aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
committermarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
commit76bcc36ed305418a3ddc5752d287ede894243e1b (patch)
treebacb320c825768471ce56f058f17ce863d592376 /xorg-server
parent7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff)
parent0f834b91a4768673833ab4917e87d86c237bb1a6 (diff)
downloadvcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip
Merge remote-tracking branch 'origin/released'
Conflicts: pixman/pixman/pixman-mmx.c xorg-server/Xext/shm.c xorg-server/Xext/syncsrv.h xorg-server/Xext/xvmain.c xorg-server/Xi/exevents.c xorg-server/Xi/opendev.c xorg-server/composite/compalloc.c xorg-server/composite/compoverlay.c xorg-server/dix/colormap.c xorg-server/dix/devices.c xorg-server/dix/dispatch.c xorg-server/dix/dixfonts.c xorg-server/dix/eventconvert.c xorg-server/dix/events.c xorg-server/dix/gc.c xorg-server/dix/getevents.c xorg-server/dix/main.c xorg-server/dix/privates.c xorg-server/dix/registry.c xorg-server/dix/resource.c xorg-server/exa/exa_accel.c xorg-server/exa/exa_migration_classic.c xorg-server/exa/exa_unaccel.c xorg-server/fb/fb.h xorg-server/fb/fbcopy.c xorg-server/fb/fbpixmap.c xorg-server/glx/dispatch.h xorg-server/glx/glapi.h xorg-server/glx/glapi_gentable.c xorg-server/glx/glapitable.h xorg-server/glx/glprocs.h xorg-server/glx/glxcmds.c xorg-server/glx/glxcmdsswap.c xorg-server/glx/glxdricommon.c xorg-server/glx/glxdriswrast.c xorg-server/glx/glxext.c xorg-server/glx/indirect_dispatch.c xorg-server/glx/indirect_dispatch.h xorg-server/glx/indirect_dispatch_swap.c xorg-server/glx/indirect_size.h xorg-server/glx/indirect_size_get.h xorg-server/glx/indirect_table.c xorg-server/glx/indirect_util.c xorg-server/glx/rensize.c xorg-server/glx/single2swap.c xorg-server/glx/singlepix.c xorg-server/glx/singlepixswap.c xorg-server/glx/singlesize.c xorg-server/hw/dmx/dmxinit.c xorg-server/hw/kdrive/ephyr/ephyr.c xorg-server/hw/kdrive/ephyr/hostx.c xorg-server/hw/kdrive/ephyr/hostx.h xorg-server/hw/kdrive/src/kinput.c xorg-server/hw/xfree86/common/compiler.h xorg-server/hw/xwin/InitInput.c xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/glx/glwrap.c xorg-server/hw/xwin/glx/indirect.c xorg-server/hw/xwin/glx/wgl_ext_api.h xorg-server/hw/xwin/glx/winpriv.c xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winallpriv.c xorg-server/hw/xwin/winauth.c xorg-server/hw/xwin/winclipboard.h xorg-server/hw/xwin/winclipboardinit.c xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winclipboardunicode.c xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winclipboardwrappers.c xorg-server/hw/xwin/winclipboardxevents.c xorg-server/hw/xwin/wincmap.c xorg-server/hw/xwin/winconfig.c xorg-server/hw/xwin/wincreatewnd.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/windialogs.c xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winerror.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/wingetsp.c xorg-server/hw/xwin/winkeybd.c xorg-server/hw/xwin/winkeybd.h xorg-server/hw/xwin/winlayouts.h xorg-server/hw/xwin/winmisc.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winmsg.h xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winmultiwindowicons.c xorg-server/hw/xwin/winmultiwindowshape.c xorg-server/hw/xwin/winmultiwindowwindow.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winmultiwindowwndproc.c xorg-server/hw/xwin/winnativegdi.c xorg-server/hw/xwin/winpfbdd.c xorg-server/hw/xwin/winpixmap.c xorg-server/hw/xwin/winpolyline.c xorg-server/hw/xwin/winprefs.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winregistry.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winshaddd.c xorg-server/hw/xwin/winshadddnl.c xorg-server/hw/xwin/winshadgdi.c xorg-server/hw/xwin/wintrayicon.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswindow.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c xorg-server/include/callback.h xorg-server/include/dixstruct.h xorg-server/include/misc.h xorg-server/include/os.h xorg-server/include/scrnintstr.h xorg-server/mi/micmap.c xorg-server/mi/miinitext.c xorg-server/mi/mioverlay.c xorg-server/mi/misprite.c xorg-server/mi/mivaltree.c xorg-server/mi/miwindow.c xorg-server/miext/damage/damage.c xorg-server/miext/rootless/rootlessGC.c xorg-server/miext/rootless/rootlessWindow.c xorg-server/os/WaitFor.c xorg-server/os/access.c xorg-server/os/connection.c xorg-server/os/io.c xorg-server/os/log.c xorg-server/os/osinit.c xorg-server/os/utils.c xorg-server/os/xdmcp.c xorg-server/os/xprintf.c xorg-server/os/xstrans.c xorg-server/render/mipict.c xorg-server/xkb/xkbActions.c xorg-server/xkb/xkbInit.c xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/Xext/dpms.c109
-rw-r--r--xorg-server/Xext/dpmsstubs.c6
-rw-r--r--xorg-server/Xext/geext.c87
-rw-r--r--xorg-server/Xext/geext.h16
-rw-r--r--xorg-server/Xext/panoramiX.c1258
-rw-r--r--xorg-server/Xext/panoramiXSwap.c101
-rw-r--r--xorg-server/Xext/panoramiXprocs.c2730
-rw-r--r--xorg-server/Xext/panoramiXsrv.h35
-rw-r--r--xorg-server/Xext/saver.c1671
-rw-r--r--xorg-server/Xext/security.c750
-rw-r--r--xorg-server/Xext/shape.c1311
-rw-r--r--xorg-server/Xext/shm.c1075
-rw-r--r--xorg-server/Xext/sleepuntil.c434
-rw-r--r--xorg-server/Xext/sleepuntil.h14
-rw-r--r--xorg-server/Xext/sync.c2484
-rw-r--r--xorg-server/Xext/syncsrv.h101
-rw-r--r--xorg-server/Xext/xace.c398
-rw-r--r--xorg-server/Xext/xace.h35
-rw-r--r--xorg-server/Xext/xcmisc.c70
-rw-r--r--xorg-server/Xext/xf86bigfont.c739
-rw-r--r--xorg-server/Xext/xres.c184
-rw-r--r--xorg-server/Xext/xselinux_hooks.c654
-rw-r--r--xorg-server/Xext/xselinux_label.c755
-rw-r--r--xorg-server/Xext/xselinuxint.h1125
-rw-r--r--xorg-server/Xext/xtest.c469
-rw-r--r--xorg-server/Xext/xvdisp.c2252
-rw-r--r--xorg-server/Xext/xvdix.h250
-rw-r--r--xorg-server/Xext/xvmain.c1332
-rw-r--r--xorg-server/Xext/xvmc.c629
-rw-r--r--xorg-server/Xext/xvmcext.h138
-rw-r--r--xorg-server/Xi/chgdctl.c91
-rw-r--r--xorg-server/Xi/chgfctl.c455
-rw-r--r--xorg-server/Xi/chgprop.c45
-rw-r--r--xorg-server/Xi/devbell.c68
-rw-r--r--xorg-server/Xi/exevents.c1803
-rw-r--r--xorg-server/Xi/extinit.c823
-rw-r--r--xorg-server/Xi/getdctl.c58
-rw-r--r--xorg-server/Xi/getprop.c63
-rw-r--r--xorg-server/Xi/grabdev.c75
-rw-r--r--xorg-server/Xi/grabdevb.c46
-rw-r--r--xorg-server/Xi/grabdevk.c43
-rw-r--r--xorg-server/Xi/listdev.c133
-rw-r--r--xorg-server/Xi/opendev.c51
-rw-r--r--xorg-server/Xi/queryst.c93
-rw-r--r--xorg-server/Xi/selectev.c45
-rw-r--r--xorg-server/Xi/sendexev.c54
-rw-r--r--xorg-server/Xi/setbmap.c12
-rw-r--r--xorg-server/Xi/setmode.c33
-rw-r--r--xorg-server/Xi/stubs.c8
-rw-r--r--xorg-server/Xi/ungrdevb.c31
-rw-r--r--xorg-server/Xi/ungrdevk.c37
-rw-r--r--xorg-server/Xi/xiallowev.c67
-rw-r--r--xorg-server/Xi/xichangecursor.c35
-rw-r--r--xorg-server/Xi/xichangehierarchy.c217
-rw-r--r--xorg-server/Xi/xigetclientpointer.c30
-rw-r--r--xorg-server/Xi/xigrabdev.c32
-rw-r--r--xorg-server/Xi/xipassivegrab.c135
-rw-r--r--xorg-server/Xi/xipassivegrab.h5
-rw-r--r--xorg-server/Xi/xiproperty.c819
-rw-r--r--xorg-server/Xi/xiproperty.h135
-rw-r--r--xorg-server/Xi/xiquerydevice.c235
-rw-r--r--xorg-server/Xi/xiquerypointer.c63
-rw-r--r--xorg-server/Xi/xiqueryversion.c27
-rw-r--r--xorg-server/Xi/xiselectev.c140
-rw-r--r--xorg-server/Xi/xisetclientpointer.c29
-rw-r--r--xorg-server/Xi/xiwarppointer.c69
-rw-r--r--xorg-server/composite/compalloc.c754
-rw-r--r--xorg-server/composite/compext.c699
-rw-r--r--xorg-server/composite/compinit.c831
-rw-r--r--xorg-server/composite/compint.h195
-rw-r--r--xorg-server/composite/compoverlay.c351
-rw-r--r--xorg-server/composite/compwindow.c800
-rw-r--r--xorg-server/config/config.c31
-rw-r--r--xorg-server/config/dbus-core.c19
-rw-r--r--xorg-server/config/dbus.c38
-rw-r--r--xorg-server/config/hal.c263
-rw-r--r--xorg-server/config/udev.c58
-rw-r--r--xorg-server/config/wscons.c334
-rw-r--r--xorg-server/configure.ac4
-rw-r--r--xorg-server/damageext/damageext.c424
-rw-r--r--xorg-server/dbe/dbe.c838
-rw-r--r--xorg-server/dbe/dbestruct.h411
-rw-r--r--xorg-server/dbe/midbe.c1536
-rw-r--r--xorg-server/dbe/midbe.h114
-rw-r--r--xorg-server/dbe/midbestr.h154
-rw-r--r--xorg-server/dix/Xserver-dtrace.h41
-rw-r--r--xorg-server/dix/Xserver-dtrace.h.in193
-rw-r--r--xorg-server/dix/Xserver.d118
-rw-r--r--xorg-server/dix/atom.c143
-rw-r--r--xorg-server/dix/colormap.c3575
-rw-r--r--xorg-server/dix/cursor.c394
-rw-r--r--xorg-server/dix/devices.c1482
-rw-r--r--xorg-server/dix/dispatch.c3408
-rw-r--r--xorg-server/dix/dixfonts.c2466
-rw-r--r--xorg-server/dix/dixutils.c677
-rw-r--r--xorg-server/dix/enterleave.c1073
-rw-r--r--xorg-server/dix/enterleave.h59
-rw-r--r--xorg-server/dix/eventconvert.c794
-rw-r--r--xorg-server/dix/events.c4213
-rw-r--r--xorg-server/dix/extension.c222
-rw-r--r--xorg-server/dix/gc.c2298
-rw-r--r--xorg-server/dix/getevents.c540
-rw-r--r--xorg-server/dix/globals.c264
-rw-r--r--xorg-server/dix/glyphcurs.c372
-rw-r--r--xorg-server/dix/grabs.c503
-rw-r--r--xorg-server/dix/initatoms.c207
-rw-r--r--xorg-server/dix/inpututils.c187
-rw-r--r--xorg-server/dix/main.c360
-rw-r--r--xorg-server/dix/makefile2
-rw-r--r--xorg-server/dix/pixmap.c268
-rw-r--r--xorg-server/dix/privates.c1058
-rw-r--r--xorg-server/dix/property.c506
-rw-r--r--xorg-server/dix/ptrveloc.c699
-rw-r--r--xorg-server/dix/region.c1166
-rw-r--r--xorg-server/dix/registry.c247
-rw-r--r--xorg-server/dix/resource.c580
-rw-r--r--xorg-server/dix/selection.c620
-rw-r--r--xorg-server/dix/swaprep.c613
-rw-r--r--xorg-server/dix/swapreq.c309
-rw-r--r--xorg-server/dix/tables.c1038
-rw-r--r--xorg-server/dix/touch.c247
-rw-r--r--xorg-server/dix/window.c4101
-rw-r--r--xorg-server/doc/dtrace/Xserver-DTrace.xml153
-rw-r--r--xorg-server/exa/exa.c627
-rw-r--r--xorg-server/exa/exa.h1659
-rw-r--r--xorg-server/exa/exa_accel.c1634
-rw-r--r--xorg-server/exa/exa_classic.c164
-rw-r--r--xorg-server/exa/exa_driver.c114
-rw-r--r--xorg-server/exa/exa_glyphs.c1702
-rw-r--r--xorg-server/exa/exa_migration_classic.c700
-rw-r--r--xorg-server/exa/exa_migration_mixed.c275
-rw-r--r--xorg-server/exa/exa_mixed.c221
-rw-r--r--xorg-server/exa/exa_offscreen.c1374
-rw-r--r--xorg-server/exa/exa_priv.h495
-rw-r--r--xorg-server/exa/exa_render.c1463
-rw-r--r--xorg-server/exa/exa_unaccel.c706
-rw-r--r--xorg-server/fb/fb.h1763
-rw-r--r--xorg-server/fb/fb24_32.c803
-rw-r--r--xorg-server/fb/fb24_32.h25
-rw-r--r--xorg-server/fb/fballpriv.c31
-rw-r--r--xorg-server/fb/fbarc.c189
-rw-r--r--xorg-server/fb/fbbits.h1846
-rw-r--r--xorg-server/fb/fbblt.c1372
-rw-r--r--xorg-server/fb/fbbltone.c964
-rw-r--r--xorg-server/fb/fbcmap_mi.c241
-rw-r--r--xorg-server/fb/fbcopy.c482
-rw-r--r--xorg-server/fb/fbfill.c326
-rw-r--r--xorg-server/fb/fbfillrect.c215
-rw-r--r--xorg-server/fb/fbfillsp.c187
-rw-r--r--xorg-server/fb/fbgc.c303
-rw-r--r--xorg-server/fb/fbgetsp.c73
-rw-r--r--xorg-server/fb/fbglyph.c583
-rw-r--r--xorg-server/fb/fbimage.c492
-rw-r--r--xorg-server/fb/fbline.c184
-rw-r--r--xorg-server/fb/fboverlay.c444
-rw-r--r--xorg-server/fb/fboverlay.h109
-rw-r--r--xorg-server/fb/fbpict.c380
-rw-r--r--xorg-server/fb/fbpict.h75
-rw-r--r--xorg-server/fb/fbpixmap.c403
-rw-r--r--xorg-server/fb/fbpoint.c200
-rw-r--r--xorg-server/fb/fbpush.c331
-rw-r--r--xorg-server/fb/fbscreen.c238
-rw-r--r--xorg-server/fb/fbseg.c1053
-rw-r--r--xorg-server/fb/fbsetsp.c118
-rw-r--r--xorg-server/fb/fbsolid.c252
-rw-r--r--xorg-server/fb/fbstipple.c348
-rw-r--r--xorg-server/fb/fbtile.c246
-rw-r--r--xorg-server/fb/fbtrap.c244
-rw-r--r--xorg-server/fb/fbutil.c483
-rw-r--r--xorg-server/fb/fbwindow.c200
-rw-r--r--xorg-server/glx/clientinfo.c12
-rw-r--r--xorg-server/glx/createcontext.c6
-rw-r--r--xorg-server/glx/dispatch.h25896
-rw-r--r--xorg-server/glx/glapi.c332
-rw-r--r--xorg-server/glx/glapi_gentable.c19032
-rw-r--r--xorg-server/glx/glapitable.h2044
-rw-r--r--xorg-server/glx/glprocs.h5698
-rw-r--r--xorg-server/glx/glthread.c144
-rw-r--r--xorg-server/glx/glthread.h69
-rw-r--r--xorg-server/glx/glxcmds.c2119
-rw-r--r--xorg-server/glx/glxcmdsswap.c1944
-rw-r--r--xorg-server/glx/glxcontext.h255
-rw-r--r--xorg-server/glx/glxdri.c995
-rw-r--r--xorg-server/glx/glxdri2.c448
-rw-r--r--xorg-server/glx/glxdricommon.c593
-rw-r--r--xorg-server/glx/glxdricommon.h92
-rw-r--r--xorg-server/glx/glxdriswrast.c276
-rw-r--r--xorg-server/glx/glxext.c369
-rw-r--r--xorg-server/glx/glxscreens.c454
-rw-r--r--xorg-server/glx/glxscreens.h53
-rw-r--r--xorg-server/glx/glxserver.h79
-rw-r--r--xorg-server/glx/indirect_dispatch.c11876
-rw-r--r--xorg-server/glx/indirect_dispatch.h2100
-rw-r--r--xorg-server/glx/indirect_dispatch_swap.c12220
-rw-r--r--xorg-server/glx/indirect_program.c131
-rw-r--r--xorg-server/glx/indirect_reqsize.h232
-rw-r--r--xorg-server/glx/indirect_size.h2
-rw-r--r--xorg-server/glx/indirect_size_get.h2
-rw-r--r--xorg-server/glx/indirect_table.c3220
-rw-r--r--xorg-server/glx/indirect_texture_compression.c129
-rw-r--r--xorg-server/glx/indirect_util.c611
-rw-r--r--xorg-server/glx/indirect_util.h34
-rw-r--r--xorg-server/glx/render2.c249
-rw-r--r--xorg-server/glx/render2swap.c372
-rw-r--r--xorg-server/glx/renderpix.c36
-rw-r--r--xorg-server/glx/renderpixswap.c62
-rw-r--r--xorg-server/glx/rensize.c479
-rw-r--r--xorg-server/glx/single2.c399
-rw-r--r--xorg-server/glx/single2swap.c552
-rw-r--r--xorg-server/glx/singlepix.c1089
-rw-r--r--xorg-server/glx/singlepixswap.c1205
-rw-r--r--xorg-server/glx/singlesize.c404
-rw-r--r--xorg-server/glx/swap_interval.c40
-rw-r--r--xorg-server/glx/xfont.c151
-rw-r--r--xorg-server/hw/dmx/config/Canvas.c132
-rw-r--r--xorg-server/hw/dmx/config/dmxcompat.c160
-rw-r--r--xorg-server/hw/dmx/config/dmxconfig.c340
-rw-r--r--xorg-server/hw/dmx/config/dmxparse.c1295
-rw-r--r--xorg-server/hw/dmx/config/dmxparse.h329
-rw-r--r--xorg-server/hw/dmx/config/dmxprint.c373
-rw-r--r--xorg-server/hw/dmx/config/dmxtodmx.c7
-rw-r--r--xorg-server/hw/dmx/config/vdltodmx.c10
-rw-r--r--xorg-server/hw/dmx/config/xdmxconfig.c1263
-rw-r--r--xorg-server/hw/dmx/dmx.c782
-rw-r--r--xorg-server/hw/dmx/dmx_glxvisuals.c1202
-rw-r--r--xorg-server/hw/dmx/dmx_glxvisuals.h26
-rw-r--r--xorg-server/hw/dmx/dmxcb.c161
-rw-r--r--xorg-server/hw/dmx/dmxcmap.c434
-rw-r--r--xorg-server/hw/dmx/dmxcursor.c2012
-rw-r--r--xorg-server/hw/dmx/dmxdpms.c117
-rw-r--r--xorg-server/hw/dmx/dmxextension.c1770
-rw-r--r--xorg-server/hw/dmx/dmxextension.h99
-rw-r--r--xorg-server/hw/dmx/dmxfont.c1123
-rw-r--r--xorg-server/hw/dmx/dmxgc.c382
-rw-r--r--xorg-server/hw/dmx/dmxgcops.c476
-rw-r--r--xorg-server/hw/dmx/dmxinit.c850
-rw-r--r--xorg-server/hw/dmx/dmxinput.c27
-rw-r--r--xorg-server/hw/dmx/dmxinput.h78
-rw-r--r--xorg-server/hw/dmx/dmxlog.c310
-rw-r--r--xorg-server/hw/dmx/dmxpict.c2517
-rw-r--r--xorg-server/hw/dmx/dmxpict.h236
-rw-r--r--xorg-server/hw/dmx/dmxpixmap.c513
-rw-r--r--xorg-server/hw/dmx/dmxprop.c241
-rw-r--r--xorg-server/hw/dmx/dmxprop.h13
-rw-r--r--xorg-server/hw/dmx/dmxscrinit.c1047
-rw-r--r--xorg-server/hw/dmx/dmxshadow.c141
-rw-r--r--xorg-server/hw/dmx/dmxstat.c459
-rw-r--r--xorg-server/hw/dmx/dmxsync.c400
-rw-r--r--xorg-server/hw/dmx/dmxvisual.c82
-rw-r--r--xorg-server/hw/dmx/dmxwindow.c1019
-rw-r--r--xorg-server/hw/dmx/dmxwindow.h267
-rw-r--r--xorg-server/hw/dmx/examples/dmxaddinput.c20
-rw-r--r--xorg-server/hw/dmx/examples/dmxaddscreen.c61
-rw-r--r--xorg-server/hw/dmx/examples/dmxinfo.c129
-rw-r--r--xorg-server/hw/dmx/examples/dmxreconfig.c139
-rw-r--r--xorg-server/hw/dmx/examples/dmxresize.c27
-rw-r--r--xorg-server/hw/dmx/examples/dmxrminput.c13
-rw-r--r--xorg-server/hw/dmx/examples/dmxrmscreen.c15
-rw-r--r--xorg-server/hw/dmx/examples/dmxwininfo.c748
-rw-r--r--xorg-server/hw/dmx/examples/ev.c218
-rw-r--r--xorg-server/hw/dmx/examples/evi.c21
-rw-r--r--xorg-server/hw/dmx/examples/res.c32
-rw-r--r--xorg-server/hw/dmx/examples/xbell.c45
-rw-r--r--xorg-server/hw/dmx/examples/xinput.c215
-rw-r--r--xorg-server/hw/dmx/examples/xled.c28
-rw-r--r--xorg-server/hw/dmx/examples/xtest.c14
-rw-r--r--xorg-server/hw/dmx/glxProxy/compsize.c866
-rw-r--r--xorg-server/hw/dmx/glxProxy/g_disptab.c1128
-rw-r--r--xorg-server/hw/dmx/glxProxy/g_disptab.h1252
-rw-r--r--xorg-server/hw/dmx/glxProxy/g_renderswap.c2735
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmds.c4513
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmdsswap.c927
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxext.c1013
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxext.h149
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxfbconfig.c212
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxfbconfig.h5
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxscreens.c499
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxserver.h189
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxsingle.c1332
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxswap.c1100
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxutil.c71
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxutil.h83
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvendor.c753
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvendor.h27
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvisuals.c310
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvisuals.h88
-rw-r--r--xorg-server/hw/dmx/glxProxy/render2swap.c219
-rw-r--r--xorg-server/hw/dmx/glxProxy/renderpixswap.c789
-rw-r--r--xorg-server/hw/dmx/input/ChkNotMaskEv.c68
-rw-r--r--xorg-server/hw/dmx/input/dmxarg.c69
-rw-r--r--xorg-server/hw/dmx/input/dmxbackend.c1281
-rw-r--r--xorg-server/hw/dmx/input/dmxcommon.c1367
-rw-r--r--xorg-server/hw/dmx/input/dmxconsole.c2119
-rw-r--r--xorg-server/hw/dmx/input/dmxdetach.c4
-rw-r--r--xorg-server/hw/dmx/input/dmxdummy.c50
-rw-r--r--xorg-server/hw/dmx/input/dmxevents.c412
-rw-r--r--xorg-server/hw/dmx/input/dmxinputinit.c829
-rw-r--r--xorg-server/hw/dmx/input/dmxinputinit.h575
-rw-r--r--xorg-server/hw/dmx/input/dmxmap.c28
-rw-r--r--xorg-server/hw/dmx/input/dmxmotion.c290
-rw-r--r--xorg-server/hw/dmx/input/dmxmotion.h11
-rw-r--r--xorg-server/hw/dmx/input/dmxsigio.c115
-rw-r--r--xorg-server/hw/dmx/input/dmxxinput.c151
-rw-r--r--xorg-server/hw/dmx/input/lnx-keyboard.c1116
-rw-r--r--xorg-server/hw/dmx/input/lnx-ms.c669
-rw-r--r--xorg-server/hw/dmx/input/lnx-ps2.c607
-rw-r--r--xorg-server/hw/dmx/input/usb-common.c331
-rw-r--r--xorg-server/hw/dmx/input/usb-common.h15
-rw-r--r--xorg-server/hw/dmx/input/usb-keyboard.c921
-rw-r--r--xorg-server/hw/dmx/input/usb-keyboard.h17
-rw-r--r--xorg-server/hw/dmx/input/usb-mouse.c67
-rw-r--r--xorg-server/hw/dmx/input/usb-mouse.h17
-rw-r--r--xorg-server/hw/dmx/input/usb-other.c85
-rw-r--r--xorg-server/hw/dmx/input/usb-other.h17
-rw-r--r--xorg-server/hw/kdrive/ephyr/XF86dri.c1275
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.c1463
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.h105
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr_draw.c76
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdri.c328
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdri.h77
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdriext.c1480
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdriext.h10
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrglxext.c1434
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostglx.c666
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostglx.h59
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c51
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h26
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c1053
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h237
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrinit.c494
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrproxyext.c82
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrvideo.c2491
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.c1795
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.h240
-rw-r--r--xorg-server/hw/kdrive/ephyr/os.c22
-rw-r--r--xorg-server/hw/kdrive/ephyr/xf86dri.h80
-rw-r--r--xorg-server/hw/kdrive/fake/fake.c922
-rw-r--r--xorg-server/hw/kdrive/fake/fake.h85
-rw-r--r--xorg-server/hw/kdrive/fbdev/fbdev.c789
-rw-r--r--xorg-server/hw/kdrive/fbdev/fbinit.c98
-rw-r--r--xorg-server/hw/kdrive/linux/evdev.c1058
-rw-r--r--xorg-server/hw/kdrive/linux/keyboard.c1015
-rw-r--r--xorg-server/hw/kdrive/linux/linux.c385
-rw-r--r--xorg-server/hw/kdrive/linux/mouse.c956
-rw-r--r--xorg-server/hw/kdrive/linux/ms.c134
-rw-r--r--xorg-server/hw/kdrive/linux/ps2.c142
-rw-r--r--xorg-server/hw/kdrive/linux/tslib.c48
-rw-r--r--xorg-server/hw/kdrive/src/kcmap.c159
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.c1205
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.h555
-rw-r--r--xorg-server/hw/kdrive/src/kinfo.c71
-rw-r--r--xorg-server/hw/kdrive/src/kinput.c1358
-rw-r--r--xorg-server/hw/kdrive/src/kmode.c542
-rw-r--r--xorg-server/hw/kdrive/src/kshadow.c43
-rw-r--r--xorg-server/hw/kdrive/src/kxv.c3797
-rw-r--r--xorg-server/hw/kdrive/src/kxv.h318
-rw-r--r--xorg-server/hw/vfb/InitInput.c65
-rw-r--r--xorg-server/hw/vfb/InitOutput.c811
-rw-r--r--xorg-server/hw/xfree86/common/compiler.h1524
-rw-r--r--xorg-server/hw/xfree86/common/vidmodeproc.h39
-rw-r--r--xorg-server/hw/xfree86/common/xf86.h377
-rw-r--r--xorg-server/hw/xfree86/common/xf86AutoConfig.c172
-rw-r--r--xorg-server/hw/xfree86/common/xf86Bus.c296
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c2163
-rw-r--r--xorg-server/hw/xfree86/common/xf86Configure.c827
-rw-r--r--xorg-server/hw/xfree86/common/xf86Cursor.c1170
-rw-r--r--xorg-server/hw/xfree86/common/xf86DGA.c1382
-rw-r--r--xorg-server/hw/xfree86/common/xf86Events.c519
-rw-r--r--xorg-server/hw/xfree86/common/xf86Globals.c95
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c1339
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c2146
-rw-r--r--xorg-server/hw/xfree86/common/xf86Mode.c2339
-rw-r--r--xorg-server/hw/xfree86/common/xf86Module.h110
-rw-r--r--xorg-server/hw/xfree86/common/xf86Opt.h135
-rw-r--r--xorg-server/hw/xfree86/common/xf86Option.c817
-rw-r--r--xorg-server/hw/xfree86/common/xf86Optionstr.h16
-rw-r--r--xorg-server/hw/xfree86/common/xf86PM.c223
-rw-r--r--xorg-server/hw/xfree86/common/xf86Priv.h136
-rw-r--r--xorg-server/hw/xfree86/common/xf86RandR.c505
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiter.c626
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h521
-rw-r--r--xorg-server/hw/xfree86/common/xf86VidMode.c357
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c468
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.h177
-rw-r--r--xorg-server/hw/xfree86/common/xf86cmap.c2364
-rw-r--r--xorg-server/hw/xfree86/common/xf86cmap.h146
-rw-r--r--xorg-server/hw/xfree86/common/xf86fbman.c2877
-rw-r--r--xorg-server/hw/xfree86/common/xf86fbman.h221
-rw-r--r--xorg-server/hw/xfree86/common/xf86pciBus.c1440
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.c711
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.h215
-rw-r--r--xorg-server/hw/xfree86/common/xf86str.h898
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.c3153
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.h559
-rw-r--r--xorg-server/hw/xfree86/common/xf86xvmc.c456
-rw-r--r--xorg-server/hw/xfree86/common/xf86xvmc.h112
-rw-r--r--xorg-server/hw/xfree86/common/xisb.c342
-rw-r--r--xorg-server/hw/xfree86/common/xisb.h30
-rw-r--r--xorg-server/hw/xfree86/ddc/ddc.c351
-rw-r--r--xorg-server/hw/xfree86/ddc/ddcProperty.c31
-rw-r--r--xorg-server/hw/xfree86/ddc/edid.h327
-rw-r--r--xorg-server/hw/xfree86/ddc/interpret_edid.c1399
-rw-r--r--xorg-server/hw/xfree86/ddc/print_edid.c644
-rw-r--r--xorg-server/hw/xfree86/ddc/xf86DDC.h64
-rw-r--r--xorg-server/hw/xfree86/dixmods/dbemodule.c25
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h128
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/modinit.c361
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/modinit.h179
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c552
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c2458
-rw-r--r--xorg-server/hw/xfree86/dixmods/fbmodule.c28
-rw-r--r--xorg-server/hw/xfree86/dixmods/glxmodule.c51
-rw-r--r--xorg-server/hw/xfree86/dixmods/shmodule.c23
-rw-r--r--xorg-server/hw/xfree86/dri/dri.c2423
-rw-r--r--xorg-server/hw/xfree86/dri/dri.h295
-rw-r--r--xorg-server/hw/xfree86/dri/drimodule.c40
-rw-r--r--xorg-server/hw/xfree86/dri/dristruct.h253
-rw-r--r--xorg-server/hw/xfree86/dri/xf86dri.c473
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c946
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.h178
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2ext.c228
-rw-r--r--xorg-server/hw/xfree86/exa/examodule.c153
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/fbdevhw.c1173
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/fbdevhw.h98
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c92
-rw-r--r--xorg-server/hw/xfree86/i2c/bt829.c1566
-rw-r--r--xorg-server/hw/xfree86/i2c/bt829_module.c41
-rw-r--r--xorg-server/hw/xfree86/i2c/fi1236.c277
-rw-r--r--xorg-server/hw/xfree86/i2c/fi1236_module.c49
-rw-r--r--xorg-server/hw/xfree86/i2c/msp3430.c1184
-rw-r--r--xorg-server/hw/xfree86/i2c/msp3430_module.c49
-rw-r--r--xorg-server/hw/xfree86/i2c/tda8425.c161
-rw-r--r--xorg-server/hw/xfree86/i2c/tda8425.h29
-rw-r--r--xorg-server/hw/xfree86/i2c/tda8425_module.c49
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9850.c248
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9850_module.c49
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9885.c204
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9885_module.c49
-rw-r--r--xorg-server/hw/xfree86/i2c/uda1380.c379
-rw-r--r--xorg-server/hw/xfree86/i2c/uda1380_module.c49
-rw-r--r--xorg-server/hw/xfree86/i2c/xf86i2c.c1745
-rw-r--r--xorg-server/hw/xfree86/i2c/xf86i2c.h103
-rw-r--r--xorg-server/hw/xfree86/int10/generic.c262
-rw-r--r--xorg-server/hw/xfree86/int10/helper_exec.c547
-rw-r--r--xorg-server/hw/xfree86/int10/helper_mem.c182
-rw-r--r--xorg-server/hw/xfree86/int10/xf86int10.c1238
-rw-r--r--xorg-server/hw/xfree86/int10/xf86int10.h70
-rw-r--r--xorg-server/hw/xfree86/int10/xf86int10module.c75
-rw-r--r--xorg-server/hw/xfree86/loader/loader.c55
-rw-r--r--xorg-server/hw/xfree86/loader/loadext.c880
-rw-r--r--xorg-server/hw/xfree86/loader/loadmod.c1097
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c3693
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.h496
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Cursors.c632
-rw-r--r--xorg-server/hw/xfree86/modes/xf86DiDGA.c431
-rw-r--r--xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c889
-rw-r--r--xorg-server/hw/xfree86/modes/xf86EdidModes.c1068
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.c636
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.h70
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.c2146
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.h89
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Rotate.c658
-rw-r--r--xorg-server/hw/xfree86/modes/xf86cvt.c63
-rw-r--r--xorg-server/hw/xfree86/modes/xf86gtf.c84
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/alpha_video.c606
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/arm_video.c741
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c96
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c65
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_bell.c48
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_init.c778
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_kmod.c7
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c134
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/i386_video.c1113
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/memrange.h57
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/ppc_video.c105
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c40
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/Sbus.c627
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/nobus.c6
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/xf86Pci.h11
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_init.c43
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c188
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_video.c307
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/int10/linux.c544
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c390
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_agp.c745
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_apm.c153
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_axp.c166
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_init.c342
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_video.c808
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c87
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/bios_mmap.c128
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/kmod_noop.c5
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/posix_tty.c847
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/sigio.c610
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/vidmem.c317
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/xf86Axp.c41
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c271
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_apm.c453
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_bell.c363
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_init.c502
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_vid.c505
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86_OSproc.h101
-rw-r--r--xorg-server/hw/xfree86/parser/Configint.h17
-rw-r--r--xorg-server/hw/xfree86/parser/DRI.c101
-rw-r--r--xorg-server/hw/xfree86/parser/Device.c531
-rw-r--r--xorg-server/hw/xfree86/parser/Extensions.c66
-rw-r--r--xorg-server/hw/xfree86/parser/Files.c299
-rw-r--r--xorg-server/hw/xfree86/parser/Flags.c649
-rw-r--r--xorg-server/hw/xfree86/parser/Input.c217
-rw-r--r--xorg-server/hw/xfree86/parser/InputClass.c24
-rw-r--r--xorg-server/hw/xfree86/parser/Layout.c838
-rw-r--r--xorg-server/hw/xfree86/parser/Module.c329
-rw-r--r--xorg-server/hw/xfree86/parser/Monitor.c1465
-rw-r--r--xorg-server/hw/xfree86/parser/Pointer.c290
-rw-r--r--xorg-server/hw/xfree86/parser/Screen.c874
-rw-r--r--xorg-server/hw/xfree86/parser/Vendor.c270
-rw-r--r--xorg-server/hw/xfree86/parser/Video.c346
-rw-r--r--xorg-server/hw/xfree86/parser/configProcs.h86
-rw-r--r--xorg-server/hw/xfree86/parser/read.c610
-rw-r--r--xorg-server/hw/xfree86/parser/scan.c1541
-rw-r--r--xorg-server/hw/xfree86/parser/write.c421
-rw-r--r--xorg-server/hw/xfree86/parser/xf86Optrec.h24
-rw-r--r--xorg-server/hw/xfree86/parser/xf86Parser.h721
-rw-r--r--xorg-server/hw/xfree86/ramdac/BT.c158
-rw-r--r--xorg-server/hw/xfree86/ramdac/BT.h15
-rw-r--r--xorg-server/hw/xfree86/ramdac/IBM.c1282
-rw-r--r--xorg-server/hw/xfree86/ramdac/IBM.h73
-rw-r--r--xorg-server/hw/xfree86/ramdac/TI.c1442
-rw-r--r--xorg-server/hw/xfree86/ramdac/TI.h41
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86Cursor.c366
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86Cursor.h21
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86HWCurs.c433
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86RamDac.h103
-rw-r--r--xorg-server/hw/xfree86/sdksyms.sh5
-rw-r--r--xorg-server/hw/xfree86/shadowfb/sfbmodule.c23
-rw-r--r--xorg-server/hw/xfree86/shadowfb/shadow.c3322
-rw-r--r--xorg-server/hw/xfree86/shadowfb/shadowfb.h18
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/cvt.c100
-rw-r--r--xorg-server/hw/xfree86/utils/gtf/gtf.c324
-rw-r--r--xorg-server/hw/xfree86/vbe/vbe.c1032
-rw-r--r--xorg-server/hw/xfree86/vbe/vbe.h698
-rw-r--r--xorg-server/hw/xfree86/vbe/vbeModes.c902
-rw-r--r--xorg-server/hw/xfree86/vbe/vbeModes.h30
-rw-r--r--xorg-server/hw/xfree86/vbe/vbe_module.c45
-rw-r--r--xorg-server/hw/xfree86/vgahw/vgaCmap.c580
-rw-r--r--xorg-server/hw/xfree86/vgahw/vgaHW.c1385
-rw-r--r--xorg-server/hw/xfree86/vgahw/vgaHW.h184
-rw-r--r--xorg-server/hw/xfree86/x86emu/debug.c507
-rw-r--r--xorg-server/hw/xfree86/x86emu/decode.c1068
-rw-r--r--xorg-server/hw/xfree86/x86emu/fpu.c449
-rw-r--r--xorg-server/hw/xfree86/x86emu/ops.c24059
-rw-r--r--xorg-server/hw/xfree86/x86emu/ops2.c1877
-rw-r--r--xorg-server/hw/xfree86/x86emu/prim_ops.c3147
-rw-r--r--xorg-server/hw/xfree86/x86emu/sys.c427
-rw-r--r--xorg-server/hw/xfree86/x86emu/validate.c50
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h36
-rw-r--r--xorg-server/hw/xfree86/xaa/xaa.h2432
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaBitBlt.c450
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaBitmap.c653
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaCpyArea.c796
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaCpyPlane.c412
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaCpyWin.c160
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaDashLine.c687
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaFallback.c632
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaFillArc.c415
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaFillPoly.c1953
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaFillRect.c2196
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaGC.c710
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaGCmisc.c709
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaImage.c1055
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInit.c1272
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInitAccel.c3069
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaLine.c816
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaLineMisc.c299
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c194
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaNonTEText.c1182
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaOffscreen.c325
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaOverlay.c251
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaOverlayDF.c1959
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaPCache.c4901
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaPict.c1309
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaROP.c242
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaRect.c257
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaSpans.c1758
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaStateChange.c3292
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaStipple.c1197
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaTEGlyph.c2160
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaTEText.c606
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaTables.c198
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaWideLine.c1845
-rw-r--r--xorg-server/hw/xfree86/xaa/xaalocal.h2582
-rw-r--r--xorg-server/hw/xfree86/xaa/xaarop.h10
-rw-r--r--xorg-server/hw/xnest/Args.c262
-rw-r--r--xorg-server/hw/xnest/Color.c988
-rw-r--r--xorg-server/hw/xnest/Cursor.c355
-rw-r--r--xorg-server/hw/xnest/Display.c274
-rw-r--r--xorg-server/hw/xnest/Events.c261
-rw-r--r--xorg-server/hw/xnest/Font.c174
-rw-r--r--xorg-server/hw/xnest/GC.c412
-rw-r--r--xorg-server/hw/xnest/GCOps.c653
-rw-r--r--xorg-server/hw/xnest/GCOps.h58
-rw-r--r--xorg-server/hw/xnest/Init.c117
-rw-r--r--xorg-server/hw/xnest/Keyboard.c375
-rw-r--r--xorg-server/hw/xnest/Pointer.c89
-rw-r--r--xorg-server/hw/xnest/Screen.c850
-rw-r--r--xorg-server/hw/xnest/Window.c1036
-rw-r--r--xorg-server/hw/xnest/XNCursor.h25
-rw-r--r--xorg-server/hw/xquartz/GL/capabilities.c651
-rw-r--r--xorg-server/hw/xquartz/GL/glcontextmodes.c1088
-rw-r--r--xorg-server/hw/xquartz/GL/glcontextmodes.h34
-rw-r--r--xorg-server/hw/xquartz/GL/indirect.c459
-rw-r--r--xorg-server/hw/xquartz/GL/visualConfigs.c282
-rw-r--r--xorg-server/hw/xquartz/X11Application.h96
-rw-r--r--xorg-server/hw/xquartz/X11Application.m2004
-rw-r--r--xorg-server/hw/xquartz/X11Controller.h71
-rw-r--r--xorg-server/hw/xquartz/X11Controller.m1346
-rw-r--r--xorg-server/hw/xquartz/applewm.c301
-rw-r--r--xorg-server/hw/xquartz/applewmExt.h59
-rw-r--r--xorg-server/hw/xquartz/console_redirect.c222
-rw-r--r--xorg-server/hw/xquartz/darwin.c540
-rw-r--r--xorg-server/hw/xquartz/darwin.h49
-rw-r--r--xorg-server/hw/xquartz/darwinEvents.c569
-rw-r--r--xorg-server/hw/xquartz/darwinEvents.h49
-rw-r--r--xorg-server/hw/xquartz/darwinXinput.c27
-rw-r--r--xorg-server/hw/xquartz/keysym2ucs.c1622
-rw-r--r--xorg-server/hw/xquartz/mach-startup/bundle-main.c496
-rw-r--r--xorg-server/hw/xquartz/mach-startup/launchd_fd.c56
-rw-r--r--xorg-server/hw/xquartz/mach-startup/stub.c210
-rw-r--r--xorg-server/hw/xquartz/pbproxy/app-main.m62
-rw-r--r--xorg-server/hw/xquartz/pbproxy/main.m87
-rw-r--r--xorg-server/hw/xquartz/pbproxy/pbproxy.h24
-rw-r--r--xorg-server/hw/xquartz/pbproxy/trick_autotools.c6
-rw-r--r--xorg-server/hw/xquartz/pbproxy/x-input.m176
-rw-r--r--xorg-server/hw/xquartz/pbproxy/x-selection.h66
-rw-r--r--xorg-server/hw/xquartz/pbproxy/x-selection.m1747
-rw-r--r--xorg-server/hw/xquartz/pseudoramiX.c270
-rw-r--r--xorg-server/hw/xquartz/quartz.c220
-rw-r--r--xorg-server/hw/xquartz/quartzCocoa.m137
-rw-r--r--xorg-server/hw/xquartz/quartzCommon.h106
-rw-r--r--xorg-server/hw/xquartz/quartzKeyboard.c771
-rw-r--r--xorg-server/hw/xquartz/quartzRandR.c393
-rw-r--r--xorg-server/hw/xquartz/quartzStartup.c55
-rw-r--r--xorg-server/hw/xquartz/xpr/appledri.c211
-rw-r--r--xorg-server/hw/xquartz/xpr/appledristr.h309
-rw-r--r--xorg-server/hw/xquartz/xpr/dri.c549
-rw-r--r--xorg-server/hw/xquartz/xpr/dri.h58
-rw-r--r--xorg-server/hw/xquartz/xpr/driWrap.c1089
-rw-r--r--xorg-server/hw/xquartz/xpr/dristruct.h31
-rw-r--r--xorg-server/hw/xquartz/xpr/x-hash.c188
-rw-r--r--xorg-server/hw/xquartz/xpr/x-hash.h64
-rw-r--r--xorg-server/hw/xquartz/xpr/x-hook.c231
-rw-r--r--xorg-server/hw/xquartz/xpr/x-hook.h14
-rw-r--r--xorg-server/hw/xquartz/xpr/x-list.c164
-rw-r--r--xorg-server/hw/xquartz/xpr/xprAppleWM.c71
-rw-r--r--xorg-server/hw/xquartz/xpr/xprCursor.c101
-rw-r--r--xorg-server/hw/xquartz/xpr/xprEvent.c39
-rw-r--r--xorg-server/hw/xquartz/xpr/xprFrame.c224
-rw-r--r--xorg-server/hw/xquartz/xpr/xprScreen.c268
-rw-r--r--xorg-server/hw/xwin/InitInput.c98
-rw-r--r--xorg-server/hw/xwin/InitOutput.c1082
-rw-r--r--xorg-server/hw/xwin/glx/glwindows.h20
-rw-r--r--xorg-server/hw/xwin/glx/glwrap.c84
-rw-r--r--xorg-server/hw/xwin/glx/indirect.c2531
-rw-r--r--xorg-server/hw/xwin/glx/wgl_ext_api.h170
-rw-r--r--xorg-server/hw/xwin/glx/winpriv.c52
-rw-r--r--xorg-server/hw/xwin/win.h981
-rw-r--r--xorg-server/hw/xwin/winallpriv.c346
-rw-r--r--xorg-server/hw/xwin/winauth.c413
-rw-r--r--xorg-server/hw/xwin/winblock.c185
-rw-r--r--xorg-server/hw/xwin/winclipboard.h39
-rw-r--r--xorg-server/hw/xwin/winclipboardinit.c285
-rw-r--r--xorg-server/hw/xwin/winclipboardtextconv.c166
-rw-r--r--xorg-server/hw/xwin/winclipboardthread.c562
-rw-r--r--xorg-server/hw/xwin/winclipboardunicode.c26
-rw-r--r--xorg-server/hw/xwin/winclipboardwndproc.c600
-rw-r--r--xorg-server/hw/xwin/winclipboardwrappers.c475
-rw-r--r--xorg-server/hw/xwin/winclipboardxevents.c1321
-rw-r--r--xorg-server/hw/xwin/wincmap.c1169
-rw-r--r--xorg-server/hw/xwin/winconfig.c1485
-rw-r--r--xorg-server/hw/xwin/winconfig.h588
-rw-r--r--xorg-server/hw/xwin/wincreatewnd.c850
-rw-r--r--xorg-server/hw/xwin/wincursor.c1241
-rw-r--r--xorg-server/hw/xwin/windialogs.c965
-rw-r--r--xorg-server/hw/xwin/winengine.c406
-rw-r--r--xorg-server/hw/xwin/winerror.c97
-rw-r--r--xorg-server/hw/xwin/winfillsp.c1673
-rw-r--r--xorg-server/hw/xwin/wingc.c318
-rw-r--r--xorg-server/hw/xwin/wingetsp.c321
-rw-r--r--xorg-server/hw/xwin/winkeybd.c638
-rw-r--r--xorg-server/hw/xwin/winkeybd.h520
-rw-r--r--xorg-server/hw/xwin/winkeyhook.c359
-rw-r--r--xorg-server/hw/xwin/winlayouts.h194
-rw-r--r--xorg-server/hw/xwin/winmisc.c119
-rw-r--r--xorg-server/hw/xwin/winmonitors.c33
-rw-r--r--xorg-server/hw/xwin/winmouse.c443
-rw-r--r--xorg-server/hw/xwin/winmsg.c90
-rw-r--r--xorg-server/hw/xwin/winmultiwindowclass.c450
-rw-r--r--xorg-server/hw/xwin/winmultiwindowicons.c1001
-rw-r--r--xorg-server/hw/xwin/winmultiwindowshape.c421
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwindow.c1105
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwm.c2401
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwndproc.c1647
-rw-r--r--xorg-server/hw/xwin/winnativegdi.c627
-rw-r--r--xorg-server/hw/xwin/winpfbdd.c972
-rw-r--r--xorg-server/hw/xwin/winpixmap.c362
-rw-r--r--xorg-server/hw/xwin/winpolyline.c24
-rw-r--r--xorg-server/hw/xwin/winprefs.c1163
-rw-r--r--xorg-server/hw/xwin/winprefs.h159
-rw-r--r--xorg-server/hw/xwin/winprocarg.c1792
-rw-r--r--xorg-server/hw/xwin/winrandr.c228
-rw-r--r--xorg-server/hw/xwin/winregistry.c44
-rw-r--r--xorg-server/hw/xwin/winrop.c134
-rw-r--r--xorg-server/hw/xwin/winscrinit.c1084
-rw-r--r--xorg-server/hw/xwin/winsetsp.c357
-rw-r--r--xorg-server/hw/xwin/winshaddd.c1860
-rw-r--r--xorg-server/hw/xwin/winshadddnl.c1727
-rw-r--r--xorg-server/hw/xwin/winshadgdi.c1628
-rw-r--r--xorg-server/hw/xwin/wintrayicon.c266
-rw-r--r--xorg-server/hw/xwin/winvalargs.c210
-rw-r--r--xorg-server/hw/xwin/winvideo.c95
-rw-r--r--xorg-server/hw/xwin/winwakeup.c116
-rw-r--r--xorg-server/hw/xwin/winwin32rootless.c1285
-rw-r--r--xorg-server/hw/xwin/winwin32rootlesswindow.c578
-rw-r--r--xorg-server/hw/xwin/winwin32rootlesswndproc.c1944
-rw-r--r--xorg-server/hw/xwin/winwindow.c710
-rw-r--r--xorg-server/hw/xwin/winwindow.h84
-rw-r--r--xorg-server/hw/xwin/winwindowswm.c804
-rw-r--r--xorg-server/hw/xwin/winwndproc.c2055
-rw-r--r--xorg-server/include/XIstubs.h95
-rw-r--r--xorg-server/include/Xprintf.h138
-rw-r--r--xorg-server/include/callback.h192
-rw-r--r--xorg-server/include/client.h13
-rw-r--r--xorg-server/include/colormap.h359
-rw-r--r--xorg-server/include/colormapst.h74
-rw-r--r--xorg-server/include/cursor.h130
-rw-r--r--xorg-server/include/dix.h726
-rw-r--r--xorg-server/include/dixevents.h72
-rw-r--r--xorg-server/include/dixfont.h367
-rw-r--r--xorg-server/include/dixgrabs.h45
-rw-r--r--xorg-server/include/dixstruct.h165
-rw-r--r--xorg-server/include/eventstr.h57
-rw-r--r--xorg-server/include/exevents.h403
-rw-r--r--xorg-server/include/extension.h11
-rw-r--r--xorg-server/include/extinit.h16
-rw-r--r--xorg-server/include/extnsionst.h62
-rw-r--r--xorg-server/include/gc.h310
-rw-r--r--xorg-server/include/gcstruct.h614
-rw-r--r--xorg-server/include/input.h702
-rw-r--r--xorg-server/include/inputstr.h558
-rw-r--r--xorg-server/include/inpututils.h23
-rw-r--r--xorg-server/include/list.h15
-rw-r--r--xorg-server/include/misc.h93
-rw-r--r--xorg-server/include/os.h579
-rw-r--r--xorg-server/include/pixmap.h231
-rw-r--r--xorg-server/include/privates.h80
-rw-r--r--xorg-server/include/property.h72
-rw-r--r--xorg-server/include/regionstr.h183
-rw-r--r--xorg-server/include/resource.h181
-rw-r--r--xorg-server/include/screenint.h21
-rw-r--r--xorg-server/include/scrnintstr.h792
-rw-r--r--xorg-server/include/swaprep.h430
-rw-r--r--xorg-server/include/swapreq.h8
-rw-r--r--xorg-server/include/window.h302
-rw-r--r--xorg-server/include/xkbfile.h354
-rw-r--r--xorg-server/include/xkbrules.h105
-rw-r--r--xorg-server/include/xkbsrv.h1468
-rw-r--r--xorg-server/mi/mi.h827
-rw-r--r--xorg-server/mi/miarc.c5238
-rw-r--r--xorg-server/mi/mibitblt.c853
-rw-r--r--xorg-server/mi/micmap.c705
-rw-r--r--xorg-server/mi/micmap.h130
-rw-r--r--xorg-server/mi/micopy.c663
-rw-r--r--xorg-server/mi/midash.c40
-rw-r--r--xorg-server/mi/midispcur.c548
-rw-r--r--xorg-server/mi/mieq.c348
-rw-r--r--xorg-server/mi/miexpose.c759
-rw-r--r--xorg-server/mi/mifillarc.c1510
-rw-r--r--xorg-server/mi/mifillarc.h31
-rw-r--r--xorg-server/mi/mifillrct.c275
-rw-r--r--xorg-server/mi/mifpoly.h40
-rw-r--r--xorg-server/mi/mifpolycon.c529
-rw-r--r--xorg-server/mi/migc.c479
-rw-r--r--xorg-server/mi/migc.h64
-rw-r--r--xorg-server/mi/miglblt.c488
-rw-r--r--xorg-server/mi/miinitext.c263
-rw-r--r--xorg-server/mi/miline.h345
-rw-r--r--xorg-server/mi/mioverlay.c3854
-rw-r--r--xorg-server/mi/mioverlay.h24
-rw-r--r--xorg-server/mi/mipointer.c319
-rw-r--r--xorg-server/mi/mipointer.h175
-rw-r--r--xorg-server/mi/mipoly.c77
-rw-r--r--xorg-server/mi/mipoly.h80
-rw-r--r--xorg-server/mi/mipolycon.c482
-rw-r--r--xorg-server/mi/mipolygen.c443
-rw-r--r--xorg-server/mi/mipolypnt.c237
-rw-r--r--xorg-server/mi/mipolyrect.c362
-rw-r--r--xorg-server/mi/mipolyseg.c12
-rw-r--r--xorg-server/mi/mipolytext.c62
-rw-r--r--xorg-server/mi/mipolyutil.c754
-rw-r--r--xorg-server/mi/mipushpxl.c520
-rw-r--r--xorg-server/mi/miscrinit.c589
-rw-r--r--xorg-server/mi/mispans.c719
-rw-r--r--xorg-server/mi/mispans.h179
-rw-r--r--xorg-server/mi/misprite.c700
-rw-r--r--xorg-server/mi/misprite.h98
-rw-r--r--xorg-server/mi/mivaltree.c897
-rw-r--r--xorg-server/mi/miwideline.c3144
-rw-r--r--xorg-server/mi/miwideline.h239
-rw-r--r--xorg-server/mi/miwindow.c1584
-rw-r--r--xorg-server/mi/mizerarc.c1615
-rw-r--r--xorg-server/mi/mizerarc.h10
-rw-r--r--xorg-server/mi/mizerclip.c370
-rw-r--r--xorg-server/mi/mizerline.c389
-rw-r--r--xorg-server/miext/cw/cw.c1051
-rw-r--r--xorg-server/miext/cw/cw_ops.c223
-rw-r--r--xorg-server/miext/cw/cw_render.c788
-rw-r--r--xorg-server/miext/damage/damage.c2479
-rw-r--r--xorg-server/miext/damage/damage.h85
-rw-r--r--xorg-server/miext/rootless/rootless.h731
-rw-r--r--xorg-server/miext/rootless/rootlessCommon.c908
-rw-r--r--xorg-server/miext/rootless/rootlessGC.c2953
-rw-r--r--xorg-server/miext/rootless/rootlessScreen.c233
-rw-r--r--xorg-server/miext/rootless/rootlessValTree.c589
-rw-r--r--xorg-server/miext/rootless/rootlessWindow.c3289
-rw-r--r--xorg-server/miext/rootless/rootlessWindow.h123
-rw-r--r--xorg-server/miext/shadow/shadow.c92
-rw-r--r--xorg-server/miext/shadow/shadow.h114
-rw-r--r--xorg-server/miext/shadow/shpacked.c128
-rw-r--r--xorg-server/miext/shadow/shplanar.c162
-rw-r--r--xorg-server/miext/shadow/shplanar8.c151
-rw-r--r--xorg-server/miext/shadow/shrotate.c425
-rw-r--r--xorg-server/miext/shadow/shrotpack.h111
-rw-r--r--xorg-server/miext/shadow/shrotpackYX.h151
-rw-r--r--xorg-server/miext/sync/misync.c401
-rw-r--r--xorg-server/miext/sync/misync.h156
-rw-r--r--xorg-server/miext/sync/misyncstr.h168
-rw-r--r--xorg-server/os/WaitFor.c619
-rw-r--r--xorg-server/os/access.c2200
-rw-r--r--xorg-server/os/auth.c323
-rw-r--r--xorg-server/os/backtrace.c235
-rw-r--r--xorg-server/os/client.c120
-rw-r--r--xorg-server/os/connection.c1070
-rw-r--r--xorg-server/os/io.c1203
-rw-r--r--xorg-server/os/log.c311
-rw-r--r--xorg-server/os/mitauth.c151
-rw-r--r--xorg-server/os/oscolor.c3058
-rw-r--r--xorg-server/os/osdep.h116
-rw-r--r--xorg-server/os/osinit.c285
-rw-r--r--xorg-server/os/rpcauth.c113
-rw-r--r--xorg-server/os/strlcpy.c35
-rw-r--r--xorg-server/os/utils.c1671
-rw-r--r--xorg-server/os/xdmauth.c516
-rw-r--r--xorg-server/os/xdmcp.c1628
-rw-r--r--xorg-server/os/xprintf.c45
-rw-r--r--xorg-server/os/xsha1.c363
-rw-r--r--xorg-server/os/xstrans.c4
-rw-r--r--xorg-server/randr/randr.c998
-rw-r--r--xorg-server/randr/randrstr.h681
-rw-r--r--xorg-server/randr/rrcrtc.c1504
-rw-r--r--xorg-server/randr/rrdispatch.c347
-rw-r--r--xorg-server/randr/rrinfo.c310
-rw-r--r--xorg-server/randr/rrmode.c385
-rw-r--r--xorg-server/randr/rroutput.c527
-rw-r--r--xorg-server/randr/rrpointer.c151
-rw-r--r--xorg-server/randr/rrproperty.c775
-rw-r--r--xorg-server/randr/rrscreen.c1321
-rw-r--r--xorg-server/randr/rrsdispatch.c184
-rw-r--r--xorg-server/randr/rrtransform.c368
-rw-r--r--xorg-server/randr/rrtransform.h53
-rw-r--r--xorg-server/randr/rrxinerama.c311
-rw-r--r--xorg-server/record/record.c2758
-rw-r--r--xorg-server/record/set.c856
-rw-r--r--xorg-server/record/set.h38
-rw-r--r--xorg-server/render/animcur.c386
-rw-r--r--xorg-server/render/filter.c339
-rw-r--r--xorg-server/render/glyph.c1434
-rw-r--r--xorg-server/render/glyphstr.h91
-rw-r--r--xorg-server/render/matrix.c18
-rw-r--r--xorg-server/render/miindex.c684
-rw-r--r--xorg-server/render/mipict.c786
-rw-r--r--xorg-server/render/mipict.h153
-rw-r--r--xorg-server/render/mirect.c353
-rw-r--r--xorg-server/render/mitrap.c58
-rw-r--r--xorg-server/render/mitri.c135
-rw-r--r--xorg-server/render/picture.c2023
-rw-r--r--xorg-server/render/picturestr.h702
-rw-r--r--xorg-server/render/render.c3784
-rw-r--r--xorg-server/test/ddxstubs.c48
-rw-r--r--xorg-server/test/fixes.c53
-rw-r--r--xorg-server/test/input.c445
-rw-r--r--xorg-server/test/list.c110
-rw-r--r--xorg-server/test/misc.c10
-rw-r--r--xorg-server/test/string.c13
-rw-r--r--xorg-server/test/touch.c30
-rw-r--r--xorg-server/test/xfree86.c17
-rw-r--r--xorg-server/test/xi2/protocol-common.c92
-rw-r--r--xorg-server/test/xi2/protocol-common.h24
-rw-r--r--xorg-server/test/xi2/protocol-eventconvert.c453
-rw-r--r--xorg-server/test/xi2/protocol-xigetclientpointer.c27
-rw-r--r--xorg-server/test/xi2/protocol-xigetselectedevents.c88
-rw-r--r--xorg-server/test/xi2/protocol-xipassivegrabdevice.c91
-rw-r--r--xorg-server/test/xi2/protocol-xiquerydevice.c339
-rw-r--r--xorg-server/test/xi2/protocol-xiquerypointer.c45
-rw-r--r--xorg-server/test/xi2/protocol-xiqueryversion.c27
-rw-r--r--xorg-server/test/xi2/protocol-xiselectevents.c130
-rw-r--r--xorg-server/test/xi2/protocol-xisetclientpointer.c23
-rw-r--r--xorg-server/test/xi2/protocol-xiwarppointer.c40
-rw-r--r--xorg-server/test/xi2/xi2.c16
-rw-r--r--xorg-server/test/xkb.c17
-rw-r--r--xorg-server/test/xtest.c27
-rw-r--r--xorg-server/xfixes/cursor.c1165
-rw-r--r--xorg-server/xfixes/region.c758
-rw-r--r--xorg-server/xfixes/saveset.c32
-rw-r--r--xorg-server/xfixes/select.c302
-rw-r--r--xorg-server/xfixes/xfixes.c260
-rw-r--r--xorg-server/xfixes/xfixes.h17
-rw-r--r--xorg-server/xkb/XKBAlloc.c412
-rw-r--r--xorg-server/xkb/XKBGAlloc.c1044
-rw-r--r--xorg-server/xkb/XKBMAlloc.c1809
-rw-r--r--xorg-server/xkb/XKBMisc.c1354
-rw-r--r--xorg-server/xkb/ddxBeep.c455
-rw-r--r--xorg-server/xkb/ddxLEDs.c40
-rw-r--r--xorg-server/xkb/ddxList.c350
-rw-r--r--xorg-server/xkb/ddxLoad.c384
-rw-r--r--xorg-server/xkb/maprules.c1340
-rw-r--r--xorg-server/xkb/xkb.c9033
-rw-r--r--xorg-server/xkb/xkbAccessX.c872
-rw-r--r--xorg-server/xkb/xkbActions.c2083
-rw-r--r--xorg-server/xkb/xkbDflts.h780
-rw-r--r--xorg-server/xkb/xkbEvents.c1199
-rw-r--r--xorg-server/xkb/xkbInit.c586
-rw-r--r--xorg-server/xkb/xkbLEDs.c1497
-rw-r--r--xorg-server/xkb/xkbPrKeyEv.c151
-rw-r--r--xorg-server/xkb/xkbSwap.c188
-rw-r--r--xorg-server/xkb/xkbUtils.c1292
-rw-r--r--xorg-server/xkb/xkbfmisc.c624
-rw-r--r--xorg-server/xkb/xkbgeom.h829
-rw-r--r--xorg-server/xkb/xkbout.c1551
-rw-r--r--xorg-server/xkb/xkbtext.c1883
-rw-r--r--xorg-server/xkb/xkmread.c1831
-rw-r--r--xorg-server/xkeyboard-config/compat/default.in12
-rw-r--r--xorg-server/xkeyboard-config/compat/iso9995156
-rw-r--r--xorg-server/xkeyboard-config/compat/makefile6
-rw-r--r--xorg-server/xkeyboard-config/keymap/digital_vndr/makefile12
-rw-r--r--xorg-server/xkeyboard-config/keymap/makefile22
-rw-r--r--xorg-server/xkeyboard-config/keymap/sgi_vndr/makefile20
-rw-r--r--xorg-server/xkeyboard-config/keymap/sun_vndr/makefile20
-rw-r--r--xorg-server/xkeyboard-config/makefile2
-rw-r--r--xorg-server/xkeyboard-config/semantics/makefile17
-rw-r--r--xorg-server/xkeyboard-config/symbols/fr2
-rw-r--r--xorg-server/xkeyboard-config/symbols/macintosh_vndr/us296
-rw-r--r--xorg-server/xkeyboard-config/symbols/makefile4
-rw-r--r--xorg-server/xkeyboard-config/symbols/mv2
-rw-r--r--xorg-server/xkeyboard-config/symbols/nokia_vndr/su-8w2
-rw-r--r--xorg-server/xkeyboard-config/symbols/pc2
-rw-r--r--xorg-server/xkeyboard-config/symbols/sun_vndr/us2
-rw-r--r--xorg-server/xkeyboard-config/symbols/sy4
957 files changed, 323723 insertions, 328559 deletions
diff --git a/xorg-server/Xext/dpms.c b/xorg-server/Xext/dpms.c
index e82f495aa..bf01c8905 100644
--- a/xorg-server/Xext/dpms.c
+++ b/xorg-server/Xext/dpms.c
@@ -57,11 +57,11 @@ ProcDPMSGetVersion(ClientPtr client)
rep.majorVersion = DPMSMajorVersion;
rep.minorVersion = DPMSMinorVersion;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *) &rep);
return Success;
}
@@ -79,9 +79,9 @@ ProcDPMSCapable(ClientPtr client)
rep.capable = DPMSCapableFlag;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
+ swaps(&rep.sequenceNumber);
}
- WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDPMSCapableReply), (char *) &rep);
return Success;
}
@@ -101,12 +101,12 @@ ProcDPMSGetTimeouts(ClientPtr client)
rep.off = DPMSOffTime / MILLI_PER_SECOND;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swaps(&rep.standby);
- swaps(&rep.suspend);
- swaps(&rep.off);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.standby);
+ swaps(&rep.suspend);
+ swaps(&rep.off);
}
- WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *) &rep);
return Success;
}
@@ -117,16 +117,14 @@ ProcDPMSSetTimeouts(ClientPtr client)
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
- if ((stuff->off != 0)&&(stuff->off < stuff->suspend))
- {
- client->errorValue = stuff->off;
- return BadValue;
+ if ((stuff->off != 0) && (stuff->off < stuff->suspend)) {
+ client->errorValue = stuff->off;
+ return BadValue;
+ }
+ if ((stuff->suspend != 0) && (stuff->suspend < stuff->standby)) {
+ client->errorValue = stuff->suspend;
+ return BadValue;
}
- if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby))
- {
- client->errorValue = stuff->suspend;
- return BadValue;
- }
DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND;
DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND;
@@ -144,9 +142,9 @@ ProcDPMSEnable(ClientPtr client)
REQUEST_SIZE_MATCH(xDPMSEnableReq);
if (DPMSCapableFlag) {
- DPMSEnabled = TRUE;
- if (!was_enabled)
- SetScreenSaverTimer();
+ DPMSEnabled = TRUE;
+ if (!was_enabled)
+ SetScreenSaverTimer();
}
return Success;
@@ -174,14 +172,13 @@ ProcDPMSForceLevel(ClientPtr client)
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
if (!DPMSEnabled)
- return BadMatch;
+ return BadMatch;
if (stuff->level != DPMSModeOn &&
stuff->level != DPMSModeStandby &&
- stuff->level != DPMSModeSuspend &&
- stuff->level != DPMSModeOff) {
- client->errorValue = stuff->level;
- return BadValue;
+ stuff->level != DPMSModeSuspend && stuff->level != DPMSModeOff) {
+ client->errorValue = stuff->level;
+ return BadValue;
}
DPMSSet(client, stuff->level);
@@ -204,38 +201,37 @@ ProcDPMSInfo(ClientPtr client)
rep.state = DPMSEnabled;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swaps(&rep.power_level);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.power_level);
}
- WriteToClient(client, sizeof(xDPMSInfoReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDPMSInfoReply), (char *) &rep);
return Success;
}
static int
-ProcDPMSDispatch (ClientPtr client)
+ProcDPMSDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_DPMSGetVersion:
- return ProcDPMSGetVersion(client);
+ return ProcDPMSGetVersion(client);
case X_DPMSCapable:
- return ProcDPMSCapable(client);
+ return ProcDPMSCapable(client);
case X_DPMSGetTimeouts:
- return ProcDPMSGetTimeouts(client);
+ return ProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
- return ProcDPMSSetTimeouts(client);
+ return ProcDPMSSetTimeouts(client);
case X_DPMSEnable:
- return ProcDPMSEnable(client);
+ return ProcDPMSEnable(client);
case X_DPMSDisable:
- return ProcDPMSDisable(client);
+ return ProcDPMSDisable(client);
case X_DPMSForceLevel:
- return ProcDPMSForceLevel(client);
+ return ProcDPMSForceLevel(client);
case X_DPMSInfo:
- return ProcDPMSInfo(client);
+ return ProcDPMSInfo(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
@@ -334,29 +330,28 @@ SProcDPMSInfo(ClientPtr client)
}
static int
-SProcDPMSDispatch (ClientPtr client)
+SProcDPMSDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_DPMSGetVersion:
- return SProcDPMSGetVersion(client);
+ return SProcDPMSGetVersion(client);
case X_DPMSCapable:
- return SProcDPMSCapable(client);
+ return SProcDPMSCapable(client);
case X_DPMSGetTimeouts:
- return SProcDPMSGetTimeouts(client);
+ return SProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
- return SProcDPMSSetTimeouts(client);
+ return SProcDPMSSetTimeouts(client);
case X_DPMSEnable:
- return SProcDPMSEnable(client);
+ return SProcDPMSEnable(client);
case X_DPMSDisable:
- return SProcDPMSDisable(client);
+ return SProcDPMSDisable(client);
case X_DPMSForceLevel:
- return SProcDPMSForceLevel(client);
+ return SProcDPMSForceLevel(client);
case X_DPMSInfo:
- return SProcDPMSInfo(client);
+ return SProcDPMSInfo(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
@@ -364,6 +359,6 @@ void
DPMSExtensionInit(INITARGS)
{
AddExtension(DPMSExtensionName, 0, 0,
- ProcDPMSDispatch, SProcDPMSDispatch,
- NULL, StandardMinorOpcode);
+ ProcDPMSDispatch, SProcDPMSDispatch,
+ NULL, StandardMinorOpcode);
}
diff --git a/xorg-server/Xext/dpmsstubs.c b/xorg-server/Xext/dpmsstubs.c
index f0f54d293..80f13f5df 100644
--- a/xorg-server/Xext/dpmsstubs.c
+++ b/xorg-server/Xext/dpmsstubs.c
@@ -34,12 +34,14 @@ Equipment Corporation.
#define FALSE 0
-Bool DPMSSupported(void)
+Bool
+DPMSSupported(void)
{
return FALSE;
}
-int DPMSSet(ClientPtr client, int level)
+int
+DPMSSet(ClientPtr client, int level)
{
return Success;
}
diff --git a/xorg-server/Xext/geext.c b/xorg-server/Xext/geext.c
index a8718ccbd..07028238e 100644
--- a/xorg-server/Xext/geext.c
+++ b/xorg-server/Xext/geext.c
@@ -35,18 +35,18 @@
DevPrivateKeyRec GEClientPrivateKeyRec;
-int RT_GECLIENT = 0;
+int RT_GECLIENT = 0;
GEExtension GEExtensions[MAXEXTENSIONS];
/* Major available requests */
static const int version_requests[] = {
- X_GEQueryVersion, /* before client sends QueryVersion */
- X_GEQueryVersion, /* must be set to last request in version 1 */
+ X_GEQueryVersion, /* before client sends QueryVersion */
+ X_GEQueryVersion, /* must be set to last request in version 1 */
};
/* Forward declarations */
-static void SGEGenericEvent(xEvent* from, xEvent* to);
+static void SGEGenericEvent(xEvent *from, xEvent *to);
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
#define EXT_MASK(ext) ((ext) & 0x7F)
@@ -60,6 +60,7 @@ ProcGEQueryVersion(ClientPtr client)
{
GEClientInfoPtr pGEClient = GEGetClient(client);
xGEQueryVersionReply rep;
+
REQUEST(xGEQueryVersionReq);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
@@ -77,22 +78,20 @@ ProcGEQueryVersion(ClientPtr client)
pGEClient->major_version = stuff->majorVersion;
pGEClient->minor_version = stuff->minorVersion;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xGEQueryVersionReply), (char*)&rep);
+ WriteToClient(client, sizeof(xGEQueryVersionReply), (char *) &rep);
return Success;
}
-int (*ProcGEVector[GENumberRequests])(ClientPtr) = {
+int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
- ProcGEQueryVersion
-};
+ProcGEQueryVersion};
/************************************************************/
/* swapped request handlers */
@@ -106,14 +105,12 @@ SProcGEQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
- return(*ProcGEVector[stuff->ReqType])(client);
+ return (*ProcGEVector[stuff->ReqType]) (client);
}
-int (*SProcGEVector[GENumberRequests])(ClientPtr) = {
+int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
- SProcGEQueryVersion
-};
-
+SProcGEQueryVersion};
/************************************************************/
/* callbacks */
@@ -124,6 +121,7 @@ static int
ProcGEDispatch(ClientPtr client)
{
GEClientInfoPtr pGEClient = GEGetClient(client);
+
REQUEST(xGEReq);
if (pGEClient->major_version >= NUM_VERSION_REQUESTS)
@@ -131,7 +129,7 @@ ProcGEDispatch(ClientPtr client)
if (stuff->ReqType > version_requests[pGEClient->major_version])
return BadRequest;
- return (ProcGEVector[stuff->ReqType])(client);
+ return (ProcGEVector[stuff->ReqType]) (client);
}
/* dispatch swapped requests */
@@ -141,7 +139,7 @@ SProcGEDispatch(ClientPtr client)
REQUEST(xGEReq);
if (stuff->ReqType >= GENumberRequests)
return BadRequest;
- return (*SProcGEVector[stuff->ReqType])(client);
+ return (*SProcGEVector[stuff->ReqType]) (client);
}
/**
@@ -151,13 +149,11 @@ SProcGEDispatch(ClientPtr client)
* used in the furture for versioning support.
*/
static void
-GEClientCallback(CallbackListPtr *list,
- pointer closure,
- pointer data)
+GEClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- GEClientInfoPtr pGEClient = GEGetClient(pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ GEClientInfoPtr pGEClient = GEGetClient(pClient);
pGEClient->major_version = 0;
pGEClient->minor_version = 0;
@@ -165,7 +161,7 @@ GEClientCallback(CallbackListPtr *list,
/* Reset extension. Called on server shutdown. */
static void
-GEResetProc(ExtensionEntry *extEntry)
+GEResetProc(ExtensionEntry * extEntry)
{
DeleteCallback(&ClientStateCallback, GEClientCallback, 0);
EventSwapVector[GenericEvent] = NotImplemented;
@@ -179,13 +175,12 @@ GEResetProc(ExtensionEntry *extEntry)
* work.
*/
static void
-SGEGenericEvent(xEvent* from, xEvent* to)
+SGEGenericEvent(xEvent *from, xEvent *to)
{
- xGenericEvent* gefrom = (xGenericEvent*)from;
- xGenericEvent* geto = (xGenericEvent*)to;
+ xGenericEvent *gefrom = (xGenericEvent *) from;
+ xGenericEvent *geto = (xGenericEvent *) to;
- if ((gefrom->extension & 0x7f) > MAXEXTENSIONS)
- {
+ if ((gefrom->extension & 0x7f) > MAXEXTENSIONS) {
ErrorF("GE: Invalid extension offset for event.\n");
return;
}
@@ -203,23 +198,23 @@ GEExtensionInit(void)
{
ExtensionEntry *extEntry;
- if (!dixRegisterPrivateKey(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
+ if (!dixRegisterPrivateKey
+ (&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
FatalError("GEExtensionInit: GE private request failed.\n");
- if(!AddCallback(&ClientStateCallback, GEClientCallback, 0))
- {
+ if (!AddCallback(&ClientStateCallback, GEClientCallback, 0)) {
FatalError("GEExtensionInit: register client callback failed.\n");
}
- if((extEntry = AddExtension(GE_NAME,
- 0, GENumberErrors,
- ProcGEDispatch, SProcGEDispatch,
- GEResetProc, StandardMinorOpcode)) != 0)
- {
+ if ((extEntry = AddExtension(GE_NAME,
+ 0, GENumberErrors,
+ ProcGEDispatch, SProcGEDispatch,
+ GEResetProc, StandardMinorOpcode)) != 0) {
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
- } else {
+ }
+ else {
FatalError("GEInit: AddExtensions failed.\n");
}
@@ -238,24 +233,22 @@ GEExtensionInit(void)
*/
void
GERegisterExtension(int extension,
- void (*ev_swap)(xGenericEvent* from, xGenericEvent* to))
+ void (*ev_swap) (xGenericEvent *from, xGenericEvent *to))
{
- if (EXT_MASK(extension) >= MAXEXTENSIONS)
+ if (EXT_MASK(extension) >= MAXEXTENSIONS)
FatalError("GE: extension > MAXEXTENSIONS. This should not happen.\n");
/* extension opcodes are > 128, might as well save some space here */
GEExtensions[EXT_MASK(extension)].evswap = ev_swap;
}
-
/* Sets type and extension field for a generic event. This is just an
* auxiliary function, extensions could do it manually too.
*/
void
-GEInitEvent(xGenericEvent* ev, int extension)
+GEInitEvent(xGenericEvent *ev, int extension)
{
ev->type = GenericEvent;
ev->extension = extension;
ev->length = 0;
}
-
diff --git a/xorg-server/Xext/geext.h b/xorg-server/Xext/geext.h
index 8e6dbeb24..d2a15dcb9 100644
--- a/xorg-server/Xext/geext.h
+++ b/xorg-server/Xext/geext.h
@@ -37,10 +37,9 @@ from the author.
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
- void (*evswap)(xGenericEvent* from, xGenericEvent* to);
+ void (*evswap) (xGenericEvent *from, xGenericEvent *to);
} GEExtension, *GEExtensionPtr;
-
/* All registered extensions and their handling functions. */
extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
@@ -70,14 +69,15 @@ extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
GEEXT(ev) == (ext) && \
GEV(ev)->evtype == (ev_type))
-
/* Interface for other extensions */
-extern _X_EXPORT void GERegisterExtension(
- int extension,
- void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to));
+extern _X_EXPORT void GERegisterExtension(int extension,
+ void (*ev_dispatch) (xGenericEvent
+ *from,
+ xGenericEvent
+ *to));
-extern _X_EXPORT void GEInitEvent(xGenericEvent* ev, int extension);
+extern _X_EXPORT void GEInitEvent(xGenericEvent *ev, int extension);
extern _X_EXPORT void GEExtensionInit(void);
-#endif /* _GEEXT_H_ */
+#endif /* _GEEXT_H_ */
diff --git a/xorg-server/Xext/panoramiX.c b/xorg-server/Xext/panoramiX.c
index fae7c81c9..98d327f26 100644
--- a/xorg-server/Xext/panoramiX.c
+++ b/xorg-server/Xext/panoramiX.c
@@ -64,24 +64,23 @@ Equipment Corporation.
#ifdef GLXPROXY
extern VisualPtr glxMatchVisual(ScreenPtr pScreen,
- VisualPtr pVisual,
- ScreenPtr pMatchScreen);
+ VisualPtr pVisual, ScreenPtr pMatchScreen);
#endif
/*
* PanoramiX data declarations
*/
-int PanoramiXPixWidth = 0;
-int PanoramiXPixHeight = 0;
-int PanoramiXNumScreens = 0;
+int PanoramiXPixWidth = 0;
+int PanoramiXPixHeight = 0;
+int PanoramiXNumScreens = 0;
-static RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL};
+static RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
-static int PanoramiXNumDepths;
-static DepthPtr PanoramiXDepths;
-static int PanoramiXNumVisuals;
-static VisualPtr PanoramiXVisuals;
+static int PanoramiXNumDepths;
+static DepthPtr PanoramiXDepths;
+static int PanoramiXNumVisuals;
+static VisualPtr PanoramiXVisuals;
RESTYPE XRC_DRAWABLE;
RESTYPE XRT_WINDOW;
@@ -97,9 +96,9 @@ XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual;
*/
static int panoramiXGeneration;
-static int ProcPanoramiXDispatch(ClientPtr client);
+static int ProcPanoramiXDispatch(ClientPtr client);
-static void PanoramiXResetProc(ExtensionEntry*);
+static void PanoramiXResetProc(ExtensionEntry *);
/*
* External references for functions and data variables
@@ -107,22 +106,25 @@ static void PanoramiXResetProc(ExtensionEntry*);
#include "panoramiXh.h"
-int (* SavedProcVector[256]) (ClientPtr client) = { NULL, };
+int (*SavedProcVector[256]) (ClientPtr client) = {
+NULL,};
static DevPrivateKeyRec PanoramiXGCKeyRec;
+
#define PanoramiXGCKey (&PanoramiXGCKeyRec)
static DevPrivateKeyRec PanoramiXScreenKeyRec;
+
#define PanoramiXScreenKey (&PanoramiXScreenKeyRec)
typedef struct {
- DDXPointRec clipOrg;
- DDXPointRec patOrg;
- GCFuncs *wrapFuncs;
+ DDXPointRec clipOrg;
+ DDXPointRec patOrg;
+ GCFuncs *wrapFuncs;
} PanoramiXGCRec, *PanoramiXGCPtr;
typedef struct {
- CreateGCProcPtr CreateGC;
- CloseScreenProcPtr CloseScreen;
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
} PanoramiXScreenRec, *PanoramiXScreenPtr;
static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
@@ -147,18 +149,17 @@ static GCFuncs XineramaGCFuncs = {
pGCPriv->wrapFuncs = (pGC)->funcs;\
(pGC)->funcs = &XineramaGCFuncs;
-
static Bool
-XineramaCloseScreen (int i, ScreenPtr pScreen)
+XineramaCloseScreen(int i, ScreenPtr pScreen)
{
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
- dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
+ dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->CreateGC = pScreenPriv->CreateGC;
if (pScreen->myNum == 0)
- RegionUninit(&PanoramiXScreenRegion);
+ RegionUninit(&PanoramiXScreenRegion);
free((pointer) pScreenPriv);
@@ -170,21 +171,21 @@ XineramaCreateGC(GCPtr pGC)
{
ScreenPtr pScreen = pGC->pScreen;
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
- dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
+ dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
Bool ret;
pScreen->CreateGC = pScreenPriv->CreateGC;
- if((ret = (*pScreen->CreateGC)(pGC))) {
- PanoramiXGCPtr pGCPriv = (PanoramiXGCPtr)
- dixLookupPrivate(&pGC->devPrivates, PanoramiXGCKey);
+ if ((ret = (*pScreen->CreateGC) (pGC))) {
+ PanoramiXGCPtr pGCPriv = (PanoramiXGCPtr)
+ dixLookupPrivate(&pGC->devPrivates, PanoramiXGCKey);
- pGCPriv->wrapFuncs = pGC->funcs;
+ 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;
+ 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;
@@ -192,139 +193,129 @@ XineramaCreateGC(GCPtr pGC)
}
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 = pGC->pScreen->x;
- int y_off = pGC->pScreen->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;
- }
+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 = pGC->pScreen->x;
+ int y_off = pGC->pScreen->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);
+
+ (*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);
+ 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;
+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);
+ Xinerama_GC_FUNC_EPILOGUE(pGC);
}
static void
-XineramaCopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst
-){
+XineramaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
+{
PanoramiXGCPtr pSrcPriv = (PanoramiXGCPtr)
- dixLookupPrivate(&pGCSrc->devPrivates, PanoramiXGCKey);
- Xinerama_GC_FUNC_PROLOGUE (pGCDst);
+ dixLookupPrivate(&pGCSrc->devPrivates, PanoramiXGCKey);
- if(mask & GCTileStipXOrigin)
+ Xinerama_GC_FUNC_PROLOGUE(pGCDst);
+
+ if (mask & GCTileStipXOrigin)
pGCPriv->patOrg.x = pSrcPriv->patOrg.x;
- if(mask & GCTileStipYOrigin)
+ if (mask & GCTileStipYOrigin)
pGCPriv->patOrg.y = pSrcPriv->patOrg.y;
- if(mask & GCClipXOrigin)
+ if (mask & GCClipXOrigin)
pGCPriv->clipOrg.x = pSrcPriv->clipOrg.x;
- if(mask & GCClipYOrigin)
+ if (mask & GCClipYOrigin)
pGCPriv->clipOrg.y = pSrcPriv->clipOrg.y;
(*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- Xinerama_GC_FUNC_EPILOGUE (pGCDst);
+ Xinerama_GC_FUNC_EPILOGUE(pGCDst);
}
static void
-XineramaChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects
-){
- Xinerama_GC_FUNC_PROLOGUE (pGC);
+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);
+ 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);
+ 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);
+ Xinerama_GC_FUNC_PROLOGUE(pGC);
+ (*pGC->funcs->DestroyClip) (pGC);
+ Xinerama_GC_FUNC_EPILOGUE(pGC);
}
int
@@ -335,16 +326,16 @@ XineramaDeleteResource(pointer data, XID id)
}
typedef struct {
- int screen;
- int id;
-} PanoramiXSearchData;
+ int screen;
+ int id;
+} PanoramiXSearchData;
-static Bool
+static Bool
XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata)
{
- PanoramiXRes *res = (PanoramiXRes*)resource;
- PanoramiXSearchData *data = (PanoramiXSearchData*)privdata;
-
+ PanoramiXRes *res = (PanoramiXRes *) resource;
+ PanoramiXSearchData *data = (PanoramiXSearchData *) privdata;
+
return res->info[data->screen].id == data->id;
}
@@ -354,32 +345,32 @@ PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen)
PanoramiXSearchData data;
pointer val;
- if(!screen) {
- dixLookupResourceByType(&val, id, type, serverClient, DixReadAccess);
- return val;
+ if (!screen) {
+ dixLookupResourceByType(&val, id, type, serverClient, DixReadAccess);
+ return val;
}
data.screen = screen;
data.id = id;
return LookupClientResourceComplex(clients[CLIENT_ID(id)], type,
- XineramaFindIDByScrnum, &data);
+ XineramaFindIDByScrnum, &data);
}
typedef struct _connect_callback_list {
- void (*func)(void);
+ void (*func) (void);
struct _connect_callback_list *next;
} XineramaConnectionCallbackList;
static XineramaConnectionCallbackList *ConnectionCallbackList = NULL;
Bool
-XineramaRegisterConnectionBlockCallback(void (*func)(void))
+XineramaRegisterConnectionBlockCallback(void (*func) (void))
{
XineramaConnectionCallbackList *newlist;
- if(!(newlist = malloc(sizeof(XineramaConnectionCallbackList))))
- return FALSE;
+ if (!(newlist = malloc(sizeof(XineramaConnectionCallbackList))))
+ return FALSE;
newlist->next = ConnectionCallbackList;
newlist->func = func;
@@ -388,44 +379,48 @@ XineramaRegisterConnectionBlockCallback(void (*func)(void))
return TRUE;
}
-static void XineramaInitData(void)
+static void
+XineramaInitData(void)
{
int i, w, h;
RegionNull(&PanoramiXScreenRegion);
FOR_NSCREENS(i) {
- BoxRec TheBox;
- RegionRec ScreenRegion;
+ BoxRec TheBox;
+ RegionRec ScreenRegion;
- ScreenPtr pScreen = screenInfo.screens[i];
+ ScreenPtr pScreen = screenInfo.screens[i];
- TheBox.x1 = pScreen->x;
- TheBox.x2 = TheBox.x1 + pScreen->width;
- TheBox.y1 = pScreen->y;
- TheBox.y2 = TheBox.y1 + pScreen->height;
+ TheBox.x1 = pScreen->x;
+ TheBox.x2 = TheBox.x1 + pScreen->width;
+ TheBox.y1 = pScreen->y;
+ TheBox.y2 = TheBox.y1 + pScreen->height;
- RegionInit(&ScreenRegion, &TheBox, 1);
- RegionUnion(&PanoramiXScreenRegion, &PanoramiXScreenRegion,
- &ScreenRegion);
- RegionUninit(&ScreenRegion);
+ RegionInit(&ScreenRegion, &TheBox, 1);
+ RegionUnion(&PanoramiXScreenRegion, &PanoramiXScreenRegion,
+ &ScreenRegion);
+ RegionUninit(&ScreenRegion);
}
PanoramiXPixWidth = screenInfo.screens[0]->x + screenInfo.screens[0]->width;
- PanoramiXPixHeight = screenInfo.screens[0]->y + screenInfo.screens[0]->height;
+ PanoramiXPixHeight =
+ screenInfo.screens[0]->y + screenInfo.screens[0]->height;
FOR_NSCREENS_FORWARD_SKIP(i) {
- ScreenPtr pScreen = screenInfo.screens[i];
- w = pScreen->x + pScreen->width;
- h = pScreen->y + pScreen->height;
-
- if (PanoramiXPixWidth < w)
- PanoramiXPixWidth = w;
- if (PanoramiXPixHeight < h)
- PanoramiXPixHeight = h;
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ w = pScreen->x + pScreen->width;
+ h = pScreen->y + pScreen->height;
+
+ if (PanoramiXPixWidth < w)
+ PanoramiXPixWidth = w;
+ if (PanoramiXPixHeight < h)
+ PanoramiXPixHeight = h;
}
}
-void XineramaReinitData(void)
+void
+XineramaReinitData(void)
{
RegionUninit(&PanoramiXScreenRegion);
XineramaInitData();
@@ -436,103 +431,104 @@ void XineramaReinitData(void)
* Called from InitExtensions in main().
* Register PanoramiXeen Extension
* Initialize global variables.
- */
+ */
-void PanoramiXExtensionInit(int argc, char *argv[])
+void
+PanoramiXExtensionInit(int argc, char *argv[])
{
- int i;
- Bool success = FALSE;
- ExtensionEntry *extEntry;
- ScreenPtr pScreen = screenInfo.screens[0];
- PanoramiXScreenPtr pScreenPriv;
+ int i;
+ Bool success = FALSE;
+ ExtensionEntry *extEntry;
+ ScreenPtr pScreen = screenInfo.screens[0];
+ PanoramiXScreenPtr pScreenPriv;
- if (noPanoramiXExtension)
- return;
+ if (noPanoramiXExtension)
+ return;
if (!dixRegisterPrivateKey(&PanoramiXScreenKeyRec, PRIVATE_SCREEN, 0)) {
- noPanoramiXExtension = TRUE;
- return;
+ noPanoramiXExtension = TRUE;
+ return;
}
- if (!dixRegisterPrivateKey(&PanoramiXGCKeyRec, PRIVATE_GC, sizeof(PanoramiXGCRec))) {
- noPanoramiXExtension = TRUE;
- return;
+ if (!dixRegisterPrivateKey
+ (&PanoramiXGCKeyRec, PRIVATE_GC, sizeof(PanoramiXGCRec))) {
+ noPanoramiXExtension = TRUE;
+ return;
}
PanoramiXNumScreens = screenInfo.numScreens;
- if (PanoramiXNumScreens == 1) { /* Only 1 screen */
- noPanoramiXExtension = TRUE;
- return;
+ if (PanoramiXNumScreens == 1) { /* Only 1 screen */
+ noPanoramiXExtension = TRUE;
+ return;
}
while (panoramiXGeneration != serverGeneration) {
- extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0,
- ProcPanoramiXDispatch,
- SProcPanoramiXDispatch, PanoramiXResetProc,
- StandardMinorOpcode);
- if (!extEntry)
- break;
-
- /*
- * First make sure all the basic allocations succeed. If not,
- * run in non-PanoramiXeen mode.
- */
-
- FOR_NSCREENS(i) {
- pScreen = screenInfo.screens[i];
- pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
- dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
- 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,
- "XineramaWindow");
- if (XRT_WINDOW)
- XRT_WINDOW |= XRC_DRAWABLE;
- XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource,
- "XineramaPixmap");
- if (XRT_PIXMAP)
- XRT_PIXMAP |= XRC_DRAWABLE;
- XRT_GC = CreateNewResourceType(XineramaDeleteResource,
- "XineramaGC");
- XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource,
- "XineramaColormap");
-
- if (XRT_WINDOW && XRT_PIXMAP && XRT_GC && XRT_COLORMAP) {
- panoramiXGeneration = serverGeneration;
- success = TRUE;
- }
- SetResourceTypeErrorValue(XRT_WINDOW, BadWindow);
- SetResourceTypeErrorValue(XRT_PIXMAP, BadPixmap);
- SetResourceTypeErrorValue(XRT_GC, BadGC);
- SetResourceTypeErrorValue(XRT_COLORMAP, BadColor);
+ extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
+ ProcPanoramiXDispatch,
+ SProcPanoramiXDispatch, PanoramiXResetProc,
+ StandardMinorOpcode);
+ if (!extEntry)
+ break;
+
+ /*
+ * First make sure all the basic allocations succeed. If not,
+ * run in non-PanoramiXeen mode.
+ */
+
+ FOR_NSCREENS(i) {
+ pScreen = screenInfo.screens[i];
+ pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
+ dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
+ 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,
+ "XineramaWindow");
+ if (XRT_WINDOW)
+ XRT_WINDOW |= XRC_DRAWABLE;
+ XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource,
+ "XineramaPixmap");
+ if (XRT_PIXMAP)
+ XRT_PIXMAP |= XRC_DRAWABLE;
+ XRT_GC = CreateNewResourceType(XineramaDeleteResource, "XineramaGC");
+ XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource,
+ "XineramaColormap");
+
+ if (XRT_WINDOW && XRT_PIXMAP && XRT_GC && XRT_COLORMAP) {
+ panoramiXGeneration = serverGeneration;
+ success = TRUE;
+ }
+ SetResourceTypeErrorValue(XRT_WINDOW, BadWindow);
+ SetResourceTypeErrorValue(XRT_PIXMAP, BadPixmap);
+ SetResourceTypeErrorValue(XRT_GC, BadGC);
+ SetResourceTypeErrorValue(XRT_COLORMAP, BadColor);
}
if (!success) {
- noPanoramiXExtension = TRUE;
- ErrorF(PANORAMIX_PROTOCOL_NAME " extension failed to initialize\n");
- return;
+ noPanoramiXExtension = TRUE;
+ ErrorF(PANORAMIX_PROTOCOL_NAME " extension failed to initialize\n");
+ return;
}
-
+
XineramaInitData();
/*
- * Put our processes into the ProcVector
+ * Put our processes into the ProcVector
*/
- for (i = 256; i--; )
- SavedProcVector[i] = ProcVector[i];
+ for (i = 256; i--;)
+ SavedProcVector[i] = ProcVector[i];
ProcVector[X_CreateWindow] = PanoramiXCreateWindow;
ProcVector[X_ChangeWindowAttributes] = PanoramiXChangeWindowAttributes;
@@ -586,19 +582,20 @@ void PanoramiXExtensionInit(int argc, char *argv[])
ProcVector[X_StoreColors] = PanoramiXStoreColors;
ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor;
- PanoramiXRenderInit ();
+ PanoramiXRenderInit();
#ifdef XFIXES
- PanoramiXFixesInit ();
+ PanoramiXFixesInit();
#endif
#ifdef COMPOSITE
- PanoramiXCompositeInit ();
+ PanoramiXCompositeInit();
#endif
}
extern Bool CreateConnectionBlock(void);
-Bool PanoramiXCreateConnectionBlock(void)
+Bool
+PanoramiXCreateConnectionBlock(void)
{
int i, j, length;
Bool disableBackingStore = FALSE;
@@ -611,40 +608,41 @@ Bool PanoramiXCreateConnectionBlock(void)
ScreenPtr pScreen;
/*
- * Do normal CreateConnectionBlock but faking it for only one screen
+ * Do normal CreateConnectionBlock but faking it for only one screen
*/
- if(!PanoramiXNumDepths) {
- ErrorF("Xinerama error: No common visuals\n");
- return FALSE;
+ if (!PanoramiXNumDepths) {
+ ErrorF("Xinerama error: 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("Xinerama error: Root window depths differ\n");
- return FALSE;
- }
- if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport)
- disableBackingStore = TRUE;
+ for (i = 1; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if (pScreen->rootDepth != screenInfo.screens[0]->rootDepth) {
+ ErrorF("Xinerama error: Root window depths differ\n");
+ return FALSE;
+ }
+ if (pScreen->backingStoreSupport !=
+ screenInfo.screens[0]->backingStoreSupport)
+ disableBackingStore = TRUE;
}
if (disableBackingStore) {
- for (i = 0; i < screenInfo.numScreens; i++) {
- pScreen = screenInfo.screens[i];
- pScreen->backingStoreSupport = NotUseful;
- }
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ pScreen->backingStoreSupport = NotUseful;
+ }
}
i = screenInfo.numScreens;
screenInfo.numScreens = 1;
if (!CreateConnectionBlock()) {
- screenInfo.numScreens = i;
- return FALSE;
+ screenInfo.numScreens = i;
+ return FALSE;
}
screenInfo.numScreens = i;
-
+
root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart);
length = connBlockScreenStart + sizeof(xWindowRoot);
@@ -652,42 +650,40 @@ Bool PanoramiXCreateConnectionBlock(void)
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));
+ 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 = bytes_to_int32(length);
for (i = 0; i < PanoramiXNumDepths; i++)
- free(PanoramiXDepths[i].vids);
+ free(PanoramiXDepths[i].vids);
free(PanoramiXDepths);
PanoramiXDepths = NULL;
/*
* OK, change some dimensions so it looks as if it were one big screen
*/
-
+
old_width = root->pixWidth;
old_height = root->pixHeight;
@@ -698,13 +694,13 @@ Bool PanoramiXCreateConnectionBlock(void)
root->mmWidth *= width_mult;
root->mmHeight *= height_mult;
- while(ConnectionCallbackList) {
- pointer tmp;
+ while (ConnectionCallbackList) {
+ pointer tmp;
- tmp = (pointer)ConnectionCallbackList;
- (*ConnectionCallbackList->func)();
- ConnectionCallbackList = ConnectionCallbackList->next;
- free(tmp);
+ tmp = (pointer) ConnectionCallbackList;
+ (*ConnectionCallbackList->func) ();
+ ConnectionCallbackList = ConnectionCallbackList->next;
+ free(tmp);
}
return TRUE;
@@ -723,14 +719,14 @@ static Bool
VisualsEqual(VisualPtr a, ScreenPtr pScreenB, VisualPtr b)
{
return ((a->class == b->class) &&
- (a->ColormapEntries == b->ColormapEntries) &&
- (a->nplanes == b->nplanes) &&
- (a->redMask == b->redMask) &&
- (a->greenMask == b->greenMask) &&
- (a->blueMask == b->blueMask) &&
- (a->offsetRed == b->offsetRed) &&
- (a->offsetGreen == b->offsetGreen) &&
- (a->offsetBlue == b->offsetBlue));
+ (a->ColormapEntries == b->ColormapEntries) &&
+ (a->nplanes == b->nplanes) &&
+ (a->redMask == b->redMask) &&
+ (a->greenMask == b->greenMask) &&
+ (a->blueMask == b->blueMask) &&
+ (a->offsetRed == b->offsetRed) &&
+ (a->offsetGreen == b->offsetGreen) &&
+ (a->offsetBlue == b->offsetBlue));
}
static void
@@ -741,29 +737,29 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
Bool found = FALSE;
FOR_NSCREENS_FORWARD_SKIP(j) {
- pScreen = screenInfo.screens[j];
- for (k = 0; k < pScreen->numDepths; k++) {
- if (pScreen->allowedDepths[k].depth == pDepth->depth) {
- found = TRUE;
- break;
- }
- }
+ pScreen = screenInfo.screens[j];
+ for (k = 0; k < pScreen->numDepths; k++) {
+ if (pScreen->allowedDepths[k].depth == pDepth->depth) {
+ found = TRUE;
+ break;
+ }
+ }
}
if (!found)
- return;
+ return;
j = PanoramiXNumDepths;
PanoramiXNumDepths++;
PanoramiXDepths = realloc(PanoramiXDepths,
- PanoramiXNumDepths * sizeof(DepthRec));
+ PanoramiXNumDepths * sizeof(DepthRec));
PanoramiXDepths[j].depth = pDepth->depth;
PanoramiXDepths[j].numVids = 0;
/* XXX suboptimal, should grow these dynamically */
- if(pDepth->numVids)
- PanoramiXDepths[j].vids = malloc(sizeof(VisualID) * pDepth->numVids);
+ if (pDepth->numVids)
+ PanoramiXDepths[j].vids = malloc(sizeof(VisualID) * pDepth->numVids);
else
- PanoramiXDepths[j].vids = NULL;
+ PanoramiXDepths[j].vids = NULL;
}
static void
@@ -774,60 +770,60 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
Bool found = FALSE;
FOR_NSCREENS_FORWARD_SKIP(j) {
- pScreen = screenInfo.screens[j];
- found = FALSE;
+ pScreen = screenInfo.screens[j];
+ found = FALSE;
- for (k = 0; k < pScreen->numVisuals; k++) {
- VisualPtr candidate = &pScreen->visuals[k];
+ for (k = 0; k < pScreen->numVisuals; k++) {
+ VisualPtr candidate = &pScreen->visuals[k];
- if ((*XineramaVisualsEqualPtr)(pVisual, pScreen, candidate)
+ if ((*XineramaVisualsEqualPtr) (pVisual, pScreen, candidate)
#ifdef GLXPROXY
- && glxMatchVisual(screenInfo.screens[0], pVisual, pScreen)
+ && glxMatchVisual(screenInfo.screens[0], pVisual, pScreen)
#endif
- ) {
- found = TRUE;
- break;
- }
- }
-
- if (!found)
- return;
+ ) {
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (!found)
+ return;
}
/* found a matching visual on all screens, add it to the subset list */
j = PanoramiXNumVisuals;
PanoramiXNumVisuals++;
PanoramiXVisuals = realloc(PanoramiXVisuals,
- PanoramiXNumVisuals * sizeof(VisualRec));
+ PanoramiXNumVisuals * sizeof(VisualRec));
memcpy(&PanoramiXVisuals[j], pVisual, sizeof(VisualRec));
for (k = 0; k < PanoramiXNumDepths; k++) {
- if (PanoramiXDepths[k].depth == pVisual->nplanes) {
- PanoramiXDepths[k].vids[PanoramiXDepths[k].numVids] = pVisual->vid;
- PanoramiXDepths[k].numVids++;
- break;
- }
- }
+ if (PanoramiXDepths[k].depth == pVisual->nplanes) {
+ PanoramiXDepths[k].vids[PanoramiXDepths[k].numVids] = pVisual->vid;
+ PanoramiXDepths[k].numVids++;
+ break;
+ }
+ }
}
extern void
PanoramiXConsolidate(void)
{
- int i;
+ int i;
PanoramiXRes *root, *defmap, *saver;
- ScreenPtr pScreen = screenInfo.screens[0];
- DepthPtr pDepth = pScreen->allowedDepths;
- VisualPtr pVisual = pScreen->visuals;
+ ScreenPtr pScreen = screenInfo.screens[0];
+ DepthPtr pDepth = pScreen->allowedDepths;
+ VisualPtr pVisual = pScreen->visuals;
PanoramiXNumDepths = 0;
PanoramiXNumVisuals = 0;
for (i = 0; i < pScreen->numDepths; i++)
- PanoramiXMaybeAddDepth(pDepth++);
+ PanoramiXMaybeAddDepth(pDepth++);
for (i = 0; i < pScreen->numVisuals; i++)
- PanoramiXMaybeAddVisual(pVisual++);
+ PanoramiXMaybeAddVisual(pVisual++);
root = malloc(sizeof(PanoramiXRes));
root->type = XRT_WINDOW;
@@ -837,14 +833,15 @@ PanoramiXConsolidate(void)
saver->type = XRT_WINDOW;
FOR_NSCREENS(i) {
- ScreenPtr pScreen = screenInfo.screens[i];
- root->info[i].id = pScreen->root->drawable.id;
- root->u.win.class = InputOutput;
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ root->info[i].id = pScreen->root->drawable.id;
+ root->u.win.class = InputOutput;
root->u.win.root = TRUE;
saver->info[i].id = pScreen->screensaver.wid;
saver->u.win.class = InputOutput;
saver->u.win.root = TRUE;
- defmap->info[i].id = pScreen->defColormap;
+ defmap->info[i].id = pScreen->defColormap;
}
AddResource(root->info[0].id, XRT_WINDOW, root);
@@ -860,169 +857,167 @@ PanoramiXTranslateVisualID(int screen, VisualID orig)
int i;
for (i = 0; i < PanoramiXNumVisuals; i++) {
- if (orig == PanoramiXVisuals[i].vid) {
- pVisual = &PanoramiXVisuals[i];
- break;
- }
+ if (orig == PanoramiXVisuals[i].vid) {
+ pVisual = &PanoramiXVisuals[i];
+ break;
+ }
}
if (!pVisual)
- return 0;
+ return 0;
/* if screen is 0, orig is already the correct visual ID */
if (screen == 0)
- return orig;
+ return orig;
/* found the original, now translate it relative to the backend screen */
for (i = 0; i < pOtherScreen->numVisuals; i++) {
- VisualPtr pOtherVisual = &pOtherScreen->visuals[i];
+ VisualPtr pOtherVisual = &pOtherScreen->visuals[i];
- if ((*XineramaVisualsEqualPtr)(pVisual, pOtherScreen, pOtherVisual))
- return pOtherVisual->vid;
+ if ((*XineramaVisualsEqualPtr) (pVisual, pOtherScreen, pOtherVisual))
+ return pOtherVisual->vid;
}
return 0;
}
-
/*
* PanoramiXResetProc()
* Exit, deallocating as needed.
*/
-static void PanoramiXResetProc(ExtensionEntry* extEntry)
+static void
+PanoramiXResetProc(ExtensionEntry * extEntry)
{
- int i;
+ int i;
- PanoramiXRenderReset ();
+ PanoramiXRenderReset();
#ifdef XFIXES
- PanoramiXFixesReset ();
+ PanoramiXFixesReset();
#endif
screenInfo.numScreens = PanoramiXNumScreens;
- for (i = 256; i--; )
- ProcVector[i] = SavedProcVector[i];
+ for (i = 256; i--;)
+ ProcVector[i] = SavedProcVector[i];
}
-
int
-ProcPanoramiXQueryVersion (ClientPtr client)
+ProcPanoramiXQueryVersion(ClientPtr client)
{
/* REQUEST(xPanoramiXQueryVersionReq); */
- xPanoramiXQueryVersionReply rep;
+ xPanoramiXQueryVersionReply rep;
- REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION;
rep.minorVersion = SERVER_PANORAMIX_MINOR_VERSION;
- if (client->swapped) {
+ if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof (xPanoramiXQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *) &rep);
return Success;
}
int
ProcPanoramiXGetState(ClientPtr client)
{
- REQUEST(xPanoramiXGetStateReq);
- WindowPtr pWin;
- xPanoramiXGetStateReply rep;
- int rc;
-
- REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.state = !noPanoramiXExtension;
- rep.window = stuff->window;
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.window);
- }
- WriteToClient (client, sizeof (xPanoramiXGetStateReply), (char *) &rep);
- return Success;
+ REQUEST(xPanoramiXGetStateReq);
+ WindowPtr pWin;
+ xPanoramiXGetStateReply rep;
+ int rc;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.state = !noPanoramiXExtension;
+ rep.window = stuff->window;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.window);
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *) &rep);
+ return Success;
}
-int
+int
ProcPanoramiXGetScreenCount(ClientPtr client)
{
- REQUEST(xPanoramiXGetScreenCountReq);
- WindowPtr pWin;
- xPanoramiXGetScreenCountReply rep;
- int rc;
-
- REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.ScreenCount = PanoramiXNumScreens;
- rep.window = stuff->window;
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.window);
- }
- WriteToClient (client, sizeof (xPanoramiXGetScreenCountReply), (char *) &rep);
- return Success;
+ REQUEST(xPanoramiXGetScreenCountReq);
+ WindowPtr pWin;
+ xPanoramiXGetScreenCountReply rep;
+ int rc;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.ScreenCount = PanoramiXNumScreens;
+ rep.window = stuff->window;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.window);
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *) &rep);
+ return Success;
}
-int
+int
ProcPanoramiXGetScreenSize(ClientPtr client)
{
- REQUEST(xPanoramiXGetScreenSizeReq);
- WindowPtr pWin;
- xPanoramiXGetScreenSizeReply rep;
- int rc;
-
- if (stuff->screen >= PanoramiXNumScreens)
- return BadMatch;
-
- REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- /* screen dimensions */
- rep.width = screenInfo.screens[stuff->screen]->width;
- rep.height = screenInfo.screens[stuff->screen]->height;
- rep.window = stuff->window;
- rep.screen = stuff->screen;
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.width);
- swapl(&rep.height);
- swapl(&rep.window);
- swapl(&rep.screen);
- }
- WriteToClient (client, sizeof (xPanoramiXGetScreenSizeReply), (char *) &rep);
- return Success;
-}
+ REQUEST(xPanoramiXGetScreenSizeReq);
+ WindowPtr pWin;
+ xPanoramiXGetScreenSizeReply rep;
+ int rc;
+ if (stuff->screen >= PanoramiXNumScreens)
+ return BadMatch;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ /* screen dimensions */
+ rep.width = screenInfo.screens[stuff->screen]->width;
+ rep.height = screenInfo.screens[stuff->screen]->height;
+ rep.window = stuff->window;
+ rep.screen = stuff->screen;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.width);
+ swapl(&rep.height);
+ swapl(&rep.window);
+ swapl(&rep.screen);
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep);
+ return Success;
+}
int
ProcXineramaIsActive(ClientPtr client)
{
/* REQUEST(xXineramaIsActiveReq); */
- xXineramaIsActiveReply rep;
+ xXineramaIsActiveReply rep;
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
@@ -1031,28 +1026,27 @@ ProcXineramaIsActive(ClientPtr client)
rep.sequenceNumber = client->sequence;
#if 1
{
- /* The following hack fools clients into thinking that Xinerama
- * is disabled even though it is not. */
- rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack;
+ /* The following hack fools clients into thinking that Xinerama
+ * is disabled even though it is not. */
+ rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack;
}
#else
rep.state = !noPanoramiXExtension;
#endif
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.state);
- }
- WriteToClient (client, sizeof (xXineramaIsActiveReply), (char *) &rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.state);
+ }
+ WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
return Success;
}
-
int
ProcXineramaQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
- xXineramaQueryScreensReply rep;
+ xXineramaQueryScreensReply rep;
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
@@ -1061,58 +1055,56 @@ ProcXineramaQueryScreens(ClientPtr client)
rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.number);
- }
- WriteToClient (client, sizeof (xXineramaQueryScreensReply), (char *) &rep);
-
- if(!noPanoramiXExtension) {
- xXineramaScreenInfo scratch;
- int i;
-
- FOR_NSCREENS(i) {
- scratch.x_org = screenInfo.screens[i]->x;
- scratch.y_org = screenInfo.screens[i]->y;
- scratch.width = screenInfo.screens[i]->width;
- scratch.height = screenInfo.screens[i]->height;
-
- if(client->swapped) {
- swaps(&scratch.x_org);
- swaps(&scratch.y_org);
- swaps(&scratch.width);
- swaps(&scratch.height);
- }
- WriteToClient (client, sz_XineramaScreenInfo, (char *) &scratch);
- }
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.number);
+ }
+ WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep);
+
+ if (!noPanoramiXExtension) {
+ xXineramaScreenInfo scratch;
+ int i;
+
+ FOR_NSCREENS(i) {
+ scratch.x_org = screenInfo.screens[i]->x;
+ scratch.y_org = screenInfo.screens[i]->y;
+ scratch.width = screenInfo.screens[i]->width;
+ scratch.height = screenInfo.screens[i]->height;
+
+ if (client->swapped) {
+ swaps(&scratch.x_org);
+ swaps(&scratch.y_org);
+ swaps(&scratch.width);
+ swaps(&scratch.height);
+ }
+ WriteToClient(client, sz_XineramaScreenInfo, (char *) &scratch);
+ }
}
return Success;
}
-
static int
-ProcPanoramiXDispatch (ClientPtr client)
-{ REQUEST(xReq);
- switch (stuff->data)
- {
- case X_PanoramiXQueryVersion:
- return ProcPanoramiXQueryVersion(client);
- case X_PanoramiXGetState:
- return ProcPanoramiXGetState(client);
- case X_PanoramiXGetScreenCount:
- return ProcPanoramiXGetScreenCount(client);
- case X_PanoramiXGetScreenSize:
- return ProcPanoramiXGetScreenSize(client);
- case X_XineramaIsActive:
- return ProcXineramaIsActive(client);
- case X_XineramaQueryScreens:
- return ProcXineramaQueryScreens(client);
+ProcPanoramiXDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ switch (stuff->data) {
+ case X_PanoramiXQueryVersion:
+ return ProcPanoramiXQueryVersion(client);
+ case X_PanoramiXGetState:
+ return ProcPanoramiXGetState(client);
+ case X_PanoramiXGetScreenCount:
+ 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)
@@ -1124,34 +1116,31 @@ ProcPanoramiXDispatch (ClientPtr client)
static void
CopyBits(char *dst, int shiftL, char *src, int bytes)
{
- /* Just get it to work. Worry about speed later */
+ /* 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++;
- }
+ 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
-){
+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, ScreenRegion, GrabRegion;
BoxRec SrcBox, *pbox;
int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth;
@@ -1163,129 +1152,136 @@ XineramaGetImageData(
/* find box in logical screen space */
SrcBox.x1 = left;
SrcBox.y1 = top;
- if(!isRoot) {
- SrcBox.x1 += pDraw->x + screenInfo.screens[0]->x;
- SrcBox.y1 += pDraw->y + screenInfo.screens[0]->y;
+ if (!isRoot) {
+ SrcBox.x1 += pDraw->x + screenInfo.screens[0]->x;
+ SrcBox.y1 += pDraw->y + screenInfo.screens[0]->y;
}
SrcBox.x2 = SrcBox.x1 + width;
SrcBox.y2 = SrcBox.y1 + height;
-
+
RegionInit(&SrcRegion, &SrcBox, 1);
RegionNull(&GrabRegion);
depth = (format == XYPixmap) ? 1 : pDraw->depth;
FOR_NSCREENS(i) {
- BoxRec TheBox;
- ScreenPtr pScreen;
- pDraw = pDrawables[i];
- pScreen = pDraw->pScreen;
-
- TheBox.x1 = pScreen->x;
- TheBox.x2 = TheBox.x1 + pScreen->width;
- TheBox.y1 = pScreen->y;
- TheBox.y2 = TheBox.y1 + pScreen->height;
-
- RegionInit(&ScreenRegion, &TheBox, 1);
- inOut = RegionContainsRect(&ScreenRegion, &SrcBox);
- if(inOut == rgnPART)
- RegionIntersect(&GrabRegion, &SrcRegion, &ScreenRegion);
- RegionUninit(&ScreenRegion);
-
- if(inOut == rgnIN) {
- (*pScreen->GetImage)(pDraw,
- SrcBox.x1 - pDraw->x - screenInfo.screens[i]->x,
- SrcBox.y1 - pDraw->y - screenInfo.screens[i]->y,
- width, height, format, planemask, data);
- break;
- } else if (inOut == rgnOUT)
- continue;
-
- nbox = RegionNumRects(&GrabRegion);
-
- if(nbox) {
- pbox = RegionRects(&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 = realloc(ScratchMem, sizeNeeded);
- if(ScratchMem)
- size = sizeNeeded;
- else {
- ScratchMem = tmpdata;
- break;
- }
- }
-
- x = pbox->x1 - pDraw->x - screenInfo.screens[i]->x;
- y = pbox->y1 - pDraw->y - screenInfo.screens[i]->y;
-
- (*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++;
- }
-
- RegionSubtract(&SrcRegion, &SrcRegion, &GrabRegion);
- if(!RegionNotEmpty(&SrcRegion))
- break;
- }
-
+ BoxRec TheBox;
+ ScreenPtr pScreen;
+
+ pDraw = pDrawables[i];
+ pScreen = pDraw->pScreen;
+
+ TheBox.x1 = pScreen->x;
+ TheBox.x2 = TheBox.x1 + pScreen->width;
+ TheBox.y1 = pScreen->y;
+ TheBox.y2 = TheBox.y1 + pScreen->height;
+
+ RegionInit(&ScreenRegion, &TheBox, 1);
+ inOut = RegionContainsRect(&ScreenRegion, &SrcBox);
+ if (inOut == rgnPART)
+ RegionIntersect(&GrabRegion, &SrcRegion, &ScreenRegion);
+ RegionUninit(&ScreenRegion);
+
+ if (inOut == rgnIN) {
+ (*pScreen->GetImage) (pDraw,
+ SrcBox.x1 - pDraw->x -
+ screenInfo.screens[i]->x,
+ SrcBox.y1 - pDraw->y -
+ screenInfo.screens[i]->y, width, height,
+ format, planemask, data);
+ break;
+ }
+ else if (inOut == rgnOUT)
+ continue;
+
+ nbox = RegionNumRects(&GrabRegion);
+
+ if (nbox) {
+ pbox = RegionRects(&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 = realloc(ScratchMem, sizeNeeded);
+ if (ScratchMem)
+ size = sizeNeeded;
+ else {
+ ScratchMem = tmpdata;
+ break;
+ }
+ }
+
+ x = pbox->x1 - pDraw->x - screenInfo.screens[i]->x;
+ y = pbox->y1 - pDraw->y - screenInfo.screens[i]->y;
+
+ (*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++;
+ }
+
+ RegionSubtract(&SrcRegion, &SrcRegion, &GrabRegion);
+ if (!RegionNotEmpty(&SrcRegion))
+ break;
+ }
+
}
free(ScratchMem);
diff --git a/xorg-server/Xext/panoramiXSwap.c b/xorg-server/Xext/panoramiXSwap.c
index 79277021a..b6ff6f918 100644
--- a/xorg-server/Xext/panoramiXSwap.c
+++ b/xorg-server/Xext/panoramiXSwap.c
@@ -48,89 +48,86 @@ Equipment Corporation.
#include "panoramiXh.h"
static int
-SProcPanoramiXQueryVersion (ClientPtr client)
+SProcPanoramiXQueryVersion(ClientPtr client)
{
- REQUEST(xPanoramiXQueryVersionReq);
+ REQUEST(xPanoramiXQueryVersionReq);
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
- return ProcPanoramiXQueryVersion(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
+ return ProcPanoramiXQueryVersion(client);
}
static int
SProcPanoramiXGetState(ClientPtr client)
{
- REQUEST(xPanoramiXGetStateReq);
+ REQUEST(xPanoramiXGetStateReq);
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
- swapl(&stuff->window);
- return ProcPanoramiXGetState(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ swapl(&stuff->window);
+ return ProcPanoramiXGetState(client);
}
-static int
+static int
SProcPanoramiXGetScreenCount(ClientPtr client)
{
- REQUEST(xPanoramiXGetScreenCountReq);
+ REQUEST(xPanoramiXGetScreenCountReq);
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
- swapl(&stuff->window);
- return ProcPanoramiXGetScreenCount(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ swapl(&stuff->window);
+ return ProcPanoramiXGetScreenCount(client);
}
-static int
+static int
SProcPanoramiXGetScreenSize(ClientPtr client)
{
- REQUEST(xPanoramiXGetScreenSizeReq);
+ REQUEST(xPanoramiXGetScreenSizeReq);
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
- swapl(&stuff->window);
- swapl(&stuff->screen);
- return ProcPanoramiXGetScreenSize(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ swapl(&stuff->window);
+ swapl(&stuff->screen);
+ return ProcPanoramiXGetScreenSize(client);
}
-
-static int
+static int
SProcXineramaIsActive(ClientPtr client)
{
- REQUEST(xXineramaIsActiveReq);
+ REQUEST(xXineramaIsActiveReq);
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
- return ProcXineramaIsActive(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+ return ProcXineramaIsActive(client);
}
-
-static int
+static int
SProcXineramaQueryScreens(ClientPtr client)
{
- REQUEST(xXineramaQueryScreensReq);
+ REQUEST(xXineramaQueryScreensReq);
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
- return ProcXineramaQueryScreens(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+ return ProcXineramaQueryScreens(client);
}
-
int
-SProcPanoramiXDispatch (ClientPtr client)
-{ REQUEST(xReq);
- switch (stuff->data)
- {
- case X_PanoramiXQueryVersion:
- return SProcPanoramiXQueryVersion(client);
- case X_PanoramiXGetState:
- return SProcPanoramiXGetState(client);
- case X_PanoramiXGetScreenCount:
- return SProcPanoramiXGetScreenCount(client);
- case X_PanoramiXGetScreenSize:
- return SProcPanoramiXGetScreenSize(client);
- case X_XineramaIsActive:
- return SProcXineramaIsActive(client);
- case X_XineramaQueryScreens:
- return SProcXineramaQueryScreens(client);
+SProcPanoramiXDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ switch (stuff->data) {
+ case X_PanoramiXQueryVersion:
+ return SProcPanoramiXQueryVersion(client);
+ case X_PanoramiXGetState:
+ return SProcPanoramiXGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return SProcPanoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return SProcPanoramiXGetScreenSize(client);
+ case X_XineramaIsActive:
+ return SProcXineramaIsActive(client);
+ case X_XineramaQueryScreens:
+ return SProcXineramaQueryScreens(client);
}
return BadRequest;
}
diff --git a/xorg-server/Xext/panoramiXprocs.c b/xorg-server/Xext/panoramiXprocs.c
index 9ea461173..12d6163bb 100644
--- a/xorg-server/Xext/panoramiXprocs.c
+++ b/xorg-server/Xext/panoramiXprocs.c
@@ -25,7 +25,6 @@ Equipment Corporation.
/* Massively rewritten by Mark Vojkovich <markv@valinux.com> */
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -52,12 +51,14 @@ Equipment Corporation.
#define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \
CWDontPropagate | CWOverrideRedirect | CWCursor )
-int PanoramiXCreateWindow(ClientPtr client)
+int
+PanoramiXCreateWindow(ClientPtr client)
{
PanoramiXRes *parent, *newWin;
PanoramiXRes *backPix = NULL;
PanoramiXRes *bordPix = NULL;
- PanoramiXRes *cmap = NULL;
+ PanoramiXRes *cmap = NULL;
+
REQUEST(xCreateWindowReq);
int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
int result, len, j;
@@ -66,54 +67,55 @@ int PanoramiXCreateWindow(ClientPtr client)
Bool parentIsRoot;
REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
-
+
len = client->req_len - bytes_to_int32(sizeof(xCreateWindowReq));
if (Ones(stuff->mask) != len)
return BadLength;
- result = dixLookupResourceByType((pointer *)&parent, stuff->parent,
- XRT_WINDOW, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &parent, stuff->parent,
+ XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
- if(stuff->class == CopyFromParent)
- stuff->class = parent->u.win.class;
+ if (stuff->class == CopyFromParent)
+ stuff->class = parent->u.win.class;
- if((stuff->class == InputOnly) && (stuff->mask & (~INPUTONLY_LEGAL_MASK)))
+ if ((stuff->class == InputOnly) && (stuff->mask & (~INPUTONLY_LEGAL_MASK)))
return BadMatch;
- if ((Mask)stuff->mask & CWBackPixmap) {
- pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1));
- tmp = *((CARD32 *) &stuff[1] + pback_offset);
- if ((tmp != None) && (tmp != ParentRelative)) {
- result = dixLookupResourceByType((pointer *)&backPix, tmp,
- XRT_PIXMAP, client, DixReadAccess);
- if (result != Success)
- return result;
- }
- }
- if ((Mask)stuff->mask & CWBorderPixmap) {
- pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1));
- tmp = *((CARD32 *) &stuff[1] + pbord_offset);
- if (tmp != CopyFromParent) {
- result = dixLookupResourceByType((pointer *)&bordPix, tmp,
- XRT_PIXMAP, client, DixReadAccess);
- if (result != Success)
- return result;
- }
- }
- if ((Mask)stuff->mask & CWColormap) {
- cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1));
- tmp = *((CARD32 *) &stuff[1] + cmap_offset);
- if ((tmp != CopyFromParent) && (tmp != None)) {
- result = dixLookupResourceByType((pointer *)&cmap, tmp,
- XRT_COLORMAP, client, DixReadAccess);
- if (result != Success)
- return result;
- }
- }
-
- if(!(newWin = malloc(sizeof(PanoramiXRes))))
+ if ((Mask) stuff->mask & CWBackPixmap) {
+ pback_offset = Ones((Mask) stuff->mask & (CWBackPixmap - 1));
+ tmp = *((CARD32 *) &stuff[1] + pback_offset);
+ if ((tmp != None) && (tmp != ParentRelative)) {
+ result = dixLookupResourceByType((pointer *) &backPix, tmp,
+ XRT_PIXMAP, client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
+ }
+ if ((Mask) stuff->mask & CWBorderPixmap) {
+ pbord_offset = Ones((Mask) stuff->mask & (CWBorderPixmap - 1));
+ tmp = *((CARD32 *) &stuff[1] + pbord_offset);
+ if (tmp != CopyFromParent) {
+ result = dixLookupResourceByType((pointer *) &bordPix, tmp,
+ XRT_PIXMAP, client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
+ }
+ if ((Mask) stuff->mask & CWColormap) {
+ cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
+ tmp = *((CARD32 *) &stuff[1] + cmap_offset);
+ if ((tmp != CopyFromParent) && (tmp != None)) {
+ result = dixLookupResourceByType((pointer *) &cmap, tmp,
+ XRT_COLORMAP, client,
+ DixReadAccess);
+ if (result != Success)
+ return result;
+ }
+ }
+
+ if (!(newWin = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newWin->type = XRT_WINDOW;
@@ -123,326 +125,346 @@ int PanoramiXCreateWindow(ClientPtr client)
panoramix_setup_ids(newWin, client, stuff->wid);
if (stuff->class == InputOnly)
- stuff->visual = CopyFromParent;
+ stuff->visual = CopyFromParent;
orig_visual = stuff->visual;
orig_x = stuff->x;
orig_y = stuff->y;
- parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
- (stuff->parent == screenInfo.screens[0]->screensaver.wid);
+ parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id)
+ || (stuff->parent == screenInfo.screens[0]->screensaver.wid);
FOR_NSCREENS_BACKWARD(j) {
stuff->wid = newWin->info[j].id;
stuff->parent = parent->info[j].id;
- if (parentIsRoot) {
- stuff->x = orig_x - screenInfo.screens[j]->x;
- stuff->y = orig_y - screenInfo.screens[j]->y;
- }
- 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 = PanoramiXTranslateVisualID(j, orig_visual);
- result = (*SavedProcVector[X_CreateWindow])(client);
- if(result != Success) break;
+ if (parentIsRoot) {
+ stuff->x = orig_x - screenInfo.screens[j]->x;
+ stuff->y = orig_y - screenInfo.screens[j]->y;
+ }
+ 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 = PanoramiXTranslateVisualID(j, orig_visual);
+ result = (*SavedProcVector[X_CreateWindow]) (client);
+ if (result != Success)
+ break;
}
if (result == Success)
AddResource(newWin->info[0].id, XRT_WINDOW, newWin);
- else
+ else
free(newWin);
return result;
}
-
-int PanoramiXChangeWindowAttributes(ClientPtr client)
+int
+PanoramiXChangeWindowAttributes(ClientPtr client)
{
PanoramiXRes *win;
PanoramiXRes *backPix = NULL;
PanoramiXRes *bordPix = NULL;
- PanoramiXRes *cmap = NULL;
+ PanoramiXRes *cmap = NULL;
+
REQUEST(xChangeWindowAttributesReq);
int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
int result, len, j;
XID tmp;
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
-
+
len = client->req_len - bytes_to_int32(sizeof(xChangeWindowAttributesReq));
if (Ones(stuff->valueMask) != len)
return BadLength;
- result = dixLookupResourceByType((pointer *)&win, stuff->window,
- XRT_WINDOW, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->window,
+ XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
- if((win->u.win.class == InputOnly) &&
- (stuff->valueMask & (~INPUTONLY_LEGAL_MASK)))
+ 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));
- tmp = *((CARD32 *) &stuff[1] + pback_offset);
- if ((tmp != None) && (tmp != ParentRelative)) {
- result = dixLookupResourceByType((pointer *)&backPix, tmp,
- XRT_PIXMAP, client, DixReadAccess);
- if (result != Success)
- return result;
- }
- }
- if ((Mask)stuff->valueMask & CWBorderPixmap) {
- pbord_offset = Ones((Mask)stuff->valueMask & (CWBorderPixmap - 1));
- tmp = *((CARD32 *) &stuff[1] + pbord_offset);
- if (tmp != CopyFromParent) {
- result = dixLookupResourceByType((pointer *)&bordPix, tmp,
- XRT_PIXMAP, client, DixReadAccess);
- if (result != Success)
- return result;
- }
- }
- if ((Mask)stuff->valueMask & CWColormap) {
- cmap_offset = Ones((Mask)stuff->valueMask & (CWColormap - 1));
- tmp = *((CARD32 *) &stuff[1] + cmap_offset);
- if ((tmp != CopyFromParent) && (tmp != None)) {
- result = dixLookupResourceByType((pointer *)&cmap, tmp,
- XRT_COLORMAP, client, DixReadAccess);
- if (result != Success)
- return result;
- }
+ if ((Mask) stuff->valueMask & CWBackPixmap) {
+ pback_offset = Ones((Mask) stuff->valueMask & (CWBackPixmap - 1));
+ tmp = *((CARD32 *) &stuff[1] + pback_offset);
+ if ((tmp != None) && (tmp != ParentRelative)) {
+ result = dixLookupResourceByType((pointer *) &backPix, tmp,
+ XRT_PIXMAP, client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
+ }
+ if ((Mask) stuff->valueMask & CWBorderPixmap) {
+ pbord_offset = Ones((Mask) stuff->valueMask & (CWBorderPixmap - 1));
+ tmp = *((CARD32 *) &stuff[1] + pbord_offset);
+ if (tmp != CopyFromParent) {
+ result = dixLookupResourceByType((pointer *) &bordPix, tmp,
+ XRT_PIXMAP, client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
+ }
+ if ((Mask) stuff->valueMask & CWColormap) {
+ cmap_offset = Ones((Mask) stuff->valueMask & (CWColormap - 1));
+ tmp = *((CARD32 *) &stuff[1] + cmap_offset);
+ if ((tmp != CopyFromParent) && (tmp != None)) {
+ result = dixLookupResourceByType((pointer *) &cmap, tmp,
+ XRT_COLORMAP, client,
+ DixReadAccess);
+ if (result != Success)
+ return result;
+ }
}
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);
+ 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)
+int
+PanoramiXDestroyWindow(ClientPtr client)
{
PanoramiXRes *win;
- int result, j;
+ int result, j;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW,
- client, DixDestroyAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->id, XRT_WINDOW,
+ client, DixDestroyAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_BACKWARD(j) {
- stuff->id = win->info[j].id;
- result = (*SavedProcVector[X_DestroyWindow])(client);
- if(result != Success) break;
+ 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 */
-
+ our resource for us on the last pass through the loop above */
+
return result;
}
-
-int PanoramiXDestroySubwindows(ClientPtr client)
+int
+PanoramiXDestroySubwindows(ClientPtr client)
{
PanoramiXRes *win;
- int result, j;
+ int result, j;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW,
- client, DixDestroyAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->id, XRT_WINDOW,
+ client, DixDestroyAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_BACKWARD(j) {
- stuff->id = win->info[j].id;
- result = (*SavedProcVector[X_DestroySubwindows])(client);
- if(result != Success) break;
+ 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 */
+ our resources for us on the last pass through the loop above */
return result;
}
-
-int PanoramiXChangeSaveSet(ClientPtr client)
+int
+PanoramiXChangeSaveSet(ClientPtr client)
{
PanoramiXRes *win;
- int result, j;
+ int result, j;
+
REQUEST(xChangeSaveSetReq);
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->window,
- XRT_WINDOW, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->window,
+ XRT_WINDOW, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_BACKWARD(j) {
- stuff->window = win->info[j].id;
- result = (*SavedProcVector[X_ChangeSaveSet])(client);
- if(result != Success) break;
+ stuff->window = win->info[j].id;
+ result = (*SavedProcVector[X_ChangeSaveSet]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXReparentWindow(ClientPtr client)
+int
+PanoramiXReparentWindow(ClientPtr client)
{
PanoramiXRes *win, *parent;
- int result, j;
- int x, y;
- Bool parentIsRoot;
+ int result, j;
+ int x, y;
+ Bool parentIsRoot;
+
REQUEST(xReparentWindowReq);
REQUEST_SIZE_MATCH(xReparentWindowReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->window,
- XRT_WINDOW, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->window,
+ XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
- result = dixLookupResourceByType((pointer *)&parent, stuff->parent,
- XRT_WINDOW, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &parent, stuff->parent,
+ XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
x = stuff->x;
y = stuff->y;
- parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
- (stuff->parent == screenInfo.screens[0]->screensaver.wid);
+ parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id)
+ || (stuff->parent == screenInfo.screens[0]->screensaver.wid);
FOR_NSCREENS_BACKWARD(j) {
- stuff->window = win->info[j].id;
- stuff->parent = parent->info[j].id;
- if(parentIsRoot) {
- stuff->x = x - screenInfo.screens[j]->x;
- stuff->y = y - screenInfo.screens[j]->y;
- }
- result = (*SavedProcVector[X_ReparentWindow])(client);
- if(result != Success) break;
+ stuff->window = win->info[j].id;
+ stuff->parent = parent->info[j].id;
+ if (parentIsRoot) {
+ stuff->x = x - screenInfo.screens[j]->x;
+ stuff->y = y - screenInfo.screens[j]->y;
+ }
+ result = (*SavedProcVector[X_ReparentWindow]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXMapWindow(ClientPtr client)
+int
+PanoramiXMapWindow(ClientPtr client)
{
PanoramiXRes *win;
- int result, j;
+ int result, j;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->id,
- XRT_WINDOW, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->id,
+ XRT_WINDOW, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_FORWARD(j) {
- stuff->id = win->info[j].id;
- result = (*SavedProcVector[X_MapWindow])(client);
- if(result != Success) break;
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_MapWindow]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXMapSubwindows(ClientPtr client)
+int
+PanoramiXMapSubwindows(ClientPtr client)
{
PanoramiXRes *win;
- int result, j;
+ int result, j;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->id,
- XRT_WINDOW, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->id,
+ XRT_WINDOW, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_FORWARD(j) {
- stuff->id = win->info[j].id;
- result = (*SavedProcVector[X_MapSubwindows])(client);
- if(result != Success) break;
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_MapSubwindows]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXUnmapWindow(ClientPtr client)
+int
+PanoramiXUnmapWindow(ClientPtr client)
{
PanoramiXRes *win;
- int result, j;
+ int result, j;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->id,
- XRT_WINDOW, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->id,
+ XRT_WINDOW, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_FORWARD(j) {
- stuff->id = win->info[j].id;
- result = (*SavedProcVector[X_UnmapWindow])(client);
- if(result != Success) break;
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_UnmapWindow]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXUnmapSubwindows(ClientPtr client)
+int
+PanoramiXUnmapSubwindows(ClientPtr client)
{
PanoramiXRes *win;
- int result, j;
+ int result, j;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->id,
- XRT_WINDOW, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->id,
+ XRT_WINDOW, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_FORWARD(j) {
- stuff->id = win->info[j].id;
- result = (*SavedProcVector[X_UnmapSubwindows])(client);
- if(result != Success) break;
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_UnmapSubwindows]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXConfigureWindow(ClientPtr client)
+int
+PanoramiXConfigureWindow(ClientPtr client)
{
PanoramiXRes *win;
PanoramiXRes *sib = NULL;
- WindowPtr pWin;
- int result, j, len, sib_offset = 0, x = 0, y = 0;
- int x_offset = -1;
- int y_offset = -1;
+ WindowPtr pWin;
+ int result, j, len, sib_offset = 0, x = 0, y = 0;
+ int x_offset = -1;
+ int y_offset = -1;
+
REQUEST(xConfigureWindowReq);
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
@@ -452,92 +474,97 @@ int PanoramiXConfigureWindow(ClientPtr client)
return BadLength;
/* because we need the parent */
- result = dixLookupResourceByType((pointer *)&pWin, stuff->window,
- RT_WINDOW, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &pWin, stuff->window,
+ RT_WINDOW, client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
- result = dixLookupResourceByType((pointer *)&win, stuff->window,
- XRT_WINDOW, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->window,
+ XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
+
+ if ((Mask) stuff->mask & CWSibling) {
+ XID tmp;
- if ((Mask)stuff->mask & CWSibling) {
- XID tmp;
- sib_offset = Ones((Mask)stuff->mask & (CWSibling - 1));
- if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) {
- result = dixLookupResourceByType((pointer *)&sib, tmp, XRT_WINDOW,
- client, DixReadAccess);
- if (result != Success)
- return result;
- }
+ sib_offset = Ones((Mask) stuff->mask & (CWSibling - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) {
+ result = dixLookupResourceByType((pointer *) &sib, tmp, XRT_WINDOW,
+ client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
}
- if(pWin->parent && ((pWin->parent == screenInfo.screens[0]->root) ||
- (pWin->parent->drawable.id == screenInfo.screens[0]->screensaver.wid)))
- {
- 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);
- }
+ if (pWin->parent && ((pWin->parent == screenInfo.screens[0]->root) ||
+ (pWin->parent->drawable.id ==
+ screenInfo.screens[0]->screensaver.wid))) {
+ 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 */
+ 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 - screenInfo.screens[j]->x;
- if(y_offset >= 0)
- *((CARD32 *) &stuff[1] + y_offset) = y - screenInfo.screens[j]->y;
- result = (*SavedProcVector[X_ConfigureWindow])(client);
- if(result != Success) break;
+ 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 - screenInfo.screens[j]->x;
+ if (y_offset >= 0)
+ *((CARD32 *) &stuff[1] + y_offset) = y - screenInfo.screens[j]->y;
+ result = (*SavedProcVector[X_ConfigureWindow]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXCirculateWindow(ClientPtr client)
+int
+PanoramiXCirculateWindow(ClientPtr client)
{
PanoramiXRes *win;
- int result, j;
+ int result, j;
+
REQUEST(xCirculateWindowReq);
REQUEST_SIZE_MATCH(xCirculateWindowReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->window,
- XRT_WINDOW, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->window,
+ XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_FORWARD(j) {
- stuff->window = win->info[j].id;
- result = (*SavedProcVector[X_CirculateWindow])(client);
- if(result != Success) break;
+ stuff->window = win->info[j].id;
+ result = (*SavedProcVector[X_CirculateWindow]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXGetGeometry(ClientPtr client)
+int
+PanoramiXGetGeometry(ClientPtr client)
{
- xGetGeometryReply rep;
+ xGetGeometryReply rep;
DrawablePtr pDraw;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
@@ -549,33 +576,35 @@ int PanoramiXGetGeometry(ClientPtr client)
rep.x = rep.y = rep.borderWidth = 0;
if (stuff->id == rep.root) {
- xWindowRoot *root = (xWindowRoot *)
- (ConnectionInfo + connBlockScreenStart);
-
- rep.width = root->pixWidth;
- rep.height = root->pixHeight;
- } else
- if (WindowDrawable(pDraw->type))
- {
- WindowPtr pWin = (WindowPtr)pDraw;
- rep.x = pWin->origin.x - wBorderWidth (pWin);
- rep.y = pWin->origin.y - wBorderWidth (pWin);
- if((pWin->parent == screenInfo.screens[0]->root) ||
- (pWin->parent->drawable.id == screenInfo.screens[0]->screensaver.wid))
- {
- rep.x += screenInfo.screens[0]->x;
- rep.y += screenInfo.screens[0]->y;
- }
- rep.borderWidth = pWin->borderWidth;
+ xWindowRoot *root = (xWindowRoot *)
+ (ConnectionInfo + connBlockScreenStart);
+
+ rep.width = root->pixWidth;
+ rep.height = root->pixHeight;
+ }
+ else if (WindowDrawable(pDraw->type)) {
+ WindowPtr pWin = (WindowPtr) pDraw;
+
+ rep.x = pWin->origin.x - wBorderWidth(pWin);
+ rep.y = pWin->origin.y - wBorderWidth(pWin);
+ if ((pWin->parent == screenInfo.screens[0]->root) ||
+ (pWin->parent->drawable.id ==
+ screenInfo.screens[0]->screensaver.wid)) {
+ rep.x += screenInfo.screens[0]->x;
+ rep.y += screenInfo.screens[0]->y;
+ }
+ rep.borderWidth = pWin->borderWidth;
}
WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
return Success;
}
-int PanoramiXTranslateCoords(ClientPtr client)
+int
+PanoramiXTranslateCoords(ClientPtr client)
{
INT16 x, y;
+
REQUEST(xTranslateCoordsReq);
int rc;
WindowPtr pWin, pDst;
@@ -594,172 +623,177 @@ int PanoramiXTranslateCoords(ClientPtr client)
rep.sameScreen = xTrue;
rep.child = None;
- if((pWin == screenInfo.screens[0]->root) ||
- (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid))
- {
- x = stuff->srcX - screenInfo.screens[0]->x;
- y = stuff->srcY - screenInfo.screens[0]->y;
- } else {
- x = pWin->drawable.x + stuff->srcX;
- y = pWin->drawable.y + stuff->srcY;
+ if ((pWin == screenInfo.screens[0]->root) ||
+ (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid)) {
+ x = stuff->srcX - screenInfo.screens[0]->x;
+ y = stuff->srcY - screenInfo.screens[0]->y;
+ }
+ else {
+ x = pWin->drawable.x + stuff->srcX;
+ y = pWin->drawable.y + stuff->srcY;
}
pWin = pDst->firstChild;
while (pWin) {
- BoxRec box;
- 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))
- /* When a window is shaped, a further check
- * is made to see if the point is inside
- * borderSize
- */
- && (!wBoundingShape(pWin) ||
- RegionContainsPoint(wBoundingShape(pWin),
- x - pWin->drawable.x,
- y - pWin->drawable.y, &box))
- )
- {
- rep.child = pWin->drawable.id;
- pWin = (WindowPtr) NULL;
- }
- else
- pWin = pWin->nextSib;
+ BoxRec box;
+
+ 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))
+ /* When a window is shaped, a further check
+ * is made to see if the point is inside
+ * borderSize
+ */
+ && (!wBoundingShape(pWin) ||
+ RegionContainsPoint(wBoundingShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box))
+ ) {
+ 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 == screenInfo.screens[0]->root) ||
- (pDst->drawable.id == screenInfo.screens[0]->screensaver.wid))
- {
- rep.dstX += screenInfo.screens[0]->x;
- rep.dstY += screenInfo.screens[0]->y;
+ if ((pDst == screenInfo.screens[0]->root) ||
+ (pDst->drawable.id == screenInfo.screens[0]->screensaver.wid)) {
+ rep.dstX += screenInfo.screens[0]->x;
+ rep.dstY += screenInfo.screens[0]->y;
}
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
return Success;
}
-int PanoramiXCreatePixmap(ClientPtr client)
+int
+PanoramiXCreatePixmap(ClientPtr client)
{
PanoramiXRes *refDraw, *newPix;
int result, j;
+
REQUEST(xCreatePixmapReq);
REQUEST_SIZE_MATCH(xCreatePixmapReq);
client->errorValue = stuff->pid;
- result = dixLookupResourceByClass((pointer *)&refDraw, stuff->drawable,
- XRC_DRAWABLE, client, DixReadAccess);
+ result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable,
+ XRC_DRAWABLE, client, DixReadAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(!(newPix = malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPix = malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPix->type = XRT_PIXMAP;
newPix->u.pix.shared = FALSE;
panoramix_setup_ids(newPix, client, stuff->pid);
-
+
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;
+ 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
- free(newPix);
+ AddResource(newPix->info[0].id, XRT_PIXMAP, newPix);
+ else
+ free(newPix);
return result;
}
-
-int PanoramiXFreePixmap(ClientPtr client)
+int
+PanoramiXFreePixmap(ClientPtr client)
{
PanoramiXRes *pix;
- int result, j;
+ int result, j;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
client->errorValue = stuff->id;
- result = dixLookupResourceByType((pointer *)&pix, stuff->id, XRT_PIXMAP,
- client, DixDestroyAccess);
+ result = dixLookupResourceByType((pointer *) &pix, stuff->id, XRT_PIXMAP,
+ client, DixDestroyAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_BACKWARD(j) {
- stuff->id = pix->info[j].id;
- result = (*SavedProcVector[X_FreePixmap])(client);
- if(result != Success) break;
+ 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 */
-
+ our resource for us on the last pass through the loop above */
+
return result;
}
-
-int PanoramiXCreateGC(ClientPtr client)
+int
+PanoramiXCreateGC(ClientPtr client)
{
PanoramiXRes *refDraw;
PanoramiXRes *newGC;
PanoramiXRes *stip = NULL;
PanoramiXRes *tile = NULL;
PanoramiXRes *clip = NULL;
+
REQUEST(xCreateGCReq);
int tile_offset = 0, stip_offset = 0, clip_offset = 0;
int result, len, j;
XID tmp;
REQUEST_AT_LEAST_SIZE(xCreateGCReq);
-
+
client->errorValue = stuff->gc;
len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq));
if (Ones(stuff->mask) != len)
return BadLength;
- result = dixLookupResourceByClass((pointer *)&refDraw, stuff->drawable,
- XRC_DRAWABLE, client, DixReadAccess);
- if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
-
- if ((Mask)stuff->mask & GCTile) {
- tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
- if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
- result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP,
- client, DixReadAccess);
- if (result != Success)
- return result;
- }
- }
- if ((Mask)stuff->mask & GCStipple) {
- stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
- if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
- result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP,
- client, DixReadAccess);
- if (result != Success)
- return result;
- }
- }
- if ((Mask)stuff->mask & GCClipMask) {
- clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
- if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
- result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP,
- client, DixReadAccess);
- if (result != Success)
- return result;
- }
- }
-
- if(!(newGC = malloc(sizeof(PanoramiXRes))))
+ result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable,
+ XRC_DRAWABLE, client, DixReadAccess);
+ if (result != Success)
+ return (result == BadValue) ? BadDrawable : result;
+
+ if ((Mask) stuff->mask & GCTile) {
+ tile_offset = Ones((Mask) stuff->mask & (GCTile - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
+ result = dixLookupResourceByType((pointer *) &tile, tmp, XRT_PIXMAP,
+ client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
+ }
+ if ((Mask) stuff->mask & GCStipple) {
+ stip_offset = Ones((Mask) stuff->mask & (GCStipple - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
+ result = dixLookupResourceByType((pointer *) &stip, tmp, XRT_PIXMAP,
+ client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
+ }
+ if ((Mask) stuff->mask & GCClipMask) {
+ clip_offset = Ones((Mask) stuff->mask & (GCClipMask - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
+ result = dixLookupResourceByType((pointer *) &clip, tmp, XRT_PIXMAP,
+ client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
+ }
+
+ if (!(newGC = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newGC->type = XRT_GC;
@@ -768,223 +802,235 @@ int PanoramiXCreateGC(ClientPtr client)
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 (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
+ else
free(newGC);
return result;
}
-int PanoramiXChangeGC(ClientPtr client)
+int
+PanoramiXChangeGC(ClientPtr client)
{
PanoramiXRes *gc;
PanoramiXRes *stip = NULL;
PanoramiXRes *tile = NULL;
PanoramiXRes *clip = NULL;
+
REQUEST(xChangeGCReq);
int tile_offset = 0, stip_offset = 0, clip_offset = 0;
int result, len, j;
XID tmp;
REQUEST_AT_LEAST_SIZE(xChangeGCReq);
-
+
len = client->req_len - bytes_to_int32(sizeof(xChangeGCReq));
if (Ones(stuff->mask) != len)
return BadLength;
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
- if ((Mask)stuff->mask & GCTile) {
- tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
- if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
- result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP,
- client, DixReadAccess);
- if (result != Success)
- return result;
- }
+ if ((Mask) stuff->mask & GCTile) {
+ tile_offset = Ones((Mask) stuff->mask & (GCTile - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
+ result = dixLookupResourceByType((pointer *) &tile, tmp, XRT_PIXMAP,
+ client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
}
- if ((Mask)stuff->mask & GCStipple) {
- stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
- if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
- result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP,
- client, DixReadAccess);
- if (result != Success)
- return result;
- }
+ if ((Mask) stuff->mask & GCStipple) {
+ stip_offset = Ones((Mask) stuff->mask & (GCStipple - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
+ result = dixLookupResourceByType((pointer *) &stip, tmp, XRT_PIXMAP,
+ client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
}
- if ((Mask)stuff->mask & GCClipMask) {
- clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
- if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
- result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP,
- client, DixReadAccess);
- if (result != Success)
- return result;
- }
+ if ((Mask) stuff->mask & GCClipMask) {
+ clip_offset = Ones((Mask) stuff->mask & (GCClipMask - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
+ result = dixLookupResourceByType((pointer *) &clip, tmp, XRT_PIXMAP,
+ client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
}
-
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;
+ 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
+PanoramiXCopyGC(ClientPtr client)
{
PanoramiXRes *srcGC, *dstGC;
- int result, j;
+ int result, j;
+
REQUEST(xCopyGCReq);
REQUEST_SIZE_MATCH(xCopyGCReq);
- result = dixLookupResourceByType((pointer *)&srcGC, stuff->srcGC, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &srcGC, stuff->srcGC, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
- result = dixLookupResourceByType((pointer *)&dstGC, stuff->dstGC, XRT_GC,
- client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &dstGC, stuff->dstGC, XRT_GC,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS(j) {
- stuff->srcGC = srcGC->info[j].id;
- stuff->dstGC = dstGC->info[j].id;
- result = (*SavedProcVector[X_CopyGC])(client);
- if(result != Success) break;
+ 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)
+int
+PanoramiXSetDashes(ClientPtr client)
{
PanoramiXRes *gc;
- int result, j;
+ int result, j;
+
REQUEST(xSetDashesReq);
REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_BACKWARD(j) {
- stuff->gc = gc->info[j].id;
- result = (*SavedProcVector[X_SetDashes])(client);
- if(result != Success) break;
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_SetDashes]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXSetClipRectangles(ClientPtr client)
+int
+PanoramiXSetClipRectangles(ClientPtr client)
{
PanoramiXRes *gc;
- int result, j;
+ int result, j;
+
REQUEST(xSetClipRectanglesReq);
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_BACKWARD(j) {
- stuff->gc = gc->info[j].id;
- result = (*SavedProcVector[X_SetClipRectangles])(client);
- if(result != Success) break;
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_SetClipRectangles]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXFreeGC(ClientPtr client)
+int
+PanoramiXFreeGC(ClientPtr client)
{
PanoramiXRes *gc;
- int result, j;
+ int result, j;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- result = dixLookupResourceByType((pointer *)&gc, stuff->id, XRT_GC,
- client, DixDestroyAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->id, XRT_GC,
+ client, DixDestroyAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_BACKWARD(j) {
- stuff->id = gc->info[j].id;
- result = (*SavedProcVector[X_FreeGC])(client);
- if(result != Success) break;
+ 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 */
-
+ our resource for us on the last pass through the loop above */
+
return result;
}
-
-int PanoramiXClearToBackground(ClientPtr client)
+int
+PanoramiXClearToBackground(ClientPtr client)
{
PanoramiXRes *win;
- int result, j, x, y;
- Bool isRoot;
+ int result, j, x, y;
+ Bool isRoot;
+
REQUEST(xClearAreaReq);
REQUEST_SIZE_MATCH(xClearAreaReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->window,
- XRT_WINDOW, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->window,
+ XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
x = stuff->x;
y = stuff->y;
isRoot = win->u.win.root;
FOR_NSCREENS_BACKWARD(j) {
- stuff->window = win->info[j].id;
- if(isRoot) {
- stuff->x = x - screenInfo.screens[j]->x;
- stuff->y = y - screenInfo.screens[j]->y;
- }
- result = (*SavedProcVector[X_ClearArea])(client);
- if(result != Success) break;
- }
-
+ stuff->window = win->info[j].id;
+ if (isRoot) {
+ stuff->x = x - screenInfo.screens[j]->x;
+ stuff->y = y - screenInfo.screens[j]->y;
+ }
+ result = (*SavedProcVector[X_ClearArea]) (client);
+ if (result != Success)
+ break;
+ }
+
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
@@ -995,821 +1041,882 @@ int PanoramiXClearToBackground(ClientPtr client)
have to fix this later. (MArk).
*/
-int PanoramiXCopyArea(ClientPtr client)
+int
+PanoramiXCopyArea(ClientPtr client)
{
- int j, result, srcx, srcy, dstx, dsty;
- PanoramiXRes *gc, *src, *dst;
- Bool srcIsRoot = FALSE;
- Bool dstIsRoot = FALSE;
- Bool srcShared, dstShared;
+ int j, result, srcx, srcy, dstx, dsty;
+ PanoramiXRes *gc, *src, *dst;
+ Bool srcIsRoot = FALSE;
+ Bool dstIsRoot = FALSE;
+ Bool srcShared, dstShared;
+
REQUEST(xCopyAreaReq);
REQUEST_SIZE_MATCH(xCopyAreaReq);
- result = dixLookupResourceByClass((pointer *)&src, stuff->srcDrawable,
- XRC_DRAWABLE, client, DixReadAccess);
+ result = dixLookupResourceByClass((pointer *) &src, stuff->srcDrawable,
+ XRC_DRAWABLE, client, DixReadAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
srcShared = IS_SHARED_PIXMAP(src);
- result = dixLookupResourceByClass((pointer *)&dst, stuff->dstDrawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &dst, stuff->dstDrawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
dstShared = IS_SHARED_PIXMAP(dst);
- if(dstShared && srcShared)
- return (* SavedProcVector[X_CopyArea])(client);
+ if (dstShared && srcShared)
+ return (*SavedProcVector[X_CopyArea]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
-
- if((dst->type == XRT_WINDOW) && dst->u.win.root)
- dstIsRoot = TRUE;
- if((src->type == XRT_WINDOW) && src->u.win.root)
- srcIsRoot = TRUE;
+ return result;
- 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;
+ if ((dst->type == XRT_WINDOW) && dst->u.win.root)
+ dstIsRoot = TRUE;
+ if ((src->type == XRT_WINDOW) && src->u.win.root)
+ 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, rc;
-
- FOR_NSCREENS(j) {
- rc = dixLookupDrawable(drawables+j, src->info[j].id, client, 0,
- DixGetAttrAccess);
- if (rc != Success)
- return rc;
- }
-
- pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
- if(!(data = calloc(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, DixWriteAccess);
- if(drawables[0]->depth != pDst->depth) {
- client->errorValue = stuff->dstDrawable;
- free(data);
- return BadMatch;
- }
-
- (*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty,
- stuff->width, stuff->height,
- 0, ZPixmap, data);
-
- if(dstShared) break;
- }
-
- free(data);
- } else {
- DrawablePtr pDst = NULL, pSrc = NULL;
- GCPtr pGC = NULL;
- RegionRec totalReg;
- int rc;
-
- RegionNull(&totalReg);
- FOR_NSCREENS_BACKWARD(j) {
- RegionPtr pRgn;
- stuff->dstDrawable = dst->info[j].id;
- stuff->srcDrawable = src->info[j].id;
- stuff->gc = gc->info[j].id;
- if (srcIsRoot) {
- stuff->srcX = srcx - screenInfo.screens[j]->x;
- stuff->srcY = srcy - screenInfo.screens[j]->y;
- }
- if (dstIsRoot) {
- stuff->dstX = dstx - screenInfo.screens[j]->x;
- stuff->dstY = dsty - screenInfo.screens[j]->y;
- }
-
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
-
- if (stuff->dstDrawable != stuff->srcDrawable) {
- rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
- DixReadAccess);
- if (rc != Success)
- return rc;
-
- if ((pDst->pScreen != pSrc->pScreen) ||
- (pDst->depth != pSrc->depth)) {
- client->errorValue = stuff->dstDrawable;
- return BadMatch;
- }
- } else
- pSrc = pDst;
-
- pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC,
- stuff->srcX, stuff->srcY,
- stuff->width, stuff->height,
- stuff->dstX, stuff->dstY);
- if(pGC->graphicsExposures && pRgn) {
- if(srcIsRoot) {
- RegionTranslate(pRgn,
- screenInfo.screens[j]->x, screenInfo.screens[j]->y);
- }
- RegionAppend(&totalReg, pRgn);
- RegionDestroy(pRgn);
- }
-
- if(dstShared)
- break;
- }
-
- if(pGC->graphicsExposures) {
- Bool overlap;
- RegionValidate(&totalReg, &overlap);
- (*pDst->pScreen->SendGraphicsExpose)(
- client, &totalReg, stuff->dstDrawable, X_CopyArea, 0);
- RegionUninit(&totalReg);
- }
+ int pitch, rc;
+
+ FOR_NSCREENS(j) {
+ rc = dixLookupDrawable(drawables + j, src->info[j].id, client, 0,
+ DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+ }
+
+ pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
+ if (!(data = calloc(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, DixWriteAccess);
+ if (drawables[0]->depth != pDst->depth) {
+ client->errorValue = stuff->dstDrawable;
+ free(data);
+ return BadMatch;
+ }
+
+ (*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty,
+ stuff->width, stuff->height,
+ 0, ZPixmap, data);
+
+ if (dstShared)
+ break;
+ }
+
+ free(data);
+ }
+ else {
+ DrawablePtr pDst = NULL, pSrc = NULL;
+ GCPtr pGC = NULL;
+ RegionRec totalReg;
+ int rc;
+
+ RegionNull(&totalReg);
+ FOR_NSCREENS_BACKWARD(j) {
+ RegionPtr pRgn;
+
+ stuff->dstDrawable = dst->info[j].id;
+ stuff->srcDrawable = src->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (srcIsRoot) {
+ stuff->srcX = srcx - screenInfo.screens[j]->x;
+ stuff->srcY = srcy - screenInfo.screens[j]->y;
+ }
+ if (dstIsRoot) {
+ stuff->dstX = dstx - screenInfo.screens[j]->x;
+ stuff->dstY = dsty - screenInfo.screens[j]->y;
+ }
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
+
+ if (stuff->dstDrawable != stuff->srcDrawable) {
+ rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ if ((pDst->pScreen != pSrc->pScreen) ||
+ (pDst->depth != pSrc->depth)) {
+ client->errorValue = stuff->dstDrawable;
+ return BadMatch;
+ }
+ }
+ else
+ pSrc = pDst;
+
+ pRgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC,
+ stuff->srcX, stuff->srcY,
+ stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY);
+ if (pGC->graphicsExposures && pRgn) {
+ if (srcIsRoot) {
+ RegionTranslate(pRgn,
+ screenInfo.screens[j]->x,
+ screenInfo.screens[j]->y);
+ }
+ RegionAppend(&totalReg, pRgn);
+ RegionDestroy(pRgn);
+ }
+
+ if (dstShared)
+ break;
+ }
+
+ if (pGC->graphicsExposures) {
+ Bool overlap;
+
+ RegionValidate(&totalReg, &overlap);
+ (*pDst->pScreen->SendGraphicsExpose) (client, &totalReg,
+ stuff->dstDrawable,
+ X_CopyArea, 0);
+ RegionUninit(&totalReg);
+ }
}
return Success;
}
-
-int PanoramiXCopyPlane(ClientPtr client)
+int
+PanoramiXCopyPlane(ClientPtr client)
{
- int j, srcx, srcy, dstx, dsty, rc;
- PanoramiXRes *gc, *src, *dst;
- Bool srcIsRoot = FALSE;
- Bool dstIsRoot = FALSE;
- Bool srcShared, dstShared;
- DrawablePtr psrcDraw, pdstDraw = NULL;
- GCPtr pGC = NULL;
- RegionRec totalReg;
+ int j, srcx, srcy, dstx, dsty, rc;
+ PanoramiXRes *gc, *src, *dst;
+ Bool srcIsRoot = FALSE;
+ Bool dstIsRoot = FALSE;
+ Bool srcShared, dstShared;
+ DrawablePtr psrcDraw, pdstDraw = NULL;
+ GCPtr pGC = NULL;
+ RegionRec totalReg;
+
REQUEST(xCopyPlaneReq);
REQUEST_SIZE_MATCH(xCopyPlaneReq);
- rc = dixLookupResourceByClass((pointer *)&src, stuff->srcDrawable,
- XRC_DRAWABLE, client, DixReadAccess);
+ rc = dixLookupResourceByClass((pointer *) &src, stuff->srcDrawable,
+ XRC_DRAWABLE, client, DixReadAccess);
if (rc != Success)
- return (rc == BadValue) ? BadDrawable : rc;
+ return (rc == BadValue) ? BadDrawable : rc;
srcShared = IS_SHARED_PIXMAP(src);
- rc = dixLookupResourceByClass((pointer *)&dst, stuff->dstDrawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ rc = dixLookupResourceByClass((pointer *) &dst, stuff->dstDrawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (rc != Success)
- return (rc == BadValue) ? BadDrawable : rc;
+ return (rc == BadValue) ? BadDrawable : rc;
dstShared = IS_SHARED_PIXMAP(dst);
- if(dstShared && srcShared)
- return (* SavedProcVector[X_CopyPlane])(client);
+ if (dstShared && srcShared)
+ return (*SavedProcVector[X_CopyPlane]) (client);
- rc = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
- if((dst->type == XRT_WINDOW) && dst->u.win.root)
- dstIsRoot = TRUE;
- if((src->type == XRT_WINDOW) && src->u.win.root)
- srcIsRoot = TRUE;
+ if ((dst->type == XRT_WINDOW) && dst->u.win.root)
+ dstIsRoot = TRUE;
+ if ((src->type == XRT_WINDOW) && src->u.win.root)
+ srcIsRoot = TRUE;
+
+ srcx = stuff->srcX;
+ srcy = stuff->srcY;
+ dstx = stuff->dstX;
+ dsty = stuff->dstY;
- srcx = stuff->srcX; srcy = stuff->srcY;
- dstx = stuff->dstX; dsty = stuff->dstY;
-
RegionNull(&totalReg);
FOR_NSCREENS_BACKWARD(j) {
- RegionPtr pRgn;
- stuff->dstDrawable = dst->info[j].id;
- stuff->srcDrawable = src->info[j].id;
- stuff->gc = gc->info[j].id;
- if (srcIsRoot) {
- stuff->srcX = srcx - screenInfo.screens[j]->x;
- stuff->srcY = srcy - screenInfo.screens[j]->y;
- }
- if (dstIsRoot) {
- stuff->dstX = dstx - screenInfo.screens[j]->x;
- stuff->dstY = dsty - screenInfo.screens[j]->y;
- }
-
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
- if (stuff->dstDrawable != stuff->srcDrawable) {
- rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
- DixReadAccess);
- if (rc != Success)
- return rc;
+ RegionPtr pRgn;
+
+ stuff->dstDrawable = dst->info[j].id;
+ stuff->srcDrawable = src->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (srcIsRoot) {
+ stuff->srcX = srcx - screenInfo.screens[j]->x;
+ stuff->srcY = srcy - screenInfo.screens[j]->y;
+ }
+ if (dstIsRoot) {
+ stuff->dstX = dstx - screenInfo.screens[j]->x;
+ stuff->dstY = dsty - screenInfo.screens[j]->y;
+ }
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
+ if (stuff->dstDrawable != stuff->srcDrawable) {
+ rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
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;
- }
-
- pRgn = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC,
- stuff->srcX, stuff->srcY,
- stuff->width, stuff->height,
- stuff->dstX, stuff->dstY, stuff->bitPlane);
- if(pGC->graphicsExposures && pRgn) {
- RegionAppend(&totalReg, pRgn);
- RegionDestroy(pRgn);
- }
-
- if(dstShared)
- break;
- }
-
- if(pGC->graphicsExposures) {
- Bool overlap;
- RegionValidate(&totalReg, &overlap);
- (*pdstDraw->pScreen->SendGraphicsExpose)(
- client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0);
- RegionUninit(&totalReg);
+ 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;
+ }
+
+ pRgn = (*pGC->ops->CopyPlane) (psrcDraw, pdstDraw, pGC,
+ stuff->srcX, stuff->srcY,
+ stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY,
+ stuff->bitPlane);
+ if (pGC->graphicsExposures && pRgn) {
+ RegionAppend(&totalReg, pRgn);
+ RegionDestroy(pRgn);
+ }
+
+ if (dstShared)
+ break;
+ }
+
+ if (pGC->graphicsExposures) {
+ Bool overlap;
+
+ RegionValidate(&totalReg, &overlap);
+ (*pdstDraw->pScreen->SendGraphicsExpose) (client, &totalReg,
+ stuff->dstDrawable,
+ X_CopyPlane, 0);
+ RegionUninit(&totalReg);
}
return Success;
}
-
-int PanoramiXPolyPoint(ClientPtr client)
+int
+PanoramiXPolyPoint(ClientPtr client)
{
PanoramiXRes *gc, *draw;
- int result, npoint, j;
- xPoint *origPts;
- Bool isRoot;
+ int result, npoint, j;
+ xPoint *origPts;
+ Bool isRoot;
+
REQUEST(xPolyPointReq);
REQUEST_AT_LEAST_SIZE(xPolyPointReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_PolyPoint])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyPoint]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
if (npoint > 0) {
origPts = malloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
- FOR_NSCREENS_FORWARD(j){
+ FOR_NSCREENS_FORWARD(j) {
- if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
+ if (j)
+ memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
if (isRoot) {
int x_off = screenInfo.screens[j]->x;
int y_off = screenInfo.screens[j]->y;
- if(x_off || y_off) {
- xPoint *pnts = (xPoint*)&stuff[1];
- int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint;
+ 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++;
+ 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;
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_PolyPoint]) (client);
+ if (result != Success)
+ break;
}
free(origPts);
return result;
- } else
- return Success;
+ }
+ else
+ return Success;
}
-
-int PanoramiXPolyLine(ClientPtr client)
+int
+PanoramiXPolyLine(ClientPtr client)
{
PanoramiXRes *gc, *draw;
- int result, npoint, j;
- xPoint *origPts;
- Bool isRoot;
+ int result, npoint, j;
+ xPoint *origPts;
+ Bool isRoot;
+
REQUEST(xPolyLineReq);
REQUEST_AT_LEAST_SIZE(xPolyLineReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_PolyLine])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyLine]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
- if (npoint > 0){
+ if (npoint > 0) {
origPts = malloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
- FOR_NSCREENS_FORWARD(j){
+ FOR_NSCREENS_FORWARD(j) {
- if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
+ if (j)
+ memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
if (isRoot) {
int x_off = screenInfo.screens[j]->x;
int y_off = screenInfo.screens[j]->y;
- if(x_off || y_off) {
- xPoint *pnts = (xPoint*)&stuff[1];
- int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint;
+ 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++;
- }
- }
+ 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;
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_PolyLine]) (client);
+ if (result != Success)
+ break;
}
free(origPts);
return result;
- } else
- return Success;
+ }
+ else
+ return Success;
}
-
-int PanoramiXPolySegment(ClientPtr client)
+int
+PanoramiXPolySegment(ClientPtr client)
{
- int result, nsegs, i, j;
+ int result, nsegs, i, j;
PanoramiXRes *gc, *draw;
- xSegment *origSegs;
- Bool isRoot;
+ xSegment *origSegs;
+ Bool isRoot;
+
REQUEST(xPolySegmentReq);
REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_PolySegment])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolySegment]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
- if(nsegs & 4) return BadLength;
+ if (nsegs & 4)
+ return BadLength;
nsegs >>= 3;
if (nsegs > 0) {
- origSegs = malloc(nsegs * sizeof(xSegment));
+ origSegs = malloc(nsegs * sizeof(xSegment));
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
- FOR_NSCREENS_FORWARD(j){
+ FOR_NSCREENS_FORWARD(j) {
- if(j) memcpy(&stuff[1], origSegs, nsegs * sizeof(xSegment));
+ if (j)
+ memcpy(&stuff[1], origSegs, nsegs * sizeof(xSegment));
if (isRoot) {
int x_off = screenInfo.screens[j]->x;
int y_off = screenInfo.screens[j]->y;
- if(x_off || y_off) {
- xSegment *segs = (xSegment*)&stuff[1];
+ 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;
- }
- }
+ 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;
- }
- free(origSegs);
- return result;
- } else
- return Success;
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_PolySegment]) (client);
+ if (result != Success)
+ break;
+ }
+ free(origSegs);
+ return result;
+ }
+ else
+ return Success;
}
-
-int PanoramiXPolyRectangle(ClientPtr client)
+int
+PanoramiXPolyRectangle(ClientPtr client)
{
- int result, nrects, i, j;
+ int result, nrects, i, j;
PanoramiXRes *gc, *draw;
- Bool isRoot;
- xRectangle *origRecs;
+ Bool isRoot;
+ xRectangle *origRecs;
+
REQUEST(xPolyRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_PolyRectangle])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyRectangle]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
- if(nrects & 4) return BadLength;
+ if (nrects & 4)
+ return BadLength;
nrects >>= 3;
- if (nrects > 0){
- origRecs = malloc(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 = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[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;
- }
- free(origRecs);
- return result;
- } else
- return Success;
-}
+ if (nrects > 0) {
+ origRecs = malloc(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 = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[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;
+ }
+ free(origRecs);
+ return result;
+ }
+ else
+ return Success;
+}
-int PanoramiXPolyArc(ClientPtr client)
+int
+PanoramiXPolyArc(ClientPtr client)
{
- int result, narcs, i, j;
+ int result, narcs, i, j;
PanoramiXRes *gc, *draw;
- Bool isRoot;
- xArc *origArcs;
+ Bool isRoot;
+ xArc *origArcs;
+
REQUEST(xPolyArcReq);
REQUEST_AT_LEAST_SIZE(xPolyArcReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_PolyArc])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyArc]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
- if(narcs % sizeof(xArc)) return BadLength;
+ if (narcs % sizeof(xArc))
+ return BadLength;
narcs /= sizeof(xArc);
- if (narcs > 0){
- origArcs = malloc(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 = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[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;
- }
- }
+ if (narcs > 0) {
+ origArcs = malloc(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 = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[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 = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_PolyArc]) (client);
+ if (result != Success)
+ break;
}
- free(origArcs);
- return result;
- } else
- return Success;
+ free(origArcs);
+ return result;
+ }
+ else
+ return Success;
}
-
-int PanoramiXFillPoly(ClientPtr client)
+int
+PanoramiXFillPoly(ClientPtr client)
{
- int result, count, j;
+ int result, count, j;
PanoramiXRes *gc, *draw;
- Bool isRoot;
- DDXPointPtr locPts;
+ Bool isRoot;
+ DDXPointPtr locPts;
+
REQUEST(xFillPolyReq);
REQUEST_AT_LEAST_SIZE(xFillPolyReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_FillPoly])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_FillPoly]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
- if (count > 0){
- locPts = malloc(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 = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[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;
- }
- free(locPts);
- return result;
- } else
- return Success;
-}
+ if (count > 0) {
+ locPts = malloc(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 = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+ if (x_off || y_off) {
+ DDXPointPtr pnts = (DDXPointPtr) &stuff[1];
+ int i = (stuff->coordMode == CoordModePrevious) ? 1 : count;
-int PanoramiXPolyFillRectangle(ClientPtr client)
+ 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;
+ }
+ free(locPts);
+ return result;
+ }
+ else
+ return Success;
+}
+
+int
+PanoramiXPolyFillRectangle(ClientPtr client)
{
- int result, things, i, j;
+ int result, things, i, j;
PanoramiXRes *gc, *draw;
- Bool isRoot;
- xRectangle *origRects;
+ Bool isRoot;
+ xRectangle *origRects;
+
REQUEST(xPolyFillRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_PolyFillRectangle])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyFillRectangle]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
- if(things & 4) return BadLength;
+ if (things & 4)
+ return BadLength;
things >>= 3;
- if (things > 0){
- origRects = malloc(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 = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[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;
- }
- free(origRects);
- return result;
- } else
- return Success;
-}
+ if (things > 0) {
+ origRects = malloc(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 = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[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;
+ }
+ free(origRects);
+ return result;
+ }
+ else
+ return Success;
+}
-int PanoramiXPolyFillArc(ClientPtr client)
+int
+PanoramiXPolyFillArc(ClientPtr client)
{
PanoramiXRes *gc, *draw;
- Bool isRoot;
- int result, narcs, i, j;
- xArc *origArcs;
+ Bool isRoot;
+ int result, narcs, i, j;
+ xArc *origArcs;
+
REQUEST(xPolyFillArcReq);
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_PolyFillArc])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyFillArc]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
- if (narcs % sizeof(xArc)) return BadLength;
+ if (narcs % sizeof(xArc))
+ return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
- origArcs = malloc(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 = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[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;
- }
- free(origArcs);
- return result;
- } else
- return Success;
-}
+ origArcs = malloc(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 = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
-int PanoramiXPutImage(ClientPtr client)
+ 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;
+ }
+ free(origArcs);
+ return result;
+ }
+ else
+ return Success;
+}
+
+int
+PanoramiXPutImage(ClientPtr client)
{
PanoramiXRes *gc, *draw;
- Bool isRoot;
- int j, result, orig_x, orig_y;
+ Bool isRoot;
+ int j, result, orig_x, orig_y;
+
REQUEST(xPutImageReq);
REQUEST_AT_LEAST_SIZE(xPutImageReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_PutImage])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PutImage]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
orig_x = stuff->dstX;
orig_y = stuff->dstY;
- FOR_NSCREENS_BACKWARD(j){
- if (isRoot) {
- stuff->dstX = orig_x - screenInfo.screens[j]->x;
- stuff->dstY = orig_y - screenInfo.screens[j]->y;
- }
- stuff->drawable = draw->info[j].id;
- stuff->gc = gc->info[j].id;
- result = (* SavedProcVector[X_PutImage])(client);
- if(result != Success) break;
+ FOR_NSCREENS_BACKWARD(j) {
+ if (isRoot) {
+ stuff->dstX = orig_x - screenInfo.screens[j]->x;
+ stuff->dstY = orig_y - screenInfo.screens[j]->y;
+ }
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_PutImage]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXGetImage(ClientPtr client)
+int
+PanoramiXGetImage(ClientPtr client)
{
- DrawablePtr drawables[MAXSCREENS];
- DrawablePtr pDraw;
- PanoramiXRes *draw;
- xGetImageReply xgi;
- Bool isRoot;
- char *pBuf;
- int i, x, y, w, h, format, rc;
- Mask plane = 0, planemask;
- int linesDone, nlines, linesPerBuf;
- long widthBytesLine, length;
+ DrawablePtr drawables[MAXSCREENS];
+ DrawablePtr pDraw;
+ PanoramiXRes *draw;
+ xGetImageReply xgi;
+ Bool isRoot;
+ char *pBuf;
+ int i, x, y, w, h, format, rc;
+ Mask plane = 0, planemask;
+ int linesDone, nlines, linesPerBuf;
+ long widthBytesLine, length;
REQUEST(xGetImageReq);
REQUEST_SIZE_MATCH(xGetImageReq);
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
- client->errorValue = stuff->format;
+ client->errorValue = stuff->format;
return BadValue;
}
- rc = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (rc != Success)
- return (rc == BadValue) ? BadDrawable : rc;
+ return (rc == BadValue) ? BadDrawable : rc;
- if(draw->type == XRT_PIXMAP)
- return (*SavedProcVector[X_GetImage])(client);
+ if (draw->type == XRT_PIXMAP)
+ return (*SavedProcVector[X_GetImage]) (client);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
- if(!((WindowPtr)pDraw)->realized)
- return BadMatch;
+ if (!((WindowPtr) pDraw)->realized)
+ return BadMatch;
x = stuff->x;
y = stuff->y;
@@ -1820,367 +1927,375 @@ int PanoramiXGetImage(ClientPtr client)
isRoot = IS_ROOT_DRAWABLE(draw);
- 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 */
- screenInfo.screens[0]->x + pDraw->x + x < 0 ||
- screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
- screenInfo.screens[0]->y + pDraw->y + y < 0 ||
- screenInfo.screens[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;
+ if (isRoot) {
+ /* check for being onscreen */
+ if (x < 0 || x + w > PanoramiXPixWidth ||
+ y < 0 || y + h > PanoramiXPixHeight)
+ return BadMatch;
+ }
+ else {
+ /* check for being onscreen and inside of border */
+ if (screenInfo.screens[0]->x + pDraw->x + x < 0 ||
+ screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
+ screenInfo.screens[0]->y + pDraw->y + y < 0 ||
+ screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight ||
+ 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_NSCREENS_FORWARD_SKIP(i) {
- rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
- DixGetAttrAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupDrawable(drawables + i, draw->info[i].id, client, 0,
+ DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
}
- xgi.visual = wVisual (((WindowPtr) pDraw));
+ xgi.visual = wVisual(((WindowPtr) pDraw));
xgi.type = X_Reply;
xgi.sequenceNumber = client->sequence;
xgi.depth = pDraw->depth;
- if(format == ZPixmap) {
- widthBytesLine = PixmapBytePad(w, pDraw->depth);
- length = widthBytesLine * h;
-
+ if (format == ZPixmap) {
+ widthBytesLine = PixmapBytePad(w, pDraw->depth);
+ length = widthBytesLine * h;
- } else {
- widthBytesLine = BitmapBytePad(w);
- plane = ((Mask)1) << (pDraw->depth - 1);
- /* only planes asked for */
- length = widthBytesLine * h *
- Ones(planemask & (plane | (plane - 1)));
+ }
+ else {
+ widthBytesLine = BitmapBytePad(w);
+ plane = ((Mask) 1) << (pDraw->depth - 1);
+ /* only planes asked for */
+ length = widthBytesLine * h * Ones(planemask & (plane | (plane - 1)));
}
xgi.length = bytes_to_int32(length);
if (widthBytesLine == 0 || h == 0)
- linesPerBuf = 0;
+ linesPerBuf = 0;
else if (widthBytesLine >= XINERAMA_IMAGE_BUFSIZE)
- linesPerBuf = 1;
+ linesPerBuf = 1;
else {
- linesPerBuf = XINERAMA_IMAGE_BUFSIZE / widthBytesLine;
- if (linesPerBuf > h)
- linesPerBuf = h;
+ linesPerBuf = XINERAMA_IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > h)
+ linesPerBuf = h;
}
length = linesPerBuf * widthBytesLine;
- if(!(pBuf = malloc(length)))
- return BadAlloc;
+ if (!(pBuf = malloc(length)))
+ return BadAlloc;
- WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
+ WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
if (linesPerBuf == 0) {
- /* nothing to do */
+ /* nothing to do */
}
else if (format == ZPixmap) {
linesDone = 0;
while (h - linesDone > 0) {
- nlines = min(linesPerBuf, h - linesDone);
+ nlines = min(linesPerBuf, h - linesDone);
- if(pDraw->depth == 1)
- memset(pBuf, 0, nlines * widthBytesLine);
+ if (pDraw->depth == 1)
+ memset(pBuf, 0, nlines * widthBytesLine);
- XineramaGetImageData(drawables, x, y + linesDone, w, nlines,
- format, planemask, pBuf, widthBytesLine, isRoot);
+ XineramaGetImageData(drawables, x, y + linesDone, w, nlines,
+ format, planemask, pBuf, widthBytesLine,
+ isRoot);
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLine),
- pBuf);
- linesDone += nlines;
+ (void) WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
+ linesDone += nlines;
}
- } else { /* XYPixmap */
+ }
+ else { /* XYPixmap */
for (; plane; plane >>= 1) {
- if (planemask & plane) {
- linesDone = 0;
- while (h - linesDone > 0) {
- nlines = min(linesPerBuf, h - linesDone);
+ if (planemask & plane) {
+ linesDone = 0;
+ while (h - linesDone > 0) {
+ nlines = min(linesPerBuf, h - linesDone);
- memset(pBuf, 0, nlines * widthBytesLine);
+ memset(pBuf, 0, nlines * widthBytesLine);
- XineramaGetImageData(drawables, x, y + linesDone, w,
- nlines, format, plane, pBuf,
- widthBytesLine, isRoot);
+ 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;
- }
+ linesDone += nlines;
+ }
}
- }
+ }
}
free(pBuf);
return Success;
}
-
/* 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
+int
PanoramiXPolyText8(ClientPtr client)
{
PanoramiXRes *gc, *draw;
- Bool isRoot;
- int result, j;
- int orig_x, orig_y;
+ Bool isRoot;
+ int result, j;
+ int orig_x, orig_y;
+
REQUEST(xPolyTextReq);
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_PolyText8])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyText8]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_BACKWARD(j){
- stuff->drawable = draw->info[j].id;
- stuff->gc = gc->info[j].id;
- if (isRoot) {
- stuff->x = orig_x - screenInfo.screens[j]->x;
- stuff->y = orig_y - screenInfo.screens[j]->y;
- }
- result = (*SavedProcVector[X_PolyText8])(client);
- if(result != Success) break;
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
+ stuff->x = orig_x - screenInfo.screens[j]->x;
+ stuff->y = orig_y - screenInfo.screens[j]->y;
+ }
+ result = (*SavedProcVector[X_PolyText8]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-int
+int
PanoramiXPolyText16(ClientPtr client)
{
PanoramiXRes *gc, *draw;
- Bool isRoot;
- int result, j;
- int orig_x, orig_y;
+ Bool isRoot;
+ int result, j;
+ int orig_x, orig_y;
+
REQUEST(xPolyTextReq);
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_PolyText16])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyText16]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_BACKWARD(j){
- stuff->drawable = draw->info[j].id;
- stuff->gc = gc->info[j].id;
- if (isRoot) {
- stuff->x = orig_x - screenInfo.screens[j]->x;
- stuff->y = orig_y - screenInfo.screens[j]->y;
- }
- result = (*SavedProcVector[X_PolyText16])(client);
- if(result != Success) break;
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
+ stuff->x = orig_x - screenInfo.screens[j]->x;
+ stuff->y = orig_y - screenInfo.screens[j]->y;
+ }
+ result = (*SavedProcVector[X_PolyText16]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXImageText8(ClientPtr client)
+int
+PanoramiXImageText8(ClientPtr client)
{
- int result, j;
+ int result, j;
PanoramiXRes *gc, *draw;
- Bool isRoot;
- int orig_x, orig_y;
+ Bool isRoot;
+ int orig_x, orig_y;
+
REQUEST(xImageTextReq);
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_ImageText8])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_ImageText8]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_BACKWARD(j){
- stuff->drawable = draw->info[j].id;
- stuff->gc = gc->info[j].id;
- if (isRoot) {
- stuff->x = orig_x - screenInfo.screens[j]->x;
- stuff->y = orig_y - screenInfo.screens[j]->y;
- }
- result = (*SavedProcVector[X_ImageText8])(client);
- if(result != Success) break;
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
+ stuff->x = orig_x - screenInfo.screens[j]->x;
+ stuff->y = orig_y - screenInfo.screens[j]->y;
+ }
+ result = (*SavedProcVector[X_ImageText8]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXImageText16(ClientPtr client)
+int
+PanoramiXImageText16(ClientPtr client)
{
- int result, j;
+ int result, j;
PanoramiXRes *gc, *draw;
- Bool isRoot;
- int orig_x, orig_y;
+ Bool isRoot;
+ int orig_x, orig_y;
+
REQUEST(xImageTextReq);
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- if(IS_SHARED_PIXMAP(draw))
- return (*SavedProcVector[X_ImageText16])(client);
+ if (IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_ImageText16]) (client);
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = IS_ROOT_DRAWABLE(draw);
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_BACKWARD(j){
- stuff->drawable = draw->info[j].id;
- stuff->gc = gc->info[j].id;
- if (isRoot) {
- stuff->x = orig_x - screenInfo.screens[j]->x;
- stuff->y = orig_y - screenInfo.screens[j]->y;
- }
- result = (*SavedProcVector[X_ImageText16])(client);
- if(result != Success) break;
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
+ stuff->x = orig_x - screenInfo.screens[j]->x;
+ stuff->y = orig_y - screenInfo.screens[j]->y;
+ }
+ result = (*SavedProcVector[X_ImageText16]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-
-int PanoramiXCreateColormap(ClientPtr client)
+int
+PanoramiXCreateColormap(ClientPtr client)
{
- PanoramiXRes *win, *newCmap;
- int result, j, orig_visual;
+ PanoramiXRes *win, *newCmap;
+ int result, j, orig_visual;
+
REQUEST(xCreateColormapReq);
REQUEST_SIZE_MATCH(xCreateColormapReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->window,
- XRT_WINDOW, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->window,
+ XRT_WINDOW, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
- if(!(newCmap = malloc(sizeof(PanoramiXRes))))
+ if (!(newCmap = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;
panoramix_setup_ids(newCmap, client, stuff->mid);
orig_visual = stuff->visual;
- FOR_NSCREENS_BACKWARD(j){
- stuff->mid = newCmap->info[j].id;
- stuff->window = win->info[j].id;
- stuff->visual = PanoramiXTranslateVisualID(j, orig_visual);
- result = (* SavedProcVector[X_CreateColormap])(client);
- if(result != Success) break;
- }
-
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->mid = newCmap->info[j].id;
+ stuff->window = win->info[j].id;
+ stuff->visual = PanoramiXTranslateVisualID(j, orig_visual);
+ result = (*SavedProcVector[X_CreateColormap]) (client);
+ if (result != Success)
+ break;
+ }
+
if (result == Success)
AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
- else
+ else
free(newCmap);
return result;
}
-
-int PanoramiXFreeColormap(ClientPtr client)
+int
+PanoramiXFreeColormap(ClientPtr client)
{
PanoramiXRes *cmap;
- int result, j;
+ int result, j;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
client->errorValue = stuff->id;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP,
- client, DixDestroyAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP,
+ client, DixDestroyAccess);
if (result != Success)
return result;
FOR_NSCREENS_BACKWARD(j) {
stuff->id = cmap->info[j].id;
- result = (* SavedProcVector[X_FreeColormap])(client);
- if(result != Success) break;
+ result = (*SavedProcVector[X_FreeColormap]) (client);
+ if (result != Success)
+ break;
}
/* Since ProcFreeColormap is using FreeResource, it will free
- our resource for us on the last pass through the loop above */
+ our resource for us on the last pass through the loop above */
return result;
}
-
int
PanoramiXCopyColormapAndFree(ClientPtr client)
{
PanoramiXRes *cmap, *newCmap;
- int result, j;
+ int result, j;
+
REQUEST(xCopyColormapAndFreeReq);
REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
client->errorValue = stuff->srcCmap;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->srcCmap,
- XRT_COLORMAP, client,
- DixReadAccess | DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->srcCmap,
+ XRT_COLORMAP, client,
+ DixReadAccess | DixWriteAccess);
if (result != Success)
return result;
- if(!(newCmap = malloc(sizeof(PanoramiXRes))))
+ if (!(newCmap = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;
@@ -2188,231 +2303,246 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
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;
+ stuff->mid = newCmap->info[j].id;
+ result = (*SavedProcVector[X_CopyColormapAndFree]) (client);
+ if (result != Success)
+ break;
}
if (result == Success)
AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
- else
+ else
free(newCmap);
return result;
}
-
-int PanoramiXInstallColormap(ClientPtr client)
+int
+PanoramiXInstallColormap(ClientPtr client)
{
REQUEST(xResourceReq);
- int result, j;
+ int result, j;
PanoramiXRes *cmap;
REQUEST_SIZE_MATCH(xResourceReq);
client->errorValue = stuff->id;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP,
+ client, DixReadAccess);
if (result != Success)
return result;
- FOR_NSCREENS_BACKWARD(j){
- stuff->id = cmap->info[j].id;
- result = (* SavedProcVector[X_InstallColormap])(client);
- if(result != Success) break;
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = cmap->info[j].id;
+ result = (*SavedProcVector[X_InstallColormap]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXUninstallColormap(ClientPtr client)
+int
+PanoramiXUninstallColormap(ClientPtr client)
{
REQUEST(xResourceReq);
- int result, j;
+ int result, j;
PanoramiXRes *cmap;
REQUEST_SIZE_MATCH(xResourceReq);
-
+
client->errorValue = stuff->id;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP,
+ client, DixReadAccess);
if (result != Success)
return result;
FOR_NSCREENS_BACKWARD(j) {
- stuff->id = cmap->info[j].id;
- result = (* SavedProcVector[X_UninstallColormap])(client);
- if(result != Success) break;
+ stuff->id = cmap->info[j].id;
+ result = (*SavedProcVector[X_UninstallColormap]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXAllocColor(ClientPtr client)
+int
+PanoramiXAllocColor(ClientPtr client)
{
- int result, j;
+ int result, j;
PanoramiXRes *cmap;
+
REQUEST(xAllocColorReq);
REQUEST_SIZE_MATCH(xAllocColorReq);
client->errorValue = stuff->cmap;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
- XRT_COLORMAP, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+ XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
- FOR_NSCREENS_BACKWARD(j){
- stuff->cmap = cmap->info[j].id;
- result = (* SavedProcVector[X_AllocColor])(client);
- if(result != Success) break;
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->cmap = cmap->info[j].id;
+ result = (*SavedProcVector[X_AllocColor]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXAllocNamedColor(ClientPtr client)
+int
+PanoramiXAllocNamedColor(ClientPtr client)
{
- int result, j;
- PanoramiXRes *cmap;
+ int result, j;
+ PanoramiXRes *cmap;
+
REQUEST(xAllocNamedColorReq);
REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
client->errorValue = stuff->cmap;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
- XRT_COLORMAP, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+ XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
- FOR_NSCREENS_BACKWARD(j){
+ FOR_NSCREENS_BACKWARD(j) {
stuff->cmap = cmap->info[j].id;
- result = (* SavedProcVector[X_AllocNamedColor])(client);
- if(result != Success) break;
+ result = (*SavedProcVector[X_AllocNamedColor]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXAllocColorCells(ClientPtr client)
+int
+PanoramiXAllocColorCells(ClientPtr client)
{
- int result, j;
- PanoramiXRes *cmap;
+ int result, j;
+ PanoramiXRes *cmap;
+
REQUEST(xAllocColorCellsReq);
REQUEST_SIZE_MATCH(xAllocColorCellsReq);
client->errorValue = stuff->cmap;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
- XRT_COLORMAP, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+ XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
-
- FOR_NSCREENS_BACKWARD(j){
- stuff->cmap = cmap->info[j].id;
- result = (* SavedProcVector[X_AllocColorCells])(client);
- if(result != Success) break;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->cmap = cmap->info[j].id;
+ result = (*SavedProcVector[X_AllocColorCells]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXAllocColorPlanes(ClientPtr client)
+int
+PanoramiXAllocColorPlanes(ClientPtr client)
{
- int result, j;
- PanoramiXRes *cmap;
+ int result, j;
+ PanoramiXRes *cmap;
+
REQUEST(xAllocColorPlanesReq);
REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
client->errorValue = stuff->cmap;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
- XRT_COLORMAP, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+ XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
-
- FOR_NSCREENS_BACKWARD(j){
- stuff->cmap = cmap->info[j].id;
- result = (* SavedProcVector[X_AllocColorPlanes])(client);
- if(result != Success) break;
+
+ 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
+PanoramiXFreeColors(ClientPtr client)
{
- int result, j;
- PanoramiXRes *cmap;
+ int result, j;
+ PanoramiXRes *cmap;
+
REQUEST(xFreeColorsReq);
REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
client->errorValue = stuff->cmap;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
- XRT_COLORMAP, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+ XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
FOR_NSCREENS_BACKWARD(j) {
stuff->cmap = cmap->info[j].id;
- result = (* SavedProcVector[X_FreeColors])(client);
+ result = (*SavedProcVector[X_FreeColors]) (client);
}
return result;
}
-
-int PanoramiXStoreColors(ClientPtr client)
+int
+PanoramiXStoreColors(ClientPtr client)
{
- int result, j;
- PanoramiXRes *cmap;
+ int result, j;
+ PanoramiXRes *cmap;
+
REQUEST(xStoreColorsReq);
REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
client->errorValue = stuff->cmap;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
- XRT_COLORMAP, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+ XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
- FOR_NSCREENS_BACKWARD(j){
- stuff->cmap = cmap->info[j].id;
- result = (* SavedProcVector[X_StoreColors])(client);
- if(result != Success) break;
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->cmap = cmap->info[j].id;
+ result = (*SavedProcVector[X_StoreColors]) (client);
+ if (result != Success)
+ break;
}
return result;
}
-
-int PanoramiXStoreNamedColor(ClientPtr client)
+int
+PanoramiXStoreNamedColor(ClientPtr client)
{
- int result, j;
- PanoramiXRes *cmap;
+ int result, j;
+ PanoramiXRes *cmap;
+
REQUEST(xStoreNamedColorReq);
REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
client->errorValue = stuff->cmap;
- result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
- XRT_COLORMAP, client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+ XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
- FOR_NSCREENS_BACKWARD(j){
- stuff->cmap = cmap->info[j].id;
- result = (* SavedProcVector[X_StoreNamedColor])(client);
- if(result != Success) break;
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->cmap = cmap->info[j].id;
+ result = (*SavedProcVector[X_StoreNamedColor]) (client);
+ if (result != Success)
+ break;
}
return result;
}
diff --git a/xorg-server/Xext/panoramiXsrv.h b/xorg-server/Xext/panoramiXsrv.h
index 39d495203..7c605fe66 100644
--- a/xorg-server/Xext/panoramiXsrv.h
+++ b/xorg-server/Xext/panoramiXsrv.h
@@ -15,8 +15,9 @@ extern _X_EXPORT int PanoramiXPixHeight;
extern _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
extern _X_EXPORT void PanoramiXConsolidate(void);
extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void);
-extern _X_EXPORT PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int);
-extern _X_EXPORT Bool XineramaRegisterConnectionBlockCallback(void (*func)(void));
+extern _X_EXPORT PanoramiXRes *PanoramiXFindIDByScrnum(RESTYPE, XID, int);
+extern _X_EXPORT Bool
+XineramaRegisterConnectionBlockCallback(void (*func) (void));
extern _X_EXPORT int XineramaDeleteResource(pointer, XID);
extern _X_EXPORT void XineramaReinitData(void);
@@ -35,24 +36,20 @@ extern _X_EXPORT RESTYPE XRT_PICTURE;
* layers agree that the visuals are equal. The first visual is always from
* screen 0.
*/
-typedef Bool (*XineramaVisualsEqualProcPtr)(VisualPtr, ScreenPtr, VisualPtr);
+typedef Bool (*XineramaVisualsEqualProcPtr) (VisualPtr, ScreenPtr, VisualPtr);
extern _X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
-extern _X_EXPORT void XineramaGetImageData(
- DrawablePtr *pDrawables,
- int left,
- int top,
- int width,
- int height,
- unsigned int format,
- unsigned long planemask,
- char *data,
- int pitch,
- Bool isRoot
-);
-
-static inline void panoramix_setup_ids(PanoramiXRes *resource,
- ClientPtr client, XID base_id)
+extern _X_EXPORT void XineramaGetImageData(DrawablePtr *pDrawables,
+ int left,
+ int top,
+ int width,
+ int height,
+ unsigned int format,
+ unsigned long planemask,
+ char *data, int pitch, Bool isRoot);
+
+static inline void
+panoramix_setup_ids(PanoramiXRes * resource, ClientPtr client, XID base_id)
{
int j;
@@ -62,4 +59,4 @@ static inline void panoramix_setup_ids(PanoramiXRes *resource,
}
}
-#endif /* _PANORAMIXSRV_H_ */
+#endif /* _PANORAMIXSRV_H_ */
diff --git a/xorg-server/Xext/saver.c b/xorg-server/Xext/saver.c
index 78f8efac3..6c8fc6e0b 100644
--- a/xorg-server/Xext/saver.c
+++ b/xorg-server/Xext/saver.c
@@ -26,7 +26,6 @@ in this Software without prior written authorization from the X Consortium.
* Author: Keith Packard, MIT X Consortium
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#else
@@ -53,6 +52,7 @@ in this Software without prior written authorization from the X Consortium.
#include "cursorstr.h"
#include "colormapst.h"
#include "xace.h"
+#include "inputstr.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
@@ -68,39 +68,32 @@ in this Software without prior written authorization from the X Consortium.
static int ScreenSaverEventBase = 0;
-
-static Bool ScreenSaverHandle (
- ScreenPtr /* pScreen */,
- int /* xstate */,
- Bool /* force */
- );
+static Bool ScreenSaverHandle(ScreenPtr /* pScreen */ ,
+ int /* xstate */ ,
+ Bool /* force */
+ );
static Bool
-CreateSaverWindow (
- ScreenPtr /* pScreen */
- );
+ CreateSaverWindow(ScreenPtr /* pScreen */
+ );
static Bool
-DestroySaverWindow (
- ScreenPtr /* pScreen */
- );
+ DestroySaverWindow(ScreenPtr /* pScreen */
+ );
static void
-UninstallSaverColormap (
- ScreenPtr /* pScreen */
- );
+ UninstallSaverColormap(ScreenPtr /* pScreen */
+ );
static void
-CheckScreenPrivate (
- ScreenPtr /* pScreen */
- );
+ CheckScreenPrivate(ScreenPtr /* pScreen */
+ );
-static void SScreenSaverNotifyEvent (
- xScreenSaverNotifyEvent * /* from */,
- xScreenSaverNotifyEvent * /* to */
- );
+static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * /* from */ ,
+ xScreenSaverNotifyEvent * /* to */
+ );
-static RESTYPE SuspendType; /* resource type for suspension records */
+static RESTYPE SuspendType; /* resource type for suspension records */
typedef struct _ScreenSaverSuspension *ScreenSaverSuspensionPtr;
@@ -113,18 +106,16 @@ static ScreenSaverSuspensionPtr suspendingClients = NULL;
* the client disconnects. count is the number of times the client has
* requested the screensaver be suspended.
*/
-typedef struct _ScreenSaverSuspension
-{
- ScreenSaverSuspensionPtr next;
- ClientPtr pClient;
- XID clientResource;
- int count;
+typedef struct _ScreenSaverSuspension {
+ ScreenSaverSuspensionPtr next;
+ ClientPtr pClient;
+ XID clientResource;
+ int count;
} ScreenSaverSuspensionRec;
-static int ScreenSaverFreeSuspend(
- pointer /*value */,
- XID /* id */
-);
+static int ScreenSaverFreeSuspend(pointer /*value */ ,
+ XID /* id */
+ );
/*
* each screen has a list of clients requesting
@@ -134,91 +125,83 @@ static int ScreenSaverFreeSuspend(
* entry from the per-screen queue.
*/
-static RESTYPE SaverEventType; /* resource type for event masks */
+static RESTYPE SaverEventType; /* resource type for event masks */
typedef struct _ScreenSaverEvent *ScreenSaverEventPtr;
typedef struct _ScreenSaverEvent {
- ScreenSaverEventPtr next;
- ClientPtr client;
- ScreenPtr screen;
- XID resource;
- CARD32 mask;
+ ScreenSaverEventPtr next;
+ ClientPtr client;
+ ScreenPtr screen;
+ XID resource;
+ CARD32 mask;
} ScreenSaverEventRec;
-static int ScreenSaverFreeEvents(
- pointer /* value */,
- XID /* id */
-);
+static int ScreenSaverFreeEvents(pointer /* value */ ,
+ XID /* id */
+ );
-static Bool setEventMask (
- ScreenPtr /* pScreen */,
- ClientPtr /* client */,
- unsigned long /* mask */
-);
+static Bool setEventMask(ScreenPtr /* pScreen */ ,
+ ClientPtr /* client */ ,
+ unsigned long /* mask */
+ );
-static unsigned long getEventMask (
- ScreenPtr /* pScreen */,
- ClientPtr /* client */
-);
+static unsigned long getEventMask(ScreenPtr /* pScreen */ ,
+ ClientPtr /* client */
+ );
/*
* when a client sets the screen saver attributes, a resource is
* kept to be freed when the client exits
*/
-static RESTYPE AttrType; /* resource type for attributes */
+static RESTYPE AttrType; /* resource type for attributes */
typedef struct _ScreenSaverAttr {
- ScreenPtr screen;
- ClientPtr client;
- XID resource;
- short x, y;
- unsigned short width, height, borderWidth;
- unsigned char class;
- unsigned char depth;
- VisualID visual;
- CursorPtr pCursor;
- PixmapPtr pBackgroundPixmap;
- PixmapPtr pBorderPixmap;
- Colormap colormap;
- unsigned long mask; /* no pixmaps or cursors */
- unsigned long *values;
+ ScreenPtr screen;
+ ClientPtr client;
+ XID resource;
+ short x, y;
+ unsigned short width, height, borderWidth;
+ unsigned char class;
+ unsigned char depth;
+ VisualID visual;
+ CursorPtr pCursor;
+ PixmapPtr pBackgroundPixmap;
+ PixmapPtr pBorderPixmap;
+ Colormap colormap;
+ unsigned long mask; /* no pixmaps or cursors */
+ unsigned long *values;
} ScreenSaverAttrRec, *ScreenSaverAttrPtr;
-static int ScreenSaverFreeAttr (
- pointer /* value */,
- XID /* id */
-);
+static int ScreenSaverFreeAttr(pointer /* value */ ,
+ XID /* id */
+ );
-static void FreeAttrs (
- ScreenSaverAttrPtr /* pAttr */
-);
+static void FreeAttrs(ScreenSaverAttrPtr /* pAttr */
+ );
-static void FreeScreenAttr (
- ScreenSaverAttrPtr /* pAttr */
-);
+static void FreeScreenAttr(ScreenSaverAttrPtr /* pAttr */
+ );
static void
-SendScreenSaverNotify (
- ScreenPtr /* pScreen */,
- int /* state */,
- Bool /* forced */
-);
+ SendScreenSaverNotify(ScreenPtr /* pScreen */ ,
+ int /* state */ ,
+ Bool /* forced */
+ );
typedef struct _ScreenSaverScreenPrivate {
- ScreenSaverEventPtr events;
- ScreenSaverAttrPtr attr;
- Bool hasWindow;
- Colormap installedMap;
+ ScreenSaverEventPtr events;
+ ScreenSaverAttrPtr attr;
+ Bool hasWindow;
+ Colormap installedMap;
} ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr;
-static ScreenSaverScreenPrivatePtr
-MakeScreenPrivate (
- ScreenPtr /* pScreen */
- );
+static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr /* pScreen */
+ );
static DevPrivateKeyRec ScreenPrivateKeyRec;
+
#define ScreenPrivateKey (&ScreenPrivateKeyRec)
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
@@ -230,387 +213,372 @@ static DevPrivateKeyRec ScreenPrivateKeyRec;
#define New(t) (malloc(sizeof (t)))
static void
-CheckScreenPrivate (ScreenPtr pScreen)
+CheckScreenPrivate(ScreenPtr pScreen)
{
- SetupScreen (pScreen);
+ SetupScreen(pScreen);
if (!pPriv)
- return;
+ return;
if (!pPriv->attr && !pPriv->events &&
- !pPriv->hasWindow && pPriv->installedMap == None)
- {
- free(pPriv);
- SetScreenPrivate (pScreen, NULL);
- pScreen->screensaver.ExternalScreenSaver = NULL;
+ !pPriv->hasWindow && pPriv->installedMap == None) {
+ free(pPriv);
+ SetScreenPrivate(pScreen, NULL);
+ pScreen->screensaver.ExternalScreenSaver = NULL;
}
}
static ScreenSaverScreenPrivatePtr
-MakeScreenPrivate (ScreenPtr pScreen)
+MakeScreenPrivate(ScreenPtr pScreen)
{
- SetupScreen (pScreen);
+ SetupScreen(pScreen);
if (pPriv)
- return pPriv;
- pPriv = New (ScreenSaverScreenPrivateRec);
+ return pPriv;
+ pPriv = New(ScreenSaverScreenPrivateRec);
if (!pPriv)
- return 0;
+ return 0;
pPriv->events = 0;
pPriv->attr = 0;
pPriv->hasWindow = FALSE;
pPriv->installedMap = None;
- SetScreenPrivate (pScreen, pPriv);
+ SetScreenPrivate(pScreen, pPriv);
pScreen->screensaver.ExternalScreenSaver = ScreenSaverHandle;
return pPriv;
}
static unsigned long
-getEventMask (ScreenPtr pScreen, ClientPtr client)
+getEventMask(ScreenPtr pScreen, ClientPtr client)
{
SetupScreen(pScreen);
- ScreenSaverEventPtr pEv;
+ ScreenSaverEventPtr pEv;
if (!pPriv)
- return 0;
+ return 0;
for (pEv = pPriv->events; pEv; pEv = pEv->next)
- if (pEv->client == client)
- return pEv->mask;
+ if (pEv->client == client)
+ return pEv->mask;
return 0;
}
static Bool
-setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
+setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
{
SetupScreen(pScreen);
- ScreenSaverEventPtr pEv, *pPrev;
-
- if (getEventMask (pScreen, client) == mask)
- return TRUE;
- if (!pPriv)
- {
- pPriv = MakeScreenPrivate (pScreen);
- if (!pPriv)
- return FALSE;
+ ScreenSaverEventPtr pEv, *pPrev;
+
+ if (getEventMask(pScreen, client) == mask)
+ return TRUE;
+ if (!pPriv) {
+ pPriv = MakeScreenPrivate(pScreen);
+ if (!pPriv)
+ return FALSE;
}
for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next)
- if (pEv->client == client)
- break;
- if (mask == 0)
- {
- FreeResource (pEv->resource, SaverEventType);
- *pPrev = pEv->next;
- free(pEv);
- CheckScreenPrivate (pScreen);
+ if (pEv->client == client)
+ break;
+ if (mask == 0) {
+ FreeResource(pEv->resource, SaverEventType);
+ *pPrev = pEv->next;
+ free(pEv);
+ CheckScreenPrivate(pScreen);
}
- else
- {
- if (!pEv)
- {
- pEv = New (ScreenSaverEventRec);
- if (!pEv)
- {
- CheckScreenPrivate (pScreen);
- return FALSE;
- }
- *pPrev = pEv;
- pEv->next = NULL;
- pEv->client = client;
- pEv->screen = pScreen;
- pEv->resource = FakeClientID (client->index);
- if (!AddResource (pEv->resource, SaverEventType, (pointer) pEv))
- return FALSE;
- }
- pEv->mask = mask;
+ else {
+ if (!pEv) {
+ pEv = New(ScreenSaverEventRec);
+ if (!pEv) {
+ CheckScreenPrivate(pScreen);
+ return FALSE;
+ }
+ *pPrev = pEv;
+ pEv->next = NULL;
+ pEv->client = client;
+ pEv->screen = pScreen;
+ pEv->resource = FakeClientID(client->index);
+ if (!AddResource(pEv->resource, SaverEventType, (pointer) pEv))
+ return FALSE;
+ }
+ pEv->mask = mask;
}
return TRUE;
}
static void
-FreeAttrs (ScreenSaverAttrPtr pAttr)
+FreeAttrs(ScreenSaverAttrPtr pAttr)
{
- PixmapPtr pPixmap;
- CursorPtr pCursor;
+ PixmapPtr pPixmap;
+ CursorPtr pCursor;
if ((pPixmap = pAttr->pBackgroundPixmap) != 0)
- (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+ (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
if ((pPixmap = pAttr->pBorderPixmap) != 0)
- (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+ (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
if ((pCursor = pAttr->pCursor) != 0)
- FreeCursor (pCursor, (Cursor) 0);
+ FreeCursor(pCursor, (Cursor) 0);
}
static void
-FreeScreenAttr (ScreenSaverAttrPtr pAttr)
+FreeScreenAttr(ScreenSaverAttrPtr pAttr)
{
- FreeAttrs (pAttr);
+ FreeAttrs(pAttr);
free(pAttr->values);
free(pAttr);
}
static int
-ScreenSaverFreeEvents (pointer value, XID id)
+ScreenSaverFreeEvents(pointer value, XID id)
{
- ScreenSaverEventPtr pOld = (ScreenSaverEventPtr)value;
+ ScreenSaverEventPtr pOld = (ScreenSaverEventPtr) value;
ScreenPtr pScreen = pOld->screen;
- SetupScreen (pScreen);
- ScreenSaverEventPtr pEv, *pPrev;
+
+ SetupScreen(pScreen);
+ ScreenSaverEventPtr pEv, *pPrev;
if (!pPriv)
- return TRUE;
+ return TRUE;
for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next)
- if (pEv == pOld)
- break;
+ if (pEv == pOld)
+ break;
if (!pEv)
- return TRUE;
+ return TRUE;
*pPrev = pEv->next;
free(pEv);
- CheckScreenPrivate (pScreen);
+ CheckScreenPrivate(pScreen);
return TRUE;
}
static int
-ScreenSaverFreeAttr (pointer value, XID id)
+ScreenSaverFreeAttr(pointer value, XID id)
{
- ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr)value;
- ScreenPtr pScreen = pOldAttr->screen;
- SetupScreen (pScreen);
+ ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr) value;
+ ScreenPtr pScreen = pOldAttr->screen;
+
+ SetupScreen(pScreen);
if (!pPriv)
- return TRUE;
+ return TRUE;
if (pPriv->attr != pOldAttr)
- return TRUE;
- FreeScreenAttr (pOldAttr);
+ return TRUE;
+ FreeScreenAttr(pOldAttr);
pPriv->attr = NULL;
- if (pPriv->hasWindow)
- {
- dixSaveScreens (serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
- dixSaveScreens (serverClient, SCREEN_SAVER_FORCER, ScreenSaverActive);
+ if (pPriv->hasWindow) {
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverActive);
}
- CheckScreenPrivate (pScreen);
+ CheckScreenPrivate(pScreen);
return TRUE;
}
static int
-ScreenSaverFreeSuspend (pointer value, XID id)
+ScreenSaverFreeSuspend(pointer value, XID id)
{
ScreenSaverSuspensionPtr data = (ScreenSaverSuspensionPtr) value;
ScreenSaverSuspensionPtr *prev, this;
/* Unlink and free the suspension record for the client */
- for (prev = &suspendingClients; (this = *prev); prev = &this->next)
- {
- if (this == data)
- {
- *prev = this->next;
- free(this);
- break;
- }
+ for (prev = &suspendingClients; (this = *prev); prev = &this->next) {
+ if (this == data) {
+ *prev = this->next;
+ free(this);
+ break;
+ }
}
/* Reenable the screensaver if this was the last client suspending it. */
- if (screenSaverSuspended && suspendingClients == NULL)
- {
- screenSaverSuspended = FALSE;
+ if (screenSaverSuspended && suspendingClients == NULL) {
+ screenSaverSuspended = FALSE;
- /* The screensaver could be active, since suspending it (by design)
- doesn't prevent it from being forceably activated */
+ /* The screensaver could be active, since suspending it (by design)
+ doesn't prevent it from being forceably activated */
#ifdef DPMSExtension
- if (screenIsSaved != SCREEN_SAVER_ON && DPMSPowerLevel == DPMSModeOn)
+ if (screenIsSaved != SCREEN_SAVER_ON && DPMSPowerLevel == DPMSModeOn)
#else
- if (screenIsSaved != SCREEN_SAVER_ON)
+ if (screenIsSaved != SCREEN_SAVER_ON)
#endif
- {
- UpdateCurrentTimeIf();
- lastDeviceEventTime = currentTime;
- SetScreenSaverTimer();
- }
+ {
+ DeviceIntPtr dev;
+ UpdateCurrentTimeIf();
+ nt_list_for_each_entry(dev, inputInfo.devices, next)
+ lastDeviceEventTime[dev->id] = currentTime;
+ SetScreenSaverTimer();
+ }
}
return Success;
}
static void
-SendScreenSaverNotify (ScreenPtr pScreen, int state, Bool forced)
+SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced)
{
- ScreenSaverScreenPrivatePtr pPriv;
- ScreenSaverEventPtr pEv;
- unsigned long mask;
- xScreenSaverNotifyEvent ev;
- int kind;
+ ScreenSaverScreenPrivatePtr pPriv;
+ ScreenSaverEventPtr pEv;
+ unsigned long mask;
+ xScreenSaverNotifyEvent ev;
+ int kind;
- UpdateCurrentTimeIf ();
+ UpdateCurrentTimeIf();
mask = ScreenSaverNotifyMask;
if (state == ScreenSaverCycle)
- mask = ScreenSaverCycleMask;
+ mask = ScreenSaverCycleMask;
pScreen = screenInfo.screens[pScreen->myNum];
pPriv = GetScreenPrivate(pScreen);
if (!pPriv)
- return;
+ return;
if (pPriv->attr)
- kind = ScreenSaverExternal;
+ kind = ScreenSaverExternal;
else if (ScreenSaverBlanking != DontPreferBlanking)
- kind = ScreenSaverBlanked;
+ kind = ScreenSaverBlanked;
else
- kind = ScreenSaverInternal;
- for (pEv = pPriv->events; pEv; pEv = pEv->next)
- {
- if (!(pEv->mask & mask))
- continue;
- ev.type = ScreenSaverNotify + ScreenSaverEventBase;
- ev.state = state;
- ev.timestamp = currentTime.milliseconds;
- ev.root = pScreen->root->drawable.id;
- ev.window = pScreen->screensaver.wid;
- ev.kind = kind;
- ev.forced = forced;
- WriteEventsToClient (pEv->client, 1, (xEvent *) &ev);
+ kind = ScreenSaverInternal;
+ for (pEv = pPriv->events; pEv; pEv = pEv->next) {
+ if (!(pEv->mask & mask))
+ continue;
+ ev.type = ScreenSaverNotify + ScreenSaverEventBase;
+ ev.state = state;
+ ev.timestamp = currentTime.milliseconds;
+ ev.root = pScreen->root->drawable.id;
+ ev.window = pScreen->screensaver.wid;
+ ev.kind = kind;
+ ev.forced = forced;
+ WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
}
}
static void
-SScreenSaverNotifyEvent (xScreenSaverNotifyEvent *from,
- xScreenSaverNotifyEvent *to)
+SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * from,
+ xScreenSaverNotifyEvent * to)
{
to->type = from->type;
to->state = from->state;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->timestamp, to->timestamp);
- cpswapl (from->root, to->root);
- cpswapl (from->window, to->window);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->root, to->root);
+ cpswapl(from->window, to->window);
to->kind = from->kind;
to->forced = from->forced;
}
static void
-UninstallSaverColormap (ScreenPtr pScreen)
+UninstallSaverColormap(ScreenPtr pScreen)
{
SetupScreen(pScreen);
- ColormapPtr pCmap;
+ ColormapPtr pCmap;
int rc;
- if (pPriv && pPriv->installedMap != None)
- {
- rc = dixLookupResourceByType((pointer *)&pCmap, pPriv->installedMap,
- RT_COLORMAP, serverClient,
- DixUninstallAccess);
- if (rc == Success)
- (*pCmap->pScreen->UninstallColormap) (pCmap);
- pPriv->installedMap = None;
- CheckScreenPrivate (pScreen);
+ if (pPriv && pPriv->installedMap != None) {
+ rc = dixLookupResourceByType((pointer *) &pCmap, pPriv->installedMap,
+ RT_COLORMAP, serverClient,
+ DixUninstallAccess);
+ if (rc == Success)
+ (*pCmap->pScreen->UninstallColormap) (pCmap);
+ pPriv->installedMap = None;
+ CheckScreenPrivate(pScreen);
}
}
static Bool
-CreateSaverWindow (ScreenPtr pScreen)
+CreateSaverWindow(ScreenPtr pScreen)
{
- SetupScreen (pScreen);
- ScreenSaverStuffPtr pSaver;
- ScreenSaverAttrPtr pAttr;
- WindowPtr pWin;
- int result;
- unsigned long mask;
- Colormap *installedMaps;
- int numInstalled;
- int i;
- Colormap wantMap;
- ColormapPtr pCmap;
+ SetupScreen(pScreen);
+ ScreenSaverStuffPtr pSaver;
+ ScreenSaverAttrPtr pAttr;
+ WindowPtr pWin;
+ int result;
+ unsigned long mask;
+ Colormap *installedMaps;
+ int numInstalled;
+ int i;
+ Colormap wantMap;
+ ColormapPtr pCmap;
pSaver = &pScreen->screensaver;
- if (pSaver->pWindow)
- {
- pSaver->pWindow = NullWindow;
- FreeResource (pSaver->wid, RT_NONE);
- if (pPriv)
- {
- UninstallSaverColormap (pScreen);
- pPriv->hasWindow = FALSE;
- CheckScreenPrivate (pScreen);
- }
+ if (pSaver->pWindow) {
+ pSaver->pWindow = NullWindow;
+ FreeResource(pSaver->wid, RT_NONE);
+ if (pPriv) {
+ UninstallSaverColormap(pScreen);
+ pPriv->hasWindow = FALSE;
+ CheckScreenPrivate(pScreen);
+ }
}
if (!pPriv || !(pAttr = pPriv->attr))
- return FALSE;
+ return FALSE;
pPriv->installedMap = None;
if (GrabInProgress && GrabInProgress != pAttr->client->index)
- return FALSE;
-
- pWin = CreateWindow (pSaver->wid, pScreen->root,
- pAttr->x, pAttr->y, pAttr->width, pAttr->height,
- pAttr->borderWidth, pAttr->class,
- pAttr->mask, (XID *)pAttr->values,
- pAttr->depth, serverClient, pAttr->visual,
- &result);
+ return FALSE;
+
+ pWin = CreateWindow(pSaver->wid, pScreen->root,
+ pAttr->x, pAttr->y, pAttr->width, pAttr->height,
+ pAttr->borderWidth, pAttr->class,
+ pAttr->mask, (XID *) pAttr->values,
+ pAttr->depth, serverClient, pAttr->visual, &result);
if (!pWin)
- return FALSE;
+ return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW, pWin))
- return FALSE;
+ return FALSE;
mask = 0;
- if (pAttr->pBackgroundPixmap)
- {
- pWin->backgroundState = BackgroundPixmap;
- pWin->background.pixmap = pAttr->pBackgroundPixmap;
- pAttr->pBackgroundPixmap->refcnt++;
- mask |= CWBackPixmap;
+ if (pAttr->pBackgroundPixmap) {
+ pWin->backgroundState = BackgroundPixmap;
+ pWin->background.pixmap = pAttr->pBackgroundPixmap;
+ pAttr->pBackgroundPixmap->refcnt++;
+ mask |= CWBackPixmap;
}
- if (pAttr->pBorderPixmap)
- {
- pWin->borderIsPixel = FALSE;
- pWin->border.pixmap = pAttr->pBorderPixmap;
- pAttr->pBorderPixmap->refcnt++;
- mask |= CWBorderPixmap;
+ if (pAttr->pBorderPixmap) {
+ pWin->borderIsPixel = FALSE;
+ pWin->border.pixmap = pAttr->pBorderPixmap;
+ pAttr->pBorderPixmap->refcnt++;
+ mask |= CWBorderPixmap;
}
- if (pAttr->pCursor)
- {
- if (!pWin->optional)
- if (!MakeWindowOptional (pWin))
- {
- FreeResource (pWin->drawable.id, RT_NONE);
- return FALSE;
- }
- pAttr->pCursor->refcnt++;
- if (pWin->optional->cursor)
- FreeCursor (pWin->optional->cursor, (Cursor)0);
- pWin->optional->cursor = pAttr->pCursor;
- pWin->cursorIsNone = FALSE;
- CheckWindowOptionalNeed (pWin);
- mask |= CWCursor;
+ if (pAttr->pCursor) {
+ if (!pWin->optional)
+ if (!MakeWindowOptional(pWin)) {
+ FreeResource(pWin->drawable.id, RT_NONE);
+ return FALSE;
+ }
+ pAttr->pCursor->refcnt++;
+ if (pWin->optional->cursor)
+ FreeCursor(pWin->optional->cursor, (Cursor) 0);
+ pWin->optional->cursor = pAttr->pCursor;
+ pWin->cursorIsNone = FALSE;
+ CheckWindowOptionalNeed(pWin);
+ mask |= CWCursor;
}
if (mask)
- (*pScreen->ChangeWindowAttributes) (pWin, mask);
+ (*pScreen->ChangeWindowAttributes) (pWin, mask);
if (pAttr->colormap != None)
- (void) ChangeWindowAttributes (pWin, CWColormap, &pAttr->colormap,
- serverClient);
+ (void) ChangeWindowAttributes(pWin, CWColormap, &pAttr->colormap,
+ serverClient);
- MapWindow (pWin, serverClient);
+ MapWindow(pWin, serverClient);
pPriv->hasWindow = TRUE;
pSaver->pWindow = pWin;
/* check and install our own colormap if it isn't installed now */
- wantMap = wColormap (pWin);
+ wantMap = wColormap(pWin);
if (wantMap == None)
- return TRUE;
- installedMaps = malloc(pScreen->maxInstalledCmaps * sizeof (Colormap));
+ return TRUE;
+ installedMaps = malloc(pScreen->maxInstalledCmaps * sizeof(Colormap));
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
- (pScreen, installedMaps);
- for (i = 0; i < numInstalled; i++)
- if (installedMaps[i] == wantMap)
- break;
+ (pScreen, installedMaps);
+ for (i = 0; i < numInstalled; i++)
+ if (installedMaps[i] == wantMap)
+ break;
free((char *) installedMaps);
if (i < numInstalled)
- return TRUE;
+ return TRUE;
- result = dixLookupResourceByType((pointer *)&pCmap, wantMap, RT_COLORMAP,
- serverClient, DixInstallAccess);
+ result = dixLookupResourceByType((pointer *) &pCmap, wantMap, RT_COLORMAP,
+ serverClient, DixInstallAccess);
if (result != Success)
- return TRUE;
+ return TRUE;
pPriv->installedMap = wantMap;
@@ -620,229 +588,221 @@ CreateSaverWindow (ScreenPtr pScreen)
}
static Bool
-DestroySaverWindow (ScreenPtr pScreen)
+DestroySaverWindow(ScreenPtr pScreen)
{
SetupScreen(pScreen);
- ScreenSaverStuffPtr pSaver;
+ ScreenSaverStuffPtr pSaver;
if (!pPriv || !pPriv->hasWindow)
- return FALSE;
+ return FALSE;
pSaver = &pScreen->screensaver;
- if (pSaver->pWindow)
- {
- pSaver->pWindow = NullWindow;
- FreeResource (pSaver->wid, RT_NONE);
+ if (pSaver->pWindow) {
+ pSaver->pWindow = NullWindow;
+ FreeResource(pSaver->wid, RT_NONE);
}
pPriv->hasWindow = FALSE;
- CheckScreenPrivate (pScreen);
- UninstallSaverColormap (pScreen);
+ CheckScreenPrivate(pScreen);
+ UninstallSaverColormap(pScreen);
return TRUE;
}
static Bool
-ScreenSaverHandle (ScreenPtr pScreen, int xstate, Bool force)
+ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
{
- int state = 0;
- Bool ret = FALSE;
- ScreenSaverScreenPrivatePtr pPriv;
-
- switch (xstate)
- {
- case SCREEN_SAVER_ON:
- state = ScreenSaverOn;
- ret = CreateSaverWindow (pScreen);
- break;
- case SCREEN_SAVER_OFF:
- state = ScreenSaverOff;
- ret = DestroySaverWindow (pScreen);
- break;
- case SCREEN_SAVER_CYCLE:
- state = ScreenSaverCycle;
- pPriv = GetScreenPrivate (pScreen);
- if (pPriv && pPriv->hasWindow)
- ret = TRUE;
-
+ int state = 0;
+ Bool ret = FALSE;
+ ScreenSaverScreenPrivatePtr pPriv;
+
+ switch (xstate) {
+ case SCREEN_SAVER_ON:
+ state = ScreenSaverOn;
+ ret = CreateSaverWindow(pScreen);
+ break;
+ case SCREEN_SAVER_OFF:
+ state = ScreenSaverOff;
+ ret = DestroySaverWindow(pScreen);
+ break;
+ case SCREEN_SAVER_CYCLE:
+ state = ScreenSaverCycle;
+ pPriv = GetScreenPrivate(pScreen);
+ if (pPriv && pPriv->hasWindow)
+ ret = TRUE;
+
}
#ifdef PANORAMIX
- if(noPanoramiXExtension || !pScreen->myNum)
+ if (noPanoramiXExtension || !pScreen->myNum)
#endif
- SendScreenSaverNotify (pScreen, state, force);
+ SendScreenSaverNotify(pScreen, state, force);
return ret;
}
static int
-ProcScreenSaverQueryVersion (ClientPtr client)
+ProcScreenSaverQueryVersion(ClientPtr client)
{
- xScreenSaverQueryVersionReply rep;
- REQUEST_SIZE_MATCH (xScreenSaverQueryVersionReq);
+ xScreenSaverQueryVersionReply rep;
+
+ REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = SERVER_SAVER_MAJOR_VERSION;
rep.minorVersion = SERVER_SAVER_MINOR_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
- WriteToClient(client, sizeof (xScreenSaverQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), (char *) &rep);
return Success;
}
static int
-ProcScreenSaverQueryInfo (ClientPtr client)
+ProcScreenSaverQueryInfo(ClientPtr client)
{
REQUEST(xScreenSaverQueryInfoReq);
- xScreenSaverQueryInfoReply rep;
- int rc;
- ScreenSaverStuffPtr pSaver;
- DrawablePtr pDraw;
- CARD32 lastInput;
- ScreenSaverScreenPrivatePtr pPriv;
-
- REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq);
+ xScreenSaverQueryInfoReply rep;
+ int rc;
+ ScreenSaverStuffPtr pSaver;
+ DrawablePtr pDraw;
+ CARD32 lastInput;
+ ScreenSaverScreenPrivatePtr pPriv;
+
+ REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
pSaver = &pDraw->pScreen->screensaver;
- pPriv = GetScreenPrivate (pDraw->pScreen);
+ pPriv = GetScreenPrivate(pDraw->pScreen);
- UpdateCurrentTime ();
- lastInput = GetTimeInMillis() - lastDeviceEventTime.milliseconds;
+ UpdateCurrentTime();
+ lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.window = pSaver->wid;
- if (screenIsSaved != SCREEN_SAVER_OFF)
- {
- rep.state = ScreenSaverOn;
- if (ScreenSaverTime)
- rep.tilOrSince = lastInput - ScreenSaverTime;
- else
- rep.tilOrSince = 0;
+ if (screenIsSaved != SCREEN_SAVER_OFF) {
+ rep.state = ScreenSaverOn;
+ if (ScreenSaverTime)
+ rep.tilOrSince = lastInput - ScreenSaverTime;
+ else
+ rep.tilOrSince = 0;
}
- else
- {
- if (ScreenSaverTime)
- {
- rep.state = ScreenSaverOff;
- if (ScreenSaverTime < lastInput)
- rep.tilOrSince = 0;
- else
- rep.tilOrSince = ScreenSaverTime - lastInput;
- }
- else
- {
- rep.state = ScreenSaverDisabled;
- rep.tilOrSince = 0;
- }
+ else {
+ if (ScreenSaverTime) {
+ rep.state = ScreenSaverOff;
+ if (ScreenSaverTime < lastInput)
+ rep.tilOrSince = 0;
+ else
+ rep.tilOrSince = ScreenSaverTime - lastInput;
+ }
+ else {
+ rep.state = ScreenSaverDisabled;
+ rep.tilOrSince = 0;
+ }
}
rep.idle = lastInput;
- rep.eventMask = getEventMask (pDraw->pScreen, client);
+ rep.eventMask = getEventMask(pDraw->pScreen, client);
if (pPriv && pPriv->attr)
- rep.kind = ScreenSaverExternal;
+ rep.kind = ScreenSaverExternal;
else if (ScreenSaverBlanking != DontPreferBlanking)
- rep.kind = ScreenSaverBlanked;
+ rep.kind = ScreenSaverBlanked;
else
- rep.kind = ScreenSaverInternal;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.window);
- swapl(&rep.tilOrSince);
- swapl(&rep.idle);
- swapl(&rep.eventMask);
+ rep.kind = ScreenSaverInternal;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.window);
+ swapl(&rep.tilOrSince);
+ swapl(&rep.idle);
+ swapl(&rep.eventMask);
}
- WriteToClient(client, sizeof (xScreenSaverQueryInfoReply), (char *)&rep);
+ WriteToClient(client, sizeof(xScreenSaverQueryInfoReply), (char *) &rep);
return Success;
}
static int
-ProcScreenSaverSelectInput (ClientPtr client)
+ProcScreenSaverSelectInput(ClientPtr client)
{
REQUEST(xScreenSaverSelectInputReq);
- DrawablePtr pDraw;
- int rc;
+ DrawablePtr pDraw;
+ int rc;
- REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq);
- rc = dixLookupDrawable (&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
- DixSetAttrAccess);
+ DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
- if (!setEventMask (pDraw->pScreen, client, stuff->eventMask))
- return BadAlloc;
+ if (!setEventMask(pDraw->pScreen, client, stuff->eventMask))
+ return BadAlloc;
return Success;
}
static int
-ScreenSaverSetAttributes (ClientPtr client)
+ScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
- DrawablePtr pDraw;
- WindowPtr pParent;
- ScreenPtr pScreen;
+ DrawablePtr pDraw;
+ WindowPtr pParent;
+ ScreenPtr pScreen;
ScreenSaverScreenPrivatePtr pPriv = 0;
- ScreenSaverAttrPtr pAttr = 0;
- int ret, len, class, bw, depth;
- unsigned long visual;
- int idepth, ivisual;
- Bool fOK;
- DepthPtr pDepth;
- WindowOptPtr ancwopt;
- unsigned int *pVlist;
- unsigned long *values = 0;
- unsigned long tmask, imask;
- unsigned long val;
- Pixmap pixID;
- PixmapPtr pPixmap;
- Cursor cursorID;
- CursorPtr pCursor;
- Colormap cmap;
- ColormapPtr pCmap;
-
- REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
+ ScreenSaverAttrPtr pAttr = 0;
+ int ret, len, class, bw, depth;
+ unsigned long visual;
+ int idepth, ivisual;
+ Bool fOK;
+ DepthPtr pDepth;
+ WindowOptPtr ancwopt;
+ unsigned int *pVlist;
+ unsigned long *values = 0;
+ unsigned long tmask, imask;
+ unsigned long val;
+ Pixmap pixID;
+ PixmapPtr pPixmap;
+ Cursor cursorID;
+ CursorPtr pCursor;
+ Colormap cmap;
+ ColormapPtr pCmap;
+
+ REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (ret != Success)
- return ret;
+ return ret;
pScreen = pDraw->pScreen;
pParent = pScreen->root;
ret = XaceHook(XACE_SCREENSAVER_ACCESS, client, pScreen, DixSetAttrAccess);
if (ret != Success)
- return ret;
+ return ret;
- len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
+ len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
if (Ones(stuff->mask) != len)
return BadLength;
- if (!stuff->width || !stuff->height)
- {
- client->errorValue = 0;
+ if (!stuff->width || !stuff->height) {
+ client->errorValue = 0;
return BadValue;
}
- switch (class = stuff->c_class)
- {
+ switch (class = stuff->c_class) {
case CopyFromParent:
case InputOnly:
case InputOutput:
- break;
+ break;
default:
- client->errorValue = class;
- return BadValue;
+ client->errorValue = class;
+ return BadValue;
}
bw = stuff->borderWidth;
depth = stuff->depth;
@@ -851,12 +811,11 @@ ScreenSaverSetAttributes (ClientPtr client)
/* copied directly from CreateWindow */
if (class == CopyFromParent)
- class = pParent->drawable.class;
+ class = pParent->drawable.class;
- if ((class != InputOutput) && (class != InputOnly))
- {
- client->errorValue = class;
- return BadValue;
+ if ((class != InputOutput) && (class != InputOnly)) {
+ client->errorValue = class;
+ return BadValue;
}
if ((class != InputOnly) && (pParent->drawable.class == InputOnly))
@@ -869,73 +828,61 @@ ScreenSaverSetAttributes (ClientPtr client)
depth = pParent->drawable.depth;
ancwopt = pParent->optional;
if (!ancwopt)
- ancwopt = FindWindowWithOptional(pParent)->optional;
+ ancwopt = FindWindowWithOptional(pParent)->optional;
if (visual == CopyFromParent)
- visual = ancwopt->visual;
+ visual = ancwopt->visual;
/* Find out if the depth and visual are acceptable for this Screen */
- if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth))
- {
- fOK = FALSE;
- for(idepth = 0; idepth < pScreen->numDepths; idepth++)
- {
- pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
- if ((depth == pDepth->depth) || (depth == 0))
- {
- for (ivisual = 0; ivisual < pDepth->numVids; ivisual++)
- {
- if (visual == pDepth->vids[ivisual])
- {
- fOK = TRUE;
- break;
- }
- }
- }
- }
- if (fOK == FALSE)
- return BadMatch;
+ if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) {
+ fOK = FALSE;
+ for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
+ pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
+ if ((depth == pDepth->depth) || (depth == 0)) {
+ for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
+ if (visual == pDepth->vids[ivisual]) {
+ fOK = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ if (fOK == FALSE)
+ return BadMatch;
}
if (((stuff->mask & (CWBorderPixmap | CWBorderPixel)) == 0) &&
- (class != InputOnly) &&
- (depth != pParent->drawable.depth))
- {
+ (class != InputOnly) && (depth != pParent->drawable.depth)) {
return BadMatch;
}
if (((stuff->mask & CWColormap) == 0) &&
- (class != InputOnly) &&
- ((visual != ancwopt->visual) || (ancwopt->colormap == None)))
- {
- return BadMatch;
+ (class != InputOnly) &&
+ ((visual != ancwopt->visual) || (ancwopt->colormap == None))) {
+ return BadMatch;
}
/* end of errors from CreateWindow */
- pPriv = GetScreenPrivate (pScreen);
- if (pPriv && pPriv->attr)
- {
- if (pPriv->attr->client != client)
- return BadAccess;
+ pPriv = GetScreenPrivate(pScreen);
+ if (pPriv && pPriv->attr) {
+ if (pPriv->attr->client != client)
+ return BadAccess;
}
- if (!pPriv)
- {
- pPriv = MakeScreenPrivate (pScreen);
- if (!pPriv)
- return FALSE;
+ if (!pPriv) {
+ pPriv = MakeScreenPrivate(pScreen);
+ if (!pPriv)
+ return FALSE;
}
- pAttr = New (ScreenSaverAttrRec);
- if (!pAttr)
- {
- ret = BadAlloc;
- goto bail;
+ pAttr = New(ScreenSaverAttrRec);
+ if (!pAttr) {
+ ret = BadAlloc;
+ goto bail;
}
/* over allocate for override redirect */
- pAttr->values = values = malloc((len + 1) * sizeof (unsigned long));
- if (!values)
- {
- ret = BadAlloc;
- goto bail;
+ pAttr->values = values = malloc((len + 1) * sizeof(unsigned long));
+ if (!values) {
+ ret = BadAlloc;
+ goto bail;
}
pAttr->screen = pScreen;
pAttr->client = client;
@@ -959,318 +906,297 @@ ScreenSaverSetAttributes (ClientPtr client)
pAttr->mask = tmask = stuff->mask | CWOverrideRedirect;
pVlist = (unsigned int *) (stuff + 1);
while (tmask) {
- imask = lowbit (tmask);
- tmask &= ~imask;
- switch (imask)
- {
- case CWBackPixmap:
- pixID = (Pixmap )*pVlist;
- if (pixID == None)
- {
- *values++ = None;
- }
- else if (pixID == ParentRelative)
- {
- if (depth != pParent->drawable.depth)
- {
- ret = BadMatch;
- goto PatchUp;
- }
- *values++ = ParentRelative;
- }
- else
- {
- ret = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
- client, DixReadAccess);
- if (ret == Success)
- {
- if ((pPixmap->drawable.depth != depth) ||
- (pPixmap->drawable.pScreen != pScreen))
- {
+ imask = lowbit(tmask);
+ tmask &= ~imask;
+ switch (imask) {
+ case CWBackPixmap:
+ pixID = (Pixmap) * pVlist;
+ if (pixID == None) {
+ *values++ = None;
+ }
+ else if (pixID == ParentRelative) {
+ if (depth != pParent->drawable.depth) {
+ ret = BadMatch;
+ goto PatchUp;
+ }
+ *values++ = ParentRelative;
+ }
+ else {
+ ret =
+ dixLookupResourceByType((pointer *) &pPixmap, pixID,
+ RT_PIXMAP, client, DixReadAccess);
+ if (ret == Success) {
+ if ((pPixmap->drawable.depth != depth) ||
+ (pPixmap->drawable.pScreen != pScreen)) {
+ ret = BadMatch;
+ goto PatchUp;
+ }
+ pAttr->pBackgroundPixmap = pPixmap;
+ pPixmap->refcnt++;
+ pAttr->mask &= ~CWBackPixmap;
+ }
+ else {
+ client->errorValue = pixID;
+ goto PatchUp;
+ }
+ }
+ break;
+ case CWBackPixel:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWBorderPixmap:
+ pixID = (Pixmap) * pVlist;
+ if (pixID == CopyFromParent) {
+ if (depth != pParent->drawable.depth) {
+ ret = BadMatch;
+ goto PatchUp;
+ }
+ *values++ = CopyFromParent;
+ }
+ else {
+ ret =
+ dixLookupResourceByType((pointer *) &pPixmap, pixID,
+ RT_PIXMAP, client, DixReadAccess);
+ if (ret == Success) {
+ if ((pPixmap->drawable.depth != depth) ||
+ (pPixmap->drawable.pScreen != pScreen)) {
ret = BadMatch;
- goto PatchUp;
- }
- pAttr->pBackgroundPixmap = pPixmap;
- pPixmap->refcnt++;
- pAttr->mask &= ~CWBackPixmap;
- }
- else
- {
- client->errorValue = pixID;
- goto PatchUp;
- }
- }
- break;
- case CWBackPixel:
- *values++ = (CARD32) *pVlist;
- break;
- case CWBorderPixmap:
- pixID = (Pixmap ) *pVlist;
- if (pixID == CopyFromParent)
- {
- if (depth != pParent->drawable.depth)
- {
- ret = BadMatch;
- goto PatchUp;
- }
- *values++ = CopyFromParent;
- }
- else
- {
- ret = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
- client, DixReadAccess);
- if (ret == Success)
- {
- if ((pPixmap->drawable.depth != depth) ||
- (pPixmap->drawable.pScreen != pScreen))
- {
- ret = BadMatch;
- goto PatchUp;
- }
- pAttr->pBorderPixmap = pPixmap;
- pPixmap->refcnt++;
- pAttr->mask &= ~CWBorderPixmap;
- }
- else
- {
- client->errorValue = pixID;
- goto PatchUp;
- }
- }
- break;
- case CWBorderPixel:
+ goto PatchUp;
+ }
+ pAttr->pBorderPixmap = pPixmap;
+ pPixmap->refcnt++;
+ pAttr->mask &= ~CWBorderPixmap;
+ }
+ else {
+ client->errorValue = pixID;
+ goto PatchUp;
+ }
+ }
+ break;
+ case CWBorderPixel:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWBitGravity:
+ val = (CARD8) *pVlist;
+ if (val > StaticGravity) {
+ ret = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ *values++ = val;
+ break;
+ case CWWinGravity:
+ val = (CARD8) *pVlist;
+ if (val > StaticGravity) {
+ ret = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ *values++ = val;
+ break;
+ case CWBackingStore:
+ val = (CARD8) *pVlist;
+ if ((val != NotUseful) && (val != WhenMapped) && (val != Always)) {
+ ret = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ *values++ = val;
+ break;
+ case CWBackingPlanes:
*values++ = (CARD32) *pVlist;
break;
- case CWBitGravity:
- val = (CARD8 )*pVlist;
- if (val > StaticGravity)
- {
- ret = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- *values++ = val;
- break;
- case CWWinGravity:
- val = (CARD8 )*pVlist;
- if (val > StaticGravity)
- {
- ret = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- *values++ = val;
- break;
- case CWBackingStore:
- val = (CARD8 )*pVlist;
- if ((val != NotUseful) && (val != WhenMapped) && (val != Always))
- {
- ret = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- *values++ = val;
- break;
- case CWBackingPlanes:
- *values++ = (CARD32) *pVlist;
- break;
- case CWBackingPixel:
- *values++ = (CARD32) *pVlist;
- break;
- case CWSaveUnder:
- val = (BOOL) *pVlist;
- if ((val != xTrue) && (val != xFalse))
- {
- ret = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- *values++ = val;
- break;
- case CWEventMask:
- *values++ = (CARD32) *pVlist;
- break;
- case CWDontPropagate:
- *values++ = (CARD32) *pVlist;
- break;
- case CWOverrideRedirect:
- if (!(stuff->mask & CWOverrideRedirect))
- pVlist--;
- else
- {
- val = (BOOL ) *pVlist;
- if ((val != xTrue) && (val != xFalse))
- {
- ret = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- }
- *values++ = xTrue;
- break;
- case CWColormap:
- cmap = (Colormap) *pVlist;
- ret = dixLookupResourceByType((pointer *)&pCmap, cmap, RT_COLORMAP,
- client, DixUseAccess);
- if (ret != Success)
- {
- client->errorValue = cmap;
- goto PatchUp;
- }
- if (pCmap->pVisual->vid != visual || pCmap->pScreen != pScreen)
- {
- ret = BadMatch;
- goto PatchUp;
- }
- pAttr->colormap = cmap;
- pAttr->mask &= ~CWColormap;
- break;
- case CWCursor:
- cursorID = (Cursor ) *pVlist;
- if ( cursorID == None)
- {
- *values++ = None;
- }
- else
- {
- ret = dixLookupResourceByType((pointer *)&pCursor, cursorID,
- RT_CURSOR, client, DixUseAccess);
- if (ret != Success)
- {
- client->errorValue = cursorID;
- goto PatchUp;
- }
- pCursor->refcnt++;
- pAttr->pCursor = pCursor;
- pAttr->mask &= ~CWCursor;
- }
- break;
- default:
- ret = BadValue;
- client->errorValue = stuff->mask;
- goto PatchUp;
- }
- pVlist++;
+ case CWBackingPixel:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWSaveUnder:
+ val = (BOOL) * pVlist;
+ if ((val != xTrue) && (val != xFalse)) {
+ ret = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ *values++ = val;
+ break;
+ case CWEventMask:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWDontPropagate:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWOverrideRedirect:
+ if (!(stuff->mask & CWOverrideRedirect))
+ pVlist--;
+ else {
+ val = (BOOL) * pVlist;
+ if ((val != xTrue) && (val != xFalse)) {
+ ret = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ }
+ *values++ = xTrue;
+ break;
+ case CWColormap:
+ cmap = (Colormap) * pVlist;
+ ret = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP,
+ client, DixUseAccess);
+ if (ret != Success) {
+ client->errorValue = cmap;
+ goto PatchUp;
+ }
+ if (pCmap->pVisual->vid != visual || pCmap->pScreen != pScreen) {
+ ret = BadMatch;
+ goto PatchUp;
+ }
+ pAttr->colormap = cmap;
+ pAttr->mask &= ~CWColormap;
+ break;
+ case CWCursor:
+ cursorID = (Cursor) * pVlist;
+ if (cursorID == None) {
+ *values++ = None;
+ }
+ else {
+ ret = dixLookupResourceByType((pointer *) &pCursor, cursorID,
+ RT_CURSOR, client, DixUseAccess);
+ if (ret != Success) {
+ client->errorValue = cursorID;
+ goto PatchUp;
+ }
+ pCursor->refcnt++;
+ pAttr->pCursor = pCursor;
+ pAttr->mask &= ~CWCursor;
+ }
+ break;
+ default:
+ ret = BadValue;
+ client->errorValue = stuff->mask;
+ goto PatchUp;
+ }
+ pVlist++;
}
if (pPriv->attr)
- FreeScreenAttr (pPriv->attr);
+ FreeScreenAttr(pPriv->attr);
pPriv->attr = pAttr;
- pAttr->resource = FakeClientID (client->index);
- if (!AddResource (pAttr->resource, AttrType, (pointer) pAttr))
- return BadAlloc;
+ pAttr->resource = FakeClientID(client->index);
+ if (!AddResource(pAttr->resource, AttrType, (pointer) pAttr))
+ return BadAlloc;
return Success;
-PatchUp:
- FreeAttrs (pAttr);
-bail:
- CheckScreenPrivate (pScreen);
- if (pAttr) free(pAttr->values);
+ PatchUp:
+ FreeAttrs(pAttr);
+ bail:
+ CheckScreenPrivate(pScreen);
+ if (pAttr)
+ free(pAttr->values);
free(pAttr);
return ret;
}
static int
-ScreenSaverUnsetAttributes (ClientPtr client)
+ScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
- DrawablePtr pDraw;
- ScreenSaverScreenPrivatePtr pPriv;
- int rc;
+ DrawablePtr pDraw;
+ ScreenSaverScreenPrivatePtr pPriv;
+ int rc;
- REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq);
+ REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
- pPriv = GetScreenPrivate (pDraw->pScreen);
- if (pPriv && pPriv->attr && pPriv->attr->client == client)
- {
- FreeResource (pPriv->attr->resource, AttrType);
- FreeScreenAttr (pPriv->attr);
- pPriv->attr = NULL;
- CheckScreenPrivate (pDraw->pScreen);
+ return rc;
+ pPriv = GetScreenPrivate(pDraw->pScreen);
+ if (pPriv && pPriv->attr && pPriv->attr->client == client) {
+ FreeResource(pPriv->attr->resource, AttrType);
+ FreeScreenAttr(pPriv->attr);
+ pPriv->attr = NULL;
+ CheckScreenPrivate(pDraw->pScreen);
}
return Success;
}
static int
-ProcScreenSaverSetAttributes (ClientPtr client)
+ProcScreenSaverSetAttributes(ClientPtr client)
{
#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
- REQUEST(xScreenSaverSetAttributesReq);
- PanoramiXRes *draw;
- PanoramiXRes *backPix = NULL;
- PanoramiXRes *bordPix = NULL;
- PanoramiXRes *cmap = NULL;
- int i, status, len;
- int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
- XID orig_visual, tmp;
-
- REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
-
- status = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
- if (status != Success)
- return (status == BadValue) ? BadDrawable : status;
-
- len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
- if (Ones(stuff->mask) != len)
- return BadLength;
-
- if((Mask)stuff->mask & CWBackPixmap) {
- pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1));
- tmp = *((CARD32 *) &stuff[1] + pback_offset);
- if ((tmp != None) && (tmp != ParentRelative)) {
- status = dixLookupResourceByType((pointer *)&backPix, tmp,
- XRT_PIXMAP, client,
- DixReadAccess);
- if (status != Success)
- return status;
- }
- }
-
- if ((Mask)stuff->mask & CWBorderPixmap) {
- pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1));
- tmp = *((CARD32 *) &stuff[1] + pbord_offset);
- if (tmp != CopyFromParent) {
- status = dixLookupResourceByType((pointer *)&bordPix, tmp,
- XRT_PIXMAP, client,
- DixReadAccess);
- if (status != Success)
- return status;
- }
- }
-
- if ((Mask)stuff->mask & CWColormap) {
- cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1));
- tmp = *((CARD32 *) &stuff[1] + cmap_offset);
- if ((tmp != CopyFromParent) && (tmp != None)) {
- status = dixLookupResourceByType((pointer *)&cmap, tmp,
- XRT_COLORMAP, client,
- DixReadAccess);
- if (status != Success)
- return status;
- }
- }
-
- orig_visual = stuff->visualID;
-
- FOR_NSCREENS_BACKWARD(i) {
- stuff->drawable = draw->info[i].id;
- if (backPix)
- *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[i].id;
- if (bordPix)
- *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[i].id;
- if (cmap)
- *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[i].id;
-
- if (orig_visual != CopyFromParent)
- stuff->visualID = PanoramiXTranslateVisualID(i, orig_visual);
-
- status = ScreenSaverSetAttributes(client);
- }
-
- return status;
+ if (!noPanoramiXExtension) {
+ REQUEST(xScreenSaverSetAttributesReq);
+ PanoramiXRes *draw;
+ PanoramiXRes *backPix = NULL;
+ PanoramiXRes *bordPix = NULL;
+ PanoramiXRes *cmap = NULL;
+ int i, status, len;
+ int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
+ XID orig_visual, tmp;
+
+ REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
+
+ status = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
+ if (status != Success)
+ return (status == BadValue) ? BadDrawable : status;
+
+ len =
+ stuff->length -
+ bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+
+ if ((Mask) stuff->mask & CWBackPixmap) {
+ pback_offset = Ones((Mask) stuff->mask & (CWBackPixmap - 1));
+ tmp = *((CARD32 *) &stuff[1] + pback_offset);
+ if ((tmp != None) && (tmp != ParentRelative)) {
+ status = dixLookupResourceByType((pointer *) &backPix, tmp,
+ XRT_PIXMAP, client,
+ DixReadAccess);
+ if (status != Success)
+ return status;
+ }
+ }
+
+ if ((Mask) stuff->mask & CWBorderPixmap) {
+ pbord_offset = Ones((Mask) stuff->mask & (CWBorderPixmap - 1));
+ tmp = *((CARD32 *) &stuff[1] + pbord_offset);
+ if (tmp != CopyFromParent) {
+ status = dixLookupResourceByType((pointer *) &bordPix, tmp,
+ XRT_PIXMAP, client,
+ DixReadAccess);
+ if (status != Success)
+ return status;
+ }
+ }
+
+ if ((Mask) stuff->mask & CWColormap) {
+ cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
+ tmp = *((CARD32 *) &stuff[1] + cmap_offset);
+ if ((tmp != CopyFromParent) && (tmp != None)) {
+ status = dixLookupResourceByType((pointer *) &cmap, tmp,
+ XRT_COLORMAP, client,
+ DixReadAccess);
+ if (status != Success)
+ return status;
+ }
+ }
+
+ orig_visual = stuff->visualID;
+
+ FOR_NSCREENS_BACKWARD(i) {
+ stuff->drawable = draw->info[i].id;
+ if (backPix)
+ *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[i].id;
+ if (bordPix)
+ *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[i].id;
+ if (cmap)
+ *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[i].id;
+
+ if (orig_visual != CopyFromParent)
+ stuff->visualID = PanoramiXTranslateVisualID(i, orig_visual);
+
+ status = ScreenSaverSetAttributes(client);
+ }
+
+ return status;
}
#endif
@@ -1278,25 +1204,25 @@ ProcScreenSaverSetAttributes (ClientPtr client)
}
static int
-ProcScreenSaverUnsetAttributes (ClientPtr client)
+ProcScreenSaverUnsetAttributes(ClientPtr client)
{
#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
- REQUEST(xScreenSaverUnsetAttributesReq);
- PanoramiXRes *draw;
- int rc, i;
+ if (!noPanoramiXExtension) {
+ REQUEST(xScreenSaverUnsetAttributesReq);
+ PanoramiXRes *draw;
+ int rc, i;
- rc = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
- if (rc != Success)
- return (rc == BadValue) ? BadDrawable : rc;
+ rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
+ if (rc != Success)
+ return (rc == BadValue) ? BadDrawable : rc;
- for(i = PanoramiXNumScreens - 1; i > 0; i--) {
+ for (i = PanoramiXNumScreens - 1; i > 0; i--) {
stuff->drawable = draw->info[i].id;
ScreenSaverUnsetAttributes(client);
- }
+ }
- stuff->drawable = draw->info[0].id;
+ stuff->drawable = draw->info[0].id;
}
#endif
@@ -1304,7 +1230,7 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
}
static int
-ProcScreenSaverSuspend (ClientPtr client)
+ProcScreenSaverSuspend(ClientPtr client)
{
ScreenSaverSuspensionPtr *prev, this;
@@ -1313,22 +1239,21 @@ ProcScreenSaverSuspend (ClientPtr client)
/* Check if this client is suspending the screensaver */
for (prev = &suspendingClients; (this = *prev); prev = &this->next)
- if (this->pClient == client)
- break;
+ if (this->pClient == client)
+ break;
- if (this)
- {
- if (stuff->suspend == TRUE)
- this->count++;
- else if (--this->count == 0)
- FreeResource (this->clientResource, RT_NONE);
+ if (this) {
+ if (stuff->suspend == TRUE)
+ this->count++;
+ else if (--this->count == 0)
+ FreeResource(this->clientResource, RT_NONE);
- return Success;
+ return Success;
}
/* If we get to this point, this client isn't suspending the screensaver */
if (stuff->suspend == FALSE)
- return Success;
+ return Success;
/*
* Allocate a suspension record for the client, and stop the screensaver
@@ -1336,85 +1261,81 @@ ProcScreenSaverSuspend (ClientPtr client)
* to the record, so the screensaver will be reenabled and the record freed
* if the client disconnects without reenabling it first.
*/
- this = malloc(sizeof (ScreenSaverSuspensionRec));
+ this = malloc(sizeof(ScreenSaverSuspensionRec));
if (!this)
- return BadAlloc;
+ return BadAlloc;
- this->next = NULL;
- this->pClient = client;
- this->count = 1;
- this->clientResource = FakeClientID (client->index);
+ this->next = NULL;
+ this->pClient = client;
+ this->count = 1;
+ this->clientResource = FakeClientID(client->index);
- if (!AddResource (this->clientResource, SuspendType, (pointer) this))
- {
- free(this);
- return BadAlloc;
+ if (!AddResource(this->clientResource, SuspendType, (pointer) this)) {
+ free(this);
+ return BadAlloc;
}
*prev = this;
- if (!screenSaverSuspended)
- {
- screenSaverSuspended = TRUE;
- FreeScreenSaverTimer();
+ if (!screenSaverSuspended) {
+ screenSaverSuspended = TRUE;
+ FreeScreenSaverTimer();
}
return Success;
}
-static int (*NormalVector[]) (ClientPtr /* client */) = {
- ProcScreenSaverQueryVersion,
- ProcScreenSaverQueryInfo,
- ProcScreenSaverSelectInput,
- ProcScreenSaverSetAttributes,
- ProcScreenSaverUnsetAttributes,
- ProcScreenSaverSuspend,
-};
+static int (*NormalVector[]) (ClientPtr /* client */ ) = {
+ProcScreenSaverQueryVersion,
+ ProcScreenSaverQueryInfo,
+ ProcScreenSaverSelectInput,
+ ProcScreenSaverSetAttributes,
+ ProcScreenSaverUnsetAttributes, ProcScreenSaverSuspend,};
#define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0]))
static int
-ProcScreenSaverDispatch (ClientPtr client)
+ProcScreenSaverDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data < NUM_REQUESTS)
- return (*NormalVector[stuff->data])(client);
+ return (*NormalVector[stuff->data]) (client);
return BadRequest;
}
static int
-SProcScreenSaverQueryVersion (ClientPtr client)
+SProcScreenSaverQueryVersion(ClientPtr client)
{
REQUEST(xScreenSaverQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
- return ProcScreenSaverQueryVersion (client);
+ return ProcScreenSaverQueryVersion(client);
}
static int
-SProcScreenSaverQueryInfo (ClientPtr client)
+SProcScreenSaverQueryInfo(ClientPtr client)
{
REQUEST(xScreenSaverQueryInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
swapl(&stuff->drawable);
- return ProcScreenSaverQueryInfo (client);
+ return ProcScreenSaverQueryInfo(client);
}
static int
-SProcScreenSaverSelectInput (ClientPtr client)
+SProcScreenSaverSelectInput(ClientPtr client)
{
REQUEST(xScreenSaverSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
swapl(&stuff->drawable);
swapl(&stuff->eventMask);
- return ProcScreenSaverSelectInput (client);
+ return ProcScreenSaverSelectInput(client);
}
static int
-SProcScreenSaverSetAttributes (ClientPtr client)
+SProcScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
swaps(&stuff->length);
@@ -1428,45 +1349,43 @@ SProcScreenSaverSetAttributes (ClientPtr client)
swapl(&stuff->visualID);
swapl(&stuff->mask);
SwapRestL(stuff);
- return ProcScreenSaverSetAttributes (client);
+ return ProcScreenSaverSetAttributes(client);
}
static int
-SProcScreenSaverUnsetAttributes (ClientPtr client)
+SProcScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverUnsetAttributesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
swapl(&stuff->drawable);
- return ProcScreenSaverUnsetAttributes (client);
+ return ProcScreenSaverUnsetAttributes(client);
}
static int
-SProcScreenSaverSuspend (ClientPtr client)
+SProcScreenSaverSuspend(ClientPtr client)
{
REQUEST(xScreenSaverSuspendReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
- return ProcScreenSaverSuspend (client);
+ return ProcScreenSaverSuspend(client);
}
-static int (*SwappedVector[]) (ClientPtr /* client */) = {
- SProcScreenSaverQueryVersion,
- SProcScreenSaverQueryInfo,
- SProcScreenSaverSelectInput,
- SProcScreenSaverSetAttributes,
- SProcScreenSaverUnsetAttributes,
- SProcScreenSaverSuspend,
-};
+static int (*SwappedVector[]) (ClientPtr /* client */ ) = {
+SProcScreenSaverQueryVersion,
+ SProcScreenSaverQueryInfo,
+ SProcScreenSaverSelectInput,
+ SProcScreenSaverSetAttributes,
+ SProcScreenSaverUnsetAttributes, SProcScreenSaverSuspend,};
static int
-SProcScreenSaverDispatch (ClientPtr client)
+SProcScreenSaverDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data < NUM_REQUESTS)
- return (*SwappedVector[stuff->data])(client);
+ return (*SwappedVector[stuff->data]) (client);
return BadRequest;
}
@@ -1474,29 +1393,27 @@ void
ScreenSaverExtensionInit(INITARGS)
{
ExtensionEntry *extEntry;
- int i;
- ScreenPtr pScreen;
+ int i;
+ ScreenPtr pScreen;
if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return;
+ return;
AttrType = CreateNewResourceType(ScreenSaverFreeAttr, "SaverAttr");
- SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents,
- "SaverEvent");
- SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend,
- "SaverSuspend");
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- SetScreenPrivate (pScreen, NULL);
+ SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents, "SaverEvent");
+ SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend, "SaverSuspend");
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ SetScreenPrivate(pScreen, NULL);
}
if (AttrType && SaverEventType && SuspendType &&
- (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
- ProcScreenSaverDispatch, SProcScreenSaverDispatch,
- NULL, StandardMinorOpcode)))
- {
- ScreenSaverEventBase = extEntry->eventBase;
- EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent;
+ (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
+ ProcScreenSaverDispatch,
+ SProcScreenSaverDispatch, NULL,
+ StandardMinorOpcode))) {
+ ScreenSaverEventBase = extEntry->eventBase;
+ EventSwapVector[ScreenSaverEventBase] =
+ (EventSwapPtr) SScreenSaverNotifyEvent;
}
}
diff --git a/xorg-server/Xext/security.c b/xorg-server/Xext/security.c
index bc2930ce7..1e0bfefb9 100644
--- a/xorg-server/Xext/security.c
+++ b/xorg-server/Xext/security.c
@@ -44,16 +44,17 @@ in this Software without prior written authorization from The Open Group.
#include "protocol-versions.h"
/* Extension stuff */
-static int SecurityErrorBase; /* first Security error number */
-static int SecurityEventBase; /* first Security event number */
+static int SecurityErrorBase; /* first Security error number */
+static int SecurityEventBase; /* first Security event number */
-RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */
+RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */
static RESTYPE RTEventClient;
static CallbackListPtr SecurityValidateGroupCallback = NULL;
/* Private state record */
static DevPrivateKeyRec stateKeyRec;
+
#define stateKey (&stateKeyRec)
/* This is what we store as client security state */
@@ -86,7 +87,6 @@ static const Mask SecurityDeviceMask =
static const Mask SecurityServerMask = DixGetAttrAccess | DixGrabAccess;
static const Mask SecurityClientMask = DixGetAttrAccess;
-
/* SecurityAudit
*
* Arguments:
@@ -99,33 +99,34 @@ static const Mask SecurityClientMask = DixGetAttrAccess;
* Writes the message to the log file if security logging is on.
*/
-static void _X_ATTRIBUTE_PRINTF(1,2)
+static void
+_X_ATTRIBUTE_PRINTF(1, 2)
SecurityAudit(const char *format, ...)
{
va_list args;
if (auditTrailLevel < SECURITY_AUDIT_LEVEL)
- return;
+ return;
va_start(args, format);
VAuditF(format, args);
va_end(args);
-} /* SecurityAudit */
+} /* SecurityAudit */
/*
* Performs a Security permission check.
*/
static int
-SecurityDoCheck(SecurityStateRec *subj, SecurityStateRec *obj,
- Mask requested, Mask allowed)
+SecurityDoCheck(SecurityStateRec * subj, SecurityStateRec * obj,
+ Mask requested, Mask allowed)
{
if (!subj->haveState || !obj->haveState)
- return Success;
+ return Success;
if (subj->trustLevel == XSecurityClientTrusted)
- return Success;
+ return Success;
if (obj->trustLevel != XSecurityClientTrusted)
- return Success;
+ return Success;
if ((requested | allowed) == allowed)
- return Success;
+ return Success;
return BadAccess;
}
@@ -153,7 +154,6 @@ SecurityLookupRequestName(ClientPtr client)
return LookupRequestName(client->majorOp, client->minorOp);
}
-
/* SecurityDeleteAuthorization
*
* Arguments:
@@ -167,11 +167,9 @@ SecurityLookupRequestName(ClientPtr client)
*/
static int
-SecurityDeleteAuthorization(
- pointer value,
- XID id)
+SecurityDeleteAuthorization(pointer value, XID id)
{
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
+ SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
unsigned short name_len, data_len;
const char *name;
char *data;
@@ -181,74 +179,67 @@ SecurityDeleteAuthorization(
/* Remove the auth using the os layer auth manager */
- status = AuthorizationFromID(pAuth->id, &name_len, &name,
- &data_len, &data);
+ status = AuthorizationFromID(pAuth->id, &name_len, &name, &data_len, &data);
assert(status);
status = RemoveAuthorization(name_len, name, data_len, data);
assert(status);
- (void)status;
+ (void) status;
/* free the auth timer if there is one */
- if (pAuth->timer) TimerFree(pAuth->timer);
+ if (pAuth->timer)
+ TimerFree(pAuth->timer);
/* send revoke events */
- while ((pEventClient = pAuth->eventClients))
- {
- /* send revocation event event */
- xSecurityAuthorizationRevokedEvent are;
- are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
- are.authId = pAuth->id;
- WriteEventsToClient(rClient(pEventClient), 1, (xEvent *)&are);
- FreeResource(pEventClient->resource, RT_NONE);
+ while ((pEventClient = pAuth->eventClients)) {
+ /* send revocation event event */
+ xSecurityAuthorizationRevokedEvent are;
+
+ are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
+ are.authId = pAuth->id;
+ WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
+ FreeResource(pEventClient->resource, RT_NONE);
}
/* kill all clients using this auth */
- for (i = 1; i<currentMaxClients; i++)
- if (clients[i]) {
- SecurityStateRec *state;
- state = dixLookupPrivate(&clients[i]->devPrivates, stateKey);
- if (state->haveState && state->authId == pAuth->id)
- CloseDownClient(clients[i]);
- }
+ for (i = 1; i < currentMaxClients; i++)
+ if (clients[i]) {
+ SecurityStateRec *state;
+
+ state = dixLookupPrivate(&clients[i]->devPrivates, stateKey);
+ if (state->haveState && state->authId == pAuth->id)
+ CloseDownClient(clients[i]);
+ }
SecurityAudit("revoked authorization ID %d\n", pAuth->id);
free(pAuth);
return Success;
-} /* SecurityDeleteAuthorization */
-
+} /* SecurityDeleteAuthorization */
/* resource delete function for RTEventClient */
static int
-SecurityDeleteAuthorizationEventClient(
- pointer value,
- XID id)
+SecurityDeleteAuthorizationEventClient(pointer value, XID id)
{
OtherClientsPtr pEventClient, prev = NULL;
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
+ SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
for (pEventClient = pAuth->eventClients;
- pEventClient;
- pEventClient = pEventClient->next)
- {
- if (pEventClient->resource == id)
- {
- if (prev)
- prev->next = pEventClient->next;
- else
- pAuth->eventClients = pEventClient->next;
- free(pEventClient);
- return Success;
- }
- prev = pEventClient;
+ pEventClient; pEventClient = pEventClient->next) {
+ if (pEventClient->resource == id) {
+ if (prev)
+ prev->next = pEventClient->next;
+ else
+ pAuth->eventClients = pEventClient->next;
+ free(pEventClient);
+ return Success;
+ }
+ prev = pEventClient;
}
- /*NOTREACHED*/
- return -1; /* make compiler happy */
-} /* SecurityDeleteAuthorizationEventClient */
-
+ /*NOTREACHED*/ return -1; /* make compiler happy */
+} /* SecurityDeleteAuthorizationEventClient */
/* SecurityComputeAuthorizationTimeout
*
@@ -265,26 +256,23 @@ SecurityDeleteAuthorizationEventClient(
*/
static CARD32
-SecurityComputeAuthorizationTimeout(
- SecurityAuthorizationPtr pAuth,
- unsigned int seconds)
+SecurityComputeAuthorizationTimeout(SecurityAuthorizationPtr pAuth,
+ unsigned int seconds)
{
/* maxSecs is the number of full seconds that can be expressed in
* 32 bits worth of milliseconds
*/
- CARD32 maxSecs = (CARD32)(~0) / (CARD32)MILLI_PER_SECOND;
+ CARD32 maxSecs = (CARD32) (~0) / (CARD32) MILLI_PER_SECOND;
- if (seconds > maxSecs)
- { /* only come here if we want to wait more than 49 days */
- pAuth->secondsRemaining = seconds - maxSecs;
- return maxSecs * MILLI_PER_SECOND;
+ if (seconds > maxSecs) { /* only come here if we want to wait more than 49 days */
+ pAuth->secondsRemaining = seconds - maxSecs;
+ return maxSecs * MILLI_PER_SECOND;
}
- else
- { /* by far the common case */
- pAuth->secondsRemaining = 0;
- return seconds * MILLI_PER_SECOND;
+ else { /* by far the common case */
+ pAuth->secondsRemaining = 0;
+ return seconds * MILLI_PER_SECOND;
}
-} /* SecurityStartAuthorizationTimer */
+} /* SecurityStartAuthorizationTimer */
/* SecurityAuthorizationExpired
*
@@ -306,26 +294,21 @@ SecurityComputeAuthorizationTimeout(
*/
static CARD32
-SecurityAuthorizationExpired(
- OsTimerPtr timer,
- CARD32 time,
- pointer pval)
+SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, pointer pval)
{
- SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)pval;
+ SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) pval;
assert(pAuth->timer == timer);
- if (pAuth->secondsRemaining)
- {
- return SecurityComputeAuthorizationTimeout(pAuth,
- pAuth->secondsRemaining);
+ if (pAuth->secondsRemaining) {
+ return SecurityComputeAuthorizationTimeout(pAuth,
+ pAuth->secondsRemaining);
}
- else
- {
- FreeResource(pAuth->id, RT_NONE);
- return 0;
+ else {
+ FreeResource(pAuth->id, RT_NONE);
+ return 0;
}
-} /* SecurityAuthorizationExpired */
+} /* SecurityAuthorizationExpired */
/* SecurityStartAuthorizationTimer
*
@@ -341,104 +324,91 @@ SecurityAuthorizationExpired(
*/
static void
-SecurityStartAuthorizationTimer(
- SecurityAuthorizationPtr pAuth)
+SecurityStartAuthorizationTimer(SecurityAuthorizationPtr pAuth)
{
pAuth->timer = TimerSet(pAuth->timer, 0,
- SecurityComputeAuthorizationTimeout(pAuth, pAuth->timeout),
- SecurityAuthorizationExpired, pAuth);
-} /* SecurityStartAuthorizationTimer */
-
+ SecurityComputeAuthorizationTimeout(pAuth,
+ pAuth->timeout),
+ SecurityAuthorizationExpired, pAuth);
+} /* SecurityStartAuthorizationTimer */
/* Proc functions all take a client argument, execute the request in
* client->requestBuffer, and return a protocol error status.
*/
static int
-ProcSecurityQueryVersion(
- ClientPtr client)
+ProcSecurityQueryVersion(ClientPtr client)
{
/* REQUEST(xSecurityQueryVersionReq); */
- xSecurityQueryVersionReply rep;
+ xSecurityQueryVersionReply rep;
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
- rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
- if(client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
+ rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- (void)WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
- (char *)&rep);
+ (void) WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
+ (char *) &rep);
return Success;
-} /* ProcSecurityQueryVersion */
-
+} /* ProcSecurityQueryVersion */
static int
-SecurityEventSelectForAuthorization(
- SecurityAuthorizationPtr pAuth,
- ClientPtr client,
- Mask mask)
+SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
+ ClientPtr client, Mask mask)
{
OtherClients *pEventClient;
for (pEventClient = pAuth->eventClients;
- pEventClient;
- pEventClient = pEventClient->next)
- {
- if (SameClient(pEventClient, client))
- {
- if (mask == 0)
- FreeResource(pEventClient->resource, RT_NONE);
- else
- pEventClient->mask = mask;
- return Success;
- }
+ pEventClient; pEventClient = pEventClient->next) {
+ if (SameClient(pEventClient, client)) {
+ if (mask == 0)
+ FreeResource(pEventClient->resource, RT_NONE);
+ else
+ pEventClient->mask = mask;
+ return Success;
+ }
}
-
+
pEventClient = malloc(sizeof(OtherClients));
if (!pEventClient)
- return BadAlloc;
+ return BadAlloc;
pEventClient->mask = mask;
pEventClient->resource = FakeClientID(client->index);
pEventClient->next = pAuth->eventClients;
- if (!AddResource(pEventClient->resource, RTEventClient,
- (pointer)pAuth))
- {
- free(pEventClient);
- return BadAlloc;
+ if (!AddResource(pEventClient->resource, RTEventClient, (pointer) pAuth)) {
+ free(pEventClient);
+ return BadAlloc;
}
pAuth->eventClients = pEventClient;
return Success;
-} /* SecurityEventSelectForAuthorization */
-
+} /* SecurityEventSelectForAuthorization */
static int
-ProcSecurityGenerateAuthorization(
- ClientPtr client)
+ProcSecurityGenerateAuthorization(ClientPtr client)
{
REQUEST(xSecurityGenerateAuthorizationReq);
- int len; /* request length in CARD32s*/
- Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
- SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
- int err; /* error to return from this function */
- XID authId; /* authorization ID assigned by os layer */
- xSecurityGenerateAuthorizationReply rep; /* reply struct */
+ int len; /* request length in CARD32s */
+ Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
+ SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
+ int err; /* error to return from this function */
+ XID authId; /* authorization ID assigned by os layer */
+ xSecurityGenerateAuthorizationReply rep; /* reply struct */
unsigned int trustLevel; /* trust level of new auth */
- XID group; /* group of new auth */
- CARD32 timeout; /* timeout of new auth */
- CARD32 *values; /* list of supplied attributes */
- char *protoname; /* auth proto name sent in request */
- char *protodata; /* auth proto data sent in request */
+ XID group; /* group of new auth */
+ CARD32 timeout; /* timeout of new auth */
+ CARD32 *values; /* list of supplied attributes */
+ char *protoname; /* auth proto name sent in request */
+ char *protodata; /* auth proto data sent in request */
unsigned int authdata_len; /* # bytes of generated auth data */
- char *pAuthdata; /* generated auth data */
- Mask eventMask; /* what events on this auth does client want */
+ char *pAuthdata; /* generated auth data */
+ Mask eventMask; /* what events on this auth does client want */
/* check request length */
@@ -446,84 +416,75 @@ ProcSecurityGenerateAuthorization(
len = bytes_to_int32(SIZEOF(xSecurityGenerateAuthorizationReq));
len += bytes_to_int32(stuff->nbytesAuthProto);
len += bytes_to_int32(stuff->nbytesAuthData);
- values = ((CARD32 *)stuff) + len;
+ values = ((CARD32 *) stuff) + len;
len += Ones(stuff->valueMask);
if (client->req_len != len)
- return BadLength;
+ return BadLength;
/* check valuemask */
- if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes)
- {
- client->errorValue = stuff->valueMask;
- return BadValue;
+ if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes) {
+ client->errorValue = stuff->valueMask;
+ return BadValue;
}
/* check timeout */
timeout = 60;
- if (stuff->valueMask & XSecurityTimeout)
- {
- timeout = *values++;
+ if (stuff->valueMask & XSecurityTimeout) {
+ timeout = *values++;
}
/* check trustLevel */
trustLevel = XSecurityClientUntrusted;
- if (stuff->valueMask & XSecurityTrustLevel)
- {
- trustLevel = *values++;
- if (trustLevel != XSecurityClientTrusted &&
- trustLevel != XSecurityClientUntrusted)
- {
- client->errorValue = trustLevel;
- return BadValue;
- }
+ if (stuff->valueMask & XSecurityTrustLevel) {
+ trustLevel = *values++;
+ if (trustLevel != XSecurityClientTrusted &&
+ trustLevel != XSecurityClientUntrusted) {
+ client->errorValue = trustLevel;
+ return BadValue;
+ }
}
/* check group */
group = None;
- if (stuff->valueMask & XSecurityGroup)
- {
- group = *values++;
- if (SecurityValidateGroupCallback)
- {
- SecurityValidateGroupInfoRec vgi;
- vgi.group = group;
- vgi.valid = FALSE;
- CallCallbacks(&SecurityValidateGroupCallback, (pointer)&vgi);
-
- /* if nobody said they recognized it, it's an error */
-
- if (!vgi.valid)
- {
- client->errorValue = group;
- return BadValue;
- }
- }
+ if (stuff->valueMask & XSecurityGroup) {
+ group = *values++;
+ if (SecurityValidateGroupCallback) {
+ SecurityValidateGroupInfoRec vgi;
+
+ vgi.group = group;
+ vgi.valid = FALSE;
+ CallCallbacks(&SecurityValidateGroupCallback, (pointer) &vgi);
+
+ /* if nobody said they recognized it, it's an error */
+
+ if (!vgi.valid) {
+ client->errorValue = group;
+ return BadValue;
+ }
+ }
}
/* check event mask */
eventMask = 0;
- if (stuff->valueMask & XSecurityEventMask)
- {
- eventMask = *values++;
- if (eventMask & ~XSecurityAllEventMasks)
- {
- client->errorValue = eventMask;
- return BadValue;
- }
+ if (stuff->valueMask & XSecurityEventMask) {
+ eventMask = *values++;
+ if (eventMask & ~XSecurityAllEventMasks) {
+ client->errorValue = eventMask;
+ return BadValue;
+ }
}
- protoname = (char *)&stuff[1];
+ protoname = (char *) &stuff[1];
protodata = protoname + bytes_to_int32(stuff->nbytesAuthProto);
/* call os layer to generate the authorization */
authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname,
- stuff->nbytesAuthData, protodata,
- &authdata_len, &pAuthdata);
- if ((XID) ~0L == authId)
- {
- err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
- goto bailout;
+ stuff->nbytesAuthData, protodata,
+ &authdata_len, &pAuthdata);
+ if ((XID) ~0L == authId) {
+ err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
+ goto bailout;
}
/* now that we've added the auth, remember to remove it if we have to
@@ -534,10 +495,9 @@ ProcSecurityGenerateAuthorization(
/* associate additional information with this auth ID */
pAuth = malloc(sizeof(SecurityAuthorizationRec));
- if (!pAuth)
- {
- err = BadAlloc;
- goto bailout;
+ if (!pAuth) {
+ err = BadAlloc;
+ goto bailout;
}
/* fill in the auth fields */
@@ -546,29 +506,27 @@ ProcSecurityGenerateAuthorization(
pAuth->timeout = timeout;
pAuth->group = group;
pAuth->trustLevel = trustLevel;
- pAuth->refcnt = 0; /* the auth was just created; nobody's using it yet */
+ pAuth->refcnt = 0; /* the auth was just created; nobody's using it yet */
pAuth->secondsRemaining = 0;
pAuth->timer = NULL;
pAuth->eventClients = NULL;
/* handle event selection */
- if (eventMask)
- {
- err = SecurityEventSelectForAuthorization(pAuth, client, eventMask);
- if (err != Success)
- goto bailout;
+ if (eventMask) {
+ err = SecurityEventSelectForAuthorization(pAuth, client, eventMask);
+ if (err != Success)
+ goto bailout;
}
- if (!AddResource(authId, SecurityAuthorizationResType, pAuth))
- {
- err = BadAlloc;
- goto bailout;
+ if (!AddResource(authId, SecurityAuthorizationResType, pAuth)) {
+ err = BadAlloc;
+ goto bailout;
}
/* start the timer ticking */
if (pAuth->timeout != 0)
- SecurityStartAuthorizationTimer(pAuth);
+ SecurityStartAuthorizationTimer(pAuth);
/* tell client the auth id and data */
@@ -578,37 +536,36 @@ ProcSecurityGenerateAuthorization(
rep.authId = authId;
rep.dataLength = authdata_len;
- if (client->swapped)
- {
- swapl(&rep.length);
- swaps(&rep.sequenceNumber);
- swapl(&rep.authId);
- swaps(&rep.dataLength);
+ if (client->swapped) {
+ swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.authId);
+ swaps(&rep.dataLength);
}
WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply),
- (char *)&rep);
+ (char *) &rep);
WriteToClient(client, authdata_len, pAuthdata);
- SecurityAudit("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
- client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
- pAuth->group, eventMask);
+ SecurityAudit
+ ("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
+ client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
+ pAuth->group, eventMask);
/* the request succeeded; don't call RemoveAuthorization or free pAuth */
return Success;
-bailout:
+ bailout:
if (removeAuth)
- RemoveAuthorization(stuff->nbytesAuthProto, protoname,
- authdata_len, pAuthdata);
+ RemoveAuthorization(stuff->nbytesAuthProto, protoname,
+ authdata_len, pAuthdata);
free(pAuth);
return err;
-} /* ProcSecurityGenerateAuthorization */
+} /* ProcSecurityGenerateAuthorization */
static int
-ProcSecurityRevokeAuthorization(
- ClientPtr client)
+ProcSecurityRevokeAuthorization(ClientPtr client)
{
REQUEST(xSecurityRevokeAuthorizationReq);
SecurityAuthorizationPtr pAuth;
@@ -616,39 +573,35 @@ ProcSecurityRevokeAuthorization(
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
- rc = dixLookupResourceByType((pointer *)&pAuth, stuff->authId,
- SecurityAuthorizationResType, client,
- DixDestroyAccess);
+ rc = dixLookupResourceByType((pointer *) &pAuth, stuff->authId,
+ SecurityAuthorizationResType, client,
+ DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
FreeResource(stuff->authId, RT_NONE);
return Success;
-} /* ProcSecurityRevokeAuthorization */
-
+} /* ProcSecurityRevokeAuthorization */
static int
-ProcSecurityDispatch(
- ClientPtr client)
+ProcSecurityDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
- case X_SecurityQueryVersion:
- return ProcSecurityQueryVersion(client);
- case X_SecurityGenerateAuthorization:
- return ProcSecurityGenerateAuthorization(client);
- case X_SecurityRevokeAuthorization:
- return ProcSecurityRevokeAuthorization(client);
- default:
- return BadRequest;
+ switch (stuff->data) {
+ case X_SecurityQueryVersion:
+ return ProcSecurityQueryVersion(client);
+ case X_SecurityGenerateAuthorization:
+ return ProcSecurityGenerateAuthorization(client);
+ case X_SecurityRevokeAuthorization:
+ return ProcSecurityRevokeAuthorization(client);
+ default:
+ return BadRequest;
}
-} /* ProcSecurityDispatch */
+} /* ProcSecurityDispatch */
static int
-SProcSecurityQueryVersion(
- ClientPtr client)
+SProcSecurityQueryVersion(ClientPtr client)
{
REQUEST(xSecurityQueryVersionReq);
@@ -657,12 +610,10 @@ SProcSecurityQueryVersion(
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcSecurityQueryVersion(client);
-} /* SProcSecurityQueryVersion */
-
+} /* SProcSecurityQueryVersion */
static int
-SProcSecurityGenerateAuthorization(
- ClientPtr client)
+SProcSecurityGenerateAuthorization(ClientPtr client)
{
REQUEST(xSecurityGenerateAuthorizationReq);
CARD32 *values;
@@ -675,20 +626,18 @@ SProcSecurityGenerateAuthorization(
swaps(&stuff->nbytesAuthData);
swapl(&stuff->valueMask);
values_offset = bytes_to_int32(stuff->nbytesAuthProto) +
- bytes_to_int32(stuff->nbytesAuthData);
- if (values_offset >
- stuff->length - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
- return BadLength;
- values = (CARD32 *)(&stuff[1]) + values_offset;
- nvalues = (((CARD32 *)stuff) + stuff->length) - values;
+ bytes_to_int32(stuff->nbytesAuthData);
+ if (values_offset >
+ stuff->length - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
+ return BadLength;
+ values = (CARD32 *) (&stuff[1]) + values_offset;
+ nvalues = (((CARD32 *) stuff) + stuff->length) - values;
SwapLongs(values, nvalues);
return ProcSecurityGenerateAuthorization(client);
-} /* SProcSecurityGenerateAuthorization */
-
+} /* SProcSecurityGenerateAuthorization */
static int
-SProcSecurityRevokeAuthorization(
- ClientPtr client)
+SProcSecurityRevokeAuthorization(ClientPtr client)
{
REQUEST(xSecurityRevokeAuthorizationReq);
@@ -696,32 +645,28 @@ SProcSecurityRevokeAuthorization(
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
swapl(&stuff->authId);
return ProcSecurityRevokeAuthorization(client);
-} /* SProcSecurityRevokeAuthorization */
-
+} /* SProcSecurityRevokeAuthorization */
static int
-SProcSecurityDispatch(
- ClientPtr client)
+SProcSecurityDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
- case X_SecurityQueryVersion:
- return SProcSecurityQueryVersion(client);
- case X_SecurityGenerateAuthorization:
- return SProcSecurityGenerateAuthorization(client);
- case X_SecurityRevokeAuthorization:
- return SProcSecurityRevokeAuthorization(client);
- default:
- return BadRequest;
+ switch (stuff->data) {
+ case X_SecurityQueryVersion:
+ return SProcSecurityQueryVersion(client);
+ case X_SecurityGenerateAuthorization:
+ return SProcSecurityGenerateAuthorization(client);
+ case X_SecurityRevokeAuthorization:
+ return SProcSecurityRevokeAuthorization(client);
+ default:
+ return BadRequest;
}
-} /* SProcSecurityDispatch */
+} /* SProcSecurityDispatch */
-static void
-SwapSecurityAuthorizationRevokedEvent(
- xSecurityAuthorizationRevokedEvent *from,
- xSecurityAuthorizationRevokedEvent *to)
+static void
+SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from,
+ xSecurityAuthorizationRevokedEvent * to)
{
to->type = from->type;
to->detail = from->detail;
@@ -757,14 +702,14 @@ SecurityDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
obj = dixLookupPrivate(&serverClient->devPrivates, stateKey);
if (rec->dev != inputInfo.keyboard)
- /* this extension only supports the core keyboard */
- allowed = requested;
+ /* this extension only supports the core keyboard */
+ allowed = requested;
if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
- SecurityAudit("Security denied client %d keyboard access on request "
- "%s\n", rec->client->index,
- SecurityLookupRequestName(rec->client));
- rec->status = BadAccess;
+ SecurityAudit("Security denied client %d keyboard access on request "
+ "%s\n", rec->client->index,
+ SecurityLookupRequestName(rec->client));
+ rec->status = BadAccess;
}
}
@@ -802,42 +747,41 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
/* disable background None for untrusted windows */
if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW))
- if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
- ((WindowPtr)rec->res)->forcedBG = TRUE;
+ if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
+ ((WindowPtr) rec->res)->forcedBG = TRUE;
/* additional permissions for specific resource types */
if (rec->rtype == RT_WINDOW)
- allowed |= SecurityWindowExtraMask;
+ allowed |= SecurityWindowExtraMask;
/* special checks for server-owned resources */
if (cid == 0) {
- if (rec->rtype & RC_DRAWABLE)
- /* additional operations allowed on root windows */
- allowed |= SecurityRootWindowExtraMask;
+ if (rec->rtype & RC_DRAWABLE)
+ /* additional operations allowed on root windows */
+ allowed |= SecurityRootWindowExtraMask;
- else if (rec->rtype == RT_COLORMAP)
- /* allow access to default colormaps */
- allowed = requested;
+ else if (rec->rtype == RT_COLORMAP)
+ /* allow access to default colormaps */
+ allowed = requested;
- else
- /* allow read access to other server-owned resources */
- allowed |= DixReadAccess;
+ else
+ /* allow read access to other server-owned resources */
+ allowed |= DixReadAccess;
}
if (clients[cid] != NULL) {
- obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey);
- if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
- return;
+ obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey);
+ if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
+ return;
}
SecurityAudit("Security: denied client %d access %x to resource 0x%x "
- "of client %d on request %s\n", rec->client->index,
- requested, rec->id, cid,
- SecurityLookupRequestName(rec->client));
- rec->status = BadAccess; /* deny access */
+ "of client %d on request %s\n", rec->client->index,
+ requested, rec->id, cid,
+ SecurityLookupRequestName(rec->client));
+ rec->status = BadAccess; /* deny access */
}
-
static void
SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
@@ -848,16 +792,16 @@ SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
if (subj->haveState && subj->trustLevel == XSecurityClientTrusted)
- return;
+ return;
while (SecurityTrustedExtensions[i])
- if (!strcmp(SecurityTrustedExtensions[i++], rec->ext->name))
- return;
+ if (!strcmp(SecurityTrustedExtensions[i++], rec->ext->name))
+ return;
SecurityAudit("Security: denied client %d access to extension "
- "%s on request %s\n",
- rec->client->index, rec->ext->name,
- SecurityLookupRequestName(rec->client));
+ "%s on request %s\n",
+ rec->client->index, rec->ext->name,
+ SecurityLookupRequestName(rec->client));
rec->status = BadAccess;
}
@@ -871,12 +815,12 @@ SecurityServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
obj = dixLookupPrivate(&serverClient->devPrivates, stateKey);
-
+
if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
- SecurityAudit("Security: denied client %d access to server "
- "configuration request %s\n", rec->client->index,
- SecurityLookupRequestName(rec->client));
- rec->status = BadAccess;
+ SecurityAudit("Security: denied client %d access to server "
+ "configuration request %s\n", rec->client->index,
+ SecurityLookupRequestName(rec->client));
+ rec->status = BadAccess;
}
}
@@ -892,16 +836,16 @@ SecurityClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
obj = dixLookupPrivate(&rec->target->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
- SecurityAudit("Security: denied client %d access to client %d on "
- "request %s\n", rec->client->index, rec->target->index,
- SecurityLookupRequestName(rec->client));
- rec->status = BadAccess;
+ SecurityAudit("Security: denied client %d access to client %d on "
+ "request %s\n", rec->client->index, rec->target->index,
+ SecurityLookupRequestName(rec->client));
+ rec->status = BadAccess;
}
}
static void
SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
-{
+{
XacePropertyAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
ATOM name = (*rec->ppProp)->propertyName;
@@ -912,12 +856,12 @@ SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
- SecurityAudit("Security: denied client %d access to property %s "
- "(atom 0x%x) window 0x%x of client %d on request %s\n",
- rec->client->index, NameForAtom(name), name,
- rec->pWin->drawable.id, wClient(rec->pWin)->index,
- SecurityLookupRequestName(rec->client));
- rec->status = BadAccess;
+ SecurityAudit("Security: denied client %d access to property %s "
+ "(atom 0x%x) window 0x%x of client %d on request %s\n",
+ rec->client->index, NameForAtom(name), name,
+ rec->pWin->drawable.id, wClient(rec->pWin)->index,
+ SecurityLookupRequestName(rec->client));
+ rec->status = BadAccess;
}
}
@@ -928,28 +872,28 @@ SecuritySend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
SecurityStateRec *subj, *obj;
if (rec->client) {
- int i;
-
- subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
- obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
-
- if (SecurityDoCheck(subj, obj, DixSendAccess, 0) == Success)
- return;
-
- for (i = 0; i < rec->count; i++)
- if (rec->events[i].u.u.type != UnmapNotify &&
- rec->events[i].u.u.type != ConfigureRequest &&
- rec->events[i].u.u.type != ClientMessage) {
-
- SecurityAudit("Security: denied client %d from sending event "
- "of type %s to window 0x%x of client %d\n",
- rec->client->index,
- LookupEventName(rec->events[i].u.u.type),
- rec->pWin->drawable.id,
- wClient(rec->pWin)->index);
- rec->status = BadAccess;
- return;
- }
+ int i;
+
+ subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
+ obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
+
+ if (SecurityDoCheck(subj, obj, DixSendAccess, 0) == Success)
+ return;
+
+ for (i = 0; i < rec->count; i++)
+ if (rec->events[i].u.u.type != UnmapNotify &&
+ rec->events[i].u.u.type != ConfigureRequest &&
+ rec->events[i].u.u.type != ClientMessage) {
+
+ SecurityAudit("Security: denied client %d from sending event "
+ "of type %s to window 0x%x of client %d\n",
+ rec->client->index,
+ LookupEventName(rec->events[i].u.u.type),
+ rec->pWin->drawable.id,
+ wClient(rec->pWin)->index);
+ rec->status = BadAccess;
+ return;
+ }
}
}
@@ -963,12 +907,12 @@ SecurityReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, DixReceiveAccess, 0) == Success)
- return;
+ return;
SecurityAudit("Security: denied client %d from receiving an event "
- "sent to window 0x%x of client %d\n",
- rec->client->index, rec->pWin->drawable.id,
- wClient(rec->pWin)->index);
+ "sent to window 0x%x of client %d\n",
+ rec->client->index, rec->pWin->drawable.id,
+ wClient(rec->pWin)->index);
rec->status = BadAccess;
}
@@ -1006,41 +950,41 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
switch (pci->client->clientState) {
case ClientStateInitial:
- state->trustLevel = XSecurityClientTrusted;
- state->authId = None;
- state->haveState = TRUE;
- break;
+ state->trustLevel = XSecurityClientTrusted;
+ state->authId = None;
+ state->haveState = TRUE;
+ break;
case ClientStateRunning:
- state->authId = AuthorizationIDOfClient(pci->client);
- rc = dixLookupResourceByType((pointer *)&pAuth, state->authId,
- SecurityAuthorizationResType, serverClient,
- DixGetAttrAccess);
- if (rc == Success) {
- /* it is a generated authorization */
- pAuth->refcnt++;
- if (pAuth->refcnt == 1 && pAuth->timer)
- TimerCancel(pAuth->timer);
-
- state->trustLevel = pAuth->trustLevel;
- }
- break;
+ state->authId = AuthorizationIDOfClient(pci->client);
+ rc = dixLookupResourceByType((pointer *) &pAuth, state->authId,
+ SecurityAuthorizationResType, serverClient,
+ DixGetAttrAccess);
+ if (rc == Success) {
+ /* it is a generated authorization */
+ pAuth->refcnt++;
+ if (pAuth->refcnt == 1 && pAuth->timer)
+ TimerCancel(pAuth->timer);
+
+ state->trustLevel = pAuth->trustLevel;
+ }
+ break;
case ClientStateGone:
case ClientStateRetained:
- rc = dixLookupResourceByType((pointer *)&pAuth, state->authId,
- SecurityAuthorizationResType, serverClient,
- DixGetAttrAccess);
- if (rc == Success) {
- /* it is a generated authorization */
- pAuth->refcnt--;
- if (pAuth->refcnt == 0)
- SecurityStartAuthorizationTimer(pAuth);
- }
- break;
+ rc = dixLookupResourceByType((pointer *) &pAuth, state->authId,
+ SecurityAuthorizationResType, serverClient,
+ DixGetAttrAccess);
+ if (rc == Success) {
+ /* it is a generated authorization */
+ pAuth->refcnt--;
+ if (pAuth->refcnt == 0)
+ SecurityStartAuthorizationTimer(pAuth);
+ }
+ break;
default:
- break;
+ break;
}
}
@@ -1056,8 +1000,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
*/
static void
-SecurityResetProc(
- ExtensionEntry *extEntry)
+SecurityResetProc(ExtensionEntry * extEntry)
{
/* Unregister callbacks */
DeleteCallback(&ClientStateCallback, SecurityClientState, NULL);
@@ -1073,7 +1016,6 @@ SecurityResetProc(
XaceDeleteCallback(XACE_SERVER_ACCESS, SecurityServer, NULL);
}
-
/* SecurityExtensionInit
*
* Arguments: none.
@@ -1087,25 +1029,26 @@ SecurityResetProc(
void
SecurityExtensionInit(INITARGS)
{
- ExtensionEntry *extEntry;
+ ExtensionEntry *extEntry;
int ret = TRUE;
SecurityAuthorizationResType =
- CreateNewResourceType(SecurityDeleteAuthorization,
- "SecurityAuthorization");
+ CreateNewResourceType(SecurityDeleteAuthorization,
+ "SecurityAuthorization");
RTEventClient =
- CreateNewResourceType(SecurityDeleteAuthorizationEventClient,
- "SecurityEventClient");
+ CreateNewResourceType(SecurityDeleteAuthorizationEventClient,
+ "SecurityEventClient");
if (!SecurityAuthorizationResType || !RTEventClient)
- return;
+ return;
RTEventClient |= RC_NEVERRETAIN;
/* Allocate the private storage */
- if (!dixRegisterPrivateKey(stateKey, PRIVATE_CLIENT, sizeof(SecurityStateRec)))
- FatalError("SecurityExtensionSetup: Can't allocate client private.\n");
+ if (!dixRegisterPrivateKey
+ (stateKey, PRIVATE_CLIENT, sizeof(SecurityStateRec)))
+ FatalError("SecurityExtensionSetup: Can't allocate client private.\n");
/* Register callbacks */
ret &= AddCallback(&ClientStateCallback, SecurityClientState, NULL);
@@ -1121,21 +1064,22 @@ SecurityExtensionInit(INITARGS)
ret &= XaceRegisterCallback(XACE_SERVER_ACCESS, SecurityServer, NULL);
if (!ret)
- FatalError("SecurityExtensionSetup: Failed to register callbacks\n");
+ FatalError("SecurityExtensionSetup: Failed to register callbacks\n");
/* Add extension to server */
extEntry = AddExtension(SECURITY_EXTENSION_NAME,
- XSecurityNumberEvents, XSecurityNumberErrors,
- ProcSecurityDispatch, SProcSecurityDispatch,
+ XSecurityNumberEvents, XSecurityNumberErrors,
+ ProcSecurityDispatch, SProcSecurityDispatch,
SecurityResetProc, StandardMinorOpcode);
SecurityErrorBase = extEntry->errorBase;
SecurityEventBase = extEntry->eventBase;
EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
- (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;
+ (EventSwapPtr) SwapSecurityAuthorizationRevokedEvent;
- SetResourceTypeErrorValue(SecurityAuthorizationResType, SecurityErrorBase + XSecurityBadAuthorization);
+ SetResourceTypeErrorValue(SecurityAuthorizationResType,
+ SecurityErrorBase + XSecurityBadAuthorization);
/* Label objects that were created before we could register ourself */
SecurityLabelInitial();
diff --git a/xorg-server/Xext/shape.c b/xorg-server/Xext/shape.c
index 3263c0224..d3859a51d 100644
--- a/xorg-server/Xext/shape.c
+++ b/xorg-server/Xext/shape.c
@@ -49,35 +49,30 @@ in this Software without prior written authorization from The Open Group.
#include "modinit.h"
#include "protocol-versions.h"
-typedef RegionPtr (*CreateDftPtr)(
- WindowPtr /* pWin */
- );
-
-static int ShapeFreeClient(
- pointer /* data */,
- XID /* id */
- );
-static int ShapeFreeEvents(
- pointer /* data */,
- XID /* id */
- );
-static void SShapeNotifyEvent(
- xShapeNotifyEvent * /* from */,
- xShapeNotifyEvent * /* to */
- );
+typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
+ );
+
+static int ShapeFreeClient(pointer /* data */ ,
+ XID /* id */
+ );
+static int ShapeFreeEvents(pointer /* data */ ,
+ XID /* id */
+ );
+static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
+ xShapeNotifyEvent * /* to */
+ );
/* SendShapeNotify, CreateBoundingShape and CreateClipShape are used
* externally by the Xfixes extension and are now defined in window.h
*/
-
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
static int ShapeEventBase = 0;
-static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
+static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
/*
* each window has a list of clients requesting
@@ -90,10 +85,10 @@ static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
typedef struct _ShapeEvent *ShapeEventPtr;
typedef struct _ShapeEvent {
- ShapeEventPtr next;
- ClientPtr client;
- WindowPtr window;
- XID clientResource;
+ ShapeEventPtr next;
+ ClientPtr client;
+ WindowPtr window;
+ XID clientResource;
} ShapeEventRec;
/****************
@@ -105,23 +100,18 @@ typedef struct _ShapeEvent {
****************/
static int
-RegionOperate (
- ClientPtr client,
- WindowPtr pWin,
- int kind,
- RegionPtr *destRgnp,
- RegionPtr srcRgn,
- int op,
- int xoff, int yoff,
- CreateDftPtr create)
+RegionOperate(ClientPtr client,
+ WindowPtr pWin,
+ int kind,
+ RegionPtr *destRgnp,
+ RegionPtr srcRgn, int op, int xoff, int yoff, CreateDftPtr create)
{
if (srcRgn && (xoff || yoff))
- RegionTranslate(srcRgn, xoff, yoff);
- if (!pWin->parent)
- {
- if (srcRgn)
- RegionDestroy(srcRgn);
- return Success;
+ RegionTranslate(srcRgn, xoff, yoff);
+ if (!pWin->parent) {
+ if (srcRgn)
+ RegionDestroy(srcRgn);
+ return Success;
}
/* May/30/2001:
@@ -130,80 +120,81 @@ RegionOperate (
* see shape.PS, page 3, ShapeMask.
*/
if (srcRgn == NULL) {
- if (*destRgnp != NULL) {
- RegionDestroy(*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)
- RegionDestroy(*destRgnp);
- *destRgnp = srcRgn;
- srcRgn = 0;
- break;
- case ShapeUnion:
- if (*destRgnp)
- RegionUnion(*destRgnp, *destRgnp, srcRgn);
- break;
- case ShapeIntersect:
- if (*destRgnp)
- RegionIntersect(*destRgnp, *destRgnp, srcRgn);
- else {
- *destRgnp = srcRgn;
- srcRgn = 0;
- }
- break;
- case ShapeSubtract:
- if (!*destRgnp)
- *destRgnp = (*create)(pWin);
- RegionSubtract(*destRgnp, *destRgnp, srcRgn);
- break;
- case ShapeInvert:
- if (!*destRgnp)
- *destRgnp = RegionCreate((BoxPtr) 0, 0);
- else
- RegionSubtract(*destRgnp, srcRgn, *destRgnp);
- break;
- default:
- client->errorValue = op;
- return BadValue;
+ if (*destRgnp != NULL) {
+ RegionDestroy(*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)
+ RegionDestroy(*destRgnp);
+ *destRgnp = srcRgn;
+ srcRgn = 0;
+ break;
+ case ShapeUnion:
+ if (*destRgnp)
+ RegionUnion(*destRgnp, *destRgnp, srcRgn);
+ break;
+ case ShapeIntersect:
+ if (*destRgnp)
+ RegionIntersect(*destRgnp, *destRgnp, srcRgn);
+ else {
+ *destRgnp = srcRgn;
+ srcRgn = 0;
+ }
+ break;
+ case ShapeSubtract:
+ if (!*destRgnp)
+ *destRgnp = (*create) (pWin);
+ RegionSubtract(*destRgnp, *destRgnp, srcRgn);
+ break;
+ case ShapeInvert:
+ if (!*destRgnp)
+ *destRgnp = RegionCreate((BoxPtr) 0, 0);
+ else
+ RegionSubtract(*destRgnp, srcRgn, *destRgnp);
+ break;
+ default:
+ client->errorValue = op;
+ return BadValue;
+ }
if (srcRgn)
- RegionDestroy(srcRgn);
+ RegionDestroy(srcRgn);
(*pWin->drawable.pScreen->SetShape) (pWin, kind);
- SendShapeNotify (pWin, kind);
+ SendShapeNotify(pWin, kind);
return Success;
}
RegionPtr
-CreateBoundingShape (WindowPtr pWin)
+CreateBoundingShape(WindowPtr pWin)
{
- BoxRec extents;
+ BoxRec extents;
- extents.x1 = -wBorderWidth (pWin);
- extents.y1 = -wBorderWidth (pWin);
- extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
- extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
+ extents.x1 = -wBorderWidth(pWin);
+ extents.y1 = -wBorderWidth(pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth(pWin);
return RegionCreate(&extents, 1);
}
RegionPtr
-CreateClipShape (WindowPtr pWin)
+CreateClipShape(WindowPtr pWin)
{
- BoxRec extents;
+ BoxRec extents;
extents.x1 = 0;
extents.y1 = 0;
@@ -213,10 +204,11 @@ CreateClipShape (WindowPtr pWin)
}
static int
-ProcShapeQueryVersion (ClientPtr client)
+ProcShapeQueryVersion(ClientPtr client)
{
- xShapeQueryVersionReply rep;
- REQUEST_SIZE_MATCH (xShapeQueryVersionReq);
+ xShapeQueryVersionReply rep;
+
+ REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
memset(&rep, 0, sizeof(xShapeQueryVersionReply));
rep.type = X_Reply;
rep.length = 0;
@@ -224,12 +216,12 @@ ProcShapeQueryVersion (ClientPtr client)
rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;
rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof (xShapeQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xShapeQueryVersionReply), (char *) &rep);
return Success;
}
@@ -239,325 +231,324 @@ ProcShapeQueryVersion (ClientPtr client)
*****************/
static int
-ProcShapeRectangles (ClientPtr client)
+ProcShapeRectangles(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xShapeRectanglesReq);
- xRectangle *prects;
- int nrects, ctype, rc;
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- CreateDftPtr createDefault;
+ xRectangle *prects;
+ int nrects, ctype, rc;
+ RegionPtr srcRgn;
+ RegionPtr *destRgn;
+ CreateDftPtr createDefault;
- REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
+ REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->destKind) {
case ShapeBounding:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
case ShapeClip:
- createDefault = CreateClipShape;
- break;
+ createDefault = CreateClipShape;
+ break;
case ShapeInput:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
- (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded))
- {
- client->errorValue = stuff->ordering;
+ (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) {
+ client->errorValue = stuff->ordering;
return BadValue;
}
- nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
+ nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
if (nrects & 4)
- return BadLength;
+ return BadLength;
nrects >>= 3;
prects = (xRectangle *) &stuff[1];
- ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering);
+ ctype = VerifyRectOrder(nrects, prects, (int) stuff->ordering);
if (ctype < 0)
- return BadMatch;
+ return BadMatch;
srcRgn = RegionFromRects(nrects, prects, ctype);
if (!pWin->optional)
- MakeWindowOptional (pWin);
+ MakeWindowOptional(pWin);
switch (stuff->destKind) {
case ShapeBounding:
- destRgn = &pWin->optional->boundingShape;
- break;
+ destRgn = &pWin->optional->boundingShape;
+ break;
case ShapeClip:
- destRgn = &pWin->optional->clipShape;
- break;
+ destRgn = &pWin->optional->clipShape;
+ break;
case ShapeInput:
- destRgn = &pWin->optional->inputShape;
- break;
+ destRgn = &pWin->optional->inputShape;
+ break;
default:
- return BadValue;
+ return BadValue;
}
- return RegionOperate (client, pWin, (int)stuff->destKind,
- destRgn, srcRgn, (int)stuff->op,
- stuff->xOff, stuff->yOff, createDefault);
+ return RegionOperate(client, pWin, (int) stuff->destKind,
+ destRgn, srcRgn, (int) stuff->op,
+ stuff->xOff, stuff->yOff, createDefault);
}
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeRectangles(
- ClientPtr client)
+ProcPanoramiXShapeRectangles(ClientPtr client)
{
REQUEST(xShapeRectanglesReq);
- PanoramiXRes *win;
- int j, result;
+ PanoramiXRes *win;
+ int j, result;
- REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
+ REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
- client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS(j) {
- stuff->dest = win->info[j].id;
- result = ProcShapeRectangles (client);
- if (result != Success) break;
+ stuff->dest = win->info[j].id;
+ result = ProcShapeRectangles(client);
+ if (result != Success)
+ break;
}
return result;
}
#endif
-
/**************
* ProcShapeMask
**************/
-
static int
-ProcShapeMask (ClientPtr client)
+ProcShapeMask(ClientPtr client)
{
- WindowPtr pWin;
- ScreenPtr pScreen;
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+
REQUEST(xShapeMaskReq);
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- PixmapPtr pPixmap;
- CreateDftPtr createDefault;
- int rc;
+ RegionPtr srcRgn;
+ RegionPtr *destRgn;
+ PixmapPtr pPixmap;
+ CreateDftPtr createDefault;
+ int rc;
- REQUEST_SIZE_MATCH (xShapeMaskReq);
+ REQUEST_SIZE_MATCH(xShapeMaskReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->destKind) {
case ShapeBounding:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
case ShapeClip:
- createDefault = CreateClipShape;
- break;
+ createDefault = CreateClipShape;
+ break;
case ShapeInput:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
pScreen = pWin->drawable.pScreen;
if (stuff->src == None)
- srcRgn = 0;
+ srcRgn = 0;
else {
- rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
- client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->src,
+ RT_PIXMAP, client, DixReadAccess);
if (rc != Success)
- return rc;
- if (pPixmap->drawable.pScreen != pScreen ||
- pPixmap->drawable.depth != 1)
- return BadMatch;
- srcRgn = BitmapToRegion(pScreen, pPixmap);
- if (!srcRgn)
- return BadAlloc;
+ return rc;
+ if (pPixmap->drawable.pScreen != pScreen ||
+ pPixmap->drawable.depth != 1)
+ return BadMatch;
+ srcRgn = BitmapToRegion(pScreen, pPixmap);
+ if (!srcRgn)
+ return BadAlloc;
}
if (!pWin->optional)
- MakeWindowOptional (pWin);
+ MakeWindowOptional(pWin);
switch (stuff->destKind) {
case ShapeBounding:
- destRgn = &pWin->optional->boundingShape;
- break;
+ destRgn = &pWin->optional->boundingShape;
+ break;
case ShapeClip:
- destRgn = &pWin->optional->clipShape;
- break;
+ destRgn = &pWin->optional->clipShape;
+ break;
case ShapeInput:
- destRgn = &pWin->optional->inputShape;
- break;
+ destRgn = &pWin->optional->inputShape;
+ break;
default:
- return BadValue;
+ return BadValue;
}
- return RegionOperate (client, pWin, (int)stuff->destKind,
- destRgn, srcRgn, (int)stuff->op,
- stuff->xOff, stuff->yOff, createDefault);
+ return RegionOperate(client, pWin, (int) stuff->destKind,
+ destRgn, srcRgn, (int) stuff->op,
+ stuff->xOff, stuff->yOff, createDefault);
}
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeMask(
- ClientPtr client)
+ProcPanoramiXShapeMask(ClientPtr client)
{
REQUEST(xShapeMaskReq);
- PanoramiXRes *win, *pmap;
- int j, result;
+ PanoramiXRes *win, *pmap;
+ int j, result;
- REQUEST_SIZE_MATCH (xShapeMaskReq);
+ REQUEST_SIZE_MATCH(xShapeMaskReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
- client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
- if(stuff->src != None) {
- result = dixLookupResourceByType((pointer *)&pmap, stuff->src,
- XRT_PIXMAP, client, DixReadAccess);
- if (result != Success)
- return result;
- } else
- pmap = NULL;
+ if (stuff->src != None) {
+ result = dixLookupResourceByType((pointer *) &pmap, stuff->src,
+ XRT_PIXMAP, client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
+ else
+ pmap = NULL;
FOR_NSCREENS(j) {
- stuff->dest = win->info[j].id;
- if(pmap)
- stuff->src = pmap->info[j].id;
- result = ProcShapeMask (client);
- if (result != Success) break;
+ stuff->dest = win->info[j].id;
+ if (pmap)
+ stuff->src = pmap->info[j].id;
+ result = ProcShapeMask(client);
+ if (result != Success)
+ break;
}
return result;
}
#endif
-
/************
* ProcShapeCombine
************/
static int
-ProcShapeCombine (ClientPtr client)
+ProcShapeCombine(ClientPtr client)
{
- WindowPtr pSrcWin, pDestWin;
+ WindowPtr pSrcWin, pDestWin;
+
REQUEST(xShapeCombineReq);
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- CreateDftPtr createDefault;
- CreateDftPtr createSrc;
- RegionPtr tmp;
- int rc;
-
- REQUEST_SIZE_MATCH (xShapeCombineReq);
+ RegionPtr srcRgn;
+ RegionPtr *destRgn;
+ CreateDftPtr createDefault;
+ CreateDftPtr createSrc;
+ RegionPtr tmp;
+ int rc;
+
+ REQUEST_SIZE_MATCH(xShapeCombineReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (!pDestWin->optional)
- MakeWindowOptional (pDestWin);
+ MakeWindowOptional(pDestWin);
switch (stuff->destKind) {
case ShapeBounding:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
case ShapeClip:
- createDefault = CreateClipShape;
- break;
+ createDefault = CreateClipShape;
+ break;
case ShapeInput:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->srcKind) {
case ShapeBounding:
- srcRgn = wBoundingShape (pSrcWin);
- createSrc = CreateBoundingShape;
- break;
+ srcRgn = wBoundingShape(pSrcWin);
+ createSrc = CreateBoundingShape;
+ break;
case ShapeClip:
- srcRgn = wClipShape (pSrcWin);
- createSrc = CreateClipShape;
- break;
+ srcRgn = wClipShape(pSrcWin);
+ createSrc = CreateClipShape;
+ break;
case ShapeInput:
- srcRgn = wInputShape (pSrcWin);
- createSrc = CreateBoundingShape;
- break;
+ srcRgn = wInputShape(pSrcWin);
+ createSrc = CreateBoundingShape;
+ break;
default:
- client->errorValue = stuff->srcKind;
- return BadValue;
+ client->errorValue = stuff->srcKind;
+ return BadValue;
}
- if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen)
- {
- return BadMatch;
+ if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen) {
+ return BadMatch;
}
if (srcRgn) {
tmp = RegionCreate((BoxPtr) 0, 0);
RegionCopy(tmp, srcRgn);
srcRgn = tmp;
- } else
- srcRgn = (*createSrc) (pSrcWin);
+ }
+ else
+ srcRgn = (*createSrc) (pSrcWin);
if (!pDestWin->optional)
- MakeWindowOptional (pDestWin);
+ MakeWindowOptional(pDestWin);
switch (stuff->destKind) {
case ShapeBounding:
- destRgn = &pDestWin->optional->boundingShape;
- break;
+ destRgn = &pDestWin->optional->boundingShape;
+ break;
case ShapeClip:
- destRgn = &pDestWin->optional->clipShape;
- break;
+ destRgn = &pDestWin->optional->clipShape;
+ break;
case ShapeInput:
- destRgn = &pDestWin->optional->inputShape;
- break;
+ destRgn = &pDestWin->optional->inputShape;
+ break;
default:
- return BadValue;
+ return BadValue;
}
- return RegionOperate (client, pDestWin, (int)stuff->destKind,
- destRgn, srcRgn, (int)stuff->op,
- stuff->xOff, stuff->yOff, createDefault);
+ return RegionOperate(client, pDestWin, (int) stuff->destKind,
+ destRgn, srcRgn, (int) stuff->op,
+ stuff->xOff, stuff->yOff, createDefault);
}
-
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeCombine(
- ClientPtr client)
+ProcPanoramiXShapeCombine(ClientPtr client)
{
REQUEST(xShapeCombineReq);
- PanoramiXRes *win, *win2;
- int j, result;
+ PanoramiXRes *win, *win2;
+ int j, result;
- REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
+ REQUEST_AT_LEAST_SIZE(xShapeCombineReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
- client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
- result = dixLookupResourceByType((pointer *)&win2, stuff->src, XRT_WINDOW,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &win2, stuff->src, XRT_WINDOW,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS(j) {
- stuff->dest = win->info[j].id;
- stuff->src = win2->info[j].id;
- result = ProcShapeCombine (client);
- if (result != Success) break;
+ stuff->dest = win->info[j].id;
+ stuff->src = win2->info[j].id;
+ result = ProcShapeCombine(client);
+ if (result != Success)
+ break;
}
return result;
}
@@ -568,82 +559,80 @@ ProcPanoramiXShapeCombine(
*************/
static int
-ProcShapeOffset (ClientPtr client)
+ProcShapeOffset(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xShapeOffsetReq);
- RegionPtr srcRgn;
- int rc;
+ RegionPtr srcRgn;
+ int rc;
- REQUEST_SIZE_MATCH (xShapeOffsetReq);
+ REQUEST_SIZE_MATCH(xShapeOffsetReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->destKind) {
case ShapeBounding:
- srcRgn = wBoundingShape (pWin);
- break;
+ srcRgn = wBoundingShape(pWin);
+ break;
case ShapeClip:
- srcRgn = wClipShape(pWin);
- break;
+ srcRgn = wClipShape(pWin);
+ break;
case ShapeInput:
- srcRgn = wInputShape (pWin);
- break;
+ srcRgn = wInputShape(pWin);
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
- if (srcRgn)
- {
+ if (srcRgn) {
RegionTranslate(srcRgn, stuff->xOff, stuff->yOff);
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
}
- SendShapeNotify (pWin, (int)stuff->destKind);
+ SendShapeNotify(pWin, (int) stuff->destKind);
return Success;
}
-
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeOffset(
- ClientPtr client)
+ProcPanoramiXShapeOffset(ClientPtr client)
{
REQUEST(xShapeOffsetReq);
PanoramiXRes *win;
int j, result;
- REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
-
- result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
- client, DixWriteAccess);
+ REQUEST_AT_LEAST_SIZE(xShapeOffsetReq);
+
+ result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS(j) {
- stuff->dest = win->info[j].id;
- result = ProcShapeOffset (client);
- if(result != Success) break;
+ stuff->dest = win->info[j].id;
+ result = ProcShapeOffset(client);
+ if (result != Success)
+ break;
}
return result;
}
#endif
-
static int
-ProcShapeQueryExtents (ClientPtr client)
+ProcShapeQueryExtents(ClientPtr client)
{
REQUEST(xShapeQueryExtentsReq);
- WindowPtr pWin;
- xShapeQueryExtentsReply rep;
- BoxRec extents, *pExtents;
- int rc;
- RegionPtr region;
+ WindowPtr pWin;
+ xShapeQueryExtentsReply rep;
+ BoxRec extents, *pExtents;
+ int rc;
+ RegionPtr region;
- REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
+ REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
memset(&rep, 0, sizeof(xShapeQueryExtentsReply));
rep.type = X_Reply;
rep.length = 0;
@@ -651,183 +640,180 @@ ProcShapeQueryExtents (ClientPtr client)
rep.boundingShaped = (wBoundingShape(pWin) != 0);
rep.clipShaped = (wClipShape(pWin) != 0);
if ((region = wBoundingShape(pWin))) {
- /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = RegionExtents(region);
- extents = *pExtents;
- } else {
- extents.x1 = -wBorderWidth (pWin);
- extents.y1 = -wBorderWidth (pWin);
- extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
- extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
+ /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
+ pExtents = RegionExtents(region);
+ extents = *pExtents;
+ }
+ else {
+ extents.x1 = -wBorderWidth(pWin);
+ extents.y1 = -wBorderWidth(pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth(pWin);
}
rep.xBoundingShape = extents.x1;
rep.yBoundingShape = extents.y1;
rep.widthBoundingShape = extents.x2 - extents.x1;
rep.heightBoundingShape = extents.y2 - extents.y1;
if ((region = wClipShape(pWin))) {
- /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = RegionExtents(region);
- extents = *pExtents;
- } else {
- extents.x1 = 0;
- extents.y1 = 0;
- extents.x2 = pWin->drawable.width;
- extents.y2 = pWin->drawable.height;
+ /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
+ pExtents = RegionExtents(region);
+ extents = *pExtents;
+ }
+ else {
+ extents.x1 = 0;
+ extents.y1 = 0;
+ extents.x2 = pWin->drawable.width;
+ extents.y2 = pWin->drawable.height;
}
rep.xClipShape = extents.x1;
rep.yClipShape = extents.y1;
rep.widthClipShape = extents.x2 - extents.x1;
rep.heightClipShape = extents.y2 - extents.y1;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.xBoundingShape);
- swaps(&rep.yBoundingShape);
- swaps(&rep.widthBoundingShape);
- swaps(&rep.heightBoundingShape);
- swaps(&rep.xClipShape);
- swaps(&rep.yClipShape);
- swaps(&rep.widthClipShape);
- swaps(&rep.heightClipShape);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.xBoundingShape);
+ swaps(&rep.yBoundingShape);
+ swaps(&rep.widthBoundingShape);
+ swaps(&rep.heightBoundingShape);
+ swaps(&rep.xClipShape);
+ swaps(&rep.yClipShape);
+ swaps(&rep.widthClipShape);
+ swaps(&rep.heightClipShape);
}
- WriteToClient(client, sizeof (xShapeQueryExtentsReply), (char *)&rep);
+ WriteToClient(client, sizeof(xShapeQueryExtentsReply), (char *) &rep);
return Success;
}
-/*ARGSUSED*/
-static int
-ShapeFreeClient (pointer data, XID id)
+ /*ARGSUSED*/ static int
+ShapeFreeClient(pointer data, XID id)
{
- ShapeEventPtr pShapeEvent;
- WindowPtr pWin;
- ShapeEventPtr *pHead, pCur, pPrev;
+ ShapeEventPtr pShapeEvent;
+ WindowPtr pWin;
+ ShapeEventPtr *pHead, pCur, pPrev;
int rc;
pShapeEvent = (ShapeEventPtr) data;
pWin = pShapeEvent->window;
- rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- ShapeEventType, serverClient, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ ShapeEventType, serverClient, DixReadAccess);
if (rc == Success) {
- pPrev = 0;
- for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur=pCur->next)
- pPrev = pCur;
- if (pCur)
- {
- if (pPrev)
- pPrev->next = pShapeEvent->next;
- else
- *pHead = pShapeEvent->next;
- }
+ pPrev = 0;
+ for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur = pCur->next)
+ pPrev = pCur;
+ if (pCur) {
+ if (pPrev)
+ pPrev->next = pShapeEvent->next;
+ else
+ *pHead = pShapeEvent->next;
+ }
}
free((pointer) pShapeEvent);
return 1;
}
-/*ARGSUSED*/
-static int
-ShapeFreeEvents (pointer data, XID id)
+ /*ARGSUSED*/ static int
+ShapeFreeEvents(pointer data, XID id)
{
- ShapeEventPtr *pHead, pCur, pNext;
+ ShapeEventPtr *pHead, pCur, pNext;
pHead = (ShapeEventPtr *) data;
for (pCur = *pHead; pCur; pCur = pNext) {
- pNext = pCur->next;
- FreeResource (pCur->clientResource, ClientType);
- free((pointer) pCur);
+ pNext = pCur->next;
+ FreeResource(pCur->clientResource, ClientType);
+ free((pointer) pCur);
}
free((pointer) pHead);
return 1;
}
static int
-ProcShapeSelectInput (ClientPtr client)
+ProcShapeSelectInput(ClientPtr client)
{
REQUEST(xShapeSelectInputReq);
- WindowPtr pWin;
- ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
- XID clientResource;
- int rc;
+ WindowPtr pWin;
+ ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
+ XID clientResource;
+ int rc;
- REQUEST_SIZE_MATCH (xShapeSelectInputReq);
+ REQUEST_SIZE_MATCH(xShapeSelectInputReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
if (rc != Success)
- return rc;
- rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- ShapeEventType, client, DixWriteAccess);
+ return rc;
+ rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ ShapeEventType, client, DixWriteAccess);
if (rc != Success && rc != BadValue)
- return rc;
+ return rc;
switch (stuff->enable) {
case xTrue:
- if (pHead) {
-
- /* check for existing entry. */
- for (pShapeEvent = *pHead;
- pShapeEvent;
- pShapeEvent = pShapeEvent->next)
- {
- if (pShapeEvent->client == client)
- return Success;
- }
- }
-
- /* build the entry */
- pNewShapeEvent = malloc(sizeof (ShapeEventRec));
- if (!pNewShapeEvent)
- return BadAlloc;
- pNewShapeEvent->next = 0;
- pNewShapeEvent->client = client;
- pNewShapeEvent->window = pWin;
- /*
- * add a resource that will be deleted when
- * the client goes away
- */
- clientResource = FakeClientID (client->index);
- pNewShapeEvent->clientResource = clientResource;
- if (!AddResource (clientResource, ClientType, (pointer)pNewShapeEvent))
- return BadAlloc;
- /*
- * create a resource to contain a pointer to the list
- * of clients selecting input. This must be indirect as
- * the list may be arbitrarily rearranged which cannot be
- * done through the resource database.
- */
- if (!pHead)
- {
- pHead = malloc(sizeof (ShapeEventPtr));
- if (!pHead ||
- !AddResource (pWin->drawable.id, ShapeEventType, (pointer)pHead))
- {
- FreeResource (clientResource, RT_NONE);
- return BadAlloc;
- }
- *pHead = 0;
- }
- pNewShapeEvent->next = *pHead;
- *pHead = pNewShapeEvent;
- break;
+ if (pHead) {
+
+ /* check for existing entry. */
+ for (pShapeEvent = *pHead;
+ pShapeEvent; pShapeEvent = pShapeEvent->next) {
+ if (pShapeEvent->client == client)
+ return Success;
+ }
+ }
+
+ /* build the entry */
+ pNewShapeEvent = malloc(sizeof(ShapeEventRec));
+ if (!pNewShapeEvent)
+ return BadAlloc;
+ pNewShapeEvent->next = 0;
+ pNewShapeEvent->client = client;
+ pNewShapeEvent->window = pWin;
+ /*
+ * add a resource that will be deleted when
+ * the client goes away
+ */
+ clientResource = FakeClientID(client->index);
+ pNewShapeEvent->clientResource = clientResource;
+ if (!AddResource(clientResource, ClientType, (pointer) pNewShapeEvent))
+ return BadAlloc;
+ /*
+ * create a resource to contain a pointer to the list
+ * of clients selecting input. This must be indirect as
+ * the list may be arbitrarily rearranged which cannot be
+ * done through the resource database.
+ */
+ if (!pHead) {
+ pHead = malloc(sizeof(ShapeEventPtr));
+ if (!pHead ||
+ !AddResource(pWin->drawable.id, ShapeEventType,
+ (pointer) pHead)) {
+ FreeResource(clientResource, RT_NONE);
+ return BadAlloc;
+ }
+ *pHead = 0;
+ }
+ pNewShapeEvent->next = *pHead;
+ *pHead = pNewShapeEvent;
+ break;
case xFalse:
- /* delete the interest */
- if (pHead) {
- pNewShapeEvent = 0;
- for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
- if (pShapeEvent->client == client)
- break;
- pNewShapeEvent = pShapeEvent;
- }
- if (pShapeEvent) {
- FreeResource (pShapeEvent->clientResource, ClientType);
- if (pNewShapeEvent)
- pNewShapeEvent->next = pShapeEvent->next;
- else
- *pHead = pShapeEvent->next;
- free(pShapeEvent);
- }
- }
- break;
+ /* delete the interest */
+ if (pHead) {
+ pNewShapeEvent = 0;
+ for (pShapeEvent = *pHead; pShapeEvent;
+ pShapeEvent = pShapeEvent->next) {
+ if (pShapeEvent->client == client)
+ break;
+ pNewShapeEvent = pShapeEvent;
+ }
+ if (pShapeEvent) {
+ FreeResource(pShapeEvent->clientResource, ClientType);
+ if (pNewShapeEvent)
+ pNewShapeEvent->next = pShapeEvent->next;
+ else
+ *pHead = pShapeEvent->next;
+ free(pShapeEvent);
+ }
+ }
+ break;
default:
- client->errorValue = stuff->enable;
- return BadValue;
+ client->errorValue = stuff->enable;
+ return BadValue;
}
return Success;
}
@@ -837,394 +823,398 @@ ProcShapeSelectInput (ClientPtr client)
*/
void
-SendShapeNotify (WindowPtr pWin, int which)
+SendShapeNotify(WindowPtr pWin, int which)
{
- ShapeEventPtr *pHead, pShapeEvent;
- xShapeNotifyEvent se;
- BoxRec extents;
- RegionPtr region;
- BYTE shaped;
+ ShapeEventPtr *pHead, pShapeEvent;
+ xShapeNotifyEvent se;
+ BoxRec extents;
+ RegionPtr region;
+ BYTE shaped;
int rc;
- rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- ShapeEventType, serverClient, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ ShapeEventType, serverClient, DixReadAccess);
if (rc != Success)
- return;
+ return;
switch (which) {
case ShapeBounding:
- region = wBoundingShape(pWin);
- if (region) {
- extents = *RegionExtents(region);
- shaped = xTrue;
- } else {
- extents.x1 = -wBorderWidth (pWin);
- extents.y1 = -wBorderWidth (pWin);
- extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
- extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
- shaped = xFalse;
- }
- break;
+ region = wBoundingShape(pWin);
+ if (region) {
+ extents = *RegionExtents(region);
+ shaped = xTrue;
+ }
+ else {
+ extents.x1 = -wBorderWidth(pWin);
+ extents.y1 = -wBorderWidth(pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth(pWin);
+ shaped = xFalse;
+ }
+ break;
case ShapeClip:
- region = wClipShape(pWin);
- if (region) {
- extents = *RegionExtents(region);
- shaped = xTrue;
- } else {
- extents.x1 = 0;
- extents.y1 = 0;
- extents.x2 = pWin->drawable.width;
- extents.y2 = pWin->drawable.height;
- shaped = xFalse;
- }
- break;
+ region = wClipShape(pWin);
+ if (region) {
+ extents = *RegionExtents(region);
+ shaped = xTrue;
+ }
+ else {
+ extents.x1 = 0;
+ extents.y1 = 0;
+ extents.x2 = pWin->drawable.width;
+ extents.y2 = pWin->drawable.height;
+ shaped = xFalse;
+ }
+ break;
case ShapeInput:
- region = wInputShape(pWin);
- if (region) {
- extents = *RegionExtents(region);
- shaped = xTrue;
- } else {
- extents.x1 = -wBorderWidth (pWin);
- extents.y1 = -wBorderWidth (pWin);
- extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
- extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
- shaped = xFalse;
- }
- break;
+ region = wInputShape(pWin);
+ if (region) {
+ extents = *RegionExtents(region);
+ shaped = xTrue;
+ }
+ else {
+ extents.x1 = -wBorderWidth(pWin);
+ extents.y1 = -wBorderWidth(pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth(pWin);
+ shaped = xFalse;
+ }
+ break;
default:
- return;
+ return;
}
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
- se.type = ShapeNotify + ShapeEventBase;
- se.kind = which;
- se.window = pWin->drawable.id;
- se.x = extents.x1;
- se.y = extents.y1;
- se.width = extents.x2 - extents.x1;
- se.height = extents.y2 - extents.y1;
- se.time = currentTime.milliseconds;
- se.shaped = shaped;
- WriteEventsToClient (pShapeEvent->client, 1, (xEvent *) &se);
+ se.type = ShapeNotify + ShapeEventBase;
+ se.kind = which;
+ se.window = pWin->drawable.id;
+ se.x = extents.x1;
+ se.y = extents.y1;
+ se.width = extents.x2 - extents.x1;
+ se.height = extents.y2 - extents.y1;
+ se.time = currentTime.milliseconds;
+ se.shaped = shaped;
+ WriteEventsToClient(pShapeEvent->client, 1, (xEvent *) &se);
}
}
static int
-ProcShapeInputSelected (ClientPtr client)
+ProcShapeInputSelected(ClientPtr client)
{
REQUEST(xShapeInputSelectedReq);
- WindowPtr pWin;
- ShapeEventPtr pShapeEvent, *pHead;
- int enabled, rc;
- xShapeInputSelectedReply rep;
- REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
+ WindowPtr pWin;
+ ShapeEventPtr pShapeEvent, *pHead;
+ int enabled, rc;
+ xShapeInputSelectedReply rep;
+
+ REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
- rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- ShapeEventType, client, DixReadAccess);
+ return rc;
+ rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ ShapeEventType, client, DixReadAccess);
if (rc != Success && rc != BadValue)
- return rc;
+ return rc;
enabled = xFalse;
if (pHead) {
- for (pShapeEvent = *pHead;
- pShapeEvent;
- pShapeEvent = pShapeEvent->next)
- {
- if (pShapeEvent->client == client) {
- enabled = xTrue;
- break;
- }
- }
+ for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
+ if (pShapeEvent->client == client) {
+ enabled = xTrue;
+ break;
+ }
+ }
}
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.enabled = enabled;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
- WriteToClient (client, sizeof (xShapeInputSelectedReply), (char *) &rep);
+ WriteToClient(client, sizeof(xShapeInputSelectedReply), (char *) &rep);
return Success;
}
static int
-ProcShapeGetRectangles (ClientPtr client)
+ProcShapeGetRectangles(ClientPtr client)
{
REQUEST(xShapeGetRectanglesReq);
- WindowPtr pWin;
- xShapeGetRectanglesReply rep;
- xRectangle *rects;
- int nrects, i, rc;
- RegionPtr region;
+ WindowPtr pWin;
+ xShapeGetRectanglesReply rep;
+ xRectangle *rects;
+ int nrects, i, rc;
+ RegionPtr region;
+
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->kind) {
case ShapeBounding:
- region = wBoundingShape(pWin);
- break;
+ region = wBoundingShape(pWin);
+ break;
case ShapeClip:
- region = wClipShape(pWin);
- break;
+ region = wClipShape(pWin);
+ break;
case ShapeInput:
- region = wInputShape (pWin);
- break;
+ region = wInputShape(pWin);
+ break;
default:
- client->errorValue = stuff->kind;
- return BadValue;
+ client->errorValue = stuff->kind;
+ return BadValue;
}
if (!region) {
- nrects = 1;
- rects = malloc(sizeof (xRectangle));
- if (!rects)
- return BadAlloc;
- switch (stuff->kind) {
- case ShapeBounding:
- rects->x = - (int) wBorderWidth (pWin);
- rects->y = - (int) wBorderWidth (pWin);
- rects->width = pWin->drawable.width + wBorderWidth (pWin);
- rects->height = pWin->drawable.height + wBorderWidth (pWin);
- break;
- case ShapeClip:
- rects->x = 0;
- rects->y = 0;
- rects->width = pWin->drawable.width;
- rects->height = pWin->drawable.height;
- break;
- case ShapeInput:
- rects->x = - (int) wBorderWidth (pWin);
- rects->y = - (int) wBorderWidth (pWin);
- rects->width = pWin->drawable.width + wBorderWidth (pWin);
- rects->height = pWin->drawable.height + wBorderWidth (pWin);
- break;
- }
- } else {
- BoxPtr box;
- nrects = RegionNumRects(region);
- box = RegionRects(region);
- rects = malloc(nrects * sizeof (xRectangle));
- if (!rects && nrects)
- return BadAlloc;
- for (i = 0; i < nrects; i++, box++) {
- rects[i].x = box->x1;
- rects[i].y = box->y1;
- rects[i].width = box->x2 - box->x1;
- rects[i].height = box->y2 - box->y1;
- }
+ nrects = 1;
+ rects = malloc(sizeof(xRectangle));
+ if (!rects)
+ return BadAlloc;
+ switch (stuff->kind) {
+ case ShapeBounding:
+ rects->x = -(int) wBorderWidth(pWin);
+ rects->y = -(int) wBorderWidth(pWin);
+ rects->width = pWin->drawable.width + wBorderWidth(pWin);
+ rects->height = pWin->drawable.height + wBorderWidth(pWin);
+ break;
+ case ShapeClip:
+ rects->x = 0;
+ rects->y = 0;
+ rects->width = pWin->drawable.width;
+ rects->height = pWin->drawable.height;
+ break;
+ case ShapeInput:
+ rects->x = -(int) wBorderWidth(pWin);
+ rects->y = -(int) wBorderWidth(pWin);
+ rects->width = pWin->drawable.width + wBorderWidth(pWin);
+ rects->height = pWin->drawable.height + wBorderWidth(pWin);
+ break;
+ }
+ }
+ else {
+ BoxPtr box;
+
+ nrects = RegionNumRects(region);
+ box = RegionRects(region);
+ rects = malloc(nrects * sizeof(xRectangle));
+ if (!rects && nrects)
+ return BadAlloc;
+ for (i = 0; i < nrects; i++, box++) {
+ rects[i].x = box->x1;
+ rects[i].y = box->y1;
+ rects[i].width = box->x2 - box->x1;
+ rects[i].height = box->y2 - box->y1;
+ }
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = bytes_to_int32(nrects * sizeof (xRectangle));
+ rep.length = bytes_to_int32(nrects * sizeof(xRectangle));
rep.ordering = YXBanded;
rep.nrects = nrects;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.nrects);
- SwapShorts ((short *)rects, (unsigned long)nrects * 4);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.nrects);
+ SwapShorts((short *) rects, (unsigned long) nrects * 4);
}
- WriteToClient (client, sizeof (rep), (char *) &rep);
- WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects);
+ WriteToClient(client, sizeof(rep), (char *) &rep);
+ WriteToClient(client, nrects * sizeof(xRectangle), (char *) rects);
free(rects);
return Success;
}
static int
-ProcShapeDispatch (ClientPtr client)
+ProcShapeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_ShapeQueryVersion:
- return ProcShapeQueryVersion (client);
+ return ProcShapeQueryVersion(client);
case X_ShapeRectangles:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShapeRectangles (client);
- else
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShapeRectangles(client);
+ else
#endif
- return ProcShapeRectangles (client);
+ return ProcShapeRectangles(client);
case X_ShapeMask:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShapeMask (client);
- else
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShapeMask(client);
+ else
#endif
- return ProcShapeMask (client);
+ return ProcShapeMask(client);
case X_ShapeCombine:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShapeCombine (client);
- else
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShapeCombine(client);
+ else
#endif
- return ProcShapeCombine (client);
+ return ProcShapeCombine(client);
case X_ShapeOffset:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShapeOffset (client);
- else
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShapeOffset(client);
+ else
#endif
- return ProcShapeOffset (client);
+ return ProcShapeOffset(client);
case X_ShapeQueryExtents:
- return ProcShapeQueryExtents (client);
+ return ProcShapeQueryExtents(client);
case X_ShapeSelectInput:
- return ProcShapeSelectInput (client);
+ return ProcShapeSelectInput(client);
case X_ShapeInputSelected:
- return ProcShapeInputSelected (client);
+ return ProcShapeInputSelected(client);
case X_ShapeGetRectangles:
- return ProcShapeGetRectangles (client);
+ return ProcShapeGetRectangles(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
static void
-SShapeNotifyEvent(xShapeNotifyEvent *from, xShapeNotifyEvent *to)
+SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
{
to->type = from->type;
to->kind = from->kind;
- cpswapl (from->window, to->window);
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswaps (from->x, to->x);
- cpswaps (from->y, to->y);
- cpswaps (from->width, to->width);
- cpswaps (from->height, to->height);
- cpswapl (from->time, to->time);
+ cpswapl(from->window, to->window);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswaps(from->x, to->x);
+ cpswaps(from->y, to->y);
+ cpswaps(from->width, to->width);
+ cpswaps(from->height, to->height);
+ cpswapl(from->time, to->time);
to->shaped = from->shaped;
}
static int
-SProcShapeQueryVersion (ClientPtr client)
+SProcShapeQueryVersion(ClientPtr client)
{
- REQUEST (xShapeQueryVersionReq);
+ REQUEST(xShapeQueryVersionReq);
swaps(&stuff->length);
- return ProcShapeQueryVersion (client);
+ return ProcShapeQueryVersion(client);
}
static int
-SProcShapeRectangles (ClientPtr client)
+SProcShapeRectangles(ClientPtr client)
{
- REQUEST (xShapeRectanglesReq);
+ REQUEST(xShapeRectanglesReq);
swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
+ REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
SwapRestS(stuff);
- return ProcShapeRectangles (client);
+ return ProcShapeRectangles(client);
}
static int
-SProcShapeMask (ClientPtr client)
+SProcShapeMask(ClientPtr client)
{
- REQUEST (xShapeMaskReq);
+ REQUEST(xShapeMaskReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeMaskReq);
+ REQUEST_SIZE_MATCH(xShapeMaskReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
swapl(&stuff->src);
- return ProcShapeMask (client);
+ return ProcShapeMask(client);
}
static int
-SProcShapeCombine (ClientPtr client)
+SProcShapeCombine(ClientPtr client)
{
- REQUEST (xShapeCombineReq);
+ REQUEST(xShapeCombineReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeCombineReq);
+ REQUEST_SIZE_MATCH(xShapeCombineReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
swapl(&stuff->src);
- return ProcShapeCombine (client);
+ return ProcShapeCombine(client);
}
static int
-SProcShapeOffset (ClientPtr client)
+SProcShapeOffset(ClientPtr client)
{
- REQUEST (xShapeOffsetReq);
+ REQUEST(xShapeOffsetReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeOffsetReq);
+ REQUEST_SIZE_MATCH(xShapeOffsetReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
- return ProcShapeOffset (client);
+ return ProcShapeOffset(client);
}
static int
-SProcShapeQueryExtents (ClientPtr client)
+SProcShapeQueryExtents(ClientPtr client)
{
- REQUEST (xShapeQueryExtentsReq);
+ REQUEST(xShapeQueryExtentsReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
+ REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
swapl(&stuff->window);
- return ProcShapeQueryExtents (client);
+ return ProcShapeQueryExtents(client);
}
static int
-SProcShapeSelectInput (ClientPtr client)
+SProcShapeSelectInput(ClientPtr client)
{
- REQUEST (xShapeSelectInputReq);
+ REQUEST(xShapeSelectInputReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeSelectInputReq);
+ REQUEST_SIZE_MATCH(xShapeSelectInputReq);
swapl(&stuff->window);
- return ProcShapeSelectInput (client);
+ return ProcShapeSelectInput(client);
}
static int
-SProcShapeInputSelected (ClientPtr client)
+SProcShapeInputSelected(ClientPtr client)
{
- REQUEST (xShapeInputSelectedReq);
+ REQUEST(xShapeInputSelectedReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
+ REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
swapl(&stuff->window);
- return ProcShapeInputSelected (client);
+ return ProcShapeInputSelected(client);
}
static int
-SProcShapeGetRectangles (ClientPtr client)
+SProcShapeGetRectangles(ClientPtr client)
{
REQUEST(xShapeGetRectanglesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
swapl(&stuff->window);
- return ProcShapeGetRectangles (client);
+ return ProcShapeGetRectangles(client);
}
static int
-SProcShapeDispatch (ClientPtr client)
+SProcShapeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_ShapeQueryVersion:
- return SProcShapeQueryVersion (client);
+ return SProcShapeQueryVersion(client);
case X_ShapeRectangles:
- return SProcShapeRectangles (client);
+ return SProcShapeRectangles(client);
case X_ShapeMask:
- return SProcShapeMask (client);
+ return SProcShapeMask(client);
case X_ShapeCombine:
- return SProcShapeCombine (client);
+ return SProcShapeCombine(client);
case X_ShapeOffset:
- return SProcShapeOffset (client);
+ return SProcShapeOffset(client);
case X_ShapeQueryExtents:
- return SProcShapeQueryExtents (client);
+ return SProcShapeQueryExtents(client);
case X_ShapeSelectInput:
- return SProcShapeSelectInput (client);
+ return SProcShapeSelectInput(client);
case X_ShapeInputSelected:
- return SProcShapeInputSelected (client);
+ return SProcShapeInputSelected(client);
case X_ShapeGetRectangles:
- return SProcShapeGetRectangles (client);
+ return SProcShapeGetRectangles(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
@@ -1236,11 +1226,10 @@ ShapeExtensionInit(void)
ClientType = CreateNewResourceType(ShapeFreeClient, "ShapeClient");
ShapeEventType = CreateNewResourceType(ShapeFreeEvents, "ShapeEvent");
if (ClientType && ShapeEventType &&
- (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
- ProcShapeDispatch, SProcShapeDispatch,
- NULL, StandardMinorOpcode)))
- {
- ShapeEventBase = extEntry->eventBase;
- EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
+ (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
+ ProcShapeDispatch, SProcShapeDispatch,
+ NULL, StandardMinorOpcode))) {
+ ShapeEventBase = extEntry->eventBase;
+ EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
}
}
diff --git a/xorg-server/Xext/shm.c b/xorg-server/Xext/shm.c
index 2127dee3e..7a73640dd 100644
--- a/xorg-server/Xext/shm.c
+++ b/xorg-server/Xext/shm.c
@@ -26,7 +26,6 @@ in this Software without prior written authorization from The Open Group.
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
-
#define SHM
#ifdef HAVE_DIX_CONFIG_H
@@ -108,20 +107,16 @@ typedef struct _ShmScrPrivateRec {
} ShmScrPrivateRec;
static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
-static int ShmDetachSegment(
- pointer /* value */,
- XID /* shmseg */
+static int ShmDetachSegment(pointer /* value */ ,
+ XID /* shmseg */
);
-static void ShmResetProc(
- ExtensionEntry * /* extEntry */
+static void ShmResetProc(ExtensionEntry * /* extEntry */
);
-static void SShmCompletionEvent(
- xShmCompletionEvent * /* from */,
- xShmCompletionEvent * /* to */
+static void SShmCompletionEvent(xShmCompletionEvent * /* from */ ,
+ xShmCompletionEvent * /* to */
);
-static Bool ShmDestroyPixmap (PixmapPtr pPixmap);
-
+static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
static unsigned char ShmReqCode;
int ShmCompletionCode;
@@ -130,11 +125,13 @@ RESTYPE ShmSegType;
static ShmDescPtr Shmsegs;
static Bool sharedPixmaps;
static DevPrivateKeyRec shmScrPrivateKeyRec;
+
#define shmScrPrivateKey (&shmScrPrivateKeyRec)
static DevPrivateKeyRec shmPixmapPrivateKeyRec;
+
#define shmPixmapPrivateKey (&shmPixmapPrivateKeyRec)
-static ShmFuncs miFuncs = {NULL, NULL};
-static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL};
+static ShmFuncs miFuncs = { NULL, NULL };
+static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL };
#define ShmGetScreenPriv(s) ((ShmScrPrivateRec *)dixLookupPrivate(&(s)->devPrivates, shmScrPrivateKey))
@@ -167,7 +164,6 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL};
} \
}
-
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
#include <sys/signal.h>
@@ -179,9 +175,10 @@ SigSysHandler(int signo)
badSysCall = TRUE;
}
-static Bool CheckForShmSyscall(void)
+static Bool
+CheckForShmSyscall(void)
{
- void (*oldHandler)(int);
+ void (*oldHandler) (int);
int shmid = -1;
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
@@ -190,13 +187,11 @@ static Bool CheckForShmSyscall(void)
badSysCall = FALSE;
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
- if (shmid != -1)
- {
+ if (shmid != -1) {
/* Successful allocation - clean up */
- shmctl(shmid, IPC_RMID, NULL);
+ shmctl(shmid, IPC_RMID, NULL);
}
- else
- {
+ else {
/* Allocation failed */
badSysCall = TRUE;
}
@@ -212,6 +207,7 @@ static Bool
ShmCloseScreen(int i, ScreenPtr pScreen)
{
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
+
pScreen->CloseScreen = screen_priv->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
free(screen_priv);
@@ -222,12 +218,12 @@ static ShmScrPrivateRec *
ShmInitScreenPriv(ScreenPtr pScreen)
{
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
- if (!screen_priv)
- {
- screen_priv = calloc(1, sizeof (ShmScrPrivateRec));
- screen_priv->CloseScreen = pScreen->CloseScreen;
- dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
- pScreen->CloseScreen = ShmCloseScreen;
+
+ if (!screen_priv) {
+ screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
+ screen_priv->CloseScreen = pScreen->CloseScreen;
+ dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
+ pScreen->CloseScreen = ShmCloseScreen;
}
return screen_priv;
}
@@ -236,44 +232,45 @@ static Bool
ShmRegisterPrivates(void)
{
if (!dixRegisterPrivateKey(&shmScrPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&shmPixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
- return FALSE;
+ return FALSE;
return TRUE;
}
-/*ARGSUSED*/
-static void
-ShmResetProc(ExtensionEntry *extEntry)
+ /*ARGSUSED*/ static void
+ShmResetProc(ExtensionEntry * extEntry)
{
int i;
+
for (i = 0; i < screenInfo.numScreens; i++)
- ShmRegisterFuncs(screenInfo.screens[i], NULL);
+ ShmRegisterFuncs(screenInfo.screens[i], NULL);
}
void
ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
{
if (!ShmRegisterPrivates())
- return;
+ return;
ShmInitScreenPriv(pScreen)->shmFuncs = funcs;
}
static Bool
-ShmDestroyPixmap (PixmapPtr pPixmap)
+ShmDestroyPixmap(PixmapPtr pPixmap)
{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
- Bool ret;
- if (pPixmap->refcnt == 1)
- {
- ShmDescPtr shmdesc;
- shmdesc = (ShmDescPtr)dixLookupPrivate(&pPixmap->devPrivates,
- shmPixmapPrivateKey);
- if (shmdesc)
- ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
+ Bool ret;
+
+ if (pPixmap->refcnt == 1) {
+ ShmDescPtr shmdesc;
+
+ shmdesc = (ShmDescPtr) dixLookupPrivate(&pPixmap->devPrivates,
+ shmPixmapPrivateKey);
+ if (shmdesc)
+ ShmDetachSegment((pointer) shmdesc, pPixmap->drawable.id);
}
-
+
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
ret = (*pScreen->DestroyPixmap) (pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
@@ -306,14 +303,14 @@ ProcShmQueryVersion(ClientPtr client)
rep.gid = getegid();
#endif
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
- swaps(&rep.uid);
- swaps(&rep.gid);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
+ swaps(&rep.uid);
+ swaps(&rep.gid);
}
- WriteToClient(client, sizeof(xShmQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xShmQueryVersionReply), (char *) &rep);
return Success;
}
@@ -322,66 +319,66 @@ ProcShmQueryVersion(ClientPtr client)
* using the credentials from the client if available
*/
static int
-shm_access(ClientPtr client, SHMPERM_TYPE *perm, int readonly)
+shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly)
{
int uid, gid;
mode_t mask;
int uidset = 0, gidset = 0;
LocalClientCredRec *lcc;
-
+
if (GetLocalClientCreds(client, &lcc) != -1) {
- if (lcc->fieldsSet & LCC_UID_SET) {
- uid = lcc->euid;
- uidset = 1;
- }
- if (lcc->fieldsSet & LCC_GID_SET) {
- gid = lcc->egid;
- gidset = 1;
- }
+ if (lcc->fieldsSet & LCC_UID_SET) {
+ uid = lcc->euid;
+ uidset = 1;
+ }
+ if (lcc->fieldsSet & LCC_GID_SET) {
+ gid = lcc->egid;
+ gidset = 1;
+ }
#if defined(HAVE_GETZONEID) && defined(SHMPERM_ZONEID)
- if ( ((lcc->fieldsSet & LCC_ZID_SET) == 0) || (lcc->zoneid == -1)
- || (lcc->zoneid != SHMPERM_ZONEID(perm))) {
- uidset = 0;
- gidset = 0;
- }
+ if (((lcc->fieldsSet & LCC_ZID_SET) == 0) || (lcc->zoneid == -1)
+ || (lcc->zoneid != SHMPERM_ZONEID(perm))) {
+ uidset = 0;
+ gidset = 0;
+ }
#endif
- FreeLocalClientCreds(lcc);
-
- if (uidset) {
- /* User id 0 always gets access */
- if (uid == 0) {
- return 0;
- }
+ FreeLocalClientCreds(lcc);
+
+ if (uidset) {
+ /* User id 0 always gets access */
+ if (uid == 0) {
+ return 0;
+ }
#ifdef _MSC_VER
__asm int 3;
#else
- /* Check the owner */
- if (SHMPERM_UID(perm) == uid || SHMPERM_CUID(perm) == uid) {
- mask = S_IRUSR;
- if (!readonly) {
- mask |= S_IWUSR;
- }
- return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1;
- }
+ /* Check the owner */
+ if (SHMPERM_UID(perm) == uid || SHMPERM_CUID(perm) == uid) {
+ mask = S_IRUSR;
+ if (!readonly) {
+ mask |= S_IWUSR;
+ }
+ return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1;
+ }
#endif
- }
+ }
- if (gidset) {
- /* Check the group */
+ if (gidset) {
+ /* Check the group */
#ifdef _MSC_VER
__asm int 3;
#else
- if (SHMPERM_GID(perm) == gid || SHMPERM_CGID(perm) == gid) {
- mask = S_IRGRP;
- if (!readonly) {
- mask |= S_IWGRP;
- }
- return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1;
- }
+ if (SHMPERM_GID(perm) == gid || SHMPERM_CGID(perm) == gid) {
+ mask = S_IRGRP;
+ if (!readonly) {
+ mask |= S_IWGRP;
+ }
+ return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1;
+ }
#endif
- }
+ }
}
#ifdef _MSC_VER
__asm int 3;
@@ -390,7 +387,7 @@ shm_access(ClientPtr client, SHMPERM_TYPE *perm, int readonly)
/* Otherwise, check everyone else */
mask = S_IROTH;
if (!readonly) {
- mask |= S_IWOTH;
+ mask |= S_IWOTH;
}
return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1;
#endif
@@ -401,76 +398,68 @@ ProcShmAttach(ClientPtr client)
{
SHMSTAT_TYPE buf;
ShmDescPtr shmdesc;
+
REQUEST(xShmAttachReq);
REQUEST_SIZE_MATCH(xShmAttachReq);
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
- if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse))
- {
- client->errorValue = stuff->readOnly;
+ if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
+ client->errorValue = stuff->readOnly;
return BadValue;
}
for (shmdesc = Shmsegs;
- shmdesc && (shmdesc->shmid != stuff->shmid);
- shmdesc = shmdesc->next)
- ;
- if (shmdesc)
- {
- if (!stuff->readOnly && !shmdesc->writable)
- return BadAccess;
- shmdesc->refcnt++;
+ shmdesc && (shmdesc->shmid != stuff->shmid); shmdesc = shmdesc->next);
+ if (shmdesc) {
+ if (!stuff->readOnly && !shmdesc->writable)
+ return BadAccess;
+ shmdesc->refcnt++;
}
- else
- {
- shmdesc = malloc(sizeof(ShmDescRec));
- if (!shmdesc)
- return BadAlloc;
- shmdesc->addr = shmat(stuff->shmid, 0,
- stuff->readOnly ? SHM_RDONLY : 0);
- if ((shmdesc->addr == ((char *)-1)) ||
- SHMSTAT(stuff->shmid, &buf))
- {
- free(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, &(SHM_PERM(buf)), stuff->readOnly) == -1) {
- shmdt(shmdesc->addr);
- free(shmdesc);
- return BadAccess;
- }
-
- shmdesc->shmid = stuff->shmid;
- shmdesc->refcnt = 1;
- shmdesc->writable = !stuff->readOnly;
- shmdesc->size = SHM_SEGSZ(buf);
- shmdesc->next = Shmsegs;
- Shmsegs = shmdesc;
+ else {
+ shmdesc = malloc(sizeof(ShmDescRec));
+ if (!shmdesc)
+ return BadAlloc;
+ shmdesc->addr = shmat(stuff->shmid, 0,
+ stuff->readOnly ? SHM_RDONLY : 0);
+ if ((shmdesc->addr == ((char *) -1)) || SHMSTAT(stuff->shmid, &buf)) {
+ free(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, &(SHM_PERM(buf)), stuff->readOnly) == -1) {
+ shmdt(shmdesc->addr);
+ free(shmdesc);
+ return BadAccess;
+ }
+
+ shmdesc->shmid = stuff->shmid;
+ shmdesc->refcnt = 1;
+ shmdesc->writable = !stuff->readOnly;
+ shmdesc->size = SHM_SEGSZ(buf);
+ shmdesc->next = Shmsegs;
+ Shmsegs = shmdesc;
}
- if (!AddResource(stuff->shmseg, ShmSegType, (pointer)shmdesc))
- return BadAlloc;
+ if (!AddResource(stuff->shmseg, ShmSegType, (pointer) shmdesc))
+ return BadAlloc;
return Success;
}
-/*ARGSUSED*/
-static int
+ /*ARGSUSED*/ static int
ShmDetachSegment(pointer value, /* must conform to DeleteType */
- XID shmseg)
+ XID shmseg)
{
- ShmDescPtr shmdesc = (ShmDescPtr)value;
+ ShmDescPtr shmdesc = (ShmDescPtr) value;
ShmDescPtr *prev;
if (--shmdesc->refcnt)
- return TRUE;
+ return TRUE;
#ifndef _MSC_VER
shmdt(shmdesc->addr);
#endif
- for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next)
- ;
+ for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next);
*prev = shmdesc->next;
free(shmdesc);
return Success;
@@ -480,6 +469,7 @@ static int
ProcShmDetach(ClientPtr client)
{
ShmDescPtr shmdesc;
+
REQUEST(xShmDetachReq);
REQUEST_SIZE_MATCH(xShmDetachReq);
@@ -494,44 +484,47 @@ ProcShmDetach(ClientPtr client)
*/
static void
doShmPutImage(DrawablePtr dst, GCPtr pGC,
- int depth, unsigned int format,
- int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
- char *data)
+ int depth, unsigned int format,
+ int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
+ char *data)
{
PixmapPtr pPixmap;
if (format == ZPixmap || (format == XYPixmap && depth == 1)) {
- pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
- BitsPerPixel(depth),
- PixmapBytePad(w, depth),
- data);
- if (!pPixmap)
- return;
- pGC->ops->CopyArea((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy);
- FreeScratchPixmapHeader(pPixmap);
- } else {
- GCPtr putGC = GetScratchGC(depth, dst->pScreen);
-
- if (!putGC)
- return;
-
- pPixmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap) {
- FreeScratchGC(putGC);
- return;
- }
- ValidateGC(&pPixmap->drawable, putGC);
- (*putGC->ops->PutImage)(&pPixmap->drawable, putGC, depth, -sx, -sy, w, h, 0,
- (format == XYPixmap) ? XYPixmap : ZPixmap, data);
- FreeScratchGC(putGC);
- if (format == XYBitmap)
- (void)(*pGC->ops->CopyPlane)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
- dx, dy, 1L);
- else
- (void)(*pGC->ops->CopyArea)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
- dx, dy);
- (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+ pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
+ BitsPerPixel(depth),
+ PixmapBytePad(w, depth), data);
+ if (!pPixmap)
+ return;
+ pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC, sx, sy, sw, sh, dx,
+ dy);
+ FreeScratchPixmapHeader(pPixmap);
+ }
+ else {
+ GCPtr putGC = GetScratchGC(depth, dst->pScreen);
+
+ if (!putGC)
+ return;
+
+ pPixmap = (*dst->pScreen->CreatePixmap) (dst->pScreen, sw, sh, depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pPixmap) {
+ FreeScratchGC(putGC);
+ return;
+ }
+ ValidateGC(&pPixmap->drawable, putGC);
+ (*putGC->ops->PutImage) (&pPixmap->drawable, putGC, depth, -sx, -sy, w,
+ h, 0,
+ (format == XYPixmap) ? XYPixmap : ZPixmap,
+ data);
+ FreeScratchGC(putGC);
+ if (format == XYBitmap)
+ (void) (*pGC->ops->CopyPlane) (&pPixmap->drawable, dst, pGC, 0, 0,
+ sw, sh, dx, dy, 1L);
+ else
+ (void) (*pGC->ops->CopyArea) (&pPixmap->drawable, dst, pGC, 0, 0,
+ sw, sh, dx, dy);
+ (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
}
}
@@ -542,35 +535,32 @@ ProcShmPutImage(ClientPtr client)
DrawablePtr pDraw;
long length;
ShmDescPtr shmdesc;
+
REQUEST(xShmPutImageReq);
REQUEST_SIZE_MATCH(xShmPutImageReq);
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client);
if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse))
- return BadValue;
- if (stuff->format == XYBitmap)
- {
+ return BadValue;
+ if (stuff->format == XYBitmap) {
if (stuff->depth != 1)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, 1);
}
- else if (stuff->format == XYPixmap)
- {
+ else if (stuff->format == XYPixmap) {
if (pDraw->depth != stuff->depth)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, 1);
- length *= stuff->depth;
+ length *= stuff->depth;
}
- else if (stuff->format == ZPixmap)
- {
+ else if (stuff->format == ZPixmap) {
if (pDraw->depth != stuff->depth)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, stuff->depth);
}
- else
- {
- client->errorValue = stuff->format;
+ else {
+ client->errorValue = stuff->format;
return BadValue;
}
@@ -581,63 +571,57 @@ ProcShmPutImage(ClientPtr client)
* the version below ought to avoid it
*/
if (stuff->totalHeight != 0 &&
- length > (shmdesc->size - stuff->offset)/stuff->totalHeight) {
- client->errorValue = stuff->totalWidth;
- return BadValue;
+ length > (shmdesc->size - stuff->offset) / stuff->totalHeight) {
+ client->errorValue = stuff->totalWidth;
+ return BadValue;
}
- if (stuff->srcX > stuff->totalWidth)
- {
- client->errorValue = stuff->srcX;
- return BadValue;
+ if (stuff->srcX > stuff->totalWidth) {
+ client->errorValue = stuff->srcX;
+ return BadValue;
}
- if (stuff->srcY > stuff->totalHeight)
- {
- client->errorValue = stuff->srcY;
- return BadValue;
+ if (stuff->srcY > stuff->totalHeight) {
+ client->errorValue = stuff->srcY;
+ return BadValue;
}
- if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth)
- {
- client->errorValue = stuff->srcWidth;
- return BadValue;
+ if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth) {
+ client->errorValue = stuff->srcWidth;
+ return BadValue;
}
- if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight)
- {
- client->errorValue = stuff->srcHeight;
- return BadValue;
+ if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight) {
+ client->errorValue = stuff->srcHeight;
+ return BadValue;
}
if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) ||
- ((stuff->format != ZPixmap) &&
- (stuff->srcX < screenInfo.bitmapScanlinePad) &&
- ((stuff->format == XYBitmap) ||
- ((stuff->srcY == 0) &&
- (stuff->srcHeight == stuff->totalHeight))))) &&
- ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth))
- (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth,
- stuff->dstX, stuff->dstY,
- stuff->totalWidth, stuff->srcHeight,
- stuff->srcX, stuff->format,
- shmdesc->addr + stuff->offset +
- (stuff->srcY * length));
+ ((stuff->format != ZPixmap) &&
+ (stuff->srcX < screenInfo.bitmapScanlinePad) &&
+ ((stuff->format == XYBitmap) ||
+ ((stuff->srcY == 0) &&
+ (stuff->srcHeight == stuff->totalHeight))))) &&
+ ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth))
+ (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth,
+ stuff->dstX, stuff->dstY,
+ stuff->totalWidth, stuff->srcHeight,
+ stuff->srcX, stuff->format,
+ shmdesc->addr + stuff->offset +
+ (stuff->srcY * length));
else
- doShmPutImage(pDraw, pGC, stuff->depth, stuff->format,
- stuff->totalWidth, stuff->totalHeight,
- stuff->srcX, stuff->srcY,
- stuff->srcWidth, stuff->srcHeight,
- stuff->dstX, stuff->dstY,
- shmdesc->addr + stuff->offset);
-
- if (stuff->sendEvent)
- {
- xShmCompletionEvent ev;
-
- ev.type = ShmCompletionCode;
- ev.drawable = stuff->drawable;
- ev.minorEvent = X_ShmPutImage;
- ev.majorEvent = ShmReqCode;
- ev.shmseg = stuff->shmseg;
- ev.offset = stuff->offset;
- WriteEventsToClient(client, 1, (xEvent *) &ev);
+ doShmPutImage(pDraw, pGC, stuff->depth, stuff->format,
+ stuff->totalWidth, stuff->totalHeight,
+ stuff->srcX, stuff->srcY,
+ stuff->srcWidth, stuff->srcHeight,
+ stuff->dstX, stuff->dstY, shmdesc->addr + stuff->offset);
+
+ if (stuff->sendEvent) {
+ xShmCompletionEvent ev;
+
+ ev.type = ShmCompletionCode;
+ ev.drawable = stuff->drawable;
+ ev.minorEvent = X_ShmPutImage;
+ ev.majorEvent = ShmReqCode;
+ ev.shmseg = stuff->shmseg;
+ ev.offset = stuff->offset;
+ WriteEventsToClient(client, 1, (xEvent *) &ev);
}
return Success;
@@ -646,133 +630,120 @@ ProcShmPutImage(ClientPtr client)
static int
ProcShmGetImage(ClientPtr client)
{
- DrawablePtr pDraw;
- long lenPer = 0, length;
- Mask plane = 0;
- xShmGetImageReply xgi;
- ShmDescPtr shmdesc;
- int rc;
+ DrawablePtr pDraw;
+ long lenPer = 0, length;
+ Mask plane = 0;
+ xShmGetImageReply xgi;
+ ShmDescPtr shmdesc;
+ int rc;
REQUEST(xShmGetImageReq);
REQUEST_SIZE_MATCH(xShmGetImageReq);
- if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap))
- {
- client->errorValue = stuff->format;
+ if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
+ client->errorValue = stuff->format;
return BadValue;
}
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
- if (pDraw->type == DRAWABLE_WINDOW)
- {
- if( /* check for being viewable */
- !((WindowPtr) pDraw)->realized ||
- /* check for being on screen */
- pDraw->x + stuff->x < 0 ||
- pDraw->x + stuff->x + (int)stuff->width > pDraw->pScreen->width ||
- pDraw->y + stuff->y < 0 ||
- pDraw->y + stuff->y + (int)stuff->height > pDraw->pScreen->height ||
- /* check for being inside of border */
- stuff->x < - wBorderWidth((WindowPtr)pDraw) ||
- stuff->x + (int)stuff->width >
- wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
- stuff->y < -wBorderWidth((WindowPtr)pDraw) ||
- stuff->y + (int)stuff->height >
- wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height
- )
- return BadMatch;
- xgi.visual = wVisual(((WindowPtr)pDraw));
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ if ( /* check for being viewable */
+ !((WindowPtr) pDraw)->realized ||
+ /* check for being on screen */
+ pDraw->x + stuff->x < 0 ||
+ pDraw->x + stuff->x + (int) stuff->width > pDraw->pScreen->width
+ || pDraw->y + stuff->y < 0 ||
+ pDraw->y + stuff->y + (int) stuff->height >
+ pDraw->pScreen->height ||
+ /* check for being inside of border */
+ stuff->x < -wBorderWidth((WindowPtr) pDraw) ||
+ stuff->x + (int) stuff->width >
+ wBorderWidth((WindowPtr) pDraw) + (int) pDraw->width ||
+ stuff->y < -wBorderWidth((WindowPtr) pDraw) ||
+ stuff->y + (int) stuff->height >
+ wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
+ return BadMatch;
+ xgi.visual = wVisual(((WindowPtr) pDraw));
}
- else
- {
- if (stuff->x < 0 ||
- stuff->x+(int)stuff->width > pDraw->width ||
- stuff->y < 0 ||
- stuff->y+(int)stuff->height > pDraw->height
- )
- return BadMatch;
- xgi.visual = None;
+ else {
+ if (stuff->x < 0 ||
+ stuff->x + (int) stuff->width > pDraw->width ||
+ stuff->y < 0 || stuff->y + (int) stuff->height > pDraw->height)
+ return BadMatch;
+ xgi.visual = None;
}
xgi.type = X_Reply;
xgi.length = 0;
xgi.sequenceNumber = client->sequence;
xgi.depth = pDraw->depth;
- if(stuff->format == ZPixmap)
- {
- length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
+ if (stuff->format == ZPixmap) {
+ length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
}
- 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)));
+ 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)));
}
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
xgi.size = length;
- if (length == 0)
- {
- /* nothing to do */
+ if (length == 0) {
+ /* nothing to do */
}
- else if (stuff->format == ZPixmap)
- {
- (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
- stuff->width, stuff->height,
- stuff->format, stuff->planeMask,
- shmdesc->addr + stuff->offset);
+ else if (stuff->format == ZPixmap) {
+ (*pDraw->pScreen->GetImage) (pDraw, stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ stuff->format, stuff->planeMask,
+ shmdesc->addr + stuff->offset);
}
- else
- {
+ else {
- length = stuff->offset;
- for (; plane; plane >>= 1)
- {
- if (stuff->planeMask & plane)
- {
- (*pDraw->pScreen->GetImage)(pDraw,
- stuff->x, stuff->y,
- stuff->width, stuff->height,
- stuff->format, plane,
- shmdesc->addr + length);
- length += lenPer;
- }
- }
+ length = stuff->offset;
+ for (; plane; plane >>= 1) {
+ if (stuff->planeMask & plane) {
+ (*pDraw->pScreen->GetImage) (pDraw,
+ stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ stuff->format, plane,
+ shmdesc->addr + length);
+ length += lenPer;
+ }
+ }
}
if (client->swapped) {
- swaps(&xgi.sequenceNumber);
- swapl(&xgi.length);
- swapl(&xgi.visual);
- swapl(&xgi.size);
+ swaps(&xgi.sequenceNumber);
+ swapl(&xgi.length);
+ swapl(&xgi.visual);
+ swapl(&xgi.size);
}
- WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
+ WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi);
return Success;
}
#ifdef PANORAMIX
-static int
+static int
ProcPanoramiXShmPutImage(ClientPtr client)
{
- int j, result, orig_x, orig_y;
- PanoramiXRes *draw, *gc;
- Bool sendEvent, isRoot;
+ int j, result, orig_x, orig_y;
+ PanoramiXRes *draw, *gc;
+ Bool sendEvent, isRoot;
REQUEST(xShmPutImageReq);
REQUEST_SIZE_MATCH(xShmPutImageReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
- XRT_GC, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
+ XRT_GC, client, DixReadAccess);
if (result != Success)
return result;
@@ -783,53 +754,54 @@ ProcPanoramiXShmPutImage(ClientPtr client)
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 - screenInfo.screens[j]->x;
- stuff->dstY = orig_y - screenInfo.screens[j]->y;
- }
- result = ProcShmPutImage(client);
- if(result != Success) break;
+ if (!j)
+ stuff->sendEvent = sendEvent;
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
+ stuff->dstX = orig_x - screenInfo.screens[j]->x;
+ stuff->dstY = orig_y - screenInfo.screens[j]->y;
+ }
+ result = ProcShmPutImage(client);
+ if (result != Success)
+ break;
}
return result;
}
-static int
+static int
ProcPanoramiXShmGetImage(ClientPtr client)
{
- PanoramiXRes *draw;
- DrawablePtr *drawables;
- DrawablePtr pDraw;
- xShmGetImageReply xgi;
- ShmDescPtr shmdesc;
- int i, x, y, w, h, format, rc;
- Mask plane = 0, planemask;
- long lenPer = 0, length, widthBytesLine;
- Bool isRoot;
+ PanoramiXRes *draw;
+ DrawablePtr *drawables;
+ DrawablePtr pDraw;
+ xShmGetImageReply xgi;
+ ShmDescPtr shmdesc;
+ int i, x, y, w, h, format, rc;
+ 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;
+ client->errorValue = stuff->format;
return BadValue;
}
- rc = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (rc != Success)
- return (rc == BadValue) ? BadDrawable : rc;
+ return (rc == BadValue) ? BadDrawable : rc;
if (draw->type == XRT_PIXMAP)
- return ProcShmGetImage(client);
+ return ProcShmGetImage(client);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
@@ -842,85 +814,89 @@ ProcPanoramiXShmGetImage(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
- 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 */
- screenInfo.screens[0]->x + pDraw->x + x < 0 ||
- screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
- screenInfo.screens[0]->y + pDraw->y + y < 0 ||
- screenInfo.screens[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;
+ 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 */
+ screenInfo.screens[0]->x + pDraw->x + x < 0 ||
+ screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth
+ || screenInfo.screens[0]->y + pDraw->y + y < 0 ||
+ screenInfo.screens[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 = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
- if(!drawables)
- return BadAlloc;
+ if (!drawables)
+ return BadAlloc;
drawables[0] = pDraw;
FOR_NSCREENS_FORWARD_SKIP(i) {
- rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
- DixReadAccess);
- if (rc != Success)
- {
- free(drawables);
- return rc;
- }
+ rc = dixLookupDrawable(drawables + i, draw->info[i].id, client, 0,
+ DixReadAccess);
+ if (rc != Success) {
+ free(drawables);
+ return rc;
+ }
}
- xgi.visual = wVisual(((WindowPtr)pDraw));
+ 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)));
+ 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 */ }
+ 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 {
+ XineramaGetImageData(drawables, x, y, w, h, format, planemask,
+ shmdesc->addr + stuff->offset,
+ widthBytesLine, isRoot);
+ }
+ else {
- length = stuff->offset;
+ 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 (planemask & plane) {
+ XineramaGetImageData(drawables, x, y, w, h,
+ format, plane, shmdesc->addr + length,
+ widthBytesLine, isRoot);
+ length += lenPer;
+ }
+ }
}
free(drawables);
-
+
if (client->swapped) {
- swaps(&xgi.sequenceNumber);
- swapl(&xgi.length);
- swapl(&xgi.visual);
- swapl(&xgi.size);
+ swaps(&xgi.sequenceNumber);
+ swapl(&xgi.length);
+ swapl(&xgi.visual);
+ swapl(&xgi.size);
}
- WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
+ WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi);
return Success;
}
@@ -934,6 +910,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
DepthPtr pDepth;
int i, j, result, rc;
ShmDescPtr shmdesc;
+
REQUEST(xShmCreatePixmapReq);
unsigned int width, height, depth;
unsigned long size;
@@ -942,37 +919,35 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
client->errorValue = stuff->pid;
if (!sharedPixmaps)
- return BadImplementation;
+ return BadImplementation;
LEGAL_NEW_RESOURCE(stuff->pid, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
width = stuff->width;
height = stuff->height;
depth = stuff->depth;
- if (!width || !height || !depth)
- {
- client->errorValue = 0;
+ if (!width || !height || !depth) {
+ client->errorValue = 0;
return BadValue;
}
if (width > 32767 || height > 32767)
return BadAlloc;
- if (stuff->depth != 1)
- {
+ 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;
+ for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
+ if (pDepth->depth == stuff->depth)
+ goto CreatePmap;
+ client->errorValue = stuff->depth;
return BadValue;
}
-CreatePmap:
+ CreatePmap:
size = PixmapBytePad(width, depth) * height;
if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) {
if (size < width * height)
@@ -980,12 +955,12 @@ CreatePmap:
}
/* thankfully, offset is unsigned */
if (stuff->offset + size < size)
- return BadAlloc;
+ return BadAlloc;
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
- if(!(newPix = malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPix = malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPix->type = XRT_PIXMAP;
newPix->u.pix.shared = TRUE;
@@ -994,54 +969,62 @@ CreatePmap:
result = Success;
FOR_NSCREENS(j) {
- ShmScrPrivateRec *screen_priv;
- pScreen = screenInfo.screens[j];
+ ShmScrPrivateRec *screen_priv;
+
+ pScreen = screenInfo.screens[j];
- screen_priv = ShmGetScreenPriv(pScreen);
- pMap = (*screen_priv->shmFuncs->CreatePixmap)(pScreen,
- stuff->width, stuff->height, stuff->depth,
- shmdesc->addr + stuff->offset);
+ screen_priv = ShmGetScreenPriv(pScreen);
+ pMap = (*screen_priv->shmFuncs->CreatePixmap) (pScreen,
+ stuff->width,
+ stuff->height,
+ stuff->depth,
+ shmdesc->addr +
+ stuff->offset);
- if (pMap) {
- dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
+ if (pMap) {
+ dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
shmdesc->refcnt++;
- pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pMap->drawable.id = newPix->info[j].id;
- if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer)pMap)) {
- result = BadAlloc;
- break;
- }
- } else {
- result = BadAlloc;
- break;
- }
+ pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pMap->drawable.id = newPix->info[j].id;
+ if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer) pMap)) {
+ result = BadAlloc;
+ break;
+ }
+ }
+ else {
+ result = BadAlloc;
+ break;
+ }
}
- if(result == BadAlloc) {
- while(j--)
- FreeResource(newPix->info[j].id, RT_NONE);
- free(newPix);
- } else
- AddResource(stuff->pid, XRT_PIXMAP, newPix);
+ if (result == BadAlloc) {
+ while (j--)
+ FreeResource(newPix->info[j].id, RT_NONE);
+ free(newPix);
+ }
+ else
+ AddResource(stuff->pid, XRT_PIXMAP, newPix);
return result;
}
#endif
static PixmapPtr
-fbShmCreatePixmap (ScreenPtr pScreen,
- int width, int height, int depth, char *addr)
+fbShmCreatePixmap(ScreenPtr pScreen,
+ int width, int height, int depth, char *addr)
{
PixmapPtr pPixmap;
- pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0);
if (!pPixmap)
- return NullPixmap;
-
- if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
- BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
- (*pScreen->DestroyPixmap)(pPixmap);
- return NullPixmap;
+ return NullPixmap;
+
+ if (!(*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth,
+ BitsPerPixel(depth),
+ PixmapBytePad(width, depth),
+ (pointer) addr)) {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return NullPixmap;
}
return pPixmap;
}
@@ -1055,6 +1038,7 @@ ProcShmCreatePixmap(ClientPtr client)
int i, rc;
ShmDescPtr shmdesc;
ShmScrPrivateRec *screen_priv;
+
REQUEST(xShmCreatePixmapReq);
unsigned int width, height, depth;
unsigned long size;
@@ -1062,109 +1046,104 @@ ProcShmCreatePixmap(ClientPtr client)
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
client->errorValue = stuff->pid;
if (!sharedPixmaps)
- return BadImplementation;
+ return BadImplementation;
LEGAL_NEW_RESOURCE(stuff->pid, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
-
+
width = stuff->width;
height = stuff->height;
depth = stuff->depth;
- if (!width || !height || !depth)
- {
- client->errorValue = 0;
+ if (!width || !height || !depth) {
+ client->errorValue = 0;
return BadValue;
}
if (width > 32767 || height > 32767)
- return BadAlloc;
+ return BadAlloc;
- if (stuff->depth != 1)
- {
+ 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;
+ for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
+ if (pDepth->depth == stuff->depth)
+ goto CreatePmap;
+ client->errorValue = stuff->depth;
return BadValue;
}
-CreatePmap:
+ CreatePmap:
size = PixmapBytePad(width, depth) * height;
if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) {
- if (size < width * height)
- return BadAlloc;
+ if (size < width * height)
+ return BadAlloc;
}
/* thankfully, offset is unsigned */
if (stuff->offset + size < size)
- return BadAlloc;
+ return BadAlloc;
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
screen_priv = ShmGetScreenPriv(pDraw->pScreen);
- pMap = (*screen_priv->shmFuncs->CreatePixmap)(
- pDraw->pScreen, stuff->width,
- stuff->height, stuff->depth,
- shmdesc->addr + stuff->offset);
- if (pMap)
- {
- rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
- pMap, RT_NONE, NULL, DixCreateAccess);
- if (rc != Success) {
- pDraw->pScreen->DestroyPixmap(pMap);
- return rc;
- }
- dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
- shmdesc->refcnt++;
- pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pMap->drawable.id = stuff->pid;
- if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
- {
- return Success;
- }
+ pMap = (*screen_priv->shmFuncs->CreatePixmap) (pDraw->pScreen, stuff->width,
+ stuff->height, stuff->depth,
+ shmdesc->addr +
+ stuff->offset);
+ if (pMap) {
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
+ pMap, RT_NONE, NULL, DixCreateAccess);
+ if (rc != Success) {
+ pDraw->pScreen->DestroyPixmap(pMap);
+ return rc;
+ }
+ dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
+ shmdesc->refcnt++;
+ pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pMap->drawable.id = stuff->pid;
+ if (AddResource(stuff->pid, RT_PIXMAP, (pointer) pMap)) {
+ return Success;
+ }
}
return BadAlloc;
}
static int
-ProcShmDispatch (ClientPtr client)
+ProcShmDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_ShmQueryVersion:
- return ProcShmQueryVersion(client);
+ return ProcShmQueryVersion(client);
case X_ShmAttach:
- return ProcShmAttach(client);
+ return ProcShmAttach(client);
case X_ShmDetach:
- return ProcShmDetach(client);
+ return ProcShmDetach(client);
case X_ShmPutImage:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShmPutImage(client);
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShmPutImage(client);
#endif
- return ProcShmPutImage(client);
+ return ProcShmPutImage(client);
case X_ShmGetImage:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShmGetImage(client);
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShmGetImage(client);
#endif
- return ProcShmGetImage(client);
+ return ProcShmGetImage(client);
case X_ShmCreatePixmap:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShmCreatePixmap(client);
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShmCreatePixmap(client);
#endif
- return ProcShmCreatePixmap(client);
+ return ProcShmCreatePixmap(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
static void
-SShmCompletionEvent(xShmCompletionEvent *from, xShmCompletionEvent *to)
+SShmCompletionEvent(xShmCompletionEvent * from, xShmCompletionEvent * to)
{
to->type = from->type;
cpswaps(from->sequenceNumber, to->sequenceNumber);
@@ -1259,25 +1238,24 @@ SProcShmCreatePixmap(ClientPtr client)
}
static int
-SProcShmDispatch (ClientPtr client)
+SProcShmDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_ShmQueryVersion:
- return SProcShmQueryVersion(client);
+ return SProcShmQueryVersion(client);
case X_ShmAttach:
- return SProcShmAttach(client);
+ return SProcShmAttach(client);
case X_ShmDetach:
- return SProcShmDetach(client);
+ return SProcShmDetach(client);
case X_ShmPutImage:
- return SProcShmPutImage(client);
+ return SProcShmPutImage(client);
case X_ShmGetImage:
- return SProcShmGetImage(client);
+ return SProcShmGetImage(client);
case X_ShmCreatePixmap:
- return SProcShmCreatePixmap(client);
+ return SProcShmCreatePixmap(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
@@ -1288,45 +1266,44 @@ ShmExtensionInit(INITARGS)
int i;
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
- if (!CheckForShmSyscall())
- {
- ErrorF("MIT-SHM extension disabled due to lack of kernel support\n");
- return;
+ if (!CheckForShmSyscall()) {
+ ErrorF("MIT-SHM extension disabled due to lack of kernel support\n");
+ return;
}
#endif
if (!ShmRegisterPrivates())
- return;
+ return;
sharedPixmaps = xFalse;
{
- sharedPixmaps = xTrue;
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ShmScrPrivateRec *screen_priv = ShmInitScreenPriv(screenInfo.screens[i]);
- if (!screen_priv->shmFuncs)
- screen_priv->shmFuncs = &miFuncs;
- if (!screen_priv->shmFuncs->CreatePixmap)
- sharedPixmaps = xFalse;
- }
- if (sharedPixmaps)
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(screenInfo.screens[i]);
- screen_priv->destroyPixmap = screenInfo.screens[i]->DestroyPixmap;
- screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
- }
+ sharedPixmaps = xTrue;
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ShmScrPrivateRec *screen_priv =
+ ShmInitScreenPriv(screenInfo.screens[i]);
+ if (!screen_priv->shmFuncs)
+ screen_priv->shmFuncs = &miFuncs;
+ if (!screen_priv->shmFuncs->CreatePixmap)
+ sharedPixmaps = xFalse;
+ }
+ if (sharedPixmaps)
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ShmScrPrivateRec *screen_priv =
+ ShmGetScreenPriv(screenInfo.screens[i]);
+ screen_priv->destroyPixmap =
+ screenInfo.screens[i]->DestroyPixmap;
+ screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
+ }
}
ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg");
if (ShmSegType &&
- (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
- ProcShmDispatch, SProcShmDispatch,
- ShmResetProc, StandardMinorOpcode)))
- {
- ShmReqCode = (unsigned char)extEntry->base;
- ShmCompletionCode = extEntry->eventBase;
- BadShmSegCode = extEntry->errorBase;
- SetResourceTypeErrorValue(ShmSegType, BadShmSegCode);
- EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent;
+ (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
+ ProcShmDispatch, SProcShmDispatch,
+ ShmResetProc, StandardMinorOpcode))) {
+ ShmReqCode = (unsigned char) extEntry->base;
+ ShmCompletionCode = extEntry->eventBase;
+ BadShmSegCode = extEntry->errorBase;
+ SetResourceTypeErrorValue(ShmSegType, BadShmSegCode);
+ EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent;
}
}
diff --git a/xorg-server/Xext/sleepuntil.c b/xorg-server/Xext/sleepuntil.c
index 69945585d..52e22b4a6 100644
--- a/xorg-server/Xext/sleepuntil.c
+++ b/xorg-server/Xext/sleepuntil.c
@@ -1,225 +1,209 @@
-/*
- *
-Copyright 1992, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
- *
- * Author: Keith Packard, MIT X Consortium
- */
-
-/* dixsleep.c - implement millisecond timeouts for X clients */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "sleepuntil.h"
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "misc.h"
-#include "windowstr.h"
-#include "dixstruct.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-typedef struct _Sertafied {
- struct _Sertafied *next;
- TimeStamp revive;
- ClientPtr pClient;
- XID id;
- void (*notifyFunc)(
- ClientPtr /* client */,
- pointer /* closure */
- );
-
- pointer closure;
-} SertafiedRec, *SertafiedPtr;
-
-static SertafiedPtr pPending;
-static RESTYPE SertafiedResType;
-static Bool BlockHandlerRegistered;
-static int SertafiedGeneration;
-
-static void ClientAwaken(
- ClientPtr /* client */,
- pointer /* closure */
-);
-static int SertafiedDelete(
- pointer /* value */,
- XID /* id */
-);
-static void SertafiedBlockHandler(
- pointer /* data */,
- OSTimePtr /* wt */,
- pointer /* LastSelectMask */
-);
-static void SertafiedWakeupHandler(
- pointer /* data */,
- int /* i */,
- pointer /* LastSelectMask */
-);
-
-int
-ClientSleepUntil (ClientPtr client,
- TimeStamp *revive,
- void (*notifyFunc)(ClientPtr, pointer),
- pointer closure)
-{
- SertafiedPtr pRequest, pReq, pPrev;
-
- if (SertafiedGeneration != serverGeneration)
- {
- SertafiedResType = CreateNewResourceType (SertafiedDelete,
- "ClientSleep");
- if (!SertafiedResType)
- return FALSE;
- SertafiedGeneration = serverGeneration;
- BlockHandlerRegistered = FALSE;
- }
- pRequest = malloc(sizeof (SertafiedRec));
- if (!pRequest)
- return FALSE;
- pRequest->pClient = client;
- pRequest->revive = *revive;
- pRequest->id = FakeClientID (client->index);
- pRequest->closure = closure;
- if (!BlockHandlerRegistered)
- {
- if (!RegisterBlockAndWakeupHandlers (SertafiedBlockHandler,
- SertafiedWakeupHandler,
- (pointer) 0))
- {
- free(pRequest);
- return FALSE;
- }
- BlockHandlerRegistered = TRUE;
- }
- pRequest->notifyFunc = 0;
- if (!AddResource (pRequest->id, SertafiedResType, (pointer) pRequest))
- return FALSE;
- if (!notifyFunc)
- notifyFunc = ClientAwaken;
- pRequest->notifyFunc = notifyFunc;
- /* Insert into time-ordered queue, with earliest activation time coming first. */
- pPrev = 0;
- for (pReq = pPending; pReq; pReq = pReq->next)
- {
- if (CompareTimeStamps (pReq->revive, *revive) == LATER)
- break;
- pPrev = pReq;
- }
- if (pPrev)
- pPrev->next = pRequest;
- else
- pPending = pRequest;
- pRequest->next = pReq;
- IgnoreClient (client);
- return TRUE;
-}
-
-static void
-ClientAwaken (ClientPtr client, pointer closure)
-{
- if (!client->clientGone)
- AttendClient (client);
-}
-
-
-static int
-SertafiedDelete (pointer value, XID id)
-{
- SertafiedPtr pRequest = (SertafiedPtr)value;
- SertafiedPtr pReq, pPrev;
-
- pPrev = 0;
- for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next)
- if (pReq == pRequest)
- {
- if (pPrev)
- pPrev->next = pReq->next;
- else
- pPending = pReq->next;
- break;
- }
- if (pRequest->notifyFunc)
- (*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
- free(pRequest);
- return TRUE;
-}
-
-static void
-SertafiedBlockHandler (pointer data, OSTimePtr wt, pointer LastSelectMask)
-{
- SertafiedPtr pReq, pNext;
- unsigned long delay;
- TimeStamp now;
-
- if (!pPending)
- return;
- now.milliseconds = GetTimeInMillis ();
- now.months = currentTime.months;
- if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
- now.months++;
- for (pReq = pPending; pReq; pReq = pNext)
- {
- pNext = pReq->next;
- if (CompareTimeStamps (pReq->revive, now) == LATER)
- break;
- FreeResource (pReq->id, RT_NONE);
-
- /* AttendClient() may have been called via the resource delete
- * function so a client may have input to be processed and so
- * set delay to 0 to prevent blocking in WaitForSomething().
- */
- AdjustWaitForDelay (wt, 0);
- }
- pReq = pPending;
- if (!pReq)
- return;
- delay = pReq->revive.milliseconds - now.milliseconds;
- AdjustWaitForDelay (wt, delay);
-}
-
-static void
-SertafiedWakeupHandler (pointer data, int i, pointer LastSelectMask)
-{
- SertafiedPtr pReq, pNext;
- TimeStamp now;
-
- now.milliseconds = GetTimeInMillis ();
- now.months = currentTime.months;
- if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
- now.months++;
- for (pReq = pPending; pReq; pReq = pNext)
- {
- pNext = pReq->next;
- if (CompareTimeStamps (pReq->revive, now) == LATER)
- break;
- FreeResource (pReq->id, RT_NONE);
- }
- if (!pPending)
- {
- RemoveBlockAndWakeupHandlers (SertafiedBlockHandler,
- SertafiedWakeupHandler,
- (pointer) 0);
- BlockHandlerRegistered = FALSE;
- }
-}
+/*
+ *
+Copyright 1992, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+/* dixsleep.c - implement millisecond timeouts for X clients */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "sleepuntil.h"
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include "misc.h"
+#include "windowstr.h"
+#include "dixstruct.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+typedef struct _Sertafied {
+ struct _Sertafied *next;
+ TimeStamp revive;
+ ClientPtr pClient;
+ XID id;
+ void (*notifyFunc) (ClientPtr /* client */ ,
+ pointer /* closure */
+ );
+
+ pointer closure;
+} SertafiedRec, *SertafiedPtr;
+
+static SertafiedPtr pPending;
+static RESTYPE SertafiedResType;
+static Bool BlockHandlerRegistered;
+static int SertafiedGeneration;
+
+static void ClientAwaken(ClientPtr /* client */ ,
+ pointer /* closure */
+ );
+static int SertafiedDelete(pointer /* value */ ,
+ XID /* id */
+ );
+static void SertafiedBlockHandler(pointer /* data */ ,
+ OSTimePtr /* wt */ ,
+ pointer /* LastSelectMask */
+ );
+static void SertafiedWakeupHandler(pointer /* data */ ,
+ int /* i */ ,
+ pointer /* LastSelectMask */
+ );
+
+int
+ClientSleepUntil(ClientPtr client,
+ TimeStamp *revive,
+ void (*notifyFunc) (ClientPtr, pointer), pointer closure)
+{
+ SertafiedPtr pRequest, pReq, pPrev;
+
+ if (SertafiedGeneration != serverGeneration) {
+ SertafiedResType = CreateNewResourceType(SertafiedDelete,
+ "ClientSleep");
+ if (!SertafiedResType)
+ return FALSE;
+ SertafiedGeneration = serverGeneration;
+ BlockHandlerRegistered = FALSE;
+ }
+ pRequest = malloc(sizeof(SertafiedRec));
+ if (!pRequest)
+ return FALSE;
+ pRequest->pClient = client;
+ pRequest->revive = *revive;
+ pRequest->id = FakeClientID(client->index);
+ pRequest->closure = closure;
+ if (!BlockHandlerRegistered) {
+ if (!RegisterBlockAndWakeupHandlers(SertafiedBlockHandler,
+ SertafiedWakeupHandler,
+ (pointer) 0)) {
+ free(pRequest);
+ return FALSE;
+ }
+ BlockHandlerRegistered = TRUE;
+ }
+ pRequest->notifyFunc = 0;
+ if (!AddResource(pRequest->id, SertafiedResType, (pointer) pRequest))
+ return FALSE;
+ if (!notifyFunc)
+ notifyFunc = ClientAwaken;
+ pRequest->notifyFunc = notifyFunc;
+ /* Insert into time-ordered queue, with earliest activation time coming first. */
+ pPrev = 0;
+ for (pReq = pPending; pReq; pReq = pReq->next) {
+ if (CompareTimeStamps(pReq->revive, *revive) == LATER)
+ break;
+ pPrev = pReq;
+ }
+ if (pPrev)
+ pPrev->next = pRequest;
+ else
+ pPending = pRequest;
+ pRequest->next = pReq;
+ IgnoreClient(client);
+ return TRUE;
+}
+
+static void
+ClientAwaken(ClientPtr client, pointer closure)
+{
+ if (!client->clientGone)
+ AttendClient(client);
+}
+
+static int
+SertafiedDelete(pointer value, XID id)
+{
+ SertafiedPtr pRequest = (SertafiedPtr) value;
+ SertafiedPtr pReq, pPrev;
+
+ pPrev = 0;
+ for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next)
+ if (pReq == pRequest) {
+ if (pPrev)
+ pPrev->next = pReq->next;
+ else
+ pPending = pReq->next;
+ break;
+ }
+ if (pRequest->notifyFunc)
+ (*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
+ free(pRequest);
+ return TRUE;
+}
+
+static void
+SertafiedBlockHandler(pointer data, OSTimePtr wt, pointer LastSelectMask)
+{
+ SertafiedPtr pReq, pNext;
+ unsigned long delay;
+ TimeStamp now;
+
+ if (!pPending)
+ return;
+ now.milliseconds = GetTimeInMillis();
+ now.months = currentTime.months;
+ if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
+ now.months++;
+ for (pReq = pPending; pReq; pReq = pNext) {
+ pNext = pReq->next;
+ if (CompareTimeStamps(pReq->revive, now) == LATER)
+ break;
+ FreeResource(pReq->id, RT_NONE);
+
+ /* AttendClient() may have been called via the resource delete
+ * function so a client may have input to be processed and so
+ * set delay to 0 to prevent blocking in WaitForSomething().
+ */
+ AdjustWaitForDelay(wt, 0);
+ }
+ pReq = pPending;
+ if (!pReq)
+ return;
+ delay = pReq->revive.milliseconds - now.milliseconds;
+ AdjustWaitForDelay(wt, delay);
+}
+
+static void
+SertafiedWakeupHandler(pointer data, int i, pointer LastSelectMask)
+{
+ SertafiedPtr pReq, pNext;
+ TimeStamp now;
+
+ now.milliseconds = GetTimeInMillis();
+ now.months = currentTime.months;
+ if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
+ now.months++;
+ for (pReq = pPending; pReq; pReq = pNext) {
+ pNext = pReq->next;
+ if (CompareTimeStamps(pReq->revive, now) == LATER)
+ break;
+ FreeResource(pReq->id, RT_NONE);
+ }
+ if (!pPending) {
+ RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,
+ SertafiedWakeupHandler, (pointer) 0);
+ BlockHandlerRegistered = FALSE;
+ }
+}
diff --git a/xorg-server/Xext/sleepuntil.h b/xorg-server/Xext/sleepuntil.h
index a3618d99c..5c7084842 100644
--- a/xorg-server/Xext/sleepuntil.h
+++ b/xorg-server/Xext/sleepuntil.h
@@ -33,14 +33,10 @@
#include "dix.h"
-extern int ClientSleepUntil(
- ClientPtr client,
- TimeStamp *revive,
- void (*notifyFunc)(
- ClientPtr /* client */,
- pointer /* closure */
- ),
- pointer Closure
-);
+extern int ClientSleepUntil(ClientPtr client,
+ TimeStamp *revive,
+ void (*notifyFunc) (ClientPtr /* client */ ,
+ pointer /* closure */
+ ), pointer Closure);
#endif
diff --git a/xorg-server/Xext/sync.c b/xorg-server/Xext/sync.c
index 830552381..44e2b12eb 100644
--- a/xorg-server/Xext/sync.c
+++ b/xorg-server/Xext/sync.c
@@ -24,7 +24,6 @@ not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
-
Copyright 1991, 1993 by Digital Equipment Corporation, Maynard, Massachusetts,
and Olivetti Research Limited, Cambridge, England.
@@ -70,6 +69,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include "syncsrv.h"
#include "syncsdk.h"
#include "protocol-versions.h"
+#include "inputstr.h"
#include <stdio.h>
#if !defined(WIN32)
@@ -81,25 +81,25 @@ PERFORMANCE OF THIS SOFTWARE.
/*
* Local Global Variables
*/
-static int SyncEventBase;
-static int SyncErrorBase;
-static RESTYPE RTCounter = 0;
-static RESTYPE RTAwait;
-static RESTYPE RTAlarm;
-static RESTYPE RTAlarmClient;
-static RESTYPE RTFence;
-static int SyncNumSystemCounters = 0;
-static SyncCounter **SysCounterList = NULL;
+static int SyncEventBase;
+static int SyncErrorBase;
+static RESTYPE RTCounter = 0;
+static RESTYPE RTAwait;
+static RESTYPE RTAlarm;
+static RESTYPE RTAlarmClient;
+static RESTYPE RTFence;
+static struct xorg_list SysCounterList;
static int SyncNumInvalidCounterWarnings = 0;
+
#define MAX_INVALID_COUNTER_WARNINGS 5
static const char *WARN_INVALID_COUNTER_COMPARE =
-"Warning: Non-counter XSync object using Counter-only\n"
-" comparison. Result will never be true.\n";
+ "Warning: Non-counter XSync object using Counter-only\n"
+ " comparison. Result will never be true.\n";
static const char *WARN_INVALID_COUNTER_ALARM =
-"Warning: Non-counter XSync object used in alarm. This is\n"
-" the result of a programming error in the X server.\n";
+ "Warning: Non-counter XSync object used in alarm. This is\n"
+ " the result of a programming error in the X server.\n";
#define IsSystemCounter(pCounter) \
(pCounter && (pCounter->sync.client == NULL))
@@ -114,18 +114,24 @@ static void SyncInitServerTime(void);
static void SyncInitIdleTime(void);
+static inline void*
+SysCounterGetPrivate(SyncCounter *counter)
+{
+ BUG_WARN(!IsSystemCounter(counter));
+
+ return counter->pSysCounterInfo ? counter->pSysCounterInfo->private : NULL;
+}
+
static Bool
-SyncCheckWarnIsCounter(const SyncObject* pSync, const char *warning)
+SyncCheckWarnIsCounter(const SyncObject * pSync, const char *warning)
{
- if (pSync && (SYNC_COUNTER != pSync->type))
- {
- if (SyncNumInvalidCounterWarnings++ < MAX_INVALID_COUNTER_WARNINGS)
- {
- ErrorF("%s", warning);
- ErrorF(" Counter type: %d\n", pSync->type);
- }
+ if (pSync && (SYNC_COUNTER != pSync->type)) {
+ if (SyncNumInvalidCounterWarnings++ < MAX_INVALID_COUNTER_WARNINGS) {
+ ErrorF("%s", warning);
+ ErrorF(" Counter type: %d\n", pSync->type);
+ }
- return FALSE;
+ return FALSE;
}
return TRUE;
@@ -136,7 +142,7 @@ SyncCheckWarnIsCounter(const SyncObject* pSync, const char *warning)
* delete and add triggers on this list.
*/
static void
-SyncDeleteTriggerFromSyncObject(SyncTrigger *pTrigger)
+SyncDeleteTriggerFromSyncObject(SyncTrigger * pTrigger)
{
SyncTriggerList *pCur;
SyncTriggerList *pPrev;
@@ -145,79 +151,76 @@ SyncDeleteTriggerFromSyncObject(SyncTrigger *pTrigger)
/* pSync needs to be stored in pTrigger before calling here. */
if (!pTrigger->pSync)
- return;
+ return;
pPrev = NULL;
pCur = pTrigger->pSync->pTriglist;
- while (pCur)
- {
- if (pCur->pTrigger == pTrigger)
- {
- if (pPrev)
- pPrev->next = pCur->next;
- else
- pTrigger->pSync->pTriglist = pCur->next;
+ while (pCur) {
+ if (pCur->pTrigger == pTrigger) {
+ if (pPrev)
+ pPrev->next = pCur->next;
+ else
+ pTrigger->pSync->pTriglist = pCur->next;
+
+ free(pCur);
+ break;
+ }
- free(pCur);
- break;
- }
-
- pPrev = pCur;
- pCur = pCur->next;
+ pPrev = pCur;
+ pCur = pCur->next;
}
- if (SYNC_COUNTER == pTrigger->pSync->type)
- {
- pCounter = (SyncCounter *)pTrigger->pSync;
+ if (SYNC_COUNTER == pTrigger->pSync->type) {
+ pCounter = (SyncCounter *) pTrigger->pSync;
- if (IsSystemCounter(pCounter))
- SyncComputeBracketValues(pCounter);
- } else if (SYNC_FENCE == pTrigger->pSync->type) {
- SyncFence* pFence = (SyncFence*) pTrigger->pSync;
- pFence->funcs.DeleteTrigger(pTrigger);
+ if (IsSystemCounter(pCounter))
+ SyncComputeBracketValues(pCounter);
}
-}
+ else if (SYNC_FENCE == pTrigger->pSync->type) {
+ SyncFence *pFence = (SyncFence *) pTrigger->pSync;
+ pFence->funcs.DeleteTrigger(pTrigger);
+ }
+}
static int
-SyncAddTriggerToSyncObject(SyncTrigger *pTrigger)
+SyncAddTriggerToSyncObject(SyncTrigger * pTrigger)
{
SyncTriggerList *pCur;
SyncCounter *pCounter;
if (!pTrigger->pSync)
- return Success;
+ return Success;
/* don't do anything if it's already there */
- for (pCur = pTrigger->pSync->pTriglist; pCur; pCur = pCur->next)
- {
- if (pCur->pTrigger == pTrigger)
- return Success;
+ for (pCur = pTrigger->pSync->pTriglist; pCur; pCur = pCur->next) {
+ if (pCur->pTrigger == pTrigger)
+ return Success;
}
if (!(pCur = malloc(sizeof(SyncTriggerList))))
- return BadAlloc;
+ return BadAlloc;
pCur->pTrigger = pTrigger;
pCur->next = pTrigger->pSync->pTriglist;
pTrigger->pSync->pTriglist = pCur;
- if (SYNC_COUNTER == pTrigger->pSync->type)
- {
- pCounter = (SyncCounter *)pTrigger->pSync;
+ if (SYNC_COUNTER == pTrigger->pSync->type) {
+ pCounter = (SyncCounter *) pTrigger->pSync;
+
+ if (IsSystemCounter(pCounter))
+ SyncComputeBracketValues(pCounter);
+ }
+ else if (SYNC_FENCE == pTrigger->pSync->type) {
+ SyncFence *pFence = (SyncFence *) pTrigger->pSync;
- if (IsSystemCounter(pCounter))
- SyncComputeBracketValues(pCounter);
- } else if (SYNC_FENCE == pTrigger->pSync->type) {
- SyncFence* pFence = (SyncFence*) pTrigger->pSync;
- pFence->funcs.AddTrigger(pTrigger);
+ pFence->funcs.AddTrigger(pTrigger);
}
return Success;
}
-
/* Below are five possible functions that can be plugged into
* pTrigger->CheckTrigger for counter sync objects, corresponding to
* the four possible test-types, and the one possible function that
@@ -234,194 +237,182 @@ SyncAddTriggerToSyncObject(SyncTrigger *pTrigger)
*/
static Bool
-SyncCheckTriggerPositiveComparison(SyncTrigger *pTrigger, CARD64 oldval)
+SyncCheckTriggerPositiveComparison(SyncTrigger * pTrigger, CARD64 oldval)
{
SyncCounter *pCounter;
/* Non-counter sync objects should never get here because they
* never trigger this comparison. */
if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE))
- return FALSE;
+ return FALSE;
- pCounter = (SyncCounter *)pTrigger->pSync;
+ pCounter = (SyncCounter *) pTrigger->pSync;
return (pCounter == NULL ||
- XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value));
+ XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value));
}
static Bool
-SyncCheckTriggerNegativeComparison(SyncTrigger *pTrigger, CARD64 oldval)
+SyncCheckTriggerNegativeComparison(SyncTrigger * pTrigger, CARD64 oldval)
{
SyncCounter *pCounter;
/* Non-counter sync objects should never get here because they
* never trigger this comparison. */
if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE))
- return FALSE;
+ return FALSE;
- pCounter = (SyncCounter *)pTrigger->pSync;
+ pCounter = (SyncCounter *) pTrigger->pSync;
return (pCounter == NULL ||
- XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value));
+ XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value));
}
static Bool
-SyncCheckTriggerPositiveTransition(SyncTrigger *pTrigger, CARD64 oldval)
+SyncCheckTriggerPositiveTransition(SyncTrigger * pTrigger, CARD64 oldval)
{
SyncCounter *pCounter;
/* Non-counter sync objects should never get here because they
* never trigger this comparison. */
if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE))
- return FALSE;
+ return FALSE;
- pCounter = (SyncCounter *)pTrigger->pSync;
+ pCounter = (SyncCounter *) pTrigger->pSync;
return (pCounter == NULL ||
- (XSyncValueLessThan(oldval, pTrigger->test_value) &&
- XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value)));
+ (XSyncValueLessThan(oldval, pTrigger->test_value) &&
+ XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value)));
}
static Bool
-SyncCheckTriggerNegativeTransition(SyncTrigger *pTrigger, CARD64 oldval)
+SyncCheckTriggerNegativeTransition(SyncTrigger * pTrigger, CARD64 oldval)
{
SyncCounter *pCounter;
/* Non-counter sync objects should never get here because they
* never trigger this comparison. */
if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE))
- return FALSE;
+ return FALSE;
- pCounter = (SyncCounter *)pTrigger->pSync;
+ pCounter = (SyncCounter *) pTrigger->pSync;
return (pCounter == NULL ||
- (XSyncValueGreaterThan(oldval, pTrigger->test_value) &&
- XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value)));
+ (XSyncValueGreaterThan(oldval, pTrigger->test_value) &&
+ XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value)));
}
static Bool
-SyncCheckTriggerFence(SyncTrigger *pTrigger, CARD64 unused)
+SyncCheckTriggerFence(SyncTrigger * pTrigger, CARD64 unused)
{
- SyncFence* pFence = (SyncFence*) pTrigger->pSync;
- (void)unused;
+ SyncFence *pFence = (SyncFence *) pTrigger->pSync;
+
+ (void) unused;
- return (pFence == NULL ||
- pFence->funcs.CheckTriggered(pFence));
+ return (pFence == NULL || pFence->funcs.CheckTriggered(pFence));
}
static int
-SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XID syncObject,
- RESTYPE resType, Mask changes)
+SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
+ RESTYPE resType, Mask changes)
{
SyncObject *pSync = pTrigger->pSync;
SyncCounter *pCounter = NULL;
- int rc;
- Bool newSyncObject = FALSE;
-
- if (changes & XSyncCACounter)
- {
- if (syncObject == None)
- pSync = NULL;
- else if (Success != (rc = dixLookupResourceByType ((pointer *)&pSync,
- syncObject, resType, client, DixReadAccess)))
- {
- client->errorValue = syncObject;
- return rc;
- }
- if (pSync != pTrigger->pSync)
- { /* new counter for trigger */
- SyncDeleteTriggerFromSyncObject(pTrigger);
- pTrigger->pSync = pSync;
- newSyncObject = TRUE;
- }
+ int rc;
+ Bool newSyncObject = FALSE;
+
+ if (changes & XSyncCACounter) {
+ if (syncObject == None)
+ pSync = NULL;
+ else if (Success != (rc = dixLookupResourceByType((pointer *) &pSync,
+ syncObject, resType,
+ client,
+ DixReadAccess))) {
+ client->errorValue = syncObject;
+ return rc;
+ }
+ if (pSync != pTrigger->pSync) { /* new counter for trigger */
+ SyncDeleteTriggerFromSyncObject(pTrigger);
+ pTrigger->pSync = pSync;
+ newSyncObject = TRUE;
+ }
}
/* if system counter, ask it what the current value is */
- if (pSync && SYNC_COUNTER == pSync->type)
- {
- pCounter = (SyncCounter *)pSync;
-
- if (IsSystemCounter(pCounter))
- {
- (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
- &pCounter->value);
- }
- }
-
- if (changes & XSyncCAValueType)
- {
- if (pTrigger->value_type != XSyncRelative &&
- pTrigger->value_type != XSyncAbsolute)
- {
- client->errorValue = pTrigger->value_type;
- return BadValue;
- }
- }
-
- if (changes & XSyncCATestType)
- {
-
- if (pSync && SYNC_FENCE == pSync->type)
- {
- pTrigger->CheckTrigger = SyncCheckTriggerFence;
- }
- else
- {
- /* select appropriate CheckTrigger function */
-
- switch (pTrigger->test_type)
- {
- case XSyncPositiveTransition:
- pTrigger->CheckTrigger = SyncCheckTriggerPositiveTransition;
- break;
- case XSyncNegativeTransition:
- pTrigger->CheckTrigger = SyncCheckTriggerNegativeTransition;
- break;
- case XSyncPositiveComparison:
- pTrigger->CheckTrigger = SyncCheckTriggerPositiveComparison;
- break;
- case XSyncNegativeComparison:
- pTrigger->CheckTrigger = SyncCheckTriggerNegativeComparison;
- break;
- default:
- client->errorValue = pTrigger->test_type;
- return BadValue;
- }
- }
- }
-
- if (changes & (XSyncCAValueType | XSyncCAValue))
- {
- if (pTrigger->value_type == XSyncAbsolute)
- pTrigger->test_value = pTrigger->wait_value;
- else /* relative */
- {
- Bool overflow;
- if (pCounter == NULL)
- return BadMatch;
-
- XSyncValueAdd(&pTrigger->test_value, pCounter->value,
- pTrigger->wait_value, &overflow);
- if (overflow)
- {
- client->errorValue = XSyncValueHigh32(pTrigger->wait_value);
- return BadValue;
- }
- }
+ if (pSync && SYNC_COUNTER == pSync->type) {
+ pCounter = (SyncCounter *) pSync;
+
+ if (IsSystemCounter(pCounter)) {
+ (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
+ &pCounter->value);
+ }
+ }
+
+ if (changes & XSyncCAValueType) {
+ if (pTrigger->value_type != XSyncRelative &&
+ pTrigger->value_type != XSyncAbsolute) {
+ client->errorValue = pTrigger->value_type;
+ return BadValue;
+ }
+ }
+
+ if (changes & XSyncCATestType) {
+
+ if (pSync && SYNC_FENCE == pSync->type) {
+ pTrigger->CheckTrigger = SyncCheckTriggerFence;
+ }
+ else {
+ /* select appropriate CheckTrigger function */
+
+ switch (pTrigger->test_type) {
+ case XSyncPositiveTransition:
+ pTrigger->CheckTrigger = SyncCheckTriggerPositiveTransition;
+ break;
+ case XSyncNegativeTransition:
+ pTrigger->CheckTrigger = SyncCheckTriggerNegativeTransition;
+ break;
+ case XSyncPositiveComparison:
+ pTrigger->CheckTrigger = SyncCheckTriggerPositiveComparison;
+ break;
+ case XSyncNegativeComparison:
+ pTrigger->CheckTrigger = SyncCheckTriggerNegativeComparison;
+ break;
+ default:
+ client->errorValue = pTrigger->test_type;
+ return BadValue;
+ }
+ }
+ }
+
+ if (changes & (XSyncCAValueType | XSyncCAValue)) {
+ if (pTrigger->value_type == XSyncAbsolute)
+ pTrigger->test_value = pTrigger->wait_value;
+ else { /* relative */
+
+ Bool overflow;
+
+ if (pCounter == NULL)
+ return BadMatch;
+
+ XSyncValueAdd(&pTrigger->test_value, pCounter->value,
+ pTrigger->wait_value, &overflow);
+ if (overflow) {
+ client->errorValue = XSyncValueHigh32(pTrigger->wait_value);
+ return BadValue;
+ }
+ }
}
/* we wait until we're sure there are no errors before registering
* a new counter on a trigger
*/
- if (newSyncObject)
- {
- if ((rc = SyncAddTriggerToSyncObject(pTrigger)) != Success)
- return rc;
+ if (newSyncObject) {
+ if ((rc = SyncAddTriggerToSyncObject(pTrigger)) != Success)
+ return rc;
}
- else if (pCounter && IsSystemCounter(pCounter))
- {
- SyncComputeBracketValues(pCounter);
+ else if (pCounter && IsSystemCounter(pCounter)) {
+ SyncComputeBracketValues(pCounter);
}
return Success;
@@ -432,7 +423,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XID syncObject,
* clients. The alarm maintains a list of clients interested in events.
*/
static void
-SyncSendAlarmNotifyEvents(SyncAlarm *pAlarm)
+SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm)
{
SyncAlarmClientList *pcl;
xSyncAlarmNotifyEvent ane;
@@ -440,23 +431,21 @@ SyncSendAlarmNotifyEvents(SyncAlarm *pAlarm)
SyncCounter *pCounter;
if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_ALARM))
- return;
+ return;
- pCounter = (SyncCounter *)pTrigger->pSync;
+ pCounter = (SyncCounter *) pTrigger->pSync;
UpdateCurrentTime();
ane.type = SyncEventBase + XSyncAlarmNotify;
ane.kind = XSyncAlarmNotify;
ane.alarm = pAlarm->alarm_id;
- if (pTrigger->pSync && SYNC_COUNTER == pTrigger->pSync->type)
- {
- ane.counter_value_hi = XSyncValueHigh32(pCounter->value);
- ane.counter_value_lo = XSyncValueLow32(pCounter->value);
+ if (pTrigger->pSync && SYNC_COUNTER == pTrigger->pSync->type) {
+ ane.counter_value_hi = XSyncValueHigh32(pCounter->value);
+ ane.counter_value_lo = XSyncValueLow32(pCounter->value);
}
- else
- { /* XXX what else can we do if there's no counter? */
- ane.counter_value_hi = ane.counter_value_lo = 0;
+ else { /* XXX what else can we do if there's no counter? */
+ ane.counter_value_hi = ane.counter_value_lo = 0;
}
ane.alarm_value_hi = XSyncValueHigh32(pTrigger->test_value);
@@ -466,149 +455,141 @@ SyncSendAlarmNotifyEvents(SyncAlarm *pAlarm)
/* send to owner */
if (pAlarm->events)
- WriteEventsToClient(pAlarm->client, 1, (xEvent *) &ane);
+ WriteEventsToClient(pAlarm->client, 1, (xEvent *) &ane);
/* send to other interested clients */
for (pcl = pAlarm->pEventClients; pcl; pcl = pcl->next)
- WriteEventsToClient(pcl->client, 1, (xEvent *) &ane);
+ WriteEventsToClient(pcl->client, 1, (xEvent *) &ane);
}
-
/* CounterNotify events only occur in response to an Await. The events
* go only to the Awaiting client.
*/
static void
-SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait,
- int num_events)
+SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait ** ppAwait,
+ int num_events)
{
xSyncCounterNotifyEvent *pEvents, *pev;
int i;
if (client->clientGone)
- return;
+ return;
pev = pEvents = malloc(num_events * sizeof(xSyncCounterNotifyEvent));
if (!pEvents)
- return;
+ return;
UpdateCurrentTime();
- for (i = 0; i < num_events; i++, ppAwait++, pev++)
- {
- SyncTrigger *pTrigger = &(*ppAwait)->trigger;
- pev->type = SyncEventBase + XSyncCounterNotify;
- pev->kind = XSyncCounterNotify;
- pev->counter = pTrigger->pSync->id;
- pev->wait_value_lo = XSyncValueLow32(pTrigger->test_value);
- pev->wait_value_hi = XSyncValueHigh32(pTrigger->test_value);
- if (SYNC_COUNTER == pTrigger->pSync->type)
- {
- SyncCounter *pCounter = (SyncCounter *)pTrigger->pSync;
-
- pev->counter_value_lo = XSyncValueLow32(pCounter->value);
- pev->counter_value_hi = XSyncValueHigh32(pCounter->value);
- }
- else
- {
- pev->counter_value_lo = 0;
- pev->counter_value_hi = 0;
- }
-
- pev->time = currentTime.milliseconds;
- pev->count = num_events - i - 1; /* events remaining */
- pev->destroyed = pTrigger->pSync->beingDestroyed;
+ for (i = 0; i < num_events; i++, ppAwait++, pev++) {
+ SyncTrigger *pTrigger = &(*ppAwait)->trigger;
+
+ pev->type = SyncEventBase + XSyncCounterNotify;
+ pev->kind = XSyncCounterNotify;
+ pev->counter = pTrigger->pSync->id;
+ pev->wait_value_lo = XSyncValueLow32(pTrigger->test_value);
+ pev->wait_value_hi = XSyncValueHigh32(pTrigger->test_value);
+ if (SYNC_COUNTER == pTrigger->pSync->type) {
+ SyncCounter *pCounter = (SyncCounter *) pTrigger->pSync;
+
+ pev->counter_value_lo = XSyncValueLow32(pCounter->value);
+ pev->counter_value_hi = XSyncValueHigh32(pCounter->value);
+ }
+ else {
+ pev->counter_value_lo = 0;
+ pev->counter_value_hi = 0;
+ }
+
+ pev->time = currentTime.milliseconds;
+ pev->count = num_events - i - 1; /* events remaining */
+ pev->destroyed = pTrigger->pSync->beingDestroyed;
}
/* swapping will be taken care of by this */
- WriteEventsToClient(client, num_events, (xEvent *)pEvents);
+ WriteEventsToClient(client, num_events, (xEvent *) pEvents);
free(pEvents);
}
-
/* This function is called when an alarm's counter is destroyed.
* It is plugged into pTrigger->CounterDestroyed (for alarm triggers).
*/
static void
-SyncAlarmCounterDestroyed(SyncTrigger *pTrigger)
+SyncAlarmCounterDestroyed(SyncTrigger * pTrigger)
{
- SyncAlarm *pAlarm = (SyncAlarm *)pTrigger;
+ SyncAlarm *pAlarm = (SyncAlarm *) pTrigger;
pAlarm->state = XSyncAlarmInactive;
SyncSendAlarmNotifyEvents(pAlarm);
pTrigger->pSync = NULL;
}
-
/* This function is called when an alarm "goes off."
* It is plugged into pTrigger->TriggerFired (for alarm triggers).
*/
static void
-SyncAlarmTriggerFired(SyncTrigger *pTrigger)
+SyncAlarmTriggerFired(SyncTrigger * pTrigger)
{
- SyncAlarm *pAlarm = (SyncAlarm *)pTrigger;
+ SyncAlarm *pAlarm = (SyncAlarm *) pTrigger;
SyncCounter *pCounter;
CARD64 new_test_value;
if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_ALARM))
- return;
+ return;
- pCounter = (SyncCounter *)pTrigger->pSync;
+ pCounter = (SyncCounter *) pTrigger->pSync;
/* no need to check alarm unless it's active */
if (pAlarm->state != XSyncAlarmActive)
- return;
+ return;
/* " if the counter value is None, or if the delta is 0 and
* the test-type is PositiveComparison or NegativeComparison,
* no change is made to value (test-value) and the alarm
* state is changed to Inactive before the event is generated."
*/
- if (pCounter == NULL
- || (XSyncValueIsZero(pAlarm->delta)
- && (pAlarm->trigger.test_type == XSyncPositiveComparison
- || pAlarm->trigger.test_type == XSyncNegativeComparison)))
- pAlarm->state = XSyncAlarmInactive;
+ if (pCounter == NULL || (XSyncValueIsZero(pAlarm->delta)
+ && (pAlarm->trigger.test_type ==
+ XSyncPositiveComparison ||
+ pAlarm->trigger.test_type ==
+ XSyncNegativeComparison)))
+ pAlarm->state = XSyncAlarmInactive;
new_test_value = pAlarm->trigger.test_value;
- if (pAlarm->state == XSyncAlarmActive)
- {
- Bool overflow;
- CARD64 oldvalue;
- SyncTrigger *paTrigger = &pAlarm->trigger;
- SyncCounter *paCounter;
-
- if (!SyncCheckWarnIsCounter(paTrigger->pSync,
- WARN_INVALID_COUNTER_ALARM))
- return;
-
- paCounter = (SyncCounter *)pTrigger->pSync;
-
- /* "The alarm is updated by repeatedly adding delta to the
- * value of the trigger and re-initializing it until it
- * becomes FALSE."
- */
- oldvalue = paTrigger->test_value;
-
- /* XXX really should do something smarter here */
-
- do
- {
- XSyncValueAdd(&paTrigger->test_value, paTrigger->test_value,
- pAlarm->delta, &overflow);
- } while (!overflow &&
- (*paTrigger->CheckTrigger)(paTrigger,
- paCounter->value));
-
- 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
- * the alarm state is changed to Inactive before the event is
- * generated."
- */
- if (overflow)
- {
- new_test_value = oldvalue;
- pAlarm->state = XSyncAlarmInactive;
- }
+ if (pAlarm->state == XSyncAlarmActive) {
+ Bool overflow;
+ CARD64 oldvalue;
+ SyncTrigger *paTrigger = &pAlarm->trigger;
+ SyncCounter *paCounter;
+
+ if (!SyncCheckWarnIsCounter(paTrigger->pSync,
+ WARN_INVALID_COUNTER_ALARM))
+ return;
+
+ paCounter = (SyncCounter *) pTrigger->pSync;
+
+ /* "The alarm is updated by repeatedly adding delta to the
+ * value of the trigger and re-initializing it until it
+ * becomes FALSE."
+ */
+ oldvalue = paTrigger->test_value;
+
+ /* XXX really should do something smarter here */
+
+ do {
+ XSyncValueAdd(&paTrigger->test_value, paTrigger->test_value,
+ pAlarm->delta, &overflow);
+ } while (!overflow &&
+ (*paTrigger->CheckTrigger) (paTrigger, paCounter->value));
+
+ 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
+ * the alarm state is changed to Inactive before the event is
+ * generated."
+ */
+ if (overflow) {
+ new_test_value = oldvalue;
+ pAlarm->state = XSyncAlarmInactive;
+ }
}
/* The AlarmNotify event has to have the "new state of the alarm"
* which we can't be sure of until this point. However, it has
@@ -620,28 +601,27 @@ SyncAlarmTriggerFired(SyncTrigger *pTrigger)
pTrigger->test_value = new_test_value;
}
-
/* This function is called when an Await unblocks, either as a result
* of the trigger firing OR the counter being destroyed.
* It goes into pTrigger->TriggerFired AND pTrigger->CounterDestroyed
* (for Await triggers).
*/
static void
-SyncAwaitTriggerFired(SyncTrigger *pTrigger)
+SyncAwaitTriggerFired(SyncTrigger * pTrigger)
{
- SyncAwait *pAwait = (SyncAwait *)pTrigger;
+ SyncAwait *pAwait = (SyncAwait *) pTrigger;
int numwaits;
SyncAwaitUnion *pAwaitUnion;
SyncAwait **ppAwait;
int num_events = 0;
- pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader;
+ pAwaitUnion = (SyncAwaitUnion *) pAwait->pHeader;
numwaits = pAwaitUnion->header.num_waitconditions;
ppAwait = malloc(numwaits * sizeof(SyncAwait *));
if (!ppAwait)
- goto bail;
+ goto bail;
- pAwait = &(pAwaitUnion+1)->await;
+ pAwait = &(pAwaitUnion + 1)->await;
/* "When a client is unblocked, all the CounterNotify events for
* the Await request are generated contiguously. If count is 0
@@ -652,132 +632,119 @@ SyncAwaitTriggerFired(SyncTrigger *pTrigger)
* need to be sent first, so that an accurate count field can
* be stored in the events.
*/
- for ( ; numwaits; numwaits--, pAwait++)
- {
- CARD64 diff;
- Bool overflow, diffgreater, diffequal;
-
- /* "A CounterNotify event with the destroyed flag set to TRUE is
- * always generated if the counter for one of the triggers is
- * destroyed."
- */
- if (pAwait->trigger.pSync->beingDestroyed)
- {
- ppAwait[num_events++] = pAwait;
- continue;
- }
-
- if (SYNC_COUNTER == pAwait->trigger.pSync->type)
- {
- SyncCounter *pCounter = (SyncCounter *) pAwait->trigger.pSync;
-
- /* "The difference between the counter and the test value is
- * calculated by subtracting the test value from the value of
- * the counter."
- */
- XSyncValueSubtract(&diff, pCounter->value,
- pAwait->trigger.test_value, &overflow);
-
- /* "If the difference lies outside the range for an INT64, an
- * event is not generated."
- */
- if (overflow)
- continue;
- diffgreater = XSyncValueGreaterThan(diff, pAwait->event_threshold);
- diffequal = XSyncValueEqual(diff, pAwait->event_threshold);
-
- /* "If the test-type is PositiveTransition or
- * PositiveComparison, a CounterNotify event is generated if
- * the difference is at least event-threshold. If the test-type
- * is NegativeTransition or NegativeComparison, a CounterNotify
- * event is generated if the difference is at most
- * event-threshold."
- */
-
- if ( ((pAwait->trigger.test_type == XSyncPositiveComparison ||
- pAwait->trigger.test_type == XSyncPositiveTransition)
- && (diffgreater || diffequal))
- ||
- ((pAwait->trigger.test_type == XSyncNegativeComparison ||
- pAwait->trigger.test_type == XSyncNegativeTransition)
- && (!diffgreater) /* less or equal */
- )
- )
- {
- ppAwait[num_events++] = pAwait;
- }
- }
+ for (; numwaits; numwaits--, pAwait++) {
+ CARD64 diff;
+ Bool overflow, diffgreater, diffequal;
+
+ /* "A CounterNotify event with the destroyed flag set to TRUE is
+ * always generated if the counter for one of the triggers is
+ * destroyed."
+ */
+ if (pAwait->trigger.pSync->beingDestroyed) {
+ ppAwait[num_events++] = pAwait;
+ continue;
+ }
+
+ if (SYNC_COUNTER == pAwait->trigger.pSync->type) {
+ SyncCounter *pCounter = (SyncCounter *) pAwait->trigger.pSync;
+
+ /* "The difference between the counter and the test value is
+ * calculated by subtracting the test value from the value of
+ * the counter."
+ */
+ XSyncValueSubtract(&diff, pCounter->value,
+ pAwait->trigger.test_value, &overflow);
+
+ /* "If the difference lies outside the range for an INT64, an
+ * event is not generated."
+ */
+ if (overflow)
+ continue;
+ diffgreater = XSyncValueGreaterThan(diff, pAwait->event_threshold);
+ diffequal = XSyncValueEqual(diff, pAwait->event_threshold);
+
+ /* "If the test-type is PositiveTransition or
+ * PositiveComparison, a CounterNotify event is generated if
+ * the difference is at least event-threshold. If the test-type
+ * is NegativeTransition or NegativeComparison, a CounterNotify
+ * event is generated if the difference is at most
+ * event-threshold."
+ */
+
+ if (((pAwait->trigger.test_type == XSyncPositiveComparison ||
+ pAwait->trigger.test_type == XSyncPositiveTransition)
+ && (diffgreater || diffequal))
+ ||
+ ((pAwait->trigger.test_type == XSyncNegativeComparison ||
+ pAwait->trigger.test_type == XSyncNegativeTransition)
+ && (!diffgreater) /* less or equal */
+ )
+ ) {
+ ppAwait[num_events++] = pAwait;
+ }
+ }
}
if (num_events)
- SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait,
- num_events);
+ SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait,
+ num_events);
free(ppAwait);
-bail:
+ bail:
/* unblock the client */
AttendClient(pAwaitUnion->header.client);
/* delete the await */
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
}
-
/* This function should always be used to change a counter's value so that
* any triggers depending on the counter will be checked.
*/
void
-SyncChangeCounter(SyncCounter *pCounter, CARD64 newval)
+SyncChangeCounter(SyncCounter * pCounter, CARD64 newval)
{
- SyncTriggerList *ptl, *pnext;
+ SyncTriggerList *ptl, *pnext;
CARD64 oldval;
oldval = pCounter->value;
pCounter->value = newval;
/* run through triggers to see if any become true */
- for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext)
- {
- pnext = ptl->next;
- if ((*ptl->pTrigger->CheckTrigger)(ptl->pTrigger, oldval))
- (*ptl->pTrigger->TriggerFired)(ptl->pTrigger);
+ for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) {
+ pnext = ptl->next;
+ if ((*ptl->pTrigger->CheckTrigger) (ptl->pTrigger, oldval))
+ (*ptl->pTrigger->TriggerFired) (ptl->pTrigger);
}
- if (IsSystemCounter(pCounter))
- {
- SyncComputeBracketValues(pCounter);
+ if (IsSystemCounter(pCounter)) {
+ SyncComputeBracketValues(pCounter);
}
}
-
/* loosely based on dix/events.c/EventSelectForWindow */
static Bool
-SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents)
+SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
{
SyncAlarmClientList *pClients;
- if (client == pAlarm->client) /* alarm owner */
- {
- pAlarm->events = wantevents;
- return Success;
+ if (client == pAlarm->client) { /* alarm owner */
+ pAlarm->events = wantevents;
+ return Success;
}
/* see if the client is already on the list (has events selected) */
- for (pClients = pAlarm->pEventClients; pClients;
- pClients = pClients->next)
- {
- if (pClients->client == client)
- {
- /* client's presence on the list indicates desire for
- * events. If the client doesn't want events, remove it
- * from the list. If the client does want events, do
- * nothing, since it's already got them.
- */
- if (!wantevents)
- {
- FreeResource(pClients->delete_id, RT_NONE);
- }
- return Success;
- }
+ for (pClients = pAlarm->pEventClients; pClients; pClients = pClients->next) {
+ if (pClients->client == client) {
+ /* client's presence on the list indicates desire for
+ * events. If the client doesn't want events, remove it
+ * from the list. If the client does want events, do
+ * nothing, since it's already got them.
+ */
+ if (!wantevents) {
+ FreeResource(pClients->delete_id, RT_NONE);
+ }
+ return Success;
+ }
}
/* if we get here, this client does not currently have
@@ -785,16 +752,16 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents)
*/
if (!wantevents)
- /* client doesn't want events, and we just discovered that it
- * doesn't have them, so there's nothing to do.
- */
- return Success;
+ /* client doesn't want events, and we just discovered that it
+ * doesn't have them, so there's nothing to do.
+ */
+ return Success;
/* add new client to pAlarm->pEventClients */
pClients = malloc(sizeof(SyncAlarmClientList));
if (!pClients)
- return BadAlloc;
+ return BadAlloc;
/* register it as a resource so it will be cleaned up
* if the client dies
@@ -808,7 +775,7 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents)
pClients->client = client;
if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm))
- return BadAlloc;
+ return BadAlloc;
return Success;
}
@@ -817,69 +784,66 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents)
* ** SyncChangeAlarmAttributes ** This is used by CreateAlarm and ChangeAlarm
*/
static int
-SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm *pAlarm, Mask mask,
- CARD32 *values)
-{
- int status;
- XSyncCounter counter;
- Mask origmask = mask;
-
- counter =
- pAlarm->trigger.pSync ? pAlarm->trigger.pSync->id : None;
-
- while (mask)
- {
- int index2 = lowbit(mask);
- mask &= ~index2;
- switch (index2)
- {
- case XSyncCACounter:
- mask &= ~XSyncCACounter;
- /* sanity check in SyncInitTrigger */
- counter = *values++;
- break;
-
- case XSyncCAValueType:
- mask &= ~XSyncCAValueType;
- /* sanity check in SyncInitTrigger */
- pAlarm->trigger.value_type = *values++;
- break;
-
- case XSyncCAValue:
- mask &= ~XSyncCAValue;
- XSyncIntsToValue(&pAlarm->trigger.wait_value, values[1], values[0]);
- values += 2;
- break;
-
- case XSyncCATestType:
- mask &= ~XSyncCATestType;
- /* sanity check in SyncInitTrigger */
- pAlarm->trigger.test_type = *values++;
- break;
-
- case XSyncCADelta:
- mask &= ~XSyncCADelta;
- XSyncIntsToValue(&pAlarm->delta, values[1], values[0]);
- values += 2;
- break;
-
- case XSyncCAEvents:
- mask &= ~XSyncCAEvents;
- if ((*values != xTrue) && (*values != xFalse))
- {
- client->errorValue = *values;
- return BadValue;
- }
- status = SyncEventSelectForAlarm(pAlarm, client,
- (Bool)(*values++));
- if (status != Success)
- return status;
- break;
-
- default:
- client->errorValue = mask;
- return BadValue;
- }
+SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
+ CARD32 *values)
+{
+ int status;
+ XSyncCounter counter;
+ Mask origmask = mask;
+
+ counter = pAlarm->trigger.pSync ? pAlarm->trigger.pSync->id : None;
+
+ while (mask) {
+ int index2 = lowbit(mask);
+
+ mask &= ~index2;
+ switch (index2) {
+ case XSyncCACounter:
+ mask &= ~XSyncCACounter;
+ /* sanity check in SyncInitTrigger */
+ counter = *values++;
+ break;
+
+ case XSyncCAValueType:
+ mask &= ~XSyncCAValueType;
+ /* sanity check in SyncInitTrigger */
+ pAlarm->trigger.value_type = *values++;
+ break;
+
+ case XSyncCAValue:
+ mask &= ~XSyncCAValue;
+ XSyncIntsToValue(&pAlarm->trigger.wait_value, values[1], values[0]);
+ values += 2;
+ break;
+
+ case XSyncCATestType:
+ mask &= ~XSyncCATestType;
+ /* sanity check in SyncInitTrigger */
+ pAlarm->trigger.test_type = *values++;
+ break;
+
+ case XSyncCADelta:
+ mask &= ~XSyncCADelta;
+ XSyncIntsToValue(&pAlarm->delta, values[1], values[0]);
+ values += 2;
+ break;
+
+ case XSyncCAEvents:
+ mask &= ~XSyncCAEvents;
+ if ((*values != xTrue) && (*values != xFalse)) {
+ client->errorValue = *values;
+ return BadValue;
+ }
+ status = SyncEventSelectForAlarm(pAlarm, client,
+ (Bool) (*values++));
+ if (status != Success)
+ return status;
+ break;
+
+ default:
+ client->errorValue = mask;
+ return BadValue;
+ }
}
/* "If the test-type is PositiveComparison or PositiveTransition
@@ -887,27 +851,26 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm *pAlarm, Mask mask,
* NegativeComparison or NegativeTransition and delta is
* greater than zero, a Match error is generated."
*/
- if (origmask & (XSyncCADelta|XSyncCATestType))
- {
- CARD64 zero;
- XSyncIntToValue(&zero, 0);
- if ((((pAlarm->trigger.test_type == XSyncPositiveComparison) ||
- (pAlarm->trigger.test_type == XSyncPositiveTransition))
- && XSyncValueLessThan(pAlarm->delta, zero))
- ||
- (((pAlarm->trigger.test_type == XSyncNegativeComparison) ||
- (pAlarm->trigger.test_type == XSyncNegativeTransition))
- && XSyncValueGreaterThan(pAlarm->delta, zero))
- )
- {
- return BadMatch;
- }
+ if (origmask & (XSyncCADelta | XSyncCATestType)) {
+ CARD64 zero;
+
+ XSyncIntToValue(&zero, 0);
+ if ((((pAlarm->trigger.test_type == XSyncPositiveComparison) ||
+ (pAlarm->trigger.test_type == XSyncPositiveTransition))
+ && XSyncValueLessThan(pAlarm->delta, zero))
+ ||
+ (((pAlarm->trigger.test_type == XSyncNegativeComparison) ||
+ (pAlarm->trigger.test_type == XSyncNegativeTransition))
+ && XSyncValueGreaterThan(pAlarm->delta, zero))
+ ) {
+ return BadMatch;
+ }
}
/* postpone this until now, when we're sure nothing else can go wrong */
if ((status = SyncInitTrigger(client, &pAlarm->trigger, counter, RTCounter,
- origmask & XSyncCAAllTrigger)) != Success)
- return status;
+ origmask & XSyncCAAllTrigger)) != Success)
+ return status;
/* XXX spec does not really say to do this - needs clarification */
pAlarm->state = XSyncAlarmActive;
@@ -921,18 +884,18 @@ SyncCreate(ClientPtr client, XID id, unsigned char type)
switch (type) {
case SYNC_COUNTER:
- pSync = malloc(sizeof(SyncCounter));
- break;
+ pSync = malloc(sizeof(SyncCounter));
+ break;
case SYNC_FENCE:
- pSync = (SyncObject*)dixAllocateObjectWithPrivates(SyncFence,
- PRIVATE_SYNC_FENCE);
- break;
+ pSync = (SyncObject *) dixAllocateObjectWithPrivates(SyncFence,
+ PRIVATE_SYNC_FENCE);
+ break;
default:
- return NULL;
+ return NULL;
}
if (!pSync)
- return NULL;
+ return NULL;
pSync->client = client;
pSync->id = id;
@@ -943,22 +906,19 @@ SyncCreate(ClientPtr client, XID id, unsigned char type)
return pSync;
}
-
static SyncCounter *
SyncCreateCounter(ClientPtr client, XSyncCounter id, CARD64 initialvalue)
{
SyncCounter *pCounter;
- if (!(pCounter = (SyncCounter *)SyncCreate(client,
- id,
- SYNC_COUNTER)))
- return NULL;
+ if (!(pCounter = (SyncCounter *) SyncCreate(client, id, SYNC_COUNTER)))
+ return NULL;
pCounter->value = initialvalue;
pCounter->pSysCounterInfo = NULL;
if (!AddResource(id, RTCounter, (pointer) pCounter))
- return NULL;
+ return NULL;
return pCounter;
}
@@ -969,59 +929,48 @@ static int FreeCounter(void *, XID);
* ***** System Counter utilities
*/
-pointer
-SyncCreateSystemCounter(
- const char *name,
- CARD64 initial,
- CARD64 resolution,
- SyncCounterType counterType,
- void (*QueryValue)(pointer /* pCounter */,
- CARD64 * /* pValue_return */),
- void (*BracketValues)(pointer /* pCounter */,
- CARD64 * /* pbracket_less */,
- CARD64 * /* pbracket_greater */)
- )
-{
- SyncCounter *pCounter;
-
- SysCounterList = realloc(SysCounterList,
- (SyncNumSystemCounters+1)*sizeof(SyncCounter *));
- if (!SysCounterList)
- return NULL;
+SyncCounter*
+SyncCreateSystemCounter(const char *name,
+ CARD64 initial,
+ CARD64 resolution,
+ SyncCounterType counterType,
+ SyncSystemCounterQueryValue QueryValue,
+ SyncSystemCounterBracketValues BracketValues
+ )
+{
+ SyncCounter *pCounter;
/* this function may be called before SYNC has been initialized, so we
* have to make sure RTCounter is created.
*/
- if (RTCounter == 0)
- {
- RTCounter = CreateNewResourceType(FreeCounter, "SyncCounter");
- if (RTCounter == 0)
- {
- return NULL;
- }
+ if (RTCounter == 0) {
+ RTCounter = CreateNewResourceType(FreeCounter, "SyncCounter");
+ if (RTCounter == 0) {
+ return NULL;
+ }
}
pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial);
- if (pCounter)
- {
- SysCounterInfo *psci;
-
- psci = malloc(sizeof(SysCounterInfo));
- if (!psci)
- {
- FreeResource(pCounter->sync.id, RT_NONE);
- return pCounter;
- }
- pCounter->pSysCounterInfo = psci;
- psci->name = name;
- psci->resolution = resolution;
- psci->counterType = counterType;
- psci->QueryValue = QueryValue;
- psci->BracketValues = BracketValues;
- XSyncMaxValue(&psci->bracket_greater);
- XSyncMinValue(&psci->bracket_less);
- SysCounterList[SyncNumSystemCounters++] = pCounter;
+ if (pCounter) {
+ SysCounterInfo *psci;
+
+ psci = malloc(sizeof(SysCounterInfo));
+ if (!psci) {
+ FreeResource(pCounter->sync.id, RT_NONE);
+ return pCounter;
+ }
+ pCounter->pSysCounterInfo = psci;
+ psci->pCounter = pCounter;
+ psci->name = strdup(name);
+ psci->resolution = resolution;
+ psci->counterType = counterType;
+ psci->QueryValue = QueryValue;
+ psci->BracketValues = BracketValues;
+ psci->private = NULL;
+ XSyncMaxValue(&psci->bracket_greater);
+ XSyncMinValue(&psci->bracket_less);
+ xorg_list_add(&psci->entry, &SysCounterList);
}
return pCounter;
}
@@ -1029,12 +978,13 @@ SyncCreateSystemCounter(
void
SyncDestroySystemCounter(pointer pSysCounter)
{
- SyncCounter *pCounter = (SyncCounter *)pSysCounter;
+ SyncCounter *pCounter = (SyncCounter *) pSysCounter;
+
FreeResource(pCounter->sync.id, RT_NONE);
}
static void
-SyncComputeBracketValues(SyncCounter *pCounter)
+SyncComputeBracketValues(SyncCounter * pCounter)
{
SyncTriggerList *pCur;
SyncTrigger *pTrigger;
@@ -1044,89 +994,81 @@ SyncComputeBracketValues(SyncCounter *pCounter)
SyncCounterType ct;
if (!pCounter)
- return;
+ return;
psci = pCounter->pSysCounterInfo;
ct = pCounter->pSysCounterInfo->counterType;
if (ct == XSyncCounterNeverChanges)
- return;
+ return;
XSyncMaxValue(&psci->bracket_greater);
XSyncMinValue(&psci->bracket_less);
- for (pCur = pCounter->sync.pTriglist; pCur; pCur = pCur->next)
- {
- pTrigger = pCur->pTrigger;
-
+ for (pCur = pCounter->sync.pTriglist; pCur; pCur = pCur->next) {
+ pTrigger = pCur->pTrigger;
+
if (pTrigger->test_type == XSyncPositiveComparison &&
- ct != XSyncCounterNeverIncreases)
- {
- if (XSyncValueLessThan(pCounter->value, pTrigger->test_value) &&
- XSyncValueLessThan(pTrigger->test_value,
- psci->bracket_greater))
- {
- psci->bracket_greater = pTrigger->test_value;
- pnewgtval = &psci->bracket_greater;
- }
- }
- else if (pTrigger->test_type == XSyncNegativeComparison &&
- ct != XSyncCounterNeverDecreases)
- {
- if (XSyncValueGreaterThan(pCounter->value, pTrigger->test_value) &&
- XSyncValueGreaterThan(pTrigger->test_value,
- psci->bracket_less))
- {
- psci->bracket_less = pTrigger->test_value;
- pnewltval = &psci->bracket_less;
- }
- }
- else if (pTrigger->test_type == XSyncNegativeTransition &&
- ct != XSyncCounterNeverIncreases)
- {
- if (XSyncValueGreaterThan(pCounter->value, pTrigger->test_value) &&
- XSyncValueGreaterThan(pTrigger->test_value, psci->bracket_less))
- {
- psci->bracket_less = pTrigger->test_value;
- pnewltval = &psci->bracket_less;
- } else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
- XSyncValueLessThan(pTrigger->test_value,
- psci->bracket_greater))
- {
- /*
- * The value is exactly equal to our threshold. We want one
- * more event in the positive direction to ensure we pick up
- * when the value *exceeds* this threshold.
- */
- psci->bracket_greater = pTrigger->test_value;
- pnewgtval = &psci->bracket_greater;
- }
- }
+ ct != XSyncCounterNeverIncreases) {
+ if (XSyncValueLessThan(pCounter->value, pTrigger->test_value) &&
+ XSyncValueLessThan(pTrigger->test_value,
+ psci->bracket_greater)) {
+ psci->bracket_greater = pTrigger->test_value;
+ pnewgtval = &psci->bracket_greater;
+ }
+ }
+ else if (pTrigger->test_type == XSyncNegativeComparison &&
+ ct != XSyncCounterNeverDecreases) {
+ if (XSyncValueGreaterThan(pCounter->value, pTrigger->test_value) &&
+ XSyncValueGreaterThan(pTrigger->test_value,
+ psci->bracket_less)) {
+ psci->bracket_less = pTrigger->test_value;
+ pnewltval = &psci->bracket_less;
+ }
+ }
+ else if (pTrigger->test_type == XSyncNegativeTransition &&
+ ct != XSyncCounterNeverIncreases) {
+ if (XSyncValueGreaterThan(pCounter->value, pTrigger->test_value) &&
+ XSyncValueGreaterThan(pTrigger->test_value, psci->bracket_less))
+ {
+ psci->bracket_less = pTrigger->test_value;
+ pnewltval = &psci->bracket_less;
+ }
+ else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
+ XSyncValueLessThan(pTrigger->test_value,
+ psci->bracket_greater)) {
+ /*
+ * The value is exactly equal to our threshold. We want one
+ * more event in the positive direction to ensure we pick up
+ * when the value *exceeds* this threshold.
+ */
+ psci->bracket_greater = pTrigger->test_value;
+ pnewgtval = &psci->bracket_greater;
+ }
+ }
else if (pTrigger->test_type == XSyncPositiveTransition &&
- ct != XSyncCounterNeverDecreases)
- {
- if (XSyncValueLessThan(pCounter->value, pTrigger->test_value) &&
- XSyncValueLessThan(pTrigger->test_value, psci->bracket_greater))
- {
- psci->bracket_greater = pTrigger->test_value;
- pnewgtval = &psci->bracket_greater;
- } else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
- XSyncValueGreaterThan(pTrigger->test_value,
- psci->bracket_less))
- {
- /*
- * The value is exactly equal to our threshold. We want one
- * more event in the negative direction to ensure we pick up
- * when the value is less than this threshold.
- */
- psci->bracket_less = pTrigger->test_value;
- pnewltval = &psci->bracket_less;
- }
- }
- } /* end for each trigger */
-
- if (pnewgtval || pnewltval)
- {
- (*psci->BracketValues)((pointer)pCounter, pnewltval, pnewgtval);
+ ct != XSyncCounterNeverDecreases) {
+ if (XSyncValueLessThan(pCounter->value, pTrigger->test_value) &&
+ XSyncValueLessThan(pTrigger->test_value, psci->bracket_greater))
+ {
+ psci->bracket_greater = pTrigger->test_value;
+ pnewgtval = &psci->bracket_greater;
+ }
+ else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
+ XSyncValueGreaterThan(pTrigger->test_value,
+ psci->bracket_less)) {
+ /*
+ * The value is exactly equal to our threshold. We want one
+ * more event in the negative direction to ensure we pick up
+ * when the value is less than this threshold.
+ */
+ psci->bracket_less = pTrigger->test_value;
+ pnewltval = &psci->bracket_less;
+ }
+ }
+ } /* end for each trigger */
+
+ if (pnewgtval || pnewltval) {
+ (*psci->BracketValues) ((pointer) pCounter, pnewltval, pnewgtval);
}
}
@@ -1138,7 +1080,7 @@ SyncComputeBracketValues(SyncCounter *pCounter)
static int
FreeAlarm(void *addr, XID id)
{
- SyncAlarm *pAlarm = (SyncAlarm *) addr;
+ SyncAlarm *pAlarm = (SyncAlarm *) addr;
pAlarm->state = XSyncAlarmDestroyed;
@@ -1147,7 +1089,7 @@ FreeAlarm(void *addr, XID id)
/* delete event selections */
while (pAlarm->pEventClients)
- FreeResource(pAlarm->pEventClients->delete_id, RT_NONE);
+ FreeResource(pAlarm->pEventClients->delete_id, RT_NONE);
SyncDeleteTriggerFromSyncObject(&pAlarm->trigger);
@@ -1155,7 +1097,6 @@ FreeAlarm(void *addr, XID id)
return Success;
}
-
/*
* ** Cleanup after the destruction of a Counter
*/
@@ -1163,44 +1104,21 @@ FreeAlarm(void *addr, XID id)
static int
FreeCounter(void *env, XID id)
{
- SyncCounter *pCounter = (SyncCounter *) env;
+ SyncCounter *pCounter = (SyncCounter *) env;
SyncTriggerList *ptl, *pnext;
pCounter->sync.beingDestroyed = TRUE;
/* tell all the counter's triggers that the counter has been destroyed */
- for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext)
- {
- (*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger);
- pnext = ptl->next;
- free(ptl); /* destroy the trigger list as we go */
- }
- if (IsSystemCounter(pCounter))
- {
- int i, found = 0;
-
- free(pCounter->pSysCounterInfo);
-
- /* find the counter in the list of system counters and remove it */
-
- if (SysCounterList)
- {
- for (i = 0; i < SyncNumSystemCounters; i++)
- {
- if (SysCounterList[i] == pCounter)
- {
- found = i;
- break;
- }
- }
- if (found < (SyncNumSystemCounters-1))
- {
- for (i = found; i < SyncNumSystemCounters-1; i++)
- {
- SysCounterList[i] = SysCounterList[i+1];
- }
- }
- }
- SyncNumSystemCounters--;
+ for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) {
+ (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger);
+ pnext = ptl->next;
+ free(ptl); /* destroy the trigger list as we go */
+ }
+ if (IsSystemCounter(pCounter)) {
+ xorg_list_del(&pCounter->pSysCounterInfo->entry);
+ free(pCounter->pSysCounterInfo->name);
+ free(pCounter->pSysCounterInfo->private);
+ free(pCounter->pSysCounterInfo);
}
free(pCounter);
return Success;
@@ -1217,19 +1135,19 @@ FreeAwait(void *addr, XID id)
SyncAwait *pAwait;
int numwaits;
- pAwait = &(pAwaitUnion+1)->await; /* first await on list */
+ pAwait = &(pAwaitUnion + 1)->await; /* first await on list */
/* remove triggers from counters */
for (numwaits = pAwaitUnion->header.num_waitconditions; numwaits;
- numwaits--, pAwait++)
- {
- /* If the counter is being destroyed, FreeCounter will delete
- * the trigger list itself, so don't do it here.
- */
- SyncObject *pSync = pAwait->trigger.pSync;
- if (pSync && !pSync->beingDestroyed)
- SyncDeleteTriggerFromSyncObject(&pAwait->trigger);
+ numwaits--, pAwait++) {
+ /* If the counter is being destroyed, FreeCounter will delete
+ * the trigger list itself, so don't do it here.
+ */
+ SyncObject *pSync = pAwait->trigger.pSync;
+
+ if (pSync && !pSync->beingDestroyed)
+ SyncDeleteTriggerFromSyncObject(&pAwait->trigger);
}
free(pAwaitUnion);
return Success;
@@ -1243,40 +1161,35 @@ FreeAwait(void *addr, XID id)
static int
FreeAlarmClient(void *value, XID id)
{
- SyncAlarm *pAlarm = (SyncAlarm *)value;
+ SyncAlarm *pAlarm = (SyncAlarm *) value;
SyncAlarmClientList *pCur, *pPrev;
for (pPrev = NULL, pCur = pAlarm->pEventClients;
- pCur;
- pPrev = pCur, pCur = pCur->next)
- {
- if (pCur->delete_id == id)
- {
- if (pPrev)
- pPrev->next = pCur->next;
- else
- pAlarm->pEventClients = pCur->next;
- free(pCur);
- return Success;
- }
+ pCur; pPrev = pCur, pCur = pCur->next) {
+ if (pCur->delete_id == id) {
+ if (pPrev)
+ pPrev->next = pCur->next;
+ else
+ pAlarm->pEventClients = pCur->next;
+ free(pCur);
+ return Success;
+ }
}
FatalError("alarm client not on event list");
- /*NOTREACHED*/
-}
-
+ /*NOTREACHED*/}
/*
* ***** Proc functions
*/
-
/*
* ** Initialize the extension
*/
static int
ProcSyncInitialize(ClientPtr client)
{
- xSyncInitializeReply rep;
+ xSyncInitializeReply rep;
+
REQUEST_SIZE_MATCH(xSyncInitializeReq);
memset(&rep, 0, sizeof(xSyncInitializeReply));
@@ -1286,9 +1199,8 @@ ProcSyncInitialize(ClientPtr client)
rep.minorVersion = SERVER_SYNC_MINOR_VERSION;
rep.length = 0;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(rep), (char *) &rep);
return Success;
@@ -1300,70 +1212,65 @@ ProcSyncInitialize(ClientPtr client)
static int
ProcSyncListSystemCounters(ClientPtr client)
{
- xSyncListSystemCountersReply rep;
- int i, len;
+ xSyncListSystemCountersReply rep;
+ SysCounterInfo *psci=NULL;
+ int len = 0;
xSyncSystemCounter *list = NULL, *walklist = NULL;
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.nCounters = SyncNumSystemCounters;
+ rep.nCounters = 0;
- for (i = len = 0; i < SyncNumSystemCounters; i++)
- {
- const char *name = SysCounterList[i]->pSysCounterInfo->name;
- /* pad to 4 byte boundary */
- len += pad_to_int32(sz_xSyncSystemCounter + strlen(name));
+ xorg_list_for_each_entry(psci, &SysCounterList, entry) {
+ /* pad to 4 byte boundary */
+ len += pad_to_int32(sz_xSyncSystemCounter + strlen(psci->name));
+ ++rep.nCounters;
}
- if (len)
- {
- walklist = list = malloc(len);
- if (!list)
- return BadAlloc;
+ if (len) {
+ walklist = list = malloc(len);
+ if (!list)
+ return BadAlloc;
}
rep.length = bytes_to_int32(len);
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.nCounters);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.nCounters);
}
- for (i = 0; i < SyncNumSystemCounters; i++)
- {
- int namelen;
- char *pname_in_reply;
- SysCounterInfo *psci = SysCounterList[i]->pSysCounterInfo;
+ xorg_list_for_each_entry(psci, &SysCounterList, entry) {
+ int namelen;
+ char *pname_in_reply;
- walklist->counter = SysCounterList[i]->sync.id;
- walklist->resolution_hi = XSyncValueHigh32(psci->resolution);
- walklist->resolution_lo = XSyncValueLow32(psci->resolution);
- namelen = strlen(psci->name);
- walklist->name_length = namelen;
+ walklist->counter = psci->pCounter->sync.id;
+ walklist->resolution_hi = XSyncValueHigh32(psci->resolution);
+ walklist->resolution_lo = XSyncValueLow32(psci->resolution);
+ namelen = strlen(psci->name);
+ walklist->name_length = namelen;
- if (client->swapped)
- {
- swapl(&walklist->counter);
- swapl(&walklist->resolution_hi);
- swapl(&walklist->resolution_lo);
- swaps(&walklist->name_length);
- }
+ if (client->swapped) {
+ swapl(&walklist->counter);
+ swapl(&walklist->resolution_hi);
+ swapl(&walklist->resolution_lo);
+ swaps(&walklist->name_length);
+ }
- pname_in_reply = ((char *)walklist) + sz_xSyncSystemCounter;
- strncpy(pname_in_reply, psci->name, namelen);
- walklist = (xSyncSystemCounter *) (((char *)walklist) +
- pad_to_int32(sz_xSyncSystemCounter + namelen));
+ pname_in_reply = ((char *) walklist) + sz_xSyncSystemCounter;
+ strncpy(pname_in_reply, psci->name, namelen);
+ walklist = (xSyncSystemCounter *) (((char *) walklist) +
+ pad_to_int32(sz_xSyncSystemCounter +
+ namelen));
}
WriteToClient(client, sizeof(rep), (char *) &rep);
- if (len)
- {
- WriteToClient(client, len, (char *) list);
- free(list);
+ if (len) {
+ WriteToClient(client, len, (char *) list);
+ free(list);
}
return Success;
@@ -1382,24 +1289,23 @@ ProcSyncSetPriority(ClientPtr client)
REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
if (stuff->id == None)
- priorityclient = client;
+ priorityclient = client;
else {
- rc = dixLookupClient(&priorityclient, stuff->id, client,
- DixSetAttrAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupClient(&priorityclient, stuff->id, client,
+ DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
}
- if (priorityclient->priority != stuff->priority)
- {
- priorityclient->priority = stuff->priority;
+ if (priorityclient->priority != stuff->priority) {
+ priorityclient->priority = stuff->priority;
- /* The following will force the server back into WaitForSomething
- * so that the change in this client's priority is immediately
- * reflected.
- */
- isItTimeToYield = TRUE;
- dispatchException |= DE_PRIORITYCHANGE;
+ /* The following will force the server back into WaitForSomething
+ * so that the change in this client's priority is immediately
+ * reflected.
+ */
+ isItTimeToYield = TRUE;
+ dispatchException |= DE_PRIORITYCHANGE;
}
return Success;
}
@@ -1418,12 +1324,12 @@ ProcSyncGetPriority(ClientPtr client)
REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
if (stuff->id == None)
- priorityclient = client;
+ priorityclient = client;
else {
- rc = dixLookupClient(&priorityclient, stuff->id, client,
- DixGetAttrAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupClient(&priorityclient, stuff->id, client,
+ DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
}
rep.type = X_Reply;
@@ -1431,10 +1337,9 @@ ProcSyncGetPriority(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.priority = priorityclient->priority;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.priority);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.priority);
}
WriteToClient(client, sizeof(xSyncGetPriorityReply), (char *) &rep);
@@ -1449,15 +1354,16 @@ static int
ProcSyncCreateCounter(ClientPtr client)
{
REQUEST(xSyncCreateCounterReq);
- CARD64 initial;
+ CARD64 initial;
REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
LEGAL_NEW_RESOURCE(stuff->cid, client);
- XSyncIntsToValue(&initial, stuff->initial_value_lo, stuff->initial_value_hi);
+ XSyncIntsToValue(&initial, stuff->initial_value_lo,
+ stuff->initial_value_hi);
if (!SyncCreateCounter(client, stuff->cid, initial))
- return BadAlloc;
+ return BadAlloc;
return Success;
}
@@ -1469,21 +1375,20 @@ static int
ProcSyncSetCounter(ClientPtr client)
{
REQUEST(xSyncSetCounterReq);
- SyncCounter *pCounter;
- CARD64 newvalue;
- int rc;
+ SyncCounter *pCounter;
+ CARD64 newvalue;
+ int rc;
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
- rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter,
- client, DixWriteAccess);
+ rc = dixLookupResourceByType((pointer *) &pCounter, stuff->cid, RTCounter,
+ client, DixWriteAccess);
if (rc != Success)
- return rc;
+ return rc;
- if (IsSystemCounter(pCounter))
- {
- client->errorValue = stuff->cid;
- return BadAccess;
+ if (IsSystemCounter(pCounter)) {
+ client->errorValue = stuff->cid;
+ return BadAccess;
}
XSyncIntsToValue(&newvalue, stuff->value_lo, stuff->value_hi);
@@ -1498,31 +1403,29 @@ static int
ProcSyncChangeCounter(ClientPtr client)
{
REQUEST(xSyncChangeCounterReq);
- SyncCounter *pCounter;
- CARD64 newvalue;
- Bool overflow;
- int rc;
+ SyncCounter *pCounter;
+ CARD64 newvalue;
+ Bool overflow;
+ int rc;
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
- rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter,
- client, DixWriteAccess);
+ rc = dixLookupResourceByType((pointer *) &pCounter, stuff->cid, RTCounter,
+ client, DixWriteAccess);
if (rc != Success)
- return rc;
+ return rc;
- if (IsSystemCounter(pCounter))
- {
- client->errorValue = stuff->cid;
- return BadAccess;
+ if (IsSystemCounter(pCounter)) {
+ client->errorValue = stuff->cid;
+ return BadAccess;
}
XSyncIntsToValue(&newvalue, stuff->value_lo, stuff->value_hi);
XSyncValueAdd(&newvalue, pCounter->value, newvalue, &overflow);
- if (overflow)
- {
- /* XXX 64 bit value can't fit in 32 bits; do the best we can */
- client->errorValue = stuff->value_hi;
- return BadValue;
+ if (overflow) {
+ /* XXX 64 bit value can't fit in 32 bits; do the best we can */
+ client->errorValue = stuff->value_hi;
+ return BadValue;
}
SyncChangeCounter(pCounter, newvalue);
return Success;
@@ -1535,26 +1438,25 @@ static int
ProcSyncDestroyCounter(ClientPtr client)
{
REQUEST(xSyncDestroyCounterReq);
- SyncCounter *pCounter;
+ SyncCounter *pCounter;
int rc;
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
- rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter, RTCounter,
- client, DixDestroyAccess);
+ rc = dixLookupResourceByType((pointer *) &pCounter, stuff->counter,
+ RTCounter, client, DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
- if (IsSystemCounter(pCounter))
- {
- client->errorValue = stuff->counter;
- return BadAccess;
+ if (IsSystemCounter(pCounter)) {
+ client->errorValue = stuff->counter;
+ return BadAccess;
}
FreeResource(pCounter->sync.id, RT_NONE);
return Success;
}
-static SyncAwaitUnion*
+static SyncAwaitUnion *
SyncAwaitPrologue(ClientPtr client, int items)
{
SyncAwaitUnion *pAwaitUnion;
@@ -1562,9 +1464,9 @@ SyncAwaitPrologue(ClientPtr client, int items)
/* all the memory for the entire await list is allocated
* here in one chunk
*/
- pAwaitUnion = malloc((items+1) * sizeof(SyncAwaitUnion));
+ pAwaitUnion = malloc((items + 1) * sizeof(SyncAwaitUnion));
if (!pAwaitUnion)
- return NULL;
+ return NULL;
/* first item is the header, remainder are real wait conditions */
@@ -1573,13 +1475,13 @@ SyncAwaitPrologue(ClientPtr client, int items)
pAwaitUnion->header.num_waitconditions = 0;
if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion))
- return NULL;
+ return NULL;
return pAwaitUnion;
}
static void
-SyncAwaitEpilogue(ClientPtr client, int items, SyncAwaitUnion *pAwaitUnion)
+SyncAwaitEpilogue(ClientPtr client, int items, SyncAwaitUnion * pAwaitUnion)
{
SyncAwait *pAwait;
int i;
@@ -1588,27 +1490,25 @@ SyncAwaitEpilogue(ClientPtr client, int items, SyncAwaitUnion *pAwaitUnion)
/* see if any of the triggers are already true */
- pAwait = &(pAwaitUnion+1)->await; /* skip over header */
- for (i = 0; i < items; i++, pAwait++)
- {
- CARD64 value;
-
- /* don't have to worry about NULL counters because the request
- * errors before we get here out if they occur
- */
- switch (pAwait->trigger.pSync->type) {
- case SYNC_COUNTER:
- value = ((SyncCounter *)pAwait->trigger.pSync)->value;
- break;
- default:
- XSyncIntToValue(&value, 0);
- }
+ pAwait = &(pAwaitUnion + 1)->await; /* skip over header */
+ for (i = 0; i < items; i++, pAwait++) {
+ CARD64 value;
+
+ /* don't have to worry about NULL counters because the request
+ * errors before we get here out if they occur
+ */
+ switch (pAwait->trigger.pSync->type) {
+ case SYNC_COUNTER:
+ value = ((SyncCounter *) pAwait->trigger.pSync)->value;
+ break;
+ default:
+ XSyncIntToValue(&value, 0);
+ }
- if ((*pAwait->trigger.CheckTrigger)(&pAwait->trigger, value))
- {
- (*pAwait->trigger.TriggerFired)(&pAwait->trigger);
- break; /* once is enough */
- }
+ if ((*pAwait->trigger.CheckTrigger) (&pAwait->trigger, value)) {
+ (*pAwait->trigger.TriggerFired) (&pAwait->trigger);
+ break; /* once is enough */
+ }
}
}
@@ -1619,12 +1519,12 @@ static int
ProcSyncAwait(ClientPtr client)
{
REQUEST(xSyncAwaitReq);
- int len, items;
- int i;
+ int len, items;
+ int i;
xSyncWaitCondition *pProtocolWaitConds;
SyncAwaitUnion *pAwaitUnion;
- SyncAwait *pAwait;
- int status;
+ SyncAwait *pAwait;
+ int status;
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
@@ -1632,63 +1532,58 @@ ProcSyncAwait(ClientPtr client)
len -= sz_xSyncAwaitReq;
items = len / sz_xSyncWaitCondition;
- if (items * sz_xSyncWaitCondition != len)
- {
- return BadLength;
+ if (items * sz_xSyncWaitCondition != len) {
+ return BadLength;
}
- if (items == 0)
- {
- client->errorValue = items; /* XXX protocol change */
- return BadValue;
+ if (items == 0) {
+ client->errorValue = items; /* XXX protocol change */
+ return BadValue;
}
if (!(pAwaitUnion = SyncAwaitPrologue(client, items)))
- return BadAlloc;
+ return BadAlloc;
/* don't need to do any more memory allocation for this request! */
- pProtocolWaitConds = (xSyncWaitCondition *) & stuff[1];
-
- pAwait = &(pAwaitUnion+1)->await; /* skip over header */
- for (i = 0; i < items; i++, pProtocolWaitConds++, pAwait++)
- {
- if (pProtocolWaitConds->counter == None) /* XXX protocol change */
- {
- /* this should take care of removing any triggers created by
- * this request that have already been registered on sync objects
- */
- FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
- client->errorValue = pProtocolWaitConds->counter;
- return SyncErrorBase + XSyncBadCounter;
- }
-
- /* sanity checks are in SyncInitTrigger */
- pAwait->trigger.pSync = NULL;
- pAwait->trigger.value_type = pProtocolWaitConds->value_type;
- XSyncIntsToValue(&pAwait->trigger.wait_value,
- pProtocolWaitConds->wait_value_lo,
- pProtocolWaitConds->wait_value_hi);
- pAwait->trigger.test_type = pProtocolWaitConds->test_type;
-
- status = SyncInitTrigger(client, &pAwait->trigger,
- pProtocolWaitConds->counter, RTCounter,
- XSyncCAAllTrigger);
- if (status != Success)
- {
- /* this should take care of removing any triggers created by
- * this request that have already been registered on sync objects
- */
- FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
- return status;
- }
- /* this is not a mistake -- same function works for both cases */
- pAwait->trigger.TriggerFired = SyncAwaitTriggerFired;
- pAwait->trigger.CounterDestroyed = SyncAwaitTriggerFired;
- XSyncIntsToValue(&pAwait->event_threshold,
- pProtocolWaitConds->event_threshold_lo,
- pProtocolWaitConds->event_threshold_hi);
- pAwait->pHeader = &pAwaitUnion->header;
- pAwaitUnion->header.num_waitconditions++;
+ pProtocolWaitConds = (xSyncWaitCondition *) &stuff[1];
+
+ pAwait = &(pAwaitUnion + 1)->await; /* skip over header */
+ for (i = 0; i < items; i++, pProtocolWaitConds++, pAwait++) {
+ if (pProtocolWaitConds->counter == None) { /* XXX protocol change */
+ /* this should take care of removing any triggers created by
+ * this request that have already been registered on sync objects
+ */
+ FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+ client->errorValue = pProtocolWaitConds->counter;
+ return SyncErrorBase + XSyncBadCounter;
+ }
+
+ /* sanity checks are in SyncInitTrigger */
+ pAwait->trigger.pSync = NULL;
+ pAwait->trigger.value_type = pProtocolWaitConds->value_type;
+ XSyncIntsToValue(&pAwait->trigger.wait_value,
+ pProtocolWaitConds->wait_value_lo,
+ pProtocolWaitConds->wait_value_hi);
+ pAwait->trigger.test_type = pProtocolWaitConds->test_type;
+
+ status = SyncInitTrigger(client, &pAwait->trigger,
+ pProtocolWaitConds->counter, RTCounter,
+ XSyncCAAllTrigger);
+ if (status != Success) {
+ /* this should take care of removing any triggers created by
+ * this request that have already been registered on sync objects
+ */
+ FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+ return status;
+ }
+ /* this is not a mistake -- same function works for both cases */
+ pAwait->trigger.TriggerFired = SyncAwaitTriggerFired;
+ pAwait->trigger.CounterDestroyed = SyncAwaitTriggerFired;
+ XSyncIntsToValue(&pAwait->event_threshold,
+ pProtocolWaitConds->event_threshold_lo,
+ pProtocolWaitConds->event_threshold_hi);
+ pAwait->pHeader = &pAwaitUnion->header;
+ pAwaitUnion->header.num_waitconditions++;
}
SyncAwaitEpilogue(client, items, pAwaitUnion);
@@ -1696,7 +1591,6 @@ ProcSyncAwait(ClientPtr client)
return Success;
}
-
/*
* ** Query a counter
*/
@@ -1705,15 +1599,15 @@ ProcSyncQueryCounter(ClientPtr client)
{
REQUEST(xSyncQueryCounterReq);
xSyncQueryCounterReply rep;
- SyncCounter *pCounter;
+ SyncCounter *pCounter;
int rc;
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
- rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter,
- RTCounter, client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pCounter, stuff->counter,
+ RTCounter, client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
@@ -1721,26 +1615,23 @@ ProcSyncQueryCounter(ClientPtr client)
/* if system counter, ask it what the current value is */
- if (IsSystemCounter(pCounter))
- {
- (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
- &pCounter->value);
+ if (IsSystemCounter(pCounter)) {
+ (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
+ &pCounter->value);
}
rep.value_hi = XSyncValueHigh32(pCounter->value);
rep.value_lo = XSyncValueLow32(pCounter->value);
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.value_hi);
- swapl(&rep.value_lo);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.value_hi);
+ swapl(&rep.value_lo);
}
WriteToClient(client, sizeof(xSyncQueryCounterReply), (char *) &rep);
return Success;
}
-
/*
* ** Create Alarm
*/
@@ -1748,10 +1639,10 @@ static int
ProcSyncCreateAlarm(ClientPtr client)
{
REQUEST(xSyncCreateAlarmReq);
- SyncAlarm *pAlarm;
- int status;
- unsigned long len, vmask;
- SyncTrigger *pTrigger;
+ SyncAlarm *pAlarm;
+ int status;
+ unsigned long len, vmask;
+ SyncTrigger *pTrigger;
REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
@@ -1760,12 +1651,11 @@ ProcSyncCreateAlarm(ClientPtr client)
vmask = stuff->valueMask;
len = client->req_len - bytes_to_int32(sizeof(xSyncCreateAlarmReq));
/* the "extra" call to Ones accounts for the presence of 64 bit values */
- if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta))))
- return BadLength;
+ if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue | XSyncCADelta))))
+ return BadLength;
- if (!(pAlarm = malloc(sizeof(SyncAlarm))))
- {
- return BadAlloc;
+ if (!(pAlarm = malloc(sizeof(SyncAlarm)))) {
+ return BadAlloc;
}
/* set up defaults */
@@ -1778,11 +1668,10 @@ ProcSyncCreateAlarm(ClientPtr client)
pTrigger->TriggerFired = SyncAlarmTriggerFired;
pTrigger->CounterDestroyed = SyncAlarmCounterDestroyed;
status = SyncInitTrigger(client, pTrigger, None, RTCounter,
- XSyncCAAllTrigger);
- if (status != Success)
- {
- free(pAlarm);
- return status;
+ XSyncCAAllTrigger);
+ if (status != Success) {
+ free(pAlarm);
+ return status;
}
pAlarm->client = client;
@@ -1792,39 +1681,35 @@ ProcSyncCreateAlarm(ClientPtr client)
pAlarm->state = XSyncAlarmInactive;
pAlarm->pEventClients = NULL;
status = SyncChangeAlarmAttributes(client, pAlarm, vmask,
- (CARD32 *)&stuff[1]);
- if (status != Success)
- {
- free(pAlarm);
- return status;
+ (CARD32 *) &stuff[1]);
+ if (status != Success) {
+ free(pAlarm);
+ return status;
}
if (!AddResource(stuff->id, RTAlarm, pAlarm))
- return BadAlloc;
+ return BadAlloc;
/* see if alarm already triggered. NULL counter will not trigger
* in CreateAlarm and sets alarm state to Inactive.
*/
- if (!pTrigger->pSync)
- {
- pAlarm->state = XSyncAlarmInactive; /* XXX protocol change */
+ if (!pTrigger->pSync) {
+ pAlarm->state = XSyncAlarmInactive; /* XXX protocol change */
}
- else
- {
- SyncCounter *pCounter;
+ else {
+ SyncCounter *pCounter;
- if (!SyncCheckWarnIsCounter(pTrigger->pSync,
- WARN_INVALID_COUNTER_ALARM))
- {
- FreeResource(stuff->id, RT_NONE);
- return BadAlloc;
- }
+ if (!SyncCheckWarnIsCounter(pTrigger->pSync,
+ WARN_INVALID_COUNTER_ALARM)) {
+ FreeResource(stuff->id, RT_NONE);
+ return BadAlloc;
+ }
- pCounter = (SyncCounter *)pTrigger->pSync;
+ pCounter = (SyncCounter *) pTrigger->pSync;
- if ((*pTrigger->CheckTrigger)(pTrigger, pCounter->value))
- (*pTrigger->TriggerFired)(pTrigger);
+ if ((*pTrigger->CheckTrigger) (pTrigger, pCounter->value))
+ (*pTrigger->TriggerFired) (pTrigger);
}
return Success;
@@ -1837,40 +1722,39 @@ static int
ProcSyncChangeAlarm(ClientPtr client)
{
REQUEST(xSyncChangeAlarmReq);
- SyncAlarm *pAlarm;
+ SyncAlarm *pAlarm;
SyncCounter *pCounter = NULL;
- long vmask;
- int len, status;
+ long vmask;
+ int len, status;
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
- status = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm,
- client, DixWriteAccess);
+ status = dixLookupResourceByType((pointer *) &pAlarm, stuff->alarm, RTAlarm,
+ client, DixWriteAccess);
if (status != Success)
- return status;
+ return status;
vmask = stuff->valueMask;
len = client->req_len - bytes_to_int32(sizeof(xSyncChangeAlarmReq));
/* the "extra" call to Ones accounts for the presence of 64 bit values */
- if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta))))
- return BadLength;
+ if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue | XSyncCADelta))))
+ return BadLength;
if ((status = SyncChangeAlarmAttributes(client, pAlarm, vmask,
- (CARD32 *)&stuff[1])) != Success)
- return status;
+ (CARD32 *) &stuff[1])) != Success)
+ return status;
if (SyncCheckWarnIsCounter(pAlarm->trigger.pSync,
- WARN_INVALID_COUNTER_ALARM))
- pCounter = (SyncCounter *)pAlarm->trigger.pSync;
+ WARN_INVALID_COUNTER_ALARM))
+ pCounter = (SyncCounter *) pAlarm->trigger.pSync;
/* see if alarm already triggered. NULL counter WILL trigger
* in ChangeAlarm.
*/
if (!pCounter ||
- (*pAlarm->trigger.CheckTrigger)(&pAlarm->trigger, pCounter->value))
- {
- (*pAlarm->trigger.TriggerFired)(&pAlarm->trigger);
+ (*pAlarm->trigger.CheckTrigger) (&pAlarm->trigger, pCounter->value)) {
+ (*pAlarm->trigger.TriggerFired) (&pAlarm->trigger);
}
return Success;
}
@@ -1879,29 +1763,30 @@ static int
ProcSyncQueryAlarm(ClientPtr client)
{
REQUEST(xSyncQueryAlarmReq);
- SyncAlarm *pAlarm;
+ SyncAlarm *pAlarm;
xSyncQueryAlarmReply rep;
- SyncTrigger *pTrigger;
+ SyncTrigger *pTrigger;
int rc;
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
- rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm,
- client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pAlarm, stuff->alarm, RTAlarm,
+ client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
- rep.length = bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply));
+ rep.length =
+ bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply));
rep.sequenceNumber = client->sequence;
pTrigger = &pAlarm->trigger;
rep.counter = (pTrigger->pSync) ? pTrigger->pSync->id : None;
-#if 0 /* XXX unclear what to do, depends on whether relative value-types
- * are "consumed" immediately and are considered absolute from then
- * on.
- */
+#if 0 /* XXX unclear what to do, depends on whether relative value-types
+ * are "consumed" immediately and are considered absolute from then
+ * on.
+ */
rep.value_type = pTrigger->value_type;
rep.wait_value_hi = XSyncValueHigh32(pTrigger->wait_value);
rep.wait_value_lo = XSyncValueLow32(pTrigger->wait_value);
@@ -1917,16 +1802,15 @@ ProcSyncQueryAlarm(ClientPtr client)
rep.events = pAlarm->events;
rep.state = pAlarm->state;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.counter);
- swapl(&rep.wait_value_hi);
- swapl(&rep.wait_value_lo);
- swapl(&rep.test_type);
- swapl(&rep.delta_hi);
- swapl(&rep.delta_lo);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.counter);
+ swapl(&rep.wait_value_hi);
+ swapl(&rep.wait_value_lo);
+ swapl(&rep.test_type);
+ swapl(&rep.delta_hi);
+ swapl(&rep.delta_lo);
}
WriteToClient(client, sizeof(xSyncQueryAlarmReply), (char *) &rep);
@@ -1938,14 +1822,15 @@ ProcSyncDestroyAlarm(ClientPtr client)
{
SyncAlarm *pAlarm;
int rc;
+
REQUEST(xSyncDestroyAlarmReq);
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
- rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm,
- client, DixDestroyAccess);
+ rc = dixLookupResourceByType((pointer *) &pAlarm, stuff->alarm, RTAlarm,
+ client, DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
FreeResource(stuff->alarm, RT_NONE);
return Success;
@@ -1963,19 +1848,17 @@ ProcSyncCreateFence(ClientPtr client)
rc = dixLookupDrawable(&pDraw, stuff->d, client, M_ANY, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
LEGAL_NEW_RESOURCE(stuff->fid, client);
- if (!(pFence = (SyncFence *)SyncCreate(client,
- stuff->fid,
- SYNC_FENCE)))
- return BadAlloc;
+ if (!(pFence = (SyncFence *) SyncCreate(client, stuff->fid, SYNC_FENCE)))
+ return BadAlloc;
miSyncInitFence(pDraw->pScreen, pFence, stuff->initially_triggered);
if (!AddResource(stuff->fid, RTFence, (pointer) pFence))
- return BadAlloc;
+ return BadAlloc;
return client->noClientException;
}
@@ -1990,14 +1873,14 @@ FreeFence(void *obj, XID id)
return Success;
}
-int SyncVerifyFence(SyncFence **ppSyncFence, XID fid,
- ClientPtr client, Mask mode)
+int
+SyncVerifyFence(SyncFence ** ppSyncFence, XID fid, ClientPtr client, Mask mode)
{
- int rc = dixLookupResourceByType((pointer *)ppSyncFence, fid, RTFence,
- client, mode);
+ int rc = dixLookupResourceByType((pointer *) ppSyncFence, fid, RTFence,
+ client, mode);
if (rc != Success)
- client->errorValue = fid;
+ client->errorValue = fid;
return rc;
}
@@ -2011,10 +1894,10 @@ ProcSyncTriggerFence(ClientPtr client)
REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
- rc = dixLookupResourceByType((pointer *)&pFence, stuff->fid, RTFence,
- client, DixWriteAccess);
+ rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid, RTFence,
+ client, DixWriteAccess);
if (rc != Success)
- return rc;
+ return rc;
miSyncTriggerFence(pFence);
@@ -2030,13 +1913,13 @@ ProcSyncResetFence(ClientPtr client)
REQUEST_SIZE_MATCH(xSyncResetFenceReq);
- rc = dixLookupResourceByType((pointer *)&pFence, stuff->fid, RTFence,
- client, DixWriteAccess);
+ rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid, RTFence,
+ client, DixWriteAccess);
if (rc != Success)
- return rc;
+ return rc;
if (pFence->funcs.CheckTriggered(pFence) != TRUE)
- return BadMatch;
+ return BadMatch;
pFence->funcs.Reset(pFence);
@@ -2052,10 +1935,10 @@ ProcSyncDestroyFence(ClientPtr client)
REQUEST_SIZE_MATCH(xSyncDestroyFenceReq);
- rc = dixLookupResourceByType((pointer *)&pFence, stuff->fid, RTFence,
- client, DixDestroyAccess);
+ rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid, RTFence,
+ client, DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
FreeResource(stuff->fid, RT_NONE);
return client->noClientException;
@@ -2071,10 +1954,10 @@ ProcSyncQueryFence(ClientPtr client)
REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
- rc = dixLookupResourceByType((pointer *)&pFence, stuff->fid,
- RTFence, client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid,
+ RTFence, client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
@@ -2082,10 +1965,9 @@ ProcSyncQueryFence(ClientPtr client)
rep.triggered = pFence->funcs.CheckTriggered(pFence);
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
WriteToClient(client, sizeof(xSyncQueryFenceReply), (char *) &rep);
@@ -2098,6 +1980,7 @@ ProcSyncAwaitFence(ClientPtr client)
REQUEST(xSyncAwaitFenceReq);
SyncAwaitUnion *pAwaitUnion;
SyncAwait *pAwait;
+
/* Use CARD32 rather than XSyncFence because XIDs are hard-coded to
* CARD32 in protocol definitions */
CARD32 *pProtocolFences;
@@ -2112,62 +1995,56 @@ ProcSyncAwaitFence(ClientPtr client)
len -= sz_xSyncAwaitFenceReq;
items = len / sizeof(CARD32);
- if (items * sizeof(CARD32) != len)
- {
- return BadLength;
+ if (items * sizeof(CARD32) != len) {
+ return BadLength;
}
- if (items == 0)
- {
- client->errorValue = items;
- return BadValue;
+ if (items == 0) {
+ client->errorValue = items;
+ return BadValue;
}
if (!(pAwaitUnion = SyncAwaitPrologue(client, items)))
- return BadAlloc;
+ return BadAlloc;
/* don't need to do any more memory allocation for this request! */
- pProtocolFences = (CARD32 *) & stuff[1];
-
- pAwait = &(pAwaitUnion+1)->await; /* skip over header */
- for (i = 0; i < items; i++, pProtocolFences++, pAwait++)
- {
- if (*pProtocolFences == None)
- {
- /* this should take care of removing any triggers created by
- * this request that have already been registered on sync objects
- */
- FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
- client->errorValue = *pProtocolFences;
- return SyncErrorBase + XSyncBadFence;
- }
-
- pAwait->trigger.pSync = NULL;
- /* Provide acceptable values for these unused fields to
- * satisfy SyncInitTrigger's validation logic
- */
- pAwait->trigger.value_type = XSyncAbsolute;
- XSyncIntToValue(&pAwait->trigger.wait_value, 0);
- pAwait->trigger.test_type = 0;
-
- status = SyncInitTrigger(client, &pAwait->trigger,
- *pProtocolFences, RTFence,
- XSyncCAAllTrigger);
- if (status != Success)
- {
- /* this should take care of removing any triggers created by
- * this request that have already been registered on sync objects
- */
- FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
- return status;
- }
- /* this is not a mistake -- same function works for both cases */
- pAwait->trigger.TriggerFired = SyncAwaitTriggerFired;
- pAwait->trigger.CounterDestroyed = SyncAwaitTriggerFired;
- /* event_threshold is unused for fence syncs */
- XSyncIntToValue(&pAwait->event_threshold, 0);
- pAwait->pHeader = &pAwaitUnion->header;
- pAwaitUnion->header.num_waitconditions++;
+ pProtocolFences = (CARD32 *) &stuff[1];
+
+ pAwait = &(pAwaitUnion + 1)->await; /* skip over header */
+ for (i = 0; i < items; i++, pProtocolFences++, pAwait++) {
+ if (*pProtocolFences == None) {
+ /* this should take care of removing any triggers created by
+ * this request that have already been registered on sync objects
+ */
+ FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+ client->errorValue = *pProtocolFences;
+ return SyncErrorBase + XSyncBadFence;
+ }
+
+ pAwait->trigger.pSync = NULL;
+ /* Provide acceptable values for these unused fields to
+ * satisfy SyncInitTrigger's validation logic
+ */
+ pAwait->trigger.value_type = XSyncAbsolute;
+ XSyncIntToValue(&pAwait->trigger.wait_value, 0);
+ pAwait->trigger.test_type = 0;
+
+ status = SyncInitTrigger(client, &pAwait->trigger,
+ *pProtocolFences, RTFence, XSyncCAAllTrigger);
+ if (status != Success) {
+ /* this should take care of removing any triggers created by
+ * this request that have already been registered on sync objects
+ */
+ FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+ return status;
+ }
+ /* this is not a mistake -- same function works for both cases */
+ pAwait->trigger.TriggerFired = SyncAwaitTriggerFired;
+ pAwait->trigger.CounterDestroyed = SyncAwaitTriggerFired;
+ /* event_threshold is unused for fence syncs */
+ XSyncIntToValue(&pAwait->event_threshold, 0);
+ pAwait->pHeader = &pAwaitUnion->header;
+ pAwaitUnion->header.num_waitconditions++;
}
SyncAwaitEpilogue(client, items, pAwaitUnion);
@@ -2183,50 +2060,49 @@ ProcSyncDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
- case X_SyncInitialize:
- return ProcSyncInitialize(client);
- case X_SyncListSystemCounters:
- return ProcSyncListSystemCounters(client);
- case X_SyncCreateCounter:
- return ProcSyncCreateCounter(client);
- case X_SyncSetCounter:
- return ProcSyncSetCounter(client);
- case X_SyncChangeCounter:
- return ProcSyncChangeCounter(client);
- case X_SyncQueryCounter:
- return ProcSyncQueryCounter(client);
- case X_SyncDestroyCounter:
- return ProcSyncDestroyCounter(client);
- case X_SyncAwait:
- return ProcSyncAwait(client);
- case X_SyncCreateAlarm:
- return ProcSyncCreateAlarm(client);
- case X_SyncChangeAlarm:
- return ProcSyncChangeAlarm(client);
- case X_SyncQueryAlarm:
- return ProcSyncQueryAlarm(client);
- case X_SyncDestroyAlarm:
- return ProcSyncDestroyAlarm(client);
- case X_SyncSetPriority:
- return ProcSyncSetPriority(client);
- case X_SyncGetPriority:
- return ProcSyncGetPriority(client);
- case X_SyncCreateFence:
- return ProcSyncCreateFence(client);
- case X_SyncTriggerFence:
- return ProcSyncTriggerFence(client);
- case X_SyncResetFence:
- return ProcSyncResetFence(client);
- case X_SyncDestroyFence:
- return ProcSyncDestroyFence(client);
- case X_SyncQueryFence:
- return ProcSyncQueryFence(client);
- case X_SyncAwaitFence:
- return ProcSyncAwaitFence(client);
- default:
- return BadRequest;
+ switch (stuff->data) {
+ case X_SyncInitialize:
+ return ProcSyncInitialize(client);
+ case X_SyncListSystemCounters:
+ return ProcSyncListSystemCounters(client);
+ case X_SyncCreateCounter:
+ return ProcSyncCreateCounter(client);
+ case X_SyncSetCounter:
+ return ProcSyncSetCounter(client);
+ case X_SyncChangeCounter:
+ return ProcSyncChangeCounter(client);
+ case X_SyncQueryCounter:
+ return ProcSyncQueryCounter(client);
+ case X_SyncDestroyCounter:
+ return ProcSyncDestroyCounter(client);
+ case X_SyncAwait:
+ return ProcSyncAwait(client);
+ case X_SyncCreateAlarm:
+ return ProcSyncCreateAlarm(client);
+ case X_SyncChangeAlarm:
+ return ProcSyncChangeAlarm(client);
+ case X_SyncQueryAlarm:
+ return ProcSyncQueryAlarm(client);
+ case X_SyncDestroyAlarm:
+ return ProcSyncDestroyAlarm(client);
+ case X_SyncSetPriority:
+ return ProcSyncSetPriority(client);
+ case X_SyncGetPriority:
+ return ProcSyncGetPriority(client);
+ case X_SyncCreateFence:
+ return ProcSyncCreateFence(client);
+ case X_SyncTriggerFence:
+ return ProcSyncTriggerFence(client);
+ case X_SyncResetFence:
+ return ProcSyncResetFence(client);
+ case X_SyncDestroyFence:
+ return ProcSyncDestroyFence(client);
+ case X_SyncQueryFence:
+ return ProcSyncQueryFence(client);
+ case X_SyncAwaitFence:
+ return ProcSyncAwaitFence(client);
+ default:
+ return BadRequest;
}
}
@@ -2239,7 +2115,7 @@ SProcSyncInitialize(ClientPtr client)
{
REQUEST(xSyncInitializeReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncInitializeReq);
+ REQUEST_SIZE_MATCH(xSyncInitializeReq);
return ProcSyncInitialize(client);
}
@@ -2249,7 +2125,7 @@ SProcSyncListSystemCounters(ClientPtr client)
{
REQUEST(xSyncListSystemCountersReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncListSystemCountersReq);
+ REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
return ProcSyncListSystemCounters(client);
}
@@ -2259,7 +2135,7 @@ SProcSyncCreateCounter(ClientPtr client)
{
REQUEST(xSyncCreateCounterReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncCreateCounterReq);
+ REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
swapl(&stuff->cid);
swapl(&stuff->initial_value_lo);
swapl(&stuff->initial_value_hi);
@@ -2272,7 +2148,7 @@ SProcSyncSetCounter(ClientPtr client)
{
REQUEST(xSyncSetCounterReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncSetCounterReq);
+ REQUEST_SIZE_MATCH(xSyncSetCounterReq);
swapl(&stuff->cid);
swapl(&stuff->value_lo);
swapl(&stuff->value_hi);
@@ -2285,7 +2161,7 @@ SProcSyncChangeCounter(ClientPtr client)
{
REQUEST(xSyncChangeCounterReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncChangeCounterReq);
+ REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
swapl(&stuff->cid);
swapl(&stuff->value_lo);
swapl(&stuff->value_hi);
@@ -2298,7 +2174,7 @@ SProcSyncQueryCounter(ClientPtr client)
{
REQUEST(xSyncQueryCounterReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncQueryCounterReq);
+ REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
swapl(&stuff->counter);
return ProcSyncQueryCounter(client);
@@ -2309,7 +2185,7 @@ SProcSyncDestroyCounter(ClientPtr client)
{
REQUEST(xSyncDestroyCounterReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncDestroyCounterReq);
+ REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
swapl(&stuff->counter);
return ProcSyncDestroyCounter(client);
@@ -2356,7 +2232,7 @@ SProcSyncQueryAlarm(ClientPtr client)
{
REQUEST(xSyncQueryAlarmReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncQueryAlarmReq);
+ REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
swapl(&stuff->alarm);
return ProcSyncQueryAlarm(client);
@@ -2367,7 +2243,7 @@ SProcSyncDestroyAlarm(ClientPtr client)
{
REQUEST(xSyncDestroyAlarmReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncDestroyAlarmReq);
+ REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
swapl(&stuff->alarm);
return ProcSyncDestroyAlarm(client);
@@ -2378,7 +2254,7 @@ SProcSyncSetPriority(ClientPtr client)
{
REQUEST(xSyncSetPriorityReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncSetPriorityReq);
+ REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
swapl(&stuff->id);
swapl(&stuff->priority);
@@ -2390,7 +2266,7 @@ SProcSyncGetPriority(ClientPtr client)
{
REQUEST(xSyncGetPriorityReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncGetPriorityReq);
+ REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
swapl(&stuff->id);
return ProcSyncGetPriority(client);
@@ -2401,7 +2277,7 @@ SProcSyncCreateFence(ClientPtr client)
{
REQUEST(xSyncCreateFenceReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncCreateFenceReq);
+ REQUEST_SIZE_MATCH(xSyncCreateFenceReq);
swapl(&stuff->fid);
return ProcSyncCreateFence(client);
@@ -2412,7 +2288,7 @@ SProcSyncTriggerFence(ClientPtr client)
{
REQUEST(xSyncTriggerFenceReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncTriggerFenceReq);
+ REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
swapl(&stuff->fid);
return ProcSyncTriggerFence(client);
@@ -2423,7 +2299,7 @@ SProcSyncResetFence(ClientPtr client)
{
REQUEST(xSyncResetFenceReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncResetFenceReq);
+ REQUEST_SIZE_MATCH(xSyncResetFenceReq);
swapl(&stuff->fid);
return ProcSyncResetFence(client);
@@ -2434,7 +2310,7 @@ SProcSyncDestroyFence(ClientPtr client)
{
REQUEST(xSyncDestroyFenceReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncDestroyFenceReq);
+ REQUEST_SIZE_MATCH(xSyncDestroyFenceReq);
swapl(&stuff->fid);
return ProcSyncDestroyFence(client);
@@ -2445,7 +2321,7 @@ SProcSyncQueryFence(ClientPtr client)
{
REQUEST(xSyncQueryFenceReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xSyncQueryFenceReq);
+ REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
swapl(&stuff->fid);
return ProcSyncQueryFence(client);
@@ -2467,50 +2343,49 @@ SProcSyncDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
- case X_SyncInitialize:
- return SProcSyncInitialize(client);
- case X_SyncListSystemCounters:
- return SProcSyncListSystemCounters(client);
- case X_SyncCreateCounter:
- return SProcSyncCreateCounter(client);
- case X_SyncSetCounter:
- return SProcSyncSetCounter(client);
- case X_SyncChangeCounter:
- return SProcSyncChangeCounter(client);
- case X_SyncQueryCounter:
- return SProcSyncQueryCounter(client);
- case X_SyncDestroyCounter:
- return SProcSyncDestroyCounter(client);
- case X_SyncAwait:
- return SProcSyncAwait(client);
- case X_SyncCreateAlarm:
- return SProcSyncCreateAlarm(client);
- case X_SyncChangeAlarm:
- return SProcSyncChangeAlarm(client);
- case X_SyncQueryAlarm:
- return SProcSyncQueryAlarm(client);
- case X_SyncDestroyAlarm:
- return SProcSyncDestroyAlarm(client);
- case X_SyncSetPriority:
- return SProcSyncSetPriority(client);
- case X_SyncGetPriority:
- return SProcSyncGetPriority(client);
- case X_SyncCreateFence:
- return SProcSyncCreateFence(client);
- case X_SyncTriggerFence:
- return SProcSyncTriggerFence(client);
- case X_SyncResetFence:
- return SProcSyncResetFence(client);
- case X_SyncDestroyFence:
- return SProcSyncDestroyFence(client);
- case X_SyncQueryFence:
- return SProcSyncQueryFence(client);
- case X_SyncAwaitFence:
- return SProcSyncAwaitFence(client);
- default:
- return BadRequest;
+ switch (stuff->data) {
+ case X_SyncInitialize:
+ return SProcSyncInitialize(client);
+ case X_SyncListSystemCounters:
+ return SProcSyncListSystemCounters(client);
+ case X_SyncCreateCounter:
+ return SProcSyncCreateCounter(client);
+ case X_SyncSetCounter:
+ return SProcSyncSetCounter(client);
+ case X_SyncChangeCounter:
+ return SProcSyncChangeCounter(client);
+ case X_SyncQueryCounter:
+ return SProcSyncQueryCounter(client);
+ case X_SyncDestroyCounter:
+ return SProcSyncDestroyCounter(client);
+ case X_SyncAwait:
+ return SProcSyncAwait(client);
+ case X_SyncCreateAlarm:
+ return SProcSyncCreateAlarm(client);
+ case X_SyncChangeAlarm:
+ return SProcSyncChangeAlarm(client);
+ case X_SyncQueryAlarm:
+ return SProcSyncQueryAlarm(client);
+ case X_SyncDestroyAlarm:
+ return SProcSyncDestroyAlarm(client);
+ case X_SyncSetPriority:
+ return SProcSyncSetPriority(client);
+ case X_SyncGetPriority:
+ return SProcSyncGetPriority(client);
+ case X_SyncCreateFence:
+ return SProcSyncCreateFence(client);
+ case X_SyncTriggerFence:
+ return SProcSyncTriggerFence(client);
+ case X_SyncResetFence:
+ return SProcSyncResetFence(client);
+ case X_SyncDestroyFence:
+ return SProcSyncDestroyFence(client);
+ case X_SyncQueryFence:
+ return SProcSyncQueryFence(client);
+ case X_SyncAwaitFence:
+ return SProcSyncAwaitFence(client);
+ default:
+ return BadRequest;
}
}
@@ -2519,7 +2394,8 @@ SProcSyncDispatch(ClientPtr client)
*/
static void
-SCounterNotifyEvent(xSyncCounterNotifyEvent *from, xSyncCounterNotifyEvent *to)
+SCounterNotifyEvent(xSyncCounterNotifyEvent * from,
+ xSyncCounterNotifyEvent * to)
{
to->type = from->type;
to->kind = from->kind;
@@ -2534,9 +2410,8 @@ SCounterNotifyEvent(xSyncCounterNotifyEvent *from, xSyncCounterNotifyEvent *to)
to->destroyed = from->destroyed;
}
-
static void
-SAlarmNotifyEvent(xSyncAlarmNotifyEvent *from, xSyncAlarmNotifyEvent *to)
+SAlarmNotifyEvent(xSyncAlarmNotifyEvent * from, xSyncAlarmNotifyEvent * to)
{
to->type = from->type;
to->kind = from->kind;
@@ -2555,10 +2430,8 @@ SAlarmNotifyEvent(xSyncAlarmNotifyEvent *from, xSyncAlarmNotifyEvent *to)
*/
/* ARGSUSED */
static void
-SyncResetProc(ExtensionEntry *extEntry)
+SyncResetProc(ExtensionEntry * extEntry)
{
- free(SysCounterList);
- SysCounterList = NULL;
RTCounter = 0;
}
@@ -2569,41 +2442,42 @@ void
SyncExtensionInit(void)
{
ExtensionEntry *extEntry;
- int s;
+ int s;
+
+ xorg_list_init(&SysCounterList);
for (s = 0; s < screenInfo.numScreens; s++)
- miSyncSetup(screenInfo.screens[s]);
+ miSyncSetup(screenInfo.screens[s]);
- if (RTCounter == 0)
- {
- RTCounter = CreateNewResourceType(FreeCounter, "SyncCounter");
+ if (RTCounter == 0) {
+ RTCounter = CreateNewResourceType(FreeCounter, "SyncCounter");
}
RTAlarm = CreateNewResourceType(FreeAlarm, "SyncAlarm");
RTAwait = CreateNewResourceType(FreeAwait, "SyncAwait");
RTFence = CreateNewResourceType(FreeFence, "SyncFence");
if (RTAwait)
- RTAwait |= RC_NEVERRETAIN;
+ RTAwait |= RC_NEVERRETAIN;
RTAlarmClient = CreateNewResourceType(FreeAlarmClient, "SyncAlarmClient");
if (RTAlarmClient)
- RTAlarmClient |= RC_NEVERRETAIN;
+ RTAlarmClient |= RC_NEVERRETAIN;
if (RTCounter == 0 || RTAwait == 0 || RTAlarm == 0 ||
- RTAlarmClient == 0 ||
- (extEntry = AddExtension(SYNC_NAME,
- XSyncNumberEvents, XSyncNumberErrors,
- ProcSyncDispatch, SProcSyncDispatch,
- SyncResetProc,
- StandardMinorOpcode)) == NULL)
- {
- ErrorF("Sync Extension %d.%d failed to Initialise\n",
- SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION);
- return;
+ RTAlarmClient == 0 ||
+ (extEntry = AddExtension(SYNC_NAME,
+ XSyncNumberEvents, XSyncNumberErrors,
+ ProcSyncDispatch, SProcSyncDispatch,
+ SyncResetProc, StandardMinorOpcode)) == NULL) {
+ ErrorF("Sync Extension %d.%d failed to Initialise\n",
+ SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION);
+ return;
}
SyncEventBase = extEntry->eventBase;
SyncErrorBase = extEntry->errorBase;
- EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;
- EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent;
+ EventSwapVector[SyncEventBase + XSyncCounterNotify] =
+ (EventSwapPtr) SCounterNotifyEvent;
+ EventSwapVector[SyncEventBase + XSyncAlarmNotify] =
+ (EventSwapPtr) SAlarmNotifyEvent;
SetResourceTypeErrorValue(RTCounter, SyncErrorBase + XSyncBadCounter);
SetResourceTypeErrorValue(RTAlarm, SyncErrorBase + XSyncBadAlarm);
@@ -2620,17 +2494,14 @@ SyncExtensionInit(void)
#ifdef DEBUG
fprintf(stderr, "Sync Extension %d.%d\n",
- SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION);
+ SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION);
#endif
}
-
/*
* ***** SERVERTIME implementation - should go in its own file in OS directory?
*/
-
-
static pointer ServertimeCounter;
static XSyncValue Now;
static XSyncValue *pnext_time;
@@ -2647,72 +2518,62 @@ static XSyncValue *pnext_time;
*** Server Block Handler
*** code inspired by multibuffer extension (now deprecated)
*/
-/*ARGSUSED*/
-static void
+ /*ARGSUSED*/ static void
ServertimeBlockHandler(void *env, struct timeval **wt, void *LastSelectMask)
{
XSyncValue delay;
unsigned long timeout;
- if (pnext_time)
- {
+ if (pnext_time) {
GetTime();
- if (XSyncValueGreaterOrEqual(Now, *pnext_time))
- {
+ if (XSyncValueGreaterOrEqual(Now, *pnext_time)) {
timeout = 0;
}
- else
- {
- Bool overflow;
+ else {
+ Bool overflow;
+
XSyncValueSubtract(&delay, *pnext_time, Now, &overflow);
- (void)overflow;
+ (void) overflow;
timeout = XSyncValueLow32(delay);
}
- AdjustWaitForDelay(wt, timeout); /* os/utils.c */
+ AdjustWaitForDelay(wt, timeout); /* os/utils.c */
}
}
/*
*** Wakeup Handler
*/
-/*ARGSUSED*/
-static void
+ /*ARGSUSED*/ static void
ServertimeWakeupHandler(void *env, int rc, void *LastSelectMask)
{
- if (pnext_time)
- {
+ if (pnext_time) {
GetTime();
- if (XSyncValueGreaterOrEqual(Now, *pnext_time))
- {
+ if (XSyncValueGreaterOrEqual(Now, *pnext_time)) {
SyncChangeCounter(ServertimeCounter, Now);
}
}
}
static void
-ServertimeQueryValue(void *pCounter, CARD64 *pValue_return)
+ServertimeQueryValue(void *pCounter, CARD64 * pValue_return)
{
GetTime();
*pValue_return = Now;
}
static void
-ServertimeBracketValues(void *pCounter, CARD64 *pbracket_less,
- CARD64 *pbracket_greater)
+ServertimeBracketValues(void *pCounter, CARD64 * pbracket_less,
+ CARD64 * pbracket_greater)
{
- if (!pnext_time && pbracket_greater)
- {
- RegisterBlockAndWakeupHandlers(ServertimeBlockHandler,
- ServertimeWakeupHandler,
- NULL);
+ if (!pnext_time && pbracket_greater) {
+ RegisterBlockAndWakeupHandlers(ServertimeBlockHandler,
+ ServertimeWakeupHandler, NULL);
}
- else if (pnext_time && !pbracket_greater)
- {
- RemoveBlockAndWakeupHandlers(ServertimeBlockHandler,
- ServertimeWakeupHandler,
- NULL);
+ else if (pnext_time && !pbracket_greater) {
+ RemoveBlockAndWakeupHandlers(ServertimeBlockHandler,
+ ServertimeWakeupHandler, NULL);
}
pnext_time = pbracket_greater;
}
@@ -2725,157 +2586,202 @@ SyncInitServerTime(void)
XSyncIntsToValue(&Now, GetTimeInMillis(), 0);
XSyncIntToValue(&resolution, 4);
ServertimeCounter = SyncCreateSystemCounter("SERVERTIME", Now, resolution,
- XSyncCounterNeverDecreases,
- ServertimeQueryValue, ServertimeBracketValues);
+ XSyncCounterNeverDecreases,
+ ServertimeQueryValue,
+ ServertimeBracketValues);
pnext_time = NULL;
}
-
-
/*
* IDLETIME implementation
*/
-static SyncCounter *IdleTimeCounter;
-static XSyncValue *pIdleTimeValueLess;
-static XSyncValue *pIdleTimeValueGreater;
+typedef struct {
+ XSyncValue *value_less;
+ XSyncValue *value_greater;
+ int deviceid;
+} IdleCounterPriv;
static void
-IdleTimeQueryValue (pointer pCounter, CARD64 *pValue_return)
+IdleTimeQueryValue(pointer pCounter, CARD64 * pValue_return)
{
- CARD32 idle = GetTimeInMillis() - lastDeviceEventTime.milliseconds;
- XSyncIntsToValue (pValue_return, idle, 0);
+ int deviceid;
+ CARD32 idle;
+
+ if (pCounter) {
+ SyncCounter *counter = pCounter;
+ IdleCounterPriv *priv = SysCounterGetPrivate(counter);
+ deviceid = priv->deviceid;
+ }
+ else
+ deviceid = XIAllDevices;
+ idle = GetTimeInMillis() - lastDeviceEventTime[deviceid].milliseconds;
+ XSyncIntsToValue(pValue_return, idle, 0);
}
static void
-IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
+IdleTimeBlockHandler(pointer pCounter, struct timeval **wt, pointer LastSelectMask)
{
+ SyncCounter *counter = pCounter;
+ IdleCounterPriv *priv = SysCounterGetPrivate(counter);
+ XSyncValue *less = priv->value_less,
+ *greater = priv->value_greater;
XSyncValue idle, old_idle;
- SyncTriggerList *list = IdleTimeCounter->sync.pTriglist;
+ SyncTriggerList *list = counter->sync.pTriglist;
SyncTrigger *trig;
- if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
- return;
-
- old_idle = IdleTimeCounter->value;
- IdleTimeQueryValue (NULL, &idle);
- IdleTimeCounter->value = idle; /* push, so CheckTrigger works */
-
- if (pIdleTimeValueLess &&
- XSyncValueLessOrEqual (idle, *pIdleTimeValueLess))
- {
- /*
- * We've been idle for less than the threshold value, and someone
- * wants to know about that, but now we need to know whether they
- * want level or edge trigger. Check the trigger list against the
- * current idle time, and if any succeed, bomb out of select()
- * immediately so we can reschedule.
- */
-
- for (list = IdleTimeCounter->sync.pTriglist; list; list = list->next) {
- trig = list->pTrigger;
- if (trig->CheckTrigger(trig, old_idle)) {
- AdjustWaitForDelay(wt, 0);
- break;
- }
- }
- /*
- * We've been called exactly on the idle time, but we have a
- * NegativeTransition trigger which requires a transition from an
- * idle time greater than this. Schedule a wakeup for the next
- * millisecond so we won't miss a transition.
- */
- if (XSyncValueEqual (idle, *pIdleTimeValueLess))
- AdjustWaitForDelay(wt, 1);
- }
- else if (pIdleTimeValueGreater)
- {
- /*
- * There's a threshold in the positive direction. If we've been
- * idle less than it, schedule a wakeup for sometime in the future.
- * If we've been idle more than it, and someone wants to know about
- * that level-triggered, schedule an immediate wakeup.
- */
- unsigned long timeout = -1;
-
- if (XSyncValueLessThan (idle, *pIdleTimeValueGreater)) {
- XSyncValue value;
- Bool overflow;
-
- XSyncValueSubtract (&value, *pIdleTimeValueGreater,
- idle, &overflow);
- timeout = min(timeout, XSyncValueLow32 (value));
- } else {
- for (list = IdleTimeCounter->sync.pTriglist; list; list = list->next) {
- trig = list->pTrigger;
- if (trig->CheckTrigger(trig, old_idle)) {
- timeout = min(timeout, 0);
- break;
- }
- }
- }
-
- AdjustWaitForDelay (wt, timeout);
- }
-
- IdleTimeCounter->value = old_idle; /* pop */
+ if (!less && !greater)
+ return;
+
+ old_idle = counter->value;
+ IdleTimeQueryValue(NULL, &idle);
+ counter->value = idle; /* push, so CheckTrigger works */
+
+ if (less && XSyncValueLessOrEqual(idle, *less)) {
+ /*
+ * We've been idle for less than the threshold value, and someone
+ * wants to know about that, but now we need to know whether they
+ * want level or edge trigger. Check the trigger list against the
+ * current idle time, and if any succeed, bomb out of select()
+ * immediately so we can reschedule.
+ */
+
+ for (list = counter->sync.pTriglist; list; list = list->next) {
+ trig = list->pTrigger;
+ if (trig->CheckTrigger(trig, old_idle)) {
+ AdjustWaitForDelay(wt, 0);
+ break;
+ }
+ }
+ /*
+ * We've been called exactly on the idle time, but we have a
+ * NegativeTransition trigger which requires a transition from an
+ * idle time greater than this. Schedule a wakeup for the next
+ * millisecond so we won't miss a transition.
+ */
+ if (XSyncValueEqual(idle, *less))
+ AdjustWaitForDelay(wt, 1);
+ }
+ else if (greater) {
+ /*
+ * There's a threshold in the positive direction. If we've been
+ * idle less than it, schedule a wakeup for sometime in the future.
+ * If we've been idle more than it, and someone wants to know about
+ * that level-triggered, schedule an immediate wakeup.
+ */
+ unsigned long timeout = -1;
+
+ if (XSyncValueLessThan(idle, *greater)) {
+ XSyncValue value;
+ Bool overflow;
+
+ XSyncValueSubtract(&value, *greater, idle, &overflow);
+ timeout = min(timeout, XSyncValueLow32(value));
+ }
+ else {
+ for (list = counter->sync.pTriglist; list;
+ list = list->next) {
+ trig = list->pTrigger;
+ if (trig->CheckTrigger(trig, old_idle)) {
+ timeout = min(timeout, 0);
+ break;
+ }
+ }
+ }
+
+ AdjustWaitForDelay(wt, timeout);
+ }
+
+ counter->value = old_idle; /* pop */
}
static void
-IdleTimeWakeupHandler (pointer env, int rc, pointer LastSelectMask)
+IdleTimeWakeupHandler(pointer pCounter, int rc, pointer LastSelectMask)
{
+ SyncCounter *counter = pCounter;
+ IdleCounterPriv *priv = SysCounterGetPrivate(counter);
+ XSyncValue *less = priv->value_less,
+ *greater = priv->value_greater;
XSyncValue idle;
- if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
- return;
+ if (!less && !greater)
+ return;
- IdleTimeQueryValue (NULL, &idle);
+ IdleTimeQueryValue(pCounter, &idle);
- if ((pIdleTimeValueGreater &&
- XSyncValueGreaterOrEqual (idle, *pIdleTimeValueGreater)) ||
- (pIdleTimeValueLess &&
- XSyncValueLessOrEqual (idle, *pIdleTimeValueLess)))
- {
- SyncChangeCounter (IdleTimeCounter, idle);
+ if ((greater && XSyncValueGreaterOrEqual(idle, *greater)) ||
+ (less && XSyncValueLessOrEqual(idle, *less))) {
+ SyncChangeCounter(counter, idle);
}
}
static void
-IdleTimeBracketValues (pointer pCounter, CARD64 *pbracket_less,
- CARD64 *pbracket_greater)
+IdleTimeBracketValues(pointer pCounter, CARD64 * pbracket_less,
+ CARD64 * pbracket_greater)
{
- Bool registered = (pIdleTimeValueLess || pIdleTimeValueGreater);
+ SyncCounter *counter = pCounter;
+ IdleCounterPriv *priv = SysCounterGetPrivate(counter);
+ XSyncValue *less = priv->value_less,
+ *greater = priv->value_greater;
+ Bool registered = (less || greater);
- if (registered && !pbracket_less && !pbracket_greater)
- {
- RemoveBlockAndWakeupHandlers(IdleTimeBlockHandler,
- IdleTimeWakeupHandler,
- NULL);
+ if (registered && !pbracket_less && !pbracket_greater) {
+ RemoveBlockAndWakeupHandlers(IdleTimeBlockHandler,
+ IdleTimeWakeupHandler, pCounter);
}
- else if (!registered && (pbracket_less || pbracket_greater))
- {
- RegisterBlockAndWakeupHandlers(IdleTimeBlockHandler,
- IdleTimeWakeupHandler,
- NULL);
+ else if (!registered && (pbracket_less || pbracket_greater)) {
+ RegisterBlockAndWakeupHandlers(IdleTimeBlockHandler,
+ IdleTimeWakeupHandler, pCounter);
}
- pIdleTimeValueGreater = pbracket_greater;
- pIdleTimeValueLess = pbracket_less;
+ priv->value_greater = pbracket_greater;
+ priv->value_less = pbracket_less;
}
-static void
-SyncInitIdleTime (void)
+static SyncCounter*
+init_system_idle_counter(const char *name, int deviceid)
{
CARD64 resolution;
XSyncValue idle;
+ IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
+ SyncCounter *idle_time_counter;
+
+ IdleTimeQueryValue(NULL, &idle);
+ XSyncIntToValue(&resolution, 4);
+
+ idle_time_counter = SyncCreateSystemCounter(name, idle, resolution,
+ XSyncCounterUnrestricted,
+ IdleTimeQueryValue,
+ IdleTimeBracketValues);
+
+ priv->deviceid = deviceid;
+ priv->value_less = priv->value_greater = NULL;
- IdleTimeQueryValue (NULL, &idle);
- XSyncIntToValue (&resolution, 4);
+ idle_time_counter->pSysCounterInfo->private = priv;
- IdleTimeCounter = SyncCreateSystemCounter ("IDLETIME", idle, resolution,
- XSyncCounterUnrestricted,
- IdleTimeQueryValue,
- IdleTimeBracketValues);
+ return idle_time_counter;
+}
+
+static void
+SyncInitIdleTime(void)
+{
+ init_system_idle_counter("IDLETIME", XIAllDevices);
+}
- pIdleTimeValueLess = pIdleTimeValueGreater = NULL;
+SyncCounter*
+SyncInitDeviceIdleTime(DeviceIntPtr dev)
+{
+ char timer_name[64];
+ sprintf(timer_name, "DEVICEIDLETIME %d", dev->id);
+
+ return init_system_idle_counter(timer_name, dev->id);
+}
+
+void SyncRemoveDeviceIdleTime(SyncCounter *counter)
+{
+ /* FreeAllResources() frees all system counters before the devices are
+ shut down, check if there are any left before freeing the device's
+ counter */
+ if (!xorg_list_is_empty(&SysCounterList))
+ xorg_list_del(&counter->pSysCounterInfo->entry);
}
diff --git a/xorg-server/Xext/syncsrv.h b/xorg-server/Xext/syncsrv.h
index 46f25bdfc..dbed476f2 100644
--- a/xorg-server/Xext/syncsrv.h
+++ b/xorg-server/Xext/syncsrv.h
@@ -51,6 +51,7 @@ PERFORMANCE OF THIS SOFTWARE.
#ifndef _SYNCSRV_H_
#define _SYNCSRV_H_
+#include "list.h"
#include "misync.h"
#include "misyncstr.h"
@@ -65,82 +66,76 @@ typedef enum {
XSyncCounterUnrestricted
} SyncCounterType;
+typedef void (*SyncSystemCounterQueryValue)(pointer counter,
+ CARD64 *value_return
+ );
+typedef void (*SyncSystemCounterBracketValues)(pointer counter,
+ CARD64 *pbracket_less,
+ CARD64 *pbracket_greater
+ );
+
typedef struct _SysCounterInfo {
- const char *name;
- CARD64 resolution;
- CARD64 bracket_greater;
- CARD64 bracket_less;
- SyncCounterType counterType; /* how can this counter change */
- void (*QueryValue)(
- pointer /*pCounter*/,
- CARD64 * /*freshvalue*/
-);
- void (*BracketValues)(
- pointer /*pCounter*/,
- CARD64 * /*lessthan*/,
- CARD64 * /*greaterthan*/
-);
+ SyncCounter *pCounter;
+ char *name;
+ CARD64 resolution;
+ CARD64 bracket_greater;
+ CARD64 bracket_less;
+ SyncCounterType counterType; /* how can this counter change */
+ SyncSystemCounterQueryValue QueryValue;
+ SyncSystemCounterBracketValues BracketValues;
+ void *private;
+ struct xorg_list entry;
} SysCounterInfo;
-
-
typedef struct _SyncAlarmClientList {
- ClientPtr client;
- XID delete_id;
+ ClientPtr client;
+ XID delete_id;
struct _SyncAlarmClientList *next;
} SyncAlarmClientList;
typedef struct _SyncAlarm {
SyncTrigger trigger;
- ClientPtr client;
- XSyncAlarm alarm_id;
- CARD64 delta;
- int events;
- int state;
+ ClientPtr client;
+ XSyncAlarm alarm_id;
+ CARD64 delta;
+ int events;
+ int state;
SyncAlarmClientList *pEventClients;
} SyncAlarm;
typedef struct {
- ClientPtr client;
- CARD32 delete_id;
- int num_waitconditions;
+ ClientPtr client;
+ CARD32 delete_id;
+ int num_waitconditions;
} SyncAwaitHeader;
typedef struct {
SyncTrigger trigger;
- CARD64 event_threshold;
+ CARD64 event_threshold;
SyncAwaitHeader *pHeader;
} SyncAwait;
typedef union {
SyncAwaitHeader header;
- SyncAwait await;
+ SyncAwait await;
} SyncAwaitUnion;
-extern pointer SyncCreateSystemCounter(
- const char * /* name */,
- CARD64 /* inital_value */,
- CARD64 /* resolution */,
- SyncCounterType /* change characterization */,
- void (* /*QueryValue*/ ) (
- pointer /* pCounter */,
- CARD64 * /* pValue_return */), /* XXX prototype */
- void (* /*BracketValues*/) (
- pointer /* pCounter */,
- CARD64 * /* pbracket_less */,
- CARD64 * /* pbracket_greater */)
-);
-
-extern void SyncChangeCounter(
- SyncCounter * /* pCounter*/,
- CARD64 /* new_value */
-);
-
-extern void SyncDestroySystemCounter(
- pointer pCounter
-);
-
-extern void InitServertime(void);
+extern SyncCounter* SyncCreateSystemCounter(const char *name,
+ CARD64 initial_value,
+ CARD64 resolution,
+ SyncCounterType counterType,
+ SyncSystemCounterQueryValue QueryValue,
+ SyncSystemCounterBracketValues BracketValues
+ );
+
+extern void SyncChangeCounter(SyncCounter *pCounter,
+ CARD64 new_value
+ );
+
+extern void SyncDestroySystemCounter(pointer pCounter);
extern void SyncExtensionInit(void);
-#endif /* _SYNCSRV_H_ */
+
+extern SyncCounter *SyncInitDeviceIdleTime(DeviceIntPtr dev);
+extern void SyncRemoveDeviceIdleTime(SyncCounter *counter);
+#endif /* _SYNCSRV_H_ */
diff --git a/xorg-server/Xext/xace.c b/xorg-server/Xext/xace.c
index 69cb2bbdb..b4884fb6e 100644
--- a/xorg-server/Xext/xace.c
+++ b/xorg-server/Xext/xace.c
@@ -36,49 +36,53 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/Xtrans/Xtrans.h>
#include "../os/osdep.h"
-_X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
+_X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = { 0 };
/* Special-cased hook functions. Called by Xserver.
*/
-int XaceHookDispatch(ClientPtr client, int major)
+int
+XaceHookDispatch(ClientPtr client, int major)
{
/* Call the audit begin callback, there is no return value. */
XaceAuditRec rec = { client, 0 };
CallCallbacks(&XaceHooks[XACE_AUDIT_BEGIN], &rec);
if (major < 128) {
- /* Call the core dispatch hook */
- XaceCoreDispatchRec rec = { client, Success /* default allow */ };
- CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
- return rec.status;
- } else {
- /* Call the extension dispatch hook */
- ExtensionEntry *ext = GetExtensionEntry(major);
- XaceExtAccessRec rec = { client, ext, DixUseAccess, Success };
- if (ext)
- CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &rec);
- /* On error, pretend extension doesn't exist */
- return (rec.status == Success) ? Success : BadRequest;
+ /* Call the core dispatch hook */
+ XaceCoreDispatchRec rec = { client, Success /* default allow */ };
+ CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
+ return rec.status;
+ }
+ else {
+ /* Call the extension dispatch hook */
+ ExtensionEntry *ext = GetExtensionEntry(major);
+ XaceExtAccessRec rec = { client, ext, DixUseAccess, Success };
+ if (ext)
+ CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &rec);
+ /* On error, pretend extension doesn't exist */
+ return (rec.status == Success) ? Success : BadRequest;
}
}
-int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
- PropertyPtr *ppProp, Mask access_mode)
+int
+XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
+ PropertyPtr *ppProp, Mask access_mode)
{
XacePropertyAccessRec rec = { client, pWin, ppProp, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_PROPERTY_ACCESS], &rec);
return rec.status;
}
-int XaceHookSelectionAccess(ClientPtr client,
- Selection **ppSel, Mask access_mode)
+int
+XaceHookSelectionAccess(ClientPtr client, Selection ** ppSel, Mask access_mode)
{
XaceSelectionAccessRec rec = { client, ppSel, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec);
return rec.status;
}
-void XaceHookAuditEnd(ClientPtr ptr, int result)
+void
+XaceHookAuditEnd(ClientPtr ptr, int result)
{
XaceAuditRec rec = { ptr, result };
/* call callbacks, there is no return value. */
@@ -87,25 +91,26 @@ void XaceHookAuditEnd(ClientPtr ptr, int result)
/* Entry point for hook functions. Called by Xserver.
*/
-int XaceHook(int hook, ...)
+int
+XaceHook(int hook, ...)
{
union {
- XaceResourceAccessRec res;
- XaceDeviceAccessRec dev;
- XaceSendAccessRec send;
- XaceReceiveAccessRec recv;
- XaceClientAccessRec client;
- XaceExtAccessRec ext;
- XaceServerAccessRec server;
- XaceScreenAccessRec screen;
- XaceAuthAvailRec auth;
- XaceKeyAvailRec key;
+ XaceResourceAccessRec res;
+ XaceDeviceAccessRec dev;
+ XaceSendAccessRec send;
+ XaceReceiveAccessRec recv;
+ XaceClientAccessRec client;
+ XaceExtAccessRec ext;
+ XaceServerAccessRec server;
+ XaceScreenAccessRec screen;
+ XaceAuthAvailRec auth;
+ XaceKeyAvailRec key;
} u;
- int *prv = NULL; /* points to return value from callback */
- va_list ap; /* argument list */
+ int *prv = NULL; /* points to return value from callback */
+ va_list ap; /* argument list */
if (!XaceHooks[hook])
- return Success;
+ return Success;
va_start(ap, hook);
@@ -114,86 +119,97 @@ int XaceHook(int hook, ...)
* the arguments and integer return parameter, or in some cases just
* sets calldata directly to a single argument (with no return result)
*/
- switch (hook)
- {
- case XACE_RESOURCE_ACCESS:
- u.res.client = va_arg(ap, ClientPtr);
- u.res.id = va_arg(ap, XID);
- u.res.rtype = va_arg(ap, RESTYPE);
- u.res.res = va_arg(ap, pointer);
- u.res.ptype = va_arg(ap, RESTYPE);
- u.res.parent = va_arg(ap, pointer);
- u.res.access_mode = va_arg(ap, Mask);
- u.res.status = Success; /* default allow */
- prv = &u.res.status;
- break;
- case XACE_DEVICE_ACCESS:
- u.dev.client = va_arg(ap, ClientPtr);
- u.dev.dev = va_arg(ap, DeviceIntPtr);
- u.dev.access_mode = va_arg(ap, Mask);
- u.dev.status = Success; /* default allow */
- prv = &u.dev.status;
- break;
- case XACE_SEND_ACCESS:
- u.send.client = va_arg(ap, ClientPtr);
- u.send.dev = va_arg(ap, DeviceIntPtr);
- u.send.pWin = va_arg(ap, WindowPtr);
- u.send.events = va_arg(ap, xEventPtr);
- u.send.count = va_arg(ap, int);
- u.send.status = Success; /* default allow */
- prv = &u.send.status;
- break;
- case XACE_RECEIVE_ACCESS:
- u.recv.client = va_arg(ap, ClientPtr);
- u.recv.pWin = va_arg(ap, WindowPtr);
- u.recv.events = va_arg(ap, xEventPtr);
- u.recv.count = va_arg(ap, int);
- u.recv.status = Success; /* default allow */
- prv = &u.recv.status;
- break;
- case XACE_CLIENT_ACCESS:
- u.client.client = va_arg(ap, ClientPtr);
- u.client.target = va_arg(ap, ClientPtr);
- u.client.access_mode = va_arg(ap, Mask);
- u.client.status = Success; /* default allow */
- prv = &u.client.status;
- break;
- case XACE_EXT_ACCESS:
- u.ext.client = va_arg(ap, ClientPtr);
- u.ext.ext = va_arg(ap, ExtensionEntry*);
- u.ext.access_mode = DixGetAttrAccess;
- u.ext.status = Success; /* default allow */
- prv = &u.ext.status;
- break;
- case XACE_SERVER_ACCESS:
- u.server.client = va_arg(ap, ClientPtr);
- u.server.access_mode = va_arg(ap, Mask);
- u.server.status = Success; /* default allow */
- prv = &u.server.status;
- break;
- case XACE_SCREEN_ACCESS:
- case XACE_SCREENSAVER_ACCESS:
- u.screen.client = va_arg(ap, ClientPtr);
- u.screen.screen = va_arg(ap, ScreenPtr);
- u.screen.access_mode = va_arg(ap, Mask);
- u.screen.status = Success; /* default allow */
- prv = &u.screen.status;
- break;
- case XACE_AUTH_AVAIL:
- u.auth.client = va_arg(ap, ClientPtr);
- u.auth.authId = va_arg(ap, XID);
- break;
- case XACE_KEY_AVAIL:
- u.key.event = va_arg(ap, xEventPtr);
- u.key.keybd = va_arg(ap, DeviceIntPtr);
- u.key.count = va_arg(ap, int);
- break;
- default:
- va_end(ap);
- return 0; /* unimplemented hook number */
+ switch (hook) {
+ case XACE_RESOURCE_ACCESS:
+ u.res.client = va_arg(ap, ClientPtr);
+ u.res.id = va_arg(ap, XID);
+ u.res.rtype = va_arg(ap, RESTYPE);
+ u.res.res = va_arg(ap, pointer);
+ u.res.ptype = va_arg(ap, RESTYPE);
+ u.res.parent = va_arg(ap, pointer);
+ u.res.access_mode = va_arg(ap, Mask);
+
+ u.res.status = Success; /* default allow */
+ prv = &u.res.status;
+ break;
+ case XACE_DEVICE_ACCESS:
+ u.dev.client = va_arg(ap, ClientPtr);
+ u.dev.dev = va_arg(ap, DeviceIntPtr);
+ u.dev.access_mode = va_arg(ap, Mask);
+
+ u.dev.status = Success; /* default allow */
+ prv = &u.dev.status;
+ break;
+ case XACE_SEND_ACCESS:
+ u.send.client = va_arg(ap, ClientPtr);
+ u.send.dev = va_arg(ap, DeviceIntPtr);
+ u.send.pWin = va_arg(ap, WindowPtr);
+
+ u.send.events = va_arg(ap, xEventPtr);
+ u.send.count = va_arg(ap, int);
+
+ u.send.status = Success; /* default allow */
+ prv = &u.send.status;
+ break;
+ case XACE_RECEIVE_ACCESS:
+ u.recv.client = va_arg(ap, ClientPtr);
+ u.recv.pWin = va_arg(ap, WindowPtr);
+
+ u.recv.events = va_arg(ap, xEventPtr);
+ u.recv.count = va_arg(ap, int);
+
+ u.recv.status = Success; /* default allow */
+ prv = &u.recv.status;
+ break;
+ case XACE_CLIENT_ACCESS:
+ u.client.client = va_arg(ap, ClientPtr);
+ u.client.target = va_arg(ap, ClientPtr);
+ u.client.access_mode = va_arg(ap, Mask);
+
+ u.client.status = Success; /* default allow */
+ prv = &u.client.status;
+ break;
+ case XACE_EXT_ACCESS:
+ u.ext.client = va_arg(ap, ClientPtr);
+
+ u.ext.ext = va_arg(ap, ExtensionEntry *);
+ u.ext.access_mode = DixGetAttrAccess;
+ u.ext.status = Success; /* default allow */
+ prv = &u.ext.status;
+ break;
+ case XACE_SERVER_ACCESS:
+ u.server.client = va_arg(ap, ClientPtr);
+ u.server.access_mode = va_arg(ap, Mask);
+
+ u.server.status = Success; /* default allow */
+ prv = &u.server.status;
+ break;
+ case XACE_SCREEN_ACCESS:
+ case XACE_SCREENSAVER_ACCESS:
+ u.screen.client = va_arg(ap, ClientPtr);
+ u.screen.screen = va_arg(ap, ScreenPtr);
+ u.screen.access_mode = va_arg(ap, Mask);
+
+ u.screen.status = Success; /* default allow */
+ prv = &u.screen.status;
+ break;
+ case XACE_AUTH_AVAIL:
+ u.auth.client = va_arg(ap, ClientPtr);
+ u.auth.authId = va_arg(ap, XID);
+
+ break;
+ case XACE_KEY_AVAIL:
+ u.key.event = va_arg(ap, xEventPtr);
+ u.key.keybd = va_arg(ap, DeviceIntPtr);
+ u.key.count = va_arg(ap, int);
+
+ break;
+ default:
+ va_end(ap);
+ return 0; /* unimplemented hook number */
}
va_end(ap);
-
+
/* call callbacks and return result, if any. */
CallCallbacks(&XaceHooks[hook], &u);
return prv ? *prv : Success;
@@ -220,17 +236,14 @@ int XaceHook(int hook, ...)
* region of the window will be destroyed (overwritten) in pBuf.
*/
void
-XaceCensorImage(
- ClientPtr client,
- RegionPtr pVisibleRegion,
- long widthBytesLine,
- DrawablePtr pDraw,
- int x, int y, int w, int h,
- unsigned int format,
- char *pBuf)
+XaceCensorImage(ClientPtr client,
+ RegionPtr pVisibleRegion,
+ long widthBytesLine,
+ DrawablePtr pDraw,
+ int x, int y, int w, int h, unsigned int format, char *pBuf)
{
- RegionRec imageRegion; /* region representing x,y,w,h */
- RegionRec censorRegion; /* region to obliterate */
+ RegionRec imageRegion; /* region representing x,y,w,h */
+ RegionRec censorRegion; /* region to obliterate */
BoxRec imageBox;
int nRects;
@@ -244,90 +257,87 @@ XaceCensorImage(
/* censorRegion = imageRegion - visibleRegion */
RegionSubtract(&censorRegion, &imageRegion, pVisibleRegion);
nRects = RegionNumRects(&censorRegion);
- if (nRects > 0)
- { /* we have something to censor */
- GCPtr pScratchGC = NULL;
- PixmapPtr pPix = NULL;
- xRectangle *pRects = NULL;
- Bool failed = FALSE;
- int depth = 1;
- int bitsPerPixel = 1;
- int i;
- BoxPtr pBox;
-
- /* convert region to list-of-rectangles for PolyFillRect */
-
- pRects = malloc(nRects * sizeof(xRectangle));
- if (!pRects)
- {
- failed = TRUE;
- goto failSafe;
- }
- for (pBox = RegionRects(&censorRegion), i = 0;
- i < nRects;
- i++, pBox++)
- {
- pRects[i].x = pBox->x1;
- pRects[i].y = pBox->y1 - imageBox.y1;
- pRects[i].width = pBox->x2 - pBox->x1;
- pRects[i].height = pBox->y2 - pBox->y1;
- }
-
- /* use pBuf as a fake pixmap */
-
- if (format == ZPixmap)
- {
- depth = pDraw->depth;
- bitsPerPixel = pDraw->bitsPerPixel;
- }
-
- pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
- depth, bitsPerPixel,
- widthBytesLine, (pointer)pBuf);
- if (!pPix)
- {
- failed = TRUE;
- goto failSafe;
- }
-
- pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
- if (!pScratchGC)
- {
- failed = TRUE;
- goto failSafe;
- }
-
- ValidateGC(&pPix->drawable, pScratchGC);
- (* pScratchGC->ops->PolyFillRect)(&pPix->drawable,
- pScratchGC, nRects, pRects);
-
- failSafe:
- if (failed)
- {
- /* Censoring was not completed above. To be safe, wipe out
- * all the image data so that nothing trusted gets out.
- */
- memset(pBuf, 0, (int)(widthBytesLine * h));
- }
- free(pRects);
- if (pScratchGC) FreeScratchGC(pScratchGC);
- if (pPix) FreeScratchPixmapHeader(pPix);
+ if (nRects > 0) { /* we have something to censor */
+ GCPtr pScratchGC = NULL;
+ PixmapPtr pPix = NULL;
+ xRectangle *pRects = NULL;
+ Bool failed = FALSE;
+ int depth = 1;
+ int bitsPerPixel = 1;
+ int i;
+ BoxPtr pBox;
+
+ /* convert region to list-of-rectangles for PolyFillRect */
+
+ pRects = malloc(nRects * sizeof(xRectangle));
+ if (!pRects) {
+ failed = TRUE;
+ goto failSafe;
+ }
+ for (pBox = RegionRects(&censorRegion), i = 0; i < nRects; i++, pBox++) {
+ pRects[i].x = pBox->x1;
+ pRects[i].y = pBox->y1 - imageBox.y1;
+ pRects[i].width = pBox->x2 - pBox->x1;
+ pRects[i].height = pBox->y2 - pBox->y1;
+ }
+
+ /* use pBuf as a fake pixmap */
+
+ if (format == ZPixmap) {
+ depth = pDraw->depth;
+ bitsPerPixel = pDraw->bitsPerPixel;
+ }
+
+ pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
+ depth, bitsPerPixel,
+ widthBytesLine, (pointer) pBuf);
+ if (!pPix) {
+ failed = TRUE;
+ goto failSafe;
+ }
+
+ pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
+ if (!pScratchGC) {
+ failed = TRUE;
+ goto failSafe;
+ }
+
+ ValidateGC(&pPix->drawable, pScratchGC);
+ (*pScratchGC->ops->PolyFillRect) (&pPix->drawable,
+ pScratchGC, nRects, pRects);
+
+ failSafe:
+ if (failed) {
+ /* Censoring was not completed above. To be safe, wipe out
+ * all the image data so that nothing trusted gets out.
+ */
+ memset(pBuf, 0, (int) (widthBytesLine * h));
+ }
+ free(pRects);
+ if (pScratchGC)
+ FreeScratchGC(pScratchGC);
+ if (pPix)
+ FreeScratchPixmapHeader(pPix);
}
RegionUninit(&imageRegion);
RegionUninit(&censorRegion);
-} /* XaceCensorImage */
+} /* XaceCensorImage */
/*
* Xtrans wrappers for use by modules
*/
-int XaceGetConnectionNumber(ClientPtr client)
+int
+XaceGetConnectionNumber(ClientPtr client)
{
- XtransConnInfo ci = ((OsCommPtr)client->osPrivate)->trans_conn;
+ XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
+
return _XSERVTransGetConnectionNumber(ci);
}
-int XaceIsLocal(ClientPtr client)
+int
+XaceIsLocal(ClientPtr client)
{
- XtransConnInfo ci = ((OsCommPtr)client->osPrivate)->trans_conn;
+ XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
+
return _XSERVTransIsLocal(ci);
}
diff --git a/xorg-server/Xext/xace.h b/xorg-server/Xext/xace.h
index 6029d87d8..5e6cb0437 100644
--- a/xorg-server/Xext/xace.h
+++ b/xorg-server/Xext/xace.h
@@ -61,18 +61,18 @@ extern _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
/* Entry point for hook functions. Called by Xserver.
* Required by libdbe and libextmod
*/
-extern _X_EXPORT int XaceHook(
- int /*hook*/,
- ... /*appropriate args for hook*/
- );
+extern _X_EXPORT int XaceHook(int /*hook */ ,
+ ... /*appropriate args for hook */
+ );
/* Special-cased hook functions
*/
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
- PropertyPtr *ppProp, Mask access_mode);
-extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr,
- Selection **ppSel, Mask access_mode);
+ PropertyPtr *ppProp,
+ Mask access_mode);
+extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
+ Mask access_mode);
extern _X_EXPORT void XaceHookAuditEnd(ClientPtr ptr, int result);
/* Register a callback for a given hook.
@@ -93,17 +93,14 @@ extern _X_EXPORT int XaceIsLocal(ClientPtr ptr);
/* From the original Security extension...
*/
-extern _X_EXPORT void XaceCensorImage(
- ClientPtr client,
- RegionPtr pVisibleRegion,
- long widthBytesLine,
- DrawablePtr pDraw,
- int x, int y, int w, int h,
- unsigned int format,
- char * pBuf
- );
+extern _X_EXPORT void XaceCensorImage(ClientPtr client,
+ RegionPtr pVisibleRegion,
+ long widthBytesLine,
+ DrawablePtr pDraw,
+ int x, int y, int w, int h,
+ unsigned int format, char *pBuf);
-#else /* XACE */
+#else /* XACE */
/* Default window background */
#define XaceBackgroundNoneState(w) None
@@ -126,6 +123,6 @@ extern _X_EXPORT void XaceCensorImage(
#define XaceCensorImage(...) { ; }
#endif
-#endif /* XACE */
+#endif /* XACE */
-#endif /* _XACE_H */
+#endif /* _XACE_H */
diff --git a/xorg-server/Xext/xcmisc.c b/xorg-server/Xext/xcmisc.c
index 745135ed5..99a6ece43 100644
--- a/xorg-server/Xext/xcmisc.c
+++ b/xorg-server/Xext/xcmisc.c
@@ -54,11 +54,11 @@ ProcXCMiscGetVersion(ClientPtr client)
rep.majorVersion = XCMiscMajorVersion;
rep.minorVersion = XCMiscMinorVersion;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *) &rep);
return Success;
}
@@ -76,11 +76,11 @@ ProcXCMiscGetXIDRange(ClientPtr client)
rep.start_id = min_id;
rep.count = max_id - min_id + 1;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.start_id);
- swapl(&rep.count);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.start_id);
+ swapl(&rep.count);
}
- WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *) &rep);
return Success;
}
@@ -95,12 +95,11 @@ ProcXCMiscGetXIDList(ClientPtr client)
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
if (stuff->count > UINT32_MAX / sizeof(XID))
- return BadAlloc;
+ return BadAlloc;
- pids = (XID *)malloc(stuff->count * sizeof(XID));
- if (!pids)
- {
- return BadAlloc;
+ pids = (XID *) malloc(stuff->count * sizeof(XID));
+ if (!pids) {
+ return BadAlloc;
}
count = GetXIDList(client, stuff->count, pids);
rep.type = X_Reply;
@@ -108,34 +107,32 @@ ProcXCMiscGetXIDList(ClientPtr client)
rep.length = count;
rep.count = count;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.count);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.count);
}
- WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep);
- if (count)
- {
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, count * sizeof(XID), pids);
+ WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *) &rep);
+ if (count) {
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, count * sizeof(XID), pids);
}
free(pids);
return Success;
}
static int
-ProcXCMiscDispatch (ClientPtr client)
+ProcXCMiscDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_XCMiscGetVersion:
- return ProcXCMiscGetVersion(client);
+ return ProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
- return ProcXCMiscGetXIDRange(client);
+ return ProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
- return ProcXCMiscGetXIDList(client);
+ return ProcXCMiscGetXIDList(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
@@ -171,19 +168,18 @@ SProcXCMiscGetXIDList(ClientPtr client)
}
static int
-SProcXCMiscDispatch (ClientPtr client)
+SProcXCMiscDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_XCMiscGetVersion:
- return SProcXCMiscGetVersion(client);
+ return SProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
- return SProcXCMiscGetXIDRange(client);
+ return SProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
- return SProcXCMiscGetXIDList(client);
+ return SProcXCMiscGetXIDList(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
@@ -191,6 +187,6 @@ void
XCMiscExtensionInit(INITARGS)
{
AddExtension(XCMiscExtensionName, 0, 0,
- ProcXCMiscDispatch, SProcXCMiscDispatch,
- NULL, StandardMinorOpcode);
+ ProcXCMiscDispatch, SProcXCMiscDispatch,
+ NULL, StandardMinorOpcode);
}
diff --git a/xorg-server/Xext/xf86bigfont.c b/xorg-server/Xext/xf86bigfont.c
index e56370152..d10a36eef 100644
--- a/xorg-server/Xext/xf86bigfont.c
+++ b/xorg-server/Xext/xf86bigfont.c
@@ -50,7 +50,7 @@
#ifdef SVR4
#include <sys/sysmacros.h>
#endif
-#if defined(__CYGWIN__)
+#if defined(__CYGWIN__)
#include <sys/param.h>
#include <sys/sysmacros.h>
#endif
@@ -76,11 +76,9 @@
#include <X11/extensions/xf86bigfproto.h>
#include "xf86bigfontsrv.h"
-static void XF86BigfontResetProc(
- ExtensionEntry * /* extEntry */
+static void XF86BigfontResetProc(ExtensionEntry * /* extEntry */
);
-
#ifdef HAS_SHM
/* A random signature, transmitted to the clients so they can verify that the
@@ -100,8 +98,7 @@ static Bool badSysCall = FALSE;
#include <sys/signal.h>
static void
-SigSysHandler(
- int signo)
+SigSysHandler(int signo)
{
badSysCall = TRUE;
}
@@ -109,7 +106,7 @@ SigSysHandler(
static Bool
CheckForShmSyscall(void)
{
- void (*oldHandler)(int);
+ void (*oldHandler) (int);
int shmid = -1;
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
@@ -117,13 +114,11 @@ CheckForShmSyscall(void)
badSysCall = FALSE;
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
- if (shmid != -1)
- {
+ if (shmid != -1) {
/* Successful allocation - clean up */
- shmctl(shmid, IPC_RMID, NULL);
+ shmctl(shmid, IPC_RMID, NULL);
}
- else
- {
+ else {
/* Allocation failed */
badSysCall = TRUE;
}
@@ -158,8 +153,7 @@ typedef struct _ShmDesc {
static ShmDescPtr ShmList = (ShmDescPtr) NULL;
static ShmDescPtr
-shmalloc(
- unsigned int size)
+shmalloc(unsigned int size)
{
ShmDescPtr pDesc;
int shmid;
@@ -167,7 +161,7 @@ shmalloc(
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
if (pagesize == 0)
- return (ShmDescPtr) NULL;
+ return (ShmDescPtr) NULL;
#endif
/* On some older Linux systems, the number of shared memory segments
@@ -177,27 +171,27 @@ shmalloc(
the glyph metrics on the other hand. If the glyph metrics size is
small, we prefer the traditional way. */
if (size < 3500)
- return (ShmDescPtr) NULL;
+ return (ShmDescPtr) NULL;
pDesc = malloc(sizeof(ShmDescRec));
if (!pDesc)
- return (ShmDescPtr) NULL;
+ return (ShmDescPtr) NULL;
- size = (size + pagesize-1) & -pagesize;
+ size = (size + pagesize - 1) & -pagesize;
shmid = shmget(IPC_PRIVATE, size, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
if (shmid == -1) {
- ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, %s\n",
- size, strerror(errno));
- free(pDesc);
- return (ShmDescPtr) NULL;
+ ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, %s\n",
+ size, strerror(errno));
+ free(pDesc);
+ return (ShmDescPtr) NULL;
}
- if ((addr = shmat(shmid, 0, 0)) == (char *)-1) {
- ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, %s\n",
- size, strerror(errno));
- shmctl(shmid, IPC_RMID, (void *) 0);
- free(pDesc);
- return (ShmDescPtr) NULL;
+ if ((addr = shmat(shmid, 0, 0)) == (char *) -1) {
+ ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, %s\n",
+ size, strerror(errno));
+ shmctl(shmid, IPC_RMID, (void *) 0);
+ free(pDesc);
+ return (ShmDescPtr) NULL;
}
#ifdef EARLY_REMOVE
@@ -206,7 +200,8 @@ shmalloc(
pDesc->shmid = shmid;
pDesc->attach_addr = addr;
- if (ShmList) ShmList->prev = &pDesc->next;
+ if (ShmList)
+ ShmList->prev = &pDesc->next;
pDesc->next = ShmList;
pDesc->prev = &ShmList;
ShmList = pDesc;
@@ -215,15 +210,15 @@ shmalloc(
}
static void
-shmdealloc(
- ShmDescPtr pDesc)
+shmdealloc(ShmDescPtr pDesc)
{
#ifndef EARLY_REMOVE
shmctl(pDesc->shmid, IPC_RMID, (void *) 0);
#endif
shmdt(pDesc->attach_addr);
- if (pDesc->next) pDesc->next->prev = pDesc->prev;
+ if (pDesc->next)
+ pDesc->next->prev = pDesc->prev;
*pDesc->prev = pDesc->next;
free(pDesc);
}
@@ -232,8 +227,7 @@ shmdealloc(
/* Called when a font is closed. */
void
-XF86BigfontFreeFontShm(
- FontPtr pFont)
+XF86BigfontFreeFontShm(FontPtr pFont)
{
#ifdef HAS_SHM
ShmDescPtr pDesc;
@@ -242,11 +236,11 @@ XF86BigfontFreeFontShm(
* called shmdealloc() for all segments, we don't need to do it here.
*/
if (!ShmList)
- return;
+ return;
pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
if (pDesc)
- shmdealloc(pDesc);
+ shmdealloc(pDesc);
#endif
}
@@ -256,14 +250,13 @@ XF86BigfontCleanup(void)
{
#ifdef HAS_SHM
while (ShmList)
- shmdealloc(ShmList);
+ shmdealloc(ShmList);
#endif
}
/* Called when a server generation dies. */
static void
-XF86BigfontResetProc(
- ExtensionEntry* extEntry)
+XF86BigfontResetProc(ExtensionEntry * extEntry)
{
/* This function is normally called from CloseDownExtensions(), called
* from main(). It will be followed by a call to FreeAllResources(),
@@ -276,12 +269,10 @@ XF86BigfontResetProc(
XF86BigfontCleanup();
}
-
/* ========== Handling of extension specific requests ========== */
static int
-ProcXF86BigfontQueryVersion(
- ClientPtr client)
+ProcXF86BigfontQueryVersion(ClientPtr client)
{
xXF86BigfontQueryVersionReply reply;
@@ -301,33 +292,33 @@ ProcXF86BigfontQueryVersion(
#ifdef HAS_SHM
reply.signature = signature;
#else
- reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */
+ reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */
#endif
reply.capabilities =
#ifdef HAS_SHM
- (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
+ (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
#else
- 0
+ 0
#endif
- ; /* may add more bits here in future versions */
+ ; /* may add more bits here in future versions */
if (client->swapped) {
- char tmp;
- swaps(&reply.sequenceNumber);
- swapl(&reply.length);
- swaps(&reply.majorVersion);
- swaps(&reply.minorVersion);
- swapl(&reply.uid);
- swapl(&reply.gid);
- swapl(&reply.signature);
+ char tmp;
+
+ swaps(&reply.sequenceNumber);
+ swapl(&reply.length);
+ swaps(&reply.majorVersion);
+ swaps(&reply.minorVersion);
+ swapl(&reply.uid);
+ swapl(&reply.gid);
+ swapl(&reply.signature);
}
WriteToClient(client,
- sizeof(xXF86BigfontQueryVersionReply), (char *)&reply);
+ sizeof(xXF86BigfontQueryVersionReply), (char *) &reply);
return Success;
}
static void
-swapCharInfo(
- xCharInfo *pCI)
+swapCharInfo(xCharInfo * pCI)
{
char tmp;
@@ -347,52 +338,55 @@ swapCharInfo(
(p->ascent << 11) + (p->descent << 6)) ^ p->attributes)
static int
-ProcXF86BigfontQueryFont(
- ClientPtr client)
+ProcXF86BigfontQueryFont(ClientPtr client)
{
FontPtr pFont;
+
REQUEST(xXF86BigfontQueryFontReq);
CARD32 stuff_flags;
- xCharInfo* pmax;
- xCharInfo* pmin;
+ xCharInfo *pmax;
+ xCharInfo *pmin;
int nCharInfos;
int shmid;
+
#ifdef HAS_SHM
ShmDescPtr pDesc = NULL;
#else
#define pDesc 0
#endif
- xCharInfo* pCI;
- CARD16* pIndex2UniqIndex;
- CARD16* pUniqIndex2Index;
+ xCharInfo *pCI;
+ CARD16 *pIndex2UniqIndex;
+ CARD16 *pUniqIndex2Index;
CARD32 nUniqCharInfos;
#if 0
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
#else
switch (client->req_len) {
- case 2: /* client with version 1.0 libX11 */
- stuff_flags = (LocalClient(client) && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
- break;
- case 3: /* client with version 1.1 libX11 */
- stuff_flags = stuff->flags;
- break;
- default:
- return BadLength;
+ case 2: /* client with version 1.0 libX11 */
+ stuff_flags = (LocalClient(client) &&
+ !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
+ break;
+ case 3: /* client with version 1.1 libX11 */
+ stuff_flags = stuff->flags;
+ break;
+ default:
+ return BadLength;
}
#endif
- if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) != Success)
- return BadFont; /* procotol spec says only error is BadFont */
+ if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) !=
+ Success)
+ return BadFont; /* procotol spec says only error is BadFont */
pmax = FONTINKMAX(pFont);
pmin = FONTINKMIN(pFont);
nCharInfos =
- (pmax->rightSideBearing == pmin->rightSideBearing
- && pmax->leftSideBearing == pmin->leftSideBearing
- && pmax->descent == pmin->descent
- && pmax->ascent == pmin->ascent
- && pmax->characterWidth == pmin->characterWidth)
- ? 0 : N2dChars(pFont);
+ (pmax->rightSideBearing == pmin->rightSideBearing
+ && pmax->leftSideBearing == pmin->leftSideBearing
+ && pmax->descent == pmin->descent
+ && pmax->ascent == pmin->ascent
+ && pmax->characterWidth == pmin->characterWidth)
+ ? 0 : N2dChars(pFont);
shmid = -1;
pCI = NULL;
pIndex2UniqIndex = NULL;
@@ -401,278 +395,289 @@ ProcXF86BigfontQueryFont(
if (nCharInfos > 0) {
#ifdef HAS_SHM
- if (!badSysCall)
- pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
- if (pDesc) {
- pCI = (xCharInfo *) pDesc->attach_addr;
- if (stuff_flags & XF86Bigfont_FLAGS_Shm)
- shmid = pDesc->shmid;
- } else {
- if (stuff_flags & XF86Bigfont_FLAGS_Shm && !badSysCall)
- pDesc = shmalloc(nCharInfos * sizeof(xCharInfo)
- + sizeof(CARD32));
- if (pDesc) {
- pCI = (xCharInfo *) pDesc->attach_addr;
- shmid = pDesc->shmid;
- } else {
+ if (!badSysCall)
+ pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
+ if (pDesc) {
+ pCI = (xCharInfo *) pDesc->attach_addr;
+ if (stuff_flags & XF86Bigfont_FLAGS_Shm)
+ shmid = pDesc->shmid;
+ }
+ else {
+ if (stuff_flags & XF86Bigfont_FLAGS_Shm && !badSysCall)
+ pDesc = shmalloc(nCharInfos * sizeof(xCharInfo)
+ + sizeof(CARD32));
+ if (pDesc) {
+ pCI = (xCharInfo *) pDesc->attach_addr;
+ shmid = pDesc->shmid;
+ }
+ else {
#endif
- pCI = malloc(nCharInfos * sizeof(xCharInfo));
- if (!pCI)
- return BadAlloc;
+ pCI = malloc(nCharInfos * sizeof(xCharInfo));
+ if (!pCI)
+ return BadAlloc;
#ifdef HAS_SHM
- }
+ }
#endif
- /* Fill nCharInfos starting at pCI. */
- {
- xCharInfo* prCI = pCI;
- int ninfos = 0;
- int ncols = pFont->info.lastCol - pFont->info.firstCol + 1;
- int row;
- for (row = pFont->info.firstRow;
- row <= pFont->info.lastRow && ninfos < nCharInfos;
- row++) {
- unsigned char chars[512];
- xCharInfo* tmpCharInfos[256];
- unsigned long count;
- int col;
- unsigned long i;
- i = 0;
- for (col = pFont->info.firstCol;
- col <= pFont->info.lastCol;
- col++) {
- chars[i++] = row;
- chars[i++] = col;
- }
- (*pFont->get_metrics) (pFont, ncols, chars, TwoD16Bit,
- &count, tmpCharInfos);
- for (i = 0; i < count && ninfos < nCharInfos; i++) {
- *prCI++ = *tmpCharInfos[i];
- ninfos++;
- }
- }
- }
+ /* Fill nCharInfos starting at pCI. */
+ {
+ xCharInfo *prCI = pCI;
+ int ninfos = 0;
+ int ncols = pFont->info.lastCol - pFont->info.firstCol + 1;
+ int row;
+
+ for (row = pFont->info.firstRow;
+ row <= pFont->info.lastRow && ninfos < nCharInfos; row++) {
+ unsigned char chars[512];
+ xCharInfo *tmpCharInfos[256];
+ unsigned long count;
+ int col;
+ unsigned long i;
+
+ i = 0;
+ for (col = pFont->info.firstCol;
+ col <= pFont->info.lastCol; col++) {
+ chars[i++] = row;
+ chars[i++] = col;
+ }
+ (*pFont->get_metrics) (pFont, ncols, chars, TwoD16Bit,
+ &count, tmpCharInfos);
+ for (i = 0; i < count && ninfos < nCharInfos; i++) {
+ *prCI++ = *tmpCharInfos[i];
+ ninfos++;
+ }
+ }
+ }
#ifdef HAS_SHM
- if (pDesc && !badSysCall) {
- *(CARD32 *)(pCI + nCharInfos) = signature;
- if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
- shmdealloc(pDesc);
- return BadAlloc;
- }
- }
- }
+ if (pDesc && !badSysCall) {
+ *(CARD32 *) (pCI + nCharInfos) = signature;
+ if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
+ shmdealloc(pDesc);
+ return BadAlloc;
+ }
+ }
+ }
#endif
- if (shmid == -1) {
- /* Cannot use shared memory, so remove-duplicates the xCharInfos
- using a temporary hash table. */
- /* Note that CARD16 is suitable as index type, because
- nCharInfos <= 0x10000. */
- CARD32 hashModulus;
- CARD16* pHash2UniqIndex;
- CARD16* pUniqIndex2NextUniqIndex;
- CARD32 NextIndex;
- CARD32 NextUniqIndex;
- CARD16* tmp;
- CARD32 i, j;
-
- hashModulus = 67;
- if (hashModulus > nCharInfos+1)
- hashModulus = nCharInfos+1;
-
- tmp = malloc((4*nCharInfos+1) * sizeof(CARD16));
- if (!tmp) {
- if (!pDesc) free(pCI);
- return BadAlloc;
- }
- pIndex2UniqIndex = tmp;
- /* nCharInfos elements */
- pUniqIndex2Index = tmp + nCharInfos;
- /* max. nCharInfos elements */
- pUniqIndex2NextUniqIndex = tmp + 2*nCharInfos;
- /* max. nCharInfos elements */
- pHash2UniqIndex = tmp + 3*nCharInfos;
- /* hashModulus (<= nCharInfos+1) elements */
-
- /* Note that we can use 0xffff as end-of-list indicator, because
- even if nCharInfos = 0x10000, 0xffff can not occur as valid
- entry before the last element has been inserted. And once the
- last element has been inserted, we don't need the hash table
- any more. */
- for (j = 0; j < hashModulus; j++)
- pHash2UniqIndex[j] = (CARD16)(-1);
-
- NextUniqIndex = 0;
- for (NextIndex = 0; NextIndex < nCharInfos; NextIndex++) {
- xCharInfo* p = &pCI[NextIndex];
- CARD32 hashCode = hashCI(p) % hashModulus;
- for (i = pHash2UniqIndex[hashCode];
- i != (CARD16)(-1);
- i = pUniqIndex2NextUniqIndex[i]) {
- j = pUniqIndex2Index[i];
- if (pCI[j].leftSideBearing == p->leftSideBearing
- && pCI[j].rightSideBearing == p->rightSideBearing
- && pCI[j].characterWidth == p->characterWidth
- && pCI[j].ascent == p->ascent
- && pCI[j].descent == p->descent
- && pCI[j].attributes == p->attributes)
- break;
- }
- if (i != (CARD16)(-1)) {
- /* Found *p at Index j, UniqIndex i */
- pIndex2UniqIndex[NextIndex] = i;
- } else {
- /* Allocate a new entry in the Uniq table */
- if (hashModulus <= 2*NextUniqIndex
- && hashModulus < nCharInfos+1) {
- /* Time to increate hash table size */
- hashModulus = 2*hashModulus+1;
- if (hashModulus > nCharInfos+1)
- hashModulus = nCharInfos+1;
- for (j = 0; j < hashModulus; j++)
- pHash2UniqIndex[j] = (CARD16)(-1);
- for (i = 0; i < NextUniqIndex; i++)
- pUniqIndex2NextUniqIndex[i] = (CARD16)(-1);
- for (i = 0; i < NextUniqIndex; i++) {
- j = pUniqIndex2Index[i];
- p = &pCI[j];
- hashCode = hashCI(p) % hashModulus;
- pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode];
- pHash2UniqIndex[hashCode] = i;
- }
- p = &pCI[NextIndex];
- hashCode = hashCI(p) % hashModulus;
- }
- i = NextUniqIndex++;
- pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode];
- pHash2UniqIndex[hashCode] = i;
- pUniqIndex2Index[i] = NextIndex;
- pIndex2UniqIndex[NextIndex] = i;
- }
- }
- nUniqCharInfos = NextUniqIndex;
- /* fprintf(stderr, "font metrics: nCharInfos = %d, nUniqCharInfos = %d, hashModulus = %d\n", nCharInfos, nUniqCharInfos, hashModulus); */
- }
+ if (shmid == -1) {
+ /* Cannot use shared memory, so remove-duplicates the xCharInfos
+ using a temporary hash table. */
+ /* Note that CARD16 is suitable as index type, because
+ nCharInfos <= 0x10000. */
+ CARD32 hashModulus;
+ CARD16 *pHash2UniqIndex;
+ CARD16 *pUniqIndex2NextUniqIndex;
+ CARD32 NextIndex;
+ CARD32 NextUniqIndex;
+ CARD16 *tmp;
+ CARD32 i, j;
+
+ hashModulus = 67;
+ if (hashModulus > nCharInfos + 1)
+ hashModulus = nCharInfos + 1;
+
+ tmp = malloc((4 * nCharInfos + 1) * sizeof(CARD16));
+ if (!tmp) {
+ if (!pDesc)
+ free(pCI);
+ return BadAlloc;
+ }
+ pIndex2UniqIndex = tmp;
+ /* nCharInfos elements */
+ pUniqIndex2Index = tmp + nCharInfos;
+ /* max. nCharInfos elements */
+ pUniqIndex2NextUniqIndex = tmp + 2 * nCharInfos;
+ /* max. nCharInfos elements */
+ pHash2UniqIndex = tmp + 3 * nCharInfos;
+ /* hashModulus (<= nCharInfos+1) elements */
+
+ /* Note that we can use 0xffff as end-of-list indicator, because
+ even if nCharInfos = 0x10000, 0xffff can not occur as valid
+ entry before the last element has been inserted. And once the
+ last element has been inserted, we don't need the hash table
+ any more. */
+ for (j = 0; j < hashModulus; j++)
+ pHash2UniqIndex[j] = (CARD16) (-1);
+
+ NextUniqIndex = 0;
+ for (NextIndex = 0; NextIndex < nCharInfos; NextIndex++) {
+ xCharInfo *p = &pCI[NextIndex];
+ CARD32 hashCode = hashCI(p) % hashModulus;
+
+ for (i = pHash2UniqIndex[hashCode];
+ i != (CARD16) (-1); i = pUniqIndex2NextUniqIndex[i]) {
+ j = pUniqIndex2Index[i];
+ if (pCI[j].leftSideBearing == p->leftSideBearing
+ && pCI[j].rightSideBearing == p->rightSideBearing
+ && pCI[j].characterWidth == p->characterWidth
+ && pCI[j].ascent == p->ascent
+ && pCI[j].descent == p->descent
+ && pCI[j].attributes == p->attributes)
+ break;
+ }
+ if (i != (CARD16) (-1)) {
+ /* Found *p at Index j, UniqIndex i */
+ pIndex2UniqIndex[NextIndex] = i;
+ }
+ else {
+ /* Allocate a new entry in the Uniq table */
+ if (hashModulus <= 2 * NextUniqIndex
+ && hashModulus < nCharInfos + 1) {
+ /* Time to increate hash table size */
+ hashModulus = 2 * hashModulus + 1;
+ if (hashModulus > nCharInfos + 1)
+ hashModulus = nCharInfos + 1;
+ for (j = 0; j < hashModulus; j++)
+ pHash2UniqIndex[j] = (CARD16) (-1);
+ for (i = 0; i < NextUniqIndex; i++)
+ pUniqIndex2NextUniqIndex[i] = (CARD16) (-1);
+ for (i = 0; i < NextUniqIndex; i++) {
+ j = pUniqIndex2Index[i];
+ p = &pCI[j];
+ hashCode = hashCI(p) % hashModulus;
+ pUniqIndex2NextUniqIndex[i] =
+ pHash2UniqIndex[hashCode];
+ pHash2UniqIndex[hashCode] = i;
+ }
+ p = &pCI[NextIndex];
+ hashCode = hashCI(p) % hashModulus;
+ }
+ i = NextUniqIndex++;
+ pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode];
+ pHash2UniqIndex[hashCode] = i;
+ pUniqIndex2Index[i] = NextIndex;
+ pIndex2UniqIndex[NextIndex] = i;
+ }
+ }
+ nUniqCharInfos = NextUniqIndex;
+ /* fprintf(stderr, "font metrics: nCharInfos = %d, nUniqCharInfos = %d, hashModulus = %d\n", nCharInfos, nUniqCharInfos, hashModulus); */
+ }
}
{
- int nfontprops = pFont->info.nprops;
- int rlength =
- sizeof(xXF86BigfontQueryFontReply)
- + nfontprops * sizeof(xFontProp)
- + (nCharInfos > 0 && shmid == -1
- ? nUniqCharInfos * sizeof(xCharInfo)
- + (nCharInfos+1)/2 * 2 * sizeof(CARD16)
- : 0);
- xXF86BigfontQueryFontReply* reply = malloc(rlength);
- char* p;
- if (!reply) {
- if (nCharInfos > 0) {
- if (shmid == -1) free(pIndex2UniqIndex);
- if (!pDesc) free(pCI);
- }
- return BadAlloc;
- }
- reply->type = X_Reply;
- reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
- reply->sequenceNumber = client->sequence;
- reply->minBounds = pFont->info.ink_minbounds;
- reply->maxBounds = pFont->info.ink_maxbounds;
- reply->minCharOrByte2 = pFont->info.firstCol;
- reply->maxCharOrByte2 = pFont->info.lastCol;
- reply->defaultChar = pFont->info.defaultCh;
- reply->nFontProps = pFont->info.nprops;
- reply->drawDirection = pFont->info.drawDirection;
- reply->minByte1 = pFont->info.firstRow;
- reply->maxByte1 = pFont->info.lastRow;
- reply->allCharsExist = pFont->info.allExist;
- reply->fontAscent = pFont->info.fontAscent;
- reply->fontDescent = pFont->info.fontDescent;
- reply->nCharInfos = nCharInfos;
+ int nfontprops = pFont->info.nprops;
+ int rlength = sizeof(xXF86BigfontQueryFontReply)
+ + nfontprops * sizeof(xFontProp)
+ + (nCharInfos > 0 && shmid == -1
+ ? nUniqCharInfos * sizeof(xCharInfo)
+ + (nCharInfos + 1) / 2 * 2 * sizeof(CARD16)
+ : 0);
+ xXF86BigfontQueryFontReply *reply = malloc(rlength);
+ char *p;
+
+ if (!reply) {
+ if (nCharInfos > 0) {
+ if (shmid == -1)
+ free(pIndex2UniqIndex);
+ if (!pDesc)
+ free(pCI);
+ }
+ return BadAlloc;
+ }
+ reply->type = X_Reply;
+ reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
+ reply->sequenceNumber = client->sequence;
+ reply->minBounds = pFont->info.ink_minbounds;
+ reply->maxBounds = pFont->info.ink_maxbounds;
+ reply->minCharOrByte2 = pFont->info.firstCol;
+ reply->maxCharOrByte2 = pFont->info.lastCol;
+ reply->defaultChar = pFont->info.defaultCh;
+ reply->nFontProps = pFont->info.nprops;
+ reply->drawDirection = pFont->info.drawDirection;
+ reply->minByte1 = pFont->info.firstRow;
+ reply->maxByte1 = pFont->info.lastRow;
+ reply->allCharsExist = pFont->info.allExist;
+ reply->fontAscent = pFont->info.fontAscent;
+ reply->fontDescent = pFont->info.fontDescent;
+ reply->nCharInfos = nCharInfos;
reply->nUniqCharInfos = nUniqCharInfos;
- reply->shmid = shmid;
- reply->shmsegoffset = 0;
- if (client->swapped) {
- char tmp;
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swapCharInfo(&reply->minBounds);
- swapCharInfo(&reply->maxBounds);
- swaps(&reply->minCharOrByte2);
- swaps(&reply->maxCharOrByte2);
- swaps(&reply->defaultChar);
- swaps(&reply->nFontProps);
- swaps(&reply->fontAscent);
- swaps(&reply->fontDescent);
- swapl(&reply->nCharInfos);
- swapl(&reply->nUniqCharInfos);
- swapl(&reply->shmid);
- swapl(&reply->shmsegoffset);
- }
- p = (char*) &reply[1];
- {
- FontPropPtr pFP;
- xFontProp* prFP;
- int i;
- for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) p;
- i < nfontprops;
- i++, pFP++, prFP++) {
- prFP->name = pFP->name;
- prFP->value = pFP->value;
- if (client->swapped) {
- char tmp;
- swapl(&prFP->name);
- swapl(&prFP->value);
- }
- }
- p = (char*) prFP;
- }
- if (nCharInfos > 0 && shmid == -1) {
- xCharInfo* pci;
- CARD16* ps;
- int i, j;
- pci = (xCharInfo*) p;
- for (i = 0; i < nUniqCharInfos; i++, pci++) {
- *pci = pCI[pUniqIndex2Index[i]];
- if (client->swapped)
- swapCharInfo(pci);
- }
- ps = (CARD16*) pci;
- for (j = 0; j < nCharInfos; j++, ps++) {
- *ps = pIndex2UniqIndex[j];
- if (client->swapped) {
- char tmp;
- swaps(ps);
- }
- }
- }
- WriteToClient(client, rlength, (char *)reply);
- free(reply);
- if (nCharInfos > 0) {
- if (shmid == -1) free(pIndex2UniqIndex);
- if (!pDesc) free(pCI);
- }
- return Success;
+ reply->shmid = shmid;
+ reply->shmsegoffset = 0;
+ if (client->swapped) {
+ char tmp;
+
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
+ swapCharInfo(&reply->minBounds);
+ swapCharInfo(&reply->maxBounds);
+ swaps(&reply->minCharOrByte2);
+ swaps(&reply->maxCharOrByte2);
+ swaps(&reply->defaultChar);
+ swaps(&reply->nFontProps);
+ swaps(&reply->fontAscent);
+ swaps(&reply->fontDescent);
+ swapl(&reply->nCharInfos);
+ swapl(&reply->nUniqCharInfos);
+ swapl(&reply->shmid);
+ swapl(&reply->shmsegoffset);
+ }
+ p = (char *) &reply[1];
+ {
+ FontPropPtr pFP;
+ xFontProp *prFP;
+ int i;
+
+ for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) p;
+ i < nfontprops; i++, pFP++, prFP++) {
+ prFP->name = pFP->name;
+ prFP->value = pFP->value;
+ if (client->swapped) {
+ char tmp;
+
+ swapl(&prFP->name);
+ swapl(&prFP->value);
+ }
+ }
+ p = (char *) prFP;
+ }
+ if (nCharInfos > 0 && shmid == -1) {
+ xCharInfo *pci;
+ CARD16 *ps;
+ int i, j;
+
+ pci = (xCharInfo *) p;
+ for (i = 0; i < nUniqCharInfos; i++, pci++) {
+ *pci = pCI[pUniqIndex2Index[i]];
+ if (client->swapped)
+ swapCharInfo(pci);
+ }
+ ps = (CARD16 *) pci;
+ for (j = 0; j < nCharInfos; j++, ps++) {
+ *ps = pIndex2UniqIndex[j];
+ if (client->swapped) {
+ char tmp;
+
+ swaps(ps);
+ }
+ }
+ }
+ WriteToClient(client, rlength, (char *) reply);
+ free(reply);
+ if (nCharInfos > 0) {
+ if (shmid == -1)
+ free(pIndex2UniqIndex);
+ if (!pDesc)
+ free(pCI);
+ }
+ return Success;
}
}
static int
-ProcXF86BigfontDispatch(
- ClientPtr client)
+ProcXF86BigfontDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
- case X_XF86BigfontQueryVersion:
- return ProcXF86BigfontQueryVersion(client);
- case X_XF86BigfontQueryFont:
- return ProcXF86BigfontQueryFont(client);
- default:
- return BadRequest;
+ case X_XF86BigfontQueryVersion:
+ return ProcXF86BigfontQueryVersion(client);
+ case X_XF86BigfontQueryFont:
+ return ProcXF86BigfontQueryFont(client);
+ default:
+ return BadRequest;
}
}
static int
-SProcXF86BigfontQueryVersion(
- ClientPtr client)
+SProcXF86BigfontQueryVersion(ClientPtr client)
{
REQUEST(xXF86BigfontQueryVersionReq);
char tmp;
@@ -682,8 +687,7 @@ SProcXF86BigfontQueryVersion(
}
static int
-SProcXF86BigfontQueryFont(
- ClientPtr client)
+SProcXF86BigfontQueryFont(ClientPtr client)
{
REQUEST(xXF86BigfontQueryFontReq);
char tmp;
@@ -695,18 +699,17 @@ SProcXF86BigfontQueryFont(
}
static int
-SProcXF86BigfontDispatch(
- ClientPtr client)
+SProcXF86BigfontDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
- case X_XF86BigfontQueryVersion:
- return SProcXF86BigfontQueryVersion(client);
- case X_XF86BigfontQueryFont:
- return SProcXF86BigfontQueryFont(client);
- default:
- return BadRequest;
+ case X_XF86BigfontQueryVersion:
+ return SProcXF86BigfontQueryVersion(client);
+ case X_XF86BigfontQueryFont:
+ return SProcXF86BigfontQueryFont(client);
+ default:
+ return BadRequest;
}
}
@@ -714,41 +717,41 @@ void
XFree86BigfontExtensionInit(void)
{
if (AddExtension(XF86BIGFONTNAME,
- XF86BigfontNumberEvents,
- XF86BigfontNumberErrors,
- ProcXF86BigfontDispatch,
- SProcXF86BigfontDispatch,
- XF86BigfontResetProc,
- StandardMinorOpcode)) {
+ XF86BigfontNumberEvents,
+ XF86BigfontNumberErrors,
+ ProcXF86BigfontDispatch,
+ SProcXF86BigfontDispatch,
+ XF86BigfontResetProc, StandardMinorOpcode)) {
#ifdef HAS_SHM
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
- /*
- * Note: Local-clients will not be optimized without shared memory
- * support. Remote-client optimization does not depend on shared
- * memory support. Thus, the extension is still registered even
- * when shared memory support is not functional.
- */
- if (!CheckForShmSyscall()) {
- ErrorF(XF86BIGFONTNAME " extension local-client optimization disabled due to lack of shared memory support in the kernel\n");
- return;
- }
+ /*
+ * Note: Local-clients will not be optimized without shared memory
+ * support. Remote-client optimization does not depend on shared
+ * memory support. Thus, the extension is still registered even
+ * when shared memory support is not functional.
+ */
+ if (!CheckForShmSyscall()) {
+ ErrorF(XF86BIGFONTNAME
+ " extension local-client optimization disabled due to lack of shared memory support in the kernel\n");
+ return;
+ }
#endif
- srand((unsigned int) time(NULL));
- signature = ((unsigned int) (65536.0/(RAND_MAX+1.0) * rand()) << 16)
- + (unsigned int) (65536.0/(RAND_MAX+1.0) * rand());
- /* fprintf(stderr, "signature = 0x%08X\n", signature); */
+ srand((unsigned int) time(NULL));
+ signature = ((unsigned int) (65536.0 / (RAND_MAX + 1.0) * rand()) << 16)
+ + (unsigned int) (65536.0 / (RAND_MAX + 1.0) * rand());
+ /* fprintf(stderr, "signature = 0x%08X\n", signature); */
- FontShmdescIndex = AllocateFontPrivateIndex();
+ FontShmdescIndex = AllocateFontPrivateIndex();
#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
- pagesize = SHMLBA;
+ pagesize = SHMLBA;
#else
-# ifdef _SC_PAGESIZE
- pagesize = sysconf(_SC_PAGESIZE);
-# else
- pagesize = getpagesize();
-# endif
+#ifdef _SC_PAGESIZE
+ pagesize = sysconf(_SC_PAGESIZE);
+#else
+ pagesize = getpagesize();
+#endif
#endif
#endif
}
diff --git a/xorg-server/Xext/xres.c b/xorg-server/Xext/xres.c
index 232fbab5b..9d89b6550 100644
--- a/xorg-server/Xext/xres.c
+++ b/xorg-server/Xext/xres.c
@@ -24,30 +24,30 @@
#include "protocol-versions.h"
static int
-ProcXResQueryVersion (ClientPtr client)
+ProcXResQueryVersion(ClientPtr client)
{
REQUEST(xXResQueryVersionReq);
xXResQueryVersionReply rep;
- REQUEST_SIZE_MATCH (xXResQueryVersionReq);
+ REQUEST_SIZE_MATCH(xXResQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.server_major = SERVER_XRES_MAJOR_VERSION;
rep.server_minor = SERVER_XRES_MINOR_VERSION;
- if (client->swapped) {
+ if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.server_major);
swaps(&rep.server_minor);
}
- WriteToClient(client, sizeof (xXResQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXResQueryVersionReply), (char *) &rep);
return Success;
}
static int
-ProcXResQueryClients (ClientPtr client)
+ProcXResQueryClients(ClientPtr client)
{
/* REQUEST(xXResQueryClientsReq); */
xXResQueryClientsReply rep;
@@ -59,11 +59,11 @@ ProcXResQueryClients (ClientPtr client)
current_clients = malloc(currentMaxClients * sizeof(int));
num_clients = 0;
- for(i = 0; i < currentMaxClients; i++) {
- if(clients[i]) {
- current_clients[num_clients] = i;
- num_clients++;
- }
+ for (i = 0; i < currentMaxClients; i++) {
+ if (clients[i]) {
+ current_clients[num_clients] = i;
+ num_clients++;
+ }
}
rep.type = X_Reply;
@@ -74,21 +74,21 @@ ProcXResQueryClients (ClientPtr client)
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.num_clients);
- }
- WriteToClient (client, sizeof (xXResQueryClientsReply), (char *) &rep);
+ }
+ WriteToClient(client, sizeof(xXResQueryClientsReply), (char *) &rep);
- if(num_clients) {
+ if (num_clients) {
xXResClient scratch;
- for(i = 0; i < num_clients; i++) {
+ for (i = 0; i < num_clients; i++) {
scratch.resource_base = clients[current_clients[i]]->clientAsMask;
scratch.resource_mask = RESOURCE_ID_MASK;
-
- if(client->swapped) {
+
+ if (client->swapped) {
swapl(&scratch.resource_base);
swapl(&scratch.resource_mask);
}
- WriteToClient (client, sz_xXResClient, (char *) &scratch);
+ WriteToClient(client, sz_xXResClient, (char *) &scratch);
}
}
@@ -97,17 +97,16 @@ ProcXResQueryClients (ClientPtr client)
return Success;
}
-
static void
-ResFindAllRes (pointer value, XID id, RESTYPE type, pointer cdata)
+ResFindAllRes(pointer value, XID id, RESTYPE type, pointer cdata)
{
- int *counts = (int *)cdata;
+ int *counts = (int *) cdata;
counts[(type & TypeMask) - 1]++;
}
static int
-ProcXResQueryClientResources (ClientPtr client)
+ProcXResQueryClientResources(ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
xXResQueryClientResourcesReply rep;
@@ -118,7 +117,7 @@ ProcXResQueryClientResources (ClientPtr client)
clientID = CLIENT_ID(stuff->xid);
- if((clientID >= currentMaxClients) || !clients[clientID]) {
+ if ((clientID >= currentMaxClients) || !clients[clientID]) {
client->errorValue = stuff->xid;
return BadValue;
}
@@ -129,8 +128,9 @@ ProcXResQueryClientResources (ClientPtr client)
num_types = 0;
- for(i = 0; i <= lastResourceType; i++) {
- if(counts[i]) num_types++;
+ for (i = 0; i <= lastResourceType; i++) {
+ if (counts[i])
+ num_types++;
}
rep.type = X_Reply;
@@ -141,93 +141,96 @@ ProcXResQueryClientResources (ClientPtr client)
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.num_types);
- }
+ }
- WriteToClient (client,sizeof(xXResQueryClientResourcesReply),(char*)&rep);
+ WriteToClient(client, sizeof(xXResQueryClientResourcesReply),
+ (char *) &rep);
- if(num_types) {
+ if (num_types) {
xXResType scratch;
- const char *name;
+ const char *name;
- for(i = 0; i < lastResourceType; i++) {
- if(!counts[i]) continue;
+ for (i = 0; i < lastResourceType; i++) {
+ if (!counts[i])
+ continue;
- name = LookupResourceName(i + 1);
+ name = LookupResourceName(i + 1);
if (strcmp(name, XREGISTRY_UNKNOWN))
- scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
- else {
+ scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
+ else {
char buf[40];
+
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
- scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE);
+ scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE);
}
scratch.count = counts[i];
- if(client->swapped) {
+ if (client->swapped) {
swapl(&scratch.resource_type);
swapl(&scratch.count);
}
- WriteToClient (client, sz_xXResType, (char *) &scratch);
+ WriteToClient(client, sz_xXResType, (char *) &scratch);
}
}
free(counts);
-
+
return Success;
}
static unsigned long
-ResGetApproxPixmapBytes (PixmapPtr pix)
+ResGetApproxPixmapBytes(PixmapPtr pix)
{
- unsigned long nPixels;
- int bytesPerPixel;
+ unsigned long nPixels;
+ int bytesPerPixel;
- bytesPerPixel = pix->drawable.bitsPerPixel>>3;
- nPixels = pix->drawable.width * pix->drawable.height;
+ bytesPerPixel = pix->drawable.bitsPerPixel >> 3;
+ nPixels = pix->drawable.width * pix->drawable.height;
- /* Divide by refcnt as pixmap could be shared between clients,
- * so total pixmap mem is shared between these.
- */
- return ( nPixels * bytesPerPixel ) / pix->refcnt;
+ /* Divide by refcnt as pixmap could be shared between clients,
+ * so total pixmap mem is shared between these.
+ */
+ return (nPixels * bytesPerPixel) / pix->refcnt;
}
-static void
-ResFindPixmaps (pointer value, XID id, pointer cdata)
+static void
+ResFindPixmaps(pointer value, XID id, pointer cdata)
{
- unsigned long *bytes = (unsigned long *)cdata;
- PixmapPtr pix = (PixmapPtr)value;
+ unsigned long *bytes = (unsigned long *) cdata;
+ PixmapPtr pix = (PixmapPtr) value;
- *bytes += ResGetApproxPixmapBytes(pix);
+ *bytes += ResGetApproxPixmapBytes(pix);
}
static void
-ResFindWindowPixmaps (pointer value, XID id, pointer cdata)
+ResFindWindowPixmaps(pointer value, XID id, pointer cdata)
{
- unsigned long *bytes = (unsigned long *)cdata;
- WindowPtr pWin = (WindowPtr)value;
+ unsigned long *bytes = (unsigned long *) cdata;
+ WindowPtr pWin = (WindowPtr) value;
- if (pWin->backgroundState == BackgroundPixmap)
- *bytes += ResGetApproxPixmapBytes(pWin->background.pixmap);
+ if (pWin->backgroundState == BackgroundPixmap)
+ *bytes += ResGetApproxPixmapBytes(pWin->background.pixmap);
- if (pWin->border.pixmap != NULL && !pWin->borderIsPixel)
- *bytes += ResGetApproxPixmapBytes(pWin->border.pixmap);
+ if (pWin->border.pixmap != NULL && !pWin->borderIsPixel)
+ *bytes += ResGetApproxPixmapBytes(pWin->border.pixmap);
}
static void
-ResFindGCPixmaps (pointer value, XID id, pointer cdata)
+ResFindGCPixmaps(pointer value, XID id, pointer cdata)
{
- unsigned long *bytes = (unsigned long *)cdata;
- GCPtr pGC = (GCPtr)value;
+ unsigned long *bytes = (unsigned long *) cdata;
+ GCPtr pGC = (GCPtr) value;
- if (pGC->stipple != NULL)
- *bytes += ResGetApproxPixmapBytes(pGC->stipple);
+ if (pGC->stipple != NULL)
+ *bytes += ResGetApproxPixmapBytes(pGC->stipple);
- if (pGC->tile.pixmap != NULL && !pGC->tileIsPixel)
- *bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap);
+ if (pGC->tile.pixmap != NULL && !pGC->tileIsPixel)
+ *bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap);
}
static int
-ProcXResQueryClientPixmapBytes (ClientPtr client)
+ProcXResQueryClientPixmapBytes(ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
xXResQueryClientPixmapBytesReply rep;
@@ -238,29 +241,27 @@ ProcXResQueryClientPixmapBytes (ClientPtr client)
clientID = CLIENT_ID(stuff->xid);
- if((clientID >= currentMaxClients) || !clients[clientID]) {
+ if ((clientID >= currentMaxClients) || !clients[clientID]) {
client->errorValue = stuff->xid;
return BadValue;
}
bytes = 0;
- FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps,
- (pointer)(&bytes));
+ FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps,
+ (pointer) (&bytes));
/*
* Make sure win background pixmaps also held to account.
*/
- FindClientResourcesByType(clients[clientID], RT_WINDOW,
- ResFindWindowPixmaps,
- (pointer)(&bytes));
+ FindClientResourcesByType(clients[clientID], RT_WINDOW,
+ ResFindWindowPixmaps, (pointer) (&bytes));
/*
* GC Tile & Stipple pixmaps too.
- */
- FindClientResourcesByType(clients[clientID], RT_GC,
- ResFindGCPixmaps,
- (pointer)(&bytes));
+ */
+ FindClientResourcesByType(clients[clientID], RT_GC,
+ ResFindGCPixmaps, (pointer) (&bytes));
#ifdef COMPOSITE
/* FIXME: include composite pixmaps too */
@@ -281,13 +282,14 @@ ProcXResQueryClientPixmapBytes (ClientPtr client)
swapl(&rep.bytes);
swapl(&rep.bytes_overflow);
}
- WriteToClient (client,sizeof(xXResQueryClientPixmapBytesReply),(char*)&rep);
+ WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply),
+ (char *) &rep);
return Success;
}
static int
-ProcResDispatch (ClientPtr client)
+ProcResDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
@@ -299,40 +301,41 @@ ProcResDispatch (ClientPtr client)
return ProcXResQueryClientResources(client);
case X_XResQueryClientPixmapBytes:
return ProcXResQueryClientPixmapBytes(client);
- default: break;
+ default:
+ break;
}
return BadRequest;
}
static int
-SProcXResQueryVersion (ClientPtr client)
+SProcXResQueryVersion(ClientPtr client)
{
REQUEST(xXResQueryVersionReq);
- REQUEST_SIZE_MATCH (xXResQueryVersionReq);
+ REQUEST_SIZE_MATCH(xXResQueryVersionReq);
return ProcXResQueryVersion(client);
}
static int
-SProcXResQueryClientResources (ClientPtr client)
+SProcXResQueryClientResources(ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
- REQUEST_SIZE_MATCH (xXResQueryClientResourcesReq);
+ REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
swapl(&stuff->xid);
return ProcXResQueryClientResources(client);
}
static int
-SProcXResQueryClientPixmapBytes (ClientPtr client)
+SProcXResQueryClientPixmapBytes(ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
- REQUEST_SIZE_MATCH (xXResQueryClientPixmapBytesReq);
+ REQUEST_SIZE_MATCH(xXResQueryClientPixmapBytesReq);
swapl(&stuff->xid);
return ProcXResQueryClientPixmapBytes(client);
}
static int
-SProcResDispatch (ClientPtr client)
+SProcResDispatch(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
@@ -340,13 +343,14 @@ SProcResDispatch (ClientPtr client)
switch (stuff->data) {
case X_XResQueryVersion:
return SProcXResQueryVersion(client);
- case X_XResQueryClients: /* nothing to swap */
+ case X_XResQueryClients: /* nothing to swap */
return ProcXResQueryClients(client);
case X_XResQueryClientResources:
return SProcXResQueryClientResources(client);
case X_XResQueryClientPixmapBytes:
return SProcXResQueryClientPixmapBytes(client);
- default: break;
+ default:
+ break;
}
return BadRequest;
@@ -356,6 +360,6 @@ void
ResExtensionInit(INITARGS)
{
(void) AddExtension(XRES_NAME, 0, 0,
- ProcResDispatch, SProcResDispatch,
- NULL, StandardMinorOpcode);
+ ProcResDispatch, SProcResDispatch,
+ NULL, StandardMinorOpcode);
}
diff --git a/xorg-server/Xext/xselinux_hooks.c b/xorg-server/Xext/xselinux_hooks.c
index 0d4c9ab11..e9c7e93d7 100644
--- a/xorg-server/Xext/xselinux_hooks.c
+++ b/xorg-server/Xext/xselinux_hooks.c
@@ -45,18 +45,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define _XSELINUX_NEED_FLASK_MAP
#include "xselinuxint.h"
-
/* structure passed to auditing callback */
typedef struct {
- ClientPtr client; /* client */
- DeviceIntPtr dev; /* device */
- char *command; /* client's executable path */
- unsigned id; /* resource id, if any */
- int restype; /* resource type, if any */
- int event; /* event type, if any */
- Atom property; /* property name, if any */
- Atom selection; /* selection name, if any */
- char *extension; /* extension name, if any */
+ ClientPtr client; /* client */
+ DeviceIntPtr dev; /* device */
+ char *command; /* client's executable path */
+ unsigned id; /* resource id, if any */
+ int restype; /* resource type, if any */
+ int event; /* event type, if any */
+ Atom property; /* property name, if any */
+ Atom selection; /* selection name, if any */
+ char *extension; /* extension name, if any */
} SELinuxAuditRec;
/* private state keys */
@@ -78,31 +77,30 @@ static security_id_t unlabeled_sid;
static void SELinuxScreen(CallbackListPtr *, pointer, pointer);
/* "true" pointer value for use as callback data */
-static pointer truep = (pointer)1;
-
+static pointer truep = (pointer) 1;
/*
* Performs an SELinux permission check.
*/
static int
-SELinuxDoCheck(SELinuxSubjectRec *subj, SELinuxObjectRec *obj,
- security_class_t class, Mask mode, SELinuxAuditRec *auditdata)
+SELinuxDoCheck(SELinuxSubjectRec * subj, SELinuxObjectRec * obj,
+ security_class_t class, Mask mode, SELinuxAuditRec * auditdata)
{
/* serverClient requests OK */
if (subj->privileged)
- return Success;
+ return Success;
auditdata->command = subj->command;
errno = 0;
if (avc_has_perm(subj->sid, obj->sid, class, mode, &subj->aeref,
- auditdata) < 0) {
- if (mode == DixUnknownAccess)
- return Success; /* DixUnknownAccess requests OK ... for now */
- if (errno == EACCES)
- return BadAccess;
- ErrorF("SELinux: avc_has_perm: unexpected error %d\n", errno);
- return BadValue;
+ auditdata) < 0) {
+ if (mode == DixUnknownAccess)
+ return Success; /* DixUnknownAccess requests OK ... for now */
+ if (errno == EACCES)
+ return BadAccess;
+ ErrorF("SELinux: avc_has_perm: unexpected error %d\n", errno);
+ return BadValue;
}
return Success;
@@ -124,38 +122,39 @@ SELinuxLabelClient(ClientPtr client)
/* Try to get a context from the socket */
if (fd < 0 || getpeercon_raw(fd, &ctx) < 0) {
- /* Otherwise, fall back to a default context */
- ctx = SELinuxDefaultClientLabel();
+ /* Otherwise, fall back to a default context */
+ ctx = SELinuxDefaultClientLabel();
}
/* For local clients, try and determine the executable name */
if (XaceIsLocal(client)) {
- /* Get cached command name if CLIENTIDS is enabled. */
- const char *cmdname = GetClientCmdName(client);
- Bool cached = (cmdname != NULL);
- /* If CLIENTIDS is disabled, figure out the command name from
- * scratch. */
- if (!cmdname)
- {
- pid_t pid = DetermineClientPid(client);
- if (pid != -1)
- DetermineClientCmd(pid, &cmdname, NULL);
- }
-
- if (!cmdname)
- goto finish;
-
- strncpy(subj->command, cmdname, COMMAND_LEN - 1);
-
- if (!cached)
- free((void *) cmdname); /* const char * */
+ /* Get cached command name if CLIENTIDS is enabled. */
+ const char *cmdname = GetClientCmdName(client);
+ Bool cached = (cmdname != NULL);
+
+ /* If CLIENTIDS is disabled, figure out the command name from
+ * scratch. */
+ if (!cmdname) {
+ pid_t pid = DetermineClientPid(client);
+
+ if (pid != -1)
+ DetermineClientCmd(pid, &cmdname, NULL);
+ }
+
+ if (!cmdname)
+ goto finish;
+
+ strncpy(subj->command, cmdname, COMMAND_LEN - 1);
+
+ if (!cached)
+ free((void *) cmdname); /* const char * */
}
-finish:
+ finish:
/* Get a SID from the context */
if (avc_context_to_sid_raw(ctx, &subj->sid) < 0)
- FatalError("SELinux: client %d: context_to_sid_raw(%s) failed\n",
- client->index, ctx);
+ FatalError("SELinux: client %d: context_to_sid_raw(%s) failed\n",
+ client->index, ctx);
obj->sid = subj->sid;
freecon(ctx);
@@ -181,11 +180,11 @@ SELinuxLabelInitial(void)
/* Use the context of the X server process for the serverClient */
if (getcon_raw(&ctx) < 0)
- FatalError("SELinux: couldn't get context of X server process\n");
+ FatalError("SELinux: couldn't get context of X server process\n");
/* Get a SID from the context */
if (avc_context_to_sid_raw(ctx, &subj->sid) < 0)
- FatalError("SELinux: serverClient: context_to_sid(%s) failed\n", ctx);
+ FatalError("SELinux: serverClient: context_to_sid(%s) failed\n", ctx);
obj->sid = subj->sid;
freecon(ctx);
@@ -195,13 +194,13 @@ SELinuxLabelInitial(void)
srec.status = Success;
for (i = 0; i < screenInfo.numScreens; i++) {
- /* Do the screen object */
- srec.screen = screenInfo.screens[i];
- SELinuxScreen(NULL, NULL, &srec);
+ /* Do the screen object */
+ srec.screen = screenInfo.screens[i];
+ SELinuxScreen(NULL, NULL, &srec);
- /* Do the default colormap */
- dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
- RT_COLORMAP, serverClient, DixCreateAccess);
+ /* Do the default colormap */
+ dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
+ RT_COLORMAP, serverClient, DixCreateAccess);
}
}
@@ -209,50 +208,49 @@ SELinuxLabelInitial(void)
* Labels new resource objects.
*/
static int
-SELinuxLabelResource(XaceResourceAccessRec *rec, SELinuxSubjectRec *subj,
- SELinuxObjectRec *obj, security_class_t class)
+SELinuxLabelResource(XaceResourceAccessRec * rec, SELinuxSubjectRec * subj,
+ SELinuxObjectRec * obj, security_class_t class)
{
int offset;
security_id_t tsid;
/* Check for a create context */
if (rec->rtype & RC_DRAWABLE && subj->win_create_sid) {
- obj->sid = subj->win_create_sid;
- return Success;
+ obj->sid = subj->win_create_sid;
+ return Success;
}
if (rec->parent)
- offset = dixLookupPrivateOffset(rec->ptype);
+ offset = dixLookupPrivateOffset(rec->ptype);
if (rec->parent && offset >= 0) {
- /* Use the SID of the parent object in the labeling operation */
- PrivateRec **privatePtr = DEVPRIV_AT(rec->parent, offset);
- SELinuxObjectRec *pobj = dixLookupPrivate(privatePtr, objectKey);
- tsid = pobj->sid;
- } else {
- /* Use the SID of the subject */
- tsid = subj->sid;
+ /* Use the SID of the parent object in the labeling operation */
+ PrivateRec **privatePtr = DEVPRIV_AT(rec->parent, offset);
+ SELinuxObjectRec *pobj = dixLookupPrivate(privatePtr, objectKey);
+
+ tsid = pobj->sid;
+ }
+ else {
+ /* Use the SID of the subject */
+ tsid = subj->sid;
}
/* Perform a transition to obtain the final SID */
if (avc_compute_create(subj->sid, tsid, class, &obj->sid) < 0) {
- ErrorF("SELinux: a compute_create call failed!\n");
- return BadValue;
+ ErrorF("SELinux: a compute_create call failed!\n");
+ return BadValue;
}
return Success;
}
-
/*
* Libselinux Callbacks
*/
static int
SELinuxAudit(void *auditdata,
- security_class_t class,
- char *msgbuf,
- size_t msgbufsize)
+ security_class_t class, char *msgbuf, size_t msgbufsize)
{
SELinuxAuditRec *audit = auditdata;
ClientPtr client = audit->client;
@@ -261,39 +259,39 @@ SELinuxAudit(void *auditdata,
int major = -1, minor = -1;
if (client) {
- REQUEST(xReq);
- if (stuff) {
- major = client->majorOp;
- minor = client->minorOp;
- }
+ REQUEST(xReq);
+ if (stuff) {
+ major = client->majorOp;
+ minor = client->minorOp;
+ }
}
if (audit->id)
- snprintf(idNum, 16, "%x", audit->id);
+ snprintf(idNum, 16, "%x", audit->id);
propertyName = audit->property ? NameForAtom(audit->property) : NULL;
selectionName = audit->selection ? NameForAtom(audit->selection) : NULL;
return snprintf(msgbuf, msgbufsize,
- "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
- (major >= 0) ? "request=" : "",
- (major >= 0) ? LookupRequestName(major, minor) : "",
- audit->command ? " comm=" : "",
- audit->command ? audit->command : "",
- audit->dev ? " xdevice=\"" : "",
- audit->dev ? audit->dev->name : "",
- audit->dev ? "\"" : "",
- audit->id ? " resid=" : "",
- audit->id ? idNum : "",
- audit->restype ? " restype=" : "",
- audit->restype ? LookupResourceName(audit->restype) : "",
- audit->event ? " event=" : "",
- audit->event ? LookupEventName(audit->event & 127) : "",
- audit->property ? " property=" : "",
- audit->property ? propertyName : "",
- audit->selection ? " selection=" : "",
- audit->selection ? selectionName : "",
- audit->extension ? " extension=" : "",
- audit->extension ? audit->extension : "");
+ "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+ (major >= 0) ? "request=" : "",
+ (major >= 0) ? LookupRequestName(major, minor) : "",
+ audit->command ? " comm=" : "",
+ audit->command ? audit->command : "",
+ audit->dev ? " xdevice=\"" : "",
+ audit->dev ? audit->dev->name : "",
+ audit->dev ? "\"" : "",
+ audit->id ? " resid=" : "",
+ audit->id ? idNum : "",
+ audit->restype ? " restype=" : "",
+ audit->restype ? LookupResourceName(audit->restype) : "",
+ audit->event ? " event=" : "",
+ audit->event ? LookupEventName(audit->event & 127) : "",
+ audit->property ? " property=" : "",
+ audit->property ? propertyName : "",
+ audit->selection ? " selection=" : "",
+ audit->selection ? selectionName : "",
+ audit->extension ? " extension=" : "",
+ audit->extension ? audit->extension : "");
}
static int
@@ -305,14 +303,14 @@ SELinuxLog(int type, const char *fmt, ...)
switch (type) {
case SELINUX_INFO:
- aut = AUDIT_USER_MAC_POLICY_LOAD;
- break;
+ aut = AUDIT_USER_MAC_POLICY_LOAD;
+ break;
case SELINUX_AVC:
- aut = AUDIT_USER_AVC;
- break;
+ aut = AUDIT_USER_AVC;
+ break;
default:
- aut = AUDIT_USER_SELINUX_ERR;
- break;
+ aut = AUDIT_USER_SELINUX_ERR;
+ break;
}
va_start(ap, fmt);
@@ -333,7 +331,7 @@ SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
XaceDeviceAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
- SELinuxAuditRec auditdata = { .client = rec->client, .dev = rec->dev };
+ SELinuxAuditRec auditdata = {.client = rec->client,.dev = rec->dev };
security_class_t cls;
int rc;
@@ -342,24 +340,26 @@ SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
/* If this is a new object that needs labeling, do it now */
if (rec->access_mode & DixCreateAccess) {
- SELinuxSubjectRec *dsubj;
- dsubj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
-
- if (subj->dev_create_sid) {
- /* Label the device with the create context */
- obj->sid = subj->dev_create_sid;
- dsubj->sid = subj->dev_create_sid;
- } else {
- /* Label the device directly with the process SID */
- obj->sid = subj->sid;
- dsubj->sid = subj->sid;
- }
+ SELinuxSubjectRec *dsubj;
+
+ dsubj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
+
+ if (subj->dev_create_sid) {
+ /* Label the device with the create context */
+ obj->sid = subj->dev_create_sid;
+ dsubj->sid = subj->dev_create_sid;
+ }
+ else {
+ /* Label the device directly with the process SID */
+ obj->sid = subj->sid;
+ dsubj->sid = subj->sid;
+ }
}
cls = IsPointerDevice(rec->dev) ? SECCLASS_X_POINTER : SECCLASS_X_KEYBOARD;
rc = SELinuxDoCheck(subj, obj, cls, rec->access_mode, &auditdata);
if (rc != Success)
- rec->status = rc;
+ rec->status = rc;
}
static void
@@ -368,39 +368,39 @@ SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
XaceSendAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj, ev_sid;
- SELinuxAuditRec auditdata = { .client = rec->client, .dev = rec->dev };
+ SELinuxAuditRec auditdata = {.client = rec->client,.dev = rec->dev };
security_class_t class;
int rc, i, type;
if (rec->dev)
- subj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
+ subj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
else
- subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+ subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
obj = dixLookupPrivate(&rec->pWin->devPrivates, objectKey);
/* Check send permission on window */
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DRAWABLE, DixSendAccess,
- &auditdata);
+ &auditdata);
if (rc != Success)
- goto err;
+ goto err;
/* Check send permission on specific event types */
for (i = 0; i < rec->count; i++) {
- type = rec->events[i].u.u.type;
- class = (type & 128) ? SECCLASS_X_FAKEEVENT : SECCLASS_X_EVENT;
+ type = rec->events[i].u.u.type;
+ class = (type & 128) ? SECCLASS_X_FAKEEVENT : SECCLASS_X_EVENT;
- rc = SELinuxEventToSID(type, obj->sid, &ev_sid);
- if (rc != Success)
- goto err;
+ rc = SELinuxEventToSID(type, obj->sid, &ev_sid);
+ if (rc != Success)
+ goto err;
- auditdata.event = type;
- rc = SELinuxDoCheck(subj, &ev_sid, class, DixSendAccess, &auditdata);
- if (rc != Success)
- goto err;
+ auditdata.event = type;
+ rc = SELinuxDoCheck(subj, &ev_sid, class, DixSendAccess, &auditdata);
+ if (rc != Success)
+ goto err;
}
return;
-err:
+ err:
rec->status = rc;
}
@@ -410,7 +410,7 @@ SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
XaceReceiveAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj, ev_sid;
- SELinuxAuditRec auditdata = { .client = NULL };
+ SELinuxAuditRec auditdata = {.client = NULL };
security_class_t class;
int rc, i, type;
@@ -419,26 +419,26 @@ SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
/* Check receive permission on window */
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DRAWABLE, DixReceiveAccess,
- &auditdata);
+ &auditdata);
if (rc != Success)
- goto err;
+ goto err;
/* Check receive permission on specific event types */
for (i = 0; i < rec->count; i++) {
- type = rec->events[i].u.u.type;
- class = (type & 128) ? SECCLASS_X_FAKEEVENT : SECCLASS_X_EVENT;
+ type = rec->events[i].u.u.type;
+ class = (type & 128) ? SECCLASS_X_FAKEEVENT : SECCLASS_X_EVENT;
- rc = SELinuxEventToSID(type, obj->sid, &ev_sid);
- if (rc != Success)
- goto err;
+ rc = SELinuxEventToSID(type, obj->sid, &ev_sid);
+ if (rc != Success)
+ goto err;
- auditdata.event = type;
- rc = SELinuxDoCheck(subj, &ev_sid, class, DixReceiveAccess, &auditdata);
- if (rc != Success)
- goto err;
+ auditdata.event = type;
+ rc = SELinuxDoCheck(subj, &ev_sid, class, DixReceiveAccess, &auditdata);
+ if (rc != Success)
+ goto err;
}
return;
-err:
+ err:
rec->status = rc;
}
@@ -448,7 +448,7 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
XaceExtAccessRec *rec = calldata;
SELinuxSubjectRec *subj, *serv;
SELinuxObjectRec *obj;
- SELinuxAuditRec auditdata = { .client = rec->client };
+ SELinuxAuditRec auditdata = {.client = rec->client };
int rc;
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
@@ -457,30 +457,30 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
/* If this is a new object that needs labeling, do it now */
/* XXX there should be a separate callback for this */
if (obj->sid == NULL) {
- security_id_t sid;
-
- serv = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
- rc = SELinuxExtensionToSID(rec->ext->name, &sid);
- if (rc != Success) {
- rec->status = rc;
- return;
- }
-
- /* Perform a transition to obtain the final SID */
- if (avc_compute_create(serv->sid, sid, SECCLASS_X_EXTENSION,
- &obj->sid) < 0) {
- ErrorF("SELinux: a SID transition call failed!\n");
- rec->status = BadValue;
- return;
- }
+ security_id_t sid;
+
+ serv = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
+ rc = SELinuxExtensionToSID(rec->ext->name, &sid);
+ if (rc != Success) {
+ rec->status = rc;
+ return;
+ }
+
+ /* Perform a transition to obtain the final SID */
+ if (avc_compute_create(serv->sid, sid, SECCLASS_X_EXTENSION,
+ &obj->sid) < 0) {
+ ErrorF("SELinux: a SID transition call failed!\n");
+ rec->status = BadValue;
+ return;
+ }
}
/* Perform the security check */
auditdata.extension = rec->ext->name;
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_EXTENSION, rec->access_mode,
- &auditdata);
+ &auditdata);
if (rc != Success)
- rec->status = rc;
+ rec->status = rc;
}
static void
@@ -492,7 +492,7 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
Selection *pSel = *rec->ppSel;
Atom name = pSel->selection;
Mask access_mode = rec->access_mode;
- SELinuxAuditRec auditdata = { .client = rec->client, .selection = name };
+ SELinuxAuditRec auditdata = {.client = rec->client,.selection = name };
security_id_t tsid;
int rc;
@@ -501,45 +501,45 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
/* If this is a new object that needs labeling, do it now */
if (access_mode & DixCreateAccess) {
- rc = SELinuxSelectionToSID(name, subj, &obj->sid, &obj->poly);
- if (rc != Success)
- obj->sid = unlabeled_sid;
- access_mode = DixSetAttrAccess;
+ rc = SELinuxSelectionToSID(name, subj, &obj->sid, &obj->poly);
+ if (rc != Success)
+ obj->sid = unlabeled_sid;
+ access_mode = DixSetAttrAccess;
}
/* If this is a polyinstantiated object, find the right instance */
else if (obj->poly) {
- rc = SELinuxSelectionToSID(name, subj, &tsid, NULL);
- if (rc != Success) {
- rec->status = rc;
- return;
- }
- while (pSel->selection != name || obj->sid != tsid) {
- if ((pSel = pSel->next) == NULL)
- break;
- obj = dixLookupPrivate(&pSel->devPrivates, objectKey);
- }
-
- if (pSel)
- *rec->ppSel = pSel;
- else {
- rec->status = BadMatch;
- return;
- }
+ rc = SELinuxSelectionToSID(name, subj, &tsid, NULL);
+ if (rc != Success) {
+ rec->status = rc;
+ return;
+ }
+ while (pSel->selection != name || obj->sid != tsid) {
+ if ((pSel = pSel->next) == NULL)
+ break;
+ obj = dixLookupPrivate(&pSel->devPrivates, objectKey);
+ }
+
+ if (pSel)
+ *rec->ppSel = pSel;
+ else {
+ rec->status = BadMatch;
+ return;
+ }
}
/* Perform the security check */
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SELECTION, access_mode,
- &auditdata);
+ &auditdata);
if (rc != Success)
- rec->status = rc;
+ rec->status = rc;
/* Label the content (advisory only) */
if (access_mode & DixSetAttrAccess) {
- data = dixLookupPrivate(&pSel->devPrivates, dataKey);
- if (subj->sel_create_sid)
- data->sid = subj->sel_create_sid;
- else
- data->sid = obj->sid;
+ data = dixLookupPrivate(&pSel->devPrivates, dataKey);
+ if (subj->sel_create_sid)
+ data->sid = subj->sel_create_sid;
+ else
+ data->sid = obj->sid;
}
}
@@ -551,59 +551,59 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
SELinuxObjectRec *obj, *data;
PropertyPtr pProp = *rec->ppProp;
Atom name = pProp->propertyName;
- SELinuxAuditRec auditdata = { .client = rec->client, .property = name };
+ SELinuxAuditRec auditdata = {.client = rec->client,.property = name };
security_id_t tsid;
int rc;
/* Don't care about the new content check */
if (rec->access_mode & DixPostAccess)
- return;
+ return;
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
obj = dixLookupPrivate(&pProp->devPrivates, objectKey);
/* If this is a new object that needs labeling, do it now */
if (rec->access_mode & DixCreateAccess) {
- rc = SELinuxPropertyToSID(name, subj, &obj->sid, &obj->poly);
- if (rc != Success) {
- rec->status = rc;
- return;
- }
+ rc = SELinuxPropertyToSID(name, subj, &obj->sid, &obj->poly);
+ if (rc != Success) {
+ rec->status = rc;
+ return;
+ }
}
/* If this is a polyinstantiated object, find the right instance */
else if (obj->poly) {
- rc = SELinuxPropertyToSID(name, subj, &tsid, NULL);
- if (rc != Success) {
- rec->status = rc;
- return;
- }
- while (pProp->propertyName != name || obj->sid != tsid) {
- if ((pProp = pProp->next) == NULL)
- break;
- obj = dixLookupPrivate(&pProp->devPrivates, objectKey);
- }
-
- if (pProp)
- *rec->ppProp = pProp;
- else {
- rec->status = BadMatch;
- return;
- }
+ rc = SELinuxPropertyToSID(name, subj, &tsid, NULL);
+ if (rc != Success) {
+ rec->status = rc;
+ return;
+ }
+ while (pProp->propertyName != name || obj->sid != tsid) {
+ if ((pProp = pProp->next) == NULL)
+ break;
+ obj = dixLookupPrivate(&pProp->devPrivates, objectKey);
+ }
+
+ if (pProp)
+ *rec->ppProp = pProp;
+ else {
+ rec->status = BadMatch;
+ return;
+ }
}
/* Perform the security check */
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_PROPERTY, rec->access_mode,
- &auditdata);
+ &auditdata);
if (rc != Success)
- rec->status = rc;
+ rec->status = rc;
/* Label the content (advisory only) */
if (rec->access_mode & DixWriteAccess) {
- data = dixLookupPrivate(&pProp->devPrivates, dataKey);
- if (subj->prp_create_sid)
- data->sid = subj->prp_create_sid;
- else
- data->sid = obj->sid;
+ data = dixLookupPrivate(&pProp->devPrivates, dataKey);
+ if (subj->prp_create_sid)
+ data->sid = subj->prp_create_sid;
+ else
+ data->sid = obj->sid;
}
}
@@ -613,7 +613,7 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
XaceResourceAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
- SELinuxAuditRec auditdata = { .client = rec->client };
+ SELinuxAuditRec auditdata = {.client = rec->client };
Mask access_mode = rec->access_mode;
PrivateRec **privatePtr;
security_class_t class;
@@ -624,30 +624,31 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
/* Determine if the resource object has a devPrivates field */
offset = dixLookupPrivateOffset(rec->rtype);
if (offset < 0) {
- /* No: use the SID of the owning client */
- class = SECCLASS_X_RESOURCE;
- privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
- obj = dixLookupPrivate(privatePtr, objectKey);
- } else {
- /* Yes: use the SID from the resource object itself */
- class = SELinuxTypeToClass(rec->rtype);
- privatePtr = DEVPRIV_AT(rec->res, offset);
- obj = dixLookupPrivate(privatePtr, objectKey);
+ /* No: use the SID of the owning client */
+ class = SECCLASS_X_RESOURCE;
+ privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
+ obj = dixLookupPrivate(privatePtr, objectKey);
+ }
+ else {
+ /* Yes: use the SID from the resource object itself */
+ class = SELinuxTypeToClass(rec->rtype);
+ privatePtr = DEVPRIV_AT(rec->res, offset);
+ obj = dixLookupPrivate(privatePtr, objectKey);
}
/* If this is a new object that needs labeling, do it now */
if (access_mode & DixCreateAccess && offset >= 0) {
- rc = SELinuxLabelResource(rec, subj, obj, class);
- if (rc != Success) {
- rec->status = rc;
- return;
- }
+ rc = SELinuxLabelResource(rec, subj, obj, class);
+ if (rc != Success) {
+ rec->status = rc;
+ return;
+ }
}
/* Collapse generic resource permissions down to read/write */
if (class == SECCLASS_X_RESOURCE) {
- access_mode = !!(rec->access_mode & SELinuxReadMask); /* rd */
- access_mode |= !!(rec->access_mode & ~SELinuxReadMask) << 1; /* wr */
+ access_mode = ! !(rec->access_mode & SELinuxReadMask); /* rd */
+ access_mode |= ! !(rec->access_mode & ~SELinuxReadMask) << 1; /* wr */
}
/* Perform the security check */
@@ -655,13 +656,13 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
auditdata.id = rec->id;
rc = SELinuxDoCheck(subj, obj, class, access_mode, &auditdata);
if (rc != Success)
- rec->status = rc;
+ rec->status = rc;
/* Perform the background none check on windows */
if (access_mode & DixCreateAccess && rec->rtype == RT_WINDOW) {
- rc = SELinuxDoCheck(subj, obj, class, DixBlendAccess, &auditdata);
- if (rc != Success)
- ((WindowPtr)rec->res)->forcedBG = TRUE;
+ rc = SELinuxDoCheck(subj, obj, class, DixBlendAccess, &auditdata);
+ if (rc != Success)
+ ((WindowPtr) rec->res)->forcedBG = TRUE;
}
}
@@ -671,7 +672,7 @@ SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
XaceScreenAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
- SELinuxAuditRec auditdata = { .client = rec->client };
+ SELinuxAuditRec auditdata = {.client = rec->client };
Mask access_mode = rec->access_mode;
int rc;
@@ -680,21 +681,21 @@ SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
/* If this is a new object that needs labeling, do it now */
if (access_mode & DixCreateAccess) {
- /* Perform a transition to obtain the final SID */
- if (avc_compute_create(subj->sid, subj->sid, SECCLASS_X_SCREEN,
- &obj->sid) < 0) {
- ErrorF("SELinux: a compute_create call failed!\n");
- rec->status = BadValue;
- return;
- }
+ /* Perform a transition to obtain the final SID */
+ if (avc_compute_create(subj->sid, subj->sid, SECCLASS_X_SCREEN,
+ &obj->sid) < 0) {
+ ErrorF("SELinux: a compute_create call failed!\n");
+ rec->status = BadValue;
+ return;
+ }
}
if (is_saver)
- access_mode <<= 2;
+ access_mode <<= 2;
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SCREEN, access_mode, &auditdata);
if (rc != Success)
- rec->status = rc;
+ rec->status = rc;
}
static void
@@ -703,16 +704,16 @@ SELinuxClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
XaceClientAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
- SELinuxAuditRec auditdata = { .client = rec->client };
+ SELinuxAuditRec auditdata = {.client = rec->client };
int rc;
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
obj = dixLookupPrivate(&rec->target->devPrivates, objectKey);
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_CLIENT, rec->access_mode,
- &auditdata);
+ &auditdata);
if (rc != Success)
- rec->status = rc;
+ rec->status = rc;
}
static void
@@ -721,19 +722,18 @@ SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
XaceServerAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
- SELinuxAuditRec auditdata = { .client = rec->client };
+ SELinuxAuditRec auditdata = {.client = rec->client };
int rc;
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
obj = dixLookupPrivate(&serverClient->devPrivates, objectKey);
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SERVER, rec->access_mode,
- &auditdata);
+ &auditdata);
if (rc != Success)
- rec->status = rc;
+ rec->status = rc;
}
-
/*
* DIX Callbacks
*/
@@ -745,11 +745,11 @@ SELinuxClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
switch (pci->client->clientState) {
case ClientStateInitial:
- SELinuxLabelClient(pci->client);
- break;
+ SELinuxLabelClient(pci->client);
+ break;
default:
- break;
+ break;
}
}
@@ -762,45 +762,48 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
WindowPtr pWin;
if (rec->type != RT_WINDOW)
- return;
+ return;
if (rec->state != ResourceStateAdding)
- return;
+ return;
- pWin = (WindowPtr)rec->value;
+ pWin = (WindowPtr) rec->value;
subj = dixLookupPrivate(&wClient(pWin)->devPrivates, subjectKey);
if (subj->sid) {
- security_context_t ctx;
- int rc = avc_sid_to_context_raw(subj->sid, &ctx);
- if (rc < 0)
- FatalError("SELinux: Failed to get security context!\n");
- rc = dixChangeWindowProperty(serverClient,
- pWin, atom_client_ctx, XA_STRING, 8,
- PropModeReplace, strlen(ctx), ctx, FALSE);
- if (rc != Success)
- FatalError("SELinux: Failed to set label property on window!\n");
- freecon(ctx);
- } else
- FatalError("SELinux: Unexpected unlabeled client found\n");
+ security_context_t ctx;
+ int rc = avc_sid_to_context_raw(subj->sid, &ctx);
+
+ if (rc < 0)
+ FatalError("SELinux: Failed to get security context!\n");
+ rc = dixChangeWindowProperty(serverClient,
+ pWin, atom_client_ctx, XA_STRING, 8,
+ PropModeReplace, strlen(ctx), ctx, FALSE);
+ if (rc != Success)
+ FatalError("SELinux: Failed to set label property on window!\n");
+ freecon(ctx);
+ }
+ else
+ FatalError("SELinux: Unexpected unlabeled client found\n");
obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
if (obj->sid) {
- security_context_t ctx;
- int rc = avc_sid_to_context_raw(obj->sid, &ctx);
- if (rc < 0)
- FatalError("SELinux: Failed to get security context!\n");
- rc = dixChangeWindowProperty(serverClient,
- pWin, atom_ctx, XA_STRING, 8,
- PropModeReplace, strlen(ctx), ctx, FALSE);
- if (rc != Success)
- FatalError("SELinux: Failed to set label property on window!\n");
- freecon(ctx);
- } else
- FatalError("SELinux: Unexpected unlabeled window found\n");
+ security_context_t ctx;
+ int rc = avc_sid_to_context_raw(obj->sid, &ctx);
+
+ if (rc < 0)
+ FatalError("SELinux: Failed to get security context!\n");
+ rc = dixChangeWindowProperty(serverClient,
+ pWin, atom_ctx, XA_STRING, 8,
+ PropModeReplace, strlen(ctx), ctx, FALSE);
+ if (rc != Success)
+ FatalError("SELinux: Failed to set label property on window!\n");
+ freecon(ctx);
+ }
+ else
+ FatalError("SELinux: Unexpected unlabeled window found\n");
}
-
static int netlink_fd;
static void
@@ -811,7 +814,7 @@ SELinuxBlockHandler(void *data, struct timeval **tv, void *read_mask)
static void
SELinuxWakeupHandler(void *data, int err, void *read_mask)
{
- if (FD_ISSET(netlink_fd, (fd_set *)read_mask))
+ if (FD_ISSET(netlink_fd, (fd_set *) read_mask))
avc_netlink_check_nb();
}
@@ -848,63 +851,68 @@ SELinuxFlaskReset(void)
void
SELinuxFlaskInit(void)
{
- struct selinux_opt avc_option = { AVC_OPT_SETENFORCE, (char *)0 };
+ struct selinux_opt avc_option = { AVC_OPT_SETENFORCE, (char *) 0 };
security_context_t ctx;
int ret = TRUE;
- switch(selinuxEnforcingState) {
+ switch (selinuxEnforcingState) {
case SELINUX_MODE_ENFORCING:
- LogMessage(X_INFO, "SELinux: Configured in enforcing mode\n");
- avc_option.value = (char *)1;
- break;
+ LogMessage(X_INFO, "SELinux: Configured in enforcing mode\n");
+ avc_option.value = (char *) 1;
+ break;
case SELINUX_MODE_PERMISSIVE:
- LogMessage(X_INFO, "SELinux: Configured in permissive mode\n");
- avc_option.value = (char *)0;
- break;
+ LogMessage(X_INFO, "SELinux: Configured in permissive mode\n");
+ avc_option.value = (char *) 0;
+ break;
default:
- avc_option.type = AVC_OPT_UNUSED;
- break;
+ avc_option.type = AVC_OPT_UNUSED;
+ break;
}
/* Set up SELinux stuff */
- selinux_set_callback(SELINUX_CB_LOG, (union selinux_callback)SELinuxLog);
- selinux_set_callback(SELINUX_CB_AUDIT, (union selinux_callback)SELinuxAudit);
+ selinux_set_callback(SELINUX_CB_LOG, (union selinux_callback) SELinuxLog);
+ selinux_set_callback(SELINUX_CB_AUDIT,
+ (union selinux_callback) SELinuxAudit);
if (selinux_set_mapping(map) < 0) {
- if (errno == EINVAL) {
- ErrorF("SELinux: Invalid object class mapping, disabling SELinux support.\n");
- return;
- }
- FatalError("SELinux: Failed to set up security class mapping\n");
+ if (errno == EINVAL) {
+ ErrorF
+ ("SELinux: Invalid object class mapping, disabling SELinux support.\n");
+ return;
+ }
+ FatalError("SELinux: Failed to set up security class mapping\n");
}
if (avc_open(&avc_option, 1) < 0)
- FatalError("SELinux: Couldn't initialize SELinux userspace AVC\n");
+ FatalError("SELinux: Couldn't initialize SELinux userspace AVC\n");
if (security_get_initial_context_raw("unlabeled", &ctx) < 0)
- FatalError("SELinux: Failed to look up unlabeled context\n");
+ FatalError("SELinux: Failed to look up unlabeled context\n");
if (avc_context_to_sid_raw(ctx, &unlabeled_sid) < 0)
- FatalError("SELinux: a context_to_SID call failed!\n");
+ FatalError("SELinux: a context_to_SID call failed!\n");
freecon(ctx);
/* Prepare for auditing */
audit_fd = audit_open();
if (audit_fd < 0)
- FatalError("SELinux: Failed to open the system audit log\n");
+ FatalError("SELinux: Failed to open the system audit log\n");
/* Allocate private storage */
- if (!dixRegisterPrivateKey(subjectKey, PRIVATE_XSELINUX, sizeof(SELinuxSubjectRec)) ||
- !dixRegisterPrivateKey(objectKey, PRIVATE_XSELINUX, sizeof(SELinuxObjectRec)) ||
- !dixRegisterPrivateKey(dataKey, PRIVATE_XSELINUX, sizeof(SELinuxObjectRec)))
- FatalError("SELinux: Failed to allocate private storage.\n");
+ if (!dixRegisterPrivateKey
+ (subjectKey, PRIVATE_XSELINUX, sizeof(SELinuxSubjectRec)) ||
+ !dixRegisterPrivateKey(objectKey, PRIVATE_XSELINUX,
+ sizeof(SELinuxObjectRec)) ||
+ !dixRegisterPrivateKey(dataKey, PRIVATE_XSELINUX,
+ sizeof(SELinuxObjectRec)))
+ FatalError("SELinux: Failed to allocate private storage.\n");
/* Create atoms for doing window labeling */
atom_ctx = MakeAtom("_SELINUX_CONTEXT", 16, TRUE);
if (atom_ctx == BAD_RESOURCE)
- FatalError("SELinux: Failed to create atom\n");
+ FatalError("SELinux: Failed to create atom\n");
atom_client_ctx = MakeAtom("_SELINUX_CLIENT_CONTEXT", 23, TRUE);
if (atom_client_ctx == BAD_RESOURCE)
- FatalError("SELinux: Failed to create atom\n");
+ FatalError("SELinux: Failed to create atom\n");
netlink_fd = avc_netlink_acquire_fd();
AddGeneralSocket(netlink_fd);
@@ -928,7 +936,7 @@ SELinuxFlaskInit(void)
ret &= XaceRegisterCallback(XACE_SCREEN_ACCESS, SELinuxScreen, NULL);
ret &= XaceRegisterCallback(XACE_SCREENSAVER_ACCESS, SELinuxScreen, truep);
if (!ret)
- FatalError("SELinux: Failed to register one or more callbacks\n");
+ FatalError("SELinux: Failed to register one or more callbacks\n");
/* Label objects that were created before we could register ourself */
SELinuxLabelInitial();
diff --git a/xorg-server/Xext/xselinux_label.c b/xorg-server/Xext/xselinux_label.c
index 76e537abe..2c33d1cbf 100644
--- a/xorg-server/Xext/xselinux_label.c
+++ b/xorg-server/Xext/xselinux_label.c
@@ -1,374 +1,381 @@
-/************************************************************
-
-Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-this permission notice appear in supporting documentation. This permission
-notice shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <selinux/label.h>
-
-#include "registry.h"
-#include "xselinuxint.h"
-
-/* selection and property atom cache */
-typedef struct {
- SELinuxObjectRec prp;
- SELinuxObjectRec sel;
-} SELinuxAtomRec;
-
-/* dynamic array */
-typedef struct {
- unsigned size;
- void **array;
-} SELinuxArrayRec;
-
-/* labeling handle */
-static struct selabel_handle *label_hnd;
-
-/* Array of object classes indexed by resource type */
-SELinuxArrayRec arr_types;
-/* Array of event SIDs indexed by event type */
-SELinuxArrayRec arr_events;
-/* Array of property and selection SID structures */
-SELinuxArrayRec arr_atoms;
-
-/*
- * Dynamic array helpers
- */
-static void *
-SELinuxArrayGet(SELinuxArrayRec *rec, unsigned key)
-{
- return (rec->size > key) ? rec->array[key] : 0;
-}
-
-static int
-SELinuxArraySet(SELinuxArrayRec *rec, unsigned key, void *val)
-{
- if (key >= rec->size) {
- /* Need to increase size of array */
- rec->array = realloc(rec->array, (key + 1) * sizeof(val));
- if (!rec->array)
- return FALSE;
- memset(rec->array + rec->size, 0, (key - rec->size + 1) * sizeof(val));
- rec->size = key + 1;
- }
-
- rec->array[key] = val;
- return TRUE;
-}
-
-static void
-SELinuxArrayFree(SELinuxArrayRec *rec, int free_elements)
-{
- if (free_elements) {
- unsigned i = rec->size;
- while (i)
- free(rec->array[--i]);
- }
-
- free(rec->array);
- rec->size = 0;
- rec->array = NULL;
-}
-
-/*
- * Looks up a name in the selection or property mappings
- */
-static int
-SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec *obj, int map, int polymap)
-{
- const char *name = NameForAtom(atom);
- security_context_t ctx;
- int rc = Success;
-
- obj->poly = 1;
-
- /* Look in the mappings of names to contexts */
- if (selabel_lookup_raw(label_hnd, &ctx, name, map) == 0) {
- obj->poly = 0;
- } else if (errno != ENOENT) {
- ErrorF("SELinux: a property label lookup failed!\n");
- return BadValue;
- } else if (selabel_lookup_raw(label_hnd, &ctx, name, polymap) < 0) {
- ErrorF("SELinux: a property label lookup failed!\n");
- return BadValue;
- }
-
- /* Get a SID for context */
- if (avc_context_to_sid_raw(ctx, &obj->sid) < 0) {
- ErrorF("SELinux: a context_to_SID_raw call failed!\n");
- rc = BadAlloc;
- }
-
- freecon(ctx);
- return rc;
-}
-
-/*
- * Looks up the SID corresponding to the given property or selection atom
- */
-int
-SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec **obj_rtn)
-{
- SELinuxAtomRec *rec;
- SELinuxObjectRec *obj;
- int rc, map, polymap;
-
- rec = SELinuxArrayGet(&arr_atoms, atom);
- if (!rec) {
- rec = calloc(1, sizeof(SELinuxAtomRec));
- if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
- return BadAlloc;
- }
-
- if (prop) {
- obj = &rec->prp;
- map = SELABEL_X_PROP;
- polymap = SELABEL_X_POLYPROP;
- } else {
- obj = &rec->sel;
- map = SELABEL_X_SELN;
- polymap = SELABEL_X_POLYSELN;
- }
-
- if (!obj->sid) {
- rc = SELinuxAtomToSIDLookup(atom, obj, map, polymap);
- if (rc != Success)
- goto out;
- }
-
- *obj_rtn = obj;
- rc = Success;
-out:
- return rc;
-}
-
-/*
- * Looks up a SID for a selection/subject pair
- */
-int
-SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec *subj,
- security_id_t *sid_rtn, int *poly_rtn)
-{
- int rc;
- SELinuxObjectRec *obj;
- security_id_t tsid;
-
- /* Get the default context and polyinstantiation bit */
- rc = SELinuxAtomToSID(selection, 0, &obj);
- if (rc != Success)
- return rc;
-
- /* Check for an override context next */
- if (subj->sel_use_sid) {
- tsid = subj->sel_use_sid;
- goto out;
- }
-
- tsid = obj->sid;
-
- /* Polyinstantiate if necessary to obtain the final SID */
- if (obj->poly && avc_compute_member(subj->sid, obj->sid,
- SECCLASS_X_SELECTION, &tsid) < 0) {
- ErrorF("SELinux: a compute_member call failed!\n");
- return BadValue;
- }
-out:
- *sid_rtn = tsid;
- if (poly_rtn)
- *poly_rtn = obj->poly;
- return Success;
-}
-
-/*
- * Looks up a SID for a property/subject pair
- */
-int
-SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj,
- security_id_t *sid_rtn, int *poly_rtn)
-{
- int rc;
- SELinuxObjectRec *obj;
- security_id_t tsid, tsid2;
-
- /* Get the default context and polyinstantiation bit */
- rc = SELinuxAtomToSID(property, 1, &obj);
- if (rc != Success)
- return rc;
-
- /* Check for an override context next */
- if (subj->prp_use_sid) {
- tsid = subj->prp_use_sid;
- goto out;
- }
-
- /* Perform a transition */
- if (avc_compute_create(subj->sid, obj->sid,
- SECCLASS_X_PROPERTY, &tsid) < 0) {
- ErrorF("SELinux: a compute_create call failed!\n");
- return BadValue;
- }
-
- /* Polyinstantiate if necessary to obtain the final SID */
- if (obj->poly) {
- tsid2 = tsid;
- if (avc_compute_member(subj->sid, tsid2,
- SECCLASS_X_PROPERTY, &tsid) < 0) {
- ErrorF("SELinux: a compute_member call failed!\n");
- return BadValue;
- }
- }
-out:
- *sid_rtn = tsid;
- if (poly_rtn)
- *poly_rtn = obj->poly;
- return Success;
-}
-
-/*
- * Looks up the SID corresponding to the given event type
- */
-int
-SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
- SELinuxObjectRec *sid_return)
-{
- const char *name = LookupEventName(type);
- security_id_t sid;
- security_context_t ctx;
- type &= 127;
-
- sid = SELinuxArrayGet(&arr_events, type);
- if (!sid) {
- /* Look in the mappings of event names to contexts */
- if (selabel_lookup_raw(label_hnd, &ctx, name, SELABEL_X_EVENT) < 0) {
- ErrorF("SELinux: an event label lookup failed!\n");
- return BadValue;
- }
- /* Get a SID for context */
- if (avc_context_to_sid_raw(ctx, &sid) < 0) {
- ErrorF("SELinux: a context_to_SID_raw call failed!\n");
- freecon(ctx);
- return BadAlloc;
- }
- freecon(ctx);
- /* Cache the SID value */
- if (!SELinuxArraySet(&arr_events, type, sid))
- return BadAlloc;
- }
-
- /* Perform a transition to obtain the final SID */
- if (avc_compute_create(sid_of_window, sid, SECCLASS_X_EVENT,
- &sid_return->sid) < 0) {
- ErrorF("SELinux: a compute_create call failed!\n");
- return BadValue;
- }
-
- return Success;
-}
-
-int
-SELinuxExtensionToSID(const char *name, security_id_t *sid_rtn)
-{
- security_context_t ctx;
-
- /* Look in the mappings of extension names to contexts */
- if (selabel_lookup_raw(label_hnd, &ctx, name, SELABEL_X_EXT) < 0) {
- ErrorF("SELinux: a property label lookup failed!\n");
- return BadValue;
- }
- /* Get a SID for context */
- if (avc_context_to_sid_raw(ctx, sid_rtn) < 0) {
- ErrorF("SELinux: a context_to_SID_raw call failed!\n");
- freecon(ctx);
- return BadAlloc;
- }
- freecon(ctx);
- return Success;
-}
-
-/*
- * Returns the object class corresponding to the given resource type.
- */
-security_class_t
-SELinuxTypeToClass(RESTYPE type)
-{
- void *tmp;
-
- tmp = SELinuxArrayGet(&arr_types, type & TypeMask);
- if (!tmp) {
- unsigned long class = SECCLASS_X_RESOURCE;
-
- if (type & RC_DRAWABLE)
- class = SECCLASS_X_DRAWABLE;
- else if (type == RT_GC)
- class = SECCLASS_X_GC;
- else if (type == RT_FONT)
- class = SECCLASS_X_FONT;
- else if (type == RT_CURSOR)
- class = SECCLASS_X_CURSOR;
- else if (type == RT_COLORMAP)
- class = SECCLASS_X_COLORMAP;
- else {
- /* Need to do a string lookup */
- const char *str = LookupResourceName(type);
- if (!strcmp(str, "PICTURE"))
- class = SECCLASS_X_DRAWABLE;
- else if (!strcmp(str, "GLYPHSET"))
- class = SECCLASS_X_FONT;
- }
-
- tmp = (void *)class;
- SELinuxArraySet(&arr_types, type & TypeMask, tmp);
- }
-
- return (security_class_t)(unsigned long)tmp;
-}
-
-security_context_t
-SELinuxDefaultClientLabel(void)
-{
- security_context_t ctx;
-
- if (selabel_lookup_raw(label_hnd, &ctx, "remote", SELABEL_X_CLIENT) < 0)
- FatalError("SELinux: failed to look up remote-client context\n");
-
- return ctx;
-}
-
-void
-SELinuxLabelInit(void)
-{
- struct selinux_opt selabel_option = { SELABEL_OPT_VALIDATE, (char *)1 };
-
- label_hnd = selabel_open(SELABEL_CTX_X, &selabel_option, 1);
- if (!label_hnd)
- FatalError("SELinux: Failed to open x_contexts mapping in policy\n");
-}
-
-void
-SELinuxLabelReset(void)
-{
- selabel_close(label_hnd);
- label_hnd = NULL;
-
- /* Free local state */
- SELinuxArrayFree(&arr_types, 0);
- SELinuxArrayFree(&arr_events, 0);
- SELinuxArrayFree(&arr_atoms, 1);
-}
+/************************************************************
+
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+this permission notice appear in supporting documentation. This permission
+notice shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <selinux/label.h>
+
+#include "registry.h"
+#include "xselinuxint.h"
+
+/* selection and property atom cache */
+typedef struct {
+ SELinuxObjectRec prp;
+ SELinuxObjectRec sel;
+} SELinuxAtomRec;
+
+/* dynamic array */
+typedef struct {
+ unsigned size;
+ void **array;
+} SELinuxArrayRec;
+
+/* labeling handle */
+static struct selabel_handle *label_hnd;
+
+/* Array of object classes indexed by resource type */
+SELinuxArrayRec arr_types;
+
+/* Array of event SIDs indexed by event type */
+SELinuxArrayRec arr_events;
+
+/* Array of property and selection SID structures */
+SELinuxArrayRec arr_atoms;
+
+/*
+ * Dynamic array helpers
+ */
+static void *
+SELinuxArrayGet(SELinuxArrayRec * rec, unsigned key)
+{
+ return (rec->size > key) ? rec->array[key] : 0;
+}
+
+static int
+SELinuxArraySet(SELinuxArrayRec * rec, unsigned key, void *val)
+{
+ if (key >= rec->size) {
+ /* Need to increase size of array */
+ rec->array = realloc(rec->array, (key + 1) * sizeof(val));
+ if (!rec->array)
+ return FALSE;
+ memset(rec->array + rec->size, 0, (key - rec->size + 1) * sizeof(val));
+ rec->size = key + 1;
+ }
+
+ rec->array[key] = val;
+ return TRUE;
+}
+
+static void
+SELinuxArrayFree(SELinuxArrayRec * rec, int free_elements)
+{
+ if (free_elements) {
+ unsigned i = rec->size;
+
+ while (i)
+ free(rec->array[--i]);
+ }
+
+ free(rec->array);
+ rec->size = 0;
+ rec->array = NULL;
+}
+
+/*
+ * Looks up a name in the selection or property mappings
+ */
+static int
+SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec * obj, int map, int polymap)
+{
+ const char *name = NameForAtom(atom);
+ security_context_t ctx;
+ int rc = Success;
+
+ obj->poly = 1;
+
+ /* Look in the mappings of names to contexts */
+ if (selabel_lookup_raw(label_hnd, &ctx, name, map) == 0) {
+ obj->poly = 0;
+ }
+ else if (errno != ENOENT) {
+ ErrorF("SELinux: a property label lookup failed!\n");
+ return BadValue;
+ }
+ else if (selabel_lookup_raw(label_hnd, &ctx, name, polymap) < 0) {
+ ErrorF("SELinux: a property label lookup failed!\n");
+ return BadValue;
+ }
+
+ /* Get a SID for context */
+ if (avc_context_to_sid_raw(ctx, &obj->sid) < 0) {
+ ErrorF("SELinux: a context_to_SID_raw call failed!\n");
+ rc = BadAlloc;
+ }
+
+ freecon(ctx);
+ return rc;
+}
+
+/*
+ * Looks up the SID corresponding to the given property or selection atom
+ */
+int
+SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn)
+{
+ SELinuxAtomRec *rec;
+ SELinuxObjectRec *obj;
+ int rc, map, polymap;
+
+ rec = SELinuxArrayGet(&arr_atoms, atom);
+ if (!rec) {
+ rec = calloc(1, sizeof(SELinuxAtomRec));
+ if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
+ return BadAlloc;
+ }
+
+ if (prop) {
+ obj = &rec->prp;
+ map = SELABEL_X_PROP;
+ polymap = SELABEL_X_POLYPROP;
+ }
+ else {
+ obj = &rec->sel;
+ map = SELABEL_X_SELN;
+ polymap = SELABEL_X_POLYSELN;
+ }
+
+ if (!obj->sid) {
+ rc = SELinuxAtomToSIDLookup(atom, obj, map, polymap);
+ if (rc != Success)
+ goto out;
+ }
+
+ *obj_rtn = obj;
+ rc = Success;
+ out:
+ return rc;
+}
+
+/*
+ * Looks up a SID for a selection/subject pair
+ */
+int
+SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec * subj,
+ security_id_t * sid_rtn, int *poly_rtn)
+{
+ int rc;
+ SELinuxObjectRec *obj;
+ security_id_t tsid;
+
+ /* Get the default context and polyinstantiation bit */
+ rc = SELinuxAtomToSID(selection, 0, &obj);
+ if (rc != Success)
+ return rc;
+
+ /* Check for an override context next */
+ if (subj->sel_use_sid) {
+ tsid = subj->sel_use_sid;
+ goto out;
+ }
+
+ tsid = obj->sid;
+
+ /* Polyinstantiate if necessary to obtain the final SID */
+ if (obj->poly && avc_compute_member(subj->sid, obj->sid,
+ SECCLASS_X_SELECTION, &tsid) < 0) {
+ ErrorF("SELinux: a compute_member call failed!\n");
+ return BadValue;
+ }
+ out:
+ *sid_rtn = tsid;
+ if (poly_rtn)
+ *poly_rtn = obj->poly;
+ return Success;
+}
+
+/*
+ * Looks up a SID for a property/subject pair
+ */
+int
+SELinuxPropertyToSID(Atom property, SELinuxSubjectRec * subj,
+ security_id_t * sid_rtn, int *poly_rtn)
+{
+ int rc;
+ SELinuxObjectRec *obj;
+ security_id_t tsid, tsid2;
+
+ /* Get the default context and polyinstantiation bit */
+ rc = SELinuxAtomToSID(property, 1, &obj);
+ if (rc != Success)
+ return rc;
+
+ /* Check for an override context next */
+ if (subj->prp_use_sid) {
+ tsid = subj->prp_use_sid;
+ goto out;
+ }
+
+ /* Perform a transition */
+ if (avc_compute_create(subj->sid, obj->sid, SECCLASS_X_PROPERTY, &tsid) < 0) {
+ ErrorF("SELinux: a compute_create call failed!\n");
+ return BadValue;
+ }
+
+ /* Polyinstantiate if necessary to obtain the final SID */
+ if (obj->poly) {
+ tsid2 = tsid;
+ if (avc_compute_member(subj->sid, tsid2,
+ SECCLASS_X_PROPERTY, &tsid) < 0) {
+ ErrorF("SELinux: a compute_member call failed!\n");
+ return BadValue;
+ }
+ }
+ out:
+ *sid_rtn = tsid;
+ if (poly_rtn)
+ *poly_rtn = obj->poly;
+ return Success;
+}
+
+/*
+ * Looks up the SID corresponding to the given event type
+ */
+int
+SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
+ SELinuxObjectRec * sid_return)
+{
+ const char *name = LookupEventName(type);
+ security_id_t sid;
+ security_context_t ctx;
+
+ type &= 127;
+
+ sid = SELinuxArrayGet(&arr_events, type);
+ if (!sid) {
+ /* Look in the mappings of event names to contexts */
+ if (selabel_lookup_raw(label_hnd, &ctx, name, SELABEL_X_EVENT) < 0) {
+ ErrorF("SELinux: an event label lookup failed!\n");
+ return BadValue;
+ }
+ /* Get a SID for context */
+ if (avc_context_to_sid_raw(ctx, &sid) < 0) {
+ ErrorF("SELinux: a context_to_SID_raw call failed!\n");
+ freecon(ctx);
+ return BadAlloc;
+ }
+ freecon(ctx);
+ /* Cache the SID value */
+ if (!SELinuxArraySet(&arr_events, type, sid))
+ return BadAlloc;
+ }
+
+ /* Perform a transition to obtain the final SID */
+ if (avc_compute_create(sid_of_window, sid, SECCLASS_X_EVENT,
+ &sid_return->sid) < 0) {
+ ErrorF("SELinux: a compute_create call failed!\n");
+ return BadValue;
+ }
+
+ return Success;
+}
+
+int
+SELinuxExtensionToSID(const char *name, security_id_t * sid_rtn)
+{
+ security_context_t ctx;
+
+ /* Look in the mappings of extension names to contexts */
+ if (selabel_lookup_raw(label_hnd, &ctx, name, SELABEL_X_EXT) < 0) {
+ ErrorF("SELinux: a property label lookup failed!\n");
+ return BadValue;
+ }
+ /* Get a SID for context */
+ if (avc_context_to_sid_raw(ctx, sid_rtn) < 0) {
+ ErrorF("SELinux: a context_to_SID_raw call failed!\n");
+ freecon(ctx);
+ return BadAlloc;
+ }
+ freecon(ctx);
+ return Success;
+}
+
+/*
+ * Returns the object class corresponding to the given resource type.
+ */
+security_class_t
+SELinuxTypeToClass(RESTYPE type)
+{
+ void *tmp;
+
+ tmp = SELinuxArrayGet(&arr_types, type & TypeMask);
+ if (!tmp) {
+ unsigned long class = SECCLASS_X_RESOURCE;
+
+ if (type & RC_DRAWABLE)
+ class = SECCLASS_X_DRAWABLE;
+ else if (type == RT_GC)
+ class = SECCLASS_X_GC;
+ else if (type == RT_FONT)
+ class = SECCLASS_X_FONT;
+ else if (type == RT_CURSOR)
+ class = SECCLASS_X_CURSOR;
+ else if (type == RT_COLORMAP)
+ class = SECCLASS_X_COLORMAP;
+ else {
+ /* Need to do a string lookup */
+ const char *str = LookupResourceName(type);
+
+ if (!strcmp(str, "PICTURE"))
+ class = SECCLASS_X_DRAWABLE;
+ else if (!strcmp(str, "GLYPHSET"))
+ class = SECCLASS_X_FONT;
+ }
+
+ tmp = (void *) class;
+ SELinuxArraySet(&arr_types, type & TypeMask, tmp);
+ }
+
+ return (security_class_t) (unsigned long) tmp;
+}
+
+security_context_t
+SELinuxDefaultClientLabel(void)
+{
+ security_context_t ctx;
+
+ if (selabel_lookup_raw(label_hnd, &ctx, "remote", SELABEL_X_CLIENT) < 0)
+ FatalError("SELinux: failed to look up remote-client context\n");
+
+ return ctx;
+}
+
+void
+SELinuxLabelInit(void)
+{
+ struct selinux_opt selabel_option = { SELABEL_OPT_VALIDATE, (char *) 1 };
+
+ label_hnd = selabel_open(SELABEL_CTX_X, &selabel_option, 1);
+ if (!label_hnd)
+ FatalError("SELinux: Failed to open x_contexts mapping in policy\n");
+}
+
+void
+SELinuxLabelReset(void)
+{
+ selabel_close(label_hnd);
+ label_hnd = NULL;
+
+ /* Free local state */
+ SELinuxArrayFree(&arr_types, 0);
+ SELinuxArrayFree(&arr_events, 0);
+ SELinuxArrayFree(&arr_atoms, 1);
+}
diff --git a/xorg-server/Xext/xselinuxint.h b/xorg-server/Xext/xselinuxint.h
index fb1d7f4c7..57f8b7305 100644
--- a/xorg-server/Xext/xselinuxint.h
+++ b/xorg-server/Xext/xselinuxint.h
@@ -1,561 +1,564 @@
-/************************************************************
-
-Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-this permission notice appear in supporting documentation. This permission
-notice shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-********************************************************/
-
-#ifndef _XSELINUXINT_H
-#define _XSELINUXINT_H
-
-#include <selinux/selinux.h>
-#include <selinux/avc.h>
-
-#include "globals.h"
-#include "dixaccess.h"
-#include "dixstruct.h"
-#include "privates.h"
-#include "resource.h"
-#include "registry.h"
-#include "inputstr.h"
-#include "xselinux.h"
-
-/*
- * Types
- */
-
-#define COMMAND_LEN 64
-
-/* subject state (clients and devices only) */
-typedef struct {
- security_id_t sid;
- security_id_t dev_create_sid;
- security_id_t win_create_sid;
- security_id_t sel_create_sid;
- security_id_t prp_create_sid;
- security_id_t sel_use_sid;
- security_id_t prp_use_sid;
- struct avc_entry_ref aeref;
- char command[COMMAND_LEN];
- int privileged;
-} SELinuxSubjectRec;
-
-/* object state */
-typedef struct {
- security_id_t sid;
- int poly;
-} SELinuxObjectRec;
-
-/*
- * Globals
- */
-
-extern DevPrivateKeyRec subjectKeyRec;
-#define subjectKey (&subjectKeyRec)
-extern DevPrivateKeyRec objectKeyRec;
-#define objectKey (&objectKeyRec)
-extern DevPrivateKeyRec dataKeyRec;
-#define dataKey (&dataKeyRec)
-
-/*
- * Label functions
- */
-
-int
-SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec **obj_rtn);
-
-int
-SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec *subj,
- security_id_t *sid_rtn, int *poly_rtn);
-
-int
-SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj,
- security_id_t *sid_rtn, int *poly_rtn);
-
-int
-SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
- SELinuxObjectRec *sid_return);
-
-int
-SELinuxExtensionToSID(const char *name, security_id_t *sid_rtn);
-
-security_class_t
-SELinuxTypeToClass(RESTYPE type);
-
-security_context_t
-SELinuxDefaultClientLabel(void);
-
-void
-SELinuxLabelInit(void);
-
-void
-SELinuxLabelReset(void);
-
-/*
- * Security module functions
- */
-
-void
-SELinuxFlaskInit(void);
-
-void
-SELinuxFlaskReset(void);
-
-
-/*
- * Private Flask definitions
- */
-
-/* Security class constants */
-#define SECCLASS_X_DRAWABLE 1
-#define SECCLASS_X_SCREEN 2
-#define SECCLASS_X_GC 3
-#define SECCLASS_X_FONT 4
-#define SECCLASS_X_COLORMAP 5
-#define SECCLASS_X_PROPERTY 6
-#define SECCLASS_X_SELECTION 7
-#define SECCLASS_X_CURSOR 8
-#define SECCLASS_X_CLIENT 9
-#define SECCLASS_X_POINTER 10
-#define SECCLASS_X_KEYBOARD 11
-#define SECCLASS_X_SERVER 12
-#define SECCLASS_X_EXTENSION 13
-#define SECCLASS_X_EVENT 14
-#define SECCLASS_X_FAKEEVENT 15
-#define SECCLASS_X_RESOURCE 16
-
-#ifdef _XSELINUX_NEED_FLASK_MAP
-/* Mapping from DixAccess bits to Flask permissions */
-static struct security_class_mapping map[] = {
- { "x_drawable",
- { "read", /* DixReadAccess */
- "write", /* DixWriteAccess */
- "destroy", /* DixDestroyAccess */
- "create", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "setattr", /* DixSetAttrAccess */
- "list_property", /* DixListPropAccess */
- "get_property", /* DixGetPropAccess */
- "set_property", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "list_child", /* DixListAccess */
- "add_child", /* DixAddAccess */
- "remove_child", /* DixRemoveAccess */
- "hide", /* DixHideAccess */
- "show", /* DixShowAccess */
- "blend", /* DixBlendAccess */
- "override", /* DixGrabAccess */
- "", /* DixFreezeAccess */
- "", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "send", /* DixSendAccess */
- "receive", /* DixReceiveAccess */
- "", /* DixUseAccess */
- "manage", /* DixManageAccess */
- NULL }},
- { "x_screen",
- { "", /* DixReadAccess */
- "", /* DixWriteAccess */
- "", /* DixDestroyAccess */
- "", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "setattr", /* DixSetAttrAccess */
- "saver_getattr", /* DixListPropAccess */
- "saver_setattr", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "", /* DixAddAccess */
- "", /* DixRemoveAccess */
- "hide_cursor", /* DixHideAccess */
- "show_cursor", /* DixShowAccess */
- "saver_hide", /* DixBlendAccess */
- "saver_show", /* DixGrabAccess */
- NULL }},
- { "x_gc",
- { "", /* DixReadAccess */
- "", /* DixWriteAccess */
- "destroy", /* DixDestroyAccess */
- "create", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "setattr", /* DixSetAttrAccess */
- "", /* DixListPropAccess */
- "", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "", /* DixAddAccess */
- "", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "", /* DixGrabAccess */
- "", /* DixFreezeAccess */
- "", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "", /* DixSendAccess */
- "", /* DixReceiveAccess */
- "use", /* DixUseAccess */
- NULL }},
- { "x_font",
- { "", /* DixReadAccess */
- "", /* DixWriteAccess */
- "destroy", /* DixDestroyAccess */
- "create", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "", /* DixSetAttrAccess */
- "", /* DixListPropAccess */
- "", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "add_glyph", /* DixAddAccess */
- "remove_glyph", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "", /* DixGrabAccess */
- "", /* DixFreezeAccess */
- "", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "", /* DixSendAccess */
- "", /* DixReceiveAccess */
- "use", /* DixUseAccess */
- NULL }},
- { "x_colormap",
- { "read", /* DixReadAccess */
- "write", /* DixWriteAccess */
- "destroy", /* DixDestroyAccess */
- "create", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "", /* DixSetAttrAccess */
- "", /* DixListPropAccess */
- "", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "add_color", /* DixAddAccess */
- "remove_color", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "", /* DixGrabAccess */
- "", /* DixFreezeAccess */
- "", /* DixForceAccess */
- "install", /* DixInstallAccess */
- "uninstall", /* DixUninstallAccess */
- "", /* DixSendAccess */
- "", /* DixReceiveAccess */
- "use", /* DixUseAccess */
- NULL }},
- { "x_property",
- { "read", /* DixReadAccess */
- "write", /* DixWriteAccess */
- "destroy", /* DixDestroyAccess */
- "create", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "setattr", /* DixSetAttrAccess */
- "", /* DixListPropAccess */
- "", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "", /* DixAddAccess */
- "", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "write", /* DixBlendAccess */
- NULL }},
- { "x_selection",
- { "read", /* DixReadAccess */
- "", /* DixWriteAccess */
- "", /* DixDestroyAccess */
- "setattr", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "setattr", /* DixSetAttrAccess */
- NULL }},
- { "x_cursor",
- { "read", /* DixReadAccess */
- "write", /* DixWriteAccess */
- "destroy", /* DixDestroyAccess */
- "create", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "setattr", /* DixSetAttrAccess */
- "", /* DixListPropAccess */
- "", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "", /* DixAddAccess */
- "", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "", /* DixGrabAccess */
- "", /* DixFreezeAccess */
- "", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "", /* DixSendAccess */
- "", /* DixReceiveAccess */
- "use", /* DixUseAccess */
- NULL }},
- { "x_client",
- { "", /* DixReadAccess */
- "", /* DixWriteAccess */
- "destroy", /* DixDestroyAccess */
- "", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "setattr", /* DixSetAttrAccess */
- "", /* DixListPropAccess */
- "", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "", /* DixAddAccess */
- "", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "", /* DixGrabAccess */
- "", /* DixFreezeAccess */
- "", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "", /* DixSendAccess */
- "", /* DixReceiveAccess */
- "", /* DixUseAccess */
- "manage", /* DixManageAccess */
- NULL }},
- { "x_pointer",
- { "read", /* DixReadAccess */
- "write", /* DixWriteAccess */
- "destroy", /* DixDestroyAccess */
- "create", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "setattr", /* DixSetAttrAccess */
- "list_property", /* DixListPropAccess */
- "get_property", /* DixGetPropAccess */
- "set_property", /* DixSetPropAccess */
- "getfocus", /* DixGetFocusAccess */
- "setfocus", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "add", /* DixAddAccess */
- "remove", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "grab", /* DixGrabAccess */
- "freeze", /* DixFreezeAccess */
- "force_cursor", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "", /* DixSendAccess */
- "", /* DixReceiveAccess */
- "use", /* DixUseAccess */
- "manage", /* DixManageAccess */
- "", /* DixDebugAccess */
- "bell", /* DixBellAccess */
- NULL }},
- { "x_keyboard",
- { "read", /* DixReadAccess */
- "write", /* DixWriteAccess */
- "destroy", /* DixDestroyAccess */
- "create", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "setattr", /* DixSetAttrAccess */
- "list_property", /* DixListPropAccess */
- "get_property", /* DixGetPropAccess */
- "set_property", /* DixSetPropAccess */
- "getfocus", /* DixGetFocusAccess */
- "setfocus", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "add", /* DixAddAccess */
- "remove", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "grab", /* DixGrabAccess */
- "freeze", /* DixFreezeAccess */
- "force_cursor", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "", /* DixSendAccess */
- "", /* DixReceiveAccess */
- "use", /* DixUseAccess */
- "manage", /* DixManageAccess */
- "", /* DixDebugAccess */
- "bell", /* DixBellAccess */
- NULL }},
- { "x_server",
- { "record", /* DixReadAccess */
- "", /* DixWriteAccess */
- "", /* DixDestroyAccess */
- "", /* DixCreateAccess */
- "getattr", /* DixGetAttrAccess */
- "setattr", /* DixSetAttrAccess */
- "", /* DixListPropAccess */
- "", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "", /* DixAddAccess */
- "", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "grab", /* DixGrabAccess */
- "", /* DixFreezeAccess */
- "", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "", /* DixSendAccess */
- "", /* DixReceiveAccess */
- "", /* DixUseAccess */
- "manage", /* DixManageAccess */
- "debug", /* DixDebugAccess */
- NULL }},
- { "x_extension",
- { "", /* DixReadAccess */
- "", /* DixWriteAccess */
- "", /* DixDestroyAccess */
- "", /* DixCreateAccess */
- "query", /* DixGetAttrAccess */
- "", /* DixSetAttrAccess */
- "", /* DixListPropAccess */
- "", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "", /* DixAddAccess */
- "", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "", /* DixGrabAccess */
- "", /* DixFreezeAccess */
- "", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "", /* DixSendAccess */
- "", /* DixReceiveAccess */
- "use", /* DixUseAccess */
- NULL }},
- { "x_event",
- { "", /* DixReadAccess */
- "", /* DixWriteAccess */
- "", /* DixDestroyAccess */
- "", /* DixCreateAccess */
- "", /* DixGetAttrAccess */
- "", /* DixSetAttrAccess */
- "", /* DixListPropAccess */
- "", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "", /* DixAddAccess */
- "", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "", /* DixGrabAccess */
- "", /* DixFreezeAccess */
- "", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "send", /* DixSendAccess */
- "receive", /* DixReceiveAccess */
- NULL }},
- { "x_synthetic_event",
- { "", /* DixReadAccess */
- "", /* DixWriteAccess */
- "", /* DixDestroyAccess */
- "", /* DixCreateAccess */
- "", /* DixGetAttrAccess */
- "", /* DixSetAttrAccess */
- "", /* DixListPropAccess */
- "", /* DixGetPropAccess */
- "", /* DixSetPropAccess */
- "", /* DixGetFocusAccess */
- "", /* DixSetFocusAccess */
- "", /* DixListAccess */
- "", /* DixAddAccess */
- "", /* DixRemoveAccess */
- "", /* DixHideAccess */
- "", /* DixShowAccess */
- "", /* DixBlendAccess */
- "", /* DixGrabAccess */
- "", /* DixFreezeAccess */
- "", /* DixForceAccess */
- "", /* DixInstallAccess */
- "", /* DixUninstallAccess */
- "send", /* DixSendAccess */
- "receive", /* DixReceiveAccess */
- NULL }},
- { "x_resource",
- { "read", /* DixReadAccess */
- "write", /* DixWriteAccess */
- "write", /* DixDestroyAccess */
- "write", /* DixCreateAccess */
- "read", /* DixGetAttrAccess */
- "write", /* DixSetAttrAccess */
- "read", /* DixListPropAccess */
- "read", /* DixGetPropAccess */
- "write", /* DixSetPropAccess */
- "read", /* DixGetFocusAccess */
- "write", /* DixSetFocusAccess */
- "read", /* DixListAccess */
- "write", /* DixAddAccess */
- "write", /* DixRemoveAccess */
- "write", /* DixHideAccess */
- "read", /* DixShowAccess */
- "read", /* DixBlendAccess */
- "write", /* DixGrabAccess */
- "write", /* DixFreezeAccess */
- "write", /* DixForceAccess */
- "write", /* DixInstallAccess */
- "write", /* DixUninstallAccess */
- "write", /* DixSendAccess */
- "read", /* DixReceiveAccess */
- "read", /* DixUseAccess */
- "write", /* DixManageAccess */
- "read", /* DixDebugAccess */
- "write", /* DixBellAccess */
- NULL }},
- { NULL }
-};
-
-/* x_resource "read" bits from the list above */
-#define SELinuxReadMask (DixReadAccess|DixGetAttrAccess|DixListPropAccess| \
- DixGetPropAccess|DixGetFocusAccess|DixListAccess| \
- DixShowAccess|DixBlendAccess|DixReceiveAccess| \
- DixUseAccess|DixDebugAccess)
-
-#endif /* _XSELINUX_NEED_FLASK_MAP */
-#endif /* _XSELINUXINT_H */
+/************************************************************
+
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+this permission notice appear in supporting documentation. This permission
+notice shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+********************************************************/
+
+#ifndef _XSELINUXINT_H
+#define _XSELINUXINT_H
+
+#include <selinux/selinux.h>
+#include <selinux/avc.h>
+
+#include "globals.h"
+#include "dixaccess.h"
+#include "dixstruct.h"
+#include "privates.h"
+#include "resource.h"
+#include "registry.h"
+#include "inputstr.h"
+#include "xselinux.h"
+
+/*
+ * Types
+ */
+
+#define COMMAND_LEN 64
+
+/* subject state (clients and devices only) */
+typedef struct {
+ security_id_t sid;
+ security_id_t dev_create_sid;
+ security_id_t win_create_sid;
+ security_id_t sel_create_sid;
+ security_id_t prp_create_sid;
+ security_id_t sel_use_sid;
+ security_id_t prp_use_sid;
+ struct avc_entry_ref aeref;
+ char command[COMMAND_LEN];
+ int privileged;
+} SELinuxSubjectRec;
+
+/* object state */
+typedef struct {
+ security_id_t sid;
+ int poly;
+} SELinuxObjectRec;
+
+/*
+ * Globals
+ */
+
+extern DevPrivateKeyRec subjectKeyRec;
+
+#define subjectKey (&subjectKeyRec)
+extern DevPrivateKeyRec objectKeyRec;
+
+#define objectKey (&objectKeyRec)
+extern DevPrivateKeyRec dataKeyRec;
+
+#define dataKey (&dataKeyRec)
+
+/*
+ * Label functions
+ */
+
+int
+ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn);
+
+int
+
+SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec * subj,
+ security_id_t * sid_rtn, int *poly_rtn);
+
+int
+
+SELinuxPropertyToSID(Atom property, SELinuxSubjectRec * subj,
+ security_id_t * sid_rtn, int *poly_rtn);
+
+int
+
+SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
+ SELinuxObjectRec * sid_return);
+
+int
+ SELinuxExtensionToSID(const char *name, security_id_t * sid_rtn);
+
+security_class_t SELinuxTypeToClass(RESTYPE type);
+
+security_context_t SELinuxDefaultClientLabel(void);
+
+void
+ SELinuxLabelInit(void);
+
+void
+ SELinuxLabelReset(void);
+
+/*
+ * Security module functions
+ */
+
+void
+ SELinuxFlaskInit(void);
+
+void
+ SELinuxFlaskReset(void);
+
+/*
+ * Private Flask definitions
+ */
+
+/* Security class constants */
+#define SECCLASS_X_DRAWABLE 1
+#define SECCLASS_X_SCREEN 2
+#define SECCLASS_X_GC 3
+#define SECCLASS_X_FONT 4
+#define SECCLASS_X_COLORMAP 5
+#define SECCLASS_X_PROPERTY 6
+#define SECCLASS_X_SELECTION 7
+#define SECCLASS_X_CURSOR 8
+#define SECCLASS_X_CLIENT 9
+#define SECCLASS_X_POINTER 10
+#define SECCLASS_X_KEYBOARD 11
+#define SECCLASS_X_SERVER 12
+#define SECCLASS_X_EXTENSION 13
+#define SECCLASS_X_EVENT 14
+#define SECCLASS_X_FAKEEVENT 15
+#define SECCLASS_X_RESOURCE 16
+
+#ifdef _XSELINUX_NEED_FLASK_MAP
+/* Mapping from DixAccess bits to Flask permissions */
+static struct security_class_mapping map[] = {
+ {"x_drawable",
+ {"read", /* DixReadAccess */
+ "write", /* DixWriteAccess */
+ "destroy", /* DixDestroyAccess */
+ "create", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "setattr", /* DixSetAttrAccess */
+ "list_property", /* DixListPropAccess */
+ "get_property", /* DixGetPropAccess */
+ "set_property", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "list_child", /* DixListAccess */
+ "add_child", /* DixAddAccess */
+ "remove_child", /* DixRemoveAccess */
+ "hide", /* DixHideAccess */
+ "show", /* DixShowAccess */
+ "blend", /* DixBlendAccess */
+ "override", /* DixGrabAccess */
+ "", /* DixFreezeAccess */
+ "", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "send", /* DixSendAccess */
+ "receive", /* DixReceiveAccess */
+ "", /* DixUseAccess */
+ "manage", /* DixManageAccess */
+ NULL}},
+ {"x_screen",
+ {"", /* DixReadAccess */
+ "", /* DixWriteAccess */
+ "", /* DixDestroyAccess */
+ "", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "setattr", /* DixSetAttrAccess */
+ "saver_getattr", /* DixListPropAccess */
+ "saver_setattr", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "", /* DixAddAccess */
+ "", /* DixRemoveAccess */
+ "hide_cursor", /* DixHideAccess */
+ "show_cursor", /* DixShowAccess */
+ "saver_hide", /* DixBlendAccess */
+ "saver_show", /* DixGrabAccess */
+ NULL}},
+ {"x_gc",
+ {"", /* DixReadAccess */
+ "", /* DixWriteAccess */
+ "destroy", /* DixDestroyAccess */
+ "create", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "setattr", /* DixSetAttrAccess */
+ "", /* DixListPropAccess */
+ "", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "", /* DixAddAccess */
+ "", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "", /* DixGrabAccess */
+ "", /* DixFreezeAccess */
+ "", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "", /* DixSendAccess */
+ "", /* DixReceiveAccess */
+ "use", /* DixUseAccess */
+ NULL}},
+ {"x_font",
+ {"", /* DixReadAccess */
+ "", /* DixWriteAccess */
+ "destroy", /* DixDestroyAccess */
+ "create", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "", /* DixSetAttrAccess */
+ "", /* DixListPropAccess */
+ "", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "add_glyph", /* DixAddAccess */
+ "remove_glyph", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "", /* DixGrabAccess */
+ "", /* DixFreezeAccess */
+ "", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "", /* DixSendAccess */
+ "", /* DixReceiveAccess */
+ "use", /* DixUseAccess */
+ NULL}},
+ {"x_colormap",
+ {"read", /* DixReadAccess */
+ "write", /* DixWriteAccess */
+ "destroy", /* DixDestroyAccess */
+ "create", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "", /* DixSetAttrAccess */
+ "", /* DixListPropAccess */
+ "", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "add_color", /* DixAddAccess */
+ "remove_color", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "", /* DixGrabAccess */
+ "", /* DixFreezeAccess */
+ "", /* DixForceAccess */
+ "install", /* DixInstallAccess */
+ "uninstall", /* DixUninstallAccess */
+ "", /* DixSendAccess */
+ "", /* DixReceiveAccess */
+ "use", /* DixUseAccess */
+ NULL}},
+ {"x_property",
+ {"read", /* DixReadAccess */
+ "write", /* DixWriteAccess */
+ "destroy", /* DixDestroyAccess */
+ "create", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "setattr", /* DixSetAttrAccess */
+ "", /* DixListPropAccess */
+ "", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "", /* DixAddAccess */
+ "", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "write", /* DixBlendAccess */
+ NULL}},
+ {"x_selection",
+ {"read", /* DixReadAccess */
+ "", /* DixWriteAccess */
+ "", /* DixDestroyAccess */
+ "setattr", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "setattr", /* DixSetAttrAccess */
+ NULL}},
+ {"x_cursor",
+ {"read", /* DixReadAccess */
+ "write", /* DixWriteAccess */
+ "destroy", /* DixDestroyAccess */
+ "create", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "setattr", /* DixSetAttrAccess */
+ "", /* DixListPropAccess */
+ "", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "", /* DixAddAccess */
+ "", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "", /* DixGrabAccess */
+ "", /* DixFreezeAccess */
+ "", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "", /* DixSendAccess */
+ "", /* DixReceiveAccess */
+ "use", /* DixUseAccess */
+ NULL}},
+ {"x_client",
+ {"", /* DixReadAccess */
+ "", /* DixWriteAccess */
+ "destroy", /* DixDestroyAccess */
+ "", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "setattr", /* DixSetAttrAccess */
+ "", /* DixListPropAccess */
+ "", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "", /* DixAddAccess */
+ "", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "", /* DixGrabAccess */
+ "", /* DixFreezeAccess */
+ "", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "", /* DixSendAccess */
+ "", /* DixReceiveAccess */
+ "", /* DixUseAccess */
+ "manage", /* DixManageAccess */
+ NULL}},
+ {"x_pointer",
+ {"read", /* DixReadAccess */
+ "write", /* DixWriteAccess */
+ "destroy", /* DixDestroyAccess */
+ "create", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "setattr", /* DixSetAttrAccess */
+ "list_property", /* DixListPropAccess */
+ "get_property", /* DixGetPropAccess */
+ "set_property", /* DixSetPropAccess */
+ "getfocus", /* DixGetFocusAccess */
+ "setfocus", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "add", /* DixAddAccess */
+ "remove", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "grab", /* DixGrabAccess */
+ "freeze", /* DixFreezeAccess */
+ "force_cursor", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "", /* DixSendAccess */
+ "", /* DixReceiveAccess */
+ "use", /* DixUseAccess */
+ "manage", /* DixManageAccess */
+ "", /* DixDebugAccess */
+ "bell", /* DixBellAccess */
+ NULL}},
+ {"x_keyboard",
+ {"read", /* DixReadAccess */
+ "write", /* DixWriteAccess */
+ "destroy", /* DixDestroyAccess */
+ "create", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "setattr", /* DixSetAttrAccess */
+ "list_property", /* DixListPropAccess */
+ "get_property", /* DixGetPropAccess */
+ "set_property", /* DixSetPropAccess */
+ "getfocus", /* DixGetFocusAccess */
+ "setfocus", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "add", /* DixAddAccess */
+ "remove", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "grab", /* DixGrabAccess */
+ "freeze", /* DixFreezeAccess */
+ "force_cursor", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "", /* DixSendAccess */
+ "", /* DixReceiveAccess */
+ "use", /* DixUseAccess */
+ "manage", /* DixManageAccess */
+ "", /* DixDebugAccess */
+ "bell", /* DixBellAccess */
+ NULL}},
+ {"x_server",
+ {"record", /* DixReadAccess */
+ "", /* DixWriteAccess */
+ "", /* DixDestroyAccess */
+ "", /* DixCreateAccess */
+ "getattr", /* DixGetAttrAccess */
+ "setattr", /* DixSetAttrAccess */
+ "", /* DixListPropAccess */
+ "", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "", /* DixAddAccess */
+ "", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "grab", /* DixGrabAccess */
+ "", /* DixFreezeAccess */
+ "", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "", /* DixSendAccess */
+ "", /* DixReceiveAccess */
+ "", /* DixUseAccess */
+ "manage", /* DixManageAccess */
+ "debug", /* DixDebugAccess */
+ NULL}},
+ {"x_extension",
+ {"", /* DixReadAccess */
+ "", /* DixWriteAccess */
+ "", /* DixDestroyAccess */
+ "", /* DixCreateAccess */
+ "query", /* DixGetAttrAccess */
+ "", /* DixSetAttrAccess */
+ "", /* DixListPropAccess */
+ "", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "", /* DixAddAccess */
+ "", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "", /* DixGrabAccess */
+ "", /* DixFreezeAccess */
+ "", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "", /* DixSendAccess */
+ "", /* DixReceiveAccess */
+ "use", /* DixUseAccess */
+ NULL}},
+ {"x_event",
+ {"", /* DixReadAccess */
+ "", /* DixWriteAccess */
+ "", /* DixDestroyAccess */
+ "", /* DixCreateAccess */
+ "", /* DixGetAttrAccess */
+ "", /* DixSetAttrAccess */
+ "", /* DixListPropAccess */
+ "", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "", /* DixAddAccess */
+ "", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "", /* DixGrabAccess */
+ "", /* DixFreezeAccess */
+ "", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "send", /* DixSendAccess */
+ "receive", /* DixReceiveAccess */
+ NULL}},
+ {"x_synthetic_event",
+ {"", /* DixReadAccess */
+ "", /* DixWriteAccess */
+ "", /* DixDestroyAccess */
+ "", /* DixCreateAccess */
+ "", /* DixGetAttrAccess */
+ "", /* DixSetAttrAccess */
+ "", /* DixListPropAccess */
+ "", /* DixGetPropAccess */
+ "", /* DixSetPropAccess */
+ "", /* DixGetFocusAccess */
+ "", /* DixSetFocusAccess */
+ "", /* DixListAccess */
+ "", /* DixAddAccess */
+ "", /* DixRemoveAccess */
+ "", /* DixHideAccess */
+ "", /* DixShowAccess */
+ "", /* DixBlendAccess */
+ "", /* DixGrabAccess */
+ "", /* DixFreezeAccess */
+ "", /* DixForceAccess */
+ "", /* DixInstallAccess */
+ "", /* DixUninstallAccess */
+ "send", /* DixSendAccess */
+ "receive", /* DixReceiveAccess */
+ NULL}},
+ {"x_resource",
+ {"read", /* DixReadAccess */
+ "write", /* DixWriteAccess */
+ "write", /* DixDestroyAccess */
+ "write", /* DixCreateAccess */
+ "read", /* DixGetAttrAccess */
+ "write", /* DixSetAttrAccess */
+ "read", /* DixListPropAccess */
+ "read", /* DixGetPropAccess */
+ "write", /* DixSetPropAccess */
+ "read", /* DixGetFocusAccess */
+ "write", /* DixSetFocusAccess */
+ "read", /* DixListAccess */
+ "write", /* DixAddAccess */
+ "write", /* DixRemoveAccess */
+ "write", /* DixHideAccess */
+ "read", /* DixShowAccess */
+ "read", /* DixBlendAccess */
+ "write", /* DixGrabAccess */
+ "write", /* DixFreezeAccess */
+ "write", /* DixForceAccess */
+ "write", /* DixInstallAccess */
+ "write", /* DixUninstallAccess */
+ "write", /* DixSendAccess */
+ "read", /* DixReceiveAccess */
+ "read", /* DixUseAccess */
+ "write", /* DixManageAccess */
+ "read", /* DixDebugAccess */
+ "write", /* DixBellAccess */
+ NULL}},
+ {NULL}
+};
+
+/* x_resource "read" bits from the list above */
+#define SELinuxReadMask (DixReadAccess|DixGetAttrAccess|DixListPropAccess| \
+ DixGetPropAccess|DixGetFocusAccess|DixListAccess| \
+ DixShowAccess|DixBlendAccess|DixReceiveAccess| \
+ DixUseAccess|DixDebugAccess)
+
+#endif /* _XSELINUX_NEED_FLASK_MAP */
+#endif /* _XSELINUXINT_H */
diff --git a/xorg-server/Xext/xtest.c b/xorg-server/Xext/xtest.c
index bd8e1d3a7..e659b4154 100644
--- a/xorg-server/Xext/xtest.c
+++ b/xorg-server/Xext/xtest.c
@@ -62,7 +62,7 @@ extern int DeviceValuator;
/* XTest events are sent during request processing and may be interruped by
* a SIGIO. We need a separate event list to avoid events overwriting each
* other's memory */
-static InternalEvent* xtest_evlist;
+static InternalEvent *xtest_evlist;
/**
* xtestpointer
@@ -81,11 +81,9 @@ DeviceIntPtr xtestpointer, xtestkeyboard;
#include "panoramiXsrv.h"
#endif
-static int XTestSwapFakeInput(
- ClientPtr /* client */,
- xReq * /* req */
- );
-
+static int XTestSwapFakeInput(ClientPtr /* client */ ,
+ xReq * /* req */
+ );
static int
ProcXTestGetVersion(ClientPtr client)
@@ -102,7 +100,7 @@ ProcXTestGetVersion(ClientPtr client)
swaps(&rep.sequenceNumber);
swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xXTestGetVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXTestGetVersionReply), (char *) &rep);
return Success;
}
@@ -120,15 +118,18 @@ ProcXTestCompareCursor(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
+
+ if (!ptr)
+ return BadAccess;
+
if (stuff->cursor == None)
pCursor = NullCursor;
else if (stuff->cursor == XTestCurrentCursor)
pCursor = GetSpriteCursor(ptr);
else {
- rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
- client, DixReadAccess);
- if (rc != Success)
- {
+ rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor,
+ RT_CURSOR, client, DixReadAccess);
+ if (rc != Success) {
client->errorValue = stuff->cursor;
return rc;
}
@@ -140,7 +141,7 @@ ProcXTestCompareCursor(ClientPtr client)
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
- WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *) &rep);
return Success;
}
@@ -155,7 +156,7 @@ ProcXTestFakeInput(ClientPtr client)
Bool extension = FALSE;
deviceValuator *dv = NULL;
ValuatorMask mask;
- int valuators[MAX_VALUATORS] = {0};
+ int valuators[MAX_VALUATORS] = { 0 };
int numValuators = 0;
int firstValuator = 0;
int nevents = 0;
@@ -169,18 +170,16 @@ ProcXTestFakeInput(ClientPtr client)
return BadLength;
nev /= sizeof(xEvent);
UpdateCurrentTime();
- ev = (xEvent *)&((xReq *)stuff)[1];
+ ev = (xEvent *) &((xReq *) stuff)[1];
type = ev->u.u.type & 0177;
- if (type >= EXTENSION_EVENT_BASE)
- {
+ if (type >= EXTENSION_EVENT_BASE) {
extension = TRUE;
/* check device */
rc = dixLookupDevice(&dev, stuff->deviceid & 0177, client,
- DixWriteAccess);
- if (rc != Success)
- {
+ DixWriteAccess);
+ if (rc != Success) {
client->errorValue = stuff->deviceid & 0177;
return rc;
}
@@ -188,144 +187,141 @@ ProcXTestFakeInput(ClientPtr client)
/* check type */
type -= DeviceValuator;
switch (type) {
- case XI_DeviceKeyPress:
- case XI_DeviceKeyRelease:
- if (!dev->key)
- {
- client->errorValue = ev->u.u.type;
- return BadValue;
- }
- break;
- case XI_DeviceButtonPress:
- case XI_DeviceButtonRelease:
- if (!dev->button)
- {
- client->errorValue = ev->u.u.type;
- return BadValue;
- }
- break;
- case XI_DeviceMotionNotify:
- if (!dev->valuator)
- {
- client->errorValue = ev->u.u.type;
- return BadValue;
- }
- break;
- case XI_ProximityIn:
- case XI_ProximityOut:
- if (!dev->proximity)
- {
- client->errorValue = ev->u.u.type;
- return BadValue;
- }
- break;
- default:
+ case XI_DeviceKeyPress:
+ case XI_DeviceKeyRelease:
+ if (!dev->key) {
client->errorValue = ev->u.u.type;
return BadValue;
+ }
+ break;
+ case XI_DeviceButtonPress:
+ case XI_DeviceButtonRelease:
+ if (!dev->button) {
+ client->errorValue = ev->u.u.type;
+ return BadValue;
+ }
+ break;
+ case XI_DeviceMotionNotify:
+ if (!dev->valuator) {
+ client->errorValue = ev->u.u.type;
+ return BadValue;
+ }
+ break;
+ case XI_ProximityIn:
+ case XI_ProximityOut:
+ if (!dev->proximity) {
+ client->errorValue = ev->u.u.type;
+ return BadValue;
+ }
+ break;
+ default:
+ client->errorValue = ev->u.u.type;
+ return BadValue;
}
/* check validity */
if (nev == 1 && type == XI_DeviceMotionNotify)
- return BadLength; /* DevMotion must be followed by DevValuator */
+ return BadLength; /* DevMotion must be followed by DevValuator */
- if (type == XI_DeviceMotionNotify)
- {
- firstValuator = ((deviceValuator *)(ev+1))->first_valuator;
- if (firstValuator > dev->valuator->numAxes)
- {
+ if (type == XI_DeviceMotionNotify) {
+ firstValuator = ((deviceValuator *) (ev + 1))->first_valuator;
+ if (firstValuator > dev->valuator->numAxes) {
client->errorValue = ev->u.u.type;
return BadValue;
}
if (ev->u.u.detail == xFalse)
flags |= POINTER_ABSOLUTE;
- } else
- {
+ }
+ else {
firstValuator = 0;
flags |= POINTER_ABSOLUTE;
}
- if (nev > 1 && !dev->valuator)
- {
+ if (nev > 1 && !dev->valuator) {
client->errorValue = dv->first_valuator;
return BadValue;
}
-
/* check validity of valuator events */
base = firstValuator;
- for (n = 1; n < nev; n++)
- {
- dv = (deviceValuator *)(ev + n);
- if (dv->type != DeviceValuator)
- {
+ for (n = 1; n < nev; n++) {
+ dv = (deviceValuator *) (ev + n);
+ if (dv->type != DeviceValuator) {
client->errorValue = dv->type;
return BadValue;
}
- if (dv->first_valuator != base)
- {
+ if (dv->first_valuator != base) {
client->errorValue = dv->first_valuator;
return BadValue;
}
- switch(dv->num_valuators)
- {
- case 6: valuators[base + 5] = dv->valuator5;
- case 5: valuators[base + 4] = dv->valuator4;
- case 4: valuators[base + 3] = dv->valuator3;
- case 3: valuators[base + 2] = dv->valuator2;
- case 2: valuators[base + 1] = dv->valuator1;
- case 1: valuators[base] = dv->valuator0;
- break;
- default:
- client->errorValue = dv->num_valuators;
- return BadValue;
+ switch (dv->num_valuators) {
+ case 6:
+ valuators[base + 5] = dv->valuator5;
+ case 5:
+ valuators[base + 4] = dv->valuator4;
+ case 4:
+ valuators[base + 3] = dv->valuator3;
+ case 3:
+ valuators[base + 2] = dv->valuator2;
+ case 2:
+ valuators[base + 1] = dv->valuator1;
+ case 1:
+ valuators[base] = dv->valuator0;
+ break;
+ default:
+ client->errorValue = dv->num_valuators;
+ return BadValue;
}
base += dv->num_valuators;
numValuators += dv->num_valuators;
- if (firstValuator + numValuators > dev->valuator->numAxes)
- {
+ if (firstValuator + numValuators > dev->valuator->numAxes) {
client->errorValue = dv->num_valuators;
return BadValue;
}
}
type = type - XI_DeviceKeyPress + KeyPress;
- } else
- {
+ }
+ else {
if (nev != 1)
return BadLength;
- switch (type)
- {
- case KeyPress:
- case KeyRelease:
- dev = PickKeyboard(client);
- break;
- case ButtonPress:
- case ButtonRelease:
- dev = PickPointer(client);
- break;
- case MotionNotify:
- dev = PickPointer(client);
- valuators[0] = ev->u.keyButtonPointer.rootX;
- valuators[1] = ev->u.keyButtonPointer.rootY;
- numValuators = 2;
- firstValuator = 0;
- if (ev->u.u.detail == xFalse)
- flags = POINTER_ABSOLUTE | POINTER_SCREEN;
- break;
- default:
- client->errorValue = ev->u.u.type;
- return BadValue;
+ switch (type) {
+ case KeyPress:
+ case KeyRelease:
+ dev = PickKeyboard(client);
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ dev = PickPointer(client);
+ break;
+ case MotionNotify:
+ dev = PickPointer(client);
+ valuators[0] = ev->u.keyButtonPointer.rootX;
+ valuators[1] = ev->u.keyButtonPointer.rootY;
+ numValuators = 2;
+ firstValuator = 0;
+ if (ev->u.u.detail == xFalse)
+ flags = POINTER_ABSOLUTE | POINTER_SCREEN;
+ break;
+ default:
+ client->errorValue = ev->u.u.type;
+ return BadValue;
}
+ /* Technically the protocol doesn't allow for BadAccess here but
+ * this can only happen when all MDs are disabled. */
+ if (!dev)
+ return BadAccess;
+
dev = GetXTestDevice(dev);
}
+
/* If the event has a time set, wait for it to pass */
- if (ev->u.keyButtonPointer.time)
- {
+ if (ev->u.keyButtonPointer.time) {
TimeStamp activateTime;
CARD32 ms;
@@ -339,92 +335,85 @@ ProcXTestFakeInput(ClientPtr client)
/* see mbuf.c:QueueDisplayRequest (from the deprecated Multibuffer
* extension) for code similar to this */
- if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
- {
+ if (!ClientSleepUntil(client, &activateTime, NULL, NULL)) {
return BadAlloc;
}
/* swap the request back so we can simply re-execute it */
- if (client->swapped)
- {
- (void) XTestSwapFakeInput(client, (xReq *)stuff);
+ if (client->swapped) {
+ (void) XTestSwapFakeInput(client, (xReq *) stuff);
swaps(&stuff->length);
}
- ResetCurrentRequest (client);
+ ResetCurrentRequest(client);
client->sequence--;
return Success;
}
- switch (type)
- {
- case KeyPress:
- case KeyRelease:
- if (!dev->key)
- return BadDevice;
+ switch (type) {
+ case KeyPress:
+ case KeyRelease:
+ if (!dev->key)
+ return BadDevice;
- if (ev->u.u.detail < dev->key->xkbInfo->desc->min_key_code ||
- ev->u.u.detail > dev->key->xkbInfo->desc->max_key_code)
- {
- client->errorValue = ev->u.u.detail;
- return BadValue;
- }
+ if (ev->u.u.detail < dev->key->xkbInfo->desc->min_key_code ||
+ ev->u.u.detail > dev->key->xkbInfo->desc->max_key_code) {
+ client->errorValue = ev->u.u.detail;
+ return BadValue;
+ }
- need_ptr_update = 0;
- break;
- case MotionNotify:
- if (!dev->valuator)
- return BadDevice;
-
- if (!(extension || ev->u.keyButtonPointer.root == None))
- {
- rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root,
- client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
- if (root->parent)
- {
- client->errorValue = ev->u.keyButtonPointer.root;
- return BadValue;
- }
- }
- if (ev->u.u.detail != xTrue && ev->u.u.detail != xFalse)
- {
- client->errorValue = ev->u.u.detail;
+ need_ptr_update = 0;
+ break;
+ case MotionNotify:
+ if (!dev->valuator)
+ return BadDevice;
+
+ if (!(extension || ev->u.keyButtonPointer.root == None)) {
+ rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root,
+ client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+ if (root->parent) {
+ client->errorValue = ev->u.keyButtonPointer.root;
return BadValue;
}
+ }
+ if (ev->u.u.detail != xTrue && ev->u.u.detail != xFalse) {
+ client->errorValue = ev->u.u.detail;
+ return BadValue;
+ }
- /* FIXME: Xinerama! */
+ /* FIXME: Xinerama! */
- break;
- case ButtonPress:
- case ButtonRelease:
- if (!dev->button)
- return BadDevice;
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ if (!dev->button)
+ return BadDevice;
- if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
- {
- client->errorValue = ev->u.u.detail;
- return BadValue;
- }
- break;
+ if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons) {
+ client->errorValue = ev->u.u.detail;
+ return BadValue;
+ }
+ break;
}
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
- switch(type) {
- case MotionNotify:
- valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
- nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, &mask);
- break;
- case ButtonPress:
- case ButtonRelease:
- valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
- nevents = GetPointerEvents(xtest_evlist, dev, type, ev->u.u.detail,
- flags, &mask);
- break;
- case KeyPress:
- case KeyRelease:
- nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail, NULL);
- break;
+ switch (type) {
+ case MotionNotify:
+ valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
+ nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, &mask);
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
+ nevents = GetPointerEvents(xtest_evlist, dev, type, ev->u.u.detail,
+ flags, &mask);
+ break;
+ case KeyPress:
+ case KeyRelease:
+ nevents =
+ GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail, NULL);
+ break;
}
for (i = 0; i < nevents; i++)
@@ -441,8 +430,7 @@ ProcXTestGrabControl(ClientPtr client)
REQUEST(xXTestGrabControlReq);
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
- if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse))
- {
+ if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse)) {
client->errorValue = stuff->impervious;
return BadValue;
}
@@ -454,21 +442,20 @@ ProcXTestGrabControl(ClientPtr client)
}
static int
-ProcXTestDispatch (ClientPtr client)
+ProcXTestDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XTestGetVersion:
- return ProcXTestGetVersion(client);
- case X_XTestCompareCursor:
- return ProcXTestCompareCursor(client);
- case X_XTestFakeInput:
- return ProcXTestFakeInput(client);
- case X_XTestGrabControl:
- return ProcXTestGrabControl(client);
- default:
- return BadRequest;
+ switch (stuff->data) {
+ case X_XTestGetVersion:
+ return ProcXTestGetVersion(client);
+ case X_XTestCompareCursor:
+ return ProcXTestCompareCursor(client);
+ case X_XTestFakeInput:
+ return ProcXTestFakeInput(client);
+ case X_XTestGrabControl:
+ return ProcXTestGrabControl(client);
+ default:
+ return BadRequest;
}
}
@@ -496,7 +483,7 @@ SProcXTestCompareCursor(ClientPtr client)
}
static int
-XTestSwapFakeInput(ClientPtr client, xReq *req)
+XTestSwapFakeInput(ClientPtr client, xReq * req)
{
int nev;
xEvent *ev;
@@ -504,16 +491,15 @@ XTestSwapFakeInput(ClientPtr client, xReq *req)
EventSwapPtr proc;
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
- for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
- {
+ for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) {
/* Swap event */
proc = EventSwapVector[ev->u.u.type & 0177];
/* no swapping proc; invalid event type? */
- if (!proc || proc == NotImplemented) {
+ if (!proc || proc == NotImplemented) {
client->errorValue = ev->u.u.type;
return BadValue;
}
- (*proc)(ev, &sev);
+ (*proc) (ev, &sev);
*ev = sev;
}
return Success;
@@ -522,7 +508,8 @@ XTestSwapFakeInput(ClientPtr client, xReq *req)
static int
SProcXTestFakeInput(ClientPtr client)
{
- int n;
+ int n;
+
REQUEST(xReq);
swaps(&stuff->length);
@@ -543,21 +530,20 @@ SProcXTestGrabControl(ClientPtr client)
}
static int
-SProcXTestDispatch (ClientPtr client)
+SProcXTestDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XTestGetVersion:
- return SProcXTestGetVersion(client);
- case X_XTestCompareCursor:
- return SProcXTestCompareCursor(client);
- case X_XTestFakeInput:
- return SProcXTestFakeInput(client);
- case X_XTestGrabControl:
- return SProcXTestGrabControl(client);
- default:
- return BadRequest;
+ switch (stuff->data) {
+ case X_XTestGetVersion:
+ return SProcXTestGetVersion(client);
+ case X_XTestCompareCursor:
+ return SProcXTestCompareCursor(client);
+ case X_XTestFakeInput:
+ return SProcXTestFakeInput(client);
+ case X_XTestGrabControl:
+ return SProcXTestGrabControl(client);
+ default:
+ return BadRequest;
}
}
@@ -565,21 +551,22 @@ SProcXTestDispatch (ClientPtr client)
* Allocate an virtual slave device for xtest events, this
* is a slave device to inputInfo master devices
*/
-void InitXTestDevices(void)
+void
+InitXTestDevices(void)
{
- if(AllocXTestDevice(serverClient, "Virtual core",
- &xtestpointer, &xtestkeyboard,
- inputInfo.pointer, inputInfo.keyboard) != Success)
- FatalError("Failed to allocate XTest devices");
+ if (AllocXTestDevice(serverClient, "Virtual core",
+ &xtestpointer, &xtestkeyboard,
+ inputInfo.pointer, inputInfo.keyboard) != Success)
+ FatalError("Failed to allocate XTest devices");
if (ActivateDevice(xtestpointer, TRUE) != Success ||
ActivateDevice(xtestkeyboard, TRUE) != Success)
FatalError("Failed to activate XTest core devices.");
- if (!EnableDevice(xtestpointer, TRUE) ||
- !EnableDevice(xtestkeyboard, TRUE))
+ if (!EnableDevice(xtestpointer, TRUE) || !EnableDevice(xtestkeyboard, TRUE))
FatalError("Failed to enable XTest core devices.");
AttachDevice(NULL, xtestpointer, inputInfo.pointer);
+
AttachDevice(NULL, xtestkeyboard, inputInfo.keyboard);
}
@@ -588,7 +575,7 @@ void InitXTestDevices(void)
*/
static int
DeviceSetXTestProperty(DeviceIntPtr dev, Atom property,
- XIPropertyValuePtr prop, BOOL checkonly)
+ XIPropertyValuePtr prop, BOOL checkonly)
{
if (property == XIGetKnownProperty(XI_PROP_XTEST_DEVICE))
return BadAccess;
@@ -603,35 +590,42 @@ DeviceSetXTestProperty(DeviceIntPtr dev, Atom property,
* This only creates the pair, Activate/Enable Device
* still need to be called.
*/
-int AllocXTestDevice (ClientPtr client, const char* name,
- DeviceIntPtr* ptr, DeviceIntPtr* keybd,
- DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
+int
+AllocXTestDevice(ClientPtr client, const char *name,
+ DeviceIntPtr *ptr, DeviceIntPtr *keybd,
+ DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
{
int retval;
char *xtestname;
char dummy = 1;
if (asprintf(&xtestname, "%s XTEST", name) == -1)
- return BadAlloc;
+ return BadAlloc;
- retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
- if ( retval == Success ){
- (*ptr)->xtest_master_id = master_ptr->id;
- (*keybd)->xtest_master_id = master_keybd->id;
+ retval =
+ AllocDevicePair(client, xtestname, ptr, keybd, CorePointerProc,
+ CoreKeyboardProc, FALSE);
+ if (retval == Success) {
+ (*ptr)->xtest_master_id = master_ptr->id;
+ (*keybd)->xtest_master_id = master_keybd->id;
XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
- XA_INTEGER, 8, PropModeReplace, 1, &dummy,
- FALSE);
- XISetDevicePropertyDeletable(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE), FALSE);
+ XA_INTEGER, 8, PropModeReplace, 1, &dummy,
+ FALSE);
+ XISetDevicePropertyDeletable(*ptr,
+ XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
+ FALSE);
XIRegisterPropertyHandler(*ptr, DeviceSetXTestProperty, NULL, NULL);
XIChangeDeviceProperty(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
- XA_INTEGER, 8, PropModeReplace, 1, &dummy,
- FALSE);
- XISetDevicePropertyDeletable(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE), FALSE);
+ XA_INTEGER, 8, PropModeReplace, 1, &dummy,
+ FALSE);
+ XISetDevicePropertyDeletable(*keybd,
+ XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
+ FALSE);
XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
}
- free( xtestname );
+ free(xtestname);
return retval;
}
@@ -651,7 +645,7 @@ IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
/* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest
* device */
if (master)
- return dev->xtest_master_id == master->id;
+ return dev->xtest_master_id == master->id;
return dev->xtest_master_id != 0;
}
@@ -664,8 +658,7 @@ GetXTestDevice(DeviceIntPtr master)
{
DeviceIntPtr it;
- for (it = inputInfo.devices; it; it = it->next)
- {
+ for (it = inputInfo.devices; it; it = it->next) {
if (IsXTestDevice(it, master))
return it;
}
@@ -675,7 +668,7 @@ GetXTestDevice(DeviceIntPtr master)
}
static void
-XTestExtensionTearDown(ExtensionEntry *e)
+XTestExtensionTearDown(ExtensionEntry * e)
{
FreeEventList(xtest_evlist, GetMaximumEventsNum());
xtest_evlist = NULL;
@@ -685,8 +678,8 @@ void
XTestExtensionInit(INITARGS)
{
AddExtension(XTestExtensionName, 0, 0,
- ProcXTestDispatch, SProcXTestDispatch,
- XTestExtensionTearDown, StandardMinorOpcode);
+ ProcXTestDispatch, SProcXTestDispatch,
+ XTestExtensionTearDown, StandardMinorOpcode);
xtest_evlist = InitEventList(GetMaximumEventsNum());
}
diff --git a/xorg-server/Xext/xvdisp.c b/xorg-server/Xext/xvdisp.c
index 0795a1475..8abd51c11 100644
--- a/xorg-server/Xext/xvdisp.c
+++ b/xorg-server/Xext/xvdisp.c
@@ -55,215 +55,189 @@ unsigned long XvXRTPort;
#endif
static int
-SWriteQueryExtensionReply(
- ClientPtr client,
- xvQueryExtensionReply *rep
-){
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swaps(&rep->version);
- swaps(&rep->revision);
-
- (void)WriteToClient(client, sz_xvQueryExtensionReply, (char *)rep);
+SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->version);
+ swaps(&rep->revision);
+
+ (void) WriteToClient(client, sz_xvQueryExtensionReply, (char *) rep);
- return Success;
+ return Success;
}
static int
-SWriteQueryAdaptorsReply(
- ClientPtr client,
- xvQueryAdaptorsReply *rep
-){
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swaps(&rep->num_adaptors);
-
- (void)WriteToClient(client, sz_xvQueryAdaptorsReply, (char *)rep);
+SWriteQueryAdaptorsReply(ClientPtr client, xvQueryAdaptorsReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->num_adaptors);
+
+ (void) WriteToClient(client, sz_xvQueryAdaptorsReply, (char *) rep);
- return Success;
+ return Success;
}
static int
-SWriteQueryEncodingsReply(
- ClientPtr client,
- xvQueryEncodingsReply *rep
-){
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swaps(&rep->num_encodings);
-
- (void)WriteToClient(client, sz_xvQueryEncodingsReply, (char *)rep);
+SWriteQueryEncodingsReply(ClientPtr client, xvQueryEncodingsReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->num_encodings);
+
+ (void) WriteToClient(client, sz_xvQueryEncodingsReply, (char *) rep);
- return Success;
+ return Success;
}
static int
-SWriteAdaptorInfo(
- ClientPtr client,
- xvAdaptorInfo *pAdaptor
-){
- swapl(&pAdaptor->base_id);
- swaps(&pAdaptor->name_size);
- swaps(&pAdaptor->num_ports);
- swaps(&pAdaptor->num_formats);
+SWriteAdaptorInfo(ClientPtr client, xvAdaptorInfo * pAdaptor)
+{
+ swapl(&pAdaptor->base_id);
+ swaps(&pAdaptor->name_size);
+ swaps(&pAdaptor->num_ports);
+ swaps(&pAdaptor->num_formats);
- (void)WriteToClient(client, sz_xvAdaptorInfo, (char *)pAdaptor);
+ (void) WriteToClient(client, sz_xvAdaptorInfo, (char *) pAdaptor);
- return Success;
+ return Success;
}
static int
-SWriteEncodingInfo(
- ClientPtr client,
- xvEncodingInfo *pEncoding
-){
-
- swapl(&pEncoding->encoding);
- swaps(&pEncoding->name_size);
- swaps(&pEncoding->width);
- swaps(&pEncoding->height);
- swapl(&pEncoding->rate.numerator);
- swapl(&pEncoding->rate.denominator);
- (void)WriteToClient(client, sz_xvEncodingInfo, (char *)pEncoding);
-
- return Success;
+SWriteEncodingInfo(ClientPtr client, xvEncodingInfo * pEncoding)
+{
+
+ swapl(&pEncoding->encoding);
+ swaps(&pEncoding->name_size);
+ swaps(&pEncoding->width);
+ swaps(&pEncoding->height);
+ swapl(&pEncoding->rate.numerator);
+ swapl(&pEncoding->rate.denominator);
+ (void) WriteToClient(client, sz_xvEncodingInfo, (char *) pEncoding);
+
+ return Success;
}
static int
-SWriteFormat(
- ClientPtr client,
- xvFormat *pFormat
-){
- swapl(&pFormat->visual);
- (void)WriteToClient(client, sz_xvFormat, (char *)pFormat);
+SWriteFormat(ClientPtr client, xvFormat * pFormat)
+{
+ swapl(&pFormat->visual);
+ (void) WriteToClient(client, sz_xvFormat, (char *) pFormat);
- return Success;
+ return Success;
}
static int
-SWriteAttributeInfo(
- ClientPtr client,
- xvAttributeInfo *pAtt
-){
- swapl(&pAtt->flags);
- swapl(&pAtt->size);
- swapl(&pAtt->min);
- swapl(&pAtt->max);
- (void)WriteToClient(client, sz_xvAttributeInfo, (char *)pAtt);
+SWriteAttributeInfo(ClientPtr client, xvAttributeInfo * pAtt)
+{
+ swapl(&pAtt->flags);
+ swapl(&pAtt->size);
+ swapl(&pAtt->min);
+ swapl(&pAtt->max);
+ (void) WriteToClient(client, sz_xvAttributeInfo, (char *) pAtt);
- return Success;
+ return Success;
}
static int
-SWriteImageFormatInfo(
- ClientPtr client,
- xvImageFormatInfo *pImage
-){
- swapl(&pImage->id);
- swapl(&pImage->red_mask);
- swapl(&pImage->green_mask);
- swapl(&pImage->blue_mask);
- swapl(&pImage->y_sample_bits);
- swapl(&pImage->u_sample_bits);
- swapl(&pImage->v_sample_bits);
- swapl(&pImage->horz_y_period);
- swapl(&pImage->horz_u_period);
- swapl(&pImage->horz_v_period);
- swapl(&pImage->vert_y_period);
- swapl(&pImage->vert_u_period);
- swapl(&pImage->vert_v_period);
-
- (void)WriteToClient(client, sz_xvImageFormatInfo, (char *)pImage);
-
- return Success;
+SWriteImageFormatInfo(ClientPtr client, xvImageFormatInfo * pImage)
+{
+ swapl(&pImage->id);
+ swapl(&pImage->red_mask);
+ swapl(&pImage->green_mask);
+ swapl(&pImage->blue_mask);
+ swapl(&pImage->y_sample_bits);
+ swapl(&pImage->u_sample_bits);
+ swapl(&pImage->v_sample_bits);
+ swapl(&pImage->horz_y_period);
+ swapl(&pImage->horz_u_period);
+ swapl(&pImage->horz_v_period);
+ swapl(&pImage->vert_y_period);
+ swapl(&pImage->vert_u_period);
+ swapl(&pImage->vert_v_period);
+
+ (void) WriteToClient(client, sz_xvImageFormatInfo, (char *) pImage);
+
+ return Success;
}
static int
-SWriteGrabPortReply(
- ClientPtr client,
- xvGrabPortReply *rep
-){
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
+SWriteGrabPortReply(ClientPtr client, xvGrabPortReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
- (void)WriteToClient(client, sz_xvGrabPortReply, (char *)rep);
+ (void) WriteToClient(client, sz_xvGrabPortReply, (char *) rep);
- return Success;
+ return Success;
}
static int
-SWriteGetPortAttributeReply(
- ClientPtr client,
- xvGetPortAttributeReply *rep
-){
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swapl(&rep->value);
+SWriteGetPortAttributeReply(ClientPtr client, xvGetPortAttributeReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->value);
- (void)WriteToClient(client, sz_xvGetPortAttributeReply, (char *)rep);
+ (void) WriteToClient(client, sz_xvGetPortAttributeReply, (char *) rep);
- return Success;
+ return Success;
}
static int
-SWriteQueryBestSizeReply(
- ClientPtr client,
- xvQueryBestSizeReply *rep
-){
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swaps(&rep->actual_width);
- swaps(&rep->actual_height);
+SWriteQueryBestSizeReply(ClientPtr client, xvQueryBestSizeReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->actual_width);
+ swaps(&rep->actual_height);
- (void)WriteToClient(client, sz_xvQueryBestSizeReply, (char *)rep);
+ (void) WriteToClient(client, sz_xvQueryBestSizeReply, (char *) rep);
- return Success;
+ return Success;
}
static int
-SWriteQueryPortAttributesReply(
- ClientPtr client,
- xvQueryPortAttributesReply *rep
-){
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swapl(&rep->num_attributes);
- swapl(&rep->text_size);
+SWriteQueryPortAttributesReply(ClientPtr client,
+ xvQueryPortAttributesReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->num_attributes);
+ swapl(&rep->text_size);
- (void)WriteToClient(client, sz_xvQueryPortAttributesReply, (char *)rep);
+ (void) WriteToClient(client, sz_xvQueryPortAttributesReply, (char *) rep);
- return Success;
+ return Success;
}
static int
-SWriteQueryImageAttributesReply(
- ClientPtr client,
- xvQueryImageAttributesReply *rep
-){
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swapl(&rep->num_planes);
- swapl(&rep->data_size);
- swaps(&rep->width);
- swaps(&rep->height);
+SWriteQueryImageAttributesReply(ClientPtr client,
+ xvQueryImageAttributesReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->num_planes);
+ swapl(&rep->data_size);
+ swaps(&rep->width);
+ swaps(&rep->height);
- (void)WriteToClient(client, sz_xvQueryImageAttributesReply, (char *)rep);
+ (void) WriteToClient(client, sz_xvQueryImageAttributesReply, (char *) rep);
- return Success;
+ return Success;
}
static int
-SWriteListImageFormatsReply(
- ClientPtr client,
- xvListImageFormatsReply *rep
-){
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swapl(&rep->num_formats);
+SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->num_formats);
- (void)WriteToClient(client, sz_xvListImageFormatsReply, (char *)rep);
+ (void) WriteToClient(client, sz_xvListImageFormatsReply, (char *) rep);
- return Success;
+ return Success;
}
#define _WriteQueryAdaptorsReply(_c,_d) \
@@ -328,662 +302,638 @@ SWriteListImageFormatsReply(
static int
ProcXvQueryExtension(ClientPtr client)
{
- xvQueryExtensionReply rep;
- /* REQUEST(xvQueryExtensionReq); */
- REQUEST_SIZE_MATCH(xvQueryExtensionReq);
+ xvQueryExtensionReply rep;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.version = XvVersion;
- rep.revision = XvRevision;
+ /* REQUEST(xvQueryExtensionReq); */
+ REQUEST_SIZE_MATCH(xvQueryExtensionReq);
- _WriteQueryExtensionReply(client, &rep);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.version = XvVersion;
+ rep.revision = XvRevision;
- return Success;
+ _WriteQueryExtensionReply(client, &rep);
+
+ return Success;
}
static int
ProcXvQueryAdaptors(ClientPtr client)
{
- xvFormat format;
- xvAdaptorInfo ainfo;
- xvQueryAdaptorsReply rep;
- int totalSize, na, nf, rc;
- int nameSize;
- XvAdaptorPtr pa;
- XvFormatPtr pf;
- WindowPtr pWin;
- ScreenPtr pScreen;
- XvScreenPtr pxvs;
-
- REQUEST(xvQueryAdaptorsReq);
- REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
-
- rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
-
- pScreen = pWin->drawable.pScreen;
- pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- XvGetScreenKey());
- if (!pxvs)
- {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_adaptors = 0;
- rep.length = 0;
-
- _WriteQueryAdaptorsReply(client, &rep);
-
- return Success;
+ xvFormat format;
+ xvAdaptorInfo ainfo;
+ xvQueryAdaptorsReply rep;
+ int totalSize, na, nf, rc;
+ int nameSize;
+ XvAdaptorPtr pa;
+ XvFormatPtr pf;
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ XvScreenPtr pxvs;
+
+ REQUEST(xvQueryAdaptorsReq);
+ REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
+
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ pScreen = pWin->drawable.pScreen;
+ pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ XvGetScreenKey());
+ if (!pxvs) {
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.num_adaptors = 0;
+ rep.length = 0;
+
+ _WriteQueryAdaptorsReply(client, &rep);
+
+ return Success;
}
- (* pxvs->ddQueryAdaptors)(pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors);
+ (*pxvs->ddQueryAdaptors) (pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_adaptors = pxvs->nAdaptors;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.num_adaptors = pxvs->nAdaptors;
- /* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
+ /* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
- totalSize = pxvs->nAdaptors * sz_xvAdaptorInfo;
+ totalSize = pxvs->nAdaptors * sz_xvAdaptorInfo;
- /* FOR EACH ADPATOR ADD UP THE BYTES FOR ENCODINGS AND FORMATS */
+ /* FOR EACH ADPATOR ADD UP THE BYTES FOR ENCODINGS AND FORMATS */
- na = pxvs->nAdaptors;
- pa = pxvs->pAdaptors;
- while (na--)
- {
- totalSize += pad_to_int32(strlen(pa->name));
- totalSize += pa->nFormats * sz_xvFormat;
- pa++;
+ na = pxvs->nAdaptors;
+ pa = pxvs->pAdaptors;
+ while (na--) {
+ totalSize += pad_to_int32(strlen(pa->name));
+ totalSize += pa->nFormats * sz_xvFormat;
+ pa++;
}
- rep.length = bytes_to_int32(totalSize);
+ rep.length = bytes_to_int32(totalSize);
- _WriteQueryAdaptorsReply(client, &rep);
+ _WriteQueryAdaptorsReply(client, &rep);
- na = pxvs->nAdaptors;
- pa = pxvs->pAdaptors;
- while (na--)
- {
+ na = pxvs->nAdaptors;
+ pa = pxvs->pAdaptors;
+ while (na--) {
- ainfo.base_id = pa->base_id;
- ainfo.num_ports = pa->nPorts;
- ainfo.type = pa->type;
- ainfo.name_size = nameSize = strlen(pa->name);
- ainfo.num_formats = pa->nFormats;
+ ainfo.base_id = pa->base_id;
+ ainfo.num_ports = pa->nPorts;
+ ainfo.type = pa->type;
+ ainfo.name_size = nameSize = strlen(pa->name);
+ ainfo.num_formats = pa->nFormats;
- _WriteAdaptorInfo(client, &ainfo);
+ _WriteAdaptorInfo(client, &ainfo);
- WriteToClient(client, nameSize, pa->name);
+ WriteToClient(client, nameSize, pa->name);
- nf = pa->nFormats;
- pf = pa->pFormats;
- while (nf--)
- {
- format.depth = pf->depth;
- format.visual = pf->visual;
- _WriteFormat(client, &format);
- pf++;
- }
+ nf = pa->nFormats;
+ pf = pa->pFormats;
+ while (nf--) {
+ format.depth = pf->depth;
+ format.visual = pf->visual;
+ _WriteFormat(client, &format);
+ pf++;
+ }
- pa++;
+ pa++;
}
- return Success;
+ return Success;
}
static int
ProcXvQueryEncodings(ClientPtr client)
{
- xvEncodingInfo einfo;
- xvQueryEncodingsReply rep;
- int totalSize;
- int nameSize;
- XvPortPtr pPort;
- int ne;
- XvEncodingPtr pe;
- int status;
-
- REQUEST(xvQueryEncodingsReq);
- REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
-
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
-
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ xvEncodingInfo einfo;
+ xvQueryEncodingsReply rep;
+ int totalSize;
+ int nameSize;
+ XvPortPtr pPort;
+ int ne;
+ XvEncodingPtr pe;
+ int status;
+
+ REQUEST(xvQueryEncodingsReq);
+ REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
+
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_encodings = pPort->pAdaptor->nEncodings;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.num_encodings = pPort->pAdaptor->nEncodings;
- /* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
+ /* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
- ne = pPort->pAdaptor->nEncodings;
- pe = pPort->pAdaptor->pEncodings;
- totalSize = ne * sz_xvEncodingInfo;
- while (ne--)
- {
- totalSize += pad_to_int32(strlen(pe->name));
- pe++;
+ ne = pPort->pAdaptor->nEncodings;
+ pe = pPort->pAdaptor->pEncodings;
+ totalSize = ne * sz_xvEncodingInfo;
+ while (ne--) {
+ totalSize += pad_to_int32(strlen(pe->name));
+ pe++;
}
- rep.length = bytes_to_int32(totalSize);
-
- _WriteQueryEncodingsReply(client, &rep);
-
- ne = pPort->pAdaptor->nEncodings;
- pe = pPort->pAdaptor->pEncodings;
- while (ne--)
- {
- einfo.encoding = pe->id;
- einfo.name_size = nameSize = strlen(pe->name);
- einfo.width = pe->width;
- einfo.height = pe->height;
- einfo.rate.numerator = pe->rate.numerator;
- einfo.rate.denominator = pe->rate.denominator;
- _WriteEncodingInfo(client, &einfo);
- WriteToClient(client, nameSize, pe->name);
- pe++;
+ rep.length = bytes_to_int32(totalSize);
+
+ _WriteQueryEncodingsReply(client, &rep);
+
+ ne = pPort->pAdaptor->nEncodings;
+ pe = pPort->pAdaptor->pEncodings;
+ while (ne--) {
+ einfo.encoding = pe->id;
+ einfo.name_size = nameSize = strlen(pe->name);
+ einfo.width = pe->width;
+ einfo.height = pe->height;
+ einfo.rate.numerator = pe->rate.numerator;
+ einfo.rate.denominator = pe->rate.denominator;
+ _WriteEncodingInfo(client, &einfo);
+ WriteToClient(client, nameSize, pe->name);
+ pe++;
}
- return Success;
+ return Success;
}
static int
ProcXvPutVideo(ClientPtr client)
{
- DrawablePtr pDraw;
- XvPortPtr pPort;
- GCPtr pGC;
- int status;
+ DrawablePtr pDraw;
+ XvPortPtr pPort;
+ GCPtr pGC;
+ int status;
- REQUEST(xvPutVideoReq);
- REQUEST_SIZE_MATCH(xvPutVideoReq);
+ REQUEST(xvPutVideoReq);
+ REQUEST_SIZE_MATCH(xvPutVideoReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- if (!(pPort->pAdaptor->type & XvInputMask) ||
- !(pPort->pAdaptor->type & XvVideoMask))
- {
- client->errorValue = stuff->port;
- return BadMatch;
+ if (!(pPort->pAdaptor->type & XvInputMask) ||
+ !(pPort->pAdaptor->type & XvVideoMask)) {
+ client->errorValue = stuff->port;
+ return BadMatch;
}
- status = XvdiMatchPort(pPort, pDraw);
- if (status != Success)
- {
- return status;
+ status = XvdiMatchPort(pPort, pDraw);
+ if (status != Success) {
+ return status;
}
- return XvdiPutVideo(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y,
- stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y,
- stuff->drw_w, stuff->drw_h);
+ return XvdiPutVideo(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y,
+ stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y,
+ stuff->drw_w, stuff->drw_h);
}
static int
ProcXvPutStill(ClientPtr client)
{
- DrawablePtr pDraw;
- XvPortPtr pPort;
- GCPtr pGC;
- int status;
+ DrawablePtr pDraw;
+ XvPortPtr pPort;
+ GCPtr pGC;
+ int status;
- REQUEST(xvPutStillReq);
- REQUEST_SIZE_MATCH(xvPutStillReq);
+ REQUEST(xvPutStillReq);
+ REQUEST_SIZE_MATCH(xvPutStillReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- if (!(pPort->pAdaptor->type & XvInputMask) ||
- !(pPort->pAdaptor->type & XvStillMask))
- {
- client->errorValue = stuff->port;
- return BadMatch;
+ if (!(pPort->pAdaptor->type & XvInputMask) ||
+ !(pPort->pAdaptor->type & XvStillMask)) {
+ client->errorValue = stuff->port;
+ return BadMatch;
}
- status = XvdiMatchPort(pPort, pDraw);
- if (status != Success)
- {
- return status;
+ status = XvdiMatchPort(pPort, pDraw);
+ if (status != Success) {
+ return status;
}
- return XvdiPutStill(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y,
- stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y,
- stuff->drw_w, stuff->drw_h);
+ return XvdiPutStill(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y,
+ stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y,
+ stuff->drw_w, stuff->drw_h);
}
static int
ProcXvGetVideo(ClientPtr client)
{
- DrawablePtr pDraw;
- XvPortPtr pPort;
- GCPtr pGC;
- int status;
+ DrawablePtr pDraw;
+ XvPortPtr pPort;
+ GCPtr pGC;
+ int status;
- REQUEST(xvGetVideoReq);
- REQUEST_SIZE_MATCH(xvGetVideoReq);
+ REQUEST(xvGetVideoReq);
+ REQUEST_SIZE_MATCH(xvGetVideoReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- if (!(pPort->pAdaptor->type & XvOutputMask) ||
- !(pPort->pAdaptor->type & XvVideoMask))
- {
- client->errorValue = stuff->port;
- return BadMatch;
+ if (!(pPort->pAdaptor->type & XvOutputMask) ||
+ !(pPort->pAdaptor->type & XvVideoMask)) {
+ client->errorValue = stuff->port;
+ return BadMatch;
}
- status = XvdiMatchPort(pPort, pDraw);
- if (status != Success)
- {
- return status;
+ status = XvdiMatchPort(pPort, pDraw);
+ if (status != Success) {
+ return status;
}
- return XvdiGetVideo(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y,
- stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y,
- stuff->drw_w, stuff->drw_h);
+ return XvdiGetVideo(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y,
+ stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y,
+ stuff->drw_w, stuff->drw_h);
}
static int
ProcXvGetStill(ClientPtr client)
{
- DrawablePtr pDraw;
- XvPortPtr pPort;
- GCPtr pGC;
- int status;
+ DrawablePtr pDraw;
+ XvPortPtr pPort;
+ GCPtr pGC;
+ int status;
- REQUEST(xvGetStillReq);
- REQUEST_SIZE_MATCH(xvGetStillReq);
+ REQUEST(xvGetStillReq);
+ REQUEST_SIZE_MATCH(xvGetStillReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- if (!(pPort->pAdaptor->type & XvOutputMask) ||
- !(pPort->pAdaptor->type & XvStillMask))
- {
- client->errorValue = stuff->port;
- return BadMatch;
+ if (!(pPort->pAdaptor->type & XvOutputMask) ||
+ !(pPort->pAdaptor->type & XvStillMask)) {
+ client->errorValue = stuff->port;
+ return BadMatch;
}
- status = XvdiMatchPort(pPort, pDraw);
- if (status != Success)
- {
- return status;
+ status = XvdiMatchPort(pPort, pDraw);
+ if (status != Success) {
+ return status;
}
- return XvdiGetStill(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y,
- stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y,
- stuff->drw_w, stuff->drw_h);
+ return XvdiGetStill(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y,
+ stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y,
+ stuff->drw_w, stuff->drw_h);
}
static int
ProcXvSelectVideoNotify(ClientPtr client)
{
- DrawablePtr pDraw;
- int rc;
- REQUEST(xvSelectVideoNotifyReq);
- REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
+ DrawablePtr pDraw;
+ int rc;
+
+ REQUEST(xvSelectVideoNotifyReq);
+ REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReceiveAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
+ DixReceiveAccess);
+ if (rc != Success)
+ return rc;
- return XvdiSelectVideoNotify(client, pDraw, stuff->onoff);
+ return XvdiSelectVideoNotify(client, pDraw, stuff->onoff);
}
static int
ProcXvSelectPortNotify(ClientPtr client)
{
- int status;
- XvPortPtr pPort;
- REQUEST(xvSelectPortNotifyReq);
- REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
+ int status;
+ XvPortPtr pPort;
+
+ REQUEST(xvSelectPortNotifyReq);
+ REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- return XvdiSelectPortNotify(client, pPort, stuff->onoff);
+ return XvdiSelectPortNotify(client, pPort, stuff->onoff);
}
static int
ProcXvGrabPort(ClientPtr client)
{
- int result, status;
- XvPortPtr pPort;
- xvGrabPortReply rep;
- REQUEST(xvGrabPortReq);
- REQUEST_SIZE_MATCH(xvGrabPortReq);
+ int result, status;
+ XvPortPtr pPort;
+ xvGrabPortReply rep;
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ REQUEST(xvGrabPortReq);
+ REQUEST_SIZE_MATCH(xvGrabPortReq);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- status = XvdiGrabPort(client, pPort, stuff->time, &result);
+ status = XvdiGrabPort(client, pPort, stuff->time, &result);
- if (status != Success)
- {
- return status;
+ if (status != Success) {
+ return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.result = result;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.result = result;
- _WriteGrabPortReply(client, &rep);
+ _WriteGrabPortReply(client, &rep);
- return Success;
+ return Success;
}
static int
ProcXvUngrabPort(ClientPtr client)
{
- int status;
- XvPortPtr pPort;
- REQUEST(xvGrabPortReq);
- REQUEST_SIZE_MATCH(xvGrabPortReq);
+ int status;
+ XvPortPtr pPort;
+
+ REQUEST(xvGrabPortReq);
+ REQUEST_SIZE_MATCH(xvGrabPortReq);
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- return XvdiUngrabPort(client, pPort, stuff->time);
+ return XvdiUngrabPort(client, pPort, stuff->time);
}
static int
ProcXvStopVideo(ClientPtr client)
{
- int status, rc;
- DrawablePtr pDraw;
- XvPortPtr pPort;
- REQUEST(xvStopVideoReq);
- REQUEST_SIZE_MATCH(xvStopVideoReq);
+ int status, rc;
+ DrawablePtr pDraw;
+ XvPortPtr pPort;
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ REQUEST(xvStopVideoReq);
+ REQUEST_SIZE_MATCH(xvStopVideoReq);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
+ if (rc != Success)
+ return rc;
- return XvdiStopVideo(client, pPort, pDraw);
+ return XvdiStopVideo(client, pPort, pDraw);
}
static int
ProcXvSetPortAttribute(ClientPtr client)
{
- int status;
- XvPortPtr pPort;
- REQUEST(xvSetPortAttributeReq);
- REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
+ int status;
+ XvPortPtr pPort;
- VALIDATE_XV_PORT(stuff->port, pPort, DixSetAttrAccess);
+ REQUEST(xvSetPortAttributeReq);
+ REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
+
+ VALIDATE_XV_PORT(stuff->port, pPort, DixSetAttrAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- if (!ValidAtom(stuff->attribute))
- {
- client->errorValue = stuff->attribute;
- return BadAtom;
+ if (!ValidAtom(stuff->attribute)) {
+ client->errorValue = stuff->attribute;
+ return BadAtom;
}
- status = XvdiSetPortAttribute(client, pPort, stuff->attribute, stuff->value);
+ status =
+ XvdiSetPortAttribute(client, pPort, stuff->attribute, stuff->value);
- if (status == BadMatch)
- client->errorValue = stuff->attribute;
- else
- client->errorValue = stuff->value;
+ if (status == BadMatch)
+ client->errorValue = stuff->attribute;
+ else
+ client->errorValue = stuff->value;
- return status;
+ return status;
}
static int
ProcXvGetPortAttribute(ClientPtr client)
{
- INT32 value;
- int status;
- XvPortPtr pPort;
- xvGetPortAttributeReply rep;
- REQUEST(xvGetPortAttributeReq);
- REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
+ INT32 value;
+ int status;
+ XvPortPtr pPort;
+ xvGetPortAttributeReply rep;
+
+ REQUEST(xvGetPortAttributeReq);
+ REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
- VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
+ VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- if (!ValidAtom(stuff->attribute))
- {
- client->errorValue = stuff->attribute;
- return BadAtom;
+ if (!ValidAtom(stuff->attribute)) {
+ client->errorValue = stuff->attribute;
+ return BadAtom;
}
- status = XvdiGetPortAttribute(client, pPort, stuff->attribute, &value);
- if (status != Success)
- {
- client->errorValue = stuff->attribute;
- return status;
+ status = XvdiGetPortAttribute(client, pPort, stuff->attribute, &value);
+ if (status != Success) {
+ client->errorValue = stuff->attribute;
+ return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.value = value;
-
- _WriteGetPortAttributeReply(client, &rep);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.value = value;
- return Success;
+ _WriteGetPortAttributeReply(client, &rep);
+
+ return Success;
}
static int
ProcXvQueryBestSize(ClientPtr client)
{
- int status;
- unsigned int actual_width, actual_height;
- XvPortPtr pPort;
- xvQueryBestSizeReply rep;
- REQUEST(xvQueryBestSizeReq);
- REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
+ int status;
+ unsigned int actual_width, actual_height;
+ XvPortPtr pPort;
+ xvQueryBestSizeReply rep;
+
+ REQUEST(xvQueryBestSizeReq);
+ REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
- (* pPort->pAdaptor->ddQueryBestSize)(client, pPort, stuff->motion,
- stuff->vid_w, stuff->vid_h,
- stuff->drw_w, stuff->drw_h,
- &actual_width, &actual_height);
+ (*pPort->pAdaptor->ddQueryBestSize) (client, pPort, stuff->motion,
+ stuff->vid_w, stuff->vid_h,
+ stuff->drw_w, stuff->drw_h,
+ &actual_width, &actual_height);
- rep.actual_width = actual_width;
- rep.actual_height = actual_height;
-
- _WriteQueryBestSizeReply(client, &rep);
+ rep.actual_width = actual_width;
+ rep.actual_height = actual_height;
- return Success;
-}
+ _WriteQueryBestSizeReply(client, &rep);
+ return Success;
+}
static int
ProcXvQueryPortAttributes(ClientPtr client)
{
- int status, size, i;
- XvPortPtr pPort;
- XvAttributePtr pAtt;
- xvQueryPortAttributesReply rep;
- xvAttributeInfo Info;
- REQUEST(xvQueryPortAttributesReq);
- REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
+ int status, size, i;
+ XvPortPtr pPort;
+ XvAttributePtr pAtt;
+ xvQueryPortAttributesReply rep;
+ xvAttributeInfo Info;
- VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
+ REQUEST(xvQueryPortAttributesReq);
+ REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_attributes = pPort->pAdaptor->nAttributes;
- rep.text_size = 0;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.num_attributes = pPort->pAdaptor->nAttributes;
+ rep.text_size = 0;
- for(i = 0, pAtt = pPort->pAdaptor->pAttributes;
- i < pPort->pAdaptor->nAttributes; i++, pAtt++)
- {
- rep.text_size += pad_to_int32(strlen(pAtt->name) + 1);
- }
+ for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
+ i < pPort->pAdaptor->nAttributes; i++, pAtt++) {
+ rep.text_size += pad_to_int32(strlen(pAtt->name) + 1);
+ }
- rep.length = (pPort->pAdaptor->nAttributes * sz_xvAttributeInfo)
- + rep.text_size;
- rep.length >>= 2;
+ rep.length = (pPort->pAdaptor->nAttributes * sz_xvAttributeInfo)
+ + rep.text_size;
+ rep.length >>= 2;
- _WriteQueryPortAttributesReply(client, &rep);
+ _WriteQueryPortAttributesReply(client, &rep);
- for(i = 0, pAtt = pPort->pAdaptor->pAttributes;
- i < pPort->pAdaptor->nAttributes; i++, pAtt++)
- {
- size = strlen(pAtt->name) + 1; /* pass the NULL */
- Info.flags = pAtt->flags;
- Info.min = pAtt->min_value;
- Info.max = pAtt->max_value;
- Info.size = pad_to_int32(size);
+ for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
+ i < pPort->pAdaptor->nAttributes; i++, pAtt++) {
+ size = strlen(pAtt->name) + 1; /* pass the NULL */
+ Info.flags = pAtt->flags;
+ Info.min = pAtt->min_value;
+ Info.max = pAtt->max_value;
+ Info.size = pad_to_int32(size);
- _WriteAttributeInfo(client, &Info);
+ _WriteAttributeInfo(client, &Info);
- WriteToClient(client, size, pAtt->name);
- }
+ WriteToClient(client, size, pAtt->name);
+ }
- return Success;
+ return Success;
}
-static int
+static int
ProcXvPutImage(ClientPtr client)
{
- DrawablePtr pDraw;
- XvPortPtr pPort;
- XvImagePtr pImage = NULL;
- GCPtr pGC;
- int status, i, size;
- CARD16 width, height;
+ DrawablePtr pDraw;
+ XvPortPtr pPort;
+ XvImagePtr pImage = NULL;
+ GCPtr pGC;
+ int status, i, size;
+ CARD16 width, height;
- REQUEST(xvPutImageReq);
- REQUEST_AT_LEAST_SIZE(xvPutImageReq);
+ REQUEST(xvPutImageReq);
+ REQUEST_AT_LEAST_SIZE(xvPutImageReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- if (!(pPort->pAdaptor->type & XvImageMask) ||
- !(pPort->pAdaptor->type & XvInputMask))
- {
- client->errorValue = stuff->port;
- return BadMatch;
+ if (!(pPort->pAdaptor->type & XvImageMask) ||
+ !(pPort->pAdaptor->type & XvInputMask)) {
+ client->errorValue = stuff->port;
+ return BadMatch;
}
- status = XvdiMatchPort(pPort, pDraw);
- if (status != Success)
- {
- return status;
+ status = XvdiMatchPort(pPort, pDraw);
+ if (status != Success) {
+ return status;
}
- for(i = 0; i < pPort->pAdaptor->nImages; i++) {
- if(pPort->pAdaptor->pImages[i].id == stuff->id) {
- pImage = &(pPort->pAdaptor->pImages[i]);
- break;
- }
- }
+ for (i = 0; i < pPort->pAdaptor->nImages; i++) {
+ if (pPort->pAdaptor->pImages[i].id == stuff->id) {
+ pImage = &(pPort->pAdaptor->pImages[i]);
+ break;
+ }
+ }
+
+ if (!pImage)
+ return BadMatch;
- if(!pImage)
- return BadMatch;
+ width = stuff->width;
+ height = stuff->height;
+ size = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
+ pPort, pImage, &width,
+ &height, NULL, NULL);
+ size += sizeof(xvPutImageReq);
+ size = bytes_to_int32(size);
- width = stuff->width;
- height = stuff->height;
- size = (*pPort->pAdaptor->ddQueryImageAttributes)(client,
- pPort, pImage, &width, &height, NULL, NULL);
- size += sizeof(xvPutImageReq);
- size = bytes_to_int32(size);
-
- if((width < stuff->width) || (height < stuff->height))
- return BadValue;
+ if ((width < stuff->width) || (height < stuff->height))
+ return BadValue;
- if(client->req_len < size)
- return BadLength;
+ if (client->req_len < size)
+ return BadLength;
- return XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y,
- stuff->src_w, stuff->src_h, stuff->drw_x, stuff->drw_y,
- stuff->drw_w, stuff->drw_h, pImage,
- (unsigned char*)(&stuff[1]), FALSE,
- stuff->width, stuff->height);
+ return XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y,
+ stuff->src_w, stuff->src_h, stuff->drw_x, stuff->drw_y,
+ stuff->drw_w, stuff->drw_h, pImage,
+ (unsigned char *) (&stuff[1]), FALSE,
+ stuff->width, stuff->height);
}
#ifdef MITSHM
@@ -1000,74 +950,73 @@ typedef struct _ShmDesc {
extern RESTYPE ShmSegType;
extern int ShmCompletionCode;
-static int
+static int
ProcXvShmPutImage(ClientPtr client)
{
- ShmDescPtr shmdesc;
- DrawablePtr pDraw;
- XvPortPtr pPort;
- XvImagePtr pImage = NULL;
- GCPtr pGC;
- int status, size_needed, i;
- CARD16 width, height;
+ ShmDescPtr shmdesc;
+ DrawablePtr pDraw;
+ XvPortPtr pPort;
+ XvImagePtr pImage = NULL;
+ GCPtr pGC;
+ int status, size_needed, i;
+ CARD16 width, height;
- REQUEST(xvShmPutImageReq);
- REQUEST_SIZE_MATCH(xvShmPutImageReq);
+ REQUEST(xvShmPutImageReq);
+ REQUEST_SIZE_MATCH(xvShmPutImageReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if ((status = _AllocatePort(stuff->port, pPort)) != Success)
- {
- client->errorValue = stuff->port;
- return status;
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
+ client->errorValue = stuff->port;
+ return status;
}
- if (!(pPort->pAdaptor->type & XvImageMask) ||
- !(pPort->pAdaptor->type & XvInputMask))
- {
- client->errorValue = stuff->port;
- return BadMatch;
+ if (!(pPort->pAdaptor->type & XvImageMask) ||
+ !(pPort->pAdaptor->type & XvInputMask)) {
+ client->errorValue = stuff->port;
+ return BadMatch;
}
- status = XvdiMatchPort(pPort, pDraw);
- if (status != Success)
- {
- return status;
+ status = XvdiMatchPort(pPort, pDraw);
+ if (status != Success) {
+ return status;
}
- for(i = 0; i < pPort->pAdaptor->nImages; i++) {
- if(pPort->pAdaptor->pImages[i].id == stuff->id) {
- pImage = &(pPort->pAdaptor->pImages[i]);
- break;
- }
- }
-
- if(!pImage)
- return BadMatch;
-
- status = dixLookupResourceByType((pointer *)&shmdesc, stuff->shmseg,
- ShmSegType, serverClient, DixReadAccess);
- if (status != Success)
- return status;
-
- width = stuff->width;
- height = stuff->height;
- size_needed = (*pPort->pAdaptor->ddQueryImageAttributes)(client,
- pPort, pImage, &width, &height, NULL, NULL);
- if((size_needed + stuff->offset) > shmdesc->size)
- return BadAccess;
-
- if((width < stuff->width) || (height < stuff->height))
- return BadValue;
-
- status = XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y,
- stuff->src_w, stuff->src_h, stuff->drw_x, stuff->drw_y,
- stuff->drw_w, stuff->drw_h, pImage,
- (unsigned char *)shmdesc->addr + stuff->offset,
- stuff->send_event, stuff->width, stuff->height);
-
- if((status == Success) && stuff->send_event) {
+ for (i = 0; i < pPort->pAdaptor->nImages; i++) {
+ if (pPort->pAdaptor->pImages[i].id == stuff->id) {
+ pImage = &(pPort->pAdaptor->pImages[i]);
+ break;
+ }
+ }
+
+ if (!pImage)
+ return BadMatch;
+
+ status = dixLookupResourceByType((pointer *) &shmdesc, stuff->shmseg,
+ ShmSegType, serverClient, DixReadAccess);
+ if (status != Success)
+ return status;
+
+ width = stuff->width;
+ height = stuff->height;
+ size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
+ pPort, pImage,
+ &width, &height,
+ NULL, NULL);
+ if ((size_needed + stuff->offset) > shmdesc->size)
+ return BadAccess;
+
+ if ((width < stuff->width) || (height < stuff->height))
+ return BadValue;
+
+ status = XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y,
+ stuff->src_w, stuff->src_h, stuff->drw_x,
+ stuff->drw_y, stuff->drw_w, stuff->drw_h, pImage,
+ (unsigned char *) shmdesc->addr + stuff->offset,
+ stuff->send_event, stuff->width, stuff->height);
+
+ if ((status == Success) && stuff->send_event) {
xShmCompletionEvent ev;
ev.type = ShmCompletionCode;
@@ -1077,11 +1026,11 @@ ProcXvShmPutImage(ClientPtr client)
ev.shmseg = stuff->shmseg;
ev.offset = stuff->offset;
WriteEventsToClient(client, 1, (xEvent *) &ev);
- }
+ }
- return status;
+ return status;
}
-#else /* !MITSHM */
+#else /* !MITSHM */
static int
ProcXvShmPutImage(ClientPtr client)
{
@@ -1094,156 +1043,157 @@ ProcXvShmPutImage(ClientPtr client)
#include "xvmcext.h"
#endif
-static int
+static int
ProcXvQueryImageAttributes(ClientPtr client)
{
- xvQueryImageAttributesReply rep;
- int size, num_planes, i;
- CARD16 width, height;
- XvImagePtr pImage = NULL;
- XvPortPtr pPort;
- int *offsets;
- int *pitches;
- int planeLength;
- REQUEST(xvQueryImageAttributesReq);
-
- REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
-
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
-
- for(i = 0; i < pPort->pAdaptor->nImages; i++) {
- if(pPort->pAdaptor->pImages[i].id == stuff->id) {
- pImage = &(pPort->pAdaptor->pImages[i]);
- break;
- }
- }
+ xvQueryImageAttributesReply rep;
+ int size, num_planes, i;
+ CARD16 width, height;
+ XvImagePtr pImage = NULL;
+ XvPortPtr pPort;
+ int *offsets;
+ int *pitches;
+ int planeLength;
+
+ REQUEST(xvQueryImageAttributesReq);
+
+ REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
+
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+
+ for (i = 0; i < pPort->pAdaptor->nImages; i++) {
+ if (pPort->pAdaptor->pImages[i].id == stuff->id) {
+ pImage = &(pPort->pAdaptor->pImages[i]);
+ break;
+ }
+ }
#ifdef XvMCExtension
- if(!pImage)
- pImage = XvMCFindXvImage(pPort, stuff->id);
+ if (!pImage)
+ pImage = XvMCFindXvImage(pPort, stuff->id);
#endif
- if(!pImage)
- return BadMatch;
+ if (!pImage)
+ return BadMatch;
+
+ num_planes = pImage->num_planes;
- num_planes = pImage->num_planes;
+ if (!(offsets = malloc(num_planes << 3)))
+ return BadAlloc;
+ pitches = offsets + num_planes;
- if(!(offsets = malloc(num_planes << 3)))
- return BadAlloc;
- pitches = offsets + num_planes;
+ width = stuff->width;
+ height = stuff->height;
- width = stuff->width;
- height = stuff->height;
+ size = (*pPort->pAdaptor->ddQueryImageAttributes) (client, pPort, pImage,
+ &width, &height, offsets,
+ pitches);
- size = (*pPort->pAdaptor->ddQueryImageAttributes)(client, pPort, pImage,
- &width, &height, offsets, pitches);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = planeLength = num_planes << 1;
+ rep.num_planes = num_planes;
+ rep.width = width;
+ rep.height = height;
+ rep.data_size = size;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = planeLength = num_planes << 1;
- rep.num_planes = num_planes;
- rep.width = width;
- rep.height = height;
- rep.data_size = size;
-
- _WriteQueryImageAttributesReply(client, &rep);
- if(client->swapped)
- SwapLongs((CARD32*)offsets, planeLength);
- WriteToClient(client, planeLength << 2, (char*)offsets);
+ _WriteQueryImageAttributesReply(client, &rep);
+ if (client->swapped)
+ SwapLongs((CARD32 *) offsets, planeLength);
+ WriteToClient(client, planeLength << 2, (char *) offsets);
- free(offsets);
+ free(offsets);
- return Success;
+ return Success;
}
-static int
+static int
ProcXvListImageFormats(ClientPtr client)
{
- XvPortPtr pPort;
- XvImagePtr pImage;
- int i;
- xvListImageFormatsReply rep;
- xvImageFormatInfo info;
- REQUEST(xvListImageFormatsReq);
-
- REQUEST_SIZE_MATCH(xvListImageFormatsReq);
-
- VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_formats = pPort->pAdaptor->nImages;
- rep.length = bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo);
-
- _WriteListImageFormatsReply(client, &rep);
-
- pImage = pPort->pAdaptor->pImages;
-
- for(i = 0; i < pPort->pAdaptor->nImages; i++, pImage++) {
- info.id = pImage->id;
- info.type = pImage->type;
- info.byte_order = pImage->byte_order;
- memcpy(&info.guid, pImage->guid, 16);
- info.bpp = pImage->bits_per_pixel;
- info.num_planes = pImage->num_planes;
- info.depth = pImage->depth;
- info.red_mask = pImage->red_mask;
- info.green_mask = pImage->green_mask;
- info.blue_mask = pImage->blue_mask;
- info.format = pImage->format;
- info.y_sample_bits = pImage->y_sample_bits;
- info.u_sample_bits = pImage->u_sample_bits;
- info.v_sample_bits = pImage->v_sample_bits;
- info.horz_y_period = pImage->horz_y_period;
- info.horz_u_period = pImage->horz_u_period;
- info.horz_v_period = pImage->horz_v_period;
- info.vert_y_period = pImage->vert_y_period;
- info.vert_u_period = pImage->vert_u_period;
- info.vert_v_period = pImage->vert_v_period;
- memcpy(&info.comp_order, pImage->component_order, 32);
- info.scanline_order = pImage->scanline_order;
- _WriteImageFormatInfo(client, &info);
- }
-
- return Success;
-}
-
-static int (*XvProcVector[xvNumRequests])(ClientPtr) = {
- ProcXvQueryExtension,
- ProcXvQueryAdaptors,
- ProcXvQueryEncodings,
- ProcXvGrabPort,
- ProcXvUngrabPort,
- ProcXvPutVideo,
- ProcXvPutStill,
- ProcXvGetVideo,
- ProcXvGetStill,
- ProcXvStopVideo,
- ProcXvSelectVideoNotify,
- ProcXvSelectPortNotify,
- ProcXvQueryBestSize,
- ProcXvSetPortAttribute,
- ProcXvGetPortAttribute,
- ProcXvQueryPortAttributes,
- ProcXvListImageFormats,
- ProcXvQueryImageAttributes,
- ProcXvPutImage,
- ProcXvShmPutImage,
-};
+ XvPortPtr pPort;
+ XvImagePtr pImage;
+ int i;
+ xvListImageFormatsReply rep;
+ xvImageFormatInfo info;
+
+ REQUEST(xvListImageFormatsReq);
+
+ REQUEST_SIZE_MATCH(xvListImageFormatsReq);
+
+ VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.num_formats = pPort->pAdaptor->nImages;
+ rep.length =
+ bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo);
+
+ _WriteListImageFormatsReply(client, &rep);
+
+ pImage = pPort->pAdaptor->pImages;
+
+ for (i = 0; i < pPort->pAdaptor->nImages; i++, pImage++) {
+ info.id = pImage->id;
+ info.type = pImage->type;
+ info.byte_order = pImage->byte_order;
+ memcpy(&info.guid, pImage->guid, 16);
+ info.bpp = pImage->bits_per_pixel;
+ info.num_planes = pImage->num_planes;
+ info.depth = pImage->depth;
+ info.red_mask = pImage->red_mask;
+ info.green_mask = pImage->green_mask;
+ info.blue_mask = pImage->blue_mask;
+ info.format = pImage->format;
+ info.y_sample_bits = pImage->y_sample_bits;
+ info.u_sample_bits = pImage->u_sample_bits;
+ info.v_sample_bits = pImage->v_sample_bits;
+ info.horz_y_period = pImage->horz_y_period;
+ info.horz_u_period = pImage->horz_u_period;
+ info.horz_v_period = pImage->horz_v_period;
+ info.vert_y_period = pImage->vert_y_period;
+ info.vert_u_period = pImage->vert_u_period;
+ info.vert_v_period = pImage->vert_v_period;
+ memcpy(&info.comp_order, pImage->component_order, 32);
+ info.scanline_order = pImage->scanline_order;
+ _WriteImageFormatInfo(client, &info);
+ }
+
+ return Success;
+}
+
+static int (*XvProcVector[xvNumRequests]) (ClientPtr) = {
+ProcXvQueryExtension,
+ ProcXvQueryAdaptors,
+ ProcXvQueryEncodings,
+ ProcXvGrabPort,
+ ProcXvUngrabPort,
+ ProcXvPutVideo,
+ ProcXvPutStill,
+ ProcXvGetVideo,
+ ProcXvGetStill,
+ ProcXvStopVideo,
+ ProcXvSelectVideoNotify,
+ ProcXvSelectPortNotify,
+ ProcXvQueryBestSize,
+ ProcXvSetPortAttribute,
+ ProcXvGetPortAttribute,
+ ProcXvQueryPortAttributes,
+ ProcXvListImageFormats,
+ ProcXvQueryImageAttributes, ProcXvPutImage, ProcXvShmPutImage,};
int
ProcXvDispatch(ClientPtr client)
{
- REQUEST(xReq);
+ REQUEST(xReq);
- UpdateCurrentTime();
+ UpdateCurrentTime();
- if (stuff->data >= xvNumRequests) {
- SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
- return BadRequest;
- }
+ if (stuff->data >= xvNumRequests) {
+ SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
+ return BadRequest;
+ }
- return XvProcVector[stuff->data](client);
+ return XvProcVector[stuff->data] (client);
}
/* Swapped Procs */
@@ -1251,333 +1201,331 @@ ProcXvDispatch(ClientPtr client)
static int
SProcXvQueryExtension(ClientPtr client)
{
- REQUEST(xvQueryExtensionReq);
- swaps(&stuff->length);
- return XvProcVector[xv_QueryExtension](client);
+ REQUEST(xvQueryExtensionReq);
+ swaps(&stuff->length);
+ return XvProcVector[xv_QueryExtension] (client);
}
static int
SProcXvQueryAdaptors(ClientPtr client)
{
- REQUEST(xvQueryAdaptorsReq);
- swaps(&stuff->length);
- swapl(&stuff->window);
- return XvProcVector[xv_QueryAdaptors](client);
+ REQUEST(xvQueryAdaptorsReq);
+ swaps(&stuff->length);
+ swapl(&stuff->window);
+ return XvProcVector[xv_QueryAdaptors] (client);
}
static int
SProcXvQueryEncodings(ClientPtr client)
{
- REQUEST(xvQueryEncodingsReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- return XvProcVector[xv_QueryEncodings](client);
+ REQUEST(xvQueryEncodingsReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ return XvProcVector[xv_QueryEncodings] (client);
}
static int
SProcXvGrabPort(ClientPtr client)
{
- REQUEST(xvGrabPortReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->time);
- return XvProcVector[xv_GrabPort](client);
+ REQUEST(xvGrabPortReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->time);
+ return XvProcVector[xv_GrabPort] (client);
}
static int
SProcXvUngrabPort(ClientPtr client)
{
- REQUEST(xvUngrabPortReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->time);
- return XvProcVector[xv_UngrabPort](client);
+ REQUEST(xvUngrabPortReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->time);
+ return XvProcVector[xv_UngrabPort] (client);
}
static int
SProcXvPutVideo(ClientPtr client)
{
- REQUEST(xvPutVideoReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->drawable);
- swapl(&stuff->gc);
- swaps(&stuff->vid_x);
- swaps(&stuff->vid_y);
- swaps(&stuff->vid_w);
- swaps(&stuff->vid_h);
- swaps(&stuff->drw_x);
- swaps(&stuff->drw_y);
- swaps(&stuff->drw_w);
- swaps(&stuff->drw_h);
- return XvProcVector[xv_PutVideo](client);
+ REQUEST(xvPutVideoReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swaps(&stuff->vid_x);
+ swaps(&stuff->vid_y);
+ swaps(&stuff->vid_w);
+ swaps(&stuff->vid_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
+ return XvProcVector[xv_PutVideo] (client);
}
static int
SProcXvPutStill(ClientPtr client)
{
- REQUEST(xvPutStillReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->drawable);
- swapl(&stuff->gc);
- swaps(&stuff->vid_x);
- swaps(&stuff->vid_y);
- swaps(&stuff->vid_w);
- swaps(&stuff->vid_h);
- swaps(&stuff->drw_x);
- swaps(&stuff->drw_y);
- swaps(&stuff->drw_w);
- swaps(&stuff->drw_h);
- return XvProcVector[xv_PutStill](client);
+ REQUEST(xvPutStillReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swaps(&stuff->vid_x);
+ swaps(&stuff->vid_y);
+ swaps(&stuff->vid_w);
+ swaps(&stuff->vid_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
+ return XvProcVector[xv_PutStill] (client);
}
static int
SProcXvGetVideo(ClientPtr client)
{
- REQUEST(xvGetVideoReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->drawable);
- swapl(&stuff->gc);
- swaps(&stuff->vid_x);
- swaps(&stuff->vid_y);
- swaps(&stuff->vid_w);
- swaps(&stuff->vid_h);
- swaps(&stuff->drw_x);
- swaps(&stuff->drw_y);
- swaps(&stuff->drw_w);
- swaps(&stuff->drw_h);
- return XvProcVector[xv_GetVideo](client);
+ REQUEST(xvGetVideoReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swaps(&stuff->vid_x);
+ swaps(&stuff->vid_y);
+ swaps(&stuff->vid_w);
+ swaps(&stuff->vid_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
+ return XvProcVector[xv_GetVideo] (client);
}
static int
SProcXvGetStill(ClientPtr client)
{
- REQUEST(xvGetStillReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->drawable);
- swapl(&stuff->gc);
- swaps(&stuff->vid_x);
- swaps(&stuff->vid_y);
- swaps(&stuff->vid_w);
- swaps(&stuff->vid_h);
- swaps(&stuff->drw_x);
- swaps(&stuff->drw_y);
- swaps(&stuff->drw_w);
- swaps(&stuff->drw_h);
- return XvProcVector[xv_GetStill](client);
+ REQUEST(xvGetStillReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swaps(&stuff->vid_x);
+ swaps(&stuff->vid_y);
+ swaps(&stuff->vid_w);
+ swaps(&stuff->vid_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
+ return XvProcVector[xv_GetStill] (client);
}
static int
SProcXvPutImage(ClientPtr client)
{
- REQUEST(xvPutImageReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->drawable);
- swapl(&stuff->gc);
- swapl(&stuff->id);
- swaps(&stuff->src_x);
- swaps(&stuff->src_y);
- swaps(&stuff->src_w);
- swaps(&stuff->src_h);
- swaps(&stuff->drw_x);
- swaps(&stuff->drw_y);
- swaps(&stuff->drw_w);
- swaps(&stuff->drw_h);
- swaps(&stuff->width);
- swaps(&stuff->height);
- return XvProcVector[xv_PutImage](client);
+ REQUEST(xvPutImageReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swapl(&stuff->id);
+ swaps(&stuff->src_x);
+ swaps(&stuff->src_y);
+ swaps(&stuff->src_w);
+ swaps(&stuff->src_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
+ swaps(&stuff->width);
+ swaps(&stuff->height);
+ return XvProcVector[xv_PutImage] (client);
}
#ifdef MITSHM
static int
SProcXvShmPutImage(ClientPtr client)
{
- REQUEST(xvShmPutImageReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->drawable);
- swapl(&stuff->gc);
- swapl(&stuff->shmseg);
- swapl(&stuff->id);
- swapl(&stuff->offset);
- swaps(&stuff->src_x);
- swaps(&stuff->src_y);
- swaps(&stuff->src_w);
- swaps(&stuff->src_h);
- swaps(&stuff->drw_x);
- swaps(&stuff->drw_y);
- swaps(&stuff->drw_w);
- swaps(&stuff->drw_h);
- swaps(&stuff->width);
- swaps(&stuff->height);
- return XvProcVector[xv_ShmPutImage](client);
-}
-#else /* MITSHM */
+ REQUEST(xvShmPutImageReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ swapl(&stuff->gc);
+ swapl(&stuff->shmseg);
+ swapl(&stuff->id);
+ swapl(&stuff->offset);
+ swaps(&stuff->src_x);
+ swaps(&stuff->src_y);
+ swaps(&stuff->src_w);
+ swaps(&stuff->src_h);
+ swaps(&stuff->drw_x);
+ swaps(&stuff->drw_y);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
+ swaps(&stuff->width);
+ swaps(&stuff->height);
+ return XvProcVector[xv_ShmPutImage] (client);
+}
+#else /* MITSHM */
#define SProcXvShmPutImage ProcXvShmPutImage
#endif
static int
SProcXvSelectVideoNotify(ClientPtr client)
{
- REQUEST(xvSelectVideoNotifyReq);
- swaps(&stuff->length);
- swapl(&stuff->drawable);
- return XvProcVector[xv_SelectVideoNotify](client);
+ REQUEST(xvSelectVideoNotifyReq);
+ swaps(&stuff->length);
+ swapl(&stuff->drawable);
+ return XvProcVector[xv_SelectVideoNotify] (client);
}
static int
SProcXvSelectPortNotify(ClientPtr client)
{
- REQUEST(xvSelectPortNotifyReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- return XvProcVector[xv_SelectPortNotify](client);
+ REQUEST(xvSelectPortNotifyReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ return XvProcVector[xv_SelectPortNotify] (client);
}
static int
SProcXvStopVideo(ClientPtr client)
{
- REQUEST(xvStopVideoReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->drawable);
- return XvProcVector[xv_StopVideo](client);
+ REQUEST(xvStopVideoReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->drawable);
+ return XvProcVector[xv_StopVideo] (client);
}
static int
SProcXvSetPortAttribute(ClientPtr client)
{
- REQUEST(xvSetPortAttributeReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->attribute);
- swapl(&stuff->value);
- return XvProcVector[xv_SetPortAttribute](client);
+ REQUEST(xvSetPortAttributeReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->attribute);
+ swapl(&stuff->value);
+ return XvProcVector[xv_SetPortAttribute] (client);
}
static int
SProcXvGetPortAttribute(ClientPtr client)
{
- REQUEST(xvGetPortAttributeReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->attribute);
- return XvProcVector[xv_GetPortAttribute](client);
+ REQUEST(xvGetPortAttributeReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->attribute);
+ return XvProcVector[xv_GetPortAttribute] (client);
}
static int
SProcXvQueryBestSize(ClientPtr client)
{
- REQUEST(xvQueryBestSizeReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swaps(&stuff->vid_w);
- swaps(&stuff->vid_h);
- swaps(&stuff->drw_w);
- swaps(&stuff->drw_h);
- return XvProcVector[xv_QueryBestSize](client);
+ REQUEST(xvQueryBestSizeReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swaps(&stuff->vid_w);
+ swaps(&stuff->vid_h);
+ swaps(&stuff->drw_w);
+ swaps(&stuff->drw_h);
+ return XvProcVector[xv_QueryBestSize] (client);
}
static int
SProcXvQueryPortAttributes(ClientPtr client)
{
- REQUEST(xvQueryPortAttributesReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- return XvProcVector[xv_QueryPortAttributes](client);
+ REQUEST(xvQueryPortAttributesReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ return XvProcVector[xv_QueryPortAttributes] (client);
}
static int
SProcXvQueryImageAttributes(ClientPtr client)
{
- REQUEST(xvQueryImageAttributesReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- swapl(&stuff->id);
- swaps(&stuff->width);
- swaps(&stuff->height);
- return XvProcVector[xv_QueryImageAttributes](client);
+ REQUEST(xvQueryImageAttributesReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ swapl(&stuff->id);
+ swaps(&stuff->width);
+ swaps(&stuff->height);
+ return XvProcVector[xv_QueryImageAttributes] (client);
}
static int
SProcXvListImageFormats(ClientPtr client)
{
- REQUEST(xvListImageFormatsReq);
- swaps(&stuff->length);
- swapl(&stuff->port);
- return XvProcVector[xv_ListImageFormats](client);
-}
-
-static int (*SXvProcVector[xvNumRequests])(ClientPtr) = {
- SProcXvQueryExtension,
- SProcXvQueryAdaptors,
- SProcXvQueryEncodings,
- SProcXvGrabPort,
- SProcXvUngrabPort,
- SProcXvPutVideo,
- SProcXvPutStill,
- SProcXvGetVideo,
- SProcXvGetStill,
- SProcXvStopVideo,
- SProcXvSelectVideoNotify,
- SProcXvSelectPortNotify,
- SProcXvQueryBestSize,
- SProcXvSetPortAttribute,
- SProcXvGetPortAttribute,
- SProcXvQueryPortAttributes,
- SProcXvListImageFormats,
- SProcXvQueryImageAttributes,
- SProcXvPutImage,
- SProcXvShmPutImage,
-};
+ REQUEST(xvListImageFormatsReq);
+ swaps(&stuff->length);
+ swapl(&stuff->port);
+ return XvProcVector[xv_ListImageFormats] (client);
+}
+
+static int (*SXvProcVector[xvNumRequests]) (ClientPtr) = {
+SProcXvQueryExtension,
+ SProcXvQueryAdaptors,
+ SProcXvQueryEncodings,
+ SProcXvGrabPort,
+ SProcXvUngrabPort,
+ SProcXvPutVideo,
+ SProcXvPutStill,
+ SProcXvGetVideo,
+ SProcXvGetStill,
+ SProcXvStopVideo,
+ SProcXvSelectVideoNotify,
+ SProcXvSelectPortNotify,
+ SProcXvQueryBestSize,
+ SProcXvSetPortAttribute,
+ SProcXvGetPortAttribute,
+ SProcXvQueryPortAttributes,
+ SProcXvListImageFormats,
+ SProcXvQueryImageAttributes, SProcXvPutImage, SProcXvShmPutImage,};
int
SProcXvDispatch(ClientPtr client)
{
- REQUEST(xReq);
+ REQUEST(xReq);
- UpdateCurrentTime();
+ UpdateCurrentTime();
- if (stuff->data >= xvNumRequests) {
- SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
- return BadRequest;
- }
+ if (stuff->data >= xvNumRequests) {
+ SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
+ return BadRequest;
+ }
- return SXvProcVector[stuff->data](client);
+ return SXvProcVector[stuff->data] (client);
}
#ifdef PANORAMIX
static int
XineramaXvStopVideo(ClientPtr client)
{
- int result, i;
- PanoramiXRes *draw, *port;
- REQUEST(xvStopVideoReq);
- REQUEST_SIZE_MATCH(xvStopVideoReq);
+ int result, i;
+ PanoramiXRes *draw, *port;
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
- if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ REQUEST(xvStopVideoReq);
+ REQUEST_SIZE_MATCH(xvStopVideoReq);
- result = dixLookupResourceByType((pointer *)&port, stuff->port,
- XvXRTPort, client, DixReadAccess);
- if (result != Success)
- return result;
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
+ if (result != Success)
+ return (result == BadValue) ? BadDrawable : result;
+
+ result = dixLookupResourceByType((pointer *) &port, stuff->port,
+ XvXRTPort, client, DixReadAccess);
+ if (result != Success)
+ return result;
- FOR_NSCREENS_BACKWARD(i) {
- if(port->info[i].id) {
- stuff->drawable = draw->info[i].id;
- stuff->port = port->info[i].id;
- result = ProcXvStopVideo(client);
- }
- }
+ FOR_NSCREENS_BACKWARD(i) {
+ if (port->info[i].id) {
+ stuff->drawable = draw->info[i].id;
+ stuff->port = port->info[i].id;
+ result = ProcXvStopVideo(client);
+ }
+ }
- return result;
+ return result;
}
static int
@@ -1589,22 +1537,22 @@ XineramaXvSetPortAttribute(ClientPtr client)
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
- result = dixLookupResourceByType((pointer *)&port, stuff->port,
- XvXRTPort, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &port, stuff->port,
+ XvXRTPort, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS_BACKWARD(i) {
- if(port->info[i].id) {
- stuff->port = port->info[i].id;
- result = ProcXvSetPortAttribute(client);
- }
+ if (port->info[i].id) {
+ stuff->port = port->info[i].id;
+ result = ProcXvSetPortAttribute(client);
+ }
}
return result;
}
#ifdef MITSHM
-static int
+static int
XineramaXvShmPutImage(ClientPtr client)
{
REQUEST(xvShmPutImageReq);
@@ -1615,41 +1563,41 @@ XineramaXvShmPutImage(ClientPtr client)
REQUEST_SIZE_MATCH(xvShmPutImageReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
- XRT_GC, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
+ XRT_GC, client, DixReadAccess);
if (result != Success)
return result;
- result = dixLookupResourceByType((pointer *)&port, stuff->port,
- XvXRTPort, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &port, stuff->port,
+ XvXRTPort, client, DixReadAccess);
if (result != Success)
- return result;
-
+ return result;
+
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
x = stuff->drw_x;
y = stuff->drw_y;
FOR_NSCREENS_BACKWARD(i) {
- if(port->info[i].id) {
- stuff->drawable = draw->info[i].id;
- stuff->port = port->info[i].id;
- stuff->gc = gc->info[i].id;
- stuff->drw_x = x;
- stuff->drw_y = y;
- if(isRoot) {
- stuff->drw_x -= screenInfo.screens[i]->x;
- stuff->drw_y -= screenInfo.screens[i]->y;
- }
- stuff->send_event = (send_event && !i) ? 1 : 0;
-
- result = ProcXvShmPutImage(client);
- }
+ if (port->info[i].id) {
+ stuff->drawable = draw->info[i].id;
+ stuff->port = port->info[i].id;
+ stuff->gc = gc->info[i].id;
+ stuff->drw_x = x;
+ stuff->drw_y = y;
+ if (isRoot) {
+ stuff->drw_x -= screenInfo.screens[i]->x;
+ stuff->drw_y -= screenInfo.screens[i]->y;
+ }
+ stuff->send_event = (send_event && !i) ? 1 : 0;
+
+ result = ProcXvShmPutImage(client);
+ }
}
return result;
}
@@ -1657,7 +1605,7 @@ XineramaXvShmPutImage(ClientPtr client)
#define XineramaXvShmPutImage ProcXvShmPutImage
#endif
-static int
+static int
XineramaXvPutImage(ClientPtr client)
{
REQUEST(xvPutImageReq);
@@ -1667,40 +1615,40 @@ XineramaXvPutImage(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
- XRT_GC, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
+ XRT_GC, client, DixReadAccess);
if (result != Success)
return result;
- result = dixLookupResourceByType((pointer *)&port, stuff->port,
- XvXRTPort, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &port, stuff->port,
+ XvXRTPort, client, DixReadAccess);
if (result != Success)
- return result;
-
+ return result;
+
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
x = stuff->drw_x;
y = stuff->drw_y;
FOR_NSCREENS_BACKWARD(i) {
- if(port->info[i].id) {
- stuff->drawable = draw->info[i].id;
- stuff->port = port->info[i].id;
- stuff->gc = gc->info[i].id;
- stuff->drw_x = x;
- stuff->drw_y = y;
- if(isRoot) {
- stuff->drw_x -= screenInfo.screens[i]->x;
- stuff->drw_y -= screenInfo.screens[i]->y;
- }
-
- result = ProcXvPutImage(client);
- }
+ if (port->info[i].id) {
+ stuff->drawable = draw->info[i].id;
+ stuff->port = port->info[i].id;
+ stuff->gc = gc->info[i].id;
+ stuff->drw_x = x;
+ stuff->drw_y = y;
+ if (isRoot) {
+ stuff->drw_x -= screenInfo.screens[i]->x;
+ stuff->drw_y -= screenInfo.screens[i]->y;
+ }
+
+ result = ProcXvPutImage(client);
+ }
}
return result;
}
@@ -1715,20 +1663,20 @@ XineramaXvPutVideo(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutVideoReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
- XRT_GC, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
+ XRT_GC, client, DixReadAccess);
if (result != Success)
return result;
- result = dixLookupResourceByType((pointer *)&port, stuff->port,
- XvXRTPort, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &port, stuff->port,
+ XvXRTPort, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1736,18 +1684,18 @@ XineramaXvPutVideo(ClientPtr client)
y = stuff->drw_y;
FOR_NSCREENS_BACKWARD(i) {
- if(port->info[i].id) {
- stuff->drawable = draw->info[i].id;
- stuff->port = port->info[i].id;
- stuff->gc = gc->info[i].id;
- stuff->drw_x = x;
- stuff->drw_y = y;
- if(isRoot) {
+ if (port->info[i].id) {
+ stuff->drawable = draw->info[i].id;
+ stuff->port = port->info[i].id;
+ stuff->gc = gc->info[i].id;
+ stuff->drw_x = x;
+ stuff->drw_y = y;
+ if (isRoot) {
stuff->drw_x -= screenInfo.screens[i]->x;
stuff->drw_y -= screenInfo.screens[i]->y;
- }
+ }
- result = ProcXvPutVideo(client);
+ result = ProcXvPutVideo(client);
}
}
return result;
@@ -1763,20 +1711,20 @@ XineramaXvPutStill(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
- result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
+ return (result == BadValue) ? BadDrawable : result;
- result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
- XRT_GC, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
+ XRT_GC, client, DixReadAccess);
if (result != Success)
return result;
- result = dixLookupResourceByType((pointer *)&port, stuff->port,
- XvXRTPort, client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &port, stuff->port,
+ XvXRTPort, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@@ -1784,18 +1732,18 @@ XineramaXvPutStill(ClientPtr client)
y = stuff->drw_y;
FOR_NSCREENS_BACKWARD(i) {
- if(port->info[i].id) {
- stuff->drawable = draw->info[i].id;
- stuff->port = port->info[i].id;
- stuff->gc = gc->info[i].id;
- stuff->drw_x = x;
- stuff->drw_y = y;
- if(isRoot) {
+ if (port->info[i].id) {
+ stuff->drawable = draw->info[i].id;
+ stuff->port = port->info[i].id;
+ stuff->gc = gc->info[i].id;
+ stuff->drw_x = x;
+ stuff->drw_y = y;
+ if (isRoot) {
stuff->drw_x -= screenInfo.screens[i]->x;
stuff->drw_y -= screenInfo.screens[i]->y;
- }
+ }
- result = ProcXvPutStill(client);
+ result = ProcXvPutStill(client);
}
}
return result;
@@ -1811,9 +1759,10 @@ static Bool
hasOverlay(XvAdaptorPtr pAdapt)
{
int i;
- for(i = 0; i < pAdapt->nAttributes; i++)
- if(!strcmp(pAdapt->pAttributes[i].name, "XV_COLORKEY"))
- return TRUE;
+
+ for (i = 0; i < pAdapt->nAttributes; i++)
+ if (!strcmp(pAdapt->pAttributes[i].name, "XV_COLORKEY"))
+ return TRUE;
return FALSE;
}
@@ -1821,94 +1770,105 @@ static XvAdaptorPtr
matchAdaptor(ScreenPtr pScreen, XvAdaptorPtr refAdapt, Bool isOverlay)
{
int i;
- XvScreenPtr xvsp = dixLookupPrivate(&pScreen->devPrivates, XvGetScreenKey());
+ XvScreenPtr xvsp =
+ dixLookupPrivate(&pScreen->devPrivates, XvGetScreenKey());
/* Do not try to go on if xv is not supported on this screen */
- if(xvsp == NULL)
- return NULL;
+ if (xvsp == NULL)
+ return NULL;
/* if the adaptor has the same name it's a perfect match */
- for(i = 0; i < xvsp->nAdaptors; i++) {
- XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
- if(!strcmp(refAdapt->name, pAdapt->name))
- return pAdapt;
+ for (i = 0; i < xvsp->nAdaptors; i++) {
+ XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
+
+ if (!strcmp(refAdapt->name, pAdapt->name))
+ return pAdapt;
}
/* otherwise we only look for XvImage adaptors */
- if(!isImageAdaptor(refAdapt))
- return NULL;
+ if (!isImageAdaptor(refAdapt))
+ return NULL;
/* prefer overlay/overlay non-overlay/non-overlay pairing */
- for(i = 0; i < xvsp->nAdaptors; i++) {
- XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
- if(isImageAdaptor(pAdapt) && isOverlay == hasOverlay(pAdapt))
- return pAdapt;
+ for (i = 0; i < xvsp->nAdaptors; i++) {
+ XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
+
+ if (isImageAdaptor(pAdapt) && isOverlay == hasOverlay(pAdapt))
+ return pAdapt;
}
/* but we'll take any XvImage pairing if we can get it */
- for(i = 0; i < xvsp->nAdaptors; i++) {
- XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
- if(isImageAdaptor(pAdapt))
- return pAdapt;
+ for (i = 0; i < xvsp->nAdaptors; i++) {
+ XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
+
+ if (isImageAdaptor(pAdapt))
+ return pAdapt;
}
return NULL;
}
-void XineramifyXv(void)
+void
+XineramifyXv(void)
{
- XvScreenPtr xvsp0 = dixLookupPrivate(&screenInfo.screens[0]->devPrivates, XvGetScreenKey());
- XvAdaptorPtr MatchingAdaptors[MAXSCREENS];
- int i, j, k;
-
- XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort");
-
- if (!xvsp0 || !XvXRTPort) return;
- SetResourceTypeErrorValue(XvXRTPort, _XvBadPort);
-
- for(i = 0; i < xvsp0->nAdaptors; i++) {
- Bool isOverlay;
- XvAdaptorPtr refAdapt = xvsp0->pAdaptors + i;
- if(!(refAdapt->type & XvInputMask)) continue;
-
- MatchingAdaptors[0] = refAdapt;
- isOverlay = hasOverlay(refAdapt);
- FOR_NSCREENS_FORWARD_SKIP(j)
- MatchingAdaptors[j] = matchAdaptor(screenInfo.screens[j], refAdapt, isOverlay);
-
- /* now create a resource for each port */
- for(j = 0; j < refAdapt->nPorts; j++) {
- PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
- if(!port)
- break;
-
- FOR_NSCREENS(k) {
- if(MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j))
- port->info[k].id = MatchingAdaptors[k]->base_id + j;
- else
- port->info[k].id = 0;
- }
- AddResource(port->info[0].id, XvXRTPort, port);
- }
- }
+ XvScreenPtr xvsp0 =
+ dixLookupPrivate(&screenInfo.screens[0]->devPrivates, XvGetScreenKey());
+ XvAdaptorPtr MatchingAdaptors[MAXSCREENS];
+ int i, j, k;
+
+ XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort");
+
+ if (!xvsp0 || !XvXRTPort)
+ return;
+ SetResourceTypeErrorValue(XvXRTPort, _XvBadPort);
+
+ for (i = 0; i < xvsp0->nAdaptors; i++) {
+ Bool isOverlay;
+ XvAdaptorPtr refAdapt = xvsp0->pAdaptors + i;
+
+ if (!(refAdapt->type & XvInputMask))
+ continue;
+
+ MatchingAdaptors[0] = refAdapt;
+ isOverlay = hasOverlay(refAdapt);
+ FOR_NSCREENS_FORWARD_SKIP(j)
+ MatchingAdaptors[j] =
+ matchAdaptor(screenInfo.screens[j], refAdapt, isOverlay);
+
+ /* now create a resource for each port */
+ for (j = 0; j < refAdapt->nPorts; j++) {
+ PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
+
+ if (!port)
+ break;
+
+ FOR_NSCREENS(k) {
+ if (MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j))
+ port->info[k].id = MatchingAdaptors[k]->base_id + j;
+ else
+ port->info[k].id = 0;
+ }
+ AddResource(port->info[0].id, XvXRTPort, port);
+ }
+ }
- /* munge the dispatch vector */
- XvProcVector[xv_PutVideo] = XineramaXvPutVideo;
- XvProcVector[xv_PutStill] = XineramaXvPutStill;
- XvProcVector[xv_StopVideo] = XineramaXvStopVideo;
- XvProcVector[xv_SetPortAttribute] = XineramaXvSetPortAttribute;
- XvProcVector[xv_PutImage] = XineramaXvPutImage;
- XvProcVector[xv_ShmPutImage] = XineramaXvShmPutImage;
+ /* munge the dispatch vector */
+ XvProcVector[xv_PutVideo] = XineramaXvPutVideo;
+ XvProcVector[xv_PutStill] = XineramaXvPutStill;
+ XvProcVector[xv_StopVideo] = XineramaXvStopVideo;
+ XvProcVector[xv_SetPortAttribute] = XineramaXvSetPortAttribute;
+ XvProcVector[xv_PutImage] = XineramaXvPutImage;
+ XvProcVector[xv_ShmPutImage] = XineramaXvShmPutImage;
}
-#endif /* PANORAMIX */
+#endif /* PANORAMIX */
void
XvResetProcVector(void)
{
#ifdef PANORAMIX
- XvProcVector[xv_PutVideo] = ProcXvPutVideo;
- XvProcVector[xv_PutStill] = ProcXvPutStill;
- XvProcVector[xv_StopVideo] = ProcXvStopVideo;
- XvProcVector[xv_SetPortAttribute] = ProcXvSetPortAttribute;
- XvProcVector[xv_PutImage] = ProcXvPutImage;
- XvProcVector[xv_ShmPutImage] = ProcXvShmPutImage;
+ XvProcVector[xv_PutVideo] = ProcXvPutVideo;
+ XvProcVector[xv_PutStill] = ProcXvPutStill;
+ XvProcVector[xv_StopVideo] = ProcXvStopVideo;
+ XvProcVector[xv_SetPortAttribute] = ProcXvSetPortAttribute;
+ XvProcVector[xv_PutImage] = ProcXvPutImage;
+ XvProcVector[xv_ShmPutImage] = ProcXvShmPutImage;
#endif
}
diff --git a/xorg-server/Xext/xvdix.h b/xorg-server/Xext/xvdix.h
index e9c22bf65..d22672620 100644
--- a/xorg-server/Xext/xvdix.h
+++ b/xorg-server/Xext/xvdix.h
@@ -73,132 +73,131 @@ extern _X_EXPORT RESTYPE XvRTPortNotify;
#endif
typedef struct {
- int numerator;
- int denominator;
+ int numerator;
+ int denominator;
} XvRationalRec, *XvRationalPtr;
typedef struct {
- char depth;
- unsigned long visual;
+ char depth;
+ unsigned long visual;
} XvFormatRec, *XvFormatPtr;
typedef struct {
- unsigned long id;
- ClientPtr client;
+ unsigned long id;
+ ClientPtr client;
} XvGrabRec, *XvGrabPtr;
typedef struct _XvVideoNotifyRec {
- struct _XvVideoNotifyRec *next;
- ClientPtr client;
- unsigned long id;
- unsigned long mask;
+ struct _XvVideoNotifyRec *next;
+ ClientPtr client;
+ unsigned long id;
+ unsigned long mask;
} XvVideoNotifyRec, *XvVideoNotifyPtr;
typedef struct _XvPortNotifyRec {
- struct _XvPortNotifyRec *next;
- ClientPtr client;
- unsigned long id;
+ struct _XvPortNotifyRec *next;
+ ClientPtr client;
+ unsigned long id;
} XvPortNotifyRec, *XvPortNotifyPtr;
typedef struct {
- int id;
- ScreenPtr pScreen;
- char *name;
- unsigned short width, height;
- XvRationalRec rate;
+ int id;
+ ScreenPtr pScreen;
+ char *name;
+ unsigned short width, height;
+ XvRationalRec rate;
} XvEncodingRec, *XvEncodingPtr;
typedef struct _XvAttributeRec {
- int flags;
- int min_value;
- int max_value;
- char *name;
+ int flags;
+ int min_value;
+ int max_value;
+ char *name;
} XvAttributeRec, *XvAttributePtr;
typedef struct {
- int id;
- int type;
- int byte_order;
- char guid[16];
- int bits_per_pixel;
- int format;
- int num_planes;
-
- /* for RGB formats only */
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
-
- /* for YUV formats only */
- unsigned int y_sample_bits;
- unsigned int u_sample_bits;
- unsigned int v_sample_bits;
- unsigned int horz_y_period;
- unsigned int horz_u_period;
- unsigned int horz_v_period;
- unsigned int vert_y_period;
- unsigned int vert_u_period;
- unsigned int vert_v_period;
- char component_order[32];
- int scanline_order;
-} XvImageRec, *XvImagePtr;
+ int id;
+ int type;
+ int byte_order;
+ char guid[16];
+ int bits_per_pixel;
+ int format;
+ int num_planes;
+
+ /* for RGB formats only */
+ int depth;
+ unsigned int red_mask;
+ unsigned int green_mask;
+ unsigned int blue_mask;
+
+ /* for YUV formats only */
+ unsigned int y_sample_bits;
+ unsigned int u_sample_bits;
+ unsigned int v_sample_bits;
+ unsigned int horz_y_period;
+ unsigned int horz_u_period;
+ unsigned int horz_v_period;
+ unsigned int vert_y_period;
+ unsigned int vert_u_period;
+ unsigned int vert_v_period;
+ char component_order[32];
+ int scanline_order;
+} XvImageRec, *XvImagePtr;
typedef struct {
- unsigned long base_id;
- unsigned char type;
- char *name;
- int nEncodings;
- XvEncodingPtr pEncodings;
- int nFormats;
- XvFormatPtr pFormats;
- int nAttributes;
- XvAttributePtr pAttributes;
- int nImages;
- XvImagePtr pImages;
- int nPorts;
- struct _XvPortRec *pPorts;
- ScreenPtr pScreen;
- int (* ddAllocatePort)(unsigned long, struct _XvPortRec*,
- struct _XvPortRec**);
- int (* ddFreePort)(struct _XvPortRec*);
- int (* ddPutVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
- int (* ddPutStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
- int (* ddGetVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
- int (* ddGetStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
- int (* ddStopVideo)(ClientPtr, struct _XvPortRec*, DrawablePtr);
- int (* ddSetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32);
- int (* ddGetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32*);
- int (* ddQueryBestSize)(ClientPtr, struct _XvPortRec*, CARD8,
- CARD16, CARD16,CARD16, CARD16,
- unsigned int*, unsigned int*);
- int (* ddPutImage)(ClientPtr, DrawablePtr, struct _XvPortRec*, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16,
- XvImagePtr, unsigned char*, Bool,
- CARD16, CARD16);
- int (* ddQueryImageAttributes)(ClientPtr, struct _XvPortRec*, XvImagePtr,
- CARD16*, CARD16*, int*, int*);
- DevUnion devPriv;
+ unsigned long base_id;
+ unsigned char type;
+ char *name;
+ int nEncodings;
+ XvEncodingPtr pEncodings;
+ int nFormats;
+ XvFormatPtr pFormats;
+ int nAttributes;
+ XvAttributePtr pAttributes;
+ int nImages;
+ XvImagePtr pImages;
+ int nPorts;
+ struct _XvPortRec *pPorts;
+ ScreenPtr pScreen;
+ int (*ddAllocatePort) (unsigned long, struct _XvPortRec *,
+ struct _XvPortRec **);
+ int (*ddFreePort) (struct _XvPortRec *);
+ int (*ddPutVideo) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+ int (*ddPutStill) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+ int (*ddGetVideo) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+ int (*ddGetStill) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+ int (*ddStopVideo) (ClientPtr, struct _XvPortRec *, DrawablePtr);
+ int (*ddSetPortAttribute) (ClientPtr, struct _XvPortRec *, Atom, INT32);
+ int (*ddGetPortAttribute) (ClientPtr, struct _XvPortRec *, Atom, INT32 *);
+ int (*ddQueryBestSize) (ClientPtr, struct _XvPortRec *, CARD8,
+ CARD16, CARD16, CARD16, CARD16,
+ unsigned int *, unsigned int *);
+ int (*ddPutImage) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
+ XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
+ int (*ddQueryImageAttributes) (ClientPtr, struct _XvPortRec *, XvImagePtr,
+ CARD16 *, CARD16 *, int *, int *);
+ DevUnion devPriv;
} XvAdaptorRec, *XvAdaptorPtr;
typedef struct _XvPortRec {
- unsigned long id;
- XvAdaptorPtr pAdaptor;
- XvPortNotifyPtr pNotify;
- DrawablePtr pDraw;
- ClientPtr client;
- XvGrabRec grab;
- TimeStamp time;
- DevUnion devPriv;
+ unsigned long id;
+ XvAdaptorPtr pAdaptor;
+ XvPortNotifyPtr pNotify;
+ DrawablePtr pDraw;
+ ClientPtr client;
+ XvGrabRec grab;
+ TimeStamp time;
+ DevUnion devPriv;
} XvPortRec, *XvPortPtr;
#define VALIDATE_XV_PORT(portID, pPort, mode)\
@@ -210,15 +209,15 @@ typedef struct _XvPortRec {
}
typedef struct {
- int version, revision;
- int nAdaptors;
- XvAdaptorPtr pAdaptors;
- DestroyWindowProcPtr DestroyWindow;
- DestroyPixmapProcPtr DestroyPixmap;
- CloseScreenProcPtr CloseScreen;
- Bool (* ddCloseScreen)(int, ScreenPtr);
- int (* ddQueryAdaptors)(ScreenPtr, XvAdaptorPtr*, int*);
- DevUnion devPriv;
+ int version, revision;
+ int nAdaptors;
+ XvAdaptorPtr pAdaptors;
+ DestroyWindowProcPtr DestroyWindow;
+ DestroyPixmapProcPtr DestroyPixmap;
+ CloseScreenProcPtr CloseScreen;
+ Bool (*ddCloseScreen) (int, ScreenPtr);
+ int (*ddQueryAdaptors) (ScreenPtr, XvAdaptorPtr *, int *);
+ DevUnion devPriv;
} XvScreenRec, *XvScreenPtr;
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
@@ -244,32 +243,31 @@ extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
extern _X_EXPORT int XvdiVideoStopped(XvPortPtr, int);
extern _X_EXPORT int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16,
- XvImagePtr, unsigned char*, Bool,
- CARD16, CARD16);
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
+ XvImagePtr, unsigned char *, Bool,
+ CARD16, CARD16);
extern _X_EXPORT int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL);
extern _X_EXPORT int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL);
extern _X_EXPORT int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
-extern _X_EXPORT int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*);
+extern _X_EXPORT int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
extern _X_EXPORT int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiMatchPort(XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
-extern _X_EXPORT int XvdiUngrabPort( ClientPtr, XvPortPtr, Time);
-#endif /* XorgLoader */
-
-#endif /* XVDIX_H */
+extern _X_EXPORT int XvdiUngrabPort(ClientPtr, XvPortPtr, Time);
+#endif /* XorgLoader */
+#endif /* XVDIX_H */
diff --git a/xorg-server/Xext/xvmain.c b/xorg-server/Xext/xvmain.c
index a530a1b77..28f2a56df 100644
--- a/xorg-server/Xext/xvmain.c
+++ b/xorg-server/Xext/xvmain.c
@@ -106,6 +106,7 @@ SOFTWARE.
#include "xvdisp.h"
static DevPrivateKeyRec XvScreenKeyRec;
+
#define XvScreenKey (&XvScreenKeyRec)
unsigned long XvExtensionGeneration = 0;
unsigned long XvScreenGeneration = 0;
@@ -131,7 +132,7 @@ static Bool CreateResourceTypes(void);
static Bool XvCloseScreen(int, ScreenPtr);
static Bool XvDestroyPixmap(PixmapPtr);
static Bool XvDestroyWindow(WindowPtr);
-static void XvResetProc(ExtensionEntry*);
+static void XvResetProc(ExtensionEntry *);
static int XvdiDestroyGrab(pointer, XID);
static int XvdiDestroyEncoding(pointer, XID);
static int XvdiDestroyVideoNotify(pointer, XID);
@@ -140,9 +141,6 @@ static int XvdiDestroyVideoNotifyList(pointer, XID);
static int XvdiDestroyPort(pointer, XID);
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
-
-
-
/*
** XvExtensionInit
**
@@ -152,179 +150,168 @@ static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
void
XvExtensionInit(void)
{
- ExtensionEntry *extEntry;
-
- if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
- return;
-
- /* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN
- INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */
- if (XvScreenGeneration != serverGeneration)
- {
- if (!CreateResourceTypes())
- {
- ErrorF("XvExtensionInit: Unable to allocate resource types\n");
- return;
- }
+ ExtensionEntry *extEntry;
+
+ if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
+ return;
+
+ /* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN
+ INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */
+ if (XvScreenGeneration != serverGeneration) {
+ if (!CreateResourceTypes()) {
+ ErrorF("XvExtensionInit: Unable to allocate resource types\n");
+ return;
+ }
#ifdef PANORAMIX
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif
- XvScreenGeneration = serverGeneration;
+ XvScreenGeneration = serverGeneration;
}
- if (XvExtensionGeneration != serverGeneration)
- {
- XvExtensionGeneration = serverGeneration;
+ if (XvExtensionGeneration != serverGeneration) {
+ XvExtensionGeneration = serverGeneration;
- extEntry = AddExtension(XvName, XvNumEvents, XvNumErrors,
- ProcXvDispatch, SProcXvDispatch,
- XvResetProc, StandardMinorOpcode);
- if (!extEntry)
- {
- FatalError("XvExtensionInit: AddExtensions failed\n");
- }
+ extEntry = AddExtension(XvName, XvNumEvents, XvNumErrors,
+ ProcXvDispatch, SProcXvDispatch,
+ XvResetProc, StandardMinorOpcode);
+ if (!extEntry) {
+ FatalError("XvExtensionInit: AddExtensions failed\n");
+ }
- XvReqCode = extEntry->base;
- XvEventBase = extEntry->eventBase;
- XvErrorBase = extEntry->errorBase;
+ XvReqCode = extEntry->base;
+ XvEventBase = extEntry->eventBase;
+ XvErrorBase = extEntry->errorBase;
- EventSwapVector[XvEventBase+XvVideoNotify] =
- (EventSwapPtr)WriteSwappedVideoNotifyEvent;
- EventSwapVector[XvEventBase+XvPortNotify] =
- (EventSwapPtr)WriteSwappedPortNotifyEvent;
+ EventSwapVector[XvEventBase + XvVideoNotify] =
+ (EventSwapPtr) WriteSwappedVideoNotifyEvent;
+ EventSwapVector[XvEventBase + XvPortNotify] =
+ (EventSwapPtr) WriteSwappedPortNotifyEvent;
- SetResourceTypeErrorValue(XvRTPort, _XvBadPort);
- (void)MakeAtom(XvName, strlen(XvName), xTrue);
+ SetResourceTypeErrorValue(XvRTPort, _XvBadPort);
+ (void) MakeAtom(XvName, strlen(XvName), xTrue);
}
}
static Bool
CreateResourceTypes(void)
-
{
-
- if (XvResourceGeneration == serverGeneration) return TRUE;
- XvResourceGeneration = serverGeneration;
+ if (XvResourceGeneration == serverGeneration)
+ return TRUE;
+
+ XvResourceGeneration = serverGeneration;
- if (!(XvRTPort = CreateNewResourceType(XvdiDestroyPort, "XvRTPort")))
- {
- ErrorF("CreateResourceTypes: failed to allocate port resource.\n");
- return FALSE;
+ if (!(XvRTPort = CreateNewResourceType(XvdiDestroyPort, "XvRTPort"))) {
+ ErrorF("CreateResourceTypes: failed to allocate port resource.\n");
+ return FALSE;
}
- if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab, "XvRTGrab")))
- {
- ErrorF("CreateResourceTypes: failed to allocate grab resource.\n");
- return FALSE;
+ if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab, "XvRTGrab"))) {
+ ErrorF("CreateResourceTypes: failed to allocate grab resource.\n");
+ return FALSE;
}
- if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding,
- "XvRTEncoding")))
- {
- ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n");
- return FALSE;
+ if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding,
+ "XvRTEncoding"))) {
+ ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n");
+ return FALSE;
}
- if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify,
- "XvRTVideoNotify")))
- {
- ErrorF("CreateResourceTypes: failed to allocate video notify resource.\n");
- return FALSE;
+ if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify,
+ "XvRTVideoNotify"))) {
+ ErrorF
+ ("CreateResourceTypes: failed to allocate video notify resource.\n");
+ return FALSE;
}
- if (!(XvRTVideoNotifyList = CreateNewResourceType(XvdiDestroyVideoNotifyList,
- "XvRTVideoNotifyList")))
- {
- ErrorF("CreateResourceTypes: failed to allocate video notify list resource.\n");
- return FALSE;
+ if (!
+ (XvRTVideoNotifyList =
+ CreateNewResourceType(XvdiDestroyVideoNotifyList,
+ "XvRTVideoNotifyList"))) {
+ ErrorF
+ ("CreateResourceTypes: failed to allocate video notify list resource.\n");
+ return FALSE;
}
- if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify,
- "XvRTPortNotify")))
- {
- ErrorF("CreateResourceTypes: failed to allocate port notify resource.\n");
- return FALSE;
+ if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify,
+ "XvRTPortNotify"))) {
+ ErrorF
+ ("CreateResourceTypes: failed to allocate port notify resource.\n");
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
int
XvScreenInit(ScreenPtr pScreen)
{
- XvScreenPtr pxvs;
-
- if (XvScreenGeneration != serverGeneration)
- {
- if (!CreateResourceTypes())
- {
- ErrorF("XvScreenInit: Unable to allocate resource types\n");
- return BadAlloc;
- }
+ XvScreenPtr pxvs;
+
+ if (XvScreenGeneration != serverGeneration) {
+ if (!CreateResourceTypes()) {
+ ErrorF("XvScreenInit: Unable to allocate resource types\n");
+ return BadAlloc;
+ }
#ifdef PANORAMIX
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif
- XvScreenGeneration = serverGeneration;
+ XvScreenGeneration = serverGeneration;
}
- if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
- return BadAlloc;
+ if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
+ return BadAlloc;
- if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey))
- {
- ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
+ if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey)) {
+ ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
}
- /* ALLOCATE SCREEN PRIVATE RECORD */
-
- pxvs = calloc (1,sizeof (XvScreenRec));
- if (!pxvs)
- {
- ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
- return BadAlloc;
+ /* ALLOCATE SCREEN PRIVATE RECORD */
+
+ pxvs = calloc(1,sizeof(XvScreenRec));
+ if (!pxvs) {
+ ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
+ return BadAlloc;
}
- dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
-
- pxvs->DestroyPixmap = pScreen->DestroyPixmap;
- pxvs->DestroyWindow = pScreen->DestroyWindow;
- pxvs->CloseScreen = pScreen->CloseScreen;
-
- pScreen->DestroyPixmap = XvDestroyPixmap;
- pScreen->DestroyWindow = XvDestroyWindow;
- pScreen->CloseScreen = XvCloseScreen;
-
- return Success;
+ dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
+
+ pxvs->DestroyPixmap = pScreen->DestroyPixmap;
+ pxvs->DestroyWindow = pScreen->DestroyWindow;
+ pxvs->CloseScreen = pScreen->CloseScreen;
+
+ pScreen->DestroyPixmap = XvDestroyPixmap;
+ pScreen->DestroyWindow = XvDestroyWindow;
+ pScreen->CloseScreen = XvCloseScreen;
+
+ return Success;
}
static Bool
-XvCloseScreen(
- int ii,
- ScreenPtr pScreen
-){
+XvCloseScreen(int ii, ScreenPtr pScreen)
+{
- XvScreenPtr pxvs;
+ XvScreenPtr pxvs;
- pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
+ pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
- pScreen->DestroyPixmap = pxvs->DestroyPixmap;
- pScreen->DestroyWindow = pxvs->DestroyWindow;
- pScreen->CloseScreen = pxvs->CloseScreen;
+ pScreen->DestroyPixmap = pxvs->DestroyPixmap;
+ pScreen->DestroyWindow = pxvs->DestroyWindow;
+ pScreen->CloseScreen = pxvs->CloseScreen;
- if (pxvs->ddCloseScreen) (* pxvs->ddCloseScreen)(ii, pScreen);
+ if (pxvs->ddCloseScreen) (*pxvs->ddCloseScreen) (ii, pScreen);
- free(pxvs);
+ free(pxvs);
- dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
+ dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
- return (*pScreen->CloseScreen)(ii, pScreen);
+ return (*pScreen->CloseScreen) (ii, pScreen);
}
static void
-XvResetProc(ExtensionEntry* extEntry)
+XvResetProc(ExtensionEntry * extEntry)
{
XvResetProcVector();
}
@@ -338,109 +325,102 @@ XvGetScreenKey(void)
unsigned long
XvGetRTPort(void)
{
- return XvRTPort;
+ return XvRTPort;
}
static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
- Bool status;
- ScreenPtr pScreen;
- XvScreenPtr pxvs;
- XvAdaptorPtr pa;
- int na;
- XvPortPtr pp;
- int np;
-
- pScreen = pPix->drawable.pScreen;
-
- SCREEN_PROLOGUE(pScreen, DestroyPixmap);
-
- pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
-
- /* CHECK TO SEE IF THIS PORT IS IN USE */
-
- pa = pxvs->pAdaptors;
- na = pxvs->nAdaptors;
- while (na--)
- {
- np = pa->nPorts;
- pp = pa->pPorts;
-
- while (np--)
- {
- if (pp->pDraw == (DrawablePtr)pPix)
- {
- XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
-
- (void)(* pp->pAdaptor->ddStopVideo)(NULL, pp, pp->pDraw);
-
- pp->pDraw = NULL;
- pp->client = NULL;
- pp->time = currentTime;
- }
- pp++;
- }
- pa++;
+ Bool status;
+ ScreenPtr pScreen;
+ XvScreenPtr pxvs;
+ XvAdaptorPtr pa;
+ int na;
+ XvPortPtr pp;
+ int np;
+
+ pScreen = pPix->drawable.pScreen;
+
+ SCREEN_PROLOGUE(pScreen, DestroyPixmap);
+
+ pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
+
+ /* CHECK TO SEE IF THIS PORT IS IN USE */
+
+ pa = pxvs->pAdaptors;
+ na = pxvs->nAdaptors;
+ while (na--) {
+ np = pa->nPorts;
+ pp = pa->pPorts;
+
+ while (np--) {
+ if (pp->pDraw == (DrawablePtr) pPix) {
+ XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
+
+ (void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
+
+ pp->pDraw = NULL;
+ pp->client = NULL;
+ pp->time = currentTime;
+ }
+ pp++;
+ }
+ pa++;
}
-
- status = (* pScreen->DestroyPixmap)(pPix);
- SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
+ status = (*pScreen->DestroyPixmap) (pPix);
+
+ SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
- return status;
+ return status;
}
static Bool
XvDestroyWindow(WindowPtr pWin)
{
- Bool status;
- ScreenPtr pScreen;
- XvScreenPtr pxvs;
- XvAdaptorPtr pa;
- int na;
- XvPortPtr pp;
- int np;
-
- pScreen = pWin->drawable.pScreen;
-
- SCREEN_PROLOGUE(pScreen, DestroyWindow);
-
- pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
-
- /* CHECK TO SEE IF THIS PORT IS IN USE */
-
- pa = pxvs->pAdaptors;
- na = pxvs->nAdaptors;
- while (na--)
- {
- np = pa->nPorts;
- pp = pa->pPorts;
-
- while (np--)
- {
- if (pp->pDraw == (DrawablePtr)pWin)
- {
- XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
-
- (void)(* pp->pAdaptor->ddStopVideo)(NULL, pp, pp->pDraw);
-
- pp->pDraw = NULL;
- pp->client = NULL;
- pp->time = currentTime;
- }
- pp++;
- }
- pa++;
+ Bool status;
+ ScreenPtr pScreen;
+ XvScreenPtr pxvs;
+ XvAdaptorPtr pa;
+ int na;
+ XvPortPtr pp;
+ int np;
+
+ pScreen = pWin->drawable.pScreen;
+
+ SCREEN_PROLOGUE(pScreen, DestroyWindow);
+
+ pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
+
+ /* CHECK TO SEE IF THIS PORT IS IN USE */
+
+ pa = pxvs->pAdaptors;
+ na = pxvs->nAdaptors;
+ while (na--) {
+ np = pa->nPorts;
+ pp = pa->pPorts;
+
+ while (np--) {
+ if (pp->pDraw == (DrawablePtr) pWin) {
+ XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
+
+ (void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
+
+ pp->pDraw = NULL;
+ pp->client = NULL;
+ pp->time = currentTime;
+ }
+ pp++;
+ }
+ pa++;
}
-
- status = (* pScreen->DestroyWindow)(pWin);
+ status = (*pScreen->DestroyWindow) (pWin);
- SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
+ SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
- return status;
+ return status;
}
@@ -452,129 +432,123 @@ XvDestroyWindow(WindowPtr pWin)
int
XvdiVideoStopped(XvPortPtr pPort, int reason)
{
-
- /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
- if (!pPort->pDraw) return Success;
+ /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
- XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
+ if (!pPort->pDraw)
+ return Success;
- pPort->pDraw = NULL;
- pPort->client = NULL;
- pPort->time = currentTime;
+ XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
- return Success;
+ pPort->pDraw = NULL;
+ pPort->client = NULL;
+ pPort->time = currentTime;
+
+ return Success;
}
-static int
+static int
XvdiDestroyPort(pointer pPort, XID id)
{
- return (* ((XvPortPtr)pPort)->pAdaptor->ddFreePort)(pPort);
+ return (*((XvPortPtr) pPort)->pAdaptor->ddFreePort) (pPort);
}
static int
XvdiDestroyGrab(pointer pGrab, XID id)
{
- ((XvGrabPtr)pGrab)->client = NULL;
- return Success;
+ ((XvGrabPtr) pGrab)->client = NULL;
+ return Success;
}
static int
XvdiDestroyVideoNotify(pointer pn, XID id)
{
- /* JUST CLEAR OUT THE client POINTER FIELD */
+ /* JUST CLEAR OUT THE client POINTER FIELD */
- ((XvVideoNotifyPtr)pn)->client = NULL;
- return Success;
+ ((XvVideoNotifyPtr) pn)->client = NULL;
+ return Success;
}
static int
XvdiDestroyPortNotify(pointer pn, XID id)
{
- /* JUST CLEAR OUT THE client POINTER FIELD */
+ /* JUST CLEAR OUT THE client POINTER FIELD */
- ((XvPortNotifyPtr)pn)->client = NULL;
- return Success;
+ ((XvPortNotifyPtr) pn)->client = NULL;
+ return Success;
}
static int
XvdiDestroyVideoNotifyList(pointer pn, XID id)
{
- XvVideoNotifyPtr npn,cpn;
+ XvVideoNotifyPtr npn, cpn;
- /* ACTUALLY DESTROY THE NOTITY LIST */
+ /* ACTUALLY DESTROY THE NOTITY LIST */
- cpn = (XvVideoNotifyPtr)pn;
+ cpn = (XvVideoNotifyPtr) pn;
- while (cpn)
- {
- npn = cpn->next;
- if (cpn->client) FreeResource(cpn->id, XvRTVideoNotify);
- free(cpn);
- cpn = npn;
+ while (cpn) {
+ npn = cpn->next;
+ if (cpn->client)
+ FreeResource(cpn->id, XvRTVideoNotify);
+ free(cpn);
+ cpn = npn;
}
- return Success;
+ return Success;
}
static int
XvdiDestroyEncoding(pointer value, XID id)
{
- return Success;
+ return Success;
}
static int
XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
{
- xvEvent event;
- XvVideoNotifyPtr pn;
-
- dixLookupResourceByType((pointer *)&pn, pDraw->id, XvRTVideoNotifyList,
- serverClient, DixReadAccess);
-
- while (pn)
- {
- event.u.u.type = XvEventBase + XvVideoNotify;
- event.u.videoNotify.time = currentTime.milliseconds;
- event.u.videoNotify.drawable = pDraw->id;
- event.u.videoNotify.port = pPort->id;
- event.u.videoNotify.reason = reason;
- WriteEventsToClient(pn->client, 1, (xEventPtr)&event);
- pn = pn->next;
+ xvEvent event;
+ XvVideoNotifyPtr pn;
+
+ dixLookupResourceByType((pointer *) &pn, pDraw->id, XvRTVideoNotifyList,
+ serverClient, DixReadAccess);
+
+ while (pn) {
+ event.u.u.type = XvEventBase + XvVideoNotify;
+ event.u.videoNotify.time = currentTime.milliseconds;
+ event.u.videoNotify.drawable = pDraw->id;
+ event.u.videoNotify.port = pPort->id;
+ event.u.videoNotify.reason = reason;
+ WriteEventsToClient(pn->client, 1, (xEventPtr) & event);
+ pn = pn->next;
}
- return Success;
+ return Success;
}
-
int
-XvdiSendPortNotify(
- XvPortPtr pPort,
- Atom attribute,
- INT32 value
-){
- xvEvent event;
- XvPortNotifyPtr pn;
-
- pn = pPort->pNotify;
-
- while (pn)
- {
- event.u.u.type = XvEventBase + XvPortNotify;
- event.u.portNotify.time = currentTime.milliseconds;
- event.u.portNotify.port = pPort->id;
- event.u.portNotify.attribute = attribute;
- event.u.portNotify.value = value;
- WriteEventsToClient(pn->client, 1, (xEventPtr)&event);
- pn = pn->next;
+XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
+{
+ xvEvent event;
+ XvPortNotifyPtr pn;
+
+ pn = pPort->pNotify;
+
+ while (pn) {
+ event.u.u.type = XvEventBase + XvPortNotify;
+ event.u.portNotify.time = currentTime.milliseconds;
+ event.u.portNotify.port = pPort->id;
+ event.u.portNotify.attribute = attribute;
+ event.u.portNotify.value = value;
+ WriteEventsToClient(pn->client, 1, (xEventPtr) & event);
+ pn = pn->next;
}
- return Success;
+ return Success;
}
-
#define CHECK_SIZE(dw, dh, sw, sh) { \
if(!dw || !dh || !sw || !sh) return Success; \
/* The region code will break these if they are too large */ \
@@ -582,597 +556,535 @@ XvdiSendPortNotify(
return BadValue; \
}
-
int
-XvdiPutVideo(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- DrawablePtr pOldDraw;
-
- CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
-
- /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
-
- UpdateCurrentTime();
-
- /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
- INFORM CLIENT OF ITS FAILURE */
-
- if (pPort->grab.client && (pPort->grab.client != client))
- {
- XvdiSendVideoNotify(pPort, pDraw, XvBusy);
- return Success;
+XvdiPutVideo(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ DrawablePtr pOldDraw;
+
+ CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
+
+ /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
+
+ UpdateCurrentTime();
+
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
+
+ if (pPort->grab.client && (pPort->grab.client != client)) {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
}
- /* CHECK TO SEE IF PORT IS IN USE; IF SO THEN WE MUST DELIVER INTERRUPTED
- EVENTS TO ANY CLIENTS WHO WANT THEM */
+ /* CHECK TO SEE IF PORT IS IN USE; IF SO THEN WE MUST DELIVER INTERRUPTED
+ EVENTS TO ANY CLIENTS WHO WANT THEM */
- pOldDraw = pPort->pDraw;
- if ((pOldDraw) && (pOldDraw != pDraw))
- {
- XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
+ pOldDraw = pPort->pDraw;
+ if ((pOldDraw) && (pOldDraw != pDraw)) {
+ XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
}
- (void) (* pPort->pAdaptor->ddPutVideo)(client, pDraw, pPort, pGC,
- vid_x, vid_y, vid_w, vid_h,
- drw_x, drw_y, drw_w, drw_h);
+ (void) (*pPort->pAdaptor->ddPutVideo) (client, pDraw, pPort, pGC,
+ vid_x, vid_y, vid_w, vid_h,
+ drw_x, drw_y, drw_w, drw_h);
- if ((pPort->pDraw) && (pOldDraw != pDraw))
- {
- pPort->client = client;
- XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
+ if ((pPort->pDraw) && (pOldDraw != pDraw)) {
+ pPort->client = client;
+ XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
}
- pPort->time = currentTime;
+ pPort->time = currentTime;
- return Success;
+ return Success;
}
int
-XvdiPutStill(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- int status;
-
- CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
-
- /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
-
- UpdateCurrentTime();
-
- /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
- INFORM CLIENT OF ITS FAILURE */
-
- if (pPort->grab.client && (pPort->grab.client != client))
- {
- XvdiSendVideoNotify(pPort, pDraw, XvBusy);
- return Success;
+XvdiPutStill(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ int status;
+
+ CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
+
+ /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
+
+ UpdateCurrentTime();
+
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
+
+ if (pPort->grab.client && (pPort->grab.client != client)) {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
}
- pPort->time = currentTime;
+ pPort->time = currentTime;
- status = (* pPort->pAdaptor->ddPutStill)(client, pDraw, pPort, pGC,
- vid_x, vid_y, vid_w, vid_h,
- drw_x, drw_y, drw_w, drw_h);
+ status = (*pPort->pAdaptor->ddPutStill) (client, pDraw, pPort, pGC,
+ vid_x, vid_y, vid_w, vid_h,
+ drw_x, drw_y, drw_w, drw_h);
- return status;
+ return status;
}
int
-XvdiPutImage(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 src_x, INT16 src_y,
- CARD16 src_w, CARD16 src_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h,
- XvImagePtr image,
- unsigned char* data,
- Bool sync,
- CARD16 width, CARD16 height
-){
- CHECK_SIZE(drw_w, drw_h, src_w, src_h);
-
- /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
-
- UpdateCurrentTime();
-
- /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
- INFORM CLIENT OF ITS FAILURE */
-
- if (pPort->grab.client && (pPort->grab.client != client))
- {
- XvdiSendVideoNotify(pPort, pDraw, XvBusy);
- return Success;
+XvdiPutImage(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 src_x, INT16 src_y,
+ CARD16 src_w, CARD16 src_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h,
+ XvImagePtr image,
+ unsigned char *data, Bool sync, CARD16 width, CARD16 height)
+{
+ CHECK_SIZE(drw_w, drw_h, src_w, src_h);
+
+ /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
+
+ UpdateCurrentTime();
+
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
+
+ if (pPort->grab.client && (pPort->grab.client != client)) {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
}
- pPort->time = currentTime;
+ pPort->time = currentTime;
- return (* pPort->pAdaptor->ddPutImage)(client, pDraw, pPort, pGC,
- src_x, src_y, src_w, src_h,
- drw_x, drw_y, drw_w, drw_h,
- image, data, sync, width, height);
+ return (*pPort->pAdaptor->ddPutImage) (client, pDraw, pPort, pGC,
+ src_x, src_y, src_w, src_h,
+ drw_x, drw_y, drw_w, drw_h,
+ image, data, sync, width, height);
}
-
int
-XvdiGetVideo(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- DrawablePtr pOldDraw;
-
- CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
-
- /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
-
- UpdateCurrentTime();
-
- /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
- INFORM CLIENT OF ITS FAILURE */
-
- if (pPort->grab.client && (pPort->grab.client != client))
- {
- XvdiSendVideoNotify(pPort, pDraw, XvBusy);
- return Success;
+XvdiGetVideo(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ DrawablePtr pOldDraw;
+
+ CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
+
+ /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
+
+ UpdateCurrentTime();
+
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
+
+ if (pPort->grab.client && (pPort->grab.client != client)) {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
}
- /* CHECK TO SEE IF PORT IS IN USE; IF SO THEN WE MUST DELIVER INTERRUPTED
- EVENTS TO ANY CLIENTS WHO WANT THEM */
+ /* CHECK TO SEE IF PORT IS IN USE; IF SO THEN WE MUST DELIVER INTERRUPTED
+ EVENTS TO ANY CLIENTS WHO WANT THEM */
- pOldDraw = pPort->pDraw;
- if ((pOldDraw) && (pOldDraw != pDraw))
- {
- XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
+ pOldDraw = pPort->pDraw;
+ if ((pOldDraw) && (pOldDraw != pDraw)) {
+ XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
}
- (void) (* pPort->pAdaptor->ddGetVideo)(client, pDraw, pPort, pGC,
- vid_x, vid_y, vid_w, vid_h,
- drw_x, drw_y, drw_w, drw_h);
+ (void) (*pPort->pAdaptor->ddGetVideo) (client, pDraw, pPort, pGC,
+ vid_x, vid_y, vid_w, vid_h,
+ drw_x, drw_y, drw_w, drw_h);
- if ((pPort->pDraw) && (pOldDraw != pDraw))
- {
- pPort->client = client;
- XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
+ if ((pPort->pDraw) && (pOldDraw != pDraw)) {
+ pPort->client = client;
+ XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
}
- pPort->time = currentTime;
+ pPort->time = currentTime;
- return Success;
+ return Success;
}
int
-XvdiGetStill(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- int status;
-
- CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
-
- /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
-
- UpdateCurrentTime();
-
- /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
- INFORM CLIENT OF ITS FAILURE */
-
- if (pPort->grab.client && (pPort->grab.client != client))
- {
- XvdiSendVideoNotify(pPort, pDraw, XvBusy);
- return Success;
+XvdiGetStill(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ int status;
+
+ CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
+
+ /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
+
+ UpdateCurrentTime();
+
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
+
+ if (pPort->grab.client && (pPort->grab.client != client)) {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
}
- status = (* pPort->pAdaptor->ddGetStill)(client, pDraw, pPort, pGC,
- vid_x, vid_y, vid_w, vid_h,
- drw_x, drw_y, drw_w, drw_h);
+ status = (*pPort->pAdaptor->ddGetStill) (client, pDraw, pPort, pGC,
+ vid_x, vid_y, vid_w, vid_h,
+ drw_x, drw_y, drw_w, drw_h);
- pPort->time = currentTime;
+ pPort->time = currentTime;
- return status;
+ return status;
}
int
-XvdiGrabPort(
- ClientPtr client,
- XvPortPtr pPort,
- Time ctime,
- int *p_result
-){
- unsigned long id;
- TimeStamp time;
-
- UpdateCurrentTime();
- time = ClientTimeToServerTime(ctime);
-
- if (pPort->grab.client && (client != pPort->grab.client))
- {
- *p_result = XvAlreadyGrabbed;
- return Success;
+XvdiGrabPort(ClientPtr client, XvPortPtr pPort, Time ctime, int *p_result)
+{
+ unsigned long id;
+ TimeStamp time;
+
+ UpdateCurrentTime();
+ time = ClientTimeToServerTime(ctime);
+
+ if (pPort->grab.client && (client != pPort->grab.client)) {
+ *p_result = XvAlreadyGrabbed;
+ return Success;
}
- if ((CompareTimeStamps(time, currentTime) == LATER) ||
- (CompareTimeStamps(time, pPort->time) == EARLIER))
- {
- *p_result = XvInvalidTime;
- return Success;
+ if ((CompareTimeStamps(time, currentTime) == LATER) ||
+ (CompareTimeStamps(time, pPort->time) == EARLIER)) {
+ *p_result = XvInvalidTime;
+ return Success;
}
- if (client == pPort->grab.client)
- {
- *p_result = Success;
- return Success;
+ if (client == pPort->grab.client) {
+ *p_result = Success;
+ return Success;
}
- id = FakeClientID(client->index);
+ id = FakeClientID(client->index);
- if (!AddResource(id, XvRTGrab, &pPort->grab))
- {
- return BadAlloc;
+ if (!AddResource(id, XvRTGrab, &pPort->grab)) {
+ return BadAlloc;
}
- /* IF THERE IS ACTIVE VIDEO THEN STOP IT */
+ /* IF THERE IS ACTIVE VIDEO THEN STOP IT */
- if ((pPort->pDraw) && (client != pPort->client))
- {
- XvdiStopVideo(NULL, pPort, pPort->pDraw);
+ if ((pPort->pDraw) && (client != pPort->client)) {
+ XvdiStopVideo(NULL, pPort, pPort->pDraw);
}
- pPort->grab.client = client;
- pPort->grab.id = id;
+ pPort->grab.client = client;
+ pPort->grab.id = id;
- pPort->time = currentTime;
+ pPort->time = currentTime;
- *p_result = Success;
+ *p_result = Success;
- return Success;
+ return Success;
}
int
-XvdiUngrabPort(
- ClientPtr client,
- XvPortPtr pPort,
- Time ctime
-){
- TimeStamp time;
-
- UpdateCurrentTime();
- time = ClientTimeToServerTime(ctime);
-
- if ((!pPort->grab.client) || (client != pPort->grab.client))
- {
- return Success;
+XvdiUngrabPort(ClientPtr client, XvPortPtr pPort, Time ctime)
+{
+ TimeStamp time;
+
+ UpdateCurrentTime();
+ time = ClientTimeToServerTime(ctime);
+
+ if ((!pPort->grab.client) || (client != pPort->grab.client)) {
+ return Success;
}
- if ((CompareTimeStamps(time, currentTime) == LATER) ||
- (CompareTimeStamps(time, pPort->time) == EARLIER))
- {
- return Success;
+ if ((CompareTimeStamps(time, currentTime) == LATER) ||
+ (CompareTimeStamps(time, pPort->time) == EARLIER)) {
+ return Success;
}
- /* FREE THE GRAB RESOURCE; AND SET THE GRAB CLIENT TO NULL */
+ /* FREE THE GRAB RESOURCE; AND SET THE GRAB CLIENT TO NULL */
- FreeResource(pPort->grab.id, XvRTGrab);
- pPort->grab.client = NULL;
+ FreeResource(pPort->grab.id, XvRTGrab);
+ pPort->grab.client = NULL;
- pPort->time = currentTime;
+ pPort->time = currentTime;
- return Success;
+ return Success;
}
-
int
-XvdiSelectVideoNotify(
- ClientPtr client,
- DrawablePtr pDraw,
- BOOL onoff
-){
- XvVideoNotifyPtr pn,tpn,fpn;
- int rc;
-
- /* FIND VideoNotify LIST */
-
- rc = dixLookupResourceByType((pointer *)&pn, pDraw->id, XvRTVideoNotifyList,
- client, DixWriteAccess);
- if (rc != Success && rc != BadValue)
- return rc;
-
- /* IF ONE DONES'T EXIST AND NO MASK, THEN JUST RETURN */
-
- if (!onoff && !pn) return Success;
-
- /* IF ONE DOESN'T EXIST CREATE IT AND ADD A RESOURCE SO THAT THE LIST
- WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */
-
- if (!pn)
- {
- if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
- return BadAlloc;
- tpn->next = NULL;
- if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
- {
- free(tpn);
- return BadAlloc;
- }
+XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
+{
+ XvVideoNotifyPtr pn, tpn, fpn;
+ int rc;
+
+ /* FIND VideoNotify LIST */
+
+ rc = dixLookupResourceByType((pointer *) &pn, pDraw->id,
+ XvRTVideoNotifyList, client, DixWriteAccess);
+ if (rc != Success && rc != BadValue)
+ return rc;
+
+ /* IF ONE DONES'T EXIST AND NO MASK, THEN JUST RETURN */
+
+ if (!onoff && !pn)
+ return Success;
+
+ /* IF ONE DOESN'T EXIST CREATE IT AND ADD A RESOURCE SO THAT THE LIST
+ WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */
+
+ if (!pn) {
+ if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
+ return BadAlloc;
+ tpn->next = NULL;
+ if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) {
+ free(tpn);
+ return BadAlloc;
+ }
}
- else
- {
- /* LOOK TO SEE IF ENTRY ALREADY EXISTS */
-
- fpn = NULL;
- tpn = pn;
- while (tpn)
- {
- if (tpn->client == client)
- {
- if (!onoff) tpn->client = NULL;
- return Success;
- }
- if (!tpn->client) fpn = tpn; /* TAKE NOTE OF FREE ENTRY */
- tpn = tpn->next;
- }
-
- /* IF TUNNING OFF, THEN JUST RETURN */
-
- if (!onoff) return Success;
-
- /* IF ONE ISN'T FOUND THEN ALLOCATE ONE AND LINK IT INTO THE LIST */
-
- if (fpn)
- {
- tpn = fpn;
- }
- else
- {
- if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
- return BadAlloc;
- tpn->next = pn->next;
- pn->next = tpn;
- }
+ else {
+ /* LOOK TO SEE IF ENTRY ALREADY EXISTS */
+
+ fpn = NULL;
+ tpn = pn;
+ while (tpn) {
+ if (tpn->client == client) {
+ if (!onoff)
+ tpn->client = NULL;
+ return Success;
+ }
+ if (!tpn->client)
+ fpn = tpn; /* TAKE NOTE OF FREE ENTRY */
+ tpn = tpn->next;
+ }
+
+ /* IF TUNNING OFF, THEN JUST RETURN */
+
+ if (!onoff)
+ return Success;
+
+ /* IF ONE ISN'T FOUND THEN ALLOCATE ONE AND LINK IT INTO THE LIST */
+
+ if (fpn) {
+ tpn = fpn;
+ }
+ else {
+ if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
+ return BadAlloc;
+ tpn->next = pn->next;
+ pn->next = tpn;
+ }
}
- /* INIT CLIENT PTR IN CASE WE CAN'T ADD RESOURCE */
- /* ADD RESOURCE SO THAT IF CLIENT EXITS THE CLIENT PTR WILL BE CLEARED */
+ /* INIT CLIENT PTR IN CASE WE CAN'T ADD RESOURCE */
+ /* ADD RESOURCE SO THAT IF CLIENT EXITS THE CLIENT PTR WILL BE CLEARED */
- tpn->client = NULL;
- tpn->id = FakeClientID(client->index);
- AddResource(tpn->id, XvRTVideoNotify, tpn);
+ tpn->client = NULL;
+ tpn->id = FakeClientID(client->index);
+ AddResource(tpn->id, XvRTVideoNotify, tpn);
- tpn->client = client;
- return Success;
+ tpn->client = client;
+ return Success;
}
int
-XvdiSelectPortNotify(
- ClientPtr client,
- XvPortPtr pPort,
- BOOL onoff
-){
- XvPortNotifyPtr pn,tpn;
-
- /* SEE IF CLIENT IS ALREADY IN LIST */
-
- tpn = NULL;
- pn = pPort->pNotify;
- while (pn)
- {
- if (!pn->client) tpn = pn; /* TAKE NOTE OF FREE ENTRY */
- if (pn->client == client) break;
- pn = pn->next;
+XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
+{
+ XvPortNotifyPtr pn, tpn;
+
+ /* SEE IF CLIENT IS ALREADY IN LIST */
+
+ tpn = NULL;
+ pn = pPort->pNotify;
+ while (pn) {
+ if (!pn->client)
+ tpn = pn; /* TAKE NOTE OF FREE ENTRY */
+ if (pn->client == client)
+ break;
+ pn = pn->next;
}
- /* IS THE CLIENT ALREADY ON THE LIST? */
+ /* IS THE CLIENT ALREADY ON THE LIST? */
- if (pn)
- {
- /* REMOVE IT? */
+ if (pn) {
+ /* REMOVE IT? */
- if (!onoff)
- {
- pn->client = NULL;
- FreeResource(pn->id, XvRTPortNotify);
- }
+ if (!onoff) {
+ pn->client = NULL;
+ FreeResource(pn->id, XvRTPortNotify);
+ }
- return Success;
+ return Success;
}
- /* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE
- CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
+ /* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE
+ CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
- if (!tpn)
- {
- if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
- return BadAlloc;
- tpn->next = pPort->pNotify;
- pPort->pNotify = tpn;
+ if (!tpn) {
+ if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
+ return BadAlloc;
+ tpn->next = pPort->pNotify;
+ pPort->pNotify = tpn;
}
- tpn->client = client;
- tpn->id = FakeClientID(client->index);
- AddResource(tpn->id, XvRTPortNotify, tpn);
+ tpn->client = client;
+ tpn->id = FakeClientID(client->index);
+ AddResource(tpn->id, XvRTPortNotify, tpn);
- return Success;
+ return Success;
}
int
-XvdiStopVideo(
- ClientPtr client,
- XvPortPtr pPort,
- DrawablePtr pDraw
-){
- int status;
-
- /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
-
- if (!pPort->pDraw || (pPort->pDraw != pDraw))
- {
- XvdiSendVideoNotify(pPort, pDraw, XvStopped);
- return Success;
+XvdiStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
+{
+ int status;
+
+ /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
+
+ if (!pPort->pDraw || (pPort->pDraw != pDraw)) {
+ XvdiSendVideoNotify(pPort, pDraw, XvStopped);
+ return Success;
}
- /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
- INFORM CLIENT OF ITS FAILURE */
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
- if ((client) && (pPort->grab.client) && (pPort->grab.client != client))
- {
- XvdiSendVideoNotify(pPort, pDraw, XvBusy);
- return Success;
+ if ((client) && (pPort->grab.client) && (pPort->grab.client != client)) {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
}
- XvdiSendVideoNotify(pPort, pDraw, XvStopped);
+ XvdiSendVideoNotify(pPort, pDraw, XvStopped);
- status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pDraw);
+ status = (*pPort->pAdaptor->ddStopVideo) (client, pPort, pDraw);
- pPort->pDraw = NULL;
- pPort->client = (ClientPtr)client;
- pPort->time = currentTime;
+ pPort->pDraw = NULL;
+ pPort->client = (ClientPtr) client;
+ pPort->time = currentTime;
- return status;
+ return status;
}
int
-XvdiPreemptVideo(
- ClientPtr client,
- XvPortPtr pPort,
- DrawablePtr pDraw
-){
- int status;
+XvdiPreemptVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
+{
+ int status;
- /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
+ /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
- if (!pPort->pDraw || (pPort->pDraw != pDraw)) return Success;
+ if (!pPort->pDraw || (pPort->pDraw != pDraw))
+ return Success;
- XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
+ XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
- status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pPort->pDraw);
+ status = (*pPort->pAdaptor->ddStopVideo) (client, pPort, pPort->pDraw);
- pPort->pDraw = NULL;
- pPort->client = (ClientPtr)client;
- pPort->time = currentTime;
+ pPort->pDraw = NULL;
+ pPort->client = (ClientPtr) client;
+ pPort->time = currentTime;
- return status;
+ return status;
}
int
-XvdiMatchPort(
- XvPortPtr pPort,
- DrawablePtr pDraw
-){
+XvdiMatchPort(XvPortPtr pPort, DrawablePtr pDraw)
+{
- XvAdaptorPtr pa;
- XvFormatPtr pf;
- int nf;
+ XvAdaptorPtr pa;
+ XvFormatPtr pf;
+ int nf;
- pa = pPort->pAdaptor;
+ pa = pPort->pAdaptor;
- if (pa->pScreen != pDraw->pScreen) return BadMatch;
+ if (pa->pScreen != pDraw->pScreen)
+ return BadMatch;
- nf = pa->nFormats;
- pf = pa->pFormats;
+ nf = pa->nFormats;
+ pf = pa->pFormats;
- while (nf--)
- {
- if (pf->depth == pDraw->depth)
- return Success;
- pf++;
+ while (nf--) {
+ if (pf->depth == pDraw->depth)
+ return Success;
+ pf++;
}
- return BadMatch;
+ return BadMatch;
}
int
-XvdiSetPortAttribute(
- ClientPtr client,
- XvPortPtr pPort,
- Atom attribute,
- INT32 value
-){
- int status;
-
- status = (* pPort->pAdaptor->ddSetPortAttribute)(client, pPort, attribute, value);
- if (status == Success)
- XvdiSendPortNotify(pPort, attribute, value);
-
- return status;
+XvdiSetPortAttribute(ClientPtr client,
+ XvPortPtr pPort, Atom attribute, INT32 value)
+{
+ int status;
+
+ status =
+ (*pPort->pAdaptor->ddSetPortAttribute) (client, pPort, attribute,
+ value);
+ if (status == Success)
+ XvdiSendPortNotify(pPort, attribute, value);
+
+ return status;
}
int
-XvdiGetPortAttribute(
- ClientPtr client,
- XvPortPtr pPort,
- Atom attribute,
- INT32 *p_value
-){
+XvdiGetPortAttribute(ClientPtr client,
+ XvPortPtr pPort, Atom attribute, INT32 *p_value)
+{
- return
- (* pPort->pAdaptor->ddGetPortAttribute)(client, pPort, attribute, p_value);
+ return
+ (*pPort->pAdaptor->ddGetPortAttribute) (client, pPort, attribute,
+ p_value);
}
static void
-WriteSwappedVideoNotifyEvent(xvEvent *from, xvEvent *to)
-
+WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
{
- to->u.u.type = from->u.u.type;
- to->u.u.detail = from->u.u.detail;
- cpswaps(from->u.videoNotify.sequenceNumber,
- to->u.videoNotify.sequenceNumber);
- cpswapl(from->u.videoNotify.time, to->u.videoNotify.time);
- cpswapl(from->u.videoNotify.drawable, to->u.videoNotify.drawable);
- cpswapl(from->u.videoNotify.port, to->u.videoNotify.port);
+ to->u.u.type = from->u.u.type;
+ to->u.u.detail = from->u.u.detail;
+ cpswaps(from->u.videoNotify.sequenceNumber,
+ to->u.videoNotify.sequenceNumber);
+ cpswapl(from->u.videoNotify.time, to->u.videoNotify.time);
+ cpswapl(from->u.videoNotify.drawable, to->u.videoNotify.drawable);
+ cpswapl(from->u.videoNotify.port, to->u.videoNotify.port);
}
static void
-WriteSwappedPortNotifyEvent(xvEvent *from, xvEvent *to)
-
+WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
{
- to->u.u.type = from->u.u.type;
- to->u.u.detail = from->u.u.detail;
- cpswaps(from->u.portNotify.sequenceNumber, to->u.portNotify.sequenceNumber);
- cpswapl(from->u.portNotify.time, to->u.portNotify.time);
- cpswapl(from->u.portNotify.port, to->u.portNotify.port);
- cpswapl(from->u.portNotify.value, to->u.portNotify.value);
+ to->u.u.type = from->u.u.type;
+ to->u.u.detail = from->u.u.detail;
+ cpswaps(from->u.portNotify.sequenceNumber, to->u.portNotify.sequenceNumber);
+ cpswapl(from->u.portNotify.time, to->u.portNotify.time);
+ cpswapl(from->u.portNotify.port, to->u.portNotify.port);
+ cpswapl(from->u.portNotify.value, to->u.portNotify.value);
}
diff --git a/xorg-server/Xext/xvmc.c b/xorg-server/Xext/xvmc.c
index 47b9f476e..8a1d94085 100644
--- a/xorg-server/Xext/xvmc.c
+++ b/xorg-server/Xext/xvmc.c
@@ -26,14 +26,13 @@
#include <sys/ipc.h>
#include <sys/types.h>
#include <sys/shm.h>
-#endif /* HAS_XVMCSHM */
-
-
+#endif /* HAS_XVMCSHM */
#define DR_CLIENT_DRIVER_NAME_SIZE 48
#define DR_BUSID_SIZE 48
static DevPrivateKeyRec XvMCScreenKeyRec;
+
#define XvMCScreenKey (&XvMCScreenKeyRec)
static Bool XvMCInUse;
@@ -47,71 +46,71 @@ static RESTYPE XvMCRTSurface;
static RESTYPE XvMCRTSubpicture;
typedef struct {
- int num_adaptors;
- XvMCAdaptorPtr adaptors;
- CloseScreenProcPtr CloseScreen;
- char clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE];
- char busID[DR_BUSID_SIZE];
- int major;
- int minor;
- int patchLevel;
-} XvMCScreenRec, *XvMCScreenPtr;
+ int num_adaptors;
+ XvMCAdaptorPtr adaptors;
+ CloseScreenProcPtr CloseScreen;
+ char clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE];
+ char busID[DR_BUSID_SIZE];
+ int major;
+ int minor;
+ int patchLevel;
+} XvMCScreenRec, *XvMCScreenPtr;
#define XVMC_GET_PRIVATE(pScreen) \
(XvMCScreenPtr)(dixLookupPrivate(&(pScreen)->devPrivates, XvMCScreenKey))
-
static int
XvMCDestroyContextRes(pointer data, XID id)
{
- XvMCContextPtr pContext = (XvMCContextPtr)data;
-
- pContext->refcnt--;
+ XvMCContextPtr pContext = (XvMCContextPtr) data;
- if(!pContext->refcnt) {
- XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
- (*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext)(pContext);
- free(pContext);
- }
+ pContext->refcnt--;
- return Success;
+ if (!pContext->refcnt) {
+ XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
+
+ (*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext) (pContext);
+ free(pContext);
+ }
+
+ return Success;
}
static int
XvMCDestroySurfaceRes(pointer data, XID id)
{
- XvMCSurfacePtr pSurface = (XvMCSurfacePtr)data;
- XvMCContextPtr pContext = pSurface->context;
- XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
+ XvMCSurfacePtr pSurface = (XvMCSurfacePtr) data;
+ XvMCContextPtr pContext = pSurface->context;
+ XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
- (*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface)(pSurface);
- free(pSurface);
+ (*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface) (pSurface);
+ free(pSurface);
- XvMCDestroyContextRes((pointer)pContext, pContext->context_id);
+ XvMCDestroyContextRes((pointer) pContext, pContext->context_id);
- return Success;
+ return Success;
}
-
static int
XvMCDestroySubpictureRes(pointer data, XID id)
{
- XvMCSubpicturePtr pSubpict = (XvMCSubpicturePtr)data;
- XvMCContextPtr pContext = pSubpict->context;
- XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
+ XvMCSubpicturePtr pSubpict = (XvMCSubpicturePtr) data;
+ XvMCContextPtr pContext = pSubpict->context;
+ XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
- (*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture)(pSubpict);
- free(pSubpict);
+ (*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture) (pSubpict);
+ free(pSubpict);
- XvMCDestroyContextRes((pointer)pContext, pContext->context_id);
+ XvMCDestroyContextRes((pointer) pContext, pContext->context_id);
- return Success;
+ return Success;
}
-static int
+static int
ProcXvMCQueryVersion(ClientPtr client)
{
xvmcQueryVersionReply rep;
+
/* REQUEST(xvmcQueryVersionReq); */
REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
rep.type = X_Reply;
@@ -119,12 +118,11 @@ ProcXvMCQueryVersion(ClientPtr client)
rep.length = 0;
rep.major = SERVER_XVMC_MAJOR_VERSION;
rep.minor = SERVER_XVMC_MINOR_VERSION;
- WriteToClient(client, sizeof(xvmcQueryVersionReply), (char*)&rep);
+ WriteToClient(client, sizeof(xvmcQueryVersionReply), (char *) &rep);
return Success;
}
-
-static int
+static int
ProcXvMCListSurfaceTypes(ClientPtr client)
{
XvPortPtr pPort;
@@ -134,52 +132,54 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
xvmcSurfaceInfo info;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface;
+
REQUEST(xvmcListSurfaceTypesReq);
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if(XvMCInUse) { /* any adaptors at all */
- ScreenPtr pScreen = pPort->pAdaptor->pScreen;
- if((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
- for(i = 0; i < pScreenPriv->num_adaptors; i++) {
- if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
- adaptor = &(pScreenPriv->adaptors[i]);
- break;
- }
- }
- }
+ if (XvMCInUse) { /* any adaptors at all */
+ ScreenPtr pScreen = pPort->pAdaptor->pScreen;
+
+ if ((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
+ for (i = 0; i < pScreenPriv->num_adaptors; i++) {
+ if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
+ adaptor = &(pScreenPriv->adaptors[i]);
+ break;
+ }
+ }
+ }
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.num = (adaptor) ? adaptor->num_surfaces : 0;
rep.length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo));
-
- WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), (char*)&rep);
-
- for(i = 0; i < rep.num; i++) {
- surface = adaptor->surfaces[i];
- info.surface_type_id = surface->surface_type_id;
- info.chroma_format = surface->chroma_format;
- info.max_width = surface->max_width;
- info.max_height = surface->max_height;
- info.subpicture_max_width = surface->subpicture_max_width;
- info.subpicture_max_height = surface->subpicture_max_height;
- info.mc_type = surface->mc_type;
- info.flags = surface->flags;
- WriteToClient(client, sizeof(xvmcSurfaceInfo), (char*)&info);
+
+ WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), (char *) &rep);
+
+ for (i = 0; i < rep.num; i++) {
+ surface = adaptor->surfaces[i];
+ info.surface_type_id = surface->surface_type_id;
+ info.chroma_format = surface->chroma_format;
+ info.max_width = surface->max_width;
+ info.max_height = surface->max_height;
+ info.subpicture_max_width = surface->subpicture_max_width;
+ info.subpicture_max_height = surface->subpicture_max_height;
+ info.mc_type = surface->mc_type;
+ info.flags = surface->flags;
+ WriteToClient(client, sizeof(xvmcSurfaceInfo), (char *) &info);
}
return Success;
}
-static int
+static int
ProcXvMCCreateContext(ClientPtr client)
{
XvPortPtr pPort;
CARD32 *data = NULL;
- int dwords = 0;
+ int dwords = 0;
int i, result, adapt_num = -1;
ScreenPtr pScreen;
XvMCContextPtr pContext;
@@ -187,6 +187,7 @@ ProcXvMCCreateContext(ClientPtr client)
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface = NULL;
xvmcCreateContextReply rep;
+
REQUEST(xvmcCreateContextReq);
REQUEST_SIZE_MATCH(xvmcCreateContextReq);
@@ -194,43 +195,42 @@ ProcXvMCCreateContext(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
- if(!XvMCInUse) /* no XvMC adaptors */
- return BadMatch;
-
- if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */
- return BadMatch;
-
- for(i = 0; i < pScreenPriv->num_adaptors; i++) {
- if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
- adaptor = &(pScreenPriv->adaptors[i]);
- adapt_num = i;
- break;
- }
+ if (!XvMCInUse) /* no XvMC adaptors */
+ return BadMatch;
+
+ if (!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */
+ return BadMatch;
+
+ for (i = 0; i < pScreenPriv->num_adaptors; i++) {
+ if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
+ adaptor = &(pScreenPriv->adaptors[i]);
+ adapt_num = i;
+ break;
+ }
}
- if(adapt_num < 0) /* none this port */
- return BadMatch;
+ if (adapt_num < 0) /* none this port */
+ return BadMatch;
- for(i = 0; i < adaptor->num_surfaces; i++) {
- if(adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
+ for (i = 0; i < adaptor->num_surfaces; i++) {
+ if (adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
surface = adaptor->surfaces[i];
break;
}
}
/* adaptor doesn't support this suface_type_id */
- if(!surface) return BadMatch;
-
+ if (!surface)
+ return BadMatch;
- if((stuff->width > surface->max_width) ||
- (stuff->height > surface->max_height))
+ if ((stuff->width > surface->max_width) ||
+ (stuff->height > surface->max_height))
return BadValue;
- if(!(pContext = malloc(sizeof(XvMCContextRec)))) {
- return BadAlloc;
+ if (!(pContext = malloc(sizeof(XvMCContextRec)))) {
+ return BadAlloc;
}
-
pContext->pScreen = pScreen;
pContext->adapt_num = adapt_num;
pContext->context_id = stuff->context_id;
@@ -240,23 +240,23 @@ ProcXvMCCreateContext(ClientPtr client)
pContext->flags = stuff->flags;
pContext->refcnt = 1;
- result = (*adaptor->CreateContext)(pPort, pContext, &dwords, &data);
+ result = (*adaptor->CreateContext) (pPort, pContext, &dwords, &data);
- if(result != Success) {
- free(pContext);
- return result;
+ if (result != Success) {
+ free(pContext);
+ return result;
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.width_actual = pContext->width;
- rep.height_actual = pContext->height;
- rep.flags_return = pContext->flags;
+ rep.width_actual = pContext->width;
+ rep.height_actual = pContext->height;
+ rep.flags_return = pContext->flags;
rep.length = dwords;
- WriteToClient(client, sizeof(xvmcCreateContextReply), (char*)&rep);
- if(dwords)
- WriteToClient(client, dwords << 2, (char*)data);
+ WriteToClient(client, sizeof(xvmcCreateContextReply), (char *) &rep);
+ if (dwords)
+ WriteToClient(client, dwords << 2, (char *) data);
AddResource(pContext->context_id, XvMCRTContext, pContext);
free(data);
@@ -264,25 +264,26 @@ ProcXvMCCreateContext(ClientPtr client)
return Success;
}
-static int
+static int
ProcXvMCDestroyContext(ClientPtr client)
{
pointer val;
int rc;
+
REQUEST(xvmcDestroyContextReq);
REQUEST_SIZE_MATCH(xvmcDestroyContextReq);
rc = dixLookupResourceByType(&val, stuff->context_id, XvMCRTContext,
- client, DixDestroyAccess);
+ client, DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
- FreeResource(stuff->context_id, RT_NONE);
+ FreeResource(stuff->context_id, RT_NONE);
return Success;
}
-static int
+static int
ProcXvMCCreateSurface(ClientPtr client)
{
CARD32 *data = NULL;
@@ -292,27 +293,30 @@ ProcXvMCCreateSurface(ClientPtr client)
XvMCSurfacePtr pSurface;
XvMCScreenPtr pScreenPriv;
xvmcCreateSurfaceReply rep;
+
REQUEST(xvmcCreateSurfaceReq);
REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
- result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id,
- XvMCRTContext, client, DixUseAccess);
+ result = dixLookupResourceByType((pointer *) &pContext, stuff->context_id,
+ XvMCRTContext, client, DixUseAccess);
if (result != Success)
return result;
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
- if(!(pSurface = malloc(sizeof(XvMCSurfaceRec))))
+ if (!(pSurface = malloc(sizeof(XvMCSurfaceRec))))
return BadAlloc;
pSurface->surface_id = stuff->surface_id;
pSurface->surface_type_id = pContext->surface_type_id;
pSurface->context = pContext;
- result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSurface)(
- pSurface, &dwords, &data);
+ result =
+ (*pScreenPriv->adaptors[pContext->adapt_num].CreateSurface) (pSurface,
+ &dwords,
+ &data);
- if(result != Success) {
+ if (result != Success) {
free(pSurface);
return result;
}
@@ -321,9 +325,9 @@ ProcXvMCCreateSurface(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.length = dwords;
- WriteToClient(client, sizeof(xvmcCreateSurfaceReply), (char*)&rep);
- if(dwords)
- WriteToClient(client, dwords << 2, (char*)data);
+ WriteToClient(client, sizeof(xvmcCreateSurfaceReply), (char *) &rep);
+ if (dwords)
+ WriteToClient(client, dwords << 2, (char *) data);
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
free(data);
@@ -333,16 +337,17 @@ ProcXvMCCreateSurface(ClientPtr client)
return Success;
}
-static int
+static int
ProcXvMCDestroySurface(ClientPtr client)
{
pointer val;
int rc;
+
REQUEST(xvmcDestroySurfaceReq);
REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq);
rc = dixLookupResourceByType(&val, stuff->surface_id, XvMCRTSurface,
- client, DixDestroyAccess);
+ client, DixDestroyAccess);
if (rc != Success)
return rc;
@@ -351,7 +356,7 @@ ProcXvMCDestroySurface(ClientPtr client)
return Success;
}
-static int
+static int
ProcXvMCCreateSubpicture(ClientPtr client)
{
Bool image_supported = FALSE;
@@ -363,64 +368,70 @@ ProcXvMCCreateSubpicture(ClientPtr client)
xvmcCreateSubpictureReply rep;
XvMCAdaptorPtr adaptor;
XvMCSurfaceInfoPtr surface = NULL;
+
REQUEST(xvmcCreateSubpictureReq);
REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq);
- result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id,
- XvMCRTContext, client, DixUseAccess);
+ result = dixLookupResourceByType((pointer *) &pContext, stuff->context_id,
+ XvMCRTContext, client, DixUseAccess);
if (result != Success)
return result;
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
- adaptor = &(pScreenPriv->adaptors[pContext->adapt_num]);
+ adaptor = &(pScreenPriv->adaptors[pContext->adapt_num]);
/* find which surface this context supports */
- for(i = 0; i < adaptor->num_surfaces; i++) {
- if(adaptor->surfaces[i]->surface_type_id == pContext->surface_type_id){
- surface = adaptor->surfaces[i];
- break;
- }
- }
+ for (i = 0; i < adaptor->num_surfaces; i++) {
+ if (adaptor->surfaces[i]->surface_type_id == pContext->surface_type_id) {
+ surface = adaptor->surfaces[i];
+ break;
+ }
+ }
- if(!surface) return BadMatch;
+ if (!surface)
+ return BadMatch;
/* make sure this surface supports that xvimage format */
- if(!surface->compatible_subpictures) return BadMatch;
+ if (!surface->compatible_subpictures)
+ return BadMatch;
- for(i = 0; i < surface->compatible_subpictures->num_xvimages; i++) {
- if(surface->compatible_subpictures->xvimage_ids[i] == stuff->xvimage_id) {
- image_supported = TRUE;
- break;
- }
+ for (i = 0; i < surface->compatible_subpictures->num_xvimages; i++) {
+ if (surface->compatible_subpictures->xvimage_ids[i] ==
+ stuff->xvimage_id) {
+ image_supported = TRUE;
+ break;
+ }
}
- if(!image_supported) return BadMatch;
+ if (!image_supported)
+ return BadMatch;
/* make sure the size is OK */
- if((stuff->width > surface->subpicture_max_width) ||
- (stuff->height > surface->subpicture_max_height))
- return BadValue;
+ if ((stuff->width > surface->subpicture_max_width) ||
+ (stuff->height > surface->subpicture_max_height))
+ return BadValue;
- if(!(pSubpicture = malloc(sizeof(XvMCSubpictureRec))))
+ if (!(pSubpicture = malloc(sizeof(XvMCSubpictureRec))))
return BadAlloc;
pSubpicture->subpicture_id = stuff->subpicture_id;
pSubpicture->xvimage_id = stuff->xvimage_id;
pSubpicture->width = stuff->width;
pSubpicture->height = stuff->height;
- pSubpicture->num_palette_entries = 0; /* overwritten by DDX */
- pSubpicture->entry_bytes = 0; /* overwritten by DDX */
- pSubpicture->component_order[0] = 0; /* overwritten by DDX */
+ pSubpicture->num_palette_entries = 0; /* overwritten by DDX */
+ pSubpicture->entry_bytes = 0; /* overwritten by DDX */
+ pSubpicture->component_order[0] = 0; /* overwritten by DDX */
pSubpicture->component_order[1] = 0;
pSubpicture->component_order[2] = 0;
pSubpicture->component_order[3] = 0;
pSubpicture->context = pContext;
-
- result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSubpicture)(
- pSubpicture, &dwords, &data);
- if(result != Success) {
+ result =
+ (*pScreenPriv->adaptors[pContext->adapt_num].
+ CreateSubpicture) (pSubpicture, &dwords, &data);
+
+ if (result != Success) {
free(pSubpicture);
return result;
}
@@ -437,9 +448,9 @@ ProcXvMCCreateSubpicture(ClientPtr client)
rep.component_order[3] = pSubpicture->component_order[3];
rep.length = dwords;
- WriteToClient(client, sizeof(xvmcCreateSubpictureReply), (char*)&rep);
- if(dwords)
- WriteToClient(client, dwords << 2, (char*)data);
+ WriteToClient(client, sizeof(xvmcCreateSubpictureReply), (char *) &rep);
+ if (dwords)
+ WriteToClient(client, dwords << 2, (char *) data);
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
free(data);
@@ -449,16 +460,17 @@ ProcXvMCCreateSubpicture(ClientPtr client)
return Success;
}
-static int
+static int
ProcXvMCDestroySubpicture(ClientPtr client)
{
pointer val;
int rc;
+
REQUEST(xvmcDestroySubpictureReq);
REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq);
rc = dixLookupResourceByType(&val, stuff->subpicture_id, XvMCRTSubpicture,
- client, DixDestroyAccess);
+ client, DixDestroyAccess);
if (rc != Success)
return rc;
@@ -467,7 +479,6 @@ ProcXvMCDestroySubpicture(ClientPtr client)
return Success;
}
-
static int
ProcXvMCListSubpictureTypes(ClientPtr client)
{
@@ -480,6 +491,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
xvImageFormatInfo info;
XvImagePtr pImage;
int i, j;
+
REQUEST(xvmcListSubpictureTypesReq);
REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq);
@@ -488,74 +500,76 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
if (!dixPrivateKeyRegistered(XvMCScreenKey))
- return BadMatch; /* No XvMC adaptors */
+ return BadMatch; /* No XvMC adaptors */
- if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
- return BadMatch; /* None this screen */
+ if (!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
+ return BadMatch; /* None this screen */
- for(i = 0; i < pScreenPriv->num_adaptors; i++) {
- if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
+ for (i = 0; i < pScreenPriv->num_adaptors; i++) {
+ if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
break;
}
}
- if(!adaptor) return BadMatch;
+ if (!adaptor)
+ return BadMatch;
- for(i = 0; i < adaptor->num_surfaces; i++) {
- if(adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
+ for (i = 0; i < adaptor->num_surfaces; i++) {
+ if (adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
surface = adaptor->surfaces[i];
break;
}
}
- if(!surface) return BadMatch;
+ if (!surface)
+ return BadMatch;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.num = 0;
- if(surface->compatible_subpictures)
- rep.num = surface->compatible_subpictures->num_xvimages;
+ if (surface->compatible_subpictures)
+ rep.num = surface->compatible_subpictures->num_xvimages;
rep.length = bytes_to_int32(rep.num * sizeof(xvImageFormatInfo));
- WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), (char*)&rep);
-
- for(i = 0; i < rep.num; i++) {
- pImage = NULL;
- for(j = 0; j < adaptor->num_subpictures; j++) {
- if(surface->compatible_subpictures->xvimage_ids[i] ==
- adaptor->subpictures[j]->id)
- {
- pImage = adaptor->subpictures[j];
- break;
- }
- }
- if(!pImage) return BadImplementation;
-
- info.id = pImage->id;
- info.type = pImage->type;
- info.byte_order = pImage->byte_order;
- memcpy(&info.guid, pImage->guid, 16);
- info.bpp = pImage->bits_per_pixel;
- info.num_planes = pImage->num_planes;
- info.depth = pImage->depth;
- info.red_mask = pImage->red_mask;
- info.green_mask = pImage->green_mask;
- info.blue_mask = pImage->blue_mask;
- info.format = pImage->format;
- info.y_sample_bits = pImage->y_sample_bits;
- info.u_sample_bits = pImage->u_sample_bits;
- info.v_sample_bits = pImage->v_sample_bits;
- info.horz_y_period = pImage->horz_y_period;
- info.horz_u_period = pImage->horz_u_period;
- info.horz_v_period = pImage->horz_v_period;
- info.vert_y_period = pImage->vert_y_period;
- info.vert_u_period = pImage->vert_u_period;
- info.vert_v_period = pImage->vert_v_period;
- memcpy(&info.comp_order, pImage->component_order, 32);
+ WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), (char *) &rep);
+
+ for (i = 0; i < rep.num; i++) {
+ pImage = NULL;
+ for (j = 0; j < adaptor->num_subpictures; j++) {
+ if (surface->compatible_subpictures->xvimage_ids[i] ==
+ adaptor->subpictures[j]->id) {
+ pImage = adaptor->subpictures[j];
+ break;
+ }
+ }
+ if (!pImage)
+ return BadImplementation;
+
+ info.id = pImage->id;
+ info.type = pImage->type;
+ info.byte_order = pImage->byte_order;
+ memcpy(&info.guid, pImage->guid, 16);
+ info.bpp = pImage->bits_per_pixel;
+ info.num_planes = pImage->num_planes;
+ info.depth = pImage->depth;
+ info.red_mask = pImage->red_mask;
+ info.green_mask = pImage->green_mask;
+ info.blue_mask = pImage->blue_mask;
+ info.format = pImage->format;
+ info.y_sample_bits = pImage->y_sample_bits;
+ info.u_sample_bits = pImage->u_sample_bits;
+ info.v_sample_bits = pImage->v_sample_bits;
+ info.horz_y_period = pImage->horz_y_period;
+ info.horz_u_period = pImage->horz_u_period;
+ info.horz_v_period = pImage->horz_v_period;
+ info.vert_y_period = pImage->vert_y_period;
+ info.vert_u_period = pImage->vert_u_period;
+ info.vert_v_period = pImage->vert_v_period;
+ memcpy(&info.comp_order, pImage->component_order, 32);
info.scanline_order = pImage->scanline_order;
- WriteToClient(client, sizeof(xvImageFormatInfo), (char*)&info);
+ WriteToClient(client, sizeof(xvImageFormatInfo), (char *) &info);
}
return Success;
@@ -580,7 +594,7 @@ ProcXvMCGetDRInfo(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
pScreenPriv = XVMC_GET_PRIVATE(pScreen);
-
+
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.major = pScreenPriv->major;
@@ -590,8 +604,8 @@ ProcXvMCGetDRInfo(ClientPtr client)
rep.busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1);
rep.length = rep.nameLen + rep.busIDLen;
- rep.nameLen <<=2;
- rep.busIDLen <<=2;
+ rep.nameLen <<= 2;
+ rep.busIDLen <<= 2;
/*
* Read back to the client what she has put in the shared memory
@@ -600,64 +614,58 @@ ProcXvMCGetDRInfo(ClientPtr client)
rep.isLocal = 1;
#ifdef HAS_XVMCSHM
- patternP = (CARD32 *)shmat( stuff->shmKey, NULL, SHM_RDONLY );
- if ( -1 != (long) patternP) {
+ patternP = (CARD32 *) shmat(stuff->shmKey, NULL, SHM_RDONLY);
+ if (-1 != (long) patternP) {
volatile CARD32 *patternC = patternP;
- int i;
- CARD32 magic = stuff->magic;
-
- rep.isLocal = 1;
- i = 1024 / sizeof(CARD32);
-
- while ( i-- ) {
- if (*patternC++ != magic) {
- rep.isLocal = 0;
- break;
- }
- magic = ~magic;
- }
- shmdt( (char *)patternP );
+ int i;
+ CARD32 magic = stuff->magic;
+
+ rep.isLocal = 1;
+ i = 1024 / sizeof(CARD32);
+
+ while (i--) {
+ if (*patternC++ != magic) {
+ rep.isLocal = 0;
+ break;
+ }
+ magic = ~magic;
+ }
+ shmdt((char *) patternP);
+ }
+#endif /* HAS_XVMCSHM */
+
+ WriteToClient(client, sizeof(xvmcGetDRInfoReply), (char *) &rep);
+ if (rep.length) {
+ WriteToClient(client, rep.nameLen, pScreenPriv->clientDriverName);
+ WriteToClient(client, rep.busIDLen, pScreenPriv->busID);
}
-#endif /* HAS_XVMCSHM */
-
- WriteToClient(client, sizeof(xvmcGetDRInfoReply),
- (char*)&rep);
- if (rep.length) {
- WriteToClient(client, rep.nameLen,
- pScreenPriv->clientDriverName);
- WriteToClient(client, rep.busIDLen,
- pScreenPriv->busID);
- }
return Success;
}
-
-int (*ProcXvMCVector[xvmcNumRequest])(ClientPtr) = {
- ProcXvMCQueryVersion,
- ProcXvMCListSurfaceTypes,
- ProcXvMCCreateContext,
- ProcXvMCDestroyContext,
- ProcXvMCCreateSurface,
- ProcXvMCDestroySurface,
- ProcXvMCCreateSubpicture,
- ProcXvMCDestroySubpicture,
- ProcXvMCListSubpictureTypes,
- ProcXvMCGetDRInfo
-};
+int (*ProcXvMCVector[xvmcNumRequest]) (ClientPtr) = {
+ProcXvMCQueryVersion,
+ ProcXvMCListSurfaceTypes,
+ ProcXvMCCreateContext,
+ ProcXvMCDestroyContext,
+ ProcXvMCCreateSurface,
+ ProcXvMCDestroySurface,
+ ProcXvMCCreateSubpicture,
+ ProcXvMCDestroySubpicture,
+ ProcXvMCListSubpictureTypes, ProcXvMCGetDRInfo};
static int
-ProcXvMCDispatch (ClientPtr client)
+ProcXvMCDispatch(ClientPtr client)
{
REQUEST(xReq);
-
- if(stuff->data < xvmcNumRequest)
- return (*ProcXvMCVector[stuff->data])(client);
+
+ if (stuff->data < xvmcNumRequest)
+ return (*ProcXvMCVector[stuff->data]) (client);
else
- return BadRequest;
+ return BadRequest;
}
static int
-SProcXvMCDispatch (ClientPtr client)
+SProcXvMCDispatch(ClientPtr client)
{
/* We only support local */
return BadImplementation;
@@ -666,38 +674,42 @@ SProcXvMCDispatch (ClientPtr client)
void
XvMCExtensionInit(void)
{
- ExtensionEntry *extEntry;
-
- if (!dixPrivateKeyRegistered(XvMCScreenKey))
- return;
-
- if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes,
- "XvMCRTContext")))
- return;
-
- if(!(XvMCRTSurface = CreateNewResourceType(XvMCDestroySurfaceRes,
- "XvMCRTSurface")))
- return;
-
- if(!(XvMCRTSubpicture = CreateNewResourceType(XvMCDestroySubpictureRes,
- "XvMCRTSubpicture")))
- return;
-
- extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors,
- ProcXvMCDispatch, SProcXvMCDispatch,
- NULL, StandardMinorOpcode);
-
- if(!extEntry) return;
-
- XvMCReqCode = extEntry->base;
- XvMCEventBase = extEntry->eventBase;
- SetResourceTypeErrorValue(XvMCRTContext, extEntry->errorBase + XvMCBadContext);
- SetResourceTypeErrorValue(XvMCRTSurface, extEntry->errorBase + XvMCBadSurface);
- SetResourceTypeErrorValue(XvMCRTSubpicture, extEntry->errorBase + XvMCBadSubpicture);
+ ExtensionEntry *extEntry;
+
+ if (!dixPrivateKeyRegistered(XvMCScreenKey))
+ return;
+
+ if (!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes,
+ "XvMCRTContext")))
+ return;
+
+ if (!(XvMCRTSurface = CreateNewResourceType(XvMCDestroySurfaceRes,
+ "XvMCRTSurface")))
+ return;
+
+ if (!(XvMCRTSubpicture = CreateNewResourceType(XvMCDestroySubpictureRes,
+ "XvMCRTSubpicture")))
+ return;
+
+ extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors,
+ ProcXvMCDispatch, SProcXvMCDispatch,
+ NULL, StandardMinorOpcode);
+
+ if (!extEntry)
+ return;
+
+ XvMCReqCode = extEntry->base;
+ XvMCEventBase = extEntry->eventBase;
+ SetResourceTypeErrorValue(XvMCRTContext,
+ extEntry->errorBase + XvMCBadContext);
+ SetResourceTypeErrorValue(XvMCRTSurface,
+ extEntry->errorBase + XvMCBadSurface);
+ SetResourceTypeErrorValue(XvMCRTSubpicture,
+ extEntry->errorBase + XvMCBadSubpicture);
}
static Bool
-XvMCCloseScreen (int i, ScreenPtr pScreen)
+XvMCCloseScreen(int i, ScreenPtr pScreen)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
@@ -705,40 +717,40 @@ XvMCCloseScreen (int i, ScreenPtr pScreen)
free(pScreenPriv);
- return (*pScreen->CloseScreen)(i, pScreen);
+ return (*pScreen->CloseScreen) (i, pScreen);
}
-
int
XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
{
- XvMCScreenPtr pScreenPriv;
+ XvMCScreenPtr pScreenPriv;
- if (!dixRegisterPrivateKey(&XvMCScreenKeyRec, PRIVATE_SCREEN, 0))
- return BadAlloc;
+ if (!dixRegisterPrivateKey(&XvMCScreenKeyRec, PRIVATE_SCREEN, 0))
+ return BadAlloc;
- if(!(pScreenPriv = malloc(sizeof(XvMCScreenRec))))
- return BadAlloc;
+ if (!(pScreenPriv = malloc(sizeof(XvMCScreenRec))))
+ return BadAlloc;
- dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
+ dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = XvMCCloseScreen;
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = XvMCCloseScreen;
- pScreenPriv->num_adaptors = num;
- pScreenPriv->adaptors = pAdapt;
- pScreenPriv->clientDriverName[0] = 0;
- pScreenPriv->busID[0] = 0;
- pScreenPriv->major = 0;
- pScreenPriv->minor = 0;
- pScreenPriv->patchLevel = 0;
+ pScreenPriv->num_adaptors = num;
+ pScreenPriv->adaptors = pAdapt;
+ pScreenPriv->clientDriverName[0] = 0;
+ pScreenPriv->busID[0] = 0;
+ pScreenPriv->major = 0;
+ pScreenPriv->minor = 0;
+ pScreenPriv->patchLevel = 0;
- XvMCInUse = TRUE;
+ XvMCInUse = TRUE;
- return Success;
+ return Success;
}
-XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
+XvImagePtr
+XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
{
XvImagePtr pImage = NULL;
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
@@ -749,20 +761,21 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
if (!dixPrivateKeyRegistered(XvMCScreenKey))
return NULL;
- if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
+ if (!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
return NULL;
- for(i = 0; i < pScreenPriv->num_adaptors; i++) {
- if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
- adaptor = &(pScreenPriv->adaptors[i]);
- break;
- }
+ for (i = 0; i < pScreenPriv->num_adaptors; i++) {
+ if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
+ adaptor = &(pScreenPriv->adaptors[i]);
+ break;
+ }
}
- if(!adaptor) return NULL;
+ if (!adaptor)
+ return NULL;
- for(i = 0; i < adaptor->num_subpictures; i++) {
- if(adaptor->subpictures[i]->id == id) {
+ for (i = 0; i < adaptor->num_subpictures; i++) {
+ if (adaptor->subpictures[i]->id == id) {
pImage = adaptor->subpictures[i];
break;
}
@@ -773,16 +786,14 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
int
xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
- char *busID, int major, int minor,
- int patchLevel)
+ char *busID, int major, int minor, int patchLevel)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
- strlcpy(pScreenPriv->clientDriverName, name,
- DR_CLIENT_DRIVER_NAME_SIZE);
+
+ strlcpy(pScreenPriv->clientDriverName, name, DR_CLIENT_DRIVER_NAME_SIZE);
strlcpy(pScreenPriv->busID, busID, DR_BUSID_SIZE);
pScreenPriv->major = major;
pScreenPriv->minor = minor;
pScreenPriv->patchLevel = patchLevel;
return Success;
}
-
diff --git a/xorg-server/Xext/xvmcext.h b/xorg-server/Xext/xvmcext.h
index 5b431260f..5a4261bbd 100644
--- a/xorg-server/Xext/xvmcext.h
+++ b/xorg-server/Xext/xvmcext.h
@@ -5,114 +5,96 @@
#include "xvdix.h"
typedef struct {
- int num_xvimages;
- int *xvimage_ids;
+ int num_xvimages;
+ int *xvimage_ids;
} XvMCImageIDList;
typedef struct {
- int surface_type_id;
- int chroma_format;
- int color_description;
- unsigned short max_width;
- unsigned short max_height;
- unsigned short subpicture_max_width;
- unsigned short subpicture_max_height;
- int mc_type;
- int flags;
- XvMCImageIDList *compatible_subpictures;
+ int surface_type_id;
+ int chroma_format;
+ int color_description;
+ unsigned short max_width;
+ unsigned short max_height;
+ unsigned short subpicture_max_width;
+ unsigned short subpicture_max_height;
+ int mc_type;
+ int flags;
+ XvMCImageIDList *compatible_subpictures;
} XvMCSurfaceInfoRec, *XvMCSurfaceInfoPtr;
typedef struct {
- XID context_id;
- ScreenPtr pScreen;
- int adapt_num;
- int surface_type_id;
- unsigned short width;
- unsigned short height;
- CARD32 flags;
- int refcnt;
- pointer port_priv;
- pointer driver_priv;
+ XID context_id;
+ ScreenPtr pScreen;
+ int adapt_num;
+ int surface_type_id;
+ unsigned short width;
+ unsigned short height;
+ CARD32 flags;
+ int refcnt;
+ pointer port_priv;
+ pointer driver_priv;
} XvMCContextRec, *XvMCContextPtr;
typedef struct {
- XID surface_id;
- int surface_type_id;
- XvMCContextPtr context;
- pointer driver_priv;
+ XID surface_id;
+ int surface_type_id;
+ XvMCContextPtr context;
+ pointer driver_priv;
} XvMCSurfaceRec, *XvMCSurfacePtr;
-
typedef struct {
- XID subpicture_id;
- int xvimage_id;
- unsigned short width;
- unsigned short height;
- int num_palette_entries;
- int entry_bytes;
- char component_order[4];
- XvMCContextPtr context;
- pointer driver_priv;
+ XID subpicture_id;
+ int xvimage_id;
+ unsigned short width;
+ unsigned short height;
+ int num_palette_entries;
+ int entry_bytes;
+ char component_order[4];
+ XvMCContextPtr context;
+ pointer driver_priv;
} XvMCSubpictureRec, *XvMCSubpicturePtr;
-typedef int (*XvMCCreateContextProcPtr) (
- XvPortPtr port,
- XvMCContextPtr context,
- int *num_priv,
- CARD32 **priv
-);
-
-typedef void (*XvMCDestroyContextProcPtr) (
- XvMCContextPtr context
-);
+typedef int (*XvMCCreateContextProcPtr) (XvPortPtr port,
+ XvMCContextPtr context,
+ int *num_priv, CARD32 **priv);
-typedef int (*XvMCCreateSurfaceProcPtr) (
- XvMCSurfacePtr surface,
- int *num_priv,
- CARD32 **priv
-);
+typedef void (*XvMCDestroyContextProcPtr) (XvMCContextPtr context);
-typedef void (*XvMCDestroySurfaceProcPtr) (
- XvMCSurfacePtr surface
-);
+typedef int (*XvMCCreateSurfaceProcPtr) (XvMCSurfacePtr surface,
+ int *num_priv, CARD32 **priv);
-typedef int (*XvMCCreateSubpictureProcPtr) (
- XvMCSubpicturePtr subpicture,
- int *num_priv,
- CARD32 **priv
-);
+typedef void (*XvMCDestroySurfaceProcPtr) (XvMCSurfacePtr surface);
-typedef void (*XvMCDestroySubpictureProcPtr) (
- XvMCSubpicturePtr subpicture
-);
+typedef int (*XvMCCreateSubpictureProcPtr) (XvMCSubpicturePtr subpicture,
+ int *num_priv, CARD32 **priv);
+typedef void (*XvMCDestroySubpictureProcPtr) (XvMCSubpicturePtr subpicture);
typedef struct {
- XvAdaptorPtr xv_adaptor;
- int num_surfaces;
- XvMCSurfaceInfoPtr *surfaces;
- int num_subpictures;
- XvImagePtr *subpictures;
- XvMCCreateContextProcPtr CreateContext;
- XvMCDestroyContextProcPtr DestroyContext;
- XvMCCreateSurfaceProcPtr CreateSurface;
- XvMCDestroySurfaceProcPtr DestroySurface;
- XvMCCreateSubpictureProcPtr CreateSubpicture;
- XvMCDestroySubpictureProcPtr DestroySubpicture;
+ XvAdaptorPtr xv_adaptor;
+ int num_surfaces;
+ XvMCSurfaceInfoPtr *surfaces;
+ int num_subpictures;
+ XvImagePtr *subpictures;
+ XvMCCreateContextProcPtr CreateContext;
+ XvMCDestroyContextProcPtr DestroyContext;
+ XvMCCreateSurfaceProcPtr CreateSurface;
+ XvMCDestroySurfaceProcPtr DestroySurface;
+ XvMCCreateSubpictureProcPtr CreateSubpicture;
+ XvMCDestroySubpictureProcPtr DestroySubpicture;
} XvMCAdaptorRec, *XvMCAdaptorPtr;
#ifndef XorgLoader
extern _X_EXPORT void XvMCExtensionInit(void);
extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
- int num,
- XvMCAdaptorPtr adapt);
+ int num, XvMCAdaptorPtr adapt);
extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
- char *busID, int major, int minor,
- int patchLevel);
+ char *busID, int major, int minor,
+ int patchLevel);
#endif
-#endif /* _XVMC_H */
+#endif /* _XVMC_H */
diff --git a/xorg-server/Xi/chgdctl.c b/xorg-server/Xi/chgdctl.c
index ca697d9d8..ff5d69aef 100644
--- a/xorg-server/Xi/chgdctl.c
+++ b/xorg-server/Xi/chgdctl.c
@@ -54,9 +54,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h> /* control constants */
+#include <X11/extensions/XIproto.h> /* control constants */
#include "XIstubs.h"
#include "exglobals.h"
@@ -80,17 +80,17 @@ SProcXChangeDeviceControl(ClientPtr client)
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
swaps(&stuff->control);
- ctl = (xDeviceCtl*)&stuff[1];
+ ctl = (xDeviceCtl *) &stuff[1];
swaps(&ctl->control);
swaps(&ctl->length);
- switch(stuff->control) {
- case DEVICE_ABS_CALIB:
- case DEVICE_ABS_AREA:
- case DEVICE_CORE:
- case DEVICE_ENABLE:
- case DEVICE_RESOLUTION:
- /* hmm. beer. *drool* */
- break;
+ switch (stuff->control) {
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ case DEVICE_CORE:
+ case DEVICE_ENABLE:
+ case DEVICE_RESOLUTION:
+ /* hmm. beer. *drool* */
+ break;
}
return (ProcXChangeDeviceControl(client));
@@ -130,44 +130,47 @@ ProcXChangeDeviceControl(ClientPtr client)
switch (stuff->control) {
case DEVICE_RESOLUTION:
- r = (xDeviceResolutionCtl *) & stuff[1];
- if ((len < bytes_to_int32(sizeof(xDeviceResolutionCtl))) ||
- (len != bytes_to_int32(sizeof(xDeviceResolutionCtl)) + r->num_valuators)) {
+ r = (xDeviceResolutionCtl *) &stuff[1];
+ if ((len < bytes_to_int32(sizeof(xDeviceResolutionCtl))) ||
+ (len !=
+ bytes_to_int32(sizeof(xDeviceResolutionCtl)) + r->num_valuators)) {
ret = BadLength;
goto out;
- }
- if (!dev->valuator) {
+ }
+ if (!dev->valuator) {
ret = BadMatch;
goto out;
- }
- if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client)) {
- rep.status = AlreadyGrabbed;
+ }
+ if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client)) {
+ rep.status = AlreadyGrabbed;
ret = Success;
goto out;
- }
- resolution = (CARD32 *) (r + 1);
- if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) {
+ }
+ resolution = (CARD32 *) (r + 1);
+ if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) {
ret = BadValue;
goto out;
- }
- status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r);
- if (status == Success) {
- a = &dev->valuator->axes[r->first_valuator];
- for (i = 0; i < r->num_valuators; i++)
- if (*(resolution + i) < (a + i)->min_resolution ||
- *(resolution + i) > (a + i)->max_resolution)
- return BadValue;
- for (i = 0; i < r->num_valuators; i++)
- (a++)->resolution = *resolution++;
+ }
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r);
+ if (status == Success) {
+ a = &dev->valuator->axes[r->first_valuator];
+ for (i = 0; i < r->num_valuators; i++)
+ if (*(resolution + i) < (a + i)->min_resolution ||
+ *(resolution + i) > (a + i)->max_resolution)
+ return BadValue;
+ for (i = 0; i < r->num_valuators; i++)
+ (a++)->resolution = *resolution++;
ret = Success;
- } else if (status == DeviceBusy) {
- rep.status = DeviceBusy;
+ }
+ else if (status == DeviceBusy) {
+ rep.status = DeviceBusy;
ret = Success;
- } else {
+ }
+ else {
ret = BadMatch;
- }
- break;
+ }
+ break;
case DEVICE_ABS_CALIB:
case DEVICE_ABS_AREA:
/* Calibration is now done through properties, and never had any effect
@@ -180,7 +183,7 @@ ProcXChangeDeviceControl(ClientPtr client)
ret = BadMatch;
break;
case DEVICE_ENABLE:
- e = (xDeviceEnableCtl *)&stuff[1];
+ e = (xDeviceEnableCtl *) &stuff[1];
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
@@ -190,10 +193,12 @@ ProcXChangeDeviceControl(ClientPtr client)
else
DisableDevice(dev, TRUE);
ret = Success;
- } else if (status == DeviceBusy) {
+ }
+ else if (status == DeviceBusy) {
rep.status = DeviceBusy;
ret = Success;
- } else {
+ }
+ else {
ret = BadMatch;
}
@@ -202,7 +207,7 @@ ProcXChangeDeviceControl(ClientPtr client)
ret = BadValue;
}
-out:
+ out:
if (ret == Success) {
dpn.type = DevicePresenceNotify;
dpn.time = currentTime.milliseconds;
@@ -227,9 +232,9 @@ out:
void
SRepXChangeDeviceControl(ClientPtr client, int size,
- xChangeDeviceControlReply * rep)
+ xChangeDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/chgfctl.c b/xorg-server/Xi/chgfctl.c
index f818cd0ce..6dcf60c66 100644
--- a/xorg-server/Xi/chgfctl.c
+++ b/xorg-server/Xi/chgfctl.c
@@ -54,9 +54,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h> /* control constants */
+#include <X11/extensions/XIproto.h> /* control constants */
#include "exglobals.h"
@@ -89,107 +89,110 @@ SProcXChangeFeedbackControl(ClientPtr client)
static int
ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
- KbdFeedbackPtr k, xKbdFeedbackCtl * f)
+ KbdFeedbackPtr k, xKbdFeedbackCtl * f)
{
KeybdCtrl kctrl;
int t;
int key = DO_ALL;
if (client->swapped) {
- swaps(&f->length);
- swaps(&f->pitch);
- swaps(&f->duration);
- swapl(&f->led_mask);
- swapl(&f->led_values);
+ swaps(&f->length);
+ swaps(&f->pitch);
+ swaps(&f->duration);
+ swapl(&f->led_mask);
+ swapl(&f->led_values);
}
kctrl = k->ctrl;
if (mask & DvKeyClickPercent) {
- t = f->click;
- if (t == -1)
- t = defaultKeyboardControl.click;
- else if (t < 0 || t > 100) {
- client->errorValue = t;
- return BadValue;
- }
- kctrl.click = t;
+ t = f->click;
+ if (t == -1)
+ t = defaultKeyboardControl.click;
+ else if (t < 0 || t > 100) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ kctrl.click = t;
}
if (mask & DvPercent) {
- t = f->percent;
- if (t == -1)
- t = defaultKeyboardControl.bell;
- else if (t < 0 || t > 100) {
- client->errorValue = t;
- return BadValue;
- }
- kctrl.bell = t;
+ t = f->percent;
+ if (t == -1)
+ t = defaultKeyboardControl.bell;
+ else if (t < 0 || t > 100) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ kctrl.bell = t;
}
if (mask & DvPitch) {
- t = f->pitch;
- if (t == -1)
- t = defaultKeyboardControl.bell_pitch;
- else if (t < 0) {
- client->errorValue = t;
- return BadValue;
- }
- kctrl.bell_pitch = t;
+ t = f->pitch;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_pitch;
+ else if (t < 0) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ kctrl.bell_pitch = t;
}
if (mask & DvDuration) {
- t = f->duration;
- if (t == -1)
- t = defaultKeyboardControl.bell_duration;
- else if (t < 0) {
- client->errorValue = t;
- return BadValue;
- }
- kctrl.bell_duration = t;
+ t = f->duration;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_duration;
+ else if (t < 0) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ kctrl.bell_duration = t;
}
if (mask & DvLed) {
- kctrl.leds &= ~(f->led_mask);
- kctrl.leds |= (f->led_mask & f->led_values);
+ kctrl.leds &= ~(f->led_mask);
+ kctrl.leds |= (f->led_mask & f->led_values);
}
if (mask & DvKey) {
- key = (KeyCode) f->key;
- if (key < 8 || key > 255) {
- client->errorValue = key;
- return BadValue;
- }
- if (!(mask & DvAutoRepeatMode))
- return BadMatch;
+ key = (KeyCode) f->key;
+ if (key < 8 || key > 255) {
+ client->errorValue = key;
+ return BadValue;
+ }
+ if (!(mask & DvAutoRepeatMode))
+ return BadMatch;
}
if (mask & DvAutoRepeatMode) {
- int inx = (key >> 3);
- int kmask = (1 << (key & 7));
-
- t = (CARD8) f->auto_repeat_mode;
- if (t == AutoRepeatModeOff) {
- if (key == DO_ALL)
- kctrl.autoRepeat = FALSE;
- else
- kctrl.autoRepeats[inx] &= ~kmask;
- } else if (t == AutoRepeatModeOn) {
- if (key == DO_ALL)
- kctrl.autoRepeat = TRUE;
- else
- kctrl.autoRepeats[inx] |= kmask;
- } else if (t == AutoRepeatModeDefault) {
- if (key == DO_ALL)
- kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
- else
- kctrl.autoRepeats[inx] &= ~kmask;
- kctrl.autoRepeats[inx] =
- (kctrl.autoRepeats[inx] & ~kmask) |
- (defaultKeyboardControl.autoRepeats[inx] & kmask);
- } else {
- client->errorValue = t;
- return BadValue;
- }
+ int inx = (key >> 3);
+ int kmask = (1 << (key & 7));
+
+ t = (CARD8) f->auto_repeat_mode;
+ if (t == AutoRepeatModeOff) {
+ if (key == DO_ALL)
+ kctrl.autoRepeat = FALSE;
+ else
+ kctrl.autoRepeats[inx] &= ~kmask;
+ }
+ else if (t == AutoRepeatModeOn) {
+ if (key == DO_ALL)
+ kctrl.autoRepeat = TRUE;
+ else
+ kctrl.autoRepeats[inx] |= kmask;
+ }
+ else if (t == AutoRepeatModeDefault) {
+ if (key == DO_ALL)
+ kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
+ else
+ kctrl.autoRepeats[inx] &= ~kmask;
+ kctrl.autoRepeats[inx] =
+ (kctrl.autoRepeats[inx] & ~kmask) |
+ (defaultKeyboardControl.autoRepeats[inx] & kmask);
+ }
+ else {
+ client->errorValue = t;
+ return BadValue;
+ }
}
k->ctrl = kctrl;
@@ -205,55 +208,58 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
static int
ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
- PtrFeedbackPtr p, xPtrFeedbackCtl * f)
+ PtrFeedbackPtr p, xPtrFeedbackCtl * f)
{
- PtrCtrl pctrl; /* might get BadValue part way through */
+ PtrCtrl pctrl; /* might get BadValue part way through */
if (client->swapped) {
- swaps(&f->length);
- swaps(&f->num);
- swaps(&f->denom);
- swaps(&f->thresh);
+ swaps(&f->length);
+ swaps(&f->num);
+ swaps(&f->denom);
+ swaps(&f->thresh);
}
pctrl = p->ctrl;
if (mask & DvAccelNum) {
- int accelNum;
-
- accelNum = f->num;
- if (accelNum == -1)
- pctrl.num = defaultPointerControl.num;
- else if (accelNum < 0) {
- client->errorValue = accelNum;
- return BadValue;
- } else
- pctrl.num = accelNum;
+ int accelNum;
+
+ accelNum = f->num;
+ if (accelNum == -1)
+ pctrl.num = defaultPointerControl.num;
+ else if (accelNum < 0) {
+ client->errorValue = accelNum;
+ return BadValue;
+ }
+ else
+ pctrl.num = accelNum;
}
if (mask & DvAccelDenom) {
- int accelDenom;
-
- accelDenom = f->denom;
- if (accelDenom == -1)
- pctrl.den = defaultPointerControl.den;
- else if (accelDenom <= 0) {
- client->errorValue = accelDenom;
- return BadValue;
- } else
- pctrl.den = accelDenom;
+ int accelDenom;
+
+ accelDenom = f->denom;
+ if (accelDenom == -1)
+ pctrl.den = defaultPointerControl.den;
+ else if (accelDenom <= 0) {
+ client->errorValue = accelDenom;
+ return BadValue;
+ }
+ else
+ pctrl.den = accelDenom;
}
if (mask & DvThreshold) {
- int threshold;
-
- threshold = f->thresh;
- if (threshold == -1)
- pctrl.threshold = defaultPointerControl.threshold;
- else if (threshold < 0) {
- client->errorValue = threshold;
- return BadValue;
- } else
- pctrl.threshold = threshold;
+ int threshold;
+
+ threshold = f->thresh;
+ if (threshold == -1)
+ pctrl.threshold = defaultPointerControl.threshold;
+ else if (threshold < 0) {
+ client->errorValue = threshold;
+ return BadValue;
+ }
+ else
+ pctrl.threshold = threshold;
}
p->ctrl = pctrl;
@@ -269,12 +275,12 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
static int
ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
- long unsigned int mask, IntegerFeedbackPtr i,
- xIntegerFeedbackCtl * f)
+ long unsigned int mask, IntegerFeedbackPtr i,
+ xIntegerFeedbackCtl * f)
{
if (client->swapped) {
- swaps(&f->length);
- swapl(&f->int_to_display);
+ swaps(&f->length);
+ swapl(&f->int_to_display);
}
i->ctrl.integer_displayed = f->int_to_display;
@@ -290,33 +296,33 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
static int
ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
- long unsigned int mask, StringFeedbackPtr s,
- xStringFeedbackCtl * f)
+ long unsigned int mask, StringFeedbackPtr s,
+ xStringFeedbackCtl * f)
{
int i, j;
KeySym *syms, *sup_syms;
syms = (KeySym *) (f + 1);
if (client->swapped) {
- swaps(&f->length); /* swapped num_keysyms in calling proc */
- SwapLongs((CARD32 *) syms, f->num_keysyms);
+ swaps(&f->length); /* swapped num_keysyms in calling proc */
+ SwapLongs((CARD32 *) syms, f->num_keysyms);
}
if (f->num_keysyms > s->ctrl.max_symbols)
- return BadValue;
+ return BadValue;
sup_syms = s->ctrl.symbols_supported;
for (i = 0; i < f->num_keysyms; i++) {
- for (j = 0; j < s->ctrl.num_symbols_supported; j++)
- if (*(syms + i) == *(sup_syms + j))
- break;
- if (j == s->ctrl.num_symbols_supported)
- return BadMatch;
+ for (j = 0; j < s->ctrl.num_symbols_supported; j++)
+ if (*(syms + i) == *(sup_syms + j))
+ break;
+ if (j == s->ctrl.num_symbols_supported)
+ return BadMatch;
}
s->ctrl.num_symbols_displayed = f->num_keysyms;
for (i = 0; i < f->num_keysyms; i++)
- *(s->ctrl.symbols_displayed + i) = *(syms + i);
+ *(s->ctrl.symbols_displayed + i) = *(syms + i);
(*s->CtrlProc) (dev, &s->ctrl);
return Success;
}
@@ -329,50 +335,50 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
static int
ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
- long unsigned int mask, BellFeedbackPtr b,
- xBellFeedbackCtl * f)
+ long unsigned int mask, BellFeedbackPtr b,
+ xBellFeedbackCtl * f)
{
int t;
- BellCtrl bctrl; /* might get BadValue part way through */
+ BellCtrl bctrl; /* might get BadValue part way through */
if (client->swapped) {
- swaps(&f->length);
- swaps(&f->pitch);
- swaps(&f->duration);
+ swaps(&f->length);
+ swaps(&f->pitch);
+ swaps(&f->duration);
}
bctrl = b->ctrl;
if (mask & DvPercent) {
- t = f->percent;
- if (t == -1)
- t = defaultKeyboardControl.bell;
- else if (t < 0 || t > 100) {
- client->errorValue = t;
- return BadValue;
- }
- bctrl.percent = t;
+ t = f->percent;
+ if (t == -1)
+ t = defaultKeyboardControl.bell;
+ else if (t < 0 || t > 100) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ bctrl.percent = t;
}
if (mask & DvPitch) {
- t = f->pitch;
- if (t == -1)
- t = defaultKeyboardControl.bell_pitch;
- else if (t < 0) {
- client->errorValue = t;
- return BadValue;
- }
- bctrl.pitch = t;
+ t = f->pitch;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_pitch;
+ else if (t < 0) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ bctrl.pitch = t;
}
if (mask & DvDuration) {
- t = f->duration;
- if (t == -1)
- t = defaultKeyboardControl.bell_duration;
- else if (t < 0) {
- client->errorValue = t;
- return BadValue;
- }
- bctrl.duration = t;
+ t = f->duration;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_duration;
+ else if (t < 0) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ bctrl.duration = t;
}
b->ctrl = bctrl;
(*b->CtrlProc) (dev, &b->ctrl);
@@ -387,24 +393,24 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
static int
ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
- LedFeedbackPtr l, xLedFeedbackCtl * f)
+ LedFeedbackPtr l, xLedFeedbackCtl * f)
{
- LedCtrl lctrl; /* might get BadValue part way through */
+ LedCtrl lctrl; /* might get BadValue part way through */
if (client->swapped) {
- swaps(&f->length);
- swapl(&f->led_values);
- swapl(&f->led_mask);
+ swaps(&f->length);
+ swapl(&f->led_values);
+ swapl(&f->led_mask);
}
- f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
- f->led_values &= l->ctrl.led_mask; /* set only supported leds */
+ f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
+ f->led_values &= l->ctrl.led_mask; /* set only supported leds */
if (mask & DvLed) {
- lctrl.led_mask = f->led_mask;
- lctrl.led_values = f->led_values;
- (*l->CtrlProc) (dev, &lctrl);
- l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */
- l->ctrl.led_values |= (f->led_mask & f->led_values); /* OR in set leds */
+ lctrl.led_mask = f->led_mask;
+ lctrl.led_values = f->led_values;
+ (*l->CtrlProc) (dev, &lctrl);
+ l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */
+ l->ctrl.led_values |= (f->led_mask & f->led_values); /* OR in set leds */
}
return Success;
@@ -435,74 +441,75 @@ ProcXChangeFeedbackControl(ClientPtr client)
len = stuff->length - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->feedbackid) {
case KbdFeedbackClass:
- if (len != bytes_to_int32(sizeof(xKbdFeedbackCtl)))
- return BadLength;
-
- for (k = dev->kbdfeed; k; k = k->next)
- if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id)
- return ChangeKbdFeedback(client, dev, stuff->mask, k,
- (xKbdFeedbackCtl *) & stuff[1]);
- break;
+ if (len != bytes_to_int32(sizeof(xKbdFeedbackCtl)))
+ return BadLength;
+
+ for (k = dev->kbdfeed; k; k = k->next)
+ if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id)
+ return ChangeKbdFeedback(client, dev, stuff->mask, k,
+ (xKbdFeedbackCtl *) &stuff[1]);
+ break;
case PtrFeedbackClass:
- if (len != bytes_to_int32(sizeof(xPtrFeedbackCtl)))
- return BadLength;
-
- for (p = dev->ptrfeed; p; p = p->next)
- if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id)
- return ChangePtrFeedback(client, dev, stuff->mask, p,
- (xPtrFeedbackCtl *) & stuff[1]);
- break;
+ if (len != bytes_to_int32(sizeof(xPtrFeedbackCtl)))
+ return BadLength;
+
+ for (p = dev->ptrfeed; p; p = p->next)
+ if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id)
+ return ChangePtrFeedback(client, dev, stuff->mask, p,
+ (xPtrFeedbackCtl *) &stuff[1]);
+ break;
case StringFeedbackClass:
{
- xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
-
- if (client->swapped) {
- swaps(&f->num_keysyms);
- }
- if (len != (bytes_to_int32(sizeof(xStringFeedbackCtl)) + f->num_keysyms))
- return BadLength;
-
- for (s = dev->stringfeed; s; s = s->next)
- if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id)
- return ChangeStringFeedback(client, dev, stuff->mask, s,
- (xStringFeedbackCtl *) & stuff[1]);
- break;
+ xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
+
+ if (client->swapped) {
+ swaps(&f->num_keysyms);
+ }
+ if (len !=
+ (bytes_to_int32(sizeof(xStringFeedbackCtl)) + f->num_keysyms))
+ return BadLength;
+
+ for (s = dev->stringfeed; s; s = s->next)
+ if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id)
+ return ChangeStringFeedback(client, dev, stuff->mask, s,
+ (xStringFeedbackCtl *) &stuff[1]);
+ break;
}
case IntegerFeedbackClass:
- if (len != bytes_to_int32(sizeof(xIntegerFeedbackCtl)))
- return BadLength;
-
- for (i = dev->intfeed; i; i = i->next)
- if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id)
- return ChangeIntegerFeedback(client, dev, stuff->mask, i,
- (xIntegerFeedbackCtl *)&stuff[1]);
- break;
+ if (len != bytes_to_int32(sizeof(xIntegerFeedbackCtl)))
+ return BadLength;
+
+ for (i = dev->intfeed; i; i = i->next)
+ if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id)
+ return ChangeIntegerFeedback(client, dev, stuff->mask, i,
+ (xIntegerFeedbackCtl *) &
+ stuff[1]);
+ break;
case LedFeedbackClass:
- if (len != bytes_to_int32(sizeof(xLedFeedbackCtl)))
- return BadLength;
-
- for (l = dev->leds; l; l = l->next)
- if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id)
- return ChangeLedFeedback(client, dev, stuff->mask, l,
- (xLedFeedbackCtl *) & stuff[1]);
- break;
+ if (len != bytes_to_int32(sizeof(xLedFeedbackCtl)))
+ return BadLength;
+
+ for (l = dev->leds; l; l = l->next)
+ if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id)
+ return ChangeLedFeedback(client, dev, stuff->mask, l,
+ (xLedFeedbackCtl *) &stuff[1]);
+ break;
case BellFeedbackClass:
- if (len != bytes_to_int32(sizeof(xBellFeedbackCtl)))
- return BadLength;
-
- for (b = dev->bell; b; b = b->next)
- if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id)
- return ChangeBellFeedback(client, dev, stuff->mask, b,
- (xBellFeedbackCtl *) & stuff[1]);
- break;
+ if (len != bytes_to_int32(sizeof(xBellFeedbackCtl)))
+ return BadLength;
+
+ for (b = dev->bell; b; b = b->next)
+ if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id)
+ return ChangeBellFeedback(client, dev, stuff->mask, b,
+ (xBellFeedbackCtl *) &stuff[1]);
+ break;
default:
- break;
+ break;
}
return BadMatch;
}
-
diff --git a/xorg-server/Xi/chgprop.c b/xorg-server/Xi/chgprop.c
index a9f833c25..84fb51dcb 100644
--- a/xorg-server/Xi/chgprop.c
+++ b/xorg-server/Xi/chgprop.c
@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
+#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
@@ -80,7 +80,7 @@ SProcXChangeDeviceDontPropagateList(ClientPtr client)
swapl(&stuff->window);
swaps(&stuff->count);
REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq,
- stuff->count * sizeof(CARD32));
+ stuff->count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
return (ProcXChangeDeviceDontPropagateList(client));
}
@@ -102,39 +102,40 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
REQUEST(xChangeDeviceDontPropagateListReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
- if (stuff->length != bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
- stuff->count)
- return BadLength;
+ if (stuff->length !=
+ bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
+ stuff->count)
+ return BadLength;
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (stuff->mode != AddToList && stuff->mode != DeleteFromList) {
- client->errorValue = stuff->window;
- return BadMode;
+ client->errorValue = stuff->window;
+ return BadMode;
}
- if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1],
- stuff->count, tmp, NULL,
- X_ChangeDeviceDontPropagateList)) != Success)
- return rc;
+ if ((rc = CreateMaskFromList(client, (XEventClass *) &stuff[1],
+ stuff->count, tmp, NULL,
+ X_ChangeDeviceDontPropagateList)) != Success)
+ return rc;
others = wOtherInputMasks(pWin);
if (!others && stuff->mode == DeleteFromList)
- return Success;
+ return Success;
for (i = 0; i < EMASKSIZE; i++) {
- if (tmp[i].mask == 0)
- continue;
+ if (tmp[i].mask == 0)
+ continue;
- if (stuff->mode == DeleteFromList)
- tmp[i].mask = (others->dontPropagateMask[i] & ~tmp[i].mask);
- else if (others)
- tmp[i].mask |= others->dontPropagateMask[i];
+ if (stuff->mode == DeleteFromList)
+ tmp[i].mask = (others->dontPropagateMask[i] & ~tmp[i].mask);
+ else if (others)
+ tmp[i].mask |= others->dontPropagateMask[i];
- if (DeviceEventSuppressForWindow(pWin, client, tmp[i].mask, i) !=
- Success)
- return BadClass;
+ if (DeviceEventSuppressForWindow(pWin, client, tmp[i].mask, i) !=
+ Success)
+ return BadClass;
}
return Success;
diff --git a/xorg-server/Xi/devbell.c b/xorg-server/Xi/devbell.c
index 881524260..c75b94dee 100644
--- a/xorg-server/Xi/devbell.c
+++ b/xorg-server/Xi/devbell.c
@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -99,47 +99,49 @@ ProcXDeviceBell(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixBellAccess);
if (rc != Success) {
- client->errorValue = stuff->deviceid;
- return rc;
+ client->errorValue = stuff->deviceid;
+ return rc;
}
if (stuff->percent < -100 || stuff->percent > 100) {
- client->errorValue = stuff->percent;
- return BadValue;
+ client->errorValue = stuff->percent;
+ return BadValue;
}
if (stuff->feedbackclass == KbdFeedbackClass) {
- for (k = dev->kbdfeed; k; k = k->next)
- if (k->ctrl.id == stuff->feedbackid)
- break;
- if (!k) {
- client->errorValue = stuff->feedbackid;
- return BadValue;
- }
- base = k->ctrl.bell;
- proc = k->BellProc;
- ctrl = (pointer) & (k->ctrl);
- class = KbdFeedbackClass;
- } else if (stuff->feedbackclass == BellFeedbackClass) {
- for (b = dev->bell; b; b = b->next)
- if (b->ctrl.id == stuff->feedbackid)
- break;
- if (!b) {
- client->errorValue = stuff->feedbackid;
- return BadValue;
- }
- base = b->ctrl.percent;
- proc = b->BellProc;
- ctrl = (pointer) & (b->ctrl);
- class = BellFeedbackClass;
- } else {
- client->errorValue = stuff->feedbackclass;
- return BadValue;
+ for (k = dev->kbdfeed; k; k = k->next)
+ if (k->ctrl.id == stuff->feedbackid)
+ break;
+ if (!k) {
+ client->errorValue = stuff->feedbackid;
+ return BadValue;
+ }
+ base = k->ctrl.bell;
+ proc = k->BellProc;
+ ctrl = (pointer) &(k->ctrl);
+ class = KbdFeedbackClass;
+ }
+ else if (stuff->feedbackclass == BellFeedbackClass) {
+ for (b = dev->bell; b; b = b->next)
+ if (b->ctrl.id == stuff->feedbackid)
+ break;
+ if (!b) {
+ client->errorValue = stuff->feedbackid;
+ return BadValue;
+ }
+ base = b->ctrl.percent;
+ proc = b->BellProc;
+ ctrl = (pointer) &(b->ctrl);
+ class = BellFeedbackClass;
+ }
+ else {
+ client->errorValue = stuff->feedbackclass;
+ return BadValue;
}
newpercent = (base * stuff->percent) / 100;
if (stuff->percent < 0)
- newpercent = base + newpercent;
+ newpercent = base + newpercent;
else
- newpercent = base - newpercent + stuff->percent;
+ newpercent = base - newpercent + stuff->percent;
(*proc) (newpercent, dev, ctrl, class);
return Success;
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index 26538a844..4ea03d87f 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -97,12 +97,12 @@ SOFTWARE.
#include "exevents.h"
#include "extnsionst.h"
#include "exglobals.h"
-#include "dixevents.h" /* DeliverFocusedEvent */
-#include "dixgrabs.h" /* CreateGrab() */
+#include "dixevents.h" /* DeliverFocusedEvent */
+#include "dixgrabs.h" /* CreateGrab() */
#include "scrnintstr.h"
-#include "listdev.h" /* for CopySwapXXXClass */
+#include "listdev.h" /* for CopySwapXXXClass */
#include "xace.h"
-#include "xiquerydevice.h" /* For List*Info */
+#include "xiquerydevice.h" /* For List*Info */
#include "eventconvert.h"
#include "eventstr.h"
#include "inpututils.h"
@@ -119,9 +119,9 @@ SOFTWARE.
Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask )
Bool ShouldFreeInputMasks(WindowPtr /* pWin */ ,
- Bool /* ignoreSelectedEvents */
+ Bool /* ignoreSelectedEvents */
);
-static Bool MakeInputMasks(WindowPtr /* pWin */
+static Bool MakeInputMasks(WindowPtr /* pWin */
);
/*
@@ -142,32 +142,30 @@ XIShouldNotify(ClientPtr client, DeviceIntPtr dev)
}
Bool
-IsPointerEvent(InternalEvent* event)
-{
- switch(event->any.type)
- {
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_Motion:
- /* XXX: enter/leave ?? */
- return TRUE;
- default:
- break;
+IsPointerEvent(InternalEvent *event)
+{
+ switch (event->any.type) {
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_Motion:
+ /* XXX: enter/leave ?? */
+ return TRUE;
+ default:
+ break;
}
return FALSE;
}
Bool
-IsTouchEvent(InternalEvent* event)
-{
- switch(event->any.type)
- {
- case ET_TouchBegin:
- case ET_TouchUpdate:
- case ET_TouchEnd:
- return TRUE;
- default:
- break;
+IsTouchEvent(InternalEvent *event)
+{
+ switch (event->any.type) {
+ case ET_TouchBegin:
+ case ET_TouchUpdate:
+ case ET_TouchEnd:
+ return TRUE;
+ default:
+ break;
}
return FALSE;
}
@@ -177,7 +175,7 @@ IsTouchEvent(InternalEvent* event)
* NULL if the event is not an XInput event.
*/
DeviceIntPtr
-XIGetDevice(xEvent* xE)
+XIGetDevice(xEvent *xE)
{
DeviceIntPtr pDev = NULL;
@@ -185,13 +183,11 @@ XIGetDevice(xEvent* xE)
xE->u.u.type == DeviceButtonRelease ||
xE->u.u.type == DeviceMotionNotify ||
xE->u.u.type == ProximityIn ||
- xE->u.u.type == ProximityOut ||
- xE->u.u.type == DevicePropertyNotify)
- {
+ xE->u.u.type == ProximityOut || xE->u.u.type == DevicePropertyNotify) {
int rc;
int id;
- id = ((deviceKeyButtonPointer*)xE)->deviceid & ~MORE_EVENTS;
+ id = ((deviceKeyButtonPointer *) xE)->deviceid & ~MORE_EVENTS;
rc = dixLookupDevice(&pDev, id, serverClient, DixUnknownAccess);
if (rc != Success)
@@ -200,7 +196,6 @@ XIGetDevice(xEvent* xE)
return pDev;
}
-
/**
* Copy the device->key into master->key and send a mapping notify to the
* clients if appropriate.
@@ -237,7 +232,6 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
mk->sourceid = device->id;
-
if (!XkbCopyDeviceKeymap(master, device))
FatalError("Couldn't pivot keymap from device to core!\n");
}
@@ -252,153 +246,136 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
{
ClassesPtr classes;
-
- if (from->intfeed)
- {
+ if (from->intfeed) {
IntegerFeedbackPtr *i, it;
- if (!to->intfeed)
- {
+ if (!to->intfeed) {
classes = to->unused_classes;
to->intfeed = classes->intfeed;
classes->intfeed = NULL;
}
i = &to->intfeed;
- for (it = from->intfeed; it; it = it->next)
- {
- if (!(*i))
- {
+ for (it = from->intfeed; it; it = it->next) {
+ if (!(*i)) {
*i = calloc(1, sizeof(IntegerFeedbackClassRec));
- if (!(*i))
- {
+ if (!(*i)) {
ErrorF("[Xi] Cannot alloc memory for class copy.");
return;
}
}
(*i)->CtrlProc = it->CtrlProc;
- (*i)->ctrl = it->ctrl;
+ (*i)->ctrl = it->ctrl;
i = &(*i)->next;
}
- } else if (to->intfeed && !from->intfeed)
- {
+ }
+ else if (to->intfeed && !from->intfeed) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->intfeed = to->intfeed;
- to->intfeed = NULL;
+ to->intfeed = NULL;
}
- if (from->stringfeed)
- {
+ if (from->stringfeed) {
StringFeedbackPtr *s, it;
- if (!to->stringfeed)
- {
+ if (!to->stringfeed) {
classes = to->unused_classes;
to->stringfeed = classes->stringfeed;
classes->stringfeed = NULL;
}
s = &to->stringfeed;
- for (it = from->stringfeed; it; it = it->next)
- {
- if (!(*s))
- {
+ for (it = from->stringfeed; it; it = it->next) {
+ if (!(*s)) {
*s = calloc(1, sizeof(StringFeedbackClassRec));
- if (!(*s))
- {
+ if (!(*s)) {
ErrorF("[Xi] Cannot alloc memory for class copy.");
return;
}
}
(*s)->CtrlProc = it->CtrlProc;
- (*s)->ctrl = it->ctrl;
+ (*s)->ctrl = it->ctrl;
s = &(*s)->next;
}
- } else if (to->stringfeed && !from->stringfeed)
- {
+ }
+ else if (to->stringfeed && !from->stringfeed) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->stringfeed = to->stringfeed;
- to->stringfeed = NULL;
+ to->stringfeed = NULL;
}
- if (from->bell)
- {
+ if (from->bell) {
BellFeedbackPtr *b, it;
- if (!to->bell)
- {
+ if (!to->bell) {
classes = to->unused_classes;
to->bell = classes->bell;
classes->bell = NULL;
}
b = &to->bell;
- for (it = from->bell; it; it = it->next)
- {
- if (!(*b))
- {
+ for (it = from->bell; it; it = it->next) {
+ if (!(*b)) {
*b = calloc(1, sizeof(BellFeedbackClassRec));
- if (!(*b))
- {
+ if (!(*b)) {
ErrorF("[Xi] Cannot alloc memory for class copy.");
return;
}
}
(*b)->BellProc = it->BellProc;
(*b)->CtrlProc = it->CtrlProc;
- (*b)->ctrl = it->ctrl;
+ (*b)->ctrl = it->ctrl;
b = &(*b)->next;
}
- } else if (to->bell && !from->bell)
- {
+ }
+ else if (to->bell && !from->bell) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->bell = to->bell;
- to->bell = NULL;
+ to->bell = NULL;
}
- if (from->leds)
- {
+ if (from->leds) {
LedFeedbackPtr *l, it;
- if (!to->leds)
- {
+ if (!to->leds) {
classes = to->unused_classes;
to->leds = classes->leds;
classes->leds = NULL;
}
l = &to->leds;
- for (it = from->leds; it; it = it->next)
- {
- if (!(*l))
- {
+ for (it = from->leds; it; it = it->next) {
+ if (!(*l)) {
*l = calloc(1, sizeof(LedFeedbackClassRec));
- if (!(*l))
- {
+ if (!(*l)) {
ErrorF("[Xi] Cannot alloc memory for class copy.");
return;
}
}
(*l)->CtrlProc = it->CtrlProc;
- (*l)->ctrl = it->ctrl;
+ (*l)->ctrl = it->ctrl;
if ((*l)->xkb_sli)
XkbFreeSrvLedInfo((*l)->xkb_sli);
(*l)->xkb_sli = XkbCopySrvLedInfo(from, it->xkb_sli, NULL, *l);
l = &(*l)->next;
}
- } else if (to->leds && !from->leds)
- {
+ }
+ else if (to->leds && !from->leds) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->leds = to->leds;
- to->leds = NULL;
+ to->leds = NULL;
}
}
@@ -410,12 +387,10 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
/* XkbInitDevice (->XkbInitIndicatorMap->XkbFindSrvLedInfo) relies on the
* kbdfeed to be set up properly, so let's do the feedback classes first.
*/
- if (from->kbdfeed)
- {
+ if (from->kbdfeed) {
KbdFeedbackPtr *k, it;
- if (!to->kbdfeed)
- {
+ if (!to->kbdfeed) {
classes = to->unused_classes;
to->kbdfeed = classes->kbdfeed;
@@ -425,38 +400,34 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
}
k = &to->kbdfeed;
- for(it = from->kbdfeed; it; it = it->next)
- {
- if (!(*k))
- {
+ for (it = from->kbdfeed; it; it = it->next) {
+ if (!(*k)) {
*k = calloc(1, sizeof(KbdFeedbackClassRec));
- if (!*k)
- {
+ if (!*k) {
ErrorF("[Xi] Cannot alloc memory for class copy.");
return;
}
}
(*k)->BellProc = it->BellProc;
(*k)->CtrlProc = it->CtrlProc;
- (*k)->ctrl = it->ctrl;
+ (*k)->ctrl = it->ctrl;
if ((*k)->xkb_sli)
XkbFreeSrvLedInfo((*k)->xkb_sli);
(*k)->xkb_sli = XkbCopySrvLedInfo(from, it->xkb_sli, *k, NULL);
k = &(*k)->next;
}
- } else if (to->kbdfeed && !from->kbdfeed)
- {
+ }
+ else if (to->kbdfeed && !from->kbdfeed) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->kbdfeed = to->kbdfeed;
- to->kbdfeed = NULL;
+ to->kbdfeed = NULL;
}
- if (from->key)
- {
- if (!to->key)
- {
+ if (from->key) {
+ if (!to->key) {
classes = to->unused_classes;
to->key = classes->key;
if (!to->key)
@@ -466,28 +437,26 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
}
CopyKeyClass(from, to);
- } else if (to->key && !from->key)
- {
+ }
+ else if (to->key && !from->key) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->key = to->key;
- to->key = NULL;
+ to->key = NULL;
}
/* If a SrvLedInfoPtr's flags are XkbSLI_IsDefault, the names and maps
* pointer point into the xkbInfo->desc struct. XkbCopySrvLedInfo
* didn't update the pointers so we need to do it manually here.
*/
- if (to->kbdfeed)
- {
+ if (to->kbdfeed) {
KbdFeedbackPtr k;
- for (k = to->kbdfeed; k; k = k->next)
- {
+ for (k = to->kbdfeed; k; k = k->next) {
if (!k->xkb_sli)
continue;
- if (k->xkb_sli->flags & XkbSLI_IsDefault)
- {
+ if (k->xkb_sli->flags & XkbSLI_IsDefault) {
k->xkb_sli->names = to->key->xkbInfo->desc->names->indicators;
k->xkb_sli->maps = to->key->xkbInfo->desc->indicators->maps;
}
@@ -500,38 +469,38 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
* So we only copy the focus class if the device didn't have one,
* otherwise we leave it as it is.
*/
- if (from->focus)
- {
- if (!to->focus)
- {
+ if (from->focus) {
+ if (!to->focus) {
WindowPtr *oldTrace;
classes = to->unused_classes;
to->focus = classes->focus;
- if (!to->focus)
- {
+ if (!to->focus) {
to->focus = calloc(1, sizeof(FocusClassRec));
if (!to->focus)
FatalError("[Xi] no memory for class shift.\n");
- } else
+ }
+ else
classes->focus = NULL;
oldTrace = to->focus->trace;
memcpy(to->focus, from->focus, sizeof(FocusClassRec));
to->focus->trace = realloc(oldTrace,
- to->focus->traceSize * sizeof(WindowPtr));
+ to->focus->traceSize *
+ sizeof(WindowPtr));
if (!to->focus->trace && to->focus->traceSize)
FatalError("[Xi] no memory for trace.\n");
memcpy(to->focus->trace, from->focus->trace,
- from->focus->traceSize * sizeof(WindowPtr));
+ from->focus->traceSize * sizeof(WindowPtr));
to->focus->sourceid = from->id;
}
- } else if (to->focus)
- {
+ }
+ else if (to->focus) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->focus = to->focus;
- to->focus = NULL;
+ to->focus = NULL;
}
}
@@ -544,47 +513,42 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
ClassesPtr classes;
/* Feedback classes must be copied first */
- if (from->ptrfeed)
- {
+ if (from->ptrfeed) {
PtrFeedbackPtr *p, it;
- if (!to->ptrfeed)
- {
+
+ if (!to->ptrfeed) {
classes = to->unused_classes;
to->ptrfeed = classes->ptrfeed;
classes->ptrfeed = NULL;
}
p = &to->ptrfeed;
- for (it = from->ptrfeed; it; it = it->next)
- {
- if (!(*p))
- {
+ for (it = from->ptrfeed; it; it = it->next) {
+ if (!(*p)) {
*p = calloc(1, sizeof(PtrFeedbackClassRec));
- if (!*p)
- {
+ if (!*p) {
ErrorF("[Xi] Cannot alloc memory for class copy.");
return;
}
}
(*p)->CtrlProc = it->CtrlProc;
- (*p)->ctrl = it->ctrl;
+ (*p)->ctrl = it->ctrl;
p = &(*p)->next;
}
- } else if (to->ptrfeed && !from->ptrfeed)
- {
+ }
+ else if (to->ptrfeed && !from->ptrfeed) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->ptrfeed = to->ptrfeed;
- to->ptrfeed = NULL;
+ to->ptrfeed = NULL;
}
- if (from->valuator)
- {
+ if (from->valuator) {
ValuatorClassPtr v;
- if (!to->valuator)
- {
+ if (!to->valuator) {
classes = to->unused_classes;
to->valuator = classes->valuator;
if (to->valuator)
@@ -600,87 +564,84 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo));
v->sourceid = from->id;
- } else if (to->valuator && !from->valuator)
- {
+ }
+ else if (to->valuator && !from->valuator) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->valuator = to->valuator;
- to->valuator = NULL;
+ to->valuator = NULL;
}
- if (from->button)
- {
- if (!to->button)
- {
+ if (from->button) {
+ if (!to->button) {
classes = to->unused_classes;
to->button = classes->button;
- if (!to->button)
- {
+ if (!to->button) {
to->button = calloc(1, sizeof(ButtonClassRec));
if (!to->button)
FatalError("[Xi] no memory for class shift.\n");
- } else
+ }
+ else
classes->button = NULL;
}
- if (from->button->xkb_acts)
- {
- if (!to->button->xkb_acts)
- {
+ if (from->button->xkb_acts) {
+ if (!to->button->xkb_acts) {
to->button->xkb_acts = calloc(1, sizeof(XkbAction));
if (!to->button->xkb_acts)
FatalError("[Xi] not enough memory for xkb_acts.\n");
}
memcpy(to->button->xkb_acts, from->button->xkb_acts,
- sizeof(XkbAction));
- } else
+ sizeof(XkbAction));
+ }
+ else
free(to->button->xkb_acts);
- memcpy(to->button->labels, from->button->labels,
- from->button->numButtons * sizeof(Atom));
+ memcpy(to->button->labels, from->button->labels,
+ from->button->numButtons * sizeof(Atom));
to->button->sourceid = from->id;
- } else if (to->button && !from->button)
- {
+ }
+ else if (to->button && !from->button) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->button = to->button;
- to->button = NULL;
+ to->button = NULL;
}
- if (from->proximity)
- {
- if (!to->proximity)
- {
+ if (from->proximity) {
+ if (!to->proximity) {
classes = to->unused_classes;
to->proximity = classes->proximity;
- if (!to->proximity)
- {
+ if (!to->proximity) {
to->proximity = calloc(1, sizeof(ProximityClassRec));
if (!to->proximity)
FatalError("[Xi] no memory for class shift.\n");
- } else
+ }
+ else
classes->proximity = NULL;
}
memcpy(to->proximity, from->proximity, sizeof(ProximityClassRec));
to->proximity->sourceid = from->id;
- } else if (to->proximity)
- {
+ }
+ else if (to->proximity) {
ClassesPtr classes;
+
classes = to->unused_classes;
classes->proximity = to->proximity;
- to->proximity = NULL;
+ to->proximity = NULL;
}
- if (from->touch)
- {
+ if (from->touch) {
TouchClassPtr t, f;
- if (!to->touch)
- {
+
+ if (!to->touch) {
classes = to->unused_classes;
to->touch = classes->touch;
- if (!to->touch)
- {
+ if (!to->touch) {
int i;
+
to->touch = calloc(1, sizeof(TouchClassRec));
if (!to->touch)
FatalError("[Xi] no memory for class shift.\n");
@@ -691,11 +652,11 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
TouchInitTouchPoint(to->touch, to->valuator, i);
if (!to->touch)
FatalError("[Xi] no memory for class shift.\n");
- } else
+ }
+ else
classes->touch = NULL;
}
-
t = to->touch;
f = from->touch;
t->sourceid = f->sourceid;
@@ -721,7 +682,8 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
* Saves a few memory allocations.
*/
void
-DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to, DeviceChangedEvent *dce)
+DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to,
+ DeviceChangedEvent *dce)
{
/* generic feedback classes, not tied to pointer and/or keyboard */
DeepCopyFeedbackClasses(from, to);
@@ -732,7 +694,6 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to, DeviceChangedEvent *dc
DeepCopyPointerClasses(from, to);
}
-
/**
* Send an XI2 DeviceChangedEvent to all interested clients.
*/
@@ -742,16 +703,15 @@ XISendDeviceChangedEvent(DeviceIntPtr device, DeviceChangedEvent *dce)
xXIDeviceChangedEvent *dcce;
int rc;
- rc = EventToXI2((InternalEvent*)dce, (xEvent**)&dcce);
- if (rc != Success)
- {
+ rc = EventToXI2((InternalEvent *) dce, (xEvent **) &dcce);
+ if (rc != Success) {
ErrorF("[Xi] event conversion from DCE failed with code %d\n", rc);
return;
}
/* we don't actually swap if there's a NullClient, swapping is done
* later when event is delivered. */
- SendEventToAllWindows(device, XI_DeviceChangedMask, (xEvent*)dcce, 1);
+ SendEventToAllWindows(device, XI_DeviceChangedMask, (xEvent *) dcce, 1);
free(dcce);
}
@@ -768,16 +728,16 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
rc = dixLookupDevice(&slave, dce->sourceid, serverClient, DixReadAccess);
if (rc != Success)
- return; /* Device has disappeared */
+ return; /* Device has disappeared */
if (IsMaster(slave))
return;
if (IsFloating(slave))
- return; /* set floating since the event */
+ return; /* set floating since the event */
if (GetMaster(slave, MASTER_ATTACHED)->id != dce->masterid)
- return; /* not our slave anymore, don't care */
+ return; /* not our slave anymore, don't care */
/* FIXME: we probably need to send a DCE for the new slave now */
@@ -848,40 +808,38 @@ DecreaseButtonCount(DeviceIntPtr dev, int key, CARD8 *buttons_down,
#define DEFAULT 0
#define DONT_PROCESS 1
int
-UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
+UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
{
int i;
- int key = 0,
- last_valuator;
+ int key = 0, last_valuator;
- KeyClassPtr k = NULL;
- ButtonClassPtr b = NULL;
- ValuatorClassPtr v = NULL;
- TouchClassPtr t = NULL;
+ KeyClassPtr k = NULL;
+ ButtonClassPtr b = NULL;
+ ValuatorClassPtr v = NULL;
+ TouchClassPtr t = NULL;
/* This event is always the first we get, before the actual events with
* the data. However, the way how the DDX is set up, "device" will
* actually be the slave device that caused the event.
*/
- switch(event->type)
- {
- case ET_DeviceChanged:
- ChangeMasterDeviceClasses(device, (DeviceChangedEvent*)event);
- return DONT_PROCESS; /* event has been sent already */
- case ET_Motion:
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_KeyPress:
- case ET_KeyRelease:
- case ET_ProximityIn:
- case ET_ProximityOut:
- case ET_TouchBegin:
- case ET_TouchUpdate:
- case ET_TouchEnd:
- break;
- default:
- /* other events don't update the device */
- return DEFAULT;
+ switch (event->type) {
+ case ET_DeviceChanged:
+ ChangeMasterDeviceClasses(device, (DeviceChangedEvent *) event);
+ return DONT_PROCESS; /* event has been sent already */
+ case ET_Motion:
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ case ET_TouchBegin:
+ case ET_TouchUpdate:
+ case ET_TouchEnd:
+ break;
+ default:
+ /* other events don't update the device */
+ return DEFAULT;
}
k = device->key;
@@ -894,27 +852,23 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
/* Update device axis */
/* Check valuators first */
last_valuator = -1;
- for (i = 0; i < MAX_VALUATORS; i++)
- {
- if (BitIsOn(&event->valuators.mask, i))
- {
- if (!v)
- {
+ for (i = 0; i < MAX_VALUATORS; i++) {
+ if (BitIsOn(&event->valuators.mask, i)) {
+ if (!v) {
ErrorF("[Xi] Valuators reported for non-valuator device '%s'. "
- "Ignoring event.\n", device->name);
+ "Ignoring event.\n", device->name);
return DONT_PROCESS;
- } else if (v->numAxes < i)
- {
+ }
+ else if (v->numAxes < i) {
ErrorF("[Xi] Too many valuators reported for device '%s'. "
- "Ignoring event.\n", device->name);
+ "Ignoring event.\n", device->name);
return DONT_PROCESS;
}
last_valuator = i;
}
}
- for (i = 0; i <= last_valuator && i < v->numAxes; i++)
- {
+ for (i = 0; i <= last_valuator && i < v->numAxes; i++) {
/* XXX: Relative/Absolute mode */
if (BitIsOn(&event->valuators.mask, i))
v->axisVal[i] = event->valuators.data[i];
@@ -924,23 +878,25 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
if (!k)
return DONT_PROCESS;
- /* don't allow ddx to generate multiple downs, but repeats are okay */
- if (key_is_down(device, key, KEY_PROCESSED) && !event->key_repeat)
- return DONT_PROCESS;
+ /* don't allow ddx to generate multiple downs, but repeats are okay */
+ if (key_is_down(device, key, KEY_PROCESSED) && !event->key_repeat)
+ return DONT_PROCESS;
- if (device->valuator)
- device->valuator->motionHintWindow = NullWindow;
- set_key_down(device, key, KEY_PROCESSED);
- } else if (event->type == ET_KeyRelease) {
+ if (device->valuator)
+ device->valuator->motionHintWindow = NullWindow;
+ set_key_down(device, key, KEY_PROCESSED);
+ }
+ else if (event->type == ET_KeyRelease) {
if (!k)
return DONT_PROCESS;
- if (!key_is_down(device, key, KEY_PROCESSED)) /* guard against duplicates */
- return DONT_PROCESS;
- if (device->valuator)
- device->valuator->motionHintWindow = NullWindow;
- set_key_up(device, key, KEY_PROCESSED);
- } else if (event->type == ET_ButtonPress) {
+ if (!key_is_down(device, key, KEY_PROCESSED)) /* guard against duplicates */
+ return DONT_PROCESS;
+ if (device->valuator)
+ device->valuator->motionHintWindow = NullWindow;
+ set_key_up(device, key, KEY_PROCESSED);
+ }
+ else if (event->type == ET_ButtonPress) {
if (!b)
return DONT_PROCESS;
@@ -952,9 +908,11 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
if (!b->map[key])
return DONT_PROCESS;
- IncreaseButtonCount(device, key, &b->buttonsDown, &b->motionMask, &b->state);
+ IncreaseButtonCount(device, key, &b->buttonsDown, &b->motionMask,
+ &b->state);
UpdateDeviceMotionMask(device, b->state, b->motionMask);
- } else if (event->type == ET_ButtonRelease) {
+ }
+ else if (event->type == ET_ButtonRelease) {
if (!b)
return DONT_PROCESS;
@@ -983,12 +941,14 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
if (!b->map[key])
return DONT_PROCESS;
- DecreaseButtonCount(device, key, &b->buttonsDown, &b->motionMask, &b->state);
- UpdateDeviceMotionMask(device, b->state, b->motionMask);
- } else if (event->type == ET_ProximityIn)
- device->proximity->in_proximity = TRUE;
+ DecreaseButtonCount(device, key, &b->buttonsDown, &b->motionMask,
+ &b->state);
+ UpdateDeviceMotionMask(device, b->state, b->motionMask);
+ }
+ else if (event->type == ET_ProximityIn)
+ device->proximity->in_proximity = TRUE;
else if (event->type == ET_ProximityOut)
- device->proximity->in_proximity = FALSE;
+ device->proximity->in_proximity = FALSE;
else if (event->type == ET_TouchBegin) {
BUG_WARN(!b || !v);
BUG_WARN(!t);
@@ -1000,9 +960,11 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
(event->flags & TOUCH_REPLAYING))
return DONT_PROCESS;
- IncreaseButtonCount(device, key, &t->buttonsDown, &t->motionMask, &t->state);
+ IncreaseButtonCount(device, key, &t->buttonsDown, &t->motionMask,
+ &t->state);
UpdateDeviceMotionMask(device, t->state, DeviceButtonMotionMask);
- } else if (event->type == ET_TouchEnd) {
+ }
+ else if (event->type == ET_TouchEnd) {
BUG_WARN(!b || !v);
BUG_WARN(!t);
@@ -1014,7 +976,8 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
if (!(event->flags & TOUCH_END))
return DONT_PROCESS;
- DecreaseButtonCount(device, key, &t->buttonsDown, &t->motionMask, &t->state);
+ DecreaseButtonCount(device, key, &t->buttonsDown, &t->motionMask,
+ &t->state);
UpdateDeviceMotionMask(device, t->state, DeviceButtonMotionMask);
}
@@ -1029,12 +992,12 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
* window for this device, FALSE otherwise
*/
static inline Bool
-TouchClientWantsOwnershipEvents(ClientPtr client, DeviceIntPtr dev, WindowPtr win)
+TouchClientWantsOwnershipEvents(ClientPtr client, DeviceIntPtr dev,
+ WindowPtr win)
{
InputClients *iclient;
- nt_list_for_each_entry(iclient, wOtherInputMasks(win)->inputClients, next)
- {
+ nt_list_for_each_entry(iclient, wOtherInputMasks(win)->inputClients, next) {
if (rClient(iclient) != client)
continue;
@@ -1045,7 +1008,8 @@ TouchClientWantsOwnershipEvents(ClientPtr client, DeviceIntPtr dev, WindowPtr wi
}
static void
-TouchSendOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, int reason, XID resource)
+TouchSendOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, int reason,
+ XID resource)
{
int nev, i;
InternalEvent *tel = InitEventList(GetMaximumEventsNum());
@@ -1074,8 +1038,8 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
/* If the client does not have the ownership mask set and is not
* the current owner of the touch, only pretend we delivered */
if (!grab && ti->num_grabs != 0 &&
- !TouchClientWantsOwnershipEvents(client, dev,win))
- return TRUE;
+ !TouchClientWantsOwnershipEvents(client, dev, win))
+ return TRUE;
/* If we fail here, we're going to leave a client hanging. */
err = EventToXI2(ev, &xi2);
@@ -1104,8 +1068,7 @@ ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
rc = dixLookupClient(&client, ti->listeners[0].listener, serverClient,
DixSendAccess);
- if (rc != Success)
- {
+ if (rc != Success) {
ErrorF("[Xi] Failed to lookup early accepting client.\n");
return;
}
@@ -1160,15 +1123,14 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
/* Deliver the ownership */
if (ti->listeners[0].state == LISTENER_AWAITING_OWNER ||
ti->listeners[0].state == LISTENER_EARLY_ACCEPT)
- DeliverTouchEvents(dev, ti, (InternalEvent*)ev, ti->listeners[0].listener);
+ DeliverTouchEvents(dev, ti, (InternalEvent *) ev,
+ ti->listeners[0].listener);
else if (ti->listeners[0].state == LISTENER_AWAITING_BEGIN)
TouchEventHistoryReplay(ti, dev, ti->listeners[0].listener);
/* If we've just removed the last grab and the touch has physically
* ended, send a TouchEnd event too and finalise the touch. */
- if (ti->num_listeners == 1 && ti->num_grabs == 0 &&
- ti->pending_finish)
- {
+ if (ti->num_listeners == 1 && ti->num_grabs == 0 && ti->pending_finish) {
EmitTouchEnd(dev, ti, 0, 0);
TouchEndTouch(dev, ti);
return;
@@ -1197,10 +1159,8 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
/* Send a TouchEnd event to the resource being removed, but only if they
* haven't received one yet already */
- for (i = 0; i < ti->num_listeners; i++)
- {
- if (ti->listeners[i].listener == resource)
- {
+ for (i = 0; i < ti->num_listeners; i++) {
+ if (ti->listeners[i].listener == resource) {
if (ti->listeners[i].state != LISTENER_HAS_END)
EmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource);
break;
@@ -1209,16 +1169,14 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
/* If there are no other listeners left, and the touchpoint is pending
* finish, then we can just kill it now. */
- if (ti->num_listeners == 1 && ti->pending_finish)
- {
+ if (ti->num_listeners == 1 && ti->pending_finish) {
TouchEndTouch(sourcedev, ti);
return;
}
/* Remove the resource from the listener list, updating
* ti->num_listeners, as well as ti->num_grabs if it was a grab. */
- if (TouchRemoveListener(ti, resource))
- {
+ if (TouchRemoveListener(ti, resource)) {
if (dixLookupResourceByType(&grab, resource, RT_PASSIVEGRAB,
serverClient, DixGetAttrAccess) == Success)
ti->num_grabs--;
@@ -1254,8 +1212,11 @@ ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
/* Owner accepted after receiving end */
if (ti->listeners[0].state == LISTENER_HAS_END)
TouchEndTouch(dev, ti);
- } else { /* this is the very first ownership event for a grab */
- DeliverTouchEvents(dev, ti, (InternalEvent*)ev, ev->resource);
+ else
+ ti->listeners[0].state = LISTENER_HAS_ACCEPTED;
+ }
+ else { /* this is the very first ownership event for a grab */
+ DeliverTouchEvents(dev, ti, (InternalEvent *) ev, ev->resource);
}
}
@@ -1267,6 +1228,7 @@ static void
TouchCopyValuatorData(DeviceEvent *ev, TouchPointInfoPtr ti)
{
int i;
+
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
if (BitIsOn(ev->valuators.mask, i))
valuator_mask_set_double(ti->valuators, i, ev->valuators.data[i]);
@@ -1289,24 +1251,23 @@ TouchCopyValuatorData(DeviceEvent *ev, TouchPointInfoPtr ti)
*/
static Bool
RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
- InternalEvent *ev, TouchListener *listener,
+ InternalEvent *ev, TouchListener * listener,
ClientPtr *client, WindowPtr *win, GrabPtr *grab,
XI2Mask **mask)
{
- int rc;
- InputClients *iclients = NULL;
+ int rc;
+ InputClients *iclients = NULL;
if (listener->type == LISTENER_GRAB ||
- listener->type == LISTENER_POINTER_GRAB)
- {
- rc = dixLookupResourceByType((pointer*)grab, listener->listener,
- RT_PASSIVEGRAB,
- serverClient, DixSendAccess);
- if (rc != Success)
- {
+ listener->type == LISTENER_POINTER_GRAB) {
+ rc = dixLookupResourceByType((pointer *) grab, listener->listener,
+ RT_PASSIVEGRAB,
+ serverClient, DixSendAccess);
+ if (rc != Success) {
/* the grab doesn't exist but we have a grabbing listener - this
* is an implicit/active grab */
- rc = dixLookupClient(client, listener->listener, serverClient, DixSendAccess);
+ rc = dixLookupClient(client, listener->listener, serverClient,
+ DixSendAccess);
if (rc != Success)
return FALSE;
@@ -1318,51 +1279,56 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
*client = rClient(*grab);
*win = (*grab)->window;
*mask = (*grab)->xi2mask;
- } else {
+ }
+ else {
if (listener->level == CORE)
rc = dixLookupWindow(win, listener->listener,
serverClient, DixSendAccess);
else
- rc = dixLookupResourceByType((pointer*)win, listener->listener,
+ rc = dixLookupResourceByType((pointer *) win, listener->listener,
RT_INPUTCLIENT,
serverClient, DixSendAccess);
if (rc != Success)
return FALSE;
-
- if (listener->level == XI2)
- {
+ if (listener->level == XI2) {
int evtype;
- if (ti->emulate_pointer && listener->type == LISTENER_POINTER_REGULAR)
+
+ if (ti->emulate_pointer &&
+ listener->type == LISTENER_POINTER_REGULAR)
evtype = GetXI2Type(TouchGetPointerEventType(ev));
else
evtype = GetXI2Type(ev->any.type);
- nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next)
+ nt_list_for_each_entry(iclients,
+ wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
- break;
+ break;
BUG_WARN(!iclients);
if (!iclients)
return FALSE;
- } else if (listener->level == XI)
- {
+ }
+ else if (listener->level == XI) {
int xi_type = GetXIType(TouchGetPointerEventType(ev));
Mask xi_filter = event_get_filter_from_type(dev, xi_type);
- nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next)
+
+ nt_list_for_each_entry(iclients,
+ wOtherInputMasks(*win)->inputClients, next)
if (iclients->mask[dev->id] & xi_filter)
- break;
+ break;
BUG_WARN(!iclients);
if (!iclients)
return FALSE;
- } else
- {
+ }
+ else {
int coretype = GetCoreType(TouchGetPointerEventType(ev));
Mask core_filter = event_get_filter_from_type(dev, coretype);
/* all others */
- nt_list_for_each_entry(iclients, (InputClients*)wOtherClients(*win), next)
+ nt_list_for_each_entry(iclients,
+ (InputClients *) wOtherClients(*win), next)
if (iclients->mask[XIAllDevices] & core_filter)
- break;
+ break;
/* if owner selected, iclients is NULL */
}
@@ -1375,9 +1341,10 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
}
static int
-DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
- TouchListener *listener, ClientPtr client,
- WindowPtr win, GrabPtr grab, XI2Mask *xi2mask)
+DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
+ InternalEvent *ev, TouchListener * listener,
+ ClientPtr client, WindowPtr win, GrabPtr grab,
+ XI2Mask *xi2mask)
{
InternalEvent motion, button;
InternalEvent *ptrev = &motion;
@@ -1400,22 +1367,22 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent
event_set_state(dev, kbd, &ptrev->device_event);
ptrev->device_event.corestate = event_get_corestate(dev, kbd);
- if (grab)
- {
+ if (grab) {
/* this side-steps the usual activation mechansims, but... */
if (ev->any.type == ET_TouchBegin && !dev->deviceGrab.grab)
- ActivatePassiveGrab(dev, grab, ptrev, ev); /* also delivers the event */
+ ActivatePassiveGrab(dev, grab, ptrev, ev); /* also delivers the event */
else {
int deliveries = 0;
+
/* 'grab' is the passive grab, but if the grab isn't active,
* don't deliver */
if (!dev->deviceGrab.grab)
return Success;
- if (grab->ownerEvents)
- {
+ if (grab->ownerEvents) {
WindowPtr focus = NullWindow;
WindowPtr win = dev->spriteInfo->sprite->win;
+
deliveries = DeliverDeviceEvents(win, ptrev, grab, focus, dev);
}
@@ -1424,12 +1391,11 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent
if (ev->any.type == ET_TouchEnd &&
!dev->button->buttonsDown &&
- dev->deviceGrab.fromPassiveGrab &&
- GrabIsPointerGrab(grab))
- (*dev->deviceGrab.DeactivateGrab)(dev);
+ dev->deviceGrab.fromPassiveGrab && GrabIsPointerGrab(grab))
+ (*dev->deviceGrab.DeactivateGrab) (dev);
}
- } else
- {
+ }
+ else {
GrabPtr devgrab = dev->deviceGrab.grab;
DeliverDeviceEvents(win, ptrev, grab, win, dev);
@@ -1437,8 +1403,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent
* Implicit passive grab activated in response to this event. Store
* the event.
*/
- if (!devgrab && dev->deviceGrab.grab && dev->deviceGrab.implicitGrab)
- {
+ if (!devgrab && dev->deviceGrab.grab && dev->deviceGrab.implicitGrab) {
TouchListener *listener;
devgrab = dev->deviceGrab.grab;
@@ -1452,8 +1417,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent
listener = &ti->listeners[ti->num_listeners - 1];
listener->listener = devgrab->resource;
- if (devgrab->grabtype != XI2 ||
- devgrab->type != XI_TouchBegin)
+ if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
listener->type = LISTENER_POINTER_GRAB;
else
listener->type = LISTENER_GRAB;
@@ -1468,17 +1432,13 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent
return Success;
}
-
-
-
static void
DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
InternalEvent *ev)
{
InternalEvent motion;
- if (ti->num_listeners)
- {
+ if (ti->num_listeners) {
ClientPtr client;
WindowPtr win;
GrabPtr grab;
@@ -1498,21 +1458,22 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
return;
/* There may be a pointer grab on the device */
- if (!grab)
- {
+ if (!grab) {
grab = dev->deviceGrab.grab;
- if (grab)
- {
+ if (grab) {
win = grab->window;
mask = grab->xi2mask;
client = rClient(grab);
}
}
- DeliverTouchEmulatedEvent(dev, ti, &motion, &ti->listeners[0], client, win, grab, mask);
- } else {
+ DeliverTouchEmulatedEvent(dev, ti, &motion, &ti->listeners[0], client,
+ win, grab, mask);
+ }
+ else {
InternalEvent button;
int converted;
+
converted = TouchConvertToPointerEvent(ev, &motion, &button);
BUG_WARN(converted == 0);
@@ -1536,7 +1497,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
TouchPointInfoPtr ti;
uint32_t touchid;
int type = ev->any.type;
- int emulate_pointer = !!(ev->device_event.flags & TOUCH_POINTER_EMULATED);
+ int emulate_pointer = ! !(ev->device_event.flags & TOUCH_POINTER_EMULATED);
if (!t)
return;
@@ -1549,17 +1510,16 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
if (type == ET_TouchBegin) {
ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
emulate_pointer);
- } else
+ }
+ else
ti = TouchFindByClientID(dev, touchid);
- if (!ti)
- {
+ if (!ti) {
DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n",
dev->name, type, touchid);
return;
}
-
/* if emulate_pointer is set, emulate the motion event right
* here, so we can ignore it for button event emulation. TouchUpdate
* events which _only_ emulate motion just work normally */
@@ -1578,8 +1538,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
* have more complex semantics. */
if (ev->any.type == ET_TouchOwnership)
ProcessTouchOwnershipEvent(dev, ti, &ev->touch_ownership_event);
- else
- {
+ else {
TouchCopyValuatorData(&ev->device_event, ti);
/* WARNING: the event type may change to TouchUpdate in
* DeliverTouchEvents if a TouchEnd was delivered to a grabbing
@@ -1590,7 +1549,6 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
}
}
-
/**
* Process DeviceEvents and DeviceChangedEvents.
*/
@@ -1606,14 +1564,13 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
DeviceIntPtr mouse = NULL, kbd = NULL;
DeviceEvent *event = &ev->device_event;
- if (IsPointerDevice(device))
- {
+ if (IsPointerDevice(device)) {
kbd = GetMaster(device, KEYBOARD_OR_FLOAT);
mouse = device;
- if (kbd && !kbd->key) /* can happen with floating SDs */
+ if (kbd && !kbd->key) /* can happen with floating SDs */
kbd = NULL;
- } else
- {
+ }
+ else {
mouse = GetMaster(device, POINTER_OR_FLOAT);
kbd = device;
if (!mouse->valuator || !mouse->button) /* may be float. SDs */
@@ -1632,90 +1589,87 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
if (IsMaster(device) || IsFloating(device))
CheckMotion(event, device);
- switch (event->type)
- {
- case ET_Motion:
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_KeyPress:
- case ET_KeyRelease:
- case ET_ProximityIn:
- case ET_ProximityOut:
- if (!device->spriteInfo->sprite)
- return;
- GetSpritePosition(device, &rootX, &rootY);
- event->root_x = rootX;
- event->root_y = rootY;
- NoticeEventTime((InternalEvent*)event);
- event->corestate = corestate;
- key = event->detail.key;
- break;
- default:
- break;
+ switch (event->type) {
+ case ET_Motion:
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ if (!device->spriteInfo->sprite)
+ return;
+ GetSpritePosition(device, &rootX, &rootY);
+ event->root_x = rootX;
+ event->root_y = rootY;
+ NoticeEventTime((InternalEvent *) event, device);
+ event->corestate = corestate;
+ key = event->detail.key;
+ break;
+ default:
+ break;
}
if (DeviceEventCallback && !syncEvents.playingEvents) {
- DeviceEventInfoRec eventinfo;
- SpritePtr pSprite = device->spriteInfo->sprite;
+ DeviceEventInfoRec eventinfo;
+ SpritePtr pSprite = device->spriteInfo->sprite;
- /* see comment in EnqueueEvents regarding the next three lines */
- if (ev->any.type == ET_Motion)
- ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id;
+ /* see comment in EnqueueEvents regarding the next three lines */
+ if (ev->any.type == ET_Motion)
+ ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id;
- eventinfo.device = device;
- eventinfo.event = ev;
- CallCallbacks(&DeviceEventCallback, (pointer) & eventinfo);
+ eventinfo.device = device;
+ eventinfo.event = ev;
+ CallCallbacks(&DeviceEventCallback, (pointer) &eventinfo);
}
grab = device->deviceGrab.grab;
- switch(event->type)
- {
- case ET_KeyPress:
- if (!grab && CheckDeviceGrabs(device, event, 0))
- return;
- break;
- case ET_KeyRelease:
- if (grab && device->deviceGrab.fromPassiveGrab &&
- (key == device->deviceGrab.activatingKey) &&
- GrabIsKeyboardGrab(device->deviceGrab.grab))
- deactivateDeviceGrab = TRUE;
- break;
- case ET_ButtonPress:
- if (b->map[key] == 0) /* there's no button 0 */
- return;
- event->detail.button = b->map[key];
- if (!grab && CheckDeviceGrabs(device, event, 0))
- {
- /* if a passive grab was activated, the event has been sent
- * already */
- return;
- }
- break;
- case ET_ButtonRelease:
- if (b->map[key] == 0) /* there's no button 0 */
- return;
- event->detail.button = b->map[key];
- if (grab && !b->buttonsDown &&
- device->deviceGrab.fromPassiveGrab &&
- GrabIsPointerGrab(device->deviceGrab.grab))
- deactivateDeviceGrab = TRUE;
- default:
- break;
+ switch (event->type) {
+ case ET_KeyPress:
+ if (!grab && CheckDeviceGrabs(device, event, 0))
+ return;
+ break;
+ case ET_KeyRelease:
+ if (grab && device->deviceGrab.fromPassiveGrab &&
+ (key == device->deviceGrab.activatingKey) &&
+ GrabIsKeyboardGrab(device->deviceGrab.grab))
+ deactivateDeviceGrab = TRUE;
+ break;
+ case ET_ButtonPress:
+ if (b->map[key] == 0) /* there's no button 0 */
+ return;
+ event->detail.button = b->map[key];
+ if (!grab && CheckDeviceGrabs(device, event, 0)) {
+ /* if a passive grab was activated, the event has been sent
+ * already */
+ return;
+ }
+ break;
+ case ET_ButtonRelease:
+ if (b->map[key] == 0) /* there's no button 0 */
+ return;
+ event->detail.button = b->map[key];
+ if (grab && !b->buttonsDown &&
+ device->deviceGrab.fromPassiveGrab &&
+ GrabIsPointerGrab(device->deviceGrab.grab))
+ deactivateDeviceGrab = TRUE;
+ default:
+ break;
}
-
if (grab)
- DeliverGrabbedEvent((InternalEvent*)event, device, deactivateDeviceGrab);
+ DeliverGrabbedEvent((InternalEvent *) event, device,
+ deactivateDeviceGrab);
else if (device->focus && !IsPointerEvent(ev))
- DeliverFocusedEvent(device, (InternalEvent*)event,
+ DeliverFocusedEvent(device, (InternalEvent *) event,
GetSpriteWindow(device));
else
- DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent*)event,
+ DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
NullGrab, NullWindow, device);
if (deactivateDeviceGrab == TRUE)
- (*device->deviceGrab.DeactivateGrab) (device);
+ (*device->deviceGrab.DeactivateGrab) (device);
event->detail.key = key;
}
@@ -1729,118 +1683,117 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
{
verify_internal_event(ev);
- switch(ev->any.type)
- {
- case ET_RawKeyPress:
- case ET_RawKeyRelease:
- case ET_RawButtonPress:
- case ET_RawButtonRelease:
- case ET_RawMotion:
- case ET_RawTouchBegin:
- case ET_RawTouchUpdate:
- case ET_RawTouchEnd:
- DeliverRawEvent(&ev->raw_event, device);
- break;
- case ET_TouchBegin:
- case ET_TouchUpdate:
- case ET_TouchOwnership:
- case ET_TouchEnd:
- ProcessTouchEvent(ev, device);
- break;
- default:
- ProcessDeviceEvent(ev, device);
- break;
+ switch (ev->any.type) {
+ case ET_RawKeyPress:
+ case ET_RawKeyRelease:
+ case ET_RawButtonPress:
+ case ET_RawButtonRelease:
+ case ET_RawMotion:
+ case ET_RawTouchBegin:
+ case ET_RawTouchUpdate:
+ case ET_RawTouchEnd:
+ DeliverRawEvent(&ev->raw_event, device);
+ break;
+ case ET_TouchBegin:
+ case ET_TouchUpdate:
+ case ET_TouchOwnership:
+ case ET_TouchEnd:
+ ProcessTouchEvent(ev, device);
+ break;
+ default:
+ ProcessDeviceEvent(ev, device);
+ break;
}
}
static int
-DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
- TouchListener *listener, ClientPtr client,
- WindowPtr win, GrabPtr grab, XI2Mask *xi2mask)
+DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
+ InternalEvent *ev, TouchListener * listener,
+ ClientPtr client, WindowPtr win, GrabPtr grab,
+ XI2Mask *xi2mask)
{
enum TouchListenerState state;
int rc = Success;
Bool has_ownershipmask;
if (listener->type == LISTENER_POINTER_REGULAR ||
- listener->type == LISTENER_POINTER_GRAB)
- {
+ listener->type == LISTENER_POINTER_GRAB) {
rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
grab, xi2mask);
goto out;
}
-
has_ownershipmask = xi2mask_isset(xi2mask, dev, XI_TouchOwnership);
if (TouchResourceIsOwner(ti, listener->listener) || has_ownershipmask)
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
- if (!TouchResourceIsOwner(ti, listener->listener))
- {
+ if (!TouchResourceIsOwner(ti, listener->listener)) {
if (has_ownershipmask)
state = LISTENER_AWAITING_OWNER;
else
state = LISTENER_AWAITING_BEGIN;
- } else
- {
+ }
+ else {
if (has_ownershipmask)
TouchSendOwnershipEvent(dev, ti, 0, listener->listener);
- state = LISTENER_IS_OWNER;
+
+ if (!has_ownershipmask || listener->type == LISTENER_REGULAR)
+ state = LISTENER_HAS_ACCEPTED;
+ else
+ state = LISTENER_IS_OWNER;
}
listener->state = state;
-out:
+ out:
return rc;
}
static int
DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
- TouchListener *listener, ClientPtr client,
+ TouchListener * listener, ClientPtr client,
WindowPtr win, GrabPtr grab, XI2Mask *xi2mask)
{
int rc = Success;
if (listener->type == LISTENER_POINTER_REGULAR ||
- listener->type == LISTENER_POINTER_GRAB)
- {
+ listener->type == LISTENER_POINTER_GRAB) {
rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
grab, xi2mask);
goto out;
}
/* Event in response to reject */
- if (ev->device_event.flags & TOUCH_REJECT)
- {
+ if (ev->device_event.flags & TOUCH_REJECT) {
if (listener->state != LISTENER_HAS_END)
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
listener->state = LISTENER_HAS_END;
- } else if (TouchResourceIsOwner(ti, listener->listener))
- {
+ }
+ else if (TouchResourceIsOwner(ti, listener->listener)) {
+ Bool normal_end = !(ev->device_event.flags & TOUCH_ACCEPT);
+
/* FIXME: what about early acceptance */
- if (!(ev->device_event.flags & TOUCH_ACCEPT))
- {
- if (listener->state != LISTENER_HAS_END)
- rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
- listener->state = LISTENER_HAS_END;
- }
+ if (normal_end && listener->state != LISTENER_HAS_END)
+ rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
+
if ((ti->num_listeners > 1 ||
- (listener->type == LISTENER_GRAB &&
- xi2mask_isset(xi2mask, dev, XI_TouchOwnership))) &&
- (ev->device_event.flags & (TOUCH_ACCEPT|TOUCH_REJECT)) == 0)
- {
+ listener->state != LISTENER_HAS_ACCEPTED) &&
+ (ev->device_event.flags & (TOUCH_ACCEPT | TOUCH_REJECT)) == 0) {
ev->any.type = ET_TouchUpdate;
ev->device_event.flags |= TOUCH_PENDING_END;
ti->pending_finish = TRUE;
}
+
+ if (normal_end)
+ listener->state = LISTENER_HAS_END;
}
-out:
+ out:
return rc;
}
static int
DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
- TouchListener *listener, ClientPtr client,
+ TouchListener * listener, ClientPtr client,
WindowPtr win, GrabPtr grab, XI2Mask *xi2mask)
{
Bool has_ownershipmask = FALSE;
@@ -1849,30 +1802,34 @@ DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
if (xi2mask)
has_ownershipmask = xi2mask_isset(xi2mask, dev, XI_TouchOwnership);
- if (ev->any.type == ET_TouchOwnership)
- {
+ if (ev->any.type == ET_TouchOwnership) {
ev->touch_ownership_event.deviceid = dev->id;
if (!TouchResourceIsOwner(ti, listener->listener))
goto out;
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
listener->state = LISTENER_IS_OWNER;
- } else
+ }
+ else
ev->device_event.deviceid = dev->id;
- if (ev->any.type == ET_TouchBegin)
- {
- rc = DeliverTouchBeginEvent(dev, ti, ev, listener, client, win, grab, xi2mask);
- } else if (ev->any.type == ET_TouchUpdate)
- {
+ if (ev->any.type == ET_TouchBegin) {
+ rc = DeliverTouchBeginEvent(dev, ti, ev, listener, client, win, grab,
+ xi2mask);
+ }
+ else if (ev->any.type == ET_TouchUpdate) {
if (listener->type == LISTENER_POINTER_REGULAR ||
listener->type == LISTENER_POINTER_GRAB)
- DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win, grab, xi2mask);
- else if (TouchResourceIsOwner(ti, listener->listener) || has_ownershipmask)
+ DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win, grab,
+ xi2mask);
+ else if (TouchResourceIsOwner(ti, listener->listener) ||
+ has_ownershipmask)
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
- } else if (ev->any.type == ET_TouchEnd)
- rc = DeliverTouchEndEvent(dev, ti, ev, listener, client, win, grab, xi2mask);
+ }
+ else if (ev->any.type == ET_TouchEnd)
+ rc = DeliverTouchEndEvent(dev, ti, ev, listener, client, win, grab,
+ xi2mask);
-out:
+ out:
return rc;
}
@@ -1892,13 +1849,12 @@ DeliverTouchEvents(DeviceIntPtr dev, TouchPointInfoPtr ti,
int i;
if (ev->any.type == ET_TouchBegin &&
- !(ev->device_event.flags & (TOUCH_CLIENT_ID|TOUCH_REPLAYING)))
+ !(ev->device_event.flags & (TOUCH_CLIENT_ID | TOUCH_REPLAYING)))
TouchSetupListeners(dev, ti, ev);
TouchEventHistoryPush(ti, &ev->device_event);
- for (i = 0; i < ti->num_listeners; i++)
- {
+ for (i = 0; i < ti->num_listeners; i++) {
GrabPtr grab = NULL;
ClientPtr client;
WindowPtr win;
@@ -1926,7 +1882,7 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec));
if (!proxc)
- return FALSE;
+ return FALSE;
proxc->sourceid = dev->id;
proxc->in_proximity = TRUE;
dev->proximity = proxc;
@@ -1943,8 +1899,9 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
* @see InitValuatorClassDeviceStruct
*/
Bool
-InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval,
- int resolution, int min_res, int max_res, int mode)
+InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
+ int maxval, int resolution, int min_res, int max_res,
+ int mode)
{
AxisInfoPtr ax;
@@ -1973,7 +1930,8 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int
* Set the given axis number as a scrolling valuator.
*/
Bool
-SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type, double increment, int flags)
+SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type,
+ double increment, int flags)
{
AxisInfoPtr ax;
int *current_ax;
@@ -1983,30 +1941,29 @@ SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type, double incr
if (!dev || !dev->valuator || axnum >= dev->valuator->numAxes)
return FALSE;
- switch (type)
- {
- case SCROLL_TYPE_VERTICAL:
- current_ax = &dev->valuator->v_scroll_axis;
- break;
- case SCROLL_TYPE_HORIZONTAL:
- current_ax = &dev->valuator->h_scroll_axis;
- break;
- case SCROLL_TYPE_NONE:
- ax = &dev->valuator->axes[axnum];
- ax->scroll.type = type;
- return TRUE;
- default:
- return FALSE;
+ switch (type) {
+ case SCROLL_TYPE_VERTICAL:
+ current_ax = &dev->valuator->v_scroll_axis;
+ break;
+ case SCROLL_TYPE_HORIZONTAL:
+ current_ax = &dev->valuator->h_scroll_axis;
+ break;
+ case SCROLL_TYPE_NONE:
+ ax = &dev->valuator->axes[axnum];
+ ax->scroll.type = type;
+ return TRUE;
+ default:
+ return FALSE;
}
if (increment == 0.0)
return FALSE;
- if (*current_ax != -1 && axnum != *current_ax)
- {
+ if (*current_ax != -1 && axnum != *current_ax) {
ax = &dev->valuator->axes[*current_ax];
if (ax->scroll.type == type &&
- (flags & SCROLL_FLAG_PREFERRED) && (ax->scroll.flags & SCROLL_FLAG_PREFERRED))
+ (flags & SCROLL_FLAG_PREFERRED) &&
+ (ax->scroll.flags & SCROLL_FLAG_PREFERRED))
return FALSE;
}
*current_ax = axnum;
@@ -2017,7 +1974,9 @@ SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type, double incr
ax->scroll.flags = flags;
master = GetMaster(dev, MASTER_ATTACHED);
- CreateClassesChangedEvent(&dce, master, dev, DEVCHANGE_POINTER_EVENT | DEVCHANGE_DEVICE_CHANGE);
+ CreateClassesChangedEvent(&dce, master, dev,
+ DEVCHANGE_POINTER_EVENT |
+ DEVCHANGE_DEVICE_CHANGE);
XISendDeviceChangedEvent(dev, &dce.changed_event);
/* if the current slave is us, update the master. If not, we'll update
@@ -2031,7 +1990,7 @@ SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type, double incr
static void
FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
- ButtonClassPtr b, ValuatorClassPtr v, int first)
+ ButtonClassPtr b, ValuatorClassPtr v, int first)
{
ev->type = DeviceStateNotify;
ev->deviceid = dev->id;
@@ -2042,36 +2001,37 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
ev->num_valuators = 0;
if (b) {
- ev->classes_reported |= (1 << ButtonClass);
- ev->num_buttons = b->numButtons;
- memcpy((char*)ev->buttons, (char*)b->down, 4);
- } else if (k) {
- ev->classes_reported |= (1 << KeyClass);
- ev->num_keys = k->xkbInfo->desc->max_key_code -
- k->xkbInfo->desc->min_key_code;
- memmove((char *)&ev->keys[0], (char *)k->down, 4);
+ ev->classes_reported |= (1 << ButtonClass);
+ ev->num_buttons = b->numButtons;
+ memcpy((char *) ev->buttons, (char *) b->down, 4);
+ }
+ else if (k) {
+ ev->classes_reported |= (1 << KeyClass);
+ ev->num_keys = k->xkbInfo->desc->max_key_code -
+ k->xkbInfo->desc->min_key_code;
+ memmove((char *) &ev->keys[0], (char *) k->down, 4);
}
if (v) {
- int nval = v->numAxes - first;
-
- ev->classes_reported |= (1 << ValuatorClass);
- ev->classes_reported |= valuator_get_mode(dev, 0) << ModeBitsShift;
- ev->num_valuators = nval < 3 ? nval : 3;
- switch (ev->num_valuators) {
- case 3:
- ev->valuator2 = v->axisVal[first + 2];
- case 2:
- ev->valuator1 = v->axisVal[first + 1];
- case 1:
- ev->valuator0 = v->axisVal[first];
- break;
- }
+ int nval = v->numAxes - first;
+
+ ev->classes_reported |= (1 << ValuatorClass);
+ ev->classes_reported |= valuator_get_mode(dev, 0) << ModeBitsShift;
+ ev->num_valuators = nval < 3 ? nval : 3;
+ switch (ev->num_valuators) {
+ case 3:
+ ev->valuator2 = v->axisVal[first + 2];
+ case 2:
+ ev->valuator1 = v->axisVal[first + 1];
+ case 1:
+ ev->valuator0 = v->axisVal[first];
+ break;
+ }
}
}
static void
FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v,
- int first)
+ int first)
{
int nval = v->numAxes - first;
@@ -2081,12 +2041,12 @@ FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v,
ev->first_valuator = first;
switch (ev->num_valuators) {
case 3:
- ev->valuator2 = v->axisVal[first + 2];
+ ev->valuator2 = v->axisVal[first + 2];
case 2:
- ev->valuator1 = v->axisVal[first + 1];
+ ev->valuator1 = v->axisVal[first + 1];
case 1:
- ev->valuator0 = v->axisVal[first];
- break;
+ ev->valuator0 = v->axisVal[first];
+ break;
}
first += ev->num_valuators;
}
@@ -2114,8 +2074,7 @@ DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win)
evcount++;
}
if ((k = dev->key) != NULL) {
- nkeys = k->xkbInfo->desc->max_key_code -
- k->xkbInfo->desc->min_key_code;
+ nkeys = k->xkbInfo->desc->max_key_code - k->xkbInfo->desc->min_key_code;
if (nkeys > 32)
evcount++;
if (nbuttons > 0) {
@@ -2147,7 +2106,8 @@ DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win)
bev = (deviceButtonStateNotify *) ev++;
bev->type = DeviceButtonStateNotify;
bev->deviceid = dev->id;
- memcpy((char*)&bev->buttons[4], (char*)&b->down[4], DOWN_LENGTH - 4);
+ memcpy((char *) &bev->buttons[4], (char *) &b->down[4],
+ DOWN_LENGTH - 4);
}
if (nval > 0) {
(ev - 1)->deviceid |= MORE_EVENTS;
@@ -2166,7 +2126,7 @@ DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win)
kev = (deviceKeyStateNotify *) ev++;
kev->type = DeviceKeyStateNotify;
kev->deviceid = dev->id;
- memmove((char *)&kev->keys[0], (char *)&k->down[4], 28);
+ memmove((char *) &kev->keys[0], (char *) &k->down[4], 28);
}
if (nval > 0) {
(ev - 1)->deviceid |= MORE_EVENTS;
@@ -2195,7 +2155,7 @@ DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win)
void
DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
- WindowPtr pWin)
+ WindowPtr pWin)
{
deviceFocus event;
xXIFocusInEvent *xi2event;
@@ -2210,25 +2170,24 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
len = sizeof(xXIFocusInEvent) + btlen * 4;
xi2event = calloc(1, len);
- xi2event->type = GenericEvent;
- xi2event->extension = IReqCode;
- xi2event->evtype = type;
- xi2event->length = bytes_to_int32(len - sizeof(xEvent));
- xi2event->buttons_len = btlen;
- xi2event->detail = detail;
- xi2event->time = currentTime.milliseconds;
- xi2event->deviceid = dev->id;
- xi2event->sourceid = dev->id; /* a device doesn't change focus by itself */
- xi2event->mode = mode;
- xi2event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0);
- xi2event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0);
+ xi2event->type = GenericEvent;
+ xi2event->extension = IReqCode;
+ xi2event->evtype = type;
+ xi2event->length = bytes_to_int32(len - sizeof(xEvent));
+ xi2event->buttons_len = btlen;
+ xi2event->detail = detail;
+ xi2event->time = currentTime.milliseconds;
+ xi2event->deviceid = dev->id;
+ xi2event->sourceid = dev->id; /* a device doesn't change focus by itself */
+ xi2event->mode = mode;
+ xi2event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0);
+ xi2event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0);
for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
if (BitIsOn(mouse->button->down, i))
SetBit(&xi2event[1], mouse->button->map[i]);
- if (dev->key)
- {
+ if (dev->key) {
xi2event->mods.base_mods = dev->key->xkbInfo->state.base_mods;
xi2event->mods.latched_mods = dev->key->xkbInfo->state.latched_mods;
xi2event->mods.locked_mods = dev->key->xkbInfo->state.locked_mods;
@@ -2240,11 +2199,11 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
xi2event->group.effective_group = dev->key->xkbInfo->state.group;
}
- FixUpEventFromWindow(dev->spriteInfo->sprite, (xEvent*)xi2event, pWin,
+ FixUpEventFromWindow(dev->spriteInfo->sprite, (xEvent *) xi2event, pWin,
None, FALSE);
- DeliverEventsToWindow(dev, pWin, (xEvent*)xi2event, 1,
- GetEventFilter(dev, (xEvent*)xi2event), NullGrab);
+ DeliverEventsToWindow(dev, pWin, (xEvent *) xi2event, 1,
+ GetEventFilter(dev, (xEvent *) xi2event), NullGrab);
free(xi2event);
@@ -2256,46 +2215,44 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
event.window = pWin->drawable.id;
event.time = currentTime.milliseconds;
- DeliverEventsToWindow(dev, pWin, (xEvent *) & event, 1,
- DeviceFocusChangeMask, NullGrab);
+ DeliverEventsToWindow(dev, pWin, (xEvent *) &event, 1,
+ DeviceFocusChangeMask, NullGrab);
if (event.type == DeviceFocusIn)
DeliverStateNotifyEvent(dev, pWin);
}
int
-CheckGrabValues(ClientPtr client, GrabParameters* param)
+CheckGrabValues(ClientPtr client, GrabParameters *param)
{
if (param->grabtype != CORE &&
- param->grabtype != XI &&
- param->grabtype != XI2)
- {
+ param->grabtype != XI && param->grabtype != XI2) {
ErrorF("[Xi] grabtype is invalid. This is a bug.\n");
return BadImplementation;
}
if ((param->this_device_mode != GrabModeSync) &&
- (param->this_device_mode != GrabModeAsync) &&
+ (param->this_device_mode != GrabModeAsync) &&
(param->this_device_mode != XIGrabModeTouch)) {
- client->errorValue = param->this_device_mode;
- return BadValue;
+ client->errorValue = param->this_device_mode;
+ return BadValue;
}
if ((param->other_devices_mode != GrabModeSync) &&
- (param->other_devices_mode != GrabModeAsync) &&
+ (param->other_devices_mode != GrabModeAsync) &&
(param->other_devices_mode != XIGrabModeTouch)) {
- client->errorValue = param->other_devices_mode;
- return BadValue;
+ client->errorValue = param->other_devices_mode;
+ return BadValue;
}
if (param->grabtype != XI2 && (param->modifiers != AnyModifier) &&
(param->modifiers & ~AllModifiersMask)) {
- client->errorValue = param->modifiers;
- return BadValue;
+ client->errorValue = param->modifiers;
+ return BadValue;
}
if ((param->ownerEvents != xFalse) && (param->ownerEvents != xTrue)) {
- client->errorValue = param->ownerEvents;
- return BadValue;
+ client->errorValue = param->ownerEvents;
+ return BadValue;
}
return Success;
}
@@ -2303,7 +2260,7 @@ CheckGrabValues(ClientPtr client, GrabParameters* param)
int
GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
int button, GrabParameters *param, enum InputLevel grabtype,
- GrabMask *mask)
+ GrabMask *mask)
{
WindowPtr pWin, confineTo;
CursorPtr cursor;
@@ -2313,34 +2270,35 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
rc = CheckGrabValues(client, param);
if (rc != Success)
- return rc;
+ return rc;
if (param->confineTo == None)
- confineTo = NullWindow;
+ confineTo = NullWindow;
else {
- rc = dixLookupWindow(&confineTo, param->confineTo, client, DixSetAttrAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupWindow(&confineTo, param->confineTo, client,
+ DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
}
if (param->cursor == None)
- cursor = NullCursor;
+ cursor = NullCursor;
else {
- rc = dixLookupResourceByType((pointer *)&cursor, param->cursor,
- RT_CURSOR, client, DixUseAccess);
- if (rc != Success)
- {
- client->errorValue = param->cursor;
- return rc;
- }
- access_mode |= DixForceAccess;
- }
- if (param->this_device_mode == GrabModeSync || param->other_devices_mode == GrabModeSync)
- access_mode |= DixFreezeAccess;
+ rc = dixLookupResourceByType((pointer *) &cursor, param->cursor,
+ RT_CURSOR, client, DixUseAccess);
+ if (rc != Success) {
+ client->errorValue = param->cursor;
+ return rc;
+ }
+ access_mode |= DixForceAccess;
+ }
+ if (param->this_device_mode == GrabModeSync ||
+ param->other_devices_mode == GrabModeSync)
+ access_mode |= DixFreezeAccess;
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc != Success)
- return rc;
+ return rc;
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (grabtype == XI)
type = DeviceButtonPress;
@@ -2350,7 +2308,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype,
mask, param, type, button, confineTo, cursor);
if (!grab)
- return BadAlloc;
+ return BadAlloc;
return AddPassiveGrabToList(client, grab);
}
@@ -2360,7 +2318,8 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
*/
int
GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
- int key, GrabParameters *param, enum InputLevel grabtype, GrabMask *mask)
+ int key, GrabParameters *param, enum InputLevel grabtype,
+ GrabMask *mask)
{
WindowPtr pWin;
GrabPtr grab;
@@ -2372,32 +2331,33 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (rc != Success)
return rc;
if ((dev->id != XIAllDevices && dev->id != XIAllMasterDevices) && k == NULL)
- return BadMatch;
- if (grabtype == XI)
- {
+ return BadMatch;
+ if (grabtype == XI) {
if ((key > k->xkbInfo->desc->max_key_code ||
- key < k->xkbInfo->desc->min_key_code)
- && (key != AnyKey)) {
+ key < k->xkbInfo->desc->min_key_code)
+ && (key != AnyKey)) {
client->errorValue = key;
return BadValue;
}
type = DeviceKeyPress;
- } else if (grabtype == XI2)
+ }
+ else if (grabtype == XI2)
type = XI_KeyPress;
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
- if (param->this_device_mode == GrabModeSync || param->other_devices_mode == GrabModeSync)
- access_mode |= DixFreezeAccess;
+ return rc;
+ if (param->this_device_mode == GrabModeSync ||
+ param->other_devices_mode == GrabModeSync)
+ access_mode |= DixFreezeAccess;
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc != Success)
- return rc;
+ return rc;
grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype,
mask, param, type, key, NULL, NULL);
if (!grab)
- return BadAlloc;
+ return BadAlloc;
return AddPassiveGrabToList(client, grab);
}
@@ -2418,28 +2378,29 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (param->cursor == None)
- cursor = NullCursor;
+ cursor = NullCursor;
else {
- rc = dixLookupResourceByType((pointer *)&cursor, param->cursor,
- RT_CURSOR, client, DixUseAccess);
- if (rc != Success)
- {
- client->errorValue = param->cursor;
- return rc;
- }
- access_mode |= DixForceAccess;
- }
- if (param->this_device_mode == GrabModeSync || param->other_devices_mode == GrabModeSync)
- access_mode |= DixFreezeAccess;
+ rc = dixLookupResourceByType((pointer *) &cursor, param->cursor,
+ RT_CURSOR, client, DixUseAccess);
+ if (rc != Success) {
+ client->errorValue = param->cursor;
+ return rc;
+ }
+ access_mode |= DixForceAccess;
+ }
+ if (param->this_device_mode == GrabModeSync ||
+ param->other_devices_mode == GrabModeSync)
+ access_mode |= DixFreezeAccess;
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc != Success)
- return rc;
+ return rc;
grab = CreateGrab(client->index, dev, dev, pWin, XI2,
- mask, param, (type == XIGrabtypeEnter) ? XI_Enter : XI_FocusIn,
- 0, NULL, cursor);
+ mask, param,
+ (type == XIGrabtypeEnter) ? XI_Enter : XI_FocusIn, 0,
+ NULL, cursor);
if (!grab)
return BadAlloc;
@@ -2462,10 +2423,10 @@ GrabTouch(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGrabAccess);
if (rc != Success)
- return rc;
+ return rc;
grab = CreateGrab(client->index, dev, mod_dev, pWin, XI2,
mask, param, XI_TouchBegin, 0, NullWindow, NullCursor);
@@ -2477,7 +2438,7 @@ GrabTouch(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
int
SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
- Mask mask, Mask exclusivemasks)
+ Mask mask, Mask exclusivemasks)
{
int mskidx = dev->id;
int i, ret;
@@ -2486,54 +2447,54 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
check = (mask & exclusivemasks);
if (wOtherInputMasks(pWin)) {
- if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) { /* It is illegal for two different
- * clients to select on any of the
- * events for maskcheck. However,
- * it is OK, for some client to
- * continue selecting on one of those
- * events. */
- for (others = wOtherInputMasks(pWin)->inputClients; others;
- others = others->next) {
- if (!SameClient(others, client) && (check &
- others->mask[mskidx]))
- return BadAccess;
- }
- }
- for (others = wOtherInputMasks(pWin)->inputClients; others;
- others = others->next) {
- if (SameClient(others, client)) {
- check = others->mask[mskidx];
- others->mask[mskidx] = mask;
- if (mask == 0) {
- for (i = 0; i < EMASKSIZE; i++)
- if (i != mskidx && others->mask[i] != 0)
- break;
- if (i == EMASKSIZE) {
- RecalculateDeviceDeliverableEvents(pWin);
- if (ShouldFreeInputMasks(pWin, FALSE))
- FreeResource(others->resource, RT_NONE);
- return Success;
- }
- }
- goto maskSet;
- }
- }
+ if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) { /* It is illegal for two different
+ * clients to select on any of the
+ * events for maskcheck. However,
+ * it is OK, for some client to
+ * continue selecting on one of those
+ * events. */
+ for (others = wOtherInputMasks(pWin)->inputClients; others;
+ others = others->next) {
+ if (!SameClient(others, client) && (check &
+ others->mask[mskidx]))
+ return BadAccess;
+ }
+ }
+ for (others = wOtherInputMasks(pWin)->inputClients; others;
+ others = others->next) {
+ if (SameClient(others, client)) {
+ check = others->mask[mskidx];
+ others->mask[mskidx] = mask;
+ if (mask == 0) {
+ for (i = 0; i < EMASKSIZE; i++)
+ if (i != mskidx && others->mask[i] != 0)
+ break;
+ if (i == EMASKSIZE) {
+ RecalculateDeviceDeliverableEvents(pWin);
+ if (ShouldFreeInputMasks(pWin, FALSE))
+ FreeResource(others->resource, RT_NONE);
+ return Success;
+ }
+ }
+ goto maskSet;
+ }
+ }
}
check = 0;
if ((ret = AddExtensionClient(pWin, client, mask, mskidx)) != Success)
- return ret;
- maskSet:
+ return ret;
+ maskSet:
if (dev->valuator)
- if ((dev->valuator->motionHintWindow == pWin) &&
- (mask & DevicePointerMotionHintMask) &&
- !(check & DevicePointerMotionHintMask) && !dev->deviceGrab.grab)
- dev->valuator->motionHintWindow = NullWindow;
+ if ((dev->valuator->motionHintWindow == pWin) &&
+ (mask & DevicePointerMotionHintMask) &&
+ !(check & DevicePointerMotionHintMask) && !dev->deviceGrab.grab)
+ dev->valuator->motionHintWindow = NullWindow;
RecalculateDeviceDeliverableEvents(pWin);
return Success;
}
static void
-FreeInputClient(InputClientsPtr *other)
+FreeInputClient(InputClientsPtr * other)
{
xi2mask_free(&(*other)->xi2mask);
free(*other);
@@ -2552,12 +2513,12 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
InputClientsPtr others;
if (!pWin->optional && !MakeWindowOptional(pWin))
- return BadAlloc;
+ return BadAlloc;
others = AllocInputClient();
if (!others)
- return BadAlloc;
+ return BadAlloc;
if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
- goto bail;
+ goto bail;
others->xi2mask = xi2mask_new();
if (!others->xi2mask)
goto bail;
@@ -2566,10 +2527,10 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
others->next = pWin->optional->inputMasks->inputClients;
pWin->optional->inputMasks->inputClients = others;
if (!AddResource(others->resource, RT_INPUTCLIENT, (pointer) pWin))
- goto bail;
+ goto bail;
return Success;
-bail:
+ bail:
FreeInputClient(&others);
return BadAlloc;
}
@@ -2581,10 +2542,9 @@ MakeInputMasks(WindowPtr pWin)
imasks = calloc(1, sizeof(struct _OtherInputMasks));
if (!imasks)
- return FALSE;
+ return FALSE;
imasks->xi2mask = xi2mask_new();
- if (!imasks->xi2mask)
- {
+ if (!imasks->xi2mask) {
free(imasks);
return FALSE;
}
@@ -2593,7 +2553,7 @@ MakeInputMasks(WindowPtr pWin)
}
static void
-FreeInputMask(OtherInputMasks **imask)
+FreeInputMask(OtherInputMasks ** imask)
{
xi2mask_free(&(*imask)->xi2mask);
free(*imask);
@@ -2604,39 +2564,39 @@ void
RecalculateDeviceDeliverableEvents(WindowPtr pWin)
{
InputClientsPtr others;
- struct _OtherInputMasks *inputMasks; /* default: NULL */
+ struct _OtherInputMasks *inputMasks; /* default: NULL */
WindowPtr pChild, tmp;
int i;
pChild = pWin;
while (1) {
- if ((inputMasks = wOtherInputMasks(pChild)) != 0) {
+ if ((inputMasks = wOtherInputMasks(pChild)) != 0) {
xi2mask_zero(inputMasks->xi2mask, -1);
- for (others = inputMasks->inputClients; others;
- others = others->next) {
- for (i = 0; i < EMASKSIZE; i++)
- inputMasks->inputEvents[i] |= others->mask[i];
+ for (others = inputMasks->inputClients; others;
+ others = others->next) {
+ for (i = 0; i < EMASKSIZE; i++)
+ inputMasks->inputEvents[i] |= others->mask[i];
xi2mask_merge(inputMasks->xi2mask, others->xi2mask);
- }
- for (i = 0; i < EMASKSIZE; i++)
- inputMasks->deliverableEvents[i] = inputMasks->inputEvents[i];
- for (tmp = pChild->parent; tmp; tmp = tmp->parent)
- if (wOtherInputMasks(tmp))
- for (i = 0; i < EMASKSIZE; i++)
- inputMasks->deliverableEvents[i] |=
- (wOtherInputMasks(tmp)->deliverableEvents[i]
- & ~inputMasks->
- dontPropagateMask[i] & PropagateMask[i]);
- }
- if (pChild->firstChild) {
- pChild = pChild->firstChild;
- continue;
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- break;
- pChild = pChild->nextSib;
+ }
+ for (i = 0; i < EMASKSIZE; i++)
+ inputMasks->deliverableEvents[i] = inputMasks->inputEvents[i];
+ for (tmp = pChild->parent; tmp; tmp = tmp->parent)
+ if (wOtherInputMasks(tmp))
+ for (i = 0; i < EMASKSIZE; i++)
+ inputMasks->deliverableEvents[i] |=
+ (wOtherInputMasks(tmp)->deliverableEvents[i]
+ & ~inputMasks->dontPropagateMask[i] &
+ PropagateMask[i]);
+ }
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ break;
+ pChild = pChild->nextSib;
}
}
@@ -2650,36 +2610,40 @@ InputClientGone(WindowPtr pWin, XID id)
InputClientsPtr other, prev;
if (!wOtherInputMasks(pWin))
- return Success;
+ return Success;
prev = 0;
for (other = wOtherInputMasks(pWin)->inputClients; other;
- other = other->next) {
- if (other->resource == id) {
- if (prev) {
- prev->next = other->next;
- FreeInputClient(&other);
- } else if (!(other->next)) {
- if (ShouldFreeInputMasks(pWin, TRUE)) {
- OtherInputMasks *mask = wOtherInputMasks(pWin);
- mask->inputClients = other->next;
- FreeInputMask(&mask);
- pWin->optional->inputMasks = (OtherInputMasks *) NULL;
- CheckWindowOptionalNeed(pWin);
- FreeInputClient(&other);
- } else {
- other->resource = FakeClientID(0);
- if (!AddResource(other->resource, RT_INPUTCLIENT,
- (pointer) pWin))
- return BadAlloc;
- }
- } else {
- wOtherInputMasks(pWin)->inputClients = other->next;
- FreeInputClient(&other);
- }
- RecalculateDeviceDeliverableEvents(pWin);
- return Success;
- }
- prev = other;
+ other = other->next) {
+ if (other->resource == id) {
+ if (prev) {
+ prev->next = other->next;
+ FreeInputClient(&other);
+ }
+ else if (!(other->next)) {
+ if (ShouldFreeInputMasks(pWin, TRUE)) {
+ OtherInputMasks *mask = wOtherInputMasks(pWin);
+
+ mask->inputClients = other->next;
+ FreeInputMask(&mask);
+ pWin->optional->inputMasks = (OtherInputMasks *) NULL;
+ CheckWindowOptionalNeed(pWin);
+ FreeInputClient(&other);
+ }
+ else {
+ other->resource = FakeClientID(0);
+ if (!AddResource(other->resource, RT_INPUTCLIENT,
+ (pointer) pWin))
+ return BadAlloc;
+ }
+ }
+ else {
+ wOtherInputMasks(pWin)->inputClients = other->next;
+ FreeInputClient(&other);
+ }
+ RecalculateDeviceDeliverableEvents(pWin);
+ return Success;
+ }
+ prev = other;
}
FatalError("client not on device event list");
}
@@ -2689,7 +2653,8 @@ InputClientGone(WindowPtr pWin, XID id)
* and all its subwindows from the trace when found. The initial window
* order is preserved.
*/
-void WindowGone(WindowPtr win)
+void
+WindowGone(WindowPtr win)
{
DeviceIntPtr dev;
@@ -2716,60 +2681,63 @@ void WindowGone(WindowPtr win)
int
SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
- xEvent * ev, Mask mask, int count)
+ xEvent *ev, Mask mask, int count)
{
WindowPtr pWin;
- WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
+ WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
WindowPtr spriteWin = GetSpriteWindow(d);
if (dest == PointerWindow)
- pWin = spriteWin;
+ pWin = spriteWin;
else if (dest == InputFocus) {
- WindowPtr inputFocus;
-
- if (!d->focus)
- inputFocus = spriteWin;
- else
- inputFocus = d->focus->win;
-
- if (inputFocus == FollowKeyboardWin)
- inputFocus = inputInfo.keyboard->focus->win;
-
- if (inputFocus == NoneWin)
- return Success;
-
- /* If the input focus is PointerRootWin, send the event to where
- * the pointer is if possible, then perhaps propogate up to root. */
- if (inputFocus == PointerRootWin)
- inputFocus = GetCurrentRootWindow(d);
-
- if (IsParent(inputFocus, spriteWin)) {
- effectiveFocus = inputFocus;
- pWin = spriteWin;
- } else
- effectiveFocus = pWin = inputFocus;
- } else
- dixLookupWindow(&pWin, dest, client, DixSendAccess);
+ WindowPtr inputFocus;
+
+ if (!d->focus)
+ inputFocus = spriteWin;
+ else
+ inputFocus = d->focus->win;
+
+ if (inputFocus == FollowKeyboardWin)
+ inputFocus = inputInfo.keyboard->focus->win;
+
+ if (inputFocus == NoneWin)
+ return Success;
+
+ /* If the input focus is PointerRootWin, send the event to where
+ * the pointer is if possible, then perhaps propogate up to root. */
+ if (inputFocus == PointerRootWin)
+ inputFocus = GetCurrentRootWindow(d);
+
+ if (IsParent(inputFocus, spriteWin)) {
+ effectiveFocus = inputFocus;
+ pWin = spriteWin;
+ }
+ else
+ effectiveFocus = pWin = inputFocus;
+ }
+ else
+ dixLookupWindow(&pWin, dest, client, DixSendAccess);
if (!pWin)
- return BadWindow;
+ return BadWindow;
if ((propagate != xFalse) && (propagate != xTrue)) {
- client->errorValue = propagate;
- return BadValue;
+ client->errorValue = propagate;
+ return BadValue;
}
ev->u.u.type |= 0x80;
if (propagate) {
- for (; pWin; pWin = pWin->parent) {
- if (DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab))
- return Success;
- if (pWin == effectiveFocus)
- return Success;
- if (wOtherInputMasks(pWin))
- mask &= ~wOtherInputMasks(pWin)->dontPropagateMask[d->id];
- if (!mask)
- break;
- }
- } else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count))
- DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab);
+ for (; pWin; pWin = pWin->parent) {
+ if (DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab))
+ return Success;
+ if (pWin == effectiveFocus)
+ return Success;
+ if (wOtherInputMasks(pWin))
+ mask &= ~wOtherInputMasks(pWin)->dontPropagateMask[d->id];
+ if (!mask)
+ break;
+ }
+ }
+ else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count))
+ DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab);
return Success;
}
@@ -2780,47 +2748,47 @@ SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map)
ButtonClassPtr b = dev->button;
if (b == NULL)
- return BadMatch;
+ return BadMatch;
if (nElts != b->numButtons) {
- client->errorValue = nElts;
- return BadValue;
+ client->errorValue = nElts;
+ return BadValue;
}
if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue))
- return BadValue;
+ return BadValue;
for (i = 0; i < nElts; i++)
- if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1))
- return MappingBusy;
+ if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1))
+ return MappingBusy;
for (i = 0; i < nElts; i++)
- b->map[i + 1] = map[i];
+ b->map[i + 1] = map[i];
return Success;
}
int
ChangeKeyMapping(ClientPtr client,
- DeviceIntPtr dev,
- unsigned len,
- int type,
- KeyCode firstKeyCode,
- CARD8 keyCodes, CARD8 keySymsPerKeyCode, KeySym * map)
+ DeviceIntPtr dev,
+ unsigned len,
+ int type,
+ KeyCode firstKeyCode,
+ CARD8 keyCodes, CARD8 keySymsPerKeyCode, KeySym * map)
{
KeySymsRec keysyms;
KeyClassPtr k = dev->key;
if (k == NULL)
- return BadMatch;
+ return BadMatch;
if (len != (keyCodes * keySymsPerKeyCode))
- return BadLength;
+ return BadLength;
if ((firstKeyCode < k->xkbInfo->desc->min_key_code) ||
- (firstKeyCode + keyCodes - 1 > k->xkbInfo->desc->max_key_code)) {
- client->errorValue = firstKeyCode;
- return BadValue;
+ (firstKeyCode + keyCodes - 1 > k->xkbInfo->desc->max_key_code)) {
+ client->errorValue = firstKeyCode;
+ return BadValue;
}
if (keySymsPerKeyCode == 0) {
- client->errorValue = 0;
- return BadValue;
+ client->errorValue = 0;
+ return BadValue;
}
keysyms.minKeyCode = firstKeyCode;
keysyms.maxKeyCode = firstKeyCode + keyCodes - 1;
@@ -2843,68 +2811,70 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev)
* Deactivating a device grab should cause focus events. */
if (dev->deviceGrab.grab && (dev->deviceGrab.grab->window == pWin))
- (*dev->deviceGrab.DeactivateGrab) (dev);
+ (*dev->deviceGrab.DeactivateGrab) (dev);
/* If the focus window is a root window (ie. has no parent)
* then don't delete the focus from it. */
if (dev->focus && (pWin == dev->focus->win) && (pWin->parent != NullWindow)) {
- int focusEventMode = NotifyNormal;
-
- /* If a grab is in progress, then alter the mode of focus events. */
-
- if (dev->deviceGrab.grab)
- focusEventMode = NotifyWhileGrabbed;
-
- switch (dev->focus->revert) {
- case RevertToNone:
- if (!ActivateFocusInGrab(dev, pWin, NoneWin))
- DoFocusEvents(dev, pWin, NoneWin, focusEventMode);
- dev->focus->win = NoneWin;
- dev->focus->traceGood = 0;
- break;
- case RevertToParent:
- parent = pWin;
- do {
- parent = parent->parent;
- dev->focus->traceGood--;
- }
- while (!parent->realized);
- if (!ActivateFocusInGrab(dev, pWin, parent))
- DoFocusEvents(dev, pWin, parent, focusEventMode);
- dev->focus->win = parent;
- dev->focus->revert = RevertToNone;
- break;
- case RevertToPointerRoot:
- if (!ActivateFocusInGrab(dev, pWin, PointerRootWin))
- DoFocusEvents(dev, pWin, PointerRootWin, focusEventMode);
- dev->focus->win = PointerRootWin;
- dev->focus->traceGood = 0;
- break;
- case RevertToFollowKeyboard:
- {
- DeviceIntPtr kbd = GetMaster(dev, MASTER_KEYBOARD);
- if (!kbd || (kbd == dev && kbd != inputInfo.keyboard))
- kbd = inputInfo.keyboard;
- if (kbd->focus->win) {
- if (!ActivateFocusInGrab(dev, pWin, kbd->focus->win))
- DoFocusEvents(dev, pWin, kbd->focus->win, focusEventMode);
- dev->focus->win = FollowKeyboardWin;
- dev->focus->traceGood = 0;
- } else {
+ int focusEventMode = NotifyNormal;
+
+ /* If a grab is in progress, then alter the mode of focus events. */
+
+ if (dev->deviceGrab.grab)
+ focusEventMode = NotifyWhileGrabbed;
+
+ switch (dev->focus->revert) {
+ case RevertToNone:
+ if (!ActivateFocusInGrab(dev, pWin, NoneWin))
+ DoFocusEvents(dev, pWin, NoneWin, focusEventMode);
+ dev->focus->win = NoneWin;
+ dev->focus->traceGood = 0;
+ break;
+ case RevertToParent:
+ parent = pWin;
+ do {
+ parent = parent->parent;
+ dev->focus->traceGood--;
+ }
+ while (!parent->realized);
+ if (!ActivateFocusInGrab(dev, pWin, parent))
+ DoFocusEvents(dev, pWin, parent, focusEventMode);
+ dev->focus->win = parent;
+ dev->focus->revert = RevertToNone;
+ break;
+ case RevertToPointerRoot:
+ if (!ActivateFocusInGrab(dev, pWin, PointerRootWin))
+ DoFocusEvents(dev, pWin, PointerRootWin, focusEventMode);
+ dev->focus->win = PointerRootWin;
+ dev->focus->traceGood = 0;
+ break;
+ case RevertToFollowKeyboard:
+ {
+ DeviceIntPtr kbd = GetMaster(dev, MASTER_KEYBOARD);
+
+ if (!kbd || (kbd == dev && kbd != inputInfo.keyboard))
+ kbd = inputInfo.keyboard;
+ if (kbd->focus->win) {
+ if (!ActivateFocusInGrab(dev, pWin, kbd->focus->win))
+ DoFocusEvents(dev, pWin, kbd->focus->win, focusEventMode);
+ dev->focus->win = FollowKeyboardWin;
+ dev->focus->traceGood = 0;
+ }
+ else {
if (!ActivateFocusInGrab(dev, pWin, NoneWin))
DoFocusEvents(dev, pWin, NoneWin, focusEventMode);
- dev->focus->win = NoneWin;
- dev->focus->traceGood = 0;
- }
+ dev->focus->win = NoneWin;
+ dev->focus->traceGood = 0;
}
- break;
- }
+ }
+ break;
+ }
}
if (dev->valuator)
- if (dev->valuator->motionHintWindow == pWin)
- dev->valuator->motionHintWindow = NullWindow;
+ if (dev->valuator->motionHintWindow == pWin)
+ dev->valuator->motionHintWindow = NullWindow;
}
void
@@ -2916,79 +2886,80 @@ DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
struct _OtherInputMasks *inputMasks;
for (dev = inputInfo.devices; dev; dev = dev->next) {
- DeleteDeviceFromAnyExtEvents(pWin, dev);
+ DeleteDeviceFromAnyExtEvents(pWin, dev);
}
for (dev = inputInfo.off_devices; dev; dev = dev->next)
- DeleteDeviceFromAnyExtEvents(pWin, dev);
+ DeleteDeviceFromAnyExtEvents(pWin, dev);
if (freeResources)
- while ((inputMasks = wOtherInputMasks(pWin)) != 0) {
- ic = inputMasks->inputClients;
- for (i = 0; i < EMASKSIZE; i++)
- inputMasks->dontPropagateMask[i] = 0;
- FreeResource(ic->resource, RT_NONE);
- }
+ while ((inputMasks = wOtherInputMasks(pWin)) != 0) {
+ ic = inputMasks->inputClients;
+ for (i = 0; i < EMASKSIZE; i++)
+ inputMasks->dontPropagateMask[i] = 0;
+ FreeResource(ic->resource, RT_NONE);
+ }
}
int
-MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask)
+MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer *pEvents, Mask mask)
{
DeviceIntPtr dev;
dixLookupDevice(&dev, pEvents->deviceid & DEVICE_BITS, serverClient,
- DixReadAccess);
+ DixReadAccess);
if (!dev)
return 0;
if (pEvents->type == DeviceMotionNotify) {
- if (mask & DevicePointerMotionHintMask) {
- if (WID(dev->valuator->motionHintWindow) == pEvents->event) {
- return 1; /* don't send, but pretend we did */
- }
- pEvents->detail = NotifyHint;
- } else {
- pEvents->detail = NotifyNormal;
- }
+ if (mask & DevicePointerMotionHintMask) {
+ if (WID(dev->valuator->motionHintWindow) == pEvents->event) {
+ return 1; /* don't send, but pretend we did */
+ }
+ pEvents->detail = NotifyHint;
+ }
+ else {
+ pEvents->detail = NotifyNormal;
+ }
}
return 0;
}
void
CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type,
- deviceKeyButtonPointer * xE, GrabPtr grab,
- ClientPtr client, Mask deliveryMask)
+ deviceKeyButtonPointer *xE, GrabPtr grab,
+ ClientPtr client, Mask deliveryMask)
{
DeviceIntPtr dev;
dixLookupDevice(&dev, xE->deviceid & DEVICE_BITS, serverClient,
- DixGrabAccess);
+ DixGrabAccess);
if (!dev)
return;
if (type == DeviceMotionNotify)
- dev->valuator->motionHintWindow = pWin;
+ dev->valuator->motionHintWindow = pWin;
else if ((type == DeviceButtonPress) && (!grab) &&
- (deliveryMask & DeviceButtonGrabMask)) {
- GrabPtr tempGrab;
+ (deliveryMask & DeviceButtonGrabMask)) {
+ GrabPtr tempGrab;
- tempGrab = AllocGrab();
- if (!tempGrab)
- return;
+ tempGrab = AllocGrab();
+ if (!tempGrab)
+ return;
- tempGrab->device = dev;
- tempGrab->resource = client->clientAsMask;
- tempGrab->window = pWin;
- tempGrab->ownerEvents =
- (deliveryMask & DeviceOwnerGrabButtonMask) ? TRUE : FALSE;
- tempGrab->eventMask = deliveryMask;
- tempGrab->keyboardMode = GrabModeAsync;
- tempGrab->pointerMode = GrabModeAsync;
- tempGrab->confineTo = NullWindow;
- tempGrab->cursor = NullCursor;
- tempGrab->next = NULL;
- (*dev->deviceGrab.ActivateGrab) (dev, tempGrab, currentTime, TRUE);
- FreeGrab(tempGrab);
+ tempGrab->device = dev;
+ tempGrab->resource = client->clientAsMask;
+ tempGrab->window = pWin;
+ tempGrab->ownerEvents =
+ (deliveryMask & DeviceOwnerGrabButtonMask) ? TRUE : FALSE;
+ tempGrab->eventMask = deliveryMask;
+ tempGrab->keyboardMode = GrabModeAsync;
+ tempGrab->pointerMode = GrabModeAsync;
+ tempGrab->confineTo = NullWindow;
+ tempGrab->cursor = NullCursor;
+ tempGrab->next = NULL;
+ (*dev->deviceGrab.ActivateGrab) (dev, tempGrab, currentTime, TRUE);
+ FreeGrab(tempGrab);
}
}
@@ -2998,11 +2969,11 @@ DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
InputClientsPtr other;
if (!wOtherInputMasks(pWin))
- return 0;
+ return 0;
for (other = wOtherInputMasks(pWin)->inputClients; other;
- other = other->next) {
- if (SameClient(other, client))
- return other->mask[dev->id];
+ other = other->next) {
+ if (SameClient(other, client))
+ return other->mask[dev->id];
}
return 0;
}
@@ -3016,39 +2987,40 @@ MaybeStopDeviceHint(DeviceIntPtr dev, ClientPtr client)
pWin = dev->valuator->motionHintWindow;
if ((grab && SameClient(grab, client) &&
- ((grab->eventMask & DevicePointerMotionHintMask) ||
- (grab->ownerEvents &&
- (DeviceEventMaskForClient(dev, pWin, client) &
- DevicePointerMotionHintMask)))) ||
- (!grab &&
- (DeviceEventMaskForClient(dev, pWin, client) &
- DevicePointerMotionHintMask)))
- dev->valuator->motionHintWindow = NullWindow;
+ ((grab->eventMask & DevicePointerMotionHintMask) ||
+ (grab->ownerEvents &&
+ (DeviceEventMaskForClient(dev, pWin, client) &
+ DevicePointerMotionHintMask)))) ||
+ (!grab &&
+ (DeviceEventMaskForClient(dev, pWin, client) &
+ DevicePointerMotionHintMask)))
+ dev->valuator->motionHintWindow = NullWindow;
}
int
DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
- int maskndx)
+ int maskndx)
{
struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
if (mask & ~PropagateMask[maskndx]) {
- client->errorValue = mask;
- return BadValue;
+ client->errorValue = mask;
+ return BadValue;
}
if (mask == 0) {
- if (inputMasks)
- inputMasks->dontPropagateMask[maskndx] = mask;
- } else {
- if (!inputMasks)
- AddExtensionClient(pWin, client, 0, 0);
- inputMasks = wOtherInputMasks(pWin);
- inputMasks->dontPropagateMask[maskndx] = mask;
+ if (inputMasks)
+ inputMasks->dontPropagateMask[maskndx] = mask;
+ }
+ else {
+ if (!inputMasks)
+ AddExtensionClient(pWin, client, 0, 0);
+ inputMasks = wOtherInputMasks(pWin);
+ inputMasks->dontPropagateMask[maskndx] = mask;
}
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE))
- FreeResource(inputMasks->inputClients->resource, RT_NONE);
+ FreeResource(inputMasks->inputClients->resource, RT_NONE);
return Success;
}
@@ -3060,14 +3032,14 @@ ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents)
struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
for (i = 0; i < EMASKSIZE; i++)
- allInputEventMasks |= inputMasks->dontPropagateMask[i];
+ allInputEventMasks |= inputMasks->dontPropagateMask[i];
if (!ignoreSelectedEvents)
- for (i = 0; i < EMASKSIZE; i++)
- allInputEventMasks |= inputMasks->inputEvents[i];
+ for (i = 0; i < EMASKSIZE; i++)
+ allInputEventMasks |= inputMasks->inputEvents[i];
if (allInputEventMasks == 0)
- return TRUE;
+ return TRUE;
else
- return FALSE;
+ return FALSE;
}
/***********************************************************************
@@ -3079,7 +3051,7 @@ ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents)
static void
FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask,
- xEvent * ev, int count)
+ xEvent *ev, int count)
{
WindowPtr p2;
@@ -3098,7 +3070,7 @@ FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask,
*/
void
-SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
+SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent *ev, int count)
{
int i;
WindowPtr pWin, p1;
@@ -3123,29 +3095,26 @@ SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
*/
int
XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
- unsigned int len, unsigned char* mask)
+ unsigned int len, unsigned char *mask)
{
OtherInputMasks *masks;
InputClientsPtr others = NULL;
masks = wOtherInputMasks(win);
- if (masks)
- {
- for (others = wOtherInputMasks(win)->inputClients; others;
- others = others->next) {
- if (SameClient(others, client)) {
+ if (masks) {
+ for (others = wOtherInputMasks(win)->inputClients; others;
+ others = others->next) {
+ if (SameClient(others, client)) {
xi2mask_zero(others->xi2mask, dev->id);
break;
}
}
}
-
- if (len && !others)
- {
+ if (len && !others) {
if (AddExtensionClient(win, client, 0, 0) != Success)
return BadAlloc;
- others= wOtherInputMasks(win)->inputClients;
+ others = wOtherInputMasks(win)->inputClients;
}
if (others) {
diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c
index a81c8f1ff..4483076e9 100644
--- a/xorg-server/Xi/extinit.c
+++ b/xorg-server/Xi/extinit.c
@@ -58,13 +58,13 @@ SOFTWARE.
#endif
#include "inputstr.h"
-#include "gcstruct.h" /* pointer for extnsionst.h */
-#include "extnsionst.h" /* extension entry */
+#include "gcstruct.h" /* pointer for extnsionst.h */
+#include "extnsionst.h" /* extension entry */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
-#include "geext.h" /* extension interfaces for ge */
+#include "geext.h" /* extension interfaces for ge */
#include "dixevents.h"
#include "exevents.h"
@@ -125,42 +125,40 @@ SOFTWARE.
#include "xisetclientpointer.h"
#include "xiwarppointer.h"
-
/* Masks for XI events have to be aligned with core event (partially anyway).
* If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
* breaks down. The device needs the dev->button->motionMask. If DBMM is
* the same as BMM, we can ensure that both core and device events can be
* delivered, without the need for extra structures in the DeviceIntRec. */
-const Mask DeviceKeyPressMask = KeyPressMask;
-const Mask DeviceKeyReleaseMask = KeyReleaseMask;
-const Mask DeviceButtonPressMask = ButtonPressMask;
-const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
-const Mask DeviceProximityMask = (1L << 4);
-const Mask DeviceStateNotifyMask = (1L << 5);
-const Mask DevicePointerMotionMask = PointerMotionMask;
-const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
-const Mask DeviceButton1MotionMask = Button1MotionMask;
-const Mask DeviceButton2MotionMask = Button2MotionMask;
-const Mask DeviceButton3MotionMask = Button3MotionMask;
-const Mask DeviceButton4MotionMask = Button4MotionMask;
-const Mask DeviceButton5MotionMask = Button5MotionMask;
-const Mask DeviceButtonMotionMask = ButtonMotionMask;
-const Mask DeviceFocusChangeMask = (1L << 14);
-const Mask DeviceMappingNotifyMask = (1L << 15);
-const Mask ChangeDeviceNotifyMask = (1L << 16);
-const Mask DeviceButtonGrabMask = (1L << 17);
-const Mask DeviceOwnerGrabButtonMask = (1L << 17);
-const Mask DevicePresenceNotifyMask = (1L << 18);
-const Mask DeviceEnterWindowMask = (1L << 18);
-const Mask DeviceLeaveWindowMask = (1L << 19);
-const Mask DevicePropertyNotifyMask = (1L << 20);
-const Mask XIAllMasks = (1L << 21) - 1;
+const Mask DeviceKeyPressMask = KeyPressMask;
+const Mask DeviceKeyReleaseMask = KeyReleaseMask;
+const Mask DeviceButtonPressMask = ButtonPressMask;
+const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
+const Mask DeviceProximityMask = (1L << 4);
+const Mask DeviceStateNotifyMask = (1L << 5);
+const Mask DevicePointerMotionMask = PointerMotionMask;
+const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
+const Mask DeviceButton1MotionMask = Button1MotionMask;
+const Mask DeviceButton2MotionMask = Button2MotionMask;
+const Mask DeviceButton3MotionMask = Button3MotionMask;
+const Mask DeviceButton4MotionMask = Button4MotionMask;
+const Mask DeviceButton5MotionMask = Button5MotionMask;
+const Mask DeviceButtonMotionMask = ButtonMotionMask;
+const Mask DeviceFocusChangeMask = (1L << 14);
+const Mask DeviceMappingNotifyMask = (1L << 15);
+const Mask ChangeDeviceNotifyMask = (1L << 16);
+const Mask DeviceButtonGrabMask = (1L << 17);
+const Mask DeviceOwnerGrabButtonMask = (1L << 17);
+const Mask DevicePresenceNotifyMask = (1L << 18);
+const Mask DeviceEnterWindowMask = (1L << 18);
+const Mask DeviceLeaveWindowMask = (1L << 19);
+const Mask DevicePropertyNotifyMask = (1L << 20);
+const Mask XIAllMasks = (1L << 21) - 1;
int ExtEventIndex;
Mask ExtExclusiveMasks[EMASKSIZE];
-static struct dev_type
-{
+static struct dev_type {
Atom type;
const char *name;
} dev_type[] = {
@@ -194,135 +192,135 @@ static DeviceIntRec xi_all_master_devices;
* Dispatch vector. Functions defined in here will be called when the matching
* request arrives.
*/
-static int (*ProcIVector[])(ClientPtr) = {
- NULL, /* 0 */
- ProcXGetExtensionVersion, /* 1 */
- ProcXListInputDevices, /* 2 */
- ProcXOpenDevice, /* 3 */
- ProcXCloseDevice, /* 4 */
- ProcXSetDeviceMode, /* 5 */
- ProcXSelectExtensionEvent, /* 6 */
- ProcXGetSelectedExtensionEvents, /* 7 */
- ProcXChangeDeviceDontPropagateList, /* 8 */
- ProcXGetDeviceDontPropagateList, /* 9 */
- ProcXGetDeviceMotionEvents, /* 10 */
- ProcXChangeKeyboardDevice, /* 11 */
- ProcXChangePointerDevice, /* 12 */
- ProcXGrabDevice, /* 13 */
- ProcXUngrabDevice, /* 14 */
- ProcXGrabDeviceKey, /* 15 */
- ProcXUngrabDeviceKey, /* 16 */
- ProcXGrabDeviceButton, /* 17 */
- ProcXUngrabDeviceButton, /* 18 */
- ProcXAllowDeviceEvents, /* 19 */
- ProcXGetDeviceFocus, /* 20 */
- ProcXSetDeviceFocus, /* 21 */
- ProcXGetFeedbackControl, /* 22 */
- ProcXChangeFeedbackControl, /* 23 */
- ProcXGetDeviceKeyMapping, /* 24 */
- ProcXChangeDeviceKeyMapping, /* 25 */
- ProcXGetDeviceModifierMapping, /* 26 */
- ProcXSetDeviceModifierMapping, /* 27 */
- ProcXGetDeviceButtonMapping, /* 28 */
- ProcXSetDeviceButtonMapping, /* 29 */
- ProcXQueryDeviceState, /* 30 */
- ProcXSendExtensionEvent, /* 31 */
- ProcXDeviceBell, /* 32 */
- ProcXSetDeviceValuators, /* 33 */
- ProcXGetDeviceControl, /* 34 */
- ProcXChangeDeviceControl, /* 35 */
+static int (*ProcIVector[]) (ClientPtr) = {
+ NULL, /* 0 */
+ ProcXGetExtensionVersion, /* 1 */
+ ProcXListInputDevices, /* 2 */
+ ProcXOpenDevice, /* 3 */
+ ProcXCloseDevice, /* 4 */
+ ProcXSetDeviceMode, /* 5 */
+ ProcXSelectExtensionEvent, /* 6 */
+ ProcXGetSelectedExtensionEvents, /* 7 */
+ ProcXChangeDeviceDontPropagateList, /* 8 */
+ ProcXGetDeviceDontPropagateList, /* 9 */
+ ProcXGetDeviceMotionEvents, /* 10 */
+ ProcXChangeKeyboardDevice, /* 11 */
+ ProcXChangePointerDevice, /* 12 */
+ ProcXGrabDevice, /* 13 */
+ ProcXUngrabDevice, /* 14 */
+ ProcXGrabDeviceKey, /* 15 */
+ ProcXUngrabDeviceKey, /* 16 */
+ ProcXGrabDeviceButton, /* 17 */
+ ProcXUngrabDeviceButton, /* 18 */
+ ProcXAllowDeviceEvents, /* 19 */
+ ProcXGetDeviceFocus, /* 20 */
+ ProcXSetDeviceFocus, /* 21 */
+ ProcXGetFeedbackControl, /* 22 */
+ ProcXChangeFeedbackControl, /* 23 */
+ ProcXGetDeviceKeyMapping, /* 24 */
+ ProcXChangeDeviceKeyMapping, /* 25 */
+ ProcXGetDeviceModifierMapping, /* 26 */
+ ProcXSetDeviceModifierMapping, /* 27 */
+ ProcXGetDeviceButtonMapping, /* 28 */
+ ProcXSetDeviceButtonMapping, /* 29 */
+ ProcXQueryDeviceState, /* 30 */
+ ProcXSendExtensionEvent, /* 31 */
+ ProcXDeviceBell, /* 32 */
+ ProcXSetDeviceValuators, /* 33 */
+ ProcXGetDeviceControl, /* 34 */
+ ProcXChangeDeviceControl, /* 35 */
/* XI 1.5 */
- ProcXListDeviceProperties, /* 36 */
- ProcXChangeDeviceProperty, /* 37 */
- ProcXDeleteDeviceProperty, /* 38 */
- ProcXGetDeviceProperty, /* 39 */
+ ProcXListDeviceProperties, /* 36 */
+ ProcXChangeDeviceProperty, /* 37 */
+ ProcXDeleteDeviceProperty, /* 38 */
+ ProcXGetDeviceProperty, /* 39 */
/* XI 2 */
- ProcXIQueryPointer, /* 40 */
- ProcXIWarpPointer, /* 41 */
- ProcXIChangeCursor, /* 42 */
- ProcXIChangeHierarchy, /* 43 */
- ProcXISetClientPointer, /* 44 */
- ProcXIGetClientPointer, /* 45 */
- ProcXISelectEvents, /* 46 */
- ProcXIQueryVersion, /* 47 */
- ProcXIQueryDevice, /* 48 */
- ProcXISetFocus, /* 49 */
- ProcXIGetFocus, /* 50 */
- ProcXIGrabDevice, /* 51 */
- ProcXIUngrabDevice, /* 52 */
- ProcXIAllowEvents, /* 53 */
- ProcXIPassiveGrabDevice, /* 54 */
- ProcXIPassiveUngrabDevice, /* 55 */
- ProcXIListProperties, /* 56 */
- ProcXIChangeProperty, /* 57 */
- ProcXIDeleteProperty, /* 58 */
- ProcXIGetProperty, /* 59 */
- ProcXIGetSelectedEvents /* 60 */
+ ProcXIQueryPointer, /* 40 */
+ ProcXIWarpPointer, /* 41 */
+ ProcXIChangeCursor, /* 42 */
+ ProcXIChangeHierarchy, /* 43 */
+ ProcXISetClientPointer, /* 44 */
+ ProcXIGetClientPointer, /* 45 */
+ ProcXISelectEvents, /* 46 */
+ ProcXIQueryVersion, /* 47 */
+ ProcXIQueryDevice, /* 48 */
+ ProcXISetFocus, /* 49 */
+ ProcXIGetFocus, /* 50 */
+ ProcXIGrabDevice, /* 51 */
+ ProcXIUngrabDevice, /* 52 */
+ ProcXIAllowEvents, /* 53 */
+ ProcXIPassiveGrabDevice, /* 54 */
+ ProcXIPassiveUngrabDevice, /* 55 */
+ ProcXIListProperties, /* 56 */
+ ProcXIChangeProperty, /* 57 */
+ ProcXIDeleteProperty, /* 58 */
+ ProcXIGetProperty, /* 59 */
+ ProcXIGetSelectedEvents /* 60 */
};
/* For swapped clients */
-static int (*SProcIVector[])(ClientPtr) = {
- NULL, /* 0 */
- SProcXGetExtensionVersion, /* 1 */
- SProcXListInputDevices, /* 2 */
- SProcXOpenDevice, /* 3 */
- SProcXCloseDevice, /* 4 */
- SProcXSetDeviceMode, /* 5 */
- SProcXSelectExtensionEvent, /* 6 */
- SProcXGetSelectedExtensionEvents, /* 7 */
- SProcXChangeDeviceDontPropagateList, /* 8 */
- SProcXGetDeviceDontPropagateList, /* 9 */
- SProcXGetDeviceMotionEvents, /* 10 */
- SProcXChangeKeyboardDevice, /* 11 */
- SProcXChangePointerDevice, /* 12 */
- SProcXGrabDevice, /* 13 */
- SProcXUngrabDevice, /* 14 */
- SProcXGrabDeviceKey, /* 15 */
- SProcXUngrabDeviceKey, /* 16 */
- SProcXGrabDeviceButton, /* 17 */
- SProcXUngrabDeviceButton, /* 18 */
- SProcXAllowDeviceEvents, /* 19 */
- SProcXGetDeviceFocus, /* 20 */
- SProcXSetDeviceFocus, /* 21 */
- SProcXGetFeedbackControl, /* 22 */
- SProcXChangeFeedbackControl, /* 23 */
- SProcXGetDeviceKeyMapping, /* 24 */
- SProcXChangeDeviceKeyMapping, /* 25 */
- SProcXGetDeviceModifierMapping, /* 26 */
- SProcXSetDeviceModifierMapping, /* 27 */
- SProcXGetDeviceButtonMapping, /* 28 */
- SProcXSetDeviceButtonMapping, /* 29 */
- SProcXQueryDeviceState, /* 30 */
- SProcXSendExtensionEvent, /* 31 */
- SProcXDeviceBell, /* 32 */
- SProcXSetDeviceValuators, /* 33 */
- SProcXGetDeviceControl, /* 34 */
- SProcXChangeDeviceControl, /* 35 */
- SProcXListDeviceProperties, /* 36 */
- SProcXChangeDeviceProperty, /* 37 */
- SProcXDeleteDeviceProperty, /* 38 */
- SProcXGetDeviceProperty, /* 39 */
- SProcXIQueryPointer, /* 40 */
- SProcXIWarpPointer, /* 41 */
- SProcXIChangeCursor, /* 42 */
- SProcXIChangeHierarchy, /* 43 */
- SProcXISetClientPointer, /* 44 */
- SProcXIGetClientPointer, /* 45 */
- SProcXISelectEvents, /* 46 */
- SProcXIQueryVersion, /* 47 */
- SProcXIQueryDevice, /* 48 */
- SProcXISetFocus, /* 49 */
- SProcXIGetFocus, /* 50 */
- SProcXIGrabDevice, /* 51 */
- SProcXIUngrabDevice, /* 52 */
- SProcXIAllowEvents, /* 53 */
- SProcXIPassiveGrabDevice, /* 54 */
- SProcXIPassiveUngrabDevice, /* 55 */
- SProcXIListProperties, /* 56 */
- SProcXIChangeProperty, /* 57 */
- SProcXIDeleteProperty, /* 58 */
- SProcXIGetProperty, /* 59 */
- SProcXIGetSelectedEvents /* 60 */
+static int (*SProcIVector[]) (ClientPtr) = {
+ NULL, /* 0 */
+ SProcXGetExtensionVersion, /* 1 */
+ SProcXListInputDevices, /* 2 */
+ SProcXOpenDevice, /* 3 */
+ SProcXCloseDevice, /* 4 */
+ SProcXSetDeviceMode, /* 5 */
+ SProcXSelectExtensionEvent, /* 6 */
+ SProcXGetSelectedExtensionEvents, /* 7 */
+ SProcXChangeDeviceDontPropagateList, /* 8 */
+ SProcXGetDeviceDontPropagateList, /* 9 */
+ SProcXGetDeviceMotionEvents, /* 10 */
+ SProcXChangeKeyboardDevice, /* 11 */
+ SProcXChangePointerDevice, /* 12 */
+ SProcXGrabDevice, /* 13 */
+ SProcXUngrabDevice, /* 14 */
+ SProcXGrabDeviceKey, /* 15 */
+ SProcXUngrabDeviceKey, /* 16 */
+ SProcXGrabDeviceButton, /* 17 */
+ SProcXUngrabDeviceButton, /* 18 */
+ SProcXAllowDeviceEvents, /* 19 */
+ SProcXGetDeviceFocus, /* 20 */
+ SProcXSetDeviceFocus, /* 21 */
+ SProcXGetFeedbackControl, /* 22 */
+ SProcXChangeFeedbackControl, /* 23 */
+ SProcXGetDeviceKeyMapping, /* 24 */
+ SProcXChangeDeviceKeyMapping, /* 25 */
+ SProcXGetDeviceModifierMapping, /* 26 */
+ SProcXSetDeviceModifierMapping, /* 27 */
+ SProcXGetDeviceButtonMapping, /* 28 */
+ SProcXSetDeviceButtonMapping, /* 29 */
+ SProcXQueryDeviceState, /* 30 */
+ SProcXSendExtensionEvent, /* 31 */
+ SProcXDeviceBell, /* 32 */
+ SProcXSetDeviceValuators, /* 33 */
+ SProcXGetDeviceControl, /* 34 */
+ SProcXChangeDeviceControl, /* 35 */
+ SProcXListDeviceProperties, /* 36 */
+ SProcXChangeDeviceProperty, /* 37 */
+ SProcXDeleteDeviceProperty, /* 38 */
+ SProcXGetDeviceProperty, /* 39 */
+ SProcXIQueryPointer, /* 40 */
+ SProcXIWarpPointer, /* 41 */
+ SProcXIChangeCursor, /* 42 */
+ SProcXIChangeHierarchy, /* 43 */
+ SProcXISetClientPointer, /* 44 */
+ SProcXIGetClientPointer, /* 45 */
+ SProcXISelectEvents, /* 46 */
+ SProcXIQueryVersion, /* 47 */
+ SProcXIQueryDevice, /* 48 */
+ SProcXISetFocus, /* 49 */
+ SProcXIGetFocus, /* 50 */
+ SProcXIGrabDevice, /* 51 */
+ SProcXIUngrabDevice, /* 52 */
+ SProcXIAllowEvents, /* 53 */
+ SProcXIPassiveGrabDevice, /* 54 */
+ SProcXIPassiveUngrabDevice, /* 55 */
+ SProcXIListProperties, /* 56 */
+ SProcXIChangeProperty, /* 57 */
+ SProcXIDeleteProperty, /* 58 */
+ SProcXIGetProperty, /* 59 */
+ SProcXIGetSelectedEvents /* 60 */
};
/*****************************************************************
@@ -367,7 +365,6 @@ RESTYPE RT_INPUTCLIENT;
extern XExtensionVersion XIVersion;
-
Mask PropagateMask[MAXDEVICES];
/*****************************************************************
@@ -385,11 +382,9 @@ DevPrivateKeyRec XIClientPrivateKeyRec;
*/
static void
-XIClientCallback(CallbackListPtr *list,
- pointer closure,
- pointer data)
+XIClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec*)data;
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
ClientPtr pClient = clientinfo->client;
XIClientPtr pXIClient;
@@ -412,7 +407,7 @@ ProcIDispatch(ClientPtr client)
if (stuff->data >= ARRAY_SIZE(ProcIVector) || !ProcIVector[stuff->data])
return BadRequest;
- return (*ProcIVector[stuff->data])(client);
+ return (*ProcIVector[stuff->data]) (client);
}
/*******************************************************************************
@@ -431,7 +426,7 @@ SProcIDispatch(ClientPtr client)
if (stuff->data >= ARRAY_SIZE(SProcIVector) || !SProcIVector[stuff->data])
return BadRequest;
- return (*SProcIVector[stuff->data])(client);
+ return (*SProcIVector[stuff->data]) (client);
}
/**********************************************************************
@@ -443,84 +438,85 @@ SProcIDispatch(ClientPtr client)
static void
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
- /* All we look at is the type field */
-{ /* This is common to all replies */
+ /* All we look at is the type field */
+{ /* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion)
- SRepXGetExtensionVersion(client, len,
- (xGetExtensionVersionReply *) rep);
+ SRepXGetExtensionVersion(client, len,
+ (xGetExtensionVersionReply *) rep);
else if (rep->RepType == X_ListInputDevices)
- SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
+ SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
else if (rep->RepType == X_OpenDevice)
- SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
+ SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
else if (rep->RepType == X_SetDeviceMode)
- SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
+ SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
else if (rep->RepType == X_GetSelectedExtensionEvents)
- SRepXGetSelectedExtensionEvents(client, len,
- (xGetSelectedExtensionEventsReply *)
- rep);
+ SRepXGetSelectedExtensionEvents(client, len,
+ (xGetSelectedExtensionEventsReply *)
+ rep);
else if (rep->RepType == X_GetDeviceDontPropagateList)
- SRepXGetDeviceDontPropagateList(client, len,
- (xGetDeviceDontPropagateListReply *)
- rep);
+ SRepXGetDeviceDontPropagateList(client, len,
+ (xGetDeviceDontPropagateListReply *)
+ rep);
else if (rep->RepType == X_GetDeviceMotionEvents)
- SRepXGetDeviceMotionEvents(client, len,
- (xGetDeviceMotionEventsReply *) rep);
+ SRepXGetDeviceMotionEvents(client, len,
+ (xGetDeviceMotionEventsReply *) rep);
else if (rep->RepType == X_GrabDevice)
- SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
+ SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
else if (rep->RepType == X_GetDeviceFocus)
- SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
+ SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
else if (rep->RepType == X_GetFeedbackControl)
- SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);
+ SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);
else if (rep->RepType == X_GetDeviceKeyMapping)
- SRepXGetDeviceKeyMapping(client, len,
- (xGetDeviceKeyMappingReply *) rep);
+ SRepXGetDeviceKeyMapping(client, len,
+ (xGetDeviceKeyMappingReply *) rep);
else if (rep->RepType == X_GetDeviceModifierMapping)
- SRepXGetDeviceModifierMapping(client, len,
- (xGetDeviceModifierMappingReply *) rep);
+ SRepXGetDeviceModifierMapping(client, len,
+ (xGetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_SetDeviceModifierMapping)
- SRepXSetDeviceModifierMapping(client, len,
- (xSetDeviceModifierMappingReply *) rep);
+ SRepXSetDeviceModifierMapping(client, len,
+ (xSetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_GetDeviceButtonMapping)
- SRepXGetDeviceButtonMapping(client, len,
- (xGetDeviceButtonMappingReply *) rep);
+ SRepXGetDeviceButtonMapping(client, len,
+ (xGetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_SetDeviceButtonMapping)
- SRepXSetDeviceButtonMapping(client, len,
- (xSetDeviceButtonMappingReply *) rep);
+ SRepXSetDeviceButtonMapping(client, len,
+ (xSetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_QueryDeviceState)
- SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
+ SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
else if (rep->RepType == X_SetDeviceValuators)
- SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
+ SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
else if (rep->RepType == X_GetDeviceControl)
- SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
+ SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
else if (rep->RepType == X_ChangeDeviceControl)
- SRepXChangeDeviceControl(client, len,
- (xChangeDeviceControlReply *) rep);
+ SRepXChangeDeviceControl(client, len,
+ (xChangeDeviceControlReply *) rep);
else if (rep->RepType == X_ListDeviceProperties)
- SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep);
+ SRepXListDeviceProperties(client, len,
+ (xListDevicePropertiesReply *) rep);
else if (rep->RepType == X_GetDeviceProperty)
- SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
+ SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
else if (rep->RepType == X_XIQueryPointer)
- SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
+ SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
else if (rep->RepType == X_XIGetClientPointer)
- SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply*) rep);
+ SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply *) rep);
else if (rep->RepType == X_XIQueryVersion)
- SRepXIQueryVersion(client, len, (xXIQueryVersionReply*)rep);
+ SRepXIQueryVersion(client, len, (xXIQueryVersionReply *) rep);
else if (rep->RepType == X_XIQueryDevice)
- SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep);
+ SRepXIQueryDevice(client, len, (xXIQueryDeviceReply *) rep);
else if (rep->RepType == X_XIGrabDevice)
- SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
+ SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
else if (rep->RepType == X_XIPassiveGrabDevice)
- SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
+ SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
else if (rep->RepType == X_XIListProperties)
- SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
+ SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
else if (rep->RepType == X_XIGetProperty)
- SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
+ SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
else if (rep->RepType == X_XIGetSelectedEvents)
- SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
+ SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
else if (rep->RepType == X_XIGetFocus)
- SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
+ SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
else {
- FatalError("XINPUT confused sending swapped reply");
+ FatalError("XINPUT confused sending swapped reply");
}
}
@@ -541,7 +537,7 @@ SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
swaps(&to->device_state);
ip = &to->valuator0;
for (i = 0; i < 6; i++) {
- swapl(ip + i);
+ swapl(ip + i);
}
}
@@ -565,13 +561,13 @@ SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
swapl(&to->time);
ip = &to->valuator0;
for (i = 0; i < 3; i++) {
- swapl(ip + i);
+ swapl(ip + i);
}
}
static void
SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
- deviceKeyStateNotify * to)
+ deviceKeyStateNotify * to)
{
*to = *from;
swaps(&to->sequenceNumber);
@@ -579,7 +575,7 @@ SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
static void
SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
- deviceButtonStateNotify * to)
+ deviceButtonStateNotify * to)
{
*to = *from;
swaps(&to->sequenceNumber);
@@ -602,7 +598,8 @@ SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
}
static void
-SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
+SDevicePresenceNotifyEvent(devicePresenceNotify * from,
+ devicePresenceNotify * to)
{
*to = *from;
swaps(&to->sequenceNumber);
@@ -611,7 +608,8 @@ SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to
}
static void
-SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to)
+SDevicePropertyNotifyEvent(devicePropertyNotify * from,
+ devicePropertyNotify * to)
{
*to = *from;
swaps(&to->sequenceNumber);
@@ -620,7 +618,7 @@ SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to
}
static void
-SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to)
+SDeviceLeaveNotifyEvent(xXILeaveEvent * from, xXILeaveEvent * to)
{
*to = *from;
swaps(&to->sequenceNumber);
@@ -643,7 +641,7 @@ SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to)
}
static void
-SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
+SDeviceChangedEvent(xXIDeviceChangedEvent * from, xXIDeviceChangedEvent * to)
{
int i, j;
xXIAnyInfo *any;
@@ -651,51 +649,52 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
*to = *from;
memcpy(&to[1], &from[1], from->length * 4);
- any = (xXIAnyInfo*)&to[1];
- for (i = 0; i < to->num_classes; i++)
- {
+ any = (xXIAnyInfo *) & to[1];
+ for (i = 0; i < to->num_classes; i++) {
int length = any->length;
- switch(any->type)
+ switch (any->type) {
+ case KeyClass:
+ {
+ xXIKeyInfo *ki = (xXIKeyInfo *) any;
+ uint32_t *key = (uint32_t *) & ki[1];
+
+ for (j = 0; j < ki->num_keycodes; j++, key++)
+ swapl(key);
+ swaps(&ki->num_keycodes);
+ }
+ break;
+ case ButtonClass:
+ {
+ xXIButtonInfo *bi = (xXIButtonInfo *) any;
+ Atom *labels = (Atom *) ((char *) bi + sizeof(xXIButtonInfo) +
+ pad_to_int32(bits_to_bytes
+ (bi->num_buttons)));
+ for (j = 0; j < bi->num_buttons; j++)
+ swapl(&labels[j]);
+ swaps(&bi->num_buttons);
+ }
+ break;
+ case ValuatorClass:
{
- case KeyClass:
- {
- xXIKeyInfo *ki = (xXIKeyInfo*)any;
- uint32_t *key = (uint32_t*)&ki[1];
- for (j = 0; j < ki->num_keycodes; j++, key++)
- swapl(key);
- swaps(&ki->num_keycodes);
- }
- break;
- case ButtonClass:
- {
- xXIButtonInfo *bi = (xXIButtonInfo*)any;
- Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) +
- pad_to_int32(bits_to_bytes(bi->num_buttons)));
- for (j = 0; j < bi->num_buttons; j++)
- swapl(&labels[j]);
- swaps(&bi->num_buttons);
- }
- break;
- case ValuatorClass:
- {
- xXIValuatorInfo* ai = (xXIValuatorInfo*)any;
- swapl(&ai->label);
- swapl(&ai->min.integral);
- swapl(&ai->min.frac);
- swapl(&ai->max.integral);
- swapl(&ai->max.frac);
- swapl(&ai->resolution);
- swaps(&ai->number);
- }
- break;
+ xXIValuatorInfo *ai = (xXIValuatorInfo *) any;
+
+ swapl(&ai->label);
+ swapl(&ai->min.integral);
+ swapl(&ai->min.frac);
+ swapl(&ai->max.integral);
+ swapl(&ai->max.frac);
+ swapl(&ai->resolution);
+ swaps(&ai->number);
+ }
+ break;
}
swaps(&any->type);
swaps(&any->length);
swaps(&any->sourceid);
- any = (xXIAnyInfo*)((char*)any + length * 4);
+ any = (xXIAnyInfo *) ((char *) any + length * 4);
}
swaps(&to->sequenceNumber);
@@ -708,7 +707,8 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
}
-static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
+static void
+SDeviceEvent(xXIDeviceEvent * from, xXIDeviceEvent * to)
{
int i;
char *ptr;
@@ -738,24 +738,22 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
swapl(&to->mods.effective_mods);
swapl(&to->flags);
- ptr = (char*)(&to[1]);
+ ptr = (char *) (&to[1]);
ptr += from->buttons_len * 4;
- vmask = ptr; /* valuator mask */
+ vmask = ptr; /* valuator mask */
ptr += from->valuators_len * 4;
- for (i = 0; i < from->valuators_len * 32; i++)
- {
- if (BitIsOn(vmask, i))
- {
- swapl(((uint32_t *)ptr));
+ for (i = 0; i < from->valuators_len * 32; i++) {
+ if (BitIsOn(vmask, i)) {
+ swapl(((uint32_t *) ptr));
ptr += 4;
- swapl(((uint32_t *)ptr));
+ swapl(((uint32_t *) ptr));
ptr += 4;
}
}
}
-static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
- xXIHierarchyEvent *to)
+static void
+SDeviceHierarchyEvent(xXIHierarchyEvent * from, xXIHierarchyEvent * to)
{
int i;
xXIHierarchyInfo *info;
@@ -770,16 +768,16 @@ static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
swapl(&to->flags);
swaps(&to->num_info);
- info = (xXIHierarchyInfo*)&to[1];
- for (i = 0; i< from->num_info; i++)
- {
+ info = (xXIHierarchyInfo *) & to[1];
+ for (i = 0; i < from->num_info; i++) {
swaps(&info->deviceid);
swaps(&info->attachment);
info++;
}
}
-static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
+static void
+SXIPropertyEvent(xXIPropertyEvent * from, xXIPropertyEvent * to)
{
*to = *from;
swaps(&to->sequenceNumber);
@@ -789,7 +787,8 @@ static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
swapl(&to->property);
}
-static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
+static void
+SRawEvent(xXIRawEvent * from, xXIRawEvent * to)
{
int i;
FP3232 *values;
@@ -804,14 +803,11 @@ static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
swapl(&to->time);
swapl(&to->detail);
+ mask = (unsigned char *) &to[1];
+ values = (FP3232 *) (mask + from->valuators_len * 4);
- mask = (unsigned char*)&to[1];
- values = (FP3232*)(mask + from->valuators_len * 4);
-
- for (i = 0; i < from->valuators_len * 4 * 8; i++)
- {
- if (BitIsOn(mask, i))
- {
+ for (i = 0; i < from->valuators_len * 4 * 8; i++) {
+ if (BitIsOn(mask, i)) {
/* for each bit set there are two FP3232 values on the wire, in
* the order abcABC for data and data_raw. Here we swap as if
* they were in aAbBcC order because it's easier and really
@@ -829,8 +825,8 @@ static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
swaps(&to->valuators_len);
}
-static void STouchOwnershipEvent(xXITouchOwnershipEvent *from,
- xXITouchOwnershipEvent *to)
+static void
+STouchOwnershipEvent(xXITouchOwnershipEvent * from, xXITouchOwnershipEvent * to)
{
*to = *from;
swaps(&to->sequenceNumber);
@@ -850,52 +846,51 @@ static void STouchOwnershipEvent(xXITouchOwnershipEvent *from,
void
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
{
- switch(from->evtype)
- {
- case XI_Enter:
- case XI_Leave:
- case XI_FocusIn:
- case XI_FocusOut:
- SDeviceLeaveNotifyEvent((xXILeaveEvent*)from, (xXILeaveEvent*)to);
- break;
- case XI_DeviceChanged:
- SDeviceChangedEvent((xXIDeviceChangedEvent*)from,
- (xXIDeviceChangedEvent*)to);
- break;
- case XI_HierarchyChanged:
- SDeviceHierarchyEvent((xXIHierarchyEvent*)from, (xXIHierarchyEvent*)to);
- break;
- case XI_PropertyEvent:
- SXIPropertyEvent((xXIPropertyEvent*)from,
- (xXIPropertyEvent*)to);
- break;
- case XI_Motion:
- case XI_KeyPress:
- case XI_KeyRelease:
- case XI_ButtonPress:
- case XI_ButtonRelease:
- case XI_TouchBegin:
- case XI_TouchUpdate:
- case XI_TouchEnd:
- SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to);
- break;
- case XI_TouchOwnership:
- STouchOwnershipEvent((xXITouchOwnershipEvent*)from,
- (xXITouchOwnershipEvent*)to);
- break;
- case XI_RawMotion:
- case XI_RawKeyPress:
- case XI_RawKeyRelease:
- case XI_RawButtonPress:
- case XI_RawButtonRelease:
- case XI_RawTouchBegin:
- case XI_RawTouchUpdate:
- case XI_RawTouchEnd:
- SRawEvent((xXIRawEvent*)from, (xXIRawEvent*)to);
- break;
- default:
- ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
- break;
+ switch (from->evtype) {
+ case XI_Enter:
+ case XI_Leave:
+ case XI_FocusIn:
+ case XI_FocusOut:
+ SDeviceLeaveNotifyEvent((xXILeaveEvent *) from, (xXILeaveEvent *) to);
+ break;
+ case XI_DeviceChanged:
+ SDeviceChangedEvent((xXIDeviceChangedEvent *) from,
+ (xXIDeviceChangedEvent *) to);
+ break;
+ case XI_HierarchyChanged:
+ SDeviceHierarchyEvent((xXIHierarchyEvent *) from,
+ (xXIHierarchyEvent *) to);
+ break;
+ case XI_PropertyEvent:
+ SXIPropertyEvent((xXIPropertyEvent *) from, (xXIPropertyEvent *) to);
+ break;
+ case XI_Motion:
+ case XI_KeyPress:
+ case XI_KeyRelease:
+ case XI_ButtonPress:
+ case XI_ButtonRelease:
+ case XI_TouchBegin:
+ case XI_TouchUpdate:
+ case XI_TouchEnd:
+ SDeviceEvent((xXIDeviceEvent *) from, (xXIDeviceEvent *) to);
+ break;
+ case XI_TouchOwnership:
+ STouchOwnershipEvent((xXITouchOwnershipEvent *) from,
+ (xXITouchOwnershipEvent *) to);
+ break;
+ case XI_RawMotion:
+ case XI_RawKeyPress:
+ case XI_RawKeyRelease:
+ case XI_RawButtonPress:
+ case XI_RawButtonRelease:
+ case XI_RawTouchBegin:
+ case XI_RawTouchUpdate:
+ case XI_RawTouchEnd:
+ SRawEvent((xXIRawEvent *) from, (xXIRawEvent *) to);
+ break;
+ default:
+ ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
+ break;
}
}
@@ -912,7 +907,7 @@ AllowPropagateSuppress(Mask mask)
int i;
for (i = 0; i < MAXDEVICES; i++)
- PropagateMask[i] |= mask;
+ PropagateMask[i] |= mask;
}
/**************************************************************************
@@ -949,7 +944,7 @@ SetExclusiveAccess(Mask mask)
int i;
for (i = 0; i < MAXDEVICES; i++)
- ExtExclusiveMasks[i] |= mask;
+ ExtExclusiveMasks[i] |= mask;
}
/**************************************************************************
@@ -967,7 +962,7 @@ SetMaskForExtEvent(Mask mask, int event)
EventInfo[ExtEventIndex++].type = event;
if ((event < LASTEvent) || (event >= 128))
- FatalError("MaskForExtensionEvent: bogus event number");
+ FatalError("MaskForExtensionEvent: bogus event number");
for (i = 0; i < MAXDEVICES; i++)
SetMaskForEvent(i, mask, event);
@@ -1078,13 +1073,12 @@ RestoreExtensionEvents(void)
IEventBase = 0;
for (i = 0; i < ExtEventIndex - 1; i++) {
- if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
- {
+ if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128)) {
for (j = 0; j < MAXDEVICES; j++)
SetMaskForEvent(j, 0, EventInfo[i].type);
}
- EventInfo[i].mask = 0;
- EventInfo[i].type = 0;
+ EventInfo[i].mask = 0;
+ EventInfo[i].type = 0;
}
ExtEventIndex = 0;
DeviceValuator = 0;
@@ -1145,7 +1139,6 @@ IResetProc(ExtensionEntry * unused)
RestoreExtensionEvents();
}
-
/***********************************************************************
*
* Assign an id and type to an input device.
@@ -1171,8 +1164,8 @@ MakeDeviceTypeAtoms(void)
int i;
for (i = 0; i < NUMTYPES; i++)
- dev_type[i].type =
- MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1);
+ dev_type[i].type =
+ MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1);
}
/*****************************************************************************
@@ -1184,53 +1177,60 @@ MakeDeviceTypeAtoms(void)
#define DO_SWAP(func,type) func ((type *)from, (type *)to)
static void
-SEventIDispatch(xEvent * from, xEvent * to)
+SEventIDispatch(xEvent *from, xEvent *to)
{
int type = from->u.u.type & 0177;
if (type == DeviceValuator)
- DO_SWAP(SEventDeviceValuator, deviceValuator);
+ DO_SWAP(SEventDeviceValuator, deviceValuator);
else if (type == DeviceKeyPress) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceKeyRelease) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceButtonPress) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceButtonRelease) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceMotionNotify) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceFocusIn)
- DO_SWAP(SEventFocus, deviceFocus);
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceKeyRelease) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceButtonPress) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceButtonRelease) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceMotionNotify) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceFocusIn)
+ DO_SWAP(SEventFocus, deviceFocus);
else if (type == DeviceFocusOut)
- DO_SWAP(SEventFocus, deviceFocus);
+ DO_SWAP(SEventFocus, deviceFocus);
else if (type == ProximityIn) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == ProximityOut) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceStateNotify)
- DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == ProximityOut) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceStateNotify)
+ DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
else if (type == DeviceKeyStateNotify)
- DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
+ DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
else if (type == DeviceButtonStateNotify)
- DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
+ DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
else if (type == DeviceMappingNotify)
- DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
+ DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
else if (type == ChangeDeviceNotify)
- DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
+ DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
else if (type == DevicePresenceNotify)
- DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
+ DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
else if (type == DevicePropertyNotify)
- DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify);
+ DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify);
else {
- FatalError("XInputExtension: Impossible event!\n");
+ FatalError("XInputExtension: Impossible event!\n");
}
}
@@ -1250,63 +1250,64 @@ void
XInputExtensionInit(void)
{
ExtensionEntry *extEntry;
+
XExtensionVersion thisversion = { XI_Present,
SERVER_XI_MAJOR_VERSION,
SERVER_XI_MINOR_VERSION,
};
- if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
+ if (!dixRegisterPrivateKey
+ (&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
FatalError("Cannot request private for XI.\n");
if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
FatalError("Failed to add callback to XI.\n");
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
- SProcIDispatch, IResetProc, StandardMinorOpcode);
+ SProcIDispatch, IResetProc, StandardMinorOpcode);
if (extEntry) {
- IReqCode = extEntry->base;
- IEventBase = extEntry->eventBase;
- XIVersion = thisversion;
- MakeDeviceTypeAtoms();
- RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone,
- "INPUTCLIENT");
- if (!RT_INPUTCLIENT)
- FatalError("Failed to add resource type for XI.\n");
- FixExtensionEvents(extEntry);
- ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
- EventSwapVector[DeviceValuator] = SEventIDispatch;
- EventSwapVector[DeviceKeyPress] = SEventIDispatch;
- EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
- EventSwapVector[DeviceButtonPress] = SEventIDispatch;
- EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
- EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
- EventSwapVector[DeviceFocusIn] = SEventIDispatch;
- EventSwapVector[DeviceFocusOut] = SEventIDispatch;
- EventSwapVector[ProximityIn] = SEventIDispatch;
- EventSwapVector[ProximityOut] = SEventIDispatch;
- EventSwapVector[DeviceStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
- EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
- EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
-
- GERegisterExtension(IReqCode, XI2EventSwap);
-
-
- memset(&xi_all_devices, 0, sizeof(xi_all_devices));
- memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
- xi_all_devices.id = XIAllDevices;
- xi_all_devices.name = "XIAllDevices";
- xi_all_master_devices.id = XIAllMasterDevices;
- xi_all_master_devices.name = "XIAllMasterDevices";
-
- inputInfo.all_devices = &xi_all_devices;
- inputInfo.all_master_devices = &xi_all_master_devices;
-
- XIResetProperties();
- } else {
- FatalError("IExtensionInit: AddExtensions failed\n");
+ IReqCode = extEntry->base;
+ IEventBase = extEntry->eventBase;
+ XIVersion = thisversion;
+ MakeDeviceTypeAtoms();
+ RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone,
+ "INPUTCLIENT");
+ if (!RT_INPUTCLIENT)
+ FatalError("Failed to add resource type for XI.\n");
+ FixExtensionEvents(extEntry);
+ ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
+ EventSwapVector[DeviceValuator] = SEventIDispatch;
+ EventSwapVector[DeviceKeyPress] = SEventIDispatch;
+ EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
+ EventSwapVector[DeviceButtonPress] = SEventIDispatch;
+ EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
+ EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
+ EventSwapVector[DeviceFocusIn] = SEventIDispatch;
+ EventSwapVector[DeviceFocusOut] = SEventIDispatch;
+ EventSwapVector[ProximityIn] = SEventIDispatch;
+ EventSwapVector[ProximityOut] = SEventIDispatch;
+ EventSwapVector[DeviceStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
+ EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
+ EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
+
+ GERegisterExtension(IReqCode, XI2EventSwap);
+
+ memset(&xi_all_devices, 0, sizeof(xi_all_devices));
+ memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
+ xi_all_devices.id = XIAllDevices;
+ xi_all_devices.name = "XIAllDevices";
+ xi_all_master_devices.id = XIAllMasterDevices;
+ xi_all_master_devices.name = "XIAllMasterDevices";
+
+ inputInfo.all_devices = &xi_all_devices;
+ inputInfo.all_master_devices = &xi_all_master_devices;
+
+ XIResetProperties();
+ }
+ else {
+ FatalError("IExtensionInit: AddExtensions failed\n");
}
}
-
diff --git a/xorg-server/Xi/getdctl.c b/xorg-server/Xi/getdctl.c
index 6090b814a..4d66a4dfc 100644
--- a/xorg-server/Xi/getdctl.c
+++ b/xorg-server/Xi/getdctl.c
@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -86,7 +86,7 @@ SProcXGetDeviceControl(ClientPtr client)
static void
CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
- int length)
+ int length)
{
AxisInfoPtr a;
xDeviceResolutionState *r;
@@ -97,25 +97,26 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
r->length = length;
r->num_valuators = v->numAxes;
buf += sizeof(xDeviceResolutionState);
- iptr = (int *)buf;
+ iptr = (int *) buf;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
- *iptr++ = a->resolution;
+ *iptr++ = a->resolution;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
- *iptr++ = a->min_resolution;
+ *iptr++ = a->min_resolution;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
- *iptr++ = a->max_resolution;
+ *iptr++ = a->max_resolution;
if (client->swapped) {
- swaps(&r->control);
- swaps(&r->length);
- swapl(&r->num_valuators);
- iptr = (int *)buf;
- for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
- swapl(iptr);
- }
+ swaps(&r->control);
+ swaps(&r->length);
+ swapl(&r->num_valuators);
+ iptr = (int *) buf;
+ for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
+ swapl(iptr);
+ }
}
}
-static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
+static void
+CopySwapDeviceCore(ClientPtr client, DeviceIntPtr dev, char *buf)
{
xDeviceCoreState *c = (xDeviceCoreState *) buf;
@@ -130,7 +131,8 @@ static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
}
}
-static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
+static void
+CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
{
xDeviceEnableState *e = (xDeviceEnableState *) buf;
@@ -156,7 +158,7 @@ SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
/***********************************************************************
@@ -178,7 +180,7 @@ ProcXGetDeviceControl(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.repType = X_Reply;
rep.RepType = X_GetDeviceControl;
@@ -187,11 +189,11 @@ ProcXGetDeviceControl(ClientPtr client)
switch (stuff->control) {
case DEVICE_RESOLUTION:
- if (!dev->valuator)
- return BadMatch;
- total_length = sizeof(xDeviceResolutionState) +
- (3 * sizeof(int) * dev->valuator->numAxes);
- break;
+ if (!dev->valuator)
+ return BadMatch;
+ total_length = sizeof(xDeviceResolutionState) +
+ (3 * sizeof(int) * dev->valuator->numAxes);
+ break;
case DEVICE_ABS_CALIB:
case DEVICE_ABS_AREA:
return BadMatch;
@@ -202,18 +204,18 @@ ProcXGetDeviceControl(ClientPtr client)
total_length = sizeof(xDeviceEnableState);
break;
default:
- return BadValue;
+ return BadValue;
}
- buf = (char *)malloc(total_length);
+ buf = (char *) malloc(total_length);
if (!buf)
- return BadAlloc;
+ return BadAlloc;
savbuf = buf;
switch (stuff->control) {
case DEVICE_RESOLUTION:
- CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
- break;
+ CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
+ break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
break;
@@ -221,7 +223,7 @@ ProcXGetDeviceControl(ClientPtr client)
CopySwapDeviceEnable(client, dev, buf);
break;
default:
- break;
+ break;
}
rep.length = bytes_to_int32(total_length);
diff --git a/xorg-server/Xi/getprop.c b/xorg-server/Xi/getprop.c
index 11afd3784..b7b9e6b5a 100644
--- a/xorg-server/Xi/getprop.c
+++ b/xorg-server/Xi/getprop.c
@@ -54,8 +54,8 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structs */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structs */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -109,30 +109,29 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if ((others = wOtherInputMasks(pWin)) != 0) {
- for (i = 0; i < EMASKSIZE; i++)
- ClassFromMask(NULL, others->dontPropagateMask[i], i,
- &count, COUNT);
- if (count) {
- rep.count = count;
- buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
- rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
-
- tbuf = buf;
- for (i = 0; i < EMASKSIZE; i++)
- tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i,
- NULL, CREATE);
- }
+ for (i = 0; i < EMASKSIZE; i++)
+ ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
+ if (count) {
+ rep.count = count;
+ buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
+ rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
+
+ tbuf = buf;
+ for (i = 0; i < EMASKSIZE; i++)
+ tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i,
+ NULL, CREATE);
+ }
}
WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep);
if (count) {
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf);
- free(buf);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf);
+ free(buf);
}
return Success;
}
@@ -145,23 +144,23 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
*/
XEventClass
- * ClassFromMask(XEventClass * buf, Mask mask, int maskndx, CARD16 * count,
- int mode)
+ * ClassFromMask(XEventClass * buf, Mask mask, int maskndx, CARD16 *count,
+ int mode)
{
int i, j;
int id = maskndx;
Mask tmask = 0x80000000;
for (i = 0; i < 32; i++, tmask >>= 1)
- if (tmask & mask) {
- for (j = 0; j < ExtEventIndex; j++)
- if (EventInfo[j].mask == tmask) {
- if (mode == COUNT)
- (*count)++;
- else
- *buf++ = (id << 8) | EventInfo[j].type;
- }
- }
+ if (tmask & mask) {
+ for (j = 0; j < ExtEventIndex; j++)
+ if (EventInfo[j].mask == tmask) {
+ if (mode == COUNT)
+ (*count)++;
+ else
+ *buf++ = (id << 8) | EventInfo[j].type;
+ }
+ }
return buf;
}
@@ -174,10 +173,10 @@ XEventClass
void
SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
- xGetDeviceDontPropagateListReply * rep)
+ xGetDeviceDontPropagateListReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->count);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/grabdev.c b/xorg-server/Xi/grabdev.c
index 8fd114e60..c904a9707 100644
--- a/xorg-server/Xi/grabdev.c
+++ b/xorg-server/Xi/grabdev.c
@@ -54,12 +54,12 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
-#include "dixevents.h" /* GrabDevice */
+#include "dixevents.h" /* GrabDevice */
#include "grabdev.h"
@@ -82,9 +82,10 @@ SProcXGrabDevice(ClientPtr client)
swapl(&stuff->time);
swaps(&stuff->event_count);
- if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
- return BadLength;
-
+ if (stuff->length !=
+ bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
+ return BadLength;
+
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return (ProcXGrabDevice(client));
@@ -108,8 +109,9 @@ ProcXGrabDevice(ClientPtr client)
REQUEST(xGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
- if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
- return BadLength;
+ if (stuff->length !=
+ bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
+ return BadLength;
rep.repType = X_Reply;
rep.RepType = X_GrabDevice;
@@ -118,23 +120,22 @@ ProcXGrabDevice(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
if (rc != Success)
- return rc;
+ return rc;
- if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1],
- stuff->event_count, tmp, dev,
- X_GrabDevice)) != Success)
- return rc;
+ if ((rc = CreateMaskFromList(client, (XEventClass *) &stuff[1],
+ stuff->event_count, tmp, dev,
+ X_GrabDevice)) != Success)
+ return rc;
mask.xi = tmp[stuff->deviceid].mask;
rc = GrabDevice(client, dev, stuff->other_devices_mode,
stuff->this_device_mode, stuff->grabWindow,
- stuff->ownerEvents, stuff->time,
- &mask, XI, None, None,
- &rep.status);
+ stuff->ownerEvents, stuff->time,
+ &mask, XI, None, None, &rep.status);
if (rc != Success)
- return rc;
+ return rc;
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
return Success;
@@ -166,34 +167,34 @@ ProcXGrabDevice(ClientPtr client)
int
CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
- struct tmask *mask, DeviceIntPtr dev, int req)
+ struct tmask *mask, DeviceIntPtr dev, int req)
{
int rc, i, j;
int device;
DeviceIntPtr tdev;
for (i = 0; i < EMASKSIZE; i++) {
- mask[i].mask = 0;
- mask[i].dev = NULL;
+ mask[i].mask = 0;
+ mask[i].dev = NULL;
}
for (i = 0; i < count; i++, list++) {
- device = *list >> 8;
- if (device > 255)
- return BadClass;
-
- rc = dixLookupDevice(&tdev, device, client, DixUseAccess);
- if (rc != BadDevice && rc != Success)
- return rc;
- if (rc == BadDevice || (dev != NULL && tdev != dev))
- return BadClass;
-
- for (j = 0; j < ExtEventIndex; j++)
- if (EventInfo[j].type == (*list & 0xff)) {
- mask[device].mask |= EventInfo[j].mask;
- mask[device].dev = (Pointer) tdev;
- break;
- }
+ device = *list >> 8;
+ if (device > 255)
+ return BadClass;
+
+ rc = dixLookupDevice(&tdev, device, client, DixUseAccess);
+ if (rc != BadDevice && rc != Success)
+ return rc;
+ if (rc == BadDevice || (dev != NULL && tdev != dev))
+ return BadClass;
+
+ for (j = 0; j < ExtEventIndex; j++)
+ if (EventInfo[j].type == (*list & 0xff)) {
+ mask[device].mask |= EventInfo[j].mask;
+ mask[device].dev = (Pointer) tdev;
+ break;
+ }
}
return Success;
}
@@ -210,5 +211,5 @@ SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/grabdevb.c b/xorg-server/Xi/grabdevb.c
index dda0da8bb..0f0e975a0 100644
--- a/xorg-server/Xi/grabdevb.c
+++ b/xorg-server/Xi/grabdevb.c
@@ -54,8 +54,8 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
@@ -81,7 +81,7 @@ SProcXGrabDeviceButton(ClientPtr client)
swaps(&stuff->modifiers);
swaps(&stuff->event_count);
REQUEST_FIXED_SIZE(xGrabDeviceButtonReq,
- stuff->event_count * sizeof(CARD32));
+ stuff->event_count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return (ProcXGrabDeviceButton(client));
@@ -108,33 +108,34 @@ ProcXGrabDeviceButton(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
if (stuff->length !=
- bytes_to_int32(sizeof(xGrabDeviceButtonReq)) + stuff->event_count)
- return BadLength;
+ bytes_to_int32(sizeof(xGrabDeviceButtonReq)) + stuff->event_count)
+ return BadLength;
ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess);
if (ret != Success)
- return ret;
+ return ret;
if (stuff->modifier_device != UseXKeyboard) {
- ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
- DixUseAccess);
- if (ret != Success)
- return ret;
- if (mdev->key == NULL)
- return BadMatch;
- } else {
- mdev = PickKeyboard(client);
- ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
- if (ret != Success)
- return ret;
+ ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
+ DixUseAccess);
+ if (ret != Success)
+ return ret;
+ if (mdev->key == NULL)
+ return BadMatch;
+ }
+ else {
+ mdev = PickKeyboard(client);
+ ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
+ if (ret != Success)
+ return ret;
}
- class = (XEventClass *) (&stuff[1]); /* first word of values */
+ class = (XEventClass *) (&stuff[1]); /* first word of values */
if ((ret = CreateMaskFromList(client, class,
- stuff->event_count, tmp, dev,
- X_GrabDeviceButton)) != Success)
- return ret;
+ stuff->event_count, tmp, dev,
+ X_GrabDeviceButton)) != Success)
+ return ret;
memset(&param, 0, sizeof(param));
param.grabtype = XI;
@@ -145,8 +146,7 @@ ProcXGrabDeviceButton(ClientPtr client)
param.modifiers = stuff->modifiers;
mask.xi = tmp[stuff->grabbed_device].mask;
- ret = GrabButton(client, dev, mdev, stuff->button, &param,
- XI, &mask);
+ ret = GrabButton(client, dev, mdev, stuff->button, &param, XI, &mask);
return ret;
}
diff --git a/xorg-server/Xi/grabdevk.c b/xorg-server/Xi/grabdevk.c
index 61ab43a20..b75518211 100644
--- a/xorg-server/Xi/grabdevk.c
+++ b/xorg-server/Xi/grabdevk.c
@@ -54,8 +54,8 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
@@ -105,34 +105,35 @@ ProcXGrabDeviceKey(ClientPtr client)
REQUEST(xGrabDeviceKeyReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
- if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count)
- return BadLength;
+ if (stuff->length !=
+ bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count)
+ return BadLength;
ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess);
if (ret != Success)
- return ret;
+ return ret;
if (stuff->modifier_device != UseXKeyboard) {
- ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
- DixUseAccess);
- if (ret != Success)
- return ret;
- if (mdev->key == NULL)
- return BadMatch;
- } else {
- mdev = PickKeyboard(client);
- ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
- if (ret != Success)
- return ret;
+ ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
+ DixUseAccess);
+ if (ret != Success)
+ return ret;
+ if (mdev->key == NULL)
+ return BadMatch;
+ }
+ else {
+ mdev = PickKeyboard(client);
+ ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
+ if (ret != Success)
+ return ret;
}
- class = (XEventClass *) (&stuff[1]); /* first word of values */
+ class = (XEventClass *) (&stuff[1]); /* first word of values */
if ((ret = CreateMaskFromList(client, class,
- stuff->event_count, tmp, dev,
- X_GrabDeviceKey)) != Success)
- return ret;
-
+ stuff->event_count, tmp, dev,
+ X_GrabDeviceKey)) != Success)
+ return ret;
memset(&param, 0, sizeof(param));
param.grabtype = XI;
diff --git a/xorg-server/Xi/listdev.c b/xorg-server/Xi/listdev.c
index 1b3081d96..a02112f32 100644
--- a/xorg-server/Xi/listdev.c
+++ b/xorg-server/Xi/listdev.c
@@ -54,9 +54,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
@@ -68,7 +68,6 @@ SOFTWARE.
#include "listdev.h"
-
/***********************************************************************
*
* This procedure lists the input devices available to the server.
@@ -97,15 +96,15 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
*namesize += 1;
if (d->name)
- *namesize += strlen(d->name);
+ *namesize += strlen(d->name);
if (d->key != NULL)
- *size += sizeof(xKeyInfo);
+ *size += sizeof(xKeyInfo);
if (d->button != NULL)
- *size += sizeof(xButtonInfo);
+ *size += sizeof(xButtonInfo);
if (d->valuator != NULL) {
- chunks = ((int)d->valuator->numAxes + 19) / VPC;
- *size += (chunks * sizeof(xValuatorInfo) +
- d->valuator->numAxes * sizeof(xAxisInfo));
+ chunks = ((int) d->valuator->numAxes + 19) / VPC;
+ *size += (chunks * sizeof(xValuatorInfo) +
+ d->valuator->numAxes * sizeof(xAxisInfo));
}
}
@@ -122,15 +121,16 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
static void
CopyDeviceName(char **namebuf, char *name)
{
- char *nameptr = (char *)*namebuf;
+ char *nameptr = (char *) *namebuf;
if (name) {
- *nameptr++ = strlen(name);
- strcpy(nameptr, name);
- *namebuf += (strlen(name) + 1);
- } else {
- *nameptr++ = 0;
- *namebuf += 1;
+ *nameptr++ = strlen(name);
+ strcpy(nameptr, name);
+ *namebuf += (strlen(name) + 1);
+ }
+ else {
+ *nameptr++ = 0;
+ *namebuf += 1;
}
}
@@ -150,7 +150,7 @@ CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf)
b2->length = sizeof(xButtonInfo);
b2->num_buttons = b->numButtons;
if (client && client->swapped) {
- swaps(&b2->num_buttons);
+ swaps(&b2->num_buttons);
}
*buf += sizeof(xButtonInfo);
}
@@ -162,8 +162,7 @@ CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf)
*/
static void
-CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes,
- char **buf)
+CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, char **buf)
{
xDeviceInfoPtr dev;
@@ -173,18 +172,18 @@ CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes,
dev->type = d->xinput_type;
dev->num_classes = num_classes;
if (IsMaster(d) && IsKeyboardDevice(d))
- dev->use = IsXKeyboard;
+ dev->use = IsXKeyboard;
else if (IsMaster(d) && IsPointerDevice(d))
- dev->use = IsXPointer;
+ dev->use = IsXPointer;
else if (d->valuator && d->button)
dev->use = IsXExtensionPointer;
else if (d->key && d->kbdfeed)
dev->use = IsXExtensionKeyboard;
else
- dev->use = IsXExtensionDevice;
+ dev->use = IsXExtensionDevice;
if (client->swapped) {
- swapl(&dev->type);
+ swapl(&dev->type);
}
*buf += sizeof(xDeviceInfo);
}
@@ -207,7 +206,7 @@ CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf)
k2->max_keycode = k->xkbInfo->desc->max_key_code;
k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
if (client && client->swapped) {
- swaps(&k2->num_keys);
+ swaps(&k2->num_keys);
}
*buf += sizeof(xKeyInfo);
}
@@ -234,54 +233,53 @@ CopySwapValuatorClass(ClientPtr client, DeviceIntPtr dev, char **buf)
xAxisInfoPtr a2;
for (i = 0, axes = v->numAxes; i < ((v->numAxes + 19) / VPC);
- i++, axes -= VPC) {
- t_axes = axes < VPC ? axes : VPC;
- if (t_axes < 0)
- t_axes = v->numAxes % VPC;
- v2 = (xValuatorInfoPtr) * buf;
- v2->class = ValuatorClass;
- v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo);
- v2->num_axes = t_axes;
- v2->mode = valuator_get_mode(dev, 0);
- v2->motion_buffer_size = v->numMotionEvents;
- if (client && client->swapped) {
- swapl(&v2->motion_buffer_size);
- }
- *buf += sizeof(xValuatorInfo);
- a = v->axes + (VPC * i);
- a2 = (xAxisInfoPtr) * buf;
- for (j = 0; j < t_axes; j++) {
- a2->min_value = a->min_value;
- a2->max_value = a->max_value;
- a2->resolution = a->resolution;
- if (client && client->swapped) {
- swapl(&a2->min_value);
- swapl(&a2->max_value);
- swapl(&a2->resolution);
- }
- a2++;
- a++;
- *buf += sizeof(xAxisInfo);
- }
+ i++, axes -= VPC) {
+ t_axes = axes < VPC ? axes : VPC;
+ if (t_axes < 0)
+ t_axes = v->numAxes % VPC;
+ v2 = (xValuatorInfoPtr) * buf;
+ v2->class = ValuatorClass;
+ v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo);
+ v2->num_axes = t_axes;
+ v2->mode = valuator_get_mode(dev, 0);
+ v2->motion_buffer_size = v->numMotionEvents;
+ if (client && client->swapped) {
+ swapl(&v2->motion_buffer_size);
+ }
+ *buf += sizeof(xValuatorInfo);
+ a = v->axes + (VPC * i);
+ a2 = (xAxisInfoPtr) * buf;
+ for (j = 0; j < t_axes; j++) {
+ a2->min_value = a->min_value;
+ a2->max_value = a->max_value;
+ a2->resolution = a->resolution;
+ if (client && client->swapped) {
+ swapl(&a2->min_value);
+ swapl(&a2->max_value);
+ swapl(&a2->resolution);
+ }
+ a2++;
+ a++;
+ *buf += sizeof(xAxisInfo);
+ }
}
return i;
}
static void
CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
- char** classbuf)
+ char **classbuf)
{
if (dev->key != NULL) {
- CopySwapKeyClass(client, dev->key, classbuf);
- (*num_classes)++;
+ CopySwapKeyClass(client, dev->key, classbuf);
+ (*num_classes)++;
}
if (dev->button != NULL) {
- CopySwapButtonClass(client, dev->button, classbuf);
- (*num_classes)++;
+ CopySwapButtonClass(client, dev->button, classbuf);
+ (*num_classes)++;
}
if (dev->valuator != NULL) {
- (*num_classes) +=
- CopySwapValuatorClass(client, dev, classbuf);
+ (*num_classes) += CopySwapValuatorClass(client, dev, classbuf);
}
}
@@ -293,7 +291,7 @@ CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
static void
ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
- char **devbuf, char **classbuf, char **namebuf)
+ char **devbuf, char **classbuf, char **namebuf)
{
CopyDeviceName(namebuf, d->name);
CopySwapDevice(client, d, 0, devbuf);
@@ -310,16 +308,15 @@ static Bool
ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
{
/* don't send master devices other than VCP/VCK */
- if (!IsMaster(d) || d == inputInfo.pointer || d == inputInfo.keyboard)
- {
+ if (!IsMaster(d) || d == inputInfo.pointer ||d == inputInfo.keyboard) {
int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
+
if (rc == Success)
return FALSE;
}
return TRUE;
}
-
/***********************************************************************
*
* This procedure lists the input devices available to the server.
@@ -335,7 +332,7 @@ ProcXListInputDevices(ClientPtr client)
{
xListInputDevicesReply rep;
int numdevs = 0;
- int namesize = 1; /* need 1 extra byte for strcpy */
+ int namesize = 1; /* need 1 extra byte for strcpy */
int i = 0, size = 0;
int total_length;
char *devbuf, *classbuf, *namebuf, *savbuf;
@@ -378,7 +375,7 @@ ProcXListInputDevices(ClientPtr client)
/* allocate space for reply */
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
- devbuf = (char *)calloc(1, total_length);
+ devbuf = (char *) calloc(1, total_length);
classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
namebuf = classbuf + size;
savbuf = devbuf;
@@ -420,5 +417,5 @@ SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/opendev.c b/xorg-server/Xi/opendev.c
index c91bebbcf..27a959d85 100644
--- a/xorg-server/Xi/opendev.c
+++ b/xorg-server/Xi/opendev.c
@@ -54,11 +54,11 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
-#include "windowstr.h" /* window structure */
+#include "windowstr.h" /* window structure */
#include "exglobals.h"
#include "exevents.h"
@@ -102,52 +102,53 @@ ProcXOpenDevice(ClientPtr client)
status = dixLookupDevice(&dev, stuff->deviceid, client, DixUseAccess);
if (status == BadDevice) { /* not open */
- for (dev = inputInfo.off_devices; dev; dev = dev->next)
- if (dev->id == stuff->deviceid)
- break;
- if (dev == NULL)
- return BadDevice;
- } else if (status != Success)
- return status;
+ for (dev = inputInfo.off_devices; dev; dev = dev->next)
+ if (dev->id == stuff->deviceid)
+ break;
+ if (dev == NULL)
+ return BadDevice;
+ }
+ else if (status != Success)
+ return status;
if (IsMaster(dev))
- return BadDevice;
+ return BadDevice;
memset(&rep, 0, sizeof(xOpenDeviceReply));
rep.repType = X_Reply;
rep.RepType = X_OpenDevice;
rep.sequenceNumber = client->sequence;
if (dev->key != NULL) {
- evbase[j].class = KeyClass;
- evbase[j++].event_type_base = event_base[KeyClass];
+ evbase[j].class = KeyClass;
+ evbase[j++].event_type_base = event_base[KeyClass];
}
if (dev->button != NULL) {
- evbase[j].class = ButtonClass;
- evbase[j++].event_type_base = event_base[ButtonClass];
+ evbase[j].class = ButtonClass;
+ evbase[j++].event_type_base = event_base[ButtonClass];
}
if (dev->valuator != NULL) {
- evbase[j].class = ValuatorClass;
- evbase[j++].event_type_base = event_base[ValuatorClass];
+ evbase[j].class = ValuatorClass;
+ evbase[j++].event_type_base = event_base[ValuatorClass];
}
if (dev->kbdfeed != NULL || dev->ptrfeed != NULL || dev->leds != NULL ||
- dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL) {
- evbase[j].class = FeedbackClass;
- evbase[j++].event_type_base = event_base[FeedbackClass];
+ dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL) {
+ evbase[j].class = FeedbackClass;
+ evbase[j++].event_type_base = event_base[FeedbackClass];
}
if (dev->focus != NULL) {
- evbase[j].class = FocusClass;
- evbase[j++].event_type_base = event_base[FocusClass];
+ evbase[j].class = FocusClass;
+ evbase[j++].event_type_base = event_base[FocusClass];
}
if (dev->proximity != NULL) {
- evbase[j].class = ProximityClass;
- evbase[j++].event_type_base = event_base[ProximityClass];
+ evbase[j].class = ProximityClass;
+ evbase[j++].event_type_base = event_base[ProximityClass];
}
evbase[j].class = OtherClass;
evbase[j++].event_type_base = event_base[OtherClass];
rep.length = bytes_to_int32(j * sizeof(xInputClassInfo));
rep.num_classes = j;
WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
- WriteToClient(client, j * sizeof(xInputClassInfo), (char *)evbase);
+ WriteToClient(client, j * sizeof(xInputClassInfo), (char *) evbase);
return Success;
}
@@ -163,5 +164,5 @@ SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/queryst.c b/xorg-server/Xi/queryst.c
index 8c3bdcf97..ffb6de04a 100644
--- a/xorg-server/Xi/queryst.c
+++ b/xorg-server/Xi/queryst.c
@@ -36,8 +36,8 @@ from The Open Group.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
@@ -94,79 +94,80 @@ ProcXQueryDeviceState(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
if (rc != Success && rc != BadAccess)
- return rc;
+ return rc;
v = dev->valuator;
if (v != NULL && v->motionHintWindow != NULL)
- MaybeStopDeviceHint(dev, client);
+ MaybeStopDeviceHint(dev, client);
k = dev->key;
if (k != NULL) {
- total_length += sizeof(xKeyState);
- num_classes++;
+ total_length += sizeof(xKeyState);
+ num_classes++;
}
b = dev->button;
if (b != NULL) {
- total_length += sizeof(xButtonState);
- num_classes++;
+ total_length += sizeof(xButtonState);
+ num_classes++;
}
if (v != NULL) {
- total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int)));
- num_classes++;
+ total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int)));
+ num_classes++;
}
- buf = (char *)calloc(total_length, 1);
+ buf = (char *) calloc(total_length, 1);
if (!buf)
- return BadAlloc;
+ return BadAlloc;
savbuf = buf;
if (k != NULL) {
- tk = (xKeyState *) buf;
- tk->class = KeyClass;
- tk->length = sizeof(xKeyState);
- tk->num_keys = k->xkbInfo->desc->max_key_code -
- k->xkbInfo->desc->min_key_code + 1;
- if (rc != BadAccess)
- for (i = 0; i < 32; i++)
- tk->keys[i] = k->down[i];
- buf += sizeof(xKeyState);
+ tk = (xKeyState *) buf;
+ tk->class = KeyClass;
+ tk->length = sizeof(xKeyState);
+ tk->num_keys = k->xkbInfo->desc->max_key_code -
+ k->xkbInfo->desc->min_key_code + 1;
+ if (rc != BadAccess)
+ for (i = 0; i < 32; i++)
+ tk->keys[i] = k->down[i];
+ buf += sizeof(xKeyState);
}
if (b != NULL) {
- tb = (xButtonState *) buf;
- tb->class = ButtonClass;
- tb->length = sizeof(xButtonState);
- tb->num_buttons = b->numButtons;
- if (rc != BadAccess)
- memcpy(tb->buttons, b->down, sizeof(b->down));
- buf += sizeof(xButtonState);
+ tb = (xButtonState *) buf;
+ tb->class = ButtonClass;
+ tb->length = sizeof(xButtonState);
+ tb->num_buttons = b->numButtons;
+ if (rc != BadAccess)
+ memcpy(tb->buttons, b->down, sizeof(b->down));
+ buf += sizeof(xButtonState);
}
if (v != NULL) {
- tv = (xValuatorState *) buf;
- tv->class = ValuatorClass;
- tv->length = sizeof(xValuatorState) + v->numAxes * 4;
- tv->num_valuators = v->numAxes;
- tv->mode = valuator_get_mode(dev, 0);
- tv->mode |= (dev->proximity && !dev->proximity->in_proximity) ? OutOfProximity : 0;
- buf += sizeof(xValuatorState);
- for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
- if (rc != BadAccess)
- *((int *)buf) = *values;
- values++;
- if (client->swapped) {
- swapl((int *)buf);
- }
- buf += sizeof(int);
- }
+ tv = (xValuatorState *) buf;
+ tv->class = ValuatorClass;
+ tv->length = sizeof(xValuatorState) + v->numAxes * 4;
+ tv->num_valuators = v->numAxes;
+ tv->mode = valuator_get_mode(dev, 0);
+ tv->mode |= (dev->proximity &&
+ !dev->proximity->in_proximity) ? OutOfProximity : 0;
+ buf += sizeof(xValuatorState);
+ for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
+ if (rc != BadAccess)
+ *((int *) buf) = *values;
+ values++;
+ if (client->swapped) {
+ swapl((int *) buf);
+ }
+ buf += sizeof(int);
+ }
}
rep.num_classes = num_classes;
rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0)
- WriteToClient(client, total_length, savbuf);
+ WriteToClient(client, total_length, savbuf);
free(savbuf);
return Success;
}
@@ -183,5 +184,5 @@ SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/selectev.c b/xorg-server/Xi/selectev.c
index 4c2c2fe05..284bd29e5 100644
--- a/xorg-server/Xi/selectev.c
+++ b/xorg-server/Xi/selectev.c
@@ -50,13 +50,12 @@ SOFTWARE.
*
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2.h>
#include <X11/extensions/XIproto.h>
@@ -70,7 +69,7 @@ extern Mask ExtExclusiveMasks[];
static int
HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
- XEventClass *cls, CARD16 *count)
+ XEventClass * cls, CARD16 *count)
{
int i, j;
Mask mask;
@@ -106,7 +105,7 @@ HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
/* We always only use mksidx = AllDevices for events not bound to
* devices */
- if (AddExtensionClient (win, client, mask, XIAllDevices) != Success)
+ if (AddExtensionClient(win, client, mask, XIAllDevices) != Success)
return BadAlloc;
RecalculateDeviceDeliverableEvents(win);
@@ -128,8 +127,7 @@ SProcXSelectExtensionEvent(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
swapl(&stuff->window);
swaps(&stuff->count);
- REQUEST_FIXED_SIZE(xSelectExtensionEventReq,
- stuff->count * sizeof(CARD32));
+ REQUEST_FIXED_SIZE(xSelectExtensionEventReq, stuff->count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
return (ProcXSelectExtensionEvent(client));
@@ -152,33 +150,34 @@ ProcXSelectExtensionEvent(ClientPtr client)
REQUEST(xSelectExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
- if (stuff->length != bytes_to_int32(sizeof(xSelectExtensionEventReq)) + stuff->count)
- return BadLength;
+ if (stuff->length !=
+ bytes_to_int32(sizeof(xSelectExtensionEventReq)) + stuff->count)
+ return BadLength;
ret = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
if (ret != Success)
- return ret;
+ return ret;
- if (HandleDevicePresenceMask(client, pWin, (XEventClass *) & stuff[1],
- &stuff->count) != Success)
- return BadAlloc;
+ if (HandleDevicePresenceMask(client, pWin, (XEventClass *) &stuff[1],
+ &stuff->count) != Success)
+ return BadAlloc;
- if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1],
- stuff->count, tmp, NULL,
- X_SelectExtensionEvent)) != Success)
- return ret;
+ if ((ret = CreateMaskFromList(client, (XEventClass *) &stuff[1],
+ stuff->count, tmp, NULL,
+ X_SelectExtensionEvent)) != Success)
+ return ret;
for (i = 0; i < EMASKSIZE; i++)
- if (tmp[i].dev != NULL) {
+ if (tmp[i].dev != NULL) {
if (tmp[i].mask & ~XIAllMasks) {
client->errorValue = tmp[i].mask;
return BadValue;
}
- if ((ret =
- SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client,
- tmp[i].mask, ExtExclusiveMasks[i]))!= Success)
- return ret;
- }
+ if ((ret =
+ SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client,
+ tmp[i].mask, ExtExclusiveMasks[i])) != Success)
+ return ret;
+ }
return Success;
}
diff --git a/xorg-server/Xi/sendexev.c b/xorg-server/Xi/sendexev.c
index 4770c28d1..3c213864b 100644
--- a/xorg-server/Xi/sendexev.c
+++ b/xorg-server/Xi/sendexev.c
@@ -54,9 +54,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* Window */
-#include "extnsionst.h" /* EventSwapPtr */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* Window */
+#include "extnsionst.h" /* EventSwapPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
@@ -65,7 +65,7 @@ SOFTWARE.
#include "grabdev.h"
#include "sendexev.h"
-extern int lastEvent; /* Defined in extension.c */
+extern int lastEvent; /* Defined in extension.c */
/***********************************************************************
*
@@ -88,20 +88,21 @@ SProcXSendExtensionEvent(ClientPtr client)
swapl(&stuff->destination);
swaps(&stuff->count);
- if (stuff->length != bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
- bytes_to_int32(stuff->num_events * sizeof(xEvent)))
- return BadLength;
+ if (stuff->length !=
+ bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
+ bytes_to_int32(stuff->num_events * sizeof(xEvent)))
+ return BadLength;
- eventP = (xEvent *) & stuff[1];
+ eventP = (xEvent *) &stuff[1];
for (i = 0; i < stuff->num_events; i++, eventP++) {
- proc = EventSwapVector[eventP->u.u.type & 0177];
- if (proc == NotImplemented) /* no swapping proc; invalid event type? */
- return BadValue;
- (*proc) (eventP, &eventT);
- *eventP = eventT;
+ proc = EventSwapVector[eventP->u.u.type & 0177];
+ if (proc == NotImplemented) /* no swapping proc; invalid event type? */
+ return BadValue;
+ (*proc) (eventP, &eventT);
+ *eventP = eventT;
}
- p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events);
+ p = (CARD32 *) (((xEvent *) &stuff[1]) + stuff->num_events);
SwapLongs(p, stuff->count);
return (ProcXSendExtensionEvent(client));
}
@@ -125,31 +126,32 @@ ProcXSendExtensionEvent(ClientPtr client)
REQUEST(xSendExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
- if (stuff->length != bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
- (stuff->num_events * bytes_to_int32(sizeof(xEvent))))
- return BadLength;
+ if (stuff->length !=
+ bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
+ (stuff->num_events * bytes_to_int32(sizeof(xEvent))))
+ return BadLength;
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess);
if (ret != Success)
- return ret;
+ return ret;
/* The client's event type must be one defined by an extension. */
- first = ((xEvent *) & stuff[1]);
+ first = ((xEvent *) &stuff[1]);
if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
- (first->u.u.type < lastEvent))) {
- client->errorValue = first->u.u.type;
- return BadValue;
+ (first->u.u.type < lastEvent))) {
+ client->errorValue = first->u.u.type;
+ return BadValue;
}
list = (XEventClass *) (first + stuff->num_events);
if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,
- X_SendExtensionEvent)) != Success)
- return ret;
+ X_SendExtensionEvent)) != Success)
+ return ret;
ret = (SendEvent(client, dev, stuff->destination,
- stuff->propagate, (xEvent *) & stuff[1],
- tmp[stuff->deviceid].mask, stuff->num_events));
+ stuff->propagate, (xEvent *) &stuff[1],
+ tmp[stuff->deviceid].mask, stuff->num_events));
return ret;
}
diff --git a/xorg-server/Xi/setbmap.c b/xorg-server/Xi/setbmap.c
index 2a8f5d3b7..110f5e91e 100644
--- a/xorg-server/Xi/setbmap.c
+++ b/xorg-server/Xi/setbmap.c
@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
@@ -94,7 +94,7 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
if (stuff->length !=
bytes_to_int32(sizeof(xSetDeviceButtonMappingReq) + stuff->map_length))
- return BadLength;
+ return BadLength;
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (ret != Success)
@@ -106,7 +106,9 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.status = MappingSuccess;
- ret = ApplyPointerMapping(dev, (CARD8 *) &stuff[1], stuff->map_length, client);
+ ret =
+ ApplyPointerMapping(dev, (CARD8 *) &stuff[1], stuff->map_length,
+ client);
if (ret == -1)
return BadValue;
else if (ret == MappingBusy)
@@ -128,9 +130,9 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
void
SRepXSetDeviceButtonMapping(ClientPtr client, int size,
- xSetDeviceButtonMappingReply * rep)
+ xSetDeviceButtonMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/setmode.c b/xorg-server/Xi/setmode.c
index 80ee764b0..a7bf1eaff 100644
--- a/xorg-server/Xi/setmode.c
+++ b/xorg-server/Xi/setmode.c
@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
@@ -99,27 +99,26 @@ ProcXSetDeviceMode(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (dev->valuator == NULL)
- return BadMatch;
+ return BadMatch;
if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client))
- rep.status = AlreadyGrabbed;
+ rep.status = AlreadyGrabbed;
else
- rep.status = SetDeviceMode(client, dev, stuff->mode);
+ rep.status = SetDeviceMode(client, dev, stuff->mode);
if (rep.status == Success)
valuator_set_mode(dev, VALUATOR_MODE_ALL_AXES, stuff->mode);
- else if (rep.status != AlreadyGrabbed)
- {
- switch(rep.status) {
- case BadMatch:
- case BadImplementation:
- case BadAlloc:
- break;
- default:
- rep.status = BadMode;
- }
- return rep.status;
+ else if (rep.status != AlreadyGrabbed) {
+ switch (rep.status) {
+ case BadMatch:
+ case BadImplementation:
+ case BadAlloc:
+ break;
+ default:
+ rep.status = BadMode;
+ }
+ return rep.status;
}
WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
@@ -138,5 +137,5 @@ SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/stubs.c b/xorg-server/Xi/stubs.c
index 6a4c18158..8baa5a09b 100644
--- a/xorg-server/Xi/stubs.c
+++ b/xorg-server/Xi/stubs.c
@@ -98,7 +98,7 @@ SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
int
SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
- int *valuators, int first_valuator, int num_valuators)
+ int *valuators, int first_valuator, int num_valuators)
{
return BadMatch;
}
@@ -112,13 +112,11 @@ SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
*/
int
-ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
- xDeviceCtl * control)
+ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control)
{
return BadMatch;
}
-
/****************************************************************************
*
* Caller: configAddDevice (and others)
@@ -127,7 +125,7 @@ ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
*
*/
int
-NewInputDeviceRequest(InputOption *options, InputAttributes *attrs,
+NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
DeviceIntPtr *pdev)
{
return BadValue;
diff --git a/xorg-server/Xi/ungrdevb.c b/xorg-server/Xi/ungrdevb.c
index 0ba395cf3..c4632fadc 100644
--- a/xorg-server/Xi/ungrdevb.c
+++ b/xorg-server/Xi/ungrdevb.c
@@ -54,8 +54,8 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -104,27 +104,28 @@ ProcXUngrabDeviceButton(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess);
if (rc != Success)
- return rc;
+ return rc;
if (dev->button == NULL)
- return BadMatch;
+ return BadMatch;
if (stuff->modifier_device != UseXKeyboard) {
- rc = dixLookupDevice(&mdev, stuff->modifier_device, client,
- DixReadAccess);
- if (rc != Success)
- return BadDevice;
- if (mdev->key == NULL)
- return BadMatch;
- } else
- mdev = PickKeyboard(client);
+ rc = dixLookupDevice(&mdev, stuff->modifier_device, client,
+ DixReadAccess);
+ if (rc != Success)
+ return BadDevice;
+ if (mdev->key == NULL)
+ return BadMatch;
+ }
+ else
+ mdev = PickKeyboard(client);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if ((stuff->modifiers != AnyModifier) &&
- (stuff->modifiers & ~AllModifiersMask))
- return BadValue;
+ (stuff->modifiers & ~AllModifiersMask))
+ return BadValue;
temporaryGrab = AllocGrab();
if (!temporaryGrab)
diff --git a/xorg-server/Xi/ungrdevk.c b/xorg-server/Xi/ungrdevk.c
index 8785989b0..3273878d3 100644
--- a/xorg-server/Xi/ungrdevk.c
+++ b/xorg-server/Xi/ungrdevk.c
@@ -54,8 +54,8 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -106,32 +106,33 @@ ProcXUngrabDeviceKey(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess);
if (rc != Success)
- return rc;
+ return rc;
if (dev->key == NULL)
- return BadMatch;
+ return BadMatch;
if (stuff->modifier_device != UseXKeyboard) {
- rc = dixLookupDevice(&mdev, stuff->modifier_device, client,
- DixReadAccess);
- if (rc != Success)
- return BadDevice;
- if (mdev->key == NULL)
- return BadMatch;
- } else
- mdev = PickKeyboard(client);
+ rc = dixLookupDevice(&mdev, stuff->modifier_device, client,
+ DixReadAccess);
+ if (rc != Success)
+ return BadDevice;
+ if (mdev->key == NULL)
+ return BadMatch;
+ }
+ else
+ mdev = PickKeyboard(client);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (((stuff->key > dev->key->xkbInfo->desc->max_key_code) ||
- (stuff->key < dev->key->xkbInfo->desc->min_key_code))
- && (stuff->key != AnyKey))
- return BadValue;
+ (stuff->key < dev->key->xkbInfo->desc->min_key_code))
+ && (stuff->key != AnyKey))
+ return BadValue;
if ((stuff->modifiers != AnyModifier) &&
- (stuff->modifiers & ~AllModifiersMask))
- return BadValue;
+ (stuff->modifiers & ~AllModifiersMask))
+ return BadValue;
temporaryGrab = AllocGrab();
if (!temporaryGrab)
diff --git a/xorg-server/Xi/xiallowev.c b/xorg-server/Xi/xiallowev.c
index d0856b656..62a0727b0 100644
--- a/xorg-server/Xi/xiallowev.c
+++ b/xorg-server/Xi/xiallowev.c
@@ -33,14 +33,14 @@
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include "mi.h"
#include "eventstr.h"
#include <X11/extensions/XI2.h>
#include <X11/extensions/XI2proto.h>
-#include "exglobals.h" /* BadDevice */
+#include "exglobals.h" /* BadDevice */
#include "exevents.h"
#include "xiallowev.h"
@@ -52,9 +52,9 @@ SProcXIAllowEvents(ClientPtr client)
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->time);
- if (stuff->length > 3)
- {
- xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq*)stuff;
+ if (stuff->length > 3) {
+ xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq *) stuff;
+
swapl(&req_xi22->touchid);
swapl(&req_xi22->grab_window);
}
@@ -70,70 +70,69 @@ ProcXIAllowEvents(ClientPtr client)
int ret = Success;
XIClientPtr xi_client;
Bool have_xi22 = FALSE;
+
REQUEST(xXI2_2AllowEventsReq);
xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
if (version_compare(xi_client->major_version,
- xi_client->minor_version, 2, 2) >= 0)
- {
+ xi_client->minor_version, 2, 2) >= 0) {
REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq);
have_xi22 = TRUE;
- } else
- {
+ }
+ else {
REQUEST_SIZE_MATCH(xXIAllowEventsReq);
}
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (ret != Success)
- return ret;
+ return ret;
time = ClientTimeToServerTime(stuff->time);
switch (stuff->mode) {
case XIReplayDevice:
- AllowSome(client, time, dev, NOT_GRABBED);
- break;
+ AllowSome(client, time, dev, NOT_GRABBED);
+ break;
case XISyncDevice:
- AllowSome(client, time, dev, FREEZE_NEXT_EVENT);
- break;
+ AllowSome(client, time, dev, FREEZE_NEXT_EVENT);
+ break;
case XIAsyncDevice:
- AllowSome(client, time, dev, THAWED);
- break;
+ AllowSome(client, time, dev, THAWED);
+ break;
case XIAsyncPairedDevice:
if (IsMaster(dev))
AllowSome(client, time, dev, THAW_OTHERS);
- break;
+ break;
case XISyncPair:
if (IsMaster(dev))
AllowSome(client, time, dev, FREEZE_BOTH_NEXT_EVENT);
- break;
+ break;
case XIAsyncPair:
if (IsMaster(dev))
AllowSome(client, time, dev, THAWED_BOTH);
- break;
+ break;
case XIRejectTouch:
case XIAcceptTouch:
- {
- int rc;
- WindowPtr win;
+ {
+ int rc;
+ WindowPtr win;
- if (!have_xi22)
- return BadValue;
+ if (!have_xi22)
+ return BadValue;
- rc = dixLookupWindow(&win, stuff->grab_window, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupWindow(&win, stuff->grab_window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
- ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid,
- stuff->grab_window, &client->errorValue);
- }
+ ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid,
+ stuff->grab_window, &client->errorValue);
+ }
break;
default:
- client->errorValue = stuff->mode;
- ret = BadValue;
+ client->errorValue = stuff->mode;
+ ret = BadValue;
}
return ret;
}
-
diff --git a/xorg-server/Xi/xichangecursor.c b/xorg-server/Xi/xichangecursor.c
index 48f51f3b5..0be6bc0d4 100644
--- a/xorg-server/Xi/xichangecursor.c
+++ b/xorg-server/Xi/xichangecursor.c
@@ -33,11 +33,11 @@
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
-#include "scrnintstr.h" /* screen structure */
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2proto.h>
#include "extnsionst.h"
@@ -65,10 +65,11 @@ SProcXIChangeCursor(ClientPtr client)
return (ProcXIChangeCursor(client));
}
-int ProcXIChangeCursor(ClientPtr client)
+int
+ProcXIChangeCursor(ClientPtr client)
{
int rc;
- WindowPtr pWin = NULL;
+ WindowPtr pWin = NULL;
DeviceIntPtr pDev = NULL;
CursorPtr pCursor = NULL;
@@ -82,30 +83,26 @@ int ProcXIChangeCursor(ClientPtr client)
if (!IsMaster(pDev) || !IsPointerDevice(pDev))
return BadDevice;
- if (stuff->win != None)
- {
+ if (stuff->win != None) {
rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
if (rc != Success)
return rc;
}
- if (stuff->cursor == None)
- {
+ if (stuff->cursor == None) {
if (pWin == pWin->drawable.pScreen->root)
pCursor = rootCursor;
else
- pCursor = (CursorPtr)None;
+ pCursor = (CursorPtr) None;
}
- else
- {
- rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor,
- RT_CURSOR, client, DixUseAccess);
- if (rc != Success)
- return rc;
+ else {
+ rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor,
+ RT_CURSOR, client, DixUseAccess);
+ if (rc != Success)
+ return rc;
}
ChangeWindowDeviceCursor(pWin, pDev, pCursor);
return Success;
}
-
diff --git a/xorg-server/Xi/xichangehierarchy.c b/xorg-server/Xi/xichangehierarchy.c
index 503404e64..756aaac06 100644
--- a/xorg-server/Xi/xichangehierarchy.c
+++ b/xorg-server/Xi/xichangehierarchy.c
@@ -30,16 +30,15 @@
*
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
-#include "scrnintstr.h" /* screen structure */
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
@@ -48,7 +47,7 @@
#include "exglobals.h"
#include "geext.h"
#include "xace.h"
-#include "xiquerydevice.h" /* for GetDeviceUse */
+#include "xiquerydevice.h" /* for GetDeviceUse */
#include "xkbsrv.h"
@@ -57,7 +56,8 @@
/**
* Send the current state of the device hierarchy to all clients.
*/
-void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
+void
+XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
{
xXIHierarchyEvent *ev;
xXIHierarchyInfo *info;
@@ -69,7 +69,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
return;
ev = calloc(1, sizeof(xXIHierarchyEvent) +
- MAXDEVICES * sizeof(xXIHierarchyInfo));
+ MAXDEVICES * sizeof(xXIHierarchyInfo));
if (!ev)
return;
ev->type = GenericEvent;
@@ -79,9 +79,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
ev->flags = 0;
ev->num_info = inputInfo.numDevices;
- info = (xXIHierarchyInfo*)&ev[1];
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ info = (xXIHierarchyInfo *) & ev[1];
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
info->deviceid = dev->id;
info->enabled = dev->enabled;
info->use = GetDeviceUse(dev, &info->attachment);
@@ -89,8 +88,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
ev->flags |= info->flags;
info++;
}
- for (dev = inputInfo.off_devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.off_devices; dev; dev = dev->next) {
info->deviceid = dev->id;
info->enabled = dev->enabled;
info->use = GetDeviceUse(dev, &info->attachment);
@@ -99,11 +97,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
info++;
}
-
- for (i = 0; i < MAXDEVICES; i++)
- {
- if (flags[i] & (XIMasterRemoved | XISlaveRemoved))
- {
+ for (i = 0; i < MAXDEVICES; i++) {
+ if (flags[i] & (XIMasterRemoved | XISlaveRemoved)) {
info->deviceid = i;
info->enabled = FALSE;
info->flags = flags[i];
@@ -119,11 +114,11 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
memset(&dummyDev, 0, sizeof(dummyDev));
dummyDev.id = XIAllDevices;
dummyDev.type = SLAVE;
- SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1);
+ SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8),
+ (xEvent *) ev, 1);
free(ev);
}
-
/***********************************************************************
*
* This procedure allows a client to change the device hierarchy through
@@ -131,7 +126,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
*
*/
-int SProcXIChangeHierarchy(ClientPtr client)
+int
+SProcXIChangeHierarchy(ClientPtr client)
{
REQUEST(xXIChangeHierarchyReq);
swaps(&stuff->length);
@@ -139,14 +135,14 @@ int SProcXIChangeHierarchy(ClientPtr client)
}
static int
-add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
+add_master(ClientPtr client, xXIAddMasterInfo * c, int flags[MAXDEVICES])
{
DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
- char* name;
+ char *name;
int rc;
name = calloc(c->name_len + 1, sizeof(char));
- strncpy(name, (char*)&c[1], c->name_len);
+ strncpy(name, (char *) &c[1], c->name_len);
rc = AllocDevicePair(client, name, &ptr, &keybd,
CorePointerProc, CoreKeyboardProc, TRUE);
@@ -154,12 +150,11 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
goto unwind;
if (!c->send_core)
- ptr->coreEvents = keybd->coreEvents = FALSE;
+ ptr->coreEvents = keybd->coreEvents = FALSE;
/* Allocate virtual slave devices for xtest events */
rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd, ptr, keybd);
- if (rc != Success)
- {
+ if (rc != Success) {
DeleteInputDeviceRequest(ptr);
DeleteInputDeviceRequest(keybd);
goto unwind;
@@ -175,8 +170,7 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
flags[XTestptr->id] |= XISlaveAdded;
flags[XTestkeybd->id] |= XISlaveAdded;
- if (c->enable)
- {
+ if (c->enable) {
EnableDevice(ptr, FALSE);
EnableDevice(keybd, FALSE);
flags[ptr->id] |= XIDeviceEnabled;
@@ -195,7 +189,7 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
flags[XTestptr->id] |= XISlaveAttached;
flags[XTestkeybd->id] |= XISlaveAttached;
-unwind:
+ unwind:
free(name);
return rc;
}
@@ -205,44 +199,39 @@ disable_clientpointer(DeviceIntPtr dev)
{
int i;
- for (i = 0; i < currentMaxClients; i++)
- {
+ for (i = 0; i < currentMaxClients; i++) {
ClientPtr client = clients[i];
+
if (client && client->clientPtr == dev)
client->clientPtr = NULL;
}
}
static int
-remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
- int flags[MAXDEVICES])
+remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
{
DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
int rc = Success;
- if (r->return_mode != XIAttachToMaster &&
- r->return_mode != XIFloating)
+ if (r->return_mode != XIAttachToMaster && r->return_mode != XIFloating)
return BadValue;
rc = dixLookupDevice(&ptr, r->deviceid, client, DixDestroyAccess);
if (rc != Success)
goto unwind;
- if (!IsMaster(ptr))
- {
+ if (!IsMaster(ptr)) {
client->errorValue = r->deviceid;
rc = BadDevice;
goto unwind;
}
/* XXX: For now, don't allow removal of VCP, VCK */
- if (ptr == inputInfo.pointer || ptr == inputInfo.keyboard)
- {
+ if (ptr == inputInfo.pointer ||ptr == inputInfo.keyboard) {
rc = BadDevice;
goto unwind;
}
-
ptr = GetMaster(ptr, MASTER_POINTER);
rc = dixLookupDevice(&ptr, ptr->id, client, DixDestroyAccess);
if (rc != Success)
@@ -258,8 +247,7 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
goto unwind;
XTestkeybd = GetXTestDevice(keybd);
- rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client,
- DixDestroyAccess);
+ rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client, DixDestroyAccess);
if (rc != Success)
goto unwind;
@@ -267,18 +255,14 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
/* Disabling sends the devices floating, reattach them if
* desired. */
- if (r->return_mode == XIAttachToMaster)
- {
- DeviceIntPtr attached,
- newptr,
- newkeybd;
+ if (r->return_mode == XIAttachToMaster) {
+ DeviceIntPtr attached, newptr, newkeybd;
rc = dixLookupDevice(&newptr, r->return_pointer, client, DixAddAccess);
if (rc != Success)
goto unwind;
- if (!IsMaster(newptr))
- {
+ if (!IsMaster(newptr)) {
client->errorValue = r->return_pointer;
rc = BadDevice;
goto unwind;
@@ -289,23 +273,19 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
if (rc != Success)
goto unwind;
- if (!IsMaster(newkeybd))
- {
+ if (!IsMaster(newkeybd)) {
client->errorValue = r->return_keyboard;
rc = BadDevice;
goto unwind;
}
- for (attached = inputInfo.devices; attached; attached = attached->next)
- {
+ for (attached = inputInfo.devices; attached; attached = attached->next) {
if (!IsMaster(attached)) {
- if (GetMaster(attached, MASTER_ATTACHED) == ptr)
- {
+ if (GetMaster(attached, MASTER_ATTACHED) == ptr) {
AttachDevice(client, attached, newptr);
flags[attached->id] |= XISlaveAttached;
}
- if (GetMaster(attached, MASTER_ATTACHED) == keybd)
- {
+ if (GetMaster(attached, MASTER_ATTACHED) == keybd) {
AttachDevice(client, attached, newkeybd);
flags[attached->id] |= XISlaveAttached;
}
@@ -339,12 +319,12 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
flags[keybd->id] |= XIMasterRemoved;
flags[ptr->id] |= XIMasterRemoved;
-unwind:
+ unwind:
return rc;
}
static int
-detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES])
+detach_slave(ClientPtr client, xXIDetachSlaveInfo * c, int flags[MAXDEVICES])
{
DeviceIntPtr dev;
int rc;
@@ -353,16 +333,14 @@ detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES])
if (rc != Success)
goto unwind;
- if (IsMaster(dev))
- {
+ if (IsMaster(dev)) {
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
}
/* Don't allow changes to XTest Devices, these are fixed */
- if (IsXTestDevice(dev, NULL))
- {
+ if (IsXTestDevice(dev, NULL)) {
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
@@ -372,13 +350,12 @@ detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES])
AttachDevice(client, dev, NULL);
flags[dev->id] |= XISlaveDetached;
-unwind:
+ unwind:
return rc;
}
static int
-attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
- int flags[MAXDEVICES])
+attach_slave(ClientPtr client, xXIAttachSlaveInfo * c, int flags[MAXDEVICES])
{
DeviceIntPtr dev;
DeviceIntPtr newmaster;
@@ -388,16 +365,14 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
if (rc != Success)
goto unwind;
- if (IsMaster(dev))
- {
+ if (IsMaster(dev)) {
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
}
/* Don't allow changes to XTest Devices, these are fixed */
- if (IsXTestDevice(dev, NULL))
- {
+ if (IsXTestDevice(dev, NULL)) {
client->errorValue = c->deviceid;
rc = BadDevice;
goto unwind;
@@ -406,16 +381,14 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
rc = dixLookupDevice(&newmaster, c->new_master, client, DixAddAccess);
if (rc != Success)
goto unwind;
- if (!IsMaster(newmaster))
- {
+ if (!IsMaster(newmaster)) {
client->errorValue = c->new_master;
rc = BadDevice;
goto unwind;
}
if (!((IsPointerDevice(newmaster) && IsPointerDevice(dev)) ||
- (IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev))))
- {
+ (IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev)))) {
rc = BadDevice;
goto unwind;
}
@@ -424,12 +397,10 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
AttachDevice(client, dev, newmaster);
flags[dev->id] |= XISlaveAttached;
-unwind:
+ unwind:
return rc;
}
-
-
#define SWAPIF(cmd) if (client->swapped) { cmd; }
int
@@ -438,7 +409,7 @@ ProcXIChangeHierarchy(ClientPtr client)
xXIAnyHierarchyChangeInfo *any;
int required_len = sizeof(xXIChangeHierarchyReq);
int rc = Success;
- int flags[MAXDEVICES] = {0};
+ int flags[MAXDEVICES] = { 0 };
REQUEST(xXIChangeHierarchyReq);
REQUEST_AT_LEAST_SIZE(xXIChangeHierarchyReq);
@@ -446,9 +417,8 @@ ProcXIChangeHierarchy(ClientPtr client)
if (!stuff->num_changes)
return rc;
- any = (xXIAnyHierarchyChangeInfo*)&stuff[1];
- while(stuff->num_changes--)
- {
+ any = (xXIAnyHierarchyChangeInfo *) &stuff[1];
+ while (stuff->num_changes--) {
SWAPIF(swaps(&any->type));
SWAPIF(swaps(&any->length));
@@ -456,53 +426,52 @@ ProcXIChangeHierarchy(ClientPtr client)
if ((stuff->length * 4) < required_len)
return BadLength;
- switch(any->type)
+ switch (any->type) {
+ case XIAddMaster:
{
- case XIAddMaster:
- {
- xXIAddMasterInfo* c = (xXIAddMasterInfo*)any;
- SWAPIF(swaps(&c->name_len));
-
- rc = add_master(client, c, flags);
- if (rc != Success)
- goto unwind;
- }
- break;
- case XIRemoveMaster:
- {
- xXIRemoveMasterInfo* r = (xXIRemoveMasterInfo*)any;
-
- rc = remove_master(client, r, flags);
- if (rc != Success)
- goto unwind;
- }
- break;
- case XIDetachSlave:
- {
- xXIDetachSlaveInfo* c = (xXIDetachSlaveInfo*)any;
-
- rc = detach_slave(client, c, flags);
- if (rc != Success)
- goto unwind;
- }
- break;
- case XIAttachSlave:
- {
- xXIAttachSlaveInfo* c = (xXIAttachSlaveInfo*)any;
-
- rc = attach_slave(client, c, flags);
- if (rc != Success)
- goto unwind;
- }
- break;
+ xXIAddMasterInfo *c = (xXIAddMasterInfo *) any;
+
+ SWAPIF(swaps(&c->name_len));
+
+ rc = add_master(client, c, flags);
+ if (rc != Success)
+ goto unwind;
}
+ break;
+ case XIRemoveMaster:
+ {
+ xXIRemoveMasterInfo *r = (xXIRemoveMasterInfo *) any;
+
+ rc = remove_master(client, r, flags);
+ if (rc != Success)
+ goto unwind;
+ }
+ break;
+ case XIDetachSlave:
+ {
+ xXIDetachSlaveInfo *c = (xXIDetachSlaveInfo *) any;
- any = (xXIAnyHierarchyChangeInfo*)((char*)any + any->length * 4);
+ rc = detach_slave(client, c, flags);
+ if (rc != Success)
+ goto unwind;
+ }
+ break;
+ case XIAttachSlave:
+ {
+ xXIAttachSlaveInfo *c = (xXIAttachSlaveInfo *) any;
+
+ rc = attach_slave(client, c, flags);
+ if (rc != Success)
+ goto unwind;
+ }
+ break;
+ }
+
+ any = (xXIAnyHierarchyChangeInfo *) ((char *) any + any->length * 4);
}
-unwind:
+ unwind:
XISendDeviceHierarchyEvent(flags);
return rc;
}
-
diff --git a/xorg-server/Xi/xigetclientpointer.c b/xorg-server/Xi/xigetclientpointer.c
index 1124ae08c..07dbf1800 100644
--- a/xorg-server/Xi/xigetclientpointer.c
+++ b/xorg-server/Xi/xigetclientpointer.c
@@ -27,15 +27,15 @@
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
-#include "scrnintstr.h" /* screen structure */
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2proto.h>
#include "extnsionst.h"
-#include "extinit.h" /* LookupDeviceIntRec */
+#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@@ -56,22 +56,23 @@ SProcXIGetClientPointer(ClientPtr client)
return ProcXIGetClientPointer(client);
}
-int ProcXIGetClientPointer(ClientPtr client)
+int
+ProcXIGetClientPointer(ClientPtr client)
{
int rc;
ClientPtr winclient;
xXIGetClientPointerReply rep;
+
REQUEST(xXIGetClientPointerReq);
REQUEST_SIZE_MATCH(xXIGetClientPointerReq);
- if (stuff->win != None)
- {
- rc = dixLookupClient(&winclient, stuff->win, client,
- DixGetAttrAccess);
+ if (stuff->win != None) {
+ rc = dixLookupClient(&winclient, stuff->win, client, DixGetAttrAccess);
if (rc != Success)
return BadWindow;
- } else
+ }
+ else
winclient = client;
rep.repType = X_Reply;
@@ -94,11 +95,10 @@ int ProcXIGetClientPointer(ClientPtr client)
void
SRepXIGetClientPointer(ClientPtr client, int size,
- xXIGetClientPointerReply* rep)
+ xXIGetClientPointerReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->deviceid);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
-
diff --git a/xorg-server/Xi/xigrabdev.c b/xorg-server/Xi/xigrabdev.c
index 2b3055004..8d2cf0bed 100644
--- a/xorg-server/Xi/xigrabdev.c
+++ b/xorg-server/Xi/xigrabdev.c
@@ -33,12 +33,12 @@
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI2.h>
#include <X11/extensions/XI2proto.h>
-#include "exglobals.h" /* BadDevice */
+#include "exglobals.h" /* BadDevice */
#include "exevents.h"
#include "xigrabdev.h"
#include "inpututils.h"
@@ -73,12 +73,12 @@ ProcXIGrabDevice(ClientPtr client)
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
if (ret != Success)
- return ret;
+ return ret;
if (!IsMaster(dev))
stuff->paired_device_mode = GrabModeAsync;
- if (XICheckInvalidMaskBits(client, (unsigned char*)&stuff[1],
+ if (XICheckInvalidMaskBits(client, (unsigned char *) &stuff[1],
stuff->mask_len * 4) != Success)
return BadValue;
@@ -88,17 +88,15 @@ ProcXIGrabDevice(ClientPtr client)
mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4);
/* FIXME: I think the old code was broken here */
- xi2mask_set_one_mask(mask.xi2mask, dev->id, (unsigned char*)&stuff[1], mask_len);
+ xi2mask_set_one_mask(mask.xi2mask, dev->id, (unsigned char *) &stuff[1],
+ mask_len);
ret = GrabDevice(client, dev, stuff->grab_mode,
stuff->paired_device_mode,
stuff->grab_window,
stuff->owner_events,
stuff->time,
- &mask,
- XI2,
- stuff->cursor,
- None /* confineTo */,
+ &mask, XI2, stuff->cursor, None /* confineTo */ ,
&status);
xi2mask_free(&mask.xi2mask);
@@ -112,7 +110,6 @@ ProcXIGrabDevice(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.status = status;
-
WriteReplyToClient(client, sizeof(rep), &rep);
return ret;
}
@@ -141,22 +138,23 @@ ProcXIUngrabDevice(ClientPtr client)
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (ret != Success)
- return ret;
+ return ret;
grab = dev->deviceGrab.grab;
time = ClientTimeToServerTime(stuff->time);
if ((CompareTimeStamps(time, currentTime) != LATER) &&
- (CompareTimeStamps(time, dev->deviceGrab.grabTime) != EARLIER) &&
- (grab) && SameClient(grab, client) && grab->grabtype == XI2)
- (*dev->deviceGrab.DeactivateGrab) (dev);
+ (CompareTimeStamps(time, dev->deviceGrab.grabTime) != EARLIER) &&
+ (grab) && SameClient(grab, client) && grab->grabtype == XI2)
+ (*dev->deviceGrab.DeactivateGrab) (dev);
return Success;
}
-void SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
+void
+SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/xipassivegrab.c b/xorg-server/Xi/xipassivegrab.c
index c80da8044..8a1c59968 100644
--- a/xorg-server/Xi/xipassivegrab.c
+++ b/xorg-server/Xi/xipassivegrab.c
@@ -33,13 +33,13 @@
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI2.h>
#include <X11/extensions/XI2proto.h>
#include "swaprep.h"
-#include "exglobals.h" /* BadDevice */
+#include "exglobals.h" /* BadDevice */
#include "exevents.h"
#include "xipassivegrab.h"
#include "dixgrabs.h"
@@ -63,10 +63,9 @@ SProcXIPassiveGrabDevice(ClientPtr client)
swaps(&stuff->mask_len);
swaps(&stuff->num_modifiers);
- mods = (xXIModifierInfo*)&stuff[1];
+ mods = (xXIModifierInfo *) &stuff[1];
- for (i = 0; i < stuff->num_modifiers; i++, mods++)
- {
+ for (i = 0; i < stuff->num_modifiers; i++, mods++) {
swapl(&mods->base_mods);
swapl(&mods->latched_mods);
swapl(&mods->locked_mods);
@@ -95,11 +94,9 @@ ProcXIPassiveGrabDevice(ClientPtr client)
dev = inputInfo.all_devices;
else if (stuff->deviceid == XIAllMasterDevices)
dev = inputInfo.all_master_devices;
- else
- {
+ else {
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
- if (ret != Success)
- {
+ if (ret != Success) {
client->errorValue = stuff->deviceid;
return ret;
}
@@ -109,29 +106,26 @@ ProcXIPassiveGrabDevice(ClientPtr client)
stuff->grab_type != XIGrabtypeKeycode &&
stuff->grab_type != XIGrabtypeEnter &&
stuff->grab_type != XIGrabtypeFocusIn &&
- stuff->grab_type != XIGrabtypeTouchBegin)
- {
+ stuff->grab_type != XIGrabtypeTouchBegin) {
client->errorValue = stuff->grab_type;
return BadValue;
}
if ((stuff->grab_type == XIGrabtypeEnter ||
stuff->grab_type == XIGrabtypeFocusIn ||
- stuff->grab_type == XIGrabtypeTouchBegin) && stuff->detail != 0)
- {
+ stuff->grab_type == XIGrabtypeTouchBegin) && stuff->detail != 0) {
client->errorValue = stuff->detail;
return BadValue;
}
if (stuff->grab_type == XIGrabtypeTouchBegin &&
(stuff->grab_mode != XIGrabModeTouch ||
- stuff->paired_device_mode != GrabModeAsync))
- {
+ stuff->paired_device_mode != GrabModeAsync)) {
client->errorValue = stuff->grab_mode;
return BadValue;
}
- if (XICheckInvalidMaskBits(client, (unsigned char*)&stuff[1],
+ if (XICheckInvalidMaskBits(client, (unsigned char *) &stuff[1],
stuff->mask_len * 4) != Success)
return BadValue;
@@ -140,7 +134,8 @@ ProcXIPassiveGrabDevice(ClientPtr client)
return BadAlloc;
mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4);
- xi2mask_set_one_mask(mask.xi2mask, stuff->deviceid, (unsigned char*)&stuff[1], mask_len * 4);
+ xi2mask_set_one_mask(mask.xi2mask, stuff->deviceid,
+ (unsigned char *) &stuff[1], mask_len * 4);
rep.repType = X_Reply;
rep.RepType = X_XIPassiveGrabDevice;
@@ -157,23 +152,24 @@ ProcXIPassiveGrabDevice(ClientPtr client)
if (IsKeyboardDevice(dev)) {
param.this_device_mode = stuff->grab_mode;
param.other_devices_mode = stuff->paired_device_mode;
- } else {
+ }
+ else {
param.this_device_mode = stuff->paired_device_mode;
param.other_devices_mode = stuff->grab_mode;
}
- if (stuff->cursor != None)
- {
+ if (stuff->cursor != None) {
ret = dixLookupResourceByType(&tmp, stuff->cursor,
RT_CURSOR, client, DixUseAccess);
- if (ret != Success)
- {
+ if (ret != Success) {
client->errorValue = stuff->cursor;
goto out;
}
}
- ret = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess);
+ ret =
+ dixLookupWindow((WindowPtr *) &tmp, stuff->grab_window, client,
+ DixSetAttrAccess);
if (ret != Success)
goto out;
@@ -181,8 +177,9 @@ ProcXIPassiveGrabDevice(ClientPtr client)
if (ret != Success)
goto out;
- modifiers = (uint32_t*)&stuff[1] + stuff->mask_len;
- modifiers_failed = calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
+ modifiers = (uint32_t *) &stuff[1] + stuff->mask_len;
+ modifiers_failed =
+ calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
if (!modifiers_failed) {
ret = BadAlloc;
goto out;
@@ -190,33 +187,29 @@ ProcXIPassiveGrabDevice(ClientPtr client)
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
- for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
- {
+ for (i = 0; i < stuff->num_modifiers; i++, modifiers++) {
uint8_t status = Success;
param.modifiers = *modifiers;
- switch(stuff->grab_type)
- {
- case XIGrabtypeButton:
- status = GrabButton(client, dev, mod_dev, stuff->detail,
- &param, XI2, &mask);
- break;
- case XIGrabtypeKeycode:
- status = GrabKey(client, dev, mod_dev, stuff->detail,
- &param, XI2, &mask);
- break;
- case XIGrabtypeEnter:
- case XIGrabtypeFocusIn:
- status = GrabWindow(client, dev, stuff->grab_type,
- &param, &mask);
- break;
- case XIGrabtypeTouchBegin:
- status = GrabTouch(client, dev, mod_dev, &param, &mask);
- break;
+ switch (stuff->grab_type) {
+ case XIGrabtypeButton:
+ status = GrabButton(client, dev, mod_dev, stuff->detail,
+ &param, XI2, &mask);
+ break;
+ case XIGrabtypeKeycode:
+ status = GrabKey(client, dev, mod_dev, stuff->detail,
+ &param, XI2, &mask);
+ break;
+ case XIGrabtypeEnter:
+ case XIGrabtypeFocusIn:
+ status = GrabWindow(client, dev, stuff->grab_type, &param, &mask);
+ break;
+ case XIGrabtypeTouchBegin:
+ status = GrabTouch(client, dev, mod_dev, &param, &mask);
+ break;
}
- if (status != GrabSuccess)
- {
+ if (status != GrabSuccess) {
xXIGrabModifierInfo *info = modifiers_failed + rep.num_modifiers;
info->status = status;
@@ -231,10 +224,10 @@ ProcXIPassiveGrabDevice(ClientPtr client)
WriteReplyToClient(client, sizeof(rep), &rep);
if (rep.num_modifiers)
- WriteToClient(client, rep.length * 4, (char*)modifiers_failed);
+ WriteToClient(client, rep.length * 4, (char *) modifiers_failed);
free(modifiers_failed);
-out:
+ out:
xi2mask_free(&mask.xi2mask);
return ret;
}
@@ -247,7 +240,7 @@ SRepXIPassiveGrabDevice(ClientPtr client, int size,
swapl(&rep->length);
swaps(&rep->num_modifiers);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
int
@@ -264,7 +257,7 @@ SProcXIPassiveUngrabDevice(ClientPtr client)
swapl(&stuff->detail);
swaps(&stuff->num_modifiers);
- modifiers = (uint32_t*)&stuff[1];
+ modifiers = (uint32_t *) &stuff[1];
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
swapl(modifiers);
@@ -278,7 +271,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
DeviceIntPtr dev, mod_dev;
WindowPtr win;
GrabPtr tempGrab;
- uint32_t* modifiers;
+ uint32_t *modifiers;
int i, rc;
REQUEST(xXIPassiveUngrabDeviceReq);
@@ -288,25 +281,22 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
dev = inputInfo.all_devices;
else if (stuff->deviceid == XIAllMasterDevices)
dev = inputInfo.all_master_devices;
- else
- {
+ else {
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
if (rc != Success)
- return rc;
+ return rc;
}
if (stuff->grab_type != XIGrabtypeButton &&
stuff->grab_type != XIGrabtypeKeycode &&
stuff->grab_type != XIGrabtypeEnter &&
- stuff->grab_type != XIGrabtypeFocusIn)
- {
+ stuff->grab_type != XIGrabtypeFocusIn) {
client->errorValue = stuff->grab_type;
return BadValue;
}
if ((stuff->grab_type == XIGrabtypeEnter ||
- stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0)
- {
+ stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0) {
client->errorValue = stuff->detail;
return BadValue;
}
@@ -317,7 +307,6 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
-
tempGrab = AllocGrab();
if (!tempGrab)
return BadAlloc;
@@ -325,12 +314,19 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
tempGrab->resource = client->clientAsMask;
tempGrab->device = dev;
tempGrab->window = win;
- switch(stuff->grab_type)
- {
- case XIGrabtypeButton: tempGrab->type = XI_ButtonPress; break;
- case XIGrabtypeKeycode: tempGrab->type = XI_KeyPress; break;
- case XIGrabtypeEnter: tempGrab->type = XI_Enter; break;
- case XIGrabtypeFocusIn: tempGrab->type = XI_FocusIn; break;
+ switch (stuff->grab_type) {
+ case XIGrabtypeButton:
+ tempGrab->type = XI_ButtonPress;
+ break;
+ case XIGrabtypeKeycode:
+ tempGrab->type = XI_KeyPress;
+ break;
+ case XIGrabtypeEnter:
+ tempGrab->type = XI_Enter;
+ break;
+ case XIGrabtypeFocusIn:
+ tempGrab->type = XI_FocusIn;
+ break;
}
tempGrab->grabtype = XI2;
tempGrab->modifierDevice = mod_dev;
@@ -338,10 +334,9 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
tempGrab->detail.exact = stuff->detail;
tempGrab->detail.pMask = NULL;
- modifiers = (uint32_t*)&stuff[1];
+ modifiers = (uint32_t *) &stuff[1];
- for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
- {
+ for (i = 0; i < stuff->num_modifiers; i++, modifiers++) {
tempGrab->modifiersDetail.exact = *modifiers;
DeletePassiveGrabFromList(tempGrab);
}
diff --git a/xorg-server/Xi/xipassivegrab.h b/xorg-server/Xi/xipassivegrab.h
index 079e7c61b..c790bb779 100644
--- a/xorg-server/Xi/xipassivegrab.h
+++ b/xorg-server/Xi/xipassivegrab.h
@@ -32,8 +32,9 @@
int SProcXIPassiveUngrabDevice(ClientPtr client);
int ProcXIPassiveUngrabDevice(ClientPtr client);
-void SRepXIPassiveGrabDevice(ClientPtr client, int size, xXIPassiveGrabDeviceReply * rep);
+void SRepXIPassiveGrabDevice(ClientPtr client, int size,
+ xXIPassiveGrabDeviceReply * rep);
int ProcXIPassiveGrabDevice(ClientPtr client);
int SProcXIPassiveGrabDevice(ClientPtr client);
-#endif /* XIPASSIVEGRAB_H */
+#endif /* XIPASSIVEGRAB_H */
diff --git a/xorg-server/Xi/xiproperty.c b/xorg-server/Xi/xiproperty.c
index c612af22c..e17efe407 100644
--- a/xorg-server/Xi/xiproperty.c
+++ b/xorg-server/Xi/xiproperty.c
@@ -45,195 +45,185 @@
/**
* Properties used or alloced from inside the server.
*/
-static struct dev_properties
-{
+static struct dev_properties {
Atom type;
const char *name;
} dev_properties[] = {
- {0, XI_PROP_ENABLED},
- {0, XI_PROP_XTEST_DEVICE},
-
- {0, XATOM_FLOAT},
-
- {0, ACCEL_PROP_PROFILE_NUMBER},
- {0, ACCEL_PROP_CONSTANT_DECELERATION},
- {0, ACCEL_PROP_ADAPTIVE_DECELERATION},
- {0, ACCEL_PROP_VELOCITY_SCALING},
-
- {0, AXIS_LABEL_PROP},
- {0, AXIS_LABEL_PROP_REL_X},
- {0, AXIS_LABEL_PROP_REL_Y},
- {0, AXIS_LABEL_PROP_REL_Z},
- {0, AXIS_LABEL_PROP_REL_RX},
- {0, AXIS_LABEL_PROP_REL_RY},
- {0, AXIS_LABEL_PROP_REL_RZ},
- {0, AXIS_LABEL_PROP_REL_HWHEEL},
- {0, AXIS_LABEL_PROP_REL_DIAL},
- {0, AXIS_LABEL_PROP_REL_WHEEL},
- {0, AXIS_LABEL_PROP_REL_MISC},
- {0, AXIS_LABEL_PROP_REL_VSCROLL},
- {0, AXIS_LABEL_PROP_REL_HSCROLL},
- {0, AXIS_LABEL_PROP_ABS_X},
- {0, AXIS_LABEL_PROP_ABS_Y},
- {0, AXIS_LABEL_PROP_ABS_Z},
- {0, AXIS_LABEL_PROP_ABS_RX},
- {0, AXIS_LABEL_PROP_ABS_RY},
- {0, AXIS_LABEL_PROP_ABS_RZ},
- {0, AXIS_LABEL_PROP_ABS_THROTTLE},
- {0, AXIS_LABEL_PROP_ABS_RUDDER},
- {0, AXIS_LABEL_PROP_ABS_WHEEL},
- {0, AXIS_LABEL_PROP_ABS_GAS},
- {0, AXIS_LABEL_PROP_ABS_BRAKE},
- {0, AXIS_LABEL_PROP_ABS_HAT0X},
- {0, AXIS_LABEL_PROP_ABS_HAT0Y},
- {0, AXIS_LABEL_PROP_ABS_HAT1X},
- {0, AXIS_LABEL_PROP_ABS_HAT1Y},
- {0, AXIS_LABEL_PROP_ABS_HAT2X},
- {0, AXIS_LABEL_PROP_ABS_HAT2Y},
- {0, AXIS_LABEL_PROP_ABS_HAT3X},
- {0, AXIS_LABEL_PROP_ABS_HAT3Y},
- {0, AXIS_LABEL_PROP_ABS_PRESSURE},
- {0, AXIS_LABEL_PROP_ABS_DISTANCE},
- {0, AXIS_LABEL_PROP_ABS_TILT_X},
- {0, AXIS_LABEL_PROP_ABS_TILT_Y},
- {0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH},
- {0, AXIS_LABEL_PROP_ABS_VOLUME},
- {0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR},
- {0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR},
- {0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR},
- {0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR},
- {0, AXIS_LABEL_PROP_ABS_MT_ORIENTATION},
- {0, AXIS_LABEL_PROP_ABS_MT_POSITION_X},
- {0, AXIS_LABEL_PROP_ABS_MT_POSITION_Y},
- {0, AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE},
- {0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID},
- {0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID},
- {0, AXIS_LABEL_PROP_ABS_MT_PRESSURE},
- {0, AXIS_LABEL_PROP_ABS_MISC},
-
- {0, BTN_LABEL_PROP},
- {0, BTN_LABEL_PROP_BTN_UNKNOWN},
- {0, BTN_LABEL_PROP_BTN_WHEEL_UP},
- {0, BTN_LABEL_PROP_BTN_WHEEL_DOWN},
- {0, BTN_LABEL_PROP_BTN_HWHEEL_LEFT},
- {0, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT},
- {0, BTN_LABEL_PROP_BTN_0},
- {0, BTN_LABEL_PROP_BTN_1},
- {0, BTN_LABEL_PROP_BTN_2},
- {0, BTN_LABEL_PROP_BTN_3},
- {0, BTN_LABEL_PROP_BTN_4},
- {0, BTN_LABEL_PROP_BTN_5},
- {0, BTN_LABEL_PROP_BTN_6},
- {0, BTN_LABEL_PROP_BTN_7},
- {0, BTN_LABEL_PROP_BTN_8},
- {0, BTN_LABEL_PROP_BTN_9},
-
- {0, BTN_LABEL_PROP_BTN_LEFT},
- {0, BTN_LABEL_PROP_BTN_RIGHT},
- {0, BTN_LABEL_PROP_BTN_MIDDLE},
- {0, BTN_LABEL_PROP_BTN_SIDE},
- {0, BTN_LABEL_PROP_BTN_EXTRA},
- {0, BTN_LABEL_PROP_BTN_FORWARD},
- {0, BTN_LABEL_PROP_BTN_BACK},
- {0, BTN_LABEL_PROP_BTN_TASK},
-
- {0, BTN_LABEL_PROP_BTN_TRIGGER},
- {0, BTN_LABEL_PROP_BTN_THUMB},
- {0, BTN_LABEL_PROP_BTN_THUMB2},
- {0, BTN_LABEL_PROP_BTN_TOP},
- {0, BTN_LABEL_PROP_BTN_TOP2},
- {0, BTN_LABEL_PROP_BTN_PINKIE},
- {0, BTN_LABEL_PROP_BTN_BASE},
- {0, BTN_LABEL_PROP_BTN_BASE2},
- {0, BTN_LABEL_PROP_BTN_BASE3},
- {0, BTN_LABEL_PROP_BTN_BASE4},
- {0, BTN_LABEL_PROP_BTN_BASE5},
- {0, BTN_LABEL_PROP_BTN_BASE6},
- {0, BTN_LABEL_PROP_BTN_DEAD},
-
- {0, BTN_LABEL_PROP_BTN_A},
- {0, BTN_LABEL_PROP_BTN_B},
- {0, BTN_LABEL_PROP_BTN_C},
- {0, BTN_LABEL_PROP_BTN_X},
- {0, BTN_LABEL_PROP_BTN_Y},
- {0, BTN_LABEL_PROP_BTN_Z},
- {0, BTN_LABEL_PROP_BTN_TL},
- {0, BTN_LABEL_PROP_BTN_TR},
- {0, BTN_LABEL_PROP_BTN_TL2},
- {0, BTN_LABEL_PROP_BTN_TR2},
- {0, BTN_LABEL_PROP_BTN_SELECT},
- {0, BTN_LABEL_PROP_BTN_START},
- {0, BTN_LABEL_PROP_BTN_MODE},
- {0, BTN_LABEL_PROP_BTN_THUMBL},
- {0, BTN_LABEL_PROP_BTN_THUMBR},
-
- {0, BTN_LABEL_PROP_BTN_TOOL_PEN},
- {0, BTN_LABEL_PROP_BTN_TOOL_RUBBER},
- {0, BTN_LABEL_PROP_BTN_TOOL_BRUSH},
- {0, BTN_LABEL_PROP_BTN_TOOL_PENCIL},
- {0, BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH},
- {0, BTN_LABEL_PROP_BTN_TOOL_FINGER},
- {0, BTN_LABEL_PROP_BTN_TOOL_MOUSE},
- {0, BTN_LABEL_PROP_BTN_TOOL_LENS},
- {0, BTN_LABEL_PROP_BTN_TOUCH},
- {0, BTN_LABEL_PROP_BTN_STYLUS},
- {0, BTN_LABEL_PROP_BTN_STYLUS2},
- {0, BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP},
- {0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP},
-
- {0, BTN_LABEL_PROP_BTN_GEAR_DOWN},
- {0, BTN_LABEL_PROP_BTN_GEAR_UP},
-
- {0, XI_PROP_TRANSFORM}
+ {
+ 0, XI_PROP_ENABLED}, {
+ 0, XI_PROP_XTEST_DEVICE}, {
+ 0, XATOM_FLOAT}, {
+ 0, ACCEL_PROP_PROFILE_NUMBER}, {
+ 0, ACCEL_PROP_CONSTANT_DECELERATION}, {
+ 0, ACCEL_PROP_ADAPTIVE_DECELERATION}, {
+ 0, ACCEL_PROP_VELOCITY_SCALING}, {
+ 0, AXIS_LABEL_PROP}, {
+ 0, AXIS_LABEL_PROP_REL_X}, {
+ 0, AXIS_LABEL_PROP_REL_Y}, {
+ 0, AXIS_LABEL_PROP_REL_Z}, {
+ 0, AXIS_LABEL_PROP_REL_RX}, {
+ 0, AXIS_LABEL_PROP_REL_RY}, {
+ 0, AXIS_LABEL_PROP_REL_RZ}, {
+ 0, AXIS_LABEL_PROP_REL_HWHEEL}, {
+ 0, AXIS_LABEL_PROP_REL_DIAL}, {
+ 0, AXIS_LABEL_PROP_REL_WHEEL}, {
+ 0, AXIS_LABEL_PROP_REL_MISC}, {
+ 0, AXIS_LABEL_PROP_REL_VSCROLL}, {
+ 0, AXIS_LABEL_PROP_REL_HSCROLL}, {
+ 0, AXIS_LABEL_PROP_ABS_X}, {
+ 0, AXIS_LABEL_PROP_ABS_Y}, {
+ 0, AXIS_LABEL_PROP_ABS_Z}, {
+ 0, AXIS_LABEL_PROP_ABS_RX}, {
+ 0, AXIS_LABEL_PROP_ABS_RY}, {
+ 0, AXIS_LABEL_PROP_ABS_RZ}, {
+ 0, AXIS_LABEL_PROP_ABS_THROTTLE}, {
+ 0, AXIS_LABEL_PROP_ABS_RUDDER}, {
+ 0, AXIS_LABEL_PROP_ABS_WHEEL}, {
+ 0, AXIS_LABEL_PROP_ABS_GAS}, {
+ 0, AXIS_LABEL_PROP_ABS_BRAKE}, {
+ 0, AXIS_LABEL_PROP_ABS_HAT0X}, {
+ 0, AXIS_LABEL_PROP_ABS_HAT0Y}, {
+ 0, AXIS_LABEL_PROP_ABS_HAT1X}, {
+ 0, AXIS_LABEL_PROP_ABS_HAT1Y}, {
+ 0, AXIS_LABEL_PROP_ABS_HAT2X}, {
+ 0, AXIS_LABEL_PROP_ABS_HAT2Y}, {
+ 0, AXIS_LABEL_PROP_ABS_HAT3X}, {
+ 0, AXIS_LABEL_PROP_ABS_HAT3Y}, {
+ 0, AXIS_LABEL_PROP_ABS_PRESSURE}, {
+ 0, AXIS_LABEL_PROP_ABS_DISTANCE}, {
+ 0, AXIS_LABEL_PROP_ABS_TILT_X}, {
+ 0, AXIS_LABEL_PROP_ABS_TILT_Y}, {
+ 0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH}, {
+ 0, AXIS_LABEL_PROP_ABS_VOLUME}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_ORIENTATION}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_POSITION_X}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_POSITION_Y}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID}, {
+ 0, AXIS_LABEL_PROP_ABS_MT_PRESSURE}, {
+ 0, AXIS_LABEL_PROP_ABS_MISC}, {
+ 0, BTN_LABEL_PROP}, {
+ 0, BTN_LABEL_PROP_BTN_UNKNOWN}, {
+ 0, BTN_LABEL_PROP_BTN_WHEEL_UP}, {
+ 0, BTN_LABEL_PROP_BTN_WHEEL_DOWN}, {
+ 0, BTN_LABEL_PROP_BTN_HWHEEL_LEFT}, {
+ 0, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT}, {
+ 0, BTN_LABEL_PROP_BTN_0}, {
+ 0, BTN_LABEL_PROP_BTN_1}, {
+ 0, BTN_LABEL_PROP_BTN_2}, {
+ 0, BTN_LABEL_PROP_BTN_3}, {
+ 0, BTN_LABEL_PROP_BTN_4}, {
+ 0, BTN_LABEL_PROP_BTN_5}, {
+ 0, BTN_LABEL_PROP_BTN_6}, {
+ 0, BTN_LABEL_PROP_BTN_7}, {
+ 0, BTN_LABEL_PROP_BTN_8}, {
+ 0, BTN_LABEL_PROP_BTN_9}, {
+ 0, BTN_LABEL_PROP_BTN_LEFT}, {
+ 0, BTN_LABEL_PROP_BTN_RIGHT}, {
+ 0, BTN_LABEL_PROP_BTN_MIDDLE}, {
+ 0, BTN_LABEL_PROP_BTN_SIDE}, {
+ 0, BTN_LABEL_PROP_BTN_EXTRA}, {
+ 0, BTN_LABEL_PROP_BTN_FORWARD}, {
+ 0, BTN_LABEL_PROP_BTN_BACK}, {
+ 0, BTN_LABEL_PROP_BTN_TASK}, {
+ 0, BTN_LABEL_PROP_BTN_TRIGGER}, {
+ 0, BTN_LABEL_PROP_BTN_THUMB}, {
+ 0, BTN_LABEL_PROP_BTN_THUMB2}, {
+ 0, BTN_LABEL_PROP_BTN_TOP}, {
+ 0, BTN_LABEL_PROP_BTN_TOP2}, {
+ 0, BTN_LABEL_PROP_BTN_PINKIE}, {
+ 0, BTN_LABEL_PROP_BTN_BASE}, {
+ 0, BTN_LABEL_PROP_BTN_BASE2}, {
+ 0, BTN_LABEL_PROP_BTN_BASE3}, {
+ 0, BTN_LABEL_PROP_BTN_BASE4}, {
+ 0, BTN_LABEL_PROP_BTN_BASE5}, {
+ 0, BTN_LABEL_PROP_BTN_BASE6}, {
+ 0, BTN_LABEL_PROP_BTN_DEAD}, {
+ 0, BTN_LABEL_PROP_BTN_A}, {
+ 0, BTN_LABEL_PROP_BTN_B}, {
+ 0, BTN_LABEL_PROP_BTN_C}, {
+ 0, BTN_LABEL_PROP_BTN_X}, {
+ 0, BTN_LABEL_PROP_BTN_Y}, {
+ 0, BTN_LABEL_PROP_BTN_Z}, {
+ 0, BTN_LABEL_PROP_BTN_TL}, {
+ 0, BTN_LABEL_PROP_BTN_TR}, {
+ 0, BTN_LABEL_PROP_BTN_TL2}, {
+ 0, BTN_LABEL_PROP_BTN_TR2}, {
+ 0, BTN_LABEL_PROP_BTN_SELECT}, {
+ 0, BTN_LABEL_PROP_BTN_START}, {
+ 0, BTN_LABEL_PROP_BTN_MODE}, {
+ 0, BTN_LABEL_PROP_BTN_THUMBL}, {
+ 0, BTN_LABEL_PROP_BTN_THUMBR}, {
+ 0, BTN_LABEL_PROP_BTN_TOOL_PEN}, {
+ 0, BTN_LABEL_PROP_BTN_TOOL_RUBBER}, {
+ 0, BTN_LABEL_PROP_BTN_TOOL_BRUSH}, {
+ 0, BTN_LABEL_PROP_BTN_TOOL_PENCIL}, {
+ 0, BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH}, {
+ 0, BTN_LABEL_PROP_BTN_TOOL_FINGER}, {
+ 0, BTN_LABEL_PROP_BTN_TOOL_MOUSE}, {
+ 0, BTN_LABEL_PROP_BTN_TOOL_LENS}, {
+ 0, BTN_LABEL_PROP_BTN_TOUCH}, {
+ 0, BTN_LABEL_PROP_BTN_STYLUS}, {
+ 0, BTN_LABEL_PROP_BTN_STYLUS2}, {
+ 0, BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP}, {
+ 0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP}, {
+ 0, BTN_LABEL_PROP_BTN_GEAR_DOWN}, {
+ 0, BTN_LABEL_PROP_BTN_GEAR_UP}, {
+ 0, XI_PROP_TRANSFORM}
};
static long XIPropHandlerID = 1;
-static void send_property_event(DeviceIntPtr dev, Atom property, int what)
+static void
+send_property_event(DeviceIntPtr dev, Atom property, int what)
{
- devicePropertyNotify event;
- xXIPropertyEvent xi2;
- int state;
-
- if (what == XIPropertyDeleted)
- state = PropertyDelete;
- else
- state = PropertyNewValue;
-
- event.type = DevicePropertyNotify;
- event.deviceid = dev->id;
- event.state = state;
- event.atom = property;
- event.time = currentTime.milliseconds;
- SendEventToAllWindows(dev, DevicePropertyNotifyMask,
- (xEvent*)&event, 1);
-
- xi2.type = GenericEvent;
- xi2.extension = IReqCode;
- xi2.length = 0;
- xi2.evtype = XI_PropertyEvent;
- xi2.deviceid = dev->id;
- xi2.time = currentTime.milliseconds;
- xi2.property = property;
- xi2.what = what;
- SendEventToAllWindows(dev, GetEventFilter(dev, (xEvent*)&xi2),
- (xEvent*)&xi2, 1);
+ devicePropertyNotify event;
+ xXIPropertyEvent xi2;
+ int state;
+
+ if (what == XIPropertyDeleted)
+ state = PropertyDelete;
+ else
+ state = PropertyNewValue;
+
+ event.type = DevicePropertyNotify;
+ event.deviceid = dev->id;
+ event.state = state;
+ event.atom = property;
+ event.time = currentTime.milliseconds;
+ SendEventToAllWindows(dev, DevicePropertyNotifyMask, (xEvent *) &event, 1);
+
+ xi2.type = GenericEvent;
+ xi2.extension = IReqCode;
+ xi2.length = 0;
+ xi2.evtype = XI_PropertyEvent;
+ xi2.deviceid = dev->id;
+ xi2.time = currentTime.milliseconds;
+ xi2.property = property;
+ xi2.what = what;
+ SendEventToAllWindows(dev, GetEventFilter(dev, (xEvent *) &xi2),
+ (xEvent *) &xi2, 1);
}
-static int list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
+static int
+list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
{
XIPropertyPtr prop;
- Atom *atoms = NULL;
- int nprops = 0;
+ Atom *atoms = NULL;
+ int nprops = 0;
for (prop = dev->properties.properties; prop; prop = prop->next)
nprops++;
- if (nprops)
- {
+ if (nprops) {
Atom *a;
atoms = malloc(nprops * sizeof(Atom));
- if(!atoms)
+ if (!atoms)
return BadAlloc;
a = atoms;
for (prop = dev->properties.properties; prop; prop = prop->next, a++)
@@ -256,19 +246,16 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
XIPropertyPtr prop;
XIPropertyValuePtr prop_value;
- if (!ValidAtom(property))
- {
+ if (!ValidAtom(property)) {
client->errorValue = property;
return BadAtom;
}
- if ((delete != xTrue) && (delete != xFalse))
- {
+ if ((delete != xTrue) && (delete != xFalse)) {
client->errorValue = delete;
return BadValue;
}
- if ((type != AnyPropertyType) && !ValidAtom(type))
- {
+ if ((type != AnyPropertyType) && !ValidAtom(type)) {
client->errorValue = type;
return BadAtom;
}
@@ -277,8 +264,7 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
if (prop->propertyName == property)
break;
- if (!prop)
- {
+ if (!prop) {
*bytes_after = 0;
*type_return = None;
*format = 0;
@@ -288,17 +274,15 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
}
rc = XIGetDeviceProperty(dev, property, &prop_value);
- if (rc != Success)
- {
+ if (rc != Success) {
client->errorValue = property;
return rc;
}
/* If the request type and actual type don't match. Return the
- property information, but not the data. */
+ property information, but not the data. */
- if (((type != prop_value->type) && (type != AnyPropertyType)))
- {
+ if (((type != prop_value->type) && (type != AnyPropertyType))) {
*bytes_after = prop_value->size;
*format = prop_value->format;
*length_return = 0;
@@ -308,14 +292,13 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
}
/* Return type, format, value to client */
- n = (prop_value->format/8) * prop_value->size; /* size (bytes) of prop */
+ n = (prop_value->format / 8) * prop_value->size; /* size (bytes) of prop */
ind = offset << 2;
- /* If offset is invalid such that it causes "len" to
- be negative, it's a value error. */
+ /* If offset is invalid such that it causes "len" to
+ be negative, it's a value error. */
- if (n < ind)
- {
+ if (n < ind) {
client->errorValue = offset;
return BadValue;
}
@@ -331,7 +314,7 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
*nitems = 0;
*type_return = prop_value->type;
- *data = (char*)prop_value->data + ind;
+ *data = (char *) prop_value->data + ind;
return Success;
}
@@ -341,24 +324,20 @@ check_change_property(ClientPtr client, Atom property, Atom type, int format,
int mode, int nitems)
{
if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
- (mode != PropModePrepend))
- {
+ (mode != PropModePrepend)) {
client->errorValue = mode;
return BadValue;
}
- if ((format != 8) && (format != 16) && (format != 32))
- {
+ if ((format != 8) && (format != 16) && (format != 32)) {
client->errorValue = format;
return BadValue;
}
- if (!ValidAtom(property))
- {
+ if (!ValidAtom(property)) {
client->errorValue = property;
return BadAtom;
}
- if (!ValidAtom(type))
- {
+ if (!ValidAtom(type)) {
client->errorValue = type;
return BadAtom;
}
@@ -372,7 +351,8 @@ change_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
{
int rc = Success;
- rc = XIChangeDeviceProperty(dev, property, type, format, mode, len, data, TRUE);
+ rc = XIChangeDeviceProperty(dev, property, type, format, mode, len, data,
+ TRUE);
if (rc != Success)
client->errorValue = property;
@@ -393,14 +373,13 @@ XIGetKnownProperty(const char *name)
if (!name)
return None;
- for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
- {
- if (strcmp(name, dev_properties[i].name) == 0){
- if (dev_properties[i].type == None){
- dev_properties[i].type =
- MakeAtom(dev_properties[i].name,
- strlen(dev_properties[i].name),
- TRUE);
+ for (i = 0; i < (sizeof(dev_properties) / sizeof(struct dev_properties));
+ i++) {
+ if (strcmp(name, dev_properties[i].name) == 0) {
+ if (dev_properties[i].type == None) {
+ dev_properties[i].type =
+ MakeAtom(dev_properties[i].name,
+ strlen(dev_properties[i].name), TRUE);
}
return dev_properties[i].type;
@@ -415,7 +394,8 @@ XIResetProperties(void)
{
int i;
- for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
+ for (i = 0; i < (sizeof(dev_properties) / sizeof(struct dev_properties));
+ i++)
dev_properties[i].type = None;
}
@@ -450,35 +430,38 @@ XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
if (!*buf_return && *nelem_return)
return BadLength;
- switch(val->format)
- {
- case 8:
- case 16:
- case 32:
- break;
- default:
- return BadValue;
+ switch (val->format) {
+ case 8:
+ case 16:
+ case 32:
+ break;
+ default:
+ return BadValue;
}
buf = *buf_return;
- if (!buf && !(*nelem_return))
- {
+ if (!buf && !(*nelem_return)) {
buf = calloc(val->size, sizeof(int));
if (!buf)
return BadAlloc;
*buf_return = buf;
*nelem_return = val->size;
- } else if (val->size < *nelem_return)
+ }
+ else if (val->size < *nelem_return)
*nelem_return = val->size;
- for (i = 0; i < val->size && i < *nelem_return; i++)
- {
- switch(val->format)
- {
- case 8: buf[i] = ((CARD8*)val->data)[i]; break;
- case 16: buf[i] = ((CARD16*)val->data)[i]; break;
- case 32: buf[i] = ((CARD32*)val->data)[i]; break;
+ for (i = 0; i < val->size && i < *nelem_return; i++) {
+ switch (val->format) {
+ case 8:
+ buf[i] = ((CARD8 *) val->data)[i];
+ break;
+ case 16:
+ buf[i] = ((CARD16 *) val->data)[i];
+ break;
+ case 32:
+ buf[i] = ((CARD32 *) val->data)[i];
+ break;
}
}
@@ -522,18 +505,18 @@ XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return)
buf = *buf_return;
- if (!buf && !(*nelem_return))
- {
+ if (!buf && !(*nelem_return)) {
buf = calloc(val->size, sizeof(float));
if (!buf)
return BadAlloc;
*buf_return = buf;
*nelem_return = val->size;
- } else if (val->size < *nelem_return)
+ }
+ else if (val->size < *nelem_return)
*nelem_return = val->size;
for (i = 0; i < val->size && i < *nelem_return; i++)
- buf[i] = ((float*)val->data)[i];
+ buf[i] = ((float *) val->data)[i];
return Success;
}
@@ -544,7 +527,7 @@ XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return)
* @return The handler's identifier or 0 if an error occured.
*/
long
-XIRegisterPropertyHandler(DeviceIntPtr dev,
+XIRegisterPropertyHandler(DeviceIntPtr dev,
int (*SetProperty) (DeviceIntPtr dev,
Atom property,
XIPropertyValuePtr prop,
@@ -576,8 +559,7 @@ XIUnregisterPropertyHandler(DeviceIntPtr dev, long id)
XIPropertyHandlerPtr curr, prev = NULL;
curr = dev->properties.handlers;
- while(curr && curr->id != id)
- {
+ while (curr && curr->id != id) {
prev = curr;
curr = curr->next;
}
@@ -585,7 +567,7 @@ XIUnregisterPropertyHandler(DeviceIntPtr dev, long id)
if (!curr)
return;
- if (!prev) /* first one */
+ if (!prev) /* first one */
dev->properties.handlers = curr->next;
else
prev->next = curr->next;
@@ -594,21 +576,21 @@ XIUnregisterPropertyHandler(DeviceIntPtr dev, long id)
}
static XIPropertyPtr
-XICreateDeviceProperty (Atom property)
+XICreateDeviceProperty(Atom property)
{
- XIPropertyPtr prop;
+ XIPropertyPtr prop;
- prop = (XIPropertyPtr)malloc(sizeof(XIPropertyRec));
+ prop = (XIPropertyPtr) malloc(sizeof(XIPropertyRec));
if (!prop)
return NULL;
- prop->next = NULL;
- prop->propertyName = property;
- prop->value.type = None;
+ prop->next = NULL;
+ prop->propertyName = property;
+ prop->value.type = None;
prop->value.format = 0;
- prop->value.size = 0;
- prop->value.data = NULL;
- prop->deletable = TRUE;
+ prop->value.size = 0;
+ prop->value.data = NULL;
+ prop->deletable = TRUE;
return prop;
}
@@ -616,7 +598,7 @@ XICreateDeviceProperty (Atom property)
static XIPropertyPtr
XIFetchDeviceProperty(DeviceIntPtr dev, Atom property)
{
- XIPropertyPtr prop;
+ XIPropertyPtr prop;
for (prop = dev->properties.properties; prop; prop = prop->next)
if (prop->propertyName == property)
@@ -625,7 +607,7 @@ XIFetchDeviceProperty(DeviceIntPtr dev, Atom property)
}
static void
-XIDestroyDeviceProperty (XIPropertyPtr prop)
+XIDestroyDeviceProperty(XIPropertyPtr prop)
{
free(prop->value.data);
free(prop);
@@ -636,13 +618,12 @@ XIDestroyDeviceProperty (XIPropertyPtr prop)
* DO NOT CALL FROM THE DRIVER.
*/
void
-XIDeleteAllDeviceProperties (DeviceIntPtr device)
+XIDeleteAllDeviceProperties(DeviceIntPtr device)
{
- XIPropertyPtr prop, next;
- XIPropertyHandlerPtr curr_handler, next_handler;
+ XIPropertyPtr prop, next;
+ XIPropertyHandlerPtr curr_handler, next_handler;
- for (prop = device->properties.properties; prop; prop = next)
- {
+ for (prop = device->properties.properties; prop; prop = next) {
next = prop->next;
send_property_event(device, prop->propertyName, XIPropertyDeleted);
XIDestroyDeviceProperty(prop);
@@ -652,8 +633,7 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device)
/* Now free all handlers */
curr_handler = device->properties.handlers;
- while(curr_handler)
- {
+ while (curr_handler) {
next_handler = curr_handler->next;
free(curr_handler);
curr_handler = next_handler;
@@ -662,14 +642,14 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device)
device->properties.handlers = NULL;
}
-
int
-XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
+XIDeleteDeviceProperty(DeviceIntPtr device, Atom property, Bool fromClient)
{
- XIPropertyPtr prop, *prev;
- int rc = Success;
+ XIPropertyPtr prop, *prev;
+ int rc = Success;
- for (prev = &device->properties.properties; (prop = *prev); prev = &(prop->next))
+ for (prev = &device->properties.properties; (prop = *prev);
+ prev = &(prop->next))
if (prop->propertyName == property)
break;
@@ -680,11 +660,10 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
return BadAccess;
/* Ask handlers if we may delete the property */
- if (device->properties.handlers)
- {
+ if (device->properties.handlers) {
XIPropertyHandlerPtr handler = device->properties.handlers;
- while(handler)
- {
+
+ while (handler) {
if (handler->DeleteProperty)
rc = handler->DeleteProperty(device, prop->propertyName);
if (rc != Success)
@@ -693,37 +672,35 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
}
}
- if (prop)
- {
+ if (prop) {
*prev = prop->next;
send_property_event(device, prop->propertyName, XIPropertyDeleted);
- XIDestroyDeviceProperty (prop);
+ XIDestroyDeviceProperty(prop);
}
return Success;
}
int
-XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
- int format, int mode, unsigned long len,
- const void *value, Bool sendevent)
+XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
+ int format, int mode, unsigned long len,
+ const void *value, Bool sendevent)
{
- XIPropertyPtr prop;
- int size_in_bytes;
- int total_size;
- unsigned long total_len;
- XIPropertyValuePtr prop_value;
- XIPropertyValueRec new_value;
- Bool add = FALSE;
- int rc;
+ XIPropertyPtr prop;
+ int size_in_bytes;
+ int total_size;
+ unsigned long total_len;
+ XIPropertyValuePtr prop_value;
+ XIPropertyValueRec new_value;
+ Bool add = FALSE;
+ int rc;
size_in_bytes = format >> 3;
/* first see if property already exists */
- prop = XIFetchDeviceProperty (dev, property);
- if (!prop) /* just add to list */
- {
- prop = XICreateDeviceProperty (property);
+ prop = XIFetchDeviceProperty(dev, property);
+ if (!prop) { /* just add to list */
+ prop = XICreateDeviceProperty(property);
if (!prop)
return BadAlloc;
add = TRUE;
@@ -732,9 +709,9 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
prop_value = &prop->value;
/* To append or prepend to a property the request format and type
- must match those of the already defined property. The
- existing format and type are irrelevant when using the mode
- "PropModeReplace" since they will be written over. */
+ must match those of the already defined property. The
+ existing format and type are irrelevant when using the mode
+ "PropModeReplace" since they will be written over. */
if ((format != prop_value->format) && (mode != PropModeReplace))
return BadMatch;
@@ -746,16 +723,14 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
else
total_len = prop_value->size + len;
- if (mode == PropModeReplace || len > 0)
- {
- pointer new_data = NULL, old_data = NULL;
+ if (mode == PropModeReplace || len > 0) {
+ pointer new_data = NULL, old_data = NULL;
total_size = total_len * size_in_bytes;
- new_value.data = (pointer)malloc(total_size);
- if (!new_value.data && total_size)
- {
+ new_value.data = (pointer) malloc(total_size);
+ if (!new_value.data && total_size) {
if (add)
- XIDestroyDeviceProperty (prop);
+ XIDestroyDeviceProperty(prop);
return BadAlloc;
}
new_value.size = len;
@@ -779,29 +754,25 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
break;
}
if (new_data)
- memcpy ((char *) new_data, (char *) value, len * size_in_bytes);
+ memcpy((char *) new_data, (char *) value, len * size_in_bytes);
if (old_data)
- memcpy ((char *) old_data, (char *) prop_value->data,
- prop_value->size * size_in_bytes);
+ memcpy((char *) old_data, (char *) prop_value->data,
+ prop_value->size * size_in_bytes);
- if (dev->properties.handlers)
- {
+ if (dev->properties.handlers) {
XIPropertyHandlerPtr handler;
BOOL checkonly = TRUE;
+
/* run through all handlers with checkonly TRUE, then again with
* checkonly FALSE. Handlers MUST return error codes on the
* checkonly run, errors on the second run are ignored */
- do
- {
+ do {
handler = dev->properties.handlers;
- while(handler)
- {
- if (handler->SetProperty)
- {
+ while (handler) {
+ if (handler->SetProperty) {
rc = handler->SetProperty(dev, prop->propertyName,
- &new_value, checkonly);
- if (checkonly && rc != Success)
- {
+ &new_value, checkonly);
+ if (checkonly && rc != Success) {
free(new_value.data);
return rc;
}
@@ -813,47 +784,42 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
}
free(prop_value->data);
*prop_value = new_value;
- } else if (len == 0)
- {
+ }
+ else if (len == 0) {
/* do nothing */
}
- if (add)
- {
+ if (add) {
prop->next = dev->properties.properties;
dev->properties.properties = prop;
}
if (sendevent)
send_property_event(dev, prop->propertyName,
- (add) ? XIPropertyCreated : XIPropertyModified);
+ (add) ? XIPropertyCreated : XIPropertyModified);
return Success;
}
int
-XIGetDeviceProperty (DeviceIntPtr dev, Atom property, XIPropertyValuePtr *value)
+XIGetDeviceProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr *value)
{
- XIPropertyPtr prop = XIFetchDeviceProperty (dev, property);
+ XIPropertyPtr prop = XIFetchDeviceProperty(dev, property);
int rc;
- if (!prop)
- {
+ if (!prop) {
*value = NULL;
return BadAtom;
}
/* If we can, try to update the property value first */
- if (dev->properties.handlers)
- {
+ if (dev->properties.handlers) {
XIPropertyHandlerPtr handler = dev->properties.handlers;
- while(handler)
- {
- if (handler->GetProperty)
- {
+
+ while (handler) {
+ if (handler->GetProperty) {
rc = handler->GetProperty(dev, prop->propertyName);
- if (rc != Success)
- {
+ if (rc != Success) {
*value = NULL;
return rc;
}
@@ -879,18 +845,18 @@ XISetDevicePropertyDeletable(DeviceIntPtr dev, Atom property, Bool deletable)
}
int
-ProcXListDeviceProperties (ClientPtr client)
+ProcXListDeviceProperties(ClientPtr client)
{
- Atom *atoms;
- xListDevicePropertiesReply rep;
- int natoms;
- DeviceIntPtr dev;
- int rc = Success;
+ Atom *atoms;
+ xListDevicePropertiesReply rep;
+ int natoms;
+ DeviceIntPtr dev;
+ int rc = Success;
REQUEST(xListDevicePropertiesReq);
REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixListPropAccess);
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixListPropAccess);
if (rc != Success)
return rc;
@@ -905,9 +871,8 @@ ProcXListDeviceProperties (ClientPtr client)
rep.nAtoms = natoms;
WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep);
- if (natoms)
- {
- client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
+ if (natoms) {
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
free(atoms);
}
@@ -915,18 +880,18 @@ ProcXListDeviceProperties (ClientPtr client)
}
int
-ProcXChangeDeviceProperty (ClientPtr client)
+ProcXChangeDeviceProperty(ClientPtr client)
{
REQUEST(xChangeDevicePropertyReq);
- DeviceIntPtr dev;
- unsigned long len;
- int totalSize;
- int rc;
+ DeviceIntPtr dev;
+ unsigned long len;
+ int totalSize;
+ int rc;
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
UpdateCurrentTime();
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetPropAccess);
if (rc != Success)
return rc;
@@ -937,29 +902,28 @@ ProcXChangeDeviceProperty (ClientPtr client)
if (len > (bytes_to_int32(0xffffffff - sizeof(xChangeDevicePropertyReq))))
return BadLength;
- totalSize = len * (stuff->format/8);
+ totalSize = len * (stuff->format / 8);
REQUEST_FIXED_SIZE(xChangeDevicePropertyReq, totalSize);
rc = change_property(client, dev, stuff->property, stuff->type,
- stuff->format, stuff->mode, len, (void*)&stuff[1]);
+ stuff->format, stuff->mode, len, (void *) &stuff[1]);
return rc;
}
int
-ProcXDeleteDeviceProperty (ClientPtr client)
+ProcXDeleteDeviceProperty(ClientPtr client)
{
REQUEST(xDeleteDevicePropertyReq);
- DeviceIntPtr dev;
- int rc;
+ DeviceIntPtr dev;
+ int rc;
REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
UpdateCurrentTime();
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetPropAccess);
if (rc != Success)
return rc;
- if (!ValidAtom(stuff->property))
- {
+ if (!ValidAtom(stuff->property)) {
client->errorValue = stuff->property;
return BadAtom;
}
@@ -969,28 +933,27 @@ ProcXDeleteDeviceProperty (ClientPtr client)
}
int
-ProcXGetDeviceProperty (ClientPtr client)
+ProcXGetDeviceProperty(ClientPtr client)
{
REQUEST(xGetDevicePropertyReq);
- DeviceIntPtr dev;
- int length;
- int rc, format, nitems, bytes_after;
- char *data;
- Atom type;
- xGetDevicePropertyReply reply;
+ DeviceIntPtr dev;
+ int length;
+ int rc, format, nitems, bytes_after;
+ char *data;
+ Atom type;
+ xGetDevicePropertyReply reply;
REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
if (stuff->delete)
UpdateCurrentTime();
- rc = dixLookupDevice (&dev, stuff->deviceid, client,
- stuff->delete ? DixSetPropAccess :
- DixGetPropAccess);
+ rc = dixLookupDevice(&dev, stuff->deviceid, client,
+ stuff->delete ? DixSetPropAccess : DixGetPropAccess);
if (rc != Success)
return rc;
rc = get_property(client, dev, stuff->property, stuff->type,
- stuff->delete, stuff->longOffset, stuff->longLength,
- &bytes_after, &type, &format, &nitems, &length, &data);
+ stuff->delete, stuff->longOffset, stuff->longLength,
+ &bytes_after, &type, &format, &nitems, &length, &data);
if (rc != Success)
return rc;
@@ -1010,24 +973,28 @@ ProcXGetDeviceProperty (ClientPtr client)
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
- if (length)
- {
+ if (length) {
switch (reply.format) {
- case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
- case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
- default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
+ case 32:
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
+ break;
+ case 16:
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
+ break;
+ default:
+ client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
+ break;
}
WriteSwappedDataToClient(client, length, data);
}
/* delete the Property */
- if (stuff->delete && (reply.bytesAfter == 0))
- {
+ if (stuff->delete && (reply.bytesAfter == 0)) {
XIPropertyPtr prop, *prev;
- for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
- {
- if (prop->propertyName == stuff->property)
- {
+
+ for (prev = &dev->properties.properties; (prop = *prev);
+ prev = &prop->next) {
+ if (prop->propertyName == stuff->property) {
*prev = prop->next;
XIDestroyDeviceProperty(prop);
break;
@@ -1037,9 +1004,8 @@ ProcXGetDeviceProperty (ClientPtr client)
return Success;
}
-
int
-SProcXListDeviceProperties (ClientPtr client)
+SProcXListDeviceProperties(ClientPtr client)
{
REQUEST(xListDevicePropertiesReq);
@@ -1050,7 +1016,7 @@ SProcXListDeviceProperties (ClientPtr client)
}
int
-SProcXChangeDeviceProperty (ClientPtr client)
+SProcXChangeDeviceProperty(ClientPtr client)
{
REQUEST(xChangeDevicePropertyReq);
@@ -1063,7 +1029,7 @@ SProcXChangeDeviceProperty (ClientPtr client)
}
int
-SProcXDeleteDeviceProperty (ClientPtr client)
+SProcXDeleteDeviceProperty(ClientPtr client)
{
REQUEST(xDeleteDevicePropertyReq);
@@ -1074,7 +1040,7 @@ SProcXDeleteDeviceProperty (ClientPtr client)
}
int
-SProcXGetDeviceProperty (ClientPtr client)
+SProcXGetDeviceProperty(ClientPtr client)
{
REQUEST(xGetDevicePropertyReq);
@@ -1087,23 +1053,22 @@ SProcXGetDeviceProperty (ClientPtr client)
return (ProcXGetDeviceProperty(client));
}
-
/* Reply swapping */
void
SRepXListDeviceProperties(ClientPtr client, int size,
- xListDevicePropertiesReply *rep)
+ xListDevicePropertiesReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->nAtoms);
/* properties will be swapped later, see ProcXListDeviceProperties */
- WriteToClient(client, size, (char*)rep);
+ WriteToClient(client, size, (char *) rep);
}
void
SRepXGetDeviceProperty(ClientPtr client, int size,
- xGetDevicePropertyReply *rep)
+ xGetDevicePropertyReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
@@ -1111,23 +1076,23 @@ SRepXGetDeviceProperty(ClientPtr client, int size,
swapl(&rep->bytesAfter);
swapl(&rep->nItems);
/* data will be swapped, see ProcXGetDeviceProperty */
- WriteToClient(client, size, (char*)rep);
+ WriteToClient(client, size, (char *) rep);
}
/* XI2 Request/reply handling */
int
ProcXIListProperties(ClientPtr client)
{
- Atom *atoms;
- xXIListPropertiesReply rep;
- int natoms;
- DeviceIntPtr dev;
- int rc = Success;
+ Atom *atoms;
+ xXIListPropertiesReply rep;
+ int natoms;
+ DeviceIntPtr dev;
+ int rc = Success;
REQUEST(xXIListPropertiesReq);
REQUEST_SIZE_MATCH(xXIListPropertiesReq);
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixListPropAccess);
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixListPropAccess);
if (rc != Success)
return rc;
@@ -1142,9 +1107,8 @@ ProcXIListProperties(ClientPtr client)
rep.num_properties = natoms;
WriteReplyToClient(client, sizeof(xXIListPropertiesReply), &rep);
- if (natoms)
- {
- client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
+ if (natoms) {
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
free(atoms);
}
@@ -1154,16 +1118,16 @@ ProcXIListProperties(ClientPtr client)
int
ProcXIChangeProperty(ClientPtr client)
{
- int rc;
- DeviceIntPtr dev;
- int totalSize;
- unsigned long len;
+ int rc;
+ DeviceIntPtr dev;
+ int totalSize;
+ unsigned long len;
REQUEST(xXIChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
UpdateCurrentTime();
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetPropAccess);
if (rc != Success)
return rc;
@@ -1173,29 +1137,29 @@ ProcXIChangeProperty(ClientPtr client)
if (len > bytes_to_int32(0xffffffff - sizeof(xXIChangePropertyReq)))
return BadLength;
- totalSize = len * (stuff->format/8);
+ totalSize = len * (stuff->format / 8);
REQUEST_FIXED_SIZE(xXIChangePropertyReq, totalSize);
rc = change_property(client, dev, stuff->property, stuff->type,
- stuff->format, stuff->mode, len, (void*)&stuff[1]);
+ stuff->format, stuff->mode, len, (void *) &stuff[1]);
return rc;
}
int
ProcXIDeleteProperty(ClientPtr client)
{
- DeviceIntPtr dev;
- int rc;
+ DeviceIntPtr dev;
+ int rc;
+
REQUEST(xXIDeletePropertyReq);
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
UpdateCurrentTime();
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetPropAccess);
if (rc != Success)
return rc;
- if (!ValidAtom(stuff->property))
- {
+ if (!ValidAtom(stuff->property)) {
client->errorValue = stuff->property;
return BadAtom;
}
@@ -1204,30 +1168,28 @@ ProcXIDeleteProperty(ClientPtr client)
return rc;
}
-
int
ProcXIGetProperty(ClientPtr client)
{
REQUEST(xXIGetPropertyReq);
- DeviceIntPtr dev;
- xXIGetPropertyReply reply;
- int length;
- int rc, format, nitems, bytes_after;
- char *data;
- Atom type;
+ DeviceIntPtr dev;
+ xXIGetPropertyReply reply;
+ int length;
+ int rc, format, nitems, bytes_after;
+ char *data;
+ Atom type;
REQUEST_SIZE_MATCH(xXIGetPropertyReq);
if (stuff->delete)
UpdateCurrentTime();
- rc = dixLookupDevice (&dev, stuff->deviceid, client,
- stuff->delete ? DixSetPropAccess :
- DixGetPropAccess);
+ rc = dixLookupDevice(&dev, stuff->deviceid, client,
+ stuff->delete ? DixSetPropAccess : DixGetPropAccess);
if (rc != Success)
return rc;
rc = get_property(client, dev, stuff->property, stuff->type,
- stuff->delete, stuff->offset, stuff->len,
- &bytes_after, &type, &format, &nitems, &length, &data);
+ stuff->delete, stuff->offset, stuff->len,
+ &bytes_after, &type, &format, &nitems, &length, &data);
if (rc != Success)
return rc;
@@ -1246,24 +1208,28 @@ ProcXIGetProperty(ClientPtr client)
WriteReplyToClient(client, sizeof(xXIGetPropertyReply), &reply);
- if (length)
- {
+ if (length) {
switch (reply.format) {
- case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
- case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
- default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
+ case 32:
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
+ break;
+ case 16:
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
+ break;
+ default:
+ client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
+ break;
}
WriteSwappedDataToClient(client, length, data);
}
/* delete the Property */
- if (stuff->delete && (reply.bytes_after == 0))
- {
+ if (stuff->delete && (reply.bytes_after == 0)) {
XIPropertyPtr prop, *prev;
- for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
- {
- if (prop->propertyName == stuff->property)
- {
+
+ for (prev = &dev->properties.properties; (prop = *prev);
+ prev = &prop->next) {
+ if (prop->propertyName == stuff->property) {
*prev = prop->next;
XIDestroyDeviceProperty(prop);
break;
@@ -1327,21 +1293,18 @@ SProcXIGetProperty(ClientPtr client)
return (ProcXIGetProperty(client));
}
-
void
-SRepXIListProperties(ClientPtr client, int size,
- xXIListPropertiesReply *rep)
+SRepXIListProperties(ClientPtr client, int size, xXIListPropertiesReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_properties);
/* properties will be swapped later, see ProcXIListProperties */
- WriteToClient(client, size, (char*)rep);
+ WriteToClient(client, size, (char *) rep);
}
void
-SRepXIGetProperty(ClientPtr client, int size,
- xXIGetPropertyReply *rep)
+SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
@@ -1349,5 +1312,5 @@ SRepXIGetProperty(ClientPtr client, int size,
swapl(&rep->bytes_after);
swapl(&rep->num_items);
/* data will be swapped, see ProcXIGetProperty */
- WriteToClient(client, size, (char*)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/xiproperty.h b/xorg-server/Xi/xiproperty.h
index a610e083c..482c834ed 100644
--- a/xorg-server/Xi/xiproperty.h
+++ b/xorg-server/Xi/xiproperty.h
@@ -1,68 +1,67 @@
-/*
- * Copyright © 2008 Peter Hutterer
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Author: Peter Hutterer
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef XIPROPERTY_H
-#define XIPROPERTY_H 1
-
-int ProcXListDeviceProperties (ClientPtr client);
-int ProcXChangeDeviceProperty (ClientPtr client);
-int ProcXDeleteDeviceProperty (ClientPtr client);
-int ProcXGetDeviceProperty (ClientPtr client);
-
-/* request swapping */
-int SProcXListDeviceProperties (ClientPtr client);
-int SProcXChangeDeviceProperty (ClientPtr client);
-int SProcXDeleteDeviceProperty (ClientPtr client);
-int SProcXGetDeviceProperty (ClientPtr client);
-
-/* reply swapping */
-void SRepXListDeviceProperties(ClientPtr client, int size,
- xListDevicePropertiesReply *rep);
-void SRepXGetDeviceProperty(ClientPtr client, int size,
- xGetDevicePropertyReply *rep);
-
-/* XI2 request/reply handling */
-int ProcXIListProperties (ClientPtr client);
-int ProcXIChangeProperty (ClientPtr client);
-int ProcXIDeleteProperty (ClientPtr client);
-int ProcXIGetProperty (ClientPtr client);
-
-int SProcXIListProperties (ClientPtr client);
-int SProcXIChangeProperty (ClientPtr client);
-int SProcXIDeleteProperty (ClientPtr client);
-int SProcXIGetProperty (ClientPtr client);
-
-void SRepXIListProperties(ClientPtr client, int size,
- xXIListPropertiesReply *rep);
-void SRepXIGetProperty(ClientPtr client, int size,
- xXIGetPropertyReply *rep);
-
-void XIResetProperties(void);
-
-#endif /* XIPROPERTY_H */
+/*
+ * Copyright © 2008 Peter Hutterer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Peter Hutterer
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef XIPROPERTY_H
+#define XIPROPERTY_H 1
+
+int ProcXListDeviceProperties(ClientPtr client);
+int ProcXChangeDeviceProperty(ClientPtr client);
+int ProcXDeleteDeviceProperty(ClientPtr client);
+int ProcXGetDeviceProperty(ClientPtr client);
+
+/* request swapping */
+int SProcXListDeviceProperties(ClientPtr client);
+int SProcXChangeDeviceProperty(ClientPtr client);
+int SProcXDeleteDeviceProperty(ClientPtr client);
+int SProcXGetDeviceProperty(ClientPtr client);
+
+/* reply swapping */
+void SRepXListDeviceProperties(ClientPtr client, int size,
+ xListDevicePropertiesReply * rep);
+void SRepXGetDeviceProperty(ClientPtr client, int size,
+ xGetDevicePropertyReply * rep);
+
+/* XI2 request/reply handling */
+int ProcXIListProperties(ClientPtr client);
+int ProcXIChangeProperty(ClientPtr client);
+int ProcXIDeleteProperty(ClientPtr client);
+int ProcXIGetProperty(ClientPtr client);
+
+int SProcXIListProperties(ClientPtr client);
+int SProcXIChangeProperty(ClientPtr client);
+int SProcXIDeleteProperty(ClientPtr client);
+int SProcXIGetProperty(ClientPtr client);
+
+void SRepXIListProperties(ClientPtr client, int size,
+ xXIListPropertiesReply * rep);
+void SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep);
+
+void XIResetProperties(void);
+
+#endif /* XIPROPERTY_H */
diff --git a/xorg-server/Xi/xiquerydevice.c b/xorg-server/Xi/xiquerydevice.c
index 0879080ad..749bc24c9 100644
--- a/xorg-server/Xi/xiquerydevice.c
+++ b/xorg-server/Xi/xiquerydevice.c
@@ -47,9 +47,9 @@
static Bool ShouldSkipDevice(ClientPtr client, int deviceid, DeviceIntPtr d);
static int
-ListDeviceInfo(ClientPtr client, DeviceIntPtr dev, xXIDeviceInfo* info);
+ ListDeviceInfo(ClientPtr client, DeviceIntPtr dev, xXIDeviceInfo * info);
static int SizeDeviceInfo(DeviceIntPtr dev);
-static void SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info);
+static void SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo * info);
int
SProcXIQueryDevice(ClientPtr client)
{
@@ -74,31 +74,27 @@ ProcXIQueryDevice(ClientPtr client)
REQUEST(xXIQueryDeviceReq);
REQUEST_SIZE_MATCH(xXIQueryDeviceReq);
- if (stuff->deviceid != XIAllDevices && stuff->deviceid != XIAllMasterDevices)
- {
+ if (stuff->deviceid != XIAllDevices &&
+ stuff->deviceid != XIAllMasterDevices) {
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
- if (rc != Success)
- {
+ if (rc != Success) {
client->errorValue = stuff->deviceid;
return rc;
}
len += SizeDeviceInfo(dev);
}
- else
- {
+ else {
skip = calloc(sizeof(Bool), inputInfo.numDevices);
if (!skip)
return BadAlloc;
- for (dev = inputInfo.devices; dev; dev = dev->next, i++)
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next, i++) {
skip[i] = ShouldSkipDevice(client, stuff->deviceid, dev);
if (!skip[i])
len += SizeDeviceInfo(dev);
}
- for (dev = inputInfo.off_devices; dev; dev = dev->next, i++)
- {
+ for (dev = inputInfo.off_devices; dev; dev = dev->next, i++) {
skip[i] = ShouldSkipDevice(client, stuff->deviceid, dev);
if (!skip[i])
len += SizeDeviceInfo(dev);
@@ -115,39 +111,34 @@ ProcXIQueryDevice(ClientPtr client)
rep.repType = X_Reply;
rep.RepType = X_XIQueryDevice;
rep.sequenceNumber = client->sequence;
- rep.length = len/4;
+ rep.length = len / 4;
rep.num_devices = 0;
ptr = info;
- if (dev)
- {
- len = ListDeviceInfo(client, dev, (xXIDeviceInfo*)info);
+ if (dev) {
+ len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
if (client->swapped)
- SwapDeviceInfo(dev, (xXIDeviceInfo*)info);
+ SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
info += len;
rep.num_devices = 1;
- } else
- {
+ }
+ else {
i = 0;
- for (dev = inputInfo.devices; dev; dev = dev->next, i++)
- {
- if (!skip[i])
- {
- len = ListDeviceInfo(client, dev, (xXIDeviceInfo*)info);
+ for (dev = inputInfo.devices; dev; dev = dev->next, i++) {
+ if (!skip[i]) {
+ len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
if (client->swapped)
- SwapDeviceInfo(dev, (xXIDeviceInfo*)info);
+ SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
info += len;
rep.num_devices++;
}
}
- for (dev = inputInfo.off_devices; dev; dev = dev->next, i++)
- {
- if (!skip[i])
- {
- len = ListDeviceInfo(client, dev, (xXIDeviceInfo*)info);
+ for (dev = inputInfo.off_devices; dev; dev = dev->next, i++) {
+ if (!skip[i]) {
+ len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
if (client->swapped)
- SwapDeviceInfo(dev, (xXIDeviceInfo*)info);
+ SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
info += len;
rep.num_devices++;
}
@@ -163,7 +154,7 @@ ProcXIQueryDevice(ClientPtr client)
}
void
-SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply *rep)
+SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
@@ -171,10 +162,9 @@ SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply *rep)
/* Device info is already swapped, see ProcXIQueryDevice */
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
-
/**
* @return Whether the device should be included in the returned list.
*/
@@ -182,9 +172,9 @@ static Bool
ShouldSkipDevice(ClientPtr client, int deviceid, DeviceIntPtr dev)
{
/* if all devices are not being queried, only master devices are */
- if (deviceid == XIAllDevices || IsMaster(dev))
- {
+ if (deviceid == XIAllDevices || IsMaster(dev)) {
int rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGetAttrAccess);
+
if (rc == Success)
return FALSE;
}
@@ -215,23 +205,22 @@ SizeDeviceClasses(DeviceIntPtr dev)
{
int len = 0;
- if (dev->button)
- {
+ if (dev->button) {
len += sizeof(xXIButtonInfo);
len += dev->button->numButtons * sizeof(Atom);
len += pad_to_int32(bits_to_bytes(dev->button->numButtons));
}
- if (dev->key)
- {
+ if (dev->key) {
XkbDescPtr xkb = dev->key->xkbInfo->desc;
+
len += sizeof(xXIKeyInfo);
len += (xkb->max_key_code - xkb->min_key_code + 1) * sizeof(uint32_t);
}
- if (dev->valuator)
- {
+ if (dev->valuator) {
int i;
+
len += (sizeof(xXIValuatorInfo)) * dev->valuator->numAxes;
for (i = 0; i < dev->valuator->numAxes; i++) {
@@ -246,36 +235,35 @@ SizeDeviceClasses(DeviceIntPtr dev)
return len;
}
-
/**
* Write button information into info.
* @return Number of bytes written into info.
*/
int
-ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info, Bool reportState)
+ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo * info, Bool reportState)
{
unsigned char *bits;
int mask_len;
int i;
if (!dev || !dev->button)
- return 0;
+ return 0;
mask_len = bytes_to_int32(bits_to_bytes(dev->button->numButtons));
info->type = ButtonClass;
info->num_buttons = dev->button->numButtons;
info->length = bytes_to_int32(sizeof(xXIButtonInfo)) +
- info->num_buttons + mask_len;
+ info->num_buttons + mask_len;
info->sourceid = dev->button->sourceid;
- bits = (unsigned char*)&info[1];
+ bits = (unsigned char *) &info[1];
memset(bits, 0, mask_len * 4);
if (reportState)
- for (i = 0; i < dev->button->numButtons; i++)
- if (BitIsOn(dev->button->down, i))
- SetBit(bits, i);
+ for (i = 0; i < dev->button->numButtons; i++)
+ if (BitIsOn(dev->button->down, i))
+ SetBit(bits, i);
bits += mask_len * 4;
memcpy(bits, dev->button->labels, dev->button->numButtons * sizeof(Atom));
@@ -284,15 +272,16 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info, Bool reportState)
}
static void
-SwapButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info)
+SwapButtonInfo(DeviceIntPtr dev, xXIButtonInfo * info)
{
Atom *btn;
int i;
+
swaps(&info->type);
swaps(&info->length);
swaps(&info->sourceid);
- for (i = 0, btn = (Atom*)&info[1]; i < info->num_buttons; i++, btn++)
+ for (i = 0, btn = (Atom *) &info[1]; i < info->num_buttons; i++, btn++)
swapl(btn);
swaps(&info->num_buttons);
@@ -303,7 +292,7 @@ SwapButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info)
* @return Number of bytes written into info.
*/
int
-ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
+ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo * info)
{
int i;
XkbDescPtr xkb = dev->key->xkbInfo->desc;
@@ -311,10 +300,10 @@ ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
info->type = KeyClass;
info->num_keycodes = xkb->max_key_code - xkb->min_key_code + 1;
- info->length = sizeof(xXIKeyInfo)/4 + info->num_keycodes;
+ info->length = sizeof(xXIKeyInfo) / 4 + info->num_keycodes;
info->sourceid = dev->key->sourceid;
- kc = (uint32_t*)&info[1];
+ kc = (uint32_t *) & info[1];
for (i = xkb->min_key_code; i <= xkb->max_key_code; i++, kc++)
*kc = i;
@@ -322,15 +311,17 @@ ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
}
static void
-SwapKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
+SwapKeyInfo(DeviceIntPtr dev, xXIKeyInfo * info)
{
uint32_t *key;
int i;
+
swaps(&info->type);
swaps(&info->length);
swaps(&info->sourceid);
- for (i = 0, key = (uint32_t*)&info[1]; i < info->num_keycodes; i++, key++)
+ for (i = 0, key = (uint32_t *) & info[1]; i < info->num_keycodes;
+ i++, key++)
swapl(key);
swaps(&info->num_keycodes);
@@ -342,13 +333,13 @@ SwapKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
* @return The number of bytes written into info.
*/
int
-ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber,
- Bool reportState)
+ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo * info, int axisnumber,
+ Bool reportState)
{
ValuatorClassPtr v = dev->valuator;
info->type = ValuatorClass;
- info->length = sizeof(xXIValuatorInfo)/4;
+ info->length = sizeof(xXIValuatorInfo) / 4;
info->label = v->axes[axisnumber].label;
info->min.integral = v->axes[axisnumber].min_value;
info->min.frac = 0;
@@ -361,13 +352,13 @@ ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber,
info->sourceid = v->sourceid;
if (!reportState)
- info->value = info->min;
+ info->value = info->min;
return info->length * 4;
}
static void
-SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info)
+SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo * info)
{
swaps(&info->type);
swaps(&info->length);
@@ -381,7 +372,7 @@ SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info)
}
int
-ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo *info, int axisnumber)
+ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo * info, int axisnumber)
{
ValuatorClassPtr v = dev->valuator;
AxisInfoPtr axis = &v->axes[axisnumber];
@@ -390,19 +381,19 @@ ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo *info, int axisnumber)
return 0;
info->type = XIScrollClass;
- info->length = sizeof(xXIScrollInfo)/4;
+ info->length = sizeof(xXIScrollInfo) / 4;
info->number = axisnumber;
- switch(axis->scroll.type)
- {
- case SCROLL_TYPE_VERTICAL:
- info->scroll_type = XIScrollTypeVertical;
- break;
- case SCROLL_TYPE_HORIZONTAL:
- info->scroll_type = XIScrollTypeHorizontal;
- break;
- default:
- ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n", axis->scroll.type);
- break;
+ switch (axis->scroll.type) {
+ case SCROLL_TYPE_VERTICAL:
+ info->scroll_type = XIScrollTypeVertical;
+ break;
+ case SCROLL_TYPE_HORIZONTAL:
+ info->scroll_type = XIScrollTypeHorizontal;
+ break;
+ default:
+ ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n",
+ axis->scroll.type);
+ break;
}
info->increment = double_to_fp3232(axis->scroll.increment);
info->sourceid = v->sourceid;
@@ -418,7 +409,7 @@ ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo *info, int axisnumber)
}
static void
-SwapScrollInfo(DeviceIntPtr dev, xXIScrollInfo* info)
+SwapScrollInfo(DeviceIntPtr dev, xXIScrollInfo * info)
{
swaps(&info->type);
swaps(&info->length);
@@ -435,7 +426,7 @@ SwapScrollInfo(DeviceIntPtr dev, xXIScrollInfo* info)
* @return The number of bytes written into info.
*/
int
-ListTouchInfo(DeviceIntPtr dev, xXITouchInfo *touch)
+ListTouchInfo(DeviceIntPtr dev, xXITouchInfo * touch)
{
touch->type = XITouchClass;
touch->length = sizeof(xXITouchInfo) >> 2;
@@ -447,28 +438,30 @@ ListTouchInfo(DeviceIntPtr dev, xXITouchInfo *touch)
}
static void
-SwapTouchInfo(DeviceIntPtr dev, xXITouchInfo* touch)
+SwapTouchInfo(DeviceIntPtr dev, xXITouchInfo * touch)
{
swaps(&touch->type);
swaps(&touch->length);
swaps(&touch->sourceid);
}
-int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
+int
+GetDeviceUse(DeviceIntPtr dev, uint16_t * attachment)
{
DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
int use;
- if (IsMaster(dev))
- {
+ if (IsMaster(dev)) {
DeviceIntPtr paired = GetPairedDevice(dev);
+
use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard;
*attachment = (paired ? paired->id : 0);
- } else if (!IsFloating(dev))
- {
+ }
+ else if (!IsFloating(dev)) {
use = IsPointerDevice(master) ? XISlavePointer : XISlaveKeyboard;
*attachment = master->id;
- } else
+ }
+ else
use = XIFloatingSlave;
return use;
@@ -480,9 +473,9 @@ int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
* @return The number of bytes used.
*/
static int
-ListDeviceInfo(ClientPtr client, DeviceIntPtr dev, xXIDeviceInfo* info)
+ListDeviceInfo(ClientPtr client, DeviceIntPtr dev, xXIDeviceInfo * info)
{
- char *any = (char*)&info[1];
+ char *any = (char *) &info[1];
int len = 0, total_len = 0;
info->deviceid = dev->id;
@@ -509,7 +502,7 @@ ListDeviceInfo(ClientPtr client, DeviceIntPtr dev, xXIDeviceInfo* info)
*/
int
ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
- char *any, uint16_t *nclasses)
+ char *any, uint16_t * nclasses)
{
int total_len = 0;
int len;
@@ -519,43 +512,38 @@ ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
/* Check if the current device state should be suppressed */
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess);
- if (dev->button)
- {
+ if (dev->button) {
(*nclasses)++;
- len = ListButtonInfo(dev, (xXIButtonInfo*)any, rc == Success);
+ len = ListButtonInfo(dev, (xXIButtonInfo *) any, rc == Success);
any += len;
total_len += len;
}
- if (dev->key)
- {
+ if (dev->key) {
(*nclasses)++;
- len = ListKeyInfo(dev, (xXIKeyInfo*)any);
+ len = ListKeyInfo(dev, (xXIKeyInfo *) any);
any += len;
total_len += len;
}
- for (i = 0; dev->valuator && i < dev->valuator->numAxes; i++)
- {
+ for (i = 0; dev->valuator && i < dev->valuator->numAxes; i++) {
(*nclasses)++;
- len = ListValuatorInfo(dev, (xXIValuatorInfo*)any, i, rc == Success);
+ len = ListValuatorInfo(dev, (xXIValuatorInfo *) any, i, rc == Success);
any += len;
total_len += len;
}
- for (i = 0; dev->valuator && i < dev->valuator->numAxes; i++)
- {
- len = ListScrollInfo(dev, (xXIScrollInfo*)any, i);
+ for (i = 0; dev->valuator && i < dev->valuator->numAxes; i++) {
+ len = ListScrollInfo(dev, (xXIScrollInfo *) any, i);
if (len)
(*nclasses)++;
any += len;
total_len += len;
}
- if (dev->touch)
- {
+ if (dev->touch) {
(*nclasses)++;
- len = ListTouchInfo(dev, (xXITouchInfo*)any);
+ len = ListTouchInfo(dev, (xXITouchInfo *) any);
any += len;
total_len += len;
}
@@ -564,34 +552,33 @@ ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
}
static void
-SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info)
+SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo * info)
{
- char *any = (char*)&info[1];
+ char *any = (char *) &info[1];
int i;
/* Skip over name */
any += pad_to_int32(info->name_len);
- for (i = 0; i < info->num_classes; i++)
- {
- int len = ((xXIAnyInfo*)any)->length;
- switch(((xXIAnyInfo*)any)->type)
- {
- case XIButtonClass:
- SwapButtonInfo(dev, (xXIButtonInfo*)any);
- break;
- case XIKeyClass:
- SwapKeyInfo(dev, (xXIKeyInfo*)any);
- break;
- case XIValuatorClass:
- SwapValuatorInfo(dev, (xXIValuatorInfo*)any);
- break;
- case XIScrollClass:
- SwapScrollInfo(dev, (xXIScrollInfo*)any);
- break;
- case XITouchClass:
- SwapTouchInfo(dev, (xXITouchInfo*)any);
- break;
+ for (i = 0; i < info->num_classes; i++) {
+ int len = ((xXIAnyInfo *) any)->length;
+
+ switch (((xXIAnyInfo *) any)->type) {
+ case XIButtonClass:
+ SwapButtonInfo(dev, (xXIButtonInfo *) any);
+ break;
+ case XIKeyClass:
+ SwapKeyInfo(dev, (xXIKeyInfo *) any);
+ break;
+ case XIValuatorClass:
+ SwapValuatorInfo(dev, (xXIValuatorInfo *) any);
+ break;
+ case XIScrollClass:
+ SwapScrollInfo(dev, (xXIScrollInfo *) any);
+ break;
+ case XITouchClass:
+ SwapTouchInfo(dev, (xXITouchInfo *) any);
+ break;
}
diff --git a/xorg-server/Xi/xiquerypointer.c b/xorg-server/Xi/xiquerypointer.c
index d01a81394..a2e7442e0 100644
--- a/xorg-server/Xi/xiquerypointer.c
+++ b/xorg-server/Xi/xiquerypointer.c
@@ -33,10 +33,10 @@
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2proto.h>
#include "extnsionst.h"
@@ -78,30 +78,25 @@ ProcXIQueryPointer(ClientPtr client)
SpritePtr pSprite;
XkbStatePtr state;
char *buttons = NULL;
- int buttons_size = 0; /* size of buttons array */
+ int buttons_size = 0; /* size of buttons array */
REQUEST(xXIQueryPointerReq);
REQUEST_SIZE_MATCH(xXIQueryPointerReq);
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
- if (rc != Success)
- {
+ if (rc != Success) {
client->errorValue = stuff->deviceid;
return rc;
}
- if (pDev->valuator == NULL || IsKeyboardDevice(pDev) ||
- (!IsMaster(pDev) && !IsFloating(pDev))) /* no attached devices */
- {
+ if (pDev->valuator == NULL || IsKeyboardDevice(pDev) || (!IsMaster(pDev) && !IsFloating(pDev))) { /* no attached devices */
client->errorValue = stuff->deviceid;
return BadDevice;
}
rc = dixLookupWindow(&pWin, stuff->win, client, DixGetAttrAccess);
- if (rc != Success)
- {
- SendErrorToClient(client, IReqCode, X_XIQueryPointer,
- stuff->win, rc);
+ if (rc != Success) {
+ SendErrorToClient(client, IReqCode, X_XIQueryPointer, stuff->win, rc);
return Success;
}
@@ -125,8 +120,7 @@ ProcXIQueryPointer(ClientPtr client)
rep.root_y = FP1616(pSprite->hot.y, 0);
rep.child = None;
- if (kbd)
- {
+ if (kbd) {
state = &kbd->key->xkbInfo->state;
rep.mods.base_mods = state->base_mods;
rep.mods.latched_mods = state->latched_mods;
@@ -137,10 +131,11 @@ ProcXIQueryPointer(ClientPtr client)
rep.group.locked_group = state->locked_group;
}
- if (pDev->button)
- {
+ if (pDev->button) {
int i, down;
- rep.buttons_len = bytes_to_int32(bits_to_bytes(pDev->button->numButtons));
+
+ rep.buttons_len =
+ bytes_to_int32(bits_to_bytes(pDev->button->numButtons));
rep.length += rep.buttons_len;
buttons_size = rep.buttons_len * 4;
buttons = calloc(1, buttons_size);
@@ -149,41 +144,37 @@ ProcXIQueryPointer(ClientPtr client)
down = pDev->button->buttonsDown;
- for (i = 0; i < pDev->button->numButtons && down; i++)
- {
- if (BitIsOn(pDev->button->down, i))
- {
+ for (i = 0; i < pDev->button->numButtons && down; i++) {
+ if (BitIsOn(pDev->button->down, i)) {
SetBit(buttons, i);
down--;
}
}
- } else
+ }
+ else
rep.buttons_len = 0;
- if (pSprite->hot.pScreen == pWin->drawable.pScreen)
- {
+ if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
rep.same_screen = xTrue;
rep.win_x = FP1616(pSprite->hot.x - pWin->drawable.x, 0);
rep.win_y = FP1616(pSprite->hot.y - pWin->drawable.y, 0);
for (t = pSprite->win; t; t = t->parent)
- if (t->parent == pWin)
- {
+ if (t->parent == pWin) {
rep.child = t->drawable.id;
break;
}
- } else
- {
+ }
+ else {
rep.same_screen = xFalse;
rep.win_x = 0;
rep.win_y = 0;
}
#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
+ if (!noPanoramiXExtension) {
rep.root_x += FP1616(screenInfo.screens[0]->x, 0);
rep.root_y += FP1616(screenInfo.screens[0]->y, 0);
- if (stuff->win == rep.root)
- {
+ if (stuff->win == rep.root) {
rep.win_x += FP1616(screenInfo.screens[0]->x, 0);
rep.win_y += FP1616(screenInfo.screens[0]->y, 0);
}
@@ -207,8 +198,7 @@ ProcXIQueryPointer(ClientPtr client)
*/
void
-SRepXIQueryPointer(ClientPtr client, int size,
- xXIQueryPointerReply * rep)
+SRepXIQueryPointer(ClientPtr client, int size, xXIQueryPointerReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
@@ -220,6 +210,5 @@ SRepXIQueryPointer(ClientPtr client, int size,
swapl(&rep->win_y);
swaps(&rep->buttons_len);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
-
diff --git a/xorg-server/Xi/xiqueryversion.c b/xorg-server/Xi/xiqueryversion.c
index a94061432..fc0ca751b 100644
--- a/xorg-server/Xi/xiqueryversion.c
+++ b/xorg-server/Xi/xiqueryversion.c
@@ -33,7 +33,6 @@
#include <dix-config.h>
#endif
-
#include "inputstr.h"
#include <X11/Xmd.h>
@@ -45,7 +44,8 @@
#include "xiqueryversion.h"
#include "misc.h"
-extern XExtensionVersion XIVersion; /* defined in getvers.c */
+extern XExtensionVersion XIVersion; /* defined in getvers.c */
+
/**
* Return the supported XI version.
*
@@ -63,21 +63,28 @@ ProcXIQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xXIQueryVersionReq);
/* This request only exists after XI2 */
- if (stuff->major_version < 2)
- {
+ if (stuff->major_version < 2) {
client->errorValue = stuff->major_version;
return BadValue;
}
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
- if (version_compare(XIVersion.major_version, XIVersion.minor_version,
- stuff->major_version, stuff->minor_version) > 0)
+ if (pXIClient->major_version &&
+ (stuff->major_version != pXIClient->major_version ||
+ stuff->minor_version != pXIClient->minor_version))
{
+ client->errorValue = stuff->major_version;
+ return BadValue;
+ }
+
+
+ if (version_compare(XIVersion.major_version, XIVersion.minor_version,
+ stuff->major_version, stuff->minor_version) > 0) {
major = stuff->major_version;
minor = stuff->minor_version;
- } else
- {
+ }
+ else {
major = XIVersion.major_version;
minor = XIVersion.minor_version;
}
@@ -112,11 +119,11 @@ SProcXIQueryVersion(ClientPtr client)
}
void
-SRepXIQueryVersion(ClientPtr client, int size, xXIQueryVersionReply *rep)
+SRepXIQueryVersion(ClientPtr client, int size, xXIQueryVersionReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->major_version);
swaps(&rep->minor_version);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
diff --git a/xorg-server/Xi/xiselectev.c b/xorg-server/Xi/xiselectev.c
index 1b6c47a87..43a67c833 100644
--- a/xorg-server/Xi/xiselectev.c
+++ b/xorg-server/Xi/xiselectev.c
@@ -27,7 +27,6 @@
#include <dix-config.h>
#endif
-
#include "dixstruct.h"
#include "windowstr.h"
#include "exglobals.h"
@@ -43,15 +42,14 @@
*
* @return BadValue if at least one invalid bit is set or Success otherwise.
*/
-int XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len)
+int
+XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len)
{
- if (len >= XIMaskLen(XI2LASTEVENT))
- {
+ if (len >= XIMaskLen(XI2LASTEVENT)) {
int i;
- for (i = XI2LASTEVENT + 1; i < len * 8; i++)
- {
- if (BitIsOn(mask, i))
- {
+
+ for (i = XI2LASTEVENT + 1; i < len * 8; i++) {
+ if (BitIsOn(mask, i)) {
client->errorValue = i;
return BadValue;
}
@@ -65,7 +63,7 @@ int
SProcXISelectEvents(ClientPtr client)
{
int i;
- xXIEventMask* evmask;
+ xXIEventMask *evmask;
REQUEST(xXISelectEventsReq);
swaps(&stuff->length);
@@ -73,12 +71,12 @@ SProcXISelectEvents(ClientPtr client)
swapl(&stuff->win);
swaps(&stuff->num_masks);
- evmask = (xXIEventMask*)&stuff[1];
- for (i = 0; i < stuff->num_masks; i++)
- {
+ evmask = (xXIEventMask *) &stuff[1];
+ for (i = 0; i < stuff->num_masks; i++) {
swaps(&evmask->deviceid);
swaps(&evmask->mask_len);
- evmask = (xXIEventMask*)(((char*)&evmask[1]) + evmask->mask_len * 4);
+ evmask =
+ (xXIEventMask *) (((char *) &evmask[1]) + evmask->mask_len * 4);
}
return (ProcXISelectEvents(client));
@@ -108,10 +106,9 @@ ProcXISelectEvents(ClientPtr client)
len = sz_xXISelectEventsReq;
/* check request validity */
- evmask = (xXIEventMask*)&stuff[1];
+ evmask = (xXIEventMask *) &stuff[1];
num_masks = stuff->num_masks;
- while(num_masks--)
- {
+ while (num_masks--) {
len += sizeof(xXIEventMask) + evmask->mask_len * 4;
if (bytes_to_int32(len) > stuff->length)
@@ -127,20 +124,19 @@ ProcXISelectEvents(ClientPtr client)
return rc;
/* hierarchy event mask is not allowed on devices */
- if (evmask->deviceid != XIAllDevices && evmask->mask_len >= 1)
- {
- unsigned char *bits = (unsigned char*)&evmask[1];
- if (BitIsOn(bits, XI_HierarchyChanged))
- {
+ if (evmask->deviceid != XIAllDevices && evmask->mask_len >= 1) {
+ unsigned char *bits = (unsigned char *) &evmask[1];
+
+ if (BitIsOn(bits, XI_HierarchyChanged)) {
client->errorValue = XI_HierarchyChanged;
return BadValue;
}
}
/* Raw events may only be selected on root windows */
- if (win->parent && evmask->mask_len >= 1)
- {
- unsigned char *bits = (unsigned char*)&evmask[1];
+ if (win->parent && evmask->mask_len >= 1) {
+ unsigned char *bits = (unsigned char *) &evmask[1];
+
if (BitIsOn(bits, XI_RawKeyPress) ||
BitIsOn(bits, XI_RawKeyRelease) ||
BitIsOn(bits, XI_RawButtonPress) ||
@@ -148,16 +144,14 @@ ProcXISelectEvents(ClientPtr client)
BitIsOn(bits, XI_RawMotion) ||
BitIsOn(bits, XI_RawTouchBegin) ||
BitIsOn(bits, XI_RawTouchUpdate) ||
- BitIsOn(bits, XI_RawTouchEnd))
- {
+ BitIsOn(bits, XI_RawTouchEnd)) {
client->errorValue = XI_RawKeyPress;
return BadValue;
}
}
- if (evmask->mask_len >= 1)
- {
- unsigned char *bits = (unsigned char*)&evmask[1];
+ if (evmask->mask_len >= 1) {
+ unsigned char *bits = (unsigned char *) &evmask[1];
/* All three touch events must be selected at once */
if ((BitIsOn(bits, XI_TouchBegin) ||
@@ -166,8 +160,7 @@ ProcXISelectEvents(ClientPtr client)
BitIsOn(bits, XI_TouchEnd)) &&
(!BitIsOn(bits, XI_TouchBegin) ||
!BitIsOn(bits, XI_TouchUpdate) ||
- !BitIsOn(bits, XI_TouchEnd)))
- {
+ !BitIsOn(bits, XI_TouchEnd))) {
client->errorValue = XI_TouchBegin;
return BadValue;
}
@@ -175,22 +168,22 @@ ProcXISelectEvents(ClientPtr client)
/* Only one client per window may select for touch events on the
* same devices, including master devices.
* XXX: This breaks if a device goes from floating to attached. */
- if (BitIsOn(bits, XI_TouchBegin))
- {
+ if (BitIsOn(bits, XI_TouchBegin)) {
OtherInputMasks *inputMasks = wOtherInputMasks(win);
InputClients *iclient = NULL;
+
if (inputMasks)
iclient = inputMasks->inputClients;
- for (; iclient; iclient = iclient->next)
- {
+ for (; iclient; iclient = iclient->next) {
DeviceIntPtr dummy;
if (CLIENT_ID(iclient->resource) == client->index)
continue;
- dixLookupDevice(&dummy, evmask->deviceid, serverClient, DixReadAccess);
+ dixLookupDevice(&dummy, evmask->deviceid, serverClient,
+ DixReadAccess);
if (!dummy)
- return BadImplementation; /* this shouldn't happen */
+ return BadImplementation; /* this shouldn't happen */
if (xi2mask_isset(iclient->xi2mask, dummy, XI_TouchBegin))
return BadAccess;
@@ -198,11 +191,13 @@ ProcXISelectEvents(ClientPtr client)
}
}
- if (XICheckInvalidMaskBits(client, (unsigned char*)&evmask[1],
+ if (XICheckInvalidMaskBits(client, (unsigned char *) &evmask[1],
evmask->mask_len * 4) != Success)
return BadValue;
- evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
+ evmask =
+ (xXIEventMask *) (((unsigned char *) evmask) +
+ evmask->mask_len * 4);
evmask++;
}
@@ -210,21 +205,22 @@ ProcXISelectEvents(ClientPtr client)
return BadLength;
/* Set masks on window */
- evmask = (xXIEventMask*)&stuff[1];
+ evmask = (xXIEventMask *) &stuff[1];
num_masks = stuff->num_masks;
- while(num_masks--)
- {
+ while (num_masks--) {
if (evmask->deviceid == XIAllDevices ||
- evmask->deviceid == XIAllMasterDevices)
- {
+ evmask->deviceid == XIAllMasterDevices) {
dummy.id = evmask->deviceid;
dev = &dummy;
- } else
+ }
+ else
dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
if (XISetEventMask(dev, win, client, evmask->mask_len * 4,
- (unsigned char*)&evmask[1]) != Success)
+ (unsigned char *) &evmask[1]) != Success)
return BadAlloc;
- evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
+ evmask =
+ (xXIEventMask *) (((unsigned char *) evmask) +
+ evmask->mask_len * 4);
evmask++;
}
@@ -234,7 +230,6 @@ ProcXISelectEvents(ClientPtr client)
return Success;
}
-
int
SProcXIGetSelectedEvents(ClientPtr client)
{
@@ -272,59 +267,53 @@ ProcXIGetSelectedEvents(ClientPtr client)
reply.num_masks = 0;
masks = wOtherInputMasks(win);
- if (masks)
- {
- for (others = wOtherInputMasks(win)->inputClients; others;
- others = others->next) {
- if (SameClient(others, client)) {
+ if (masks) {
+ for (others = wOtherInputMasks(win)->inputClients; others;
+ others = others->next) {
+ if (SameClient(others, client)) {
break;
}
}
}
- if (!others)
- {
+ if (!others) {
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
return Success;
}
- buffer = calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
+ buffer =
+ calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
if (!buffer)
return BadAlloc;
- evmask = (xXIEventMask*)buffer;
- for (i = 0; i < MAXDEVICES; i++)
- {
+ evmask = (xXIEventMask *) buffer;
+ for (i = 0; i < MAXDEVICES; i++) {
int j;
const unsigned char *devmask = xi2mask_get_one_mask(others->xi2mask, i);
- if (i > 2)
- {
+ if (i > 2) {
rc = dixLookupDevice(&dev, i, client, DixGetAttrAccess);
if (rc != Success)
continue;
}
+ for (j = xi2mask_mask_size(others->xi2mask) - 1; j >= 0; j--) {
+ if (devmask[j] != 0) {
+ int mask_len = (j + 4) / 4; /* j is an index, hence + 4, not + 3 */
- for (j = xi2mask_mask_size(others->xi2mask) - 1; j >= 0; j--)
- {
- if (devmask[j] != 0)
- {
- int mask_len = (j + 4)/4; /* j is an index, hence + 4, not + 3 */
evmask->deviceid = i;
evmask->mask_len = mask_len;
reply.num_masks++;
- reply.length += sizeof(xXIEventMask)/4 + evmask->mask_len;
+ reply.length += sizeof(xXIEventMask) / 4 + evmask->mask_len;
- if (client->swapped)
- {
+ if (client->swapped) {
swaps(&evmask->deviceid);
swaps(&evmask->mask_len);
}
memcpy(&evmask[1], devmask, j + 1);
- evmask = (xXIEventMask*)((char*)evmask +
- sizeof(xXIEventMask) + mask_len * 4);
+ evmask = (xXIEventMask *) ((char *) evmask +
+ sizeof(xXIEventMask) + mask_len * 4);
break;
}
}
@@ -339,13 +328,12 @@ ProcXIGetSelectedEvents(ClientPtr client)
return Success;
}
-void SRepXIGetSelectedEvents(ClientPtr client,
- int len, xXIGetSelectedEventsReply *rep)
+void
+SRepXIGetSelectedEvents(ClientPtr client,
+ int len, xXIGetSelectedEventsReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_masks);
- WriteToClient(client, len, (char *)rep);
+ WriteToClient(client, len, (char *) rep);
}
-
-
diff --git a/xorg-server/Xi/xisetclientpointer.c b/xorg-server/Xi/xisetclientpointer.c
index 934747d30..38ff51e86 100644
--- a/xorg-server/Xi/xisetclientpointer.c
+++ b/xorg-server/Xi/xisetclientpointer.c
@@ -30,16 +30,15 @@
* default value.
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
-#include "scrnintstr.h" /* screen structure */
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2proto.h>
#include "extnsionst.h"
@@ -69,36 +68,32 @@ ProcXISetClientPointer(ClientPtr client)
REQUEST(xXISetClientPointerReq);
REQUEST_SIZE_MATCH(xXISetClientPointerReq);
-
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixManageAccess);
- if (rc != Success)
- {
+ if (rc != Success) {
client->errorValue = stuff->deviceid;
return rc;
}
- if (!IsMaster(pDev))
- {
+ if (!IsMaster(pDev)) {
client->errorValue = stuff->deviceid;
return BadDevice;
}
pDev = GetMaster(pDev, MASTER_POINTER);
- if (stuff->win != None)
- {
+ if (stuff->win != None) {
rc = dixLookupClient(&targetClient, stuff->win, client,
- DixManageAccess);
+ DixManageAccess);
if (rc != Success)
return BadWindow;
- } else
+ }
+ else
targetClient = client;
rc = SetClientPointer(targetClient, pDev);
- if (rc != Success)
- {
+ if (rc != Success) {
client->errorValue = stuff->deviceid;
return rc;
}
diff --git a/xorg-server/Xi/xiwarppointer.c b/xorg-server/Xi/xiwarppointer.c
index 11ab241b5..3f051f759 100644
--- a/xorg-server/Xi/xiwarppointer.c
+++ b/xorg-server/Xi/xiwarppointer.c
@@ -33,18 +33,17 @@
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
-#include "scrnintstr.h" /* screen structure */
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2proto.h>
#include "extnsionst.h"
#include "exevents.h"
#include "exglobals.h"
-#include "mipointer.h" /* for miPointerUpdateSprite */
-
+#include "mipointer.h" /* for miPointerUpdateSprite */
#include "xiwarppointer.h"
/***********************************************************************
@@ -89,24 +88,20 @@ ProcXIWarpPointer(ClientPtr client)
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
- if (rc != Success)
- {
+ if (rc != Success) {
client->errorValue = stuff->deviceid;
return rc;
}
if ((!IsMaster(pDev) && !IsFloating(pDev)) ||
- (IsMaster(pDev) && !IsPointerDevice(pDev)))
- {
+ (IsMaster(pDev) && !IsPointerDevice(pDev))) {
client->errorValue = stuff->deviceid;
return BadDevice;
}
- if (stuff->dst_win != None)
- {
+ if (stuff->dst_win != None) {
rc = dixLookupWindow(&dest, stuff->dst_win, client, DixGetAttrAccess);
- if (rc != Success)
- {
+ if (rc != Success) {
client->errorValue = stuff->dst_win;
return rc;
}
@@ -116,19 +111,17 @@ ProcXIWarpPointer(ClientPtr client)
x = pSprite->hotPhys.x;
y = pSprite->hotPhys.y;
- src_x = stuff->src_x / (double)(1 << 16);
- src_y = stuff->src_y / (double)(1 << 16);
- dst_x = stuff->dst_x / (double)(1 << 16);
- dst_y = stuff->dst_y / (double)(1 << 16);
+ src_x = stuff->src_x / (double) (1 << 16);
+ src_y = stuff->src_y / (double) (1 << 16);
+ dst_x = stuff->dst_x / (double) (1 << 16);
+ dst_y = stuff->dst_y / (double) (1 << 16);
- if (stuff->src_win != None)
- {
+ if (stuff->src_win != None) {
int winX, winY;
WindowPtr src;
rc = dixLookupWindow(&src, stuff->src_win, client, DixGetAttrAccess);
- if (rc != Success)
- {
+ if (rc != Success) {
client->errorValue = stuff->src_win;
return rc;
}
@@ -136,22 +129,22 @@ ProcXIWarpPointer(ClientPtr client)
winX = src->drawable.x;
winY = src->drawable.y;
if (src->drawable.pScreen != pSprite->hotPhys.pScreen ||
- x < winX + src_x ||
- y < winY + src_y ||
- (stuff->src_width != 0 &&
- winX + src_x + (int)stuff->src_width < 0) ||
- (stuff->src_height != 0 &&
- winY + src_y + (int)stuff->src_height < y) ||
- !PointInWindowIsVisible(src, x, y))
+ x < winX + src_x ||
+ y < winY + src_y ||
+ (stuff->src_width != 0 &&
+ winX + src_x + (int) stuff->src_width < 0) ||
+ (stuff->src_height != 0 &&
+ winY + src_y + (int) stuff->src_height < y) ||
+ !PointInWindowIsVisible(src, x, y))
return Success;
}
- if (dest)
- {
+ if (dest) {
x = dest->drawable.x;
y = dest->drawable.y;
newScreen = dest->drawable.pScreen;
- } else
+ }
+ else
newScreen = pSprite->hotPhys.pScreen;
x += dst_x;
@@ -167,8 +160,7 @@ ProcXIWarpPointer(ClientPtr client)
else if (y > newScreen->height)
y = newScreen->height - 1;
- if (newScreen == pSprite->hotPhys.pScreen)
- {
+ if (newScreen == pSprite->hotPhys.pScreen) {
if (x < pSprite->physLimits.x1)
x = pSprite->physLimits.x1;
else if (x >= pSprite->physLimits.x2)
@@ -181,9 +173,9 @@ ProcXIWarpPointer(ClientPtr client)
if (pSprite->hotShape)
ConfineToShape(pDev, pSprite->hotShape, &x, &y);
- (*newScreen->SetCursorPosition)(pDev, newScreen, x, y, TRUE);
- } else if (!PointerConfinedToScreen(pDev))
- {
+ (*newScreen->SetCursorPosition) (pDev, newScreen, x, y, TRUE);
+ }
+ else if (!PointerConfinedToScreen(pDev)) {
NewCurrentScreen(pDev, newScreen, x, y);
}
@@ -196,4 +188,3 @@ ProcXIWarpPointer(ClientPtr client)
here though. */
return Success;
}
-
diff --git a/xorg-server/composite/compalloc.c b/xorg-server/composite/compalloc.c
index 5b53e6931..e85ade0f0 100644
--- a/xorg-server/composite/compalloc.c
+++ b/xorg-server/composite/compalloc.c
@@ -48,23 +48,20 @@
#include "compint.h"
static void
-compScreenUpdate (ScreenPtr pScreen)
+compScreenUpdate(ScreenPtr pScreen)
{
- compCheckTree (pScreen);
- compPaintChildrenToWindow (pScreen->root);
+ compCheckTree(pScreen);
+ compPaintChildrenToWindow(pScreen->root);
}
static void
-compBlockHandler (int i,
- pointer blockData,
- pointer pTimeout,
- pointer pReadmask)
+compBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
{
- ScreenPtr pScreen = screenInfo.screens[i];
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = screenInfo.screens[i];
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->BlockHandler = cs->BlockHandler;
- compScreenUpdate (pScreen);
+ compScreenUpdate(pScreen);
(*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
/* Next damage will restore the block handler */
@@ -72,12 +69,12 @@ compBlockHandler (int i,
}
static void
-compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
+compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
- WindowPtr pWin = (WindowPtr) closure;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- CompWindowPtr cw = GetCompWindow (pWin);
+ WindowPtr pWin = (WindowPtr) closure;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompWindowPtr cw = GetCompWindow(pWin);
if (!cs->BlockHandler) {
cs->BlockHandler = pScreen->BlockHandler;
@@ -88,34 +85,33 @@ compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
/* Mark the ancestors */
pWin = pWin->parent;
while (pWin) {
- if (pWin->damagedDescendants)
- break;
- pWin->damagedDescendants = TRUE;
- pWin = pWin->parent;
+ if (pWin->damagedDescendants)
+ break;
+ pWin->damagedDescendants = TRUE;
+ pWin = pWin->parent;
}
}
static void
-compDestroyDamage (DamagePtr pDamage, void *closure)
+compDestroyDamage(DamagePtr pDamage, void *closure)
{
- WindowPtr pWin = (WindowPtr) closure;
- CompWindowPtr cw = GetCompWindow (pWin);
+ WindowPtr pWin = (WindowPtr) closure;
+ CompWindowPtr cw = GetCompWindow(pWin);
cw->damage = 0;
}
static Bool
-compMarkWindows(WindowPtr pWin,
- WindowPtr *ppLayerWin)
+compMarkWindows(WindowPtr pWin, WindowPtr *ppLayerWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pLayerWin = pWin;
if (!pWin->viewable)
- return FALSE;
+ return FALSE;
- (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin);
- (*pScreen->MarkWindow)(pLayerWin->parent);
+ (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin);
+ (*pScreen->MarkWindow) (pLayerWin->parent);
*ppLayerWin = pLayerWin;
@@ -127,143 +123,134 @@ compHandleMarkedWindows(WindowPtr pWin, WindowPtr pLayerWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTOther);
- (*pScreen->HandleExposures)(pLayerWin->parent);
+ (*pScreen->ValidateTree) (pLayerWin->parent, pLayerWin, VTOther);
+ (*pScreen->HandleExposures) (pLayerWin->parent);
if (pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTOther);
+ (*pScreen->PostValidateTree) (pLayerWin->parent, pLayerWin, VTOther);
}
/*
* Redirect one window for one client
*/
int
-compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
+compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- CompClientWindowPtr ccw;
- CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
- WindowPtr pLayerWin;
- Bool anyMarked = FALSE;
-
+ CompWindowPtr cw = GetCompWindow(pWin);
+ CompClientWindowPtr ccw;
+ CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
+ WindowPtr pLayerWin;
+ Bool anyMarked = FALSE;
+
if (pWin == cs->pOverlayWin) {
- return Success;
+ return Success;
}
if (!pWin->parent)
- return BadMatch;
+ return BadMatch;
/*
* Only one Manual update is allowed
*/
if (cw && update == CompositeRedirectManual)
- for (ccw = cw->clients; ccw; ccw = ccw->next)
- if (ccw->update == CompositeRedirectManual)
- return BadAccess;
-
+ for (ccw = cw->clients; ccw; ccw = ccw->next)
+ if (ccw->update == CompositeRedirectManual)
+ return BadAccess;
+
/*
* Allocate per-client per-window structure
* The client *could* allocate multiple, but while supported,
* it is not expected to be common
*/
- ccw = malloc(sizeof (CompClientWindowRec));
+ ccw = malloc(sizeof(CompClientWindowRec));
if (!ccw)
- return BadAlloc;
- ccw->id = FakeClientID (pClient->index);
+ return BadAlloc;
+ ccw->id = FakeClientID(pClient->index);
ccw->update = update;
/*
* Now make sure there's a per-window structure to hang this from
*/
- if (!cw)
- {
- cw = calloc (1,sizeof (CompWindowRec));
- if (!cw)
- {
- free(ccw);
- return BadAlloc;
- }
- cw->damage = DamageCreate (compReportDamage,
- compDestroyDamage,
- DamageReportNonEmpty,
- FALSE,
- pWin->drawable.pScreen,
- pWin);
- if (!cw->damage)
- {
- free(ccw);
- free(cw);
- return BadAlloc;
- }
-
- anyMarked = compMarkWindows (pWin, &pLayerWin);
-
- RegionNull(&cw->borderClip);
- cw->update = CompositeRedirectAutomatic;
- cw->clients = 0;
- cw->oldx = COMP_ORIGIN_INVALID;
- cw->oldy = COMP_ORIGIN_INVALID;
- cw->damageRegistered = FALSE;
- cw->damaged = FALSE;
- cw->pOldPixmap = NullPixmap;
- dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
+ if (!cw) {
+ cw = calloc(1,sizeof(CompWindowRec));
+ if (!cw) {
+ free(ccw);
+ return BadAlloc;
+ }
+ cw->damage = DamageCreate(compReportDamage,
+ compDestroyDamage,
+ DamageReportNonEmpty,
+ FALSE, pWin->drawable.pScreen, pWin);
+ if (!cw->damage) {
+ free(ccw);
+ free(cw);
+ return BadAlloc;
+ }
+
+ anyMarked = compMarkWindows(pWin, &pLayerWin);
+
+ RegionNull(&cw->borderClip);
+ cw->update = CompositeRedirectAutomatic;
+ cw->clients = 0;
+ cw->oldx = COMP_ORIGIN_INVALID;
+ cw->oldy = COMP_ORIGIN_INVALID;
+ cw->damageRegistered = FALSE;
+ cw->damaged = FALSE;
+ cw->pOldPixmap = NullPixmap;
+ dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
}
ccw->next = cw->clients;
cw->clients = ccw;
- if (!AddResource (ccw->id, CompositeClientWindowType, pWin))
- return BadAlloc;
- if (ccw->update == CompositeRedirectManual)
- {
- if (!anyMarked)
- anyMarked = compMarkWindows (pWin, &pLayerWin);
-
- if (cw->damageRegistered)
- {
- DamageUnregister (&pWin->drawable, cw->damage);
- cw->damageRegistered = FALSE;
- }
- cw->update = CompositeRedirectManual;
+ if (!AddResource(ccw->id, CompositeClientWindowType, pWin))
+ return BadAlloc;
+ if (ccw->update == CompositeRedirectManual) {
+ if (!anyMarked)
+ anyMarked = compMarkWindows(pWin, &pLayerWin);
+
+ if (cw->damageRegistered) {
+ DamageUnregister(&pWin->drawable, cw->damage);
+ cw->damageRegistered = FALSE;
+ }
+ cw->update = CompositeRedirectManual;
}
else if (cw->update == CompositeRedirectAutomatic && !cw->damageRegistered) {
- if (!anyMarked)
- anyMarked = compMarkWindows (pWin, &pLayerWin);
+ if (!anyMarked)
+ anyMarked = compMarkWindows(pWin, &pLayerWin);
}
- if (!compCheckRedirect (pWin))
- {
- FreeResource (ccw->id, RT_NONE);
- return BadAlloc;
+ if (!compCheckRedirect(pWin)) {
+ FreeResource(ccw->id, RT_NONE);
+ return BadAlloc;
}
if (anyMarked)
- compHandleMarkedWindows (pWin, pLayerWin);
-
+ compHandleMarkedWindows(pWin, pLayerWin);
+
return Success;
}
void
-compRestoreWindow (WindowPtr pWin, PixmapPtr pPixmap)
+compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pParent = pWin->parent;
if (pParent->drawable.depth == pWin->drawable.depth) {
- GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen);
- int bw = (int) pWin->borderWidth;
- int x = bw;
- int y = bw;
- int w = pWin->drawable.width;
- int h = pWin->drawable.height;
-
- if (pGC) {
- ChangeGCVal val;
- val.val = IncludeInferiors;
- ChangeGC (NullClient, pGC, GCSubwindowMode, &val);
- ValidateGC(&pWin->drawable, pGC);
- (*pGC->ops->CopyArea) (&pPixmap->drawable,
- &pWin->drawable,
- pGC,
- x, y, w, h, 0, 0);
- FreeScratchGC (pGC);
- }
+ GCPtr pGC = GetScratchGC(pWin->drawable.depth, pScreen);
+ int bw = (int) pWin->borderWidth;
+ int x = bw;
+ int y = bw;
+ int w = pWin->drawable.width;
+ int h = pWin->drawable.height;
+
+ if (pGC) {
+ ChangeGCVal val;
+
+ val.val = IncludeInferiors;
+ ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
+ ValidateGC(&pWin->drawable, pGC);
+ (*pGC->ops->CopyArea) (&pPixmap->drawable,
+ &pWin->drawable, pGC, x, y, w, h, 0, 0);
+ FreeScratchGC(pGC);
+ }
}
}
@@ -272,62 +259,58 @@ compRestoreWindow (WindowPtr pWin, PixmapPtr pPixmap)
* redirect and the per-window pointer as appropriate
*/
void
-compFreeClientWindow (WindowPtr pWin, XID id)
+compFreeClientWindow(WindowPtr pWin, XID id)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompWindowPtr cw = GetCompWindow (pWin);
- CompClientWindowPtr ccw, *prev;
- Bool anyMarked = FALSE;
- WindowPtr pLayerWin;
- PixmapPtr pPixmap = NULL;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ CompClientWindowPtr ccw, *prev;
+ Bool anyMarked = FALSE;
+ WindowPtr pLayerWin;
+ PixmapPtr pPixmap = NULL;
if (!cw)
- return;
- for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next)
- {
- if (ccw->id == id)
- {
- *prev = ccw->next;
- if (ccw->update == CompositeRedirectManual)
- cw->update = CompositeRedirectAutomatic;
- free(ccw);
- break;
- }
+ return;
+ for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next) {
+ if (ccw->id == id) {
+ *prev = ccw->next;
+ if (ccw->update == CompositeRedirectManual)
+ cw->update = CompositeRedirectAutomatic;
+ free(ccw);
+ break;
+ }
}
- if (!cw->clients)
- {
- anyMarked = compMarkWindows (pWin, &pLayerWin);
-
- if (pWin->redirectDraw != RedirectDrawNone) {
- pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- compSetParentPixmap (pWin);
- }
-
- if (cw->damage)
- DamageDestroy (cw->damage);
-
- RegionUninit(&cw->borderClip);
-
- dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
- free(cw);
+ if (!cw->clients) {
+ anyMarked = compMarkWindows(pWin, &pLayerWin);
+
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ compSetParentPixmap(pWin);
+ }
+
+ if (cw->damage)
+ DamageDestroy(cw->damage);
+
+ RegionUninit(&cw->borderClip);
+
+ dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
+ free(cw);
}
else if (cw->update == CompositeRedirectAutomatic &&
- !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone)
- {
- anyMarked = compMarkWindows (pWin, &pLayerWin);
-
- DamageRegister (&pWin->drawable, cw->damage);
- cw->damageRegistered = TRUE;
- pWin->redirectDraw = RedirectDrawAutomatic;
- DamageDamageRegion(&pWin->drawable, &pWin->borderSize);
+ !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone) {
+ anyMarked = compMarkWindows(pWin, &pLayerWin);
+
+ DamageRegister(&pWin->drawable, cw->damage);
+ cw->damageRegistered = TRUE;
+ pWin->redirectDraw = RedirectDrawAutomatic;
+ DamageDamageRegion(&pWin->drawable, &pWin->borderSize);
}
if (anyMarked)
- compHandleMarkedWindows (pWin, pLayerWin);
+ compHandleMarkedWindows(pWin, pLayerWin);
if (pPixmap) {
- compRestoreWindow (pWin, pPixmap);
- (*pScreen->DestroyPixmap) (pPixmap);
+ compRestoreWindow(pWin, pPixmap);
+ (*pScreen->DestroyPixmap) (pPixmap);
}
}
@@ -336,101 +319,95 @@ compFreeClientWindow (WindowPtr pWin, XID id)
*/
int
-compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
+compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- CompClientWindowPtr ccw;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ CompClientWindowPtr ccw;
if (!cw)
- return BadValue;
+ return BadValue;
for (ccw = cw->clients; ccw; ccw = ccw->next)
- if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
- {
- FreeResource (ccw->id, RT_NONE);
- return Success;
- }
+ if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
+ FreeResource(ccw->id, RT_NONE);
+ return Success;
+ }
return BadValue;
}
-
+
/*
* Redirect all subwindows for one client
*/
int
-compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
+compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
{
- CompSubwindowsPtr csw = GetCompSubwindows (pWin);
- CompClientWindowPtr ccw;
- WindowPtr pChild;
+ CompSubwindowsPtr csw = GetCompSubwindows(pWin);
+ CompClientWindowPtr ccw;
+ WindowPtr pChild;
/*
* Only one Manual update is allowed
*/
if (csw && update == CompositeRedirectManual)
- for (ccw = csw->clients; ccw; ccw = ccw->next)
- if (ccw->update == CompositeRedirectManual)
- return BadAccess;
+ for (ccw = csw->clients; ccw; ccw = ccw->next)
+ if (ccw->update == CompositeRedirectManual)
+ return BadAccess;
/*
* Allocate per-client per-window structure
* The client *could* allocate multiple, but while supported,
* it is not expected to be common
*/
- ccw = malloc(sizeof (CompClientWindowRec));
+ ccw = malloc(sizeof(CompClientWindowRec));
if (!ccw)
- return BadAlloc;
- ccw->id = FakeClientID (pClient->index);
+ return BadAlloc;
+ ccw->id = FakeClientID(pClient->index);
ccw->update = update;
/*
* Now make sure there's a per-window structure to hang this from
*/
- if (!csw)
- {
- csw = malloc(sizeof (CompSubwindowsRec));
- if (!csw)
- {
- free(ccw);
- return BadAlloc;
- }
- csw->update = CompositeRedirectAutomatic;
- csw->clients = 0;
- dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw);
+ if (!csw) {
+ csw = malloc(sizeof(CompSubwindowsRec));
+ if (!csw) {
+ free(ccw);
+ return BadAlloc;
+ }
+ csw->update = CompositeRedirectAutomatic;
+ csw->clients = 0;
+ dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw);
}
/*
* Redirect all existing windows
*/
- for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
- {
- int ret = compRedirectWindow (pClient, pChild, update);
- if (ret != Success)
- {
- for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)
- (void) compUnredirectWindow (pClient, pChild, update);
- if (!csw->clients)
- {
- free(csw);
- dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
- }
- free(ccw);
- return ret;
- }
+ for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) {
+ int ret = compRedirectWindow(pClient, pChild, update);
+
+ if (ret != Success) {
+ for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)
+ (void) compUnredirectWindow(pClient, pChild, update);
+ if (!csw->clients) {
+ free(csw);
+ dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
+ }
+ free(ccw);
+ return ret;
+ }
}
/*
* Hook into subwindows list
*/
ccw->next = csw->clients;
csw->clients = ccw;
- if (!AddResource (ccw->id, CompositeClientSubwindowsType, pWin))
- return BadAlloc;
- if (ccw->update == CompositeRedirectManual)
- {
- csw->update = CompositeRedirectManual;
- /*
- * tell damage extension that damage events for this client are
- * critical output
- */
- DamageExtSetCritical (pClient, TRUE);
- pWin->inhibitBGPaint = TRUE;
+ if (!AddResource(ccw->id, CompositeClientSubwindowsType, pWin))
+ return BadAlloc;
+ if (ccw->update == CompositeRedirectManual) {
+ csw->update = CompositeRedirectManual;
+ /*
+ * tell damage extension that damage events for this client are
+ * critical output
+ */
+ DamageExtSetCritical(pClient, TRUE);
+ pWin->inhibitBGPaint = TRUE;
}
return Success;
}
@@ -440,52 +417,49 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
* which frees one redirect per subwindow
*/
void
-compFreeClientSubwindows (WindowPtr pWin, XID id)
+compFreeClientSubwindows(WindowPtr pWin, XID id)
{
- CompSubwindowsPtr csw = GetCompSubwindows (pWin);
- CompClientWindowPtr ccw, *prev;
- WindowPtr pChild;
+ CompSubwindowsPtr csw = GetCompSubwindows(pWin);
+ CompClientWindowPtr ccw, *prev;
+ WindowPtr pChild;
if (!csw)
- return;
- for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next)
- {
- if (ccw->id == id)
- {
- ClientPtr pClient = clients[CLIENT_ID(id)];
-
- *prev = ccw->next;
- if (ccw->update == CompositeRedirectManual)
- {
- /*
- * tell damage extension that damage events for this client are
- * critical output
- */
- DamageExtSetCritical (pClient, FALSE);
- csw->update = CompositeRedirectAutomatic;
- pWin->inhibitBGPaint = FALSE;
- if (pWin->mapped)
- (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, TRUE);
- }
-
- /*
- * Unredirect all existing subwindows
- */
- for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
- (void) compUnredirectWindow (pClient, pChild, ccw->update);
-
- free(ccw);
- break;
- }
+ return;
+ for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next) {
+ if (ccw->id == id) {
+ ClientPtr pClient = clients[CLIENT_ID(id)];
+
+ *prev = ccw->next;
+ if (ccw->update == CompositeRedirectManual) {
+ /*
+ * tell damage extension that damage events for this client are
+ * critical output
+ */
+ DamageExtSetCritical(pClient, FALSE);
+ csw->update = CompositeRedirectAutomatic;
+ pWin->inhibitBGPaint = FALSE;
+ if (pWin->mapped)
+ (*pWin->drawable.pScreen->ClearToBackground) (pWin, 0, 0, 0,
+ 0, TRUE);
+ }
+
+ /*
+ * Unredirect all existing subwindows
+ */
+ for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
+ (void) compUnredirectWindow(pClient, pChild, ccw->update);
+
+ free(ccw);
+ break;
+ }
}
/*
* Check if all of the per-client records are gone
*/
- if (!csw->clients)
- {
- dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
- free(csw);
+ if (!csw->clients) {
+ dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
+ free(csw);
}
}
@@ -494,19 +468,18 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
*/
int
-compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
+compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
{
- CompSubwindowsPtr csw = GetCompSubwindows (pWin);
- CompClientWindowPtr ccw;
-
+ CompSubwindowsPtr csw = GetCompSubwindows(pWin);
+ CompClientWindowPtr ccw;
+
if (!csw)
- return BadValue;
+ return BadValue;
for (ccw = csw->clients; ccw; ccw = ccw->next)
- if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
- {
- FreeResource (ccw->id, RT_NONE);
- return Success;
- }
+ if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
+ FreeResource(ccw->id, RT_NONE);
+ return Success;
+ }
return BadValue;
}
@@ -515,19 +488,19 @@ compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
*/
int
-compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
+compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin)
{
- CompSubwindowsPtr csw = GetCompSubwindows (pParent);
- CompClientWindowPtr ccw;
+ CompSubwindowsPtr csw = GetCompSubwindows(pParent);
+ CompClientWindowPtr ccw;
if (!csw)
- return Success;
- for (ccw = csw->clients; ccw; ccw = ccw->next)
- {
- int ret = compRedirectWindow (clients[CLIENT_ID(ccw->id)],
- pWin, ccw->update);
- if (ret != Success)
- return ret;
+ return Success;
+ for (ccw = csw->clients; ccw; ccw = ccw->next) {
+ int ret = compRedirectWindow(clients[CLIENT_ID(ccw->id)],
+ pWin, ccw->update);
+
+ if (ret != Success)
+ return ret;
}
return Success;
}
@@ -537,122 +510,116 @@ compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
*/
int
-compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
+compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin)
{
- CompSubwindowsPtr csw = GetCompSubwindows (pParent);
- CompClientWindowPtr ccw;
+ CompSubwindowsPtr csw = GetCompSubwindows(pParent);
+ CompClientWindowPtr ccw;
if (!csw)
- return Success;
- for (ccw = csw->clients; ccw; ccw = ccw->next)
- {
- int ret = compUnredirectWindow (clients[CLIENT_ID(ccw->id)],
- pWin, ccw->update);
- if (ret != Success)
- return ret;
+ return Success;
+ for (ccw = csw->clients; ccw; ccw = ccw->next) {
+ int ret = compUnredirectWindow(clients[CLIENT_ID(ccw->id)],
+ pWin, ccw->update);
+
+ if (ret != Success)
+ return ret;
}
return Success;
}
static PixmapPtr
-compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
+compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- WindowPtr pParent = pWin->parent;
- PixmapPtr pPixmap;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr pParent = pWin->parent;
+ PixmapPtr pPixmap;
pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth,
- CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
+ CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
if (!pPixmap)
- return 0;
-
+ return 0;
+
pPixmap->screen_x = x;
pPixmap->screen_y = y;
- if (pParent->drawable.depth == pWin->drawable.depth)
- {
- GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen);
-
- if (pGC)
- {
- ChangeGCVal val;
- val.val = IncludeInferiors;
- ChangeGC (NullClient, pGC, GCSubwindowMode, &val);
- ValidateGC(&pPixmap->drawable, pGC);
- (*pGC->ops->CopyArea) (&pParent->drawable,
- &pPixmap->drawable,
- pGC,
- x - pParent->drawable.x,
- y - pParent->drawable.y,
- w, h, 0, 0);
- FreeScratchGC (pGC);
- }
+ if (pParent->drawable.depth == pWin->drawable.depth) {
+ GCPtr pGC = GetScratchGC(pWin->drawable.depth, pScreen);
+
+ if (pGC) {
+ ChangeGCVal val;
+
+ val.val = IncludeInferiors;
+ ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
+ ValidateGC(&pPixmap->drawable, pGC);
+ (*pGC->ops->CopyArea) (&pParent->drawable,
+ &pPixmap->drawable,
+ pGC,
+ x - pParent->drawable.x,
+ y - pParent->drawable.y, w, h, 0, 0);
+ FreeScratchGC(pGC);
+ }
}
- else
- {
- PictFormatPtr pSrcFormat = compWindowFormat (pParent);
- PictFormatPtr pDstFormat = compWindowFormat (pWin);
- XID inferiors = IncludeInferiors;
- int error;
-
- PicturePtr pSrcPicture = CreatePicture (None,
- &pParent->drawable,
- pSrcFormat,
- CPSubwindowMode,
- &inferiors,
- serverClient, &error);
-
- PicturePtr pDstPicture = CreatePicture (None,
- &pPixmap->drawable,
- pDstFormat,
- 0, 0,
- serverClient, &error);
-
- if (pSrcPicture && pDstPicture)
- {
- CompositePicture (PictOpSrc,
- pSrcPicture,
- NULL,
- pDstPicture,
- x - pParent->drawable.x,
- y - pParent->drawable.y,
- 0, 0, 0, 0, w, h);
- }
- if (pSrcPicture)
- FreePicture (pSrcPicture, 0);
- if (pDstPicture)
- FreePicture (pDstPicture, 0);
+ else {
+ PictFormatPtr pSrcFormat = compWindowFormat(pParent);
+ PictFormatPtr pDstFormat = compWindowFormat(pWin);
+ XID inferiors = IncludeInferiors;
+ int error;
+
+ PicturePtr pSrcPicture = CreatePicture(None,
+ &pParent->drawable,
+ pSrcFormat,
+ CPSubwindowMode,
+ &inferiors,
+ serverClient, &error);
+
+ PicturePtr pDstPicture = CreatePicture(None,
+ &pPixmap->drawable,
+ pDstFormat,
+ 0, 0,
+ serverClient, &error);
+
+ if (pSrcPicture && pDstPicture) {
+ CompositePicture(PictOpSrc,
+ pSrcPicture,
+ NULL,
+ pDstPicture,
+ x - pParent->drawable.x,
+ y - pParent->drawable.y, 0, 0, 0, 0, w, h);
+ }
+ if (pSrcPicture)
+ FreePicture(pSrcPicture, 0);
+ if (pDstPicture)
+ FreePicture(pDstPicture, 0);
}
return pPixmap;
}
Bool
-compAllocPixmap (WindowPtr pWin)
+compAllocPixmap(WindowPtr pWin)
{
- int bw = (int) pWin->borderWidth;
- int x = pWin->drawable.x - bw;
- int y = pWin->drawable.y - bw;
- int w = pWin->drawable.width + (bw << 1);
- int h = pWin->drawable.height + (bw << 1);
- PixmapPtr pPixmap = compNewPixmap (pWin, x, y, w, h);
- CompWindowPtr cw = GetCompWindow (pWin);
+ int bw = (int) pWin->borderWidth;
+ int x = pWin->drawable.x - bw;
+ int y = pWin->drawable.y - bw;
+ int w = pWin->drawable.width + (bw << 1);
+ int h = pWin->drawable.height + (bw << 1);
+ PixmapPtr pPixmap = compNewPixmap(pWin, x, y, w, h);
+ CompWindowPtr cw = GetCompWindow(pWin);
if (!pPixmap)
- return FALSE;
+ return FALSE;
if (cw->update == CompositeRedirectAutomatic)
- pWin->redirectDraw = RedirectDrawAutomatic;
+ pWin->redirectDraw = RedirectDrawAutomatic;
else
- pWin->redirectDraw = RedirectDrawManual;
+ pWin->redirectDraw = RedirectDrawManual;
- compSetPixmap (pWin, pPixmap);
+ compSetPixmap(pWin, pPixmap);
cw->oldx = COMP_ORIGIN_INVALID;
cw->oldy = COMP_ORIGIN_INVALID;
cw->damageRegistered = FALSE;
- if (cw->update == CompositeRedirectAutomatic)
- {
- DamageRegister (&pWin->drawable, cw->damage);
- cw->damageRegistered = TRUE;
+ if (cw->update == CompositeRedirectAutomatic) {
+ DamageRegister(&pWin->drawable, cw->damage);
+ cw->damageRegistered = TRUE;
}
/* Make sure our borderClip is up to date */
@@ -665,17 +632,16 @@ compAllocPixmap (WindowPtr pWin)
}
void
-compSetParentPixmap (WindowPtr pWin)
+compSetParentPixmap(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pParentPixmap;
- CompWindowPtr cw = GetCompWindow (pWin);
-
- if (cw->damageRegistered)
- {
- DamageUnregister (&pWin->drawable, cw->damage);
- cw->damageRegistered = FALSE;
- DamageEmpty (cw->damage);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pParentPixmap;
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ if (cw->damageRegistered) {
+ DamageUnregister(&pWin->drawable, cw->damage);
+ cw->damageRegistered = FALSE;
+ DamageEmpty(cw->damage);
}
/*
* Move the parent-constrained border clip region back into
@@ -686,7 +652,7 @@ compSetParentPixmap (WindowPtr pWin)
RegionCopy(&pWin->borderClip, &cw->borderClip);
pParentPixmap = (*pScreen->GetWindowPixmap) (pWin->parent);
pWin->redirectDraw = RedirectDrawNone;
- compSetPixmap (pWin, pParentPixmap);
+ compSetPixmap(pWin, pParentPixmap);
}
/*
@@ -695,35 +661,33 @@ compSetParentPixmap (WindowPtr pWin)
* old pixmap in cw->pOldPixmap so bits can be recovered
*/
Bool
-compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y,
- unsigned int w, unsigned int h, int bw)
+compReallocPixmap(WindowPtr pWin, int draw_x, int draw_y,
+ unsigned int w, unsigned int h, int bw)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pOld = (*pScreen->GetWindowPixmap) (pWin);
- PixmapPtr pNew;
- CompWindowPtr cw = GetCompWindow (pWin);
- int pix_x, pix_y;
- int pix_w, pix_h;
-
- assert (cw && pWin->redirectDraw != RedirectDrawNone);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pOld = (*pScreen->GetWindowPixmap) (pWin);
+ PixmapPtr pNew;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ int pix_x, pix_y;
+ int pix_w, pix_h;
+
+ assert(cw && pWin->redirectDraw != RedirectDrawNone);
cw->oldx = pOld->screen_x;
cw->oldy = pOld->screen_y;
pix_x = draw_x - bw;
pix_y = draw_y - bw;
pix_w = w + (bw << 1);
pix_h = h + (bw << 1);
- if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height)
- {
- pNew = compNewPixmap (pWin, pix_x, pix_y, pix_w, pix_h);
- if (!pNew)
- return FALSE;
- cw->pOldPixmap = pOld;
- compSetPixmap (pWin, pNew);
+ if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height) {
+ pNew = compNewPixmap(pWin, pix_x, pix_y, pix_w, pix_h);
+ if (!pNew)
+ return FALSE;
+ cw->pOldPixmap = pOld;
+ compSetPixmap(pWin, pNew);
}
- else
- {
- pNew = pOld;
- cw->pOldPixmap = 0;
+ else {
+ pNew = pOld;
+ cw->pOldPixmap = 0;
}
pNew->screen_x = pix_x;
pNew->screen_y = pix_y;
diff --git a/xorg-server/composite/compext.c b/xorg-server/composite/compext.c
index 722587a43..940eed1fc 100644
--- a/xorg-server/composite/compext.c
+++ b/xorg-server/composite/compext.c
@@ -49,66 +49,66 @@
#include "xace.h"
#include "protocol-versions.h"
-static CARD8 CompositeReqCode;
+static CARD8 CompositeReqCode;
static DevPrivateKeyRec CompositeClientPrivateKeyRec;
+
#define CompositeClientPrivateKey (&CompositeClientPrivateKeyRec)
-RESTYPE CompositeClientWindowType;
-RESTYPE CompositeClientSubwindowsType;
-RESTYPE CompositeClientOverlayType;
+RESTYPE CompositeClientWindowType;
+RESTYPE CompositeClientSubwindowsType;
+RESTYPE CompositeClientOverlayType;
typedef struct _CompositeClient {
- int major_version;
- int minor_version;
+ int major_version;
+ int minor_version;
} CompositeClientRec, *CompositeClientPtr;
#define GetCompositeClient(pClient) ((CompositeClientPtr) \
dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey))
static void
-CompositeClientCallback (CallbackListPtr *list,
- pointer closure,
- pointer data)
+CompositeClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- CompositeClientPtr pCompositeClient = GetCompositeClient (pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ CompositeClientPtr pCompositeClient = GetCompositeClient(pClient);
pCompositeClient->major_version = 0;
pCompositeClient->minor_version = 0;
}
static int
-FreeCompositeClientWindow (pointer value, XID ccwid)
+FreeCompositeClientWindow(pointer value, XID ccwid)
{
- WindowPtr pWin = value;
+ WindowPtr pWin = value;
- compFreeClientWindow (pWin, ccwid);
+ compFreeClientWindow(pWin, ccwid);
return Success;
}
static int
-FreeCompositeClientSubwindows (pointer value, XID ccwid)
+FreeCompositeClientSubwindows(pointer value, XID ccwid)
{
- WindowPtr pWin = value;
+ WindowPtr pWin = value;
- compFreeClientSubwindows (pWin, ccwid);
+ compFreeClientSubwindows(pWin, ccwid);
return Success;
}
static int
-FreeCompositeClientOverlay (pointer value, XID ccwid)
+FreeCompositeClientOverlay(pointer value, XID ccwid)
{
CompOverlayClientPtr pOc = (CompOverlayClientPtr) value;
- compFreeOverlayClient (pOc);
+ compFreeOverlayClient(pOc);
return Success;
}
static int
-ProcCompositeQueryVersion (ClientPtr client)
+ProcCompositeQueryVersion(ClientPtr client)
{
- CompositeClientPtr pCompositeClient = GetCompositeClient (client);
+ CompositeClientPtr pCompositeClient = GetCompositeClient(client);
xCompositeQueryVersionReply rep;
+
REQUEST(xCompositeQueryVersionReq);
REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
@@ -116,21 +116,22 @@ ProcCompositeQueryVersion (ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) {
- rep.majorVersion = stuff->majorVersion;
- rep.minorVersion = stuff->minorVersion;
- } else {
- rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION;
+ rep.majorVersion = stuff->majorVersion;
+ rep.minorVersion = stuff->minorVersion;
+ }
+ else {
+ rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION;
rep.minorVersion = SERVER_COMPOSITE_MINOR_VERSION;
}
pCompositeClient->major_version = rep.majorVersion;
pCompositeClient->minor_version = rep.minorVersion;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xCompositeQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xCompositeQueryVersionReply), (char *) &rep);
return Success;
}
@@ -146,129 +147,134 @@ ProcCompositeQueryVersion (ClientPtr client)
} while (0)
static int
-ProcCompositeRedirectWindow (ClientPtr client)
+ProcCompositeRedirectWindow(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xCompositeRedirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
VERIFY_WINDOW(pWin, stuff->window, client,
- DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+ DixSetAttrAccess | DixManageAccess | DixBlendAccess);
- return compRedirectWindow (client, pWin, stuff->update);
+ return compRedirectWindow(client, pWin, stuff->update);
}
static int
-ProcCompositeRedirectSubwindows (ClientPtr client)
+ProcCompositeRedirectSubwindows(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xCompositeRedirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
VERIFY_WINDOW(pWin, stuff->window, client,
- DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+ DixSetAttrAccess | DixManageAccess | DixBlendAccess);
- return compRedirectSubwindows (client, pWin, stuff->update);
+ return compRedirectSubwindows(client, pWin, stuff->update);
}
static int
-ProcCompositeUnredirectWindow (ClientPtr client)
+ProcCompositeUnredirectWindow(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xCompositeUnredirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
VERIFY_WINDOW(pWin, stuff->window, client,
- DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+ DixSetAttrAccess | DixManageAccess | DixBlendAccess);
- return compUnredirectWindow (client, pWin, stuff->update);
+ return compUnredirectWindow(client, pWin, stuff->update);
}
static int
-ProcCompositeUnredirectSubwindows (ClientPtr client)
+ProcCompositeUnredirectSubwindows(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xCompositeUnredirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
VERIFY_WINDOW(pWin, stuff->window, client,
- DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+ DixSetAttrAccess | DixManageAccess | DixBlendAccess);
- return compUnredirectSubwindows (client, pWin, stuff->update);
+ return compUnredirectSubwindows(client, pWin, stuff->update);
}
static int
-ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
+ProcCompositeCreateRegionFromBorderClip(ClientPtr client)
{
- WindowPtr pWin;
- CompWindowPtr cw;
- RegionPtr pBorderClip, pRegion;
+ WindowPtr pWin;
+ CompWindowPtr cw;
+ RegionPtr pBorderClip, pRegion;
+
REQUEST(xCompositeCreateRegionFromBorderClipReq);
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
- LEGAL_NEW_RESOURCE (stuff->region, client);
-
- cw = GetCompWindow (pWin);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+
+ cw = GetCompWindow(pWin);
if (cw)
- pBorderClip = &cw->borderClip;
+ pBorderClip = &cw->borderClip;
else
- pBorderClip = &pWin->borderClip;
- pRegion = XFixesRegionCopy (pBorderClip);
+ pBorderClip = &pWin->borderClip;
+ pRegion = XFixesRegionCopy(pBorderClip);
if (!pRegion)
- return BadAlloc;
+ return BadAlloc;
RegionTranslate(pRegion, -pWin->drawable.x, -pWin->drawable.y);
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
return Success;
}
static int
-ProcCompositeNameWindowPixmap (ClientPtr client)
+ProcCompositeNameWindowPixmap(ClientPtr client)
{
- WindowPtr pWin;
- CompWindowPtr cw;
- PixmapPtr pPixmap;
+ WindowPtr pWin;
+ CompWindowPtr cw;
+ PixmapPtr pPixmap;
int rc;
+
REQUEST(xCompositeNameWindowPixmapReq);
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
if (!pWin->viewable)
- return BadMatch;
+ return BadMatch;
- LEGAL_NEW_RESOURCE (stuff->pixmap, client);
-
- cw = GetCompWindow (pWin);
+ LEGAL_NEW_RESOURCE(stuff->pixmap, client);
+
+ cw = GetCompWindow(pWin);
if (!cw)
- return BadMatch;
+ return BadMatch;
pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
if (!pPixmap)
- return BadMatch;
+ return BadMatch;
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
- pPixmap, RT_WINDOW, pWin, DixCreateAccess);
+ pPixmap, RT_WINDOW, pWin, DixCreateAccess);
if (rc != Success)
- return rc;
+ return rc;
++pPixmap->refcnt;
- if (!AddResource (stuff->pixmap, RT_PIXMAP, (pointer) pPixmap))
- return BadAlloc;
+ if (!AddResource(stuff->pixmap, RT_PIXMAP, (pointer) pPixmap))
+ return BadAlloc;
return Success;
}
-
static int
-ProcCompositeGetOverlayWindow (ClientPtr client)
+ProcCompositeGetOverlayWindow(ClientPtr client)
{
- REQUEST(xCompositeGetOverlayWindowReq);
+ REQUEST(xCompositeGetOverlayWindowReq);
xCompositeGetOverlayWindowReply rep;
WindowPtr pWin;
ScreenPtr pScreen;
@@ -286,25 +292,23 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
*/
pOc = compCreateOverlayClient(pScreen, client);
if (pOc == NULL)
- return BadAlloc;
+ return BadAlloc;
/*
* Make sure the overlay window exists
*/
cs = GetCompScreen(pScreen);
if (cs->pOverlayWin == NULL)
- if (!compCreateOverlayWindow(pScreen))
- {
- FreeResource (pOc->resource, RT_NONE);
- return BadAlloc;
- }
+ if (!compCreateOverlayWindow(pScreen)) {
+ FreeResource(pOc->resource, RT_NONE);
+ return BadAlloc;
+ }
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
- RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
- if (rc != Success)
- {
- FreeResource (pOc->resource, RT_NONE);
- return rc;
+ RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
+ if (rc != Success) {
+ FreeResource(pOc->resource, RT_NONE);
+ return rc;
}
rep.type = X_Reply;
@@ -312,21 +316,21 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
rep.length = 0;
rep.overlayWin = cs->pOverlayWin->drawable.id;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.overlayWin);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.overlayWin);
}
- (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);
+ (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply,
+ (char *) &rep);
return Success;
}
static int
-ProcCompositeReleaseOverlayWindow (ClientPtr client)
+ProcCompositeReleaseOverlayWindow(ClientPtr client)
{
- REQUEST(xCompositeReleaseOverlayWindowReq);
+ REQUEST(xCompositeReleaseOverlayWindowReq);
WindowPtr pWin;
ScreenPtr pScreen;
CompOverlayClientPtr pOc;
@@ -339,41 +343,39 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client)
* Has client queried a reference to the overlay window
* on this screen? If not, generate an error.
*/
- pOc = compFindOverlayClient (pWin->drawable.pScreen, client);
+ pOc = compFindOverlayClient(pWin->drawable.pScreen, client);
if (pOc == NULL)
- return BadMatch;
+ return BadMatch;
/* The delete function will free the client structure */
- FreeResource (pOc->resource, RT_NONE);
+ FreeResource(pOc->resource, RT_NONE);
return Success;
}
-static int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
- ProcCompositeQueryVersion,
- ProcCompositeRedirectWindow,
- ProcCompositeRedirectSubwindows,
- ProcCompositeUnredirectWindow,
- ProcCompositeUnredirectSubwindows,
- ProcCompositeCreateRegionFromBorderClip,
- ProcCompositeNameWindowPixmap,
- ProcCompositeGetOverlayWindow,
- ProcCompositeReleaseOverlayWindow,
-};
+static int (*ProcCompositeVector[CompositeNumberRequests]) (ClientPtr) = {
+ProcCompositeQueryVersion,
+ ProcCompositeRedirectWindow,
+ ProcCompositeRedirectSubwindows,
+ ProcCompositeUnredirectWindow,
+ ProcCompositeUnredirectSubwindows,
+ ProcCompositeCreateRegionFromBorderClip,
+ ProcCompositeNameWindowPixmap,
+ ProcCompositeGetOverlayWindow, ProcCompositeReleaseOverlayWindow,};
static int
-ProcCompositeDispatch (ClientPtr client)
+ProcCompositeDispatch(ClientPtr client)
{
REQUEST(xReq);
-
+
if (stuff->data < CompositeNumberRequests)
- return (*ProcCompositeVector[stuff->data]) (client);
+ return (*ProcCompositeVector[stuff->data]) (client);
else
- return BadRequest;
+ return BadRequest;
}
static int
-SProcCompositeQueryVersion (ClientPtr client)
+SProcCompositeQueryVersion(ClientPtr client)
{
REQUEST(xCompositeQueryVersionReq);
@@ -385,7 +387,7 @@ SProcCompositeQueryVersion (ClientPtr client)
}
static int
-SProcCompositeRedirectWindow (ClientPtr client)
+SProcCompositeRedirectWindow(ClientPtr client)
{
REQUEST(xCompositeRedirectWindowReq);
@@ -396,7 +398,7 @@ SProcCompositeRedirectWindow (ClientPtr client)
}
static int
-SProcCompositeRedirectSubwindows (ClientPtr client)
+SProcCompositeRedirectSubwindows(ClientPtr client)
{
REQUEST(xCompositeRedirectSubwindowsReq);
@@ -407,7 +409,7 @@ SProcCompositeRedirectSubwindows (ClientPtr client)
}
static int
-SProcCompositeUnredirectWindow (ClientPtr client)
+SProcCompositeUnredirectWindow(ClientPtr client)
{
REQUEST(xCompositeUnredirectWindowReq);
@@ -418,7 +420,7 @@ SProcCompositeUnredirectWindow (ClientPtr client)
}
static int
-SProcCompositeUnredirectSubwindows (ClientPtr client)
+SProcCompositeUnredirectSubwindows(ClientPtr client)
{
REQUEST(xCompositeUnredirectSubwindowsReq);
@@ -429,7 +431,7 @@ SProcCompositeUnredirectSubwindows (ClientPtr client)
}
static int
-SProcCompositeCreateRegionFromBorderClip (ClientPtr client)
+SProcCompositeCreateRegionFromBorderClip(ClientPtr client)
{
REQUEST(xCompositeCreateRegionFromBorderClipReq);
@@ -441,7 +443,7 @@ SProcCompositeCreateRegionFromBorderClip (ClientPtr client)
}
static int
-SProcCompositeNameWindowPixmap (ClientPtr client)
+SProcCompositeNameWindowPixmap(ClientPtr client)
{
REQUEST(xCompositeNameWindowPixmapReq);
@@ -453,7 +455,7 @@ SProcCompositeNameWindowPixmap (ClientPtr client)
}
static int
-SProcCompositeGetOverlayWindow (ClientPtr client)
+SProcCompositeGetOverlayWindow(ClientPtr client)
{
REQUEST(xCompositeGetOverlayWindowReq);
@@ -464,7 +466,7 @@ SProcCompositeGetOverlayWindow (ClientPtr client)
}
static int
-SProcCompositeReleaseOverlayWindow (ClientPtr client)
+SProcCompositeReleaseOverlayWindow(ClientPtr client)
{
REQUEST(xCompositeReleaseOverlayWindowReq);
@@ -474,92 +476,89 @@ SProcCompositeReleaseOverlayWindow (ClientPtr client)
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
}
-static int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
- SProcCompositeQueryVersion,
- SProcCompositeRedirectWindow,
- SProcCompositeRedirectSubwindows,
- SProcCompositeUnredirectWindow,
- SProcCompositeUnredirectSubwindows,
- SProcCompositeCreateRegionFromBorderClip,
- SProcCompositeNameWindowPixmap,
- SProcCompositeGetOverlayWindow,
- SProcCompositeReleaseOverlayWindow,
-};
+static int (*SProcCompositeVector[CompositeNumberRequests]) (ClientPtr) = {
+SProcCompositeQueryVersion,
+ SProcCompositeRedirectWindow,
+ SProcCompositeRedirectSubwindows,
+ SProcCompositeUnredirectWindow,
+ SProcCompositeUnredirectSubwindows,
+ SProcCompositeCreateRegionFromBorderClip,
+ SProcCompositeNameWindowPixmap,
+ SProcCompositeGetOverlayWindow, SProcCompositeReleaseOverlayWindow,};
static int
-SProcCompositeDispatch (ClientPtr client)
+SProcCompositeDispatch(ClientPtr client)
{
REQUEST(xReq);
-
+
if (stuff->data < CompositeNumberRequests)
- return (*SProcCompositeVector[stuff->data]) (client);
+ return (*SProcCompositeVector[stuff->data]) (client);
else
- return BadRequest;
+ return BadRequest;
}
void
-CompositeExtensionInit (void)
+CompositeExtensionInit(void)
{
- ExtensionEntry *extEntry;
- int s;
+ ExtensionEntry *extEntry;
+ int s;
/* Assume initialization is going to fail */
noCompositeExtension = TRUE;
for (s = 0; s < screenInfo.numScreens; s++) {
- ScreenPtr pScreen = screenInfo.screens[s];
- VisualPtr vis;
-
- /* Composite on 8bpp pseudocolor root windows appears to fail, so
- * just disable it on anything pseudocolor for safety.
- */
- for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++)
- ;
- if ((vis->class | DynamicClass) == PseudoColor)
- return;
-
- /* Ensure that Render is initialized, which is required for automatic
- * compositing.
- */
- if (GetPictureScreenIfSet(pScreen) == NULL)
- return;
+ ScreenPtr pScreen = screenInfo.screens[s];
+ VisualPtr vis;
+
+ /* Composite on 8bpp pseudocolor root windows appears to fail, so
+ * just disable it on anything pseudocolor for safety.
+ */
+ for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++);
+ if ((vis->class | DynamicClass) == PseudoColor)
+ return;
+
+ /* Ensure that Render is initialized, which is required for automatic
+ * compositing.
+ */
+ if (GetPictureScreenIfSet(pScreen) == NULL)
+ return;
}
CompositeClientWindowType = CreateNewResourceType
- (FreeCompositeClientWindow, "CompositeClientWindow");
+ (FreeCompositeClientWindow, "CompositeClientWindow");
if (!CompositeClientWindowType)
- return;
+ return;
CompositeClientSubwindowsType = CreateNewResourceType
- (FreeCompositeClientSubwindows, "CompositeClientSubwindows");
+ (FreeCompositeClientSubwindows, "CompositeClientSubwindows");
if (!CompositeClientSubwindowsType)
- return;
+ return;
CompositeClientOverlayType = CreateNewResourceType
- (FreeCompositeClientOverlay, "CompositeClientOverlay");
+ (FreeCompositeClientOverlay, "CompositeClientOverlay");
if (!CompositeClientOverlayType)
- return;
+ return;
if (!dixRegisterPrivateKey(&CompositeClientPrivateKeyRec, PRIVATE_CLIENT,
- sizeof(CompositeClientRec)))
- return;
+ sizeof(CompositeClientRec)))
+ return;
- if (!AddCallback (&ClientStateCallback, CompositeClientCallback, 0))
- return;
+ if (!AddCallback(&ClientStateCallback, CompositeClientCallback, 0))
+ return;
for (s = 0; s < screenInfo.numScreens; s++)
- if (!compScreenInit (screenInfo.screens[s]))
- return;
+ if (!compScreenInit(screenInfo.screens[s]))
+ return;
- extEntry = AddExtension (COMPOSITE_NAME, 0, 0,
- ProcCompositeDispatch, SProcCompositeDispatch,
- NULL, StandardMinorOpcode);
+ extEntry = AddExtension(COMPOSITE_NAME, 0, 0,
+ ProcCompositeDispatch, SProcCompositeDispatch,
+ NULL, StandardMinorOpcode);
if (!extEntry)
- return;
+ return;
CompositeReqCode = (CARD8) extEntry->base;
- miRegisterRedirectBorderClipProc (compSetRedirectBorderClip,
- compGetRedirectBorderClip);
+ miRegisterRedirectBorderClipProc(compSetRedirectBorderClip,
+ compGetRedirectBorderClip);
/* Initialization succeeded */
noCompositeExtension = FALSE;
@@ -571,175 +570,178 @@ CompositeExtensionInit (void)
int (*PanoramiXSaveCompositeVector[CompositeNumberRequests]) (ClientPtr);
static int
-PanoramiXCompositeRedirectWindow (ClientPtr client)
+PanoramiXCompositeRedirectWindow(ClientPtr client)
{
PanoramiXRes *win;
int rc = 0, j;
+
REQUEST(xCompositeRedirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->window = win->info[j].id;
- rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
- if (rc != Success) break;
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success)
+ break;
}
return rc;
}
static int
-PanoramiXCompositeRedirectSubwindows (ClientPtr client)
+PanoramiXCompositeRedirectSubwindows(ClientPtr client)
{
PanoramiXRes *win;
int rc = 0, j;
+
REQUEST(xCompositeRedirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->window = win->info[j].id;
- rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
- if (rc != Success) break;
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success)
+ break;
}
return rc;
}
static int
-PanoramiXCompositeUnredirectWindow (ClientPtr client)
+PanoramiXCompositeUnredirectWindow(ClientPtr client)
{
PanoramiXRes *win;
int rc = 0, j;
+
REQUEST(xCompositeUnredirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->window = win->info[j].id;
- rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
- if (rc != Success) break;
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success)
+ break;
}
return rc;
}
static int
-PanoramiXCompositeUnredirectSubwindows (ClientPtr client)
+PanoramiXCompositeUnredirectSubwindows(ClientPtr client)
{
PanoramiXRes *win;
int rc = 0, j;
+
REQUEST(xCompositeUnredirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->window = win->info[j].id;
- rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
- if (rc != Success) break;
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success)
+ break;
}
return rc;
}
static int
-PanoramiXCompositeNameWindowPixmap (ClientPtr client)
+PanoramiXCompositeNameWindowPixmap(ClientPtr client)
{
- WindowPtr pWin;
- CompWindowPtr cw;
- PixmapPtr pPixmap;
+ WindowPtr pWin;
+ CompWindowPtr cw;
+ PixmapPtr pPixmap;
int rc;
PanoramiXRes *win, *newPix;
int i;
+
REQUEST(xCompositeNameWindowPixmapReq);
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
- LEGAL_NEW_RESOURCE (stuff->pixmap, client);
+ LEGAL_NEW_RESOURCE(stuff->pixmap, client);
- if(!(newPix = malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPix = malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPix->type = XRT_PIXMAP;
newPix->u.pix.shared = FALSE;
panoramix_setup_ids(newPix, client, stuff->pixmap);
FOR_NSCREENS(i) {
- rc = dixLookupResourceByType ((void **) &pWin, win->info[i].id,
- RT_WINDOW, client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- free (newPix);
- return rc;
- }
-
- if (!pWin->viewable)
- {
- free (newPix);
- return BadMatch;
- }
-
- cw = GetCompWindow (pWin);
- if (!cw)
- {
- free (newPix);
- return BadMatch;
- }
-
- pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
- if (!pPixmap)
- {
- free (newPix);
- return BadMatch;
- }
-
- if (!AddResource (newPix->info[i].id, RT_PIXMAP,
- (pointer) pPixmap))
- return BadAlloc;
-
- ++pPixmap->refcnt;
+ rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
+ RT_WINDOW, client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->window;
+ free(newPix);
+ return rc;
+ }
+
+ if (!pWin->viewable) {
+ free(newPix);
+ return BadMatch;
+ }
+
+ cw = GetCompWindow(pWin);
+ if (!cw) {
+ free(newPix);
+ return BadMatch;
+ }
+
+ pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
+ if (!pPixmap) {
+ free(newPix);
+ return BadMatch;
+ }
+
+ if (!AddResource(newPix->info[i].id, RT_PIXMAP, (pointer) pPixmap))
+ return BadAlloc;
+
+ ++pPixmap->refcnt;
}
- if (!AddResource (stuff->pixmap, XRT_PIXMAP, (pointer) newPix))
- return BadAlloc;
+ if (!AddResource(stuff->pixmap, XRT_PIXMAP, (pointer) newPix))
+ return BadAlloc;
return Success;
}
-
static int
-PanoramiXCompositeGetOverlayWindow (ClientPtr client)
+PanoramiXCompositeGetOverlayWindow(ClientPtr client)
{
REQUEST(xCompositeGetOverlayWindowReq);
xCompositeGetOverlayWindowReply rep;
@@ -753,70 +755,65 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
cs = GetCompScreen(screenInfo.screens[0]);
- if (!cs->pOverlayWin)
- {
- if(!(overlayWin = malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!cs->pOverlayWin) {
+ if (!(overlayWin = malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
- overlayWin->type = XRT_WINDOW;
- overlayWin->u.win.root = FALSE;
+ overlayWin->type = XRT_WINDOW;
+ overlayWin->u.win.root = FALSE;
}
FOR_NSCREENS_BACKWARD(i) {
- rc = dixLookupResourceByType((pointer *)&pWin, win->info[i].id,
- RT_WINDOW, client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- return rc;
- }
- pScreen = pWin->drawable.pScreen;
-
- /*
- * Create an OverlayClient structure to mark this client's
- * interest in the overlay window
- */
- pOc = compCreateOverlayClient(pScreen, client);
- if (pOc == NULL)
- return BadAlloc;
-
- /*
- * Make sure the overlay window exists
- */
- cs = GetCompScreen(pScreen);
- if (cs->pOverlayWin == NULL)
- if (!compCreateOverlayWindow(pScreen))
- {
- FreeResource (pOc->resource, RT_NONE);
- return BadAlloc;
- }
-
- rc = XaceHook(XACE_RESOURCE_ACCESS, client,
- cs->pOverlayWin->drawable.id,
- RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
- DixGetAttrAccess);
- if (rc != Success)
- {
- FreeResource (pOc->resource, RT_NONE);
- return rc;
- }
+ rc = dixLookupResourceByType((pointer *) &pWin, win->info[i].id,
+ RT_WINDOW, client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+ pScreen = pWin->drawable.pScreen;
+
+ /*
+ * Create an OverlayClient structure to mark this client's
+ * interest in the overlay window
+ */
+ pOc = compCreateOverlayClient(pScreen, client);
+ if (pOc == NULL)
+ return BadAlloc;
+
+ /*
+ * Make sure the overlay window exists
+ */
+ cs = GetCompScreen(pScreen);
+ if (cs->pOverlayWin == NULL)
+ if (!compCreateOverlayWindow(pScreen)) {
+ FreeResource(pOc->resource, RT_NONE);
+ return BadAlloc;
+ }
+
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client,
+ cs->pOverlayWin->drawable.id,
+ RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
+ DixGetAttrAccess);
+ if (rc != Success) {
+ FreeResource(pOc->resource, RT_NONE);
+ return rc;
+ }
}
- if (overlayWin)
- {
- FOR_NSCREENS(i) {
- cs = GetCompScreen(screenInfo.screens[i]);
- overlayWin->info[i].id = cs->pOverlayWin->drawable.id;
- }
+ if (overlayWin) {
+ FOR_NSCREENS(i) {
+ cs = GetCompScreen(screenInfo.screens[i]);
+ overlayWin->info[i].id = cs->pOverlayWin->drawable.id;
+ }
- AddResource(overlayWin->info[0].id, XRT_WINDOW, overlayWin);
+ AddResource(overlayWin->info[0].id, XRT_WINDOW, overlayWin);
}
cs = GetCompScreen(screenInfo.screens[0]);
@@ -826,19 +823,19 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
rep.length = 0;
rep.overlayWin = cs->pOverlayWin->drawable.id;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.overlayWin);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.overlayWin);
}
- (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);
+ (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply,
+ (char *) &rep);
return Success;
}
static int
-PanoramiXCompositeReleaseOverlayWindow (ClientPtr client)
+PanoramiXCompositeReleaseOverlayWindow(ClientPtr client)
{
REQUEST(xCompositeReleaseOverlayWindowReq);
WindowPtr pWin;
@@ -849,69 +846,69 @@ PanoramiXCompositeReleaseOverlayWindow (ClientPtr client)
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
- if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
- client, DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
+ if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
}
FOR_NSCREENS_BACKWARD(i) {
- if ((rc = dixLookupResourceByType((void **)&pWin, win->info[i].id,
- XRT_WINDOW, client,
- DixUnknownAccess))) {
- client->errorValue = stuff->window;
- return rc;
- }
- pScreen = pWin->drawable.pScreen;
-
- /*
- * Has client queried a reference to the overlay window
- * on this screen? If not, generate an error.
- */
- pOc = compFindOverlayClient (pWin->drawable.pScreen, client);
- if (pOc == NULL)
- return BadMatch;
-
- /* The delete function will free the client structure */
- FreeResource (pOc->resource, RT_NONE);
+ if ((rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
+ XRT_WINDOW, client,
+ DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+ pScreen = pWin->drawable.pScreen;
+
+ /*
+ * Has client queried a reference to the overlay window
+ * on this screen? If not, generate an error.
+ */
+ pOc = compFindOverlayClient(pWin->drawable.pScreen, client);
+ if (pOc == NULL)
+ return BadMatch;
+
+ /* The delete function will free the client structure */
+ FreeResource(pOc->resource, RT_NONE);
}
return Success;
}
void
-PanoramiXCompositeInit (void)
+PanoramiXCompositeInit(void)
{
int i;
for (i = 0; i < CompositeNumberRequests; i++)
- PanoramiXSaveCompositeVector[i] = ProcCompositeVector[i];
+ PanoramiXSaveCompositeVector[i] = ProcCompositeVector[i];
/*
* Stuff in Xinerama aware request processing hooks
*/
ProcCompositeVector[X_CompositeRedirectWindow] =
- PanoramiXCompositeRedirectWindow;
+ PanoramiXCompositeRedirectWindow;
ProcCompositeVector[X_CompositeRedirectSubwindows] =
- PanoramiXCompositeRedirectSubwindows;
+ PanoramiXCompositeRedirectSubwindows;
ProcCompositeVector[X_CompositeUnredirectWindow] =
- PanoramiXCompositeUnredirectWindow;
+ PanoramiXCompositeUnredirectWindow;
ProcCompositeVector[X_CompositeUnredirectSubwindows] =
- PanoramiXCompositeUnredirectSubwindows;
+ PanoramiXCompositeUnredirectSubwindows;
ProcCompositeVector[X_CompositeNameWindowPixmap] =
- PanoramiXCompositeNameWindowPixmap;
+ PanoramiXCompositeNameWindowPixmap;
ProcCompositeVector[X_CompositeGetOverlayWindow] =
- PanoramiXCompositeGetOverlayWindow;
+ PanoramiXCompositeGetOverlayWindow;
ProcCompositeVector[X_CompositeReleaseOverlayWindow] =
- PanoramiXCompositeReleaseOverlayWindow;
+ PanoramiXCompositeReleaseOverlayWindow;
}
void
-PanoramiXCompositeReset (void)
+PanoramiXCompositeReset(void)
{
int i;
for (i = 0; i < CompositeNumberRequests; i++)
- ProcCompositeVector[i] = PanoramiXSaveCompositeVector[i];
+ ProcCompositeVector[i] = PanoramiXSaveCompositeVector[i];
}
#endif
diff --git a/xorg-server/composite/compinit.c b/xorg-server/composite/compinit.c
index 291b759be..eaa125681 100644
--- a/xorg-server/composite/compinit.c
+++ b/xorg-server/composite/compinit.c
@@ -1,415 +1,416 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Copyright © 2003 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "compint.h"
-#include "compositeext.h"
-
-DevPrivateKeyRec CompScreenPrivateKeyRec;
-DevPrivateKeyRec CompWindowPrivateKeyRec;
-DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
-
-static Bool
-compCloseScreen (int index, ScreenPtr pScreen)
-{
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret;
-
- free(cs->alternateVisuals);
-
- pScreen->CloseScreen = cs->CloseScreen;
- pScreen->InstallColormap = cs->InstallColormap;
- pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
- pScreen->ReparentWindow = cs->ReparentWindow;
- pScreen->ConfigNotify = cs->ConfigNotify;
- pScreen->MoveWindow = cs->MoveWindow;
- pScreen->ResizeWindow = cs->ResizeWindow;
- pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
-
- pScreen->ClipNotify = cs->ClipNotify;
- pScreen->UnrealizeWindow = cs->UnrealizeWindow;
- pScreen->RealizeWindow = cs->RealizeWindow;
- pScreen->DestroyWindow = cs->DestroyWindow;
- pScreen->CreateWindow = cs->CreateWindow;
- pScreen->CopyWindow = cs->CopyWindow;
- pScreen->PositionWindow = cs->PositionWindow;
-
- pScreen->GetImage = cs->GetImage;
- pScreen->SourceValidate = cs->SourceValidate;
-
- free(cs);
- dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
- ret = (*pScreen->CloseScreen) (index, pScreen);
-
- return ret;
-}
-
-static void
-compInstallColormap (ColormapPtr pColormap)
-{
- VisualPtr pVisual = pColormap->pVisual;
- ScreenPtr pScreen = pColormap->pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- int a;
-
- for (a = 0; a < cs->numAlternateVisuals; a++)
- if (pVisual->vid == cs->alternateVisuals[a])
- return;
- pScreen->InstallColormap = cs->InstallColormap;
- (*pScreen->InstallColormap) (pColormap);
- cs->InstallColormap = pScreen->InstallColormap;
- pScreen->InstallColormap = compInstallColormap;
-}
-
-/* Fake backing store via automatic redirection */
-static Bool
-compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret;
-
- pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
- ret = pScreen->ChangeWindowAttributes(pWin, mask);
-
- if (ret && (mask & CWBackingStore) &&
- pScreen->backingStoreSupport != NotUseful) {
- if (pWin->backingStore != NotUseful) {
- compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
- pWin->backStorage = (pointer) (intptr_t) 1;
- } else {
- compUnredirectWindow(serverClient, pWin,
- CompositeRedirectAutomatic);
- pWin->backStorage = NULL;
- }
- }
-
- pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
-
- return ret;
-}
-
-static void
-compGetImage (DrawablePtr pDrawable,
- int sx, int sy,
- int w, int h,
- unsigned int format,
- unsigned long planemask,
- char *pdstLine)
-{
- ScreenPtr pScreen = pDrawable->pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
-
- pScreen->GetImage = cs->GetImage;
- if (pDrawable->type == DRAWABLE_WINDOW)
- compPaintChildrenToWindow ((WindowPtr) pDrawable);
- (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine);
- cs->GetImage = pScreen->GetImage;
- pScreen->GetImage = compGetImage;
-}
-
-static void compSourceValidate(DrawablePtr pDrawable,
- int x, int y,
- int width, int height,
- unsigned int subWindowMode)
-{
- ScreenPtr pScreen = pDrawable->pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
-
- pScreen->SourceValidate = cs->SourceValidate;
- if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors)
- compPaintChildrenToWindow ((WindowPtr) pDrawable);
- if (pScreen->SourceValidate)
- (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
- subWindowMode);
- cs->SourceValidate = pScreen->SourceValidate;
- pScreen->SourceValidate = compSourceValidate;
-}
-
-/*
- * Add alternate visuals -- always expose an ARGB32 and RGB24 visual
- */
-
-static DepthPtr
-compFindVisuallessDepth (ScreenPtr pScreen, int d)
-{
- int i;
-
- for (i = 0; i < pScreen->numDepths; i++)
- {
- DepthPtr depth = &pScreen->allowedDepths[i];
- if (depth->depth == d)
- {
- /*
- * Make sure it doesn't have visuals already
- */
- if (depth->numVids)
- return 0;
- /*
- * looks fine
- */
- return depth;
- }
- }
- /*
- * If there isn't one, then it's gonna be hard to have
- * an associated visual
- */
- return 0;
-}
-
-/*
- * Add a list of visual IDs to the list of visuals to implicitly redirect.
- */
-static Bool
-compRegisterAlternateVisuals (CompScreenPtr cs, VisualID *vids, int nVisuals)
-{
- VisualID *p;
-
- p = realloc(cs->alternateVisuals,
- sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
- if(p == NULL)
- return FALSE;
-
- memcpy(&p[cs->numAlternateVisuals], vids, sizeof(VisualID) * nVisuals);
-
- cs->alternateVisuals = p;
- cs->numAlternateVisuals += nVisuals;
-
- return TRUE;
-}
-
-Bool CompositeRegisterAlternateVisuals (ScreenPtr pScreen, VisualID *vids,
- int nVisuals)
-{
- CompScreenPtr cs = GetCompScreen (pScreen);
- return compRegisterAlternateVisuals(cs, vids, nVisuals);
-}
-
-typedef struct _alternateVisual {
- int depth;
- CARD32 format;
-} CompAlternateVisual;
-
-static CompAlternateVisual altVisuals[] = {
-#if COMP_INCLUDE_RGB24_VISUAL
- { 24, PICT_r8g8b8 },
-#endif
- { 32, PICT_a8r8g8b8 },
-};
-
-static const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) /
- sizeof(CompAlternateVisual);
-
-static Bool
-compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
- CompAlternateVisual *alt)
-{
- VisualPtr visual;
- DepthPtr depth;
- PictFormatPtr pPictFormat;
- unsigned long alphaMask;
-
- /*
- * The ARGB32 visual is always available. Other alternate depth visuals
- * are only provided if their depth is less than the root window depth.
- * There's no deep reason for this.
- */
- if (alt->depth >= pScreen->rootDepth && alt->depth != 32)
- return FALSE;
-
- depth = compFindVisuallessDepth (pScreen, alt->depth);
- if (!depth)
- /* alt->depth doesn't exist or already has alternate visuals. */
- return TRUE;
-
- pPictFormat = PictureMatchFormat (pScreen, alt->depth, alt->format);
- if (!pPictFormat)
- return FALSE;
-
- if (ResizeVisualArray(pScreen, 1, depth) == FALSE) {
- return FALSE;
- }
-
- visual = pScreen->visuals + (pScreen->numVisuals - 1); /* the new one */
-
- /* Initialize the visual */
- visual->bitsPerRGBValue = 8;
- if (PICT_FORMAT_TYPE(alt->format) == PICT_TYPE_COLOR) {
- visual->class = PseudoColor;
- visual->nplanes = PICT_FORMAT_BPP(alt->format);
- visual->ColormapEntries = 1 << visual->nplanes;
- } else {
- DirectFormatRec *direct = &pPictFormat->direct;
- visual->class = TrueColor;
- visual->redMask = ((unsigned long)direct->redMask) << direct->red;
- visual->greenMask = ((unsigned long)direct->greenMask) << direct->green;
- visual->blueMask = ((unsigned long)direct->blueMask) << direct->blue;
- alphaMask = ((unsigned long)direct->alphaMask) << direct->alpha;
- visual->offsetRed = direct->red;
- visual->offsetGreen = direct->green;
- visual->offsetBlue = direct->blue;
- /*
- * Include A bits in this (unlike GLX which includes only RGB)
- * This lets DIX compute suitable masks for colormap allocations
- */
- visual->nplanes = Ones (visual->redMask |
- visual->greenMask |
- visual->blueMask |
- alphaMask);
- /* find widest component */
- visual->ColormapEntries = (1 << max (Ones (visual->redMask),
- max (Ones (visual->greenMask),
- Ones (visual->blueMask))));
- }
-
- /* remember the visual ID to detect auto-update windows */
- compRegisterAlternateVisuals(cs, &visual->vid, 1);
-
- return TRUE;
-}
-
-static Bool
-compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
-{
- int alt, ret = 0;
-
- for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++)
- ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt);
-
- return !!ret;
-}
-
-Bool
-compScreenInit (ScreenPtr pScreen)
-{
- CompScreenPtr cs;
-
- if (!dixRegisterPrivateKey(&CompScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
- if (!dixRegisterPrivateKey(&CompWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
- if (!dixRegisterPrivateKey(&CompSubwindowsPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
-
- if (GetCompScreen (pScreen))
- return TRUE;
- cs = (CompScreenPtr) malloc(sizeof (CompScreenRec));
- if (!cs)
- return FALSE;
-
- cs->overlayWid = FakeClientID(0);
- cs->pOverlayWin = NULL;
- cs->pOverlayClients = NULL;
-
- cs->numAlternateVisuals = 0;
- cs->alternateVisuals = NULL;
-
- if (!compAddAlternateVisuals (pScreen, cs))
- {
- free(cs);
- return FALSE;
- }
-
- cs->PositionWindow = pScreen->PositionWindow;
- pScreen->PositionWindow = compPositionWindow;
-
- cs->CopyWindow = pScreen->CopyWindow;
- pScreen->CopyWindow = compCopyWindow;
-
- cs->CreateWindow = pScreen->CreateWindow;
- pScreen->CreateWindow = compCreateWindow;
-
- cs->DestroyWindow = pScreen->DestroyWindow;
- pScreen->DestroyWindow = compDestroyWindow;
-
- cs->RealizeWindow = pScreen->RealizeWindow;
- pScreen->RealizeWindow = compRealizeWindow;
-
- cs->UnrealizeWindow = pScreen->UnrealizeWindow;
- pScreen->UnrealizeWindow = compUnrealizeWindow;
-
- cs->ClipNotify = pScreen->ClipNotify;
- pScreen->ClipNotify = compClipNotify;
-
- cs->ConfigNotify = pScreen->ConfigNotify;
- pScreen->ConfigNotify = compConfigNotify;
-
- cs->MoveWindow = pScreen->MoveWindow;
- pScreen->MoveWindow = compMoveWindow;
-
- cs->ResizeWindow = pScreen->ResizeWindow;
- pScreen->ResizeWindow = compResizeWindow;
-
- cs->ChangeBorderWidth = pScreen->ChangeBorderWidth;
- pScreen->ChangeBorderWidth = compChangeBorderWidth;
-
- cs->ReparentWindow = pScreen->ReparentWindow;
- pScreen->ReparentWindow = compReparentWindow;
-
- cs->InstallColormap = pScreen->InstallColormap;
- pScreen->InstallColormap = compInstallColormap;
-
- cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
- pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
-
- cs->BlockHandler = NULL;
-
- cs->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = compCloseScreen;
-
- cs->GetImage = pScreen->GetImage;
- pScreen->GetImage = compGetImage;
-
- cs->SourceValidate = pScreen->SourceValidate;
- pScreen->SourceValidate = compSourceValidate;
-
- dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs);
-
- RegisterRealChildHeadProc(CompositeRealChildHead);
-
- return TRUE;
-}
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "compint.h"
+#include "compositeext.h"
+
+DevPrivateKeyRec CompScreenPrivateKeyRec;
+DevPrivateKeyRec CompWindowPrivateKeyRec;
+DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
+
+static Bool
+compCloseScreen(int index, ScreenPtr pScreen)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret;
+
+ free(cs->alternateVisuals);
+
+ pScreen->CloseScreen = cs->CloseScreen;
+ pScreen->InstallColormap = cs->InstallColormap;
+ pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
+ pScreen->ReparentWindow = cs->ReparentWindow;
+ pScreen->ConfigNotify = cs->ConfigNotify;
+ pScreen->MoveWindow = cs->MoveWindow;
+ pScreen->ResizeWindow = cs->ResizeWindow;
+ pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
+
+ pScreen->ClipNotify = cs->ClipNotify;
+ pScreen->UnrealizeWindow = cs->UnrealizeWindow;
+ pScreen->RealizeWindow = cs->RealizeWindow;
+ pScreen->DestroyWindow = cs->DestroyWindow;
+ pScreen->CreateWindow = cs->CreateWindow;
+ pScreen->CopyWindow = cs->CopyWindow;
+ pScreen->PositionWindow = cs->PositionWindow;
+
+ pScreen->GetImage = cs->GetImage;
+ pScreen->SourceValidate = cs->SourceValidate;
+
+ free(cs);
+ dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
+ ret = (*pScreen->CloseScreen) (index, pScreen);
+
+ return ret;
+}
+
+static void
+compInstallColormap(ColormapPtr pColormap)
+{
+ VisualPtr pVisual = pColormap->pVisual;
+ ScreenPtr pScreen = pColormap->pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ int a;
+
+ for (a = 0; a < cs->numAlternateVisuals; a++)
+ if (pVisual->vid == cs->alternateVisuals[a])
+ return;
+ pScreen->InstallColormap = cs->InstallColormap;
+ (*pScreen->InstallColormap) (pColormap);
+ cs->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = compInstallColormap;
+}
+
+/* Fake backing store via automatic redirection */
+static Bool
+compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret;
+
+ pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
+ ret = pScreen->ChangeWindowAttributes(pWin, mask);
+
+ if (ret && (mask & CWBackingStore) &&
+ pScreen->backingStoreSupport != NotUseful) {
+ if (pWin->backingStore != NotUseful) {
+ compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
+ pWin->backStorage = (pointer) (intptr_t) 1;
+ }
+ else {
+ compUnredirectWindow(serverClient, pWin,
+ CompositeRedirectAutomatic);
+ pWin->backStorage = NULL;
+ }
+ }
+
+ pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
+
+ return ret;
+}
+
+static void
+compGetImage(DrawablePtr pDrawable,
+ int sx, int sy,
+ int w, int h,
+ unsigned int format, unsigned long planemask, char *pdstLine)
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+
+ pScreen->GetImage = cs->GetImage;
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ compPaintChildrenToWindow((WindowPtr) pDrawable);
+ (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine);
+ cs->GetImage = pScreen->GetImage;
+ pScreen->GetImage = compGetImage;
+}
+
+static void
+compSourceValidate(DrawablePtr pDrawable,
+ int x, int y,
+ int width, int height, unsigned int subWindowMode)
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+
+ pScreen->SourceValidate = cs->SourceValidate;
+ if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors)
+ compPaintChildrenToWindow((WindowPtr) pDrawable);
+ if (pScreen->SourceValidate)
+ (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
+ subWindowMode);
+ cs->SourceValidate = pScreen->SourceValidate;
+ pScreen->SourceValidate = compSourceValidate;
+}
+
+/*
+ * Add alternate visuals -- always expose an ARGB32 and RGB24 visual
+ */
+
+static DepthPtr
+compFindVisuallessDepth(ScreenPtr pScreen, int d)
+{
+ int i;
+
+ for (i = 0; i < pScreen->numDepths; i++) {
+ DepthPtr depth = &pScreen->allowedDepths[i];
+
+ if (depth->depth == d) {
+ /*
+ * Make sure it doesn't have visuals already
+ */
+ if (depth->numVids)
+ return 0;
+ /*
+ * looks fine
+ */
+ return depth;
+ }
+ }
+ /*
+ * If there isn't one, then it's gonna be hard to have
+ * an associated visual
+ */
+ return 0;
+}
+
+/*
+ * Add a list of visual IDs to the list of visuals to implicitly redirect.
+ */
+static Bool
+compRegisterAlternateVisuals(CompScreenPtr cs, VisualID * vids, int nVisuals)
+{
+ VisualID *p;
+
+ p = realloc(cs->alternateVisuals,
+ sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
+ if (p == NULL)
+ return FALSE;
+
+ memcpy(&p[cs->numAlternateVisuals], vids, sizeof(VisualID) * nVisuals);
+
+ cs->alternateVisuals = p;
+ cs->numAlternateVisuals += nVisuals;
+
+ return TRUE;
+}
+
+Bool
+CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids,
+ int nVisuals)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+
+ return compRegisterAlternateVisuals(cs, vids, nVisuals);
+}
+
+typedef struct _alternateVisual {
+ int depth;
+ CARD32 format;
+} CompAlternateVisual;
+
+static CompAlternateVisual altVisuals[] = {
+#if COMP_INCLUDE_RGB24_VISUAL
+ {24, PICT_r8g8b8},
+#endif
+ {32, PICT_a8r8g8b8},
+};
+
+static const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) /
+ sizeof(CompAlternateVisual);
+
+static Bool
+compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
+ CompAlternateVisual * alt)
+{
+ VisualPtr visual;
+ DepthPtr depth;
+ PictFormatPtr pPictFormat;
+ unsigned long alphaMask;
+
+ /*
+ * The ARGB32 visual is always available. Other alternate depth visuals
+ * are only provided if their depth is less than the root window depth.
+ * There's no deep reason for this.
+ */
+ if (alt->depth >= pScreen->rootDepth && alt->depth != 32)
+ return FALSE;
+
+ depth = compFindVisuallessDepth(pScreen, alt->depth);
+ if (!depth)
+ /* alt->depth doesn't exist or already has alternate visuals. */
+ return TRUE;
+
+ pPictFormat = PictureMatchFormat(pScreen, alt->depth, alt->format);
+ if (!pPictFormat)
+ return FALSE;
+
+ if (ResizeVisualArray(pScreen, 1, depth) == FALSE) {
+ return FALSE;
+ }
+
+ visual = pScreen->visuals + (pScreen->numVisuals - 1); /* the new one */
+
+ /* Initialize the visual */
+ visual->bitsPerRGBValue = 8;
+ if (PICT_FORMAT_TYPE(alt->format) == PICT_TYPE_COLOR) {
+ visual->class = PseudoColor;
+ visual->nplanes = PICT_FORMAT_BPP(alt->format);
+ visual->ColormapEntries = 1 << visual->nplanes;
+ }
+ else {
+ DirectFormatRec *direct = &pPictFormat->direct;
+
+ visual->class = TrueColor;
+ visual->redMask = ((unsigned long) direct->redMask) << direct->red;
+ visual->greenMask =
+ ((unsigned long) direct->greenMask) << direct->green;
+ visual->blueMask = ((unsigned long) direct->blueMask) << direct->blue;
+ alphaMask = ((unsigned long) direct->alphaMask) << direct->alpha;
+ visual->offsetRed = direct->red;
+ visual->offsetGreen = direct->green;
+ visual->offsetBlue = direct->blue;
+ /*
+ * Include A bits in this (unlike GLX which includes only RGB)
+ * This lets DIX compute suitable masks for colormap allocations
+ */
+ visual->nplanes = Ones(visual->redMask |
+ visual->greenMask |
+ visual->blueMask | alphaMask);
+ /* find widest component */
+ visual->ColormapEntries = (1 << max(Ones(visual->redMask),
+ max(Ones(visual->greenMask),
+ Ones(visual->blueMask))));
+ }
+
+ /* remember the visual ID to detect auto-update windows */
+ compRegisterAlternateVisuals(cs, &visual->vid, 1);
+
+ return TRUE;
+}
+
+static Bool
+compAddAlternateVisuals(ScreenPtr pScreen, CompScreenPtr cs)
+{
+ int alt, ret = 0;
+
+ for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++)
+ ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt);
+
+ return ! !ret;
+}
+
+Bool
+compScreenInit(ScreenPtr pScreen)
+{
+ CompScreenPtr cs;
+
+ if (!dixRegisterPrivateKey(&CompScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&CompWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&CompSubwindowsPrivateKeyRec, PRIVATE_WINDOW, 0))
+ return FALSE;
+
+ if (GetCompScreen(pScreen))
+ return TRUE;
+ cs = (CompScreenPtr) malloc(sizeof(CompScreenRec));
+ if (!cs)
+ return FALSE;
+
+ cs->overlayWid = FakeClientID(0);
+ cs->pOverlayWin = NULL;
+ cs->pOverlayClients = NULL;
+
+ cs->numAlternateVisuals = 0;
+ cs->alternateVisuals = NULL;
+
+ if (!compAddAlternateVisuals(pScreen, cs)) {
+ free(cs);
+ return FALSE;
+ }
+
+ cs->PositionWindow = pScreen->PositionWindow;
+ pScreen->PositionWindow = compPositionWindow;
+
+ cs->CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = compCopyWindow;
+
+ cs->CreateWindow = pScreen->CreateWindow;
+ pScreen->CreateWindow = compCreateWindow;
+
+ cs->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = compDestroyWindow;
+
+ cs->RealizeWindow = pScreen->RealizeWindow;
+ pScreen->RealizeWindow = compRealizeWindow;
+
+ cs->UnrealizeWindow = pScreen->UnrealizeWindow;
+ pScreen->UnrealizeWindow = compUnrealizeWindow;
+
+ cs->ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = compClipNotify;
+
+ cs->ConfigNotify = pScreen->ConfigNotify;
+ pScreen->ConfigNotify = compConfigNotify;
+
+ cs->MoveWindow = pScreen->MoveWindow;
+ pScreen->MoveWindow = compMoveWindow;
+
+ cs->ResizeWindow = pScreen->ResizeWindow;
+ pScreen->ResizeWindow = compResizeWindow;
+
+ cs->ChangeBorderWidth = pScreen->ChangeBorderWidth;
+ pScreen->ChangeBorderWidth = compChangeBorderWidth;
+
+ cs->ReparentWindow = pScreen->ReparentWindow;
+ pScreen->ReparentWindow = compReparentWindow;
+
+ cs->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = compInstallColormap;
+
+ cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+ pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
+
+ cs->BlockHandler = NULL;
+
+ cs->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = compCloseScreen;
+
+ cs->GetImage = pScreen->GetImage;
+ pScreen->GetImage = compGetImage;
+
+ cs->SourceValidate = pScreen->SourceValidate;
+ pScreen->SourceValidate = compSourceValidate;
+
+ dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs);
+
+ RegisterRealChildHeadProc(CompositeRealChildHead);
+
+ return TRUE;
+}
diff --git a/xorg-server/composite/compint.h b/xorg-server/composite/compint.h
index bb5335d70..6c4272e5b 100644
--- a/xorg-server/composite/compint.h
+++ b/xorg-server/composite/compint.h
@@ -80,29 +80,29 @@
*/
typedef struct _CompClientWindow {
- struct _CompClientWindow *next;
- XID id;
- int update;
-} CompClientWindowRec, *CompClientWindowPtr;
+ struct _CompClientWindow *next;
+ XID id;
+ int update;
+} CompClientWindowRec, *CompClientWindowPtr;
typedef struct _CompWindow {
- RegionRec borderClip;
- DamagePtr damage; /* for automatic update mode */
- Bool damageRegistered;
- Bool damaged;
- int update;
- CompClientWindowPtr clients;
- int oldx;
- int oldy;
- PixmapPtr pOldPixmap;
- int borderClipX, borderClipY;
+ RegionRec borderClip;
+ DamagePtr damage; /* for automatic update mode */
+ Bool damageRegistered;
+ Bool damaged;
+ int update;
+ CompClientWindowPtr clients;
+ int oldx;
+ int oldy;
+ PixmapPtr pOldPixmap;
+ int borderClipX, borderClipY;
} CompWindowRec, *CompWindowPtr;
#define COMP_ORIGIN_INVALID 0x80000000
typedef struct _CompSubwindows {
- int update;
- CompClientWindowPtr clients;
+ int update;
+ CompClientWindowPtr clients;
} CompSubwindowsRec, *CompSubwindowsPtr;
#ifndef COMP_INCLUDE_RGB24_VISUAL
@@ -112,64 +112,67 @@ typedef struct _CompSubwindows {
typedef struct _CompOverlayClientRec *CompOverlayClientPtr;
typedef struct _CompOverlayClientRec {
- CompOverlayClientPtr pNext;
- ClientPtr pClient;
- ScreenPtr pScreen;
- XID resource;
+ CompOverlayClientPtr pNext;
+ ClientPtr pClient;
+ ScreenPtr pScreen;
+ XID resource;
} CompOverlayClientRec;
typedef struct _CompScreen {
- PositionWindowProcPtr PositionWindow;
- CopyWindowProcPtr CopyWindow;
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- ClipNotifyProcPtr ClipNotify;
+ PositionWindowProcPtr PositionWindow;
+ CopyWindowProcPtr CopyWindow;
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ ClipNotifyProcPtr ClipNotify;
/*
* Called from ConfigureWindow, these
* three track changes to the offscreen storage
* geometry
*/
- ConfigNotifyProcPtr ConfigNotify;
- MoveWindowProcPtr MoveWindow;
- ResizeWindowProcPtr ResizeWindow;
- ChangeBorderWidthProcPtr ChangeBorderWidth;
+ ConfigNotifyProcPtr ConfigNotify;
+ MoveWindowProcPtr MoveWindow;
+ ResizeWindowProcPtr ResizeWindow;
+ ChangeBorderWidthProcPtr ChangeBorderWidth;
/*
* Reparenting has an effect on Subwindows redirect
*/
- ReparentWindowProcPtr ReparentWindow;
-
+ ReparentWindowProcPtr ReparentWindow;
+
/*
* Colormaps for new visuals better not get installed
*/
- InstallColormapProcPtr InstallColormap;
+ InstallColormapProcPtr InstallColormap;
/*
* Fake backing store via automatic redirection
*/
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- ScreenBlockHandlerProcPtr BlockHandler;
- CloseScreenProcPtr CloseScreen;
- int numAlternateVisuals;
- VisualID *alternateVisuals;
-
- WindowPtr pOverlayWin;
- Window overlayWid;
- CompOverlayClientPtr pOverlayClients;
-
- GetImageProcPtr GetImage;
- SourceValidateProcPtr SourceValidate;
+ ScreenBlockHandlerProcPtr BlockHandler;
+ CloseScreenProcPtr CloseScreen;
+ int numAlternateVisuals;
+ VisualID *alternateVisuals;
+
+ WindowPtr pOverlayWin;
+ Window overlayWid;
+ CompOverlayClientPtr pOverlayClients;
+
+ GetImageProcPtr GetImage;
+ SourceValidateProcPtr SourceValidate;
} CompScreenRec, *CompScreenPtr;
extern DevPrivateKeyRec CompScreenPrivateKeyRec;
+
#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)
extern DevPrivateKeyRec CompWindowPrivateKeyRec;
+
#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)
extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
+
#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
#define GetCompScreen(s) ((CompScreenPtr) \
@@ -179,83 +182,84 @@ extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
-extern RESTYPE CompositeClientWindowType;
-extern RESTYPE CompositeClientSubwindowsType;
-extern RESTYPE CompositeClientOverlayType;
+extern RESTYPE CompositeClientWindowType;
+extern RESTYPE CompositeClientSubwindowsType;
+extern RESTYPE CompositeClientOverlayType;
/*
* compalloc.c
*/
Bool
-compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
+ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
void
-compFreeClientWindow (WindowPtr pWin, XID id);
+ compFreeClientWindow(WindowPtr pWin, XID id);
int
-compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
+ compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
int
-compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update);
+ compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
void
-compFreeClientSubwindows (WindowPtr pWin, XID id);
+ compFreeClientSubwindows(WindowPtr pWin, XID id);
int
-compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update);
+ compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
int
-compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin);
+ compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
int
-compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin);
+ compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
Bool
-compAllocPixmap (WindowPtr pWin);
+ compAllocPixmap(WindowPtr pWin);
void
-compSetParentPixmap (WindowPtr pWin);
+ compSetParentPixmap(WindowPtr pWin);
void
-compRestoreWindow (WindowPtr pWin, PixmapPtr pPixmap);
+ compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
Bool
-compReallocPixmap (WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, int bw);
+
+compReallocPixmap(WindowPtr pWin, int x, int y,
+ unsigned int w, unsigned int h, int bw);
/*
* compext.c
*/
void
-CompositeExtensionInit (void);
+ CompositeExtensionInit(void);
/*
* compinit.c
*/
Bool
-compScreenInit (ScreenPtr pScreen);
+ compScreenInit(ScreenPtr pScreen);
/*
* compoverlay.c
*/
void
-compFreeOverlayClient (CompOverlayClientPtr pOcToDel);
+ compFreeOverlayClient(CompOverlayClientPtr pOcToDel);
CompOverlayClientPtr
-compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient);
-
+compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
+
CompOverlayClientPtr
-compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient);
+compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
Bool
-compCreateOverlayWindow (ScreenPtr pScreen);
+ compCreateOverlayWindow(ScreenPtr pScreen);
void
-compDestroyOverlayWindow (ScreenPtr pScreen);
+ compDestroyOverlayWindow(ScreenPtr pScreen);
/*
* compwindow.c
@@ -263,74 +267,75 @@ compDestroyOverlayWindow (ScreenPtr pScreen);
#ifdef COMPOSITE_DEBUG
void
-compCheckTree (ScreenPtr pScreen);
+ compCheckTree(ScreenPtr pScreen);
#else
#define compCheckTree(s)
#endif
-PictFormatPtr
-compWindowFormat (WindowPtr pWin);
+PictFormatPtr compWindowFormat(WindowPtr pWin);
void
-compSetPixmap (WindowPtr pWin, PixmapPtr pPixmap);
+ compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap);
Bool
-compCheckRedirect (WindowPtr pWin);
+ compCheckRedirect(WindowPtr pWin);
Bool
-compPositionWindow (WindowPtr pWin, int x, int y);
+ compPositionWindow(WindowPtr pWin, int x, int y);
Bool
-compRealizeWindow (WindowPtr pWin);
+ compRealizeWindow(WindowPtr pWin);
Bool
-compUnrealizeWindow (WindowPtr pWin);
+ compUnrealizeWindow(WindowPtr pWin);
void
-compClipNotify (WindowPtr pWin, int dx, int dy);
+ compClipNotify(WindowPtr pWin, int dx, int dy);
void
-compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
+ compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
void
-compResizeWindow (WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib);
+
+compResizeWindow(WindowPtr pWin, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib);
void
-compChangeBorderWidth (WindowPtr pWin, unsigned int border_width);
+ compChangeBorderWidth(WindowPtr pWin, unsigned int border_width);
void
-compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent);
+ compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent);
Bool
-compCreateWindow (WindowPtr pWin);
+ compCreateWindow(WindowPtr pWin);
Bool
-compDestroyWindow (WindowPtr pWin);
+ compDestroyWindow(WindowPtr pWin);
void
-compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion);
+ compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion);
RegionPtr
-compGetRedirectBorderClip (WindowPtr pWin);
+ compGetRedirectBorderClip(WindowPtr pWin);
void
-compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+ compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
void
-compPaintChildrenToWindow (WindowPtr pWin);
+ compPaintChildrenToWindow(WindowPtr pWin);
WindowPtr
-CompositeRealChildHead (WindowPtr pWin);
+ CompositeRealChildHead(WindowPtr pWin);
int
-DeleteWindowNoInputDevices(pointer value, XID wid);
+ DeleteWindowNoInputDevices(pointer value, XID wid);
int
+
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
- int bw, WindowPtr pSib);
+ int bw, WindowPtr pSib);
-void PanoramiXCompositeInit (void);
-void PanoramiXCompositeReset (void);
+void PanoramiXCompositeInit(void);
+void PanoramiXCompositeReset(void);
-#endif /* _COMPINT_H_ */
+#endif /* _COMPINT_H_ */
diff --git a/xorg-server/composite/compoverlay.c b/xorg-server/composite/compoverlay.c
index 6ac05e8ad..3eafc2031 100644
--- a/xorg-server/composite/compoverlay.c
+++ b/xorg-server/composite/compoverlay.c
@@ -1,177 +1,174 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Copyright © 2003 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifdef CreateWindow
-#undef CreateWindow
-#endif
-
-#include "compint.h"
-#include "xace.h"
-
-#ifdef PANORAMIX
-#include "panoramiXsrv.h"
-#endif
-
-/*
- * Delete the given overlay client list element from its screen list.
- */
-void
-compFreeOverlayClient (CompOverlayClientPtr pOcToDel)
-{
- ScreenPtr pScreen = pOcToDel->pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- CompOverlayClientPtr *pPrev, pOc;
-
- for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext)
- {
- if (pOc == pOcToDel) {
- *pPrev = pOc->pNext;
- free(pOc);
- break;
- }
- }
-
- /* Destroy overlay window when there are no more clients using it */
- if (cs->pOverlayClients == NULL)
- compDestroyOverlayWindow (pScreen);
-}
-
-/*
- * Return the client's first overlay client rec from the given screen
- */
-CompOverlayClientPtr
-compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
-{
- CompScreenPtr cs = GetCompScreen(pScreen);
- CompOverlayClientPtr pOc;
-
- for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext)
- if (pOc->pClient == pClient)
- return pOc;
-
- return NULL;
-}
-
-/*
- * Create an overlay client object for the given client
- */
-CompOverlayClientPtr
-compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
-{
- CompScreenPtr cs = GetCompScreen(pScreen);
- CompOverlayClientPtr pOc;
-
- pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
- if (pOc == NULL)
- return NULL;
-
- pOc->pClient = pClient;
- pOc->pScreen = pScreen;
- pOc->resource = FakeClientID(pClient->index);
- pOc->pNext = cs->pOverlayClients;
- cs->pOverlayClients = pOc;
-
- /*
- * Create a resource for this element so it can be deleted
- * when the client goes away.
- */
- if (!AddResource (pOc->resource, CompositeClientOverlayType, (pointer) pOc))
- return NULL;
-
- return pOc;
-}
-
-/*
- * Create the overlay window and map it
- */
-Bool
-compCreateOverlayWindow (ScreenPtr pScreen)
-{
- CompScreenPtr cs = GetCompScreen(pScreen);
- WindowPtr pRoot = pScreen->root;
- WindowPtr pWin;
- XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
- int result;
- int w = pScreen->width;
- int h = pScreen->height;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- {
- w = PanoramiXPixWidth;
- h = PanoramiXPixHeight;
- }
-#endif
-
- pWin = cs->pOverlayWin =
- CreateWindow (cs->overlayWid, pRoot, 0, 0, w, h, 0,
- InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
- pRoot->drawable.depth,
- serverClient, pScreen->rootVisual, &result);
- if (pWin == NULL)
- return FALSE;
-
- if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin))
- return FALSE;
-
- MapWindow(pWin, serverClient);
-
- return TRUE;
-}
-
-/*
- * Destroy the overlay window
- */
-void
-compDestroyOverlayWindow (ScreenPtr pScreen)
-{
- CompScreenPtr cs = GetCompScreen(pScreen);
-
- cs->pOverlayWin = NullWindow;
- FreeResource (cs->overlayWid, RT_NONE);
-}
-
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef CreateWindow
+#undef CreateWindow
+#endif
+
+#include "compint.h"
+#include "xace.h"
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+/*
+ * Delete the given overlay client list element from its screen list.
+ */
+void
+compFreeOverlayClient(CompOverlayClientPtr pOcToDel)
+{
+ ScreenPtr pScreen = pOcToDel->pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompOverlayClientPtr *pPrev, pOc;
+
+ for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) {
+ if (pOc == pOcToDel) {
+ *pPrev = pOc->pNext;
+ free(pOc);
+ break;
+ }
+ }
+
+ /* Destroy overlay window when there are no more clients using it */
+ if (cs->pOverlayClients == NULL)
+ compDestroyOverlayWindow(pScreen);
+}
+
+/*
+ * Return the client's first overlay client rec from the given screen
+ */
+CompOverlayClientPtr
+compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompOverlayClientPtr pOc;
+
+ for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext)
+ if (pOc->pClient == pClient)
+ return pOc;
+
+ return NULL;
+}
+
+/*
+ * Create an overlay client object for the given client
+ */
+CompOverlayClientPtr
+compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompOverlayClientPtr pOc;
+
+ pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
+ if (pOc == NULL)
+ return NULL;
+
+ pOc->pClient = pClient;
+ pOc->pScreen = pScreen;
+ pOc->resource = FakeClientID(pClient->index);
+ pOc->pNext = cs->pOverlayClients;
+ cs->pOverlayClients = pOc;
+
+ /*
+ * Create a resource for this element so it can be deleted
+ * when the client goes away.
+ */
+ if (!AddResource(pOc->resource, CompositeClientOverlayType, (pointer) pOc))
+ return NULL;
+
+ return pOc;
+}
+
+/*
+ * Create the overlay window and map it
+ */
+Bool
+compCreateOverlayWindow(ScreenPtr pScreen)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ WindowPtr pRoot = pScreen->root;
+ WindowPtr pWin;
+ XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
+ int result;
+ int w = pScreen->width;
+ int h = pScreen->height;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ w = PanoramiXPixWidth;
+ h = PanoramiXPixHeight;
+ }
+#endif
+
+ pWin = cs->pOverlayWin =
+ CreateWindow(cs->overlayWid, pRoot, 0, 0, w, h, 0,
+ InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
+ pRoot->drawable.depth,
+ serverClient, pScreen->rootVisual, &result);
+ if (pWin == NULL)
+ return FALSE;
+
+ if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer) pWin))
+ return FALSE;
+
+ MapWindow(pWin, serverClient);
+
+ return TRUE;
+}
+
+/*
+ * Destroy the overlay window
+ */
+void
+compDestroyOverlayWindow(ScreenPtr pScreen)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+
+ cs->pOverlayWin = NullWindow;
+ FreeResource(cs->overlayWid, RT_NONE);
+}
diff --git a/xorg-server/composite/compwindow.c b/xorg-server/composite/compwindow.c
index d2a866d6f..6eb624b11 100644
--- a/xorg-server/composite/compwindow.c
+++ b/xorg-server/composite/compwindow.c
@@ -53,129 +53,130 @@
#ifdef COMPOSITE_DEBUG
static int
-compCheckWindow (WindowPtr pWin, pointer data)
+compCheckWindow(WindowPtr pWin, pointer data)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
- PixmapPtr pParentPixmap = pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0;
- PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
-
- if (!pWin->parent)
- {
- assert (pWin->redirectDraw == RedirectDrawNone);
- assert (pWinPixmap == pScreenPixmap);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ PixmapPtr pParentPixmap =
+ pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0;
+ PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+
+ if (!pWin->parent) {
+ assert(pWin->redirectDraw == RedirectDrawNone);
+ assert(pWinPixmap == pScreenPixmap);
}
- else if (pWin->redirectDraw != RedirectDrawNone)
- {
- assert (pWinPixmap != pParentPixmap);
- assert (pWinPixmap != pScreenPixmap);
+ else if (pWin->redirectDraw != RedirectDrawNone) {
+ assert(pWinPixmap != pParentPixmap);
+ assert(pWinPixmap != pScreenPixmap);
}
- else
- {
- assert (pWinPixmap == pParentPixmap);
+ else {
+ assert(pWinPixmap == pParentPixmap);
}
- assert (0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
- assert (0 < pScreenPixmap->refcnt && pScreenPixmap->refcnt < 3);
+ assert(0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
+ assert(0 < pScreenPixmap->refcnt && pScreenPixmap->refcnt < 3);
if (pParentPixmap)
- assert (0 <= pParentPixmap->refcnt && pParentPixmap->refcnt < 3);
+ assert(0 <= pParentPixmap->refcnt && pParentPixmap->refcnt < 3);
return WT_WALKCHILDREN;
}
void
-compCheckTree (ScreenPtr pScreen)
+compCheckTree(ScreenPtr pScreen)
{
- WalkTree (pScreen, compCheckWindow, 0);
+ WalkTree(pScreen, compCheckWindow, 0);
}
#endif
typedef struct _compPixmapVisit {
- WindowPtr pWindow;
- PixmapPtr pPixmap;
+ WindowPtr pWindow;
+ PixmapPtr pPixmap;
} CompPixmapVisitRec, *CompPixmapVisitPtr;
static Bool
-compRepaintBorder (ClientPtr pClient, pointer closure)
+compRepaintBorder(ClientPtr pClient, pointer closure)
{
WindowPtr pWindow;
- int rc = dixLookupWindow(&pWindow, (XID)(intptr_t)closure, pClient, DixWriteAccess);
+ int rc =
+ dixLookupWindow(&pWindow, (XID) (intptr_t) closure, pClient,
+ DixWriteAccess);
if (rc == Success) {
- RegionRec exposed;
+ RegionRec exposed;
- RegionNull(&exposed);
- RegionSubtract(&exposed, &pWindow->borderClip, &pWindow->winSize);
- miPaintWindow(pWindow, &exposed, PW_BORDER);
- RegionUninit(&exposed);
+ RegionNull(&exposed);
+ RegionSubtract(&exposed, &pWindow->borderClip, &pWindow->winSize);
+ miPaintWindow(pWindow, &exposed, PW_BORDER);
+ RegionUninit(&exposed);
}
return TRUE;
}
static int
-compSetPixmapVisitWindow (WindowPtr pWindow, pointer data)
+compSetPixmapVisitWindow(WindowPtr pWindow, pointer data)
{
- CompPixmapVisitPtr pVisit = (CompPixmapVisitPtr) data;
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ CompPixmapVisitPtr pVisit = (CompPixmapVisitPtr) data;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
if (pWindow != pVisit->pWindow && pWindow->redirectDraw != RedirectDrawNone)
- return WT_DONTWALKCHILDREN;
+ return WT_DONTWALKCHILDREN;
(*pScreen->SetWindowPixmap) (pWindow, pVisit->pPixmap);
/*
* Recompute winSize and borderSize. This is duplicate effort
* when resizing pixmaps, but necessary when changing redirection.
* Might be nice to fix this.
*/
- SetWinSize (pWindow);
- SetBorderSize (pWindow);
- if (HasBorder (pWindow))
- QueueWorkProc (compRepaintBorder, serverClient,
- (pointer)(intptr_t) pWindow->drawable.id);
+ SetWinSize(pWindow);
+ SetBorderSize(pWindow);
+ if (HasBorder(pWindow))
+ QueueWorkProc(compRepaintBorder, serverClient,
+ (pointer) (intptr_t) pWindow->drawable.id);
return WT_WALKCHILDREN;
}
void
-compSetPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
+compSetPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
{
- CompPixmapVisitRec visitRec;
+ CompPixmapVisitRec visitRec;
visitRec.pWindow = pWindow;
visitRec.pPixmap = pPixmap;
- TraverseTree (pWindow, compSetPixmapVisitWindow, (pointer) &visitRec);
- compCheckTree (pWindow->drawable.pScreen);
+ TraverseTree(pWindow, compSetPixmapVisitWindow, (pointer) &visitRec);
+ compCheckTree(pWindow->drawable.pScreen);
}
Bool
-compCheckRedirect (WindowPtr pWin)
+compCheckRedirect(WindowPtr pWin)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
- Bool should;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
+ Bool should;
should = pWin->realized && (pWin->drawable.class != InputOnly) &&
- (cw != NULL) && (pWin->parent != NULL);
+ (cw != NULL) && (pWin->parent != NULL);
/* Never redirect the overlay window */
if (cs->pOverlayWin != NULL) {
- if (pWin == cs->pOverlayWin) {
- should = FALSE;
- }
+ if (pWin == cs->pOverlayWin) {
+ should = FALSE;
+ }
}
- if (should != (pWin->redirectDraw != RedirectDrawNone))
- {
- if (should)
- return compAllocPixmap (pWin);
- else {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- compSetParentPixmap (pWin);
- compRestoreWindow (pWin, pPixmap);
- (*pScreen->DestroyPixmap) (pPixmap);
- }
- } else if (should) {
- if (cw->update == CompositeRedirectAutomatic)
- pWin->redirectDraw = RedirectDrawAutomatic;
- else
- pWin->redirectDraw = RedirectDrawManual;
+ if (should != (pWin->redirectDraw != RedirectDrawNone)) {
+ if (should)
+ return compAllocPixmap(pWin);
+ else {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+
+ compSetParentPixmap(pWin);
+ compRestoreWindow(pWin, pPixmap);
+ (*pScreen->DestroyPixmap) (pPixmap);
+ }
+ }
+ else if (should) {
+ if (cw->update == CompositeRedirectAutomatic)
+ pWin->redirectDraw = RedirectDrawAutomatic;
+ else
+ pWin->redirectDraw = RedirectDrawManual;
}
return TRUE;
}
@@ -183,110 +184,106 @@ compCheckRedirect (WindowPtr pWin)
static int
updateOverlayWindow(ScreenPtr pScreen)
{
- CompScreenPtr cs;
- WindowPtr pWin; /* overlay window */
- XID vlist[2];
- int w = pScreen->width;
- int h = pScreen->height;
+ CompScreenPtr cs;
+ WindowPtr pWin; /* overlay window */
+ XID vlist[2];
+ int w = pScreen->width;
+ int h = pScreen->height;
#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- {
- w = PanoramiXPixWidth;
- h = PanoramiXPixHeight;
- }
+ if (!noPanoramiXExtension) {
+ w = PanoramiXPixWidth;
+ h = PanoramiXPixHeight;
+ }
#endif
- cs = GetCompScreen(pScreen);
- if ((pWin = cs->pOverlayWin) != NULL) {
- if ((pWin->drawable.width == w) &&
- (pWin->drawable.height == h))
- return Success;
+ cs = GetCompScreen(pScreen);
+ if ((pWin = cs->pOverlayWin) != NULL) {
+ if ((pWin->drawable.width == w) && (pWin->drawable.height == h))
+ return Success;
- /* Let's resize the overlay window. */
- vlist[0] = w;
- vlist[1] = h;
- return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
- }
+ /* Let's resize the overlay window. */
+ vlist[0] = w;
+ vlist[1] = h;
+ return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
+ }
- /* Let's be on the safe side and not assume an overlay window is always allocated. */
- return Success;
+ /* Let's be on the safe side and not assume an overlay window is always allocated. */
+ return Success;
}
Bool
-compPositionWindow (WindowPtr pWin, int x, int y)
+compPositionWindow(WindowPtr pWin, int x, int y)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = TRUE;
pScreen->PositionWindow = cs->PositionWindow;
/*
* "Shouldn't need this as all possible places should be wrapped
*
- compCheckRedirect (pWin);
+ compCheckRedirect (pWin);
*/
#ifdef COMPOSITE_DEBUG
if ((pWin->redirectDraw != RedirectDrawNone) !=
- (pWin->viewable && (GetCompWindow(pWin) != NULL)))
- OsAbort ();
+ (pWin->viewable && (GetCompWindow(pWin) != NULL)))
+ OsAbort();
#endif
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- int bw = wBorderWidth (pWin);
- int nx = pWin->drawable.x - bw;
- int ny = pWin->drawable.y - bw;
-
- if (pPixmap->screen_x != nx || pPixmap->screen_y != ny)
- {
- pPixmap->screen_x = nx;
- pPixmap->screen_y = ny;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ int bw = wBorderWidth(pWin);
+ int nx = pWin->drawable.x - bw;
+ int ny = pWin->drawable.y - bw;
+
+ if (pPixmap->screen_x != nx || pPixmap->screen_y != ny) {
+ pPixmap->screen_x = nx;
+ pPixmap->screen_y = ny;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
}
if (!(*pScreen->PositionWindow) (pWin, x, y))
- ret = FALSE;
+ ret = FALSE;
cs->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = compPositionWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
if (updateOverlayWindow(pScreen) != Success)
- ret = FALSE;
+ ret = FALSE;
return ret;
}
Bool
-compRealizeWindow (WindowPtr pWin)
+compRealizeWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = TRUE;
pScreen->RealizeWindow = cs->RealizeWindow;
- compCheckRedirect (pWin);
+ compCheckRedirect(pWin);
if (!(*pScreen->RealizeWindow) (pWin))
- ret = FALSE;
+ ret = FALSE;
cs->RealizeWindow = pScreen->RealizeWindow;
pScreen->RealizeWindow = compRealizeWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
return ret;
}
Bool
-compUnrealizeWindow (WindowPtr pWin)
+compUnrealizeWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = TRUE;
pScreen->UnrealizeWindow = cs->UnrealizeWindow;
- compCheckRedirect (pWin);
+ compCheckRedirect(pWin);
if (!(*pScreen->UnrealizeWindow) (pWin))
- ret = FALSE;
+ ret = FALSE;
cs->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = compUnrealizeWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
return ret;
}
@@ -296,30 +293,27 @@ compUnrealizeWindow (WindowPtr pWin)
*/
void
-compClipNotify (WindowPtr pWin, int dx, int dy)
+compClipNotify(WindowPtr pWin, int dx, int dy)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- CompWindowPtr cw = GetCompWindow (pWin);
-
- if (cw)
- {
- if (cw->borderClipX != pWin->drawable.x ||
- cw->borderClipY != pWin->drawable.y)
- {
- RegionTranslate(&cw->borderClip,
- pWin->drawable.x - cw->borderClipX,
- pWin->drawable.y - cw->borderClipY);
- cw->borderClipX = pWin->drawable.x;
- cw->borderClipY = pWin->drawable.y;
- }
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ if (cw) {
+ if (cw->borderClipX != pWin->drawable.x ||
+ cw->borderClipY != pWin->drawable.y) {
+ RegionTranslate(&cw->borderClip,
+ pWin->drawable.x - cw->borderClipX,
+ pWin->drawable.y - cw->borderClipY);
+ cw->borderClipX = pWin->drawable.x;
+ cw->borderClipY = pWin->drawable.y;
+ }
}
- if (cs->ClipNotify)
- {
- pScreen->ClipNotify = cs->ClipNotify;
- (*pScreen->ClipNotify) (pWin, dx, dy);
- cs->ClipNotify = pScreen->ClipNotify;
- pScreen->ClipNotify = compClipNotify;
+ if (cs->ClipNotify) {
+ pScreen->ClipNotify = cs->ClipNotify;
+ (*pScreen->ClipNotify) (pWin, dx, dy);
+ cs->ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = compClipNotify;
}
}
@@ -329,53 +323,53 @@ compClipNotify (WindowPtr pWin, int dx, int dy)
*/
static Bool
-compIsAlternateVisual (ScreenPtr pScreen,
- XID visual)
+compIsAlternateVisual(ScreenPtr pScreen, XID visual)
{
- CompScreenPtr cs = GetCompScreen (pScreen);
- int i;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ int i;
for (i = 0; i < cs->numAlternateVisuals; i++)
- if (cs->alternateVisuals[i] == visual)
- return TRUE;
+ if (cs->alternateVisuals[i] == visual)
+ return TRUE;
return FALSE;
}
static Bool
-compImplicitRedirect (WindowPtr pWin, WindowPtr pParent)
+compImplicitRedirect(WindowPtr pWin, WindowPtr pParent)
{
- if (pParent)
- {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XID winVisual = wVisual (pWin);
- XID parentVisual = wVisual (pParent);
-
- if (winVisual != parentVisual &&
- (compIsAlternateVisual (pScreen, winVisual) ||
- compIsAlternateVisual (pScreen, parentVisual)))
- return TRUE;
+ if (pParent) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XID winVisual = wVisual(pWin);
+ XID parentVisual = wVisual(pParent);
+
+ if (winVisual != parentVisual &&
+ (compIsAlternateVisual(pScreen, winVisual) ||
+ compIsAlternateVisual(pScreen, parentVisual)))
+ return TRUE;
}
return FALSE;
}
-static void compFreeOldPixmap(WindowPtr pWin)
+static void
+compFreeOldPixmap(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow (pWin);
- if (cw->pOldPixmap)
- {
- (*pScreen->DestroyPixmap) (cw->pOldPixmap);
- cw->pOldPixmap = NullPixmap;
- }
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ if (cw->pOldPixmap) {
+ (*pScreen->DestroyPixmap) (cw->pOldPixmap);
+ cw->pOldPixmap = NullPixmap;
+ }
}
}
+
void
-compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
+compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->MoveWindow = cs->MoveWindow;
(*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
@@ -383,15 +377,15 @@ compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
pScreen->MoveWindow = compMoveWindow;
compFreeOldPixmap(pWin);
- compCheckTree (pScreen);
+ compCheckTree(pScreen);
}
void
-compResizeWindow (WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib)
+compResizeWindow(WindowPtr pWin, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->ResizeWindow = cs->ResizeWindow;
(*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
@@ -399,14 +393,14 @@ compResizeWindow (WindowPtr pWin, int x, int y,
pScreen->ResizeWindow = compResizeWindow;
compFreeOldPixmap(pWin);
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
void
-compChangeBorderWidth (WindowPtr pWin, unsigned int bw)
+compChangeBorderWidth(WindowPtr pWin, unsigned int bw)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
(*pScreen->ChangeBorderWidth) (pWin, bw);
@@ -414,189 +408,183 @@ compChangeBorderWidth (WindowPtr pWin, unsigned int bw)
pScreen->ChangeBorderWidth = compChangeBorderWidth;
compFreeOldPixmap(pWin);
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
void
-compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent)
+compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->ReparentWindow = cs->ReparentWindow;
/*
* Remove any implicit redirect due to synthesized visual
*/
- if (compImplicitRedirect (pWin, pPriorParent))
- compUnredirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
+ if (compImplicitRedirect(pWin, pPriorParent))
+ compUnredirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
/*
* Handle subwindows redirection
*/
- compUnredirectOneSubwindow (pPriorParent, pWin);
- compRedirectOneSubwindow (pWin->parent, pWin);
+ compUnredirectOneSubwindow(pPriorParent, pWin);
+ compRedirectOneSubwindow(pWin->parent, pWin);
/*
* Add any implict redirect due to synthesized visual
*/
- if (compImplicitRedirect (pWin, pWin->parent))
- compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
+ if (compImplicitRedirect(pWin, pWin->parent))
+ compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
/*
* Allocate any necessary redirect pixmap
* (this actually should never be true; pWin is always unmapped)
*/
- compCheckRedirect (pWin);
+ compCheckRedirect(pWin);
/*
* Reset pixmap pointers as appropriate
*/
if (pWin->parent && pWin->redirectDraw == RedirectDrawNone)
- compSetPixmap (pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
+ compSetPixmap(pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
/*
* Call down to next function
*/
if (pScreen->ReparentWindow)
- (*pScreen->ReparentWindow) (pWin, pPriorParent);
+ (*pScreen->ReparentWindow) (pWin, pPriorParent);
cs->ReparentWindow = pScreen->ReparentWindow;
pScreen->ReparentWindow = compReparentWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
void
-compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- int dx = 0, dy = 0;
-
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- CompWindowPtr cw = GetCompWindow (pWin);
-
- assert (cw->oldx != COMP_ORIGIN_INVALID);
- assert (cw->oldy != COMP_ORIGIN_INVALID);
- if (cw->pOldPixmap)
- {
- /*
- * Ok, the old bits are available in pOldPixmap and
- * need to be copied to pNewPixmap.
- */
- RegionRec rgnDst;
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- GCPtr pGC;
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- RegionTranslate(prgnSrc, -dx, -dy);
-
- RegionNull(&rgnDst);
-
- RegionIntersect(&rgnDst,
- &pWin->borderClip, prgnSrc);
-
- RegionTranslate(&rgnDst,
- -pPixmap->screen_x, -pPixmap->screen_y);
-
- dx = dx + pPixmap->screen_x - cw->oldx;
- dy = dy + pPixmap->screen_y - cw->oldy;
- pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
- if (pGC)
- {
- BoxPtr pBox = RegionRects (&rgnDst);
- int nBox = RegionNumRects (&rgnDst);
-
- ValidateGC(&pPixmap->drawable, pGC);
- while (nBox--)
- {
- (void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable,
- &pPixmap->drawable,
- pGC,
- pBox->x1 + dx, pBox->y1 + dy,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1,
- pBox->x1, pBox->y1);
- pBox++;
- }
- FreeScratchGC (pGC);
- }
- return;
- }
- dx = pPixmap->screen_x - cw->oldx;
- dy = pPixmap->screen_y - cw->oldy;
- ptOldOrg.x += dx;
- ptOldOrg.y += dy;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ int dx = 0, dy = 0;
+
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ assert(cw->oldx != COMP_ORIGIN_INVALID);
+ assert(cw->oldy != COMP_ORIGIN_INVALID);
+ if (cw->pOldPixmap) {
+ /*
+ * Ok, the old bits are available in pOldPixmap and
+ * need to be copied to pNewPixmap.
+ */
+ RegionRec rgnDst;
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ GCPtr pGC;
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ RegionTranslate(prgnSrc, -dx, -dy);
+
+ RegionNull(&rgnDst);
+
+ RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
+
+ RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y);
+
+ dx = dx + pPixmap->screen_x - cw->oldx;
+ dy = dy + pPixmap->screen_y - cw->oldy;
+ pGC = GetScratchGC(pPixmap->drawable.depth, pScreen);
+ if (pGC) {
+ BoxPtr pBox = RegionRects(&rgnDst);
+ int nBox = RegionNumRects(&rgnDst);
+
+ ValidateGC(&pPixmap->drawable, pGC);
+ while (nBox--) {
+ (void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable,
+ &pPixmap->drawable,
+ pGC,
+ pBox->x1 + dx, pBox->y1 + dy,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1,
+ pBox->x1, pBox->y1);
+ pBox++;
+ }
+ FreeScratchGC(pGC);
+ }
+ return;
+ }
+ dx = pPixmap->screen_x - cw->oldx;
+ dy = pPixmap->screen_y - cw->oldy;
+ ptOldOrg.x += dx;
+ ptOldOrg.y += dy;
}
pScreen->CopyWindow = cs->CopyWindow;
- if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y)
- {
- if (dx || dy)
- RegionTranslate(prgnSrc, dx, dy);
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- if (dx || dy)
- RegionTranslate(prgnSrc, -dx, -dy);
+ if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y) {
+ if (dx || dy)
+ RegionTranslate(prgnSrc, dx, dy);
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ if (dx || dy)
+ RegionTranslate(prgnSrc, -dx, -dy);
}
- else
- {
- ptOldOrg.x -= dx;
- ptOldOrg.y -= dy;
- RegionTranslate(prgnSrc,
- pWin->drawable.x - ptOldOrg.x,
- pWin->drawable.y - ptOldOrg.y);
- DamageDamageRegion(&pWin->drawable, prgnSrc);
+ else {
+ ptOldOrg.x -= dx;
+ ptOldOrg.y -= dy;
+ RegionTranslate(prgnSrc,
+ pWin->drawable.x - ptOldOrg.x,
+ pWin->drawable.y - ptOldOrg.y);
+ DamageDamageRegion(&pWin->drawable, prgnSrc);
}
cs->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = compCopyWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
Bool
-compCreateWindow (WindowPtr pWin)
+compCreateWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret;
pScreen->CreateWindow = cs->CreateWindow;
ret = (*pScreen->CreateWindow) (pWin);
- if (pWin->parent && ret)
- {
- CompSubwindowsPtr csw = GetCompSubwindows (pWin->parent);
- CompClientWindowPtr ccw;
-
- (*pScreen->SetWindowPixmap) (pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
- if (csw)
- for (ccw = csw->clients; ccw; ccw = ccw->next)
- compRedirectWindow (clients[CLIENT_ID(ccw->id)],
- pWin, ccw->update);
- if (compImplicitRedirect (pWin, pWin->parent))
- compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
+ if (pWin->parent && ret) {
+ CompSubwindowsPtr csw = GetCompSubwindows(pWin->parent);
+ CompClientWindowPtr ccw;
+
+ (*pScreen->SetWindowPixmap) (pWin,
+ (*pScreen->GetWindowPixmap) (pWin->
+ parent));
+ if (csw)
+ for (ccw = csw->clients; ccw; ccw = ccw->next)
+ compRedirectWindow(clients[CLIENT_ID(ccw->id)],
+ pWin, ccw->update);
+ if (compImplicitRedirect(pWin, pWin->parent))
+ compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
}
cs->CreateWindow = pScreen->CreateWindow;
pScreen->CreateWindow = compCreateWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
return ret;
}
Bool
-compDestroyWindow (WindowPtr pWin)
+compDestroyWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- CompWindowPtr cw;
- CompSubwindowsPtr csw;
- Bool ret;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompWindowPtr cw;
+ CompSubwindowsPtr csw;
+ Bool ret;
pScreen->DestroyWindow = cs->DestroyWindow;
- while ((cw = GetCompWindow (pWin)))
- FreeResource (cw->clients->id, RT_NONE);
- while ((csw = GetCompSubwindows (pWin)))
- FreeResource (csw->clients->id, RT_NONE);
+ while ((cw = GetCompWindow(pWin)))
+ FreeResource(cw->clients->id, RT_NONE);
+ while ((csw = GetCompSubwindows(pWin)))
+ FreeResource(csw->clients->id, RT_NONE);
if (pWin->redirectDraw != RedirectDrawNone) {
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- compSetParentPixmap (pWin);
- (*pScreen->DestroyPixmap) (pPixmap);
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+
+ compSetParentPixmap(pWin);
+ (*pScreen->DestroyPixmap) (pPixmap);
}
ret = (*pScreen->DestroyWindow) (pWin);
cs->DestroyWindow = pScreen->DestroyWindow;
@@ -606,18 +594,18 @@ compDestroyWindow (WindowPtr pWin)
}
void
-compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion)
+compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- RegionRec damage;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ RegionRec damage;
RegionNull(&damage);
/*
* Align old border clip with new border clip
*/
RegionTranslate(&cw->borderClip,
- pWin->drawable.x - cw->borderClipX,
- pWin->drawable.y - cw->borderClipY);
+ pWin->drawable.x - cw->borderClipX,
+ pWin->drawable.y - cw->borderClipY);
/*
* Compute newly visible portion of window for repaint
*/
@@ -636,64 +624,63 @@ compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion)
}
RegionPtr
-compGetRedirectBorderClip (WindowPtr pWin)
+compGetRedirectBorderClip(WindowPtr pWin)
{
- CompWindowPtr cw = GetCompWindow (pWin);
+ CompWindowPtr cw = GetCompWindow(pWin);
return &cw->borderClip;
}
static VisualPtr
-compGetWindowVisual (WindowPtr pWin)
+compGetWindowVisual(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- VisualID vid = wVisual (pWin);
- int i;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual(pWin);
+ int i;
for (i = 0; i < pScreen->numVisuals; i++)
- if (pScreen->visuals[i].vid == vid)
- return &pScreen->visuals[i];
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
return 0;
}
PictFormatPtr
-compWindowFormat (WindowPtr pWin)
+compWindowFormat(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- return PictureMatchVisual (pScreen, pWin->drawable.depth,
- compGetWindowVisual (pWin));
+ return PictureMatchVisual(pScreen, pWin->drawable.depth,
+ compGetWindowVisual(pWin));
}
static void
-compWindowUpdateAutomatic (WindowPtr pWin)
+compWindowUpdateAutomatic(WindowPtr pWin)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- ScreenPtr pScreen = pWin->drawable.pScreen;
- WindowPtr pParent = pWin->parent;
- PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
- PictFormatPtr pSrcFormat = compWindowFormat (pWin);
- PictFormatPtr pDstFormat = compWindowFormat (pWin->parent);
- int error;
- RegionPtr pRegion = DamageRegion (cw->damage);
- PicturePtr pSrcPicture = CreatePicture (0, &pSrcPixmap->drawable,
- pSrcFormat,
- 0, 0,
- serverClient,
- &error);
- XID subwindowMode = IncludeInferiors;
- PicturePtr pDstPicture = CreatePicture (0, &pParent->drawable,
- pDstFormat,
- CPSubwindowMode,
- &subwindowMode,
- serverClient,
- &error);
+ CompWindowPtr cw = GetCompWindow(pWin);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr pParent = pWin->parent;
+ PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ PictFormatPtr pSrcFormat = compWindowFormat(pWin);
+ PictFormatPtr pDstFormat = compWindowFormat(pWin->parent);
+ int error;
+ RegionPtr pRegion = DamageRegion(cw->damage);
+ PicturePtr pSrcPicture = CreatePicture(0, &pSrcPixmap->drawable,
+ pSrcFormat,
+ 0, 0,
+ serverClient,
+ &error);
+ XID subwindowMode = IncludeInferiors;
+ PicturePtr pDstPicture = CreatePicture(0, &pParent->drawable,
+ pDstFormat,
+ CPSubwindowMode,
+ &subwindowMode,
+ serverClient,
+ &error);
/*
* First move the region from window to screen coordinates
*/
- RegionTranslate(pRegion,
- pWin->drawable.x, pWin->drawable.y);
+ RegionTranslate(pRegion, pWin->drawable.x, pWin->drawable.y);
/*
* Clip against the "real" border clip
@@ -703,130 +690,123 @@ compWindowUpdateAutomatic (WindowPtr pWin)
/*
* Now translate from screen to dest coordinates
*/
- RegionTranslate(pRegion,
- -pParent->drawable.x, -pParent->drawable.y);
+ RegionTranslate(pRegion, -pParent->drawable.x, -pParent->drawable.y);
/*
* Clip the picture
*/
- SetPictureClipRegion (pDstPicture, 0, 0, pRegion);
+ SetPictureClipRegion(pDstPicture, 0, 0, pRegion);
/*
* And paint
*/
- CompositePicture (PictOpSrc,
- pSrcPicture,
- 0,
- pDstPicture,
- 0, 0, /* src_x, src_y */
- 0, 0, /* msk_x, msk_y */
- pSrcPixmap->screen_x - pParent->drawable.x,
- pSrcPixmap->screen_y - pParent->drawable.y,
- pSrcPixmap->drawable.width,
- pSrcPixmap->drawable.height);
- FreePicture (pSrcPicture, 0);
- FreePicture (pDstPicture, 0);
+ CompositePicture(PictOpSrc, pSrcPicture, 0, pDstPicture, 0, 0, /* src_x, src_y */
+ 0, 0, /* msk_x, msk_y */
+ pSrcPixmap->screen_x - pParent->drawable.x,
+ pSrcPixmap->screen_y - pParent->drawable.y,
+ pSrcPixmap->drawable.width, pSrcPixmap->drawable.height);
+ FreePicture(pSrcPicture, 0);
+ FreePicture(pDstPicture, 0);
/*
* Empty the damage region. This has the nice effect of
* rendering the translations above harmless
*/
- DamageEmpty (cw->damage);
+ DamageEmpty(cw->damage);
}
static void
-compPaintWindowToParent (WindowPtr pWin)
+compPaintWindowToParent(WindowPtr pWin)
{
- compPaintChildrenToWindow (pWin);
+ compPaintChildrenToWindow(pWin);
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow(pWin);
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ CompWindowPtr cw = GetCompWindow(pWin);
- if (cw->damaged)
- {
- compWindowUpdateAutomatic (pWin);
- cw->damaged = FALSE;
- }
+ if (cw->damaged) {
+ compWindowUpdateAutomatic(pWin);
+ cw->damaged = FALSE;
+ }
}
}
void
-compPaintChildrenToWindow (WindowPtr pWin)
+compPaintChildrenToWindow(WindowPtr pWin)
{
WindowPtr pChild;
if (!pWin->damagedDescendants)
- return;
+ return;
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
- compPaintWindowToParent (pChild);
+ compPaintWindowToParent(pChild);
pWin->damagedDescendants = FALSE;
}
WindowPtr
-CompositeRealChildHead (WindowPtr pWin)
+CompositeRealChildHead(WindowPtr pWin)
{
WindowPtr pChild, pChildBefore;
CompScreenPtr cs;
if (!pWin->parent &&
- (screenIsSaved == SCREEN_SAVER_ON) &&
- (HasSaverWindow (pWin->drawable.pScreen))) {
+ (screenIsSaved == SCREEN_SAVER_ON) &&
+ (HasSaverWindow(pWin->drawable.pScreen))) {
- /* First child is the screen saver; see if next child is the overlay */
- pChildBefore = pWin->firstChild;
- pChild = pChildBefore->nextSib;
+ /* First child is the screen saver; see if next child is the overlay */
+ pChildBefore = pWin->firstChild;
+ pChild = pChildBefore->nextSib;
- } else {
- pChildBefore = NullWindow;
- pChild = pWin->firstChild;
+ }
+ else {
+ pChildBefore = NullWindow;
+ pChild = pWin->firstChild;
}
if (!pChild) {
- return NullWindow;
+ return NullWindow;
}
cs = GetCompScreen(pWin->drawable.pScreen);
if (pChild == cs->pOverlayWin) {
- return pChild;
- } else {
- return pChildBefore;
+ return pChild;
+ }
+ else {
+ return pChildBefore;
}
}
int
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
- int bw, WindowPtr pSib)
+ int bw, WindowPtr pSib)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = 0;
- WindowPtr pParent = pWin->parent;
- int draw_x, draw_y;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = 0;
+ WindowPtr pParent = pWin->parent;
+ int draw_x, draw_y;
Bool alloc_ret;
- if (cs->ConfigNotify)
- {
- pScreen->ConfigNotify = cs->ConfigNotify;
- ret = (*pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
- cs->ConfigNotify = pScreen->ConfigNotify;
- pScreen->ConfigNotify = compConfigNotify;
+ if (cs->ConfigNotify) {
+ pScreen->ConfigNotify = cs->ConfigNotify;
+ ret = (*pScreen->ConfigNotify) (pWin, x, y, w, h, bw, pSib);
+ cs->ConfigNotify = pScreen->ConfigNotify;
+ pScreen->ConfigNotify = compConfigNotify;
- if (ret)
- return ret;
+ if (ret)
+ return ret;
}
if (pWin->redirectDraw == RedirectDrawNone)
- return Success;
+ return Success;
- compCheckTree (pScreen);
+ compCheckTree(pScreen);
draw_x = pParent->drawable.x + x + bw;
draw_y = pParent->drawable.y + y + bw;
- alloc_ret = compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
+ alloc_ret = compReallocPixmap(pWin, draw_x, draw_y, w, h, bw);
if (alloc_ret == FALSE)
- return BadAlloc;
+ return BadAlloc;
return Success;
}
diff --git a/xorg-server/config/config.c b/xorg-server/config/config.c
index 0dae3ad68..2b96dbb74 100644
--- a/xorg-server/config/config.c
+++ b/xorg-server/config/config.c
@@ -40,21 +40,21 @@ config_init(void)
ErrorF("[config] failed to initialise udev\n");
#elif defined(CONFIG_NEED_DBUS)
if (config_dbus_core_init()) {
-# ifdef CONFIG_DBUS_API
- if (!config_dbus_init())
- ErrorF("[config] failed to initialise D-Bus API\n");
-# endif
-# ifdef CONFIG_HAL
+#ifdef CONFIG_DBUS_API
+ if (!config_dbus_init())
+ ErrorF("[config] failed to initialise D-Bus API\n");
+#endif
+#ifdef CONFIG_HAL
if (!config_hal_init())
ErrorF("[config] failed to initialise HAL\n");
-# endif
+#endif
}
else {
- ErrorF("[config] failed to initialise D-Bus core\n");
+ ErrorF("[config] failed to initialise D-Bus core\n");
}
#elif defined(CONFIG_WSCONS)
if (!config_wscons_init())
- ErrorF("[config] failed to initialise wscons\n");
+ ErrorF("[config] failed to initialise wscons\n");
#endif
}
@@ -64,12 +64,12 @@ config_fini(void)
#if defined(CONFIG_UDEV)
config_udev_fini();
#elif defined(CONFIG_NEED_DBUS)
-# ifdef CONFIG_HAL
+#ifdef CONFIG_HAL
config_hal_fini();
-# endif
-# ifdef CONFIG_DBUS_API
+#endif
+#ifdef CONFIG_DBUS_API
config_dbus_fini();
-# endif
+#endif
config_dbus_core_fini();
#elif defined(CONFIG_WSCONS)
config_wscons_fini();
@@ -112,18 +112,15 @@ device_is_duplicate(const char *config_info)
{
DeviceIntPtr dev;
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
return TRUE;
}
- for (dev = inputInfo.off_devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.off_devices; dev; dev = dev->next) {
if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
return TRUE;
}
return FALSE;
}
-
diff --git a/xorg-server/config/dbus-core.c b/xorg-server/config/dbus-core.c
index 4c5e10f51..324258718 100644
--- a/xorg-server/config/dbus-core.c
+++ b/xorg-server/config/dbus-core.c
@@ -35,7 +35,7 @@
#include "os.h"
/* How often to attempt reconnecting when we get booted off the bus. */
-#define RECONNECT_DELAY (10 * 1000) /* in ms */
+#define RECONNECT_DELAY (10 * 1000) /* in ms */
struct dbus_core_info {
int fd;
@@ -57,7 +57,8 @@ wakeup_handler(pointer data, int err, pointer read_mask)
dbus_connection_read_write_dispatch(info->connection, 0);
} while (info->connection &&
dbus_connection_get_is_connected(info->connection) &&
- dbus_connection_get_dispatch_status(info->connection) == DBUS_DISPATCH_DATA_REMAINS);
+ dbus_connection_get_dispatch_status(info->connection) ==
+ DBUS_DISPATCH_DATA_REMAINS);
}
}
@@ -105,13 +106,12 @@ teardown(void)
* careful to ignore anything we don't want to deal with here.
*/
static DBusHandlerResult
-message_filter(DBusConnection *connection, DBusMessage *message, void *data)
+message_filter(DBusConnection * connection, DBusMessage * message, void *data)
{
/* If we get disconnected, then take everything down, and attempt to
* reconnect immediately (assuming it's just a restart). The
* connection isn't valid at this point, so throw it out immediately. */
- if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL,
- "Disconnected")) {
+ if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
DebugF("[config/dbus-core] disconnected from bus\n");
bus_info.connection = NULL;
teardown();
@@ -173,12 +173,12 @@ connect_to_bus(void)
return 1;
-err_fd:
+ err_fd:
bus_info.fd = -1;
-err_unref:
+ err_unref:
dbus_connection_unref(bus_info.connection);
bus_info.connection = NULL;
-err_begin:
+ err_begin:
dbus_error_free(&error);
return 0;
@@ -202,8 +202,7 @@ config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
{
struct config_dbus_core_hook **prev;
- for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next)
- ;
+ for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next);
hook->next = NULL;
*prev = hook;
diff --git a/xorg-server/config/dbus.c b/xorg-server/config/dbus.c
index f0fc5686e..99a1537e1 100644
--- a/xorg-server/config/dbus.c
+++ b/xorg-server/config/dbus.c
@@ -33,7 +33,7 @@
#include <X11/X.h>
#include "config-backends.h"
-#include "opaque.h" /* for 'display': there should be a better way. */
+#include "opaque.h" /* for 'display': there should be a better way. */
#include "input.h"
#include "inputstr.h"
@@ -65,7 +65,7 @@ reset_info(struct connection_info *info)
}
static int
-add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
+add_device(DBusMessage * message, DBusMessage * reply, DBusError * error)
{
DBusMessageIter iter, reply_iter, subiter;
InputOption *input_options = NULL;
@@ -89,6 +89,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
/* signature should be [ss][ss]... */
while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
char *key, *value;
+
dbus_message_iter_recurse(&iter, &subiter);
if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
@@ -145,7 +146,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
}
}
-unwind:
+ unwind:
if (ret != Success) {
if (dev)
RemoveDevice(dev, TRUE);
@@ -160,7 +161,7 @@ unwind:
}
static int
-remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
+remove_device(DBusMessage * message, DBusMessage * reply, DBusError * error)
{
int deviceid, ret, err;
DeviceIntPtr dev;
@@ -196,7 +197,7 @@ remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
ret = Success;
-unwind:
+ unwind:
err = (ret == Success) ? ret : -ret;
dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
@@ -204,7 +205,7 @@ unwind:
}
static int
-list_devices(DBusMessage *message, DBusMessage *reply, DBusError *error)
+list_devices(DBusMessage * message, DBusMessage * reply, DBusError * error)
{
DeviceIntPtr dev;
DBusMessageIter iter, subiter;
@@ -237,7 +238,7 @@ list_devices(DBusMessage *message, DBusMessage *reply, DBusError *error)
}
static int
-get_version(DBusMessage *message, DBusMessage *reply, DBusError *error)
+get_version(DBusMessage * message, DBusMessage * reply, DBusError * error)
{
DBusMessageIter iter;
unsigned int version = API_VERSION;
@@ -252,7 +253,7 @@ get_version(DBusMessage *message, DBusMessage *reply, DBusError *error)
}
static DBusHandlerResult
-message_handler(DBusConnection *connection, DBusMessage *message, void *data)
+message_handler(DBusConnection * connection, DBusMessage * message, void *data)
{
DBusError error;
DBusMessage *reply;
@@ -301,19 +302,19 @@ message_handler(DBusConnection *connection, DBusMessage *message, void *data)
ret = DBUS_HANDLER_RESULT_HANDLED;
-err_reply:
+ err_reply:
dbus_message_unref(reply);
-err_start:
+ err_start:
dbus_error_free(&error);
return ret;
}
static void
-connect_hook(DBusConnection *connection, void *data)
+connect_hook(DBusConnection * connection, void *data)
{
DBusError error;
- DBusObjectPathVTable vtable = { .message_function = message_handler, };
+ DBusObjectPathVTable vtable = {.message_function = message_handler, };
struct connection_info *info = data;
info->connection = connection;
@@ -336,8 +337,7 @@ connect_hook(DBusConnection *connection, void *data)
}
if (!dbus_connection_register_object_path(info->connection,
- info->busobject, &vtable,
- info)) {
+ info->busobject, &vtable, info)) {
ErrorF("[config/dbus] couldn't register object path\n");
goto err_match;
}
@@ -348,11 +348,11 @@ connect_hook(DBusConnection *connection, void *data)
return;
-err_match:
+ err_match:
dbus_bus_remove_match(info->connection, MATCH_RULE, &error);
-err_name:
+ err_name:
dbus_bus_release_name(info->connection, info->busname, &error);
-err_start:
+ err_start:
dbus_error_free(&error);
reset_info(info);
@@ -372,8 +372,7 @@ pre_disconnect_hook(void)
dbus_error_init(&error);
dbus_connection_unregister_object_path(connection_data->connection,
connection_data->busobject);
- dbus_bus_remove_match(connection_data->connection, MATCH_RULE,
- &error);
+ dbus_bus_remove_match(connection_data->connection, MATCH_RULE, &error);
dbus_bus_release_name(connection_data->connection,
connection_data->busname, &error);
dbus_error_free(&error);
@@ -381,6 +380,7 @@ pre_disconnect_hook(void)
#endif
static struct connection_info connection_data;
+
static struct config_dbus_core_hook core_hook = {
.connect = connect_hook,
.disconnect = disconnect_hook,
diff --git a/xorg-server/config/hal.c b/xorg-server/config/hal.c
index 088c9939d..2ead556b0 100644
--- a/xorg-server/config/hal.c
+++ b/xorg-server/config/hal.c
@@ -39,11 +39,9 @@
#include "config-backends.h"
#include "os.h"
-
#define LIBHAL_PROP_KEY "input.x11_options."
#define LIBHAL_XKB_PROP_KEY "input.xkb."
-
struct config_hal_info {
DBusConnection *system_bus;
LibHalContext *hal_ctx;
@@ -51,19 +49,19 @@ struct config_hal_info {
/* Used for special handling of xkb options. */
struct xkb_options {
- char* layout;
- char* model;
- char* rules;
- char* variant;
- char* options;
+ char *layout;
+ char *model;
+ char *rules;
+ char *variant;
+ char *options;
};
static void
-device_removed(LibHalContext *ctx, const char *udi)
+device_removed(LibHalContext * ctx, const char *udi)
{
char *value;
- if (asprintf (&value, "hal:%s", udi) == -1)
+ if (asprintf(&value, "hal:%s", udi) == -1)
return;
remove_devices("hal", value);
@@ -72,12 +70,13 @@ device_removed(LibHalContext *ctx, const char *udi)
}
static char *
-get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
+get_prop_string(LibHalContext * hal_ctx, const char *udi, const char *name)
{
char *prop, *ret;
prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL);
- LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop ? prop : "(null)");
+ LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n",
+ name, udi, prop ? prop : "(null)");
if (prop) {
ret = strdup(prop);
libhal_free_string(prop);
@@ -90,7 +89,8 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
}
static char *
-get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
+get_prop_string_array(LibHalContext * hal_ctx, const char *udi,
+ const char *prop)
{
char **props, *ret, *str;
int i, len = 0;
@@ -100,7 +100,7 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
for (i = 0; props[i]; i++)
len += strlen(props[i]);
- ret = calloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */
+ ret = calloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */
if (!ret) {
libhal_free_string_array(props);
return NULL;
@@ -112,7 +112,7 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
str += strlen(props[i]);
*str++ = ',';
}
- *(str-1) = '\0';
+ *(str - 1) = '\0';
libhal_free_string_array(props);
}
@@ -124,34 +124,35 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
}
static void
-device_added(LibHalContext *hal_ctx, const char *udi)
+device_added(LibHalContext * hal_ctx, const char *udi)
{
char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL;
char *hal_tags, *parent;
InputOption *input_options = NULL;
- InputAttributes attrs = {0};
+ InputAttributes attrs = { 0 };
DeviceIntPtr dev = NULL;
DBusError error;
- struct xkb_options xkb_opts = {0};
+ struct xkb_options xkb_opts = { 0 };
int rc;
LibHalPropertySet *set = NULL;
- LibHalPropertySetIterator set_iter;
+ LibHalPropertySetIterator set_iter;
char *psi_key = NULL, *tmp_val;
-
dbus_error_init(&error);
driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
- if (!driver){
+ if (!driver) {
/* verbose, don't tell the user unless they _want_ to see it */
- LogMessageVerb(X_INFO,7,"config/hal: no driver specified for device %s\n", udi);
+ LogMessageVerb(X_INFO, 7,
+ "config/hal: no driver specified for device %s\n", udi);
goto unwind;
}
path = get_prop_string(hal_ctx, udi, "input.device");
if (!path) {
- LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi);
+ LogMessage(X_WARNING,
+ "config/hal: no driver or path specified for %s\n", udi);
goto unwind;
}
attrs.device = strdup(path);
@@ -199,15 +200,16 @@ device_added(LibHalContext *hal_ctx, const char *udi)
"returned %04x\n", parent, usb_product);
if (usb_vendor && usb_product)
if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_product)
- == -1)
- attrs.usb_id = NULL;
+ == -1)
+ attrs.usb_id = NULL;
free(parent);
}
input_options = input_option_new(NULL, "_source", "server/hal");
if (!input_options) {
- LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
+ LogMessage(X_ERROR,
+ "config/hal: couldn't allocate first key/value pair\n");
goto unwind;
}
@@ -219,44 +221,46 @@ device_added(LibHalContext *hal_ctx, const char *udi)
input_options = input_option_new(input_options, "driver", driver);
input_options = input_option_new(input_options, "name", name);
- if (asprintf (&config_info, "hal:%s", udi) == -1) {
+ if (asprintf(&config_info, "hal:%s", udi) == -1) {
config_info = NULL;
LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
goto unwind;
}
/* Check for duplicate devices */
- if (device_is_duplicate(config_info))
- {
- LogMessage(X_WARNING, "config/hal: device %s already added. Ignoring.\n", name);
+ if (device_is_duplicate(config_info)) {
+ LogMessage(X_WARNING,
+ "config/hal: device %s already added. Ignoring.\n", name);
goto unwind;
}
/* ok, grab options from hal.. iterate through all properties
- * and lets see if any of them are options that we can add */
+ * and lets see if any of them are options that we can add */
set = libhal_device_get_all_properties(hal_ctx, udi, &error);
if (!set) {
- LogMessage(X_ERROR, "config/hal: couldn't get property list for %s: %s (%s)\n",
- udi, error.name, error.message);
+ LogMessage(X_ERROR,
+ "config/hal: couldn't get property list for %s: %s (%s)\n",
+ udi, error.name, error.message);
goto unwind;
}
- libhal_psi_init(&set_iter,set);
+ libhal_psi_init(&set_iter, set);
while (libhal_psi_has_more(&set_iter)) {
/* we are looking for supported keys.. extract and add to options */
psi_key = libhal_psi_get_key(&set_iter);
- if (psi_key){
+ if (psi_key) {
/* normal options first (input.x11_options.<propname>) */
- if (!strncasecmp(psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY)-1)){
- char* tmp;
+ if (!strncasecmp
+ (psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY) - 1)) {
+ char *tmp;
/* only support strings for all values */
tmp_val = get_prop_string(hal_ctx, udi, psi_key);
- if (tmp_val){
+ if (tmp_val) {
/* xkb needs special handling. HAL specs include
* input.xkb.xyz options, but the x11-input.fdi specifies
@@ -265,49 +269,53 @@ device_added(LibHalContext *hal_ctx, const char *udi)
* Since we can't predict the order in which the keys
* arrive, we need to store them.
*/
- if ((tmp = strcasestr(psi_key, "xkb")) && strlen(tmp) >= 4)
- {
- if (!strcasecmp(&tmp[3], "layout"))
- {
+ if ((tmp = strcasestr(psi_key, "xkb")) && strlen(tmp) >= 4) {
+ if (!strcasecmp(&tmp[3], "layout")) {
free(xkb_opts.layout);
xkb_opts.layout = strdup(tmp_val);
- } else if (!strcasecmp(&tmp[3], "model"))
- {
+ }
+ else if (!strcasecmp(&tmp[3], "model")) {
free(xkb_opts.model);
xkb_opts.model = strdup(tmp_val);
- } else if (!strcasecmp(&tmp[3], "rules"))
- {
+ }
+ else if (!strcasecmp(&tmp[3], "rules")) {
free(xkb_opts.rules);
xkb_opts.rules = strdup(tmp_val);
- } else if (!strcasecmp(&tmp[3], "variant"))
- {
+ }
+ else if (!strcasecmp(&tmp[3], "variant")) {
free(xkb_opts.variant);
xkb_opts.variant = strdup(tmp_val);
- } else if (!strcasecmp(&tmp[3], "options"))
- {
+ }
+ else if (!strcasecmp(&tmp[3], "options")) {
free(xkb_opts.options);
xkb_opts.options = strdup(tmp_val);
}
- } else
- {
+ }
+ else {
/* all others */
- input_options = input_option_new(input_options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
+ input_options =
+ input_option_new(input_options,
+ psi_key + sizeof(LIBHAL_PROP_KEY) -
+ 1, tmp_val);
free(tmp_val);
}
- } else
- {
+ }
+ else {
/* server 1.4 had xkb_options as strlist. */
if ((tmp = strcasestr(psi_key, "xkb")) &&
(strlen(tmp) >= 4) &&
(!strcasecmp(&tmp[3], "options")) &&
- (tmp_val = get_prop_string_array(hal_ctx, udi, psi_key)))
- {
+ (tmp_val =
+ get_prop_string_array(hal_ctx, udi, psi_key))) {
free(xkb_opts.options);
xkb_opts.options = strdup(tmp_val);
}
}
- } else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){
- char* tmp;
+ }
+ else if (!strncasecmp
+ (psi_key, LIBHAL_XKB_PROP_KEY,
+ sizeof(LIBHAL_XKB_PROP_KEY) - 1)) {
+ char *tmp;
/* only support strings for all values */
tmp_val = get_prop_string(hal_ctx, udi, psi_key);
@@ -316,34 +324,33 @@ device_added(LibHalContext *hal_ctx, const char *udi)
tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
- if (!strcasecmp(tmp, "layout"))
- {
+ if (!strcasecmp(tmp, "layout")) {
if (!xkb_opts.layout)
xkb_opts.layout = strdup(tmp_val);
- } else if (!strcasecmp(tmp, "rules"))
- {
+ }
+ else if (!strcasecmp(tmp, "rules")) {
if (!xkb_opts.rules)
xkb_opts.rules = strdup(tmp_val);
- } else if (!strcasecmp(tmp, "variant"))
- {
+ }
+ else if (!strcasecmp(tmp, "variant")) {
if (!xkb_opts.variant)
xkb_opts.variant = strdup(tmp_val);
- } else if (!strcasecmp(tmp, "model"))
- {
+ }
+ else if (!strcasecmp(tmp, "model")) {
if (!xkb_opts.model)
xkb_opts.model = strdup(tmp_val);
- } else if (!strcasecmp(tmp, "options"))
- {
+ }
+ else if (!strcasecmp(tmp, "options")) {
if (!xkb_opts.options)
xkb_opts.options = strdup(tmp_val);
}
free(tmp_val);
- } else
- {
+ }
+ else {
/* server 1.4 had xkb options as strlist */
tmp_val = get_prop_string_array(hal_ctx, udi, psi_key);
- if (tmp_val && strlen(psi_key) >= sizeof(LIBHAL_XKB_PROP_KEY))
- {
+ if (tmp_val &&
+ strlen(psi_key) >= sizeof(LIBHAL_XKB_PROP_KEY)) {
tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
if (!strcasecmp(tmp, ".options") && (!xkb_opts.options))
xkb_opts.options = strdup(tmp_val);
@@ -357,29 +364,34 @@ device_added(LibHalContext *hal_ctx, const char *udi)
libhal_psi_next(&set_iter);
}
-
/* Now add xkb options */
if (xkb_opts.layout)
- input_options = input_option_new(input_options, "xkb_layout", xkb_opts.layout);
+ input_options =
+ input_option_new(input_options, "xkb_layout", xkb_opts.layout);
if (xkb_opts.rules)
- input_options = input_option_new(input_options, "xkb_rules", xkb_opts.rules);
+ input_options =
+ input_option_new(input_options, "xkb_rules", xkb_opts.rules);
if (xkb_opts.variant)
- input_options = input_option_new(input_options, "xkb_variant", xkb_opts.variant);
+ input_options =
+ input_option_new(input_options, "xkb_variant", xkb_opts.variant);
if (xkb_opts.model)
- input_options = input_option_new(input_options, "xkb_model", xkb_opts.model);
+ input_options =
+ input_option_new(input_options, "xkb_model", xkb_opts.model);
if (xkb_opts.options)
- input_options = input_option_new(input_options, "xkb_options", xkb_opts.options);
+ input_options =
+ input_option_new(input_options, "xkb_options", xkb_opts.options);
input_options = input_option_new(input_options, "config_info", config_info);
/* this isn't an error, but how else do you output something that the user can see? */
LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
if ((rc = NewInputDeviceRequest(input_options, &attrs, &dev)) != Success) {
- LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n", rc);
+ LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n",
+ rc);
dev = NULL;
goto unwind;
}
-unwind:
+ unwind:
if (set)
libhal_free_property_set(set);
free(path);
@@ -395,6 +407,7 @@ unwind:
free(attrs.usb_id);
if (attrs.tags) {
char **tag = attrs.tags;
+
while (*tag) {
free(*tag);
tag++;
@@ -423,8 +436,9 @@ disconnect_hook(void *data)
if (dbus_connection_get_is_connected(info->system_bus)) {
dbus_error_init(&error);
if (!libhal_ctx_shutdown(info->hal_ctx, &error))
- LogMessage(X_WARNING, "config/hal: disconnect_hook couldn't shut down context: %s (%s)\n",
- error.name, error.message);
+ LogMessage(X_WARNING,
+ "config/hal: disconnect_hook couldn't shut down context: %s (%s)\n",
+ error.name, error.message);
dbus_error_free(&error);
}
libhal_ctx_free(info->hal_ctx);
@@ -435,14 +449,14 @@ disconnect_hook(void *data)
}
static BOOL
-connect_and_register(DBusConnection *connection, struct config_hal_info *info)
+connect_and_register(DBusConnection * connection, struct config_hal_info *info)
{
DBusError error;
char **devices;
int num_devices, i;
if (info->hal_ctx)
- return TRUE; /* already registered, pretend we did something */
+ return TRUE; /* already registered, pretend we did something */
info->system_bus = connection;
@@ -455,19 +469,22 @@ connect_and_register(DBusConnection *connection, struct config_hal_info *info)
}
if (!libhal_ctx_set_dbus_connection(info->hal_ctx, info->system_bus)) {
- LogMessage(X_ERROR, "config/hal: couldn't associate HAL context with bus\n");
+ LogMessage(X_ERROR,
+ "config/hal: couldn't associate HAL context with bus\n");
goto out_err;
}
if (!libhal_ctx_init(info->hal_ctx, &error)) {
- LogMessage(X_ERROR, "config/hal: couldn't initialise context: %s (%s)\n",
- error.name ? error.name : "unknown error",
- error.message ? error.message : "null");
+ LogMessage(X_ERROR,
+ "config/hal: couldn't initialise context: %s (%s)\n",
+ error.name ? error.name : "unknown error",
+ error.message ? error.message : "null");
goto out_err;
}
if (!libhal_device_property_watch_all(info->hal_ctx, &error)) {
- LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n",
- error.name ? error.name : "unknown error",
- error.message ? error.message : "null");
+ LogMessage(X_ERROR,
+ "config/hal: couldn't watch all properties: %s (%s)\n",
+ error.name ? error.name : "unknown error",
+ error.message ? error.message : "null");
goto out_ctx;
}
libhal_ctx_set_device_added(info->hal_ctx, device_added);
@@ -478,8 +495,8 @@ connect_and_register(DBusConnection *connection, struct config_hal_info *info)
/* FIXME: Get default devices if error is set. */
if (dbus_error_is_set(&error)) {
LogMessage(X_ERROR, "config/hal: couldn't find input device: %s (%s)\n",
- error.name ? error.name : "unknown error",
- error.message ? error.message : "null");
+ error.name ? error.name : "unknown error",
+ error.message ? error.message : "null");
goto out_ctx;
}
for (i = 0; i < num_devices; i++)
@@ -490,17 +507,18 @@ connect_and_register(DBusConnection *connection, struct config_hal_info *info)
return TRUE;
-out_ctx:
+ out_ctx:
dbus_error_free(&error);
if (!libhal_ctx_shutdown(info->hal_ctx, &error)) {
- LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n",
- error.name ? error.name : "unknown error",
- error.message ? error.message : "null");
+ LogMessage(X_WARNING,
+ "config/hal: couldn't shut down context: %s (%s)\n",
+ error.name ? error.name : "unknown error",
+ error.message ? error.message : "null");
dbus_error_free(&error);
}
-out_err:
+ out_err:
dbus_error_free(&error);
if (info->hal_ctx) {
@@ -513,7 +531,6 @@ out_err:
return FALSE;
}
-
/**
* Handle NewOwnerChanged signals to deal with HAL startup at X server runtime.
*
@@ -523,13 +540,13 @@ out_err:
* owner.
*/
static DBusHandlerResult
-ownerchanged_handler(DBusConnection *connection, DBusMessage *message, void *data)
+ownerchanged_handler(DBusConnection * connection, DBusMessage * message,
+ void *data)
{
int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (dbus_message_is_signal(message,
- "org.freedesktop.DBus",
- "NameOwnerChanged")) {
+ "org.freedesktop.DBus", "NameOwnerChanged")) {
DBusError error;
char *name, *old_owner, *new_owner;
@@ -537,19 +554,21 @@ ownerchanged_handler(DBusConnection *connection, DBusMessage *message, void *dat
dbus_message_get_args(message, &error,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &old_owner,
- DBUS_TYPE_STRING, &new_owner,
- DBUS_TYPE_INVALID);
+ DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID);
if (dbus_error_is_set(&error)) {
- ErrorF("[config/hal] failed to get NameOwnerChanged args: %s (%s)\n",
- error.name, error.message);
- } else if (name && strcmp(name, "org.freedesktop.Hal") == 0) {
+ ErrorF
+ ("[config/hal] failed to get NameOwnerChanged args: %s (%s)\n",
+ error.name, error.message);
+ }
+ else if (name && strcmp(name, "org.freedesktop.Hal") == 0) {
if (!old_owner || !strlen(old_owner)) {
DebugF("[config/hal] HAL startup detected.\n");
- if (connect_and_register(connection, (struct config_hal_info*)data))
+ if (connect_and_register
+ (connection, (struct config_hal_info *) data))
dbus_connection_unregister_object_path(connection,
- "/org/freedesktop/DBus");
+ "/org/freedesktop/DBus");
else
ErrorF("[config/hal] Failed to connect to HAL bus.\n");
}
@@ -566,30 +585,29 @@ ownerchanged_handler(DBusConnection *connection, DBusMessage *message, void *dat
* Register a handler for the NameOwnerChanged signal.
*/
static BOOL
-listen_for_startup(DBusConnection *connection, void *data)
+listen_for_startup(DBusConnection * connection, void *data)
{
- DBusObjectPathVTable vtable = { .message_function = ownerchanged_handler, };
+ DBusObjectPathVTable vtable = {.message_function = ownerchanged_handler, };
DBusError error;
const char MATCH_RULE[] = "sender='org.freedesktop.DBus',"
- "interface='org.freedesktop.DBus',"
- "type='signal',"
- "path='/org/freedesktop/DBus',"
- "member='NameOwnerChanged'";
+ "interface='org.freedesktop.DBus',"
+ "type='signal',"
+ "path='/org/freedesktop/DBus'," "member='NameOwnerChanged'";
int rc = FALSE;
dbus_error_init(&error);
dbus_bus_add_match(connection, MATCH_RULE, &error);
if (!dbus_error_is_set(&error)) {
if (dbus_connection_register_object_path(connection,
- "/org/freedesktop/DBus",
- &vtable,
- data))
+ "/org/freedesktop/DBus",
+ &vtable, data))
rc = TRUE;
else
ErrorF("[config/hal] cannot register object path.\n");
- } else {
+ }
+ else {
ErrorF("[config/hal] couldn't add match rule: %s (%s)\n", error.name,
- error.message);
+ error.message);
ErrorF("[config/hal] cannot detect a HAL startup.\n");
}
@@ -599,7 +617,7 @@ listen_for_startup(DBusConnection *connection, void *data)
}
static void
-connect_hook(DBusConnection *connection, void *data)
+connect_hook(DBusConnection * connection, void *data)
{
struct config_hal_info *info = data;
@@ -612,6 +630,7 @@ connect_hook(DBusConnection *connection, void *data)
}
static struct config_hal_info hal_info;
+
static struct config_dbus_core_hook hook = {
.connect = connect_hook,
.disconnect = disconnect_hook,
@@ -631,7 +650,7 @@ config_hal_init(void)
}
/* verbose message */
- LogMessageVerb(X_INFO,7,"config/hal: initialized\n");
+ LogMessageVerb(X_INFO, 7, "config/hal: initialized\n");
return 1;
}
diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c
index e2b3726cc..8b3ca0475 100644
--- a/xorg-server/config/udev.c
+++ b/xorg-server/config/udev.c
@@ -61,7 +61,7 @@ device_added(struct udev_device *udev_device)
const char *tags_prop;
const char *key, *value, *tmp;
InputOption *input_options;
- InputAttributes attrs = {};
+ InputAttributes attrs = { };
DeviceIntPtr dev = NULL;
struct udev_list_entry *set, *entry;
struct udev_device *parent;
@@ -88,8 +88,7 @@ device_added(struct udev_device *udev_device)
if (!udev_device_get_property_value(udev_device, "ID_INPUT")) {
LogMessageVerb(X_INFO, 10,
"config/udev: ignoring device %s without "
- "property ID_INPUT set\n",
- path);
+ "property ID_INPUT set\n", path);
return;
}
@@ -116,7 +115,8 @@ device_added(struct udev_device *udev_device)
LOG_SYSATTR(ppath, "id", pnp_id);
/* construct USB ID in lowercase hex - "0000:ffff" */
- if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
+ if (product &&
+ sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model)
== -1)
attrs.usb_id = NULL;
@@ -145,7 +145,7 @@ device_added(struct udev_device *udev_device)
if (device_is_duplicate(config_info)) {
LogMessage(X_WARNING, "config/udev: device %s already added. "
- "Ignoring.\n", name);
+ "Ignoring.\n", name);
goto unwind;
}
@@ -155,39 +155,50 @@ device_added(struct udev_device *udev_device)
if (!key)
continue;
value = udev_list_entry_get_value(entry);
- if (!strncasecmp(key, UDEV_XKB_PROP_KEY,
- sizeof(UDEV_XKB_PROP_KEY) - 1)) {
+ if (!strncasecmp(key, UDEV_XKB_PROP_KEY, sizeof(UDEV_XKB_PROP_KEY) - 1)) {
LOG_PROPERTY(path, key, value);
tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1;
if (!strcasecmp(tmp, "rules"))
- input_options = input_option_new(input_options, "xkb_rules", value);
+ input_options =
+ input_option_new(input_options, "xkb_rules", value);
else if (!strcasecmp(tmp, "layout"))
- input_options = input_option_new(input_options, "xkb_layout", value);
+ input_options =
+ input_option_new(input_options, "xkb_layout", value);
else if (!strcasecmp(tmp, "variant"))
- input_options = input_option_new(input_options, "xkb_variant", value);
+ input_options =
+ input_option_new(input_options, "xkb_variant", value);
else if (!strcasecmp(tmp, "model"))
- input_options = input_option_new(input_options, "xkb_model", value);
+ input_options =
+ input_option_new(input_options, "xkb_model", value);
else if (!strcasecmp(tmp, "options"))
- input_options = input_option_new(input_options, "xkb_options", value);
- } else if (!strcmp(key, "ID_VENDOR")) {
+ input_options =
+ input_option_new(input_options, "xkb_options", value);
+ }
+ else if (!strcmp(key, "ID_VENDOR")) {
LOG_PROPERTY(path, key, value);
attrs.vendor = strdup(value);
- } else if (!strcmp(key, "ID_INPUT_KEY")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_KEY")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_KEYBOARD;
- } else if (!strcmp(key, "ID_INPUT_MOUSE")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_MOUSE")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_POINTER;
- } else if (!strcmp(key, "ID_INPUT_JOYSTICK")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_JOYSTICK")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_JOYSTICK;
- } else if (!strcmp(key, "ID_INPUT_TABLET")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_TABLET")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_TABLET;
- } else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_TOUCHPAD;
- } else if (!strcmp(key, "ID_INPUT_TOUCHSCREEN")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_TOUCHSCREEN")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_TOUCHSCREEN;
}
@@ -212,6 +223,7 @@ device_added(struct udev_device *udev_device)
free(attrs.vendor);
if (attrs.tags) {
char **tag = attrs.tags;
+
while (*tag) {
free(*tag);
tag++;
@@ -246,7 +258,7 @@ wakeup_handler(pointer data, int err, pointer read_mask)
if (err < 0)
return;
- if (FD_ISSET(udev_fd, (fd_set *)read_mask)) {
+ if (FD_ISSET(udev_fd, (fd_set *) read_mask)) {
udev_device = udev_monitor_receive_device(udev_monitor);
if (!udev_device)
return;
@@ -282,7 +294,8 @@ config_udev_init(void)
if (!udev_monitor)
return 0;
- udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", NULL);
+ udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input",
+ NULL);
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
#ifdef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG
@@ -311,7 +324,8 @@ config_udev_init(void)
devices = udev_enumerate_get_list_entry(enumerate);
udev_list_entry_foreach(device, devices) {
const char *syspath = udev_list_entry_get_name(device);
- struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath);
+ struct udev_device *udev_device =
+ udev_device_new_from_syspath(udev, syspath);
/* Device might be gone by the time we try to open it */
if (!udev_device)
diff --git a/xorg-server/config/wscons.c b/xorg-server/config/wscons.c
index 27c1f6348..7a5e8cc10 100644
--- a/xorg-server/config/wscons.c
+++ b/xorg-server/config/wscons.c
@@ -50,219 +50,211 @@
{ KB_CF, "ca" }
struct nameint {
- int val;
- char *name;
-} kbdenc[] = { KB_OVRENC, KB_ENCTAB, { 0 } };
+ int val;
+ char *name;
+} kbdenc[] = {
+ KB_OVRENC, KB_ENCTAB, {
+0}};
struct nameint kbdvar[] = {
- { KB_NODEAD | KB_SG, "de_nodeadkeys" },
- { KB_NODEAD | KB_SF, "fr_nodeadkeys" },
- { KB_SF, "fr" },
- { KB_DVORAK | KB_CF, "fr-dvorak" },
- { KB_DVORAK | KB_FR, "bepo" },
- { KB_DVORAK, "dvorak" },
- { KB_CF, "fr-legacy" },
- { KB_NODEAD, "nodeadkeys" },
- { 0 }
+ {KB_NODEAD | KB_SG, "de_nodeadkeys"},
+ {KB_NODEAD | KB_SF, "fr_nodeadkeys"},
+ {KB_SF, "fr"},
+ {KB_DVORAK | KB_CF, "fr-dvorak"},
+ {KB_DVORAK | KB_FR, "bepo"},
+ {KB_DVORAK, "dvorak"},
+ {KB_CF, "fr-legacy"},
+ {KB_NODEAD, "nodeadkeys"},
+ {0}
};
struct nameint kbdopt[] = {
- { KB_SWAPCTRLCAPS, "ctrl:swapcaps" },
- { 0 }
+ {KB_SWAPCTRLCAPS, "ctrl:swapcaps"},
+ {0}
};
struct nameint kbdmodel[] = {
- { WSKBD_TYPE_ZAURUS, "zaurus" },
- { 0 }
+ {WSKBD_TYPE_ZAURUS, "zaurus"},
+ {0}
};
static void
wscons_add_keyboard(void)
{
- InputAttributes attrs = {};
- DeviceIntPtr dev = NULL;
- InputOption *input_options = NULL;
- char *config_info = NULL;
- int fd, i, rc;
- unsigned int type;
- kbd_t wsenc = 0;
+ InputAttributes attrs = { };
+ DeviceIntPtr dev = NULL;
+ InputOption *input_options = NULL;
+ char *config_info = NULL;
+ int fd, i, rc;
+ unsigned int type;
+ kbd_t wsenc = 0;
- /* Find keyboard configuration */
- fd = open(WSCONS_KBD_DEVICE, O_RDWR | O_NONBLOCK | O_EXCL);
- if (fd == -1) {
- LogMessage(X_ERROR, "wskbd: open %s: %s\n",
- WSCONS_KBD_DEVICE, strerror(errno));
- return;
- }
- if (ioctl(fd, WSKBDIO_GETENCODING, &wsenc) == -1) {
- LogMessage(X_WARNING, "wskbd: ioctl(WSKBDIO_GETENCODING) "
- "failed: %s\n", strerror(errno));
- close(fd);
- return;
- }
- if (ioctl(fd, WSKBDIO_GTYPE, &type) == -1) {
- LogMessage(X_WARNING, "wskbd: ioctl(WSKBDIO_GTYPE) "
- "failed: %s\n", strerror(errno));
- close(fd);
- return;
- }
- close (fd);
+ /* Find keyboard configuration */
+ fd = open(WSCONS_KBD_DEVICE, O_RDWR | O_NONBLOCK | O_EXCL);
+ if (fd == -1) {
+ LogMessage(X_ERROR, "wskbd: open %s: %s\n",
+ WSCONS_KBD_DEVICE, strerror(errno));
+ return;
+ }
+ if (ioctl(fd, WSKBDIO_GETENCODING, &wsenc) == -1) {
+ LogMessage(X_WARNING, "wskbd: ioctl(WSKBDIO_GETENCODING) "
+ "failed: %s\n", strerror(errno));
+ close(fd);
+ return;
+ }
+ if (ioctl(fd, WSKBDIO_GTYPE, &type) == -1) {
+ LogMessage(X_WARNING, "wskbd: ioctl(WSKBDIO_GTYPE) "
+ "failed: %s\n", strerror(errno));
+ close(fd);
+ return;
+ }
+ close(fd);
- input_options = input_option_new(input_options, "_source",
- "server/wscons");
- if (input_options == NULL)
- return;
+ input_options = input_option_new(input_options, "_source", "server/wscons");
+ if (input_options == NULL)
+ return;
- LogMessage(X_INFO, "config/wscons: checking input device %s\n",
- WSCONS_KBD_DEVICE);
- input_options = input_option_new(input_options, "name",
- WSCONS_KBD_DEVICE);
- input_options = input_option_new(input_options, "driver", "kbd");
+ LogMessage(X_INFO, "config/wscons: checking input device %s\n",
+ WSCONS_KBD_DEVICE);
+ input_options = input_option_new(input_options, "name", WSCONS_KBD_DEVICE);
+ input_options = input_option_new(input_options, "driver", "kbd");
- config_info = Xprintf("wscons:%s", WSCONS_KBD_DEVICE);
- if (!config_info)
- goto unwind;
- if (KB_ENCODING(wsenc) == KB_USER) {
- /* Ignore wscons "user" layout */
- LogMessageVerb(X_INFO, 3, "wskbd: ignoring \"user\" layout\n");
- goto kbd_config_done;
- }
- for (i = 0; kbdenc[i].val; i++)
- if(KB_ENCODING(wsenc) == kbdenc[i].val) {
- LogMessageVerb(X_INFO, 3, "wskbd: using layout %s\n",
- kbdenc[i].name);
- input_options = input_option_new(input_options,
- "xkb_layout", kbdenc[i].name);
- break;
- }
- for (i = 0; kbdvar[i].val; i++)
- if (wsenc == kbdvar[i].val ||
- KB_VARIANT(wsenc) == kbdvar[i].val) {
- LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
- kbdvar[i].name);
- input_options = input_option_new(input_options,
- "xkb_variant", kbdvar[i].name);
- break;
- }
- for (i = 0; kbdopt[i].val; i++)
- if (KB_VARIANT(wsenc) == kbdopt[i].val) {
- LogMessageVerb(X_INFO, 3, "wskbd: using option %s\n",
- kbdopt[i].name);
- input_options = input_option_new(input_options,
- "xkb_options", kbdopt[i].name);
- break;
- }
- for (i = 0; kbdmodel[i].val; i++)
- if (type == kbdmodel[i].val) {
- LogMessageVerb(X_INFO, 3, "wskbd: using model %s\n",
- kbdmodel[i].name);
- input_options = input_option_new(input_options,
- "xkb_model", kbdmodel[i].name);
- break;
- }
+ config_info = Xprintf("wscons:%s", WSCONS_KBD_DEVICE);
+ if (!config_info)
+ goto unwind;
+ if (KB_ENCODING(wsenc) == KB_USER) {
+ /* Ignore wscons "user" layout */
+ LogMessageVerb(X_INFO, 3, "wskbd: ignoring \"user\" layout\n");
+ goto kbd_config_done;
+ }
+ for (i = 0; kbdenc[i].val; i++)
+ if (KB_ENCODING(wsenc) == kbdenc[i].val) {
+ LogMessageVerb(X_INFO, 3, "wskbd: using layout %s\n",
+ kbdenc[i].name);
+ input_options = input_option_new(input_options,
+ "xkb_layout", kbdenc[i].name);
+ break;
+ }
+ for (i = 0; kbdvar[i].val; i++)
+ if (wsenc == kbdvar[i].val || KB_VARIANT(wsenc) == kbdvar[i].val) {
+ LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
+ kbdvar[i].name);
+ input_options = input_option_new(input_options,
+ "xkb_variant", kbdvar[i].name);
+ break;
+ }
+ for (i = 0; kbdopt[i].val; i++)
+ if (KB_VARIANT(wsenc) == kbdopt[i].val) {
+ LogMessageVerb(X_INFO, 3, "wskbd: using option %s\n",
+ kbdopt[i].name);
+ input_options = input_option_new(input_options,
+ "xkb_options", kbdopt[i].name);
+ break;
+ }
+ for (i = 0; kbdmodel[i].val; i++)
+ if (type == kbdmodel[i].val) {
+ LogMessageVerb(X_INFO, 3, "wskbd: using model %s\n",
+ kbdmodel[i].name);
+ input_options = input_option_new(input_options,
+ "xkb_model", kbdmodel[i].name);
+ break;
+ }
-kbd_config_done:
- attrs.flags |= ATTR_KEYBOARD;
- rc = NewInputDeviceRequest(input_options, &attrs, &dev);
- if (rc != Success)
- goto unwind;
+ kbd_config_done:
+ attrs.flags |= ATTR_KEYBOARD;
+ rc = NewInputDeviceRequest(input_options, &attrs, &dev);
+ if (rc != Success)
+ goto unwind;
- for (; dev; dev = dev->next) {
- free(dev->config_info);
- dev->config_info = strdup(config_info);
- }
-unwind:
- input_option_free_list(&input_options);
+ for (; dev; dev = dev->next) {
+ free(dev->config_info);
+ dev->config_info = strdup(config_info);
+ }
+ unwind:
+ input_option_free_list(&input_options);
}
static void
wscons_add_pointer(const char *path, const char *driver, int flags)
{
- InputAttributes attrs = {};
- DeviceIntPtr dev = NULL;
- InputOption *input_options = NULL;
- char *config_info = NULL;
- int rc;
+ InputAttributes attrs = { };
+ DeviceIntPtr dev = NULL;
+ InputOption *input_options = NULL;
+ char *config_info = NULL;
+ int rc;
- config_info = Xprintf("wscons:%s", path);
- if (!config_info)
- return;
+ config_info = Xprintf("wscons:%s", path);
+ if (!config_info)
+ return;
- input_options = input_option_new(input_options, "_source",
- "server/wscons");
- if (input_options == NULL)
- return;
+ input_options = input_option_new(input_options, "_source", "server/wscons");
+ if (input_options == NULL)
+ return;
- input_options = input_option_new(input_options, "name",
- strdup(path));
- input_options = input_option_new(input_options, "driver",
- strdup(driver));
- input_options = input_option_new(input_options, "device",
- strdup(path));
- LogMessage(X_INFO, "config/wscons: checking input device %s\n", path);
- attrs.flags |= flags;
- rc = NewInputDeviceRequest(input_options, &attrs, &dev);
- if (rc != Success)
- goto unwind;
+ input_options = input_option_new(input_options, "name", strdup(path));
+ input_options = input_option_new(input_options, "driver", strdup(driver));
+ input_options = input_option_new(input_options, "device", strdup(path));
+ LogMessage(X_INFO, "config/wscons: checking input device %s\n", path);
+ attrs.flags |= flags;
+ rc = NewInputDeviceRequest(input_options, &attrs, &dev);
+ if (rc != Success)
+ goto unwind;
- for (; dev; dev = dev->next) {
- free(dev->config_info);
- dev->config_info = strdup(config_info);
- }
-unwind:
- input_option_free_list(&input_options);
+ for (; dev; dev = dev->next) {
+ free(dev->config_info);
+ dev->config_info = strdup(config_info);
+ }
+ unwind:
+ input_option_free_list(&input_options);
}
static void
wscons_add_pointers(void)
{
- char devname[256];
- int fd, i, wsmouse_type;
+ char devname[256];
+ int fd, i, wsmouse_type;
- /* Check pointing devices */
- for (i = 0; i < 4; i++) {
- snprintf(devname, sizeof(devname), "%s%d",
- WSCONS_MOUSE_PREFIX, i);
- LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname);
- fd = open_device(devnamem O_RDWR | O_NONBLOCK | O_EXCL);
- if (fd == -1) {
- LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname,
- strerror(errno));
- continue;
- }
- if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) != 0) {
- LogMessageVerb(X_WARNING, 10,
- "%s: WSMOUSEIO_GTYPE failed\n", devname);
- close(fd);
- continue;
- }
- close(fd);
- switch (wsmouse_type) {
- case WSMOUSE_TYPE_SYNAPTICS:
- wscons_add_pointer(devname, "synaptics",
- ATTR_TOUCHPAD);
- break;
- case WSMOUSE_TYPE_TPANEL:
- wscons_add_pointer(devname, "ws", ATTR_TOUCHSCREEN);
- break;
- default:
- break;
- }
- }
- /* Add a default entry catching all other mux elements as "mouse" */
- wscons_add_pointer(WSCONS_MOUSE_PREFIX, "mouse", ATTR_POINTER);
+ /* Check pointing devices */
+ for (i = 0; i < 4; i++) {
+ snprintf(devname, sizeof(devname), "%s%d", WSCONS_MOUSE_PREFIX, i);
+ LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname);
+ fd = open_device(devnamem O_RDWR | O_NONBLOCK | O_EXCL);
+ if (fd == -1) {
+ LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname, strerror(errno));
+ continue;
+ }
+ if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) != 0) {
+ LogMessageVerb(X_WARNING, 10,
+ "%s: WSMOUSEIO_GTYPE failed\n", devname);
+ close(fd);
+ continue;
+ }
+ close(fd);
+ switch (wsmouse_type) {
+ case WSMOUSE_TYPE_SYNAPTICS:
+ wscons_add_pointer(devname, "synaptics", ATTR_TOUCHPAD);
+ break;
+ case WSMOUSE_TYPE_TPANEL:
+ wscons_add_pointer(devname, "ws", ATTR_TOUCHSCREEN);
+ break;
+ default:
+ break;
+ }
+ }
+ /* Add a default entry catching all other mux elements as "mouse" */
+ wscons_add_pointer(WSCONS_MOUSE_PREFIX, "mouse", ATTR_POINTER);
}
int
config_wscons_init(void)
{
- wscons_add_keyboard();
- wscons_add_pointers();
- return 1;
+ wscons_add_keyboard();
+ wscons_add_pointers();
+ return 1;
}
void
config_wscons_fini(void)
{
- /* Not much to do ? */
+ /* Not much to do ? */
}
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 2693ce705..65d29f206 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -26,8 +26,8 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.12.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-03-04"
+AC_INIT([xorg-server], 1.12.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-03-14"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
diff --git a/xorg-server/damageext/damageext.c b/xorg-server/damageext/damageext.c
index 86f880c1e..f21f71ca8 100644
--- a/xorg-server/damageext/damageext.c
+++ b/xorg-server/damageext/damageext.c
@@ -27,24 +27,25 @@
#include "damageextint.h"
#include "protocol-versions.h"
-static unsigned char DamageReqCode;
-static int DamageEventBase;
-static RESTYPE DamageExtType;
-static RESTYPE DamageExtWinType;
+static unsigned char DamageReqCode;
+static int DamageEventBase;
+static RESTYPE DamageExtType;
+static RESTYPE DamageExtWinType;
static DevPrivateKeyRec DamageClientPrivateKeyRec;
+
#define DamageClientPrivateKey (&DamageClientPrivateKeyRec)
static void
-DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
+DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
{
- ClientPtr pClient = pDamageExt->pClient;
- DamageClientPtr pDamageClient = GetDamageClient (pClient);
- DrawablePtr pDrawable = pDamageExt->pDrawable;
- xDamageNotifyEvent ev;
- int i;
+ ClientPtr pClient = pDamageExt->pClient;
+ DamageClientPtr pDamageClient = GetDamageClient(pClient);
+ DrawablePtr pDrawable = pDamageExt->pDrawable;
+ xDamageNotifyEvent ev;
+ int i;
- UpdateCurrentTimeIf ();
+ UpdateCurrentTimeIf();
ev.type = DamageEventBase + XDamageNotify;
ev.level = pDamageExt->level;
ev.drawable = pDamageExt->drawable;
@@ -54,81 +55,79 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
ev.geometry.y = pDrawable->y;
ev.geometry.width = pDrawable->width;
ev.geometry.height = pDrawable->height;
- if (pBoxes)
- {
- for (i = 0; i < nBoxes; i++)
- {
- ev.level = pDamageExt->level;
- if (i < nBoxes - 1)
- ev.level |= DamageNotifyMore;
- ev.area.x = pBoxes[i].x1;
- ev.area.y = pBoxes[i].y1;
- ev.area.width = pBoxes[i].x2 - pBoxes[i].x1;
- ev.area.height = pBoxes[i].y2 - pBoxes[i].y1;
- WriteEventsToClient (pClient, 1, (xEvent *) &ev);
- }
+ if (pBoxes) {
+ for (i = 0; i < nBoxes; i++) {
+ ev.level = pDamageExt->level;
+ if (i < nBoxes - 1)
+ ev.level |= DamageNotifyMore;
+ ev.area.x = pBoxes[i].x1;
+ ev.area.y = pBoxes[i].y1;
+ ev.area.width = pBoxes[i].x2 - pBoxes[i].x1;
+ ev.area.height = pBoxes[i].y2 - pBoxes[i].y1;
+ WriteEventsToClient(pClient, 1, (xEvent *) &ev);
+ }
}
- else
- {
- ev.area.x = 0;
- ev.area.y = 0;
- ev.area.width = pDrawable->width;
- ev.area.height = pDrawable->height;
- WriteEventsToClient (pClient, 1, (xEvent *) &ev);
+ else {
+ ev.area.x = 0;
+ ev.area.y = 0;
+ ev.area.width = pDrawable->width;
+ ev.area.height = pDrawable->height;
+ WriteEventsToClient(pClient, 1, (xEvent *) &ev);
}
/* Composite extension marks clients with manual Subwindows as critical */
- if (pDamageClient->critical > 0)
- {
- SetCriticalOutputPending ();
- pClient->smart_priority = SMART_MAX_PRIORITY;
+ if (pDamageClient->critical > 0) {
+ SetCriticalOutputPending();
+ pClient->smart_priority = SMART_MAX_PRIORITY;
}
}
static void
-DamageExtReport (DamagePtr pDamage, RegionPtr pRegion, void *closure)
+DamageExtReport(DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
- DamageExtPtr pDamageExt = closure;
+ DamageExtPtr pDamageExt = closure;
switch (pDamageExt->level) {
case DamageReportRawRegion:
case DamageReportDeltaRegion:
- DamageExtNotify (pDamageExt, RegionRects(pRegion), RegionNumRects(pRegion));
- break;
+ DamageExtNotify(pDamageExt, RegionRects(pRegion),
+ RegionNumRects(pRegion));
+ break;
case DamageReportBoundingBox:
- DamageExtNotify (pDamageExt, RegionExtents(pRegion), 1);
- break;
+ DamageExtNotify(pDamageExt, RegionExtents(pRegion), 1);
+ break;
case DamageReportNonEmpty:
- DamageExtNotify (pDamageExt, NullBox, 0);
- break;
+ DamageExtNotify(pDamageExt, NullBox, 0);
+ break;
case DamageReportNone:
- break;
+ break;
}
}
static void
-DamageExtDestroy (DamagePtr pDamage, void *closure)
+DamageExtDestroy(DamagePtr pDamage, void *closure)
{
- DamageExtPtr pDamageExt = closure;
-
+ DamageExtPtr pDamageExt = closure;
+
pDamageExt->pDamage = 0;
if (pDamageExt->id)
- FreeResource (pDamageExt->id, RT_NONE);
+ FreeResource(pDamageExt->id, RT_NONE);
}
void
-DamageExtSetCritical (ClientPtr pClient, Bool critical)
+DamageExtSetCritical(ClientPtr pClient, Bool critical)
{
- DamageClientPtr pDamageClient = GetDamageClient (pClient);
+ DamageClientPtr pDamageClient = GetDamageClient(pClient);
if (pDamageClient)
- pDamageClient->critical += critical ? 1 : -1;
+ pDamageClient->critical += critical ? 1 : -1;
}
static int
ProcDamageQueryVersion(ClientPtr client)
{
- DamageClientPtr pDamageClient = GetDamageClient (client);
+ DamageClientPtr pDamageClient = GetDamageClient(client);
xDamageQueryVersionReply rep;
+
REQUEST(xDamageQueryVersionReq);
REQUEST_SIZE_MATCH(xDamageQueryVersionReq);
@@ -136,157 +135,153 @@ ProcDamageQueryVersion(ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (stuff->majorVersion < SERVER_DAMAGE_MAJOR_VERSION) {
- rep.majorVersion = stuff->majorVersion;
- rep.minorVersion = stuff->minorVersion;
- } else {
- rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION;
- if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION &&
- stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION)
- rep.minorVersion = stuff->minorVersion;
- else
- rep.minorVersion = SERVER_DAMAGE_MINOR_VERSION;
+ rep.majorVersion = stuff->majorVersion;
+ rep.minorVersion = stuff->minorVersion;
+ }
+ else {
+ rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION;
+ if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION &&
+ stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION)
+ rep.minorVersion = stuff->minorVersion;
+ else
+ rep.minorVersion = SERVER_DAMAGE_MINOR_VERSION;
}
pDamageClient->major_version = rep.majorVersion;
pDamageClient->minor_version = rep.minorVersion;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xDamageQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDamageQueryVersionReply), (char *) &rep);
return Success;
}
static int
-ProcDamageCreate (ClientPtr client)
+ProcDamageCreate(ClientPtr client)
{
- DrawablePtr pDrawable;
- DamageExtPtr pDamageExt;
- DamageReportLevel level;
- RegionPtr pRegion;
- int rc;
-
+ DrawablePtr pDrawable;
+ DamageExtPtr pDamageExt;
+ DamageReportLevel level;
+ RegionPtr pRegion;
+ int rc;
+
REQUEST(xDamageCreateReq);
REQUEST_SIZE_MATCH(xDamageCreateReq);
LEGAL_NEW_RESOURCE(stuff->damage, client);
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixGetAttrAccess|DixReadAccess);
+ DixGetAttrAccess | DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->level) {
case XDamageReportRawRectangles:
- level = DamageReportRawRegion;
- break;
+ level = DamageReportRawRegion;
+ break;
case XDamageReportDeltaRectangles:
- level = DamageReportDeltaRegion;
- break;
+ level = DamageReportDeltaRegion;
+ break;
case XDamageReportBoundingBox:
- level = DamageReportBoundingBox;
- break;
+ level = DamageReportBoundingBox;
+ break;
case XDamageReportNonEmpty:
- level = DamageReportNonEmpty;
- break;
+ level = DamageReportNonEmpty;
+ break;
default:
- client->errorValue = stuff->level;
- return BadValue;
+ client->errorValue = stuff->level;
+ return BadValue;
}
-
- pDamageExt = malloc(sizeof (DamageExtRec));
+
+ pDamageExt = malloc(sizeof(DamageExtRec));
if (!pDamageExt)
- return BadAlloc;
+ return BadAlloc;
pDamageExt->id = stuff->damage;
pDamageExt->drawable = stuff->drawable;
pDamageExt->pDrawable = pDrawable;
pDamageExt->level = level;
pDamageExt->pClient = client;
- pDamageExt->pDamage = DamageCreate (DamageExtReport,
- DamageExtDestroy,
- level,
- FALSE,
- pDrawable->pScreen,
- pDamageExt);
- if (!pDamageExt->pDamage)
- {
- free(pDamageExt);
- return BadAlloc;
+ pDamageExt->pDamage = DamageCreate(DamageExtReport,
+ DamageExtDestroy,
+ level,
+ FALSE, pDrawable->pScreen, pDamageExt);
+ if (!pDamageExt->pDamage) {
+ free(pDamageExt);
+ return BadAlloc;
}
- if (!AddResource (stuff->damage, DamageExtType, (pointer) pDamageExt))
- return BadAlloc;
+ if (!AddResource(stuff->damage, DamageExtType, (pointer) pDamageExt))
+ return BadAlloc;
- DamageSetReportAfterOp (pDamageExt->pDamage, TRUE);
- DamageRegister (pDamageExt->pDrawable, pDamageExt->pDamage);
+ DamageSetReportAfterOp(pDamageExt->pDamage, TRUE);
+ DamageRegister(pDamageExt->pDrawable, pDamageExt->pDamage);
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- pRegion = &((WindowPtr) pDrawable)->borderClip;
- DamageReportDamage(pDamageExt->pDamage, pRegion);
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ pRegion = &((WindowPtr) pDrawable)->borderClip;
+ DamageReportDamage(pDamageExt->pDamage, pRegion);
}
return Success;
}
static int
-ProcDamageDestroy (ClientPtr client)
+ProcDamageDestroy(ClientPtr client)
{
REQUEST(xDamageDestroyReq);
- DamageExtPtr pDamageExt;
+ DamageExtPtr pDamageExt;
REQUEST_SIZE_MATCH(xDamageDestroyReq);
VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
- FreeResource (stuff->damage, RT_NONE);
+ FreeResource(stuff->damage, RT_NONE);
return Success;
}
static int
-ProcDamageSubtract (ClientPtr client)
+ProcDamageSubtract(ClientPtr client)
{
REQUEST(xDamageSubtractReq);
- DamageExtPtr pDamageExt;
- RegionPtr pRepair;
- RegionPtr pParts;
+ DamageExtPtr pDamageExt;
+ RegionPtr pRepair;
+ RegionPtr pParts;
REQUEST_SIZE_MATCH(xDamageSubtractReq);
VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess);
VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess);
- if (pDamageExt->level != DamageReportRawRegion)
- {
- DamagePtr pDamage = pDamageExt->pDamage;
- if (pRepair)
- {
- if (pParts)
- RegionIntersect(pParts, DamageRegion (pDamage), pRepair);
- if (DamageSubtract (pDamage, pRepair))
- DamageExtReport (pDamage, DamageRegion (pDamage), (void *) pDamageExt);
- }
- else
- {
- if (pParts)
- RegionCopy(pParts, DamageRegion (pDamage));
- DamageEmpty (pDamage);
- }
+ if (pDamageExt->level != DamageReportRawRegion) {
+ DamagePtr pDamage = pDamageExt->pDamage;
+
+ if (pRepair) {
+ if (pParts)
+ RegionIntersect(pParts, DamageRegion(pDamage), pRepair);
+ if (DamageSubtract(pDamage, pRepair))
+ DamageExtReport(pDamage, DamageRegion(pDamage),
+ (void *) pDamageExt);
+ }
+ else {
+ if (pParts)
+ RegionCopy(pParts, DamageRegion(pDamage));
+ DamageEmpty(pDamage);
+ }
}
return Success;
}
static int
-ProcDamageAdd (ClientPtr client)
+ProcDamageAdd(ClientPtr client)
{
REQUEST(xDamageAddReq);
- DrawablePtr pDrawable;
- RegionPtr pRegion;
- int rc;
+ DrawablePtr pDrawable;
+ RegionPtr pRegion;
+ int rc;
REQUEST_SIZE_MATCH(xDamageAddReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixWriteAccess);
+ DixWriteAccess);
if (rc != Success)
- return rc;
+ return rc;
/* The region is relative to the drawable origin, so translate it out to
* screen coordinates like damage expects.
@@ -300,33 +295,29 @@ ProcDamageAdd (ClientPtr client)
/* Major version controls available requests */
static const int version_requests[] = {
- X_DamageQueryVersion, /* before client sends QueryVersion */
- X_DamageAdd, /* Version 1 */
+ X_DamageQueryVersion, /* before client sends QueryVersion */
+ X_DamageAdd, /* Version 1 */
};
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
-
-static int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
+
+static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
/*************** Version 1 ******************/
ProcDamageQueryVersion,
- ProcDamageCreate,
- ProcDamageDestroy,
- ProcDamageSubtract,
+ ProcDamageCreate, ProcDamageDestroy, ProcDamageSubtract,
/*************** Version 1.1 ****************/
- ProcDamageAdd,
-};
-
+ProcDamageAdd,};
static int
-ProcDamageDispatch (ClientPtr client)
+ProcDamageDispatch(ClientPtr client)
{
REQUEST(xDamageReq);
- DamageClientPtr pDamageClient = GetDamageClient (client);
+ DamageClientPtr pDamageClient = GetDamageClient(client);
if (pDamageClient->major_version >= NUM_VERSION_REQUESTS)
- return BadRequest;
+ return BadRequest;
if (stuff->damageReqType > version_requests[pDamageClient->major_version])
- return BadRequest;
+ return BadRequest;
return (*ProcDamageVector[stuff->damageReqType]) (client);
}
@@ -343,10 +334,10 @@ SProcDamageQueryVersion(ClientPtr client)
}
static int
-SProcDamageCreate (ClientPtr client)
+SProcDamageCreate(ClientPtr client)
{
REQUEST(xDamageCreateReq);
-
+
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDamageCreateReq);
swapl(&stuff->damage);
@@ -355,10 +346,10 @@ SProcDamageCreate (ClientPtr client)
}
static int
-SProcDamageDestroy (ClientPtr client)
+SProcDamageDestroy(ClientPtr client)
{
REQUEST(xDamageDestroyReq);
-
+
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDamageDestroyReq);
swapl(&stuff->damage);
@@ -366,10 +357,10 @@ SProcDamageDestroy (ClientPtr client)
}
static int
-SProcDamageSubtract (ClientPtr client)
+SProcDamageSubtract(ClientPtr client)
{
REQUEST(xDamageSubtractReq);
-
+
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDamageSubtractReq);
swapl(&stuff->damage);
@@ -379,7 +370,7 @@ SProcDamageSubtract (ClientPtr client)
}
static int
-SProcDamageAdd (ClientPtr client)
+SProcDamageAdd(ClientPtr client)
{
REQUEST(xDamageAddReq);
@@ -390,126 +381,119 @@ SProcDamageAdd (ClientPtr client)
return (*ProcDamageVector[stuff->damageReqType]) (client);
}
-static int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
+static int (*SProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
/*************** Version 1 ******************/
SProcDamageQueryVersion,
- SProcDamageCreate,
- SProcDamageDestroy,
- SProcDamageSubtract,
+ SProcDamageCreate, SProcDamageDestroy, SProcDamageSubtract,
/*************** Version 1.1 ****************/
- SProcDamageAdd,
-};
+SProcDamageAdd,};
static int
-SProcDamageDispatch (ClientPtr client)
+SProcDamageDispatch(ClientPtr client)
{
REQUEST(xDamageReq);
if (stuff->damageReqType >= XDamageNumberRequests)
- return BadRequest;
+ return BadRequest;
return (*SProcDamageVector[stuff->damageReqType]) (client);
}
static void
-DamageClientCallback (CallbackListPtr *list,
- pointer closure,
- pointer data)
+DamageClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- DamageClientPtr pDamageClient = GetDamageClient (pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ DamageClientPtr pDamageClient = GetDamageClient(pClient);
pDamageClient->critical = 0;
pDamageClient->major_version = 0;
pDamageClient->minor_version = 0;
}
-/*ARGSUSED*/
-static void
-DamageResetProc (ExtensionEntry *extEntry)
+ /*ARGSUSED*/ static void
+DamageResetProc(ExtensionEntry * extEntry)
{
- DeleteCallback (&ClientStateCallback, DamageClientCallback, 0);
+ DeleteCallback(&ClientStateCallback, DamageClientCallback, 0);
}
static int
-FreeDamageExt (pointer value, XID did)
+FreeDamageExt(pointer value, XID did)
{
- DamageExtPtr pDamageExt = (DamageExtPtr) value;
+ DamageExtPtr pDamageExt = (DamageExtPtr) value;
/*
* Get rid of the resource table entry hanging from the window id
*/
pDamageExt->id = 0;
if (WindowDrawable(pDamageExt->pDrawable->type))
- FreeResourceByType (pDamageExt->pDrawable->id, DamageExtWinType, TRUE);
- if (pDamageExt->pDamage)
- {
- DamageUnregister (pDamageExt->pDrawable, pDamageExt->pDamage);
- DamageDestroy (pDamageExt->pDamage);
+ FreeResourceByType(pDamageExt->pDrawable->id, DamageExtWinType, TRUE);
+ if (pDamageExt->pDamage) {
+ DamageUnregister(pDamageExt->pDrawable, pDamageExt->pDamage);
+ DamageDestroy(pDamageExt->pDamage);
}
free(pDamageExt);
return Success;
}
static int
-FreeDamageExtWin (pointer value, XID wid)
+FreeDamageExtWin(pointer value, XID wid)
{
- DamageExtPtr pDamageExt = (DamageExtPtr) value;
+ DamageExtPtr pDamageExt = (DamageExtPtr) value;
if (pDamageExt->id)
- FreeResource (pDamageExt->id, RT_NONE);
+ FreeResource(pDamageExt->id, RT_NONE);
return Success;
}
static void
-SDamageNotifyEvent (xDamageNotifyEvent *from,
- xDamageNotifyEvent *to)
+SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to)
{
to->type = from->type;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->drawable, to->drawable);
- cpswapl (from->damage, to->damage);
- cpswaps (from->area.x, to->area.x);
- cpswaps (from->area.y, to->area.y);
- cpswaps (from->area.width, to->area.width);
- cpswaps (from->area.height, to->area.height);
- cpswaps (from->geometry.x, to->geometry.x);
- cpswaps (from->geometry.y, to->geometry.y);
- cpswaps (from->geometry.width, to->geometry.width);
- cpswaps (from->geometry.height, to->geometry.height);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->drawable, to->drawable);
+ cpswapl(from->damage, to->damage);
+ cpswaps(from->area.x, to->area.x);
+ cpswaps(from->area.y, to->area.y);
+ cpswaps(from->area.width, to->area.width);
+ cpswaps(from->area.height, to->area.height);
+ cpswaps(from->geometry.x, to->geometry.x);
+ cpswaps(from->geometry.y, to->geometry.y);
+ cpswaps(from->geometry.width, to->geometry.width);
+ cpswaps(from->geometry.height, to->geometry.height);
}
void
DamageExtensionInit(void)
{
ExtensionEntry *extEntry;
- int s;
+ int s;
for (s = 0; s < screenInfo.numScreens; s++)
- DamageSetup (screenInfo.screens[s]);
+ DamageSetup(screenInfo.screens[s]);
- DamageExtType = CreateNewResourceType (FreeDamageExt, "DamageExt");
+ DamageExtType = CreateNewResourceType(FreeDamageExt, "DamageExt");
if (!DamageExtType)
- return;
+ return;
- DamageExtWinType = CreateNewResourceType (FreeDamageExtWin, "DamageExtWin");
+ DamageExtWinType = CreateNewResourceType(FreeDamageExtWin, "DamageExtWin");
if (!DamageExtWinType)
- return;
-
- if (!dixRegisterPrivateKey(&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (DamageClientRec)))
- return;
-
- if (!AddCallback (&ClientStateCallback, DamageClientCallback, 0))
- return;
-
- if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents,
- XDamageNumberErrors,
- ProcDamageDispatch, SProcDamageDispatch,
- DamageResetProc, StandardMinorOpcode)) != 0)
- {
- DamageReqCode = (unsigned char)extEntry->base;
- DamageEventBase = extEntry->eventBase;
- EventSwapVector[DamageEventBase + XDamageNotify] =
- (EventSwapPtr) SDamageNotifyEvent;
- SetResourceTypeErrorValue(DamageExtType, extEntry->errorBase + BadDamage);
+ return;
+
+ if (!dixRegisterPrivateKey
+ (&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(DamageClientRec)))
+ return;
+
+ if (!AddCallback(&ClientStateCallback, DamageClientCallback, 0))
+ return;
+
+ if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents,
+ XDamageNumberErrors,
+ ProcDamageDispatch, SProcDamageDispatch,
+ DamageResetProc, StandardMinorOpcode)) != 0) {
+ DamageReqCode = (unsigned char) extEntry->base;
+ DamageEventBase = extEntry->eventBase;
+ EventSwapVector[DamageEventBase + XDamageNotify] =
+ (EventSwapPtr) SDamageNotifyEvent;
+ SetResourceTypeErrorValue(DamageExtType,
+ extEntry->errorBase + BadDamage);
}
}
diff --git a/xorg-server/dbe/dbe.c b/xorg-server/dbe/dbe.c
index a46867676..ca7f3e278 100644
--- a/xorg-server/dbe/dbe.c
+++ b/xorg-server/dbe/dbe.c
@@ -30,7 +30,6 @@
*
*****************************************************************************/
-
/* INCLUDES */
#ifdef HAVE_DIX_CONFIG_H
@@ -57,11 +56,11 @@ DevPrivateKeyRec dbeScreenPrivKeyRec;
DevPrivateKeyRec dbeWindowPrivKeyRec;
/* These are globals for use by DDX */
-RESTYPE dbeDrawableResType;
-RESTYPE dbeWindowPrivResType;
+RESTYPE dbeDrawableResType;
+RESTYPE dbeWindowPrivResType;
/* Used to generate DBE's BadBuffer error. */
-static int dbeErrorBase;
+static int dbeErrorBase;
/******************************************************************************
*
@@ -87,19 +86,17 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
*/
/* Stub DDX. */
- pDbeScreenPriv->GetVisualInfo = NULL;
+ pDbeScreenPriv->GetVisualInfo = NULL;
pDbeScreenPriv->AllocBackBufferName = NULL;
- pDbeScreenPriv->SwapBuffers = NULL;
- pDbeScreenPriv->BeginIdiom = NULL;
- pDbeScreenPriv->EndIdiom = NULL;
- pDbeScreenPriv->WinPrivDelete = NULL;
- pDbeScreenPriv->ResetProc = NULL;
+ pDbeScreenPriv->SwapBuffers = NULL;
+ pDbeScreenPriv->BeginIdiom = NULL;
+ pDbeScreenPriv->EndIdiom = NULL;
+ pDbeScreenPriv->WinPrivDelete = NULL;
+ pDbeScreenPriv->ResetProc = NULL;
(*nStubbedScreens)++;
-} /* DbeStubScreen() */
-
-
+} /* DbeStubScreen() */
/******************************************************************************
*
@@ -121,27 +118,25 @@ static int
ProcDbeGetVersion(ClientPtr client)
{
/* REQUEST(xDbeGetVersionReq); */
- xDbeGetVersionReply rep;
+ xDbeGetVersionReply rep;
REQUEST_SIZE_MATCH(xDbeGetVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
+ rep.type = X_Reply;
+ rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.majorVersion = DBE_MAJOR_VERSION;
- rep.minorVersion = DBE_MINOR_VERSION;
+ rep.majorVersion = DBE_MAJOR_VERSION;
+ rep.minorVersion = DBE_MINOR_VERSION;
- if (client->swapped)
- {
+ if (client->swapped) {
swaps(&rep.sequenceNumber);
}
- WriteToClient(client, sizeof(xDbeGetVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDbeGetVersionReply), (char *) &rep);
return Success;
-} /* ProcDbeGetVersion() */
-
+} /* ProcDbeGetVersion() */
/******************************************************************************
*
@@ -170,38 +165,34 @@ static int
ProcDbeAllocateBackBufferName(ClientPtr client)
{
REQUEST(xDbeAllocateBackBufferNameReq);
- WindowPtr pWin;
- DbeScreenPrivPtr pDbeScreenPriv;
- DbeWindowPrivPtr pDbeWindowPriv;
- XdbeScreenVisualInfo scrVisInfo;
- register int i;
- Bool visualMatched = FALSE;
- xDbeSwapAction swapAction;
- VisualID visual;
- int status;
- int add_index;
-
+ WindowPtr pWin;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ XdbeScreenVisualInfo scrVisInfo;
+ register int i;
+ Bool visualMatched = FALSE;
+ xDbeSwapAction swapAction;
+ VisualID visual;
+ int status;
+ int add_index;
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
/* The window must be valid. */
status = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
if (status != Success)
- return status;
+ return status;
/* The window must be InputOutput. */
- if (pWin->drawable.class != InputOutput)
- {
- return BadMatch;
+ if (pWin->drawable.class != InputOutput) {
+ return BadMatch;
}
/* The swap action must be valid. */
- swapAction = stuff->swapAction; /* use local var for performance. */
- if ((swapAction != XdbeUndefined ) &&
+ swapAction = stuff->swapAction; /* use local var for performance. */
+ if ((swapAction != XdbeUndefined) &&
(swapAction != XdbeBackground) &&
- (swapAction != XdbeUntouched ) &&
- (swapAction != XdbeCopied ))
- {
+ (swapAction != XdbeUntouched) && (swapAction != XdbeCopied)) {
return BadValue;
}
@@ -213,115 +204,105 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
*/
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
if (!pDbeScreenPriv->GetVisualInfo)
- return BadMatch; /* screen doesn't support double buffering */
+ return BadMatch; /* screen doesn't support double buffering */
- if (!(*pDbeScreenPriv->GetVisualInfo)(pWin->drawable.pScreen, &scrVisInfo))
- {
+ if (!(*pDbeScreenPriv->GetVisualInfo) (pWin->drawable.pScreen, &scrVisInfo)) {
/* GetVisualInfo() failed to allocate visual info data. */
return BadAlloc;
}
/* See if the window's visual is on the list. */
visual = wVisual(pWin);
- for (i = 0; (i < scrVisInfo.count) && !visualMatched; i++)
- {
- if (scrVisInfo.visinfo[i].visual == visual)
- {
- visualMatched = TRUE;
- }
+ for (i = 0; (i < scrVisInfo.count) && !visualMatched; i++) {
+ if (scrVisInfo.visinfo[i].visual == visual) {
+ visualMatched = TRUE;
+ }
}
/* Free what was allocated by the GetVisualInfo() call above. */
free(scrVisInfo.visinfo);
- if (!visualMatched)
- {
- return BadMatch;
+ if (!visualMatched) {
+ return BadMatch;
}
- if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)) == NULL)
- {
+ if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)) == NULL) {
/* There is no buffer associated with the window.
* Allocate a window priv.
*/
- pDbeWindowPriv = dixAllocateObjectWithPrivates(DbeWindowPrivRec, PRIVATE_DBE_WINDOW);
- if (!pDbeWindowPriv)
+ pDbeWindowPriv =
+ dixAllocateObjectWithPrivates(DbeWindowPrivRec, PRIVATE_DBE_WINDOW);
+ if (!pDbeWindowPriv)
return BadAlloc;
/* Fill out window priv information. */
- pDbeWindowPriv->pWindow = pWin;
- pDbeWindowPriv->width = pWin->drawable.width;
- pDbeWindowPriv->height = pWin->drawable.height;
- pDbeWindowPriv->x = pWin->drawable.x;
- pDbeWindowPriv->y = pWin->drawable.y;
- pDbeWindowPriv->nBufferIDs = 0;
+ pDbeWindowPriv->pWindow = pWin;
+ pDbeWindowPriv->width = pWin->drawable.width;
+ pDbeWindowPriv->height = pWin->drawable.height;
+ pDbeWindowPriv->x = pWin->drawable.x;
+ pDbeWindowPriv->y = pWin->drawable.y;
+ pDbeWindowPriv->nBufferIDs = 0;
/* Set the buffer ID array pointer to the initial (static) array). */
pDbeWindowPriv->IDs = pDbeWindowPriv->initIDs;
- /* Initialize the buffer ID list. */
+ /* Initialize the buffer ID list. */
pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
pDbeWindowPriv->IDs[0] = stuff->buffer;
add_index = 0;
- for (i = 0; i < DBE_INIT_MAX_IDS; i++)
- {
+ for (i = 0; i < DBE_INIT_MAX_IDS; i++) {
pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT;
}
/* Actually connect the window priv to the window. */
dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, pDbeWindowPriv);
- } /* if -- There is no buffer associated with the window. */
+ } /* if -- There is no buffer associated with the window. */
- else
- {
+ else {
/* A buffer is already associated with the window.
* Add the new buffer ID to the array, reallocating the array memory
* if necessary.
*/
/* Determine if there is a free element in the ID array. */
- for (i = 0; i < pDbeWindowPriv->maxAvailableIDs; i++)
- {
- if (pDbeWindowPriv->IDs[i] == DBE_FREE_ID_ELEMENT)
- {
+ for (i = 0; i < pDbeWindowPriv->maxAvailableIDs; i++) {
+ if (pDbeWindowPriv->IDs[i] == DBE_FREE_ID_ELEMENT) {
/* There is still room in the ID array. */
break;
}
}
-
- if (i == pDbeWindowPriv->maxAvailableIDs)
- {
+
+ if (i == pDbeWindowPriv->maxAvailableIDs) {
/* No more room in the ID array -- reallocate another array. */
- XID *pIDs;
+ XID *pIDs;
/* Setup an array pointer for the realloc operation below. */
- if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS)
- {
+ if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS) {
/* We will malloc a new array. */
pIDs = NULL;
}
- else
- {
+ else {
/* We will realloc a new array. */
pIDs = pDbeWindowPriv->IDs;
}
/* malloc/realloc a new array and initialize all elements to 0. */
- pDbeWindowPriv->IDs = (XID *)realloc(pIDs,
- (pDbeWindowPriv->maxAvailableIDs+DBE_INCR_MAX_IDS)*sizeof(XID));
- if (!pDbeWindowPriv->IDs)
- {
+ pDbeWindowPriv->IDs = (XID *) realloc(pIDs,
+ (pDbeWindowPriv->
+ maxAvailableIDs +
+ DBE_INCR_MAX_IDS) *
+ sizeof(XID));
+ if (!pDbeWindowPriv->IDs) {
return BadAlloc;
}
memset(&pDbeWindowPriv->IDs[pDbeWindowPriv->nBufferIDs], 0,
(pDbeWindowPriv->maxAvailableIDs + DBE_INCR_MAX_IDS -
pDbeWindowPriv->nBufferIDs) * sizeof(XID));
- if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS)
- {
+ if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS) {
/* We just went from using the initial (static) array to a
* newly allocated array. Copy the IDs from the initial array
* to the new array.
@@ -333,21 +314,18 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
pDbeWindowPriv->maxAvailableIDs += DBE_INCR_MAX_IDS;
}
- add_index = i;
-
- } /* else -- A buffer is already associated with the window. */
+ add_index = i;
+ } /* else -- A buffer is already associated with the window. */
/* Call the DDX routine to allocate the back buffer. */
- status = (*pDbeScreenPriv->AllocBackBufferName)(pWin, stuff->buffer,
- stuff->swapAction);
+ status = (*pDbeScreenPriv->AllocBackBufferName) (pWin, stuff->buffer,
+ stuff->swapAction);
- if (status == Success)
- {
- pDbeWindowPriv->IDs[add_index] = stuff->buffer;
+ if (status == Success) {
+ pDbeWindowPriv->IDs[add_index] = stuff->buffer;
if (!AddResource(stuff->buffer, dbeWindowPrivResType,
- (pointer)pDbeWindowPriv))
- {
+ (pointer) pDbeWindowPriv)) {
pDbeWindowPriv->IDs[add_index] = DBE_FREE_ID_ELEMENT;
if (pDbeWindowPriv->nBufferIDs == 0) {
@@ -355,7 +333,8 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
goto out_free;
}
}
- } else {
+ }
+ else {
/* The DDX buffer allocation routine failed for the first buffer of
* this window.
*/
@@ -372,13 +351,12 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
return status;
-out_free:
+ out_free:
dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, NULL);
free(pDbeWindowPriv);
return status;
-} /* ProcDbeAllocateBackBufferName() */
-
+} /* ProcDbeAllocateBackBufferName() */
/******************************************************************************
*
@@ -401,41 +379,37 @@ static int
ProcDbeDeallocateBackBufferName(ClientPtr client)
{
REQUEST(xDbeDeallocateBackBufferNameReq);
- DbeWindowPrivPtr pDbeWindowPriv;
- int rc, i;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ int rc, i;
pointer val;
-
REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq);
/* Buffer name must be valid */
- rc = dixLookupResourceByType((pointer *)&pDbeWindowPriv, stuff->buffer,
- dbeWindowPrivResType, client,
- DixDestroyAccess);
+ rc = dixLookupResourceByType((pointer *) &pDbeWindowPriv, stuff->buffer,
+ dbeWindowPrivResType, client,
+ DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
rc = dixLookupResourceByType(&val, stuff->buffer, dbeDrawableResType,
- client, DixDestroyAccess);
+ client, DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
/* Make sure that the id is valid for the window.
* This is paranoid code since we already looked up the ID by type
* above.
*/
- for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++)
- {
+ for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) {
/* Loop through the ID list to find the ID. */
- if (pDbeWindowPriv->IDs[i] == stuff->buffer)
- {
+ if (pDbeWindowPriv->IDs[i] == stuff->buffer) {
break;
}
}
- if (i == pDbeWindowPriv->nBufferIDs)
- {
+ if (i == pDbeWindowPriv->nBufferIDs) {
/* We did not find the ID in the ID list. */
client->errorValue = stuff->buffer;
return dbeErrorBase + DbeBadBuffer;
@@ -445,8 +419,7 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
return Success;
-} /* ProcDbeDeallocateBackBufferName() */
-
+} /* ProcDbeDeallocateBackBufferName() */
/******************************************************************************
*
@@ -475,82 +448,72 @@ static int
ProcDbeSwapBuffers(ClientPtr client)
{
REQUEST(xDbeSwapBuffersReq);
- WindowPtr pWin;
- DbeScreenPrivPtr pDbeScreenPriv;
- DbeSwapInfoPtr swapInfo;
- xDbeSwapInfo *dbeSwapInfo;
- int error;
- register int i, j;
- int nStuff;
-
+ WindowPtr pWin;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeSwapInfoPtr swapInfo;
+ xDbeSwapInfo *dbeSwapInfo;
+ int error;
+ register int i, j;
+ int nStuff;
REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq);
- nStuff = stuff->n; /* use local variable for performance. */
+ nStuff = stuff->n; /* use local variable for performance. */
- if (nStuff == 0)
- {
+ if (nStuff == 0) {
return Success;
}
if (nStuff > UINT32_MAX / sizeof(DbeSwapInfoRec))
- return BadAlloc;
+ return BadAlloc;
/* Get to the swap info appended to the end of the request. */
- dbeSwapInfo = (xDbeSwapInfo *)&stuff[1];
+ dbeSwapInfo = (xDbeSwapInfo *) &stuff[1];
- /* Allocate array to record swap information. */
- swapInfo = (DbeSwapInfoPtr)malloc(nStuff * sizeof(DbeSwapInfoRec));
- if (swapInfo == NULL)
- {
+ /* Allocate array to record swap information. */
+ swapInfo = (DbeSwapInfoPtr) malloc(nStuff * sizeof(DbeSwapInfoRec));
+ if (swapInfo == NULL) {
return BadAlloc;
}
-
- for (i = 0; i < nStuff; i++)
- {
+ for (i = 0; i < nStuff; i++) {
/* Check all windows to swap. */
/* Each window must be a valid window - BadWindow. */
- error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client,
- DixWriteAccess);
- if (error != Success) {
+ error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client,
+ DixWriteAccess);
+ if (error != Success) {
free(swapInfo);
- return error;
+ return error;
}
/* Each window must be double-buffered - BadMatch. */
- if (DBE_WINDOW_PRIV(pWin) == NULL)
- {
+ if (DBE_WINDOW_PRIV(pWin) == NULL) {
free(swapInfo);
return BadMatch;
}
/* Each window must only be specified once - BadMatch. */
- for (j = i + 1; j < nStuff; j++)
- {
- if (dbeSwapInfo[i].window == dbeSwapInfo[j].window)
- {
+ for (j = i + 1; j < nStuff; j++) {
+ if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) {
free(swapInfo);
return BadMatch;
- }
+ }
}
/* Each swap action must be valid - BadValue. */
- if ((dbeSwapInfo[i].swapAction != XdbeUndefined ) &&
+ if ((dbeSwapInfo[i].swapAction != XdbeUndefined) &&
(dbeSwapInfo[i].swapAction != XdbeBackground) &&
- (dbeSwapInfo[i].swapAction != XdbeUntouched ) &&
- (dbeSwapInfo[i].swapAction != XdbeCopied ))
- {
+ (dbeSwapInfo[i].swapAction != XdbeUntouched) &&
+ (dbeSwapInfo[i].swapAction != XdbeCopied)) {
free(swapInfo);
return BadValue;
}
/* Everything checks out OK. Fill in the swap info array. */
- swapInfo[i].pWindow = pWin;
- swapInfo[i].swapAction = dbeSwapInfo[i].swapAction;
-
- } /* for (i = 0; i < nStuff; i++) */
+ swapInfo[i].pWindow = pWin;
+ swapInfo[i].swapAction = dbeSwapInfo[i].swapAction;
+ } /* for (i = 0; i < nStuff; i++) */
/* Call the DDX routine to perform the swap(s). The DDX routine should
* scan the swap list (swap info), swap any buffers that it knows how to
@@ -565,22 +528,19 @@ ProcDbeSwapBuffers(ClientPtr client)
* could deal with cross-screen synchronization.
*/
- while (nStuff > 0)
- {
+ while (nStuff > 0) {
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(swapInfo[0].pWindow);
- error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo);
- if (error != Success)
- {
+ error = (*pDbeScreenPriv->SwapBuffers) (client, &nStuff, swapInfo);
+ if (error != Success) {
free(swapInfo);
return error;
}
}
-
+
free(swapInfo);
return Success;
-} /* ProcDbeSwapBuffers() */
-
+} /* ProcDbeSwapBuffers() */
/******************************************************************************
*
@@ -602,27 +562,23 @@ static int
ProcDbeBeginIdiom(ClientPtr client)
{
/* REQUEST(xDbeBeginIdiomReq); */
- DbeScreenPrivPtr pDbeScreenPriv;
- register int i;
-
+ DbeScreenPrivPtr pDbeScreenPriv;
+ register int i;
REQUEST_SIZE_MATCH(xDbeBeginIdiomReq);
- for (i = 0; i < screenInfo.numScreens; i++)
- {
+ for (i = 0; i < screenInfo.numScreens; i++) {
pDbeScreenPriv = DBE_SCREEN_PRIV(screenInfo.screens[i]);
/* Call the DDX begin idiom procedure if there is one. */
- if (pDbeScreenPriv->BeginIdiom)
- {
- (*pDbeScreenPriv->BeginIdiom)(client);
+ if (pDbeScreenPriv->BeginIdiom) {
+ (*pDbeScreenPriv->BeginIdiom) (client);
}
}
return Success;
-} /* ProcDbeBeginIdiom() */
-
+} /* ProcDbeBeginIdiom() */
/******************************************************************************
*
@@ -645,37 +601,33 @@ static int
ProcDbeGetVisualInfo(ClientPtr client)
{
REQUEST(xDbeGetVisualInfoReq);
- DbeScreenPrivPtr pDbeScreenPriv;
- xDbeGetVisualInfoReply rep;
- Drawable *drawables;
- DrawablePtr *pDrawables = NULL;
- register int i, j, rc;
- register int count; /* number of visual infos in reply */
- register int length; /* length of reply */
- ScreenPtr pScreen;
- XdbeScreenVisualInfo *pScrVisInfo;
-
+ DbeScreenPrivPtr pDbeScreenPriv;
+ xDbeGetVisualInfoReply rep;
+ Drawable *drawables;
+ DrawablePtr *pDrawables = NULL;
+ register int i, j, rc;
+ register int count; /* number of visual infos in reply */
+ register int length; /* length of reply */
+ ScreenPtr pScreen;
+ XdbeScreenVisualInfo *pScrVisInfo;
REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq);
if (stuff->n > UINT32_MAX / sizeof(DrawablePtr))
- return BadAlloc;
+ return BadAlloc;
/* Make sure any specified drawables are valid. */
- if (stuff->n != 0)
- {
- if (!(pDrawables = (DrawablePtr *)malloc(stuff->n *
- sizeof(DrawablePtr))))
- {
+ if (stuff->n != 0) {
+ if (!(pDrawables = (DrawablePtr *) malloc(stuff->n *
+ sizeof(DrawablePtr)))) {
return BadAlloc;
}
- drawables = (Drawable *)&stuff[1];
+ drawables = (Drawable *) &stuff[1];
- for (i = 0; i < stuff->n; i++)
- {
- rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0,
- DixGetAttrAccess);
- if (rc != Success) {
+ for (i = 0; i < stuff->n; i++) {
+ rc = dixLookupDrawable(pDrawables + i, drawables[i], client, 0,
+ DixGetAttrAccess);
+ if (rc != Success) {
free(pDrawables);
return rc;
}
@@ -683,8 +635,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
}
count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n;
- if (!(pScrVisInfo = calloc(count, sizeof(XdbeScreenVisualInfo))))
- {
+ if (!(pScrVisInfo = calloc(count, sizeof(XdbeScreenVisualInfo)))) {
free(pDrawables);
return BadAlloc;
@@ -692,22 +643,20 @@ ProcDbeGetVisualInfo(ClientPtr client)
length = 0;
- for (i = 0; i < count; i++)
- {
+ for (i = 0; i < count; i++) {
pScreen = (stuff->n == 0) ? screenInfo.screens[i] :
- pDrawables[i]->pScreen;
+ pDrawables[i]->pScreen;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
- rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
+ rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
if (rc != Success)
goto freeScrVisInfo;
- if (!(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
- {
+ if (!(*pDbeScreenPriv->GetVisualInfo) (pScreen, &pScrVisInfo[i])) {
/* We failed to alloc pScrVisInfo[i].visinfo. */
rc = BadAlloc;
- /* Free visinfos that we allocated for previous screen infos.*/
+ /* Free visinfos that we allocated for previous screen infos. */
goto freeScrVisInfo;
}
@@ -718,53 +667,48 @@ ProcDbeGetVisualInfo(ClientPtr client)
length += pScrVisInfo[i].count * sizeof(xDbeVisInfo);
}
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = bytes_to_int32(length);
- rep.m = count;
+ rep.length = bytes_to_int32(length);
+ rep.m = count;
- if (client->swapped)
- {
+ if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.m);
}
/* Send off reply. */
- WriteToClient(client, sizeof(xDbeGetVisualInfoReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDbeGetVisualInfoReply), (char *) &rep);
- for (i = 0; i < count; i++)
- {
- CARD32 data32;
+ for (i = 0; i < count; i++) {
+ CARD32 data32;
/* For each screen in the reply, send off the visual info */
/* Send off number of visuals. */
- data32 = (CARD32)pScrVisInfo[i].count;
+ data32 = (CARD32) pScrVisInfo[i].count;
- if (client->swapped)
- {
+ if (client->swapped) {
swapl(&data32);
}
- WriteToClient(client, sizeof(CARD32), (char *)&data32);
+ WriteToClient(client, sizeof(CARD32), (char *) &data32);
/* Now send off visual info items. */
- for (j = 0; j < pScrVisInfo[i].count; j++)
- {
- xDbeVisInfo visInfo;
+ for (j = 0; j < pScrVisInfo[i].count; j++) {
+ xDbeVisInfo visInfo;
/* Copy the data in the client data structure to a protocol
* data structure. We will send data to the client from the
* protocol data structure.
*/
- visInfo.visualID = (CARD32)pScrVisInfo[i].visinfo[j].visual;
- visInfo.depth = (CARD8) pScrVisInfo[i].visinfo[j].depth;
+ visInfo.visualID = (CARD32) pScrVisInfo[i].visinfo[j].visual;
+ visInfo.depth = (CARD8) pScrVisInfo[i].visinfo[j].depth;
visInfo.perfLevel = (CARD8) pScrVisInfo[i].visinfo[j].perflevel;
- if (client->swapped)
- {
+ if (client->swapped) {
swapl(&visInfo.visualID);
/* We do not need to swap depth and perfLevel since they are
@@ -773,16 +717,16 @@ ProcDbeGetVisualInfo(ClientPtr client)
}
/* Write visualID(32), depth(8), perfLevel(8), and pad(16). */
- WriteToClient(client, 2*sizeof(CARD32), (char *)&visInfo.visualID);
+ WriteToClient(client, 2 * sizeof(CARD32),
+ (char *) &visInfo.visualID);
}
}
rc = Success;
- freeScrVisInfo:
+ freeScrVisInfo:
/* Clean up memory. */
- for (i = 0; i < count; i++)
- {
+ for (i = 0; i < count; i++) {
free(pScrVisInfo[i].visinfo);
}
free(pScrVisInfo);
@@ -791,8 +735,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
return rc;
-} /* ProcDbeGetVisualInfo() */
-
+} /* ProcDbeGetVisualInfo() */
/******************************************************************************
*
@@ -813,42 +756,37 @@ static int
ProcDbeGetBackBufferAttributes(ClientPtr client)
{
REQUEST(xDbeGetBackBufferAttributesReq);
- xDbeGetBackBufferAttributesReply rep;
- DbeWindowPrivPtr pDbeWindowPriv;
- int rc;
-
+ xDbeGetBackBufferAttributesReply rep;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ int rc;
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
- rc = dixLookupResourceByType((pointer *)&pDbeWindowPriv, stuff->buffer,
- dbeWindowPrivResType, client,
- DixGetAttrAccess);
- if (rc == Success)
- {
+ rc = dixLookupResourceByType((pointer *) &pDbeWindowPriv, stuff->buffer,
+ dbeWindowPrivResType, client,
+ DixGetAttrAccess);
+ if (rc == Success) {
rep.attributes = pDbeWindowPriv->pWindow->drawable.id;
}
- else
- {
+ else {
rep.attributes = None;
}
-
- rep.type = X_Reply;
+
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
-
- if (client->swapped)
- {
+ rep.length = 0;
+
+ if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.attributes);
}
WriteToClient(client, sizeof(xDbeGetBackBufferAttributesReply),
- (char *)&rep);
+ (char *) &rep);
return Success;
-} /* ProcDbeGetbackBufferAttributes() */
-
+} /* ProcDbeGetbackBufferAttributes() */
/******************************************************************************
*
@@ -865,39 +803,36 @@ ProcDbeDispatch(ClientPtr client)
{
REQUEST(xReq);
+ switch (stuff->data) {
+ case X_DbeGetVersion:
+ return (ProcDbeGetVersion(client));
- switch (stuff->data)
- {
- case X_DbeGetVersion:
- return(ProcDbeGetVersion(client));
+ case X_DbeAllocateBackBufferName:
+ return (ProcDbeAllocateBackBufferName(client));
- case X_DbeAllocateBackBufferName:
- return(ProcDbeAllocateBackBufferName(client));
+ case X_DbeDeallocateBackBufferName:
+ return (ProcDbeDeallocateBackBufferName(client));
- case X_DbeDeallocateBackBufferName:
- return(ProcDbeDeallocateBackBufferName(client));
+ case X_DbeSwapBuffers:
+ return (ProcDbeSwapBuffers(client));
- case X_DbeSwapBuffers:
- return(ProcDbeSwapBuffers(client));
+ case X_DbeBeginIdiom:
+ return (ProcDbeBeginIdiom(client));
- case X_DbeBeginIdiom:
- return(ProcDbeBeginIdiom(client));
-
- case X_DbeEndIdiom:
- return Success;
+ case X_DbeEndIdiom:
+ return Success;
- case X_DbeGetVisualInfo:
- return(ProcDbeGetVisualInfo(client));
+ case X_DbeGetVisualInfo:
+ return (ProcDbeGetVisualInfo(client));
- case X_DbeGetBackBufferAttributes:
- return(ProcDbeGetBackBufferAttributes(client));
+ case X_DbeGetBackBufferAttributes:
+ return (ProcDbeGetBackBufferAttributes(client));
- default:
- return BadRequest;
+ default:
+ return BadRequest;
}
-} /* ProcDbeDispatch() */
-
+} /* ProcDbeDispatch() */
/******************************************************************************
*
@@ -921,10 +856,9 @@ SProcDbeGetVersion(ClientPtr client)
REQUEST(xDbeGetVersionReq);
swaps(&stuff->length);
- return(ProcDbeGetVersion(client));
-
-} /* SProcDbeGetVersion() */
+ return (ProcDbeGetVersion(client));
+} /* SProcDbeGetVersion() */
/******************************************************************************
*
@@ -961,10 +895,9 @@ SProcDbeAllocateBackBufferName(ClientPtr client)
swapl(&stuff->buffer);
/* stuff->swapAction is a byte. We do not need to swap this field. */
- return(ProcDbeAllocateBackBufferName(client));
-
-} /* SProcDbeAllocateBackBufferName() */
+ return (ProcDbeAllocateBackBufferName(client));
+} /* SProcDbeAllocateBackBufferName() */
/******************************************************************************
*
@@ -986,17 +919,16 @@ SProcDbeAllocateBackBufferName(ClientPtr client)
static int
SProcDbeDeallocateBackBufferName(ClientPtr client)
{
- REQUEST (xDbeDeallocateBackBufferNameReq);
+ REQUEST(xDbeDeallocateBackBufferNameReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq);
swapl(&stuff->buffer);
- return(ProcDbeDeallocateBackBufferName(client));
-
-} /* SProcDbeDeallocateBackBufferName() */
+ return (ProcDbeDeallocateBackBufferName(client));
+} /* SProcDbeDeallocateBackBufferName() */
/******************************************************************************
*
@@ -1023,33 +955,29 @@ static int
SProcDbeSwapBuffers(ClientPtr client)
{
REQUEST(xDbeSwapBuffersReq);
- register int i;
- xDbeSwapInfo *pSwapInfo;
-
+ register int i;
+ xDbeSwapInfo *pSwapInfo;
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq);
swapl(&stuff->n);
- if (stuff->n != 0)
- {
- pSwapInfo = (xDbeSwapInfo *)stuff+1;
+ if (stuff->n != 0) {
+ pSwapInfo = (xDbeSwapInfo *) stuff + 1;
/* The swap info following the fix part of this request is a window(32)
* followed by a 1 byte swap action and then 3 pad bytes. We only need
* to swap the window information.
*/
- for (i = 0; i < stuff->n; i++)
- {
+ for (i = 0; i < stuff->n; i++) {
swapl(&pSwapInfo->window);
}
}
- return(ProcDbeSwapBuffers(client));
-
-} /* SProcDbeSwapBuffers() */
+ return (ProcDbeSwapBuffers(client));
+} /* SProcDbeSwapBuffers() */
/******************************************************************************
*
@@ -1073,10 +1001,9 @@ SProcDbeBeginIdiom(ClientPtr client)
REQUEST(xDbeBeginIdiomReq);
swaps(&stuff->length);
- return(ProcDbeBeginIdiom(client));
-
-} /* SProcDbeBeginIdiom() */
+ return (ProcDbeBeginIdiom(client));
+} /* SProcDbeBeginIdiom() */
/******************************************************************************
*
@@ -1106,10 +1033,9 @@ SProcDbeGetVisualInfo(ClientPtr client)
swapl(&stuff->n);
SwapRestL(stuff);
- return(ProcDbeGetVisualInfo(client));
-
-} /* SProcDbeGetVisualInfo() */
+ return (ProcDbeGetVisualInfo(client));
+} /* SProcDbeGetVisualInfo() */
/******************************************************************************
*
@@ -1130,17 +1056,16 @@ SProcDbeGetVisualInfo(ClientPtr client)
static int
SProcDbeGetBackBufferAttributes(ClientPtr client)
{
- REQUEST (xDbeGetBackBufferAttributesReq);
+ REQUEST(xDbeGetBackBufferAttributesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
swapl(&stuff->buffer);
- return(ProcDbeGetBackBufferAttributes(client));
-
-} /* SProcDbeGetBackBufferAttributes() */
+ return (ProcDbeGetBackBufferAttributes(client));
+} /* SProcDbeGetBackBufferAttributes() */
/******************************************************************************
*
@@ -1157,39 +1082,36 @@ SProcDbeDispatch(ClientPtr client)
{
REQUEST(xReq);
+ switch (stuff->data) {
+ case X_DbeGetVersion:
+ return (SProcDbeGetVersion(client));
- switch (stuff->data)
- {
- case X_DbeGetVersion:
- return(SProcDbeGetVersion(client));
+ case X_DbeAllocateBackBufferName:
+ return (SProcDbeAllocateBackBufferName(client));
- case X_DbeAllocateBackBufferName:
- return(SProcDbeAllocateBackBufferName(client));
+ case X_DbeDeallocateBackBufferName:
+ return (SProcDbeDeallocateBackBufferName(client));
- case X_DbeDeallocateBackBufferName:
- return(SProcDbeDeallocateBackBufferName(client));
+ case X_DbeSwapBuffers:
+ return (SProcDbeSwapBuffers(client));
- case X_DbeSwapBuffers:
- return(SProcDbeSwapBuffers(client));
+ case X_DbeBeginIdiom:
+ return (SProcDbeBeginIdiom(client));
- case X_DbeBeginIdiom:
- return(SProcDbeBeginIdiom(client));
-
- case X_DbeEndIdiom:
- return Success;
+ case X_DbeEndIdiom:
+ return Success;
- case X_DbeGetVisualInfo:
- return(SProcDbeGetVisualInfo(client));
+ case X_DbeGetVisualInfo:
+ return (SProcDbeGetVisualInfo(client));
- case X_DbeGetBackBufferAttributes:
- return(SProcDbeGetBackBufferAttributes(client));
+ case X_DbeGetBackBufferAttributes:
+ return (SProcDbeGetBackBufferAttributes(client));
- default:
- return BadRequest;
+ default:
+ return BadRequest;
}
-} /* SProcDbeDispatch() */
-
+} /* SProcDbeDispatch() */
/******************************************************************************
*
@@ -1209,12 +1131,11 @@ SProcDbeDispatch(ClientPtr client)
static Bool
DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
{
- ChangeGCVal gcvalues[4];
- int ts_x_origin, ts_y_origin;
- PixUnion background;
- int backgroundState;
- Mask gcmask;
-
+ ChangeGCVal gcvalues[4];
+ int ts_x_origin, ts_y_origin;
+ PixUnion background;
+ int backgroundState;
+ Mask gcmask;
/* First take care of any ParentRelative stuff by altering the
* tile/stipple origin to match the coordinates of the upper-left
@@ -1222,40 +1143,37 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
* This coordinate is, of course, negative.
*/
ts_x_origin = ts_y_origin = 0;
- while (pWin->backgroundState == ParentRelative)
- {
+ while (pWin->backgroundState == ParentRelative) {
ts_x_origin -= pWin->origin.x;
ts_y_origin -= pWin->origin.y;
pWin = pWin->parent;
}
backgroundState = pWin->backgroundState;
- background = pWin->background;
-
- switch (backgroundState)
- {
- case BackgroundPixel:
- gcvalues[0].val = background.pixel;
- gcvalues[1].val = FillSolid;
- gcmask = GCForeground|GCFillStyle;
- break;
-
- case BackgroundPixmap:
- gcvalues[0].val = FillTiled;
- gcvalues[1].ptr = background.pixmap;
- gcvalues[2].val = ts_x_origin;
- gcvalues[3].val = ts_y_origin;
- gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
- break;
-
- default:
- /* pWin->backgroundState == None */
- return FALSE;
+ background = pWin->background;
+
+ switch (backgroundState) {
+ case BackgroundPixel:
+ gcvalues[0].val = background.pixel;
+ gcvalues[1].val = FillSolid;
+ gcmask = GCForeground | GCFillStyle;
+ break;
+
+ case BackgroundPixmap:
+ gcvalues[0].val = FillTiled;
+ gcvalues[1].ptr = background.pixmap;
+ gcvalues[2].val = ts_x_origin;
+ gcvalues[3].val = ts_y_origin;
+ gcmask = GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
+ break;
+
+ default:
+ /* pWin->backgroundState == None */
+ return FALSE;
}
return ChangeGC(NullClient, pGC, gcmask, gcvalues) == 0;
-} /* DbeSetupBackgroundPainter() */
-
+} /* DbeSetupBackgroundPainter() */
/******************************************************************************
*
@@ -1278,8 +1196,7 @@ DbeDrawableDelete(pointer pDrawable, XID id)
{
return Success;
-} /* DbeDrawableDelete() */
-
+} /* DbeDrawableDelete() */
/******************************************************************************
*
@@ -1295,10 +1212,9 @@ DbeDrawableDelete(pointer pDrawable, XID id)
static int
DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
{
- DbeScreenPrivPtr pDbeScreenPriv;
- DbeWindowPrivPtr pDbeWindowPriv = (DbeWindowPrivPtr)pDbeWinPriv;
- int i;
-
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeWindowPrivPtr pDbeWindowPriv = (DbeWindowPrivPtr) pDbeWinPriv;
+ int i;
/*
**************************************************************************
@@ -1308,27 +1224,23 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
/* Find the ID in the ID array. */
i = 0;
- while ((i < pDbeWindowPriv->nBufferIDs) && (pDbeWindowPriv->IDs[i] != id))
- {
+ while ((i < pDbeWindowPriv->nBufferIDs) && (pDbeWindowPriv->IDs[i] != id)) {
i++;
}
- if (i == pDbeWindowPriv->nBufferIDs)
- {
+ if (i == pDbeWindowPriv->nBufferIDs) {
/* We did not find the ID in the array. We should never get here. */
return BadValue;
}
/* Remove the ID from the array. */
- if (i < (pDbeWindowPriv->nBufferIDs - 1))
- {
+ if (i < (pDbeWindowPriv->nBufferIDs - 1)) {
/* Compress the buffer ID array, overwriting the ID in the process. */
- memmove(&pDbeWindowPriv->IDs[i], &pDbeWindowPriv->IDs[i+1],
- (pDbeWindowPriv->nBufferIDs - i - 1) * sizeof(XID));
+ memmove(&pDbeWindowPriv->IDs[i], &pDbeWindowPriv->IDs[i + 1],
+ (pDbeWindowPriv->nBufferIDs - i - 1) * sizeof(XID));
}
- else
- {
+ else {
/* We are removing the last ID in the array, in which case, the
* assignement below is all that we need to do.
*/
@@ -1341,9 +1253,8 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
* buffer IDs will fit in the static array.
*/
- if ((pDbeWindowPriv->maxAvailableIDs > DBE_INIT_MAX_IDS) &&
- (pDbeWindowPriv->nBufferIDs == DBE_INIT_MAX_IDS))
- {
+ if ((pDbeWindowPriv->maxAvailableIDs > DBE_INIT_MAX_IDS) &&
+ (pDbeWindowPriv->nBufferIDs == DBE_INIT_MAX_IDS)) {
/* Copy the IDs back into the static array. */
memcpy(pDbeWindowPriv->initIDs, pDbeWindowPriv->IDs,
DBE_INIT_MAX_IDS * sizeof(XID));
@@ -1354,17 +1265,15 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
}
-
/*
**************************************************************************
** Perform DDX level tasks.
**************************************************************************
*/
- pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(
- (DbeWindowPrivPtr)pDbeWindowPriv);
- (*pDbeScreenPriv->WinPrivDelete)((DbeWindowPrivPtr)pDbeWindowPriv, id);
-
+ pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW_PRIV((DbeWindowPrivPtr)
+ pDbeWindowPriv);
+ (*pDbeScreenPriv->WinPrivDelete) ((DbeWindowPrivPtr) pDbeWindowPriv, id);
/*
**************************************************************************
@@ -1373,20 +1282,18 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
**************************************************************************
*/
- if (pDbeWindowPriv->nBufferIDs == 0)
- {
+ if (pDbeWindowPriv->nBufferIDs == 0) {
/* Reset the DBE window priv pointer. */
- dixSetPrivate(&pDbeWindowPriv->pWindow->devPrivates, dbeWindowPrivKey,
- NULL);
+ dixSetPrivate(&pDbeWindowPriv->pWindow->devPrivates, dbeWindowPrivKey,
+ NULL);
/* We are done with the window priv. */
- dixFreeObjectWithPrivates(pDbeWindowPriv, PRIVATE_DBE_WINDOW);
+ dixFreeObjectWithPrivates(pDbeWindowPriv, PRIVATE_DBE_WINDOW);
}
return Success;
-} /* DbeWindowPrivDelete() */
-
+} /* DbeWindowPrivDelete() */
/******************************************************************************
*
@@ -1400,30 +1307,27 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
*
*****************************************************************************/
static void
-DbeResetProc(ExtensionEntry *extEntry)
+DbeResetProc(ExtensionEntry * extEntry)
{
- int i;
- ScreenPtr pScreen;
- DbeScreenPrivPtr pDbeScreenPriv;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
-
- if (pDbeScreenPriv)
- {
- /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit().*/
+ int i;
+ ScreenPtr pScreen;
+ DbeScreenPrivPtr pDbeScreenPriv;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ if (pDbeScreenPriv) {
+ /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
- if (pDbeScreenPriv->ResetProc)
- (*pDbeScreenPriv->ResetProc)(pScreen);
+ if (pDbeScreenPriv->ResetProc)
+ (*pDbeScreenPriv->ResetProc) (pScreen);
- free(pDbeScreenPriv);
- }
+ free(pDbeScreenPriv);
+ }
}
-} /* DbeResetProc() */
-
+} /* DbeResetProc() */
/******************************************************************************
*
@@ -1440,11 +1344,10 @@ DbeResetProc(ExtensionEntry *extEntry)
static Bool
DbeDestroyWindow(WindowPtr pWin)
{
- DbeScreenPrivPtr pDbeScreenPriv;
- DbeWindowPrivPtr pDbeWindowPriv;
- ScreenPtr pScreen;
- Bool ret;
-
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ ScreenPtr pScreen;
+ Bool ret;
/*
**************************************************************************
@@ -1452,8 +1355,8 @@ DbeDestroyWindow(WindowPtr pWin)
**************************************************************************
*/
- pScreen = pWin->drawable.pScreen;
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+ pScreen = pWin->drawable.pScreen;
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
/*
@@ -1465,10 +1368,8 @@ DbeDestroyWindow(WindowPtr pWin)
**************************************************************************
*/
- if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
- {
- while (pDbeWindowPriv)
- {
+ if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
+ while (pDbeWindowPriv) {
/* *DbeWinPrivDelete() will free the window private and set it to
* NULL if there are no more buffer IDs associated with this
* window.
@@ -1484,7 +1385,7 @@ DbeDestroyWindow(WindowPtr pWin)
**************************************************************************
*/
- ret = (*pScreen->DestroyWindow)(pWin);
+ ret = (*pScreen->DestroyWindow) (pWin);
/*
**************************************************************************
@@ -1506,8 +1407,7 @@ DbeDestroyWindow(WindowPtr pWin)
return ret;
-} /* DbeDestroyWindow() */
-
+} /* DbeDestroyWindow() */
/******************************************************************************
*
@@ -1522,67 +1422,65 @@ DbeDestroyWindow(WindowPtr pWin)
void
DbeExtensionInit(void)
{
- ExtensionEntry *extEntry;
- register int i, j;
- ScreenPtr pScreen = NULL;
- DbeScreenPrivPtr pDbeScreenPriv;
- int nStubbedScreens = 0;
- Bool ddxInitSuccess;
+ ExtensionEntry *extEntry;
+ register int i, j;
+ ScreenPtr pScreen = NULL;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ int nStubbedScreens = 0;
+ Bool ddxInitSuccess;
#ifdef PANORAMIX
- if(!noPanoramiXExtension) return;
+ if (!noPanoramiXExtension)
+ return;
#endif
/* Create the resource types. */
dbeDrawableResType =
CreateNewResourceType(DbeDrawableDelete, "dbeDrawable");
if (!dbeDrawableResType)
- return;
+ return;
dbeDrawableResType |= RC_DRAWABLE;
dbeWindowPrivResType =
CreateNewResourceType(DbeWindowPrivDelete, "dbeWindow");
if (!dbeWindowPrivResType)
- return;
+ return;
if (!dixRegisterPrivateKey(&dbeScreenPrivKeyRec, PRIVATE_SCREEN, 0))
- return;
+ return;
if (!dixRegisterPrivateKey(&dbeWindowPrivKeyRec, PRIVATE_WINDOW, 0))
- return;
+ return;
- for (i = 0; i < screenInfo.numScreens; i++)
- {
+ for (i = 0; i < screenInfo.numScreens; i++) {
/* For each screen, set up DBE screen privates and init DIX and DDX
* interface.
*/
- pScreen = screenInfo.screens[i];
+ pScreen = screenInfo.screens[i];
- if (!(pDbeScreenPriv = malloc (sizeof (DbeScreenPrivRec))))
- {
+ if (!(pDbeScreenPriv = malloc(sizeof(DbeScreenPrivRec)))) {
/* If we can not alloc a window or screen private,
* then free any privates that we already alloc'ed and return
*/
- for (j = 0; j < i; j++)
- {
- free(dixLookupPrivate(&screenInfo.screens[j]->devPrivates,
- dbeScreenPrivKey));
- dixSetPrivate(&screenInfo.screens[j]->devPrivates,
- dbeScreenPrivKey, NULL);
- }
- return;
- }
+ for (j = 0; j < i; j++) {
+ free(dixLookupPrivate(&screenInfo.screens[j]->devPrivates,
+ dbeScreenPrivKey));
+ dixSetPrivate(&screenInfo.screens[j]->devPrivates,
+ dbeScreenPrivKey, NULL);
+ }
+ return;
+ }
- dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, pDbeScreenPriv);
+ dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, pDbeScreenPriv);
{
/* We don't have DDX support for DBE anymore */
#ifndef DISABLE_MI_DBE_BY_DEFAULT
/* Setup DIX. */
- pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter;
+ pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter;
/* Setup DDX. */
ddxInitSuccess = miDbeInit(pScreen, pDbeScreenPriv);
@@ -1592,17 +1490,15 @@ DbeExtensionInit(void)
*/
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
- if (ddxInitSuccess)
- {
+ if (ddxInitSuccess) {
/* Wrap DestroyWindow. The DDX initialization function
* already wrapped PositionWindow for us.
*/
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
- pScreen->DestroyWindow = DbeDestroyWindow;
+ pScreen->DestroyWindow = DbeDestroyWindow;
}
- else
- {
+ else {
/* DDX initialization failed. Stub the screen. */
DbeStubScreen(pDbeScreenPriv, &nStubbedScreens);
}
@@ -1612,31 +1508,27 @@ DbeExtensionInit(void)
}
- } /* for (i = 0; i < screenInfo.numScreens; i++) */
-
+ } /* for (i = 0; i < screenInfo.numScreens; i++) */
- if (nStubbedScreens == screenInfo.numScreens)
- {
- /* All screens stubbed. Clean up and return. */
+ if (nStubbedScreens == screenInfo.numScreens) {
+ /* All screens stubbed. Clean up and return. */
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- free(dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
- dbeScreenPrivKey));
- dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL);
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ free(dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
+ dbeScreenPrivKey));
+ dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL);
}
return;
}
-
/* Now add the extension. */
- extEntry = AddExtension(DBE_PROTOCOL_NAME, DbeNumberEvents,
+ extEntry = AddExtension(DBE_PROTOCOL_NAME, DbeNumberEvents,
DbeNumberErrors, ProcDbeDispatch, SProcDbeDispatch,
DbeResetProc, StandardMinorOpcode);
dbeErrorBase = extEntry->errorBase;
- SetResourceTypeErrorValue(dbeWindowPrivResType, dbeErrorBase + DbeBadBuffer);
+ SetResourceTypeErrorValue(dbeWindowPrivResType,
+ dbeErrorBase + DbeBadBuffer);
SetResourceTypeErrorValue(dbeDrawableResType, dbeErrorBase + DbeBadBuffer);
-} /* DbeExtensionInit() */
-
+} /* DbeExtensionInit() */
diff --git a/xorg-server/dbe/dbestruct.h b/xorg-server/dbe/dbestruct.h
index 089719ba7..9ea9eb695 100644
--- a/xorg-server/dbe/dbestruct.h
+++ b/xorg-server/dbe/dbestruct.h
@@ -1,214 +1,197 @@
-/******************************************************************************
- *
- * Copyright (c) 1994, 1995 Hewlett-Packard Company
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the Hewlett-Packard
- * Company shall not be used in advertising or otherwise to promote the
- * sale, use or other dealings in this Software without prior written
- * authorization from the Hewlett-Packard Company.
- *
- * Header file for DIX-related DBE
- *
- *****************************************************************************/
-
-#ifndef DBE_STRUCT_H
-#define DBE_STRUCT_H
-
-
-/* INCLUDES */
-
-#define NEED_DBE_PROTOCOL
-#include <X11/extensions/dbeproto.h>
-#include "windowstr.h"
-#include "privates.h"
-
-typedef struct
-{
- VisualID visual; /* one visual ID that supports double-buffering */
- int depth; /* depth of visual in bits */
- int perflevel; /* performance level of visual */
-}
-XdbeVisualInfo;
-
-typedef struct
-{
- int count; /* number of items in visual_depth */
- XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
-}
-XdbeScreenVisualInfo;
-
-/* DEFINES */
-
-#define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey))
-
-#define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
- DBE_SCREEN_PRIV((pDrawable)->pScreen)
-
-#define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
- DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
-
-#define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
- DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
-
-#define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
- DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
-
-#define DBE_SCREEN_PRIV_FROM_GC(pGC)\
- DBE_SCREEN_PRIV((pGC)->pScreen)
-
-#define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \
- dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey))
-
-/* Initial size of the buffer ID array in the window priv. */
-#define DBE_INIT_MAX_IDS 2
-
-/* Reallocation increment for the buffer ID array. */
-#define DBE_INCR_MAX_IDS 4
-
-/* Marker for free elements in the buffer ID array. */
-#define DBE_FREE_ID_ELEMENT 0
-
-extern _X_EXPORT void DbeExtensionInit (void);
-
-/* TYPEDEFS */
-
-/* Record used to pass swap information between DIX and DDX swapping
- * procedures.
- */
-typedef struct _DbeSwapInfoRec
-{
- WindowPtr pWindow;
- unsigned char swapAction;
-
-} DbeSwapInfoRec, *DbeSwapInfoPtr;
-
-/*
- ******************************************************************************
- ** Per-window data
- ******************************************************************************
- */
-
-typedef struct _DbeWindowPrivRec
-{
- /* A pointer to the window with which the DBE window private (buffer) is
- * associated.
- */
- WindowPtr pWindow;
-
- /* Last known swap action for this buffer. Legal values for this field
- * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
- */
- unsigned char swapAction;
-
- /* Last known buffer size.
- */
- unsigned short width, height;
-
- /* Coordinates used for static gravity when the window is positioned.
- */
- short x, y;
-
- /* Number of XIDs associated with this buffer.
- */
- int nBufferIDs;
-
- /* Capacity of the current buffer ID array, IDs. */
- int maxAvailableIDs;
-
- /* Pointer to the array of buffer IDs. This initially points to initIDs.
- * When the static limit of the initIDs array is reached, the array is
- * reallocated and this pointer is set to the new array instead of initIDs.
- */
- XID *IDs;
-
- /* Initial array of buffer IDs. We are defining the XID array within the
- * window priv to optimize for data locality. In most cases, only one
- * buffer will be associated with a window. Having the array declared
- * here can prevent us from accessing the data in another memory page,
- * possibly resulting in a page swap and loss of performance. Initially we
- * will use this array to store buffer IDs. For situations where we have
- * more IDs than can fit in this static array, we will allocate a larger
- * array to use, possibly suffering a performance loss.
- */
- XID initIDs[DBE_INIT_MAX_IDS];
-
- /* Device-specific private information.
- */
- PrivateRec *devPrivates;
-
-} DbeWindowPrivRec, *DbeWindowPrivPtr;
-
-
-/*
- ******************************************************************************
- ** Per-screen data
- ******************************************************************************
- */
-
-typedef struct _DbeScreenPrivRec
-{
- /* Wrapped functions
- * It is the responsibilty of the DDX layer to wrap PositionWindow().
- * DbeExtensionInit wraps DestroyWindow().
- */
- PositionWindowProcPtr PositionWindow;
- DestroyWindowProcPtr DestroyWindow;
-
- /* Per-screen DIX routines */
- Bool (*SetupBackgroundPainter)(
- WindowPtr /*pWin*/,
- GCPtr /*pGC*/
-);
-
- /* Per-screen DDX routines */
- Bool (*GetVisualInfo)(
- ScreenPtr /*pScreen*/,
- XdbeScreenVisualInfo * /*pVisInfo*/
-);
- int (*AllocBackBufferName)(
- WindowPtr /*pWin*/,
- XID /*bufId*/,
- int /*swapAction*/
-);
- int (*SwapBuffers)(
- ClientPtr /*client*/,
- int * /*pNumWindows*/,
- DbeSwapInfoPtr /*swapInfo*/
-);
- void (*BeginIdiom)(
- ClientPtr /*client*/
-);
- void (*EndIdiom)(
- ClientPtr /*client*/
-);
- void (*WinPrivDelete)(
- DbeWindowPrivPtr /*pDbeWindowPriv*/,
- XID /*bufId*/
-);
- void (*ResetProc)(
- ScreenPtr /*pScreen*/
-);
-
-} DbeScreenPrivRec, *DbeScreenPrivPtr;
-
-#endif /* DBE_STRUCT_H */
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ * Header file for DIX-related DBE
+ *
+ *****************************************************************************/
+
+#ifndef DBE_STRUCT_H
+#define DBE_STRUCT_H
+
+/* INCLUDES */
+
+#define NEED_DBE_PROTOCOL
+#include <X11/extensions/dbeproto.h>
+#include "windowstr.h"
+#include "privates.h"
+
+typedef struct {
+ VisualID visual; /* one visual ID that supports double-buffering */
+ int depth; /* depth of visual in bits */
+ int perflevel; /* performance level of visual */
+} XdbeVisualInfo;
+
+typedef struct {
+ int count; /* number of items in visual_depth */
+ XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
+} XdbeScreenVisualInfo;
+
+/* DEFINES */
+
+#define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey))
+
+#define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
+ DBE_SCREEN_PRIV((pDrawable)->pScreen)
+
+#define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
+ DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
+
+#define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
+ DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
+
+#define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
+ DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
+
+#define DBE_SCREEN_PRIV_FROM_GC(pGC)\
+ DBE_SCREEN_PRIV((pGC)->pScreen)
+
+#define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey))
+
+/* Initial size of the buffer ID array in the window priv. */
+#define DBE_INIT_MAX_IDS 2
+
+/* Reallocation increment for the buffer ID array. */
+#define DBE_INCR_MAX_IDS 4
+
+/* Marker for free elements in the buffer ID array. */
+#define DBE_FREE_ID_ELEMENT 0
+
+extern _X_EXPORT void DbeExtensionInit(void);
+
+/* TYPEDEFS */
+
+/* Record used to pass swap information between DIX and DDX swapping
+ * procedures.
+ */
+typedef struct _DbeSwapInfoRec {
+ WindowPtr pWindow;
+ unsigned char swapAction;
+
+} DbeSwapInfoRec, *DbeSwapInfoPtr;
+
+/*
+ ******************************************************************************
+ ** Per-window data
+ ******************************************************************************
+ */
+
+typedef struct _DbeWindowPrivRec {
+ /* A pointer to the window with which the DBE window private (buffer) is
+ * associated.
+ */
+ WindowPtr pWindow;
+
+ /* Last known swap action for this buffer. Legal values for this field
+ * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
+ */
+ unsigned char swapAction;
+
+ /* Last known buffer size.
+ */
+ unsigned short width, height;
+
+ /* Coordinates used for static gravity when the window is positioned.
+ */
+ short x, y;
+
+ /* Number of XIDs associated with this buffer.
+ */
+ int nBufferIDs;
+
+ /* Capacity of the current buffer ID array, IDs. */
+ int maxAvailableIDs;
+
+ /* Pointer to the array of buffer IDs. This initially points to initIDs.
+ * When the static limit of the initIDs array is reached, the array is
+ * reallocated and this pointer is set to the new array instead of initIDs.
+ */
+ XID *IDs;
+
+ /* Initial array of buffer IDs. We are defining the XID array within the
+ * window priv to optimize for data locality. In most cases, only one
+ * buffer will be associated with a window. Having the array declared
+ * here can prevent us from accessing the data in another memory page,
+ * possibly resulting in a page swap and loss of performance. Initially we
+ * will use this array to store buffer IDs. For situations where we have
+ * more IDs than can fit in this static array, we will allocate a larger
+ * array to use, possibly suffering a performance loss.
+ */
+ XID initIDs[DBE_INIT_MAX_IDS];
+
+ /* Device-specific private information.
+ */
+ PrivateRec *devPrivates;
+
+} DbeWindowPrivRec, *DbeWindowPrivPtr;
+
+/*
+ ******************************************************************************
+ ** Per-screen data
+ ******************************************************************************
+ */
+
+typedef struct _DbeScreenPrivRec {
+ /* Wrapped functions
+ * It is the responsibilty of the DDX layer to wrap PositionWindow().
+ * DbeExtensionInit wraps DestroyWindow().
+ */
+ PositionWindowProcPtr PositionWindow;
+ DestroyWindowProcPtr DestroyWindow;
+
+ /* Per-screen DIX routines */
+ Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
+ GCPtr /*pGC */
+ );
+
+ /* Per-screen DDX routines */
+ Bool (*GetVisualInfo) (ScreenPtr /*pScreen */ ,
+ XdbeScreenVisualInfo * /*pVisInfo */
+ );
+ int (*AllocBackBufferName) (WindowPtr /*pWin */ ,
+ XID /*bufId */ ,
+ int /*swapAction */
+ );
+ int (*SwapBuffers) (ClientPtr /*client */ ,
+ int * /*pNumWindows */ ,
+ DbeSwapInfoPtr /*swapInfo */
+ );
+ void (*BeginIdiom) (ClientPtr /*client */
+ );
+ void (*EndIdiom) (ClientPtr /*client */
+ );
+ void (*WinPrivDelete) (DbeWindowPrivPtr /*pDbeWindowPriv */ ,
+ XID /*bufId */
+ );
+ void (*ResetProc) (ScreenPtr /*pScreen */
+ );
+
+} DbeScreenPrivRec, *DbeScreenPrivPtr;
+
+#endif /* DBE_STRUCT_H */
diff --git a/xorg-server/dbe/midbe.c b/xorg-server/dbe/midbe.c
index 76d2e00aa..d810d992e 100644
--- a/xorg-server/dbe/midbe.c
+++ b/xorg-server/dbe/midbe.c
@@ -1,797 +1,739 @@
-/******************************************************************************
- *
- * Copyright (c) 1994, 1995 Hewlett-Packard Company
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the Hewlett-Packard
- * Company shall not be used in advertising or otherwise to promote the
- * sale, use or other dealings in this Software without prior written
- * authorization from the Hewlett-Packard Company.
- *
- * Machine-independent DBE code
- *
- *****************************************************************************/
-
-
-/* INCLUDES */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "opaque.h"
-#include "dbestruct.h"
-#include "midbestr.h"
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "inputstr.h"
-#include "midbe.h"
-#include "xace.h"
-
-#include <stdio.h>
-
-static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec;
-#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec)
-
-
-/******************************************************************************
- *
- * DBE MI Procedure: miDbeGetVisualInfo
- *
- * Description:
- *
- * This is the MI function for the DbeGetVisualInfo request. This function
- * is called through pDbeScreenPriv->GetVisualInfo. This function is also
- * called for the DbeAllocateBackBufferName request at the extension level;
- * it is called by ProcDbeAllocateBackBufferName() in dbe.c.
- *
- * If memory allocation fails or we can not get the visual info, this
- * function returns FALSE. Otherwise, it returns TRUE for success.
- *
- *****************************************************************************/
-
-static Bool
-miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo)
-{
- register int i, j, k;
- register int count;
- DepthPtr pDepth;
- XdbeVisualInfo *visInfo;
-
-
- /* Determine number of visuals for this screen. */
- for (i = 0, count = 0; i < pScreen->numDepths; i++)
- {
- count += pScreen->allowedDepths[i].numVids;
- }
-
- /* Allocate an array of XdbeVisualInfo items. */
- if (!(visInfo = (XdbeVisualInfo *)malloc(count * sizeof(XdbeVisualInfo))))
- {
- return FALSE; /* memory alloc failure */
- }
-
- for (i = 0, k = 0; i < pScreen->numDepths; i++)
- {
- /* For each depth of this screen, get visual information. */
-
- pDepth = &pScreen->allowedDepths[i];
-
- for (j = 0; j < pDepth->numVids; j++)
- {
- /* For each visual for this depth of this screen, get visual ID
- * and visual depth. Since this is MI code, we will always return
- * the same performance level for all visuals (0). A higher
- * performance level value indicates higher performance.
- */
- visInfo[k].visual = pDepth->vids[j];
- visInfo[k].depth = pDepth->depth;
- visInfo[k].perflevel = 0;
- k++;
- }
- }
-
- /* Record the number of visuals and point visual_depth to
- * the array of visual info.
- */
- pScrVisInfo->count = count;
- pScrVisInfo->visinfo = visInfo;
-
- return TRUE; /* success */
-
-} /* miDbeGetVisualInfo() */
-
-
-/******************************************************************************
- *
- * DBE MI Procedure: miAllocBackBufferName
- *
- * Description:
- *
- * This is the MI function for the DbeAllocateBackBufferName request.
- *
- *****************************************************************************/
-
-static int
-miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
-{
- ScreenPtr pScreen;
- DbeWindowPrivPtr pDbeWindowPriv;
- MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
- DbeScreenPrivPtr pDbeScreenPriv;
- GCPtr pGC;
- xRectangle clearRect;
- int rc;
-
-
- pScreen = pWin->drawable.pScreen;
- pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
-
- if (pDbeWindowPriv->nBufferIDs == 0)
- {
- /* There is no buffer associated with the window.
- * We have to create the window priv priv. Remember, the window
- * priv was created at the DIX level, so all we need to do is
- * create the priv priv and attach it to the priv.
- */
-
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
-
- /* Setup the window priv priv. */
- pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
- pDbeWindowPrivPriv->pDbeWindowPriv = pDbeWindowPriv;
-
- /* Get a front pixmap. */
- if (!(pDbeWindowPrivPriv->pFrontBuffer =
- (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width,
- pDbeWindowPriv->height,
- pWin->drawable.depth, 0)))
- {
- return BadAlloc;
- }
-
- /* Get a back pixmap. */
- if (!(pDbeWindowPrivPriv->pBackBuffer =
- (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width,
- pDbeWindowPriv->height,
- pWin->drawable.depth, 0)))
- {
- (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer);
- return BadAlloc;
- }
-
- /* Security creation/labeling check. */
- rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId,
- dbeDrawableResType, pDbeWindowPrivPriv->pBackBuffer,
- RT_WINDOW, pWin, DixCreateAccess);
-
- /* Make the back pixmap a DBE drawable resource. */
- if (rc != Success || !AddResource(bufId, dbeDrawableResType,
- pDbeWindowPrivPriv->pBackBuffer))
- {
- /* free the buffer and the drawable resource */
- FreeResource(bufId, RT_NONE);
- return (rc == Success) ? BadAlloc : rc;
- }
-
- /* Clear the back buffer. */
- pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
- if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
- {
- ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC);
- clearRect.x = clearRect.y = 0;
- clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
- clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
- (*pGC->ops->PolyFillRect)(
- (DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC, 1,
- &clearRect);
- }
- FreeScratchGC(pGC);
-
- } /* if no buffer associated with the window */
-
- else
- {
- /* A buffer is already associated with the window.
- * Place the new buffer ID information at the head of the ID list.
- */
-
- /* Associate the new ID with an existing pixmap. */
- pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
- if (!AddResource(bufId, dbeDrawableResType,
- (pointer)pDbeWindowPrivPriv->pBackBuffer))
- {
- return BadAlloc;
- }
-
- }
-
- return Success;
-
-} /* miDbeAllocBackBufferName() */
-
-
-/******************************************************************************
- *
- * DBE MI Procedure: miDbeAliasBuffers
- *
- * Description:
- *
- * This function associates all XIDs of a buffer with the back pixmap
- * stored in the window priv.
- *
- *****************************************************************************/
-
-static void
-miDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv)
-{
- int i;
- MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv =
- MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
-
- for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++)
- {
- ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType,
- (pointer)pDbeWindowPrivPriv->pBackBuffer);
- }
-
-} /* miDbeAliasBuffers() */
-
-
-/******************************************************************************
- *
- * DBE MI Procedure: miDbeSwapBuffers
- *
- * Description:
- *
- * This is the MI function for the DbeSwapBuffers request.
- *
- *****************************************************************************/
-
-static int
-miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
-{
- DbeScreenPrivPtr pDbeScreenPriv;
- GCPtr pGC;
- WindowPtr pWin;
- MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
- PixmapPtr pTmpBuffer;
- xRectangle clearRect;
-
-
- pWin = swapInfo[0].pWindow;
- pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
- pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin);
- pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
-
- /*
- **********************************************************************
- ** Setup before swap.
- **********************************************************************
- */
-
- switch(swapInfo[0].swapAction)
- {
- case XdbeUndefined:
- break;
-
- case XdbeBackground:
- break;
-
- case XdbeUntouched:
- ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer, pGC);
- (*pGC->ops->CopyArea)((DrawablePtr)pWin,
- (DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer,
- pGC, 0, 0, pWin->drawable.width,
- pWin->drawable.height, 0, 0);
- break;
-
- case XdbeCopied:
- break;
-
- }
-
- /*
- **********************************************************************
- ** Swap.
- **********************************************************************
- */
-
- ValidateGC((DrawablePtr)pWin, pGC);
- (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
- (DrawablePtr)pWin, pGC, 0, 0,
- pWin->drawable.width, pWin->drawable.height,
- 0, 0);
-
- /*
- **********************************************************************
- ** Tasks after swap.
- **********************************************************************
- */
-
- switch(swapInfo[0].swapAction)
- {
- case XdbeUndefined:
- break;
-
- case XdbeBackground:
- if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
- {
- ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC);
- clearRect.x = 0;
- clearRect.y = 0;
- clearRect.width =
- pDbeWindowPrivPriv->pBackBuffer->drawable.width;
- clearRect.height =
- pDbeWindowPrivPriv->pBackBuffer->drawable.height;
- (*pGC->ops->PolyFillRect)(
- (DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
- pGC, 1, &clearRect);
- }
- break;
-
- case XdbeUntouched:
- /* Swap pixmap pointers. */
- pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer;
- pDbeWindowPrivPriv->pBackBuffer =
- pDbeWindowPrivPriv->pFrontBuffer;
- pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer;
-
- miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv);
-
- break;
-
- case XdbeCopied:
- break;
-
- }
-
- /* Remove the swapped window from the swap information array and decrement
- * pNumWindows to indicate to the DIX level how many windows were actually
- * swapped.
- */
-
- if (*pNumWindows > 1)
- {
- /* We were told to swap more than one window, but we only swapped the
- * first one. Remove the first window in the list by moving the last
- * window to the beginning.
- */
- swapInfo[0].pWindow = swapInfo[*pNumWindows - 1].pWindow;
- swapInfo[0].swapAction = swapInfo[*pNumWindows - 1].swapAction;
-
- /* Clear the last window information just to be safe. */
- swapInfo[*pNumWindows - 1].pWindow = (WindowPtr)NULL;
- swapInfo[*pNumWindows - 1].swapAction = 0;
- }
- else
- {
- /* Clear the window information just to be safe. */
- swapInfo[0].pWindow = (WindowPtr)NULL;
- swapInfo[0].swapAction = 0;
- }
-
- (*pNumWindows)--;
-
- FreeScratchGC(pGC);
-
- return Success;
-
-} /* miSwapBuffers() */
-
-
-/******************************************************************************
- *
- * DBE MI Procedure: miDbeWinPrivDelete
- *
- * Description:
- *
- * This is the MI function for deleting the dbeWindowPrivResType resource.
- * This function is invoked indirectly by calling FreeResource() to free
- * the resources associated with a DBE buffer ID. There are 5 ways that
- * miDbeWinPrivDelete() can be called by FreeResource(). They are:
- *
- * - A DBE window is destroyed, in which case the DbeDestroyWindow()
- * wrapper is invoked. The wrapper calls FreeResource() for all DBE
- * buffer IDs.
- *
- * - miDbeAllocBackBufferName() calls FreeResource() to clean up resources
- * after a buffer allocation failure.
- *
- * - The PositionWindow wrapper, miDbePositionWindow(), calls
- * FreeResource() when it fails to create buffers of the new size.
- * FreeResource() is called for all DBE buffer IDs.
- *
- * - FreeClientResources() calls FreeResource() when a client dies or the
- * the server resets.
- *
- * When FreeResource() is called for a DBE buffer ID, the delete function
- * for the only other type of DBE resource, dbeDrawableResType, is also
- * invoked. This delete function (DbeDrawableDelete) is a NOOP to make
- * resource deletion easier. It is not guaranteed which delete function is
- * called first. Hence, we will let miDbeWinPrivDelete() free all DBE
- * resources.
- *
- * This function deletes/frees the following stuff associated with
- * the window private:
- *
- * - the ID node in the ID list representing the passed in ID.
- *
- * In addition, pDbeWindowPriv->nBufferIDs is decremented.
- *
- * If this function is called for the last/only buffer ID for a window,
- * these are additionally deleted/freed:
- *
- * - the front and back pixmaps
- * - the window priv itself
- *
- *****************************************************************************/
-
-static void
-miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
-{
- MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
-
-
- if (pDbeWindowPriv->nBufferIDs != 0)
- {
- /* We still have at least one more buffer ID associated with this
- * window.
- */
- return;
- }
-
-
- /* We have no more buffer IDs associated with this window. We need to
- * free some stuff.
- */
-
- pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
-
- /* Destroy the front and back pixmaps. */
- if (pDbeWindowPrivPriv->pFrontBuffer)
- {
- (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
- pDbeWindowPrivPriv->pFrontBuffer);
- }
- if (pDbeWindowPrivPriv->pBackBuffer)
- {
- (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
- pDbeWindowPrivPriv->pBackBuffer);
- }
-
-} /* miDbeWinPrivDelete() */
-
-
-/******************************************************************************
- *
- * DBE MI Procedure: miDbePositionWindow
- *
- * Description:
- *
- * This function was cloned from miMbxPositionWindow() in mimultibuf.c.
- * This function resizes the buffer when the window is resized.
- *
- *****************************************************************************/
-
-static Bool
-miDbePositionWindow(WindowPtr pWin, int x, int y)
-{
- ScreenPtr pScreen;
- DbeScreenPrivPtr pDbeScreenPriv;
- DbeWindowPrivPtr pDbeWindowPriv;
- int width, height;
- int dx, dy, dw, dh;
- int sourcex, sourcey;
- int destx, desty;
- int savewidth, saveheight;
- PixmapPtr pFrontBuffer;
- PixmapPtr pBackBuffer;
- Bool clear;
- GCPtr pGC;
- xRectangle clearRect;
- Bool ret;
-
-
- /*
- **************************************************************************
- ** 1. Unwrap the member routine.
- **************************************************************************
- */
-
- pScreen = pWin->drawable.pScreen;
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
- pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
-
- /*
- **************************************************************************
- ** 2. Do any work necessary before the member routine is called.
- **
- ** In this case we do not need to do anything.
- **************************************************************************
- */
-
- /*
- **************************************************************************
- ** 3. Call the member routine, saving its result if necessary.
- **************************************************************************
- */
-
- ret = (*pScreen->PositionWindow)(pWin, x, y);
-
- /*
- **************************************************************************
- ** 4. Rewrap the member routine, restoring the wrapper value first in case
- ** the wrapper (or something that it wrapped) change this value.
- **************************************************************************
- */
-
- pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
- pScreen->PositionWindow = miDbePositionWindow;
-
- /*
- **************************************************************************
- ** 5. Do any work necessary after the member routine has been called.
- **************************************************************************
- */
-
- if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
- {
- return ret;
- }
-
- if (pDbeWindowPriv->width == pWin->drawable.width &&
- pDbeWindowPriv->height == pWin->drawable.height)
- {
- return ret;
- }
-
- width = pWin->drawable.width;
- height = pWin->drawable.height;
-
- dx = pWin->drawable.x - pDbeWindowPriv->x;
- dy = pWin->drawable.y - pDbeWindowPriv->y;
- dw = width - pDbeWindowPriv->width;
- dh = height - pDbeWindowPriv->height;
-
- GravityTranslate (0, 0, -dx, -dy, dw, dh, pWin->bitGravity, &destx, &desty);
-
- clear = ((pDbeWindowPriv->width < (unsigned short)width ) ||
- (pDbeWindowPriv->height < (unsigned short)height) ||
- (pWin->bitGravity == ForgetGravity));
-
- sourcex = 0;
- sourcey = 0;
- savewidth = pDbeWindowPriv->width;
- saveheight = pDbeWindowPriv->height;
-
- /* Clip rectangle to source and destination. */
- if (destx < 0)
- {
- savewidth += destx;
- sourcex -= destx;
- destx = 0;
- }
-
- if (destx + savewidth > width)
- {
- savewidth = width - destx;
- }
-
- if (desty < 0)
- {
- saveheight += desty;
- sourcey -= desty;
- desty = 0;
- }
-
- if (desty + saveheight > height)
- {
- saveheight = height - desty;
- }
-
- pDbeWindowPriv->width = width;
- pDbeWindowPriv->height = height;
- pDbeWindowPriv->x = pWin->drawable.x;
- pDbeWindowPriv->y = pWin->drawable.y;
-
- pGC = GetScratchGC (pWin->drawable.depth, pScreen);
-
- if (clear)
- {
- if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
- {
- clearRect.x = 0;
- clearRect.y = 0;
- clearRect.width = width;
- clearRect.height = height;
- }
- else
- {
- clear = FALSE;
- }
- }
-
- /* Create DBE buffer pixmaps equal to size of resized window. */
- pFrontBuffer = (*pScreen->CreatePixmap)(pScreen, width, height,
- pWin->drawable.depth, 0);
-
- pBackBuffer = (*pScreen->CreatePixmap)(pScreen, width, height,
- pWin->drawable.depth, 0);
-
- if (!pFrontBuffer || !pBackBuffer)
- {
- /* We failed at creating 1 or 2 of the pixmaps. */
-
- if (pFrontBuffer)
- {
- (*pScreen->DestroyPixmap)(pFrontBuffer);
- }
-
- if (pBackBuffer)
- {
- (*pScreen->DestroyPixmap)(pBackBuffer);
- }
-
- /* Destroy all buffers for this window. */
- while (pDbeWindowPriv)
- {
- /* DbeWindowPrivDelete() will free the window private if there no
- * more buffer IDs associated with this window.
- */
- FreeResource(pDbeWindowPriv->IDs[0], RT_NONE);
- pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
- }
-
- FreeScratchGC(pGC);
- return FALSE;
- }
-
- else
- {
- /* Clear out the new DBE buffer pixmaps. */
-
- MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
-
-
- pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
-
- /* I suppose this could avoid quite a bit of work if
- * it computed the minimal area required.
- */
- ValidateGC(&pFrontBuffer->drawable, pGC);
- if (clear)
- {
- (*pGC->ops->PolyFillRect)((DrawablePtr)pFrontBuffer, pGC, 1,
- &clearRect);
- }
- /* Copy the contents of the old front pixmap to the new one. */
- if (pWin->bitGravity != ForgetGravity)
- {
- (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer,
- (DrawablePtr)pFrontBuffer, pGC, sourcex,
- sourcey, savewidth, saveheight, destx, desty);
- }
-
- ValidateGC(&pBackBuffer->drawable, pGC);
- if (clear)
- {
- (*pGC->ops->PolyFillRect)((DrawablePtr)pBackBuffer , pGC, 1,
- &clearRect);
- }
- /* Copy the contents of the old back pixmap to the new one. */
- if (pWin->bitGravity != ForgetGravity)
- {
- (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
- (DrawablePtr)pBackBuffer, pGC, sourcex,
- sourcey, savewidth, saveheight, destx, desty);
- }
-
- /* Destroy the old pixmaps, and point the DBE window priv to the new
- * pixmaps.
- */
-
- (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer);
- (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pBackBuffer);
-
- pDbeWindowPrivPriv->pFrontBuffer = pFrontBuffer;
- pDbeWindowPrivPriv->pBackBuffer = pBackBuffer;
-
- /* Make sure all XID are associated with the new back pixmap. */
- miDbeAliasBuffers(pDbeWindowPriv);
-
- FreeScratchGC(pGC);
- }
-
- return ret;
-
-} /* miDbePositionWindow() */
-
-
-/******************************************************************************
- *
- * DBE MI Procedure: miDbeResetProc
- *
- * Description:
- *
- * This function is called from DbeResetProc(), which is called at the end
- * of every server generation. This function peforms any MI-specific
- * shutdown tasks.
- *
- *****************************************************************************/
-
-static void
-miDbeResetProc(ScreenPtr pScreen)
-{
- DbeScreenPrivPtr pDbeScreenPriv;
-
-
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
-
- /* Unwrap wrappers */
- pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
-
-} /* miDbeResetProc() */
-
-
-/******************************************************************************
- *
- * DBE MI Procedure: miDbeInit
- *
- * Description:
- *
- * This is the MI initialization function called by DbeExtensionInit().
- *
- *****************************************************************************/
-
-Bool
-miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
-{
- if (!dixRegisterPrivateKey(&miDbeWindowPrivPrivKeyRec, PRIVATE_DBE_WINDOW,
- sizeof(MiDbeWindowPrivPrivRec)))
- return FALSE;
-
- /* Wrap functions. */
- pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
- pScreen->PositionWindow = miDbePositionWindow;
-
- /* Initialize the per-screen DBE function pointers. */
- pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo;
- pDbeScreenPriv->AllocBackBufferName = miDbeAllocBackBufferName;
- pDbeScreenPriv->SwapBuffers = miDbeSwapBuffers;
- pDbeScreenPriv->BeginIdiom = 0;
- pDbeScreenPriv->EndIdiom = 0;
- pDbeScreenPriv->ResetProc = miDbeResetProc;
- pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete;
-
- return TRUE;
-
-} /* miDbeInit() */
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ * Machine-independent DBE code
+ *
+ *****************************************************************************/
+
+/* INCLUDES */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "os.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "opaque.h"
+#include "dbestruct.h"
+#include "midbestr.h"
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "inputstr.h"
+#include "midbe.h"
+#include "xace.h"
+
+#include <stdio.h>
+
+static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec;
+
+#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec)
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeGetVisualInfo
+ *
+ * Description:
+ *
+ * This is the MI function for the DbeGetVisualInfo request. This function
+ * is called through pDbeScreenPriv->GetVisualInfo. This function is also
+ * called for the DbeAllocateBackBufferName request at the extension level;
+ * it is called by ProcDbeAllocateBackBufferName() in dbe.c.
+ *
+ * If memory allocation fails or we can not get the visual info, this
+ * function returns FALSE. Otherwise, it returns TRUE for success.
+ *
+ *****************************************************************************/
+
+static Bool
+miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo * pScrVisInfo)
+{
+ register int i, j, k;
+ register int count;
+ DepthPtr pDepth;
+ XdbeVisualInfo *visInfo;
+
+ /* Determine number of visuals for this screen. */
+ for (i = 0, count = 0; i < pScreen->numDepths; i++) {
+ count += pScreen->allowedDepths[i].numVids;
+ }
+
+ /* Allocate an array of XdbeVisualInfo items. */
+ if (!(visInfo = (XdbeVisualInfo *) malloc(count * sizeof(XdbeVisualInfo)))) {
+ return FALSE; /* memory alloc failure */
+ }
+
+ for (i = 0, k = 0; i < pScreen->numDepths; i++) {
+ /* For each depth of this screen, get visual information. */
+
+ pDepth = &pScreen->allowedDepths[i];
+
+ for (j = 0; j < pDepth->numVids; j++) {
+ /* For each visual for this depth of this screen, get visual ID
+ * and visual depth. Since this is MI code, we will always return
+ * the same performance level for all visuals (0). A higher
+ * performance level value indicates higher performance.
+ */
+ visInfo[k].visual = pDepth->vids[j];
+ visInfo[k].depth = pDepth->depth;
+ visInfo[k].perflevel = 0;
+ k++;
+ }
+ }
+
+ /* Record the number of visuals and point visual_depth to
+ * the array of visual info.
+ */
+ pScrVisInfo->count = count;
+ pScrVisInfo->visinfo = visInfo;
+
+ return TRUE; /* success */
+
+} /* miDbeGetVisualInfo() */
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miAllocBackBufferName
+ *
+ * Description:
+ *
+ * This is the MI function for the DbeAllocateBackBufferName request.
+ *
+ *****************************************************************************/
+
+static int
+miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
+{
+ ScreenPtr pScreen;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ GCPtr pGC;
+ xRectangle clearRect;
+ int rc;
+
+ pScreen = pWin->drawable.pScreen;
+ pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
+
+ if (pDbeWindowPriv->nBufferIDs == 0) {
+ /* There is no buffer associated with the window.
+ * We have to create the window priv priv. Remember, the window
+ * priv was created at the DIX level, so all we need to do is
+ * create the priv priv and attach it to the priv.
+ */
+
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ /* Setup the window priv priv. */
+ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+ pDbeWindowPrivPriv->pDbeWindowPriv = pDbeWindowPriv;
+
+ /* Get a front pixmap. */
+ if (!(pDbeWindowPrivPriv->pFrontBuffer =
+ (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
+ pDbeWindowPriv->height,
+ pWin->drawable.depth, 0))) {
+ return BadAlloc;
+ }
+
+ /* Get a back pixmap. */
+ if (!(pDbeWindowPrivPriv->pBackBuffer =
+ (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
+ pDbeWindowPriv->height,
+ pWin->drawable.depth, 0))) {
+ (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
+ return BadAlloc;
+ }
+
+ /* Security creation/labeling check. */
+ rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId,
+ dbeDrawableResType, pDbeWindowPrivPriv->pBackBuffer,
+ RT_WINDOW, pWin, DixCreateAccess);
+
+ /* Make the back pixmap a DBE drawable resource. */
+ if (rc != Success || !AddResource(bufId, dbeDrawableResType,
+ pDbeWindowPrivPriv->pBackBuffer)) {
+ /* free the buffer and the drawable resource */
+ FreeResource(bufId, RT_NONE);
+ return (rc == Success) ? BadAlloc : rc;
+ }
+
+ /* Clear the back buffer. */
+ pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
+ if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
+ ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
+ clearRect.x = clearRect.y = 0;
+ clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
+ clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
+ (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv->
+ pBackBuffer, pGC, 1, &clearRect);
+ }
+ FreeScratchGC(pGC);
+
+ } /* if no buffer associated with the window */
+
+ else {
+ /* A buffer is already associated with the window.
+ * Place the new buffer ID information at the head of the ID list.
+ */
+
+ /* Associate the new ID with an existing pixmap. */
+ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+ if (!AddResource(bufId, dbeDrawableResType,
+ (pointer) pDbeWindowPrivPriv->pBackBuffer)) {
+ return BadAlloc;
+ }
+
+ }
+
+ return Success;
+
+} /* miDbeAllocBackBufferName() */
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeAliasBuffers
+ *
+ * Description:
+ *
+ * This function associates all XIDs of a buffer with the back pixmap
+ * stored in the window priv.
+ *
+ *****************************************************************************/
+
+static void
+miDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv)
+{
+ int i;
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv =
+ MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+
+ for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) {
+ ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType,
+ (pointer) pDbeWindowPrivPriv->pBackBuffer);
+ }
+
+} /* miDbeAliasBuffers() */
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeSwapBuffers
+ *
+ * Description:
+ *
+ * This is the MI function for the DbeSwapBuffers request.
+ *
+ *****************************************************************************/
+
+static int
+miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
+{
+ DbeScreenPrivPtr pDbeScreenPriv;
+ GCPtr pGC;
+ WindowPtr pWin;
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+ PixmapPtr pTmpBuffer;
+ xRectangle clearRect;
+
+ pWin = swapInfo[0].pWindow;
+ pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
+ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin);
+ pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
+
+ /*
+ **********************************************************************
+ ** Setup before swap.
+ **********************************************************************
+ */
+
+ switch (swapInfo[0].swapAction) {
+ case XdbeUndefined:
+ break;
+
+ case XdbeBackground:
+ break;
+
+ case XdbeUntouched:
+ ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pFrontBuffer, pGC);
+ (*pGC->ops->CopyArea) ((DrawablePtr) pWin,
+ (DrawablePtr) pDbeWindowPrivPriv->pFrontBuffer,
+ pGC, 0, 0, pWin->drawable.width,
+ pWin->drawable.height, 0, 0);
+ break;
+
+ case XdbeCopied:
+ break;
+
+ }
+
+ /*
+ **********************************************************************
+ ** Swap.
+ **********************************************************************
+ */
+
+ ValidateGC((DrawablePtr) pWin, pGC);
+ (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer,
+ (DrawablePtr) pWin, pGC, 0, 0,
+ pWin->drawable.width, pWin->drawable.height, 0, 0);
+
+ /*
+ **********************************************************************
+ ** Tasks after swap.
+ **********************************************************************
+ */
+
+ switch (swapInfo[0].swapAction) {
+ case XdbeUndefined:
+ break;
+
+ case XdbeBackground:
+ if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
+ ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
+ clearRect.x = 0;
+ clearRect.y = 0;
+ clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
+ clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
+ (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv->
+ pBackBuffer, pGC, 1, &clearRect);
+ }
+ break;
+
+ case XdbeUntouched:
+ /* Swap pixmap pointers. */
+ pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer;
+ pDbeWindowPrivPriv->pBackBuffer = pDbeWindowPrivPriv->pFrontBuffer;
+ pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer;
+
+ miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv);
+
+ break;
+
+ case XdbeCopied:
+ break;
+
+ }
+
+ /* Remove the swapped window from the swap information array and decrement
+ * pNumWindows to indicate to the DIX level how many windows were actually
+ * swapped.
+ */
+
+ if (*pNumWindows > 1) {
+ /* We were told to swap more than one window, but we only swapped the
+ * first one. Remove the first window in the list by moving the last
+ * window to the beginning.
+ */
+ swapInfo[0].pWindow = swapInfo[*pNumWindows - 1].pWindow;
+ swapInfo[0].swapAction = swapInfo[*pNumWindows - 1].swapAction;
+
+ /* Clear the last window information just to be safe. */
+ swapInfo[*pNumWindows - 1].pWindow = (WindowPtr) NULL;
+ swapInfo[*pNumWindows - 1].swapAction = 0;
+ }
+ else {
+ /* Clear the window information just to be safe. */
+ swapInfo[0].pWindow = (WindowPtr) NULL;
+ swapInfo[0].swapAction = 0;
+ }
+
+ (*pNumWindows)--;
+
+ FreeScratchGC(pGC);
+
+ return Success;
+
+} /* miSwapBuffers() */
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeWinPrivDelete
+ *
+ * Description:
+ *
+ * This is the MI function for deleting the dbeWindowPrivResType resource.
+ * This function is invoked indirectly by calling FreeResource() to free
+ * the resources associated with a DBE buffer ID. There are 5 ways that
+ * miDbeWinPrivDelete() can be called by FreeResource(). They are:
+ *
+ * - A DBE window is destroyed, in which case the DbeDestroyWindow()
+ * wrapper is invoked. The wrapper calls FreeResource() for all DBE
+ * buffer IDs.
+ *
+ * - miDbeAllocBackBufferName() calls FreeResource() to clean up resources
+ * after a buffer allocation failure.
+ *
+ * - The PositionWindow wrapper, miDbePositionWindow(), calls
+ * FreeResource() when it fails to create buffers of the new size.
+ * FreeResource() is called for all DBE buffer IDs.
+ *
+ * - FreeClientResources() calls FreeResource() when a client dies or the
+ * the server resets.
+ *
+ * When FreeResource() is called for a DBE buffer ID, the delete function
+ * for the only other type of DBE resource, dbeDrawableResType, is also
+ * invoked. This delete function (DbeDrawableDelete) is a NOOP to make
+ * resource deletion easier. It is not guaranteed which delete function is
+ * called first. Hence, we will let miDbeWinPrivDelete() free all DBE
+ * resources.
+ *
+ * This function deletes/frees the following stuff associated with
+ * the window private:
+ *
+ * - the ID node in the ID list representing the passed in ID.
+ *
+ * In addition, pDbeWindowPriv->nBufferIDs is decremented.
+ *
+ * If this function is called for the last/only buffer ID for a window,
+ * these are additionally deleted/freed:
+ *
+ * - the front and back pixmaps
+ * - the window priv itself
+ *
+ *****************************************************************************/
+
+static void
+miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
+{
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+
+ if (pDbeWindowPriv->nBufferIDs != 0) {
+ /* We still have at least one more buffer ID associated with this
+ * window.
+ */
+ return;
+ }
+
+ /* We have no more buffer IDs associated with this window. We need to
+ * free some stuff.
+ */
+
+ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+
+ /* Destroy the front and back pixmaps. */
+ if (pDbeWindowPrivPriv->pFrontBuffer) {
+ (*pDbeWindowPriv->pWindow->drawable.pScreen->
+ DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
+ }
+ if (pDbeWindowPrivPriv->pBackBuffer) {
+ (*pDbeWindowPriv->pWindow->drawable.pScreen->
+ DestroyPixmap) (pDbeWindowPrivPriv->pBackBuffer);
+ }
+
+} /* miDbeWinPrivDelete() */
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbePositionWindow
+ *
+ * Description:
+ *
+ * This function was cloned from miMbxPositionWindow() in mimultibuf.c.
+ * This function resizes the buffer when the window is resized.
+ *
+ *****************************************************************************/
+
+static Bool
+miDbePositionWindow(WindowPtr pWin, int x, int y)
+{
+ ScreenPtr pScreen;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ int width, height;
+ int dx, dy, dw, dh;
+ int sourcex, sourcey;
+ int destx, desty;
+ int savewidth, saveheight;
+ PixmapPtr pFrontBuffer;
+ PixmapPtr pBackBuffer;
+ Bool clear;
+ GCPtr pGC;
+ xRectangle clearRect;
+ Bool ret;
+
+ /*
+ **************************************************************************
+ ** 1. Unwrap the member routine.
+ **************************************************************************
+ */
+
+ pScreen = pWin->drawable.pScreen;
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+ pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
+
+ /*
+ **************************************************************************
+ ** 2. Do any work necessary before the member routine is called.
+ **
+ ** In this case we do not need to do anything.
+ **************************************************************************
+ */
+
+ /*
+ **************************************************************************
+ ** 3. Call the member routine, saving its result if necessary.
+ **************************************************************************
+ */
+
+ ret = (*pScreen->PositionWindow) (pWin, x, y);
+
+ /*
+ **************************************************************************
+ ** 4. Rewrap the member routine, restoring the wrapper value first in case
+ ** the wrapper (or something that it wrapped) change this value.
+ **************************************************************************
+ */
+
+ pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
+ pScreen->PositionWindow = miDbePositionWindow;
+
+ /*
+ **************************************************************************
+ ** 5. Do any work necessary after the member routine has been called.
+ **************************************************************************
+ */
+
+ if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
+ return ret;
+ }
+
+ if (pDbeWindowPriv->width == pWin->drawable.width &&
+ pDbeWindowPriv->height == pWin->drawable.height) {
+ return ret;
+ }
+
+ width = pWin->drawable.width;
+ height = pWin->drawable.height;
+
+ dx = pWin->drawable.x - pDbeWindowPriv->x;
+ dy = pWin->drawable.y - pDbeWindowPriv->y;
+ dw = width - pDbeWindowPriv->width;
+ dh = height - pDbeWindowPriv->height;
+
+ GravityTranslate(0, 0, -dx, -dy, dw, dh, pWin->bitGravity, &destx, &desty);
+
+ clear = ((pDbeWindowPriv->width < (unsigned short) width) ||
+ (pDbeWindowPriv->height < (unsigned short) height) ||
+ (pWin->bitGravity == ForgetGravity));
+
+ sourcex = 0;
+ sourcey = 0;
+ savewidth = pDbeWindowPriv->width;
+ saveheight = pDbeWindowPriv->height;
+
+ /* Clip rectangle to source and destination. */
+ if (destx < 0) {
+ savewidth += destx;
+ sourcex -= destx;
+ destx = 0;
+ }
+
+ if (destx + savewidth > width) {
+ savewidth = width - destx;
+ }
+
+ if (desty < 0) {
+ saveheight += desty;
+ sourcey -= desty;
+ desty = 0;
+ }
+
+ if (desty + saveheight > height) {
+ saveheight = height - desty;
+ }
+
+ pDbeWindowPriv->width = width;
+ pDbeWindowPriv->height = height;
+ pDbeWindowPriv->x = pWin->drawable.x;
+ pDbeWindowPriv->y = pWin->drawable.y;
+
+ pGC = GetScratchGC(pWin->drawable.depth, pScreen);
+
+ if (clear) {
+ if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
+ clearRect.x = 0;
+ clearRect.y = 0;
+ clearRect.width = width;
+ clearRect.height = height;
+ }
+ else {
+ clear = FALSE;
+ }
+ }
+
+ /* Create DBE buffer pixmaps equal to size of resized window. */
+ pFrontBuffer = (*pScreen->CreatePixmap) (pScreen, width, height,
+ pWin->drawable.depth, 0);
+
+ pBackBuffer = (*pScreen->CreatePixmap) (pScreen, width, height,
+ pWin->drawable.depth, 0);
+
+ if (!pFrontBuffer || !pBackBuffer) {
+ /* We failed at creating 1 or 2 of the pixmaps. */
+
+ if (pFrontBuffer) {
+ (*pScreen->DestroyPixmap) (pFrontBuffer);
+ }
+
+ if (pBackBuffer) {
+ (*pScreen->DestroyPixmap) (pBackBuffer);
+ }
+
+ /* Destroy all buffers for this window. */
+ while (pDbeWindowPriv) {
+ /* DbeWindowPrivDelete() will free the window private if there no
+ * more buffer IDs associated with this window.
+ */
+ FreeResource(pDbeWindowPriv->IDs[0], RT_NONE);
+ pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
+ }
+
+ FreeScratchGC(pGC);
+ return FALSE;
+ }
+
+ else {
+ /* Clear out the new DBE buffer pixmaps. */
+
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+
+ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+
+ /* I suppose this could avoid quite a bit of work if
+ * it computed the minimal area required.
+ */
+ ValidateGC(&pFrontBuffer->drawable, pGC);
+ if (clear) {
+ (*pGC->ops->PolyFillRect) ((DrawablePtr) pFrontBuffer, pGC, 1,
+ &clearRect);
+ }
+ /* Copy the contents of the old front pixmap to the new one. */
+ if (pWin->bitGravity != ForgetGravity) {
+ (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->
+ pFrontBuffer, (DrawablePtr) pFrontBuffer,
+ pGC, sourcex, sourcey, savewidth, saveheight,
+ destx, desty);
+ }
+
+ ValidateGC(&pBackBuffer->drawable, pGC);
+ if (clear) {
+ (*pGC->ops->PolyFillRect) ((DrawablePtr) pBackBuffer, pGC, 1,
+ &clearRect);
+ }
+ /* Copy the contents of the old back pixmap to the new one. */
+ if (pWin->bitGravity != ForgetGravity) {
+ (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->
+ pBackBuffer, (DrawablePtr) pBackBuffer, pGC,
+ sourcex, sourcey, savewidth, saveheight,
+ destx, desty);
+ }
+
+ /* Destroy the old pixmaps, and point the DBE window priv to the new
+ * pixmaps.
+ */
+
+ (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
+ (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pBackBuffer);
+
+ pDbeWindowPrivPriv->pFrontBuffer = pFrontBuffer;
+ pDbeWindowPrivPriv->pBackBuffer = pBackBuffer;
+
+ /* Make sure all XID are associated with the new back pixmap. */
+ miDbeAliasBuffers(pDbeWindowPriv);
+
+ FreeScratchGC(pGC);
+ }
+
+ return ret;
+
+} /* miDbePositionWindow() */
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeResetProc
+ *
+ * Description:
+ *
+ * This function is called from DbeResetProc(), which is called at the end
+ * of every server generation. This function peforms any MI-specific
+ * shutdown tasks.
+ *
+ *****************************************************************************/
+
+static void
+miDbeResetProc(ScreenPtr pScreen)
+{
+ DbeScreenPrivPtr pDbeScreenPriv;
+
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ /* Unwrap wrappers */
+ pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
+
+} /* miDbeResetProc() */
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeInit
+ *
+ * Description:
+ *
+ * This is the MI initialization function called by DbeExtensionInit().
+ *
+ *****************************************************************************/
+
+Bool
+miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
+{
+ if (!dixRegisterPrivateKey(&miDbeWindowPrivPrivKeyRec, PRIVATE_DBE_WINDOW,
+ sizeof(MiDbeWindowPrivPrivRec)))
+ return FALSE;
+
+ /* Wrap functions. */
+ pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
+ pScreen->PositionWindow = miDbePositionWindow;
+
+ /* Initialize the per-screen DBE function pointers. */
+ pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo;
+ pDbeScreenPriv->AllocBackBufferName = miDbeAllocBackBufferName;
+ pDbeScreenPriv->SwapBuffers = miDbeSwapBuffers;
+ pDbeScreenPriv->BeginIdiom = 0;
+ pDbeScreenPriv->EndIdiom = 0;
+ pDbeScreenPriv->ResetProc = miDbeResetProc;
+ pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete;
+
+ return TRUE;
+
+} /* miDbeInit() */
diff --git a/xorg-server/dbe/midbe.h b/xorg-server/dbe/midbe.h
index 4f09bf432..4eed538d0 100644
--- a/xorg-server/dbe/midbe.h
+++ b/xorg-server/dbe/midbe.h
@@ -1,58 +1,56 @@
-/******************************************************************************
- * Copyright (c) 1994, 1995 Hewlett-Packard Company
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the Hewlett-Packard
- * Company shall not be used in advertising or otherwise to promote the
- * sale, use or other dealings in this Software without prior written
- * authorization from the Hewlett-Packard Company.
- *
- * Header file for users of machine-independent DBE code
- *
- *****************************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef MIDBE_H
-#define MIDBE_H
-
-#include "privates.h"
-
-/* EXTERNS */
-
-extern Bool miDbeInit(
- ScreenPtr pScreen,
- DbeScreenPrivPtr pDbeScreenPriv
-);
-
-extern DevPrivateKeyRec dbeScreenPrivKeyRec;
-#define dbeScreenPrivKey (&dbeScreenPrivKeyRec)
-
-extern DevPrivateKeyRec dbeWindowPrivKeyRec;
-#define dbeWindowPrivKey (&dbeWindowPrivKeyRec)
-
-extern RESTYPE dbeDrawableResType;
-extern RESTYPE dbeWindowPrivResType;
-
-#endif /* MIDBE_H */
-
+/******************************************************************************
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ * Header file for users of machine-independent DBE code
+ *
+ *****************************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef MIDBE_H
+#define MIDBE_H
+
+#include "privates.h"
+
+/* EXTERNS */
+
+extern Bool miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv);
+
+extern DevPrivateKeyRec dbeScreenPrivKeyRec;
+
+#define dbeScreenPrivKey (&dbeScreenPrivKeyRec)
+
+extern DevPrivateKeyRec dbeWindowPrivKeyRec;
+
+#define dbeWindowPrivKey (&dbeWindowPrivKeyRec)
+
+extern RESTYPE dbeDrawableResType;
+extern RESTYPE dbeWindowPrivResType;
+
+#endif /* MIDBE_H */
diff --git a/xorg-server/dbe/midbestr.h b/xorg-server/dbe/midbestr.h
index efbe9b28e..70017b045 100644
--- a/xorg-server/dbe/midbestr.h
+++ b/xorg-server/dbe/midbestr.h
@@ -1,79 +1,75 @@
-/******************************************************************************
- *
- * Copyright (c) 1994, 1995 Hewlett-Packard Company
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the Hewlett-Packard
- * Company shall not be used in advertising or otherwise to promote the
- * sale, use or other dealings in this Software without prior written
- * authorization from the Hewlett-Packard Company.
- *
- * Header file for users of machine-independent DBE code
- *
- *****************************************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef MIDBE_STRUCT_H
-#define MIDBE_STRUCT_H
-
-
-/* DEFINES */
-
-#define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \
- (!(pDbeWindowPriv) ? NULL : (MiDbeWindowPrivPrivPtr) \
- dixLookupPrivate(&(pDbeWindowPriv)->devPrivates, miDbeWindowPrivPrivKey))
-
-#define MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin)\
- MI_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin))
-
-/* TYPEDEFS */
-
-typedef struct _MiDbeWindowPrivPrivRec
-{
- /* Place machine-specific fields in here.
- * Since this is mi code, we do not really have machine-specific fields.
- */
-
- /* Pointer to a drawable that contains the contents of the back buffer.
- */
- PixmapPtr pBackBuffer;
-
- /* Pointer to a drawable that contains the contents of the front buffer.
- * This pointer is only used for the XdbeUntouched swap action. For that
- * swap action, we need to copy the front buffer (window) contents into
- * this drawable, copy the contents of current back buffer drawable (the
- * back buffer) into the window, swap the front and back drawable pointers,
- * and then swap the drawable/resource associations in the resource
- * database.
- */
- PixmapPtr pFrontBuffer;
-
- /* Pointer back to our window private with which we are associated. */
- DbeWindowPrivPtr pDbeWindowPriv;
-
-} MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr;
-
-#endif /* MIDBE_STRUCT_H */
-
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ * Header file for users of machine-independent DBE code
+ *
+ *****************************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef MIDBE_STRUCT_H
+#define MIDBE_STRUCT_H
+
+/* DEFINES */
+
+#define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \
+ (!(pDbeWindowPriv) ? NULL : (MiDbeWindowPrivPrivPtr) \
+ dixLookupPrivate(&(pDbeWindowPriv)->devPrivates, miDbeWindowPrivPrivKey))
+
+#define MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin)\
+ MI_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin))
+
+/* TYPEDEFS */
+
+typedef struct _MiDbeWindowPrivPrivRec {
+ /* Place machine-specific fields in here.
+ * Since this is mi code, we do not really have machine-specific fields.
+ */
+
+ /* Pointer to a drawable that contains the contents of the back buffer.
+ */
+ PixmapPtr pBackBuffer;
+
+ /* Pointer to a drawable that contains the contents of the front buffer.
+ * This pointer is only used for the XdbeUntouched swap action. For that
+ * swap action, we need to copy the front buffer (window) contents into
+ * this drawable, copy the contents of current back buffer drawable (the
+ * back buffer) into the window, swap the front and back drawable pointers,
+ * and then swap the drawable/resource associations in the resource
+ * database.
+ */
+ PixmapPtr pFrontBuffer;
+
+ /* Pointer back to our window private with which we are associated. */
+ DbeWindowPrivPtr pDbeWindowPriv;
+
+} MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr;
+
+#endif /* MIDBE_STRUCT_H */
diff --git a/xorg-server/dix/Xserver-dtrace.h b/xorg-server/dix/Xserver-dtrace.h
index 0ced498af..52daf677e 100644
--- a/xorg-server/dix/Xserver-dtrace.h
+++ b/xorg-server/dix/Xserver-dtrace.h
@@ -1,29 +1,23 @@
-/* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+/* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, and/or sell copies of the Software, and to permit persons
- * to whom the Software is furnished to do so, provided that the above
- * copyright notice(s) and this permission notice appear in all copies of
- * the Software and that both the above copyright notice(s) and this
- * permission notice appear in supporting documentation.
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
*
- * Except as contained in this notice, the name of a copyright holder
- * shall not be used in advertising or otherwise to promote the sale, use
- * or other dealings in this Software without prior written authorization
- * of the copyright holder.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*/
/*
@@ -58,6 +52,8 @@ extern "C" {
winDebug4("XSERVER_RESOURCE_FREE: 0x%x 0x%x ->%p %s\n",arg0, arg1, arg2, arg3)
#define XSERVER_SEND_EVENT(arg0, arg1, arg2) \
winDebug4("XSERVER_SEND_EVENT: 0x%x 0x%x ->%p\n",arg0, arg1, arg2)
+#define XSERVER_INPUT_EVENT(arg0, arg1, arg2, arg3, arg4, arg5, arg6) \
+ winDebug4("XSERVER_SEND_EVENT: %x %x %x %x %x %x %x\n", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
#define XSERVER_CLIENT_AUTH_ENABLED() (1)
#define XSERVER_CLIENT_CONNECT_ENABLED() (1)
@@ -67,6 +63,7 @@ extern "C" {
#define XSERVER_RESOURCE_ALLOC_ENABLED() (1)
#define XSERVER_RESOURCE_FREE_ENABLED() (1)
#define XSERVER_SEND_EVENT_ENABLED() (1)
+#define XSERVER_INPUT_EVENT_ENABLED() (1)
#ifdef __cplusplus
}
diff --git a/xorg-server/dix/Xserver-dtrace.h.in b/xorg-server/dix/Xserver-dtrace.h.in
index dc9419b0d..60ebbcdd9 100644
--- a/xorg-server/dix/Xserver-dtrace.h.in
+++ b/xorg-server/dix/Xserver-dtrace.h.in
@@ -1,94 +1,99 @@
-/* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Generated by dtrace(1M), and then modified for backwards compatibility
- * with older versions of dtrace. Used if dtrace -h fails.
- * (Since _ENABLED support was added after dtrace -h, this assumes if
- * dtrace -h fails, _ENABLED will too.)
- */
-
-#ifndef _XSERVER_DTRACE_H
-#define _XSERVER_DTRACE_H
-
-#include <unistd.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if _DTRACE_VERSION
-
-#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3) \
- __dtrace_Xserver___client__auth(arg0, arg1, arg2, arg3)
-#define XSERVER_CLIENT_CONNECT(arg0, arg1) \
- __dtrace_Xserver___client__connect(arg0, arg1)
-#define XSERVER_CLIENT_DISCONNECT(arg0) \
- __dtrace_Xserver___client__disconnect(arg0)
-#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4) \
- __dtrace_Xserver___request__done(arg0, arg1, arg2, arg3, arg4)
-#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4) \
- __dtrace_Xserver___request__start(arg0, arg1, arg2, arg3, arg4)
-#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3) \
- __dtrace_Xserver___resource__alloc(arg0, arg1, arg2, arg3)
-#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3) \
- __dtrace_Xserver___resource__free(arg0, arg1, arg2, arg3)
-#define XSERVER_SEND_EVENT(arg0, arg1, arg2) \
- __dtrace_Xserver___send__event(arg0, arg1, arg2)
-
-
-extern void __dtrace_Xserver___client__auth(int, string, pid_t, zoneid_t);
-extern void __dtrace_Xserver___client__connect(int, int);
-extern void __dtrace_Xserver___client__disconnect(int);
-extern void __dtrace_Xserver___request__done(string, uint8_t, uint32_t, int, int);
-extern void __dtrace_Xserver___request__start(string, uint8_t, uint16_t, int, void *);
-extern void __dtrace_Xserver___resource__alloc(uint32_t, uint32_t, void *, string);
-extern void __dtrace_Xserver___resource__free(uint32_t, uint32_t, void *, string);
-extern void __dtrace_Xserver___send__event(int, uint8_t, void *);
-
-#else
-
-#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3)
-#define XSERVER_CLIENT_CONNECT(arg0, arg1)
-#define XSERVER_CLIENT_DISCONNECT(arg0)
-#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4)
-#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4)
-#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3)
-#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3)
-#define XSERVER_SEND_EVENT(arg0, arg1, arg2)
-
-#endif
-
-#define XSERVER_CLIENT_AUTH_ENABLED() (1)
-#define XSERVER_CLIENT_CONNECT_ENABLED() (1)
-#define XSERVER_CLIENT_DISCONNECT_ENABLED() (1)
-#define XSERVER_REQUEST_DONE_ENABLED() (1)
-#define XSERVER_REQUEST_START_ENABLED() (1)
-#define XSERVER_RESOURCE_ALLOC_ENABLED() (1)
-#define XSERVER_RESOURCE_FREE_ENABLED() (1)
-#define XSERVER_SEND_EVENT_ENABLED() (1)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _XSERVER_DTRACE_H */
+/* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Generated by dtrace(1M), and then modified for backwards compatibility
+ * with older versions of dtrace. Used if dtrace -h fails.
+ * (Since _ENABLED support was added after dtrace -h, this assumes if
+ * dtrace -h fails, _ENABLED will too.)
+ */
+
+#ifndef _XSERVER_DTRACE_H
+#define _XSERVER_DTRACE_H
+
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if _DTRACE_VERSION
+
+#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___client__auth(arg0, arg1, arg2, arg3)
+#define XSERVER_CLIENT_CONNECT(arg0, arg1) \
+ __dtrace_Xserver___client__connect(arg0, arg1)
+#define XSERVER_CLIENT_DISCONNECT(arg0) \
+ __dtrace_Xserver___client__disconnect(arg0)
+#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4) \
+ __dtrace_Xserver___request__done(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4) \
+ __dtrace_Xserver___request__start(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___resource__alloc(arg0, arg1, arg2, arg3)
+#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___resource__free(arg0, arg1, arg2, arg3)
+#define XSERVER_SEND_EVENT(arg0, arg1, arg2) \
+ __dtrace_Xserver___send__event(arg0, arg1, arg2)
+#define XSERVER_INPUT_EVENT(arg0, arg1, arg2, arg3, arg4, arg5, arg6) \
+ __dtrace_Xserver___input__event(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
+
+extern void __dtrace_Xserver___client__auth(int, string, pid_t, zoneid_t);
+extern void __dtrace_Xserver___client__connect(int, int);
+extern void __dtrace_Xserver___client__disconnect(int);
+extern void __dtrace_Xserver___request__done(string, uint8_t, uint32_t, int, int);
+extern void __dtrace_Xserver___request__start(string, uint8_t, uint16_t, int, void *);
+extern void __dtrace_Xserver___resource__alloc(uint32_t, uint32_t, void *, string);
+extern void __dtrace_Xserver___resource__free(uint32_t, uint32_t, void *, string);
+extern void __dtrace_Xserver___send__event(int, uint8_t, void *);
+extern void __dtrace_Xserver___input__event(int, uint16_t, uint32_t, uint32_t, int8_t, uint8_t *, double *);
+
+
+#else
+
+#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3)
+#define XSERVER_CLIENT_CONNECT(arg0, arg1)
+#define XSERVER_CLIENT_DISCONNECT(arg0)
+#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3)
+#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3)
+#define XSERVER_SEND_EVENT(arg0, arg1, arg2)
+#define XSERVER_INPUT_EVENT(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
+
+#endif
+
+#define XSERVER_CLIENT_AUTH_ENABLED() (1)
+#define XSERVER_CLIENT_CONNECT_ENABLED() (1)
+#define XSERVER_CLIENT_DISCONNECT_ENABLED() (1)
+#define XSERVER_REQUEST_DONE_ENABLED() (1)
+#define XSERVER_REQUEST_START_ENABLED() (1)
+#define XSERVER_RESOURCE_ALLOC_ENABLED() (1)
+#define XSERVER_RESOURCE_FREE_ENABLED() (1)
+#define XSERVER_SEND_EVENT_ENABLED() (1)
+#define XSERVER_INPUT_EVENT_ENABLED() (1)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XSERVER_DTRACE_H */
diff --git a/xorg-server/dix/Xserver.d b/xorg-server/dix/Xserver.d
index 6584ece52..248d48e24 100644
--- a/xorg-server/dix/Xserver.d
+++ b/xorg-server/dix/Xserver.d
@@ -1,58 +1,60 @@
-/* Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Xserver dtrace provider definition
- */
-#ifdef __APPLE__
-#define string char *
-#define pid_t uint32_t
-#define zoneid_t uint32_t
-#else
-#include <sys/types.h>
-#endif
-
-provider Xserver {
- /* reqType, data, length, client id, request buffer */
- probe request__start(string, uint8_t, uint16_t, int, void *);
- /* reqType, data, sequence, client id, result */
- probe request__done(string, uint8_t, uint32_t, int, int);
- /* client id, client fd */
- probe client__connect(int, int);
- /* client id, client address, client pid, client zone id */
- probe client__auth(int, string, pid_t, zoneid_t);
- /* client id */
- probe client__disconnect(int);
- /* resource id, resource type, value, resource type name */
- probe resource__alloc(uint32_t, uint32_t, void *, string);
- /* resource id, resource type, value, resource type name */
- probe resource__free(uint32_t, uint32_t, void *, string);
- /* client id, event type, event* */
- probe send__event(int, uint8_t, void *);
-};
-
-#pragma D attributes Unstable/Unstable/Common provider Xserver provider
-#pragma D attributes Private/Private/Unknown provider Xserver module
-#pragma D attributes Private/Private/Unknown provider Xserver function
-#pragma D attributes Unstable/Unstable/Common provider Xserver name
-#pragma D attributes Unstable/Unstable/Common provider Xserver args
-
+/* Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Xserver dtrace provider definition
+ */
+#ifdef __APPLE__
+#define string char *
+#define pid_t uint32_t
+#define zoneid_t uint32_t
+#else
+#include <sys/types.h>
+#endif
+
+provider Xserver {
+ /* reqType, data, length, client id, request buffer */
+ probe request__start(string, uint8_t, uint16_t, int, void *);
+ /* reqType, data, sequence, client id, result */
+ probe request__done(string, uint8_t, uint32_t, int, int);
+ /* client id, client fd */
+ probe client__connect(int, int);
+ /* client id, client address, client pid, client zone id */
+ probe client__auth(int, string, pid_t, zoneid_t);
+ /* client id */
+ probe client__disconnect(int);
+ /* resource id, resource type, value, resource type name */
+ probe resource__alloc(uint32_t, uint32_t, void *, string);
+ /* resource id, resource type, value, resource type name */
+ probe resource__free(uint32_t, uint32_t, void *, string);
+ /* client id, event type, event* */
+ probe send__event(int, uint8_t, void *);
+ /* deviceid, type, button/keycode/touchid, flags, nvalues, mask, values */
+ probe input__event(int, int, uint32_t, uint32_t, int8_t, uint8_t*, double*);
+};
+
+#pragma D attributes Unstable/Unstable/Common provider Xserver provider
+#pragma D attributes Private/Private/Unknown provider Xserver module
+#pragma D attributes Private/Private/Unknown provider Xserver function
+#pragma D attributes Unstable/Unstable/Common provider Xserver name
+#pragma D attributes Unstable/Unstable/Common provider Xserver args
+
diff --git a/xorg-server/dix/atom.c b/xorg-server/dix/atom.c
index 83ff71a7d..6f85968cd 100644
--- a/xorg-server/dix/atom.c
+++ b/xorg-server/dix/atom.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -45,7 +44,6 @@ SOFTWARE.
******************************************************************/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -61,10 +59,10 @@ SOFTWARE.
#define InitialTableSize 100
typedef struct _Node {
- struct _Node *left, *right;
+ struct _Node *left, *right;
Atom a;
unsigned int fingerPrint;
- const char *string;
+ const char *string;
} NodeRec, *NodePtr;
static Atom lastAtom = None;
@@ -77,77 +75,71 @@ void FreeAtom(NodePtr patom);
Atom
MakeAtom(const char *string, unsigned len, Bool makeit)
{
- NodePtr * np;
+ NodePtr *np;
unsigned i;
int comp;
unsigned int fp = 0;
np = &atomRoot;
- for (i = 0; i < (len+1)/2; i++)
- {
- fp = fp * 27 + string[i];
- fp = fp * 27 + string[len - 1 - i];
+ for (i = 0; i < (len + 1) / 2; i++) {
+ fp = fp * 27 + string[i];
+ fp = fp * 27 + string[len - 1 - i];
}
- while (*np != NULL)
- {
- if (fp < (*np)->fingerPrint)
- np = &((*np)->left);
- else if (fp > (*np)->fingerPrint)
- np = &((*np)->right);
- else
- { /* now start testing the strings */
- comp = strncmp(string, (*np)->string, (int)len);
- if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string))))
- np = &((*np)->left);
- else if (comp > 0)
- np = &((*np)->right);
- else
- return(*np)->a;
- }
+ while (*np != NULL) {
+ if (fp < (*np)->fingerPrint)
+ np = &((*np)->left);
+ else if (fp > (*np)->fingerPrint)
+ np = &((*np)->right);
+ else { /* now start testing the strings */
+ comp = strncmp(string, (*np)->string, (int) len);
+ if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string))))
+ np = &((*np)->left);
+ else if (comp > 0)
+ np = &((*np)->right);
+ else
+ return (*np)->a;
+ }
}
- if (makeit)
- {
- NodePtr nd;
-
- nd = malloc(sizeof(NodeRec));
- if (!nd)
- return BAD_RESOURCE;
- if (lastAtom < XA_LAST_PREDEFINED)
- {
- nd->string = string;
- }
- else
- {
- nd->string = strndup(string, len);
- if (!nd->string) {
- free(nd);
- return BAD_RESOURCE;
- }
- }
- if ((lastAtom + 1) >= tableLength) {
- NodePtr *table;
-
- table = realloc(nodeTable, tableLength * (2 * sizeof(NodePtr)));
- if (!table) {
- if (nd->string != string) {
+ if (makeit) {
+ NodePtr nd;
+
+ nd = malloc(sizeof(NodeRec));
+ if (!nd)
+ return BAD_RESOURCE;
+ if (lastAtom < XA_LAST_PREDEFINED) {
+ nd->string = string;
+ }
+ else {
+ nd->string = strndup(string, len);
+ if (!nd->string) {
+ free(nd);
+ return BAD_RESOURCE;
+ }
+ }
+ if ((lastAtom + 1) >= tableLength) {
+ NodePtr *table;
+
+ table = realloc(nodeTable, tableLength * (2 * sizeof(NodePtr)));
+ if (!table) {
+ if (nd->string != string) {
/* nd->string has been strdup'ed */
- free((char *)nd->string);
+ free((char *) nd->string);
}
- free(nd);
- return BAD_RESOURCE;
- }
- tableLength <<= 1;
- nodeTable = table;
- }
- *np = nd;
- nd->left = nd->right = NULL;
- nd->fingerPrint = fp;
- nd->a = ++lastAtom;
- nodeTable[lastAtom] = nd;
- return nd->a;
+ free(nd);
+ return BAD_RESOURCE;
+ }
+ tableLength <<= 1;
+ nodeTable = table;
+ }
+ *np = nd;
+ nd->left = nd->right = NULL;
+ nd->fingerPrint = fp;
+ nd->a = ++lastAtom;
+ nodeTable[lastAtom] = nd;
+ return nd->a;
}
else
- return None;
+ return None;
}
Bool
@@ -160,8 +152,11 @@ const char *
NameForAtom(Atom atom)
{
NodePtr node;
- if (atom > lastAtom) return 0;
- if ((node = nodeTable[atom]) == NULL) return 0;
+
+ if (atom > lastAtom)
+ return 0;
+ if ((node = nodeTable[atom]) == NULL)
+ return 0;
return node->string;
}
@@ -174,16 +169,16 @@ AtomError(void)
void
FreeAtom(NodePtr patom)
{
- if(patom->left)
- FreeAtom(patom->left);
- if(patom->right)
- FreeAtom(patom->right);
+ if (patom->left)
+ FreeAtom(patom->left);
+ if (patom->right)
+ FreeAtom(patom->right);
if (patom->a > XA_LAST_PREDEFINED) {
/*
* All strings above XA_LAST_PREDEFINED are strdup'ed, so it's safe to
* cast here
*/
- free((char *)patom->string);
+ free((char *) patom->string);
}
free(patom);
}
@@ -192,7 +187,7 @@ void
FreeAllAtoms(void)
{
if (atomRoot == NULL)
- return;
+ return;
FreeAtom(atomRoot);
atomRoot = NULL;
free(nodeTable);
@@ -207,9 +202,9 @@ InitAtoms(void)
tableLength = InitialTableSize;
nodeTable = malloc(InitialTableSize * sizeof(NodePtr));
if (!nodeTable)
- AtomError();
+ AtomError();
nodeTable[None] = NULL;
MakePredeclaredAtoms();
if (lastAtom != XA_LAST_PREDEFINED)
- AtomError();
+ AtomError();
}
diff --git a/xorg-server/dix/colormap.c b/xorg-server/dix/colormap.c
index 618da444a..02937fb72 100644
--- a/xorg-server/dix/colormap.c
+++ b/xorg-server/dix/colormap.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -45,7 +44,6 @@ SOFTWARE.
******************************************************************/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -70,126 +68,110 @@ SOFTWARE.
#define UpdateColors thisUpdateColors
#endif
-static Pixel FindBestPixel(
- EntryPtr /*pentFirst*/,
- int /*size*/,
- xrgb * /*prgb*/,
- int /*channel*/
-);
-
-static int AllComp(
- EntryPtr /*pent*/,
- xrgb * /*prgb*/
-);
-
-static int RedComp(
- EntryPtr /*pent*/,
- xrgb * /*prgb*/
-);
-
-static int GreenComp(
- EntryPtr /*pent*/,
- xrgb * /*prgb*/
-);
-
-static int BlueComp(
- EntryPtr /*pent*/,
- xrgb * /*prgb*/
-);
-
-static void FreePixels(
- ColormapPtr /*pmap*/,
- int /*client*/
-);
-
-static void CopyFree(
- int /*channel*/,
- int /*client*/,
- ColormapPtr /*pmapSrc*/,
- ColormapPtr /*pmapDst*/
-);
-
-static void FreeCell(
- ColormapPtr /*pmap*/,
- Pixel /*i*/,
- int /*channel*/
-);
-
-static void UpdateColors(
- ColormapPtr /*pmap*/
-);
-
-static int AllocDirect(
- int /*client*/,
- ColormapPtr /*pmap*/,
- int /*c*/,
- int /*r*/,
- int /*g*/,
- int /*b*/,
- Bool /*contig*/,
- Pixel * /*pixels*/,
- Pixel * /*prmask*/,
- Pixel * /*pgmask*/,
- Pixel * /*pbmask*/
-);
-
-static int AllocPseudo(
- int /*client*/,
- ColormapPtr /*pmap*/,
- int /*c*/,
- int /*r*/,
- Bool /*contig*/,
- Pixel * /*pixels*/,
- Pixel * /*pmask*/,
- Pixel ** /*pppixFirst*/
-);
-
-static Bool AllocCP(
- ColormapPtr /*pmap*/,
- EntryPtr /*pentFirst*/,
- int /*count*/,
- int /*planes*/,
- Bool /*contig*/,
- Pixel * /*pixels*/,
- Pixel * /*pMask*/
-);
-
-static Bool AllocShared(
- ColormapPtr /*pmap*/,
- Pixel * /*ppix*/,
- int /*c*/,
- int /*r*/,
- int /*g*/,
- int /*b*/,
- Pixel /*rmask*/,
- Pixel /*gmask*/,
- Pixel /*bmask*/,
- Pixel * /*ppixFirst*/
-);
-
-static int FreeCo(
- ColormapPtr /*pmap*/,
- int /*client*/,
- int /*color*/,
- int /*npixIn*/,
- Pixel * /*ppixIn*/,
- Pixel /*mask*/
-);
-
-static int TellNoMap(
- WindowPtr /*pwin*/,
- Colormap * /*pmid*/
-);
-
-static void FindColorInRootCmap (
- ColormapPtr /* pmap */,
- EntryPtr /* pentFirst */,
- int /* size */,
- xrgb* /* prgb */,
- Pixel* /* pPixel */,
- int /* channel */,
- ColorCompareProcPtr /* comp */
-);
+static Pixel FindBestPixel(EntryPtr /*pentFirst */ ,
+ int /*size */ ,
+ xrgb * /*prgb */ ,
+ int /*channel */
+ );
+
+static int AllComp(EntryPtr /*pent */ ,
+ xrgb * /*prgb */
+ );
+
+static int RedComp(EntryPtr /*pent */ ,
+ xrgb * /*prgb */
+ );
+
+static int GreenComp(EntryPtr /*pent */ ,
+ xrgb * /*prgb */
+ );
+
+static int BlueComp(EntryPtr /*pent */ ,
+ xrgb * /*prgb */
+ );
+
+static void FreePixels(ColormapPtr /*pmap */ ,
+ int /*client */
+ );
+
+static void CopyFree(int /*channel */ ,
+ int /*client */ ,
+ ColormapPtr /*pmapSrc */ ,
+ ColormapPtr /*pmapDst */
+ );
+
+static void FreeCell(ColormapPtr /*pmap */ ,
+ Pixel /*i */ ,
+ int /*channel */
+ );
+
+static void UpdateColors(ColormapPtr /*pmap */
+ );
+
+static int AllocDirect(int /*client */ ,
+ ColormapPtr /*pmap */ ,
+ int /*c */ ,
+ int /*r */ ,
+ int /*g */ ,
+ int /*b */ ,
+ Bool /*contig */ ,
+ Pixel * /*pixels */ ,
+ Pixel * /*prmask */ ,
+ Pixel * /*pgmask */ ,
+ Pixel * /*pbmask */
+ );
+
+static int AllocPseudo(int /*client */ ,
+ ColormapPtr /*pmap */ ,
+ int /*c */ ,
+ int /*r */ ,
+ Bool /*contig */ ,
+ Pixel * /*pixels */ ,
+ Pixel * /*pmask */ ,
+ Pixel ** /*pppixFirst */
+ );
+
+static Bool AllocCP(ColormapPtr /*pmap */ ,
+ EntryPtr /*pentFirst */ ,
+ int /*count */ ,
+ int /*planes */ ,
+ Bool /*contig */ ,
+ Pixel * /*pixels */ ,
+ Pixel * /*pMask */
+ );
+
+static Bool AllocShared(ColormapPtr /*pmap */ ,
+ Pixel * /*ppix */ ,
+ int /*c */ ,
+ int /*r */ ,
+ int /*g */ ,
+ int /*b */ ,
+ Pixel /*rmask */ ,
+ Pixel /*gmask */ ,
+ Pixel /*bmask */ ,
+ Pixel * /*ppixFirst */
+ );
+
+static int FreeCo(ColormapPtr /*pmap */ ,
+ int /*client */ ,
+ int /*color */ ,
+ int /*npixIn */ ,
+ Pixel * /*ppixIn */ ,
+ Pixel /*mask */
+ );
+
+static int TellNoMap(WindowPtr /*pwin */ ,
+ Colormap * /*pmid */
+ );
+
+static void FindColorInRootCmap(ColormapPtr /* pmap */ ,
+ EntryPtr /* pentFirst */ ,
+ int /* size */ ,
+ xrgb * /* prgb */ ,
+ Pixel * /* pPixel */ ,
+ int /* channel */ ,
+ ColorCompareProcPtr /* comp */
+ );
#define NUMRED(vis) ((vis->redMask >> vis->offsetRed) + 1)
#define NUMGREEN(vis) ((vis->greenMask >> vis->offsetGreen) + 1)
@@ -231,14 +213,13 @@ static void FindColorInRootCmap (
break; \
(bits) += (base); \
while((bits) & ~(mask)) \
- (bits) += ((bits) & ~(mask));
+ (bits) += ((bits) & ~(mask));
/* ID of server as client */
#define SERVER_ID 0
-typedef struct _colorResource
-{
- Colormap mid;
- int client;
+typedef struct _colorResource {
+ Colormap mid;
+ int client;
} colorResource;
/* Invariants:
@@ -248,7 +229,6 @@ typedef struct _colorResource
* fShared should only be set if refcnt == AllocPrivate, and only in red map
*/
-
/**
* Create and initialize the color map
*
@@ -256,165 +236,160 @@ typedef struct _colorResource
* \param alloc 1 iff all entries are allocated writable
*/
int
-CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
- ColormapPtr *ppcmap, int alloc, int client)
+CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
+ ColormapPtr *ppcmap, int alloc, int client)
{
- int class, size;
+ int class, size;
unsigned long sizebytes;
- ColormapPtr pmap;
- EntryPtr pent;
- int i;
- Pixel *ppix, **pptr;
+ ColormapPtr pmap;
+ EntryPtr pent;
+ int i;
+ Pixel *ppix, **pptr;
class = pVisual->class;
- if(!(class & DynamicClass) && (alloc != AllocNone) && (client != SERVER_ID))
- return BadMatch;
+ if (!(class & DynamicClass) && (alloc != AllocNone) &&
+ (client != SERVER_ID))
+ return BadMatch;
size = pVisual->ColormapEntries;
sizebytes = (size * sizeof(Entry)) +
- (MAXCLIENTS * sizeof(Pixel *)) +
- (MAXCLIENTS * sizeof(int));
+ (MAXCLIENTS * sizeof(Pixel *)) + (MAXCLIENTS * sizeof(int));
if ((class | DynamicClass) == DirectColor)
- sizebytes *= 3;
+ sizebytes *= 3;
sizebytes += sizeof(ColormapRec);
if (mid == pScreen->defColormap) {
- pmap = malloc(sizebytes);
- if (!pmap)
- return BadAlloc;
- if (!dixAllocatePrivates(&pmap->devPrivates, PRIVATE_COLORMAP)) {
- free (pmap);
- return BadAlloc;
- }
- } else {
- pmap = _dixAllocateObjectWithPrivates(sizebytes, sizebytes,
- offsetof(ColormapRec, devPrivates), PRIVATE_COLORMAP);
- if (!pmap)
- return BadAlloc;
- }
- pmap->red = (EntryPtr)((char *)pmap + sizeof(ColormapRec));
+ pmap = malloc(sizebytes);
+ if (!pmap)
+ return BadAlloc;
+ if (!dixAllocatePrivates(&pmap->devPrivates, PRIVATE_COLORMAP)) {
+ free(pmap);
+ return BadAlloc;
+ }
+ }
+ else {
+ pmap = _dixAllocateObjectWithPrivates(sizebytes, sizebytes,
+ offsetof(ColormapRec,
+ devPrivates),
+ PRIVATE_COLORMAP);
+ if (!pmap)
+ return BadAlloc;
+ }
+ pmap->red = (EntryPtr) ((char *) pmap + sizeof(ColormapRec));
sizebytes = size * sizeof(Entry);
- pmap->clientPixelsRed = (Pixel **)((char *)pmap->red + sizebytes);
- pmap->numPixelsRed = (int *)((char *)pmap->clientPixelsRed +
- (MAXCLIENTS * sizeof(Pixel *)));
+ pmap->clientPixelsRed = (Pixel **) ((char *) pmap->red + sizebytes);
+ pmap->numPixelsRed = (int *) ((char *) pmap->clientPixelsRed +
+ (MAXCLIENTS * sizeof(Pixel *)));
pmap->mid = mid;
- pmap->flags = 0; /* start out with all flags clear */
- if(mid == pScreen->defColormap)
- pmap->flags |= IsDefault;
+ pmap->flags = 0; /* start out with all flags clear */
+ if (mid == pScreen->defColormap)
+ pmap->flags |= IsDefault;
pmap->pScreen = pScreen;
pmap->pVisual = pVisual;
pmap->class = class;
if ((class | DynamicClass) == DirectColor)
- size = NUMRED(pVisual);
+ size = NUMRED(pVisual);
pmap->freeRed = size;
- memset((char *) pmap->red, 0, (int)sizebytes);
+ memset((char *) pmap->red, 0, (int) sizebytes);
memset((char *) pmap->numPixelsRed, 0, MAXCLIENTS * sizeof(int));
- for (pptr = &pmap->clientPixelsRed[MAXCLIENTS]; --pptr >= pmap->clientPixelsRed; )
- *pptr = (Pixel *)NULL;
- if (alloc == AllocAll)
- {
- if (class & DynamicClass)
- pmap->flags |= AllAllocated;
- for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--)
- pent->refcnt = AllocPrivate;
- pmap->freeRed = 0;
- ppix = malloc(size * sizeof(Pixel));
- if (!ppix)
- {
- free(pmap);
- return BadAlloc;
- }
- pmap->clientPixelsRed[client] = ppix;
- for(i = 0; i < size; i++)
- ppix[i] = i;
- pmap->numPixelsRed[client] = size;
- }
-
- if ((class | DynamicClass) == DirectColor)
- {
- pmap->freeGreen = NUMGREEN(pVisual);
- pmap->green = (EntryPtr)((char *)pmap->numPixelsRed +
- (MAXCLIENTS * sizeof(int)));
- pmap->clientPixelsGreen = (Pixel **)((char *)pmap->green + sizebytes);
- pmap->numPixelsGreen = (int *)((char *)pmap->clientPixelsGreen +
- (MAXCLIENTS * sizeof(Pixel *)));
- pmap->freeBlue = NUMBLUE(pVisual);
- pmap->blue = (EntryPtr)((char *)pmap->numPixelsGreen +
- (MAXCLIENTS * sizeof(int)));
- pmap->clientPixelsBlue = (Pixel **)((char *)pmap->blue + sizebytes);
- pmap->numPixelsBlue = (int *)((char *)pmap->clientPixelsBlue +
- (MAXCLIENTS * sizeof(Pixel *)));
-
- memset((char *) pmap->green, 0, (int)sizebytes);
- memset((char *) pmap->blue, 0, (int)sizebytes);
-
- memmove((char *) pmap->clientPixelsGreen,
- (char *) pmap->clientPixelsRed,
- MAXCLIENTS * sizeof(Pixel *));
- memmove((char *) pmap->clientPixelsBlue,
- (char *) pmap->clientPixelsRed,
- MAXCLIENTS * sizeof(Pixel *));
- memset((char *) pmap->numPixelsGreen, 0, MAXCLIENTS * sizeof(int));
- memset((char *) pmap->numPixelsBlue, 0, MAXCLIENTS * sizeof(int));
-
- /* If every cell is allocated, mark its refcnt */
- if (alloc == AllocAll)
- {
- size = pmap->freeGreen;
- for(pent = &pmap->green[size-1]; pent >= pmap->green; pent--)
- pent->refcnt = AllocPrivate;
- pmap->freeGreen = 0;
- ppix = malloc(size * sizeof(Pixel));
- if (!ppix)
- {
- free(pmap->clientPixelsRed[client]);
- free(pmap);
- return BadAlloc;
- }
- pmap->clientPixelsGreen[client] = ppix;
- for(i = 0; i < size; i++)
- ppix[i] = i;
- pmap->numPixelsGreen[client] = size;
-
- size = pmap->freeBlue;
- for(pent = &pmap->blue[size-1]; pent >= pmap->blue; pent--)
- pent->refcnt = AllocPrivate;
- pmap->freeBlue = 0;
- ppix = malloc(size * sizeof(Pixel));
- if (!ppix)
- {
- free(pmap->clientPixelsGreen[client]);
- free(pmap->clientPixelsRed[client]);
- free(pmap);
- return BadAlloc;
- }
- pmap->clientPixelsBlue[client] = ppix;
- for(i = 0; i < size; i++)
- ppix[i] = i;
- pmap->numPixelsBlue[client] = size;
- }
+ for (pptr = &pmap->clientPixelsRed[MAXCLIENTS];
+ --pptr >= pmap->clientPixelsRed;)
+ *pptr = (Pixel *) NULL;
+ if (alloc == AllocAll) {
+ if (class & DynamicClass)
+ pmap->flags |= AllAllocated;
+ for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--)
+ pent->refcnt = AllocPrivate;
+ pmap->freeRed = 0;
+ ppix = malloc(size * sizeof(Pixel));
+ if (!ppix) {
+ free(pmap);
+ return BadAlloc;
+ }
+ pmap->clientPixelsRed[client] = ppix;
+ for (i = 0; i < size; i++)
+ ppix[i] = i;
+ pmap->numPixelsRed[client] = size;
+ }
+
+ if ((class | DynamicClass) == DirectColor) {
+ pmap->freeGreen = NUMGREEN(pVisual);
+ pmap->green = (EntryPtr) ((char *) pmap->numPixelsRed +
+ (MAXCLIENTS * sizeof(int)));
+ pmap->clientPixelsGreen = (Pixel **) ((char *) pmap->green + sizebytes);
+ pmap->numPixelsGreen = (int *) ((char *) pmap->clientPixelsGreen +
+ (MAXCLIENTS * sizeof(Pixel *)));
+ pmap->freeBlue = NUMBLUE(pVisual);
+ pmap->blue = (EntryPtr) ((char *) pmap->numPixelsGreen +
+ (MAXCLIENTS * sizeof(int)));
+ pmap->clientPixelsBlue = (Pixel **) ((char *) pmap->blue + sizebytes);
+ pmap->numPixelsBlue = (int *) ((char *) pmap->clientPixelsBlue +
+ (MAXCLIENTS * sizeof(Pixel *)));
+
+ memset((char *) pmap->green, 0, (int) sizebytes);
+ memset((char *) pmap->blue, 0, (int) sizebytes);
+
+ memmove((char *) pmap->clientPixelsGreen,
+ (char *) pmap->clientPixelsRed, MAXCLIENTS * sizeof(Pixel *));
+ memmove((char *) pmap->clientPixelsBlue,
+ (char *) pmap->clientPixelsRed, MAXCLIENTS * sizeof(Pixel *));
+ memset((char *) pmap->numPixelsGreen, 0, MAXCLIENTS * sizeof(int));
+ memset((char *) pmap->numPixelsBlue, 0, MAXCLIENTS * sizeof(int));
+
+ /* If every cell is allocated, mark its refcnt */
+ if (alloc == AllocAll) {
+ size = pmap->freeGreen;
+ for (pent = &pmap->green[size - 1]; pent >= pmap->green; pent--)
+ pent->refcnt = AllocPrivate;
+ pmap->freeGreen = 0;
+ ppix = malloc(size * sizeof(Pixel));
+ if (!ppix) {
+ free(pmap->clientPixelsRed[client]);
+ free(pmap);
+ return BadAlloc;
+ }
+ pmap->clientPixelsGreen[client] = ppix;
+ for (i = 0; i < size; i++)
+ ppix[i] = i;
+ pmap->numPixelsGreen[client] = size;
+
+ size = pmap->freeBlue;
+ for (pent = &pmap->blue[size - 1]; pent >= pmap->blue; pent--)
+ pent->refcnt = AllocPrivate;
+ pmap->freeBlue = 0;
+ ppix = malloc(size * sizeof(Pixel));
+ if (!ppix) {
+ free(pmap->clientPixelsGreen[client]);
+ free(pmap->clientPixelsRed[client]);
+ free(pmap);
+ return BadAlloc;
+ }
+ pmap->clientPixelsBlue[client] = ppix;
+ for (i = 0; i < size; i++)
+ ppix[i] = i;
+ pmap->numPixelsBlue[client] = size;
+ }
}
pmap->flags |= BeingCreated;
- if (!AddResource(mid, RT_COLORMAP, (pointer)pmap))
- return BadAlloc;
+ if (!AddResource(mid, RT_COLORMAP, (pointer) pmap))
+ return BadAlloc;
/*
* Security creation/labeling check
*/
i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, RT_COLORMAP,
- pmap, RT_NONE, NULL, DixCreateAccess);
+ pmap, RT_NONE, NULL, DixCreateAccess);
if (i != Success) {
- FreeResource(mid, RT_NONE);
- return i;
+ FreeResource(mid, RT_NONE);
+ return i;
}
/* If the device wants a chance to initialize the colormap in any way,
* this is it. In specific, if this is a Static colormap, this is the
* time to fill in the colormap's values */
- if (!(*pScreen->CreateColormap)(pmap))
- {
- FreeResource (mid, RT_NONE);
- return BadAlloc;
+ if (!(*pScreen->CreateColormap) (pmap)) {
+ FreeResource(mid, RT_NONE);
+ return BadAlloc;
}
pmap->flags &= ~BeingCreated;
*ppcmap = pmap;
@@ -426,84 +401,76 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
* \param value must conform to DeleteType
*/
int
-FreeColormap (pointer value, XID mid)
+FreeColormap(pointer value, XID mid)
{
- int i;
+ int i;
EntryPtr pent;
- ColormapPtr pmap = (ColormapPtr)value;
+ ColormapPtr pmap = (ColormapPtr) value;
- if(CLIENT_ID(mid) != SERVER_ID)
- {
+ if (CLIENT_ID(mid) != SERVER_ID) {
(*pmap->pScreen->UninstallColormap) (pmap);
- WalkTree(pmap->pScreen, (VisitWindowProcPtr)TellNoMap, (pointer) &mid);
+ WalkTree(pmap->pScreen, (VisitWindowProcPtr) TellNoMap, (pointer) &mid);
}
/* This is the device's chance to undo anything it needs to, especially
* to free any storage it allocated */
- (*pmap->pScreen->DestroyColormap)(pmap);
-
- if(pmap->clientPixelsRed)
- {
- for(i = 0; i < MAXCLIENTS; i++)
- free(pmap->clientPixelsRed[i]);
- }
-
- if ((pmap->class == PseudoColor) || (pmap->class == GrayScale))
- {
- for(pent = &pmap->red[pmap->pVisual->ColormapEntries - 1];
- pent >= pmap->red;
- pent--)
- {
- if(pent->fShared)
- {
- if (--pent->co.shco.red->refcnt == 0)
- free(pent->co.shco.red);
- if (--pent->co.shco.green->refcnt == 0)
- free(pent->co.shco.green);
- if (--pent->co.shco.blue->refcnt == 0)
- free(pent->co.shco.blue);
- }
- }
- }
- if((pmap->class | DynamicClass) == DirectColor)
- {
- for(i = 0; i < MAXCLIENTS; i++)
- {
+ (*pmap->pScreen->DestroyColormap) (pmap);
+
+ if (pmap->clientPixelsRed) {
+ for (i = 0; i < MAXCLIENTS; i++)
+ free(pmap->clientPixelsRed[i]);
+ }
+
+ if ((pmap->class == PseudoColor) || (pmap->class == GrayScale)) {
+ for (pent = &pmap->red[pmap->pVisual->ColormapEntries - 1];
+ pent >= pmap->red; pent--) {
+ if (pent->fShared) {
+ if (--pent->co.shco.red->refcnt == 0)
+ free(pent->co.shco.red);
+ if (--pent->co.shco.green->refcnt == 0)
+ free(pent->co.shco.green);
+ if (--pent->co.shco.blue->refcnt == 0)
+ free(pent->co.shco.blue);
+ }
+ }
+ }
+ if ((pmap->class | DynamicClass) == DirectColor) {
+ for (i = 0; i < MAXCLIENTS; i++) {
free(pmap->clientPixelsGreen[i]);
free(pmap->clientPixelsBlue[i]);
}
}
if (pmap->flags & IsDefault) {
- dixFreePrivates(pmap->devPrivates, PRIVATE_COLORMAP);
- free(pmap);
- } else
- dixFreeObjectWithPrivates(pmap, PRIVATE_COLORMAP);
+ dixFreePrivates(pmap->devPrivates, PRIVATE_COLORMAP);
+ free(pmap);
+ }
+ else
+ dixFreeObjectWithPrivates(pmap, PRIVATE_COLORMAP);
return Success;
}
/* Tell window that pmid has disappeared */
static int
-TellNoMap (WindowPtr pwin, Colormap *pmid)
+TellNoMap(WindowPtr pwin, Colormap * pmid)
{
- xEvent xE;
-
- if (wColormap(pwin) == *pmid)
- {
- /* This should be call to DeliverEvent */
- xE.u.u.type = ColormapNotify;
- xE.u.colormap.window = pwin->drawable.id;
- xE.u.colormap.colormap = None;
- xE.u.colormap.new = TRUE;
- xE.u.colormap.state = ColormapUninstalled;
+ xEvent xE;
+
+ if (wColormap(pwin) == *pmid) {
+ /* This should be call to DeliverEvent */
+ xE.u.u.type = ColormapNotify;
+ xE.u.colormap.window = pwin->drawable.id;
+ xE.u.colormap.colormap = None;
+ xE.u.colormap.new = TRUE;
+ xE.u.colormap.state = ColormapUninstalled;
#ifdef PANORAMIX
- if(noPanoramiXExtension || !pwin->drawable.pScreen->myNum)
+ if (noPanoramiXExtension || !pwin->drawable.pScreen->myNum)
#endif
- DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL);
- if (pwin->optional) {
- pwin->optional->colormap = None;
- CheckWindowOptionalNeed (pwin);
- }
+ DeliverEvents(pwin, &xE, 1, (WindowPtr) NULL);
+ if (pwin->optional) {
+ pwin->optional->colormap = None;
+ CheckWindowOptionalNeed(pwin);
+ }
}
return WT_WALKCHILDREN;
@@ -511,24 +478,23 @@ TellNoMap (WindowPtr pwin, Colormap *pmid)
/* Tell window that pmid got uninstalled */
int
-TellLostMap (WindowPtr pwin, pointer value)
+TellLostMap(WindowPtr pwin, pointer value)
{
- Colormap *pmid = (Colormap *)value;
- xEvent xE;
+ Colormap *pmid = (Colormap *) value;
+ xEvent xE;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
- return WT_STOPWALKING;
+ if (!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
+ return WT_STOPWALKING;
#endif
- if (wColormap(pwin) == *pmid)
- {
- /* This should be call to DeliverEvent */
- xE.u.u.type = ColormapNotify;
- xE.u.colormap.window = pwin->drawable.id;
- xE.u.colormap.colormap = *pmid;
- xE.u.colormap.new = FALSE;
- xE.u.colormap.state = ColormapUninstalled;
- DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL);
+ if (wColormap(pwin) == *pmid) {
+ /* This should be call to DeliverEvent */
+ xE.u.u.type = ColormapNotify;
+ xE.u.colormap.window = pwin->drawable.id;
+ xE.u.colormap.colormap = *pmid;
+ xE.u.colormap.new = FALSE;
+ xE.u.colormap.state = ColormapUninstalled;
+ DeliverEvents(pwin, &xE, 1, (WindowPtr) NULL);
}
return WT_WALKCHILDREN;
@@ -536,272 +502,251 @@ TellLostMap (WindowPtr pwin, pointer value)
/* Tell window that pmid got installed */
int
-TellGainedMap (WindowPtr pwin, pointer value)
+TellGainedMap(WindowPtr pwin, pointer value)
{
- Colormap *pmid = (Colormap *)value;
- xEvent xE;
+ Colormap *pmid = (Colormap *) value;
+ xEvent xE;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
- return WT_STOPWALKING;
+ if (!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
+ return WT_STOPWALKING;
#endif
- if (wColormap (pwin) == *pmid)
- {
- /* This should be call to DeliverEvent */
- xE.u.u.type = ColormapNotify;
- xE.u.colormap.window = pwin->drawable.id;
- xE.u.colormap.colormap = *pmid;
- xE.u.colormap.new = FALSE;
- xE.u.colormap.state = ColormapInstalled;
- DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL);
+ if (wColormap(pwin) == *pmid) {
+ /* This should be call to DeliverEvent */
+ xE.u.u.type = ColormapNotify;
+ xE.u.colormap.window = pwin->drawable.id;
+ xE.u.colormap.colormap = *pmid;
+ xE.u.colormap.new = FALSE;
+ xE.u.colormap.state = ColormapInstalled;
+ DeliverEvents(pwin, &xE, 1, (WindowPtr) NULL);
}
return WT_WALKCHILDREN;
}
-
int
-CopyColormapAndFree (Colormap mid, ColormapPtr pSrc, int client)
+CopyColormapAndFree(Colormap mid, ColormapPtr pSrc, int client)
{
- ColormapPtr pmap = (ColormapPtr) NULL;
- int result, alloc, size;
- Colormap midSrc;
- ScreenPtr pScreen;
- VisualPtr pVisual;
+ ColormapPtr pmap = (ColormapPtr) NULL;
+ int result, alloc, size;
+ Colormap midSrc;
+ ScreenPtr pScreen;
+ VisualPtr pVisual;
pScreen = pSrc->pScreen;
pVisual = pSrc->pVisual;
midSrc = pSrc->mid;
alloc = ((pSrc->flags & AllAllocated) && CLIENT_ID(midSrc) == client) ?
- AllocAll : AllocNone;
+ AllocAll : AllocNone;
size = pVisual->ColormapEntries;
/* If the create returns non-0, it failed */
- result = CreateColormap (mid, pScreen, pVisual, &pmap, alloc, client);
- if(result != Success)
+ result = CreateColormap(mid, pScreen, pVisual, &pmap, alloc, client);
+ if (result != Success)
return result;
- if(alloc == AllocAll)
- {
- memmove((char *)pmap->red, (char *)pSrc->red, size * sizeof(Entry));
- if((pmap->class | DynamicClass) == DirectColor)
- {
- memmove((char *)pmap->green, (char *)pSrc->green, size * sizeof(Entry));
- memmove((char *)pmap->blue, (char *)pSrc->blue, size * sizeof(Entry));
- }
- pSrc->flags &= ~AllAllocated;
- FreePixels(pSrc, client);
- UpdateColors(pmap);
- return Success;
+ if (alloc == AllocAll) {
+ memmove((char *) pmap->red, (char *) pSrc->red, size * sizeof(Entry));
+ if ((pmap->class | DynamicClass) == DirectColor) {
+ memmove((char *) pmap->green, (char *) pSrc->green,
+ size * sizeof(Entry));
+ memmove((char *) pmap->blue, (char *) pSrc->blue,
+ size * sizeof(Entry));
+ }
+ pSrc->flags &= ~AllAllocated;
+ FreePixels(pSrc, client);
+ UpdateColors(pmap);
+ return Success;
}
CopyFree(REDMAP, client, pSrc, pmap);
- if ((pmap->class | DynamicClass) == DirectColor)
- {
- CopyFree(GREENMAP, client, pSrc, pmap);
- CopyFree(BLUEMAP, client, pSrc, pmap);
+ if ((pmap->class | DynamicClass) == DirectColor) {
+ CopyFree(GREENMAP, client, pSrc, pmap);
+ CopyFree(BLUEMAP, client, pSrc, pmap);
}
if (pmap->class & DynamicClass)
- UpdateColors(pmap);
+ UpdateColors(pmap);
/* XXX should worry about removing any RT_CMAPENTRY resource */
return Success;
}
/* Helper routine for freeing large numbers of cells from a map */
static void
-CopyFree (int channel, int client, ColormapPtr pmapSrc, ColormapPtr pmapDst)
+CopyFree(int channel, int client, ColormapPtr pmapSrc, ColormapPtr pmapDst)
{
- int z, npix;
- EntryPtr pentSrcFirst, pentDstFirst;
- EntryPtr pentSrc, pentDst;
- Pixel *ppix;
- int nalloc;
-
- switch(channel)
- {
- default: /* so compiler can see that everything gets initialized */
- case REDMAP:
- ppix = (pmapSrc->clientPixelsRed)[client];
- npix = (pmapSrc->numPixelsRed)[client];
- pentSrcFirst = pmapSrc->red;
- pentDstFirst = pmapDst->red;
- break;
- case GREENMAP:
- ppix = (pmapSrc->clientPixelsGreen)[client];
- npix = (pmapSrc->numPixelsGreen)[client];
- pentSrcFirst = pmapSrc->green;
- pentDstFirst = pmapDst->green;
- break;
- case BLUEMAP:
- ppix = (pmapSrc->clientPixelsBlue)[client];
- npix = (pmapSrc->numPixelsBlue)[client];
- pentSrcFirst = pmapSrc->blue;
- pentDstFirst = pmapDst->blue;
- break;
+ int z, npix;
+ EntryPtr pentSrcFirst, pentDstFirst;
+ EntryPtr pentSrc, pentDst;
+ Pixel *ppix;
+ int nalloc;
+
+ switch (channel) {
+ default: /* so compiler can see that everything gets initialized */
+ case REDMAP:
+ ppix = (pmapSrc->clientPixelsRed)[client];
+ npix = (pmapSrc->numPixelsRed)[client];
+ pentSrcFirst = pmapSrc->red;
+ pentDstFirst = pmapDst->red;
+ break;
+ case GREENMAP:
+ ppix = (pmapSrc->clientPixelsGreen)[client];
+ npix = (pmapSrc->numPixelsGreen)[client];
+ pentSrcFirst = pmapSrc->green;
+ pentDstFirst = pmapDst->green;
+ break;
+ case BLUEMAP:
+ ppix = (pmapSrc->clientPixelsBlue)[client];
+ npix = (pmapSrc->numPixelsBlue)[client];
+ pentSrcFirst = pmapSrc->blue;
+ pentDstFirst = pmapDst->blue;
+ break;
}
nalloc = 0;
- if (pmapSrc->class & DynamicClass)
- {
- for(z = npix; --z >= 0; ppix++)
- {
- /* Copy entries */
- pentSrc = pentSrcFirst + *ppix;
- pentDst = pentDstFirst + *ppix;
- if (pentDst->refcnt > 0)
- {
- pentDst->refcnt++;
- }
- else
- {
- *pentDst = *pentSrc;
- nalloc++;
- if (pentSrc->refcnt > 0)
- pentDst->refcnt = 1;
- else
- pentSrc->fShared = FALSE;
- }
- FreeCell(pmapSrc, *ppix, channel);
- }
+ if (pmapSrc->class & DynamicClass) {
+ for (z = npix; --z >= 0; ppix++) {
+ /* Copy entries */
+ pentSrc = pentSrcFirst + *ppix;
+ pentDst = pentDstFirst + *ppix;
+ if (pentDst->refcnt > 0) {
+ pentDst->refcnt++;
+ }
+ else {
+ *pentDst = *pentSrc;
+ nalloc++;
+ if (pentSrc->refcnt > 0)
+ pentDst->refcnt = 1;
+ else
+ pentSrc->fShared = FALSE;
+ }
+ FreeCell(pmapSrc, *ppix, channel);
+ }
}
/* Note that FreeCell has already fixed pmapSrc->free{Color} */
- switch(channel)
- {
- case REDMAP:
+ switch (channel) {
+ case REDMAP:
pmapDst->freeRed -= nalloc;
- (pmapDst->clientPixelsRed)[client] =
- (pmapSrc->clientPixelsRed)[client];
+ (pmapDst->clientPixelsRed)[client] = (pmapSrc->clientPixelsRed)[client];
(pmapSrc->clientPixelsRed)[client] = (Pixel *) NULL;
(pmapDst->numPixelsRed)[client] = (pmapSrc->numPixelsRed)[client];
(pmapSrc->numPixelsRed)[client] = 0;
- break;
- case GREENMAP:
+ break;
+ case GREENMAP:
pmapDst->freeGreen -= nalloc;
(pmapDst->clientPixelsGreen)[client] =
- (pmapSrc->clientPixelsGreen)[client];
+ (pmapSrc->clientPixelsGreen)[client];
(pmapSrc->clientPixelsGreen)[client] = (Pixel *) NULL;
(pmapDst->numPixelsGreen)[client] = (pmapSrc->numPixelsGreen)[client];
(pmapSrc->numPixelsGreen)[client] = 0;
- break;
- case BLUEMAP:
+ break;
+ case BLUEMAP:
pmapDst->freeBlue -= nalloc;
pmapDst->clientPixelsBlue[client] = pmapSrc->clientPixelsBlue[client];
pmapSrc->clientPixelsBlue[client] = (Pixel *) NULL;
pmapDst->numPixelsBlue[client] = pmapSrc->numPixelsBlue[client];
pmapSrc->numPixelsBlue[client] = 0;
- break;
+ break;
}
}
/* Free the ith entry in a color map. Must handle freeing of
* colors allocated through AllocColorPlanes */
static void
-FreeCell (ColormapPtr pmap, Pixel i, int channel)
+FreeCell(ColormapPtr pmap, Pixel i, int channel)
{
EntryPtr pent;
- int *pCount;
-
-
- switch (channel)
- {
- default: /* so compiler can see that everything gets initialized */
- case PSEUDOMAP:
- case REDMAP:
- pent = (EntryPtr) &pmap->red[i];
- pCount = &pmap->freeRed;
- break;
- case GREENMAP:
- pent = (EntryPtr) &pmap->green[i];
- pCount = &pmap->freeGreen;
- break;
- case BLUEMAP:
- pent = (EntryPtr) &pmap->blue[i];
- pCount = &pmap->freeBlue;
- break;
+ int *pCount;
+
+ switch (channel) {
+ default: /* so compiler can see that everything gets initialized */
+ case PSEUDOMAP:
+ case REDMAP:
+ pent = (EntryPtr) & pmap->red[i];
+ pCount = &pmap->freeRed;
+ break;
+ case GREENMAP:
+ pent = (EntryPtr) & pmap->green[i];
+ pCount = &pmap->freeGreen;
+ break;
+ case BLUEMAP:
+ pent = (EntryPtr) & pmap->blue[i];
+ pCount = &pmap->freeBlue;
+ break;
}
/* If it's not privately allocated and it's not time to free it, just
* decrement the count */
if (pent->refcnt > 1)
- pent->refcnt--;
- else
- {
+ pent->refcnt--;
+ else {
/* If the color type is shared, find the sharedcolor. If decremented
* refcnt is 0, free the shared cell. */
- if (pent->fShared)
- {
- if(--pent->co.shco.red->refcnt == 0)
- free(pent->co.shco.red);
- if(--pent->co.shco.green->refcnt == 0)
- free(pent->co.shco.green);
- if(--pent->co.shco.blue->refcnt == 0)
- free(pent->co.shco.blue);
- pent->fShared = FALSE;
- }
- pent->refcnt = 0;
- *pCount += 1;
+ if (pent->fShared) {
+ if (--pent->co.shco.red->refcnt == 0)
+ free(pent->co.shco.red);
+ if (--pent->co.shco.green->refcnt == 0)
+ free(pent->co.shco.green);
+ if (--pent->co.shco.blue->refcnt == 0)
+ free(pent->co.shco.blue);
+ pent->fShared = FALSE;
+ }
+ pent->refcnt = 0;
+ *pCount += 1;
}
}
static void
-UpdateColors (ColormapPtr pmap)
+UpdateColors(ColormapPtr pmap)
{
- xColorItem *defs;
+ xColorItem *defs;
xColorItem *pdef;
- EntryPtr pent;
- VisualPtr pVisual;
- int i, n, size;
+ EntryPtr pent;
+ VisualPtr pVisual;
+ int i, n, size;
pVisual = pmap->pVisual;
size = pVisual->ColormapEntries;
defs = malloc(size * sizeof(xColorItem));
if (!defs)
- return;
+ return;
n = 0;
pdef = defs;
- if (pmap->class == DirectColor)
- {
- for (i = 0; i < size; i++)
- {
- if (!pmap->red[i].refcnt &&
- !pmap->green[i].refcnt &&
- !pmap->blue[i].refcnt)
- continue;
- pdef->pixel = ((Pixel)i << pVisual->offsetRed) |
- ((Pixel)i << pVisual->offsetGreen) |
- ((Pixel)i << pVisual->offsetBlue);
- pdef->red = pmap->red[i].co.local.red;
- pdef->green = pmap->green[i].co.local.green;
- pdef->blue = pmap->blue[i].co.local.blue;
- pdef->flags = DoRed|DoGreen|DoBlue;
- pdef++;
- n++;
- }
+ if (pmap->class == DirectColor) {
+ for (i = 0; i < size; i++) {
+ if (!pmap->red[i].refcnt &&
+ !pmap->green[i].refcnt && !pmap->blue[i].refcnt)
+ continue;
+ pdef->pixel = ((Pixel) i << pVisual->offsetRed) |
+ ((Pixel) i << pVisual->offsetGreen) |
+ ((Pixel) i << pVisual->offsetBlue);
+ pdef->red = pmap->red[i].co.local.red;
+ pdef->green = pmap->green[i].co.local.green;
+ pdef->blue = pmap->blue[i].co.local.blue;
+ pdef->flags = DoRed | DoGreen | DoBlue;
+ pdef++;
+ n++;
+ }
}
- else
- {
- for (i = 0, pent = pmap->red; i < size; i++, pent++)
- {
- if (!pent->refcnt)
- continue;
- pdef->pixel = i;
- if(pent->fShared)
- {
- pdef->red = pent->co.shco.red->color;
- pdef->green = pent->co.shco.green->color;
- pdef->blue = pent->co.shco.blue->color;
- }
- else
- {
- pdef->red = pent->co.local.red;
- pdef->green = pent->co.local.green;
- pdef->blue = pent->co.local.blue;
- }
- pdef->flags = DoRed|DoGreen|DoBlue;
- pdef++;
- n++;
- }
+ else {
+ for (i = 0, pent = pmap->red; i < size; i++, pent++) {
+ if (!pent->refcnt)
+ continue;
+ pdef->pixel = i;
+ if (pent->fShared) {
+ pdef->red = pent->co.shco.red->color;
+ pdef->green = pent->co.shco.green->color;
+ pdef->blue = pent->co.shco.blue->color;
+ }
+ else {
+ pdef->red = pent->co.local.red;
+ pdef->green = pent->co.local.green;
+ pdef->blue = pent->co.local.blue;
+ }
+ pdef->flags = DoRed | DoGreen | DoBlue;
+ pdef++;
+ n++;
+ }
}
if (n)
- (*pmap->pScreen->StoreColors)(pmap, n, defs);
+ (*pmap->pScreen->StoreColors) (pmap, n, defs);
free(defs);
}
@@ -809,17 +754,17 @@ UpdateColors (ColormapPtr pmap)
* Returns by changing the value in pred, pgreen, pblue and pPix
*/
int
-AllocColor (ColormapPtr pmap,
- unsigned short *pred, unsigned short *pgreen, unsigned short *pblue,
- Pixel *pPix, int client)
+AllocColor(ColormapPtr pmap,
+ unsigned short *pred, unsigned short *pgreen, unsigned short *pblue,
+ Pixel * pPix, int client)
{
- Pixel pixR, pixG, pixB;
- int entries;
- xrgb rgb;
- int class;
- VisualPtr pVisual;
- int npix;
- Pixel *ppix;
+ Pixel pixR, pixG, pixB;
+ int entries;
+ xrgb rgb;
+ int class;
+ VisualPtr pVisual;
+ int npix;
+ Pixel *ppix;
pVisual = pmap->pVisual;
(*pmap->pScreen->ResolveColor) (pred, pgreen, pblue, pVisual);
@@ -833,8 +778,8 @@ AllocColor (ColormapPtr pmap,
* the colormap, even if it's a static type. Otherwise, we'd never be
* able to initialize static colormaps
*/
- if(pmap->flags & BeingCreated)
- class |= DynamicClass;
+ if (pmap->flags & BeingCreated)
+ class |= DynamicClass;
/* If this is one of the static storage classes, and we're not initializing
* it, the best we can do is to find the closest color entry to the
@@ -843,144 +788,139 @@ AllocColor (ColormapPtr pmap,
switch (class) {
case StaticColor:
case StaticGray:
- /* Look up all three components in the same pmap */
- *pPix = pixR = FindBestPixel(pmap->red, entries, &rgb, PSEUDOMAP);
- *pred = pmap->red[pixR].co.local.red;
- *pgreen = pmap->red[pixR].co.local.green;
- *pblue = pmap->red[pixR].co.local.blue;
- npix = pmap->numPixelsRed[client];
- ppix = (Pixel *) realloc(pmap->clientPixelsRed[client],
- (npix + 1) * sizeof(Pixel));
- if (!ppix)
- return BadAlloc;
- ppix[npix] = pixR;
- pmap->clientPixelsRed[client] = ppix;
- pmap->numPixelsRed[client]++;
- break;
+ /* Look up all three components in the same pmap */
+ *pPix = pixR = FindBestPixel(pmap->red, entries, &rgb, PSEUDOMAP);
+ *pred = pmap->red[pixR].co.local.red;
+ *pgreen = pmap->red[pixR].co.local.green;
+ *pblue = pmap->red[pixR].co.local.blue;
+ npix = pmap->numPixelsRed[client];
+ ppix = (Pixel *) realloc(pmap->clientPixelsRed[client],
+ (npix + 1) * sizeof(Pixel));
+ if (!ppix)
+ return BadAlloc;
+ ppix[npix] = pixR;
+ pmap->clientPixelsRed[client] = ppix;
+ pmap->numPixelsRed[client]++;
+ break;
case TrueColor:
- /* Look up each component in its own map, then OR them together */
- pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP);
- pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP);
- pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP);
- *pPix = (pixR << pVisual->offsetRed) |
- (pixG << pVisual->offsetGreen) |
- (pixB << pVisual->offsetBlue) |
- ALPHAMASK(pVisual);
-
- *pred = pmap->red[pixR].co.local.red;
- *pgreen = pmap->green[pixG].co.local.green;
- *pblue = pmap->blue[pixB].co.local.blue;
- npix = pmap->numPixelsRed[client];
- ppix = (Pixel *) realloc(pmap->clientPixelsRed[client],
- (npix + 1) * sizeof(Pixel));
- if (!ppix)
- return BadAlloc;
- ppix[npix] = pixR;
- pmap->clientPixelsRed[client] = ppix;
- npix = pmap->numPixelsGreen[client];
- ppix = (Pixel *) realloc(pmap->clientPixelsGreen[client],
- (npix + 1) * sizeof(Pixel));
- if (!ppix)
- return BadAlloc;
- ppix[npix] = pixG;
- pmap->clientPixelsGreen[client] = ppix;
- npix = pmap->numPixelsBlue[client];
- ppix = (Pixel *) realloc(pmap->clientPixelsBlue[client],
- (npix + 1) * sizeof(Pixel));
- if (!ppix)
- return BadAlloc;
- ppix[npix] = pixB;
- pmap->clientPixelsBlue[client] = ppix;
- pmap->numPixelsRed[client]++;
- pmap->numPixelsGreen[client]++;
- pmap->numPixelsBlue[client]++;
- break;
+ /* Look up each component in its own map, then OR them together */
+ pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP);
+ pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP);
+ pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP);
+ *pPix = (pixR << pVisual->offsetRed) |
+ (pixG << pVisual->offsetGreen) |
+ (pixB << pVisual->offsetBlue) | ALPHAMASK(pVisual);
+
+ *pred = pmap->red[pixR].co.local.red;
+ *pgreen = pmap->green[pixG].co.local.green;
+ *pblue = pmap->blue[pixB].co.local.blue;
+ npix = pmap->numPixelsRed[client];
+ ppix = (Pixel *) realloc(pmap->clientPixelsRed[client],
+ (npix + 1) * sizeof(Pixel));
+ if (!ppix)
+ return BadAlloc;
+ ppix[npix] = pixR;
+ pmap->clientPixelsRed[client] = ppix;
+ npix = pmap->numPixelsGreen[client];
+ ppix = (Pixel *) realloc(pmap->clientPixelsGreen[client],
+ (npix + 1) * sizeof(Pixel));
+ if (!ppix)
+ return BadAlloc;
+ ppix[npix] = pixG;
+ pmap->clientPixelsGreen[client] = ppix;
+ npix = pmap->numPixelsBlue[client];
+ ppix = (Pixel *) realloc(pmap->clientPixelsBlue[client],
+ (npix + 1) * sizeof(Pixel));
+ if (!ppix)
+ return BadAlloc;
+ ppix[npix] = pixB;
+ pmap->clientPixelsBlue[client] = ppix;
+ pmap->numPixelsRed[client]++;
+ pmap->numPixelsGreen[client]++;
+ pmap->numPixelsBlue[client]++;
+ break;
case GrayScale:
case PseudoColor:
- if (pmap->mid != pmap->pScreen->defColormap &&
- pmap->pVisual->vid == pmap->pScreen->rootVisual)
- {
- ColormapPtr prootmap;
- dixLookupResourceByType((pointer *)&prootmap, pmap->pScreen->defColormap,
- RT_COLORMAP, clients[client], DixReadAccess);
-
- if (pmap->class == prootmap->class)
- FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb,
- pPix, PSEUDOMAP, AllComp);
- }
- if (FindColor(pmap, pmap->red, entries, &rgb, pPix, PSEUDOMAP,
- client, AllComp) != Success)
- return BadAlloc;
+ if (pmap->mid != pmap->pScreen->defColormap &&
+ pmap->pVisual->vid == pmap->pScreen->rootVisual) {
+ ColormapPtr prootmap;
+
+ dixLookupResourceByType((pointer *) &prootmap,
+ pmap->pScreen->defColormap, RT_COLORMAP,
+ clients[client], DixReadAccess);
+
+ if (pmap->class == prootmap->class)
+ FindColorInRootCmap(prootmap, prootmap->red, entries, &rgb,
+ pPix, PSEUDOMAP, AllComp);
+ }
+ if (FindColor(pmap, pmap->red, entries, &rgb, pPix, PSEUDOMAP,
+ client, AllComp) != Success)
+ return BadAlloc;
break;
case DirectColor:
- if (pmap->mid != pmap->pScreen->defColormap &&
- pmap->pVisual->vid == pmap->pScreen->rootVisual)
- {
- ColormapPtr prootmap;
- dixLookupResourceByType((pointer *)&prootmap, pmap->pScreen->defColormap,
- RT_COLORMAP, clients[client], DixReadAccess);
-
- if (pmap->class == prootmap->class)
- {
- pixR = (*pPix & pVisual->redMask) >> pVisual->offsetRed;
- FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb,
- &pixR, REDMAP, RedComp);
- pixG = (*pPix & pVisual->greenMask) >> pVisual->offsetGreen;
- FindColorInRootCmap (prootmap, prootmap->green, entries, &rgb,
- &pixG, GREENMAP, GreenComp);
- pixB = (*pPix & pVisual->blueMask) >> pVisual->offsetBlue;
- FindColorInRootCmap (prootmap, prootmap->blue, entries, &rgb,
- &pixB, BLUEMAP, BlueComp);
- *pPix = pixR | pixG | pixB;
- }
- }
-
- pixR = (*pPix & pVisual->redMask) >> pVisual->offsetRed;
- if (FindColor(pmap, pmap->red, NUMRED(pVisual), &rgb, &pixR, REDMAP,
- client, RedComp) != Success)
- return BadAlloc;
- pixG = (*pPix & pVisual->greenMask) >> pVisual->offsetGreen;
- if (FindColor(pmap, pmap->green, NUMGREEN(pVisual), &rgb, &pixG,
- GREENMAP, client, GreenComp) != Success)
- {
- (void)FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel)0);
- return BadAlloc;
- }
- pixB = (*pPix & pVisual->blueMask) >> pVisual->offsetBlue;
- if (FindColor(pmap, pmap->blue, NUMBLUE(pVisual), &rgb, &pixB, BLUEMAP,
- client, BlueComp) != Success)
- {
- (void)FreeCo(pmap, client, GREENMAP, 1, &pixG, (Pixel)0);
- (void)FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel)0);
- return BadAlloc;
- }
- *pPix = pixR | pixG | pixB | ALPHAMASK(pVisual);
-
- break;
+ if (pmap->mid != pmap->pScreen->defColormap &&
+ pmap->pVisual->vid == pmap->pScreen->rootVisual) {
+ ColormapPtr prootmap;
+
+ dixLookupResourceByType((pointer *) &prootmap,
+ pmap->pScreen->defColormap, RT_COLORMAP,
+ clients[client], DixReadAccess);
+
+ if (pmap->class == prootmap->class) {
+ pixR = (*pPix & pVisual->redMask) >> pVisual->offsetRed;
+ FindColorInRootCmap(prootmap, prootmap->red, entries, &rgb,
+ &pixR, REDMAP, RedComp);
+ pixG = (*pPix & pVisual->greenMask) >> pVisual->offsetGreen;
+ FindColorInRootCmap(prootmap, prootmap->green, entries, &rgb,
+ &pixG, GREENMAP, GreenComp);
+ pixB = (*pPix & pVisual->blueMask) >> pVisual->offsetBlue;
+ FindColorInRootCmap(prootmap, prootmap->blue, entries, &rgb,
+ &pixB, BLUEMAP, BlueComp);
+ *pPix = pixR | pixG | pixB;
+ }
+ }
+
+ pixR = (*pPix & pVisual->redMask) >> pVisual->offsetRed;
+ if (FindColor(pmap, pmap->red, NUMRED(pVisual), &rgb, &pixR, REDMAP,
+ client, RedComp) != Success)
+ return BadAlloc;
+ pixG = (*pPix & pVisual->greenMask) >> pVisual->offsetGreen;
+ if (FindColor(pmap, pmap->green, NUMGREEN(pVisual), &rgb, &pixG,
+ GREENMAP, client, GreenComp) != Success) {
+ (void) FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel) 0);
+ return BadAlloc;
+ }
+ pixB = (*pPix & pVisual->blueMask) >> pVisual->offsetBlue;
+ if (FindColor(pmap, pmap->blue, NUMBLUE(pVisual), &rgb, &pixB, BLUEMAP,
+ client, BlueComp) != Success) {
+ (void) FreeCo(pmap, client, GREENMAP, 1, &pixG, (Pixel) 0);
+ (void) FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel) 0);
+ return BadAlloc;
+ }
+ *pPix = pixR | pixG | pixB | ALPHAMASK(pVisual);
+
+ break;
}
/* if this is the client's first pixel in this colormap, tell the
* resource manager that the client has pixels in this colormap which
* should be freed when the client dies */
if ((pmap->numPixelsRed[client] == 1) &&
- (CLIENT_ID(pmap->mid) != client) &&
- !(pmap->flags & BeingCreated))
- {
- colorResource *pcr;
-
- pcr = malloc(sizeof(colorResource));
- if (!pcr)
- {
- (void)FreeColors(pmap, client, 1, pPix, (Pixel)0);
- return BadAlloc;
- }
- pcr->mid = pmap->mid;
- pcr->client = client;
- if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
- return BadAlloc;
+ (CLIENT_ID(pmap->mid) != client) && !(pmap->flags & BeingCreated)) {
+ colorResource *pcr;
+
+ pcr = malloc(sizeof(colorResource));
+ if (!pcr) {
+ (void) FreeColors(pmap, client, 1, pPix, (Pixel) 0);
+ return BadAlloc;
+ }
+ pcr->mid = pmap->mid;
+ pcr->client = client;
+ if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer) pcr))
+ return BadAlloc;
}
return Success;
}
@@ -994,13 +934,13 @@ AllocColor (ColormapPtr pmap,
*/
void
-FakeAllocColor (ColormapPtr pmap, xColorItem *item)
+FakeAllocColor(ColormapPtr pmap, xColorItem * item)
{
Pixel pixR, pixG, pixB;
Pixel temp;
- int entries;
+ int entries;
xrgb rgb;
- int class;
+ int class;
VisualPtr pVisual;
pVisual = pmap->pVisual;
@@ -1014,48 +954,47 @@ FakeAllocColor (ColormapPtr pmap, xColorItem *item)
switch (class) {
case GrayScale:
case PseudoColor:
- temp = 0;
- item->pixel = 0;
- if (FindColor(pmap, pmap->red, entries, &rgb, &temp, PSEUDOMAP,
- -1, AllComp) == Success) {
- item->pixel = temp;
- break;
- }
- /* fall through ... */
+ temp = 0;
+ item->pixel = 0;
+ if (FindColor(pmap, pmap->red, entries, &rgb, &temp, PSEUDOMAP,
+ -1, AllComp) == Success) {
+ item->pixel = temp;
+ break;
+ }
+ /* fall through ... */
case StaticColor:
case StaticGray:
- item->pixel = FindBestPixel(pmap->red, entries, &rgb, PSEUDOMAP);
- break;
+ item->pixel = FindBestPixel(pmap->red, entries, &rgb, PSEUDOMAP);
+ break;
case DirectColor:
- /* Look up each component in its own map, then OR them together */
- pixR = (item->pixel & pVisual->redMask) >> pVisual->offsetRed;
- pixG = (item->pixel & pVisual->greenMask) >> pVisual->offsetGreen;
- pixB = (item->pixel & pVisual->blueMask) >> pVisual->offsetBlue;
- if (FindColor(pmap, pmap->red, NUMRED(pVisual), &rgb, &pixR, REDMAP,
- -1, RedComp) != Success)
- pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP)
- << pVisual->offsetRed;
- if (FindColor(pmap, pmap->green, NUMGREEN(pVisual), &rgb, &pixG,
- GREENMAP, -1, GreenComp) != Success)
- pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb,
- GREENMAP) << pVisual->offsetGreen;
- if (FindColor(pmap, pmap->blue, NUMBLUE(pVisual), &rgb, &pixB, BLUEMAP,
- -1, BlueComp) != Success)
- pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP)
- << pVisual->offsetBlue;
- item->pixel = pixR | pixG | pixB;
- break;
+ /* Look up each component in its own map, then OR them together */
+ pixR = (item->pixel & pVisual->redMask) >> pVisual->offsetRed;
+ pixG = (item->pixel & pVisual->greenMask) >> pVisual->offsetGreen;
+ pixB = (item->pixel & pVisual->blueMask) >> pVisual->offsetBlue;
+ if (FindColor(pmap, pmap->red, NUMRED(pVisual), &rgb, &pixR, REDMAP,
+ -1, RedComp) != Success)
+ pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP)
+ << pVisual->offsetRed;
+ if (FindColor(pmap, pmap->green, NUMGREEN(pVisual), &rgb, &pixG,
+ GREENMAP, -1, GreenComp) != Success)
+ pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb,
+ GREENMAP) << pVisual->offsetGreen;
+ if (FindColor(pmap, pmap->blue, NUMBLUE(pVisual), &rgb, &pixB, BLUEMAP,
+ -1, BlueComp) != Success)
+ pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP)
+ << pVisual->offsetBlue;
+ item->pixel = pixR | pixG | pixB;
+ break;
case TrueColor:
- /* Look up each component in its own map, then OR them together */
- pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP);
- pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP);
- pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP);
- item->pixel = (pixR << pVisual->offsetRed) |
- (pixG << pVisual->offsetGreen) |
- (pixB << pVisual->offsetBlue);
- break;
+ /* Look up each component in its own map, then OR them together */
+ pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP);
+ pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP);
+ pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP);
+ item->pixel = (pixR << pVisual->offsetRed) |
+ (pixG << pVisual->offsetGreen) | (pixB << pVisual->offsetBlue);
+ break;
}
}
@@ -1069,26 +1008,26 @@ FakeFreeColor(ColormapPtr pmap, Pixel pixel)
switch (pmap->class) {
case GrayScale:
case PseudoColor:
- if (pmap->red[pixel].refcnt == AllocTemporary)
- pmap->red[pixel].refcnt = 0;
- break;
+ if (pmap->red[pixel].refcnt == AllocTemporary)
+ pmap->red[pixel].refcnt = 0;
+ break;
case DirectColor:
- pVisual = pmap->pVisual;
- pixR = (pixel & pVisual->redMask) >> pVisual->offsetRed;
- pixG = (pixel & pVisual->greenMask) >> pVisual->offsetGreen;
- pixB = (pixel & pVisual->blueMask) >> pVisual->offsetBlue;
- if (pmap->red[pixR].refcnt == AllocTemporary)
- pmap->red[pixR].refcnt = 0;
- if (pmap->green[pixG].refcnt == AllocTemporary)
- pmap->green[pixG].refcnt = 0;
- if (pmap->blue[pixB].refcnt == AllocTemporary)
- pmap->blue[pixB].refcnt = 0;
- break;
+ pVisual = pmap->pVisual;
+ pixR = (pixel & pVisual->redMask) >> pVisual->offsetRed;
+ pixG = (pixel & pVisual->greenMask) >> pVisual->offsetGreen;
+ pixB = (pixel & pVisual->blueMask) >> pVisual->offsetBlue;
+ if (pmap->red[pixR].refcnt == AllocTemporary)
+ pmap->red[pixR].refcnt = 0;
+ if (pmap->green[pixG].refcnt == AllocTemporary)
+ pmap->green[pixG].refcnt = 0;
+ if (pmap->blue[pixB].refcnt == AllocTemporary)
+ pmap->blue[pixB].refcnt = 0;
+ break;
}
}
-typedef unsigned short BigNumUpper;
-typedef unsigned long BigNumLower;
+typedef unsigned short BigNumUpper;
+typedef unsigned long BigNumLower;
#define BIGNUMLOWERBITS 24
#define BIGNUMUPPERBITS 16
@@ -1098,8 +1037,8 @@ typedef unsigned long BigNumLower;
#define LOWERPART(i) ((i) & (BIGNUMLOWER - 1))
typedef struct _bignum {
- BigNumUpper upper;
- BigNumLower lower;
+ BigNumUpper upper;
+ BigNumLower lower;
} BigNumRec, *BigNumPtr;
#define BigNumGreater(x,y) (((x)->upper > (y)->upper) ||\
@@ -1112,97 +1051,91 @@ typedef struct _bignum {
((r)->lower = BIGNUMLOWER-1))
static void
-BigNumAdd (BigNumPtr x, BigNumPtr y, BigNumPtr r)
+BigNumAdd(BigNumPtr x, BigNumPtr y, BigNumPtr r)
{
- BigNumLower lower, carry = 0;
+ BigNumLower lower, carry = 0;
lower = x->lower + y->lower;
if (lower >= BIGNUMLOWER) {
- lower -= BIGNUMLOWER;
- carry = 1;
+ lower -= BIGNUMLOWER;
+ carry = 1;
}
r->lower = lower;
r->upper = x->upper + y->upper + carry;
}
static Pixel
-FindBestPixel(EntryPtr pentFirst, int size, xrgb *prgb, int channel)
+FindBestPixel(EntryPtr pentFirst, int size, xrgb * prgb, int channel)
{
- EntryPtr pent;
- Pixel pixel, final;
- long dr, dg, db;
- unsigned long sq;
- BigNumRec minval, sum, temp;
+ EntryPtr pent;
+ Pixel pixel, final;
+ long dr, dg, db;
+ unsigned long sq;
+ BigNumRec minval, sum, temp;
final = 0;
MaxBigNum(&minval);
/* look for the minimal difference */
- for (pent = pentFirst, pixel = 0; pixel < size; pent++, pixel++)
- {
- dr = dg = db = 0;
- switch(channel)
- {
- case PSEUDOMAP:
- dg = (long) pent->co.local.green - prgb->green;
- db = (long) pent->co.local.blue - prgb->blue;
- case REDMAP:
- dr = (long) pent->co.local.red - prgb->red;
- break;
- case GREENMAP:
- dg = (long) pent->co.local.green - prgb->green;
- break;
- case BLUEMAP:
- db = (long) pent->co.local.blue - prgb->blue;
- break;
- }
- sq = dr * dr;
- UnsignedToBigNum (sq, &sum);
- sq = dg * dg;
- UnsignedToBigNum (sq, &temp);
- BigNumAdd (&sum, &temp, &sum);
- sq = db * db;
- UnsignedToBigNum (sq, &temp);
- BigNumAdd (&sum, &temp, &sum);
- if (BigNumGreater (&minval, &sum))
- {
- final = pixel;
- minval = sum;
- }
+ for (pent = pentFirst, pixel = 0; pixel < size; pent++, pixel++) {
+ dr = dg = db = 0;
+ switch (channel) {
+ case PSEUDOMAP:
+ dg = (long) pent->co.local.green - prgb->green;
+ db = (long) pent->co.local.blue - prgb->blue;
+ case REDMAP:
+ dr = (long) pent->co.local.red - prgb->red;
+ break;
+ case GREENMAP:
+ dg = (long) pent->co.local.green - prgb->green;
+ break;
+ case BLUEMAP:
+ db = (long) pent->co.local.blue - prgb->blue;
+ break;
+ }
+ sq = dr * dr;
+ UnsignedToBigNum(sq, &sum);
+ sq = dg * dg;
+ UnsignedToBigNum(sq, &temp);
+ BigNumAdd(&sum, &temp, &sum);
+ sq = db * db;
+ UnsignedToBigNum(sq, &temp);
+ BigNumAdd(&sum, &temp, &sum);
+ if (BigNumGreater(&minval, &sum)) {
+ final = pixel;
+ minval = sum;
+ }
}
return final;
}
static void
-FindColorInRootCmap (ColormapPtr pmap, EntryPtr pentFirst, int size,
- xrgb *prgb, Pixel *pPixel, int channel,
- ColorCompareProcPtr comp)
+FindColorInRootCmap(ColormapPtr pmap, EntryPtr pentFirst, int size,
+ xrgb * prgb, Pixel * pPixel, int channel,
+ ColorCompareProcPtr comp)
{
- EntryPtr pent;
- Pixel pixel;
- int count;
+ EntryPtr pent;
+ Pixel pixel;
+ int count;
if ((pixel = *pPixel) >= size)
- pixel = 0;
- for (pent = pentFirst + pixel, count = size; --count >= 0; pent++, pixel++)
- {
- if (pent->refcnt > 0 && (*comp) (pent, prgb))
- {
- switch (channel)
- {
- case REDMAP:
- pixel <<= pmap->pVisual->offsetRed;
- break;
- case GREENMAP:
- pixel <<= pmap->pVisual->offsetGreen;
- break;
- case BLUEMAP:
- pixel <<= pmap->pVisual->offsetBlue;
- break;
- default: /* PSEUDOMAP */
- break;
- }
- *pPixel = pixel;
- }
+ pixel = 0;
+ for (pent = pentFirst + pixel, count = size; --count >= 0; pent++, pixel++) {
+ if (pent->refcnt > 0 && (*comp) (pent, prgb)) {
+ switch (channel) {
+ case REDMAP:
+ pixel <<= pmap->pVisual->offsetRed;
+ break;
+ case GREENMAP:
+ pixel <<= pmap->pVisual->offsetGreen;
+ break;
+ case BLUEMAP:
+ pixel <<= pmap->pVisual->offsetBlue;
+ break;
+ default: /* PSEUDOMAP */
+ break;
+ }
+ *pPixel = pixel;
+ }
}
}
@@ -1212,170 +1145,159 @@ FindColorInRootCmap (ColormapPtr pmap, EntryPtr pentFirst, int size,
* load *pPixel with that value, otherwise set it to 0
*/
int
-FindColor (ColormapPtr pmap, EntryPtr pentFirst, int size, xrgb *prgb,
- Pixel *pPixel, int channel, int client,
- ColorCompareProcPtr comp)
+FindColor(ColormapPtr pmap, EntryPtr pentFirst, int size, xrgb * prgb,
+ Pixel * pPixel, int channel, int client, ColorCompareProcPtr comp)
{
- EntryPtr pent;
- Bool foundFree;
- Pixel pixel, Free = 0;
- int npix, count, *nump = NULL;
- Pixel **pixp = NULL, *ppix;
- xColorItem def;
+ EntryPtr pent;
+ Bool foundFree;
+ Pixel pixel, Free = 0;
+ int npix, count, *nump = NULL;
+ Pixel **pixp = NULL, *ppix;
+ xColorItem def;
foundFree = FALSE;
- if((pixel = *pPixel) >= size)
- pixel = 0;
+ if ((pixel = *pPixel) >= size)
+ pixel = 0;
/* see if there is a match, and also look for a free entry */
- for (pent = pentFirst + pixel, count = size; --count >= 0; )
- {
- if (pent->refcnt > 0)
- {
- if ((*comp) (pent, prgb))
- {
- if (client >= 0)
- pent->refcnt++;
- *pPixel = pixel;
- switch(channel)
- {
- case REDMAP:
- *pPixel <<= pmap->pVisual->offsetRed;
- case PSEUDOMAP:
- break;
- case GREENMAP:
- *pPixel <<= pmap->pVisual->offsetGreen;
- break;
- case BLUEMAP:
- *pPixel <<= pmap->pVisual->offsetBlue;
- break;
- }
- goto gotit;
- }
+ for (pent = pentFirst + pixel, count = size; --count >= 0;) {
+ if (pent->refcnt > 0) {
+ if ((*comp) (pent, prgb)) {
+ if (client >= 0)
+ pent->refcnt++;
+ *pPixel = pixel;
+ switch (channel) {
+ case REDMAP:
+ *pPixel <<= pmap->pVisual->offsetRed;
+ case PSEUDOMAP:
+ break;
+ case GREENMAP:
+ *pPixel <<= pmap->pVisual->offsetGreen;
+ break;
+ case BLUEMAP:
+ *pPixel <<= pmap->pVisual->offsetBlue;
+ break;
+ }
+ goto gotit;
+ }
}
- else if (!foundFree && pent->refcnt == 0)
- {
- Free = pixel;
- foundFree = TRUE;
- /* If we're initializing the colormap, then we are looking for
- * the first free cell we can find, not to minimize the number
- * of entries we use. So don't look any further. */
- if(pmap->flags & BeingCreated)
- break;
- }
- pixel++;
- if(pixel >= size)
- {
- pent = pentFirst;
- pixel = 0;
- }
- else
- pent++;
+ else if (!foundFree && pent->refcnt == 0) {
+ Free = pixel;
+ foundFree = TRUE;
+ /* If we're initializing the colormap, then we are looking for
+ * the first free cell we can find, not to minimize the number
+ * of entries we use. So don't look any further. */
+ if (pmap->flags & BeingCreated)
+ break;
+ }
+ pixel++;
+ if (pixel >= size) {
+ pent = pentFirst;
+ pixel = 0;
+ }
+ else
+ pent++;
}
/* If we got here, we didn't find a match. If we also didn't find
* a free entry, we're out of luck. Otherwise, we'll usurp a free
* entry and fill it in */
if (!foundFree)
- return BadAlloc;
+ return BadAlloc;
pent = pentFirst + Free;
pent->fShared = FALSE;
pent->refcnt = (client >= 0) ? 1 : AllocTemporary;
- switch (channel)
- {
- case PSEUDOMAP:
+ switch (channel) {
+ case PSEUDOMAP:
pent->co.local.red = prgb->red;
pent->co.local.green = prgb->green;
pent->co.local.blue = prgb->blue;
def.red = prgb->red;
- def.green = prgb->green;
- def.blue = prgb->blue;
- def.flags = (DoRed|DoGreen|DoBlue);
- if (client >= 0)
- pmap->freeRed--;
- def.pixel = Free;
- break;
-
- case REDMAP:
+ def.green = prgb->green;
+ def.blue = prgb->blue;
+ def.flags = (DoRed | DoGreen | DoBlue);
+ if (client >= 0)
+ pmap->freeRed--;
+ def.pixel = Free;
+ break;
+
+ case REDMAP:
pent->co.local.red = prgb->red;
def.red = prgb->red;
- def.green = pmap->green[0].co.local.green;
- def.blue = pmap->blue[0].co.local.blue;
- def.flags = DoRed;
- if (client >= 0)
- pmap->freeRed--;
- def.pixel = Free << pmap->pVisual->offsetRed;
- break;
-
- case GREENMAP:
- pent->co.local.green = prgb->green;
- def.red = pmap->red[0].co.local.red;
+ def.green = pmap->green[0].co.local.green;
+ def.blue = pmap->blue[0].co.local.blue;
+ def.flags = DoRed;
+ if (client >= 0)
+ pmap->freeRed--;
+ def.pixel = Free << pmap->pVisual->offsetRed;
+ break;
+
+ case GREENMAP:
+ pent->co.local.green = prgb->green;
+ def.red = pmap->red[0].co.local.red;
def.green = prgb->green;
- def.blue = pmap->blue[0].co.local.blue;
- def.flags = DoGreen;
- if (client >= 0)
- pmap->freeGreen--;
- def.pixel = Free << pmap->pVisual->offsetGreen;
- break;
-
- case BLUEMAP:
- pent->co.local.blue = prgb->blue;
- def.red = pmap->red[0].co.local.red;
- def.green = pmap->green[0].co.local.green;
- def.blue = prgb->blue;
- def.flags = DoBlue;
- if (client >= 0)
- pmap->freeBlue--;
- def.pixel = Free << pmap->pVisual->offsetBlue;
- break;
+ def.blue = pmap->blue[0].co.local.blue;
+ def.flags = DoGreen;
+ if (client >= 0)
+ pmap->freeGreen--;
+ def.pixel = Free << pmap->pVisual->offsetGreen;
+ break;
+
+ case BLUEMAP:
+ pent->co.local.blue = prgb->blue;
+ def.red = pmap->red[0].co.local.red;
+ def.green = pmap->green[0].co.local.green;
+ def.blue = prgb->blue;
+ def.flags = DoBlue;
+ if (client >= 0)
+ pmap->freeBlue--;
+ def.pixel = Free << pmap->pVisual->offsetBlue;
+ break;
}
(*pmap->pScreen->StoreColors) (pmap, 1, &def);
- pixel = Free;
+ pixel = Free;
*pPixel = def.pixel;
-gotit:
+ gotit:
if (pmap->flags & BeingCreated || client == -1)
- return Success;
+ return Success;
/* Now remember the pixel, for freeing later */
- switch (channel)
- {
- case PSEUDOMAP:
- case REDMAP:
- nump = pmap->numPixelsRed;
- pixp = pmap->clientPixelsRed;
- break;
-
- case GREENMAP:
- nump = pmap->numPixelsGreen;
- pixp = pmap->clientPixelsGreen;
- break;
-
- case BLUEMAP:
- nump = pmap->numPixelsBlue;
- pixp = pmap->clientPixelsBlue;
- break;
+ switch (channel) {
+ case PSEUDOMAP:
+ case REDMAP:
+ nump = pmap->numPixelsRed;
+ pixp = pmap->clientPixelsRed;
+ break;
+
+ case GREENMAP:
+ nump = pmap->numPixelsGreen;
+ pixp = pmap->clientPixelsGreen;
+ break;
+
+ case BLUEMAP:
+ nump = pmap->numPixelsBlue;
+ pixp = pmap->clientPixelsBlue;
+ break;
}
npix = nump[client];
ppix = (Pixel *) realloc(pixp[client], (npix + 1) * sizeof(Pixel));
- if (!ppix)
- {
- pent->refcnt--;
- if (!pent->fShared)
- switch (channel)
- {
- case PSEUDOMAP:
- case REDMAP:
- pmap->freeRed++;
- break;
- case GREENMAP:
- pmap->freeGreen++;
- break;
- case BLUEMAP:
- pmap->freeBlue++;
- break;
- }
- return BadAlloc;
+ if (!ppix) {
+ pent->refcnt--;
+ if (!pent->fShared)
+ switch (channel) {
+ case PSEUDOMAP:
+ case REDMAP:
+ pmap->freeRed++;
+ break;
+ case GREENMAP:
+ pmap->freeGreen++;
+ break;
+ case BLUEMAP:
+ pmap->freeBlue++;
+ break;
+ }
+ return BadAlloc;
}
ppix[npix] = pixel;
pixp[client] = ppix;
@@ -1387,123 +1309,112 @@ gotit:
/* Comparison functions -- passed to FindColor to determine if an
* entry is already the color we're looking for or not */
static int
-AllComp (EntryPtr pent, xrgb *prgb)
+AllComp(EntryPtr pent, xrgb * prgb)
{
- if((pent->co.local.red == prgb->red) &&
- (pent->co.local.green == prgb->green) &&
- (pent->co.local.blue == prgb->blue) )
- return 1;
+ if ((pent->co.local.red == prgb->red) &&
+ (pent->co.local.green == prgb->green) &&
+ (pent->co.local.blue == prgb->blue))
+ return 1;
return 0;
}
static int
-RedComp (EntryPtr pent, xrgb *prgb)
+RedComp(EntryPtr pent, xrgb * prgb)
{
- if (pent->co.local.red == prgb->red)
- return 1;
+ if (pent->co.local.red == prgb->red)
+ return 1;
return 0;
}
static int
-GreenComp (EntryPtr pent, xrgb *prgb)
+GreenComp(EntryPtr pent, xrgb * prgb)
{
- if (pent->co.local.green == prgb->green)
- return 1;
+ if (pent->co.local.green == prgb->green)
+ return 1;
return 0;
}
static int
-BlueComp (EntryPtr pent, xrgb *prgb)
+BlueComp(EntryPtr pent, xrgb * prgb)
{
- if (pent->co.local.blue == prgb->blue)
- return 1;
+ if (pent->co.local.blue == prgb->blue)
+ return 1;
return 0;
}
-
/* Read the color value of a cell */
int
-QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList, ClientPtr client)
+QueryColors(ColormapPtr pmap, int count, Pixel * ppixIn, xrgb * prgbList,
+ ClientPtr client)
{
- Pixel *ppix, pixel;
- xrgb *prgb;
- VisualPtr pVisual;
- EntryPtr pent;
- Pixel i;
- int errVal = Success;
+ Pixel *ppix, pixel;
+ xrgb *prgb;
+ VisualPtr pVisual;
+ EntryPtr pent;
+ Pixel i;
+ int errVal = Success;
pVisual = pmap->pVisual;
- if ((pmap->class | DynamicClass) == DirectColor)
- {
- int numred, numgreen, numblue;
- Pixel rgbbad;
-
- numred = NUMRED(pVisual);
- numgreen = NUMGREEN(pVisual);
- numblue = NUMBLUE(pVisual);
- rgbbad = ~RGBMASK(pVisual);
- for( ppix = ppixIn, prgb = prgbList; --count >= 0; ppix++, prgb++)
- {
- pixel = *ppix;
- if (pixel & rgbbad) {
- client->errorValue = pixel;
- errVal = BadValue;
- continue;
- }
- i = (pixel & pVisual->redMask) >> pVisual->offsetRed;
- if (i >= numred)
- {
- client->errorValue = pixel;
- errVal = BadValue;
- continue;
- }
- prgb->red = pmap->red[i].co.local.red;
- i = (pixel & pVisual->greenMask) >> pVisual->offsetGreen;
- if (i >= numgreen)
- {
- client->errorValue = pixel;
- errVal = BadValue;
- continue;
- }
- prgb->green = pmap->green[i].co.local.green;
- i = (pixel & pVisual->blueMask) >> pVisual->offsetBlue;
- if (i >= numblue)
- {
- client->errorValue = pixel;
- errVal = BadValue;
- continue;
- }
- prgb->blue = pmap->blue[i].co.local.blue;
- }
+ if ((pmap->class | DynamicClass) == DirectColor) {
+ int numred, numgreen, numblue;
+ Pixel rgbbad;
+
+ numred = NUMRED(pVisual);
+ numgreen = NUMGREEN(pVisual);
+ numblue = NUMBLUE(pVisual);
+ rgbbad = ~RGBMASK(pVisual);
+ for (ppix = ppixIn, prgb = prgbList; --count >= 0; ppix++, prgb++) {
+ pixel = *ppix;
+ if (pixel & rgbbad) {
+ client->errorValue = pixel;
+ errVal = BadValue;
+ continue;
+ }
+ i = (pixel & pVisual->redMask) >> pVisual->offsetRed;
+ if (i >= numred) {
+ client->errorValue = pixel;
+ errVal = BadValue;
+ continue;
+ }
+ prgb->red = pmap->red[i].co.local.red;
+ i = (pixel & pVisual->greenMask) >> pVisual->offsetGreen;
+ if (i >= numgreen) {
+ client->errorValue = pixel;
+ errVal = BadValue;
+ continue;
+ }
+ prgb->green = pmap->green[i].co.local.green;
+ i = (pixel & pVisual->blueMask) >> pVisual->offsetBlue;
+ if (i >= numblue) {
+ client->errorValue = pixel;
+ errVal = BadValue;
+ continue;
+ }
+ prgb->blue = pmap->blue[i].co.local.blue;
+ }
}
- else
- {
- for( ppix = ppixIn, prgb = prgbList; --count >= 0; ppix++, prgb++)
- {
- pixel = *ppix;
- if (pixel >= pVisual->ColormapEntries)
- {
- client->errorValue = pixel;
- errVal = BadValue;
- }
- else
- {
- pent = (EntryPtr)&pmap->red[pixel];
- if (pent->fShared)
- {
- prgb->red = pent->co.shco.red->color;
- prgb->green = pent->co.shco.green->color;
- prgb->blue = pent->co.shco.blue->color;
- }
- else
- {
- prgb->red = pent->co.local.red;
- prgb->green = pent->co.local.green;
- prgb->blue = pent->co.local.blue;
- }
- }
- }
+ else {
+ for (ppix = ppixIn, prgb = prgbList; --count >= 0; ppix++, prgb++) {
+ pixel = *ppix;
+ if (pixel >= pVisual->ColormapEntries) {
+ client->errorValue = pixel;
+ errVal = BadValue;
+ }
+ else {
+ pent = (EntryPtr) & pmap->red[pixel];
+ if (pent->fShared) {
+ prgb->red = pent->co.shco.red->color;
+ prgb->green = pent->co.shco.green->color;
+ prgb->blue = pent->co.shco.blue->color;
+ }
+ else {
+ prgb->red = pent->co.local.red;
+ prgb->green = pent->co.local.green;
+ prgb->blue = pent->co.local.blue;
+ }
+ }
+ }
}
return errVal;
}
@@ -1513,40 +1424,37 @@ FreePixels(ColormapPtr pmap, int client)
{
Pixel *ppix, *ppixStart;
int n;
- int class;
+ int class;
class = pmap->class;
ppixStart = pmap->clientPixelsRed[client];
- if (class & DynamicClass)
- {
- n = pmap->numPixelsRed[client];
- for (ppix = ppixStart; --n >= 0; )
- {
- FreeCell(pmap, *ppix, REDMAP);
- ppix++;
- }
+ if (class & DynamicClass) {
+ n = pmap->numPixelsRed[client];
+ for (ppix = ppixStart; --n >= 0;) {
+ FreeCell(pmap, *ppix, REDMAP);
+ ppix++;
+ }
}
free(ppixStart);
pmap->clientPixelsRed[client] = (Pixel *) NULL;
pmap->numPixelsRed[client] = 0;
- if ((class | DynamicClass) == DirectColor)
- {
+ if ((class | DynamicClass) == DirectColor) {
ppixStart = pmap->clientPixelsGreen[client];
- if (class & DynamicClass)
- for (ppix = ppixStart, n = pmap->numPixelsGreen[client]; --n >= 0;)
- FreeCell(pmap, *ppix++, GREENMAP);
- free(ppixStart);
- pmap->clientPixelsGreen[client] = (Pixel *) NULL;
- pmap->numPixelsGreen[client] = 0;
+ if (class & DynamicClass)
+ for (ppix = ppixStart, n = pmap->numPixelsGreen[client]; --n >= 0;)
+ FreeCell(pmap, *ppix++, GREENMAP);
+ free(ppixStart);
+ pmap->clientPixelsGreen[client] = (Pixel *) NULL;
+ pmap->numPixelsGreen[client] = 0;
ppixStart = pmap->clientPixelsBlue[client];
- if (class & DynamicClass)
- for (ppix = ppixStart, n = pmap->numPixelsBlue[client]; --n >= 0; )
- FreeCell(pmap, *ppix++, BLUEMAP);
- free(ppixStart);
- pmap->clientPixelsBlue[client] = (Pixel *) NULL;
- pmap->numPixelsBlue[client] = 0;
+ if (class & DynamicClass)
+ for (ppix = ppixStart, n = pmap->numPixelsBlue[client]; --n >= 0;)
+ FreeCell(pmap, *ppix++, BLUEMAP);
+ free(ppixStart);
+ pmap->clientPixelsBlue[client] = (Pixel *) NULL;
+ pmap->numPixelsBlue[client] = 0;
}
}
@@ -1557,252 +1465,236 @@ FreePixels(ColormapPtr pmap, int client)
* \unused fakeid
*/
int
-FreeClientPixels (pointer value, XID fakeid)
+FreeClientPixels(pointer value, XID fakeid)
{
pointer pmap;
colorResource *pcr = value;
int rc;
rc = dixLookupResourceByType(&pmap, pcr->mid, RT_COLORMAP, serverClient,
- DixRemoveAccess);
+ DixRemoveAccess);
if (rc == Success)
- FreePixels((ColormapPtr)pmap, pcr->client);
+ FreePixels((ColormapPtr) pmap, pcr->client);
free(pcr);
return Success;
}
int
-AllocColorCells (int client, ColormapPtr pmap, int colors, int planes,
- Bool contig, Pixel *ppix, Pixel *masks)
+AllocColorCells(int client, ColormapPtr pmap, int colors, int planes,
+ Bool contig, Pixel * ppix, Pixel * masks)
{
- Pixel rmask, gmask, bmask, *ppixFirst, r, g, b;
- int n, class;
- int ok;
- int oldcount;
- colorResource *pcr = (colorResource *)NULL;
+ Pixel rmask, gmask, bmask, *ppixFirst, r, g, b;
+ int n, class;
+ int ok;
+ int oldcount;
+ colorResource *pcr = (colorResource *) NULL;
class = pmap->class;
if (!(class & DynamicClass))
- return BadAlloc; /* Shouldn't try on this type */
+ return BadAlloc; /* Shouldn't try on this type */
oldcount = pmap->numPixelsRed[client];
if (pmap->class == DirectColor)
- oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
- if (!oldcount && (CLIENT_ID(pmap->mid) != client))
- {
- pcr = malloc(sizeof(colorResource));
- if (!pcr)
- return BadAlloc;
- }
-
- if (pmap->class == DirectColor)
- {
- ok = AllocDirect (client, pmap, colors, planes, planes, planes,
- contig, ppix, &rmask, &gmask, &bmask);
- if(ok == Success)
- {
- for (r = g = b = 1, n = planes; --n >= 0; r += r, g += g, b += b)
- {
- while(!(rmask & r))
- r += r;
- while(!(gmask & g))
- g += g;
- while(!(bmask & b))
- b += b;
- *masks++ = r | g | b;
- }
- }
+ oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
+ if (!oldcount && (CLIENT_ID(pmap->mid) != client)) {
+ pcr = malloc(sizeof(colorResource));
+ if (!pcr)
+ return BadAlloc;
+ }
+
+ if (pmap->class == DirectColor) {
+ ok = AllocDirect(client, pmap, colors, planes, planes, planes,
+ contig, ppix, &rmask, &gmask, &bmask);
+ if (ok == Success) {
+ for (r = g = b = 1, n = planes; --n >= 0; r += r, g += g, b += b) {
+ while (!(rmask & r))
+ r += r;
+ while (!(gmask & g))
+ g += g;
+ while (!(bmask & b))
+ b += b;
+ *masks++ = r | g | b;
+ }
+ }
}
- else
- {
- ok = AllocPseudo (client, pmap, colors, planes, contig, ppix, &rmask,
- &ppixFirst);
- if(ok == Success)
- {
- for (r = 1, n = planes; --n >= 0; r += r)
- {
- while(!(rmask & r))
- r += r;
- *masks++ = r;
- }
- }
+ else {
+ ok = AllocPseudo(client, pmap, colors, planes, contig, ppix, &rmask,
+ &ppixFirst);
+ if (ok == Success) {
+ for (r = 1, n = planes; --n >= 0; r += r) {
+ while (!(rmask & r))
+ r += r;
+ *masks++ = r;
+ }
+ }
}
/* if this is the client's first pixels in this colormap, tell the
* resource manager that the client has pixels in this colormap which
* should be freed when the client dies */
- if ((ok == Success) && pcr)
- {
- pcr->mid = pmap->mid;
- pcr->client = client;
- if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
- ok = BadAlloc;
- } else free(pcr);
+ if ((ok == Success) && pcr) {
+ pcr->mid = pmap->mid;
+ pcr->client = client;
+ if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer) pcr))
+ ok = BadAlloc;
+ }
+ else
+ free(pcr);
return ok;
}
-
int
-AllocColorPlanes (int client, ColormapPtr pmap, int colors,
- int r, int g, int b, Bool contig, Pixel *pixels,
- Pixel *prmask, Pixel *pgmask, Pixel *pbmask)
+AllocColorPlanes(int client, ColormapPtr pmap, int colors,
+ int r, int g, int b, Bool contig, Pixel * pixels,
+ Pixel * prmask, Pixel * pgmask, Pixel * pbmask)
{
- int ok;
- Pixel mask, *ppixFirst;
+ int ok;
+ Pixel mask, *ppixFirst;
Pixel shift;
int i;
- int class;
- int oldcount;
- colorResource *pcr = (colorResource *)NULL;
+ int class;
+ int oldcount;
+ colorResource *pcr = (colorResource *) NULL;
class = pmap->class;
if (!(class & DynamicClass))
- return BadAlloc; /* Shouldn't try on this type */
+ return BadAlloc; /* Shouldn't try on this type */
oldcount = pmap->numPixelsRed[client];
if (class == DirectColor)
- oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
- if (!oldcount && (CLIENT_ID(pmap->mid) != client))
- {
- pcr = malloc(sizeof(colorResource));
- if (!pcr)
- return BadAlloc;
- }
-
- if (class == DirectColor)
- {
- ok = AllocDirect (client, pmap, colors, r, g, b, contig, pixels,
- prmask, pgmask, pbmask);
- }
- else
- {
- /* Allocate the proper pixels */
- /* XXX This is sort of bad, because of contig is set, we force all
- * r + g + b bits to be contiguous. Should only force contiguity
- * per mask
- */
- ok = AllocPseudo (client, pmap, colors, r + g + b, contig, pixels,
- &mask, &ppixFirst);
-
- if(ok == Success)
- {
- /* now split that mask into three */
- *prmask = *pgmask = *pbmask = 0;
- shift = 1;
- for (i = r; --i >= 0; shift += shift)
- {
- while (!(mask & shift))
- shift += shift;
- *prmask |= shift;
- }
- for (i = g; --i >= 0; shift += shift)
- {
- while (!(mask & shift))
- shift += shift;
- *pgmask |= shift;
- }
- for (i = b; --i >= 0; shift += shift)
- {
- while (!(mask & shift))
- shift += shift;
- *pbmask |= shift;
- }
-
- /* set up the shared color cells */
- if (!AllocShared(pmap, pixels, colors, r, g, b,
- *prmask, *pgmask, *pbmask, ppixFirst))
- {
- (void)FreeColors(pmap, client, colors, pixels, mask);
- ok = BadAlloc;
- }
- }
+ oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
+ if (!oldcount && (CLIENT_ID(pmap->mid) != client)) {
+ pcr = malloc(sizeof(colorResource));
+ if (!pcr)
+ return BadAlloc;
+ }
+
+ if (class == DirectColor) {
+ ok = AllocDirect(client, pmap, colors, r, g, b, contig, pixels,
+ prmask, pgmask, pbmask);
+ }
+ else {
+ /* Allocate the proper pixels */
+ /* XXX This is sort of bad, because of contig is set, we force all
+ * r + g + b bits to be contiguous. Should only force contiguity
+ * per mask
+ */
+ ok = AllocPseudo(client, pmap, colors, r + g + b, contig, pixels,
+ &mask, &ppixFirst);
+
+ if (ok == Success) {
+ /* now split that mask into three */
+ *prmask = *pgmask = *pbmask = 0;
+ shift = 1;
+ for (i = r; --i >= 0; shift += shift) {
+ while (!(mask & shift))
+ shift += shift;
+ *prmask |= shift;
+ }
+ for (i = g; --i >= 0; shift += shift) {
+ while (!(mask & shift))
+ shift += shift;
+ *pgmask |= shift;
+ }
+ for (i = b; --i >= 0; shift += shift) {
+ while (!(mask & shift))
+ shift += shift;
+ *pbmask |= shift;
+ }
+
+ /* set up the shared color cells */
+ if (!AllocShared(pmap, pixels, colors, r, g, b,
+ *prmask, *pgmask, *pbmask, ppixFirst)) {
+ (void) FreeColors(pmap, client, colors, pixels, mask);
+ ok = BadAlloc;
+ }
+ }
}
/* if this is the client's first pixels in this colormap, tell the
* resource manager that the client has pixels in this colormap which
* should be freed when the client dies */
- if ((ok == Success) && pcr)
- {
- pcr->mid = pmap->mid;
- pcr->client = client;
- if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
- ok = BadAlloc;
- } else free(pcr);
+ if ((ok == Success) && pcr) {
+ pcr->mid = pmap->mid;
+ pcr->client = client;
+ if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer) pcr))
+ ok = BadAlloc;
+ }
+ else
+ free(pcr);
return ok;
}
static int
-AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool contig,
- Pixel *pixels, Pixel *prmask, Pixel *pgmask, Pixel *pbmask)
+AllocDirect(int client, ColormapPtr pmap, int c, int r, int g, int b,
+ Bool contig, Pixel * pixels, Pixel * prmask, Pixel * pgmask,
+ Pixel * pbmask)
{
- Pixel *ppixRed, *ppixGreen, *ppixBlue;
- Pixel *ppix, *pDst, *p;
- int npix, npixR, npixG, npixB;
- Bool okR, okG, okB;
- Pixel *rpix = 0, *gpix = 0, *bpix = 0;
+ Pixel *ppixRed, *ppixGreen, *ppixBlue;
+ Pixel *ppix, *pDst, *p;
+ int npix, npixR, npixG, npixB;
+ Bool okR, okG, okB;
+ Pixel *rpix = 0, *gpix = 0, *bpix = 0;
npixR = c << r;
npixG = c << g;
npixB = c << b;
if ((r >= 32) || (g >= 32) || (b >= 32) ||
- (npixR > pmap->freeRed) || (npixR < c) ||
- (npixG > pmap->freeGreen) || (npixG < c) ||
- (npixB > pmap->freeBlue) || (npixB < c))
- return BadAlloc;
+ (npixR > pmap->freeRed) || (npixR < c) ||
+ (npixG > pmap->freeGreen) || (npixG < c) ||
+ (npixB > pmap->freeBlue) || (npixB < c))
+ return BadAlloc;
/* start out with empty pixels */
- for(p = pixels; p < pixels + c; p++)
- *p = 0;
+ for (p = pixels; p < pixels + c; p++)
+ *p = 0;
ppixRed = malloc(npixR * sizeof(Pixel));
ppixGreen = malloc(npixG * sizeof(Pixel));
ppixBlue = malloc(npixB * sizeof(Pixel));
- if (!ppixRed || !ppixGreen || !ppixBlue)
- {
- free(ppixBlue);
- free(ppixGreen);
- free(ppixRed);
- return BadAlloc;
+ if (!ppixRed || !ppixGreen || !ppixBlue) {
+ free(ppixBlue);
+ free(ppixGreen);
+ free(ppixRed);
+ return BadAlloc;
}
okR = AllocCP(pmap, pmap->red, c, r, contig, ppixRed, prmask);
okG = AllocCP(pmap, pmap->green, c, g, contig, ppixGreen, pgmask);
okB = AllocCP(pmap, pmap->blue, c, b, contig, ppixBlue, pbmask);
- if (okR && okG && okB)
- {
- rpix = (Pixel *) realloc(pmap->clientPixelsRed[client],
- (pmap->numPixelsRed[client] + (c << r)) *
- sizeof(Pixel));
- if (rpix)
- pmap->clientPixelsRed[client] = rpix;
- gpix = (Pixel *) realloc(pmap->clientPixelsGreen[client],
- (pmap->numPixelsGreen[client] + (c << g)) *
- sizeof(Pixel));
- if (gpix)
- pmap->clientPixelsGreen[client] = gpix;
- bpix = (Pixel *) realloc(pmap->clientPixelsBlue[client],
- (pmap->numPixelsBlue[client] + (c << b)) *
- sizeof(Pixel));
- if (bpix)
- pmap->clientPixelsBlue[client] = bpix;
- }
-
- if (!okR || !okG || !okB || !rpix || !gpix || !bpix)
- {
- if (okR)
- for(ppix = ppixRed, npix = npixR; --npix >= 0; ppix++)
- pmap->red[*ppix].refcnt = 0;
- if (okG)
- for(ppix = ppixGreen, npix = npixG; --npix >= 0; ppix++)
- pmap->green[*ppix].refcnt = 0;
- if (okB)
- for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++)
- pmap->blue[*ppix].refcnt = 0;
- free(ppixBlue);
- free(ppixGreen);
- free(ppixRed);
- return BadAlloc;
+ if (okR && okG && okB) {
+ rpix = (Pixel *) realloc(pmap->clientPixelsRed[client],
+ (pmap->numPixelsRed[client] + (c << r)) *
+ sizeof(Pixel));
+ if (rpix)
+ pmap->clientPixelsRed[client] = rpix;
+ gpix = (Pixel *) realloc(pmap->clientPixelsGreen[client],
+ (pmap->numPixelsGreen[client] + (c << g)) *
+ sizeof(Pixel));
+ if (gpix)
+ pmap->clientPixelsGreen[client] = gpix;
+ bpix = (Pixel *) realloc(pmap->clientPixelsBlue[client],
+ (pmap->numPixelsBlue[client] + (c << b)) *
+ sizeof(Pixel));
+ if (bpix)
+ pmap->clientPixelsBlue[client] = bpix;
+ }
+
+ if (!okR || !okG || !okB || !rpix || !gpix || !bpix) {
+ if (okR)
+ for (ppix = ppixRed, npix = npixR; --npix >= 0; ppix++)
+ pmap->red[*ppix].refcnt = 0;
+ if (okG)
+ for (ppix = ppixGreen, npix = npixG; --npix >= 0; ppix++)
+ pmap->green[*ppix].refcnt = 0;
+ if (okB)
+ for (ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++)
+ pmap->blue[*ppix].refcnt = 0;
+ free(ppixBlue);
+ free(ppixGreen);
+ free(ppixRed);
+ return BadAlloc;
}
*prmask <<= pmap->pVisual->offsetRed;
@@ -1810,38 +1702,34 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
*pbmask <<= pmap->pVisual->offsetBlue;
ppix = rpix + pmap->numPixelsRed[client];
- for (pDst = pixels, p = ppixRed; p < ppixRed + npixR; p++)
- {
- *ppix++ = *p;
- if(p < ppixRed + c)
- *pDst++ |= *p << pmap->pVisual->offsetRed;
+ for (pDst = pixels, p = ppixRed; p < ppixRed + npixR; p++) {
+ *ppix++ = *p;
+ if (p < ppixRed + c)
+ *pDst++ |= *p << pmap->pVisual->offsetRed;
}
pmap->numPixelsRed[client] += npixR;
pmap->freeRed -= npixR;
ppix = gpix + pmap->numPixelsGreen[client];
- for (pDst = pixels, p = ppixGreen; p < ppixGreen + npixG; p++)
- {
- *ppix++ = *p;
- if(p < ppixGreen + c)
- *pDst++ |= *p << pmap->pVisual->offsetGreen;
+ for (pDst = pixels, p = ppixGreen; p < ppixGreen + npixG; p++) {
+ *ppix++ = *p;
+ if (p < ppixGreen + c)
+ *pDst++ |= *p << pmap->pVisual->offsetGreen;
}
pmap->numPixelsGreen[client] += npixG;
pmap->freeGreen -= npixG;
ppix = bpix + pmap->numPixelsBlue[client];
- for (pDst = pixels, p = ppixBlue; p < ppixBlue + npixB; p++)
- {
- *ppix++ = *p;
- if(p < ppixBlue + c)
- *pDst++ |= *p << pmap->pVisual->offsetBlue;
+ for (pDst = pixels, p = ppixBlue; p < ppixBlue + npixB; p++) {
+ *ppix++ = *p;
+ if (p < ppixBlue + c)
+ *pDst++ |= *p << pmap->pVisual->offsetBlue;
}
pmap->numPixelsBlue[client] += npixB;
pmap->freeBlue -= npixB;
-
for (pDst = pixels; pDst < pixels + c; pDst++)
- *pDst |= ALPHAMASK(pmap->pVisual);
+ *pDst |= ALPHAMASK(pmap->pVisual);
free(ppixBlue);
free(ppixGreen);
@@ -1851,46 +1739,44 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
}
static int
-AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
- Pixel *pixels, Pixel *pmask, Pixel **pppixFirst)
+AllocPseudo(int client, ColormapPtr pmap, int c, int r, Bool contig,
+ Pixel * pixels, Pixel * pmask, Pixel ** pppixFirst)
{
- Pixel *ppix, *p, *pDst, *ppixTemp;
- int npix;
- Bool ok;
+ Pixel *ppix, *p, *pDst, *ppixTemp;
+ int npix;
+ Bool ok;
npix = c << r;
if ((r >= 32) || (npix > pmap->freeRed) || (npix < c))
- return BadAlloc;
- if(!(ppixTemp = malloc(npix * sizeof(Pixel))))
- return BadAlloc;
+ return BadAlloc;
+ if (!(ppixTemp = malloc(npix * sizeof(Pixel))))
+ return BadAlloc;
ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask);
- if (ok)
- {
-
- /* all the allocated pixels are added to the client pixel list,
- * but only the unique ones are returned to the client */
- ppix = (Pixel *)realloc(pmap->clientPixelsRed[client],
- (pmap->numPixelsRed[client] + npix) * sizeof(Pixel));
- if (!ppix)
- {
- for (p = ppixTemp; p < ppixTemp + npix; p++)
- pmap->red[*p].refcnt = 0;
- free(ppixTemp);
- return BadAlloc;
- }
- pmap->clientPixelsRed[client] = ppix;
- ppix += pmap->numPixelsRed[client];
- *pppixFirst = ppix;
- pDst = pixels;
- for (p = ppixTemp; p < ppixTemp + npix; p++)
- {
- *ppix++ = *p;
- if(p < ppixTemp + c)
- *pDst++ = *p;
- }
- pmap->numPixelsRed[client] += npix;
- pmap->freeRed -= npix;
+ if (ok) {
+
+ /* all the allocated pixels are added to the client pixel list,
+ * but only the unique ones are returned to the client */
+ ppix = (Pixel *) realloc(pmap->clientPixelsRed[client],
+ (pmap->numPixelsRed[client] +
+ npix) * sizeof(Pixel));
+ if (!ppix) {
+ for (p = ppixTemp; p < ppixTemp + npix; p++)
+ pmap->red[*p].refcnt = 0;
+ free(ppixTemp);
+ return BadAlloc;
+ }
+ pmap->clientPixelsRed[client] = ppix;
+ ppix += pmap->numPixelsRed[client];
+ *pppixFirst = ppix;
+ pDst = pixels;
+ for (p = ppixTemp; p < ppixTemp + npix; p++) {
+ *ppix++ = *p;
+ if (p < ppixTemp + c)
+ *pDst++ = *p;
+ }
+ pmap->numPixelsRed[client] += npix;
+ pmap->freeRed -= npix;
}
free(ppixTemp);
return ok ? Success : BadAlloc;
@@ -1907,43 +1793,39 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
* (see AllocShared for why we care)
*/
static Bool
-AllocCP (ColormapPtr pmap, EntryPtr pentFirst, int count, int planes,
- Bool contig, Pixel *pixels, Pixel *pMask)
+AllocCP(ColormapPtr pmap, EntryPtr pentFirst, int count, int planes,
+ Bool contig, Pixel * pixels, Pixel * pMask)
{
- EntryPtr ent;
- Pixel pixel, base, entries, maxp, save;
- int dplanes, found;
- Pixel *ppix;
- Pixel mask;
- Pixel finalmask;
+ EntryPtr ent;
+ Pixel pixel, base, entries, maxp, save;
+ int dplanes, found;
+ Pixel *ppix;
+ Pixel mask;
+ Pixel finalmask;
dplanes = pmap->pVisual->nplanes;
/* Easy case. Allocate pixels only */
- if (planes == 0)
- {
+ if (planes == 0) {
/* allocate writable entries */
- ppix = pixels;
+ ppix = pixels;
ent = pentFirst;
pixel = 0;
- while (--count >= 0)
- {
+ while (--count >= 0) {
/* Just find count unallocated cells */
- while (ent->refcnt)
- {
- ent++;
- pixel++;
- }
- ent->refcnt = AllocPrivate;
- *ppix++ = pixel;
- ent->fShared = FALSE;
+ while (ent->refcnt) {
+ ent++;
+ pixel++;
+ }
+ ent->refcnt = AllocPrivate;
+ *ppix++ = pixel;
+ ent->fShared = FALSE;
}
*pMask = 0;
return TRUE;
}
- else if (planes > dplanes)
- {
- return FALSE;
+ else if (planes > dplanes) {
+ return FALSE;
}
/* General case count pixels * 2 ^ planes cells to be allocated */
@@ -1952,56 +1834,49 @@ AllocCP (ColormapPtr pmap, EntryPtr pentFirst, int count, int planes,
ent = pentFirst;
/* first try for contiguous planes, since it's fastest */
- for (mask = (((Pixel)1) << planes) - 1, base = 1, dplanes -= (planes - 1);
- --dplanes >= 0;
- mask += mask, base += base)
- {
+ for (mask = (((Pixel) 1) << planes) - 1, base = 1, dplanes -= (planes - 1);
+ --dplanes >= 0; mask += mask, base += base) {
ppix = pixels;
found = 0;
pixel = 0;
entries = pmap->pVisual->ColormapEntries - mask;
- while (pixel < entries)
- {
- save = pixel;
- maxp = pixel + mask + base;
- /* check if all are free */
- while (pixel != maxp && ent[pixel].refcnt == 0)
- pixel += base;
- if (pixel == maxp)
- {
- /* this one works */
- *ppix++ = save;
- found++;
- if (found == count)
- {
- /* found enough, allocate them all */
- while (--count >= 0)
- {
- pixel = pixels[count];
- maxp = pixel + mask;
- while (1)
- {
- ent[pixel].refcnt = AllocPrivate;
- ent[pixel].fShared = FALSE;
- if (pixel == maxp)
- break;
- pixel += base;
- *ppix++ = pixel;
- }
- }
- *pMask = mask;
- return TRUE;
- }
- }
- pixel = save + 1;
- if (pixel & mask)
- pixel += mask;
+ while (pixel < entries) {
+ save = pixel;
+ maxp = pixel + mask + base;
+ /* check if all are free */
+ while (pixel != maxp && ent[pixel].refcnt == 0)
+ pixel += base;
+ if (pixel == maxp) {
+ /* this one works */
+ *ppix++ = save;
+ found++;
+ if (found == count) {
+ /* found enough, allocate them all */
+ while (--count >= 0) {
+ pixel = pixels[count];
+ maxp = pixel + mask;
+ while (1) {
+ ent[pixel].refcnt = AllocPrivate;
+ ent[pixel].fShared = FALSE;
+ if (pixel == maxp)
+ break;
+ pixel += base;
+ *ppix++ = pixel;
+ }
+ }
+ *pMask = mask;
+ return TRUE;
+ }
+ }
+ pixel = save + 1;
+ if (pixel & mask)
+ pixel += mask;
}
}
dplanes = pmap->pVisual->nplanes;
if (contig || planes == 1 || dplanes < 3)
- return FALSE;
+ return FALSE;
/* this will be very slow for large maps, need a better algorithm */
@@ -2012,67 +1887,62 @@ AllocCP (ColormapPtr pmap, EntryPtr pentFirst, int count, int planes,
(Non-contiguous masks need one more bit than contiguous masks). Then
the smallest such mask consists of the rightmost planes-1 bits set, then
a zero, then a one in position planes + 1. The formula is
- (3 << (planes-1)) -1
+ (3 << (planes-1)) -1
The largest such masks consists of the leftmost planes-1 bits set, then
a zero, then a one bit in position dplanes-planes-1. If dplanes is
smaller than 32 (the number of bits in a word) then the formula is:
- (1<<dplanes) - (1<<(dplanes-planes+1) + (1<<dplanes-planes-1)
+ (1<<dplanes) - (1<<(dplanes-planes+1) + (1<<dplanes-planes-1)
If dplanes = 32, then we can't calculate (1<<dplanes) and we have
to use:
- ( (1<<(planes-1)) - 1) << (dplanes-planes+1) + (1<<(dplanes-planes-1))
-
- << Thank you, Loretta>>>
+ ( (1<<(planes-1)) - 1) << (dplanes-planes+1) + (1<<(dplanes-planes-1))
+
+ << Thank you, Loretta>>>
- */
+ */
finalmask =
- (((((Pixel)1)<<(planes-1)) - 1) << (dplanes-planes+1)) +
- (((Pixel)1)<<(dplanes-planes-1));
- for (mask = (((Pixel)3) << (planes -1)) - 1; mask <= finalmask; mask++)
- {
+ (((((Pixel) 1) << (planes - 1)) - 1) << (dplanes - planes + 1)) +
+ (((Pixel) 1) << (dplanes - planes - 1));
+ for (mask = (((Pixel) 3) << (planes - 1)) - 1; mask <= finalmask; mask++) {
/* next 3 magic statements count number of ones (HAKMEM #169) */
pixel = (mask >> 1) & 033333333333;
pixel = mask - pixel - ((pixel >> 1) & 033333333333);
if ((((pixel + (pixel >> 3)) & 030707070707) % 077) != planes)
- continue;
+ continue;
ppix = pixels;
found = 0;
entries = pmap->pVisual->ColormapEntries - mask;
- base = lowbit (mask);
- for (pixel = 0; pixel < entries; pixel++)
- {
- if (pixel & mask)
- continue;
- maxp = 0;
- /* check if all are free */
- while (ent[pixel + maxp].refcnt == 0)
- {
- GetNextBitsOrBreak(maxp, mask, base);
- }
- if ((maxp < mask) || (ent[pixel + mask].refcnt != 0))
- continue;
- /* this one works */
- *ppix++ = pixel;
- found++;
- if (found < count)
- continue;
- /* found enough, allocate them all */
- while (--count >= 0)
- {
- pixel = (pixels)[count];
- maxp = 0;
- while (1)
- {
- ent[pixel + maxp].refcnt = AllocPrivate;
- ent[pixel + maxp].fShared = FALSE;
- GetNextBitsOrBreak(maxp, mask, base);
- *ppix++ = pixel + maxp;
- }
- }
-
- *pMask = mask;
- return TRUE;
- }
+ base = lowbit(mask);
+ for (pixel = 0; pixel < entries; pixel++) {
+ if (pixel & mask)
+ continue;
+ maxp = 0;
+ /* check if all are free */
+ while (ent[pixel + maxp].refcnt == 0) {
+ GetNextBitsOrBreak(maxp, mask, base);
+ }
+ if ((maxp < mask) || (ent[pixel + mask].refcnt != 0))
+ continue;
+ /* this one works */
+ *ppix++ = pixel;
+ found++;
+ if (found < count)
+ continue;
+ /* found enough, allocate them all */
+ while (--count >= 0) {
+ pixel = (pixels)[count];
+ maxp = 0;
+ while (1) {
+ ent[pixel + maxp].refcnt = AllocPrivate;
+ ent[pixel + maxp].fShared = FALSE;
+ GetNextBitsOrBreak(maxp, mask, base);
+ *ppix++ = pixel + maxp;
+ }
+ }
+
+ *pMask = mask;
+ return TRUE;
+ }
}
return FALSE;
}
@@ -2082,173 +1952,145 @@ AllocCP (ColormapPtr pmap, EntryPtr pentFirst, int count, int planes,
* \param ppixFirst First of the client's new pixels
*/
static Bool
-AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
- Pixel rmask, Pixel gmask, Pixel bmask, Pixel *ppixFirst)
+AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
+ Pixel rmask, Pixel gmask, Pixel bmask, Pixel * ppixFirst)
{
- Pixel *pptr, *cptr;
- int npix, z, npixClientNew, npixShared;
- Pixel basemask, base, bits, common;
+ Pixel *pptr, *cptr;
+ int npix, z, npixClientNew, npixShared;
+ Pixel basemask, base, bits, common;
SHAREDCOLOR *pshared, **ppshared, **psharedList;
npixClientNew = c << (r + g + b);
npixShared = (c << r) + (c << g) + (c << b);
psharedList = malloc(npixShared * sizeof(SHAREDCOLOR *));
if (!psharedList)
- return FALSE;
+ return FALSE;
ppshared = psharedList;
- for (z = npixShared; --z >= 0; )
- {
- if (!(ppshared[z] = malloc(sizeof(SHAREDCOLOR))))
- {
- for (z++ ; z < npixShared; z++)
- free(ppshared[z]);
- free(psharedList);
- return FALSE;
- }
- }
- for(pptr = ppix, npix = c; --npix >= 0; pptr++)
- {
- basemask = ~(gmask | bmask);
- common = *pptr & basemask;
- if (rmask)
- {
- bits = 0;
- base = lowbit (rmask);
- while(1)
- {
- pshared = *ppshared++;
- pshared->refcnt = 1 << (g + b);
- for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
- {
- if ((*cptr & basemask) == (common | bits))
- {
- pmap->red[*cptr].fShared = TRUE;
- pmap->red[*cptr].co.shco.red = pshared;
- }
- }
- GetNextBitsOrBreak(bits, rmask, base);
- }
- }
- else
- {
- pshared = *ppshared++;
- pshared->refcnt = 1 << (g + b);
- for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
- {
- if ((*cptr & basemask) == common)
- {
- pmap->red[*cptr].fShared = TRUE;
- pmap->red[*cptr].co.shco.red = pshared;
- }
- }
- }
- basemask = ~(rmask | bmask);
- common = *pptr & basemask;
- if (gmask)
- {
- bits = 0;
- base = lowbit (gmask);
- while(1)
- {
- pshared = *ppshared++;
- pshared->refcnt = 1 << (r + b);
- for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
- {
- if ((*cptr & basemask) == (common | bits))
- {
- pmap->red[*cptr].co.shco.green = pshared;
- }
- }
- GetNextBitsOrBreak(bits, gmask, base);
- }
- }
- else
- {
- pshared = *ppshared++;
- pshared->refcnt = 1 << (g + b);
- for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
- {
- if ((*cptr & basemask) == common)
- {
- pmap->red[*cptr].co.shco.green = pshared;
- }
- }
- }
- basemask = ~(rmask | gmask);
- common = *pptr & basemask;
- if (bmask)
- {
- bits = 0;
- base = lowbit (bmask);
- while(1)
- {
- pshared = *ppshared++;
- pshared->refcnt = 1 << (r + g);
- for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
- {
- if ((*cptr & basemask) == (common | bits))
- {
- pmap->red[*cptr].co.shco.blue = pshared;
- }
- }
- GetNextBitsOrBreak(bits, bmask, base);
- }
- }
- else
- {
- pshared = *ppshared++;
- pshared->refcnt = 1 << (g + b);
- for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
- {
- if ((*cptr & basemask) == common)
- {
- pmap->red[*cptr].co.shco.blue = pshared;
- }
- }
- }
+ for (z = npixShared; --z >= 0;) {
+ if (!(ppshared[z] = malloc(sizeof(SHAREDCOLOR)))) {
+ for (z++; z < npixShared; z++)
+ free(ppshared[z]);
+ free(psharedList);
+ return FALSE;
+ }
+ }
+ for (pptr = ppix, npix = c; --npix >= 0; pptr++) {
+ basemask = ~(gmask | bmask);
+ common = *pptr & basemask;
+ if (rmask) {
+ bits = 0;
+ base = lowbit(rmask);
+ while (1) {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (g + b);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
+ if ((*cptr & basemask) == (common | bits)) {
+ pmap->red[*cptr].fShared = TRUE;
+ pmap->red[*cptr].co.shco.red = pshared;
+ }
+ }
+ GetNextBitsOrBreak(bits, rmask, base);
+ }
+ }
+ else {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (g + b);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
+ if ((*cptr & basemask) == common) {
+ pmap->red[*cptr].fShared = TRUE;
+ pmap->red[*cptr].co.shco.red = pshared;
+ }
+ }
+ }
+ basemask = ~(rmask | bmask);
+ common = *pptr & basemask;
+ if (gmask) {
+ bits = 0;
+ base = lowbit(gmask);
+ while (1) {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (r + b);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
+ if ((*cptr & basemask) == (common | bits)) {
+ pmap->red[*cptr].co.shco.green = pshared;
+ }
+ }
+ GetNextBitsOrBreak(bits, gmask, base);
+ }
+ }
+ else {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (g + b);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
+ if ((*cptr & basemask) == common) {
+ pmap->red[*cptr].co.shco.green = pshared;
+ }
+ }
+ }
+ basemask = ~(rmask | gmask);
+ common = *pptr & basemask;
+ if (bmask) {
+ bits = 0;
+ base = lowbit(bmask);
+ while (1) {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (r + g);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
+ if ((*cptr & basemask) == (common | bits)) {
+ pmap->red[*cptr].co.shco.blue = pshared;
+ }
+ }
+ GetNextBitsOrBreak(bits, bmask, base);
+ }
+ }
+ else {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (g + b);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
+ if ((*cptr & basemask) == common) {
+ pmap->red[*cptr].co.shco.blue = pshared;
+ }
+ }
+ }
}
free(psharedList);
return TRUE;
}
-
/** FreeColors
* Free colors and/or cells (probably slow for large numbers)
*/
int
-FreeColors (ColormapPtr pmap, int client, int count, Pixel *pixels, Pixel mask)
+FreeColors(ColormapPtr pmap, int client, int count, Pixel * pixels, Pixel mask)
{
- int rval, result, class;
- Pixel rmask;
+ int rval, result, class;
+ Pixel rmask;
class = pmap->class;
if (pmap->flags & AllAllocated)
- return BadAccess;
- if ((class | DynamicClass) == DirectColor)
- {
- rmask = mask & RGBMASK(pmap->pVisual);
+ return BadAccess;
+ if ((class | DynamicClass) == DirectColor) {
+ rmask = mask & RGBMASK(pmap->pVisual);
result = FreeCo(pmap, client, REDMAP, count, pixels,
- mask & pmap->pVisual->redMask);
- /* If any of the three calls fails, we must report that, if more
- * than one fails, it's ok that we report the last one */
+ mask & pmap->pVisual->redMask);
+ /* If any of the three calls fails, we must report that, if more
+ * than one fails, it's ok that we report the last one */
rval = FreeCo(pmap, client, GREENMAP, count, pixels,
- mask & pmap->pVisual->greenMask);
- if(rval != Success)
- result = rval;
- rval = FreeCo(pmap, client, BLUEMAP, count, pixels,
- mask & pmap->pVisual->blueMask);
- if(rval != Success)
- result = rval;
- }
- else
- {
- rmask = mask & ((((Pixel)1) << pmap->pVisual->nplanes) - 1);
+ mask & pmap->pVisual->greenMask);
+ if (rval != Success)
+ result = rval;
+ rval = FreeCo(pmap, client, BLUEMAP, count, pixels,
+ mask & pmap->pVisual->blueMask);
+ if (rval != Success)
+ result = rval;
+ }
+ else {
+ rmask = mask & ((((Pixel) 1) << pmap->pVisual->nplanes) - 1);
result = FreeCo(pmap, client, PSEUDOMAP, count, pixels, rmask);
}
- if ((mask != rmask) && count)
- {
- clients[client]->errorValue = *pixels | mask;
- result = BadValue;
+ if ((mask != rmask) && count) {
+ clients[client]->errorValue = *pixels | mask;
+ result = BadValue;
}
/* XXX should worry about removing any RT_CMAPENTRY resource */
return result;
@@ -2266,435 +2108,381 @@ FreeColors (ColormapPtr pmap, int client, int count, Pixel *pixels, Pixel mask)
* \param mask mask client gave us
*/
static int
-FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixel mask)
+FreeCo(ColormapPtr pmap, int client, int color, int npixIn, Pixel * ppixIn,
+ Pixel mask)
{
- Pixel *ppixClient, pixTest;
- int npixClient, npixNew, npix;
- Pixel bits, base, cmask, rgbbad;
- Pixel *pptr, *cptr;
- int n, zapped;
- int errVal = Success;
- int offset, numents;
+ Pixel *ppixClient, pixTest;
+ int npixClient, npixNew, npix;
+ Pixel bits, base, cmask, rgbbad;
+ Pixel *pptr, *cptr;
+ int n, zapped;
+ int errVal = Success;
+ int offset, numents;
if (npixIn == 0)
return errVal;
bits = 0;
zapped = 0;
- base = lowbit (mask);
-
- switch(color)
- {
- case REDMAP:
- cmask = pmap->pVisual->redMask;
- rgbbad = ~RGBMASK(pmap->pVisual);
- offset = pmap->pVisual->offsetRed;
- numents = (cmask >> offset) + 1;
- ppixClient = pmap->clientPixelsRed[client];
- npixClient = pmap->numPixelsRed[client];
- break;
- case GREENMAP:
- cmask = pmap->pVisual->greenMask;
- rgbbad = ~RGBMASK(pmap->pVisual);
- offset = pmap->pVisual->offsetGreen;
- numents = (cmask >> offset) + 1;
- ppixClient = pmap->clientPixelsGreen[client];
- npixClient = pmap->numPixelsGreen[client];
- break;
- case BLUEMAP:
- cmask = pmap->pVisual->blueMask;
- rgbbad = ~RGBMASK(pmap->pVisual);
- offset = pmap->pVisual->offsetBlue;
- numents = (cmask >> offset) + 1;
- ppixClient = pmap->clientPixelsBlue[client];
- npixClient = pmap->numPixelsBlue[client];
- break;
- default: /* so compiler can see that everything gets initialized */
- case PSEUDOMAP:
- cmask = ~((Pixel)0);
- rgbbad = 0;
- offset = 0;
- numents = pmap->pVisual->ColormapEntries;
- ppixClient = pmap->clientPixelsRed[client];
- npixClient = pmap->numPixelsRed[client];
- break;
+ base = lowbit(mask);
+
+ switch (color) {
+ case REDMAP:
+ cmask = pmap->pVisual->redMask;
+ rgbbad = ~RGBMASK(pmap->pVisual);
+ offset = pmap->pVisual->offsetRed;
+ numents = (cmask >> offset) + 1;
+ ppixClient = pmap->clientPixelsRed[client];
+ npixClient = pmap->numPixelsRed[client];
+ break;
+ case GREENMAP:
+ cmask = pmap->pVisual->greenMask;
+ rgbbad = ~RGBMASK(pmap->pVisual);
+ offset = pmap->pVisual->offsetGreen;
+ numents = (cmask >> offset) + 1;
+ ppixClient = pmap->clientPixelsGreen[client];
+ npixClient = pmap->numPixelsGreen[client];
+ break;
+ case BLUEMAP:
+ cmask = pmap->pVisual->blueMask;
+ rgbbad = ~RGBMASK(pmap->pVisual);
+ offset = pmap->pVisual->offsetBlue;
+ numents = (cmask >> offset) + 1;
+ ppixClient = pmap->clientPixelsBlue[client];
+ npixClient = pmap->numPixelsBlue[client];
+ break;
+ default: /* so compiler can see that everything gets initialized */
+ case PSEUDOMAP:
+ cmask = ~((Pixel) 0);
+ rgbbad = 0;
+ offset = 0;
+ numents = pmap->pVisual->ColormapEntries;
+ ppixClient = pmap->clientPixelsRed[client];
+ npixClient = pmap->numPixelsRed[client];
+ break;
}
-
/* zap all pixels which match */
- while (1)
- {
+ while (1) {
/* go through pixel list */
- for (pptr = ppixIn, n = npixIn; --n >= 0; pptr++)
- {
- pixTest = ((*pptr | bits) & cmask) >> offset;
- if ((pixTest >= numents) || (*pptr & rgbbad))
- {
- clients[client]->errorValue = *pptr | bits;
- errVal = BadValue;
- continue;
- }
-
- /* find match in client list */
- for (cptr = ppixClient, npix = npixClient;
- --npix >= 0 && *cptr != pixTest;
- cptr++) ;
-
- if (npix >= 0)
- {
- if (pmap->class & DynamicClass)
- {
- FreeCell(pmap, pixTest, color);
- }
- *cptr = ~((Pixel)0);
- zapped++;
- }
- else
- errVal = BadAccess;
- }
+ for (pptr = ppixIn, n = npixIn; --n >= 0; pptr++) {
+ pixTest = ((*pptr | bits) & cmask) >> offset;
+ if ((pixTest >= numents) || (*pptr & rgbbad)) {
+ clients[client]->errorValue = *pptr | bits;
+ errVal = BadValue;
+ continue;
+ }
+
+ /* find match in client list */
+ for (cptr = ppixClient, npix = npixClient;
+ --npix >= 0 && *cptr != pixTest; cptr++);
+
+ if (npix >= 0) {
+ if (pmap->class & DynamicClass) {
+ FreeCell(pmap, pixTest, color);
+ }
+ *cptr = ~((Pixel) 0);
+ zapped++;
+ }
+ else
+ errVal = BadAccess;
+ }
/* generate next bits value */
- GetNextBitsOrBreak(bits, mask, base);
+ GetNextBitsOrBreak(bits, mask, base);
}
/* delete freed pixels from client pixel list */
- if (zapped)
- {
+ if (zapped) {
npixNew = npixClient - zapped;
- if (npixNew)
- {
- /* Since the list can only get smaller, we can do a copy in
- * place and then realloc to a smaller size */
- pptr = cptr = ppixClient;
-
- /* If we have all the new pixels, we don't have to examine the
- * rest of the old ones */
- for(npix = 0; npix < npixNew; cptr++)
- {
- if (*cptr != ~((Pixel)0))
- {
- *pptr++ = *cptr;
- npix++;
- }
- }
- pptr = (Pixel *)realloc(ppixClient, npixNew * sizeof(Pixel));
- if (pptr)
- ppixClient = pptr;
- npixClient = npixNew;
+ if (npixNew) {
+ /* Since the list can only get smaller, we can do a copy in
+ * place and then realloc to a smaller size */
+ pptr = cptr = ppixClient;
+
+ /* If we have all the new pixels, we don't have to examine the
+ * rest of the old ones */
+ for (npix = 0; npix < npixNew; cptr++) {
+ if (*cptr != ~((Pixel) 0)) {
+ *pptr++ = *cptr;
+ npix++;
+ }
+ }
+ pptr = (Pixel *) realloc(ppixClient, npixNew * sizeof(Pixel));
+ if (pptr)
+ ppixClient = pptr;
+ npixClient = npixNew;
+ }
+ else {
+ npixClient = 0;
+ free(ppixClient);
+ ppixClient = (Pixel *) NULL;
+ }
+ switch (color) {
+ case PSEUDOMAP:
+ case REDMAP:
+ pmap->clientPixelsRed[client] = ppixClient;
+ pmap->numPixelsRed[client] = npixClient;
+ break;
+ case GREENMAP:
+ pmap->clientPixelsGreen[client] = ppixClient;
+ pmap->numPixelsGreen[client] = npixClient;
+ break;
+ case BLUEMAP:
+ pmap->clientPixelsBlue[client] = ppixClient;
+ pmap->numPixelsBlue[client] = npixClient;
+ break;
}
- else
- {
- npixClient = 0;
- free(ppixClient);
- ppixClient = (Pixel *)NULL;
- }
- switch(color)
- {
- case PSEUDOMAP:
- case REDMAP:
- pmap->clientPixelsRed[client] = ppixClient;
- pmap->numPixelsRed[client] = npixClient;
- break;
- case GREENMAP:
- pmap->clientPixelsGreen[client] = ppixClient;
- pmap->numPixelsGreen[client] = npixClient;
- break;
- case BLUEMAP:
- pmap->clientPixelsBlue[client] = ppixClient;
- pmap->numPixelsBlue[client] = npixClient;
- break;
- }
}
return errVal;
}
-
-
/* Redefine color values */
int
-StoreColors (ColormapPtr pmap, int count, xColorItem *defs, ClientPtr client)
+StoreColors(ColormapPtr pmap, int count, xColorItem * defs, ClientPtr client)
{
- Pixel pix;
+ Pixel pix;
xColorItem *pdef;
- EntryPtr pent, pentT, pentLast;
- VisualPtr pVisual;
- SHAREDCOLOR *pred, *pgreen, *pblue;
- int n, ChgRed, ChgGreen, ChgBlue, idef;
- int class, errVal = Success;
- int ok;
-
+ EntryPtr pent, pentT, pentLast;
+ VisualPtr pVisual;
+ SHAREDCOLOR *pred, *pgreen, *pblue;
+ int n, ChgRed, ChgGreen, ChgBlue, idef;
+ int class, errVal = Success;
+ int ok;
class = pmap->class;
- if(!(class & DynamicClass) && !(pmap->flags & BeingCreated))
- {
- return BadAccess;
+ if (!(class & DynamicClass) && !(pmap->flags & BeingCreated)) {
+ return BadAccess;
}
pVisual = pmap->pVisual;
idef = 0;
- if((class | DynamicClass) == DirectColor)
- {
- int numred, numgreen, numblue;
- Pixel rgbbad;
-
- numred = NUMRED(pVisual);
- numgreen = NUMGREEN(pVisual);
- numblue = NUMBLUE(pVisual);
- rgbbad = ~RGBMASK(pVisual);
- for (pdef = defs, n = 0; n < count; pdef++, n++)
- {
- ok = TRUE;
+ if ((class | DynamicClass) == DirectColor) {
+ int numred, numgreen, numblue;
+ Pixel rgbbad;
+
+ numred = NUMRED(pVisual);
+ numgreen = NUMGREEN(pVisual);
+ numblue = NUMBLUE(pVisual);
+ rgbbad = ~RGBMASK(pVisual);
+ for (pdef = defs, n = 0; n < count; pdef++, n++) {
+ ok = TRUE;
(*pmap->pScreen->ResolveColor)
- (&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual);
-
- if (pdef->pixel & rgbbad)
- {
- errVal = BadValue;
- client->errorValue = pdef->pixel;
- continue;
- }
- pix = (pdef->pixel & pVisual->redMask) >> pVisual->offsetRed;
- if (pix >= numred)
- {
- errVal = BadValue;
- ok = FALSE;
- }
- else if (pmap->red[pix].refcnt != AllocPrivate)
- {
- errVal = BadAccess;
- ok = FALSE;
- }
- else if (pdef->flags & DoRed)
- {
- pmap->red[pix].co.local.red = pdef->red;
- }
- else
- {
- pdef->red = pmap->red[pix].co.local.red;
- }
-
- pix = (pdef->pixel & pVisual->greenMask) >> pVisual->offsetGreen;
- if (pix >= numgreen)
- {
- errVal = BadValue;
- ok = FALSE;
- }
- else if (pmap->green[pix].refcnt != AllocPrivate)
- {
- errVal = BadAccess;
- ok = FALSE;
- }
- else if (pdef->flags & DoGreen)
- {
- pmap->green[pix].co.local.green = pdef->green;
- }
- else
- {
- pdef->green = pmap->green[pix].co.local.green;
- }
-
- pix = (pdef->pixel & pVisual->blueMask) >> pVisual->offsetBlue;
- if (pix >= numblue)
- {
- errVal = BadValue;
- ok = FALSE;
- }
- else if (pmap->blue[pix].refcnt != AllocPrivate)
- {
- errVal = BadAccess;
- ok = FALSE;
- }
- else if (pdef->flags & DoBlue)
- {
- pmap->blue[pix].co.local.blue = pdef->blue;
- }
- else
- {
- pdef->blue = pmap->blue[pix].co.local.blue;
- }
- /* If this is an o.k. entry, then it gets added to the list
- * to be sent to the hardware. If not, skip it. Once we've
- * skipped one, we have to copy all the others.
- */
- if(ok)
- {
- if(idef != n)
- defs[idef] = defs[n];
- idef++;
- } else
- client->errorValue = pdef->pixel;
- }
+ (&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual);
+
+ if (pdef->pixel & rgbbad) {
+ errVal = BadValue;
+ client->errorValue = pdef->pixel;
+ continue;
+ }
+ pix = (pdef->pixel & pVisual->redMask) >> pVisual->offsetRed;
+ if (pix >= numred) {
+ errVal = BadValue;
+ ok = FALSE;
+ }
+ else if (pmap->red[pix].refcnt != AllocPrivate) {
+ errVal = BadAccess;
+ ok = FALSE;
+ }
+ else if (pdef->flags & DoRed) {
+ pmap->red[pix].co.local.red = pdef->red;
+ }
+ else {
+ pdef->red = pmap->red[pix].co.local.red;
+ }
+
+ pix = (pdef->pixel & pVisual->greenMask) >> pVisual->offsetGreen;
+ if (pix >= numgreen) {
+ errVal = BadValue;
+ ok = FALSE;
+ }
+ else if (pmap->green[pix].refcnt != AllocPrivate) {
+ errVal = BadAccess;
+ ok = FALSE;
+ }
+ else if (pdef->flags & DoGreen) {
+ pmap->green[pix].co.local.green = pdef->green;
+ }
+ else {
+ pdef->green = pmap->green[pix].co.local.green;
+ }
+
+ pix = (pdef->pixel & pVisual->blueMask) >> pVisual->offsetBlue;
+ if (pix >= numblue) {
+ errVal = BadValue;
+ ok = FALSE;
+ }
+ else if (pmap->blue[pix].refcnt != AllocPrivate) {
+ errVal = BadAccess;
+ ok = FALSE;
+ }
+ else if (pdef->flags & DoBlue) {
+ pmap->blue[pix].co.local.blue = pdef->blue;
+ }
+ else {
+ pdef->blue = pmap->blue[pix].co.local.blue;
+ }
+ /* If this is an o.k. entry, then it gets added to the list
+ * to be sent to the hardware. If not, skip it. Once we've
+ * skipped one, we have to copy all the others.
+ */
+ if (ok) {
+ if (idef != n)
+ defs[idef] = defs[n];
+ idef++;
+ }
+ else
+ client->errorValue = pdef->pixel;
+ }
}
- else
- {
- for (pdef = defs, n = 0; n < count; pdef++, n++)
- {
-
- ok = TRUE;
- if (pdef->pixel >= pVisual->ColormapEntries)
- {
- client->errorValue = pdef->pixel;
- errVal = BadValue;
- ok = FALSE;
- }
- else if (pmap->red[pdef->pixel].refcnt != AllocPrivate)
- {
- errVal = BadAccess;
- ok = FALSE;
- }
-
- /* If this is an o.k. entry, then it gets added to the list
- * to be sent to the hardware. If not, skip it. Once we've
- * skipped one, we have to copy all the others.
- */
- if(ok)
- {
- if(idef != n)
- defs[idef] = defs[n];
- idef++;
- }
- else
- continue;
+ else {
+ for (pdef = defs, n = 0; n < count; pdef++, n++) {
+
+ ok = TRUE;
+ if (pdef->pixel >= pVisual->ColormapEntries) {
+ client->errorValue = pdef->pixel;
+ errVal = BadValue;
+ ok = FALSE;
+ }
+ else if (pmap->red[pdef->pixel].refcnt != AllocPrivate) {
+ errVal = BadAccess;
+ ok = FALSE;
+ }
+
+ /* If this is an o.k. entry, then it gets added to the list
+ * to be sent to the hardware. If not, skip it. Once we've
+ * skipped one, we have to copy all the others.
+ */
+ if (ok) {
+ if (idef != n)
+ defs[idef] = defs[n];
+ idef++;
+ }
+ else
+ continue;
(*pmap->pScreen->ResolveColor)
- (&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual);
-
- pent = &pmap->red[pdef->pixel];
-
- if(pdef->flags & DoRed)
- {
- if(pent->fShared)
- {
- pent->co.shco.red->color = pdef->red;
- if (pent->co.shco.red->refcnt > 1)
- ok = FALSE;
- }
- else
- pent->co.local.red = pdef->red;
- }
- else
- {
- if(pent->fShared)
- pdef->red = pent->co.shco.red->color;
- else
- pdef->red = pent->co.local.red;
- }
- if(pdef->flags & DoGreen)
- {
- if(pent->fShared)
- {
- pent->co.shco.green->color = pdef->green;
- if (pent->co.shco.green->refcnt > 1)
- ok = FALSE;
- }
- else
- pent->co.local.green = pdef->green;
- }
- else
- {
- if(pent->fShared)
- pdef->green = pent->co.shco.green->color;
- else
- pdef->green = pent->co.local.green;
- }
- if(pdef->flags & DoBlue)
- {
- if(pent->fShared)
- {
- pent->co.shco.blue->color = pdef->blue;
- if (pent->co.shco.blue->refcnt > 1)
- ok = FALSE;
- }
- else
- pent->co.local.blue = pdef->blue;
- }
- else
- {
- if(pent->fShared)
- pdef->blue = pent->co.shco.blue->color;
- else
- pdef->blue = pent->co.local.blue;
- }
-
- if(!ok)
- {
+ (&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual);
+
+ pent = &pmap->red[pdef->pixel];
+
+ if (pdef->flags & DoRed) {
+ if (pent->fShared) {
+ pent->co.shco.red->color = pdef->red;
+ if (pent->co.shco.red->refcnt > 1)
+ ok = FALSE;
+ }
+ else
+ pent->co.local.red = pdef->red;
+ }
+ else {
+ if (pent->fShared)
+ pdef->red = pent->co.shco.red->color;
+ else
+ pdef->red = pent->co.local.red;
+ }
+ if (pdef->flags & DoGreen) {
+ if (pent->fShared) {
+ pent->co.shco.green->color = pdef->green;
+ if (pent->co.shco.green->refcnt > 1)
+ ok = FALSE;
+ }
+ else
+ pent->co.local.green = pdef->green;
+ }
+ else {
+ if (pent->fShared)
+ pdef->green = pent->co.shco.green->color;
+ else
+ pdef->green = pent->co.local.green;
+ }
+ if (pdef->flags & DoBlue) {
+ if (pent->fShared) {
+ pent->co.shco.blue->color = pdef->blue;
+ if (pent->co.shco.blue->refcnt > 1)
+ ok = FALSE;
+ }
+ else
+ pent->co.local.blue = pdef->blue;
+ }
+ else {
+ if (pent->fShared)
+ pdef->blue = pent->co.shco.blue->color;
+ else
+ pdef->blue = pent->co.local.blue;
+ }
+
+ if (!ok) {
/* have to run through the colormap and change anybody who
- * shares this value */
- pred = pent->co.shco.red;
- pgreen = pent->co.shco.green;
- pblue = pent->co.shco.blue;
- ChgRed = pdef->flags & DoRed;
- ChgGreen = pdef->flags & DoGreen;
- ChgBlue = pdef->flags & DoBlue;
- pentLast = pmap->red + pVisual->ColormapEntries;
-
- for(pentT = pmap->red; pentT < pentLast; pentT++)
- {
- if(pentT->fShared && (pentT != pent))
- {
- xColorItem defChg;
-
- /* There are, alas, devices in this world too dumb
- * to read their own hardware colormaps. Sick, but
- * true. So we're going to be really nice and load
- * the xColorItem with the proper value for all the
- * fields. We will only set the flags for those
- * fields that actually change. Smart devices can
- * arrange to change only those fields. Dumb devices
- * can rest assured that we have provided for them,
- * and can change all three fields */
-
- defChg.flags = 0;
- if(ChgRed && pentT->co.shco.red == pred)
- {
- defChg.flags |= DoRed;
- }
- if(ChgGreen && pentT->co.shco.green == pgreen)
- {
- defChg.flags |= DoGreen;
- }
- if(ChgBlue && pentT->co.shco.blue == pblue)
- {
- defChg.flags |= DoBlue;
- }
- if(defChg.flags != 0)
- {
- defChg.pixel = pentT - pmap->red;
- defChg.red = pentT->co.shco.red->color;
- defChg.green = pentT->co.shco.green->color;
- defChg.blue = pentT->co.shco.blue->color;
- (*pmap->pScreen->StoreColors) (pmap, 1, &defChg);
- }
- }
- }
-
- }
- }
+ * shares this value */
+ pred = pent->co.shco.red;
+ pgreen = pent->co.shco.green;
+ pblue = pent->co.shco.blue;
+ ChgRed = pdef->flags & DoRed;
+ ChgGreen = pdef->flags & DoGreen;
+ ChgBlue = pdef->flags & DoBlue;
+ pentLast = pmap->red + pVisual->ColormapEntries;
+
+ for (pentT = pmap->red; pentT < pentLast; pentT++) {
+ if (pentT->fShared && (pentT != pent)) {
+ xColorItem defChg;
+
+ /* There are, alas, devices in this world too dumb
+ * to read their own hardware colormaps. Sick, but
+ * true. So we're going to be really nice and load
+ * the xColorItem with the proper value for all the
+ * fields. We will only set the flags for those
+ * fields that actually change. Smart devices can
+ * arrange to change only those fields. Dumb devices
+ * can rest assured that we have provided for them,
+ * and can change all three fields */
+
+ defChg.flags = 0;
+ if (ChgRed && pentT->co.shco.red == pred) {
+ defChg.flags |= DoRed;
+ }
+ if (ChgGreen && pentT->co.shco.green == pgreen) {
+ defChg.flags |= DoGreen;
+ }
+ if (ChgBlue && pentT->co.shco.blue == pblue) {
+ defChg.flags |= DoBlue;
+ }
+ if (defChg.flags != 0) {
+ defChg.pixel = pentT - pmap->red;
+ defChg.red = pentT->co.shco.red->color;
+ defChg.green = pentT->co.shco.green->color;
+ defChg.blue = pentT->co.shco.blue->color;
+ (*pmap->pScreen->StoreColors) (pmap, 1, &defChg);
+ }
+ }
+ }
+
+ }
+ }
}
/* Note that we use idef, the count of acceptable entries, and not
* count, the count of proposed entries */
if (idef != 0)
- ( *pmap->pScreen->StoreColors) (pmap, idef, defs);
+ (*pmap->pScreen->StoreColors) (pmap, idef, defs);
return errVal;
}
int
IsMapInstalled(Colormap map, WindowPtr pWin)
{
- Colormap *pmaps;
- int imap, nummaps, found;
+ Colormap *pmaps;
+ int imap, nummaps, found;
- pmaps = malloc(pWin->drawable.pScreen->maxInstalledCmaps*sizeof(Colormap));
- if(!pmaps)
- return FALSE;
+ pmaps =
+ malloc(pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap));
+ if (!pmaps)
+ return FALSE;
nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
(pWin->drawable.pScreen, pmaps);
found = FALSE;
- for(imap = 0; imap < nummaps; imap++)
- {
- if(pmaps[imap] == map)
- {
- found = TRUE;
- break;
- }
+ for (imap = 0; imap < nummaps; imap++) {
+ if (pmaps[imap] == map) {
+ found = TRUE;
+ break;
+ }
}
free(pmaps);
return found;
@@ -2705,8 +2493,8 @@ struct colormap_lookup_data {
VisualPtr visuals;
};
-static void _colormap_find_resource(pointer value, XID id,
- pointer cdata)
+static void
+_colormap_find_resource(pointer value, XID id, pointer cdata)
{
struct colormap_lookup_data *cmap_data = cdata;
VisualPtr visuals = cmap_data->visuals;
@@ -2715,7 +2503,7 @@ static void _colormap_find_resource(pointer value, XID id,
int j;
if (pScreen != cmap->pScreen)
- return;
+ return;
j = cmap->pVisual - pScreen->visuals;
cmap->pVisual = &visuals[j];
@@ -2724,8 +2512,7 @@ static void _colormap_find_resource(pointer value, XID id,
/* something has realloced the visuals, instead of breaking
ABI fix it up here - glx and compsite did this wrong */
Bool
-ResizeVisualArray(ScreenPtr pScreen, int new_visual_count,
- DepthPtr depth)
+ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
{
struct colormap_lookup_data cdata;
int numVisuals;
@@ -2736,7 +2523,8 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count,
first_new_vid = depth->numVids;
first_new_visual = pScreen->numVisuals;
- vids = realloc(depth->vids, (depth->numVids + new_visual_count) * sizeof(XID));
+ vids =
+ realloc(depth->vids, (depth->numVids + new_visual_count) * sizeof(XID));
if (!vids)
return FALSE;
@@ -2746,19 +2534,20 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count,
numVisuals = pScreen->numVisuals + new_visual_count;
visuals = realloc(pScreen->visuals, numVisuals * sizeof(VisualRec));
if (!visuals) {
- return FALSE;
+ return FALSE;
}
cdata.visuals = visuals;
cdata.pScreen = pScreen;
- FindClientResourcesByType(serverClient, RT_COLORMAP, _colormap_find_resource, &cdata);
+ FindClientResourcesByType(serverClient, RT_COLORMAP,
+ _colormap_find_resource, &cdata);
pScreen->visuals = visuals;
for (i = 0; i < new_visual_count; i++) {
- vid = FakeClientID(0);
- pScreen->visuals[first_new_visual + i].vid = vid;
- vids[first_new_vid + i] = vid;
+ vid = FakeClientID(0);
+ pScreen->visuals[first_new_visual + i].vid = vid;
+ vids[first_new_vid + i] = vid;
}
depth->numVids += new_visual_count;
diff --git a/xorg-server/dix/cursor.c b/xorg-server/dix/cursor.c
index 6bff44723..1ee127ac5 100644
--- a/xorg-server/dix/cursor.c
+++ b/xorg-server/dix/cursor.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -45,8 +44,6 @@ SOFTWARE.
******************************************************************/
-
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -70,40 +67,36 @@ typedef struct _GlyphShare {
struct _GlyphShare *next;
} GlyphShare, *GlyphSharePtr;
-static GlyphSharePtr sharedGlyphs = (GlyphSharePtr)NULL;
+static GlyphSharePtr sharedGlyphs = (GlyphSharePtr) NULL;
DevScreenPrivateKeyRec cursorScreenDevPriv;
#ifdef XFIXES
-static CARD32 cursorSerial;
+static CARD32 cursorSerial;
#endif
static void
FreeCursorBits(CursorBitsPtr bits)
{
if (--bits->refcnt > 0)
- return;
+ return;
free(bits->source);
free(bits->mask);
#ifdef ARGB_CURSOR
free(bits->argb);
#endif
dixFiniPrivates(bits, PRIVATE_CURSOR_BITS);
- if (bits->refcnt == 0)
- {
- GlyphSharePtr *prev, this;
-
- for (prev = &sharedGlyphs;
- (this = *prev) && (this->bits != bits);
- prev = &this->next)
- ;
- if (this)
- {
- *prev = this->next;
- CloseFont(this->font, (Font)0);
- free(this);
- }
- free(bits);
+ if (bits->refcnt == 0) {
+ GlyphSharePtr *prev, this;
+
+ for (prev = &sharedGlyphs;
+ (this = *prev) && (this->bits != bits); prev = &this->next);
+ if (this) {
+ *prev = this->next;
+ CloseFont(this->font, (Font) 0);
+ free(this);
+ }
+ free(bits);
}
}
@@ -115,27 +108,25 @@ FreeCursorBits(CursorBitsPtr bits)
int
FreeCursor(pointer value, XID cid)
{
- int nscr;
- CursorPtr pCurs = (CursorPtr)value;
+ int nscr;
+ CursorPtr pCurs = (CursorPtr) value;
- ScreenPtr pscr;
- DeviceIntPtr pDev = NULL; /* unused anyway */
+ ScreenPtr pscr;
+ DeviceIntPtr pDev = NULL; /* unused anyway */
- if ( --pCurs->refcnt != 0)
- return Success;
+ if (--pCurs->refcnt != 0)
+ return Success;
- for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
- {
- pscr = screenInfo.screens[nscr];
- (void)( *pscr->UnrealizeCursor)(pDev, pscr, pCurs);
+ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
+ pscr = screenInfo.screens[nscr];
+ (void) (*pscr->UnrealizeCursor) (pDev, pscr, pCurs);
}
FreeCursorBits(pCurs->bits);
dixFiniPrivates(pCurs, PRIVATE_CURSOR);
- free( pCurs);
+ free(pCurs);
return Success;
}
-
/*
* We check for empty cursors so that we won't have to display them
*/
@@ -146,15 +137,17 @@ CheckForEmptyMask(CursorBitsPtr bits)
int n = BitmapBytePad(bits->width) * bits->height;
bits->emptyMask = FALSE;
- while(n--)
- if(*(msk++) != 0) return;
+ while (n--)
+ if (*(msk++) != 0)
+ return;
#ifdef ARGB_CURSOR
- if (bits->argb)
- {
- CARD32 *argb = bits->argb;
- n = bits->width * bits->height;
- while (n--)
- if (*argb++ & 0xff000000) return;
+ if (bits->argb) {
+ CARD32 *argb = bits->argb;
+
+ n = bits->width * bits->height;
+ while (n--)
+ if (*argb++ & 0xff000000)
+ return;
}
#endif
bits->emptyMask = TRUE;
@@ -171,43 +164,37 @@ static int
RealizeCursorAllScreens(CursorPtr pCurs)
{
DeviceIntPtr pDev;
- ScreenPtr pscr;
+ ScreenPtr pscr;
int nscr;
- for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
- {
+ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
pscr = screenInfo.screens[nscr];
- for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
- if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs))
- {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
+ if (!(*pscr->RealizeCursor) (pDev, pscr, pCurs)) {
/* Realize failed for device pDev on screen pscr.
* We have to assume that for all devices before, realize
* worked. We need to rollback all devices so far on the
* current screen and then all devices on previous
* screens.
*/
- DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator*/
- while(pDevIt && pDevIt != pDev)
- {
+ DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator */
+
+ while (pDevIt && pDevIt != pDev) {
if (DevHasCursor(pDevIt))
- ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs);
+ (*pscr->UnrealizeCursor) (pDevIt, pscr, pCurs);
pDevIt = pDevIt->next;
}
- while (--nscr >= 0)
- {
+ while (--nscr >= 0) {
pscr = screenInfo.screens[nscr];
/* now unrealize all devices on previous screens */
pDevIt = inputInfo.devices;
- while (pDevIt)
- {
+ while (pDevIt) {
if (DevHasCursor(pDevIt))
- ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs);
+ (*pscr->UnrealizeCursor) (pDevIt, pscr, pCurs);
pDevIt = pDevIt->next;
}
- ( *pscr->UnrealizeCursor)(pDev, pscr, pCurs);
+ (*pscr->UnrealizeCursor) (pDev, pscr, pCurs);
}
return BadAlloc;
}
@@ -218,7 +205,6 @@ RealizeCursorAllScreens(CursorPtr pCurs)
return Success;
}
-
/**
* does nothing about the resource table, just creates the data structure.
* does not copy the src and mask bits
@@ -229,24 +215,24 @@ RealizeCursorAllScreens(CursorPtr pCurs)
*/
int
AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
- CARD32 *argb, CursorMetricPtr cm,
- unsigned foreRed, unsigned foreGreen, unsigned foreBlue,
- unsigned backRed, unsigned backGreen, unsigned backBlue,
- CursorPtr *ppCurs, ClientPtr client, XID cid)
+ CARD32 *argb, CursorMetricPtr cm,
+ unsigned foreRed, unsigned foreGreen, unsigned foreBlue,
+ unsigned backRed, unsigned backGreen, unsigned backBlue,
+ CursorPtr *ppCurs, ClientPtr client, XID cid)
{
- CursorBitsPtr bits;
- CursorPtr pCurs;
+ CursorBitsPtr bits;
+ CursorPtr pCurs;
int rc;
*ppCurs = NULL;
- pCurs = (CursorPtr)calloc(CURSOR_REC_SIZE + CURSOR_BITS_SIZE, 1);
+ pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE + CURSOR_BITS_SIZE, 1);
if (!pCurs)
- return BadAlloc;
+ return BadAlloc;
- bits = (CursorBitsPtr)((char *)pCurs + CURSOR_REC_SIZE);
+ bits = (CursorBitsPtr) ((char *) pCurs + CURSOR_REC_SIZE);
dixInitPrivates(pCurs, pCurs + 1, PRIVATE_CURSOR);
dixInitPrivates(bits, bits + 1, PRIVATE_CURSOR_BITS)
- bits->source = psrcbits;
+ bits->source = psrcbits;
bits->mask = pmaskbits;
#ifdef ARGB_CURSOR
bits->argb = argb;
@@ -255,7 +241,7 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
bits->height = cm->height;
bits->xhot = cm->xhot;
bits->yhot = cm->yhot;
- pCurs->refcnt = 1;
+ pCurs->refcnt = 1;
bits->refcnt = -1;
CheckForEmptyMask(bits);
pCurs->bits = bits;
@@ -276,7 +262,7 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR,
- pCurs, RT_NONE, NULL, DixCreateAccess);
+ pCurs, RT_NONE, NULL, DixCreateAccess);
if (rc != Success)
goto error;
@@ -287,7 +273,7 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
*ppCurs = pCurs;
return Success;
-error:
+ error:
FreeCursorBits(bits);
dixFiniPrivates(pCurs, PRIVATE_CURSOR);
free(pCurs);
@@ -297,142 +283,124 @@ error:
int
AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
- unsigned foreRed, unsigned foreGreen, unsigned foreBlue,
- unsigned backRed, unsigned backGreen, unsigned backBlue,
- CursorPtr *ppCurs, ClientPtr client, XID cid)
+ unsigned foreRed, unsigned foreGreen, unsigned foreBlue,
+ unsigned backRed, unsigned backGreen, unsigned backBlue,
+ CursorPtr *ppCurs, ClientPtr client, XID cid)
{
- FontPtr sourcefont, maskfont;
- unsigned char *srcbits;
- unsigned char *mskbits;
+ FontPtr sourcefont, maskfont;
+ unsigned char *srcbits;
+ unsigned char *mskbits;
CursorMetricRec cm;
int rc;
- CursorBitsPtr bits;
- CursorPtr pCurs;
+ CursorBitsPtr bits;
+ CursorPtr pCurs;
GlyphSharePtr pShare;
- rc = dixLookupResourceByType((pointer *)&sourcefont, source, RT_FONT, client,
- DixUseAccess);
- if (rc != Success)
- {
- client->errorValue = source;
- return rc;
+ rc = dixLookupResourceByType((pointer *) &sourcefont, source, RT_FONT,
+ client, DixUseAccess);
+ if (rc != Success) {
+ client->errorValue = source;
+ return rc;
}
- rc = dixLookupResourceByType((pointer *)&maskfont, mask, RT_FONT, client,
- DixUseAccess);
- if (rc != Success && mask != None)
- {
- client->errorValue = mask;
- return rc;
+ rc = dixLookupResourceByType((pointer *) &maskfont, mask, RT_FONT, client,
+ DixUseAccess);
+ if (rc != Success && mask != None) {
+ client->errorValue = mask;
+ return rc;
}
if (sourcefont != maskfont)
- pShare = (GlyphSharePtr)NULL;
- else
- {
- for (pShare = sharedGlyphs;
- pShare &&
- ((pShare->font != sourcefont) ||
- (pShare->sourceChar != sourceChar) ||
- (pShare->maskChar != maskChar));
- pShare = pShare->next)
- ;
+ pShare = (GlyphSharePtr) NULL;
+ else {
+ for (pShare = sharedGlyphs;
+ pShare &&
+ ((pShare->font != sourcefont) ||
+ (pShare->sourceChar != sourceChar) ||
+ (pShare->maskChar != maskChar)); pShare = pShare->next);
}
- if (pShare)
- {
- pCurs = (CursorPtr)calloc(CURSOR_REC_SIZE, 1);
- if (!pCurs)
- return BadAlloc;
- dixInitPrivates(pCurs, pCurs + 1, PRIVATE_CURSOR);
- bits = pShare->bits;
- bits->refcnt++;
+ if (pShare) {
+ pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE, 1);
+ if (!pCurs)
+ return BadAlloc;
+ dixInitPrivates(pCurs, pCurs + 1, PRIVATE_CURSOR);
+ bits = pShare->bits;
+ bits->refcnt++;
}
- else
- {
- if (!CursorMetricsFromGlyph(sourcefont, sourceChar, &cm))
- {
- client->errorValue = sourceChar;
- return BadValue;
- }
- if (!maskfont)
- {
- long n;
- unsigned char *mskptr;
-
- n = BitmapBytePad(cm.width)*(long)cm.height;
- mskptr = mskbits = malloc(n);
- if (!mskptr)
- return BadAlloc;
- while (--n >= 0)
- *mskptr++ = ~0;
- }
- else
- {
- if (!CursorMetricsFromGlyph(maskfont, maskChar, &cm))
- {
- client->errorValue = maskChar;
- return BadValue;
- }
- if ((rc = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)))
- return rc;
- }
- if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)))
- {
- free(mskbits);
- return rc;
- }
- if (sourcefont != maskfont)
- {
- pCurs =
- (CursorPtr)calloc(CURSOR_REC_SIZE + CURSOR_BITS_SIZE, 1);
- if (pCurs)
- bits = (CursorBitsPtr)((char *)pCurs + CURSOR_REC_SIZE);
- else
- bits = (CursorBitsPtr)NULL;
- }
- else
- {
- pCurs = (CursorPtr)calloc(CURSOR_REC_SIZE, 1);
- if (pCurs)
- bits = (CursorBitsPtr)calloc(CURSOR_BITS_SIZE, 1);
- else
- bits = (CursorBitsPtr)NULL;
- }
- if (!bits)
- {
- free(pCurs);
- free(mskbits);
- free(srcbits);
- return BadAlloc;
- }
- dixInitPrivates(pCurs, pCurs + 1, PRIVATE_CURSOR);
- dixInitPrivates(bits, bits + 1, PRIVATE_CURSOR_BITS);
- bits->source = srcbits;
- bits->mask = mskbits;
+ else {
+ if (!CursorMetricsFromGlyph(sourcefont, sourceChar, &cm)) {
+ client->errorValue = sourceChar;
+ return BadValue;
+ }
+ if (!maskfont) {
+ long n;
+ unsigned char *mskptr;
+
+ n = BitmapBytePad(cm.width) * (long) cm.height;
+ mskptr = mskbits = malloc(n);
+ if (!mskptr)
+ return BadAlloc;
+ while (--n >= 0)
+ *mskptr++ = ~0;
+ }
+ else {
+ if (!CursorMetricsFromGlyph(maskfont, maskChar, &cm)) {
+ client->errorValue = maskChar;
+ return BadValue;
+ }
+ if ((rc = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)))
+ return rc;
+ }
+ if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits))) {
+ free(mskbits);
+ return rc;
+ }
+ if (sourcefont != maskfont) {
+ pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE + CURSOR_BITS_SIZE, 1);
+ if (pCurs)
+ bits = (CursorBitsPtr) ((char *) pCurs + CURSOR_REC_SIZE);
+ else
+ bits = (CursorBitsPtr) NULL;
+ }
+ else {
+ pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE, 1);
+ if (pCurs)
+ bits = (CursorBitsPtr) calloc(CURSOR_BITS_SIZE, 1);
+ else
+ bits = (CursorBitsPtr) NULL;
+ }
+ if (!bits) {
+ free(pCurs);
+ free(mskbits);
+ free(srcbits);
+ return BadAlloc;
+ }
+ dixInitPrivates(pCurs, pCurs + 1, PRIVATE_CURSOR);
+ dixInitPrivates(bits, bits + 1, PRIVATE_CURSOR_BITS);
+ bits->source = srcbits;
+ bits->mask = mskbits;
#ifdef ARGB_CURSOR
- bits->argb = 0;
+ bits->argb = 0;
#endif
- bits->width = cm.width;
- bits->height = cm.height;
- bits->xhot = cm.xhot;
- bits->yhot = cm.yhot;
- if (sourcefont != maskfont)
- bits->refcnt = -1;
- else
- {
- bits->refcnt = 1;
- pShare = malloc(sizeof(GlyphShare));
- if (!pShare)
- {
- FreeCursorBits(bits);
- return BadAlloc;
- }
- pShare->font = sourcefont;
- sourcefont->refcnt++;
- pShare->sourceChar = sourceChar;
- pShare->maskChar = maskChar;
- pShare->bits = bits;
- pShare->next = sharedGlyphs;
- sharedGlyphs = pShare;
- }
+ bits->width = cm.width;
+ bits->height = cm.height;
+ bits->xhot = cm.xhot;
+ bits->yhot = cm.yhot;
+ if (sourcefont != maskfont)
+ bits->refcnt = -1;
+ else {
+ bits->refcnt = 1;
+ pShare = malloc(sizeof(GlyphShare));
+ if (!pShare) {
+ FreeCursorBits(bits);
+ return BadAlloc;
+ }
+ pShare->font = sourcefont;
+ sourcefont->refcnt++;
+ pShare->sourceChar = sourceChar;
+ pShare->maskChar = maskChar;
+ pShare->bits = bits;
+ pShare->next = sharedGlyphs;
+ sharedGlyphs = pShare;
+ }
}
CheckForEmptyMask(bits);
@@ -455,7 +423,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR,
- pCurs, RT_NONE, NULL, DixCreateAccess);
+ pCurs, RT_NONE, NULL, DixCreateAccess);
if (rc != Success)
goto error;
@@ -466,7 +434,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
*ppCurs = pCurs;
return Success;
-error:
+ error:
FreeCursorBits(bits);
dixFiniPrivates(pCurs, PRIVATE_CURSOR);
free(pCurs);
@@ -486,27 +454,27 @@ error:
CursorPtr
CreateRootCursor(char *unused1, unsigned int unused2)
{
- CursorPtr curs;
- FontPtr cursorfont;
- int err;
- XID fontID;
+ CursorPtr curs;
+ FontPtr cursorfont;
+ int err;
+ XID fontID;
fontID = FakeClientID(0);
err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync,
- (unsigned)strlen(defaultCursorFont), defaultCursorFont);
+ (unsigned) strlen(defaultCursorFont), defaultCursorFont);
if (err != Success)
- return NullCursor;
+ return NullCursor;
- err = dixLookupResourceByType((pointer *)&cursorfont, fontID, RT_FONT,
- serverClient, DixReadAccess);
+ err = dixLookupResourceByType((pointer *) &cursorfont, fontID, RT_FONT,
+ serverClient, DixReadAccess);
if (err != Success)
- return NullCursor;
+ return NullCursor;
if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0,
- &curs, serverClient, (XID)0) != Success)
- return NullCursor;
+ &curs, serverClient, (XID) 0) != Success)
+ return NullCursor;
- if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer)curs))
- return NullCursor;
+ if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer) curs))
+ return NullCursor;
return curs;
}
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index f01857e77..d5ad08e16 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -45,8 +44,6 @@ SOFTWARE.
********************************************************/
-
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -82,11 +79,12 @@ SOFTWARE.
#include <pixman.h>
#include "exglobals.h"
#include "exevents.h"
-#include "xiquerydevice.h" /* for SizeDeviceClasses */
+#include "xiquerydevice.h" /* for SizeDeviceClasses */
#include "xiproperty.h"
-#include "enterleave.h" /* for EnterWindow() */
+#include "enterleave.h" /* for EnterWindow() */
#include "xserver-properties.h"
-#include "xichangehierarchy.h" /* For XISendDeviceHierarchyEvent */
+#include "xichangehierarchy.h" /* For XISendDeviceHierarchyEvent */
+#include "syncsrv.h"
#ifdef _MSC_VER
#define isfinite(val) _finite(val)
@@ -126,8 +124,8 @@ DeviceSetTransform(DeviceIntPtr dev, float *transform)
scale.m[1][2] = dev->valuator->axes[1].min_value;
/* transform */
- for (y=0; y<3; y++)
- for (x=0; x<3; x++)
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
dev->transform.m[y][x] = *transform++;
pixman_f_transform_multiply(&dev->transform, &scale, &dev->transform);
@@ -147,33 +145,31 @@ static int
DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
BOOL checkonly)
{
- if (property == XIGetKnownProperty(XI_PROP_ENABLED))
- {
+ if (property == XIGetKnownProperty(XI_PROP_ENABLED)) {
if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1)
return BadValue;
/* Don't allow disabling of VCP/VCK */
- if ((dev == inputInfo.pointer || dev == inputInfo.keyboard) &&
- !(*(CARD8*)prop->data))
+ if ((dev == inputInfo.pointer ||dev ==
+ inputInfo.keyboard) &&!(*(CARD8 *) prop->data))
return BadAccess;
- if (!checkonly)
- {
- if ((*((CARD8*)prop->data)) && !dev->enabled)
+ if (!checkonly) {
+ if ((*((CARD8 *) prop->data)) && !dev->enabled)
EnableDevice(dev, TRUE);
- else if (!(*((CARD8*)prop->data)) && dev->enabled)
+ else if (!(*((CARD8 *) prop->data)) && dev->enabled)
DisableDevice(dev, TRUE);
}
- } else if (property == XIGetKnownProperty(XI_PROP_TRANSFORM))
- {
- float *f = (float*)prop->data;
+ }
+ else if (property == XIGetKnownProperty(XI_PROP_TRANSFORM)) {
+ float *f = (float *) prop->data;
int i;
if (prop->format != 32 || prop->size != 9 ||
prop->type != XIGetKnownProperty(XATOM_FLOAT))
return BadValue;
- for (i=0; i<9; i++)
+ for (i = 0; i < 9; i++)
if (!isfinite(f[i]))
return BadValue;
@@ -203,8 +199,7 @@ PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
if (ptr->spriteInfo->paired)
return BadDevice;
- if (kbd->spriteInfo->spriteOwner)
- {
+ if (kbd->spriteInfo->spriteOwner) {
free(kbd->spriteInfo->sprite);
kbd->spriteInfo->sprite = NULL;
kbd->spriteInfo->spriteOwner = FALSE;
@@ -216,7 +211,6 @@ PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
return Success;
}
-
/**
* Find and return the next unpaired MD pointer device.
*/
@@ -224,10 +218,10 @@ static DeviceIntPtr
NextFreePointerDevice(void)
{
DeviceIntPtr dev;
+
for (dev = inputInfo.devices; dev; dev = dev->next)
if (IsMaster(dev) &&
- dev->spriteInfo->spriteOwner &&
- !dev->spriteInfo->paired)
+ dev->spriteInfo->spriteOwner && !dev->spriteInfo->paired)
return dev;
return NULL;
}
@@ -242,7 +236,7 @@ NextFreePointerDevice(void)
DeviceIntPtr
AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
{
- DeviceIntPtr dev, *prev; /* not a typo */
+ DeviceIntPtr dev, *prev; /* not a typo */
DeviceIntPtr devtmp;
int devid;
char devind[MAXDEVICES];
@@ -250,21 +244,24 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
float transform[9];
/* Find next available id, 0 and 1 are reserved */
- memset(devind, 0, sizeof(char)*MAXDEVICES);
+ memset(devind, 0, sizeof(char) * MAXDEVICES);
for (devtmp = inputInfo.devices; devtmp; devtmp = devtmp->next)
- devind[devtmp->id]++;
+ devind[devtmp->id]++;
for (devtmp = inputInfo.off_devices; devtmp; devtmp = devtmp->next)
- devind[devtmp->id]++;
- for (devid = 2; devid < MAXDEVICES && devind[devid]; devid++)
- ;
+ devind[devtmp->id]++;
+ for (devid = 2; devid < MAXDEVICES && devind[devid]; devid++);
if (devid >= MAXDEVICES)
- return (DeviceIntPtr)NULL;
- dev = _dixAllocateObjectWithPrivates(sizeof(DeviceIntRec) + sizeof(SpriteInfoRec),
- sizeof(DeviceIntRec) + sizeof(SpriteInfoRec),
- offsetof(DeviceIntRec, devPrivates), PRIVATE_DEVICE);
+ return (DeviceIntPtr) NULL;
+ dev =
+ _dixAllocateObjectWithPrivates(sizeof(DeviceIntRec) +
+ sizeof(SpriteInfoRec),
+ sizeof(DeviceIntRec) +
+ sizeof(SpriteInfoRec),
+ offsetof(DeviceIntRec, devPrivates),
+ PRIVATE_DEVICE);
if (!dev)
- return (DeviceIntPtr)NULL;
+ return (DeviceIntPtr) NULL;
dev->last.scroll = NULL;
dev->last.touches = NULL;
@@ -287,27 +284,26 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
dev->coreEvents = TRUE;
/* sprite defaults */
- dev->spriteInfo = (SpriteInfoPtr)&dev[1];
+ dev->spriteInfo = (SpriteInfoPtr) & dev[1];
/* security creation/labeling check
*/
if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixCreateAccess)) {
- free(dev);
- return NULL;
+ free(dev);
+ return NULL;
}
inputInfo.numDevices++;
- for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next)
- ;
+ for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next);
*prev = dev;
dev->next = NULL;
enabled = FALSE;
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
- XA_INTEGER, 8, PropModeReplace, 1, &enabled,
- FALSE);
- XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED), FALSE);
+ XA_INTEGER, 8, PropModeReplace, 1, &enabled, FALSE);
+ XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED),
+ FALSE);
/* unity matrix */
memset(transform, 0, sizeof(transform));
@@ -337,7 +333,7 @@ SendDevicePresenceEvent(int deviceid, int type)
ev.deviceid = deviceid;
dummyDev.id = XIAllDevices;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
- (xEvent*)&ev, 1);
+ (xEvent *) &ev, 1);
}
/**
@@ -360,72 +356,68 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
int ret;
DeviceIntPtr other;
BOOL enabled;
- int flags[MAXDEVICES] = {0};
+ int flags[MAXDEVICES] = { 0 };
for (prev = &inputInfo.off_devices;
- *prev && (*prev != dev);
- prev = &(*prev)->next)
- ;
+ *prev && (*prev != dev); prev = &(*prev)->next);
- if (!dev->spriteInfo->sprite)
- {
- if (IsMaster(dev))
- {
+ if (!dev->spriteInfo->sprite) {
+ if (IsMaster(dev)) {
/* Sprites appear on first root window, so we can hardcode it */
- if (dev->spriteInfo->spriteOwner)
- {
+ if (dev->spriteInfo->spriteOwner) {
InitializeSprite(dev, screenInfo.screens[0]->root);
- /* mode doesn't matter */
+ /* mode doesn't matter */
EnterWindow(dev, screenInfo.screens[0]->root, NotifyAncestor);
}
- else if ((other = NextFreePointerDevice()) == NULL)
- {
+ else if ((other = NextFreePointerDevice()) == NULL) {
ErrorF("[dix] cannot find pointer to pair with. "
"This is a bug.\n");
return FALSE;
- } else
+ }
+ else
PairDevices(NULL, other, dev);
- } else
- {
+ }
+ else {
if (dev->coreEvents)
other = (IsPointerDevice(dev)) ? inputInfo.pointer :
inputInfo.keyboard;
else
- other = NULL; /* auto-float non-core devices */
+ other = NULL; /* auto-float non-core devices */
AttachDevice(NULL, dev, other);
}
}
if ((*prev != dev) || !dev->inited ||
- ((ret = (*dev->deviceProc)(dev, DEVICE_ON)) != Success)) {
+ ((ret = (*dev->deviceProc) (dev, DEVICE_ON)) != Success)) {
ErrorF("[dix] couldn't enable device %d\n", dev->id);
- return FALSE;
+ return FALSE;
}
dev->enabled = TRUE;
*prev = dev->next;
- for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next)
- ;
+ for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next);
*prev = dev;
dev->next = NULL;
enabled = TRUE;
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
- XA_INTEGER, 8, PropModeReplace, 1, &enabled,
- TRUE);
+ XA_INTEGER, 8, PropModeReplace, 1, &enabled, TRUE);
SendDevicePresenceEvent(dev->id, DeviceEnabled);
- if (sendevent)
- {
+ if (sendevent) {
flags[dev->id] |= XIDeviceEnabled;
XISendDeviceHierarchyEvent(flags);
}
RecalculateMasterButtons(dev);
+ /* initialise an idle timer for this device*/
+ dev->idle_counter = SyncInitDeviceIdleTime(dev);
+
return TRUE;
}
+
/**
* Switch a device off through the driver and push it onto the off_devices
* list. A device will not send events while disabled. All clients are
@@ -442,57 +434,49 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
{
DeviceIntPtr *prev, other;
BOOL enabled;
- int flags[MAXDEVICES] = {0};
+ int flags[MAXDEVICES] = { 0 };
for (prev = &inputInfo.devices;
- *prev && (*prev != dev);
- prev = &(*prev)->next)
- ;
+ *prev && (*prev != dev); prev = &(*prev)->next);
if (*prev != dev)
- return FALSE;
+ return FALSE;
+
+ SyncRemoveDeviceIdleTime(dev->idle_counter);
+ dev->idle_counter = NULL;
/* float attached devices */
- if (IsMaster(dev))
- {
- for (other = inputInfo.devices; other; other = other->next)
- {
- if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev)
- {
+ if (IsMaster(dev)) {
+ for (other = inputInfo.devices; other; other = other->next) {
+ if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev) {
AttachDevice(NULL, other, NULL);
flags[other->id] |= XISlaveDetached;
}
}
}
- else
- {
- for (other = inputInfo.devices; other; other = other->next)
- {
- if (IsMaster(other) && other->lastSlave == dev)
- other->lastSlave = NULL;
- }
+ else {
+ for (other = inputInfo.devices; other; other = other->next) {
+ if (IsMaster(other) && other->lastSlave == dev)
+ other->lastSlave = NULL;
+ }
}
- if (IsMaster(dev) && dev->spriteInfo->sprite)
- {
- for (other = inputInfo.devices; other; other = other->next)
- {
- if (other->spriteInfo->paired == dev)
- {
+ if (IsMaster(dev) && dev->spriteInfo->sprite) {
+ for (other = inputInfo.devices; other; other = other->next) {
+ if (other->spriteInfo->paired == dev) {
ErrorF("[dix] cannot disable device, still paired. "
- "This is a bug. \n");
+ "This is a bug. \n");
return FALSE;
}
}
}
- (void)(*dev->deviceProc)(dev, DEVICE_OFF);
+ (void) (*dev->deviceProc) (dev, DEVICE_OFF);
dev->enabled = FALSE;
/* now that the device is disabled, we can reset the signal handler's
* last.slave */
OsBlockSignals();
- for (other = inputInfo.devices; other; other = other->next)
- {
+ for (other = inputInfo.devices; other; other = other->next) {
if (other->last.slave == dev)
other->last.slave = NULL;
}
@@ -507,12 +491,10 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
enabled = FALSE;
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
- XA_INTEGER, 8, PropModeReplace, 1, &enabled,
- TRUE);
+ XA_INTEGER, 8, PropModeReplace, 1, &enabled, TRUE);
SendDevicePresenceEvent(dev->id, DeviceDisabled);
- if (sendevent)
- {
+ if (sendevent) {
flags[dev->id] = XIDeviceDisabled;
XISendDeviceHierarchyEvent(flags);
}
@@ -552,9 +534,8 @@ ActivateDevice(DeviceIntPtr dev, BOOL sendevent)
ret = BadAlloc;
SendDevicePresenceEvent(dev->id, DeviceAdded);
- if (sendevent)
- {
- int flags[MAXDEVICES] = {0};
+ if (sendevent) {
+ int flags[MAXDEVICES] = { 0 };
flags[dev->id] = XISlaveAdded;
XISendDeviceHierarchyEvent(flags);
}
@@ -574,7 +555,7 @@ CoreKeyboardBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
}
static void
-CoreKeyboardCtl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
+CoreKeyboardCtl(DeviceIntPtr pDev, KeybdCtrl * ctrl)
{
return;
}
@@ -589,8 +570,7 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
switch (what) {
case DEVICE_INIT:
if (!InitKeyboardDeviceStruct(pDev, NULL, CoreKeyboardBell,
- CoreKeyboardCtl))
- {
+ CoreKeyboardCtl)) {
ErrorF("Keyboard initialization failed. This could be a missing "
"or incorrect setup of xkeyboard-config.\n");
return BadValue;
@@ -618,8 +598,8 @@ CorePointerProc(DeviceIntPtr pDev, int what)
#define NAXES 2
BYTE map[NBUTTONS + 1];
int i = 0;
- Atom btn_labels[NBUTTONS] = {0};
- Atom axes_labels[NAXES] = {0};
+ Atom btn_labels[NBUTTONS] = { 0 };
+ Atom axes_labels[NAXES] = { 0 };
ScreenPtr scr = screenInfo.screens[0];
switch (what) {
@@ -627,25 +607,25 @@ CorePointerProc(DeviceIntPtr pDev, int what)
for (i = 1; i <= NBUTTONS; i++)
map[i] = i;
- btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
- btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
- btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
- btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
- btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
- btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
- btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
- /* don't know about the rest */
-
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
-
- if (!InitPointerDeviceStruct((DevicePtr)pDev, map, NBUTTONS, btn_labels,
- (PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), NAXES, axes_labels))
- {
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ /* don't know about the rest */
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+
+ if (!InitPointerDeviceStruct
+ ((DevicePtr) pDev, map, NBUTTONS, btn_labels,
+ (PtrCtrlProcPtr) NoopDDA, GetMotionHistorySize(), NAXES,
+ axes_labels)) {
ErrorF("Could not initialize device '%s'. Out of memory.\n",
pDev->name);
- return BadAlloc; /* IPDS only fails on allocs */
+ return BadAlloc; /* IPDS only fails on allocs */
}
/* axisVal is per-screen, last.valuators is desktop-wide */
pDev->valuator->axisVal[0] = scr->width / 2;
@@ -680,16 +660,15 @@ InitCoreDevices(void)
{
if (AllocDevicePair(serverClient, "Virtual core",
&inputInfo.pointer, &inputInfo.keyboard,
- CorePointerProc, CoreKeyboardProc,
- TRUE) != Success)
- FatalError("Failed to allocate core devices");
+ CorePointerProc, CoreKeyboardProc, TRUE) != Success)
+ FatalError("Failed to allocate core devices");
if (ActivateDevice(inputInfo.pointer, TRUE) != Success ||
ActivateDevice(inputInfo.keyboard, TRUE) != Success)
- FatalError("Failed to activate core devices.");
+ FatalError("Failed to activate core devices.");
if (!EnableDevice(inputInfo.pointer, TRUE) ||
!EnableDevice(inputInfo.keyboard, TRUE))
- FatalError("Failed to enable core devices.");
+ FatalError("Failed to enable core devices.");
InitXTestDevices();
}
@@ -718,12 +697,11 @@ InitAndStartDevices(void)
}
/* enable real devices */
- for (dev = inputInfo.off_devices; dev; dev = next)
- {
+ for (dev = inputInfo.off_devices; dev; dev = next) {
DebugF("(dix) enabling device %d\n", dev->id);
- next = dev->next;
- if (dev->inited && dev->startup)
- EnableDevice(dev, TRUE);
+ next = dev->next;
+ if (dev->inited && dev->startup)
+ EnableDevice(dev, TRUE);
}
return Success;
@@ -738,62 +716,63 @@ FreeDeviceClass(int type, pointer *class)
if (!(*class))
return;
- switch(type)
+ switch (type) {
+ case KeyClass:
{
- case KeyClass:
- {
- KeyClassPtr* k = (KeyClassPtr*)class;
- if ((*k)->xkbInfo)
- {
- XkbFreeInfo((*k)->xkbInfo);
- (*k)->xkbInfo = NULL;
- }
- free((*k));
- break;
- }
- case ButtonClass:
- {
- ButtonClassPtr *b = (ButtonClassPtr*)class;
- free((*b)->xkb_acts);
- free((*b));
- break;
- }
- case ValuatorClass:
- {
- ValuatorClassPtr *v = (ValuatorClassPtr*)class;
+ KeyClassPtr *k = (KeyClassPtr *) class;
- free((*v)->motion);
- free((*v));
- break;
- }
- case XITouchClass:
- {
- TouchClassPtr *t = (TouchClassPtr*)class;
- int i;
-
- for (i = 0; i < (*t)->num_touches; i++)
- {
- free((*t)->touches[i].sprite.spriteTrace);
- free((*t)->touches[i].listeners);
- free((*t)->touches[i].valuators);
- }
-
- free((*t));
- break;
- }
- case FocusClass:
- {
- FocusClassPtr *f = (FocusClassPtr*)class;
- free((*f)->trace);
- free((*f));
- break;
- }
- case ProximityClass:
- {
- ProximityClassPtr *p = (ProximityClassPtr*)class;
- free((*p));
- break;
- }
+ if ((*k)->xkbInfo) {
+ XkbFreeInfo((*k)->xkbInfo);
+ (*k)->xkbInfo = NULL;
+ }
+ free((*k));
+ break;
+ }
+ case ButtonClass:
+ {
+ ButtonClassPtr *b = (ButtonClassPtr *) class;
+
+ free((*b)->xkb_acts);
+ free((*b));
+ break;
+ }
+ case ValuatorClass:
+ {
+ ValuatorClassPtr *v = (ValuatorClassPtr *) class;
+
+ free((*v)->motion);
+ free((*v));
+ break;
+ }
+ case XITouchClass:
+ {
+ TouchClassPtr *t = (TouchClassPtr *) class;
+ int i;
+
+ for (i = 0; i < (*t)->num_touches; i++) {
+ free((*t)->touches[i].sprite.spriteTrace);
+ free((*t)->touches[i].listeners);
+ free((*t)->touches[i].valuators);
+ }
+
+ free((*t));
+ break;
+ }
+ case FocusClass:
+ {
+ FocusClassPtr *f = (FocusClassPtr *) class;
+
+ free((*f)->trace);
+ free((*f));
+ break;
+ }
+ case ProximityClass:
+ {
+ ProximityClassPtr *p = (ProximityClassPtr *) class;
+
+ free((*p));
+ break;
+ }
}
*class = NULL;
}
@@ -804,79 +783,79 @@ FreeFeedbackClass(int type, pointer *class)
if (!(*class))
return;
- switch(type)
+ switch (type) {
+ case KbdFeedbackClass:
{
- case KbdFeedbackClass:
- {
- KbdFeedbackPtr *kbdfeed = (KbdFeedbackPtr*)class;
- KbdFeedbackPtr k, knext;
- for (k = (*kbdfeed); k; k = knext) {
- knext = k->next;
- if (k->xkb_sli)
- XkbFreeSrvLedInfo(k->xkb_sli);
- free(k);
- }
- break;
- }
- case PtrFeedbackClass:
- {
- PtrFeedbackPtr *ptrfeed = (PtrFeedbackPtr*)class;
- PtrFeedbackPtr p, pnext;
-
- for (p = (*ptrfeed); p; p = pnext) {
- pnext = p->next;
- free(p);
- }
- break;
- }
- case IntegerFeedbackClass:
- {
- IntegerFeedbackPtr *intfeed = (IntegerFeedbackPtr*)class;
- IntegerFeedbackPtr i, inext;
-
- for (i = (*intfeed); i; i = inext) {
- inext = i->next;
- free(i);
- }
- break;
- }
- case StringFeedbackClass:
- {
- StringFeedbackPtr *stringfeed = (StringFeedbackPtr*)class;
- StringFeedbackPtr s, snext;
-
- for (s = (*stringfeed); s; s = snext) {
- snext = s->next;
- free(s->ctrl.symbols_supported);
- free(s->ctrl.symbols_displayed);
- free(s);
- }
- break;
- }
- case BellFeedbackClass:
- {
- BellFeedbackPtr *bell = (BellFeedbackPtr*)class;
- BellFeedbackPtr b, bnext;
-
- for (b = (*bell); b; b = bnext) {
- bnext = b->next;
- free(b);
- }
- break;
- }
- case LedFeedbackClass:
- {
- LedFeedbackPtr *leds = (LedFeedbackPtr*)class;
- LedFeedbackPtr l, lnext;
-
- for (l = (*leds); l; l = lnext) {
- lnext = l->next;
- if (l->xkb_sli)
- XkbFreeSrvLedInfo(l->xkb_sli);
- free(l);
- }
- break;
- }
+ KbdFeedbackPtr *kbdfeed = (KbdFeedbackPtr *) class;
+ KbdFeedbackPtr k, knext;
+
+ for (k = (*kbdfeed); k; k = knext) {
+ knext = k->next;
+ if (k->xkb_sli)
+ XkbFreeSrvLedInfo(k->xkb_sli);
+ free(k);
+ }
+ break;
+ }
+ case PtrFeedbackClass:
+ {
+ PtrFeedbackPtr *ptrfeed = (PtrFeedbackPtr *) class;
+ PtrFeedbackPtr p, pnext;
+
+ for (p = (*ptrfeed); p; p = pnext) {
+ pnext = p->next;
+ free(p);
+ }
+ break;
+ }
+ case IntegerFeedbackClass:
+ {
+ IntegerFeedbackPtr *intfeed = (IntegerFeedbackPtr *) class;
+ IntegerFeedbackPtr i, inext;
+
+ for (i = (*intfeed); i; i = inext) {
+ inext = i->next;
+ free(i);
+ }
+ break;
+ }
+ case StringFeedbackClass:
+ {
+ StringFeedbackPtr *stringfeed = (StringFeedbackPtr *) class;
+ StringFeedbackPtr s, snext;
+
+ for (s = (*stringfeed); s; s = snext) {
+ snext = s->next;
+ free(s->ctrl.symbols_supported);
+ free(s->ctrl.symbols_displayed);
+ free(s);
+ }
+ break;
+ }
+ case BellFeedbackClass:
+ {
+ BellFeedbackPtr *bell = (BellFeedbackPtr *) class;
+ BellFeedbackPtr b, bnext;
+
+ for (b = (*bell); b; b = bnext) {
+ bnext = b->next;
+ free(b);
+ }
+ break;
+ }
+ case LedFeedbackClass:
+ {
+ LedFeedbackPtr *leds = (LedFeedbackPtr *) class;
+ LedFeedbackPtr l, lnext;
+
+ for (l = (*leds); l; l = lnext) {
+ lnext = l->next;
+ if (l->xkb_sli)
+ XkbFreeSrvLedInfo(l->xkb_sli);
+ free(l);
+ }
+ break;
+ }
}
*class = NULL;
}
@@ -887,19 +866,19 @@ FreeAllDeviceClasses(ClassesPtr classes)
if (!classes)
return;
- FreeDeviceClass(KeyClass, (pointer)&classes->key);
- FreeDeviceClass(ValuatorClass, (pointer)&classes->valuator);
- FreeDeviceClass(XITouchClass, (pointer)&classes->touch);
- FreeDeviceClass(ButtonClass, (pointer)&classes->button);
- FreeDeviceClass(FocusClass, (pointer)&classes->focus);
- FreeDeviceClass(ProximityClass, (pointer)&classes->proximity);
+ FreeDeviceClass(KeyClass, (pointer) &classes->key);
+ FreeDeviceClass(ValuatorClass, (pointer) &classes->valuator);
+ FreeDeviceClass(XITouchClass, (pointer) &classes->touch);
+ FreeDeviceClass(ButtonClass, (pointer) &classes->button);
+ FreeDeviceClass(FocusClass, (pointer) &classes->focus);
+ FreeDeviceClass(ProximityClass, (pointer) &classes->proximity);
- FreeFeedbackClass(KbdFeedbackClass, (pointer)&classes->kbdfeed);
- FreeFeedbackClass(PtrFeedbackClass, (pointer)&classes->ptrfeed);
- FreeFeedbackClass(IntegerFeedbackClass, (pointer)&classes->intfeed);
- FreeFeedbackClass(StringFeedbackClass, (pointer)&classes->stringfeed);
- FreeFeedbackClass(BellFeedbackClass, (pointer)&classes->bell);
- FreeFeedbackClass(LedFeedbackClass, (pointer)&classes->leds);
+ FreeFeedbackClass(KbdFeedbackClass, (pointer) &classes->kbdfeed);
+ FreeFeedbackClass(PtrFeedbackClass, (pointer) &classes->ptrfeed);
+ FreeFeedbackClass(IntegerFeedbackClass, (pointer) &classes->intfeed);
+ FreeFeedbackClass(StringFeedbackClass, (pointer) &classes->stringfeed);
+ FreeFeedbackClass(BellFeedbackClass, (pointer) &classes->bell);
+ FreeFeedbackClass(LedFeedbackClass, (pointer) &classes->leds);
}
@@ -923,43 +902,40 @@ CloseDevice(DeviceIntPtr dev)
XIDeleteAllDeviceProperties(dev);
if (dev->inited)
- (void)(*dev->deviceProc)(dev, DEVICE_CLOSE);
+ (void) (*dev->deviceProc) (dev, DEVICE_CLOSE);
/* free sprite memory */
if (IsMaster(dev) && dev->spriteInfo->sprite)
screen->DeviceCursorCleanup(dev, screen);
/* free acceleration info */
- if(dev->valuator && dev->valuator->accelScheme.AccelCleanupProc)
- dev->valuator->accelScheme.AccelCleanupProc(dev);
+ if (dev->valuator && dev->valuator->accelScheme.AccelCleanupProc)
+ dev->valuator->accelScheme.AccelCleanupProc(dev);
while (dev->xkb_interest)
- XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource);
+ XkbRemoveResourceClient((DevicePtr) dev, dev->xkb_interest->resource);
free(dev->name);
- classes = (ClassesPtr)&dev->key;
+ classes = (ClassesPtr) & dev->key;
FreeAllDeviceClasses(classes);
- if (IsMaster(dev))
- {
+ if (IsMaster(dev)) {
classes = dev->unused_classes;
FreeAllDeviceClasses(classes);
- free(classes);
+ free(classes);
}
if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
- if (dev->spriteInfo->sprite->current)
- FreeCursor(dev->spriteInfo->sprite->current, None);
+ if (dev->spriteInfo->sprite->current)
+ FreeCursor(dev->spriteInfo->sprite->current, None);
free(dev->spriteInfo->sprite->spriteTrace);
free(dev->spriteInfo->sprite);
}
/* a client may have the device set as client pointer */
- for (j = 0; j < currentMaxClients; j++)
- {
- if (clients[j] && clients[j]->clientPtr == dev)
- {
+ for (j = 0; j < currentMaxClients; j++) {
+ if (clients[j] && clients[j]->clientPtr == dev) {
clients[j]->clientPtr = NULL;
clients[j]->clientPtr = PickPointer(clients[j]);
}
@@ -980,7 +956,7 @@ CloseDevice(DeviceIntPtr dev)
* Shut down all devices of one list and free all resources.
*/
static
-void
+ void
CloseDeviceList(DeviceIntPtr *listHead)
{
/* Used to mark devices that we tried to free */
@@ -995,8 +971,7 @@ CloseDeviceList(DeviceIntPtr *listHead)
freedIds[i] = FALSE;
dev = *listHead;
- while (dev != NULL)
- {
+ while (dev != NULL) {
freedIds[dev->id] = TRUE;
DeleteInputDeviceRequest(dev);
@@ -1022,8 +997,7 @@ CloseDownDevices(void)
* AttachDevice(NULL, dev, NULL). Instead, we have to forcibly set master
* to NULL and pretend nothing happened.
*/
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
if (!IsMaster(dev) && !IsFloating(dev))
dev->master = NULL;
/* Initialise the sprite and paired members of all devices
@@ -1036,12 +1010,14 @@ CloseDownDevices(void)
CloseDeviceList(&inputInfo.off_devices);
CloseDevice(inputInfo.pointer);
+
CloseDevice(inputInfo.keyboard);
inputInfo.devices = NULL;
inputInfo.off_devices = NULL;
inputInfo.keyboard = NULL;
inputInfo.pointer = NULL;
+
XkbDeleteRulesDflts();
OsReleaseSignals();
@@ -1077,12 +1053,12 @@ UndisplayDevices(void)
int
RemoveDevice(DeviceIntPtr dev, BOOL sendevent)
{
- DeviceIntPtr prev,tmp,next;
+ DeviceIntPtr prev, tmp, next;
int ret = BadMatch;
ScreenPtr screen = screenInfo.screens[0];
int deviceid;
int initialized;
- int flags[MAXDEVICES] = {0};
+ int flags[MAXDEVICES] = { 0 };
DebugF("(dix) removing device %d\n", dev->id);
@@ -1092,8 +1068,7 @@ RemoveDevice(DeviceIntPtr dev, BOOL sendevent)
initialized = dev->inited;
deviceid = dev->id;
- if (initialized)
- {
+ if (initialized) {
if (DevHasCursor(dev))
screen->DisplayCursor(dev, screen, NullCursor);
@@ -1103,34 +1078,34 @@ RemoveDevice(DeviceIntPtr dev, BOOL sendevent)
prev = NULL;
for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) {
- next = tmp->next;
- if (tmp == dev) {
+ next = tmp->next;
+ if (tmp == dev) {
- if (prev==NULL)
- inputInfo.devices = next;
- else
- prev->next = next;
+ if (prev == NULL)
+ inputInfo.devices = next;
+ else
+ prev->next = next;
- flags[tmp->id] = IsMaster(tmp) ? XIMasterRemoved : XISlaveRemoved;
- CloseDevice(tmp);
- ret = Success;
- }
+ flags[tmp->id] = IsMaster(tmp) ? XIMasterRemoved : XISlaveRemoved;
+ CloseDevice(tmp);
+ ret = Success;
+ }
}
prev = NULL;
for (tmp = inputInfo.off_devices; tmp; (prev = tmp), (tmp = next)) {
- next = tmp->next;
- if (tmp == dev) {
- flags[tmp->id] = IsMaster(tmp) ? XIMasterRemoved : XISlaveRemoved;
- CloseDevice(tmp);
+ next = tmp->next;
+ if (tmp == dev) {
+ flags[tmp->id] = IsMaster(tmp) ? XIMasterRemoved : XISlaveRemoved;
+ CloseDevice(tmp);
- if (prev == NULL)
- inputInfo.off_devices = next;
- else
- prev->next = next;
+ if (prev == NULL)
+ inputInfo.off_devices = next;
+ else
+ prev->next = next;
ret = Success;
- }
+ }
}
if (ret == Success && initialized) {
@@ -1156,22 +1131,23 @@ dixLookupDevice(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode)
{
DeviceIntPtr dev;
int rc;
+
*pDev = NULL;
- for (dev=inputInfo.devices; dev; dev=dev->next) {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
if (dev->id == id)
goto found;
}
- for (dev=inputInfo.off_devices; dev; dev=dev->next) {
+ for (dev = inputInfo.off_devices; dev; dev = dev->next) {
if (dev->id == id)
- goto found;
+ goto found;
}
return BadDevice;
-found:
+ found:
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc == Success)
- *pDev = dev;
+ *pDev = dev;
return rc;
}
@@ -1179,8 +1155,8 @@ void
QueryMinMaxKeyCodes(KeyCode *minCode, KeyCode *maxCode)
{
if (inputInfo.keyboard) {
- *minCode = inputInfo.keyboard->key->xkbInfo->desc->min_key_code;
- *maxCode = inputInfo.keyboard->key->xkbInfo->desc->max_key_code;
+ *minCode = inputInfo.keyboard->key->xkbInfo->desc->min_key_code;
+ *maxCode = inputInfo.keyboard->key->xkbInfo->desc->max_key_code;
}
}
@@ -1198,24 +1174,24 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
for (i = src->minKeyCode; i <= src->maxKeyCode; i++) {
#define SI(r, c) (((r - src->minKeyCode) * src->mapWidth) + (c))
#define DI(r, c) (((r - dst->minKeyCode) * dst->mapWidth) + (c))
- for (j = 0; j < src->mapWidth; j++)
- dst->map[DI(i, j)] = src->map[SI(i, j)];
- for (j = src->mapWidth; j < dst->mapWidth; j++)
- dst->map[DI(i, j)] = NoSymbol;
+ for (j = 0; j < src->mapWidth; j++)
+ dst->map[DI(i, j)] = src->map[SI(i, j)];
+ for (j = src->mapWidth; j < dst->mapWidth; j++)
+ dst->map[DI(i, j)] = NoSymbol;
#undef SI
#undef DI
- }
- return TRUE;
+ }
+ return TRUE;
}
else if (src->mapWidth > dst->mapWidth) {
i = sizeof(KeySym) * src->mapWidth *
- (dst->maxKeyCode - dst->minKeyCode + 1);
+ (dst->maxKeyCode - dst->minKeyCode + 1);
tmp = calloc(sizeof(KeySym), i);
if (!tmp)
return FALSE;
if (dst->map) {
- for (i = 0; i <= dst->maxKeyCode-dst->minKeyCode; i++)
+ for (i = 0; i <= dst->maxKeyCode - dst->minKeyCode; i++)
memmove(&tmp[i * src->mapWidth], &dst->map[i * dst->mapWidth],
dst->mapWidth * sizeof(KeySym));
free(dst->map);
@@ -1225,7 +1201,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
}
else if (!dst->map) {
i = sizeof(KeySym) * src->mapWidth *
- (dst->maxKeyCode - dst->minKeyCode + 1);
+ (dst->maxKeyCode - dst->minKeyCode + 1);
tmp = calloc(sizeof(KeySym), i);
if (!tmp)
return FALSE;
@@ -1242,7 +1218,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
}
Bool
-InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom* labels,
+InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom *labels,
CARD8 *map)
{
ButtonClassPtr butc;
@@ -1250,11 +1226,11 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom* labels,
butc = calloc(1, sizeof(ButtonClassRec));
if (!butc)
- return FALSE;
+ return FALSE;
butc->numButtons = numButtons;
butc->sourceid = dev->id;
for (i = 1; i <= numButtons; i++)
- butc->map[i] = map[i];
+ butc->map[i] = map[i];
for (i = numButtons + 1; i < MAP_LENGTH; i++)
butc->map[i] = i;
memcpy(butc->labels, labels, numButtons * sizeof(Atom));
@@ -1275,11 +1251,16 @@ ValuatorClassPtr
AllocValuatorClass(ValuatorClassPtr src, int numAxes)
{
ValuatorClassPtr v;
+
/* force alignment with double */
- union align_u { ValuatorClassRec valc; double d; } *align;
+ union align_u {
+ ValuatorClassRec valc;
+ double d;
+ } *align;
int size;
- size = sizeof(union align_u) + numAxes * (sizeof(double) + sizeof(AxisInfo));
+ size =
+ sizeof(union align_u) + numAxes * (sizeof(double) + sizeof(AxisInfo));
align = (union align_u *) realloc(src, size);
if (!align)
@@ -1290,8 +1271,8 @@ AllocValuatorClass(ValuatorClassPtr src, int numAxes)
v = &align->valc;
v->numAxes = numAxes;
- v->axisVal = (double*)(align + 1);
- v->axes = (AxisInfoPtr)(v->axisVal + numAxes);
+ v->axisVal = (double *) (align + 1);
+ v->axes = (AxisInfoPtr) (v->axisVal + numAxes);
return v;
}
@@ -1306,8 +1287,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
if (!dev)
return FALSE;
- if (numAxes > MAX_VALUATORS)
- {
+ if (numAxes > MAX_VALUATORS) {
LogMessage(X_WARNING,
"Device '%s' has %d axes, only using first %d.\n",
dev->name, numAxes, MAX_VALUATORS);
@@ -1319,8 +1299,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
return FALSE;
dev->last.scroll = valuator_mask_new(numAxes);
- if (!dev->last.scroll)
- {
+ if (!dev->last.scroll) {
free(valc);
return FALSE;
}
@@ -1342,29 +1321,32 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
AllocateMotionHistory(dev);
- for (i=0; i<numAxes; i++) {
- InitValuatorAxisStruct(dev, i, labels[i], NO_AXIS_LIMITS, NO_AXIS_LIMITS,
- 0, 0, 0, mode);
- valc->axisVal[i]=0;
+ for (i = 0; i < numAxes; i++) {
+ InitValuatorAxisStruct(dev, i, labels[i], NO_AXIS_LIMITS,
+ NO_AXIS_LIMITS, 0, 0, 0, mode);
+ valc->axisVal[i] = 0;
}
dev->last.numValuators = numAxes;
- if (IsMaster(dev) || /* do not accelerate master or xtest devices */
+ if (IsMaster(dev) || /* do not accelerate master or xtest devices */
IsXTestDevice(dev, NULL))
- InitPointerAccelerationScheme(dev, PtrAccelNoOp);
+ InitPointerAccelerationScheme(dev, PtrAccelNoOp);
else
- InitPointerAccelerationScheme(dev, PtrAccelDefault);
+ InitPointerAccelerationScheme(dev, PtrAccelDefault);
return TRUE;
}
/* global list of acceleration schemes */
ValuatorAccelerationRec pointerAccelerationScheme[] = {
- {PtrAccelNoOp, NULL, NULL, NULL, NULL},
+ {PtrAccelNoOp, NULL, NULL, NULL, NULL}
+ ,
{PtrAccelPredictable, acceleratePointerPredictable, NULL,
- InitPredictableAccelerationScheme, AccelerationDefaultCleanup},
- {PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL, NULL},
- {-1, NULL, NULL, NULL, NULL} /* terminator */
+ InitPredictableAccelerationScheme, AccelerationDefaultCleanup}
+ ,
+ {PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL, NULL}
+ ,
+ {-1, NULL, NULL, NULL, NULL} /* terminator */
};
/**
@@ -1372,8 +1354,7 @@ ValuatorAccelerationRec pointerAccelerationScheme[] = {
* change anything if unsuccessful.
*/
Bool
-InitPointerAccelerationScheme(DeviceIntPtr dev,
- int scheme)
+InitPointerAccelerationScheme(DeviceIntPtr dev, int scheme)
{
int x, i = -1;
ValuatorClassPtr val;
@@ -1387,7 +1368,7 @@ InitPointerAccelerationScheme(DeviceIntPtr dev,
return FALSE;
for (x = 0; pointerAccelerationScheme[x].number >= 0; x++) {
- if(pointerAccelerationScheme[x].number == scheme){
+ if (pointerAccelerationScheme[x].number == scheme) {
i = x;
break;
}
@@ -1401,10 +1382,12 @@ InitPointerAccelerationScheme(DeviceIntPtr dev,
if (pointerAccelerationScheme[i].AccelInitProc) {
if (!pointerAccelerationScheme[i].AccelInitProc(dev,
- &pointerAccelerationScheme[i])) {
+ &pointerAccelerationScheme
+ [i])) {
return FALSE;
}
- } else {
+ }
+ else {
val->accelScheme = pointerAccelerationScheme[i];
}
return TRUE;
@@ -1417,11 +1400,11 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev)
focc = malloc(sizeof(FocusClassRec));
if (!focc)
- return FALSE;
+ return FALSE;
focc->win = PointerRootWin;
focc->revert = None;
focc->time = currentTime;
- focc->trace = (WindowPtr *)NULL;
+ focc->trace = (WindowPtr *) NULL;
focc->traceSize = 0;
focc->traceGood = 0;
focc->sourceid = dev->id;
@@ -1436,137 +1419,142 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
feedc = malloc(sizeof(PtrFeedbackClassRec));
if (!feedc)
- return FALSE;
+ return FALSE;
feedc->CtrlProc = controlProc;
feedc->ctrl = defaultPointerControl;
feedc->ctrl.id = 0;
- if ( (feedc->next = dev->ptrfeed) )
+ if ((feedc->next = dev->ptrfeed))
feedc->ctrl.id = dev->ptrfeed->ctrl.id + 1;
dev->ptrfeed = feedc;
- (*controlProc)(dev, &feedc->ctrl);
+ (*controlProc) (dev, &feedc->ctrl);
return TRUE;
}
static LedCtrl defaultLedControl = {
- DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0};
+ DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0
+};
static BellCtrl defaultBellControl = {
- DEFAULT_BELL,
- DEFAULT_BELL_PITCH,
- DEFAULT_BELL_DURATION,
- 0};
+ DEFAULT_BELL,
+ DEFAULT_BELL_PITCH,
+ DEFAULT_BELL_DURATION,
+ 0
+};
static IntegerCtrl defaultIntegerControl = {
- DEFAULT_INT_RESOLUTION,
- DEFAULT_INT_MIN_VALUE,
- DEFAULT_INT_MAX_VALUE,
- DEFAULT_INT_DISPLAYED,
- 0};
+ DEFAULT_INT_RESOLUTION,
+ DEFAULT_INT_MIN_VALUE,
+ DEFAULT_INT_MAX_VALUE,
+ DEFAULT_INT_DISPLAYED,
+ 0
+};
Bool
-InitStringFeedbackClassDeviceStruct (
- DeviceIntPtr dev, StringCtrlProcPtr controlProc,
- int max_symbols, int num_symbols_supported, KeySym *symbols)
+InitStringFeedbackClassDeviceStruct(DeviceIntPtr dev,
+ StringCtrlProcPtr controlProc,
+ int max_symbols, int num_symbols_supported,
+ KeySym * symbols)
{
int i;
StringFeedbackPtr feedc;
feedc = malloc(sizeof(StringFeedbackClassRec));
if (!feedc)
- return FALSE;
+ return FALSE;
feedc->CtrlProc = controlProc;
feedc->ctrl.num_symbols_supported = num_symbols_supported;
feedc->ctrl.num_symbols_displayed = 0;
feedc->ctrl.max_symbols = max_symbols;
- feedc->ctrl.symbols_supported = malloc(sizeof (KeySym) * num_symbols_supported);
- feedc->ctrl.symbols_displayed = malloc(sizeof (KeySym) * max_symbols);
- if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed)
- {
- free(feedc->ctrl.symbols_supported);
- free(feedc->ctrl.symbols_displayed);
- free(feedc);
- return FALSE;
- }
- for (i=0; i<num_symbols_supported; i++)
- *(feedc->ctrl.symbols_supported+i) = *symbols++;
- for (i=0; i<max_symbols; i++)
- *(feedc->ctrl.symbols_displayed+i) = (KeySym) 0;
+ feedc->ctrl.symbols_supported =
+ malloc(sizeof(KeySym) * num_symbols_supported);
+ feedc->ctrl.symbols_displayed = malloc(sizeof(KeySym) * max_symbols);
+ if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) {
+ free(feedc->ctrl.symbols_supported);
+ free(feedc->ctrl.symbols_displayed);
+ free(feedc);
+ return FALSE;
+ }
+ for (i = 0; i < num_symbols_supported; i++)
+ *(feedc->ctrl.symbols_supported + i) = *symbols++;
+ for (i = 0; i < max_symbols; i++)
+ *(feedc->ctrl.symbols_displayed + i) = (KeySym) 0;
feedc->ctrl.id = 0;
- if ( (feedc->next = dev->stringfeed) )
- feedc->ctrl.id = dev->stringfeed->ctrl.id + 1;
+ if ((feedc->next = dev->stringfeed))
+ feedc->ctrl.id = dev->stringfeed->ctrl.id + 1;
dev->stringfeed = feedc;
- (*controlProc)(dev, &feedc->ctrl);
+ (*controlProc) (dev, &feedc->ctrl);
return TRUE;
}
Bool
-InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc,
- BellCtrlProcPtr controlProc)
+InitBellFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc,
+ BellCtrlProcPtr controlProc)
{
BellFeedbackPtr feedc;
feedc = malloc(sizeof(BellFeedbackClassRec));
if (!feedc)
- return FALSE;
+ return FALSE;
feedc->CtrlProc = controlProc;
feedc->BellProc = bellProc;
feedc->ctrl = defaultBellControl;
feedc->ctrl.id = 0;
- if ( (feedc->next = dev->bell) )
- feedc->ctrl.id = dev->bell->ctrl.id + 1;
+ if ((feedc->next = dev->bell))
+ feedc->ctrl.id = dev->bell->ctrl.id + 1;
dev->bell = feedc;
- (*controlProc)(dev, &feedc->ctrl);
+ (*controlProc) (dev, &feedc->ctrl);
return TRUE;
}
Bool
-InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc)
+InitLedFeedbackClassDeviceStruct(DeviceIntPtr dev, LedCtrlProcPtr controlProc)
{
LedFeedbackPtr feedc;
feedc = malloc(sizeof(LedFeedbackClassRec));
if (!feedc)
- return FALSE;
+ return FALSE;
feedc->CtrlProc = controlProc;
feedc->ctrl = defaultLedControl;
feedc->ctrl.id = 0;
- if ( (feedc->next = dev->leds) )
- feedc->ctrl.id = dev->leds->ctrl.id + 1;
- feedc->xkb_sli= NULL;
+ if ((feedc->next = dev->leds))
+ feedc->ctrl.id = dev->leds->ctrl.id + 1;
+ feedc->xkb_sli = NULL;
dev->leds = feedc;
- (*controlProc)(dev, &feedc->ctrl);
+ (*controlProc) (dev, &feedc->ctrl);
return TRUE;
}
Bool
-InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr controlProc)
+InitIntegerFeedbackClassDeviceStruct(DeviceIntPtr dev,
+ IntegerCtrlProcPtr controlProc)
{
IntegerFeedbackPtr feedc;
feedc = malloc(sizeof(IntegerFeedbackClassRec));
if (!feedc)
- return FALSE;
+ return FALSE;
feedc->CtrlProc = controlProc;
feedc->ctrl = defaultIntegerControl;
feedc->ctrl.id = 0;
- if ( (feedc->next = dev->intfeed) )
- feedc->ctrl.id = dev->intfeed->ctrl.id + 1;
+ if ((feedc->next = dev->intfeed))
+ feedc->ctrl.id = dev->intfeed->ctrl.id + 1;
dev->intfeed = feedc;
- (*controlProc)(dev, &feedc->ctrl);
+ (*controlProc) (dev, &feedc->ctrl);
return TRUE;
}
Bool
-InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons, Atom* btn_labels,
- PtrCtrlProcPtr controlProc, int numMotionEvents,
- int numAxes, Atom *axes_labels)
+InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons,
+ Atom *btn_labels, PtrCtrlProcPtr controlProc,
+ int numMotionEvents, int numAxes, Atom *axes_labels)
{
- DeviceIntPtr dev = (DeviceIntPtr)device;
+ DeviceIntPtr dev = (DeviceIntPtr) device;
- return(InitButtonClassDeviceStruct(dev, numButtons, btn_labels, map) &&
- InitValuatorClassDeviceStruct(dev, numAxes, axes_labels,
- numMotionEvents, Relative) &&
- InitPtrFeedbackClassDeviceStruct(dev, controlProc));
+ return (InitButtonClassDeviceStruct(dev, numButtons, btn_labels, map) &&
+ InitValuatorClassDeviceStruct(dev, numAxes, axes_labels,
+ numMotionEvents, Relative) &&
+ InitPtrFeedbackClassDeviceStruct(dev, controlProc));
}
/**
@@ -1592,8 +1580,7 @@ InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches,
if (num_axes < 2)
return FALSE;
- if (num_axes > MAX_VALUATORS)
- {
+ if (num_axes > MAX_VALUATORS) {
LogMessage(X_WARNING,
"Device '%s' has %d touch axes, only using first %d.\n",
device->name, num_axes, MAX_VALUATORS);
@@ -1606,7 +1593,7 @@ InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches,
touch->max_touches = max_touches;
if (max_touches == 0)
- max_touches = 5; /* arbitrary number plucked out of the air */
+ max_touches = 5; /* arbitrary number plucked out of the air */
touch->touches = calloc(max_touches, sizeof(*touch->touches));
if (!touch->touches)
goto err;
@@ -1625,7 +1612,7 @@ InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches,
return TRUE;
-err:
+ err:
for (i = 0; i < touch->num_touches; i++)
TouchFreeTouchPoint(device, i);
@@ -1642,19 +1629,17 @@ err:
* @return TRUE if the device map is invalid, FALSE otherwise.
*/
Bool
-BadDeviceMap(BYTE *buff, int length, unsigned low, unsigned high, XID *errval)
+BadDeviceMap(BYTE * buff, int length, unsigned low, unsigned high, XID *errval)
{
int i;
for (i = 0; i < length; i++)
- if (buff[i]) /* only check non-zero elements */
- {
- if ((low > buff[i]) || (high < buff[i]))
- {
- *errval = buff[i];
- return TRUE;
- }
- }
+ if (buff[i]) { /* only check non-zero elements */
+ if ((low > buff[i]) || (high < buff[i])) {
+ *errval = buff[i];
+ return TRUE;
+ }
+ }
return FALSE;
}
@@ -1663,24 +1648,25 @@ ProcSetModifierMapping(ClientPtr client)
{
xSetModifierMappingReply rep;
int rc;
+
REQUEST(xSetModifierMappingReq);
REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
if (client->req_len != ((stuff->numKeyPerModifier << 1) +
- bytes_to_int32(sizeof(xSetModifierMappingReq))))
- return BadLength;
+ bytes_to_int32(sizeof(xSetModifierMappingReq))))
+ return BadLength;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rc = change_modmap(client, PickKeyboard(client), (KeyCode *)&stuff[1],
+ rc = change_modmap(client, PickKeyboard(client), (KeyCode *) &stuff[1],
stuff->numKeyPerModifier);
if (rc == MappingFailed || rc == -1)
return BadValue;
if (rc != Success && rc != MappingSuccess && rc != MappingFailed &&
rc != MappingBusy)
- return rc;
+ return rc;
rep.success = rc;
@@ -1694,6 +1680,7 @@ ProcGetModifierMapping(ClientPtr client)
xGetModifierMappingReply rep;
int max_keys_per_mod = 0;
KeyCode *modkeymap = NULL;
+
REQUEST_SIZE_MATCH(xReq);
generate_modkeymap(client, PickKeyboard(client), &modkeymap,
@@ -1707,7 +1694,7 @@ ProcGetModifierMapping(ClientPtr client)
rep.length = max_keys_per_mod << 1;
WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep);
- (void)WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
+ (void) WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
free(modkeymap);
@@ -1722,25 +1709,26 @@ ProcChangeKeyboardMapping(ClientPtr client)
KeySymsRec keysyms;
DeviceIntPtr pDev, tmp;
int rc;
+
REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
len = client->req_len - bytes_to_int32(sizeof(xChangeKeyboardMappingReq));
if (len != (stuff->keyCodes * stuff->keySymsPerKeyCode))
- return BadLength;
+ return BadLength;
pDev = PickKeyboard(client);
if ((stuff->firstKeyCode < pDev->key->xkbInfo->desc->min_key_code) ||
- (stuff->firstKeyCode > pDev->key->xkbInfo->desc->max_key_code)) {
- client->errorValue = stuff->firstKeyCode;
- return BadValue;
+ (stuff->firstKeyCode > pDev->key->xkbInfo->desc->max_key_code)) {
+ client->errorValue = stuff->firstKeyCode;
+ return BadValue;
}
- if (((unsigned)(stuff->firstKeyCode + stuff->keyCodes - 1) >
- pDev->key->xkbInfo->desc->max_key_code) ||
+ if (((unsigned) (stuff->firstKeyCode + stuff->keyCodes - 1) >
+ pDev->key->xkbInfo->desc->max_key_code) ||
(stuff->keySymsPerKeyCode == 0)) {
- client->errorValue = stuff->keySymsPerKeyCode;
- return BadValue;
+ client->errorValue = stuff->keySymsPerKeyCode;
+ return BadValue;
}
keysyms.minKeyCode = stuff->firstKeyCode;
@@ -1780,17 +1768,18 @@ ProcSetPointerMapping(ClientPtr client)
int i, j;
DeviceIntPtr ptr = PickPointer(client);
xSetPointerMappingReply rep;
+
REQUEST(xSetPointerMappingReq);
REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq);
if (client->req_len !=
- bytes_to_int32(sizeof(xSetPointerMappingReq) + stuff->nElts))
- return BadLength;
+ bytes_to_int32(sizeof(xSetPointerMappingReq) + stuff->nElts))
+ return BadLength;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.success = MappingSuccess;
- map = (BYTE *)&stuff[1];
+ map = (BYTE *) &stuff[1];
/* So we're bounded here by the number of core buttons. This check
* probably wants disabling through XFixes. */
@@ -1799,8 +1788,8 @@ ProcSetPointerMapping(ClientPtr client)
* and SetPointerMapping
*/
if (stuff->nElts != ptr->button->numButtons) {
- client->errorValue = stuff->nElts;
- return BadValue;
+ client->errorValue = stuff->nElts;
+ return BadValue;
}
/* Core protocol specs don't allow for duplicate mappings; this check
@@ -1834,22 +1823,23 @@ ProcGetKeyboardMapping(ClientPtr client)
XkbDescPtr xkb;
KeySymsPtr syms;
int rc;
+
REQUEST(xGetKeyboardMappingReq);
REQUEST_SIZE_MATCH(xGetKeyboardMappingReq);
rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
xkb = kbd->key->xkbInfo->desc;
if ((stuff->firstKeyCode < xkb->min_key_code) ||
(stuff->firstKeyCode > xkb->max_key_code)) {
- client->errorValue = stuff->firstKeyCode;
- return BadValue;
+ client->errorValue = stuff->firstKeyCode;
+ return BadValue;
}
if (stuff->firstKeyCode + stuff->count > xkb->max_key_code + 1) {
- client->errorValue = stuff->count;
+ client->errorValue = stuff->count;
return BadValue;
}
@@ -1879,24 +1869,26 @@ int
ProcGetPointerMapping(ClientPtr client)
{
xGetPointerMappingReply rep;
+
/* Apps may get different values each time they call GetPointerMapping as
* the ClientPointer could change. */
DeviceIntPtr ptr = PickPointer(client);
ButtonClassPtr butc = ptr->button;
int rc;
+
REQUEST_SIZE_MATCH(xReq);
rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.nElts = (butc) ? butc->numButtons : 0;
- rep.length = ((unsigned)rep.nElts + (4-1))/4;
+ rep.length = ((unsigned) rep.nElts + (4 - 1)) / 4;
WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep);
if (butc)
- WriteToClient(client, (int)rep.nElts, (char *)&butc->map[1]);
+ WriteToClient(client, (int) rep.nElts, (char *) &butc->map[1]);
return Success;
}
@@ -1904,25 +1896,26 @@ void
NoteLedState(DeviceIntPtr keybd, int led, Bool on)
{
KeybdCtrl *ctrl = &keybd->kbdfeed->ctrl;
+
if (on)
- ctrl->leds |= ((Leds)1 << (led - 1));
+ ctrl->leds |= ((Leds) 1 << (led - 1));
else
- ctrl->leds &= ~((Leds)1 << (led - 1));
+ ctrl->leds &= ~((Leds) 1 << (led - 1));
}
int
-Ones(unsigned long mask) /* HACKMEM 169 */
-{
+Ones(unsigned long mask)
+{ /* HACKMEM 169 */
unsigned long y;
- y = (mask >> 1) &033333333333;
- y = mask - y - ((y >>1) & 033333333333);
+ y = (mask >> 1) & 033333333333;
+ y = mask - y - ((y >> 1) & 033333333333);
return (((y + (y >> 3)) & 030707070707) % 077);
}
static int
-DoChangeKeyboardControl (ClientPtr client, DeviceIntPtr keybd, XID *vlist,
- BITS32 vmask)
+DoChangeKeyboardControl(ClientPtr client, DeviceIntPtr keybd, XID *vlist,
+ BITS32 vmask)
{
#define DO_ALL (-1)
KeybdCtrl ctrl;
@@ -1935,144 +1928,144 @@ DoChangeKeyboardControl (ClientPtr client, DeviceIntPtr keybd, XID *vlist,
ctrl = keybd->kbdfeed->ctrl;
while (vmask) {
- index2 = (BITS32) lowbit (vmask);
- vmask &= ~index2;
- switch (index2) {
- case KBKeyClickPercent:
- t = *vlist;
- vlist++;
- if (t == -1) {
- t = defaultKeyboardControl.click;
+ index2 = (BITS32) lowbit(vmask);
+ vmask &= ~index2;
+ switch (index2) {
+ case KBKeyClickPercent:
+ t = *vlist;
+ vlist++;
+ if (t == -1) {
+ t = defaultKeyboardControl.click;
+ }
+ else if (t < 0 || t > 100) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ ctrl.click = t;
+ break;
+ case KBBellPercent:
+ t = (INT8) *vlist;
+ vlist++;
+ if (t == -1) {
+ t = defaultKeyboardControl.bell;
+ }
+ else if (t < 0 || t > 100) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ ctrl.bell = t;
+ break;
+ case KBBellPitch:
+ t = (INT16) *vlist;
+ vlist++;
+ if (t == -1) {
+ t = defaultKeyboardControl.bell_pitch;
+ }
+ else if (t < 0) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ ctrl.bell_pitch = t;
+ break;
+ case KBBellDuration:
+ t = (INT16) *vlist;
+ vlist++;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_duration;
+ else if (t < 0) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ ctrl.bell_duration = t;
+ break;
+ case KBLed:
+ led = (CARD8) *vlist;
+ vlist++;
+ if (led < 1 || led > 32) {
+ client->errorValue = led;
+ return BadValue;
}
- else if (t < 0 || t > 100) {
- client->errorValue = t;
- return BadValue;
- }
- ctrl.click = t;
- break;
- case KBBellPercent:
- t = (INT8)*vlist;
- vlist++;
- if (t == -1) {
- t = defaultKeyboardControl.bell;
+ if (!(mask & KBLedMode))
+ return BadMatch;
+ break;
+ case KBLedMode:
+ t = (CARD8) *vlist;
+ vlist++;
+ if (t == LedModeOff) {
+ if (led == DO_ALL)
+ ctrl.leds = 0x0;
+ else
+ ctrl.leds &= ~(((Leds) (1)) << (led - 1));
+ }
+ else if (t == LedModeOn) {
+ if (led == DO_ALL)
+ ctrl.leds = ~0L;
+ else
+ ctrl.leds |= (((Leds) (1)) << (led - 1));
}
- else if (t < 0 || t > 100) {
- client->errorValue = t;
- return BadValue;
- }
- ctrl.bell = t;
- break;
- case KBBellPitch:
- t = (INT16)*vlist;
- vlist++;
- if (t == -1) {
- t = defaultKeyboardControl.bell_pitch;
+ else {
+ client->errorValue = t;
+ return BadValue;
}
- else if (t < 0) {
- client->errorValue = t;
- return BadValue;
- }
- ctrl.bell_pitch = t;
- break;
- case KBBellDuration:
- t = (INT16)*vlist;
- vlist++;
- if (t == -1)
- t = defaultKeyboardControl.bell_duration;
- else if (t < 0) {
- client->errorValue = t;
- return BadValue;
- }
- ctrl.bell_duration = t;
- break;
- case KBLed:
- led = (CARD8)*vlist;
- vlist++;
- if (led < 1 || led > 32) {
- client->errorValue = led;
- return BadValue;
- }
- if (!(mask & KBLedMode))
- return BadMatch;
- break;
- case KBLedMode:
- t = (CARD8)*vlist;
- vlist++;
- if (t == LedModeOff) {
- if (led == DO_ALL)
- ctrl.leds = 0x0;
- else
- ctrl.leds &= ~(((Leds)(1)) << (led - 1));
- }
- else if (t == LedModeOn) {
- if (led == DO_ALL)
- ctrl.leds = ~0L;
- else
- ctrl.leds |= (((Leds)(1)) << (led - 1));
- }
- else {
- client->errorValue = t;
- return BadValue;
- }
-
- XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client);
- XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))),
- ctrl.leds, &cause);
+
+ XkbSetCauseCoreReq(&cause, X_ChangeKeyboardControl, client);
+ XkbSetIndicators(keybd, ((led == DO_ALL) ? ~0L : (1L << (led - 1))),
+ ctrl.leds, &cause);
ctrl.leds = keybd->kbdfeed->ctrl.leds;
- break;
- case KBKey:
- key = (KeyCode)*vlist;
- vlist++;
- if ((KeyCode)key < keybd->key->xkbInfo->desc->min_key_code ||
- (KeyCode)key > keybd->key->xkbInfo->desc->max_key_code) {
- client->errorValue = key;
- return BadValue;
- }
- if (!(mask & KBAutoRepeatMode))
- return BadMatch;
- break;
- case KBAutoRepeatMode:
- i = (key >> 3);
- mask = (1 << (key & 7));
- t = (CARD8)*vlist;
- vlist++;
+ break;
+ case KBKey:
+ key = (KeyCode) *vlist;
+ vlist++;
+ if ((KeyCode) key < keybd->key->xkbInfo->desc->min_key_code ||
+ (KeyCode) key > keybd->key->xkbInfo->desc->max_key_code) {
+ client->errorValue = key;
+ return BadValue;
+ }
+ if (!(mask & KBAutoRepeatMode))
+ return BadMatch;
+ break;
+ case KBAutoRepeatMode:
+ i = (key >> 3);
+ mask = (1 << (key & 7));
+ t = (CARD8) *vlist;
+ vlist++;
if (key != DO_ALL)
- XkbDisableComputedAutoRepeats(keybd,key);
- if (t == AutoRepeatModeOff) {
- if (key == DO_ALL)
- ctrl.autoRepeat = FALSE;
- else
- ctrl.autoRepeats[i] &= ~mask;
- }
- else if (t == AutoRepeatModeOn) {
- if (key == DO_ALL)
- ctrl.autoRepeat = TRUE;
- else
- ctrl.autoRepeats[i] |= mask;
- }
- else if (t == AutoRepeatModeDefault) {
- if (key == DO_ALL)
- ctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
- else
- ctrl.autoRepeats[i] =
- (ctrl.autoRepeats[i] & ~mask) |
- (defaultKeyboardControl.autoRepeats[i] & mask);
- }
- else {
- client->errorValue = t;
- return BadValue;
- }
- break;
- default:
- client->errorValue = mask;
- return BadValue;
- }
+ XkbDisableComputedAutoRepeats(keybd, key);
+ if (t == AutoRepeatModeOff) {
+ if (key == DO_ALL)
+ ctrl.autoRepeat = FALSE;
+ else
+ ctrl.autoRepeats[i] &= ~mask;
+ }
+ else if (t == AutoRepeatModeOn) {
+ if (key == DO_ALL)
+ ctrl.autoRepeat = TRUE;
+ else
+ ctrl.autoRepeats[i] |= mask;
+ }
+ else if (t == AutoRepeatModeDefault) {
+ if (key == DO_ALL)
+ ctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
+ else
+ ctrl.autoRepeats[i] =
+ (ctrl.autoRepeats[i] & ~mask) |
+ (defaultKeyboardControl.autoRepeats[i] & mask);
+ }
+ else {
+ client->errorValue = t;
+ return BadValue;
+ }
+ break;
+ default:
+ client->errorValue = mask;
+ return BadValue;
+ }
}
keybd->kbdfeed->ctrl = ctrl;
/* The XKB RepeatKeys control and core protocol global autorepeat */
- /* value are linked */
+ /* value are linked */
XkbSetRepeatKeys(keybd, key, keybd->kbdfeed->ctrl.autoRepeat);
return Success;
@@ -2084,38 +2077,40 @@ DoChangeKeyboardControl (ClientPtr client, DeviceIntPtr keybd, XID *vlist,
* Changes kbd control on the ClientPointer and all attached SDs.
*/
int
-ProcChangeKeyboardControl (ClientPtr client)
+ProcChangeKeyboardControl(ClientPtr client)
{
XID *vlist;
BITS32 vmask;
int ret = Success, error = Success;
DeviceIntPtr pDev = NULL, keyboard;
+
REQUEST(xChangeKeyboardControlReq);
REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
vmask = stuff->mask;
- vlist = (XID *)&stuff[1];
+ vlist = (XID *) &stuff[1];
- if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
- return BadLength;
+ if (client->req_len !=
+ (sizeof(xChangeKeyboardControlReq) >> 2) + Ones(vmask))
+ return BadLength;
keyboard = PickKeyboard(client);
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if ((pDev == keyboard ||
- (!IsMaster(pDev) && GetMaster(pDev, MASTER_KEYBOARD) == keyboard))
- && pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+ (!IsMaster(pDev) && GetMaster(pDev, MASTER_KEYBOARD) == keyboard))
+ && pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess);
- if (ret != Success)
+ if (ret != Success)
return ret;
}
}
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if ((pDev == keyboard ||
- (!IsMaster(pDev) && GetMaster(pDev, MASTER_KEYBOARD) == keyboard))
- && pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+ (!IsMaster(pDev) && GetMaster(pDev, MASTER_KEYBOARD) == keyboard))
+ && pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
ret = DoChangeKeyboardControl(client, pDev, vlist, vmask);
if (ret != Success)
error = ret;
@@ -2126,17 +2121,18 @@ ProcChangeKeyboardControl (ClientPtr client)
}
int
-ProcGetKeyboardControl (ClientPtr client)
+ProcGetKeyboardControl(ClientPtr client)
{
int rc, i;
DeviceIntPtr kbd = PickKeyboard(client);
KeybdCtrl *ctrl = &kbd->kbdfeed->ctrl;
xGetKeyboardControlReply rep;
+
REQUEST_SIZE_MATCH(xReq);
rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 5;
@@ -2148,7 +2144,7 @@ ProcGetKeyboardControl (ClientPtr client)
rep.bellDuration = ctrl->bell_duration;
rep.ledMask = ctrl->leds;
for (i = 0; i < 32; i++)
- rep.map[i] = ctrl->autoRepeats[i];
+ rep.map[i] = ctrl->autoRepeats[i];
WriteReplyToClient(client, sizeof(xGetKeyboardControlReply), &rep);
return Success;
}
@@ -2160,28 +2156,29 @@ ProcBell(ClientPtr client)
int base = keybd->kbdfeed->ctrl.bell;
int newpercent;
int rc;
+
REQUEST(xBellReq);
REQUEST_SIZE_MATCH(xBellReq);
if (stuff->percent < -100 || stuff->percent > 100) {
- client->errorValue = stuff->percent;
- return BadValue;
+ client->errorValue = stuff->percent;
+ return BadValue;
}
newpercent = (base * stuff->percent) / 100;
if (stuff->percent < 0)
newpercent = base + newpercent;
else
- newpercent = base - newpercent + stuff->percent;
+ newpercent = base - newpercent + stuff->percent;
for (dev = inputInfo.devices; dev; dev = dev->next) {
if ((dev == keybd ||
- (!IsMaster(dev) && GetMaster(dev, MASTER_KEYBOARD) == keybd)) &&
+ (!IsMaster(dev) && GetMaster(dev, MASTER_KEYBOARD) == keybd)) &&
dev->kbdfeed && dev->kbdfeed->BellProc) {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixBellAccess);
- if (rc != Success)
- return rc;
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixBellAccess);
+ if (rc != Success)
+ return rc;
XkbHandleBell(FALSE, FALSE, dev, newpercent,
&dev->kbdfeed->ctrl, 0, None, NULL, client);
}
@@ -2194,69 +2191,70 @@ int
ProcChangePointerControl(ClientPtr client)
{
DeviceIntPtr dev, mouse = PickPointer(client);
- PtrCtrl ctrl; /* might get BadValue part way through */
+ PtrCtrl ctrl; /* might get BadValue part way through */
int rc;
+
REQUEST(xChangePointerControlReq);
REQUEST_SIZE_MATCH(xChangePointerControlReq);
ctrl = mouse->ptrfeed->ctrl;
if ((stuff->doAccel != xTrue) && (stuff->doAccel != xFalse)) {
- client->errorValue = stuff->doAccel;
- return BadValue;
+ client->errorValue = stuff->doAccel;
+ return BadValue;
}
if ((stuff->doThresh != xTrue) && (stuff->doThresh != xFalse)) {
- client->errorValue = stuff->doThresh;
- return BadValue;
+ client->errorValue = stuff->doThresh;
+ return BadValue;
}
if (stuff->doAccel) {
- if (stuff->accelNum == -1) {
- ctrl.num = defaultPointerControl.num;
+ if (stuff->accelNum == -1) {
+ ctrl.num = defaultPointerControl.num;
}
- else if (stuff->accelNum < 0) {
- client->errorValue = stuff->accelNum;
- return BadValue;
- }
- else {
+ else if (stuff->accelNum < 0) {
+ client->errorValue = stuff->accelNum;
+ return BadValue;
+ }
+ else {
ctrl.num = stuff->accelNum;
}
- if (stuff->accelDenum == -1) {
- ctrl.den = defaultPointerControl.den;
+ if (stuff->accelDenum == -1) {
+ ctrl.den = defaultPointerControl.den;
+ }
+ else if (stuff->accelDenum <= 0) {
+ client->errorValue = stuff->accelDenum;
+ return BadValue;
}
- else if (stuff->accelDenum <= 0) {
- client->errorValue = stuff->accelDenum;
- return BadValue;
- }
- else {
+ else {
ctrl.den = stuff->accelDenum;
}
}
if (stuff->doThresh) {
- if (stuff->threshold == -1) {
- ctrl.threshold = defaultPointerControl.threshold;
+ if (stuff->threshold == -1) {
+ ctrl.threshold = defaultPointerControl.threshold;
+ }
+ else if (stuff->threshold < 0) {
+ client->errorValue = stuff->threshold;
+ return BadValue;
}
- else if (stuff->threshold < 0) {
- client->errorValue = stuff->threshold;
- return BadValue;
- }
- else {
+ else {
ctrl.threshold = stuff->threshold;
}
}
for (dev = inputInfo.devices; dev; dev = dev->next) {
if ((dev == mouse ||
- (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) == mouse)) &&
+ (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) == mouse)) &&
dev->ptrfeed) {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess);
- if (rc != Success)
- return rc;
- }
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess);
+ if (rc != Success)
+ return rc;
+ }
}
for (dev = inputInfo.devices; dev; dev = dev->next) {
if ((dev == mouse ||
- (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) == mouse)) &&
+ (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) == mouse)) &&
dev->ptrfeed) {
dev->ptrfeed->ctrl = ctrl;
}
@@ -2272,11 +2270,12 @@ ProcGetPointerControl(ClientPtr client)
PtrCtrl *ctrl = &ptr->ptrfeed->ctrl;
xGetPointerControlReply rep;
int rc;
+
REQUEST_SIZE_MATCH(xReq);
rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
@@ -2294,76 +2293,74 @@ MaybeStopHint(DeviceIntPtr dev, ClientPtr client)
GrabPtr grab = dev->deviceGrab.grab;
if ((grab && SameClient(grab, client) &&
- ((grab->eventMask & PointerMotionHintMask) ||
- (grab->ownerEvents &&
- (EventMaskForClient(dev->valuator->motionHintWindow, client) &
- PointerMotionHintMask)))) ||
- (!grab &&
- (EventMaskForClient(dev->valuator->motionHintWindow, client) &
- PointerMotionHintMask)))
- dev->valuator->motionHintWindow = NullWindow;
+ ((grab->eventMask & PointerMotionHintMask) ||
+ (grab->ownerEvents &&
+ (EventMaskForClient(dev->valuator->motionHintWindow, client) &
+ PointerMotionHintMask)))) ||
+ (!grab &&
+ (EventMaskForClient(dev->valuator->motionHintWindow, client) &
+ PointerMotionHintMask)))
+ dev->valuator->motionHintWindow = NullWindow;
}
int
ProcGetMotionEvents(ClientPtr client)
{
WindowPtr pWin;
- xTimecoord * coords = (xTimecoord *) NULL;
+ xTimecoord *coords = (xTimecoord *) NULL;
xGetMotionEventsReply rep;
int i, count, xmin, xmax, ymin, ymax, rc;
unsigned long nEvents;
DeviceIntPtr mouse = PickPointer(client);
TimeStamp start, stop;
+
REQUEST(xGetMotionEventsReq);
REQUEST_SIZE_MATCH(xGetMotionEventsReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
if (mouse->valuator->motionHintWindow)
- MaybeStopHint(mouse, client);
+ MaybeStopHint(mouse, client);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
nEvents = 0;
start = ClientTimeToServerTime(stuff->start);
stop = ClientTimeToServerTime(stuff->stop);
if ((CompareTimeStamps(start, stop) != LATER) &&
- (CompareTimeStamps(start, currentTime) != LATER) &&
- mouse->valuator->numMotionEvents)
- {
- if (CompareTimeStamps(stop, currentTime) == LATER)
- stop = currentTime;
- count = GetMotionHistory(mouse, &coords, start.milliseconds,
- stop.milliseconds, pWin->drawable.pScreen,
+ (CompareTimeStamps(start, currentTime) != LATER) &&
+ mouse->valuator->numMotionEvents) {
+ if (CompareTimeStamps(stop, currentTime) == LATER)
+ stop = currentTime;
+ count = GetMotionHistory(mouse, &coords, start.milliseconds,
+ stop.milliseconds, pWin->drawable.pScreen,
TRUE);
- xmin = pWin->drawable.x - wBorderWidth (pWin);
- xmax = pWin->drawable.x + (int)pWin->drawable.width +
- wBorderWidth (pWin);
- ymin = pWin->drawable.y - wBorderWidth (pWin);
- ymax = pWin->drawable.y + (int)pWin->drawable.height +
- wBorderWidth (pWin);
- for (i = 0; i < count; i++)
- if ((xmin <= coords[i].x) && (coords[i].x < xmax) &&
- (ymin <= coords[i].y) && (coords[i].y < ymax))
- {
- coords[nEvents].time = coords[i].time;
- coords[nEvents].x = coords[i].x - pWin->drawable.x;
- coords[nEvents].y = coords[i].y - pWin->drawable.y;
- nEvents++;
- }
+ xmin = pWin->drawable.x - wBorderWidth(pWin);
+ xmax = pWin->drawable.x + (int) pWin->drawable.width +
+ wBorderWidth(pWin);
+ ymin = pWin->drawable.y - wBorderWidth(pWin);
+ ymax = pWin->drawable.y + (int) pWin->drawable.height +
+ wBorderWidth(pWin);
+ for (i = 0; i < count; i++)
+ if ((xmin <= coords[i].x) && (coords[i].x < xmax) &&
+ (ymin <= coords[i].y) && (coords[i].y < ymax)) {
+ coords[nEvents].time = coords[i].time;
+ coords[nEvents].x = coords[i].x - pWin->drawable.x;
+ coords[nEvents].y = coords[i].y - pWin->drawable.y;
+ nEvents++;
+ }
}
rep.length = nEvents * bytes_to_int32(sizeof(xTimecoord));
rep.nEvents = nEvents;
WriteReplyToClient(client, sizeof(xGetMotionEventsReply), &rep);
- if (nEvents)
- {
- client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite;
- WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
- (char *)coords);
+ if (nEvents) {
+ client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite;
+ WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
+ (char *) coords);
}
free(coords);
return Success;
@@ -2384,20 +2381,19 @@ ProcQueryKeymap(ClientPtr client)
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
if (rc != Success && rc != BadAccess)
- return rc;
+ return rc;
- for (i = 0; i<32; i++)
- rep.map[i] = down[i];
+ for (i = 0; i < 32; i++)
+ rep.map[i] = down[i];
if (rc == BadAccess)
- memset(rep.map, 0, 32);
+ memset(rep.map, 0, 32);
WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
- return Success;
+ return Success;
}
-
/**
* Recalculate the number of buttons for the master device. The number of
* buttons on the master device is equal to the number of buttons on the
@@ -2416,18 +2412,15 @@ RecalculateMasterButtons(DeviceIntPtr slave)
if (!master)
return;
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
if (IsMaster(dev) ||
- GetMaster(dev, MASTER_ATTACHED) != master ||
- !dev->button)
+ GetMaster(dev, MASTER_ATTACHED) != master || !dev->button)
continue;
maxbuttons = max(maxbuttons, dev->button->numButtons);
}
- if (master->button && master->button->numButtons != maxbuttons)
- {
+ if (master->button && master->button->numButtons != maxbuttons) {
int i;
DeviceChangedEvent event;
@@ -2442,23 +2435,21 @@ RecalculateMasterButtons(DeviceIntPtr slave)
event.flags = DEVCHANGE_POINTER_EVENT | DEVCHANGE_DEVICE_CHANGE;
event.buttons.num_buttons = maxbuttons;
memcpy(&event.buttons.names, master->button->labels, maxbuttons *
- sizeof(Atom));
+ sizeof(Atom));
- if (master->valuator)
- {
+ if (master->valuator) {
event.num_valuators = master->valuator->numAxes;
- for (i = 0; i < event.num_valuators; i++)
- {
+ for (i = 0; i < event.num_valuators; i++) {
event.valuators[i].min = master->valuator->axes[i].min_value;
event.valuators[i].max = master->valuator->axes[i].max_value;
- event.valuators[i].resolution = master->valuator->axes[i].resolution;
+ event.valuators[i].resolution =
+ master->valuator->axes[i].resolution;
event.valuators[i].mode = master->valuator->axes[i].mode;
event.valuators[i].name = master->valuator->axes[i].label;
}
}
- if (master->key)
- {
+ if (master->key) {
event.keys.min_keycode = master->key->xkbInfo->desc->min_key_code;
event.keys.max_keycode = master->key->xkbInfo->desc->max_key_code;
}
@@ -2474,30 +2465,27 @@ RecalculateMasterButtons(DeviceIntPtr slave)
void
ReleaseButtonsAndKeys(DeviceIntPtr dev)
{
- InternalEvent* eventlist = InitEventList(GetMaximumEventsNum());
- ButtonClassPtr b = dev->button;
- KeyClassPtr k = dev->key;
- int i, j, nevents;
+ InternalEvent *eventlist = InitEventList(GetMaximumEventsNum());
+ ButtonClassPtr b = dev->button;
+ KeyClassPtr k = dev->key;
+ int i, j, nevents;
- if (!eventlist) /* no release events for you */
+ if (!eventlist) /* no release events for you */
return;
/* Release all buttons */
- for (i = 0; b && i < b->numButtons; i++)
- {
- if (BitIsOn(b->down, i))
- {
- nevents = GetPointerEvents(eventlist, dev, ButtonRelease, i, 0, NULL);
+ for (i = 0; b && i < b->numButtons; i++) {
+ if (BitIsOn(b->down, i)) {
+ nevents =
+ GetPointerEvents(eventlist, dev, ButtonRelease, i, 0, NULL);
for (j = 0; j < nevents; j++)
mieqProcessDeviceEvent(dev, &eventlist[j], NULL);
}
}
/* Release all keys */
- for (i = 0; k && i < MAP_LENGTH; i++)
- {
- if (BitIsOn(k->down, i))
- {
+ for (i = 0; k && i < MAP_LENGTH; i++) {
+ if (BitIsOn(k->down, i)) {
nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i, NULL);
for (j = 0; j < nevents; j++)
mieqProcessDeviceEvent(dev, &eventlist[j], NULL);
@@ -2521,10 +2509,11 @@ int
AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
{
ScreenPtr screen;
+
if (!dev || IsMaster(dev))
return BadDevice;
- if (master && !IsMaster(master)) /* can't attach to slaves */
+ if (master && !IsMaster(master)) /* can't attach to slaves */
return BadDevice;
/* set from floating to floating? */
@@ -2532,8 +2521,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
return Success;
/* free the existing sprite. */
- if (IsFloating(dev) && dev->spriteInfo->paired == dev)
- {
+ if (IsFloating(dev) && dev->spriteInfo->paired == dev) {
screen = miPointerGetScreen(dev);
screen->DeviceCursorCleanup(dev, screen);
free(dev->spriteInfo->sprite);
@@ -2547,13 +2535,12 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
* Sprite has to be forced to NULL first, otherwise InitializeSprite won't
* alloc new memory but overwrite the previous one.
*/
- if (!master)
- {
+ if (!master) {
WindowPtr currentRoot;
if (dev->spriteInfo->sprite)
currentRoot = GetCurrentRootWindow(dev);
- else /* new device auto-set to floating */
+ else /* new device auto-set to floating */
currentRoot = screenInfo.screens[0]->root;
/* we need to init a fake sprite */
@@ -2563,8 +2550,8 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
InitializeSprite(dev, currentRoot);
dev->spriteInfo->spriteOwner = FALSE;
dev->spriteInfo->paired = dev;
- } else
- {
+ }
+ else {
dev->spriteInfo->sprite = master->spriteInfo->sprite;
dev->spriteInfo->paired = master;
dev->spriteInfo->spriteOwner = FALSE;
@@ -2595,7 +2582,6 @@ GetPairedDevice(DeviceIntPtr dev)
return dev->spriteInfo->paired;
}
-
/**
* Returns the requested master for this device.
* The return values are:
@@ -2623,18 +2609,17 @@ GetMaster(DeviceIntPtr dev, int which)
master = dev;
else {
master = dev->master;
- if (!master && (which == POINTER_OR_FLOAT || which == KEYBOARD_OR_FLOAT))
+ if (!master &&
+ (which == POINTER_OR_FLOAT || which == KEYBOARD_OR_FLOAT))
return dev;
}
- if (master && which != MASTER_ATTACHED)
- {
- if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT)
- {
+ if (master && which != MASTER_ATTACHED) {
+ if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT) {
if (master->type != MASTER_KEYBOARD)
master = GetPairedDevice(master);
- } else
- {
+ }
+ else {
if (master->type != MASTER_POINTER)
master = GetPairedDevice(master);
}
@@ -2651,24 +2636,25 @@ GetMaster(DeviceIntPtr dev, int which)
* the value for master.
*/
int
-AllocDevicePair (ClientPtr client, const char* name,
- DeviceIntPtr* ptr,
- DeviceIntPtr* keybd,
- DeviceProc ptr_proc,
- DeviceProc keybd_proc,
- Bool master)
+AllocDevicePair(ClientPtr client, const char *name,
+ DeviceIntPtr *ptr,
+ DeviceIntPtr *keybd,
+ DeviceProc ptr_proc, DeviceProc keybd_proc, Bool master)
{
DeviceIntPtr pointer;
DeviceIntPtr keyboard;
+
*ptr = *keybd = NULL;
pointer = AddInputDevice(client, ptr_proc, TRUE);
+
if (!pointer)
return BadAlloc;
if (asprintf(&pointer->name, "%s pointer", name) == -1) {
pointer->name = NULL;
RemoveDevice(pointer, FALSE);
+
return BadAlloc;
}
@@ -2685,9 +2671,9 @@ AllocDevicePair (ClientPtr client, const char* name,
pointer->type = (master) ? MASTER_POINTER : SLAVE;
keyboard = AddInputDevice(client, keybd_proc, TRUE);
- if (!keyboard)
- {
+ if (!keyboard) {
RemoveDevice(pointer, FALSE);
+
return BadAlloc;
}
@@ -2695,6 +2681,7 @@ AllocDevicePair (ClientPtr client, const char* name,
keyboard->name = NULL;
RemoveDevice(keyboard, FALSE);
RemoveDevice(pointer, FALSE);
+
return BadAlloc;
}
@@ -2712,9 +2699,11 @@ AllocDevicePair (ClientPtr client, const char* name,
/* The ClassesRec stores the device classes currently not used. */
pointer->unused_classes = calloc(1, sizeof(ClassesRec));
+
keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
*ptr = pointer;
+
*keybd = keyboard;
return Success;
@@ -2723,7 +2712,8 @@ AllocDevicePair (ClientPtr client, const char* name,
/**
* Return Relative or Absolute for the device.
*/
-int valuator_get_mode(DeviceIntPtr dev, int axis)
+int
+valuator_get_mode(DeviceIntPtr dev, int axis)
{
return (dev->valuator->axes[axis].mode & DeviceMode);
}
@@ -2732,12 +2722,14 @@ int valuator_get_mode(DeviceIntPtr dev, int axis)
* Set the given mode for the axis. If axis is VALUATOR_MODE_ALL_AXES, then
* set the mode for all axes.
*/
-void valuator_set_mode(DeviceIntPtr dev, int axis, int mode)
+void
+valuator_set_mode(DeviceIntPtr dev, int axis, int mode)
{
if (axis != VALUATOR_MODE_ALL_AXES)
dev->valuator->axes[axis].mode = mode;
else {
int i;
+
for (i = 0; i < dev->valuator->numAxes; i++)
dev->valuator->axes[i].mode = mode;
}
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c
index 35ce741c8..14f1af18a 100644
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -97,8 +96,6 @@ Equipment Corporation.
* DEALINGS IN THE SOFTWARE.
*/
-
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <version-config.h>
@@ -140,6 +137,7 @@ int ProcInitialConnection();
#include "registry.h"
#include <sys/types.h>
typedef const char *string;
+
#include "Xserver-dtrace.h"
#endif
@@ -156,6 +154,7 @@ xConnSetupPrefix connSetupPrefix;
PaddingInfo PixmapWidthPaddingInfo[33];
static ClientPtr grabClient;
+
#define GrabNone 0
#define GrabActive 1
#define GrabKickout 2
@@ -167,9 +166,9 @@ int connBlockScreenStart;
static void KillAllClients(void);
-static int nextFreeClientID; /* always MIN free client ID */
+static int nextFreeClientID; /* always MIN free client ID */
-static int nClients; /* number of authorized clients */
+static int nClients; /* number of authorized clients */
CallbackListPtr ClientStateCallback;
@@ -202,11 +201,11 @@ UpdateCurrentTime(void)
systime.months = currentTime.months;
systime.milliseconds = GetTimeInMillis();
if (systime.milliseconds < currentTime.milliseconds)
- systime.months++;
+ systime.months++;
if (*checkForInput[0] != *checkForInput[1])
- ProcessInputEvents();
+ ProcessInputEvents();
if (CompareTimeStamps(systime, currentTime) == LATER)
- currentTime = systime;
+ currentTime = systime;
}
/* Like UpdateCurrentTime, but can't call ProcessInputEvents */
@@ -218,16 +217,15 @@ UpdateCurrentTimeIf(void)
systime.months = currentTime.months;
systime.milliseconds = GetTimeInMillis();
if (systime.milliseconds < currentTime.milliseconds)
- systime.months++;
+ systime.months++;
if (*checkForInput[0] == *checkForInput[1])
- currentTime = systime;
+ currentTime = systime;
}
-
#undef SMART_DEBUG
-#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
-#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
+#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
+#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
Bool SmartScheduleDisable = FALSE;
long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
@@ -235,91 +233,86 @@ long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
long SmartScheduleTime;
int SmartScheduleLatencyLimited = 0;
-static ClientPtr SmartLastClient;
-static int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1];
+static ClientPtr SmartLastClient;
+static int SmartLastIndex[SMART_MAX_PRIORITY - SMART_MIN_PRIORITY + 1];
#ifdef SMART_DEBUG
-long SmartLastPrint;
+long SmartLastPrint;
#endif
-void Dispatch(void);
+void Dispatch(void);
static int
-SmartScheduleClient (int *clientReady, int nready)
+SmartScheduleClient(int *clientReady, int nready)
{
- ClientPtr pClient;
- int i;
- int client;
- int bestPrio, best = 0;
- int bestRobin, robin;
- long now = SmartScheduleTime;
- long idle;
+ ClientPtr pClient;
+ int i;
+ int client;
+ int bestPrio, best = 0;
+ int bestRobin, robin;
+ long now = SmartScheduleTime;
+ long idle;
bestPrio = -0x7fffffff;
bestRobin = 0;
idle = 2 * SmartScheduleSlice;
- for (i = 0; i < nready; i++)
- {
- client = clientReady[i];
- pClient = clients[client];
- /* Praise clients which are idle */
- if ((now - pClient->smart_check_tick) >= idle)
- {
- if (pClient->smart_priority < 0)
- pClient->smart_priority++;
- }
- pClient->smart_check_tick = now;
-
- /* check priority to select best client */
- robin = (pClient->index - SmartLastIndex[pClient->smart_priority-SMART_MIN_PRIORITY]) & 0xff;
- if (pClient->smart_priority > bestPrio ||
- (pClient->smart_priority == bestPrio && robin > bestRobin))
- {
- bestPrio = pClient->smart_priority;
- bestRobin = robin;
- best = client;
- }
+ for (i = 0; i < nready; i++) {
+ client = clientReady[i];
+ pClient = clients[client];
+ /* Praise clients which are idle */
+ if ((now - pClient->smart_check_tick) >= idle) {
+ if (pClient->smart_priority < 0)
+ pClient->smart_priority++;
+ }
+ pClient->smart_check_tick = now;
+
+ /* check priority to select best client */
+ robin =
+ (pClient->index -
+ SmartLastIndex[pClient->smart_priority -
+ SMART_MIN_PRIORITY]) & 0xff;
+ if (pClient->smart_priority > bestPrio ||
+ (pClient->smart_priority == bestPrio && robin > bestRobin)) {
+ bestPrio = pClient->smart_priority;
+ bestRobin = robin;
+ best = client;
+ }
#ifdef SMART_DEBUG
- if ((now - SmartLastPrint) >= 5000)
- fprintf (stderr, " %2d: %3d", client, pClient->smart_priority);
+ if ((now - SmartLastPrint) >= 5000)
+ fprintf(stderr, " %2d: %3d", client, pClient->smart_priority);
#endif
}
#ifdef SMART_DEBUG
- if ((now - SmartLastPrint) >= 5000)
- {
- fprintf (stderr, " use %2d\n", best);
- SmartLastPrint = now;
+ if ((now - SmartLastPrint) >= 5000) {
+ fprintf(stderr, " use %2d\n", best);
+ SmartLastPrint = now;
}
#endif
pClient = clients[best];
- SmartLastIndex[bestPrio-SMART_MIN_PRIORITY] = pClient->index;
+ SmartLastIndex[bestPrio - SMART_MIN_PRIORITY] = pClient->index;
/*
* Set current client pointer
*/
- if (SmartLastClient != pClient)
- {
- pClient->smart_start_tick = now;
- SmartLastClient = pClient;
+ if (SmartLastClient != pClient) {
+ pClient->smart_start_tick = now;
+ SmartLastClient = pClient;
}
/*
* Adjust slice
*/
- if (nready == 1 && SmartScheduleLatencyLimited == 0)
- {
- /*
- * If it's been a long time since another client
- * has run, bump the slice up to get maximal
- * performance from a single client
- */
- if ((now - pClient->smart_start_tick) > 1000 &&
- SmartScheduleSlice < SmartScheduleMaxSlice)
- {
- SmartScheduleSlice += SmartScheduleInterval;
- }
+ if (nready == 1 && SmartScheduleLatencyLimited == 0) {
+ /*
+ * If it's been a long time since another client
+ * has run, bump the slice up to get maximal
+ * performance from a single client
+ */
+ if ((now - pClient->smart_start_tick) > 1000 &&
+ SmartScheduleSlice < SmartScheduleMaxSlice) {
+ SmartScheduleSlice += SmartScheduleInterval;
+ }
}
- else
- {
- SmartScheduleSlice = SmartScheduleInterval;
+ else {
+ SmartScheduleSlice = SmartScheduleInterval;
}
return best;
}
@@ -338,170 +331,161 @@ DisableLimitedSchedulingLatency(void)
/* protect against bugs */
if (SmartScheduleLatencyLimited < 0)
- SmartScheduleLatencyLimited = 0;
+ SmartScheduleLatencyLimited = 0;
}
void
Dispatch(void)
{
- int *clientReady; /* array of request ready clients */
- int result;
- ClientPtr client;
- int nready;
- HWEventQueuePtr* icheck = checkForInput;
- long start_tick;
+ int *clientReady; /* array of request ready clients */
+ int result;
+ ClientPtr client;
+ int nready;
+ HWEventQueuePtr *icheck = checkForInput;
+ long start_tick;
nextFreeClientID = 1;
nClients = 0;
clientReady = malloc(sizeof(int) * MaxClients);
if (!clientReady)
- return;
+ return;
SmartScheduleSlice = SmartScheduleInterval;
- while (!dispatchException)
- {
- if (*icheck[0] != *icheck[1])
- {
- ProcessInputEvents();
- FlushIfCriticalOutputPending();
- }
-
- nready = WaitForSomething(clientReady);
-
- if (nready && !SmartScheduleDisable)
- {
- clientReady[0] = SmartScheduleClient (clientReady, nready);
- nready = 1;
- }
+ while (!dispatchException) {
+ if (*icheck[0] != *icheck[1]) {
+ ProcessInputEvents();
+ FlushIfCriticalOutputPending();
+ }
+
+ nready = WaitForSomething(clientReady);
+
+ if (nready && !SmartScheduleDisable) {
+ clientReady[0] = SmartScheduleClient(clientReady, nready);
+ nready = 1;
+ }
/*****************
* Handle events in round robin fashion, doing input between
* each round
*****************/
- while (!dispatchException && (--nready >= 0))
- {
- client = clients[clientReady[nready]];
- if (! client)
- {
- /* KillClient can cause this to happen */
- continue;
- }
- /* GrabServer activation can cause this to be true */
- if (grabState == GrabKickout)
- {
- grabState = GrabActive;
- break;
- }
- isItTimeToYield = FALSE;
-
- start_tick = SmartScheduleTime;
- while (!isItTimeToYield)
- {
+ while (!dispatchException && (--nready >= 0)) {
+ client = clients[clientReady[nready]];
+ if (!client) {
+ /* KillClient can cause this to happen */
+ continue;
+ }
+ /* GrabServer activation can cause this to be true */
+ if (grabState == GrabKickout) {
+ grabState = GrabActive;
+ break;
+ }
+ isItTimeToYield = FALSE;
+
+ start_tick = SmartScheduleTime;
+ while (!isItTimeToYield) {
#ifdef XSERVER_DTRACE
- CARD8 StartMajorOp;
+ CARD8 StartMajorOp;
#endif
- if (*icheck[0] != *icheck[1])
- ProcessInputEvents();
-
- FlushIfCriticalOutputPending();
- if (!SmartScheduleDisable &&
- (SmartScheduleTime - start_tick) >= SmartScheduleSlice)
- {
- /* Penalize clients which consume ticks */
- if (client->smart_priority > SMART_MIN_PRIORITY)
- client->smart_priority--;
- break;
- }
- /* now, finally, deal with client requests */
-
- result = ReadRequestFromClient(client);
- if (result <= 0)
- {
- if (result < 0)
- CloseDownClient(client);
- break;
- }
-
- client->sequence++;
- client->majorOp = ((xReq *)client->requestBuffer)->reqType;
- client->minorOp = 0;
- if (client->majorOp >= EXTENSION_BASE) {
- ExtensionEntry *ext = GetExtensionEntry(client->majorOp);
- if (ext)
- client->minorOp = ext->MinorOpcode(client);
- }
+ if (*icheck[0] != *icheck[1])
+ ProcessInputEvents();
+
+ FlushIfCriticalOutputPending();
+ if (!SmartScheduleDisable &&
+ (SmartScheduleTime - start_tick) >= SmartScheduleSlice) {
+ /* Penalize clients which consume ticks */
+ if (client->smart_priority > SMART_MIN_PRIORITY)
+ client->smart_priority--;
+ break;
+ }
+ /* now, finally, deal with client requests */
+
+ result = ReadRequestFromClient(client);
+ if (result <= 0) {
+ if (result < 0)
+ CloseDownClient(client);
+ break;
+ }
+
+ client->sequence++;
+ client->majorOp = ((xReq *) client->requestBuffer)->reqType;
+ client->minorOp = 0;
+ if (client->majorOp >= EXTENSION_BASE) {
+ ExtensionEntry *ext = GetExtensionEntry(client->majorOp);
+
+ if (ext)
+ client->minorOp = ext->MinorOpcode(client);
+ }
#ifdef XSERVER_DTRACE
- if (XSERVER_REQUEST_START_ENABLED())
- {
- StartMajorOp=client->majorOp;
- XSERVER_REQUEST_START(LookupMajorName(client->majorOp),
- client->majorOp,
- ((xReq *)client->requestBuffer)->length,
- client->index, client->requestBuffer);
- }
+ if (XSERVER_REQUEST_START_ENABLED())
+ {
+ StartMajorOp=client->majorOp;
+ XSERVER_REQUEST_START(LookupMajorName(client->majorOp),
+ client->majorOp,
+ ((xReq *)client->requestBuffer)->length,
+ client->index, client->requestBuffer);
+ }
#endif
- if (result > (maxBigRequestSize << 2))
- result = BadLength;
- else {
- result = XaceHookDispatch(client, client->majorOp);
- if (result == Success)
- result = (* client->requestVector[client->majorOp])(client);
- XaceHookAuditEnd(client, result);
- }
+ if (result > (maxBigRequestSize << 2))
+ result = BadLength;
+ else {
+ result = XaceHookDispatch(client, client->majorOp);
+ if (result == Success)
+ result =
+ (*client->requestVector[client->majorOp]) (client);
+ XaceHookAuditEnd(client, result);
+ }
#ifdef XSERVER_DTRACE
- if (XSERVER_REQUEST_DONE_ENABLED())
- {
- if (result!=Success)
- {
- char Message[255];
- sprintf(Message,"ERROR: %s (0x%x)",LookupMajorName(client->majorOp),client->errorValue);
- XSERVER_REQUEST_DONE(Message,
- client->majorOp, client->sequence,
- client->index, result);
- }
- else
- {
- if (StartMajorOp!=client->majorOp)
- {
- char Message[255];
- sprintf(Message,"Changed request: %s -> %s",LookupMajorName(StartMajorOp),LookupMajorName(client->majorOp));
- XSERVER_REQUEST_DONE(Message,
- client->majorOp, client->sequence,
- client->index, result);
- }
- else
- {
- XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp),
- client->majorOp, client->sequence,
- client->index, result);
- }
- }
- }
+ if (XSERVER_REQUEST_DONE_ENABLED())
+ {
+ if (result!=Success)
+ {
+ char Message[255];
+ sprintf(Message,"ERROR: %s (0x%x)",LookupMajorName(client->majorOp),client->errorValue);
+ XSERVER_REQUEST_DONE(Message,
+ client->majorOp, client->sequence,
+ client->index, result);
+ }
+ else
+ {
+ if (StartMajorOp!=client->majorOp)
+ {
+ char Message[255];
+ sprintf(Message,"Changed request: %s -> %s",LookupMajorName(StartMajorOp),LookupMajorName(client->majorOp));
+ XSERVER_REQUEST_DONE(Message,
+ client->majorOp, client->sequence,
+ client->index, result);
+ }
+ else
+ {
+ XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp),
+ client->majorOp, client->sequence,
+ client->index, result);
+ }
+ }
+ }
#endif
- if (client->noClientException != Success)
- {
- CloseDownClient(client);
- break;
- }
- else if (result != Success)
- {
- SendErrorToClient(client, client->majorOp,
- client->minorOp,
- client->errorValue, result);
- break;
- }
- }
- FlushAllOutput();
- client = clients[clientReady[nready]];
- if (client)
- client->smart_stop_tick = SmartScheduleTime;
- }
- dispatchException &= ~DE_PRIORITYCHANGE;
+ if (client->noClientException != Success) {
+ CloseDownClient(client);
+ break;
+ }
+ else if (result != Success) {
+ SendErrorToClient(client, client->majorOp,
+ client->minorOp,
+ client->errorValue, result);
+ break;
+ }
+ }
+ FlushAllOutput();
+ client = clients[clientReady[nready]];
+ if (client)
+ client->smart_stop_tick = SmartScheduleTime;
+ }
+ dispatchException &= ~DE_PRIORITYCHANGE;
}
#if defined(DDXBEFORERESET)
- ddxBeforeReset ();
+ ddxBeforeReset();
#endif
KillAllClients();
free(clientReady);
@@ -509,10 +493,10 @@ Dispatch(void)
SmartScheduleLatencyLimited = 0;
}
-static int VendorRelease = VENDOR_RELEASE;
+static int VendorRelease = VENDOR_RELEASE;
static char *VendorString = VENDOR_NAME;
-static const int padlength[4] = {0, 3, 2, 1};
+static const int padlength[4] = { 0, 3, 2, 1 };
void
SetVendorRelease(int release)
@@ -531,16 +515,13 @@ CreateConnectionBlock(void)
{
xConnSetup setup;
xWindowRoot root;
- xDepth depth;
+ xDepth depth;
xVisualType visual;
xPixmapFormat format;
unsigned long vid;
- int i, j, k,
- lenofblock,
- sizesofar = 0;
+ int i, j, k, lenofblock, sizesofar = 0;
char *pBuf;
-
memset(&setup, 0, sizeof(xConnSetup));
/* Leave off the ridBase and ridMask, these must be sent with
connection */
@@ -563,112 +544,104 @@ CreateConnectionBlock(void)
QueryMinMaxKeyCodes(&setup.minKeyCode, &setup.maxKeyCode);
lenofblock = sizeof(xConnSetup) +
- pad_to_int32(setup.nbytesVendor) +
- (setup.numFormats * sizeof(xPixmapFormat)) +
- (setup.numRoots * sizeof(xWindowRoot));
+ pad_to_int32(setup.nbytesVendor) +
+ (setup.numFormats * sizeof(xPixmapFormat)) +
+ (setup.numRoots * sizeof(xWindowRoot));
ConnectionInfo = malloc(lenofblock);
if (!ConnectionInfo)
- return FALSE;
+ return FALSE;
- memmove(ConnectionInfo, (char *)&setup, sizeof(xConnSetup));
+ memmove(ConnectionInfo, (char *) &setup, sizeof(xConnSetup));
sizesofar = sizeof(xConnSetup);
pBuf = ConnectionInfo + sizeof(xConnSetup);
- memmove(pBuf, VendorString, (int)setup.nbytesVendor);
+ memmove(pBuf, VendorString, (int) setup.nbytesVendor);
sizesofar += setup.nbytesVendor;
pBuf += setup.nbytesVendor;
i = padlength[setup.nbytesVendor & 3];
sizesofar += i;
while (--i >= 0)
- *pBuf++ = 0;
+ *pBuf++ = 0;
memset(&format, 0, sizeof(xPixmapFormat));
- for (i=0; i<screenInfo.numPixmapFormats; i++)
- {
- format.depth = screenInfo.formats[i].depth;
- format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
- format.scanLinePad = screenInfo.formats[i].scanlinePad;
- memmove(pBuf, (char *)&format, sizeof(xPixmapFormat));
- pBuf += sizeof(xPixmapFormat);
- sizesofar += sizeof(xPixmapFormat);
+ for (i = 0; i < screenInfo.numPixmapFormats; i++) {
+ format.depth = screenInfo.formats[i].depth;
+ format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
+ format.scanLinePad = screenInfo.formats[i].scanlinePad;
+ memmove(pBuf, (char *) &format, sizeof(xPixmapFormat));
+ pBuf += sizeof(xPixmapFormat);
+ sizesofar += sizeof(xPixmapFormat);
}
connBlockScreenStart = sizesofar;
memset(&depth, 0, sizeof(xDepth));
memset(&visual, 0, sizeof(xVisualType));
- for (i=0; i<screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen;
- DepthPtr pDepth;
- VisualPtr pVisual;
-
- pScreen = screenInfo.screens[i];
- root.windowId = pScreen->root->drawable.id;
- root.defaultColormap = pScreen->defColormap;
- root.whitePixel = pScreen->whitePixel;
- root.blackPixel = pScreen->blackPixel;
- root.currentInputMask = 0; /* filled in when sent */
- root.pixWidth = pScreen->width;
- root.pixHeight = pScreen->height;
- root.mmWidth = pScreen->mmWidth;
- root.mmHeight = pScreen->mmHeight;
- root.minInstalledMaps = pScreen->minInstalledCmaps;
- root.maxInstalledMaps = pScreen->maxInstalledCmaps;
- root.rootVisualID = pScreen->rootVisual;
- root.backingStore = pScreen->backingStoreSupport;
- root.saveUnders = FALSE;
- root.rootDepth = pScreen->rootDepth;
- root.nDepths = pScreen->numDepths;
- memmove(pBuf, (char *)&root, sizeof(xWindowRoot));
- sizesofar += sizeof(xWindowRoot);
- pBuf += sizeof(xWindowRoot);
-
- pDepth = pScreen->allowedDepths;
- for(j = 0; j < pScreen->numDepths; j++, pDepth++)
- {
- lenofblock += sizeof(xDepth) +
- (pDepth->numVids * sizeof(xVisualType));
- pBuf = (char *)realloc(ConnectionInfo, lenofblock);
- if (!pBuf)
- {
- free(ConnectionInfo);
- return FALSE;
- }
- ConnectionInfo = pBuf;
- pBuf += sizesofar;
- depth.depth = pDepth->depth;
- depth.nVisuals = pDepth->numVids;
- memmove(pBuf, (char *)&depth, sizeof(xDepth));
- pBuf += sizeof(xDepth);
- sizesofar += sizeof(xDepth);
- for(k = 0; k < pDepth->numVids; k++)
- {
- vid = pDepth->vids[k];
- for (pVisual = pScreen->visuals;
- pVisual->vid != vid;
- pVisual++)
- ;
- visual.visualID = vid;
- visual.class = pVisual->class;
- visual.bitsPerRGB = pVisual->bitsPerRGBValue;
- visual.colormapEntries = pVisual->ColormapEntries;
- visual.redMask = pVisual->redMask;
- visual.greenMask = pVisual->greenMask;
- visual.blueMask = pVisual->blueMask;
- memmove(pBuf, (char *)&visual, sizeof(xVisualType));
- pBuf += sizeof(xVisualType);
- sizesofar += sizeof(xVisualType);
- }
- }
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen;
+ DepthPtr pDepth;
+ VisualPtr pVisual;
+
+ pScreen = screenInfo.screens[i];
+ root.windowId = pScreen->root->drawable.id;
+ root.defaultColormap = pScreen->defColormap;
+ root.whitePixel = pScreen->whitePixel;
+ root.blackPixel = pScreen->blackPixel;
+ root.currentInputMask = 0; /* filled in when sent */
+ root.pixWidth = pScreen->width;
+ root.pixHeight = pScreen->height;
+ root.mmWidth = pScreen->mmWidth;
+ root.mmHeight = pScreen->mmHeight;
+ root.minInstalledMaps = pScreen->minInstalledCmaps;
+ root.maxInstalledMaps = pScreen->maxInstalledCmaps;
+ root.rootVisualID = pScreen->rootVisual;
+ root.backingStore = pScreen->backingStoreSupport;
+ root.saveUnders = FALSE;
+ root.rootDepth = pScreen->rootDepth;
+ root.nDepths = pScreen->numDepths;
+ memmove(pBuf, (char *) &root, sizeof(xWindowRoot));
+ sizesofar += sizeof(xWindowRoot);
+ pBuf += sizeof(xWindowRoot);
+
+ pDepth = pScreen->allowedDepths;
+ for (j = 0; j < pScreen->numDepths; j++, pDepth++) {
+ lenofblock += sizeof(xDepth) +
+ (pDepth->numVids * sizeof(xVisualType));
+ pBuf = (char *) realloc(ConnectionInfo, lenofblock);
+ if (!pBuf) {
+ free(ConnectionInfo);
+ return FALSE;
+ }
+ ConnectionInfo = pBuf;
+ pBuf += sizesofar;
+ depth.depth = pDepth->depth;
+ depth.nVisuals = pDepth->numVids;
+ memmove(pBuf, (char *) &depth, sizeof(xDepth));
+ pBuf += sizeof(xDepth);
+ sizesofar += sizeof(xDepth);
+ for (k = 0; k < pDepth->numVids; k++) {
+ vid = pDepth->vids[k];
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != vid; pVisual++);
+ visual.visualID = vid;
+ visual.class = pVisual->class;
+ visual.bitsPerRGB = pVisual->bitsPerRGBValue;
+ visual.colormapEntries = pVisual->ColormapEntries;
+ visual.redMask = pVisual->redMask;
+ visual.greenMask = pVisual->greenMask;
+ visual.blueMask = pVisual->blueMask;
+ memmove(pBuf, (char *) &visual, sizeof(xVisualType));
+ pBuf += sizeof(xVisualType);
+ sizesofar += sizeof(xVisualType);
+ }
+ }
}
connSetupPrefix.success = xTrue;
- connSetupPrefix.length = lenofblock/4;
+ connSetupPrefix.length = lenofblock / 4;
connSetupPrefix.majorVersion = X_PROTOCOL;
connSetupPrefix.minorVersion = X_PROTOCOL_REVISION;
return TRUE;
}
-
int
ProcBadRequest(ClientPtr client)
{
@@ -679,11 +652,12 @@ int
ProcCreateWindow(ClientPtr client)
{
WindowPtr pParent, pWin;
+
REQUEST(xCreateWindowReq);
int len, rc;
REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
-
+
LEGAL_NEW_RESOURCE(stuff->wid, client);
rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess);
if (rc != Success)
@@ -691,25 +665,22 @@ ProcCreateWindow(ClientPtr client)
len = client->req_len - bytes_to_int32(sizeof(xCreateWindowReq));
if (Ones(stuff->mask) != len)
return BadLength;
- if (!stuff->width || !stuff->height)
- {
- client->errorValue = 0;
+ if (!stuff->width || !stuff->height) {
+ client->errorValue = 0;
return BadValue;
}
pWin = CreateWindow(stuff->wid, pParent, stuff->x,
- stuff->y, stuff->width, stuff->height,
- stuff->borderWidth, stuff->class,
- stuff->mask, (XID *) &stuff[1],
- (int)stuff->depth,
- client, stuff->visual, &rc);
- if (pWin)
- {
- Mask mask = pWin->eventMask;
-
- pWin->eventMask = 0; /* subterfuge in case AddResource fails */
- if (!AddResource(stuff->wid, RT_WINDOW, (pointer)pWin))
- return BadAlloc;
- pWin->eventMask = mask;
+ stuff->y, stuff->width, stuff->height,
+ stuff->borderWidth, stuff->class,
+ stuff->mask, (XID *) &stuff[1],
+ (int) stuff->depth, client, stuff->visual, &rc);
+ if (pWin) {
+ Mask mask = pWin->eventMask;
+
+ pWin->eventMask = 0; /* subterfuge in case AddResource fails */
+ if (!AddResource(stuff->wid, RT_WINDOW, (pointer) pWin))
+ return BadAlloc;
+ pWin->eventMask = mask;
}
return rc;
}
@@ -718,6 +689,7 @@ int
ProcChangeWindowAttributes(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xChangeWindowAttributesReq);
int len, rc;
Mask access_mode = 0;
@@ -732,15 +704,14 @@ ProcChangeWindowAttributes(ClientPtr client)
if (len != Ones(stuff->valueMask))
return BadLength;
return ChangeWindowAttributes(pWin,
- stuff->valueMask,
- (XID *) &stuff[1],
- client);
+ stuff->valueMask, (XID *) &stuff[1], client);
}
int
ProcGetWindowAttributes(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xResourceReq);
xGetWindowAttributesReply wa;
int rc;
@@ -748,7 +719,7 @@ ProcGetWindowAttributes(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
memset(&wa, 0, sizeof(xGetWindowAttributesReply));
GetWindowAttributes(pWin, client, &wa);
WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
@@ -759,19 +730,20 @@ int
ProcDestroyWindow(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
if (pWin->parent) {
- rc = dixLookupWindow(&pWin, pWin->parent->drawable.id, client,
- DixRemoveAccess);
- if (rc != Success)
- return rc;
- FreeResource(stuff->id, RT_NONE);
+ rc = dixLookupWindow(&pWin, pWin->parent->drawable.id, client,
+ DixRemoveAccess);
+ if (rc != Success)
+ return rc;
+ FreeResource(stuff->id, RT_NONE);
}
return Success;
}
@@ -780,13 +752,14 @@ int
ProcDestroySubwindows(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupWindow(&pWin, stuff->id, client, DixRemoveAccess);
if (rc != Success)
- return rc;
+ return rc;
DestroySubwindows(pWin, client);
return Success;
}
@@ -795,9 +768,10 @@ int
ProcChangeSaveSet(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xChangeSaveSetReq);
int rc;
-
+
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
if (rc != Success)
@@ -814,6 +788,7 @@ int
ProcReparentWindow(ClientPtr client)
{
WindowPtr pWin, pParent;
+
REQUEST(xReparentWindowReq);
int rc;
@@ -825,21 +800,22 @@ ProcReparentWindow(ClientPtr client)
if (rc != Success)
return rc;
if (!SAME_SCREENS(pWin->drawable, pParent->drawable))
- return BadMatch;
+ return BadMatch;
if ((pWin->backgroundState == ParentRelative) &&
- (pParent->drawable.depth != pWin->drawable.depth))
- return BadMatch;
+ (pParent->drawable.depth != pWin->drawable.depth))
+ return BadMatch;
if ((pWin->drawable.class != InputOnly) &&
- (pParent->drawable.class == InputOnly))
- return BadMatch;
+ (pParent->drawable.class == InputOnly))
+ return BadMatch;
return ReparentWindow(pWin, pParent,
- (short)stuff->x, (short)stuff->y, client);
+ (short) stuff->x, (short) stuff->y, client);
}
int
ProcMapWindow(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xResourceReq);
int rc;
@@ -848,7 +824,7 @@ ProcMapWindow(ClientPtr client)
if (rc != Success)
return rc;
MapWindow(pWin, client);
- /* update cache to say it is mapped */
+ /* update cache to say it is mapped */
return Success;
}
@@ -856,6 +832,7 @@ int
ProcMapSubwindows(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xResourceReq);
int rc;
@@ -864,7 +841,7 @@ ProcMapSubwindows(ClientPtr client)
if (rc != Success)
return rc;
MapSubwindows(pWin, client);
- /* update cache to say it is mapped */
+ /* update cache to say it is mapped */
return Success;
}
@@ -872,6 +849,7 @@ int
ProcUnmapWindow(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xResourceReq);
int rc;
@@ -880,7 +858,7 @@ ProcUnmapWindow(ClientPtr client)
if (rc != Success)
return rc;
UnmapWindow(pWin, FALSE);
- /* update cache to say it is mapped */
+ /* update cache to say it is mapped */
return Success;
}
@@ -888,6 +866,7 @@ int
ProcUnmapSubwindows(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xResourceReq);
int rc;
@@ -903,52 +882,53 @@ int
ProcConfigureWindow(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xConfigureWindowReq);
int len, rc;
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
rc = dixLookupWindow(&pWin, stuff->window, client,
- DixManageAccess|DixSetAttrAccess);
+ DixManageAccess | DixSetAttrAccess);
if (rc != Success)
return rc;
len = client->req_len - bytes_to_int32(sizeof(xConfigureWindowReq));
- if (Ones((Mask)stuff->mask) != len)
+ if (Ones((Mask) stuff->mask) != len)
return BadLength;
- return ConfigureWindow(pWin, (Mask)stuff->mask, (XID *) &stuff[1], client);
+ return ConfigureWindow(pWin, (Mask) stuff->mask, (XID *) &stuff[1], client);
}
int
ProcCirculateWindow(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xCirculateWindowReq);
int rc;
REQUEST_SIZE_MATCH(xCirculateWindowReq);
- if ((stuff->direction != RaiseLowest) &&
- (stuff->direction != LowerHighest))
- {
- client->errorValue = stuff->direction;
+ if ((stuff->direction != RaiseLowest) && (stuff->direction != LowerHighest)) {
+ client->errorValue = stuff->direction;
return BadValue;
}
rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
if (rc != Success)
return rc;
- CirculateWindow(pWin, (int)stuff->direction, client);
+ CirculateWindow(pWin, (int) stuff->direction, client);
return Success;
}
static int
-GetGeometry(ClientPtr client, xGetGeometryReply *rep)
+GetGeometry(ClientPtr client, xGetGeometryReply * rep)
{
DrawablePtr pDraw;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep->type = X_Reply;
rep->length = 0;
@@ -958,22 +938,21 @@ GetGeometry(ClientPtr client, xGetGeometryReply *rep)
rep->width = pDraw->width;
rep->height = pDraw->height;
- if (WindowDrawable(pDraw->type))
- {
- WindowPtr pWin = (WindowPtr)pDraw;
- rep->x = pWin->origin.x - wBorderWidth (pWin);
- rep->y = pWin->origin.y - wBorderWidth (pWin);
- rep->borderWidth = pWin->borderWidth;
+ if (WindowDrawable(pDraw->type)) {
+ WindowPtr pWin = (WindowPtr) pDraw;
+
+ rep->x = pWin->origin.x - wBorderWidth(pWin);
+ rep->y = pWin->origin.y - wBorderWidth(pWin);
+ rep->borderWidth = pWin->borderWidth;
}
- else /* DRAWABLE_PIXMAP */
- {
- rep->x = rep->y = rep->borderWidth = 0;
+ else { /* DRAWABLE_PIXMAP */
+
+ rep->x = rep->y = rep->borderWidth = 0;
}
return Success;
}
-
int
ProcGetGeometry(ClientPtr client)
{
@@ -982,7 +961,7 @@ ProcGetGeometry(ClientPtr client)
memset(&rep, 0, sizeof(xGetGeometryReply));
if ((status = GetGeometry(client, &rep)) != Success)
- return status;
+ return status;
WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
return Success;
@@ -995,14 +974,14 @@ ProcGetGeometry(ClientPtr client)
extern Window g_iClipboardWindow;
#endif
-
int
ProcQueryTree(ClientPtr client)
{
xQueryTreeReply reply;
int rc, numChildren = 0;
WindowPtr pChild, pWin, pHead;
- Window *childIDs = (Window *)NULL;
+ Window *childIDs = (Window *) NULL;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
@@ -1014,38 +993,38 @@ ProcQueryTree(ClientPtr client)
reply.root = pWin->drawable.pScreen->root->drawable.id;
reply.sequenceNumber = client->sequence;
if (pWin->parent)
- reply.parent = pWin->parent->drawable.id;
+ reply.parent = pWin->parent->drawable.id;
else
- reply.parent = (Window)None;
+ reply.parent = (Window) None;
pHead = RealChildHead(pWin);
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
#ifdef WIN32
- if (pChild->drawable.id!=g_iClipboardWindow)
+ if (pChild->drawable.id!=g_iClipboardWindow)
#endif
- numChildren++;
- if (numChildren)
- {
- int curChild = 0;
+ numChildren++;
+ if (numChildren) {
+ int curChild = 0;
- childIDs = malloc(numChildren * sizeof(Window));
- if (!childIDs)
- return BadAlloc;
- for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
+ childIDs = malloc(numChildren * sizeof(Window));
+ if (!childIDs)
+ return BadAlloc;
+ for (pChild = pWin->lastChild; pChild != pHead;
+ pChild = pChild->prevSib)
#ifdef WIN32
- if (pChild->drawable.id!=g_iClipboardWindow)
+ if (pChild->drawable.id!=g_iClipboardWindow)
#endif
- childIDs[curChild++] = pChild->drawable.id;
+ childIDs[curChild++] = pChild->drawable.id;
}
-
+
reply.nChildren = numChildren;
reply.length = bytes_to_int32(numChildren * sizeof(Window));
-
+
WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply);
- if (numChildren)
- {
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
- free(childIDs);
+ if (numChildren) {
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, numChildren * sizeof(Window),
+ childIDs);
+ free(childIDs);
}
return Success;
@@ -1056,29 +1035,29 @@ ProcInternAtom(ClientPtr client)
{
Atom atom;
char *tchar;
+
REQUEST(xInternAtomReq);
REQUEST_FIXED_SIZE(xInternAtomReq, stuff->nbytes);
- if ((stuff->onlyIfExists != xTrue) && (stuff->onlyIfExists != xFalse))
- {
- client->errorValue = stuff->onlyIfExists;
+ if ((stuff->onlyIfExists != xTrue) && (stuff->onlyIfExists != xFalse)) {
+ client->errorValue = stuff->onlyIfExists;
return BadValue;
}
tchar = (char *) &stuff[1];
atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists);
- if (atom != BAD_RESOURCE)
- {
- xInternAtomReply reply;
- memset(&reply, 0, sizeof(xInternAtomReply));
- reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
- reply.atom = atom;
- WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
- return Success;
+ if (atom != BAD_RESOURCE) {
+ xInternAtomReply reply;
+
+ memset(&reply, 0, sizeof(xInternAtomReply));
+ reply.type = X_Reply;
+ reply.length = 0;
+ reply.sequenceNumber = client->sequence;
+ reply.atom = atom;
+ WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
+ return Success;
}
else
- return BadAlloc;
+ return BadAlloc;
}
int
@@ -1087,25 +1066,24 @@ ProcGetAtomName(ClientPtr client)
const char *str;
xGetAtomNameReply reply;
int len;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- if ( (str = NameForAtom(stuff->id)) )
- {
- len = strlen(str);
- memset(&reply, 0, sizeof(xGetAtomNameReply));
- reply.type = X_Reply;
- reply.length = bytes_to_int32(len);
- reply.sequenceNumber = client->sequence;
- reply.nameLength = len;
- WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
- (void)WriteToClient(client, len, str);
- return Success;
+ if ((str = NameForAtom(stuff->id))) {
+ len = strlen(str);
+ memset(&reply, 0, sizeof(xGetAtomNameReply));
+ reply.type = X_Reply;
+ reply.length = bytes_to_int32(len);
+ reply.sequenceNumber = client->sequence;
+ reply.nameLength = len;
+ WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
+ (void) WriteToClient(client, len, str);
+ return Success;
}
- else
- {
- client->errorValue = stuff->id;
- return BadAtom;
+ else {
+ client->errorValue = stuff->id;
+ return BadAtom;
}
}
@@ -1113,27 +1091,27 @@ int
ProcGrabServer(ClientPtr client)
{
int rc;
+
REQUEST_SIZE_MATCH(xReq);
- if (grabState != GrabNone && client != grabClient)
- {
- ResetCurrentRequest(client);
- client->sequence--;
- BITSET(grabWaiters, client->index);
- IgnoreClient(client);
- return Success;
+ if (grabState != GrabNone && client != grabClient) {
+ ResetCurrentRequest(client);
+ client->sequence--;
+ BITSET(grabWaiters, client->index);
+ IgnoreClient(client);
+ return Success;
}
rc = OnlyListenToOneClient(client);
if (rc != Success)
- return rc;
+ return rc;
grabState = GrabKickout;
grabClient = client;
- if (ServerGrabCallback)
- {
- ServerGrabInfoRec grabinfo;
- grabinfo.client = client;
- grabinfo.grabstate = SERVER_GRABBED;
- CallCallbacks(&ServerGrabCallback, (pointer)&grabinfo);
+ if (ServerGrabCallback) {
+ ServerGrabInfoRec grabinfo;
+
+ grabinfo.client = client;
+ grabinfo.grabstate = SERVER_GRABBED;
+ CallCallbacks(&ServerGrabCallback, (pointer) &grabinfo);
}
return Success;
@@ -1146,23 +1124,21 @@ UngrabServer(ClientPtr client)
grabState = GrabNone;
ListenToAllClients();
- for (i = mskcnt; --i >= 0 && !grabWaiters[i]; )
- ;
- if (i >= 0)
- {
- i <<= 5;
- while (!GETBIT(grabWaiters, i))
- i++;
- BITCLEAR(grabWaiters, i);
- AttendClient(clients[i]);
+ for (i = mskcnt; --i >= 0 && !grabWaiters[i];);
+ if (i >= 0) {
+ i <<= 5;
+ while (!GETBIT(grabWaiters, i))
+ i++;
+ BITCLEAR(grabWaiters, i);
+ AttendClient(clients[i]);
}
- if (ServerGrabCallback)
- {
- ServerGrabInfoRec grabinfo;
- grabinfo.client = client;
- grabinfo.grabstate = SERVER_UNGRABBED;
- CallCallbacks(&ServerGrabCallback, (pointer)&grabinfo);
+ if (ServerGrabCallback) {
+ ServerGrabInfoRec grabinfo;
+
+ grabinfo.client = client;
+ grabinfo.grabstate = SERVER_UNGRABBED;
+ CallCallbacks(&ServerGrabCallback, (pointer) &grabinfo);
}
}
@@ -1194,53 +1170,51 @@ ProcTranslateCoords(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if (!SAME_SCREENS(pWin->drawable, pDst->drawable))
- {
- rep.sameScreen = xFalse;
+ if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) {
+ rep.sameScreen = xFalse;
rep.child = None;
- rep.dstX = rep.dstY = 0;
+ rep.dstX = rep.dstY = 0;
}
- else
- {
- INT16 x, y;
- rep.sameScreen = xTrue;
- rep.child = None;
- /* computing absolute coordinates -- adjust to destination later */
- x = pWin->drawable.x + stuff->srcX;
- y = pWin->drawable.y + stuff->srcY;
- pWin = pDst->firstChild;
- while (pWin)
- {
- BoxRec box;
- 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))
- /* When a window is shaped, a further check
- * is made to see if the point is inside
- * borderSize
- */
- && (!wBoundingShape(pWin) ||
- RegionContainsPoint(&pWin->borderSize, x, y, &box))
-
- && (!wInputShape(pWin) ||
- RegionContainsPoint(wInputShape(pWin),
- x - pWin->drawable.x,
- y - pWin->drawable.y, &box))
- )
- {
- rep.child = pWin->drawable.id;
- pWin = (WindowPtr) NULL;
- }
- else
- pWin = pWin->nextSib;
- }
- /* adjust to destination coordinates */
- rep.dstX = x - pDst->drawable.x;
- rep.dstY = y - pDst->drawable.y;
+ else {
+ INT16 x, y;
+
+ rep.sameScreen = xTrue;
+ rep.child = None;
+ /* computing absolute coordinates -- adjust to destination later */
+ x = pWin->drawable.x + stuff->srcX;
+ y = pWin->drawable.y + stuff->srcY;
+ pWin = pDst->firstChild;
+ while (pWin) {
+ BoxRec box;
+
+ 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))
+ /* When a window is shaped, a further check
+ * is made to see if the point is inside
+ * borderSize
+ */
+ && (!wBoundingShape(pWin) ||
+ RegionContainsPoint(&pWin->borderSize, x, y, &box))
+
+ && (!wInputShape(pWin) ||
+ RegionContainsPoint(wInputShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box))
+ ) {
+ rep.child = pWin->drawable.id;
+ pWin = (WindowPtr) NULL;
+ }
+ else
+ pWin = pWin->nextSib;
+ }
+ /* adjust to destination coordinates */
+ rep.dstX = x - pDst->drawable.x;
+ rep.dstY = y - pDst->drawable.y;
}
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
return Success;
@@ -1249,20 +1223,20 @@ ProcTranslateCoords(ClientPtr client)
int
ProcOpenFont(ClientPtr client)
{
- int err;
+ int err;
+
REQUEST(xOpenFontReq);
REQUEST_FIXED_SIZE(xOpenFontReq, stuff->nbytes);
client->errorValue = stuff->fid;
LEGAL_NEW_RESOURCE(stuff->fid, client);
err = OpenFont(client, stuff->fid, (Mask) 0,
- stuff->nbytes, (char *)&stuff[1]);
- if (err == Success)
- {
- return Success;
+ stuff->nbytes, (char *) &stuff[1]);
+ if (err == Success) {
+ return Success;
}
else
- return err;
+ return err;
}
int
@@ -1270,19 +1244,18 @@ ProcCloseFont(ClientPtr client)
{
FontPtr pFont;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT,
- client, DixDestroyAccess);
- if (rc == Success)
- {
+ rc = dixLookupResourceByType((pointer *) &pFont, stuff->id, RT_FONT,
+ client, DixDestroyAccess);
+ if (rc == Success) {
FreeResource(stuff->id, RT_NONE);
- return Success;
+ return Success;
}
- else
- {
- client->errorValue = stuff->id;
+ else {
+ client->errorValue = stuff->id;
return rc;
}
}
@@ -1290,47 +1263,46 @@ ProcCloseFont(ClientPtr client)
int
ProcQueryFont(ClientPtr client)
{
- xQueryFontReply *reply;
+ xQueryFontReply *reply;
FontPtr pFont;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
{
- xCharInfo *pmax = FONTINKMAX(pFont);
- xCharInfo *pmin = FONTINKMIN(pFont);
- int nprotoxcistructs;
- int rlength;
-
- nprotoxcistructs = (
- pmax->rightSideBearing == pmin->rightSideBearing &&
- pmax->leftSideBearing == pmin->leftSideBearing &&
- pmax->descent == pmin->descent &&
- pmax->ascent == pmin->ascent &&
- pmax->characterWidth == pmin->characterWidth) ?
- 0 : N2dChars(pFont);
-
- rlength = sizeof(xQueryFontReply) +
- FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
- nprotoxcistructs * sizeof(xCharInfo);
- reply = calloc(1, rlength);
- if(!reply)
- {
- return BadAlloc;
- }
-
- reply->type = X_Reply;
- reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
- reply->sequenceNumber = client->sequence;
- QueryFont( pFont, reply, nprotoxcistructs);
+ xCharInfo *pmax = FONTINKMAX(pFont);
+ xCharInfo *pmin = FONTINKMIN(pFont);
+ int nprotoxcistructs;
+ int rlength;
+
+ nprotoxcistructs = (pmax->rightSideBearing == pmin->rightSideBearing &&
+ pmax->leftSideBearing == pmin->leftSideBearing &&
+ pmax->descent == pmin->descent &&
+ pmax->ascent == pmin->ascent &&
+ pmax->characterWidth == pmin->characterWidth) ?
+ 0 : N2dChars(pFont);
+
+ rlength = sizeof(xQueryFontReply) +
+ FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
+ nprotoxcistructs * sizeof(xCharInfo);
+ reply = calloc(1, rlength);
+ if (!reply) {
+ return BadAlloc;
+ }
+
+ reply->type = X_Reply;
+ reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
+ reply->sequenceNumber = client->sequence;
+ QueryFont(pFont, reply, nprotoxcistructs);
WriteReplyToClient(client, rlength, reply);
- free(reply);
- return Success;
+ free(reply);
+ return Success;
}
}
@@ -1342,23 +1314,23 @@ ProcQueryTextExtents(ClientPtr client)
ExtentInfoRec info;
unsigned long length;
int rc;
+
REQUEST(xQueryTextExtentsReq);
REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
-
+
rc = dixLookupFontable(&pFont, stuff->fid, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
length = client->req_len - bytes_to_int32(sizeof(xQueryTextExtentsReq));
length = length << 1;
- if (stuff->oddLength)
- {
- if (length == 0)
- return BadLength;
+ if (stuff->oddLength) {
+ if (length == 0)
+ return BadLength;
length--;
}
- if (!QueryTextExtents(pFont, length, (unsigned char *)&stuff[1], &info))
- return BadAlloc;
+ if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info))
+ return BadAlloc;
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
@@ -1381,8 +1353,8 @@ ProcListFonts(ClientPtr client)
REQUEST_FIXED_SIZE(xListFontsReq, stuff->nbytes);
- return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes,
- stuff->maxNames);
+ return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes,
+ stuff->maxNames);
}
int
@@ -1393,7 +1365,7 @@ ProcListFontsWithInfo(ClientPtr client)
REQUEST_FIXED_SIZE(xListFontsWithInfoReq, stuff->nbytes);
return StartListFontsWithInfo(client, stuff->nbytes,
- (unsigned char *) &stuff[1], stuff->maxNames);
+ (unsigned char *) &stuff[1], stuff->maxNames);
}
/**
@@ -1403,8 +1375,9 @@ ProcListFontsWithInfo(ClientPtr client)
int
dixDestroyPixmap(pointer value, XID pid)
{
- PixmapPtr pPixmap = (PixmapPtr)value;
- return (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+ PixmapPtr pPixmap = (PixmapPtr) value;
+
+ return (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
}
int
@@ -1412,6 +1385,7 @@ ProcCreatePixmap(ClientPtr client)
{
PixmapPtr pMap;
DrawablePtr pDraw;
+
REQUEST(xCreatePixmapReq);
DepthPtr pDepth;
int i, rc;
@@ -1419,60 +1393,55 @@ ProcCreatePixmap(ClientPtr client)
REQUEST_SIZE_MATCH(xCreatePixmapReq);
client->errorValue = stuff->pid;
LEGAL_NEW_RESOURCE(stuff->pid, client);
-
+
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
- if (!stuff->width || !stuff->height)
- {
- client->errorValue = 0;
+ if (!stuff->width || !stuff->height) {
+ client->errorValue = 0;
return BadValue;
}
- if (stuff->width > 32767 || stuff->height > 32767)
- {
- /* It is allowed to try and allocate a pixmap which is larger than
- * 32767 in either dimension. However, all of the framebuffer code
- * is buggy and does not reliably draw to such big pixmaps, basically
- * because the Region data structure operates with signed shorts
- * for the rectangles in it.
- *
- * Furthermore, several places in the X server computes the
- * size in bytes of the pixmap and tries to store it in an
- * integer. This integer can overflow and cause the allocated size
- * to be much smaller.
- *
- * So, such big pixmaps are rejected here with a BadAlloc
- */
- return BadAlloc;
- }
- if (stuff->depth != 1)
- {
+ if (stuff->width > 32767 || stuff->height > 32767) {
+ /* It is allowed to try and allocate a pixmap which is larger than
+ * 32767 in either dimension. However, all of the framebuffer code
+ * is buggy and does not reliably draw to such big pixmaps, basically
+ * because the Region data structure operates with signed shorts
+ * for the rectangles in it.
+ *
+ * Furthermore, several places in the X server computes the
+ * size in bytes of the pixmap and tries to store it in an
+ * integer. This integer can overflow and cause the allocated size
+ * to be much smaller.
+ *
+ * So, such big pixmaps are rejected here with a BadAlloc
+ */
+ return BadAlloc;
+ }
+ 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;
+ for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
+ if (pDepth->depth == stuff->depth)
+ goto CreatePmap;
+ client->errorValue = stuff->depth;
return BadValue;
}
-CreatePmap:
- pMap = (PixmapPtr)(*pDraw->pScreen->CreatePixmap)
- (pDraw->pScreen, stuff->width,
- stuff->height, stuff->depth, 0);
- if (pMap)
- {
- pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pMap->drawable.id = stuff->pid;
- /* security creation/labeling check */
- rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
- pMap, RT_NONE, NULL, DixCreateAccess);
- if (rc != Success) {
- (*pDraw->pScreen->DestroyPixmap)(pMap);
- return rc;
- }
- if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
- return Success;
+ CreatePmap:
+ pMap = (PixmapPtr) (*pDraw->pScreen->CreatePixmap)
+ (pDraw->pScreen, stuff->width, stuff->height, stuff->depth, 0);
+ if (pMap) {
+ pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pMap->drawable.id = stuff->pid;
+ /* security creation/labeling check */
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
+ pMap, RT_NONE, NULL, DixCreateAccess);
+ if (rc != Success) {
+ (*pDraw->pScreen->DestroyPixmap) (pMap);
+ return rc;
+ }
+ if (AddResource(stuff->pid, RT_PIXMAP, (pointer) pMap))
+ return Success;
}
return BadAlloc;
}
@@ -1482,20 +1451,19 @@ ProcFreePixmap(ClientPtr client)
{
PixmapPtr pMap;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResourceByType((pointer *)&pMap, stuff->id, RT_PIXMAP, client,
- DixDestroyAccess);
- if (rc == Success)
- {
- FreeResource(stuff->id, RT_NONE);
- return Success;
+ rc = dixLookupResourceByType((pointer *) &pMap, stuff->id, RT_PIXMAP,
+ client, DixDestroyAccess);
+ if (rc == Success) {
+ FreeResource(stuff->id, RT_NONE);
+ return Success;
}
- else
- {
- client->errorValue = stuff->id;
- return rc;
+ else {
+ client->errorValue = stuff->id;
+ return rc;
}
}
@@ -1506,25 +1474,26 @@ ProcCreateGC(ClientPtr client)
GC *pGC;
DrawablePtr pDraw;
unsigned len;
+
REQUEST(xCreateGCReq);
REQUEST_AT_LEAST_SIZE(xCreateGCReq);
client->errorValue = stuff->gc;
LEGAL_NEW_RESOURCE(stuff->gc, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
- len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq));
+ len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq));
if (len != Ones(stuff->mask))
return BadLength;
- pGC = (GC *)CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error,
- stuff->gc, client);
+ pGC = (GC *) CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error,
+ stuff->gc, client);
if (error != Success)
return error;
- if (!AddResource(stuff->gc, RT_GC, (pointer)pGC))
- return BadAlloc;
+ if (!AddResource(stuff->gc, RT_GC, (pointer) pGC))
+ return BadAlloc;
return Success;
}
@@ -1534,14 +1503,15 @@ ProcChangeGC(ClientPtr client)
GC *pGC;
int result;
unsigned len;
+
REQUEST(xChangeGCReq);
REQUEST_AT_LEAST_SIZE(xChangeGCReq);
result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
if (result != Success)
- return result;
+ return result;
- len = client->req_len - bytes_to_int32(sizeof(xChangeGCReq));
+ len = client->req_len - bytes_to_int32(sizeof(xChangeGCReq));
if (len != Ones(stuff->mask))
return BadLength;
@@ -1554,21 +1524,21 @@ ProcCopyGC(ClientPtr client)
GC *dstGC;
GC *pGC;
int result;
+
REQUEST(xCopyGCReq);
REQUEST_SIZE_MATCH(xCopyGCReq);
result = dixLookupGC(&pGC, stuff->srcGC, client, DixGetAttrAccess);
if (result != Success)
- return result;
+ return result;
result = dixLookupGC(&dstGC, stuff->dstGC, client, DixSetAttrAccess);
if (result != Success)
- return result;
+ return result;
if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
return BadMatch;
- if (stuff->mask & ~GCAllBits)
- {
- client->errorValue = stuff->mask;
- return BadValue;
+ if (stuff->mask & ~GCAllBits) {
+ client->errorValue = stuff->mask;
+ return BadValue;
}
return CopyGC(pGC, dstGC, stuff->mask);
}
@@ -1578,50 +1548,50 @@ ProcSetDashes(ClientPtr client)
{
GC *pGC;
int result;
+
REQUEST(xSetDashesReq);
REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
- if (stuff->nDashes == 0)
- {
- client->errorValue = 0;
- return BadValue;
+ if (stuff->nDashes == 0) {
+ client->errorValue = 0;
+ return BadValue;
}
- result = dixLookupGC(&pGC,stuff->gc, client, DixSetAttrAccess);
+ result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
if (result != Success)
- return result;
+ return result;
/* If there's an error, either there's no sensible errorValue,
* or there was a dash segment of 0. */
client->errorValue = 0;
return SetDashes(pGC, stuff->dashOffset, stuff->nDashes,
- (unsigned char *)&stuff[1]);
+ (unsigned char *) &stuff[1]);
}
int
ProcSetClipRectangles(ClientPtr client)
{
- int nr, result;
+ int nr, result;
GC *pGC;
+
REQUEST(xSetClipRectanglesReq);
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
- (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded))
- {
- client->errorValue = stuff->ordering;
+ (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) {
+ client->errorValue = stuff->ordering;
return BadValue;
}
- result = dixLookupGC(&pGC,stuff->gc, client, DixSetAttrAccess);
+ result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
if (result != Success)
- return result;
-
+ return result;
+
nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq);
if (nr & 4)
- return BadLength;
+ return BadLength;
nr >>= 3;
return SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin,
- nr, (xRectangle *)&stuff[1], (int)stuff->ordering);
+ nr, (xRectangle *) &stuff[1], (int) stuff->ordering);
}
int
@@ -1629,12 +1599,13 @@ ProcFreeGC(ClientPtr client)
{
GC *pGC;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupGC(&pGC, stuff->id, client, DixDestroyAccess);
if (rc != Success)
- return rc;
+ return rc;
FreeResource(stuff->id, RT_NONE);
return Success;
@@ -1651,19 +1622,17 @@ ProcClearToBackground(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (rc != Success)
return rc;
- if (pWin->drawable.class == InputOnly)
- {
- client->errorValue = stuff->window;
- return BadMatch;
- }
- if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse))
- {
- client->errorValue = stuff->exposures;
+ if (pWin->drawable.class == InputOnly) {
+ client->errorValue = stuff->window;
+ return BadMatch;
+ }
+ if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse)) {
+ client->errorValue = stuff->exposures;
return BadValue;
}
- (*pWin->drawable.pScreen->ClearToBackground)(pWin, stuff->x, stuff->y,
- stuff->width, stuff->height,
- (Bool)stuff->exposures);
+ (*pWin->drawable.pScreen->ClearToBackground) (pWin, stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ (Bool) stuff->exposures);
return Success;
}
@@ -1673,37 +1642,35 @@ ProcCopyArea(ClientPtr client)
DrawablePtr pDst;
DrawablePtr pSrc;
GC *pGC;
+
REQUEST(xCopyAreaReq);
RegionPtr pRgn;
int rc;
REQUEST_SIZE_MATCH(xCopyAreaReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
- if (stuff->dstDrawable != stuff->srcDrawable)
- {
- rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
- DixReadAccess);
- if (rc != Success)
- return rc;
- if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth))
- {
- client->errorValue = stuff->dstDrawable;
- return BadMatch;
- }
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
+ if (stuff->dstDrawable != stuff->srcDrawable) {
+ rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+ if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) {
+ client->errorValue = stuff->dstDrawable;
+ return BadMatch;
+ }
}
else
pSrc = pDst;
- pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY,
- stuff->width, stuff->height,
- stuff->dstX, stuff->dstY);
- if (pGC->graphicsExposures)
- {
- (*pDst->pScreen->SendGraphicsExpose)
- (client, pRgn, stuff->dstDrawable, X_CopyArea, 0);
- if (pRgn)
- RegionDestroy(pRgn);
+ pRgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, stuff->srcX, stuff->srcY,
+ stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY);
+ if (pGC->graphicsExposures) {
+ (*pDst->pScreen->SendGraphicsExpose)
+ (client, pRgn, stuff->dstDrawable, X_CopyArea, 0);
+ if (pRgn)
+ RegionDestroy(pRgn);
}
return Success;
@@ -1714,6 +1681,7 @@ ProcCopyPlane(ClientPtr client)
{
DrawablePtr psrcDraw, pdstDraw;
GC *pGC;
+
REQUEST(xCopyPlaneReq);
RegionPtr pRgn;
int rc;
@@ -1721,39 +1689,36 @@ ProcCopyPlane(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyPlaneReq);
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
- if (stuff->dstDrawable != stuff->srcDrawable)
- {
- rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
- DixReadAccess);
- if (rc != Success)
- return rc;
-
- if (pdstDraw->pScreen != psrcDraw->pScreen)
- {
- client->errorValue = stuff->dstDrawable;
- return BadMatch;
- }
+ if (stuff->dstDrawable != stuff->srcDrawable) {
+ rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ if (pdstDraw->pScreen != psrcDraw->pScreen) {
+ client->errorValue = stuff->dstDrawable;
+ return BadMatch;
+ }
}
else
psrcDraw = pdstDraw;
/* Check to see if stuff->bitPlane has exactly ONE good bit set */
- if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
- (stuff->bitPlane > (1L << (psrcDraw->depth - 1))))
- {
- client->errorValue = stuff->bitPlane;
- return BadValue;
+ if (stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
+ (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) {
+ client->errorValue = stuff->bitPlane;
+ return BadValue;
}
- pRgn = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC, stuff->srcX, stuff->srcY,
- stuff->width, stuff->height,
- stuff->dstX, stuff->dstY, stuff->bitPlane);
- if (pGC->graphicsExposures)
- {
- (*pdstDraw->pScreen->SendGraphicsExpose)
- (client, pRgn, stuff->dstDrawable, X_CopyPlane, 0);
- if (pRgn)
- RegionDestroy(pRgn);
+ pRgn =
+ (*pGC->ops->CopyPlane) (psrcDraw, pdstDraw, pGC, stuff->srcX,
+ stuff->srcY, stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY, stuff->bitPlane);
+ if (pGC->graphicsExposures) {
+ (*pdstDraw->pScreen->SendGraphicsExpose)
+ (client, pRgn, stuff->dstDrawable, X_CopyPlane, 0);
+ if (pRgn)
+ RegionDestroy(pRgn);
}
return Success;
}
@@ -1764,20 +1729,20 @@ ProcPolyPoint(ClientPtr client)
int npoint;
GC *pGC;
DrawablePtr pDraw;
+
REQUEST(xPolyPointReq);
REQUEST_AT_LEAST_SIZE(xPolyPointReq);
- if ((stuff->coordMode != CoordModeOrigin) &&
- (stuff->coordMode != CoordModePrevious))
- {
- client->errorValue = stuff->coordMode;
+ if ((stuff->coordMode != CoordModeOrigin) &&
+ (stuff->coordMode != CoordModePrevious)) {
+ client->errorValue = stuff->coordMode;
return BadValue;
}
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
if (npoint)
- (*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint,
- (xPoint *) &stuff[1]);
+ (*pGC->ops->PolyPoint) (pDraw, pGC, stuff->coordMode, npoint,
+ (xPoint *) &stuff[1]);
return Success;
}
@@ -1787,20 +1752,20 @@ ProcPolyLine(ClientPtr client)
int npoint;
GC *pGC;
DrawablePtr pDraw;
+
REQUEST(xPolyLineReq);
REQUEST_AT_LEAST_SIZE(xPolyLineReq);
- if ((stuff->coordMode != CoordModeOrigin) &&
- (stuff->coordMode != CoordModePrevious))
- {
- client->errorValue = stuff->coordMode;
+ if ((stuff->coordMode != CoordModeOrigin) &&
+ (stuff->coordMode != CoordModePrevious)) {
+ client->errorValue = stuff->coordMode;
return BadValue;
}
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
if (npoint > 1)
- (*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint,
- (DDXPointPtr) &stuff[1]);
+ (*pGC->ops->Polylines) (pDraw, pGC, stuff->coordMode, npoint,
+ (DDXPointPtr) &stuff[1]);
return Success;
}
@@ -1810,77 +1775,79 @@ ProcPolySegment(ClientPtr client)
int nsegs;
GC *pGC;
DrawablePtr pDraw;
+
REQUEST(xPolySegmentReq);
REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
if (nsegs & 4)
- return BadLength;
+ return BadLength;
nsegs >>= 3;
if (nsegs)
- (*pGC->ops->PolySegment)(pDraw, pGC, nsegs, (xSegment *) &stuff[1]);
+ (*pGC->ops->PolySegment) (pDraw, pGC, nsegs, (xSegment *) &stuff[1]);
return Success;
}
int
-ProcPolyRectangle (ClientPtr client)
+ProcPolyRectangle(ClientPtr client)
{
int nrects;
GC *pGC;
DrawablePtr pDraw;
+
REQUEST(xPolyRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
if (nrects & 4)
- return BadLength;
+ return BadLength;
nrects >>= 3;
if (nrects)
- (*pGC->ops->PolyRectangle)(pDraw, pGC,
- nrects, (xRectangle *) &stuff[1]);
+ (*pGC->ops->PolyRectangle) (pDraw, pGC,
+ nrects, (xRectangle *) &stuff[1]);
return Success;
}
int
ProcPolyArc(ClientPtr client)
{
- int narcs;
+ int narcs;
GC *pGC;
DrawablePtr pDraw;
+
REQUEST(xPolyArcReq);
REQUEST_AT_LEAST_SIZE(xPolyArcReq);
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
if (narcs % sizeof(xArc))
- return BadLength;
+ return BadLength;
narcs /= sizeof(xArc);
if (narcs)
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, (xArc *) &stuff[1]);
+ (*pGC->ops->PolyArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
return Success;
}
int
ProcFillPoly(ClientPtr client)
{
- int things;
+ int things;
GC *pGC;
DrawablePtr pDraw;
+
REQUEST(xFillPolyReq);
REQUEST_AT_LEAST_SIZE(xFillPolyReq);
- if ((stuff->shape != Complex) && (stuff->shape != Nonconvex) &&
- (stuff->shape != Convex))
- {
- client->errorValue = stuff->shape;
+ if ((stuff->shape != Complex) && (stuff->shape != Nonconvex) &&
+ (stuff->shape != Convex)) {
+ client->errorValue = stuff->shape;
return BadValue;
}
- if ((stuff->coordMode != CoordModeOrigin) &&
- (stuff->coordMode != CoordModePrevious))
- {
- client->errorValue = stuff->coordMode;
+ if ((stuff->coordMode != CoordModeOrigin) &&
+ (stuff->coordMode != CoordModePrevious)) {
+ client->errorValue = stuff->coordMode;
return BadValue;
}
@@ -1888,45 +1855,47 @@ ProcFillPoly(ClientPtr client)
things = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
if (things)
(*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape,
- stuff->coordMode, things,
- (DDXPointPtr) &stuff[1]);
+ stuff->coordMode, things,
+ (DDXPointPtr) &stuff[1]);
return Success;
}
int
ProcPolyFillRectangle(ClientPtr client)
{
- int things;
+ int things;
GC *pGC;
DrawablePtr pDraw;
+
REQUEST(xPolyFillRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
if (things & 4)
- return BadLength;
+ return BadLength;
things >>= 3;
if (things)
(*pGC->ops->PolyFillRect) (pDraw, pGC, things,
- (xRectangle *) &stuff[1]);
+ (xRectangle *) &stuff[1]);
return Success;
}
int
ProcPolyFillArc(ClientPtr client)
{
- int narcs;
+ int narcs;
GC *pGC;
DrawablePtr pDraw;
+
REQUEST(xPolyFillArcReq);
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
if (narcs % sizeof(xArc))
- return BadLength;
+ return BadLength;
narcs /= sizeof(xArc);
if (narcs)
(*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
@@ -1936,40 +1905,40 @@ ProcPolyFillArc(ClientPtr client)
#ifdef MATCH_CLIENT_ENDIAN
int
-ServerOrder (void)
+ServerOrder(void)
{
- int whichbyte = 1;
+ int whichbyte = 1;
if (*((char *) &whichbyte))
- return LSBFirst;
+ return LSBFirst;
return MSBFirst;
}
#define ClientOrder(client) ((client)->swapped ? !ServerOrder() : ServerOrder())
void
-ReformatImage (char *base, int nbytes, int bpp, int order)
+ReformatImage(char *base, int nbytes, int bpp, int order)
{
switch (bpp) {
- case 1: /* yuck */
- if (BITMAP_BIT_ORDER != order)
- BitOrderInvert ((unsigned char *) base, nbytes);
+ case 1: /* yuck */
+ if (BITMAP_BIT_ORDER != order)
+ BitOrderInvert((unsigned char *) base, nbytes);
#if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8
- ReformatImage (base, nbytes, BITMAP_SCANLINE_UNIT, order);
+ ReformatImage(base, nbytes, BITMAP_SCANLINE_UNIT, order);
#endif
- break;
+ break;
case 4:
- break; /* yuck */
+ break; /* yuck */
case 8:
- break;
+ break;
case 16:
- if (IMAGE_BYTE_ORDER != order)
- TwoByteSwap ((unsigned char *) base, nbytes);
- break;
+ if (IMAGE_BYTE_ORDER != order)
+ TwoByteSwap((unsigned char *) base, nbytes);
+ break;
case 32:
- if (IMAGE_BYTE_ORDER != order)
- FourByteSwap ((unsigned char *) base, nbytes);
- break;
+ if (IMAGE_BYTE_ORDER != order)
+ FourByteSwap((unsigned char *) base, nbytes);
+ break;
}
}
#else
@@ -1992,128 +1961,122 @@ ProcPutImage(ClientPtr client)
{
GC *pGC;
DrawablePtr pDraw;
- long length; /* length of scanline server padded */
- long lengthProto; /* length of scanline protocol padded */
- char *tmpImage;
+ long length; /* length of scanline server padded */
+ long lengthProto; /* length of scanline protocol padded */
+ char *tmpImage;
+
REQUEST(xPutImageReq);
REQUEST_AT_LEAST_SIZE(xPutImageReq);
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
- if (stuff->format == XYBitmap)
- {
+ if (stuff->format == XYBitmap) {
if ((stuff->depth != 1) ||
- (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))
+ (stuff->leftPad >= (unsigned int) screenInfo.bitmapScanlinePad))
return BadMatch;
- length = BitmapBytePad(stuff->width + stuff->leftPad);
+ length = BitmapBytePad(stuff->width + stuff->leftPad);
}
- else if (stuff->format == XYPixmap)
- {
- if ((pDraw->depth != stuff->depth) ||
- (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))
+ else if (stuff->format == XYPixmap) {
+ if ((pDraw->depth != stuff->depth) ||
+ (stuff->leftPad >= (unsigned int) screenInfo.bitmapScanlinePad))
return BadMatch;
- length = BitmapBytePad(stuff->width + stuff->leftPad);
- length *= stuff->depth;
+ length = BitmapBytePad(stuff->width + stuff->leftPad);
+ length *= stuff->depth;
}
- else if (stuff->format == ZPixmap)
- {
+ else if (stuff->format == ZPixmap) {
if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0))
return BadMatch;
- length = PixmapBytePad(stuff->width, stuff->depth);
+ length = PixmapBytePad(stuff->width, stuff->depth);
}
- else
- {
- client->errorValue = stuff->format;
+ else {
+ client->errorValue = stuff->format;
return BadValue;
}
- tmpImage = (char *)&stuff[1];
+ tmpImage = (char *) &stuff[1];
lengthProto = length;
-
+
if ((bytes_to_int32(lengthProto * stuff->height) +
- bytes_to_int32(sizeof(xPutImageReq))) != client->req_len)
- return BadLength;
+ bytes_to_int32(sizeof(xPutImageReq))) != client->req_len)
+ return BadLength;
+
+ ReformatImage(tmpImage, lengthProto * stuff->height,
+ stuff->format == ZPixmap ? BitsPerPixel(stuff->depth) : 1,
+ ClientOrder(client));
- ReformatImage (tmpImage, lengthProto * stuff->height,
- stuff->format == ZPixmap ? BitsPerPixel (stuff->depth) : 1,
- ClientOrder(client));
-
(*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY,
- stuff->width, stuff->height,
- stuff->leftPad, stuff->format, tmpImage);
+ stuff->width, stuff->height,
+ stuff->leftPad, stuff->format, tmpImage);
- return Success;
+ return Success;
}
static int
-DoGetImage(ClientPtr client, int format, Drawable drawable,
- int x, int y, int width, int height,
- Mask planemask, xGetImageReply **im_return)
+DoGetImage(ClientPtr client, int format, Drawable drawable,
+ int x, int y, int width, int height,
+ Mask planemask, xGetImageReply ** im_return)
{
- DrawablePtr pDraw, pBoundingDraw;
- int nlines, linesPerBuf, rc;
- int linesDone;
+ DrawablePtr pDraw, pBoundingDraw;
+ int nlines, linesPerBuf, rc;
+ int linesDone;
+
/* coordinates relative to the bounding drawable */
- int relx, rely;
- long widthBytesLine, length;
- Mask plane = 0;
- char *pBuf;
- xGetImageReply xgi;
+ int relx, rely;
+ long widthBytesLine, length;
+ Mask plane = 0;
+ char *pBuf;
+ xGetImageReply xgi;
RegionPtr pVisibleRegion = NULL;
- if ((format != XYPixmap) && (format != ZPixmap))
- {
- client->errorValue = format;
+ if ((format != XYPixmap) && (format != ZPixmap)) {
+ client->errorValue = format;
return BadValue;
}
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
memset(&xgi, 0, sizeof(xGetImageReply));
relx = x;
rely = y;
- if(pDraw->type == DRAWABLE_WINDOW)
- {
- WindowPtr pWin = (WindowPtr)pDraw;
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDraw;
- /* "If the drawable is a window, the window must be viewable ... or a
- * BadMatch error results" */
- if (!pWin->viewable)
- return BadMatch;
+ /* "If the drawable is a window, the window must be viewable ... or a
+ * BadMatch error results" */
+ if (!pWin->viewable)
+ return BadMatch;
- /* If the drawable is a window, the rectangle must be contained within
- * its bounds (including the border). */
- if (x < -wBorderWidth(pWin) ||
- x + width > wBorderWidth(pWin) + (int)pDraw->width ||
- y < -wBorderWidth(pWin) ||
- y + height > wBorderWidth(pWin) + (int)pDraw->height)
- return BadMatch;
+ /* If the drawable is a window, the rectangle must be contained within
+ * its bounds (including the border). */
+ if (x < -wBorderWidth(pWin) ||
+ x + width > wBorderWidth(pWin) + (int) pDraw->width ||
+ y < -wBorderWidth(pWin) ||
+ y + height > wBorderWidth(pWin) + (int) pDraw->height)
+ return BadMatch;
- relx += pDraw->x;
- rely += pDraw->y;
+ relx += pDraw->x;
+ rely += pDraw->y;
- if (pDraw->pScreen->GetWindowPixmap) {
- PixmapPtr pPix = (*pDraw->pScreen->GetWindowPixmap) (pWin);
+ if (pDraw->pScreen->GetWindowPixmap) {
+ PixmapPtr pPix = (*pDraw->pScreen->GetWindowPixmap) (pWin);
- pBoundingDraw = &pPix->drawable;
+ pBoundingDraw = &pPix->drawable;
#ifdef COMPOSITE
- relx -= pPix->screen_x;
- rely -= pPix->screen_y;
+ relx -= pPix->screen_x;
+ rely -= pPix->screen_y;
#endif
- }
- else
- {
- pBoundingDraw = (DrawablePtr)pDraw->pScreen->root;
- }
+ }
+ else {
+ pBoundingDraw = (DrawablePtr) pDraw->pScreen->root;
+ }
- xgi.visual = wVisual (pWin);
+ xgi.visual = wVisual(pWin);
}
- else
- {
- pBoundingDraw = pDraw;
- xgi.visual = None;
+ else {
+ pBoundingDraw = pDraw;
+ xgi.visual = None;
}
/* "If the drawable is a pixmap, the given rectangle must be wholly
@@ -2127,171 +2090,151 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
* within the bounds of the window's backing pixmap. In particular, this
* means that a GetImage request may succeed or fail with BadMatch depending
* on whether any of its ancestor windows are redirected. */
- if(relx < 0 || relx + width > (int)pBoundingDraw->width ||
- rely < 0 || rely + height > (int)pBoundingDraw->height)
- return BadMatch;
+ if (relx < 0 || relx + width > (int) pBoundingDraw->width ||
+ rely < 0 || rely + height > (int) pBoundingDraw->height)
+ return BadMatch;
xgi.type = X_Reply;
xgi.sequenceNumber = client->sequence;
xgi.depth = pDraw->depth;
- if(format == ZPixmap)
- {
- widthBytesLine = PixmapBytePad(width, pDraw->depth);
- length = widthBytesLine * height;
+ if (format == ZPixmap) {
+ widthBytesLine = PixmapBytePad(width, pDraw->depth);
+ length = widthBytesLine * height;
}
- else
- {
- widthBytesLine = BitmapBytePad(width);
- plane = ((Mask)1) << (pDraw->depth - 1);
- /* only planes asked for */
- length = widthBytesLine * height *
- Ones(planemask & (plane | (plane - 1)));
+ else {
+ widthBytesLine = BitmapBytePad(width);
+ plane = ((Mask) 1) << (pDraw->depth - 1);
+ /* only planes asked for */
+ length = widthBytesLine * height *
+ Ones(planemask & (plane | (plane - 1)));
}
xgi.length = length;
if (im_return) {
- pBuf = calloc(1, sz_xGetImageReply + length);
- if (!pBuf)
- return BadAlloc;
- if (widthBytesLine == 0)
- linesPerBuf = 0;
- else
- linesPerBuf = height;
- *im_return = (xGetImageReply *)pBuf;
- *(xGetImageReply *)pBuf = xgi;
- pBuf += sz_xGetImageReply;
- } else {
- xgi.length = bytes_to_int32(xgi.length);
- if (widthBytesLine == 0 || height == 0)
- linesPerBuf = 0;
- else if (widthBytesLine >= IMAGE_BUFSIZE)
- linesPerBuf = 1;
- else
- {
- linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
- if (linesPerBuf > height)
- linesPerBuf = height;
- }
- length = linesPerBuf * widthBytesLine;
- if (linesPerBuf < height)
- {
- /* we have to make sure intermediate buffers don't need padding */
- while ((linesPerBuf > 1) &&
- (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD)-1)))
- {
- linesPerBuf--;
- length -= widthBytesLine;
- }
- while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD)-1))
- {
- linesPerBuf++;
- length += widthBytesLine;
- }
- }
- if(!(pBuf = calloc(1, length)))
- return BadAlloc;
- WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
- }
-
- if (pDraw->type == DRAWABLE_WINDOW)
- {
- pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw);
- if (pVisibleRegion)
- {
- RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y);
- }
+ pBuf = calloc(1, sz_xGetImageReply + length);
+ if (!pBuf)
+ return BadAlloc;
+ if (widthBytesLine == 0)
+ linesPerBuf = 0;
+ else
+ linesPerBuf = height;
+ *im_return = (xGetImageReply *) pBuf;
+ *(xGetImageReply *) pBuf = xgi;
+ pBuf += sz_xGetImageReply;
+ }
+ else {
+ xgi.length = bytes_to_int32(xgi.length);
+ if (widthBytesLine == 0 || height == 0)
+ linesPerBuf = 0;
+ else if (widthBytesLine >= IMAGE_BUFSIZE)
+ linesPerBuf = 1;
+ else {
+ linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > height)
+ linesPerBuf = height;
+ }
+ length = linesPerBuf * widthBytesLine;
+ if (linesPerBuf < height) {
+ /* we have to make sure intermediate buffers don't need padding */
+ while ((linesPerBuf > 1) &&
+ (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
+ linesPerBuf--;
+ length -= widthBytesLine;
+ }
+ while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
+ linesPerBuf++;
+ length += widthBytesLine;
+ }
+ }
+ if (!(pBuf = calloc(1, length)))
+ return BadAlloc;
+ WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
}
- if (linesPerBuf == 0)
- {
- /* nothing to do */
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ pVisibleRegion = NotClippedByChildren((WindowPtr) pDraw);
+ if (pVisibleRegion) {
+ RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y);
+ }
}
- else if (format == ZPixmap)
- {
+
+ if (linesPerBuf == 0) {
+ /* nothing to do */
+ }
+ else if (format == ZPixmap) {
linesDone = 0;
- while (height - linesDone > 0)
- {
- nlines = min(linesPerBuf, height - linesDone);
- (*pDraw->pScreen->GetImage) (pDraw,
- x,
- y + linesDone,
- width,
- nlines,
- format,
- planemask,
- (pointer) pBuf);
- if (pVisibleRegion)
- XaceCensorImage(client, pVisibleRegion, widthBytesLine,
- pDraw, x, y + linesDone, width,
- nlines, format, pBuf);
-
- /* Note that this is NOT a call to WriteSwappedDataToClient,
+ while (height - linesDone > 0) {
+ nlines = min(linesPerBuf, height - linesDone);
+ (*pDraw->pScreen->GetImage) (pDraw,
+ x,
+ y + linesDone,
+ width,
+ nlines,
+ format, planemask, (pointer) pBuf);
+ if (pVisibleRegion)
+ XaceCensorImage(client, pVisibleRegion, widthBytesLine,
+ pDraw, x, y + linesDone, width,
+ nlines, format, pBuf);
+
+ /* Note that this is NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
- if (!im_return)
- {
- ReformatImage (pBuf, (int)(nlines * widthBytesLine),
- BitsPerPixel (pDraw->depth),
- ClientOrder(client));
+ if (!im_return) {
+ ReformatImage(pBuf, (int) (nlines * widthBytesLine),
+ BitsPerPixel(pDraw->depth), ClientOrder(client));
/* Don't split me, gcc pukes when you do */
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLine),
- pBuf);
- }
- linesDone += nlines;
+ (void) WriteToClient(client,
+ (int) (nlines * widthBytesLine), pBuf);
+ }
+ linesDone += nlines;
}
}
- else /* XYPixmap */
- {
- for (; plane; plane >>= 1)
- {
- if (planemask & plane)
- {
- linesDone = 0;
- while (height - linesDone > 0)
- {
- nlines = min(linesPerBuf, height - linesDone);
- (*pDraw->pScreen->GetImage) (pDraw,
- x,
- y + linesDone,
- width,
- nlines,
- format,
- plane,
- (pointer)pBuf);
- if (pVisibleRegion)
- XaceCensorImage(client, pVisibleRegion,
- widthBytesLine,
- pDraw, x, y + linesDone, width,
- nlines, format, pBuf);
-
- /* Note: NOT a call to WriteSwappedDataToClient,
- as we do NOT byte swap */
- if (im_return) {
- pBuf += nlines * widthBytesLine;
- } else {
- ReformatImage (pBuf,
- (int)(nlines * widthBytesLine),
- 1,
- ClientOrder (client));
+ else { /* XYPixmap */
+
+ for (; plane; plane >>= 1) {
+ if (planemask & plane) {
+ linesDone = 0;
+ while (height - linesDone > 0) {
+ nlines = min(linesPerBuf, height - linesDone);
+ (*pDraw->pScreen->GetImage) (pDraw,
+ x,
+ y + linesDone,
+ width,
+ nlines,
+ format, plane, (pointer) pBuf);
+ if (pVisibleRegion)
+ XaceCensorImage(client, pVisibleRegion,
+ widthBytesLine,
+ pDraw, x, y + linesDone, width,
+ nlines, format, pBuf);
+
+ /* Note: NOT a call to WriteSwappedDataToClient,
+ as we do NOT byte swap */
+ if (im_return) {
+ pBuf += nlines * widthBytesLine;
+ }
+ else {
+ ReformatImage(pBuf,
+ (int) (nlines * widthBytesLine),
+ 1, ClientOrder(client));
/* Don't split me, gcc pukes when you do */
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLine),
- pBuf);
- }
- linesDone += nlines;
- }
+ (void) WriteToClient(client,
+ (int) (nlines * widthBytesLine),
+ pBuf);
+ }
+ linesDone += nlines;
+ }
}
- }
+ }
}
if (pVisibleRegion)
- RegionDestroy(pVisibleRegion);
+ RegionDestroy(pVisibleRegion);
if (!im_return)
- free(pBuf);
+ free(pBuf);
return Success;
}
@@ -2303,15 +2246,16 @@ ProcGetImage(ClientPtr client)
REQUEST_SIZE_MATCH(xGetImageReq);
return DoGetImage(client, stuff->format, stuff->drawable,
- stuff->x, stuff->y,
- (int)stuff->width, (int)stuff->height,
- stuff->planeMask, (xGetImageReply **)NULL);
+ stuff->x, stuff->y,
+ (int) stuff->width, (int) stuff->height,
+ stuff->planeMask, (xGetImageReply **) NULL);
}
int
ProcPolyText(ClientPtr client)
{
- int err;
+ int err;
+
REQUEST(xPolyTextReq);
DrawablePtr pDraw;
GC *pGC;
@@ -2320,27 +2264,23 @@ ProcPolyText(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
err = PolyText(client,
- pDraw,
- pGC,
- (unsigned char *)&stuff[1],
- ((unsigned char *) stuff) + (client->req_len << 2),
- stuff->x,
- stuff->y,
- stuff->reqType,
- stuff->drawable);
-
- if (err == Success)
- {
- return Success;
+ pDraw,
+ pGC,
+ (unsigned char *) &stuff[1],
+ ((unsigned char *) stuff) + (client->req_len << 2),
+ stuff->x, stuff->y, stuff->reqType, stuff->drawable);
+
+ if (err == Success) {
+ return Success;
}
else
- return err;
+ return err;
}
int
ProcImageText8(ClientPtr client)
{
- int err;
+ int err;
DrawablePtr pDraw;
GC *pGC;
@@ -2350,27 +2290,23 @@ ProcImageText8(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
err = ImageText(client,
- pDraw,
- pGC,
- stuff->nChars,
- (unsigned char *)&stuff[1],
- stuff->x,
- stuff->y,
- stuff->reqType,
- stuff->drawable);
-
- if (err == Success)
- {
- return Success;
+ pDraw,
+ pGC,
+ stuff->nChars,
+ (unsigned char *) &stuff[1],
+ stuff->x, stuff->y, stuff->reqType, stuff->drawable);
+
+ if (err == Success) {
+ return Success;
}
else
- return err;
+ return err;
}
int
ProcImageText16(ClientPtr client)
{
- int err;
+ int err;
DrawablePtr pDraw;
GC *pGC;
@@ -2380,40 +2316,35 @@ ProcImageText16(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
err = ImageText(client,
- pDraw,
- pGC,
- stuff->nChars,
- (unsigned char *)&stuff[1],
- stuff->x,
- stuff->y,
- stuff->reqType,
- stuff->drawable);
-
- if (err == Success)
- {
- return Success;
+ pDraw,
+ pGC,
+ stuff->nChars,
+ (unsigned char *) &stuff[1],
+ stuff->x, stuff->y, stuff->reqType, stuff->drawable);
+
+ if (err == Success) {
+ return Success;
}
else
- return err;
+ return err;
}
-
int
ProcCreateColormap(ClientPtr client)
{
- VisualPtr pVisual;
- ColormapPtr pmap;
- Colormap mid;
- WindowPtr pWin;
+ VisualPtr pVisual;
+ ColormapPtr pmap;
+ Colormap mid;
+ WindowPtr pWin;
ScreenPtr pScreen;
+
REQUEST(xCreateColormapReq);
int i, result;
REQUEST_SIZE_MATCH(xCreateColormapReq);
- if ((stuff->alloc != AllocNone) && (stuff->alloc != AllocAll))
- {
- client->errorValue = stuff->alloc;
+ if ((stuff->alloc != AllocNone) && (stuff->alloc != AllocAll)) {
+ client->errorValue = stuff->alloc;
return BadValue;
}
mid = stuff->mid;
@@ -2424,13 +2355,11 @@ ProcCreateColormap(ClientPtr client)
pScreen = pWin->drawable.pScreen;
for (i = 0, pVisual = pScreen->visuals;
- i < pScreen->numVisuals;
- i++, pVisual++)
- {
- if (pVisual->vid != stuff->visual)
- continue;
- return CreateColormap(mid, pScreen, pVisual, &pmap,
- (int)stuff->alloc, client->index);
+ i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid != stuff->visual)
+ continue;
+ return CreateColormap(mid, pScreen, pVisual, &pmap,
+ (int) stuff->alloc, client->index);
}
client->errorValue = stuff->visual;
return BadMatch;
@@ -2441,41 +2370,41 @@ ProcFreeColormap(ClientPtr client)
{
ColormapPtr pmap;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResourceByType((pointer *)&pmap, stuff->id, RT_COLORMAP, client,
- DixDestroyAccess);
- if (rc == Success)
- {
- /* Freeing a default colormap is a no-op */
- if (!(pmap->flags & IsDefault))
- FreeResource(stuff->id, RT_NONE);
- return Success;
+ rc = dixLookupResourceByType((pointer *) &pmap, stuff->id, RT_COLORMAP,
+ client, DixDestroyAccess);
+ if (rc == Success) {
+ /* Freeing a default colormap is a no-op */
+ if (!(pmap->flags & IsDefault))
+ FreeResource(stuff->id, RT_NONE);
+ return Success;
}
- else
- {
- client->errorValue = stuff->id;
- return rc;
+ else {
+ client->errorValue = stuff->id;
+ return rc;
}
}
-
int
ProcCopyColormapAndFree(ClientPtr client)
{
- Colormap mid;
- ColormapPtr pSrcMap;
+ Colormap mid;
+ ColormapPtr pSrcMap;
+
REQUEST(xCopyColormapAndFreeReq);
int rc;
REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
mid = stuff->mid;
LEGAL_NEW_RESOURCE(mid, client);
- rc = dixLookupResourceByType((pointer *)&pSrcMap, stuff->srcCmap, RT_COLORMAP,
- client, DixReadAccess|DixRemoveAccess);
+ rc = dixLookupResourceByType((pointer *) &pSrcMap, stuff->srcCmap,
+ RT_COLORMAP, client,
+ DixReadAccess | DixRemoveAccess);
if (rc == Success)
- return CopyColormapAndFree(mid, pSrcMap, client->index);
+ return CopyColormapAndFree(mid, pSrcMap, client->index);
client->errorValue = stuff->srcCmap;
return rc;
}
@@ -2485,25 +2414,26 @@ ProcInstallColormap(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP, client,
- DixInstallAccess);
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP,
+ client, DixInstallAccess);
if (rc != Success)
- goto out;
+ goto out;
rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess);
if (rc != Success) {
- if (rc == BadValue)
- rc = BadColor;
- goto out;
+ if (rc == BadValue)
+ rc = BadColor;
+ goto out;
}
(*(pcmp->pScreen->InstallColormap)) (pcmp);
return Success;
-out:
+ out:
client->errorValue = stuff->id;
return rc;
}
@@ -2513,26 +2443,27 @@ ProcUninstallColormap(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP, client,
- DixUninstallAccess);
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP,
+ client, DixUninstallAccess);
if (rc != Success)
- goto out;
+ goto out;
rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess);
if (rc != Success) {
- if (rc == BadValue)
- rc = BadColor;
- goto out;
+ if (rc == BadValue)
+ rc = BadColor;
+ goto out;
}
- if(pcmp->mid != pcmp->pScreen->defColormap)
- (*(pcmp->pScreen->UninstallColormap)) (pcmp);
+ if (pcmp->mid != pcmp->pScreen->defColormap)
+ (*(pcmp->pScreen->UninstallColormap)) (pcmp);
return Success;
-out:
+ out:
client->errorValue = stuff->id;
return rc;
}
@@ -2540,34 +2471,35 @@ out:
int
ProcListInstalledColormaps(ClientPtr client)
{
- xListInstalledColormapsReply *preply;
+ xListInstalledColormapsReply *preply;
int nummaps, rc;
WindowPtr pWin;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
preply = malloc(sizeof(xListInstalledColormapsReply) +
- pWin->drawable.pScreen->maxInstalledCmaps *
- sizeof(Colormap));
- if(!preply)
+ pWin->drawable.pScreen->maxInstalledCmaps *
+ sizeof(Colormap));
+ if (!preply)
return BadAlloc;
preply->type = X_Reply;
preply->sequenceNumber = client->sequence;
nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
- (pWin->drawable.pScreen, (Colormap *)&preply[1]);
+ (pWin->drawable.pScreen, (Colormap *) & preply[1]);
preply->nColormaps = nummaps;
preply->length = nummaps;
- WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
+ WriteReplyToClient(client, sizeof(xListInstalledColormapsReply), preply);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
free(preply);
@@ -2575,147 +2507,142 @@ ProcListInstalledColormaps(ClientPtr client)
}
int
-ProcAllocColor (ClientPtr client)
+ProcAllocColor(ClientPtr client)
{
ColormapPtr pmap;
int rc;
xAllocColorReply acr;
+
REQUEST(xAllocColorReq);
REQUEST_SIZE_MATCH(xAllocColorReq);
- rc = dixLookupResourceByType((pointer *)&pmap, stuff->cmap, RT_COLORMAP, client,
- DixAddAccess);
- if (rc == Success)
- {
- acr.type = X_Reply;
- acr.length = 0;
- acr.sequenceNumber = client->sequence;
- acr.red = stuff->red;
- acr.green = stuff->green;
- acr.blue = stuff->blue;
- acr.pixel = 0;
- if( (rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
- &acr.pixel, client->index)) )
- return rc;
+ rc = dixLookupResourceByType((pointer *) &pmap, stuff->cmap, RT_COLORMAP,
+ client, DixAddAccess);
+ if (rc == Success) {
+ acr.type = X_Reply;
+ acr.length = 0;
+ acr.sequenceNumber = client->sequence;
+ acr.red = stuff->red;
+ acr.green = stuff->green;
+ acr.blue = stuff->blue;
+ acr.pixel = 0;
+ if ((rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
+ &acr.pixel, client->index)))
+ return rc;
#ifdef PANORAMIX
- if (noPanoramiXExtension || !pmap->pScreen->myNum)
+ if (noPanoramiXExtension || !pmap->pScreen->myNum)
#endif
- WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
- return Success;
+ WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
+ return Success;
}
- else
- {
+ else {
client->errorValue = stuff->cmap;
return rc;
}
}
int
-ProcAllocNamedColor (ClientPtr client)
+ProcAllocNamedColor(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xAllocNamedColorReq);
REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
- DixAddAccess);
- if (rc == Success)
- {
- xAllocNamedColorReply ancr;
-
- ancr.type = X_Reply;
- ancr.length = 0;
- ancr.sequenceNumber = client->sequence;
-
- if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes,
- &ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue))
- {
- ancr.screenRed = ancr.exactRed;
- ancr.screenGreen = ancr.exactGreen;
- ancr.screenBlue = ancr.exactBlue;
- ancr.pixel = 0;
- if( (rc = AllocColor(pcmp,
- &ancr.screenRed, &ancr.screenGreen, &ancr.screenBlue,
- &ancr.pixel, client->index)) )
- return rc;
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+ client, DixAddAccess);
+ if (rc == Success) {
+ xAllocNamedColorReply ancr;
+
+ ancr.type = X_Reply;
+ ancr.length = 0;
+ ancr.sequenceNumber = client->sequence;
+
+ if (OsLookupColor
+ (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
+ &ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) {
+ ancr.screenRed = ancr.exactRed;
+ ancr.screenGreen = ancr.exactGreen;
+ ancr.screenBlue = ancr.exactBlue;
+ ancr.pixel = 0;
+ if ((rc = AllocColor(pcmp,
+ &ancr.screenRed, &ancr.screenGreen,
+ &ancr.screenBlue, &ancr.pixel, client->index)))
+ return rc;
#ifdef PANORAMIX
- if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
- WriteReplyToClient(client, sizeof (xAllocNamedColorReply), &ancr);
- return Success;
- }
- else
- return BadName;
-
+ WriteReplyToClient(client, sizeof(xAllocNamedColorReply),
+ &ancr);
+ return Success;
+ }
+ else
+ return BadName;
+
}
- else
- {
+ else {
client->errorValue = stuff->cmap;
return rc;
}
}
int
-ProcAllocColorCells (ClientPtr client)
+ProcAllocColorCells(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xAllocColorCellsReq);
REQUEST_SIZE_MATCH(xAllocColorCellsReq);
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
- DixAddAccess);
- if (rc == Success)
- {
- xAllocColorCellsReply accr;
- int npixels, nmasks;
- long length;
- Pixel *ppixels, *pmasks;
-
- npixels = stuff->colors;
- if (!npixels)
- {
- client->errorValue = npixels;
- return BadValue;
- }
- if (stuff->contiguous != xTrue && stuff->contiguous != xFalse)
- {
- client->errorValue = stuff->contiguous;
- return BadValue;
- }
- nmasks = stuff->planes;
- length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
- ppixels = malloc(length);
- if(!ppixels)
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+ client, DixAddAccess);
+ if (rc == Success) {
+ xAllocColorCellsReply accr;
+ int npixels, nmasks;
+ long length;
+ Pixel *ppixels, *pmasks;
+
+ npixels = stuff->colors;
+ if (!npixels) {
+ client->errorValue = npixels;
+ return BadValue;
+ }
+ if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) {
+ client->errorValue = stuff->contiguous;
+ return BadValue;
+ }
+ nmasks = stuff->planes;
+ length = ((long) npixels + (long) nmasks) * sizeof(Pixel);
+ ppixels = malloc(length);
+ if (!ppixels)
return BadAlloc;
- pmasks = ppixels + npixels;
-
- if( (rc = AllocColorCells(client->index, pcmp, npixels, nmasks,
- (Bool)stuff->contiguous, ppixels, pmasks)) )
- {
- free(ppixels);
- return rc;
- }
+ pmasks = ppixels + npixels;
+
+ if ((rc = AllocColorCells(client->index, pcmp, npixels, nmasks,
+ (Bool) stuff->contiguous, ppixels, pmasks))) {
+ free(ppixels);
+ return rc;
+ }
#ifdef PANORAMIX
- if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
- {
- accr.type = X_Reply;
- accr.length = bytes_to_int32(length);
- accr.sequenceNumber = client->sequence;
- accr.nPixels = npixels;
- accr.nMasks = nmasks;
- WriteReplyToClient(client, sizeof (xAllocColorCellsReply), &accr);
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, length, ppixels);
- }
- free(ppixels);
+ {
+ accr.type = X_Reply;
+ accr.length = bytes_to_int32(length);
+ accr.sequenceNumber = client->sequence;
+ accr.nPixels = npixels;
+ accr.nMasks = nmasks;
+ WriteReplyToClient(client, sizeof(xAllocColorCellsReply), &accr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ }
+ free(ppixels);
return Success;
}
- else
- {
+ else {
client->errorValue = stuff->cmap;
return rc;
}
@@ -2726,58 +2653,56 @@ ProcAllocColorPlanes(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xAllocColorPlanesReq);
REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
- DixAddAccess);
- if (rc == Success)
- {
- xAllocColorPlanesReply acpr;
- int npixels;
- long length;
- Pixel *ppixels;
-
- npixels = stuff->colors;
- if (!npixels)
- {
- client->errorValue = npixels;
- return BadValue;
- }
- if (stuff->contiguous != xTrue && stuff->contiguous != xFalse)
- {
- client->errorValue = stuff->contiguous;
- return BadValue;
- }
- acpr.type = X_Reply;
- acpr.sequenceNumber = client->sequence;
- acpr.nPixels = npixels;
- length = (long)npixels * sizeof(Pixel);
- ppixels = malloc(length);
- if(!ppixels)
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+ client, DixAddAccess);
+ if (rc == Success) {
+ xAllocColorPlanesReply acpr;
+ int npixels;
+ long length;
+ Pixel *ppixels;
+
+ npixels = stuff->colors;
+ if (!npixels) {
+ client->errorValue = npixels;
+ return BadValue;
+ }
+ if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) {
+ client->errorValue = stuff->contiguous;
+ return BadValue;
+ }
+ acpr.type = X_Reply;
+ acpr.sequenceNumber = client->sequence;
+ acpr.nPixels = npixels;
+ length = (long) npixels *sizeof(Pixel);
+
+ ppixels = malloc(length);
+ if (!ppixels)
return BadAlloc;
- if( (rc = AllocColorPlanes(client->index, pcmp, npixels,
- (int)stuff->red, (int)stuff->green, (int)stuff->blue,
- (Bool)stuff->contiguous, ppixels,
- &acpr.redMask, &acpr.greenMask, &acpr.blueMask)) )
- {
+ if ((rc = AllocColorPlanes(client->index, pcmp, npixels,
+ (int) stuff->red, (int) stuff->green,
+ (int) stuff->blue, (Bool) stuff->contiguous,
+ ppixels, &acpr.redMask, &acpr.greenMask,
+ &acpr.blueMask))) {
free(ppixels);
- return rc;
- }
- acpr.length = bytes_to_int32(length);
+ return rc;
+ }
+ acpr.length = bytes_to_int32(length);
#ifdef PANORAMIX
- if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
- {
- WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, length, ppixels);
- }
- free(ppixels);
+ {
+ WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ }
+ free(ppixels);
return Success;
}
- else
- {
+ else {
client->errorValue = stuff->cmap;
return rc;
}
@@ -2788,80 +2713,76 @@ ProcFreeColors(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xFreeColorsReq);
REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
- DixRemoveAccess);
- if (rc == Success)
- {
- int count;
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+ client, DixRemoveAccess);
+ if (rc == Success) {
+ int count;
- if(pcmp->flags & AllAllocated)
- return BadAccess;
- count = bytes_to_int32((client->req_len << 2) - sizeof(xFreeColorsReq));
- return FreeColors(pcmp, client->index, count,
- (Pixel *)&stuff[1], (Pixel)stuff->planeMask);
+ if (pcmp->flags & AllAllocated)
+ return BadAccess;
+ count = bytes_to_int32((client->req_len << 2) - sizeof(xFreeColorsReq));
+ return FreeColors(pcmp, client->index, count,
+ (Pixel *) &stuff[1], (Pixel) stuff->planeMask);
}
- else
- {
+ else {
client->errorValue = stuff->cmap;
return rc;
}
}
int
-ProcStoreColors (ClientPtr client)
+ProcStoreColors(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xStoreColorsReq);
REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
- DixWriteAccess);
- if (rc == Success)
- {
- int count;
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+ client, DixWriteAccess);
+ if (rc == Success) {
+ int count;
count = (client->req_len << 2) - sizeof(xStoreColorsReq);
- if (count % sizeof(xColorItem))
- return BadLength;
- count /= sizeof(xColorItem);
- return StoreColors(pcmp, count, (xColorItem *)&stuff[1], client);
+ if (count % sizeof(xColorItem))
+ return BadLength;
+ count /= sizeof(xColorItem);
+ return StoreColors(pcmp, count, (xColorItem *) &stuff[1], client);
}
- else
- {
+ else {
client->errorValue = stuff->cmap;
return rc;
}
}
int
-ProcStoreNamedColor (ClientPtr client)
+ProcStoreNamedColor(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xStoreNamedColorReq);
REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
- DixWriteAccess);
- if (rc == Success)
- {
- xColorItem def;
-
- if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1],
- stuff->nbytes, &def.red, &def.green, &def.blue))
- {
- def.flags = stuff->flags;
- def.pixel = stuff->pixel;
- return StoreColors(pcmp, 1, &def, client);
- }
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+ client, DixWriteAccess);
+ if (rc == Success) {
+ xColorItem def;
+
+ if (OsLookupColor(pcmp->pScreen->myNum, (char *) &stuff[1],
+ stuff->nbytes, &def.red, &def.green, &def.blue)) {
+ def.flags = stuff->flags;
+ def.pixel = stuff->pixel;
+ return StoreColors(pcmp, 1, &def, client);
+ }
return BadName;
}
- else
- {
+ else {
client->errorValue = stuff->cmap;
return rc;
}
@@ -2872,98 +2793,95 @@ ProcQueryColors(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xQueryColorsReq);
REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
- DixReadAccess);
- if (rc == Success)
- {
- int count;
- xrgb *prgbs;
- xQueryColorsReply qcr;
-
- count = bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
- prgbs = calloc(1, count * sizeof(xrgb));
- if(!prgbs && count)
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+ client, DixReadAccess);
+ if (rc == Success) {
+ int count;
+ xrgb *prgbs;
+ xQueryColorsReply qcr;
+
+ count =
+ bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
+ prgbs = calloc(1, count * sizeof(xrgb));
+ if (!prgbs && count)
return BadAlloc;
- if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs, client)) )
- {
- free(prgbs);
- return rc;
- }
- memset(&qcr, 0, sizeof(xQueryColorsReply));
- qcr.type = X_Reply;
- qcr.length = bytes_to_int32(count * sizeof(xrgb));
- qcr.sequenceNumber = client->sequence;
- qcr.nColors = count;
- WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
- if (count)
- {
- client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
- WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
- }
- free(prgbs);
- return Success;
-
+ if ((rc =
+ QueryColors(pcmp, count, (Pixel *) &stuff[1], prgbs, client))) {
+ free(prgbs);
+ return rc;
+ }
+ memset(&qcr, 0, sizeof(xQueryColorsReply));
+ qcr.type = X_Reply;
+ qcr.length = bytes_to_int32(count * sizeof(xrgb));
+ qcr.sequenceNumber = client->sequence;
+ qcr.nColors = count;
+ WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
+ if (count) {
+ client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
+ WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
+ }
+ free(prgbs);
+ return Success;
+
}
- else
- {
+ else {
client->errorValue = stuff->cmap;
return rc;
}
-}
+}
int
ProcLookupColor(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xLookupColorReq);
REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes);
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
- DixReadAccess);
- if (rc == Success)
- {
- xLookupColorReply lcr;
-
- if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes,
- &lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue))
- {
- lcr.type = X_Reply;
- lcr.length = 0;
- lcr.sequenceNumber = client->sequence;
- lcr.screenRed = lcr.exactRed;
- lcr.screenGreen = lcr.exactGreen;
- lcr.screenBlue = lcr.exactBlue;
- (*pcmp->pScreen->ResolveColor)(&lcr.screenRed,
- &lcr.screenGreen,
- &lcr.screenBlue,
- pcmp->pVisual);
- WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
- return Success;
- }
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+ client, DixReadAccess);
+ if (rc == Success) {
+ xLookupColorReply lcr;
+
+ if (OsLookupColor
+ (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
+ &lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue)) {
+ lcr.type = X_Reply;
+ lcr.length = 0;
+ lcr.sequenceNumber = client->sequence;
+ lcr.screenRed = lcr.exactRed;
+ lcr.screenGreen = lcr.exactGreen;
+ lcr.screenBlue = lcr.exactBlue;
+ (*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
+ &lcr.screenGreen,
+ &lcr.screenBlue, pcmp->pVisual);
+ WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
+ return Success;
+ }
return BadName;
}
- else
- {
+ else {
client->errorValue = stuff->cmap;
return rc;
}
}
int
-ProcCreateCursor (ClientPtr client)
+ProcCreateCursor(ClientPtr client)
{
- CursorPtr pCursor;
- PixmapPtr src;
- PixmapPtr msk;
- unsigned char * srcbits;
- unsigned char * mskbits;
- unsigned short width, height;
- long n;
- CursorMetricRec cm;
+ CursorPtr pCursor;
+ PixmapPtr src;
+ PixmapPtr msk;
+ unsigned char *srcbits;
+ unsigned char *mskbits;
+ unsigned short width, height;
+ long n;
+ CursorMetricRec cm;
int rc;
REQUEST(xCreateCursorReq);
@@ -2971,87 +2889,82 @@ ProcCreateCursor (ClientPtr client)
REQUEST_SIZE_MATCH(xCreateCursorReq);
LEGAL_NEW_RESOURCE(stuff->cid, client);
- rc = dixLookupResourceByType((pointer *)&src, stuff->source, RT_PIXMAP, client,
- DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &src, stuff->source, RT_PIXMAP,
+ client, DixReadAccess);
if (rc != Success) {
- client->errorValue = stuff->source;
- return rc;
+ client->errorValue = stuff->source;
+ return rc;
}
- rc = dixLookupResourceByType((pointer *)&msk, stuff->mask, RT_PIXMAP, client,
- DixReadAccess);
- if (rc != Success)
- {
- if (stuff->mask != None)
- {
- client->errorValue = stuff->mask;
- return rc;
- }
- }
- else if ( src->drawable.width != msk->drawable.width
- || src->drawable.height != msk->drawable.height
- || src->drawable.depth != 1
- || msk->drawable.depth != 1)
- return BadMatch;
+ rc = dixLookupResourceByType((pointer *) &msk, stuff->mask, RT_PIXMAP,
+ client, DixReadAccess);
+ if (rc != Success) {
+ if (stuff->mask != None) {
+ client->errorValue = stuff->mask;
+ return rc;
+ }
+ }
+ else if (src->drawable.width != msk->drawable.width
+ || src->drawable.height != msk->drawable.height
+ || src->drawable.depth != 1 || msk->drawable.depth != 1)
+ return BadMatch;
width = src->drawable.width;
height = src->drawable.height;
- if ( stuff->x > width
- || stuff->y > height )
- return BadMatch;
+ if (stuff->x > width || stuff->y > height)
+ return BadMatch;
- n = BitmapBytePad(width)*height;
+ n = BitmapBytePad(width) * height;
srcbits = calloc(1, n);
if (!srcbits)
- return BadAlloc;
+ return BadAlloc;
mskbits = malloc(n);
- if (!mskbits)
- {
- free(srcbits);
- return BadAlloc;
+ if (!mskbits) {
+ free(srcbits);
+ return BadAlloc;
}
- (* src->drawable.pScreen->GetImage)( (DrawablePtr)src, 0, 0, width, height,
- XYPixmap, 1, (pointer)srcbits);
- if ( msk == (PixmapPtr)NULL)
- {
- unsigned char *bits = mskbits;
- while (--n >= 0)
- *bits++ = ~0;
+ (*src->drawable.pScreen->GetImage) ((DrawablePtr) src, 0, 0, width, height,
+ XYPixmap, 1, (pointer) srcbits);
+ if (msk == (PixmapPtr) NULL) {
+ unsigned char *bits = mskbits;
+
+ while (--n >= 0)
+ *bits++ = ~0;
}
- else
- {
- /* zeroing the (pad) bits helps some ddx cursor handling */
- memset((char *)mskbits, 0, n);
- (* msk->drawable.pScreen->GetImage)( (DrawablePtr)msk, 0, 0, width,
- height, XYPixmap, 1, (pointer)mskbits);
+ else {
+ /* zeroing the (pad) bits helps some ddx cursor handling */
+ memset((char *) mskbits, 0, n);
+ (*msk->drawable.pScreen->GetImage) ((DrawablePtr) msk, 0, 0, width,
+ height, XYPixmap, 1,
+ (pointer) mskbits);
}
cm.width = width;
cm.height = height;
cm.xhot = stuff->x;
cm.yhot = stuff->y;
rc = AllocARGBCursor(srcbits, mskbits, NULL, &cm,
- stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
- stuff->backRed, stuff->backGreen, stuff->backBlue,
- &pCursor, client, stuff->cid);
+ stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
+ stuff->backRed, stuff->backGreen, stuff->backBlue,
+ &pCursor, client, stuff->cid);
if (rc != Success)
- goto bail;
- if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) {
- rc = BadAlloc;
- goto bail;
+ goto bail;
+ if (!AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor)) {
+ rc = BadAlloc;
+ goto bail;
}
return Success;
-bail:
+ bail:
free(srcbits);
free(mskbits);
return rc;
}
int
-ProcCreateGlyphCursor (ClientPtr client)
+ProcCreateGlyphCursor(ClientPtr client)
{
CursorPtr pCursor;
int res;
@@ -3062,70 +2975,67 @@ ProcCreateGlyphCursor (ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->cid, client);
res = AllocGlyphCursor(stuff->source, stuff->sourceChar,
- stuff->mask, stuff->maskChar,
- stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
- stuff->backRed, stuff->backGreen, stuff->backBlue,
- &pCursor, client, stuff->cid);
+ stuff->mask, stuff->maskChar,
+ stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
+ stuff->backRed, stuff->backGreen, stuff->backBlue,
+ &pCursor, client, stuff->cid);
if (res != Success)
- return res;
- if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
- return Success;
+ return res;
+ if (AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor))
+ return Success;
return BadAlloc;
}
-
int
-ProcFreeCursor (ClientPtr client)
+ProcFreeCursor(ClientPtr client)
{
CursorPtr pCursor;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResourceByType((pointer *)&pCursor, stuff->id, RT_CURSOR, client,
- DixDestroyAccess);
- if (rc == Success)
- {
- FreeResource(stuff->id, RT_NONE);
- return Success;
+ rc = dixLookupResourceByType((pointer *) &pCursor, stuff->id, RT_CURSOR,
+ client, DixDestroyAccess);
+ if (rc == Success) {
+ FreeResource(stuff->id, RT_NONE);
+ return Success;
}
- else
- {
- client->errorValue = stuff->id;
- return rc;
+ else {
+ client->errorValue = stuff->id;
+ return rc;
}
}
int
-ProcQueryBestSize (ClientPtr client)
+ProcQueryBestSize(ClientPtr client)
{
- xQueryBestSizeReply reply;
+ xQueryBestSizeReply reply;
DrawablePtr pDraw;
ScreenPtr pScreen;
int rc;
+
REQUEST(xQueryBestSizeReq);
REQUEST_SIZE_MATCH(xQueryBestSizeReq);
- if ((stuff->class != CursorShape) &&
- (stuff->class != TileShape) &&
- (stuff->class != StippleShape))
- {
- client->errorValue = stuff->class;
+ if ((stuff->class != CursorShape) &&
+ (stuff->class != TileShape) && (stuff->class != StippleShape)) {
+ client->errorValue = stuff->class;
return BadValue;
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
- return BadMatch;
+ return BadMatch;
pScreen = pDraw->pScreen;
rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
if (rc != Success)
- return rc;
- (* pScreen->QueryBestSize)(stuff->class, &stuff->width,
- &stuff->height, pScreen);
+ return rc;
+ (*pScreen->QueryBestSize) (stuff->class, &stuff->width,
+ &stuff->height, pScreen);
memset(&reply, 0, sizeof(xQueryBestSizeReply));
reply.type = X_Reply;
reply.length = 0;
@@ -3136,65 +3046,61 @@ ProcQueryBestSize (ClientPtr client)
return Success;
}
-
int
-ProcSetScreenSaver (ClientPtr client)
+ProcSetScreenSaver(ClientPtr client)
{
int rc, i, blankingOption, exposureOption;
+
REQUEST(xSetScreenSaverReq);
REQUEST_SIZE_MATCH(xSetScreenSaverReq);
for (i = 0; i < screenInfo.numScreens; i++) {
- rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
- DixSetAttrAccess);
- if (rc != Success)
- return rc;
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
+ DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
}
blankingOption = stuff->preferBlank;
if ((blankingOption != DontPreferBlanking) &&
(blankingOption != PreferBlanking) &&
- (blankingOption != DefaultBlanking))
- {
- client->errorValue = blankingOption;
+ (blankingOption != DefaultBlanking)) {
+ client->errorValue = blankingOption;
return BadValue;
}
exposureOption = stuff->allowExpose;
if ((exposureOption != DontAllowExposures) &&
(exposureOption != AllowExposures) &&
- (exposureOption != DefaultExposures))
- {
- client->errorValue = exposureOption;
+ (exposureOption != DefaultExposures)) {
+ client->errorValue = exposureOption;
return BadValue;
}
- if (stuff->timeout < -1)
- {
- client->errorValue = stuff->timeout;
+ if (stuff->timeout < -1) {
+ client->errorValue = stuff->timeout;
return BadValue;
}
- if (stuff->interval < -1)
- {
- client->errorValue = stuff->interval;
+ if (stuff->interval < -1) {
+ client->errorValue = stuff->interval;
return BadValue;
}
if (blankingOption == DefaultBlanking)
- ScreenSaverBlanking = defaultScreenSaverBlanking;
+ ScreenSaverBlanking = defaultScreenSaverBlanking;
else
- ScreenSaverBlanking = blankingOption;
+ ScreenSaverBlanking = blankingOption;
if (exposureOption == DefaultExposures)
- ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
+ ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
else
- ScreenSaverAllowExposures = exposureOption;
+ ScreenSaverAllowExposures = exposureOption;
if (stuff->timeout >= 0)
- ScreenSaverTime = stuff->timeout * MILLI_PER_SECOND;
- else
- ScreenSaverTime = defaultScreenSaverTime;
+ ScreenSaverTime = stuff->timeout * MILLI_PER_SECOND;
+ else
+ ScreenSaverTime = defaultScreenSaverTime;
if (stuff->interval >= 0)
- ScreenSaverInterval = stuff->interval * MILLI_PER_SECOND;
+ ScreenSaverInterval = stuff->interval * MILLI_PER_SECOND;
else
- ScreenSaverInterval = defaultScreenSaverInterval;
+ ScreenSaverInterval = defaultScreenSaverInterval;
SetScreenSaverTimer();
return Success;
@@ -3205,13 +3111,14 @@ ProcGetScreenSaver(ClientPtr client)
{
xGetScreenSaverReply rep;
int rc, i;
+
REQUEST_SIZE_MATCH(xReq);
for (i = 0; i < screenInfo.numScreens; i++) {
- rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
- DixGetAttrAccess);
- if (rc != Success)
- return rc;
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
+ DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
}
rep.type = X_Reply;
@@ -3232,12 +3139,12 @@ ProcChangeHosts(ClientPtr client)
REQUEST_FIXED_SIZE(xChangeHostsReq, stuff->hostLength);
- if(stuff->mode == HostInsert)
- return AddHost(client, (int)stuff->hostFamily,
- stuff->hostLength, (pointer)&stuff[1]);
+ if (stuff->mode == HostInsert)
+ return AddHost(client, (int) stuff->hostFamily,
+ stuff->hostLength, (pointer) &stuff[1]);
if (stuff->mode == HostDelete)
- return RemoveHost(client, (int)stuff->hostFamily,
- stuff->hostLength, (pointer)&stuff[1]);
+ return RemoveHost(client, (int) stuff->hostFamily,
+ stuff->hostLength, (pointer) &stuff[1]);
client->errorValue = stuff->mode;
return BadValue;
}
@@ -3246,8 +3153,9 @@ int
ProcListHosts(ClientPtr client)
{
xListHostsReply reply;
- int len, nHosts, result;
- pointer pdata;
+ int len, nHosts, result;
+ pointer pdata;
+
/* REQUEST(xListHostsReq); */
REQUEST_SIZE_MATCH(xListHostsReq);
@@ -3255,20 +3163,19 @@ ProcListHosts(ClientPtr client)
/* untrusted clients can't list hosts */
result = XaceHook(XACE_SERVER_ACCESS, client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
result = GetHosts(&pdata, &nHosts, &len, &reply.enabled);
if (result != Success)
- return result;
+ return result;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.nHosts = nHosts;
reply.length = bytes_to_int32(len);
WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
- if (nHosts)
- {
- client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
- WriteSwappedDataToClient(client, len, pdata);
+ if (nHosts) {
+ client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
+ WriteSwappedDataToClient(client, len, pdata);
}
free(pdata);
return Success;
@@ -3280,9 +3187,8 @@ ProcChangeAccessControl(ClientPtr client)
REQUEST(xSetAccessControlReq);
REQUEST_SIZE_MATCH(xSetAccessControlReq);
- if ((stuff->mode != EnableAccess) && (stuff->mode != DisableAccess))
- {
- client->errorValue = stuff->mode;
+ if ((stuff->mode != EnableAccess) && (stuff->mode != DisableAccess)) {
+ client->errorValue = stuff->mode;
return BadValue;
}
return ChangeAccessControl(client, stuff->mode == EnableAccess);
@@ -3301,12 +3207,11 @@ CloseDownRetainedResources(void)
int i;
ClientPtr client;
- for (i=1; i<currentMaxClients; i++)
- {
+ for (i = 1; i < currentMaxClients; i++) {
client = clients[i];
if (client && (client->closeDownMode == RetainTemporary)
- && (client->clientGone))
- CloseDownClient(client);
+ && (client->clientGone))
+ CloseDownClient(client);
}
}
@@ -3318,28 +3223,26 @@ ProcKillClient(ClientPtr client)
int rc;
REQUEST_SIZE_MATCH(xResourceReq);
- if (stuff->id == AllTemporary)
- {
- CloseDownRetainedResources();
+ if (stuff->id == AllTemporary) {
+ CloseDownRetainedResources();
return Success;
}
rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess);
if (rc == Success) {
- CloseDownClient(killclient);
- /* if an LBX proxy gets killed, isItTimeToYield will be set */
- if (isItTimeToYield || (client == killclient))
- {
- /* force yield and return Success, so that Dispatch()
- * doesn't try to touch client
- */
- isItTimeToYield = TRUE;
- return Success;
- }
- return Success;
+ CloseDownClient(killclient);
+ /* if an LBX proxy gets killed, isItTimeToYield will be set */
+ if (isItTimeToYield || (client == killclient)) {
+ /* force yield and return Success, so that Dispatch()
+ * doesn't try to touch client
+ */
+ isItTimeToYield = TRUE;
+ return Success;
+ }
+ return Success;
}
else
- return rc;
+ return rc;
}
int
@@ -3349,24 +3252,24 @@ ProcSetFontPath(ClientPtr client)
unsigned long nbytes, total;
long nfonts;
int n;
+
REQUEST(xSetFontPathReq);
-
+
REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
-
+
nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
total = nbytes;
- ptr = (unsigned char *)&stuff[1];
+ ptr = (unsigned char *) &stuff[1];
nfonts = stuff->nFonts;
- while (--nfonts >= 0)
- {
- if ((total == 0) || (total < (n = (*ptr + 1))))
- return BadLength;
- total -= n;
- ptr += n;
+ while (--nfonts >= 0) {
+ if ((total == 0) || (total < (n = (*ptr + 1))))
+ return BadLength;
+ total -= n;
+ ptr += n;
}
if (total >= 4)
- return BadLength;
- return SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
+ return BadLength;
+ return SetFontPath(client, stuff->nFonts, (unsigned char *) &stuff[1]);
}
int
@@ -3375,12 +3278,13 @@ ProcGetFontPath(ClientPtr client)
xGetFontPathReply reply;
int rc, stringLens, numpaths;
unsigned char *bufferStart;
+
/* REQUEST (xReq); */
REQUEST_SIZE_MATCH(xReq);
rc = GetFontPath(client, &numpaths, &stringLens, &bufferStart);
if (rc != Success)
- return rc;
+ return rc;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
@@ -3389,7 +3293,8 @@ ProcGetFontPath(ClientPtr client)
WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply);
if (stringLens || numpaths)
- (void)WriteToClient(client, stringLens + numpaths, (char *)bufferStart);
+ (void) WriteToClient(client, stringLens + numpaths,
+ (char *) bufferStart);
return Success;
}
@@ -3397,50 +3302,49 @@ int
ProcChangeCloseDownMode(ClientPtr client)
{
int rc;
+
REQUEST(xSetCloseDownModeReq);
REQUEST_SIZE_MATCH(xSetCloseDownModeReq);
rc = XaceHook(XACE_CLIENT_ACCESS, client, client, DixManageAccess);
if (rc != Success)
- return rc;
+ return rc;
if ((stuff->mode == AllTemporary) ||
- (stuff->mode == RetainPermanent) ||
- (stuff->mode == RetainTemporary))
- {
- client->closeDownMode = stuff->mode;
- return Success;
+ (stuff->mode == RetainPermanent) || (stuff->mode == RetainTemporary)) {
+ client->closeDownMode = stuff->mode;
+ return Success;
}
- else
- {
- client->errorValue = stuff->mode;
- return BadValue;
+ else {
+ client->errorValue = stuff->mode;
+ return BadValue;
}
}
-int ProcForceScreenSaver(ClientPtr client)
-{
+int
+ProcForceScreenSaver(ClientPtr client)
+{
int rc;
+
REQUEST(xForceScreenSaverReq);
REQUEST_SIZE_MATCH(xForceScreenSaverReq);
-
- if ((stuff->mode != ScreenSaverReset) &&
- (stuff->mode != ScreenSaverActive))
- {
- client->errorValue = stuff->mode;
+
+ if ((stuff->mode != ScreenSaverReset) && (stuff->mode != ScreenSaverActive)) {
+ client->errorValue = stuff->mode;
return BadValue;
}
- rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, (int)stuff->mode);
+ rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, (int) stuff->mode);
if (rc != Success)
- return rc;
+ return rc;
return Success;
}
-int ProcNoOperation(ClientPtr client)
+int
+ProcNoOperation(ClientPtr client)
{
REQUEST_AT_LEAST_SIZE(xReq);
-
+
/* noop -- don't do anything */
return Success;
}
@@ -3458,88 +3362,81 @@ void
CloseDownClient(ClientPtr client)
{
Bool really_close_down = client->clientGone ||
- client->closeDownMode == DestroyAll;
+ client->closeDownMode == DestroyAll;
- if (!client->clientGone)
- {
- /* ungrab server if grabbing client dies */
- if (grabState != GrabNone && grabClient == client)
- {
- UngrabServer(client);
- }
- BITCLEAR(grabWaiters, client->index);
- DeleteClientFromAnySelections(client);
- ReleaseActiveGrabs(client);
- DeleteClientFontStuff(client);
- if (!really_close_down)
- {
- /* This frees resources that should never be retained
- * no matter what the close down mode is. Actually we
- * could do this unconditionally, but it's probably
- * better not to traverse all the client's resources
- * twice (once here, once a few lines down in
- * FreeClientResources) in the common case of
- * really_close_down == TRUE.
- */
- FreeClientNeverRetainResources(client);
- client->clientState = ClientStateRetained;
- if (ClientStateCallback)
- {
- NewClientInfoRec clientinfo;
-
- clientinfo.client = client;
- clientinfo.prefix = (xConnSetupPrefix *)NULL;
- clientinfo.setup = (xConnSetup *) NULL;
- CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
- }
- }
- client->clientGone = TRUE; /* so events aren't sent to client */
- if (ClientIsAsleep(client))
- ClientSignal (client);
- ProcessWorkQueueZombies();
- CloseDownConnection(client);
-
- /* If the client made it to the Running stage, nClients has
- * been incremented on its behalf, so we need to decrement it
- * now. If it hasn't gotten to Running, nClients has *not*
- * been incremented, so *don't* decrement it.
- */
- if (client->clientState != ClientStateInitial)
- {
- --nClients;
- }
- }
-
- if (really_close_down)
- {
- if (client->clientState == ClientStateRunning && nClients == 0)
- dispatchException |= dispatchExceptionAtReset;
-
- client->clientState = ClientStateGone;
- if (ClientStateCallback)
- {
- NewClientInfoRec clientinfo;
-
- clientinfo.client = client;
- clientinfo.prefix = (xConnSetupPrefix *)NULL;
- clientinfo.setup = (xConnSetup *) NULL;
- CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
- }
- FreeClientResources(client);
- /* Disable client ID tracking. This must be done after
- * ClientStateCallback. */
- ReleaseClientIds(client);
+ if (!client->clientGone) {
+ /* ungrab server if grabbing client dies */
+ if (grabState != GrabNone && grabClient == client) {
+ UngrabServer(client);
+ }
+ BITCLEAR(grabWaiters, client->index);
+ DeleteClientFromAnySelections(client);
+ ReleaseActiveGrabs(client);
+ DeleteClientFontStuff(client);
+ if (!really_close_down) {
+ /* This frees resources that should never be retained
+ * no matter what the close down mode is. Actually we
+ * could do this unconditionally, but it's probably
+ * better not to traverse all the client's resources
+ * twice (once here, once a few lines down in
+ * FreeClientResources) in the common case of
+ * really_close_down == TRUE.
+ */
+ FreeClientNeverRetainResources(client);
+ client->clientState = ClientStateRetained;
+ if (ClientStateCallback) {
+ NewClientInfoRec clientinfo;
+
+ clientinfo.client = client;
+ clientinfo.prefix = (xConnSetupPrefix *) NULL;
+ clientinfo.setup = (xConnSetup *) NULL;
+ CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
+ }
+ }
+ client->clientGone = TRUE; /* so events aren't sent to client */
+ if (ClientIsAsleep(client))
+ ClientSignal(client);
+ ProcessWorkQueueZombies();
+ CloseDownConnection(client);
+
+ /* If the client made it to the Running stage, nClients has
+ * been incremented on its behalf, so we need to decrement it
+ * now. If it hasn't gotten to Running, nClients has *not*
+ * been incremented, so *don't* decrement it.
+ */
+ if (client->clientState != ClientStateInitial) {
+ --nClients;
+ }
+ }
+
+ if (really_close_down) {
+ if (client->clientState == ClientStateRunning && nClients == 0)
+ dispatchException |= dispatchExceptionAtReset;
+
+ client->clientState = ClientStateGone;
+ if (ClientStateCallback) {
+ NewClientInfoRec clientinfo;
+
+ clientinfo.client = client;
+ clientinfo.prefix = (xConnSetupPrefix *) NULL;
+ clientinfo.setup = (xConnSetup *) NULL;
+ CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
+ }
+ FreeClientResources(client);
+ /* Disable client ID tracking. This must be done after
+ * ClientStateCallback. */
+ ReleaseClientIds(client);
#ifdef XSERVER_DTRACE
- XSERVER_CLIENT_DISCONNECT(client->index);
-#endif
- if (client->index < nextFreeClientID)
- nextFreeClientID = client->index;
- clients[client->index] = NullClient;
- SmartLastClient = NullClient;
- dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
+ XSERVER_CLIENT_DISCONNECT(client->index);
+#endif
+ if (client->index < nextFreeClientID)
+ nextFreeClientID = client->index;
+ clients[client->index] = NullClient;
+ SmartLastClient = NullClient;
+ dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
- while (!clients[currentMaxClients-1])
- currentMaxClients--;
+ while (!clients[currentMaxClients - 1])
+ currentMaxClients--;
}
}
@@ -3547,22 +3444,24 @@ static void
KillAllClients(void)
{
int i;
- for (i=1; i<currentMaxClients; i++)
+
+ for (i = 1; i < currentMaxClients; i++)
if (clients[i]) {
/* Make sure Retained clients are released. */
clients[i]->closeDownMode = DestroyAll;
- CloseDownClient(clients[i]);
+ CloseDownClient(clients[i]);
}
}
-void InitClient(ClientPtr client, int i, pointer ospriv)
+void
+InitClient(ClientPtr client, int i, pointer ospriv)
{
client->index = i;
- client->clientAsMask = ((Mask)i) << CLIENTOFFSET;
+ client->clientAsMask = ((Mask) i) << CLIENTOFFSET;
client->closeDownMode = i ? DestroyAll : RetainPermanent;
client->requestVector = InitialVector;
client->osPrivate = ospriv;
- QueryMinMaxKeyCodes(&client->minKC,&client->maxKC);
+ QueryMinMaxKeyCodes(&client->minKC, &client->maxKC);
client->smart_start_tick = SmartScheduleTime;
client->smart_stop_tick = SmartScheduleTime;
client->smart_check_tick = SmartScheduleTime;
@@ -3576,7 +3475,8 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
* Returns NULL if there are no free clients.
*************************/
-ClientPtr NextAvailableClient(pointer ospriv)
+ClientPtr
+NextAvailableClient(pointer ospriv)
{
int i;
ClientPtr client;
@@ -3584,42 +3484,40 @@ ClientPtr NextAvailableClient(pointer ospriv)
i = nextFreeClientID;
if (i == MAXCLIENTS)
- return (ClientPtr)NULL;
- clients[i] = client = dixAllocateObjectWithPrivates(ClientRec, PRIVATE_CLIENT);
+ return (ClientPtr) NULL;
+ clients[i] = client =
+ dixAllocateObjectWithPrivates(ClientRec, PRIVATE_CLIENT);
if (!client)
- return (ClientPtr)NULL;
+ return (ClientPtr) NULL;
InitClient(client, i, ospriv);
- if (!InitClientResources(client))
- {
- dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
- return (ClientPtr)NULL;
+ if (!InitClientResources(client)) {
+ dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
+ return (ClientPtr) NULL;
}
data.reqType = 1;
data.length = bytes_to_int32(sz_xReq + sz_xConnClientPrefix);
- if (!InsertFakeRequest(client, (char *)&data, sz_xReq))
- {
- FreeClientResources(client);
- dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
- return (ClientPtr)NULL;
+ if (!InsertFakeRequest(client, (char *) &data, sz_xReq)) {
+ FreeClientResources(client);
+ dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
+ return (ClientPtr) NULL;
}
if (i == currentMaxClients)
- currentMaxClients++;
+ currentMaxClients++;
while ((nextFreeClientID < MAXCLIENTS) && clients[nextFreeClientID])
- nextFreeClientID++;
+ nextFreeClientID++;
/* Enable client ID tracking. This must be done before
* ClientStateCallback. */
ReserveClientIds(client);
- if (ClientStateCallback)
- {
- NewClientInfoRec clientinfo;
+ if (ClientStateCallback) {
+ NewClientInfoRec clientinfo;
- clientinfo.client = client;
- clientinfo.prefix = (xConnSetupPrefix *)NULL;
+ clientinfo.client = client;
+ clientinfo.prefix = (xConnSetupPrefix *) NULL;
clientinfo.setup = (xConnSetup *) NULL;
- CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
- }
+ CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
+ }
return client;
}
@@ -3630,21 +3528,19 @@ ProcInitialConnection(ClientPtr client)
xConnClientPrefix *prefix;
int whichbyte = 1;
- prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
+ prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq);
if ((prefix->byteOrder != 'l') && (prefix->byteOrder != 'B'))
- return client->noClientException = -1;
+ return client->noClientException = -1;
if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) ||
- (!(*(char *) &whichbyte) && (prefix->byteOrder == 'l')))
- {
- client->swapped = TRUE;
- SwapConnClientPrefix(prefix);
+ (!(*(char *) &whichbyte) && (prefix->byteOrder == 'l'))) {
+ client->swapped = TRUE;
+ SwapConnClientPrefix(prefix);
}
stuff->reqType = 2;
stuff->length += bytes_to_int32(prefix->nbytesAuthProto) +
- bytes_to_int32(prefix->nbytesAuthString);
- if (client->swapped)
- {
- swaps(&stuff->length);
+ bytes_to_int32(prefix->nbytesAuthString);
+ if (client->swapped) {
+ swaps(&stuff->length);
}
ResetCurrentRequest(client);
return Success;
@@ -3656,24 +3552,23 @@ SendConnSetup(ClientPtr client, const char *reason)
xWindowRoot *root;
int i;
int numScreens;
- char* lConnectionInfo;
- xConnSetupPrefix* lconnSetupPrefix;
+ char *lConnectionInfo;
+ xConnSetupPrefix *lconnSetupPrefix;
- if (reason)
- {
- xConnSetupPrefix csp;
+ if (reason) {
+ xConnSetupPrefix csp;
- csp.success = xFalse;
- csp.lengthReason = strlen(reason);
- csp.length = bytes_to_int32(csp.lengthReason);
- csp.majorVersion = X_PROTOCOL;
- csp.minorVersion = X_PROTOCOL_REVISION;
- if (client->swapped)
- WriteSConnSetupPrefix(client, &csp);
- else
- (void)WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp);
- (void)WriteToClient(client, (int)csp.lengthReason, reason);
- return client->noClientException = -1;
+ csp.success = xFalse;
+ csp.lengthReason = strlen(reason);
+ csp.length = bytes_to_int32(csp.lengthReason);
+ csp.majorVersion = X_PROTOCOL;
+ csp.minorVersion = X_PROTOCOL_REVISION;
+ if (client->swapped)
+ WriteSConnSetupPrefix(client, &csp);
+ else
+ (void) WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp);
+ (void) WriteToClient(client, (int) csp.lengthReason, reason);
+ return client->noClientException = -1;
}
numScreens = screenInfo.numScreens;
@@ -3689,61 +3584,56 @@ SendConnSetup(ClientPtr client, const char *reason)
client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
client->sequence = 0;
- ((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask;
- ((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
+ ((xConnSetup *) lConnectionInfo)->ridBase = client->clientAsMask;
+ ((xConnSetup *) lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
#ifdef MATCH_CLIENT_ENDIAN
- ((xConnSetup *)lConnectionInfo)->imageByteOrder = ClientOrder (client);
- ((xConnSetup *)lConnectionInfo)->bitmapBitOrder = ClientOrder (client);
+ ((xConnSetup *) lConnectionInfo)->imageByteOrder = ClientOrder(client);
+ ((xConnSetup *) lConnectionInfo)->bitmapBitOrder = ClientOrder(client);
#endif
/* fill in the "currentInputMask" */
- root = (xWindowRoot *)(lConnectionInfo + connBlockScreenStart);
+ root = (xWindowRoot *) (lConnectionInfo + connBlockScreenStart);
#ifdef PANORAMIX
if (noPanoramiXExtension)
- numScreens = screenInfo.numScreens;
- else
- numScreens = ((xConnSetup *)ConnectionInfo)->numRoots;
+ numScreens = screenInfo.numScreens;
+ else
+ numScreens = ((xConnSetup *) ConnectionInfo)->numRoots;
#endif
- for (i=0; i<numScreens; i++)
- {
- unsigned int j;
- xDepth *pDepth;
- WindowPtr pRoot = screenInfo.screens[i]->root;
+ for (i = 0; i < numScreens; i++) {
+ unsigned int j;
+ xDepth *pDepth;
+ WindowPtr pRoot = screenInfo.screens[i]->root;
root->currentInputMask = pRoot->eventMask | wOtherEventMasks(pRoot);
- pDepth = (xDepth *)(root + 1);
- for (j = 0; j < root->nDepths; j++)
- {
- pDepth = (xDepth *)(((char *)(pDepth + 1)) +
- pDepth->nVisuals * sizeof(xVisualType));
- }
- root = (xWindowRoot *)pDepth;
+ pDepth = (xDepth *) (root + 1);
+ for (j = 0; j < root->nDepths; j++) {
+ pDepth = (xDepth *) (((char *) (pDepth + 1)) +
+ pDepth->nVisuals * sizeof(xVisualType));
+ }
+ root = (xWindowRoot *) pDepth;
}
- if (client->swapped)
- {
- WriteSConnSetupPrefix(client, lconnSetupPrefix);
- WriteSConnectionInfo(client,
- (unsigned long)(lconnSetupPrefix->length << 2),
- lConnectionInfo);
+ if (client->swapped) {
+ WriteSConnSetupPrefix(client, lconnSetupPrefix);
+ WriteSConnectionInfo(client,
+ (unsigned long) (lconnSetupPrefix->length << 2),
+ lConnectionInfo);
}
- else
- {
- (void)WriteToClient(client, sizeof(xConnSetupPrefix),
- (char *) lconnSetupPrefix);
- (void)WriteToClient(client, (int)(lconnSetupPrefix->length << 2),
- lConnectionInfo);
+ else {
+ (void) WriteToClient(client, sizeof(xConnSetupPrefix),
+ (char *) lconnSetupPrefix);
+ (void) WriteToClient(client, (int) (lconnSetupPrefix->length << 2),
+ lConnectionInfo);
}
client->clientState = ClientStateRunning;
- if (ClientStateCallback)
- {
- NewClientInfoRec clientinfo;
+ if (ClientStateCallback) {
+ NewClientInfoRec clientinfo;
- clientinfo.client = client;
- clientinfo.prefix = lconnSetupPrefix;
- clientinfo.setup = (xConnSetup *)lConnectionInfo;
- CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
- }
+ clientinfo.client = client;
+ clientinfo.prefix = lconnSetupPrefix;
+ clientinfo.setup = (xConnSetup *) lConnectionInfo;
+ CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
+ }
return Success;
}
@@ -3753,26 +3643,27 @@ ProcEstablishConnection(ClientPtr client)
const char *reason;
char *auth_proto, *auth_string;
xConnClientPrefix *prefix;
+
REQUEST(xReq);
- prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
- auth_proto = (char *)prefix + sz_xConnClientPrefix;
+ prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq);
+ auth_proto = (char *) prefix + sz_xConnClientPrefix;
auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto);
if ((prefix->majorVersion != X_PROTOCOL) ||
- (prefix->minorVersion != X_PROTOCOL_REVISION))
- reason = "Protocol version mismatch";
+ (prefix->minorVersion != X_PROTOCOL_REVISION))
+ reason = "Protocol version mismatch";
else
- reason = ClientAuthorized(client,
- (unsigned short)prefix->nbytesAuthProto,
- auth_proto,
- (unsigned short)prefix->nbytesAuthString,
- auth_string);
+ reason = ClientAuthorized(client,
+ (unsigned short) prefix->nbytesAuthProto,
+ auth_proto,
+ (unsigned short) prefix->nbytesAuthString,
+ auth_string);
- return(SendConnSetup(client, reason));
+ return (SendConnSetup(client, reason));
}
void
-SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
+SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
XID resId, int errorCode)
{
xError rep;
@@ -3784,7 +3675,7 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
rep.minorCode = minorCode;
rep.resourceID = resId;
- WriteEventsToClient (client, 1, (xEvent *)&rep);
+ WriteEventsToClient(client, 1, (xEvent *) &rep);
}
void
@@ -3799,15 +3690,15 @@ MarkClientException(ClientPtr client)
* Note that ~0 is an invalid entry (mostly for the benefit of the reader).
*/
static int answer[6][4] = {
- /* pad pad pad pad*/
- /* 8 16 32 64 */
-
- { 3, 4, 5 , 6 }, /* 1 bit per pixel */
- { 1, 2, 3 , 4 }, /* 4 bits per pixel */
- { 0, 1, 2 , 3 }, /* 8 bits per pixel */
- { ~0, 0, 1 , 2 }, /* 16 bits per pixel */
- { ~0, ~0, 0 , 1 }, /* 24 bits per pixel */
- { ~0, ~0, 0 , 1 } /* 32 bits per pixel */
+ /* pad pad pad pad */
+ /* 8 16 32 64 */
+
+ {3, 4, 5, 6}, /* 1 bit per pixel */
+ {1, 2, 3, 4}, /* 4 bits per pixel */
+ {0, 1, 2, 3}, /* 8 bits per pixel */
+ {~0, 0, 1, 2}, /* 16 bits per pixel */
+ {~0, ~0, 0, 1}, /* 24 bits per pixel */
+ {~0, ~0, 0, 1} /* 32 bits per pixel */
};
/*
@@ -3815,32 +3706,32 @@ static int answer[6][4] = {
* the answer array above given the number of bits per pixel?"
* Note that ~0 is an invalid entry (mostly for the benefit of the reader).
*/
-static int indexForBitsPerPixel[ 33 ] = {
- ~0, 0, ~0, ~0, /* 1 bit per pixel */
- 1, ~0, ~0, ~0, /* 4 bits per pixel */
- 2, ~0, ~0, ~0, /* 8 bits per pixel */
- ~0,~0, ~0, ~0,
- 3, ~0, ~0, ~0, /* 16 bits per pixel */
- ~0,~0, ~0, ~0,
- 4, ~0, ~0, ~0, /* 24 bits per pixel */
- ~0,~0, ~0, ~0,
- 5 /* 32 bits per pixel */
+static int indexForBitsPerPixel[33] = {
+ ~0, 0, ~0, ~0, /* 1 bit per pixel */
+ 1, ~0, ~0, ~0, /* 4 bits per pixel */
+ 2, ~0, ~0, ~0, /* 8 bits per pixel */
+ ~0, ~0, ~0, ~0,
+ 3, ~0, ~0, ~0, /* 16 bits per pixel */
+ ~0, ~0, ~0, ~0,
+ 4, ~0, ~0, ~0, /* 24 bits per pixel */
+ ~0, ~0, ~0, ~0,
+ 5 /* 32 bits per pixel */
};
/*
* This array gives the bytesperPixel value for cases where the number
* of bits per pixel is a multiple of 8 but not a power of 2.
*/
-static int answerBytesPerPixel[ 33 ] = {
- ~0, 0, ~0, ~0, /* 1 bit per pixel */
- 0, ~0, ~0, ~0, /* 4 bits per pixel */
- 0, ~0, ~0, ~0, /* 8 bits per pixel */
- ~0,~0, ~0, ~0,
- 0, ~0, ~0, ~0, /* 16 bits per pixel */
- ~0,~0, ~0, ~0,
- 3, ~0, ~0, ~0, /* 24 bits per pixel */
- ~0,~0, ~0, ~0,
- 0 /* 32 bits per pixel */
+static int answerBytesPerPixel[33] = {
+ ~0, 0, ~0, ~0, /* 1 bit per pixel */
+ 0, ~0, ~0, ~0, /* 4 bits per pixel */
+ 0, ~0, ~0, ~0, /* 8 bits per pixel */
+ ~0, ~0, ~0, ~0,
+ 0, ~0, ~0, ~0, /* 16 bits per pixel */
+ ~0, ~0, ~0, ~0,
+ 3, ~0, ~0, ~0, /* 24 bits per pixel */
+ ~0, ~0, ~0, ~0,
+ 0 /* 32 bits per pixel */
};
/*
@@ -3848,24 +3739,24 @@ static int answerBytesPerPixel[ 33 ] = {
* the answer array above given the number of bits per scanline pad unit?"
* Note that ~0 is an invalid entry (mostly for the benefit of the reader).
*/
-static int indexForScanlinePad[ 65 ] = {
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- 0, ~0, ~0, ~0, /* 8 bits per scanline pad unit */
- ~0, ~0, ~0, ~0,
- 1, ~0, ~0, ~0, /* 16 bits per scanline pad unit */
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- 2, ~0, ~0, ~0, /* 32 bits per scanline pad unit */
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0,
- 3 /* 64 bits per scanline pad unit */
+static int indexForScanlinePad[65] = {
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ 0, ~0, ~0, ~0, /* 8 bits per scanline pad unit */
+ ~0, ~0, ~0, ~0,
+ 1, ~0, ~0, ~0, /* 16 bits per scanline pad unit */
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ 2, ~0, ~0, ~0, /* 32 bits per scanline pad unit */
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ 3 /* 64 bits per scanline pad unit */
};
/*
@@ -3877,15 +3768,11 @@ with its screen number, a pointer to its ScreenRec, argc, and argv.
*/
int
-AddScreen(
- Bool (* pfnInit)(
- int /*index*/,
- ScreenPtr /*pScreen*/,
- int /*argc*/,
- char ** /*argv*/
- ),
- int argc,
- char **argv)
+AddScreen(Bool (*pfnInit) (int /*index */ ,
+ ScreenPtr /*pScreen */ ,
+ int /*argc */ ,
+ char ** /*argv */
+ ), int argc, char **argv)
{
int i;
@@ -3894,19 +3781,19 @@ AddScreen(
i = screenInfo.numScreens;
if (i == MAXSCREENS)
- return -1;
+ return -1;
pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
if (!pScreen)
- return -1;
+ return -1;
if (!dixAllocatePrivates(&pScreen->devPrivates, PRIVATE_SCREEN)) {
- free (pScreen);
- return -1;
+ free(pScreen);
+ return -1;
}
pScreen->myNum = i;
- pScreen->totalPixmapSize = 0; /* computed in CreateScratchPixmapForScreen */
- pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
+ pScreen->totalPixmapSize = 0; /* computed in CreateScratchPixmapForScreen */
+ pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
pScreen->CreateScreenResources = 0;
/*
@@ -3918,29 +3805,26 @@ AddScreen(
* Anyway, this must be called after InitOutput and before the
* screen init routine is called.
*/
- for (format=0; format<screenInfo.numPixmapFormats; format++)
- {
- depth = screenInfo.formats[format].depth;
- bitsPerPixel = screenInfo.formats[format].bitsPerPixel;
- scanlinepad = screenInfo.formats[format].scanlinePad;
- j = indexForBitsPerPixel[ bitsPerPixel ];
- k = indexForScanlinePad[ scanlinepad ];
- PixmapWidthPaddingInfo[ depth ].padPixelsLog2 = answer[j][k];
- PixmapWidthPaddingInfo[ depth ].padRoundUp =
- (scanlinepad/bitsPerPixel) - 1;
- j = indexForBitsPerPixel[ 8 ]; /* bits per byte */
- PixmapWidthPaddingInfo[ depth ].padBytesLog2 = answer[j][k];
- PixmapWidthPaddingInfo[ depth ].bitsPerPixel = bitsPerPixel;
- if (answerBytesPerPixel[bitsPerPixel])
- {
- PixmapWidthPaddingInfo[ depth ].notPower2 = 1;
- PixmapWidthPaddingInfo[ depth ].bytesPerPixel =
- answerBytesPerPixel[bitsPerPixel];
- }
- else
- {
- PixmapWidthPaddingInfo[ depth ].notPower2 = 0;
- }
+ for (format = 0; format < screenInfo.numPixmapFormats; format++) {
+ depth = screenInfo.formats[format].depth;
+ bitsPerPixel = screenInfo.formats[format].bitsPerPixel;
+ scanlinepad = screenInfo.formats[format].scanlinePad;
+ j = indexForBitsPerPixel[bitsPerPixel];
+ k = indexForScanlinePad[scanlinepad];
+ PixmapWidthPaddingInfo[depth].padPixelsLog2 = answer[j][k];
+ PixmapWidthPaddingInfo[depth].padRoundUp =
+ (scanlinepad / bitsPerPixel) - 1;
+ j = indexForBitsPerPixel[8]; /* bits per byte */
+ PixmapWidthPaddingInfo[depth].padBytesLog2 = answer[j][k];
+ PixmapWidthPaddingInfo[depth].bitsPerPixel = bitsPerPixel;
+ if (answerBytesPerPixel[bitsPerPixel]) {
+ PixmapWidthPaddingInfo[depth].notPower2 = 1;
+ PixmapWidthPaddingInfo[depth].bytesPerPixel =
+ answerBytesPerPixel[bitsPerPixel];
+ }
+ else {
+ PixmapWidthPaddingInfo[depth].notPower2 = 0;
+ }
}
/* This is where screen specific stuff gets initialized. Load the
@@ -3950,20 +3834,20 @@ AddScreen(
Note that InitScreen is NOT allowed to modify argc, argv, or
any of the strings pointed to by argv. They may be passed to
multiple screens.
- */
+ */
screenInfo.screens[i] = pScreen;
screenInfo.numScreens++;
- if (!(*pfnInit)(i, pScreen, argc, argv))
- {
- dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
- free(pScreen);
- screenInfo.numScreens--;
- return -1;
+ if (!(*pfnInit) (i, pScreen, argc, argv)) {
+ dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
+ free(pScreen);
+ screenInfo.numScreens--;
+ return -1;
}
update_desktop_dimensions();
- dixRegisterScreenPrivateKey(&cursorScreenDevPriv, pScreen, PRIVATE_CURSOR, 0);
+ dixRegisterScreenPrivateKey(&cursorScreenDevPriv, pScreen, PRIVATE_CURSOR,
+ 0);
return i;
}
diff --git a/xorg-server/dix/dixfonts.c b/xorg-server/dix/dixfonts.c
index efc3c09ce..eb2c98c4b 100644
--- a/xorg-server/dix/dixfonts.c
+++ b/xorg-server/dix/dixfonts.c
@@ -74,14 +74,14 @@ extern pointer fosNaturalParams;
extern FontPtr defaultFont;
static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0;
-static int num_fpes = 0;
+static int num_fpes = 0;
static FPEFunctions *fpe_functions = (FPEFunctions *) 0;
-static int num_fpe_types = 0;
+static int num_fpe_types = 0;
static unsigned char *font_path_string;
-static int num_slept_fpes = 0;
-static int size_slept_fpes = 0;
+static int num_slept_fpes = 0;
+static int size_slept_fpes = 0;
static FontPathElementPtr *slept_fpes = (FontPathElementPtr *) 0;
static FontPatternCachePtr patternCache;
@@ -90,29 +90,29 @@ FontToXError(int err)
{
switch (err) {
case Successful:
- return Success;
+ return Success;
case AllocError:
- return BadAlloc;
+ return BadAlloc;
case BadFontName:
- return BadName;
+ return BadName;
case BadFontPath:
- case BadFontFormat: /* is there something better? */
+ case BadFontFormat: /* is there something better? */
case BadCharRange:
- return BadValue;
+ return BadValue;
default:
- return err;
+ return err;
}
}
static int
LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned nchars, int item_size,
- unsigned char *data)
+ unsigned char *data)
{
if (fpe_functions[pfont->fpe->type].load_glyphs)
- return (*fpe_functions[pfont->fpe->type].load_glyphs)
- (client, pfont, 0, nchars, item_size, data);
+ return (*fpe_functions[pfont->fpe->type].load_glyphs)
+ (client, pfont, 0, nchars, item_size, data);
else
- return Successful;
+ return Successful;
}
/*
@@ -121,21 +121,21 @@ LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned nchars, int item_size,
Bool
SetDefaultFont(char *defaultfontname)
{
- int err;
- FontPtr pf;
- XID fid;
+ int err;
+ FontPtr pf;
+ XID fid;
static FontPtr last_pf;
fid = FakeClientID(0);
err = OpenFont(serverClient, fid, FontLoadAll | FontOpenSync,
- (unsigned) strlen(defaultfontname), defaultfontname);
+ (unsigned) strlen(defaultfontname), defaultfontname);
if (err != Success)
- return FALSE;
- err = dixLookupResourceByType((pointer *)&pf, fid, RT_FONT, serverClient,
- DixReadAccess);
+ return FALSE;
+ err = dixLookupResourceByType((pointer *) &pf, fid, RT_FONT, serverClient,
+ DixReadAccess);
if (err == Success) last_pf = pf;
if (last_pf == (FontPtr) NULL)
- return FALSE;
+ return FALSE;
defaultFont = last_pf;
return TRUE;
}
@@ -152,22 +152,22 @@ SetDefaultFont(char *defaultfontname)
void
QueueFontWakeup(FontPathElementPtr fpe)
{
- int i;
+ int i;
FontPathElementPtr *new;
for (i = 0; i < num_slept_fpes; i++) {
- if (slept_fpes[i] == fpe) {
- return;
- }
+ if (slept_fpes[i] == fpe) {
+ return;
+ }
}
if (num_slept_fpes == size_slept_fpes) {
- new = (FontPathElementPtr *)
- realloc(slept_fpes,
- sizeof(FontPathElementPtr) * (size_slept_fpes + 4));
- if (!new)
- return;
- slept_fpes = new;
- size_slept_fpes += 4;
+ new = (FontPathElementPtr *)
+ realloc(slept_fpes,
+ sizeof(FontPathElementPtr) * (size_slept_fpes + 4));
+ if (!new)
+ return;
+ slept_fpes = new;
+ size_slept_fpes += 4;
}
slept_fpes[num_slept_fpes] = fpe;
num_slept_fpes++;
@@ -176,32 +176,31 @@ QueueFontWakeup(FontPathElementPtr fpe)
void
RemoveFontWakeup(FontPathElementPtr fpe)
{
- int i,
- j;
+ int i, j;
for (i = 0; i < num_slept_fpes; i++) {
- if (slept_fpes[i] == fpe) {
- for (j = i; j < num_slept_fpes; j++) {
- slept_fpes[j] = slept_fpes[j + 1];
- }
- num_slept_fpes--;
- return;
- }
+ if (slept_fpes[i] == fpe) {
+ for (j = i; j < num_slept_fpes; j++) {
+ slept_fpes[j] = slept_fpes[j + 1];
+ }
+ num_slept_fpes--;
+ return;
+ }
}
}
void
FontWakeup(pointer data, int count, pointer LastSelectMask)
{
- int i;
+ int i;
FontPathElementPtr fpe;
if (count < 0)
- return;
+ return;
/* wake up any fpe's that may be waiting for information */
for (i = 0; i < num_slept_fpes; i++) {
- fpe = slept_fpes[i];
- (void) (*fpe_functions[fpe->type].wakeup_fpe) (fpe, LastSelectMask);
+ fpe = slept_fpes[i];
+ (void) (*fpe_functions[fpe->type].wakeup_fpe) (fpe, LastSelectMask);
}
}
@@ -213,227 +212,212 @@ UseFPE(FontPathElementPtr fpe)
}
static void
-FreeFPE (FontPathElementPtr fpe)
+FreeFPE(FontPathElementPtr fpe)
{
fpe->refcount--;
if (fpe->refcount == 0) {
- (*fpe_functions[fpe->type].free_fpe) (fpe);
- free(fpe->name);
- free(fpe);
+ (*fpe_functions[fpe->type].free_fpe) (fpe);
+ free(fpe->name);
+ free(fpe);
}
}
static Bool
doOpenFont(ClientPtr client, OFclosurePtr c)
{
- FontPtr pfont = NullFont;
+ FontPtr pfont = NullFont;
FontPathElementPtr fpe = NULL;
- ScreenPtr pScr;
- int err = Successful;
- int i;
- char *alias,
- *newname;
- int newlen;
- int aliascount = 20;
- Bool fromDispatch = c->from_dispatch;
- Bool finished = FALSE;
+ ScreenPtr pScr;
+ int err = Successful;
+ int i;
+ char *alias, *newname;
+ int newlen;
+ int aliascount = 20;
+ Bool fromDispatch = c->from_dispatch;
+ Bool finished = FALSE;
/*
* Decide at runtime what FontFormat to use.
*/
- Mask FontFormat =
-
- ((screenInfo.imageByteOrder == LSBFirst) ?
- BitmapFormatByteOrderLSB : BitmapFormatByteOrderMSB) |
-
- ((screenInfo.bitmapBitOrder == LSBFirst) ?
- BitmapFormatBitOrderLSB : BitmapFormatBitOrderMSB) |
-
- BitmapFormatImageRectMin |
-
+ Mask FontFormat =
+ ((screenInfo.imageByteOrder == LSBFirst) ?
+ BitmapFormatByteOrderLSB : BitmapFormatByteOrderMSB) |
+ ((screenInfo.bitmapBitOrder == LSBFirst) ?
+ BitmapFormatBitOrderLSB : BitmapFormatBitOrderMSB) |
+ BitmapFormatImageRectMin |
#if GLYPHPADBYTES == 1
- BitmapFormatScanlinePad8 |
+ BitmapFormatScanlinePad8 |
#endif
-
#if GLYPHPADBYTES == 2
- BitmapFormatScanlinePad16 |
+ BitmapFormatScanlinePad16 |
#endif
-
#if GLYPHPADBYTES == 4
- BitmapFormatScanlinePad32 |
+ BitmapFormatScanlinePad32 |
#endif
-
#if GLYPHPADBYTES == 8
- BitmapFormatScanlinePad64 |
+ BitmapFormatScanlinePad64 |
#endif
-
- BitmapFormatScanlineUnit8;
+ BitmapFormatScanlineUnit8;
c->from_dispatch = FALSE;
- if (client->clientGone)
- {
- if (c->current_fpe < c->num_fpes)
- {
- fpe = c->fpe_list[c->current_fpe];
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- }
- err = Successful;
- goto bail;
+ if (client->clientGone) {
+ if (c->current_fpe < c->num_fpes) {
+ fpe = c->fpe_list[c->current_fpe];
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ }
+ err = Successful;
+ goto bail;
}
while (c->current_fpe < c->num_fpes) {
- fpe = c->fpe_list[c->current_fpe];
- err = (*fpe_functions[fpe->type].open_font)
- ((pointer) client, fpe, c->flags,
- c->fontname, c->fnamelen, FontFormat,
- BitmapFormatMaskByte |
- BitmapFormatMaskBit |
- BitmapFormatMaskImageRectangle |
- BitmapFormatMaskScanLinePad |
- BitmapFormatMaskScanLineUnit,
- c->fontid, &pfont, &alias,
- c->non_cachable_font && c->non_cachable_font->fpe == fpe ?
- c->non_cachable_font :
- (FontPtr)0);
-
- if (err == FontNameAlias && alias) {
- newlen = strlen(alias);
- newname = (char *) realloc(c->fontname, newlen);
- if (!newname) {
- err = AllocError;
- break;
- }
- memmove(newname, alias, newlen);
- c->fontname = newname;
- c->fnamelen = newlen;
- c->current_fpe = 0;
- if (--aliascount <= 0) {
- /* We've tried resolving this alias 20 times, we're
- * probably stuck in an infinite loop of aliases pointing
- * to each other - time to take emergency exit!
- */
- err = BadImplementation;
- break;
- }
- continue;
- }
- if (err == BadFontName) {
- c->current_fpe++;
- continue;
- }
- if (err == Suspended) {
- if (!ClientIsAsleep(client))
- ClientSleep(client, (ClientSleepProcPtr)doOpenFont, c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
- break;
+ fpe = c->fpe_list[c->current_fpe];
+ err = (*fpe_functions[fpe->type].open_font)
+ ((pointer) client, fpe, c->flags,
+ c->fontname, c->fnamelen, FontFormat,
+ BitmapFormatMaskByte |
+ BitmapFormatMaskBit |
+ BitmapFormatMaskImageRectangle |
+ BitmapFormatMaskScanLinePad |
+ BitmapFormatMaskScanLineUnit,
+ c->fontid, &pfont, &alias,
+ c->non_cachable_font && c->non_cachable_font->fpe == fpe ?
+ c->non_cachable_font : (FontPtr) 0);
+
+ if (err == FontNameAlias && alias) {
+ newlen = strlen(alias);
+ newname = (char *) realloc(c->fontname, newlen);
+ if (!newname) {
+ err = AllocError;
+ break;
+ }
+ memmove(newname, alias, newlen);
+ c->fontname = newname;
+ c->fnamelen = newlen;
+ c->current_fpe = 0;
+ if (--aliascount <= 0) {
+ /* We've tried resolving this alias 20 times, we're
+ * probably stuck in an infinite loop of aliases pointing
+ * to each other - time to take emergency exit!
+ */
+ err = BadImplementation;
+ break;
+ }
+ continue;
+ }
+ if (err == BadFontName) {
+ c->current_fpe++;
+ continue;
+ }
+ if (err == Suspended) {
+ if (!ClientIsAsleep(client))
+ ClientSleep(client, (ClientSleepProcPtr) doOpenFont, c);
+ else
+ goto xinerama_sleep;
+ return TRUE;
+ }
+ break;
}
if (err != Successful)
- goto bail;
+ goto bail;
if (!pfont) {
- err = BadFontName;
- goto bail;
+ err = BadFontName;
+ goto bail;
}
/* check values for firstCol, lastCol, firstRow, and lastRow */
if (pfont->info.firstCol > pfont->info.lastCol ||
- pfont->info.firstRow > pfont->info.lastRow ||
- pfont->info.lastCol - pfont->info.firstCol > 255) {
- err = AllocError;
- goto bail;
+ pfont->info.firstRow > pfont->info.lastRow ||
+ pfont->info.lastCol - pfont->info.firstCol > 255) {
+ err = AllocError;
+ goto bail;
}
if (!pfont->fpe)
- pfont->fpe = fpe;
+ pfont->fpe = fpe;
pfont->refcnt++;
if (pfont->refcnt == 1) {
- UseFPE(pfont->fpe);
- for (i = 0; i < screenInfo.numScreens; i++) {
- pScr = screenInfo.screens[i];
- if (pScr->RealizeFont)
- {
- if (!(*pScr->RealizeFont) (pScr, pfont))
- {
- CloseFont (pfont, (Font) 0);
- err = AllocError;
- goto bail;
- }
- }
- }
+ UseFPE(pfont->fpe);
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pScr = screenInfo.screens[i];
+ if (pScr->RealizeFont) {
+ if (!(*pScr->RealizeFont) (pScr, pfont)) {
+ CloseFont(pfont, (Font) 0);
+ err = AllocError;
+ goto bail;
+ }
+ }
+ }
}
if (!AddResource(c->fontid, RT_FONT, (pointer) pfont)) {
- err = AllocError;
- goto bail;
+ err = AllocError;
+ goto bail;
}
if (patternCache && pfont != c->non_cachable_font)
- CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen,
- pfont);
-bail:
+ CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen,
+ pfont);
+ bail:
if (err != Successful && c->client != serverClient) {
- SendErrorToClient(c->client, X_OpenFont, 0,
- c->fontid, FontToXError(err));
+ SendErrorToClient(c->client, X_OpenFont, 0,
+ c->fontid, FontToXError(err));
}
ClientWakeup(c->client);
finished = TRUE;
-xinerama_sleep:
+ xinerama_sleep:
if (finished || fromDispatch) {
- for (i = 0; i < c->num_fpes; i++) {
- FreeFPE(c->fpe_list[i]);
- }
- free(c->fpe_list);
- free(c->fontname);
- free(c);
+ for (i = 0; i < c->num_fpes; i++) {
+ FreeFPE(c->fpe_list[i]);
+ }
+ free(c->fpe_list);
+ free(c->fontname);
+ free(c);
}
return TRUE;
}
int
-OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontname)
+OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
+ char *pfontname)
{
OFclosurePtr c;
- int i;
- FontPtr cached = (FontPtr)0;
+ int i;
+ FontPtr cached = (FontPtr) 0;
if (!lenfname || lenfname > XLFDMAXFONTNAMELEN)
- return BadName;
- if (patternCache)
- {
+ return BadName;
+ if (patternCache) {
- /*
- ** Check name cache. If we find a cached version of this font that
- ** is cachable, immediately satisfy the request with it. If we find
- ** a cached version of this font that is non-cachable, we do not
- ** satisfy the request with it. Instead, we pass the FontPtr to the
- ** FPE's open_font code (the fontfile FPE in turn passes the
- ** information to the rasterizer; the fserve FPE ignores it).
- **
- ** Presumably, the font is marked non-cachable because the FPE has
- ** put some licensing restrictions on it. If the FPE, using
- ** whatever logic it relies on, determines that it is willing to
- ** share this existing font with the client, then it has the option
- ** to return the FontPtr we passed it as the newly-opened font.
- ** This allows the FPE to exercise its licensing logic without
- ** having to create another instance of a font that already exists.
- */
-
- cached = FindCachedFontPattern(patternCache, pfontname, lenfname);
- if (cached && cached->info.cachable)
- {
- if (!AddResource(fid, RT_FONT, (pointer) cached))
- return BadAlloc;
- cached->refcnt++;
- return Success;
- }
+ /*
+ ** Check name cache. If we find a cached version of this font that
+ ** is cachable, immediately satisfy the request with it. If we find
+ ** a cached version of this font that is non-cachable, we do not
+ ** satisfy the request with it. Instead, we pass the FontPtr to the
+ ** FPE's open_font code (the fontfile FPE in turn passes the
+ ** information to the rasterizer; the fserve FPE ignores it).
+ **
+ ** Presumably, the font is marked non-cachable because the FPE has
+ ** put some licensing restrictions on it. If the FPE, using
+ ** whatever logic it relies on, determines that it is willing to
+ ** share this existing font with the client, then it has the option
+ ** to return the FontPtr we passed it as the newly-opened font.
+ ** This allows the FPE to exercise its licensing logic without
+ ** having to create another instance of a font that already exists.
+ */
+
+ cached = FindCachedFontPattern(patternCache, pfontname, lenfname);
+ if (cached && cached->info.cachable) {
+ if (!AddResource(fid, RT_FONT, (pointer) cached))
+ return BadAlloc;
+ cached->refcnt++;
+ return Success;
+ }
}
c = malloc(sizeof(OFclosureRec));
if (!c)
- return BadAlloc;
+ return BadAlloc;
c->fontname = malloc(lenfname);
c->origFontName = pfontname;
c->origFontNameLen = lenfname;
if (!c->fontname) {
- free(c);
- return BadAlloc;
+ free(c);
+ return BadAlloc;
}
/*
* copy the current FPE list, so that if it gets changed by another client
@@ -441,14 +425,14 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna
*/
c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes);
if (!c->fpe_list) {
- free(c->fontname);
- free(c);
- return BadAlloc;
+ free(c->fontname);
+ free(c);
+ return BadAlloc;
}
memmove(c->fontname, pfontname, lenfname);
for (i = 0; i < num_fpes; i++) {
- c->fpe_list[i] = font_path_elements[i];
- UseFPE(c->fpe_list[i]);
+ c->fpe_list[i] = font_path_elements[i];
+ UseFPE(c->fpe_list[i]);
}
c->client = client;
c->fontid = fid;
@@ -471,38 +455,37 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna
int
CloseFont(pointer value, XID fid)
{
- int nscr;
- ScreenPtr pscr;
+ int nscr;
+ ScreenPtr pscr;
FontPathElementPtr fpe;
- FontPtr pfont = (FontPtr)value;
+ FontPtr pfont = (FontPtr) value;
if (pfont == NullFont)
- return Success;
+ return Success;
if (--pfont->refcnt == 0) {
- if (patternCache)
- RemoveCachedFontPattern (patternCache, pfont);
- /*
- * since the last reference is gone, ask each screen to free any
- * storage it may have allocated locally for it.
- */
- for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
- pscr = screenInfo.screens[nscr];
- if (pscr->UnrealizeFont)
- (*pscr->UnrealizeFont) (pscr, pfont);
- }
- if (pfont == defaultFont)
- defaultFont = NULL;
+ if (patternCache)
+ RemoveCachedFontPattern(patternCache, pfont);
+ /*
+ * since the last reference is gone, ask each screen to free any
+ * storage it may have allocated locally for it.
+ */
+ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
+ pscr = screenInfo.screens[nscr];
+ if (pscr->UnrealizeFont)
+ (*pscr->UnrealizeFont) (pscr, pfont);
+ }
+ if (pfont == defaultFont)
+ defaultFont = NULL;
#ifdef XF86BIGFONT
- XF86BigfontFreeFontShm(pfont);
+ XF86BigfontFreeFontShm(pfont);
#endif
- fpe = pfont->fpe;
- (*fpe_functions[fpe->type].close_font) (fpe, pfont);
- FreeFPE(fpe);
+ fpe = pfont->fpe;
+ (*fpe_functions[fpe->type].close_font) (fpe, pfont);
+ FreeFPE(fpe);
}
return Success;
}
-
/***====================================================================***/
/**
@@ -512,19 +495,17 @@ CloseFont(pointer value, XID fid)
* \param pReply caller must allocate this storage
*/
void
-QueryFont(FontPtr pFont, xQueryFontReply *pReply, int nProtoCCIStructs)
+QueryFont(FontPtr pFont, xQueryFontReply * pReply, int nProtoCCIStructs)
{
- FontPropPtr pFP;
- int r,
- c,
- i;
- xFontProp *prFP;
- xCharInfo *prCI;
- xCharInfo *charInfos[256];
- unsigned char chars[512];
- int ninfos;
- unsigned long ncols;
- unsigned long count;
+ FontPropPtr pFP;
+ int r, c, i;
+ xFontProp *prFP;
+ xCharInfo *prCI;
+ xCharInfo *charInfos[256];
+ unsigned char chars[512];
+ int ninfos;
+ unsigned long ncols;
+ unsigned long count;
/* pr->length set in dispatch */
pReply->minCharOrByte2 = pFont->info.firstCol;
@@ -544,31 +525,29 @@ QueryFont(FontPtr pFont, xQueryFontReply *pReply, int nProtoCCIStructs)
pReply->nCharInfos = nProtoCCIStructs;
for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) (&pReply[1]);
- i < pFont->info.nprops;
- i++, pFP++, prFP++) {
- prFP->name = pFP->name;
- prFP->value = pFP->value;
+ i < pFont->info.nprops; i++, pFP++, prFP++) {
+ prFP->name = pFP->name;
+ prFP->value = pFP->value;
}
ninfos = 0;
ncols = (unsigned long) (pFont->info.lastCol - pFont->info.firstCol + 1);
prCI = (xCharInfo *) (prFP);
for (r = pFont->info.firstRow;
- ninfos < nProtoCCIStructs && r <= (int)pFont->info.lastRow;
- r++) {
- i = 0;
- for (c = pFont->info.firstCol; c <= (int)pFont->info.lastCol; c++) {
- chars[i++] = r;
- chars[i++] = c;
- }
- (*pFont->get_metrics) (pFont, ncols, chars,
- TwoD16Bit, &count, charInfos);
- i = 0;
- for (i = 0; i < (int) count && ninfos < nProtoCCIStructs; i++) {
- *prCI = *charInfos[i];
- prCI++;
- ninfos++;
- }
+ ninfos < nProtoCCIStructs && r <= (int) pFont->info.lastRow; r++) {
+ i = 0;
+ for (c = pFont->info.firstCol; c <= (int) pFont->info.lastCol; c++) {
+ chars[i++] = r;
+ chars[i++] = c;
+ }
+ (*pFont->get_metrics) (pFont, ncols, chars,
+ TwoD16Bit, &count, charInfos);
+ i = 0;
+ for (i = 0; i < (int) count && ninfos < nProtoCCIStructs; i++) {
+ *prCI = *charInfos[i];
+ prCI++;
+ ninfos++;
+ }
}
return;
}
@@ -577,215 +556,206 @@ static Bool
doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
{
FontPathElementPtr fpe;
- int err = Successful;
+ int err = Successful;
FontNamesPtr names = NULL;
- char *name, *resolved=NULL;
- int namelen, resolvedlen;
- int nnames;
- int stringLens;
- int i;
+ char *name, *resolved = NULL;
+ int namelen, resolvedlen;
+ int nnames;
+ int stringLens;
+ int i;
xListFontsReply reply;
- char *bufptr;
- char *bufferStart;
- int aliascount = 0;
- Bool fromDispatch = c->from_dispatch;
- Bool finished = FALSE;
+ char *bufptr;
+ char *bufferStart;
+ int aliascount = 0;
+ Bool fromDispatch = c->from_dispatch;
+ Bool finished = FALSE;
c->from_dispatch = FALSE;
- if (client->clientGone)
- {
- if (c->current.current_fpe < c->num_fpes)
- {
- fpe = c->fpe_list[c->current.current_fpe];
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- }
- err = Successful;
- goto bail;
+ if (client->clientGone) {
+ if (c->current.current_fpe < c->num_fpes) {
+ fpe = c->fpe_list[c->current.current_fpe];
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ }
+ err = Successful;
+ goto bail;
}
if (!c->current.patlen)
- goto finish;
+ goto finish;
while (c->current.current_fpe < c->num_fpes) {
- fpe = c->fpe_list[c->current.current_fpe];
- err = Successful;
-
- if (!fpe_functions[fpe->type].start_list_fonts_and_aliases)
- {
- /* This FPE doesn't support/require list_fonts_and_aliases */
-
- err = (*fpe_functions[fpe->type].list_fonts)
- ((pointer) c->client, fpe, c->current.pattern,
- c->current.patlen, c->current.max_names - c->names->nnames,
- c->names);
-
- if (err == Suspended) {
- if (!ClientIsAsleep(client))
- ClientSleep(client,
- (ClientSleepProcPtr)doListFontsAndAliases,
- c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
-
- err = BadFontName;
- }
- else
- {
- /* Start of list_fonts_and_aliases functionality. Modeled
- after list_fonts_with_info in that it resolves aliases,
- except that the information collected from FPEs is just
- names, not font info. Each list_next_font_or_alias()
- returns either a name into name/namelen or an alias into
- name/namelen and its target name into resolved/resolvedlen.
- The code at this level then resolves the alias by polling
- the FPEs. */
-
- if (!c->current.list_started) {
- err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases)
- ((pointer) c->client, fpe, c->current.pattern,
- c->current.patlen, c->current.max_names - c->names->nnames,
- &c->current.private);
- if (err == Suspended) {
- if (!ClientIsAsleep(client))
- ClientSleep(client,
- (ClientSleepProcPtr)doListFontsAndAliases,
- c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
- if (err == Successful)
- c->current.list_started = TRUE;
- }
- if (err == Successful) {
- char *tmpname;
- name = 0;
- err = (*fpe_functions[fpe->type].list_next_font_or_alias)
- ((pointer) c->client, fpe, &name, &namelen, &tmpname,
- &resolvedlen, c->current.private);
- if (err == Suspended) {
- if (!ClientIsAsleep(client))
- ClientSleep(client,
- (ClientSleepProcPtr)doListFontsAndAliases,
- c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
- if (err == FontNameAlias) {
- free(resolved);
- resolved = malloc(resolvedlen + 1);
- if (resolved)
- memmove(resolved, tmpname, resolvedlen + 1);
- }
- }
-
- if (err == Successful)
- {
- if (c->haveSaved)
- {
- if (c->savedName)
- (void)AddFontNamesName(c->names, c->savedName,
- c->savedNameLen);
- }
- else
- (void)AddFontNamesName(c->names, name, namelen);
- }
-
- /*
- * When we get an alias back, save our state and reset back to
- * the start of the FPE looking for the specified name. As
- * soon as a real font is found for the alias, pop back to the
- * old state
- */
- else if (err == FontNameAlias) {
- char tmp_pattern[XLFDMAXFONTNAMELEN];
- /*
- * when an alias recurses, we need to give
- * the last FPE a chance to clean up; so we call
- * it again, and assume that the error returned
- * is BadFontName, indicating the alias resolution
- * is complete.
- */
- memmove(tmp_pattern, resolved, resolvedlen);
- if (c->haveSaved)
- {
- char *tmpname;
- int tmpnamelen;
-
- tmpname = 0;
- (void) (*fpe_functions[fpe->type].list_next_font_or_alias)
- ((pointer) c->client, fpe, &tmpname, &tmpnamelen,
- &tmpname, &tmpnamelen, c->current.private);
- if (--aliascount <= 0)
- {
- err = BadFontName;
- goto ContBadFontName;
- }
- }
- else
- {
- c->saved = c->current;
- c->haveSaved = TRUE;
- free(c->savedName);
- c->savedName = malloc(namelen + 1);
- if (c->savedName)
- memmove(c->savedName, name, namelen + 1);
- c->savedNameLen = namelen;
- aliascount = 20;
- }
- memmove(c->current.pattern, tmp_pattern, resolvedlen);
- c->current.patlen = resolvedlen;
- c->current.max_names = c->names->nnames + 1;
- c->current.current_fpe = -1;
- c->current.private = 0;
- err = BadFontName;
- }
- }
- /*
- * At the end of this FPE, step to the next. If we've finished
- * processing an alias, pop state back. If we've collected enough
- * font names, quit.
- */
- if (err == BadFontName) {
- ContBadFontName: ;
- c->current.list_started = FALSE;
- c->current.current_fpe++;
- err = Successful;
- if (c->haveSaved)
- {
- if (c->names->nnames == c->current.max_names ||
- c->current.current_fpe == c->num_fpes) {
- c->haveSaved = FALSE;
- c->current = c->saved;
- /* Give the saved namelist a chance to clean itself up */
- continue;
- }
- }
- if (c->names->nnames == c->current.max_names)
- break;
- }
+ fpe = c->fpe_list[c->current.current_fpe];
+ err = Successful;
+
+ if (!fpe_functions[fpe->type].start_list_fonts_and_aliases) {
+ /* This FPE doesn't support/require list_fonts_and_aliases */
+
+ err = (*fpe_functions[fpe->type].list_fonts)
+ ((pointer) c->client, fpe, c->current.pattern,
+ c->current.patlen, c->current.max_names - c->names->nnames,
+ c->names);
+
+ if (err == Suspended) {
+ if (!ClientIsAsleep(client))
+ ClientSleep(client,
+ (ClientSleepProcPtr) doListFontsAndAliases, c);
+ else
+ goto xinerama_sleep;
+ return TRUE;
+ }
+
+ err = BadFontName;
+ }
+ else {
+ /* Start of list_fonts_and_aliases functionality. Modeled
+ after list_fonts_with_info in that it resolves aliases,
+ except that the information collected from FPEs is just
+ names, not font info. Each list_next_font_or_alias()
+ returns either a name into name/namelen or an alias into
+ name/namelen and its target name into resolved/resolvedlen.
+ The code at this level then resolves the alias by polling
+ the FPEs. */
+
+ if (!c->current.list_started) {
+ err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases)
+ ((pointer) c->client, fpe, c->current.pattern,
+ c->current.patlen, c->current.max_names - c->names->nnames,
+ &c->current.private);
+ if (err == Suspended) {
+ if (!ClientIsAsleep(client))
+ ClientSleep(client,
+ (ClientSleepProcPtr) doListFontsAndAliases,
+ c);
+ else
+ goto xinerama_sleep;
+ return TRUE;
+ }
+ if (err == Successful)
+ c->current.list_started = TRUE;
+ }
+ if (err == Successful) {
+ char *tmpname;
+
+ name = 0;
+ err = (*fpe_functions[fpe->type].list_next_font_or_alias)
+ ((pointer) c->client, fpe, &name, &namelen, &tmpname,
+ &resolvedlen, c->current.private);
+ if (err == Suspended) {
+ if (!ClientIsAsleep(client))
+ ClientSleep(client,
+ (ClientSleepProcPtr) doListFontsAndAliases,
+ c);
+ else
+ goto xinerama_sleep;
+ return TRUE;
+ }
+ if (err == FontNameAlias) {
+ free(resolved);
+ resolved = malloc(resolvedlen + 1);
+ if (resolved)
+ memmove(resolved, tmpname, resolvedlen + 1);
+ }
+ }
+
+ if (err == Successful) {
+ if (c->haveSaved) {
+ if (c->savedName)
+ (void) AddFontNamesName(c->names, c->savedName,
+ c->savedNameLen);
+ }
+ else
+ (void) AddFontNamesName(c->names, name, namelen);
+ }
+
+ /*
+ * When we get an alias back, save our state and reset back to
+ * the start of the FPE looking for the specified name. As
+ * soon as a real font is found for the alias, pop back to the
+ * old state
+ */
+ else if (err == FontNameAlias) {
+ char tmp_pattern[XLFDMAXFONTNAMELEN];
+
+ /*
+ * when an alias recurses, we need to give
+ * the last FPE a chance to clean up; so we call
+ * it again, and assume that the error returned
+ * is BadFontName, indicating the alias resolution
+ * is complete.
+ */
+ memmove(tmp_pattern, resolved, resolvedlen);
+ if (c->haveSaved) {
+ char *tmpname;
+ int tmpnamelen;
+
+ tmpname = 0;
+ (void) (*fpe_functions[fpe->type].list_next_font_or_alias)
+ ((pointer) c->client, fpe, &tmpname, &tmpnamelen,
+ &tmpname, &tmpnamelen, c->current.private);
+ if (--aliascount <= 0) {
+ err = BadFontName;
+ goto ContBadFontName;
+ }
+ }
+ else {
+ c->saved = c->current;
+ c->haveSaved = TRUE;
+ free(c->savedName);
+ c->savedName = malloc(namelen + 1);
+ if (c->savedName)
+ memmove(c->savedName, name, namelen + 1);
+ c->savedNameLen = namelen;
+ aliascount = 20;
+ }
+ memmove(c->current.pattern, tmp_pattern, resolvedlen);
+ c->current.patlen = resolvedlen;
+ c->current.max_names = c->names->nnames + 1;
+ c->current.current_fpe = -1;
+ c->current.private = 0;
+ err = BadFontName;
+ }
+ }
+ /*
+ * At the end of this FPE, step to the next. If we've finished
+ * processing an alias, pop state back. If we've collected enough
+ * font names, quit.
+ */
+ if (err == BadFontName) {
+ ContBadFontName:;
+ c->current.list_started = FALSE;
+ c->current.current_fpe++;
+ err = Successful;
+ if (c->haveSaved) {
+ if (c->names->nnames == c->current.max_names ||
+ c->current.current_fpe == c->num_fpes) {
+ c->haveSaved = FALSE;
+ c->current = c->saved;
+ /* Give the saved namelist a chance to clean itself up */
+ continue;
+ }
+ }
+ if (c->names->nnames == c->current.max_names)
+ break;
+ }
}
/*
* send the reply
*/
if (err != Successful) {
- SendErrorToClient(client, X_ListFonts, 0, 0, FontToXError(err));
- goto bail;
+ SendErrorToClient(client, X_ListFonts, 0, 0, FontToXError(err));
+ goto bail;
}
-finish:
+ finish:
names = c->names;
nnames = names->nnames;
client = c->client;
stringLens = 0;
for (i = 0; i < nnames; i++)
- stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
+ stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
memset(&reply, 0, sizeof(xListFontsReply));
reply.type = X_Reply;
@@ -796,22 +766,21 @@ finish:
bufptr = bufferStart = malloc(reply.length << 2);
if (!bufptr && reply.length) {
- SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
- goto bail;
+ SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
+ goto bail;
}
/*
* since WriteToClient long word aligns things, copy to temp buffer and
* write all at once
*/
for (i = 0; i < nnames; i++) {
- if (names->length[i] > 255)
- reply.nFonts--;
- else
- {
- *bufptr++ = names->length[i];
- memmove( bufptr, names->names[i], names->length[i]);
- bufptr += names->length[i];
- }
+ if (names->length[i] > 255)
+ reply.nFonts--;
+ else {
+ *bufptr++ = names->length[i];
+ memmove(bufptr, names->names[i], names->length[i]);
+ bufptr += names->length[i];
+ }
}
nnames = reply.nFonts;
reply.length = bytes_to_int32(stringLens + nnames);
@@ -820,27 +789,27 @@ finish:
(void) WriteToClient(client, stringLens + nnames, bufferStart);
free(bufferStart);
-bail:
+ bail:
ClientWakeup(client);
finished = TRUE;
-xinerama_sleep:
+ xinerama_sleep:
if (finished || fromDispatch) {
- for (i = 0; i < c->num_fpes; i++)
- FreeFPE(c->fpe_list[i]);
- free(c->fpe_list);
- free(c->savedName);
- FreeFontNames(names);
- free(c);
+ for (i = 0; i < c->num_fpes; i++)
+ FreeFPE(c->fpe_list[i]);
+ free(c->fpe_list);
+ free(c->savedName);
+ FreeFontNames(names);
+ free(c);
}
free(resolved);
return TRUE;
}
int
-ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
+ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
unsigned max_names)
{
- int i;
+ int i;
LFclosurePtr c;
/*
@@ -850,30 +819,29 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
* a list containing zero fontnames.
*/
if (length > XLFDMAXFONTNAMELEN)
- return BadAlloc;
+ return BadAlloc;
i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess);
if (i != Success)
- return i;
+ return i;
if (!(c = malloc(sizeof *c)))
- return BadAlloc;
+ return BadAlloc;
c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes);
if (!c->fpe_list) {
- free(c);
- return BadAlloc;
+ free(c);
+ return BadAlloc;
}
c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100);
- if (!c->names)
- {
- free(c->fpe_list);
- free(c);
- return BadAlloc;
+ if (!c->names) {
+ free(c->fpe_list);
+ free(c);
+ return BadAlloc;
}
- memmove( c->current.pattern, pattern, length);
+ memmove(c->current.pattern, pattern, length);
for (i = 0; i < num_fpes; i++) {
- c->fpe_list[i] = font_path_elements[i];
- UseFPE(c->fpe_list[i]);
+ c->fpe_list[i] = font_path_elements[i];
+ UseFPE(c->fpe_list[i]);
}
c->client = client;
c->num_fpes = num_fpes;
@@ -893,235 +861,214 @@ int
doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
{
FontPathElementPtr fpe;
- int err = Successful;
- char *name;
- Bool fromDispatch = c->from_dispatch;
- Bool finished = FALSE;
- int namelen;
- int numFonts;
- FontInfoRec fontInfo,
- *pFontInfo;
+ int err = Successful;
+ char *name;
+ Bool fromDispatch = c->from_dispatch;
+ Bool finished = FALSE;
+ int namelen;
+ int numFonts;
+ FontInfoRec fontInfo, *pFontInfo;
xListFontsWithInfoReply *reply;
- int length;
- xFontProp *pFP;
- int i;
- int aliascount = 0;
+ int length;
+ xFontProp *pFP;
+ int i;
+ int aliascount = 0;
xListFontsWithInfoReply finalReply;
c->from_dispatch = FALSE;
- if (client->clientGone)
- {
- if (c->current.current_fpe < c->num_fpes)
- {
- fpe = c->fpe_list[c->current.current_fpe];
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- }
- err = Successful;
- goto bail;
+ if (client->clientGone) {
+ if (c->current.current_fpe < c->num_fpes) {
+ fpe = c->fpe_list[c->current.current_fpe];
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ }
+ err = Successful;
+ goto bail;
}
client->pSwapReplyFunc = ReplySwapVector[X_ListFontsWithInfo];
if (!c->current.patlen)
- goto finish;
- while (c->current.current_fpe < c->num_fpes)
- {
- fpe = c->fpe_list[c->current.current_fpe];
- err = Successful;
- if (!c->current.list_started)
- {
- err = (*fpe_functions[fpe->type].start_list_fonts_with_info)
- (client, fpe, c->current.pattern, c->current.patlen,
- c->current.max_names, &c->current.private);
- if (err == Suspended)
- {
- if (!ClientIsAsleep(client))
- ClientSleep(client,
- (ClientSleepProcPtr)doListFontsWithInfo, c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
- if (err == Successful)
- c->current.list_started = TRUE;
- }
- if (err == Successful)
- {
- name = 0;
- pFontInfo = &fontInfo;
- err = (*fpe_functions[fpe->type].list_next_font_with_info)
- (client, fpe, &name, &namelen, &pFontInfo,
- &numFonts, c->current.private);
- if (err == Suspended)
- {
- if (!ClientIsAsleep(client))
- ClientSleep(client,
- (ClientSleepProcPtr)doListFontsWithInfo, c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
- }
- /*
- * When we get an alias back, save our state and reset back to the
- * start of the FPE looking for the specified name. As soon as a real
- * font is found for the alias, pop back to the old state
- */
- if (err == FontNameAlias)
- {
- /*
- * when an alias recurses, we need to give
- * the last FPE a chance to clean up; so we call
- * it again, and assume that the error returned
- * is BadFontName, indicating the alias resolution
- * is complete.
- */
- if (c->haveSaved)
- {
- char *tmpname;
- int tmpnamelen;
- FontInfoPtr tmpFontInfo;
-
- tmpname = 0;
- tmpFontInfo = &fontInfo;
- (void) (*fpe_functions[fpe->type].list_next_font_with_info)
- (client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo,
- &numFonts, c->current.private);
- if (--aliascount <= 0)
- {
- err = BadFontName;
- goto ContBadFontName;
- }
- }
- else
- {
- c->saved = c->current;
- c->haveSaved = TRUE;
- c->savedNumFonts = numFonts;
- free(c->savedName);
- c->savedName = malloc(namelen + 1);
- if (c->savedName)
- memmove(c->savedName, name, namelen + 1);
- aliascount = 20;
- }
- memmove(c->current.pattern, name, namelen);
- c->current.patlen = namelen;
- c->current.max_names = 1;
- c->current.current_fpe = 0;
- c->current.private = 0;
- c->current.list_started = FALSE;
- }
- /*
- * At the end of this FPE, step to the next. If we've finished
- * processing an alias, pop state back. If we've sent enough font
- * names, quit. Always wait for BadFontName to let the FPE
- * have a chance to clean up.
- */
- else if (err == BadFontName)
- {
- ContBadFontName: ;
- c->current.list_started = FALSE;
- c->current.current_fpe++;
- err = Successful;
- if (c->haveSaved)
- {
- if (c->current.max_names == 0 ||
- c->current.current_fpe == c->num_fpes)
- {
- c->haveSaved = FALSE;
- c->saved.max_names -= (1 - c->current.max_names);
- c->current = c->saved;
- }
- }
- else if (c->current.max_names == 0)
- break;
- }
- else if (err == Successful)
- {
- length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp);
- reply = c->reply;
- if (c->length < length)
- {
- reply = (xListFontsWithInfoReply *) realloc(c->reply, length);
- if (!reply)
- {
- err = AllocError;
- break;
- }
- memset((char*)reply + c->length, 0, length - c->length);
- c->reply = reply;
- c->length = length;
- }
- if (c->haveSaved)
- {
- numFonts = c->savedNumFonts;
- name = c->savedName;
- namelen = strlen(name);
- }
- reply->type = X_Reply;
- reply->length = bytes_to_int32(sizeof *reply - sizeof(xGenericReply) +
- pFontInfo->nprops * sizeof(xFontProp) +
- namelen);
- reply->sequenceNumber = client->sequence;
- reply->nameLength = namelen;
- reply->minBounds = pFontInfo->ink_minbounds;
- reply->maxBounds = pFontInfo->ink_maxbounds;
- reply->minCharOrByte2 = pFontInfo->firstCol;
- reply->maxCharOrByte2 = pFontInfo->lastCol;
- reply->defaultChar = pFontInfo->defaultCh;
- reply->nFontProps = pFontInfo->nprops;
- reply->drawDirection = pFontInfo->drawDirection;
- reply->minByte1 = pFontInfo->firstRow;
- reply->maxByte1 = pFontInfo->lastRow;
- reply->allCharsExist = pFontInfo->allExist;
- reply->fontAscent = pFontInfo->fontAscent;
- reply->fontDescent = pFontInfo->fontDescent;
- reply->nReplies = numFonts;
- pFP = (xFontProp *) (reply + 1);
- for (i = 0; i < pFontInfo->nprops; i++)
- {
- pFP->name = pFontInfo->props[i].name;
- pFP->value = pFontInfo->props[i].value;
- pFP++;
- }
- WriteSwappedDataToClient(client, length, reply);
- (void) WriteToClient(client, namelen, name);
- if (pFontInfo == &fontInfo)
- {
- free(fontInfo.props);
- free(fontInfo.isStringProp);
- }
- --c->current.max_names;
- }
- }
-finish:
+ goto finish;
+ while (c->current.current_fpe < c->num_fpes) {
+ fpe = c->fpe_list[c->current.current_fpe];
+ err = Successful;
+ if (!c->current.list_started) {
+ err = (*fpe_functions[fpe->type].start_list_fonts_with_info)
+ (client, fpe, c->current.pattern, c->current.patlen,
+ c->current.max_names, &c->current.private);
+ if (err == Suspended) {
+ if (!ClientIsAsleep(client))
+ ClientSleep(client,
+ (ClientSleepProcPtr) doListFontsWithInfo, c);
+ else
+ goto xinerama_sleep;
+ return TRUE;
+ }
+ if (err == Successful)
+ c->current.list_started = TRUE;
+ }
+ if (err == Successful) {
+ name = 0;
+ pFontInfo = &fontInfo;
+ err = (*fpe_functions[fpe->type].list_next_font_with_info)
+ (client, fpe, &name, &namelen, &pFontInfo,
+ &numFonts, c->current.private);
+ if (err == Suspended) {
+ if (!ClientIsAsleep(client))
+ ClientSleep(client,
+ (ClientSleepProcPtr) doListFontsWithInfo, c);
+ else
+ goto xinerama_sleep;
+ return TRUE;
+ }
+ }
+ /*
+ * When we get an alias back, save our state and reset back to the
+ * start of the FPE looking for the specified name. As soon as a real
+ * font is found for the alias, pop back to the old state
+ */
+ if (err == FontNameAlias) {
+ /*
+ * when an alias recurses, we need to give
+ * the last FPE a chance to clean up; so we call
+ * it again, and assume that the error returned
+ * is BadFontName, indicating the alias resolution
+ * is complete.
+ */
+ if (c->haveSaved) {
+ char *tmpname;
+ int tmpnamelen;
+ FontInfoPtr tmpFontInfo;
+
+ tmpname = 0;
+ tmpFontInfo = &fontInfo;
+ (void) (*fpe_functions[fpe->type].list_next_font_with_info)
+ (client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo,
+ &numFonts, c->current.private);
+ if (--aliascount <= 0) {
+ err = BadFontName;
+ goto ContBadFontName;
+ }
+ }
+ else {
+ c->saved = c->current;
+ c->haveSaved = TRUE;
+ c->savedNumFonts = numFonts;
+ free(c->savedName);
+ c->savedName = malloc(namelen + 1);
+ if (c->savedName)
+ memmove(c->savedName, name, namelen + 1);
+ aliascount = 20;
+ }
+ memmove(c->current.pattern, name, namelen);
+ c->current.patlen = namelen;
+ c->current.max_names = 1;
+ c->current.current_fpe = 0;
+ c->current.private = 0;
+ c->current.list_started = FALSE;
+ }
+ /*
+ * At the end of this FPE, step to the next. If we've finished
+ * processing an alias, pop state back. If we've sent enough font
+ * names, quit. Always wait for BadFontName to let the FPE
+ * have a chance to clean up.
+ */
+ else if (err == BadFontName) {
+ ContBadFontName:;
+ c->current.list_started = FALSE;
+ c->current.current_fpe++;
+ err = Successful;
+ if (c->haveSaved) {
+ if (c->current.max_names == 0 ||
+ c->current.current_fpe == c->num_fpes) {
+ c->haveSaved = FALSE;
+ c->saved.max_names -= (1 - c->current.max_names);
+ c->current = c->saved;
+ }
+ }
+ else if (c->current.max_names == 0)
+ break;
+ }
+ else if (err == Successful) {
+ length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp);
+ reply = c->reply;
+ if (c->length < length) {
+ reply = (xListFontsWithInfoReply *) realloc(c->reply, length);
+ if (!reply) {
+ err = AllocError;
+ break;
+ }
+ memset((char *) reply + c->length, 0, length - c->length);
+ c->reply = reply;
+ c->length = length;
+ }
+ if (c->haveSaved) {
+ numFonts = c->savedNumFonts;
+ name = c->savedName;
+ namelen = strlen(name);
+ }
+ reply->type = X_Reply;
+ reply->length =
+ bytes_to_int32(sizeof *reply - sizeof(xGenericReply) +
+ pFontInfo->nprops * sizeof(xFontProp) + namelen);
+ reply->sequenceNumber = client->sequence;
+ reply->nameLength = namelen;
+ reply->minBounds = pFontInfo->ink_minbounds;
+ reply->maxBounds = pFontInfo->ink_maxbounds;
+ reply->minCharOrByte2 = pFontInfo->firstCol;
+ reply->maxCharOrByte2 = pFontInfo->lastCol;
+ reply->defaultChar = pFontInfo->defaultCh;
+ reply->nFontProps = pFontInfo->nprops;
+ reply->drawDirection = pFontInfo->drawDirection;
+ reply->minByte1 = pFontInfo->firstRow;
+ reply->maxByte1 = pFontInfo->lastRow;
+ reply->allCharsExist = pFontInfo->allExist;
+ reply->fontAscent = pFontInfo->fontAscent;
+ reply->fontDescent = pFontInfo->fontDescent;
+ reply->nReplies = numFonts;
+ pFP = (xFontProp *) (reply + 1);
+ for (i = 0; i < pFontInfo->nprops; i++) {
+ pFP->name = pFontInfo->props[i].name;
+ pFP->value = pFontInfo->props[i].value;
+ pFP++;
+ }
+ WriteSwappedDataToClient(client, length, reply);
+ (void) WriteToClient(client, namelen, name);
+ if (pFontInfo == &fontInfo) {
+ free(fontInfo.props);
+ free(fontInfo.isStringProp);
+ }
+ --c->current.max_names;
+ }
+ }
+ finish:
length = sizeof(xListFontsWithInfoReply);
memset((char *) &finalReply, 0, sizeof(xListFontsWithInfoReply));
finalReply.type = X_Reply;
finalReply.sequenceNumber = client->sequence;
finalReply.length = bytes_to_int32(sizeof(xListFontsWithInfoReply)
- - sizeof(xGenericReply));
+ - sizeof(xGenericReply));
WriteSwappedDataToClient(client, length, &finalReply);
-bail:
+ bail:
ClientWakeup(client);
finished = TRUE;
-xinerama_sleep:
+ xinerama_sleep:
if (finished || fromDispatch) {
- for (i = 0; i < c->num_fpes; i++)
- FreeFPE(c->fpe_list[i]);
- free(c->reply);
- free(c->fpe_list);
- free(c->savedName);
- free(c);
+ for (i = 0; i < c->num_fpes; i++)
+ FreeFPE(c->fpe_list[i]);
+ free(c->reply);
+ free(c->fpe_list);
+ free(c->savedName);
+ free(c);
}
return TRUE;
}
int
-StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
+StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
int max_names)
{
- int i;
- LFWIclosurePtr c;
+ int i;
+ LFWIclosurePtr c;
/*
* The right error to return here would be BadName, however the
@@ -1130,25 +1077,23 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
* a list containing zero fontnames.
*/
if (length > XLFDMAXFONTNAMELEN)
- return BadAlloc;
+ return BadAlloc;
i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess);
if (i != Success)
- return i;
+ return i;
if (!(c = malloc(sizeof *c)))
- goto badAlloc;
+ goto badAlloc;
c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes);
- if (!c->fpe_list)
- {
- free(c);
- goto badAlloc;
+ if (!c->fpe_list) {
+ free(c);
+ goto badAlloc;
}
memmove(c->current.pattern, pattern, length);
- for (i = 0; i < num_fpes; i++)
- {
- c->fpe_list[i] = font_path_elements[i];
- UseFPE(c->fpe_list[i]);
+ for (i = 0; i < num_fpes; i++) {
+ c->fpe_list[i] = font_path_elements[i];
+ UseFPE(c->fpe_list[i]);
}
c->client = client;
c->num_fpes = num_fpes;
@@ -1165,20 +1110,21 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
c->savedName = 0;
doListFontsWithInfo(client, c);
return Success;
-badAlloc:
+ badAlloc:
return BadAlloc;
}
#define TextEltHeader 2
#define FontShiftSize 5
static ChangeGCVal clearGC[] = { NullPixmap };
+
#define clearGCmask (GCClipMask)
int
doPolyText(ClientPtr client, PTclosurePtr c)
{
FontPtr pFont = c->pGC->font, oldpFont;
- int err = Success, lgerr; /* err is in X error, not font error, space */
+ int err = Success, lgerr; /* err is in X error, not font error, space */
enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT;
FontPathElementPtr fpe;
GC *origGC = NULL;
@@ -1188,270 +1134,261 @@ doPolyText(ClientPtr client, PTclosurePtr c)
c->from_dispatch = FALSE;
- if (client->clientGone)
- {
- fpe = c->pGC->font->fpe;
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
-
- if (ClientIsAsleep(client))
- {
- /* Client has died, but we cannot bail out right now. We
- need to clean up after the work we did when going to
- sleep. Setting the drawable pointer to 0 makes this
- happen without any attempts to render or perform other
- unnecessary activities. */
- c->pDraw = (DrawablePtr)0;
- }
- else
- {
- err = Success;
- goto bail;
- }
+ if (client->clientGone) {
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+
+ if (ClientIsAsleep(client)) {
+ /* Client has died, but we cannot bail out right now. We
+ need to clean up after the work we did when going to
+ sleep. Setting the drawable pointer to 0 makes this
+ happen without any attempts to render or perform other
+ unnecessary activities. */
+ c->pDraw = (DrawablePtr) 0;
+ }
+ else {
+ err = Success;
+ goto bail;
+ }
}
/* Make sure our drawable hasn't disappeared while we slept. */
- if (ClientIsAsleep(client) && c->pDraw)
- {
- DrawablePtr pDraw;
- dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
- if (c->pDraw != pDraw) {
- /* Our drawable has disappeared. Treat like client died... ask
- the FPE code to clean up after client and avoid further
- rendering while we clean up after ourself. */
- fpe = c->pGC->font->fpe;
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- c->pDraw = (DrawablePtr)0;
- }
+ if (ClientIsAsleep(client) && c->pDraw) {
+ DrawablePtr pDraw;
+
+ dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
+ if (c->pDraw != pDraw) {
+ /* Our drawable has disappeared. Treat like client died... ask
+ the FPE code to clean up after client and avoid further
+ rendering while we clean up after ourself. */
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ c->pDraw = (DrawablePtr) 0;
+ }
}
client_state = ClientIsAsleep(client) ? SLEEPING : NEVER_SLEPT;
- while (c->endReq - c->pElt > TextEltHeader)
- {
- if (*c->pElt == FontChange)
- {
- Font fid;
- if (c->endReq - c->pElt < FontShiftSize)
- {
- err = BadLength;
- goto bail;
- }
-
- oldpFont = pFont;
-
- fid = ((Font)*(c->pElt+4)) /* big-endian */
- | ((Font)*(c->pElt+3)) << 8
- | ((Font)*(c->pElt+2)) << 16
- | ((Font)*(c->pElt+1)) << 24;
- err = dixLookupResourceByType((pointer *)&pFont, fid, RT_FONT,
- client, DixUseAccess);
- if (err != Success)
- {
- /* restore pFont for step 4 (described below) */
- pFont = oldpFont;
-
- /* If we're in START_SLEEP mode, the following step
- shortens the request... in the unlikely event that
- the fid somehow becomes valid before we come through
- again to actually execute the polytext, which would
- then mess up our refcounting scheme badly. */
- c->err = err;
- c->endReq = c->pElt;
-
- goto bail;
- }
-
- /* Step 3 (described below) on our new font */
- if (client_state == START_SLEEP)
- pFont->refcnt++;
- else
- {
- if (pFont != c->pGC->font && c->pDraw)
- {
- ChangeGCVal val;
- val.ptr = pFont;
- ChangeGC(NullClient, c->pGC, GCFont, &val);
- ValidateGC(c->pDraw, c->pGC);
- }
-
- /* Undo the refcnt++ we performed when going to sleep */
- if (client_state == SLEEPING)
- (void)CloseFont(c->pGC->font, (Font)0);
- }
- c->pElt += FontShiftSize;
- }
- else /* print a string */
- {
- unsigned char *pNextElt;
- pNextElt = c->pElt + TextEltHeader + (*c->pElt) * itemSize;
- if ( pNextElt > c->endReq)
- {
- err = BadLength;
- goto bail;
- }
- if (client_state == START_SLEEP)
- {
- c->pElt = pNextElt;
- continue;
- }
- if (c->pDraw)
- {
- lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, itemSize,
- c->pElt + TextEltHeader);
- }
- else lgerr = Successful;
-
- if (lgerr == Suspended)
- {
- if (!ClientIsAsleep(client)) {
- int len;
- GC *pGC;
- PTclosurePtr new_closure;
-
- /* We're putting the client to sleep. We need to do a few things
- to ensure successful and atomic-appearing execution of the
- remainder of the request. First, copy the remainder of the
- request into a safe malloc'd area. Second, create a scratch GC
- to use for the remainder of the request. Third, mark all fonts
- referenced in the remainder of the request to prevent their
- deallocation. Fourth, make the original GC look like the
- request has completed... set its font to the final font value
- from this request. These GC manipulations are for the unlikely
- (but possible) event that some other client is using the GC.
- Steps 3 and 4 are performed by running this procedure through
- the remainder of the request in a special no-render mode
- indicated by client_state = START_SLEEP. */
-
- /* Step 1 */
- /* Allocate a malloc'd closure structure to replace
- the local one we were passed */
- new_closure = malloc(sizeof(PTclosureRec));
- if (!new_closure)
- {
- err = BadAlloc;
- goto bail;
- }
- *new_closure = *c;
-
- len = new_closure->endReq - new_closure->pElt;
- new_closure->data = malloc(len);
- if (!new_closure->data)
- {
- free(new_closure);
- err = BadAlloc;
- goto bail;
- }
- memmove(new_closure->data, new_closure->pElt, len);
- new_closure->pElt = new_closure->data;
- new_closure->endReq = new_closure->pElt + len;
-
- /* Step 2 */
-
- pGC = GetScratchGC(new_closure->pGC->depth, new_closure->pGC->pScreen);
- if (!pGC)
- {
- free(new_closure->data);
- free(new_closure);
- err = BadAlloc;
- goto bail;
- }
- if ((err = CopyGC(new_closure->pGC, pGC, GCFunction |
- GCPlaneMask | GCForeground |
- GCBackground | GCFillStyle |
- GCTile | GCStipple |
- GCTileStipXOrigin |
- GCTileStipYOrigin | GCFont |
- GCSubwindowMode | GCClipXOrigin |
- GCClipYOrigin | GCClipMask)) !=
- Success)
- {
- FreeScratchGC(pGC);
- free(new_closure->data);
- free(new_closure);
- err = BadAlloc;
- goto bail;
- }
- c = new_closure;
- origGC = c->pGC;
- c->pGC = pGC;
- ValidateGC(c->pDraw, c->pGC);
-
- ClientSleep(client, (ClientSleepProcPtr)doPolyText, c);
-
- /* Set up to perform steps 3 and 4 */
- client_state = START_SLEEP;
- continue; /* on to steps 3 and 4 */
- }
- else
- goto xinerama_sleep;
- return TRUE;
- }
- else if (lgerr != Successful)
- {
- err = FontToXError(lgerr);
- goto bail;
- }
- if (c->pDraw)
- {
- c->xorg += *((INT8 *)(c->pElt + 1)); /* must be signed */
- if (c->reqType == X_PolyText8)
- c->xorg = (* c->pGC->ops->PolyText8)(c->pDraw, c->pGC, c->xorg, c->yorg,
- *c->pElt, (char *) (c->pElt + TextEltHeader));
- else
- c->xorg = (* c->pGC->ops->PolyText16)(c->pDraw, c->pGC, c->xorg, c->yorg,
- *c->pElt, (unsigned short *) (c->pElt + TextEltHeader));
- }
- c->pElt = pNextElt;
- }
- }
-
-bail:
-
- if (client_state == START_SLEEP)
- {
- /* Step 4 */
- if (pFont != origGC->font)
- {
- ChangeGCVal val;
- val.ptr = pFont;
- ChangeGC(NullClient, origGC, GCFont, &val);
- ValidateGC(c->pDraw, origGC);
- }
-
- /* restore pElt pointer for execution of remainder of the request */
- c->pElt = c->data;
- return TRUE;
- }
-
- if (c->err != Success) err = c->err;
+ while (c->endReq - c->pElt > TextEltHeader) {
+ if (*c->pElt == FontChange) {
+ Font fid;
+
+ if (c->endReq - c->pElt < FontShiftSize) {
+ err = BadLength;
+ goto bail;
+ }
+
+ oldpFont = pFont;
+
+ fid = ((Font) *(c->pElt + 4)) /* big-endian */
+ |((Font) *(c->pElt + 3)) << 8
+ | ((Font) *(c->pElt + 2)) << 16 | ((Font) *(c->pElt + 1)) << 24;
+ err = dixLookupResourceByType((pointer *) &pFont, fid, RT_FONT,
+ client, DixUseAccess);
+ if (err != Success) {
+ /* restore pFont for step 4 (described below) */
+ pFont = oldpFont;
+
+ /* If we're in START_SLEEP mode, the following step
+ shortens the request... in the unlikely event that
+ the fid somehow becomes valid before we come through
+ again to actually execute the polytext, which would
+ then mess up our refcounting scheme badly. */
+ c->err = err;
+ c->endReq = c->pElt;
+
+ goto bail;
+ }
+
+ /* Step 3 (described below) on our new font */
+ if (client_state == START_SLEEP)
+ pFont->refcnt++;
+ else {
+ if (pFont != c->pGC->font && c->pDraw) {
+ ChangeGCVal val;
+
+ val.ptr = pFont;
+ ChangeGC(NullClient, c->pGC, GCFont, &val);
+ ValidateGC(c->pDraw, c->pGC);
+ }
+
+ /* Undo the refcnt++ we performed when going to sleep */
+ if (client_state == SLEEPING)
+ (void) CloseFont(c->pGC->font, (Font) 0);
+ }
+ c->pElt += FontShiftSize;
+ }
+ else { /* print a string */
+
+ unsigned char *pNextElt;
+
+ pNextElt = c->pElt + TextEltHeader + (*c->pElt) * itemSize;
+ if (pNextElt > c->endReq) {
+ err = BadLength;
+ goto bail;
+ }
+ if (client_state == START_SLEEP) {
+ c->pElt = pNextElt;
+ continue;
+ }
+ if (c->pDraw) {
+ lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, itemSize,
+ c->pElt + TextEltHeader);
+ }
+ else
+ lgerr = Successful;
+
+ if (lgerr == Suspended) {
+ if (!ClientIsAsleep(client)) {
+ int len;
+ GC *pGC;
+ PTclosurePtr new_closure;
+
+ /* We're putting the client to sleep. We need to do a few things
+ to ensure successful and atomic-appearing execution of the
+ remainder of the request. First, copy the remainder of the
+ request into a safe malloc'd area. Second, create a scratch GC
+ to use for the remainder of the request. Third, mark all fonts
+ referenced in the remainder of the request to prevent their
+ deallocation. Fourth, make the original GC look like the
+ request has completed... set its font to the final font value
+ from this request. These GC manipulations are for the unlikely
+ (but possible) event that some other client is using the GC.
+ Steps 3 and 4 are performed by running this procedure through
+ the remainder of the request in a special no-render mode
+ indicated by client_state = START_SLEEP. */
+
+ /* Step 1 */
+ /* Allocate a malloc'd closure structure to replace
+ the local one we were passed */
+ new_closure = malloc(sizeof(PTclosureRec));
+ if (!new_closure) {
+ err = BadAlloc;
+ goto bail;
+ }
+ *new_closure = *c;
+
+ len = new_closure->endReq - new_closure->pElt;
+ new_closure->data = malloc(len);
+ if (!new_closure->data) {
+ free(new_closure);
+ err = BadAlloc;
+ goto bail;
+ }
+ memmove(new_closure->data, new_closure->pElt, len);
+ new_closure->pElt = new_closure->data;
+ new_closure->endReq = new_closure->pElt + len;
+
+ /* Step 2 */
+
+ pGC =
+ GetScratchGC(new_closure->pGC->depth,
+ new_closure->pGC->pScreen);
+ if (!pGC) {
+ free(new_closure->data);
+ free(new_closure);
+ err = BadAlloc;
+ goto bail;
+ }
+ if ((err = CopyGC(new_closure->pGC, pGC, GCFunction |
+ GCPlaneMask | GCForeground |
+ GCBackground | GCFillStyle |
+ GCTile | GCStipple |
+ GCTileStipXOrigin |
+ GCTileStipYOrigin | GCFont |
+ GCSubwindowMode | GCClipXOrigin |
+ GCClipYOrigin | GCClipMask)) != Success) {
+ FreeScratchGC(pGC);
+ free(new_closure->data);
+ free(new_closure);
+ err = BadAlloc;
+ goto bail;
+ }
+ c = new_closure;
+ origGC = c->pGC;
+ c->pGC = pGC;
+ ValidateGC(c->pDraw, c->pGC);
+
+ ClientSleep(client, (ClientSleepProcPtr) doPolyText, c);
+
+ /* Set up to perform steps 3 and 4 */
+ client_state = START_SLEEP;
+ continue; /* on to steps 3 and 4 */
+ }
+ else
+ goto xinerama_sleep;
+ return TRUE;
+ }
+ else if (lgerr != Successful) {
+ err = FontToXError(lgerr);
+ goto bail;
+ }
+ if (c->pDraw) {
+ c->xorg += *((INT8 *) (c->pElt + 1)); /* must be signed */
+ if (c->reqType == X_PolyText8)
+ c->xorg =
+ (*c->pGC->ops->PolyText8) (c->pDraw, c->pGC, c->xorg,
+ c->yorg, *c->pElt,
+ (char *) (c->pElt +
+ TextEltHeader));
+ else
+ c->xorg =
+ (*c->pGC->ops->PolyText16) (c->pDraw, c->pGC, c->xorg,
+ c->yorg, *c->pElt,
+ (unsigned short *) (c->
+ pElt +
+ TextEltHeader));
+ }
+ c->pElt = pNextElt;
+ }
+ }
+
+ bail:
+
+ if (client_state == START_SLEEP) {
+ /* Step 4 */
+ if (pFont != origGC->font) {
+ ChangeGCVal val;
+
+ val.ptr = pFont;
+ ChangeGC(NullClient, origGC, GCFont, &val);
+ ValidateGC(c->pDraw, origGC);
+ }
+
+ /* restore pElt pointer for execution of remainder of the request */
+ c->pElt = c->data;
+ return TRUE;
+ }
+
+ if (c->err != Success)
+ err = c->err;
if (err != Success && c->client != serverClient) {
#ifdef PANORAMIX
if (noPanoramiXExtension || !c->pGC->pScreen->myNum)
#endif
- SendErrorToClient(c->client, c->reqType, 0, 0, err);
- }
- if (ClientIsAsleep(client))
- {
- ClientWakeup(c->client);
- finished = TRUE;
-xinerama_sleep:
- if (finished || fromDispatch) {
- ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
-
- /* Unreference the font from the scratch GC */
- CloseFont(c->pGC->font, (Font)0);
- c->pGC->font = NullFont;
-
- FreeScratchGC(c->pGC);
- free(c->data);
- free(c);
- }
+ SendErrorToClient(c->client, c->reqType, 0, 0, err);
+ }
+ if (ClientIsAsleep(client)) {
+ ClientWakeup(c->client);
+ finished = TRUE;
+ xinerama_sleep:
+ if (finished || fromDispatch) {
+ ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
+
+ /* Unreference the font from the scratch GC */
+ CloseFont(c->pGC->font, (Font) 0);
+ c->pGC->font = NullFont;
+
+ FreeScratchGC(c->pGC);
+ free(c->data);
+ free(c);
+ }
}
return TRUE;
}
int
-PolyText(ClientPtr client, DrawablePtr pDraw, GC *pGC, unsigned char *pElt,
+PolyText(ClientPtr client, DrawablePtr pDraw, GC * pGC, unsigned char *pElt,
unsigned char *endReq, int xorg, int yorg, int reqType, XID did)
{
PTclosureRec local_closure;
@@ -1471,14 +1408,13 @@ PolyText(ClientPtr client, DrawablePtr pDraw, GC *pGC, unsigned char *pElt,
return Success;
}
-
#undef TextEltHeader
#undef FontShiftSize
int
doImageText(ClientPtr client, ITclosurePtr c)
{
- int err = Success, lgerr; /* err is in X error, not font error, space */
+ int err = Success, lgerr; /* err is in X error, not font error, space */
FontPathElementPtr fpe;
int itemSize = c->reqType == X_ImageText8 ? 1 : 2;
Bool fromDispatch = c->from_dispatch;
@@ -1486,133 +1422,124 @@ doImageText(ClientPtr client, ITclosurePtr c)
c->from_dispatch = FALSE;
- if (client->clientGone)
- {
- fpe = c->pGC->font->fpe;
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- err = Success;
- goto bail;
+ if (client->clientGone) {
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ err = Success;
+ goto bail;
}
/* Make sure our drawable hasn't disappeared while we slept. */
- if (ClientIsAsleep(client) && c->pDraw)
- {
- DrawablePtr pDraw;
- dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
- if (c->pDraw != pDraw) {
- /* Our drawable has disappeared. Treat like client died... ask
- the FPE code to clean up after client. */
- fpe = c->pGC->font->fpe;
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- err = Success;
- goto bail;
- }
+ if (ClientIsAsleep(client) && c->pDraw) {
+ DrawablePtr pDraw;
+
+ dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
+ if (c->pDraw != pDraw) {
+ /* Our drawable has disappeared. Treat like client died... ask
+ the FPE code to clean up after client. */
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ err = Success;
+ goto bail;
+ }
}
lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, itemSize, c->data);
- if (lgerr == Suspended)
- {
+ if (lgerr == Suspended) {
if (!ClientIsAsleep(client)) {
- GC *pGC;
- unsigned char *data;
- ITclosurePtr new_closure;
-
- /* We're putting the client to sleep. We need to
- save some state. Similar problem to that handled
- in doPolyText, but much simpler because the
- request structure is much simpler. */
-
- new_closure = malloc(sizeof(ITclosureRec));
- if (!new_closure)
- {
- err = BadAlloc;
- goto bail;
- }
- *new_closure = *c;
- c = new_closure;
-
- data = malloc(c->nChars * itemSize);
- if (!data)
- {
- free(c);
- err = BadAlloc;
- goto bail;
- }
- memmove(data, c->data, c->nChars * itemSize);
- c->data = data;
-
- pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
- if (!pGC)
- {
- free(c->data);
- free(c);
- err = BadAlloc;
- goto bail;
- }
- if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask |
- GCForeground | GCBackground | GCFillStyle |
- GCTile | GCStipple | GCTileStipXOrigin |
- GCTileStipYOrigin | GCFont |
- GCSubwindowMode | GCClipXOrigin |
- GCClipYOrigin | GCClipMask)) != Success)
- {
- FreeScratchGC(pGC);
- free(c->data);
- free(c);
- err = BadAlloc;
- goto bail;
- }
- c->pGC = pGC;
- ValidateGC(c->pDraw, c->pGC);
-
- ClientSleep(client, (ClientSleepProcPtr)doImageText, c);
+ GC *pGC;
+ unsigned char *data;
+ ITclosurePtr new_closure;
+
+ /* We're putting the client to sleep. We need to
+ save some state. Similar problem to that handled
+ in doPolyText, but much simpler because the
+ request structure is much simpler. */
+
+ new_closure = malloc(sizeof(ITclosureRec));
+ if (!new_closure) {
+ err = BadAlloc;
+ goto bail;
+ }
+ *new_closure = *c;
+ c = new_closure;
+
+ data = malloc(c->nChars * itemSize);
+ if (!data) {
+ free(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ memmove(data, c->data, c->nChars * itemSize);
+ c->data = data;
+
+ pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
+ if (!pGC) {
+ free(c->data);
+ free(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask |
+ GCForeground | GCBackground | GCFillStyle |
+ GCTile | GCStipple | GCTileStipXOrigin |
+ GCTileStipYOrigin | GCFont |
+ GCSubwindowMode | GCClipXOrigin |
+ GCClipYOrigin | GCClipMask)) != Success) {
+ FreeScratchGC(pGC);
+ free(c->data);
+ free(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ c->pGC = pGC;
+ ValidateGC(c->pDraw, c->pGC);
+
+ ClientSleep(client, (ClientSleepProcPtr) doImageText, c);
}
- else
- goto xinerama_sleep;
+ else
+ goto xinerama_sleep;
return TRUE;
}
- else if (lgerr != Successful)
- {
+ else if (lgerr != Successful) {
err = FontToXError(lgerr);
goto bail;
}
- if (c->pDraw)
- {
- if (c->reqType == X_ImageText8)
- (* c->pGC->ops->ImageText8)(c->pDraw, c->pGC, c->xorg, c->yorg,
- c->nChars, (char *) c->data);
- else
- (* c->pGC->ops->ImageText16)(c->pDraw, c->pGC, c->xorg, c->yorg,
- c->nChars, (unsigned short *) c->data);
+ if (c->pDraw) {
+ if (c->reqType == X_ImageText8)
+ (*c->pGC->ops->ImageText8) (c->pDraw, c->pGC, c->xorg, c->yorg,
+ c->nChars, (char *) c->data);
+ else
+ (*c->pGC->ops->ImageText16) (c->pDraw, c->pGC, c->xorg, c->yorg,
+ c->nChars, (unsigned short *) c->data);
}
-bail:
+ bail:
if (err != Success && c->client != serverClient) {
- SendErrorToClient(c->client, c->reqType, 0, 0, err);
- }
- if (ClientIsAsleep(client))
- {
- ClientWakeup(c->client);
- finished = TRUE;
-xinerama_sleep:
- if (finished || fromDispatch) {
- ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
-
- /* Unreference the font from the scratch GC */
- CloseFont(c->pGC->font, (Font)0);
- c->pGC->font = NullFont;
-
- FreeScratchGC(c->pGC);
- free(c->data);
- free(c);
- }
+ SendErrorToClient(c->client, c->reqType, 0, 0, err);
+ }
+ if (ClientIsAsleep(client)) {
+ ClientWakeup(c->client);
+ finished = TRUE;
+ xinerama_sleep:
+ if (finished || fromDispatch) {
+ ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
+
+ /* Unreference the font from the scratch GC */
+ CloseFont(c->pGC->font, (Font) 0);
+ c->pGC->font = NullFont;
+
+ FreeScratchGC(c->pGC);
+ free(c->data);
+ free(c);
+ }
}
return TRUE;
}
int
-ImageText(ClientPtr client, DrawablePtr pDraw, GC *pGC, int nChars,
+ImageText(ClientPtr client, DrawablePtr pDraw, GC * pGC, int nChars,
unsigned char *data, int xorg, int yorg, int reqType, XID did)
{
ITclosureRec local_closure;
@@ -1631,168 +1558,157 @@ ImageText(ClientPtr client, DrawablePtr pDraw, GC *pGC, int nChars,
return Success;
}
-
/* does the necessary magic to figure out the fpe type */
static int
DetermineFPEType(char *pathname)
{
- int i;
+ int i;
for (i = 0; i < num_fpe_types; i++) {
- if ((*fpe_functions[i].name_check) (pathname))
- return i;
+ if ((*fpe_functions[i].name_check) (pathname))
+ return i;
}
return -1;
}
-
static void
-FreeFontPath(FontPathElementPtr *list, int n, Bool force)
+FreeFontPath(FontPathElementPtr * list, int n, Bool force)
{
- int i;
+ int i;
for (i = 0; i < n; i++) {
- if (force) {
- /* Sanity check that all refcounts will be 0 by the time
- we get to the end of the list. */
- int found = 1; /* the first reference is us */
- int j;
- for (j = i+1; j < n; j++) {
- if (list[j] == list[i])
- found++;
- }
- if (list[i]->refcount != found) {
- list[i]->refcount = found; /* ensure it will get freed */
- }
- }
- FreeFPE(list[i]);
+ if (force) {
+ /* Sanity check that all refcounts will be 0 by the time
+ we get to the end of the list. */
+ int found = 1; /* the first reference is us */
+ int j;
+
+ for (j = i + 1; j < n; j++) {
+ if (list[j] == list[i])
+ found++;
+ }
+ if (list[i]->refcount != found) {
+ list[i]->refcount = found; /* ensure it will get freed */
+ }
+ }
+ FreeFPE(list[i]);
}
free(list);
}
static FontPathElementPtr
-find_existing_fpe(FontPathElementPtr *list, int num, unsigned char *name, int len)
+find_existing_fpe(FontPathElementPtr * list, int num, unsigned char *name,
+ int len)
{
FontPathElementPtr fpe;
- int i;
+ int i;
for (i = 0; i < num; i++) {
- fpe = list[i];
- if (fpe->name_length == len && memcmp(name, fpe->name, len) == 0)
- return fpe;
+ fpe = list[i];
+ if (fpe->name_length == len && memcmp(name, fpe->name, len) == 0)
+ return fpe;
}
return (FontPathElementPtr) 0;
}
-
static int
SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
{
- int i, err = 0;
- int valid_paths = 0;
+ int i, err = 0;
+ int valid_paths = 0;
unsigned int len;
unsigned char *cp = paths;
FontPathElementPtr fpe = NULL, *fplist;
fplist = malloc(sizeof(FontPathElementPtr) * npaths);
if (!fplist) {
- *bad = 0;
- return BadAlloc;
+ *bad = 0;
+ return BadAlloc;
}
for (i = 0; i < num_fpe_types; i++) {
- if (fpe_functions[i].set_path_hook)
- (*fpe_functions[i].set_path_hook) ();
- }
- for (i = 0; i < npaths; i++)
- {
- len = (unsigned int) (*cp++);
-
- if (len == 0)
- {
- if (persist)
- ErrorF("[dix] Removing empty element from the valid list of fontpaths\n");
- err = BadValue;
- }
- else
- {
- /* if it's already in our active list, just reset it */
- /*
- * note that this can miss FPE's in limbo -- may be worth catching
- * them, though it'd muck up refcounting
- */
- fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len);
- if (fpe)
- {
- err = (*fpe_functions[fpe->type].reset_fpe) (fpe);
- if (err == Successful)
- {
- UseFPE(fpe);/* since it'll be decref'd later when freed
- * from the old list */
- }
- else
- fpe = 0;
- }
- /* if error or can't do it, act like it's a new one */
- if (!fpe)
- {
- fpe = malloc(sizeof(FontPathElementRec));
- if (!fpe)
- {
- err = BadAlloc;
- goto bail;
- }
- fpe->name = malloc(len + 1);
- if (!fpe->name)
- {
- free(fpe);
- err = BadAlloc;
- goto bail;
- }
- fpe->refcount = 1;
-
- strncpy(fpe->name, (char *) cp, (int) len);
- fpe->name[len] = '\0';
- fpe->name_length = len;
- fpe->type = DetermineFPEType(fpe->name);
- if (fpe->type == -1)
- err = BadValue;
- else
- err = (*fpe_functions[fpe->type].init_fpe) (fpe);
- if (err != Successful)
- {
- if (persist)
- {
- ErrorF("[dix] Could not init font path element %s, removing from list!\n",
- fpe->name);
- }
- free(fpe->name);
- free(fpe);
- }
- }
- }
- if (err != Successful)
- {
- if (!persist)
- goto bail;
- }
- else
- {
- fplist[valid_paths++] = fpe;
- }
- cp += len;
+ if (fpe_functions[i].set_path_hook)
+ (*fpe_functions[i].set_path_hook) ();
+ }
+ for (i = 0; i < npaths; i++) {
+ len = (unsigned int) (*cp++);
+
+ if (len == 0) {
+ if (persist)
+ ErrorF
+ ("[dix] Removing empty element from the valid list of fontpaths\n");
+ err = BadValue;
+ }
+ else {
+ /* if it's already in our active list, just reset it */
+ /*
+ * note that this can miss FPE's in limbo -- may be worth catching
+ * them, though it'd muck up refcounting
+ */
+ fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len);
+ if (fpe) {
+ err = (*fpe_functions[fpe->type].reset_fpe) (fpe);
+ if (err == Successful) {
+ UseFPE(fpe); /* since it'll be decref'd later when freed
+ * from the old list */
+ }
+ else
+ fpe = 0;
+ }
+ /* if error or can't do it, act like it's a new one */
+ if (!fpe) {
+ fpe = malloc(sizeof(FontPathElementRec));
+ if (!fpe) {
+ err = BadAlloc;
+ goto bail;
+ }
+ fpe->name = malloc(len + 1);
+ if (!fpe->name) {
+ free(fpe);
+ err = BadAlloc;
+ goto bail;
+ }
+ fpe->refcount = 1;
+
+ strncpy(fpe->name, (char *) cp, (int) len);
+ fpe->name[len] = '\0';
+ fpe->name_length = len;
+ fpe->type = DetermineFPEType(fpe->name);
+ if (fpe->type == -1)
+ err = BadValue;
+ else
+ err = (*fpe_functions[fpe->type].init_fpe) (fpe);
+ if (err != Successful) {
+ if (persist) {
+ ErrorF
+ ("[dix] Could not init font path element %s, removing from list!\n",
+ fpe->name);
+ }
+ free(fpe->name);
+ free(fpe);
+ }
+ }
+ }
+ if (err != Successful) {
+ if (!persist)
+ goto bail;
+ }
+ else {
+ fplist[valid_paths++] = fpe;
+ }
+ cp += len;
}
FreeFontPath(font_path_elements, num_fpes, FALSE);
font_path_elements = fplist;
if (patternCache)
- EmptyFontPatternCache(patternCache);
+ EmptyFontPatternCache(patternCache);
num_fpes = valid_paths;
return Success;
-bail:
+ bail:
*bad = i;
while (--valid_paths >= 0)
- FreeFPE(fplist[valid_paths]);
+ FreeFPE(fplist[valid_paths]);
free(fplist);
return FontToXError(err);
}
@@ -1801,16 +1717,19 @@ int
SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
{
int err = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
+
if (err != Success)
- return err;
+ return err;
if (npaths == 0) {
- if (SetDefaultFontPath(defaultFontPath) != Success)
- return BadValue;
- } else {
- int bad;
- err = SetFontPathElements(npaths, paths, &bad, FALSE);
- client->errorValue = bad;
+ if (SetDefaultFontPath(defaultFontPath) != Success)
+ return BadValue;
+ }
+ else {
+ int bad;
+
+ err = SetFontPathElements(npaths, paths, &bad, FALSE);
+ client->errorValue = bad;
}
return err;
}
@@ -1818,36 +1737,28 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
int
SetDefaultFontPath(char *path)
{
- char *temp_path,
- *start,
- *end;
- unsigned char *cp,
- *pp,
- *nump,
- *newpath;
- int num = 1,
- len,
- err,
- size = 0,
- bad;
+ char *temp_path, *start, *end;
+ unsigned char *cp, *pp, *nump, *newpath;
+ int num = 1, len, err, size = 0, bad;
/* ensure temp_path contains "built-ins" */
start = path;
while (1) {
- start = strstr(start, "built-ins");
- if (start == NULL)
- break;
- end = start + strlen("built-ins");
- if ((start == path || start[-1] == ',') && (!*end || *end == ','))
- break;
- start = end;
+ start = strstr(start, "built-ins");
+ if (start == NULL)
+ break;
+ end = start + strlen("built-ins");
+ if ((start == path || start[-1] == ',') && (!*end || *end == ','))
+ break;
+ start = end;
}
if (!start) {
- if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "")
- == -1)
- temp_path = NULL;
- } else {
- temp_path = strdup(path);
+ if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "")
+ == -1)
+ temp_path = NULL;
+ }
+ else {
+ temp_path = strdup(path);
}
if (!temp_path)
return BadAlloc;
@@ -1856,22 +1767,23 @@ SetDefaultFontPath(char *path)
len = strlen(temp_path) + 1;
nump = cp = newpath = malloc(len);
if (!newpath) {
- free(temp_path);
- return BadAlloc;
+ free(temp_path);
+ return BadAlloc;
}
pp = (unsigned char *) temp_path;
cp++;
while (*pp) {
- if (*pp == ',') {
- *nump = (unsigned char) size;
- nump = cp++;
- pp++;
- num++;
- size = 0;
- } else {
- *cp++ = *pp++;
- size++;
- }
+ if (*pp == ',') {
+ *nump = (unsigned char) size;
+ nump = cp++;
+ pp++;
+ num++;
+ size = 0;
+ }
+ else {
+ *cp++ = *pp++;
+ size++;
+ }
}
*nump = (unsigned char) size;
@@ -1886,32 +1798,32 @@ SetDefaultFontPath(char *path)
int
GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result)
{
- int i;
- unsigned char *c;
- int len;
- FontPathElementPtr fpe;
+ int i;
+ unsigned char *c;
+ int len;
+ FontPathElementPtr fpe;
i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess);
if (i != Success)
- return i;
+ return i;
len = 0;
for (i = 0; i < num_fpes; i++) {
- fpe = font_path_elements[i];
- len += fpe->name_length + 1;
+ fpe = font_path_elements[i];
+ len += fpe->name_length + 1;
}
font_path_string = (unsigned char *) realloc(font_path_string, len);
if (!font_path_string)
- return BadAlloc;
+ return BadAlloc;
c = font_path_string;
*length = 0;
for (i = 0; i < num_fpes; i++) {
- fpe = font_path_elements[i];
- *c = fpe->name_length;
- *length += *c++;
- memmove(c, fpe->name, fpe->name_length);
- c += fpe->name_length;
+ fpe = font_path_elements[i];
+ *c = fpe->name_length;
+ *length += *c++;
+ memmove(c, fpe->name, fpe->name_length);
+ c += fpe->name_length;
}
*count = num_fpes;
*result = font_path_string;
@@ -1921,19 +1833,18 @@ GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result)
void
DeleteClientFontStuff(ClientPtr client)
{
- int i;
- FontPathElementPtr fpe;
+ int i;
+ FontPathElementPtr fpe;
- for (i = 0; i < num_fpes; i++)
- {
- fpe = font_path_elements[i];
- if (fpe_functions[fpe->type].client_died)
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ for (i = 0; i < num_fpes; i++) {
+ fpe = font_path_elements[i];
+ if (fpe_functions[fpe->type].client_died)
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
}
}
void
-InitFonts (void)
+InitFonts(void)
{
patternCache = MakeFontPatternCache();
@@ -1941,17 +1852,16 @@ InitFonts (void)
}
int
-GetDefaultPointSize (void)
+GetDefaultPointSize(void)
{
return 120;
}
-
FontResolutionPtr
-GetClientResolutions (int *num)
+GetClientResolutions(int *num)
{
static struct _FontResolution res;
- ScreenPtr pScreen;
+ ScreenPtr pScreen;
pScreen = screenInfo.screens[0];
res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth;
@@ -1960,14 +1870,14 @@ GetClientResolutions (int *num)
so that we can match them from scalable fonts
*/
if (res.x_resolution < 88)
- res.x_resolution = 75;
+ res.x_resolution = 75;
else
- res.x_resolution = 100;
+ res.x_resolution = 100;
res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight;
if (res.y_resolution < 88)
- res.y_resolution = 75;
+ res.y_resolution = 75;
else
- res.y_resolution = 100;
+ res.y_resolution = 100;
res.point_size = 120;
*num = 1;
return &res;
@@ -1980,29 +1890,28 @@ GetClientResolutions (int *num)
*/
int
-RegisterFPEFunctions(NameCheckFunc name_func,
- InitFpeFunc init_func,
- FreeFpeFunc free_func,
- ResetFpeFunc reset_func,
- OpenFontFunc open_func,
- CloseFontFunc close_func,
- ListFontsFunc list_func,
- StartLfwiFunc start_lfwi_func,
- NextLfwiFunc next_lfwi_func,
- WakeupFpeFunc wakeup_func,
- ClientDiedFunc client_died,
- LoadGlyphsFunc load_glyphs,
- StartLaFunc start_list_alias_func,
- NextLaFunc next_list_alias_func,
- SetPathFunc set_path_func)
+RegisterFPEFunctions(NameCheckFunc name_func,
+ InitFpeFunc init_func,
+ FreeFpeFunc free_func,
+ ResetFpeFunc reset_func,
+ OpenFontFunc open_func,
+ CloseFontFunc close_func,
+ ListFontsFunc list_func,
+ StartLfwiFunc start_lfwi_func,
+ NextLfwiFunc next_lfwi_func,
+ WakeupFpeFunc wakeup_func,
+ ClientDiedFunc client_died,
+ LoadGlyphsFunc load_glyphs,
+ StartLaFunc start_list_alias_func,
+ NextLaFunc next_list_alias_func, SetPathFunc set_path_func)
{
FPEFunctions *new;
/* grow the list */
new = (FPEFunctions *) realloc(fpe_functions,
- (num_fpe_types + 1) * sizeof(FPEFunctions));
+ (num_fpe_types + 1) * sizeof(FPEFunctions));
if (!new)
- return -1;
+ return -1;
fpe_functions = new;
fpe_functions[num_fpe_types].name_check = name_func;
@@ -2010,19 +1919,16 @@ RegisterFPEFunctions(NameCheckFunc name_func,
fpe_functions[num_fpe_types].close_font = close_func;
fpe_functions[num_fpe_types].wakeup_fpe = wakeup_func;
fpe_functions[num_fpe_types].list_fonts = list_func;
- fpe_functions[num_fpe_types].start_list_fonts_with_info =
- start_lfwi_func;
- fpe_functions[num_fpe_types].list_next_font_with_info =
- next_lfwi_func;
+ fpe_functions[num_fpe_types].start_list_fonts_with_info = start_lfwi_func;
+ fpe_functions[num_fpe_types].list_next_font_with_info = next_lfwi_func;
fpe_functions[num_fpe_types].init_fpe = init_func;
fpe_functions[num_fpe_types].free_fpe = free_func;
fpe_functions[num_fpe_types].reset_fpe = reset_func;
fpe_functions[num_fpe_types].client_died = client_died;
fpe_functions[num_fpe_types].load_glyphs = load_glyphs;
fpe_functions[num_fpe_types].start_list_fonts_and_aliases =
- start_list_alias_func;
- fpe_functions[num_fpe_types].list_next_font_or_alias =
- next_list_alias_func;
+ start_list_alias_func;
+ fpe_functions[num_fpe_types].list_next_font_or_alias = next_list_alias_func;
fpe_functions[num_fpe_types].set_path_hook = set_path_func;
return num_fpe_types++;
@@ -2032,8 +1938,8 @@ void
FreeFonts(void)
{
if (patternCache) {
- FreeFontPatternCache(patternCache);
- patternCache = 0;
+ FreeFontPatternCache(patternCache);
+ patternCache = 0;
}
FreeFontPath(font_path_elements, num_fpes, TRUE);
font_path_elements = 0;
@@ -2049,8 +1955,9 @@ FontPtr
find_old_font(XID id)
{
pointer pFont;
+
dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess);
- return (FontPtr)pFont;
+ return (FontPtr) pFont;
}
Font
@@ -2077,7 +1984,7 @@ client_auth_generation(ClientPtr client)
return 0;
}
-static int fs_handlers_installed = 0;
+static int fs_handlers_installed = 0;
static unsigned int last_server_gen;
int
@@ -2085,28 +1992,29 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
{
/* if server has reset, make sure the b&w handlers are reinstalled */
if (last_server_gen < serverGeneration) {
- last_server_gen = serverGeneration;
- fs_handlers_installed = 0;
+ last_server_gen = serverGeneration;
+ fs_handlers_installed = 0;
}
if (fs_handlers_installed == 0) {
- if (!RegisterBlockAndWakeupHandlers(block_handler,
- FontWakeup, (pointer) 0))
- return AllocError;
- fs_handlers_installed++;
+ if (!RegisterBlockAndWakeupHandlers(block_handler,
+ FontWakeup, (pointer) 0))
+ return AllocError;
+ fs_handlers_installed++;
}
QueueFontWakeup(fpe);
return Successful;
}
void
-remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, Bool all)
+remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler,
+ Bool all)
{
if (all) {
- /* remove the handlers if no one else is using them */
- if (--fs_handlers_installed == 0) {
- RemoveBlockAndWakeupHandlers(block_handler, FontWakeup,
- (pointer) 0);
- }
+ /* remove the handlers if no one else is using them */
+ if (--fs_handlers_installed == 0) {
+ RemoveBlockAndWakeupHandlers(block_handler, FontWakeup,
+ (pointer) 0);
+ }
}
RemoveFontWakeup(fpe);
}
diff --git a/xorg-server/dix/dixutils.c b/xorg-server/dix/dixutils.c
index da26dc144..9eb54893a 100644
--- a/xorg-server/dix/dixutils.c
+++ b/xorg-server/dix/dixutils.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -81,7 +80,6 @@ Author: Adobe Systems Incorporated
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -107,13 +105,13 @@ int
CompareTimeStamps(TimeStamp a, TimeStamp b)
{
if (a.months < b.months)
- return EARLIER;
+ return EARLIER;
if (a.months > b.months)
- return LATER;
+ return LATER;
if (a.milliseconds < b.milliseconds)
- return EARLIER;
+ return EARLIER;
if (a.milliseconds > b.milliseconds)
- return LATER;
+ return LATER;
return SAMETIME;
}
@@ -126,19 +124,18 @@ TimeStamp
ClientTimeToServerTime(CARD32 c)
{
TimeStamp ts;
+
if (c == CurrentTime)
- return currentTime;
+ return currentTime;
ts.months = currentTime.months;
ts.milliseconds = c;
- if (c > currentTime.milliseconds)
- {
- if (((unsigned long) c - currentTime.milliseconds) > HALFMONTH)
- ts.months -= 1;
+ if (c > currentTime.milliseconds) {
+ if (((unsigned long) c - currentTime.milliseconds) > HALFMONTH)
+ ts.months -= 1;
}
- else if (c < currentTime.milliseconds)
- {
- if (((unsigned long)currentTime.milliseconds - c) > HALFMONTH)
- ts.months += 1;
+ else if (c < currentTime.milliseconds) {
+ if (((unsigned long) currentTime.milliseconds - c) > HALFMONTH)
+ ts.months += 1;
}
return ts;
}
@@ -151,36 +148,35 @@ ClientTimeToServerTime(CARD32 c)
*/
static unsigned char
-ISOLatin1ToLower (unsigned char source)
+ISOLatin1ToLower(unsigned char source)
{
- unsigned char dest;
+ unsigned char dest;
+
if ((source >= XK_A) && (source <= XK_Z))
- dest = source + (XK_a - XK_A);
+ dest = source + (XK_a - XK_A);
else if ((source >= XK_Agrave) && (source <= XK_Odiaeresis))
- dest = source + (XK_agrave - XK_Agrave);
+ dest = source + (XK_agrave - XK_Agrave);
else if ((source >= XK_Ooblique) && (source <= XK_Thorn))
- dest = source + (XK_oslash - XK_Ooblique);
+ dest = source + (XK_oslash - XK_Ooblique);
else
- dest = source;
+ dest = source;
return dest;
}
-
int
CompareISOLatin1Lowered(const unsigned char *s1, int s1len,
- const unsigned char *s2, int s2len)
-{
- unsigned char c1, c2;
-
- for (;;)
- {
- /* note -- compare against zero so that -1 ignores len */
- c1 = s1len-- ? *s1++ : '\0';
- c2 = s2len-- ? *s2++ : '\0';
- if (!c1 ||
- (c1 != c2 &&
- (c1 = ISOLatin1ToLower (c1)) != (c2 = ISOLatin1ToLower (c2))))
- break;
+ const unsigned char *s2, int s2len)
+{
+ unsigned char c1, c2;
+
+ for (;;) {
+ /* note -- compare against zero so that -1 ignores len */
+ c1 = s1len-- ? *s1++ : '\0';
+ c2 = s2len-- ? *s2++ : '\0';
+ if (!c1 ||
+ (c1 != c2 &&
+ (c1 = ISOLatin1ToLower(c1)) != (c2 = ISOLatin1ToLower(c2))))
+ break;
}
return (int) c1 - (int) c2;
}
@@ -196,24 +192,25 @@ CompareISOLatin1Lowered(const unsigned char *s1, int s1len,
*/
int
dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
- Mask type, Mask access)
+ Mask type, Mask access)
{
DrawablePtr pTmp;
int rc;
*pDraw = NULL;
- rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
+ rc = dixLookupResourceByClass((pointer *) &pTmp, id, RC_DRAWABLE, client,
+ access);
if (rc != Success)
- client->errorValue = id;
+ client->errorValue = id;
if (rc == BadValue)
- return BadDrawable;
+ return BadDrawable;
if (rc != Success)
- return rc;
+ return rc;
if (!((1 << pTmp->type) & (type ? type : M_DRAWABLE)))
- return BadMatch;
+ return BadMatch;
*pDraw = pTmp;
return Success;
@@ -223,22 +220,23 @@ int
dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
{
int rc;
- rc = dixLookupDrawable((DrawablePtr*)pWin, id, client, M_WINDOW, access);
+
+ rc = dixLookupDrawable((DrawablePtr *) pWin, id, client, M_WINDOW, access);
/* dixLookupDrawable returns BadMatch iff id is a valid Drawable
but is not a Window. Users of dixLookupWindow expect a BadWindow
error in this case; they don't care that it's a valid non-Window XID */
if (rc == BadMatch)
- rc = BadWindow;
+ rc = BadWindow;
/* Similarly, users of dixLookupWindow don't want BadDrawable. */
if (rc == BadDrawable)
- rc = BadWindow;
+ rc = BadWindow;
return rc;
}
int
dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access)
{
- return dixLookupResourceByType((pointer *)pGC, id, RT_GC, client, access);
+ return dixLookupResourceByType((pointer *) pGC, id, RT_GC, client, access);
}
int
@@ -246,15 +244,17 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
{
int rc;
GC *pGC;
- client->errorValue = id; /* EITHER font or gc */
- rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client, access);
+
+ client->errorValue = id; /* EITHER font or gc */
+ rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client,
+ access);
if (rc != BadFont)
- return rc;
+ return rc;
rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access);
if (rc == BadGC)
- return BadFont;
+ return BadFont;
if (rc == Success)
- *pFont = pGC->font;
+ *pFont = pGC->font;
return rc;
}
@@ -265,20 +265,20 @@ dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
int rc = BadValue, clientIndex = CLIENT_ID(rid);
if (!clientIndex || !clients[clientIndex] || (rid & SERVER_BIT))
- goto bad;
+ goto bad;
rc = dixLookupResourceByClass(&pRes, rid, RC_ANY, client, DixGetAttrAccess);
if (rc != Success)
- goto bad;
+ goto bad;
rc = XaceHook(XACE_CLIENT_ACCESS, client, clients[clientIndex], access);
if (rc != Success)
- goto bad;
+ goto bad;
*pClient = clients[clientIndex];
return Success;
-bad:
- if(client)
+ bad:
+ if (client)
client->errorValue = rid;
*pClient = NULL;
return rc;
@@ -294,48 +294,43 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
numnow = client->numSaved;
j = 0;
- if (numnow)
- {
- pTmp = client->saveSet;
- while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (pointer)pWin))
- j++;
+ if (numnow) {
+ pTmp = client->saveSet;
+ while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (pointer) pWin))
+ j++;
}
- if (mode == SetModeInsert)
- {
- if (j < numnow) /* duplicate */
- return Success;
- numnow++;
- pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow);
- if (!pTmp)
- return BadAlloc;
- client->saveSet = pTmp;
- client->numSaved = numnow;
- SaveSetAssignWindow(client->saveSet[numnow - 1], pWin);
- SaveSetAssignToRoot(client->saveSet[numnow - 1], toRoot);
- SaveSetAssignMap(client->saveSet[numnow - 1], map);
- return Success;
+ if (mode == SetModeInsert) {
+ if (j < numnow) /* duplicate */
+ return Success;
+ numnow++;
+ pTmp = (SaveSetElt *) realloc(client->saveSet, sizeof(*pTmp) * numnow);
+ if (!pTmp)
+ return BadAlloc;
+ client->saveSet = pTmp;
+ client->numSaved = numnow;
+ SaveSetAssignWindow(client->saveSet[numnow - 1], pWin);
+ SaveSetAssignToRoot(client->saveSet[numnow - 1], toRoot);
+ SaveSetAssignMap(client->saveSet[numnow - 1], map);
+ return Success;
}
- else if ((mode == SetModeDelete) && (j < numnow))
- {
- while (j < numnow-1)
- {
- pTmp[j] = pTmp[j+1];
- j++;
- }
- numnow--;
- if (numnow)
- {
- pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow);
- if (pTmp)
- client->saveSet = pTmp;
- }
- else
- {
+ else if ((mode == SetModeDelete) && (j < numnow)) {
+ while (j < numnow - 1) {
+ pTmp[j] = pTmp[j + 1];
+ j++;
+ }
+ numnow--;
+ if (numnow) {
+ pTmp =
+ (SaveSetElt *) realloc(client->saveSet, sizeof(*pTmp) * numnow);
+ if (pTmp)
+ client->saveSet = pTmp;
+ }
+ else {
free(client->saveSet);
- client->saveSet = (SaveSetElt *)NULL;
- }
- client->numSaved = numnow;
- return Success;
+ client->saveSet = (SaveSetElt *) NULL;
+ }
+ client->numSaved = numnow;
+ return Success;
}
return Success;
}
@@ -345,12 +340,12 @@ DeleteWindowFromAnySaveSet(WindowPtr pWin)
{
int i;
ClientPtr client;
-
- for (i = 0; i< currentMaxClients; i++)
- {
- client = clients[i];
- if (client && client->numSaved)
- (void)AlterSaveSetForClient(client, pWin, SetModeDelete, FALSE, TRUE);
+
+ for (i = 0; i < currentMaxClients; i++) {
+ client = clients[i];
+ if (client && client->numSaved)
+ (void) AlterSaveSetForClient(client, pWin, SetModeDelete, FALSE,
+ TRUE);
}
}
@@ -368,14 +363,14 @@ typedef struct _BlockHandler {
BlockHandlerProcPtr BlockHandler;
WakeupHandlerProcPtr WakeupHandler;
pointer blockData;
- Bool deleted;
+ Bool deleted;
} BlockHandlerRec, *BlockHandlerPtr;
-static BlockHandlerPtr handlers;
-static int numHandlers;
-static int sizeHandlers;
-static Bool inHandler;
-static Bool handlerDeleted;
+static BlockHandlerPtr handlers;
+static int numHandlers;
+static int sizeHandlers;
+static Bool inHandler;
+static Bool handlerDeleted;
/**
*
@@ -386,28 +381,26 @@ void
BlockHandler(pointer pTimeout, pointer pReadmask)
{
int i, j;
-
+
++inHandler;
for (i = 0; i < screenInfo.numScreens; i++)
- (* screenInfo.screens[i]->BlockHandler)(i,
- screenInfo.screens[i]->blockData,
- pTimeout, pReadmask);
+ (*screenInfo.screens[i]->BlockHandler) (i,
+ screenInfo.screens[i]->
+ blockData, pTimeout, pReadmask);
for (i = 0; i < numHandlers; i++)
- if (!handlers[i].deleted)
- (*handlers[i].BlockHandler) (handlers[i].blockData,
- pTimeout, pReadmask);
- if (handlerDeleted)
- {
- for (i = 0; i < numHandlers;)
- if (handlers[i].deleted)
- {
- for (j = i; j < numHandlers - 1; j++)
- handlers[j] = handlers[j+1];
- numHandlers--;
- }
- else
- i++;
- handlerDeleted = FALSE;
+ if (!handlers[i].deleted)
+ (*handlers[i].BlockHandler) (handlers[i].blockData,
+ pTimeout, pReadmask);
+ if (handlerDeleted) {
+ for (i = 0; i < numHandlers;)
+ if (handlers[i].deleted) {
+ for (j = i; j < numHandlers - 1; j++)
+ handlers[j] = handlers[j + 1];
+ numHandlers--;
+ }
+ else
+ i++;
+ handlerDeleted = FALSE;
}
--inHandler;
}
@@ -424,25 +417,23 @@ WakeupHandler(int result, pointer pReadmask)
++inHandler;
for (i = numHandlers - 1; i >= 0; i--)
- if (!handlers[i].deleted)
- (*handlers[i].WakeupHandler) (handlers[i].blockData,
- result, pReadmask);
+ if (!handlers[i].deleted)
+ (*handlers[i].WakeupHandler) (handlers[i].blockData,
+ result, pReadmask);
for (i = 0; i < screenInfo.numScreens; i++)
- (* screenInfo.screens[i]->WakeupHandler)(i,
- screenInfo.screens[i]->wakeupData,
- result, pReadmask);
- if (handlerDeleted)
- {
- for (i = 0; i < numHandlers;)
- if (handlers[i].deleted)
- {
- for (j = i; j < numHandlers - 1; j++)
- handlers[j] = handlers[j+1];
- numHandlers--;
- }
- else
- i++;
- handlerDeleted = FALSE;
+ (*screenInfo.screens[i]->WakeupHandler) (i,
+ screenInfo.screens[i]->
+ wakeupData, result, pReadmask);
+ if (handlerDeleted) {
+ for (i = 0; i < numHandlers;)
+ if (handlers[i].deleted) {
+ for (j = i; j < numHandlers - 1; j++)
+ handlers[j] = handlers[j + 1];
+ numHandlers--;
+ }
+ else
+ i++;
+ handlerDeleted = FALSE;
}
--inHandler;
}
@@ -452,20 +443,19 @@ WakeupHandler(int result, pointer pReadmask)
* get called until next time
*/
Bool
-RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
- WakeupHandlerProcPtr wakeupHandler,
- pointer blockData)
+RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
+ WakeupHandlerProcPtr wakeupHandler,
+ pointer blockData)
{
BlockHandlerPtr new;
- if (numHandlers >= sizeHandlers)
- {
+ if (numHandlers >= sizeHandlers) {
new = (BlockHandlerPtr) realloc(handlers, (numHandlers + 1) *
- sizeof (BlockHandlerRec));
- if (!new)
- return FALSE;
- handlers = new;
- sizeHandlers = numHandlers + 1;
+ sizeof(BlockHandlerRec));
+ if (!new)
+ return FALSE;
+ handlers = new;
+ sizeHandlers = numHandlers + 1;
}
handlers[numHandlers].BlockHandler = blockHandler;
handlers[numHandlers].WakeupHandler = wakeupHandler;
@@ -476,34 +466,31 @@ RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
}
void
-RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
- WakeupHandlerProcPtr wakeupHandler,
- pointer blockData)
+RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
+ WakeupHandlerProcPtr wakeupHandler,
+ pointer blockData)
{
- int i;
+ int i;
for (i = 0; i < numHandlers; i++)
- if (handlers[i].BlockHandler == blockHandler &&
- handlers[i].WakeupHandler == wakeupHandler &&
- handlers[i].blockData == blockData)
- {
- if (inHandler)
- {
- handlerDeleted = TRUE;
- handlers[i].deleted = TRUE;
- }
- else
- {
- for (; i < numHandlers - 1; i++)
- handlers[i] = handlers[i+1];
- numHandlers--;
- }
- break;
- }
+ if (handlers[i].BlockHandler == blockHandler &&
+ handlers[i].WakeupHandler == wakeupHandler &&
+ handlers[i].blockData == blockData) {
+ if (inHandler) {
+ handlerDeleted = TRUE;
+ handlers[i].deleted = TRUE;
+ }
+ else {
+ for (; i < numHandlers - 1; i++)
+ handlers[i] = handlers[i + 1];
+ numHandlers--;
+ }
+ break;
+ }
}
void
-InitBlockAndWakeupHandlers (void)
+InitBlockAndWakeupHandlers(void)
{
free(handlers);
handlers = (BlockHandlerPtr) 0;
@@ -516,13 +503,13 @@ InitBlockAndWakeupHandlers (void)
* sleeps for input.
*/
-WorkQueuePtr workQueue;
-static WorkQueuePtr *workQueueLast = &workQueue;
+WorkQueuePtr workQueue;
+static WorkQueuePtr *workQueueLast = &workQueue;
void
ProcessWorkQueue(void)
{
- WorkQueuePtr q, *p;
+ WorkQueuePtr q, *p;
p = &workQueue;
/*
@@ -531,18 +518,15 @@ ProcessWorkQueue(void)
* they will be called again. This must be reentrant with
* QueueWorkProc.
*/
- while ((q = *p))
- {
- if ((*q->function) (q->client, q->closure))
- {
- /* remove q from the list */
- *p = q->next; /* don't fetch until after func called */
- free(q);
- }
- else
- {
- p = &q->next; /* don't fetch until after func called */
- }
+ while ((q = *p)) {
+ if ((*q->function) (q->client, q->closure)) {
+ /* remove q from the list */
+ *p = q->next; /* don't fetch until after func called */
+ free(q);
+ }
+ else {
+ p = &q->next; /* don't fetch until after func called */
+ }
}
workQueueLast = p;
}
@@ -550,36 +534,33 @@ ProcessWorkQueue(void)
void
ProcessWorkQueueZombies(void)
{
- WorkQueuePtr q, *p;
+ WorkQueuePtr q, *p;
p = &workQueue;
- while ((q = *p))
- {
- if (q->client && q->client->clientGone)
- {
- (void) (*q->function) (q->client, q->closure);
- /* remove q from the list */
- *p = q->next; /* don't fetch until after func called */
- free(q);
- }
- else
- {
- p = &q->next; /* don't fetch until after func called */
- }
+ while ((q = *p)) {
+ if (q->client && q->client->clientGone) {
+ (void) (*q->function) (q->client, q->closure);
+ /* remove q from the list */
+ *p = q->next; /* don't fetch until after func called */
+ free(q);
+ }
+ else {
+ p = &q->next; /* don't fetch until after func called */
+ }
}
workQueueLast = p;
}
Bool
-QueueWorkProc (
- Bool (*function)(ClientPtr /* pClient */, pointer /* closure */),
- ClientPtr client, pointer closure)
+QueueWorkProc(Bool (*function)
+ (ClientPtr /* pClient */ , pointer /* closure */ ),
+ ClientPtr client, pointer closure)
{
- WorkQueuePtr q;
+ WorkQueuePtr q;
q = malloc(sizeof *q);
if (!q)
- return FALSE;
+ return FALSE;
q->function = function;
q->client = client;
q->closure = closure;
@@ -598,24 +579,24 @@ QueueWorkProc (
*/
typedef struct _SleepQueue {
- struct _SleepQueue *next;
- ClientPtr client;
- ClientSleepProcPtr function;
- pointer closure;
+ struct _SleepQueue *next;
+ ClientPtr client;
+ ClientSleepProcPtr function;
+ pointer closure;
} SleepQueueRec, *SleepQueuePtr;
-static SleepQueuePtr sleepQueue = NULL;
+static SleepQueuePtr sleepQueue = NULL;
Bool
-ClientSleep (ClientPtr client, ClientSleepProcPtr function, pointer closure)
+ClientSleep(ClientPtr client, ClientSleepProcPtr function, pointer closure)
{
- SleepQueuePtr q;
+ SleepQueuePtr q;
q = malloc(sizeof *q);
if (!q)
- return FALSE;
+ return FALSE;
- IgnoreClient (client);
+ IgnoreClient(client);
q->next = sleepQueue;
q->client = client;
q->function = function;
@@ -625,52 +606,49 @@ ClientSleep (ClientPtr client, ClientSleepProcPtr function, pointer closure)
}
Bool
-ClientSignal (ClientPtr client)
+ClientSignal(ClientPtr client)
{
- SleepQueuePtr q;
+ SleepQueuePtr q;
for (q = sleepQueue; q; q = q->next)
- if (q->client == client)
- {
- return QueueWorkProc (q->function, q->client, q->closure);
- }
+ if (q->client == client) {
+ return QueueWorkProc(q->function, q->client, q->closure);
+ }
return FALSE;
}
void
-ClientWakeup (ClientPtr client)
+ClientWakeup(ClientPtr client)
{
- SleepQueuePtr q, *prev;
+ SleepQueuePtr q, *prev;
prev = &sleepQueue;
- while ( (q = *prev) )
- {
- if (q->client == client)
- {
- *prev = q->next;
- free(q);
- if (client->clientGone)
- /* Oops -- new zombie cleanup code ensures this only
- * happens from inside CloseDownClient; don't want to
- * recurse here...
- */
- /* CloseDownClient(client) */;
- else
- AttendClient (client);
- break;
- }
- prev = &q->next;
+ while ((q = *prev)) {
+ if (q->client == client) {
+ *prev = q->next;
+ free(q);
+ if (client->clientGone)
+ /* Oops -- new zombie cleanup code ensures this only
+ * happens from inside CloseDownClient; don't want to
+ * recurse here...
+ */
+ /* CloseDownClient(client) */ ;
+ else
+ AttendClient(client);
+ break;
+ }
+ prev = &q->next;
}
}
Bool
-ClientIsAsleep (ClientPtr client)
+ClientIsAsleep(ClientPtr client)
{
- SleepQueuePtr q;
+ SleepQueuePtr q;
for (q = sleepQueue; q; q = q->next)
- if (q->client == client)
- return TRUE;
+ if (q->client == client)
+ return TRUE;
return FALSE;
}
@@ -684,16 +662,13 @@ static int numCallbackListsToCleanup = 0;
static CallbackListPtr **listsToCleanup = NULL;
static Bool
-_AddCallback(
- CallbackListPtr *pcbl,
- CallbackProcPtr callback,
- pointer data)
+_AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
{
- CallbackPtr cbr;
+ CallbackPtr cbr;
cbr = malloc(sizeof(CallbackRec));
if (!cbr)
- return FALSE;
+ return FALSE;
cbr->proc = callback;
cbr->data = data;
cbr->next = (*pcbl)->list;
@@ -702,126 +677,105 @@ _AddCallback(
return TRUE;
}
-static Bool
-_DeleteCallback(
- CallbackListPtr *pcbl,
- CallbackProcPtr callback,
- pointer data)
+static Bool
+_DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
{
CallbackListPtr cbl = *pcbl;
- CallbackPtr cbr, pcbr;
-
- for (pcbr = NULL, cbr = cbl->list;
- cbr != NULL;
- pcbr = cbr, cbr = cbr->next)
- {
- if ((cbr->proc == callback) && (cbr->data == data))
- break;
+ CallbackPtr cbr, pcbr;
+
+ for (pcbr = NULL, cbr = cbl->list; cbr != NULL; pcbr = cbr, cbr = cbr->next) {
+ if ((cbr->proc == callback) && (cbr->data == data))
+ break;
}
- if (cbr != NULL)
- {
- if (cbl->inCallback)
- {
- ++(cbl->numDeleted);
- cbr->deleted = TRUE;
- }
- else
- {
- if (pcbr == NULL)
- cbl->list = cbr->next;
- else
- pcbr->next = cbr->next;
- free(cbr);
- }
- return TRUE;
+ if (cbr != NULL) {
+ if (cbl->inCallback) {
+ ++(cbl->numDeleted);
+ cbr->deleted = TRUE;
+ }
+ else {
+ if (pcbr == NULL)
+ cbl->list = cbr->next;
+ else
+ pcbr->next = cbr->next;
+ free(cbr);
+ }
+ return TRUE;
}
return FALSE;
}
-void
-_CallCallbacks(
- CallbackListPtr *pcbl,
- pointer call_data)
+void
+_CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
{
CallbackListPtr cbl = *pcbl;
- CallbackPtr cbr, pcbr;
+ CallbackPtr cbr, pcbr;
++(cbl->inCallback);
- for (cbr = cbl->list; cbr != NULL; cbr = cbr->next)
- {
- (*(cbr->proc)) (pcbl, cbr->data, call_data);
+ for (cbr = cbl->list; cbr != NULL; cbr = cbr->next) {
+ (*(cbr->proc)) (pcbl, cbr->data, call_data);
}
--(cbl->inCallback);
- if (cbl->inCallback) return;
+ if (cbl->inCallback)
+ return;
/* Was the entire list marked for deletion? */
- if (cbl->deleted)
- {
- DeleteCallbackList(pcbl);
- return;
+ if (cbl->deleted) {
+ DeleteCallbackList(pcbl);
+ return;
}
/* Were some individual callbacks on the list marked for deletion?
* If so, do the deletions.
*/
- if (cbl->numDeleted)
- {
- for (pcbr = NULL, cbr = cbl->list; (cbr != NULL) && cbl->numDeleted; )
- {
- if (cbr->deleted)
- {
- if (pcbr)
- {
- cbr = cbr->next;
- free(pcbr->next);
- pcbr->next = cbr;
- } else
- {
- cbr = cbr->next;
- free(cbl->list);
- cbl->list = cbr;
- }
- cbl->numDeleted--;
- }
- else /* this one wasn't deleted */
- {
- pcbr = cbr;
- cbr = cbr->next;
- }
- }
+ if (cbl->numDeleted) {
+ for (pcbr = NULL, cbr = cbl->list; (cbr != NULL) && cbl->numDeleted;) {
+ if (cbr->deleted) {
+ if (pcbr) {
+ cbr = cbr->next;
+ free(pcbr->next);
+ pcbr->next = cbr;
+ }
+ else {
+ cbr = cbr->next;
+ free(cbl->list);
+ cbl->list = cbr;
+ }
+ cbl->numDeleted--;
+ }
+ else { /* this one wasn't deleted */
+
+ pcbr = cbr;
+ cbr = cbr->next;
+ }
+ }
}
}
static void
-_DeleteCallbackList(
- CallbackListPtr *pcbl)
+_DeleteCallbackList(CallbackListPtr *pcbl)
{
CallbackListPtr cbl = *pcbl;
- CallbackPtr cbr, nextcbr;
+ CallbackPtr cbr, nextcbr;
int i;
- if (cbl->inCallback)
- {
- cbl->deleted = TRUE;
- return;
+ if (cbl->inCallback) {
+ cbl->deleted = TRUE;
+ return;
}
- for (i = 0; i < numCallbackListsToCleanup; i++)
- {
- if (listsToCleanup[i] == pcbl)
- {
- listsToCleanup[i] = NULL;
- break;
- }
+ for (i = 0; i < numCallbackListsToCleanup; i++) {
+ if (listsToCleanup[i] == pcbl) {
+ listsToCleanup[i] = NULL;
+ break;
+ }
}
- for (cbr = cbl->list; cbr != NULL; cbr = nextcbr)
- {
- nextcbr = cbr->next;
- free(cbr);
+ for (cbr = cbl->list; cbr != NULL; cbr = nextcbr) {
+ nextcbr = cbr->next;
+ free(cbr);
}
free(cbl);
*pcbl = NULL;
@@ -830,29 +784,31 @@ _DeleteCallbackList(
static Bool
CreateCallbackList(CallbackListPtr *pcbl)
{
- CallbackListPtr cbl;
+ CallbackListPtr cbl;
int i;
- if (!pcbl) return FALSE;
+ if (!pcbl)
+ return FALSE;
cbl = malloc(sizeof(CallbackListRec));
- if (!cbl) return FALSE;
+ if (!cbl)
+ return FALSE;
cbl->inCallback = 0;
cbl->deleted = FALSE;
cbl->numDeleted = 0;
cbl->list = NULL;
*pcbl = cbl;
- for (i = 0; i < numCallbackListsToCleanup; i++)
- {
- if (!listsToCleanup[i])
- {
- listsToCleanup[i] = pcbl;
- return TRUE;
- }
+ for (i = 0; i < numCallbackListsToCleanup; i++) {
+ if (!listsToCleanup[i]) {
+ listsToCleanup[i] = pcbl;
+ return TRUE;
+ }
}
- listsToCleanup = (CallbackListPtr **)xnfrealloc(listsToCleanup,
- sizeof(CallbackListPtr *) * (numCallbackListsToCleanup+1));
+ listsToCleanup = (CallbackListPtr **) xnfrealloc(listsToCleanup,
+ sizeof(CallbackListPtr *) *
+ (numCallbackListsToCleanup
+ + 1));
listsToCleanup[numCallbackListsToCleanup] = pcbl;
numCallbackListsToCleanup++;
return TRUE;
@@ -863,11 +819,11 @@ CreateCallbackList(CallbackListPtr *pcbl)
Bool
AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
{
- if (!pcbl) return FALSE;
- if (!*pcbl)
- { /* list hasn't been created yet; go create it */
- if (!CreateCallbackList(pcbl))
- return FALSE;
+ if (!pcbl)
+ return FALSE;
+ if (!*pcbl) { /* list hasn't been created yet; go create it */
+ if (!CreateCallbackList(pcbl))
+ return FALSE;
}
return _AddCallback(pcbl, callback, data);
}
@@ -875,14 +831,16 @@ AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
Bool
DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
{
- if (!pcbl || !*pcbl) return FALSE;
+ if (!pcbl || !*pcbl)
+ return FALSE;
return _DeleteCallback(pcbl, callback, data);
}
void
DeleteCallbackList(CallbackListPtr *pcbl)
{
- if (!pcbl || !*pcbl) return;
+ if (!pcbl || !*pcbl)
+ return;
_DeleteCallbackList(pcbl);
}
@@ -891,9 +849,8 @@ InitCallbackManager(void)
{
int i;
- for (i = 0; i < numCallbackListsToCleanup; i++)
- {
- DeleteCallbackList(listsToCleanup[i]);
+ for (i = 0; i < numCallbackListsToCleanup; i++) {
+ DeleteCallbackList(listsToCleanup[i]);
}
free(listsToCleanup);
diff --git a/xorg-server/dix/enterleave.c b/xorg-server/dix/enterleave.c
index 89a82ab99..725080a4c 100644
--- a/xorg-server/dix/enterleave.c
+++ b/xorg-server/dix/enterleave.c
@@ -106,6 +106,7 @@ static BOOL
HasFocus(WindowPtr win)
{
int i;
+
for (i = 0; i < MAXDEVICES; i++)
if (FocusWindows[i] == win)
return TRUE;
@@ -133,8 +134,8 @@ static WindowPtr
FirstPointerChild(WindowPtr win)
{
int i;
- for (i = 0; i < MAXDEVICES; i++)
- {
+
+ for (i = 0; i < MAXDEVICES; i++) {
if (PointerWindows[i] && IsParent(win, PointerWindows[i]))
return PointerWindows[i];
}
@@ -153,8 +154,8 @@ static WindowPtr
FirstFocusChild(WindowPtr win)
{
int i;
- for (i = 0; i < MAXDEVICES; i++)
- {
+
+ for (i = 0; i < MAXDEVICES; i++) {
if (FocusWindows[i] && FocusWindows[i] != PointerRootWin &&
IsParent(win, FocusWindows[i]))
return FocusWindows[i];
@@ -199,9 +200,6 @@ SetFocusOut(DeviceIntPtr dev)
FocusWindows[dev->id] = NULL;
}
-
-
-
/**
* Return the common ancestor of 'a' and 'b' (if one exists).
* @param a A window with the same ancestor as b.
@@ -210,16 +208,14 @@ SetFocusOut(DeviceIntPtr dev)
* NullWindow if they do not have a common ancestor.
*/
WindowPtr
-CommonAncestor(
- WindowPtr a,
- WindowPtr b)
+CommonAncestor(WindowPtr a, WindowPtr b)
{
for (b = b->parent; b; b = b->parent)
- if (IsParent(b, a)) return b;
+ if (IsParent(b, a))
+ return b;
return NullWindow;
}
-
/**
* Send enter notifies to all windows between 'ancestor' and 'child' (excluding
* both). Events are sent running up the window hierarchy. This function
@@ -227,16 +223,13 @@ CommonAncestor(
*/
static void
DeviceEnterNotifies(DeviceIntPtr dev,
- int sourceid,
- WindowPtr ancestor,
- WindowPtr child,
- int mode,
- int detail)
+ int sourceid,
+ WindowPtr ancestor, WindowPtr child, int mode, int detail)
{
- WindowPtr parent = child->parent;
+ WindowPtr parent = child->parent;
if (ancestor == parent)
- return;
+ return;
DeviceEnterNotifies(dev, sourceid, ancestor, parent, mode, detail);
DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, detail, parent,
child->drawable.id);
@@ -249,79 +242,73 @@ DeviceEnterNotifies(DeviceIntPtr dev,
*/
static void
CoreEnterNotifies(DeviceIntPtr dev,
- WindowPtr ancestor,
- WindowPtr child,
- int mode,
- int detail)
+ WindowPtr ancestor, WindowPtr child, int mode, int detail)
{
- WindowPtr parent = child->parent;
+ WindowPtr parent = child->parent;
+
if (ancestor == parent)
- return;
+ return;
CoreEnterNotifies(dev, ancestor, parent, mode, detail);
-
/* Case 3:
- A is above W, B is a descendant
-
- Classically: The move generates an EnterNotify on W with a detail of
- Virtual or NonlinearVirtual
-
- MPX:
- Case 3A: There is at least one other pointer on W itself
- P(W) doesn't change, so the event should be suppressed
- Case 3B: Otherwise, if there is at least one other pointer in a
- descendant
- P(W) stays on the same descendant, or changes to a different
- descendant. The event should be suppressed.
- Case 3C: Otherwise:
- P(W) moves from a window above W to a descendant. The subwindow
- field is set to the child containing the descendant. The detail
- may need to be changed from Virtual to NonlinearVirtual depending
- on the previous P(W). */
+ A is above W, B is a descendant
+
+ Classically: The move generates an EnterNotify on W with a detail of
+ Virtual or NonlinearVirtual
+
+ MPX:
+ Case 3A: There is at least one other pointer on W itself
+ P(W) doesn't change, so the event should be suppressed
+ Case 3B: Otherwise, if there is at least one other pointer in a
+ descendant
+ P(W) stays on the same descendant, or changes to a different
+ descendant. The event should be suppressed.
+ Case 3C: Otherwise:
+ P(W) moves from a window above W to a descendant. The subwindow
+ field is set to the child containing the descendant. The detail
+ may need to be changed from Virtual to NonlinearVirtual depending
+ on the previous P(W). */
if (!HasPointer(dev, parent) && !FirstPointerChild(parent))
- CoreEnterLeaveEvent(dev, EnterNotify, mode, detail, parent,
- child->drawable.id);
+ CoreEnterLeaveEvent(dev, EnterNotify, mode, detail, parent,
+ child->drawable.id);
}
static void
CoreLeaveNotifies(DeviceIntPtr dev,
- WindowPtr child,
- WindowPtr ancestor,
- int mode,
- int detail)
+ WindowPtr child, WindowPtr ancestor, int mode, int detail)
{
- WindowPtr win;
+ WindowPtr win;
if (ancestor == child)
return;
- for (win = child->parent; win != ancestor; win = win->parent)
- {
+ for (win = child->parent; win != ancestor; win = win->parent) {
/*Case 7:
- A is a descendant of W, B is above W
-
- Classically: A LeaveNotify is generated on W with a detail of Virtual
- or NonlinearVirtual.
-
- MPX:
- Case 3A: There is at least one other pointer on W itself
- P(W) doesn't change, the event should be suppressed.
- Case 3B: Otherwise, if there is at least one other pointer in a
- descendant
- P(W) stays on the same descendant, or changes to a different
- descendant. The event should be suppressed.
- Case 3C: Otherwise:
- P(W) changes from the descendant of W to a window above W.
- The detail may need to be changed from Virtual to NonlinearVirtual
- or vice-versa depending on the new P(W).*/
+ A is a descendant of W, B is above W
+
+ Classically: A LeaveNotify is generated on W with a detail of Virtual
+ or NonlinearVirtual.
+
+ MPX:
+ Case 3A: There is at least one other pointer on W itself
+ P(W) doesn't change, the event should be suppressed.
+ Case 3B: Otherwise, if there is at least one other pointer in a
+ descendant
+ P(W) stays on the same descendant, or changes to a different
+ descendant. The event should be suppressed.
+ Case 3C: Otherwise:
+ P(W) changes from the descendant of W to a window above W.
+ The detail may need to be changed from Virtual to NonlinearVirtual
+ or vice-versa depending on the new P(W). */
/* If one window has a pointer or a child with a pointer, skip some
* work and exit. */
if (HasPointer(dev, win) || FirstPointerChild(win))
return;
- CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win, child->drawable.id);
+ CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win,
+ child->drawable.id);
child = win;
}
@@ -333,20 +320,16 @@ CoreLeaveNotifies(DeviceIntPtr dev,
*/
static void
DeviceLeaveNotifies(DeviceIntPtr dev,
- int sourceid,
- WindowPtr child,
- WindowPtr ancestor,
- int mode,
- int detail)
+ int sourceid,
+ WindowPtr child, WindowPtr ancestor, int mode, int detail)
{
- WindowPtr win;
+ WindowPtr win;
if (ancestor == child)
- return;
- for (win = child->parent; win != ancestor; win = win->parent)
- {
+ return;
+ for (win = child->parent; win != ancestor; win = win->parent) {
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, detail, win,
- child->drawable.id);
+ child->drawable.id);
child = win;
}
}
@@ -356,205 +339,198 @@ DeviceLeaveNotifies(DeviceIntPtr dev,
* B a descendant of A.
*/
static void
-CoreEnterLeaveNonLinear(DeviceIntPtr dev,
- WindowPtr A,
- WindowPtr B,
- int mode)
+CoreEnterLeaveNonLinear(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
{
WindowPtr X = CommonAncestor(A, B);
+
/* Case 4:
- A is W, B is above W
+ A is W, B is above W
- Classically: The move generates a LeaveNotify on W with a detail of
+ Classically: The move generates a LeaveNotify on W with a detail of
Ancestor or Nonlinear
- MPX:
- Case 3A: There is at least one other pointer on W itself
- P(W) doesn't change, the event should be suppressed
- Case 3B: Otherwise, if there is at least one other pointer in a
- descendant of W
- P(W) changes from W to a descendant of W. The subwindow field
- is set to the child containing the new P(W), the detail field
- is set to Inferior
- Case 3C: Otherwise:
- The pointer window moves from W to a window above W.
- The detail may need to be changed from Ancestor to Nonlinear or
- vice versa depending on the the new P(W)
+ MPX:
+ Case 3A: There is at least one other pointer on W itself
+ P(W) doesn't change, the event should be suppressed
+ Case 3B: Otherwise, if there is at least one other pointer in a
+ descendant of W
+ P(W) changes from W to a descendant of W. The subwindow field
+ is set to the child containing the new P(W), the detail field
+ is set to Inferior
+ Case 3C: Otherwise:
+ The pointer window moves from W to a window above W.
+ The detail may need to be changed from Ancestor to Nonlinear or
+ vice versa depending on the the new P(W)
*/
- if (!HasPointer(dev, A))
- {
+ if (!HasPointer(dev, A)) {
WindowPtr child = FirstPointerChild(A);
+
if (child)
- CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
+ CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A,
+ None);
else
- CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyNonlinear, A, None);
+ CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyNonlinear, A,
+ None);
}
-
CoreLeaveNotifies(dev, A, X, mode, NotifyNonlinearVirtual);
/*
- Case 9:
- A is a descendant of W, B is a descendant of W
-
- Classically: No events are generated on W
- MPX: The pointer window stays the same or moves to a different
- descendant of W. No events should be generated on W.
+ Case 9:
+ A is a descendant of W, B is a descendant of W
+ Classically: No events are generated on W
+ MPX: The pointer window stays the same or moves to a different
+ descendant of W. No events should be generated on W.
Therefore, no event to X.
- */
+ */
CoreEnterNotifies(dev, X, B, mode, NotifyNonlinearVirtual);
/* Case 2:
- A is above W, B=W
-
- Classically: The move generates an EnterNotify on W with a detail of
- Ancestor or Nonlinear
-
- MPX:
- Case 2A: There is at least one other pointer on W itself
- P(W) doesn't change, so the event should be suppressed
- Case 2B: Otherwise, if there is at least one other pointer in a
- descendant
- P(W) moves from a descendant to W. detail is changed to Inferior,
- subwindow is set to the child containing the previous P(W)
- Case 2C: Otherwise:
- P(W) changes from a window above W to W itself.
- The detail may need to be changed from Ancestor to Nonlinear
- or vice-versa depending on the previous P(W). */
-
- if (!HasPointer(dev, B))
- {
- WindowPtr child = FirstPointerChild(B);
- if (child)
- CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None);
- else
- CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyNonlinear, B, None);
- }
+ A is above W, B=W
+
+ Classically: The move generates an EnterNotify on W with a detail of
+ Ancestor or Nonlinear
+
+ MPX:
+ Case 2A: There is at least one other pointer on W itself
+ P(W) doesn't change, so the event should be suppressed
+ Case 2B: Otherwise, if there is at least one other pointer in a
+ descendant
+ P(W) moves from a descendant to W. detail is changed to Inferior,
+ subwindow is set to the child containing the previous P(W)
+ Case 2C: Otherwise:
+ P(W) changes from a window above W to W itself.
+ The detail may need to be changed from Ancestor to Nonlinear
+ or vice-versa depending on the previous P(W). */
+
+ if (!HasPointer(dev, B)) {
+ WindowPtr child = FirstPointerChild(B);
+
+ if (child)
+ CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B,
+ None);
+ else
+ CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyNonlinear, B,
+ None);
+ }
}
/**
* Pointer dev moves from A to B and A is a descendant of B.
*/
static void
-CoreEnterLeaveToAncestor(DeviceIntPtr dev,
- WindowPtr A,
- WindowPtr B,
- int mode)
+CoreEnterLeaveToAncestor(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
{
/* Case 4:
- A is W, B is above W
+ A is W, B is above W
- Classically: The move generates a LeaveNotify on W with a detail of
+ Classically: The move generates a LeaveNotify on W with a detail of
Ancestor or Nonlinear
- MPX:
- Case 3A: There is at least one other pointer on W itself
- P(W) doesn't change, the event should be suppressed
- Case 3B: Otherwise, if there is at least one other pointer in a
- descendant of W
- P(W) changes from W to a descendant of W. The subwindow field
- is set to the child containing the new P(W), the detail field
- is set to Inferior
- Case 3C: Otherwise:
- The pointer window moves from W to a window above W.
- The detail may need to be changed from Ancestor to Nonlinear or
- vice versa depending on the the new P(W)
+ MPX:
+ Case 3A: There is at least one other pointer on W itself
+ P(W) doesn't change, the event should be suppressed
+ Case 3B: Otherwise, if there is at least one other pointer in a
+ descendant of W
+ P(W) changes from W to a descendant of W. The subwindow field
+ is set to the child containing the new P(W), the detail field
+ is set to Inferior
+ Case 3C: Otherwise:
+ The pointer window moves from W to a window above W.
+ The detail may need to be changed from Ancestor to Nonlinear or
+ vice versa depending on the the new P(W)
*/
- if (!HasPointer(dev, A))
- {
+ if (!HasPointer(dev, A)) {
WindowPtr child = FirstPointerChild(A);
+
if (child)
- CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
+ CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A,
+ None);
else
- CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyAncestor, A, None);
+ CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyAncestor, A,
+ None);
}
CoreLeaveNotifies(dev, A, B, mode, NotifyVirtual);
/* Case 8:
- A is a descendant of W, B is W
+ A is a descendant of W, B is W
- Classically: A EnterNotify is generated on W with a detail of
- NotifyInferior
+ Classically: A EnterNotify is generated on W with a detail of
+ NotifyInferior
- MPX:
- Case 3A: There is at least one other pointer on W itself
- P(W) doesn't change, the event should be suppressed
- Case 3B: Otherwise:
- P(W) changes from a descendant to W itself. The subwindow
- field should be set to the child containing the old P(W) <<< WRONG */
+ MPX:
+ Case 3A: There is at least one other pointer on W itself
+ P(W) doesn't change, the event should be suppressed
+ Case 3B: Otherwise:
+ P(W) changes from a descendant to W itself. The subwindow
+ field should be set to the child containing the old P(W) <<< WRONG */
if (!HasPointer(dev, B))
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None);
}
-
/**
* Pointer dev moves from A to B and B is a descendant of A.
*/
static void
-CoreEnterLeaveToDescendant(DeviceIntPtr dev,
- WindowPtr A,
- WindowPtr B,
- int mode)
+CoreEnterLeaveToDescendant(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
{
/* Case 6:
- A is W, B is a descendant of W
+ A is W, B is a descendant of W
- Classically: A LeaveNotify is generated on W with a detail of
+ Classically: A LeaveNotify is generated on W with a detail of
NotifyInferior
- MPX:
- Case 3A: There is at least one other pointer on W itself
- P(W) doesn't change, the event should be suppressed
- Case 3B: Otherwise:
- P(W) changes from W to a descendant of W. The subwindow field
- is set to the child containing the new P(W) <<< THIS IS WRONG */
+ MPX:
+ Case 3A: There is at least one other pointer on W itself
+ P(W) doesn't change, the event should be suppressed
+ Case 3B: Otherwise:
+ P(W) changes from W to a descendant of W. The subwindow field
+ is set to the child containing the new P(W) <<< THIS IS WRONG */
if (!HasPointer(dev, A))
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
-
CoreEnterNotifies(dev, A, B, mode, NotifyVirtual);
/* Case 2:
- A is above W, B=W
-
- Classically: The move generates an EnterNotify on W with a detail of
- Ancestor or Nonlinear
-
- MPX:
- Case 2A: There is at least one other pointer on W itself
- P(W) doesn't change, so the event should be suppressed
- Case 2B: Otherwise, if there is at least one other pointer in a
- descendant
- P(W) moves from a descendant to W. detail is changed to Inferior,
- subwindow is set to the child containing the previous P(W)
- Case 2C: Otherwise:
- P(W) changes from a window above W to W itself.
- The detail may need to be changed from Ancestor to Nonlinear
- or vice-versa depending on the previous P(W). */
-
- if (!HasPointer(dev, B))
- {
- WindowPtr child = FirstPointerChild(B);
- if (child)
- CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None);
- else
- CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyAncestor, B, None);
- }
+ A is above W, B=W
+
+ Classically: The move generates an EnterNotify on W with a detail of
+ Ancestor or Nonlinear
+
+ MPX:
+ Case 2A: There is at least one other pointer on W itself
+ P(W) doesn't change, so the event should be suppressed
+ Case 2B: Otherwise, if there is at least one other pointer in a
+ descendant
+ P(W) moves from a descendant to W. detail is changed to Inferior,
+ subwindow is set to the child containing the previous P(W)
+ Case 2C: Otherwise:
+ P(W) changes from a window above W to W itself.
+ The detail may need to be changed from Ancestor to Nonlinear
+ or vice-versa depending on the previous P(W). */
+
+ if (!HasPointer(dev, B)) {
+ WindowPtr child = FirstPointerChild(B);
+
+ if (child)
+ CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B,
+ None);
+ else
+ CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyAncestor, B,
+ None);
+ }
}
static void
-CoreEnterLeaveEvents(DeviceIntPtr dev,
- WindowPtr from,
- WindowPtr to,
- int mode)
+CoreEnterLeaveEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
{
if (!IsMaster(dev))
return;
@@ -573,31 +549,34 @@ CoreEnterLeaveEvents(DeviceIntPtr dev,
static void
DeviceEnterLeaveEvents(DeviceIntPtr dev,
- int sourceid,
- WindowPtr from,
- WindowPtr to,
- int mode)
+ int sourceid, WindowPtr from, WindowPtr to, int mode)
{
- if (IsParent(from, to))
- {
- DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyInferior, from, None);
+ if (IsParent(from, to)) {
+ DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyInferior,
+ from, None);
DeviceEnterNotifies(dev, sourceid, from, to, mode, NotifyVirtual);
- DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyAncestor, to, None);
+ DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyAncestor, to,
+ None);
}
- else if (IsParent(to, from))
- {
- DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyAncestor, from, None);
- DeviceLeaveNotifies(dev, sourceid, from, to, mode, NotifyVirtual);
- DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyInferior, to, None);
+ else if (IsParent(to, from)) {
+ DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyAncestor,
+ from, None);
+ DeviceLeaveNotifies(dev, sourceid, from, to, mode, NotifyVirtual);
+ DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyInferior, to,
+ None);
}
- else
- { /* neither from nor to is descendent of the other */
- WindowPtr common = CommonAncestor(to, from);
- /* common == NullWindow ==> different screens */
- DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyNonlinear, from, None);
- DeviceLeaveNotifies(dev, sourceid, from, common, mode, NotifyNonlinearVirtual);
- DeviceEnterNotifies(dev, sourceid, common, to, mode, NotifyNonlinearVirtual);
- DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyNonlinear, to, None);
+ else { /* neither from nor to is descendent of the other */
+ WindowPtr common = CommonAncestor(to, from);
+
+ /* common == NullWindow ==> different screens */
+ DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyNonlinear,
+ from, None);
+ DeviceLeaveNotifies(dev, sourceid, from, common, mode,
+ NotifyNonlinearVirtual);
+ DeviceEnterNotifies(dev, sourceid, common, to, mode,
+ NotifyNonlinearVirtual);
+ DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyNonlinear,
+ to, None);
}
}
@@ -610,16 +589,13 @@ DeviceEnterLeaveEvents(DeviceIntPtr dev,
*/
void
DoEnterLeaveEvents(DeviceIntPtr pDev,
- int sourceid,
- WindowPtr fromWin,
- WindowPtr toWin,
- int mode)
+ int sourceid, WindowPtr fromWin, WindowPtr toWin, int mode)
{
if (!IsPointerDevice(pDev))
return;
if (fromWin == toWin)
- return;
+ return;
if (mode != XINotifyPassiveGrab && mode != XINotifyPassiveUngrab)
CoreEnterLeaveEvents(pDev, fromWin, toWin, mode);
@@ -632,20 +608,16 @@ DoEnterLeaveEvents(DeviceIntPtr pDev,
*/
static void
DeviceFocusOutEvents(DeviceIntPtr dev,
- WindowPtr child,
- WindowPtr ancestor,
- int mode,
- int detail)
+ WindowPtr child, WindowPtr ancestor, int mode, int detail)
{
- WindowPtr win;
+ WindowPtr win;
if (ancestor == child)
- return;
+ return;
for (win = child->parent; win != ancestor; win = win->parent)
DeviceFocusEvent(dev, XI_FocusOut, mode, detail, win);
}
-
/**
* Send enter notifies to all windows between 'ancestor' and 'child' (excluding
* both). Events are sent running up the window hierarchy. This function
@@ -653,15 +625,12 @@ DeviceFocusOutEvents(DeviceIntPtr dev,
*/
static void
DeviceFocusInEvents(DeviceIntPtr dev,
- WindowPtr ancestor,
- WindowPtr child,
- int mode,
- int detail)
+ WindowPtr ancestor, WindowPtr child, int mode, int detail)
{
- WindowPtr parent = child->parent;
+ WindowPtr parent = child->parent;
if (ancestor == parent || !parent)
- return;
+ return;
DeviceFocusInEvents(dev, ancestor, parent, mode, detail);
DeviceFocusEvent(dev, XI_FocusIn, mode, detail, parent);
}
@@ -673,70 +642,63 @@ DeviceFocusInEvents(DeviceIntPtr dev,
*/
static void
CoreFocusInEvents(DeviceIntPtr dev,
- WindowPtr ancestor,
- WindowPtr child,
- int mode,
- int detail)
+ WindowPtr ancestor, WindowPtr child, int mode, int detail)
{
- WindowPtr parent = child->parent;
+ WindowPtr parent = child->parent;
+
if (ancestor == parent)
- return;
+ return;
CoreFocusInEvents(dev, ancestor, parent, mode, detail);
-
/* Case 3:
- A is above W, B is a descendant
-
- Classically: The move generates an FocusIn on W with a detail of
- Virtual or NonlinearVirtual
-
- MPX:
- Case 3A: There is at least one other focus on W itself
- F(W) doesn't change, so the event should be suppressed
- Case 3B: Otherwise, if there is at least one other focus in a
- descendant
- F(W) stays on the same descendant, or changes to a different
- descendant. The event should be suppressed.
- Case 3C: Otherwise:
- F(W) moves from a window above W to a descendant. The detail may
- need to be changed from Virtual to NonlinearVirtual depending
- on the previous F(W). */
+ A is above W, B is a descendant
+
+ Classically: The move generates an FocusIn on W with a detail of
+ Virtual or NonlinearVirtual
+
+ MPX:
+ Case 3A: There is at least one other focus on W itself
+ F(W) doesn't change, so the event should be suppressed
+ Case 3B: Otherwise, if there is at least one other focus in a
+ descendant
+ F(W) stays on the same descendant, or changes to a different
+ descendant. The event should be suppressed.
+ Case 3C: Otherwise:
+ F(W) moves from a window above W to a descendant. The detail may
+ need to be changed from Virtual to NonlinearVirtual depending
+ on the previous F(W). */
if (!HasFocus(parent) && !FirstFocusChild(parent))
- CoreFocusEvent(dev, FocusIn, mode, detail, parent);
+ CoreFocusEvent(dev, FocusIn, mode, detail, parent);
}
static void
CoreFocusOutEvents(DeviceIntPtr dev,
- WindowPtr child,
- WindowPtr ancestor,
- int mode,
- int detail)
+ WindowPtr child, WindowPtr ancestor, int mode, int detail)
{
- WindowPtr win;
+ WindowPtr win;
if (ancestor == child)
return;
- for (win = child->parent; win != ancestor; win = win->parent)
- {
+ for (win = child->parent; win != ancestor; win = win->parent) {
/*Case 7:
- A is a descendant of W, B is above W
-
- Classically: A FocusOut is generated on W with a detail of Virtual
- or NonlinearVirtual.
-
- MPX:
- Case 3A: There is at least one other focus on W itself
- F(W) doesn't change, the event should be suppressed.
- Case 3B: Otherwise, if there is at least one other focus in a
- descendant
- F(W) stays on the same descendant, or changes to a different
- descendant. The event should be suppressed.
- Case 3C: Otherwise:
- F(W) changes from the descendant of W to a window above W.
- The detail may need to be changed from Virtual to NonlinearVirtual
- or vice-versa depending on the new P(W).*/
+ A is a descendant of W, B is above W
+
+ Classically: A FocusOut is generated on W with a detail of Virtual
+ or NonlinearVirtual.
+
+ MPX:
+ Case 3A: There is at least one other focus on W itself
+ F(W) doesn't change, the event should be suppressed.
+ Case 3B: Otherwise, if there is at least one other focus in a
+ descendant
+ F(W) stays on the same descendant, or changes to a different
+ descendant. The event should be suppressed.
+ Case 3C: Otherwise:
+ F(W) changes from the descendant of W to a window above W.
+ The detail may need to be changed from Virtual to NonlinearVirtual
+ or vice-versa depending on the new P(W). */
/* If one window has a focus or a child with a focuspointer, skip some
* work and exit. */
@@ -760,9 +722,7 @@ CoreFocusOutEvents(DeviceIntPtr dev,
static void
CoreFocusOutNotifyPointerEvents(DeviceIntPtr dev,
WindowPtr pwin_parent,
- WindowPtr exclude,
- int mode,
- int inclusive)
+ WindowPtr exclude, int mode, int inclusive)
{
WindowPtr P, stopAt;
@@ -790,10 +750,7 @@ CoreFocusOutNotifyPointerEvents(DeviceIntPtr dev,
*/
static void
CoreFocusInRecurse(DeviceIntPtr dev,
- WindowPtr win,
- WindowPtr stopAt,
- int mode,
- int inclusive)
+ WindowPtr win, WindowPtr stopAt, int mode, int inclusive)
{
if ((!inclusive && win == stopAt) || !win)
return;
@@ -802,7 +759,6 @@ CoreFocusInRecurse(DeviceIntPtr dev,
CoreFocusEvent(dev, FocusIn, mode, NotifyPointer, win);
}
-
/**
* Send FocusIn(NotifyPointer) events from pwin_parent down to
* including the current pointer window (which is a descendant of pwin_parent).
@@ -815,9 +771,7 @@ CoreFocusInRecurse(DeviceIntPtr dev,
static void
CoreFocusInNotifyPointerEvents(DeviceIntPtr dev,
WindowPtr pwin_parent,
- WindowPtr exclude,
- int mode,
- int inclusive)
+ WindowPtr exclude, int mode, int inclusive)
{
WindowPtr P;
@@ -832,160 +786,148 @@ CoreFocusInNotifyPointerEvents(DeviceIntPtr dev,
CoreFocusInRecurse(dev, P, pwin_parent, mode, inclusive);
}
-
/**
* Focus of dev moves from A to B and A neither a descendant of B nor is
* B a descendant of A.
*/
static void
-CoreFocusNonLinear(DeviceIntPtr dev,
- WindowPtr A,
- WindowPtr B,
- int mode)
+CoreFocusNonLinear(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
{
WindowPtr X = CommonAncestor(A, B);
/* Case 4:
- A is W, B is above W
+ A is W, B is above W
- Classically: The change generates a FocusOut on W with a detail of
+ Classically: The change generates a FocusOut on W with a detail of
Ancestor or Nonlinear
- MPX:
- Case 3A: There is at least one other focus on W itself
- F(W) doesn't change, the event should be suppressed
- Case 3B: Otherwise, if there is at least one other focus in a
- descendant of W
- F(W) changes from W to a descendant of W. The detail field
- is set to Inferior
- Case 3C: Otherwise:
- The focus window moves from W to a window above W.
- The detail may need to be changed from Ancestor to Nonlinear or
- vice versa depending on the the new F(W)
+ MPX:
+ Case 3A: There is at least one other focus on W itself
+ F(W) doesn't change, the event should be suppressed
+ Case 3B: Otherwise, if there is at least one other focus in a
+ descendant of W
+ F(W) changes from W to a descendant of W. The detail field
+ is set to Inferior
+ Case 3C: Otherwise:
+ The focus window moves from W to a window above W.
+ The detail may need to be changed from Ancestor to Nonlinear or
+ vice versa depending on the the new F(W)
*/
- if (!HasFocus(A))
- {
+ if (!HasFocus(A)) {
WindowPtr child = FirstFocusChild(A);
- if (child)
- {
- /* NotifyPointer P-A unless P is child or below*/
+
+ if (child) {
+ /* NotifyPointer P-A unless P is child or below */
CoreFocusOutNotifyPointerEvents(dev, A, child, mode, FALSE);
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
- } else
- {
+ }
+ else {
/* NotifyPointer P-A */
CoreFocusOutNotifyPointerEvents(dev, A, None, mode, FALSE);
CoreFocusEvent(dev, FocusOut, mode, NotifyNonlinear, A);
}
}
-
CoreFocusOutEvents(dev, A, X, mode, NotifyNonlinearVirtual);
/*
- Case 9:
- A is a descendant of W, B is a descendant of W
-
- Classically: No events are generated on W
- MPX: The focus window stays the same or moves to a different
- descendant of W. No events should be generated on W.
+ Case 9:
+ A is a descendant of W, B is a descendant of W
+ Classically: No events are generated on W
+ MPX: The focus window stays the same or moves to a different
+ descendant of W. No events should be generated on W.
Therefore, no event to X.
- */
+ */
CoreFocusInEvents(dev, X, B, mode, NotifyNonlinearVirtual);
/* Case 2:
- A is above W, B=W
-
- Classically: The move generates an EnterNotify on W with a detail of
- Ancestor or Nonlinear
-
- MPX:
- Case 2A: There is at least one other focus on W itself
- F(W) doesn't change, so the event should be suppressed
- Case 2B: Otherwise, if there is at least one other focus in a
- descendant
- F(W) moves from a descendant to W. detail is changed to Inferior.
- Case 2C: Otherwise:
- F(W) changes from a window above W to W itself.
- The detail may need to be changed from Ancestor to Nonlinear
- or vice-versa depending on the previous F(W). */
-
- if (!HasFocus(B))
- {
- WindowPtr child = FirstFocusChild(B);
- if (child)
- {
- CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
- /* NotifyPointer B-P unless P is child or below. */
- CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
- } else {
- CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinear, B);
- /* NotifyPointer B-P unless P is child or below. */
- CoreFocusInNotifyPointerEvents(dev, B, None, mode, FALSE);
- }
- }
-}
+ A is above W, B=W
+
+ Classically: The move generates an EnterNotify on W with a detail of
+ Ancestor or Nonlinear
+ MPX:
+ Case 2A: There is at least one other focus on W itself
+ F(W) doesn't change, so the event should be suppressed
+ Case 2B: Otherwise, if there is at least one other focus in a
+ descendant
+ F(W) moves from a descendant to W. detail is changed to Inferior.
+ Case 2C: Otherwise:
+ F(W) changes from a window above W to W itself.
+ The detail may need to be changed from Ancestor to Nonlinear
+ or vice-versa depending on the previous F(W). */
+
+ if (!HasFocus(B)) {
+ WindowPtr child = FirstFocusChild(B);
+
+ if (child) {
+ CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
+ /* NotifyPointer B-P unless P is child or below. */
+ CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
+ }
+ else {
+ CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinear, B);
+ /* NotifyPointer B-P unless P is child or below. */
+ CoreFocusInNotifyPointerEvents(dev, B, None, mode, FALSE);
+ }
+ }
+}
/**
* Focus of dev moves from A to B and A is a descendant of B.
*/
static void
-CoreFocusToAncestor(DeviceIntPtr dev,
- WindowPtr A,
- WindowPtr B,
- int mode)
+CoreFocusToAncestor(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
{
/* Case 4:
- A is W, B is above W
+ A is W, B is above W
- Classically: The change generates a FocusOut on W with a detail of
+ Classically: The change generates a FocusOut on W with a detail of
Ancestor or Nonlinear
- MPX:
- Case 3A: There is at least one other focus on W itself
- F(W) doesn't change, the event should be suppressed
- Case 3B: Otherwise, if there is at least one other focus in a
- descendant of W
- F(W) changes from W to a descendant of W. The detail field
- is set to Inferior
- Case 3C: Otherwise:
- The focus window moves from W to a window above W.
- The detail may need to be changed from Ancestor to Nonlinear or
- vice versa depending on the the new F(W)
+ MPX:
+ Case 3A: There is at least one other focus on W itself
+ F(W) doesn't change, the event should be suppressed
+ Case 3B: Otherwise, if there is at least one other focus in a
+ descendant of W
+ F(W) changes from W to a descendant of W. The detail field
+ is set to Inferior
+ Case 3C: Otherwise:
+ The focus window moves from W to a window above W.
+ The detail may need to be changed from Ancestor to Nonlinear or
+ vice versa depending on the the new F(W)
*/
- if (!HasFocus(A))
- {
+ if (!HasFocus(A)) {
WindowPtr child = FirstFocusChild(A);
- if (child)
- {
- /* NotifyPointer P-A unless P is child or below*/
+
+ if (child) {
+ /* NotifyPointer P-A unless P is child or below */
CoreFocusOutNotifyPointerEvents(dev, A, child, mode, FALSE);
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
- } else
+ }
+ else
CoreFocusEvent(dev, FocusOut, mode, NotifyAncestor, A);
}
CoreFocusOutEvents(dev, A, B, mode, NotifyVirtual);
/* Case 8:
- A is a descendant of W, B is W
+ A is a descendant of W, B is W
- Classically: A FocusOut is generated on W with a detail of
- NotifyInferior
+ Classically: A FocusOut is generated on W with a detail of
+ NotifyInferior
- MPX:
- Case 3A: There is at least one other focus on W itself
- F(W) doesn't change, the event should be suppressed
- Case 3B: Otherwise:
- F(W) changes from a descendant to W itself. */
+ MPX:
+ Case 3A: There is at least one other focus on W itself
+ F(W) doesn't change, the event should be suppressed
+ Case 3B: Otherwise:
+ F(W) changes from a descendant to W itself. */
- if (!HasFocus(B))
- {
+ if (!HasFocus(B)) {
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
/* NotifyPointer B-P unless P is A or below. */
CoreFocusInNotifyPointerEvents(dev, B, A, mode, FALSE);
@@ -996,61 +938,56 @@ CoreFocusToAncestor(DeviceIntPtr dev,
* Focus of dev moves from A to B and B is a descendant of A.
*/
static void
-CoreFocusToDescendant(DeviceIntPtr dev,
- WindowPtr A,
- WindowPtr B,
- int mode)
+CoreFocusToDescendant(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
{
/* Case 6:
- A is W, B is a descendant of W
+ A is W, B is a descendant of W
- Classically: A FocusOut is generated on W with a detail of
+ Classically: A FocusOut is generated on W with a detail of
NotifyInferior
- MPX:
- Case 3A: There is at least one other focus on W itself
- F(W) doesn't change, the event should be suppressed
- Case 3B: Otherwise:
- F(W) changes from W to a descendant of W. */
+ MPX:
+ Case 3A: There is at least one other focus on W itself
+ F(W) doesn't change, the event should be suppressed
+ Case 3B: Otherwise:
+ F(W) changes from W to a descendant of W. */
- if (!HasFocus(A))
- {
- /* NotifyPointer P-A unless P is B or below*/
+ if (!HasFocus(A)) {
+ /* NotifyPointer P-A unless P is B or below */
CoreFocusOutNotifyPointerEvents(dev, A, B, mode, FALSE);
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
}
-
CoreFocusInEvents(dev, A, B, mode, NotifyVirtual);
/* Case 2:
- A is above W, B=W
-
- Classically: The move generates an FocusIn on W with a detail of
- Ancestor or Nonlinear
-
- MPX:
- Case 2A: There is at least one other focus on W itself
- F(W) doesn't change, so the event should be suppressed
- Case 2B: Otherwise, if there is at least one other focus in a
- descendant
- F(W) moves from a descendant to W. detail is changed to Inferior.
- Case 2C: Otherwise:
- F(W) changes from a window above W to W itself.
- The detail may need to be changed from Ancestor to Nonlinear
- or vice-versa depending on the previous F(W). */
-
- if (!HasFocus(B))
- {
- WindowPtr child = FirstFocusChild(B);
- if (child)
- {
- CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
- /* NotifyPointer B-P unless P is child or below. */
- CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
- } else
- CoreFocusEvent(dev, FocusIn, mode, NotifyAncestor, B);
- }
+ A is above W, B=W
+
+ Classically: The move generates an FocusIn on W with a detail of
+ Ancestor or Nonlinear
+
+ MPX:
+ Case 2A: There is at least one other focus on W itself
+ F(W) doesn't change, so the event should be suppressed
+ Case 2B: Otherwise, if there is at least one other focus in a
+ descendant
+ F(W) moves from a descendant to W. detail is changed to Inferior.
+ Case 2C: Otherwise:
+ F(W) changes from a window above W to W itself.
+ The detail may need to be changed from Ancestor to Nonlinear
+ or vice-versa depending on the previous F(W). */
+
+ if (!HasFocus(B)) {
+ WindowPtr child = FirstFocusChild(B);
+
+ if (child) {
+ CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
+ /* NotifyPointer B-P unless P is child or below. */
+ CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
+ }
+ else
+ CoreFocusEvent(dev, FocusIn, mode, NotifyAncestor, B);
+ }
}
static BOOL
@@ -1070,9 +1007,8 @@ HasOtherPointer(WindowPtr win, DeviceIntPtr exclude)
* Assumption: Neither A nor B are valid windows.
*/
static void
-CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
- WindowPtr A, /* PointerRootWin or NoneWin */
- WindowPtr B, /* NoneWin or PointerRootWin */
+CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, WindowPtr A, /* PointerRootWin or NoneWin */
+ WindowPtr B, /* NoneWin or PointerRootWin */
int mode)
{
WindowPtr root;
@@ -1084,23 +1020,25 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
nscreens = 1;
#endif
- for (i = 0; i < nscreens; i++)
- {
+ for (i = 0; i < nscreens; i++) {
root = screenInfo.screens[i]->root;
- if (!HasOtherPointer(root, GetMaster(dev, POINTER_OR_FLOAT)) && !FirstFocusChild(root))
- {
+ if (!HasOtherPointer(root, GetMaster(dev, POINTER_OR_FLOAT)) &&
+ !FirstFocusChild(root)) {
/* If pointer was on PointerRootWin and changes to NoneWin, and
* the pointer paired with dev is below the current root window,
* do a NotifyPointer run. */
if (dev->focus && dev->focus->win == PointerRootWin &&
- B != PointerRootWin)
- {
+ B != PointerRootWin) {
WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT));
+
if (ptrwin && IsParent(root, ptrwin))
- CoreFocusOutNotifyPointerEvents(dev, root, None, mode, TRUE);
+ CoreFocusOutNotifyPointerEvents(dev, root, None, mode,
+ TRUE);
}
- CoreFocusEvent(dev, FocusOut, mode, A ? NotifyPointerRoot : NotifyDetailNone, root);
- CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root);
+ CoreFocusEvent(dev, FocusOut, mode,
+ A ? NotifyPointerRoot : NotifyDetailNone, root);
+ CoreFocusEvent(dev, FocusIn, mode,
+ B ? NotifyPointerRoot : NotifyDetailNone, root);
if (B == PointerRootWin)
CoreFocusInNotifyPointerEvents(dev, root, None, mode, TRUE);
}
@@ -1113,10 +1051,8 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
* Assumption: A is a valid window and not PointerRoot or None.
*/
static void
-CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
- WindowPtr A,
- WindowPtr B, /* PointerRootWin or NoneWin */
- int mode)
+CoreFocusToPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, WindowPtr B, /* PointerRootWin or NoneWin */
+ int mode)
{
WindowPtr root;
int i;
@@ -1127,15 +1063,15 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
nscreens = 1;
#endif
- if (!HasFocus(A))
- {
+ if (!HasFocus(A)) {
WindowPtr child = FirstFocusChild(A);
- if (child)
- {
- /* NotifyPointer P-A unless P is B or below*/
+
+ if (child) {
+ /* NotifyPointer P-A unless P is B or below */
CoreFocusOutNotifyPointerEvents(dev, A, B, mode, FALSE);
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
- } else {
+ }
+ else {
/* NotifyPointer P-A */
CoreFocusOutNotifyPointerEvents(dev, A, None, mode, FALSE);
CoreFocusEvent(dev, FocusOut, mode, NotifyNonlinear, A);
@@ -1145,12 +1081,11 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
/* NullWindow means we include the root window */
CoreFocusOutEvents(dev, A, NullWindow, mode, NotifyNonlinearVirtual);
- for (i = 0; i < nscreens; i++)
- {
+ for (i = 0; i < nscreens; i++) {
root = screenInfo.screens[i]->root;
- if (!HasFocus(root) && !FirstFocusChild(root))
- {
- CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root);
+ if (!HasFocus(root) && !FirstFocusChild(root)) {
+ CoreFocusEvent(dev, FocusIn, mode,
+ B ? NotifyPointerRoot : NotifyDetailNone, root);
if (B == PointerRootWin)
CoreFocusInNotifyPointerEvents(dev, root, None, mode, TRUE);
}
@@ -1162,10 +1097,8 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
* Assumption: B is a valid window and not PointerRoot or None.
*/
static void
-CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
- WindowPtr A, /* PointerRootWin or NoneWin */
- WindowPtr B,
- int mode)
+CoreFocusFromPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, /* PointerRootWin or NoneWin */
+ WindowPtr B, int mode)
{
WindowPtr root;
int i;
@@ -1176,45 +1109,43 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
nscreens = 1;
#endif
- for (i = 0; i < nscreens; i++)
- {
+ for (i = 0; i < nscreens; i++) {
root = screenInfo.screens[i]->root;
- if (!HasFocus(root) && !FirstFocusChild(root))
- {
+ if (!HasFocus(root) && !FirstFocusChild(root)) {
/* If pointer was on PointerRootWin and changes to NoneWin, and
* the pointer paired with dev is below the current root window,
* do a NotifyPointer run. */
if (dev->focus && dev->focus->win == PointerRootWin &&
- B != PointerRootWin)
- {
+ B != PointerRootWin) {
WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT));
+
if (ptrwin)
- CoreFocusOutNotifyPointerEvents(dev, root, None, mode, TRUE);
+ CoreFocusOutNotifyPointerEvents(dev, root, None, mode,
+ TRUE);
}
- CoreFocusEvent(dev, FocusOut, mode, A ? NotifyPointerRoot : NotifyDetailNone, root);
+ CoreFocusEvent(dev, FocusOut, mode,
+ A ? NotifyPointerRoot : NotifyDetailNone, root);
}
}
- root = B; /* get B's root window */
- while(root->parent)
+ root = B; /* get B's root window */
+ while (root->parent)
root = root->parent;
- if (B != root)
- {
+ if (B != root) {
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinearVirtual, root);
CoreFocusInEvents(dev, root, B, mode, NotifyNonlinearVirtual);
}
-
- if (!HasFocus(B))
- {
+ if (!HasFocus(B)) {
WindowPtr child = FirstFocusChild(B);
- if (child)
- {
- CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
- /* NotifyPointer B-P unless P is child or below. */
- CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
- } else {
+
+ if (child) {
+ CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
+ /* NotifyPointer B-P unless P is child or below. */
+ CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
+ }
+ else {
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinear, B);
/* NotifyPointer B-P unless P is child or below. */
CoreFocusInNotifyPointerEvents(dev, B, None, mode, FALSE);
@@ -1224,10 +1155,7 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
}
static void
-CoreFocusEvents(DeviceIntPtr dev,
- WindowPtr from,
- WindowPtr to,
- int mode)
+CoreFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
{
if (!IsMaster(dev))
return;
@@ -1252,16 +1180,13 @@ CoreFocusEvents(DeviceIntPtr dev,
}
static void
-DeviceFocusEvents(DeviceIntPtr dev,
- WindowPtr from,
- WindowPtr to,
- int mode)
+DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
{
- int out, in; /* for holding details for to/from
- PointerRoot/None */
+ int out, in; /* for holding details for to/from
+ PointerRoot/None */
int i;
int nscreens = screenInfo.numScreens;
- SpritePtr sprite = dev->spriteInfo->sprite;
+ SpritePtr sprite = dev->spriteInfo->sprite;
if (from == to)
return;
@@ -1274,96 +1199,95 @@ DeviceFocusEvents(DeviceIntPtr dev,
nscreens = 1;
#endif
- if ((to == NullWindow) || (to == PointerRootWin))
- {
- if ((from == NullWindow) || (from == PointerRootWin))
- {
+ if ((to == NullWindow) || (to == PointerRootWin)) {
+ if ((from == NullWindow) || (from == PointerRootWin)) {
if (from == PointerRootWin)
- DeviceFocusOutEvents(dev, sprite->win, GetCurrentRootWindow(dev), mode,
- NotifyPointer);
+ DeviceFocusOutEvents(dev, sprite->win,
+ GetCurrentRootWindow(dev), mode,
+ NotifyPointer);
/* Notify all the roots */
for (i = 0; i < nscreens; i++)
- DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root);
+ DeviceFocusEvent(dev, XI_FocusOut, mode, out,
+ screenInfo.screens[i]->root);
}
- else
- {
+ else {
if (IsParent(from, sprite->win))
DeviceFocusOutEvents(dev, sprite->win, from, mode,
- NotifyPointer);
+ NotifyPointer);
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
/* next call catches the root too, if the screen changed */
DeviceFocusOutEvents(dev, from, NullWindow, mode,
- NotifyNonlinearVirtual);
+ NotifyNonlinearVirtual);
}
/* Notify all the roots */
for (i = 0; i < nscreens; i++)
- DeviceFocusEvent(dev, XI_FocusIn, mode, in, screenInfo.screens[i]->root);
- if (to == PointerRootWin)
- {
- DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win, mode, NotifyPointer);
+ DeviceFocusEvent(dev, XI_FocusIn, mode, in,
+ screenInfo.screens[i]->root);
+ if (to == PointerRootWin) {
+ DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win,
+ mode, NotifyPointer);
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyPointer, sprite->win);
}
}
- else
- {
- if ((from == NullWindow) || (from == PointerRootWin))
- {
+ else {
+ if ((from == NullWindow) || (from == PointerRootWin)) {
if (from == PointerRootWin)
- DeviceFocusOutEvents(dev, sprite->win, GetCurrentRootWindow(dev), mode,
- NotifyPointer);
+ DeviceFocusOutEvents(dev, sprite->win,
+ GetCurrentRootWindow(dev), mode,
+ NotifyPointer);
for (i = 0; i < nscreens; i++)
- DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root);
+ DeviceFocusEvent(dev, XI_FocusOut, mode, out,
+ screenInfo.screens[i]->root);
if (to->parent != NullWindow)
- DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), to, mode, NotifyNonlinearVirtual);
+ DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), to, mode,
+ NotifyNonlinearVirtual);
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
if (IsParent(to, sprite->win))
DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
}
- else
- {
- if (IsParent(to, from))
- {
+ else {
+ if (IsParent(to, from)) {
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from);
- DeviceFocusOutEvents(dev, from, to, mode,
- NotifyVirtual);
+ DeviceFocusOutEvents(dev, from, to, mode, NotifyVirtual);
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to);
if ((IsParent(to, sprite->win)) &&
- (sprite->win != from) &&
- (!IsParent(from, sprite->win)) &&
- (!IsParent(sprite->win, from)))
- DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
+ (sprite->win != from) &&
+ (!IsParent(from, sprite->win)) &&
+ (!IsParent(sprite->win, from)))
+ DeviceFocusInEvents(dev, to, sprite->win, mode,
+ NotifyPointer);
+ }
+ else if (IsParent(from, to)) {
+ if ((IsParent(from, sprite->win)) &&
+ (sprite->win != from) &&
+ (!IsParent(to, sprite->win)) &&
+ (!IsParent(sprite->win, to)))
+ DeviceFocusOutEvents(dev, sprite->win, from, mode,
+ NotifyPointer);
+ DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyInferior, from);
+ DeviceFocusInEvents(dev, from, to, mode, NotifyVirtual);
+ DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyAncestor, to);
+ }
+ else {
+ /* neither from or to is child of other */
+ WindowPtr common = CommonAncestor(to, from);
+
+ /* common == NullWindow ==> different screens */
+ if (IsParent(from, sprite->win))
+ DeviceFocusOutEvents(dev, sprite->win, from, mode,
+ NotifyPointer);
+ DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
+ if (from->parent != NullWindow)
+ DeviceFocusOutEvents(dev, from, common, mode,
+ NotifyNonlinearVirtual);
+ if (to->parent != NullWindow)
+ DeviceFocusInEvents(dev, common, to, mode,
+ NotifyNonlinearVirtual);
+ DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
+ if (IsParent(to, sprite->win))
+ DeviceFocusInEvents(dev, to, sprite->win, mode,
+ NotifyPointer);
}
- else
- if (IsParent(from, to))
- {
- if ((IsParent(from, sprite->win)) &&
- (sprite->win != from) &&
- (!IsParent(to, sprite->win)) &&
- (!IsParent(sprite->win, to)))
- DeviceFocusOutEvents(dev, sprite->win, from, mode,
- NotifyPointer);
- DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyInferior, from);
- DeviceFocusInEvents(dev, from, to, mode, NotifyVirtual);
- DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyAncestor, to);
- }
- else
- {
- /* neither from or to is child of other */
- WindowPtr common = CommonAncestor(to, from);
- /* common == NullWindow ==> different screens */
- if (IsParent(from, sprite->win))
- DeviceFocusOutEvents(dev, sprite->win, from, mode,
- NotifyPointer);
- DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
- if (from->parent != NullWindow)
- DeviceFocusOutEvents(dev, from, common, mode,
- NotifyNonlinearVirtual);
- if (to->parent != NullWindow)
- DeviceFocusInEvents(dev, common, to, mode, NotifyNonlinearVirtual);
- DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
- if (IsParent(to, sprite->win))
- DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
- }
}
}
}
@@ -1376,16 +1300,13 @@ DeviceFocusEvents(DeviceIntPtr dev,
* @param to Window the focus moved into.
*/
void
-DoFocusEvents(DeviceIntPtr pDev,
- WindowPtr from,
- WindowPtr to,
- int mode)
+DoFocusEvents(DeviceIntPtr pDev, WindowPtr from, WindowPtr to, int mode)
{
if (!IsKeyboardDevice(pDev))
return;
if (from == to)
- return;
+ return;
CoreFocusEvents(pDev, from, to, mode);
DeviceFocusEvents(pDev, from, to, mode);
diff --git a/xorg-server/dix/enterleave.h b/xorg-server/dix/enterleave.h
index 471f4efaa..c1729f8da 100644
--- a/xorg-server/dix/enterleave.h
+++ b/xorg-server/dix/enterleave.h
@@ -31,67 +31,40 @@
#ifndef ENTERLEAVE_H
#define ENTERLEAVE_H
-extern void DoEnterLeaveEvents(
- DeviceIntPtr pDev,
- int sourceid,
- WindowPtr fromWin,
- WindowPtr toWin,
- int mode
-);
+extern void DoEnterLeaveEvents(DeviceIntPtr pDev,
+ int sourceid,
+ WindowPtr fromWin, WindowPtr toWin, int mode);
-extern void DoFocusEvents(
- DeviceIntPtr pDev,
- WindowPtr fromWin,
- WindowPtr toWin,
- int mode
-);
+extern void DoFocusEvents(DeviceIntPtr pDev,
+ WindowPtr fromWin, WindowPtr toWin, int mode);
-extern void EnterLeaveEvent(
- DeviceIntPtr mouse,
- int type,
- int mode,
- int detail,
- WindowPtr pWin,
- Window child);
+extern void EnterLeaveEvent(DeviceIntPtr mouse,
+ int type,
+ int mode, int detail, WindowPtr pWin, Window child);
-extern WindowPtr CommonAncestor(
- WindowPtr a,
- WindowPtr b);
+extern WindowPtr CommonAncestor(WindowPtr a, WindowPtr b);
extern void CoreEnterLeaveEvent(DeviceIntPtr mouse,
int type,
int mode,
- int detail,
- WindowPtr pWin,
- Window child);
+ int detail, WindowPtr pWin, Window child);
extern void DeviceEnterLeaveEvent(DeviceIntPtr mouse,
int sourceid,
int type,
int mode,
- int detail,
- WindowPtr pWin,
- Window child);
+ int detail, WindowPtr pWin, Window child);
-extern void EnterWindow(DeviceIntPtr dev,
- WindowPtr win,
- int mode);
+extern void EnterWindow(DeviceIntPtr dev, WindowPtr win, int mode);
extern void LeaveWindow(DeviceIntPtr dev);
extern void CoreFocusEvent(DeviceIntPtr kbd,
- int type,
- int mode,
- int detail,
- WindowPtr pWin);
+ int type, int mode, int detail, WindowPtr pWin);
extern void DeviceFocusEvent(DeviceIntPtr kbd,
- int type,
- int mode,
- int detail,
- WindowPtr pWin);
+ int type, int mode, int detail, WindowPtr pWin);
-extern void SetFocusIn(DeviceIntPtr kbd,
- WindowPtr win);
+extern void SetFocusIn(DeviceIntPtr kbd, WindowPtr win);
extern void SetFocusOut(DeviceIntPtr dev);
-#endif /* _ENTERLEAVE_H_ */
+#endif /* _ENTERLEAVE_H_ */
diff --git a/xorg-server/dix/eventconvert.c b/xorg-server/dix/eventconvert.c
index d608b0438..b84e34eec 100644
--- a/xorg-server/dix/eventconvert.c
+++ b/xorg-server/dix/eventconvert.c
@@ -51,9 +51,8 @@
#include "xkbsrv.h"
#include "inpututils.h"
-
static int countValuators(DeviceEvent *ev, int *first);
-static int getValuatorEvents(DeviceEvent *ev, deviceValuator *xv);
+static int getValuatorEvents(DeviceEvent *ev, deviceValuator * xv);
static int eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count);
static int eventToDeviceChanged(DeviceChangedEvent *ev, xEvent **dcce);
static int eventToDeviceEvent(DeviceEvent *ev, xEvent **xi);
@@ -85,7 +84,7 @@ EventSetKeyRepeatFlag(xEvent *event, BOOL on)
BOOL
EventIsKeyRepeat(xEvent *event)
{
- return !!event->u.u.sequenceNumber;
+ return ! !event->u.u.sequenceNumber;
}
/**
@@ -107,74 +106,69 @@ EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
int count = 0;
int ret = BadImplementation;
- switch(event->any.type)
+ switch (event->any.type) {
+ case ET_Motion:
{
- case ET_Motion:
- {
- DeviceEvent *e = &event->device_event;
- /* Don't create core motion event if neither x nor y are
- * present */
- if (!BitIsOn(e->valuators.mask, 0) &&
- !BitIsOn(e->valuators.mask, 1))
- {
- ret = BadMatch;
- goto out;
- }
- }
- /* fallthrough */
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_KeyPress:
- case ET_KeyRelease:
- {
- DeviceEvent *e = &event->device_event;
-
- if (e->detail.key > 0xFF)
- {
- ret = BadMatch;
- goto out;
- }
-
- core = calloc(1, sizeof(*core));
- if (!core)
- return BadAlloc;
- count = 1;
- core->u.u.type = e->type - ET_KeyPress + KeyPress;
- core->u.u.detail = e->detail.key & 0xFF;
- core->u.keyButtonPointer.time = e->time;
- core->u.keyButtonPointer.rootX = e->root_x;
- core->u.keyButtonPointer.rootY = e->root_y;
- core->u.keyButtonPointer.state = e->corestate&0xffff;
- core->u.keyButtonPointer.root = e->root;
- EventSetKeyRepeatFlag(core,
- (e->type == ET_KeyPress &&
- e->key_repeat));
- ret = Success;
- }
- break;
- case ET_ProximityIn:
- case ET_ProximityOut:
- case ET_RawKeyPress:
- case ET_RawKeyRelease:
- case ET_RawButtonPress:
- case ET_RawButtonRelease:
- case ET_RawMotion:
- case ET_RawTouchBegin:
- case ET_RawTouchUpdate:
- case ET_RawTouchEnd:
- case ET_TouchBegin:
- case ET_TouchUpdate:
- case ET_TouchEnd:
- case ET_TouchOwnership:
+ DeviceEvent *e = &event->device_event;
+
+ /* Don't create core motion event if neither x nor y are
+ * present */
+ if (!BitIsOn(e->valuators.mask, 0) && !BitIsOn(e->valuators.mask, 1)) {
ret = BadMatch;
- break;
- default:
- /* XXX: */
- ErrorF("[dix] EventToCore: Not implemented yet \n");
- ret = BadImplementation;
+ goto out;
+ }
}
+ /* fallthrough */
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ {
+ DeviceEvent *e = &event->device_event;
-out:
+ if (e->detail.key > 0xFF) {
+ ret = BadMatch;
+ goto out;
+ }
+
+ core = calloc(1, sizeof(*core));
+ if (!core)
+ return BadAlloc;
+ count = 1;
+ core->u.u.type = e->type - ET_KeyPress + KeyPress;
+ core->u.u.detail = e->detail.key & 0xFF;
+ core->u.keyButtonPointer.time = e->time;
+ core->u.keyButtonPointer.rootX = e->root_x;
+ core->u.keyButtonPointer.rootY = e->root_y;
+ core->u.keyButtonPointer.state = e->corestate&0xffff;
+ core->u.keyButtonPointer.root = e->root;
+ EventSetKeyRepeatFlag(core, (e->type == ET_KeyPress && e->key_repeat));
+ ret = Success;
+ }
+ break;
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ case ET_RawKeyPress:
+ case ET_RawKeyRelease:
+ case ET_RawButtonPress:
+ case ET_RawButtonRelease:
+ case ET_RawMotion:
+ case ET_RawTouchBegin:
+ case ET_RawTouchUpdate:
+ case ET_RawTouchEnd:
+ case ET_TouchBegin:
+ case ET_TouchUpdate:
+ case ET_TouchEnd:
+ case ET_TouchOwnership:
+ ret = BadMatch;
+ break;
+ default:
+ /* XXX: */
+ ErrorF("[dix] EventToCore: Not implemented yet \n");
+ ret = BadImplementation;
+ }
+
+ out:
*core_out = core;
*count_out = count;
return ret;
@@ -200,34 +194,33 @@ out:
int
EventToXI(InternalEvent *ev, xEvent **xi, int *count)
{
- switch (ev->any.type)
- {
- case ET_Motion:
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_KeyPress:
- case ET_KeyRelease:
- case ET_ProximityIn:
- case ET_ProximityOut:
- return eventToKeyButtonPointer(&ev->device_event, xi, count);
- case ET_DeviceChanged:
- case ET_RawKeyPress:
- case ET_RawKeyRelease:
- case ET_RawButtonPress:
- case ET_RawButtonRelease:
- case ET_RawMotion:
- case ET_RawTouchBegin:
- case ET_RawTouchUpdate:
- case ET_RawTouchEnd:
- case ET_TouchBegin:
- case ET_TouchUpdate:
- case ET_TouchEnd:
- case ET_TouchOwnership:
- *count = 0;
- *xi = NULL;
- return BadMatch;
- default:
- break;
+ switch (ev->any.type) {
+ case ET_Motion:
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ return eventToKeyButtonPointer(&ev->device_event, xi, count);
+ case ET_DeviceChanged:
+ case ET_RawKeyPress:
+ case ET_RawKeyRelease:
+ case ET_RawButtonPress:
+ case ET_RawButtonRelease:
+ case ET_RawMotion:
+ case ET_RawTouchBegin:
+ case ET_RawTouchUpdate:
+ case ET_RawTouchEnd:
+ case ET_TouchBegin:
+ case ET_TouchUpdate:
+ case ET_TouchEnd:
+ case ET_TouchOwnership:
+ *count = 0;
+ *xi = NULL;
+ return BadMatch;
+ default:
+ break;
}
ErrorF("[dix] EventToXI: Not implemented for %d \n", ev->any.type);
@@ -251,42 +244,41 @@ EventToXI(InternalEvent *ev, xEvent **xi, int *count)
int
EventToXI2(InternalEvent *ev, xEvent **xi)
{
- switch (ev->any.type)
- {
+ switch (ev->any.type) {
/* Enter/FocusIn are for grabs. We don't need an actual event, since
* the real events delivered are triggered elsewhere */
- case ET_Enter:
- case ET_FocusIn:
- *xi = NULL;
- return Success;
- case ET_Motion:
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_KeyPress:
- case ET_KeyRelease:
- case ET_TouchBegin:
- case ET_TouchUpdate:
- case ET_TouchEnd:
- return eventToDeviceEvent(&ev->device_event, xi);
- case ET_TouchOwnership:
- return eventToTouchOwnershipEvent(&ev->touch_ownership_event, xi);
- case ET_ProximityIn:
- case ET_ProximityOut:
- *xi = NULL;
- return BadMatch;
- case ET_DeviceChanged:
- return eventToDeviceChanged(&ev->changed_event, xi);
- case ET_RawKeyPress:
- case ET_RawKeyRelease:
- case ET_RawButtonPress:
- case ET_RawButtonRelease:
- case ET_RawMotion:
- case ET_RawTouchBegin:
- case ET_RawTouchUpdate:
- case ET_RawTouchEnd:
- return eventToRawEvent(&ev->raw_event, xi);
- default:
- break;
+ case ET_Enter:
+ case ET_FocusIn:
+ *xi = NULL;
+ return Success;
+ case ET_Motion:
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ case ET_TouchBegin:
+ case ET_TouchUpdate:
+ case ET_TouchEnd:
+ return eventToDeviceEvent(&ev->device_event, xi);
+ case ET_TouchOwnership:
+ return eventToTouchOwnershipEvent(&ev->touch_ownership_event, xi);
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ *xi = NULL;
+ return BadMatch;
+ case ET_DeviceChanged:
+ return eventToDeviceChanged(&ev->changed_event, xi);
+ case ET_RawKeyPress:
+ case ET_RawKeyRelease:
+ case ET_RawButtonPress:
+ case ET_RawButtonRelease:
+ case ET_RawMotion:
+ case ET_RawTouchBegin:
+ case ET_RawTouchUpdate:
+ case ET_RawTouchEnd:
+ return eventToRawEvent(&ev->raw_event, xi);
+ default:
+ break;
}
ErrorF("[dix] EventToXI2: Not implemented for %d \n", ev->any.type);
@@ -297,83 +289,90 @@ static int
eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
{
int num_events;
- int first; /* dummy */
+ int first; /* dummy */
deviceKeyButtonPointer *kbp;
/* Sorry, XI 1.x protocol restrictions. */
- if (ev->detail.button > 0xFF || ev->deviceid >= 0x80)
- {
+ if (ev->detail.button > 0xFF || ev->deviceid >= 0x80) {
*count = 0;
return Success;
}
- num_events = (countValuators(ev, &first) + 5)/6; /* valuator ev */
- if (num_events <= 0)
- {
- switch (ev->type)
- {
- case ET_KeyPress:
- case ET_KeyRelease:
- case ET_ButtonPress:
- case ET_ButtonRelease:
- /* no axes is ok */
- break;
- case ET_Motion:
- case ET_ProximityIn:
- case ET_ProximityOut:
- *count = 0;
- return BadMatch;
- default:
- *count = 0;
- return BadImplementation;
+ num_events = (countValuators(ev, &first) + 5) / 6; /* valuator ev */
+ if (num_events <= 0) {
+ switch (ev->type) {
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ /* no axes is ok */
+ break;
+ case ET_Motion:
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ *count = 0;
+ return BadMatch;
+ default:
+ *count = 0;
+ return BadImplementation;
}
}
- num_events++; /* the actual event event */
+ num_events++; /* the actual event event */
*xi = calloc(num_events, sizeof(xEvent));
- if (!(*xi))
- {
+ if (!(*xi)) {
return BadAlloc;
}
- kbp = (deviceKeyButtonPointer*)(*xi);
- kbp->detail = ev->detail.button;
- kbp->time = ev->time;
- kbp->root = ev->root;
- kbp->root_x = ev->root_x;
- kbp->root_y = ev->root_y;
+ kbp = (deviceKeyButtonPointer *) (*xi);
+ kbp->detail = ev->detail.button;
+ kbp->time = ev->time;
+ kbp->root = ev->root;
+ kbp->root_x = ev->root_x;
+ kbp->root_y = ev->root_y;
kbp->deviceid = ev->deviceid;
- kbp->state = ev->corestate;
- EventSetKeyRepeatFlag((xEvent*)kbp,
+ kbp->state = ev->corestate;
+ EventSetKeyRepeatFlag((xEvent *) kbp,
(ev->type == ET_KeyPress && ev->key_repeat));
if (num_events > 1)
kbp->deviceid |= MORE_EVENTS;
- switch(ev->type)
- {
- case ET_Motion: kbp->type = DeviceMotionNotify; break;
- case ET_ButtonPress: kbp->type = DeviceButtonPress; break;
- case ET_ButtonRelease: kbp->type = DeviceButtonRelease; break;
- case ET_KeyPress: kbp->type = DeviceKeyPress; break;
- case ET_KeyRelease: kbp->type = DeviceKeyRelease; break;
- case ET_ProximityIn: kbp->type = ProximityIn; break;
- case ET_ProximityOut: kbp->type = ProximityOut; break;
- default:
- break;
+ switch (ev->type) {
+ case ET_Motion:
+ kbp->type = DeviceMotionNotify;
+ break;
+ case ET_ButtonPress:
+ kbp->type = DeviceButtonPress;
+ break;
+ case ET_ButtonRelease:
+ kbp->type = DeviceButtonRelease;
+ break;
+ case ET_KeyPress:
+ kbp->type = DeviceKeyPress;
+ break;
+ case ET_KeyRelease:
+ kbp->type = DeviceKeyRelease;
+ break;
+ case ET_ProximityIn:
+ kbp->type = ProximityIn;
+ break;
+ case ET_ProximityOut:
+ kbp->type = ProximityOut;
+ break;
+ default:
+ break;
}
- if (num_events > 1)
- {
- getValuatorEvents(ev, (deviceValuator*)(kbp + 1));
+ if (num_events > 1) {
+ getValuatorEvents(ev, (deviceValuator *) (kbp + 1));
}
*count = num_events;
return Success;
}
-
/**
* Set first to the first valuator in the event ev and return the number of
* valuators from first to the last set valuator.
@@ -384,18 +383,15 @@ countValuators(DeviceEvent *ev, int *first)
int first_valuator = -1, last_valuator = -1, num_valuators = 0;
int i;
- for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
- {
- if (BitIsOn(ev->valuators.mask, i))
- {
+ for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++) {
+ if (BitIsOn(ev->valuators.mask, i)) {
if (first_valuator == -1)
first_valuator = i;
last_valuator = i;
}
}
- if (first_valuator != -1)
- {
+ if (first_valuator != -1) {
num_valuators = last_valuator - first_valuator + 1;
*first = first_valuator;
}
@@ -404,25 +400,26 @@ countValuators(DeviceEvent *ev, int *first)
}
static int
-getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
+getValuatorEvents(DeviceEvent *ev, deviceValuator * xv)
{
int i;
int state = 0;
int first_valuator, num_valuators;
-
num_valuators = countValuators(ev, &first_valuator);
- if (num_valuators > 0)
- {
+ if (num_valuators > 0) {
DeviceIntPtr dev = NULL;
+
dixLookupDevice(&dev, ev->deviceid, serverClient, DixUseAccess);
/* State needs to be assembled BEFORE the device is updated. */
- state = (dev && dev->key) ? XkbStateFieldFromRec(&dev->key->xkbInfo->state) : 0;
+ state = (dev &&
+ dev->key) ? XkbStateFieldFromRec(&dev->key->xkbInfo->
+ state) : 0;
state |= (dev && dev->button) ? (dev->button->state) : 0;
}
for (i = 0; i < num_valuators; i += 6, xv++) {
- INT32 *valuators = &xv->valuator0; // Treat all 6 vals as an array
+ INT32 *valuators = &xv->valuator0; // Treat all 6 vals as an array
int j;
xv->type = DeviceValuator;
@@ -443,19 +440,18 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
return (num_valuators + 5) / 6;
}
-
static int
-appendKeyInfo(DeviceChangedEvent *dce, xXIKeyInfo* info)
+appendKeyInfo(DeviceChangedEvent *dce, xXIKeyInfo * info)
{
uint32_t *kc;
int i;
info->type = XIKeyClass;
info->num_keycodes = dce->keys.max_keycode - dce->keys.min_keycode + 1;
- info->length = sizeof(xXIKeyInfo)/4 + info->num_keycodes;
+ info->length = sizeof(xXIKeyInfo) / 4 + info->num_keycodes;
info->sourceid = dce->sourceid;
- kc = (uint32_t*)&info[1];
+ kc = (uint32_t *) & info[1];
for (i = 0; i < info->num_keycodes; i++)
*kc++ = i + dce->keys.min_keycode;
@@ -463,7 +459,7 @@ appendKeyInfo(DeviceChangedEvent *dce, xXIKeyInfo* info)
}
static int
-appendButtonInfo(DeviceChangedEvent *dce, xXIButtonInfo *info)
+appendButtonInfo(DeviceChangedEvent *dce, xXIButtonInfo * info)
{
unsigned char *bits;
int mask_len;
@@ -473,10 +469,10 @@ appendButtonInfo(DeviceChangedEvent *dce, xXIButtonInfo *info)
info->type = XIButtonClass;
info->num_buttons = dce->buttons.num_buttons;
info->length = bytes_to_int32(sizeof(xXIButtonInfo)) +
- info->num_buttons + mask_len;
+ info->num_buttons + mask_len;
info->sourceid = dce->sourceid;
- bits = (unsigned char*)&info[1];
+ bits = (unsigned char *) &info[1];
memset(bits, 0, mask_len * 4);
/* FIXME: is_down? */
@@ -487,10 +483,11 @@ appendButtonInfo(DeviceChangedEvent *dce, xXIButtonInfo *info)
}
static int
-appendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo *info, int axisnumber)
+appendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo * info,
+ int axisnumber)
{
info->type = XIValuatorClass;
- info->length = sizeof(xXIValuatorInfo)/4;
+ info->length = sizeof(xXIValuatorInfo) / 4;
info->label = dce->valuators[axisnumber].name;
info->min.integral = dce->valuators[axisnumber].min;
info->min.frac = 0;
@@ -508,27 +505,28 @@ appendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo *info, int axisnumbe
}
static int
-appendScrollInfo(DeviceChangedEvent *dce, xXIScrollInfo *info, int axisnumber)
+appendScrollInfo(DeviceChangedEvent *dce, xXIScrollInfo * info, int axisnumber)
{
if (dce->valuators[axisnumber].scroll.type == SCROLL_TYPE_NONE)
return 0;
info->type = XIScrollClass;
- info->length = sizeof(xXIScrollInfo)/4;
+ info->length = sizeof(xXIScrollInfo) / 4;
info->number = axisnumber;
- switch(dce->valuators[axisnumber].scroll.type)
- {
- case SCROLL_TYPE_VERTICAL:
- info->scroll_type = XIScrollTypeVertical;
- break;
- case SCROLL_TYPE_HORIZONTAL:
- info->scroll_type = XIScrollTypeHorizontal;
- break;
- default:
- ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n", dce->valuators[axisnumber].scroll.type);
- break;
+ switch (dce->valuators[axisnumber].scroll.type) {
+ case SCROLL_TYPE_VERTICAL:
+ info->scroll_type = XIScrollTypeVertical;
+ break;
+ case SCROLL_TYPE_HORIZONTAL:
+ info->scroll_type = XIScrollTypeHorizontal;
+ break;
+ default:
+ ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n",
+ dce->valuators[axisnumber].scroll.type);
+ break;
}
- info->increment = double_to_fp3232(dce->valuators[axisnumber].scroll.increment);
+ info->increment =
+ double_to_fp3232(dce->valuators[axisnumber].scroll.increment);
info->sourceid = dce->sourceid;
info->flags = 0;
@@ -549,14 +547,12 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
int nkeys;
char *ptr;
- if (dce->buttons.num_buttons)
- {
+ if (dce->buttons.num_buttons) {
len += sizeof(xXIButtonInfo);
len += dce->buttons.num_buttons * sizeof(Atom); /* button names */
len += pad_to_int32(bits_to_bytes(dce->buttons.num_buttons));
}
- if (dce->num_valuators)
- {
+ if (dce->num_valuators) {
int i;
len += sizeof(xXIValuatorInfo) * dce->num_valuators;
@@ -567,77 +563,70 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
}
nkeys = (dce->keys.max_keycode > 0) ?
- dce->keys.max_keycode - dce->keys.min_keycode + 1 : 0;
- if (nkeys > 0)
- {
+ dce->keys.max_keycode - dce->keys.min_keycode + 1 : 0;
+ if (nkeys > 0) {
len += sizeof(xXIKeyInfo);
- len += sizeof(CARD32) * nkeys; /* keycodes */
+ len += sizeof(CARD32) * nkeys; /* keycodes */
}
dcce = calloc(1, len);
- if (!dcce)
- {
+ if (!dcce) {
ErrorF("[Xi] BadAlloc in SendDeviceChangedEvent.\n");
return BadAlloc;
}
- dcce->type = GenericEvent;
- dcce->extension = IReqCode;
- dcce->evtype = XI_DeviceChanged;
- dcce->time = dce->time;
- dcce->deviceid = dce->deviceid;
- dcce->sourceid = dce->sourceid;
- dcce->reason = (dce->flags & DEVCHANGE_DEVICE_CHANGE) ? XIDeviceChange : XISlaveSwitch;
- dcce->num_classes = 0;
+ dcce->type = GenericEvent;
+ dcce->extension = IReqCode;
+ dcce->evtype = XI_DeviceChanged;
+ dcce->time = dce->time;
+ dcce->deviceid = dce->deviceid;
+ dcce->sourceid = dce->sourceid;
+ dcce->reason =
+ (dce->flags & DEVCHANGE_DEVICE_CHANGE) ? XIDeviceChange : XISlaveSwitch;
+ dcce->num_classes = 0;
dcce->length = bytes_to_int32(len - sizeof(xEvent));
- ptr = (char*)&dcce[1];
- if (dce->buttons.num_buttons)
- {
+ ptr = (char *) &dcce[1];
+ if (dce->buttons.num_buttons) {
dcce->num_classes++;
- ptr += appendButtonInfo(dce, (xXIButtonInfo*)ptr);
+ ptr += appendButtonInfo(dce, (xXIButtonInfo *) ptr);
}
- if (nkeys)
- {
+ if (nkeys) {
dcce->num_classes++;
- ptr += appendKeyInfo(dce, (xXIKeyInfo*)ptr);
+ ptr += appendKeyInfo(dce, (xXIKeyInfo *) ptr);
}
- if (dce->num_valuators)
- {
+ if (dce->num_valuators) {
int i;
dcce->num_classes += dce->num_valuators;
for (i = 0; i < dce->num_valuators; i++)
- ptr += appendValuatorInfo(dce, (xXIValuatorInfo*)ptr, i);
+ ptr += appendValuatorInfo(dce, (xXIValuatorInfo *) ptr, i);
- for (i = 0; i < dce->num_valuators; i++)
- {
- if (dce->valuators[i].scroll.type != SCROLL_TYPE_NONE)
- {
+ for (i = 0; i < dce->num_valuators; i++) {
+ if (dce->valuators[i].scroll.type != SCROLL_TYPE_NONE) {
dcce->num_classes++;
- ptr += appendScrollInfo(dce, (xXIScrollInfo*)ptr, i);
+ ptr += appendScrollInfo(dce, (xXIScrollInfo *) ptr, i);
}
}
}
- *xi = (xEvent*)dcce;
+ *xi = (xEvent *) dcce;
return Success;
}
-static int count_bits(unsigned char* ptr, int len)
+static int
+count_bits(unsigned char *ptr, int len)
{
int bits = 0;
unsigned int i;
unsigned char x;
- for (i = 0; i < len; i++)
- {
+ for (i = 0; i < len; i++) {
x = ptr[i];
- while(x > 0)
- {
+ while (x > 0) {
bits += (x & 0x1);
x >>= 1;
}
@@ -658,69 +647,67 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
* with MAX_VALUATORS below */
/* btlen is in 4 byte units */
btlen = bytes_to_int32(bits_to_bytes(MAX_BUTTONS));
- len += btlen * 4; /* buttonmask len */
+ len += btlen * 4; /* buttonmask len */
-
- vallen = count_bits(ev->valuators.mask, sizeof(ev->valuators.mask)/sizeof(ev->valuators.mask[0]));
- len += vallen * 2 * sizeof(uint32_t); /* axisvalues */
+ vallen =
+ count_bits(ev->valuators.mask,
+ sizeof(ev->valuators.mask) / sizeof(ev->valuators.mask[0]));
+ len += vallen * 2 * sizeof(uint32_t); /* axisvalues */
vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS));
- len += vallen * 4; /* valuators mask */
+ len += vallen * 4; /* valuators mask */
*xi = calloc(1, len);
- xde = (xXIDeviceEvent*)*xi;
- xde->type = GenericEvent;
- xde->extension = IReqCode;
- xde->evtype = GetXI2Type(ev->type);
- xde->time = ev->time;
- xde->length = bytes_to_int32(len - sizeof(xEvent));
- if (IsTouchEvent((InternalEvent*)ev))
- xde->detail = ev->touchid;
+ xde = (xXIDeviceEvent *) * xi;
+ xde->type = GenericEvent;
+ xde->extension = IReqCode;
+ xde->evtype = GetXI2Type(ev->type);
+ xde->time = ev->time;
+ xde->length = bytes_to_int32(len - sizeof(xEvent));
+ if (IsTouchEvent((InternalEvent *) ev))
+ xde->detail = ev->touchid;
else
- xde->detail = ev->detail.button;
+ xde->detail = ev->detail.button;
- xde->root = ev->root;
- xde->buttons_len = btlen;
- xde->valuators_len = vallen;
- xde->deviceid = ev->deviceid;
- xde->sourceid = ev->sourceid;
- xde->root_x = FP1616(ev->root_x, ev->root_x_frac);
- xde->root_y = FP1616(ev->root_y, ev->root_y_frac);
+ xde->root = ev->root;
+ xde->buttons_len = btlen;
+ xde->valuators_len = vallen;
+ xde->deviceid = ev->deviceid;
+ xde->sourceid = ev->sourceid;
+ xde->root_x = FP1616(ev->root_x, ev->root_x_frac);
+ xde->root_y = FP1616(ev->root_y, ev->root_y_frac);
if (ev->type == ET_TouchUpdate)
xde->flags |= (ev->flags & TOUCH_PENDING_END) ? XITouchPendingEnd : 0;
else
xde->flags = ev->flags;
- if (IsTouchEvent((InternalEvent*)ev) &&
+ if (IsTouchEvent((InternalEvent *) ev) &&
ev->flags & TOUCH_POINTER_EMULATED)
xde->flags |= XITouchEmulatingPointer;
if (ev->key_repeat)
- xde->flags |= XIKeyRepeat;
+ xde->flags |= XIKeyRepeat;
- xde->mods.base_mods = ev->mods.base;
- xde->mods.latched_mods = ev->mods.latched;
- xde->mods.locked_mods = ev->mods.locked;
- xde->mods.effective_mods = ev->mods.effective;
+ xde->mods.base_mods = ev->mods.base;
+ xde->mods.latched_mods = ev->mods.latched;
+ xde->mods.locked_mods = ev->mods.locked;
+ xde->mods.effective_mods = ev->mods.effective;
- xde->group.base_group = ev->group.base;
- xde->group.latched_group = ev->group.latched;
- xde->group.locked_group = ev->group.locked;
- xde->group.effective_group = ev->group.effective;
+ xde->group.base_group = ev->group.base;
+ xde->group.latched_group = ev->group.latched;
+ xde->group.locked_group = ev->group.locked;
+ xde->group.effective_group = ev->group.effective;
- ptr = (char*)&xde[1];
- for (i = 0; i < sizeof(ev->buttons) * 8; i++)
- {
+ ptr = (char *) &xde[1];
+ for (i = 0; i < sizeof(ev->buttons) * 8; i++) {
if (BitIsOn(ev->buttons, i))
SetBit(ptr, i);
}
ptr += xde->buttons_len * 4;
- axisval = (FP3232*)(ptr + xde->valuators_len * 4);
- for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
- {
- if (BitIsOn(ev->valuators.mask, i))
- {
+ axisval = (FP3232 *) (ptr + xde->valuators_len * 4);
+ for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++) {
+ if (BitIsOn(ev->valuators.mask, i)) {
SetBit(ptr, i);
*axisval = double_to_fp3232(ev->valuators.data[i]);
axisval++;
@@ -737,16 +724,16 @@ eventToTouchOwnershipEvent(TouchOwnershipEvent *ev, xEvent **xi)
xXITouchOwnershipEvent *xtoe;
*xi = calloc(1, len);
- xtoe = (xXITouchOwnershipEvent*)*xi;
- xtoe->type = GenericEvent;
- xtoe->extension = IReqCode;
- xtoe->length = bytes_to_int32(len - sizeof(xEvent));
- xtoe->evtype = GetXI2Type(ev->type);
- xtoe->deviceid = ev->deviceid;
- xtoe->time = ev->time;
- xtoe->sourceid = ev->sourceid;
- xtoe->touchid = ev->touchid;
- xtoe->flags = 0; /* we don't have wire flags for ownership yet */
+ xtoe = (xXITouchOwnershipEvent *) * xi;
+ xtoe->type = GenericEvent;
+ xtoe->extension = IReqCode;
+ xtoe->length = bytes_to_int32(len - sizeof(xEvent));
+ xtoe->evtype = GetXI2Type(ev->type);
+ xtoe->deviceid = ev->deviceid;
+ xtoe->time = ev->time;
+ xtoe->sourceid = ev->sourceid;
+ xtoe->touchid = ev->touchid;
+ xtoe->flags = 0; /* we don't have wire flags for ownership yet */
return Success;
}
@@ -754,40 +741,38 @@ eventToTouchOwnershipEvent(TouchOwnershipEvent *ev, xEvent **xi)
static int
eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
{
- xXIRawEvent* raw;
+ xXIRawEvent *raw;
int vallen, nvals;
int i, len = sizeof(xXIRawEvent);
char *ptr;
FP3232 *axisval, *axisval_raw;
nvals = count_bits(ev->valuators.mask, sizeof(ev->valuators.mask));
- len += nvals * sizeof(FP3232) * 2; /* 8 byte per valuator, once
- raw, once processed */
+ len += nvals * sizeof(FP3232) * 2; /* 8 byte per valuator, once
+ raw, once processed */
vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS));
- len += vallen * 4; /* valuators mask */
+ len += vallen * 4; /* valuators mask */
*xi = calloc(1, len);
- raw = (xXIRawEvent*)*xi;
- raw->type = GenericEvent;
- raw->extension = IReqCode;
- raw->evtype = GetXI2Type(ev->type);
- raw->time = ev->time;
- raw->length = bytes_to_int32(len - sizeof(xEvent));
- raw->detail = ev->detail.button;
- raw->deviceid = ev->deviceid;
- raw->sourceid = ev->sourceid;
- raw->valuators_len = vallen;
- raw->flags = ev->flags;
-
- ptr = (char*)&raw[1];
- axisval = (FP3232*)(ptr + raw->valuators_len * 4);
+ raw = (xXIRawEvent *) * xi;
+ raw->type = GenericEvent;
+ raw->extension = IReqCode;
+ raw->evtype = GetXI2Type(ev->type);
+ raw->time = ev->time;
+ raw->length = bytes_to_int32(len - sizeof(xEvent));
+ raw->detail = ev->detail.button;
+ raw->deviceid = ev->deviceid;
+ raw->sourceid = ev->sourceid;
+ raw->valuators_len = vallen;
+ raw->flags = ev->flags;
+
+ ptr = (char *) &raw[1];
+ axisval = (FP3232 *) (ptr + raw->valuators_len * 4);
axisval_raw = axisval + nvals;
- for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
- {
- if (BitIsOn(ev->valuators.mask, i))
- {
+ for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++) {
+ if (BitIsOn(ev->valuators.mask, i)) {
SetBit(ptr, i);
- *axisval = double_to_fp3232(ev->valuators.data[i]);
+ *axisval = double_to_fp3232(ev->valuators.data[i]);
*axisval_raw = double_to_fp3232(ev->valuators.data_raw[i]);
axisval++;
axisval_raw++;
@@ -805,15 +790,25 @@ int
GetCoreType(enum EventType type)
{
int coretype = 0;
- switch(type)
- {
- case ET_Motion: coretype = MotionNotify; break;
- case ET_ButtonPress: coretype = ButtonPress; break;
- case ET_ButtonRelease: coretype = ButtonRelease; break;
- case ET_KeyPress: coretype = KeyPress; break;
- case ET_KeyRelease: coretype = KeyRelease; break;
- default:
- break;
+
+ switch (type) {
+ case ET_Motion:
+ coretype = MotionNotify;
+ break;
+ case ET_ButtonPress:
+ coretype = ButtonPress;
+ break;
+ case ET_ButtonRelease:
+ coretype = ButtonRelease;
+ break;
+ case ET_KeyPress:
+ coretype = KeyPress;
+ break;
+ case ET_KeyRelease:
+ coretype = KeyRelease;
+ break;
+ default:
+ break;
}
return coretype;
}
@@ -826,17 +821,31 @@ int
GetXIType(enum EventType type)
{
int xitype = 0;
- switch(type)
- {
- case ET_Motion: xitype = DeviceMotionNotify; break;
- case ET_ButtonPress: xitype = DeviceButtonPress; break;
- case ET_ButtonRelease: xitype = DeviceButtonRelease; break;
- case ET_KeyPress: xitype = DeviceKeyPress; break;
- case ET_KeyRelease: xitype = DeviceKeyRelease; break;
- case ET_ProximityIn: xitype = ProximityIn; break;
- case ET_ProximityOut: xitype = ProximityOut; break;
- default:
- break;
+
+ switch (type) {
+ case ET_Motion:
+ xitype = DeviceMotionNotify;
+ break;
+ case ET_ButtonPress:
+ xitype = DeviceButtonPress;
+ break;
+ case ET_ButtonRelease:
+ xitype = DeviceButtonRelease;
+ break;
+ case ET_KeyPress:
+ xitype = DeviceKeyPress;
+ break;
+ case ET_KeyRelease:
+ xitype = DeviceKeyRelease;
+ break;
+ case ET_ProximityIn:
+ xitype = ProximityIn;
+ break;
+ case ET_ProximityOut:
+ xitype = ProximityOut;
+ break;
+ default:
+ break;
}
return xitype;
}
@@ -850,33 +859,78 @@ GetXI2Type(enum EventType type)
{
int xi2type = 0;
- switch(type)
- {
- case ET_Motion: xi2type = XI_Motion; break;
- case ET_ButtonPress: xi2type = XI_ButtonPress; break;
- case ET_ButtonRelease: xi2type = XI_ButtonRelease; break;
- case ET_KeyPress: xi2type = XI_KeyPress; break;
- case ET_KeyRelease: xi2type = XI_KeyRelease; break;
- case ET_Enter: xi2type = XI_Enter; break;
- case ET_Leave: xi2type = XI_Leave; break;
- case ET_Hierarchy: xi2type = XI_HierarchyChanged; break;
- case ET_DeviceChanged: xi2type = XI_DeviceChanged; break;
- case ET_RawKeyPress: xi2type = XI_RawKeyPress; break;
- case ET_RawKeyRelease: xi2type = XI_RawKeyRelease; break;
- case ET_RawButtonPress: xi2type = XI_RawButtonPress; break;
- case ET_RawButtonRelease: xi2type = XI_RawButtonRelease; break;
- case ET_RawMotion: xi2type = XI_RawMotion; break;
- case ET_RawTouchBegin: xi2type = XI_RawTouchBegin; break;
- case ET_RawTouchUpdate: xi2type = XI_RawTouchUpdate; break;
- case ET_RawTouchEnd: xi2type = XI_RawTouchEnd; break;
- case ET_FocusIn: xi2type = XI_FocusIn; break;
- case ET_FocusOut: xi2type = XI_FocusOut; break;
- case ET_TouchBegin: xi2type = XI_TouchBegin; break;
- case ET_TouchEnd: xi2type = XI_TouchEnd; break;
- case ET_TouchUpdate: xi2type = XI_TouchUpdate; break;
- case ET_TouchOwnership: xi2type = XI_TouchOwnership; break;
- default:
- break;
+ switch (type) {
+ case ET_Motion:
+ xi2type = XI_Motion;
+ break;
+ case ET_ButtonPress:
+ xi2type = XI_ButtonPress;
+ break;
+ case ET_ButtonRelease:
+ xi2type = XI_ButtonRelease;
+ break;
+ case ET_KeyPress:
+ xi2type = XI_KeyPress;
+ break;
+ case ET_KeyRelease:
+ xi2type = XI_KeyRelease;
+ break;
+ case ET_Enter:
+ xi2type = XI_Enter;
+ break;
+ case ET_Leave:
+ xi2type = XI_Leave;
+ break;
+ case ET_Hierarchy:
+ xi2type = XI_HierarchyChanged;
+ break;
+ case ET_DeviceChanged:
+ xi2type = XI_DeviceChanged;
+ break;
+ case ET_RawKeyPress:
+ xi2type = XI_RawKeyPress;
+ break;
+ case ET_RawKeyRelease:
+ xi2type = XI_RawKeyRelease;
+ break;
+ case ET_RawButtonPress:
+ xi2type = XI_RawButtonPress;
+ break;
+ case ET_RawButtonRelease:
+ xi2type = XI_RawButtonRelease;
+ break;
+ case ET_RawMotion:
+ xi2type = XI_RawMotion;
+ break;
+ case ET_RawTouchBegin:
+ xi2type = XI_RawTouchBegin;
+ break;
+ case ET_RawTouchUpdate:
+ xi2type = XI_RawTouchUpdate;
+ break;
+ case ET_RawTouchEnd:
+ xi2type = XI_RawTouchEnd;
+ break;
+ case ET_FocusIn:
+ xi2type = XI_FocusIn;
+ break;
+ case ET_FocusOut:
+ xi2type = XI_FocusOut;
+ break;
+ case ET_TouchBegin:
+ xi2type = XI_TouchBegin;
+ break;
+ case ET_TouchEnd:
+ xi2type = XI_TouchEnd;
+ break;
+ case ET_TouchUpdate:
+ xi2type = XI_TouchUpdate;
+ break;
+ case ET_TouchOwnership:
+ xi2type = XI_TouchOwnership;
+ break;
+ default:
+ break;
}
return xi2type;
}
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index d225546ca..05f6ca6a5 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -130,6 +129,7 @@ Equipment Corporation.
#ifdef XSERVER_DTRACE
#include <sys/types.h>
typedef const char *string;
+
#include "Xserver-dtrace.h"
#endif
@@ -155,7 +155,7 @@ typedef const char *string;
#include "mi.h"
/* Extension events type numbering starts at EXTENSION_EVENT_BASE. */
-#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
+#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
#define StructureAndSubMask ( StructureNotifyMask | SubstructureNotifyMask )
#define AllButtonsMask ( \
Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask )
@@ -177,7 +177,6 @@ typedef const char *string;
#define LastEventMask OwnerGrabButtonMask
#define AllEventMasks (LastEventMask|(LastEventMask-1))
-
/* @return the core event type or 0 if the event is not a core event */
static inline int
core_get_type(const xEvent *event)
@@ -191,9 +190,10 @@ core_get_type(const xEvent *event)
static inline int
xi2_get_type(const xEvent *event)
{
- const xGenericEvent* e = (const xGenericEvent*)event;
+ const xGenericEvent *e = (const xGenericEvent *) event;
- return (e->type != GenericEvent || e->extension != IReqCode) ? 0 : e->evtype;
+ return (e->type != GenericEvent ||
+ e->extension != IReqCode) ? 0 : e->evtype;
}
/**
@@ -206,7 +206,6 @@ xi2_get_type(const xEvent *event)
#define XE_KBPTR (xE->u.keyButtonPointer)
-
CallbackListPtr EventCallback;
CallbackListPtr DeviceEventCallback;
@@ -215,11 +214,10 @@ CallbackListPtr DeviceEventCallback;
Mask DontPropagateMasks[DNPMCOUNT];
static int DontPropagateRefCnts[DNPMCOUNT];
-static void CheckVirtualMotion( DeviceIntPtr pDev, QdEventPtr qe, WindowPtr pWin);
-static void CheckPhysLimits(DeviceIntPtr pDev,
- CursorPtr cursor,
- Bool generateEvents,
- Bool confineToScreen,
+static void CheckVirtualMotion(DeviceIntPtr pDev, QdEventPtr qe,
+ WindowPtr pWin);
+static void CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor,
+ Bool generateEvents, Bool confineToScreen,
ScreenPtr pScreen);
/** Key repeat hack. Do not use but in TryClientEvents */
@@ -266,7 +264,7 @@ EventSyncInfoRec syncEvents;
*/
#define RootWindow(sprite) sprite->spriteTrace[0]
-static xEvent* swapEvent = NULL;
+static xEvent *swapEvent = NULL;
static int swapEventLen = 0;
void
@@ -284,6 +282,7 @@ int
XItoCoreType(int xitype)
{
int coretype = 0;
+
if (xitype == DeviceMotionNotify)
coretype = MotionNotify;
else if (xitype == DeviceButtonPress)
@@ -316,8 +315,7 @@ Bool
IsPointerDevice(DeviceIntPtr dev)
{
return (dev->type == MASTER_POINTER) ||
- (dev->valuator && dev->button) ||
- (dev->valuator && !dev->key);
+ (dev->valuator && dev->button) || (dev->valuator && !dev->key);
}
/*
@@ -331,7 +329,7 @@ Bool
IsKeyboardDevice(DeviceIntPtr dev)
{
return (dev->type == MASTER_KEYBOARD) ||
- ((dev->key && dev->kbdfeed) && !IsPointerDevice(dev));
+ ((dev->key && dev->kbdfeed) && !IsPointerDevice(dev));
}
Bool
@@ -343,10 +341,9 @@ IsMaster(DeviceIntPtr dev)
Bool
IsFloating(DeviceIntPtr dev)
{
- return GetMaster(dev, MASTER_KEYBOARD) == NULL;
+ return !IsMaster(dev) && GetMaster(dev, MASTER_KEYBOARD) == NULL;
}
-
/**
* Max event opcode.
*/
@@ -370,43 +367,42 @@ extern int DeviceMotionNotify;
*/
Mask event_filters[MAXDEVICES][MAXEVENTS];
-static const Mask default_filter[MAXEVENTS] =
-{
- NoSuchEvent, /* 0 */
- NoSuchEvent, /* 1 */
- KeyPressMask, /* KeyPress */
- KeyReleaseMask, /* KeyRelease */
- ButtonPressMask, /* ButtonPress */
- ButtonReleaseMask, /* ButtonRelease */
- PointerMotionMask, /* MotionNotify (initial state) */
- EnterWindowMask, /* EnterNotify */
- LeaveWindowMask, /* LeaveNotify */
- FocusChangeMask, /* FocusIn */
- FocusChangeMask, /* FocusOut */
- KeymapStateMask, /* KeymapNotify */
- ExposureMask, /* Expose */
- CantBeFiltered, /* GraphicsExpose */
- CantBeFiltered, /* NoExpose */
- VisibilityChangeMask, /* VisibilityNotify */
- SubstructureNotifyMask, /* CreateNotify */
- StructureAndSubMask, /* DestroyNotify */
- StructureAndSubMask, /* UnmapNotify */
- StructureAndSubMask, /* MapNotify */
- SubstructureRedirectMask, /* MapRequest */
- StructureAndSubMask, /* ReparentNotify */
- StructureAndSubMask, /* ConfigureNotify */
- SubstructureRedirectMask, /* ConfigureRequest */
- StructureAndSubMask, /* GravityNotify */
- ResizeRedirectMask, /* ResizeRequest */
- StructureAndSubMask, /* CirculateNotify */
- SubstructureRedirectMask, /* CirculateRequest */
- PropertyChangeMask, /* PropertyNotify */
- CantBeFiltered, /* SelectionClear */
- CantBeFiltered, /* SelectionRequest */
- CantBeFiltered, /* SelectionNotify */
- ColormapChangeMask, /* ColormapNotify */
- CantBeFiltered, /* ClientMessage */
- CantBeFiltered /* MappingNotify */
+static const Mask default_filter[MAXEVENTS] = {
+ NoSuchEvent, /* 0 */
+ NoSuchEvent, /* 1 */
+ KeyPressMask, /* KeyPress */
+ KeyReleaseMask, /* KeyRelease */
+ ButtonPressMask, /* ButtonPress */
+ ButtonReleaseMask, /* ButtonRelease */
+ PointerMotionMask, /* MotionNotify (initial state) */
+ EnterWindowMask, /* EnterNotify */
+ LeaveWindowMask, /* LeaveNotify */
+ FocusChangeMask, /* FocusIn */
+ FocusChangeMask, /* FocusOut */
+ KeymapStateMask, /* KeymapNotify */
+ ExposureMask, /* Expose */
+ CantBeFiltered, /* GraphicsExpose */
+ CantBeFiltered, /* NoExpose */
+ VisibilityChangeMask, /* VisibilityNotify */
+ SubstructureNotifyMask, /* CreateNotify */
+ StructureAndSubMask, /* DestroyNotify */
+ StructureAndSubMask, /* UnmapNotify */
+ StructureAndSubMask, /* MapNotify */
+ SubstructureRedirectMask, /* MapRequest */
+ StructureAndSubMask, /* ReparentNotify */
+ StructureAndSubMask, /* ConfigureNotify */
+ SubstructureRedirectMask, /* ConfigureRequest */
+ StructureAndSubMask, /* GravityNotify */
+ ResizeRedirectMask, /* ResizeRequest */
+ StructureAndSubMask, /* CirculateNotify */
+ SubstructureRedirectMask, /* CirculateRequest */
+ PropertyChangeMask, /* PropertyNotify */
+ CantBeFiltered, /* SelectionClear */
+ CantBeFiltered, /* SelectionRequest */
+ CantBeFiltered, /* SelectionNotify */
+ ColormapChangeMask, /* ColormapNotify */
+ CantBeFiltered, /* ClientMessage */
+ CantBeFiltered /* MappingNotify */
};
/**
@@ -453,13 +449,12 @@ GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type)
return 0;
}
-
/**
* @return TRUE if the mask is set for this event from this device on the
* window, or FALSE otherwise.
*/
Bool
-WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
+WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent *ev)
{
OtherInputMasks *inputMasks = wOtherInputMasks(win);
int evtype;
@@ -467,34 +462,33 @@ WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
if (!inputMasks || xi2_get_type(ev) == 0)
return 0;
- evtype = ((xGenericEvent*)ev)->evtype;
+ evtype = ((xGenericEvent *) ev)->evtype;
return xi2mask_isset(inputMasks->xi2mask, dev, evtype);
}
Mask
-GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients* other)
+GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients * other)
{
int evtype;
/* XI2 filters are only ever 8 bit, so let's return a 8 bit mask */
- if ((evtype = xi2_get_type(event)))
- {
+ if ((evtype = xi2_get_type(event))) {
return GetXI2MaskByte(other->xi2mask, dev, evtype);
- } else if (core_get_type(event) != 0)
+ }
+ else if (core_get_type(event) != 0)
return other->mask[XIAllDevices];
else
return other->mask[dev->id];
}
-
-static CARD8 criticalEvents[32] =
-{
- 0x7c, 0x30, 0x40 /* key, button, expose, and configure events */
+static CARD8 criticalEvents[32] = {
+ 0x7c, 0x30, 0x40 /* key, button, expose, and configure events */
};
static void
-SyntheticMotion(DeviceIntPtr dev, int x, int y) {
+SyntheticMotion(DeviceIntPtr dev, int x, int y)
+{
int screenno = 0;
#ifdef PANORAMIX
@@ -502,7 +496,8 @@ SyntheticMotion(DeviceIntPtr dev, int x, int y) {
screenno = dev->spriteInfo->sprite->screen->myNum;
#endif
PostSyntheticMotion(dev, x, y, screenno,
- (syncEvents.playingEvents) ? syncEvents.time.milliseconds : currentTime.milliseconds);
+ (syncEvents.playingEvents) ? syncEvents.time.
+ milliseconds : currentTime.milliseconds);
}
@@ -510,12 +505,8 @@ SyntheticMotion(DeviceIntPtr dev, int x, int y) {
static void PostNewCursor(DeviceIntPtr pDev);
static Bool
-XineramaSetCursorPosition(
- DeviceIntPtr pDev,
- int x,
- int y,
- Bool generateEvent
-){
+XineramaSetCursorPosition(DeviceIntPtr pDev, int x, int y, Bool generateEvent)
+{
ScreenPtr pScreen;
int i;
SpritePtr pSprite = pDev->spriteInfo->sprite;
@@ -528,18 +519,15 @@ XineramaSetCursorPosition(
x += screenInfo.screens[0]->x;
y += screenInfo.screens[0]->y;
- if(!point_on_screen(pScreen, x, y))
- {
- FOR_NSCREENS(i)
- {
- if(i == pScreen->myNum)
- continue;
- if(point_on_screen(screenInfo.screens[i], x, y))
- {
- pScreen = screenInfo.screens[i];
- break;
- }
- }
+ if (!point_on_screen(pScreen, x, y)) {
+ FOR_NSCREENS(i) {
+ if (i == pScreen->myNum)
+ continue;
+ if (point_on_screen(screenInfo.screens[i], x, y)) {
+ pScreen = screenInfo.screens[i];
+ break;
+ }
+ }
}
pSprite->screen = pScreen;
@@ -548,10 +536,9 @@ XineramaSetCursorPosition(
x -= pScreen->x;
y -= pScreen->y;
- return (*pScreen->SetCursorPosition)(pDev, pScreen, x, y, generateEvent);
+ return (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
}
-
static void
XineramaConstrainCursor(DeviceIntPtr pDev)
{
@@ -569,66 +556,65 @@ XineramaConstrainCursor(DeviceIntPtr pDev)
newBox.y1 += screenInfo.screens[0]->y - pScreen->y;
newBox.y2 += screenInfo.screens[0]->y - pScreen->y;
- (* pScreen->ConstrainCursor)(pDev, pScreen, &newBox);
+ (*pScreen->ConstrainCursor) (pDev, pScreen, &newBox);
}
-
static Bool
XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin)
{
SpritePtr pSprite = pDev->spriteInfo->sprite;
- if(pWin == screenInfo.screens[0]->root) {
- int i;
- FOR_NSCREENS(i)
- pSprite->windows[i] = screenInfo.screens[i]->root;
- } else {
- PanoramiXRes *win;
- int rc, i;
-
- rc = dixLookupResourceByType((pointer *)&win, pWin->drawable.id,
- XRT_WINDOW, serverClient, DixReadAccess);
- if (rc != Success)
- return FALSE;
-
- FOR_NSCREENS(i) {
- rc = dixLookupWindow(pSprite->windows + i, win->info[i].id,
- serverClient, DixReadAccess);
- if (rc != Success) /* window is being unmapped */
- return FALSE;
- }
+ if (pWin == screenInfo.screens[0]->root) {
+ int i;
+
+ FOR_NSCREENS(i)
+ pSprite->windows[i] = screenInfo.screens[i]->root;
+ }
+ else {
+ PanoramiXRes *win;
+ int rc, i;
+
+ rc = dixLookupResourceByType((pointer *) &win, pWin->drawable.id,
+ XRT_WINDOW, serverClient, DixReadAccess);
+ if (rc != Success)
+ return FALSE;
+
+ FOR_NSCREENS(i) {
+ rc = dixLookupWindow(pSprite->windows + i, win->info[i].id,
+ serverClient, DixReadAccess);
+ if (rc != Success) /* window is being unmapped */
+ return FALSE;
+ }
}
return TRUE;
}
static void
XineramaConfineCursorToWindow(DeviceIntPtr pDev,
- WindowPtr pWin,
- Bool generateEvents)
+ WindowPtr pWin, Bool generateEvents)
{
SpritePtr pSprite = pDev->spriteInfo->sprite;
int x, y, off_x, off_y, i;
- if(!XineramaSetWindowPntrs(pDev, pWin))
+ if (!XineramaSetWindowPntrs(pDev, pWin))
return;
i = PanoramiXNumScreens - 1;
- RegionCopy(&pSprite->Reg1,
- &pSprite->windows[i]->borderSize);
+ RegionCopy(&pSprite->Reg1, &pSprite->windows[i]->borderSize);
off_x = screenInfo.screens[i]->x;
off_y = screenInfo.screens[i]->y;
- while(i--) {
+ while (i--) {
x = off_x - screenInfo.screens[i]->x;
y = off_y - screenInfo.screens[i]->y;
- if(x || y)
+ if (x || y)
RegionTranslate(&pSprite->Reg1, x, y);
RegionUnion(&pSprite->Reg1, &pSprite->Reg1,
- &pSprite->windows[i]->borderSize);
+ &pSprite->windows[i]->borderSize);
off_x = screenInfo.screens[i]->x;
off_y = screenInfo.screens[i]->y;
@@ -636,18 +622,19 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev,
pSprite->hotLimits = *RegionExtents(&pSprite->Reg1);
- if(RegionNumRects(&pSprite->Reg1) > 1)
+ if (RegionNumRects(&pSprite->Reg1) > 1)
pSprite->hotShape = &pSprite->Reg1;
else
pSprite->hotShape = NullRegion;
pSprite->confined = FALSE;
- pSprite->confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin;
+ pSprite->confineWin =
+ (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin;
CheckPhysLimits(pDev, pSprite->current, generateEvents, FALSE, NULL);
}
-#endif /* PANORAMIX */
+#endif /* PANORAMIX */
/**
* Modifies the filter for the given protocol event type to the given masks.
@@ -675,7 +662,7 @@ void
SetCriticalEvent(int event)
{
if (event >= MAXEVENTS)
- FatalError("SetCriticalEvent: bogus event number");
+ FatalError("SetCriticalEvent: bogus event number");
criticalEvents[event >> 3] |= 1 << (event & 7);
}
@@ -687,47 +674,40 @@ ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py)
int incx = 1, incy = 1;
if (RegionContainsPoint(shape, x, y, &box))
- return;
+ return;
box = *RegionExtents(shape);
/* this is rather crude */
do {
- x += incx;
- if (x >= box.x2)
- {
- incx = -1;
- x = *px - 1;
- }
- else if (x < box.x1)
- {
- incx = 1;
- x = *px;
- y += incy;
- if (y >= box.y2)
- {
- incy = -1;
- y = *py - 1;
- }
- else if (y < box.y1)
- return; /* should never get here! */
- }
+ x += incx;
+ if (x >= box.x2) {
+ incx = -1;
+ x = *px - 1;
+ }
+ else if (x < box.x1) {
+ incx = 1;
+ x = *px;
+ y += incy;
+ if (y >= box.y2) {
+ incy = -1;
+ y = *py - 1;
+ }
+ else if (y < box.y1)
+ return; /* should never get here! */
+ }
} while (!RegionContainsPoint(shape, x, y, &box));
*px = x;
*py = y;
}
static void
-CheckPhysLimits(
- DeviceIntPtr pDev,
- CursorPtr cursor,
- Bool generateEvents,
- Bool confineToScreen, /* unused if PanoramiX on */
- ScreenPtr pScreen) /* unused if PanoramiX on */
-{
+CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents, Bool confineToScreen, /* unused if PanoramiX on */
+ ScreenPtr pScreen)
+{ /* unused if PanoramiX on */
HotSpot new;
SpritePtr pSprite = pDev->spriteInfo->sprite;
if (!cursor)
- return;
+ return;
new = pSprite->hotPhys;
#ifdef PANORAMIX
if (!noPanoramiXExtension)
@@ -741,36 +721,33 @@ CheckPhysLimits(
else
pScreen = new.pScreen;
(*pScreen->CursorLimits) (pDev, pScreen, cursor, &pSprite->hotLimits,
- &pSprite->physLimits);
+ &pSprite->physLimits);
pSprite->confined = confineToScreen;
- (* pScreen->ConstrainCursor)(pDev, pScreen, &pSprite->physLimits);
+ (*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits);
}
/* constrain the pointer to those limits */
if (new.x < pSprite->physLimits.x1)
- new.x = pSprite->physLimits.x1;
- else
- if (new.x >= pSprite->physLimits.x2)
- new.x = pSprite->physLimits.x2 - 1;
+ new.x = pSprite->physLimits.x1;
+ else if (new.x >= pSprite->physLimits.x2)
+ new.x = pSprite->physLimits.x2 - 1;
if (new.y < pSprite->physLimits.y1)
- new.y = pSprite->physLimits.y1;
- else
- if (new.y >= pSprite->physLimits.y2)
- new.y = pSprite->physLimits.y2 - 1;
+ new.y = pSprite->physLimits.y1;
+ else if (new.y >= pSprite->physLimits.y2)
+ new.y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
- ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y);
+ ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y);
if ((
#ifdef PANORAMIX
noPanoramiXExtension &&
#endif
(pScreen != pSprite->hotPhys.pScreen)) ||
- (new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y))
- {
+ (new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)) {
#ifdef PANORAMIX
if (!noPanoramiXExtension)
{
if (pScreen && ((new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)))
- XineramaSetCursorPosition (pDev, new.x, new.y, generateEvents);
+ XineramaSetCursorPosition(pDev, new.x, new.y, generateEvents);
}
else
#endif
@@ -792,94 +769,89 @@ CheckPhysLimits(
}
static void
-CheckVirtualMotion(
- DeviceIntPtr pDev,
- QdEventPtr qe,
- WindowPtr pWin)
+CheckVirtualMotion(DeviceIntPtr pDev, QdEventPtr qe, WindowPtr pWin)
{
SpritePtr pSprite = pDev->spriteInfo->sprite;
RegionPtr reg = NULL;
DeviceEvent *ev = NULL;
- if (qe)
- {
+ if (qe) {
ev = &qe->event->device_event;
- switch(ev->type)
- {
- case ET_Motion:
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_KeyPress:
- case ET_KeyRelease:
- case ET_ProximityIn:
- case ET_ProximityOut:
- pSprite->hot.pScreen = qe->pScreen;
- pSprite->hot.x = ev->root_x;
- pSprite->hot.y = ev->root_y;
- pWin = pDev->deviceGrab.grab ? pDev->deviceGrab.grab->confineTo : NullWindow;
- break;
- default:
- break;
+ switch (ev->type) {
+ case ET_Motion:
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ pSprite->hot.pScreen = qe->pScreen;
+ pSprite->hot.x = ev->root_x;
+ pSprite->hot.y = ev->root_y;
+ pWin =
+ pDev->deviceGrab.grab ? pDev->deviceGrab.grab->
+ confineTo : NullWindow;
+ break;
+ default:
+ break;
}
}
- if (pWin)
- {
- BoxRec lims;
+ if (pWin) {
+ BoxRec lims;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
int x, y, off_x, off_y, i;
- if(!XineramaSetWindowPntrs(pDev, pWin))
+ if (!XineramaSetWindowPntrs(pDev, pWin))
return;
i = PanoramiXNumScreens - 1;
- RegionCopy(&pSprite->Reg2,
- &pSprite->windows[i]->borderSize);
+ RegionCopy(&pSprite->Reg2, &pSprite->windows[i]->borderSize);
off_x = screenInfo.screens[i]->x;
off_y = screenInfo.screens[i]->y;
- while(i--) {
+ while (i--) {
x = off_x - screenInfo.screens[i]->x;
y = off_y - screenInfo.screens[i]->y;
- if(x || y)
+ if (x || y)
RegionTranslate(&pSprite->Reg2, x, y);
RegionUnion(&pSprite->Reg2, &pSprite->Reg2,
- &pSprite->windows[i]->borderSize);
+ &pSprite->windows[i]->borderSize);
off_x = screenInfo.screens[i]->x;
off_y = screenInfo.screens[i]->y;
}
- } else
+ }
+ else
#endif
{
- if (pSprite->hot.pScreen != pWin->drawable.pScreen)
- {
+ if (pSprite->hot.pScreen != pWin->drawable.pScreen) {
pSprite->hot.pScreen = pWin->drawable.pScreen;
pSprite->hot.x = pSprite->hot.y = 0;
}
}
- lims = *RegionExtents(&pWin->borderSize);
- if (pSprite->hot.x < lims.x1)
- pSprite->hot.x = lims.x1;
- else if (pSprite->hot.x >= lims.x2)
- pSprite->hot.x = lims.x2 - 1;
- if (pSprite->hot.y < lims.y1)
- pSprite->hot.y = lims.y1;
- else if (pSprite->hot.y >= lims.y2)
- pSprite->hot.y = lims.y2 - 1;
+ lims = *RegionExtents(&pWin->borderSize);
+ if (pSprite->hot.x < lims.x1)
+ pSprite->hot.x = lims.x1;
+ else if (pSprite->hot.x >= lims.x2)
+ pSprite->hot.x = lims.x2 - 1;
+ if (pSprite->hot.y < lims.y1)
+ pSprite->hot.y = lims.y1;
+ else if (pSprite->hot.y >= lims.y2)
+ pSprite->hot.y = lims.y2 - 1;
#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- {
+ if (!noPanoramiXExtension) {
if (RegionNumRects(&pSprite->Reg2) > 1)
reg = &pSprite->Reg2;
- } else
+ }
+ else
#endif
{
if (wBoundingShape(pWin))
@@ -889,40 +861,38 @@ CheckVirtualMotion(
if (reg)
ConfineToShape(pDev, reg, &pSprite->hot.x, &pSprite->hot.y);
- if (qe && ev)
- {
- qe->pScreen = pSprite->hot.pScreen;
- ev->root_x = pSprite->hot.x;
- ev->root_y = pSprite->hot.y;
- }
+ if (qe && ev) {
+ qe->pScreen = pSprite->hot.pScreen;
+ ev->root_x = pSprite->hot.x;
+ ev->root_y = pSprite->hot.y;
+ }
}
#ifdef PANORAMIX
- if (noPanoramiXExtension) /* No typo. Only set the root win if disabled */
+ if (noPanoramiXExtension) /* No typo. Only set the root win if disabled */
#endif
RootWindow(pDev->spriteInfo->sprite) = pSprite->hot.pScreen->root;
}
static void
-ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bool confineToScreen)
+ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents,
+ Bool confineToScreen)
{
SpritePtr pSprite = pDev->spriteInfo->sprite;
- if (syncEvents.playingEvents)
- {
- CheckVirtualMotion(pDev, (QdEventPtr)NULL, pWin);
- SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y);
+ if (syncEvents.playingEvents) {
+ CheckVirtualMotion(pDev, (QdEventPtr) NULL, pWin);
+ SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y);
}
- else
- {
+ else {
#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
+ if (!noPanoramiXExtension) {
XineramaConfineCursorToWindow(pDev, pWin, generateEvents);
return;
}
#endif
- pSprite->hotLimits = *RegionExtents(&pWin->borderSize);
- pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize
- : NullRegion;
+ pSprite->hotLimits = *RegionExtents(&pWin->borderSize);
+ pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize
+ : NullRegion;
CheckPhysLimits(pDev, pSprite->current, generateEvents,
confineToScreen, pWin->drawable.pScreen);
}
@@ -947,12 +917,11 @@ ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
SpritePtr pSprite = pDev->spriteInfo->sprite;
ScreenPtr pScreen;
- if (cursor != pSprite->current)
- {
- if ((pSprite->current->bits->xhot != cursor->bits->xhot) ||
- (pSprite->current->bits->yhot != cursor->bits->yhot))
- CheckPhysLimits(pDev, cursor, FALSE, pSprite->confined,
- (ScreenPtr)NULL);
+ if (cursor != pSprite->current) {
+ if ((pSprite->current->bits->xhot != cursor->bits->xhot) ||
+ (pSprite->current->bits->yhot != cursor->bits->yhot))
+ CheckPhysLimits(pDev, cursor, FALSE, pSprite->confined,
+ (ScreenPtr) NULL);
#ifdef PANORAMIX
/* XXX: is this really necessary?? (whot) */
if (!noPanoramiXExtension)
@@ -961,10 +930,10 @@ ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
#endif
pScreen = pSprite->hotPhys.pScreen;
- (*pScreen->DisplayCursor)(pDev, pScreen, cursor);
- FreeCursor(pSprite->current, (Cursor)0);
- pSprite->current = cursor;
- pSprite->current->refcnt++;
+ (*pScreen->DisplayCursor) (pDev, pScreen, cursor);
+ FreeCursor(pSprite->current, (Cursor) 0);
+ pSprite->current = cursor;
+ pSprite->current->refcnt++;
}
}
@@ -975,7 +944,8 @@ Bool
IsParent(WindowPtr a, WindowPtr b)
{
for (b = b->parent; b; b = b->parent)
- if (b == a) return TRUE;
+ if (b == a)
+ return TRUE;
return FALSE;
}
@@ -989,42 +959,36 @@ PostNewCursor(DeviceIntPtr pDev)
{
WindowPtr win;
GrabPtr grab = pDev->deviceGrab.grab;
- SpritePtr pSprite = pDev->spriteInfo->sprite;
- CursorPtr pCursor;
+ SpritePtr pSprite = pDev->spriteInfo->sprite;
+ CursorPtr pCursor;
if (syncEvents.playingEvents)
- return;
- if (grab)
- {
- if (grab->cursor)
- {
- ChangeToCursor(pDev, grab->cursor);
- return;
- }
- if (IsParent(grab->window, pSprite->win))
- win = pSprite->win;
- else
- win = grab->window;
+ return;
+ if (grab) {
+ if (grab->cursor) {
+ ChangeToCursor(pDev, grab->cursor);
+ return;
+ }
+ if (IsParent(grab->window, pSprite->win))
+ win = pSprite->win;
+ else
+ win = grab->window;
}
else
- win = pSprite->win;
- for (; win; win = win->parent)
- {
- if (win->optional)
- {
+ win = pSprite->win;
+ for (; win; win = win->parent) {
+ if (win->optional) {
pCursor = WindowGetDeviceCursor(win, pDev);
if (!pCursor && win->optional->cursor != NullCursor)
pCursor = win->optional->cursor;
- if (pCursor)
- {
+ if (pCursor) {
ChangeToCursor(pDev, pCursor);
return;
}
- }
+ }
}
}
-
/**
* @param dev device which you want to know its current root window
* @return root window where dev's sprite is located
@@ -1060,6 +1024,7 @@ void
GetSpritePosition(DeviceIntPtr pDev, int *px, int *py)
{
SpritePtr pSprite = pDev->spriteInfo->sprite;
+
*px = pSprite->hotPhys.x;
*py = pSprite->hotPhys.y;
}
@@ -1068,15 +1033,16 @@ GetSpritePosition(DeviceIntPtr pDev, int *px, int *py)
int
XineramaGetCursorScreen(DeviceIntPtr pDev)
{
- if(!noPanoramiXExtension) {
- return pDev->spriteInfo->sprite->screen->myNum;
- } else {
- return 0;
+ if (!noPanoramiXExtension) {
+ return pDev->spriteInfo->sprite->screen->myNum;
+ }
+ else {
+ return 0;
}
}
-#endif /* PANORAMIX */
+#endif /* PANORAMIX */
-#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
+#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
static void
MonthChangedOrBadTime(InternalEvent *ev)
@@ -1086,25 +1052,26 @@ MonthChangedOrBadTime(InternalEvent *ev)
* backwards when it should not. Here we ensure a decent time.
*/
if ((currentTime.milliseconds - ev->any.time) > TIMESLOP)
- currentTime.months++;
+ currentTime.months++;
else
ev->any.time = currentTime.milliseconds;
}
static void
-NoticeTime(InternalEvent *ev)
+NoticeTime(InternalEvent *ev, DeviceIntPtr dev)
{
if (ev->any.time < currentTime.milliseconds)
MonthChangedOrBadTime(ev);
currentTime.milliseconds = ev->any.time;
- lastDeviceEventTime = currentTime;
+ lastDeviceEventTime[XIAllDevices] = currentTime;
+ lastDeviceEventTime[dev->id] = currentTime;
}
void
-NoticeEventTime(InternalEvent *ev)
+NoticeEventTime(InternalEvent *ev, DeviceIntPtr dev)
{
if (!syncEvents.playingEvents)
- NoticeTime(ev);
+ NoticeTime(ev, dev);
}
/**************************************************************************
@@ -1119,78 +1086,76 @@ NoticeEventTime(InternalEvent *ev)
void
EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
{
- QdEventPtr tail = NULL;
- QdEventPtr qe;
- SpritePtr pSprite = device->spriteInfo->sprite;
- int eventlen;
+ QdEventPtr tail = NULL;
+ QdEventPtr qe;
+ SpritePtr pSprite = device->spriteInfo->sprite;
+ int eventlen;
DeviceEvent *event = &ev->device_event;
if (!xorg_list_is_empty(&syncEvents.pending))
tail = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next);
- NoticeTime((InternalEvent*)event);
+ NoticeTime((InternalEvent *)event, device);
/* Fix for key repeating bug. */
if (device->key != NULL && device->key->xkbInfo != NULL &&
event->type == ET_KeyRelease)
- AccessXCancelRepeatKey(device->key->xkbInfo, event->detail.key);
+ AccessXCancelRepeatKey(device->key->xkbInfo, event->detail.key);
+
+ if (DeviceEventCallback) {
+ DeviceEventInfoRec eventinfo;
+
+ /* The RECORD spec says that the root window field of motion events
+ * must be valid. At this point, it hasn't been filled in yet, so
+ * we do it here. The long expression below is necessary to get
+ * the current root window; the apparently reasonable alternative
+ * GetCurrentRootWindow()->drawable.id doesn't give you the right
+ * answer on the first motion event after a screen change because
+ * the data that GetCurrentRootWindow relies on hasn't been
+ * updated yet.
+ */
+ if (ev->any.type == ET_Motion)
+ ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id;
- if (DeviceEventCallback)
- {
- DeviceEventInfoRec eventinfo;
-
- /* The RECORD spec says that the root window field of motion events
- * must be valid. At this point, it hasn't been filled in yet, so
- * we do it here. The long expression below is necessary to get
- * the current root window; the apparently reasonable alternative
- * GetCurrentRootWindow()->drawable.id doesn't give you the right
- * answer on the first motion event after a screen change because
- * the data that GetCurrentRootWindow relies on hasn't been
- * updated yet.
- */
- if (ev->any.type == ET_Motion)
- ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id;
-
- eventinfo.event = ev;
- eventinfo.device = device;
- CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
- }
-
- if (event->type == ET_Motion)
- {
+ eventinfo.event = ev;
+ eventinfo.device = device;
+ CallCallbacks(&DeviceEventCallback, (pointer) &eventinfo);
+ }
+
+ if (event->type == ET_Motion) {
#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
- event->root_x += pSprite->screen->x - screenInfo.screens[0]->x;
- event->root_y += pSprite->screen->y - screenInfo.screens[0]->y;
- }
+ if (!noPanoramiXExtension) {
+ event->root_x += pSprite->screen->x - screenInfo.screens[0]->x;
+ event->root_y += pSprite->screen->y - screenInfo.screens[0]->y;
+ }
#endif
- pSprite->hotPhys.x = event->root_x;
- pSprite->hotPhys.y = event->root_y;
- /* do motion compression, but not if from different devices */
- if (tail &&
- (tail->event->any.type == ET_Motion) &&
+ pSprite->hotPhys.x = event->root_x;
+ pSprite->hotPhys.y = event->root_y;
+ /* do motion compression, but not if from different devices */
+ if (tail &&
+ (tail->event->any.type == ET_Motion) &&
(tail->device == device) &&
- (tail->pScreen == pSprite->hotPhys.pScreen))
- {
+ (tail->pScreen == pSprite->hotPhys.pScreen)) {
DeviceEvent *tailev = &tail->event->device_event;
- tailev->root_x = pSprite->hotPhys.x;
- tailev->root_y = pSprite->hotPhys.y;
- tailev->time = event->time;
- tail->months = currentTime.months;
- return;
- }
+
+ tailev->root_x = pSprite->hotPhys.x;
+ tailev->root_y = pSprite->hotPhys.y;
+ tailev->time = event->time;
+ tail->months = currentTime.months;
+ return;
+ }
}
eventlen = event->length;
qe = malloc(sizeof(QdEventRec) + eventlen);
if (!qe)
- return;
+ return;
xorg_list_init(&qe->next);
qe->device = device;
qe->pScreen = pSprite->hotPhys.pScreen;
qe->months = currentTime.months;
- qe->event = (InternalEvent *)(qe + 1);
+ qe->event = (InternalEvent *) (qe + 1);
memcpy(qe->event, event, eventlen);
xorg_list_append(&qe->next, &syncEvents.pending);
}
@@ -1212,53 +1177,52 @@ PlayReleasedEvents(void)
DeviceIntPtr dev;
DeviceIntPtr pDev;
-restart:
+ restart:
xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) {
- if (!qe->device->deviceGrab.sync.frozen)
- {
- xorg_list_del(&qe->next);
- pDev = qe->device;
- if (qe->event->any.type == ET_Motion)
- CheckVirtualMotion(pDev, qe, NullWindow);
- syncEvents.time.months = qe->months;
+ if (!qe->device->deviceGrab.sync.frozen) {
+ xorg_list_del(&qe->next);
+ pDev = qe->device;
+ if (qe->event->any.type == ET_Motion)
+ CheckVirtualMotion(pDev, qe, NullWindow);
+ syncEvents.time.months = qe->months;
syncEvents.time.milliseconds = qe->event->any.time;
#ifdef PANORAMIX
- /* Translate back to the sprite screen since processInputProc
- will translate from sprite screen to screen 0 upon reentry
- to the DIX layer */
- if(!noPanoramiXExtension) {
+ /* Translate back to the sprite screen since processInputProc
+ will translate from sprite screen to screen 0 upon reentry
+ to the DIX layer */
+ if (!noPanoramiXExtension) {
DeviceEvent *ev = &qe->event->device_event;
- switch(ev->type)
- {
- case ET_Motion:
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_KeyPress:
- case ET_KeyRelease:
- case ET_ProximityIn:
- case ET_ProximityOut:
- ev->root_x += screenInfo.screens[0]->x -
- pDev->spriteInfo->sprite->screen->x;
- ev->root_y += screenInfo.screens[0]->y -
- pDev->spriteInfo->sprite->screen->y;
- break;
- default:
- break;
+
+ switch (ev->type) {
+ case ET_Motion:
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ ev->root_x += screenInfo.screens[0]->x -
+ pDev->spriteInfo->sprite->screen->x;
+ ev->root_y += screenInfo.screens[0]->y -
+ pDev->spriteInfo->sprite->screen->y;
+ break;
+ default:
+ break;
}
- }
+ }
#endif
- (*qe->device->public.processInputProc)(qe->event, qe->device);
- free(qe);
- for (dev = inputInfo.devices; dev && dev->deviceGrab.sync.frozen; dev = dev->next)
- ;
- if (!dev)
- break;
-
- /* Playing the event may have unfrozen another device. */
- /* So to play it safe, restart at the head of the queue */
- goto restart;
- }
+ (*qe->device->public.processInputProc) (qe->event, qe->device);
+ free(qe);
+ for (dev = inputInfo.devices; dev && dev->deviceGrab.sync.frozen;
+ dev = dev->next);
+ if (!dev)
+ break;
+
+ /* Playing the event may have unfrozen another device. */
+ /* So to play it safe, restart at the head of the queue */
+ goto restart;
+ }
}
}
@@ -1275,9 +1239,9 @@ FreezeThaw(DeviceIntPtr dev, Bool frozen)
{
dev->deviceGrab.sync.frozen = frozen;
if (frozen)
- dev->public.processInputProc = dev->public.enqueueInputProc;
+ dev->public.processInputProc = dev->public.enqueueInputProc;
else
- dev->public.processInputProc = dev->public.realInputProc;
+ dev->public.processInputProc = dev->public.realInputProc;
}
/**
@@ -1297,66 +1261,64 @@ ComputeFreezes(void)
DeviceIntPtr dev;
for (dev = inputInfo.devices; dev; dev = dev->next)
- FreezeThaw(dev, dev->deviceGrab.sync.other ||
- (dev->deviceGrab.sync.state >= FROZEN));
+ FreezeThaw(dev, dev->deviceGrab.sync.other ||
+ (dev->deviceGrab.sync.state >= FROZEN));
if (syncEvents.playingEvents ||
(!replayDev && xorg_list_is_empty(&syncEvents.pending)))
- return;
+ return;
syncEvents.playingEvents = TRUE;
- if (replayDev)
- {
- DeviceEvent* event = replayDev->deviceGrab.sync.event;
+ if (replayDev) {
+ DeviceEvent *event = replayDev->deviceGrab.sync.event;
- syncEvents.replayDev = (DeviceIntPtr)NULL;
+ syncEvents.replayDev = (DeviceIntPtr) NULL;
w = XYToWindow(replayDev->spriteInfo->sprite,
event->root_x, event->root_y);
- if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin))
- {
- if (IsTouchEvent((InternalEvent*)event))
- {
+ if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin)) {
+ if (IsTouchEvent((InternalEvent *) event)) {
InternalEvent *events = InitEventList(GetMaximumEventsNum());
int i, nev;
- TouchPointInfoPtr ti = TouchFindByClientID(replayDev, event->touchid);
+ TouchPointInfoPtr ti =
+ TouchFindByClientID(replayDev, event->touchid);
BUG_WARN(!ti);
- nev = GetTouchOwnershipEvents(events, replayDev, ti, XIRejectTouch, ti->listeners[0].listener, 0);
+ nev =
+ GetTouchOwnershipEvents(events, replayDev, ti,
+ XIRejectTouch,
+ ti->listeners[0].listener, 0);
for (i = 0; i < nev; i++)
mieqProcessDeviceEvent(replayDev, events + i, NULL);
ProcessInputEvents();
- } else if (replayDev->focus && !IsPointerEvent((InternalEvent*)event))
- DeliverFocusedEvent(replayDev, (InternalEvent*)event, w);
+ }
+ else if (replayDev->focus &&
+ !IsPointerEvent((InternalEvent *) event))
+ DeliverFocusedEvent(replayDev, (InternalEvent *) event, w);
else
- DeliverDeviceEvents(w, (InternalEvent*)event, NullGrab,
+ DeliverDeviceEvents(w, (InternalEvent *) event, NullGrab,
NullWindow, replayDev);
}
}
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (!dev->deviceGrab.sync.frozen)
- {
- PlayReleasedEvents();
- break;
- }
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (!dev->deviceGrab.sync.frozen) {
+ PlayReleasedEvents();
+ break;
+ }
}
syncEvents.playingEvents = FALSE;
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (DevHasCursor(dev))
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (DevHasCursor(dev)) {
/* the following may have been skipped during replay,
- so do it now */
- if ((grab = dev->deviceGrab.grab) && grab->confineTo)
- {
+ so do it now */
+ if ((grab = dev->deviceGrab.grab) && grab->confineTo) {
if (grab->confineTo->drawable.pScreen !=
- dev->spriteInfo->sprite->hotPhys.pScreen)
+ dev->spriteInfo->sprite->hotPhys.pScreen)
dev->spriteInfo->sprite->hotPhys.x =
dev->spriteInfo->sprite->hotPhys.y = 0;
ConfineCursorToWindow(dev, grab->confineTo, TRUE, TRUE);
}
else
ConfineCursorToWindow(dev,
- dev->spriteInfo->sprite->hotPhys.pScreen->root,
- TRUE, FALSE);
+ dev->spriteInfo->sprite->hotPhys.pScreen->
+ root, TRUE, FALSE);
PostNewCursor(dev);
}
}
@@ -1364,29 +1326,28 @@ ComputeFreezes(void)
#ifdef RANDR
void
-ScreenRestructured (ScreenPtr pScreen)
+ScreenRestructured(ScreenPtr pScreen)
{
GrabPtr grab;
DeviceIntPtr pDev;
- for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (!IsFloating(pDev) && !DevHasCursor(pDev))
continue;
/* GrabDevice doesn't have a confineTo field, so we don't need to
* worry about it. */
- if ((grab = pDev->deviceGrab.grab) && grab->confineTo)
- {
+ if ((grab = pDev->deviceGrab.grab) && grab->confineTo) {
if (grab->confineTo->drawable.pScreen
- != pDev->spriteInfo->sprite->hotPhys.pScreen)
- pDev->spriteInfo->sprite->hotPhys.x = pDev->spriteInfo->sprite->hotPhys.y = 0;
+ != pDev->spriteInfo->sprite->hotPhys.pScreen)
+ pDev->spriteInfo->sprite->hotPhys.x =
+ pDev->spriteInfo->sprite->hotPhys.y = 0;
ConfineCursorToWindow(pDev, grab->confineTo, TRUE, TRUE);
}
else
ConfineCursorToWindow(pDev,
- pDev->spriteInfo->sprite->hotPhys.pScreen->root,
- TRUE, FALSE);
+ pDev->spriteInfo->sprite->hotPhys.pScreen->
+ root, TRUE, FALSE);
}
}
#endif
@@ -1398,26 +1359,23 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
DeviceIntPtr dev;
if (thisMode == GrabModeSync)
- thisDev->deviceGrab.sync.state = FROZEN_NO_EVENT;
- else
- { /* free both if same client owns both */
- thisDev->deviceGrab.sync.state = THAWED;
- if (thisDev->deviceGrab.sync.other &&
- (CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) ==
- CLIENT_BITS(grab->resource)))
- thisDev->deviceGrab.sync.other = NullGrab;
+ thisDev->deviceGrab.sync.state = FROZEN_NO_EVENT;
+ else { /* free both if same client owns both */
+ thisDev->deviceGrab.sync.state = THAWED;
+ if (thisDev->deviceGrab.sync.other &&
+ (CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) ==
+ CLIENT_BITS(grab->resource)))
+ thisDev->deviceGrab.sync.other = NullGrab;
}
- if (IsMaster(thisDev))
- {
+ if (IsMaster(thisDev)) {
dev = GetPairedDevice(thisDev);
if (otherMode == GrabModeSync)
dev->deviceGrab.sync.other = grab;
- else
- { /* free both if same client owns both */
+ else { /* free both if same client owns both */
if (dev->deviceGrab.sync.other &&
- (CLIENT_BITS(dev->deviceGrab.sync.other->resource) ==
- CLIENT_BITS(grab->resource)))
+ (CLIENT_BITS(dev->deviceGrab.sync.other->resource) ==
+ CLIENT_BITS(grab->resource)))
dev->deviceGrab.sync.other = NullGrab;
}
}
@@ -1454,10 +1412,9 @@ ReattachToOldMaster(DeviceIntPtr dev)
dixLookupDevice(&master, dev->saved_master_id, serverClient, DixUseAccess);
- if (master)
- {
+ if (master) {
AttachDevice(serverClient, dev, master);
- dev->saved_master_id = 0;
+ dev->saved_master_id = 0;
}
}
@@ -1482,8 +1439,7 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
{
GrabInfoPtr grabinfo = &mouse->deviceGrab;
WindowPtr oldWin = (grabinfo->grab) ?
- grabinfo->grab->window
- : mouse->spriteInfo->sprite->win;
+ grabinfo->grab->window : mouse->spriteInfo->sprite->win;
Bool isPassive = autoGrab & ~ImplicitGrabMask;
/* slave devices need to float for the duration of the grab. */
@@ -1491,28 +1447,28 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
!(autoGrab & ImplicitGrabMask) && !IsMaster(mouse))
DetachFromMaster(mouse);
- if (grab->confineTo)
- {
- if (grab->confineTo->drawable.pScreen
- != mouse->spriteInfo->sprite->hotPhys.pScreen)
- mouse->spriteInfo->sprite->hotPhys.x =
+ if (grab->confineTo) {
+ if (grab->confineTo->drawable.pScreen
+ != mouse->spriteInfo->sprite->hotPhys.pScreen)
+ mouse->spriteInfo->sprite->hotPhys.x =
mouse->spriteInfo->sprite->hotPhys.y = 0;
- ConfineCursorToWindow(mouse, grab->confineTo, FALSE, TRUE);
+ ConfineCursorToWindow(mouse, grab->confineTo, FALSE, TRUE);
}
DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab);
mouse->valuator->motionHintWindow = NullWindow;
if (syncEvents.playingEvents)
grabinfo->grabTime = syncEvents.time;
else
- grabinfo->grabTime = time;
+ grabinfo->grabTime = time;
if (grab->cursor)
- grab->cursor->refcnt++;
+ grab->cursor->refcnt++;
CopyGrab(grabinfo->activeGrab, grab);
grabinfo->grab = grabinfo->activeGrab;
grabinfo->fromPassiveGrab = isPassive;
grabinfo->implicitGrab = autoGrab & ImplicitGrabMask;
PostNewCursor(mouse);
- CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
+ CheckGrabForSyncs(mouse, (Bool) grab->pointerMode,
+ (Bool) grab->keyboardMode);
}
/**
@@ -1535,18 +1491,17 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
mouse->deviceGrab.sync.state = NOT_GRABBED;
mouse->deviceGrab.fromPassiveGrab = FALSE;
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (dev->deviceGrab.sync.other == grab)
- dev->deviceGrab.sync.other = NullGrab;
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (dev->deviceGrab.sync.other == grab)
+ dev->deviceGrab.sync.other = NullGrab;
}
DoEnterLeaveEvents(mouse, mouse->id, grab->window,
mouse->spriteInfo->sprite->win, NotifyUngrab);
if (grab->confineTo)
- ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE);
+ ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE);
PostNewCursor(mouse);
if (grab->cursor)
- FreeCursor(grab->cursor, (Cursor)0);
+ FreeCursor(grab->cursor, (Cursor) 0);
if (!wasImplicit && grab->grabtype == XI2)
ReattachToOldMaster(mouse);
@@ -1560,37 +1515,38 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
* Extension devices have ActivateKeyboardGrab() set as their grabbing proc.
*/
void
-ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive)
+ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
+ Bool passive)
{
GrabInfoPtr grabinfo = &keybd->deviceGrab;
WindowPtr oldWin;
/* slave devices need to float for the duration of the grab. */
if (grab->grabtype == XI2 &&
- !(passive & ImplicitGrabMask) &&
- !IsMaster(keybd))
+ !(passive & ImplicitGrabMask) && !IsMaster(keybd))
DetachFromMaster(keybd);
if (grabinfo->grab)
- oldWin = grabinfo->grab->window;
+ oldWin = grabinfo->grab->window;
else if (keybd->focus)
- oldWin = keybd->focus->win;
+ oldWin = keybd->focus->win;
else
- oldWin = keybd->spriteInfo->sprite->win;
+ oldWin = keybd->spriteInfo->sprite->win;
if (oldWin == FollowKeyboardWin)
- oldWin = keybd->focus->win;
+ oldWin = keybd->focus->win;
if (keybd->valuator)
- keybd->valuator->motionHintWindow = NullWindow;
+ keybd->valuator->motionHintWindow = NullWindow;
DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
if (syncEvents.playingEvents)
- grabinfo->grabTime = syncEvents.time;
+ grabinfo->grabTime = syncEvents.time;
else
- grabinfo->grabTime = time;
+ grabinfo->grabTime = time;
CopyGrab(grabinfo->activeGrab, grab);
grabinfo->grab = grabinfo->activeGrab;
grabinfo->fromPassiveGrab = passive;
grabinfo->implicitGrab = passive & ImplicitGrabMask;
- CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
+ CheckGrabForSyncs(keybd, (Bool) grab->keyboardMode,
+ (Bool) grab->pointerMode);
}
/**
@@ -1602,22 +1558,21 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
GrabPtr grab = keybd->deviceGrab.grab;
DeviceIntPtr dev;
WindowPtr focusWin = keybd->focus ? keybd->focus->win
- : keybd->spriteInfo->sprite->win;
+ : keybd->spriteInfo->sprite->win;
Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab &&
keybd->deviceGrab.implicitGrab);
if (focusWin == FollowKeyboardWin)
- focusWin = inputInfo.keyboard->focus->win;
+ focusWin = inputInfo.keyboard->focus->win;
if (keybd->valuator)
- keybd->valuator->motionHintWindow = NullWindow;
+ keybd->valuator->motionHintWindow = NullWindow;
keybd->deviceGrab.grab = NullGrab;
keybd->deviceGrab.sync.state = NOT_GRABBED;
keybd->deviceGrab.fromPassiveGrab = FALSE;
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (dev->deviceGrab.sync.other == grab)
- dev->deviceGrab.sync.other = NullGrab;
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (dev->deviceGrab.sync.other == grab)
+ dev->deviceGrab.sync.other = NullGrab;
}
DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
@@ -1628,124 +1583,106 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
}
void
-AllowSome(ClientPtr client,
- TimeStamp time,
- DeviceIntPtr thisDev,
- int newState)
+AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
{
Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced;
TimeStamp grabTime;
DeviceIntPtr dev;
- GrabInfoPtr devgrabinfo,
- grabinfo = &thisDev->deviceGrab;
+ GrabInfoPtr devgrabinfo, grabinfo = &thisDev->deviceGrab;
thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client);
thisSynced = FALSE;
otherGrabbed = FALSE;
othersFrozen = FALSE;
grabTime = grabinfo->grabTime;
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
devgrabinfo = &dev->deviceGrab;
- if (dev == thisDev)
- continue;
- if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
- {
- if (!(thisGrabbed || otherGrabbed) ||
- (CompareTimeStamps(devgrabinfo->grabTime, grabTime) == LATER))
- grabTime = devgrabinfo->grabTime;
- otherGrabbed = TRUE;
- if (grabinfo->sync.other == devgrabinfo->grab)
- thisSynced = TRUE;
- if (devgrabinfo->sync.state >= FROZEN)
- othersFrozen = TRUE;
- }
+ if (dev == thisDev)
+ continue;
+ if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) {
+ if (!(thisGrabbed || otherGrabbed) ||
+ (CompareTimeStamps(devgrabinfo->grabTime, grabTime) == LATER))
+ grabTime = devgrabinfo->grabTime;
+ otherGrabbed = TRUE;
+ if (grabinfo->sync.other == devgrabinfo->grab)
+ thisSynced = TRUE;
+ if (devgrabinfo->sync.state >= FROZEN)
+ othersFrozen = TRUE;
+ }
}
if (!((thisGrabbed && grabinfo->sync.state >= FROZEN) || thisSynced))
- return;
+ return;
if ((CompareTimeStamps(time, currentTime) == LATER) ||
- (CompareTimeStamps(time, grabTime) == EARLIER))
- return;
- switch (newState)
- {
- case THAWED: /* Async */
- if (thisGrabbed)
- grabinfo->sync.state = THAWED;
- if (thisSynced)
- grabinfo->sync.other = NullGrab;
- ComputeFreezes();
- break;
- case FREEZE_NEXT_EVENT: /* Sync */
- if (thisGrabbed)
- {
- grabinfo->sync.state = FREEZE_NEXT_EVENT;
- if (thisSynced)
- grabinfo->sync.other = NullGrab;
- ComputeFreezes();
- }
- break;
- case THAWED_BOTH: /* AsyncBoth */
- if (othersFrozen)
- {
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- devgrabinfo = &dev->deviceGrab;
- if (devgrabinfo->grab
- && SameClient(devgrabinfo->grab, client))
- devgrabinfo->sync.state = THAWED;
- if (devgrabinfo->sync.other &&
- SameClient(devgrabinfo->sync.other, client))
- devgrabinfo->sync.other = NullGrab;
- }
- ComputeFreezes();
- }
- break;
- case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */
- if (othersFrozen)
- {
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- devgrabinfo = &dev->deviceGrab;
- if (devgrabinfo->grab
- && SameClient(devgrabinfo->grab, client))
- devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT;
- if (devgrabinfo->sync.other
- && SameClient(devgrabinfo->sync.other, client))
- devgrabinfo->sync.other = NullGrab;
- }
- ComputeFreezes();
- }
- break;
- case NOT_GRABBED: /* Replay */
- if (thisGrabbed && grabinfo->sync.state == FROZEN_WITH_EVENT)
- {
- if (thisSynced)
- grabinfo->sync.other = NullGrab;
- syncEvents.replayDev = thisDev;
- syncEvents.replayWin = grabinfo->grab->window;
- (*grabinfo->DeactivateGrab)(thisDev);
- syncEvents.replayDev = (DeviceIntPtr)NULL;
- }
- break;
- case THAW_OTHERS: /* AsyncOthers */
- if (othersFrozen)
- {
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (dev == thisDev)
- continue;
- devgrabinfo = &dev->deviceGrab;
- if (devgrabinfo->grab
- && SameClient(devgrabinfo->grab, client))
- devgrabinfo->sync.state = THAWED;
- if (devgrabinfo->sync.other
- && SameClient(devgrabinfo->sync.other, client))
- devgrabinfo->sync.other = NullGrab;
- }
- ComputeFreezes();
- }
- break;
+ (CompareTimeStamps(time, grabTime) == EARLIER))
+ return;
+ switch (newState) {
+ case THAWED: /* Async */
+ if (thisGrabbed)
+ grabinfo->sync.state = THAWED;
+ if (thisSynced)
+ grabinfo->sync.other = NullGrab;
+ ComputeFreezes();
+ break;
+ case FREEZE_NEXT_EVENT: /* Sync */
+ if (thisGrabbed) {
+ grabinfo->sync.state = FREEZE_NEXT_EVENT;
+ if (thisSynced)
+ grabinfo->sync.other = NullGrab;
+ ComputeFreezes();
+ }
+ break;
+ case THAWED_BOTH: /* AsyncBoth */
+ if (othersFrozen) {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ devgrabinfo = &dev->deviceGrab;
+ if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
+ devgrabinfo->sync.state = THAWED;
+ if (devgrabinfo->sync.other &&
+ SameClient(devgrabinfo->sync.other, client))
+ devgrabinfo->sync.other = NullGrab;
+ }
+ ComputeFreezes();
+ }
+ break;
+ case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */
+ if (othersFrozen) {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ devgrabinfo = &dev->deviceGrab;
+ if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
+ devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT;
+ if (devgrabinfo->sync.other
+ && SameClient(devgrabinfo->sync.other, client))
+ devgrabinfo->sync.other = NullGrab;
+ }
+ ComputeFreezes();
+ }
+ break;
+ case NOT_GRABBED: /* Replay */
+ if (thisGrabbed && grabinfo->sync.state == FROZEN_WITH_EVENT) {
+ if (thisSynced)
+ grabinfo->sync.other = NullGrab;
+ syncEvents.replayDev = thisDev;
+ syncEvents.replayWin = grabinfo->grab->window;
+ (*grabinfo->DeactivateGrab) (thisDev);
+ syncEvents.replayDev = (DeviceIntPtr) NULL;
+ }
+ break;
+ case THAW_OTHERS: /* AsyncOthers */
+ if (othersFrozen) {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (dev == thisDev)
+ continue;
+ devgrabinfo = &dev->deviceGrab;
+ if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
+ devgrabinfo->sync.state = THAWED;
+ if (devgrabinfo->sync.other
+ && SameClient(devgrabinfo->sync.other, client))
+ devgrabinfo->sync.other = NullGrab;
+ }
+ ComputeFreezes();
+ }
+ break;
}
}
@@ -1757,9 +1694,10 @@ AllowSome(ClientPtr client,
int
ProcAllowEvents(ClientPtr client)
{
- TimeStamp time;
- DeviceIntPtr mouse = NULL;
- DeviceIntPtr keybd = NULL;
+ TimeStamp time;
+ DeviceIntPtr mouse = NULL;
+ DeviceIntPtr keybd = NULL;
+
REQUEST(xAllowEventsReq);
REQUEST_SIZE_MATCH(xAllowEventsReq);
@@ -1768,35 +1706,34 @@ ProcAllowEvents(ClientPtr client)
mouse = PickPointer(client);
keybd = PickKeyboard(client);
- switch (stuff->mode)
- {
- case ReplayPointer:
- AllowSome(client, time, mouse, NOT_GRABBED);
- break;
- case SyncPointer:
- AllowSome(client, time, mouse, FREEZE_NEXT_EVENT);
- break;
- case AsyncPointer:
- AllowSome(client, time, mouse, THAWED);
- break;
- case ReplayKeyboard:
- AllowSome(client, time, keybd, NOT_GRABBED);
- break;
- case SyncKeyboard:
- AllowSome(client, time, keybd, FREEZE_NEXT_EVENT);
- break;
- case AsyncKeyboard:
- AllowSome(client, time, keybd, THAWED);
- break;
- case SyncBoth:
- AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT);
- break;
- case AsyncBoth:
- AllowSome(client, time, keybd, THAWED_BOTH);
- break;
- default:
- client->errorValue = stuff->mode;
- return BadValue;
+ switch (stuff->mode) {
+ case ReplayPointer:
+ AllowSome(client, time, mouse, NOT_GRABBED);
+ break;
+ case SyncPointer:
+ AllowSome(client, time, mouse, FREEZE_NEXT_EVENT);
+ break;
+ case AsyncPointer:
+ AllowSome(client, time, mouse, THAWED);
+ break;
+ case ReplayKeyboard:
+ AllowSome(client, time, keybd, NOT_GRABBED);
+ break;
+ case SyncKeyboard:
+ AllowSome(client, time, keybd, FREEZE_NEXT_EVENT);
+ break;
+ case AsyncKeyboard:
+ AllowSome(client, time, keybd, THAWED);
+ break;
+ case SyncBoth:
+ AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT);
+ break;
+ case AsyncBoth:
+ AllowSome(client, time, keybd, THAWED_BOTH);
+ break;
+ default:
+ client->errorValue = stuff->mode;
+ return BadValue;
}
return Success;
}
@@ -1808,21 +1745,20 @@ void
ReleaseActiveGrabs(ClientPtr client)
{
DeviceIntPtr dev;
- Bool done;
+ Bool done;
/* XXX CloseDownClient should remove passive grabs before
* releasing active grabs.
*/
do {
- done = TRUE;
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
- {
- (*dev->deviceGrab.DeactivateGrab)(dev);
- done = FALSE;
- }
- }
+ done = TRUE;
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (dev->deviceGrab.grab &&
+ SameClient(dev->deviceGrab.grab, client)) {
+ (*dev->deviceGrab.DeactivateGrab) (dev);
+ done = FALSE;
+ }
+ }
} while (!done);
}
@@ -1856,8 +1792,8 @@ ReleaseActiveGrabs(ClientPtr client)
* client.
*/
int
-TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
- int count, Mask mask, Mask filter, GrabPtr grab)
+TryClientEvents(ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
+ int count, Mask mask, Mask filter, GrabPtr grab)
{
int type;
@@ -1875,75 +1811,66 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
return 0;
}
- if (filter != CantBeFiltered && !(mask & filter))
- {
- #ifdef DEBUG_EVENTS
+ if (filter != CantBeFiltered && !(mask & filter)) {
+#ifdef DEBUG_EVENTS
ErrorF(" filtered\n");
- #endif
+#endif
return 0;
}
- if (grab && !SameClient(grab, client))
- {
+ if (grab && !SameClient(grab, client)) {
#ifdef DEBUG_EVENTS
ErrorF(" not delivered due to grab\n");
#endif
- return -1; /* don't send, but notify caller */
+ return -1; /* don't send, but notify caller */
}
type = pEvents->u.u.type;
- if (type == MotionNotify)
- {
- if (mask & PointerMotionHintMask)
- {
+ if (type == MotionNotify) {
+ if (mask & PointerMotionHintMask) {
if (WID(dev->valuator->motionHintWindow) ==
- pEvents->u.keyButtonPointer.event)
- {
+ pEvents->u.keyButtonPointer.event) {
#ifdef DEBUG_EVENTS
ErrorF("[dix] \n");
ErrorF("[dix] motionHintWindow == keyButtonPointer.event\n");
#endif
- return 1; /* don't send, but pretend we did */
+ return 1; /* don't send, but pretend we did */
}
pEvents->u.u.detail = NotifyHint;
}
- else
- {
+ else {
pEvents->u.u.detail = NotifyNormal;
}
}
- else if (type == DeviceMotionNotify)
- {
- if (MaybeSendDeviceMotionNotifyHint((deviceKeyButtonPointer*)pEvents,
+ else if (type == DeviceMotionNotify) {
+ if (MaybeSendDeviceMotionNotifyHint((deviceKeyButtonPointer *) pEvents,
mask) != 0)
return 1;
- } else if (type == KeyPress)
- {
- if (EventIsKeyRepeat(pEvents))
- {
- if (!_XkbWantsDetectableAutoRepeat(client))
- {
+ }
+ else if (type == KeyPress) {
+ if (EventIsKeyRepeat(pEvents)) {
+ if (!_XkbWantsDetectableAutoRepeat(client)) {
xEvent release = *pEvents;
+
release.u.u.type = KeyRelease;
WriteEventsToClient(client, 1, &release);
#ifdef DEBUG_EVENTS
ErrorF(" (plus fake core release for repeat)");
#endif
- } else
- {
+ }
+ else {
#ifdef DEBUG_EVENTS
ErrorF(" (detectable autorepeat for core)");
#endif
}
}
- } else if (type == DeviceKeyPress)
- {
- if (EventIsKeyRepeat(pEvents))
- {
- if (!_XkbWantsDetectableAutoRepeat(client))
- {
- deviceKeyButtonPointer release = *(deviceKeyButtonPointer *)pEvents;
+ }
+ else if (type == DeviceKeyPress) {
+ if (EventIsKeyRepeat(pEvents)) {
+ if (!_XkbWantsDetectableAutoRepeat(client)) {
+ deviceKeyButtonPointer release =
+ *(deviceKeyButtonPointer *) pEvents;
release.type = DeviceKeyRelease;
#ifdef DEBUG_EVENTS
ErrorF(" (plus fake xi1 release for repeat)");
@@ -1958,8 +1885,7 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
}
}
- if (BitIsOn(criticalEvents, type))
- {
+ if (BitIsOn(criticalEvents, type)) {
if (client->smart_priority < SMART_MAX_PRIORITY)
client->smart_priority++;
SetCriticalOutputPending();
@@ -2008,13 +1934,13 @@ ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, WindowPtr win,
/* get the XI and XI2 device mask */
inputMasks = wOtherInputMasks(win);
- tempGrab->deviceMask = (inputMasks) ? inputMasks->inputEvents[dev->id]: 0;
+ tempGrab->deviceMask = (inputMasks) ? inputMasks->inputEvents[dev->id] : 0;
if (inputMasks)
xi2mask_merge(tempGrab->xi2mask, inputMasks->xi2mask);
- (*dev->deviceGrab.ActivateGrab)(dev, tempGrab,
- currentTime, TRUE | ImplicitGrabMask);
+ (*dev->deviceGrab.ActivateGrab) (dev, tempGrab,
+ currentTime, TRUE | ImplicitGrabMask);
FreeGrab(tempGrab);
return TRUE;
}
@@ -2024,22 +1950,21 @@ ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, WindowPtr win,
*/
static enum EventDeliveryState
DeliverToWindowOwner(DeviceIntPtr dev, WindowPtr win,
- xEvent *events, int count, Mask filter,
- GrabPtr grab)
+ xEvent *events, int count, Mask filter, GrabPtr grab)
{
/* if nobody ever wants to see this event, skip some work */
if (filter != CantBeFiltered &&
- !((wOtherEventMasks(win)|win->eventMask) & filter))
+ !((wOtherEventMasks(win) | win->eventMask) & filter))
return EVENT_SKIP;
if (IsInterferingGrab(wClient(win), dev, events))
return EVENT_SKIP;
- if (!XaceHook(XACE_RECEIVE_ACCESS, wClient(win), win, events, count))
- {
+ if (!XaceHook(XACE_RECEIVE_ACCESS, wClient(win), win, events, count)) {
int attempt = TryClientEvents(wClient(win), dev, events,
count, win->eventMask,
filter, grab);
+
if (attempt > 0)
return EVENT_DELIVERED;
if (attempt < 0)
@@ -2049,7 +1974,6 @@ DeliverToWindowOwner(DeviceIntPtr dev, WindowPtr win,
return EVENT_NOT_DELIVERED;
}
-
/**
* Get the list of clients that should be tried for event delivery on the
* given window.
@@ -2059,31 +1983,32 @@ DeliverToWindowOwner(DeviceIntPtr dev, WindowPtr win,
*/
static Bool
GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win,
- xEvent *events, Mask filter, InputClients **clients)
+ xEvent *events, Mask filter, InputClients ** clients)
{
int rc = 0;
if (core_get_type(events) != 0)
- *clients = (InputClients *)wOtherClients(win);
- else if (xi2_get_type(events) != 0)
- {
+ *clients = (InputClients *) wOtherClients(win);
+ else if (xi2_get_type(events) != 0) {
OtherInputMasks *inputMasks = wOtherInputMasks(win);
+
/* Has any client selected for the event? */
if (!WindowXI2MaskIsset(dev, win, events))
goto out;
*clients = inputMasks->inputClients;
- } else {
+ }
+ else {
OtherInputMasks *inputMasks = wOtherInputMasks(win);
+
/* Has any client selected for the event? */
- if (!inputMasks ||
- !(inputMasks->inputEvents[dev->id] & filter))
+ if (!inputMasks || !(inputMasks->inputEvents[dev->id] & filter))
goto out;
*clients = inputMasks->inputClients;
}
rc = 1;
-out:
+ out:
return rc;
}
@@ -2092,7 +2017,7 @@ out:
* accepts it and there is no interfering core grab..
*/
static enum EventDeliveryState
-DeliverEventToInputClients(DeviceIntPtr dev, InputClients *inputclients,
+DeliverEventToInputClients(DeviceIntPtr dev, InputClients * inputclients,
WindowPtr win, xEvent *events,
int count, Mask filter, GrabPtr grab,
ClientPtr *client_return, Mask *mask_return)
@@ -2100,8 +2025,7 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients *inputclients,
int attempt;
enum EventDeliveryState rc = EVENT_NOT_DELIVERED;
- for (; inputclients; inputclients = inputclients->next)
- {
+ for (; inputclients; inputclients = inputclients->next) {
Mask mask;
ClientPtr client = rClient(inputclients);
@@ -2110,21 +2034,19 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients *inputclients,
mask = GetEventMask(dev, events, inputclients);
- if (XaceHook(XACE_RECEIVE_ACCESS, client, win,
- events, count))
- /* do nothing */;
- else if ( (attempt = TryClientEvents(client, dev,
- events, count,
- mask, filter, grab)) )
- {
- if (attempt > 0)
- {
+ if (XaceHook(XACE_RECEIVE_ACCESS, client, win, events, count))
+ /* do nothing */ ;
+ else if ((attempt = TryClientEvents(client, dev,
+ events, count,
+ mask, filter, grab))) {
+ if (attempt > 0) {
rc = EVENT_DELIVERED;
*client_return = client;
*mask_return = mask;
/* Success overrides non-success, so if we've been
* successful on one client, return that */
- } else if (rc == EVENT_NOT_DELIVERED)
+ }
+ else if (rc == EVENT_NOT_DELIVERED)
rc = EVENT_REJECTED;
}
}
@@ -2132,7 +2054,6 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients *inputclients,
return rc;
}
-
/**
* Deliver events to clients registered on the window.
*
@@ -2155,7 +2076,6 @@ DeliverEventToWindowMask(DeviceIntPtr dev, WindowPtr win, xEvent *events,
}
-
/**
* Deliver events to a window. At this point, we do not yet know if the event
* actually needs to be delivered. May activate a grab if the event is a
@@ -2180,77 +2100,73 @@ DeliverEventToWindowMask(DeviceIntPtr dev, WindowPtr win, xEvent *events,
*/
int
DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
- *pEvents, int count, Mask filter, GrabPtr grab)
+ *pEvents, int count, Mask filter, GrabPtr grab)
{
int deliveries = 0, nondeliveries = 0;
ClientPtr client = NullClient;
- Mask deliveryMask = 0; /* If a grab occurs due to a button press, then
- this mask is the mask of the grab. */
+ Mask deliveryMask = 0; /* If a grab occurs due to a button press, then
+ this mask is the mask of the grab. */
int type = pEvents->u.u.type;
/* Deliver to window owner */
- if ((filter == CantBeFiltered) || core_get_type(pEvents) != 0)
- {
+ if ((filter == CantBeFiltered) || core_get_type(pEvents) != 0) {
enum EventDeliveryState rc;
rc = DeliverToWindowOwner(pDev, pWin, pEvents, count, filter, grab);
- switch(rc)
- {
- case EVENT_SKIP:
- return 0;
- case EVENT_REJECTED:
- nondeliveries--;
- break;
- case EVENT_DELIVERED:
- /* We delivered to the owner, with our event mask */
- deliveries++;
- client = wClient(pWin);
- deliveryMask = pWin->eventMask;
- break;
- case EVENT_NOT_DELIVERED:
- break;
+ switch (rc) {
+ case EVENT_SKIP:
+ return 0;
+ case EVENT_REJECTED:
+ nondeliveries--;
+ break;
+ case EVENT_DELIVERED:
+ /* We delivered to the owner, with our event mask */
+ deliveries++;
+ client = wClient(pWin);
+ deliveryMask = pWin->eventMask;
+ break;
+ case EVENT_NOT_DELIVERED:
+ break;
}
}
/* CantBeFiltered means only window owner gets the event */
- if (filter != CantBeFiltered)
- {
+ if (filter != CantBeFiltered) {
enum EventDeliveryState rc;
rc = DeliverEventToWindowMask(pDev, pWin, pEvents, count, filter,
grab, &client, &deliveryMask);
- switch(rc)
- {
- case EVENT_SKIP:
- return 0;
- case EVENT_REJECTED:
- nondeliveries--;
- break;
- case EVENT_DELIVERED:
- deliveries++;
- break;
- case EVENT_NOT_DELIVERED:
- break;
+ switch (rc) {
+ case EVENT_SKIP:
+ return 0;
+ case EVENT_REJECTED:
+ nondeliveries--;
+ break;
+ case EVENT_DELIVERED:
+ deliveries++;
+ break;
+ case EVENT_NOT_DELIVERED:
+ break;
}
}
- if (deliveries)
- {
+ if (deliveries) {
/*
* Note that since core events are delivered first, an implicit grab may
* be activated on a core grab, stopping the XI events.
*/
- if (!grab && ActivateImplicitGrab(pDev, client, pWin, pEvents, deliveryMask))
- /* grab activated */;
+ if (!grab &&
+ ActivateImplicitGrab(pDev, client, pWin, pEvents, deliveryMask))
+ /* grab activated */ ;
else if (type == MotionNotify)
pDev->valuator->motionHintWindow = pWin;
else if (type == DeviceMotionNotify || type == DeviceButtonPress)
- CheckDeviceGrabAndHintWindow (pWin, type,
- (deviceKeyButtonPointer*) pEvents,
- grab, client, deliveryMask);
- return deliveries;
+ CheckDeviceGrabAndHintWindow(pWin, type,
+ (deviceKeyButtonPointer *) pEvents,
+ grab, client, deliveryMask);
+ return deliveries;
}
return nondeliveries;
}
@@ -2273,7 +2189,8 @@ FilterRawEvents(const ClientPtr client, const GrabPtr grab)
if (!grab)
return FALSE;
- client_xi_version = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+ client_xi_version =
+ dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
cmp = version_compare(client_xi_version->major_version,
client_xi_version->minor_version, 2, 0);
@@ -2299,21 +2216,19 @@ DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
int i, rc;
int filter;
- rc = EventToXI2((InternalEvent*)ev, (xEvent**)&xi);
- if (rc != Success)
- {
+ rc = EventToXI2((InternalEvent *) ev, (xEvent **) &xi);
+ if (rc != Success) {
ErrorF("[Xi] %s: XI2 conversion failed in %s (%d)\n",
- __FUNCTION__, device->name, rc);
+ __FUNCTION__, device->name, rc);
return;
}
if (grab)
- DeliverGrabbedEvent((InternalEvent*)ev, device, FALSE);
+ DeliverGrabbedEvent((InternalEvent *) ev, device, FALSE);
filter = GetEventFilter(device, xi);
- for (i = 0; i < screenInfo.numScreens; i++)
- {
+ for (i = 0; i < screenInfo.numScreens; i++) {
WindowPtr root;
InputClients *inputclients;
@@ -2321,10 +2236,9 @@ DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
if (!GetClientsForDelivery(device, root, xi, filter, &inputclients))
continue;
- for (; inputclients; inputclients = inputclients->next)
- {
- ClientPtr c; /* unused */
- Mask m; /* unused */
+ for (; inputclients; inputclients = inputclients->next) {
+ ClientPtr c; /* unused */
+ Mask m; /* unused */
InputClients ic = *inputclients;
/* Because we run through the list manually, copy the actual
@@ -2351,17 +2265,15 @@ DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
#ifdef PANORAMIX
static int
-XineramaTryClientEventsResult(
- ClientPtr client,
- GrabPtr grab,
- Mask mask,
- Mask filter
-){
+XineramaTryClientEventsResult(ClientPtr client,
+ GrabPtr grab, Mask mask, Mask filter)
+{
if ((client) && (client != serverClient) && (!client->clientGone) &&
- ((filter == CantBeFiltered) || (mask & filter)))
- {
- if (grab && !SameClient(grab, client)) return -1;
- else return 1;
+ ((filter == CantBeFiltered) || (mask & filter))) {
+ if (grab && !SameClient(grab, client))
+ return -1;
+ else
+ return 1;
}
return 0;
}
@@ -2382,43 +2294,40 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
{
OtherClients *other;
-
- if (pWin->eventMask & filter)
- {
+ if (pWin->eventMask & filter) {
if (wClient(pWin) == dontClient)
- return 0;
+ return 0;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
- return XineramaTryClientEventsResult(
- wClient(pWin), NullGrab, pWin->eventMask, filter);
+ if (!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return XineramaTryClientEventsResult(wClient(pWin), NullGrab,
+ pWin->eventMask, filter);
#endif
- if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count))
- return 1; /* don't send, but pretend we did */
- return TryClientEvents(wClient(pWin), NULL, pEvents, count,
- pWin->eventMask, filter, NullGrab);
+ if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count))
+ return 1; /* don't send, but pretend we did */
+ return TryClientEvents(wClient(pWin), NULL, pEvents, count,
+ pWin->eventMask, filter, NullGrab);
}
- for (other = wOtherClients(pWin); other; other = other->next)
- {
- if (other->mask & filter)
- {
+ for (other = wOtherClients(pWin); other; other = other->next) {
+ if (other->mask & filter) {
if (SameClient(other, dontClient))
- return 0;
+ return 0;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
- return XineramaTryClientEventsResult(
- rClient(other), NullGrab, other->mask, filter);
+ if (!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return XineramaTryClientEventsResult(rClient(other), NullGrab,
+ other->mask, filter);
#endif
- if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents,
- count))
- return 1; /* don't send, but pretend we did */
- return TryClientEvents(rClient(other), NULL, pEvents, count,
- other->mask, filter, NullGrab);
- }
+ if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents,
+ count))
+ return 1; /* don't send, but pretend we did */
+ return TryClientEvents(rClient(other), NULL, pEvents, count,
+ other->mask, filter, NullGrab);
+ }
}
return 2;
}
-static Window FindChildForEvent(SpritePtr pSprite, WindowPtr event)
+static Window
+FindChildForEvent(SpritePtr pSprite, WindowPtr event)
{
WindowPtr w = DeepestSpriteWin(pSprite);
Window child = None;
@@ -2427,19 +2336,16 @@ static Window FindChildForEvent(SpritePtr pSprite, WindowPtr event)
set to none or should the value in the argument be passed
through. It probably doesn't matter since everyone calls
this function with child == None anyway. */
- while (w)
- {
+ while (w) {
/* If the source window is same as event window, child should be
none. Don't bother going all all the way back to the root. */
- if (w == event)
- {
+ if (w == event) {
child = None;
break;
}
- if (w->parent == event)
- {
+ if (w->parent == event) {
child = w->drawable.id;
break;
}
@@ -2457,56 +2363,48 @@ static Window FindChildForEvent(SpritePtr pSprite, WindowPtr event)
* @param calcChild If True, calculate the child window.
*/
void
-FixUpEventFromWindow(
- SpritePtr pSprite,
- xEvent *xE,
- WindowPtr pWin,
- Window child,
- Bool calcChild)
+FixUpEventFromWindow(SpritePtr pSprite,
+ xEvent *xE, WindowPtr pWin, Window child, Bool calcChild)
{
int evtype;
if (calcChild)
child = FindChildForEvent(pSprite, pWin);
- if ((evtype = xi2_get_type(xE)))
- {
- xXIDeviceEvent* event = (xXIDeviceEvent*)xE;
-
- switch (evtype)
- {
- case XI_RawKeyPress:
- case XI_RawKeyRelease:
- case XI_RawButtonPress:
- case XI_RawButtonRelease:
- case XI_RawMotion:
- case XI_RawTouchBegin:
- case XI_RawTouchUpdate:
- case XI_RawTouchEnd:
- case XI_DeviceChanged:
- case XI_HierarchyChanged:
- case XI_PropertyEvent:
- return;
- default:
- break;
+ if ((evtype = xi2_get_type(xE))) {
+ xXIDeviceEvent *event = (xXIDeviceEvent *) xE;
+
+ switch (evtype) {
+ case XI_RawKeyPress:
+ case XI_RawKeyRelease:
+ case XI_RawButtonPress:
+ case XI_RawButtonRelease:
+ case XI_RawMotion:
+ case XI_RawTouchBegin:
+ case XI_RawTouchUpdate:
+ case XI_RawTouchEnd:
+ case XI_DeviceChanged:
+ case XI_HierarchyChanged:
+ case XI_PropertyEvent:
+ return;
+ default:
+ break;
}
event->root = RootWindow(pSprite)->drawable.id;
event->event = pWin->drawable.id;
- if (evtype == XI_TouchOwnership)
- {
+ if (evtype == XI_TouchOwnership) {
event->child = child;
return;
}
- if (pSprite->hot.pScreen == pWin->drawable.pScreen)
- {
+ if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
event->event_x = event->root_x - FP1616(pWin->drawable.x, 0);
event->event_y = event->root_y - FP1616(pWin->drawable.y, 0);
event->child = child;
- } else
- {
+ }
+ else {
event->event_x = 0;
event->event_y = 0;
event->child = None;
@@ -2514,24 +2412,20 @@ FixUpEventFromWindow(
if (event->evtype == XI_Enter || event->evtype == XI_Leave ||
event->evtype == XI_FocusIn || event->evtype == XI_FocusOut)
- ((xXIEnterEvent*)event)->same_screen =
+ ((xXIEnterEvent *) event)->same_screen =
(pSprite->hot.pScreen == pWin->drawable.pScreen);
- } else
- {
+ }
+ else {
XE_KBPTR.root = RootWindow(pSprite)->drawable.id;
XE_KBPTR.event = pWin->drawable.id;
- if (pSprite->hot.pScreen == pWin->drawable.pScreen)
- {
+ if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
XE_KBPTR.sameScreen = xTrue;
XE_KBPTR.child = child;
- XE_KBPTR.eventX =
- XE_KBPTR.rootX - pWin->drawable.x;
- XE_KBPTR.eventY =
- XE_KBPTR.rootY - pWin->drawable.y;
+ XE_KBPTR.eventX = XE_KBPTR.rootX - pWin->drawable.x;
+ XE_KBPTR.eventY = XE_KBPTR.rootY - pWin->drawable.y;
}
- else
- {
+ else {
XE_KBPTR.sameScreen = xFalse;
XE_KBPTR.child = None;
XE_KBPTR.eventX = 0;
@@ -2561,14 +2455,12 @@ EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win)
int type;
OtherInputMasks *inputMasks = wOtherInputMasks(win);
- if ((type = GetXI2Type(evtype)) != 0)
- {
+ if ((type = GetXI2Type(evtype)) != 0) {
if (inputMasks && xi2mask_isset(inputMasks->xi2mask, dev, type))
rc |= EVENT_XI2_MASK;
}
- if ((type = GetXIType(evtype)) != 0)
- {
+ if ((type = GetXIType(evtype)) != 0) {
filter = event_get_filter_from_type(dev, type);
/* Check for XI mask */
@@ -2583,8 +2475,7 @@ EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win)
}
- if ((type = GetCoreType(evtype)) != 0)
- {
+ if ((type = GetCoreType(evtype)) != 0) {
filter = event_get_filter_from_type(dev, type);
/* Check for core mask */
@@ -2611,8 +2502,7 @@ DeliverEvent(DeviceIntPtr dev, xEvent *xE, int count,
if (XaceHook(XACE_SEND_ACCESS, NULL, dev, win, xE, count) == Success) {
filter = GetEventFilter(dev, xE);
FixUpEventFromWindow(pSprite, xE, win, child, FALSE);
- deliveries = DeliverEventsToWindow(dev, win, xE, count,
- filter, grab);
+ deliveries = DeliverEventsToWindow(dev, win, xE, count, filter, grab);
}
return deliveries;
@@ -2627,26 +2517,26 @@ DeliverOneEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level,
int deliveries = 0;
int rc;
- switch(level)
- {
- case XI2:
- rc = EventToXI2(event, &xE);
- count = 1;
- break;
- case XI:
- rc = EventToXI(event, &xE, &count);
- break;
- case CORE:
- rc = EventToCore(event, &xE, &count);
- break;
+ switch (level) {
+ case XI2:
+ rc = EventToXI2(event, &xE);
+ count = 1;
+ break;
+ case XI:
+ rc = EventToXI(event, &xE, &count);
+ break;
+ case CORE:
+ rc = EventToCore(event, &xE, &count);
+ break;
}
- if (rc == Success)
- {
+ if (rc == Success) {
deliveries = DeliverEvent(dev, xE, count, win, child, grab);
free(xE);
- } else
- BUG_WARN_MSG(rc != BadMatch, "%s: conversion to level %d failed with rc %d\n",
+ }
+ else
+ BUG_WARN_MSG(rc != BadMatch,
+ "%s: conversion to level %d failed with rc %d\n",
dev->name, level, rc);
return deliveries;
}
@@ -2680,30 +2570,27 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
verify_internal_event(event);
- while (pWin)
- {
- if ((mask = EventIsDeliverable(dev, event->any.type, pWin)))
- {
+ while (pWin) {
+ if ((mask = EventIsDeliverable(dev, event->any.type, pWin))) {
/* XI2 events first */
- if (mask & EVENT_XI2_MASK)
- {
- deliveries = DeliverOneEvent(event, dev, XI2, pWin, child, grab);
+ if (mask & EVENT_XI2_MASK) {
+ deliveries =
+ DeliverOneEvent(event, dev, XI2, pWin, child, grab);
if (deliveries > 0)
break;
}
/* XI events */
- if (mask & EVENT_XI1_MASK)
- {
+ if (mask & EVENT_XI1_MASK) {
deliveries = DeliverOneEvent(event, dev, XI, pWin, child, grab);
if (deliveries > 0)
break;
}
/* Core event */
- if ((mask & EVENT_CORE_MASK) && IsMaster(dev) && dev->coreEvents)
- {
- deliveries = DeliverOneEvent(event, dev, CORE, pWin, child, grab);
+ if ((mask & EVENT_CORE_MASK) && IsMaster(dev) && dev->coreEvents) {
+ deliveries =
+ DeliverOneEvent(event, dev, CORE, pWin, child, grab);
if (deliveries > 0)
break;
}
@@ -2711,8 +2598,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
}
if ((deliveries < 0) || (pWin == stopAt) ||
- (mask & EVENT_DONT_PROPAGATE_MASK))
- {
+ (mask & EVENT_DONT_PROPAGATE_MASK)) {
deliveries = 0;
break;
}
@@ -2738,97 +2624,93 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
* @param otherParent Used for ReparentNotify events.
*/
int
-DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
- WindowPtr otherParent)
+DeliverEvents(WindowPtr pWin, xEvent *xE, int count, WindowPtr otherParent)
{
DeviceIntRec dummy;
- int deliveries;
+ int deliveries;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
- return count;
+ if (!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return count;
#endif
if (!count)
- return 0;
+ return 0;
dummy.id = XIAllDevices;
- switch (xE->u.u.type)
- {
- case DestroyNotify:
- case UnmapNotify:
- case MapNotify:
- case MapRequest:
- case ReparentNotify:
- case ConfigureNotify:
- case ConfigureRequest:
- case GravityNotify:
- case CirculateNotify:
- case CirculateRequest:
- xE->u.destroyNotify.event = pWin->drawable.id;
- break;
+ switch (xE->u.u.type) {
+ case DestroyNotify:
+ case UnmapNotify:
+ case MapNotify:
+ case MapRequest:
+ case ReparentNotify:
+ case ConfigureNotify:
+ case ConfigureRequest:
+ case GravityNotify:
+ case CirculateNotify:
+ case CirculateRequest:
+ xE->u.destroyNotify.event = pWin->drawable.id;
+ break;
}
- switch (xE->u.u.type)
+ switch (xE->u.u.type) {
+ case DestroyNotify:
+ case UnmapNotify:
+ case MapNotify:
+ case ReparentNotify:
+ case ConfigureNotify:
+ case GravityNotify:
+ case CirculateNotify:
+ break;
+ default:
{
- case DestroyNotify:
- case UnmapNotify:
- case MapNotify:
- case ReparentNotify:
- case ConfigureNotify:
- case GravityNotify:
- case CirculateNotify:
- break;
- default:
- {
- Mask filter;
- filter = GetEventFilter(&dummy, xE);
- return DeliverEventsToWindow(&dummy, pWin, xE, count, filter,
- NullGrab);
- }
+ Mask filter;
+
+ filter = GetEventFilter(&dummy, xE);
+ return DeliverEventsToWindow(&dummy, pWin, xE, count, filter, NullGrab);
+ }
}
deliveries = DeliverEventsToWindow(&dummy, pWin, xE, count,
StructureNotifyMask, NullGrab);
- if (pWin->parent)
- {
- xE->u.destroyNotify.event = pWin->parent->drawable.id;
- deliveries += DeliverEventsToWindow(&dummy, pWin->parent, xE, count,
- SubstructureNotifyMask, NullGrab);
- if (xE->u.u.type == ReparentNotify)
- {
- xE->u.destroyNotify.event = otherParent->drawable.id;
+ if (pWin->parent) {
+ xE->u.destroyNotify.event = pWin->parent->drawable.id;
+ deliveries += DeliverEventsToWindow(&dummy, pWin->parent, xE, count,
+ SubstructureNotifyMask, NullGrab);
+ if (xE->u.u.type == ReparentNotify) {
+ xE->u.destroyNotify.event = otherParent->drawable.id;
deliveries += DeliverEventsToWindow(&dummy,
- otherParent, xE, count, SubstructureNotifyMask,
- NullGrab);
- }
+ otherParent, xE, count,
+ SubstructureNotifyMask,
+ NullGrab);
+ }
}
return deliveries;
}
-
static Bool
PointInBorderSize(WindowPtr pWin, int x, int y)
{
BoxRec box;
- if(RegionContainsPoint(&pWin->borderSize, x, y, &box))
- return TRUE;
+ if (RegionContainsPoint(&pWin->borderSize, x, y, &box))
+ return TRUE;
#ifdef PANORAMIX
- if(!noPanoramiXExtension &&
- XineramaSetWindowPntrs(inputInfo.pointer, pWin)) {
- SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite;
- int i;
-
- FOR_NSCREENS_FORWARD_SKIP(i) {
- if(RegionContainsPoint(&pSprite->windows[i]->borderSize,
- x + screenInfo.screens[0]->x - screenInfo.screens[i]->x,
- y + screenInfo.screens[0]->y - screenInfo.screens[i]->y,
- &box))
- return TRUE;
- }
+ if (!noPanoramiXExtension &&
+ XineramaSetWindowPntrs(inputInfo.pointer, pWin)) {
+ SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite;
+ int i;
+
+ FOR_NSCREENS_FORWARD_SKIP(i) {
+ if (RegionContainsPoint(&pSprite->windows[i]->borderSize,
+ x + screenInfo.screens[0]->x -
+ screenInfo.screens[i]->x,
+ y + screenInfo.screens[0]->y -
+ screenInfo.screens[i]->y, &box))
+ return TRUE;
+ }
}
#endif
return FALSE;
@@ -2848,49 +2730,47 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
WindowPtr
XYToWindow(SpritePtr pSprite, int x, int y)
{
- WindowPtr pWin;
- BoxRec box;
+ WindowPtr pWin;
+ BoxRec box;
- pSprite->spriteTraceGood = 1; /* root window still there */
+ pSprite->spriteTraceGood = 1; /* root window still there */
pWin = RootWindow(pSprite)->firstChild;
- while (pWin)
- {
- 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))
- /* When a window is shaped, a further check
- * is made to see if the point is inside
- * borderSize
- */
- && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
- && (!wInputShape(pWin) ||
- RegionContainsPoint(wInputShape(pWin),
- x - pWin->drawable.x,
- y - pWin->drawable.y, &box))
+ while (pWin) {
+ 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))
+ /* When a window is shaped, a further check
+ * is made to see if the point is inside
+ * borderSize
+ */
+ && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
+ && (!wInputShape(pWin) ||
+ RegionContainsPoint(wInputShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box))
#ifdef ROOTLESS
- /* In rootless mode windows may be offscreen, even when
- * they're in X's stack. (E.g. if the native window system
- * implements some form of virtual desktop system).
- */
- && !pWin->rootlessUnhittable
+ /* In rootless mode windows may be offscreen, even when
+ * they're in X's stack. (E.g. if the native window system
+ * implements some form of virtual desktop system).
+ */
+ && !pWin->rootlessUnhittable
#endif
- )
- {
- if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize)
- {
- pSprite->spriteTraceSize += 10;
- pSprite->spriteTrace = realloc(pSprite->spriteTrace,
- pSprite->spriteTraceSize*sizeof(WindowPtr));
- }
- pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
- pWin = pWin->firstChild;
- }
- else
- pWin = pWin->nextSib;
+ ) {
+ if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) {
+ pSprite->spriteTraceSize += 10;
+ pSprite->spriteTrace = realloc(pSprite->spriteTrace,
+ pSprite->spriteTraceSize *
+ sizeof(WindowPtr));
+ }
+ pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
+ pWin = pWin->firstChild;
+ }
+ else
+ pWin = pWin->nextSib;
}
return DeepestSpriteWin(pSprite);
}
@@ -2908,15 +2788,14 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
BOOL rc = FALSE;
DeviceEvent event;
- if (dev->deviceGrab.grab)
- {
+ if (dev->deviceGrab.grab) {
if (!dev->deviceGrab.fromPassiveGrab ||
dev->deviceGrab.grab->type != XI_Enter ||
dev->deviceGrab.grab->window == win ||
IsParent(dev->deviceGrab.grab->window, win))
return FALSE;
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
- (*dev->deviceGrab.DeactivateGrab)(dev);
+ (*dev->deviceGrab.DeactivateGrab) (dev);
}
if (win == NoneWin || win == PointerRootWin)
@@ -2949,15 +2828,14 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
BOOL rc = FALSE;
DeviceEvent event;
- if (dev->deviceGrab.grab)
- {
+ if (dev->deviceGrab.grab) {
if (!dev->deviceGrab.fromPassiveGrab ||
dev->deviceGrab.grab->type != XI_Enter ||
dev->deviceGrab.grab->window == win ||
IsParent(dev->deviceGrab.grab->window, win))
return FALSE;
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
- (*dev->deviceGrab.DeactivateGrab)(dev);
+ (*dev->deviceGrab.DeactivateGrab) (dev);
}
memset(&event, 0, sizeof(DeviceEvent));
@@ -2992,45 +2870,41 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
WindowPtr prevSpriteWin, newSpriteWin;
SpritePtr pSprite = pDev->spriteInfo->sprite;
- verify_internal_event((InternalEvent *)ev);
+ verify_internal_event((InternalEvent *) ev);
if (!pSprite)
return FALSE;
prevSpriteWin = pSprite->win;
- if (ev && !syncEvents.playingEvents)
- {
+ if (ev && !syncEvents.playingEvents) {
/* GetPointerEvents() guarantees that pointer events have the correct
rootX/Y set already. */
- switch (ev->type)
- {
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_Motion:
- case ET_TouchBegin:
- case ET_TouchUpdate:
- case ET_TouchEnd:
- break;
- default:
- /* all other events return FALSE */
- return FALSE;
+ switch (ev->type) {
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_Motion:
+ case ET_TouchBegin:
+ case ET_TouchUpdate:
+ case ET_TouchEnd:
+ break;
+ default:
+ /* all other events return FALSE */
+ return FALSE;
}
-
#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- {
+ if (!noPanoramiXExtension) {
/* Motion events entering DIX get translated to Screen 0
coordinates. Replayed events have already been
translated since they've entered DIX before */
ev->root_x += pSprite->screen->x - screenInfo.screens[0]->x;
ev->root_y += pSprite->screen->y - screenInfo.screens[0]->y;
- } else
+ }
+ else
#endif
{
- if (pSprite->hot.pScreen != pSprite->hotPhys.pScreen)
- {
+ if (pSprite->hot.pScreen != pSprite->hotPhys.pScreen) {
pSprite->hot.pScreen = pSprite->hotPhys.pScreen;
RootWindow(pDev->spriteInfo->sprite) =
pSprite->hot.pScreen->root;
@@ -3047,43 +2921,49 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
pSprite->hot.y = pSprite->physLimits.y1;
else if (pSprite->hot.y >= pSprite->physLimits.y2)
pSprite->hot.y = pSprite->physLimits.y2 - 1;
- if (pSprite->hotShape)
- ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x, &pSprite->hot.y);
- pSprite->hotPhys = pSprite->hot;
+ if (pSprite->hotShape)
+ ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x,
+ &pSprite->hot.y);
+ pSprite->hotPhys = pSprite->hot;
- if ((pSprite->hotPhys.x != ev->root_x) ||
- (pSprite->hotPhys.y != ev->root_y))
- {
+ if ((pSprite->hotPhys.x != ev->root_x) ||
+ (pSprite->hotPhys.y != ev->root_y)) {
#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- {
- XineramaSetCursorPosition(
- pDev, pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE);
- } else
+ if (!noPanoramiXExtension) {
+ XineramaSetCursorPosition(pDev, pSprite->hotPhys.x,
+ pSprite->hotPhys.y, FALSE);
+ }
+ else
#endif
{
- (*pSprite->hotPhys.pScreen->SetCursorPosition)(
- pDev, pSprite->hotPhys.pScreen,
- pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE);
+ (*pSprite->hotPhys.pScreen->SetCursorPosition) (pDev,
+ pSprite->
+ hotPhys.pScreen,
+ pSprite->
+ hotPhys.x,
+ pSprite->
+ hotPhys.y,
+ FALSE);
}
- }
+ }
- ev->root_x = pSprite->hot.x;
- ev->root_y = pSprite->hot.y;
+ ev->root_x = pSprite->hot.x;
+ ev->root_y = pSprite->hot.y;
}
newSpriteWin = XYToWindow(pSprite, pSprite->hot.x, pSprite->hot.y);
- if (newSpriteWin != prevSpriteWin)
- {
+ if (newSpriteWin != prevSpriteWin) {
int sourceid;
+
if (!ev) {
UpdateCurrentTimeIf();
- sourceid = pDev->id; /* when from WindowsRestructured */
- } else
+ sourceid = pDev->id; /* when from WindowsRestructured */
+ }
+ else
sourceid = ev->sourceid;
- if (prevSpriteWin != NullWindow) {
+ if (prevSpriteWin != NullWindow) {
if (!ActivateEnterGrab(pDev, prevSpriteWin, newSpriteWin))
DoEnterLeaveEvents(pDev, sourceid, prevSpriteWin,
newSpriteWin, NotifyNormal);
@@ -3106,8 +2986,8 @@ void
WindowsRestructured(void)
{
DeviceIntPtr pDev = inputInfo.devices;
- while(pDev)
- {
+
+ while (pDev) {
if (IsMaster(pDev) || IsFloating(pDev))
CheckMotion(NULL, pDev);
pDev = pDev->next;
@@ -3120,25 +3000,25 @@ WindowsRestructured(void)
* other than 0,0, the information in the private sprite structure must
* be updated accordingly, or XYToWindow (and other routines) will not
* compute correctly. */
-void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
+void
+ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
{
- GrabPtr grab;
+ GrabPtr grab;
DeviceIntPtr pDev;
SpritePtr pSprite;
- if (noPanoramiXExtension) return;
+ if (noPanoramiXExtension)
+ return;
pDev = inputInfo.devices;
- while(pDev)
- {
- if (DevHasCursor(pDev))
- {
+ while (pDev) {
+ if (DevHasCursor(pDev)) {
pSprite = pDev->spriteInfo->sprite;
- pSprite->hot.x -= xoff;
- pSprite->hot.y -= yoff;
+ pSprite->hot.x -= xoff;
+ pSprite->hot.y -= yoff;
- pSprite->hotPhys.x -= xoff;
- pSprite->hotPhys.y -= yoff;
+ pSprite->hotPhys.x -= xoff;
+ pSprite->hotPhys.y -= yoff;
pSprite->hotLimits.x1 -= xoff;
pSprite->hotLimits.y1 -= yoff;
@@ -3153,14 +3033,14 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
/* FIXME: if we call ConfineCursorToWindow, must we do anything else? */
if ((grab = pDev->deviceGrab.grab) && grab->confineTo) {
if (grab->confineTo->drawable.pScreen
- != pSprite->hotPhys.pScreen)
+ != pSprite->hotPhys.pScreen)
pSprite->hotPhys.x = pSprite->hotPhys.y = 0;
ConfineCursorToWindow(pDev, grab->confineTo, TRUE, TRUE);
- } else
- ConfineCursorToWindow(
- pDev,
- pSprite->hotPhys.pScreen->root,
- TRUE, FALSE);
+ }
+ else
+ ConfineCursorToWindow(pDev,
+ pSprite->hotPhys.pScreen->root,
+ TRUE, FALSE);
}
pDev = pDev->next;
@@ -3190,11 +3070,10 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
ScreenPtr pScreen;
CursorPtr pCursor;
- if (!pDev->spriteInfo->sprite)
- {
+ if (!pDev->spriteInfo->sprite) {
DeviceIntPtr it;
- pDev->spriteInfo->sprite = (SpritePtr)calloc(1, sizeof(SpriteRec));
+ pDev->spriteInfo->sprite = (SpritePtr) calloc(1, sizeof(SpriteRec));
if (!pDev->spriteInfo->sprite)
FatalError("InitializeSprite: failed to allocate sprite struct");
@@ -3204,8 +3083,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
*
* The VCK is always paired with the VCP before the VCP has a sprite.
*/
- for (it = inputInfo.devices; it; it = it->next)
- {
+ for (it = inputInfo.devices; it; it = it->next) {
if (it->spriteInfo->paired == pDev)
it->spriteInfo->sprite = pDev->spriteInfo->sprite;
}
@@ -3216,11 +3094,10 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
pSprite = pDev->spriteInfo->sprite;
pDev->spriteInfo->spriteOwner = TRUE;
- pScreen = (pWin) ? pWin->drawable.pScreen : (ScreenPtr)NULL;
+ pScreen = (pWin) ? pWin->drawable.pScreen : (ScreenPtr) NULL;
pSprite->hot.pScreen = pScreen;
pSprite->hotPhys.pScreen = pScreen;
- if (pScreen)
- {
+ if (pScreen) {
pSprite->hotPhys.x = pScreen->width / 2;
pSprite->hotPhys.y = pScreen->height / 2;
pSprite->hotLimits.x2 = pScreen->width;
@@ -3230,53 +3107,50 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
pSprite->hot = pSprite->hotPhys;
pSprite->win = pWin;
- if (pWin)
- {
- pCursor = wCursor(pWin);
- pSprite->spriteTrace = (WindowPtr *)calloc(1, 32*sizeof(WindowPtr));
- if (!pSprite->spriteTrace)
- FatalError("Failed to allocate spriteTrace");
- pSprite->spriteTraceSize = 32;
+ if (pWin) {
+ pCursor = wCursor(pWin);
+ pSprite->spriteTrace = (WindowPtr *) calloc(1, 32 * sizeof(WindowPtr));
+ if (!pSprite->spriteTrace)
+ FatalError("Failed to allocate spriteTrace");
+ pSprite->spriteTraceSize = 32;
- RootWindow(pDev->spriteInfo->sprite) = pWin;
- pSprite->spriteTraceGood = 1;
+ RootWindow(pDev->spriteInfo->sprite) = pWin;
+ pSprite->spriteTraceGood = 1;
- pSprite->pEnqueueScreen = pScreen;
- pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
+ pSprite->pEnqueueScreen = pScreen;
+ pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
- } else {
+ }
+ else {
pCursor = NullCursor;
- pSprite->spriteTrace = NULL;
- pSprite->spriteTraceSize = 0;
- pSprite->spriteTraceGood = 0;
- pSprite->pEnqueueScreen = screenInfo.screens[0];
- pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
+ pSprite->spriteTrace = NULL;
+ pSprite->spriteTraceSize = 0;
+ pSprite->spriteTraceGood = 0;
+ pSprite->pEnqueueScreen = screenInfo.screens[0];
+ pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
}
if (pCursor)
- pCursor->refcnt++;
+ pCursor->refcnt++;
if (pSprite->current)
- FreeCursor(pSprite->current, None);
+ FreeCursor(pSprite->current, None);
pSprite->current = pCursor;
- if (pScreen)
- {
- (*pScreen->RealizeCursor) ( pDev, pScreen, pSprite->current);
- (*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current,
- &pSprite->hotLimits, &pSprite->physLimits);
+ if (pScreen) {
+ (*pScreen->RealizeCursor) (pDev, pScreen, pSprite->current);
+ (*pScreen->CursorLimits) (pDev, pScreen, pSprite->current,
+ &pSprite->hotLimits, &pSprite->physLimits);
pSprite->confined = FALSE;
- (*pScreen->ConstrainCursor) (pDev, pScreen,
- &pSprite->physLimits);
+ (*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits);
(*pScreen->SetCursorPosition) (pDev, pScreen, pSprite->hot.x,
- pSprite->hot.y,
- FALSE);
+ pSprite->hot.y, FALSE);
(*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current);
}
#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
+ if (!noPanoramiXExtension) {
pSprite->hotLimits.x1 = -screenInfo.screens[0]->x;
pSprite->hotLimits.y1 = -screenInfo.screens[0]->y;
- pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x;
+ pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x;
pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y;
pSprite->physLimits = pSprite->hotLimits;
pSprite->confineWin = NullWindow;
@@ -3310,8 +3184,9 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen)
SpritePtr pSprite = NULL;
WindowPtr win = NULL;
CursorPtr pCursor;
+
if (!pScreen)
- return ;
+ return;
if (!pDev->spriteInfo->sprite)
return;
@@ -3327,26 +3202,25 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen)
pSprite->win = win;
pCursor = wCursor(win);
if (pCursor)
- pCursor->refcnt++;
+ pCursor->refcnt++;
if (pSprite->current)
- FreeCursor(pSprite->current, 0);
+ FreeCursor(pSprite->current, 0);
pSprite->current = pCursor;
pSprite->spriteTraceGood = 1;
pSprite->spriteTrace[0] = win;
(*pScreen->CursorLimits) (pDev,
pScreen,
pSprite->current,
- &pSprite->hotLimits,
- &pSprite->physLimits);
+ &pSprite->hotLimits, &pSprite->physLimits);
pSprite->confined = FALSE;
(*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits);
(*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current);
#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
+ if (!noPanoramiXExtension) {
pSprite->hotLimits.x1 = -screenInfo.screens[0]->x;
pSprite->hotLimits.y1 = -screenInfo.screens[0]->y;
- pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x;
+ pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x;
pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y;
pSprite->physLimits = pSprite->hotLimits;
pSprite->screen = pScreen;
@@ -3366,7 +3240,7 @@ WindowHasNewCursor(WindowPtr pWin)
{
DeviceIntPtr pDev;
- for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
if (DevHasCursor(pDev))
PostNewCursor(pDev);
}
@@ -3377,72 +3251,76 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
DeviceIntPtr ptr;
SpritePtr pSprite;
- ptr = IsFloating(pDev) ? pDev : GetXTestDevice(GetMaster(pDev, MASTER_POINTER));
+ ptr =
+ IsFloating(pDev) ? pDev :
+ GetXTestDevice(GetMaster(pDev, MASTER_POINTER));
pSprite = ptr->spriteInfo->sprite;
pSprite->hotPhys.x = x;
pSprite->hotPhys.y = y;
#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
- pSprite->hotPhys.x += newScreen->x - screenInfo.screens[0]->x;
- pSprite->hotPhys.y += newScreen->y - screenInfo.screens[0]->y;
- if (newScreen != pSprite->screen) {
- pSprite->screen = newScreen;
- /* Make sure we tell the DDX to update its copy of the screen */
- if(pSprite->confineWin)
- XineramaConfineCursorToWindow(ptr,
- pSprite->confineWin, TRUE);
- else
- XineramaConfineCursorToWindow(ptr, screenInfo.screens[0]->root, TRUE);
- /* if the pointer wasn't confined, the DDX won't get
- told of the pointer warp so we reposition it here */
- if(!syncEvents.playingEvents)
- (*pSprite->screen->SetCursorPosition)(
- ptr,
- pSprite->screen,
- pSprite->hotPhys.x + screenInfo.screens[0]->x -
- pSprite->screen->x,
- pSprite->hotPhys.y + screenInfo.screens[0]->y -
- pSprite->screen->y, FALSE);
- }
- } else
+ if (!noPanoramiXExtension) {
+ pSprite->hotPhys.x += newScreen->x - screenInfo.screens[0]->x;
+ pSprite->hotPhys.y += newScreen->y - screenInfo.screens[0]->y;
+ if (newScreen != pSprite->screen) {
+ pSprite->screen = newScreen;
+ /* Make sure we tell the DDX to update its copy of the screen */
+ if (pSprite->confineWin)
+ XineramaConfineCursorToWindow(ptr, pSprite->confineWin, TRUE);
+ else
+ XineramaConfineCursorToWindow(ptr, screenInfo.screens[0]->root,
+ TRUE);
+ /* if the pointer wasn't confined, the DDX won't get
+ told of the pointer warp so we reposition it here */
+ if (!syncEvents.playingEvents)
+ (*pSprite->screen->SetCursorPosition) (ptr,
+ pSprite->screen,
+ pSprite->hotPhys.x +
+ screenInfo.screens[0]->
+ x - pSprite->screen->x,
+ pSprite->hotPhys.y +
+ screenInfo.screens[0]->
+ y - pSprite->screen->y,
+ FALSE);
+ }
+ }
+ else
#endif
if (newScreen != pSprite->hotPhys.pScreen)
- ConfineCursorToWindow(ptr, newScreen->root, TRUE, FALSE);
+ ConfineCursorToWindow(ptr, newScreen->root, TRUE, FALSE);
}
#ifdef PANORAMIX
static Bool
-XineramaPointInWindowIsVisible(
- WindowPtr pWin,
- int x,
- int y
-)
+XineramaPointInWindowIsVisible(WindowPtr pWin, int x, int y)
{
BoxRec box;
int i, xoff, yoff;
- if (!pWin->realized) return FALSE;
+ if (!pWin->realized)
+ return FALSE;
if (RegionContainsPoint(&pWin->borderClip, x, y, &box))
return TRUE;
- if(!XineramaSetWindowPntrs(inputInfo.pointer, pWin)) return FALSE;
+ if (!XineramaSetWindowPntrs(inputInfo.pointer, pWin))
+ return FALSE;
xoff = x + screenInfo.screens[0]->x;
yoff = y + screenInfo.screens[0]->y;
FOR_NSCREENS_FORWARD_SKIP(i) {
- pWin = inputInfo.pointer->spriteInfo->sprite->windows[i];
- x = xoff - screenInfo.screens[i]->x;
- y = yoff - screenInfo.screens[i]->y;
-
- if(RegionContainsPoint(&pWin->borderClip, x, y, &box)
- && (!wInputShape(pWin) ||
- RegionContainsPoint(wInputShape(pWin),
- x - pWin->drawable.x,
- y - pWin->drawable.y, &box)))
+ pWin = inputInfo.pointer->spriteInfo->sprite->windows[i];
+
+ x = xoff - screenInfo.screens[i]->x;
+ y = yoff - screenInfo.screens[i]->y;
+
+ if (RegionContainsPoint(&pWin->borderClip, x, y, &box)
+ && (!wInputShape(pWin) ||
+ RegionContainsPoint(wInputShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box)))
return TRUE;
}
@@ -3453,68 +3331,66 @@ XineramaPointInWindowIsVisible(
static int
XineramaWarpPointer(ClientPtr client)
{
- WindowPtr dest = NULL;
- int x, y, rc;
- SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite;
+ WindowPtr dest = NULL;
+ int x, y, rc;
+ SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite;
REQUEST(xWarpPointerReq);
-
if (stuff->dstWid != None) {
- rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
x = pSprite->hotPhys.x;
y = pSprite->hotPhys.y;
- if (stuff->srcWid != None)
- {
- int winX, winY;
- XID winID = stuff->srcWid;
+ if (stuff->srcWid != None) {
+ int winX, winY;
+ XID winID = stuff->srcWid;
WindowPtr source;
- rc = dixLookupWindow(&source, winID, client, DixReadAccess);
- if (rc != Success)
- return rc;
-
- winX = source->drawable.x;
- winY = source->drawable.y;
- if(source == screenInfo.screens[0]->root) {
- winX -= screenInfo.screens[0]->x;
- winY -= screenInfo.screens[0]->y;
- }
- if (x < winX + stuff->srcX ||
- y < winY + stuff->srcY ||
- (stuff->srcWidth != 0 &&
- winX + stuff->srcX + (int)stuff->srcWidth < x) ||
- (stuff->srcHeight != 0 &&
- winY + stuff->srcY + (int)stuff->srcHeight < y) ||
- !XineramaPointInWindowIsVisible(source, x, y))
- return Success;
+ rc = dixLookupWindow(&source, winID, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ winX = source->drawable.x;
+ winY = source->drawable.y;
+ if (source == screenInfo.screens[0]->root) {
+ winX -= screenInfo.screens[0]->x;
+ winY -= screenInfo.screens[0]->y;
+ }
+ if (x < winX + stuff->srcX ||
+ y < winY + stuff->srcY ||
+ (stuff->srcWidth != 0 &&
+ winX + stuff->srcX + (int) stuff->srcWidth < x) ||
+ (stuff->srcHeight != 0 &&
+ winY + stuff->srcY + (int) stuff->srcHeight < y) ||
+ !XineramaPointInWindowIsVisible(source, x, y))
+ return Success;
}
if (dest) {
- x = dest->drawable.x;
- y = dest->drawable.y;
- if(dest == screenInfo.screens[0]->root) {
- x -= screenInfo.screens[0]->x;
- y -= screenInfo.screens[0]->y;
- }
+ x = dest->drawable.x;
+ y = dest->drawable.y;
+ if (dest == screenInfo.screens[0]->root) {
+ x -= screenInfo.screens[0]->x;
+ y -= screenInfo.screens[0]->y;
+ }
}
x += stuff->dstX;
y += stuff->dstY;
if (x < pSprite->physLimits.x1)
- x = pSprite->physLimits.x1;
+ x = pSprite->physLimits.x1;
else if (x >= pSprite->physLimits.x2)
- x = pSprite->physLimits.x2 - 1;
+ x = pSprite->physLimits.x2 - 1;
if (y < pSprite->physLimits.y1)
- y = pSprite->physLimits.y1;
+ y = pSprite->physLimits.y1;
else if (y >= pSprite->physLimits.y2)
- y = pSprite->physLimits.y2 - 1;
+ y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
- ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y);
+ ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y);
XineramaSetCursorPosition(PickPointer(client), x, y, TRUE);
@@ -3523,7 +3399,6 @@ XineramaWarpPointer(ClientPtr client)
#endif
-
/**
* Server-side protocol handling for WarpPointer request.
* Warps the cursor position to the coordinates given in the request.
@@ -3531,11 +3406,11 @@ XineramaWarpPointer(ClientPtr client)
int
ProcWarpPointer(ClientPtr client)
{
- WindowPtr dest = NULL;
- int x, y, rc;
- ScreenPtr newScreen;
+ WindowPtr dest = NULL;
+ int x, y, rc;
+ ScreenPtr newScreen;
DeviceIntPtr dev, tmp;
- SpritePtr pSprite;
+ SpritePtr pSprite;
REQUEST(xWarpPointerReq);
REQUEST_SIZE_MATCH(xWarpPointerReq);
@@ -3544,10 +3419,10 @@ ProcWarpPointer(ClientPtr client)
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
if (GetMaster(tmp, MASTER_ATTACHED) == dev) {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
- if (rc != Success)
- return rc;
- }
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
+ if (rc != Success)
+ return rc;
+ }
}
if (dev->lastSlave)
@@ -3555,77 +3430,74 @@ ProcWarpPointer(ClientPtr client)
pSprite = dev->spriteInfo->sprite;
#ifdef PANORAMIX
- if(!noPanoramiXExtension)
- return XineramaWarpPointer(client);
+ if (!noPanoramiXExtension)
+ return XineramaWarpPointer(client);
#endif
if (stuff->dstWid != None) {
- rc = dixLookupWindow(&dest, stuff->dstWid, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupWindow(&dest, stuff->dstWid, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
}
x = pSprite->hotPhys.x;
y = pSprite->hotPhys.y;
- if (stuff->srcWid != None)
- {
- int winX, winY;
- XID winID = stuff->srcWid;
+ if (stuff->srcWid != None) {
+ int winX, winY;
+ XID winID = stuff->srcWid;
WindowPtr source;
- rc = dixLookupWindow(&source, winID, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
-
- winX = source->drawable.x;
- winY = source->drawable.y;
- if (source->drawable.pScreen != pSprite->hotPhys.pScreen ||
- x < winX + stuff->srcX ||
- y < winY + stuff->srcY ||
- (stuff->srcWidth != 0 &&
- winX + stuff->srcX + (int)stuff->srcWidth < x) ||
- (stuff->srcHeight != 0 &&
- winY + stuff->srcY + (int)stuff->srcHeight < y) ||
- !PointInWindowIsVisible(source, x, y))
- return Success;
- }
- if (dest)
- {
- x = dest->drawable.x;
- y = dest->drawable.y;
- newScreen = dest->drawable.pScreen;
- } else
- newScreen = pSprite->hotPhys.pScreen;
+ rc = dixLookupWindow(&source, winID, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ winX = source->drawable.x;
+ winY = source->drawable.y;
+ if (source->drawable.pScreen != pSprite->hotPhys.pScreen ||
+ x < winX + stuff->srcX ||
+ y < winY + stuff->srcY ||
+ (stuff->srcWidth != 0 &&
+ winX + stuff->srcX + (int) stuff->srcWidth < x) ||
+ (stuff->srcHeight != 0 &&
+ winY + stuff->srcY + (int) stuff->srcHeight < y) ||
+ !PointInWindowIsVisible(source, x, y))
+ return Success;
+ }
+ if (dest) {
+ x = dest->drawable.x;
+ y = dest->drawable.y;
+ newScreen = dest->drawable.pScreen;
+ }
+ else
+ newScreen = pSprite->hotPhys.pScreen;
x += stuff->dstX;
y += stuff->dstY;
if (x < 0)
- x = 0;
+ x = 0;
else if (x >= newScreen->width)
- x = newScreen->width - 1;
+ x = newScreen->width - 1;
if (y < 0)
- y = 0;
+ y = 0;
else if (y >= newScreen->height)
- y = newScreen->height - 1;
-
- if (newScreen == pSprite->hotPhys.pScreen)
- {
- if (x < pSprite->physLimits.x1)
- x = pSprite->physLimits.x1;
- else if (x >= pSprite->physLimits.x2)
- x = pSprite->physLimits.x2 - 1;
- if (y < pSprite->physLimits.y1)
- y = pSprite->physLimits.y1;
- else if (y >= pSprite->physLimits.y2)
- y = pSprite->physLimits.y2 - 1;
- if (pSprite->hotShape)
- ConfineToShape(dev, pSprite->hotShape, &x, &y);
- (*newScreen->SetCursorPosition)(dev, newScreen, x, y, TRUE);
- }
- else if (!PointerConfinedToScreen(dev))
- {
- NewCurrentScreen(dev, newScreen, x, y);
+ y = newScreen->height - 1;
+
+ if (newScreen == pSprite->hotPhys.pScreen) {
+ if (x < pSprite->physLimits.x1)
+ x = pSprite->physLimits.x1;
+ else if (x >= pSprite->physLimits.x2)
+ x = pSprite->physLimits.x2 - 1;
+ if (y < pSprite->physLimits.y1)
+ y = pSprite->physLimits.y1;
+ else if (y >= pSprite->physLimits.y2)
+ y = pSprite->physLimits.y2 - 1;
+ if (pSprite->hotShape)
+ ConfineToShape(dev, pSprite->hotShape, &x, &y);
+ (*newScreen->SetCursorPosition) (dev, newScreen, x, y, TRUE);
+ }
+ else if (!PointerConfinedToScreen(dev)) {
+ NewCurrentScreen(dev, newScreen, x, y);
}
return Success;
}
@@ -3633,20 +3505,21 @@ ProcWarpPointer(ClientPtr client)
static Bool
BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin)
{
- if(RegionNotEmpty(&pWin->borderSize))
- return TRUE;
+ if (RegionNotEmpty(&pWin->borderSize))
+ return TRUE;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && XineramaSetWindowPntrs(pDev, pWin)) {
- int i;
-
- FOR_NSCREENS_FORWARD_SKIP(i) {
- if(RegionNotEmpty(&pDev->spriteInfo->sprite->windows[i]->borderSize))
- return TRUE;
- }
- }
+ if (!noPanoramiXExtension && XineramaSetWindowPntrs(pDev, pWin)) {
+ int i;
+
+ FOR_NSCREENS_FORWARD_SKIP(i) {
+ if (RegionNotEmpty
+ (&pDev->spriteInfo->sprite->windows[i]->borderSize))
+ return TRUE;
+ }
+ }
#endif
- return FALSE;
+ return FALSE;
}
/**
@@ -3664,7 +3537,6 @@ BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin)
Bool
ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
InternalEvent *real_event)
-
{
SpritePtr pSprite = device->spriteInfo->sprite;
GrabInfoPtr grabinfo = &device->deviceGrab;
@@ -3674,8 +3546,7 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
/* The only consumers of corestate are Xi 1.x and core events, which
* are guaranteed to come from DeviceEvents. */
- if (grab->grabtype == XI || grab->grabtype == CORE)
- {
+ if (grab->grabtype == XI || grab->grabtype == CORE) {
DeviceIntPtr gdev;
event->device_event.corestate &= 0x1f00;
@@ -3690,43 +3561,38 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
gdev->key->xkbInfo->state.grab_mods & (~0x1f00);
}
- if (grab->grabtype == CORE)
- {
+ if (grab->grabtype == CORE) {
rc = EventToCore(event, &xE, &count);
- if (rc != Success)
- {
- BUG_WARN_MSG(rc != BadMatch,"[dix] %s: core conversion failed"
+ if (rc != Success) {
+ BUG_WARN_MSG(rc != BadMatch, "[dix] %s: core conversion failed"
"(%d, %d).\n", device->name, event->any.type, rc);
return FALSE;
}
- } else if (grab->grabtype == XI2)
- {
+ }
+ else if (grab->grabtype == XI2) {
rc = EventToXI2(event, &xE);
- if (rc != Success)
- {
+ if (rc != Success) {
if (rc != BadMatch)
- BUG_WARN_MSG(rc != BadMatch,"[dix] %s: XI2 conversion failed"
+ BUG_WARN_MSG(rc != BadMatch, "[dix] %s: XI2 conversion failed"
"(%d, %d).\n", device->name, event->any.type, rc);
return FALSE;
}
count = 1;
- } else
- {
+ }
+ else {
rc = EventToXI(event, &xE, &count);
- if (rc != Success)
- {
+ if (rc != Success) {
if (rc != BadMatch)
- BUG_WARN_MSG(rc != BadMatch,"[dix] %s: XI conversion failed"
+ BUG_WARN_MSG(rc != BadMatch, "[dix] %s: XI conversion failed"
"(%d, %d).\n", device->name, event->any.type, rc);
return FALSE;
}
}
- (*grabinfo->ActivateGrab)(device, grab,
- ClientTimeToServerTime(event->any.time), TRUE);
+ (*grabinfo->ActivateGrab) (device, grab,
+ ClientTimeToServerTime(event->any.time), TRUE);
- if (xE)
- {
+ if (xE) {
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
/* XXX: XACE? */
@@ -3749,16 +3615,15 @@ CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab)
DeviceIntPtr other;
BOOL interfering = FALSE;
- for (other = inputInfo.devices; other; other = other->next)
- {
+ for (other = inputInfo.devices; other; other = other->next) {
GrabPtr othergrab = other->deviceGrab.grab;
+
if (othergrab && othergrab->grabtype == CORE &&
- SameClient(grab, rClient(othergrab)) &&
- ((IsPointerDevice(grab->device) &&
- IsPointerDevice(othergrab->device)) ||
- (IsKeyboardDevice(grab->device) &&
- IsKeyboardDevice(othergrab->device))))
- {
+ SameClient(grab, rClient(othergrab)) &&
+ ((IsPointerDevice(grab->device) &&
+ IsPointerDevice(othergrab->device)) ||
+ (IsKeyboardDevice(grab->device) &&
+ IsKeyboardDevice(othergrab->device)))) {
interfering = TRUE;
break;
}
@@ -3768,10 +3633,10 @@ CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab)
}
enum MatchFlags {
- NO_MATCH = 0x0,
- CORE_MATCH = 0x1,
- XI_MATCH = 0x2,
- XI2_MATCH = 0x4,
+ NO_MATCH = 0x0,
+ CORE_MATCH = 0x1,
+ XI_MATCH = 0x2,
+ XI2_MATCH = 0x4,
};
/**
@@ -3786,32 +3651,32 @@ enum MatchFlags {
* @return The respective matched flag or 0 for no match
*/
static enum MatchFlags
-MatchForType(const GrabPtr grab, GrabPtr tmp, enum InputLevel level, int event_type)
+MatchForType(const GrabPtr grab, GrabPtr tmp, enum InputLevel level,
+ int event_type)
{
enum MatchFlags match;
BOOL ignore_device = FALSE;
int grabtype;
int evtype;
- switch(level)
- {
- case XI2:
- grabtype = XI2;
- evtype = GetXI2Type(event_type);
- BUG_WARN(!evtype);
- match = XI2_MATCH;
- break;
- case XI:
- grabtype = XI;
- evtype = GetXIType(event_type);
- match = XI_MATCH;
- break;
- case CORE:
- grabtype = CORE;
- evtype = GetCoreType(event_type);
- match = CORE_MATCH;
- ignore_device = TRUE;
- break;
+ switch (level) {
+ case XI2:
+ grabtype = XI2;
+ evtype = GetXI2Type(event_type);
+ BUG_WARN(!evtype);
+ match = XI2_MATCH;
+ break;
+ case XI:
+ grabtype = XI;
+ evtype = GetXIType(event_type);
+ match = XI_MATCH;
+ break;
+ case CORE:
+ grabtype = CORE;
+ evtype = GetCoreType(event_type);
+ match = CORE_MATCH;
+ ignore_device = TRUE;
+ break;
}
tmp->grabtype = grabtype;
@@ -3846,11 +3711,10 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
int emulated_type = 0;
gdev = grab->modifierDevice;
- if (grab->grabtype == CORE)
- {
+ if (grab->grabtype == CORE) {
gdev = GetMaster(device, KEYBOARD_OR_FLOAT);
- } else if (grab->grabtype == XI2)
- {
+ }
+ else if (grab->grabtype == XI2) {
/* if the device is an attached slave device, gdev must be the
* attached master keyboard. Since the slave may have been
* reattached after the grab, the modifier device may not be the
@@ -3860,15 +3724,15 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
}
if (gdev && gdev->key)
- xkbi= gdev->key->xkbInfo;
+ xkbi = gdev->key->xkbInfo;
tempGrab->modifierDevice = grab->modifierDevice;
tempGrab->modifiersDetail.exact = xkbi ? xkbi->state.grab_mods : 0;
/* Check for XI2 and XI grabs first */
match = MatchForType(grab, tempGrab, XI2, event->any.type);
- if (!match && IsTouchEvent(event) && (event->device_event.flags & TOUCH_POINTER_EMULATED))
- {
+ if (!match && IsTouchEvent(event) &&
+ (event->device_event.flags & TOUCH_POINTER_EMULATED)) {
emulated_type = TouchGetPointerEventType(event);
match = MatchForType(grab, tempGrab, XI2, emulated_type);
}
@@ -3879,8 +3743,7 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
if (!match && emulated_type)
match = MatchForType(grab, tempGrab, XI, emulated_type);
- if (!match && checkCore)
- {
+ if (!match && checkCore) {
match = MatchForType(grab, tempGrab, CORE, event->any.type);
if (!match && emulated_type)
match = MatchForType(grab, tempGrab, CORE, emulated_type);
@@ -3897,8 +3760,7 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
* device.
*/
- if (grab->grabtype == CORE)
- {
+ if (grab->grabtype == CORE) {
/* A passive grab may have been created for a different device
than it is assigned to at this point in time.
Update the grab's device and modifier device to reflect the
@@ -3906,8 +3768,7 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
Since XGrabDeviceButton requires to specify the
modifierDevice explicitly, we don't override this choice.
*/
- if (grab->type < GenericEvent)
- {
+ if (grab->type < GenericEvent) {
grab->device = device;
grab->modifierDevice = GetMaster(device, MASTER_KEYBOARD);
}
@@ -3933,38 +3794,34 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
*/
GrabPtr
-CheckPassiveGrabsOnWindow(
- WindowPtr pWin,
- DeviceIntPtr device,
- InternalEvent *event,
- BOOL checkCore,
- BOOL activate)
+CheckPassiveGrabsOnWindow(WindowPtr pWin,
+ DeviceIntPtr device,
+ InternalEvent *event, BOOL checkCore, BOOL activate)
{
GrabPtr grab = wPassiveGrabs(pWin);
GrabPtr tempGrab;
if (!grab)
- return NULL;
+ return NULL;
tempGrab = AllocGrab();
/* Fill out the grab details, but leave the type for later before
* comparing */
- switch (event->any.type)
- {
- case ET_KeyPress:
- case ET_KeyRelease:
- tempGrab->detail.exact = event->device_event.detail.key;
- break;
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_TouchBegin:
- case ET_TouchEnd:
- tempGrab->detail.exact = event->device_event.detail.button;
- break;
- default:
- tempGrab->detail.exact = 0;
- break;
+ switch (event->any.type) {
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ tempGrab->detail.exact = event->device_event.detail.key;
+ break;
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_TouchBegin:
+ case ET_TouchEnd:
+ tempGrab->detail.exact = event->device_event.detail.button;
+ break;
+ default:
+ tempGrab->detail.exact = 0;
+ break;
}
tempGrab->window = pWin;
tempGrab->device = device;
@@ -3972,8 +3829,7 @@ CheckPassiveGrabsOnWindow(
tempGrab->modifiersDetail.pMask = NULL;
tempGrab->next = NULL;
- for (; grab; grab = grab->next)
- {
+ for (; grab; grab = grab->next) {
if (!CheckPassiveGrab(device, grab, event, checkCore, tempGrab))
continue;
@@ -4018,24 +3874,22 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor)
{
int i;
WindowPtr pWin = NULL;
- FocusClassPtr focus = IsPointerEvent((InternalEvent*)event) ? NULL : device->focus;
+ FocusClassPtr focus =
+ IsPointerEvent((InternalEvent *) event) ? NULL : device->focus;
BOOL sendCore = (IsMaster(device) && device->coreEvents);
Bool ret = FALSE;
- if (event->type != ET_ButtonPress &&
- event->type != ET_KeyPress)
+ if (event->type != ET_ButtonPress && event->type != ET_KeyPress)
return FALSE;
- if (event->type == ET_ButtonPress
- && (device->button->buttonsDown != 1))
- return FALSE;
+ if (event->type == ET_ButtonPress && (device->button->buttonsDown != 1))
+ return FALSE;
if (device->deviceGrab.grab)
return FALSE;
i = 0;
- if (ancestor)
- {
+ if (ancestor) {
while (i < device->spriteInfo->sprite->spriteTraceGood)
if (device->spriteInfo->sprite->spriteTrace[i++] == ancestor)
break;
@@ -4043,37 +3897,32 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor)
goto out;
}
- if (focus)
- {
- for (; i < focus->traceGood; i++)
- {
- pWin = focus->trace[i];
- if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event,
- sendCore, TRUE))
- {
- ret = TRUE;
- goto out;
- }
- }
-
- if ((focus->win == NoneWin) ||
- (i >= device->spriteInfo->sprite->spriteTraceGood) ||
- (pWin && pWin != device->spriteInfo->sprite->spriteTrace[i-1]))
- goto out;
- }
-
- for (; i < device->spriteInfo->sprite->spriteTraceGood; i++)
- {
- pWin = device->spriteInfo->sprite->spriteTrace[i];
- if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event,
- sendCore, TRUE))
- {
- ret = TRUE;
- goto out;
- }
+ if (focus) {
+ for (; i < focus->traceGood; i++) {
+ pWin = focus->trace[i];
+ if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event,
+ sendCore, TRUE)) {
+ ret = TRUE;
+ goto out;
+ }
+ }
+
+ if ((focus->win == NoneWin) ||
+ (i >= device->spriteInfo->sprite->spriteTraceGood) ||
+ (pWin && pWin != device->spriteInfo->sprite->spriteTrace[i - 1]))
+ goto out;
+ }
+
+ for (; i < device->spriteInfo->sprite->spriteTraceGood; i++) {
+ pWin = device->spriteInfo->sprite->spriteTrace[i];
+ if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event,
+ sendCore, TRUE)) {
+ ret = TRUE;
+ goto out;
+ }
}
-out:
+ out:
if (ret == TRUE && event->type == ET_KeyPress)
device->deviceGrab.activatingKey = event->detail.key;
return ret;
@@ -4101,78 +3950,81 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
int deliveries = 0;
if (focus == FollowKeyboardWin)
- focus = inputInfo.keyboard->focus->win;
+ focus = inputInfo.keyboard->focus->win;
if (!focus)
- return;
- if (focus == PointerRootWin)
- {
- DeliverDeviceEvents(window, event, NullGrab, NullWindow, keybd);
- return;
+ return;
+ if (focus == PointerRootWin) {
+ DeliverDeviceEvents(window, event, NullGrab, NullWindow, keybd);
+ return;
}
- if ((focus == window) || IsParent(focus, window))
- {
- if (DeliverDeviceEvents(window, event, NullGrab, focus, keybd))
- return;
+ if ((focus == window) || IsParent(focus, window)) {
+ if (DeliverDeviceEvents(window, event, NullGrab, focus, keybd))
+ return;
}
/* just deliver it to the focus window */
ptr = GetMaster(keybd, POINTER_OR_FLOAT);
rc = EventToXI2(event, &xi2);
- if (rc == Success)
- {
+ if (rc == Success) {
/* XXX: XACE */
int filter = GetEventFilter(keybd, xi2);
+
FixUpEventFromWindow(ptr->spriteInfo->sprite, xi2, focus, None, FALSE);
deliveries = DeliverEventsToWindow(keybd, focus, xi2, 1,
filter, NullGrab);
if (deliveries > 0)
goto unwind;
- } else if (rc != BadMatch)
- ErrorF("[dix] %s: XI2 conversion failed in DFE (%d, %d). Skipping delivery.\n",
- keybd->name, event->any.type, rc);
+ }
+ else if (rc != BadMatch)
+ ErrorF
+ ("[dix] %s: XI2 conversion failed in DFE (%d, %d). Skipping delivery.\n",
+ keybd->name, event->any.type, rc);
rc = EventToXI(event, &xE, &count);
if (rc == Success &&
- XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count) == Success)
- {
+ XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count) == Success) {
FixUpEventFromWindow(ptr->spriteInfo->sprite, xE, focus, None, FALSE);
deliveries = DeliverEventsToWindow(keybd, focus, xE, count,
- GetEventFilter(keybd, xE),
- NullGrab);
+ GetEventFilter(keybd, xE), NullGrab);
if (deliveries > 0)
goto unwind;
- } else if (rc != BadMatch)
- ErrorF("[dix] %s: XI conversion failed in DFE (%d, %d). Skipping delivery.\n",
- keybd->name, event->any.type, rc);
+ }
+ else if (rc != BadMatch)
+ ErrorF
+ ("[dix] %s: XI conversion failed in DFE (%d, %d). Skipping delivery.\n",
+ keybd->name, event->any.type, rc);
- if (sendCore)
- {
+ if (sendCore) {
rc = EventToCore(event, &core, &count);
if (rc == Success) {
- if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, core, count) == Success) {
+ if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, core, count) ==
+ Success) {
FixUpEventFromWindow(keybd->spriteInfo->sprite, core, focus,
None, FALSE);
- deliveries = DeliverEventsToWindow(keybd, focus, core, count,
- GetEventFilter(keybd, core),
- NullGrab);
+ deliveries =
+ DeliverEventsToWindow(keybd, focus, core, count,
+ GetEventFilter(keybd, core),
+ NullGrab);
}
- } else if (rc != BadMatch)
- ErrorF("[dix] %s: core conversion failed DFE (%d, %d). Skipping delivery.\n",
- keybd->name, event->any.type, rc);
+ }
+ else if (rc != BadMatch)
+ ErrorF
+ ("[dix] %s: core conversion failed DFE (%d, %d). Skipping delivery.\n",
+ keybd->name, event->any.type, rc);
}
-unwind:
+ unwind:
free(core);
free(xE);
free(xi2);
return;
}
-
int
-DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level)
+DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev,
+ enum InputLevel level)
{
SpritePtr pSprite = dev->spriteInfo->sprite;
int rc;
@@ -4184,61 +4036,58 @@ DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel l
GrabPtr grab = grabinfo->grab;
Mask filter;
- switch(level)
- {
- case XI2:
- rc = EventToXI2(event, &xE);
- count = 1;
- if (rc == Success)
- {
- int evtype = xi2_get_type(xE);
- mask = GetXI2MaskByte(grab->xi2mask, dev, evtype);
- filter = GetEventFilter(dev, xE);
- }
- break;
- case XI:
- if (grabinfo->fromPassiveGrab && grabinfo->implicitGrab)
- mask = grab->deviceMask;
- else
- mask = grab->eventMask;
- rc = EventToXI(event, &xE, &count);
- if (rc == Success)
- filter = GetEventFilter(dev, xE);
- break;
- case CORE:
- rc = EventToCore(event, &xE, &count);
+ switch (level) {
+ case XI2:
+ rc = EventToXI2(event, &xE);
+ count = 1;
+ if (rc == Success) {
+ int evtype = xi2_get_type(xE);
+
+ mask = GetXI2MaskByte(grab->xi2mask, dev, evtype);
+ filter = GetEventFilter(dev, xE);
+ }
+ break;
+ case XI:
+ if (grabinfo->fromPassiveGrab && grabinfo->implicitGrab)
+ mask = grab->deviceMask;
+ else
mask = grab->eventMask;
- if (rc == Success)
- filter = GetEventFilter(dev, xE);
- break;
- default:
- BUG_WARN_MSG(1, "Invalid input level %d\n", level);
- return 0;
+ rc = EventToXI(event, &xE, &count);
+ if (rc == Success)
+ filter = GetEventFilter(dev, xE);
+ break;
+ case CORE:
+ rc = EventToCore(event, &xE, &count);
+ mask = grab->eventMask;
+ if (rc == Success)
+ filter = GetEventFilter(dev, xE);
+ break;
+ default:
+ BUG_WARN_MSG(1, "Invalid input level %d\n", level);
+ return 0;
}
- if (rc == Success)
- {
+ if (rc == Success) {
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
if (XaceHook(XACE_SEND_ACCESS, 0, dev,
- grab->window, xE, count) ||
- XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
- grab->window, xE, count))
- deliveries = 1; /* don't send, but pretend we did */
- else if (level != CORE || !IsInterferingGrab(rClient(grab), dev, xE))
- {
+ grab->window, xE, count) ||
+ XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
+ grab->window, xE, count))
+ deliveries = 1; /* don't send, but pretend we did */
+ else if (level != CORE || !IsInterferingGrab(rClient(grab), dev, xE)) {
deliveries = TryClientEvents(rClient(grab), dev,
- xE, count, mask, filter,
- grab);
+ xE, count, mask, filter, grab);
}
- } else
- BUG_WARN_MSG(rc != BadMatch, "%s: conversion to mode %d failed on %d with %d\n",
- dev->name, level, event->any.type, rc);
+ }
+ else
+ BUG_WARN_MSG(rc != BadMatch,
+ "%s: conversion to mode %d failed on %d with %d\n",
+ dev->name, level, event->any.type, rc);
free(xE);
return deliveries;
}
-
/**
* Deliver an event from a device that is currently grabbed. Uses
* DeliverDeviceEvents() for further delivery if a ownerEvents is set on the
@@ -4262,9 +4111,8 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
grabinfo = &thisDev->deviceGrab;
grab = grabinfo->grab;
- if (grab->ownerEvents)
- {
- WindowPtr focus;
+ if (grab->ownerEvents) {
+ WindowPtr focus;
/* Hack: Some pointer device have a focus class. So we need to check
* for the type of event, to see if we really want to deliver it to
@@ -4272,27 +4120,25 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
*/
if (IsPointerEvent(event))
focus = PointerRootWin;
- else if (thisDev->focus)
- {
- focus = thisDev->focus->win;
- if (focus == FollowKeyboardWin)
- focus = inputInfo.keyboard->focus->win;
- }
- else
- focus = PointerRootWin;
- if (focus == PointerRootWin)
- deliveries = DeliverDeviceEvents(pSprite->win, event, grab,
+ else if (thisDev->focus) {
+ focus = thisDev->focus->win;
+ if (focus == FollowKeyboardWin)
+ focus = inputInfo.keyboard->focus->win;
+ }
+ else
+ focus = PointerRootWin;
+ if (focus == PointerRootWin)
+ deliveries = DeliverDeviceEvents(pSprite->win, event, grab,
NullWindow, thisDev);
- else if (focus && (focus == pSprite->win ||
- IsParent(focus, pSprite->win)))
- deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus,
- thisDev);
- else if (focus)
- deliveries = DeliverDeviceEvents(focus, event, grab, focus,
- thisDev);
- }
- if (!deliveries)
- {
+ else if (focus && (focus == pSprite->win ||
+ IsParent(focus, pSprite->win)))
+ deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus,
+ thisDev);
+ else if (focus)
+ deliveries = DeliverDeviceEvents(focus, event, grab, focus,
+ thisDev);
+ }
+ if (!deliveries) {
/* XXX: In theory, we could pass the internal events through to
* everything and only convert just before hitting the wire. We can't
* do that yet, so DGE is the last stop for internal events. From here
@@ -4301,47 +4147,41 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
sendCore = (IsMaster(thisDev) && thisDev->coreEvents);
/* try core event */
- if (sendCore && grab->grabtype == CORE)
- {
+ if (sendCore && grab->grabtype == CORE) {
deliveries = DeliverOneGrabbedEvent(event, thisDev, CORE);
}
- if (!deliveries)
- {
+ if (!deliveries) {
deliveries = DeliverOneGrabbedEvent(event, thisDev, XI2);
}
- if (!deliveries)
- {
+ if (!deliveries) {
deliveries = DeliverOneGrabbedEvent(event, thisDev, XI);
}
if (deliveries && (event->any.type == ET_Motion))
thisDev->valuator->motionHintWindow = grab->window;
}
- if (deliveries && !deactivateGrab && event->any.type != ET_Motion)
- {
- switch (grabinfo->sync.state)
- {
- case FREEZE_BOTH_NEXT_EVENT:
- dev = GetPairedDevice(thisDev);
- if (dev)
- {
- FreezeThaw(dev, TRUE);
- if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) &&
- (CLIENT_BITS(grab->resource) ==
- CLIENT_BITS(dev->deviceGrab.grab->resource)))
- dev->deviceGrab.sync.state = FROZEN_NO_EVENT;
- else
+ if (deliveries && !deactivateGrab && event->any.type != ET_Motion) {
+ switch (grabinfo->sync.state) {
+ case FREEZE_BOTH_NEXT_EVENT:
+ dev = GetPairedDevice(thisDev);
+ if (dev) {
+ FreezeThaw(dev, TRUE);
+ if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) &&
+ (CLIENT_BITS(grab->resource) ==
+ CLIENT_BITS(dev->deviceGrab.grab->resource)))
+ dev->deviceGrab.sync.state = FROZEN_NO_EVENT;
+ else
dev->deviceGrab.sync.other = grab;
- }
- /* fall through */
- case FREEZE_NEXT_EVENT:
- grabinfo->sync.state = FROZEN_WITH_EVENT;
- FreezeThaw(thisDev, TRUE);
- *grabinfo->sync.event = event->device_event;
- break;
- }
+ }
+ /* fall through */
+ case FREEZE_NEXT_EVENT:
+ grabinfo->sync.state = FROZEN_WITH_EVENT;
+ FreezeThaw(thisDev, TRUE);
+ *grabinfo->sync.event = event->device_event;
+ break;
+ }
}
return deliveries;
@@ -4352,12 +4192,12 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
the device's processInputProc to be called, as in for example Mouse Keys.
*/
void
-FixKeyState (DeviceEvent *event, DeviceIntPtr keybd)
+FixKeyState(DeviceEvent *event, DeviceIntPtr keybd)
{
int key = event->detail.key;
if (event->type == ET_KeyPress) {
- DebugF("FixKeyState: Key %d %s\n",key,
+ DebugF("FixKeyState: Key %d %s\n", key,
((event->type == ET_KeyPress) ? "down" : "up"));
}
@@ -4393,32 +4233,28 @@ RecalculateDeliverableEvents(WindowPtr pWin)
WindowPtr pChild;
pChild = pWin;
- while (1)
- {
- if (pChild->optional)
- {
- pChild->optional->otherEventMasks = 0;
- for (others = wOtherClients(pChild); others; others = others->next)
- {
- pChild->optional->otherEventMasks |= others->mask;
- }
- }
- pChild->deliverableEvents = pChild->eventMask|
- wOtherEventMasks(pChild);
- if (pChild->parent)
- pChild->deliverableEvents |=
- (pChild->parent->deliverableEvents &
- ~wDontPropagateMask(pChild) & PropagateMask);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- break;
- pChild = pChild->nextSib;
+ while (1) {
+ if (pChild->optional) {
+ pChild->optional->otherEventMasks = 0;
+ for (others = wOtherClients(pChild); others; others = others->next) {
+ pChild->optional->otherEventMasks |= others->mask;
+ }
+ }
+ pChild->deliverableEvents = pChild->eventMask |
+ wOtherEventMasks(pChild);
+ if (pChild->parent)
+ pChild->deliverableEvents |=
+ (pChild->parent->deliverableEvents &
+ ~wDontPropagateMask(pChild) & PropagateMask);
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ break;
+ pChild = pChild->nextSib;
}
}
@@ -4430,107 +4266,93 @@ int
OtherClientGone(pointer value, XID id)
{
OtherClientsPtr other, prev;
- WindowPtr pWin = (WindowPtr)value;
+ WindowPtr pWin = (WindowPtr) value;
prev = 0;
- for (other = wOtherClients(pWin); other; other = other->next)
- {
- if (other->resource == id)
- {
- if (prev)
- prev->next = other->next;
- else
- {
- if (!(pWin->optional->otherClients = other->next))
- CheckWindowOptionalNeed (pWin);
- }
- free(other);
- RecalculateDeliverableEvents(pWin);
- return Success;
- }
- prev = other;
+ for (other = wOtherClients(pWin); other; other = other->next) {
+ if (other->resource == id) {
+ if (prev)
+ prev->next = other->next;
+ else {
+ if (!(pWin->optional->otherClients = other->next))
+ CheckWindowOptionalNeed(pWin);
+ }
+ free(other);
+ RecalculateDeliverableEvents(pWin);
+ return Success;
+ }
+ prev = other;
}
FatalError("client not on event list");
- /*NOTREACHED*/
- return -1; /* make compiler happy */
+ /*NOTREACHED*/ return -1; /* make compiler happy */
}
int
EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
{
Mask check;
- OtherClients * others;
+ OtherClients *others;
DeviceIntPtr dev;
int rc;
- if (mask & ~AllEventMasks)
- {
- client->errorValue = mask;
- return BadValue;
+ if (mask & ~AllEventMasks) {
+ client->errorValue = mask;
+ return BadValue;
}
check = (mask & ManagerMask);
if (check) {
- rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
- RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess);
- if (rc != Success)
- return rc;
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
+ RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess);
+ if (rc != Success)
+ return rc;
}
check = (mask & AtMostOneClient);
- if (check & (pWin->eventMask|wOtherEventMasks(pWin)))
- { /* It is illegal for two different
- clients to select on any of the
- events for AtMostOneClient. However,
- it is OK, for some client to
- continue selecting on one of those
- events. */
- if ((wClient(pWin) != client) && (check & pWin->eventMask))
- return BadAccess;
- for (others = wOtherClients (pWin); others; others = others->next)
- {
- if (!SameClient(others, client) && (check & others->mask))
- return BadAccess;
- }
- }
- if (wClient (pWin) == client)
- {
- check = pWin->eventMask;
- pWin->eventMask = mask;
+ if (check & (pWin->eventMask | wOtherEventMasks(pWin))) { /* It is illegal for two different
+ clients to select on any of the
+ events for AtMostOneClient. However,
+ it is OK, for some client to
+ continue selecting on one of those
+ events. */
+ if ((wClient(pWin) != client) && (check & pWin->eventMask))
+ return BadAccess;
+ for (others = wOtherClients(pWin); others; others = others->next) {
+ if (!SameClient(others, client) && (check & others->mask))
+ return BadAccess;
+ }
}
- else
- {
- for (others = wOtherClients (pWin); others; others = others->next)
- {
- if (SameClient(others, client))
- {
- check = others->mask;
- if (mask == 0)
- {
- FreeResource(others->resource, RT_NONE);
- return Success;
- }
- else
- others->mask = mask;
- goto maskSet;
- }
- }
- check = 0;
- if (!pWin->optional && !MakeWindowOptional (pWin))
- return BadAlloc;
- others = malloc(sizeof(OtherClients));
- if (!others)
- return BadAlloc;
- others->mask = mask;
- others->resource = FakeClientID(client->index);
- others->next = pWin->optional->otherClients;
- pWin->optional->otherClients = others;
- if (!AddResource(others->resource, RT_OTHERCLIENT, (pointer)pWin))
- return BadAlloc;
- }
-maskSet:
- if ((mask & PointerMotionHintMask) && !(check & PointerMotionHintMask))
- {
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ if (wClient(pWin) == client) {
+ check = pWin->eventMask;
+ pWin->eventMask = mask;
+ }
+ else {
+ for (others = wOtherClients(pWin); others; others = others->next) {
+ if (SameClient(others, client)) {
+ check = others->mask;
+ if (mask == 0) {
+ FreeResource(others->resource, RT_NONE);
+ return Success;
+ }
+ else
+ others->mask = mask;
+ goto maskSet;
+ }
+ }
+ check = 0;
+ if (!pWin->optional && !MakeWindowOptional(pWin))
+ return BadAlloc;
+ others = malloc(sizeof(OtherClients));
+ if (!others)
+ return BadAlloc;
+ others->mask = mask;
+ others->resource = FakeClientID(client->index);
+ others->next = pWin->optional->otherClients;
+ pWin->optional->otherClients = others;
+ if (!AddResource(others->resource, RT_OTHERCLIENT, (pointer) pWin))
+ return BadAlloc;
+ }
+ maskSet:
+ if ((mask & PointerMotionHintMask) && !(check & PointerMotionHintMask)) {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
if (dev->valuator && dev->valuator->motionHintWindow == pWin)
dev->valuator->motionHintWindow = NullWindow;
}
@@ -4545,50 +4367,42 @@ EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
{
int i, free;
- if (mask & ~PropagateMask)
- {
- client->errorValue = mask;
- return BadValue;
+ if (mask & ~PropagateMask) {
+ client->errorValue = mask;
+ return BadValue;
}
if (pWin->dontPropagate)
- DontPropagateRefCnts[pWin->dontPropagate]--;
+ DontPropagateRefCnts[pWin->dontPropagate]--;
if (!mask)
- i = 0;
- else
- {
- for (i = DNPMCOUNT, free = 0; --i > 0; )
- {
- if (!DontPropagateRefCnts[i])
- free = i;
- else if (mask == DontPropagateMasks[i])
- break;
- }
- if (!i && free)
- {
- i = free;
- DontPropagateMasks[i] = mask;
- }
- }
- if (i || !mask)
- {
- pWin->dontPropagate = i;
- if (i)
- DontPropagateRefCnts[i]++;
- if (pWin->optional)
- {
- pWin->optional->dontPropagateMask = mask;
- *checkOptional = TRUE;
- }
+ i = 0;
+ else {
+ for (i = DNPMCOUNT, free = 0; --i > 0;) {
+ if (!DontPropagateRefCnts[i])
+ free = i;
+ else if (mask == DontPropagateMasks[i])
+ break;
+ }
+ if (!i && free) {
+ i = free;
+ DontPropagateMasks[i] = mask;
+ }
}
- else
- {
- if (!pWin->optional && !MakeWindowOptional (pWin))
- {
- if (pWin->dontPropagate)
- DontPropagateRefCnts[pWin->dontPropagate]++;
- return BadAlloc;
- }
- pWin->dontPropagate = 0;
+ if (i || !mask) {
+ pWin->dontPropagate = i;
+ if (i)
+ DontPropagateRefCnts[i]++;
+ if (pWin->optional) {
+ pWin->optional->dontPropagateMask = mask;
+ *checkOptional = TRUE;
+ }
+ }
+ else {
+ if (!pWin->optional && !MakeWindowOptional(pWin)) {
+ if (pWin->dontPropagate)
+ DontPropagateRefCnts[pWin->dontPropagate]++;
+ return BadAlloc;
+ }
+ pWin->dontPropagate = 0;
pWin->optional->dontPropagateMask = mask;
}
RecalculateDeliverableEvents(pWin);
@@ -4600,34 +4414,28 @@ EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
* Uses the paired keyboard to get some additional information.
*/
void
-CoreEnterLeaveEvent(
- DeviceIntPtr mouse,
- int type,
- int mode,
- int detail,
- WindowPtr pWin,
- Window child)
+CoreEnterLeaveEvent(DeviceIntPtr mouse,
+ int type,
+ int mode, int detail, WindowPtr pWin, Window child)
{
- xEvent event;
- WindowPtr focus;
- DeviceIntPtr keybd;
- GrabPtr grab = mouse->deviceGrab.grab;
- Mask mask;
+ xEvent event;
+ WindowPtr focus;
+ DeviceIntPtr keybd;
+ GrabPtr grab = mouse->deviceGrab.grab;
+ Mask mask;
keybd = GetMaster(mouse, KEYBOARD_OR_FLOAT);
if ((pWin == mouse->valuator->motionHintWindow) &&
- (detail != NotifyInferior))
- mouse->valuator->motionHintWindow = NullWindow;
- if (grab)
- {
- mask = (pWin == grab->window) ? grab->eventMask : 0;
- if (grab->ownerEvents)
- mask |= EventMaskForClient(pWin, rClient(grab));
+ (detail != NotifyInferior))
+ mouse->valuator->motionHintWindow = NullWindow;
+ if (grab) {
+ mask = (pWin == grab->window) ? grab->eventMask : 0;
+ if (grab->ownerEvents)
+ mask |= EventMaskForClient(pWin, rClient(grab));
}
- else
- {
- mask = pWin->eventMask | wOtherEventMasks(pWin);
+ else {
+ mask = pWin->eventMask | wOtherEventMasks(pWin);
}
memset(&event, 0, sizeof(xEvent));
@@ -4642,62 +4450,56 @@ CoreEnterLeaveEvent(
event.u.enterLeave.child = child;
event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ?
ELFlagSameScreen : 0;
- event.u.enterLeave.state = mouse->button ? (mouse->button->state & 0x1f00) : 0;
+ event.u.enterLeave.state =
+ mouse->button ? (mouse->button->state & 0x1f00) : 0;
if (keybd)
event.u.enterLeave.state |=
- XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
+ XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
event.u.enterLeave.mode = mode;
focus = (keybd) ? keybd->focus->win : None;
if ((focus != NoneWin) &&
- ((pWin == focus) || (focus == PointerRootWin) ||
- IsParent(focus, pWin)))
+ ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin)))
event.u.enterLeave.flags |= ELFlagFocus;
- if ((mask & GetEventFilter(mouse, &event)))
- {
+ if ((mask & GetEventFilter(mouse, &event))) {
if (grab)
TryClientEvents(rClient(grab), mouse, &event, 1, mask,
GetEventFilter(mouse, &event), grab);
else
DeliverEventsToWindow(mouse, pWin, &event, 1,
- GetEventFilter(mouse, &event),
- NullGrab);
+ GetEventFilter(mouse, &event), NullGrab);
}
- if ((type == EnterNotify) && (mask & KeymapStateMask))
- {
+ if ((type == EnterNotify) && (mask & KeymapStateMask)) {
xKeymapEvent ke;
ClientPtr client = grab ? rClient(grab) : wClient(pWin);
+
if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess))
- memset((char *)&ke.map[0], 0, 31);
+ memset((char *) &ke.map[0], 0, 31);
else
- memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31);
+ memmove((char *) &ke.map[0], (char *) &keybd->key->down[1], 31);
ke.type = KeymapNotify;
if (grab)
- TryClientEvents(rClient(grab), keybd, (xEvent *)&ke, 1,
+ TryClientEvents(rClient(grab), keybd, (xEvent *) &ke, 1,
mask, KeymapStateMask, grab);
else
- DeliverEventsToWindow(mouse, pWin, (xEvent *)&ke, 1,
+ DeliverEventsToWindow(mouse, pWin, (xEvent *) &ke, 1,
KeymapStateMask, NullGrab);
}
}
void
-DeviceEnterLeaveEvent(
- DeviceIntPtr mouse,
- int sourceid,
- int type,
- int mode,
- int detail,
- WindowPtr pWin,
- Window child)
+DeviceEnterLeaveEvent(DeviceIntPtr mouse,
+ int sourceid,
+ int type,
+ int mode, int detail, WindowPtr pWin, Window child)
{
- GrabPtr grab = mouse->deviceGrab.grab;
- xXIEnterEvent *event;
- int filter;
- int btlen, len, i;
- DeviceIntPtr kbd;
+ GrabPtr grab = mouse->deviceGrab.grab;
+ xXIEnterEvent *event;
+ int filter;
+ int btlen, len, i;
+ DeviceIntPtr kbd;
if ((mode == XINotifyPassiveGrab && type == XI_Leave) ||
(mode == XINotifyPassiveUngrab && type == XI_Enter))
@@ -4708,26 +4510,25 @@ DeviceEnterLeaveEvent(
len = sizeof(xXIEnterEvent) + btlen * 4;
event = calloc(1, len);
- event->type = GenericEvent;
- event->extension = IReqCode;
- event->evtype = type;
- event->length = (len - sizeof(xEvent))/4;
- event->buttons_len = btlen;
- event->detail = detail;
- event->time = currentTime.milliseconds;
- event->deviceid = mouse->id;
- event->sourceid = sourceid;
- event->mode = mode;
- event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0);
- event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0);
+ event->type = GenericEvent;
+ event->extension = IReqCode;
+ event->evtype = type;
+ event->length = (len - sizeof(xEvent)) / 4;
+ event->buttons_len = btlen;
+ event->detail = detail;
+ event->time = currentTime.milliseconds;
+ event->deviceid = mouse->id;
+ event->sourceid = sourceid;
+ event->mode = mode;
+ event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0);
+ event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0);
for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
if (BitIsOn(mouse->button->down, i))
SetBit(&event[1], i);
kbd = GetMaster(mouse, MASTER_KEYBOARD);
- if (kbd && kbd->key)
- {
+ if (kbd && kbd->key) {
event->mods.base_mods = kbd->key->xkbInfo->state.base_mods;
event->mods.latched_mods = kbd->key->xkbInfo->state.latched_mods;
event->mods.locked_mods = kbd->key->xkbInfo->state.locked_mods;
@@ -4737,24 +4538,26 @@ DeviceEnterLeaveEvent(
event->group.locked_group = kbd->key->xkbInfo->state.locked_group;
}
- FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent*)event, pWin,
+ FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent *) event, pWin,
None, FALSE);
- filter = GetEventFilter(mouse, (xEvent*)event);
+ filter = GetEventFilter(mouse, (xEvent *) event);
- if (grab)
- {
+ if (grab) {
Mask mask;
+
mask = xi2mask_isset(grab->xi2mask, mouse, type);
- TryClientEvents(rClient(grab), mouse, (xEvent*)event, 1, mask, 1, grab);
- } else {
- if (!WindowXI2MaskIsset(mouse, pWin, (xEvent*)event))
+ TryClientEvents(rClient(grab), mouse, (xEvent *) event, 1, mask, 1,
+ grab);
+ }
+ else {
+ if (!WindowXI2MaskIsset(mouse, pWin, (xEvent *) event))
goto out;
- DeliverEventsToWindow(mouse, pWin, (xEvent*)event, 1, filter,
+ DeliverEventsToWindow(mouse, pWin, (xEvent *) event, 1, filter,
NullGrab);
}
-out:
+ out:
free(event);
}
@@ -4772,18 +4575,18 @@ CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
DeliverEventsToWindow(dev, pWin, &event, 1,
GetEventFilter(dev, &event), NullGrab);
if ((type == FocusIn) &&
- ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask))
- {
+ ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) {
xKeymapEvent ke;
ClientPtr client = wClient(pWin);
+
if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess))
- memset((char *)&ke.map[0], 0, 31);
+ memset((char *) &ke.map[0], 0, 31);
else
- memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31);
+ memmove((char *) &ke.map[0], (char *) &dev->key->down[1], 31);
ke.type = KeymapNotify;
- DeliverEventsToWindow(dev, pWin, (xEvent *)&ke, 1,
- KeymapStateMask, NullGrab);
+ DeliverEventsToWindow(dev, pWin, (xEvent *) &ke, 1,
+ KeymapStateMask, NullGrab);
}
}
@@ -4805,90 +4608,81 @@ CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
* @param followOK True if pointer is allowed to follow the keyboard.
*/
int
-SetInputFocus(
- ClientPtr client,
- DeviceIntPtr dev,
- Window focusID,
- CARD8 revertTo,
- Time ctime,
- Bool followOK)
+SetInputFocus(ClientPtr client,
+ DeviceIntPtr dev,
+ Window focusID, CARD8 revertTo, Time ctime, Bool followOK)
{
FocusClassPtr focus;
WindowPtr focusWin;
int mode, rc;
TimeStamp time;
- DeviceIntPtr keybd; /* used for FollowKeyboard or FollowKeyboardWin */
-
+ DeviceIntPtr keybd; /* used for FollowKeyboard or FollowKeyboardWin */
UpdateCurrentTime();
if ((revertTo != RevertToParent) &&
- (revertTo != RevertToPointerRoot) &&
- (revertTo != RevertToNone) &&
- ((revertTo != RevertToFollowKeyboard) || !followOK))
- {
- client->errorValue = revertTo;
- return BadValue;
+ (revertTo != RevertToPointerRoot) &&
+ (revertTo != RevertToNone) &&
+ ((revertTo != RevertToFollowKeyboard) || !followOK)) {
+ client->errorValue = revertTo;
+ return BadValue;
}
time = ClientTimeToServerTime(ctime);
keybd = GetMaster(dev, KEYBOARD_OR_FLOAT);
if ((focusID == None) || (focusID == PointerRoot))
- focusWin = (WindowPtr)(long)focusID;
- else if ((focusID == FollowKeyboard) && followOK)
- {
- focusWin = keybd->focus->win;
+ focusWin = (WindowPtr) (long) focusID;
+ else if ((focusID == FollowKeyboard) && followOK) {
+ focusWin = keybd->focus->win;
}
else {
- rc = dixLookupWindow(&focusWin, focusID, client, DixSetAttrAccess);
- if (rc != Success)
- return rc;
- /* It is a match error to try to set the input focus to an
- unviewable window. */
- if(!focusWin->realized)
- return BadMatch;
+ rc = dixLookupWindow(&focusWin, focusID, client, DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
+ /* It is a match error to try to set the input focus to an
+ unviewable window. */
+ if (!focusWin->realized)
+ return BadMatch;
}
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixSetFocusAccess);
if (rc != Success)
- return Success;
+ return Success;
focus = dev->focus;
if ((CompareTimeStamps(time, currentTime) == LATER) ||
- (CompareTimeStamps(time, focus->time) == EARLIER))
- return Success;
+ (CompareTimeStamps(time, focus->time) == EARLIER))
+ return Success;
mode = (dev->deviceGrab.grab) ? NotifyWhileGrabbed : NotifyNormal;
- if (focus->win == FollowKeyboardWin)
- {
+ if (focus->win == FollowKeyboardWin) {
if (!ActivateFocusInGrab(dev, keybd->focus->win, focusWin))
DoFocusEvents(dev, keybd->focus->win, focusWin, mode);
- } else
- {
+ }
+ else {
if (!ActivateFocusInGrab(dev, focus->win, focusWin))
DoFocusEvents(dev, focus->win, focusWin, mode);
}
focus->time = time;
focus->revert = revertTo;
if (focusID == FollowKeyboard)
- focus->win = FollowKeyboardWin;
+ focus->win = FollowKeyboardWin;
else
- focus->win = focusWin;
+ focus->win = focusWin;
if ((focusWin == NoneWin) || (focusWin == PointerRootWin))
- focus->traceGood = 0;
- else
- {
+ focus->traceGood = 0;
+ else {
int depth = 0;
- WindowPtr pWin;
-
- for (pWin = focusWin; pWin; pWin = pWin->parent) depth++;
- if (depth > focus->traceSize)
- {
- focus->traceSize = depth+1;
- focus->trace = realloc(focus->trace,
- focus->traceSize * sizeof(WindowPtr));
- }
- focus->traceGood = depth;
+ WindowPtr pWin;
+
+ for (pWin = focusWin; pWin; pWin = pWin->parent)
+ depth++;
+ if (depth > focus->traceSize) {
+ focus->traceSize = depth + 1;
+ focus->trace = realloc(focus->trace,
+ focus->traceSize * sizeof(WindowPtr));
+ }
+ focus->traceGood = depth;
for (pWin = focusWin, depth--; pWin; pWin = pWin->parent, depth--)
- focus->trace[depth] = pWin;
+ focus->trace[depth] = pWin;
}
return Success;
}
@@ -4902,12 +4696,13 @@ int
ProcSetInputFocus(ClientPtr client)
{
DeviceIntPtr kbd = PickKeyboard(client);
+
REQUEST(xSetInputFocusReq);
REQUEST_SIZE_MATCH(xSetInputFocusReq);
return SetInputFocus(client, kbd, stuff->focus,
- stuff->revertTo, stuff->time, FALSE);
+ stuff->revertTo, stuff->time, FALSE);
}
/**
@@ -4923,22 +4718,24 @@ ProcGetInputFocus(ClientPtr client)
xGetInputFocusReply rep;
FocusClassPtr focus = kbd->focus;
int rc;
+
/* REQUEST(xReq); */
REQUEST_SIZE_MATCH(xReq);
rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetFocusAccess);
if (rc != Success)
- return rc;
+ return rc;
memset(&rep, 0, sizeof(xGetInputFocusReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (focus->win == NoneWin)
- rep.focus = None;
+ rep.focus = None;
else if (focus->win == PointerRootWin)
- rep.focus = PointerRoot;
- else rep.focus = focus->win->drawable.id;
+ rep.focus = PointerRoot;
+ else
+ rep.focus = focus->win->drawable.id;
rep.revertTo = focus->revert;
WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep);
return Success;
@@ -4959,34 +4756,32 @@ ProcGrabPointer(ClientPtr client)
GrabMask mask;
WindowPtr confineTo;
CursorPtr oldCursor;
+
REQUEST(xGrabPointerReq);
int rc;
REQUEST_SIZE_MATCH(xGrabPointerReq);
UpdateCurrentTime();
- if (stuff->eventMask & ~PointerGrabMask)
- {
- client->errorValue = stuff->eventMask;
+ if (stuff->eventMask & ~PointerGrabMask) {
+ client->errorValue = stuff->eventMask;
return BadValue;
}
if (stuff->confineTo == None)
- confineTo = NullWindow;
- else
- {
- rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
- DixSetAttrAccess);
- if (rc != Success)
- return rc;
+ confineTo = NullWindow;
+ else {
+ rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
+ DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
}
memset(&rep, 0, sizeof(xGrabPointerReply));
oldCursor = NullCursor;
grab = device->deviceGrab.grab;
- if (grab)
- {
+ if (grab) {
if (grab->confineTo && !confineTo)
ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE,
FALSE);
@@ -4997,13 +4792,12 @@ ProcGrabPointer(ClientPtr client)
rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode,
stuff->grabWindow, stuff->ownerEvents, stuff->time,
- &mask, CORE, stuff->cursor,
- stuff->confineTo, &rep.status);
+ &mask, CORE, stuff->cursor, stuff->confineTo, &rep.status);
if (rc != Success)
return rc;
if (oldCursor && rep.status == GrabSuccess)
- FreeCursor (oldCursor, (Cursor)0);
+ FreeCursor(oldCursor, (Cursor) 0);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
@@ -5022,48 +4816,47 @@ int
ProcChangeActivePointerGrab(ClientPtr client)
{
DeviceIntPtr device;
- GrabPtr grab;
+ GrabPtr grab;
CursorPtr newCursor, oldCursor;
+
REQUEST(xChangeActivePointerGrabReq);
TimeStamp time;
REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq);
- if (stuff->eventMask & ~PointerGrabMask)
- {
- client->errorValue = stuff->eventMask;
+ if (stuff->eventMask & ~PointerGrabMask) {
+ client->errorValue = stuff->eventMask;
return BadValue;
}
if (stuff->cursor == None)
- newCursor = NullCursor;
- else
- {
- int rc = dixLookupResourceByType((pointer *)&newCursor, stuff->cursor,
- RT_CURSOR, client, DixUseAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->cursor;
- return rc;
- }
+ newCursor = NullCursor;
+ else {
+ int rc = dixLookupResourceByType((pointer *) &newCursor, stuff->cursor,
+ RT_CURSOR, client, DixUseAccess);
+
+ if (rc != Success) {
+ client->errorValue = stuff->cursor;
+ return rc;
+ }
}
device = PickPointer(client);
grab = device->deviceGrab.grab;
if (!grab)
- return Success;
+ return Success;
if (!SameClient(grab, client))
- return Success;
+ return Success;
time = ClientTimeToServerTime(stuff->time);
if ((CompareTimeStamps(time, currentTime) == LATER) ||
- (CompareTimeStamps(time, device->deviceGrab.grabTime) == EARLIER))
- return Success;
+ (CompareTimeStamps(time, device->deviceGrab.grabTime) == EARLIER))
+ return Success;
oldCursor = grab->cursor;
grab->cursor = newCursor;
if (newCursor)
- newCursor->refcnt++;
+ newCursor->refcnt++;
PostNewCursor(device);
if (oldCursor)
- FreeCursor(oldCursor, (Cursor)0);
+ FreeCursor(oldCursor, (Cursor) 0);
grab->eventMask = stuff->eventMask;
return Success;
}
@@ -5079,6 +4872,7 @@ ProcUngrabPointer(ClientPtr client)
DeviceIntPtr device = PickPointer(client);
GrabPtr grab;
TimeStamp time;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
@@ -5087,9 +4881,9 @@ ProcUngrabPointer(ClientPtr client)
time = ClientTimeToServerTime(stuff->id);
if ((CompareTimeStamps(time, currentTime) != LATER) &&
- (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) &&
- (grab) && SameClient(grab, client))
- (*device->deviceGrab.DeactivateGrab)(device);
+ (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) &&
+ (grab) && SameClient(grab, client))
+ (*device->deviceGrab.DeactivateGrab) (device);
return Success;
}
@@ -5126,99 +4920,91 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
CursorPtr cursor;
UpdateCurrentTime();
- if ((keyboard_mode != GrabModeSync) && (keyboard_mode != GrabModeAsync))
- {
- client->errorValue = keyboard_mode;
+ if ((keyboard_mode != GrabModeSync) && (keyboard_mode != GrabModeAsync)) {
+ client->errorValue = keyboard_mode;
return BadValue;
}
- if ((pointer_mode != GrabModeSync) && (pointer_mode != GrabModeAsync))
- {
- client->errorValue = pointer_mode;
+ if ((pointer_mode != GrabModeSync) && (pointer_mode != GrabModeAsync)) {
+ client->errorValue = pointer_mode;
return BadValue;
}
- if ((ownerEvents != xFalse) && (ownerEvents != xTrue))
- {
- client->errorValue = ownerEvents;
+ if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) {
+ client->errorValue = ownerEvents;
return BadValue;
}
rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (confineToWin == None)
- confineTo = NullWindow;
- else
- {
- rc = dixLookupWindow(&confineTo, confineToWin, client,
- DixSetAttrAccess);
- if (rc != Success)
- return rc;
+ confineTo = NullWindow;
+ else {
+ rc = dixLookupWindow(&confineTo, confineToWin, client,
+ DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
}
if (curs == None)
- cursor = NullCursor;
- else
- {
- rc = dixLookupResourceByType((pointer *)&cursor, curs, RT_CURSOR,
- client, DixUseAccess);
- if (rc != Success)
- {
- client->errorValue = curs;
- return rc;
- }
- access_mode |= DixForceAccess;
+ cursor = NullCursor;
+ else {
+ rc = dixLookupResourceByType((pointer *) &cursor, curs, RT_CURSOR,
+ client, DixUseAccess);
+ if (rc != Success) {
+ client->errorValue = curs;
+ return rc;
+ }
+ access_mode |= DixForceAccess;
}
if (keyboard_mode == GrabModeSync || pointer_mode == GrabModeSync)
- access_mode |= DixFreezeAccess;
+ access_mode |= DixFreezeAccess;
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc != Success)
- return rc;
+ return rc;
time = ClientTimeToServerTime(ctime);
grab = grabInfo->grab;
if (grab && grab->grabtype != grabtype)
*status = AlreadyGrabbed;
if (grab && !SameClient(grab, client))
- *status = AlreadyGrabbed;
+ *status = AlreadyGrabbed;
else if ((!pWin->realized) ||
(confineTo &&
- !(confineTo->realized
- && BorderSizeNotEmpty(dev, confineTo))))
- *status = GrabNotViewable;
+ !(confineTo->realized && BorderSizeNotEmpty(dev, confineTo))))
+ *status = GrabNotViewable;
else if ((CompareTimeStamps(time, currentTime) == LATER) ||
- (CompareTimeStamps(time, grabInfo->grabTime) == EARLIER))
- *status = GrabInvalidTime;
+ (CompareTimeStamps(time, grabInfo->grabTime) == EARLIER))
+ *status = GrabInvalidTime;
else if (grabInfo->sync.frozen &&
- grabInfo->sync.other && !SameClient(grabInfo->sync.other, client))
- *status = GrabFrozen;
- else
- {
- GrabPtr tempGrab;
-
- tempGrab = AllocGrab();
-
- tempGrab->next = NULL;
- tempGrab->window = pWin;
- tempGrab->resource = client->clientAsMask;
- tempGrab->ownerEvents = ownerEvents;
- tempGrab->keyboardMode = keyboard_mode;
- tempGrab->pointerMode = pointer_mode;
- if (grabtype == CORE)
- tempGrab->eventMask = mask->core;
- else if (grabtype == XI)
- tempGrab->eventMask = mask->xi;
- else
+ grabInfo->sync.other && !SameClient(grabInfo->sync.other, client))
+ *status = GrabFrozen;
+ else {
+ GrabPtr tempGrab;
+
+ tempGrab = AllocGrab();
+
+ tempGrab->next = NULL;
+ tempGrab->window = pWin;
+ tempGrab->resource = client->clientAsMask;
+ tempGrab->ownerEvents = ownerEvents;
+ tempGrab->keyboardMode = keyboard_mode;
+ tempGrab->pointerMode = pointer_mode;
+ if (grabtype == CORE)
+ tempGrab->eventMask = mask->core;
+ else if (grabtype == XI)
+ tempGrab->eventMask = mask->xi;
+ else
xi2mask_merge(tempGrab->xi2mask, mask->xi2mask);
- tempGrab->device = dev;
- tempGrab->cursor = cursor;
- tempGrab->confineTo = confineTo;
- tempGrab->grabtype = grabtype;
- (*grabInfo->ActivateGrab)(dev, tempGrab, time, FALSE);
- *status = GrabSuccess;
+ tempGrab->device = dev;
+ tempGrab->cursor = cursor;
+ tempGrab->confineTo = confineTo;
+ tempGrab->grabtype = grabtype;
+ (*grabInfo->ActivateGrab) (dev, tempGrab, time, FALSE);
+ *status = GrabSuccess;
- FreeGrab(tempGrab);
+ FreeGrab(tempGrab);
}
return Success;
}
@@ -5232,6 +5018,7 @@ int
ProcGrabKeyboard(ClientPtr client)
{
xGrabKeyboardReply rep;
+
REQUEST(xGrabKeyboardReq);
int result;
DeviceIntPtr keyboard = PickKeyboard(client);
@@ -5243,12 +5030,12 @@ ProcGrabKeyboard(ClientPtr client)
mask.core = KeyPressMask | KeyReleaseMask;
result = GrabDevice(client, keyboard, stuff->pointerMode,
- stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents,
- stuff->time, &mask, CORE, None, None,
- &rep.status);
+ stuff->keyboardMode, stuff->grabWindow,
+ stuff->ownerEvents, stuff->time, &mask, CORE, None,
+ None, &rep.status);
if (result != Success)
- return result;
+ return result;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
@@ -5267,6 +5054,7 @@ ProcUngrabKeyboard(ClientPtr client)
DeviceIntPtr device = PickKeyboard(client);
GrabPtr grab;
TimeStamp time;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
@@ -5276,9 +5064,9 @@ ProcUngrabKeyboard(ClientPtr client)
time = ClientTimeToServerTime(stuff->id);
if ((CompareTimeStamps(time, currentTime) != LATER) &&
- (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) &&
- (grab) && SameClient(grab, client) && grab->grabtype == CORE)
- (*device->deviceGrab.DeactivateGrab)(device);
+ (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) &&
+ (grab) && SameClient(grab, client) && grab->grabtype == CORE)
+ (*device->deviceGrab.DeactivateGrab) (device);
return Success;
}
@@ -5297,21 +5085,22 @@ ProcQueryPointer(ClientPtr client)
DeviceIntPtr keyboard;
SpritePtr pSprite;
int rc;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess);
if (rc != Success && rc != BadAccess)
- return rc;
+ return rc;
keyboard = GetMaster(mouse, MASTER_KEYBOARD);
pSprite = mouse->spriteInfo->sprite;
if (mouse->valuator->motionHintWindow)
- MaybeStopHint(mouse, client);
+ MaybeStopHint(mouse, client);
memset(&rep, 0, sizeof(xQueryPointerReply));
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
@@ -5322,43 +5111,40 @@ ProcQueryPointer(ClientPtr client)
rep.rootX = pSprite->hot.x;
rep.rootY = pSprite->hot.y;
rep.child = None;
- if (pSprite->hot.pScreen == pWin->drawable.pScreen)
- {
- rep.sameScreen = xTrue;
- rep.winX = pSprite->hot.x - pWin->drawable.x;
- rep.winY = pSprite->hot.y - pWin->drawable.y;
- for (t = pSprite->win; t; t = t->parent)
- if (t->parent == pWin)
- {
- rep.child = t->drawable.id;
- break;
- }
+ if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
+ rep.sameScreen = xTrue;
+ rep.winX = pSprite->hot.x - pWin->drawable.x;
+ rep.winY = pSprite->hot.y - pWin->drawable.y;
+ for (t = pSprite->win; t; t = t->parent)
+ if (t->parent == pWin) {
+ rep.child = t->drawable.id;
+ break;
+ }
}
- else
- {
- rep.sameScreen = xFalse;
- rep.winX = 0;
- rep.winY = 0;
+ else {
+ rep.sameScreen = xFalse;
+ rep.winX = 0;
+ rep.winY = 0;
}
#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
- rep.rootX += screenInfo.screens[0]->x;
- rep.rootY += screenInfo.screens[0]->y;
- if(stuff->id == rep.root) {
- rep.winX += screenInfo.screens[0]->x;
- rep.winY += screenInfo.screens[0]->y;
- }
+ if (!noPanoramiXExtension) {
+ rep.rootX += screenInfo.screens[0]->x;
+ rep.rootY += screenInfo.screens[0]->y;
+ if (stuff->id == rep.root) {
+ rep.winX += screenInfo.screens[0]->x;
+ rep.winY += screenInfo.screens[0]->y;
+ }
}
#endif
if (rc == BadAccess) {
- rep.mask = 0;
- rep.child = None;
- rep.rootX = 0;
- rep.rootY = 0;
- rep.winX = 0;
- rep.winY = 0;
+ rep.mask = 0;
+ rep.child = None;
+ rep.rootX = 0;
+ rep.rootY = 0;
+ rep.winX = 0;
+ rep.winY = 0;
}
WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep);
@@ -5378,16 +5164,17 @@ InitEvents(void)
QdEventPtr tmp;
inputInfo.numDevices = 0;
- inputInfo.devices = (DeviceIntPtr)NULL;
- inputInfo.off_devices = (DeviceIntPtr)NULL;
- inputInfo.keyboard = (DeviceIntPtr)NULL;
- inputInfo.pointer = (DeviceIntPtr)NULL;
- for (i = 0; i < MAXDEVICES; i++)
- {
+ inputInfo.devices = (DeviceIntPtr) NULL;
+ inputInfo.off_devices = (DeviceIntPtr) NULL;
+ inputInfo.keyboard = (DeviceIntPtr) NULL;
+ inputInfo.pointer = (DeviceIntPtr) NULL;
+
+ for (i = 0; i < MAXDEVICES; i++) {
memcpy(&event_filters[i], default_filter, sizeof(default_filter));
+ lastDeviceEventTime[i] = currentTime;
}
- syncEvents.replayDev = (DeviceIntPtr)NULL;
+ syncEvents.replayDev = (DeviceIntPtr) NULL;
syncEvents.replayWin = NullWindow;
if (syncEvents.pending.next)
xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next)
@@ -5395,14 +5182,12 @@ InitEvents(void)
xorg_list_init(&syncEvents.pending);
syncEvents.playingEvents = FALSE;
syncEvents.time.months = 0;
- syncEvents.time.milliseconds = 0; /* hardly matters */
+ syncEvents.time.milliseconds = 0; /* hardly matters */
currentTime.months = 0;
currentTime.milliseconds = GetTimeInMillis();
- lastDeviceEventTime = currentTime;
- for (i = 0; i < DNPMCOUNT; i++)
- {
- DontPropagateMasks[i] = 0;
- DontPropagateRefCnts[i] = 0;
+ for (i = 0; i < DNPMCOUNT; i++) {
+ DontPropagateMasks[i] = 0;
+ DontPropagateRefCnts[i] = 0;
}
InputEventList = InitEventList(GetMaximumEventsNum());
@@ -5428,10 +5213,11 @@ int
ProcSendEvent(ClientPtr client)
{
WindowPtr pWin;
- WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
+ WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
DeviceIntPtr dev = PickPointer(client);
DeviceIntPtr keybd = GetMaster(dev, MASTER_KEYBOARD);
SpritePtr pSprite = dev->spriteInfo->sprite;
+
REQUEST(xSendEventReq);
REQUEST_SIZE_MATCH(xSendEventReq);
@@ -5447,83 +5233,75 @@ ProcSendEvent(ClientPtr client)
stuff->event.u.u.type &= ~(SEND_EVENT_BIT);
/* The client's event type must be a core event type or one defined by an
- extension. */
+ extension. */
- if ( ! ((stuff->event.u.u.type > X_Reply &&
- stuff->event.u.u.type < LASTEvent) ||
- (stuff->event.u.u.type >= EXTENSION_EVENT_BASE &&
- stuff->event.u.u.type < (unsigned)lastEvent)))
- {
- client->errorValue = stuff->event.u.u.type;
- return BadValue;
+ if (!((stuff->event.u.u.type > X_Reply &&
+ stuff->event.u.u.type < LASTEvent) ||
+ (stuff->event.u.u.type >= EXTENSION_EVENT_BASE &&
+ stuff->event.u.u.type < (unsigned) lastEvent))) {
+ client->errorValue = stuff->event.u.u.type;
+ return BadValue;
}
if (stuff->event.u.u.type == ClientMessage &&
- stuff->event.u.u.detail != 8 &&
- stuff->event.u.u.detail != 16 &&
- stuff->event.u.u.detail != 32)
- {
- client->errorValue = stuff->event.u.u.detail;
- return BadValue;
+ stuff->event.u.u.detail != 8 &&
+ stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
+ client->errorValue = stuff->event.u.u.detail;
+ return BadValue;
}
- if (stuff->eventMask & ~AllEventMasks)
- {
- client->errorValue = stuff->eventMask;
- return BadValue;
+ if (stuff->eventMask & ~AllEventMasks) {
+ client->errorValue = stuff->eventMask;
+ return BadValue;
}
if (stuff->destination == PointerWindow)
- pWin = pSprite->win;
- else if (stuff->destination == InputFocus)
- {
- WindowPtr inputFocus = (keybd) ? keybd->focus->win : NoneWin;
+ pWin = pSprite->win;
+ else if (stuff->destination == InputFocus) {
+ WindowPtr inputFocus = (keybd) ? keybd->focus->win : NoneWin;
- if (inputFocus == NoneWin)
- return Success;
+ if (inputFocus == NoneWin)
+ return Success;
- /* If the input focus is PointerRootWin, send the event to where
- the pointer is if possible, then perhaps propogate up to root. */
- if (inputFocus == PointerRootWin)
- inputFocus = GetCurrentRootWindow(dev);
+ /* If the input focus is PointerRootWin, send the event to where
+ the pointer is if possible, then perhaps propogate up to root. */
+ if (inputFocus == PointerRootWin)
+ inputFocus = GetCurrentRootWindow(dev);
- if (IsParent(inputFocus, pSprite->win))
- {
- effectiveFocus = inputFocus;
- pWin = pSprite->win;
- }
- else
- effectiveFocus = pWin = inputFocus;
+ if (IsParent(inputFocus, pSprite->win)) {
+ effectiveFocus = inputFocus;
+ pWin = pSprite->win;
+ }
+ else
+ effectiveFocus = pWin = inputFocus;
}
else
- dixLookupWindow(&pWin, stuff->destination, client, DixSendAccess);
+ dixLookupWindow(&pWin, stuff->destination, client, DixSendAccess);
if (!pWin)
- return BadWindow;
- if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue))
- {
- client->errorValue = stuff->propagate;
- return BadValue;
+ return BadWindow;
+ if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) {
+ client->errorValue = stuff->propagate;
+ return BadValue;
}
stuff->event.u.u.type |= SEND_EVENT_BIT;
- if (stuff->propagate)
- {
- for (;pWin; pWin = pWin->parent)
- {
- if (XaceHook(XACE_SEND_ACCESS, client, NULL, pWin,
- &stuff->event, 1))
- return Success;
+ if (stuff->propagate) {
+ for (; pWin; pWin = pWin->parent) {
+ if (XaceHook(XACE_SEND_ACCESS, client, NULL, pWin,
+ &stuff->event, 1))
+ return Success;
if (DeliverEventsToWindow(dev, pWin,
- &stuff->event, 1, stuff->eventMask, NullGrab))
- return Success;
- if (pWin == effectiveFocus)
- return Success;
- stuff->eventMask &= ~wDontPropagateMask(pWin);
- if (!stuff->eventMask)
- break;
- }
+ &stuff->event, 1, stuff->eventMask,
+ NullGrab))
+ return Success;
+ if (pWin == effectiveFocus)
+ return Success;
+ stuff->eventMask &= ~wDontPropagateMask(pWin);
+ if (!stuff->eventMask)
+ break;
+ }
}
else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, &stuff->event, 1))
DeliverEventsToWindow(dev, pWin, &stuff->event,
- 1, stuff->eventMask, NullGrab);
+ 1, stuff->eventMask, NullGrab);
return Success;
}
@@ -5545,20 +5323,18 @@ ProcUngrabKey(ClientPtr client)
REQUEST_SIZE_MATCH(xUngrabKeyReq);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (((stuff->key > keybd->key->xkbInfo->desc->max_key_code) ||
- (stuff->key < keybd->key->xkbInfo->desc->min_key_code))
- && (stuff->key != AnyKey))
- {
- client->errorValue = stuff->key;
+ (stuff->key < keybd->key->xkbInfo->desc->min_key_code))
+ && (stuff->key != AnyKey)) {
+ client->errorValue = stuff->key;
return BadValue;
}
if ((stuff->modifiers != AnyModifier) &&
- (stuff->modifiers & ~AllModifiersMask))
- {
- client->errorValue = stuff->modifiers;
- return BadValue;
+ (stuff->modifiers & ~AllModifiersMask)) {
+ client->errorValue = stuff->modifiers;
+ return BadValue;
}
tempGrab = AllocGrab();
if (!tempGrab)
@@ -5593,6 +5369,7 @@ int
ProcGrabKey(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xGrabKeyReq);
GrabPtr grab;
DeviceIntPtr keybd = PickKeyboard(client);
@@ -5614,27 +5391,24 @@ ProcGrabKey(ClientPtr client)
return rc;
if (((stuff->key > keybd->key->xkbInfo->desc->max_key_code) ||
- (stuff->key < keybd->key->xkbInfo->desc->min_key_code))
- && (stuff->key != AnyKey))
- {
- client->errorValue = stuff->key;
+ (stuff->key < keybd->key->xkbInfo->desc->min_key_code))
+ && (stuff->key != AnyKey)) {
+ client->errorValue = stuff->key;
return BadValue;
}
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
-
+ return rc;
mask.core = (KeyPressMask | KeyReleaseMask);
grab = CreateGrab(client->index, keybd, keybd, pWin, CORE, &mask,
&param, KeyPress, stuff->key, NullWindow, NullCursor);
if (!grab)
- return BadAlloc;
+ return BadAlloc;
return AddPassiveGrabToList(client, grab);
}
-
/**
* Server-side protocol handling for GrabButton request.
*
@@ -5645,6 +5419,7 @@ int
ProcGrabButton(ClientPtr client)
{
WindowPtr pWin, confineTo;
+
REQUEST(xGrabButtonReq);
CursorPtr cursor;
GrabPtr grab;
@@ -5656,66 +5431,59 @@ ProcGrabButton(ClientPtr client)
REQUEST_SIZE_MATCH(xGrabButtonReq);
if ((stuff->pointerMode != GrabModeSync) &&
- (stuff->pointerMode != GrabModeAsync))
- {
- client->errorValue = stuff->pointerMode;
+ (stuff->pointerMode != GrabModeAsync)) {
+ client->errorValue = stuff->pointerMode;
return BadValue;
}
if ((stuff->keyboardMode != GrabModeSync) &&
- (stuff->keyboardMode != GrabModeAsync))
- {
- client->errorValue = stuff->keyboardMode;
+ (stuff->keyboardMode != GrabModeAsync)) {
+ client->errorValue = stuff->keyboardMode;
return BadValue;
}
if ((stuff->modifiers != AnyModifier) &&
- (stuff->modifiers & ~AllModifiersMask))
- {
- client->errorValue = stuff->modifiers;
- return BadValue;
+ (stuff->modifiers & ~AllModifiersMask)) {
+ client->errorValue = stuff->modifiers;
+ return BadValue;
}
- if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue))
- {
- client->errorValue = stuff->ownerEvents;
- return BadValue;
+ if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue)) {
+ client->errorValue = stuff->ownerEvents;
+ return BadValue;
}
- if (stuff->eventMask & ~PointerGrabMask)
- {
- client->errorValue = stuff->eventMask;
+ if (stuff->eventMask & ~PointerGrabMask) {
+ client->errorValue = stuff->eventMask;
return BadValue;
}
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (stuff->confineTo == None)
- confineTo = NullWindow;
+ confineTo = NullWindow;
else {
- rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
- DixSetAttrAccess);
- if (rc != Success)
- return rc;
+ rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
+ DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
}
if (stuff->cursor == None)
- cursor = NullCursor;
- else
- {
- rc = dixLookupResourceByType((pointer *)&cursor, stuff->cursor, RT_CURSOR,
- client, DixUseAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->cursor;
- return rc;
- }
- access_mode |= DixForceAccess;
+ cursor = NullCursor;
+ else {
+ rc = dixLookupResourceByType((pointer *) &cursor, stuff->cursor,
+ RT_CURSOR, client, DixUseAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->cursor;
+ return rc;
+ }
+ access_mode |= DixForceAccess;
}
ptr = PickPointer(client);
modifierDevice = GetMaster(ptr, MASTER_KEYBOARD);
if (stuff->pointerMode == GrabModeSync ||
- stuff->keyboardMode == GrabModeSync)
- access_mode |= DixFreezeAccess;
+ stuff->keyboardMode == GrabModeSync)
+ access_mode |= DixFreezeAccess;
rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, access_mode);
if (rc != Success)
- return rc;
+ return rc;
memset(&param, 0, sizeof(param));
param.grabtype = CORE;
@@ -5730,7 +5498,7 @@ ProcGrabButton(ClientPtr client)
CORE, &mask, &param, ButtonPress,
stuff->button, confineTo, cursor);
if (!grab)
- return BadAlloc;
+ return BadAlloc;
return AddPassiveGrabToList(client, grab);
}
@@ -5750,14 +5518,13 @@ ProcUngrabButton(ClientPtr client)
REQUEST_SIZE_MATCH(xUngrabButtonReq);
if ((stuff->modifiers != AnyModifier) &&
- (stuff->modifiers & ~AllModifiersMask))
- {
- client->errorValue = stuff->modifiers;
- return BadValue;
+ (stuff->modifiers & ~AllModifiersMask)) {
+ client->errorValue = stuff->modifiers;
+ return BadValue;
}
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
ptr = PickPointer(client);
@@ -5797,48 +5564,40 @@ ProcUngrabButton(ClientPtr client)
void
DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
{
- WindowPtr parent;
- DeviceIntPtr mouse = inputInfo.pointer;
- DeviceIntPtr keybd = inputInfo.keyboard;
- FocusClassPtr focus;
- OtherClientsPtr oc;
- GrabPtr passive;
- GrabPtr grab;
-
+ WindowPtr parent;
+ DeviceIntPtr mouse = inputInfo.pointer;
+ DeviceIntPtr keybd = inputInfo.keyboard;
+ FocusClassPtr focus;
+ OtherClientsPtr oc;
+ GrabPtr passive;
+ GrabPtr grab;
/* Deactivate any grabs performed on this window, before making any
- input focus changes. */
+ input focus changes. */
grab = mouse->deviceGrab.grab;
- if (grab &&
- ((grab->window == pWin) || (grab->confineTo == pWin)))
- (*mouse->deviceGrab.DeactivateGrab)(mouse);
-
+ if (grab && ((grab->window == pWin) || (grab->confineTo == pWin)))
+ (*mouse->deviceGrab.DeactivateGrab) (mouse);
/* Deactivating a keyboard grab should cause focus events. */
grab = keybd->deviceGrab.grab;
if (grab && (grab->window == pWin))
- (*keybd->deviceGrab.DeactivateGrab)(keybd);
+ (*keybd->deviceGrab.DeactivateGrab) (keybd);
/* And now the real devices */
- for (mouse = inputInfo.devices; mouse; mouse = mouse->next)
- {
+ for (mouse = inputInfo.devices; mouse; mouse = mouse->next) {
grab = mouse->deviceGrab.grab;
if (grab && ((grab->window == pWin) || (grab->confineTo == pWin)))
- (*mouse->deviceGrab.DeactivateGrab)(mouse);
+ (*mouse->deviceGrab.DeactivateGrab) (mouse);
}
-
- for (keybd = inputInfo.devices; keybd; keybd = keybd->next)
- {
- if (IsKeyboardDevice(keybd))
- {
+ for (keybd = inputInfo.devices; keybd; keybd = keybd->next) {
+ if (IsKeyboardDevice(keybd)) {
focus = keybd->focus;
/* If the focus window is a root window (ie. has no parent) then don't
delete the focus from it. */
- if ((pWin == focus->win) && (pWin->parent != NullWindow))
- {
+ if ((pWin == focus->win) && (pWin->parent != NullWindow)) {
int focusEventMode = NotifyNormal;
/* If a grab is in progress, then alter the mode of focus events. */
@@ -5846,61 +5605,58 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
if (keybd->deviceGrab.grab)
focusEventMode = NotifyWhileGrabbed;
- switch (focus->revert)
- {
- case RevertToNone:
- DoFocusEvents(keybd, pWin, NoneWin, focusEventMode);
- focus->win = NoneWin;
- focus->traceGood = 0;
- break;
- case RevertToParent:
- parent = pWin;
- do
- {
- parent = parent->parent;
- focus->traceGood--;
- } while (!parent->realized
- /* This would be a good protocol change -- windows being reparented
- during SaveSet processing would cause the focus to revert to the
- nearest enclosing window which will survive the death of the exiting
- client, instead of ending up reverting to a dying window and thence
- to None
- */
+ switch (focus->revert) {
+ case RevertToNone:
+ DoFocusEvents(keybd, pWin, NoneWin, focusEventMode);
+ focus->win = NoneWin;
+ focus->traceGood = 0;
+ break;
+ case RevertToParent:
+ parent = pWin;
+ do {
+ parent = parent->parent;
+ focus->traceGood--;
+ } while (!parent->realized
+ /* This would be a good protocol change -- windows being reparented
+ during SaveSet processing would cause the focus to revert to the
+ nearest enclosing window which will survive the death of the exiting
+ client, instead of ending up reverting to a dying window and thence
+ to None
+ */
#ifdef NOTDEF
- || wClient(parent)->clientGone
+ || wClient(parent)->clientGone
#endif
- );
- if (!ActivateFocusInGrab(keybd, pWin, parent))
- DoFocusEvents(keybd, pWin, parent, focusEventMode);
- focus->win = parent;
- focus->revert = RevertToNone;
- break;
- case RevertToPointerRoot:
- if (!ActivateFocusInGrab(keybd, pWin, PointerRootWin))
- DoFocusEvents(keybd, pWin, PointerRootWin, focusEventMode);
- focus->win = PointerRootWin;
- focus->traceGood = 0;
- break;
+ );
+ if (!ActivateFocusInGrab(keybd, pWin, parent))
+ DoFocusEvents(keybd, pWin, parent, focusEventMode);
+ focus->win = parent;
+ focus->revert = RevertToNone;
+ break;
+ case RevertToPointerRoot:
+ if (!ActivateFocusInGrab(keybd, pWin, PointerRootWin))
+ DoFocusEvents(keybd, pWin, PointerRootWin,
+ focusEventMode);
+ focus->win = PointerRootWin;
+ focus->traceGood = 0;
+ break;
}
}
}
- if (IsPointerDevice(keybd))
- {
+ if (IsPointerDevice(keybd)) {
if (keybd->valuator->motionHintWindow == pWin)
keybd->valuator->motionHintWindow = NullWindow;
}
}
- if (freeResources)
- {
- if (pWin->dontPropagate)
- DontPropagateRefCnts[pWin->dontPropagate]--;
- while ( (oc = wOtherClients(pWin)) )
- FreeResource(oc->resource, RT_NONE);
- while ( (passive = wPassiveGrabs(pWin)) )
- FreeResource(passive->resource, RT_NONE);
- }
+ if (freeResources) {
+ if (pWin->dontPropagate)
+ DontPropagateRefCnts[pWin->dontPropagate]--;
+ while ((oc = wOtherClients(pWin)))
+ FreeResource(oc->resource, RT_NONE);
+ while ((passive = wPassiveGrabs(pWin)))
+ FreeResource(passive->resource, RT_NONE);
+ }
DeleteWindowFromAnyExtEvents(pWin, freeResources);
}
@@ -5918,18 +5674,16 @@ CheckCursorConfinement(WindowPtr pWin)
DeviceIntPtr pDev;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return;
+ if (!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return;
#endif
- for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
grab = pDev->deviceGrab.grab;
- if (grab && (confineTo = grab->confineTo))
- {
+ if (grab && (confineTo = grab->confineTo)) {
if (!BorderSizeNotEmpty(pDev, confineTo))
- (*pDev->deviceGrab.DeactivateGrab)(pDev);
+ (*pDev->deviceGrab.DeactivateGrab) (pDev);
else if ((pWin == confineTo) || IsParent(pWin, confineTo))
ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE);
}
@@ -5940,14 +5694,13 @@ CheckCursorConfinement(WindowPtr pWin)
Mask
EventMaskForClient(WindowPtr pWin, ClientPtr client)
{
- OtherClientsPtr other;
+ OtherClientsPtr other;
- if (wClient (pWin) == client)
- return pWin->eventMask;
- for (other = wOtherClients(pWin); other; other = other->next)
- {
- if (SameClient(other, client))
- return other->mask;
+ if (wClient(pWin) == client)
+ return pWin->eventMask;
+ for (other = wOtherClients(pWin); other; other = other->next) {
+ if (SameClient(other, client))
+ return other->mask;
}
return 0;
}
@@ -5959,19 +5712,19 @@ int
ProcRecolorCursor(ClientPtr client)
{
CursorPtr pCursor;
- int rc, nscr;
- ScreenPtr pscr;
- Bool displayed;
- SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite;
+ int rc, nscr;
+ ScreenPtr pscr;
+ Bool displayed;
+ SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite;
+
REQUEST(xRecolorCursorReq);
REQUEST_SIZE_MATCH(xRecolorCursorReq);
- rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
- client, DixWriteAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->cursor;
- return rc;
+ rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor, RT_CURSOR,
+ client, DixWriteAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->cursor;
+ return rc;
}
pCursor->foreRed = stuff->foreRed;
@@ -5982,17 +5735,16 @@ ProcRecolorCursor(ClientPtr client)
pCursor->backGreen = stuff->backGreen;
pCursor->backBlue = stuff->backBlue;
- for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
- {
- pscr = screenInfo.screens[nscr];
+ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
+ pscr = screenInfo.screens[nscr];
#ifdef PANORAMIX
- if(!noPanoramiXExtension)
- displayed = (pscr == pSprite->screen);
- else
+ if (!noPanoramiXExtension)
+ displayed = (pscr == pSprite->screen);
+ else
#endif
- displayed = (pscr == pSprite->hotPhys.pScreen);
- ( *pscr->RecolorCursor)(PickPointer(client), pscr, pCursor,
- (pCursor == pSprite->current) && displayed);
+ displayed = (pscr == pSprite->hotPhys.pScreen);
+ (*pscr->RecolorCursor) (PickPointer(client), pscr, pCursor,
+ (pCursor == pSprite->current) && displayed);
}
return Success;
}
@@ -6015,120 +5767,109 @@ void
WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
{
#ifdef PANORAMIX
- xEvent eventCopy;
+ xEvent eventCopy;
#endif
- xEvent *eventTo, *eventFrom;
- int i,
- eventlength = sizeof(xEvent);
+ xEvent *eventTo, *eventFrom;
+ int i, eventlength = sizeof(xEvent);
if (!pClient || pClient == serverClient || pClient->clientGone)
- return;
+ return;
for (i = 0; i < count; i++)
- if ((events[i].u.u.type & 0x7f) != KeymapNotify)
- events[i].u.u.sequenceNumber = pClient->sequence;
+ if ((events[i].u.u.type & 0x7f) != KeymapNotify)
+ events[i].u.u.sequenceNumber = pClient->sequence;
/* Let XKB rewrite the state, as it depends on client preferences. */
XkbFilterEvents(pClient, count, events);
#ifdef PANORAMIX
- if(!noPanoramiXExtension &&
- (screenInfo.screens[0]->x || screenInfo.screens[0]->y))
- {
- switch(events->u.u.type) {
- case MotionNotify:
- case ButtonPress:
- case ButtonRelease:
- case KeyPress:
- case KeyRelease:
- case EnterNotify:
- case LeaveNotify:
- /*
- When multiple clients want the same event DeliverEventsToWindow
- passes the same event structure multiple times so we can't
- modify the one passed to us
- */
- count = 1; /* should always be 1 */
- memcpy(&eventCopy, events, sizeof(xEvent));
- eventCopy.u.keyButtonPointer.rootX += screenInfo.screens[0]->x;
- eventCopy.u.keyButtonPointer.rootY += screenInfo.screens[0]->y;
- if(eventCopy.u.keyButtonPointer.event ==
- eventCopy.u.keyButtonPointer.root)
- {
- eventCopy.u.keyButtonPointer.eventX += screenInfo.screens[0]->x;
- eventCopy.u.keyButtonPointer.eventY += screenInfo.screens[0]->y;
- }
- events = &eventCopy;
- break;
- default: break;
- }
+ if (!noPanoramiXExtension &&
+ (screenInfo.screens[0]->x || screenInfo.screens[0]->y)) {
+ switch (events->u.u.type) {
+ case MotionNotify:
+ case ButtonPress:
+ case ButtonRelease:
+ case KeyPress:
+ case KeyRelease:
+ case EnterNotify:
+ case LeaveNotify:
+ /*
+ When multiple clients want the same event DeliverEventsToWindow
+ passes the same event structure multiple times so we can't
+ modify the one passed to us
+ */
+ count = 1; /* should always be 1 */
+ memcpy(&eventCopy, events, sizeof(xEvent));
+ eventCopy.u.keyButtonPointer.rootX += screenInfo.screens[0]->x;
+ eventCopy.u.keyButtonPointer.rootY += screenInfo.screens[0]->y;
+ if (eventCopy.u.keyButtonPointer.event ==
+ eventCopy.u.keyButtonPointer.root) {
+ eventCopy.u.keyButtonPointer.eventX += screenInfo.screens[0]->x;
+ eventCopy.u.keyButtonPointer.eventY += screenInfo.screens[0]->y;
+ }
+ events = &eventCopy;
+ break;
+ default:
+ break;
+ }
}
#endif
- if (EventCallback)
- {
- EventInfoRec eventinfo;
- eventinfo.client = pClient;
- eventinfo.events = events;
- eventinfo.count = count;
- CallCallbacks(&EventCallback, (pointer)&eventinfo);
+ if (EventCallback) {
+ EventInfoRec eventinfo;
+
+ eventinfo.client = pClient;
+ eventinfo.events = events;
+ eventinfo.count = count;
+ CallCallbacks(&EventCallback, (pointer) &eventinfo);
}
#ifdef XSERVER_DTRACE
if (XSERVER_SEND_EVENT_ENABLED()) {
- for (i = 0; i < count; i++)
- {
- XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]);
- }
+ for (i = 0; i < count; i++) {
+ XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]);
+ }
}
#endif
/* Just a safety check to make sure we only have one GenericEvent, it just
* makes things easier for me right now. (whot) */
- for (i = 1; i < count; i++)
- {
- if (events[i].u.u.type == GenericEvent)
- {
+ for (i = 1; i < count; i++) {
+ if (events[i].u.u.type == GenericEvent) {
ErrorF("[dix] TryClientEvents: Only one GenericEvent at a time.\n");
return;
}
}
- if (events->u.u.type == GenericEvent)
- {
- eventlength += ((xGenericEvent*)events)->length * 4;
+ if (events->u.u.type == GenericEvent) {
+ eventlength += ((xGenericEvent *) events)->length * 4;
}
- if(pClient->swapped)
- {
- if (eventlength > swapEventLen)
- {
+ if (pClient->swapped) {
+ if (eventlength > swapEventLen) {
swapEventLen = eventlength;
swapEvent = realloc(swapEvent, swapEventLen);
- if (!swapEvent)
- {
+ if (!swapEvent) {
FatalError("WriteEventsToClient: Out of memory.\n");
return;
}
}
- for(i = 0; i < count; i++)
- {
- eventFrom = &events[i];
+ for (i = 0; i < count; i++) {
+ eventFrom = &events[i];
eventTo = swapEvent;
- /* Remember to strip off the leading bit of type in case
- this event was sent with "SendEvent." */
- (*EventSwapVector[eventFrom->u.u.type & 0177])
- (eventFrom, eventTo);
+ /* Remember to strip off the leading bit of type in case
+ this event was sent with "SendEvent." */
+ (*EventSwapVector[eventFrom->u.u.type & 0177])
+ (eventFrom, eventTo);
- WriteToClient(pClient, eventlength, (char *)eventTo);
- }
+ WriteToClient(pClient, eventlength, (char *) eventTo);
+ }
}
- else
- {
+ else {
/* only one GenericEvent, remember? that means either count is 1 and
* eventlength is arbitrary or eventlength is 32 and count doesn't
* matter. And we're all set. Woohoo. */
- WriteToClient(pClient, count * eventlength, (char *) events);
+ WriteToClient(pClient, count * eventlength, (char *) events);
}
}
@@ -6145,17 +5886,17 @@ int
SetClientPointer(ClientPtr client, DeviceIntPtr device)
{
int rc = XaceHook(XACE_DEVICE_ACCESS, client, device, DixUseAccess);
+
if (rc != Success)
- return rc;
+ return rc;
- if (!IsMaster(device))
- {
+ if (!IsMaster(device)) {
ErrorF("[dix] Need master device for ClientPointer. This is a bug.\n");
return BadDevice;
- } else if (!device->spriteInfo->spriteOwner)
- {
+ }
+ else if (!device->spriteInfo->spriteOwner) {
ErrorF("[dix] Device %d does not have a sprite. "
- "Cannot be ClientPointer\n", device->id);
+ "Cannot be ClientPointer\n", device->id);
return BadDevice;
}
client->clientPtr = device;
@@ -6176,23 +5917,19 @@ PickPointer(ClientPtr client)
/* First, check if the client currently has a grab on a device. Even
* keyboards count. */
- for(it = inputInfo.devices; it; it = it->next)
- {
+ for (it = inputInfo.devices; it; it = it->next) {
GrabPtr grab = it->deviceGrab.grab;
- if (grab && grab->grabtype == CORE && SameClient(grab, client))
- {
+
+ if (grab && grab->grabtype == CORE && SameClient(grab, client)) {
it = GetMaster(it, MASTER_POINTER);
- return it; /* Always return a core grabbed device */
+ return it; /* Always return a core grabbed device */
}
}
- if (!client->clientPtr)
- {
+ if (!client->clientPtr) {
it = inputInfo.devices;
- while (it)
- {
- if (IsMaster(it) && it->spriteInfo->spriteOwner)
- {
+ while (it) {
+ if (IsMaster(it) && it->spriteInfo->spriteOwner) {
client->clientPtr = it;
break;
}
@@ -6212,10 +5949,9 @@ PickKeyboard(ClientPtr client)
DeviceIntPtr ptr = PickPointer(client);
DeviceIntPtr kbd = GetMaster(ptr, MASTER_KEYBOARD);
- if (!kbd)
- {
+ if (!kbd) {
ErrorF("[dix] ClientPointer not paired with a keyboard. This "
- "is a bug.\n");
+ "is a bug.\n");
}
return kbd;
@@ -6230,36 +5966,32 @@ PickKeyboard(ClientPtr client)
* be delivered.
*/
Bool
-IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event)
+IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent *event)
{
DeviceIntPtr it = inputInfo.devices;
- switch(event->u.u.type)
- {
- case KeyPress:
- case KeyRelease:
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- case EnterNotify:
- case LeaveNotify:
- break;
- default:
- return FALSE;
+ switch (event->u.u.type) {
+ case KeyPress:
+ case KeyRelease:
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ case EnterNotify:
+ case LeaveNotify:
+ break;
+ default:
+ return FALSE;
}
if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
return FALSE;
- while(it)
- {
- if (it != dev)
- {
+ while (it) {
+ if (it != dev) {
if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client)
- && !it->deviceGrab.fromPassiveGrab)
- {
+ && !it->deviceGrab.fromPassiveGrab) {
if ((IsPointerDevice(it) && IsPointerDevice(dev)) ||
- (IsKeyboardDevice(it) && IsKeyboardDevice(dev)))
+ (IsKeyboardDevice(it) && IsKeyboardDevice(dev)))
return TRUE;
}
}
@@ -6268,4 +6000,3 @@ IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event)
return FALSE;
}
-
diff --git a/xorg-server/dix/extension.c b/xorg-server/dix/extension.c
index af9ba312d..3cdfb5152 100644
--- a/xorg-server/dix/extension.c
+++ b/xorg-server/dix/extension.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -63,7 +62,7 @@ SOFTWARE.
#define LAST_ERROR 255
-static ExtensionEntry **extensions = (ExtensionEntry **)NULL;
+static ExtensionEntry **extensions = (ExtensionEntry **) NULL;
int lastEvent = EXTENSION_EVENT_BASE;
static int lastError = FirstExtensionError;
@@ -71,48 +70,46 @@ static unsigned int NumExtensions = 0;
ExtensionEntry *
AddExtension(const char *name, int NumEvents, int NumErrors,
- int (*MainProc)(ClientPtr c1),
- int (*SwappedMainProc)(ClientPtr c2),
- void (*CloseDownProc)(ExtensionEntry *e),
- unsigned short (*MinorOpcodeProc)(ClientPtr c3))
+ int (*MainProc) (ClientPtr c1),
+ int (*SwappedMainProc) (ClientPtr c2),
+ void (*CloseDownProc) (ExtensionEntry * e),
+ unsigned short (*MinorOpcodeProc) (ClientPtr c3))
{
int i;
ExtensionEntry *ext, **newexts;
if (!MainProc || !SwappedMainProc || !MinorOpcodeProc)
- return((ExtensionEntry *) NULL);
- if ((lastEvent + NumEvents > MAXEVENTS) ||
- (unsigned)(lastError + NumErrors > LAST_ERROR)) {
+ return ((ExtensionEntry *) NULL);
+ if ((lastEvent + NumEvents > MAXEVENTS) ||
+ (unsigned) (lastError + NumErrors > LAST_ERROR)) {
LogMessage(X_ERROR, "Not enabling extension %s: maximum number of "
"events or errors exceeded.\n", name);
- return((ExtensionEntry *) NULL);
+ return ((ExtensionEntry *) NULL);
}
- ext = calloc(sizeof (ExtensionEntry), 1);
+ ext = calloc(sizeof(ExtensionEntry), 1);
if (!ext)
- return NULL;
+ return NULL;
if (!dixAllocatePrivates(&ext->devPrivates, PRIVATE_EXTENSION)) {
- free(ext);
- return NULL;
+ free(ext);
+ return NULL;
}
ext->name = strdup(name);
ext->num_aliases = 0;
- ext->aliases = (char **)NULL;
- if (!ext->name)
- {
- dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION);
- free(ext);
- return((ExtensionEntry *) NULL);
+ ext->aliases = (char **) NULL;
+ if (!ext->name) {
+ dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION);
+ free(ext);
+ return ((ExtensionEntry *) NULL);
}
i = NumExtensions;
newexts = (ExtensionEntry **) realloc(extensions,
- (i + 1) * sizeof(ExtensionEntry *));
- if (!newexts)
- {
- free(ext->name);
- dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION);
- free(ext);
- return((ExtensionEntry *) NULL);
+ (i + 1) * sizeof(ExtensionEntry *));
+ if (!newexts) {
+ free(ext->name);
+ dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION);
+ free(ext);
+ return ((ExtensionEntry *) NULL);
}
NumExtensions++;
extensions = newexts;
@@ -123,25 +120,21 @@ AddExtension(const char *name, int NumEvents, int NumErrors,
ext->MinorOpcode = MinorOpcodeProc;
ProcVector[i + EXTENSION_BASE] = MainProc;
SwappedProcVector[i + EXTENSION_BASE] = SwappedMainProc;
- if (NumEvents)
- {
+ if (NumEvents) {
ext->eventBase = lastEvent;
- ext->eventLast = lastEvent + NumEvents;
- lastEvent += NumEvents;
+ ext->eventLast = lastEvent + NumEvents;
+ lastEvent += NumEvents;
}
- else
- {
+ else {
ext->eventBase = 0;
ext->eventLast = 0;
}
- if (NumErrors)
- {
+ if (NumErrors) {
ext->errorBase = lastError;
- ext->errorLast = lastError + NumErrors;
- lastError += NumErrors;
+ ext->errorLast = lastError + NumErrors;
+ lastError += NumErrors;
}
- else
- {
+ else {
ext->errorBase = 0;
ext->errorLast = 0;
}
@@ -150,21 +143,22 @@ AddExtension(const char *name, int NumEvents, int NumErrors,
return ext;
}
-Bool AddExtensionAlias(const char *alias, ExtensionEntry *ext)
+Bool
+AddExtensionAlias(const char *alias, ExtensionEntry * ext)
{
char *name;
char **aliases;
if (!ext)
- return FALSE ;
- aliases = (char **)realloc(ext->aliases,
- (ext->num_aliases + 1) * sizeof(char *));
+ return FALSE;
+ aliases = (char **) realloc(ext->aliases,
+ (ext->num_aliases + 1) * sizeof(char *));
if (!aliases)
- return FALSE;
+ return FALSE;
ext->aliases = aliases;
name = strdup(alias);
if (!name)
- return FALSE;
+ return FALSE;
ext->aliases[ext->num_aliases] = name;
ext->num_aliases++;
return TRUE;
@@ -175,18 +169,17 @@ FindExtension(const char *extname, int len)
{
int i, j;
- for (i=0; i<NumExtensions; i++)
- {
- if ((strlen(extensions[i]->name) == len) &&
- !strncmp(extname, extensions[i]->name, len))
- break;
- for (j = extensions[i]->num_aliases; --j >= 0;)
- {
- if ((strlen(extensions[i]->aliases[j]) == len) &&
- !strncmp(extname, extensions[i]->aliases[j], len))
- break;
- }
- if (j >= 0) break;
+ for (i = 0; i < NumExtensions; i++) {
+ if ((strlen(extensions[i]->name) == len) &&
+ !strncmp(extname, extensions[i]->name, len))
+ break;
+ for (j = extensions[i]->num_aliases; --j >= 0;) {
+ if ((strlen(extensions[i]->aliases[j]) == len) &&
+ !strncmp(extname, extensions[i]->aliases[j], len))
+ break;
+ }
+ if (j >= 0)
+ break;
}
return ((i == NumExtensions) ? -1 : i);
}
@@ -202,9 +195,9 @@ CheckExtension(const char *extname)
n = FindExtension(extname, strlen(extname));
if (n != -1)
- return extensions[n];
+ return extensions[n];
else
- return NULL;
+ return NULL;
}
/*
@@ -212,40 +205,39 @@ CheckExtension(const char *extname)
*/
ExtensionEntry *
GetExtensionEntry(int major)
-{
+{
if (major < EXTENSION_BASE)
- return NULL;
+ return NULL;
major -= EXTENSION_BASE;
if (major >= NumExtensions)
- return NULL;
+ return NULL;
return extensions[major];
}
unsigned short
StandardMinorOpcode(ClientPtr client)
{
- return ((xReq *)client->requestBuffer)->data;
+ return ((xReq *) client->requestBuffer)->data;
}
void
CloseDownExtensions(void)
{
- int i,j;
-
- for (i = NumExtensions - 1; i >= 0; i--)
- {
- if (extensions[i]->CloseDown)
- extensions[i]->CloseDown(extensions[i]);
- NumExtensions = i;
- free(extensions[i]->name);
- for (j = extensions[i]->num_aliases; --j >= 0;)
- free(extensions[i]->aliases[j]);
- free(extensions[i]->aliases);
- dixFreePrivates(extensions[i]->devPrivates, PRIVATE_EXTENSION);
- free(extensions[i]);
+ int i, j;
+
+ for (i = NumExtensions - 1; i >= 0; i--) {
+ if (extensions[i]->CloseDown)
+ extensions[i]->CloseDown(extensions[i]);
+ NumExtensions = i;
+ free(extensions[i]->name);
+ for (j = extensions[i]->num_aliases; --j >= 0;)
+ free(extensions[i]->aliases[j]);
+ free(extensions[i]->aliases);
+ dixFreePrivates(extensions[i]->devPrivates, PRIVATE_EXTENSION);
+ free(extensions[i]);
}
free(extensions);
- extensions = (ExtensionEntry **)NULL;
+ extensions = (ExtensionEntry **) NULL;
lastEvent = EXTENSION_EVENT_BASE;
lastError = FirstExtensionError;
}
@@ -255,6 +247,7 @@ ProcQueryExtension(ClientPtr client)
{
xQueryExtensionReply reply;
int i;
+
REQUEST(xQueryExtensionReq);
REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes);
@@ -265,20 +258,18 @@ ProcQueryExtension(ClientPtr client)
reply.major_opcode = 0;
reply.sequenceNumber = client->sequence;
- if ( ! NumExtensions )
+ if (!NumExtensions)
reply.present = xFalse;
- else
- {
- i = FindExtension((char *)&stuff[1], stuff->nbytes);
+ else {
+ i = FindExtension((char *) &stuff[1], stuff->nbytes);
if (i < 0 || XaceHook(XACE_EXT_ACCESS, client, extensions[i]))
reply.present = xFalse;
- else
- {
+ else {
reply.present = xTrue;
- reply.major_opcode = extensions[i]->base;
- reply.first_event = extensions[i]->eventBase;
- reply.first_error = extensions[i]->errorBase;
- }
+ reply.major_opcode = extensions[i]->base;
+ reply.first_event = extensions[i]->eventBase;
+ reply.first_error = extensions[i]->errorBase;
+ }
}
WriteReplyToClient(client, sizeof(xQueryExtensionReply), &reply);
return Success;
@@ -300,41 +291,38 @@ ProcListExtensions(ClientPtr client)
reply.sequenceNumber = client->sequence;
buffer = NULL;
- if ( NumExtensions )
- {
+ if (NumExtensions) {
int i, j;
- for (i=0; i<NumExtensions; i++)
- {
- /* call callbacks to find out whether to show extension */
- if (XaceHook(XACE_EXT_ACCESS, client, extensions[i]) != Success)
- continue;
-
- total_length += strlen(extensions[i]->name) + 1;
- reply.nExtensions += 1 + extensions[i]->num_aliases;
- for (j = extensions[i]->num_aliases; --j >= 0;)
- total_length += strlen(extensions[i]->aliases[j]) + 1;
- }
+ for (i = 0; i < NumExtensions; i++) {
+ /* call callbacks to find out whether to show extension */
+ if (XaceHook(XACE_EXT_ACCESS, client, extensions[i]) != Success)
+ continue;
+
+ total_length += strlen(extensions[i]->name) + 1;
+ reply.nExtensions += 1 + extensions[i]->num_aliases;
+ for (j = extensions[i]->num_aliases; --j >= 0;)
+ total_length += strlen(extensions[i]->aliases[j]) + 1;
+ }
reply.length = bytes_to_int32(total_length);
- buffer = bufptr = malloc(total_length);
- if (!buffer)
- return BadAlloc;
- for (i=0; i<NumExtensions; i++)
- {
- int len;
- if (XaceHook(XACE_EXT_ACCESS, client, extensions[i]) != Success)
- continue;
+ buffer = bufptr = malloc(total_length);
+ if (!buffer)
+ return BadAlloc;
+ for (i = 0; i < NumExtensions; i++) {
+ int len;
+
+ if (XaceHook(XACE_EXT_ACCESS, client, extensions[i]) != Success)
+ continue;
*bufptr++ = len = strlen(extensions[i]->name);
- memmove(bufptr, extensions[i]->name, len);
- bufptr += len;
- for (j = extensions[i]->num_aliases; --j >= 0;)
- {
- *bufptr++ = len = strlen(extensions[i]->aliases[j]);
- memmove(bufptr, extensions[i]->aliases[j], len);
- bufptr += len;
- }
- }
+ memmove(bufptr, extensions[i]->name, len);
+ bufptr += len;
+ for (j = extensions[i]->num_aliases; --j >= 0;) {
+ *bufptr++ = len = strlen(extensions[i]->aliases[j]);
+ memmove(bufptr, extensions[i]->aliases[j], len);
+ bufptr += len;
+ }
+ }
}
WriteReplyToClient(client, sizeof(xListExtensionsReply), &reply);
if (reply.length)
diff --git a/xorg-server/dix/gc.c b/xorg-server/dix/gc.c
index 92d24dde4..ec7e24f13 100644
--- a/xorg-server/dix/gc.c
+++ b/xorg-server/dix/gc.c
@@ -1,1169 +1,1129 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "resource.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "dixfontstr.h"
-#include "scrnintstr.h"
-#include "region.h"
-#include "dixstruct.h"
-
-#include "privates.h"
-#include "dix.h"
-#include "xace.h"
-#include <assert.h>
-
-extern FontPtr defaultFont;
-
-static Bool CreateDefaultTile(GCPtr pGC);
-
-static unsigned char DefaultDash[2] = {4, 4};
-
-void
-ValidateGC(DrawablePtr pDraw, GC *pGC)
-{
- (*pGC->funcs->ValidateGC) (pGC, pGC->stateChanges, pDraw);
- pGC->stateChanges = 0;
- pGC->serialNumber = pDraw->serialNumber;
-}
-
-
-/*
- * ChangeGC/ChangeGCXIDs:
- *
- * The client performing the gc change must be passed so that access
- * checks can be performed on any tiles, stipples, or fonts that are
- * specified. ddxen can call this too; they should normally pass
- * NullClient for the client since any access checking should have
- * already been done at a higher level.
- *
- * If you have any XIDs, you must use ChangeGCXIDs:
- *
- * CARD32 v[2];
- * v[0] = FillTiled;
- * v[1] = pid;
- * ChangeGCXIDs(client, pGC, GCFillStyle|GCTile, v);
- *
- * However, if you need to pass a pointer to a pixmap or font, you must
- * use ChangeGC:
- *
- * ChangeGCVal v[2];
- * v[0].val = FillTiled;
- * v[1].ptr = pPixmap;
- * ChangeGC(client, pGC, GCFillStyle|GCTile, v);
- *
- * If you have neither XIDs nor pointers, you can use either function,
- * but ChangeGC will do less work.
- *
- * ChangeGCVal v[2];
- * v[0].val = foreground;
- * v[1].val = background;
- * ChangeGC(client, pGC, GCForeground|GCBackground, v);
- */
-
-#define NEXTVAL(_type, _var) { \
- _var = (_type)(pUnion->val); pUnion++; \
- }
-
-#define NEXT_PTR(_type, _var) { \
- _var = (_type)pUnion->ptr; pUnion++; }
-
-int
-ChangeGC(ClientPtr client, GC *pGC, BITS32 mask, ChangeGCValPtr pUnion)
-{
- BITS32 index2;
- int error = 0;
- PixmapPtr pPixmap;
- BITS32 maskQ;
-
- assert(pUnion);
- pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
-
- maskQ = mask; /* save these for when we walk the GCque */
- while (mask && !error)
- {
- index2 = (BITS32) lowbit (mask);
- mask &= ~index2;
- pGC->stateChanges |= index2;
- switch (index2)
- {
- case GCFunction:
- {
- CARD8 newalu;
- NEXTVAL(CARD8, newalu);
- if (newalu <= GXset)
- pGC->alu = newalu;
- else
- {
- if (client)
- client->errorValue = newalu;
- error = BadValue;
- }
- break;
- }
- case GCPlaneMask:
- NEXTVAL(unsigned long, pGC->planemask);
- break;
- case GCForeground:
- NEXTVAL(unsigned long, pGC->fgPixel);
- /*
- * this is for CreateGC
- */
- if (!pGC->tileIsPixel && !pGC->tile.pixmap)
- {
- pGC->tileIsPixel = TRUE;
- pGC->tile.pixel = pGC->fgPixel;
- }
- break;
- case GCBackground:
- NEXTVAL(unsigned long, pGC->bgPixel);
- break;
- case GCLineWidth: /* ??? line width is a CARD16 */
- NEXTVAL(CARD16, pGC->lineWidth);
- break;
- case GCLineStyle:
- {
- unsigned int newlinestyle;
- NEXTVAL(unsigned int, newlinestyle);
- if (newlinestyle <= LineDoubleDash)
- pGC->lineStyle = newlinestyle;
- else
- {
- if (client)
- client->errorValue = newlinestyle;
- error = BadValue;
- }
- break;
- }
- case GCCapStyle:
- {
- unsigned int newcapstyle;
- NEXTVAL(unsigned int, newcapstyle);
- if (newcapstyle <= CapProjecting)
- pGC->capStyle = newcapstyle;
- else
- {
- if (client)
- client->errorValue = newcapstyle;
- error = BadValue;
- }
- break;
- }
- case GCJoinStyle:
- {
- unsigned int newjoinstyle;
- NEXTVAL(unsigned int, newjoinstyle);
- if (newjoinstyle <= JoinBevel)
- pGC->joinStyle = newjoinstyle;
- else
- {
- if (client)
- client->errorValue = newjoinstyle;
- error = BadValue;
- }
- break;
- }
- case GCFillStyle:
- {
- unsigned int newfillstyle;
- NEXTVAL(unsigned int, newfillstyle);
- if (newfillstyle <= FillOpaqueStippled)
- pGC->fillStyle = newfillstyle;
- else
- {
- if (client)
- client->errorValue = newfillstyle;
- error = BadValue;
- }
- break;
- }
- case GCFillRule:
- {
- unsigned int newfillrule;
- NEXTVAL(unsigned int, newfillrule);
- if (newfillrule <= WindingRule)
- pGC->fillRule = newfillrule;
- else
- {
- if (client)
- client->errorValue = newfillrule;
- error = BadValue;
- }
- break;
- }
- case GCTile:
- NEXT_PTR(PixmapPtr, pPixmap);
- if ((pPixmap->drawable.depth != pGC->depth) ||
- (pPixmap->drawable.pScreen != pGC->pScreen))
- {
- error = BadMatch;
- }
- else
- {
- pPixmap->refcnt++;
- if (!pGC->tileIsPixel)
- (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
- pGC->tileIsPixel = FALSE;
- pGC->tile.pixmap = pPixmap;
- }
- break;
- case GCStipple:
- NEXT_PTR(PixmapPtr, pPixmap);
- if ((pPixmap->drawable.depth != 1) ||
- (pPixmap->drawable.pScreen != pGC->pScreen))
- {
- error = BadMatch;
- }
- else
- {
- pPixmap->refcnt++;
- if (pGC->stipple)
- (* pGC->pScreen->DestroyPixmap)(pGC->stipple);
- pGC->stipple = pPixmap;
- }
- break;
- case GCTileStipXOrigin:
- NEXTVAL(INT16, pGC->patOrg.x);
- break;
- case GCTileStipYOrigin:
- NEXTVAL(INT16, pGC->patOrg.y);
- break;
- case GCFont:
- {
- FontPtr pFont;
- NEXT_PTR(FontPtr, pFont);
- pFont->refcnt++;
- if (pGC->font)
- CloseFont(pGC->font, (Font)0);
- pGC->font = pFont;
- break;
- }
- case GCSubwindowMode:
- {
- unsigned int newclipmode;
- NEXTVAL(unsigned int, newclipmode);
- if (newclipmode <= IncludeInferiors)
- pGC->subWindowMode = newclipmode;
- else
- {
- if (client)
- client->errorValue = newclipmode;
- error = BadValue;
- }
- break;
- }
- case GCGraphicsExposures:
- {
- unsigned int newge;
- NEXTVAL(unsigned int, newge);
- if (newge <= xTrue)
- pGC->graphicsExposures = newge;
- else
- {
- if (client)
- client->errorValue = newge;
- error = BadValue;
- }
- break;
- }
- case GCClipXOrigin:
- #ifndef _DEBUG
- NEXTVAL(INT16, pGC->clipOrg.x);
- #else
- {
- long Val;
- NEXTVAL(long, Val);
- if (abs(Val)>65535)
- ErrorF("Value received for GCClipXOrigin is too large %x\n",Val);
- pGC->clipOrg.x=(INT16)(Val&0xffff);
- }
- #endif
- break;
- case GCClipYOrigin:
- #ifndef _DEBUG
- NEXTVAL(INT16, pGC->clipOrg.y);
- #else
- {
- long Val;
- NEXTVAL(long, Val);
- if (abs(Val)>65535)
- ErrorF("Value received for GCClipYOrigin is too large %x\n",Val);
- pGC->clipOrg.y=(INT16)(Val&0xffff);
- }
- #endif
- break;
- case GCClipMask:
- NEXT_PTR(PixmapPtr, pPixmap);
- if (pPixmap)
- {
- if ((pPixmap->drawable.depth != 1) ||
- (pPixmap->drawable.pScreen != pGC->pScreen))
- {
- error = BadMatch;
- break;
- }
- pPixmap->refcnt++;
- }
- (*pGC->funcs->ChangeClip)(pGC, pPixmap ? CT_PIXMAP : CT_NONE,
- (pointer)pPixmap, 0);
- break;
- case GCDashOffset:
- NEXTVAL(INT16, pGC->dashOffset);
- break;
- case GCDashList:
- {
- CARD8 newdash;
- NEXTVAL(CARD8, newdash);
- if (newdash == 4)
- {
- if (pGC->dash != DefaultDash)
- {
- free(pGC->dash);
- pGC->numInDashList = 2;
- pGC->dash = DefaultDash;
- }
- }
- else if (newdash != 0)
- {
- unsigned char *dash;
-
- dash = malloc(2 * sizeof(unsigned char));
- if (dash)
- {
- if (pGC->dash != DefaultDash)
- free(pGC->dash);
- pGC->numInDashList = 2;
- pGC->dash = dash;
- dash[0] = newdash;
- dash[1] = newdash;
- }
- else
- error = BadAlloc;
- }
- else
- {
- if (client)
- client->errorValue = newdash;
- error = BadValue;
- }
- break;
- }
- case GCArcMode:
- {
- unsigned int newarcmode;
- NEXTVAL(unsigned int, newarcmode);
- if (newarcmode <= ArcPieSlice)
- pGC->arcMode = newarcmode;
- else
- {
- if (client)
- client->errorValue = newarcmode;
- error = BadValue;
- }
- break;
- }
- default:
- if (client)
- client->errorValue = maskQ;
- error = BadValue;
- break;
- }
- } /* end while mask && !error */
-
- if (pGC->fillStyle == FillTiled && pGC->tileIsPixel)
- {
- if (!CreateDefaultTile (pGC))
- {
- pGC->fillStyle = FillSolid;
- error = BadAlloc;
- }
- }
- (*pGC->funcs->ChangeGC)(pGC, maskQ);
- return error;
-}
-
-#undef NEXTVAL
-#undef NEXT_PTR
-
-static const struct {
- BITS32 mask;
- RESTYPE type;
- Mask access_mode;
-} xidfields[] = {
- { GCTile, RT_PIXMAP, DixReadAccess },
- { GCStipple, RT_PIXMAP, DixReadAccess },
- { GCFont, RT_FONT, DixUseAccess },
- { GCClipMask, RT_PIXMAP, DixReadAccess },
-};
-
-int
-ChangeGCXIDs(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32)
-{
- ChangeGCVal vals[GCLastBit + 1];
- int i;
- if (mask & ~GCAllBits)
- {
- client->errorValue = mask;
- return BadValue;
- }
- for (i = Ones(mask); i--; )
- vals[i].val = pC32[i];
- for (i = 0; i < sizeof(xidfields) / sizeof(*xidfields); ++i)
- {
- int offset, rc;
- if (!(mask & xidfields[i].mask))
- continue;
- offset = Ones(mask & (xidfields[i].mask - 1));
- if (xidfields[i].mask == GCClipMask && vals[offset].val == None)
- {
- vals[offset].ptr = NullPixmap;
- continue;
- }
- rc = dixLookupResourceByType(&vals[offset].ptr, vals[offset].val,
- xidfields[i].type, client, xidfields[i].access_mode);
- if (rc != Success)
- {
- client->errorValue = vals[offset].val;
- return rc;
- }
- }
- return ChangeGC(client, pGC, mask, vals);
-}
-
-/* CreateGC(pDrawable, mask, pval, pStatus)
- creates a default GC for the given drawable, using mask to fill
- in any non-default values.
- Returns a pointer to the new GC on success, NULL otherwise.
- returns status of non-default fields in pStatus
-BUG:
- should check for failure to create default tile
-
-*/
-GCPtr
-CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
- XID gcid, ClientPtr client)
-{
- GCPtr pGC;
-
- pGC = dixAllocateObjectWithPrivates(GC, PRIVATE_GC);
- if (!pGC)
- {
- *pStatus = BadAlloc;
- return (GCPtr)NULL;
- }
-
- pGC->pScreen = pDrawable->pScreen;
- pGC->depth = pDrawable->depth;
- pGC->alu = GXcopy; /* dst <- src */
- pGC->planemask = ~0;
- pGC->serialNumber = GC_CHANGE_SERIAL_BIT;
- pGC->funcs = 0;
- pGC->fgPixel = 0;
- pGC->bgPixel = 1;
- pGC->lineWidth = 0;
- pGC->lineStyle = LineSolid;
- pGC->capStyle = CapButt;
- pGC->joinStyle = JoinMiter;
- pGC->fillStyle = FillSolid;
- pGC->fillRule = EvenOddRule;
- pGC->arcMode = ArcPieSlice;
- pGC->tile.pixel = 0;
- pGC->tile.pixmap = NullPixmap;
- if (mask & GCForeground)
- {
- /*
- * magic special case -- ChangeGC checks for this condition
- * and snags the Foreground value to create a pseudo default-tile
- */
- pGC->tileIsPixel = FALSE;
- }
- else
- {
- pGC->tileIsPixel = TRUE;
- }
-
- pGC->patOrg.x = 0;
- pGC->patOrg.y = 0;
- pGC->subWindowMode = ClipByChildren;
- pGC->graphicsExposures = TRUE;
- pGC->clipOrg.x = 0;
- pGC->clipOrg.y = 0;
- pGC->clientClipType = CT_NONE;
- pGC->clientClip = (pointer)NULL;
- pGC->numInDashList = 2;
- pGC->dash = DefaultDash;
- pGC->dashOffset = 0;
-
- /* use the default font and stipple */
- pGC->font = defaultFont;
- defaultFont->refcnt++;
- pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
- pGC->stipple->refcnt++;
-
- /* this is not a scratch GC */
- pGC->scratch_inuse = FALSE;
-
- /* security creation/labeling check */
- *pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC,
- RT_NONE, NULL, DixCreateAccess|DixSetAttrAccess);
- if (*pStatus != Success)
- goto out;
-
- pGC->stateChanges = GCAllBits;
- if (!(*pGC->pScreen->CreateGC)(pGC))
- *pStatus = BadAlloc;
- else if (mask)
- *pStatus = ChangeGCXIDs(client, pGC, mask, pval);
- else
- *pStatus = Success;
-
-out:
- if (*pStatus != Success)
- {
- if (!pGC->tileIsPixel && !pGC->tile.pixmap)
- pGC->tileIsPixel = TRUE; /* undo special case */
- FreeGC(pGC, (XID)0);
- pGC = (GCPtr)NULL;
- }
-
- return pGC;
-}
-
-static Bool
-CreateDefaultTile (GCPtr pGC)
-{
- ChangeGCVal tmpval[3];
- PixmapPtr pTile;
- GCPtr pgcScratch;
- xRectangle rect;
- CARD16 w, h;
-
- w = 1;
- h = 1;
- (*pGC->pScreen->QueryBestSize)(TileShape, &w, &h, pGC->pScreen);
- pTile = (PixmapPtr)
- (*pGC->pScreen->CreatePixmap)(pGC->pScreen,
- w, h, pGC->depth, 0);
- pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen);
- if (!pTile || !pgcScratch)
- {
- if (pTile)
- (*pTile->drawable.pScreen->DestroyPixmap)(pTile);
- if (pgcScratch)
- FreeScratchGC(pgcScratch);
- return FALSE;
- }
- tmpval[0].val = GXcopy;
- tmpval[1].val = pGC->tile.pixel;
- tmpval[2].val = FillSolid;
- (void)ChangeGC(NullClient, pgcScratch, GCFunction | GCForeground | GCFillStyle, tmpval);
- ValidateGC((DrawablePtr)pTile, pgcScratch);
- rect.x = 0;
- rect.y = 0;
- rect.width = w;
- rect.height = h;
- (*pgcScratch->ops->PolyFillRect)((DrawablePtr)pTile, pgcScratch, 1, &rect);
- /* Always remember to free the scratch graphics context after use. */
- FreeScratchGC(pgcScratch);
-
- pGC->tileIsPixel = FALSE;
- pGC->tile.pixmap = pTile;
- return TRUE;
-}
-
-int
-CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
-{
- BITS32 index2;
- BITS32 maskQ;
- int error = 0;
-
- if (pgcSrc == pgcDst)
- return Success;
- pgcDst->serialNumber |= GC_CHANGE_SERIAL_BIT;
- pgcDst->stateChanges |= mask;
- maskQ = mask;
- while (mask)
- {
- index2 = (BITS32) lowbit (mask);
- mask &= ~index2;
- switch (index2)
- {
- case GCFunction:
- pgcDst->alu = pgcSrc->alu;
- break;
- case GCPlaneMask:
- pgcDst->planemask = pgcSrc->planemask;
- break;
- case GCForeground:
- pgcDst->fgPixel = pgcSrc->fgPixel;
- break;
- case GCBackground:
- pgcDst->bgPixel = pgcSrc->bgPixel;
- break;
- case GCLineWidth:
- pgcDst->lineWidth = pgcSrc->lineWidth;
- break;
- case GCLineStyle:
- pgcDst->lineStyle = pgcSrc->lineStyle;
- break;
- case GCCapStyle:
- pgcDst->capStyle = pgcSrc->capStyle;
- break;
- case GCJoinStyle:
- pgcDst->joinStyle = pgcSrc->joinStyle;
- break;
- case GCFillStyle:
- pgcDst->fillStyle = pgcSrc->fillStyle;
- break;
- case GCFillRule:
- pgcDst->fillRule = pgcSrc->fillRule;
- break;
- case GCTile:
- {
- if (EqualPixUnion(pgcDst->tileIsPixel,
- pgcDst->tile,
- pgcSrc->tileIsPixel,
- pgcSrc->tile))
- {
- break;
- }
- if (!pgcDst->tileIsPixel)
- (* pgcDst->pScreen->DestroyPixmap)(pgcDst->tile.pixmap);
- pgcDst->tileIsPixel = pgcSrc->tileIsPixel;
- pgcDst->tile = pgcSrc->tile;
- if (!pgcDst->tileIsPixel)
- pgcDst->tile.pixmap->refcnt++;
- break;
- }
- case GCStipple:
- {
- if (pgcDst->stipple == pgcSrc->stipple)
- break;
- if (pgcDst->stipple)
- (* pgcDst->pScreen->DestroyPixmap)(pgcDst->stipple);
- pgcDst->stipple = pgcSrc->stipple;
- if (pgcDst->stipple)
- pgcDst->stipple->refcnt ++;
- break;
- }
- case GCTileStipXOrigin:
- pgcDst->patOrg.x = pgcSrc->patOrg.x;
- break;
- case GCTileStipYOrigin:
- pgcDst->patOrg.y = pgcSrc->patOrg.y;
- break;
- case GCFont:
- if (pgcDst->font == pgcSrc->font)
- break;
- if (pgcDst->font)
- CloseFont(pgcDst->font, (Font)0);
- if ((pgcDst->font = pgcSrc->font) != NullFont)
- (pgcDst->font)->refcnt++;
- break;
- case GCSubwindowMode:
- pgcDst->subWindowMode = pgcSrc->subWindowMode;
- break;
- case GCGraphicsExposures:
- pgcDst->graphicsExposures = pgcSrc->graphicsExposures;
- break;
- case GCClipXOrigin:
- pgcDst->clipOrg.x = pgcSrc->clipOrg.x;
- break;
- case GCClipYOrigin:
- pgcDst->clipOrg.y = pgcSrc->clipOrg.y;
- break;
- case GCClipMask:
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- break;
- case GCDashOffset:
- pgcDst->dashOffset = pgcSrc->dashOffset;
- break;
- case GCDashList:
- if (pgcSrc->dash == DefaultDash)
- {
- if (pgcDst->dash != DefaultDash)
- {
- free(pgcDst->dash);
- pgcDst->numInDashList = pgcSrc->numInDashList;
- pgcDst->dash = pgcSrc->dash;
- }
- }
- else
- {
- unsigned char *dash;
- unsigned int i;
-
- dash = malloc(pgcSrc->numInDashList * sizeof(unsigned char));
- if (dash)
- {
- if (pgcDst->dash != DefaultDash)
- free(pgcDst->dash);
- pgcDst->numInDashList = pgcSrc->numInDashList;
- pgcDst->dash = dash;
- for (i=0; i<pgcSrc->numInDashList; i++)
- dash[i] = pgcSrc->dash[i];
- }
- else
- error = BadAlloc;
- }
- break;
- case GCArcMode:
- pgcDst->arcMode = pgcSrc->arcMode;
- break;
- default:
- FatalError ("CopyGC: Unhandled mask!\n");
- }
- }
- if (pgcDst->fillStyle == FillTiled && pgcDst->tileIsPixel)
- {
- if (!CreateDefaultTile (pgcDst))
- {
- pgcDst->fillStyle = FillSolid;
- error = BadAlloc;
- }
- }
- (*pgcDst->funcs->CopyGC) (pgcSrc, maskQ, pgcDst);
- return error;
-}
-
-/**
- * does the diX part of freeing the characteristics in the GC.
- *
- * \param value must conform to DeleteType
- */
-int
-FreeGC(pointer value, XID gid)
-{
- GCPtr pGC = (GCPtr)value;
-
- CloseFont(pGC->font, (Font)0);
- (* pGC->funcs->DestroyClip)(pGC);
-
- if (!pGC->tileIsPixel)
- (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
- if (pGC->stipple)
- (* pGC->pScreen->DestroyPixmap)(pGC->stipple);
-
- (*pGC->funcs->DestroyGC) (pGC);
- if (pGC->dash != DefaultDash)
- free(pGC->dash);
- dixFreeObjectWithPrivates(pGC, PRIVATE_GC);
- return Success;
-}
-
-/* CreateScratchGC(pScreen, depth)
- like CreateGC, but doesn't do the default tile or stipple,
-since we can't create them without already having a GC. any code
-using the tile or stipple has to set them explicitly anyway,
-since the state of the scratch gc is unknown. This is OK
-because ChangeGC() has to be able to deal with NULL tiles and
-stipples anyway (in case the CreateGC() call has provided a
-value for them -- we can't set the default tile until the
-client-supplied attributes are installed, since the fgPixel
-is what fills the default tile. (maybe this comment should
-go with CreateGC() or ChangeGC().)
-*/
-
-static GCPtr
-CreateScratchGC(ScreenPtr pScreen, unsigned depth)
-{
- GCPtr pGC;
-
- pGC = dixAllocateObjectWithPrivates(GC, PRIVATE_GC);
- if (!pGC)
- return (GCPtr)NULL;
-
- pGC->pScreen = pScreen;
- pGC->depth = depth;
- pGC->alu = GXcopy; /* dst <- src */
- pGC->planemask = ~0;
- pGC->serialNumber = 0;
- pGC->fgPixel = 0;
- pGC->bgPixel = 1;
- pGC->lineWidth = 0;
- pGC->lineStyle = LineSolid;
- pGC->capStyle = CapButt;
- pGC->joinStyle = JoinMiter;
- pGC->fillStyle = FillSolid;
- pGC->fillRule = EvenOddRule;
- pGC->arcMode = ArcPieSlice;
- pGC->font = defaultFont;
- if ( pGC->font) /* necessary, because open of default font could fail */
- pGC->font->refcnt++;
- pGC->tileIsPixel = TRUE;
- pGC->tile.pixel = 0;
- pGC->tile.pixmap = NullPixmap;
- pGC->stipple = NullPixmap;
- pGC->patOrg.x = 0;
- pGC->patOrg.y = 0;
- pGC->subWindowMode = ClipByChildren;
- pGC->graphicsExposures = TRUE;
- pGC->clipOrg.x = 0;
- pGC->clipOrg.y = 0;
- pGC->clientClipType = CT_NONE;
- pGC->dashOffset = 0;
- pGC->numInDashList = 2;
- pGC->dash = DefaultDash;
-
- /* scratch GCs in the GCperDepth pool start off unused */
- pGC->scratch_inuse = FALSE;
-
- pGC->stateChanges = GCAllBits;
- if (!(*pScreen->CreateGC)(pGC))
- {
- FreeGC(pGC, (XID)0);
- pGC = (GCPtr)NULL;
- }
- return pGC;
-}
-
-void
-FreeGCperDepth(int screenNum)
-{
- int i;
- ScreenPtr pScreen;
- GCPtr *ppGC;
-
- pScreen = screenInfo.screens[screenNum];
- ppGC = pScreen->GCperDepth;
-
- for (i = 0; i <= pScreen->numDepths; i++)
- {
- (void)FreeGC(ppGC[i], (XID)0);
- ppGC[i] = NULL;
- }
-}
-
-
-Bool
-CreateGCperDepth(int screenNum)
-{
- int i;
- ScreenPtr pScreen;
- DepthPtr pDepth;
- GCPtr *ppGC;
-
- pScreen = screenInfo.screens[screenNum];
- ppGC = pScreen->GCperDepth;
- /* do depth 1 separately because it's not included in list */
- if (!(ppGC[0] = CreateScratchGC(pScreen, 1)))
- return FALSE;
- ppGC[0]->graphicsExposures = FALSE;
- /* Make sure we don't overflow GCperDepth[] */
- if( pScreen->numDepths > MAXFORMATS )
- return FALSE;
-
- pDepth = pScreen->allowedDepths;
- for (i=0; i<pScreen->numDepths; i++, pDepth++)
- {
- if (!(ppGC[i+1] = CreateScratchGC(pScreen, pDepth->depth)))
- {
- for (; i >= 0; i--)
- (void)FreeGC(ppGC[i], (XID)0);
- return FALSE;
- }
- ppGC[i+1]->graphicsExposures = FALSE;
- }
- return TRUE;
-}
-
-Bool
-CreateDefaultStipple(int screenNum)
-{
- ScreenPtr pScreen;
- ChangeGCVal tmpval[3];
- xRectangle rect;
- CARD16 w, h;
- GCPtr pgcScratch;
-
- pScreen = screenInfo.screens[screenNum];
-
- w = 16;
- h = 16;
- (* pScreen->QueryBestSize)(StippleShape, &w, &h, pScreen);
- if (!(pScreen->PixmapPerDepth[0] =
- (*pScreen->CreatePixmap)(pScreen, w, h, 1, 0)))
- return FALSE;
- /* fill stipple with 1 */
- tmpval[0].val = GXcopy;
- tmpval[1].val = 1;
- tmpval[2].val = FillSolid;
- pgcScratch = GetScratchGC(1, pScreen);
- if (!pgcScratch)
- {
- (*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
- return FALSE;
- }
- (void)ChangeGC(NullClient, pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval);
- ValidateGC((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch);
- rect.x = 0;
- rect.y = 0;
- rect.width = w;
- rect.height = h;
- (*pgcScratch->ops->PolyFillRect)((DrawablePtr)pScreen->PixmapPerDepth[0],
- pgcScratch, 1, &rect);
- FreeScratchGC(pgcScratch);
- return TRUE;
-}
-
-void
-FreeDefaultStipple(int screenNum)
-{
- ScreenPtr pScreen = screenInfo.screens[screenNum];
- (*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
-}
-
-int
-SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
-{
- long i;
- unsigned char *p, *indash;
- BITS32 maskQ = 0;
-
- i = ndash;
- p = pdash;
- while (i--)
- {
- if (!*p++)
- {
- /* dash segment must be > 0 */
- return BadValue;
- }
- }
-
- if (ndash & 1)
- p = malloc(2 * ndash * sizeof(unsigned char));
- else
- p = malloc(ndash * sizeof(unsigned char));
- if (!p)
- return BadAlloc;
-
- pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
- if (offset != pGC->dashOffset)
- {
- pGC->dashOffset = offset;
- pGC->stateChanges |= GCDashOffset;
- maskQ |= GCDashOffset;
- }
-
- if (pGC->dash != DefaultDash)
- free(pGC->dash);
- pGC->numInDashList = ndash;
- pGC->dash = p;
- if (ndash & 1)
- {
- pGC->numInDashList += ndash;
- indash = pdash;
- i = ndash;
- while (i--)
- *p++ = *indash++;
- }
- while(ndash--)
- *p++ = *pdash++;
- pGC->stateChanges |= GCDashList;
- maskQ |= GCDashList;
-
- if (pGC->funcs->ChangeGC)
- (*pGC->funcs->ChangeGC) (pGC, maskQ);
- return Success;
-}
-
-int
-VerifyRectOrder(int nrects, xRectangle *prects, int ordering)
-{
- xRectangle *prectP, *prectN;
- int i;
-
- switch(ordering)
- {
- case Unsorted:
- return CT_UNSORTED;
- case YSorted:
- if(nrects > 1)
- {
- for(i = 1, prectP = prects, prectN = prects + 1;
- i < nrects;
- i++, prectP++, prectN++)
- if(prectN->y < prectP->y)
- return -1;
- }
- return CT_YSORTED;
- case YXSorted:
- if(nrects > 1)
- {
- for(i = 1, prectP = prects, prectN = prects + 1;
- i < nrects;
- i++, prectP++, prectN++)
- if((prectN->y < prectP->y) ||
- ( (prectN->y == prectP->y) &&
- (prectN->x < prectP->x) ) )
- return -1;
- }
- return CT_YXSORTED;
- case YXBanded:
- if(nrects > 1)
- {
- for(i = 1, prectP = prects, prectN = prects + 1;
- i < nrects;
- i++, prectP++, prectN++)
- if((prectN->y != prectP->y &&
- prectN->y < prectP->y + (int) prectP->height) ||
- ((prectN->y == prectP->y) &&
- (prectN->height != prectP->height ||
- prectN->x < prectP->x + (int) prectP->width)))
- return -1;
- }
- return CT_YXBANDED;
- }
- return -1;
-}
-
-int
-SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
- xRectangle *prects, int ordering)
-{
- int newct, size;
- xRectangle *prectsNew;
-
- newct = VerifyRectOrder(nrects, prects, ordering);
- if (newct < 0)
- return BadMatch;
- size = nrects * sizeof(xRectangle);
- prectsNew = malloc(size);
- if (!prectsNew && size)
- return BadAlloc;
-
- pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
- pGC->clipOrg.x = xOrigin;
- pGC->stateChanges |= GCClipXOrigin;
-
- pGC->clipOrg.y = yOrigin;
- pGC->stateChanges |= GCClipYOrigin;
-
- if (size)
- memmove((char *)prectsNew, (char *)prects, size);
- (*pGC->funcs->ChangeClip)(pGC, newct, (pointer)prectsNew, nrects);
- if (pGC->funcs->ChangeGC)
- (*pGC->funcs->ChangeGC) (pGC, GCClipXOrigin|GCClipYOrigin|GCClipMask);
- return Success;
-}
-
-
-/*
- sets reasonable defaults
- if we can get a pre-allocated one, use it and mark it as used.
- if we can't, create one out of whole cloth (The Velveteen GC -- if
- you use it often enough it will become real.)
-*/
-GCPtr
-GetScratchGC(unsigned depth, ScreenPtr pScreen)
-{
- int i;
- GCPtr pGC;
-
- for (i=0; i<=pScreen->numDepths; i++)
- {
- pGC = pScreen->GCperDepth[i];
- if (pGC && pGC->depth == depth && !pGC->scratch_inuse)
- {
- pGC->scratch_inuse = TRUE;
-
- pGC->alu = GXcopy;
- pGC->planemask = ~0;
- pGC->serialNumber = 0;
- pGC->fgPixel = 0;
- pGC->bgPixel = 1;
- pGC->lineWidth = 0;
- pGC->lineStyle = LineSolid;
- pGC->capStyle = CapButt;
- pGC->joinStyle = JoinMiter;
- pGC->fillStyle = FillSolid;
- pGC->fillRule = EvenOddRule;
- pGC->arcMode = ArcChord;
- pGC->patOrg.x = 0;
- pGC->patOrg.y = 0;
- pGC->subWindowMode = ClipByChildren;
- pGC->graphicsExposures = FALSE;
- pGC->clipOrg.x = 0;
- pGC->clipOrg.y = 0;
- if (pGC->clientClipType != CT_NONE)
- (*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
- pGC->stateChanges = GCAllBits;
- return pGC;
- }
- }
- /* if we make it this far, need to roll our own */
- pGC = CreateScratchGC(pScreen, depth);
- if (pGC)
- pGC->graphicsExposures = FALSE;
- return pGC;
-}
-
-/*
- if the gc to free is in the table of pre-existing ones,
-mark it as available.
- if not, free it for real
-*/
-void
-FreeScratchGC(GCPtr pGC)
-{
- if (pGC->scratch_inuse)
- pGC->scratch_inuse = FALSE;
- else
- FreeGC(pGC, (GContext)0);
-}
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "resource.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+#include "region.h"
+#include "dixstruct.h"
+
+#include "privates.h"
+#include "dix.h"
+#include "xace.h"
+#include <assert.h>
+
+extern FontPtr defaultFont;
+
+static Bool CreateDefaultTile(GCPtr pGC);
+
+static unsigned char DefaultDash[2] = { 4, 4 };
+
+void
+ValidateGC(DrawablePtr pDraw, GC * pGC)
+{
+ (*pGC->funcs->ValidateGC) (pGC, pGC->stateChanges, pDraw);
+ pGC->stateChanges = 0;
+ pGC->serialNumber = pDraw->serialNumber;
+}
+
+/*
+ * ChangeGC/ChangeGCXIDs:
+ *
+ * The client performing the gc change must be passed so that access
+ * checks can be performed on any tiles, stipples, or fonts that are
+ * specified. ddxen can call this too; they should normally pass
+ * NullClient for the client since any access checking should have
+ * already been done at a higher level.
+ *
+ * If you have any XIDs, you must use ChangeGCXIDs:
+ *
+ * CARD32 v[2];
+ * v[0] = FillTiled;
+ * v[1] = pid;
+ * ChangeGCXIDs(client, pGC, GCFillStyle|GCTile, v);
+ *
+ * However, if you need to pass a pointer to a pixmap or font, you must
+ * use ChangeGC:
+ *
+ * ChangeGCVal v[2];
+ * v[0].val = FillTiled;
+ * v[1].ptr = pPixmap;
+ * ChangeGC(client, pGC, GCFillStyle|GCTile, v);
+ *
+ * If you have neither XIDs nor pointers, you can use either function,
+ * but ChangeGC will do less work.
+ *
+ * ChangeGCVal v[2];
+ * v[0].val = foreground;
+ * v[1].val = background;
+ * ChangeGC(client, pGC, GCForeground|GCBackground, v);
+ */
+
+#define NEXTVAL(_type, _var) { \
+ _var = (_type)(pUnion->val); pUnion++; \
+ }
+
+#define NEXT_PTR(_type, _var) { \
+ _var = (_type)pUnion->ptr; pUnion++; }
+
+int
+ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion)
+{
+ BITS32 index2;
+ int error = 0;
+ PixmapPtr pPixmap;
+ BITS32 maskQ;
+
+ assert(pUnion);
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+
+ maskQ = mask; /* save these for when we walk the GCque */
+ while (mask && !error) {
+ index2 = (BITS32) lowbit(mask);
+ mask &= ~index2;
+ pGC->stateChanges |= index2;
+ switch (index2) {
+ case GCFunction:
+ {
+ CARD8 newalu;
+ NEXTVAL(CARD8, newalu);
+
+ if (newalu <= GXset)
+ pGC->alu = newalu;
+ else {
+ if (client)
+ client->errorValue = newalu;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCPlaneMask:
+ NEXTVAL(unsigned long, pGC->planemask);
+
+ break;
+ case GCForeground:
+ NEXTVAL(unsigned long, pGC->fgPixel);
+
+ /*
+ * this is for CreateGC
+ */
+ if (!pGC->tileIsPixel && !pGC->tile.pixmap) {
+ pGC->tileIsPixel = TRUE;
+ pGC->tile.pixel = pGC->fgPixel;
+ }
+ break;
+ case GCBackground:
+ NEXTVAL(unsigned long, pGC->bgPixel);
+
+ break;
+ case GCLineWidth: /* ??? line width is a CARD16 */
+ NEXTVAL(CARD16, pGC->lineWidth);
+
+ break;
+ case GCLineStyle:
+ {
+ unsigned int newlinestyle;
+ NEXTVAL(unsigned int, newlinestyle);
+
+ if (newlinestyle <= LineDoubleDash)
+ pGC->lineStyle = newlinestyle;
+ else {
+ if (client)
+ client->errorValue = newlinestyle;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCCapStyle:
+ {
+ unsigned int newcapstyle;
+ NEXTVAL(unsigned int, newcapstyle);
+
+ if (newcapstyle <= CapProjecting)
+ pGC->capStyle = newcapstyle;
+ else {
+ if (client)
+ client->errorValue = newcapstyle;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCJoinStyle:
+ {
+ unsigned int newjoinstyle;
+ NEXTVAL(unsigned int, newjoinstyle);
+
+ if (newjoinstyle <= JoinBevel)
+ pGC->joinStyle = newjoinstyle;
+ else {
+ if (client)
+ client->errorValue = newjoinstyle;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCFillStyle:
+ {
+ unsigned int newfillstyle;
+ NEXTVAL(unsigned int, newfillstyle);
+
+ if (newfillstyle <= FillOpaqueStippled)
+ pGC->fillStyle = newfillstyle;
+ else {
+ if (client)
+ client->errorValue = newfillstyle;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCFillRule:
+ {
+ unsigned int newfillrule;
+ NEXTVAL(unsigned int, newfillrule);
+
+ if (newfillrule <= WindingRule)
+ pGC->fillRule = newfillrule;
+ else {
+ if (client)
+ client->errorValue = newfillrule;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCTile:
+ NEXT_PTR(PixmapPtr, pPixmap);
+
+ if ((pPixmap->drawable.depth != pGC->depth) ||
+ (pPixmap->drawable.pScreen != pGC->pScreen)) {
+ error = BadMatch;
+ }
+ else {
+ pPixmap->refcnt++;
+ if (!pGC->tileIsPixel)
+ (*pGC->pScreen->DestroyPixmap) (pGC->tile.pixmap);
+ pGC->tileIsPixel = FALSE;
+ pGC->tile.pixmap = pPixmap;
+ }
+ break;
+ case GCStipple:
+ NEXT_PTR(PixmapPtr, pPixmap);
+
+ if ((pPixmap->drawable.depth != 1) ||
+ (pPixmap->drawable.pScreen != pGC->pScreen)) {
+ error = BadMatch;
+ }
+ else {
+ pPixmap->refcnt++;
+ if (pGC->stipple)
+ (*pGC->pScreen->DestroyPixmap) (pGC->stipple);
+ pGC->stipple = pPixmap;
+ }
+ break;
+ case GCTileStipXOrigin:
+ NEXTVAL(INT16, pGC->patOrg.x);
+
+ break;
+ case GCTileStipYOrigin:
+ NEXTVAL(INT16, pGC->patOrg.y);
+
+ break;
+ case GCFont:
+ {
+ FontPtr pFont;
+ NEXT_PTR(FontPtr, pFont);
+
+ pFont->refcnt++;
+ if (pGC->font)
+ CloseFont(pGC->font, (Font) 0);
+ pGC->font = pFont;
+ break;
+ }
+ case GCSubwindowMode:
+ {
+ unsigned int newclipmode;
+ NEXTVAL(unsigned int, newclipmode);
+
+ if (newclipmode <= IncludeInferiors)
+ pGC->subWindowMode = newclipmode;
+ else {
+ if (client)
+ client->errorValue = newclipmode;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCGraphicsExposures:
+ {
+ unsigned int newge;
+ NEXTVAL(unsigned int, newge);
+
+ if (newge <= xTrue)
+ pGC->graphicsExposures = newge;
+ else {
+ if (client)
+ client->errorValue = newge;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCClipXOrigin:
+ #ifndef _DEBUG
+ NEXTVAL(INT16, pGC->clipOrg.x);
+ #else
+ {
+ long Val;
+ NEXTVAL(long, Val);
+ if (abs(Val)>65535)
+ ErrorF("Value received for GCClipXOrigin is too large %x\n",Val);
+ pGC->clipOrg.x=(INT16)(Val&0xffff);
+ }
+ #endif
+ break;
+ case GCClipYOrigin:
+ #ifndef _DEBUG
+ NEXTVAL(INT16, pGC->clipOrg.y);
+ #else
+ {
+ long Val;
+ NEXTVAL(long, Val);
+ if (abs(Val)>65535)
+ ErrorF("Value received for GCClipYOrigin is too large %x\n",Val);
+ pGC->clipOrg.y=(INT16)(Val&0xffff);
+ }
+ #endif
+ break;
+ case GCClipMask:
+ NEXT_PTR(PixmapPtr, pPixmap);
+
+ if (pPixmap) {
+ if ((pPixmap->drawable.depth != 1) ||
+ (pPixmap->drawable.pScreen != pGC->pScreen)) {
+ error = BadMatch;
+ break;
+ }
+ pPixmap->refcnt++;
+ }
+ (*pGC->funcs->ChangeClip) (pGC, pPixmap ? CT_PIXMAP : CT_NONE,
+ (pointer) pPixmap, 0);
+ break;
+ case GCDashOffset:
+ NEXTVAL(INT16, pGC->dashOffset);
+
+ break;
+ case GCDashList:
+ {
+ CARD8 newdash;
+ NEXTVAL(CARD8, newdash);
+
+ if (newdash == 4) {
+ if (pGC->dash != DefaultDash) {
+ free(pGC->dash);
+ pGC->numInDashList = 2;
+ pGC->dash = DefaultDash;
+ }
+ }
+ else if (newdash != 0) {
+ unsigned char *dash;
+
+ dash = malloc(2 * sizeof(unsigned char));
+ if (dash) {
+ if (pGC->dash != DefaultDash)
+ free(pGC->dash);
+ pGC->numInDashList = 2;
+ pGC->dash = dash;
+ dash[0] = newdash;
+ dash[1] = newdash;
+ }
+ else
+ error = BadAlloc;
+ }
+ else {
+ if (client)
+ client->errorValue = newdash;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCArcMode:
+ {
+ unsigned int newarcmode;
+ NEXTVAL(unsigned int, newarcmode);
+
+ if (newarcmode <= ArcPieSlice)
+ pGC->arcMode = newarcmode;
+ else {
+ if (client)
+ client->errorValue = newarcmode;
+ error = BadValue;
+ }
+ break;
+ }
+ default:
+ if (client)
+ client->errorValue = maskQ;
+ error = BadValue;
+ break;
+ }
+ } /* end while mask && !error */
+
+ if (pGC->fillStyle == FillTiled && pGC->tileIsPixel) {
+ if (!CreateDefaultTile(pGC)) {
+ pGC->fillStyle = FillSolid;
+ error = BadAlloc;
+ }
+ }
+ (*pGC->funcs->ChangeGC) (pGC, maskQ);
+ return error;
+}
+
+#undef NEXTVAL
+#undef NEXT_PTR
+
+static const struct {
+ BITS32 mask;
+ RESTYPE type;
+ Mask access_mode;
+} xidfields[] = {
+ {
+ GCTile, RT_PIXMAP, DixReadAccess}, {
+ GCStipple, RT_PIXMAP, DixReadAccess}, {
+ GCFont, RT_FONT, DixUseAccess}, {
+GCClipMask, RT_PIXMAP, DixReadAccess},};
+
+int
+ChangeGCXIDs(ClientPtr client, GC * pGC, BITS32 mask, CARD32 *pC32)
+{
+ ChangeGCVal vals[GCLastBit + 1];
+ int i;
+
+ if (mask & ~GCAllBits) {
+ client->errorValue = mask;
+ return BadValue;
+ }
+ for (i = Ones(mask); i--;)
+ vals[i].val = pC32[i];
+ for (i = 0; i < sizeof(xidfields) / sizeof(*xidfields); ++i) {
+ int offset, rc;
+
+ if (!(mask & xidfields[i].mask))
+ continue;
+ offset = Ones(mask & (xidfields[i].mask - 1));
+ if (xidfields[i].mask == GCClipMask && vals[offset].val == None) {
+ vals[offset].ptr = NullPixmap;
+ continue;
+ }
+ rc = dixLookupResourceByType(&vals[offset].ptr, vals[offset].val,
+ xidfields[i].type, client,
+ xidfields[i].access_mode);
+ if (rc != Success) {
+ client->errorValue = vals[offset].val;
+ return rc;
+ }
+ }
+ return ChangeGC(client, pGC, mask, vals);
+}
+
+/* CreateGC(pDrawable, mask, pval, pStatus)
+ creates a default GC for the given drawable, using mask to fill
+ in any non-default values.
+ Returns a pointer to the new GC on success, NULL otherwise.
+ returns status of non-default fields in pStatus
+BUG:
+ should check for failure to create default tile
+
+*/
+GCPtr
+CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
+ XID gcid, ClientPtr client)
+{
+ GCPtr pGC;
+
+ pGC = dixAllocateObjectWithPrivates(GC, PRIVATE_GC);
+ if (!pGC) {
+ *pStatus = BadAlloc;
+ return (GCPtr) NULL;
+ }
+
+ pGC->pScreen = pDrawable->pScreen;
+ pGC->depth = pDrawable->depth;
+ pGC->alu = GXcopy; /* dst <- src */
+ pGC->planemask = ~0;
+ pGC->serialNumber = GC_CHANGE_SERIAL_BIT;
+ pGC->funcs = 0;
+ pGC->fgPixel = 0;
+ pGC->bgPixel = 1;
+ pGC->lineWidth = 0;
+ pGC->lineStyle = LineSolid;
+ pGC->capStyle = CapButt;
+ pGC->joinStyle = JoinMiter;
+ pGC->fillStyle = FillSolid;
+ pGC->fillRule = EvenOddRule;
+ pGC->arcMode = ArcPieSlice;
+ pGC->tile.pixel = 0;
+ pGC->tile.pixmap = NullPixmap;
+ if (mask & GCForeground) {
+ /*
+ * magic special case -- ChangeGC checks for this condition
+ * and snags the Foreground value to create a pseudo default-tile
+ */
+ pGC->tileIsPixel = FALSE;
+ }
+ else {
+ pGC->tileIsPixel = TRUE;
+ }
+
+ pGC->patOrg.x = 0;
+ pGC->patOrg.y = 0;
+ pGC->subWindowMode = ClipByChildren;
+ pGC->graphicsExposures = TRUE;
+ pGC->clipOrg.x = 0;
+ pGC->clipOrg.y = 0;
+ pGC->clientClipType = CT_NONE;
+ pGC->clientClip = (pointer) NULL;
+ pGC->numInDashList = 2;
+ pGC->dash = DefaultDash;
+ pGC->dashOffset = 0;
+
+ /* use the default font and stipple */
+ pGC->font = defaultFont;
+ defaultFont->refcnt++;
+ pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
+ pGC->stipple->refcnt++;
+
+ /* this is not a scratch GC */
+ pGC->scratch_inuse = FALSE;
+
+ /* security creation/labeling check */
+ *pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC,
+ RT_NONE, NULL, DixCreateAccess | DixSetAttrAccess);
+ if (*pStatus != Success)
+ goto out;
+
+ pGC->stateChanges = GCAllBits;
+ if (!(*pGC->pScreen->CreateGC) (pGC))
+ *pStatus = BadAlloc;
+ else if (mask)
+ *pStatus = ChangeGCXIDs(client, pGC, mask, pval);
+ else
+ *pStatus = Success;
+
+ out:
+ if (*pStatus != Success) {
+ if (!pGC->tileIsPixel && !pGC->tile.pixmap)
+ pGC->tileIsPixel = TRUE; /* undo special case */
+ FreeGC(pGC, (XID) 0);
+ pGC = (GCPtr) NULL;
+ }
+
+ return pGC;
+}
+
+static Bool
+CreateDefaultTile(GCPtr pGC)
+{
+ ChangeGCVal tmpval[3];
+ PixmapPtr pTile;
+ GCPtr pgcScratch;
+ xRectangle rect;
+ CARD16 w, h;
+
+ w = 1;
+ h = 1;
+ (*pGC->pScreen->QueryBestSize) (TileShape, &w, &h, pGC->pScreen);
+ pTile = (PixmapPtr)
+ (*pGC->pScreen->CreatePixmap) (pGC->pScreen, w, h, pGC->depth, 0);
+ pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen);
+ if (!pTile || !pgcScratch) {
+ if (pTile)
+ (*pTile->drawable.pScreen->DestroyPixmap) (pTile);
+ if (pgcScratch)
+ FreeScratchGC(pgcScratch);
+ return FALSE;
+ }
+ tmpval[0].val = GXcopy;
+ tmpval[1].val = pGC->tile.pixel;
+ tmpval[2].val = FillSolid;
+ (void) ChangeGC(NullClient, pgcScratch,
+ GCFunction | GCForeground | GCFillStyle, tmpval);
+ ValidateGC((DrawablePtr) pTile, pgcScratch);
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = w;
+ rect.height = h;
+ (*pgcScratch->ops->PolyFillRect) ((DrawablePtr) pTile, pgcScratch, 1,
+ &rect);
+ /* Always remember to free the scratch graphics context after use. */
+ FreeScratchGC(pgcScratch);
+
+ pGC->tileIsPixel = FALSE;
+ pGC->tile.pixmap = pTile;
+ return TRUE;
+}
+
+int
+CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask)
+{
+ BITS32 index2;
+ BITS32 maskQ;
+ int error = 0;
+
+ if (pgcSrc == pgcDst)
+ return Success;
+ pgcDst->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pgcDst->stateChanges |= mask;
+ maskQ = mask;
+ while (mask) {
+ index2 = (BITS32) lowbit(mask);
+ mask &= ~index2;
+ switch (index2) {
+ case GCFunction:
+ pgcDst->alu = pgcSrc->alu;
+ break;
+ case GCPlaneMask:
+ pgcDst->planemask = pgcSrc->planemask;
+ break;
+ case GCForeground:
+ pgcDst->fgPixel = pgcSrc->fgPixel;
+ break;
+ case GCBackground:
+ pgcDst->bgPixel = pgcSrc->bgPixel;
+ break;
+ case GCLineWidth:
+ pgcDst->lineWidth = pgcSrc->lineWidth;
+ break;
+ case GCLineStyle:
+ pgcDst->lineStyle = pgcSrc->lineStyle;
+ break;
+ case GCCapStyle:
+ pgcDst->capStyle = pgcSrc->capStyle;
+ break;
+ case GCJoinStyle:
+ pgcDst->joinStyle = pgcSrc->joinStyle;
+ break;
+ case GCFillStyle:
+ pgcDst->fillStyle = pgcSrc->fillStyle;
+ break;
+ case GCFillRule:
+ pgcDst->fillRule = pgcSrc->fillRule;
+ break;
+ case GCTile:
+ {
+ if (EqualPixUnion(pgcDst->tileIsPixel,
+ pgcDst->tile,
+ pgcSrc->tileIsPixel, pgcSrc->tile)) {
+ break;
+ }
+ if (!pgcDst->tileIsPixel)
+ (*pgcDst->pScreen->DestroyPixmap) (pgcDst->tile.pixmap);
+ pgcDst->tileIsPixel = pgcSrc->tileIsPixel;
+ pgcDst->tile = pgcSrc->tile;
+ if (!pgcDst->tileIsPixel)
+ pgcDst->tile.pixmap->refcnt++;
+ break;
+ }
+ case GCStipple:
+ {
+ if (pgcDst->stipple == pgcSrc->stipple)
+ break;
+ if (pgcDst->stipple)
+ (*pgcDst->pScreen->DestroyPixmap) (pgcDst->stipple);
+ pgcDst->stipple = pgcSrc->stipple;
+ if (pgcDst->stipple)
+ pgcDst->stipple->refcnt++;
+ break;
+ }
+ case GCTileStipXOrigin:
+ pgcDst->patOrg.x = pgcSrc->patOrg.x;
+ break;
+ case GCTileStipYOrigin:
+ pgcDst->patOrg.y = pgcSrc->patOrg.y;
+ break;
+ case GCFont:
+ if (pgcDst->font == pgcSrc->font)
+ break;
+ if (pgcDst->font)
+ CloseFont(pgcDst->font, (Font) 0);
+ if ((pgcDst->font = pgcSrc->font) != NullFont)
+ (pgcDst->font)->refcnt++;
+ break;
+ case GCSubwindowMode:
+ pgcDst->subWindowMode = pgcSrc->subWindowMode;
+ break;
+ case GCGraphicsExposures:
+ pgcDst->graphicsExposures = pgcSrc->graphicsExposures;
+ break;
+ case GCClipXOrigin:
+ pgcDst->clipOrg.x = pgcSrc->clipOrg.x;
+ break;
+ case GCClipYOrigin:
+ pgcDst->clipOrg.y = pgcSrc->clipOrg.y;
+ break;
+ case GCClipMask:
+ (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
+ break;
+ case GCDashOffset:
+ pgcDst->dashOffset = pgcSrc->dashOffset;
+ break;
+ case GCDashList:
+ if (pgcSrc->dash == DefaultDash) {
+ if (pgcDst->dash != DefaultDash) {
+ free(pgcDst->dash);
+ pgcDst->numInDashList = pgcSrc->numInDashList;
+ pgcDst->dash = pgcSrc->dash;
+ }
+ }
+ else {
+ unsigned char *dash;
+ unsigned int i;
+
+ dash = malloc(pgcSrc->numInDashList * sizeof(unsigned char));
+ if (dash) {
+ if (pgcDst->dash != DefaultDash)
+ free(pgcDst->dash);
+ pgcDst->numInDashList = pgcSrc->numInDashList;
+ pgcDst->dash = dash;
+ for (i = 0; i < pgcSrc->numInDashList; i++)
+ dash[i] = pgcSrc->dash[i];
+ }
+ else
+ error = BadAlloc;
+ }
+ break;
+ case GCArcMode:
+ pgcDst->arcMode = pgcSrc->arcMode;
+ break;
+ default:
+ FatalError("CopyGC: Unhandled mask!\n");
+ }
+ }
+ if (pgcDst->fillStyle == FillTiled && pgcDst->tileIsPixel) {
+ if (!CreateDefaultTile(pgcDst)) {
+ pgcDst->fillStyle = FillSolid;
+ error = BadAlloc;
+ }
+ }
+ (*pgcDst->funcs->CopyGC) (pgcSrc, maskQ, pgcDst);
+ return error;
+}
+
+/**
+ * does the diX part of freeing the characteristics in the GC.
+ *
+ * \param value must conform to DeleteType
+ */
+int
+FreeGC(pointer value, XID gid)
+{
+ GCPtr pGC = (GCPtr) value;
+
+ CloseFont(pGC->font, (Font) 0);
+ (*pGC->funcs->DestroyClip) (pGC);
+
+ if (!pGC->tileIsPixel)
+ (*pGC->pScreen->DestroyPixmap) (pGC->tile.pixmap);
+ if (pGC->stipple)
+ (*pGC->pScreen->DestroyPixmap) (pGC->stipple);
+
+ (*pGC->funcs->DestroyGC) (pGC);
+ if (pGC->dash != DefaultDash)
+ free(pGC->dash);
+ dixFreeObjectWithPrivates(pGC, PRIVATE_GC);
+ return Success;
+}
+
+/* CreateScratchGC(pScreen, depth)
+ like CreateGC, but doesn't do the default tile or stipple,
+since we can't create them without already having a GC. any code
+using the tile or stipple has to set them explicitly anyway,
+since the state of the scratch gc is unknown. This is OK
+because ChangeGC() has to be able to deal with NULL tiles and
+stipples anyway (in case the CreateGC() call has provided a
+value for them -- we can't set the default tile until the
+client-supplied attributes are installed, since the fgPixel
+is what fills the default tile. (maybe this comment should
+go with CreateGC() or ChangeGC().)
+*/
+
+static GCPtr
+CreateScratchGC(ScreenPtr pScreen, unsigned depth)
+{
+ GCPtr pGC;
+
+ pGC = dixAllocateObjectWithPrivates(GC, PRIVATE_GC);
+ if (!pGC)
+ return (GCPtr) NULL;
+
+ pGC->pScreen = pScreen;
+ pGC->depth = depth;
+ pGC->alu = GXcopy; /* dst <- src */
+ pGC->planemask = ~0;
+ pGC->serialNumber = 0;
+ pGC->fgPixel = 0;
+ pGC->bgPixel = 1;
+ pGC->lineWidth = 0;
+ pGC->lineStyle = LineSolid;
+ pGC->capStyle = CapButt;
+ pGC->joinStyle = JoinMiter;
+ pGC->fillStyle = FillSolid;
+ pGC->fillRule = EvenOddRule;
+ pGC->arcMode = ArcPieSlice;
+ pGC->font = defaultFont;
+ if (pGC->font) /* necessary, because open of default font could fail */
+ pGC->font->refcnt++;
+ pGC->tileIsPixel = TRUE;
+ pGC->tile.pixel = 0;
+ pGC->tile.pixmap = NullPixmap;
+ pGC->stipple = NullPixmap;
+ pGC->patOrg.x = 0;
+ pGC->patOrg.y = 0;
+ pGC->subWindowMode = ClipByChildren;
+ pGC->graphicsExposures = TRUE;
+ pGC->clipOrg.x = 0;
+ pGC->clipOrg.y = 0;
+ pGC->clientClipType = CT_NONE;
+ pGC->dashOffset = 0;
+ pGC->numInDashList = 2;
+ pGC->dash = DefaultDash;
+
+ /* scratch GCs in the GCperDepth pool start off unused */
+ pGC->scratch_inuse = FALSE;
+
+ pGC->stateChanges = GCAllBits;
+ if (!(*pScreen->CreateGC) (pGC)) {
+ FreeGC(pGC, (XID) 0);
+ pGC = (GCPtr) NULL;
+ }
+ return pGC;
+}
+
+void
+FreeGCperDepth(int screenNum)
+{
+ int i;
+ ScreenPtr pScreen;
+ GCPtr *ppGC;
+
+ pScreen = screenInfo.screens[screenNum];
+ ppGC = pScreen->GCperDepth;
+
+ for (i = 0; i <= pScreen->numDepths; i++) {
+ (void) FreeGC(ppGC[i], (XID) 0);
+ ppGC[i] = NULL;
+ }
+}
+
+Bool
+CreateGCperDepth(int screenNum)
+{
+ int i;
+ ScreenPtr pScreen;
+ DepthPtr pDepth;
+ GCPtr *ppGC;
+
+ pScreen = screenInfo.screens[screenNum];
+ ppGC = pScreen->GCperDepth;
+ /* do depth 1 separately because it's not included in list */
+ if (!(ppGC[0] = CreateScratchGC(pScreen, 1)))
+ return FALSE;
+ ppGC[0]->graphicsExposures = FALSE;
+ /* Make sure we don't overflow GCperDepth[] */
+ if (pScreen->numDepths > MAXFORMATS)
+ return FALSE;
+
+ pDepth = pScreen->allowedDepths;
+ for (i = 0; i < pScreen->numDepths; i++, pDepth++) {
+ if (!(ppGC[i + 1] = CreateScratchGC(pScreen, pDepth->depth))) {
+ for (; i >= 0; i--)
+ (void) FreeGC(ppGC[i], (XID) 0);
+ return FALSE;
+ }
+ ppGC[i + 1]->graphicsExposures = FALSE;
+ }
+ return TRUE;
+}
+
+Bool
+CreateDefaultStipple(int screenNum)
+{
+ ScreenPtr pScreen;
+ ChangeGCVal tmpval[3];
+ xRectangle rect;
+ CARD16 w, h;
+ GCPtr pgcScratch;
+
+ pScreen = screenInfo.screens[screenNum];
+
+ w = 16;
+ h = 16;
+ (*pScreen->QueryBestSize) (StippleShape, &w, &h, pScreen);
+ if (!(pScreen->PixmapPerDepth[0] =
+ (*pScreen->CreatePixmap) (pScreen, w, h, 1, 0)))
+ return FALSE;
+ /* fill stipple with 1 */
+ tmpval[0].val = GXcopy;
+ tmpval[1].val = 1;
+ tmpval[2].val = FillSolid;
+ pgcScratch = GetScratchGC(1, pScreen);
+ if (!pgcScratch) {
+ (*pScreen->DestroyPixmap) (pScreen->PixmapPerDepth[0]);
+ return FALSE;
+ }
+ (void) ChangeGC(NullClient, pgcScratch,
+ GCFunction | GCForeground | GCFillStyle, tmpval);
+ ValidateGC((DrawablePtr) pScreen->PixmapPerDepth[0], pgcScratch);
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = w;
+ rect.height = h;
+ (*pgcScratch->ops->PolyFillRect) ((DrawablePtr) pScreen->PixmapPerDepth[0],
+ pgcScratch, 1, &rect);
+ FreeScratchGC(pgcScratch);
+ return TRUE;
+}
+
+void
+FreeDefaultStipple(int screenNum)
+{
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+
+ (*pScreen->DestroyPixmap) (pScreen->PixmapPerDepth[0]);
+}
+
+int
+SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
+{
+ long i;
+ unsigned char *p, *indash;
+ BITS32 maskQ = 0;
+
+ i = ndash;
+ p = pdash;
+ while (i--) {
+ if (!*p++) {
+ /* dash segment must be > 0 */
+ return BadValue;
+ }
+ }
+
+ if (ndash & 1)
+ p = malloc(2 * ndash * sizeof(unsigned char));
+ else
+ p = malloc(ndash * sizeof(unsigned char));
+ if (!p)
+ return BadAlloc;
+
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ if (offset != pGC->dashOffset) {
+ pGC->dashOffset = offset;
+ pGC->stateChanges |= GCDashOffset;
+ maskQ |= GCDashOffset;
+ }
+
+ if (pGC->dash != DefaultDash)
+ free(pGC->dash);
+ pGC->numInDashList = ndash;
+ pGC->dash = p;
+ if (ndash & 1) {
+ pGC->numInDashList += ndash;
+ indash = pdash;
+ i = ndash;
+ while (i--)
+ *p++ = *indash++;
+ }
+ while (ndash--)
+ *p++ = *pdash++;
+ pGC->stateChanges |= GCDashList;
+ maskQ |= GCDashList;
+
+ if (pGC->funcs->ChangeGC)
+ (*pGC->funcs->ChangeGC) (pGC, maskQ);
+ return Success;
+}
+
+int
+VerifyRectOrder(int nrects, xRectangle *prects, int ordering)
+{
+ xRectangle *prectP, *prectN;
+ int i;
+
+ switch (ordering) {
+ case Unsorted:
+ return CT_UNSORTED;
+ case YSorted:
+ if (nrects > 1) {
+ for (i = 1, prectP = prects, prectN = prects + 1;
+ i < nrects; i++, prectP++, prectN++)
+ if (prectN->y < prectP->y)
+ return -1;
+ }
+ return CT_YSORTED;
+ case YXSorted:
+ if (nrects > 1) {
+ for (i = 1, prectP = prects, prectN = prects + 1;
+ i < nrects; i++, prectP++, prectN++)
+ if ((prectN->y < prectP->y) ||
+ ((prectN->y == prectP->y) && (prectN->x < prectP->x)))
+ return -1;
+ }
+ return CT_YXSORTED;
+ case YXBanded:
+ if (nrects > 1) {
+ for (i = 1, prectP = prects, prectN = prects + 1;
+ i < nrects; i++, prectP++, prectN++)
+ if ((prectN->y != prectP->y &&
+ prectN->y < prectP->y + (int) prectP->height) ||
+ ((prectN->y == prectP->y) &&
+ (prectN->height != prectP->height ||
+ prectN->x < prectP->x + (int) prectP->width)))
+ return -1;
+ }
+ return CT_YXBANDED;
+ }
+ return -1;
+}
+
+int
+SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
+ xRectangle *prects, int ordering)
+{
+ int newct, size;
+ xRectangle *prectsNew;
+
+ newct = VerifyRectOrder(nrects, prects, ordering);
+ if (newct < 0)
+ return BadMatch;
+ size = nrects * sizeof(xRectangle);
+ prectsNew = malloc(size);
+ if (!prectsNew && size)
+ return BadAlloc;
+
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->clipOrg.x = xOrigin;
+ pGC->stateChanges |= GCClipXOrigin;
+
+ pGC->clipOrg.y = yOrigin;
+ pGC->stateChanges |= GCClipYOrigin;
+
+ if (size)
+ memmove((char *) prectsNew, (char *) prects, size);
+ (*pGC->funcs->ChangeClip) (pGC, newct, (pointer) prectsNew, nrects);
+ if (pGC->funcs->ChangeGC)
+ (*pGC->funcs->ChangeGC) (pGC,
+ GCClipXOrigin | GCClipYOrigin | GCClipMask);
+ return Success;
+}
+
+/*
+ sets reasonable defaults
+ if we can get a pre-allocated one, use it and mark it as used.
+ if we can't, create one out of whole cloth (The Velveteen GC -- if
+ you use it often enough it will become real.)
+*/
+GCPtr
+GetScratchGC(unsigned depth, ScreenPtr pScreen)
+{
+ int i;
+ GCPtr pGC;
+
+ for (i = 0; i <= pScreen->numDepths; i++) {
+ pGC = pScreen->GCperDepth[i];
+ if (pGC && pGC->depth == depth && !pGC->scratch_inuse) {
+ pGC->scratch_inuse = TRUE;
+
+ pGC->alu = GXcopy;
+ pGC->planemask = ~0;
+ pGC->serialNumber = 0;
+ pGC->fgPixel = 0;
+ pGC->bgPixel = 1;
+ pGC->lineWidth = 0;
+ pGC->lineStyle = LineSolid;
+ pGC->capStyle = CapButt;
+ pGC->joinStyle = JoinMiter;
+ pGC->fillStyle = FillSolid;
+ pGC->fillRule = EvenOddRule;
+ pGC->arcMode = ArcChord;
+ pGC->patOrg.x = 0;
+ pGC->patOrg.y = 0;
+ pGC->subWindowMode = ClipByChildren;
+ pGC->graphicsExposures = FALSE;
+ pGC->clipOrg.x = 0;
+ pGC->clipOrg.y = 0;
+ if (pGC->clientClipType != CT_NONE)
+ (*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
+ pGC->stateChanges = GCAllBits;
+ return pGC;
+ }
+ }
+ /* if we make it this far, need to roll our own */
+ pGC = CreateScratchGC(pScreen, depth);
+ if (pGC)
+ pGC->graphicsExposures = FALSE;
+ return pGC;
+}
+
+/*
+ if the gc to free is in the table of pre-existing ones,
+mark it as available.
+ if not, free it for real
+*/
+void
+FreeScratchGC(GCPtr pGC)
+{
+ if (pGC->scratch_inuse)
+ pGC->scratch_inuse = FALSE;
+ else
+ FreeGC(pGC, (GContext) 0);
+}
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index ed529722c..0c2a95d3d 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -66,7 +66,13 @@
#include "exglobals.h"
#include "exevents.h"
#include "extnsionst.h"
-#include "listdev.h" /* for sizing up DeviceClassesChangedEvent */
+#include "listdev.h" /* for sizing up DeviceClassesChangedEvent */
+
+#if XSERVER_DTRACE
+#include <sys/types.h>
+typedef const char *string;
+#include <Xserver-dtrace.h>
+#endif
#ifdef _MSC_VER
#include <math.h>
@@ -91,7 +97,7 @@ double roundd(double f)
* QueuePointerEvents, QueueKeyboardEvents, and QueueProximityEvents.
* This list is allocated on startup by the DIX.
*/
-InternalEvent* InputEventList = NULL;
+InternalEvent *InputEventList = NULL;
/**
* Pick some arbitrary size for Xi motion history.
@@ -167,12 +173,12 @@ key_is_down(DeviceIntPtr pDev, int key_code, int type)
static Bool
key_autorepeats(DeviceIntPtr pDev, int key_code)
{
- return !!(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3] &
- (1 << (key_code & 7)));
+ return ! !(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3] &
+ (1 << (key_code & 7)));
}
static void
-init_event(DeviceIntPtr dev, DeviceEvent* event, Time ms)
+init_event(DeviceIntPtr dev, DeviceEvent *event, Time ms)
{
memset(event, 0, sizeof(DeviceEvent));
event->header = ET_Internal;
@@ -199,15 +205,31 @@ init_raw(DeviceIntPtr dev, RawDeviceEvent *event, Time ms, int type, int detail)
memset(event, 0, sizeof(RawDeviceEvent));
event->header = ET_Internal;
event->length = sizeof(RawDeviceEvent);
- switch(type) {
- case MotionNotify: event->type = ET_RawMotion; break;
- case ButtonPress: event->type = ET_RawButtonPress; break;
- case ButtonRelease: event->type = ET_RawButtonRelease; break;
- case KeyPress: event->type = ET_RawKeyPress; break;
- case KeyRelease: event->type = ET_RawKeyRelease; break;
- case XI_TouchBegin: event->type = ET_RawTouchBegin; break;
- case XI_TouchUpdate: event->type = ET_RawTouchUpdate; break;
- case XI_TouchEnd: event->type = ET_RawTouchEnd; break;
+ switch (type) {
+ case MotionNotify:
+ event->type = ET_RawMotion;
+ break;
+ case ButtonPress:
+ event->type = ET_RawButtonPress;
+ break;
+ case ButtonRelease:
+ event->type = ET_RawButtonRelease;
+ break;
+ case KeyPress:
+ event->type = ET_RawKeyPress;
+ break;
+ case KeyRelease:
+ event->type = ET_RawKeyRelease;
+ break;
+ case XI_TouchBegin:
+ event->type = ET_RawTouchBegin;
+ break;
+ case XI_TouchUpdate:
+ event->type = ET_RawTouchUpdate;
+ break;
+ case XI_TouchEnd:
+ event->type = ET_RawTouchEnd;
+ break;
}
event->time = ms;
event->deviceid = dev->id;
@@ -216,32 +238,27 @@ init_raw(DeviceIntPtr dev, RawDeviceEvent *event, Time ms, int type, int detail)
}
static void
-set_raw_valuators(RawDeviceEvent *event, ValuatorMask *mask, double* data)
+set_raw_valuators(RawDeviceEvent *event, ValuatorMask *mask, double *data)
{
int i;
- for (i = 0; i < valuator_mask_size(mask); i++)
- {
- if (valuator_mask_isset(mask, i))
- {
+ for (i = 0; i < valuator_mask_size(mask); i++) {
+ if (valuator_mask_isset(mask, i)) {
SetBit(event->valuators.mask, i);
data[i] = valuator_mask_get_double(mask, i);
}
}
}
-
static void
-set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask)
+set_valuators(DeviceIntPtr dev, DeviceEvent *event, ValuatorMask *mask)
{
int i;
/* Set the data to the previous value for unset absolute axes. The values
* may be used when sent as part of an XI 1.x valuator event. */
- for (i = 0; i < valuator_mask_size(mask); i++)
- {
- if (valuator_mask_isset(mask, i))
- {
+ for (i = 0; i < valuator_mask_size(mask); i++) {
+ if (valuator_mask_isset(mask, i)) {
SetBit(event->valuators.mask, i);
if (valuator_get_mode(dev, i) == Absolute)
SetBit(event->valuators.mode, i);
@@ -253,10 +270,8 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask)
}
void
-CreateClassesChangedEvent(InternalEvent* event,
- DeviceIntPtr master,
- DeviceIntPtr slave,
- int flags)
+CreateClassesChangedEvent(InternalEvent *event,
+ DeviceIntPtr master, DeviceIntPtr slave, int flags)
{
int i;
DeviceChangedEvent *dce;
@@ -273,17 +288,14 @@ CreateClassesChangedEvent(InternalEvent* event,
dce->flags = flags;
dce->sourceid = slave->id;
- if (slave->button)
- {
+ if (slave->button) {
dce->buttons.num_buttons = slave->button->numButtons;
for (i = 0; i < dce->buttons.num_buttons; i++)
dce->buttons.names[i] = slave->button->labels[i];
}
- if (slave->valuator)
- {
+ if (slave->valuator) {
dce->num_valuators = slave->valuator->numAxes;
- for (i = 0; i < dce->num_valuators; i++)
- {
+ for (i = 0; i < dce->num_valuators; i++) {
dce->valuators[i].min = slave->valuator->axes[i].min_value;
dce->valuators[i].max = slave->valuator->axes[i].max_value;
dce->valuators[i].resolution = slave->valuator->axes[i].resolution;
@@ -292,8 +304,7 @@ CreateClassesChangedEvent(InternalEvent* event,
dce->valuators[i].scroll = slave->valuator->axes[i].scroll;
}
}
- if (slave->key)
- {
+ if (slave->key) {
dce->keys.min_keycode = slave->key->xkbInfo->desc->min_key_code;
dce->keys.max_keycode = slave->key->xkbInfo->desc->max_key_code;
}
@@ -321,7 +332,7 @@ rescaleValuatorAxis(double coord, AxisInfoPtr from, AxisInfoPtr to,
if (fmin == tmin && fmax == tmax)
return coord;
- if (fmax == fmin) /* avoid division by 0 */
+ if (fmax == fmin) /* avoid division by 0 */
return 0.0;
return (coord - fmin) * (tmax - tmin) / (fmax - fmin) + tmin;
@@ -338,7 +349,6 @@ rescaleValuatorAxis(double coord, AxisInfoPtr from, AxisInfoPtr to,
static void
updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
{
- ScreenPtr scr = miPointerGetScreen(pDev);
int i;
DeviceIntPtr lastSlave;
@@ -351,19 +361,19 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
return;
/* scale back to device coordinates */
- if(pDev->valuator->numAxes > 0)
- {
+ if (pDev->valuator->numAxes > 0) {
pDev->last.valuators[0] = rescaleValuatorAxis(pDev->last.valuators[0],
NULL,
pDev->valuator->axes + 0,
- 0, scr->width);
+ screenInfo.x,
+ screenInfo.width);
}
- if(pDev->valuator->numAxes > 1)
- {
+ if (pDev->valuator->numAxes > 1) {
pDev->last.valuators[1] = rescaleValuatorAxis(pDev->last.valuators[1],
NULL,
pDev->valuator->axes + 1,
- 0, scr->height);
+ screenInfo.y,
+ screenInfo.height);
}
/* calculate the other axis as well based on info from the old
@@ -372,14 +382,13 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
*/
if ((lastSlave = master->last.slave) && lastSlave->valuator) {
for (i = 2; i < pDev->valuator->numAxes; i++) {
- if (i >= lastSlave->valuator->numAxes)
- {
+ if (i >= lastSlave->valuator->numAxes) {
pDev->last.valuators[i] = 0;
valuator_mask_set_double(pDev->last.scroll, i, 0);
}
- else
- {
+ else {
double val = pDev->last.valuators[i];
+
val = rescaleValuatorAxis(val, lastSlave->valuator->axes + i,
pDev->valuator->axes + i, 0, 0);
pDev->last.valuators[i] = val;
@@ -397,6 +406,7 @@ void
AllocateMotionHistory(DeviceIntPtr pDev)
{
int size;
+
free(pDev->valuator->motion);
if (pDev->valuator->numMotionEvents < 1)
@@ -411,6 +421,7 @@ AllocateMotionHistory(DeviceIntPtr pDev)
else {
ValuatorClassPtr v = pDev->valuator;
int numAxes;
+
/* XI1 doesn't understand mixed mode devices */
for (numAxes = 0; numAxes < v->numAxes; numAxes++)
if (valuator_get_mode(pDev, numAxes) != valuator_get_mode(pDev, 0))
@@ -425,7 +436,7 @@ AllocateMotionHistory(DeviceIntPtr pDev)
pDev->valuator->last_motion = 0;
if (!pDev->valuator->motion)
ErrorF("[dix] %s: Failed to alloc motion history (%d bytes).\n",
- pDev->name, size * pDev->valuator->numMotionEvents);
+ pDev->name, size * pDev->valuator->numMotionEvents);
}
/**
@@ -436,19 +447,20 @@ AllocateMotionHistory(DeviceIntPtr pDev)
* If core is set, we only generate x/y, in INT16, scaled to screen coords.
*/
int
-GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
+GetMotionHistory(DeviceIntPtr pDev, xTimecoord ** buff, unsigned long start,
unsigned long stop, ScreenPtr pScreen, BOOL core)
{
char *ibuff = NULL, *obuff;
int i = 0, ret = 0;
int j, coord;
Time current;
+
/* The size of a single motion event. */
int size;
- AxisInfo from, *to; /* for scaling */
- INT32 *ocbuf, *icbuf; /* pointer to coordinates for copying */
+ AxisInfo from, *to; /* for scaling */
+ INT32 *ocbuf, *icbuf; /* pointer to coordinates for copying */
INT16 *corebuf;
- AxisInfo core_axis = {0};
+ AxisInfo core_axis = { 0 };
if (!pDev->valuator || !pDev->valuator->numMotionEvents)
return 0;
@@ -464,7 +476,7 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
*buff = malloc(size * pDev->valuator->numMotionEvents);
if (!(*buff))
return 0;
- obuff = (char *)*buff;
+ obuff = (char *) *buff;
for (i = pDev->valuator->first_motion;
i != pDev->valuator->last_motion;
@@ -479,12 +491,11 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
return ret;
}
else if (current >= start) {
- if (core)
- {
- memcpy(obuff, ibuff, sizeof(Time)); /* copy timestamp */
+ if (core) {
+ memcpy(obuff, ibuff, sizeof(Time)); /* copy timestamp */
- icbuf = (INT32*)(ibuff + sizeof(Time));
- corebuf = (INT16*)(obuff + sizeof(Time));
+ icbuf = (INT32 *) (ibuff + sizeof(Time));
+ corebuf = (INT16 *) (obuff + sizeof(Time));
/* fetch x coordinate + range */
memcpy(&from.min_value, icbuf++, sizeof(INT32));
@@ -494,7 +505,8 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
/* scale to screen coords */
to = &core_axis;
to->max_value = pScreen->width;
- coord = rescaleValuatorAxis(coord, &from, to, 0, pScreen->width);
+ coord =
+ rescaleValuatorAxis(coord, &from, to, 0, pScreen->width);
memcpy(corebuf, &coord, sizeof(INT16));
corebuf++;
@@ -505,17 +517,17 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
memcpy(&coord, icbuf++, sizeof(INT32));
to->max_value = pScreen->height;
- coord = rescaleValuatorAxis(coord, &from, to, 0, pScreen->height);
+ coord =
+ rescaleValuatorAxis(coord, &from, to, 0, pScreen->height);
memcpy(corebuf, &coord, sizeof(INT16));
- } else if (IsMaster(pDev))
- {
- memcpy(obuff, ibuff, sizeof(Time)); /* copy timestamp */
+ }
+ else if (IsMaster(pDev)) {
+ memcpy(obuff, ibuff, sizeof(Time)); /* copy timestamp */
- ocbuf = (INT32*)(obuff + sizeof(Time));
- icbuf = (INT32*)(ibuff + sizeof(Time));
- for (j = 0; j < MAX_VALUATORS; j++)
- {
+ ocbuf = (INT32 *) (obuff + sizeof(Time));
+ icbuf = (INT32 *) (ibuff + sizeof(Time));
+ for (j = 0; j < MAX_VALUATORS; j++) {
if (j >= pDev->valuator->numAxes)
break;
@@ -524,7 +536,9 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
memcpy(&from.max_value, icbuf++, sizeof(INT32));
memcpy(&coord, icbuf++, sizeof(INT32));
- to = (j < pDev->valuator->numAxes) ? &pDev->valuator->axes[j] : NULL;
+ to = (j <
+ pDev->valuator->numAxes) ? &pDev->valuator->
+ axes[j] : NULL;
/* x/y scaled to screen if no range is present */
if (j == 0 && (from.max_value < from.min_value))
@@ -537,7 +551,8 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
memcpy(ocbuf, &coord, sizeof(INT32));
ocbuf++;
}
- } else
+ }
+ else
memcpy(obuff, ibuff, size);
/* don't advance by size here. size may be different to the
@@ -545,7 +560,8 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
if (core)
obuff += sizeof(INT32) + sizeof(Time);
else
- obuff += (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
+ obuff +=
+ (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
ret++;
}
}
@@ -553,7 +569,6 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
return ret;
}
-
/**
* Update the motion history for a specific device, with the list of
* valuators.
@@ -577,24 +592,22 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, ValuatorMask *mask,
return;
v = pDev->valuator;
- if (IsMaster(pDev))
- {
+ if (IsMaster(pDev)) {
buff += ((sizeof(INT32) * 3 * MAX_VALUATORS) + sizeof(CARD32)) *
- v->last_motion;
+ v->last_motion;
memcpy(buff, &ms, sizeof(Time));
buff += sizeof(Time);
memset(buff, 0, sizeof(INT32) * 3 * MAX_VALUATORS);
- for (i = 0; i < v->numAxes; i++)
- {
+ for (i = 0; i < v->numAxes; i++) {
int val;
+
/* XI1 doesn't support mixed mode devices */
if (valuator_get_mode(pDev, i) != valuator_get_mode(pDev, 0))
break;
- if (valuator_mask_size(mask) <= i || !valuator_mask_isset(mask, i))
- {
+ if (valuator_mask_size(mask) <= i || !valuator_mask_isset(mask, i)) {
buff += 3 * sizeof(INT32);
continue;
}
@@ -606,8 +619,8 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, ValuatorMask *mask,
memcpy(buff, &val, sizeof(INT32));
buff += sizeof(INT32);
}
- } else
- {
+ }
+ else {
buff += ((sizeof(INT32) * pDev->valuator->numAxes) + sizeof(CARD32)) *
pDev->valuator->last_motion;
@@ -617,11 +630,10 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, ValuatorMask *mask,
memset(buff, 0, sizeof(INT32) * pDev->valuator->numAxes);
- for (i = 0; i < MAX_VALUATORS; i++)
- {
+ for (i = 0; i < MAX_VALUATORS; i++) {
int val;
- if (valuator_mask_size(mask) <= i || !valuator_mask_isset(mask, i))
- {
+
+ if (valuator_mask_size(mask) <= i || !valuator_mask_isset(mask, i)) {
buff += sizeof(INT32);
continue;
}
@@ -636,12 +648,11 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, ValuatorMask *mask,
/* If we're wrapping around, just keep the circular buffer going. */
if (pDev->valuator->first_motion == pDev->valuator->last_motion)
pDev->valuator->first_motion = (pDev->valuator->first_motion + 1) %
- pDev->valuator->numMotionEvents;
+ pDev->valuator->numMotionEvents;
return;
}
-
/**
* Returns the maximum number of events GetKeyboardEvents
* and GetPointerEvents will ever return.
@@ -649,7 +660,8 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, ValuatorMask *mask,
* This MUST be absolutely constant, from init until exit.
*/
int
-GetMaximumEventsNum(void) {
+GetMaximumEventsNum(void)
+{
/* One raw event
* One device event
* One possible device changed event
@@ -659,7 +671,6 @@ GetMaximumEventsNum(void) {
return 100;
}
-
/**
* Clip an axis to its bounds, which are declared in the call to
* InitValuatorAxisClassStruct.
@@ -693,9 +704,9 @@ clipValuators(DeviceIntPtr pDev, ValuatorMask *mask)
int i;
for (i = 0; i < valuator_mask_size(mask); i++)
- if (valuator_mask_isset(mask, i))
- {
+ if (valuator_mask_isset(mask, i)) {
double val = valuator_mask_get_double(mask, i);
+
clipAxis(pDev, i, &val);
valuator_mask_set_double(mask, i, val);
}
@@ -713,18 +724,21 @@ clipValuators(DeviceIntPtr pDev, ValuatorMask *mask)
* events if a DCCE was generated.
* @return The updated @events pointer.
*/
-InternalEvent*
-UpdateFromMaster(InternalEvent* events, DeviceIntPtr dev, int type, int *num_events)
+InternalEvent *
+UpdateFromMaster(InternalEvent *events, DeviceIntPtr dev, int type,
+ int *num_events)
{
DeviceIntPtr master;
- master = GetMaster(dev, (type & DEVCHANGE_POINTER_EVENT) ? MASTER_POINTER : MASTER_KEYBOARD);
+ master =
+ GetMaster(dev,
+ (type & DEVCHANGE_POINTER_EVENT) ? MASTER_POINTER :
+ MASTER_KEYBOARD);
- if (master && master->last.slave != dev)
- {
- CreateClassesChangedEvent(events, master, dev, type | DEVCHANGE_SLAVE_SWITCH);
- if (IsPointerDevice(master))
- {
+ if (master && master->last.slave != dev) {
+ CreateClassesChangedEvent(events, master, dev,
+ type | DEVCHANGE_SLAVE_SWITCH);
+ if (IsPointerDevice(master)) {
updateSlaveDeviceCoords(master, dev);
master->last.numValuators = dev->last.numValuators;
}
@@ -746,8 +760,7 @@ clipAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
{
int i;
- for (i = 0; i < valuator_mask_size(mask); i++)
- {
+ for (i = 0; i < valuator_mask_size(mask); i++) {
double val;
if (!valuator_mask_isset(mask, i))
@@ -771,8 +784,7 @@ moveRelative(DeviceIntPtr dev, ValuatorMask *mask)
Bool clip_xy = IsMaster(dev) || !IsFloating(dev);
/* calc other axes, clip, drop back into valuators */
- for (i = 0; i < valuator_mask_size(mask); i++)
- {
+ for (i = 0; i < valuator_mask_size(mask); i++) {
double val = dev->last.valuators[i];
if (!valuator_mask_isset(mask, i))
@@ -795,7 +807,7 @@ moveRelative(DeviceIntPtr dev, ValuatorMask *mask)
* @param ms Current time.
*/
static void
-accelPointer(DeviceIntPtr dev, ValuatorMask* valuators, CARD32 ms)
+accelPointer(DeviceIntPtr dev, ValuatorMask *valuators, CARD32 ms)
{
if (dev->valuator->accelScheme.AccelSchemeProc)
dev->valuator->accelScheme.AccelSchemeProc(dev, valuators, ms);
@@ -815,16 +827,14 @@ scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask)
double scaled;
ScreenPtr scr = miPointerGetScreen(dev);
- if (valuator_mask_isset(mask, 0))
- {
+ if (valuator_mask_isset(mask, 0)) {
scaled = valuator_mask_get_double(mask, 0) + scr->x;
scaled = rescaleValuatorAxis(scaled,
NULL, dev->valuator->axes + 0,
0, scr->width);
valuator_mask_set_double(mask, 0, scaled);
}
- if (valuator_mask_isset(mask, 1))
- {
+ if (valuator_mask_isset(mask, 1)) {
scaled = valuator_mask_get_double(mask, 1) + scr->y;
scaled = rescaleValuatorAxis(scaled,
NULL, dev->valuator->axes + 1,
@@ -833,7 +843,6 @@ scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask)
}
}
-
/**
* Scale from (absolute) device to screen coordinates here,
*
@@ -849,15 +858,13 @@ scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask)
*/
static ScreenPtr
scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
- double *devx, double *devy,
- double *screenx, double *screeny)
+ double *devx, double *devy, double *screenx, double *screeny)
{
ScreenPtr scr = miPointerGetScreen(dev);
double x, y;
BUG_WARN(!dev->valuator || dev->valuator->numAxes < 2);
- if (!dev->valuator || dev->valuator->numAxes < 2)
- {
+ if (!dev->valuator || dev->valuator->numAxes < 2) {
/* if we have no axes, last.valuators must be in screen coords
* anyway */
*devx = *screenx = dev->last.valuators[0];
@@ -910,8 +917,7 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
*/
static ScreenPtr
positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask,
- double *devx, double *devy,
- double *screenx, double *screeny)
+ double *devx, double *devy, double *screenx, double *screeny)
{
ScreenPtr scr = miPointerGetScreen(dev);
double tmpx, tmpy;
@@ -942,14 +948,16 @@ positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask,
/* Recalculate the per-screen device coordinates */
if (valuator_mask_isset(mask, 0)) {
double x;
- x = rescaleValuatorAxis(*screenx - scr->x, NULL, dev->valuator->axes + 0,
- 0, scr->width);
+
+ x = rescaleValuatorAxis(*screenx - scr->x, NULL,
+ dev->valuator->axes + 0, 0, scr->width);
valuator_mask_set_double(mask, 0, x);
}
if (valuator_mask_isset(mask, 1)) {
double y;
- y = rescaleValuatorAxis(*screeny - scr->y, NULL, dev->valuator->axes + 1,
- 0, scr->height);
+
+ y = rescaleValuatorAxis(*screeny - scr->y, NULL,
+ dev->valuator->axes + 1, 0, scr->height);
valuator_mask_set_double(mask, 1, y);
}
@@ -971,9 +979,9 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
return;
updateMotionHistory(dev, ms, mask, dev->last.valuators);
- if(!IsMaster(dev) && !IsFloating(dev))
- {
+ if (!IsMaster(dev) && !IsFloating(dev)) {
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
+
updateMotionHistory(master, ms, mask, dev->last.valuators);
}
}
@@ -982,12 +990,13 @@ static void
queueEventList(DeviceIntPtr device, InternalEvent *events, int nevents)
{
int i;
+
for (i = 0; i < nevents; i++)
mieqEnqueue(device, &events[i]);
}
static void
-event_set_root_coordinates(DeviceEvent* event, double x, double y)
+event_set_root_coordinates(DeviceEvent *event, double x, double y)
{
event->root_x = trunc(x);
event->root_y = trunc(y);
@@ -1030,30 +1039,41 @@ QueueKeyboardEvents(DeviceIntPtr device, int type,
*/
int
GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
- int key_code, const ValuatorMask *mask_in) {
+ int key_code, const ValuatorMask *mask_in)
+{
int num_events = 0;
CARD32 ms = 0;
DeviceEvent *event;
RawDeviceEvent *raw;
ValuatorMask mask;
+#if XSERVER_DTRACE
+ if (XSERVER_INPUT_EVENT_ENABLED()) {
+ XSERVER_INPUT_EVENT(pDev->id, type, key_code, 0,
+ mask_in ? mask_in->last_bit + 1 : 0,
+ mask_in ? mask_in->mask : NULL,
+ mask_in ? mask_in->valuators : NULL);
+ }
+#endif
+
/* refuse events from disabled devices */
if (!pDev || !pDev->enabled)
return 0;
- if (!events ||!pDev->key || !pDev->focus || !pDev->kbdfeed ||
- (type != KeyPress && type != KeyRelease) ||
- (key_code < 8 || key_code > 255))
+ if (!events || !pDev->key || !pDev->focus || !pDev->kbdfeed ||
+ (type != KeyPress && type != KeyRelease) ||
+ (key_code < 8 || key_code > 255))
return 0;
if (mask_in && valuator_mask_size(mask_in) > 1) {
ErrorF("[dix] the server does not handle valuator masks with "
- "keyboard events. This is a bug. You may fix it.\n");
+ "keyboard events. This is a bug. You may fix it.\n");
}
num_events = 1;
- events = UpdateFromMaster(events, pDev, DEVCHANGE_KEYBOARD_EVENT, &num_events);
+ events =
+ UpdateFromMaster(events, pDev, DEVCHANGE_KEYBOARD_EVENT, &num_events);
/* Handle core repeating, via press/release/press/release. */
if (type == KeyPress && key_is_down(pDev, key_code, KEY_POSTED)) {
@@ -1086,11 +1106,11 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
if (type == KeyPress) {
event->type = ET_KeyPress;
- set_key_down(pDev, key_code, KEY_POSTED);
+ set_key_down(pDev, key_code, KEY_POSTED);
}
else if (type == KeyRelease) {
event->type = ET_KeyRelease;
- set_key_up(pDev, key_code, KEY_POSTED);
+ set_key_up(pDev, key_code, KEY_POSTED);
}
clipValuators(pDev, &mask);
@@ -1098,10 +1118,11 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
set_valuators(pDev, event, &mask);
if (!IsFloating(pDev)) {
- DeviceIntPtr master = GetMaster(pDev, MASTER_POINTER);
- event_set_root_coordinates(event,
- master->last.valuators[0],
- master->last.valuators[1]);
+ DeviceIntPtr master = GetMaster(pDev, MASTER_POINTER);
+
+ event_set_root_coordinates(event,
+ master->last.valuators[0],
+ master->last.valuators[1]);
}
return num_events;
@@ -1114,10 +1135,11 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
*
* @param num_events Number of elements in list.
*/
-InternalEvent*
+InternalEvent *
InitEventList(int num_events)
{
InternalEvent *events = calloc(num_events, sizeof(InternalEvent));
+
return events;
}
@@ -1187,8 +1209,7 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
static void
storeLastValuators(DeviceIntPtr dev, ValuatorMask *mask,
- int xaxis, int yaxis,
- double devx, double devy)
+ int xaxis, int yaxis, double devx, double devy)
{
int i;
@@ -1198,8 +1219,7 @@ storeLastValuators(DeviceIntPtr dev, ValuatorMask *mask,
if (valuator_mask_isset(mask, yaxis))
dev->last.valuators[1] = devy;
- for (i = 0; i < valuator_mask_size(mask); i++)
- {
+ for (i = 0; i < valuator_mask_size(mask); i++) {
if (i == xaxis || i == yaxis)
continue;
@@ -1228,7 +1248,8 @@ QueuePointerEvents(DeviceIntPtr device, int type,
{
int nevents;
- nevents = GetPointerEvents(InputEventList, device, type, buttons, flags, mask);
+ nevents =
+ GetPointerEvents(InputEventList, device, type, buttons, flags, mask);
queueEventList(device, InputEventList, nevents);
}
@@ -1280,68 +1301,68 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
int num_events = 1;
DeviceEvent *event;
RawDeviceEvent *raw;
- double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */
- double devx = 0.0, devy = 0.0; /* desktop-wide in device coords */
+ double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */
+ double devx = 0.0, devy = 0.0; /* desktop-wide in device coords */
ValuatorMask mask;
ScreenPtr scr;
- switch (type)
- {
- case MotionNotify:
- if (!pDev->valuator)
- {
- ErrorF("[dix] motion events from device %d without valuators\n", pDev->id);
- return 0;
- }
- if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)
- return 0;
- break;
- case ButtonPress:
- case ButtonRelease:
- if (!pDev->button || !buttons)
- return 0;
- if (mask_in && valuator_mask_size(mask_in) > 0 && !pDev->valuator)
- {
- ErrorF("[dix] button event with valuator from device %d without valuators\n", pDev->id);
- return 0;
- }
- break;
- default:
+ switch (type) {
+ case MotionNotify:
+ if (!pDev->valuator) {
+ ErrorF("[dix] motion events from device %d without valuators\n",
+ pDev->id);
return 0;
+ }
+ if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)
+ return 0;
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ if (!pDev->button || !buttons)
+ return 0;
+ if (mask_in && valuator_mask_size(mask_in) > 0 && !pDev->valuator) {
+ ErrorF
+ ("[dix] button event with valuator from device %d without valuators\n",
+ pDev->id);
+ return 0;
+ }
+ break;
+ default:
+ return 0;
}
valuator_mask_copy(&mask, mask_in);
- if ((flags & POINTER_NORAW) == 0)
- {
- raw = &events->raw_event;
- events++;
- num_events++;
+ if ((flags & POINTER_NORAW) == 0) {
+ raw = &events->raw_event;
+ events++;
+ num_events++;
- init_raw(pDev, raw, ms, type, buttons);
+ init_raw(pDev, raw, ms, type, buttons);
set_raw_valuators(raw, &mask, raw->valuators.data_raw);
}
/* valuators are in driver-native format (rel or abs) */
- if (flags & POINTER_ABSOLUTE)
- {
- if (flags & POINTER_SCREEN) /* valuators are in screen coords */
+ if (flags & POINTER_ABSOLUTE) {
+ if (flags & POINTER_SCREEN) /* valuators are in screen coords */
scale_from_screen(pDev, &mask);
transformAbsolute(pDev, &mask);
clipAbsolute(pDev, &mask);
- } else {
+ if ((flags & POINTER_NORAW) == 0)
+ set_raw_valuators(raw, &mask, raw->valuators.data);
+ }
+ else {
if (flags & POINTER_ACCELERATE)
accelPointer(pDev, &mask, ms);
+ if ((flags & POINTER_NORAW) == 0)
+ set_raw_valuators(raw, &mask, raw->valuators.data);
+
moveRelative(pDev, &mask);
}
/* valuators are in device coordinate system in absolute coordinates */
-
- if ((flags & POINTER_NORAW) == 0)
- set_raw_valuators(raw, &mask, raw->valuators.data);
-
scale_to_desktop(pDev, &mask, &devx, &devy, &screenx, &screeny);
scr = positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
&mask, &devx, &devy, &screenx, &screeny);
@@ -1358,6 +1379,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
/* Update the MD's co-ordinates, which are always in desktop space. */
if (!IsMaster(pDev) && !IsFloating(pDev)) {
DeviceIntPtr master = GetMaster(pDev, MASTER_POINTER);
+
master->last.valuators[0] = screenx;
master->last.valuators[1] = screeny;
}
@@ -1415,9 +1437,7 @@ emulate_scroll_button_events(InternalEvent *events,
int type,
int axis,
const ValuatorMask *mask,
- ValuatorMask *last,
- CARD32 ms,
- int max_events)
+ ValuatorMask *last, CARD32 ms, int max_events)
{
AxisInfoPtr ax;
double delta;
@@ -1442,16 +1462,16 @@ emulate_scroll_button_events(InternalEvent *events,
if (!valuator_mask_isset(last, axis))
valuator_mask_set_double(last, axis, 0);
- delta = valuator_mask_get_double(mask, axis) - valuator_mask_get_double(last, axis);
+ delta =
+ valuator_mask_get_double(mask, axis) - valuator_mask_get_double(last,
+ axis);
total = delta;
b = (ax->scroll.type == SCROLL_TYPE_VERTICAL) ? 5 : 7;
- if ((incr > 0 && delta < 0) ||
- (incr < 0 && delta > 0))
- b--; /* we're scrolling up or left → button 4 or 6 */
+ if ((incr > 0 && delta < 0) || (incr < 0 && delta > 0))
+ b--; /* we're scrolling up or left → button 4 or 6 */
- while (fabs(delta) >= fabs(incr))
- {
+ while (fabs(delta) >= fabs(incr)) {
int nev_tmp;
if (delta > 0)
@@ -1464,17 +1484,14 @@ emulate_scroll_button_events(InternalEvent *events,
* We may get a bigger scroll delta than we can generate events
* for. In that case, we keep decreasing delta, but skip events.
*/
- if (num_events + 4 < max_events)
- {
- if (type != ButtonRelease)
- {
+ if (num_events + 4 < max_events) {
+ if (type != ButtonRelease) {
nev_tmp = fill_pointer_events(events, dev, ButtonPress, b, ms,
flags, NULL);
events += nev_tmp;
num_events += nev_tmp;
}
- if (type != ButtonPress)
- {
+ if (type != ButtonPress) {
nev_tmp = fill_pointer_events(events, dev, ButtonRelease, b, ms,
flags, NULL);
events += nev_tmp;
@@ -1484,8 +1501,7 @@ emulate_scroll_button_events(InternalEvent *events,
}
/* We emulated, update last.scroll */
- if (total != delta)
- {
+ if (total != delta) {
total -= delta;
valuator_mask_set_double(last, axis,
valuator_mask_get_double(last, axis) + total);
@@ -1494,7 +1510,6 @@ emulate_scroll_button_events(InternalEvent *events,
return num_events;
}
-
/**
* Generate a complete series of InternalEvents (filled into the EventList)
* representing pointer motion, or button presses. If the device is a slave
@@ -1524,6 +1539,15 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
int i;
int realtype = type;
+#if XSERVER_DTRACE
+ if (XSERVER_INPUT_EVENT_ENABLED()) {
+ XSERVER_INPUT_EVENT(pDev->id, type, buttons, flags,
+ mask_in ? mask_in->last_bit + 1 : 0,
+ mask_in ? mask_in->mask : NULL,
+ mask_in ? mask_in->valuators : NULL);
+ }
+#endif
+
/* refuse events from disabled devices */
if (!pDev->enabled)
return 0;
@@ -1539,15 +1563,13 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
/* Turn a scroll button press into a smooth-scrolling event if
* necessary. This only needs to cater for the XIScrollFlagPreferred
* axis (if more than one scrolling axis is present) */
- if (type == ButtonPress)
- {
+ if (type == ButtonPress) {
double val, adj;
int axis;
int h_scroll_axis = -1;
int v_scroll_axis = -1;
- if (pDev->valuator)
- {
+ if (pDev->valuator) {
h_scroll_axis = pDev->valuator->h_scroll_axis;
v_scroll_axis = pDev->valuator->v_scroll_axis;
}
@@ -1576,8 +1598,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
break;
}
- if (adj != 0.0 && axis != -1)
- {
+ if (adj != 0.0 && axis != -1) {
adj *= pDev->valuator->axes[axis].scroll.increment;
val = valuator_mask_get_double(&mask, axis) + adj;
valuator_mask_set_double(&mask, axis, val);
@@ -1603,9 +1624,10 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
valuator_mask_set_double(&scroll, i, pDev->last.valuators[i]);
- nev_tmp = emulate_scroll_button_events(events, pDev, realtype, i, &scroll,
- pDev->last.scroll, ms,
- GetMaximumEventsNum() - num_events);
+ nev_tmp =
+ emulate_scroll_button_events(events, pDev, realtype, i, &scroll,
+ pDev->last.scroll, ms,
+ GetMaximumEventsNum() - num_events);
events += nev_tmp;
num_events += nev_tmp;
}
@@ -1626,8 +1648,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
*
*/
void
-QueueProximityEvents(DeviceIntPtr device, int type,
- const ValuatorMask *mask)
+QueueProximityEvents(DeviceIntPtr device, int type, const ValuatorMask *mask)
{
int nevents;
@@ -1645,12 +1666,22 @@ QueueProximityEvents(DeviceIntPtr device, int type,
* @return the number of events written into events.
*/
int
-GetProximityEvents(InternalEvent *events, DeviceIntPtr pDev, int type, const ValuatorMask *mask_in)
+GetProximityEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
+ const ValuatorMask *mask_in)
{
int num_events = 1, i;
DeviceEvent *event;
ValuatorMask mask;
+#if XSERVER_DTRACE
+ if (XSERVER_INPUT_EVENT_ENABLED()) {
+ XSERVER_INPUT_EVENT(pDev->id, type, 0, 0,
+ mask_in ? mask_in->last_bit + 1 : 0,
+ mask_in ? mask_in->mask : NULL,
+ mask_in ? mask_in->valuators : NULL);
+ }
+#endif
+
/* refuse events from disabled devices */
if (!pDev->enabled)
return 0;
@@ -1664,8 +1695,7 @@ GetProximityEvents(InternalEvent *events, DeviceIntPtr pDev, int type, const Val
valuator_mask_copy(&mask, mask_in);
/* ignore relative axes for proximity. */
- for (i = 0; i < valuator_mask_size(&mask); i++)
- {
+ for (i = 0; i < valuator_mask_size(&mask); i++) {
if (valuator_mask_isset(&mask, i) &&
valuator_get_mode(pDev, i) == Relative)
valuator_mask_unset(&mask, i);
@@ -1675,7 +1705,8 @@ GetProximityEvents(InternalEvent *events, DeviceIntPtr pDev, int type, const Val
* in an empty event, EventToXI() will fail to convert → no event sent
* to client. */
- events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events);
+ events =
+ UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events);
event = &events->device_event;
init_device_event(event, pDev, GetTimeInMillis());
@@ -1730,7 +1761,8 @@ QueueTouchEvents(DeviceIntPtr device, int type,
{
int nevents;
- nevents = GetTouchEvents(InputEventList, device, ddx_touchid, type, flags, mask);
+ nevents =
+ GetTouchEvents(InputEventList, device, ddx_touchid, type, flags, mask);
queueEventList(device, InputEventList, nevents);
}
@@ -1761,8 +1793,8 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
DeviceEvent *event;
CARD32 ms = GetTimeInMillis();
ValuatorMask mask;
- double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */
- double devx = 0.0, devy = 0.0; /* desktop-wide in device coords */
+ double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */
+ double devx = 0.0, devy = 0.0; /* desktop-wide in device coords */
int i;
int num_events = 0;
RawDeviceEvent *raw;
@@ -1774,13 +1806,21 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
Bool emulate_pointer = FALSE;
int client_id = 0;
+#if XSERVER_DTRACE
+ if (XSERVER_INPUT_EVENT_ENABLED()) {
+ XSERVER_INPUT_EVENT(dev->id, type, ddx_touchid, flags,
+ mask_in ? mask_in->last_bit + 1 : 0,
+ mask_in ? mask_in->mask : NULL,
+ mask_in ? mask_in->valuators : NULL);
+ }
+#endif
+
if (!dev->enabled || !t || !v)
return 0;
/* Find and/or create the DDX touch info */
- if (flags & TOUCH_CLIENT_ID) /* A DIX-submitted TouchEnd */
- {
+ if (flags & TOUCH_CLIENT_ID) { /* A DIX-submitted TouchEnd */
touchpoint.dix_ti = TouchFindByClientID(dev, ddx_touchid);
BUG_WARN(!touchpoint.dix_ti);
@@ -1789,38 +1829,39 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
if (!mask_in ||
!valuator_mask_isset(mask_in, 0) ||
- !valuator_mask_isset(mask_in, 1))
- {
- ErrorF("[dix] dix-submitted events must have x/y valuator information.\n");
+ !valuator_mask_isset(mask_in, 1)) {
+ ErrorF
+ ("[dix] dix-submitted events must have x/y valuator information.\n");
return 0;
}
need_rawevent = FALSE;
client_id = touchpoint.dix_ti->client_id;
- } else /* a DDX-submitted touch */
- {
- touchpoint.ti = TouchFindByDDXID(dev, ddx_touchid, (type == XI_TouchBegin));
- if (!touchpoint.ti)
- {
+ }
+ else { /* a DDX-submitted touch */
+
+ touchpoint.ti =
+ TouchFindByDDXID(dev, ddx_touchid, (type == XI_TouchBegin));
+ if (!touchpoint.ti) {
ErrorF("[dix] %s: unable to %s touch point %x\n", dev->name,
- type == XI_TouchBegin ? "begin" : "find", ddx_touchid);
+ type == XI_TouchBegin ? "begin" : "find", ddx_touchid);
return 0;
}
client_id = touchpoint.ti->client_id;
}
if (!(flags & TOUCH_CLIENT_ID))
- emulate_pointer = touchpoint.ti->emulate_pointer;
+ emulate_pointer = touchpoint.ti->emulate_pointer;
else
- emulate_pointer = !!(flags & TOUCH_POINTER_EMULATED);
+ emulate_pointer = ! !(flags & TOUCH_POINTER_EMULATED);
if (!IsMaster(dev))
- events = UpdateFromMaster(events, dev, DEVCHANGE_POINTER_EVENT, &num_events);
+ events =
+ UpdateFromMaster(events, dev, DEVCHANGE_POINTER_EVENT, &num_events);
valuator_mask_copy(&mask, mask_in);
- if (need_rawevent)
- {
+ if (need_rawevent) {
raw = &events->raw_event;
events++;
num_events++;
@@ -1833,8 +1874,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
init_event(dev, event, ms);
/* if submitted for master device, get the sourceid from there */
- if (flags & TOUCH_CLIENT_ID)
- {
+ if (flags & TOUCH_CLIENT_ID) {
event->sourceid = touchpoint.dix_ti->sourceid;
/* TOUCH_CLIENT_ID implies norawevent */
}
@@ -1845,8 +1885,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
/* If we're starting a touch, we must have x & y co-ordinates. */
if (!mask_in ||
!valuator_mask_isset(mask_in, 0) ||
- !valuator_mask_isset(mask_in, 1))
- {
+ !valuator_mask_isset(mask_in, 1)) {
ErrorF("%s: Attempted to start touch without x/y (driver bug)\n",
dev->name);
return 0;
@@ -1854,10 +1893,9 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
break;
case XI_TouchUpdate:
event->type = ET_TouchUpdate;
- if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)
- {
+ if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0) {
ErrorF("%s: TouchUpdate with no valuators? Driver bug\n",
- dev->name);
+ dev->name);
}
break;
case XI_TouchEnd:
@@ -1870,12 +1908,15 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
default:
return 0;
}
- if (t->mode == XIDirectTouch && !(flags & TOUCH_CLIENT_ID))
- {
+ if (t->mode == XIDirectTouch && !(flags & TOUCH_CLIENT_ID)) {
if (!valuator_mask_isset(&mask, 0))
- valuator_mask_set_double(&mask, 0, valuator_mask_get_double(touchpoint.ti->valuators, 0));
+ valuator_mask_set_double(&mask, 0,
+ valuator_mask_get_double(touchpoint.ti->
+ valuators, 0));
if (!valuator_mask_isset(&mask, 1))
- valuator_mask_set_double(&mask, 1, valuator_mask_get_double(touchpoint.ti->valuators, 1));
+ valuator_mask_set_double(&mask, 1,
+ valuator_mask_get_double(touchpoint.ti->
+ valuators, 1));
}
/* Get our screen event co-ordinates (root_x/root_y/event_x/event_y):
@@ -1887,6 +1928,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
if (!(flags & TOUCH_CLIENT_ID)) {
for (i = 0; i < valuator_mask_size(&mask); i++) {
double val;
+
if (valuator_mask_fetch_double(&mask, i, &val))
valuator_mask_set_double(touchpoint.ti->valuators, i, val);
}
@@ -1926,15 +1968,13 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
event->touchid = client_id;
event->flags = flags;
- if (emulate_pointer)
- {
+ if (emulate_pointer) {
event->flags |= TOUCH_POINTER_EMULATED;
event->detail.button = 1;
}
set_valuators(dev, event, &mask);
- for (i = 0; i < v->numAxes; i++)
- {
+ for (i = 0; i < v->numAxes; i++) {
if (valuator_mask_isset(&mask, i))
v->axisVal[i] = valuator_mask_get(&mask, i);
}
@@ -1942,7 +1982,6 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
return num_events;
}
-
/**
* Synthesize a single motion event for the core pointer.
*
@@ -1951,10 +1990,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
*/
void
PostSyntheticMotion(DeviceIntPtr pDev,
- int x,
- int y,
- int screen,
- unsigned long time)
+ int x, int y, int screen, unsigned long time)
{
DeviceEvent ev;
@@ -1976,5 +2012,5 @@ PostSyntheticMotion(DeviceIntPtr pDev,
ev.time = time;
/* FIXME: MD/SD considerations? */
- (*pDev->public.processInputProc)((InternalEvent*)&ev, pDev);
+ (*pDev->public.processInputProc) ((InternalEvent *) &ev, pDev);
}
diff --git a/xorg-server/dix/globals.c b/xorg-server/dix/globals.c
index d7e919e50..a564575f3 100644
--- a/xorg-server/dix/globals.c
+++ b/xorg-server/dix/globals.c
@@ -1,131 +1,133 @@
-/************************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-********************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "misc.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "input.h"
-#include "dixfont.h"
-#include "site.h"
-#include "dixstruct.h"
-#include "os.h"
-
-ScreenInfo screenInfo;
-KeybdCtrl defaultKeyboardControl = {
- DEFAULT_KEYBOARD_CLICK,
- DEFAULT_BELL,
- DEFAULT_BELL_PITCH,
- DEFAULT_BELL_DURATION,
- DEFAULT_AUTOREPEAT,
- DEFAULT_AUTOREPEATS,
- DEFAULT_LEDS,
- 0};
-
-PtrCtrl defaultPointerControl = {
- DEFAULT_PTR_NUMERATOR,
- DEFAULT_PTR_DENOMINATOR,
- DEFAULT_PTR_THRESHOLD,
- 0};
-
-ClientPtr clients[MAXCLIENTS];
-ClientPtr serverClient;
-int currentMaxClients; /* current size of clients array */
-long maxBigRequestSize = MAX_BIG_REQUEST_SIZE;
-
-unsigned long globalSerialNumber = 0;
-unsigned long serverGeneration = 0;
-
-/* these next four are initialized in main.c */
-CARD32 ScreenSaverTime;
-CARD32 ScreenSaverInterval;
-int ScreenSaverBlanking;
-int ScreenSaverAllowExposures;
-
-#ifdef DPMSExtension
-CARD16 DPMSPowerLevel = 0;
-Bool DPMSDisabledSwitch = FALSE;
-Bool DPMSCapableFlag = FALSE;
-CARD32 DPMSStandbyTime;
-CARD32 DPMSSuspendTime;
-CARD32 DPMSOffTime;
-Bool DPMSEnabled;
-#endif
-
-CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
-CARD32 defaultScreenSaverInterval = DEFAULT_SCREEN_SAVER_INTERVAL;
-int defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING;
-int defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES;
-#ifdef SCREENSAVER
-Bool screenSaverSuspended = FALSE;
-#endif
-
-char *defaultFontPath = COMPILEDDEFAULTFONTPATH;
-char *defaultTextFont = COMPILEDDEFAULTFONT;
-char *defaultCursorFont = COMPILEDCURSORFONT;
-FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in
- every compilation of dix code */
-CursorPtr rootCursor;
-Bool party_like_its_1989 = FALSE;
-Bool whiteRoot = FALSE;
-
-TimeStamp currentTime;
-TimeStamp lastDeviceEventTime;
-
-int defaultColorVisualClass = -1;
-int monitorResolution = 0;
-
-char *display;
-char *ConnectionInfo;
-
-CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND;
+/************************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include "misc.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "input.h"
+#include "dixfont.h"
+#include "site.h"
+#include "dixstruct.h"
+#include "os.h"
+
+ScreenInfo screenInfo;
+
+KeybdCtrl defaultKeyboardControl = {
+ DEFAULT_KEYBOARD_CLICK,
+ DEFAULT_BELL,
+ DEFAULT_BELL_PITCH,
+ DEFAULT_BELL_DURATION,
+ DEFAULT_AUTOREPEAT,
+ DEFAULT_AUTOREPEATS,
+ DEFAULT_LEDS,
+ 0
+};
+
+PtrCtrl defaultPointerControl = {
+ DEFAULT_PTR_NUMERATOR,
+ DEFAULT_PTR_DENOMINATOR,
+ DEFAULT_PTR_THRESHOLD,
+ 0
+};
+
+ClientPtr clients[MAXCLIENTS];
+ClientPtr serverClient;
+int currentMaxClients; /* current size of clients array */
+long maxBigRequestSize = MAX_BIG_REQUEST_SIZE;
+
+unsigned long globalSerialNumber = 0;
+unsigned long serverGeneration = 0;
+
+/* these next four are initialized in main.c */
+CARD32 ScreenSaverTime;
+CARD32 ScreenSaverInterval;
+int ScreenSaverBlanking;
+int ScreenSaverAllowExposures;
+
+#ifdef DPMSExtension
+CARD16 DPMSPowerLevel = 0;
+Bool DPMSDisabledSwitch = FALSE;
+Bool DPMSCapableFlag = FALSE;
+CARD32 DPMSStandbyTime;
+CARD32 DPMSSuspendTime;
+CARD32 DPMSOffTime;
+Bool DPMSEnabled;
+#endif
+
+CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
+CARD32 defaultScreenSaverInterval = DEFAULT_SCREEN_SAVER_INTERVAL;
+int defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING;
+int defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES;
+
+#ifdef SCREENSAVER
+Bool screenSaverSuspended = FALSE;
+#endif
+
+char *defaultFontPath = COMPILEDDEFAULTFONTPATH;
+char *defaultTextFont = COMPILEDDEFAULTFONT;
+char *defaultCursorFont = COMPILEDCURSORFONT;
+FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in
+ every compilation of dix code */
+CursorPtr rootCursor;
+Bool party_like_its_1989 = FALSE;
+Bool whiteRoot = FALSE;
+
+TimeStamp currentTime;
+TimeStamp lastDeviceEventTime[MAXDEVICES];
+
+int defaultColorVisualClass = -1;
+int monitorResolution = 0;
+
+char *display;
+char *ConnectionInfo;
+
+CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND;
diff --git a/xorg-server/dix/glyphcurs.c b/xorg-server/dix/glyphcurs.c
index 946f447b2..9004cb152 100644
--- a/xorg-server/dix/glyphcurs.c
+++ b/xorg-server/dix/glyphcurs.c
@@ -1,191 +1,181 @@
-/************************************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-************************************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "misc.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "resource.h"
-#include "dix.h"
-#include "cursorstr.h"
-#include "opaque.h"
-#include "servermd.h"
-
-
-/*
- get the bits out of the font in a portable way. to avoid
-dealing with padding and such-like, we draw the glyph into
-a bitmap, then read the bits out with GetImage, which
-uses server-natural format.
- since all screens return the same bitmap format, we'll just use
-the first one we find.
- the character origin lines up with the hotspot in the
-cursor metrics.
-*/
-
-int
-ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned char **ppbits)
-{
- ScreenPtr pScreen;
- GCPtr pGC;
- xRectangle rect;
- PixmapPtr ppix;
- long nby;
- char *pbits;
- ChangeGCVal gcval[3];
- unsigned char char2b[2];
-
- /* turn glyph index into a protocol-format char2b */
- char2b[0] = (unsigned char)(ch >> 8);
- char2b[1] = (unsigned char)(ch & 0xff);
-
- pScreen = screenInfo.screens[0];
- nby = BitmapBytePad(cm->width) * (long)cm->height;
- pbits = calloc(1, nby);
- if (!pbits)
- return BadAlloc;
-
- ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width,
- cm->height, 1,
- CREATE_PIXMAP_USAGE_SCRATCH);
- pGC = GetScratchGC(1, pScreen);
- if (!ppix || !pGC)
- {
- if (ppix)
- (*pScreen->DestroyPixmap)(ppix);
- if (pGC)
- FreeScratchGC(pGC);
- free(pbits);
- return BadAlloc;
- }
-
- rect.x = 0;
- rect.y = 0;
- rect.width = cm->width;
- rect.height = cm->height;
-
- /* fill the pixmap with 0 */
- gcval[0].val = GXcopy;
- gcval[1].val = 0;
- gcval[2].ptr = (pointer)pfont;
- ChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont, gcval);
- ValidateGC((DrawablePtr)ppix, pGC);
- (*pGC->ops->PolyFillRect)((DrawablePtr)ppix, pGC, 1, &rect);
-
- /* draw the glyph */
- gcval[0].val = 1;
- ChangeGC(NullClient, pGC, GCForeground, gcval);
- ValidateGC((DrawablePtr)ppix, pGC);
- (*pGC->ops->PolyText16)((DrawablePtr)ppix, pGC, cm->xhot, cm->yhot,
- 1, (unsigned short *)char2b);
- (*pScreen->GetImage)((DrawablePtr)ppix, 0, 0, cm->width, cm->height,
- XYPixmap, 1, pbits);
- *ppbits = (unsigned char *)pbits;
- FreeScratchGC(pGC);
- (*pScreen->DestroyPixmap)(ppix);
- return Success;
-}
-
-
-Bool
-CursorMetricsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm)
-{
- CharInfoPtr pci;
- unsigned long nglyphs;
- CARD8 chs[2];
- FontEncoding encoding;
-
- chs[0] = ch >> 8;
- chs[1] = ch;
- encoding = (FONTLASTROW(pfont) == 0) ? Linear16Bit : TwoD16Bit;
- if (encoding == Linear16Bit)
- {
- if (ch < pfont->info.firstCol || pfont->info.lastCol < ch)
- return FALSE;
- }
- else
- {
- if (chs[0] < pfont->info.firstRow || pfont->info.lastRow < chs[0])
- return FALSE;
- if (chs[1] < pfont->info.firstCol || pfont->info.lastCol < chs[1])
- return FALSE;
- }
- (*pfont->get_glyphs) (pfont, 1, chs, encoding, &nglyphs, &pci);
- if (nglyphs == 0)
- return FALSE;
- cm->width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
- cm->height = pci->metrics.descent + pci->metrics.ascent;
- if (pci->metrics.leftSideBearing > 0)
- {
- cm->width += pci->metrics.leftSideBearing;
- cm->xhot = 0;
- }
- else
- {
- cm->xhot = -pci->metrics.leftSideBearing;
- if (pci->metrics.rightSideBearing < 0)
- cm->width -= pci->metrics.rightSideBearing;
- }
- if (pci->metrics.ascent < 0)
- {
- cm->height -= pci->metrics.ascent;
- cm->yhot = 0;
- }
- else
- {
- cm->yhot = pci->metrics.ascent;
- if (pci->metrics.descent < 0)
- cm->height -= pci->metrics.descent;
- }
- return TRUE;
-}
+/************************************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+************************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "misc.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "resource.h"
+#include "dix.h"
+#include "cursorstr.h"
+#include "opaque.h"
+#include "servermd.h"
+
+/*
+ get the bits out of the font in a portable way. to avoid
+dealing with padding and such-like, we draw the glyph into
+a bitmap, then read the bits out with GetImage, which
+uses server-natural format.
+ since all screens return the same bitmap format, we'll just use
+the first one we find.
+ the character origin lines up with the hotspot in the
+cursor metrics.
+*/
+
+int
+ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm,
+ unsigned char **ppbits)
+{
+ ScreenPtr pScreen;
+ GCPtr pGC;
+ xRectangle rect;
+ PixmapPtr ppix;
+ long nby;
+ char *pbits;
+ ChangeGCVal gcval[3];
+ unsigned char char2b[2];
+
+ /* turn glyph index into a protocol-format char2b */
+ char2b[0] = (unsigned char) (ch >> 8);
+ char2b[1] = (unsigned char) (ch & 0xff);
+
+ pScreen = screenInfo.screens[0];
+ nby = BitmapBytePad(cm->width) * (long) cm->height;
+ pbits = calloc(1, nby);
+ if (!pbits)
+ return BadAlloc;
+
+ ppix = (PixmapPtr) (*pScreen->CreatePixmap) (pScreen, cm->width,
+ cm->height, 1,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ pGC = GetScratchGC(1, pScreen);
+ if (!ppix || !pGC) {
+ if (ppix)
+ (*pScreen->DestroyPixmap) (ppix);
+ if (pGC)
+ FreeScratchGC(pGC);
+ free(pbits);
+ return BadAlloc;
+ }
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = cm->width;
+ rect.height = cm->height;
+
+ /* fill the pixmap with 0 */
+ gcval[0].val = GXcopy;
+ gcval[1].val = 0;
+ gcval[2].ptr = (pointer) pfont;
+ ChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont, gcval);
+ ValidateGC((DrawablePtr) ppix, pGC);
+ (*pGC->ops->PolyFillRect) ((DrawablePtr) ppix, pGC, 1, &rect);
+
+ /* draw the glyph */
+ gcval[0].val = 1;
+ ChangeGC(NullClient, pGC, GCForeground, gcval);
+ ValidateGC((DrawablePtr) ppix, pGC);
+ (*pGC->ops->PolyText16) ((DrawablePtr) ppix, pGC, cm->xhot, cm->yhot,
+ 1, (unsigned short *) char2b);
+ (*pScreen->GetImage) ((DrawablePtr) ppix, 0, 0, cm->width, cm->height,
+ XYPixmap, 1, pbits);
+ *ppbits = (unsigned char *) pbits;
+ FreeScratchGC(pGC);
+ (*pScreen->DestroyPixmap) (ppix);
+ return Success;
+}
+
+Bool
+CursorMetricsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm)
+{
+ CharInfoPtr pci;
+ unsigned long nglyphs;
+ CARD8 chs[2];
+ FontEncoding encoding;
+
+ chs[0] = ch >> 8;
+ chs[1] = ch;
+ encoding = (FONTLASTROW(pfont) == 0) ? Linear16Bit : TwoD16Bit;
+ if (encoding == Linear16Bit) {
+ if (ch < pfont->info.firstCol || pfont->info.lastCol < ch)
+ return FALSE;
+ }
+ else {
+ if (chs[0] < pfont->info.firstRow || pfont->info.lastRow < chs[0])
+ return FALSE;
+ if (chs[1] < pfont->info.firstCol || pfont->info.lastCol < chs[1])
+ return FALSE;
+ }
+ (*pfont->get_glyphs) (pfont, 1, chs, encoding, &nglyphs, &pci);
+ if (nglyphs == 0)
+ return FALSE;
+ cm->width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
+ cm->height = pci->metrics.descent + pci->metrics.ascent;
+ if (pci->metrics.leftSideBearing > 0) {
+ cm->width += pci->metrics.leftSideBearing;
+ cm->xhot = 0;
+ }
+ else {
+ cm->xhot = -pci->metrics.leftSideBearing;
+ if (pci->metrics.rightSideBearing < 0)
+ cm->width -= pci->metrics.rightSideBearing;
+ }
+ if (pci->metrics.ascent < 0) {
+ cm->height -= pci->metrics.ascent;
+ cm->yhot = 0;
+ }
+ else {
+ cm->yhot = pci->metrics.ascent;
+ if (pci->metrics.descent < 0)
+ cm->height -= pci->metrics.descent;
+ }
+ return TRUE;
+}
diff --git a/xorg-server/dix/grabs.c b/xorg-server/dix/grabs.c
index 710fcb86c..b775f117d 100644
--- a/xorg-server/dix/grabs.c
+++ b/xorg-server/dix/grabs.c
@@ -24,7 +24,6 @@ not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved
@@ -84,24 +83,20 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
ErrorF("Active grab 0x%lx (%s) on device '%s' (%d):\n",
(unsigned long) grab->resource,
(grab->grabtype == XI2) ? "xi2" :
- ((grab->grabtype == CORE) ? "core" : "xi1"),
- dev->name, dev->id);
+ ((grab->grabtype == CORE) ? "core" : "xi1"), dev->name, dev->id);
client = clients[CLIENT_ID(grab->resource)];
- if (client)
- {
+ if (client) {
pid_t clientpid = GetClientPid(client);
const char *cmdname = GetClientCmdName(client);
const char *cmdargs = GetClientCmdArgs(client);
- if ((clientpid > 0) && (cmdname != NULL))
- {
+ if ((clientpid > 0) && (cmdname != NULL)) {
ErrorF(" client pid %ld %s %s\n",
(long) clientpid, cmdname, cmdargs ? cmdargs : "");
clientIdPrinted = TRUE;
}
- else if (GetLocalClientCreds(client, &lcc) != -1)
- {
+ else if (GetLocalClientCreds(client, &lcc) != -1) {
ErrorF(" client pid %ld uid %ld gid %ld\n",
(lcc->fieldsSet & LCC_PID_SET) ? (long) lcc->pid : 0,
(lcc->fieldsSet & LCC_UID_SET) ? (long) lcc->euid : 0,
@@ -110,8 +105,7 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
clientIdPrinted = TRUE;
}
}
- if (!clientIdPrinted)
- {
+ if (!clientIdPrinted) {
ErrorF(" (no client information available for client %d)\n",
CLIENT_ID(grab->resource));
}
@@ -125,32 +119,26 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
(unsigned long) devGrab->grabTime.milliseconds,
devGrab->fromPassiveGrab ? "passive" : "active",
devGrab->implicitGrab ? " (implicit)" : "",
- devGrab->sync.frozen ? "frozen" : "thawed",
- devGrab->sync.state);
+ devGrab->sync.frozen ? "frozen" : "thawed", devGrab->sync.state);
- if (grab->grabtype == CORE)
- {
+ if (grab->grabtype == CORE) {
ErrorF(" core event mask 0x%lx\n",
(unsigned long) grab->eventMask);
}
- else if (grab->grabtype == XI)
- {
+ else if (grab->grabtype == XI) {
ErrorF(" xi1 event mask 0x%lx\n",
devGrab->implicitGrab ? (unsigned long) grab->deviceMask :
- (unsigned long) grab->eventMask);
+ (unsigned long) grab->eventMask);
}
- else if (grab->grabtype == XI2)
- {
- for (i = 0; i < xi2mask_num_masks(grab->xi2mask); i++)
- {
+ else if (grab->grabtype == XI2) {
+ for (i = 0; i < xi2mask_num_masks(grab->xi2mask); i++) {
const unsigned char *mask;
int print;
+
print = 0;
- for (j = 0; j < XI2MASKSIZE; j++)
- {
+ for (j = 0; j < XI2MASKSIZE; j++) {
mask = xi2mask_get_one_mask(grab->xi2mask, i);
- if (mask[j])
- {
+ if (mask[j]) {
print = 1;
break;
}
@@ -164,8 +152,7 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
}
}
- if (devGrab->fromPassiveGrab)
- {
+ if (devGrab->fromPassiveGrab) {
ErrorF(" passive grab type %d, detail 0x%x, "
"activating key %d\n", grab->type, grab->detail.exact,
devGrab->activatingKey);
@@ -187,8 +174,7 @@ UngrabAllDevices(Bool kill_client)
ErrorF("Ungrabbing all devices%s; grabs listed below:\n",
kill_client ? " and killing their owners" : "");
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
if (!dev->deviceGrab.grab)
continue;
PrintDeviceGrabInfo(dev);
@@ -218,28 +204,18 @@ AllocGrab(void)
}
GrabPtr
-CreateGrab(
- int client,
- DeviceIntPtr device,
- DeviceIntPtr modDevice,
- WindowPtr window,
- enum InputLevel grabtype,
- GrabMask *mask,
- GrabParameters *param,
- int type,
- KeyCode keybut, /* key or button */
- WindowPtr confineTo,
- CursorPtr cursor)
+CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice, WindowPtr window, enum InputLevel grabtype, GrabMask *mask, GrabParameters *param, int type, KeyCode keybut, /* key or button */
+ WindowPtr confineTo, CursorPtr cursor)
{
GrabPtr grab;
grab = AllocGrab();
if (!grab)
- return (GrabPtr)NULL;
+ return (GrabPtr) NULL;
grab->resource = FakeClientID(client);
grab->device = device;
grab->window = window;
- grab->eventMask = mask->core; /* same for XI */
+ grab->eventMask = mask->core; /* same for XI */
grab->deviceMask = 0;
grab->ownerEvents = param->ownerEvents;
grab->keyboardMode = param->this_device_mode;
@@ -258,7 +234,7 @@ CreateGrab(
if (grabtype == XI2)
xi2mask_merge(grab->xi2mask, mask->xi2mask);
if (cursor)
- cursor->refcnt++;
+ cursor->refcnt++;
return grab;
}
@@ -273,7 +249,7 @@ FreeGrab(GrabPtr pGrab)
free(pGrab->detail.pMask);
if (pGrab->cursor)
- FreeCursor(pGrab->cursor, (Cursor)0);
+ FreeCursor(pGrab->cursor, (Cursor) 0);
xi2mask_free(&pGrab->xi2mask);
free(pGrab);
@@ -291,6 +267,7 @@ CopyGrab(GrabPtr dst, const GrabPtr src)
if (src->modifiersDetail.pMask) {
int len = MasksPerDetailMask * sizeof(Mask);
+
mdetails_mask = malloc(len);
if (!mdetails_mask)
return FALSE;
@@ -299,6 +276,7 @@ CopyGrab(GrabPtr dst, const GrabPtr src)
if (src->detail.pMask) {
int len = MasksPerDetailMask * sizeof(Mask);
+
details_mask = malloc(len);
if (!details_mask) {
free(mdetails_mask);
@@ -314,7 +292,8 @@ CopyGrab(GrabPtr dst, const GrabPtr src)
free(details_mask);
return FALSE;
}
- } else {
+ }
+ else {
xi2mask = dst->xi2mask;
xi2mask_zero(xi2mask, -1);
}
@@ -333,22 +312,19 @@ int
DeletePassiveGrab(pointer value, XID id)
{
GrabPtr g, prev;
- GrabPtr pGrab = (GrabPtr)value;
+ GrabPtr pGrab = (GrabPtr) value;
/* it is OK if the grab isn't found */
prev = 0;
- for (g = (wPassiveGrabs (pGrab->window)); g; g = g->next)
- {
- if (pGrab == g)
- {
- if (prev)
- prev->next = g->next;
- else
- if (!(pGrab->window->optional->passiveGrabs = g->next))
- CheckWindowOptionalNeed (pGrab->window);
- break;
- }
- prev = g;
+ for (g = (wPassiveGrabs(pGrab->window)); g; g = g->next) {
+ if (pGrab == g) {
+ if (prev)
+ prev->next = g->next;
+ else if (!(pGrab->window->optional->passiveGrabs = g->next))
+ CheckWindowOptionalNeed(pGrab->window);
+ break;
+ }
+ prev = g;
}
FreeGrab(pGrab);
return Success;
@@ -361,69 +337,60 @@ DeleteDetailFromMask(Mask *pDetailMask, unsigned int detail)
int i;
mask = malloc(sizeof(Mask) * MasksPerDetailMask);
- if (mask)
- {
- if (pDetailMask)
- for (i = 0; i < MasksPerDetailMask; i++)
- mask[i]= pDetailMask[i];
- else
- for (i = 0; i < MasksPerDetailMask; i++)
- mask[i]= ~0L;
- BITCLEAR(mask, detail);
+ if (mask) {
+ if (pDetailMask)
+ for (i = 0; i < MasksPerDetailMask; i++)
+ mask[i] = pDetailMask[i];
+ else
+ for (i = 0; i < MasksPerDetailMask; i++)
+ mask[i] = ~0L;
+ BITCLEAR(mask, detail);
}
- return mask;
+ return mask;
}
static Bool
-IsInGrabMask(
- DetailRec firstDetail,
- DetailRec secondDetail,
- unsigned int exception)
+IsInGrabMask(DetailRec firstDetail,
+ DetailRec secondDetail, unsigned int exception)
{
- if (firstDetail.exact == exception)
- {
- if (firstDetail.pMask == NULL)
- return TRUE;
-
- /* (at present) never called with two non-null pMasks */
- if (secondDetail.exact == exception)
- return FALSE;
-
- if (GETBIT(firstDetail.pMask, secondDetail.exact))
- return TRUE;
+ if (firstDetail.exact == exception) {
+ if (firstDetail.pMask == NULL)
+ return TRUE;
+
+ /* (at present) never called with two non-null pMasks */
+ if (secondDetail.exact == exception)
+ return FALSE;
+
+ if (GETBIT(firstDetail.pMask, secondDetail.exact))
+ return TRUE;
}
-
+
return FALSE;
}
-static Bool
-IdenticalExactDetails(
- unsigned int firstExact,
- unsigned int secondExact,
- unsigned int exception)
+static Bool
+IdenticalExactDetails(unsigned int firstExact,
+ unsigned int secondExact, unsigned int exception)
{
if ((firstExact == exception) || (secondExact == exception))
- return FALSE;
-
+ return FALSE;
+
if (firstExact == secondExact)
- return TRUE;
+ return TRUE;
return FALSE;
}
-static Bool
-DetailSupersedesSecond(
- DetailRec firstDetail,
- DetailRec secondDetail,
- unsigned int exception)
+static Bool
+DetailSupersedesSecond(DetailRec firstDetail,
+ DetailRec secondDetail, unsigned int exception)
{
if (IsInGrabMask(firstDetail, secondDetail, exception))
- return TRUE;
+ return TRUE;
+
+ if (IdenticalExactDetails(firstDetail.exact, secondDetail.exact, exception))
+ return TRUE;
- if (IdenticalExactDetails(firstDetail.exact, secondDetail.exact,
- exception))
- return TRUE;
-
return FALSE;
}
@@ -431,17 +398,15 @@ static Bool
GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab)
{
unsigned int any_modifier = (pFirstGrab->grabtype == XI2) ?
- (unsigned int)XIAnyModifier :
- (unsigned int)AnyModifier;
+ (unsigned int) XIAnyModifier : (unsigned int) AnyModifier;
if (!DetailSupersedesSecond(pFirstGrab->modifiersDetail,
- pSecondGrab->modifiersDetail,
- any_modifier))
- return FALSE;
+ pSecondGrab->modifiersDetail, any_modifier))
+ return FALSE;
if (DetailSupersedesSecond(pFirstGrab->detail,
- pSecondGrab->detail, (unsigned int)AnyKey))
- return TRUE;
-
+ pSecondGrab->detail, (unsigned int) AnyKey))
+ return TRUE;
+
return FALSE;
}
@@ -462,57 +427,54 @@ Bool
GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab, Bool ignoreDevice)
{
unsigned int any_modifier = (pFirstGrab->grabtype == XI2) ?
- (unsigned int)XIAnyModifier :
- (unsigned int)AnyModifier;
+ (unsigned int) XIAnyModifier : (unsigned int) AnyModifier;
if (pFirstGrab->grabtype != pSecondGrab->grabtype)
return FALSE;
- if (pFirstGrab->grabtype == XI2)
- {
+ if (pFirstGrab->grabtype == XI2) {
if (pFirstGrab->device == inputInfo.all_devices ||
- pSecondGrab->device == inputInfo.all_devices)
- {
+ pSecondGrab->device == inputInfo.all_devices) {
/* do nothing */
- } else if (pFirstGrab->device == inputInfo.all_master_devices)
- {
+ }
+ else if (pFirstGrab->device == inputInfo.all_master_devices) {
if (pSecondGrab->device != inputInfo.all_master_devices &&
!IsMaster(pSecondGrab->device))
return FALSE;
- } else if (pSecondGrab->device == inputInfo.all_master_devices)
- {
+ }
+ else if (pSecondGrab->device == inputInfo.all_master_devices) {
if (pFirstGrab->device != inputInfo.all_master_devices &&
!IsMaster(pFirstGrab->device))
return FALSE;
- } else if (pSecondGrab->device != pFirstGrab->device)
- return FALSE;
- } else if (!ignoreDevice &&
- ((pFirstGrab->device != pSecondGrab->device) ||
- (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice)))
+ }
+ else if (pSecondGrab->device != pFirstGrab->device)
return FALSE;
+ }
+ else if (!ignoreDevice &&
+ ((pFirstGrab->device != pSecondGrab->device) ||
+ (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice)))
+ return FALSE;
if (pFirstGrab->type != pSecondGrab->type)
- return FALSE;
+ return FALSE;
if (GrabSupersedesSecond(pFirstGrab, pSecondGrab) ||
- GrabSupersedesSecond(pSecondGrab, pFirstGrab))
- return TRUE;
-
+ GrabSupersedesSecond(pSecondGrab, pFirstGrab))
+ return TRUE;
+
if (DetailSupersedesSecond(pSecondGrab->detail, pFirstGrab->detail,
- (unsigned int)AnyKey)
- &&
- DetailSupersedesSecond(pFirstGrab->modifiersDetail,
- pSecondGrab->modifiersDetail,
- any_modifier))
- return TRUE;
+ (unsigned int) AnyKey)
+ &&
+ DetailSupersedesSecond(pFirstGrab->modifiersDetail,
+ pSecondGrab->modifiersDetail, any_modifier))
+ return TRUE;
if (DetailSupersedesSecond(pFirstGrab->detail, pSecondGrab->detail,
- (unsigned int)AnyKey)
- &&
- DetailSupersedesSecond(pSecondGrab->modifiersDetail,
- pFirstGrab->modifiersDetail,
- any_modifier))
- return TRUE;
+ (unsigned int) AnyKey)
+ &&
+ DetailSupersedesSecond(pSecondGrab->modifiersDetail,
+ pFirstGrab->modifiersDetail, any_modifier))
+ return TRUE;
return FALSE;
}
@@ -521,38 +483,33 @@ static Bool
GrabsAreIdentical(GrabPtr pFirstGrab, GrabPtr pSecondGrab)
{
unsigned int any_modifier = (pFirstGrab->grabtype == XI2) ?
- (unsigned int)XIAnyModifier :
- (unsigned int)AnyModifier;
+ (unsigned int) XIAnyModifier : (unsigned int) AnyModifier;
if (pFirstGrab->grabtype != pSecondGrab->grabtype)
return FALSE;
- if (pFirstGrab->device != pSecondGrab->device ||
- (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice) ||
- (pFirstGrab->type != pSecondGrab->type))
- return FALSE;
-
- if (!(DetailSupersedesSecond(pFirstGrab->detail,
- pSecondGrab->detail,
- (unsigned int)AnyKey) &&
- DetailSupersedesSecond(pSecondGrab->detail,
- pFirstGrab->detail,
- (unsigned int)AnyKey)))
+ if (pFirstGrab->device != pSecondGrab->device ||
+ (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice) ||
+ (pFirstGrab->type != pSecondGrab->type))
return FALSE;
+ if (!(DetailSupersedesSecond(pFirstGrab->detail,
+ pSecondGrab->detail,
+ (unsigned int) AnyKey) &&
+ DetailSupersedesSecond(pSecondGrab->detail,
+ pFirstGrab->detail, (unsigned int) AnyKey)))
+ return FALSE;
- if (!(DetailSupersedesSecond(pFirstGrab->modifiersDetail,
- pSecondGrab->modifiersDetail,
- any_modifier) &&
- DetailSupersedesSecond(pSecondGrab->modifiersDetail,
- pFirstGrab->modifiersDetail,
- any_modifier)))
+ if (!(DetailSupersedesSecond(pFirstGrab->modifiersDetail,
+ pSecondGrab->modifiersDetail,
+ any_modifier) &&
+ DetailSupersedesSecond(pSecondGrab->modifiersDetail,
+ pFirstGrab->modifiersDetail, any_modifier)))
return FALSE;
return TRUE;
}
-
/**
* Prepend the new grab to the list of passive grabs on the window.
* Any previously existing grab that matches the new grab will be removed.
@@ -568,44 +525,39 @@ AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab)
Mask access_mode = DixGrabAccess;
int rc;
- for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next)
- {
- if (GrabMatchesSecond(pGrab, grab, (pGrab->grabtype == CORE)))
- {
- if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource))
- {
- FreeGrab(pGrab);
- return BadAccess;
- }
- }
+ for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) {
+ if (GrabMatchesSecond(pGrab, grab, (pGrab->grabtype == CORE))) {
+ if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource)) {
+ FreeGrab(pGrab);
+ return BadAccess;
+ }
+ }
}
- if (pGrab->keyboardMode == GrabModeSync||pGrab->pointerMode == GrabModeSync)
- access_mode |= DixFreezeAccess;
+ if (pGrab->keyboardMode == GrabModeSync ||
+ pGrab->pointerMode == GrabModeSync)
+ access_mode |= DixFreezeAccess;
rc = XaceHook(XACE_DEVICE_ACCESS, client, pGrab->device, access_mode);
if (rc != Success)
- return rc;
+ return rc;
/* Remove all grabs that match the new one exactly */
- for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next)
- {
- if (GrabsAreIdentical(pGrab, grab))
- {
+ for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) {
+ if (GrabsAreIdentical(pGrab, grab)) {
DeletePassiveGrabFromList(grab);
break;
- }
+ }
}
- if (!pGrab->window->optional && !MakeWindowOptional (pGrab->window))
- {
- FreeGrab(pGrab);
- return BadAlloc;
+ if (!pGrab->window->optional && !MakeWindowOptional(pGrab->window)) {
+ FreeGrab(pGrab);
+ return BadAlloc;
}
pGrab->next = pGrab->window->optional->passiveGrabs;
pGrab->window->optional->passiveGrabs = pGrab;
- if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (pointer)pGrab))
- return Success;
+ if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (pointer) pGrab))
+ return Success;
return BadAlloc;
}
@@ -632,58 +584,50 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
i = 0;
for (grab = wPassiveGrabs(pMinuendGrab->window); grab; grab = grab->next)
- i++;
+ i++;
if (!i)
- return TRUE;
+ return TRUE;
deletes = malloc(i * sizeof(GrabPtr));
adds = malloc(i * sizeof(GrabPtr));
updates = malloc(i * sizeof(Mask **));
details = malloc(i * sizeof(Mask *));
- if (!deletes || !adds || !updates || !details)
- {
- free(details);
- free(updates);
- free(adds);
- free(deletes);
- return FALSE;
+ if (!deletes || !adds || !updates || !details) {
+ free(details);
+ free(updates);
+ free(adds);
+ free(deletes);
+ return FALSE;
}
any_modifier = (pMinuendGrab->grabtype == XI2) ?
- (unsigned int)XIAnyModifier : (unsigned int)AnyModifier;
+ (unsigned int) XIAnyModifier : (unsigned int) AnyModifier;
any_key = (pMinuendGrab->grabtype == XI2) ?
- (unsigned int)XIAnyKeycode : (unsigned int)AnyKey;
+ (unsigned int) XIAnyKeycode : (unsigned int) AnyKey;
ndels = nadds = nups = 0;
ok = TRUE;
for (grab = wPassiveGrabs(pMinuendGrab->window);
- grab && ok;
- grab = grab->next)
- {
- if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource)) ||
- !GrabMatchesSecond(grab, pMinuendGrab,
- (grab->grabtype == CORE)))
- continue;
- if (GrabSupersedesSecond(pMinuendGrab, grab))
- {
- deletes[ndels++] = grab;
- }
- else if ((grab->detail.exact == any_key)
- && (grab->modifiersDetail.exact != any_modifier))
- {
- UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);
- }
- else if ((grab->modifiersDetail.exact == any_modifier)
- && (grab->detail.exact != any_key))
- {
- UPDATE(grab->modifiersDetail.pMask,
- pMinuendGrab->modifiersDetail.exact);
- }
- else if ((pMinuendGrab->detail.exact != any_key)
- && (pMinuendGrab->modifiersDetail.exact != any_modifier))
- {
- GrabPtr pNewGrab;
+ grab && ok; grab = grab->next) {
+ if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource))
+ || !GrabMatchesSecond(grab, pMinuendGrab, (grab->grabtype == CORE)))
+ continue;
+ if (GrabSupersedesSecond(pMinuendGrab, grab)) {
+ deletes[ndels++] = grab;
+ }
+ else if ((grab->detail.exact == any_key)
+ && (grab->modifiersDetail.exact != any_modifier)) {
+ UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);
+ }
+ else if ((grab->modifiersDetail.exact == any_modifier)
+ && (grab->detail.exact != any_key)) {
+ UPDATE(grab->modifiersDetail.pMask,
+ pMinuendGrab->modifiersDetail.exact);
+ }
+ else if ((pMinuendGrab->detail.exact != any_key)
+ && (pMinuendGrab->modifiersDetail.exact != any_modifier)) {
+ GrabPtr pNewGrab;
GrabParameters param;
- UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);
+ UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);
memset(&param, 0, sizeof(param));
param.ownerEvents = grab->ownerEvents;
@@ -691,64 +635,57 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
param.other_devices_mode = grab->pointerMode;
param.modifiers = any_modifier;
- pNewGrab = CreateGrab(CLIENT_ID(grab->resource), grab->device,
- grab->modifierDevice, grab->window,
+ pNewGrab = CreateGrab(CLIENT_ID(grab->resource), grab->device,
+ grab->modifierDevice, grab->window,
grab->grabtype,
- (GrabMask*)&grab->eventMask,
- &param, (int)grab->type,
- pMinuendGrab->detail.exact,
- grab->confineTo, grab->cursor);
- if (!pNewGrab)
- ok = FALSE;
- else if (!(pNewGrab->modifiersDetail.pMask =
- DeleteDetailFromMask(grab->modifiersDetail.pMask,
- pMinuendGrab->modifiersDetail.exact))
- ||
- (!pNewGrab->window->optional &&
- !MakeWindowOptional(pNewGrab->window)))
- {
- FreeGrab(pNewGrab);
- ok = FALSE;
- }
- else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB,
- (pointer)pNewGrab))
- ok = FALSE;
- else
- adds[nadds++] = pNewGrab;
- }
- else if (pMinuendGrab->detail.exact == any_key)
- {
- UPDATE(grab->modifiersDetail.pMask,
- pMinuendGrab->modifiersDetail.exact);
- }
- else
- {
- UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);
- }
+ (GrabMask *) &grab->eventMask,
+ &param, (int) grab->type,
+ pMinuendGrab->detail.exact,
+ grab->confineTo, grab->cursor);
+ if (!pNewGrab)
+ ok = FALSE;
+ else if (!(pNewGrab->modifiersDetail.pMask =
+ DeleteDetailFromMask(grab->modifiersDetail.pMask,
+ pMinuendGrab->modifiersDetail.
+ exact))
+ || (!pNewGrab->window->optional &&
+ !MakeWindowOptional(pNewGrab->window))) {
+ FreeGrab(pNewGrab);
+ ok = FALSE;
+ }
+ else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB,
+ (pointer) pNewGrab))
+ ok = FALSE;
+ else
+ adds[nadds++] = pNewGrab;
+ }
+ else if (pMinuendGrab->detail.exact == any_key) {
+ UPDATE(grab->modifiersDetail.pMask,
+ pMinuendGrab->modifiersDetail.exact);
+ }
+ else {
+ UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);
+ }
}
- if (!ok)
- {
- for (i = 0; i < nadds; i++)
- FreeResource(adds[i]->resource, RT_NONE);
- for (i = 0; i < nups; i++)
- free(details[i]);
+ if (!ok) {
+ for (i = 0; i < nadds; i++)
+ FreeResource(adds[i]->resource, RT_NONE);
+ for (i = 0; i < nups; i++)
+ free(details[i]);
}
- else
- {
- for (i = 0; i < ndels; i++)
- FreeResource(deletes[i]->resource, RT_NONE);
- for (i = 0; i < nadds; i++)
- {
- grab = adds[i];
- grab->next = grab->window->optional->passiveGrabs;
- grab->window->optional->passiveGrabs = grab;
- }
- for (i = 0; i < nups; i++)
- {
- free(*updates[i]);
- *updates[i] = details[i];
- }
+ else {
+ for (i = 0; i < ndels; i++)
+ FreeResource(deletes[i]->resource, RT_NONE);
+ for (i = 0; i < nadds; i++) {
+ grab = adds[i];
+ grab->next = grab->window->optional->passiveGrabs;
+ grab->window->optional->passiveGrabs = grab;
+ }
+ for (i = 0; i < nups; i++) {
+ free(*updates[i]);
+ *updates[i] = details[i];
+ }
}
free(details);
free(updates);
@@ -763,14 +700,12 @@ Bool
GrabIsPointerGrab(GrabPtr grab)
{
return (grab->type == ButtonPress ||
- grab->type == DeviceButtonPress ||
- grab->type == XI_ButtonPress);
+ grab->type == DeviceButtonPress || grab->type == XI_ButtonPress);
}
Bool
GrabIsKeyboardGrab(GrabPtr grab)
{
- return (grab->type == KeyPress ||
- grab->type == DeviceKeyPress ||
- grab->type == XI_KeyPress);
+ return (grab->type == KeyPress ||
+ grab->type == DeviceKeyPress || grab->type == XI_KeyPress);
}
diff --git a/xorg-server/dix/initatoms.c b/xorg-server/dix/initatoms.c
index de101bd0f..bcc38a0f1 100644
--- a/xorg-server/dix/initatoms.c
+++ b/xorg-server/dix/initatoms.c
@@ -11,74 +11,143 @@
#include <X11/Xatom.h>
#include "misc.h"
#include "dix.h"
-void MakePredeclaredAtoms(void)
+void
+MakePredeclaredAtoms(void)
{
- if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError();
- if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError();
- if (MakeAtom("ARC", 3, 1) != XA_ARC) AtomError();
- if (MakeAtom("ATOM", 4, 1) != XA_ATOM) AtomError();
- if (MakeAtom("BITMAP", 6, 1) != XA_BITMAP) AtomError();
- if (MakeAtom("CARDINAL", 8, 1) != XA_CARDINAL) AtomError();
- if (MakeAtom("COLORMAP", 8, 1) != XA_COLORMAP) AtomError();
- if (MakeAtom("CURSOR", 6, 1) != XA_CURSOR) AtomError();
- if (MakeAtom("CUT_BUFFER0", 11, 1) != XA_CUT_BUFFER0) AtomError();
- if (MakeAtom("CUT_BUFFER1", 11, 1) != XA_CUT_BUFFER1) AtomError();
- if (MakeAtom("CUT_BUFFER2", 11, 1) != XA_CUT_BUFFER2) AtomError();
- if (MakeAtom("CUT_BUFFER3", 11, 1) != XA_CUT_BUFFER3) AtomError();
- if (MakeAtom("CUT_BUFFER4", 11, 1) != XA_CUT_BUFFER4) AtomError();
- if (MakeAtom("CUT_BUFFER5", 11, 1) != XA_CUT_BUFFER5) AtomError();
- if (MakeAtom("CUT_BUFFER6", 11, 1) != XA_CUT_BUFFER6) AtomError();
- if (MakeAtom("CUT_BUFFER7", 11, 1) != XA_CUT_BUFFER7) AtomError();
- if (MakeAtom("DRAWABLE", 8, 1) != XA_DRAWABLE) AtomError();
- if (MakeAtom("FONT", 4, 1) != XA_FONT) AtomError();
- if (MakeAtom("INTEGER", 7, 1) != XA_INTEGER) AtomError();
- if (MakeAtom("PIXMAP", 6, 1) != XA_PIXMAP) AtomError();
- if (MakeAtom("POINT", 5, 1) != XA_POINT) AtomError();
- if (MakeAtom("RECTANGLE", 9, 1) != XA_RECTANGLE) AtomError();
- if (MakeAtom("RESOURCE_MANAGER", 16, 1) != XA_RESOURCE_MANAGER) AtomError();
- if (MakeAtom("RGB_COLOR_MAP", 13, 1) != XA_RGB_COLOR_MAP) AtomError();
- if (MakeAtom("RGB_BEST_MAP", 12, 1) != XA_RGB_BEST_MAP) AtomError();
- if (MakeAtom("RGB_BLUE_MAP", 12, 1) != XA_RGB_BLUE_MAP) AtomError();
- if (MakeAtom("RGB_DEFAULT_MAP", 15, 1) != XA_RGB_DEFAULT_MAP) AtomError();
- if (MakeAtom("RGB_GRAY_MAP", 12, 1) != XA_RGB_GRAY_MAP) AtomError();
- if (MakeAtom("RGB_GREEN_MAP", 13, 1) != XA_RGB_GREEN_MAP) AtomError();
- if (MakeAtom("RGB_RED_MAP", 11, 1) != XA_RGB_RED_MAP) AtomError();
- if (MakeAtom("STRING", 6, 1) != XA_STRING) AtomError();
- if (MakeAtom("VISUALID", 8, 1) != XA_VISUALID) AtomError();
- if (MakeAtom("WINDOW", 6, 1) != XA_WINDOW) AtomError();
- if (MakeAtom("WM_COMMAND", 10, 1) != XA_WM_COMMAND) AtomError();
- if (MakeAtom("WM_HINTS", 8, 1) != XA_WM_HINTS) AtomError();
- if (MakeAtom("WM_CLIENT_MACHINE", 17, 1) != XA_WM_CLIENT_MACHINE) AtomError();
- if (MakeAtom("WM_ICON_NAME", 12, 1) != XA_WM_ICON_NAME) AtomError();
- if (MakeAtom("WM_ICON_SIZE", 12, 1) != XA_WM_ICON_SIZE) AtomError();
- if (MakeAtom("WM_NAME", 7, 1) != XA_WM_NAME) AtomError();
- if (MakeAtom("WM_NORMAL_HINTS", 15, 1) != XA_WM_NORMAL_HINTS) AtomError();
- if (MakeAtom("WM_SIZE_HINTS", 13, 1) != XA_WM_SIZE_HINTS) AtomError();
- if (MakeAtom("WM_ZOOM_HINTS", 13, 1) != XA_WM_ZOOM_HINTS) AtomError();
- if (MakeAtom("MIN_SPACE", 9, 1) != XA_MIN_SPACE) AtomError();
- if (MakeAtom("NORM_SPACE", 10, 1) != XA_NORM_SPACE) AtomError();
- if (MakeAtom("MAX_SPACE", 9, 1) != XA_MAX_SPACE) AtomError();
- if (MakeAtom("END_SPACE", 9, 1) != XA_END_SPACE) AtomError();
- if (MakeAtom("SUPERSCRIPT_X", 13, 1) != XA_SUPERSCRIPT_X) AtomError();
- if (MakeAtom("SUPERSCRIPT_Y", 13, 1) != XA_SUPERSCRIPT_Y) AtomError();
- if (MakeAtom("SUBSCRIPT_X", 11, 1) != XA_SUBSCRIPT_X) AtomError();
- if (MakeAtom("SUBSCRIPT_Y", 11, 1) != XA_SUBSCRIPT_Y) AtomError();
- if (MakeAtom("UNDERLINE_POSITION", 18, 1) != XA_UNDERLINE_POSITION) AtomError();
- if (MakeAtom("UNDERLINE_THICKNESS", 19, 1) != XA_UNDERLINE_THICKNESS) AtomError();
- if (MakeAtom("STRIKEOUT_ASCENT", 16, 1) != XA_STRIKEOUT_ASCENT) AtomError();
- if (MakeAtom("STRIKEOUT_DESCENT", 17, 1) != XA_STRIKEOUT_DESCENT) AtomError();
- if (MakeAtom("ITALIC_ANGLE", 12, 1) != XA_ITALIC_ANGLE) AtomError();
- if (MakeAtom("X_HEIGHT", 8, 1) != XA_X_HEIGHT) AtomError();
- if (MakeAtom("QUAD_WIDTH", 10, 1) != XA_QUAD_WIDTH) AtomError();
- if (MakeAtom("WEIGHT", 6, 1) != XA_WEIGHT) AtomError();
- if (MakeAtom("POINT_SIZE", 10, 1) != XA_POINT_SIZE) AtomError();
- if (MakeAtom("RESOLUTION", 10, 1) != XA_RESOLUTION) AtomError();
- if (MakeAtom("COPYRIGHT", 9, 1) != XA_COPYRIGHT) AtomError();
- if (MakeAtom("NOTICE", 6, 1) != XA_NOTICE) AtomError();
- if (MakeAtom("FONT_NAME", 9, 1) != XA_FONT_NAME) AtomError();
- if (MakeAtom("FAMILY_NAME", 11, 1) != XA_FAMILY_NAME) AtomError();
- if (MakeAtom("FULL_NAME", 9, 1) != XA_FULL_NAME) AtomError();
- if (MakeAtom("CAP_HEIGHT", 10, 1) != XA_CAP_HEIGHT) AtomError();
- if (MakeAtom("WM_CLASS", 8, 1) != XA_WM_CLASS) AtomError();
- if (MakeAtom("WM_TRANSIENT_FOR", 16, 1) != XA_WM_TRANSIENT_FOR) AtomError();
+ if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY)
+ AtomError();
+ if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY)
+ AtomError();
+ if (MakeAtom("ARC", 3, 1) != XA_ARC)
+ AtomError();
+ if (MakeAtom("ATOM", 4, 1) != XA_ATOM)
+ AtomError();
+ if (MakeAtom("BITMAP", 6, 1) != XA_BITMAP)
+ AtomError();
+ if (MakeAtom("CARDINAL", 8, 1) != XA_CARDINAL)
+ AtomError();
+ if (MakeAtom("COLORMAP", 8, 1) != XA_COLORMAP)
+ AtomError();
+ if (MakeAtom("CURSOR", 6, 1) != XA_CURSOR)
+ AtomError();
+ if (MakeAtom("CUT_BUFFER0", 11, 1) != XA_CUT_BUFFER0)
+ AtomError();
+ if (MakeAtom("CUT_BUFFER1", 11, 1) != XA_CUT_BUFFER1)
+ AtomError();
+ if (MakeAtom("CUT_BUFFER2", 11, 1) != XA_CUT_BUFFER2)
+ AtomError();
+ if (MakeAtom("CUT_BUFFER3", 11, 1) != XA_CUT_BUFFER3)
+ AtomError();
+ if (MakeAtom("CUT_BUFFER4", 11, 1) != XA_CUT_BUFFER4)
+ AtomError();
+ if (MakeAtom("CUT_BUFFER5", 11, 1) != XA_CUT_BUFFER5)
+ AtomError();
+ if (MakeAtom("CUT_BUFFER6", 11, 1) != XA_CUT_BUFFER6)
+ AtomError();
+ if (MakeAtom("CUT_BUFFER7", 11, 1) != XA_CUT_BUFFER7)
+ AtomError();
+ if (MakeAtom("DRAWABLE", 8, 1) != XA_DRAWABLE)
+ AtomError();
+ if (MakeAtom("FONT", 4, 1) != XA_FONT)
+ AtomError();
+ if (MakeAtom("INTEGER", 7, 1) != XA_INTEGER)
+ AtomError();
+ if (MakeAtom("PIXMAP", 6, 1) != XA_PIXMAP)
+ AtomError();
+ if (MakeAtom("POINT", 5, 1) != XA_POINT)
+ AtomError();
+ if (MakeAtom("RECTANGLE", 9, 1) != XA_RECTANGLE)
+ AtomError();
+ if (MakeAtom("RESOURCE_MANAGER", 16, 1) != XA_RESOURCE_MANAGER)
+ AtomError();
+ if (MakeAtom("RGB_COLOR_MAP", 13, 1) != XA_RGB_COLOR_MAP)
+ AtomError();
+ if (MakeAtom("RGB_BEST_MAP", 12, 1) != XA_RGB_BEST_MAP)
+ AtomError();
+ if (MakeAtom("RGB_BLUE_MAP", 12, 1) != XA_RGB_BLUE_MAP)
+ AtomError();
+ if (MakeAtom("RGB_DEFAULT_MAP", 15, 1) != XA_RGB_DEFAULT_MAP)
+ AtomError();
+ if (MakeAtom("RGB_GRAY_MAP", 12, 1) != XA_RGB_GRAY_MAP)
+ AtomError();
+ if (MakeAtom("RGB_GREEN_MAP", 13, 1) != XA_RGB_GREEN_MAP)
+ AtomError();
+ if (MakeAtom("RGB_RED_MAP", 11, 1) != XA_RGB_RED_MAP)
+ AtomError();
+ if (MakeAtom("STRING", 6, 1) != XA_STRING)
+ AtomError();
+ if (MakeAtom("VISUALID", 8, 1) != XA_VISUALID)
+ AtomError();
+ if (MakeAtom("WINDOW", 6, 1) != XA_WINDOW)
+ AtomError();
+ if (MakeAtom("WM_COMMAND", 10, 1) != XA_WM_COMMAND)
+ AtomError();
+ if (MakeAtom("WM_HINTS", 8, 1) != XA_WM_HINTS)
+ AtomError();
+ if (MakeAtom("WM_CLIENT_MACHINE", 17, 1) != XA_WM_CLIENT_MACHINE)
+ AtomError();
+ if (MakeAtom("WM_ICON_NAME", 12, 1) != XA_WM_ICON_NAME)
+ AtomError();
+ if (MakeAtom("WM_ICON_SIZE", 12, 1) != XA_WM_ICON_SIZE)
+ AtomError();
+ if (MakeAtom("WM_NAME", 7, 1) != XA_WM_NAME)
+ AtomError();
+ if (MakeAtom("WM_NORMAL_HINTS", 15, 1) != XA_WM_NORMAL_HINTS)
+ AtomError();
+ if (MakeAtom("WM_SIZE_HINTS", 13, 1) != XA_WM_SIZE_HINTS)
+ AtomError();
+ if (MakeAtom("WM_ZOOM_HINTS", 13, 1) != XA_WM_ZOOM_HINTS)
+ AtomError();
+ if (MakeAtom("MIN_SPACE", 9, 1) != XA_MIN_SPACE)
+ AtomError();
+ if (MakeAtom("NORM_SPACE", 10, 1) != XA_NORM_SPACE)
+ AtomError();
+ if (MakeAtom("MAX_SPACE", 9, 1) != XA_MAX_SPACE)
+ AtomError();
+ if (MakeAtom("END_SPACE", 9, 1) != XA_END_SPACE)
+ AtomError();
+ if (MakeAtom("SUPERSCRIPT_X", 13, 1) != XA_SUPERSCRIPT_X)
+ AtomError();
+ if (MakeAtom("SUPERSCRIPT_Y", 13, 1) != XA_SUPERSCRIPT_Y)
+ AtomError();
+ if (MakeAtom("SUBSCRIPT_X", 11, 1) != XA_SUBSCRIPT_X)
+ AtomError();
+ if (MakeAtom("SUBSCRIPT_Y", 11, 1) != XA_SUBSCRIPT_Y)
+ AtomError();
+ if (MakeAtom("UNDERLINE_POSITION", 18, 1) != XA_UNDERLINE_POSITION)
+ AtomError();
+ if (MakeAtom("UNDERLINE_THICKNESS", 19, 1) != XA_UNDERLINE_THICKNESS)
+ AtomError();
+ if (MakeAtom("STRIKEOUT_ASCENT", 16, 1) != XA_STRIKEOUT_ASCENT)
+ AtomError();
+ if (MakeAtom("STRIKEOUT_DESCENT", 17, 1) != XA_STRIKEOUT_DESCENT)
+ AtomError();
+ if (MakeAtom("ITALIC_ANGLE", 12, 1) != XA_ITALIC_ANGLE)
+ AtomError();
+ if (MakeAtom("X_HEIGHT", 8, 1) != XA_X_HEIGHT)
+ AtomError();
+ if (MakeAtom("QUAD_WIDTH", 10, 1) != XA_QUAD_WIDTH)
+ AtomError();
+ if (MakeAtom("WEIGHT", 6, 1) != XA_WEIGHT)
+ AtomError();
+ if (MakeAtom("POINT_SIZE", 10, 1) != XA_POINT_SIZE)
+ AtomError();
+ if (MakeAtom("RESOLUTION", 10, 1) != XA_RESOLUTION)
+ AtomError();
+ if (MakeAtom("COPYRIGHT", 9, 1) != XA_COPYRIGHT)
+ AtomError();
+ if (MakeAtom("NOTICE", 6, 1) != XA_NOTICE)
+ AtomError();
+ if (MakeAtom("FONT_NAME", 9, 1) != XA_FONT_NAME)
+ AtomError();
+ if (MakeAtom("FAMILY_NAME", 11, 1) != XA_FAMILY_NAME)
+ AtomError();
+ if (MakeAtom("FULL_NAME", 9, 1) != XA_FULL_NAME)
+ AtomError();
+ if (MakeAtom("CAP_HEIGHT", 10, 1) != XA_CAP_HEIGHT)
+ AtomError();
+ if (MakeAtom("WM_CLASS", 8, 1) != XA_WM_CLASS)
+ AtomError();
+ if (MakeAtom("WM_TRANSIENT_FOR", 16, 1) != XA_WM_TRANSIENT_FOR)
+ AtomError();
}
diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c
index 9e0c5518c..223d547c5 100644
--- a/xorg-server/dix/inpututils.c
+++ b/xorg-server/dix/inpututils.c
@@ -48,15 +48,13 @@ check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out,
{
int i, ret;
- if (!dev || !dev->button)
- {
+ if (!dev || !dev->button) {
client->errorValue = (dev) ? dev->id : 0;
return BadDevice;
}
ret = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess);
- if (ret != Success)
- {
+ if (ret != Success) {
client->errorValue = dev->id;
return ret;
}
@@ -207,9 +205,9 @@ check_modmap_change_slave(ClientPtr client, DeviceIntPtr master,
* extended keyboard, ignore the whole remap request. */
for (j = 0;
j < XkbKeyNumSyms(slave_xkb, i) &&
- j < XkbKeyNumSyms(master_xkb, i);
- j++)
- if (XkbKeySymsPtr(slave_xkb, i)[j] != XkbKeySymsPtr(master_xkb, i)[j])
+ j < XkbKeyNumSyms(master_xkb, i); j++)
+ if (XkbKeySymsPtr(slave_xkb, i)[j] !=
+ XkbKeySymsPtr(master_xkb, i)[j])
return 0;
}
@@ -227,8 +225,9 @@ do_modmap_change(ClientPtr client, DeviceIntPtr dev, CARD8 *modmap)
}
/* Rebuild modmap (key -> mod) from map (mod -> key). */
-static int build_modmap_from_modkeymap(CARD8 *modmap, KeyCode *modkeymap,
- int max_keys_per_mod)
+static int
+build_modmap_from_modkeymap(CARD8 *modmap, KeyCode *modkeymap,
+ int max_keys_per_mod)
{
int i, len = max_keys_per_mod * 8;
@@ -276,7 +275,8 @@ change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *modkeymap,
do_modmap_change(client, tmp, modmap);
}
}
- else if (!IsFloating(dev) && GetMaster(dev, MASTER_KEYBOARD)->lastSlave == dev) {
+ else if (!IsFloating(dev) &&
+ GetMaster(dev, MASTER_KEYBOARD)->lastSlave == dev) {
/* If this fails, expect the results to be weird. */
if (check_modmap_change(client, dev->master, modmap))
do_modmap_change(client, dev->master, modmap);
@@ -285,8 +285,9 @@ change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *modkeymap,
return Success;
}
-int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
- KeyCode **modkeymap_out, int *max_keys_per_mod_out)
+int
+generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
+ KeyCode **modkeymap_out, int *max_keys_per_mod_out)
{
CARD8 keys_per_mod[8];
int max_keys_per_mod;
@@ -344,8 +345,8 @@ int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
* flexibility with the data. Drivers should be able to call realloc on the
* product string if needed and perform similar operations.
*/
-InputAttributes*
-DuplicateInputAttributes(InputAttributes *attrs)
+InputAttributes *
+DuplicateInputAttributes(InputAttributes * attrs)
{
InputAttributes *new_attr;
int ntags = 0;
@@ -370,20 +371,18 @@ DuplicateInputAttributes(InputAttributes *attrs)
new_attr->flags = attrs->flags;
- if ((tags = attrs->tags))
- {
- while(*tags++)
+ if ((tags = attrs->tags)) {
+ while (*tags++)
ntags++;
- new_attr->tags = calloc(ntags + 1, sizeof(char*));
+ new_attr->tags = calloc(ntags + 1, sizeof(char *));
if (!new_attr->tags)
goto unwind;
tags = attrs->tags;
new_tags = new_attr->tags;
- while(*tags)
- {
+ while (*tags) {
*new_tags = strdup(*tags);
if (!*new_tags)
goto unwind;
@@ -395,13 +394,13 @@ DuplicateInputAttributes(InputAttributes *attrs)
return new_attr;
-unwind:
+ unwind:
FreeInputAttributes(new_attr);
return NULL;
}
void
-FreeInputAttributes(InputAttributes *attrs)
+FreeInputAttributes(InputAttributes * attrs)
{
char **tags;
@@ -415,7 +414,7 @@ FreeInputAttributes(InputAttributes *attrs)
free(attrs->usb_id);
if ((tags = attrs->tags))
- while(*tags)
+ while (*tags)
free(*tags++);
free(attrs->tags);
@@ -425,13 +424,14 @@ FreeInputAttributes(InputAttributes *attrs)
/**
* Alloc a valuator mask large enough for num_valuators.
*/
-ValuatorMask*
+ValuatorMask *
valuator_mask_new(int num_valuators)
{
/* alloc a fixed size mask for now and ignore num_valuators. in the
* flying-car future, when we can dynamically alloc the masks and are
* not constrained by signals, we can start using num_valuators */
ValuatorMask *mask = calloc(1, sizeof(ValuatorMask));
+
if (mask == NULL)
return NULL;
@@ -446,20 +446,20 @@ valuator_mask_free(ValuatorMask **mask)
*mask = NULL;
}
-
/**
* Sets a range of valuators between first_valuator and num_valuators with
* the data in the valuators array. All other values are set to 0.
*/
void
-valuator_mask_set_range(ValuatorMask *mask, int first_valuator, int num_valuators,
- const int* valuators)
+valuator_mask_set_range(ValuatorMask *mask, int first_valuator,
+ int num_valuators, const int *valuators)
{
int i;
valuator_mask_zero(mask);
- for (i = first_valuator; i < min(first_valuator + num_valuators, MAX_VALUATORS); i++)
+ for (i = first_valuator;
+ i < min(first_valuator + num_valuators, MAX_VALUATORS); i++)
valuator_mask_set(mask, i, valuators[i - first_valuator]);
}
@@ -550,13 +550,14 @@ valuator_mask_get(const ValuatorMask *mask, int valuator)
* FALSE is returned.
*/
Bool
-valuator_mask_fetch_double(const ValuatorMask *mask, int valuator, double *value)
+valuator_mask_fetch_double(const ValuatorMask *mask, int valuator,
+ double *value)
{
- if (valuator_mask_isset(mask, valuator))
- {
+ if (valuator_mask_isset(mask, valuator)) {
*value = valuator_mask_get_double(mask, valuator);
return TRUE;
- } else
+ }
+ else
return FALSE;
}
@@ -570,11 +571,11 @@ valuator_mask_fetch_double(const ValuatorMask *mask, int valuator, double *value
Bool
valuator_mask_fetch(const ValuatorMask *mask, int valuator, int *value)
{
- if (valuator_mask_isset(mask, valuator))
- {
+ if (valuator_mask_isset(mask, valuator)) {
*value = valuator_mask_get(mask, valuator);
return TRUE;
- } else
+ }
+ else
return FALSE;
}
@@ -607,7 +608,7 @@ valuator_mask_copy(ValuatorMask *dest, const ValuatorMask *src)
}
int
-CountBits(const uint8_t *mask, int len)
+CountBits(const uint8_t * mask, int len)
{
int i;
int ret = 0;
@@ -624,17 +625,16 @@ CountBits(const uint8_t *mask, int len)
* memdumps the first 32 bytes of event to the log, a backtrace, then kill
* the server.
*/
-void verify_internal_event(const InternalEvent *ev)
+void
+verify_internal_event(const InternalEvent *ev)
{
- if (ev && ev->any.header != ET_Internal)
- {
+ if (ev && ev->any.header != ET_Internal) {
int i;
- const unsigned char *data = (const unsigned char*)ev;
+ const unsigned char *data = (const unsigned char *) ev;
ErrorF("dix: invalid event type %d\n", ev->any.header);
- for (i = 0; i < sizeof(xEvent); i++, data++)
- {
+ for (i = 0; i < sizeof(xEvent); i++, data++) {
ErrorF("%02hhx ", *data);
if ((i % 8) == 7)
@@ -650,7 +650,8 @@ void verify_internal_event(const InternalEvent *ev)
* Initializes the given event to zero (or default values), for the given
* device.
*/
-void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms)
+void
+init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms)
{
memset(event, 0, sizeof(DeviceEvent));
event->header = ET_Internal;
@@ -660,18 +661,23 @@ void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms)
event->sourceid = dev->id;
}
-int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd)
+int
+event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd)
{
int corestate;
+
/* core state needs to be assembled BEFORE the device is updated. */
- corestate = (kbd && kbd->key) ? XkbStateFieldFromRec(&kbd->key->xkbInfo->state) : 0;
+ corestate = (kbd &&
+ kbd->key) ? XkbStateFieldFromRec(&kbd->key->xkbInfo->
+ state) : 0;
corestate |= (mouse && mouse->button) ? (mouse->button->state) : 0;
corestate |= (mouse && mouse->touch) ? (mouse->touch->state) : 0;
return corestate;
}
-void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event)
+void
+event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event)
{
int i;
@@ -682,9 +688,9 @@ void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event)
if (mouse && mouse->touch && mouse->touch->buttonsDown > 0)
SetBit(event->buttons, mouse->button->map[1]);
- if (kbd && kbd->key)
- {
+ if (kbd && kbd->key) {
XkbStatePtr state;
+
/* we need the state before the event happens */
if (event->type == ET_KeyPress || event->type == ET_KeyRelease)
state = &kbd->key->xkbInfo->prev_state;
@@ -727,7 +733,7 @@ Bool
point_on_screen(ScreenPtr pScreen, int x, int y)
{
return x >= pScreen->x && x < pScreen->x + pScreen->width &&
- y >= pScreen->y && y < pScreen->y + pScreen->height;
+ y >= pScreen->y && y < pScreen->y + pScreen->height;
}
/**
@@ -737,11 +743,12 @@ void
update_desktop_dimensions(void)
{
int i;
- int x1 = INT_MAX, y1 = INT_MAX; /* top-left */
- int x2 = INT_MIN, y2 = INT_MIN; /* bottom-right */
+ int x1 = INT_MAX, y1 = INT_MAX; /* top-left */
+ int x2 = INT_MIN, y2 = INT_MIN; /* bottom-right */
for (i = 0; i < screenInfo.numScreens; i++) {
ScreenPtr screen = screenInfo.screens[i];
+
x1 = min(x1, screen->x);
y1 = min(y1, screen->y);
x2 = max(x2, screen->x + screen->width);
@@ -783,20 +790,17 @@ input_option_free(InputOption *o)
* is NULL, a new option list with one element. On failure, NULL is
* returned.
*/
-InputOption*
-input_option_new(InputOption* list, const char *key, const char *value)
+InputOption *
+input_option_new(InputOption *list, const char *key, const char *value)
{
InputOption *opt = NULL;
if (!key)
return NULL;
- if (list)
- {
- nt_list_for_each_entry(opt, list, list.next)
- {
- if (strcmp(input_option_get_key(opt), key) == 0)
- {
+ if (list) {
+ nt_list_for_each_entry(opt, list, list.next) {
+ if (strcmp(input_option_get_key(opt), key) == 0) {
input_option_set_value(opt, value);
return list;
}
@@ -811,15 +815,16 @@ input_option_new(InputOption* list, const char *key, const char *value)
input_option_set_key(opt, key);
input_option_set_value(opt, value);
- if (list)
- {
+ if (list) {
nt_list_append(opt, list, InputOption, list.next);
+
return list;
- } else
+ }
+ else
return opt;
}
-InputOption*
+InputOption *
input_option_free_element(InputOption *list, const char *key)
{
InputOption *element;
@@ -827,6 +832,7 @@ input_option_free_element(InputOption *list, const char *key)
nt_list_for_each_entry(element, list, list.next) {
if (strcmp(input_option_get_key(element), key) == 0) {
nt_list_del(element, list, InputOption, list.next);
+
input_option_free(element);
break;
}
@@ -844,18 +850,18 @@ input_option_free_list(InputOption **opt)
nt_list_for_each_entry_safe(element, tmp, *opt, list.next) {
nt_list_del(element, *opt, InputOption, list.next);
+
input_option_free(element);
}
*opt = NULL;
}
-
/**
* Find the InputOption with the given option name.
*
* @return The InputOption or NULL if not present.
*/
-InputOption*
+InputOption *
input_option_find(InputOption *list, const char *key)
{
InputOption *element;
@@ -868,13 +874,13 @@ input_option_find(InputOption *list, const char *key)
return NULL;
}
-const char*
+const char *
input_option_get_key(const InputOption *opt)
{
return opt->opt_name;
}
-const char*
+const char *
input_option_get_value(const InputOption *opt)
{
return opt->opt_val;
@@ -896,7 +902,6 @@ input_option_set_value(InputOption *opt, const char *value)
opt->opt_val = strdup(value);
}
-
/* FP1616/FP3232 conversion functions.
* Fixed point types are encoded as signed integral and unsigned frac. So any
* negative number -n.m is encoded as floor(n) + (1 - 0.m).
@@ -906,8 +911,8 @@ fp1616_to_double(FP1616 in)
{
double ret;
- ret = (double)(in >> 16);
- ret += (double)(in & 0xffff) * (1.0 / (1UL << 16)); /* Optimized: ldexp((double)(in & 0xffff), -16); */
+ ret = (double) (in >> 16);
+ ret += (double) (in & 0xffff) * (1.0 / (1UL << 16)); /* Optimized: ldexp((double)(in & 0xffff), -16); */
return ret;
}
@@ -915,12 +920,12 @@ double
fp3232_to_double(FP3232 in)
{
double ret;
- ret = (double)in.integral;
- ret += (double)in.frac * (1.0 / (1ULL << 32)); /* Optimized: ldexp((double)in.frac, -32); */
+
+ ret = (double) in.integral;
+ ret += (double) in.frac * (1.0 / (1ULL << 32)); /* Optimized: ldexp((double)in.frac, -32); */
return ret;
}
-
FP1616
double_to_fp1616(double in)
{
@@ -930,10 +935,10 @@ double_to_fp1616(double in)
uint32_t frac_d;
tmp = floor(in);
- integral = (int32_t)tmp;
+ integral = (int32_t) tmp;
- tmp = (in - integral) * (1UL << 16); /* Optimized: ldexp(in - integral, 16) */
- frac_d = (uint16_t)tmp;
+ tmp = (in - integral) * (1UL << 16); /* Optimized: ldexp(in - integral, 16) */
+ frac_d = (uint16_t) tmp;
ret = integral << 16;
ret |= frac_d & 0xffff;
@@ -949,10 +954,10 @@ double_to_fp3232(double in)
uint32_t frac_d;
tmp = floor(in);
- integral = (int32_t)tmp;
+ integral = (int32_t) tmp;
- tmp = (in - integral) * (1ULL << 32); /* Optimized: ldexp(in - integral, 32) */
- frac_d = (uint32_t)tmp;
+ tmp = (in - integral) * (1ULL << 32); /* Optimized: ldexp(in - integral, 32) */
+ frac_d = (uint32_t) tmp;
ret.integral = integral;
ret.frac = frac_d;
@@ -967,16 +972,16 @@ double_to_fp3232(double in)
* @param size The size of the masks in bytes
* @return The new mask or NULL on allocation error.
*/
-XI2Mask*
+XI2Mask *
xi2mask_new_with_size(size_t nmasks, size_t size)
{
int i;
XI2Mask *mask = calloc(1, sizeof(*mask));
+
if (!mask)
return NULL;
-
mask->nmasks = nmasks;
mask->mask_size = size;
@@ -991,19 +996,18 @@ xi2mask_new_with_size(size_t nmasks, size_t size)
}
return mask;
-unwind:
+ unwind:
xi2mask_free(&mask);
return NULL;
}
-
/**
* Create a new XI2 mask of the standard size, i.e. for all devices + fake
* devices and for the highest supported XI2 event type.
*
* @return The new mask or NULL on allocation error.
*/
-XI2Mask*
+XI2Mask *
xi2mask_new(void)
{
return xi2mask_new_with_size(EMASKSIZE, XI2MASKSIZE);
@@ -1013,7 +1017,7 @@ xi2mask_new(void)
* Frees memory associated with mask and resets mask to NULL.
*/
void
-xi2mask_free(XI2Mask** mask)
+xi2mask_free(XI2Mask **mask)
{
int i;
@@ -1034,7 +1038,7 @@ xi2mask_free(XI2Mask** mask)
* @return TRUE if the bit is set, FALSE otherwise
*/
Bool
-xi2mask_isset(XI2Mask* mask, const DeviceIntPtr dev, int event_type)
+xi2mask_isset(XI2Mask *mask, const DeviceIntPtr dev, int event_type)
{
int set = 0;
@@ -1042,11 +1046,11 @@ xi2mask_isset(XI2Mask* mask, const DeviceIntPtr dev, int event_type)
BUG_WARN(dev->id >= mask->nmasks);
BUG_WARN(bits_to_bytes(event_type + 1) > mask->mask_size);
- set = !!BitIsOn(mask->masks[XIAllDevices], event_type);
+ set = ! !BitIsOn(mask->masks[XIAllDevices], event_type);
if (!set)
- set = !!BitIsOn(mask->masks[dev->id], event_type);
+ set = ! !BitIsOn(mask->masks[dev->id], event_type);
if (!set && IsMaster(dev))
- set = !!BitIsOn(mask->masks[XIAllMasterDevices], event_type);
+ set = ! !BitIsOn(mask->masks[XIAllMasterDevices], event_type);
return set;
}
@@ -1120,7 +1124,8 @@ xi2mask_mask_size(const XI2Mask *mask)
* parts are copied.
*/
void
-xi2mask_set_one_mask(XI2Mask *xi2mask, int deviceid, const unsigned char *mask, size_t mask_size)
+xi2mask_set_one_mask(XI2Mask *xi2mask, int deviceid, const unsigned char *mask,
+ size_t mask_size)
{
BUG_WARN(deviceid < 0);
BUG_WARN(deviceid >= xi2mask->nmasks);
@@ -1131,7 +1136,7 @@ xi2mask_set_one_mask(XI2Mask *xi2mask, int deviceid, const unsigned char *mask,
/**
* Get a reference to the XI2mask for this particular device.
*/
-const unsigned char*
+const unsigned char *
xi2mask_get_one_mask(const XI2Mask *mask, int deviceid)
{
BUG_WARN(deviceid < 0);
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index 7a5a34c33..b6a9a4e1c 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -80,7 +79,7 @@ Equipment Corporation.
#endif
#include <X11/X.h>
-#include <X11/Xos.h> /* for unistd.h */
+#include <X11/Xos.h> /* for unistd.h */
#include <X11/Xproto.h>
#include <pixman.h>
#include "scrnintstr.h"
@@ -108,7 +107,7 @@ Equipment Corporation.
#ifdef PANORAMIX
#include "panoramiXsrv.h"
#else
-#include "dixevents.h" /* InitEvents() */
+#include "dixevents.h" /* InitEvents() */
#endif
#ifdef DPMSExtension
@@ -131,13 +130,15 @@ pthread_cond_t serverRunningCond = PTHREAD_COND_INITIALIZER;
int dix_main(int argc, char *argv[], char *envp[]);
-int dix_main(int argc, char *argv[], char *envp[])
+int
+dix_main(int argc, char *argv[], char *envp[])
#else
-int main(int argc, char *argv[], char *envp[])
+int
+main(int argc, char *argv[], char *envp[])
#endif
{
- int i;
- HWEventQueueType alwaysCheckForInput[2];
+ int i;
+ HWEventQueueType alwaysCheckForInput[2];
#ifdef _DEBUG
//int TmpFlag=_CrtSetDbgFlag( _CRTDBG_REPORT_FLAG);
@@ -193,216 +194,213 @@ int main(int argc, char *argv[], char *envp[])
alwaysCheckForInput[0] = 0;
alwaysCheckForInput[1] = 1;
- while(1)
- {
- serverGeneration++;
- ScreenSaverTime = defaultScreenSaverTime;
- ScreenSaverInterval = defaultScreenSaverInterval;
- ScreenSaverBlanking = defaultScreenSaverBlanking;
- ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
+ while (1) {
+ serverGeneration++;
+ ScreenSaverTime = defaultScreenSaverTime;
+ ScreenSaverInterval = defaultScreenSaverInterval;
+ ScreenSaverBlanking = defaultScreenSaverBlanking;
+ ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
#ifdef DPMSExtension
- DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
- DPMSEnabled = TRUE;
- DPMSPowerLevel = 0;
+ DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
+ DPMSEnabled = TRUE;
+ DPMSPowerLevel = 0;
#endif
- InitBlockAndWakeupHandlers();
- /* Perform any operating system dependent initializations you'd like */
- OsInit();
- if(serverGeneration == 1)
- {
- CreateWellKnownSockets();
- for (i=1; i<MAXCLIENTS; i++)
- clients[i] = NullClient;
- serverClient = calloc(sizeof(ClientRec), 1);
- if (!serverClient)
- FatalError("couldn't create server client");
- InitClient(serverClient, 0, (pointer)NULL);
- }
- else
- ResetWellKnownSockets ();
- clients[0] = serverClient;
- currentMaxClients = 1;
-
- /* Initialize privates before first allocation */
- dixResetPrivates();
-
- /* Initialize server client devPrivates, to be reallocated as
- * more client privates are registered
- */
- if (!dixAllocatePrivates(&serverClient->devPrivates, PRIVATE_CLIENT))
- FatalError("failed to create server client privates");
-
- if (!InitClientResources(serverClient)) /* for root resources */
- FatalError("couldn't init server resources");
-
- SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
- screenInfo.numScreens = 0;
-
- InitAtoms();
- InitEvents();
- InitSelections();
- InitGlyphCaching();
- dixResetRegistry();
- ResetFontPrivateIndex();
- InitCallbackManager();
- InitOutput(&screenInfo, argc, argv);
-
- if (screenInfo.numScreens < 1)
- FatalError("no screens found");
- InitExtensions(argc, argv);
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen = screenInfo.screens[i];
- if (!CreateScratchPixmapsForScreen(i))
- FatalError("failed to create scratch pixmaps");
- if (pScreen->CreateScreenResources &&
- !(*pScreen->CreateScreenResources)(pScreen))
- FatalError("failed to create screen resources");
- if (!CreateGCperDepth(i))
- FatalError("failed to create scratch GCs");
- if (!CreateDefaultStipple(i))
- FatalError("failed to create default stipple");
- if (!CreateRootWindow(pScreen))
- FatalError("failed to create root window");
- }
-
- InitFonts();
- if (SetDefaultFontPath(defaultFontPath) != Success) {
- ErrorF("[dix] failed to set default font path '%s'", defaultFontPath);
- }
- if (!SetDefaultFont(defaultTextFont)) {
- FatalError("could not open default font '%s'", defaultTextFont);
- }
-
- if (!(rootCursor = CreateRootCursor(NULL, 0))) {
- FatalError("could not open default cursor font '%s'",
- defaultCursorFont);
- }
+ InitBlockAndWakeupHandlers();
+ /* Perform any operating system dependent initializations you'd like */
+ OsInit();
+ if (serverGeneration == 1) {
+ CreateWellKnownSockets();
+ for (i = 1; i < MAXCLIENTS; i++)
+ clients[i] = NullClient;
+ serverClient = calloc(sizeof(ClientRec), 1);
+ if (!serverClient)
+ FatalError("couldn't create server client");
+ InitClient(serverClient, 0, (pointer) NULL);
+ }
+ else
+ ResetWellKnownSockets();
+ clients[0] = serverClient;
+ currentMaxClients = 1;
+
+ /* Initialize privates before first allocation */
+ dixResetPrivates();
+
+ /* Initialize server client devPrivates, to be reallocated as
+ * more client privates are registered
+ */
+ if (!dixAllocatePrivates(&serverClient->devPrivates, PRIVATE_CLIENT))
+ FatalError("failed to create server client privates");
+
+ if (!InitClientResources(serverClient)) /* for root resources */
+ FatalError("couldn't init server resources");
+
+ SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
+ screenInfo.numScreens = 0;
+
+ InitAtoms();
+ InitEvents();
+ InitSelections();
+ InitGlyphCaching();
+ dixResetRegistry();
+ ResetFontPrivateIndex();
+ InitCallbackManager();
+ InitOutput(&screenInfo, argc, argv);
+
+ if (screenInfo.numScreens < 1)
+ FatalError("no screens found");
+ InitExtensions(argc, argv);
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ if (!CreateScratchPixmapsForScreen(i))
+ FatalError("failed to create scratch pixmaps");
+ if (pScreen->CreateScreenResources &&
+ !(*pScreen->CreateScreenResources) (pScreen))
+ FatalError("failed to create screen resources");
+ if (!CreateGCperDepth(i))
+ FatalError("failed to create scratch GCs");
+ if (!CreateDefaultStipple(i))
+ FatalError("failed to create default stipple");
+ if (!CreateRootWindow(pScreen))
+ FatalError("failed to create root window");
+ }
+
+ InitFonts();
+ if (SetDefaultFontPath(defaultFontPath) != Success) {
+ ErrorF("[dix] failed to set default font path '%s'",
+ defaultFontPath);
+ }
+ if (!SetDefaultFont(defaultTextFont)) {
+ FatalError("could not open default font '%s'", defaultTextFont);
+ }
+
+ if (!(rootCursor = CreateRootCursor(NULL, 0))) {
+ FatalError("could not open default cursor font '%s'",
+ defaultCursorFont);
+ }
#ifdef DPMSExtension
- /* check all screens, looking for DPMS Capabilities */
- DPMSCapableFlag = DPMSSupported();
- if (!DPMSCapableFlag)
- DPMSEnabled = FALSE;
+ /* check all screens, looking for DPMS Capabilities */
+ DPMSCapableFlag = DPMSSupported();
+ if (!DPMSCapableFlag)
+ DPMSEnabled = FALSE;
#endif
#ifdef PANORAMIX
- /*
- * Consolidate window and colourmap information for each screen
- */
- if (!noPanoramiXExtension)
- PanoramiXConsolidate();
+ /*
+ * Consolidate window and colourmap information for each screen
+ */
+ if (!noPanoramiXExtension)
+ PanoramiXConsolidate();
#endif
- for (i = 0; i < screenInfo.numScreens; i++)
- InitRootWindow(screenInfo.screens[i]->root);
+ for (i = 0; i < screenInfo.numScreens; i++)
+ InitRootWindow(screenInfo.screens[i]->root);
InitCoreDevices();
- InitInput(argc, argv);
- InitAndStartDevices();
- ReserveClientIds(serverClient);
+ InitInput(argc, argv);
+ InitAndStartDevices();
+ ReserveClientIds(serverClient);
- dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- if (!PanoramiXCreateConnectionBlock()) {
- FatalError("could not create connection block info");
- }
- } else
+ if (!noPanoramiXExtension) {
+ if (!PanoramiXCreateConnectionBlock()) {
+ FatalError("could not create connection block info");
+ }
+ }
+ else
#endif
- {
- if (!CreateConnectionBlock()) {
- FatalError("could not create connection block info");
- }
- }
+ {
+ if (!CreateConnectionBlock()) {
+ FatalError("could not create connection block info");
+ }
+ }
#ifdef XQUARTZ
- /* Let the other threads know the server is done with its init */
- pthread_mutex_lock(&serverRunningMutex);
- serverRunning = TRUE;
- pthread_cond_broadcast(&serverRunningCond);
- pthread_mutex_unlock(&serverRunningMutex);
+ /* Let the other threads know the server is done with its init */
+ pthread_mutex_lock(&serverRunningMutex);
+ serverRunning = TRUE;
+ pthread_cond_broadcast(&serverRunningCond);
+ pthread_mutex_unlock(&serverRunningMutex);
#endif
-
- NotifyParentProcess();
+
+ NotifyParentProcess();
#ifdef _MSC_VER
// initialise here because doing it in InitInput failes because keyboard device is not started yet then
winInitializeModeKeyStates ();
#endif
- Dispatch();
+ Dispatch();
#ifdef XQUARTZ
- /* Let the other threads know the server is no longer running */
- pthread_mutex_lock(&serverRunningMutex);
- serverRunning = FALSE;
- pthread_mutex_unlock(&serverRunningMutex);
+ /* Let the other threads know the server is no longer running */
+ pthread_mutex_lock(&serverRunningMutex);
+ serverRunning = FALSE;
+ pthread_mutex_unlock(&serverRunningMutex);
#endif
- UndisplayDevices();
+ UndisplayDevices();
- /* Now free up whatever must be freed */
- if (screenIsSaved == SCREEN_SAVER_ON)
- dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
- FreeScreenSaverTimer();
- CloseDownExtensions();
+ /* Now free up whatever must be freed */
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
+ FreeScreenSaverTimer();
+ CloseDownExtensions();
#ifdef PANORAMIX
- {
- Bool remember_it = noPanoramiXExtension;
- noPanoramiXExtension = TRUE;
- FreeAllResources();
- noPanoramiXExtension = remember_it;
- }
+ {
+ Bool remember_it = noPanoramiXExtension;
+
+ noPanoramiXExtension = TRUE;
+ FreeAllResources();
+ noPanoramiXExtension = remember_it;
+ }
#else
- FreeAllResources();
+ FreeAllResources();
#endif
CloseInput();
- for (i = 0; i < screenInfo.numScreens; i++)
- screenInfo.screens[i]->root = NullWindow;
- CloseDownDevices();
- CloseDownEvents();
-
- for (i = screenInfo.numScreens - 1; i >= 0; i--)
- {
- FreeScratchPixmapsForScreen(i);
- FreeGCperDepth(i);
- FreeDefaultStipple(i);
- (* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]);
- dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
- free(screenInfo.screens[i]);
- screenInfo.numScreens = i;
- }
-
- ReleaseClientIds(serverClient);
- dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
- serverClient->devPrivates = NULL;
-
- FreeFonts();
-
- FreeAuditTimer();
-
- if (dispatchException & DE_TERMINATE)
- {
- CloseWellKnownConnections();
- }
-
- OsCleanup((dispatchException & DE_TERMINATE) != 0);
-
- if (dispatchException & DE_TERMINATE)
- {
- ddxGiveUp(EXIT_NO_ERROR);
- break;
- }
-
- free(ConnectionInfo);
- ConnectionInfo = NULL;
+ for (i = 0; i < screenInfo.numScreens; i++)
+ screenInfo.screens[i]->root = NullWindow;
+ CloseDownDevices();
+ CloseDownEvents();
+
+ for (i = screenInfo.numScreens - 1; i >= 0; i--) {
+ FreeScratchPixmapsForScreen(i);
+ FreeGCperDepth(i);
+ FreeDefaultStipple(i);
+ (*screenInfo.screens[i]->CloseScreen) (i, screenInfo.screens[i]);
+ dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
+ free(screenInfo.screens[i]);
+ screenInfo.numScreens = i;
+ }
+
+ ReleaseClientIds(serverClient);
+ dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
+ serverClient->devPrivates = NULL;
+
+ FreeFonts();
+
+ FreeAuditTimer();
+
+ if (dispatchException & DE_TERMINATE) {
+ CloseWellKnownConnections();
+ }
+
+ OsCleanup((dispatchException & DE_TERMINATE) != 0);
+
+ if (dispatchException & DE_TERMINATE) {
+ ddxGiveUp(EXIT_NO_ERROR);
+ break;
+ }
+
+ free(ConnectionInfo);
+ ConnectionInfo = NULL;
}
return 0;
}
-
diff --git a/xorg-server/dix/makefile b/xorg-server/dix/makefile
index 031f94671..a7e9e3249 100644
--- a/xorg-server/dix/makefile
+++ b/xorg-server/dix/makefile
@@ -2,7 +2,7 @@ ifeq ($(DEBUG),1)
DEFINES += FONTDEBUG XSERVER_DTRACE
endif
-INCLUDES += ..\composite
+INCLUDES += ..\composite ..\miext\sync
LIBRARY=libdix
diff --git a/xorg-server/dix/pixmap.c b/xorg-server/dix/pixmap.c
index 3943f5582..47b220b58 100644
--- a/xorg-server/dix/pixmap.c
+++ b/xorg-server/dix/pixmap.c
@@ -1,137 +1,131 @@
-/*
-
-Copyright 1993, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "misc.h"
-#include "os.h"
-#include "windowstr.h"
-#include "resource.h"
-#include "dixstruct.h"
-#include "gcstruct.h"
-#include "servermd.h"
-#include "site.h"
-
-
-/*
- * Scratch pixmap management and device independent pixmap allocation
- * function.
- */
-
-
-/* callable by ddx */
-PixmapPtr
-GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData)
-{
- PixmapPtr pPixmap = pScreen->pScratchPixmap;
-
- if (pPixmap)
- pScreen->pScratchPixmap = NULL;
- else
- /* width and height of 0 means don't allocate any pixmap data */
- pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0);
-
- if (pPixmap) {
- if ((*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData))
- return pPixmap;
- (*pScreen->DestroyPixmap)(pPixmap);
- }
- return NullPixmap;
-}
-
-
-/* callable by ddx */
-void
-FreeScratchPixmapHeader(PixmapPtr pPixmap)
-{
- if (pPixmap)
- {
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
-
- pPixmap->devPrivate.ptr = NULL; /* lest ddx chases bad ptr */
- if (pScreen->pScratchPixmap)
- (*pScreen->DestroyPixmap)(pPixmap);
- else
- pScreen->pScratchPixmap = pPixmap;
- }
-}
-
-
-Bool
-CreateScratchPixmapsForScreen(int scrnum)
-{
- unsigned int pixmap_size;
-
- pixmap_size = sizeof(PixmapRec) + dixPrivatesSize(PRIVATE_PIXMAP);
- screenInfo.screens[scrnum]->totalPixmapSize = BitmapBytePad(pixmap_size * 8);
-
- /* let it be created on first use */
- screenInfo.screens[scrnum]->pScratchPixmap = NULL;
- return TRUE;
-}
-
-
-void
-FreeScratchPixmapsForScreen(int scrnum)
-{
- FreeScratchPixmapHeader(screenInfo.screens[scrnum]->pScratchPixmap);
-}
-
-
-/* callable by ddx */
-PixmapPtr
-AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
-{
- PixmapPtr pPixmap;
-
- assert(pScreen->totalPixmapSize > 0);
-
- if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize)
- return NullPixmap;
-
- pPixmap = malloc(pScreen->totalPixmapSize + pixDataSize);
- if (!pPixmap)
- return NullPixmap;
-
- dixInitPrivates(pPixmap, pPixmap + 1, PRIVATE_PIXMAP);
- return pPixmap;
-}
-
-/* callable by ddx */
-void
-FreePixmap(PixmapPtr pPixmap)
-{
- dixFiniPrivates(pPixmap, PRIVATE_PIXMAP);
- free(pPixmap);
-}
+/*
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "misc.h"
+#include "os.h"
+#include "windowstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+#include "gcstruct.h"
+#include "servermd.h"
+#include "site.h"
+
+/*
+ * Scratch pixmap management and device independent pixmap allocation
+ * function.
+ */
+
+/* callable by ddx */
+PixmapPtr
+GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
+{
+ PixmapPtr pPixmap = pScreen->pScratchPixmap;
+
+ if (pPixmap)
+ pScreen->pScratchPixmap = NULL;
+ else
+ /* width and height of 0 means don't allocate any pixmap data */
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, 0);
+
+ if (pPixmap) {
+ if ((*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth,
+ bitsPerPixel, devKind, pPixData))
+ return pPixmap;
+ (*pScreen->DestroyPixmap) (pPixmap);
+ }
+ return NullPixmap;
+}
+
+/* callable by ddx */
+void
+FreeScratchPixmapHeader(PixmapPtr pPixmap)
+{
+ if (pPixmap) {
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
+ pPixmap->devPrivate.ptr = NULL; /* lest ddx chases bad ptr */
+ if (pScreen->pScratchPixmap)
+ (*pScreen->DestroyPixmap) (pPixmap);
+ else
+ pScreen->pScratchPixmap = pPixmap;
+ }
+}
+
+Bool
+CreateScratchPixmapsForScreen(int scrnum)
+{
+ unsigned int pixmap_size;
+
+ pixmap_size = sizeof(PixmapRec) + dixPrivatesSize(PRIVATE_PIXMAP);
+ screenInfo.screens[scrnum]->totalPixmapSize =
+ BitmapBytePad(pixmap_size * 8);
+
+ /* let it be created on first use */
+ screenInfo.screens[scrnum]->pScratchPixmap = NULL;
+ return TRUE;
+}
+
+void
+FreeScratchPixmapsForScreen(int scrnum)
+{
+ FreeScratchPixmapHeader(screenInfo.screens[scrnum]->pScratchPixmap);
+}
+
+/* callable by ddx */
+PixmapPtr
+AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
+{
+ PixmapPtr pPixmap;
+
+ assert(pScreen->totalPixmapSize > 0);
+
+ if (pScreen->totalPixmapSize > ((size_t) - 1) - pixDataSize)
+ return NullPixmap;
+
+ pPixmap = malloc(pScreen->totalPixmapSize + pixDataSize);
+ if (!pPixmap)
+ return NullPixmap;
+
+ dixInitPrivates(pPixmap, pPixmap + 1, PRIVATE_PIXMAP);
+ return pPixmap;
+}
+
+/* callable by ddx */
+void
+FreePixmap(PixmapPtr pPixmap)
+{
+ dixFiniPrivates(pPixmap, PRIVATE_PIXMAP);
+ free(pPixmap);
+}
diff --git a/xorg-server/dix/privates.c b/xorg-server/dix/privates.c
index d261f6895..21faf5b94 100644
--- a/xorg-server/dix/privates.c
+++ b/xorg-server/dix/privates.c
@@ -1,521 +1,537 @@
-/*
-
-Copyright 1993, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-/*
- * Copyright © 2010, Keith Packard
- * Copyright © 2010, Jamey Sharp
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stddef.h>
-#include "windowstr.h"
-#include "resource.h"
-#include "privates.h"
-#include "gcstruct.h"
-#include "cursorstr.h"
-#include "colormapst.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "extnsionst.h"
-
-static struct {
- DevPrivateKey key;
- unsigned offset;
- int created;
- int allocated;
-} keys[PRIVATE_LAST];
-
-static const Bool xselinux_private[PRIVATE_LAST] = {
- /* PRIVATE_XSELINUX,*/ FALSE,
- /* PRIVATE_SCREEN,*/ TRUE,
- /* [PRIVATE_EXTENSION] =*/TRUE,
- /* [PRIVATE_COLORMAP] =*/ TRUE,
- /* [PRIVATE_DEVICE] =*/ TRUE,
- /* [PRIVATE_CLIENT] = */ TRUE,
- /* [PRIVATE_PROPERTY] =*/ TRUE,
- /* [PRIVATE_SELECTION] =*/TRUE,
- /* [PRIVATE_WINDOW] =*/ TRUE,
- /* [PRIVATE_PIXMAP] =*/ TRUE,
- /* [PRIVATE_GC] =*/ TRUE,
- /* [PRIVATE_CURSOR] =*/ TRUE,
- /* PRIVATE_CURSOR_BITS,*/ FALSE,
- /* PRIVATE_DBE_WINDOW,*/ FALSE,
- /* PRIVATE_DAMAGE,*/ FALSE,
- /* PRIVATE_GLYPH,*/ FALSE,
- /* [PRIVATE_GLYPHSET] =*/ TRUE,
- /* [PRIVATE_PICTURE] =*/ TRUE
-};
-
-typedef Bool (*FixupFunc)(PrivatePtr *privates, int offset, unsigned bytes);
-
-static Bool
-dixReallocPrivates(PrivatePtr *privates, int old_offset, unsigned bytes)
-{
- void *new_privates;
-
- new_privates = realloc(*privates, old_offset + bytes);
- if (!new_privates)
- return FALSE;
- memset((char *) new_privates + old_offset, '\0', bytes);
- *privates = new_privates;
- return TRUE;
-}
-
-static Bool
-dixMovePrivates(PrivatePtr *privates, int new_offset, unsigned bytes)
-{
- memmove((char *) *privates + bytes, *privates, new_offset - bytes);
- memset(*privates, '\0', bytes);
- return TRUE;
-}
-
-static Bool
-fixupScreens(FixupFunc fixup, unsigned bytes)
-{
- int s;
- for (s = 0; s < screenInfo.numScreens; s++)
- if (!fixup(&screenInfo.screens[s]->devPrivates, keys[PRIVATE_SCREEN].offset, bytes))
- return FALSE;
- return TRUE;
-}
-
-static Bool
-fixupServerClient(FixupFunc fixup, unsigned bytes)
-{
- if (serverClient)
- return fixup(&serverClient->devPrivates, keys[PRIVATE_CLIENT].offset, bytes);
- return TRUE;
-}
-
-static Bool
-fixupExtensions(FixupFunc fixup, unsigned bytes)
-{
- unsigned char major;
- ExtensionEntry *extension;
- for (major = EXTENSION_BASE; (extension = GetExtensionEntry(major)); major++)
- if (!fixup(&extension->devPrivates, keys[PRIVATE_EXTENSION].offset, bytes))
- return FALSE;
- return TRUE;
-}
-
-static Bool
-fixupDefaultColormaps(FixupFunc fixup, unsigned bytes)
-{
- int s;
- for (s = 0; s < screenInfo.numScreens; s++) {
- ColormapPtr cmap;
- dixLookupResourceByType((pointer *) &cmap, screenInfo.screens[s]->defColormap,
- RT_COLORMAP, serverClient, DixCreateAccess);
- if (cmap && !fixup(&cmap->devPrivates, keys[PRIVATE_COLORMAP].offset, bytes))
- return FALSE;
- }
- return TRUE;
-}
-
-static Bool (* const allocated_early[PRIVATE_LAST])(FixupFunc, unsigned) = {
- /*PRIVATE_XSELINUX,*/ NULL,
- /*[PRIVATE_SCREEN] =*/ fixupScreens,
- /*[PRIVATE_EXTENSION] =*/ fixupExtensions,
- /*[PRIVATE_COLORMAP] =*/ fixupDefaultColormaps,
- /*PRIVATE_DEVICE,*/ NULL,
- /*[PRIVATE_CLIENT] =*/ fixupServerClient,
- /*PRIVATE_PROPERTY,*/ NULL,
- /*PRIVATE_SELECTION,*/ NULL,
- /*PRIVATE_WINDOW,*/ NULL,
- /*PRIVATE_PIXMAP,*/ NULL,
- /*PRIVATE_GC,*/ NULL,
- /*PRIVATE_CURSOR,*/ NULL,
- /*PRIVATE_CURSOR_BITS,*/ NULL,
- /*PRIVATE_DBE_WINDOW,*/ NULL,
- /*PRIVATE_DAMAGE,*/ NULL,
- /*PRIVATE_GLYPH,*/ NULL,
- /*PRIVATE_GLYPHSET,*/ NULL,
- /*PRIVATE_PICTURE,*/ NULL
-};
-
-/*
- * Register a private key. This takes the type of object the key will
- * be used with, which may be PRIVATE_ALL indicating that this key
- * will be used with all of the private objects. If 'size' is
- * non-zero, then the specified amount of space will be allocated in
- * the private storage. Otherwise, space for a single pointer will
- * be allocated which can be set with dixSetPrivate
- */
-Bool
-dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size)
-{
- DevPrivateType t;
- int offset;
- unsigned bytes;
-
- if (key->initialized) {
- assert (size == key->size);
- return TRUE;
- }
-
- /* Compute required space */
- bytes = size;
- if (size == 0)
- bytes = sizeof (void *);
-
- /* align to void * size */
- bytes = (bytes + sizeof (void *) - 1) & ~(sizeof (void *) - 1);
-
- /* Update offsets for all affected keys */
- if (type == PRIVATE_XSELINUX) {
- DevPrivateKey k;
-
- /* Resize if we can, or make sure nothing's allocated if we can't
- */
- for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++)
- if (xselinux_private[t]) {
- if (!allocated_early[t])
- assert (!keys[t].created);
- else if (!allocated_early[t](dixReallocPrivates, bytes))
- return FALSE;
- }
-
- /* Move all existing keys up in the privates space to make
- * room for this new global key
- */
- for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++) {
- if (xselinux_private[t]) {
- for (k = keys[t].key; k; k = k->next)
- k->offset += bytes;
- keys[t].offset += bytes;
- if (allocated_early[t])
- allocated_early[t](dixMovePrivates, bytes);
- }
- }
-
- offset = 0;
- } else {
- /* Resize if we can, or make sure nothing's allocated if we can't */
- if (!allocated_early[type])
- assert(!keys[type].created);
- else if (!allocated_early[type](dixReallocPrivates, bytes))
- return FALSE;
- offset = keys[type].offset;
- keys[type].offset += bytes;
- }
-
- /* Setup this key */
- key->offset = offset;
- key->size = size;
- key->initialized = TRUE;
- key->type = type;
- key->allocated = FALSE;
- key->next = keys[type].key;
- keys[type].key = key;
-
- return TRUE;
-}
-
-Bool
-dixRegisterScreenPrivateKey(DevScreenPrivateKey screenKey, ScreenPtr pScreen, DevPrivateType type, unsigned size)
-{
- DevPrivateKey key;
-
- if (!dixRegisterPrivateKey(&screenKey->screenKey, PRIVATE_SCREEN, 0))
- return FALSE;
- key = dixGetPrivate(&pScreen->devPrivates, &screenKey->screenKey);
- if (key != NULL) {
- assert(key->size == size);
- assert(key->type == type);
- return TRUE;
- }
- key = calloc(sizeof (DevPrivateKeyRec), 1);
- if (!key)
- return FALSE;
- if (!dixRegisterPrivateKey(key, type, size)) {
- free(key);
- return FALSE;
- }
- key->allocated = TRUE;
- dixSetPrivate(&pScreen->devPrivates, &screenKey->screenKey, key);
- return TRUE;
-}
-
-DevPrivateKey
-_dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen)
-{
- return dixGetPrivate(&pScreen->devPrivates, &key->screenKey);
-}
-
-/*
- * Initialize privates by zeroing them
- */
-void
-_dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type)
-{
- keys[type].created++;
- if (xselinux_private[type])
- keys[PRIVATE_XSELINUX].created++;
- if (keys[type].offset == 0)
- addr = 0;
- *privates = addr;
- memset(addr, '\0', keys[type].offset);
-}
-
-/*
- * Clean up privates
- */
-void
-_dixFiniPrivates(PrivatePtr privates, DevPrivateType type)
-{
- keys[type].created--;
- if (xselinux_private[type])
- keys[PRIVATE_XSELINUX].created--;
-}
-
-/*
- * Allocate new object with privates.
- *
- * This is expected to be invoked from the
- * dixAllocateObjectWithPrivates macro
- */
-void *
-_dixAllocateObjectWithPrivates(unsigned baseSize, unsigned clear, unsigned offset, DevPrivateType type)
-{
- unsigned totalSize;
- void *object;
- PrivatePtr privates;
- PrivatePtr *devPrivates;
-
- assert (type > PRIVATE_SCREEN && type < PRIVATE_LAST);
-
- /* round up so that void * is aligned */
- baseSize = (baseSize + sizeof (void *) - 1) & ~(sizeof (void *) - 1);
- totalSize = baseSize + keys[type].offset;
- object = malloc(totalSize);
- if (!object)
- return NULL;
-
- memset(object, '\0', clear);
- privates = (PrivatePtr) (((char *) object) + baseSize);
- devPrivates = (PrivatePtr *) ((char *) object + offset);
-
- _dixInitPrivates(devPrivates, privates, type);
-
- return object;
-}
-
-/*
- * Allocate privates separately from containing object.
- * Used for clients and screens.
- */
-Bool
-dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type)
-{
- unsigned size;
- PrivatePtr p;
-
- assert (type > PRIVATE_XSELINUX && type < PRIVATE_LAST);
-
- size = keys[type].offset;
- if (!size) {
- p = NULL;
- } else {
- if (!(p = malloc(size)))
- return FALSE;
- }
-
- _dixInitPrivates(privates, p, type);
- ++keys[type].allocated;
-
- return TRUE;
-}
-
-/*
- * Free an object that has privates
- *
- * This is expected to be invoked from the
- * dixFreeObjectWithPrivates macro
- */
-void
-_dixFreeObjectWithPrivates(void *object, PrivatePtr privates, DevPrivateType type)
-{
- _dixFiniPrivates(privates, type);
- free(object);
-}
-
-/*
- * Called to free screen or client privates
- */
-void
-dixFreePrivates(PrivatePtr privates, DevPrivateType type)
-{
- _dixFiniPrivates(privates, type);
- --keys[type].allocated;
- free(privates);
-}
-
-/*
- * Return size of privates for the specified type
- */
-extern _X_EXPORT int
-dixPrivatesSize(DevPrivateType type)
-{
- assert (type >= PRIVATE_SCREEN && type < PRIVATE_LAST);
-
- return keys[type].offset;
-}
-
-/* Table of devPrivates offsets */
-static const int offsets[] = {
- -1, /* RT_NONE */
- offsetof(WindowRec, devPrivates), /* RT_WINDOW */
- offsetof(PixmapRec, devPrivates), /* RT_PIXMAP */
- offsetof(GC, devPrivates), /* RT_GC */
- -1, /* RT_FONT */
- offsetof(CursorRec, devPrivates), /* RT_CURSOR */
- offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */
-};
-
-#define NUM_OFFSETS (sizeof (offsets) / sizeof (offsets[0]))
-
-int
-dixLookupPrivateOffset(RESTYPE type)
-{
- /*
- * Special kludge for DBE which registers a new resource type that
- * points at pixmaps (thanks, DBE)
- */
- if (type & RC_DRAWABLE) {
- if (type == RT_WINDOW)
- return offsets[RT_WINDOW & TypeMask];
- else
- return offsets[RT_PIXMAP & TypeMask];
- }
- type = type & TypeMask;
- if (type < NUM_OFFSETS)
- return offsets[type];
- return -1;
-}
-
-static const char *key_names[PRIVATE_LAST] = {
- /* XSELinux uses the same private keys for numerous objects */
- /*[PRIVATE_XSELINUX] =*/ "XSELINUX",
-
- /* Otherwise, you get a private in just the requested structure
- */
- /* These can have objects created before all of the keys are registered */
- /*[PRIVATE_SCREEN] =*/ "SCREEN",
- /*[PRIVATE_EXTENSION] =*/ "EXTENSION",
- /*[PRIVATE_COLORMAP] =*/ "COLORMAP",
-
- /* These cannot have any objects before all relevant keys are registered */
- /*[PRIVATE_DEVICE] =*/ "DEVICE",
- /*[PRIVATE_CLIENT] =*/ "CLIENT",
- /*[PRIVATE_PROPERTY] =*/ "PROPERTY",
- /*[PRIVATE_SELECTION] =*/ "SELECTION",
- /*[PRIVATE_WINDOW] =*/ "WINDOW",
- /*[PRIVATE_PIXMAP] =*/ "PIXMAP",
- /*[PRIVATE_GC] =*/ "GC",
- /*[PRIVATE_CURSOR] =*/ "CURSOR",
- /*[PRIVATE_CURSOR_BITS] =*/ "CURSOR_BITS",
-
- /* extension privates */
- /*[PRIVATE_DBE_WINDOW] =*/ "DBE_WINDOW",
- /*[PRIVATE_DAMAGE] =*/ "DAMAGE",
- /*[PRIVATE_GLYPH] =*/ "GLYPH",
- /*[PRIVATE_GLYPHSET] =*/ "GLYPHSET",
- /*[PRIVATE_PICTURE] =*/ "PICTURE" ,
- /*[PRIVATE_SYNC_FENCE] =*/ "SYNC_FENCE"
-};
-
-void
-dixPrivateUsage(void)
-{
- int objects = 0;
- int bytes = 0;
- int alloc = 0;
- DevPrivateType t;
-
- for (t = PRIVATE_XSELINUX + 1; t < PRIVATE_LAST; t++) {
- if (keys[t].offset) {
- ErrorF("%s: %d objects of %d bytes = %d total bytes %d private allocs\n",
- key_names[t], keys[t].created, keys[t].offset, keys[t].created * keys[t].offset,
- keys[t].allocated);
- bytes += keys[t].created * keys[t].offset;
- objects += keys[t].created;
- alloc += keys[t].allocated;
- }
- }
- ErrorF("TOTAL: %d objects, %d bytes, %d allocs\n",
- objects, bytes, alloc);
-}
-
-void
-dixResetPrivates(void)
-{
- DevPrivateType t;
-
- for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++) {
- DevPrivateKey key, next;
-
- for (key = keys[t].key; key; key = next) {
- next = key->next;
- key->offset = 0;
- key->initialized = FALSE;
- key->size = 0;
- key->type = 0;
- if (key->allocated)
- free(key);
- }
- if (keys[t].created) {
- ErrorF("%d %ss still allocated at reset\n",
- keys[t].created, key_names[t]);
- dixPrivateUsage();
- }
- keys[t].key = NULL;
- keys[t].offset = 0;
- keys[t].created = 0;
- keys[t].allocated = 0;
- }
-}
+/*
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/*
+ * Copyright © 2010, Keith Packard
+ * Copyright © 2010, Jamey Sharp
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stddef.h>
+#include "windowstr.h"
+#include "resource.h"
+#include "privates.h"
+#include "gcstruct.h"
+#include "cursorstr.h"
+#include "colormapst.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "extnsionst.h"
+
+static struct {
+ DevPrivateKey key;
+ unsigned offset;
+ int created;
+ int allocated;
+} keys[PRIVATE_LAST];
+
+static const Bool xselinux_private[PRIVATE_LAST] = {
+ /* PRIVATE_XSELINUX,*/ FALSE,
+ /* PRIVATE_SCREEN,*/ TRUE,
+ /* [PRIVATE_EXTENSION] =*/TRUE,
+ /* [PRIVATE_COLORMAP] =*/ TRUE,
+ /* [PRIVATE_DEVICE] =*/ TRUE,
+ /* [PRIVATE_CLIENT] = */ TRUE,
+ /* [PRIVATE_PROPERTY] =*/ TRUE,
+ /* [PRIVATE_SELECTION] =*/TRUE,
+ /* [PRIVATE_WINDOW] =*/ TRUE,
+ /* [PRIVATE_PIXMAP] =*/ TRUE,
+ /* [PRIVATE_GC] =*/ TRUE,
+ /* [PRIVATE_CURSOR] =*/ TRUE,
+ /* PRIVATE_CURSOR_BITS,*/ FALSE,
+ /* PRIVATE_DBE_WINDOW,*/ FALSE,
+ /* PRIVATE_DAMAGE,*/ FALSE,
+ /* PRIVATE_GLYPH,*/ FALSE,
+ /* [PRIVATE_GLYPHSET] =*/ TRUE,
+ /* [PRIVATE_PICTURE] =*/ TRUE
+};
+
+typedef Bool (*FixupFunc) (PrivatePtr *privates, int offset, unsigned bytes);
+
+static Bool
+dixReallocPrivates(PrivatePtr *privates, int old_offset, unsigned bytes)
+{
+ void *new_privates;
+
+ new_privates = realloc(*privates, old_offset + bytes);
+ if (!new_privates)
+ return FALSE;
+ memset((char *) new_privates + old_offset, '\0', bytes);
+ *privates = new_privates;
+ return TRUE;
+}
+
+static Bool
+dixMovePrivates(PrivatePtr *privates, int new_offset, unsigned bytes)
+{
+ memmove((char *) *privates + bytes, *privates, new_offset - bytes);
+ memset(*privates, '\0', bytes);
+ return TRUE;
+}
+
+static Bool
+fixupScreens(FixupFunc fixup, unsigned bytes)
+{
+ int s;
+
+ for (s = 0; s < screenInfo.numScreens; s++)
+ if (!fixup
+ (&screenInfo.screens[s]->devPrivates, keys[PRIVATE_SCREEN].offset,
+ bytes))
+ return FALSE;
+ return TRUE;
+}
+
+static Bool
+fixupServerClient(FixupFunc fixup, unsigned bytes)
+{
+ if (serverClient)
+ return fixup(&serverClient->devPrivates, keys[PRIVATE_CLIENT].offset,
+ bytes);
+ return TRUE;
+}
+
+static Bool
+fixupExtensions(FixupFunc fixup, unsigned bytes)
+{
+ unsigned char major;
+ ExtensionEntry *extension;
+
+ for (major = EXTENSION_BASE; (extension = GetExtensionEntry(major));
+ major++)
+ if (!fixup
+ (&extension->devPrivates, keys[PRIVATE_EXTENSION].offset, bytes))
+ return FALSE;
+ return TRUE;
+}
+
+static Bool
+fixupDefaultColormaps(FixupFunc fixup, unsigned bytes)
+{
+ int s;
+
+ for (s = 0; s < screenInfo.numScreens; s++) {
+ ColormapPtr cmap;
+
+ dixLookupResourceByType((pointer *) &cmap,
+ screenInfo.screens[s]->defColormap, RT_COLORMAP,
+ serverClient, DixCreateAccess);
+ if (cmap &&
+ !fixup(&cmap->devPrivates, keys[PRIVATE_COLORMAP].offset, bytes))
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static Bool (*const allocated_early[PRIVATE_LAST]) (FixupFunc, unsigned) = {
+ /*PRIVATE_XSELINUX,*/ NULL,
+ /*[PRIVATE_SCREEN] =*/ fixupScreens,
+ /*[PRIVATE_EXTENSION] =*/ fixupExtensions,
+ /*[PRIVATE_COLORMAP] =*/ fixupDefaultColormaps,
+ /*PRIVATE_DEVICE,*/ NULL,
+ /*[PRIVATE_CLIENT] =*/ fixupServerClient,
+ /*PRIVATE_PROPERTY,*/ NULL,
+ /*PRIVATE_SELECTION,*/ NULL,
+ /*PRIVATE_WINDOW,*/ NULL,
+ /*PRIVATE_PIXMAP,*/ NULL,
+ /*PRIVATE_GC,*/ NULL,
+ /*PRIVATE_CURSOR,*/ NULL,
+ /*PRIVATE_CURSOR_BITS,*/ NULL,
+ /*PRIVATE_DBE_WINDOW,*/ NULL,
+ /*PRIVATE_DAMAGE,*/ NULL,
+ /*PRIVATE_GLYPH,*/ NULL,
+ /*PRIVATE_GLYPHSET,*/ NULL,
+ /*PRIVATE_PICTURE,*/ NULL
+};
+
+/*
+ * Register a private key. This takes the type of object the key will
+ * be used with, which may be PRIVATE_ALL indicating that this key
+ * will be used with all of the private objects. If 'size' is
+ * non-zero, then the specified amount of space will be allocated in
+ * the private storage. Otherwise, space for a single pointer will
+ * be allocated which can be set with dixSetPrivate
+ */
+Bool
+dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size)
+{
+ DevPrivateType t;
+ int offset;
+ unsigned bytes;
+
+ if (key->initialized) {
+ assert(size == key->size);
+ return TRUE;
+ }
+
+ /* Compute required space */
+ bytes = size;
+ if (size == 0)
+ bytes = sizeof(void *);
+
+ /* align to void * size */
+ bytes = (bytes + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
+
+ /* Update offsets for all affected keys */
+ if (type == PRIVATE_XSELINUX) {
+ DevPrivateKey k;
+
+ /* Resize if we can, or make sure nothing's allocated if we can't
+ */
+ for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++)
+ if (xselinux_private[t]) {
+ if (!allocated_early[t])
+ assert(!keys[t].created);
+ else if (!allocated_early[t] (dixReallocPrivates, bytes))
+ return FALSE;
+ }
+
+ /* Move all existing keys up in the privates space to make
+ * room for this new global key
+ */
+ for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++) {
+ if (xselinux_private[t]) {
+ for (k = keys[t].key; k; k = k->next)
+ k->offset += bytes;
+ keys[t].offset += bytes;
+ if (allocated_early[t])
+ allocated_early[t] (dixMovePrivates, bytes);
+ }
+ }
+
+ offset = 0;
+ }
+ else {
+ /* Resize if we can, or make sure nothing's allocated if we can't */
+ if (!allocated_early[type])
+ assert(!keys[type].created);
+ else if (!allocated_early[type] (dixReallocPrivates, bytes))
+ return FALSE;
+ offset = keys[type].offset;
+ keys[type].offset += bytes;
+ }
+
+ /* Setup this key */
+ key->offset = offset;
+ key->size = size;
+ key->initialized = TRUE;
+ key->type = type;
+ key->allocated = FALSE;
+ key->next = keys[type].key;
+ keys[type].key = key;
+
+ return TRUE;
+}
+
+Bool
+dixRegisterScreenPrivateKey(DevScreenPrivateKey screenKey, ScreenPtr pScreen,
+ DevPrivateType type, unsigned size)
+{
+ DevPrivateKey key;
+
+ if (!dixRegisterPrivateKey(&screenKey->screenKey, PRIVATE_SCREEN, 0))
+ return FALSE;
+ key = dixGetPrivate(&pScreen->devPrivates, &screenKey->screenKey);
+ if (key != NULL) {
+ assert(key->size == size);
+ assert(key->type == type);
+ return TRUE;
+ }
+ key = calloc(sizeof(DevPrivateKeyRec), 1);
+ if (!key)
+ return FALSE;
+ if (!dixRegisterPrivateKey(key, type, size)) {
+ free(key);
+ return FALSE;
+ }
+ key->allocated = TRUE;
+ dixSetPrivate(&pScreen->devPrivates, &screenKey->screenKey, key);
+ return TRUE;
+}
+
+DevPrivateKey
+_dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen)
+{
+ return dixGetPrivate(&pScreen->devPrivates, &key->screenKey);
+}
+
+/*
+ * Initialize privates by zeroing them
+ */
+void
+_dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type)
+{
+ keys[type].created++;
+ if (xselinux_private[type])
+ keys[PRIVATE_XSELINUX].created++;
+ if (keys[type].offset == 0)
+ addr = 0;
+ *privates = addr;
+ memset(addr, '\0', keys[type].offset);
+}
+
+/*
+ * Clean up privates
+ */
+void
+_dixFiniPrivates(PrivatePtr privates, DevPrivateType type)
+{
+ keys[type].created--;
+ if (xselinux_private[type])
+ keys[PRIVATE_XSELINUX].created--;
+}
+
+/*
+ * Allocate new object with privates.
+ *
+ * This is expected to be invoked from the
+ * dixAllocateObjectWithPrivates macro
+ */
+void *
+_dixAllocateObjectWithPrivates(unsigned baseSize, unsigned clear,
+ unsigned offset, DevPrivateType type)
+{
+ unsigned totalSize;
+ void *object;
+ PrivatePtr privates;
+ PrivatePtr *devPrivates;
+
+ assert(type > PRIVATE_SCREEN && type < PRIVATE_LAST);
+
+ /* round up so that void * is aligned */
+ baseSize = (baseSize + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
+ totalSize = baseSize + keys[type].offset;
+ object = malloc(totalSize);
+ if (!object)
+ return NULL;
+
+ memset(object, '\0', clear);
+ privates = (PrivatePtr) (((char *) object) + baseSize);
+ devPrivates = (PrivatePtr *) ((char *) object + offset);
+
+ _dixInitPrivates(devPrivates, privates, type);
+
+ return object;
+}
+
+/*
+ * Allocate privates separately from containing object.
+ * Used for clients and screens.
+ */
+Bool
+dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type)
+{
+ unsigned size;
+ PrivatePtr p;
+
+ assert(type > PRIVATE_XSELINUX && type < PRIVATE_LAST);
+
+ size = keys[type].offset;
+ if (!size) {
+ p = NULL;
+ }
+ else {
+ if (!(p = malloc(size)))
+ return FALSE;
+ }
+
+ _dixInitPrivates(privates, p, type);
+ ++keys[type].allocated;
+
+ return TRUE;
+}
+
+/*
+ * Free an object that has privates
+ *
+ * This is expected to be invoked from the
+ * dixFreeObjectWithPrivates macro
+ */
+void
+_dixFreeObjectWithPrivates(void *object, PrivatePtr privates,
+ DevPrivateType type)
+{
+ _dixFiniPrivates(privates, type);
+ free(object);
+}
+
+/*
+ * Called to free screen or client privates
+ */
+void
+dixFreePrivates(PrivatePtr privates, DevPrivateType type)
+{
+ _dixFiniPrivates(privates, type);
+ --keys[type].allocated;
+ free(privates);
+}
+
+/*
+ * Return size of privates for the specified type
+ */
+extern _X_EXPORT int
+dixPrivatesSize(DevPrivateType type)
+{
+ assert(type >= PRIVATE_SCREEN && type < PRIVATE_LAST);
+
+ return keys[type].offset;
+}
+
+/* Table of devPrivates offsets */
+static const int offsets[] = {
+ -1, /* RT_NONE */
+ offsetof(WindowRec, devPrivates), /* RT_WINDOW */
+ offsetof(PixmapRec, devPrivates), /* RT_PIXMAP */
+ offsetof(GC, devPrivates), /* RT_GC */
+ -1, /* RT_FONT */
+ offsetof(CursorRec, devPrivates), /* RT_CURSOR */
+ offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */
+};
+
+#define NUM_OFFSETS (sizeof (offsets) / sizeof (offsets[0]))
+
+int
+dixLookupPrivateOffset(RESTYPE type)
+{
+ /*
+ * Special kludge for DBE which registers a new resource type that
+ * points at pixmaps (thanks, DBE)
+ */
+ if (type & RC_DRAWABLE) {
+ if (type == RT_WINDOW)
+ return offsets[RT_WINDOW & TypeMask];
+ else
+ return offsets[RT_PIXMAP & TypeMask];
+ }
+ type = type & TypeMask;
+ if (type < NUM_OFFSETS)
+ return offsets[type];
+ return -1;
+}
+
+static const char *key_names[PRIVATE_LAST] = {
+ /* XSELinux uses the same private keys for numerous objects */
+ /*[PRIVATE_XSELINUX] =*/ "XSELINUX",
+
+ /* Otherwise, you get a private in just the requested structure
+ */
+ /* These can have objects created before all of the keys are registered */
+ /*[PRIVATE_SCREEN] =*/ "SCREEN",
+ /*[PRIVATE_EXTENSION] =*/ "EXTENSION",
+ /*[PRIVATE_COLORMAP] =*/ "COLORMAP",
+
+ /* These cannot have any objects before all relevant keys are registered */
+ /*[PRIVATE_DEVICE] =*/ "DEVICE",
+ /*[PRIVATE_CLIENT] =*/ "CLIENT",
+ /*[PRIVATE_PROPERTY] =*/ "PROPERTY",
+ /*[PRIVATE_SELECTION] =*/ "SELECTION",
+ /*[PRIVATE_WINDOW] =*/ "WINDOW",
+ /*[PRIVATE_PIXMAP] =*/ "PIXMAP",
+ /*[PRIVATE_GC] =*/ "GC",
+ /*[PRIVATE_CURSOR] =*/ "CURSOR",
+ /*[PRIVATE_CURSOR_BITS] =*/ "CURSOR_BITS",
+
+ /* extension privates */
+ /*[PRIVATE_DBE_WINDOW] =*/ "DBE_WINDOW",
+ /*[PRIVATE_DAMAGE] =*/ "DAMAGE",
+ /*[PRIVATE_GLYPH] =*/ "GLYPH",
+ /*[PRIVATE_GLYPHSET] =*/ "GLYPHSET",
+ /*[PRIVATE_PICTURE] =*/ "PICTURE" ,
+ /*[PRIVATE_SYNC_FENCE] =*/ "SYNC_FENCE"
+};
+
+void
+dixPrivateUsage(void)
+{
+ int objects = 0;
+ int bytes = 0;
+ int alloc = 0;
+ DevPrivateType t;
+
+ for (t = PRIVATE_XSELINUX + 1; t < PRIVATE_LAST; t++) {
+ if (keys[t].offset) {
+ ErrorF
+ ("%s: %d objects of %d bytes = %d total bytes %d private allocs\n",
+ key_names[t], keys[t].created, keys[t].offset,
+ keys[t].created * keys[t].offset, keys[t].allocated);
+ bytes += keys[t].created * keys[t].offset;
+ objects += keys[t].created;
+ alloc += keys[t].allocated;
+ }
+ }
+ ErrorF("TOTAL: %d objects, %d bytes, %d allocs\n", objects, bytes, alloc);
+}
+
+void
+dixResetPrivates(void)
+{
+ DevPrivateType t;
+
+ for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++) {
+ DevPrivateKey key, next;
+
+ for (key = keys[t].key; key; key = next) {
+ next = key->next;
+ key->offset = 0;
+ key->initialized = FALSE;
+ key->size = 0;
+ key->type = 0;
+ if (key->allocated)
+ free(key);
+ }
+ if (keys[t].created) {
+ ErrorF("%d %ss still allocated at reset\n",
+ keys[t].created, key_names[t]);
+ dixPrivateUsage();
+ }
+ keys[t].key = NULL;
+ keys[t].offset = 0;
+ keys[t].created = 0;
+ keys[t].allocated = 0;
+ }
+}
diff --git a/xorg-server/dix/property.c b/xorg-server/dix/property.c
index d933d5cec..b1b83124f 100644
--- a/xorg-server/dix/property.c
+++ b/xorg-server/dix/property.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -76,13 +75,12 @@ PrintPropertys(WindowPtr pWin)
int j;
pProp = pWin->userProps;
- while (pProp)
- {
+ while (pProp) {
ErrorF("[dix] %x %x\n", pProp->propertyName, pProp->type);
ErrorF("[dix] property format: %d\n", pProp->format);
ErrorF("[dix] property data: \n");
- for (j=0; j<(pProp->format/8)*pProp->size; j++)
- ErrorF("[dix] %c\n", pProp->data[j]);
+ for (j = 0; j < (pProp->format / 8) * pProp->size; j++)
+ ErrorF("[dix] %c\n", pProp->data[j]);
pProp = pProp->next;
}
}
@@ -90,18 +88,19 @@ PrintPropertys(WindowPtr pWin)
int
dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName,
- ClientPtr client, Mask access_mode)
+ ClientPtr client, Mask access_mode)
{
PropertyPtr pProp;
int rc = BadMatch;
+
client->errorValue = propertyName;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
- if (pProp->propertyName == propertyName)
- break;
+ if (pProp->propertyName == propertyName)
+ break;
if (pProp)
- rc = XaceHookPropertyAccess(client, pWin, &pProp, access_mode);
+ rc = XaceHookPropertyAccess(client, pWin, &pProp, access_mode);
*result = pProp;
return rc;
}
@@ -117,17 +116,18 @@ deliverPropertyNotifyEvent(WindowPtr pWin, int state, Atom atom)
event.u.property.state = state;
event.u.property.atom = atom;
event.u.property.time = currentTime.milliseconds;
- DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+ DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
}
int
ProcRotateProperties(ClientPtr client)
{
- int i, j, delta, rc;
+ int i, j, delta, rc;
+
REQUEST(xRotatePropertiesReq);
WindowPtr pWin;
- Atom * atoms;
- PropertyPtr * props; /* array of pointer */
+ Atom *atoms;
+ PropertyPtr *props; /* array of pointer */
PropertyPtr pProp, saved;
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
@@ -136,70 +136,67 @@ ProcRotateProperties(ClientPtr client)
if (rc != Success || stuff->nAtoms <= 0)
return rc;
- atoms = (Atom *) & stuff[1];
+ atoms = (Atom *) &stuff[1];
props = malloc(stuff->nAtoms * sizeof(PropertyPtr));
saved = malloc(stuff->nAtoms * sizeof(PropertyRec));
if (!props || !saved) {
- rc = BadAlloc;
- goto out;
+ rc = BadAlloc;
+ goto out;
}
- for (i = 0; i < stuff->nAtoms; i++)
- {
+ for (i = 0; i < stuff->nAtoms; i++) {
if (!ValidAtom(atoms[i])) {
- rc = BadAtom;
- client->errorValue = atoms[i];
- goto out;
+ rc = BadAtom;
+ client->errorValue = atoms[i];
+ goto out;
}
for (j = i + 1; j < stuff->nAtoms; j++)
- if (atoms[j] == atoms[i])
- {
- rc = BadMatch;
- goto out;
+ if (atoms[j] == atoms[i]) {
+ rc = BadMatch;
+ goto out;
}
- rc = dixLookupProperty(&pProp, pWin, atoms[i], client,
- DixReadAccess|DixWriteAccess);
- if (rc != Success)
- goto out;
+ rc = dixLookupProperty(&pProp, pWin, atoms[i], client,
+ DixReadAccess | DixWriteAccess);
+ if (rc != Success)
+ goto out;
props[i] = pProp;
- saved[i] = *pProp;
+ saved[i] = *pProp;
}
delta = stuff->nPositions;
/* If the rotation is a complete 360 degrees, then moving the properties
- around and generating PropertyNotify events should be skipped. */
+ around and generating PropertyNotify events should be skipped. */
- if (abs(delta) % stuff->nAtoms)
- {
- while (delta < 0) /* faster if abs value is small */
+ if (abs(delta) % stuff->nAtoms) {
+ while (delta < 0) /* faster if abs value is small */
delta += stuff->nAtoms;
- for (i = 0; i < stuff->nAtoms; i++)
- {
- j = (i + delta) % stuff->nAtoms;
- deliverPropertyNotifyEvent(pWin, PropertyNewValue, atoms[i]);
-
- /* Preserve name and devPrivates */
- props[j]->type = saved[i].type;
- props[j]->format = saved[i].format;
- props[j]->size = saved[i].size;
- props[j]->data = saved[i].data;
- }
+ for (i = 0; i < stuff->nAtoms; i++) {
+ j = (i + delta) % stuff->nAtoms;
+ deliverPropertyNotifyEvent(pWin, PropertyNewValue, atoms[i]);
+
+ /* Preserve name and devPrivates */
+ props[j]->type = saved[i].type;
+ props[j]->format = saved[i].format;
+ props[j]->size = saved[i].size;
+ props[j]->data = saved[i].data;
+ }
}
-out:
+ out:
free(saved);
free(props);
return rc;
}
-int
+int
ProcChangeProperty(ClientPtr client)
-{
+{
WindowPtr pWin;
char format, mode;
unsigned long len;
int sizeInBytes, totalSize, err;
+
REQUEST(xChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
@@ -207,50 +204,46 @@ ProcChangeProperty(ClientPtr client)
format = stuff->format;
mode = stuff->mode;
if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
- (mode != PropModePrepend))
- {
- client->errorValue = mode;
- return BadValue;
+ (mode != PropModePrepend)) {
+ client->errorValue = mode;
+ return BadValue;
}
- if ((format != 8) && (format != 16) && (format != 32))
- {
- client->errorValue = format;
+ if ((format != 8) && (format != 16) && (format != 32)) {
+ client->errorValue = format;
return BadValue;
}
len = stuff->nUnits;
if (len > bytes_to_int32(0xffffffff - sizeof(xChangePropertyReq)))
- return BadLength;
- sizeInBytes = format>>3;
+ return BadLength;
+ sizeInBytes = format >> 3;
totalSize = len * sizeInBytes;
REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize);
err = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess);
if (err != Success)
- return err;
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
+ return err;
+ if (!ValidAtom(stuff->property)) {
+ client->errorValue = stuff->property;
+ return BadAtom;
}
- if (!ValidAtom(stuff->type))
- {
- client->errorValue = stuff->type;
- return BadAtom;
+ if (!ValidAtom(stuff->type)) {
+ client->errorValue = stuff->type;
+ return BadAtom;
}
err = dixChangeWindowProperty(client, pWin, stuff->property, stuff->type,
- (int)format, (int)mode, len, &stuff[1],
- TRUE);
+ (int) format, (int) mode, len, &stuff[1],
+ TRUE);
if (err != Success)
- return err;
+ return err;
else
- return Success;
+ return Success;
}
int
dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
- Atom type, int format, int mode, unsigned long len,
- pointer value, Bool sendevent)
+ Atom type, int format, int mode, unsigned long len,
+ pointer value, Bool sendevent)
{
PropertyPtr pProp;
PropertyRec savedProp;
@@ -258,126 +251,116 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
unsigned char *data;
Mask access_mode;
- sizeInBytes = format>>3;
+ sizeInBytes = format >> 3;
totalSize = len * sizeInBytes;
access_mode = (mode == PropModeReplace) ? DixWriteAccess : DixBlendAccess;
/* first see if property already exists */
rc = dixLookupProperty(&pProp, pWin, property, pClient, access_mode);
- if (rc == BadMatch) /* just add to list */
- {
- if (!pWin->optional && !MakeWindowOptional (pWin))
- return BadAlloc;
- pProp = dixAllocateObjectWithPrivates(PropertyRec, PRIVATE_PROPERTY);
- if (!pProp)
- return BadAlloc;
+ if (rc == BadMatch) { /* just add to list */
+ if (!pWin->optional && !MakeWindowOptional(pWin))
+ return BadAlloc;
+ pProp = dixAllocateObjectWithPrivates(PropertyRec, PRIVATE_PROPERTY);
+ if (!pProp)
+ return BadAlloc;
data = malloc(totalSize);
- if (!data && len)
- {
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
- return BadAlloc;
- }
+ if (!data && len) {
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ return BadAlloc;
+ }
memcpy(data, value, totalSize);
pProp->propertyName = property;
pProp->type = type;
pProp->format = format;
pProp->data = data;
- pProp->size = len;
- rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
- DixCreateAccess|DixWriteAccess);
- if (rc != Success) {
- free(data);
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
- pClient->errorValue = property;
- return rc;
- }
+ pProp->size = len;
+ rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
+ DixCreateAccess | DixWriteAccess);
+ if (rc != Success) {
+ free(data);
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ pClient->errorValue = property;
+ return rc;
+ }
pProp->next = pWin->optional->userProps;
pWin->optional->userProps = pProp;
}
- else if (rc == Success)
- {
- /* To append or prepend to a property the request format and type
- must match those of the already defined property. The
- existing format and type are irrelevant when using the mode
- "PropModeReplace" since they will be written over. */
+ else if (rc == Success) {
+ /* To append or prepend to a property the request format and type
+ must match those of the already defined property. The
+ existing format and type are irrelevant when using the mode
+ "PropModeReplace" since they will be written over. */
if ((format != pProp->format) && (mode != PropModeReplace))
- return BadMatch;
+ return BadMatch;
if ((pProp->type != type) && (mode != PropModeReplace))
return BadMatch;
- /* save the old values for later */
- savedProp = *pProp;
-
- if (mode == PropModeReplace)
- {
- data = malloc(totalSize);
- if (!data && len)
- return BadAlloc;
- memcpy(data, value, totalSize);
- pProp->data = data;
- pProp->size = len;
- pProp->type = type;
- pProp->format = format;
- }
- else if (len == 0)
- {
- /* do nothing */
- }
- else if (mode == PropModeAppend)
- {
- data = malloc((pProp->size + len) * sizeInBytes);
- if (!data)
- return BadAlloc;
- memcpy(data, pProp->data, pProp->size * sizeInBytes);
- memcpy(data + pProp->size * sizeInBytes, value, totalSize);
+ /* save the old values for later */
+ savedProp = *pProp;
+
+ if (mode == PropModeReplace) {
+ data = malloc(totalSize);
+ if (!data && len)
+ return BadAlloc;
+ memcpy(data, value, totalSize);
+ pProp->data = data;
+ pProp->size = len;
+ pProp->type = type;
+ pProp->format = format;
+ }
+ else if (len == 0) {
+ /* do nothing */
+ }
+ else if (mode == PropModeAppend) {
+ data = malloc((pProp->size + len) * sizeInBytes);
+ if (!data)
+ return BadAlloc;
+ memcpy(data, pProp->data, pProp->size * sizeInBytes);
+ memcpy(data + pProp->size * sizeInBytes, value, totalSize);
pProp->data = data;
pProp->size += len;
- }
- else if (mode == PropModePrepend)
- {
+ }
+ else if (mode == PropModePrepend) {
data = malloc(sizeInBytes * (len + pProp->size));
- if (!data)
- return BadAlloc;
+ if (!data)
+ return BadAlloc;
memcpy(data + totalSize, pProp->data, pProp->size * sizeInBytes);
memcpy(data, value, totalSize);
pProp->data = data;
pProp->size += len;
- }
-
- /* Allow security modules to check the new content */
- access_mode |= DixPostAccess;
- rc = XaceHookPropertyAccess(pClient, pWin, &pProp, access_mode);
- if (rc == Success)
- {
- if (savedProp.data != pProp->data)
- free(savedProp.data);
- }
- else
- {
- if (savedProp.data != pProp->data)
- free(pProp->data);
- *pProp = savedProp;
- return rc;
- }
+ }
+
+ /* Allow security modules to check the new content */
+ access_mode |= DixPostAccess;
+ rc = XaceHookPropertyAccess(pClient, pWin, &pProp, access_mode);
+ if (rc == Success) {
+ if (savedProp.data != pProp->data)
+ free(savedProp.data);
+ }
+ else {
+ if (savedProp.data != pProp->data)
+ free(pProp->data);
+ *pProp = savedProp;
+ return rc;
+ }
}
else
- return rc;
+ return rc;
if (sendevent)
- deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName);
+ deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName);
return Success;
}
int
-ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
- int mode, unsigned long len, pointer value,
- Bool sendevent)
+ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
+ int mode, unsigned long len, pointer value, Bool sendevent)
{
return dixChangeWindowProperty(serverClient, pWin, property, type, format,
- mode, len, value, sendevent);
+ mode, len, value, sendevent);
}
int
@@ -388,24 +371,25 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
rc = dixLookupProperty(&pProp, pWin, propName, client, DixDestroyAccess);
if (rc == BadMatch)
- return Success; /* Succeed if property does not exist */
+ return Success; /* Succeed if property does not exist */
if (rc == Success) {
- if (pWin->optional->userProps == pProp) {
- /* Takes care of head */
+ if (pWin->optional->userProps == pProp) {
+ /* Takes care of head */
if (!(pWin->optional->userProps = pProp->next))
- CheckWindowOptionalNeed (pWin);
- } else {
- /* Need to traverse to find the previous element */
- prevProp = pWin->optional->userProps;
- while (prevProp->next != pProp)
- prevProp = prevProp->next;
- prevProp->next = pProp->next;
- }
-
- deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
- free(pProp->data);
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ CheckWindowOptionalNeed(pWin);
+ }
+ else {
+ /* Need to traverse to find the previous element */
+ prevProp = pWin->optional->userProps;
+ while (prevProp->next != pProp)
+ prevProp = prevProp->next;
+ prevProp->next = pProp->next;
+ }
+
+ deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
+ free(pProp->data);
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
}
return rc;
}
@@ -415,14 +399,13 @@ DeleteAllWindowProperties(WindowPtr pWin)
{
PropertyPtr pProp, pNextProp;
- pProp = wUserProps (pWin);
- while (pProp)
- {
- deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
- pNextProp = pProp->next;
+ pProp = wUserProps(pWin);
+ while (pProp) {
+ deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
+ pNextProp = pProp->next;
free(pProp->data);
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
- pProp = pNextProp;
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ pProp = pNextProp;
}
if (pWin->optional)
@@ -430,11 +413,8 @@ DeleteAllWindowProperties(WindowPtr pWin)
}
static int
-NullPropertyReply(
- ClientPtr client,
- ATOM propertyType,
- int format,
- xGetPropertyReply *reply)
+NullPropertyReply(ClientPtr client,
+ ATOM propertyType, int format, xGetPropertyReply * reply)
{
reply->nItems = 0;
reply->length = 0;
@@ -464,32 +444,30 @@ ProcGetProperty(ClientPtr client)
WindowPtr pWin;
xGetPropertyReply reply;
Mask win_mode = DixGetPropAccess, prop_mode = DixReadAccess;
+
REQUEST(xGetPropertyReq);
REQUEST_SIZE_MATCH(xGetPropertyReq);
if (stuff->delete) {
- UpdateCurrentTime();
- win_mode |= DixSetPropAccess;
- prop_mode |= DixDestroyAccess;
+ UpdateCurrentTime();
+ win_mode |= DixSetPropAccess;
+ prop_mode |= DixDestroyAccess;
}
rc = dixLookupWindow(&pWin, stuff->window, client, win_mode);
if (rc != Success)
- return rc;
+ return rc;
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
+ if (!ValidAtom(stuff->property)) {
+ client->errorValue = stuff->property;
+ return BadAtom;
}
- if ((stuff->delete != xTrue) && (stuff->delete != xFalse))
- {
- client->errorValue = stuff->delete;
- return BadValue;
+ if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) {
+ client->errorValue = stuff->delete;
+ return BadValue;
}
- if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type))
- {
- client->errorValue = stuff->type;
- return BadAtom;
+ if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) {
+ client->errorValue = stuff->type;
+ return BadAtom;
}
memset(&reply, 0, sizeof(xGetPropertyReply));
@@ -498,39 +476,36 @@ ProcGetProperty(ClientPtr client)
rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode);
if (rc == BadMatch)
- return NullPropertyReply(client, None, 0, &reply);
+ return NullPropertyReply(client, None, 0, &reply);
else if (rc != Success)
- return rc;
+ return rc;
/* If the request type and actual type don't match. Return the
- property information, but not the data. */
-
- if (((stuff->type != pProp->type) &&
- (stuff->type != AnyPropertyType))
- )
- {
- reply.bytesAfter = pProp->size;
- reply.format = pProp->format;
- reply.length = 0;
- reply.nItems = 0;
- reply.propertyType = pProp->type;
- WriteReplyToClient(client, sizeof(xGenericReply), &reply);
- return Success;
+ property information, but not the data. */
+
+ if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType))
+ ) {
+ reply.bytesAfter = pProp->size;
+ reply.format = pProp->format;
+ reply.length = 0;
+ reply.nItems = 0;
+ reply.propertyType = pProp->type;
+ WriteReplyToClient(client, sizeof(xGenericReply), &reply);
+ return Success;
}
/*
* Return type, format, value to client
*/
- n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */
- ind = stuff->longOffset << 2;
+ n = (pProp->format / 8) * pProp->size; /* size (bytes) of prop */
+ ind = stuff->longOffset << 2;
- /* If longOffset is invalid such that it causes "len" to
- be negative, it's a value error. */
+ /* If longOffset is invalid such that it causes "len" to
+ be negative, it's a value error. */
- if (n < ind)
- {
- client->errorValue = stuff->longOffset;
- return BadValue;
+ if (n < ind) {
+ client->errorValue = stuff->longOffset;
+ return BadValue;
}
len = min(n - ind, 4 * stuff->longLength);
@@ -538,40 +513,45 @@ ProcGetProperty(ClientPtr client)
reply.bytesAfter = n - (ind + len);
reply.format = pProp->format;
reply.length = bytes_to_int32(len);
- reply.nItems = len / (pProp->format / 8 );
+ reply.nItems = len / (pProp->format / 8);
reply.propertyType = pProp->type;
if (stuff->delete && (reply.bytesAfter == 0))
- deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
+ deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
- if (len)
- {
- switch (reply.format) {
- case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
- case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
- default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
- }
- WriteSwappedDataToClient(client, len,
- (char *)pProp->data + ind);
+ if (len) {
+ switch (reply.format) {
+ case 32:
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
+ break;
+ case 16:
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
+ break;
+ default:
+ client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
+ break;
+ }
+ WriteSwappedDataToClient(client, len, (char *) pProp->data + ind);
}
if (stuff->delete && (reply.bytesAfter == 0)) {
- /* Delete the Property */
- if (pWin->optional->userProps == pProp) {
- /* Takes care of head */
+ /* Delete the Property */
+ if (pWin->optional->userProps == pProp) {
+ /* Takes care of head */
if (!(pWin->optional->userProps = pProp->next))
- CheckWindowOptionalNeed (pWin);
- } else {
- /* Need to traverse to find the previous element */
- prevProp = pWin->optional->userProps;
- while (prevProp->next != pProp)
- prevProp = prevProp->next;
- prevProp->next = pProp->next;
- }
-
- free(pProp->data);
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ CheckWindowOptionalNeed(pWin);
+ }
+ else {
+ /* Need to traverse to find the previous element */
+ prevProp = pWin->optional->userProps;
+ while (prevProp->next != pProp)
+ prevProp = prevProp->next;
+ prevProp->next = pProp->next;
+ }
+
+ free(pProp->data);
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
}
return Success;
}
@@ -581,9 +561,10 @@ ProcListProperties(ClientPtr client)
{
Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr;
- int rc, numProps = 0;
+ int rc, numProps = 0;
WindowPtr pWin;
PropertyPtr pProp, realProp;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
@@ -592,20 +573,20 @@ ProcListProperties(ClientPtr client)
return rc;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
- numProps++;
+ numProps++;
if (numProps && !(pAtoms = malloc(numProps * sizeof(Atom))))
- return BadAlloc;
+ return BadAlloc;
numProps = 0;
temppAtoms = pAtoms;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
- realProp = pProp;
- rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
- if (rc == Success && realProp == pProp) {
- *temppAtoms++ = pProp->propertyName;
- numProps++;
- }
+ realProp = pProp;
+ rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
+ if (rc == Success && realProp == pProp) {
+ *temppAtoms++ = pProp->propertyName;
+ numProps++;
+ }
}
xlpr.type = X_Reply;
@@ -613,31 +594,30 @@ ProcListProperties(ClientPtr client)
xlpr.length = bytes_to_int32(numProps * sizeof(Atom));
xlpr.sequenceNumber = client->sequence;
WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
- if (numProps)
- {
- client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
+ if (numProps) {
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
}
free(pAtoms);
return Success;
}
-int
+int
ProcDeleteProperty(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xDeletePropertyReq);
int result;
-
+
REQUEST_SIZE_MATCH(xDeletePropertyReq);
UpdateCurrentTime();
result = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess);
if (result != Success)
return result;
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
+ if (!ValidAtom(stuff->property)) {
+ client->errorValue = stuff->property;
+ return BadAtom;
}
return DeleteProperty(client, pWin, stuff->property);
diff --git a/xorg-server/dix/ptrveloc.c b/xorg-server/dix/ptrveloc.c
index 1ba531c96..fb5f19d69 100644
--- a/xorg-server/dix/ptrveloc.c
+++ b/xorg-server/dix/ptrveloc.c
@@ -71,8 +71,9 @@
/* fwds */
int
-SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
+ SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
static double
+
SimpleSmoothProfile(DeviceIntPtr dev, DeviceVelocityPtr vel, double velocity,
double threshold, double acc);
static PointerAccelerationProfileFunc
@@ -90,7 +91,7 @@ DeletePredictableAccelerationProperties(DeviceIntPtr,
#ifdef PTRACCEL_DEBUGGING
#define DebugAccelF ErrorF
#else
-#define DebugAccelF(...) /* */
+#define DebugAccelF(...) /* */
#endif
/********************************
@@ -108,11 +109,11 @@ InitVelocityData(DeviceVelocityPtr vel)
{
memset(vel, 0, sizeof(DeviceVelocityRec));
- vel->corr_mul = 10.0; /* dots per 10 milisecond should be usable */
- vel->const_acceleration = 1.0; /* no acceleration/deceleration */
+ vel->corr_mul = 10.0; /* dots per 10 milisecond should be usable */
+ vel->const_acceleration = 1.0; /* no acceleration/deceleration */
vel->reset_time = 300;
vel->use_softening = 1;
- vel->min_acceleration = 1.0; /* don't decelerate */
+ vel->min_acceleration = 1.0; /* don't decelerate */
vel->max_rel_diff = 0.2;
vel->max_diff = 1.0;
vel->initial_range = 2;
@@ -121,26 +122,27 @@ InitVelocityData(DeviceVelocityPtr vel)
InitTrackers(vel, 16);
}
-
/**
* Clean up DeviceVelocityRec
*/
void
-FreeVelocityData(DeviceVelocityPtr vel){
+FreeVelocityData(DeviceVelocityPtr vel)
+{
free(vel->tracker);
SetAccelerationProfile(vel, PROFILE_UNINITIALIZE);
}
-
/**
* Init predictable scheme
*/
Bool
InitPredictableAccelerationScheme(DeviceIntPtr dev,
- ValuatorAccelerationPtr protoScheme) {
+ ValuatorAccelerationPtr protoScheme)
+{
DeviceVelocityPtr vel;
ValuatorAccelerationRec scheme;
PredictableAccelSchemePtr schemeData;
+
scheme = *protoScheme;
vel = calloc(1, sizeof(DeviceVelocityRec));
schemeData = calloc(1, sizeof(PredictableAccelSchemeRec));
@@ -156,7 +158,6 @@ InitPredictableAccelerationScheme(DeviceIntPtr dev,
return TRUE;
}
-
/**
* Uninit scheme
*/
@@ -164,6 +165,7 @@ void
AccelerationDefaultCleanup(DeviceIntPtr dev)
{
DeviceVelocityPtr vel = GetDevicePredictableAccelData(dev);
+
if (vel) {
/* the proper guarantee would be that we're not inside of
* AccelSchemeProc(), but that seems impossible. Schemes don't get
@@ -174,14 +176,15 @@ AccelerationDefaultCleanup(DeviceIntPtr dev)
FreeVelocityData(vel);
free(vel);
DeletePredictableAccelerationProperties(dev,
- (PredictableAccelSchemePtr) dev->valuator->accelScheme.accelData);
+ (PredictableAccelSchemePtr)
+ dev->valuator->accelScheme.
+ accelData);
free(dev->valuator->accelScheme.accelData);
dev->valuator->accelScheme.accelData = NULL;
OsReleaseSignals();
}
}
-
/*************************
* Input property support
************************/
@@ -206,15 +209,15 @@ AccelSetProfileProperty(DeviceIntPtr dev, Atom atom,
return BadValue;
rc = XIPropToInt(val, &nelem, &ptr);
- if(checkOnly)
- {
+ if (checkOnly) {
if (rc)
return rc;
if (GetAccelerationProfile(vel, profile) == NULL)
return BadValue;
- } else
- SetAccelerationProfile(vel, profile);
+ }
+ else
+ SetAccelerationProfile(vel, profile);
return Success;
}
@@ -251,15 +254,14 @@ AccelSetDecelProperty(DeviceIntPtr dev, Atom atom,
return BadValue;
rc = XIPropToFloat(val, &nelem, &ptr);
- if(checkOnly)
- {
+ if (checkOnly) {
if (rc)
return rc;
- return (v >= 1.0f) ? Success : BadValue;
+ return (v >= 1.0f) ? Success : BadValue;
}
- if(v >= 1.0f)
- vel->const_acceleration = 1/v;
+ if (v >= 1.0f)
+ vel->const_acceleration = 1 / v;
return Success;
}
@@ -267,16 +269,16 @@ AccelSetDecelProperty(DeviceIntPtr dev, Atom atom,
static long
AccelInitDecelProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
{
- float fval = 1.0/vel->const_acceleration;
- Atom prop_const_decel = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION);
+ float fval = 1.0 / vel->const_acceleration;
+ Atom prop_const_decel =
+ XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION);
XIChangeDeviceProperty(dev, prop_const_decel,
- XIGetKnownProperty(XATOM_FLOAT), 32,
- PropModeReplace, 1, &fval, FALSE);
+ XIGetKnownProperty(XATOM_FLOAT), 32, PropModeReplace,
+ 1, &fval, FALSE);
XISetDevicePropertyDeletable(dev, prop_const_decel, FALSE);
return XIRegisterPropertyHandler(dev, AccelSetDecelProperty, NULL, NULL);
}
-
/**
* adaptive deceleration
*/
@@ -297,15 +299,14 @@ AccelSetAdaptDecelProperty(DeviceIntPtr dev, Atom atom,
return BadValue;
rc = XIPropToFloat(val, &nelem, &ptr);
- if(checkOnly)
- {
+ if (checkOnly) {
if (rc)
return rc;
- return (v >= 1.0f) ? Success : BadValue;
+ return (v >= 1.0f) ? Success : BadValue;
}
- if(v >= 1.0f)
- veloc->min_acceleration = 1/v;
+ if (v >= 1.0f)
+ veloc->min_acceleration = 1 / v;
return Success;
}
@@ -313,16 +314,18 @@ AccelSetAdaptDecelProperty(DeviceIntPtr dev, Atom atom,
static long
AccelInitAdaptDecelProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
{
- float fval = 1.0/vel->min_acceleration;
- Atom prop_adapt_decel = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION);
+ float fval = 1.0 / vel->min_acceleration;
+ Atom prop_adapt_decel =
+ XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION);
- XIChangeDeviceProperty(dev, prop_adapt_decel, XIGetKnownProperty(XATOM_FLOAT), 32,
- PropModeReplace, 1, &fval, FALSE);
+ XIChangeDeviceProperty(dev, prop_adapt_decel,
+ XIGetKnownProperty(XATOM_FLOAT), 32, PropModeReplace,
+ 1, &fval, FALSE);
XISetDevicePropertyDeletable(dev, prop_adapt_decel, FALSE);
- return XIRegisterPropertyHandler(dev, AccelSetAdaptDecelProperty, NULL, NULL);
+ return XIRegisterPropertyHandler(dev, AccelSetAdaptDecelProperty, NULL,
+ NULL);
}
-
/**
* velocity scaling
*/
@@ -343,16 +346,15 @@ AccelSetScaleProperty(DeviceIntPtr dev, Atom atom,
return BadValue;
rc = XIPropToFloat(val, &nelem, &ptr);
- if (checkOnly)
- {
+ if (checkOnly) {
if (rc)
return rc;
return (v > 0) ? Success : BadValue;
}
- if(v > 0)
- vel->corr_mul = v;
+ if (v > 0)
+ vel->corr_mul = v;
return Success;
}
@@ -363,20 +365,22 @@ AccelInitScaleProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
float fval = vel->corr_mul;
Atom prop_velo_scale = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING);
- XIChangeDeviceProperty(dev, prop_velo_scale, XIGetKnownProperty(XATOM_FLOAT), 32,
- PropModeReplace, 1, &fval, FALSE);
+ XIChangeDeviceProperty(dev, prop_velo_scale,
+ XIGetKnownProperty(XATOM_FLOAT), 32, PropModeReplace,
+ 1, &fval, FALSE);
XISetDevicePropertyDeletable(dev, prop_velo_scale, FALSE);
return XIRegisterPropertyHandler(dev, AccelSetScaleProperty, NULL, NULL);
}
static BOOL
-InitializePredictableAccelerationProperties(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- PredictableAccelSchemePtr schemeData)
+InitializePredictableAccelerationProperties(DeviceIntPtr dev,
+ DeviceVelocityPtr vel,
+ PredictableAccelSchemePtr
+ schemeData)
{
int num_handlers = 4;
- if(!vel)
+
+ if (!vel)
return FALSE;
schemeData->prop_handlers = calloc(num_handlers, sizeof(long));
@@ -392,9 +396,8 @@ InitializePredictableAccelerationProperties(
}
BOOL
-DeletePredictableAccelerationProperties(
- DeviceIntPtr dev,
- PredictableAccelSchemePtr scheme)
+DeletePredictableAccelerationProperties(DeviceIntPtr dev,
+ PredictableAccelSchemePtr scheme)
{
DeviceVelocityPtr vel;
Atom prop;
@@ -429,26 +432,27 @@ DeletePredictableAccelerationProperties(
void
InitTrackers(DeviceVelocityPtr vel, int ntracker)
{
- if(ntracker < 1){
- ErrorF("(dix ptracc) invalid number of trackers\n");
- return;
+ if (ntracker < 1) {
+ ErrorF("(dix ptracc) invalid number of trackers\n");
+ return;
}
free(vel->tracker);
- vel->tracker = (MotionTrackerPtr)calloc(ntracker, sizeof(MotionTracker));
+ vel->tracker = (MotionTrackerPtr) calloc(ntracker, sizeof(MotionTracker));
vel->num_tracker = ntracker;
}
enum directions {
- N = (1 << 0),
- NE = (1 << 1),
- E = (1 << 2),
- SE = (1 << 3),
- S = (1 << 4),
- SW = (1 << 5),
- W = (1 << 6),
- NW = (1 << 7),
+ N = (1 << 0),
+ NE = (1 << 1),
+ E = (1 << 2),
+ SE = (1 << 3),
+ S = (1 << 4),
+ SW = (1 << 5),
+ W = (1 << 6),
+ NW = (1 << 7),
UNDEFINED = 0xFF
};
+
/**
* return a bit field of possible directions.
* There's no reason against widening to more precise directions (<45 degrees),
@@ -461,32 +465,34 @@ enum directions {
* this movement.
*/
static int
-DoGetDirection(int dx, int dy){
+DoGetDirection(int dx, int dy)
+{
int dir = 0;
/* on insignificant mickeys, flag 135 degrees */
- if(abs(dx) < 2 && abs(dy) < 2){
+ if (abs(dx) < 2 && abs(dy) < 2) {
/* first check diagonal cases */
- if(dx > 0 && dy > 0)
+ if (dx > 0 && dy > 0)
dir = E | SE | S;
- else if(dx > 0 && dy < 0)
- dir = N | NE | E;
- else if(dx < 0 && dy < 0)
- dir = W | NW | N;
- else if(dx < 0 && dy > 0)
- dir = W | SW | S;
+ else if (dx > 0 && dy < 0)
+ dir = N | NE | E;
+ else if (dx < 0 && dy < 0)
+ dir = W | NW | N;
+ else if (dx < 0 && dy > 0)
+ dir = W | SW | S;
/* check axis-aligned directions */
- else if(dx > 0)
- dir = NE | E | SE;
- else if(dx < 0)
- dir = NW | W | SW;
- else if(dy > 0)
- dir = SE | S | SW;
- else if(dy < 0)
- dir = NE | N | NW;
+ else if (dx > 0)
+ dir = NE | E | SE;
+ else if (dx < 0)
+ dir = NW | W | SW;
+ else if (dy > 0)
+ dir = SE | S | SW;
+ else if (dy < 0)
+ dir = NE | N | NW;
else
- dir = UNDEFINED; /* shouldn't happen */
- } else { /* compute angle and set appropriate flags */
+ dir = UNDEFINED; /* shouldn't happen */
+ }
+ else { /* compute angle and set appropriate flags */
double r;
int i1, i2;
@@ -502,13 +508,13 @@ DoGetDirection(int dx, int dy){
* But we add extra 90° to match up with our N, S, etc. defines up
* there, rest stays the same.
*/
- r = (r+(M_PI*2.5))/(M_PI/4);
+ r = (r + (M_PI * 2.5)) / (M_PI / 4);
/* this intends to flag 2 directions (45 degrees),
* except on very well-aligned mickeys. */
- i1 = (int)(r+0.1) % 8;
- i2 = (int)(r+0.9) % 8;
- if(i1 < 0 || i1 > 7 || i2 < 0 || i2 > 7)
- dir = UNDEFINED; /* shouldn't happen */
+ i1 = (int) (r + 0.1) % 8;
+ i2 = (int) (r + 0.9) % 8;
+ if (i1 < 0 || i1 > 7 || i2 < 0 || i2 > 7)
+ dir = UNDEFINED; /* shouldn't happen */
else
dir = (1 << i1 | 1 << i2);
}
@@ -526,19 +532,22 @@ DoGetDirection(int dx, int dy){
* this movement.
*/
static int
-GetDirection(int dx, int dy){
+GetDirection(int dx, int dy)
+{
static int cache[DIRECTION_CACHE_SIZE][DIRECTION_CACHE_SIZE];
int dir;
+
if (abs(dx) <= DIRECTION_CACHE_RANGE && abs(dy) <= DIRECTION_CACHE_RANGE) {
- /* cacheable */
- dir = cache[DIRECTION_CACHE_RANGE+dx][DIRECTION_CACHE_RANGE+dy];
- if(dir == 0) {
- dir = DoGetDirection(dx, dy);
- cache[DIRECTION_CACHE_RANGE+dx][DIRECTION_CACHE_RANGE+dy] = dir;
- }
- }else{
- /* non-cacheable */
- dir = DoGetDirection(dx, dy);
+ /* cacheable */
+ dir = cache[DIRECTION_CACHE_RANGE + dx][DIRECTION_CACHE_RANGE + dy];
+ if (dir == 0) {
+ dir = DoGetDirection(dx, dy);
+ cache[DIRECTION_CACHE_RANGE + dx][DIRECTION_CACHE_RANGE + dy] = dir;
+ }
+ }
+ else {
+ /* non-cacheable */
+ dir = DoGetDirection(dx, dy);
}
return dir;
@@ -547,7 +556,6 @@ GetDirection(int dx, int dy){
#undef DIRECTION_CACHE_RANGE
#undef DIRECTION_CACHE_SIZE
-
/* convert offset (age) to array index */
#define TRACKER_INDEX(s, d) (((s)->num_tracker + (s)->cur_tracker - (d)) % (s)->num_tracker)
#define TRACKER(s, d) &(s)->tracker[TRACKER_INDEX(s,d)]
@@ -560,9 +568,10 @@ static inline void
FeedTrackers(DeviceVelocityPtr vel, double dx, double dy, int cur_t)
{
int n;
- for(n = 0; n < vel->num_tracker; n++){
- vel->tracker[n].dx += dx;
- vel->tracker[n].dy += dy;
+
+ for (n = 0; n < vel->num_tracker; n++) {
+ vel->tracker[n].dx += dx;
+ vel->tracker[n].dy += dy;
}
n = (vel->cur_tracker + 1) % vel->num_tracker;
vel->tracker[n].dx = 0.0;
@@ -581,13 +590,15 @@ FeedTrackers(DeviceVelocityPtr vel, double dx, double dy, int cur_t)
* This assumes linear motion.
*/
static double
-CalcTracker(const MotionTracker *tracker, int cur_t){
+CalcTracker(const MotionTracker * tracker, int cur_t)
+{
double dist = sqrt(tracker->dx * tracker->dx + tracker->dy * tracker->dy);
int dtime = cur_t - tracker->time;
- if(dtime > 0)
- return dist / dtime;
+
+ if (dtime > 0)
+ return dist / dtime;
else
- return 0;/* synonymous for NaN, since we're not C99 */
+ return 0; /* synonymous for NaN, since we're not C99 */
}
/* find the most plausible velocity. That is, the most distant
@@ -598,71 +609,79 @@ CalcTracker(const MotionTracker *tracker, int cur_t){
* @return The tracker's velocity or 0 if the above conditions are unmet
*/
static double
-QueryTrackers(DeviceVelocityPtr vel, int cur_t){
+QueryTrackers(DeviceVelocityPtr vel, int cur_t)
+{
int offset, dir = UNDEFINED, used_offset = -1, age_ms;
+
/* initial velocity: a low-offset, valid velocity */
double initial_velocity = 0, result = 0, velocity_diff;
- double velocity_factor = vel->corr_mul * vel->const_acceleration; /* premultiply */
+ double velocity_factor = vel->corr_mul * vel->const_acceleration; /* premultiply */
+
/* loop from current to older data */
- for(offset = 1; offset < vel->num_tracker; offset++){
- MotionTracker *tracker = TRACKER(vel, offset);
- double tracker_velocity;
-
- age_ms = cur_t - tracker->time;
-
- /* bail out if data is too old and protect from overrun */
- if (age_ms >= vel->reset_time || age_ms < 0) {
- DebugAccelF("(dix prtacc) query: tracker too old\n");
- break;
- }
-
- /*
- * this heuristic avoids using the linear-motion velocity formula
- * in CalcTracker() on motion that isn't exactly linear. So to get
- * even more precision we could subdivide as a final step, so possible
- * non-linearities are accounted for.
- */
- dir &= tracker->dir;
- if(dir == 0){ /* we've changed octant of movement (e.g. NE → NW) */
- DebugAccelF("(dix prtacc) query: no longer linear\n");
- /* instead of breaking it we might also inspect the partition after,
- * but actual improvement with this is probably rare. */
- break;
- }
-
- tracker_velocity = CalcTracker(tracker, cur_t) * velocity_factor;
-
- if ((initial_velocity == 0 || offset <= vel->initial_range) && tracker_velocity != 0) {
- /* set initial velocity and result */
- result = initial_velocity = tracker_velocity;
- used_offset = offset;
- } else if (initial_velocity != 0 && tracker_velocity != 0) {
- velocity_diff = fabs(initial_velocity - tracker_velocity);
-
- if (velocity_diff > vel->max_diff &&
- velocity_diff/(initial_velocity + tracker_velocity) >= vel->max_rel_diff) {
- /* we're not in range, quit - it won't get better. */
- DebugAccelF("(dix prtacc) query: tracker too different:"
- " old %2.2f initial %2.2f diff: %2.2f\n",
- tracker_velocity, initial_velocity, velocity_diff);
- break;
- }
- /* we're in range with the initial velocity,
- * so this result is likely better
- * (it contains more information). */
- result = tracker_velocity;
- used_offset = offset;
- }
+ for (offset = 1; offset < vel->num_tracker; offset++) {
+ MotionTracker *tracker = TRACKER(vel, offset);
+ double tracker_velocity;
+
+ age_ms = cur_t - tracker->time;
+
+ /* bail out if data is too old and protect from overrun */
+ if (age_ms >= vel->reset_time || age_ms < 0) {
+ DebugAccelF("(dix prtacc) query: tracker too old\n");
+ break;
+ }
+
+ /*
+ * this heuristic avoids using the linear-motion velocity formula
+ * in CalcTracker() on motion that isn't exactly linear. So to get
+ * even more precision we could subdivide as a final step, so possible
+ * non-linearities are accounted for.
+ */
+ dir &= tracker->dir;
+ if (dir == 0) { /* we've changed octant of movement (e.g. NE → NW) */
+ DebugAccelF("(dix prtacc) query: no longer linear\n");
+ /* instead of breaking it we might also inspect the partition after,
+ * but actual improvement with this is probably rare. */
+ break;
+ }
+
+ tracker_velocity = CalcTracker(tracker, cur_t) * velocity_factor;
+
+ if ((initial_velocity == 0 || offset <= vel->initial_range) &&
+ tracker_velocity != 0) {
+ /* set initial velocity and result */
+ result = initial_velocity = tracker_velocity;
+ used_offset = offset;
+ }
+ else if (initial_velocity != 0 && tracker_velocity != 0) {
+ velocity_diff = fabs(initial_velocity - tracker_velocity);
+
+ if (velocity_diff > vel->max_diff &&
+ velocity_diff / (initial_velocity + tracker_velocity) >=
+ vel->max_rel_diff) {
+ /* we're not in range, quit - it won't get better. */
+ DebugAccelF("(dix prtacc) query: tracker too different:"
+ " old %2.2f initial %2.2f diff: %2.2f\n",
+ tracker_velocity, initial_velocity, velocity_diff);
+ break;
+ }
+ /* we're in range with the initial velocity,
+ * so this result is likely better
+ * (it contains more information). */
+ result = tracker_velocity;
+ used_offset = offset;
+ }
}
- if(offset == vel->num_tracker){
- DebugAccelF("(dix prtacc) query: last tracker in effect\n");
- used_offset = vel->num_tracker-1;
+ if (offset == vel->num_tracker) {
+ DebugAccelF("(dix prtacc) query: last tracker in effect\n");
+ used_offset = vel->num_tracker - 1;
}
- if(used_offset >= 0){
+ if (used_offset >= 0) {
#ifdef PTRACCEL_DEBUGGING
- MotionTracker *tracker = TRACKER(vel, used_offset);
- DebugAccelF("(dix prtacc) result: offset %i [dx: %i dy: %i diff: %i]\n",
- used_offset, tracker->dx, tracker->dy, cur_t - tracker->time);
+ MotionTracker *tracker = TRACKER(vel, used_offset);
+
+ DebugAccelF("(dix prtacc) result: offset %i [dx: %i dy: %i diff: %i]\n",
+ used_offset, tracker->dx, tracker->dy,
+ cur_t - tracker->time);
#endif
}
return result;
@@ -676,11 +695,7 @@ QueryTrackers(DeviceVelocityPtr vel, int cur_t){
* return true if non-visible state reset is suggested
*/
BOOL
-ProcessVelocityData2D(
- DeviceVelocityPtr vel,
- double dx,
- double dy,
- int time)
+ProcessVelocityData2D(DeviceVelocityPtr vel, double dx, double dy, int time)
{
double velocity;
@@ -704,15 +719,14 @@ ApplySimpleSoftening(double prev_delta, double delta)
double result = delta;
if (delta < -1.0 || delta > 1.0) {
- if (delta > prev_delta)
- result -= 0.5;
- else if (delta < prev_delta)
- result += 0.5;
+ if (delta > prev_delta)
+ result -= 0.5;
+ else if (delta < prev_delta)
+ result += 0.5;
}
return result;
}
-
/**
* Soften the delta based on previous deltas stored in vel.
*
@@ -720,10 +734,7 @@ ApplySimpleSoftening(double prev_delta, double delta)
* @param[in,out] fdx Delta Y, modified in-place.
*/
static void
-ApplySoftening(
- DeviceVelocityPtr vel,
- double* fdx,
- double* fdy)
+ApplySoftening(DeviceVelocityPtr vel, double *fdx, double *fdy)
{
if (vel->use_softening) {
*fdx = ApplySimpleSoftening(vel->last_dx, *fdx);
@@ -742,19 +753,18 @@ ApplyConstantDeceleration(DeviceVelocityPtr vel, double *fdx, double *fdy)
* compute the acceleration for given velocity and enforce min_acceleartion
*/
double
-BasicComputeAcceleration(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- double velocity,
- double threshold,
- double acc){
+BasicComputeAcceleration(DeviceIntPtr dev,
+ DeviceVelocityPtr vel,
+ double velocity, double threshold, double acc)
+{
double result;
+
result = vel->Profile(dev, vel, velocity, threshold, acc);
/* enforce min_acceleration */
if (result < vel->min_acceleration)
- result = vel->min_acceleration;
+ result = vel->min_acceleration;
return result;
}
@@ -764,47 +774,48 @@ BasicComputeAcceleration(
* current velocity, last velocity and 4 times the average between the two.
*/
static double
-ComputeAcceleration(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- double threshold,
- double acc){
+ComputeAcceleration(DeviceIntPtr dev,
+ DeviceVelocityPtr vel, double threshold, double acc)
+{
double result;
- if(vel->velocity <= 0){
- DebugAccelF("(dix ptracc) profile skipped\n");
+ if (vel->velocity <= 0) {
+ DebugAccelF("(dix ptracc) profile skipped\n");
/*
* If we have no idea about device velocity, don't pretend it.
*/
- return 1;
+ return 1;
}
- if(vel->average_accel && vel->velocity != vel->last_velocity){
- /* use simpson's rule to average acceleration between
- * current and previous velocity.
- * Though being the more natural choice, it causes a minor delay
- * in comparison, so it can be disabled. */
- result = BasicComputeAcceleration(
- dev, vel, vel->velocity, threshold, acc);
- result += BasicComputeAcceleration(
- dev, vel, vel->last_velocity, threshold, acc);
- result += 4.0f * BasicComputeAcceleration(dev, vel,
- (vel->last_velocity + vel->velocity) / 2,
- threshold, acc);
- result /= 6.0f;
- DebugAccelF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n",
- vel->velocity, vel->last_velocity, result);
- }else{
- result = BasicComputeAcceleration(dev, vel,
- vel->velocity, threshold, acc);
- DebugAccelF("(dix ptracc) profile sample [%.2f] is %.3f\n",
- vel->velocity, res);
+ if (vel->average_accel && vel->velocity != vel->last_velocity) {
+ /* use simpson's rule to average acceleration between
+ * current and previous velocity.
+ * Though being the more natural choice, it causes a minor delay
+ * in comparison, so it can be disabled. */
+ result =
+ BasicComputeAcceleration(dev, vel, vel->velocity, threshold, acc);
+ result +=
+ BasicComputeAcceleration(dev, vel, vel->last_velocity, threshold,
+ acc);
+ result +=
+ 4.0f * BasicComputeAcceleration(dev, vel,
+ (vel->last_velocity +
+ vel->velocity) / 2, threshold,
+ acc);
+ result /= 6.0f;
+ DebugAccelF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n",
+ vel->velocity, vel->last_velocity, result);
+ }
+ else {
+ result = BasicComputeAcceleration(dev, vel,
+ vel->velocity, threshold, acc);
+ DebugAccelF("(dix ptracc) profile sample [%.2f] is %.3f\n",
+ vel->velocity, res);
}
return result;
}
-
/*****************************************
* Acceleration functions and profiles
****************************************/
@@ -813,45 +824,30 @@ ComputeAcceleration(
* Polynomial function similar previous one, but with f(1) = 1
*/
static double
-PolynomialAccelerationProfile(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- double velocity,
- double ignored,
- double acc)
+PolynomialAccelerationProfile(DeviceIntPtr dev,
+ DeviceVelocityPtr vel,
+ double velocity, double ignored, double acc)
{
- return pow(velocity, (acc - 1.0) * 0.5);
+ return pow(velocity, (acc - 1.0) * 0.5);
}
-
/**
* returns acceleration for velocity.
* This profile selects the two functions like the old scheme did
*/
static double
-ClassicProfile(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- double velocity,
- double threshold,
- double acc)
+ClassicProfile(DeviceIntPtr dev,
+ DeviceVelocityPtr vel,
+ double velocity, double threshold, double acc)
{
if (threshold > 0) {
- return SimpleSmoothProfile (dev,
- vel,
- velocity,
- threshold,
- acc);
- } else {
- return PolynomialAccelerationProfile (dev,
- vel,
- velocity,
- 0,
- acc);
+ return SimpleSmoothProfile(dev, vel, velocity, threshold, acc);
+ }
+ else {
+ return PolynomialAccelerationProfile(dev, vel, velocity, 0, acc);
}
}
-
/**
* Power profile
* This has a completely smooth transition curve, i.e. no jumps in the
@@ -861,16 +857,13 @@ ClassicProfile(
* In effect, min_acceleration mimics const_acceleration in this profile.
*/
static double
-PowerProfile(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- double velocity,
- double threshold,
- double acc)
+PowerProfile(DeviceIntPtr dev,
+ DeviceVelocityPtr vel,
+ double velocity, double threshold, double acc)
{
double vel_dist;
- acc = (acc-1.0) * 0.1f + 1.0; /* without this, acc of 2 is unuseable */
+ acc = (acc - 1.0) * 0.1f + 1.0; /* without this, acc of 2 is unuseable */
if (velocity <= threshold)
return vel->min_acceleration;
@@ -878,7 +871,6 @@ PowerProfile(
return (pow(acc, vel_dist)) * vel->min_acceleration;
}
-
/**
* just a smooth function in [0..1] -> [0..1]
* - point symmetry at 0.5
@@ -887,28 +879,25 @@ PowerProfile(
* - smoothness C1 (Cinf if you dare to ignore endpoints)
*/
static inline double
-CalcPenumbralGradient(double x){
+CalcPenumbralGradient(double x)
+{
x *= 2.0f;
x -= 1.0f;
- return 0.5f + (x * sqrt(1.0 - x*x) + asin(x))/M_PI;
+ return 0.5f + (x * sqrt(1.0 - x * x) + asin(x)) / M_PI;
}
-
/**
* acceleration function similar to classic accelerated/unaccelerated,
* but with smooth transition in between (and towards zero for adaptive dec.).
*/
static double
-SimpleSmoothProfile(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- double velocity,
- double threshold,
- double acc)
+SimpleSmoothProfile(DeviceIntPtr dev,
+ DeviceVelocityPtr vel,
+ double velocity, double threshold, double acc)
{
- if(velocity < 1.0f)
- return CalcPenumbralGradient(0.5 + velocity*0.5) * 2.0f - 1.0f;
- if(threshold < 1.0f)
+ if (velocity < 1.0f)
+ return CalcPenumbralGradient(0.5 + velocity * 0.5) * 2.0f - 1.0f;
+ if (threshold < 1.0f)
threshold = 1.0f;
if (velocity <= threshold)
return 1;
@@ -916,118 +905,102 @@ SimpleSmoothProfile(
if (velocity >= acc)
return acc;
else
- return 1.0f + (CalcPenumbralGradient(velocity/acc) * (acc - 1.0f));
+ return 1.0f + (CalcPenumbralGradient(velocity / acc) * (acc - 1.0f));
}
-
/**
* This profile uses the first half of the penumbral gradient as a start
* and then scales linearly.
*/
static double
-SmoothLinearProfile(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- double velocity,
- double threshold,
- double acc)
+SmoothLinearProfile(DeviceIntPtr dev,
+ DeviceVelocityPtr vel,
+ double velocity, double threshold, double acc)
{
double res, nv;
- if(acc > 1.0f)
- acc -= 1.0f; /*this is so acc = 1 is no acceleration */
+ if (acc > 1.0f)
+ acc -= 1.0f; /*this is so acc = 1 is no acceleration */
else
return 1.0f;
nv = (velocity - threshold) * acc * 0.5f;
- if(nv < 0){
+ if (nv < 0) {
res = 0;
- }else if(nv < 2){
- res = CalcPenumbralGradient(nv*0.25f)*2.0f;
- }else{
+ }
+ else if (nv < 2) {
+ res = CalcPenumbralGradient(nv * 0.25f) * 2.0f;
+ }
+ else {
nv -= 2.0f;
res = nv * 2.0f / M_PI /* steepness of gradient at 0.5 */
- + 1.0f; /* gradient crosses 2|1 */
+ + 1.0f; /* gradient crosses 2|1 */
}
res += vel->min_acceleration;
return res;
}
-
/**
* From 0 to threshold, the response graduates smoothly from min_accel to
* acceleration. Beyond threshold it is exactly the specified acceleration.
*/
static double
-SmoothLimitedProfile(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- double velocity,
- double threshold,
- double acc)
+SmoothLimitedProfile(DeviceIntPtr dev,
+ DeviceVelocityPtr vel,
+ double velocity, double threshold, double acc)
{
double res;
- if(velocity >= threshold || threshold == 0.0f)
- return acc;
+ if (velocity >= threshold || threshold == 0.0f)
+ return acc;
- velocity /= threshold; /* should be [0..1[ now */
+ velocity /= threshold; /* should be [0..1[ now */
res = CalcPenumbralGradient(velocity) * (acc - vel->min_acceleration);
return vel->min_acceleration + res;
}
-
static double
-LinearProfile(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- double velocity,
- double threshold,
- double acc)
+LinearProfile(DeviceIntPtr dev,
+ DeviceVelocityPtr vel,
+ double velocity, double threshold, double acc)
{
return acc * velocity;
}
static double
-NoProfile(
- DeviceIntPtr dev,
- DeviceVelocityPtr vel,
- double velocity,
- double threshold,
- double acc)
+NoProfile(DeviceIntPtr dev,
+ DeviceVelocityPtr vel, double velocity, double threshold, double acc)
{
return 1.0f;
}
static PointerAccelerationProfileFunc
-GetAccelerationProfile(
- DeviceVelocityPtr vel,
- int profile_num)
+GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num)
{
- switch(profile_num){
- case AccelProfileClassic:
- return ClassicProfile;
- case AccelProfileDeviceSpecific:
- return vel->deviceSpecificProfile;
- case AccelProfilePolynomial:
- return PolynomialAccelerationProfile;
- case AccelProfileSmoothLinear:
- return SmoothLinearProfile;
- case AccelProfileSimple:
- return SimpleSmoothProfile;
- case AccelProfilePower:
- return PowerProfile;
- case AccelProfileLinear:
- return LinearProfile;
- case AccelProfileSmoothLimited:
- return SmoothLimitedProfile;
- case AccelProfileNone:
- return NoProfile;
- default:
- return NULL;
+ switch (profile_num) {
+ case AccelProfileClassic:
+ return ClassicProfile;
+ case AccelProfileDeviceSpecific:
+ return vel->deviceSpecificProfile;
+ case AccelProfilePolynomial:
+ return PolynomialAccelerationProfile;
+ case AccelProfileSmoothLinear:
+ return SmoothLinearProfile;
+ case AccelProfileSimple:
+ return SimpleSmoothProfile;
+ case AccelProfilePower:
+ return PowerProfile;
+ case AccelProfileLinear:
+ return LinearProfile;
+ case AccelProfileSmoothLimited:
+ return SmoothLimitedProfile;
+ case AccelProfileNone:
+ return NoProfile;
+ default:
+ return NULL;
}
}
@@ -1042,15 +1015,14 @@ GetAccelerationProfile(
* returns FALSE if profile number is unavailable, TRUE otherwise.
*/
int
-SetAccelerationProfile(
- DeviceVelocityPtr vel,
- int profile_num)
+SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num)
{
PointerAccelerationProfileFunc profile;
+
profile = GetAccelerationProfile(vel, profile_num);
- if(profile == NULL && profile_num != PROFILE_UNINITIALIZE)
- return FALSE;
+ if (profile == NULL && profile_num != PROFILE_UNINITIALIZE)
+ return FALSE;
/* Here one could free old profile-private data */
free(vel->profile_private);
@@ -1065,7 +1037,6 @@ SetAccelerationProfile(
* driver interaction
**********************************************/
-
/**
* device-specific profile
*
@@ -1076,12 +1047,11 @@ SetAccelerationProfile(
* Users may override or choose it.
*/
void
-SetDeviceSpecificAccelerationProfile(
- DeviceVelocityPtr vel,
- PointerAccelerationProfileFunc profile)
+SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
+ PointerAccelerationProfileFunc profile)
{
- if(vel)
- vel->deviceSpecificProfile = profile;
+ if (vel)
+ vel->deviceSpecificProfile = profile;
}
/**
@@ -1089,21 +1059,20 @@ SetDeviceSpecificAccelerationProfile(
* the predictable acceleration scheme is not in effect.
*/
DeviceVelocityPtr
-GetDevicePredictableAccelData(
- DeviceIntPtr dev)
+GetDevicePredictableAccelData(DeviceIntPtr dev)
{
- /*sanity check*/
- if(!dev){
- ErrorF("[dix] accel: DeviceIntPtr was NULL");
- return NULL;
+ /*sanity check */
+ if (!dev) {
+ ErrorF("[dix] accel: DeviceIntPtr was NULL");
+ return NULL;
}
- if( dev->valuator &&
- dev->valuator->accelScheme.AccelSchemeProc ==
- acceleratePointerPredictable &&
- dev->valuator->accelScheme.accelData != NULL){
+ if (dev->valuator &&
+ dev->valuator->accelScheme.AccelSchemeProc ==
+ acceleratePointerPredictable &&
+ dev->valuator->accelScheme.accelData != NULL) {
- return ((PredictableAccelSchemePtr)
- dev->valuator->accelScheme.accelData)->vel;
+ return ((PredictableAccelSchemePtr)
+ dev->valuator->accelScheme.accelData)->vel;
}
return NULL;
}
@@ -1118,10 +1087,7 @@ GetDevicePredictableAccelData(
* enable fine-grained predictable acceleration profiles.
*/
void
-acceleratePointerPredictable(
- DeviceIntPtr dev,
- ValuatorMask* val,
- CARD32 evtime)
+acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime)
{
double dx = 0, dy = 0;
DeviceVelocityPtr velocitydata = GetDevicePredictableAccelData(dev);
@@ -1132,7 +1098,7 @@ acceleratePointerPredictable(
if (velocitydata->statistics.profile_number == AccelProfileNone &&
velocitydata->const_acceleration == 1.0f) {
- return; /*we're inactive anyway, so skip the whole thing.*/
+ return; /*we're inactive anyway, so skip the whole thing. */
}
if (valuator_mask_isset(val, 0)) {
@@ -1145,7 +1111,7 @@ acceleratePointerPredictable(
if (dx != 0.0 || dy != 0.0) {
/* reset non-visible state? */
- if (ProcessVelocityData2D(velocitydata, dx , dy, evtime)) {
+ if (ProcessVelocityData2D(velocitydata, dx, dy, evtime)) {
soften = FALSE;
}
@@ -1153,12 +1119,12 @@ acceleratePointerPredictable(
double mult;
/* invoke acceleration profile to determine acceleration */
- mult = ComputeAcceleration (dev, velocitydata,
- dev->ptrfeed->ctrl.threshold,
- (double)dev->ptrfeed->ctrl.num /
- (double)dev->ptrfeed->ctrl.den);
+ mult = ComputeAcceleration(dev, velocitydata,
+ dev->ptrfeed->ctrl.threshold,
+ (double) dev->ptrfeed->ctrl.num /
+ (double) dev->ptrfeed->ctrl.den);
- if(mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
+ if (mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
if (mult > 1.0f && soften)
ApplySoftening(velocitydata, &dx, &dy);
ApplyConstantDeceleration(velocitydata, &dx, &dy);
@@ -1177,17 +1143,13 @@ acceleratePointerPredictable(
velocitydata->last_dy = dy;
}
-
-
/**
* Originally a part of xf86PostMotionEvent; modifies valuators
* in-place. Retained mostly for embedded scenarios.
*/
void
-acceleratePointerLightweight(
- DeviceIntPtr dev,
- ValuatorMask* val,
- CARD32 ignored)
+acceleratePointerLightweight(DeviceIntPtr dev,
+ ValuatorMask *val, CARD32 ignored)
{
double mult = 0.0, tmpf;
double dx = 0.0, dy = 0.0;
@@ -1208,23 +1170,22 @@ acceleratePointerLightweight(
if (dev->ptrfeed->ctrl.threshold) {
if ((fabs(dx) + fabs(dy)) >= dev->ptrfeed->ctrl.threshold) {
if (dx != 0.0) {
- tmpf = (dx * (double)(dev->ptrfeed->ctrl.num)) /
- (double)(dev->ptrfeed->ctrl.den);
+ tmpf = (dx * (double) (dev->ptrfeed->ctrl.num)) /
+ (double) (dev->ptrfeed->ctrl.den);
valuator_mask_set_double(val, 0, tmpf);
}
if (dy != 0.0) {
- tmpf = (dy * (double)(dev->ptrfeed->ctrl.num)) /
- (double)(dev->ptrfeed->ctrl.den);
+ tmpf = (dy * (double) (dev->ptrfeed->ctrl.num)) /
+ (double) (dev->ptrfeed->ctrl.den);
valuator_mask_set_double(val, 1, tmpf);
}
}
}
else {
- mult = pow(dx * dx + dy * dy,
- ((double)(dev->ptrfeed->ctrl.num) /
- (double)(dev->ptrfeed->ctrl.den) - 1.0) /
- 2.0) / 2.0;
+ mult = pow(dx * dx + dy * dy,
+ ((double) (dev->ptrfeed->ctrl.num) /
+ (double) (dev->ptrfeed->ctrl.den) - 1.0) / 2.0) / 2.0;
if (dx != 0.0)
valuator_mask_set_double(val, 0, mult * dx);
if (dy != 0.0)
diff --git a/xorg-server/dix/region.c b/xorg-server/dix/region.c
index 6820c1eac..737d2a861 100644
--- a/xorg-server/dix/region.c
+++ b/xorg-server/dix/region.c
@@ -202,7 +202,6 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
assert(pReg->data->numRects<=pReg->data->size); \
}
-
#define DOWNSIZE(reg,numRects) \
if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
{ \
@@ -215,17 +214,17 @@ if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
} \
}
+BoxRec RegionEmptyBox = { 0, 0, 0, 0 };
+RegDataRec RegionEmptyData = { 0, 0 };
-BoxRec RegionEmptyBox = {0, 0, 0, 0};
-RegDataRec RegionEmptyData = {0, 0};
-
-RegDataRec RegionBrokenData = {0, 0};
-static RegionRec RegionBrokenRegion = { { 0, 0, 0, 0 }, &RegionBrokenData };
+RegDataRec RegionBrokenData = { 0, 0 };
+static RegionRec RegionBrokenRegion = { {0, 0, 0, 0}, &RegionBrokenData };
void
-InitRegions (void)
+InitRegions(void)
{
- pixman_region_set_static_pointers (&RegionEmptyBox, &RegionEmptyData, &RegionBrokenData);
+ pixman_region_set_static_pointers(&RegionEmptyBox, &RegionEmptyData,
+ &RegionBrokenData);
}
/*****************************************************************
@@ -238,22 +237,22 @@ RegionPtr
RegionCreate(BoxPtr rect, int size)
{
RegionPtr pReg;
-
- pReg = (RegionPtr)malloc(sizeof(RegionRec));
+
+ pReg = (RegionPtr) malloc(sizeof(RegionRec));
if (!pReg)
- return &RegionBrokenRegion;
+ return &RegionBrokenRegion;
+
+ RegionInit(pReg, rect, size);
- RegionInit (pReg, rect, size);
-
return pReg;
}
void
RegionDestroy(RegionPtr pReg)
{
- pixman_region_fini (pReg);
+ pixman_region_fini(pReg);
if (pReg != &RegionBrokenRegion)
- free(pReg);
+ free(pReg);
}
void
@@ -268,10 +267,10 @@ RegionPrint(RegionPtr rgn)
rects = RegionRects(rgn);
ErrorF("[mi] num: %d size: %d\n", num, size);
ErrorF("[mi] extents: %d %d %d %d\n",
- rgn->extents.x1, rgn->extents.y1, rgn->extents.x2, rgn->extents.y2);
+ rgn->extents.x1, rgn->extents.y1, rgn->extents.x2, rgn->extents.y2);
for (i = 0; i < num; i++)
- ErrorF("[mi] %d %d %d %d \n",
- rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
+ ErrorF("[mi] %d %d %d %d \n",
+ rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
ErrorF("[mi] \n");
}
@@ -280,52 +279,48 @@ Bool
RegionIsValid(RegionPtr reg)
{
int i, numRects;
-
+
if ((reg->extents.x1 > reg->extents.x2) ||
- (reg->extents.y1 > reg->extents.y2))
- return FALSE;
+ (reg->extents.y1 > reg->extents.y2))
+ return FALSE;
numRects = RegionNumRects(reg);
if (!numRects)
- return ((reg->extents.x1 == reg->extents.x2) &&
- (reg->extents.y1 == reg->extents.y2) &&
- (reg->data->size || (reg->data == &RegionEmptyData)));
+ return ((reg->extents.x1 == reg->extents.x2) &&
+ (reg->extents.y1 == reg->extents.y2) &&
+ (reg->data->size || (reg->data == &RegionEmptyData)));
else if (numRects == 1)
- return !reg->data;
- else
- {
- BoxPtr pboxP, pboxN;
- BoxRec box;
-
- pboxP = RegionRects(reg);
- box = *pboxP;
- box.y2 = pboxP[numRects-1].y2;
- pboxN = pboxP + 1;
- for (i = numRects; --i > 0; pboxP++, pboxN++)
- {
- if ((pboxN->x1 >= pboxN->x2) ||
- (pboxN->y1 >= pboxN->y2))
- return FALSE;
- if (pboxN->x1 < box.x1)
- box.x1 = pboxN->x1;
- if (pboxN->x2 > box.x2)
- box.x2 = pboxN->x2;
- if ((pboxN->y1 < pboxP->y1) ||
- ((pboxN->y1 == pboxP->y1) &&
- ((pboxN->x1 < pboxP->x2) || (pboxN->y2 != pboxP->y2))))
- return FALSE;
- }
- return ((box.x1 == reg->extents.x1) &&
- (box.x2 == reg->extents.x2) &&
- (box.y1 == reg->extents.y1) &&
- (box.y2 == reg->extents.y2));
+ return !reg->data;
+ else {
+ BoxPtr pboxP, pboxN;
+ BoxRec box;
+
+ pboxP = RegionRects(reg);
+ box = *pboxP;
+ box.y2 = pboxP[numRects - 1].y2;
+ pboxN = pboxP + 1;
+ for (i = numRects; --i > 0; pboxP++, pboxN++) {
+ if ((pboxN->x1 >= pboxN->x2) || (pboxN->y1 >= pboxN->y2))
+ return FALSE;
+ if (pboxN->x1 < box.x1)
+ box.x1 = pboxN->x1;
+ if (pboxN->x2 > box.x2)
+ box.x2 = pboxN->x2;
+ if ((pboxN->y1 < pboxP->y1) ||
+ ((pboxN->y1 == pboxP->y1) &&
+ ((pboxN->x1 < pboxP->x2) || (pboxN->y2 != pboxP->y2))))
+ return FALSE;
+ }
+ return ((box.x1 == reg->extents.x1) &&
+ (box.x2 == reg->extents.x2) &&
+ (box.y1 == reg->extents.y1) && (box.y2 == reg->extents.y2));
}
}
-#endif /* DEBUG */
+#endif /* DEBUG */
Bool
-RegionBreak (RegionPtr pReg)
+RegionBreak(RegionPtr pReg)
{
- xfreeData (pReg);
+ xfreeData(pReg);
pReg->extents = RegionEmptyBox;
pReg->data = &RegionBrokenData;
return FALSE;
@@ -334,37 +329,33 @@ RegionBreak (RegionPtr pReg)
Bool
RegionRectAlloc(RegionPtr pRgn, int n)
{
- RegDataPtr data;
-
- if (!pRgn->data)
- {
- n++;
- pRgn->data = xallocData(n);
- if (!pRgn->data)
- return RegionBreak (pRgn);
- pRgn->data->numRects = 1;
- *RegionBoxptr(pRgn) = pRgn->extents;
+ RegDataPtr data;
+
+ if (!pRgn->data) {
+ n++;
+ pRgn->data = xallocData(n);
+ if (!pRgn->data)
+ return RegionBreak(pRgn);
+ pRgn->data->numRects = 1;
+ *RegionBoxptr(pRgn) = pRgn->extents;
}
- else if (!pRgn->data->size)
- {
- pRgn->data = xallocData(n);
- if (!pRgn->data)
- return RegionBreak (pRgn);
- pRgn->data->numRects = 0;
+ else if (!pRgn->data->size) {
+ pRgn->data = xallocData(n);
+ if (!pRgn->data)
+ return RegionBreak(pRgn);
+ pRgn->data->numRects = 0;
}
- else
- {
- if (n == 1)
- {
- n = pRgn->data->numRects;
- if (n > 500) /* XXX pick numbers out of a hat */
- n = 250;
- }
- n += pRgn->data->numRects;
- data = (RegDataPtr)realloc(pRgn->data, RegionSizeof(n));
- if (!data)
- return RegionBreak (pRgn);
- pRgn->data = data;
+ else {
+ if (n == 1) {
+ n = pRgn->data->numRects;
+ if (n > 500) /* XXX pick numbers out of a hat */
+ n = 250;
+ }
+ n += pRgn->data->numRects;
+ data = (RegDataPtr) realloc(pRgn->data, RegionSizeof(n));
+ if (!data)
+ return RegionBreak(pRgn);
+ pRgn->data = data;
}
pRgn->data->size = n;
return TRUE;
@@ -393,22 +384,23 @@ RegionRectAlloc(RegionPtr pRgn, int n)
*-----------------------------------------------------------------------
*/
_X_INLINE static int
-RegionCoalesce (
- RegionPtr pReg, /* Region to coalesce */
- int prevStart, /* Index of start of previous band */
- int curStart) /* Index of start of current band */
-{
- BoxPtr pPrevBox; /* Current box in previous band */
- BoxPtr pCurBox; /* Current box in current band */
- int numRects; /* Number rectangles in both bands */
- int y2; /* Bottom of current band */
+RegionCoalesce(RegionPtr pReg, /* Region to coalesce */
+ int prevStart, /* Index of start of previous band */
+ int curStart)
+{ /* Index of start of current band */
+ BoxPtr pPrevBox; /* Current box in previous band */
+ BoxPtr pCurBox; /* Current box in current band */
+ int numRects; /* Number rectangles in both bands */
+ int y2; /* Bottom of current band */
+
/*
* Figure out how many rectangles are in the band.
*/
numRects = curStart - prevStart;
assert(numRects == pReg->data->numRects - curStart);
- if (!numRects) return curStart;
+ if (!numRects)
+ return curStart;
/*
* The bands may only be coalesced if the bottom of the previous
@@ -416,7 +408,8 @@ RegionCoalesce (
*/
pPrevBox = RegionBox(pReg, prevStart);
pCurBox = RegionBox(pReg, curStart);
- if (pPrevBox->y2 != pCurBox->y1) return curStart;
+ if (pPrevBox->y2 != pCurBox->y1)
+ return curStart;
/*
* Make sure the bands have boxes in the same places. This
@@ -427,12 +420,12 @@ RegionCoalesce (
y2 = pCurBox->y2;
do {
- if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) {
- return curStart;
- }
- pPrevBox++;
- pCurBox++;
- numRects--;
+ if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) {
+ return curStart;
+ }
+ pPrevBox++;
+ pCurBox++;
+ numRects--;
} while (numRects);
/*
@@ -442,14 +435,13 @@ RegionCoalesce (
numRects = curStart - prevStart;
pReg->data->numRects -= numRects;
do {
- pPrevBox--;
- pPrevBox->y2 = y2;
- numRects--;
+ pPrevBox--;
+ pPrevBox->y2 = y2;
+ numRects--;
} while (numRects);
return prevStart;
}
-
/* Quicky macro to avoid trivial reject procedure calls to RegionCoalesce */
#define Coalesce(newReg, prevBand, curBand) \
@@ -477,15 +469,10 @@ RegionCoalesce (
*/
_X_INLINE static Bool
-RegionAppendNonO (
- RegionPtr pReg,
- BoxPtr r,
- BoxPtr rEnd,
- int y1,
- int y2)
+RegionAppendNonO(RegionPtr pReg, BoxPtr r, BoxPtr rEnd, int y1, int y2)
{
- BoxPtr pNextRect;
- int newRects;
+ BoxPtr pNextRect;
+ int newRects;
newRects = rEnd - r;
@@ -497,9 +484,9 @@ RegionAppendNonO (
pNextRect = RegionTop(pReg);
pReg->data->numRects += newRects;
do {
- assert(r->x1 < r->x2);
- ADDRECT(pNextRect, r->x1, y1, r->x2, y2);
- r++;
+ assert(r->x1 < r->x2);
+ ADDRECT(pNextRect, r->x1, y1, r->x2, y2);
+ r++;
} while (r != rEnd);
return TRUE;
@@ -554,58 +541,54 @@ RegionAppendNonO (
*-----------------------------------------------------------------------
*/
-typedef Bool (*OverlapProcPtr)(
- RegionPtr pReg,
- BoxPtr r1,
- BoxPtr r1End,
- BoxPtr r2,
- BoxPtr r2End,
- short y1,
- short y2,
- Bool *pOverlap);
+typedef Bool (*OverlapProcPtr) (RegionPtr pReg,
+ BoxPtr r1,
+ BoxPtr r1End,
+ BoxPtr r2,
+ BoxPtr r2End,
+ short y1, short y2, Bool *pOverlap);
static Bool
-RegionOp(
- RegionPtr newReg, /* Place to store result */
- RegionPtr reg1, /* First region in operation */
- RegionPtr reg2, /* 2d region in operation */
- OverlapProcPtr overlapFunc, /* Function to call for over-
- * lapping bands */
- Bool appendNon1, /* Append non-overlapping bands */
- /* in region 1 ? */
- Bool appendNon2, /* Append non-overlapping bands */
- /* in region 2 ? */
- Bool *pOverlap)
+RegionOp(RegionPtr newReg, /* Place to store result */
+ RegionPtr reg1, /* First region in operation */
+ RegionPtr reg2, /* 2d region in operation */
+ OverlapProcPtr overlapFunc, /* Function to call for over-
+ * lapping bands */
+ Bool appendNon1, /* Append non-overlapping bands */
+ /* in region 1 ? */
+ Bool appendNon2, /* Append non-overlapping bands */
+ /* in region 2 ? */
+ Bool *pOverlap)
{
- BoxPtr r1; /* Pointer into first region */
- BoxPtr r2; /* Pointer into 2d region */
- BoxPtr r1End; /* End of 1st region */
- BoxPtr r2End; /* End of 2d region */
- short ybot; /* Bottom of intersection */
- short ytop; /* Top of intersection */
- RegDataPtr oldData; /* Old data for newReg */
- int prevBand; /* Index of start of
- * previous band in newReg */
- int curBand; /* Index of start of current
- * band in newReg */
- BoxPtr r1BandEnd; /* End of current band in r1 */
- BoxPtr r2BandEnd; /* End of current band in r2 */
- short top; /* Top of non-overlapping band */
- short bot; /* Bottom of non-overlapping band*/
- int r1y1; /* Temps for r1->y1 and r2->y1 */
- int r2y1;
- int newSize;
- int numRects;
+ BoxPtr r1; /* Pointer into first region */
+ BoxPtr r2; /* Pointer into 2d region */
+ BoxPtr r1End; /* End of 1st region */
+ BoxPtr r2End; /* End of 2d region */
+ short ybot; /* Bottom of intersection */
+ short ytop; /* Top of intersection */
+ RegDataPtr oldData; /* Old data for newReg */
+ int prevBand; /* Index of start of
+ * previous band in newReg */
+ int curBand; /* Index of start of current
+ * band in newReg */
+ BoxPtr r1BandEnd; /* End of current band in r1 */
+ BoxPtr r2BandEnd; /* End of current band in r2 */
+ short top; /* Top of non-overlapping band */
+ short bot; /* Bottom of non-overlapping band */
+ int r1y1; /* Temps for r1->y1 and r2->y1 */
+ int r2y1;
+ int newSize;
+ int numRects;
/*
* Break any region computed from a broken region
*/
- if (RegionNar (reg1) || RegionNar(reg2))
- return RegionBreak (newReg);
-
+ if (RegionNar(reg1) || RegionNar(reg2))
+ return RegionBreak(newReg);
+
/*
* Initialization:
- * set r1, r2, r1End and r2End appropriately, save the rectangles
+ * set r1, r2, r1End and r2End appropriately, save the rectangles
* of the destination region until the end in case it's one of
* the two source regions, then mark the "new" region empty, allocating
* another array of rectangles for it to use.
@@ -622,39 +605,38 @@ RegionOp(
oldData = NULL;
if (((newReg == reg1) && (newSize > 1)) ||
- ((newReg == reg2) && (numRects > 1)))
- {
- oldData = newReg->data;
- newReg->data = &RegionEmptyData;
+ ((newReg == reg2) && (numRects > 1))) {
+ oldData = newReg->data;
+ newReg->data = &RegionEmptyData;
}
/* guess at new size */
if (numRects > newSize)
- newSize = numRects;
+ newSize = numRects;
newSize <<= 1;
if (!newReg->data)
- newReg->data = &RegionEmptyData;
+ newReg->data = &RegionEmptyData;
else if (newReg->data->size)
- newReg->data->numRects = 0;
+ newReg->data->numRects = 0;
if (newSize > newReg->data->size)
- if (!RegionRectAlloc(newReg, newSize))
- return FALSE;
+ if (!RegionRectAlloc(newReg, newSize))
+ return FALSE;
/*
* Initialize ybot.
* In the upcoming loop, ybot and ytop serve different functions depending
* on whether the band being handled is an overlapping or non-overlapping
* band.
- * In the case of a non-overlapping band (only one of the regions
+ * In the case of a non-overlapping band (only one of the regions
* has points in the band), ybot is the bottom of the most recent
* intersection and thus clips the top of the rectangles in that band.
* ytop is the top of the next intersection between the two regions and
* serves to clip the bottom of the rectangles in the current band.
- * For an overlapping band (where the two regions intersect), ytop clips
+ * For an overlapping band (where the two regions intersect), ytop clips
* the top of the rectangles of both regions and ybot clips the bottoms.
*/
ybot = min(r1->y1, r2->y1);
-
+
/*
* prevBand serves to mark the start of the previous band so rectangles
* can be coalesced into larger rectangles. qv. RegionCoalesce, above.
@@ -665,73 +647,77 @@ RegionOp(
* array of rectangles.
*/
prevBand = 0;
-
+
do {
- /*
- * This algorithm proceeds one source-band (as opposed to a
- * destination band, which is determined by where the two regions
- * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
- * rectangle after the last one in the current band for their
- * respective regions.
- */
- assert(r1 != r1End);
- assert(r2 != r2End);
-
- FindBand(r1, r1BandEnd, r1End, r1y1);
- FindBand(r2, r2BandEnd, r2End, r2y1);
-
- /*
- * First handle the band that doesn't intersect, if any.
- *
- * Note that attention is restricted to one band in the
- * non-intersecting region at once, so if a region has n
- * bands between the current position and the next place it overlaps
- * the other, this entire loop will be passed through n times.
- */
- if (r1y1 < r2y1) {
- if (appendNon1) {
- top = max(r1y1, ybot);
- bot = min(r1->y2, r2y1);
- if (top != bot) {
- curBand = newReg->data->numRects;
- RegionAppendNonO(newReg, r1, r1BandEnd, top, bot);
- Coalesce(newReg, prevBand, curBand);
- }
- }
- ytop = r2y1;
- } else if (r2y1 < r1y1) {
- if (appendNon2) {
- top = max(r2y1, ybot);
- bot = min(r2->y2, r1y1);
- if (top != bot) {
- curBand = newReg->data->numRects;
- RegionAppendNonO(newReg, r2, r2BandEnd, top, bot);
- Coalesce(newReg, prevBand, curBand);
- }
- }
- ytop = r1y1;
- } else {
- ytop = r1y1;
- }
-
- /*
- * Now see if we've hit an intersecting band. The two bands only
- * intersect if ybot > ytop
- */
- ybot = min(r1->y2, r2->y2);
- if (ybot > ytop) {
- curBand = newReg->data->numRects;
- (* overlapFunc)(newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot,
- pOverlap);
- Coalesce(newReg, prevBand, curBand);
- }
-
- /*
- * If we've finished with a band (y2 == ybot) we skip forward
- * in the region to the next band.
- */
- if (r1->y2 == ybot) r1 = r1BandEnd;
- if (r2->y2 == ybot) r2 = r2BandEnd;
+ /*
+ * This algorithm proceeds one source-band (as opposed to a
+ * destination band, which is determined by where the two regions
+ * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
+ * rectangle after the last one in the current band for their
+ * respective regions.
+ */
+ assert(r1 != r1End);
+ assert(r2 != r2End);
+
+ FindBand(r1, r1BandEnd, r1End, r1y1);
+ FindBand(r2, r2BandEnd, r2End, r2y1);
+
+ /*
+ * First handle the band that doesn't intersect, if any.
+ *
+ * Note that attention is restricted to one band in the
+ * non-intersecting region at once, so if a region has n
+ * bands between the current position and the next place it overlaps
+ * the other, this entire loop will be passed through n times.
+ */
+ if (r1y1 < r2y1) {
+ if (appendNon1) {
+ top = max(r1y1, ybot);
+ bot = min(r1->y2, r2y1);
+ if (top != bot) {
+ curBand = newReg->data->numRects;
+ RegionAppendNonO(newReg, r1, r1BandEnd, top, bot);
+ Coalesce(newReg, prevBand, curBand);
+ }
+ }
+ ytop = r2y1;
+ }
+ else if (r2y1 < r1y1) {
+ if (appendNon2) {
+ top = max(r2y1, ybot);
+ bot = min(r2->y2, r1y1);
+ if (top != bot) {
+ curBand = newReg->data->numRects;
+ RegionAppendNonO(newReg, r2, r2BandEnd, top, bot);
+ Coalesce(newReg, prevBand, curBand);
+ }
+ }
+ ytop = r1y1;
+ }
+ else {
+ ytop = r1y1;
+ }
+
+ /*
+ * Now see if we've hit an intersecting band. The two bands only
+ * intersect if ybot > ytop
+ */
+ ybot = min(r1->y2, r2->y2);
+ if (ybot > ytop) {
+ curBand = newReg->data->numRects;
+ (*overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot,
+ pOverlap);
+ Coalesce(newReg, prevBand, curBand);
+ }
+
+ /*
+ * If we've finished with a band (y2 == ybot) we skip forward
+ * in the region to the next band.
+ */
+ if (r1->y2 == ybot)
+ r1 = r1BandEnd;
+ if (r2->y2 == ybot)
+ r2 = r2BandEnd;
} while (r1 != r1End && r2 != r2End);
@@ -744,40 +730,38 @@ RegionOp(
*/
if ((r1 != r1End) && appendNon1) {
- /* Do first nonOverlap1Func call, which may be able to coalesce */
- FindBand(r1, r1BandEnd, r1End, r1y1);
- curBand = newReg->data->numRects;
- RegionAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2);
- Coalesce(newReg, prevBand, curBand);
- /* Just append the rest of the boxes */
- AppendRegions(newReg, r1BandEnd, r1End);
-
- } else if ((r2 != r2End) && appendNon2) {
- /* Do first nonOverlap2Func call, which may be able to coalesce */
- FindBand(r2, r2BandEnd, r2End, r2y1);
- curBand = newReg->data->numRects;
- RegionAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2);
- Coalesce(newReg, prevBand, curBand);
- /* Append rest of boxes */
- AppendRegions(newReg, r2BandEnd, r2End);
+ /* Do first nonOverlap1Func call, which may be able to coalesce */
+ FindBand(r1, r1BandEnd, r1End, r1y1);
+ curBand = newReg->data->numRects;
+ RegionAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2);
+ Coalesce(newReg, prevBand, curBand);
+ /* Just append the rest of the boxes */
+ AppendRegions(newReg, r1BandEnd, r1End);
+
+ }
+ else if ((r2 != r2End) && appendNon2) {
+ /* Do first nonOverlap2Func call, which may be able to coalesce */
+ FindBand(r2, r2BandEnd, r2End, r2y1);
+ curBand = newReg->data->numRects;
+ RegionAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2);
+ Coalesce(newReg, prevBand, curBand);
+ /* Append rest of boxes */
+ AppendRegions(newReg, r2BandEnd, r2End);
}
free(oldData);
- if (!(numRects = newReg->data->numRects))
- {
- xfreeData(newReg);
- newReg->data = &RegionEmptyData;
+ if (!(numRects = newReg->data->numRects)) {
+ xfreeData(newReg);
+ newReg->data = &RegionEmptyData;
}
- else if (numRects == 1)
- {
- newReg->extents = *RegionBoxptr(newReg);
- xfreeData(newReg);
- newReg->data = NULL;
+ else if (numRects == 1) {
+ newReg->extents = *RegionBoxptr(newReg);
+ xfreeData(newReg);
+ newReg->data = NULL;
}
- else
- {
- DOWNSIZE(newReg, numRects);
+ else {
+ DOWNSIZE(newReg, numRects);
}
return TRUE;
@@ -799,17 +783,16 @@ RegionOp(
*-----------------------------------------------------------------------
*/
static void
-RegionSetExtents (RegionPtr pReg)
+RegionSetExtents(RegionPtr pReg)
{
BoxPtr pBox, pBoxEnd;
if (!pReg->data)
- return;
- if (!pReg->data->size)
- {
- pReg->extents.x2 = pReg->extents.x1;
- pReg->extents.y2 = pReg->extents.y1;
- return;
+ return;
+ if (!pReg->data->size) {
+ pReg->extents.x2 = pReg->extents.x1;
+ pReg->extents.y2 = pReg->extents.y1;
+ return;
}
pBox = RegionBoxptr(pReg);
@@ -829,11 +812,11 @@ RegionSetExtents (RegionPtr pReg)
assert(pReg->extents.y1 < pReg->extents.y2);
while (pBox <= pBoxEnd) {
- if (pBox->x1 < pReg->extents.x1)
- pReg->extents.x1 = pBox->x1;
- if (pBox->x2 > pReg->extents.x2)
- pReg->extents.x2 = pBox->x2;
- pBox++;
+ if (pBox->x1 < pReg->extents.x1)
+ pReg->extents.x1 = pBox->x1;
+ if (pBox->x2 > pReg->extents.x2)
+ pReg->extents.x2 = pBox->x2;
+ pBox++;
};
assert(pReg->extents.x1 < pReg->extents.x2);
@@ -855,8 +838,7 @@ RegionSetExtents (RegionPtr pReg)
*
*-----------------------------------------------------------------------
*/
-/*ARGSUSED*/
-
+ /*ARGSUSED*/
#define MERGERECT(r) \
{ \
if (r->x1 <= x2) { \
@@ -871,11 +853,9 @@ RegionSetExtents (RegionPtr pReg)
} \
r++; \
}
-
/*======================================================================
* Region Union
*====================================================================*/
-
/*-
*-----------------------------------------------------------------------
* RegionUnionO --
@@ -891,60 +871,51 @@ RegionSetExtents (RegionPtr pReg)
*
*-----------------------------------------------------------------------
*/
-static Bool
-RegionUnionO (
- RegionPtr pReg,
- BoxPtr r1,
- BoxPtr r1End,
- BoxPtr r2,
- BoxPtr r2End,
- short y1,
- short y2,
- Bool *pOverlap)
+ static Bool
+RegionUnionO(RegionPtr pReg,
+ BoxPtr r1,
+ BoxPtr r1End,
+ BoxPtr r2, BoxPtr r2End, short y1, short y2, Bool *pOverlap)
{
- BoxPtr pNextRect;
- int x1; /* left and right side of current union */
- int x2;
+ BoxPtr pNextRect;
+ int x1; /* left and right side of current union */
+ int x2;
- assert (y1 < y2);
+ assert(y1 < y2);
assert(r1 != r1End && r2 != r2End);
pNextRect = RegionTop(pReg);
/* Start off current rectangle */
- if (r1->x1 < r2->x1)
- {
- x1 = r1->x1;
- x2 = r1->x2;
- r1++;
+ if (r1->x1 < r2->x1) {
+ x1 = r1->x1;
+ x2 = r1->x2;
+ r1++;
}
- else
- {
- x1 = r2->x1;
- x2 = r2->x2;
- r2++;
+ else {
+ x1 = r2->x1;
+ x2 = r2->x2;
+ r2++;
}
- while (r1 != r1End && r2 != r2End)
- {
- if (r1->x1 < r2->x1) MERGERECT(r1) else MERGERECT(r2);
+ while (r1 != r1End && r2 != r2End) {
+ if (r1->x1 < r2->x1)
+ MERGERECT(r1)
+ else
+ MERGERECT(r2);
}
/* Finish off whoever (if any) is left */
- if (r1 != r1End)
- {
- do
- {
- MERGERECT(r1);
- } while (r1 != r1End);
+ if (r1 != r1End) {
+ do {
+ MERGERECT(r1);
+ } while (r1 != r1End);
}
- else if (r2 != r2End)
- {
- do
- {
- MERGERECT(r2);
- } while (r2 != r2End);
+ else if (r2 != r2End) {
+ do {
+ MERGERECT(r2);
+ } while (r2 != r2End);
}
-
+
/* Add current rectangle */
NEWRECT(pReg, pNextRect, x1, y1, x2, y2);
@@ -980,83 +951,76 @@ RegionAppend(RegionPtr dstrgn, RegionPtr rgn)
Bool prepend;
if (RegionNar(rgn))
- return RegionBreak (dstrgn);
-
- if (!rgn->data && (dstrgn->data == &RegionEmptyData))
- {
- dstrgn->extents = rgn->extents;
- dstrgn->data = NULL;
- return TRUE;
+ return RegionBreak(dstrgn);
+
+ if (!rgn->data && (dstrgn->data == &RegionEmptyData)) {
+ dstrgn->extents = rgn->extents;
+ dstrgn->data = NULL;
+ return TRUE;
}
numRects = RegionNumRects(rgn);
if (!numRects)
- return TRUE;
+ return TRUE;
prepend = FALSE;
size = numRects;
dnumRects = RegionNumRects(dstrgn);
if (!dnumRects && (size < 200))
- size = 200; /* XXX pick numbers out of a hat */
+ size = 200; /* XXX pick numbers out of a hat */
RECTALLOC(dstrgn, size);
old = RegionRects(rgn);
if (!dnumRects)
- dstrgn->extents = rgn->extents;
- else if (dstrgn->extents.x2 > dstrgn->extents.x1)
- {
- BoxPtr first, last;
-
- first = old;
- last = RegionBoxptr(dstrgn) + (dnumRects - 1);
- if ((first->y1 > last->y2) ||
- ((first->y1 == last->y1) && (first->y2 == last->y2) &&
- (first->x1 > last->x2)))
- {
- if (rgn->extents.x1 < dstrgn->extents.x1)
- dstrgn->extents.x1 = rgn->extents.x1;
- if (rgn->extents.x2 > dstrgn->extents.x2)
- dstrgn->extents.x2 = rgn->extents.x2;
- dstrgn->extents.y2 = rgn->extents.y2;
- }
- else
- {
- first = RegionBoxptr(dstrgn);
- last = old + (numRects - 1);
- if ((first->y1 > last->y2) ||
- ((first->y1 == last->y1) && (first->y2 == last->y2) &&
- (first->x1 > last->x2)))
- {
- prepend = TRUE;
- if (rgn->extents.x1 < dstrgn->extents.x1)
- dstrgn->extents.x1 = rgn->extents.x1;
- if (rgn->extents.x2 > dstrgn->extents.x2)
- dstrgn->extents.x2 = rgn->extents.x2;
- dstrgn->extents.y1 = rgn->extents.y1;
- }
- else
- dstrgn->extents.x2 = dstrgn->extents.x1;
- }
+ dstrgn->extents = rgn->extents;
+ else if (dstrgn->extents.x2 > dstrgn->extents.x1) {
+ BoxPtr first, last;
+
+ first = old;
+ last = RegionBoxptr(dstrgn) + (dnumRects - 1);
+ if ((first->y1 > last->y2) ||
+ ((first->y1 == last->y1) && (first->y2 == last->y2) &&
+ (first->x1 > last->x2))) {
+ if (rgn->extents.x1 < dstrgn->extents.x1)
+ dstrgn->extents.x1 = rgn->extents.x1;
+ if (rgn->extents.x2 > dstrgn->extents.x2)
+ dstrgn->extents.x2 = rgn->extents.x2;
+ dstrgn->extents.y2 = rgn->extents.y2;
+ }
+ else {
+ first = RegionBoxptr(dstrgn);
+ last = old + (numRects - 1);
+ if ((first->y1 > last->y2) ||
+ ((first->y1 == last->y1) && (first->y2 == last->y2) &&
+ (first->x1 > last->x2))) {
+ prepend = TRUE;
+ if (rgn->extents.x1 < dstrgn->extents.x1)
+ dstrgn->extents.x1 = rgn->extents.x1;
+ if (rgn->extents.x2 > dstrgn->extents.x2)
+ dstrgn->extents.x2 = rgn->extents.x2;
+ dstrgn->extents.y1 = rgn->extents.y1;
+ }
+ else
+ dstrgn->extents.x2 = dstrgn->extents.x1;
+ }
}
- if (prepend)
- {
- new = RegionBox(dstrgn, numRects);
- if (dnumRects == 1)
- *new = *RegionBoxptr(dstrgn);
- else
- memmove((char *)new,(char *)RegionBoxptr(dstrgn),
- dnumRects * sizeof(BoxRec));
- new = RegionBoxptr(dstrgn);
+ if (prepend) {
+ new = RegionBox(dstrgn, numRects);
+ if (dnumRects == 1)
+ *new = *RegionBoxptr(dstrgn);
+ else
+ memmove((char *) new, (char *) RegionBoxptr(dstrgn),
+ dnumRects * sizeof(BoxRec));
+ new = RegionBoxptr(dstrgn);
}
else
- new = RegionBoxptr(dstrgn) + dnumRects;
+ new = RegionBoxptr(dstrgn) + dnumRects;
if (numRects == 1)
- *new = *old;
+ *new = *old;
else
- memmove((char *)new, (char *)old, numRects * sizeof(BoxRec));
+ memmove((char *) new, (char *) old, numRects * sizeof(BoxRec));
dstrgn->data->numRects += numRects;
return TRUE;
}
-
#define ExchangeRects(a, b) \
{ \
BoxRec t; \
@@ -1066,60 +1030,53 @@ RegionAppend(RegionPtr dstrgn, RegionPtr rgn)
}
static void
-QuickSortRects(
- BoxRec rects[],
- int numRects)
+QuickSortRects(BoxRec rects[], int numRects)
{
- int y1;
- int x1;
- int i, j;
- BoxPtr r;
+ int y1;
+ int x1;
+ int i, j;
+ BoxPtr r;
/* Always called with numRects > 1 */
- do
- {
- if (numRects == 2)
- {
- if (rects[0].y1 > rects[1].y1 ||
- (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1))
- ExchangeRects(0, 1);
- return;
- }
-
- /* Choose partition element, stick in location 0 */
+ do {
+ if (numRects == 2) {
+ if (rects[0].y1 > rects[1].y1 ||
+ (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1))
+ ExchangeRects(0, 1);
+ return;
+ }
+
+ /* Choose partition element, stick in location 0 */
ExchangeRects(0, numRects >> 1);
- y1 = rects[0].y1;
- x1 = rects[0].x1;
+ y1 = rects[0].y1;
+ x1 = rects[0].x1;
/* Partition array */
i = 0;
j = numRects;
- do
- {
- r = &(rects[i]);
- do
- {
- r++;
- i++;
+ do {
+ r = &(rects[i]);
+ do {
+ r++;
+ i++;
} while (i != numRects &&
- (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1)));
- r = &(rects[j]);
- do
- {
- r--;
- j--;
+ (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1)));
+ r = &(rects[j]);
+ do {
+ r--;
+ j--;
} while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1));
if (i < j)
- ExchangeRects(i, j);
+ ExchangeRects(i, j);
} while (i < j);
/* Move partition element back to middle */
ExchangeRects(0, j);
- /* Recurse */
- if (numRects-j-1 > 1)
- QuickSortRects(&rects[j+1], numRects-j-1);
+ /* Recurse */
+ if (numRects - j - 1 > 1)
+ QuickSortRects(&rects[j + 1], numRects - j - 1);
numRects = j;
} while (numRects > 1);
}
@@ -1161,51 +1118,46 @@ RegionValidate(RegionPtr badreg, Bool *pOverlap)
{
/* Descriptor for regions under construction in Step 2. */
typedef struct {
- RegionRec reg;
- int prevBand;
- int curBand;
+ RegionRec reg;
+ int prevBand;
+ int curBand;
} RegionInfo;
- int numRects; /* Original numRects for badreg */
- RegionInfo *ri; /* Array of current regions */
- int numRI; /* Number of entries used in ri */
- int sizeRI; /* Number of entries available in ri */
- int i; /* Index into rects */
- int j; /* Index into ri */
- RegionInfo *rit; /* &ri[j] */
- RegionPtr reg; /* ri[j].reg */
- BoxPtr box; /* Current box in rects */
- BoxPtr riBox; /* Last box in ri[j].reg */
- RegionPtr hreg; /* ri[j_half].reg */
- Bool ret = TRUE;
+ int numRects; /* Original numRects for badreg */
+ RegionInfo *ri; /* Array of current regions */
+ int numRI; /* Number of entries used in ri */
+ int sizeRI; /* Number of entries available in ri */
+ int i; /* Index into rects */
+ int j; /* Index into ri */
+ RegionInfo *rit; /* &ri[j] */
+ RegionPtr reg; /* ri[j].reg */
+ BoxPtr box; /* Current box in rects */
+ BoxPtr riBox; /* Last box in ri[j].reg */
+ RegionPtr hreg; /* ri[j_half].reg */
+ Bool ret = TRUE;
*pOverlap = FALSE;
- if (!badreg->data)
- {
- good(badreg);
- return TRUE;
+ if (!badreg->data) {
+ good(badreg);
+ return TRUE;
}
numRects = badreg->data->numRects;
- if (!numRects)
- {
- if (RegionNar(badreg))
- return FALSE;
- good(badreg);
- return TRUE;
+ if (!numRects) {
+ if (RegionNar(badreg))
+ return FALSE;
+ good(badreg);
+ return TRUE;
}
- if (badreg->extents.x1 < badreg->extents.x2)
- {
- if ((numRects) == 1)
- {
- xfreeData(badreg);
- badreg->data = (RegDataPtr) NULL;
- }
- else
- {
- DOWNSIZE(badreg, numRects);
- }
- good(badreg);
- return TRUE;
+ if (badreg->extents.x1 < badreg->extents.x2) {
+ if ((numRects) == 1) {
+ xfreeData(badreg);
+ badreg->data = (RegDataPtr) NULL;
+ }
+ else {
+ DOWNSIZE(badreg, numRects);
+ }
+ good(badreg);
+ return TRUE;
}
/* Step 1: Sort the rects array into ascending (y1, x1) order */
@@ -1217,7 +1169,7 @@ RegionValidate(RegionPtr badreg, Bool *pOverlap)
/* Note that step 2 code will never overflow the ri[0].reg rects array */
ri = (RegionInfo *) malloc(4 * sizeof(RegionInfo));
if (!ri)
- return RegionBreak (badreg);
+ return RegionBreak(badreg);
sizeRI = 4;
numRI = 1;
ri[0].prevBand = 0;
@@ -1233,193 +1185,181 @@ RegionValidate(RegionPtr badreg, Bool *pOverlap)
forget it. Try the next region. If it doesn't fit cleanly into any
region, make a new one. */
- for (i = numRects; --i > 0;)
- {
- box++;
- /* Look for a region to append box to */
- for (j = numRI, rit = ri; --j >= 0; rit++)
- {
- reg = &rit->reg;
- riBox = RegionEnd(reg);
-
- if (box->y1 == riBox->y1 && box->y2 == riBox->y2)
- {
- /* box is in same band as riBox. Merge or append it */
- if (box->x1 <= riBox->x2)
- {
- /* Merge it with riBox */
- if (box->x1 < riBox->x2) *pOverlap = TRUE;
- if (box->x2 > riBox->x2) riBox->x2 = box->x2;
- }
- else
- {
- RECTALLOC_BAIL(reg, 1, bail);
- *RegionTop(reg) = *box;
- reg->data->numRects++;
- }
- goto NextRect; /* So sue me */
- }
- else if (box->y1 >= riBox->y2)
- {
- /* Put box into new band */
- if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2;
- if (reg->extents.x1 > box->x1) reg->extents.x1 = box->x1;
- Coalesce(reg, rit->prevBand, rit->curBand);
- rit->curBand = reg->data->numRects;
- RECTALLOC_BAIL(reg, 1, bail);
- *RegionTop(reg) = *box;
- reg->data->numRects++;
- goto NextRect;
- }
- /* Well, this region was inappropriate. Try the next one. */
- } /* for j */
-
- /* Uh-oh. No regions were appropriate. Create a new one. */
- if (sizeRI == numRI)
- {
- /* Oops, allocate space for new region information */
- sizeRI <<= 1;
- rit = (RegionInfo *) realloc(ri, sizeRI * sizeof(RegionInfo));
- if (!rit)
- goto bail;
- ri = rit;
- rit = &ri[numRI];
- }
- numRI++;
- rit->prevBand = 0;
- rit->curBand = 0;
- rit->reg.extents = *box;
- rit->reg.data = NULL;
- if (!RegionRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
- goto bail;
-NextRect: ;
- } /* for i */
+ for (i = numRects; --i > 0;) {
+ box++;
+ /* Look for a region to append box to */
+ for (j = numRI, rit = ri; --j >= 0; rit++) {
+ reg = &rit->reg;
+ riBox = RegionEnd(reg);
+
+ if (box->y1 == riBox->y1 && box->y2 == riBox->y2) {
+ /* box is in same band as riBox. Merge or append it */
+ if (box->x1 <= riBox->x2) {
+ /* Merge it with riBox */
+ if (box->x1 < riBox->x2)
+ *pOverlap = TRUE;
+ if (box->x2 > riBox->x2)
+ riBox->x2 = box->x2;
+ }
+ else {
+ RECTALLOC_BAIL(reg, 1, bail);
+ *RegionTop(reg) = *box;
+ reg->data->numRects++;
+ }
+ goto NextRect; /* So sue me */
+ }
+ else if (box->y1 >= riBox->y2) {
+ /* Put box into new band */
+ if (reg->extents.x2 < riBox->x2)
+ reg->extents.x2 = riBox->x2;
+ if (reg->extents.x1 > box->x1)
+ reg->extents.x1 = box->x1;
+ Coalesce(reg, rit->prevBand, rit->curBand);
+ rit->curBand = reg->data->numRects;
+ RECTALLOC_BAIL(reg, 1, bail);
+ *RegionTop(reg) = *box;
+ reg->data->numRects++;
+ goto NextRect;
+ }
+ /* Well, this region was inappropriate. Try the next one. */
+ } /* for j */
+
+ /* Uh-oh. No regions were appropriate. Create a new one. */
+ if (sizeRI == numRI) {
+ /* Oops, allocate space for new region information */
+ sizeRI <<= 1;
+ rit = (RegionInfo *) realloc(ri, sizeRI * sizeof(RegionInfo));
+ if (!rit)
+ goto bail;
+ ri = rit;
+ rit = &ri[numRI];
+ }
+ numRI++;
+ rit->prevBand = 0;
+ rit->curBand = 0;
+ rit->reg.extents = *box;
+ rit->reg.data = NULL;
+ if (!RegionRectAlloc(&rit->reg, (i + numRI) / numRI)) /* MUST force allocation */
+ goto bail;
+ NextRect:;
+ } /* for i */
/* Make a final pass over each region in order to Coalesce and set
extents.x2 and extents.y2 */
- for (j = numRI, rit = ri; --j >= 0; rit++)
- {
- reg = &rit->reg;
- riBox = RegionEnd(reg);
- reg->extents.y2 = riBox->y2;
- if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2;
- Coalesce(reg, rit->prevBand, rit->curBand);
- if (reg->data->numRects == 1) /* keep unions happy below */
- {
- xfreeData(reg);
- reg->data = NULL;
- }
+ for (j = numRI, rit = ri; --j >= 0; rit++) {
+ reg = &rit->reg;
+ riBox = RegionEnd(reg);
+ reg->extents.y2 = riBox->y2;
+ if (reg->extents.x2 < riBox->x2)
+ reg->extents.x2 = riBox->x2;
+ Coalesce(reg, rit->prevBand, rit->curBand);
+ if (reg->data->numRects == 1) { /* keep unions happy below */
+ xfreeData(reg);
+ reg->data = NULL;
+ }
}
/* Step 3: Union all regions into a single region */
- while (numRI > 1)
- {
- int half = numRI/2;
- for (j = numRI & 1; j < (half + (numRI & 1)); j++)
- {
- reg = &ri[j].reg;
- hreg = &ri[j+half].reg;
- if (!RegionOp(reg, reg, hreg, RegionUnionO, TRUE, TRUE, pOverlap))
- ret = FALSE;
- if (hreg->extents.x1 < reg->extents.x1)
- reg->extents.x1 = hreg->extents.x1;
- if (hreg->extents.y1 < reg->extents.y1)
- reg->extents.y1 = hreg->extents.y1;
- if (hreg->extents.x2 > reg->extents.x2)
- reg->extents.x2 = hreg->extents.x2;
- if (hreg->extents.y2 > reg->extents.y2)
- reg->extents.y2 = hreg->extents.y2;
- xfreeData(hreg);
- }
- numRI -= half;
+ while (numRI > 1) {
+ int half = numRI / 2;
+
+ for (j = numRI & 1; j < (half + (numRI & 1)); j++) {
+ reg = &ri[j].reg;
+ hreg = &ri[j + half].reg;
+ if (!RegionOp(reg, reg, hreg, RegionUnionO, TRUE, TRUE, pOverlap))
+ ret = FALSE;
+ if (hreg->extents.x1 < reg->extents.x1)
+ reg->extents.x1 = hreg->extents.x1;
+ if (hreg->extents.y1 < reg->extents.y1)
+ reg->extents.y1 = hreg->extents.y1;
+ if (hreg->extents.x2 > reg->extents.x2)
+ reg->extents.x2 = hreg->extents.x2;
+ if (hreg->extents.y2 > reg->extents.y2)
+ reg->extents.y2 = hreg->extents.y2;
+ xfreeData(hreg);
+ }
+ numRI -= half;
}
*badreg = ri[0].reg;
free(ri);
good(badreg);
return ret;
-bail:
+ bail:
for (i = 0; i < numRI; i++)
- xfreeData(&ri[i].reg);
+ xfreeData(&ri[i].reg);
free(ri);
- return RegionBreak (badreg);
+ return RegionBreak(badreg);
}
RegionPtr
RegionFromRects(int nrects, xRectangle *prect, int ctype)
{
-
- RegionPtr pRgn;
- RegDataPtr pData;
- BoxPtr pBox;
- int i;
- int x1, y1, x2, y2;
+
+ RegionPtr pRgn;
+ RegDataPtr pData;
+ BoxPtr pBox;
+ int i;
+ int x1, y1, x2, y2;
pRgn = RegionCreate(NullBox, 0);
- if (RegionNar (pRgn))
- return pRgn;
+ if (RegionNar(pRgn))
+ return pRgn;
if (!nrects)
- return pRgn;
- if (nrects == 1)
- {
- x1 = prect->x;
- y1 = prect->y;
- if ((x2 = x1 + (int) prect->width) > MAXSHORT)
- x2 = MAXSHORT;
- if ((y2 = y1 + (int) prect->height) > MAXSHORT)
- y2 = MAXSHORT;
- if (x1 != x2 && y1 != y2)
- {
- pRgn->extents.x1 = x1;
- pRgn->extents.y1 = y1;
- pRgn->extents.x2 = x2;
- pRgn->extents.y2 = y2;
- pRgn->data = NULL;
- }
- return pRgn;
+ return pRgn;
+ if (nrects == 1) {
+ x1 = prect->x;
+ y1 = prect->y;
+ if ((x2 = x1 + (int) prect->width) > MAXSHORT)
+ x2 = MAXSHORT;
+ if ((y2 = y1 + (int) prect->height) > MAXSHORT)
+ y2 = MAXSHORT;
+ if (x1 != x2 && y1 != y2) {
+ pRgn->extents.x1 = x1;
+ pRgn->extents.y1 = y1;
+ pRgn->extents.x2 = x2;
+ pRgn->extents.y2 = y2;
+ pRgn->data = NULL;
+ }
+ return pRgn;
}
pData = xallocData(nrects);
- if (!pData)
- {
- RegionBreak (pRgn);
- return pRgn;
+ if (!pData) {
+ RegionBreak(pRgn);
+ return pRgn;
}
pBox = (BoxPtr) (pData + 1);
- for (i = nrects; --i >= 0; prect++)
- {
- x1 = prect->x;
- y1 = prect->y;
- if ((x2 = x1 + (int) prect->width) > MAXSHORT)
- x2 = MAXSHORT;
- if ((y2 = y1 + (int) prect->height) > MAXSHORT)
- y2 = MAXSHORT;
- if (x1 != x2 && y1 != y2)
- {
- pBox->x1 = x1;
- pBox->y1 = y1;
- pBox->x2 = x2;
- pBox->y2 = y2;
- pBox++;
- }
+ for (i = nrects; --i >= 0; prect++) {
+ x1 = prect->x;
+ y1 = prect->y;
+ if ((x2 = x1 + (int) prect->width) > MAXSHORT)
+ x2 = MAXSHORT;
+ if ((y2 = y1 + (int) prect->height) > MAXSHORT)
+ y2 = MAXSHORT;
+ if (x1 != x2 && y1 != y2) {
+ pBox->x1 = x1;
+ pBox->y1 = y1;
+ pBox->x2 = x2;
+ pBox->y2 = y2;
+ pBox++;
+ }
}
- if (pBox != (BoxPtr) (pData + 1))
- {
- pData->size = nrects;
- pData->numRects = pBox - (BoxPtr) (pData + 1);
- pRgn->data = pData;
- if (ctype != CT_YXBANDED)
- {
- Bool overlap; /* result ignored */
- pRgn->extents.x1 = pRgn->extents.x2 = 0;
- RegionValidate(pRgn, &overlap);
- }
- else
- RegionSetExtents(pRgn);
- good(pRgn);
+ if (pBox != (BoxPtr) (pData + 1)) {
+ pData->size = nrects;
+ pData->numRects = pBox - (BoxPtr) (pData + 1);
+ pRgn->data = pData;
+ if (ctype != CT_YXBANDED) {
+ Bool overlap; /* result ignored */
+
+ pRgn->extents.x1 = pRgn->extents.x2 = 0;
+ RegionValidate(pRgn, &overlap);
+ }
+ else
+ RegionSetExtents(pRgn);
+ good(pRgn);
}
- else
- {
- free(pData);
+ else {
+ free(pData);
}
return pRgn;
}
diff --git a/xorg-server/dix/registry.c b/xorg-server/dix/registry.c
index 319973920..18344f417 100644
--- a/xorg-server/dix/registry.c
+++ b/xorg-server/dix/registry.c
@@ -49,43 +49,45 @@ static unsigned nmajor, *nminor, nevent, nerror, nresource;
/*
* File parsing routines
*/
-static int double_size(void *p, unsigned n, unsigned size)
+static int
+double_size(void *p, unsigned n, unsigned size)
{
- char **ptr = (char **)p;
+ char **ptr = (char **) p;
unsigned s, f;
if (n) {
- s = n * size;
- n *= 2 * size;
- f = n;
- } else {
- s = 0;
- n = f = BASE_SIZE * size;
+ s = n * size;
+ n *= 2 * size;
+ f = n;
+ }
+ else {
+ s = 0;
+ n = f = BASE_SIZE * size;
}
*ptr = realloc(*ptr, n);
if (!*ptr) {
- dixResetRegistry();
- return FALSE;
+ dixResetRegistry();
+ return FALSE;
}
memset(*ptr + s, 0, f - s);
return TRUE;
-}
+}
static void
RegisterRequestName(unsigned major, unsigned minor, char *name)
{
while (major >= nmajor) {
- if (!double_size(&requests, nmajor, sizeof(char **)))
- return;
- if (!double_size(&nminor, nmajor, sizeof(unsigned)))
- return;
- nmajor = nmajor ? nmajor * 2 : BASE_SIZE;
+ if (!double_size(&requests, nmajor, sizeof(char **)))
+ return;
+ if (!double_size(&nminor, nmajor, sizeof(unsigned)))
+ return;
+ nmajor = nmajor ? nmajor * 2 : BASE_SIZE;
}
while (minor >= nminor[major]) {
- if (!double_size(requests+major, nminor[major], sizeof(char *)))
- return;
- nminor[major] = nminor[major] ? nminor[major] * 2 : BASE_SIZE;
+ if (!double_size(requests + major, nminor[major], sizeof(char *)))
+ return;
+ nminor[major] = nminor[major] ? nminor[major] * 2 : BASE_SIZE;
}
free(requests[major][minor]);
@@ -93,11 +95,12 @@ RegisterRequestName(unsigned major, unsigned minor, char *name)
}
static void
-RegisterEventName(unsigned event, char *name) {
+RegisterEventName(unsigned event, char *name)
+{
while (event >= nevent) {
- if (!double_size(&events, nevent, sizeof(char *)))
- return;
- nevent = nevent ? nevent * 2 : BASE_SIZE;
+ if (!double_size(&events, nevent, sizeof(char *)))
+ return;
+ nevent = nevent ? nevent * 2 : BASE_SIZE;
}
free(events[event]);
@@ -105,11 +108,12 @@ RegisterEventName(unsigned event, char *name) {
}
static void
-RegisterErrorName(unsigned error, char *name) {
+RegisterErrorName(unsigned error, char *name)
+{
while (error >= nerror) {
- if (!double_size(&errors, nerror, sizeof(char *)))
- return;
- nerror = nerror ? nerror * 2 : BASE_SIZE;
+ if (!double_size(&errors, nerror, sizeof(char *)))
+ return;
+ nerror = nerror ? nerror * 2 : BASE_SIZE;
}
free(errors[error]);
@@ -117,80 +121,80 @@ RegisterErrorName(unsigned error, char *name) {
}
void
-RegisterExtensionNames(ExtensionEntry *extEntry)
+RegisterExtensionNames(ExtensionEntry * extEntry)
{
char buf[256], *lineobj, *ptr;
unsigned offset;
if (fh == NULL)
- return;
+ return;
rewind(fh);
while (fgets(buf, sizeof(buf), fh)) {
- lineobj = NULL;
- ptr = strchr(buf, '\n');
- if (ptr)
- *ptr = 0;
-
- /* Check for comments or empty lines */
- switch (buf[0]) {
- case PROT_REQUEST:
- case PROT_EVENT:
- case PROT_ERROR:
- break;
- case PROT_COMMENT:
- case '\0':
- continue;
- default:
- goto invalid;
- }
-
- /* Check for space character in the fifth position */
- ptr = strchr(buf, ' ');
- if (!ptr || ptr != buf + 4)
- goto invalid;
-
- /* Duplicate the string after the space */
- lineobj = strdup(ptr + 1);
- if (!lineobj)
- continue;
-
- /* Check for a colon somewhere on the line */
- ptr = strchr(buf, ':');
- if (!ptr)
- goto invalid;
-
- /* Compare the part before colon with the target extension name */
- *ptr = 0;
- if (strcmp(buf + 5, extEntry->name))
- goto skip;
-
- /* Get the opcode for the request, event, or error */
- offset = strtol(buf + 1, &ptr, 10);
- if (offset == 0 && ptr == buf + 1)
- goto invalid;
-
- /* Save the strdup result in the registry */
- switch(buf[0]) {
- case PROT_REQUEST:
- if (extEntry->base)
- RegisterRequestName(extEntry->base, offset, lineobj);
- else
- RegisterRequestName(offset, 0, lineobj);
- continue;
- case PROT_EVENT:
- RegisterEventName(extEntry->eventBase + offset, lineobj);
- continue;
- case PROT_ERROR:
- RegisterErrorName(extEntry->errorBase + offset, lineobj);
- continue;
- }
-
- invalid:
- LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
- skip:
- free(lineobj);
+ lineobj = NULL;
+ ptr = strchr(buf, '\n');
+ if (ptr)
+ *ptr = 0;
+
+ /* Check for comments or empty lines */
+ switch (buf[0]) {
+ case PROT_REQUEST:
+ case PROT_EVENT:
+ case PROT_ERROR:
+ break;
+ case PROT_COMMENT:
+ case '\0':
+ continue;
+ default:
+ goto invalid;
+ }
+
+ /* Check for space character in the fifth position */
+ ptr = strchr(buf, ' ');
+ if (!ptr || ptr != buf + 4)
+ goto invalid;
+
+ /* Duplicate the string after the space */
+ lineobj = strdup(ptr + 1);
+ if (!lineobj)
+ continue;
+
+ /* Check for a colon somewhere on the line */
+ ptr = strchr(buf, ':');
+ if (!ptr)
+ goto invalid;
+
+ /* Compare the part before colon with the target extension name */
+ *ptr = 0;
+ if (strcmp(buf + 5, extEntry->name))
+ goto skip;
+
+ /* Get the opcode for the request, event, or error */
+ offset = strtol(buf + 1, &ptr, 10);
+ if (offset == 0 && ptr == buf + 1)
+ goto invalid;
+
+ /* Save the strdup result in the registry */
+ switch (buf[0]) {
+ case PROT_REQUEST:
+ if (extEntry->base)
+ RegisterRequestName(extEntry->base, offset, lineobj);
+ else
+ RegisterRequestName(offset, 0, lineobj);
+ continue;
+ case PROT_EVENT:
+ RegisterEventName(extEntry->eventBase + offset, lineobj);
+ continue;
+ case PROT_ERROR:
+ RegisterErrorName(extEntry->errorBase + offset, lineobj);
+ continue;
+ }
+
+ invalid:
+ LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
+ skip:
+ free(lineobj);
}
}
@@ -204,9 +208,9 @@ RegisterResourceName(RESTYPE resource, const char *name)
resource &= TypeMask;
while (resource >= nresource) {
- if (!double_size((void*)&resources, nresource, sizeof(char *)))
- return;
- nresource = nresource ? nresource * 2 : BASE_SIZE;
+ if (!double_size((void*)&resources, nresource, sizeof(char *)))
+ return;
+ nresource = nresource ? nresource * 2 : BASE_SIZE;
}
resources[resource] = name;
@@ -220,9 +224,9 @@ const char *
LookupRequestName(int major, int minor)
{
if (major >= nmajor)
- return XREGISTRY_UNKNOWN;
+ return XREGISTRY_UNKNOWN;
if (minor >= nminor[major])
- return XREGISTRY_UNKNOWN;
+ return XREGISTRY_UNKNOWN;
return requests[major][minor] ? requests[major][minor] : XREGISTRY_UNKNOWN;
}
@@ -231,18 +235,20 @@ const char *
LookupMajorName(int major)
{
if (major < 128) {
- const char *retval;
-
- if (major >= nmajor)
- return XREGISTRY_UNKNOWN;
- if (0 >= nminor[major])
- return XREGISTRY_UNKNOWN;
-
- retval = requests[major][0];
- return retval ? retval + sizeof(CORE) : XREGISTRY_UNKNOWN;
- } else {
- ExtensionEntry *extEntry = GetExtensionEntry(major);
- return extEntry ? extEntry->name : XREGISTRY_UNKNOWN;
+ const char *retval;
+
+ if (major >= nmajor)
+ return XREGISTRY_UNKNOWN;
+ if (0 >= nminor[major])
+ return XREGISTRY_UNKNOWN;
+
+ retval = requests[major][0];
+ return retval ? retval + sizeof(CORE) : XREGISTRY_UNKNOWN;
+ }
+ else {
+ ExtensionEntry *extEntry = GetExtensionEntry(major);
+
+ return extEntry ? extEntry->name : XREGISTRY_UNKNOWN;
}
}
@@ -251,7 +257,7 @@ LookupEventName(int event)
{
event &= 127;
if (event >= nevent)
- return XREGISTRY_UNKNOWN;
+ return XREGISTRY_UNKNOWN;
return events[event] ? events[event] : XREGISTRY_UNKNOWN;
}
@@ -260,7 +266,7 @@ const char *
LookupErrorName(int error)
{
if (error >= nerror)
- return XREGISTRY_UNKNOWN;
+ return XREGISTRY_UNKNOWN;
return errors[error] ? errors[error] : XREGISTRY_UNKNOWN;
}
@@ -270,7 +276,7 @@ LookupResourceName(RESTYPE resource)
{
resource &= TypeMask;
if (resource >= nresource)
- return XREGISTRY_UNKNOWN;
+ return XREGISTRY_UNKNOWN;
return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN;
}
@@ -285,19 +291,19 @@ dixResetRegistry(void)
/* Free all memory */
while (nmajor--) {
- while (nminor[nmajor])
- free(requests[nmajor][--nminor[nmajor]]);
- free(requests[nmajor]);
+ while (nminor[nmajor])
+ free(requests[nmajor][--nminor[nmajor]]);
+ free(requests[nmajor]);
}
free(requests);
free(nminor);
while (nevent--)
- free(events[nevent]);
+ free(events[nevent]);
free(events);
while (nerror--)
- free(errors[nerror]);
+ free(errors[nerror]);
free(errors);
free((void*)resources);
@@ -312,10 +318,11 @@ dixResetRegistry(void)
/* Open the protocol file */
if (fh)
- fclose(fh);
+ fclose(fh);
fh = fopen(FILENAME, "r");
if (!fh)
- LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME "\n");
+ LogMessage(X_WARNING,
+ "Failed to open protocol names file " FILENAME "\n");
/* Add built-in resources */
RegisterResourceName(RT_NONE, "NONE");
@@ -335,4 +342,4 @@ dixResetRegistry(void)
RegisterExtensionNames(&extEntry);
}
-#endif /* XREGISTRY */
+#endif /* XREGISTRY */
diff --git a/xorg-server/dix/resource.c b/xorg-server/dix/resource.c
index 3368339fb..865b5b219 100644
--- a/xorg-server/dix/resource.c
+++ b/xorg-server/dix/resource.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -126,7 +125,7 @@ Equipment Corporation.
#include "misc.h"
#include "os.h"
#include "resource.h"
-#include "dixstruct.h"
+#include "dixstruct.h"
#include "opaque.h"
#include "windowstr.h"
#include "dixfont.h"
@@ -146,14 +145,14 @@ Equipment Corporation.
#ifdef XSERVER_DTRACE
#include <sys/types.h>
typedef const char *string;
+
#include "Xserver-dtrace.h"
#define TypeNameString(t) LookupResourceName(t)
#endif
-static void RebuildTable(
- int /*client*/
-);
+static void RebuildTable(int /*client */
+ );
#define SERVER_MINID 32
@@ -162,19 +161,19 @@ static void RebuildTable(
#define MAXHASHSIZE 11
typedef struct _Resource {
- struct _Resource *next;
- XID id;
- RESTYPE type;
- pointer value;
+ struct _Resource *next;
+ XID id;
+ RESTYPE type;
+ pointer value;
} ResourceRec, *ResourcePtr;
typedef struct _ClientResource {
ResourcePtr *resources;
- int elements;
- int buckets;
- int hashsize; /* log(2)(buckets) */
- XID fakeID;
- XID endFakeID;
+ int elements;
+ int buckets;
+ int hashsize; /* log(2)(buckets) */
+ XID fakeID;
+ XID endFakeID;
} ClientResourceRec;
RESTYPE lastResourceType;
@@ -234,11 +233,11 @@ static const struct ResourceType predefTypes[] = {
CallbackListPtr ResourceStateCallback;
static _X_INLINE void
-CallResourceStateCallback(ResourceState state, ResourceRec *res)
+CallResourceStateCallback(ResourceState state, ResourceRec * res)
{
if (ResourceStateCallback) {
- ResourceStateInfoRec rsi = { state, res->id, res->type, res->value };
- CallCallbacks(&ResourceStateCallback, &rsi);
+ ResourceStateInfoRec rsi = { state, res->id, res->type, res->value };
+ CallCallbacks(&ResourceStateCallback, &rsi);
}
}
@@ -249,10 +248,10 @@ CreateNewResourceType(DeleteType deleteFunc, const char *name)
struct ResourceType *types;
if (next & lastResourceClass)
- return 0;
+ return 0;
types = realloc(resourceTypes, (next + 1) * sizeof(*resourceTypes));
if (!types)
- return 0;
+ return 0;
lastResourceType = next;
resourceTypes = types;
@@ -277,7 +276,7 @@ CreateNewResourceClass(void)
RESTYPE next = lastResourceClass >> 1;
if (next & lastResourceType)
- return 0;
+ return 0;
lastResourceClass = next;
TypeMask = next - 1;
return next;
@@ -295,22 +294,21 @@ Bool
InitClientResources(ClientPtr client)
{
int i, j;
-
- if (client == serverClient)
- {
- lastResourceType = RT_LASTPREDEF;
- lastResourceClass = RC_LASTPREDEF;
- TypeMask = RC_LASTPREDEF - 1;
- free(resourceTypes);
- resourceTypes = malloc(sizeof(predefTypes));
- if (!resourceTypes)
- return FALSE;
- memcpy(resourceTypes, predefTypes, sizeof(predefTypes));
+
+ if (client == serverClient) {
+ lastResourceType = RT_LASTPREDEF;
+ lastResourceClass = RC_LASTPREDEF;
+ TypeMask = RC_LASTPREDEF - 1;
+ free(resourceTypes);
+ resourceTypes = malloc(sizeof(predefTypes));
+ if (!resourceTypes)
+ return FALSE;
+ memcpy(resourceTypes, predefTypes, sizeof(predefTypes));
}
clientTable[i = client->index].resources =
- malloc(INITBUCKETS*sizeof(ResourcePtr));
+ malloc(INITBUCKETS * sizeof(ResourcePtr));
if (!clientTable[i].resources)
- return FALSE;
+ return FALSE;
clientTable[i].buckets = INITBUCKETS;
clientTable[i].elements = 0;
clientTable[i].hashsize = INITHASHSIZE;
@@ -320,56 +318,48 @@ InitClientResources(ClientPtr client)
* clients, we can start from zero, with SERVER_BIT set.
*/
clientTable[i].fakeID = client->clientAsMask |
- (client->index ? SERVER_BIT : SERVER_MINID);
+ (client->index ? SERVER_BIT : SERVER_MINID);
clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1;
- for (j=0; j<INITBUCKETS; j++)
- {
+ for (j = 0; j < INITBUCKETS; j++) {
clientTable[i].resources[j] = NULL;
}
return TRUE;
}
-
static int
Hash(int client, XID id)
{
id &= RESOURCE_ID_MASK;
- switch (clientTable[client].hashsize)
- {
- case 6:
- return ((int)(0x03F & (id ^ (id>>6) ^ (id>>12))));
- case 7:
- return ((int)(0x07F & (id ^ (id>>7) ^ (id>>13))));
- case 8:
- return ((int)(0x0FF & (id ^ (id>>8) ^ (id>>16))));
- case 9:
- return ((int)(0x1FF & (id ^ (id>>9))));
- case 10:
- return ((int)(0x3FF & (id ^ (id>>10))));
- case 11:
- return ((int)(0x7FF & (id ^ (id>>11))));
+ switch (clientTable[client].hashsize) {
+ case 6:
+ return ((int) (0x03F & (id ^ (id >> 6) ^ (id >> 12))));
+ case 7:
+ return ((int) (0x07F & (id ^ (id >> 7) ^ (id >> 13))));
+ case 8:
+ return ((int) (0x0FF & (id ^ (id >> 8) ^ (id >> 16))));
+ case 9:
+ return ((int) (0x1FF & (id ^ (id >> 9))));
+ case 10:
+ return ((int) (0x3FF & (id ^ (id >> 10))));
+ case 11:
+ return ((int) (0x7FF & (id ^ (id >> 11))));
}
return -1;
}
static XID
-AvailableID(
- int client,
- XID id,
- XID maxid,
- XID goodid)
+AvailableID(int client, XID id, XID maxid, XID goodid)
{
ResourcePtr res;
if ((goodid >= id) && (goodid <= maxid))
- return goodid;
- for (; id <= maxid; id++)
- {
- res = clientTable[client].resources[Hash(client, id)];
- while (res && (res->id != id))
- res = res->next;
- if (!res)
- return id;
+ return goodid;
+ for (; id <= maxid; id++) {
+ res = clientTable[client].resources[Hash(client, id)];
+ while (res && (res->id != id))
+ res = res->next;
+ if (!res)
+ return id;
}
return 0;
}
@@ -383,28 +373,26 @@ GetXIDRange(int client, Bool server, XID *minp, XID *maxp)
int i;
XID goodid;
- id = (Mask)client << CLIENTOFFSET;
+ id = (Mask) client << CLIENTOFFSET;
if (server)
- id |= client ? SERVER_BIT : SERVER_MINID;
+ id |= client ? SERVER_BIT : SERVER_MINID;
maxid = id | RESOURCE_ID_MASK;
goodid = 0;
for (resp = clientTable[client].resources, i = clientTable[client].buckets;
- --i >= 0;)
- {
- for (res = *resp++; res; res = res->next)
- {
- if ((res->id < id) || (res->id > maxid))
- continue;
- if (((res->id - id) >= (maxid - res->id)) ?
- (goodid = AvailableID(client, id, res->id - 1, goodid)) :
- !(goodid = AvailableID(client, res->id + 1, maxid, goodid)))
- maxid = res->id - 1;
- else
- id = res->id + 1;
- }
+ --i >= 0;) {
+ for (res = *resp++; res; res = res->next) {
+ if ((res->id < id) || (res->id > maxid))
+ continue;
+ if (((res->id - id) >= (maxid - res->id)) ?
+ (goodid = AvailableID(client, id, res->id - 1, goodid)) :
+ !(goodid = AvailableID(client, res->id + 1, maxid, goodid)))
+ maxid = res->id - 1;
+ else
+ id = res->id + 1;
+ }
}
if (id > maxid)
- id = maxid = 0;
+ id = maxid = 0;
*minp = id;
*maxp = maxid;
}
@@ -434,15 +422,13 @@ GetXIDList(ClientPtr pClient, unsigned count, XID *pids)
pointer val;
maxid = id | RESOURCE_ID_MASK;
- while ( (found < count) && (id <= maxid) )
- {
- rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
- DixGetAttrAccess);
- if (rc == BadValue)
- {
- pids[found++] = id;
- }
- id++;
+ while ((found < count) && (id <= maxid)) {
+ rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
+ DixGetAttrAccess);
+ if (rc == BadValue) {
+ pids[found++] = id;
+ }
+ id++;
}
return found;
}
@@ -462,14 +448,14 @@ FakeClientID(int client)
id = clientTable[client].fakeID++;
if (id != clientTable[client].endFakeID)
- return id;
+ return id;
GetXIDRange(client, TRUE, &id, &maxid);
if (!id) {
- if (!client)
- FatalError("FakeClientID: server internal ids exhausted\n");
- MarkClientException(clients[client]);
- id = ((Mask)client << CLIENTOFFSET) | (SERVER_BIT * 3);
- maxid = id | RESOURCE_ID_MASK;
+ if (!client)
+ FatalError("FakeClientID: server internal ids exhausted\n");
+ MarkClientException(clients[client]);
+ id = ((Mask) client << CLIENTOFFSET) | (SERVER_BIT * 3);
+ maxid = id | RESOURCE_ID_MASK;
}
clientTable[client].fakeID = id + 1;
clientTable[client].endFakeID = maxid + 1;
@@ -482,27 +468,24 @@ AddResource(XID id, RESTYPE type, pointer value)
int client;
ClientResourceRec *rrec;
ResourcePtr res, *head;
-
+
#ifdef XSERVER_DTRACE
XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
#endif
client = CLIENT_ID(id);
rrec = &clientTable[client];
- if (!rrec->buckets)
- {
- ErrorF("[dix] AddResource(%lx, %x, %lx), client=%d \n",
- (unsigned long)id, type, (unsigned long)value, client);
+ if (!rrec->buckets) {
+ ErrorF("[dix] AddResource(%lx, %x, %lx), client=%d \n",
+ (unsigned long) id, type, (unsigned long) value, client);
FatalError("client not in use\n");
}
- if ((rrec->elements >= 4*rrec->buckets) &&
- (rrec->hashsize < MAXHASHSIZE))
- RebuildTable(client);
+ if ((rrec->elements >= 4 * rrec->buckets) && (rrec->hashsize < MAXHASHSIZE))
+ RebuildTable(client);
head = &rrec->resources[Hash(client, id)];
res = malloc(sizeof(ResourceRec));
- if (!res)
- {
- (*resourceTypes[type & TypeMask].deleteFunc)(value, id);
- return FALSE;
+ if (!res) {
+ (*resourceTypes[type & TypeMask].deleteFunc) (value, id);
+ return FALSE;
}
res->next = *head;
res->id = id;
@@ -530,32 +513,26 @@ RebuildTable(int client)
j = 2 * clientTable[client].buckets;
tails = malloc(j * sizeof(ResourcePtr *));
if (!tails)
- return;
+ return;
resources = malloc(j * sizeof(ResourcePtr));
- if (!resources)
- {
- free(tails);
- return;
+ if (!resources) {
+ free(tails);
+ return;
}
- for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
- {
- *rptr = NULL;
- *tptr = rptr;
+ for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++) {
+ *rptr = NULL;
+ *tptr = rptr;
}
clientTable[client].hashsize++;
for (j = clientTable[client].buckets,
- rptr = clientTable[client].resources;
- --j >= 0;
- rptr++)
- {
- for (res = *rptr; res; res = next)
- {
- next = res->next;
- res->next = NULL;
- tptr = &tails[Hash(client, res->id)];
- **tptr = res;
- *tptr = &res->next;
- }
+ rptr = clientTable[client].resources; --j >= 0; rptr++) {
+ for (res = *rptr; res; res = next) {
+ next = res->next;
+ res->next = NULL;
+ tptr = &tails[Hash(client, res->id)];
+ **tptr = res;
+ *tptr = &res->next;
+ }
}
free(tails);
clientTable[client].buckets *= 2;
@@ -569,7 +546,7 @@ doFreeResource(ResourcePtr res, Bool skip)
CallResourceStateCallback(ResourceStateFreeing, res);
if (!skip)
- resourceTypes[res->type & TypeMask].deleteFunc(res->value, res->id);
+ resourceTypes[res->type & TypeMask].deleteFunc(res->value, res->id);
free(res);
}
@@ -577,38 +554,35 @@ doFreeResource(ResourcePtr res, Bool skip)
void
FreeResource(XID id, RESTYPE skipDeleteFuncType)
{
- int cid;
+ int cid;
ResourcePtr res;
ResourcePtr *prev, *head;
int *eltptr;
- int elements;
+ int elements;
- if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
- {
- head = &clientTable[cid].resources[Hash(cid, id)];
- eltptr = &clientTable[cid].elements;
+ if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) {
+ head = &clientTable[cid].resources[Hash(cid, id)];
+ eltptr = &clientTable[cid].elements;
- prev = head;
- while ( (res = *prev) )
- {
- if (res->id == id)
- {
- RESTYPE rtype = res->type;
+ prev = head;
+ while ((res = *prev)) {
+ if (res->id == id) {
+ RESTYPE rtype = res->type;
#ifdef XSERVER_DTRACE
- XSERVER_RESOURCE_FREE(res->id, res->type,
- res->value, TypeNameString(res->type));
-#endif
- *prev = res->next;
- elements = --*eltptr;
-
- doFreeResource(res, rtype == skipDeleteFuncType);
-
- if (*eltptr != elements)
- prev = head; /* prev may no longer be valid */
- }
- else
- prev = &res->next;
+ XSERVER_RESOURCE_FREE(res->id, res->type,
+ res->value, TypeNameString(res->type));
+#endif
+ *prev = res->next;
+ elements = --*eltptr;
+
+ doFreeResource(res, rtype == skipDeleteFuncType);
+
+ if (*eltptr != elements)
+ prev = head; /* prev may no longer be valid */
+ }
+ else
+ prev = &res->next;
}
}
}
@@ -616,31 +590,29 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
void
FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
{
- int cid;
+ int cid;
ResourcePtr res;
ResourcePtr *prev, *head;
- if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
- {
- head = &clientTable[cid].resources[Hash(cid, id)];
-
- prev = head;
- while ( (res = *prev) )
- {
- if (res->id == id && res->type == type)
- {
+
+ if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) {
+ head = &clientTable[cid].resources[Hash(cid, id)];
+
+ prev = head;
+ while ((res = *prev)) {
+ if (res->id == id && res->type == type) {
#ifdef XSERVER_DTRACE
- XSERVER_RESOURCE_FREE(res->id, res->type,
- res->value, TypeNameString(res->type));
-#endif
- *prev = res->next;
- clientTable[cid].elements--;
-
- doFreeResource(res, skipFree);
-
- break;
- }
- else
- prev = &res->next;
+ XSERVER_RESOURCE_FREE(res->id, res->type,
+ res->value, TypeNameString(res->type));
+#endif
+ *prev = res->next;
+ clientTable[cid].elements--;
+
+ doFreeResource(res, skipFree);
+
+ break;
+ }
+ else
+ prev = &res->next;
}
}
}
@@ -652,21 +624,19 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
*/
Bool
-ChangeResourceValue (XID id, RESTYPE rtype, pointer value)
+ChangeResourceValue(XID id, RESTYPE rtype, pointer value)
{
- int cid;
+ int cid;
ResourcePtr res;
- if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
- {
- res = clientTable[cid].resources[Hash(cid, id)];
+ if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) {
+ res = clientTable[cid].resources[Hash(cid, id)];
- for (; res; res = res->next)
- if ((res->id == id) && (res->type == rtype))
- {
- res->value = value;
- return TRUE;
- }
+ for (; res; res = res->next)
+ if ((res->id == id) && (res->type == rtype)) {
+ res->value = value;
+ return TRUE;
+ }
}
return FALSE;
}
@@ -678,43 +648,35 @@ ChangeResourceValue (XID id, RESTYPE rtype, pointer value)
*/
void
-FindClientResourcesByType(
- ClientPtr client,
- RESTYPE type,
- FindResType func,
- pointer cdata
-){
+FindClientResourcesByType(ClientPtr client,
+ RESTYPE type, FindResType func, pointer cdata)
+{
ResourcePtr *resources;
ResourcePtr this, next;
int i, elements;
int *eltptr;
if (!client)
- client = serverClient;
+ client = serverClient;
resources = clientTable[client->index].resources;
eltptr = &clientTable[client->index].elements;
- for (i = 0; i < clientTable[client->index].buckets; i++)
- {
- for (this = resources[i]; this; this = next)
- {
- next = this->next;
- if (!type || this->type == type) {
- elements = *eltptr;
- (*func)(this->value, this->id, cdata);
- if (*eltptr != elements)
- next = resources[i]; /* start over */
- }
- }
+ for (i = 0; i < clientTable[client->index].buckets; i++) {
+ for (this = resources[i]; this; this = next) {
+ next = this->next;
+ if (!type || this->type == type) {
+ elements = *eltptr;
+ (*func) (this->value, this->id, cdata);
+ if (*eltptr != elements)
+ next = resources[i]; /* start over */
+ }
+ }
}
}
void
-FindAllClientResources(
- ClientPtr client,
- FindAllRes func,
- pointer cdata
-){
+FindAllClientResources(ClientPtr client, FindAllRes func, pointer cdata)
+{
ResourcePtr *resources;
ResourcePtr this, next;
int i, elements;
@@ -725,51 +687,45 @@ FindAllClientResources(
resources = clientTable[client->index].resources;
eltptr = &clientTable[client->index].elements;
- for (i = 0; i < clientTable[client->index].buckets; i++)
- {
- for (this = resources[i]; this; this = next)
- {
+ for (i = 0; i < clientTable[client->index].buckets; i++) {
+ for (this = resources[i]; this; this = next) {
next = this->next;
elements = *eltptr;
- (*func)(this->value, this->id, this->type, cdata);
+ (*func) (this->value, this->id, this->type, cdata);
if (*eltptr != elements)
- next = resources[i]; /* start over */
+ next = resources[i]; /* start over */
}
}
}
-
pointer
-LookupClientResourceComplex(
- ClientPtr client,
- RESTYPE type,
- FindComplexResType func,
- pointer cdata
-){
+LookupClientResourceComplex(ClientPtr client,
+ RESTYPE type,
+ FindComplexResType func, pointer cdata)
+{
ResourcePtr *resources;
ResourcePtr this, next;
pointer value;
int i;
if (!client)
- client = serverClient;
+ client = serverClient;
resources = clientTable[client->index].resources;
for (i = 0; i < clientTable[client->index].buckets; i++) {
for (this = resources[i]; this; this = next) {
- next = this->next;
- if (!type || this->type == type) {
- /* workaround func freeing the type as DRI1 does */
- value = this->value;
- if((*func)(value, this->id, cdata))
- return value;
- }
- }
+ next = this->next;
+ if (!type || this->type == type) {
+ /* workaround func freeing the type as DRI1 does */
+ value = this->value;
+ if ((*func) (value, this->id, cdata))
+ return value;
+ }
+ }
}
return NULL;
}
-
void
FreeClientNeverRetainResources(ClientPtr client)
{
@@ -780,34 +736,32 @@ FreeClientNeverRetainResources(ClientPtr client)
int *eltptr;
if (!client)
- return;
+ return;
resources = clientTable[client->index].resources;
eltptr = &clientTable[client->index].elements;
- for (j=0; j < clientTable[client->index].buckets; j++)
- {
- prev = &resources[j];
- while ( (this = *prev) )
- {
- RESTYPE rtype = this->type;
- if (rtype & RC_NEVERRETAIN)
- {
+ for (j = 0; j < clientTable[client->index].buckets; j++) {
+ prev = &resources[j];
+ while ((this = *prev)) {
+ RESTYPE rtype = this->type;
+
+ if (rtype & RC_NEVERRETAIN) {
#ifdef XSERVER_DTRACE
- XSERVER_RESOURCE_FREE(this->id, this->type,
- this->value, TypeNameString(this->type));
-#endif
- *prev = this->next;
- clientTable[client->index].elements--;
- elements = *eltptr;
-
- doFreeResource(this, FALSE);
-
- if (*eltptr != elements)
- prev = &resources[j]; /* prev may no longer be valid */
- }
- else
- prev = &this->next;
- }
+ XSERVER_RESOURCE_FREE(this->id, this->type,
+ this->value, TypeNameString(this->type));
+#endif
+ *prev = this->next;
+ clientTable[client->index].elements--;
+ elements = *eltptr;
+
+ doFreeResource(this, FALSE);
+
+ if (*eltptr != elements)
+ prev = &resources[j]; /* prev may no longer be valid */
+ }
+ else
+ prev = &this->next;
+ }
}
}
@@ -819,40 +773,38 @@ FreeClientResources(ClientPtr client)
int j;
/* This routine shouldn't be called with a null client, but just in
- case ... */
+ case ... */
if (!client)
- return;
+ return;
HandleSaveSet(client);
resources = clientTable[client->index].resources;
- for (j=0; j < clientTable[client->index].buckets; j++)
- {
+ for (j = 0; j < clientTable[client->index].buckets; j++) {
/* It may seem silly to update the head of this resource list as
- we delete the members, since the entire list will be deleted any way,
- but there are some resource deletion functions "FreeClientPixels" for
- one which do a LookupID on another resource id (a Colormap id in this
- case), so the resource list must be kept valid up to the point that
- it is deleted, so every time we delete a resource, we must update the
- head, just like in FreeResource. I hope that this doesn't slow down
- mass deletion appreciably. PRH */
+ we delete the members, since the entire list will be deleted any way,
+ but there are some resource deletion functions "FreeClientPixels" for
+ one which do a LookupID on another resource id (a Colormap id in this
+ case), so the resource list must be kept valid up to the point that
+ it is deleted, so every time we delete a resource, we must update the
+ head, just like in FreeResource. I hope that this doesn't slow down
+ mass deletion appreciably. PRH */
- ResourcePtr *head;
+ ResourcePtr *head;
- head = &resources[j];
+ head = &resources[j];
- for (this = *head; this; this = *head)
- {
+ for (this = *head; this; this = *head) {
#ifdef XSERVER_DTRACE
- XSERVER_RESOURCE_FREE(this->id, this->type,
- this->value, TypeNameString(this->type));
-#endif
- *head = this->next;
- clientTable[client->index].elements--;
-
- doFreeResource(this, FALSE);
- }
+ XSERVER_RESOURCE_FREE(this->id, this->type,
+ this->value, TypeNameString(this->type));
+#endif
+ *head = this->next;
+ clientTable[client->index].elements--;
+
+ doFreeResource(this, FALSE);
+ }
}
free(clientTable[client->index].resources);
clientTable[client->index].resources = NULL;
@@ -862,12 +814,11 @@ FreeClientResources(ClientPtr client)
void
FreeAllResources(void)
{
- int i;
+ int i;
- for (i = currentMaxClients; --i >= 0; )
- {
- if (clientTable[i].buckets)
- FreeClientResources(clients[i]);
+ for (i = currentMaxClients; --i >= 0;) {
+ if (clientTable[i].buckets)
+ FreeClientResources(clients[i]);
}
}
@@ -878,7 +829,7 @@ LegalNewID(XID id, ClientPtr client)
int rc;
#ifdef PANORAMIX
- XID minid, maxid;
+ XID minid, maxid;
if (!noPanoramiXExtension) {
minid = client->clientAsMask | (client->index ?
@@ -887,9 +838,8 @@ LegalNewID(XID id, ClientPtr client)
if ((id >= minid) && (id <= maxid))
return TRUE;
}
-#endif /* PANORAMIX */
- if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
- {
+#endif /* PANORAMIX */
+ if (client->clientAsMask == (id & ~RESOURCE_ID_MASK)) {
rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
DixGetAttrAccess);
return rc == BadValue;
@@ -899,33 +849,33 @@ LegalNewID(XID id, ClientPtr client)
int
dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
- ClientPtr client, Mask mode)
+ ClientPtr client, Mask mode)
{
int cid = CLIENT_ID(id);
ResourcePtr res = NULL;
*result = NULL;
if ((rtype & TypeMask) > lastResourceType)
- return BadImplementation;
+ return BadImplementation;
if ((cid < MAXCLIENTS) && clientTable[cid].buckets) {
- res = clientTable[cid].resources[Hash(cid, id)];
+ res = clientTable[cid].resources[Hash(cid, id)];
- for (; res; res = res->next)
- if (res->id == id && res->type == rtype)
- break;
+ for (; res; res = res->next)
+ if (res->id == id && res->type == rtype)
+ break;
}
if (!res)
- return resourceTypes[rtype & TypeMask].errorValue;
+ return resourceTypes[rtype & TypeMask].errorValue;
if (client) {
- client->errorValue = id;
- cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
- res->value, RT_NONE, NULL, mode);
- if (cid == BadValue)
- return resourceTypes[rtype & TypeMask].errorValue;
- if (cid != Success)
- return cid;
+ client->errorValue = id;
+ cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
+ res->value, RT_NONE, NULL, mode);
+ if (cid == BadValue)
+ return resourceTypes[rtype & TypeMask].errorValue;
+ if (cid != Success)
+ return cid;
}
*result = res->value;
@@ -934,7 +884,7 @@ dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
int
dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass,
- ClientPtr client, Mask mode)
+ ClientPtr client, Mask mode)
{
int cid = CLIENT_ID(id);
ResourcePtr res = NULL;
@@ -942,21 +892,21 @@ dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass,
*result = NULL;
if ((cid < MAXCLIENTS) && clientTable[cid].buckets) {
- res = clientTable[cid].resources[Hash(cid, id)];
+ res = clientTable[cid].resources[Hash(cid, id)];
- for (; res; res = res->next)
- if (res->id == id && (res->type & rclass))
- break;
+ for (; res; res = res->next)
+ if (res->id == id && (res->type & rclass))
+ break;
}
if (!res)
- return BadValue;
+ return BadValue;
if (client) {
- client->errorValue = id;
- cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
- res->value, RT_NONE, NULL, mode);
- if (cid != Success)
- return cid;
+ client->errorValue = id;
+ cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
+ res->value, RT_NONE, NULL, mode);
+ if (cid != Success)
+ return cid;
}
*result = res->value;
diff --git a/xorg-server/dix/selection.c b/xorg-server/dix/selection.c
index 732ba34e5..dfdcfdc64 100644
--- a/xorg-server/dix/selection.c
+++ b/xorg-server/dix/selection.c
@@ -1,311 +1,309 @@
-/************************************************************
-
-Copyright 1987, 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "windowstr.h"
-#include "dixstruct.h"
-#include "dispatch.h"
-#include "selection.h"
-#include "xace.h"
-
-/*****************************************************************
- * Selection Stuff
- *
- * dixLookupSelection
- *
- * Selections are global to the server. The list of selections should
- * not be traversed directly. Instead, use the functions listed above.
- *
- *****************************************************************/
-
-Selection *CurrentSelections;
-CallbackListPtr SelectionCallback;
-
-int
-dixLookupSelection(Selection **result, Atom selectionName,
- ClientPtr client, Mask access_mode)
-{
- Selection *pSel;
- int rc = BadMatch;
- client->errorValue = selectionName;
-
- for (pSel = CurrentSelections; pSel; pSel = pSel->next)
- if (pSel->selection == selectionName)
- break;
-
- if (pSel)
- rc = XaceHookSelectionAccess(client, &pSel, access_mode);
- *result = pSel;
- return rc;
-}
-
-void
-InitSelections(void)
-{
- Selection *pSel, *pNextSel;
-
- pSel = CurrentSelections;
- while (pSel) {
- pNextSel = pSel->next;
- dixFreeObjectWithPrivates(pSel, PRIVATE_SELECTION);
- pSel = pNextSel;
- }
-
- CurrentSelections = NULL;
-}
-
-static _X_INLINE void
-CallSelectionCallback(Selection *pSel, ClientPtr client,
- SelectionCallbackKind kind)
-{
- SelectionInfoRec info = { pSel, client, kind };
- CallCallbacks(&SelectionCallback, &info);
-}
-
-void
-DeleteWindowFromAnySelections(WindowPtr pWin)
-{
- Selection *pSel;
-
- for (pSel = CurrentSelections; pSel; pSel = pSel->next)
- if (pSel->pWin == pWin) {
- CallSelectionCallback(pSel, NULL, SelectionWindowDestroy);
-
- pSel->pWin = (WindowPtr)NULL;
- pSel->window = None;
- pSel->client = NullClient;
- }
-}
-
-void
-DeleteClientFromAnySelections(ClientPtr client)
-{
- Selection *pSel;
-
- for (pSel = CurrentSelections; pSel; pSel = pSel->next)
- if (pSel->client == client) {
- CallSelectionCallback(pSel, NULL, SelectionClientClose);
-
- pSel->pWin = (WindowPtr)NULL;
- pSel->window = None;
- pSel->client = NullClient;
- }
-}
-
-int
-ProcSetSelectionOwner(ClientPtr client)
-{
- WindowPtr pWin = NULL;
- TimeStamp time;
- Selection *pSel;
- int rc;
-
- REQUEST(xSetSelectionOwnerReq);
- REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
-
- UpdateCurrentTime();
- time = ClientTimeToServerTime(stuff->time);
-
- /* If the client's time stamp is in the future relative to the server's
- time stamp, do not set the selection, just return success. */
- if (CompareTimeStamps(time, currentTime) == LATER)
- return Success;
-
- if (stuff->window != None) {
- rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess);
- if (rc != Success)
- return rc;
- }
- if (!ValidAtom(stuff->selection)) {
- client->errorValue = stuff->selection;
- return BadAtom;
- }
-
- /*
- * First, see if the selection is already set...
- */
- rc = dixLookupSelection(&pSel, stuff->selection, client, DixSetAttrAccess);
-
- if (rc == Success) {
- xEvent event;
-
- /* If the timestamp in client's request is in the past relative
- to the time stamp indicating the last time the owner of the
- selection was set, do not set the selection, just return
- success. */
- if (CompareTimeStamps(time, pSel->lastTimeChanged) == EARLIER)
- return Success;
- if (pSel->client && (!pWin || (pSel->client != client)))
- {
- event.u.u.type = SelectionClear;
- event.u.selectionClear.time = time.milliseconds;
- event.u.selectionClear.window = pSel->window;
- event.u.selectionClear.atom = pSel->selection;
- WriteEventsToClient(pSel->client, 1, &event);
- }
- }
- else if (rc == BadMatch)
- {
- /*
- * It doesn't exist, so add it...
- */
- pSel = dixAllocateObjectWithPrivates(Selection, PRIVATE_SELECTION);
- if (!pSel)
- return BadAlloc;
-
- pSel->selection = stuff->selection;
-
- /* security creation/labeling check */
- rc = XaceHookSelectionAccess(client, &pSel,
- DixCreateAccess|DixSetAttrAccess);
- if (rc != Success) {
- free(pSel);
- return rc;
- }
-
- pSel->next = CurrentSelections;
- CurrentSelections = pSel;
- }
- else
- return rc;
-
- pSel->lastTimeChanged = time;
- pSel->window = stuff->window;
- pSel->pWin = pWin;
- pSel->client = (pWin ? client : NullClient);
-
- CallSelectionCallback(pSel, client, SelectionSetOwner);
- return Success;
-}
-
-int
-ProcGetSelectionOwner(ClientPtr client)
-{
- int rc;
- Selection *pSel;
- xGetSelectionOwnerReply reply;
-
- REQUEST(xResourceReq);
- REQUEST_SIZE_MATCH(xResourceReq);
-
- if (!ValidAtom(stuff->id)) {
- client->errorValue = stuff->id;
- return BadAtom;
- }
-
- memset(&reply, 0, sizeof(xGetSelectionOwnerReply));
- reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
-
- rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess);
- if (rc == Success)
- reply.owner = pSel->window;
- else if (rc == BadMatch)
- reply.owner = None;
- else
- return rc;
-
- WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply);
- return Success;
-}
-
-int
-ProcConvertSelection(ClientPtr client)
-{
- Bool paramsOkay;
- xEvent event;
- WindowPtr pWin;
- Selection *pSel;
- int rc;
-
- REQUEST(xConvertSelectionReq);
- REQUEST_SIZE_MATCH(xConvertSelectionReq);
-
- rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess);
- if (rc != Success)
- return rc;
-
- paramsOkay = ValidAtom(stuff->selection) && ValidAtom(stuff->target);
- paramsOkay &= (stuff->property == None) || ValidAtom(stuff->property);
- if (!paramsOkay) {
- client->errorValue = stuff->property;
- return BadAtom;
- }
-
- rc = dixLookupSelection(&pSel, stuff->selection, client, DixReadAccess);
-
- memset(&event, 0, sizeof(xEvent));
- if (rc != Success && rc != BadMatch)
- return rc;
- else if (rc == Success && pSel->window != None) {
- event.u.u.type = SelectionRequest;
- event.u.selectionRequest.owner = pSel->window;
- event.u.selectionRequest.time = stuff->time;
- event.u.selectionRequest.requestor = stuff->requestor;
- event.u.selectionRequest.selection = stuff->selection;
- event.u.selectionRequest.target = stuff->target;
- event.u.selectionRequest.property = stuff->property;
- if (pSel->client && pSel->client != serverClient && !pSel->client->clientGone)
- {
- WriteEventsToClient(pSel->client, 1, &event);
- return Success;
- }
- }
-
- event.u.u.type = SelectionNotify;
- event.u.selectionNotify.time = stuff->time;
- event.u.selectionNotify.requestor = stuff->requestor;
- event.u.selectionNotify.selection = stuff->selection;
- event.u.selectionNotify.target = stuff->target;
- event.u.selectionNotify.property = None;
- WriteEventsToClient(client, 1, &event);
- return Success;
-}
+/************************************************************
+
+Copyright 1987, 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "windowstr.h"
+#include "dixstruct.h"
+#include "dispatch.h"
+#include "selection.h"
+#include "xace.h"
+
+/*****************************************************************
+ * Selection Stuff
+ *
+ * dixLookupSelection
+ *
+ * Selections are global to the server. The list of selections should
+ * not be traversed directly. Instead, use the functions listed above.
+ *
+ *****************************************************************/
+
+Selection *CurrentSelections;
+CallbackListPtr SelectionCallback;
+
+int
+dixLookupSelection(Selection ** result, Atom selectionName,
+ ClientPtr client, Mask access_mode)
+{
+ Selection *pSel;
+ int rc = BadMatch;
+
+ client->errorValue = selectionName;
+
+ for (pSel = CurrentSelections; pSel; pSel = pSel->next)
+ if (pSel->selection == selectionName)
+ break;
+
+ if (pSel)
+ rc = XaceHookSelectionAccess(client, &pSel, access_mode);
+ *result = pSel;
+ return rc;
+}
+
+void
+InitSelections(void)
+{
+ Selection *pSel, *pNextSel;
+
+ pSel = CurrentSelections;
+ while (pSel) {
+ pNextSel = pSel->next;
+ dixFreeObjectWithPrivates(pSel, PRIVATE_SELECTION);
+ pSel = pNextSel;
+ }
+
+ CurrentSelections = NULL;
+}
+
+static _X_INLINE void
+CallSelectionCallback(Selection * pSel, ClientPtr client,
+ SelectionCallbackKind kind)
+{
+ SelectionInfoRec info = { pSel, client, kind };
+ CallCallbacks(&SelectionCallback, &info);
+}
+
+void
+DeleteWindowFromAnySelections(WindowPtr pWin)
+{
+ Selection *pSel;
+
+ for (pSel = CurrentSelections; pSel; pSel = pSel->next)
+ if (pSel->pWin == pWin) {
+ CallSelectionCallback(pSel, NULL, SelectionWindowDestroy);
+
+ pSel->pWin = (WindowPtr) NULL;
+ pSel->window = None;
+ pSel->client = NullClient;
+ }
+}
+
+void
+DeleteClientFromAnySelections(ClientPtr client)
+{
+ Selection *pSel;
+
+ for (pSel = CurrentSelections; pSel; pSel = pSel->next)
+ if (pSel->client == client) {
+ CallSelectionCallback(pSel, NULL, SelectionClientClose);
+
+ pSel->pWin = (WindowPtr) NULL;
+ pSel->window = None;
+ pSel->client = NullClient;
+ }
+}
+
+int
+ProcSetSelectionOwner(ClientPtr client)
+{
+ WindowPtr pWin = NULL;
+ TimeStamp time;
+ Selection *pSel;
+ int rc;
+
+ REQUEST(xSetSelectionOwnerReq);
+ REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
+
+ UpdateCurrentTime();
+ time = ClientTimeToServerTime(stuff->time);
+
+ /* If the client's time stamp is in the future relative to the server's
+ time stamp, do not set the selection, just return success. */
+ if (CompareTimeStamps(time, currentTime) == LATER)
+ return Success;
+
+ if (stuff->window != None) {
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
+ }
+ if (!ValidAtom(stuff->selection)) {
+ client->errorValue = stuff->selection;
+ return BadAtom;
+ }
+
+ /*
+ * First, see if the selection is already set...
+ */
+ rc = dixLookupSelection(&pSel, stuff->selection, client, DixSetAttrAccess);
+
+ if (rc == Success) {
+ xEvent event;
+
+ /* If the timestamp in client's request is in the past relative
+ to the time stamp indicating the last time the owner of the
+ selection was set, do not set the selection, just return
+ success. */
+ if (CompareTimeStamps(time, pSel->lastTimeChanged) == EARLIER)
+ return Success;
+ if (pSel->client && (!pWin || (pSel->client != client))) {
+ event.u.u.type = SelectionClear;
+ event.u.selectionClear.time = time.milliseconds;
+ event.u.selectionClear.window = pSel->window;
+ event.u.selectionClear.atom = pSel->selection;
+ WriteEventsToClient(pSel->client, 1, &event);
+ }
+ }
+ else if (rc == BadMatch) {
+ /*
+ * It doesn't exist, so add it...
+ */
+ pSel = dixAllocateObjectWithPrivates(Selection, PRIVATE_SELECTION);
+ if (!pSel)
+ return BadAlloc;
+
+ pSel->selection = stuff->selection;
+
+ /* security creation/labeling check */
+ rc = XaceHookSelectionAccess(client, &pSel,
+ DixCreateAccess | DixSetAttrAccess);
+ if (rc != Success) {
+ free(pSel);
+ return rc;
+ }
+
+ pSel->next = CurrentSelections;
+ CurrentSelections = pSel;
+ }
+ else
+ return rc;
+
+ pSel->lastTimeChanged = time;
+ pSel->window = stuff->window;
+ pSel->pWin = pWin;
+ pSel->client = (pWin ? client : NullClient);
+
+ CallSelectionCallback(pSel, client, SelectionSetOwner);
+ return Success;
+}
+
+int
+ProcGetSelectionOwner(ClientPtr client)
+{
+ int rc;
+ Selection *pSel;
+ xGetSelectionOwnerReply reply;
+
+ REQUEST(xResourceReq);
+ REQUEST_SIZE_MATCH(xResourceReq);
+
+ if (!ValidAtom(stuff->id)) {
+ client->errorValue = stuff->id;
+ return BadAtom;
+ }
+
+ memset(&reply, 0, sizeof(xGetSelectionOwnerReply));
+ reply.type = X_Reply;
+ reply.length = 0;
+ reply.sequenceNumber = client->sequence;
+
+ rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess);
+ if (rc == Success)
+ reply.owner = pSel->window;
+ else if (rc == BadMatch)
+ reply.owner = None;
+ else
+ return rc;
+
+ WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply);
+ return Success;
+}
+
+int
+ProcConvertSelection(ClientPtr client)
+{
+ Bool paramsOkay;
+ xEvent event;
+ WindowPtr pWin;
+ Selection *pSel;
+ int rc;
+
+ REQUEST(xConvertSelectionReq);
+ REQUEST_SIZE_MATCH(xConvertSelectionReq);
+
+ rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ paramsOkay = ValidAtom(stuff->selection) && ValidAtom(stuff->target);
+ paramsOkay &= (stuff->property == None) || ValidAtom(stuff->property);
+ if (!paramsOkay) {
+ client->errorValue = stuff->property;
+ return BadAtom;
+ }
+
+ rc = dixLookupSelection(&pSel, stuff->selection, client, DixReadAccess);
+
+ memset(&event, 0, sizeof(xEvent));
+ if (rc != Success && rc != BadMatch)
+ return rc;
+ else if (rc == Success && pSel->window != None) {
+ event.u.u.type = SelectionRequest;
+ event.u.selectionRequest.owner = pSel->window;
+ event.u.selectionRequest.time = stuff->time;
+ event.u.selectionRequest.requestor = stuff->requestor;
+ event.u.selectionRequest.selection = stuff->selection;
+ event.u.selectionRequest.target = stuff->target;
+ event.u.selectionRequest.property = stuff->property;
+ if (pSel->client && pSel->client != serverClient &&
+ !pSel->client->clientGone) {
+ WriteEventsToClient(pSel->client, 1, &event);
+ return Success;
+ }
+ }
+
+ event.u.u.type = SelectionNotify;
+ event.u.selectionNotify.time = stuff->time;
+ event.u.selectionNotify.requestor = stuff->requestor;
+ event.u.selectionNotify.selection = stuff->selection;
+ event.u.selectionNotify.target = stuff->target;
+ event.u.selectionNotify.property = None;
+ WriteEventsToClient(client, 1, &event);
+ return Success;
+}
diff --git a/xorg-server/dix/swaprep.c b/xorg-server/dix/swaprep.c
index 28c354cd9..9440c4ee3 100644
--- a/xorg-server/dix/swaprep.c
+++ b/xorg-server/dix/swaprep.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -45,7 +44,6 @@ SOFTWARE.
********************************************************/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -59,11 +57,11 @@ SOFTWARE.
#include "swaprep.h"
#include "globals.h"
-static void SwapFontInfo(xQueryFontReply *pr);
+static void SwapFontInfo(xQueryFontReply * pr);
-static void SwapCharInfo(xCharInfo *pInfo);
+static void SwapCharInfo(xCharInfo * pInfo);
-static void SwapFont(xQueryFontReply *pr, Bool hasGlyphs);
+static void SwapFont(xQueryFontReply * pr, Bool hasGlyphs);
/**
* Thanks to Jack Palevich for testing and subsequently rewriting all this
@@ -76,13 +74,13 @@ Swap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
int i;
size >>= 2;
- for(i = 0; i < size; i++)
- /* brackets are mandatory here, because "swapl" macro expands
- to several statements */
- {
- swapl(&pbuf[i]);
+ for (i = 0; i < size; i++)
+ /* brackets are mandatory here, because "swapl" macro expands
+ to several statements */
+ {
+ swapl(&pbuf[i]);
}
- (void)WriteToClient(pClient, size << 2, (char *) pbuf);
+ (void) WriteToClient(pClient, size << 2, (char *) pbuf);
}
/**
@@ -96,18 +94,16 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
CARD32 *pbufT;
CARD32 *from, *to, *fromLast, *toLast;
CARD32 tmpbuf[1];
-
+
/* Allocate as big a buffer as we can... */
- while (!(pbufT = malloc(bufsize)))
- {
+ while (!(pbufT = malloc(bufsize))) {
bufsize >>= 1;
- if (bufsize == 4)
- {
- pbufT = tmpbuf;
- break;
- }
+ if (bufsize == 4) {
+ pbufT = tmpbuf;
+ break;
+ }
}
-
+
/* convert lengths from # of bytes to # of longs */
size >>= 2;
bufsize >>= 2;
@@ -115,22 +111,23 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
from = pbuf;
fromLast = from + size;
while (from < fromLast) {
- int nbytes;
+ int nbytes;
+
to = pbufT;
- toLast = to + min (bufsize, fromLast - from);
+ toLast = to + min(bufsize, fromLast - from);
nbytes = (toLast - to) << 2;
while (to < toLast) {
/* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro
- that evaulates its args more than once */
- cpswapl(*from, *to);
+ that evaulates its args more than once */
+ cpswapl(*from, *to);
from++;
to++;
- }
- (void)WriteToClient (pClient, nbytes, (char *) pbufT);
- }
+ }
+ (void) WriteToClient(pClient, nbytes, (char *) pbufT);
+ }
if (pbufT != tmpbuf)
- free(pbufT);
+ free(pbufT);
}
/**
@@ -144,18 +141,16 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
short *pbufT;
short *from, *to, *fromLast, *toLast;
short tmpbuf[2];
-
+
/* Allocate as big a buffer as we can... */
- while (!(pbufT = malloc(bufsize)))
- {
+ while (!(pbufT = malloc(bufsize))) {
bufsize >>= 1;
- if (bufsize == 4)
- {
- pbufT = tmpbuf;
- break;
- }
+ if (bufsize == 4) {
+ pbufT = tmpbuf;
+ break;
+ }
}
-
+
/* convert lengths from # of bytes to # of shorts */
size >>= 1;
bufsize >>= 1;
@@ -163,37 +158,37 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
from = pbuf;
fromLast = from + size;
while (from < fromLast) {
- int nbytes;
+ int nbytes;
+
to = pbufT;
- toLast = to + min (bufsize, fromLast - from);
+ toLast = to + min(bufsize, fromLast - from);
nbytes = (toLast - to) << 1;
while (to < toLast) {
/* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro
- that evaulates its args more than once */
- cpswaps(*from, *to);
+ that evaulates its args more than once */
+ cpswaps(*from, *to);
from++;
to++;
- }
- (void)WriteToClient (pClient, nbytes, (char *) pbufT);
- }
+ }
+ (void) WriteToClient(pClient, nbytes, (char *) pbufT);
+ }
if (pbufT != tmpbuf)
- free(pbufT);
+ free(pbufT);
}
-
/* Extra-small reply */
void
-SGenericReply(ClientPtr pClient, int size, xGenericReply *pRep)
+SGenericReply(ClientPtr pClient, int size, xGenericReply * pRep)
{
swaps(&pRep->sequenceNumber);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
/* Extra-large reply */
void
SGetWindowAttributesReply(ClientPtr pClient, int size,
- xGetWindowAttributesReply *pRep)
+ xGetWindowAttributesReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
@@ -205,11 +200,11 @@ SGetWindowAttributesReply(ClientPtr pClient, int size,
swapl(&pRep->allEventMasks);
swapl(&pRep->yourEventMask);
swaps(&pRep->doNotPropagateMask);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep)
+SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->root);
@@ -218,70 +213,68 @@ SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep)
swaps(&pRep->width);
swaps(&pRep->height);
swaps(&pRep->borderWidth);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply *pRep)
+SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swapl(&pRep->root);
swapl(&pRep->parent);
swaps(&pRep->nChildren);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply *pRep)
+SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->atom);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep)
+SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swaps(&pRep->nameLength);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
-
void
-SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply *pRep)
+SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swapl(&pRep->propertyType);
swapl(&pRep->bytesAfter);
swapl(&pRep->nItems);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply *pRep)
+SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swaps(&pRep->nProperties);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
SGetSelectionOwnerReply(ClientPtr pClient, int size,
- xGetSelectionOwnerReply *pRep)
+ xGetSelectionOwnerReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->owner);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
-
void
-SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep)
+SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->root);
@@ -291,11 +284,11 @@ SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep)
swaps(&pRep->winX);
swaps(&pRep->winY);
swaps(&pRep->mask);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
static void
-SwapTimecoord(xTimecoord* pCoord)
+SwapTimecoord(xTimecoord * pCoord)
{
swapl(&pCoord->time);
swaps(&pCoord->x);
@@ -303,59 +296,59 @@ SwapTimecoord(xTimecoord* pCoord)
}
void
-SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord *pRep)
+SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord * pRep)
{
- int i, n;
- xTimecoord *pRepT;
+ int i, n;
+ xTimecoord *pRepT;
n = size / sizeof(xTimecoord);
pRepT = pRep;
- for(i = 0; i < n; i++)
- {
- SwapTimecoord(pRepT);
- pRepT++;
+ for (i = 0; i < n; i++) {
+ SwapTimecoord(pRepT);
+ pRepT++;
}
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
+
void
-SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply *pRep)
+SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swapl(&pRep->nEvents);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply *pRep)
+STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->child);
swaps(&pRep->dstX);
swaps(&pRep->dstY);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep)
+SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->focus);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
/* extra long reply */
void
-SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep)
+SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
static void
-SwapCharInfo(xCharInfo *pInfo)
+SwapCharInfo(xCharInfo * pInfo)
{
swaps(&pInfo->leftSideBearing);
swaps(&pInfo->rightSideBearing);
@@ -366,7 +359,7 @@ SwapCharInfo(xCharInfo *pInfo)
}
static void
-SwapFontInfo(xQueryFontReply *pr)
+SwapFontInfo(xQueryFontReply * pr)
{
swaps(&pr->minCharOrByte2);
swaps(&pr->maxCharOrByte2);
@@ -374,18 +367,18 @@ SwapFontInfo(xQueryFontReply *pr)
swaps(&pr->nFontProps);
swaps(&pr->fontAscent);
swaps(&pr->fontDescent);
- SwapCharInfo( &pr->minBounds);
- SwapCharInfo( &pr->maxBounds);
+ SwapCharInfo(&pr->minBounds);
+ SwapCharInfo(&pr->maxBounds);
swapl(&pr->nCharInfos);
}
static void
-SwapFont(xQueryFontReply *pr, Bool hasGlyphs)
+SwapFont(xQueryFontReply * pr, Bool hasGlyphs)
{
- unsigned i;
- xCharInfo * pxci;
- unsigned nchars, nprops;
- char *pby;
+ unsigned i;
+ xCharInfo *pxci;
+ unsigned nchars, nprops;
+ char *pby;
swaps(&pr->sequenceNumber);
swapl(&pr->length);
@@ -395,30 +388,29 @@ SwapFont(xQueryFontReply *pr, Bool hasGlyphs)
pby = (char *) &pr[1];
/* Font properties are an atom and either an int32 or a CARD32, so
* they are always 2 4 byte values */
- for(i = 0; i < nprops; i++)
- {
- swapl((int *)pby);
- pby += 4;
- swapl((int *)pby);
- pby += 4;
+ for (i = 0; i < nprops; i++) {
+ swapl((int *) pby);
+ pby += 4;
+ swapl((int *) pby);
+ pby += 4;
}
- if (hasGlyphs)
- {
- pxci = (xCharInfo *)pby;
- for(i = 0; i< nchars; i++, pxci++)
- SwapCharInfo(pxci);
+ if (hasGlyphs) {
+ pxci = (xCharInfo *) pby;
+ for (i = 0; i < nchars; i++, pxci++)
+ SwapCharInfo(pxci);
}
}
void
-SQueryFontReply(ClientPtr pClient, int size, xQueryFontReply *pRep)
+SQueryFontReply(ClientPtr pClient, int size, xQueryFontReply * pRep)
{
SwapFont(pRep, TRUE);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep)
+SQueryTextExtentsReply(ClientPtr pClient, int size,
+ xQueryTextExtentsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swaps(&pRep->fontAscent);
@@ -428,68 +420,68 @@ SQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep
swapl(&pRep->overallWidth);
swapl(&pRep->overallLeft);
swapl(&pRep->overallRight);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SListFontsReply(ClientPtr pClient, int size, xListFontsReply *pRep)
+SListFontsReply(ClientPtr pClient, int size, xListFontsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swaps(&pRep->nFonts);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
SListFontsWithInfoReply(ClientPtr pClient, int size,
- xListFontsWithInfoReply *pRep)
+ xListFontsWithInfoReply * pRep)
{
- SwapFont((xQueryFontReply *)pRep, FALSE);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ SwapFont((xQueryFontReply *) pRep, FALSE);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply *pRep)
+SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swaps(&pRep->nPaths);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SGetImageReply(ClientPtr pClient, int size, xGetImageReply *pRep)
+SGetImageReply(ClientPtr pClient, int size, xGetImageReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swapl(&pRep->visual);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
/* Fortunately, image doesn't need swapping */
}
void
SListInstalledColormapsReply(ClientPtr pClient, int size,
- xListInstalledColormapsReply *pRep)
+ xListInstalledColormapsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swaps(&pRep->nColormaps);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SAllocColorReply(ClientPtr pClient, int size, xAllocColorReply *pRep)
+SAllocColorReply(ClientPtr pClient, int size, xAllocColorReply * pRep)
{
swaps(&pRep->sequenceNumber);
swaps(&pRep->red);
swaps(&pRep->green);
swaps(&pRep->blue);
swapl(&pRep->pixel);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep)
+SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->pixel);
@@ -499,22 +491,22 @@ SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep)
swaps(&pRep->screenRed);
swaps(&pRep->screenGreen);
swaps(&pRep->screenBlue);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep)
+SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swaps(&pRep->nPixels);
swaps(&pRep->nMasks);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
-
void
-SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep)
+SAllocColorPlanesReply(ClientPtr pClient, int size,
+ xAllocColorPlanesReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
@@ -522,11 +514,11 @@ SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep
swapl(&pRep->redMask);
swapl(&pRep->greenMask);
swapl(&pRep->blueMask);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
static void
-SwapRGB(xrgb *prgb)
+SwapRGB(xrgb * prgb)
{
swaps(&prgb->red);
swaps(&prgb->green);
@@ -534,32 +526,31 @@ SwapRGB(xrgb *prgb)
}
void
-SQColorsExtend(ClientPtr pClient, int size, xrgb *prgb)
+SQColorsExtend(ClientPtr pClient, int size, xrgb * prgb)
{
- int i, n;
- xrgb *prgbT;
+ int i, n;
+ xrgb *prgbT;
n = size / sizeof(xrgb);
prgbT = prgb;
- for(i = 0; i < n; i++)
- {
- SwapRGB(prgbT);
- prgbT++;
+ for (i = 0; i < n; i++) {
+ SwapRGB(prgbT);
+ prgbT++;
}
- (void)WriteToClient(pClient, size, (char *) prgb);
+ (void) WriteToClient(pClient, size, (char *) prgb);
}
void
-SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply* pRep)
+SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swaps(&pRep->nColors);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep)
+SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply * pRep)
{
swaps(&pRep->sequenceNumber);
swaps(&pRep->exactRed);
@@ -568,81 +559,83 @@ SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep)
swaps(&pRep->screenRed);
swaps(&pRep->screenGreen);
swaps(&pRep->screenBlue);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply *pRep)
+SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply * pRep)
{
swaps(&pRep->sequenceNumber);
swaps(&pRep->width);
swaps(&pRep->height);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply *pRep)
+SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
SGetKeyboardMappingReply(ClientPtr pClient, int size,
- xGetKeyboardMappingReply *pRep)
+ xGetKeyboardMappingReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
SGetPointerMappingReply(ClientPtr pClient, int size,
- xGetPointerMappingReply *pRep)
+ xGetPointerMappingReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
SGetModifierMappingReply(ClientPtr pClient, int size,
- xGetModifierMappingReply *pRep)
+ xGetModifierMappingReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SGetKeyboardControlReply(ClientPtr pClient, int size, xGetKeyboardControlReply *pRep)
+SGetKeyboardControlReply(ClientPtr pClient, int size,
+ xGetKeyboardControlReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swapl(&pRep->ledMask);
swaps(&pRep->bellPitch);
swaps(&pRep->bellDuration);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SGetPointerControlReply(ClientPtr pClient, int size, xGetPointerControlReply *pRep)
+SGetPointerControlReply(ClientPtr pClient, int size,
+ xGetPointerControlReply * pRep)
{
swaps(&pRep->sequenceNumber);
swaps(&pRep->accelNumerator);
swaps(&pRep->accelDenominator);
swaps(&pRep->threshold);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
-SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply *pRep)
+SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply * pRep)
{
swaps(&pRep->sequenceNumber);
swaps(&pRep->timeout);
swaps(&pRep->interval);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
void
@@ -650,28 +643,28 @@ SLHostsExtend(ClientPtr pClient, int size, char *buf)
{
char *bufT = buf;
char *endbuf = buf + size;
+
while (bufT < endbuf) {
- xHostEntry *host = (xHostEntry *) bufT;
- int len = host->length;
- swaps(&host->length);
- bufT += sizeof (xHostEntry) + pad_to_int32(len);
- }
- (void)WriteToClient (pClient, size, buf);
+ xHostEntry *host = (xHostEntry *) bufT;
+ int len = host->length;
+
+ swaps(&host->length);
+ bufT += sizeof(xHostEntry) + pad_to_int32(len);
+ }
+ (void) WriteToClient(pClient, size, buf);
}
void
-SListHostsReply(ClientPtr pClient, int size, xListHostsReply *pRep)
+SListHostsReply(ClientPtr pClient, int size, xListHostsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swaps(&pRep->nHosts);
- (void)WriteToClient(pClient, size, (char *) pRep);
+ (void) WriteToClient(pClient, size, (char *) pRep);
}
-
-
void
-SErrorEvent(xError *from, xError *to)
+SErrorEvent(xError * from, xError * to)
{
to->type = X_Error;
to->errorCode = from->errorCode;
@@ -687,26 +680,16 @@ SKeyButtonPtrEvent(xEvent *from, xEvent *to)
to->u.u.type = from->u.u.type;
to->u.u.detail = from->u.u.detail;
cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
- cpswapl(from->u.keyButtonPointer.time,
- to->u.keyButtonPointer.time);
- cpswapl(from->u.keyButtonPointer.root,
- to->u.keyButtonPointer.root);
- cpswapl(from->u.keyButtonPointer.event,
- to->u.keyButtonPointer.event);
- cpswapl(from->u.keyButtonPointer.child,
- to->u.keyButtonPointer.child);
- cpswaps(from->u.keyButtonPointer.rootX,
- to->u.keyButtonPointer.rootX);
- cpswaps(from->u.keyButtonPointer.rootY,
- to->u.keyButtonPointer.rootY);
- cpswaps(from->u.keyButtonPointer.eventX,
- to->u.keyButtonPointer.eventX);
- cpswaps(from->u.keyButtonPointer.eventY,
- to->u.keyButtonPointer.eventY);
- cpswaps(from->u.keyButtonPointer.state,
- to->u.keyButtonPointer.state);
- to->u.keyButtonPointer.sameScreen =
- from->u.keyButtonPointer.sameScreen;
+ cpswapl(from->u.keyButtonPointer.time, to->u.keyButtonPointer.time);
+ cpswapl(from->u.keyButtonPointer.root, to->u.keyButtonPointer.root);
+ cpswapl(from->u.keyButtonPointer.event, to->u.keyButtonPointer.event);
+ cpswapl(from->u.keyButtonPointer.child, to->u.keyButtonPointer.child);
+ cpswaps(from->u.keyButtonPointer.rootX, to->u.keyButtonPointer.rootX);
+ cpswaps(from->u.keyButtonPointer.rootY, to->u.keyButtonPointer.rootY);
+ cpswaps(from->u.keyButtonPointer.eventX, to->u.keyButtonPointer.eventX);
+ cpswaps(from->u.keyButtonPointer.eventY, to->u.keyButtonPointer.eventY);
+ cpswaps(from->u.keyButtonPointer.state, to->u.keyButtonPointer.state);
+ to->u.keyButtonPointer.sameScreen = from->u.keyButtonPointer.sameScreen;
}
void
@@ -756,22 +739,15 @@ SGraphicsExposureEvent(xEvent *from, xEvent *to)
{
to->u.u.type = from->u.u.type;
cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
- cpswapl(from->u.graphicsExposure.drawable,
- to->u.graphicsExposure.drawable);
- cpswaps(from->u.graphicsExposure.x,
- to->u.graphicsExposure.x);
- cpswaps(from->u.graphicsExposure.y,
- to->u.graphicsExposure.y);
- cpswaps(from->u.graphicsExposure.width,
- to->u.graphicsExposure.width);
- cpswaps(from->u.graphicsExposure.height,
- to->u.graphicsExposure.height);
+ cpswapl(from->u.graphicsExposure.drawable, to->u.graphicsExposure.drawable);
+ cpswaps(from->u.graphicsExposure.x, to->u.graphicsExposure.x);
+ cpswaps(from->u.graphicsExposure.y, to->u.graphicsExposure.y);
+ cpswaps(from->u.graphicsExposure.width, to->u.graphicsExposure.width);
+ cpswaps(from->u.graphicsExposure.height, to->u.graphicsExposure.height);
cpswaps(from->u.graphicsExposure.minorEvent,
- to->u.graphicsExposure.minorEvent);
- cpswaps(from->u.graphicsExposure.count,
- to->u.graphicsExposure.count);
- to->u.graphicsExposure.majorEvent =
- from->u.graphicsExposure.majorEvent;
+ to->u.graphicsExposure.minorEvent);
+ cpswaps(from->u.graphicsExposure.count, to->u.graphicsExposure.count);
+ to->u.graphicsExposure.majorEvent = from->u.graphicsExposure.majorEvent;
}
void
@@ -804,8 +780,7 @@ SCreateNotifyEvent(xEvent *from, xEvent *to)
cpswaps(from->u.createNotify.y, to->u.createNotify.y);
cpswaps(from->u.createNotify.width, to->u.createNotify.width);
cpswaps(from->u.createNotify.height, to->u.createNotify.height);
- cpswaps(from->u.createNotify.borderWidth,
- to->u.createNotify.borderWidth);
+ cpswaps(from->u.createNotify.borderWidth, to->u.createNotify.borderWidth);
to->u.createNotify.override = from->u.createNotify.override;
}
@@ -865,19 +840,16 @@ SConfigureNotifyEvent(xEvent *from, xEvent *to)
{
to->u.u.type = from->u.u.type;
cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
- cpswapl(from->u.configureNotify.event,
- to->u.configureNotify.event);
- cpswapl(from->u.configureNotify.window,
- to->u.configureNotify.window);
+ cpswapl(from->u.configureNotify.event, to->u.configureNotify.event);
+ cpswapl(from->u.configureNotify.window, to->u.configureNotify.window);
cpswapl(from->u.configureNotify.aboveSibling,
- to->u.configureNotify.aboveSibling);
+ to->u.configureNotify.aboveSibling);
cpswaps(from->u.configureNotify.x, to->u.configureNotify.x);
cpswaps(from->u.configureNotify.y, to->u.configureNotify.y);
cpswaps(from->u.configureNotify.width, to->u.configureNotify.width);
- cpswaps(from->u.configureNotify.height,
- to->u.configureNotify.height);
+ cpswaps(from->u.configureNotify.height, to->u.configureNotify.height);
cpswaps(from->u.configureNotify.borderWidth,
- to->u.configureNotify.borderWidth);
+ to->u.configureNotify.borderWidth);
to->u.configureNotify.override = from->u.configureNotify.override;
}
@@ -887,25 +859,19 @@ SConfigureRequestEvent(xEvent *from, xEvent *to)
to->u.u.type = from->u.u.type;
to->u.u.detail = from->u.u.detail; /* actually stack-mode */
cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
- cpswapl(from->u.configureRequest.parent,
- to->u.configureRequest.parent);
- cpswapl(from->u.configureRequest.window,
- to->u.configureRequest.window);
- cpswapl(from->u.configureRequest.sibling,
- to->u.configureRequest.sibling);
+ cpswapl(from->u.configureRequest.parent, to->u.configureRequest.parent);
+ cpswapl(from->u.configureRequest.window, to->u.configureRequest.window);
+ cpswapl(from->u.configureRequest.sibling, to->u.configureRequest.sibling);
cpswaps(from->u.configureRequest.x, to->u.configureRequest.x);
cpswaps(from->u.configureRequest.y, to->u.configureRequest.y);
- cpswaps(from->u.configureRequest.width,
- to->u.configureRequest.width);
- cpswaps(from->u.configureRequest.height,
- to->u.configureRequest.height);
+ cpswaps(from->u.configureRequest.width, to->u.configureRequest.width);
+ cpswaps(from->u.configureRequest.height, to->u.configureRequest.height);
cpswaps(from->u.configureRequest.borderWidth,
- to->u.configureRequest.borderWidth);
+ to->u.configureRequest.borderWidth);
cpswaps(from->u.configureRequest.valueMask,
- to->u.configureRequest.valueMask);
+ to->u.configureRequest.valueMask);
}
-
void
SGravityEvent(xEvent *from, xEvent *to)
{
@@ -966,16 +932,13 @@ SSelectionRequestEvent(xEvent *from, xEvent *to)
to->u.u.type = from->u.u.type;
cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
cpswapl(from->u.selectionRequest.time, to->u.selectionRequest.time);
- cpswapl(from->u.selectionRequest.owner,
- to->u.selectionRequest.owner);
+ cpswapl(from->u.selectionRequest.owner, to->u.selectionRequest.owner);
cpswapl(from->u.selectionRequest.requestor,
- to->u.selectionRequest.requestor);
+ to->u.selectionRequest.requestor);
cpswapl(from->u.selectionRequest.selection,
- to->u.selectionRequest.selection);
- cpswapl(from->u.selectionRequest.target,
- to->u.selectionRequest.target);
- cpswapl(from->u.selectionRequest.property,
- to->u.selectionRequest.property);
+ to->u.selectionRequest.selection);
+ cpswapl(from->u.selectionRequest.target, to->u.selectionRequest.target);
+ cpswapl(from->u.selectionRequest.property, to->u.selectionRequest.property);
}
void
@@ -984,14 +947,10 @@ SSelectionNotifyEvent(xEvent *from, xEvent *to)
to->u.u.type = from->u.u.type;
cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
cpswapl(from->u.selectionNotify.time, to->u.selectionNotify.time);
- cpswapl(from->u.selectionNotify.requestor,
- to->u.selectionNotify.requestor);
- cpswapl(from->u.selectionNotify.selection,
- to->u.selectionNotify.selection);
- cpswapl(from->u.selectionNotify.target,
- to->u.selectionNotify.target);
- cpswapl(from->u.selectionNotify.property,
- to->u.selectionNotify.property);
+ cpswapl(from->u.selectionNotify.requestor, to->u.selectionNotify.requestor);
+ cpswapl(from->u.selectionNotify.selection, to->u.selectionNotify.selection);
+ cpswapl(from->u.selectionNotify.target, to->u.selectionNotify.target);
+ cpswapl(from->u.selectionNotify.property, to->u.selectionNotify.property);
}
void
@@ -1011,8 +970,7 @@ SMappingEvent(xEvent *from, xEvent *to)
to->u.u.type = from->u.u.type;
cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
to->u.mappingNotify.request = from->u.mappingNotify.request;
- to->u.mappingNotify.firstKeyCode =
- from->u.mappingNotify.firstKeyCode;
+ to->u.mappingNotify.firstKeyCode = from->u.mappingNotify.firstKeyCode;
to->u.mappingNotify.count = from->u.mappingNotify.count;
}
@@ -1023,48 +981,47 @@ SClientMessageEvent(xEvent *from, xEvent *to)
to->u.u.detail = from->u.u.detail; /* actually format */
cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
cpswapl(from->u.clientMessage.window, to->u.clientMessage.window);
- cpswapl(from->u.clientMessage.u.l.type,
- to->u.clientMessage.u.l.type);
+ cpswapl(from->u.clientMessage.u.l.type, to->u.clientMessage.u.l.type);
switch (from->u.u.detail) {
- case 8:
- memmove(to->u.clientMessage.u.b.bytes,
- from->u.clientMessage.u.b.bytes,20);
- break;
- case 16:
- cpswaps(from->u.clientMessage.u.s.shorts0,
- to->u.clientMessage.u.s.shorts0);
- cpswaps(from->u.clientMessage.u.s.shorts1,
- to->u.clientMessage.u.s.shorts1);
- cpswaps(from->u.clientMessage.u.s.shorts2,
- to->u.clientMessage.u.s.shorts2);
- cpswaps(from->u.clientMessage.u.s.shorts3,
- to->u.clientMessage.u.s.shorts3);
- cpswaps(from->u.clientMessage.u.s.shorts4,
- to->u.clientMessage.u.s.shorts4);
- cpswaps(from->u.clientMessage.u.s.shorts5,
- to->u.clientMessage.u.s.shorts5);
- cpswaps(from->u.clientMessage.u.s.shorts6,
- to->u.clientMessage.u.s.shorts6);
- cpswaps(from->u.clientMessage.u.s.shorts7,
- to->u.clientMessage.u.s.shorts7);
- cpswaps(from->u.clientMessage.u.s.shorts8,
- to->u.clientMessage.u.s.shorts8);
- cpswaps(from->u.clientMessage.u.s.shorts9,
- to->u.clientMessage.u.s.shorts9);
- break;
- case 32:
- cpswapl(from->u.clientMessage.u.l.longs0,
- to->u.clientMessage.u.l.longs0);
- cpswapl(from->u.clientMessage.u.l.longs1,
- to->u.clientMessage.u.l.longs1);
- cpswapl(from->u.clientMessage.u.l.longs2,
- to->u.clientMessage.u.l.longs2);
- cpswapl(from->u.clientMessage.u.l.longs3,
- to->u.clientMessage.u.l.longs3);
- cpswapl(from->u.clientMessage.u.l.longs4,
- to->u.clientMessage.u.l.longs4);
- break;
- }
+ case 8:
+ memmove(to->u.clientMessage.u.b.bytes,
+ from->u.clientMessage.u.b.bytes, 20);
+ break;
+ case 16:
+ cpswaps(from->u.clientMessage.u.s.shorts0,
+ to->u.clientMessage.u.s.shorts0);
+ cpswaps(from->u.clientMessage.u.s.shorts1,
+ to->u.clientMessage.u.s.shorts1);
+ cpswaps(from->u.clientMessage.u.s.shorts2,
+ to->u.clientMessage.u.s.shorts2);
+ cpswaps(from->u.clientMessage.u.s.shorts3,
+ to->u.clientMessage.u.s.shorts3);
+ cpswaps(from->u.clientMessage.u.s.shorts4,
+ to->u.clientMessage.u.s.shorts4);
+ cpswaps(from->u.clientMessage.u.s.shorts5,
+ to->u.clientMessage.u.s.shorts5);
+ cpswaps(from->u.clientMessage.u.s.shorts6,
+ to->u.clientMessage.u.s.shorts6);
+ cpswaps(from->u.clientMessage.u.s.shorts7,
+ to->u.clientMessage.u.s.shorts7);
+ cpswaps(from->u.clientMessage.u.s.shorts8,
+ to->u.clientMessage.u.s.shorts8);
+ cpswaps(from->u.clientMessage.u.s.shorts9,
+ to->u.clientMessage.u.s.shorts9);
+ break;
+ case 32:
+ cpswapl(from->u.clientMessage.u.l.longs0,
+ to->u.clientMessage.u.l.longs0);
+ cpswapl(from->u.clientMessage.u.l.longs1,
+ to->u.clientMessage.u.l.longs1);
+ cpswapl(from->u.clientMessage.u.l.longs2,
+ to->u.clientMessage.u.l.longs2);
+ cpswapl(from->u.clientMessage.u.l.longs3,
+ to->u.clientMessage.u.l.longs3);
+ cpswapl(from->u.clientMessage.u.l.longs4,
+ to->u.clientMessage.u.l.longs4);
+ break;
+ }
}
void
@@ -1076,7 +1033,7 @@ SKeymapNotifyEvent(xEvent *from, xEvent *to)
}
static void
-SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT)
+SwapConnSetup(xConnSetup * pConnSetup, xConnSetup * pConnSetupT)
{
cpswapl(pConnSetup->release, pConnSetupT->release);
cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase);
@@ -1095,7 +1052,7 @@ SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT)
}
static void
-SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT)
+SwapWinRoot(xWindowRoot * pRoot, xWindowRoot * pRootT)
{
cpswapl(pRoot->windowId, pRootT->windowId);
cpswapl(pRoot->defaultColormap, pRootT->defaultColormap);
@@ -1116,7 +1073,7 @@ SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT)
}
static void
-SwapVisual(xVisualType *pVis, xVisualType *pVisT)
+SwapVisual(xVisualType * pVis, xVisualType * pVisT)
{
cpswapl(pVis->visualID, pVisT->visualID);
pVisT->class = pVis->class;
@@ -1128,17 +1085,14 @@ SwapVisual(xVisualType *pVis, xVisualType *pVisT)
}
void
-SwapConnSetupInfo(
- char *pInfo,
- char *pInfoT
-)
+SwapConnSetupInfo(char *pInfo, char *pInfoT)
{
- int i, j, k;
- xConnSetup *pConnSetup = (xConnSetup *)pInfo;
- xDepth *depth;
+ int i, j, k;
+ xConnSetup *pConnSetup = (xConnSetup *) pInfo;
+ xDepth *depth;
xWindowRoot *root;
- SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT);
+ SwapConnSetup(pConnSetup, (xConnSetup *) pInfoT);
pInfo += sizeof(xConnSetup);
pInfoT += sizeof(xConnSetup);
@@ -1154,48 +1108,44 @@ SwapConnSetupInfo(
pInfo += i;
pInfoT += i;
- for(i = 0; i < pConnSetup->numRoots; i++)
- {
- root = (xWindowRoot*)pInfo;
- SwapWinRoot(root, (xWindowRoot *)pInfoT);
- pInfo += sizeof(xWindowRoot);
- pInfoT += sizeof(xWindowRoot);
-
- for(j = 0; j < root->nDepths; j++)
- {
- depth = (xDepth*)pInfo;
- ((xDepth *)pInfoT)->depth = depth->depth;
- cpswaps(depth->nVisuals, ((xDepth *)pInfoT)->nVisuals);
- pInfo += sizeof(xDepth);
- pInfoT += sizeof(xDepth);
- for(k = 0; k < depth->nVisuals; k++)
- {
- SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT);
- pInfo += sizeof(xVisualType);
- pInfoT += sizeof(xVisualType);
- }
- }
+ for (i = 0; i < pConnSetup->numRoots; i++) {
+ root = (xWindowRoot *) pInfo;
+ SwapWinRoot(root, (xWindowRoot *) pInfoT);
+ pInfo += sizeof(xWindowRoot);
+ pInfoT += sizeof(xWindowRoot);
+
+ for (j = 0; j < root->nDepths; j++) {
+ depth = (xDepth *) pInfo;
+ ((xDepth *) pInfoT)->depth = depth->depth;
+ cpswaps(depth->nVisuals, ((xDepth *) pInfoT)->nVisuals);
+ pInfo += sizeof(xDepth);
+ pInfoT += sizeof(xDepth);
+ for (k = 0; k < depth->nVisuals; k++) {
+ SwapVisual((xVisualType *) pInfo, (xVisualType *) pInfoT);
+ pInfo += sizeof(xVisualType);
+ pInfoT += sizeof(xVisualType);
+ }
+ }
}
}
void
WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
{
- char *pInfoTBase;
+ char *pInfoTBase;
pInfoTBase = malloc(size);
- if (!pInfoTBase)
- {
- pClient->noClientException = -1;
- return;
+ if (!pInfoTBase) {
+ pClient->noClientException = -1;
+ return;
}
SwapConnSetupInfo(pInfo, pInfoTBase);
- (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase);
+ (void) WriteToClient(pClient, (int) size, (char *) pInfoTBase);
free(pInfoTBase);
}
void
-SwapConnSetupPrefix(xConnSetupPrefix *pcspFrom, xConnSetupPrefix *pcspTo)
+SwapConnSetupPrefix(xConnSetupPrefix * pcspFrom, xConnSetupPrefix * pcspTo)
{
pcspTo->success = pcspFrom->success;
pcspTo->lengthReason = pcspFrom->lengthReason;
@@ -1205,12 +1155,12 @@ SwapConnSetupPrefix(xConnSetupPrefix *pcspFrom, xConnSetupPrefix *pcspTo)
}
void
-WriteSConnSetupPrefix(ClientPtr pClient, xConnSetupPrefix *pcsp)
+WriteSConnSetupPrefix(ClientPtr pClient, xConnSetupPrefix * pcsp)
{
- xConnSetupPrefix cspT;
+ xConnSetupPrefix cspT;
SwapConnSetupPrefix(pcsp, &cspT);
- (void)WriteToClient(pClient, sizeof(cspT), (char *) &cspT);
+ (void) WriteToClient(pClient, sizeof(cspT), (char *) &cspT);
}
/*
@@ -1218,12 +1168,7 @@ WriteSConnSetupPrefix(ClientPtr pClient, xConnSetupPrefix *pcsp)
*/
void
-ReplyNotSwappd(
- ClientPtr pClient ,
- int size ,
- void * pbuf
- )
+ReplyNotSwappd(ClientPtr pClient, int size, void *pbuf)
{
FatalError("Not implemented");
}
-
diff --git a/xorg-server/dix/swapreq.c b/xorg-server/dix/swapreq.c
index d07cd10d3..a896b4b29 100644
--- a/xorg-server/dix/swapreq.c
+++ b/xorg-server/dix/swapreq.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -45,7 +44,6 @@ SOFTWARE.
********************************************************/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -55,65 +53,65 @@ SOFTWARE.
#include <X11/Xprotostr.h>
#include "misc.h"
#include "dixstruct.h"
-#include "extnsionst.h" /* for SendEvent */
+#include "extnsionst.h" /* for SendEvent */
#include "swapreq.h"
/* Thanks to Jack Palevich for testing and subsequently rewriting all this */
/* Byte swap a list of longs */
void
-SwapLongs (CARD32 *list, unsigned long count)
-{
- while (count >= 8) {
- swapl(list + 0);
- swapl(list + 1);
- swapl(list + 2);
- swapl(list + 3);
- swapl(list + 4);
- swapl(list + 5);
- swapl(list + 6);
- swapl(list + 7);
- list += 8;
- count -= 8;
- }
- if (count != 0) {
- do {
- swapl(list);
- list++;
- } while (--count != 0);
- }
+SwapLongs(CARD32 *list, unsigned long count)
+{
+ while (count >= 8) {
+ swapl(list + 0);
+ swapl(list + 1);
+ swapl(list + 2);
+ swapl(list + 3);
+ swapl(list + 4);
+ swapl(list + 5);
+ swapl(list + 6);
+ swapl(list + 7);
+ list += 8;
+ count -= 8;
+ }
+ if (count != 0) {
+ do {
+ swapl(list);
+ list++;
+ } while (--count != 0);
+ }
}
/* Byte swap a list of shorts */
void
-SwapShorts (short *list, unsigned long count)
-{
- while (count >= 16) {
- swaps(list + 0);
- swaps(list + 1);
- swaps(list + 2);
- swaps(list + 3);
- swaps(list + 4);
- swaps(list + 5);
- swaps(list + 6);
- swaps(list + 7);
- swaps(list + 8);
- swaps(list + 9);
- swaps(list + 10);
- swaps(list + 11);
- swaps(list + 12);
- swaps(list + 13);
- swaps(list + 14);
- swaps(list + 15);
- list += 16;
- count -= 16;
- }
- if (count != 0) {
- do {
- swaps(list);
- list++;
- } while (--count != 0);
- }
+SwapShorts(short *list, unsigned long count)
+{
+ while (count >= 16) {
+ swaps(list + 0);
+ swaps(list + 1);
+ swaps(list + 2);
+ swaps(list + 3);
+ swaps(list + 4);
+ swaps(list + 5);
+ swaps(list + 6);
+ swaps(list + 7);
+ swaps(list + 8);
+ swaps(list + 9);
+ swaps(list + 10);
+ swaps(list + 11);
+ swaps(list + 12);
+ swaps(list + 13);
+ swaps(list + 14);
+ swaps(list + 15);
+ list += 16;
+ count -= 16;
+ }
+ if (count != 0) {
+ do {
+ swaps(list);
+ list++;
+ } while (--count != 0);
+ }
}
/* The following is used for all requests that have
@@ -123,7 +121,7 @@ SProcSimpleReq(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
- return(*ProcVector[stuff->reqType])(client);
+ return (*ProcVector[stuff->reqType]) (client);
}
/* The following is used for all requests that have
@@ -134,9 +132,9 @@ SProcResourceReq(ClientPtr client)
{
REQUEST(xResourceReq);
swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE(xResourceReq); /* not EXACT */
+ REQUEST_AT_LEAST_SIZE(xResourceReq); /* not EXACT */
swapl(&stuff->id);
- return(*ProcVector[stuff->reqType])(client);
+ return (*ProcVector[stuff->reqType]) (client);
}
int
@@ -156,7 +154,7 @@ SProcCreateWindow(ClientPtr client)
swapl(&stuff->visual);
swapl(&stuff->mask);
SwapRestL(stuff);
- return((* ProcVector[X_CreateWindow])(client));
+ return ((*ProcVector[X_CreateWindow]) (client));
}
int
@@ -168,7 +166,7 @@ SProcChangeWindowAttributes(ClientPtr client)
swapl(&stuff->window);
swapl(&stuff->valueMask);
SwapRestL(stuff);
- return((* ProcVector[X_ChangeWindowAttributes])(client));
+ return ((*ProcVector[X_ChangeWindowAttributes]) (client));
}
int
@@ -181,7 +179,7 @@ SProcReparentWindow(ClientPtr client)
swapl(&stuff->parent);
swaps(&stuff->x);
swaps(&stuff->y);
- return((* ProcVector[X_ReparentWindow])(client));
+ return ((*ProcVector[X_ReparentWindow]) (client));
}
int
@@ -193,11 +191,10 @@ SProcConfigureWindow(ClientPtr client)
swapl(&stuff->window);
swaps(&stuff->mask);
SwapRestL(stuff);
- return((* ProcVector[X_ConfigureWindow])(client));
+ return ((*ProcVector[X_ConfigureWindow]) (client));
}
-
int
SProcInternAtom(ClientPtr client)
{
@@ -205,7 +202,7 @@ SProcInternAtom(ClientPtr client)
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xInternAtomReq);
swaps(&stuff->nbytes);
- return((* ProcVector[X_InternAtom])(client));
+ return ((*ProcVector[X_InternAtom]) (client));
}
int
@@ -218,17 +215,17 @@ SProcChangeProperty(ClientPtr client)
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->nUnits);
- switch ( stuff->format ) {
- case 8 :
- break;
- case 16:
- SwapRestS(stuff);
- break;
- case 32:
- SwapRestL(stuff);
- break;
- }
- return((* ProcVector[X_ChangeProperty])(client));
+ switch (stuff->format) {
+ case 8:
+ break;
+ case 16:
+ SwapRestS(stuff);
+ break;
+ case 32:
+ SwapRestL(stuff);
+ break;
+ }
+ return ((*ProcVector[X_ChangeProperty]) (client));
}
int
@@ -239,8 +236,8 @@ SProcDeleteProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xDeletePropertyReq);
swapl(&stuff->window);
swapl(&stuff->property);
- return((* ProcVector[X_DeleteProperty])(client));
-
+ return ((*ProcVector[X_DeleteProperty]) (client));
+
}
int
@@ -254,7 +251,7 @@ SProcGetProperty(ClientPtr client)
swapl(&stuff->type);
swapl(&stuff->longOffset);
swapl(&stuff->longLength);
- return((* ProcVector[X_GetProperty])(client));
+ return ((*ProcVector[X_GetProperty]) (client));
}
int
@@ -266,7 +263,7 @@ SProcSetSelectionOwner(ClientPtr client)
swapl(&stuff->window);
swapl(&stuff->selection);
swapl(&stuff->time);
- return((* ProcVector[X_SetSelectionOwner])(client));
+ return ((*ProcVector[X_SetSelectionOwner]) (client));
}
int
@@ -280,7 +277,7 @@ SProcConvertSelection(ClientPtr client)
swapl(&stuff->target);
swapl(&stuff->property);
swapl(&stuff->time);
- return((* ProcVector[X_ConvertSelection])(client));
+ return ((*ProcVector[X_ConvertSelection]) (client));
}
int
@@ -288,6 +285,7 @@ SProcSendEvent(ClientPtr client)
{
xEvent eventT;
EventSwapPtr proc;
+
REQUEST(xSendEventReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSendEventReq);
@@ -296,12 +294,12 @@ SProcSendEvent(ClientPtr client)
/* Swap event */
proc = EventSwapVector[stuff->event.u.u.type & 0177];
- if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
- return BadValue;
- (*proc)(&stuff->event, &eventT);
+ if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
+ return BadValue;
+ (*proc) (&stuff->event, &eventT);
stuff->event = eventT;
- return((* ProcVector[X_SendEvent])(client));
+ return ((*ProcVector[X_SendEvent]) (client));
}
int
@@ -315,7 +313,7 @@ SProcGrabPointer(ClientPtr client)
swapl(&stuff->confineTo);
swapl(&stuff->cursor);
swapl(&stuff->time);
- return((* ProcVector[X_GrabPointer])(client));
+ return ((*ProcVector[X_GrabPointer]) (client));
}
int
@@ -329,7 +327,7 @@ SProcGrabButton(ClientPtr client)
swapl(&stuff->confineTo);
swapl(&stuff->cursor);
swaps(&stuff->modifiers);
- return((* ProcVector[X_GrabButton])(client));
+ return ((*ProcVector[X_GrabButton]) (client));
}
int
@@ -340,7 +338,7 @@ SProcUngrabButton(ClientPtr client)
REQUEST_SIZE_MATCH(xUngrabButtonReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
- return((* ProcVector[X_UngrabButton])(client));
+ return ((*ProcVector[X_UngrabButton]) (client));
}
int
@@ -352,7 +350,7 @@ SProcChangeActivePointerGrab(ClientPtr client)
swapl(&stuff->cursor);
swapl(&stuff->time);
swaps(&stuff->eventMask);
- return((* ProcVector[X_ChangeActivePointerGrab])(client));
+ return ((*ProcVector[X_ChangeActivePointerGrab]) (client));
}
int
@@ -363,7 +361,7 @@ SProcGrabKeyboard(ClientPtr client)
REQUEST_SIZE_MATCH(xGrabKeyboardReq);
swapl(&stuff->grabWindow);
swapl(&stuff->time);
- return((* ProcVector[X_GrabKeyboard])(client));
+ return ((*ProcVector[X_GrabKeyboard]) (client));
}
int
@@ -374,7 +372,7 @@ SProcGrabKey(ClientPtr client)
REQUEST_SIZE_MATCH(xGrabKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
- return((* ProcVector[X_GrabKey])(client));
+ return ((*ProcVector[X_GrabKey]) (client));
}
int
@@ -385,7 +383,7 @@ SProcUngrabKey(ClientPtr client)
REQUEST_SIZE_MATCH(xUngrabKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
- return((* ProcVector[X_UngrabKey])(client));
+ return ((*ProcVector[X_UngrabKey]) (client));
}
int
@@ -397,7 +395,7 @@ SProcGetMotionEvents(ClientPtr client)
swapl(&stuff->window);
swapl(&stuff->start);
swapl(&stuff->stop);
- return((* ProcVector[X_GetMotionEvents])(client));
+ return ((*ProcVector[X_GetMotionEvents]) (client));
}
int
@@ -410,7 +408,7 @@ SProcTranslateCoords(ClientPtr client)
swapl(&stuff->dstWid);
swaps(&stuff->srcX);
swaps(&stuff->srcY);
- return((* ProcVector[X_TranslateCoords])(client));
+ return ((*ProcVector[X_TranslateCoords]) (client));
}
int
@@ -427,7 +425,7 @@ SProcWarpPointer(ClientPtr client)
swaps(&stuff->srcHeight);
swaps(&stuff->dstX);
swaps(&stuff->dstY);
- return((* ProcVector[X_WarpPointer])(client));
+ return ((*ProcVector[X_WarpPointer]) (client));
}
int
@@ -438,7 +436,7 @@ SProcSetInputFocus(ClientPtr client)
REQUEST_SIZE_MATCH(xSetInputFocusReq);
swapl(&stuff->focus);
swapl(&stuff->time);
- return((* ProcVector[X_SetInputFocus])(client));
+ return ((*ProcVector[X_SetInputFocus]) (client));
}
int
@@ -449,7 +447,7 @@ SProcOpenFont(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xOpenFontReq);
swapl(&stuff->fid);
swaps(&stuff->nbytes);
- return((* ProcVector[X_OpenFont])(client));
+ return ((*ProcVector[X_OpenFont]) (client));
}
int
@@ -460,7 +458,7 @@ SProcListFonts(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xListFontsReq);
swaps(&stuff->maxNames);
swaps(&stuff->nbytes);
- return((* ProcVector[X_ListFonts])(client));
+ return ((*ProcVector[X_ListFonts]) (client));
}
int
@@ -471,7 +469,7 @@ SProcListFontsWithInfo(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xListFontsWithInfoReq);
swaps(&stuff->maxNames);
swaps(&stuff->nbytes);
- return((* ProcVector[X_ListFontsWithInfo])(client));
+ return ((*ProcVector[X_ListFontsWithInfo]) (client));
}
int
@@ -481,7 +479,7 @@ SProcSetFontPath(ClientPtr client)
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
swaps(&stuff->nFonts);
- return((* ProcVector[X_SetFontPath])(client));
+ return ((*ProcVector[X_SetFontPath]) (client));
}
int
@@ -495,7 +493,7 @@ SProcCreatePixmap(ClientPtr client)
swapl(&stuff->drawable);
swaps(&stuff->width);
swaps(&stuff->height);
- return((* ProcVector[X_CreatePixmap])(client));
+ return ((*ProcVector[X_CreatePixmap]) (client));
}
int
@@ -508,7 +506,7 @@ SProcCreateGC(ClientPtr client)
swapl(&stuff->drawable);
swapl(&stuff->mask);
SwapRestL(stuff);
- return((* ProcVector[X_CreateGC])(client));
+ return ((*ProcVector[X_CreateGC]) (client));
}
int
@@ -520,7 +518,7 @@ SProcChangeGC(ClientPtr client)
swapl(&stuff->gc);
swapl(&stuff->mask);
SwapRestL(stuff);
- return((* ProcVector[X_ChangeGC])(client));
+ return ((*ProcVector[X_ChangeGC]) (client));
}
int
@@ -532,7 +530,7 @@ SProcCopyGC(ClientPtr client)
swapl(&stuff->srcGC);
swapl(&stuff->dstGC);
swapl(&stuff->mask);
- return((* ProcVector[X_CopyGC])(client));
+ return ((*ProcVector[X_CopyGC]) (client));
}
int
@@ -544,7 +542,7 @@ SProcSetDashes(ClientPtr client)
swapl(&stuff->gc);
swaps(&stuff->dashOffset);
swaps(&stuff->nDashes);
- return((* ProcVector[X_SetDashes])(client));
+ return ((*ProcVector[X_SetDashes]) (client));
}
@@ -558,7 +556,7 @@ SProcSetClipRectangles(ClientPtr client)
swaps(&stuff->xOrigin);
swaps(&stuff->yOrigin);
SwapRestS(stuff);
- return((* ProcVector[X_SetClipRectangles])(client));
+ return ((*ProcVector[X_SetClipRectangles]) (client));
}
int
@@ -572,7 +570,7 @@ SProcClearToBackground(ClientPtr client)
swaps(&stuff->y);
swaps(&stuff->width);
swaps(&stuff->height);
- return((* ProcVector[X_ClearArea])(client));
+ return ((*ProcVector[X_ClearArea]) (client));
}
int
@@ -590,7 +588,7 @@ SProcCopyArea(ClientPtr client)
swaps(&stuff->dstY);
swaps(&stuff->width);
swaps(&stuff->height);
- return((* ProcVector[X_CopyArea])(client));
+ return ((*ProcVector[X_CopyArea]) (client));
}
int
@@ -609,7 +607,7 @@ SProcCopyPlane(ClientPtr client)
swaps(&stuff->width);
swaps(&stuff->height);
swapl(&stuff->bitPlane);
- return((* ProcVector[X_CopyPlane])(client));
+ return ((*ProcVector[X_CopyPlane]) (client));
}
/* The following routine is used for all Poly drawing requests
@@ -623,7 +621,7 @@ SProcPoly(ClientPtr client)
swapl(&stuff->drawable);
swapl(&stuff->gc);
SwapRestS(stuff);
- return((* ProcVector[stuff->reqType])(client));
+ return ((*ProcVector[stuff->reqType]) (client));
}
/* cannot use SProcPoly for this one, because xFillPolyReq
@@ -638,7 +636,7 @@ SProcFillPoly(ClientPtr client)
swapl(&stuff->drawable);
swapl(&stuff->gc);
SwapRestS(stuff);
- return((* ProcVector[X_FillPoly])(client));
+ return ((*ProcVector[X_FillPoly]) (client));
}
int
@@ -654,7 +652,7 @@ SProcPutImage(ClientPtr client)
swaps(&stuff->dstX);
swaps(&stuff->dstY);
/* Image should already be swapped */
- return((* ProcVector[X_PutImage])(client));
+ return ((*ProcVector[X_PutImage]) (client));
}
@@ -670,7 +668,7 @@ SProcGetImage(ClientPtr client)
swaps(&stuff->width);
swaps(&stuff->height);
swapl(&stuff->planeMask);
- return((* ProcVector[X_GetImage])(client));
+ return ((*ProcVector[X_GetImage]) (client));
}
/* ProcPolyText used for both PolyText8 and PolyText16 */
@@ -685,7 +683,7 @@ SProcPolyText(ClientPtr client)
swapl(&stuff->gc);
swaps(&stuff->x);
swaps(&stuff->y);
- return((* ProcVector[stuff->reqType])(client));
+ return ((*ProcVector[stuff->reqType]) (client));
}
/* ProcImageText used for both ImageText8 and ImageText16 */
@@ -700,7 +698,7 @@ SProcImageText(ClientPtr client)
swapl(&stuff->gc);
swaps(&stuff->x);
swaps(&stuff->y);
- return((* ProcVector[stuff->reqType])(client));
+ return ((*ProcVector[stuff->reqType]) (client));
}
int
@@ -712,10 +710,9 @@ SProcCreateColormap(ClientPtr client)
swapl(&stuff->mid);
swapl(&stuff->window);
swapl(&stuff->visual);
- return((* ProcVector[X_CreateColormap])(client));
+ return ((*ProcVector[X_CreateColormap]) (client));
}
-
int
SProcCopyColormapAndFree(ClientPtr client)
{
@@ -724,7 +721,7 @@ SProcCopyColormapAndFree(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
swapl(&stuff->mid);
swapl(&stuff->srcCmap);
- return((* ProcVector[X_CopyColormapAndFree])(client));
+ return ((*ProcVector[X_CopyColormapAndFree]) (client));
}
@@ -738,7 +735,7 @@ SProcAllocColor(ClientPtr client)
swaps(&stuff->red);
swaps(&stuff->green);
swaps(&stuff->blue);
- return((* ProcVector[X_AllocColor])(client));
+ return ((*ProcVector[X_AllocColor]) (client));
}
int
@@ -749,7 +746,7 @@ SProcAllocNamedColor(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xAllocNamedColorReq);
swapl(&stuff->cmap);
swaps(&stuff->nbytes);
- return((* ProcVector[X_AllocNamedColor])(client));
+ return ((*ProcVector[X_AllocNamedColor]) (client));
}
int
@@ -761,7 +758,7 @@ SProcAllocColorCells(ClientPtr client)
swapl(&stuff->cmap);
swaps(&stuff->colors);
swaps(&stuff->planes);
- return((* ProcVector[X_AllocColorCells])(client));
+ return ((*ProcVector[X_AllocColorCells]) (client));
}
int
@@ -775,7 +772,7 @@ SProcAllocColorPlanes(ClientPtr client)
swaps(&stuff->red);
swaps(&stuff->green);
swaps(&stuff->blue);
- return((* ProcVector[X_AllocColorPlanes])(client));
+ return ((*ProcVector[X_AllocColorPlanes]) (client));
}
int
@@ -787,12 +784,12 @@ SProcFreeColors(ClientPtr client)
swapl(&stuff->cmap);
swapl(&stuff->planeMask);
SwapRestL(stuff);
- return((* ProcVector[X_FreeColors])(client));
+ return ((*ProcVector[X_FreeColors]) (client));
}
void
-SwapColorItem(xColorItem *pItem)
+SwapColorItem(xColorItem * pItem)
{
swapl(&pItem->pixel);
swaps(&pItem->red);
@@ -804,20 +801,20 @@ int
SProcStoreColors(ClientPtr client)
{
long count;
- xColorItem *pItem;
+ xColorItem *pItem;
REQUEST(xStoreColorsReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
swapl(&stuff->cmap);
pItem = (xColorItem *) &stuff[1];
- for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
- SwapColorItem(pItem++);
- return((* ProcVector[X_StoreColors])(client));
+ for (count = LengthRestB(stuff) / sizeof(xColorItem); --count >= 0;)
+ SwapColorItem(pItem++);
+ return ((*ProcVector[X_StoreColors]) (client));
}
int
-SProcStoreNamedColor (ClientPtr client)
+SProcStoreNamedColor(ClientPtr client)
{
REQUEST(xStoreNamedColorReq);
swaps(&stuff->length);
@@ -825,33 +822,33 @@ SProcStoreNamedColor (ClientPtr client)
swapl(&stuff->cmap);
swapl(&stuff->pixel);
swaps(&stuff->nbytes);
- return((* ProcVector[X_StoreNamedColor])(client));
+ return ((*ProcVector[X_StoreNamedColor]) (client));
}
int
-SProcQueryColors (ClientPtr client)
+SProcQueryColors(ClientPtr client)
{
REQUEST(xQueryColorsReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
swapl(&stuff->cmap);
SwapRestL(stuff);
- return((* ProcVector[X_QueryColors])(client));
-}
+ return ((*ProcVector[X_QueryColors]) (client));
+}
int
-SProcLookupColor (ClientPtr client)
+SProcLookupColor(ClientPtr client)
{
REQUEST(xLookupColorReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xLookupColorReq);
swapl(&stuff->cmap);
swaps(&stuff->nbytes);
- return((* ProcVector[X_LookupColor])(client));
+ return ((*ProcVector[X_LookupColor]) (client));
}
int
-SProcCreateCursor (ClientPtr client)
+SProcCreateCursor(ClientPtr client)
{
REQUEST(xCreateCursorReq);
swaps(&stuff->length);
@@ -867,11 +864,11 @@ SProcCreateCursor (ClientPtr client)
swaps(&stuff->backBlue);
swaps(&stuff->x);
swaps(&stuff->y);
- return((* ProcVector[X_CreateCursor])(client));
+ return ((*ProcVector[X_CreateCursor]) (client));
}
int
-SProcCreateGlyphCursor (ClientPtr client)
+SProcCreateGlyphCursor(ClientPtr client)
{
REQUEST(xCreateGlyphCursorReq);
swaps(&stuff->length);
@@ -887,12 +884,11 @@ SProcCreateGlyphCursor (ClientPtr client)
swaps(&stuff->backRed);
swaps(&stuff->backGreen);
swaps(&stuff->backBlue);
- return((* ProcVector[X_CreateGlyphCursor])(client));
+ return ((*ProcVector[X_CreateGlyphCursor]) (client));
}
-
int
-SProcRecolorCursor (ClientPtr client)
+SProcRecolorCursor(ClientPtr client)
{
REQUEST(xRecolorCursorReq);
swaps(&stuff->length);
@@ -904,11 +900,11 @@ SProcRecolorCursor (ClientPtr client)
swaps(&stuff->backRed);
swaps(&stuff->backGreen);
swaps(&stuff->backBlue);
- return((* ProcVector[X_RecolorCursor])(client));
+ return ((*ProcVector[X_RecolorCursor]) (client));
}
int
-SProcQueryBestSize (ClientPtr client)
+SProcQueryBestSize(ClientPtr client)
{
REQUEST(xQueryBestSizeReq);
swaps(&stuff->length);
@@ -916,44 +912,43 @@ SProcQueryBestSize (ClientPtr client)
swapl(&stuff->drawable);
swaps(&stuff->width);
swaps(&stuff->height);
- return((* ProcVector[X_QueryBestSize])(client));
+ return ((*ProcVector[X_QueryBestSize]) (client));
}
int
-SProcQueryExtension (ClientPtr client)
+SProcQueryExtension(ClientPtr client)
{
REQUEST(xQueryExtensionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xQueryExtensionReq);
swaps(&stuff->nbytes);
- return((* ProcVector[X_QueryExtension])(client));
+ return ((*ProcVector[X_QueryExtension]) (client));
}
int
-SProcChangeKeyboardMapping (ClientPtr client)
+SProcChangeKeyboardMapping(ClientPtr client)
{
REQUEST(xChangeKeyboardMappingReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
SwapRestL(stuff);
- return((* ProcVector[X_ChangeKeyboardMapping])(client));
+ return ((*ProcVector[X_ChangeKeyboardMapping]) (client));
}
-
int
-SProcChangeKeyboardControl (ClientPtr client)
+SProcChangeKeyboardControl(ClientPtr client)
{
REQUEST(xChangeKeyboardControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
swapl(&stuff->mask);
SwapRestL(stuff);
- return((* ProcVector[X_ChangeKeyboardControl])(client));
+ return ((*ProcVector[X_ChangeKeyboardControl]) (client));
}
int
-SProcChangePointerControl (ClientPtr client)
+SProcChangePointerControl(ClientPtr client)
{
REQUEST(xChangePointerControlReq);
swaps(&stuff->length);
@@ -961,33 +956,33 @@ SProcChangePointerControl (ClientPtr client)
swaps(&stuff->accelNum);
swaps(&stuff->accelDenum);
swaps(&stuff->threshold);
- return((* ProcVector[X_ChangePointerControl])(client));
+ return ((*ProcVector[X_ChangePointerControl]) (client));
}
-
int
-SProcSetScreenSaver (ClientPtr client)
+SProcSetScreenSaver(ClientPtr client)
{
REQUEST(xSetScreenSaverReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSetScreenSaverReq);
swaps(&stuff->timeout);
swaps(&stuff->interval);
- return((* ProcVector[X_SetScreenSaver])(client));
+ return ((*ProcVector[X_SetScreenSaver]) (client));
}
int
-SProcChangeHosts (ClientPtr client)
+SProcChangeHosts(ClientPtr client)
{
REQUEST(xChangeHostsReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeHostsReq);
swaps(&stuff->hostLength);
- return((* ProcVector[X_ChangeHosts])(client));
+ return ((*ProcVector[X_ChangeHosts]) (client));
}
-int SProcRotateProperties (ClientPtr client)
+int
+SProcRotateProperties(ClientPtr client)
{
REQUEST(xRotatePropertiesReq);
swaps(&stuff->length);
@@ -996,7 +991,7 @@ int SProcRotateProperties (ClientPtr client)
swaps(&stuff->nAtoms);
swaps(&stuff->nPositions);
SwapRestL(stuff);
- return ((* ProcVector[X_RotateProperties])(client));
+ return ((*ProcVector[X_RotateProperties]) (client));
}
int
@@ -1004,11 +999,11 @@ SProcNoOperation(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
- return ((* ProcVector[X_NoOperation])(client));
+ return ((*ProcVector[X_NoOperation]) (client));
}
void
-SwapConnClientPrefix(xConnClientPrefix *pCCP)
+SwapConnClientPrefix(xConnClientPrefix * pCCP)
{
swaps(&pCCP->majorVersion);
swaps(&pCCP->minorVersion);
diff --git a/xorg-server/dix/tables.c b/xorg-server/dix/tables.c
index 45ae2a9d1..705ef0d4d 100644
--- a/xorg-server/dix/tables.c
+++ b/xorg-server/dix/tables.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -59,572 +58,397 @@ SOFTWARE.
#include "swaprep.h"
#include "swapreq.h"
-int (* InitialVector[3]) (
- ClientPtr /* client */
- ) =
-{
- 0,
- ProcInitialConnection,
- ProcEstablishConnection
-};
+int (*InitialVector[3]) (ClientPtr /* client */
+ ) = {
+0, ProcInitialConnection, ProcEstablishConnection};
-int (* ProcVector[256]) (
- ClientPtr /* client */
- ) =
-{
- ProcBadRequest,
- ProcCreateWindow,
- ProcChangeWindowAttributes,
- ProcGetWindowAttributes,
- ProcDestroyWindow,
- ProcDestroySubwindows, /* 5 */
- ProcChangeSaveSet,
- ProcReparentWindow,
- ProcMapWindow,
- ProcMapSubwindows,
- ProcUnmapWindow, /* 10 */
- ProcUnmapSubwindows,
- ProcConfigureWindow,
- ProcCirculateWindow,
- ProcGetGeometry,
- ProcQueryTree, /* 15 */
- ProcInternAtom,
- ProcGetAtomName,
- ProcChangeProperty,
- ProcDeleteProperty,
- ProcGetProperty, /* 20 */
- ProcListProperties,
- ProcSetSelectionOwner,
- ProcGetSelectionOwner,
- ProcConvertSelection,
- ProcSendEvent, /* 25 */
- ProcGrabPointer,
- ProcUngrabPointer,
- ProcGrabButton,
- ProcUngrabButton,
- ProcChangeActivePointerGrab, /* 30 */
- ProcGrabKeyboard,
- ProcUngrabKeyboard,
- ProcGrabKey,
- ProcUngrabKey,
- ProcAllowEvents, /* 35 */
- ProcGrabServer,
- ProcUngrabServer,
- ProcQueryPointer,
- ProcGetMotionEvents,
- ProcTranslateCoords, /* 40 */
- ProcWarpPointer,
- ProcSetInputFocus,
- ProcGetInputFocus,
- ProcQueryKeymap,
- ProcOpenFont, /* 45 */
- ProcCloseFont,
- ProcQueryFont,
- ProcQueryTextExtents,
- ProcListFonts,
- ProcListFontsWithInfo, /* 50 */
- ProcSetFontPath,
- ProcGetFontPath,
- ProcCreatePixmap,
- ProcFreePixmap,
- ProcCreateGC, /* 55 */
- ProcChangeGC,
- ProcCopyGC,
- ProcSetDashes,
- ProcSetClipRectangles,
- ProcFreeGC, /* 60 */
- ProcClearToBackground,
- ProcCopyArea,
- ProcCopyPlane,
- ProcPolyPoint,
- ProcPolyLine, /* 65 */
- ProcPolySegment,
- ProcPolyRectangle,
- ProcPolyArc,
- ProcFillPoly,
- ProcPolyFillRectangle, /* 70 */
- ProcPolyFillArc,
- ProcPutImage,
- ProcGetImage,
- ProcPolyText,
- ProcPolyText, /* 75 */
- ProcImageText8,
- ProcImageText16,
- ProcCreateColormap,
- ProcFreeColormap,
- ProcCopyColormapAndFree, /* 80 */
- ProcInstallColormap,
- ProcUninstallColormap,
- ProcListInstalledColormaps,
- ProcAllocColor,
- ProcAllocNamedColor, /* 85 */
- ProcAllocColorCells,
- ProcAllocColorPlanes,
- ProcFreeColors,
- ProcStoreColors,
- ProcStoreNamedColor, /* 90 */
- ProcQueryColors,
- ProcLookupColor,
- ProcCreateCursor,
- ProcCreateGlyphCursor,
- ProcFreeCursor, /* 95 */
- ProcRecolorCursor,
- ProcQueryBestSize,
- ProcQueryExtension,
- ProcListExtensions,
- ProcChangeKeyboardMapping, /* 100 */
- ProcGetKeyboardMapping,
- ProcChangeKeyboardControl,
- ProcGetKeyboardControl,
- ProcBell,
- ProcChangePointerControl, /* 105 */
- ProcGetPointerControl,
- ProcSetScreenSaver,
- ProcGetScreenSaver,
- ProcChangeHosts,
- ProcListHosts, /* 110 */
- ProcChangeAccessControl,
- ProcChangeCloseDownMode,
- ProcKillClient,
- ProcRotateProperties,
- ProcForceScreenSaver, /* 115 */
- ProcSetPointerMapping,
- ProcGetPointerMapping,
- ProcSetModifierMapping,
- ProcGetModifierMapping,
- ProcBadRequest, /* 120 */
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest, /* 125 */
- ProcBadRequest,
- ProcNoOperation,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest
-};
+int (*ProcVector[256]) (ClientPtr /* client */
+ ) = {
+ ProcBadRequest, ProcCreateWindow, ProcChangeWindowAttributes, ProcGetWindowAttributes, ProcDestroyWindow, ProcDestroySubwindows, /* 5 */
+ ProcChangeSaveSet, ProcReparentWindow, ProcMapWindow, ProcMapSubwindows, ProcUnmapWindow, /* 10 */
+ ProcUnmapSubwindows, ProcConfigureWindow, ProcCirculateWindow, ProcGetGeometry, ProcQueryTree, /* 15 */
+ ProcInternAtom, ProcGetAtomName, ProcChangeProperty, ProcDeleteProperty, ProcGetProperty, /* 20 */
+ ProcListProperties, ProcSetSelectionOwner, ProcGetSelectionOwner, ProcConvertSelection, ProcSendEvent, /* 25 */
+ ProcGrabPointer, ProcUngrabPointer, ProcGrabButton, ProcUngrabButton, ProcChangeActivePointerGrab, /* 30 */
+ ProcGrabKeyboard, ProcUngrabKeyboard, ProcGrabKey, ProcUngrabKey, ProcAllowEvents, /* 35 */
+ ProcGrabServer, ProcUngrabServer, ProcQueryPointer, ProcGetMotionEvents, ProcTranslateCoords, /* 40 */
+ ProcWarpPointer, ProcSetInputFocus, ProcGetInputFocus, ProcQueryKeymap, ProcOpenFont, /* 45 */
+ ProcCloseFont, ProcQueryFont, ProcQueryTextExtents, ProcListFonts, ProcListFontsWithInfo, /* 50 */
+ ProcSetFontPath, ProcGetFontPath, ProcCreatePixmap, ProcFreePixmap, ProcCreateGC, /* 55 */
+ ProcChangeGC, ProcCopyGC, ProcSetDashes, ProcSetClipRectangles, ProcFreeGC, /* 60 */
+ ProcClearToBackground, ProcCopyArea, ProcCopyPlane, ProcPolyPoint, ProcPolyLine, /* 65 */
+ ProcPolySegment, ProcPolyRectangle, ProcPolyArc, ProcFillPoly, ProcPolyFillRectangle, /* 70 */
+ ProcPolyFillArc, ProcPutImage, ProcGetImage, ProcPolyText, ProcPolyText, /* 75 */
+ ProcImageText8, ProcImageText16, ProcCreateColormap, ProcFreeColormap, ProcCopyColormapAndFree, /* 80 */
+ ProcInstallColormap, ProcUninstallColormap, ProcListInstalledColormaps, ProcAllocColor, ProcAllocNamedColor, /* 85 */
+ ProcAllocColorCells, ProcAllocColorPlanes, ProcFreeColors, ProcStoreColors, ProcStoreNamedColor, /* 90 */
+ ProcQueryColors, ProcLookupColor, ProcCreateCursor, ProcCreateGlyphCursor, ProcFreeCursor, /* 95 */
+ ProcRecolorCursor, ProcQueryBestSize, ProcQueryExtension, ProcListExtensions, ProcChangeKeyboardMapping, /* 100 */
+ ProcGetKeyboardMapping, ProcChangeKeyboardControl, ProcGetKeyboardControl, ProcBell, ProcChangePointerControl, /* 105 */
+ ProcGetPointerControl, ProcSetScreenSaver, ProcGetScreenSaver, ProcChangeHosts, ProcListHosts, /* 110 */
+ ProcChangeAccessControl, ProcChangeCloseDownMode, ProcKillClient, ProcRotateProperties, ProcForceScreenSaver, /* 115 */
+ ProcSetPointerMapping, ProcGetPointerMapping, ProcSetModifierMapping, ProcGetModifierMapping, ProcBadRequest, /* 120 */
+ ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest, /* 125 */
+ProcBadRequest,
+ ProcNoOperation,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest};
-int (* SwappedProcVector[256]) (
- ClientPtr /* client */
- ) =
-{
- ProcBadRequest,
- SProcCreateWindow,
- SProcChangeWindowAttributes,
- SProcResourceReq, /* GetWindowAttributes */
- SProcResourceReq, /* DestroyWindow */
- SProcResourceReq, /* 5 DestroySubwindows */
- SProcResourceReq, /* SProcChangeSaveSet, */
- SProcReparentWindow,
- SProcResourceReq, /* MapWindow */
- SProcResourceReq, /* MapSubwindows */
- SProcResourceReq, /* 10 UnmapWindow */
- SProcResourceReq, /* UnmapSubwindows */
- SProcConfigureWindow,
- SProcResourceReq, /* SProcCirculateWindow, */
- SProcResourceReq, /* GetGeometry */
- SProcResourceReq, /* 15 QueryTree */
- SProcInternAtom,
- SProcResourceReq, /* SProcGetAtomName, */
- SProcChangeProperty,
- SProcDeleteProperty,
- SProcGetProperty, /* 20 */
- SProcResourceReq, /* SProcListProperties, */
- SProcSetSelectionOwner,
- SProcResourceReq, /* SProcGetSelectionOwner, */
- SProcConvertSelection,
- SProcSendEvent, /* 25 */
- SProcGrabPointer,
- SProcResourceReq, /* SProcUngrabPointer, */
- SProcGrabButton,
- SProcUngrabButton,
- SProcChangeActivePointerGrab, /* 30 */
- SProcGrabKeyboard,
- SProcResourceReq, /* SProcUngrabKeyboard, */
- SProcGrabKey,
- SProcUngrabKey,
- SProcResourceReq, /* 35 SProcAllowEvents, */
- SProcSimpleReq, /* SProcGrabServer, */
- SProcSimpleReq, /* SProcUngrabServer, */
- SProcResourceReq, /* SProcQueryPointer, */
- SProcGetMotionEvents,
- SProcTranslateCoords, /*40 */
- SProcWarpPointer,
- SProcSetInputFocus,
- SProcSimpleReq, /* SProcGetInputFocus, */
- SProcSimpleReq, /* QueryKeymap, */
- SProcOpenFont, /* 45 */
- SProcResourceReq, /* SProcCloseFont, */
- SProcResourceReq, /* SProcQueryFont, */
- SProcResourceReq, /* SProcQueryTextExtents, */
- SProcListFonts,
- SProcListFontsWithInfo, /* 50 */
- SProcSetFontPath,
- SProcSimpleReq, /* GetFontPath, */
- SProcCreatePixmap,
- SProcResourceReq, /* SProcFreePixmap, */
- SProcCreateGC, /* 55 */
- SProcChangeGC,
- SProcCopyGC,
- SProcSetDashes,
- SProcSetClipRectangles,
- SProcResourceReq, /* 60 SProcFreeGC, */
- SProcClearToBackground,
- SProcCopyArea,
- SProcCopyPlane,
- SProcPoly, /* PolyPoint, */
- SProcPoly, /* 65 PolyLine */
- SProcPoly, /* PolySegment, */
- SProcPoly, /* PolyRectangle, */
- SProcPoly, /* PolyArc, */
- SProcFillPoly,
- SProcPoly, /* 70 PolyFillRectangle */
- SProcPoly, /* PolyFillArc, */
- SProcPutImage,
- SProcGetImage,
- SProcPolyText,
- SProcPolyText, /* 75 */
- SProcImageText,
- SProcImageText,
- SProcCreateColormap,
- SProcResourceReq, /* SProcFreeColormap, */
- SProcCopyColormapAndFree, /* 80 */
- SProcResourceReq, /* SProcInstallColormap, */
- SProcResourceReq, /* SProcUninstallColormap, */
- SProcResourceReq, /* SProcListInstalledColormaps, */
- SProcAllocColor,
- SProcAllocNamedColor, /* 85 */
- SProcAllocColorCells,
- SProcAllocColorPlanes,
- SProcFreeColors,
- SProcStoreColors,
- SProcStoreNamedColor, /* 90 */
- SProcQueryColors,
- SProcLookupColor,
- SProcCreateCursor,
- SProcCreateGlyphCursor,
- SProcResourceReq, /* 95 SProcFreeCursor, */
- SProcRecolorCursor,
- SProcQueryBestSize,
- SProcQueryExtension,
- SProcSimpleReq, /* ListExtensions, */
- SProcChangeKeyboardMapping, /* 100 */
- SProcSimpleReq, /* GetKeyboardMapping, */
- SProcChangeKeyboardControl,
- SProcSimpleReq, /* GetKeyboardControl, */
- SProcSimpleReq, /* Bell, */
- SProcChangePointerControl, /* 105 */
- SProcSimpleReq, /* GetPointerControl, */
- SProcSetScreenSaver,
- SProcSimpleReq, /* GetScreenSaver, */
- SProcChangeHosts,
- SProcSimpleReq, /* 110 ListHosts, */
- SProcSimpleReq, /* SProcChangeAccessControl, */
- SProcSimpleReq, /* SProcChangeCloseDownMode, */
- SProcResourceReq, /* SProcKillClient, */
- SProcRotateProperties,
- SProcSimpleReq, /* 115 ForceScreenSaver */
- SProcSimpleReq, /* SetPointerMapping, */
- SProcSimpleReq, /* GetPointerMapping, */
- SProcSimpleReq, /* SetModifierMapping, */
- SProcSimpleReq, /* GetModifierMapping, */
- ProcBadRequest, /* 120 */
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest, /* 125 */
- ProcBadRequest,
- SProcNoOperation,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest
-};
+int (*SwappedProcVector[256]) (ClientPtr /* client */
+ ) = {
+ ProcBadRequest, SProcCreateWindow, SProcChangeWindowAttributes, SProcResourceReq, /* GetWindowAttributes */
+ SProcResourceReq, /* DestroyWindow */
+ SProcResourceReq, /* 5 DestroySubwindows */
+ SProcResourceReq, /* SProcChangeSaveSet, */
+ SProcReparentWindow, SProcResourceReq, /* MapWindow */
+ SProcResourceReq, /* MapSubwindows */
+ SProcResourceReq, /* 10 UnmapWindow */
+ SProcResourceReq, /* UnmapSubwindows */
+ SProcConfigureWindow, SProcResourceReq, /* SProcCirculateWindow, */
+ SProcResourceReq, /* GetGeometry */
+ SProcResourceReq, /* 15 QueryTree */
+ SProcInternAtom, SProcResourceReq, /* SProcGetAtomName, */
+ SProcChangeProperty, SProcDeleteProperty, SProcGetProperty, /* 20 */
+ SProcResourceReq, /* SProcListProperties, */
+ SProcSetSelectionOwner, SProcResourceReq, /* SProcGetSelectionOwner, */
+ SProcConvertSelection, SProcSendEvent, /* 25 */
+ SProcGrabPointer, SProcResourceReq, /* SProcUngrabPointer, */
+ SProcGrabButton, SProcUngrabButton, SProcChangeActivePointerGrab, /* 30 */
+ SProcGrabKeyboard, SProcResourceReq, /* SProcUngrabKeyboard, */
+ SProcGrabKey, SProcUngrabKey, SProcResourceReq, /* 35 SProcAllowEvents, */
+ SProcSimpleReq, /* SProcGrabServer, */
+ SProcSimpleReq, /* SProcUngrabServer, */
+ SProcResourceReq, /* SProcQueryPointer, */
+ SProcGetMotionEvents, SProcTranslateCoords, /*40 */
+ SProcWarpPointer, SProcSetInputFocus, SProcSimpleReq, /* SProcGetInputFocus, */
+ SProcSimpleReq, /* QueryKeymap, */
+ SProcOpenFont, /* 45 */
+ SProcResourceReq, /* SProcCloseFont, */
+ SProcResourceReq, /* SProcQueryFont, */
+ SProcResourceReq, /* SProcQueryTextExtents, */
+ SProcListFonts, SProcListFontsWithInfo, /* 50 */
+ SProcSetFontPath, SProcSimpleReq, /* GetFontPath, */
+ SProcCreatePixmap, SProcResourceReq, /* SProcFreePixmap, */
+ SProcCreateGC, /* 55 */
+ SProcChangeGC, SProcCopyGC, SProcSetDashes, SProcSetClipRectangles, SProcResourceReq, /* 60 SProcFreeGC, */
+ SProcClearToBackground, SProcCopyArea, SProcCopyPlane, SProcPoly, /* PolyPoint, */
+ SProcPoly, /* 65 PolyLine */
+ SProcPoly, /* PolySegment, */
+ SProcPoly, /* PolyRectangle, */
+ SProcPoly, /* PolyArc, */
+ SProcFillPoly, SProcPoly, /* 70 PolyFillRectangle */
+ SProcPoly, /* PolyFillArc, */
+ SProcPutImage, SProcGetImage, SProcPolyText, SProcPolyText, /* 75 */
+ SProcImageText, SProcImageText, SProcCreateColormap, SProcResourceReq, /* SProcFreeColormap, */
+ SProcCopyColormapAndFree, /* 80 */
+ SProcResourceReq, /* SProcInstallColormap, */
+ SProcResourceReq, /* SProcUninstallColormap, */
+ SProcResourceReq, /* SProcListInstalledColormaps, */
+ SProcAllocColor, SProcAllocNamedColor, /* 85 */
+ SProcAllocColorCells, SProcAllocColorPlanes, SProcFreeColors, SProcStoreColors, SProcStoreNamedColor, /* 90 */
+ SProcQueryColors, SProcLookupColor, SProcCreateCursor, SProcCreateGlyphCursor, SProcResourceReq, /* 95 SProcFreeCursor, */
+ SProcRecolorCursor, SProcQueryBestSize, SProcQueryExtension, SProcSimpleReq, /* ListExtensions, */
+ SProcChangeKeyboardMapping, /* 100 */
+ SProcSimpleReq, /* GetKeyboardMapping, */
+ SProcChangeKeyboardControl, SProcSimpleReq, /* GetKeyboardControl, */
+ SProcSimpleReq, /* Bell, */
+ SProcChangePointerControl, /* 105 */
+ SProcSimpleReq, /* GetPointerControl, */
+ SProcSetScreenSaver, SProcSimpleReq, /* GetScreenSaver, */
+ SProcChangeHosts, SProcSimpleReq, /* 110 ListHosts, */
+ SProcSimpleReq, /* SProcChangeAccessControl, */
+ SProcSimpleReq, /* SProcChangeCloseDownMode, */
+ SProcResourceReq, /* SProcKillClient, */
+ SProcRotateProperties, SProcSimpleReq, /* 115 ForceScreenSaver */
+ SProcSimpleReq, /* SetPointerMapping, */
+ SProcSimpleReq, /* GetPointerMapping, */
+ SProcSimpleReq, /* SetModifierMapping, */
+ SProcSimpleReq, /* GetModifierMapping, */
+ ProcBadRequest, /* 120 */
+ ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest, /* 125 */
+ProcBadRequest,
+ SProcNoOperation,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest,
+ ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest};
-EventSwapPtr EventSwapVector[MAXEVENTS] =
-{
- (EventSwapPtr)SErrorEvent,
+EventSwapPtr EventSwapVector[MAXEVENTS] = {
+ (EventSwapPtr) SErrorEvent,
NotImplemented,
SKeyButtonPtrEvent,
SKeyButtonPtrEvent,
SKeyButtonPtrEvent,
- SKeyButtonPtrEvent, /* 5 */
+ SKeyButtonPtrEvent, /* 5 */
SKeyButtonPtrEvent,
SEnterLeaveEvent,
SEnterLeaveEvent,
SFocusEvent,
- SFocusEvent, /* 10 */
+ SFocusEvent, /* 10 */
SKeymapNotifyEvent,
SExposeEvent,
SGraphicsExposureEvent,
SNoExposureEvent,
- SVisibilityEvent, /* 15 */
+ SVisibilityEvent, /* 15 */
SCreateNotifyEvent,
SDestroyNotifyEvent,
SUnmapNotifyEvent,
SMapNotifyEvent,
- SMapRequestEvent, /* 20 */
+ SMapRequestEvent, /* 20 */
SReparentEvent,
SConfigureNotifyEvent,
SConfigureRequestEvent,
SGravityEvent,
- SResizeRequestEvent, /* 25 */
+ SResizeRequestEvent, /* 25 */
SCirculateEvent,
SCirculateEvent,
SPropertyEvent,
SSelectionClearEvent,
- SSelectionRequestEvent, /* 30 */
+ SSelectionRequestEvent, /* 30 */
SSelectionNotifyEvent,
SColormapEvent,
SClientMessageEvent,
@@ -724,137 +548,135 @@ EventSwapPtr EventSwapVector[MAXEVENTS] =
NotImplemented
};
-
-ReplySwapPtr ReplySwapVector[256] =
-{
+ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
- (ReplySwapPtr)SGetWindowAttributesReply,
+ (ReplySwapPtr) SGetWindowAttributesReply,
ReplyNotSwappd,
- ReplyNotSwappd, /* 5 */
+ ReplyNotSwappd, /* 5 */
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 10 */
+ ReplyNotSwappd, /* 10 */
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
- (ReplySwapPtr)SGetGeometryReply,
- (ReplySwapPtr)SQueryTreeReply, /* 15 */
- (ReplySwapPtr)SInternAtomReply,
- (ReplySwapPtr)SGetAtomNameReply,
+ (ReplySwapPtr) SGetGeometryReply,
+ (ReplySwapPtr) SQueryTreeReply, /* 15 */
+ (ReplySwapPtr) SInternAtomReply,
+ (ReplySwapPtr) SGetAtomNameReply,
ReplyNotSwappd,
ReplyNotSwappd,
- (ReplySwapPtr)SGetPropertyReply, /* 20 */
- (ReplySwapPtr)SListPropertiesReply,
+ (ReplySwapPtr) SGetPropertyReply, /* 20 */
+ (ReplySwapPtr) SListPropertiesReply,
ReplyNotSwappd,
- (ReplySwapPtr)SGetSelectionOwnerReply,
+ (ReplySwapPtr) SGetSelectionOwnerReply,
ReplyNotSwappd,
- ReplyNotSwappd, /* 25 */
- (ReplySwapPtr)SGenericReply, /* SGrabPointerReply, */
+ ReplyNotSwappd, /* 25 */
+ (ReplySwapPtr) SGenericReply, /* SGrabPointerReply, */
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 30 */
- (ReplySwapPtr)SGenericReply, /* SGrabKeyboardReply, */
+ ReplyNotSwappd, /* 30 */
+ (ReplySwapPtr) SGenericReply, /* SGrabKeyboardReply, */
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 35 */
+ ReplyNotSwappd, /* 35 */
ReplyNotSwappd,
ReplyNotSwappd,
- (ReplySwapPtr)SQueryPointerReply,
- (ReplySwapPtr)SGetMotionEventsReply,
- (ReplySwapPtr)STranslateCoordsReply, /* 40 */
+ (ReplySwapPtr) SQueryPointerReply,
+ (ReplySwapPtr) SGetMotionEventsReply,
+ (ReplySwapPtr) STranslateCoordsReply, /* 40 */
ReplyNotSwappd,
ReplyNotSwappd,
- (ReplySwapPtr)SGetInputFocusReply,
- (ReplySwapPtr)SQueryKeymapReply,
- ReplyNotSwappd, /* 45 */
+ (ReplySwapPtr) SGetInputFocusReply,
+ (ReplySwapPtr) SQueryKeymapReply,
+ ReplyNotSwappd, /* 45 */
ReplyNotSwappd,
- (ReplySwapPtr)SQueryFontReply,
- (ReplySwapPtr)SQueryTextExtentsReply,
- (ReplySwapPtr)SListFontsReply,
- (ReplySwapPtr)SListFontsWithInfoReply, /* 50 */
+ (ReplySwapPtr) SQueryFontReply,
+ (ReplySwapPtr) SQueryTextExtentsReply,
+ (ReplySwapPtr) SListFontsReply,
+ (ReplySwapPtr) SListFontsWithInfoReply, /* 50 */
ReplyNotSwappd,
- (ReplySwapPtr)SGetFontPathReply,
+ (ReplySwapPtr) SGetFontPathReply,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 55 */
+ ReplyNotSwappd, /* 55 */
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 60 */
+ ReplyNotSwappd, /* 60 */
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 65 */
+ ReplyNotSwappd, /* 65 */
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 70 */
+ ReplyNotSwappd, /* 70 */
ReplyNotSwappd,
ReplyNotSwappd,
- (ReplySwapPtr)SGetImageReply,
+ (ReplySwapPtr) SGetImageReply,
ReplyNotSwappd,
- ReplyNotSwappd, /* 75 */
+ ReplyNotSwappd, /* 75 */
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 80 */
+ ReplyNotSwappd, /* 80 */
ReplyNotSwappd,
ReplyNotSwappd,
- (ReplySwapPtr)SListInstalledColormapsReply,
- (ReplySwapPtr)SAllocColorReply,
- (ReplySwapPtr)SAllocNamedColorReply, /* 85 */
- (ReplySwapPtr)SAllocColorCellsReply,
- (ReplySwapPtr)SAllocColorPlanesReply,
+ (ReplySwapPtr) SListInstalledColormapsReply,
+ (ReplySwapPtr) SAllocColorReply,
+ (ReplySwapPtr) SAllocNamedColorReply, /* 85 */
+ (ReplySwapPtr) SAllocColorCellsReply,
+ (ReplySwapPtr) SAllocColorPlanesReply,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 90 */
- (ReplySwapPtr)SQueryColorsReply,
- (ReplySwapPtr)SLookupColorReply,
+ ReplyNotSwappd, /* 90 */
+ (ReplySwapPtr) SQueryColorsReply,
+ (ReplySwapPtr) SLookupColorReply,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 95 */
+ ReplyNotSwappd, /* 95 */
ReplyNotSwappd,
- (ReplySwapPtr)SQueryBestSizeReply,
- (ReplySwapPtr)SGenericReply, /* SQueryExtensionReply, */
- (ReplySwapPtr)SListExtensionsReply,
- ReplyNotSwappd, /* 100 */
- (ReplySwapPtr)SGetKeyboardMappingReply,
+ (ReplySwapPtr) SQueryBestSizeReply,
+ (ReplySwapPtr) SGenericReply, /* SQueryExtensionReply, */
+ (ReplySwapPtr) SListExtensionsReply,
+ ReplyNotSwappd, /* 100 */
+ (ReplySwapPtr) SGetKeyboardMappingReply,
ReplyNotSwappd,
- (ReplySwapPtr)SGetKeyboardControlReply,
+ (ReplySwapPtr) SGetKeyboardControlReply,
ReplyNotSwappd,
- ReplyNotSwappd, /* 105 */
- (ReplySwapPtr)SGetPointerControlReply,
+ ReplyNotSwappd, /* 105 */
+ (ReplySwapPtr) SGetPointerControlReply,
ReplyNotSwappd,
- (ReplySwapPtr)SGetScreenSaverReply,
+ (ReplySwapPtr) SGetScreenSaverReply,
ReplyNotSwappd,
- (ReplySwapPtr)SListHostsReply, /* 110 */
+ (ReplySwapPtr) SListHostsReply, /* 110 */
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
- ReplyNotSwappd, /* 115 */
- (ReplySwapPtr)SGenericReply, /* SetPointerMapping */
- (ReplySwapPtr)SGetPointerMappingReply,
- (ReplySwapPtr)SGenericReply, /* SetModifierMapping */
- (ReplySwapPtr)SGetModifierMappingReply, /* 119 */
- ReplyNotSwappd, /* 120 */
- ReplyNotSwappd, /* 121 */
- ReplyNotSwappd, /* 122 */
- ReplyNotSwappd, /* 123 */
- ReplyNotSwappd, /* 124 */
- ReplyNotSwappd, /* 125 */
- ReplyNotSwappd, /* 126 */
- ReplyNotSwappd, /* NoOperation */
+ ReplyNotSwappd, /* 115 */
+ (ReplySwapPtr) SGenericReply, /* SetPointerMapping */
+ (ReplySwapPtr) SGetPointerMappingReply,
+ (ReplySwapPtr) SGenericReply, /* SetModifierMapping */
+ (ReplySwapPtr) SGetModifierMappingReply, /* 119 */
+ ReplyNotSwappd, /* 120 */
+ ReplyNotSwappd, /* 121 */
+ ReplyNotSwappd, /* 122 */
+ ReplyNotSwappd, /* 123 */
+ ReplyNotSwappd, /* 124 */
+ ReplyNotSwappd, /* 125 */
+ ReplyNotSwappd, /* 126 */
+ ReplyNotSwappd, /* NoOperation */
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
diff --git a/xorg-server/dix/touch.c b/xorg-server/dix/touch.c
index d04801c86..0829b6545 100644
--- a/xorg-server/dix/touch.c
+++ b/xorg-server/dix/touch.c
@@ -42,9 +42,8 @@
#define TOUCH_HISTORY_SIZE 100
-
/* If a touch queue resize is needed, the device id's bit is set. */
-static unsigned char resize_waiting[(MAXDEVICES + 7)/8];
+static unsigned char resize_waiting[(MAXDEVICES + 7) / 8];
/**
* Some documentation about touch points:
@@ -83,8 +82,7 @@ TouchResizeQueue(ClientPtr client, pointer closure)
OsBlockSignals();
/* first two ids are reserved */
- for (i = 2; i < MAXDEVICES; i++)
- {
+ for (i = 2; i < MAXDEVICES; i++) {
DeviceIntPtr dev;
DDXTouchPointInfoPtr tmp;
size_t size;
@@ -101,12 +99,12 @@ TouchResizeQueue(ClientPtr client, pointer closure)
/* Need to grow the queue means dropping events. Grow sufficiently so we
* don't need to do it often */
- size = dev->last.num_touches + dev->last.num_touches/2 + 1;
+ size = dev->last.num_touches + dev->last.num_touches / 2 + 1;
- tmp = realloc(dev->last.touches, size * sizeof(*dev->last.touches));
- if (tmp)
- {
+ tmp = realloc(dev->last.touches, size * sizeof(*dev->last.touches));
+ if (tmp) {
int i;
+
dev->last.touches = tmp;
for (i = dev->last.num_touches; i < size; i++)
TouchInitDDXTouchPoint(dev, &dev->last.touches[i]);
@@ -136,8 +134,7 @@ TouchFindByDDXID(DeviceIntPtr dev, uint32_t ddx_id, Bool create)
if (!dev->touch)
return NULL;
- for (i = 0; i < dev->last.num_touches; i++)
- {
+ for (i = 0; i < dev->last.num_touches; i++) {
ti = &dev->last.touches[i];
if (ti->active && ti->ddx_id == ddx_id)
return ti;
@@ -173,21 +170,20 @@ TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id)
if (TouchFindByDDXID(dev, ddx_id, FALSE))
return NULL;
- for (i = 0; i < dev->last.num_touches; i++)
- {
+ for (i = 0; i < dev->last.num_touches; i++) {
/* Only emulate pointer events on the first touch */
if (dev->last.touches[i].active)
emulate_pointer = FALSE;
- else if (!ti) /* ti is now first non-active touch rec */
+ else if (!ti) /* ti is now first non-active touch rec */
ti = &dev->last.touches[i];
if (!emulate_pointer && ti)
break;
}
- if (ti)
- {
+ if (ti) {
int client_id;
+
ti->active = TRUE;
ti->ddx_id = ddx_id;
client_id = next_client_id;
@@ -230,7 +226,6 @@ TouchInitDDXTouchPoint(DeviceIntPtr dev, DDXTouchPointInfoPtr ddxtouch)
ddxtouch->valuators = valuator_mask_new(dev->valuator->numAxes);
}
-
Bool
TouchInitTouchPoint(TouchClassPtr t, ValuatorClassPtr v, int index)
{
@@ -247,8 +242,7 @@ TouchInitTouchPoint(TouchClassPtr t, ValuatorClassPtr v, int index)
return FALSE;
ti->sprite.spriteTrace = calloc(32, sizeof(*ti->sprite.spriteTrace));
- if (!ti->sprite.spriteTrace)
- {
+ if (!ti->sprite.spriteTrace) {
valuator_mask_free(&ti->valuators);
return FALSE;
}
@@ -299,8 +293,7 @@ TouchFindByClientID(DeviceIntPtr dev, uint32_t client_id)
if (!t)
return NULL;
- for (i = 0; i < t->num_touches; i++)
- {
+ for (i = 0; i < t->num_touches; i++) {
ti = &t->touches[i];
if (ti->active && ti->client_id == client_id)
return ti;
@@ -309,7 +302,6 @@ TouchFindByClientID(DeviceIntPtr dev, uint32_t client_id)
return NULL;
}
-
/**
* Given a unique ID for a touchpoint, create a touchpoint record in the
* server.
@@ -337,9 +329,8 @@ TouchBeginTouch(DeviceIntPtr dev, int sourceid, uint32_t touchid,
if (TouchFindByClientID(dev, touchid))
return NULL;
-try_find_touch:
- for (i = 0; i < t->num_touches; i++)
- {
+ try_find_touch:
+ for (i = 0; i < t->num_touches; i++) {
ti = &t->touches[i];
if (!ti->active) {
ti->active = TRUE;
@@ -353,8 +344,7 @@ try_find_touch:
/* If we get here, then we've run out of touches: enlarge dev->touch and
* try again. */
tmp = realloc(t->touches, (t->num_touches + 1) * sizeof(*ti));
- if (tmp)
- {
+ if (tmp) {
t->touches = tmp;
t->num_touches++;
if (TouchInitTouchPoint(t, dev->valuator, t->num_touches - 1))
@@ -372,24 +362,22 @@ try_find_touch:
void
TouchEndTouch(DeviceIntPtr dev, TouchPointInfoPtr ti)
{
- if (ti->emulate_pointer)
- {
+ if (ti->emulate_pointer) {
GrabPtr grab;
DeviceEvent ev;
+
memset(&ev, 0, sizeof(ev));
ev.type = ET_TouchEnd;
ev.detail.button = 1;
ev.touchid = ti->client_id;
- ev.flags = TOUCH_POINTER_EMULATED|TOUCH_END;
+ ev.flags = TOUCH_POINTER_EMULATED | TOUCH_END;
UpdateDeviceState(dev, &ev);
- if ((grab = dev->deviceGrab.grab))
- {
+ if ((grab = dev->deviceGrab.grab)) {
if (dev->deviceGrab.fromPassiveGrab &&
!dev->button->buttonsDown &&
- !dev->touch->buttonsDown &&
- GrabIsPointerGrab(grab))
- (*dev->deviceGrab.DeactivateGrab)(dev);
+ !dev->touch->buttonsDown && GrabIsPointerGrab(grab))
+ (*dev->deviceGrab.DeactivateGrab) (dev);
}
}
@@ -450,32 +438,30 @@ TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev)
if (!ti->history)
return;
- switch(ev->type)
- {
- case ET_TouchBegin:
- /* don't store the same touchbegin twice */
- if (ti->history_elements > 0)
- return;
- break;
- case ET_TouchUpdate:
- break;
- case ET_TouchEnd:
- return; /* no TouchEnd events in the history */
- default:
+ switch (ev->type) {
+ case ET_TouchBegin:
+ /* don't store the same touchbegin twice */
+ if (ti->history_elements > 0)
return;
+ break;
+ case ET_TouchUpdate:
+ break;
+ case ET_TouchEnd:
+ return; /* no TouchEnd events in the history */
+ default:
+ return;
}
/* We only store real events in the history */
- if (ev->flags & (TOUCH_CLIENT_ID|TOUCH_REPLAYING))
+ if (ev->flags & (TOUCH_CLIENT_ID | TOUCH_REPLAYING))
return;
ti->history[ti->history_elements++] = *ev;
/* FIXME: proper overflow fixes */
- if (ti->history_elements > ti->history_size - 1)
- {
+ if (ti->history_elements > ti->history_size - 1) {
ti->history_elements = ti->history_size - 1;
DebugF("source device %d: history size %d overflowing for touch %u\n",
- ti->sourceid, ti->history_size, ti->client_id);
+ ti->sourceid, ti->history_size, ti->client_id);
}
}
@@ -493,7 +479,7 @@ TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
valuator_mask_set_double(mask, 0, ti->history[0].valuators.data[0]);
valuator_mask_set_double(mask, 1, ti->history[0].valuators.data[1]);
- flags = TOUCH_CLIENT_ID|TOUCH_REPLAYING;
+ flags = TOUCH_CLIENT_ID | TOUCH_REPLAYING;
if (ti->emulate_pointer)
flags |= TOUCH_POINTER_EMULATED;
/* send fake begin event to next owner */
@@ -505,11 +491,11 @@ TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
FreeEventList(tel, GetMaximumEventsNum());
/* First event was TouchBegin, already replayed that one */
- for (i = 1; i < ti->history_elements; i++)
- {
+ for (i = 1; i < ti->history_elements; i++) {
DeviceEvent *ev = &ti->history[i];
+
ev->flags |= TOUCH_REPLAYING;
- DeliverTouchEvents(dev, ti, (InternalEvent*)ev, resource);
+ DeliverTouchEvents(dev, ti, (InternalEvent *) ev, resource);
}
}
@@ -524,7 +510,8 @@ TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite)
/* All touches should have the same sprite trace, so find and reuse an
* existing touch's sprite if possible, else use the device's sprite. */
for (i = 0; i < t->num_touches; i++)
- if (t->touches[i].sprite.spriteTraceGood > 0)
+ if (!t->touches[i].pending_finish &&
+ t->touches[i].sprite.spriteTraceGood > 0)
break;
if (i < t->num_touches)
srcsprite = &t->touches[i].sprite;
@@ -533,12 +520,10 @@ TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite)
else
return FALSE;
- if (srcsprite->spriteTraceGood > sprite->spriteTraceSize)
- {
+ if (srcsprite->spriteTraceGood > sprite->spriteTraceSize) {
trace = realloc(sprite->spriteTrace,
- srcsprite->spriteTraceSize * sizeof(*trace));
- if (!trace)
- {
+ srcsprite->spriteTraceSize * sizeof(*trace));
+ if (!trace) {
sprite->spriteTraceGood = 0;
return FALSE;
}
@@ -546,7 +531,7 @@ TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite)
sprite->spriteTraceSize = srcsprite->spriteTraceGood;
}
memcpy(sprite->spriteTrace, srcsprite->spriteTrace,
- srcsprite->spriteTraceGood * sizeof(*trace));
+ srcsprite->spriteTraceGood * sizeof(*trace));
sprite->spriteTraceGood = srcsprite->spriteTraceGood;
return TRUE;
@@ -573,8 +558,7 @@ TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
else if (ev->any.type != ET_TouchBegin)
return (sprite->spriteTraceGood > 0);
- if (t->mode == XIDirectTouch)
- {
+ if (t->mode == XIDirectTouch) {
/* Focus immediately under the touchpoint in direct touch mode.
* XXX: Do we need to handle crossing screens here? */
sprite->spriteTrace[0] =
@@ -590,8 +574,7 @@ TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
/* Mark which grabs/event selections we're delivering to: max one grab per
* window plus the bottom-most event selection. */
ti->listeners = calloc(sprite->spriteTraceGood + 1, sizeof(*ti->listeners));
- if (!ti->listeners)
- {
+ if (!ti->listeners) {
sprite->spriteTraceGood = 0;
return FALSE;
}
@@ -624,22 +607,21 @@ TouchConvertToPointerEvent(const InternalEvent *event,
BUG_WARN(!event);
BUG_WARN(!motion_event);
- switch(event->any.type)
- {
- case ET_TouchUpdate:
- nevents = 1;
- break;
- case ET_TouchBegin:
- nevents = 2; /* motion + press */
- ptrtype = ET_ButtonPress;
- break;
- case ET_TouchEnd:
- nevents = 2; /* motion + release */
- ptrtype = ET_ButtonRelease;
- break;
- default:
- BUG_WARN_MSG(1,"Invalid event type %d\n", event->any.type);
- return 0;
+ switch (event->any.type) {
+ case ET_TouchUpdate:
+ nevents = 1;
+ break;
+ case ET_TouchBegin:
+ nevents = 2; /* motion + press */
+ ptrtype = ET_ButtonPress;
+ break;
+ case ET_TouchEnd:
+ nevents = 2; /* motion + release */
+ ptrtype = ET_ButtonRelease;
+ break;
+ default:
+ BUG_WARN_MSG(1, "Invalid event type %d\n", event->any.type);
+ return 0;
}
BUG_WARN_MSG(!(event->device_event.flags & TOUCH_POINTER_EMULATED),
@@ -650,8 +632,7 @@ TouchConvertToPointerEvent(const InternalEvent *event,
motion_event->device_event.detail.button = 0;
motion_event->device_event.flags = XIPointerEmulated;
- if (nevents > 1)
- {
+ if (nevents > 1) {
BUG_WARN(!button_event);
*button_event = *event;
button_event->any.type = ptrtype;
@@ -671,18 +652,22 @@ TouchGetPointerEventType(const InternalEvent *event)
{
int type = 0;
- switch(event->any.type)
- {
- case ET_TouchBegin: type = ET_ButtonPress; break;
- case ET_TouchUpdate: type = ET_Motion; break;
- case ET_TouchEnd: type = ET_ButtonRelease; break;
- default:
- break;
+ switch (event->any.type) {
+ case ET_TouchBegin:
+ type = ET_ButtonPress;
+ break;
+ case ET_TouchUpdate:
+ type = ET_Motion;
+ break;
+ case ET_TouchEnd:
+ type = ET_ButtonRelease;
+ break;
+ default:
+ break;
}
return type;
}
-
/**
* @returns TRUE if the specified grab or selection is the current owner of
* the touch sequence.
@@ -719,12 +704,12 @@ Bool
TouchRemoveListener(TouchPointInfoPtr ti, XID resource)
{
int i;
- for (i = 0; i < ti->num_listeners; i++)
- {
- if (ti->listeners[i].listener == resource)
- {
+
+ for (i = 0; i < ti->num_listeners; i++) {
+ if (ti->listeners[i].listener == resource) {
int j;
- for (j = i; j< ti->num_listeners - 1; j++)
+
+ for (j = i; j < ti->num_listeners - 1; j++)
ti->listeners[j] = ti->listeners[j + 1];
ti->num_listeners--;
ti->listeners[ti->num_listeners].listener = 0;
@@ -743,14 +728,13 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
/* FIXME: owner_events */
- if (grab->grabtype == XI2)
- {
+ if (grab->grabtype == XI2) {
if (!xi2mask_isset(grab->xi2mask, dev, XI_TouchOwnership))
TouchEventHistoryAllocate(ti);
if (!xi2mask_isset(grab->xi2mask, dev, XI_TouchBegin))
type = LISTENER_POINTER_GRAB;
- } else if (grab->grabtype == XI || grab->grabtype == CORE)
- {
+ }
+ else if (grab->grabtype == XI || grab->grabtype == CORE) {
TouchEventHistoryAllocate(ti);
type = LISTENER_POINTER_GRAB;
}
@@ -784,7 +768,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
{
InputClients *iclients = NULL;
OtherInputMasks *inputMasks = NULL;
- uint16_t evtype = 0; /* may be event type or emulated event type */
+ uint16_t evtype = 0; /* may be event type or emulated event type */
enum TouchListenerType type = LISTENER_REGULAR;
int mask;
@@ -792,11 +776,9 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
mask = EventIsDeliverable(dev, ev->any.type, win);
if (!mask && !ti->emulate_pointer)
return FALSE;
- else if (!mask)/* now try for pointer event */
- {
+ else if (!mask) { /* now try for pointer event */
mask = EventIsDeliverable(dev, TouchGetPointerEventType(ev), win);
- if (mask)
- {
+ if (mask) {
evtype = GetXI2Type(TouchGetPointerEventType(ev));
type = LISTENER_POINTER_REGULAR;
}
@@ -806,10 +788,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
inputMasks = wOtherInputMasks(win);
- if (mask & EVENT_XI2_MASK)
- {
- nt_list_for_each_entry(iclients, inputMasks->inputClients, next)
- {
+ if (mask & EVENT_XI2_MASK) {
+ nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
if (!xi2mask_isset(iclients->xi2mask, dev, evtype))
continue;
@@ -822,12 +802,11 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
}
}
- if (mask & EVENT_XI1_MASK)
- {
+ if (mask & EVENT_XI1_MASK) {
int xitype = GetXIType(TouchGetPointerEventType(ev));
Mask xi_filter = event_get_filter_from_type(dev, xitype);
- nt_list_for_each_entry(iclients, inputMasks->inputClients, next)
- {
+
+ nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
if (!(iclients->mask[dev->id] & xi_filter))
continue;
@@ -839,14 +818,12 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
}
}
- if (mask & EVENT_CORE_MASK)
- {
+ if (mask & EVENT_CORE_MASK) {
int coretype = GetCoreType(TouchGetPointerEventType(ev));
Mask core_filter = event_get_filter_from_type(dev, coretype);
/* window owner */
- if (IsMaster(dev) && (win->eventMask & core_filter))
- {
+ if (IsMaster(dev) && (win->eventMask & core_filter)) {
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, win->drawable.id, CORE,
LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
@@ -855,8 +832,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
}
/* all others */
- nt_list_for_each_entry(iclients, (InputClients*)wOtherClients(win), next)
- {
+ nt_list_for_each_entry(iclients, (InputClients *) wOtherClients(win),
+ next) {
if (!(iclients->mask[XIAllDevices] & core_filter))
continue;
@@ -880,7 +857,8 @@ TouchAddActiveGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (!ti->emulate_pointer &&
grab->grabtype == XI2 &&
- (grab->type != XI_TouchBegin && grab->type != XI_TouchEnd && grab->type != XI_TouchUpdate))
+ (grab->type != XI_TouchBegin && grab->type != XI_TouchEnd &&
+ grab->type != XI_TouchUpdate))
return;
TouchAddGrabListener(dev, ti, ev, grab);
@@ -898,16 +876,14 @@ TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev)
/* First, find all grabbing clients from the root window down
* to the deepest child window. */
- for (i = 0; i < sprite->spriteTraceGood; i++)
- {
+ for (i = 0; i < sprite->spriteTraceGood; i++) {
win = sprite->spriteTrace[i];
TouchAddPassiveGrabListener(dev, ti, win, ev);
}
/* Find the first client with an applicable event selection,
* going from deepest child window back up to the root window. */
- for (i = sprite->spriteTraceGood - 1; i >= 0; i--)
- {
+ for (i = sprite->spriteTraceGood - 1; i >= 0; i--) {
Bool delivered;
win = sprite->spriteTrace[i];
@@ -935,7 +911,7 @@ TouchRemovePointerGrab(DeviceIntPtr dev)
return;
ev = dev->deviceGrab.sync.event;
- if (!IsTouchEvent((InternalEvent*)ev))
+ if (!IsTouchEvent((InternalEvent *) ev))
return;
ti = TouchFindByClientID(dev, ev->touchid);
@@ -957,19 +933,16 @@ TouchListenerGone(XID resource)
if (!events)
FatalError("TouchListenerGone: couldn't allocate events\n");
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
if (!dev->touch)
continue;
- for (i = 0; i < dev->touch->num_touches; i++)
- {
+ for (i = 0; i < dev->touch->num_touches; i++) {
ti = &dev->touch->touches[i];
if (!ti->active)
continue;
- for (j = 0; j < ti->num_listeners; j++)
- {
+ for (j = 0; j < ti->num_listeners; j++) {
if (ti->listeners[j].listener != resource)
continue;
@@ -997,21 +970,18 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
if (!events)
return BadAlloc;
- if (!dev->touch)
- {
+ if (!dev->touch) {
*error = dev->id;
return BadDevice;
}
ti = TouchFindByClientID(dev, touchid);
- if (!ti)
- {
+ if (!ti) {
*error = touchid;
return BadValue;
}
- for (i = 0; i < ti->num_listeners; i++)
- {
+ for (i = 0; i < ti->num_listeners; i++) {
if (CLIENT_ID(ti->listeners[i].listener) == client->index &&
ti->listeners[i].window->drawable.id == grab_window)
break;
@@ -1019,8 +989,7 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
if (i == ti->num_listeners)
return BadAccess;
- if (i > 0)
- {
+ if (i > 0) {
if (mode == XIRejectTouch)
TouchRejected(dev, ti, ti->listeners[i].listener, NULL);
else
diff --git a/xorg-server/dix/window.c b/xorg-server/dix/window.c
index 823294b9a..98f5604c9 100644
--- a/xorg-server/dix/window.c
+++ b/xorg-server/dix/window.c
@@ -45,7 +45,6 @@ not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved
@@ -97,7 +96,6 @@ Equipment Corporation.
******************************************************************/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -124,7 +122,7 @@ Equipment Corporation.
#endif
#include "dixevents.h"
#include "globals.h"
-#include "mi.h" /* miPaintWindow */
+#include "mi.h" /* miPaintWindow */
#ifdef COMPOSITE
#include "compint.h"
#endif
@@ -133,7 +131,7 @@ Equipment Corporation.
#include "xace.h"
#include "exevents.h"
-#include <X11/Xatom.h> /* must come after server includes */
+#include <X11/Xatom.h> /* must come after server includes */
/******
* Window stuff for server
@@ -147,17 +145,16 @@ Equipment Corporation.
Bool bgNoneRoot = FALSE;
-static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11};
-static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88};
+static unsigned char _back_lsb[4] = { 0x88, 0x22, 0x44, 0x11 };
+static unsigned char _back_msb[4] = { 0x11, 0x44, 0x22, 0x88 };
+
+static Bool WindowParentHasDeviceCursor(WindowPtr pWin,
+ DeviceIntPtr pDev, CursorPtr pCurs);
+static Bool
-static Bool WindowParentHasDeviceCursor(WindowPtr pWin,
- DeviceIntPtr pDev,
- CursorPtr pCurs);
-static Bool
-WindowSeekDeviceCursor(WindowPtr pWin,
- DeviceIntPtr pDev,
- DevCursNodePtr* pNode,
- DevCursNodePtr* pPrev);
+WindowSeekDeviceCursor(WindowPtr pWin,
+ DeviceIntPtr pDev,
+ DevCursNodePtr * pNode, DevCursNodePtr * pPrev);
int screenIsSaved = SCREEN_SAVER_OFF;
@@ -194,6 +191,7 @@ get_window_name(WindowPtr pWin)
PropertyPtr prop;
static char buf[WINDOW_NAME_BUF_LEN];
int len;
+
#ifdef COMPOSITE
CompScreenPtr comp_screen = GetCompScreen(pWin->drawable.pScreen);
@@ -201,11 +199,9 @@ get_window_name(WindowPtr pWin)
return overlay_win_name;
#endif
- for (prop = wUserProps(pWin); prop; prop = prop->next)
- {
+ for (prop = wUserProps(pWin); prop; prop = prop->next) {
if (prop->propertyName == XA_WM_NAME && prop->type == XA_STRING &&
- prop->data)
- {
+ prop->data) {
len = min(prop->size, WINDOW_NAME_BUF_LEN - 1);
memcpy(buf, prop->data, len);
buf[len] = '\0';
@@ -217,7 +213,8 @@ get_window_name(WindowPtr pWin)
#undef WINDOW_NAME_BUF_LEN
}
-static void log_window_info(WindowPtr pWin, int depth)
+static void
+log_window_info(WindowPtr pWin, int depth)
{
int i;
const char *win_name, *visibility;
@@ -241,35 +238,32 @@ static void log_window_info(WindowPtr pWin, int depth)
if (pWin->redirectDraw)
ErrorF(" (%s compositing: pixmap %x)",
(pWin->redirectDraw == RedirectDrawAutomatic) ?
- "automatic" : "manual",
+ "automatic" : "manual",
pScreen->GetWindowPixmap(pWin)->drawable.id);
#endif
- switch (pWin->visibility)
- {
+ switch (pWin->visibility) {
case VisibilityUnobscured:
- visibility = "unobscured";
- break;
+ visibility = "unobscured";
+ break;
case VisibilityPartiallyObscured:
- visibility = "partially obscured";
- break;
+ visibility = "partially obscured";
+ break;
case VisibilityFullyObscured:
- visibility = "fully obscured";
- break;
+ visibility = "fully obscured";
+ break;
case VisibilityNotViewable:
- visibility = "unviewable";
- break;
+ visibility = "unviewable";
+ break;
}
ErrorF(", %s", visibility);
- if (REGION_NOTEMPTY(pScreen, &pWin->clipList))
- {
+ if (REGION_NOTEMPTY(pScreen, &pWin->clipList)) {
ErrorF(", clip list:");
rects = REGION_RECTS(&pWin->clipList);
for (i = 0; i < REGION_NUM_RECTS(&pWin->clipList); i++)
ErrorF(" [(%d, %d) to (%d, %d)]",
- rects[i].x1, rects[i].y1,
- rects[i].x2, rects[i].y2);
+ rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
ErrorF("; extents [(%d, %d) to (%d, %d)]",
pWin->clipList.extents.x1, pWin->clipList.extents.y1,
pWin->clipList.extents.x2, pWin->clipList.extents.y2);
@@ -285,31 +279,27 @@ PrintWindowTree(void)
ScreenPtr pScreen;
WindowPtr pWin;
- for (scrnum = 0; scrnum < screenInfo.numScreens; scrnum++)
- {
+ for (scrnum = 0; scrnum < screenInfo.numScreens; scrnum++) {
pScreen = screenInfo.screens[scrnum];
ErrorF("[dix] Dumping windows for screen %d (pixmap %x):\n", scrnum,
pScreen->GetScreenPixmap(pScreen)->drawable.id);
pWin = pScreen->root;
depth = 1;
- while (pWin)
- {
+ while (pWin) {
log_window_info(pWin, depth);
- if (pWin->firstChild)
- {
+ if (pWin->firstChild) {
pWin = pWin->firstChild;
depth++;
continue;
}
- while (pWin && !pWin->nextSib)
- {
+ while (pWin && !pWin->nextSib) {
pWin = pWin->parent;
depth--;
}
if (!pWin)
break;
pWin = pWin->nextSib;
- }
+ }
}
}
@@ -320,22 +310,20 @@ TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data)
WindowPtr pChild;
if (!(pChild = pWin))
- return WT_NOMATCH;
- while (1)
- {
- result = (* func)(pChild, data);
- if (result == WT_STOPWALKING)
- return WT_STOPWALKING;
- if ((result == WT_WALKCHILDREN) && pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- break;
- pChild = pChild->nextSib;
+ return WT_NOMATCH;
+ while (1) {
+ result = (*func) (pChild, data);
+ if (result == WT_STOPWALKING)
+ return WT_STOPWALKING;
+ if ((result == WT_WALKCHILDREN) && pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ break;
+ pChild = pChild->nextSib;
}
return WT_NOMATCH;
}
@@ -351,14 +339,15 @@ TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data)
int
WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, pointer data)
{
- return(TraverseTree(pScreen->root, func, data));
+ return (TraverseTree(pScreen->root, func, data));
}
/* hack for forcing backing store on all windows */
-int defaultBackingStore = NotUseful;
+int defaultBackingStore = NotUseful;
+
/* hack to force no backing store */
-Bool disableBackingStore = FALSE;
-Bool enableBackingStore = FALSE;
+Bool disableBackingStore = FALSE;
+Bool enableBackingStore = FALSE;
static void
SetWindowToDefaults(WindowPtr pWin)
@@ -367,16 +356,16 @@ SetWindowToDefaults(WindowPtr pWin)
pWin->firstChild = NullWindow;
pWin->lastChild = NullWindow;
- pWin->valdata = (ValidatePtr)NULL;
- pWin->optional = (WindowOptPtr)NULL;
+ pWin->valdata = (ValidatePtr) NULL;
+ pWin->optional = (WindowOptPtr) NULL;
pWin->cursorIsNone = TRUE;
pWin->backingStore = NotUseful;
pWin->DIXsaveUnder = FALSE;
pWin->backStorage = (pointer) NULL;
- pWin->mapped = FALSE; /* off */
- pWin->realized = FALSE; /* off */
+ pWin->mapped = FALSE; /* off */
+ pWin->realized = FALSE; /* off */
pWin->viewable = FALSE;
pWin->visibility = VisibilityNotViewable;
pWin->overrideRedirect = FALSE;
@@ -411,36 +400,37 @@ MakeRootTile(WindowPtr pWin)
unsigned char *from, *to;
int i, j;
- pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
- pScreen->rootDepth, 0);
+ pWin->background.pixmap = (*pScreen->CreatePixmap) (pScreen, 4, 4,
+ pScreen->rootDepth, 0);
pWin->backgroundState = BackgroundPixmap;
pGC = GetScratchGC(pScreen->rootDepth, pScreen);
if (!pWin->background.pixmap || !pGC)
- FatalError("could not create root tile");
+ FatalError("could not create root tile");
{
- ChangeGCVal attributes[2];
+ ChangeGCVal attributes[2];
- attributes[0].val = pScreen->whitePixel;
- attributes[1].val = pScreen->blackPixel;
+ attributes[0].val = pScreen->whitePixel;
+ attributes[1].val = pScreen->blackPixel;
- (void)ChangeGC(NullClient, pGC, GCForeground | GCBackground, attributes);
+ (void) ChangeGC(NullClient, pGC, GCForeground | GCBackground,
+ attributes);
}
- ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
+ ValidateGC((DrawablePtr) pWin->background.pixmap, pGC);
- from = (screenInfo.bitmapBitOrder == LSBFirst) ? _back_lsb : _back_msb;
- to = back;
+ from = (screenInfo.bitmapBitOrder == LSBFirst) ? _back_lsb : _back_msb;
+ to = back;
- for (i = 4; i > 0; i--, from++)
- for (j = len; j > 0; j--)
- *to++ = *from;
+ for (i = 4; i > 0; i--, from++)
+ for (j = len; j > 0; j--)
+ *to++ = *from;
- (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1,
- 0, 0, len, 4, 0, XYBitmap, (char *)back);
+ (*pGC->ops->PutImage) ((DrawablePtr) pWin->background.pixmap, pGC, 1,
+ 0, 0, len, 4, 0, XYBitmap, (char *) back);
- FreeScratchGC(pGC);
+ FreeScratchGC(pGC);
}
@@ -452,13 +442,13 @@ MakeRootTile(WindowPtr pWin)
Bool
CreateRootWindow(ScreenPtr pScreen)
{
- WindowPtr pWin;
- BoxRec box;
+ WindowPtr pWin;
+ BoxRec box;
PixmapFormatRec *format;
pWin = dixAllocateObjectWithPrivates(WindowRec, PRIVATE_WINDOW);
if (!pWin)
- return FALSE;
+ return FALSE;
pScreen->screensaver.pWindow = NULL;
pScreen->screensaver.wid = FakeClientID(0);
@@ -472,9 +462,7 @@ CreateRootWindow(ScreenPtr pScreen)
pWin->drawable.depth = pScreen->rootDepth;
for (format = screenInfo.formats;
- format->depth != pScreen->rootDepth;
- format++)
- ;
+ format->depth != pScreen->rootDepth; format++);
pWin->drawable.bitsPerPixel = format->bitsPerPixel;
pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
@@ -482,7 +470,7 @@ CreateRootWindow(ScreenPtr pScreen)
pWin->parent = NullWindow;
SetWindowToDefaults(pWin);
- pWin->optional = malloc(sizeof (WindowOptRec));
+ pWin->optional = malloc(sizeof(WindowOptRec));
if (!pWin->optional)
return FALSE;
@@ -532,16 +520,16 @@ CreateRootWindow(ScreenPtr pScreen)
/* security creation/labeling check
*/
if (XaceHook(XACE_RESOURCE_ACCESS, serverClient, pWin->drawable.id,
- RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess))
- return FALSE;
+ RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess))
+ return FALSE;
- if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin))
- return FALSE;
+ if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer) pWin))
+ return FALSE;
if (disableBackingStore)
- pScreen->backingStoreSupport = NotUseful;
+ pScreen->backingStoreSupport = NotUseful;
if (enableBackingStore)
- pScreen->backingStoreSupport = Always;
+ pScreen->backingStoreSupport = Always;
pScreen->saveUnderSupport = NotUseful;
@@ -554,35 +542,36 @@ InitRootWindow(WindowPtr pWin)
ScreenPtr pScreen = pWin->drawable.pScreen;
int backFlag = CWBorderPixel | CWCursor | CWBackingStore;
- if (!(*pScreen->CreateWindow)(pWin))
- return; /* XXX */
- (*pScreen->PositionWindow)(pWin, 0, 0);
+ if (!(*pScreen->CreateWindow) (pWin))
+ return; /* XXX */
+ (*pScreen->PositionWindow) (pWin, 0, 0);
pWin->cursorIsNone = FALSE;
pWin->optional->cursor = rootCursor;
rootCursor->refcnt++;
-
if (party_like_its_1989) {
MakeRootTile(pWin);
backFlag |= CWBackPixmap;
- } else if (pScreen->canDoBGNoneRoot && bgNoneRoot) {
+ }
+ else if (pScreen->canDoBGNoneRoot && bgNoneRoot) {
pWin->backgroundState = XaceBackgroundNoneState(pWin);
pWin->background.pixel = pScreen->whitePixel;
backFlag |= CWBackPixmap;
- } else {
+ }
+ else {
pWin->backgroundState = BackgroundPixel;
- if (whiteRoot)
+ if (whiteRoot)
pWin->background.pixel = pScreen->whitePixel;
else
pWin->background.pixel = pScreen->blackPixel;
backFlag |= CWBackPixel;
- }
+ }
pWin->backingStore = defaultBackingStore;
pWin->forcedBS = (defaultBackingStore != NotUseful);
/* We SHOULD check for an error value here XXX */
- (*pScreen->ChangeWindowAttributes)(pWin, backFlag);
+ (*pScreen->ChangeWindowAttributes) (pWin, backFlag);
MapWindow(pWin, serverClient);
}
@@ -593,27 +582,25 @@ InitRootWindow(WindowPtr pWin)
*/
static void
-ClippedRegionFromBox(WindowPtr pWin, RegionPtr Rgn,
- int x, int y,
- int w, int h)
+ClippedRegionFromBox(WindowPtr pWin, RegionPtr Rgn, int x, int y, int w, int h)
{
BoxRec box = *RegionExtents(&pWin->winSize);
/* we do these calculations to avoid overflows */
if (x > box.x1)
- box.x1 = x;
+ box.x1 = x;
if (y > box.y1)
- box.y1 = y;
+ box.y1 = y;
x += w;
if (x < box.x2)
- box.x2 = x;
+ box.x2 = x;
y += h;
if (y < box.y2)
- box.y2 = y;
+ box.y2 = y;
if (box.x1 > box.x2)
- box.x2 = box.x1;
+ box.x2 = box.x1;
if (box.y1 > box.y2)
- box.y2 = box.y1;
+ box.y2 = box.y1;
RegionReset(Rgn, &box);
RegionIntersect(Rgn, Rgn, &pWin->winSize);
}
@@ -621,25 +608,24 @@ ClippedRegionFromBox(WindowPtr pWin, RegionPtr Rgn,
static RealChildHeadProc realChildHeadProc = NULL;
void
-RegisterRealChildHeadProc (RealChildHeadProc proc)
+RegisterRealChildHeadProc(RealChildHeadProc proc)
{
realChildHeadProc = proc;
}
-
WindowPtr
RealChildHead(WindowPtr pWin)
{
if (realChildHeadProc) {
- return realChildHeadProc (pWin);
+ return realChildHeadProc(pWin);
}
if (!pWin->parent &&
- (screenIsSaved == SCREEN_SAVER_ON) &&
- (HasSaverWindow (pWin->drawable.pScreen)))
- return pWin->firstChild;
+ (screenIsSaved == SCREEN_SAVER_ON) &&
+ (HasSaverWindow(pWin->drawable.pScreen)))
+ return pWin->firstChild;
else
- return NullWindow;
+ return NullWindow;
}
/*****
@@ -663,97 +649,82 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
WindowOptPtr ancwopt;
if (class == CopyFromParent)
- class = pParent->drawable.class;
+ class = pParent->drawable.class;
- if ((class != InputOutput) && (class != InputOnly))
- {
- *error = BadValue;
- client->errorValue = class;
- return NullWindow;
+ if ((class != InputOutput) && (class != InputOnly)) {
+ *error = BadValue;
+ client->errorValue = class;
+ return NullWindow;
}
- if ((class != InputOnly) && (pParent->drawable.class == InputOnly))
- {
- *error = BadMatch;
- return NullWindow;
+ if ((class != InputOnly) && (pParent->drawable.class == InputOnly)) {
+ *error = BadMatch;
+ return NullWindow;
}
- if ((class == InputOnly) && ((bw != 0) || (depth != 0)))
- {
- *error = BadMatch;
- return NullWindow;
+ if ((class == InputOnly) && ((bw != 0) || (depth != 0))) {
+ *error = BadMatch;
+ return NullWindow;
}
pScreen = pParent->drawable.pScreen;
if ((class == InputOutput) && (depth == 0))
- depth = pParent->drawable.depth;
+ depth = pParent->drawable.depth;
ancwopt = pParent->optional;
if (!ancwopt)
- ancwopt = FindWindowWithOptional(pParent)->optional;
+ ancwopt = FindWindowWithOptional(pParent)->optional;
if (visual == CopyFromParent) {
- visual = ancwopt->visual;
+ visual = ancwopt->visual;
}
/* Find out if the depth and visual are acceptable for this Screen */
- if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth))
- {
- fOK = FALSE;
- for(idepth = 0; idepth < pScreen->numDepths; idepth++)
- {
- pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
- if ((depth == pDepth->depth) || (depth == 0))
- {
- for (ivisual = 0; ivisual < pDepth->numVids; ivisual++)
- {
- if (visual == pDepth->vids[ivisual])
- {
- fOK = TRUE;
- break;
- }
- }
- }
- }
- if (fOK == FALSE)
- {
- *error = BadMatch;
- return NullWindow;
- }
+ if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) {
+ fOK = FALSE;
+ for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
+ pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
+ if ((depth == pDepth->depth) || (depth == 0)) {
+ for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
+ if (visual == pDepth->vids[ivisual]) {
+ fOK = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ if (fOK == FALSE) {
+ *error = BadMatch;
+ return NullWindow;
+ }
}
if (((vmask & (CWBorderPixmap | CWBorderPixel)) == 0) &&
- (class != InputOnly) &&
- (depth != pParent->drawable.depth))
- {
- *error = BadMatch;
- return NullWindow;
+ (class != InputOnly) && (depth != pParent->drawable.depth)) {
+ *error = BadMatch;
+ return NullWindow;
}
if (((vmask & CWColormap) == 0) &&
- (class != InputOnly) &&
- ((visual != ancwopt->visual) || (ancwopt->colormap == None)))
- {
- *error = BadMatch;
- return NullWindow;
+ (class != InputOnly) &&
+ ((visual != ancwopt->visual) || (ancwopt->colormap == None))) {
+ *error = BadMatch;
+ return NullWindow;
}
pWin = dixAllocateObjectWithPrivates(WindowRec, PRIVATE_WINDOW);
- if (!pWin)
- {
- *error = BadAlloc;
- return NullWindow;
+ if (!pWin) {
+ *error = BadAlloc;
+ return NullWindow;
}
pWin->drawable = pParent->drawable;
pWin->drawable.depth = depth;
if (depth == pParent->drawable.depth)
- pWin->drawable.bitsPerPixel = pParent->drawable.bitsPerPixel;
- else
- {
- for (format = screenInfo.formats; format->depth != depth; format++)
- ;
- pWin->drawable.bitsPerPixel = format->bitsPerPixel;
+ pWin->drawable.bitsPerPixel = pParent->drawable.bitsPerPixel;
+ else {
+ for (format = screenInfo.formats; format->depth != depth; format++);
+ pWin->drawable.bitsPerPixel = format->bitsPerPixel;
}
if (class == InputOnly)
- pWin->drawable.type = (short) UNDRAWABLE_WINDOW;
+ pWin->drawable.type = (short) UNDRAWABLE_WINDOW;
pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pWin->drawable.id = wid;
@@ -762,16 +733,14 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
pWin->parent = pParent;
SetWindowToDefaults(pWin);
- if (visual != ancwopt->visual)
- {
- if (!MakeWindowOptional (pWin))
- {
- dixFreeObjectWithPrivates(pWin, PRIVATE_WINDOW);
- *error = BadAlloc;
- return NullWindow;
- }
- pWin->optional->visual = visual;
- pWin->optional->colormap = None;
+ if (visual != ancwopt->visual) {
+ if (!MakeWindowOptional(pWin)) {
+ dixFreeObjectWithPrivates(pWin, PRIVATE_WINDOW);
+ *error = BadAlloc;
+ return NullWindow;
+ }
+ pWin->optional->visual = visual;
+ pWin->optional->colormap = None;
}
pWin->borderWidth = bw;
@@ -779,10 +748,11 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
/* security creation/labeling check
*/
*error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, RT_WINDOW, pWin,
- RT_WINDOW, pWin->parent, DixCreateAccess|DixSetAttrAccess);
+ RT_WINDOW, pWin->parent,
+ DixCreateAccess | DixSetAttrAccess);
if (*error != Success) {
- dixFreeObjectWithPrivates(pWin, PRIVATE_WINDOW);
- return NullWindow;
+ dixFreeObjectWithPrivates(pWin, PRIVATE_WINDOW);
+ return NullWindow;
}
pWin->backgroundState = XaceBackgroundNoneState(pWin);
@@ -791,118 +761,112 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
pWin->borderIsPixel = pParent->borderIsPixel;
pWin->border = pParent->border;
if (pWin->borderIsPixel == FALSE)
- pWin->border.pixmap->refcnt++;
-
- pWin->origin.x = x + (int)bw;
- pWin->origin.y = y + (int)bw;
+ pWin->border.pixmap->refcnt++;
+
+ pWin->origin.x = x + (int) bw;
+ pWin->origin.y = y + (int) bw;
pWin->drawable.width = w;
pWin->drawable.height = h;
- pWin->drawable.x = pParent->drawable.x + x + (int)bw;
- pWin->drawable.y = pParent->drawable.y + y + (int)bw;
+ pWin->drawable.x = pParent->drawable.x + x + (int) bw;
+ pWin->drawable.y = pParent->drawable.y + y + (int) bw;
- /* set up clip list correctly for unobscured WindowPtr */
+ /* set up clip list correctly for unobscured WindowPtr */
RegionNull(&pWin->clipList);
RegionNull(&pWin->borderClip);
RegionNull(&pWin->winSize);
RegionNull(&pWin->borderSize);
pHead = RealChildHead(pParent);
- if (pHead)
- {
- pWin->nextSib = pHead->nextSib;
- if (pHead->nextSib)
- pHead->nextSib->prevSib = pWin;
- else
- pParent->lastChild = pWin;
- pHead->nextSib = pWin;
- pWin->prevSib = pHead;
+ if (pHead) {
+ pWin->nextSib = pHead->nextSib;
+ if (pHead->nextSib)
+ pHead->nextSib->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pHead->nextSib = pWin;
+ pWin->prevSib = pHead;
}
- else
- {
- pWin->nextSib = pParent->firstChild;
- if (pParent->firstChild)
- pParent->firstChild->prevSib = pWin;
- else
- pParent->lastChild = pWin;
- pParent->firstChild = pWin;
+ else {
+ pWin->nextSib = pParent->firstChild;
+ if (pParent->firstChild)
+ pParent->firstChild->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pParent->firstChild = pWin;
}
- SetWinSize (pWin);
- SetBorderSize (pWin);
+ SetWinSize(pWin);
+ SetBorderSize(pWin);
/* We SHOULD check for an error value here XXX */
- if (!(*pScreen->CreateWindow)(pWin))
- {
- *error = BadAlloc;
- DeleteWindow(pWin, None);
- return NullWindow;
+ if (!(*pScreen->CreateWindow) (pWin)) {
+ *error = BadAlloc;
+ DeleteWindow(pWin, None);
+ return NullWindow;
}
/* We SHOULD check for an error value here XXX */
- (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y);
+ (*pScreen->PositionWindow) (pWin, pWin->drawable.x, pWin->drawable.y);
if (!(vmask & CWEventMask))
- RecalculateDeliverableEvents(pWin);
+ RecalculateDeliverableEvents(pWin);
if (vmask)
- *error = ChangeWindowAttributes(pWin, vmask, vlist, wClient (pWin));
+ *error = ChangeWindowAttributes(pWin, vmask, vlist, wClient(pWin));
else
- *error = Success;
+ *error = Success;
- if (*error != Success)
- {
- DeleteWindow(pWin, None);
- return NullWindow;
- }
- if (!(vmask & CWBackingStore) && (defaultBackingStore != NotUseful))
- {
- XID value = defaultBackingStore;
- (void)ChangeWindowAttributes(pWin, CWBackingStore, &value, wClient (pWin));
- pWin->forcedBS = TRUE;
- }
-
- if (SubSend(pParent))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = CreateNotify;
- event.u.createNotify.window = wid;
- event.u.createNotify.parent = pParent->drawable.id;
- event.u.createNotify.x = x;
- event.u.createNotify.y = y;
- event.u.createNotify.width = w;
- event.u.createNotify.height = h;
- event.u.createNotify.borderWidth = bw;
- event.u.createNotify.override = pWin->overrideRedirect;
- DeliverEvents(pParent, &event, 1, NullWindow);
+ if (*error != Success) {
+ DeleteWindow(pWin, None);
+ return NullWindow;
+ }
+ if (!(vmask & CWBackingStore) && (defaultBackingStore != NotUseful)) {
+ XID value = defaultBackingStore;
+
+ (void) ChangeWindowAttributes(pWin, CWBackingStore, &value,
+ wClient(pWin));
+ pWin->forcedBS = TRUE;
+ }
+
+ if (SubSend(pParent)) {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = CreateNotify;
+ event.u.createNotify.window = wid;
+ event.u.createNotify.parent = pParent->drawable.id;
+ event.u.createNotify.x = x;
+ event.u.createNotify.y = y;
+ event.u.createNotify.width = w;
+ event.u.createNotify.height = h;
+ event.u.createNotify.borderWidth = bw;
+ event.u.createNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pParent, &event, 1, NullWindow);
}
return pWin;
}
static void
-DisposeWindowOptional (WindowPtr pWin)
+DisposeWindowOptional(WindowPtr pWin)
{
if (!pWin->optional)
- return;
+ return;
/*
* everything is peachy. Delete the optional record
* and clean up
*/
- if (pWin->optional->cursor)
- {
- FreeCursor (pWin->optional->cursor, (Cursor)0);
- pWin->cursorIsNone = FALSE;
+ if (pWin->optional->cursor) {
+ FreeCursor(pWin->optional->cursor, (Cursor) 0);
+ pWin->cursorIsNone = FALSE;
}
else
- pWin->cursorIsNone = TRUE;
+ pWin->cursorIsNone = TRUE;
- if (pWin->optional->deviceCursors)
- {
+ if (pWin->optional->deviceCursors) {
DevCursorList pList;
DevCursorList pPrev;
+
pList = pWin->optional->deviceCursors;
- while(pList)
- {
+ while (pList) {
if (pList->cursor)
- FreeCursor(pList->cursor, (XID)0);
+ FreeCursor(pList->cursor, (XID) 0);
pPrev = pList;
pList = pList->next;
free(pPrev);
@@ -926,21 +890,21 @@ FreeWindowResources(WindowPtr pWin)
RegionUninit(&pWin->winSize);
RegionUninit(&pWin->borderClip);
RegionUninit(&pWin->borderSize);
- if (wBoundingShape (pWin))
- RegionDestroy(wBoundingShape (pWin));
- if (wClipShape (pWin))
- RegionDestroy(wClipShape (pWin));
- if (wInputShape (pWin))
- RegionDestroy(wInputShape (pWin));
+ if (wBoundingShape(pWin))
+ RegionDestroy(wBoundingShape(pWin));
+ if (wClipShape(pWin))
+ RegionDestroy(wClipShape(pWin));
+ if (wInputShape(pWin))
+ RegionDestroy(wInputShape(pWin));
if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ (*pScreen->DestroyPixmap) (pWin->border.pixmap);
if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ (*pScreen->DestroyPixmap) (pWin->background.pixmap);
DeleteAllWindowProperties(pWin);
/* We SHOULD check for an error value here XXX */
- (*pScreen->DestroyWindow)(pWin);
- DisposeWindowOptional (pWin);
+ (*pScreen->DestroyWindow) (pWin);
+ DisposeWindowOptional(pWin);
}
static void
@@ -951,46 +915,41 @@ CrushTree(WindowPtr pWin)
xEvent event;
if (!(pChild = pWin->firstChild))
- return;
+ return;
UnrealizeWindow = pWin->drawable.pScreen->UnrealizeWindow;
- while (1)
- {
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- while (1)
- {
- pParent = pChild->parent;
- if (SubStrSend(pChild, pParent))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = DestroyNotify;
- event.u.destroyNotify.window = pChild->drawable.id;
- DeliverEvents(pChild, &event, 1, NullWindow);
- }
- FreeResource(pChild->drawable.id, RT_WINDOW);
- pSib = pChild->nextSib;
- pChild->viewable = FALSE;
- if (pChild->realized)
- {
- pChild->realized = FALSE;
- (*UnrealizeWindow)(pChild);
- }
- FreeWindowResources(pChild);
- dixFreeObjectWithPrivates(pChild, PRIVATE_WINDOW);
- if ( (pChild = pSib) )
- break;
- pChild = pParent;
- pChild->firstChild = NullWindow;
- pChild->lastChild = NullWindow;
- if (pChild == pWin)
- return;
- }
+ while (1) {
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (1) {
+ pParent = pChild->parent;
+ if (SubStrSend(pChild, pParent)) {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = DestroyNotify;
+ event.u.destroyNotify.window = pChild->drawable.id;
+ DeliverEvents(pChild, &event, 1, NullWindow);
+ }
+ FreeResource(pChild->drawable.id, RT_WINDOW);
+ pSib = pChild->nextSib;
+ pChild->viewable = FALSE;
+ if (pChild->realized) {
+ pChild->realized = FALSE;
+ (*UnrealizeWindow) (pChild);
+ }
+ FreeWindowResources(pChild);
+ dixFreeObjectWithPrivates(pChild, PRIVATE_WINDOW);
+ if ((pChild = pSib))
+ break;
+ pChild = pParent;
+ pChild->firstChild = NullWindow;
+ pChild->lastChild = NullWindow;
+ if (pChild == pWin)
+ return;
+ }
}
}
-
+
/*****
* DeleteWindow
* Deletes child of window then window itself
@@ -999,9 +958,9 @@ CrushTree(WindowPtr pWin)
int
DeleteWindow(pointer value, XID wid)
- {
+{
WindowPtr pParent;
- WindowPtr pWin = (WindowPtr)value;
+ WindowPtr pWin = (WindowPtr) value;
xEvent event;
UnmapWindow(pWin, FALSE);
@@ -1009,28 +968,26 @@ DeleteWindow(pointer value, XID wid)
CrushTree(pWin);
pParent = pWin->parent;
- if (wid && pParent && SubStrSend(pWin, pParent))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = DestroyNotify;
- event.u.destroyNotify.window = pWin->drawable.id;
- DeliverEvents(pWin, &event, 1, NullWindow);
+ if (wid && pParent && SubStrSend(pWin, pParent)) {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = DestroyNotify;
+ event.u.destroyNotify.window = pWin->drawable.id;
+ DeliverEvents(pWin, &event, 1, NullWindow);
}
FreeWindowResources(pWin);
- if (pParent)
- {
- if (pParent->firstChild == pWin)
- pParent->firstChild = pWin->nextSib;
- if (pParent->lastChild == pWin)
- pParent->lastChild = pWin->prevSib;
- if (pWin->nextSib)
- pWin->nextSib->prevSib = pWin->prevSib;
- if (pWin->prevSib)
- pWin->prevSib->nextSib = pWin->nextSib;
+ if (pParent) {
+ if (pParent->firstChild == pWin)
+ pParent->firstChild = pWin->nextSib;
+ if (pParent->lastChild == pWin)
+ pParent->lastChild = pWin->prevSib;
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
}
else
- pWin->drawable.pScreen->root = NULL;
+ pWin->drawable.pScreen->root = NULL;
dixFreeObjectWithPrivates(pWin, PRIVATE_WINDOW);
return Success;
}
@@ -1048,12 +1005,13 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client)
*/
UnmapSubwindows(pWin);
while (pWin->lastChild) {
- int rc = XaceHook(XACE_RESOURCE_ACCESS, client,
- pWin->lastChild->drawable.id, RT_WINDOW,
- pWin->lastChild, RT_NONE, NULL, DixDestroyAccess);
- if (rc != Success)
- return rc;
- FreeResource(pWin->lastChild->drawable.id, RT_NONE);
+ int rc = XaceHook(XACE_RESOURCE_ACCESS, client,
+ pWin->lastChild->drawable.id, RT_WINDOW,
+ pWin->lastChild, RT_NONE, NULL, DixDestroyAccess);
+
+ if (rc != Success)
+ return rc;
+ FreeResource(pWin->lastChild->drawable.id, RT_NONE);
}
return Success;
}
@@ -1064,18 +1022,18 @@ SetRootWindowBackground(WindowPtr pWin, ScreenPtr pScreen, Mask *index2)
/* following the protocol: "Changing the background of a root window to
* None or ParentRelative restores the default background pixmap" */
if (bgNoneRoot) {
- pWin->backgroundState = XaceBackgroundNoneState(pWin);
- pWin->background.pixel = pScreen->whitePixel;
+ pWin->backgroundState = XaceBackgroundNoneState(pWin);
+ pWin->background.pixel = pScreen->whitePixel;
}
else if (party_like_its_1989)
- MakeRootTile(pWin);
+ MakeRootTile(pWin);
else {
pWin->backgroundState = BackgroundPixel;
- if (whiteRoot)
- pWin->background.pixel = pScreen->whitePixel;
- else
- pWin->background.pixel = pScreen->blackPixel;
- *index2 = CWBackPixel;
+ if (whiteRoot)
+ pWin->background.pixel = pScreen->whitePixel;
+ else
+ pWin->background.pixel = pScreen->blackPixel;
+ *index2 = CWBackPixel;
}
}
@@ -1086,7 +1044,7 @@ SetRootWindowBackground(WindowPtr pWin, ScreenPtr pScreen, Mask *index2)
* value-list contains one value for each one bit in the mask, from least
* to most significant bit in the mask.
*****/
-
+
int
ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
{
@@ -1097,7 +1055,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
Cursor cursorID;
WindowPtr pChild;
Colormap cmap;
- ColormapPtr pCmap;
+ ColormapPtr pCmap;
xEvent xE;
int error, rc;
ScreenPtr pScreen;
@@ -1105,568 +1063,523 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
unsigned int val;
Bool checkOptional = FALSE, borderRelative = FALSE;
- if ((pWin->drawable.class == InputOnly) && (vmask & (~INPUTONLY_LEGAL_MASK)))
- return BadMatch;
+ if ((pWin->drawable.class == InputOnly) &&
+ (vmask & (~INPUTONLY_LEGAL_MASK)))
+ return BadMatch;
error = Success;
pScreen = pWin->drawable.pScreen;
pVlist = vlist;
tmask = vmask;
- while (tmask)
- {
- index2 = (Mask) lowbit (tmask);
- tmask &= ~index2;
- switch (index2)
- {
- case CWBackPixmap:
- pixID = (Pixmap )*pVlist;
- pVlist++;
- if (pWin->backgroundState == ParentRelative)
- borderRelative = TRUE;
- if (pixID == None)
- {
- if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
- if (!pWin->parent)
- SetRootWindowBackground(pWin, pScreen, &index2);
- else {
- pWin->backgroundState = XaceBackgroundNoneState(pWin);
- pWin->background.pixel = pScreen->whitePixel;
- }
- }
- else if (pixID == ParentRelative)
- {
- if (pWin->parent &&
- pWin->drawable.depth != pWin->parent->drawable.depth)
- {
- error = BadMatch;
- goto PatchUp;
- }
- if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
- if (!pWin->parent)
- SetRootWindowBackground(pWin, pScreen, &index2);
- else
- pWin->backgroundState = ParentRelative;
- borderRelative = TRUE;
- /* Note that the parent's backgroundTile's refcnt is NOT
- * incremented. */
- }
- else
- {
- rc = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
- client, DixReadAccess);
- if (rc == Success)
- {
- if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
- (pPixmap->drawable.pScreen != pScreen))
- {
- error = BadMatch;
- goto PatchUp;
- }
- if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
- pWin->backgroundState = BackgroundPixmap;
- pWin->background.pixmap = pPixmap;
- pPixmap->refcnt++;
- }
- else
- {
- error = rc;
- client->errorValue = pixID;
- goto PatchUp;
- }
- }
- break;
- case CWBackPixel:
- if (pWin->backgroundState == ParentRelative)
- borderRelative = TRUE;
- if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
- pWin->backgroundState = BackgroundPixel;
- pWin->background.pixel = (CARD32 ) *pVlist;
- /* background pixel overrides background pixmap,
- so don't let the ddx layer see both bits */
- vmaskCopy &= ~CWBackPixmap;
- pVlist++;
- break;
- case CWBorderPixmap:
- pixID = (Pixmap ) *pVlist;
- pVlist++;
- if (pixID == CopyFromParent)
- {
- if (!pWin->parent ||
- (pWin->drawable.depth != pWin->parent->drawable.depth))
- {
- error = BadMatch;
- goto PatchUp;
- }
- if (pWin->parent->borderIsPixel == TRUE) {
- if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
- pWin->border = pWin->parent->border;
- pWin->borderIsPixel = TRUE;
- index2 = CWBorderPixel;
- break;
- }
- else
- {
- pixID = pWin->parent->border.pixmap->drawable.id;
- }
- }
- rc = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
- client, DixReadAccess);
- if (rc == Success)
- {
- if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
- (pPixmap->drawable.pScreen != pScreen))
- {
- error = BadMatch;
- goto PatchUp;
- }
- if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
- pWin->borderIsPixel = FALSE;
- pWin->border.pixmap = pPixmap;
- pPixmap->refcnt++;
- }
- else
- {
- error = rc;
- client->errorValue = pixID;
- goto PatchUp;
- }
- break;
- case CWBorderPixel:
- if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
- pWin->borderIsPixel = TRUE;
- pWin->border.pixel = (CARD32) *pVlist;
- /* border pixel overrides border pixmap,
- so don't let the ddx layer see both bits */
- vmaskCopy &= ~CWBorderPixmap;
- pVlist++;
- break;
- case CWBitGravity:
- val = (CARD8 )*pVlist;
- pVlist++;
- if (val > StaticGravity)
- {
- error = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- pWin->bitGravity = val;
- break;
- case CWWinGravity:
- val = (CARD8 )*pVlist;
- pVlist++;
- if (val > StaticGravity)
- {
- error = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- pWin->winGravity = val;
- break;
- case CWBackingStore:
- val = (CARD8 )*pVlist;
- pVlist++;
- if ((val != NotUseful) && (val != WhenMapped) && (val != Always))
- {
- error = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- pWin->backingStore = val;
- pWin->forcedBS = FALSE;
- break;
- case CWBackingPlanes:
- if (pWin->optional || ((CARD32)*pVlist != (CARD32)~0L)) {
- if (!pWin->optional && !MakeWindowOptional (pWin))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- pWin->optional->backingBitPlanes = (CARD32) *pVlist;
- if ((CARD32)*pVlist == (CARD32)~0L)
- checkOptional = TRUE;
- }
- pVlist++;
- break;
- case CWBackingPixel:
- if (pWin->optional || (CARD32) *pVlist) {
- if (!pWin->optional && !MakeWindowOptional (pWin))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- pWin->optional->backingPixel = (CARD32) *pVlist;
- if (!*pVlist)
- checkOptional = TRUE;
- }
- pVlist++;
- break;
- case CWSaveUnder:
- val = (BOOL) *pVlist;
- pVlist++;
- if ((val != xTrue) && (val != xFalse))
- {
- error = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- pWin->saveUnder = val;
- break;
- case CWEventMask:
- rc = EventSelectForWindow(pWin, client, (Mask )*pVlist);
- if (rc)
- {
- error = rc;
- goto PatchUp;
- }
- pVlist++;
- break;
- case CWDontPropagate:
- rc = EventSuppressForWindow(pWin, client, (Mask )*pVlist,
- &checkOptional);
- if (rc)
- {
- error = rc;
- goto PatchUp;
- }
- pVlist++;
- break;
- case CWOverrideRedirect:
- val = (BOOL ) *pVlist;
- pVlist++;
- if ((val != xTrue) && (val != xFalse))
- {
- error = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- if (val == xTrue) {
- rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
- RT_WINDOW, pWin, RT_NONE, NULL, DixGrabAccess);
- if (rc != Success) {
- error = rc;
- client->errorValue = pWin->drawable.id;
- goto PatchUp;
- }
- }
- pWin->overrideRedirect = val;
- break;
- case CWColormap:
- cmap = (Colormap) *pVlist;
- pVlist++;
- if (cmap == CopyFromParent)
- {
- if (pWin->parent &&
- (!pWin->optional ||
- pWin->optional->visual == wVisual (pWin->parent)))
- {
- cmap = wColormap (pWin->parent);
- }
- else
- cmap = None;
- }
- if (cmap == None)
- {
- error = BadMatch;
- goto PatchUp;
- }
- rc = dixLookupResourceByType((pointer *)&pCmap, cmap, RT_COLORMAP,
- client, DixUseAccess);
- if (rc != Success)
- {
- error = rc;
- client->errorValue = cmap;
- goto PatchUp;
- }
- if (pCmap->pVisual->vid != wVisual (pWin) ||
- pCmap->pScreen != pScreen)
- {
- error = BadMatch;
- goto PatchUp;
- }
- if (cmap != wColormap (pWin))
- {
- if (!pWin->optional)
- {
- if (!MakeWindowOptional (pWin))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- }
- else if (pWin->parent && cmap == wColormap (pWin->parent))
- checkOptional = TRUE;
-
- /*
- * propagate the original colormap to any children
- * inheriting it
- */
-
- for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
- {
- if (!pChild->optional && !MakeWindowOptional (pChild))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- }
-
- pWin->optional->colormap = cmap;
-
- /*
- * check on any children now matching the new colormap
- */
-
- for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
- {
- if (pChild->optional->colormap == cmap)
- CheckWindowOptionalNeed (pChild);
- }
-
- xE.u.u.type = ColormapNotify;
- xE.u.colormap.window = pWin->drawable.id;
- xE.u.colormap.colormap = cmap;
- xE.u.colormap.new = xTrue;
- xE.u.colormap.state = IsMapInstalled(cmap, pWin);
- DeliverEvents(pWin, &xE, 1, NullWindow);
- }
- break;
- case CWCursor:
- cursorID = (Cursor ) *pVlist;
- pVlist++;
- /*
- * install the new
- */
- if ( cursorID == None)
- {
- if (pWin == pWin->drawable.pScreen->root)
- pCursor = rootCursor;
- else
- pCursor = (CursorPtr) None;
- }
- else
- {
- rc = dixLookupResourceByType((pointer *)&pCursor, cursorID,
- RT_CURSOR, client, DixUseAccess);
- if (rc != Success)
- {
- error = rc;
- client->errorValue = cursorID;
- goto PatchUp;
- }
- }
-
- if (pCursor != wCursor (pWin))
- {
- /*
- * patch up child windows so they don't lose cursors.
- */
-
- for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
- {
- if (!pChild->optional && !pChild->cursorIsNone &&
- !MakeWindowOptional (pChild))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- }
-
- pOldCursor = 0;
- if (pCursor == (CursorPtr) None)
- {
- pWin->cursorIsNone = TRUE;
- if (pWin->optional)
- {
- pOldCursor = pWin->optional->cursor;
- pWin->optional->cursor = (CursorPtr) None;
- checkOptional = TRUE;
- }
- } else {
- if (!pWin->optional)
- {
- if (!MakeWindowOptional (pWin))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- }
- else if (pWin->parent && pCursor == wCursor (pWin->parent))
- checkOptional = TRUE;
- pOldCursor = pWin->optional->cursor;
- pWin->optional->cursor = pCursor;
- pCursor->refcnt++;
- pWin->cursorIsNone = FALSE;
- /*
- * check on any children now matching the new cursor
- */
-
- for (pChild=pWin->firstChild; pChild; pChild=pChild->nextSib)
- {
- if (pChild->optional &&
- (pChild->optional->cursor == pCursor))
- CheckWindowOptionalNeed (pChild);
- }
- }
-
- if (pWin->realized)
- WindowHasNewCursor( pWin);
-
- /* Can't free cursor until here - old cursor
- * is needed in WindowHasNewCursor
- */
- if (pOldCursor)
- FreeCursor (pOldCursor, (Cursor)0);
- }
- break;
- default:
- error = BadValue;
- client->errorValue = vmask;
- goto PatchUp;
- }
- vmaskCopy |= index2;
- }
-PatchUp:
+ while (tmask) {
+ index2 = (Mask) lowbit(tmask);
+ tmask &= ~index2;
+ switch (index2) {
+ case CWBackPixmap:
+ pixID = (Pixmap) * pVlist;
+ pVlist++;
+ if (pWin->backgroundState == ParentRelative)
+ borderRelative = TRUE;
+ if (pixID == None) {
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap) (pWin->background.pixmap);
+ if (!pWin->parent)
+ SetRootWindowBackground(pWin, pScreen, &index2);
+ else {
+ pWin->backgroundState = XaceBackgroundNoneState(pWin);
+ pWin->background.pixel = pScreen->whitePixel;
+ }
+ }
+ else if (pixID == ParentRelative) {
+ if (pWin->parent &&
+ pWin->drawable.depth != pWin->parent->drawable.depth) {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap) (pWin->background.pixmap);
+ if (!pWin->parent)
+ SetRootWindowBackground(pWin, pScreen, &index2);
+ else
+ pWin->backgroundState = ParentRelative;
+ borderRelative = TRUE;
+ /* Note that the parent's backgroundTile's refcnt is NOT
+ * incremented. */
+ }
+ else {
+ rc = dixLookupResourceByType((pointer *) &pPixmap, pixID,
+ RT_PIXMAP, client, DixReadAccess);
+ if (rc == Success) {
+ if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
+ (pPixmap->drawable.pScreen != pScreen)) {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap) (pWin->background.pixmap);
+ pWin->backgroundState = BackgroundPixmap;
+ pWin->background.pixmap = pPixmap;
+ pPixmap->refcnt++;
+ }
+ else {
+ error = rc;
+ client->errorValue = pixID;
+ goto PatchUp;
+ }
+ }
+ break;
+ case CWBackPixel:
+ if (pWin->backgroundState == ParentRelative)
+ borderRelative = TRUE;
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap) (pWin->background.pixmap);
+ pWin->backgroundState = BackgroundPixel;
+ pWin->background.pixel = (CARD32) *pVlist;
+ /* background pixel overrides background pixmap,
+ so don't let the ddx layer see both bits */
+ vmaskCopy &= ~CWBackPixmap;
+ pVlist++;
+ break;
+ case CWBorderPixmap:
+ pixID = (Pixmap) * pVlist;
+ pVlist++;
+ if (pixID == CopyFromParent) {
+ if (!pWin->parent ||
+ (pWin->drawable.depth != pWin->parent->drawable.depth)) {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->parent->borderIsPixel == TRUE) {
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap) (pWin->border.pixmap);
+ pWin->border = pWin->parent->border;
+ pWin->borderIsPixel = TRUE;
+ index2 = CWBorderPixel;
+ break;
+ }
+ else {
+ pixID = pWin->parent->border.pixmap->drawable.id;
+ }
+ }
+ rc = dixLookupResourceByType((pointer *) &pPixmap, pixID, RT_PIXMAP,
+ client, DixReadAccess);
+ if (rc == Success) {
+ if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
+ (pPixmap->drawable.pScreen != pScreen)) {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap) (pWin->border.pixmap);
+ pWin->borderIsPixel = FALSE;
+ pWin->border.pixmap = pPixmap;
+ pPixmap->refcnt++;
+ }
+ else {
+ error = rc;
+ client->errorValue = pixID;
+ goto PatchUp;
+ }
+ break;
+ case CWBorderPixel:
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap) (pWin->border.pixmap);
+ pWin->borderIsPixel = TRUE;
+ pWin->border.pixel = (CARD32) *pVlist;
+ /* border pixel overrides border pixmap,
+ so don't let the ddx layer see both bits */
+ vmaskCopy &= ~CWBorderPixmap;
+ pVlist++;
+ break;
+ case CWBitGravity:
+ val = (CARD8) *pVlist;
+ pVlist++;
+ if (val > StaticGravity) {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->bitGravity = val;
+ break;
+ case CWWinGravity:
+ val = (CARD8) *pVlist;
+ pVlist++;
+ if (val > StaticGravity) {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->winGravity = val;
+ break;
+ case CWBackingStore:
+ val = (CARD8) *pVlist;
+ pVlist++;
+ if ((val != NotUseful) && (val != WhenMapped) && (val != Always)) {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->backingStore = val;
+ pWin->forcedBS = FALSE;
+ break;
+ case CWBackingPlanes:
+ if (pWin->optional || ((CARD32) *pVlist != (CARD32) ~0L)) {
+ if (!pWin->optional && !MakeWindowOptional(pWin)) {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ pWin->optional->backingBitPlanes = (CARD32) *pVlist;
+ if ((CARD32) *pVlist == (CARD32) ~0L)
+ checkOptional = TRUE;
+ }
+ pVlist++;
+ break;
+ case CWBackingPixel:
+ if (pWin->optional || (CARD32) *pVlist) {
+ if (!pWin->optional && !MakeWindowOptional(pWin)) {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ pWin->optional->backingPixel = (CARD32) *pVlist;
+ if (!*pVlist)
+ checkOptional = TRUE;
+ }
+ pVlist++;
+ break;
+ case CWSaveUnder:
+ val = (BOOL) * pVlist;
+ pVlist++;
+ if ((val != xTrue) && (val != xFalse)) {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->saveUnder = val;
+ break;
+ case CWEventMask:
+ rc = EventSelectForWindow(pWin, client, (Mask) *pVlist);
+ if (rc) {
+ error = rc;
+ goto PatchUp;
+ }
+ pVlist++;
+ break;
+ case CWDontPropagate:
+ rc = EventSuppressForWindow(pWin, client, (Mask) *pVlist,
+ &checkOptional);
+ if (rc) {
+ error = rc;
+ goto PatchUp;
+ }
+ pVlist++;
+ break;
+ case CWOverrideRedirect:
+ val = (BOOL) * pVlist;
+ pVlist++;
+ if ((val != xTrue) && (val != xFalse)) {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ if (val == xTrue) {
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
+ RT_WINDOW, pWin, RT_NONE, NULL, DixGrabAccess);
+ if (rc != Success) {
+ error = rc;
+ client->errorValue = pWin->drawable.id;
+ goto PatchUp;
+ }
+ }
+ pWin->overrideRedirect = val;
+ break;
+ case CWColormap:
+ cmap = (Colormap) * pVlist;
+ pVlist++;
+ if (cmap == CopyFromParent) {
+ if (pWin->parent &&
+ (!pWin->optional ||
+ pWin->optional->visual == wVisual(pWin->parent))) {
+ cmap = wColormap(pWin->parent);
+ }
+ else
+ cmap = None;
+ }
+ if (cmap == None) {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ rc = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP,
+ client, DixUseAccess);
+ if (rc != Success) {
+ error = rc;
+ client->errorValue = cmap;
+ goto PatchUp;
+ }
+ if (pCmap->pVisual->vid != wVisual(pWin) ||
+ pCmap->pScreen != pScreen) {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (cmap != wColormap(pWin)) {
+ if (!pWin->optional) {
+ if (!MakeWindowOptional(pWin)) {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+ else if (pWin->parent && cmap == wColormap(pWin->parent))
+ checkOptional = TRUE;
+
+ /*
+ * propagate the original colormap to any children
+ * inheriting it
+ */
+
+ for (pChild = pWin->firstChild; pChild;
+ pChild = pChild->nextSib) {
+ if (!pChild->optional && !MakeWindowOptional(pChild)) {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+
+ pWin->optional->colormap = cmap;
+
+ /*
+ * check on any children now matching the new colormap
+ */
+
+ for (pChild = pWin->firstChild; pChild;
+ pChild = pChild->nextSib) {
+ if (pChild->optional->colormap == cmap)
+ CheckWindowOptionalNeed(pChild);
+ }
+
+ xE.u.u.type = ColormapNotify;
+ xE.u.colormap.window = pWin->drawable.id;
+ xE.u.colormap.colormap = cmap;
+ xE.u.colormap.new = xTrue;
+ xE.u.colormap.state = IsMapInstalled(cmap, pWin);
+ DeliverEvents(pWin, &xE, 1, NullWindow);
+ }
+ break;
+ case CWCursor:
+ cursorID = (Cursor) * pVlist;
+ pVlist++;
+ /*
+ * install the new
+ */
+ if (cursorID == None) {
+ if (pWin == pWin->drawable.pScreen->root)
+ pCursor = rootCursor;
+ else
+ pCursor = (CursorPtr) None;
+ }
+ else {
+ rc = dixLookupResourceByType((pointer *) &pCursor, cursorID,
+ RT_CURSOR, client, DixUseAccess);
+ if (rc != Success) {
+ error = rc;
+ client->errorValue = cursorID;
+ goto PatchUp;
+ }
+ }
+
+ if (pCursor != wCursor(pWin)) {
+ /*
+ * patch up child windows so they don't lose cursors.
+ */
+
+ for (pChild = pWin->firstChild; pChild;
+ pChild = pChild->nextSib) {
+ if (!pChild->optional && !pChild->cursorIsNone &&
+ !MakeWindowOptional(pChild)) {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+
+ pOldCursor = 0;
+ if (pCursor == (CursorPtr) None) {
+ pWin->cursorIsNone = TRUE;
+ if (pWin->optional) {
+ pOldCursor = pWin->optional->cursor;
+ pWin->optional->cursor = (CursorPtr) None;
+ checkOptional = TRUE;
+ }
+ }
+ else {
+ if (!pWin->optional) {
+ if (!MakeWindowOptional(pWin)) {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+ else if (pWin->parent && pCursor == wCursor(pWin->parent))
+ checkOptional = TRUE;
+ pOldCursor = pWin->optional->cursor;
+ pWin->optional->cursor = pCursor;
+ pCursor->refcnt++;
+ pWin->cursorIsNone = FALSE;
+ /*
+ * check on any children now matching the new cursor
+ */
+
+ for (pChild = pWin->firstChild; pChild;
+ pChild = pChild->nextSib) {
+ if (pChild->optional &&
+ (pChild->optional->cursor == pCursor))
+ CheckWindowOptionalNeed(pChild);
+ }
+ }
+
+ if (pWin->realized)
+ WindowHasNewCursor(pWin);
+
+ /* Can't free cursor until here - old cursor
+ * is needed in WindowHasNewCursor
+ */
+ if (pOldCursor)
+ FreeCursor(pOldCursor, (Cursor) 0);
+ }
+ break;
+ default:
+ error = BadValue;
+ client->errorValue = vmask;
+ goto PatchUp;
+ }
+ vmaskCopy |= index2;
+ }
+ PatchUp:
if (checkOptional)
- CheckWindowOptionalNeed (pWin);
+ CheckWindowOptionalNeed(pWin);
- /* We SHOULD check for an error value here XXX */
- (*pScreen->ChangeWindowAttributes)(pWin, vmaskCopy);
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->ChangeWindowAttributes) (pWin, vmaskCopy);
/*
- If the border contents have changed, redraw the border.
- Note that this has to be done AFTER pScreen->ChangeWindowAttributes
- for the tile to be rotated, and the correct function selected.
- */
+ If the border contents have changed, redraw the border.
+ Note that this has to be done AFTER pScreen->ChangeWindowAttributes
+ for the tile to be rotated, and the correct function selected.
+ */
if (((vmaskCopy & (CWBorderPixel | CWBorderPixmap)) || borderRelative)
- && pWin->viewable && HasBorder (pWin))
- {
- RegionRec exposed;
+ && pWin->viewable && HasBorder(pWin)) {
+ RegionRec exposed;
- RegionNull(&exposed);
- RegionSubtract(&exposed, &pWin->borderClip, &pWin->winSize);
- miPaintWindow(pWin, &exposed, PW_BORDER);
- RegionUninit(&exposed);
+ RegionNull(&exposed);
+ RegionSubtract(&exposed, &pWin->borderClip, &pWin->winSize);
+ miPaintWindow(pWin, &exposed, PW_BORDER);
+ RegionUninit(&exposed);
}
return error;
}
-
/*****
* GetWindowAttributes
* Notice that this is different than ChangeWindowAttributes
*****/
void
-GetWindowAttributes(WindowPtr pWin, ClientPtr client, xGetWindowAttributesReply *wa)
+GetWindowAttributes(WindowPtr pWin, ClientPtr client,
+ xGetWindowAttributesReply * wa)
{
wa->type = X_Reply;
wa->bitGravity = pWin->bitGravity;
wa->winGravity = pWin->winGravity;
if (pWin->forcedBS && pWin->backingStore != Always)
- wa->backingStore = NotUseful;
+ wa->backingStore = NotUseful;
else
- wa->backingStore = pWin->backingStore;
+ wa->backingStore = pWin->backingStore;
wa->length = bytes_to_int32(sizeof(xGetWindowAttributesReply) -
- sizeof(xGenericReply));
+ sizeof(xGenericReply));
wa->sequenceNumber = client->sequence;
- wa->backingBitPlanes = wBackingBitPlanes (pWin);
- wa->backingPixel = wBackingPixel (pWin);
- wa->saveUnder = (BOOL)pWin->saveUnder;
+ wa->backingBitPlanes = wBackingBitPlanes(pWin);
+ wa->backingPixel = wBackingPixel(pWin);
+ wa->saveUnder = (BOOL) pWin->saveUnder;
wa->override = pWin->overrideRedirect;
if (!pWin->mapped)
- wa->mapState = IsUnmapped;
+ wa->mapState = IsUnmapped;
else if (pWin->realized)
- wa->mapState = IsViewable;
+ wa->mapState = IsViewable;
else
- wa->mapState = IsUnviewable;
+ wa->mapState = IsUnviewable;
- wa->colormap = wColormap (pWin);
+ wa->colormap = wColormap(pWin);
wa->mapInstalled = (wa->colormap == None) ? xFalse
- : IsMapInstalled(wa->colormap, pWin);
+ : IsMapInstalled(wa->colormap, pWin);
wa->yourEventMask = EventMaskForClient(pWin, client);
- wa->allEventMasks = pWin->eventMask | wOtherEventMasks (pWin);
- wa->doNotPropagateMask = wDontPropagateMask (pWin);
+ wa->allEventMasks = pWin->eventMask | wOtherEventMasks(pWin);
+ wa->doNotPropagateMask = wDontPropagateMask(pWin);
wa->class = pWin->drawable.class;
- wa->visualID = wVisual (pWin);
+ wa->visualID = wVisual(pWin);
}
-
WindowPtr
MoveWindowInStack(WindowPtr pWin, WindowPtr pNextSib)
{
WindowPtr pParent = pWin->parent;
- WindowPtr pFirstChange = pWin; /* highest window where list changes */
+ WindowPtr pFirstChange = pWin; /* highest window where list changes */
+
+ if (pWin->nextSib != pNextSib) {
+ WindowPtr pOldNextSib = pWin->nextSib;
+
+ if (!pNextSib) { /* move to bottom */
+ if (pParent->firstChild == pWin)
+ pParent->firstChild = pWin->nextSib;
+ /* if (pWin->nextSib) *//* is always True: pNextSib == NULL
+ * and pWin->nextSib != pNextSib
+ * therefore pWin->nextSib != NULL */
+ pFirstChange = pWin->nextSib;
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ pParent->lastChild->nextSib = pWin;
+ pWin->prevSib = pParent->lastChild;
+ pWin->nextSib = NullWindow;
+ pParent->lastChild = pWin;
+ }
+ else if (pParent->firstChild == pNextSib) { /* move to top */
+ pFirstChange = pWin;
+ if (pParent->lastChild == pWin)
+ pParent->lastChild = pWin->prevSib;
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ pWin->nextSib = pParent->firstChild;
+ pWin->prevSib = (WindowPtr) NULL;
+ pNextSib->prevSib = pWin;
+ pParent->firstChild = pWin;
+ }
+ else { /* move in middle of list */
- if (pWin->nextSib != pNextSib)
- {
- WindowPtr pOldNextSib = pWin->nextSib;
-
- if (!pNextSib) /* move to bottom */
- {
- if (pParent->firstChild == pWin)
- pParent->firstChild = pWin->nextSib;
- /* if (pWin->nextSib) */ /* is always True: pNextSib == NULL
- * and pWin->nextSib != pNextSib
- * therefore pWin->nextSib != NULL */
- pFirstChange = pWin->nextSib;
- pWin->nextSib->prevSib = pWin->prevSib;
- if (pWin->prevSib)
- pWin->prevSib->nextSib = pWin->nextSib;
- pParent->lastChild->nextSib = pWin;
- pWin->prevSib = pParent->lastChild;
- pWin->nextSib = NullWindow;
- pParent->lastChild = pWin;
- }
- else if (pParent->firstChild == pNextSib) /* move to top */
- {
- pFirstChange = pWin;
- if (pParent->lastChild == pWin)
- pParent->lastChild = pWin->prevSib;
- if (pWin->nextSib)
- pWin->nextSib->prevSib = pWin->prevSib;
- if (pWin->prevSib)
- pWin->prevSib->nextSib = pWin->nextSib;
- pWin->nextSib = pParent->firstChild;
- pWin->prevSib = (WindowPtr ) NULL;
- pNextSib->prevSib = pWin;
- pParent->firstChild = pWin;
- }
- else /* move in middle of list */
- {
- WindowPtr pOldNext = pWin->nextSib;
-
- pFirstChange = NullWindow;
- if (pParent->firstChild == pWin)
- pFirstChange = pParent->firstChild = pWin->nextSib;
- if (pParent->lastChild == pWin) {
- pFirstChange = pWin;
- pParent->lastChild = pWin->prevSib;
- }
- if (pWin->nextSib)
- pWin->nextSib->prevSib = pWin->prevSib;
- if (pWin->prevSib)
- pWin->prevSib->nextSib = pWin->nextSib;
- pWin->nextSib = pNextSib;
- pWin->prevSib = pNextSib->prevSib;
- if (pNextSib->prevSib)
- pNextSib->prevSib->nextSib = pWin;
- pNextSib->prevSib = pWin;
- if (!pFirstChange) { /* do we know it yet? */
- pFirstChange = pParent->firstChild; /* no, search from top */
- while ((pFirstChange != pWin) && (pFirstChange != pOldNext))
- pFirstChange = pFirstChange->nextSib;
- }
- }
- if(pWin->drawable.pScreen->RestackWindow)
- (*pWin->drawable.pScreen->RestackWindow)(pWin, pOldNextSib);
+ WindowPtr pOldNext = pWin->nextSib;
+
+ pFirstChange = NullWindow;
+ if (pParent->firstChild == pWin)
+ pFirstChange = pParent->firstChild = pWin->nextSib;
+ if (pParent->lastChild == pWin) {
+ pFirstChange = pWin;
+ pParent->lastChild = pWin->prevSib;
+ }
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ pWin->nextSib = pNextSib;
+ pWin->prevSib = pNextSib->prevSib;
+ if (pNextSib->prevSib)
+ pNextSib->prevSib->nextSib = pWin;
+ pNextSib->prevSib = pWin;
+ if (!pFirstChange) { /* do we know it yet? */
+ pFirstChange = pParent->firstChild; /* no, search from top */
+ while ((pFirstChange != pWin) && (pFirstChange != pOldNext))
+ pFirstChange = pFirstChange->nextSib;
+ }
+ }
+ if (pWin->drawable.pScreen->RestackWindow)
+ (*pWin->drawable.pScreen->RestackWindow) (pWin, pOldNextSib);
}
#ifdef ROOTLESS
@@ -1677,90 +1590,85 @@ MoveWindowInStack(WindowPtr pWin, WindowPtr pNextSib)
* the underlying window system may want to reorder it.
*/
else if (pWin->drawable.pScreen->RestackWindow)
- (*pWin->drawable.pScreen->RestackWindow)(pWin, pWin->nextSib);
+ (*pWin->drawable.pScreen->RestackWindow) (pWin, pWin->nextSib);
#endif
return pFirstChange;
}
void
-SetWinSize (WindowPtr pWin)
+SetWinSize(WindowPtr pWin)
{
#ifdef COMPOSITE
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- BoxRec box;
-
- /*
- * Redirected clients get clip list equal to their
- * own geometry, not clipped to their parent
- */
- box.x1 = pWin->drawable.x;
- box.y1 = pWin->drawable.y;
- box.x2 = pWin->drawable.x + pWin->drawable.width;
- box.y2 = pWin->drawable.y + pWin->drawable.height;
- RegionReset(&pWin->winSize, &box);
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ BoxRec box;
+
+ /*
+ * Redirected clients get clip list equal to their
+ * own geometry, not clipped to their parent
+ */
+ box.x1 = pWin->drawable.x;
+ box.y1 = pWin->drawable.y;
+ box.x2 = pWin->drawable.x + pWin->drawable.width;
+ box.y2 = pWin->drawable.y + pWin->drawable.height;
+ RegionReset(&pWin->winSize, &box);
}
else
#endif
- ClippedRegionFromBox(pWin->parent, &pWin->winSize,
- pWin->drawable.x, pWin->drawable.y,
- (int)pWin->drawable.width,
- (int)pWin->drawable.height);
- if (wBoundingShape (pWin) || wClipShape (pWin)) {
- RegionTranslate(&pWin->winSize, - pWin->drawable.x,
- - pWin->drawable.y);
- if (wBoundingShape (pWin))
- RegionIntersect(&pWin->winSize, &pWin->winSize,
- wBoundingShape (pWin));
- if (wClipShape (pWin))
- RegionIntersect(&pWin->winSize, &pWin->winSize,
- wClipShape (pWin));
- RegionTranslate(&pWin->winSize, pWin->drawable.x,
- pWin->drawable.y);
+ ClippedRegionFromBox(pWin->parent, &pWin->winSize,
+ pWin->drawable.x, pWin->drawable.y,
+ (int) pWin->drawable.width,
+ (int) pWin->drawable.height);
+ if (wBoundingShape(pWin) || wClipShape(pWin)) {
+ RegionTranslate(&pWin->winSize, -pWin->drawable.x, -pWin->drawable.y);
+ if (wBoundingShape(pWin))
+ RegionIntersect(&pWin->winSize, &pWin->winSize,
+ wBoundingShape(pWin));
+ if (wClipShape(pWin))
+ RegionIntersect(&pWin->winSize, &pWin->winSize, wClipShape(pWin));
+ RegionTranslate(&pWin->winSize, pWin->drawable.x, pWin->drawable.y);
}
}
void
-SetBorderSize (WindowPtr pWin)
+SetBorderSize(WindowPtr pWin)
{
- int bw;
+ int bw;
- if (HasBorder (pWin)) {
- bw = wBorderWidth (pWin);
+ if (HasBorder(pWin)) {
+ bw = wBorderWidth(pWin);
#ifdef COMPOSITE
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- BoxRec box;
-
- /*
- * Redirected clients get clip list equal to their
- * own geometry, not clipped to their parent
- */
- box.x1 = pWin->drawable.x - bw;
- box.y1 = pWin->drawable.y - bw;
- box.x2 = pWin->drawable.x + pWin->drawable.width + bw;
- box.y2 = pWin->drawable.y + pWin->drawable.height + bw;
- RegionReset(&pWin->borderSize, &box);
- }
- else
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ BoxRec box;
+
+ /*
+ * Redirected clients get clip list equal to their
+ * own geometry, not clipped to their parent
+ */
+ box.x1 = pWin->drawable.x - bw;
+ box.y1 = pWin->drawable.y - bw;
+ box.x2 = pWin->drawable.x + pWin->drawable.width + bw;
+ box.y2 = pWin->drawable.y + pWin->drawable.height + bw;
+ RegionReset(&pWin->borderSize, &box);
+ }
+ else
#endif
- ClippedRegionFromBox(pWin->parent, &pWin->borderSize,
- pWin->drawable.x - bw, pWin->drawable.y - bw,
- (int)(pWin->drawable.width + (bw<<1)),
- (int)(pWin->drawable.height + (bw<<1)));
- if (wBoundingShape (pWin)) {
- RegionTranslate(&pWin->borderSize, - pWin->drawable.x,
- - pWin->drawable.y);
- RegionIntersect(&pWin->borderSize, &pWin->borderSize,
- wBoundingShape (pWin));
- RegionTranslate(&pWin->borderSize, pWin->drawable.x,
- pWin->drawable.y);
- RegionUnion(&pWin->borderSize, &pWin->borderSize,
- &pWin->winSize);
- }
- } else {
- RegionCopy(&pWin->borderSize, &pWin->winSize);
+ ClippedRegionFromBox(pWin->parent, &pWin->borderSize,
+ pWin->drawable.x - bw, pWin->drawable.y - bw,
+ (int) (pWin->drawable.width + (bw << 1)),
+ (int) (pWin->drawable.height + (bw << 1)));
+ if (wBoundingShape(pWin)) {
+ RegionTranslate(&pWin->borderSize, -pWin->drawable.x,
+ -pWin->drawable.y);
+ RegionIntersect(&pWin->borderSize, &pWin->borderSize,
+ wBoundingShape(pWin));
+ RegionTranslate(&pWin->borderSize, pWin->drawable.x,
+ pWin->drawable.y);
+ RegionUnion(&pWin->borderSize, &pWin->borderSize, &pWin->winSize);
+ }
+ }
+ else {
+ RegionCopy(&pWin->borderSize, &pWin->winSize);
}
}
@@ -1772,51 +1680,50 @@ SetBorderSize (WindowPtr pWin)
*/
void
-GravityTranslate (int x, int y, int oldx, int oldy,
- int dw, int dh, unsigned gravity,
- int *destx, int *desty)
+GravityTranslate(int x, int y, int oldx, int oldy,
+ int dw, int dh, unsigned gravity, int *destx, int *desty)
{
switch (gravity) {
case NorthGravity:
- *destx = x + dw / 2;
- *desty = y;
- break;
+ *destx = x + dw / 2;
+ *desty = y;
+ break;
case NorthEastGravity:
- *destx = x + dw;
- *desty = y;
- break;
+ *destx = x + dw;
+ *desty = y;
+ break;
case WestGravity:
- *destx = x;
- *desty = y + dh / 2;
- break;
+ *destx = x;
+ *desty = y + dh / 2;
+ break;
case CenterGravity:
- *destx = x + dw / 2;
- *desty = y + dh / 2;
- break;
+ *destx = x + dw / 2;
+ *desty = y + dh / 2;
+ break;
case EastGravity:
- *destx = x + dw;
- *desty = y + dh / 2;
- break;
+ *destx = x + dw;
+ *desty = y + dh / 2;
+ break;
case SouthWestGravity:
- *destx = x;
- *desty = y + dh;
- break;
+ *destx = x;
+ *desty = y + dh;
+ break;
case SouthGravity:
- *destx = x + dw / 2;
- *desty = y + dh;
- break;
+ *destx = x + dw / 2;
+ *desty = y + dh;
+ break;
case SouthEastGravity:
- *destx = x + dw;
- *desty = y + dh;
- break;
+ *destx = x + dw;
+ *desty = y + dh;
+ break;
case StaticGravity:
- *destx = oldx;
- *desty = oldy;
- break;
+ *destx = oldx;
+ *desty = oldy;
+ break;
default:
- *destx = x;
- *desty = y;
- break;
+ *destx = x;
+ *desty = y;
+ break;
}
}
@@ -1830,59 +1737,54 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
pScreen = pWin->drawable.pScreen;
- for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib)
- {
- if (resized && (pSib->winGravity > NorthWestGravity))
- {
- int cwsx, cwsy;
-
- cwsx = pSib->origin.x;
- cwsy = pSib->origin.y;
- GravityTranslate (cwsx, cwsy, cwsx - dx, cwsy - dy, dw, dh,
- pSib->winGravity, &cwsx, &cwsy);
- if (cwsx != pSib->origin.x || cwsy != pSib->origin.y)
- {
- xEvent event;
-
- event.u.u.type = GravityNotify;
- event.u.gravity.window = pSib->drawable.id;
- event.u.gravity.x = cwsx - wBorderWidth (pSib);
- event.u.gravity.y = cwsy - wBorderWidth (pSib);
- DeliverEvents (pSib, &event, 1, NullWindow);
- pSib->origin.x = cwsx;
- pSib->origin.y = cwsy;
- }
- }
- pSib->drawable.x = pWin->drawable.x + pSib->origin.x;
- pSib->drawable.y = pWin->drawable.y + pSib->origin.y;
- SetWinSize (pSib);
- SetBorderSize (pSib);
- (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y);
-
- if ( (pChild = pSib->firstChild) )
- {
- while (1)
- {
- pChild->drawable.x = pChild->parent->drawable.x +
- pChild->origin.x;
- pChild->drawable.y = pChild->parent->drawable.y +
- pChild->origin.y;
- SetWinSize (pChild);
- SetBorderSize (pChild);
- (*pScreen->PositionWindow)(pChild,
- pChild->drawable.x, pChild->drawable.y);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- while (!pChild->nextSib && (pChild != pSib))
- pChild = pChild->parent;
- if (pChild == pSib)
- break;
- pChild = pChild->nextSib;
- }
- }
+ for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib) {
+ if (resized && (pSib->winGravity > NorthWestGravity)) {
+ int cwsx, cwsy;
+
+ cwsx = pSib->origin.x;
+ cwsy = pSib->origin.y;
+ GravityTranslate(cwsx, cwsy, cwsx - dx, cwsy - dy, dw, dh,
+ pSib->winGravity, &cwsx, &cwsy);
+ if (cwsx != pSib->origin.x || cwsy != pSib->origin.y) {
+ xEvent event;
+
+ event.u.u.type = GravityNotify;
+ event.u.gravity.window = pSib->drawable.id;
+ event.u.gravity.x = cwsx - wBorderWidth(pSib);
+ event.u.gravity.y = cwsy - wBorderWidth(pSib);
+ DeliverEvents(pSib, &event, 1, NullWindow);
+ pSib->origin.x = cwsx;
+ pSib->origin.y = cwsy;
+ }
+ }
+ pSib->drawable.x = pWin->drawable.x + pSib->origin.x;
+ pSib->drawable.y = pWin->drawable.y + pSib->origin.y;
+ SetWinSize(pSib);
+ SetBorderSize(pSib);
+ (*pScreen->PositionWindow) (pSib, pSib->drawable.x, pSib->drawable.y);
+
+ if ((pChild = pSib->firstChild)) {
+ while (1) {
+ pChild->drawable.x = pChild->parent->drawable.x +
+ pChild->origin.x;
+ pChild->drawable.y = pChild->parent->drawable.y +
+ pChild->origin.y;
+ SetWinSize(pChild);
+ SetBorderSize(pChild);
+ (*pScreen->PositionWindow) (pChild,
+ pChild->drawable.x,
+ pChild->drawable.y);
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (!pChild->nextSib && (pChild != pSib))
+ pChild = pChild->parent;
+ if (pChild == pSib)
+ break;
+ pChild = pChild->nextSib;
+ }
+ }
}
}
@@ -1916,68 +1818,58 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
*/
static int
-IsSiblingAboveMe(
- WindowPtr pMe,
- WindowPtr pSib)
+IsSiblingAboveMe(WindowPtr pMe, WindowPtr pSib)
{
WindowPtr pWin;
pWin = pMe->parent->firstChild;
- while (pWin)
- {
- if (pWin == pSib)
- return Above;
- else if (pWin == pMe)
- return Below;
- pWin = pWin->nextSib;
+ while (pWin) {
+ if (pWin == pSib)
+ return Above;
+ else if (pWin == pMe)
+ return Below;
+ pWin = pWin->nextSib;
}
return Below;
}
static BoxPtr
-WindowExtents(
- WindowPtr pWin,
- BoxPtr pBox)
+WindowExtents(WindowPtr pWin, BoxPtr pBox)
{
- pBox->x1 = pWin->drawable.x - wBorderWidth (pWin);
- pBox->y1 = pWin->drawable.y - wBorderWidth (pWin);
- pBox->x2 = pWin->drawable.x + (int)pWin->drawable.width
- + wBorderWidth (pWin);
- pBox->y2 = pWin->drawable.y + (int)pWin->drawable.height
- + wBorderWidth (pWin);
+ pBox->x1 = pWin->drawable.x - wBorderWidth(pWin);
+ pBox->y1 = pWin->drawable.y - wBorderWidth(pWin);
+ pBox->x2 = pWin->drawable.x + (int) pWin->drawable.width
+ + wBorderWidth(pWin);
+ pBox->y2 = pWin->drawable.y + (int) pWin->drawable.height
+ + wBorderWidth(pWin);
return pBox;
}
#define IS_SHAPED(pWin) (wBoundingShape (pWin) != (RegionPtr) NULL)
static RegionPtr
-MakeBoundingRegion (
- WindowPtr pWin,
- BoxPtr pBox)
+MakeBoundingRegion(WindowPtr pWin, BoxPtr pBox)
{
- RegionPtr pRgn = RegionCreate(pBox, 1);
- if (wBoundingShape (pWin)) {
- RegionTranslate(pRgn, -pWin->origin.x, -pWin->origin.y);
- RegionIntersect(pRgn, pRgn, wBoundingShape (pWin));
- RegionTranslate(pRgn, pWin->origin.x, pWin->origin.y);
+ RegionPtr pRgn = RegionCreate(pBox, 1);
+
+ if (wBoundingShape(pWin)) {
+ RegionTranslate(pRgn, -pWin->origin.x, -pWin->origin.y);
+ RegionIntersect(pRgn, pRgn, wBoundingShape(pWin));
+ RegionTranslate(pRgn, pWin->origin.x, pWin->origin.y);
}
return pRgn;
}
static Bool
-ShapeOverlap (
- WindowPtr pWin,
- BoxPtr pWinBox,
- WindowPtr pSib,
- BoxPtr pSibBox)
+ShapeOverlap(WindowPtr pWin, BoxPtr pWinBox, WindowPtr pSib, BoxPtr pSibBox)
{
- RegionPtr pWinRgn, pSibRgn;
- Bool ret;
+ RegionPtr pWinRgn, pSibRgn;
+ Bool ret;
if (!IS_SHAPED(pWin) && !IS_SHAPED(pSib))
- return TRUE;
- pWinRgn = MakeBoundingRegion (pWin, pWinBox);
- pSibRgn = MakeBoundingRegion (pSib, pSibBox);
+ return TRUE;
+ pWinRgn = MakeBoundingRegion(pWin, pWinBox);
+ pSibRgn = MakeBoundingRegion(pSib, pSibBox);
RegionIntersect(pWinRgn, pWinRgn, pSibRgn);
ret = RegionNotEmpty(pWinRgn);
RegionDestroy(pWinRgn);
@@ -1986,48 +1878,39 @@ ShapeOverlap (
}
static Bool
-AnyWindowOverlapsMe(
- WindowPtr pWin,
- WindowPtr pHead,
- BoxPtr box)
+AnyWindowOverlapsMe(WindowPtr pWin, WindowPtr pHead, BoxPtr box)
{
WindowPtr pSib;
BoxRec sboxrec;
BoxPtr sbox;
- for (pSib = pWin->prevSib; pSib != pHead; pSib = pSib->prevSib)
- {
- if (pSib->mapped)
- {
- sbox = WindowExtents(pSib, &sboxrec);
- if (BOXES_OVERLAP(sbox, box)
- && ShapeOverlap (pWin, box, pSib, sbox)
- )
- return TRUE;
- }
+ for (pSib = pWin->prevSib; pSib != pHead; pSib = pSib->prevSib) {
+ if (pSib->mapped) {
+ sbox = WindowExtents(pSib, &sboxrec);
+ if (BOXES_OVERLAP(sbox, box)
+ && ShapeOverlap(pWin, box, pSib, sbox)
+ )
+ return TRUE;
+ }
}
return FALSE;
}
static Bool
-IOverlapAnyWindow(
- WindowPtr pWin,
- BoxPtr box)
+IOverlapAnyWindow(WindowPtr pWin, BoxPtr box)
{
WindowPtr pSib;
BoxRec sboxrec;
BoxPtr sbox;
- for (pSib = pWin->nextSib; pSib; pSib = pSib->nextSib)
- {
- if (pSib->mapped)
- {
- sbox = WindowExtents(pSib, &sboxrec);
- if (BOXES_OVERLAP(sbox, box)
- && ShapeOverlap (pWin, box, pSib, sbox)
- )
- return TRUE;
- }
+ for (pSib = pWin->nextSib; pSib; pSib = pSib->nextSib) {
+ if (pSib->mapped) {
+ sbox = WindowExtents(pSib, &sboxrec);
+ if (BOXES_OVERLAP(sbox, box)
+ && ShapeOverlap(pWin, box, pSib, sbox)
+ )
+ return TRUE;
+ }
}
return FALSE;
}
@@ -2061,144 +1944,130 @@ IOverlapAnyWindow(
*/
static WindowPtr
-WhereDoIGoInTheStack(
- WindowPtr pWin,
- WindowPtr pSib,
- short x,
- short y,
- unsigned short w,
- unsigned short h,
- int smode)
+WhereDoIGoInTheStack(WindowPtr pWin,
+ WindowPtr pSib,
+ short x,
+ short y, unsigned short w, unsigned short h, int smode)
{
BoxRec box;
WindowPtr pHead, pFirst;
- if ((pWin == pWin->parent->firstChild) &&
- (pWin == pWin->parent->lastChild))
- return((WindowPtr ) NULL);
+ if ((pWin == pWin->parent->firstChild) && (pWin == pWin->parent->lastChild))
+ return ((WindowPtr) NULL);
pHead = RealChildHead(pWin->parent);
pFirst = pHead ? pHead->nextSib : pWin->parent->firstChild;
box.x1 = x;
box.y1 = y;
- box.x2 = x + (int)w;
- box.y2 = y + (int)h;
- switch (smode)
+ box.x2 = x + (int) w;
+ box.y2 = y + (int) h;
+ switch (smode) {
+ case Above:
+ if (pSib)
+ return pSib;
+ else if (pWin == pFirst)
+ return pWin->nextSib;
+ else
+ return pFirst;
+ case Below:
+ if (pSib)
+ if (pSib->nextSib != pWin)
+ return pSib->nextSib;
+ else
+ return pWin->nextSib;
+ else
+ return NullWindow;
+ case TopIf:
+ if ((!pWin->mapped || (pSib && !pSib->mapped)))
+ return pWin->nextSib;
+ else if (pSib) {
+ if ((IsSiblingAboveMe(pWin, pSib) == Above) &&
+ (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT))
+ return pFirst;
+ else
+ return pWin->nextSib;
+ }
+ else if (AnyWindowOverlapsMe(pWin, pHead, &box))
+ return pFirst;
+ else
+ return pWin->nextSib;
+ case BottomIf:
+ if ((!pWin->mapped || (pSib && !pSib->mapped)))
+ return pWin->nextSib;
+ else if (pSib) {
+ if ((IsSiblingAboveMe(pWin, pSib) == Below) &&
+ (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT))
+ return NullWindow;
+ else
+ return pWin->nextSib;
+ }
+ else if (IOverlapAnyWindow(pWin, &box))
+ return NullWindow;
+ else
+ return pWin->nextSib;
+ case Opposite:
+ if ((!pWin->mapped || (pSib && !pSib->mapped)))
+ return pWin->nextSib;
+ else if (pSib) {
+ if (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT) {
+ if (IsSiblingAboveMe(pWin, pSib) == Above)
+ return pFirst;
+ else
+ return NullWindow;
+ }
+ else
+ return pWin->nextSib;
+ }
+ else if (AnyWindowOverlapsMe(pWin, pHead, &box)) {
+ /* If I'm occluded, I can't possibly be the first child
+ * if (pWin == pWin->parent->firstChild)
+ * return pWin->nextSib;
+ */
+ return pFirst;
+ }
+ else if (IOverlapAnyWindow(pWin, &box))
+ return NullWindow;
+ else
+ return pWin->nextSib;
+ default:
{
- case Above:
- if (pSib)
- return pSib;
- else if (pWin == pFirst)
- return pWin->nextSib;
- else
- return pFirst;
- case Below:
- if (pSib)
- if (pSib->nextSib != pWin)
- return pSib->nextSib;
- else
- return pWin->nextSib;
- else
- return NullWindow;
- case TopIf:
- if ((!pWin->mapped || (pSib && !pSib->mapped)))
- return pWin->nextSib;
- else if (pSib)
- {
- if ((IsSiblingAboveMe(pWin, pSib) == Above) &&
- (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT))
- return pFirst;
- else
- return pWin->nextSib;
- }
- else if (AnyWindowOverlapsMe(pWin, pHead, &box))
- return pFirst;
- else
- return pWin->nextSib;
- case BottomIf:
- if ((!pWin->mapped || (pSib && !pSib->mapped)))
- return pWin->nextSib;
- else if (pSib)
- {
- if ((IsSiblingAboveMe(pWin, pSib) == Below) &&
- (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT))
- return NullWindow;
- else
- return pWin->nextSib;
- }
- else if (IOverlapAnyWindow(pWin, &box))
- return NullWindow;
- else
- return pWin->nextSib;
- case Opposite:
- if ((!pWin->mapped || (pSib && !pSib->mapped)))
- return pWin->nextSib;
- else if (pSib)
- {
- if (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT)
- {
- if (IsSiblingAboveMe(pWin, pSib) == Above)
- return pFirst;
- else
- return NullWindow;
- }
- else
- return pWin->nextSib;
- }
- else if (AnyWindowOverlapsMe(pWin, pHead, &box))
- {
- /* If I'm occluded, I can't possibly be the first child
- * if (pWin == pWin->parent->firstChild)
- * return pWin->nextSib;
- */
- return pFirst;
- }
- else if (IOverlapAnyWindow(pWin, &box))
- return NullWindow;
- else
- return pWin->nextSib;
- default:
- {
- /* should never happen; make something up. */
- return pWin->nextSib;
- }
+ /* should never happen; make something up. */
+ return pWin->nextSib;
+ }
}
}
static void
-ReflectStackChange(
- WindowPtr pWin,
- WindowPtr pSib,
- VTKind kind)
+ReflectStackChange(WindowPtr pWin, WindowPtr pSib, VTKind kind)
{
/* Note that pSib might be NULL */
- Bool WasViewable = (Bool)pWin->viewable;
+ Bool WasViewable = (Bool) pWin->viewable;
Bool anyMarked;
WindowPtr pFirstChange;
- WindowPtr pLayerWin;
+ WindowPtr pLayerWin;
ScreenPtr pScreen = pWin->drawable.pScreen;
/* if this is a root window, can't be restacked */
if (!pWin->parent)
- return;
+ return;
pFirstChange = MoveWindowInStack(pWin, pSib);
- if (WasViewable)
- {
- anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange,
- &pLayerWin);
- if (pLayerWin != pWin) pFirstChange = pLayerWin;
- if (anyMarked)
- {
- (*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, kind);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (anyMarked && pWin->drawable.pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange, kind);
+ if (WasViewable) {
+ anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pFirstChange,
+ &pLayerWin);
+ if (pLayerWin != pWin)
+ pFirstChange = pLayerWin;
+ if (anyMarked) {
+ (*pScreen->ValidateTree) (pLayerWin->parent, pFirstChange, kind);
+ (*pScreen->HandleExposures) (pLayerWin->parent);
+ }
+ if (anyMarked && pWin->drawable.pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pLayerWin->parent, pFirstChange,
+ kind);
}
if (pWin->realized)
- WindowsRestructured ();
+ WindowsRestructured();
}
/*****
@@ -2217,251 +2086,236 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
Window sibwid = 0;
Mask index2, tmask;
XID *pVlist;
- short x, y, beforeX, beforeY;
+ short x, y, beforeX, beforeY;
unsigned short w = pWin->drawable.width,
- h = pWin->drawable.height,
- bw = pWin->borderWidth;
+ h = pWin->drawable.height, bw = pWin->borderWidth;
int rc, action, smode = Above;
xEvent event;
- if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask))
- return BadMatch;
+ if ((pWin->drawable.class == InputOnly) &&
+ (mask & IllegalInputOnlyConfigureMask))
+ return BadMatch;
if ((mask & CWSibling) && !(mask & CWStackMode))
- return BadMatch;
+ return BadMatch;
pVlist = vlist;
- if (pParent)
- {
- x = pWin->drawable.x - pParent->drawable.x - (int)bw;
- y = pWin->drawable.y - pParent->drawable.y - (int)bw;
+ if (pParent) {
+ x = pWin->drawable.x - pParent->drawable.x - (int) bw;
+ y = pWin->drawable.y - pParent->drawable.y - (int) bw;
}
- else
- {
- x = pWin->drawable.x;
- y = pWin->drawable.y;
+ else {
+ x = pWin->drawable.x;
+ y = pWin->drawable.y;
}
beforeX = x;
beforeY = y;
- action = RESTACK_WIN;
- if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth))))
- {
- GET_INT16(CWX, x);
- GET_INT16(CWY, y);
- action = MOVE_WIN;
- }
- /* or should be resized */
- else if (mask & (CWX | CWY | CWWidth | CWHeight))
- {
- GET_INT16(CWX, x);
- GET_INT16(CWY, y);
- GET_CARD16(CWWidth, w);
- GET_CARD16 (CWHeight, h);
- if (!w || !h)
- {
- client->errorValue = 0;
- return BadValue;
- }
- action = RESIZE_WIN;
+ action = RESTACK_WIN;
+ if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth)))) {
+ GET_INT16(CWX, x);
+ GET_INT16(CWY, y);
+ action = MOVE_WIN;
+ }
+ /* or should be resized */
+ else if (mask & (CWX | CWY | CWWidth | CWHeight)) {
+ GET_INT16(CWX, x);
+ GET_INT16(CWY, y);
+ GET_CARD16(CWWidth, w);
+ GET_CARD16(CWHeight, h);
+ if (!w || !h) {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ action = RESIZE_WIN;
}
tmask = mask & ~ChangeMask;
- while (tmask)
- {
- index2 = (Mask)lowbit (tmask);
- tmask &= ~index2;
- switch (index2)
- {
- case CWBorderWidth:
- GET_CARD16(CWBorderWidth, bw);
- break;
- case CWSibling:
- sibwid = (Window ) *pVlist;
- pVlist++;
- rc = dixLookupWindow(&pSib, sibwid, client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = sibwid;
- return rc;
- }
- if (pSib->parent != pParent)
- return BadMatch;
- if (pSib == pWin)
- return BadMatch;
- break;
- case CWStackMode:
- GET_CARD8(CWStackMode, smode);
- if ((smode != TopIf) && (smode != BottomIf) &&
- (smode != Opposite) && (smode != Above) && (smode != Below))
- {
- client->errorValue = smode;
- return BadValue;
- }
- break;
- default:
- client->errorValue = mask;
- return BadValue;
- }
- }
- /* root really can't be reconfigured, so just return */
+ while (tmask) {
+ index2 = (Mask) lowbit(tmask);
+ tmask &= ~index2;
+ switch (index2) {
+ case CWBorderWidth:
+ GET_CARD16(CWBorderWidth, bw);
+ break;
+ case CWSibling:
+ sibwid = (Window) *pVlist;
+ pVlist++;
+ rc = dixLookupWindow(&pSib, sibwid, client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = sibwid;
+ return rc;
+ }
+ if (pSib->parent != pParent)
+ return BadMatch;
+ if (pSib == pWin)
+ return BadMatch;
+ break;
+ case CWStackMode:
+ GET_CARD8(CWStackMode, smode);
+ if ((smode != TopIf) && (smode != BottomIf) &&
+ (smode != Opposite) && (smode != Above) && (smode != Below)) {
+ client->errorValue = smode;
+ return BadValue;
+ }
+ break;
+ default:
+ client->errorValue = mask;
+ return BadValue;
+ }
+ }
+ /* root really can't be reconfigured, so just return */
if (!pParent)
- return Success;
+ return Success;
- /* Figure out if the window should be moved. Doesnt
- make the changes to the window if event sent */
+ /* Figure out if the window should be moved. Doesnt
+ make the changes to the window if event sent */
if (mask & CWStackMode)
- pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x,
- pParent->drawable.y + y,
- w + (bw << 1), h + (bw << 1), smode);
+ pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x,
+ pParent->drawable.y + y,
+ w + (bw << 1), h + (bw << 1), smode);
else
- pSib = pWin->nextSib;
-
-
- if ((!pWin->overrideRedirect) &&
- (RedirectSend(pParent)
- ))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = ConfigureRequest;
- event.u.configureRequest.window = pWin->drawable.id;
- if (mask & CWSibling)
- event.u.configureRequest.sibling = sibwid;
- else
- event.u.configureRequest.sibling = None;
- if (mask & CWStackMode)
- event.u.u.detail = smode;
- else
- event.u.u.detail = Above;
- event.u.configureRequest.x = x;
- event.u.configureRequest.y = y;
+ pSib = pWin->nextSib;
+
+ if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
+ )) {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = ConfigureRequest;
+ event.u.configureRequest.window = pWin->drawable.id;
+ if (mask & CWSibling)
+ event.u.configureRequest.sibling = sibwid;
+ else
+ event.u.configureRequest.sibling = None;
+ if (mask & CWStackMode)
+ event.u.u.detail = smode;
+ else
+ event.u.u.detail = Above;
+ event.u.configureRequest.x = x;
+ event.u.configureRequest.y = y;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && (!pParent || !pParent->parent)) {
+ if (!noPanoramiXExtension && (!pParent || !pParent->parent)) {
event.u.configureRequest.x += screenInfo.screens[0]->x;
event.u.configureRequest.y += screenInfo.screens[0]->y;
- }
+ }
#endif
- event.u.configureRequest.width = w;
- event.u.configureRequest.height = h;
- event.u.configureRequest.borderWidth = bw;
- event.u.configureRequest.valueMask = mask;
- event.u.configureRequest.parent = pParent->drawable.id;
- if (MaybeDeliverEventsToClient(pParent, &event, 1,
- SubstructureRedirectMask, client) == 1)
- return Success;
+ event.u.configureRequest.width = w;
+ event.u.configureRequest.height = h;
+ event.u.configureRequest.borderWidth = bw;
+ event.u.configureRequest.valueMask = mask;
+ event.u.configureRequest.parent = pParent->drawable.id;
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask, client) == 1)
+ return Success;
}
- if (action == RESIZE_WIN)
- {
- Bool size_change = (w != pWin->drawable.width)
- || (h != pWin->drawable.height);
- if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask))
- {
- xEvent eventT;
- memset(&eventT, 0, sizeof(xEvent));
- eventT.u.u.type = ResizeRequest;
- eventT.u.resizeRequest.window = pWin->drawable.id;
- eventT.u.resizeRequest.width = w;
- eventT.u.resizeRequest.height = h;
- if (MaybeDeliverEventsToClient(pWin, &eventT, 1,
- ResizeRedirectMask, client) == 1)
- {
- /* if event is delivered, leave the actual size alone. */
- w = pWin->drawable.width;
- h = pWin->drawable.height;
- size_change = FALSE;
- }
- }
- if (!size_change)
- {
- if (mask & (CWX | CWY))
- action = MOVE_WIN;
- else if (mask & (CWStackMode | CWBorderWidth))
- action = RESTACK_WIN;
- else /* really nothing to do */
- return(Success) ;
- }
+ if (action == RESIZE_WIN) {
+ Bool size_change = (w != pWin->drawable.width)
+ || (h != pWin->drawable.height);
+
+ if (size_change &&
+ ((pWin->eventMask | wOtherEventMasks(pWin)) & ResizeRedirectMask)) {
+ xEvent eventT;
+
+ memset(&eventT, 0, sizeof(xEvent));
+ eventT.u.u.type = ResizeRequest;
+ eventT.u.resizeRequest.window = pWin->drawable.id;
+ eventT.u.resizeRequest.width = w;
+ eventT.u.resizeRequest.height = h;
+ if (MaybeDeliverEventsToClient(pWin, &eventT, 1,
+ ResizeRedirectMask, client) == 1) {
+ /* if event is delivered, leave the actual size alone. */
+ w = pWin->drawable.width;
+ h = pWin->drawable.height;
+ size_change = FALSE;
+ }
+ }
+ if (!size_change) {
+ if (mask & (CWX | CWY))
+ action = MOVE_WIN;
+ else if (mask & (CWStackMode | CWBorderWidth))
+ action = RESTACK_WIN;
+ else /* really nothing to do */
+ return (Success);
+ }
}
if (action == RESIZE_WIN)
- /* we've already checked whether there's really a size change */
- goto ActuallyDoSomething;
+ /* we've already checked whether there's really a size change */
+ goto ActuallyDoSomething;
if ((mask & CWX) && (x != beforeX))
- goto ActuallyDoSomething;
+ goto ActuallyDoSomething;
if ((mask & CWY) && (y != beforeY))
- goto ActuallyDoSomething;
- if ((mask & CWBorderWidth) && (bw != wBorderWidth (pWin)))
- goto ActuallyDoSomething;
- if (mask & CWStackMode)
- {
+ goto ActuallyDoSomething;
+ if ((mask & CWBorderWidth) && (bw != wBorderWidth(pWin)))
+ goto ActuallyDoSomething;
+ if (mask & CWStackMode) {
#ifndef ROOTLESS
/* See above for why we always reorder in rootless mode. */
- if (pWin->nextSib != pSib)
+ if (pWin->nextSib != pSib)
#endif
- goto ActuallyDoSomething;
+ goto ActuallyDoSomething;
}
return Success;
-ActuallyDoSomething:
- if (pWin->drawable.pScreen->ConfigNotify)
- {
- int ret;
- ret = (*pWin->drawable.pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
- if (ret) {
- client->errorValue = 0;
- return ret;
- }
+ ActuallyDoSomething:
+ if (pWin->drawable.pScreen->ConfigNotify) {
+ int ret;
+
+ ret =
+ (*pWin->drawable.pScreen->ConfigNotify) (pWin, x, y, w, h, bw,
+ pSib);
+ if (ret) {
+ client->errorValue = 0;
+ return ret;
+ }
}
- if (SubStrSend(pWin, pParent))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = ConfigureNotify;
- event.u.configureNotify.window = pWin->drawable.id;
- if (pSib)
- event.u.configureNotify.aboveSibling = pSib->drawable.id;
- else
- event.u.configureNotify.aboveSibling = None;
- event.u.configureNotify.x = x;
- event.u.configureNotify.y = y;
+ if (SubStrSend(pWin, pParent)) {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = ConfigureNotify;
+ event.u.configureNotify.window = pWin->drawable.id;
+ if (pSib)
+ event.u.configureNotify.aboveSibling = pSib->drawable.id;
+ else
+ event.u.configureNotify.aboveSibling = None;
+ event.u.configureNotify.x = x;
+ event.u.configureNotify.y = y;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && (!pParent || !pParent->parent)) {
- event.u.configureNotify.x += screenInfo.screens[0]->x;
- event.u.configureNotify.y += screenInfo.screens[0]->y;
- }
+ if (!noPanoramiXExtension && (!pParent || !pParent->parent)) {
+ event.u.configureNotify.x += screenInfo.screens[0]->x;
+ event.u.configureNotify.y += screenInfo.screens[0]->y;
+ }
#endif
- event.u.configureNotify.width = w;
- event.u.configureNotify.height = h;
- event.u.configureNotify.borderWidth = bw;
- event.u.configureNotify.override = pWin->overrideRedirect;
- DeliverEvents(pWin, &event, 1, NullWindow);
- }
- if (mask & CWBorderWidth)
- {
- if (action == RESTACK_WIN)
- {
- action = MOVE_WIN;
- pWin->borderWidth = bw;
- }
- else if ((action == MOVE_WIN) &&
- (beforeX + wBorderWidth (pWin) == x + (int)bw) &&
- (beforeY + wBorderWidth (pWin) == y + (int)bw))
- {
- action = REBORDER_WIN;
- (*pWin->drawable.pScreen->ChangeBorderWidth)(pWin, bw);
- }
- else
- pWin->borderWidth = bw;
+ event.u.configureNotify.width = w;
+ event.u.configureNotify.height = h;
+ event.u.configureNotify.borderWidth = bw;
+ event.u.configureNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+ if (mask & CWBorderWidth) {
+ if (action == RESTACK_WIN) {
+ action = MOVE_WIN;
+ pWin->borderWidth = bw;
+ }
+ else if ((action == MOVE_WIN) &&
+ (beforeX + wBorderWidth(pWin) == x + (int) bw) &&
+ (beforeY + wBorderWidth(pWin) == y + (int) bw)) {
+ action = REBORDER_WIN;
+ (*pWin->drawable.pScreen->ChangeBorderWidth) (pWin, bw);
+ }
+ else
+ pWin->borderWidth = bw;
}
if (action == MOVE_WIN)
- (*pWin->drawable.pScreen->MoveWindow)(pWin, x, y, pSib,
- (mask & CWBorderWidth) ? VTOther : VTMove);
+ (*pWin->drawable.pScreen->MoveWindow) (pWin, x, y, pSib,
+ (mask & CWBorderWidth) ? VTOther
+ : VTMove);
else if (action == RESIZE_WIN)
- (*pWin->drawable.pScreen->ResizeWindow)(pWin, x, y, w, h, pSib);
+ (*pWin->drawable.pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
else if (mask & CWStackMode)
- ReflectStackChange(pWin, pSib, VTOther);
+ ReflectStackChange(pWin, pSib, VTOther);
if (action != RESTACK_WIN)
- CheckCursorConfinement(pWin);
+ CheckCursorConfinement(pWin);
return Success;
#undef RESTACK_WIN
#undef MOVE_WIN
@@ -2469,7 +2323,6 @@ ActuallyDoSomething:
#undef REBORDER_WIN
}
-
/******
*
* CirculateWindow
@@ -2489,63 +2342,58 @@ CirculateWindow(WindowPtr pParent, int direction, ClientPtr client)
pHead = RealChildHead(pParent);
pFirst = pHead ? pHead->nextSib : pParent->firstChild;
- if (direction == RaiseLowest)
- {
- for (pWin = pParent->lastChild;
- (pWin != pHead) &&
- !(pWin->mapped &&
- AnyWindowOverlapsMe(pWin, pHead, WindowExtents(pWin, &box)));
- pWin = pWin->prevSib) ;
- if (pWin == pHead)
- return Success;
+ if (direction == RaiseLowest) {
+ for (pWin = pParent->lastChild;
+ (pWin != pHead) &&
+ !(pWin->mapped &&
+ AnyWindowOverlapsMe(pWin, pHead, WindowExtents(pWin, &box)));
+ pWin = pWin->prevSib);
+ if (pWin == pHead)
+ return Success;
}
- else
- {
- for (pWin = pFirst;
- pWin &&
- !(pWin->mapped &&
- IOverlapAnyWindow(pWin, WindowExtents(pWin, &box)));
- pWin = pWin->nextSib) ;
- if (!pWin)
- return Success;
+ else {
+ for (pWin = pFirst;
+ pWin &&
+ !(pWin->mapped &&
+ IOverlapAnyWindow(pWin, WindowExtents(pWin, &box)));
+ pWin = pWin->nextSib);
+ if (!pWin)
+ return Success;
}
event.u.circulate.window = pWin->drawable.id;
event.u.circulate.parent = pParent->drawable.id;
event.u.circulate.event = pParent->drawable.id;
if (direction == RaiseLowest)
- event.u.circulate.place = PlaceOnTop;
+ event.u.circulate.place = PlaceOnTop;
else
- event.u.circulate.place = PlaceOnBottom;
+ event.u.circulate.place = PlaceOnBottom;
- if (RedirectSend(pParent))
- {
- event.u.u.type = CirculateRequest;
- if (MaybeDeliverEventsToClient(pParent, &event, 1,
- SubstructureRedirectMask, client) == 1)
- return Success;
+ if (RedirectSend(pParent)) {
+ event.u.u.type = CirculateRequest;
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask, client) == 1)
+ return Success;
}
event.u.u.type = CirculateNotify;
DeliverEvents(pWin, &event, 1, NullWindow);
ReflectStackChange(pWin,
- (direction == RaiseLowest) ? pFirst : NullWindow,
- VTStack);
+ (direction == RaiseLowest) ? pFirst : NullWindow,
+ VTStack);
return Success;
}
static int
-CompareWIDs(
- WindowPtr pWin,
- pointer value) /* must conform to VisitWindowProcPtr */
-{
- Window *wid = (Window *)value;
+CompareWIDs(WindowPtr pWin, pointer value)
+{ /* must conform to VisitWindowProcPtr */
+ Window *wid = (Window *) value;
if (pWin->drawable.id == *wid)
- return WT_STOPWALKING;
+ return WT_STOPWALKING;
else
- return WT_WALKCHILDREN;
+ return WT_WALKCHILDREN;
}
/*****
@@ -2557,19 +2405,20 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent,
int x, int y, ClientPtr client)
{
WindowPtr pPrev, pPriorParent;
- Bool WasMapped = (Bool)(pWin->mapped);
+ Bool WasMapped = (Bool) (pWin->mapped);
xEvent event;
- int bw = wBorderWidth (pWin);
+ int bw = wBorderWidth(pWin);
ScreenPtr pScreen;
pScreen = pWin->drawable.pScreen;
- if (TraverseTree(pWin, CompareWIDs, (pointer)&pParent->drawable.id) == WT_STOPWALKING)
- return BadMatch;
+ if (TraverseTree(pWin, CompareWIDs, (pointer) &pParent->drawable.id) ==
+ WT_STOPWALKING)
+ return BadMatch;
if (!MakeWindowOptional(pWin))
- return BadAlloc;
+ return BadAlloc;
if (WasMapped)
- UnmapWindow(pWin, FALSE);
+ UnmapWindow(pWin, FALSE);
memset(&event, 0, sizeof(xEvent));
event.u.u.type = ReparentNotify;
@@ -2578,9 +2427,9 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent,
event.u.reparent.x = x;
event.u.reparent.y = y;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && !pParent->parent) {
- event.u.reparent.x += screenInfo.screens[0]->x;
- event.u.reparent.y += screenInfo.screens[0]->y;
+ if (!noPanoramiXExtension && !pParent->parent) {
+ event.u.reparent.x += screenInfo.screens[0]->x;
+ event.u.reparent.y += screenInfo.screens[0]->y;
}
#endif
event.u.reparent.override = pWin->overrideRedirect;
@@ -2590,37 +2439,35 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent,
pPriorParent = pPrev = pWin->parent;
if (pPrev->firstChild == pWin)
- pPrev->firstChild = pWin->nextSib;
+ pPrev->firstChild = pWin->nextSib;
if (pPrev->lastChild == pWin)
- pPrev->lastChild = pWin->prevSib;
+ pPrev->lastChild = pWin->prevSib;
if (pWin->nextSib)
- pWin->nextSib->prevSib = pWin->prevSib;
+ pWin->nextSib->prevSib = pWin->prevSib;
if (pWin->prevSib)
- pWin->prevSib->nextSib = pWin->nextSib;
+ pWin->prevSib->nextSib = pWin->nextSib;
/* insert at begining of pParent */
pWin->parent = pParent;
pPrev = RealChildHead(pParent);
- if (pPrev)
- {
- pWin->nextSib = pPrev->nextSib;
- if (pPrev->nextSib)
- pPrev->nextSib->prevSib = pWin;
- else
- pParent->lastChild = pWin;
- pPrev->nextSib = pWin;
- pWin->prevSib = pPrev;
+ if (pPrev) {
+ pWin->nextSib = pPrev->nextSib;
+ if (pPrev->nextSib)
+ pPrev->nextSib->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pPrev->nextSib = pWin;
+ pWin->prevSib = pPrev;
}
- else
- {
- pWin->nextSib = pParent->firstChild;
- pWin->prevSib = NullWindow;
- if (pParent->firstChild)
- pParent->firstChild->prevSib = pWin;
- else
- pParent->lastChild = pWin;
- pParent->firstChild = pWin;
+ else {
+ pWin->nextSib = pParent->firstChild;
+ pWin->prevSib = NullWindow;
+ if (pParent->firstChild)
+ pParent->firstChild->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pParent->firstChild = pWin;
}
pWin->origin.x = x + bw;
@@ -2629,18 +2476,18 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent,
pWin->drawable.y = y + bw + pParent->drawable.y;
/* clip to parent */
- SetWinSize (pWin);
- SetBorderSize (pWin);
+ SetWinSize(pWin);
+ SetBorderSize(pWin);
if (pScreen->ReparentWindow)
- (*pScreen->ReparentWindow)(pWin, pPriorParent);
- (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y);
+ (*pScreen->ReparentWindow) (pWin, pPriorParent);
+ (*pScreen->PositionWindow) (pWin, pWin->drawable.x, pWin->drawable.y);
ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
CheckWindowOptionalNeed(pWin);
if (WasMapped)
- MapWindow(pWin, client);
+ MapWindow(pWin, client);
RecalculateDeliverableEvents(pWin);
return Success;
}
@@ -2653,24 +2500,21 @@ RealizeTree(WindowPtr pWin)
Realize = pWin->drawable.pScreen->RealizeWindow;
pChild = pWin;
- while (1)
- {
- if (pChild->mapped)
- {
- pChild->realized = TRUE;
- pChild->viewable = (pChild->drawable.class == InputOutput);
- (* Realize)(pChild);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- return;
- pChild = pChild->nextSib;
+ while (1) {
+ if (pChild->mapped) {
+ pChild->realized = TRUE;
+ pChild->viewable = (pChild->drawable.class == InputOutput);
+ (*Realize) (pChild);
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ return;
+ pChild = pChild->nextSib;
}
}
@@ -2679,15 +2523,15 @@ static WindowPtr windowDisableMapUnmapEvents;
void
DisableMapUnmapEvents(WindowPtr pWin)
{
- assert (windowDisableMapUnmapEvents == NULL);
-
+ assert(windowDisableMapUnmapEvents == NULL);
+
windowDisableMapUnmapEvents = pWin;
}
void
EnableMapUnmapEvents(WindowPtr pWin)
{
- assert (windowDisableMapUnmapEvents != NULL);
+ assert(windowDisableMapUnmapEvents != NULL);
windowDisableMapUnmapEvents = NULL;
}
@@ -2712,86 +2556,80 @@ MapWindow(WindowPtr pWin, ClientPtr client)
ScreenPtr pScreen;
WindowPtr pParent;
- WindowPtr pLayerWin;
+ WindowPtr pLayerWin;
if (pWin->mapped)
- return Success;
+ return Success;
/* general check for permission to map window */
if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW,
- pWin, RT_NONE, NULL, DixShowAccess) != Success)
- return Success;
+ pWin, RT_NONE, NULL, DixShowAccess) != Success)
+ return Success;
pScreen = pWin->drawable.pScreen;
- if ( (pParent = pWin->parent) )
- {
- xEvent event;
- Bool anyMarked;
-
- if ((!pWin->overrideRedirect) &&
- (RedirectSend(pParent)
- ))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = MapRequest;
- event.u.mapRequest.window = pWin->drawable.id;
- event.u.mapRequest.parent = pParent->drawable.id;
-
- if (MaybeDeliverEventsToClient(pParent, &event, 1,
- SubstructureRedirectMask, client) == 1)
- return Success;
- }
-
- pWin->mapped = TRUE;
- if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = MapNotify;
- event.u.mapNotify.window = pWin->drawable.id;
- event.u.mapNotify.override = pWin->overrideRedirect;
- DeliverEvents(pWin, &event, 1, NullWindow);
- }
-
- if (!pParent->realized)
- return Success;
- RealizeTree(pWin);
- if (pWin->viewable)
- {
- anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin,
- &pLayerWin);
- if (anyMarked)
- {
- (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTMap);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTMap);
- }
- WindowsRestructured ();
+ if ((pParent = pWin->parent)) {
+ xEvent event;
+ Bool anyMarked;
+
+ if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
+ )) {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = MapRequest;
+ event.u.mapRequest.window = pWin->drawable.id;
+ event.u.mapRequest.parent = pParent->drawable.id;
+
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask,
+ client) == 1)
+ return Success;
+ }
+
+ pWin->mapped = TRUE;
+ if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = MapNotify;
+ event.u.mapNotify.window = pWin->drawable.id;
+ event.u.mapNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+
+ if (!pParent->realized)
+ return Success;
+ RealizeTree(pWin);
+ if (pWin->viewable) {
+ anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pWin,
+ &pLayerWin);
+ if (anyMarked) {
+ (*pScreen->ValidateTree) (pLayerWin->parent, pLayerWin, VTMap);
+ (*pScreen->HandleExposures) (pLayerWin->parent);
+ }
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pLayerWin->parent, pLayerWin,
+ VTMap);
+ }
+ WindowsRestructured();
}
- else
- {
- RegionRec temp;
-
- pWin->mapped = TRUE;
- pWin->realized = TRUE; /* for roots */
- pWin->viewable = pWin->drawable.class == InputOutput;
- /* We SHOULD check for an error value here XXX */
- (*pScreen->RealizeWindow)(pWin);
- if (pScreen->ClipNotify)
- (*pScreen->ClipNotify) (pWin, 0, 0);
- if (pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap);
- RegionNull(&temp);
- RegionCopy(&temp, &pWin->clipList);
- (*pScreen->WindowExposures) (pWin, &temp, NullRegion);
- RegionUninit(&temp);
+ else {
+ RegionRec temp;
+
+ pWin->mapped = TRUE;
+ pWin->realized = TRUE; /* for roots */
+ pWin->viewable = pWin->drawable.class == InputOutput;
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->RealizeWindow) (pWin);
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (pWin, 0, 0);
+ if (pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (NullWindow, pWin, VTMap);
+ RegionNull(&temp);
+ RegionCopy(&temp, &pWin->clipList);
+ (*pScreen->WindowExposures) (pWin, &temp, NullRegion);
+ RegionUninit(&temp);
}
return Success;
}
-
/*****
* MapSubwindows
* Performs a MapWindow all unmapped children of the window, in top
@@ -2801,84 +2639,76 @@ MapWindow(WindowPtr pWin, ClientPtr client)
void
MapSubwindows(WindowPtr pParent, ClientPtr client)
{
- WindowPtr pWin;
- WindowPtr pFirstMapped = NullWindow;
- ScreenPtr pScreen;
- Mask parentRedirect;
- Mask parentNotify;
- xEvent event;
- Bool anyMarked;
- WindowPtr pLayerWin;
+ WindowPtr pWin;
+ WindowPtr pFirstMapped = NullWindow;
+ ScreenPtr pScreen;
+ Mask parentRedirect;
+ Mask parentNotify;
+ xEvent event;
+ Bool anyMarked;
+ WindowPtr pLayerWin;
pScreen = pParent->drawable.pScreen;
parentRedirect = RedirectSend(pParent);
parentNotify = SubSend(pParent);
anyMarked = FALSE;
- for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib)
- {
- if (!pWin->mapped)
- {
- if (parentRedirect && !pWin->overrideRedirect)
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = MapRequest;
- event.u.mapRequest.window = pWin->drawable.id;
- event.u.mapRequest.parent = pParent->drawable.id;
-
- if (MaybeDeliverEventsToClient(pParent, &event, 1,
- SubstructureRedirectMask, client) == 1)
- continue;
- }
-
- pWin->mapped = TRUE;
- if (parentNotify || StrSend(pWin))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = MapNotify;
- event.u.mapNotify.window = pWin->drawable.id;
- event.u.mapNotify.override = pWin->overrideRedirect;
- DeliverEvents(pWin, &event, 1, NullWindow);
- }
-
- if (!pFirstMapped)
- pFirstMapped = pWin;
- if (pParent->realized)
- {
- RealizeTree(pWin);
- if (pWin->viewable)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
- (WindowPtr *)NULL);
- }
- }
- }
- }
-
- if (pFirstMapped)
- {
- pLayerWin = (*pScreen->GetLayerWindow)(pParent);
- if (pLayerWin->parent != pParent) {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pLayerWin,
- pLayerWin,
- (WindowPtr *)NULL);
- pFirstMapped = pLayerWin;
- }
- if (anyMarked)
- {
- (*pScreen->ValidateTree)(pLayerWin->parent, pFirstMapped, VTMap);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
+ for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) {
+ if (!pWin->mapped) {
+ if (parentRedirect && !pWin->overrideRedirect) {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = MapRequest;
+ event.u.mapRequest.window = pWin->drawable.id;
+ event.u.mapRequest.parent = pParent->drawable.id;
+
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask,
+ client) == 1)
+ continue;
+ }
+
+ pWin->mapped = TRUE;
+ if (parentNotify || StrSend(pWin)) {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = MapNotify;
+ event.u.mapNotify.window = pWin->drawable.id;
+ event.u.mapNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+
+ if (!pFirstMapped)
+ pFirstMapped = pWin;
+ if (pParent->realized) {
+ RealizeTree(pWin);
+ if (pWin->viewable) {
+ anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pWin,
+ (WindowPtr
+ *) NULL);
+ }
+ }
+ }
+ }
+
+ if (pFirstMapped) {
+ pLayerWin = (*pScreen->GetLayerWindow) (pParent);
+ if (pLayerWin->parent != pParent) {
+ anyMarked |= (*pScreen->MarkOverlappedWindows) (pLayerWin,
+ pLayerWin,
+ (WindowPtr *) NULL);
+ pFirstMapped = pLayerWin;
+ }
+ if (anyMarked) {
+ (*pScreen->ValidateTree) (pLayerWin->parent, pFirstMapped, VTMap);
+ (*pScreen->HandleExposures) (pLayerWin->parent);
+ }
if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstMapped,
- VTMap);
- WindowsRestructured ();
+ (*pScreen->PostValidateTree) (pLayerWin->parent, pFirstMapped,
+ VTMap);
+ WindowsRestructured();
}
}
static void
-UnrealizeTree(
- WindowPtr pWin,
- Bool fromConfigure)
+UnrealizeTree(WindowPtr pWin, Bool fromConfigure)
{
WindowPtr pChild;
UnrealizeWindowProcPtr Unrealize;
@@ -2887,42 +2717,40 @@ UnrealizeTree(
Unrealize = pWin->drawable.pScreen->UnrealizeWindow;
MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow;
pChild = pWin;
- while (1)
- {
- if (pChild->realized)
- {
- pChild->realized = FALSE;
- pChild->visibility = VisibilityNotViewable;
+ while (1) {
+ if (pChild->realized) {
+ pChild->realized = FALSE;
+ pChild->visibility = VisibilityNotViewable;
#ifdef PANORAMIX
- if(!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) {
- PanoramiXRes *win;
- int rc = dixLookupResourceByType((pointer *)&win,
- pChild->drawable.id, XRT_WINDOW,
- serverClient, DixWriteAccess);
- if (rc == Success)
- win->u.win.visibility = VisibilityNotViewable;
- }
+ if (!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) {
+ PanoramiXRes *win;
+ int rc = dixLookupResourceByType((pointer *) &win,
+ pChild->drawable.id,
+ XRT_WINDOW,
+ serverClient, DixWriteAccess);
+
+ if (rc == Success)
+ win->u.win.visibility = VisibilityNotViewable;
+ }
#endif
- (* Unrealize)(pChild);
- if (MapUnmapEventsEnabled(pWin))
- DeleteWindowFromAnyEvents(pChild, FALSE);
- if (pChild->viewable)
- {
- pChild->viewable = FALSE;
- (* MarkUnrealizedWindow)(pChild, pWin, fromConfigure);
- pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- return;
- pChild = pChild->nextSib;
+ (*Unrealize) (pChild);
+ if (MapUnmapEventsEnabled(pWin))
+ DeleteWindowFromAnyEvents(pChild, FALSE);
+ if (pChild->viewable) {
+ pChild->viewable = FALSE;
+ (*MarkUnrealizedWindow) (pChild, pWin, fromConfigure);
+ pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ return;
+ pChild = pChild->nextSib;
}
}
@@ -2938,43 +2766,39 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
{
WindowPtr pParent;
xEvent event;
- Bool wasRealized = (Bool)pWin->realized;
- Bool wasViewable = (Bool)pWin->viewable;
+ Bool wasRealized = (Bool) pWin->realized;
+ Bool wasViewable = (Bool) pWin->viewable;
ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pLayerWin = pWin;
if ((!pWin->mapped) || (!(pParent = pWin->parent)))
- return Success;
- if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = UnmapNotify;
- event.u.unmapNotify.window = pWin->drawable.id;
- event.u.unmapNotify.fromConfigure = fromConfigure;
- DeliverEvents(pWin, &event, 1, NullWindow);
- }
- if (wasViewable && !fromConfigure)
- {
- pWin->valdata = UnmapValData;
- (*pScreen->MarkOverlappedWindows)(pWin, pWin->nextSib, &pLayerWin);
- (*pScreen->MarkWindow)(pLayerWin->parent);
+ return Success;
+ if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = UnmapNotify;
+ event.u.unmapNotify.window = pWin->drawable.id;
+ event.u.unmapNotify.fromConfigure = fromConfigure;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+ if (wasViewable && !fromConfigure) {
+ pWin->valdata = UnmapValData;
+ (*pScreen->MarkOverlappedWindows) (pWin, pWin->nextSib, &pLayerWin);
+ (*pScreen->MarkWindow) (pLayerWin->parent);
}
pWin->mapped = FALSE;
if (wasRealized)
- UnrealizeTree(pWin, fromConfigure);
- if (wasViewable)
- {
- if (!fromConfigure)
- {
- (*pScreen->ValidateTree)(pLayerWin->parent, pWin, VTUnmap);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (!fromConfigure && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pWin, VTUnmap);
+ UnrealizeTree(pWin, fromConfigure);
+ if (wasViewable) {
+ if (!fromConfigure) {
+ (*pScreen->ValidateTree) (pLayerWin->parent, pWin, VTUnmap);
+ (*pScreen->HandleExposures) (pLayerWin->parent);
+ }
+ if (!fromConfigure && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pLayerWin->parent, pWin, VTUnmap);
}
if (wasRealized && !fromConfigure) {
- WindowsRestructured ();
- WindowGone(pWin);
+ WindowsRestructured();
+ WindowGone(pWin);
}
return Success;
}
@@ -2990,125 +2814,114 @@ UnmapSubwindows(WindowPtr pWin)
{
WindowPtr pChild, pHead;
xEvent event;
- Bool wasRealized = (Bool)pWin->realized;
- Bool wasViewable = (Bool)pWin->viewable;
+ Bool wasRealized = (Bool) pWin->realized;
+ Bool wasViewable = (Bool) pWin->viewable;
Bool anyMarked = FALSE;
Mask parentNotify;
WindowPtr pLayerWin = NULL;
ScreenPtr pScreen = pWin->drawable.pScreen;
if (!pWin->firstChild)
- return;
+ return;
parentNotify = SubSend(pWin);
pHead = RealChildHead(pWin);
if (wasViewable)
- pLayerWin = (*pScreen->GetLayerWindow)(pWin);
-
- for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
- {
- if (pChild->mapped)
- {
- if (parentNotify || StrSend(pChild))
- {
- event.u.u.type = UnmapNotify;
- event.u.unmapNotify.window = pChild->drawable.id;
- event.u.unmapNotify.fromConfigure = xFalse;
- DeliverEvents(pChild, &event, 1, NullWindow);
- }
- if (pChild->viewable)
- {
- pChild->valdata = UnmapValData;
- anyMarked = TRUE;
- }
- pChild->mapped = FALSE;
- if (pChild->realized)
- UnrealizeTree(pChild, FALSE);
- if (wasViewable)
- {
- }
- }
+ pLayerWin = (*pScreen->GetLayerWindow) (pWin);
+
+ for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) {
+ if (pChild->mapped) {
+ if (parentNotify || StrSend(pChild)) {
+ event.u.u.type = UnmapNotify;
+ event.u.unmapNotify.window = pChild->drawable.id;
+ event.u.unmapNotify.fromConfigure = xFalse;
+ DeliverEvents(pChild, &event, 1, NullWindow);
+ }
+ if (pChild->viewable) {
+ pChild->valdata = UnmapValData;
+ anyMarked = TRUE;
+ }
+ pChild->mapped = FALSE;
+ if (pChild->realized)
+ UnrealizeTree(pChild, FALSE);
+ if (wasViewable) {
+ }
+ }
}
- if (wasViewable)
- {
- if (anyMarked)
- {
- if (pLayerWin->parent == pWin)
- (*pScreen->MarkWindow)(pWin);
- else
- {
- WindowPtr ptmp;
- (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin,
- (WindowPtr *)NULL);
- (*pScreen->MarkWindow)(pLayerWin->parent);
-
- /* Windows between pWin and pLayerWin may not have been marked */
- ptmp = pWin;
-
- while (ptmp != pLayerWin->parent)
- {
- (*pScreen->MarkWindow)(ptmp);
- ptmp = ptmp->parent;
- }
+ if (wasViewable) {
+ if (anyMarked) {
+ if (pLayerWin->parent == pWin)
+ (*pScreen->MarkWindow) (pWin);
+ else {
+ WindowPtr ptmp;
+
+ (*pScreen->MarkOverlappedWindows) (pWin, pLayerWin,
+ (WindowPtr *) NULL);
+ (*pScreen->MarkWindow) (pLayerWin->parent);
+
+ /* Windows between pWin and pLayerWin may not have been marked */
+ ptmp = pWin;
+
+ while (ptmp != pLayerWin->parent) {
+ (*pScreen->MarkWindow) (ptmp);
+ ptmp = ptmp->parent;
+ }
pHead = pWin->firstChild;
- }
- (*pScreen->ValidateTree)(pLayerWin->parent, pHead, VTUnmap);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pHead, VTUnmap);
+ }
+ (*pScreen->ValidateTree) (pLayerWin->parent, pHead, VTUnmap);
+ (*pScreen->HandleExposures) (pLayerWin->parent);
+ }
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pLayerWin->parent, pHead, VTUnmap);
}
if (wasRealized) {
- WindowsRestructured ();
- WindowGone(pWin);
+ WindowsRestructured();
+ WindowGone(pWin);
}
}
-
void
HandleSaveSet(ClientPtr client)
{
WindowPtr pParent, pWin;
int j;
- for (j=0; j<client->numSaved; j++)
- {
- pWin = SaveSetWindow(client->saveSet[j]);
+ for (j = 0; j < client->numSaved; j++) {
+ pWin = SaveSetWindow(client->saveSet[j]);
#ifdef XFIXES
- if (SaveSetToRoot(client->saveSet[j]))
- pParent = pWin->drawable.pScreen->root;
- else
+ if (SaveSetToRoot(client->saveSet[j]))
+ pParent = pWin->drawable.pScreen->root;
+ else
#endif
- {
- pParent = pWin->parent;
- while (pParent && (wClient (pParent) == client))
- pParent = pParent->parent;
- }
- if (pParent)
- {
- if (pParent != pWin->parent)
- {
+ {
+ pParent = pWin->parent;
+ while (pParent && (wClient(pParent) == client))
+ pParent = pParent->parent;
+ }
+ if (pParent) {
+ if (pParent != pWin->parent) {
#ifdef XFIXES
- /* unmap first so that ReparentWindow doesn't remap */
- if (!SaveSetShouldMap (client->saveSet[j]))
- UnmapWindow(pWin, FALSE);
+ /* unmap first so that ReparentWindow doesn't remap */
+ if (!SaveSetShouldMap(client->saveSet[j]))
+ UnmapWindow(pWin, FALSE);
#endif
- ReparentWindow(pWin, pParent,
- pWin->drawable.x - wBorderWidth (pWin) - pParent->drawable.x,
- pWin->drawable.y - wBorderWidth (pWin) - pParent->drawable.y,
- client);
- if(!pWin->realized && pWin->mapped)
- pWin->mapped = FALSE;
- }
+ ReparentWindow(pWin, pParent,
+ pWin->drawable.x - wBorderWidth(pWin) -
+ pParent->drawable.x,
+ pWin->drawable.y - wBorderWidth(pWin) -
+ pParent->drawable.y, client);
+ if (!pWin->realized && pWin->mapped)
+ pWin->mapped = FALSE;
+ }
#ifdef XFIXES
- if (SaveSetShouldMap (client->saveSet[j]))
+ if (SaveSetShouldMap(client->saveSet[j]))
#endif
- MapWindow(pWin, client);
- }
+ MapWindow(pWin, client);
+ }
}
free(client->saveSet);
client->numSaved = 0;
- client->saveSet = (SaveSetElt *)NULL;
+ client->saveSet = (SaveSetElt *) NULL;
}
/**
@@ -3121,27 +2934,25 @@ PointInWindowIsVisible(WindowPtr pWin, int x, int y)
BoxRec box;
if (!pWin->realized)
- return FALSE;
- if (RegionContainsPoint(&pWin->borderClip,
- x, y, &box)
- && (!wInputShape(pWin) ||
- RegionContainsPoint(wInputShape(pWin),
- x - pWin->drawable.x,
- y - pWin->drawable.y, &box)))
- return TRUE;
+ return FALSE;
+ if (RegionContainsPoint(&pWin->borderClip, x, y, &box)
+ && (!wInputShape(pWin) ||
+ RegionContainsPoint(wInputShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box)))
+ return TRUE;
return FALSE;
}
-
RegionPtr
NotClippedByChildren(WindowPtr pWin)
{
RegionPtr pReg = RegionCreate(NullBox, 1);
+
if (pWin->parent ||
- screenIsSaved != SCREEN_SAVER_ON ||
- !HasSaverWindow (pWin->drawable.pScreen))
- {
- RegionIntersect(pReg, &pWin->borderClip, &pWin->winSize);
+ screenIsSaved != SCREEN_SAVER_ON ||
+ !HasSaverWindow(pWin->drawable.pScreen)) {
+ RegionIntersect(pReg, &pWin->borderClip, &pWin->winSize);
}
return pReg;
}
@@ -3156,59 +2967,64 @@ SendVisibilityNotify(WindowPtr pWin)
return;
#ifdef PANORAMIX
/* This is not quite correct yet, but it's close */
- if(!noPanoramiXExtension) {
- PanoramiXRes *win;
- WindowPtr pWin2;
- int rc, i, Scrnum;
-
- Scrnum = pWin->drawable.pScreen->myNum;
-
- win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, Scrnum);
-
- if(!win || (win->u.win.visibility == visibility))
- return;
-
- switch(visibility) {
- case VisibilityUnobscured:
- FOR_NSCREENS(i) {
- if(i == Scrnum) continue;
-
- rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
- DixWriteAccess);
-
- if (rc == Success) {
- if(pWin2->visibility == VisibilityPartiallyObscured)
- return;
-
- if(!i) pWin = pWin2;
- }
- }
- break;
- case VisibilityPartiallyObscured:
- if(Scrnum) {
- rc = dixLookupWindow(&pWin2, win->info[0].id, serverClient,
- DixWriteAccess);
- if (rc == Success) pWin = pWin2;
- }
- break;
- case VisibilityFullyObscured:
- FOR_NSCREENS(i) {
- if(i == Scrnum) continue;
-
- rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
- DixWriteAccess);
-
- if (rc == Success) {
- if(pWin2->visibility != VisibilityFullyObscured)
- return;
-
- if(!i) pWin = pWin2;
- }
- }
- break;
- }
-
- win->u.win.visibility = visibility;
+ if (!noPanoramiXExtension) {
+ PanoramiXRes *win;
+ WindowPtr pWin2;
+ int rc, i, Scrnum;
+
+ Scrnum = pWin->drawable.pScreen->myNum;
+
+ win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, Scrnum);
+
+ if (!win || (win->u.win.visibility == visibility))
+ return;
+
+ switch (visibility) {
+ case VisibilityUnobscured:
+ FOR_NSCREENS(i) {
+ if (i == Scrnum)
+ continue;
+
+ rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
+ DixWriteAccess);
+
+ if (rc == Success) {
+ if (pWin2->visibility == VisibilityPartiallyObscured)
+ return;
+
+ if (!i)
+ pWin = pWin2;
+ }
+ }
+ break;
+ case VisibilityPartiallyObscured:
+ if (Scrnum) {
+ rc = dixLookupWindow(&pWin2, win->info[0].id, serverClient,
+ DixWriteAccess);
+ if (rc == Success)
+ pWin = pWin2;
+ }
+ break;
+ case VisibilityFullyObscured:
+ FOR_NSCREENS(i) {
+ if (i == Scrnum)
+ continue;
+
+ rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
+ DixWriteAccess);
+
+ if (rc == Success) {
+ if (pWin2->visibility != VisibilityFullyObscured)
+ return;
+
+ if (!i)
+ pWin = pWin2;
+ }
+ }
+ break;
+ }
+
+ win->u.win.visibility = visibility;
}
#endif
@@ -3225,109 +3041,105 @@ dixSaveScreens(ClientPtr client, int on, int mode)
{
int rc, i, what, type;
- if (on == SCREEN_SAVER_FORCER)
- {
- if (mode == ScreenSaverReset)
- what = SCREEN_SAVER_OFF;
- else
- what = SCREEN_SAVER_ON;
- type = what;
+ if (on == SCREEN_SAVER_FORCER) {
+ if (mode == ScreenSaverReset)
+ what = SCREEN_SAVER_OFF;
+ else
+ what = SCREEN_SAVER_ON;
+ type = what;
}
- else
- {
- what = on;
- type = what;
- if (what == screenIsSaved)
- type = SCREEN_SAVER_CYCLE;
+ else {
+ what = on;
+ type = what;
+ if (what == screenIsSaved)
+ type = SCREEN_SAVER_CYCLE;
}
for (i = 0; i < screenInfo.numScreens; i++) {
- rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
- DixShowAccess | DixHideAccess);
- if (rc != Success)
- return rc;
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
+ DixShowAccess | DixHideAccess);
+ if (rc != Success)
+ return rc;
}
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen = screenInfo.screens[i];
- if (on == SCREEN_SAVER_FORCER)
- (* pScreen->SaveScreen) (pScreen, on);
- if (pScreen->screensaver.ExternalScreenSaver)
- {
- if ((*pScreen->screensaver.ExternalScreenSaver)
- (pScreen, type, on == SCREEN_SAVER_FORCER))
- continue;
- }
- if (type == screenIsSaved)
- continue;
- switch (type) {
- case SCREEN_SAVER_OFF:
- if (pScreen->screensaver.blanked == SCREEN_IS_BLANKED)
- {
- (* pScreen->SaveScreen) (pScreen, what);
- }
- else if (HasSaverWindow (pScreen))
- {
- pScreen->screensaver.pWindow = NullWindow;
- FreeResource(pScreen->screensaver.wid, RT_NONE);
- }
- break;
- case SCREEN_SAVER_CYCLE:
- if (pScreen->screensaver.blanked == SCREEN_IS_TILED)
- {
- WindowPtr pWin = pScreen->screensaver.pWindow;
- /* make it look like screen saver is off, so that
- * NotClippedByChildren will compute a clip list
- * for the root window, so miPaintWindow works
- */
- screenIsSaved = SCREEN_SAVER_OFF;
- (*pWin->drawable.pScreen->MoveWindow)(pWin,
- (short)(-(rand() % RANDOM_WIDTH)),
- (short)(-(rand() % RANDOM_WIDTH)),
- pWin->nextSib, VTMove);
- screenIsSaved = SCREEN_SAVER_ON;
- }
- /*
- * Call the DDX saver in case it wants to do something
- * at cycle time
- */
- else if (pScreen->screensaver.blanked == SCREEN_IS_BLANKED)
- {
- (* pScreen->SaveScreen) (pScreen, type);
- }
- break;
- case SCREEN_SAVER_ON:
- if (ScreenSaverBlanking != DontPreferBlanking)
- {
- if ((* pScreen->SaveScreen) (pScreen, what))
- {
- pScreen->screensaver.blanked = SCREEN_IS_BLANKED;
- continue;
- }
- if ((ScreenSaverAllowExposures != DontAllowExposures) &&
- TileScreenSaver(pScreen, SCREEN_IS_BLACK))
- {
- pScreen->screensaver.blanked = SCREEN_IS_BLACK;
- continue;
- }
- }
- if ((ScreenSaverAllowExposures != DontAllowExposures) &&
- TileScreenSaver(pScreen, SCREEN_IS_TILED))
- {
- pScreen->screensaver.blanked = SCREEN_IS_TILED;
- }
- else
- pScreen->screensaver.blanked = SCREEN_ISNT_SAVED;
- break;
- }
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ if (on == SCREEN_SAVER_FORCER)
+ (*pScreen->SaveScreen) (pScreen, on);
+ if (pScreen->screensaver.ExternalScreenSaver) {
+ if ((*pScreen->screensaver.ExternalScreenSaver)
+ (pScreen, type, on == SCREEN_SAVER_FORCER))
+ continue;
+ }
+ if (type == screenIsSaved)
+ continue;
+ switch (type) {
+ case SCREEN_SAVER_OFF:
+ if (pScreen->screensaver.blanked == SCREEN_IS_BLANKED) {
+ (*pScreen->SaveScreen) (pScreen, what);
+ }
+ else if (HasSaverWindow(pScreen)) {
+ pScreen->screensaver.pWindow = NullWindow;
+ FreeResource(pScreen->screensaver.wid, RT_NONE);
+ }
+ break;
+ case SCREEN_SAVER_CYCLE:
+ if (pScreen->screensaver.blanked == SCREEN_IS_TILED) {
+ WindowPtr pWin = pScreen->screensaver.pWindow;
+
+ /* make it look like screen saver is off, so that
+ * NotClippedByChildren will compute a clip list
+ * for the root window, so miPaintWindow works
+ */
+ screenIsSaved = SCREEN_SAVER_OFF;
+ (*pWin->drawable.pScreen->MoveWindow) (pWin,
+ (short) (-
+ (rand() %
+ RANDOM_WIDTH)),
+ (short) (-
+ (rand() %
+ RANDOM_WIDTH)),
+ pWin->nextSib, VTMove);
+ screenIsSaved = SCREEN_SAVER_ON;
+ }
+ /*
+ * Call the DDX saver in case it wants to do something
+ * at cycle time
+ */
+ else if (pScreen->screensaver.blanked == SCREEN_IS_BLANKED) {
+ (*pScreen->SaveScreen) (pScreen, type);
+ }
+ break;
+ case SCREEN_SAVER_ON:
+ if (ScreenSaverBlanking != DontPreferBlanking) {
+ if ((*pScreen->SaveScreen) (pScreen, what)) {
+ pScreen->screensaver.blanked = SCREEN_IS_BLANKED;
+ continue;
+ }
+ if ((ScreenSaverAllowExposures != DontAllowExposures) &&
+ TileScreenSaver(pScreen, SCREEN_IS_BLACK)) {
+ pScreen->screensaver.blanked = SCREEN_IS_BLACK;
+ continue;
+ }
+ }
+ if ((ScreenSaverAllowExposures != DontAllowExposures) &&
+ TileScreenSaver(pScreen, SCREEN_IS_TILED)) {
+ pScreen->screensaver.blanked = SCREEN_IS_TILED;
+ }
+ else
+ pScreen->screensaver.blanked = SCREEN_ISNT_SAVED;
+ break;
+ }
}
screenIsSaved = what;
if (mode == ScreenSaverReset) {
- if (on == SCREEN_SAVER_FORCER) {
- UpdateCurrentTimeIf();
- lastDeviceEventTime = currentTime;
- }
- SetScreenSaverTimer();
+ if (on == SCREEN_SAVER_FORCER) {
+ DeviceIntPtr dev;
+ UpdateCurrentTimeIf();
+ nt_list_for_each_entry(dev, inputInfo.devices, next)
+ lastDeviceEventTime[dev->id] = currentTime;
+ }
+ SetScreenSaverTimer();
}
return Success;
}
@@ -3345,34 +3157,34 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
int result;
XID attributes[3];
Mask mask;
- WindowPtr pWin;
+ WindowPtr pWin;
CursorMetricRec cm;
unsigned char *srcbits, *mskbits;
CursorPtr cursor;
- XID cursorID = 0;
- int attri;
+ XID cursorID = 0;
+ int attri;
mask = 0;
attri = 0;
switch (kind) {
case SCREEN_IS_TILED:
- switch (pScreen->root->backgroundState) {
- case BackgroundPixel:
- attributes[attri++] = pScreen->root->background.pixel;
- mask |= CWBackPixel;
- break;
- case BackgroundPixmap:
- attributes[attri++] = None;
- mask |= CWBackPixmap;
- break;
- default:
- break;
- }
- break;
+ switch (pScreen->root->backgroundState) {
+ case BackgroundPixel:
+ attributes[attri++] = pScreen->root->background.pixel;
+ mask |= CWBackPixel;
+ break;
+ case BackgroundPixmap:
+ attributes[attri++] = None;
+ mask |= CWBackPixmap;
+ break;
+ default:
+ break;
+ }
+ break;
case SCREEN_IS_BLACK:
- attributes[attri++] = pScreen->root->drawable.pScreen->blackPixel;
- mask |= CWBackPixel;
- break;
+ attributes[attri++] = pScreen->root->drawable.pScreen->blackPixel;
+ mask |= CWBackPixel;
+ break;
}
mask |= CWOverrideRedirect;
attributes[attri++] = xTrue;
@@ -3381,65 +3193,59 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
* create a blank cursor
*/
- cm.width=16;
- cm.height=16;
- cm.xhot=8;
- cm.yhot=8;
- srcbits = malloc( BitmapBytePad(32)*16);
- mskbits = malloc( BitmapBytePad(32)*16);
- if (!srcbits || !mskbits)
- {
- free(srcbits);
- free(mskbits);
- cursor = 0;
+ cm.width = 16;
+ cm.height = 16;
+ cm.xhot = 8;
+ cm.yhot = 8;
+ srcbits = malloc(BitmapBytePad(32) * 16);
+ mskbits = malloc(BitmapBytePad(32) * 16);
+ if (!srcbits || !mskbits) {
+ free(srcbits);
+ free(mskbits);
+ cursor = 0;
}
- else
- {
- for (j=0; j<BitmapBytePad(32)*16; j++)
- srcbits[j] = mskbits[j] = 0x0;
- result = AllocARGBCursor(srcbits, mskbits, NULL, &cm, 0, 0, 0, 0, 0, 0,
- &cursor, serverClient, (XID)0);
- if (cursor)
- {
- cursorID = FakeClientID(0);
- if (AddResource (cursorID, RT_CURSOR, (pointer) cursor))
- {
- attributes[attri] = cursorID;
- mask |= CWCursor;
- }
- else
- cursor = 0;
- }
- else
- {
- free(srcbits);
- free(mskbits);
- }
+ else {
+ for (j = 0; j < BitmapBytePad(32) * 16; j++)
+ srcbits[j] = mskbits[j] = 0x0;
+ result = AllocARGBCursor(srcbits, mskbits, NULL, &cm, 0, 0, 0, 0, 0, 0,
+ &cursor, serverClient, (XID) 0);
+ if (cursor) {
+ cursorID = FakeClientID(0);
+ if (AddResource(cursorID, RT_CURSOR, (pointer) cursor)) {
+ attributes[attri] = cursorID;
+ mask |= CWCursor;
+ }
+ else
+ cursor = 0;
+ }
+ else {
+ free(srcbits);
+ free(mskbits);
+ }
}
pWin = pScreen->screensaver.pWindow =
- CreateWindow(pScreen->screensaver.wid,
- pScreen->root,
- -RANDOM_WIDTH, -RANDOM_WIDTH,
- (unsigned short)pScreen->width + RANDOM_WIDTH,
- (unsigned short)pScreen->height + RANDOM_WIDTH,
- 0, InputOutput, mask, attributes, 0, serverClient,
- wVisual (pScreen->root), &result);
+ CreateWindow(pScreen->screensaver.wid,
+ pScreen->root,
+ -RANDOM_WIDTH, -RANDOM_WIDTH,
+ (unsigned short) pScreen->width + RANDOM_WIDTH,
+ (unsigned short) pScreen->height + RANDOM_WIDTH,
+ 0, InputOutput, mask, attributes, 0, serverClient,
+ wVisual(pScreen->root), &result);
if (cursor)
- FreeResource (cursorID, RT_NONE);
+ FreeResource(cursorID, RT_NONE);
if (!pWin)
- return FALSE;
+ return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW,
- (pointer)pScreen->screensaver.pWindow))
- return FALSE;
+ (pointer) pScreen->screensaver.pWindow))
+ return FALSE;
- if (mask & CWBackPixmap)
- {
- MakeRootTile (pWin);
- (*pWin->drawable.pScreen->ChangeWindowAttributes)(pWin, CWBackPixmap);
+ if (mask & CWBackPixmap) {
+ MakeRootTile(pWin);
+ (*pWin->drawable.pScreen->ChangeWindowAttributes) (pWin, CWBackPixmap);
}
MapWindow(pWin, serverClient);
return TRUE;
@@ -3454,10 +3260,10 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
*/
WindowPtr
-FindWindowWithOptional (WindowPtr w)
+FindWindowWithOptional(WindowPtr w)
{
do
- w = w->parent;
+ w = w->parent;
while (!w->optional);
return w;
}
@@ -3471,41 +3277,40 @@ FindWindowWithOptional (WindowPtr w)
*/
void
-CheckWindowOptionalNeed (WindowPtr w)
+CheckWindowOptionalNeed(WindowPtr w)
{
WindowOptPtr optional;
WindowOptPtr parentOptional;
if (!w->parent || !w->optional)
- return;
+ return;
optional = w->optional;
if (optional->dontPropagateMask != DontPropagateMasks[w->dontPropagate])
- return;
+ return;
if (optional->otherEventMasks != 0)
- return;
+ return;
if (optional->otherClients != NULL)
- return;
+ return;
if (optional->passiveGrabs != NULL)
- return;
+ return;
if (optional->userProps != NULL)
- return;
+ return;
if (optional->backingBitPlanes != ~0L)
- return;
+ return;
if (optional->backingPixel != 0)
- return;
+ return;
if (optional->boundingShape != NULL)
- return;
+ return;
if (optional->clipShape != NULL)
- return;
+ return;
if (optional->inputShape != NULL)
- return;
+ return;
if (optional->inputMasks != NULL)
- return;
- if (optional->deviceCursors != NULL)
- {
+ return;
+ if (optional->deviceCursors != NULL) {
DevCursNodePtr pNode = optional->deviceCursors;
- while(pNode)
- {
+
+ while (pNode) {
if (pNode->cursor != None)
return;
pNode = pNode->next;
@@ -3514,14 +3319,13 @@ CheckWindowOptionalNeed (WindowPtr w)
parentOptional = FindWindowWithOptional(w)->optional;
if (optional->visual != parentOptional->visual)
- return;
+ return;
if (optional->cursor != None &&
- (optional->cursor != parentOptional->cursor ||
- w->parent->cursorIsNone))
- return;
+ (optional->cursor != parentOptional->cursor || w->parent->cursorIsNone))
+ return;
if (optional->colormap != parentOptional->colormap)
- return;
- DisposeWindowOptional (w);
+ return;
+ DisposeWindowOptional(w);
}
/*
@@ -3532,16 +3336,16 @@ CheckWindowOptionalNeed (WindowPtr w)
*/
Bool
-MakeWindowOptional (WindowPtr pWin)
+MakeWindowOptional(WindowPtr pWin)
{
WindowOptPtr optional;
WindowOptPtr parentOptional;
if (pWin->optional)
- return TRUE;
- optional = malloc(sizeof (WindowOptRec));
+ return TRUE;
+ optional = malloc(sizeof(WindowOptRec));
if (!optional)
- return FALSE;
+ return FALSE;
optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate];
optional->otherEventMasks = 0;
optional->otherClients = NULL;
@@ -3557,14 +3361,12 @@ MakeWindowOptional (WindowPtr pWin)
parentOptional = FindWindowWithOptional(pWin)->optional;
optional->visual = parentOptional->visual;
- if (!pWin->cursorIsNone)
- {
- optional->cursor = parentOptional->cursor;
- optional->cursor->refcnt++;
+ if (!pWin->cursorIsNone) {
+ optional->cursor = parentOptional->cursor;
+ optional->cursor->refcnt++;
}
- else
- {
- optional->cursor = None;
+ else {
+ optional->cursor = None;
}
optional->colormap = parentOptional->colormap;
pWin->optional = optional;
@@ -3586,9 +3388,7 @@ MakeWindowOptional (WindowPtr pWin)
* cursor. If the cursor is set to None, it is inherited by the parent.
*/
int
-ChangeWindowDeviceCursor(WindowPtr pWin,
- DeviceIntPtr pDev,
- CursorPtr pCursor)
+ChangeWindowDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev, CursorPtr pCursor)
{
DevCursNodePtr pNode, pPrev;
CursorPtr pOldCursor = NULL;
@@ -3613,8 +3413,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin,
pScreen = pWin->drawable.pScreen;
- if (WindowSeekDeviceCursor(pWin, pDev, &pNode, &pPrev))
- {
+ if (WindowSeekDeviceCursor(pWin, pDev, &pNode, &pPrev)) {
/* has device cursor */
if (pNode->cursor == pCursor)
@@ -3622,20 +3421,19 @@ ChangeWindowDeviceCursor(WindowPtr pWin,
pOldCursor = pNode->cursor;
- if (!pCursor) /* remove from list */
- {
- if(pPrev)
- pPrev->next = pNode->next;
- else
- /* first item in list */
- pWin->optional->deviceCursors = pNode->next;
+ if (!pCursor) { /* remove from list */
+ if (pPrev)
+ pPrev->next = pNode->next;
+ else
+ /* first item in list */
+ pWin->optional->deviceCursors = pNode->next;
free(pNode);
goto out;
}
- } else
- {
+ }
+ else {
/* no device cursor yet */
DevCursNodePtr pNewNode;
@@ -3652,40 +3450,36 @@ ChangeWindowDeviceCursor(WindowPtr pWin,
if (pCursor && WindowParentHasDeviceCursor(pWin, pDev, pCursor))
pNode->cursor = None;
- else
- {
+ else {
pNode->cursor = pCursor;
pCursor->refcnt++;
}
pNode = pPrev = NULL;
/* fix up children */
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- if (WindowSeekDeviceCursor(pChild, pDev, &pNode, &pPrev))
- {
- if (pNode->cursor == None) /* inherited from parent */
- {
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
+ if (WindowSeekDeviceCursor(pChild, pDev, &pNode, &pPrev)) {
+ if (pNode->cursor == None) { /* inherited from parent */
pNode->cursor = pOldCursor;
pOldCursor->refcnt++;
- } else if (pNode->cursor == pCursor)
- {
+ }
+ else if (pNode->cursor == pCursor) {
pNode->cursor = None;
- FreeCursor(pCursor, (Cursor)0); /* fix up refcnt */
+ FreeCursor(pCursor, (Cursor) 0); /* fix up refcnt */
}
}
}
-out:
+ out:
if (pWin->realized)
WindowHasNewCursor(pWin);
if (pOldCursor)
- FreeCursor(pOldCursor, (Cursor)0);
+ FreeCursor(pOldCursor, (Cursor) 0);
/* FIXME: We SHOULD check for an error value here XXX
(comment taken from ChangeWindowAttributes) */
- (*pScreen->ChangeWindowAttributes)(pWin, CWCursor);
+ (*pScreen->ChangeWindowAttributes) (pWin, CWCursor);
return Success;
}
@@ -3701,11 +3495,9 @@ WindowGetDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev)
pList = pWin->optional->deviceCursors;
- while(pList)
- {
- if (pList->dev == pDev)
- {
- if (pList->cursor == None) /* inherited from parent */
+ while (pList) {
+ if (pList->dev == pDev) {
+ if (pList->cursor == None) /* inherited from parent */
return WindowGetDeviceCursor(pWin->parent, pDev);
else
return pList->cursor;
@@ -3720,11 +3512,10 @@ WindowGetDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev)
* before the node respectively. Otherwise return False.
* If the device is the first in list, pPrev is set to NULL.
*/
-static Bool
-WindowSeekDeviceCursor(WindowPtr pWin,
- DeviceIntPtr pDev,
- DevCursNodePtr* pNode,
- DevCursNodePtr* pPrev)
+static Bool
+WindowSeekDeviceCursor(WindowPtr pWin,
+ DeviceIntPtr pDev,
+ DevCursNodePtr * pNode, DevCursNodePtr * pPrev)
{
DevCursorList pList;
@@ -3733,19 +3524,15 @@ WindowSeekDeviceCursor(WindowPtr pWin,
pList = pWin->optional->deviceCursors;
- if (pList && pList->dev == pDev)
- {
+ if (pList && pList->dev == pDev) {
*pNode = pList;
*pPrev = NULL;
return TRUE;
}
- while(pList)
- {
- if (pList->next)
- {
- if (pList->next->dev == pDev)
- {
+ while (pList) {
+ if (pList->next) {
+ if (pList->next->dev == pDev) {
*pNode = pList->next;
*pPrev = pList;
return TRUE;
@@ -3758,30 +3545,26 @@ WindowSeekDeviceCursor(WindowPtr pWin,
/* Return True if a parent has the same device cursor set or False if
* otherwise
- */
-static Bool
-WindowParentHasDeviceCursor(WindowPtr pWin,
- DeviceIntPtr pDev,
- CursorPtr pCursor)
+ */
+static Bool
+WindowParentHasDeviceCursor(WindowPtr pWin,
+ DeviceIntPtr pDev, CursorPtr pCursor)
{
WindowPtr pParent;
DevCursNodePtr pParentNode, pParentPrev;
pParent = pWin->parent;
- while(pParent)
- {
- if (WindowSeekDeviceCursor(pParent, pDev,
- &pParentNode, &pParentPrev))
- {
+ while (pParent) {
+ if (WindowSeekDeviceCursor(pParent, pDev, &pParentNode, &pParentPrev)) {
/* if there is a node in the list, the win has a dev cursor */
- if (!pParentNode->cursor) /* inherited. */
+ if (!pParentNode->cursor) /* inherited. */
pParent = pParent->parent;
- else if (pParentNode->cursor == pCursor) /* inherit */
+ else if (pParentNode->cursor == pCursor) /* inherit */
return TRUE;
- else /* different cursor */
+ else /* different cursor */
return FALSE;
- }
- else
+ }
+ else
/* parent does not have a device cursor for our device */
return FALSE;
}
@@ -3797,39 +3580,34 @@ WindowParentHasDeviceCursor(WindowPtr pWin,
void
SetRootClip(ScreenPtr pScreen, Bool enable)
{
- WindowPtr pWin = pScreen->root;
- WindowPtr pChild;
- Bool WasViewable;
- Bool anyMarked = FALSE;
- WindowPtr pLayerWin;
- BoxRec box;
+ WindowPtr pWin = pScreen->root;
+ WindowPtr pChild;
+ Bool WasViewable;
+ Bool anyMarked = FALSE;
+ WindowPtr pLayerWin;
+ BoxRec box;
if (!pWin)
- return;
- WasViewable = (Bool)(pWin->viewable);
- if (WasViewable)
- {
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- (void) (*pScreen->MarkOverlappedWindows)(pChild,
- pChild,
- &pLayerWin);
- }
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- if (pWin->valdata)
- {
- if (HasBorder (pWin))
- {
- RegionPtr borderVisible;
-
- borderVisible = RegionCreate(NullBox, 1);
- RegionSubtract(borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- }
- pWin->valdata->before.resized = TRUE;
- }
+ return;
+ WasViewable = (Bool) (pWin->viewable);
+ if (WasViewable) {
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
+ (void) (*pScreen->MarkOverlappedWindows) (pChild,
+ pChild, &pLayerWin);
+ }
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ if (pWin->valdata) {
+ if (HasBorder(pWin)) {
+ RegionPtr borderVisible;
+
+ borderVisible = RegionCreate(NullBox, 1);
+ RegionSubtract(borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ pWin->valdata->before.resized = TRUE;
+ }
}
/*
@@ -3837,55 +3615,48 @@ SetRootClip(ScreenPtr pScreen, Bool enable)
* that assume the root borderClip can't change well, normally
* it doesn't...)
*/
- if (enable)
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- RegionInit(&pWin->winSize, &box, 1);
- RegionInit(&pWin->borderSize, &box, 1);
- if (WasViewable)
- RegionReset(&pWin->borderClip, &box);
- pWin->drawable.width = pScreen->width;
- pWin->drawable.height = pScreen->height;
- RegionBreak(&pWin->clipList);
+ if (enable) {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ RegionInit(&pWin->winSize, &box, 1);
+ RegionInit(&pWin->borderSize, &box, 1);
+ if (WasViewable)
+ RegionReset(&pWin->borderClip, &box);
+ pWin->drawable.width = pScreen->width;
+ pWin->drawable.height = pScreen->height;
+ RegionBreak(&pWin->clipList);
}
- else
- {
- RegionEmpty(&pWin->borderClip);
- RegionBreak(&pWin->clipList);
+ else {
+ RegionEmpty(&pWin->borderClip);
+ RegionBreak(&pWin->clipList);
}
- ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- if (pWin->firstChild)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
- pWin->firstChild,
- (WindowPtr *)NULL);
- }
- else
- {
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- }
+ ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
+ if (WasViewable) {
+ if (pWin->firstChild) {
+ anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin->firstChild,
+ pWin->firstChild,
+ (WindowPtr *) NULL);
+ }
+ else {
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ }
- if (anyMarked)
- (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
+ if (anyMarked)
+ (*pScreen->ValidateTree) (pWin, NullWindow, VTOther);
}
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pWin);
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
+ if (WasViewable) {
+ if (anyMarked)
+ (*pScreen->HandleExposures) (pWin);
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pWin, NullWindow, VTOther);
}
if (pWin->realized)
- WindowsRestructured ();
+ WindowsRestructured();
FlushAllOutput();
}
diff --git a/xorg-server/doc/dtrace/Xserver-DTrace.xml b/xorg-server/doc/dtrace/Xserver-DTrace.xml
index 5ef062980..91ca254d7 100644
--- a/xorg-server/doc/dtrace/Xserver-DTrace.xml
+++ b/xorg-server/doc/dtrace/Xserver-DTrace.xml
@@ -52,7 +52,9 @@ DEALINGS IN THE SOFTWARE.
facility in <productname>Solaris</productname> 10,
<productname>MacOS X</productname> 10.5, and later releases. This
provider instruments various points in the X server, to allow
- tracing what client applications are up to.
+ tracing what client applications are up to. DTrace probes may be used
+ with <ulink url="http://sourceware.org/systemtap/">SystemTap</ulink>
+ on GNU/Linux systems.
</para>
<para>
@@ -81,7 +83,7 @@ DEALINGS IN THE SOFTWARE.
<table id="Probes_and_their_arguments">
<title>Probes and their arguments</title>
- <tgroup cols='7'>
+ <tgroup cols='9'>
<colspec colname="probe" colwidth="2*"/>
<colspec colname="desc" colwidth="3*"/>
<colspec colname="arg0" colwidth="1*"/>
@@ -89,6 +91,8 @@ DEALINGS IN THE SOFTWARE.
<colspec colname="arg2" colwidth="1*"/>
<colspec colname="arg3" colwidth="1*"/>
<colspec colname="arg4" colwidth="1*"/>
+ <colspec colname="arg5" colwidth="1*"/>
+ <colspec colname="arg6" colwidth="1*"/>
<spanspec spanname="all" namest="probe" nameend="arg4"/>
<thead>
<row>
@@ -99,6 +103,8 @@ DEALINGS IN THE SOFTWARE.
<entry>arg2</entry>
<entry>arg3</entry>
<entry>arg4</entry>
+ <entry>arg5</entry>
+ <entry>arg6</entry>
</row>
</thead>
<tbody>
@@ -113,6 +119,8 @@ DEALINGS IN THE SOFTWARE.
<entry><parameter>requestLength</parameter></entry>
<entry><parameter>clientId</parameter></entry>
<entry><parameter>requestBuffer</parameter></entry>
+ <entry nameend="arg5" class="unused"/>
+ <entry nameend="arg6" class="unused"/>
</row>
<row>
<entry>request-done</entry>
@@ -122,6 +130,8 @@ DEALINGS IN THE SOFTWARE.
<entry><parameter>sequenceNumber</parameter></entry>
<entry><parameter>clientId</parameter></entry>
<entry><parameter>resultCode</parameter></entry>
+ <entry nameend="arg5" class="unused"/>
+ <entry nameend="arg6" class="unused"/>
</row>
<row>
<entry spanname="all" class="grouphead">Event Probes</entry>
@@ -132,7 +142,10 @@ DEALINGS IN THE SOFTWARE.
<entry><parameter>clientId</parameter></entry>
<entry><parameter>eventCode</parameter></entry>
<entry><parameter>eventBuffer</parameter></entry>
+ <entry nameend="arg3" class="unused"/>
<entry nameend="arg4" class="unused"/>
+ <entry nameend="arg5" class="unused"/>
+ <entry nameend="arg6" class="unused"/>
</row>
<row>
<entry spanname="all" class="grouphead">Client Connection Probes</entry>
@@ -142,7 +155,11 @@ DEALINGS IN THE SOFTWARE.
<entry>Called when a new connection is opened from a client</entry>
<entry><parameter>clientId</parameter></entry>
<entry><parameter>clientFD</parameter></entry>
+ <entry nameend="arg2" class="unused"/>
+ <entry nameend="arg3" class="unused"/>
<entry nameend="arg4" class="unused"/>
+ <entry nameend="arg5" class="unused"/>
+ <entry nameend="arg6" class="unused"/>
</row>
<row>
<entry>client-auth</entry>
@@ -152,12 +169,19 @@ DEALINGS IN THE SOFTWARE.
<entry><parameter>clientPid</parameter></entry>
<entry><parameter>clientZoneId</parameter></entry>
<entry nameend="arg4" class="unused"/>
+ <entry nameend="arg5" class="unused"/>
+ <entry nameend="arg6" class="unused"/>
</row>
<row>
<entry>client-disconnect</entry>
<entry>Called when a client connection is closed</entry>
<entry><parameter>clientId</parameter></entry>
+ <entry nameend="arg1" class="unused"/>
+ <entry nameend="arg2" class="unused"/>
+ <entry nameend="arg3" class="unused"/>
<entry nameend="arg4" class="unused"/>
+ <entry nameend="arg5" class="unused"/>
+ <entry nameend="arg6" class="unused"/>
</row>
<row>
<entry spanname="all" class="grouphead">Resource Allocation Probes</entry>
@@ -170,6 +194,8 @@ DEALINGS IN THE SOFTWARE.
<entry><parameter>resourceValue</parameter></entry>
<entry><parameter>resourceTypeName</parameter></entry>
<entry nameend="arg4" class="unused"/>
+ <entry nameend="arg5" class="unused"/>
+ <entry nameend="arg6" class="unused"/>
</row>
<row>
<entry>resource-free</entry>
@@ -179,6 +205,24 @@ DEALINGS IN THE SOFTWARE.
<entry><parameter>resourceValue</parameter></entry>
<entry><parameter>resourceTypeName</parameter></entry>
<entry nameend="arg4" class="unused"/>
+ <entry nameend="arg5" class="unused"/>
+ <entry nameend="arg6" class="unused"/>
+ </row>
+ <row>
+ <entry spanname="all" class="grouphead">Input API probes</entry>
+ </row>
+ <row>
+ <entry>input-event</entry>
+ <entry>Called when an input event was submitted for processing</entry>
+ <entry><parameter>deviceid</parameter></entry>
+ <entry><parameter>eventtype</parameter></entry>
+ <entry><parameter>button</parameter> or
+ <parameter>keycode</parameter> or
+ <parameter>touchid</parameter></entry>
+ <entry><parameter>flags</parameter></entry>
+ <entry><parameter>nvalues</parameter></entry>
+ <entry><parameter>mask</parameter></entry>
+ <entry><parameter>values</parameter></entry>
</row>
</tbody>
</tgroup>
@@ -304,6 +348,44 @@ DEALINGS IN THE SOFTWARE.
<entry><type>uint32_t</type></entry>
<entry>Number of X request in in this connection</entry>
</row>
+ <row>
+ <entry><parameter>deviceid</parameter></entry>
+ <entry><type>int</type></entry>
+ <entry>The device's numerical ID</entry>
+ </row>
+ <row>
+ <entry><parameter>eventtype</parameter></entry>
+ <entry><type>int</type></entry>
+ <entry>Protocol event type</entry>
+ </row>
+ <row>
+ <entry><parameter>button, keycode, touchid</parameter></entry>
+ <entry><type>uint32_t</type></entry>
+ <entry>The button number, keycode or touch ID</entry>
+ </row>
+ <row>
+ <entry><parameter>flags</parameter></entry>
+ <entry><type>uint32_t</type></entry>
+ <entry>Miscellaneous event-specific server flags</entry>
+ </row>
+ <row>
+ <entry><parameter>nvalues</parameter></entry>
+ <entry><type>int8_t</type></entry>
+ <entry>Number of bits in <parameter>mask</parameter> and number of elements
+ in <parameter>values</parameter></entry>
+ </row>
+ <row>
+ <entry><parameter>mask</parameter></entry>
+ <entry><type>uint8_t*</type></entry>
+ <entry>Binary mask indicating which indices in <parameter>values</parameter> contain
+ valid data</entry>
+ </row>
+ <row>
+ <entry><parameter>values</parameter></entry>
+ <entry><type>double*</type></entry>
+ <entry>Valuator values. Values for indices for which the
+ <parameter>mask</parameter> is not set are undefined</entry>
+ </row>
</tbody>
</tgroup>
</table>
@@ -572,6 +654,73 @@ Xserver$1:::client-disconnect
</example>
+ <example id="Input_API_monitoring_with_systemtap">
+ <title>Input API monitoring with SystemTap</title>
+
+ <para>
+ This script can be used to monitor events submitted by drivers to
+ the server for enqueuing. Due to the integration of the input API
+ probes, some server-enqueued events will show up too.
+ <programlisting>
+ # Compile+run with
+ # stap -g xorg.stp /usr/bin/Xorg
+ #
+
+
+ function print_valuators:string(nvaluators:long, mask_in:long, valuators_in:long) %{
+ int i;
+ unsigned char *mask = (unsigned char*)THIS->mask_in;
+ double *valuators = (double*)THIS->valuators_in;
+ char str[128] = {0};
+ char *s = str;
+
+ #define BitIsSet(ptr, bit) (((unsigned char*)(ptr))[(bit)>>3] &amp; (1 &lt;&lt; ((bit) &amp; 7)))
+
+ s += sprintf(s, "nval: %d ::", (int)THIS->nvaluators);
+ for (i = 0; i &lt; THIS->nvaluators; i++)
+ {
+ s += sprintf(s, " %d: ", i);
+ if (BitIsSet(mask, i))
+ s += sprintf(s, "%d", (int)valuators[i]);
+ }
+
+ sprintf(THIS->__retvalue, "%s", str);
+ %}
+
+ probe process(@1).mark("input__event")
+ {
+ deviceid = $arg1
+ type = $arg2
+ detail = $arg3
+ flags = $arg4
+ nvaluators = $arg5
+
+ str = print_valuators(nvaluators, $arg6, $arg7)
+ printf("Event: device %d type %d detail %d flags %#x %s\n",
+ deviceid, type, detail, flags, str);
+ }
+ </programlisting>
+
+ Sample output from a run of this script:
+ <screen><computeroutput>
+Event: device 13 type 4 detail 1 flags 0x0 nval: 0 ::
+Event: device 13 type 6 detail 0 flags 0xa nval: 1 :: 0: 1
+Event: device 13 type 6 detail 0 flags 0xa nval: 2 :: 0: 2 1: -1
+Event: device 13 type 6 detail 0 flags 0xa nval: 2 :: 0: 2 1: -1
+Event: device 13 type 6 detail 0 flags 0xa nval: 2 :: 0: 4 1: -3
+Event: device 13 type 6 detail 0 flags 0xa nval: 2 :: 0: 3 1: -3
+Event: device 13 type 6 detail 0 flags 0xa nval: 2 :: 0: 3 1: -2
+Event: device 13 type 6 detail 0 flags 0xa nval: 2 :: 0: 2 1: -2
+Event: device 13 type 6 detail 0 flags 0xa nval: 2 :: 0: 2 1: -2
+Event: device 13 type 6 detail 0 flags 0xa nval: 2 :: 0: 2 1: -2
+Event: device 13 type 6 detail 0 flags 0xa nval: 2 :: 0: 1: -1
+Event: device 13 type 6 detail 0 flags 0xa nval: 2 :: 0: 1: -1
+Event: device 13 type 5 detail 1 flags 0x0 nval: 0 ::
+ </computeroutput></screen>
+
+ </para>
+
+ </example>
</sect1>
diff --git a/xorg-server/exa/exa.c b/xorg-server/exa/exa.c
index 4ce983bc3..754c8305a 100644
--- a/xorg-server/exa/exa.c
+++ b/xorg-server/exa/exa.c
@@ -58,10 +58,10 @@ static ShmFuncs exaShmFuncs = { NULL, NULL };
unsigned long
exaGetPixmapOffset(PixmapPtr pPix)
{
- ExaScreenPriv (pPix->drawable.pScreen);
- ExaPixmapPriv (pPix);
+ ExaScreenPriv(pPix->drawable.pScreen);
+ ExaPixmapPriv(pPix);
- return (CARD8 *)pExaPixmap->fb_ptr - pExaScr->info->memoryBase;
+ return (CARD8 *) pExaPixmap->fb_ptr - pExaScr->info->memoryBase;
}
void *
@@ -95,7 +95,7 @@ exaGetPixmapSize(PixmapPtr pPix)
pExaPixmap = ExaGetPixmapPriv(pPix);
if (pExaPixmap != NULL)
- return pExaPixmap->fb_size;
+ return pExaPixmap->fb_size;
return 0;
}
@@ -113,10 +113,10 @@ exaGetPixmapSize(PixmapPtr pPix)
PixmapPtr
exaGetDrawablePixmap(DrawablePtr pDrawable)
{
- if (pDrawable->type == DRAWABLE_WINDOW)
- return pDrawable->pScreen->GetWindowPixmap ((WindowPtr) pDrawable);
- else
- return (PixmapPtr) pDrawable;
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ return pDrawable->pScreen->GetWindowPixmap((WindowPtr) pDrawable);
+ else
+ return (PixmapPtr) pDrawable;
}
/**
@@ -125,14 +125,13 @@ exaGetDrawablePixmap(DrawablePtr pDrawable)
* windows.
*/
void
-exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
- int *xp, int *yp)
+exaGetDrawableDeltas(DrawablePtr pDrawable, PixmapPtr pPixmap, int *xp, int *yp)
{
#ifdef COMPOSITE
if (pDrawable->type == DRAWABLE_WINDOW) {
- *xp = -pPixmap->screen_x;
- *yp = -pPixmap->screen_y;
- return;
+ *xp = -pPixmap->screen_x;
+ *yp = -pPixmap->screen_y;
+ return;
}
#endif
@@ -145,7 +144,7 @@ exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
* optimizations in pixmap migration when no changes have occurred.
*/
void
-exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2)
+exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2)
{
BoxRec box;
RegionRec region;
@@ -156,7 +155,7 @@ exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2)
box.y2 = min(y2, pPix->drawable.height);
if (box.x1 >= box.x2 || box.y1 >= box.y2)
- return;
+ return;
RegionInit(&region, &box, 1);
DamageDamageRegion(&pPix->drawable, &region);
@@ -169,9 +168,9 @@ exaLog2(int val)
int bits;
if (val <= 0)
- return 0;
+ return 0;
for (bits = 0; val != 0; bits++)
- val >>= 1;
+ val >>= 1;
return bits - 1;
}
@@ -218,12 +217,12 @@ exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
* some X Server internal component (the score says it's pinned).
*/
Bool
-exaPixmapIsPinned (PixmapPtr pPix)
+exaPixmapIsPinned(PixmapPtr pPix)
{
- ExaPixmapPriv (pPix);
+ ExaPixmapPriv(pPix);
if (pExaPixmap == NULL)
- EXA_FatalErrorDebugWithRet(("EXA bug: exaPixmapIsPinned was called on a non-exa pixmap.\n"), TRUE);
+ EXA_FatalErrorDebugWithRet(("EXA bug: exaPixmapIsPinned was called on a non-exa pixmap.\n"), TRUE);
return pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED;
}
@@ -243,22 +242,23 @@ exaPixmapIsPinned (PixmapPtr pPix)
Bool
exaPixmapHasGpuCopy(PixmapPtr pPixmap)
{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
ExaScreenPriv(pScreen);
if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
- return FALSE;
+ return FALSE;
- return (*pExaScr->pixmap_has_gpu_copy)(pPixmap);
+ return (*pExaScr->pixmap_has_gpu_copy) (pPixmap);
}
/**
* exaDrawableIsOffscreen() is a convenience wrapper for exaPixmapHasGpuCopy().
*/
Bool
-exaDrawableIsOffscreen (DrawablePtr pDrawable)
+exaDrawableIsOffscreen(DrawablePtr pDrawable)
{
- return exaPixmapHasGpuCopy (exaGetDrawablePixmap (pDrawable));
+ return exaPixmapHasGpuCopy(exaGetDrawablePixmap(pDrawable));
}
/**
@@ -266,16 +266,16 @@ exaDrawableIsOffscreen (DrawablePtr pDrawable)
* coordinates to make them address the same bits in the backing drawable.
*/
PixmapPtr
-exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
+exaGetOffscreenPixmap(DrawablePtr pDrawable, int *xp, int *yp)
{
- PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
+ PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
- exaGetDrawableDeltas (pDrawable, pPixmap, xp, yp);
+ exaGetDrawableDeltas(pDrawable, pPixmap, xp, yp);
- if (exaPixmapHasGpuCopy (pPixmap))
- return pPixmap;
+ if (exaPixmapHasGpuCopy(pPixmap))
+ return pPixmap;
else
- return NULL;
+ return NULL;
}
/**
@@ -285,46 +285,47 @@ Bool
ExaDoPrepareAccess(PixmapPtr pPixmap, int index)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
- ExaScreenPriv (pScreen);
+
+ ExaScreenPriv(pScreen);
ExaPixmapPriv(pPixmap);
Bool has_gpu_copy, ret;
int i;
if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
- return FALSE;
+ return FALSE;
if (pExaPixmap == NULL)
- EXA_FatalErrorDebugWithRet(("EXA bug: ExaDoPrepareAccess was called on a non-exa pixmap.\n"), FALSE);
+ EXA_FatalErrorDebugWithRet(("EXA bug: ExaDoPrepareAccess was called on a non-exa pixmap.\n"), FALSE);
/* Handle repeated / nested calls. */
for (i = 0; i < EXA_NUM_PREPARE_INDICES; i++) {
- if (pExaScr->access[i].pixmap == pPixmap) {
- pExaScr->access[i].count++;
- return pExaScr->access[i].retval;
- }
+ if (pExaScr->access[i].pixmap == pPixmap) {
+ pExaScr->access[i].count++;
+ return pExaScr->access[i].retval;
+ }
}
/* If slot for this index is taken, find an empty slot */
if (pExaScr->access[index].pixmap) {
- for (index = EXA_NUM_PREPARE_INDICES - 1; index >= 0; index--)
- if (!pExaScr->access[index].pixmap)
- break;
+ for (index = EXA_NUM_PREPARE_INDICES - 1; index >= 0; index--)
+ if (!pExaScr->access[index].pixmap)
+ break;
}
/* Access to this pixmap hasn't been prepared yet, so data pointer should be NULL. */
if (pPixmap->devPrivate.ptr != NULL) {
- EXA_FatalErrorDebug(("EXA bug: pPixmap->devPrivate.ptr was %p, but should have been NULL.\n",
- pPixmap->devPrivate.ptr));
+ EXA_FatalErrorDebug(("EXA bug: pPixmap->devPrivate.ptr was %p, but should have been NULL.\n", pPixmap->devPrivate.ptr));
}
has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
if (has_gpu_copy && pExaPixmap->fb_ptr) {
- pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr;
- ret = TRUE;
- } else {
- pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
- ret = FALSE;
+ pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr;
+ ret = TRUE;
+ }
+ else {
+ pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
+ ret = FALSE;
}
/* Store so we can handle repeated / nested calls. */
@@ -332,34 +333,34 @@ ExaDoPrepareAccess(PixmapPtr pPixmap, int index)
pExaScr->access[index].count = 1;
if (!has_gpu_copy)
- goto out;
+ goto out;
- exaWaitSync (pScreen);
+ exaWaitSync(pScreen);
if (pExaScr->info->PrepareAccess == NULL)
- goto out;
+ goto out;
if (index >= EXA_PREPARE_AUX_DEST &&
- !(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
- if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
- FatalError("Unsupported AUX indices used on a pinned pixmap.\n");
- exaMoveOutPixmap (pPixmap);
- ret = FALSE;
- goto out;
+ !(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
+ if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
+ FatalError("Unsupported AUX indices used on a pinned pixmap.\n");
+ exaMoveOutPixmap(pPixmap);
+ ret = FALSE;
+ goto out;
}
if (!(*pExaScr->info->PrepareAccess) (pPixmap, index)) {
- if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED &&
- !(pExaScr->info->flags & EXA_MIXED_PIXMAPS))
- FatalError("Driver failed PrepareAccess on a pinned pixmap.\n");
- exaMoveOutPixmap (pPixmap);
- ret = FALSE;
- goto out;
+ if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED &&
+ !(pExaScr->info->flags & EXA_MIXED_PIXMAPS))
+ FatalError("Driver failed PrepareAccess on a pinned pixmap.\n");
+ exaMoveOutPixmap(pPixmap);
+ ret = FALSE;
+ goto out;
}
ret = TRUE;
-out:
+ out:
pExaScr->access[index].retval = ret;
return ret;
}
@@ -374,12 +375,13 @@ void
exaPrepareAccess(DrawablePtr pDrawable, int index)
{
PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
+
ExaScreenPriv(pDrawable->pScreen);
if (pExaScr->prepare_access_reg)
- pExaScr->prepare_access_reg(pPixmap, index, NULL);
+ pExaScr->prepare_access_reg(pPixmap, index, NULL);
else
- (void)ExaDoPrepareAccess(pPixmap, index);
+ (void) ExaDoPrepareAccess(pPixmap, index);
}
/**
@@ -390,31 +392,32 @@ exaPrepareAccess(DrawablePtr pDrawable, int index)
void
exaFinishAccess(DrawablePtr pDrawable, int index)
{
- ScreenPtr pScreen = pDrawable->pScreen;
- ExaScreenPriv (pScreen);
- PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
- ExaPixmapPriv (pPixmap);
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ ExaScreenPriv(pScreen);
+ PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
+
+ ExaPixmapPriv(pPixmap);
int i;
if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
- return;
+ return;
if (pExaPixmap == NULL)
- EXA_FatalErrorDebugWithRet(("EXA bug: exaFinishAccesss was called on a non-exa pixmap.\n"),);
+ EXA_FatalErrorDebugWithRet(("EXA bug: exaFinishAccesss was called on a non-exa pixmap.\n"),);
/* Handle repeated / nested calls. */
for (i = 0; i < EXA_NUM_PREPARE_INDICES; i++) {
- if (pExaScr->access[i].pixmap == pPixmap) {
- if (--pExaScr->access[i].count > 0)
- return;
- break;
- }
+ if (pExaScr->access[i].pixmap == pPixmap) {
+ if (--pExaScr->access[i].count > 0)
+ return;
+ break;
+ }
}
/* Catch unbalanced Prepare/FinishAccess calls. */
if (i == EXA_NUM_PREPARE_INDICES)
- EXA_FatalErrorDebugWithRet(("EXA bug: FinishAccess called without PrepareAccess for pixmap 0x%p.\n",
- pPixmap),);
+ EXA_FatalErrorDebugWithRet(("EXA bug: FinishAccess called without PrepareAccess for pixmap 0x%p.\n", pPixmap),);
pExaScr->access[i].pixmap = NULL;
@@ -423,19 +426,18 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
/* Only call FinishAccess if PrepareAccess was called and succeeded. */
if (!pExaScr->info->FinishAccess || !pExaScr->access[i].retval)
- return;
+ return;
if (i >= EXA_PREPARE_AUX_DEST &&
- !(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
- ErrorF("EXA bug: Trying to call driver FinishAccess hook with "
- "unsupported index EXA_PREPARE_AUX*\n");
- return;
+ !(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
+ ErrorF("EXA bug: Trying to call driver FinishAccess hook with "
+ "unsupported index EXA_PREPARE_AUX*\n");
+ return;
}
(*pExaScr->info->FinishAccess) (pPixmap, i);
}
-
/**
* Helper for things common to all schemes when a pixmap is destroyed
*/
@@ -449,51 +451,42 @@ exaDestroyPixmap(PixmapPtr pPixmap)
* software fallback)
*/
for (i = 0; i < EXA_NUM_PREPARE_INDICES; i++) {
- if (pExaScr->access[i].pixmap == pPixmap) {
- exaFinishAccess(&pPixmap->drawable, i);
- pExaScr->access[i].pixmap = NULL;
- break;
- }
+ if (pExaScr->access[i].pixmap == pPixmap) {
+ exaFinishAccess(&pPixmap->drawable, i);
+ pExaScr->access[i].pixmap = NULL;
+ break;
+ }
}
}
-
/**
* Here begins EXA's GC code.
* Do not ever access the fb/mi layer directly.
*/
static void
-exaValidateGC(GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable);
+ exaValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
static void
-exaDestroyGC(GCPtr pGC);
+ exaDestroyGC(GCPtr pGC);
static void
-exaChangeGC (GCPtr pGC,
- unsigned long mask);
+ exaChangeGC(GCPtr pGC, unsigned long mask);
static void
-exaCopyGC (GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst);
+ exaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
static void
-exaChangeClip (GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects);
+ exaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
static void
-exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
+ exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
static void
-exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
+ exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
static void
-exaDestroyClip(GCPtr pGC);
+ exaDestroyClip(GCPtr pGC);
const GCFuncs exaGCFuncs = {
exaValidateGC,
@@ -506,15 +499,14 @@ const GCFuncs exaGCFuncs = {
};
static void
-exaValidateGC(GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable)
+exaValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
/* fbValidateGC will do direct access to pixmaps if the tiling has changed.
* Do a few smart things so fbValidateGC can do it's work.
*/
ScreenPtr pScreen = pDrawable->pScreen;
+
ExaScreenPriv(pScreen);
ExaGCPriv(pGC);
PixmapPtr pTile = NULL;
@@ -522,41 +514,45 @@ exaValidateGC(GCPtr pGC,
/* Either of these conditions is enough to trigger access to a tile pixmap. */
/* With pGC->tileIsPixel == 1, you run the risk of dereferencing an invalid tile pixmap pointer. */
- if (pGC->fillStyle == FillTiled || ((changes & GCTile) && !pGC->tileIsPixel)) {
- pTile = pGC->tile.pixmap;
-
- /* Sometimes tile pixmaps are swapped, you need access to:
- * - The current tile if it depth matches.
- * - Or the rotated tile if that one matches depth and !(changes & GCTile).
- * - Or the current tile pixmap and a newly created one.
- */
- if (pTile && pTile->drawable.depth != pDrawable->depth && !(changes & GCTile)) {
- PixmapPtr pRotatedTile = fbGetRotatedPixmap(pGC);
- if (pRotatedTile && pRotatedTile->drawable.depth == pDrawable->depth)
- pTile = pRotatedTile;
- else
- finish_current_tile = TRUE; /* CreatePixmap will be called. */
- }
+ if (pGC->fillStyle == FillTiled ||
+ ((changes & GCTile) && !pGC->tileIsPixel)) {
+ pTile = pGC->tile.pixmap;
+
+ /* Sometimes tile pixmaps are swapped, you need access to:
+ * - The current tile if it depth matches.
+ * - Or the rotated tile if that one matches depth and !(changes & GCTile).
+ * - Or the current tile pixmap and a newly created one.
+ */
+ if (pTile && pTile->drawable.depth != pDrawable->depth &&
+ !(changes & GCTile)) {
+ PixmapPtr pRotatedTile = fbGetRotatedPixmap(pGC);
+
+ if (pRotatedTile &&
+ pRotatedTile->drawable.depth == pDrawable->depth)
+ pTile = pRotatedTile;
+ else
+ finish_current_tile = TRUE; /* CreatePixmap will be called. */
+ }
}
if (pGC->stipple)
exaPrepareAccess(&pGC->stipple->drawable, EXA_PREPARE_MASK);
if (pTile)
- exaPrepareAccess(&pTile->drawable, EXA_PREPARE_SRC);
+ exaPrepareAccess(&pTile->drawable, EXA_PREPARE_SRC);
/* Calls to Create/DestroyPixmap have to be identified as special. */
pExaScr->fallback_counter++;
swap(pExaGC, pGC, funcs);
- (*pGC->funcs->ValidateGC)(pGC, changes, pDrawable);
+ (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);
swap(pExaGC, pGC, funcs);
pExaScr->fallback_counter--;
if (pTile)
- exaFinishAccess(&pTile->drawable, EXA_PREPARE_SRC);
+ exaFinishAccess(&pTile->drawable, EXA_PREPARE_SRC);
if (finish_current_tile && pGC->tile.pixmap)
- exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_AUX_DEST);
+ exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_AUX_DEST);
if (pGC->stipple)
- exaFinishAccess(&pGC->stipple->drawable, EXA_PREPARE_MASK);
+ exaFinishAccess(&pGC->stipple->drawable, EXA_PREPARE_MASK);
}
/* Is exaPrepareAccessGC() needed? */
@@ -565,13 +561,12 @@ exaDestroyGC(GCPtr pGC)
{
ExaGCPriv(pGC);
swap(pExaGC, pGC, funcs);
- (*pGC->funcs->DestroyGC)(pGC);
+ (*pGC->funcs->DestroyGC) (pGC);
swap(pExaGC, pGC, funcs);
}
static void
-exaChangeGC (GCPtr pGC,
- unsigned long mask)
+exaChangeGC(GCPtr pGC, unsigned long mask)
{
ExaGCPriv(pGC);
swap(pExaGC, pGC, funcs);
@@ -580,9 +575,7 @@ exaChangeGC (GCPtr pGC,
}
static void
-exaCopyGC (GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst)
+exaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
{
ExaGCPriv(pGCDst);
swap(pExaGC, pGCDst, funcs);
@@ -591,10 +584,7 @@ exaCopyGC (GCPtr pGCSrc,
}
static void
-exaChangeClip (GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects)
+exaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
{
ExaGCPriv(pGC);
swap(pExaGC, pGC, funcs);
@@ -607,7 +597,7 @@ exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
{
ExaGCPriv(pGCDst);
swap(pExaGC, pGCDst, funcs);
- (*pGCDst->funcs->CopyClip)(pGCDst, pGCSrc);
+ (*pGCDst->funcs->CopyClip) (pGCDst, pGCSrc);
swap(pExaGC, pGCDst, funcs);
}
@@ -616,7 +606,7 @@ exaDestroyClip(GCPtr pGC)
{
ExaGCPriv(pGC);
swap(pExaGC, pGC, funcs);
- (*pGC->funcs->DestroyClip)(pGC);
+ (*pGC->funcs->DestroyClip) (pGC);
swap(pExaGC, pGC, funcs);
}
@@ -625,17 +615,18 @@ exaDestroyClip(GCPtr pGC)
* exaValidateGC() will get called.
*/
static int
-exaCreateGC (GCPtr pGC)
+exaCreateGC(GCPtr pGC)
{
ScreenPtr pScreen = pGC->pScreen;
+
ExaScreenPriv(pScreen);
ExaGCPriv(pGC);
Bool ret;
swap(pExaScr, pScreen, CreateGC);
if ((ret = (*pScreen->CreateGC) (pGC))) {
- wrap(pExaGC, pGC, funcs, (GCFuncs *) &exaGCFuncs);
- wrap(pExaGC, pGC, ops, (GCOps *) &exaOps);
+ wrap(pExaGC, pGC, funcs, (GCFuncs *) & exaGCFuncs);
+ wrap(pExaGC, pGC, ops, (GCOps *) & exaOps);
}
swap(pExaScr, pScreen, CreateGC);
@@ -647,13 +638,14 @@ exaChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
Bool ret;
ScreenPtr pScreen = pWin->drawable.pScreen;
+
ExaScreenPriv(pScreen);
- if ((mask & CWBackPixmap) && pWin->backgroundState == BackgroundPixmap)
- exaPrepareAccess(&pWin->background.pixmap->drawable, EXA_PREPARE_SRC);
+ if ((mask & CWBackPixmap) && pWin->backgroundState == BackgroundPixmap)
+ exaPrepareAccess(&pWin->background.pixmap->drawable, EXA_PREPARE_SRC);
if ((mask & CWBorderPixmap) && pWin->borderIsPixel == FALSE)
- exaPrepareAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_MASK);
+ exaPrepareAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_MASK);
pExaScr->fallback_counter++;
swap(pExaScr, pScreen, ChangeWindowAttributes);
@@ -661,10 +653,10 @@ exaChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
swap(pExaScr, pScreen, ChangeWindowAttributes);
pExaScr->fallback_counter--;
- if ((mask & CWBackPixmap) && pWin->backgroundState == BackgroundPixmap)
- exaFinishAccess(&pWin->background.pixmap->drawable, EXA_PREPARE_SRC);
+ if ((mask & CWBackPixmap) && pWin->backgroundState == BackgroundPixmap)
+ exaFinishAccess(&pWin->background.pixmap->drawable, EXA_PREPARE_SRC);
if ((mask & CWBorderPixmap) && pWin->borderIsPixel == FALSE)
- exaFinishAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_MASK);
+ exaFinishAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_MASK);
return ret;
}
@@ -674,11 +666,12 @@ exaBitmapToRegion(PixmapPtr pPix)
{
RegionPtr ret;
ScreenPtr pScreen = pPix->drawable.pScreen;
+
ExaScreenPriv(pScreen);
exaPrepareAccess(&pPix->drawable, EXA_PREPARE_SRC);
swap(pExaScr, pScreen, BitmapToRegion);
- ret = (*pScreen->BitmapToRegion)(pPix);
+ ret = (*pScreen->BitmapToRegion) (pPix);
swap(pExaScr, pScreen, BitmapToRegion);
exaFinishAccess(&pPix->drawable, EXA_PREPARE_SRC);
@@ -715,14 +708,15 @@ exaCreateScreenResources(ScreenPtr pScreen)
static void
ExaBlockHandler(int screenNum, pointer blockData, pointer pTimeout,
- pointer pReadmask)
+ pointer pReadmask)
{
ScreenPtr pScreen = screenInfo.screens[screenNum];
+
ExaScreenPriv(pScreen);
/* Move any deferred results from a software fallback to the driver pixmap */
if (pExaScr->deferred_mixed_pixmap)
- exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
+ exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
unwrap(pExaScr, pScreen, BlockHandler);
(*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
@@ -730,25 +724,26 @@ ExaBlockHandler(int screenNum, pointer blockData, pointer pTimeout,
/* The rest only applies to classic EXA */
if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS)
- return;
+ return;
/* Try and keep the offscreen memory area tidy every now and then (at most
* once per second) when the server has been idle for at least 100ms.
*/
if (pExaScr->numOffscreenAvailable > 1) {
- CARD32 now = GetTimeInMillis();
+ CARD32 now = GetTimeInMillis();
- pExaScr->nextDefragment = now +
- max(100, (INT32)(pExaScr->lastDefragment + 1000 - now));
- AdjustWaitForDelay(pTimeout, pExaScr->nextDefragment - now);
+ pExaScr->nextDefragment = now +
+ max(100, (INT32) (pExaScr->lastDefragment + 1000 - now));
+ AdjustWaitForDelay(pTimeout, pExaScr->nextDefragment - now);
}
}
static void
ExaWakeupHandler(int screenNum, pointer wakeupData, unsigned long result,
- pointer pReadmask)
+ pointer pReadmask)
{
ScreenPtr pScreen = screenInfo.screens[screenNum];
+
ExaScreenPriv(pScreen);
unwrap(pExaScr, pScreen, WakeupHandler);
@@ -756,12 +751,12 @@ ExaWakeupHandler(int screenNum, pointer wakeupData, unsigned long result,
wrap(pExaScr, pScreen, WakeupHandler, ExaWakeupHandler);
if (result == 0 && pExaScr->numOffscreenAvailable > 1) {
- CARD32 now = GetTimeInMillis();
+ CARD32 now = GetTimeInMillis();
- if ((int)(now - pExaScr->nextDefragment) > 0) {
- ExaOffscreenDefragment(pScreen);
- pExaScr->lastDefragment = now;
- }
+ if ((int) (now - pExaScr->nextDefragment) > 0) {
+ ExaOffscreenDefragment(pScreen);
+ pExaScr->lastDefragment = now;
+ }
}
}
@@ -773,32 +768,32 @@ static Bool
exaCloseScreen(int i, ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
if (ps->Glyphs == exaGlyphs)
- exaGlyphsFini(pScreen);
+ exaGlyphsFini(pScreen);
if (pScreen->BlockHandler == ExaBlockHandler)
- unwrap(pExaScr, pScreen, BlockHandler);
+ unwrap(pExaScr, pScreen, BlockHandler);
if (pScreen->WakeupHandler == ExaWakeupHandler)
- unwrap(pExaScr, pScreen, WakeupHandler);
+ unwrap(pExaScr, pScreen, WakeupHandler);
unwrap(pExaScr, pScreen, CreateGC);
unwrap(pExaScr, pScreen, CloseScreen);
unwrap(pExaScr, pScreen, GetImage);
unwrap(pExaScr, pScreen, GetSpans);
if (pExaScr->SavedCreatePixmap)
- unwrap(pExaScr, pScreen, CreatePixmap);
+ unwrap(pExaScr, pScreen, CreatePixmap);
if (pExaScr->SavedDestroyPixmap)
- unwrap(pExaScr, pScreen, DestroyPixmap);
+ unwrap(pExaScr, pScreen, DestroyPixmap);
if (pExaScr->SavedModifyPixmapHeader)
- unwrap(pExaScr, pScreen, ModifyPixmapHeader);
+ unwrap(pExaScr, pScreen, ModifyPixmapHeader);
unwrap(pExaScr, pScreen, CopyWindow);
unwrap(pExaScr, pScreen, ChangeWindowAttributes);
unwrap(pExaScr, pScreen, BitmapToRegion);
unwrap(pExaScr, pScreen, CreateScreenResources);
unwrap(pExaScr, ps, Composite);
if (pExaScr->SavedGlyphs)
- unwrap(pExaScr, ps, Glyphs);
+ unwrap(pExaScr, ps, Glyphs);
unwrap(pExaScr, ps, Trapezoids);
unwrap(pExaScr, ps, Triangles);
unwrap(pExaScr, ps, AddTraps);
@@ -835,62 +830,60 @@ exaDriverAlloc(void)
* @return TRUE if EXA was successfully initialized.
*/
Bool
-exaDriverInit (ScreenPtr pScreen,
- ExaDriverPtr pScreenInfo)
+exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
{
ExaScreenPrivPtr pExaScr;
PictureScreenPtr ps;
if (!pScreenInfo)
- return FALSE;
+ return FALSE;
if (pScreenInfo->exa_major != EXA_VERSION_MAJOR ||
- pScreenInfo->exa_minor > EXA_VERSION_MINOR)
- {
- LogMessage(X_ERROR, "EXA(%d): driver's EXA version requirements "
- "(%d.%d) are incompatible with EXA version (%d.%d)\n",
- pScreen->myNum,
- pScreenInfo->exa_major, pScreenInfo->exa_minor,
- EXA_VERSION_MAJOR, EXA_VERSION_MINOR);
- return FALSE;
+ pScreenInfo->exa_minor > EXA_VERSION_MINOR) {
+ LogMessage(X_ERROR, "EXA(%d): driver's EXA version requirements "
+ "(%d.%d) are incompatible with EXA version (%d.%d)\n",
+ pScreen->myNum,
+ pScreenInfo->exa_major, pScreenInfo->exa_minor,
+ EXA_VERSION_MAJOR, EXA_VERSION_MINOR);
+ return FALSE;
}
if (!pScreenInfo->CreatePixmap && !pScreenInfo->CreatePixmap2) {
- if (!pScreenInfo->memoryBase) {
- LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memoryBase "
- "must be non-zero\n", pScreen->myNum);
- return FALSE;
- }
-
- if (!pScreenInfo->memorySize) {
- LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memorySize must be "
- "non-zero\n", pScreen->myNum);
- return FALSE;
- }
-
- if (pScreenInfo->offScreenBase > pScreenInfo->memorySize) {
- LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::offScreenBase must "
- "be <= ExaDriverRec::memorySize\n", pScreen->myNum);
- return FALSE;
- }
+ if (!pScreenInfo->memoryBase) {
+ LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memoryBase "
+ "must be non-zero\n", pScreen->myNum);
+ return FALSE;
+ }
+
+ if (!pScreenInfo->memorySize) {
+ LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memorySize must be "
+ "non-zero\n", pScreen->myNum);
+ return FALSE;
+ }
+
+ if (pScreenInfo->offScreenBase > pScreenInfo->memorySize) {
+ LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::offScreenBase must "
+ "be <= ExaDriverRec::memorySize\n", pScreen->myNum);
+ return FALSE;
+ }
}
if (!pScreenInfo->PrepareSolid) {
- LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::PrepareSolid must be "
- "non-NULL\n", pScreen->myNum);
- return FALSE;
+ LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::PrepareSolid must be "
+ "non-NULL\n", pScreen->myNum);
+ return FALSE;
}
if (!pScreenInfo->PrepareCopy) {
- LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::PrepareCopy must be "
- "non-NULL\n", pScreen->myNum);
- return FALSE;
+ LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::PrepareCopy must be "
+ "non-NULL\n", pScreen->myNum);
+ return FALSE;
}
if (!pScreenInfo->WaitMarker) {
- LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::WaitMarker must be "
- "non-NULL\n", pScreen->myNum);
- return FALSE;
+ LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::WaitMarker must be "
+ "non-NULL\n", pScreen->myNum);
+ return FALSE;
}
/* If the driver doesn't set any max pitch values, we'll just assume
@@ -902,8 +895,7 @@ exaDriverInit (ScreenPtr pScreen,
* whether a pixmap is rejected because of its pitch or
* because of its width.
*/
- if (!pScreenInfo->maxPitchPixels && !pScreenInfo->maxPitchBytes)
- {
+ if (!pScreenInfo->maxPitchPixels && !pScreenInfo->maxPitchBytes) {
pScreenInfo->maxPitchPixels = pScreenInfo->maxX;
}
@@ -911,15 +903,15 @@ exaDriverInit (ScreenPtr pScreen,
if (!dixRegisterPrivateKey(&exaScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) {
LogMessage(X_WARNING, "EXA(%d): Failed to register screen private\n",
- pScreen->myNum);
- return FALSE;
+ pScreen->myNum);
+ return FALSE;
}
- pExaScr = calloc (sizeof (ExaScreenPrivRec), 1);
+ pExaScr = calloc(sizeof(ExaScreenPrivRec), 1);
if (!pExaScr) {
LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n",
- pScreen->myNum);
- return FALSE;
+ pScreen->myNum);
+ return FALSE;
}
pExaScr->info = pScreenInfo;
@@ -930,23 +922,23 @@ exaDriverInit (ScreenPtr pScreen,
exaDDXDriverInit(pScreen);
- if (!dixRegisterPrivateKey(&exaGCPrivateKeyRec, PRIVATE_GC, sizeof(ExaGCPrivRec))) {
- LogMessage(X_WARNING,
- "EXA(%d): Failed to allocate GC private\n",
- pScreen->myNum);
- return FALSE;
+ if (!dixRegisterPrivateKey
+ (&exaGCPrivateKeyRec, PRIVATE_GC, sizeof(ExaGCPrivRec))) {
+ LogMessage(X_WARNING, "EXA(%d): Failed to allocate GC private\n",
+ pScreen->myNum);
+ return FALSE;
}
/*
* Replace various fb screen functions
*/
if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) &&
- (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) ||
- (pExaScr->info->flags & EXA_MIXED_PIXMAPS)))
- wrap(pExaScr, pScreen, BlockHandler, ExaBlockHandler);
+ (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) ||
+ (pExaScr->info->flags & EXA_MIXED_PIXMAPS)))
+ wrap(pExaScr, pScreen, BlockHandler, ExaBlockHandler);
if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) &&
- !(pExaScr->info->flags & EXA_HANDLES_PIXMAPS))
- wrap(pExaScr, pScreen, WakeupHandler, ExaWakeupHandler);
+ !(pExaScr->info->flags & EXA_HANDLES_PIXMAPS))
+ wrap(pExaScr, pScreen, WakeupHandler, ExaWakeupHandler);
wrap(pExaScr, pScreen, CreateGC, exaCreateGC);
wrap(pExaScr, pScreen, CloseScreen, exaCloseScreen);
wrap(pExaScr, pScreen, GetImage, exaGetImage);
@@ -957,15 +949,16 @@ exaDriverInit (ScreenPtr pScreen,
wrap(pExaScr, pScreen, CreateScreenResources, exaCreateScreenResources);
if (ps) {
- wrap(pExaScr, ps, Composite, exaComposite);
- if (pScreenInfo->PrepareComposite) {
- wrap(pExaScr, ps, Glyphs, exaGlyphs);
- } else {
- wrap(pExaScr, ps, Glyphs, ExaCheckGlyphs);
- }
- wrap(pExaScr, ps, Trapezoids, exaTrapezoids);
- wrap(pExaScr, ps, Triangles, exaTriangles);
- wrap(pExaScr, ps, AddTraps, ExaCheckAddTraps);
+ wrap(pExaScr, ps, Composite, exaComposite);
+ if (pScreenInfo->PrepareComposite) {
+ wrap(pExaScr, ps, Glyphs, exaGlyphs);
+ }
+ else {
+ wrap(pExaScr, ps, Glyphs, ExaCheckGlyphs);
+ }
+ wrap(pExaScr, ps, Trapezoids, exaTrapezoids);
+ wrap(pExaScr, ps, Triangles, exaTriangles);
+ wrap(pExaScr, ps, AddTraps, ExaCheckAddTraps);
}
#ifdef MITSHM
@@ -977,86 +970,95 @@ exaDriverInit (ScreenPtr pScreen,
/*
* Hookup offscreen pixmaps
*/
- if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS)
- {
- if (!dixRegisterPrivateKey(&exaPixmapPrivateKeyRec, PRIVATE_PIXMAP, sizeof(ExaPixmapPrivRec))) {
+ if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) {
+ if (!dixRegisterPrivateKey
+ (&exaPixmapPrivateKeyRec, PRIVATE_PIXMAP,
+ sizeof(ExaPixmapPrivRec))) {
LogMessage(X_WARNING,
- "EXA(%d): Failed to allocate pixmap private\n",
- pScreen->myNum);
- return FALSE;
+ "EXA(%d): Failed to allocate pixmap private\n",
+ pScreen->myNum);
+ return FALSE;
+ }
+ if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS) {
+ if (pExaScr->info->flags & EXA_MIXED_PIXMAPS) {
+ wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_mixed);
+ wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_mixed);
+ wrap(pExaScr, pScreen, ModifyPixmapHeader,
+ exaModifyPixmapHeader_mixed);
+ pExaScr->do_migration = exaDoMigration_mixed;
+ pExaScr->pixmap_has_gpu_copy = exaPixmapHasGpuCopy_mixed;
+ pExaScr->do_move_in_pixmap = exaMoveInPixmap_mixed;
+ pExaScr->do_move_out_pixmap = NULL;
+ pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed;
+ }
+ else {
+ wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver);
+ wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_driver);
+ wrap(pExaScr, pScreen, ModifyPixmapHeader,
+ exaModifyPixmapHeader_driver);
+ pExaScr->do_migration = NULL;
+ pExaScr->pixmap_has_gpu_copy = exaPixmapHasGpuCopy_driver;
+ pExaScr->do_move_in_pixmap = NULL;
+ pExaScr->do_move_out_pixmap = NULL;
+ pExaScr->prepare_access_reg = NULL;
+ }
+ }
+ else {
+ wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic);
+ wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_classic);
+ wrap(pExaScr, pScreen, ModifyPixmapHeader,
+ exaModifyPixmapHeader_classic);
+ pExaScr->do_migration = exaDoMigration_classic;
+ pExaScr->pixmap_has_gpu_copy = exaPixmapHasGpuCopy_classic;
+ pExaScr->do_move_in_pixmap = exaMoveInPixmap_classic;
+ pExaScr->do_move_out_pixmap = exaMoveOutPixmap_classic;
+ pExaScr->prepare_access_reg = exaPrepareAccessReg_classic;
+ }
+ if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
+ LogMessage(X_INFO, "EXA(%d): Offscreen pixmap area of %lu bytes\n",
+ pScreen->myNum,
+ pExaScr->info->memorySize -
+ pExaScr->info->offScreenBase);
+ }
+ else {
+ LogMessage(X_INFO, "EXA(%d): Driver allocated offscreen pixmaps\n",
+ pScreen->myNum);
+
}
- if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS) {
- if (pExaScr->info->flags & EXA_MIXED_PIXMAPS) {
- wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_mixed);
- wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_mixed);
- wrap(pExaScr, pScreen, ModifyPixmapHeader, exaModifyPixmapHeader_mixed);
- pExaScr->do_migration = exaDoMigration_mixed;
- pExaScr->pixmap_has_gpu_copy = exaPixmapHasGpuCopy_mixed;
- pExaScr->do_move_in_pixmap = exaMoveInPixmap_mixed;
- pExaScr->do_move_out_pixmap = NULL;
- pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed;
- } else {
- wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver);
- wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_driver);
- wrap(pExaScr, pScreen, ModifyPixmapHeader, exaModifyPixmapHeader_driver);
- pExaScr->do_migration = NULL;
- pExaScr->pixmap_has_gpu_copy = exaPixmapHasGpuCopy_driver;
- pExaScr->do_move_in_pixmap = NULL;
- pExaScr->do_move_out_pixmap = NULL;
- pExaScr->prepare_access_reg = NULL;
- }
- } else {
- wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic);
- wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_classic);
- wrap(pExaScr, pScreen, ModifyPixmapHeader, exaModifyPixmapHeader_classic);
- pExaScr->do_migration = exaDoMigration_classic;
- pExaScr->pixmap_has_gpu_copy = exaPixmapHasGpuCopy_classic;
- pExaScr->do_move_in_pixmap = exaMoveInPixmap_classic;
- pExaScr->do_move_out_pixmap = exaMoveOutPixmap_classic;
- pExaScr->prepare_access_reg = exaPrepareAccessReg_classic;
- }
- if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
- LogMessage(X_INFO, "EXA(%d): Offscreen pixmap area of %lu bytes\n",
- pScreen->myNum,
- pExaScr->info->memorySize - pExaScr->info->offScreenBase);
- } else {
- LogMessage(X_INFO, "EXA(%d): Driver allocated offscreen pixmaps\n",
- pScreen->myNum);
-
- }
}
else
LogMessage(X_INFO, "EXA(%d): No offscreen pixmaps\n", pScreen->myNum);
if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
- DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->offScreenBase,
- pExaScr->info->memorySize));
- if (pExaScr->info->offScreenBase < pExaScr->info->memorySize) {
- if (!exaOffscreenInit (pScreen)) {
- LogMessage(X_WARNING, "EXA(%d): Offscreen pixmap setup failed\n",
- pScreen->myNum);
- return FALSE;
- }
- }
+ DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->offScreenBase,
+ pExaScr->info->memorySize));
+ if (pExaScr->info->offScreenBase < pExaScr->info->memorySize) {
+ if (!exaOffscreenInit(pScreen)) {
+ LogMessage(X_WARNING,
+ "EXA(%d): Offscreen pixmap setup failed\n",
+ pScreen->myNum);
+ return FALSE;
+ }
+ }
}
if (ps->Glyphs == exaGlyphs)
- exaGlyphsInit(pScreen);
+ exaGlyphsInit(pScreen);
LogMessage(X_INFO, "EXA(%d): Driver registered support for the following"
- " operations:\n", pScreen->myNum);
+ " operations:\n", pScreen->myNum);
assert(pScreenInfo->PrepareSolid != NULL);
LogMessage(X_INFO, " Solid\n");
assert(pScreenInfo->PrepareCopy != NULL);
LogMessage(X_INFO, " Copy\n");
if (pScreenInfo->PrepareComposite != NULL) {
- LogMessage(X_INFO, " Composite (RENDER acceleration)\n");
+ LogMessage(X_INFO, " Composite (RENDER acceleration)\n");
}
if (pScreenInfo->UploadToScreen != NULL) {
- LogMessage(X_INFO, " UploadToScreen\n");
+ LogMessage(X_INFO, " UploadToScreen\n");
}
if (pScreenInfo->DownloadFromScreen != NULL) {
- LogMessage(X_INFO, " DownloadFromScreen\n");
+ LogMessage(X_INFO, " DownloadFromScreen\n");
}
return TRUE;
@@ -1068,9 +1070,9 @@ exaDriverInit (ScreenPtr pScreen,
* @param pScreen screen being torn down.
*/
void
-exaDriverFini (ScreenPtr pScreen)
+exaDriverFini(ScreenPtr pScreen)
{
- /*right now does nothing*/
+ /*right now does nothing */
}
/**
@@ -1084,13 +1086,14 @@ exaDriverFini (ScreenPtr pScreen)
* driver MarkSync() callback, the return value of which may be used to do partial
* synchronization with the hardware in the future.
*/
-void exaMarkSync(ScreenPtr pScreen)
+void
+exaMarkSync(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
pExaScr->info->needsSync = TRUE;
if (pExaScr->info->MarkSync != NULL) {
- pExaScr->info->lastMarker = (*pExaScr->info->MarkSync)(pScreen);
+ pExaScr->info->lastMarker = (*pExaScr->info->MarkSync) (pScreen);
}
}
@@ -1103,12 +1106,13 @@ void exaMarkSync(ScreenPtr pScreen)
* It should always be called before relying on the framebuffer contents
* reflecting previous drawing, from a CPU perspective.
*/
-void exaWaitSync(ScreenPtr pScreen)
+void
+exaWaitSync(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
if (pExaScr->info->needsSync && !pExaScr->swappedOut) {
- (*pExaScr->info->WaitMarker)(pScreen, pExaScr->info->lastMarker);
+ (*pExaScr->info->WaitMarker) (pScreen, pExaScr->info->lastMarker);
pExaScr->info->needsSync = FALSE;
}
}
@@ -1119,40 +1123,43 @@ void exaWaitSync(ScreenPtr pScreen)
* config file.
*/
void
-exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
+exaDoMigration(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
{
ScreenPtr pScreen = pixmaps[0].pPix->drawable.pScreen;
+
ExaScreenPriv(pScreen);
if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
- return;
+ return;
if (pExaScr->do_migration)
- (*pExaScr->do_migration)(pixmaps, npixmaps, can_accel);
+ (*pExaScr->do_migration) (pixmaps, npixmaps, can_accel);
}
void
-exaMoveInPixmap (PixmapPtr pPixmap)
+exaMoveInPixmap(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
ExaScreenPriv(pScreen);
if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
- return;
+ return;
if (pExaScr->do_move_in_pixmap)
- (*pExaScr->do_move_in_pixmap)(pPixmap);
+ (*pExaScr->do_move_in_pixmap) (pPixmap);
}
void
-exaMoveOutPixmap (PixmapPtr pPixmap)
+exaMoveOutPixmap(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
ExaScreenPriv(pScreen);
if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
- return;
+ return;
if (pExaScr->do_move_out_pixmap)
- (*pExaScr->do_move_out_pixmap)(pPixmap);
+ (*pExaScr->do_move_out_pixmap) (pPixmap);
}
diff --git a/xorg-server/exa/exa.h b/xorg-server/exa/exa.h
index 3109607d8..75340021e 100644
--- a/xorg-server/exa/exa.h
+++ b/xorg-server/exa/exa.h
@@ -1,843 +1,816 @@
-/*
- *
- * Copyright (C) 2000 Keith Packard
- * 2004 Eric Anholt
- * 2005 Zack Rusin
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of copyright holders not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Copyright holders make no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-/** @file
- * This is the header containing the public API of EXA for exa drivers.
- */
-
-#ifndef EXA_H
-#define EXA_H
-
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "gcstruct.h"
-#include "picturestr.h"
-#include "fb.h"
-
-#define EXA_VERSION_MAJOR 2
-#define EXA_VERSION_MINOR 5
-#define EXA_VERSION_RELEASE 0
-
-typedef struct _ExaOffscreenArea ExaOffscreenArea;
-
-typedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen, ExaOffscreenArea *area);
-
-typedef enum _ExaOffscreenState {
- ExaOffscreenAvail,
- ExaOffscreenRemovable,
- ExaOffscreenLocked
-} ExaOffscreenState;
-
-struct _ExaOffscreenArea {
- int base_offset; /* allocation base */
- int offset; /* aligned offset */
- int size; /* total allocation size */
- unsigned last_use;
- pointer privData;
-
- ExaOffscreenSaveProc save;
-
- ExaOffscreenState state;
-
- ExaOffscreenArea *next;
-
- unsigned eviction_cost;
-
- ExaOffscreenArea *prev; /* Double-linked list for defragmentation */
- int align; /* required alignment */
-};
-
-/**
- * The ExaDriver structure is allocated through exaDriverAlloc(), and then
- * fllled in by drivers.
- */
-typedef struct _ExaDriver {
- /**
- * exa_major and exa_minor should be set by the driver to the version of
- * EXA which the driver was compiled for (or configures itself at runtime
- * to support). This allows EXA to extend the structure for new features
- * without breaking ABI for drivers compiled against older versions.
- */
- int exa_major, exa_minor;
-
- /**
- * memoryBase is the address of the beginning of framebuffer memory.
- * The visible screen should be within memoryBase to memoryBase +
- * memorySize.
- */
- CARD8 *memoryBase;
-
- /**
- * offScreenBase is the offset from memoryBase of the beginning of the area
- * to be managed by EXA's linear offscreen memory manager.
- *
- * In XFree86 DDX drivers, this is probably:
- * (pScrn->displayWidth * cpp * pScrn->virtualY)
- */
- unsigned long offScreenBase;
-
- /**
- * memorySize is the length (in bytes) of framebuffer memory beginning
- * from memoryBase.
- *
- * The offscreen memory manager will manage the area beginning at
- * (memoryBase + offScreenBase), with a length of (memorySize -
- * offScreenBase)
- *
- * In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024)
- */
- unsigned long memorySize;
-
- /**
- * pixmapOffsetAlign is the byte alignment necessary for pixmap offsets
- * within framebuffer.
- *
- * Hardware typically has a required alignment of offsets, which may or may
- * not be a power of two. EXA will ensure that pixmaps managed by the
- * offscreen memory manager meet this alignment requirement.
- */
- int pixmapOffsetAlign;
-
- /**
- * pixmapPitchAlign is the byte alignment necessary for pixmap pitches
- * within the framebuffer.
- *
- * Hardware typically has a required alignment of pitches for acceleration.
- * For 3D hardware, Composite acceleration often requires that source and
- * mask pixmaps (textures) have a power-of-two pitch, which can be demanded
- * using EXA_OFFSCREEN_ALIGN_POT. These pitch requirements only apply to
- * pixmaps managed by the offscreen memory manager. Thus, it is up to the
- * driver to ensure that the visible screen has an appropriate pitch for
- * acceleration.
- */
- int pixmapPitchAlign;
-
- /**
- * The flags field is bitfield of boolean values controlling EXA's behavior.
- *
- * The flags in clude EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and
- * EXA_TWO_BITBLT_DIRECTIONS.
- */
- int flags;
-
- /** @{ */
- /**
- * maxX controls the X coordinate limitation for rendering from the card.
- * The driver should never receive a request for rendering beyond maxX
- * in the X direction from the origin of a pixmap.
- */
- int maxX;
-
- /**
- * maxY controls the Y coordinate limitation for rendering from the card.
- * The driver should never receive a request for rendering beyond maxY
- * in the Y direction from the origin of a pixmap.
- */
- int maxY;
- /** @} */
-
- /* private */
- ExaOffscreenArea *offScreenAreas;
- Bool needsSync;
- int lastMarker;
-
- /** @name Solid
- * @{
- */
- /**
- * PrepareSolid() sets up the driver for doing a solid fill.
- * @param pPixmap Destination pixmap
- * @param alu raster operation
- * @param planemask write mask for the fill
- * @param fg "foreground" color for the fill
- *
- * This call should set up the driver for doing a series of solid fills
- * through the Solid() call. The alu raster op is one of the GX*
- * graphics functions listed in X.h, and typically maps to a similar
- * single-byte "ROP" setting in all hardware. The planemask controls
- * which bits of the destination should be affected, and will only represent
- * the bits up to the depth of pPixmap. The fg is the pixel value of the
- * foreground color referred to in ROP descriptions.
- *
- * Note that many drivers will need to store some of the data in the driver
- * private record, for sending to the hardware with each drawing command.
- *
- * The PrepareSolid() call is required of all drivers, but it may fail for any
- * reason. Failure results in a fallback to software rendering.
- */
- Bool (*PrepareSolid) (PixmapPtr pPixmap,
- int alu,
- Pixel planemask,
- Pixel fg);
-
- /**
- * Solid() performs a solid fill set up in the last PrepareSolid() call.
- *
- * @param pPixmap destination pixmap
- * @param x1 left coordinate
- * @param y1 top coordinate
- * @param x2 right coordinate
- * @param y2 bottom coordinate
- *
- * Performs the fill set up by the last PrepareSolid() call, covering the
- * area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are
- * in the coordinate space of the destination pixmap, so the driver will
- * need to set up the hardware's offset and pitch for the destination
- * coordinates according to the pixmap's offset and pitch within
- * framebuffer. This likely means using exaGetPixmapOffset() and
- * exaGetPixmapPitch().
- *
- * This call is required if PrepareSolid() ever succeeds.
- */
- void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
-
- /**
- * DoneSolid() finishes a set of solid fills.
- *
- * @param pPixmap destination pixmap.
- *
- * The DoneSolid() call is called at the end of a series of consecutive
- * Solid() calls following a successful PrepareSolid(). This allows drivers
- * to finish up emitting drawing commands that were buffered, or clean up
- * state from PrepareSolid().
- *
- * This call is required if PrepareSolid() ever succeeds.
- */
- void (*DoneSolid) (PixmapPtr pPixmap);
- /** @} */
-
- /** @name Copy
- * @{
- */
- /**
- * PrepareCopy() sets up the driver for doing a copy within video
- * memory.
- *
- * @param pSrcPixmap source pixmap
- * @param pDstPixmap destination pixmap
- * @param dx X copy direction
- * @param dy Y copy direction
- * @param alu raster operation
- * @param planemask write mask for the fill
- *
- * This call should set up the driver for doing a series of copies from the
- * the pSrcPixmap to the pDstPixmap. The dx flag will be positive if the
- * hardware should do the copy from the left to the right, and dy will be
- * positive if the copy should be done from the top to the bottom. This
- * is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
- * If your hardware can only support blits that are (left to right, top to
- * bottom) or (right to left, bottom to top), then you should set
- * #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to
- * ones that meet those requirements. The alu raster op is one of the GX*
- * graphics functions listed in X.h, and typically maps to a similar
- * single-byte "ROP" setting in all hardware. The planemask controls which
- * bits of the destination should be affected, and will only represent the
- * bits up to the depth of pPixmap.
- *
- * Note that many drivers will need to store some of the data in the driver
- * private record, for sending to the hardware with each drawing command.
- *
- * The PrepareCopy() call is required of all drivers, but it may fail for any
- * reason. Failure results in a fallback to software rendering.
- */
- Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
- PixmapPtr pDstPixmap,
- int dx,
- int dy,
- int alu,
- Pixel planemask);
-
- /**
- * Copy() performs a copy set up in the last PrepareCopy call.
- *
- * @param pDstPixmap destination pixmap
- * @param srcX source X coordinate
- * @param srcY source Y coordinate
- * @param dstX destination X coordinate
- * @param dstY destination Y coordinate
- * @param width width of the rectangle to be copied
- * @param height height of the rectangle to be copied.
- *
- * Performs the copy set up by the last PrepareCopy() call, copying the
- * rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
- * pixmap to the same-sized rectangle at (dstX, dstY) in the destination
- * pixmap. Those rectangles may overlap in memory, if
- * pSrcPixmap == pDstPixmap. Note that this call does not receive the
- * pSrcPixmap as an argument -- if it's needed in this function, it should
- * be stored in the driver private during PrepareCopy(). As with Solid(),
- * the coordinates are in the coordinate space of each pixmap, so the driver
- * will need to set up source and destination pitches and offsets from those
- * pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch().
- *
- * This call is required if PrepareCopy ever succeeds.
- */
- void (*Copy) (PixmapPtr pDstPixmap,
- int srcX,
- int srcY,
- int dstX,
- int dstY,
- int width,
- int height);
-
- /**
- * DoneCopy() finishes a set of copies.
- *
- * @param pPixmap destination pixmap.
- *
- * The DoneCopy() call is called at the end of a series of consecutive
- * Copy() calls following a successful PrepareCopy(). This allows drivers
- * to finish up emitting drawing commands that were buffered, or clean up
- * state from PrepareCopy().
- *
- * This call is required if PrepareCopy() ever succeeds.
- */
- void (*DoneCopy) (PixmapPtr pDstPixmap);
- /** @} */
-
- /** @name Composite
- * @{
- */
- /**
- * CheckComposite() checks to see if a composite operation could be
- * accelerated.
- *
- * @param op Render operation
- * @param pSrcPicture source Picture
- * @param pMaskPicture mask picture
- * @param pDstPicture destination Picture
- *
- * The CheckComposite() call checks if the driver could handle acceleration
- * of op with the given source, mask, and destination pictures. This allows
- * drivers to check source and destination formats, supported operations,
- * transformations, and component alpha state, and send operations it can't
- * support to software rendering early on. This avoids costly pixmap
- * migration to the wrong places when the driver can't accelerate
- * operations. Note that because migration hasn't happened, the driver
- * can't know during CheckComposite() what the offsets and pitches of the
- * pixmaps are going to be.
- *
- * See PrepareComposite() for more details on likely issues that drivers
- * will have in accelerating Composite operations.
- *
- * The CheckComposite() call is recommended if PrepareComposite() is
- * implemented, but is not required.
- */
- Bool (*CheckComposite) (int op,
- PicturePtr pSrcPicture,
- PicturePtr pMaskPicture,
- PicturePtr pDstPicture);
-
- /**
- * PrepareComposite() sets up the driver for doing a Composite operation
- * described in the Render extension protocol spec.
- *
- * @param op Render operation
- * @param pSrcPicture source Picture
- * @param pMaskPicture mask picture
- * @param pDstPicture destination Picture
- * @param pSrc source pixmap
- * @param pMask mask pixmap
- * @param pDst destination pixmap
- *
- * This call should set up the driver for doing a series of Composite
- * operations, as described in the Render protocol spec, with the given
- * pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and
- * pDst are the pixmaps containing the pixel data, and should be used for
- * setting the offset and pitch used for the coordinate spaces for each of
- * the Pictures.
- *
- * Notes on interpreting Picture structures:
- * - The Picture structures will always have a valid pDrawable.
- * - The Picture structures will never have alphaMap set.
- * - The mask Picture (and therefore pMask) may be NULL, in which case the
- * operation is simply src OP dst instead of src IN mask OP dst, and
- * mask coordinates should be ignored.
- * - pMarkPicture may have componentAlpha set, which greatly changes
- * the behavior of the Composite operation. componentAlpha has no effect
- * when set on pSrcPicture or pDstPicture.
- * - The source and mask Pictures may have a transformation set
- * (Picture->transform != NULL), which means that the source coordinates
- * should be transformed by that transformation, resulting in scaling,
- * rotation, etc. The PictureTransformPoint() call can transform
- * coordinates for you. Transforms have no effect on Pictures when used
- * as a destination.
- * - The source and mask pictures may have a filter set. PictFilterNearest
- * and PictFilterBilinear are defined in the Render protocol, but others
- * may be encountered, and must be handled correctly (usually by
- * PrepareComposite failing, and falling back to software). Filters have
- * no effect on Pictures when used as a destination.
- * - The source and mask Pictures may have repeating set, which must be
- * respected. Many chipsets will be unable to support repeating on
- * pixmaps that have a width or height that is not a power of two.
- *
- * If your hardware can't support source pictures (textures) with
- * non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT.
- *
- * Note that many drivers will need to store some of the data in the driver
- * private record, for sending to the hardware with each drawing command.
- *
- * The PrepareComposite() call is not required. However, it is highly
- * recommended for performance of antialiased font rendering and performance
- * of cairo applications. Failure results in a fallback to software
- * rendering.
- */
- Bool (*PrepareComposite) (int op,
- PicturePtr pSrcPicture,
- PicturePtr pMaskPicture,
- PicturePtr pDstPicture,
- PixmapPtr pSrc,
- PixmapPtr pMask,
- PixmapPtr pDst);
-
- /**
- * Composite() performs a Composite operation set up in the last
- * PrepareComposite() call.
- *
- * @param pDstPixmap destination pixmap
- * @param srcX source X coordinate
- * @param srcY source Y coordinate
- * @param maskX source X coordinate
- * @param maskY source Y coordinate
- * @param dstX destination X coordinate
- * @param dstY destination Y coordinate
- * @param width destination rectangle width
- * @param height destination rectangle height
- *
- * Performs the Composite operation set up by the last PrepareComposite()
- * call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
- * in the destination Pixmap. Note that if a transformation was set on
- * the source or mask Pictures, the source rectangles may not be the same
- * size as the destination rectangles and filtering. Getting the coordinate
- * transformation right at the subpixel level can be tricky, and rendercheck
- * can test this for you.
- *
- * This call is required if PrepareComposite() ever succeeds.
- */
- void (*Composite) (PixmapPtr pDst,
- int srcX,
- int srcY,
- int maskX,
- int maskY,
- int dstX,
- int dstY,
- int width,
- int height);
-
- /**
- * DoneComposite() finishes a set of Composite operations.
- *
- * @param pPixmap destination pixmap.
- *
- * The DoneComposite() call is called at the end of a series of consecutive
- * Composite() calls following a successful PrepareComposite(). This allows
- * drivers to finish up emitting drawing commands that were buffered, or
- * clean up state from PrepareComposite().
- *
- * This call is required if PrepareComposite() ever succeeds.
- */
- void (*DoneComposite) (PixmapPtr pDst);
- /** @} */
-
- /**
- * UploadToScreen() loads a rectangle of data from src into pDst.
- *
- * @param pDst destination pixmap
- * @param x destination X coordinate.
- * @param y destination Y coordinate
- * @param width width of the rectangle to be copied
- * @param height height of the rectangle to be copied
- * @param src pointer to the beginning of the source data
- * @param src_pitch pitch (in bytes) of the lines of source data.
- *
- * UploadToScreen() copies data in system memory beginning at src (with
- * pitch src_pitch) into the destination pixmap from (x, y) to
- * (x + width, y + height). This is typically done with hostdata uploads,
- * where the CPU sets up a blit command on the hardware with instructions
- * that the blit data will be fed through some sort of aperture on the card.
- *
- * If UploadToScreen() is performed asynchronously, it is up to the driver
- * to call exaMarkSync(). This is in contrast to most other acceleration
- * calls in EXA.
- *
- * UploadToScreen() can aid in pixmap migration, but is most important for
- * the performance of exaGlyphs() (antialiased font drawing) by allowing
- * pipelining of data uploads, avoiding a sync of the card after each glyph.
- *
- * @return TRUE if the driver successfully uploaded the data. FALSE
- * indicates that EXA should fall back to doing the upload in software.
- *
- * UploadToScreen() is not required, but is recommended if Composite
- * acceleration is supported.
- */
- Bool (*UploadToScreen) (PixmapPtr pDst,
- int x,
- int y,
- int w,
- int h,
- char *src,
- int src_pitch);
-
- /**
- * UploadToScratch() is no longer used and will be removed next time the EXA
- * major version needs to be bumped.
- */
- Bool (*UploadToScratch) (PixmapPtr pSrc,
- PixmapPtr pDst);
-
- /**
- * DownloadFromScreen() loads a rectangle of data from pSrc into dst
- *
- * @param pSrc source pixmap
- * @param x source X coordinate.
- * @param y source Y coordinate
- * @param width width of the rectangle to be copied
- * @param height height of the rectangle to be copied
- * @param dst pointer to the beginning of the destination data
- * @param dst_pitch pitch (in bytes) of the lines of destination data.
- *
- * DownloadFromScreen() copies data from offscreen memory in pSrc from
- * (x, y) to (x + width, y + height), to system memory starting at
- * dst (with pitch dst_pitch). This would usually be done
- * using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
- * and then synchronously reading from AGP. Because the implementation
- * might be synchronous, EXA leaves it up to the driver to call
- * exaMarkSync() if DownloadFromScreen() was asynchronous. This is in
- * contrast to most other acceleration calls in EXA.
- *
- * DownloadFromScreen() can aid in the largest bottleneck in pixmap
- * migration, which is the read from framebuffer when evicting pixmaps from
- * framebuffer memory. Thus, it is highly recommended, even though
- * implementations are typically complicated.
- *
- * @return TRUE if the driver successfully downloaded the data. FALSE
- * indicates that EXA should fall back to doing the download in software.
- *
- * DownloadFromScreen() is not required, but is highly recommended.
- */
- Bool (*DownloadFromScreen)(PixmapPtr pSrc,
- int x, int y,
- int w, int h,
- char *dst, int dst_pitch);
-
- /**
- * MarkSync() requests that the driver mark a synchronization point,
- * returning an driver-defined integer marker which could be requested for
- * synchronization to later in WaitMarker(). This might be used in the
- * future to avoid waiting for full hardware stalls before accessing pixmap
- * data with the CPU, but is not important in the current incarnation of
- * EXA.
- *
- * Note that drivers should call exaMarkSync() when they have done some
- * acceleration, rather than their own MarkSync() handler, as otherwise EXA
- * will be unaware of the driver's acceleration and not sync to it during
- * fallbacks.
- *
- * MarkSync() is optional.
- */
- int (*MarkSync) (ScreenPtr pScreen);
-
- /**
- * WaitMarker() waits for all rendering before the given marker to have
- * completed. If the driver does not implement MarkSync(), marker is
- * meaningless, and all rendering by the hardware should be completed before
- * WaitMarker() returns.
- *
- * Note that drivers should call exaWaitSync() to wait for all acceleration
- * to finish, as otherwise EXA will be unaware of the driver having
- * synchronized, resulting in excessive WaitMarker() calls.
- *
- * WaitMarker() is required of all drivers.
- */
- void (*WaitMarker) (ScreenPtr pScreen, int marker);
-
- /** @{ */
- /**
- * PrepareAccess() is called before CPU access to an offscreen pixmap.
- *
- * @param pPix the pixmap being accessed
- * @param index the index of the pixmap being accessed.
- *
- * PrepareAccess() will be called before CPU access to an offscreen pixmap.
- * This can be used to set up hardware surfaces for byteswapping or
- * untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
- * making CPU access use a different aperture.
- *
- * The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC,
- * #EXA_PREPARE_MASK, #EXA_PREPARE_AUX_DEST, #EXA_PREPARE_AUX_SRC, or
- * #EXA_PREPARE_AUX_MASK. Since only up to #EXA_NUM_PREPARE_INDICES pixmaps
- * will have PrepareAccess() called on them per operation, drivers can have
- * a small, statically-allocated space to maintain state for PrepareAccess()
- * and FinishAccess() in. Note that PrepareAccess() is only called once per
- * pixmap and operation, regardless of whether the pixmap is used as a
- * destination and/or source, and the index may not reflect the usage.
- *
- * PrepareAccess() may fail. An example might be the case of hardware that
- * can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess()
- * fails, EXA will migrate the pixmap to system memory.
- * DownloadFromScreen() must be implemented and must not fail if a driver
- * wishes to fail in PrepareAccess(). PrepareAccess() must not fail when
- * pPix is the visible screen, because the visible screen can not be
- * migrated.
- *
- * @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
- * drawing.
- * @return FALSE if PrepareAccess() is unsuccessful and EXA should use
- * DownloadFromScreen() to migate the pixmap out.
- */
- Bool (*PrepareAccess)(PixmapPtr pPix, int index);
-
- /**
- * FinishAccess() is called after CPU access to an offscreen pixmap.
- *
- * @param pPix the pixmap being accessed
- * @param index the index of the pixmap being accessed.
- *
- * FinishAccess() will be called after finishing CPU access of an offscreen
- * pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be
- * called if PrepareAccess() failed and the pixmap was migrated out.
- */
- void (*FinishAccess)(PixmapPtr pPix, int index);
-
- /**
- * PixmapIsOffscreen() is an optional driver replacement to
- * exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour
- * of exaPixmapHasGpuCopy().
- *
- * @param pPix the pixmap
- * @return TRUE if the given drawable is in framebuffer memory.
- *
- * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen
- * memory, meaning that acceleration could probably be done to it, and that it
- * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
- * with the CPU.
- *
- *
- */
- Bool (*PixmapIsOffscreen)(PixmapPtr pPix);
-
- /** @name PrepareAccess() and FinishAccess() indices
- * @{
- */
- /**
- * EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
- * read from.
- */
- #define EXA_PREPARE_DEST 0
- /**
- * EXA_PREPARE_SRC is the index for a pixmap that may be read from
- */
- #define EXA_PREPARE_SRC 1
- /**
- * EXA_PREPARE_SRC is the index for a second pixmap that may be read
- * from.
- */
- #define EXA_PREPARE_MASK 2
- /**
- * EXA_PREPARE_AUX* are additional indices for other purposes, e.g.
- * separate alpha maps with Composite operations.
- */
- #define EXA_PREPARE_AUX_DEST 3
- #define EXA_PREPARE_AUX_SRC 4
- #define EXA_PREPARE_AUX_MASK 5
- #define EXA_NUM_PREPARE_INDICES 6
- /** @} */
-
- /**
- * maxPitchPixels controls the pitch limitation for rendering from
- * the card.
- * The driver should never receive a request for rendering a pixmap
- * that has a pitch (in pixels) beyond maxPitchPixels.
- *
- * Setting this field is optional -- if your hardware doesn't have
- * a pitch limitation in pixels, don't set this. If neither this value
- * nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
- * If set, it must not be smaller than maxX.
- *
- * @sa maxPitchBytes
- */
- int maxPitchPixels;
-
- /**
- * maxPitchBytes controls the pitch limitation for rendering from
- * the card.
- * The driver should never receive a request for rendering a pixmap
- * that has a pitch (in bytes) beyond maxPitchBytes.
- *
- * Setting this field is optional -- if your hardware doesn't have
- * a pitch limitation in bytes, don't set this.
- * If set, it must not be smaller than maxX * 4.
- * There's no default value for maxPitchBytes.
- *
- * @sa maxPitchPixels
- */
- int maxPitchBytes;
-
- /* Hooks to allow driver to its own pixmap memory management */
- void *(*CreatePixmap)(ScreenPtr pScreen, int size, int align);
- void (*DestroyPixmap)(ScreenPtr pScreen, void *driverPriv);
- /**
- * Returning a pixmap with non-NULL devPrivate.ptr implies a pixmap which is
- * not offscreen, which will never be accelerated and Prepare/FinishAccess won't
- * be called.
- */
- Bool (*ModifyPixmapHeader)(PixmapPtr pPixmap, int width, int height,
- int depth, int bitsPerPixel, int devKind,
- pointer pPixData);
-
- /* hooks for drivers with tiling support:
- * driver MUST fill out new_fb_pitch with valid pitch of pixmap
- */
- void *(*CreatePixmap2)(ScreenPtr pScreen, int width, int height,
- int depth, int usage_hint, int bitsPerPixel,
- int *new_fb_pitch);
- /** @} */
-} ExaDriverRec, *ExaDriverPtr;
-
-/** @name EXA driver flags
- * @{
- */
-/**
- * EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support
- * offscreen pixmaps.
- */
-#define EXA_OFFSCREEN_PIXMAPS (1 << 0)
-
-/**
- * EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps
- * to have a power-of-two pitch.
- */
-#define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
-
-/**
- * EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only
- * support copies that are (left-to-right, top-to-bottom) or
- * (right-to-left, bottom-to-top).
- */
-#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
-
-/**
- * EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle
- * all pixmap addressing and migration.
- */
-#define EXA_HANDLES_PIXMAPS (1 << 3)
-
-/**
- * EXA_SUPPORTS_PREPARE_AUX indicates to EXA that the driver can handle the
- * EXA_PREPARE_AUX* indices in the Prepare/FinishAccess hooks. If there are no
- * such hooks, this flag has no effect.
- */
-#define EXA_SUPPORTS_PREPARE_AUX (1 << 4)
-
-/**
- * EXA_SUPPORTS_OFFSCREEN_OVERLAPS indicates to EXA that the driver Copy hooks
- * can handle the source and destination occupying overlapping offscreen memory
- * areas. This allows the offscreen memory defragmentation code to defragment
- * areas where the defragmented position overlaps the fragmented position.
- *
- * Typically this is supported by traditional 2D engines but not by 3D engines.
- */
-#define EXA_SUPPORTS_OFFSCREEN_OVERLAPS (1 << 5)
-
-/**
- * EXA_MIXED_PIXMAPS will hide unacceleratable pixmaps from drivers and manage the
- * problem known software fallbacks like trapezoids. This only migrates pixmaps one way
- * into a driver pixmap and then pins it.
- */
-#define EXA_MIXED_PIXMAPS (1 << 6)
-
-/** @} */
-
-/* in exa.c */
-extern _X_EXPORT ExaDriverPtr
-exaDriverAlloc(void);
-
-extern _X_EXPORT Bool
-exaDriverInit(ScreenPtr pScreen,
- ExaDriverPtr pScreenInfo);
-
-extern _X_EXPORT void
-exaDriverFini(ScreenPtr pScreen);
-
-extern _X_EXPORT void
-exaMarkSync(ScreenPtr pScreen);
-extern _X_EXPORT void
-exaWaitSync(ScreenPtr pScreen);
-
-extern _X_EXPORT unsigned long
-exaGetPixmapOffset(PixmapPtr pPix);
-
-extern _X_EXPORT unsigned long
-exaGetPixmapPitch(PixmapPtr pPix);
-
-extern _X_EXPORT unsigned long
-exaGetPixmapSize(PixmapPtr pPix);
-
-extern _X_EXPORT void *
-exaGetPixmapDriverPrivate(PixmapPtr p);
-
-
-/* in exa_offscreen.c */
-extern _X_EXPORT ExaOffscreenArea *
-exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
- Bool locked,
- ExaOffscreenSaveProc save,
- pointer privData);
-
-extern _X_EXPORT ExaOffscreenArea *
-exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea *area);
-
-extern _X_EXPORT void
-ExaOffscreenMarkUsed (PixmapPtr pPixmap);
-
-extern _X_EXPORT void
-exaEnableDisableFBAccess (int index, Bool enable);
-
-extern _X_EXPORT Bool
-exaDrawableIsOffscreen (DrawablePtr pDrawable);
-
-/* in exa.c */
-extern _X_EXPORT void
-exaMoveInPixmap (PixmapPtr pPixmap);
-
-extern _X_EXPORT void
-exaMoveOutPixmap (PixmapPtr pPixmap);
-
-
-/* in exa_unaccel.c */
-extern _X_EXPORT CARD32
-exaGetPixmapFirstPixel (PixmapPtr pPixmap);
-
-
-/**
- * Returns TRUE if the given planemask covers all the significant bits in the
- * pixel values for pDrawable.
- */
-#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
- (((_pm) & FbFullMask((_pDrawable)->depth)) == \
- FbFullMask((_pDrawable)->depth))
-
-#endif /* EXA_H */
+/*
+ *
+ * Copyright (C) 2000 Keith Packard
+ * 2004 Eric Anholt
+ * 2005 Zack Rusin
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Copyright holders make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/** @file
+ * This is the header containing the public API of EXA for exa drivers.
+ */
+
+#ifndef EXA_H
+#define EXA_H
+
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "picturestr.h"
+#include "fb.h"
+
+#define EXA_VERSION_MAJOR 2
+#define EXA_VERSION_MINOR 5
+#define EXA_VERSION_RELEASE 0
+
+typedef struct _ExaOffscreenArea ExaOffscreenArea;
+
+typedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen,
+ ExaOffscreenArea * area);
+
+typedef enum _ExaOffscreenState {
+ ExaOffscreenAvail,
+ ExaOffscreenRemovable,
+ ExaOffscreenLocked
+} ExaOffscreenState;
+
+struct _ExaOffscreenArea {
+ int base_offset; /* allocation base */
+ int offset; /* aligned offset */
+ int size; /* total allocation size */
+ unsigned last_use;
+ pointer privData;
+
+ ExaOffscreenSaveProc save;
+
+ ExaOffscreenState state;
+
+ ExaOffscreenArea *next;
+
+ unsigned eviction_cost;
+
+ ExaOffscreenArea *prev; /* Double-linked list for defragmentation */
+ int align; /* required alignment */
+};
+
+/**
+ * The ExaDriver structure is allocated through exaDriverAlloc(), and then
+ * fllled in by drivers.
+ */
+typedef struct _ExaDriver {
+ /**
+ * exa_major and exa_minor should be set by the driver to the version of
+ * EXA which the driver was compiled for (or configures itself at runtime
+ * to support). This allows EXA to extend the structure for new features
+ * without breaking ABI for drivers compiled against older versions.
+ */
+ int exa_major, exa_minor;
+
+ /**
+ * memoryBase is the address of the beginning of framebuffer memory.
+ * The visible screen should be within memoryBase to memoryBase +
+ * memorySize.
+ */
+ CARD8 *memoryBase;
+
+ /**
+ * offScreenBase is the offset from memoryBase of the beginning of the area
+ * to be managed by EXA's linear offscreen memory manager.
+ *
+ * In XFree86 DDX drivers, this is probably:
+ * (pScrn->displayWidth * cpp * pScrn->virtualY)
+ */
+ unsigned long offScreenBase;
+
+ /**
+ * memorySize is the length (in bytes) of framebuffer memory beginning
+ * from memoryBase.
+ *
+ * The offscreen memory manager will manage the area beginning at
+ * (memoryBase + offScreenBase), with a length of (memorySize -
+ * offScreenBase)
+ *
+ * In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024)
+ */
+ unsigned long memorySize;
+
+ /**
+ * pixmapOffsetAlign is the byte alignment necessary for pixmap offsets
+ * within framebuffer.
+ *
+ * Hardware typically has a required alignment of offsets, which may or may
+ * not be a power of two. EXA will ensure that pixmaps managed by the
+ * offscreen memory manager meet this alignment requirement.
+ */
+ int pixmapOffsetAlign;
+
+ /**
+ * pixmapPitchAlign is the byte alignment necessary for pixmap pitches
+ * within the framebuffer.
+ *
+ * Hardware typically has a required alignment of pitches for acceleration.
+ * For 3D hardware, Composite acceleration often requires that source and
+ * mask pixmaps (textures) have a power-of-two pitch, which can be demanded
+ * using EXA_OFFSCREEN_ALIGN_POT. These pitch requirements only apply to
+ * pixmaps managed by the offscreen memory manager. Thus, it is up to the
+ * driver to ensure that the visible screen has an appropriate pitch for
+ * acceleration.
+ */
+ int pixmapPitchAlign;
+
+ /**
+ * The flags field is bitfield of boolean values controlling EXA's behavior.
+ *
+ * The flags in clude EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and
+ * EXA_TWO_BITBLT_DIRECTIONS.
+ */
+ int flags;
+
+ /** @{ */
+ /**
+ * maxX controls the X coordinate limitation for rendering from the card.
+ * The driver should never receive a request for rendering beyond maxX
+ * in the X direction from the origin of a pixmap.
+ */
+ int maxX;
+
+ /**
+ * maxY controls the Y coordinate limitation for rendering from the card.
+ * The driver should never receive a request for rendering beyond maxY
+ * in the Y direction from the origin of a pixmap.
+ */
+ int maxY;
+ /** @} */
+
+ /* private */
+ ExaOffscreenArea *offScreenAreas;
+ Bool needsSync;
+ int lastMarker;
+
+ /** @name Solid
+ * @{
+ */
+ /**
+ * PrepareSolid() sets up the driver for doing a solid fill.
+ * @param pPixmap Destination pixmap
+ * @param alu raster operation
+ * @param planemask write mask for the fill
+ * @param fg "foreground" color for the fill
+ *
+ * This call should set up the driver for doing a series of solid fills
+ * through the Solid() call. The alu raster op is one of the GX*
+ * graphics functions listed in X.h, and typically maps to a similar
+ * single-byte "ROP" setting in all hardware. The planemask controls
+ * which bits of the destination should be affected, and will only represent
+ * the bits up to the depth of pPixmap. The fg is the pixel value of the
+ * foreground color referred to in ROP descriptions.
+ *
+ * Note that many drivers will need to store some of the data in the driver
+ * private record, for sending to the hardware with each drawing command.
+ *
+ * The PrepareSolid() call is required of all drivers, but it may fail for any
+ * reason. Failure results in a fallback to software rendering.
+ */
+ Bool (*PrepareSolid) (PixmapPtr pPixmap,
+ int alu, Pixel planemask, Pixel fg);
+
+ /**
+ * Solid() performs a solid fill set up in the last PrepareSolid() call.
+ *
+ * @param pPixmap destination pixmap
+ * @param x1 left coordinate
+ * @param y1 top coordinate
+ * @param x2 right coordinate
+ * @param y2 bottom coordinate
+ *
+ * Performs the fill set up by the last PrepareSolid() call, covering the
+ * area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are
+ * in the coordinate space of the destination pixmap, so the driver will
+ * need to set up the hardware's offset and pitch for the destination
+ * coordinates according to the pixmap's offset and pitch within
+ * framebuffer. This likely means using exaGetPixmapOffset() and
+ * exaGetPixmapPitch().
+ *
+ * This call is required if PrepareSolid() ever succeeds.
+ */
+ void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
+
+ /**
+ * DoneSolid() finishes a set of solid fills.
+ *
+ * @param pPixmap destination pixmap.
+ *
+ * The DoneSolid() call is called at the end of a series of consecutive
+ * Solid() calls following a successful PrepareSolid(). This allows drivers
+ * to finish up emitting drawing commands that were buffered, or clean up
+ * state from PrepareSolid().
+ *
+ * This call is required if PrepareSolid() ever succeeds.
+ */
+ void (*DoneSolid) (PixmapPtr pPixmap);
+ /** @} */
+
+ /** @name Copy
+ * @{
+ */
+ /**
+ * PrepareCopy() sets up the driver for doing a copy within video
+ * memory.
+ *
+ * @param pSrcPixmap source pixmap
+ * @param pDstPixmap destination pixmap
+ * @param dx X copy direction
+ * @param dy Y copy direction
+ * @param alu raster operation
+ * @param planemask write mask for the fill
+ *
+ * This call should set up the driver for doing a series of copies from the
+ * the pSrcPixmap to the pDstPixmap. The dx flag will be positive if the
+ * hardware should do the copy from the left to the right, and dy will be
+ * positive if the copy should be done from the top to the bottom. This
+ * is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
+ * If your hardware can only support blits that are (left to right, top to
+ * bottom) or (right to left, bottom to top), then you should set
+ * #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to
+ * ones that meet those requirements. The alu raster op is one of the GX*
+ * graphics functions listed in X.h, and typically maps to a similar
+ * single-byte "ROP" setting in all hardware. The planemask controls which
+ * bits of the destination should be affected, and will only represent the
+ * bits up to the depth of pPixmap.
+ *
+ * Note that many drivers will need to store some of the data in the driver
+ * private record, for sending to the hardware with each drawing command.
+ *
+ * The PrepareCopy() call is required of all drivers, but it may fail for any
+ * reason. Failure results in a fallback to software rendering.
+ */
+ Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ int dx, int dy, int alu, Pixel planemask);
+
+ /**
+ * Copy() performs a copy set up in the last PrepareCopy call.
+ *
+ * @param pDstPixmap destination pixmap
+ * @param srcX source X coordinate
+ * @param srcY source Y coordinate
+ * @param dstX destination X coordinate
+ * @param dstY destination Y coordinate
+ * @param width width of the rectangle to be copied
+ * @param height height of the rectangle to be copied.
+ *
+ * Performs the copy set up by the last PrepareCopy() call, copying the
+ * rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
+ * pixmap to the same-sized rectangle at (dstX, dstY) in the destination
+ * pixmap. Those rectangles may overlap in memory, if
+ * pSrcPixmap == pDstPixmap. Note that this call does not receive the
+ * pSrcPixmap as an argument -- if it's needed in this function, it should
+ * be stored in the driver private during PrepareCopy(). As with Solid(),
+ * the coordinates are in the coordinate space of each pixmap, so the driver
+ * will need to set up source and destination pitches and offsets from those
+ * pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch().
+ *
+ * This call is required if PrepareCopy ever succeeds.
+ */
+ void (*Copy) (PixmapPtr pDstPixmap,
+ int srcX,
+ int srcY, int dstX, int dstY, int width, int height);
+
+ /**
+ * DoneCopy() finishes a set of copies.
+ *
+ * @param pPixmap destination pixmap.
+ *
+ * The DoneCopy() call is called at the end of a series of consecutive
+ * Copy() calls following a successful PrepareCopy(). This allows drivers
+ * to finish up emitting drawing commands that were buffered, or clean up
+ * state from PrepareCopy().
+ *
+ * This call is required if PrepareCopy() ever succeeds.
+ */
+ void (*DoneCopy) (PixmapPtr pDstPixmap);
+ /** @} */
+
+ /** @name Composite
+ * @{
+ */
+ /**
+ * CheckComposite() checks to see if a composite operation could be
+ * accelerated.
+ *
+ * @param op Render operation
+ * @param pSrcPicture source Picture
+ * @param pMaskPicture mask picture
+ * @param pDstPicture destination Picture
+ *
+ * The CheckComposite() call checks if the driver could handle acceleration
+ * of op with the given source, mask, and destination pictures. This allows
+ * drivers to check source and destination formats, supported operations,
+ * transformations, and component alpha state, and send operations it can't
+ * support to software rendering early on. This avoids costly pixmap
+ * migration to the wrong places when the driver can't accelerate
+ * operations. Note that because migration hasn't happened, the driver
+ * can't know during CheckComposite() what the offsets and pitches of the
+ * pixmaps are going to be.
+ *
+ * See PrepareComposite() for more details on likely issues that drivers
+ * will have in accelerating Composite operations.
+ *
+ * The CheckComposite() call is recommended if PrepareComposite() is
+ * implemented, but is not required.
+ */
+ Bool (*CheckComposite) (int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture, PicturePtr pDstPicture);
+
+ /**
+ * PrepareComposite() sets up the driver for doing a Composite operation
+ * described in the Render extension protocol spec.
+ *
+ * @param op Render operation
+ * @param pSrcPicture source Picture
+ * @param pMaskPicture mask picture
+ * @param pDstPicture destination Picture
+ * @param pSrc source pixmap
+ * @param pMask mask pixmap
+ * @param pDst destination pixmap
+ *
+ * This call should set up the driver for doing a series of Composite
+ * operations, as described in the Render protocol spec, with the given
+ * pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and
+ * pDst are the pixmaps containing the pixel data, and should be used for
+ * setting the offset and pitch used for the coordinate spaces for each of
+ * the Pictures.
+ *
+ * Notes on interpreting Picture structures:
+ * - The Picture structures will always have a valid pDrawable.
+ * - The Picture structures will never have alphaMap set.
+ * - The mask Picture (and therefore pMask) may be NULL, in which case the
+ * operation is simply src OP dst instead of src IN mask OP dst, and
+ * mask coordinates should be ignored.
+ * - pMarkPicture may have componentAlpha set, which greatly changes
+ * the behavior of the Composite operation. componentAlpha has no effect
+ * when set on pSrcPicture or pDstPicture.
+ * - The source and mask Pictures may have a transformation set
+ * (Picture->transform != NULL), which means that the source coordinates
+ * should be transformed by that transformation, resulting in scaling,
+ * rotation, etc. The PictureTransformPoint() call can transform
+ * coordinates for you. Transforms have no effect on Pictures when used
+ * as a destination.
+ * - The source and mask pictures may have a filter set. PictFilterNearest
+ * and PictFilterBilinear are defined in the Render protocol, but others
+ * may be encountered, and must be handled correctly (usually by
+ * PrepareComposite failing, and falling back to software). Filters have
+ * no effect on Pictures when used as a destination.
+ * - The source and mask Pictures may have repeating set, which must be
+ * respected. Many chipsets will be unable to support repeating on
+ * pixmaps that have a width or height that is not a power of two.
+ *
+ * If your hardware can't support source pictures (textures) with
+ * non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT.
+ *
+ * Note that many drivers will need to store some of the data in the driver
+ * private record, for sending to the hardware with each drawing command.
+ *
+ * The PrepareComposite() call is not required. However, it is highly
+ * recommended for performance of antialiased font rendering and performance
+ * of cairo applications. Failure results in a fallback to software
+ * rendering.
+ */
+ Bool (*PrepareComposite) (int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture,
+ PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst);
+
+ /**
+ * Composite() performs a Composite operation set up in the last
+ * PrepareComposite() call.
+ *
+ * @param pDstPixmap destination pixmap
+ * @param srcX source X coordinate
+ * @param srcY source Y coordinate
+ * @param maskX source X coordinate
+ * @param maskY source Y coordinate
+ * @param dstX destination X coordinate
+ * @param dstY destination Y coordinate
+ * @param width destination rectangle width
+ * @param height destination rectangle height
+ *
+ * Performs the Composite operation set up by the last PrepareComposite()
+ * call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
+ * in the destination Pixmap. Note that if a transformation was set on
+ * the source or mask Pictures, the source rectangles may not be the same
+ * size as the destination rectangles and filtering. Getting the coordinate
+ * transformation right at the subpixel level can be tricky, and rendercheck
+ * can test this for you.
+ *
+ * This call is required if PrepareComposite() ever succeeds.
+ */
+ void (*Composite) (PixmapPtr pDst,
+ int srcX,
+ int srcY,
+ int maskX,
+ int maskY, int dstX, int dstY, int width, int height);
+
+ /**
+ * DoneComposite() finishes a set of Composite operations.
+ *
+ * @param pPixmap destination pixmap.
+ *
+ * The DoneComposite() call is called at the end of a series of consecutive
+ * Composite() calls following a successful PrepareComposite(). This allows
+ * drivers to finish up emitting drawing commands that were buffered, or
+ * clean up state from PrepareComposite().
+ *
+ * This call is required if PrepareComposite() ever succeeds.
+ */
+ void (*DoneComposite) (PixmapPtr pDst);
+ /** @} */
+
+ /**
+ * UploadToScreen() loads a rectangle of data from src into pDst.
+ *
+ * @param pDst destination pixmap
+ * @param x destination X coordinate.
+ * @param y destination Y coordinate
+ * @param width width of the rectangle to be copied
+ * @param height height of the rectangle to be copied
+ * @param src pointer to the beginning of the source data
+ * @param src_pitch pitch (in bytes) of the lines of source data.
+ *
+ * UploadToScreen() copies data in system memory beginning at src (with
+ * pitch src_pitch) into the destination pixmap from (x, y) to
+ * (x + width, y + height). This is typically done with hostdata uploads,
+ * where the CPU sets up a blit command on the hardware with instructions
+ * that the blit data will be fed through some sort of aperture on the card.
+ *
+ * If UploadToScreen() is performed asynchronously, it is up to the driver
+ * to call exaMarkSync(). This is in contrast to most other acceleration
+ * calls in EXA.
+ *
+ * UploadToScreen() can aid in pixmap migration, but is most important for
+ * the performance of exaGlyphs() (antialiased font drawing) by allowing
+ * pipelining of data uploads, avoiding a sync of the card after each glyph.
+ *
+ * @return TRUE if the driver successfully uploaded the data. FALSE
+ * indicates that EXA should fall back to doing the upload in software.
+ *
+ * UploadToScreen() is not required, but is recommended if Composite
+ * acceleration is supported.
+ */
+ Bool (*UploadToScreen) (PixmapPtr pDst,
+ int x,
+ int y, int w, int h, char *src, int src_pitch);
+
+ /**
+ * UploadToScratch() is no longer used and will be removed next time the EXA
+ * major version needs to be bumped.
+ */
+ Bool (*UploadToScratch) (PixmapPtr pSrc, PixmapPtr pDst);
+
+ /**
+ * DownloadFromScreen() loads a rectangle of data from pSrc into dst
+ *
+ * @param pSrc source pixmap
+ * @param x source X coordinate.
+ * @param y source Y coordinate
+ * @param width width of the rectangle to be copied
+ * @param height height of the rectangle to be copied
+ * @param dst pointer to the beginning of the destination data
+ * @param dst_pitch pitch (in bytes) of the lines of destination data.
+ *
+ * DownloadFromScreen() copies data from offscreen memory in pSrc from
+ * (x, y) to (x + width, y + height), to system memory starting at
+ * dst (with pitch dst_pitch). This would usually be done
+ * using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
+ * and then synchronously reading from AGP. Because the implementation
+ * might be synchronous, EXA leaves it up to the driver to call
+ * exaMarkSync() if DownloadFromScreen() was asynchronous. This is in
+ * contrast to most other acceleration calls in EXA.
+ *
+ * DownloadFromScreen() can aid in the largest bottleneck in pixmap
+ * migration, which is the read from framebuffer when evicting pixmaps from
+ * framebuffer memory. Thus, it is highly recommended, even though
+ * implementations are typically complicated.
+ *
+ * @return TRUE if the driver successfully downloaded the data. FALSE
+ * indicates that EXA should fall back to doing the download in software.
+ *
+ * DownloadFromScreen() is not required, but is highly recommended.
+ */
+ Bool (*DownloadFromScreen) (PixmapPtr pSrc,
+ int x, int y,
+ int w, int h, char *dst, int dst_pitch);
+
+ /**
+ * MarkSync() requests that the driver mark a synchronization point,
+ * returning an driver-defined integer marker which could be requested for
+ * synchronization to later in WaitMarker(). This might be used in the
+ * future to avoid waiting for full hardware stalls before accessing pixmap
+ * data with the CPU, but is not important in the current incarnation of
+ * EXA.
+ *
+ * Note that drivers should call exaMarkSync() when they have done some
+ * acceleration, rather than their own MarkSync() handler, as otherwise EXA
+ * will be unaware of the driver's acceleration and not sync to it during
+ * fallbacks.
+ *
+ * MarkSync() is optional.
+ */
+ int (*MarkSync) (ScreenPtr pScreen);
+
+ /**
+ * WaitMarker() waits for all rendering before the given marker to have
+ * completed. If the driver does not implement MarkSync(), marker is
+ * meaningless, and all rendering by the hardware should be completed before
+ * WaitMarker() returns.
+ *
+ * Note that drivers should call exaWaitSync() to wait for all acceleration
+ * to finish, as otherwise EXA will be unaware of the driver having
+ * synchronized, resulting in excessive WaitMarker() calls.
+ *
+ * WaitMarker() is required of all drivers.
+ */
+ void (*WaitMarker) (ScreenPtr pScreen, int marker);
+
+ /** @{ */
+ /**
+ * PrepareAccess() is called before CPU access to an offscreen pixmap.
+ *
+ * @param pPix the pixmap being accessed
+ * @param index the index of the pixmap being accessed.
+ *
+ * PrepareAccess() will be called before CPU access to an offscreen pixmap.
+ * This can be used to set up hardware surfaces for byteswapping or
+ * untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
+ * making CPU access use a different aperture.
+ *
+ * The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC,
+ * #EXA_PREPARE_MASK, #EXA_PREPARE_AUX_DEST, #EXA_PREPARE_AUX_SRC, or
+ * #EXA_PREPARE_AUX_MASK. Since only up to #EXA_NUM_PREPARE_INDICES pixmaps
+ * will have PrepareAccess() called on them per operation, drivers can have
+ * a small, statically-allocated space to maintain state for PrepareAccess()
+ * and FinishAccess() in. Note that PrepareAccess() is only called once per
+ * pixmap and operation, regardless of whether the pixmap is used as a
+ * destination and/or source, and the index may not reflect the usage.
+ *
+ * PrepareAccess() may fail. An example might be the case of hardware that
+ * can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess()
+ * fails, EXA will migrate the pixmap to system memory.
+ * DownloadFromScreen() must be implemented and must not fail if a driver
+ * wishes to fail in PrepareAccess(). PrepareAccess() must not fail when
+ * pPix is the visible screen, because the visible screen can not be
+ * migrated.
+ *
+ * @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
+ * drawing.
+ * @return FALSE if PrepareAccess() is unsuccessful and EXA should use
+ * DownloadFromScreen() to migate the pixmap out.
+ */
+ Bool (*PrepareAccess) (PixmapPtr pPix, int index);
+
+ /**
+ * FinishAccess() is called after CPU access to an offscreen pixmap.
+ *
+ * @param pPix the pixmap being accessed
+ * @param index the index of the pixmap being accessed.
+ *
+ * FinishAccess() will be called after finishing CPU access of an offscreen
+ * pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be
+ * called if PrepareAccess() failed and the pixmap was migrated out.
+ */
+ void (*FinishAccess) (PixmapPtr pPix, int index);
+
+ /**
+ * PixmapIsOffscreen() is an optional driver replacement to
+ * exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour
+ * of exaPixmapHasGpuCopy().
+ *
+ * @param pPix the pixmap
+ * @return TRUE if the given drawable is in framebuffer memory.
+ *
+ * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen
+ * memory, meaning that acceleration could probably be done to it, and that it
+ * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
+ * with the CPU.
+ *
+ *
+ */
+ Bool (*PixmapIsOffscreen) (PixmapPtr pPix);
+
+ /** @name PrepareAccess() and FinishAccess() indices
+ * @{
+ */
+ /**
+ * EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
+ * read from.
+ */
+#define EXA_PREPARE_DEST 0
+ /**
+ * EXA_PREPARE_SRC is the index for a pixmap that may be read from
+ */
+#define EXA_PREPARE_SRC 1
+ /**
+ * EXA_PREPARE_SRC is the index for a second pixmap that may be read
+ * from.
+ */
+#define EXA_PREPARE_MASK 2
+ /**
+ * EXA_PREPARE_AUX* are additional indices for other purposes, e.g.
+ * separate alpha maps with Composite operations.
+ */
+#define EXA_PREPARE_AUX_DEST 3
+#define EXA_PREPARE_AUX_SRC 4
+#define EXA_PREPARE_AUX_MASK 5
+#define EXA_NUM_PREPARE_INDICES 6
+ /** @} */
+
+ /**
+ * maxPitchPixels controls the pitch limitation for rendering from
+ * the card.
+ * The driver should never receive a request for rendering a pixmap
+ * that has a pitch (in pixels) beyond maxPitchPixels.
+ *
+ * Setting this field is optional -- if your hardware doesn't have
+ * a pitch limitation in pixels, don't set this. If neither this value
+ * nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
+ * If set, it must not be smaller than maxX.
+ *
+ * @sa maxPitchBytes
+ */
+ int maxPitchPixels;
+
+ /**
+ * maxPitchBytes controls the pitch limitation for rendering from
+ * the card.
+ * The driver should never receive a request for rendering a pixmap
+ * that has a pitch (in bytes) beyond maxPitchBytes.
+ *
+ * Setting this field is optional -- if your hardware doesn't have
+ * a pitch limitation in bytes, don't set this.
+ * If set, it must not be smaller than maxX * 4.
+ * There's no default value for maxPitchBytes.
+ *
+ * @sa maxPitchPixels
+ */
+ int maxPitchBytes;
+
+ /* Hooks to allow driver to its own pixmap memory management */
+ void *(*CreatePixmap) (ScreenPtr pScreen, int size, int align);
+ void (*DestroyPixmap) (ScreenPtr pScreen, void *driverPriv);
+ /**
+ * Returning a pixmap with non-NULL devPrivate.ptr implies a pixmap which is
+ * not offscreen, which will never be accelerated and Prepare/FinishAccess won't
+ * be called.
+ */
+ Bool (*ModifyPixmapHeader) (PixmapPtr pPixmap, int width, int height,
+ int depth, int bitsPerPixel, int devKind,
+ pointer pPixData);
+
+ /* hooks for drivers with tiling support:
+ * driver MUST fill out new_fb_pitch with valid pitch of pixmap
+ */
+ void *(*CreatePixmap2) (ScreenPtr pScreen, int width, int height,
+ int depth, int usage_hint, int bitsPerPixel,
+ int *new_fb_pitch);
+ /** @} */
+} ExaDriverRec, *ExaDriverPtr;
+
+/** @name EXA driver flags
+ * @{
+ */
+/**
+ * EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support
+ * offscreen pixmaps.
+ */
+#define EXA_OFFSCREEN_PIXMAPS (1 << 0)
+
+/**
+ * EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps
+ * to have a power-of-two pitch.
+ */
+#define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
+
+/**
+ * EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only
+ * support copies that are (left-to-right, top-to-bottom) or
+ * (right-to-left, bottom-to-top).
+ */
+#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
+
+/**
+ * EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle
+ * all pixmap addressing and migration.
+ */
+#define EXA_HANDLES_PIXMAPS (1 << 3)
+
+/**
+ * EXA_SUPPORTS_PREPARE_AUX indicates to EXA that the driver can handle the
+ * EXA_PREPARE_AUX* indices in the Prepare/FinishAccess hooks. If there are no
+ * such hooks, this flag has no effect.
+ */
+#define EXA_SUPPORTS_PREPARE_AUX (1 << 4)
+
+/**
+ * EXA_SUPPORTS_OFFSCREEN_OVERLAPS indicates to EXA that the driver Copy hooks
+ * can handle the source and destination occupying overlapping offscreen memory
+ * areas. This allows the offscreen memory defragmentation code to defragment
+ * areas where the defragmented position overlaps the fragmented position.
+ *
+ * Typically this is supported by traditional 2D engines but not by 3D engines.
+ */
+#define EXA_SUPPORTS_OFFSCREEN_OVERLAPS (1 << 5)
+
+/**
+ * EXA_MIXED_PIXMAPS will hide unacceleratable pixmaps from drivers and manage the
+ * problem known software fallbacks like trapezoids. This only migrates pixmaps one way
+ * into a driver pixmap and then pins it.
+ */
+#define EXA_MIXED_PIXMAPS (1 << 6)
+
+/** @} */
+
+/* in exa.c */
+extern _X_EXPORT ExaDriverPtr exaDriverAlloc(void);
+
+extern _X_EXPORT Bool
+ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo);
+
+extern _X_EXPORT void
+ exaDriverFini(ScreenPtr pScreen);
+
+extern _X_EXPORT void
+ exaMarkSync(ScreenPtr pScreen);
+extern _X_EXPORT void
+ exaWaitSync(ScreenPtr pScreen);
+
+extern _X_EXPORT unsigned long
+ exaGetPixmapOffset(PixmapPtr pPix);
+
+extern _X_EXPORT unsigned long
+ exaGetPixmapPitch(PixmapPtr pPix);
+
+extern _X_EXPORT unsigned long
+ exaGetPixmapSize(PixmapPtr pPix);
+
+extern _X_EXPORT void *exaGetPixmapDriverPrivate(PixmapPtr p);
+
+/* in exa_offscreen.c */
+extern _X_EXPORT ExaOffscreenArea *exaOffscreenAlloc(ScreenPtr pScreen,
+ int size, int align,
+ Bool locked,
+ ExaOffscreenSaveProc save,
+ pointer privData);
+
+extern _X_EXPORT ExaOffscreenArea *exaOffscreenFree(ScreenPtr pScreen,
+ ExaOffscreenArea * area);
+
+extern _X_EXPORT void
+ ExaOffscreenMarkUsed(PixmapPtr pPixmap);
+
+extern _X_EXPORT void
+ exaEnableDisableFBAccess(int index, Bool enable);
+
+extern _X_EXPORT Bool
+ exaDrawableIsOffscreen(DrawablePtr pDrawable);
+
+/* in exa.c */
+extern _X_EXPORT void
+ exaMoveInPixmap(PixmapPtr pPixmap);
+
+extern _X_EXPORT void
+ exaMoveOutPixmap(PixmapPtr pPixmap);
+
+/* in exa_unaccel.c */
+extern _X_EXPORT CARD32
+ exaGetPixmapFirstPixel(PixmapPtr pPixmap);
+
+/**
+ * Returns TRUE if the given planemask covers all the significant bits in the
+ * pixel values for pDrawable.
+ */
+#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
+ (((_pm) & FbFullMask((_pDrawable)->depth)) == \
+ FbFullMask((_pDrawable)->depth))
+
+#endif /* EXA_H */
diff --git a/xorg-server/exa/exa_accel.c b/xorg-server/exa/exa_accel.c
index 3917621e1..5279b765c 100644
--- a/xorg-server/exa/exa_accel.c
+++ b/xorg-server/exa/exa_accel.c
@@ -37,48 +37,46 @@
static void
exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
- DDXPointPtr ppt, int *pwidth, int fSorted)
+ DDXPointPtr ppt, int *pwidth, int fSorted)
{
- ScreenPtr pScreen = pDrawable->pScreen;
- ExaScreenPriv (pScreen);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
- ExaPixmapPriv (pPixmap);
- BoxPtr pextent, pbox;
- int nbox;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1;
- int partX1, partX2;
- int off_x, off_y;
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ ExaScreenPriv(pScreen);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
+
+ ExaPixmapPriv(pPixmap);
+ BoxPtr pextent, pbox;
+ int nbox;
+ int extentX1, extentX2, extentY1, extentY2;
+ int fullX1, fullX2, fullY1;
+ int partX1, partX2;
+ int off_x, off_y;
if (pExaScr->fallback_counter ||
- pExaScr->swappedOut ||
- pGC->fillStyle != FillSolid ||
- pExaPixmap->accel_blocked)
- {
- ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
- return;
+ pExaScr->swappedOut ||
+ pGC->fillStyle != FillSolid || pExaPixmap->accel_blocked) {
+ ExaCheckFillSpans(pDrawable, pGC, n, ppt, pwidth, fSorted);
+ return;
}
if (pExaScr->do_migration) {
- ExaMigrationRec pixmaps[1];
+ ExaMigrationRec pixmaps[1];
- pixmaps[0].as_dst = TRUE;
- pixmaps[0].as_src = FALSE;
- pixmaps[0].pPix = pPixmap;
- pixmaps[0].pReg = NULL;
+ pixmaps[0].as_dst = TRUE;
+ pixmaps[0].as_src = FALSE;
+ pixmaps[0].pPix = pPixmap;
+ pixmaps[0].pReg = NULL;
- exaDoMigration (pixmaps, 1, TRUE);
+ exaDoMigration(pixmaps, 1, TRUE);
}
- if (!(pPixmap = exaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) ||
- !(*pExaScr->info->PrepareSolid) (pPixmap,
- pGC->alu,
- pGC->planemask,
- pGC->fgPixel))
- {
- ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
- return;
+ if (!(pPixmap = exaGetOffscreenPixmap(pDrawable, &off_x, &off_y)) ||
+ !(*pExaScr->info->PrepareSolid) (pPixmap,
+ pGC->alu,
+ pGC->planemask, pGC->fgPixel)) {
+ ExaCheckFillSpans(pDrawable, pGC, n, ppt, pwidth, fSorted);
+ return;
}
pextent = RegionExtents(pClip);
@@ -86,66 +84,63 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
extentY1 = pextent->y1;
extentX2 = pextent->x2;
extentY2 = pextent->y2;
- while (n--)
- {
- fullX1 = ppt->x;
- fullY1 = ppt->y;
- fullX2 = fullX1 + (int) *pwidth;
- ppt++;
- pwidth++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- nbox = RegionNumRects (pClip);
- if (nbox == 1)
- {
- (*pExaScr->info->Solid) (pPixmap,
- fullX1 + off_x, fullY1 + off_y,
- fullX2 + off_x, fullY1 + 1 + off_y);
- }
- else
- {
- pbox = RegionRects(pClip);
- while(nbox--)
- {
- if (pbox->y1 <= fullY1 && fullY1 < pbox->y2)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- if (partX2 > partX1) {
- (*pExaScr->info->Solid) (pPixmap,
- partX1 + off_x, fullY1 + off_y,
- partX2 + off_x, fullY1 + 1 + off_y);
- }
- }
- pbox++;
- }
- }
+ while (n--) {
+ fullX1 = ppt->x;
+ fullY1 = ppt->y;
+ fullX2 = fullX1 + (int) *pwidth;
+ ppt++;
+ pwidth++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ nbox = RegionNumRects(pClip);
+ if (nbox == 1) {
+ (*pExaScr->info->Solid) (pPixmap,
+ fullX1 + off_x, fullY1 + off_y,
+ fullX2 + off_x, fullY1 + 1 + off_y);
+ }
+ else {
+ pbox = RegionRects(pClip);
+ while (nbox--) {
+ if (pbox->y1 <= fullY1 && fullY1 < pbox->y2) {
+ partX1 = pbox->x1;
+ if (partX1 < fullX1)
+ partX1 = fullX1;
+ partX2 = pbox->x2;
+ if (partX2 > fullX2)
+ partX2 = fullX2;
+ if (partX2 > partX1) {
+ (*pExaScr->info->Solid) (pPixmap,
+ partX1 + off_x, fullY1 + off_y,
+ partX2 + off_x,
+ fullY1 + 1 + off_y);
+ }
+ }
+ pbox++;
+ }
+ }
}
(*pExaScr->info->DoneSolid) (pPixmap);
exaMarkSync(pScreen);
}
static Bool
-exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
- int w, int h, int format, char *bits, int src_stride)
+exaDoPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int format, char *bits, int src_stride)
{
- ExaScreenPriv (pDrawable->pScreen);
- PixmapPtr pPix = exaGetDrawablePixmap (pDrawable);
+ ExaScreenPriv(pDrawable->pScreen);
+ PixmapPtr pPix = exaGetDrawablePixmap(pDrawable);
+
ExaPixmapPriv(pPix);
RegionPtr pClip;
BoxPtr pbox;
@@ -154,284 +149,280 @@ exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int bpp = pDrawable->bitsPerPixel;
Bool ret = TRUE;
- if (pExaScr->fallback_counter || pExaPixmap->accel_blocked || !pExaScr->info->UploadToScreen)
- return FALSE;
+ if (pExaScr->fallback_counter || pExaPixmap->accel_blocked ||
+ !pExaScr->info->UploadToScreen)
+ return FALSE;
/* If there's a system copy, we want to save the result there */
if (pExaPixmap->pDamage)
- return FALSE;
+ return FALSE;
/* Don't bother with under 8bpp, XYPixmaps. */
if (format != ZPixmap || bpp < 8)
- return FALSE;
+ return FALSE;
/* Only accelerate copies: no rop or planemask. */
if (!EXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy)
- return FALSE;
+ return FALSE;
if (pExaScr->swappedOut)
- return FALSE;
+ return FALSE;
if (pExaScr->do_migration) {
- ExaMigrationRec pixmaps[1];
+ ExaMigrationRec pixmaps[1];
- pixmaps[0].as_dst = TRUE;
- pixmaps[0].as_src = FALSE;
- pixmaps[0].pPix = pPix;
- pixmaps[0].pReg = DamagePendingRegion(pExaPixmap->pDamage);
+ pixmaps[0].as_dst = TRUE;
+ pixmaps[0].as_src = FALSE;
+ pixmaps[0].pPix = pPix;
+ pixmaps[0].pReg = DamagePendingRegion(pExaPixmap->pDamage);
- exaDoMigration (pixmaps, 1, TRUE);
+ exaDoMigration(pixmaps, 1, TRUE);
}
- pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
+ pPix = exaGetOffscreenPixmap(pDrawable, &xoff, &yoff);
if (!pPix)
- return FALSE;
+ return FALSE;
x += pDrawable->x;
y += pDrawable->y;
pClip = fbGetCompositeClip(pGC);
for (nbox = RegionNumRects(pClip),
- pbox = RegionRects(pClip);
- nbox--;
- pbox++)
- {
- int x1 = x;
- int y1 = y;
- int x2 = x + w;
- int y2 = y + h;
- char *src;
- Bool ok;
-
- if (x1 < pbox->x1)
- x1 = pbox->x1;
- if (y1 < pbox->y1)
- y1 = pbox->y1;
- if (x2 > pbox->x2)
- x2 = pbox->x2;
- if (y2 > pbox->y2)
- y2 = pbox->y2;
- if (x1 >= x2 || y1 >= y2)
- continue;
-
- src = bits + (y1 - y) * src_stride + (x1 - x) * (bpp / 8);
- ok = pExaScr->info->UploadToScreen(pPix, x1 + xoff, y1 + yoff,
- x2 - x1, y2 - y1, src, src_stride);
- /* We have to fall back completely, and ignore what has already been completed.
- * Messing with the fb layer directly like we used to is completely unacceptable.
- */
- if (!ok) {
- ret = FALSE;
- break;
- }
+ pbox = RegionRects(pClip); nbox--; pbox++) {
+ int x1 = x;
+ int y1 = y;
+ int x2 = x + w;
+ int y2 = y + h;
+ char *src;
+ Bool ok;
+
+ if (x1 < pbox->x1)
+ x1 = pbox->x1;
+ if (y1 < pbox->y1)
+ y1 = pbox->y1;
+ if (x2 > pbox->x2)
+ x2 = pbox->x2;
+ if (y2 > pbox->y2)
+ y2 = pbox->y2;
+ if (x1 >= x2 || y1 >= y2)
+ continue;
+
+ src = bits + (y1 - y) * src_stride + (x1 - x) * (bpp / 8);
+ ok = pExaScr->info->UploadToScreen(pPix, x1 + xoff, y1 + yoff,
+ x2 - x1, y2 - y1, src, src_stride);
+ /* We have to fall back completely, and ignore what has already been completed.
+ * Messing with the fb layer directly like we used to is completely unacceptable.
+ */
+ if (!ok) {
+ ret = FALSE;
+ break;
+ }
}
if (ret)
- exaMarkSync(pDrawable->pScreen);
+ exaMarkSync(pDrawable->pScreen);
return ret;
}
static void
-exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *bits)
+exaPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *bits)
{
if (!exaDoPutImage(pDrawable, pGC, depth, x, y, w, h, format, bits,
- PixmapBytePad(w, pDrawable->depth)))
- ExaCheckPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format,
- bits);
+ PixmapBytePad(w, pDrawable->depth)))
+ ExaCheckPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format,
+ bits);
}
static Bool __inline
-exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy)
+exaCopyNtoNTwoDir(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy)
{
- ExaScreenPriv (pDstDrawable->pScreen);
+ ExaScreenPriv(pDstDrawable->pScreen);
PixmapPtr pSrcPixmap, pDstPixmap;
int src_off_x, src_off_y, dst_off_x, dst_off_y;
int dirsetup;
/* Need to get both pixmaps to call the driver routines */
- pSrcPixmap = exaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y);
- pDstPixmap = exaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y);
+ pSrcPixmap = exaGetOffscreenPixmap(pSrcDrawable, &src_off_x, &src_off_y);
+ pDstPixmap = exaGetOffscreenPixmap(pDstDrawable, &dst_off_x, &dst_off_y);
if (!pSrcPixmap || !pDstPixmap)
- return FALSE;
+ return FALSE;
/*
* Now the case of a chip that only supports xdir = ydir = 1 or
* xdir = ydir = -1, but we have xdir != ydir.
*/
- dirsetup = 0; /* No direction set up yet. */
+ dirsetup = 0; /* No direction set up yet. */
for (; nbox; pbox++, nbox--) {
- if (dx >= 0 && (src_off_y + pbox->y1 + dy) != pbox->y1) {
- /* Do a xdir = ydir = -1 blit instead. */
- if (dirsetup != -1) {
- if (dirsetup != 0)
- pExaScr->info->DoneCopy(pDstPixmap);
- dirsetup = -1;
- if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap,
- pDstPixmap,
- -1, -1,
- pGC ? pGC->alu : GXcopy,
- pGC ? pGC->planemask :
- FB_ALLONES))
- return FALSE;
- }
- (*pExaScr->info->Copy)(pDstPixmap,
- src_off_x + pbox->x1 + dx,
- src_off_y + pbox->y1 + dy,
- dst_off_x + pbox->x1,
- dst_off_y + pbox->y1,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- } else if (dx < 0 && (src_off_y + pbox->y1 + dy) != pbox->y1) {
- /* Do a xdir = ydir = 1 blit instead. */
- if (dirsetup != 1) {
- if (dirsetup != 0)
- pExaScr->info->DoneCopy(pDstPixmap);
- dirsetup = 1;
- if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap,
- pDstPixmap,
- 1, 1,
- pGC ? pGC->alu : GXcopy,
- pGC ? pGC->planemask :
- FB_ALLONES))
- return FALSE;
- }
- (*pExaScr->info->Copy)(pDstPixmap,
- src_off_x + pbox->x1 + dx,
- src_off_y + pbox->y1 + dy,
- dst_off_x + pbox->x1,
- dst_off_y + pbox->y1,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- } else if (dx >= 0) {
- /*
- * xdir = 1, ydir = -1.
- * Perform line-by-line xdir = ydir = 1 blits, going up.
- */
- int i;
- if (dirsetup != 1) {
- if (dirsetup != 0)
- pExaScr->info->DoneCopy(pDstPixmap);
- dirsetup = 1;
- if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap,
- pDstPixmap,
- 1, 1,
- pGC ? pGC->alu : GXcopy,
- pGC ? pGC->planemask :
- FB_ALLONES))
- return FALSE;
- }
- for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
- (*pExaScr->info->Copy)(pDstPixmap,
- src_off_x + pbox->x1 + dx,
- src_off_y + pbox->y1 + dy + i,
- dst_off_x + pbox->x1,
- dst_off_y + pbox->y1 + i,
- pbox->x2 - pbox->x1, 1);
- } else {
- /*
- * xdir = -1, ydir = 1.
- * Perform line-by-line xdir = ydir = -1 blits, going down.
- */
- int i;
- if (dirsetup != -1) {
- if (dirsetup != 0)
- pExaScr->info->DoneCopy(pDstPixmap);
- dirsetup = -1;
- if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap,
- pDstPixmap,
- -1, -1,
- pGC ? pGC->alu : GXcopy,
- pGC ? pGC->planemask :
- FB_ALLONES))
- return FALSE;
- }
- for (i = 0; i < pbox->y2 - pbox->y1; i++)
- (*pExaScr->info->Copy)(pDstPixmap,
- src_off_x + pbox->x1 + dx,
- src_off_y + pbox->y1 + dy + i,
- dst_off_x + pbox->x1,
- dst_off_y + pbox->y1 + i,
- pbox->x2 - pbox->x1, 1);
- }
+ if (dx >= 0 && (src_off_y + pbox->y1 + dy) != pbox->y1) {
+ /* Do a xdir = ydir = -1 blit instead. */
+ if (dirsetup != -1) {
+ if (dirsetup != 0)
+ pExaScr->info->DoneCopy(pDstPixmap);
+ dirsetup = -1;
+ if (!(*pExaScr->info->PrepareCopy) (pSrcPixmap,
+ pDstPixmap,
+ -1, -1,
+ pGC ? pGC->alu : GXcopy,
+ pGC ? pGC->planemask :
+ FB_ALLONES))
+ return FALSE;
+ }
+ (*pExaScr->info->Copy) (pDstPixmap,
+ src_off_x + pbox->x1 + dx,
+ src_off_y + pbox->y1 + dy,
+ dst_off_x + pbox->x1,
+ dst_off_y + pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ }
+ else if (dx < 0 && (src_off_y + pbox->y1 + dy) != pbox->y1) {
+ /* Do a xdir = ydir = 1 blit instead. */
+ if (dirsetup != 1) {
+ if (dirsetup != 0)
+ pExaScr->info->DoneCopy(pDstPixmap);
+ dirsetup = 1;
+ if (!(*pExaScr->info->PrepareCopy) (pSrcPixmap,
+ pDstPixmap,
+ 1, 1,
+ pGC ? pGC->alu : GXcopy,
+ pGC ? pGC->planemask :
+ FB_ALLONES))
+ return FALSE;
+ }
+ (*pExaScr->info->Copy) (pDstPixmap,
+ src_off_x + pbox->x1 + dx,
+ src_off_y + pbox->y1 + dy,
+ dst_off_x + pbox->x1,
+ dst_off_y + pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ }
+ else if (dx >= 0) {
+ /*
+ * xdir = 1, ydir = -1.
+ * Perform line-by-line xdir = ydir = 1 blits, going up.
+ */
+ int i;
+
+ if (dirsetup != 1) {
+ if (dirsetup != 0)
+ pExaScr->info->DoneCopy(pDstPixmap);
+ dirsetup = 1;
+ if (!(*pExaScr->info->PrepareCopy) (pSrcPixmap,
+ pDstPixmap,
+ 1, 1,
+ pGC ? pGC->alu : GXcopy,
+ pGC ? pGC->planemask :
+ FB_ALLONES))
+ return FALSE;
+ }
+ for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
+ (*pExaScr->info->Copy) (pDstPixmap,
+ src_off_x + pbox->x1 + dx,
+ src_off_y + pbox->y1 + dy + i,
+ dst_off_x + pbox->x1,
+ dst_off_y + pbox->y1 + i,
+ pbox->x2 - pbox->x1, 1);
+ }
+ else {
+ /*
+ * xdir = -1, ydir = 1.
+ * Perform line-by-line xdir = ydir = -1 blits, going down.
+ */
+ int i;
+
+ if (dirsetup != -1) {
+ if (dirsetup != 0)
+ pExaScr->info->DoneCopy(pDstPixmap);
+ dirsetup = -1;
+ if (!(*pExaScr->info->PrepareCopy) (pSrcPixmap,
+ pDstPixmap,
+ -1, -1,
+ pGC ? pGC->alu : GXcopy,
+ pGC ? pGC->planemask :
+ FB_ALLONES))
+ return FALSE;
+ }
+ for (i = 0; i < pbox->y2 - pbox->y1; i++)
+ (*pExaScr->info->Copy) (pDstPixmap,
+ src_off_x + pbox->x1 + dx,
+ src_off_y + pbox->y1 + dy + i,
+ dst_off_x + pbox->x1,
+ dst_off_y + pbox->y1 + i,
+ pbox->x2 - pbox->x1, 1);
+ }
}
if (dirsetup != 0)
- pExaScr->info->DoneCopy(pDstPixmap);
+ pExaScr->info->DoneCopy(pDstPixmap);
exaMarkSync(pDstDrawable->pScreen);
return TRUE;
}
Bool
-exaHWCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown)
+exaHWCopyNtoN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox, int dx, int dy, Bool reverse, Bool upsidedown)
{
- ExaScreenPriv (pDstDrawable->pScreen);
+ ExaScreenPriv(pDstDrawable->pScreen);
PixmapPtr pSrcPixmap, pDstPixmap;
ExaPixmapPrivPtr pSrcExaPixmap, pDstExaPixmap;
- int src_off_x, src_off_y;
- int dst_off_x, dst_off_y;
+ int src_off_x, src_off_y;
+ int dst_off_x, dst_off_y;
RegionPtr srcregion = NULL, dstregion = NULL;
xRectangle *rects;
Bool ret = TRUE;
/* avoid doing copy operations if no boxes */
if (nbox == 0)
- return TRUE;
+ return TRUE;
- pSrcPixmap = exaGetDrawablePixmap (pSrcDrawable);
- pDstPixmap = exaGetDrawablePixmap (pDstDrawable);
+ pSrcPixmap = exaGetDrawablePixmap(pSrcDrawable);
+ pDstPixmap = exaGetDrawablePixmap(pDstDrawable);
- exaGetDrawableDeltas (pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y);
- exaGetDrawableDeltas (pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y);
+ exaGetDrawableDeltas(pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y);
+ exaGetDrawableDeltas(pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y);
rects = malloc(nbox * sizeof(xRectangle));
if (rects) {
- int i;
- int ordering;
-
- for (i = 0; i < nbox; i++) {
- rects[i].x = pbox[i].x1 + dx + src_off_x;
- rects[i].y = pbox[i].y1 + dy + src_off_y;
- rects[i].width = pbox[i].x2 - pbox[i].x1;
- rects[i].height = pbox[i].y2 - pbox[i].y1;
- }
-
- /* This must match the RegionCopy() logic for reversing rect order */
- if (nbox == 1 || (dx > 0 && dy > 0) ||
- (pDstDrawable != pSrcDrawable &&
- (pDstDrawable->type != DRAWABLE_WINDOW ||
- pSrcDrawable->type != DRAWABLE_WINDOW)))
- ordering = CT_YXBANDED;
- else
- ordering = CT_UNSORTED;
-
- srcregion = RegionFromRects(nbox, rects, ordering);
- free(rects);
-
- if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
- pGC->fillStyle, pGC->alu,
- pGC->clientClipType)) {
- dstregion = RegionCreate(NullBox, 0);
- RegionCopy(dstregion, srcregion);
- RegionTranslate(dstregion, dst_off_x - dx - src_off_x,
- dst_off_y - dy - src_off_y);
- }
- }
+ int i;
+ int ordering;
+
+ for (i = 0; i < nbox; i++) {
+ rects[i].x = pbox[i].x1 + dx + src_off_x;
+ rects[i].y = pbox[i].y1 + dy + src_off_y;
+ rects[i].width = pbox[i].x2 - pbox[i].x1;
+ rects[i].height = pbox[i].y2 - pbox[i].y1;
+ }
+ /* This must match the RegionCopy() logic for reversing rect order */
+ if (nbox == 1 || (dx > 0 && dy > 0) ||
+ (pDstDrawable != pSrcDrawable &&
+ (pDstDrawable->type != DRAWABLE_WINDOW ||
+ pSrcDrawable->type != DRAWABLE_WINDOW)))
+ ordering = CT_YXBANDED;
+ else
+ ordering = CT_UNSORTED;
+
+ srcregion = RegionFromRects(nbox, rects, ordering);
+ free(rects);
+
+ if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
+ pGC->fillStyle, pGC->alu,
+ pGC->clientClipType)) {
+ dstregion = RegionCreate(NullBox, 0);
+ RegionCopy(dstregion, srcregion);
+ RegionTranslate(dstregion, dst_off_x - dx - src_off_x,
+ dst_off_y - dy - src_off_y);
+ }
+ }
- pSrcExaPixmap = ExaGetPixmapPriv (pSrcPixmap);
- pDstExaPixmap = ExaGetPixmapPriv (pDstPixmap);
+ pSrcExaPixmap = ExaGetPixmapPriv(pSrcPixmap);
+ pDstExaPixmap = ExaGetPixmapPriv(pDstPixmap);
/* Check whether the accelerator can use this pixmap.
* If the pitch of the pixmaps is out of range, there's nothing
@@ -439,7 +430,7 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
*/
if (pSrcExaPixmap->accel_blocked & EXA_RANGE_PITCH ||
pDstExaPixmap->accel_blocked & EXA_RANGE_PITCH)
- goto fallback;
+ goto fallback;
/* If the width or the height of either of the pixmaps
* is out of range, check whether the boxes are actually out of the
@@ -463,158 +454,167 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
}
if (pExaScr->do_migration) {
- ExaMigrationRec pixmaps[2];
-
- pixmaps[0].as_dst = TRUE;
- pixmaps[0].as_src = FALSE;
- pixmaps[0].pPix = pDstPixmap;
- pixmaps[0].pReg = dstregion;
- pixmaps[1].as_dst = FALSE;
- pixmaps[1].as_src = TRUE;
- pixmaps[1].pPix = pSrcPixmap;
- pixmaps[1].pReg = srcregion;
-
- exaDoMigration (pixmaps, 2, TRUE);
+ ExaMigrationRec pixmaps[2];
+
+ pixmaps[0].as_dst = TRUE;
+ pixmaps[0].as_src = FALSE;
+ pixmaps[0].pPix = pDstPixmap;
+ pixmaps[0].pReg = dstregion;
+ pixmaps[1].as_dst = FALSE;
+ pixmaps[1].as_src = TRUE;
+ pixmaps[1].pPix = pSrcPixmap;
+ pixmaps[1].pReg = srcregion;
+
+ exaDoMigration(pixmaps, 2, TRUE);
}
/* Mixed directions must be handled specially if the card is lame */
if ((pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS) &&
- reverse != upsidedown) {
- if (exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox,
- dx, dy))
- goto out;
- goto fallback;
+ reverse != upsidedown) {
+ if (exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox,
+ dx, dy))
+ goto out;
+ goto fallback;
}
if (exaPixmapHasGpuCopy(pDstPixmap)) {
- /* Normal blitting. */
- if (exaPixmapHasGpuCopy(pSrcPixmap)) {
- if (!(*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap, reverse ? -1 : 1,
- upsidedown ? -1 : 1,
- pGC ? pGC->alu : GXcopy,
- pGC ? pGC->planemask : FB_ALLONES)) {
- goto fallback;
- }
-
- while (nbox--)
- {
- (*pExaScr->info->Copy) (pDstPixmap,
- pbox->x1 + dx + src_off_x,
- pbox->y1 + dy + src_off_y,
- pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- pbox++;
- }
-
- (*pExaScr->info->DoneCopy) (pDstPixmap);
- exaMarkSync (pDstDrawable->pScreen);
- /* UTS: mainly for SHM PutImage's secondary path.
- *
- * Only taking this path for directly accessible pixmaps.
- */
- } else if (!pDstExaPixmap->pDamage && pSrcExaPixmap->sys_ptr) {
- int bpp = pSrcDrawable->bitsPerPixel;
- int src_stride = exaGetPixmapPitch(pSrcPixmap);
- CARD8 *src = NULL;
-
- if (!pExaScr->info->UploadToScreen)
- goto fallback;
-
- if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
- goto fallback;
-
- if (pSrcDrawable->bitsPerPixel < 8)
- goto fallback;
-
- if (pGC && !(pGC->alu == GXcopy && EXA_PM_IS_SOLID(pSrcDrawable, pGC->planemask)))
- goto fallback;
-
- while (nbox--)
- {
- src = pSrcExaPixmap->sys_ptr + (pbox->y1 + dy + src_off_y) * src_stride + (pbox->x1 + dx + src_off_x) * (bpp / 8);
- if (!pExaScr->info->UploadToScreen(pDstPixmap, pbox->x1 + dst_off_x,
- pbox->y1 + dst_off_y, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- (char *) src, src_stride))
- goto fallback;
-
- pbox++;
- }
- } else
- goto fallback;
- } else
- goto fallback;
+ /* Normal blitting. */
+ if (exaPixmapHasGpuCopy(pSrcPixmap)) {
+ if (!(*pExaScr->info->PrepareCopy)
+ (pSrcPixmap, pDstPixmap, reverse ? -1 : 1, upsidedown ? -1 : 1,
+ pGC ? pGC->alu : GXcopy, pGC ? pGC->planemask : FB_ALLONES)) {
+ goto fallback;
+ }
+
+ while (nbox--) {
+ (*pExaScr->info->Copy) (pDstPixmap,
+ pbox->x1 + dx + src_off_x,
+ pbox->y1 + dy + src_off_y,
+ pbox->x1 + dst_off_x,
+ pbox->y1 + dst_off_y,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ (*pExaScr->info->DoneCopy) (pDstPixmap);
+ exaMarkSync(pDstDrawable->pScreen);
+ /* UTS: mainly for SHM PutImage's secondary path.
+ *
+ * Only taking this path for directly accessible pixmaps.
+ */
+ }
+ else if (!pDstExaPixmap->pDamage && pSrcExaPixmap->sys_ptr) {
+ int bpp = pSrcDrawable->bitsPerPixel;
+ int src_stride = exaGetPixmapPitch(pSrcPixmap);
+ CARD8 *src = NULL;
+
+ if (!pExaScr->info->UploadToScreen)
+ goto fallback;
+
+ if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
+ goto fallback;
+
+ if (pSrcDrawable->bitsPerPixel < 8)
+ goto fallback;
+
+ if (pGC &&
+ !(pGC->alu == GXcopy &&
+ EXA_PM_IS_SOLID(pSrcDrawable, pGC->planemask)))
+ goto fallback;
+
+ while (nbox--) {
+ src =
+ pSrcExaPixmap->sys_ptr + (pbox->y1 + dy +
+ src_off_y) * src_stride +
+ (pbox->x1 + dx + src_off_x) * (bpp / 8);
+ if (!pExaScr->info->
+ UploadToScreen(pDstPixmap, pbox->x1 + dst_off_x,
+ pbox->y1 + dst_off_y, pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1, (char *) src,
+ src_stride))
+ goto fallback;
+
+ pbox++;
+ }
+ }
+ else
+ goto fallback;
+ }
+ else
+ goto fallback;
goto out;
-fallback:
+ fallback:
ret = FALSE;
-out:
+ out:
if (dstregion) {
- RegionUninit(dstregion);
- RegionDestroy(dstregion);
+ RegionUninit(dstregion);
+ RegionDestroy(dstregion);
}
if (srcregion) {
- RegionUninit(srcregion);
- RegionDestroy(srcregion);
+ RegionUninit(srcregion);
+ RegionDestroy(srcregion);
}
return ret;
}
void
-exaCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
+exaCopyNtoN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
{
ExaScreenPriv(pDstDrawable->pScreen);
if (pExaScr->fallback_counter ||
- (pExaScr->fallback_flags & EXA_FALLBACK_COPYWINDOW))
- return;
+ (pExaScr->fallback_flags & EXA_FALLBACK_COPYWINDOW))
+ return;
- if (exaHWCopyNtoN(pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy, reverse, upsidedown))
- return;
+ if (exaHWCopyNtoN
+ (pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy, reverse,
+ upsidedown))
+ return;
/* This is a CopyWindow, it's cleaner to fallback at the original call. */
if (pExaScr->fallback_flags & EXA_ACCEL_COPYWINDOW) {
- pExaScr->fallback_flags |= EXA_FALLBACK_COPYWINDOW;
- return;
+ pExaScr->fallback_flags |= EXA_FALLBACK_COPYWINDOW;
+ return;
}
/* fallback */
- ExaCheckCopyNtoN(pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy, reverse, upsidedown, bitplane, closure);
+ ExaCheckCopyNtoN(pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy,
+ reverse, upsidedown, bitplane, closure);
}
RegionPtr
exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty)
+ int srcx, int srcy, int width, int height, int dstx, int dsty)
{
- ExaScreenPriv (pDstDrawable->pScreen);
+ ExaScreenPriv(pDstDrawable->pScreen);
if (pExaScr->fallback_counter || pExaScr->swappedOut) {
- return ExaCheckCopyArea(pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height, dstx, dsty);
+ return ExaCheckCopyArea(pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height, dstx, dsty);
}
- return miDoCopy (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, exaCopyNtoN, 0, NULL);
+ return miDoCopy(pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height,
+ dstx, dsty, exaCopyNtoN, 0, NULL);
}
static void
exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
- DDXPointPtr ppt)
+ DDXPointPtr ppt)
{
- ExaScreenPriv (pDrawable->pScreen);
+ ExaScreenPriv(pDrawable->pScreen);
int i;
xRectangle *prect;
@@ -622,20 +622,20 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
* points.
*/
if (pExaScr->fallback_counter || pGC->fillStyle != FillSolid) {
- ExaCheckPolyPoint(pDrawable, pGC, mode, npt, ppt);
- return;
+ ExaCheckPolyPoint(pDrawable, pGC, mode, npt, ppt);
+ return;
}
prect = malloc(sizeof(xRectangle) * npt);
for (i = 0; i < npt; i++) {
- prect[i].x = ppt[i].x;
- prect[i].y = ppt[i].y;
- if (i > 0 && mode == CoordModePrevious) {
- prect[i].x += prect[i - 1].x;
- prect[i].y += prect[i - 1].y;
- }
- prect[i].width = 1;
- prect[i].height = 1;
+ prect[i].x = ppt[i].x;
+ prect[i].y = ppt[i].y;
+ if (i > 0 && mode == CoordModePrevious) {
+ prect[i].x += prect[i - 1].x;
+ prect[i].y += prect[i - 1].y;
+ }
+ prect[i].width = 1;
+ prect[i].height = 1;
}
pGC->ops->PolyFillRect(pDrawable, pGC, npt, prect);
free(prect);
@@ -648,23 +648,23 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
*/
static void
exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
- DDXPointPtr ppt)
+ DDXPointPtr ppt)
{
- ExaScreenPriv (pDrawable->pScreen);
+ ExaScreenPriv(pDrawable->pScreen);
xRectangle *prect;
int x1, x2, y1, y2;
int i;
if (pExaScr->fallback_counter) {
- ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt);
- return;
+ ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt);
+ return;
}
/* Don't try to do wide lines or non-solid fill style. */
if (pGC->lineWidth != 0 || pGC->lineStyle != LineSolid ||
- pGC->fillStyle != FillSolid) {
- ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt);
- return;
+ pGC->fillStyle != FillSolid) {
+ ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt);
+ return;
}
prect = malloc(sizeof(xRectangle) * (npt - 1));
@@ -672,37 +672,40 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
y1 = ppt[0].y;
/* If we have any non-horizontal/vertical, fall back. */
for (i = 0; i < npt - 1; i++) {
- if (mode == CoordModePrevious) {
- x2 = x1 + ppt[i + 1].x;
- y2 = y1 + ppt[i + 1].y;
- } else {
- x2 = ppt[i + 1].x;
- y2 = ppt[i + 1].y;
- }
-
- if (x1 != x2 && y1 != y2) {
- free(prect);
- ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt);
- return;
- }
-
- if (x1 < x2) {
- prect[i].x = x1;
- prect[i].width = x2 - x1 + 1;
- } else {
- prect[i].x = x2;
- prect[i].width = x1 - x2 + 1;
- }
- if (y1 < y2) {
- prect[i].y = y1;
- prect[i].height = y2 - y1 + 1;
- } else {
- prect[i].y = y2;
- prect[i].height = y1 - y2 + 1;
- }
-
- x1 = x2;
- y1 = y2;
+ if (mode == CoordModePrevious) {
+ x2 = x1 + ppt[i + 1].x;
+ y2 = y1 + ppt[i + 1].y;
+ }
+ else {
+ x2 = ppt[i + 1].x;
+ y2 = ppt[i + 1].y;
+ }
+
+ if (x1 != x2 && y1 != y2) {
+ free(prect);
+ ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt);
+ return;
+ }
+
+ if (x1 < x2) {
+ prect[i].x = x1;
+ prect[i].width = x2 - x1 + 1;
+ }
+ else {
+ prect[i].x = x2;
+ prect[i].width = x1 - x2 + 1;
+ }
+ if (y1 < y2) {
+ prect[i].y = y1;
+ prect[i].height = y2 - y1 + 1;
+ }
+ else {
+ prect[i].y = y2;
+ prect[i].height = y1 - y2 + 1;
+ }
+
+ x1 = x2;
+ y1 = y2;
}
pGC->ops->PolyFillRect(pDrawable, pGC, npt - 1, prect);
free(prect);
@@ -714,80 +717,78 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
* acceleration if so.
*/
static void
-exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
- xSegment *pSeg)
+exaPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg)
{
- ExaScreenPriv (pDrawable->pScreen);
+ ExaScreenPriv(pDrawable->pScreen);
xRectangle *prect;
int i;
/* Don't try to do wide lines or non-solid fill style. */
if (pExaScr->fallback_counter || pGC->lineWidth != 0 ||
- pGC->lineStyle != LineSolid || pGC->fillStyle != FillSolid)
- {
- ExaCheckPolySegment(pDrawable, pGC, nseg, pSeg);
- return;
+ pGC->lineStyle != LineSolid || pGC->fillStyle != FillSolid) {
+ ExaCheckPolySegment(pDrawable, pGC, nseg, pSeg);
+ return;
}
/* If we have any non-horizontal/vertical, fall back. */
for (i = 0; i < nseg; i++) {
- if (pSeg[i].x1 != pSeg[i].x2 && pSeg[i].y1 != pSeg[i].y2) {
- ExaCheckPolySegment(pDrawable, pGC, nseg, pSeg);
- return;
- }
+ if (pSeg[i].x1 != pSeg[i].x2 && pSeg[i].y1 != pSeg[i].y2) {
+ ExaCheckPolySegment(pDrawable, pGC, nseg, pSeg);
+ return;
+ }
}
prect = malloc(sizeof(xRectangle) * nseg);
for (i = 0; i < nseg; i++) {
- if (pSeg[i].x1 < pSeg[i].x2) {
- prect[i].x = pSeg[i].x1;
- prect[i].width = pSeg[i].x2 - pSeg[i].x1 + 1;
- } else {
- prect[i].x = pSeg[i].x2;
- prect[i].width = pSeg[i].x1 - pSeg[i].x2 + 1;
- }
- if (pSeg[i].y1 < pSeg[i].y2) {
- prect[i].y = pSeg[i].y1;
- prect[i].height = pSeg[i].y2 - pSeg[i].y1 + 1;
- } else {
- prect[i].y = pSeg[i].y2;
- prect[i].height = pSeg[i].y1 - pSeg[i].y2 + 1;
- }
-
- /* don't paint last pixel */
- if (pGC->capStyle == CapNotLast) {
- if (prect[i].width == 1)
- prect[i].height--;
- else
- prect[i].width--;
- }
+ if (pSeg[i].x1 < pSeg[i].x2) {
+ prect[i].x = pSeg[i].x1;
+ prect[i].width = pSeg[i].x2 - pSeg[i].x1 + 1;
+ }
+ else {
+ prect[i].x = pSeg[i].x2;
+ prect[i].width = pSeg[i].x1 - pSeg[i].x2 + 1;
+ }
+ if (pSeg[i].y1 < pSeg[i].y2) {
+ prect[i].y = pSeg[i].y1;
+ prect[i].height = pSeg[i].y2 - pSeg[i].y1 + 1;
+ }
+ else {
+ prect[i].y = pSeg[i].y2;
+ prect[i].height = pSeg[i].y1 - pSeg[i].y2 + 1;
+ }
+
+ /* don't paint last pixel */
+ if (pGC->capStyle == CapNotLast) {
+ if (prect[i].width == 1)
+ prect[i].height--;
+ else
+ prect[i].width--;
+ }
}
pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect);
free(prect);
}
-static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion,
- Pixel pixel, CARD32 planemask, CARD32 alu,
- unsigned int clientClipType);
+static Bool exaFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion,
+ Pixel pixel, CARD32 planemask, CARD32 alu,
+ unsigned int clientClipType);
static void
-exaPolyFillRect(DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect)
+exaPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrect, xRectangle *prect)
{
- ExaScreenPriv (pDrawable->pScreen);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
- ExaPixmapPriv (pPixmap);
+ ExaScreenPriv(pDrawable->pScreen);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
+
+ ExaPixmapPriv(pPixmap);
register BoxPtr pbox;
- BoxPtr pextent;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1, fullY2;
- int partX1, partX2, partY1, partY2;
- int xoff, yoff;
- int xorg, yorg;
- int n;
+ BoxPtr pextent;
+ int extentX1, extentX2, extentY1, extentY2;
+ int fullX1, fullX2, fullY1, fullY2;
+ int partX1, partX2, partY1, partY2;
+ int xoff, yoff;
+ int xorg, yorg;
+ int n;
RegionPtr pReg = RegionFromRects(nrect, prect, CT_UNSORTED);
/* Compute intersection of rects and clip region */
@@ -795,62 +796,58 @@ exaPolyFillRect(DrawablePtr pDrawable,
RegionIntersect(pReg, pClip, pReg);
if (!RegionNumRects(pReg)) {
- goto out;
+ goto out;
}
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
if (pExaScr->fallback_counter || pExaScr->swappedOut ||
- pExaPixmap->accel_blocked)
- {
- goto fallback;
+ pExaPixmap->accel_blocked) {
+ goto fallback;
}
/* For ROPs where overlaps don't matter, convert rectangles to region and
* call exaFillRegion{Solid,Tiled}.
*/
if ((pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled) &&
- (nrect == 1 || pGC->alu == GXcopy || pGC->alu == GXclear ||
- pGC->alu == GXnoop || pGC->alu == GXcopyInverted ||
- pGC->alu == GXset)) {
- if (((pGC->fillStyle == FillSolid || pGC->tileIsPixel) &&
- exaFillRegionSolid(pDrawable, pReg, pGC->fillStyle == FillSolid ?
- pGC->fgPixel : pGC->tile.pixel, pGC->planemask,
- pGC->alu, pGC->clientClipType)) ||
- (pGC->fillStyle == FillTiled && !pGC->tileIsPixel &&
- exaFillRegionTiled(pDrawable, pReg, pGC->tile.pixmap, &pGC->patOrg,
- pGC->planemask, pGC->alu,
- pGC->clientClipType))) {
- goto out;
- }
+ (nrect == 1 || pGC->alu == GXcopy || pGC->alu == GXclear ||
+ pGC->alu == GXnoop || pGC->alu == GXcopyInverted ||
+ pGC->alu == GXset)) {
+ if (((pGC->fillStyle == FillSolid || pGC->tileIsPixel) &&
+ exaFillRegionSolid(pDrawable, pReg, pGC->fillStyle == FillSolid ?
+ pGC->fgPixel : pGC->tile.pixel, pGC->planemask,
+ pGC->alu, pGC->clientClipType)) ||
+ (pGC->fillStyle == FillTiled && !pGC->tileIsPixel &&
+ exaFillRegionTiled(pDrawable, pReg, pGC->tile.pixmap, &pGC->patOrg,
+ pGC->planemask, pGC->alu,
+ pGC->clientClipType))) {
+ goto out;
+ }
}
if (pGC->fillStyle != FillSolid &&
- !(pGC->tileIsPixel && pGC->fillStyle == FillTiled))
- {
- goto fallback;
+ !(pGC->tileIsPixel && pGC->fillStyle == FillTiled)) {
+ goto fallback;
}
if (pExaScr->do_migration) {
- ExaMigrationRec pixmaps[1];
+ ExaMigrationRec pixmaps[1];
- pixmaps[0].as_dst = TRUE;
- pixmaps[0].as_src = FALSE;
- pixmaps[0].pPix = pPixmap;
- pixmaps[0].pReg = NULL;
+ pixmaps[0].as_dst = TRUE;
+ pixmaps[0].as_src = FALSE;
+ pixmaps[0].pPix = pPixmap;
+ pixmaps[0].pReg = NULL;
- exaDoMigration (pixmaps, 1, TRUE);
+ exaDoMigration(pixmaps, 1, TRUE);
}
- if (!exaPixmapHasGpuCopy (pPixmap) ||
- !(*pExaScr->info->PrepareSolid) (pPixmap,
- pGC->alu,
- pGC->planemask,
- pGC->fgPixel))
- {
-fallback:
- ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect);
- goto out;
+ if (!exaPixmapHasGpuCopy(pPixmap) ||
+ !(*pExaScr->info->PrepareSolid) (pPixmap,
+ pGC->alu,
+ pGC->planemask, pGC->fgPixel)) {
+ fallback:
+ ExaCheckPolyFillRect(pDrawable, pGC, nrect, prect);
+ goto out;
}
xorg = pDrawable->x;
@@ -861,72 +858,68 @@ fallback:
extentY1 = pextent->y1;
extentX2 = pextent->x2;
extentY2 = pextent->y2;
- while (nrect--)
- {
- fullX1 = prect->x + xorg;
- fullY1 = prect->y + yorg;
- fullX2 = fullX1 + (int) prect->width;
- fullY2 = fullY1 + (int) prect->height;
- prect++;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullY1 < extentY1)
- fullY1 = extentY1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullY2 > extentY2)
- fullY2 = extentY2;
-
- if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
- continue;
- n = RegionNumRects (pClip);
- if (n == 1)
- {
- (*pExaScr->info->Solid) (pPixmap,
- fullX1 + xoff, fullY1 + yoff,
- fullX2 + xoff, fullY2 + yoff);
- }
- else
- {
- pbox = RegionRects(pClip);
- /*
- * clip the rectangle to each box in the clip region
- * this is logically equivalent to calling Intersect(),
- * but rectangles may overlap each other here.
- */
- while(n--)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partY1 = pbox->y1;
- if (partY1 < fullY1)
- partY1 = fullY1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- partY2 = pbox->y2;
- if (partY2 > fullY2)
- partY2 = fullY2;
-
- pbox++;
-
- if (partX1 < partX2 && partY1 < partY2) {
- (*pExaScr->info->Solid) (pPixmap,
- partX1 + xoff, partY1 + yoff,
- partX2 + xoff, partY2 + yoff);
- }
- }
- }
+ while (nrect--) {
+ fullX1 = prect->x + xorg;
+ fullY1 = prect->y + yorg;
+ fullX2 = fullX1 + (int) prect->width;
+ fullY2 = fullY1 + (int) prect->height;
+ prect++;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+
+ if (fullY1 < extentY1)
+ fullY1 = extentY1;
+
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullY2 > extentY2)
+ fullY2 = extentY2;
+
+ if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
+ continue;
+ n = RegionNumRects(pClip);
+ if (n == 1) {
+ (*pExaScr->info->Solid) (pPixmap,
+ fullX1 + xoff, fullY1 + yoff,
+ fullX2 + xoff, fullY2 + yoff);
+ }
+ else {
+ pbox = RegionRects(pClip);
+ /*
+ * clip the rectangle to each box in the clip region
+ * this is logically equivalent to calling Intersect(),
+ * but rectangles may overlap each other here.
+ */
+ while (n--) {
+ partX1 = pbox->x1;
+ if (partX1 < fullX1)
+ partX1 = fullX1;
+ partY1 = pbox->y1;
+ if (partY1 < fullY1)
+ partY1 = fullY1;
+ partX2 = pbox->x2;
+ if (partX2 > fullX2)
+ partX2 = fullX2;
+ partY2 = pbox->y2;
+ if (partY2 > fullY2)
+ partY2 = fullY2;
+
+ pbox++;
+
+ if (partX1 < partX2 && partY1 < partY2) {
+ (*pExaScr->info->Solid) (pPixmap,
+ partX1 + xoff, partY1 + yoff,
+ partX2 + xoff, partY2 + yoff);
+ }
+ }
+ }
}
(*pExaScr->info->DoneSolid) (pPixmap);
exaMarkSync(pDrawable->pScreen);
-out:
+ out:
RegionUninit(pReg);
RegionDestroy(pReg);
}
@@ -957,9 +950,10 @@ const GCOps exaOps = {
void
exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- RegionRec rgnDst;
- int dx, dy;
- PixmapPtr pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
+ RegionRec rgnDst;
+ int dx, dy;
+ PixmapPtr pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
+
ExaScreenPriv(pWin->drawable.pScreen);
dx = ptOldOrg.x - pWin->drawable.x;
@@ -971,38 +965,37 @@ exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
#ifdef COMPOSITE
if (pPixmap->screen_x || pPixmap->screen_y)
- RegionTranslate(&rgnDst,
- -pPixmap->screen_x, -pPixmap->screen_y);
+ RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y);
#endif
if (pExaScr->fallback_counter) {
- pExaScr->fallback_flags |= EXA_FALLBACK_COPYWINDOW;
- goto fallback;
+ pExaScr->fallback_flags |= EXA_FALLBACK_COPYWINDOW;
+ goto fallback;
}
pExaScr->fallback_flags |= EXA_ACCEL_COPYWINDOW;
- miCopyRegion (&pPixmap->drawable, &pPixmap->drawable,
- NULL,
- &rgnDst, dx, dy, exaCopyNtoN, 0, NULL);
+ miCopyRegion(&pPixmap->drawable, &pPixmap->drawable,
+ NULL, &rgnDst, dx, dy, exaCopyNtoN, 0, NULL);
pExaScr->fallback_flags &= ~EXA_ACCEL_COPYWINDOW;
-fallback:
+ fallback:
RegionUninit(&rgnDst);
if (pExaScr->fallback_flags & EXA_FALLBACK_COPYWINDOW) {
- pExaScr->fallback_flags &= ~EXA_FALLBACK_COPYWINDOW;
- RegionTranslate(prgnSrc, dx, dy);
- ExaCheckCopyWindow(pWin, ptOldOrg, prgnSrc);
+ pExaScr->fallback_flags &= ~EXA_FALLBACK_COPYWINDOW;
+ RegionTranslate(prgnSrc, dx, dy);
+ ExaCheckCopyWindow(pWin, ptOldOrg, prgnSrc);
}
}
static Bool
-exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
- CARD32 planemask, CARD32 alu, unsigned int clientClipType)
+exaFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
+ CARD32 planemask, CARD32 alu, unsigned int clientClipType)
{
ExaScreenPriv(pDrawable->pScreen);
- PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
- ExaPixmapPriv (pPixmap);
+ PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
+
+ ExaPixmapPriv(pPixmap);
int xoff, yoff;
Bool ret = FALSE;
@@ -1010,69 +1003,67 @@ exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
RegionTranslate(pRegion, xoff, yoff);
if (pExaScr->fallback_counter || pExaPixmap->accel_blocked)
- goto out;
+ goto out;
if (pExaScr->do_migration) {
- ExaMigrationRec pixmaps[1];
+ ExaMigrationRec pixmaps[1];
- pixmaps[0].as_dst = TRUE;
- pixmaps[0].as_src = FALSE;
- pixmaps[0].pPix = pPixmap;
- pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillSolid,
- alu, clientClipType) ? NULL : pRegion;
+ pixmaps[0].as_dst = TRUE;
+ pixmaps[0].as_src = FALSE;
+ pixmaps[0].pPix = pPixmap;
+ pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillSolid,
+ alu,
+ clientClipType) ? NULL :
+ pRegion;
- exaDoMigration (pixmaps, 1, TRUE);
+ exaDoMigration(pixmaps, 1, TRUE);
}
- if (exaPixmapHasGpuCopy (pPixmap) &&
- (*pExaScr->info->PrepareSolid) (pPixmap, alu, planemask, pixel))
- {
- int nbox;
- BoxPtr pBox;
-
- nbox = RegionNumRects (pRegion);
- pBox = RegionRects (pRegion);
-
- while (nbox--)
- {
- (*pExaScr->info->Solid) (pPixmap, pBox->x1, pBox->y1, pBox->x2,
- pBox->y2);
- pBox++;
- }
- (*pExaScr->info->DoneSolid) (pPixmap);
- exaMarkSync(pDrawable->pScreen);
-
- if (pExaPixmap->pDamage &&
- pExaPixmap->sys_ptr && pDrawable->type == DRAWABLE_PIXMAP &&
- pDrawable->width == 1 && pDrawable->height == 1 &&
- pDrawable->bitsPerPixel != 24) {
- ExaPixmapPriv(pPixmap);
- RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
-
- switch (pDrawable->bitsPerPixel) {
- case 32:
- *(CARD32*)pExaPixmap->sys_ptr = pixel;
- break;
- case 16:
- *(CARD16*)pExaPixmap->sys_ptr = pixel;
- break;
- case 8:
- case 4:
- case 1:
- *(CARD8*)pExaPixmap->sys_ptr = pixel;
- }
-
- RegionUnion(&pExaPixmap->validSys, &pExaPixmap->validSys,
- pRegion);
- RegionUnion(&pExaPixmap->validFB, &pExaPixmap->validFB,
- pRegion);
- RegionSubtract(pending_damage, pending_damage, pRegion);
- }
-
- ret = TRUE;
+ if (exaPixmapHasGpuCopy(pPixmap) &&
+ (*pExaScr->info->PrepareSolid) (pPixmap, alu, planemask, pixel)) {
+ int nbox;
+ BoxPtr pBox;
+
+ nbox = RegionNumRects(pRegion);
+ pBox = RegionRects(pRegion);
+
+ while (nbox--) {
+ (*pExaScr->info->Solid) (pPixmap, pBox->x1, pBox->y1, pBox->x2,
+ pBox->y2);
+ pBox++;
+ }
+ (*pExaScr->info->DoneSolid) (pPixmap);
+ exaMarkSync(pDrawable->pScreen);
+
+ if (pExaPixmap->pDamage &&
+ pExaPixmap->sys_ptr && pDrawable->type == DRAWABLE_PIXMAP &&
+ pDrawable->width == 1 && pDrawable->height == 1 &&
+ pDrawable->bitsPerPixel != 24) {
+ ExaPixmapPriv(pPixmap);
+ RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
+
+ switch (pDrawable->bitsPerPixel) {
+ case 32:
+ *(CARD32 *) pExaPixmap->sys_ptr = pixel;
+ break;
+ case 16:
+ *(CARD16 *) pExaPixmap->sys_ptr = pixel;
+ break;
+ case 8:
+ case 4:
+ case 1:
+ *(CARD8 *) pExaPixmap->sys_ptr = pixel;
+ }
+
+ RegionUnion(&pExaPixmap->validSys, &pExaPixmap->validSys, pRegion);
+ RegionUnion(&pExaPixmap->validFB, &pExaPixmap->validFB, pRegion);
+ RegionSubtract(pending_damage, pending_damage, pRegion);
+ }
+
+ ret = TRUE;
}
-out:
+ out:
RegionTranslate(pRegion, -xoff, -yoff);
return ret;
@@ -1082,9 +1073,9 @@ out:
* Based on fbFillRegionTiled(), fbTile().
*/
Bool
-exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
- DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
- unsigned int clientClipType)
+exaFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
+ DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
+ unsigned int clientClipType)
{
ExaScreenPriv(pDrawable->pScreen);
PixmapPtr pPixmap;
@@ -1092,8 +1083,8 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
ExaPixmapPrivPtr pTileExaPixmap = ExaGetPixmapPriv(pTile);
int xoff, yoff;
int tileWidth, tileHeight;
- int nbox = RegionNumRects (pRegion);
- BoxPtr pBox = RegionRects (pRegion);
+ int nbox = RegionNumRects(pRegion);
+ BoxPtr pBox = RegionRects(pRegion);
Bool ret = FALSE;
int i;
@@ -1104,156 +1095,158 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
* FillRegionSolid, saving numerous copies.
*/
if (tileWidth == 1 && tileHeight == 1)
- return exaFillRegionSolid(pDrawable, pRegion,
- exaGetPixmapFirstPixel (pTile), planemask,
- alu, clientClipType);
+ return exaFillRegionSolid(pDrawable, pRegion,
+ exaGetPixmapFirstPixel(pTile), planemask,
+ alu, clientClipType);
- pPixmap = exaGetDrawablePixmap (pDrawable);
- pExaPixmap = ExaGetPixmapPriv (pPixmap);
+ pPixmap = exaGetDrawablePixmap(pDrawable);
+ pExaPixmap = ExaGetPixmapPriv(pPixmap);
if (pExaScr->fallback_counter || pExaPixmap->accel_blocked ||
- pTileExaPixmap->accel_blocked)
- return FALSE;
+ pTileExaPixmap->accel_blocked)
+ return FALSE;
if (pExaScr->do_migration) {
- ExaMigrationRec pixmaps[2];
-
- pixmaps[0].as_dst = TRUE;
- pixmaps[0].as_src = FALSE;
- pixmaps[0].pPix = pPixmap;
- pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
- alu, clientClipType) ? NULL : pRegion;
- pixmaps[1].as_dst = FALSE;
- pixmaps[1].as_src = TRUE;
- pixmaps[1].pPix = pTile;
- pixmaps[1].pReg = NULL;
-
- exaDoMigration (pixmaps, 2, TRUE);
+ ExaMigrationRec pixmaps[2];
+
+ pixmaps[0].as_dst = TRUE;
+ pixmaps[0].as_src = FALSE;
+ pixmaps[0].pPix = pPixmap;
+ pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
+ alu,
+ clientClipType) ? NULL :
+ pRegion;
+ pixmaps[1].as_dst = FALSE;
+ pixmaps[1].as_src = TRUE;
+ pixmaps[1].pPix = pTile;
+ pixmaps[1].pReg = NULL;
+
+ exaDoMigration(pixmaps, 2, TRUE);
}
- pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
+ pPixmap = exaGetOffscreenPixmap(pDrawable, &xoff, &yoff);
if (!pPixmap || !exaPixmapHasGpuCopy(pTile))
- return FALSE;
-
- if ((*pExaScr->info->PrepareCopy) (pTile, pPixmap, 1, 1, alu, planemask))
- {
- if (xoff || yoff)
- RegionTranslate(pRegion, xoff, yoff);
-
- for (i = 0; i < nbox; i++)
- {
- int height = pBox[i].y2 - pBox[i].y1;
- int dstY = pBox[i].y1;
- int tileY;
-
- if (alu == GXcopy)
- height = min(height, tileHeight);
-
- modulus(dstY - yoff - pDrawable->y - pPatOrg->y, tileHeight, tileY);
-
- while (height > 0) {
- int width = pBox[i].x2 - pBox[i].x1;
- int dstX = pBox[i].x1;
- int tileX;
- int h = tileHeight - tileY;
-
- if (alu == GXcopy)
- width = min(width, tileWidth);
-
- if (h > height)
- h = height;
- height -= h;
-
- modulus(dstX - xoff - pDrawable->x - pPatOrg->x, tileWidth,
- tileX);
-
- while (width > 0) {
- int w = tileWidth - tileX;
- if (w > width)
- w = width;
- width -= w;
-
- (*pExaScr->info->Copy) (pPixmap, tileX, tileY, dstX, dstY,
- w, h);
- dstX += w;
- tileX = 0;
- }
- dstY += h;
- tileY = 0;
- }
- }
- (*pExaScr->info->DoneCopy) (pPixmap);
-
- /* With GXcopy, we only need to do the basic algorithm up to the tile
- * size; then, we can just keep doubling the destination in each
- * direction until it fills the box. This way, the number of copy
- * operations is O(log(rx)) + O(log(ry)) instead of O(rx * ry), where
- * rx/ry is the ratio between box and tile width/height. This can make
- * a big difference if each driver copy incurs a significant constant
- * overhead.
- */
- if (alu != GXcopy)
- ret = TRUE;
- else {
- Bool more_copy = FALSE;
-
- for (i = 0; i < nbox; i++) {
- int dstX = pBox[i].x1 + tileWidth;
- int dstY = pBox[i].y1 + tileHeight;
-
- if ((dstX < pBox[i].x2) || (dstY < pBox[i].y2)) {
- more_copy = TRUE;
- break;
- }
- }
-
- if (more_copy == FALSE)
- ret = TRUE;
-
- if (more_copy && (*pExaScr->info->PrepareCopy) (pPixmap, pPixmap,
- 1, 1, alu, planemask)) {
- for (i = 0; i < nbox; i++)
- {
- int dstX = pBox[i].x1 + tileWidth;
- int dstY = pBox[i].y1 + tileHeight;
- int width = min(pBox[i].x2 - dstX, tileWidth);
- int height = min(pBox[i].y2 - pBox[i].y1, tileHeight);
-
- while (dstX < pBox[i].x2) {
- (*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
- dstX, pBox[i].y1, width, height);
- dstX += width;
- width = min(pBox[i].x2 - dstX, width * 2);
- }
-
- width = pBox[i].x2 - pBox[i].x1;
- height = min(pBox[i].y2 - dstY, tileHeight);
-
- while (dstY < pBox[i].y2) {
- (*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
- pBox[i].x1, dstY, width, height);
- dstY += height;
- height = min(pBox[i].y2 - dstY, height * 2);
- }
- }
-
- (*pExaScr->info->DoneCopy) (pPixmap);
-
- ret = TRUE;
- }
- }
-
- exaMarkSync(pDrawable->pScreen);
-
- if (xoff || yoff)
- RegionTranslate(pRegion, -xoff, -yoff);
+ return FALSE;
+
+ if ((*pExaScr->info->PrepareCopy) (pTile, pPixmap, 1, 1, alu, planemask)) {
+ if (xoff || yoff)
+ RegionTranslate(pRegion, xoff, yoff);
+
+ for (i = 0; i < nbox; i++) {
+ int height = pBox[i].y2 - pBox[i].y1;
+ int dstY = pBox[i].y1;
+ int tileY;
+
+ if (alu == GXcopy)
+ height = min(height, tileHeight);
+
+ modulus(dstY - yoff - pDrawable->y - pPatOrg->y, tileHeight, tileY);
+
+ while (height > 0) {
+ int width = pBox[i].x2 - pBox[i].x1;
+ int dstX = pBox[i].x1;
+ int tileX;
+ int h = tileHeight - tileY;
+
+ if (alu == GXcopy)
+ width = min(width, tileWidth);
+
+ if (h > height)
+ h = height;
+ height -= h;
+
+ modulus(dstX - xoff - pDrawable->x - pPatOrg->x, tileWidth,
+ tileX);
+
+ while (width > 0) {
+ int w = tileWidth - tileX;
+
+ if (w > width)
+ w = width;
+ width -= w;
+
+ (*pExaScr->info->Copy) (pPixmap, tileX, tileY, dstX, dstY,
+ w, h);
+ dstX += w;
+ tileX = 0;
+ }
+ dstY += h;
+ tileY = 0;
+ }
+ }
+ (*pExaScr->info->DoneCopy) (pPixmap);
+
+ /* With GXcopy, we only need to do the basic algorithm up to the tile
+ * size; then, we can just keep doubling the destination in each
+ * direction until it fills the box. This way, the number of copy
+ * operations is O(log(rx)) + O(log(ry)) instead of O(rx * ry), where
+ * rx/ry is the ratio between box and tile width/height. This can make
+ * a big difference if each driver copy incurs a significant constant
+ * overhead.
+ */
+ if (alu != GXcopy)
+ ret = TRUE;
+ else {
+ Bool more_copy = FALSE;
+
+ for (i = 0; i < nbox; i++) {
+ int dstX = pBox[i].x1 + tileWidth;
+ int dstY = pBox[i].y1 + tileHeight;
+
+ if ((dstX < pBox[i].x2) || (dstY < pBox[i].y2)) {
+ more_copy = TRUE;
+ break;
+ }
+ }
+
+ if (more_copy == FALSE)
+ ret = TRUE;
+
+ if (more_copy && (*pExaScr->info->PrepareCopy) (pPixmap, pPixmap,
+ 1, 1, alu,
+ planemask)) {
+ for (i = 0; i < nbox; i++) {
+ int dstX = pBox[i].x1 + tileWidth;
+ int dstY = pBox[i].y1 + tileHeight;
+ int width = min(pBox[i].x2 - dstX, tileWidth);
+ int height = min(pBox[i].y2 - pBox[i].y1, tileHeight);
+
+ while (dstX < pBox[i].x2) {
+ (*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
+ dstX, pBox[i].y1, width,
+ height);
+ dstX += width;
+ width = min(pBox[i].x2 - dstX, width * 2);
+ }
+
+ width = pBox[i].x2 - pBox[i].x1;
+ height = min(pBox[i].y2 - dstY, tileHeight);
+
+ while (dstY < pBox[i].y2) {
+ (*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
+ pBox[i].x1, dstY, width,
+ height);
+ dstY += height;
+ height = min(pBox[i].y2 - dstY, height * 2);
+ }
+ }
+
+ (*pExaScr->info->DoneCopy) (pPixmap);
+
+ ret = TRUE;
+ }
+ }
+
+ exaMarkSync(pDrawable->pScreen);
+
+ if (xoff || yoff)
+ RegionTranslate(pRegion, -xoff, -yoff);
}
return ret;
}
-
/**
* Accelerates GetImage for solid ZPixmap downloads from framebuffer memory.
*
@@ -1262,45 +1255,46 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
* the pixmap out of framebuffer.
*/
void
-exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask, char *d)
+exaGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long planeMask, char *d)
{
- ExaScreenPriv (pDrawable->pScreen);
- PixmapPtr pPix = exaGetDrawablePixmap (pDrawable);
+ ExaScreenPriv(pDrawable->pScreen);
+ PixmapPtr pPix = exaGetDrawablePixmap(pDrawable);
+
ExaPixmapPriv(pPix);
int xoff, yoff;
Bool ok;
if (pExaScr->fallback_counter || pExaScr->swappedOut)
- goto fallback;
+ goto fallback;
/* If there's a system copy, we want to save the result there */
if (pExaPixmap->pDamage)
- goto fallback;
+ goto fallback;
- pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
+ pPix = exaGetOffscreenPixmap(pDrawable, &xoff, &yoff);
if (pPix == NULL || pExaScr->info->DownloadFromScreen == NULL)
- goto fallback;
+ goto fallback;
/* Only cover the ZPixmap, solid copy case. */
if (format != ZPixmap || !EXA_PM_IS_SOLID(pDrawable, planeMask))
- goto fallback;
+ goto fallback;
/* Only try to handle the 8bpp and up cases, since we don't want to think
* about <8bpp.
*/
if (pDrawable->bitsPerPixel < 8)
- goto fallback;
+ goto fallback;
ok = pExaScr->info->DownloadFromScreen(pPix, pDrawable->x + x + xoff,
- pDrawable->y + y + yoff, w, h, d,
- PixmapBytePad(w, pDrawable->depth));
+ pDrawable->y + y + yoff, w, h, d,
+ PixmapBytePad(w, pDrawable->depth));
if (ok) {
- exaWaitSync(pDrawable->pScreen);
- return;
+ exaWaitSync(pDrawable->pScreen);
+ return;
}
-fallback:
+ fallback:
ExaCheckGetImage(pDrawable, x, y, w, h, format, planeMask, d);
}
diff --git a/xorg-server/exa/exa_classic.c b/xorg-server/exa/exa_classic.c
index 919b29df2..1fa534bc6 100644
--- a/xorg-server/exa/exa_classic.c
+++ b/xorg-server/exa/exa_classic.c
@@ -33,15 +33,15 @@
/* This file holds the classic exa specific implementation. */
-static _X_INLINE void*
+static _X_INLINE void *
ExaGetPixmapAddress(PixmapPtr p)
{
ExaPixmapPriv(p);
if (pExaPixmap->use_gpu_copy && pExaPixmap->fb_ptr)
- return pExaPixmap->fb_ptr;
+ return pExaPixmap->fb_ptr;
else
- return pExaPixmap->sys_ptr;
+ return pExaPixmap->sys_ptr;
}
/**
@@ -54,19 +54,20 @@ ExaGetPixmapAddress(PixmapPtr p)
*/
PixmapPtr
exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
+ unsigned usage_hint)
{
PixmapPtr pPixmap;
- ExaPixmapPrivPtr pExaPixmap;
+ ExaPixmapPrivPtr pExaPixmap;
BoxRec box;
int bpp;
+
ExaScreenPriv(pScreen);
if (w > 32767 || h > 32767)
- return NullPixmap;
+ return NullPixmap;
swap(pExaScr, pScreen, CreatePixmap);
- pPixmap = pScreen->CreatePixmap (pScreen, w, h, depth, usage_hint);
+ pPixmap = pScreen->CreatePixmap(pScreen, w, h, depth, usage_hint);
swap(pExaScr, pScreen, CreatePixmap);
if (!pPixmap)
@@ -82,9 +83,9 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
* migrated.
*/
if (!w || !h)
- pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
+ pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
else
- pExaPixmap->score = EXA_PIXMAP_SCORE_INIT;
+ pExaPixmap->score = EXA_PIXMAP_SCORE_INIT;
pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
pExaPixmap->sys_pitch = pPixmap->devKind;
@@ -97,28 +98,28 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
if (pExaPixmap->fb_pitch > 131071) {
- swap(pExaScr, pScreen, DestroyPixmap);
- pScreen->DestroyPixmap (pPixmap);
- swap(pExaScr, pScreen, DestroyPixmap);
- return NULL;
+ swap(pExaScr, pScreen, DestroyPixmap);
+ pScreen->DestroyPixmap(pPixmap);
+ swap(pExaScr, pScreen, DestroyPixmap);
+ return NULL;
}
/* Set up damage tracking */
- pExaPixmap->pDamage = DamageCreate (NULL, NULL,
- DamageReportNone, TRUE,
- pScreen, pPixmap);
+ pExaPixmap->pDamage = DamageCreate(NULL, NULL,
+ DamageReportNone, TRUE,
+ pScreen, pPixmap);
if (pExaPixmap->pDamage == NULL) {
- swap(pExaScr, pScreen, DestroyPixmap);
- pScreen->DestroyPixmap (pPixmap);
- swap(pExaScr, pScreen, DestroyPixmap);
- return NULL;
+ swap(pExaScr, pScreen, DestroyPixmap);
+ pScreen->DestroyPixmap(pPixmap);
+ swap(pExaScr, pScreen, DestroyPixmap);
+ return NULL;
}
- DamageRegister (&pPixmap->drawable, pExaPixmap->pDamage);
+ DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
/* This ensures that pending damage reflects the current operation. */
/* This is used by exa to optimize migration. */
- DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE);
+ DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
pExaPixmap->area = NULL;
@@ -134,19 +135,19 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
RegionInit(&pExaPixmap->validSys, &box, 0);
RegionInit(&pExaPixmap->validFB, &box, 0);
- exaSetAccelBlock(pExaScr, pExaPixmap,
- w, h, bpp);
+ exaSetAccelBlock(pExaScr, pExaPixmap, w, h, bpp);
/* During a fallback we must prepare access. */
if (pExaScr->fallback_counter)
- exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
+ exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
return pPixmap;
}
Bool
-exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData)
+exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
+ int depth, int bitsPerPixel, int devKind,
+ pointer pPixData)
{
ScreenPtr pScreen;
ExaScreenPrivPtr pExaScr;
@@ -167,41 +168,39 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept
if (devKind > 0)
pExaPixmap->sys_pitch = devKind;
- /* Classic EXA:
- * - Framebuffer.
- * - Scratch pixmap with gpu memory.
- */
- if (pExaScr->info->memoryBase && pPixData) {
- if ((CARD8 *)pPixData >= pExaScr->info->memoryBase &&
- ((CARD8 *)pPixData - pExaScr->info->memoryBase) <
- pExaScr->info->memorySize) {
- pExaPixmap->fb_ptr = pPixData;
- pExaPixmap->fb_pitch = devKind;
- pExaPixmap->use_gpu_copy = TRUE;
- }
- }
+ /* Classic EXA:
+ * - Framebuffer.
+ * - Scratch pixmap with gpu memory.
+ */
+ if (pExaScr->info->memoryBase && pPixData) {
+ if ((CARD8 *) pPixData >= pExaScr->info->memoryBase &&
+ ((CARD8 *) pPixData - pExaScr->info->memoryBase) <
+ pExaScr->info->memorySize) {
+ pExaPixmap->fb_ptr = pPixData;
+ pExaPixmap->fb_pitch = devKind;
+ pExaPixmap->use_gpu_copy = TRUE;
+ }
+ }
if (width > 0 && height > 0 && bitsPerPixel > 0) {
- exaSetFbPitch(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
+ exaSetFbPitch(pExaScr, pExaPixmap, width, height, bitsPerPixel);
- exaSetAccelBlock(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
+ exaSetAccelBlock(pExaScr, pExaPixmap, width, height, bitsPerPixel);
}
- /* Pixmaps subject to ModifyPixmapHeader will be pinned to system or
- * gpu memory, so there's no need to track damage.
- */
- if (pExaPixmap->pDamage) {
- DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
- DamageDestroy(pExaPixmap->pDamage);
- pExaPixmap->pDamage = NULL;
- }
+ /* Pixmaps subject to ModifyPixmapHeader will be pinned to system or
+ * gpu memory, so there's no need to track damage.
+ */
+ if (pExaPixmap->pDamage) {
+ DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+ DamageDestroy(pExaPixmap->pDamage);
+ pExaPixmap->pDamage = NULL;
+ }
}
swap(pExaScr, pScreen, ModifyPixmapHeader);
ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
+ bitsPerPixel, devKind, pPixData);
swap(pExaScr, pScreen, ModifyPixmapHeader);
/* Always NULL this, we don't want lingering pointers. */
@@ -211,36 +210,34 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept
}
Bool
-exaDestroyPixmap_classic (PixmapPtr pPixmap)
+exaDestroyPixmap_classic(PixmapPtr pPixmap)
{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
ExaScreenPriv(pScreen);
Bool ret;
- if (pPixmap->refcnt == 1)
- {
- ExaPixmapPriv (pPixmap);
-
- exaDestroyPixmap(pPixmap);
-
- if (pExaPixmap->area)
- {
- DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
- (void*)pPixmap->drawable.id,
- ExaGetPixmapPriv(pPixmap)->area->offset,
- pPixmap->drawable.width,
- pPixmap->drawable.height));
- /* Free the offscreen area */
- exaOffscreenFree (pPixmap->drawable.pScreen, pExaPixmap->area);
- pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
- pPixmap->devKind = pExaPixmap->sys_pitch;
- }
- RegionUninit(&pExaPixmap->validSys);
- RegionUninit(&pExaPixmap->validFB);
+ if (pPixmap->refcnt == 1) {
+ ExaPixmapPriv(pPixmap);
+
+ exaDestroyPixmap(pPixmap);
+
+ if (pExaPixmap->area) {
+ DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
+ (void *) pPixmap->drawable.id,
+ ExaGetPixmapPriv(pPixmap)->area->offset,
+ pPixmap->drawable.width, pPixmap->drawable.height));
+ /* Free the offscreen area */
+ exaOffscreenFree(pPixmap->drawable.pScreen, pExaPixmap->area);
+ pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
+ pPixmap->devKind = pExaPixmap->sys_pitch;
+ }
+ RegionUninit(&pExaPixmap->validSys);
+ RegionUninit(&pExaPixmap->validFB);
}
swap(pExaScr, pScreen, DestroyPixmap);
- ret = pScreen->DestroyPixmap (pPixmap);
+ ret = pScreen->DestroyPixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
return ret;
@@ -250,17 +247,20 @@ Bool
exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
ExaScreenPriv(pScreen);
ExaPixmapPriv(pPixmap);
Bool ret;
if (pExaScr->info->PixmapIsOffscreen) {
- void* old_ptr = pPixmap->devPrivate.ptr;
- pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
- ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
- pPixmap->devPrivate.ptr = old_ptr;
- } else
- ret = (pExaPixmap->use_gpu_copy && pExaPixmap->fb_ptr);
+ void *old_ptr = pPixmap->devPrivate.ptr;
+
+ pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
+ ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
+ pPixmap->devPrivate.ptr = old_ptr;
+ }
+ else
+ ret = (pExaPixmap->use_gpu_copy && pExaPixmap->fb_ptr);
return ret;
}
diff --git a/xorg-server/exa/exa_driver.c b/xorg-server/exa/exa_driver.c
index 795cb00cd..d467ca928 100644
--- a/xorg-server/exa/exa_driver.c
+++ b/xorg-server/exa/exa_driver.c
@@ -33,7 +33,7 @@
/* This file holds the driver allocated pixmaps specific implementation. */
-static _X_INLINE void*
+static _X_INLINE void *
ExaGetPixmapAddress(PixmapPtr p)
{
ExaPixmapPriv(p);
@@ -48,16 +48,17 @@ ExaGetPixmapAddress(PixmapPtr p)
*/
PixmapPtr
exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
+ unsigned usage_hint)
{
PixmapPtr pPixmap;
- ExaPixmapPrivPtr pExaPixmap;
+ ExaPixmapPrivPtr pExaPixmap;
int bpp;
size_t paddedWidth, datasize;
+
ExaScreenPriv(pScreen);
if (w > 32767 || h > 32767)
- return NullPixmap;
+ return NullPixmap;
swap(pExaScr, pScreen, CreatePixmap);
pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
@@ -77,28 +78,32 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
pPixmap->devPrivate.ptr = NULL;
if (pExaScr->info->CreatePixmap2) {
- int new_pitch = 0;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp, &new_pitch);
- paddedWidth = pExaPixmap->fb_pitch = new_pitch;
+ int new_pitch = 0;
+
+ pExaPixmap->driverPriv =
+ pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp,
+ &new_pitch);
+ paddedWidth = pExaPixmap->fb_pitch = new_pitch;
}
else {
- paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
- if (paddedWidth / 4 > 32767 || h > 32767)
- return NullPixmap;
+ paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
+ if (paddedWidth / 4 > 32767 || h > 32767)
+ return NullPixmap;
- exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
+ exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
- if (paddedWidth < pExaPixmap->fb_pitch)
- paddedWidth = pExaPixmap->fb_pitch;
- datasize = h * paddedWidth;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
+ if (paddedWidth < pExaPixmap->fb_pitch)
+ paddedWidth = pExaPixmap->fb_pitch;
+ datasize = h * paddedWidth;
+ pExaPixmap->driverPriv =
+ pExaScr->info->CreatePixmap(pScreen, datasize, 0);
}
if (!pExaPixmap->driverPriv) {
- swap(pExaScr, pScreen, DestroyPixmap);
- pScreen->DestroyPixmap (pPixmap);
- swap(pExaScr, pScreen, DestroyPixmap);
- return NULL;
+ swap(pExaScr, pScreen, DestroyPixmap);
+ pScreen->DestroyPixmap(pPixmap);
+ swap(pExaScr, pScreen, DestroyPixmap);
+ return NULL;
}
/* Allow ModifyPixmapHeader to set sys_ptr appropriately. */
@@ -107,26 +112,25 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
pExaPixmap->pDamage = NULL;
pExaPixmap->sys_ptr = NULL;
- (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
- paddedWidth, NULL);
+ (*pScreen->ModifyPixmapHeader) (pPixmap, w, h, 0, 0, paddedWidth, NULL);
pExaPixmap->area = NULL;
- exaSetAccelBlock(pExaScr, pExaPixmap,
- w, h, bpp);
+ exaSetAccelBlock(pExaScr, pExaPixmap, w, h, bpp);
pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
/* During a fallback we must prepare access. */
if (pExaScr->fallback_counter)
- exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
+ exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
return pPixmap;
}
Bool
-exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData)
+exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
+ int depth, int bitsPerPixel, int devKind,
+ pointer pPixData)
{
ScreenPtr pScreen;
ExaScreenPrivPtr pExaScr;
@@ -148,36 +152,35 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth
pExaPixmap->sys_pitch = devKind;
if (width > 0 && height > 0 && bitsPerPixel > 0) {
- exaSetFbPitch(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
+ exaSetFbPitch(pExaScr, pExaPixmap, width, height, bitsPerPixel);
- exaSetAccelBlock(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
+ exaSetAccelBlock(pExaScr, pExaPixmap, width, height, bitsPerPixel);
}
}
if (pExaScr->info->ModifyPixmapHeader) {
- ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
- /* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL.
- * If pPixmap->devPrivate.ptr is non-NULL, then we've got a
- * !has_gpu_copy pixmap. We need to store the pointer,
- * because PrepareAccess won't be called.
- */
- if (!pPixData && pPixmap->devPrivate.ptr && pPixmap->devKind) {
- pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
- pExaPixmap->sys_pitch = pPixmap->devKind;
- }
- if (ret == TRUE)
- goto out;
+ ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
+ bitsPerPixel, devKind,
+ pPixData);
+ /* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL.
+ * If pPixmap->devPrivate.ptr is non-NULL, then we've got a
+ * !has_gpu_copy pixmap. We need to store the pointer,
+ * because PrepareAccess won't be called.
+ */
+ if (!pPixData && pPixmap->devPrivate.ptr && pPixmap->devKind) {
+ pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
+ pExaPixmap->sys_pitch = pPixmap->devKind;
+ }
+ if (ret == TRUE)
+ goto out;
}
swap(pExaScr, pScreen, ModifyPixmapHeader);
ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
+ bitsPerPixel, devKind, pPixData);
swap(pExaScr, pScreen, ModifyPixmapHeader);
-out:
+ out:
/* Always NULL this, we don't want lingering pointers. */
pPixmap->devPrivate.ptr = NULL;
@@ -185,25 +188,25 @@ out:
}
Bool
-exaDestroyPixmap_driver (PixmapPtr pPixmap)
+exaDestroyPixmap_driver(PixmapPtr pPixmap)
{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
ExaScreenPriv(pScreen);
Bool ret;
- if (pPixmap->refcnt == 1)
- {
- ExaPixmapPriv (pPixmap);
+ if (pPixmap->refcnt == 1) {
+ ExaPixmapPriv(pPixmap);
- exaDestroyPixmap(pPixmap);
+ exaDestroyPixmap(pPixmap);
- if (pExaPixmap->driverPriv)
- pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
- pExaPixmap->driverPriv = NULL;
+ if (pExaPixmap->driverPriv)
+ pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
+ pExaPixmap->driverPriv = NULL;
}
swap(pExaScr, pScreen, DestroyPixmap);
- ret = pScreen->DestroyPixmap (pPixmap);
+ ret = pScreen->DestroyPixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
return ret;
@@ -213,6 +216,7 @@ Bool
exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
ExaScreenPriv(pScreen);
pointer saved_ptr;
Bool ret;
diff --git a/xorg-server/exa/exa_glyphs.c b/xorg-server/exa/exa_glyphs.c
index 15ef61b1e..2538bce01 100644
--- a/xorg-server/exa/exa_glyphs.c
+++ b/xorg-server/exa/exa_glyphs.c
@@ -1,863 +1,839 @@
-/*
- * Copyright © 2008 Red Hat, Inc.
- * Partly based on code Copyright © 2000 SuSE, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Red Hat not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Red Hat makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * Red Hat DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Red Hat
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Owen Taylor <otaylor@fishsoup.net>
- * Based on code by: Keith Packard
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "exa_priv.h"
-
-#include "mipict.h"
-
-#if DEBUG_GLYPH_CACHE
-#define DBG_GLYPH_CACHE(a) ErrorF a
-#else
-#define DBG_GLYPH_CACHE(a)
-#endif
-
-/* Width of the pixmaps we use for the caches; this should be less than
- * max texture size of the driver; this may need to actually come from
- * the driver.
- */
-#define CACHE_PICTURE_WIDTH 1024
-
-/* Maximum number of glyphs we buffer on the stack before flushing
- * rendering to the mask or destination surface.
- */
-#define GLYPH_BUFFER_SIZE 256
-
-typedef struct {
- PicturePtr mask;
- ExaCompositeRectRec rects[GLYPH_BUFFER_SIZE];
- int count;
-} ExaGlyphBuffer, *ExaGlyphBufferPtr;
-
-typedef enum {
- ExaGlyphSuccess, /* Glyph added to render buffer */
- ExaGlyphFail, /* out of memory, etc */
- ExaGlyphNeedFlush, /* would evict a glyph already in the buffer */
-} ExaGlyphCacheResult;
-
-void
-exaGlyphsInit(ScreenPtr pScreen)
-{
- ExaScreenPriv(pScreen);
- int i = 0;
-
- memset(pExaScr->glyphCaches, 0, sizeof(pExaScr->glyphCaches));
-
- pExaScr->glyphCaches[i].format = PICT_a8;
- pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight = 16;
- i++;
- pExaScr->glyphCaches[i].format = PICT_a8;
- pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight = 32;
- i++;
- pExaScr->glyphCaches[i].format = PICT_a8r8g8b8;
- pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight = 16;
- i++;
- pExaScr->glyphCaches[i].format = PICT_a8r8g8b8;
- pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight = 32;
- i++;
-
- assert(i == EXA_NUM_GLYPH_CACHES);
-
- for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
- pExaScr->glyphCaches[i].columns = CACHE_PICTURE_WIDTH / pExaScr->glyphCaches[i].glyphWidth;
- pExaScr->glyphCaches[i].size = 256;
- pExaScr->glyphCaches[i].hashSize = 557;
- }
-}
-
-static void
-exaUnrealizeGlyphCaches(ScreenPtr pScreen,
- unsigned int format)
-{
- ExaScreenPriv(pScreen);
- int i;
-
- for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
- ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
-
- if (cache->format != format)
- continue;
-
- if (cache->picture) {
- FreePicture ((pointer) cache->picture, (XID) 0);
- cache->picture = NULL;
- }
-
- free(cache->hashEntries);
- cache->hashEntries = NULL;
-
- free(cache->glyphs);
- cache->glyphs = NULL;
- cache->glyphCount = 0;
- }
-}
-
-#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
-
-/* All caches for a single format share a single pixmap for glyph storage,
- * allowing mixing glyphs of different sizes without paying a penalty
- * for switching between mask pixmaps. (Note that for a size of font
- * right at the border between two sizes, we might be switching for almost
- * every glyph.)
- *
- * This function allocates the storage pixmap, and then fills in the
- * rest of the allocated structures for all caches with the given format.
- */
-static Bool
-exaRealizeGlyphCaches(ScreenPtr pScreen,
- unsigned int format)
-{
- ExaScreenPriv(pScreen);
-
- int depth = PIXMAN_FORMAT_DEPTH(format);
- PictFormatPtr pPictFormat;
- PixmapPtr pPixmap;
- PicturePtr pPicture;
- CARD32 component_alpha;
- int height;
- int i;
- int error;
-
- pPictFormat = PictureMatchFormat(pScreen, depth, format);
- if (!pPictFormat)
- return FALSE;
-
- /* Compute the total vertical size needed for the format */
-
- height = 0;
- for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
- ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
- int rows;
-
- if (cache->format != format)
- continue;
-
- cache->yOffset = height;
-
- rows = (cache->size + cache->columns - 1) / cache->columns;
- height += rows * cache->glyphHeight;
- }
-
- /* Now allocate the pixmap and picture */
- pPixmap = (*pScreen->CreatePixmap) (pScreen,
- CACHE_PICTURE_WIDTH,
- height, depth, 0);
- if (!pPixmap)
- return FALSE;
-
- component_alpha = NeedsComponent(pPictFormat->format);
- pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat,
- CPComponentAlpha, &component_alpha, serverClient,
- &error);
-
- (*pScreen->DestroyPixmap) (pPixmap); /* picture holds a refcount */
-
- if (!pPicture)
- return FALSE;
-
- /* And store the picture in all the caches for the format */
- for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
- ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
- int j;
-
- if (cache->format != format)
- continue;
-
- cache->picture = pPicture;
- cache->picture->refcnt++;
- cache->hashEntries = malloc(sizeof(int) * cache->hashSize);
- cache->glyphs = malloc(sizeof(ExaCachedGlyphRec) * cache->size);
- cache->glyphCount = 0;
-
- if (!cache->hashEntries || !cache->glyphs)
- goto bail;
-
- for (j = 0; j < cache->hashSize; j++)
- cache->hashEntries[j] = -1;
-
- cache->evictionPosition = rand() % cache->size;
- }
-
- /* Each cache references the picture individually */
- FreePicture ((pointer) pPicture, (XID) 0);
- return TRUE;
-
-bail:
- exaUnrealizeGlyphCaches(pScreen, format);
- return FALSE;
-}
-
-void
-exaGlyphsFini (ScreenPtr pScreen)
-{
- ExaScreenPriv(pScreen);
- int i;
-
- for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
- ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
-
- if (cache->picture)
- exaUnrealizeGlyphCaches(pScreen, cache->format);
- }
-}
-
-static int
-exaGlyphCacheHashLookup(ExaGlyphCachePtr cache,
- GlyphPtr pGlyph)
-{
- int slot;
-
- slot = (*(CARD32 *) pGlyph->sha1) % cache->hashSize;
-
- while (TRUE) { /* hash table can never be full */
- int entryPos = cache->hashEntries[slot];
- if (entryPos == -1)
- return -1;
-
- if (memcmp(pGlyph->sha1, cache->glyphs[entryPos].sha1, sizeof(pGlyph->sha1)) == 0){
- return entryPos;
- }
-
- slot--;
- if (slot < 0)
- slot = cache->hashSize - 1;
- }
-}
-
-static void
-exaGlyphCacheHashInsert(ExaGlyphCachePtr cache,
- GlyphPtr pGlyph,
- int pos)
-{
- int slot;
-
- memcpy(cache->glyphs[pos].sha1, pGlyph->sha1, sizeof(pGlyph->sha1));
-
- slot = (*(CARD32 *) pGlyph->sha1) % cache->hashSize;
-
- while (TRUE) { /* hash table can never be full */
- if (cache->hashEntries[slot] == -1) {
- cache->hashEntries[slot] = pos;
- return;
- }
-
- slot--;
- if (slot < 0)
- slot = cache->hashSize - 1;
- }
-}
-
-static void
-exaGlyphCacheHashRemove(ExaGlyphCachePtr cache,
- int pos)
-{
- int slot;
- int emptiedSlot = -1;
-
- slot = (*(CARD32 *) cache->glyphs[pos].sha1) % cache->hashSize;
-
- while (TRUE) { /* hash table can never be full */
- int entryPos = cache->hashEntries[slot];
-
- if (entryPos == -1)
- return;
-
- if (entryPos == pos) {
- cache->hashEntries[slot] = -1;
- emptiedSlot = slot;
- } else if (emptiedSlot != -1) {
- /* See if we can move this entry into the emptied slot, we can't
- * do that if if entry would have hashed between the current position
- * and the emptied slot. (taking wrapping into account). Bad positions
- * are:
- *
- * | XXXXXXXXXX |
- * i j
- *
- * |XXX XXXX|
- * j i
- *
- * i - slot, j - emptiedSlot
- *
- * (Knuth 6.4R)
- */
-
- int entrySlot = (*(CARD32 *) cache->glyphs[entryPos].sha1) % cache->hashSize;
-
- if (!((entrySlot >= slot && entrySlot < emptiedSlot) ||
- (emptiedSlot < slot && (entrySlot < emptiedSlot || entrySlot >= slot))))
- {
- cache->hashEntries[emptiedSlot] = entryPos;
- cache->hashEntries[slot] = -1;
- emptiedSlot = slot;
- }
- }
-
- slot--;
- if (slot < 0)
- slot = cache->hashSize - 1;
- }
-}
-
-#define CACHE_X(pos) (((pos) % cache->columns) * cache->glyphWidth)
-#define CACHE_Y(pos) (cache->yOffset + ((pos) / cache->columns) * cache->glyphHeight)
-
-/* The most efficient thing to way to upload the glyph to the screen
- * is to use the UploadToScreen() driver hook; this allows us to
- * pipeline glyph uploads and to avoid creating gpu backed pixmaps for
- * glyphs that we'll never use again.
- *
- * If we can't do it with UploadToScreen (because the glyph has a gpu copy,
- * etc), we fall back to CompositePicture.
- *
- * We need to damage the cache pixmap manually in either case because the damage
- * layer unwrapped the picture screen before calling exaGlyphs.
- */
-static void
-exaGlyphCacheUploadGlyph(ScreenPtr pScreen,
- ExaGlyphCachePtr cache,
- int x,
- int y,
- GlyphPtr pGlyph)
-{
- ExaScreenPriv(pScreen);
- PicturePtr pGlyphPicture = GlyphPicture(pGlyph)[pScreen->myNum];
- PixmapPtr pGlyphPixmap = (PixmapPtr)pGlyphPicture->pDrawable;
- ExaPixmapPriv(pGlyphPixmap);
- PixmapPtr pCachePixmap = (PixmapPtr)cache->picture->pDrawable;
-
- if (!pExaScr->info->UploadToScreen || pExaScr->swappedOut || pExaPixmap->accel_blocked)
- goto composite;
-
- /* If the glyph pixmap is already uploaded, no point in doing
- * things this way */
- if (exaPixmapHasGpuCopy(pGlyphPixmap))
- goto composite;
-
- /* UploadToScreen only works if bpp match */
- if (pGlyphPixmap->drawable.bitsPerPixel != pCachePixmap->drawable.bitsPerPixel)
- goto composite;
-
- if (pExaScr->do_migration) {
- ExaMigrationRec pixmaps[1];
-
- /* cache pixmap must have a gpu copy. */
- pixmaps[0].as_dst = TRUE;
- pixmaps[0].as_src = FALSE;
- pixmaps[0].pPix = pCachePixmap;
- pixmaps[0].pReg = NULL;
- exaDoMigration (pixmaps, 1, TRUE);
- }
-
- if (!exaPixmapHasGpuCopy(pCachePixmap))
- goto composite;
-
- /* x,y are in pixmap coordinates, no need for cache{X,Y}off */
- if (pExaScr->info->UploadToScreen(pCachePixmap,
- x,
- y,
- pGlyph->info.width,
- pGlyph->info.height,
- (char *)pExaPixmap->sys_ptr,
- pExaPixmap->sys_pitch))
- goto damage;
-
-composite:
- CompositePicture (PictOpSrc,
- pGlyphPicture,
- None,
- cache->picture,
- 0, 0,
- 0, 0,
- x,
- y,
- pGlyph->info.width,
- pGlyph->info.height);
-
-damage:
- /* The cache pixmap isn't a window, so no need to offset coordinates. */
- exaPixmapDirty (pCachePixmap,
- x,
- y,
- x + cache->glyphWidth,
- y + cache->glyphHeight);
-}
-
-static ExaGlyphCacheResult
-exaGlyphCacheBufferGlyph(ScreenPtr pScreen,
- ExaGlyphCachePtr cache,
- ExaGlyphBufferPtr buffer,
- GlyphPtr pGlyph,
- PicturePtr pSrc,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst)
-{
- ExaCompositeRectPtr rect;
- int pos;
- int x, y;
-
- if (buffer->mask && buffer->mask != cache->picture)
- return ExaGlyphNeedFlush;
-
- if (!cache->picture) {
- if (!exaRealizeGlyphCaches(pScreen, cache->format))
- return ExaGlyphFail;
- }
-
- DBG_GLYPH_CACHE(("(%d,%d,%s): buffering glyph %lx\n",
- cache->glyphWidth, cache->glyphHeight, cache->format == PICT_a8 ? "A" : "ARGB",
- (long)*(CARD32 *) pGlyph->sha1));
-
- pos = exaGlyphCacheHashLookup(cache, pGlyph);
- if (pos != -1) {
- DBG_GLYPH_CACHE((" found existing glyph at %d\n", pos));
- x = CACHE_X(pos);
- y = CACHE_Y(pos);
- } else {
- if (cache->glyphCount < cache->size) {
- /* Space remaining; we fill from the start */
- pos = cache->glyphCount;
- x = CACHE_X(pos);
- y = CACHE_Y(pos);
- cache->glyphCount++;
- DBG_GLYPH_CACHE((" storing glyph in free space at %d\n", pos));
-
- exaGlyphCacheHashInsert(cache, pGlyph, pos);
-
- } else {
- /* Need to evict an entry. We have to see if any glyphs
- * already in the output buffer were at this position in
- * the cache
- */
- pos = cache->evictionPosition;
- x = CACHE_X(pos);
- y = CACHE_Y(pos);
- DBG_GLYPH_CACHE((" evicting glyph at %d\n", pos));
- if (buffer->count) {
- int i;
-
- for (i = 0; i < buffer->count; i++) {
- if (pSrc ?
- (buffer->rects[i].xMask == x && buffer->rects[i].yMask == y) :
- (buffer->rects[i].xSrc == x && buffer->rects[i].ySrc == y)) {
- DBG_GLYPH_CACHE((" must flush buffer\n"));
- return ExaGlyphNeedFlush;
- }
- }
- }
-
- /* OK, we're all set, swap in the new glyph */
- exaGlyphCacheHashRemove(cache, pos);
- exaGlyphCacheHashInsert(cache, pGlyph, pos);
-
- /* And pick a new eviction position */
- cache->evictionPosition = rand() % cache->size;
- }
-
- exaGlyphCacheUploadGlyph(pScreen, cache, x, y, pGlyph);
- }
-
- buffer->mask = cache->picture;
-
- rect = &buffer->rects[buffer->count];
-
- if (pSrc)
- {
- rect->xSrc = xSrc;
- rect->ySrc = ySrc;
- rect->xMask = x;
- rect->yMask = y;
- }
- else
- {
- rect->xSrc = x;
- rect->ySrc = y;
- rect->xMask = 0;
- rect->yMask = 0;
- }
-
- rect->pDst = pDst;
- rect->xDst = xDst;
- rect->yDst = yDst;
- rect->width = pGlyph->info.width;
- rect->height = pGlyph->info.height;
-
- buffer->count++;
-
- return ExaGlyphSuccess;
-}
-
-#undef CACHE_X
-#undef CACHE_Y
-
-static ExaGlyphCacheResult
-exaBufferGlyph(ScreenPtr pScreen,
- ExaGlyphBufferPtr buffer,
- GlyphPtr pGlyph,
- PicturePtr pSrc,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst)
-{
- ExaScreenPriv(pScreen);
- unsigned int format = (GlyphPicture(pGlyph)[pScreen->myNum])->format;
- int width = pGlyph->info.width;
- int height = pGlyph->info.height;
- ExaCompositeRectPtr rect;
- PicturePtr mask;
- int i;
-
- if (buffer->count == GLYPH_BUFFER_SIZE)
- return ExaGlyphNeedFlush;
-
- if (PICT_FORMAT_BPP(format) == 1)
- format = PICT_a8;
-
- for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
- ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
-
- if (format == cache->format &&
- width <= cache->glyphWidth &&
- height <= cache->glyphHeight) {
- ExaGlyphCacheResult result = exaGlyphCacheBufferGlyph(pScreen,
- &pExaScr->glyphCaches[i],
- buffer,
- pGlyph,
- pSrc,
- pDst,
- xSrc, ySrc,
- xMask, yMask,
- xDst, yDst);
- switch (result) {
- case ExaGlyphFail:
- break;
- case ExaGlyphSuccess:
- case ExaGlyphNeedFlush:
- return result;
- }
- }
- }
-
- /* Couldn't find the glyph in the cache, use the glyph picture directly */
-
- mask = GlyphPicture(pGlyph)[pScreen->myNum];
- if (buffer->mask && buffer->mask != mask)
- return ExaGlyphNeedFlush;
-
- buffer->mask = mask;
-
- rect = &buffer->rects[buffer->count];
- rect->xSrc = xSrc;
- rect->ySrc = ySrc;
- rect->xMask = xMask;
- rect->yMask = yMask;
- rect->xDst = xDst;
- rect->yDst = yDst;
- rect->width = width;
- rect->height = height;
-
- buffer->count++;
-
- return ExaGlyphSuccess;
-}
-
-static void
-exaGlyphsToMask(PicturePtr pMask,
- ExaGlyphBufferPtr buffer)
-{
- exaCompositeRects(PictOpAdd, buffer->mask, NULL, pMask,
- buffer->count, buffer->rects);
-
- buffer->count = 0;
- buffer->mask = NULL;
-}
-
-static void
-exaGlyphsToDst(PicturePtr pSrc,
- PicturePtr pDst,
- ExaGlyphBufferPtr buffer)
-{
- exaCompositeRects(PictOpOver, pSrc, buffer->mask, pDst, buffer->count,
- buffer->rects);
-
- buffer->count = 0;
- buffer->mask = NULL;
-}
-
-/* Cut and paste from render/glyph.c - probably should export it instead */
-static void
-GlyphExtents (int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs,
- BoxPtr extents)
-{
- int x1, x2, y1, y2;
- int n;
- GlyphPtr glyph;
- int x, y;
-
- x = 0;
- y = 0;
- extents->x1 = MAXSHORT;
- extents->x2 = MINSHORT;
- extents->y1 = MAXSHORT;
- extents->y2 = MINSHORT;
- while (nlist--)
- {
- x += list->xOff;
- y += list->yOff;
- n = list->len;
- list++;
- while (n--)
- {
- glyph = *glyphs++;
- x1 = x - glyph->info.x;
- if (x1 < MINSHORT)
- x1 = MINSHORT;
- y1 = y - glyph->info.y;
- if (y1 < MINSHORT)
- y1 = MINSHORT;
- x2 = x1 + glyph->info.width;
- if (x2 > MAXSHORT)
- x2 = MAXSHORT;
- y2 = y1 + glyph->info.height;
- if (y2 > MAXSHORT)
- y2 = MAXSHORT;
- if (x1 < extents->x1)
- extents->x1 = x1;
- if (x2 > extents->x2)
- extents->x2 = x2;
- if (y1 < extents->y1)
- extents->y1 = y1;
- if (y2 > extents->y2)
- extents->y2 = y2;
- x += glyph->info.xOff;
- y += glyph->info.yOff;
- }
- }
-}
-
-void
-exaGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
- PixmapPtr pMaskPixmap = 0;
- PicturePtr pMask = NULL;
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- int width = 0, height = 0;
- int x, y;
- int first_xOff = list->xOff, first_yOff = list->yOff;
- int n;
- GlyphPtr glyph;
- int error;
- BoxRec extents = {0, 0, 0, 0};
- CARD32 component_alpha;
- ExaGlyphBuffer buffer;
-
- if (maskFormat)
- {
- ExaScreenPriv(pScreen);
- GCPtr pGC;
- xRectangle rect;
-
- GlyphExtents (nlist, list, glyphs, &extents);
-
- if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
- return;
- width = extents.x2 - extents.x1;
- height = extents.y2 - extents.y1;
-
- if (maskFormat->depth == 1) {
- PictFormatPtr a8Format = PictureMatchFormat (pScreen, 8, PICT_a8);
-
- if (a8Format)
- maskFormat = a8Format;
- }
-
- pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
- maskFormat->depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pMaskPixmap)
- return;
- component_alpha = NeedsComponent(maskFormat->format);
- pMask = CreatePicture (0, &pMaskPixmap->drawable,
- maskFormat, CPComponentAlpha, &component_alpha,
- serverClient, &error);
- if (!pMask ||
- (!component_alpha && pExaScr->info->CheckComposite &&
- !(*pExaScr->info->CheckComposite) (PictOpAdd, pSrc, NULL, pMask)))
- {
- PictFormatPtr argbFormat;
-
- (*pScreen->DestroyPixmap) (pMaskPixmap);
-
- if (!pMask)
- return;
-
- /* The driver can't seem to composite to a8, let's try argb (but
- * without component-alpha) */
- FreePicture ((pointer) pMask, (XID) 0);
-
- argbFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
-
- if (argbFormat)
- maskFormat = argbFormat;
-
- pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
- maskFormat->depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pMaskPixmap)
- return;
-
- pMask = CreatePicture (0, &pMaskPixmap->drawable, maskFormat, 0, 0,
- serverClient, &error);
- if (!pMask) {
- (*pScreen->DestroyPixmap) (pMaskPixmap);
- return;
- }
- }
- pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
- ValidateGC (&pMaskPixmap->drawable, pGC);
- rect.x = 0;
- rect.y = 0;
- rect.width = width;
- rect.height = height;
- (*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
- FreeScratchGC (pGC);
- x = -extents.x1;
- y = -extents.y1;
- }
- else
- {
- x = 0;
- y = 0;
- }
- buffer.count = 0;
- buffer.mask = NULL;
- while (nlist--)
- {
- x += list->xOff;
- y += list->yOff;
- n = list->len;
- while (n--)
- {
- glyph = *glyphs++;
-
- if (glyph->info.width > 0 && glyph->info.height > 0)
- {
- /* pGlyph->info.{x,y} compensate for empty space in the glyph. */
- if (maskFormat)
- {
- if (exaBufferGlyph(pScreen, &buffer, glyph, NULL, pMask,
- 0, 0, 0, 0, x - glyph->info.x, y - glyph->info.y) == ExaGlyphNeedFlush)
- {
- exaGlyphsToMask(pMask, &buffer);
- exaBufferGlyph(pScreen, &buffer, glyph, NULL, pMask,
- 0, 0, 0, 0, x - glyph->info.x, y - glyph->info.y);
- }
- }
- else
- {
- if (exaBufferGlyph(pScreen, &buffer, glyph, pSrc, pDst,
- xSrc + (x - glyph->info.x) - first_xOff, ySrc + (y - glyph->info.y) - first_yOff,
- 0, 0, x - glyph->info.x, y - glyph->info.y)
- == ExaGlyphNeedFlush)
- {
- exaGlyphsToDst(pSrc, pDst, &buffer);
- exaBufferGlyph(pScreen, &buffer, glyph, pSrc, pDst,
- xSrc + (x - glyph->info.x) - first_xOff, ySrc + (y - glyph->info.y) - first_yOff,
- 0, 0, x - glyph->info.x, y - glyph->info.y);
- }
- }
- }
-
- x += glyph->info.xOff;
- y += glyph->info.yOff;
- }
- list++;
- }
-
- if (buffer.count) {
- if (maskFormat)
- exaGlyphsToMask(pMask, &buffer);
- else
- exaGlyphsToDst(pSrc, pDst, &buffer);
- }
-
- if (maskFormat)
- {
- x = extents.x1;
- y = extents.y1;
- CompositePicture (op,
- pSrc,
- pMask,
- pDst,
- xSrc + x - first_xOff,
- ySrc + y - first_yOff,
- 0, 0,
- x, y,
- width, height);
- FreePicture ((pointer) pMask, (XID) 0);
- (*pScreen->DestroyPixmap) (pMaskPixmap);
- }
-}
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ * Partly based on code Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Red Hat not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. Red Hat makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * Red Hat DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Red Hat
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Owen Taylor <otaylor@fishsoup.net>
+ * Based on code by: Keith Packard
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "exa_priv.h"
+
+#include "mipict.h"
+
+#if DEBUG_GLYPH_CACHE
+#define DBG_GLYPH_CACHE(a) ErrorF a
+#else
+#define DBG_GLYPH_CACHE(a)
+#endif
+
+/* Width of the pixmaps we use for the caches; this should be less than
+ * max texture size of the driver; this may need to actually come from
+ * the driver.
+ */
+#define CACHE_PICTURE_WIDTH 1024
+
+/* Maximum number of glyphs we buffer on the stack before flushing
+ * rendering to the mask or destination surface.
+ */
+#define GLYPH_BUFFER_SIZE 256
+
+typedef struct {
+ PicturePtr mask;
+ ExaCompositeRectRec rects[GLYPH_BUFFER_SIZE];
+ int count;
+} ExaGlyphBuffer, *ExaGlyphBufferPtr;
+
+typedef enum {
+ ExaGlyphSuccess, /* Glyph added to render buffer */
+ ExaGlyphFail, /* out of memory, etc */
+ ExaGlyphNeedFlush, /* would evict a glyph already in the buffer */
+} ExaGlyphCacheResult;
+
+void
+exaGlyphsInit(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+ int i = 0;
+
+ memset(pExaScr->glyphCaches, 0, sizeof(pExaScr->glyphCaches));
+
+ pExaScr->glyphCaches[i].format = PICT_a8;
+ pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight =
+ 16;
+ i++;
+ pExaScr->glyphCaches[i].format = PICT_a8;
+ pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight =
+ 32;
+ i++;
+ pExaScr->glyphCaches[i].format = PICT_a8r8g8b8;
+ pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight =
+ 16;
+ i++;
+ pExaScr->glyphCaches[i].format = PICT_a8r8g8b8;
+ pExaScr->glyphCaches[i].glyphWidth = pExaScr->glyphCaches[i].glyphHeight =
+ 32;
+ i++;
+
+ assert(i == EXA_NUM_GLYPH_CACHES);
+
+ for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
+ pExaScr->glyphCaches[i].columns =
+ CACHE_PICTURE_WIDTH / pExaScr->glyphCaches[i].glyphWidth;
+ pExaScr->glyphCaches[i].size = 256;
+ pExaScr->glyphCaches[i].hashSize = 557;
+ }
+}
+
+static void
+exaUnrealizeGlyphCaches(ScreenPtr pScreen, unsigned int format)
+{
+ ExaScreenPriv(pScreen);
+ int i;
+
+ for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
+ ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
+
+ if (cache->format != format)
+ continue;
+
+ if (cache->picture) {
+ FreePicture((pointer) cache->picture, (XID) 0);
+ cache->picture = NULL;
+ }
+
+ free(cache->hashEntries);
+ cache->hashEntries = NULL;
+
+ free(cache->glyphs);
+ cache->glyphs = NULL;
+ cache->glyphCount = 0;
+ }
+}
+
+#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
+
+/* All caches for a single format share a single pixmap for glyph storage,
+ * allowing mixing glyphs of different sizes without paying a penalty
+ * for switching between mask pixmaps. (Note that for a size of font
+ * right at the border between two sizes, we might be switching for almost
+ * every glyph.)
+ *
+ * This function allocates the storage pixmap, and then fills in the
+ * rest of the allocated structures for all caches with the given format.
+ */
+static Bool
+exaRealizeGlyphCaches(ScreenPtr pScreen, unsigned int format)
+{
+ ExaScreenPriv(pScreen);
+
+ int depth = PIXMAN_FORMAT_DEPTH(format);
+ PictFormatPtr pPictFormat;
+ PixmapPtr pPixmap;
+ PicturePtr pPicture;
+ CARD32 component_alpha;
+ int height;
+ int i;
+ int error;
+
+ pPictFormat = PictureMatchFormat(pScreen, depth, format);
+ if (!pPictFormat)
+ return FALSE;
+
+ /* Compute the total vertical size needed for the format */
+
+ height = 0;
+ for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
+ ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
+ int rows;
+
+ if (cache->format != format)
+ continue;
+
+ cache->yOffset = height;
+
+ rows = (cache->size + cache->columns - 1) / cache->columns;
+ height += rows * cache->glyphHeight;
+ }
+
+ /* Now allocate the pixmap and picture */
+ pPixmap = (*pScreen->CreatePixmap) (pScreen,
+ CACHE_PICTURE_WIDTH, height, depth, 0);
+ if (!pPixmap)
+ return FALSE;
+
+ component_alpha = NeedsComponent(pPictFormat->format);
+ pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat,
+ CPComponentAlpha, &component_alpha, serverClient,
+ &error);
+
+ (*pScreen->DestroyPixmap) (pPixmap); /* picture holds a refcount */
+
+ if (!pPicture)
+ return FALSE;
+
+ /* And store the picture in all the caches for the format */
+ for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
+ ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
+ int j;
+
+ if (cache->format != format)
+ continue;
+
+ cache->picture = pPicture;
+ cache->picture->refcnt++;
+ cache->hashEntries = malloc(sizeof(int) * cache->hashSize);
+ cache->glyphs = malloc(sizeof(ExaCachedGlyphRec) * cache->size);
+ cache->glyphCount = 0;
+
+ if (!cache->hashEntries || !cache->glyphs)
+ goto bail;
+
+ for (j = 0; j < cache->hashSize; j++)
+ cache->hashEntries[j] = -1;
+
+ cache->evictionPosition = rand() % cache->size;
+ }
+
+ /* Each cache references the picture individually */
+ FreePicture((pointer) pPicture, (XID) 0);
+ return TRUE;
+
+ bail:
+ exaUnrealizeGlyphCaches(pScreen, format);
+ return FALSE;
+}
+
+void
+exaGlyphsFini(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+ int i;
+
+ for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
+ ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
+
+ if (cache->picture)
+ exaUnrealizeGlyphCaches(pScreen, cache->format);
+ }
+}
+
+static int
+exaGlyphCacheHashLookup(ExaGlyphCachePtr cache, GlyphPtr pGlyph)
+{
+ int slot;
+
+ slot = (*(CARD32 *) pGlyph->sha1) % cache->hashSize;
+
+ while (TRUE) { /* hash table can never be full */
+ int entryPos = cache->hashEntries[slot];
+
+ if (entryPos == -1)
+ return -1;
+
+ if (memcmp
+ (pGlyph->sha1, cache->glyphs[entryPos].sha1,
+ sizeof(pGlyph->sha1)) == 0) {
+ return entryPos;
+ }
+
+ slot--;
+ if (slot < 0)
+ slot = cache->hashSize - 1;
+ }
+}
+
+static void
+exaGlyphCacheHashInsert(ExaGlyphCachePtr cache, GlyphPtr pGlyph, int pos)
+{
+ int slot;
+
+ memcpy(cache->glyphs[pos].sha1, pGlyph->sha1, sizeof(pGlyph->sha1));
+
+ slot = (*(CARD32 *) pGlyph->sha1) % cache->hashSize;
+
+ while (TRUE) { /* hash table can never be full */
+ if (cache->hashEntries[slot] == -1) {
+ cache->hashEntries[slot] = pos;
+ return;
+ }
+
+ slot--;
+ if (slot < 0)
+ slot = cache->hashSize - 1;
+ }
+}
+
+static void
+exaGlyphCacheHashRemove(ExaGlyphCachePtr cache, int pos)
+{
+ int slot;
+ int emptiedSlot = -1;
+
+ slot = (*(CARD32 *) cache->glyphs[pos].sha1) % cache->hashSize;
+
+ while (TRUE) { /* hash table can never be full */
+ int entryPos = cache->hashEntries[slot];
+
+ if (entryPos == -1)
+ return;
+
+ if (entryPos == pos) {
+ cache->hashEntries[slot] = -1;
+ emptiedSlot = slot;
+ }
+ else if (emptiedSlot != -1) {
+ /* See if we can move this entry into the emptied slot, we can't
+ * do that if if entry would have hashed between the current position
+ * and the emptied slot. (taking wrapping into account). Bad positions
+ * are:
+ *
+ * | XXXXXXXXXX |
+ * i j
+ *
+ * |XXX XXXX|
+ * j i
+ *
+ * i - slot, j - emptiedSlot
+ *
+ * (Knuth 6.4R)
+ */
+
+ int entrySlot =
+ (*(CARD32 *) cache->glyphs[entryPos].sha1) % cache->hashSize;
+
+ if (!((entrySlot >= slot && entrySlot < emptiedSlot) ||
+ (emptiedSlot < slot &&
+ (entrySlot < emptiedSlot || entrySlot >= slot)))) {
+ cache->hashEntries[emptiedSlot] = entryPos;
+ cache->hashEntries[slot] = -1;
+ emptiedSlot = slot;
+ }
+ }
+
+ slot--;
+ if (slot < 0)
+ slot = cache->hashSize - 1;
+ }
+}
+
+#define CACHE_X(pos) (((pos) % cache->columns) * cache->glyphWidth)
+#define CACHE_Y(pos) (cache->yOffset + ((pos) / cache->columns) * cache->glyphHeight)
+
+/* The most efficient thing to way to upload the glyph to the screen
+ * is to use the UploadToScreen() driver hook; this allows us to
+ * pipeline glyph uploads and to avoid creating gpu backed pixmaps for
+ * glyphs that we'll never use again.
+ *
+ * If we can't do it with UploadToScreen (because the glyph has a gpu copy,
+ * etc), we fall back to CompositePicture.
+ *
+ * We need to damage the cache pixmap manually in either case because the damage
+ * layer unwrapped the picture screen before calling exaGlyphs.
+ */
+static void
+exaGlyphCacheUploadGlyph(ScreenPtr pScreen,
+ ExaGlyphCachePtr cache, int x, int y, GlyphPtr pGlyph)
+{
+ ExaScreenPriv(pScreen);
+ PicturePtr pGlyphPicture = GlyphPicture(pGlyph)[pScreen->myNum];
+ PixmapPtr pGlyphPixmap = (PixmapPtr) pGlyphPicture->pDrawable;
+
+ ExaPixmapPriv(pGlyphPixmap);
+ PixmapPtr pCachePixmap = (PixmapPtr) cache->picture->pDrawable;
+
+ if (!pExaScr->info->UploadToScreen || pExaScr->swappedOut ||
+ pExaPixmap->accel_blocked)
+ goto composite;
+
+ /* If the glyph pixmap is already uploaded, no point in doing
+ * things this way */
+ if (exaPixmapHasGpuCopy(pGlyphPixmap))
+ goto composite;
+
+ /* UploadToScreen only works if bpp match */
+ if (pGlyphPixmap->drawable.bitsPerPixel !=
+ pCachePixmap->drawable.bitsPerPixel)
+ goto composite;
+
+ if (pExaScr->do_migration) {
+ ExaMigrationRec pixmaps[1];
+
+ /* cache pixmap must have a gpu copy. */
+ pixmaps[0].as_dst = TRUE;
+ pixmaps[0].as_src = FALSE;
+ pixmaps[0].pPix = pCachePixmap;
+ pixmaps[0].pReg = NULL;
+ exaDoMigration(pixmaps, 1, TRUE);
+ }
+
+ if (!exaPixmapHasGpuCopy(pCachePixmap))
+ goto composite;
+
+ /* x,y are in pixmap coordinates, no need for cache{X,Y}off */
+ if (pExaScr->info->UploadToScreen(pCachePixmap,
+ x,
+ y,
+ pGlyph->info.width,
+ pGlyph->info.height,
+ (char *) pExaPixmap->sys_ptr,
+ pExaPixmap->sys_pitch))
+ goto damage;
+
+ composite:
+ CompositePicture(PictOpSrc,
+ pGlyphPicture,
+ None,
+ cache->picture,
+ 0, 0, 0, 0, x, y, pGlyph->info.width, pGlyph->info.height);
+
+ damage:
+ /* The cache pixmap isn't a window, so no need to offset coordinates. */
+ exaPixmapDirty(pCachePixmap,
+ x, y, x + cache->glyphWidth, y + cache->glyphHeight);
+}
+
+static ExaGlyphCacheResult
+exaGlyphCacheBufferGlyph(ScreenPtr pScreen,
+ ExaGlyphCachePtr cache,
+ ExaGlyphBufferPtr buffer,
+ GlyphPtr pGlyph,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst)
+{
+ ExaCompositeRectPtr rect;
+ int pos;
+ int x, y;
+
+ if (buffer->mask && buffer->mask != cache->picture)
+ return ExaGlyphNeedFlush;
+
+ if (!cache->picture) {
+ if (!exaRealizeGlyphCaches(pScreen, cache->format))
+ return ExaGlyphFail;
+ }
+
+ DBG_GLYPH_CACHE(("(%d,%d,%s): buffering glyph %lx\n",
+ cache->glyphWidth, cache->glyphHeight,
+ cache->format == PICT_a8 ? "A" : "ARGB",
+ (long) *(CARD32 *) pGlyph->sha1));
+
+ pos = exaGlyphCacheHashLookup(cache, pGlyph);
+ if (pos != -1) {
+ DBG_GLYPH_CACHE((" found existing glyph at %d\n", pos));
+ x = CACHE_X(pos);
+ y = CACHE_Y(pos);
+ }
+ else {
+ if (cache->glyphCount < cache->size) {
+ /* Space remaining; we fill from the start */
+ pos = cache->glyphCount;
+ x = CACHE_X(pos);
+ y = CACHE_Y(pos);
+ cache->glyphCount++;
+ DBG_GLYPH_CACHE((" storing glyph in free space at %d\n", pos));
+
+ exaGlyphCacheHashInsert(cache, pGlyph, pos);
+
+ }
+ else {
+ /* Need to evict an entry. We have to see if any glyphs
+ * already in the output buffer were at this position in
+ * the cache
+ */
+ pos = cache->evictionPosition;
+ x = CACHE_X(pos);
+ y = CACHE_Y(pos);
+ DBG_GLYPH_CACHE((" evicting glyph at %d\n", pos));
+ if (buffer->count) {
+ int i;
+
+ for (i = 0; i < buffer->count; i++) {
+ if (pSrc ?
+ (buffer->rects[i].xMask == x &&
+ buffer->rects[i].yMask ==
+ y) : (buffer->rects[i].xSrc == x &&
+ buffer->rects[i].ySrc == y)) {
+ DBG_GLYPH_CACHE((" must flush buffer\n"));
+ return ExaGlyphNeedFlush;
+ }
+ }
+ }
+
+ /* OK, we're all set, swap in the new glyph */
+ exaGlyphCacheHashRemove(cache, pos);
+ exaGlyphCacheHashInsert(cache, pGlyph, pos);
+
+ /* And pick a new eviction position */
+ cache->evictionPosition = rand() % cache->size;
+ }
+
+ exaGlyphCacheUploadGlyph(pScreen, cache, x, y, pGlyph);
+ }
+
+ buffer->mask = cache->picture;
+
+ rect = &buffer->rects[buffer->count];
+
+ if (pSrc) {
+ rect->xSrc = xSrc;
+ rect->ySrc = ySrc;
+ rect->xMask = x;
+ rect->yMask = y;
+ }
+ else {
+ rect->xSrc = x;
+ rect->ySrc = y;
+ rect->xMask = 0;
+ rect->yMask = 0;
+ }
+
+ rect->pDst = pDst;
+ rect->xDst = xDst;
+ rect->yDst = yDst;
+ rect->width = pGlyph->info.width;
+ rect->height = pGlyph->info.height;
+
+ buffer->count++;
+
+ return ExaGlyphSuccess;
+}
+
+#undef CACHE_X
+#undef CACHE_Y
+
+static ExaGlyphCacheResult
+exaBufferGlyph(ScreenPtr pScreen,
+ ExaGlyphBufferPtr buffer,
+ GlyphPtr pGlyph,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst)
+{
+ ExaScreenPriv(pScreen);
+ unsigned int format = (GlyphPicture(pGlyph)[pScreen->myNum])->format;
+ int width = pGlyph->info.width;
+ int height = pGlyph->info.height;
+ ExaCompositeRectPtr rect;
+ PicturePtr mask;
+ int i;
+
+ if (buffer->count == GLYPH_BUFFER_SIZE)
+ return ExaGlyphNeedFlush;
+
+ if (PICT_FORMAT_BPP(format) == 1)
+ format = PICT_a8;
+
+ for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
+ ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
+
+ if (format == cache->format &&
+ width <= cache->glyphWidth && height <= cache->glyphHeight) {
+ ExaGlyphCacheResult result = exaGlyphCacheBufferGlyph(pScreen,
+ &pExaScr->
+ glyphCaches
+ [i],
+ buffer,
+ pGlyph,
+ pSrc,
+ pDst,
+ xSrc, ySrc,
+ xMask, yMask,
+ xDst, yDst);
+
+ switch (result) {
+ case ExaGlyphFail:
+ break;
+ case ExaGlyphSuccess:
+ case ExaGlyphNeedFlush:
+ return result;
+ }
+ }
+ }
+
+ /* Couldn't find the glyph in the cache, use the glyph picture directly */
+
+ mask = GlyphPicture(pGlyph)[pScreen->myNum];
+ if (buffer->mask && buffer->mask != mask)
+ return ExaGlyphNeedFlush;
+
+ buffer->mask = mask;
+
+ rect = &buffer->rects[buffer->count];
+ rect->xSrc = xSrc;
+ rect->ySrc = ySrc;
+ rect->xMask = xMask;
+ rect->yMask = yMask;
+ rect->xDst = xDst;
+ rect->yDst = yDst;
+ rect->width = width;
+ rect->height = height;
+
+ buffer->count++;
+
+ return ExaGlyphSuccess;
+}
+
+static void
+exaGlyphsToMask(PicturePtr pMask, ExaGlyphBufferPtr buffer)
+{
+ exaCompositeRects(PictOpAdd, buffer->mask, NULL, pMask,
+ buffer->count, buffer->rects);
+
+ buffer->count = 0;
+ buffer->mask = NULL;
+}
+
+static void
+exaGlyphsToDst(PicturePtr pSrc, PicturePtr pDst, ExaGlyphBufferPtr buffer)
+{
+ exaCompositeRects(PictOpOver, pSrc, buffer->mask, pDst, buffer->count,
+ buffer->rects);
+
+ buffer->count = 0;
+ buffer->mask = NULL;
+}
+
+/* Cut and paste from render/glyph.c - probably should export it instead */
+static void
+GlyphExtents(int nlist, GlyphListPtr list, GlyphPtr * glyphs, BoxPtr extents)
+{
+ int x1, x2, y1, y2;
+ int n;
+ GlyphPtr glyph;
+ int x, y;
+
+ x = 0;
+ y = 0;
+ extents->x1 = MAXSHORT;
+ extents->x2 = MINSHORT;
+ extents->y1 = MAXSHORT;
+ extents->y2 = MINSHORT;
+ while (nlist--) {
+ x += list->xOff;
+ y += list->yOff;
+ n = list->len;
+ list++;
+ while (n--) {
+ glyph = *glyphs++;
+ x1 = x - glyph->info.x;
+ if (x1 < MINSHORT)
+ x1 = MINSHORT;
+ y1 = y - glyph->info.y;
+ if (y1 < MINSHORT)
+ y1 = MINSHORT;
+ x2 = x1 + glyph->info.width;
+ if (x2 > MAXSHORT)
+ x2 = MAXSHORT;
+ y2 = y1 + glyph->info.height;
+ if (y2 > MAXSHORT)
+ y2 = MAXSHORT;
+ if (x1 < extents->x1)
+ extents->x1 = x1;
+ if (x2 > extents->x2)
+ extents->x2 = x2;
+ if (y1 < extents->y1)
+ extents->y1 = y1;
+ if (y2 > extents->y2)
+ extents->y2 = y2;
+ x += glyph->info.xOff;
+ y += glyph->info.yOff;
+ }
+ }
+}
+
+void
+exaGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
+{
+ PixmapPtr pMaskPixmap = 0;
+ PicturePtr pMask = NULL;
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ int width = 0, height = 0;
+ int x, y;
+ int first_xOff = list->xOff, first_yOff = list->yOff;
+ int n;
+ GlyphPtr glyph;
+ int error;
+ BoxRec extents = { 0, 0, 0, 0 };
+ CARD32 component_alpha;
+ ExaGlyphBuffer buffer;
+
+ if (maskFormat) {
+ ExaScreenPriv(pScreen);
+ GCPtr pGC;
+ xRectangle rect;
+
+ GlyphExtents(nlist, list, glyphs, &extents);
+
+ if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
+ return;
+ width = extents.x2 - extents.x1;
+ height = extents.y2 - extents.y1;
+
+ if (maskFormat->depth == 1) {
+ PictFormatPtr a8Format = PictureMatchFormat(pScreen, 8, PICT_a8);
+
+ if (a8Format)
+ maskFormat = a8Format;
+ }
+
+ pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
+ maskFormat->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pMaskPixmap)
+ return;
+ component_alpha = NeedsComponent(maskFormat->format);
+ pMask = CreatePicture(0, &pMaskPixmap->drawable,
+ maskFormat, CPComponentAlpha, &component_alpha,
+ serverClient, &error);
+ if (!pMask ||
+ (!component_alpha && pExaScr->info->CheckComposite &&
+ !(*pExaScr->info->CheckComposite) (PictOpAdd, pSrc, NULL, pMask)))
+ {
+ PictFormatPtr argbFormat;
+
+ (*pScreen->DestroyPixmap) (pMaskPixmap);
+
+ if (!pMask)
+ return;
+
+ /* The driver can't seem to composite to a8, let's try argb (but
+ * without component-alpha) */
+ FreePicture((pointer) pMask, (XID) 0);
+
+ argbFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8);
+
+ if (argbFormat)
+ maskFormat = argbFormat;
+
+ pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
+ maskFormat->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pMaskPixmap)
+ return;
+
+ pMask = CreatePicture(0, &pMaskPixmap->drawable, maskFormat, 0, 0,
+ serverClient, &error);
+ if (!pMask) {
+ (*pScreen->DestroyPixmap) (pMaskPixmap);
+ return;
+ }
+ }
+ pGC = GetScratchGC(pMaskPixmap->drawable.depth, pScreen);
+ ValidateGC(&pMaskPixmap->drawable, pGC);
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = width;
+ rect.height = height;
+ (*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
+ FreeScratchGC(pGC);
+ x = -extents.x1;
+ y = -extents.y1;
+ }
+ else {
+ x = 0;
+ y = 0;
+ }
+ buffer.count = 0;
+ buffer.mask = NULL;
+ while (nlist--) {
+ x += list->xOff;
+ y += list->yOff;
+ n = list->len;
+ while (n--) {
+ glyph = *glyphs++;
+
+ if (glyph->info.width > 0 && glyph->info.height > 0) {
+ /* pGlyph->info.{x,y} compensate for empty space in the glyph. */
+ if (maskFormat) {
+ if (exaBufferGlyph(pScreen, &buffer, glyph, NULL, pMask,
+ 0, 0, 0, 0, x - glyph->info.x,
+ y - glyph->info.y) ==
+ ExaGlyphNeedFlush) {
+ exaGlyphsToMask(pMask, &buffer);
+ exaBufferGlyph(pScreen, &buffer, glyph, NULL, pMask,
+ 0, 0, 0, 0, x - glyph->info.x,
+ y - glyph->info.y);
+ }
+ }
+ else {
+ if (exaBufferGlyph(pScreen, &buffer, glyph, pSrc, pDst,
+ xSrc + (x - glyph->info.x) - first_xOff,
+ ySrc + (y - glyph->info.y) - first_yOff,
+ 0, 0, x - glyph->info.x,
+ y - glyph->info.y)
+ == ExaGlyphNeedFlush) {
+ exaGlyphsToDst(pSrc, pDst, &buffer);
+ exaBufferGlyph(pScreen, &buffer, glyph, pSrc, pDst,
+ xSrc + (x - glyph->info.x) - first_xOff,
+ ySrc + (y - glyph->info.y) - first_yOff,
+ 0, 0, x - glyph->info.x,
+ y - glyph->info.y);
+ }
+ }
+ }
+
+ x += glyph->info.xOff;
+ y += glyph->info.yOff;
+ }
+ list++;
+ }
+
+ if (buffer.count) {
+ if (maskFormat)
+ exaGlyphsToMask(pMask, &buffer);
+ else
+ exaGlyphsToDst(pSrc, pDst, &buffer);
+ }
+
+ if (maskFormat) {
+ x = extents.x1;
+ y = extents.y1;
+ CompositePicture(op,
+ pSrc,
+ pMask,
+ pDst,
+ xSrc + x - first_xOff,
+ ySrc + y - first_yOff, 0, 0, x, y, width, height);
+ FreePicture((pointer) pMask, (XID) 0);
+ (*pScreen->DestroyPixmap) (pMaskPixmap);
+ }
+}
diff --git a/xorg-server/exa/exa_migration_classic.c b/xorg-server/exa/exa_migration_classic.c
index 2f01f8d24..65bbb17ce 100644
--- a/xorg-server/exa/exa_migration_classic.c
+++ b/xorg-server/exa/exa_migration_classic.c
@@ -46,9 +46,9 @@
* and exaCopyDirtyToFb both needed to do this loop.
*/
static void
-exaMemcpyBox (PixmapPtr pPixmap, BoxPtr pbox, CARD8 *src, int src_pitch,
- CARD8 *dst, int dst_pitch)
- {
+exaMemcpyBox(PixmapPtr pPixmap, BoxPtr pbox, CARD8 *src, int src_pitch,
+ CARD8 *dst, int dst_pitch)
+{
int i, cpp = pPixmap->drawable.bitsPerPixel / 8;
int bytes = (pbox->x2 - pbox->x1) * cpp;
@@ -56,9 +56,9 @@ exaMemcpyBox (PixmapPtr pPixmap, BoxPtr pbox, CARD8 *src, int src_pitch,
dst += pbox->y1 * dst_pitch + pbox->x1 * cpp;
for (i = pbox->y2 - pbox->y1; i; i--) {
- memcpy (dst, src, bytes);
- src += src_pitch;
- dst += dst_pitch;
+ memcpy(dst, src, bytes);
+ src += src_pitch;
+ dst += dst_pitch;
}
}
@@ -68,18 +68,18 @@ exaMemcpyBox (PixmapPtr pPixmap, BoxPtr pbox, CARD8 *src, int src_pitch,
* dirtiness.
*/
static Bool
-exaPixmapIsDirty (PixmapPtr pPix)
+exaPixmapIsDirty(PixmapPtr pPix)
{
- ExaPixmapPriv (pPix);
+ ExaPixmapPriv(pPix);
if (pExaPixmap == NULL)
- EXA_FatalErrorDebugWithRet(("EXA bug: exaPixmapIsDirty was called on a non-exa pixmap.\n"), TRUE);
+ EXA_FatalErrorDebugWithRet(("EXA bug: exaPixmapIsDirty was called on a non-exa pixmap.\n"), TRUE);
if (!pExaPixmap->pDamage)
- return FALSE;
+ return FALSE;
return RegionNotEmpty(DamageRegion(pExaPixmap->pDamage)) ||
- !RegionEqual(&pExaPixmap->validSys, &pExaPixmap->validFB);
+ !RegionEqual(&pExaPixmap->validSys, &pExaPixmap->validFB);
}
/**
@@ -90,12 +90,12 @@ exaPixmapIsDirty (PixmapPtr pPix)
* Only valid if using a migration scheme that tracks score.
*/
static Bool
-exaPixmapShouldBeInFB (PixmapPtr pPix)
+exaPixmapShouldBeInFB(PixmapPtr pPix)
{
- ExaPixmapPriv (pPix);
+ ExaPixmapPriv(pPix);
- if (exaPixmapIsPinned (pPix))
- return TRUE;
+ if (exaPixmapIsPinned(pPix))
+ return TRUE;
return pExaPixmap->score >= 0;
}
@@ -106,13 +106,14 @@ exaPixmapShouldBeInFB (PixmapPtr pPix)
*/
static void
exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
- Bool (*transfer) (PixmapPtr pPix, int x, int y, int w, int h,
- char *sys, int sys_pitch), int fallback_index,
- void (*sync) (ScreenPtr pScreen))
+ Bool (*transfer) (PixmapPtr pPix, int x, int y, int w, int h,
+ char *sys, int sys_pitch), int fallback_index,
+ void (*sync) (ScreenPtr pScreen))
{
PixmapPtr pPixmap = migrate->pPix;
- ExaPixmapPriv (pPixmap);
- RegionPtr damage = DamageRegion (pExaPixmap->pDamage);
+
+ ExaPixmapPriv(pPixmap);
+ RegionPtr damage = DamageRegion(pExaPixmap->pDamage);
RegionRec CopyReg;
Bool save_use_gpu_copy;
int save_pitch;
@@ -123,15 +124,12 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
/* Damaged bits are valid in current copy but invalid in other one */
if (pExaPixmap->use_gpu_copy) {
- RegionUnion(&pExaPixmap->validFB, &pExaPixmap->validFB,
- damage);
- RegionSubtract(&pExaPixmap->validSys, &pExaPixmap->validSys,
- damage);
- } else {
- RegionUnion(&pExaPixmap->validSys, &pExaPixmap->validSys,
- damage);
- RegionSubtract(&pExaPixmap->validFB, &pExaPixmap->validFB,
- damage);
+ RegionUnion(&pExaPixmap->validFB, &pExaPixmap->validFB, damage);
+ RegionSubtract(&pExaPixmap->validSys, &pExaPixmap->validSys, damage);
+ }
+ else {
+ RegionUnion(&pExaPixmap->validSys, &pExaPixmap->validSys, damage);
+ RegionSubtract(&pExaPixmap->validFB, &pExaPixmap->validFB, damage);
}
RegionEmpty(damage);
@@ -141,63 +139,65 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
RegionSubtract(&CopyReg, pValidSrc, pValidDst);
if (migrate->as_dst) {
- ExaScreenPriv (pPixmap->drawable.pScreen);
+ ExaScreenPriv(pPixmap->drawable.pScreen);
- /* XXX: The pending damage region will be marked as damaged after the
- * operation, so it should serve as an upper bound for the region that
- * needs to be synchronized for the operation. Unfortunately, this
- * causes corruption in some cases, e.g. when starting compiz. See
- * https://bugs.freedesktop.org/show_bug.cgi?id=12916 .
- */
- if (pExaScr->optimize_migration) {
- RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
+ /* XXX: The pending damage region will be marked as damaged after the
+ * operation, so it should serve as an upper bound for the region that
+ * needs to be synchronized for the operation. Unfortunately, this
+ * causes corruption in some cases, e.g. when starting compiz. See
+ * https://bugs.freedesktop.org/show_bug.cgi?id=12916 .
+ */
+ if (pExaScr->optimize_migration) {
+ RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
#if DEBUG_MIGRATE
- if (RegionNil(pending_damage)) {
- static Bool firsttime = TRUE;
-
- if (firsttime) {
- ErrorF("%s: Pending damage region empty!\n", __func__);
- firsttime = FALSE;
- }
- }
+ if (RegionNil(pending_damage)) {
+ static Bool firsttime = TRUE;
+
+ if (firsttime) {
+ ErrorF("%s: Pending damage region empty!\n", __func__);
+ firsttime = FALSE;
+ }
+ }
#endif
- /* Try to prevent destination valid region from growing too many
- * rects by filling it up to the extents of the union of the
- * destination valid region and the pending damage region.
- */
- if (RegionNumRects(pValidDst) > 10) {
- BoxRec box;
- BoxPtr pValidExt, pDamageExt;
- RegionRec closure;
-
- pValidExt = RegionExtents(pValidDst);
- pDamageExt = RegionExtents(pending_damage);
-
- box.x1 = min(pValidExt->x1, pDamageExt->x1);
- box.y1 = min(pValidExt->y1, pDamageExt->y1);
- box.x2 = max(pValidExt->x2, pDamageExt->x2);
- box.y2 = max(pValidExt->y2, pDamageExt->y2);
-
- RegionInit(&closure, &box, 0);
- RegionIntersect(&CopyReg, &CopyReg, &closure);
- } else
- RegionIntersect(&CopyReg, &CopyReg, pending_damage);
- }
-
- /* The caller may provide a region to be subtracted from the calculated
- * dirty region. This is to avoid migration of bits that don't
- * contribute to the result of the operation.
- */
- if (migrate->pReg)
- RegionSubtract(&CopyReg, &CopyReg, migrate->pReg);
- } else {
- /* The caller may restrict the region to be migrated for source pixmaps
- * to what's relevant for the operation.
- */
- if (migrate->pReg)
- RegionIntersect(&CopyReg, &CopyReg, migrate->pReg);
+ /* Try to prevent destination valid region from growing too many
+ * rects by filling it up to the extents of the union of the
+ * destination valid region and the pending damage region.
+ */
+ if (RegionNumRects(pValidDst) > 10) {
+ BoxRec box;
+ BoxPtr pValidExt, pDamageExt;
+ RegionRec closure;
+
+ pValidExt = RegionExtents(pValidDst);
+ pDamageExt = RegionExtents(pending_damage);
+
+ box.x1 = min(pValidExt->x1, pDamageExt->x1);
+ box.y1 = min(pValidExt->y1, pDamageExt->y1);
+ box.x2 = max(pValidExt->x2, pDamageExt->x2);
+ box.y2 = max(pValidExt->y2, pDamageExt->y2);
+
+ RegionInit(&closure, &box, 0);
+ RegionIntersect(&CopyReg, &CopyReg, &closure);
+ }
+ else
+ RegionIntersect(&CopyReg, &CopyReg, pending_damage);
+ }
+
+ /* The caller may provide a region to be subtracted from the calculated
+ * dirty region. This is to avoid migration of bits that don't
+ * contribute to the result of the operation.
+ */
+ if (migrate->pReg)
+ RegionSubtract(&CopyReg, &CopyReg, migrate->pReg);
+ }
+ else {
+ /* The caller may restrict the region to be migrated for source pixmaps
+ * to what's relevant for the operation.
+ */
+ if (migrate->pReg)
+ RegionIntersect(&CopyReg, &CopyReg, migrate->pReg);
}
pBox = RegionRects(&CopyReg);
@@ -209,40 +209,43 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
pPixmap->devKind = pExaPixmap->fb_pitch;
while (nbox--) {
- pBox->x1 = max(pBox->x1, 0);
- pBox->y1 = max(pBox->y1, 0);
- pBox->x2 = min(pBox->x2, pPixmap->drawable.width);
- pBox->y2 = min(pBox->y2, pPixmap->drawable.height);
-
- if (pBox->x1 >= pBox->x2 || pBox->y1 >= pBox->y2)
- continue;
-
- if (!transfer || !transfer (pPixmap,
- pBox->x1, pBox->y1,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1,
- (char *) (pExaPixmap->sys_ptr
- + pBox->y1 * pExaPixmap->sys_pitch
- + pBox->x1 * pPixmap->drawable.bitsPerPixel / 8),
- pExaPixmap->sys_pitch))
- {
- if (!access_prepared) {
- ExaDoPrepareAccess(pPixmap, fallback_index);
- access_prepared = TRUE;
- }
- if (fallback_index == EXA_PREPARE_DEST) {
- exaMemcpyBox (pPixmap, pBox,
- pExaPixmap->sys_ptr, pExaPixmap->sys_pitch,
- pPixmap->devPrivate.ptr, pPixmap->devKind);
- } else {
- exaMemcpyBox (pPixmap, pBox,
- pPixmap->devPrivate.ptr, pPixmap->devKind,
- pExaPixmap->sys_ptr, pExaPixmap->sys_pitch);
- }
- } else
- need_sync = TRUE;
-
- pBox++;
+ pBox->x1 = max(pBox->x1, 0);
+ pBox->y1 = max(pBox->y1, 0);
+ pBox->x2 = min(pBox->x2, pPixmap->drawable.width);
+ pBox->y2 = min(pBox->y2, pPixmap->drawable.height);
+
+ if (pBox->x1 >= pBox->x2 || pBox->y1 >= pBox->y2)
+ continue;
+
+ if (!transfer || !transfer(pPixmap,
+ pBox->x1, pBox->y1,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1,
+ (char *) (pExaPixmap->sys_ptr
+ + pBox->y1 * pExaPixmap->sys_pitch
+ +
+ pBox->x1 *
+ pPixmap->drawable.bitsPerPixel /
+ 8), pExaPixmap->sys_pitch)) {
+ if (!access_prepared) {
+ ExaDoPrepareAccess(pPixmap, fallback_index);
+ access_prepared = TRUE;
+ }
+ if (fallback_index == EXA_PREPARE_DEST) {
+ exaMemcpyBox(pPixmap, pBox,
+ pExaPixmap->sys_ptr, pExaPixmap->sys_pitch,
+ pPixmap->devPrivate.ptr, pPixmap->devKind);
+ }
+ else {
+ exaMemcpyBox(pPixmap, pBox,
+ pPixmap->devPrivate.ptr, pPixmap->devKind,
+ pExaPixmap->sys_ptr, pExaPixmap->sys_pitch);
+ }
+ }
+ else
+ need_sync = TRUE;
+
+ pBox++;
}
pExaPixmap->use_gpu_copy = save_use_gpu_copy;
@@ -253,7 +256,7 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
* Removing anything beyond that would lead to data loss.
*/
if (RegionNumRects(pValidSrc) > 20)
- RegionSubtract(pValidSrc, pValidSrc, pValidDst);
+ RegionSubtract(pValidSrc, pValidSrc, pValidDst);
/* The copied bits are now valid in destination */
RegionUnion(pValidDst, pValidDst, &CopyReg);
@@ -261,9 +264,9 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
RegionUninit(&CopyReg);
if (access_prepared)
- exaFinishAccess(&pPixmap->drawable, fallback_index);
+ exaFinishAccess(&pPixmap->drawable, fallback_index);
else if (need_sync && sync)
- sync (pPixmap->drawable.pScreen);
+ sync(pPixmap->drawable.pScreen);
}
/**
@@ -272,15 +275,16 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
* allocated.
*/
void
-exaCopyDirtyToSys (ExaMigrationPtr migrate)
+exaCopyDirtyToSys(ExaMigrationPtr migrate)
{
PixmapPtr pPixmap = migrate->pPix;
- ExaScreenPriv (pPixmap->drawable.pScreen);
- ExaPixmapPriv (pPixmap);
+
+ ExaScreenPriv(pPixmap->drawable.pScreen);
+ ExaPixmapPriv(pPixmap);
exaCopyDirty(migrate, &pExaPixmap->validSys, &pExaPixmap->validFB,
- pExaScr->info->DownloadFromScreen, EXA_PREPARE_SRC,
- exaWaitSync);
+ pExaScr->info->DownloadFromScreen, EXA_PREPARE_SRC,
+ exaWaitSync);
}
/**
@@ -289,14 +293,15 @@ exaCopyDirtyToSys (ExaMigrationPtr migrate)
* allocated.
*/
void
-exaCopyDirtyToFb (ExaMigrationPtr migrate)
+exaCopyDirtyToFb(ExaMigrationPtr migrate)
{
PixmapPtr pPixmap = migrate->pPix;
- ExaScreenPriv (pPixmap->drawable.pScreen);
- ExaPixmapPriv (pPixmap);
+
+ ExaScreenPriv(pPixmap->drawable.pScreen);
+ ExaPixmapPriv(pPixmap);
exaCopyDirty(migrate, &pExaPixmap->validFB, &pExaPixmap->validSys,
- pExaScr->info->UploadToScreen, EXA_PREPARE_DEST, NULL);
+ pExaScr->info->UploadToScreen, EXA_PREPARE_DEST, NULL);
}
/**
@@ -315,54 +320,55 @@ exaCopyDirtyToFb (ExaMigrationPtr migrate)
* all the data, since it's almost surely all valid now.
*/
static void
-exaDoMoveInPixmap (ExaMigrationPtr migrate)
+exaDoMoveInPixmap(ExaMigrationPtr migrate)
{
PixmapPtr pPixmap = migrate->pPix;
ScreenPtr pScreen = pPixmap->drawable.pScreen;
- ExaScreenPriv (pScreen);
- ExaPixmapPriv (pPixmap);
+
+ ExaScreenPriv(pScreen);
+ ExaPixmapPriv(pPixmap);
/* If we're VT-switched away, no touching card memory allowed. */
if (pExaScr->swappedOut)
- return;
+ return;
/* If we're not allowed to move, then fail. */
if (exaPixmapIsPinned(pPixmap))
- return;
+ return;
/* Don't migrate in pixmaps which are less than 8bpp. This avoids a lot of
* fragility in EXA, and <8bpp is probably not used enough any more to care
* (at least, not in acceleratd paths).
*/
if (pPixmap->drawable.bitsPerPixel < 8)
- return;
+ return;
if (pExaPixmap->accel_blocked)
- return;
+ return;
if (pExaPixmap->area == NULL) {
- pExaPixmap->area =
- exaOffscreenAlloc (pScreen, pExaPixmap->fb_size,
- pExaScr->info->pixmapOffsetAlign, FALSE,
- exaPixmapSave, (pointer) pPixmap);
- if (pExaPixmap->area == NULL)
- return;
-
- pExaPixmap->fb_ptr = (CARD8 *) pExaScr->info->memoryBase +
- pExaPixmap->area->offset;
+ pExaPixmap->area =
+ exaOffscreenAlloc(pScreen, pExaPixmap->fb_size,
+ pExaScr->info->pixmapOffsetAlign, FALSE,
+ exaPixmapSave, (pointer) pPixmap);
+ if (pExaPixmap->area == NULL)
+ return;
+
+ pExaPixmap->fb_ptr = (CARD8 *) pExaScr->info->memoryBase +
+ pExaPixmap->area->offset;
}
- exaCopyDirtyToFb (migrate);
+ exaCopyDirtyToFb(migrate);
if (exaPixmapHasGpuCopy(pPixmap))
- return;
+ return;
- DBG_MIGRATE (("-> %p (0x%x) (%dx%d) (%c)\n", pPixmap,
- (ExaGetPixmapPriv(pPixmap)->area ?
- ExaGetPixmapPriv(pPixmap)->area->offset : 0),
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- exaPixmapIsDirty(pPixmap) ? 'd' : 'c'));
+ DBG_MIGRATE(("-> %p (0x%x) (%dx%d) (%c)\n", pPixmap,
+ (ExaGetPixmapPriv(pPixmap)->area ?
+ ExaGetPixmapPriv(pPixmap)->area->offset : 0),
+ pPixmap->drawable.width,
+ pPixmap->drawable.height,
+ exaPixmapIsDirty(pPixmap) ? 'd' : 'c'));
pExaPixmap->use_gpu_copy = TRUE;
@@ -371,13 +377,14 @@ exaDoMoveInPixmap (ExaMigrationPtr migrate)
}
void
-exaMoveInPixmap_classic (PixmapPtr pPixmap)
+exaMoveInPixmap_classic(PixmapPtr pPixmap)
{
- static ExaMigrationRec migrate = { FALSE, TRUE,
- NULL, NULL };
+ static ExaMigrationRec migrate = {FALSE, TRUE,
+ NULL, NULL
+ };
migrate.pPix = pPixmap;
- exaDoMoveInPixmap (&migrate);
+ exaDoMoveInPixmap(&migrate);
}
/**
@@ -385,52 +392,54 @@ exaMoveInPixmap_classic (PixmapPtr pPixmap)
* updated data out if necessary.
*/
static void
-exaDoMoveOutPixmap (ExaMigrationPtr migrate)
+exaDoMoveOutPixmap(ExaMigrationPtr migrate)
{
PixmapPtr pPixmap = migrate->pPix;
- ExaPixmapPriv (pPixmap);
+
+ ExaPixmapPriv(pPixmap);
if (!pExaPixmap->area || exaPixmapIsPinned(pPixmap))
- return;
+ return;
- exaCopyDirtyToSys (migrate);
+ exaCopyDirtyToSys(migrate);
if (exaPixmapHasGpuCopy(pPixmap)) {
- DBG_MIGRATE (("<- %p (%p) (%dx%d) (%c)\n", pPixmap,
- (void*)(ExaGetPixmapPriv(pPixmap)->area ?
- ExaGetPixmapPriv(pPixmap)->area->offset : 0),
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- exaPixmapIsDirty(pPixmap) ? 'd' : 'c'));
+ DBG_MIGRATE(("<- %p (%p) (%dx%d) (%c)\n", pPixmap,
+ (void *) (ExaGetPixmapPriv(pPixmap)->area ?
+ ExaGetPixmapPriv(pPixmap)->area->offset : 0),
+ pPixmap->drawable.width,
+ pPixmap->drawable.height,
+ exaPixmapIsDirty(pPixmap) ? 'd' : 'c'));
- pExaPixmap->use_gpu_copy = FALSE;
+ pExaPixmap->use_gpu_copy = FALSE;
- pPixmap->devKind = pExaPixmap->sys_pitch;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->devKind = pExaPixmap->sys_pitch;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
}
}
void
-exaMoveOutPixmap_classic (PixmapPtr pPixmap)
+exaMoveOutPixmap_classic(PixmapPtr pPixmap)
{
static ExaMigrationRec migrate = { FALSE, TRUE,
- NULL, NULL };
+ NULL, NULL
+ };
migrate.pPix = pPixmap;
- exaDoMoveOutPixmap (&migrate);
+ exaDoMoveOutPixmap(&migrate);
}
-
/**
* Copies out important pixmap data and removes references to framebuffer area.
* Called when the memory manager decides it's time to kick the pixmap out of
* framebuffer entirely.
*/
void
-exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area)
+exaPixmapSave(ScreenPtr pScreen, ExaOffscreenArea * area)
{
PixmapPtr pPixmap = area->privData;
+
ExaPixmapPriv(pPixmap);
exaMoveOutPixmap(pPixmap);
@@ -448,39 +457,40 @@ exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area)
* framebuffer memory.
*/
static void
-exaMigrateTowardFb (ExaMigrationPtr migrate)
+exaMigrateTowardFb(ExaMigrationPtr migrate)
{
PixmapPtr pPixmap = migrate->pPix;
- ExaPixmapPriv (pPixmap);
+
+ ExaPixmapPriv(pPixmap);
if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED) {
- DBG_MIGRATE(("UseScreen: not migrating pinned pixmap %p\n",
- (pointer)pPixmap));
- return;
+ DBG_MIGRATE(("UseScreen: not migrating pinned pixmap %p\n",
+ (pointer) pPixmap));
+ return;
}
DBG_MIGRATE(("UseScreen %p score %d\n",
- (pointer)pPixmap, pExaPixmap->score));
+ (pointer) pPixmap, pExaPixmap->score));
if (pExaPixmap->score == EXA_PIXMAP_SCORE_INIT) {
- exaDoMoveInPixmap(migrate);
- pExaPixmap->score = 0;
+ exaDoMoveInPixmap(migrate);
+ pExaPixmap->score = 0;
}
if (pExaPixmap->score < EXA_PIXMAP_SCORE_MAX)
- pExaPixmap->score++;
+ pExaPixmap->score++;
if (pExaPixmap->score >= EXA_PIXMAP_SCORE_MOVE_IN &&
- !exaPixmapHasGpuCopy(pPixmap))
- {
- exaDoMoveInPixmap(migrate);
+ !exaPixmapHasGpuCopy(pPixmap)) {
+ exaDoMoveInPixmap(migrate);
}
if (exaPixmapHasGpuCopy(pPixmap)) {
- exaCopyDirtyToFb (migrate);
- ExaOffscreenMarkUsed (pPixmap);
- } else
- exaCopyDirtyToSys (migrate);
+ exaCopyDirtyToFb(migrate);
+ ExaOffscreenMarkUsed(pPixmap);
+ }
+ else
+ exaCopyDirtyToSys(migrate);
}
/**
@@ -488,30 +498,33 @@ exaMigrateTowardFb (ExaMigrationPtr migrate)
* system memory.
*/
static void
-exaMigrateTowardSys (ExaMigrationPtr migrate)
+exaMigrateTowardSys(ExaMigrationPtr migrate)
{
PixmapPtr pPixmap = migrate->pPix;
- ExaPixmapPriv (pPixmap);
- DBG_MIGRATE(("UseMem: %p score %d\n", (pointer)pPixmap, pExaPixmap->score));
+ ExaPixmapPriv(pPixmap);
+
+ DBG_MIGRATE(("UseMem: %p score %d\n", (pointer) pPixmap,
+ pExaPixmap->score));
if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
- return;
+ return;
if (pExaPixmap->score == EXA_PIXMAP_SCORE_INIT)
- pExaPixmap->score = 0;
+ pExaPixmap->score = 0;
if (pExaPixmap->score > EXA_PIXMAP_SCORE_MIN)
- pExaPixmap->score--;
+ pExaPixmap->score--;
if (pExaPixmap->score <= EXA_PIXMAP_SCORE_MOVE_OUT && pExaPixmap->area)
- exaDoMoveOutPixmap(migrate);
+ exaDoMoveOutPixmap(migrate);
if (exaPixmapHasGpuCopy(pPixmap)) {
- exaCopyDirtyToFb (migrate);
- ExaOffscreenMarkUsed (pPixmap);
- } else
- exaCopyDirtyToSys (migrate);
+ exaCopyDirtyToFb(migrate);
+ ExaOffscreenMarkUsed(pPixmap);
+ }
+ else
+ exaCopyDirtyToSys(migrate);
}
/**
@@ -519,9 +532,9 @@ exaMigrateTowardSys (ExaMigrationPtr migrate)
* asserts that both of them are the same.
*/
static Bool
-exaAssertNotDirty (PixmapPtr pPixmap)
+exaAssertNotDirty(PixmapPtr pPixmap)
{
- ExaPixmapPriv (pPixmap);
+ ExaPixmapPriv(pPixmap);
CARD8 *dst, *src;
RegionRec ValidReg;
int dst_pitch, src_pitch, cpp, y, nbox, save_pitch;
@@ -529,15 +542,14 @@ exaAssertNotDirty (PixmapPtr pPixmap)
Bool ret = TRUE, save_use_gpu_copy;
if (exaPixmapIsPinned(pPixmap) || pExaPixmap->area == NULL)
- return ret;
+ return ret;
RegionNull(&ValidReg);
- RegionIntersect(&ValidReg, &pExaPixmap->validFB,
- &pExaPixmap->validSys);
+ RegionIntersect(&ValidReg, &pExaPixmap->validFB, &pExaPixmap->validSys);
nbox = RegionNumRects(&ValidReg);
if (!nbox)
- goto out;
+ goto out;
pBox = RegionRects(&ValidReg);
@@ -551,41 +563,42 @@ exaAssertNotDirty (PixmapPtr pPixmap)
pPixmap->devKind = pExaPixmap->fb_pitch;
if (!ExaDoPrepareAccess(pPixmap, EXA_PREPARE_SRC))
- goto skip;
+ goto skip;
while (nbox--) {
- int rowbytes;
-
- pBox->x1 = max(pBox->x1, 0);
- pBox->y1 = max(pBox->y1, 0);
- pBox->x2 = min(pBox->x2, pPixmap->drawable.width);
- pBox->y2 = min(pBox->y2, pPixmap->drawable.height);
-
- if (pBox->x1 >= pBox->x2 || pBox->y1 >= pBox->y2)
- continue;
-
- rowbytes = (pBox->x2 - pBox->x1) * cpp;
- src = (CARD8 *) pPixmap->devPrivate.ptr + pBox->y1 * src_pitch + pBox->x1 * cpp;
- dst = pExaPixmap->sys_ptr + pBox->y1 * dst_pitch + pBox->x1 * cpp;
-
- for (y = pBox->y1; y < pBox->y2;
- y++, src += src_pitch, dst += dst_pitch) {
- if (memcmp(dst, src, rowbytes) != 0) {
- ret = FALSE;
- exaPixmapDirty(pPixmap, pBox->x1, pBox->y1, pBox->x2,
- pBox->y2);
- break;
- }
- }
+ int rowbytes;
+
+ pBox->x1 = max(pBox->x1, 0);
+ pBox->y1 = max(pBox->y1, 0);
+ pBox->x2 = min(pBox->x2, pPixmap->drawable.width);
+ pBox->y2 = min(pBox->y2, pPixmap->drawable.height);
+
+ if (pBox->x1 >= pBox->x2 || pBox->y1 >= pBox->y2)
+ continue;
+
+ rowbytes = (pBox->x2 - pBox->x1) * cpp;
+ src =
+ (CARD8 *) pPixmap->devPrivate.ptr + pBox->y1 * src_pitch +
+ pBox->x1 * cpp;
+ dst = pExaPixmap->sys_ptr + pBox->y1 * dst_pitch + pBox->x1 * cpp;
+
+ for (y = pBox->y1; y < pBox->y2;
+ y++, src += src_pitch, dst += dst_pitch) {
+ if (memcmp(dst, src, rowbytes) != 0) {
+ ret = FALSE;
+ exaPixmapDirty(pPixmap, pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ break;
+ }
+ }
}
-skip:
+ skip:
exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
pExaPixmap->use_gpu_copy = save_use_gpu_copy;
pPixmap->devKind = save_pitch;
-out:
+ out:
RegionUninit(&ValidReg);
return ret;
}
@@ -596,9 +609,10 @@ out:
* config file.
*/
void
-exaDoMigration_classic (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
+exaDoMigration_classic(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
{
ScreenPtr pScreen = pixmaps[0].pPix->drawable.pScreen;
+
ExaScreenPriv(pScreen);
int i, j;
@@ -610,117 +624,118 @@ exaDoMigration_classic (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
* to the pixmap last shouldn't be hard.
*/
if (pExaScr->checkDirtyCorrectness) {
- for (i = 0; i < npixmaps; i++) {
- if (!exaPixmapIsDirty (pixmaps[i].pPix) &&
- !exaAssertNotDirty (pixmaps[i].pPix))
- ErrorF("%s: Pixmap %d dirty but not marked as such!\n", __FUNCTION__, i);
- }
+ for (i = 0; i < npixmaps; i++) {
+ if (!exaPixmapIsDirty(pixmaps[i].pPix) &&
+ !exaAssertNotDirty(pixmaps[i].pPix))
+ ErrorF("%s: Pixmap %d dirty but not marked as such!\n",
+ __FUNCTION__, i);
+ }
}
/* If anything is pinned in system memory, we won't be able to
* accelerate.
*/
for (i = 0; i < npixmaps; i++) {
- if (exaPixmapIsPinned (pixmaps[i].pPix) &&
- !exaPixmapHasGpuCopy (pixmaps[i].pPix))
- {
- EXA_FALLBACK(("Pixmap %p (%dx%d) pinned in sys\n", pixmaps[i].pPix,
- pixmaps[i].pPix->drawable.width,
- pixmaps[i].pPix->drawable.height));
- can_accel = FALSE;
- break;
- }
+ if (exaPixmapIsPinned(pixmaps[i].pPix) &&
+ !exaPixmapHasGpuCopy(pixmaps[i].pPix)) {
+ EXA_FALLBACK(("Pixmap %p (%dx%d) pinned in sys\n", pixmaps[i].pPix,
+ pixmaps[i].pPix->drawable.width,
+ pixmaps[i].pPix->drawable.height));
+ can_accel = FALSE;
+ break;
+ }
}
if (pExaScr->migration == ExaMigrationSmart) {
- /* If we've got something as a destination that we shouldn't cause to
- * become newly dirtied, take the unaccelerated route.
- */
- for (i = 0; i < npixmaps; i++) {
- if (pixmaps[i].as_dst && !exaPixmapShouldBeInFB (pixmaps[i].pPix) &&
- !exaPixmapIsDirty (pixmaps[i].pPix))
- {
- for (i = 0; i < npixmaps; i++) {
- if (!exaPixmapIsDirty (pixmaps[i].pPix))
- exaDoMoveOutPixmap (pixmaps + i);
- }
- return;
- }
- }
-
- /* If we aren't going to accelerate, then we migrate everybody toward
- * system memory, and kick out if it's free.
- */
- if (!can_accel) {
- for (i = 0; i < npixmaps; i++) {
- exaMigrateTowardSys (pixmaps + i);
- if (!exaPixmapIsDirty (pixmaps[i].pPix))
- exaDoMoveOutPixmap (pixmaps + i);
- }
- return;
- }
-
- /* Finally, the acceleration path. Move them all in. */
- for (i = 0; i < npixmaps; i++) {
- exaMigrateTowardFb(pixmaps + i);
- exaDoMoveInPixmap(pixmaps + i);
- }
- } else if (pExaScr->migration == ExaMigrationGreedy) {
- /* If we can't accelerate, either because the driver can't or because one of
- * the pixmaps is pinned in system memory, then we migrate everybody toward
- * system memory.
- *
- * We also migrate toward system if all pixmaps involved are currently in
- * system memory -- this can mitigate thrashing when there are significantly
- * more pixmaps active than would fit in memory.
- *
- * If not, then we migrate toward FB so that hopefully acceleration can
- * happen.
- */
- if (!can_accel) {
- for (i = 0; i < npixmaps; i++)
- exaMigrateTowardSys (pixmaps + i);
- return;
- }
-
- for (i = 0; i < npixmaps; i++) {
- if (exaPixmapHasGpuCopy(pixmaps[i].pPix)) {
- /* Found one in FB, so move all to FB. */
- for (j = 0; j < npixmaps; j++)
- exaMigrateTowardFb(pixmaps + i);
- return;
- }
- }
-
- /* Nobody's in FB, so move all away from FB. */
- for (i = 0; i < npixmaps; i++)
- exaMigrateTowardSys(pixmaps + i);
- } else if (pExaScr->migration == ExaMigrationAlways) {
- /* Always move the pixmaps out if we can't accelerate. If we can
- * accelerate, try to move them all in. If that fails, then move them
- * back out.
- */
- if (!can_accel) {
- for (i = 0; i < npixmaps; i++)
- exaDoMoveOutPixmap(pixmaps + i);
- return;
- }
-
- /* Now, try to move them all into FB */
- for (i = 0; i < npixmaps; i++) {
- exaDoMoveInPixmap(pixmaps + i);
- }
-
- /* If we couldn't fit everything in, abort */
- for (i = 0; i < npixmaps; i++) {
- if (!exaPixmapHasGpuCopy(pixmaps[i].pPix)) {
- return;
- }
- }
-
- /* Yay, everything has a gpu copy, mark memory as used */
- for (i = 0; i < npixmaps; i++) {
- ExaOffscreenMarkUsed (pixmaps[i].pPix);
- }
+ /* If we've got something as a destination that we shouldn't cause to
+ * become newly dirtied, take the unaccelerated route.
+ */
+ for (i = 0; i < npixmaps; i++) {
+ if (pixmaps[i].as_dst && !exaPixmapShouldBeInFB(pixmaps[i].pPix) &&
+ !exaPixmapIsDirty(pixmaps[i].pPix)) {
+ for (i = 0; i < npixmaps; i++) {
+ if (!exaPixmapIsDirty(pixmaps[i].pPix))
+ exaDoMoveOutPixmap(pixmaps + i);
+ }
+ return;
+ }
+ }
+
+ /* If we aren't going to accelerate, then we migrate everybody toward
+ * system memory, and kick out if it's free.
+ */
+ if (!can_accel) {
+ for (i = 0; i < npixmaps; i++) {
+ exaMigrateTowardSys(pixmaps + i);
+ if (!exaPixmapIsDirty(pixmaps[i].pPix))
+ exaDoMoveOutPixmap(pixmaps + i);
+ }
+ return;
+ }
+
+ /* Finally, the acceleration path. Move them all in. */
+ for (i = 0; i < npixmaps; i++) {
+ exaMigrateTowardFb(pixmaps + i);
+ exaDoMoveInPixmap(pixmaps + i);
+ }
+ }
+ else if (pExaScr->migration == ExaMigrationGreedy) {
+ /* If we can't accelerate, either because the driver can't or because one of
+ * the pixmaps is pinned in system memory, then we migrate everybody toward
+ * system memory.
+ *
+ * We also migrate toward system if all pixmaps involved are currently in
+ * system memory -- this can mitigate thrashing when there are significantly
+ * more pixmaps active than would fit in memory.
+ *
+ * If not, then we migrate toward FB so that hopefully acceleration can
+ * happen.
+ */
+ if (!can_accel) {
+ for (i = 0; i < npixmaps; i++)
+ exaMigrateTowardSys(pixmaps + i);
+ return;
+ }
+
+ for (i = 0; i < npixmaps; i++) {
+ if (exaPixmapHasGpuCopy(pixmaps[i].pPix)) {
+ /* Found one in FB, so move all to FB. */
+ for (j = 0; j < npixmaps; j++)
+ exaMigrateTowardFb(pixmaps + i);
+ return;
+ }
+ }
+
+ /* Nobody's in FB, so move all away from FB. */
+ for (i = 0; i < npixmaps; i++)
+ exaMigrateTowardSys(pixmaps + i);
+ }
+ else if (pExaScr->migration == ExaMigrationAlways) {
+ /* Always move the pixmaps out if we can't accelerate. If we can
+ * accelerate, try to move them all in. If that fails, then move them
+ * back out.
+ */
+ if (!can_accel) {
+ for (i = 0; i < npixmaps; i++)
+ exaDoMoveOutPixmap(pixmaps + i);
+ return;
+ }
+
+ /* Now, try to move them all into FB */
+ for (i = 0; i < npixmaps; i++) {
+ exaDoMoveInPixmap(pixmaps + i);
+ }
+
+ /* If we couldn't fit everything in, abort */
+ for (i = 0; i < npixmaps; i++) {
+ if (!exaPixmapHasGpuCopy(pixmaps[i].pPix)) {
+ return;
+ }
+ }
+
+ /* Yay, everything has a gpu copy, mark memory as used */
+ for (i = 0; i < npixmaps; i++) {
+ ExaOffscreenMarkUsed(pixmaps[i].pPix);
+ }
}
}
@@ -730,16 +745,17 @@ exaPrepareAccessReg_classic(PixmapPtr pPixmap, int index, RegionPtr pReg)
ExaMigrationRec pixmaps[1];
if (index == EXA_PREPARE_DEST || index == EXA_PREPARE_AUX_DEST) {
- pixmaps[0].as_dst = TRUE;
- pixmaps[0].as_src = FALSE;
- } else {
- pixmaps[0].as_dst = FALSE;
- pixmaps[0].as_src = TRUE;
+ pixmaps[0].as_dst = TRUE;
+ pixmaps[0].as_src = FALSE;
+ }
+ else {
+ pixmaps[0].as_dst = FALSE;
+ pixmaps[0].as_src = TRUE;
}
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = pReg;
exaDoMigration(pixmaps, 1, FALSE);
- (void)ExaDoPrepareAccess(pPixmap, index);
+ (void) ExaDoPrepareAccess(pPixmap, index);
}
diff --git a/xorg-server/exa/exa_migration_mixed.c b/xorg-server/exa/exa_migration_mixed.c
index 4b2261943..445c4fcbf 100644
--- a/xorg-server/exa/exa_migration_mixed.c
+++ b/xorg-server/exa/exa_migration_mixed.c
@@ -35,6 +35,7 @@ void
exaCreateDriverPixmap_mixed(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
ExaScreenPriv(pScreen);
ExaPixmapPriv(pPixmap);
int w = pPixmap->drawable.width, h = pPixmap->drawable.height;
@@ -44,30 +45,34 @@ exaCreateDriverPixmap_mixed(PixmapPtr pPixmap)
/* Already done. */
if (pExaPixmap->driverPriv)
- return;
+ return;
if (exaPixmapIsPinned(pPixmap))
- return;
+ return;
/* Can't accel 1/4 bpp. */
if (pExaPixmap->accel_blocked || bpp < 8)
- return;
+ return;
if (pExaScr->info->CreatePixmap2) {
- int new_pitch = 0;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp, &new_pitch);
- paddedWidth = pExaPixmap->fb_pitch = new_pitch;
- } else {
- if (paddedWidth < pExaPixmap->fb_pitch)
- paddedWidth = pExaPixmap->fb_pitch;
- pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, paddedWidth*h, 0);
+ int new_pitch = 0;
+
+ pExaPixmap->driverPriv =
+ pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp,
+ &new_pitch);
+ paddedWidth = pExaPixmap->fb_pitch = new_pitch;
+ }
+ else {
+ if (paddedWidth < pExaPixmap->fb_pitch)
+ paddedWidth = pExaPixmap->fb_pitch;
+ pExaPixmap->driverPriv =
+ pExaScr->info->CreatePixmap(pScreen, paddedWidth * h, 0);
}
if (!pExaPixmap->driverPriv)
- return;
+ return;
- (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
- paddedWidth, NULL);
+ (*pScreen->ModifyPixmapHeader) (pPixmap, w, h, 0, 0, paddedWidth, NULL);
}
void
@@ -79,45 +84,45 @@ exaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
* accelerate.
*/
for (i = 0; i < npixmaps; i++) {
- if (exaPixmapIsPinned (pixmaps[i].pPix) &&
- !exaPixmapHasGpuCopy (pixmaps[i].pPix))
- {
- can_accel = FALSE;
- break;
- }
+ if (exaPixmapIsPinned(pixmaps[i].pPix) &&
+ !exaPixmapHasGpuCopy(pixmaps[i].pPix)) {
+ can_accel = FALSE;
+ break;
+ }
}
/* We can do nothing. */
if (!can_accel)
- return;
+ return;
for (i = 0; i < npixmaps; i++) {
- PixmapPtr pPixmap = pixmaps[i].pPix;
- ExaPixmapPriv(pPixmap);
-
- if (!pExaPixmap->driverPriv)
- exaCreateDriverPixmap_mixed(pPixmap);
-
- if (pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) {
- ExaScreenPriv(pPixmap->drawable.pScreen);
-
- /* This pitch is needed for proper acceleration. For some reason
- * there are pixmaps without pDamage and a bad fb_pitch value.
- * So setting devKind when only exaPixmapHasGpuCopy() is true
- * causes corruption. Pixmaps without pDamage are not migrated
- * and should have a valid devKind at all times, so that's why this
- * isn't causing problems. Pixmaps have their gpu pitch set the
- * first time in the MPH call from exaCreateDriverPixmap_mixed().
- */
- pPixmap->devKind = pExaPixmap->fb_pitch;
- exaCopyDirtyToFb(pixmaps + i);
-
- if (pExaScr->deferred_mixed_pixmap == pPixmap &&
- !pixmaps[i].as_dst && !pixmaps[i].pReg)
- pExaScr->deferred_mixed_pixmap = NULL;
- }
-
- pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
+ PixmapPtr pPixmap = pixmaps[i].pPix;
+
+ ExaPixmapPriv(pPixmap);
+
+ if (!pExaPixmap->driverPriv)
+ exaCreateDriverPixmap_mixed(pPixmap);
+
+ if (pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) {
+ ExaScreenPriv(pPixmap->drawable.pScreen);
+
+ /* This pitch is needed for proper acceleration. For some reason
+ * there are pixmaps without pDamage and a bad fb_pitch value.
+ * So setting devKind when only exaPixmapHasGpuCopy() is true
+ * causes corruption. Pixmaps without pDamage are not migrated
+ * and should have a valid devKind at all times, so that's why this
+ * isn't causing problems. Pixmaps have their gpu pitch set the
+ * first time in the MPH call from exaCreateDriverPixmap_mixed().
+ */
+ pPixmap->devKind = pExaPixmap->fb_pitch;
+ exaCopyDirtyToFb(pixmaps + i);
+
+ if (pExaScr->deferred_mixed_pixmap == pPixmap &&
+ !pixmaps[i].as_dst && !pixmaps[i].pReg)
+ pExaScr->deferred_mixed_pixmap = NULL;
+ }
+
+ pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
}
}
@@ -138,6 +143,7 @@ void
exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
PixmapPtr pPixmap = closure;
+
ExaPixmapPriv(pPixmap);
/* Move back results of software rendering on system memory copy of mixed driver
@@ -147,12 +153,12 @@ exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure)
* overhead on multiple subsequent software fallbacks.
*/
if (!pExaPixmap->use_gpu_copy && exaPixmapHasGpuCopy(pPixmap)) {
- ExaScreenPriv(pPixmap->drawable.pScreen);
+ ExaScreenPriv(pPixmap->drawable.pScreen);
- if (pExaScr->deferred_mixed_pixmap &&
- pExaScr->deferred_mixed_pixmap != pPixmap)
- exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
- pExaScr->deferred_mixed_pixmap = pPixmap;
+ if (pExaScr->deferred_mixed_pixmap &&
+ pExaScr->deferred_mixed_pixmap != pPixmap)
+ exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
+ pExaScr->deferred_mixed_pixmap = pPixmap;
}
}
@@ -171,91 +177,92 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
success = ExaDoPrepareAccess(pPixmap, index);
if (success && has_gpu_copy && pExaPixmap->pDamage) {
- /* You cannot do accelerated operations while a buffer is mapped. */
- exaFinishAccess(&pPixmap->drawable, index);
- /* Update the gpu view of both deferred destination pixmaps and of
- * source pixmaps that were migrated with a bounding region.
- */
- exaMoveInPixmap_mixed(pPixmap);
- success = ExaDoPrepareAccess(pPixmap, index);
-
- if (success) {
- /* We have a gpu pixmap that can be accessed, we don't need the cpu
- * copy anymore. Drivers that prefer DFS, should fail prepare
- * access.
- */
- DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
- DamageDestroy(pExaPixmap->pDamage);
- pExaPixmap->pDamage = NULL;
-
- free(pExaPixmap->sys_ptr);
- pExaPixmap->sys_ptr = NULL;
-
- return;
- }
+ /* You cannot do accelerated operations while a buffer is mapped. */
+ exaFinishAccess(&pPixmap->drawable, index);
+ /* Update the gpu view of both deferred destination pixmaps and of
+ * source pixmaps that were migrated with a bounding region.
+ */
+ exaMoveInPixmap_mixed(pPixmap);
+ success = ExaDoPrepareAccess(pPixmap, index);
+
+ if (success) {
+ /* We have a gpu pixmap that can be accessed, we don't need the cpu
+ * copy anymore. Drivers that prefer DFS, should fail prepare
+ * access.
+ */
+ DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+ DamageDestroy(pExaPixmap->pDamage);
+ pExaPixmap->pDamage = NULL;
+
+ free(pExaPixmap->sys_ptr);
+ pExaPixmap->sys_ptr = NULL;
+
+ return;
+ }
}
if (!success) {
- ExaMigrationRec pixmaps[1];
-
- /* Do we need to allocate our system buffer? */
- if (!pExaPixmap->sys_ptr) {
- pExaPixmap->sys_ptr = malloc(pExaPixmap->sys_pitch *
- pPixmap->drawable.height);
- if (!pExaPixmap->sys_ptr)
- FatalError("EXA: malloc failed for size %d bytes\n",
- pExaPixmap->sys_pitch * pPixmap->drawable.height);
- }
-
- if (index == EXA_PREPARE_DEST || index == EXA_PREPARE_AUX_DEST) {
- pixmaps[0].as_dst = TRUE;
- pixmaps[0].as_src = FALSE;
- } else {
- pixmaps[0].as_dst = FALSE;
- pixmaps[0].as_src = TRUE;
- }
- pixmaps[0].pPix = pPixmap;
- pixmaps[0].pReg = pReg;
-
- if (!pExaPixmap->pDamage &&
- (has_gpu_copy || !exaPixmapIsPinned(pPixmap))) {
- Bool as_dst = pixmaps[0].as_dst;
-
- /* Set up damage tracking */
- pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL,
- DamageReportNonEmpty, TRUE,
- pPixmap->drawable.pScreen,
- pPixmap);
-
- DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
- /* This ensures that pending damage reflects the current operation. */
- /* This is used by exa to optimize migration. */
- DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
-
- if (has_gpu_copy) {
- exaPixmapDirty(pPixmap, 0, 0, pPixmap->drawable.width,
- pPixmap->drawable.height);
-
- /* We don't know which region of the destination will be damaged,
- * have to assume all of it
- */
- if (as_dst) {
- pixmaps[0].as_dst = FALSE;
- pixmaps[0].as_src = TRUE;
- pixmaps[0].pReg = NULL;
- }
- exaCopyDirtyToSys(pixmaps);
- }
-
- if (as_dst)
- exaPixmapDirty(pPixmap, 0, 0, pPixmap->drawable.width,
- pPixmap->drawable.height);
- } else if (has_gpu_copy)
- exaCopyDirtyToSys(pixmaps);
-
- pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
- pPixmap->devKind = pExaPixmap->sys_pitch;
- pExaPixmap->use_gpu_copy = FALSE;
+ ExaMigrationRec pixmaps[1];
+
+ /* Do we need to allocate our system buffer? */
+ if (!pExaPixmap->sys_ptr) {
+ pExaPixmap->sys_ptr = malloc(pExaPixmap->sys_pitch *
+ pPixmap->drawable.height);
+ if (!pExaPixmap->sys_ptr)
+ FatalError("EXA: malloc failed for size %d bytes\n",
+ pExaPixmap->sys_pitch * pPixmap->drawable.height);
+ }
+
+ if (index == EXA_PREPARE_DEST || index == EXA_PREPARE_AUX_DEST) {
+ pixmaps[0].as_dst = TRUE;
+ pixmaps[0].as_src = FALSE;
+ }
+ else {
+ pixmaps[0].as_dst = FALSE;
+ pixmaps[0].as_src = TRUE;
+ }
+ pixmaps[0].pPix = pPixmap;
+ pixmaps[0].pReg = pReg;
+
+ if (!pExaPixmap->pDamage &&
+ (has_gpu_copy || !exaPixmapIsPinned(pPixmap))) {
+ Bool as_dst = pixmaps[0].as_dst;
+
+ /* Set up damage tracking */
+ pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL,
+ DamageReportNonEmpty, TRUE,
+ pPixmap->drawable.pScreen,
+ pPixmap);
+
+ DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
+ /* This ensures that pending damage reflects the current operation. */
+ /* This is used by exa to optimize migration. */
+ DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
+
+ if (has_gpu_copy) {
+ exaPixmapDirty(pPixmap, 0, 0, pPixmap->drawable.width,
+ pPixmap->drawable.height);
+
+ /* We don't know which region of the destination will be damaged,
+ * have to assume all of it
+ */
+ if (as_dst) {
+ pixmaps[0].as_dst = FALSE;
+ pixmaps[0].as_src = TRUE;
+ pixmaps[0].pReg = NULL;
+ }
+ exaCopyDirtyToSys(pixmaps);
+ }
+
+ if (as_dst)
+ exaPixmapDirty(pPixmap, 0, 0, pPixmap->drawable.width,
+ pPixmap->drawable.height);
+ }
+ else if (has_gpu_copy)
+ exaCopyDirtyToSys(pixmaps);
+
+ pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
+ pPixmap->devKind = pExaPixmap->sys_pitch;
+ pExaPixmap->use_gpu_copy = FALSE;
}
}
-
diff --git a/xorg-server/exa/exa_mixed.c b/xorg-server/exa/exa_mixed.c
index 0b1a4a4a4..06817313f 100644
--- a/xorg-server/exa/exa_mixed.c
+++ b/xorg-server/exa/exa_mixed.c
@@ -34,7 +34,7 @@
/* This file holds the driver allocated pixmaps + better initial placement code.
*/
-static _X_INLINE void*
+static _X_INLINE void *
ExaGetPixmapAddress(PixmapPtr p)
{
ExaPixmapPriv(p);
@@ -47,16 +47,17 @@ ExaGetPixmapAddress(PixmapPtr p)
*/
PixmapPtr
exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
+ unsigned usage_hint)
{
PixmapPtr pPixmap;
- ExaPixmapPrivPtr pExaPixmap;
+ ExaPixmapPrivPtr pExaPixmap;
int bpp;
size_t paddedWidth;
+
ExaScreenPriv(pScreen);
if (w > 32767 || h > 32767)
- return NullPixmap;
+ return NullPixmap;
swap(pExaScr, pScreen, CreatePixmap);
pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
@@ -84,45 +85,44 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
pExaPixmap->pDamage = NULL;
exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
- exaSetAccelBlock(pExaScr, pExaPixmap,
- w, h, bpp);
+ exaSetAccelBlock(pExaScr, pExaPixmap, w, h, bpp);
- (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
- paddedWidth, NULL);
+ (*pScreen->ModifyPixmapHeader) (pPixmap, w, h, 0, 0, paddedWidth, NULL);
/* A scratch pixmap will become a driver pixmap right away. */
if (!w || !h) {
- exaCreateDriverPixmap_mixed(pPixmap);
- pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
- } else {
- pExaPixmap->use_gpu_copy = FALSE;
-
- if (w == 1 && h == 1) {
- pExaPixmap->sys_ptr = malloc(paddedWidth);
-
- /* Set up damage tracking */
- pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL,
- DamageReportNonEmpty, TRUE,
- pPixmap->drawable.pScreen,
- pPixmap);
-
- DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
- /* This ensures that pending damage reflects the current operation. */
- /* This is used by exa to optimize migration. */
- DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
- }
+ exaCreateDriverPixmap_mixed(pPixmap);
+ pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
+ }
+ else {
+ pExaPixmap->use_gpu_copy = FALSE;
+
+ if (w == 1 && h == 1) {
+ pExaPixmap->sys_ptr = malloc(paddedWidth);
+
+ /* Set up damage tracking */
+ pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL,
+ DamageReportNonEmpty, TRUE,
+ pPixmap->drawable.pScreen,
+ pPixmap);
+
+ DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
+ /* This ensures that pending damage reflects the current operation. */
+ /* This is used by exa to optimize migration. */
+ DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
+ }
}
/* During a fallback we must prepare access. */
if (pExaScr->fallback_counter)
- exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
+ exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
return pPixmap;
}
Bool
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData)
+ int bitsPerPixel, int devKind, pointer pPixData)
{
ScreenPtr pScreen;
ExaScreenPrivPtr pExaScr;
@@ -137,100 +137,102 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
pExaPixmap = ExaGetPixmapPriv(pPixmap);
if (pPixData) {
- if (pExaPixmap->driverPriv) {
- if (pExaPixmap->pDamage) {
- DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
- DamageDestroy(pExaPixmap->pDamage);
- pExaPixmap->pDamage = NULL;
- }
-
- pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
- pExaPixmap->driverPriv = NULL;
- }
-
- pExaPixmap->use_gpu_copy = FALSE;
- pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
+ if (pExaPixmap->driverPriv) {
+ if (pExaPixmap->pDamage) {
+ DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+ DamageDestroy(pExaPixmap->pDamage);
+ pExaPixmap->pDamage = NULL;
+ }
+
+ pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
+ pExaPixmap->driverPriv = NULL;
+ }
+
+ pExaPixmap->use_gpu_copy = FALSE;
+ pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
}
has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
if (width <= 0)
- width = pPixmap->drawable.width;
+ width = pPixmap->drawable.width;
if (height <= 0)
- height = pPixmap->drawable.height;
+ height = pPixmap->drawable.height;
if (bitsPerPixel <= 0) {
- if (depth <= 0)
- bitsPerPixel = pPixmap->drawable.bitsPerPixel;
- else
- bitsPerPixel = BitsPerPixel(depth);
+ if (depth <= 0)
+ bitsPerPixel = pPixmap->drawable.bitsPerPixel;
+ else
+ bitsPerPixel = BitsPerPixel(depth);
}
if (depth <= 0)
- depth = pPixmap->drawable.depth;
+ depth = pPixmap->drawable.depth;
if (width != pPixmap->drawable.width ||
- height != pPixmap->drawable.height ||
- depth != pPixmap->drawable.depth ||
- bitsPerPixel != pPixmap->drawable.bitsPerPixel) {
- if (pExaPixmap->driverPriv) {
- if (devKind > 0)
- pExaPixmap->fb_pitch = devKind;
- else
- exaSetFbPitch(pExaScr, pExaPixmap, width, height, bitsPerPixel);
-
- exaSetAccelBlock(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
+ height != pPixmap->drawable.height ||
+ depth != pPixmap->drawable.depth ||
+ bitsPerPixel != pPixmap->drawable.bitsPerPixel) {
+ if (pExaPixmap->driverPriv) {
+ if (devKind > 0)
+ pExaPixmap->fb_pitch = devKind;
+ else
+ exaSetFbPitch(pExaScr, pExaPixmap, width, height, bitsPerPixel);
+
+ exaSetAccelBlock(pExaScr, pExaPixmap, width, height, bitsPerPixel);
RegionEmpty(&pExaPixmap->validFB);
}
- /* Need to re-create system copy if there's also a GPU copy */
- if (has_gpu_copy) {
- if (pExaPixmap->sys_ptr) {
- free(pExaPixmap->sys_ptr);
- pExaPixmap->sys_ptr = NULL;
- DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
- DamageDestroy(pExaPixmap->pDamage);
- pExaPixmap->pDamage = NULL;
- RegionEmpty(&pExaPixmap->validSys);
-
- if (pExaScr->deferred_mixed_pixmap == pPixmap)
- pExaScr->deferred_mixed_pixmap = NULL;
- }
-
- pExaPixmap->sys_pitch = PixmapBytePad(width, depth);
- }
+ /* Need to re-create system copy if there's also a GPU copy */
+ if (has_gpu_copy) {
+ if (pExaPixmap->sys_ptr) {
+ free(pExaPixmap->sys_ptr);
+ pExaPixmap->sys_ptr = NULL;
+ DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+ DamageDestroy(pExaPixmap->pDamage);
+ pExaPixmap->pDamage = NULL;
+ RegionEmpty(&pExaPixmap->validSys);
+
+ if (pExaScr->deferred_mixed_pixmap == pPixmap)
+ pExaScr->deferred_mixed_pixmap = NULL;
+ }
+
+ pExaPixmap->sys_pitch = PixmapBytePad(width, depth);
+ }
}
if (has_gpu_copy) {
- pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr;
- pPixmap->devKind = pExaPixmap->fb_pitch;
- } else {
- pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
- pPixmap->devKind = pExaPixmap->sys_pitch;
+ pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr;
+ pPixmap->devKind = pExaPixmap->fb_pitch;
+ }
+ else {
+ pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
+ pPixmap->devKind = pExaPixmap->sys_pitch;
}
/* Only pass driver pixmaps to the driver. */
if (pExaScr->info->ModifyPixmapHeader && pExaPixmap->driverPriv) {
- ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
- if (ret == TRUE)
- goto out;
+ ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
+ bitsPerPixel, devKind,
+ pPixData);
+ if (ret == TRUE)
+ goto out;
}
swap(pExaScr, pScreen, ModifyPixmapHeader);
ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
+ bitsPerPixel, devKind, pPixData);
swap(pExaScr, pScreen, ModifyPixmapHeader);
-out:
+ out:
if (has_gpu_copy) {
- pExaPixmap->fb_ptr = pPixmap->devPrivate.ptr;
- pExaPixmap->fb_pitch = pPixmap->devKind;
- } else {
- pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
- pExaPixmap->sys_pitch = pPixmap->devKind;
+ pExaPixmap->fb_ptr = pPixmap->devPrivate.ptr;
+ pExaPixmap->fb_pitch = pPixmap->devKind;
+ }
+ else {
+ pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
+ pExaPixmap->sys_pitch = pPixmap->devKind;
}
/* Always NULL this, we don't want lingering pointers. */
pPixmap->devPrivate.ptr = NULL;
@@ -241,32 +243,32 @@ out:
Bool
exaDestroyPixmap_mixed(PixmapPtr pPixmap)
{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
ExaScreenPriv(pScreen);
Bool ret;
- if (pPixmap->refcnt == 1)
- {
- ExaPixmapPriv (pPixmap);
+ if (pPixmap->refcnt == 1) {
+ ExaPixmapPriv(pPixmap);
- exaDestroyPixmap(pPixmap);
+ exaDestroyPixmap(pPixmap);
- if (pExaScr->deferred_mixed_pixmap == pPixmap)
- pExaScr->deferred_mixed_pixmap = NULL;
+ if (pExaScr->deferred_mixed_pixmap == pPixmap)
+ pExaScr->deferred_mixed_pixmap = NULL;
- if (pExaPixmap->driverPriv)
- pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
- pExaPixmap->driverPriv = NULL;
+ if (pExaPixmap->driverPriv)
+ pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
+ pExaPixmap->driverPriv = NULL;
- if (pExaPixmap->pDamage) {
- free(pExaPixmap->sys_ptr);
- pExaPixmap->sys_ptr = NULL;
- pExaPixmap->pDamage = NULL;
- }
+ if (pExaPixmap->pDamage) {
+ free(pExaPixmap->sys_ptr);
+ pExaPixmap->sys_ptr = NULL;
+ pExaPixmap->pDamage = NULL;
+ }
}
swap(pExaScr, pScreen, DestroyPixmap);
- ret = pScreen->DestroyPixmap (pPixmap);
+ ret = pScreen->DestroyPixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
return ret;
@@ -276,13 +278,14 @@ Bool
exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
ExaScreenPriv(pScreen);
ExaPixmapPriv(pPixmap);
pointer saved_ptr;
Bool ret;
if (!pExaPixmap->driverPriv)
- return FALSE;
+ return FALSE;
saved_ptr = pPixmap->devPrivate.ptr;
pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
diff --git a/xorg-server/exa/exa_offscreen.c b/xorg-server/exa/exa_offscreen.c
index 506da616d..5e1d1398e 100644
--- a/xorg-server/exa/exa_offscreen.c
+++ b/xorg-server/exa/exa_offscreen.c
@@ -1,696 +1,678 @@
-/*
- * Copyright © 2003 Anders Carlsson
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/** @file
- * This allocator allocates blocks of memory by maintaining a list of areas.
- * When allocating, the contiguous block of areas with the minimum eviction
- * cost is found and evicted in order to make room for the new allocation.
- */
-
-#include "exa_priv.h"
-
-#include <limits.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#if DEBUG_OFFSCREEN
-#define DBG_OFFSCREEN(a) ErrorF a
-#else
-#define DBG_OFFSCREEN(a)
-#endif
-
-#if DEBUG_OFFSCREEN
-static void
-ExaOffscreenValidate (ScreenPtr pScreen)
-{
- ExaScreenPriv (pScreen);
- ExaOffscreenArea *prev = 0, *area;
-
- assert (pExaScr->info->offScreenAreas->base_offset ==
- pExaScr->info->offScreenBase);
- for (area = pExaScr->info->offScreenAreas; area; area = area->next)
- {
- assert (area->offset >= area->base_offset &&
- area->offset < (area->base_offset + area->size));
- if (prev)
- assert (prev->base_offset + prev->size == area->base_offset);
- prev = area;
- }
- assert (prev->base_offset + prev->size == pExaScr->info->memorySize);
-}
-#else
-#define ExaOffscreenValidate(s)
-#endif
-
-static ExaOffscreenArea *
-ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area)
-{
- if (area->save)
- (*area->save) (pScreen, area);
- return exaOffscreenFree (pScreen, area);
-}
-
-static void
-exaUpdateEvictionCost(ExaOffscreenArea *area, unsigned offScreenCounter)
-{
- unsigned age;
-
- if (area->state == ExaOffscreenAvail)
- return;
-
- age = offScreenCounter - area->last_use;
-
- /* This is unlikely to happen, but could result in a division by zero... */
- if (age > (UINT_MAX / 2)) {
- age = UINT_MAX / 2;
- area->last_use = offScreenCounter - age;
- }
-
- area->eviction_cost = area->size / age;
-}
-
-static ExaOffscreenArea *
-exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
-{
- ExaOffscreenArea *begin, *end, *best;
- unsigned cost, best_cost;
- int avail, real_size;
-
- best_cost = UINT_MAX;
- begin = end = pExaScr->info->offScreenAreas;
- avail = 0;
- cost = 0;
- best = 0;
-
- while (end != NULL)
- {
- restart:
- while (begin != NULL && begin->state == ExaOffscreenLocked)
- begin = end = begin->next;
-
- if (begin == NULL)
- break;
-
- /* adjust size needed to account for alignment loss for this area */
- real_size = size + (begin->base_offset + begin->size - size) % align;
-
- while (avail < real_size && end != NULL)
- {
- if (end->state == ExaOffscreenLocked) {
- /* Can't more room here, restart after this locked area */
- avail = 0;
- cost = 0;
- begin = end;
- goto restart;
- }
- avail += end->size;
- exaUpdateEvictionCost(end, pExaScr->offScreenCounter);
- cost += end->eviction_cost;
- end = end->next;
- }
-
- /* Check the cost, update best */
- if (avail >= real_size && cost < best_cost) {
- best = begin;
- best_cost = cost;
- }
-
- avail -= begin->size;
- cost -= begin->eviction_cost;
- begin = begin->next;
- }
-
- return best;
-}
-
-/**
- * exaOffscreenAlloc allocates offscreen memory
- *
- * @param pScreen current screen
- * @param size size in bytes of the allocation
- * @param align byte alignment requirement for the offset of the allocated area
- * @param locked whether the allocated area is locked and can't be kicked out
- * @param save callback for when the area is evicted from memory
- * @param privdata private data for the save callback.
- *
- * Allocates offscreen memory from the device associated with pScreen. size
- * and align deteremine where and how large the allocated area is, and locked
- * will mark whether it should be held in card memory. privdata may be any
- * pointer for the save callback when the area is removed.
- *
- * Note that locked areas do get evicted on VT switch unless the driver
- * requested version 2.1 or newer behavior. In that case, the save callback is
- * still called.
- */
-ExaOffscreenArea *
-exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
- Bool locked,
- ExaOffscreenSaveProc save,
- pointer privData)
-{
- ExaOffscreenArea *area;
- ExaScreenPriv (pScreen);
- int real_size = 0, largest_avail = 0;
-#if DEBUG_OFFSCREEN
- static int number = 0;
- ErrorF("================= ============ allocating a new pixmap %d\n", ++number);
-#endif
-
- ExaOffscreenValidate (pScreen);
- if (!align)
- align = 1;
-
- if (!size)
- {
- DBG_OFFSCREEN (("Alloc 0x%x -> EMPTY\n", size));
- return NULL;
- }
-
- /* throw out requests that cannot fit */
- if (size > (pExaScr->info->memorySize - pExaScr->info->offScreenBase))
- {
- DBG_OFFSCREEN (("Alloc 0x%x vs (0x%lx) -> TOBIG\n", size,
- pExaScr->info->memorySize -
- pExaScr->info->offScreenBase));
- return NULL;
- }
-
- /* Try to find a free space that'll fit. */
- for (area = pExaScr->info->offScreenAreas; area; area = area->next)
- {
- /* skip allocated areas */
- if (area->state != ExaOffscreenAvail)
- continue;
-
- /* adjust size to match alignment requirement */
- real_size = size + (area->base_offset + area->size - size) % align;
-
- /* does it fit? */
- if (real_size <= area->size)
- break;
-
- if (area->size > largest_avail)
- largest_avail = area->size;
- }
-
- if (!area)
- {
- area = exaFindAreaToEvict(pExaScr, size, align);
-
- if (!area)
- {
- DBG_OFFSCREEN (("Alloc 0x%x -> NOSPACE\n", size));
- /* Could not allocate memory */
- ExaOffscreenValidate (pScreen);
- return NULL;
- }
-
- /* adjust size needed to account for alignment loss for this area */
- real_size = size + (area->base_offset + area->size - size) % align;
-
- /*
- * Kick out first area if in use
- */
- if (area->state != ExaOffscreenAvail)
- area = ExaOffscreenKickOut (pScreen, area);
- /*
- * Now get the system to merge the other needed areas together
- */
- while (area->size < real_size)
- {
- assert (area->next && area->next->state == ExaOffscreenRemovable);
- (void) ExaOffscreenKickOut (pScreen, area->next);
- }
- }
-
- /* save extra space in new area */
- if (real_size < area->size)
- {
- ExaOffscreenArea *new_area = malloc(sizeof (ExaOffscreenArea));
- if (!new_area)
- return NULL;
- new_area->base_offset = area->base_offset;
-
- new_area->offset = new_area->base_offset;
- new_area->align = 0;
- new_area->size = area->size - real_size;
- new_area->state = ExaOffscreenAvail;
- new_area->save = NULL;
- new_area->last_use = 0;
- new_area->eviction_cost = 0;
- new_area->next = area;
- new_area->prev = area->prev;
- if (area->prev->next)
- area->prev->next = new_area;
- else
- pExaScr->info->offScreenAreas = new_area;
- area->prev = new_area;
- area->base_offset = new_area->base_offset + new_area->size;
- area->size = real_size;
- } else
- pExaScr->numOffscreenAvailable--;
-
- /*
- * Mark this area as in use
- */
- if (locked)
- area->state = ExaOffscreenLocked;
- else
- area->state = ExaOffscreenRemovable;
- area->privData = privData;
- area->save = save;
- area->last_use = pExaScr->offScreenCounter++;
- area->offset = (area->base_offset + align - 1);
- area->offset -= area->offset % align;
- area->align = align;
-
- ExaOffscreenValidate (pScreen);
-
- DBG_OFFSCREEN (("Alloc 0x%x -> 0x%x (0x%x)\n", size,
- area->base_offset, area->offset));
- return area;
-}
-
-/**
- * Ejects all offscreen areas, and uninitializes the offscreen memory manager.
- */
-void
-ExaOffscreenSwapOut (ScreenPtr pScreen)
-{
- ExaScreenPriv (pScreen);
-
- ExaOffscreenValidate (pScreen);
- /* loop until a single free area spans the space */
- for (;;)
- {
- ExaOffscreenArea *area = pExaScr->info->offScreenAreas;
-
- if (!area)
- break;
- if (area->state == ExaOffscreenAvail)
- {
- area = area->next;
- if (!area)
- break;
- }
- assert (area->state != ExaOffscreenAvail);
- (void) ExaOffscreenKickOut (pScreen, area);
- ExaOffscreenValidate (pScreen);
- }
- ExaOffscreenValidate (pScreen);
- ExaOffscreenFini (pScreen);
-}
-
-/** Ejects all pixmaps managed by EXA. */
-static void
-ExaOffscreenEjectPixmaps (ScreenPtr pScreen)
-{
- ExaScreenPriv (pScreen);
-
- ExaOffscreenValidate (pScreen);
- /* loop until a single free area spans the space */
- for (;;)
- {
- ExaOffscreenArea *area;
-
- for (area = pExaScr->info->offScreenAreas; area != NULL;
- area = area->next)
- {
- if (area->state == ExaOffscreenRemovable &&
- area->save == exaPixmapSave)
- {
- (void) ExaOffscreenKickOut (pScreen, area);
- ExaOffscreenValidate (pScreen);
- break;
- }
- }
- if (area == NULL)
- break;
- }
- ExaOffscreenValidate (pScreen);
-}
-
-void
-ExaOffscreenSwapIn (ScreenPtr pScreen)
-{
- exaOffscreenInit (pScreen);
-}
-
-/**
- * Prepares EXA for disabling of FB access, or restoring it.
- *
- * In version 2.1, the disabling results in pixmaps being ejected, while other
- * allocations remain. With this plus the prevention of migration while
- * swappedOut is set, EXA by itself should not cause any access of the
- * framebuffer to occur while swapped out. Any remaining issues are the
- * responsibility of the driver.
- *
- * Prior to version 2.1, all allocations, including locked ones, are ejected
- * when access is disabled, and the allocator is torn down while swappedOut
- * is set. This is more drastic, and caused implementation difficulties for
- * many drivers that could otherwise handle the lack of FB access while
- * swapped out.
- */
-void
-exaEnableDisableFBAccess (int index, Bool enable)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- ExaScreenPriv (pScreen);
-
- if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS)
- return;
-
- if (!enable && pExaScr->disableFbCount++ == 0) {
- if (pExaScr->info->exa_minor < 1)
- ExaOffscreenSwapOut (pScreen);
- else
- ExaOffscreenEjectPixmaps (pScreen);
- pExaScr->swappedOut = TRUE;
- }
-
- if (enable && --pExaScr->disableFbCount == 0) {
- if (pExaScr->info->exa_minor < 1)
- ExaOffscreenSwapIn (pScreen);
- pExaScr->swappedOut = FALSE;
- }
-}
-
-/* merge the next free area into this one */
-static void
-ExaOffscreenMerge (ExaScreenPrivPtr pExaScr, ExaOffscreenArea *area)
-{
- ExaOffscreenArea *next = area->next;
-
- /* account for space */
- area->size += next->size;
- /* frob pointer */
- area->next = next->next;
- if (area->next)
- area->next->prev = area;
- else
- pExaScr->info->offScreenAreas->prev = area;
- free(next);
-
- pExaScr->numOffscreenAvailable--;
-}
-
-/**
- * exaOffscreenFree frees an allocation.
- *
- * @param pScreen current screen
- * @param area offscreen area to free
- *
- * exaOffscreenFree frees an allocation created by exaOffscreenAlloc. Note that
- * the save callback of the area is not called, and it is up to the driver to
- * do any cleanup necessary as a result.
- *
- * @return pointer to the newly freed area. This behavior should not be relied
- * on.
- */
-ExaOffscreenArea *
-exaOffscreenFree (ScreenPtr pScreen, ExaOffscreenArea *area)
-{
- ExaScreenPriv(pScreen);
- ExaOffscreenArea *next = area->next;
- ExaOffscreenArea *prev;
-
- DBG_OFFSCREEN (("Free 0x%x -> 0x%x (0x%x)\n", area->size,
- area->base_offset, area->offset));
- ExaOffscreenValidate (pScreen);
-
- area->state = ExaOffscreenAvail;
- area->save = NULL;
- area->last_use = 0;
- area->eviction_cost = 0;
- /*
- * Find previous area
- */
- if (area == pExaScr->info->offScreenAreas)
- prev = NULL;
- else
- prev = area->prev;
-
- pExaScr->numOffscreenAvailable++;
-
- /* link with next area if free */
- if (next && next->state == ExaOffscreenAvail)
- ExaOffscreenMerge (pExaScr, area);
-
- /* link with prev area if free */
- if (prev && prev->state == ExaOffscreenAvail)
- {
- area = prev;
- ExaOffscreenMerge (pExaScr, area);
- }
-
- ExaOffscreenValidate (pScreen);
- DBG_OFFSCREEN(("\tdone freeing\n"));
- return area;
-}
-
-void
-ExaOffscreenMarkUsed (PixmapPtr pPixmap)
-{
- ExaPixmapPriv (pPixmap);
- ExaScreenPriv (pPixmap->drawable.pScreen);
-
- if (!pExaPixmap || !pExaPixmap->area)
- return;
-
- pExaPixmap->area->last_use = pExaScr->offScreenCounter++;
-}
-
-/**
- * Defragment offscreen memory by compacting allocated areas at the end of it,
- * leaving the total amount of memory available as a single area at the
- * beginning (when there are no pinned allocations).
- */
-_X_HIDDEN ExaOffscreenArea*
-ExaOffscreenDefragment (ScreenPtr pScreen)
-{
- ExaScreenPriv (pScreen);
- ExaOffscreenArea *area, *largest_available = NULL;
- int largest_size = 0;
- PixmapPtr pDstPix;
- ExaPixmapPrivPtr pExaDstPix;
-
- pDstPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, 0, 0);
-
- if (!pDstPix)
- return NULL;
-
- pExaDstPix = ExaGetPixmapPriv (pDstPix);
- pExaDstPix->use_gpu_copy = TRUE;
-
- for (area = pExaScr->info->offScreenAreas->prev;
- area != pExaScr->info->offScreenAreas;
- )
- {
- ExaOffscreenArea *prev = area->prev;
- PixmapPtr pSrcPix;
- ExaPixmapPrivPtr pExaSrcPix;
- Bool save_use_gpu_copy;
- int save_pitch;
-
- if (area->state != ExaOffscreenAvail ||
- prev->state == ExaOffscreenLocked ||
- (prev->state == ExaOffscreenRemovable &&
- prev->save != exaPixmapSave)) {
- area = prev;
- continue;
- }
-
- if (prev->state == ExaOffscreenAvail) {
- if (area == largest_available) {
- largest_available = prev;
- largest_size += prev->size;
- }
- area = prev;
- ExaOffscreenMerge (pExaScr, area);
- continue;
- }
-
- if (area->size > largest_size) {
- largest_available = area;
- largest_size = area->size;
- }
-
- pSrcPix = prev->privData;
- pExaSrcPix = ExaGetPixmapPriv (pSrcPix);
-
- pExaDstPix->fb_ptr = pExaScr->info->memoryBase +
- area->base_offset + area->size - prev->size + prev->base_offset -
- prev->offset;
- pExaDstPix->fb_ptr -= (unsigned long)pExaDstPix->fb_ptr % prev->align;
-
- if (pExaDstPix->fb_ptr <= pExaSrcPix->fb_ptr) {
- area = prev;
- continue;
- }
-
- if (!(pExaScr->info->flags & EXA_SUPPORTS_OFFSCREEN_OVERLAPS) &&
- (pExaSrcPix->fb_ptr + prev->size) > pExaDstPix->fb_ptr) {
- area = prev;
- continue;
- }
-
- save_use_gpu_copy = pExaSrcPix->use_gpu_copy;
- save_pitch = pSrcPix->devKind;
-
- pExaSrcPix->use_gpu_copy = TRUE;
- pSrcPix->devKind = pExaSrcPix->fb_pitch;
-
- pDstPix->drawable.width = pSrcPix->drawable.width;
- pDstPix->devKind = pSrcPix->devKind;
- pDstPix->drawable.height = pSrcPix->drawable.height;
- pDstPix->drawable.depth = pSrcPix->drawable.depth;
- pDstPix->drawable.bitsPerPixel = pSrcPix->drawable.bitsPerPixel;
-
- if (!pExaScr->info->PrepareCopy (pSrcPix, pDstPix, -1, -1, GXcopy, ~0)) {
- pExaSrcPix->use_gpu_copy = save_use_gpu_copy;
- pSrcPix->devKind = save_pitch;
- area = prev;
- continue;
- }
-
- pExaScr->info->Copy (pDstPix, 0, 0, 0, 0, pDstPix->drawable.width,
- pDstPix->drawable.height);
- pExaScr->info->DoneCopy (pDstPix);
- exaMarkSync (pScreen);
-
- DBG_OFFSCREEN(("Before swap: prev=0x%08x-0x%08x-0x%08x area=0x%08x-0x%08x-0x%08x\n",
- prev->base_offset, prev->offset, prev->base_offset + prev->size,
- area->base_offset, area->offset, area->base_offset + area->size));
-
- /* Calculate swapped area offsets and sizes */
- area->base_offset = prev->base_offset;
- area->offset = area->base_offset;
- prev->offset += pExaDstPix->fb_ptr - pExaSrcPix->fb_ptr;
- assert(prev->offset >= pExaScr->info->offScreenBase &&
- prev->offset < pExaScr->info->memorySize);
- prev->base_offset = prev->offset;
- if (area->next)
- prev->size = area->next->base_offset - prev->base_offset;
- else
- prev->size = pExaScr->info->memorySize - prev->base_offset;
- area->size = prev->base_offset - area->base_offset;
-
- DBG_OFFSCREEN(("After swap: area=0x%08x-0x%08x-0x%08x prev=0x%08x-0x%08x-0x%08x\n",
- area->base_offset, area->offset, area->base_offset + area->size,
- prev->base_offset, prev->offset, prev->base_offset + prev->size));
-
- /* Swap areas in list */
- if (area->next)
- area->next->prev = prev;
- else
- pExaScr->info->offScreenAreas->prev = prev;
- if (prev->prev->next)
- prev->prev->next = area;
- else
- pExaScr->info->offScreenAreas = area;
- prev->next = area->next;
- area->next = prev;
- area->prev = prev->prev;
- prev->prev = area;
- if (!area->prev->next)
- pExaScr->info->offScreenAreas = area;
-
-#if DEBUG_OFFSCREEN
- if (prev->prev == prev || prev->next == prev)
- ErrorF("Whoops, prev points to itself!\n");
-
- if (area->prev == area || area->next == area)
- ErrorF("Whoops, area points to itself!\n");
-#endif
-
- pExaSrcPix->fb_ptr = pExaDstPix->fb_ptr;
- pExaSrcPix->use_gpu_copy = save_use_gpu_copy;
- pSrcPix->devKind = save_pitch;
- }
-
- pDstPix->drawable.width = 0;
- pDstPix->drawable.height = 0;
- pDstPix->drawable.depth = 0;
- pDstPix->drawable.bitsPerPixel = 0;
-
- (*pScreen->DestroyPixmap) (pDstPix);
-
- if (area->state == ExaOffscreenAvail && area->size > largest_size)
- return area;
-
- return largest_available;
-}
-
-/**
- * exaOffscreenInit initializes the offscreen memory manager.
- *
- * @param pScreen current screen
- *
- * exaOffscreenInit is called by exaDriverInit to set up the memory manager for
- * the screen, if any offscreen memory is available.
- */
-Bool
-exaOffscreenInit (ScreenPtr pScreen)
-{
- ExaScreenPriv (pScreen);
- ExaOffscreenArea *area;
-
- /* Allocate a big free area */
- area = malloc(sizeof (ExaOffscreenArea));
-
- if (!area)
- return FALSE;
-
- area->state = ExaOffscreenAvail;
- area->base_offset = pExaScr->info->offScreenBase;
- area->offset = area->base_offset;
- area->align = 0;
- area->size = pExaScr->info->memorySize - area->base_offset;
- area->save = NULL;
- area->next = NULL;
- area->prev = area;
- area->last_use = 0;
- area->eviction_cost = 0;
-
- /* Add it to the free areas */
- pExaScr->info->offScreenAreas = area;
- pExaScr->offScreenCounter = 1;
- pExaScr->numOffscreenAvailable = 1;
-
- ExaOffscreenValidate (pScreen);
-
- return TRUE;
-}
-
-void
-ExaOffscreenFini (ScreenPtr pScreen)
-{
- ExaScreenPriv (pScreen);
- ExaOffscreenArea *area;
-
- /* just free all of the area records */
- while ((area = pExaScr->info->offScreenAreas))
- {
- pExaScr->info->offScreenAreas = area->next;
- free(area);
- }
-}
+/*
+ * Copyright © 2003 Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/** @file
+ * This allocator allocates blocks of memory by maintaining a list of areas.
+ * When allocating, the contiguous block of areas with the minimum eviction
+ * cost is found and evicted in order to make room for the new allocation.
+ */
+
+#include "exa_priv.h"
+
+#include <limits.h>
+#include <assert.h>
+#include <stdlib.h>
+
+#if DEBUG_OFFSCREEN
+#define DBG_OFFSCREEN(a) ErrorF a
+#else
+#define DBG_OFFSCREEN(a)
+#endif
+
+#if DEBUG_OFFSCREEN
+static void
+ExaOffscreenValidate(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+ ExaOffscreenArea *prev = 0, *area;
+
+ assert(pExaScr->info->offScreenAreas->base_offset ==
+ pExaScr->info->offScreenBase);
+ for (area = pExaScr->info->offScreenAreas; area; area = area->next) {
+ assert(area->offset >= area->base_offset &&
+ area->offset < (area->base_offset + area->size));
+ if (prev)
+ assert(prev->base_offset + prev->size == area->base_offset);
+ prev = area;
+ }
+ assert(prev->base_offset + prev->size == pExaScr->info->memorySize);
+}
+#else
+#define ExaOffscreenValidate(s)
+#endif
+
+static ExaOffscreenArea *
+ExaOffscreenKickOut(ScreenPtr pScreen, ExaOffscreenArea * area)
+{
+ if (area->save)
+ (*area->save) (pScreen, area);
+ return exaOffscreenFree(pScreen, area);
+}
+
+static void
+exaUpdateEvictionCost(ExaOffscreenArea * area, unsigned offScreenCounter)
+{
+ unsigned age;
+
+ if (area->state == ExaOffscreenAvail)
+ return;
+
+ age = offScreenCounter - area->last_use;
+
+ /* This is unlikely to happen, but could result in a division by zero... */
+ if (age > (UINT_MAX / 2)) {
+ age = UINT_MAX / 2;
+ area->last_use = offScreenCounter - age;
+ }
+
+ area->eviction_cost = area->size / age;
+}
+
+static ExaOffscreenArea *
+exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
+{
+ ExaOffscreenArea *begin, *end, *best;
+ unsigned cost, best_cost;
+ int avail, real_size;
+
+ best_cost = UINT_MAX;
+ begin = end = pExaScr->info->offScreenAreas;
+ avail = 0;
+ cost = 0;
+ best = 0;
+
+ while (end != NULL) {
+ restart:
+ while (begin != NULL && begin->state == ExaOffscreenLocked)
+ begin = end = begin->next;
+
+ if (begin == NULL)
+ break;
+
+ /* adjust size needed to account for alignment loss for this area */
+ real_size = size + (begin->base_offset + begin->size - size) % align;
+
+ while (avail < real_size && end != NULL) {
+ if (end->state == ExaOffscreenLocked) {
+ /* Can't more room here, restart after this locked area */
+ avail = 0;
+ cost = 0;
+ begin = end;
+ goto restart;
+ }
+ avail += end->size;
+ exaUpdateEvictionCost(end, pExaScr->offScreenCounter);
+ cost += end->eviction_cost;
+ end = end->next;
+ }
+
+ /* Check the cost, update best */
+ if (avail >= real_size && cost < best_cost) {
+ best = begin;
+ best_cost = cost;
+ }
+
+ avail -= begin->size;
+ cost -= begin->eviction_cost;
+ begin = begin->next;
+ }
+
+ return best;
+}
+
+/**
+ * exaOffscreenAlloc allocates offscreen memory
+ *
+ * @param pScreen current screen
+ * @param size size in bytes of the allocation
+ * @param align byte alignment requirement for the offset of the allocated area
+ * @param locked whether the allocated area is locked and can't be kicked out
+ * @param save callback for when the area is evicted from memory
+ * @param privdata private data for the save callback.
+ *
+ * Allocates offscreen memory from the device associated with pScreen. size
+ * and align deteremine where and how large the allocated area is, and locked
+ * will mark whether it should be held in card memory. privdata may be any
+ * pointer for the save callback when the area is removed.
+ *
+ * Note that locked areas do get evicted on VT switch unless the driver
+ * requested version 2.1 or newer behavior. In that case, the save callback is
+ * still called.
+ */
+ExaOffscreenArea *
+exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
+ Bool locked, ExaOffscreenSaveProc save, pointer privData)
+{
+ ExaOffscreenArea *area;
+
+ ExaScreenPriv(pScreen);
+ int real_size = 0, largest_avail = 0;
+
+#if DEBUG_OFFSCREEN
+ static int number = 0;
+
+ ErrorF("================= ============ allocating a new pixmap %d\n",
+ ++number);
+#endif
+
+ ExaOffscreenValidate(pScreen);
+ if (!align)
+ align = 1;
+
+ if (!size) {
+ DBG_OFFSCREEN(("Alloc 0x%x -> EMPTY\n", size));
+ return NULL;
+ }
+
+ /* throw out requests that cannot fit */
+ if (size > (pExaScr->info->memorySize - pExaScr->info->offScreenBase)) {
+ DBG_OFFSCREEN(("Alloc 0x%x vs (0x%lx) -> TOBIG\n", size,
+ pExaScr->info->memorySize -
+ pExaScr->info->offScreenBase));
+ return NULL;
+ }
+
+ /* Try to find a free space that'll fit. */
+ for (area = pExaScr->info->offScreenAreas; area; area = area->next) {
+ /* skip allocated areas */
+ if (area->state != ExaOffscreenAvail)
+ continue;
+
+ /* adjust size to match alignment requirement */
+ real_size = size + (area->base_offset + area->size - size) % align;
+
+ /* does it fit? */
+ if (real_size <= area->size)
+ break;
+
+ if (area->size > largest_avail)
+ largest_avail = area->size;
+ }
+
+ if (!area) {
+ area = exaFindAreaToEvict(pExaScr, size, align);
+
+ if (!area) {
+ DBG_OFFSCREEN(("Alloc 0x%x -> NOSPACE\n", size));
+ /* Could not allocate memory */
+ ExaOffscreenValidate(pScreen);
+ return NULL;
+ }
+
+ /* adjust size needed to account for alignment loss for this area */
+ real_size = size + (area->base_offset + area->size - size) % align;
+
+ /*
+ * Kick out first area if in use
+ */
+ if (area->state != ExaOffscreenAvail)
+ area = ExaOffscreenKickOut(pScreen, area);
+ /*
+ * Now get the system to merge the other needed areas together
+ */
+ while (area->size < real_size) {
+ assert(area->next && area->next->state == ExaOffscreenRemovable);
+ (void) ExaOffscreenKickOut(pScreen, area->next);
+ }
+ }
+
+ /* save extra space in new area */
+ if (real_size < area->size) {
+ ExaOffscreenArea *new_area = malloc(sizeof(ExaOffscreenArea));
+
+ if (!new_area)
+ return NULL;
+ new_area->base_offset = area->base_offset;
+
+ new_area->offset = new_area->base_offset;
+ new_area->align = 0;
+ new_area->size = area->size - real_size;
+ new_area->state = ExaOffscreenAvail;
+ new_area->save = NULL;
+ new_area->last_use = 0;
+ new_area->eviction_cost = 0;
+ new_area->next = area;
+ new_area->prev = area->prev;
+ if (area->prev->next)
+ area->prev->next = new_area;
+ else
+ pExaScr->info->offScreenAreas = new_area;
+ area->prev = new_area;
+ area->base_offset = new_area->base_offset + new_area->size;
+ area->size = real_size;
+ }
+ else
+ pExaScr->numOffscreenAvailable--;
+
+ /*
+ * Mark this area as in use
+ */
+ if (locked)
+ area->state = ExaOffscreenLocked;
+ else
+ area->state = ExaOffscreenRemovable;
+ area->privData = privData;
+ area->save = save;
+ area->last_use = pExaScr->offScreenCounter++;
+ area->offset = (area->base_offset + align - 1);
+ area->offset -= area->offset % align;
+ area->align = align;
+
+ ExaOffscreenValidate(pScreen);
+
+ DBG_OFFSCREEN(("Alloc 0x%x -> 0x%x (0x%x)\n", size,
+ area->base_offset, area->offset));
+ return area;
+}
+
+/**
+ * Ejects all offscreen areas, and uninitializes the offscreen memory manager.
+ */
+void
+ExaOffscreenSwapOut(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+
+ ExaOffscreenValidate(pScreen);
+ /* loop until a single free area spans the space */
+ for (;;) {
+ ExaOffscreenArea *area = pExaScr->info->offScreenAreas;
+
+ if (!area)
+ break;
+ if (area->state == ExaOffscreenAvail) {
+ area = area->next;
+ if (!area)
+ break;
+ }
+ assert(area->state != ExaOffscreenAvail);
+ (void) ExaOffscreenKickOut(pScreen, area);
+ ExaOffscreenValidate(pScreen);
+ }
+ ExaOffscreenValidate(pScreen);
+ ExaOffscreenFini(pScreen);
+}
+
+/** Ejects all pixmaps managed by EXA. */
+static void
+ExaOffscreenEjectPixmaps(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+
+ ExaOffscreenValidate(pScreen);
+ /* loop until a single free area spans the space */
+ for (;;) {
+ ExaOffscreenArea *area;
+
+ for (area = pExaScr->info->offScreenAreas; area != NULL;
+ area = area->next) {
+ if (area->state == ExaOffscreenRemovable &&
+ area->save == exaPixmapSave) {
+ (void) ExaOffscreenKickOut(pScreen, area);
+ ExaOffscreenValidate(pScreen);
+ break;
+ }
+ }
+ if (area == NULL)
+ break;
+ }
+ ExaOffscreenValidate(pScreen);
+}
+
+void
+ExaOffscreenSwapIn(ScreenPtr pScreen)
+{
+ exaOffscreenInit(pScreen);
+}
+
+/**
+ * Prepares EXA for disabling of FB access, or restoring it.
+ *
+ * In version 2.1, the disabling results in pixmaps being ejected, while other
+ * allocations remain. With this plus the prevention of migration while
+ * swappedOut is set, EXA by itself should not cause any access of the
+ * framebuffer to occur while swapped out. Any remaining issues are the
+ * responsibility of the driver.
+ *
+ * Prior to version 2.1, all allocations, including locked ones, are ejected
+ * when access is disabled, and the allocator is torn down while swappedOut
+ * is set. This is more drastic, and caused implementation difficulties for
+ * many drivers that could otherwise handle the lack of FB access while
+ * swapped out.
+ */
+void
+exaEnableDisableFBAccess(int index, Bool enable)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+
+ ExaScreenPriv(pScreen);
+
+ if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS)
+ return;
+
+ if (!enable && pExaScr->disableFbCount++ == 0) {
+ if (pExaScr->info->exa_minor < 1)
+ ExaOffscreenSwapOut(pScreen);
+ else
+ ExaOffscreenEjectPixmaps(pScreen);
+ pExaScr->swappedOut = TRUE;
+ }
+
+ if (enable && --pExaScr->disableFbCount == 0) {
+ if (pExaScr->info->exa_minor < 1)
+ ExaOffscreenSwapIn(pScreen);
+ pExaScr->swappedOut = FALSE;
+ }
+}
+
+/* merge the next free area into this one */
+static void
+ExaOffscreenMerge(ExaScreenPrivPtr pExaScr, ExaOffscreenArea * area)
+{
+ ExaOffscreenArea *next = area->next;
+
+ /* account for space */
+ area->size += next->size;
+ /* frob pointer */
+ area->next = next->next;
+ if (area->next)
+ area->next->prev = area;
+ else
+ pExaScr->info->offScreenAreas->prev = area;
+ free(next);
+
+ pExaScr->numOffscreenAvailable--;
+}
+
+/**
+ * exaOffscreenFree frees an allocation.
+ *
+ * @param pScreen current screen
+ * @param area offscreen area to free
+ *
+ * exaOffscreenFree frees an allocation created by exaOffscreenAlloc. Note that
+ * the save callback of the area is not called, and it is up to the driver to
+ * do any cleanup necessary as a result.
+ *
+ * @return pointer to the newly freed area. This behavior should not be relied
+ * on.
+ */
+ExaOffscreenArea *
+exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea * area)
+{
+ ExaScreenPriv(pScreen);
+ ExaOffscreenArea *next = area->next;
+ ExaOffscreenArea *prev;
+
+ DBG_OFFSCREEN(("Free 0x%x -> 0x%x (0x%x)\n", area->size,
+ area->base_offset, area->offset));
+ ExaOffscreenValidate(pScreen);
+
+ area->state = ExaOffscreenAvail;
+ area->save = NULL;
+ area->last_use = 0;
+ area->eviction_cost = 0;
+ /*
+ * Find previous area
+ */
+ if (area == pExaScr->info->offScreenAreas)
+ prev = NULL;
+ else
+ prev = area->prev;
+
+ pExaScr->numOffscreenAvailable++;
+
+ /* link with next area if free */
+ if (next && next->state == ExaOffscreenAvail)
+ ExaOffscreenMerge(pExaScr, area);
+
+ /* link with prev area if free */
+ if (prev && prev->state == ExaOffscreenAvail) {
+ area = prev;
+ ExaOffscreenMerge(pExaScr, area);
+ }
+
+ ExaOffscreenValidate(pScreen);
+ DBG_OFFSCREEN(("\tdone freeing\n"));
+ return area;
+}
+
+void
+ExaOffscreenMarkUsed(PixmapPtr pPixmap)
+{
+ ExaPixmapPriv(pPixmap);
+ ExaScreenPriv(pPixmap->drawable.pScreen);
+
+ if (!pExaPixmap || !pExaPixmap->area)
+ return;
+
+ pExaPixmap->area->last_use = pExaScr->offScreenCounter++;
+}
+
+/**
+ * Defragment offscreen memory by compacting allocated areas at the end of it,
+ * leaving the total amount of memory available as a single area at the
+ * beginning (when there are no pinned allocations).
+ */
+_X_HIDDEN ExaOffscreenArea *
+ExaOffscreenDefragment(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+ ExaOffscreenArea *area, *largest_available = NULL;
+ int largest_size = 0;
+ PixmapPtr pDstPix;
+ ExaPixmapPrivPtr pExaDstPix;
+
+ pDstPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, 0, 0);
+
+ if (!pDstPix)
+ return NULL;
+
+ pExaDstPix = ExaGetPixmapPriv(pDstPix);
+ pExaDstPix->use_gpu_copy = TRUE;
+
+ for (area = pExaScr->info->offScreenAreas->prev;
+ area != pExaScr->info->offScreenAreas;) {
+ ExaOffscreenArea *prev = area->prev;
+ PixmapPtr pSrcPix;
+ ExaPixmapPrivPtr pExaSrcPix;
+ Bool save_use_gpu_copy;
+ int save_pitch;
+
+ if (area->state != ExaOffscreenAvail ||
+ prev->state == ExaOffscreenLocked ||
+ (prev->state == ExaOffscreenRemovable &&
+ prev->save != exaPixmapSave)) {
+ area = prev;
+ continue;
+ }
+
+ if (prev->state == ExaOffscreenAvail) {
+ if (area == largest_available) {
+ largest_available = prev;
+ largest_size += prev->size;
+ }
+ area = prev;
+ ExaOffscreenMerge(pExaScr, area);
+ continue;
+ }
+
+ if (area->size > largest_size) {
+ largest_available = area;
+ largest_size = area->size;
+ }
+
+ pSrcPix = prev->privData;
+ pExaSrcPix = ExaGetPixmapPriv(pSrcPix);
+
+ pExaDstPix->fb_ptr = pExaScr->info->memoryBase +
+ area->base_offset + area->size - prev->size + prev->base_offset -
+ prev->offset;
+ pExaDstPix->fb_ptr -= (unsigned long) pExaDstPix->fb_ptr % prev->align;
+
+ if (pExaDstPix->fb_ptr <= pExaSrcPix->fb_ptr) {
+ area = prev;
+ continue;
+ }
+
+ if (!(pExaScr->info->flags & EXA_SUPPORTS_OFFSCREEN_OVERLAPS) &&
+ (pExaSrcPix->fb_ptr + prev->size) > pExaDstPix->fb_ptr) {
+ area = prev;
+ continue;
+ }
+
+ save_use_gpu_copy = pExaSrcPix->use_gpu_copy;
+ save_pitch = pSrcPix->devKind;
+
+ pExaSrcPix->use_gpu_copy = TRUE;
+ pSrcPix->devKind = pExaSrcPix->fb_pitch;
+
+ pDstPix->drawable.width = pSrcPix->drawable.width;
+ pDstPix->devKind = pSrcPix->devKind;
+ pDstPix->drawable.height = pSrcPix->drawable.height;
+ pDstPix->drawable.depth = pSrcPix->drawable.depth;
+ pDstPix->drawable.bitsPerPixel = pSrcPix->drawable.bitsPerPixel;
+
+ if (!pExaScr->info->PrepareCopy(pSrcPix, pDstPix, -1, -1, GXcopy, ~0)) {
+ pExaSrcPix->use_gpu_copy = save_use_gpu_copy;
+ pSrcPix->devKind = save_pitch;
+ area = prev;
+ continue;
+ }
+
+ pExaScr->info->Copy(pDstPix, 0, 0, 0, 0, pDstPix->drawable.width,
+ pDstPix->drawable.height);
+ pExaScr->info->DoneCopy(pDstPix);
+ exaMarkSync(pScreen);
+
+ DBG_OFFSCREEN(("Before swap: prev=0x%08x-0x%08x-0x%08x area=0x%08x-0x%08x-0x%08x\n", prev->base_offset, prev->offset, prev->base_offset + prev->size, area->base_offset, area->offset, area->base_offset + area->size));
+
+ /* Calculate swapped area offsets and sizes */
+ area->base_offset = prev->base_offset;
+ area->offset = area->base_offset;
+ prev->offset += pExaDstPix->fb_ptr - pExaSrcPix->fb_ptr;
+ assert(prev->offset >= pExaScr->info->offScreenBase &&
+ prev->offset < pExaScr->info->memorySize);
+ prev->base_offset = prev->offset;
+ if (area->next)
+ prev->size = area->next->base_offset - prev->base_offset;
+ else
+ prev->size = pExaScr->info->memorySize - prev->base_offset;
+ area->size = prev->base_offset - area->base_offset;
+
+ DBG_OFFSCREEN(("After swap: area=0x%08x-0x%08x-0x%08x prev=0x%08x-0x%08x-0x%08x\n", area->base_offset, area->offset, area->base_offset + area->size, prev->base_offset, prev->offset, prev->base_offset + prev->size));
+
+ /* Swap areas in list */
+ if (area->next)
+ area->next->prev = prev;
+ else
+ pExaScr->info->offScreenAreas->prev = prev;
+ if (prev->prev->next)
+ prev->prev->next = area;
+ else
+ pExaScr->info->offScreenAreas = area;
+ prev->next = area->next;
+ area->next = prev;
+ area->prev = prev->prev;
+ prev->prev = area;
+ if (!area->prev->next)
+ pExaScr->info->offScreenAreas = area;
+
+#if DEBUG_OFFSCREEN
+ if (prev->prev == prev || prev->next == prev)
+ ErrorF("Whoops, prev points to itself!\n");
+
+ if (area->prev == area || area->next == area)
+ ErrorF("Whoops, area points to itself!\n");
+#endif
+
+ pExaSrcPix->fb_ptr = pExaDstPix->fb_ptr;
+ pExaSrcPix->use_gpu_copy = save_use_gpu_copy;
+ pSrcPix->devKind = save_pitch;
+ }
+
+ pDstPix->drawable.width = 0;
+ pDstPix->drawable.height = 0;
+ pDstPix->drawable.depth = 0;
+ pDstPix->drawable.bitsPerPixel = 0;
+
+ (*pScreen->DestroyPixmap) (pDstPix);
+
+ if (area->state == ExaOffscreenAvail && area->size > largest_size)
+ return area;
+
+ return largest_available;
+}
+
+/**
+ * exaOffscreenInit initializes the offscreen memory manager.
+ *
+ * @param pScreen current screen
+ *
+ * exaOffscreenInit is called by exaDriverInit to set up the memory manager for
+ * the screen, if any offscreen memory is available.
+ */
+Bool
+exaOffscreenInit(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+ ExaOffscreenArea *area;
+
+ /* Allocate a big free area */
+ area = malloc(sizeof(ExaOffscreenArea));
+
+ if (!area)
+ return FALSE;
+
+ area->state = ExaOffscreenAvail;
+ area->base_offset = pExaScr->info->offScreenBase;
+ area->offset = area->base_offset;
+ area->align = 0;
+ area->size = pExaScr->info->memorySize - area->base_offset;
+ area->save = NULL;
+ area->next = NULL;
+ area->prev = area;
+ area->last_use = 0;
+ area->eviction_cost = 0;
+
+ /* Add it to the free areas */
+ pExaScr->info->offScreenAreas = area;
+ pExaScr->offScreenCounter = 1;
+ pExaScr->numOffscreenAvailable = 1;
+
+ ExaOffscreenValidate(pScreen);
+
+ return TRUE;
+}
+
+void
+ExaOffscreenFini(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+ ExaOffscreenArea *area;
+
+ /* just free all of the area records */
+ while ((area = pExaScr->info->offScreenAreas)) {
+ pExaScr->info->offScreenAreas = area->next;
+ free(area);
+ }
+}
diff --git a/xorg-server/exa/exa_priv.h b/xorg-server/exa/exa_priv.h
index 70de4bd6f..bde78c3a0 100644
--- a/xorg-server/exa/exa_priv.h
+++ b/xorg-server/exa/exa_priv.h
@@ -68,7 +68,7 @@ do { \
} while (0)
char
-exaDrawableLocation(DrawablePtr pDrawable);
+ exaDrawableLocation(DrawablePtr pDrawable);
#else
#define EXA_FALLBACK(x)
#endif
@@ -115,7 +115,7 @@ typedef struct {
int glyphWidth;
int glyphHeight;
- int size; /* Size of cache; eventually this should be dynamically determined */
+ int size; /* Size of cache; eventually this should be dynamically determined */
/* Hash table mapping from glyph sha1 to position in the glyph; we use
* open addressing with a hash table size determined based on size and large
@@ -125,14 +125,14 @@ typedef struct {
*/
int *hashEntries;
int hashSize;
-
+
ExaCachedGlyphPtr glyphs;
- int glyphCount; /* Current number of glyphs */
-
- PicturePtr picture; /* Where the glyphs of the cache are stored */
- int yOffset; /* y location within the picture where the cache starts */
- int columns; /* Number of columns the glyphs are layed out in */
- int evictionPosition; /* Next random position to evict a glyph */
+ int glyphCount; /* Current number of glyphs */
+
+ PicturePtr picture; /* Where the glyphs of the cache are stored */
+ int yOffset; /* y location within the picture where the cache starts */
+ int columns; /* Number of columns the glyphs are layed out in */
+ int evictionPosition; /* Next random position to evict a glyph */
} ExaGlyphCacheRec, *ExaGlyphCachePtr;
#define EXA_NUM_GLYPH_CACHES 4
@@ -147,57 +147,58 @@ typedef struct _ExaMigrationRec {
RegionPtr pReg;
} ExaMigrationRec, *ExaMigrationPtr;
-typedef void (*EnableDisableFBAccessProcPtr)(int, Bool);
+typedef void (*EnableDisableFBAccessProcPtr) (int, Bool);
typedef struct {
ExaDriverPtr info;
- ScreenBlockHandlerProcPtr SavedBlockHandler;
- ScreenWakeupHandlerProcPtr SavedWakeupHandler;
- CreateGCProcPtr SavedCreateGC;
- CloseScreenProcPtr SavedCloseScreen;
- GetImageProcPtr SavedGetImage;
- GetSpansProcPtr SavedGetSpans;
- CreatePixmapProcPtr SavedCreatePixmap;
- DestroyPixmapProcPtr SavedDestroyPixmap;
- CopyWindowProcPtr SavedCopyWindow;
+ ScreenBlockHandlerProcPtr SavedBlockHandler;
+ ScreenWakeupHandlerProcPtr SavedWakeupHandler;
+ CreateGCProcPtr SavedCreateGC;
+ CloseScreenProcPtr SavedCloseScreen;
+ GetImageProcPtr SavedGetImage;
+ GetSpansProcPtr SavedGetSpans;
+ CreatePixmapProcPtr SavedCreatePixmap;
+ DestroyPixmapProcPtr SavedDestroyPixmap;
+ CopyWindowProcPtr SavedCopyWindow;
ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
- BitmapToRegionProcPtr SavedBitmapToRegion;
+ BitmapToRegionProcPtr SavedBitmapToRegion;
CreateScreenResourcesProcPtr SavedCreateScreenResources;
- ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
- SourceValidateProcPtr SavedSourceValidate;
- CompositeProcPtr SavedComposite;
- TrianglesProcPtr SavedTriangles;
- GlyphsProcPtr SavedGlyphs;
- TrapezoidsProcPtr SavedTrapezoids;
- AddTrapsProcPtr SavedAddTraps;
- void (*do_migration) (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
+ ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
+ SourceValidateProcPtr SavedSourceValidate;
+ CompositeProcPtr SavedComposite;
+ TrianglesProcPtr SavedTriangles;
+ GlyphsProcPtr SavedGlyphs;
+ TrapezoidsProcPtr SavedTrapezoids;
+ AddTrapsProcPtr SavedAddTraps;
+ void (*do_migration) (ExaMigrationPtr pixmaps, int npixmaps,
+ Bool can_accel);
Bool (*pixmap_has_gpu_copy) (PixmapPtr pPixmap);
void (*do_move_in_pixmap) (PixmapPtr pPixmap);
void (*do_move_out_pixmap) (PixmapPtr pPixmap);
- void (*prepare_access_reg)(PixmapPtr pPixmap, int index, RegionPtr pReg);
-
- Bool swappedOut;
- enum ExaMigrationHeuristic migration;
- Bool checkDirtyCorrectness;
- unsigned disableFbCount;
- Bool optimize_migration;
- unsigned offScreenCounter;
- unsigned numOffscreenAvailable;
- CARD32 lastDefragment;
- CARD32 nextDefragment;
- PixmapPtr deferred_mixed_pixmap;
+ void (*prepare_access_reg) (PixmapPtr pPixmap, int index, RegionPtr pReg);
+
+ Bool swappedOut;
+ enum ExaMigrationHeuristic migration;
+ Bool checkDirtyCorrectness;
+ unsigned disableFbCount;
+ Bool optimize_migration;
+ unsigned offScreenCounter;
+ unsigned numOffscreenAvailable;
+ CARD32 lastDefragment;
+ CARD32 nextDefragment;
+ PixmapPtr deferred_mixed_pixmap;
/* Reference counting for accessed pixmaps */
struct {
- PixmapPtr pixmap;
- int count;
- Bool retval;
+ PixmapPtr pixmap;
+ int count;
+ Bool retval;
} access[EXA_NUM_PREPARE_INDICES];
/* Holds information on fallbacks that cannot be relayed otherwise. */
unsigned int fallback_flags;
unsigned int fallback_counter;
- ExaGlyphCacheRec glyphCaches[EXA_NUM_GLYPH_CACHES];
+ ExaGlyphCacheRec glyphCaches[EXA_NUM_GLYPH_CACHES];
/**
* Regions affected by fallback composite source / mask operations.
@@ -222,10 +223,13 @@ typedef struct {
#endif
extern DevPrivateKeyRec exaScreenPrivateKeyRec;
+
#define exaScreenPrivateKey (&exaScreenPrivateKeyRec)
extern DevPrivateKeyRec exaPixmapPrivateKeyRec;
+
#define exaPixmapPrivateKey (&exaPixmapPrivateKeyRec)
extern DevPrivateKeyRec exaGCPrivateKeyRec;
+
#define exaGCPrivateKey (&exaGCPrivateKeyRec)
#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixGetPrivate(&(s)->devPrivates, exaScreenPrivateKey))
@@ -291,15 +295,15 @@ extern DevPrivateKeyRec exaGCPrivateKeyRec;
typedef struct {
ExaOffscreenArea *area;
- int score; /**< score for the move-in vs move-out heuristic */
- Bool use_gpu_copy;
+ int score; /**< score for the move-in vs move-out heuristic */
+ Bool use_gpu_copy;
- CARD8 *sys_ptr; /**< pointer to pixmap data in system memory */
- int sys_pitch; /**< pitch of pixmap in system memory */
+ CARD8 *sys_ptr; /**< pointer to pixmap data in system memory */
+ int sys_pitch; /**< pitch of pixmap in system memory */
- CARD8 *fb_ptr; /**< pointer to pixmap data in framebuffer memory */
- int fb_pitch; /**< pitch of pixmap in framebuffer memory */
- unsigned int fb_size; /**< size of pixmap in framebuffer memory */
+ CARD8 *fb_ptr; /**< pointer to pixmap data in framebuffer memory */
+ int fb_pitch; /**< pitch of pixmap in framebuffer memory */
+ unsigned int fb_size; /**< size of pixmap in framebuffer memory */
/**
* Holds information about whether this pixmap can be used for
@@ -310,19 +314,19 @@ typedef struct {
* EXA_RANGE_WIDTH - set if the pixmap's width is out of range
* EXA_RANGE_HEIGHT - set if the pixmap's height is out of range
*/
- unsigned int accel_blocked;
+ unsigned int accel_blocked;
/**
* The damage record contains the areas of the pixmap's current location
* (framebuffer or system) that have been damaged compared to the other
* location.
*/
- DamagePtr pDamage;
+ DamagePtr pDamage;
/**
* The valid regions mark the valid bits (at least, as they're derived from
* damage, which may be overreported) of a pixmap's system and FB copies.
*/
- RegionRec validSys, validFB;
+ RegionRec validSys, validFB;
/**
* Driver private storage per EXA pixmap
*/
@@ -351,374 +355,383 @@ typedef struct {
* exaDDXDriverInit must be implemented by the DDX using EXA, and is the place
* to set EXA options or hook in screen functions to handle using EXA as the AA.
*/
-void exaDDXDriverInit (ScreenPtr pScreen);
+void exaDDXDriverInit(ScreenPtr pScreen);
/* exa_unaccel.c */
void
-exaPrepareAccessGC(GCPtr pGC);
+ exaPrepareAccessGC(GCPtr pGC);
void
-exaFinishAccessGC(GCPtr pGC);
+ exaFinishAccessGC(GCPtr pGC);
void
-ExaCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
- DDXPointPtr ppt, int *pwidth, int fSorted);
+
+ExaCheckFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nspans,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
void
-ExaCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
- DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
+
+ExaCheckSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
void
-ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
- int x, int y, int w, int h, int leftPad, int format,
- char *bits);
+
+ExaCheckPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ char *bits);
void
-ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- BoxPtr pbox, int nbox, int dx, int dy, Bool reverse,
- Bool upsidedown, Pixel bitplane, void *closure);
+
+ExaCheckCopyNtoN(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ BoxPtr pbox, int nbox, int dx, int dy, Bool reverse,
+ Bool upsidedown, Pixel bitplane, void *closure);
RegionPtr
-ExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty);
+
+ExaCheckCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty);
RegionPtr
-ExaCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty,
- unsigned long bitPlane);
+
+ExaCheckCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty,
+ unsigned long bitPlane);
void
-ExaCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
- DDXPointPtr pptInit);
+
+ExaCheckPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
+ DDXPointPtr pptInit);
void
-ExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr ppt);
+
+ExaCheckPolylines(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr ppt);
void
-ExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
- int nsegInit, xSegment *pSegInit);
+
+ExaCheckPolySegment(DrawablePtr pDrawable, GCPtr pGC,
+ int nsegInit, xSegment * pSegInit);
void
-ExaCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs);
+ ExaCheckPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * pArcs);
void
-ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrect, xRectangle *prect);
+
+ExaCheckPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
+ int nrect, xRectangle *prect);
void
-ExaCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
+
+ExaCheckImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
void
-ExaCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
+
+ExaCheckPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
void
-ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w, int h, int x, int y);
+
+ExaCheckPushPixels(GCPtr pGC, PixmapPtr pBitmap,
+ DrawablePtr pDrawable, int w, int h, int x, int y);
void
-ExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+ ExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
void
+
ExaCheckGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask, char *d);
+ unsigned int format, unsigned long planeMask, char *d);
void
-ExaCheckGetSpans (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pdstStart);
+
+ExaCheckGetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart);
void
-ExaCheckAddTraps (PicturePtr pPicture,
- INT16 x_off,
- INT16 y_off,
- int ntrap,
- xTrap *traps);
+
+ExaCheckAddTraps(PicturePtr pPicture,
+ INT16 x_off, INT16 y_off, int ntrap, xTrap * traps);
/* exa_accel.c */
static _X_INLINE Bool
exaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
- unsigned int fillStyle, unsigned char alu,
- unsigned int clientClipType)
+ unsigned int fillStyle, unsigned char alu,
+ unsigned int clientClipType)
{
return ((alu != GXcopy && alu != GXclear && alu != GXset &&
- alu != GXcopyInverted) || fillStyle == FillStippled ||
- clientClipType != CT_NONE || !EXA_PM_IS_SOLID(pDrawable, planemask));
+ alu != GXcopyInverted) || fillStyle == FillStippled ||
+ clientClipType != CT_NONE ||
+ !EXA_PM_IS_SOLID(pDrawable, planemask));
}
void
-exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+ exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
Bool
-exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
- DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
- unsigned int clientClipType);
+
+exaFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
+ DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
+ unsigned int clientClipType);
void
-exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask, char *d);
+
+exaGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long planeMask, char *d);
RegionPtr
+
exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty);
+ int srcx, int srcy, int width, int height, int dstx, int dsty);
Bool
-exaHWCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown);
-
-void
-exaCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
+
+exaHWCopyNtoN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox, int dx, int dy, Bool reverse, Bool upsidedown);
+
+void
+
+exaCopyNtoN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
extern const GCOps exaOps;
void
-ExaCheckComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void
-ExaCheckGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
+
+ExaCheckComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
+
+void
+
+ExaCheckGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
/* exa_offscreen.c */
void
-ExaOffscreenSwapOut (ScreenPtr pScreen);
+ ExaOffscreenSwapOut(ScreenPtr pScreen);
void
-ExaOffscreenSwapIn (ScreenPtr pScreen);
+ ExaOffscreenSwapIn(ScreenPtr pScreen);
-ExaOffscreenArea*
-ExaOffscreenDefragment (ScreenPtr pScreen);
+ExaOffscreenArea *ExaOffscreenDefragment(ScreenPtr pScreen);
Bool
-exaOffscreenInit(ScreenPtr pScreen);
+ exaOffscreenInit(ScreenPtr pScreen);
void
-ExaOffscreenFini (ScreenPtr pScreen);
+ ExaOffscreenFini(ScreenPtr pScreen);
/* exa.c */
Bool
-ExaDoPrepareAccess(PixmapPtr pPixmap, int index);
+ ExaDoPrepareAccess(PixmapPtr pPixmap, int index);
void
-exaPrepareAccess(DrawablePtr pDrawable, int index);
+ exaPrepareAccess(DrawablePtr pDrawable, int index);
void
-exaFinishAccess(DrawablePtr pDrawable, int index);
+ exaFinishAccess(DrawablePtr pDrawable, int index);
void
-exaDestroyPixmap(PixmapPtr pPixmap);
+ exaDestroyPixmap(PixmapPtr pPixmap);
void
-exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
+ exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
void
-exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
- int *xp, int *yp);
+
+exaGetDrawableDeltas(DrawablePtr pDrawable, PixmapPtr pPixmap,
+ int *xp, int *yp);
Bool
-exaPixmapHasGpuCopy(PixmapPtr p);
+ exaPixmapHasGpuCopy(PixmapPtr p);
PixmapPtr
-exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
+ exaGetOffscreenPixmap(DrawablePtr pDrawable, int *xp, int *yp);
PixmapPtr
-exaGetDrawablePixmap(DrawablePtr pDrawable);
+ exaGetDrawablePixmap(DrawablePtr pDrawable);
void
+
exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
int w, int h, int bpp);
void
+
exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
int w, int h, int bpp);
void
-exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
+ exaDoMigration(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
Bool
-exaPixmapIsPinned (PixmapPtr pPix);
+ exaPixmapIsPinned(PixmapPtr pPix);
extern const GCFuncs exaGCFuncs;
/* exa_classic.c */
PixmapPtr
+
exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned usage_hint);
Bool
-exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData);
+
+exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
+ int depth, int bitsPerPixel, int devKind,
+ pointer pPixData);
Bool
-exaDestroyPixmap_classic (PixmapPtr pPixmap);
+ exaDestroyPixmap_classic(PixmapPtr pPixmap);
Bool
-exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
+ exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
/* exa_driver.c */
PixmapPtr
+
exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned usage_hint);
Bool
-exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData);
+
+exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
+ int depth, int bitsPerPixel, int devKind,
+ pointer pPixData);
Bool
-exaDestroyPixmap_driver (PixmapPtr pPixmap);
+ exaDestroyPixmap_driver(PixmapPtr pPixmap);
Bool
-exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
+ exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
/* exa_mixed.c */
PixmapPtr
+
exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
+ unsigned usage_hint);
Bool
+
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData);
+ int bitsPerPixel, int devKind, pointer pPixData);
Bool
-exaDestroyPixmap_mixed(PixmapPtr pPixmap);
+ exaDestroyPixmap_mixed(PixmapPtr pPixmap);
Bool
-exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap);
+ exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap);
/* exa_migration_mixed.c */
void
-exaCreateDriverPixmap_mixed(PixmapPtr pPixmap);
+ exaCreateDriverPixmap_mixed(PixmapPtr pPixmap);
void
-exaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
+ exaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
void
-exaMoveInPixmap_mixed(PixmapPtr pPixmap);
+ exaMoveInPixmap_mixed(PixmapPtr pPixmap);
void
-exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure);
+ exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure);
void
-exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg);
+ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg);
/* exa_render.c */
Bool
-exaOpReadsDestination (CARD8 op);
+ exaOpReadsDestination(CARD8 op);
void
-exaComposite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
+
+exaComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
void
-exaCompositeRects(CARD8 op,
- PicturePtr Src,
- PicturePtr pMask,
- PicturePtr pDst,
- int nrect,
- ExaCompositeRectPtr rects);
+
+exaCompositeRects(CARD8 op,
+ PicturePtr Src,
+ PicturePtr pMask,
+ PicturePtr pDst, int nrect, ExaCompositeRectPtr rects);
void
-exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int ntrap, xTrapezoid *traps);
+
+exaTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
+ int ntrap, xTrapezoid * traps);
void
-exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int ntri, xTriangle *tris);
+
+exaTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
+ int ntri, xTriangle * tris);
/* exa_glyph.c */
void
-exaGlyphsInit(ScreenPtr pScreen);
+ exaGlyphsInit(ScreenPtr pScreen);
void
-exaGlyphsFini (ScreenPtr pScreen);
+ exaGlyphsFini(ScreenPtr pScreen);
void
-exaGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
+
+exaGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
/* exa_migration_classic.c */
void
-exaCopyDirtyToSys (ExaMigrationPtr migrate);
+ exaCopyDirtyToSys(ExaMigrationPtr migrate);
void
-exaCopyDirtyToFb (ExaMigrationPtr migrate);
+ exaCopyDirtyToFb(ExaMigrationPtr migrate);
void
-exaDoMigration_classic (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
+ exaDoMigration_classic(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
void
-exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area);
+ exaPixmapSave(ScreenPtr pScreen, ExaOffscreenArea * area);
void
-exaMoveOutPixmap_classic (PixmapPtr pPixmap);
+ exaMoveOutPixmap_classic(PixmapPtr pPixmap);
void
-exaMoveInPixmap_classic (PixmapPtr pPixmap);
+ exaMoveInPixmap_classic(PixmapPtr pPixmap);
void
-exaPrepareAccessReg_classic(PixmapPtr pPixmap, int index, RegionPtr pReg);
+ exaPrepareAccessReg_classic(PixmapPtr pPixmap, int index, RegionPtr pReg);
-#endif /* EXAPRIV_H */
+#endif /* EXAPRIV_H */
diff --git a/xorg-server/exa/exa_render.c b/xorg-server/exa/exa_render.c
index 3974afe87..172e2b56d 100644
--- a/xorg-server/exa/exa_render.c
+++ b/xorg-server/exa/exa_render.c
@@ -33,7 +33,8 @@
#include "mipict.h"
#if DEBUG_TRACE_FALL
-static void exaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n)
+static void
+exaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n)
{
char format[20];
char size[20];
@@ -41,76 +42,73 @@ static void exaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n)
int temp;
if (!pict) {
- snprintf(string, n, "None");
- return;
+ snprintf(string, n, "None");
+ return;
}
- switch (pict->format)
- {
+ switch (pict->format) {
case PICT_a8r8g8b8:
- snprintf(format, 20, "ARGB8888");
- break;
+ snprintf(format, 20, "ARGB8888");
+ break;
case PICT_x8r8g8b8:
- snprintf(format, 20, "XRGB8888");
- break;
+ snprintf(format, 20, "XRGB8888");
+ break;
case PICT_b8g8r8a8:
- snprintf(format, 20, "BGRA8888");
- break;
+ snprintf(format, 20, "BGRA8888");
+ break;
case PICT_b8g8r8x8:
- snprintf(format, 20, "BGRX8888");
- break;
+ snprintf(format, 20, "BGRX8888");
+ break;
case PICT_r5g6b5:
- snprintf(format, 20, "RGB565 ");
- break;
+ snprintf(format, 20, "RGB565 ");
+ break;
case PICT_x1r5g5b5:
- snprintf(format, 20, "RGB555 ");
- break;
+ snprintf(format, 20, "RGB555 ");
+ break;
case PICT_a8:
- snprintf(format, 20, "A8 ");
- break;
+ snprintf(format, 20, "A8 ");
+ break;
case PICT_a1:
- snprintf(format, 20, "A1 ");
- break;
+ snprintf(format, 20, "A1 ");
+ break;
default:
- snprintf(format, 20, "0x%x", (int)pict->format);
- break;
+ snprintf(format, 20, "0x%x", (int) pict->format);
+ break;
}
if (pict->pDrawable) {
- loc = exaGetOffscreenPixmap(pict->pDrawable, &temp, &temp) ? 's' : 'm';
+ loc = exaGetOffscreenPixmap(pict->pDrawable, &temp, &temp) ? 's' : 'm';
- snprintf(size, 20, "%dx%d%s", pict->pDrawable->width,
- pict->pDrawable->height, pict->repeat ?
- " R" : "");
- } else {
- loc = '-';
+ snprintf(size, 20, "%dx%d%s", pict->pDrawable->width,
+ pict->pDrawable->height, pict->repeat ? " R" : "");
+ }
+ else {
+ loc = '-';
- snprintf(size, 20, "%s", pict->repeat ? " R" : "");
+ snprintf(size, 20, "%s", pict->repeat ? " R" : "");
}
- snprintf(string, n, "%p:%c fmt %s (%s)", pict->pDrawable, loc, format, size);
+ snprintf(string, n, "%p:%c fmt %s (%s)", pict->pDrawable, loc, format,
+ size);
}
static void
exaPrintCompositeFallback(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst)
+ PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst)
{
char sop[20];
char srcdesc[40], maskdesc[40], dstdesc[40];
- switch(op)
- {
+ switch (op) {
case PictOpSrc:
- snprintf(sop, sizeof(sop), "Src");
- break;
+ snprintf(sop, sizeof(sop), "Src");
+ break;
case PictOpOver:
- snprintf(sop, sizeof(sop), "Over");
- break;
+ snprintf(sop, sizeof(sop), "Over");
+ break;
default:
- snprintf(sop, sizeof(sop), "0x%x", (int)op);
- break;
+ snprintf(sop, sizeof(sop), "0x%x", (int) op);
+ break;
}
exaCompositeFallbackPictDesc(pSrc, srcdesc, 40);
@@ -118,15 +116,14 @@ exaPrintCompositeFallback(CARD8 op,
exaCompositeFallbackPictDesc(pDst, dstdesc, 40);
ErrorF("Composite fallback: op %s, \n"
- " src %s, \n"
- " mask %s, \n"
- " dst %s, \n",
- sop, srcdesc, maskdesc, dstdesc);
+ " src %s, \n"
+ " mask %s, \n"
+ " dst %s, \n", sop, srcdesc, maskdesc, dstdesc);
}
-#endif /* DEBUG_TRACE_FALL */
+#endif /* DEBUG_TRACE_FALL */
Bool
-exaOpReadsDestination (CARD8 op)
+exaOpReadsDestination(CARD8 op)
{
/* FALSE (does not read destination) is the list of ops in the protocol
* document with "0" in the "Fb" column and no "Ab" in the "Fa" column.
@@ -136,20 +133,17 @@ exaOpReadsDestination (CARD8 op)
switch (op) {
case PictOpClear:
case PictOpSrc:
- return FALSE;
+ return FALSE;
default:
- return TRUE;
+ return TRUE;
}
}
-
static Bool
-exaGetPixelFromRGBA(CARD32 *pixel,
- CARD16 red,
- CARD16 green,
- CARD16 blue,
- CARD16 alpha,
- PictFormatPtr pFormat)
+exaGetPixelFromRGBA(CARD32 *pixel,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue, CARD16 alpha, PictFormatPtr pFormat)
{
int rbits, bbits, gbits, abits;
int rshift, bshift, gshift, ashift;
@@ -157,8 +151,8 @@ exaGetPixelFromRGBA(CARD32 *pixel,
*pixel = 0;
if (!PICT_FORMAT_COLOR(pFormat->format) &&
- PICT_FORMAT_TYPE(pFormat->format) != PICT_TYPE_A)
- return FALSE;
+ PICT_FORMAT_TYPE(pFormat->format) != PICT_TYPE_A)
+ return FALSE;
rbits = PICT_FORMAT_R(pFormat->format);
gbits = PICT_FORMAT_G(pFormat->format);
@@ -170,28 +164,27 @@ exaGetPixelFromRGBA(CARD32 *pixel,
bshift = pFormat->direct.blue;
ashift = pFormat->direct.alpha;
- *pixel |= ( blue >> (16 - bbits)) << bshift;
- *pixel |= ( red >> (16 - rbits)) << rshift;
- *pixel |= (green >> (16 - gbits)) << gshift;
- *pixel |= (alpha >> (16 - abits)) << ashift;
+ *pixel |= (blue >> (16 - bbits)) << bshift;
+ *pixel |= (red >> (16 - rbits)) << rshift;
+ *pixel |= (green >> (16 - gbits)) << gshift;
+ *pixel |= (alpha >> (16 - abits)) << ashift;
return TRUE;
}
static Bool
-exaGetRGBAFromPixel(CARD32 pixel,
- CARD16 *red,
- CARD16 *green,
- CARD16 *blue,
- CARD16 *alpha,
- PictFormatPtr pFormat,
- PictFormatShort format)
+exaGetRGBAFromPixel(CARD32 pixel,
+ CARD16 *red,
+ CARD16 *green,
+ CARD16 *blue,
+ CARD16 *alpha,
+ PictFormatPtr pFormat, PictFormatShort format)
{
int rbits, bbits, gbits, abits;
int rshift, bshift, gshift, ashift;
if (!PICT_FORMAT_COLOR(format) && PICT_FORMAT_TYPE(format) != PICT_TYPE_A)
- return FALSE;
+ return FALSE;
rbits = PICT_FORMAT_R(format);
gbits = PICT_FORMAT_G(format);
@@ -199,66 +192,67 @@ exaGetRGBAFromPixel(CARD32 pixel,
abits = PICT_FORMAT_A(format);
if (pFormat) {
- rshift = pFormat->direct.red;
- gshift = pFormat->direct.green;
- bshift = pFormat->direct.blue;
- ashift = pFormat->direct.alpha;
- } else if (format == PICT_a8r8g8b8) {
- rshift = 16;
- gshift = 8;
- bshift = 0;
- ashift = 24;
- } else
- FatalError("EXA bug: exaGetRGBAFromPixel() doesn't match "
- "createSourcePicture()\n");
+ rshift = pFormat->direct.red;
+ gshift = pFormat->direct.green;
+ bshift = pFormat->direct.blue;
+ ashift = pFormat->direct.alpha;
+ }
+ else if (format == PICT_a8r8g8b8) {
+ rshift = 16;
+ gshift = 8;
+ bshift = 0;
+ ashift = 24;
+ }
+ else
+ FatalError("EXA bug: exaGetRGBAFromPixel() doesn't match "
+ "createSourcePicture()\n");
if (rbits) {
- *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
- while (rbits < 16) {
- *red |= *red >> rbits;
- rbits <<= 1;
- }
-
- *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
- while (gbits < 16) {
- *green |= *green >> gbits;
- gbits <<= 1;
- }
-
- *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
- while (bbits < 16) {
- *blue |= *blue >> bbits;
- bbits <<= 1;
- }
- } else {
- *red = 0x0000;
- *green = 0x0000;
- *blue = 0x0000;
+ *red = ((pixel >> rshift) & ((1 << rbits) - 1)) << (16 - rbits);
+ while (rbits < 16) {
+ *red |= *red >> rbits;
+ rbits <<= 1;
+ }
+
+ *green = ((pixel >> gshift) & ((1 << gbits) - 1)) << (16 - gbits);
+ while (gbits < 16) {
+ *green |= *green >> gbits;
+ gbits <<= 1;
+ }
+
+ *blue = ((pixel >> bshift) & ((1 << bbits) - 1)) << (16 - bbits);
+ while (bbits < 16) {
+ *blue |= *blue >> bbits;
+ bbits <<= 1;
+ }
+ }
+ else {
+ *red = 0x0000;
+ *green = 0x0000;
+ *blue = 0x0000;
}
if (abits) {
- *alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits);
- while (abits < 16) {
- *alpha |= *alpha >> abits;
- abits <<= 1;
- }
- } else
- *alpha = 0xffff;
+ *alpha = ((pixel >> ashift) & ((1 << abits) - 1)) << (16 - abits);
+ while (abits < 16) {
+ *alpha |= *alpha >> abits;
+ abits <<= 1;
+ }
+ }
+ else
+ *alpha = 0xffff;
return TRUE;
}
static int
-exaTryDriverSolidFill(PicturePtr pSrc,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+exaTryDriverSolidFill(PicturePtr pSrc,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
- ExaScreenPriv (pDst->pDrawable->pScreen);
+ ExaScreenPriv(pDst->pDrawable->pScreen);
RegionRec region;
BoxPtr pbox;
int nbox;
@@ -268,75 +262,71 @@ exaTryDriverSolidFill(PicturePtr pSrc,
CARD32 pixel;
CARD16 red, green, blue, alpha;
- pDstPix = exaGetDrawablePixmap (pDst->pDrawable);
+ pDstPix = exaGetDrawablePixmap(pDst->pDrawable);
pDstExaPix = ExaGetPixmapPriv(pDstPix);
/* Check whether the accelerator can use the destination pixmap.
*/
- if (pDstExaPix->accel_blocked)
- {
- return -1;
+ if (pDstExaPix->accel_blocked) {
+ return -1;
}
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
if (pSrc->pDrawable) {
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
}
- if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
- xSrc, ySrc, 0, 0, xDst, yDst,
- width, height))
- return 1;
+ if (!miComputeCompositeRegion(&region, pSrc, NULL, pDst,
+ xSrc, ySrc, 0, 0, xDst, yDst, width, height))
+ return 1;
- exaGetDrawableDeltas (pDst->pDrawable, pDstPix, &dst_off_x, &dst_off_y);
+ exaGetDrawableDeltas(pDst->pDrawable, pDstPix, &dst_off_x, &dst_off_y);
RegionTranslate(&region, dst_off_x, dst_off_y);
if (pSrc->pDrawable) {
- pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable);
- pixel = exaGetPixmapFirstPixel (pSrcPix);
- } else
- pixel = pSrc->pSourcePict->solidFill.color;
+ pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
+ pixel = exaGetPixmapFirstPixel(pSrcPix);
+ }
+ else
+ pixel = pSrc->pSourcePict->solidFill.color;
if (!exaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha,
- pSrc->pFormat, pSrc->format) ||
- !exaGetPixelFromRGBA(&pixel, red, green, blue, alpha,
- pDst->pFormat))
- {
- RegionUninit(&region);
- return -1;
+ pSrc->pFormat, pSrc->format) ||
+ !exaGetPixelFromRGBA(&pixel, red, green, blue, alpha, pDst->pFormat)) {
+ RegionUninit(&region);
+ return -1;
}
if (pExaScr->do_migration) {
- ExaMigrationRec pixmaps[1];
+ ExaMigrationRec pixmaps[1];
- pixmaps[0].as_dst = TRUE;
- pixmaps[0].as_src = FALSE;
- pixmaps[0].pPix = pDstPix;
- pixmaps[0].pReg = &region;
- exaDoMigration(pixmaps, 1, TRUE);
+ pixmaps[0].as_dst = TRUE;
+ pixmaps[0].as_src = FALSE;
+ pixmaps[0].pPix = pDstPix;
+ pixmaps[0].pReg = &region;
+ exaDoMigration(pixmaps, 1, TRUE);
}
if (!exaPixmapHasGpuCopy(pDstPix)) {
- RegionUninit(&region);
- return 0;
+ RegionUninit(&region);
+ return 0;
}
- if (!(*pExaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel))
- {
- RegionUninit(&region);
- return -1;
+ if (!(*pExaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel)) {
+ RegionUninit(&region);
+ return -1;
}
nbox = RegionNumRects(&region);
pbox = RegionRects(&region);
- while (nbox--)
- {
- (*pExaScr->info->Solid) (pDstPix, pbox->x1, pbox->y1, pbox->x2, pbox->y2);
- pbox++;
+ while (nbox--) {
+ (*pExaScr->info->Solid) (pDstPix, pbox->x1, pbox->y1, pbox->x2,
+ pbox->y2);
+ pbox++;
}
(*pExaScr->info->DoneSolid) (pDstPix);
@@ -347,30 +337,29 @@ exaTryDriverSolidFill(PicturePtr pSrc,
}
static int
-exaTryDriverCompositeRects(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- int nrect,
- ExaCompositeRectPtr rects)
+exaTryDriverCompositeRects(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ int nrect, ExaCompositeRectPtr rects)
{
- ExaScreenPriv (pDst->pDrawable->pScreen);
+ ExaScreenPriv(pDst->pDrawable->pScreen);
int src_off_x = 0, src_off_y = 0, mask_off_x = 0, mask_off_y = 0;
int dst_off_x, dst_off_y;
PixmapPtr pSrcPix = NULL, pMaskPix = NULL, pDstPix;
ExaPixmapPrivPtr pSrcExaPix = NULL, pMaskExaPix = NULL, pDstExaPix;
if (!pExaScr->info->PrepareComposite)
- return -1;
+ return -1;
if (pSrc->pDrawable) {
- pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
- pSrcExaPix = ExaGetPixmapPriv(pSrcPix);
+ pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
+ pSrcExaPix = ExaGetPixmapPriv(pSrcPix);
}
if (pMask && pMask->pDrawable) {
- pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
- pMaskExaPix = ExaGetPixmapPriv(pMaskPix);
+ pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
+ pMaskExaPix = ExaGetPixmapPriv(pMaskPix);
}
pDstPix = exaGetDrawablePixmap(pDst->pDrawable);
@@ -381,122 +370,120 @@ exaTryDriverCompositeRects(CARD8 op,
* happens within limits.
*/
if (pDstExaPix->accel_blocked ||
- (pSrcExaPix && pSrcExaPix->accel_blocked) ||
- (pMaskExaPix && pMaskExaPix->accel_blocked))
- {
- return -1;
+ (pSrcExaPix && pSrcExaPix->accel_blocked) ||
+ (pMaskExaPix && pMaskExaPix->accel_blocked)) {
+ return -1;
}
if (pExaScr->info->CheckComposite &&
- !(*pExaScr->info->CheckComposite) (op, pSrc, pMask, pDst))
- {
- return -1;
+ !(*pExaScr->info->CheckComposite) (op, pSrc, pMask, pDst)) {
+ return -1;
}
if (pExaScr->do_migration) {
- ExaMigrationRec pixmaps[3];
- int i = 0;
-
- pixmaps[i].as_dst = TRUE;
- pixmaps[i].as_src = exaOpReadsDestination(op);
- pixmaps[i].pPix = pDstPix;
- pixmaps[i].pReg = NULL;
- i++;
-
- if (pSrcPix) {
- pixmaps[i].as_dst = FALSE;
- pixmaps[i].as_src = TRUE;
- pixmaps[i].pPix = pSrcPix;
- pixmaps[i].pReg = NULL;
- i++;
- }
-
- if (pMaskPix) {
- pixmaps[i].as_dst = FALSE;
- pixmaps[i].as_src = TRUE;
- pixmaps[i].pPix = pMaskPix;
- pixmaps[i].pReg = NULL;
- i++;
- }
-
- exaDoMigration(pixmaps, i, TRUE);
+ ExaMigrationRec pixmaps[3];
+ int i = 0;
+
+ pixmaps[i].as_dst = TRUE;
+ pixmaps[i].as_src = exaOpReadsDestination(op);
+ pixmaps[i].pPix = pDstPix;
+ pixmaps[i].pReg = NULL;
+ i++;
+
+ if (pSrcPix) {
+ pixmaps[i].as_dst = FALSE;
+ pixmaps[i].as_src = TRUE;
+ pixmaps[i].pPix = pSrcPix;
+ pixmaps[i].pReg = NULL;
+ i++;
+ }
+
+ if (pMaskPix) {
+ pixmaps[i].as_dst = FALSE;
+ pixmaps[i].as_src = TRUE;
+ pixmaps[i].pPix = pMaskPix;
+ pixmaps[i].pReg = NULL;
+ i++;
+ }
+
+ exaDoMigration(pixmaps, i, TRUE);
}
- pDstPix = exaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
+ pDstPix = exaGetOffscreenPixmap(pDst->pDrawable, &dst_off_x, &dst_off_y);
if (!pDstPix)
- return 0;
+ return 0;
if (pSrcPix) {
- pSrcPix = exaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
- if (!pSrcPix)
- return 0;
+ pSrcPix =
+ exaGetOffscreenPixmap(pSrc->pDrawable, &src_off_x, &src_off_y);
+ if (!pSrcPix)
+ return 0;
}
if (pMaskPix) {
- pMaskPix = exaGetOffscreenPixmap (pMask->pDrawable, &mask_off_x, &mask_off_y);
- if (!pMaskPix)
- return 0;
+ pMaskPix =
+ exaGetOffscreenPixmap(pMask->pDrawable, &mask_off_x, &mask_off_y);
+ if (!pMaskPix)
+ return 0;
}
if (!(*pExaScr->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix,
- pMaskPix, pDstPix))
- return -1;
-
- while (nrect--)
- {
- INT16 xDst = rects->xDst + pDst->pDrawable->x;
- INT16 yDst = rects->yDst + pDst->pDrawable->y;
- INT16 xMask = rects->xMask;
- INT16 yMask = rects->yMask;
- INT16 xSrc = rects->xSrc;
- INT16 ySrc = rects->ySrc;
- RegionRec region;
- BoxPtr pbox;
- int nbox;
-
- if (pMaskPix) {
- xMask += pMask->pDrawable->x;
- yMask += pMask->pDrawable->y;
- }
-
- if (pSrcPix) {
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
- }
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- rects->width, rects->height))
- goto next_rect;
-
- RegionTranslate(&region, dst_off_x, dst_off_y);
-
- nbox = RegionNumRects(&region);
- pbox = RegionRects(&region);
-
- xMask = xMask + mask_off_x - xDst - dst_off_x;
- yMask = yMask + mask_off_y - yDst - dst_off_y;
- xSrc = xSrc + src_off_x - xDst - dst_off_x;
- ySrc = ySrc + src_off_y - yDst - dst_off_y;
-
- while (nbox--)
- {
- (*pExaScr->info->Composite) (pDstPix,
- pbox->x1 + xSrc,
- pbox->y1 + ySrc,
- pbox->x1 + xMask,
- pbox->y1 + yMask,
- pbox->x1,
- pbox->y1,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- pbox++;
- }
-
- next_rect:
- RegionUninit(&region);
-
- rects++;
+ pMaskPix, pDstPix))
+ return -1;
+
+ while (nrect--) {
+ INT16 xDst = rects->xDst + pDst->pDrawable->x;
+ INT16 yDst = rects->yDst + pDst->pDrawable->y;
+ INT16 xMask = rects->xMask;
+ INT16 yMask = rects->yMask;
+ INT16 xSrc = rects->xSrc;
+ INT16 ySrc = rects->ySrc;
+ RegionRec region;
+ BoxPtr pbox;
+ int nbox;
+
+ if (pMaskPix) {
+ xMask += pMask->pDrawable->x;
+ yMask += pMask->pDrawable->y;
+ }
+
+ if (pSrcPix) {
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+ }
+
+ if (!miComputeCompositeRegion(&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ rects->width, rects->height))
+ goto next_rect;
+
+ RegionTranslate(&region, dst_off_x, dst_off_y);
+
+ nbox = RegionNumRects(&region);
+ pbox = RegionRects(&region);
+
+ xMask = xMask + mask_off_x - xDst - dst_off_x;
+ yMask = yMask + mask_off_y - yDst - dst_off_y;
+ xSrc = xSrc + src_off_x - xDst - dst_off_x;
+ ySrc = ySrc + src_off_y - yDst - dst_off_y;
+
+ while (nbox--) {
+ (*pExaScr->info->Composite) (pDstPix,
+ pbox->x1 + xSrc,
+ pbox->y1 + ySrc,
+ pbox->x1 + xMask,
+ pbox->y1 + yMask,
+ pbox->x1,
+ pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ next_rect:
+ RegionUninit(&region);
+
+ rects++;
}
(*pExaScr->info->DoneComposite) (pDstPix);
@@ -513,14 +500,12 @@ exaTryDriverCompositeRects(CARD8 op,
* software.
*/
void
-exaCompositeRects(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- int nrect,
- ExaCompositeRectPtr rects)
+exaCompositeRects(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst, int nrect, ExaCompositeRectPtr rects)
{
- ExaScreenPriv (pDst->pDrawable->pScreen);
+ ExaScreenPriv(pDst->pDrawable->pScreen);
int n;
ExaCompositeRectPtr r;
int ret;
@@ -529,123 +514,125 @@ exaCompositeRects(CARD8 op,
* destination directly, so the damage layer takes care of this.
*/
if (!pMask) {
- RegionRec region;
- int x1 = MAXSHORT;
- int y1 = MAXSHORT;
- int x2 = MINSHORT;
- int y2 = MINSHORT;
- BoxRec box;
-
- /* We have to manage the damage ourselves, since CompositeRects isn't
- * something in the screen that can be managed by the damage extension,
- * and EXA depends on damage to track what needs to be migrated between
- * the gpu and the cpu.
- */
-
- /* Compute the overall extents of the composited region - we're making
- * the assumption here that we are compositing a bunch of glyphs that
- * cluster closely together and damaging each glyph individually would
- * be a loss compared to damaging the bounding box.
- */
- n = nrect;
- r = rects;
- while (n--) {
- int rect_x2 = r->xDst + r->width;
- int rect_y2 = r->yDst + r->height;
-
- if (r->xDst < x1) x1 = r->xDst;
- if (r->yDst < y1) y1 = r->yDst;
- if (rect_x2 > x2) x2 = rect_x2;
- if (rect_y2 > y2) y2 = rect_y2;
-
- r++;
- }
-
- if (x2 <= x1 || y2 <= y1)
- return;
-
- box.x1 = x1;
- box.x2 = x2 < MAXSHORT ? x2 : MAXSHORT;
- box.y1 = y1;
- box.y2 = y2 < MAXSHORT ? y2 : MAXSHORT;
-
- /* The pixmap migration code relies on pendingDamage indicating
- * the bounds of the current rendering, so we need to force
- * the actual damage into that region before we do anything, and
- * (see use of DamagePendingRegion in exaCopyDirty)
- */
-
- RegionInit(&region, &box, 1);
-
- DamageRegionAppend(pDst->pDrawable, &region);
-
- RegionUninit(&region);
+ RegionRec region;
+ int x1 = MAXSHORT;
+ int y1 = MAXSHORT;
+ int x2 = MINSHORT;
+ int y2 = MINSHORT;
+ BoxRec box;
+
+ /* We have to manage the damage ourselves, since CompositeRects isn't
+ * something in the screen that can be managed by the damage extension,
+ * and EXA depends on damage to track what needs to be migrated between
+ * the gpu and the cpu.
+ */
+
+ /* Compute the overall extents of the composited region - we're making
+ * the assumption here that we are compositing a bunch of glyphs that
+ * cluster closely together and damaging each glyph individually would
+ * be a loss compared to damaging the bounding box.
+ */
+ n = nrect;
+ r = rects;
+ while (n--) {
+ int rect_x2 = r->xDst + r->width;
+ int rect_y2 = r->yDst + r->height;
+
+ if (r->xDst < x1)
+ x1 = r->xDst;
+ if (r->yDst < y1)
+ y1 = r->yDst;
+ if (rect_x2 > x2)
+ x2 = rect_x2;
+ if (rect_y2 > y2)
+ y2 = rect_y2;
+
+ r++;
+ }
+
+ if (x2 <= x1 || y2 <= y1)
+ return;
+
+ box.x1 = x1;
+ box.x2 = x2 < MAXSHORT ? x2 : MAXSHORT;
+ box.y1 = y1;
+ box.y2 = y2 < MAXSHORT ? y2 : MAXSHORT;
+
+ /* The pixmap migration code relies on pendingDamage indicating
+ * the bounds of the current rendering, so we need to force
+ * the actual damage into that region before we do anything, and
+ * (see use of DamagePendingRegion in exaCopyDirty)
+ */
+
+ RegionInit(&region, &box, 1);
+
+ DamageRegionAppend(pDst->pDrawable, &region);
+
+ RegionUninit(&region);
}
-
+
/************************************************************/
-
- ValidatePicture (pSrc);
+
+ ValidatePicture(pSrc);
if (pMask)
- ValidatePicture (pMask);
- ValidatePicture (pDst);
+ ValidatePicture(pMask);
+ ValidatePicture(pDst);
ret = exaTryDriverCompositeRects(op, pSrc, pMask, pDst, nrect, rects);
if (ret != 1) {
- if (ret == -1 && op == PictOpOver && pMask && pMask->componentAlpha &&
- (!pExaScr->info->CheckComposite ||
- ((*pExaScr->info->CheckComposite)(PictOpOutReverse, pSrc, pMask,
- pDst) &&
- (*pExaScr->info->CheckComposite)(PictOpAdd, pSrc, pMask, pDst)))) {
- ret = exaTryDriverCompositeRects(PictOpOutReverse, pSrc, pMask,
- pDst, nrect, rects);
- if (ret == 1) {
- op = PictOpAdd;
- ret = exaTryDriverCompositeRects(op, pSrc, pMask, pDst, nrect,
- rects);
- }
- }
-
- if (ret != 1) {
- n = nrect;
- r = rects;
- while (n--) {
- ExaCheckComposite (op, pSrc, pMask, pDst,
- r->xSrc, r->ySrc,
- r->xMask, r->yMask,
- r->xDst, r->yDst,
- r->width, r->height);
- r++;
- }
- }
+ if (ret == -1 && op == PictOpOver && pMask && pMask->componentAlpha &&
+ (!pExaScr->info->CheckComposite ||
+ ((*pExaScr->info->CheckComposite) (PictOpOutReverse, pSrc, pMask,
+ pDst) &&
+ (*pExaScr->info->CheckComposite) (PictOpAdd, pSrc, pMask,
+ pDst)))) {
+ ret =
+ exaTryDriverCompositeRects(PictOpOutReverse, pSrc, pMask, pDst,
+ nrect, rects);
+ if (ret == 1) {
+ op = PictOpAdd;
+ ret = exaTryDriverCompositeRects(op, pSrc, pMask, pDst, nrect,
+ rects);
+ }
+ }
+
+ if (ret != 1) {
+ n = nrect;
+ r = rects;
+ while (n--) {
+ ExaCheckComposite(op, pSrc, pMask, pDst,
+ r->xSrc, r->ySrc,
+ r->xMask, r->yMask,
+ r->xDst, r->yDst, r->width, r->height);
+ r++;
+ }
+ }
}
-
+
/************************************************************/
if (!pMask) {
- /* Now we have to flush the damage out from pendingDamage => damage
- * Calling DamageRegionProcessPending has that effect.
- */
+ /* Now we have to flush the damage out from pendingDamage => damage
+ * Calling DamageRegionProcessPending has that effect.
+ */
- DamageRegionProcessPending(pDst->pDrawable);
+ DamageRegionProcessPending(pDst->pDrawable);
}
}
static int
-exaTryDriverComposite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+exaTryDriverComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
- ExaScreenPriv (pDst->pDrawable->pScreen);
+ ExaScreenPriv(pDst->pDrawable->pScreen);
RegionRec region;
BoxPtr pbox;
int nbox;
@@ -654,15 +641,15 @@ exaTryDriverComposite(CARD8 op,
ExaPixmapPrivPtr pSrcExaPix = NULL, pMaskExaPix = NULL, pDstExaPix;
if (pSrc->pDrawable) {
- pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
- pSrcExaPix = ExaGetPixmapPriv(pSrcPix);
+ pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
+ pSrcExaPix = ExaGetPixmapPriv(pSrcPix);
}
pDstPix = exaGetDrawablePixmap(pDst->pDrawable);
pDstExaPix = ExaGetPixmapPriv(pDstPix);
if (pMask && pMask->pDrawable) {
- pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
+ pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
pMaskExaPix = ExaGetPixmapPriv(pMaskPix);
}
@@ -671,96 +658,94 @@ exaTryDriverComposite(CARD8 op,
* happens within limits.
*/
if (pDstExaPix->accel_blocked ||
- (pSrcExaPix && pSrcExaPix->accel_blocked) ||
- (pMaskExaPix && (pMaskExaPix->accel_blocked)))
- {
- return -1;
+ (pSrcExaPix && pSrcExaPix->accel_blocked) ||
+ (pMaskExaPix && (pMaskExaPix->accel_blocked))) {
+ return -1;
}
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
if (pMaskPix) {
- xMask += pMask->pDrawable->x;
- yMask += pMask->pDrawable->y;
+ xMask += pMask->pDrawable->x;
+ yMask += pMask->pDrawable->y;
}
if (pSrcPix) {
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
}
if (pExaScr->info->CheckComposite &&
- !(*pExaScr->info->CheckComposite) (op, pSrc, pMask, pDst))
- {
- return -1;
+ !(*pExaScr->info->CheckComposite) (op, pSrc, pMask, pDst)) {
+ return -1;
}
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- return 1;
+ if (!miComputeCompositeRegion(&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return 1;
- exaGetDrawableDeltas (pDst->pDrawable, pDstPix, &dst_off_x, &dst_off_y);
+ exaGetDrawableDeltas(pDst->pDrawable, pDstPix, &dst_off_x, &dst_off_y);
RegionTranslate(&region, dst_off_x, dst_off_y);
if (pExaScr->do_migration) {
- ExaMigrationRec pixmaps[3];
- int i = 0;
-
- pixmaps[i].as_dst = TRUE;
- pixmaps[i].as_src = exaOpReadsDestination(op);
- pixmaps[i].pPix = pDstPix;
- pixmaps[i].pReg = pixmaps[0].as_src ? NULL : &region;
- i++;
-
- if (pSrcPix) {
- pixmaps[i].as_dst = FALSE;
- pixmaps[i].as_src = TRUE;
- pixmaps[i].pPix = pSrcPix;
- pixmaps[i].pReg = NULL;
- i++;
- }
-
- if (pMaskPix) {
- pixmaps[i].as_dst = FALSE;
- pixmaps[i].as_src = TRUE;
- pixmaps[i].pPix = pMaskPix;
- pixmaps[i].pReg = NULL;
- i++;
- }
-
- exaDoMigration(pixmaps, i, TRUE);
+ ExaMigrationRec pixmaps[3];
+ int i = 0;
+
+ pixmaps[i].as_dst = TRUE;
+ pixmaps[i].as_src = exaOpReadsDestination(op);
+ pixmaps[i].pPix = pDstPix;
+ pixmaps[i].pReg = pixmaps[0].as_src ? NULL : &region;
+ i++;
+
+ if (pSrcPix) {
+ pixmaps[i].as_dst = FALSE;
+ pixmaps[i].as_src = TRUE;
+ pixmaps[i].pPix = pSrcPix;
+ pixmaps[i].pReg = NULL;
+ i++;
+ }
+
+ if (pMaskPix) {
+ pixmaps[i].as_dst = FALSE;
+ pixmaps[i].as_src = TRUE;
+ pixmaps[i].pPix = pMaskPix;
+ pixmaps[i].pReg = NULL;
+ i++;
+ }
+
+ exaDoMigration(pixmaps, i, TRUE);
}
if (pSrcPix) {
- pSrcPix = exaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
- if (!pSrcPix) {
- RegionUninit(&region);
- return 0;
- }
+ pSrcPix =
+ exaGetOffscreenPixmap(pSrc->pDrawable, &src_off_x, &src_off_y);
+ if (!pSrcPix) {
+ RegionUninit(&region);
+ return 0;
+ }
}
if (pMaskPix) {
- pMaskPix = exaGetOffscreenPixmap (pMask->pDrawable, &mask_off_x,
- &mask_off_y);
- if (!pMaskPix) {
- RegionUninit(&region);
- return 0;
- }
+ pMaskPix = exaGetOffscreenPixmap(pMask->pDrawable, &mask_off_x,
+ &mask_off_y);
+ if (!pMaskPix) {
+ RegionUninit(&region);
+ return 0;
+ }
}
if (!exaPixmapHasGpuCopy(pDstPix)) {
- RegionUninit(&region);
- return 0;
+ RegionUninit(&region);
+ return 0;
}
if (!(*pExaScr->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix,
- pMaskPix, pDstPix))
- {
- RegionUninit(&region);
- return -1;
+ pMaskPix, pDstPix)) {
+ RegionUninit(&region);
+ return -1;
}
nbox = RegionNumRects(&region);
@@ -772,18 +757,16 @@ exaTryDriverComposite(CARD8 op,
xSrc = xSrc + src_off_x - xDst - dst_off_x;
ySrc = ySrc + src_off_y - yDst - dst_off_y;
- while (nbox--)
- {
- (*pExaScr->info->Composite) (pDstPix,
- pbox->x1 + xSrc,
- pbox->y1 + ySrc,
- pbox->x1 + xMask,
- pbox->y1 + yMask,
- pbox->x1,
- pbox->y1,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- pbox++;
+ while (nbox--) {
+ (*pExaScr->info->Composite) (pDstPix,
+ pbox->x1 + xSrc,
+ pbox->y1 + ySrc,
+ pbox->x1 + xMask,
+ pbox->y1 + yMask,
+ pbox->x1,
+ pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ pbox++;
}
(*pExaScr->info->DoneComposite) (pDstPix);
exaMarkSync(pDst->pDrawable->pScreen);
@@ -843,28 +826,25 @@ exaTryDriverComposite(CARD8 op,
static int
exaTryMagicTwoPassCompositeHelper(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height)
{
- ExaScreenPriv (pDst->pDrawable->pScreen);
+ ExaScreenPriv(pDst->pDrawable->pScreen);
assert(op == PictOpOver);
if (pExaScr->info->CheckComposite &&
- (!(*pExaScr->info->CheckComposite)(PictOpOutReverse, pSrc, pMask,
- pDst) ||
- !(*pExaScr->info->CheckComposite)(PictOpAdd, pSrc, pMask, pDst)))
- {
- return -1;
+ (!(*pExaScr->info->CheckComposite) (PictOpOutReverse, pSrc, pMask,
+ pDst) ||
+ !(*pExaScr->info->CheckComposite) (PictOpAdd, pSrc, pMask, pDst))) {
+ return -1;
}
/* Now, we think we should be able to accelerate this operation. First,
@@ -872,204 +852,197 @@ exaTryMagicTwoPassCompositeHelper(CARD8 op,
* factors.
*/
exaComposite(PictOpOutReverse, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
- xDst, yDst, width, height);
+ xDst, yDst, width, height);
/* Then, add in the source value times the destination alpha factors (1.0).
*/
exaComposite(PictOpAdd, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
- xDst, yDst, width, height);
+ xDst, yDst, width, height);
return 1;
}
void
-exaComposite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+exaComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
- ExaScreenPriv (pDst->pDrawable->pScreen);
+ ExaScreenPriv(pDst->pDrawable->pScreen);
int ret = -1;
Bool saveSrcRepeat = pSrc->repeat;
Bool saveMaskRepeat = pMask ? pMask->repeat : 0;
RegionRec region;
if (pExaScr->swappedOut)
- goto fallback;
+ goto fallback;
/* Remove repeat in source if useless */
if (pSrc->pDrawable && pSrc->repeat && !pSrc->transform && xSrc >= 0 &&
- (xSrc + width) <= pSrc->pDrawable->width && ySrc >= 0 &&
- (ySrc + height) <= pSrc->pDrawable->height)
- pSrc->repeat = 0;
+ (xSrc + width) <= pSrc->pDrawable->width && ySrc >= 0 &&
+ (ySrc + height) <= pSrc->pDrawable->height)
+ pSrc->repeat = 0;
if (!pMask && !pSrc->alphaMap && !pDst->alphaMap &&
- (op == PictOpSrc || (op == PictOpOver && !PICT_FORMAT_A(pSrc->format))))
+ (op == PictOpSrc || (op == PictOpOver && !PICT_FORMAT_A(pSrc->format))))
{
- if (pSrc->pDrawable ?
- (pSrc->pDrawable->width == 1 && pSrc->pDrawable->height == 1 &&
- pSrc->repeat) :
- (pSrc->pSourcePict->type == SourcePictTypeSolidFill))
- {
- ret = exaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst,
- width, height);
- if (ret == 1)
- goto done;
- } else if (pSrc->pDrawable && !pSrc->transform &&
- ((op == PictOpSrc &&
- (pSrc->format == pDst->format ||
- (PICT_FORMAT_COLOR(pDst->format) &&
- PICT_FORMAT_COLOR(pSrc->format) &&
- pDst->format == PICT_FORMAT(PICT_FORMAT_BPP(pSrc->format),
- PICT_FORMAT_TYPE(pSrc->format),
- 0,
- PICT_FORMAT_R(pSrc->format),
- PICT_FORMAT_G(pSrc->format),
- PICT_FORMAT_B(pSrc->format))))) ||
- (op == PictOpOver && pSrc->format == pDst->format &&
- !PICT_FORMAT_A(pSrc->format))))
- {
- if (!pSrc->repeat && xSrc >= 0 && ySrc >= 0 &&
- (xSrc + width <= pSrc->pDrawable->width) &&
- (ySrc + height <= pSrc->pDrawable->height))
- {
- Bool ret;
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst,
- yDst, width, height))
- goto done;
-
- ret = exaHWCopyNtoN(pSrc->pDrawable, pDst->pDrawable, NULL,
- RegionRects(&region), RegionNumRects(&region),
- xSrc - xDst, ySrc - yDst, FALSE, FALSE);
- RegionUninit(&region);
-
- /* Reset values to their original values. */
- xDst -= pDst->pDrawable->x;
- yDst -= pDst->pDrawable->y;
- xSrc -= pSrc->pDrawable->x;
- ySrc -= pSrc->pDrawable->y;
-
- if (!ret)
- goto fallback;
-
- goto done;
- }
-
- if (pSrc->repeat && pSrc->repeatType == RepeatNormal &&
- pSrc->pDrawable->type == DRAWABLE_PIXMAP)
- {
- DDXPointRec patOrg;
-
- /* Let's see if the driver can do the repeat in one go */
- if (pExaScr->info->PrepareComposite && !pSrc->alphaMap &&
- !pDst->alphaMap)
- {
- ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc,
- ySrc, xMask, yMask, xDst, yDst,
- width, height);
- if (ret == 1)
- goto done;
- }
-
- /* Now see if we can use exaFillRegionTiled() */
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst, xSrc,
- ySrc, xMask, yMask, xDst, yDst,
- width, height))
- goto done;
-
- /* pattern origin is the point in the destination drawable
- * corresponding to (0,0) in the source */
- patOrg.x = xDst - xSrc;
- patOrg.y = yDst - ySrc;
-
- ret = exaFillRegionTiled(pDst->pDrawable, &region,
- (PixmapPtr)pSrc->pDrawable,
- &patOrg, FB_ALLONES, GXcopy, CT_NONE);
-
- RegionUninit(&region);
-
- if (ret)
- goto done;
-
- /* Let's be correct and restore the variables to their original state. */
- xDst -= pDst->pDrawable->x;
- yDst -= pDst->pDrawable->y;
- xSrc -= pSrc->pDrawable->x;
- ySrc -= pSrc->pDrawable->y;
- }
- }
+ if (pSrc->pDrawable ?
+ (pSrc->pDrawable->width == 1 && pSrc->pDrawable->height == 1 &&
+ pSrc->repeat) :
+ (pSrc->pSourcePict->type == SourcePictTypeSolidFill)) {
+ ret = exaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst,
+ width, height);
+ if (ret == 1)
+ goto done;
+ }
+ else if (pSrc->pDrawable && !pSrc->transform &&
+ ((op == PictOpSrc &&
+ (pSrc->format == pDst->format ||
+ (PICT_FORMAT_COLOR(pDst->format) &&
+ PICT_FORMAT_COLOR(pSrc->format) &&
+ pDst->format == PICT_FORMAT(PICT_FORMAT_BPP(pSrc->format),
+ PICT_FORMAT_TYPE(pSrc->format),
+ 0,
+ PICT_FORMAT_R(pSrc->format),
+ PICT_FORMAT_G(pSrc->format),
+ PICT_FORMAT_B(pSrc->format)))))
+ || (op == PictOpOver && pSrc->format == pDst->format &&
+ !PICT_FORMAT_A(pSrc->format)))) {
+ if (!pSrc->repeat && xSrc >= 0 && ySrc >= 0 &&
+ (xSrc + width <= pSrc->pDrawable->width) &&
+ (ySrc + height <= pSrc->pDrawable->height)) {
+ Bool ret;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if (!miComputeCompositeRegion(&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst,
+ yDst, width, height))
+ goto done;
+
+ ret = exaHWCopyNtoN(pSrc->pDrawable, pDst->pDrawable, NULL,
+ RegionRects(&region),
+ RegionNumRects(&region), xSrc - xDst,
+ ySrc - yDst, FALSE, FALSE);
+ RegionUninit(&region);
+
+ /* Reset values to their original values. */
+ xDst -= pDst->pDrawable->x;
+ yDst -= pDst->pDrawable->y;
+ xSrc -= pSrc->pDrawable->x;
+ ySrc -= pSrc->pDrawable->y;
+
+ if (!ret)
+ goto fallback;
+
+ goto done;
+ }
+
+ if (pSrc->repeat && pSrc->repeatType == RepeatNormal &&
+ pSrc->pDrawable->type == DRAWABLE_PIXMAP) {
+ DDXPointRec patOrg;
+
+ /* Let's see if the driver can do the repeat in one go */
+ if (pExaScr->info->PrepareComposite && !pSrc->alphaMap &&
+ !pDst->alphaMap) {
+ ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc,
+ ySrc, xMask, yMask, xDst, yDst,
+ width, height);
+ if (ret == 1)
+ goto done;
+ }
+
+ /* Now see if we can use exaFillRegionTiled() */
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if (!miComputeCompositeRegion(&region, pSrc, pMask, pDst, xSrc,
+ ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ goto done;
+
+ /* pattern origin is the point in the destination drawable
+ * corresponding to (0,0) in the source */
+ patOrg.x = xDst - xSrc;
+ patOrg.y = yDst - ySrc;
+
+ ret = exaFillRegionTiled(pDst->pDrawable, &region,
+ (PixmapPtr) pSrc->pDrawable,
+ &patOrg, FB_ALLONES, GXcopy, CT_NONE);
+
+ RegionUninit(&region);
+
+ if (ret)
+ goto done;
+
+ /* Let's be correct and restore the variables to their original state. */
+ xDst -= pDst->pDrawable->x;
+ yDst -= pDst->pDrawable->y;
+ xSrc -= pSrc->pDrawable->x;
+ ySrc -= pSrc->pDrawable->y;
+ }
+ }
}
/* Remove repeat in mask if useless */
if (pMask && pMask->pDrawable && pMask->repeat && !pMask->transform &&
- xMask >= 0 && (xMask + width) <= pMask->pDrawable->width &&
- yMask >= 0 && (yMask + height) <= pMask->pDrawable->height)
- pMask->repeat = 0;
+ xMask >= 0 && (xMask + width) <= pMask->pDrawable->width &&
+ yMask >= 0 && (yMask + height) <= pMask->pDrawable->height)
+ pMask->repeat = 0;
if (pExaScr->info->PrepareComposite &&
- !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
- {
- Bool isSrcSolid;
-
- ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask,
- yMask, xDst, yDst, width, height);
- if (ret == 1)
- goto done;
-
- /* For generic masks and solid src pictures, mach64 can do Over in two
- * passes, similar to the component-alpha case.
- */
- isSrcSolid = pSrc->pDrawable ?
- (pSrc->pDrawable->width == 1 && pSrc->pDrawable->height == 1 &&
- pSrc->repeat) :
- (pSrc->pSourcePict->type == SourcePictTypeSolidFill);
-
- /* If we couldn't do the Composite in a single pass, and it was a
- * component-alpha Over, see if we can do it in two passes with
- * an OutReverse and then an Add.
- */
- if (ret == -1 && op == PictOpOver && pMask &&
- (pMask->componentAlpha || isSrcSolid)) {
- ret = exaTryMagicTwoPassCompositeHelper(op, pSrc, pMask, pDst,
- xSrc, ySrc,
- xMask, yMask, xDst, yDst,
- width, height);
- if (ret == 1)
- goto done;
- }
+ !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap) {
+ Bool isSrcSolid;
+
+ ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask,
+ yMask, xDst, yDst, width, height);
+ if (ret == 1)
+ goto done;
+
+ /* For generic masks and solid src pictures, mach64 can do Over in two
+ * passes, similar to the component-alpha case.
+ */
+ isSrcSolid = pSrc->pDrawable ?
+ (pSrc->pDrawable->width == 1 && pSrc->pDrawable->height == 1 &&
+ pSrc->repeat) :
+ (pSrc->pSourcePict->type == SourcePictTypeSolidFill);
+
+ /* If we couldn't do the Composite in a single pass, and it was a
+ * component-alpha Over, see if we can do it in two passes with
+ * an OutReverse and then an Add.
+ */
+ if (ret == -1 && op == PictOpOver && pMask &&
+ (pMask->componentAlpha || isSrcSolid)) {
+ ret = exaTryMagicTwoPassCompositeHelper(op, pSrc, pMask, pDst,
+ xSrc, ySrc,
+ xMask, yMask, xDst, yDst,
+ width, height);
+ if (ret == 1)
+ goto done;
+ }
}
-fallback:
+ fallback:
#if DEBUG_TRACE_FALL
- exaPrintCompositeFallback (op, pSrc, pMask, pDst);
+ exaPrintCompositeFallback(op, pSrc, pMask, pDst);
#endif
- ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc,
- xMask, yMask, xDst, yDst, width, height);
+ ExaCheckComposite(op, pSrc, pMask, pDst, xSrc, ySrc,
+ xMask, yMask, xDst, yDst, width, height);
-done:
+ done:
pSrc->repeat = saveSrcRepeat;
if (pMask)
- pMask->repeat = saveMaskRepeat;
+ pMask->repeat = saveMaskRepeat;
}
/**
@@ -1080,51 +1053,47 @@ done:
* See the comments about exaTrapezoids and exaTriangles.
*/
static PicturePtr
-exaCreateAlphaPicture (ScreenPtr pScreen,
- PicturePtr pDst,
- PictFormatPtr pPictFormat,
- CARD16 width,
- CARD16 height)
+exaCreateAlphaPicture(ScreenPtr pScreen,
+ PicturePtr pDst,
+ PictFormatPtr pPictFormat, CARD16 width, CARD16 height)
{
- PixmapPtr pPixmap;
- PicturePtr pPicture;
- GCPtr pGC;
- int error;
- xRectangle rect;
+ PixmapPtr pPixmap;
+ PicturePtr pPicture;
+ GCPtr pGC;
+ int error;
+ xRectangle rect;
if (width > 32767 || height > 32767)
- return 0;
-
- if (!pPictFormat)
- {
- if (pDst->polyEdge == PolyEdgeSharp)
- pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
- else
- pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
- if (!pPictFormat)
- return 0;
+ return 0;
+
+ if (!pPictFormat) {
+ if (pDst->polyEdge == PolyEdgeSharp)
+ pPictFormat = PictureMatchFormat(pScreen, 1, PICT_a1);
+ else
+ pPictFormat = PictureMatchFormat(pScreen, 8, PICT_a8);
+ if (!pPictFormat)
+ return 0;
}
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
- pPictFormat->depth, 0);
+ pPictFormat->depth, 0);
if (!pPixmap)
- return 0;
- pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
- if (!pGC)
- {
- (*pScreen->DestroyPixmap) (pPixmap);
- return 0;
+ return 0;
+ pGC = GetScratchGC(pPixmap->drawable.depth, pScreen);
+ if (!pGC) {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return 0;
}
- ValidateGC (&pPixmap->drawable, pGC);
+ ValidateGC(&pPixmap->drawable, pGC);
rect.x = 0;
rect.y = 0;
rect.width = width;
rect.height = height;
- ExaCheckPolyFillRect (&pPixmap->drawable, pGC, 1, &rect);
- exaPixmapDirty (pPixmap, 0, 0, width, height);
- FreeScratchGC (pGC);
- pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
- 0, 0, serverClient, &error);
+ ExaCheckPolyFillRect(&pPixmap->drawable, pGC, 1, &rect);
+ exaPixmapDirty(pPixmap, 0, 0, width, height);
+ FreeScratchGC(pGC);
+ pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat,
+ 0, 0, serverClient, &error);
(*pScreen->DestroyPixmap) (pPixmap);
return pPicture;
}
@@ -1143,53 +1112,52 @@ exaCreateAlphaPicture (ScreenPtr pScreen,
* to initialize the contents.
*/
void
-exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int ntrap, xTrapezoid *traps)
+exaTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
+ int ntrap, xTrapezoid * traps)
{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- BoxRec bounds;
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ BoxRec bounds;
if (maskFormat) {
- PicturePtr pPicture;
- INT16 xDst, yDst;
- INT16 xRel, yRel;
-
- miTrapezoidBounds (ntrap, traps, &bounds);
-
- if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
- return;
-
- xDst = traps[0].left.p1.x >> 16;
- yDst = traps[0].left.p1.y >> 16;
-
- pPicture = exaCreateAlphaPicture (pScreen, pDst, maskFormat,
- bounds.x2 - bounds.x1,
- bounds.y2 - bounds.y1);
- if (!pPicture)
- return;
-
- exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
- for (; ntrap; ntrap--, traps++)
- (*ps->RasterizeTrapezoid) (pPicture, traps,
- -bounds.x1, -bounds.y1);
- exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
-
- xRel = bounds.x1 + xSrc - xDst;
- yRel = bounds.y1 + ySrc - yDst;
- CompositePicture (op, pSrc, pPicture, pDst,
- xRel, yRel, 0, 0, bounds.x1, bounds.y1,
- bounds.x2 - bounds.x1,
- bounds.y2 - bounds.y1);
- FreePicture (pPicture, 0);
- } else {
- if (pDst->polyEdge == PolyEdgeSharp)
- maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
- else
- maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
- for (; ntrap; ntrap--, traps++)
- exaTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
+ PicturePtr pPicture;
+ INT16 xDst, yDst;
+ INT16 xRel, yRel;
+
+ miTrapezoidBounds(ntrap, traps, &bounds);
+
+ if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
+ return;
+
+ xDst = traps[0].left.p1.x >> 16;
+ yDst = traps[0].left.p1.y >> 16;
+
+ pPicture = exaCreateAlphaPicture(pScreen, pDst, maskFormat,
+ bounds.x2 - bounds.x1,
+ bounds.y2 - bounds.y1);
+ if (!pPicture)
+ return;
+
+ exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
+ for (; ntrap; ntrap--, traps++)
+ (*ps->RasterizeTrapezoid) (pPicture, traps, -bounds.x1, -bounds.y1);
+ exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
+
+ xRel = bounds.x1 + xSrc - xDst;
+ yRel = bounds.y1 + ySrc - yDst;
+ CompositePicture(op, pSrc, pPicture, pDst,
+ xRel, yRel, 0, 0, bounds.x1, bounds.y1,
+ bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
+ FreePicture(pPicture, 0);
+ }
+ else {
+ if (pDst->polyEdge == PolyEdgeSharp)
+ maskFormat = PictureMatchFormat(pScreen, 1, PICT_a1);
+ else
+ maskFormat = PictureMatchFormat(pScreen, 8, PICT_a8);
+ for (; ntrap; ntrap--, traps++)
+ exaTrapezoids(op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
}
}
@@ -1207,50 +1175,51 @@ exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
* to initialize the contents.
*/
void
-exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int ntri, xTriangle *tris)
+exaTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
+ int ntri, xTriangle * tris)
{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- BoxRec bounds;
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ BoxRec bounds;
if (maskFormat) {
- PicturePtr pPicture;
- INT16 xDst, yDst;
- INT16 xRel, yRel;
-
- miTriangleBounds (ntri, tris, &bounds);
-
- if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
- return;
-
- xDst = tris[0].p1.x >> 16;
- yDst = tris[0].p1.y >> 16;
-
- pPicture = exaCreateAlphaPicture (pScreen, pDst, maskFormat,
- bounds.x2 - bounds.x1,
- bounds.y2 - bounds.y1);
- if (!pPicture)
- return;
-
- exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
- (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
- exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
-
- xRel = bounds.x1 + xSrc - xDst;
- yRel = bounds.y1 + ySrc - yDst;
- CompositePicture (op, pSrc, pPicture, pDst,
- xRel, yRel, 0, 0, bounds.x1, bounds.y1,
- bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
- FreePicture (pPicture, 0);
- } else {
- if (pDst->polyEdge == PolyEdgeSharp)
- maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
- else
- maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
-
- for (; ntri; ntri--, tris++)
- exaTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
+ PicturePtr pPicture;
+ INT16 xDst, yDst;
+ INT16 xRel, yRel;
+
+ miTriangleBounds(ntri, tris, &bounds);
+
+ if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
+ return;
+
+ xDst = tris[0].p1.x >> 16;
+ yDst = tris[0].p1.y >> 16;
+
+ pPicture = exaCreateAlphaPicture(pScreen, pDst, maskFormat,
+ bounds.x2 - bounds.x1,
+ bounds.y2 - bounds.y1);
+ if (!pPicture)
+ return;
+
+ exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
+ (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
+ exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
+
+ xRel = bounds.x1 + xSrc - xDst;
+ yRel = bounds.y1 + ySrc - yDst;
+ CompositePicture(op, pSrc, pPicture, pDst,
+ xRel, yRel, 0, 0, bounds.x1, bounds.y1,
+ bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
+ FreePicture(pPicture, 0);
+ }
+ else {
+ if (pDst->polyEdge == PolyEdgeSharp)
+ maskFormat = PictureMatchFormat(pScreen, 1, PICT_a1);
+ else
+ maskFormat = PictureMatchFormat(pScreen, 8, PICT_a8);
+
+ for (; ntri; ntri--, tris++)
+ exaTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
}
}
diff --git a/xorg-server/exa/exa_unaccel.c b/xorg-server/exa/exa_unaccel.c
index 492a352c6..fc0f6c42e 100644
--- a/xorg-server/exa/exa_unaccel.c
+++ b/xorg-server/exa/exa_unaccel.c
@@ -45,7 +45,7 @@ exaPrepareAccessGC(GCPtr pGC)
if (pGC->stipple)
exaPrepareAccess(&pGC->stipple->drawable, EXA_PREPARE_MASK);
if (pGC->fillStyle == FillTiled)
- exaPrepareAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_SRC);
+ exaPrepareAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_SRC);
}
/**
@@ -55,7 +55,7 @@ void
exaFinishAccessGC(GCPtr pGC)
{
if (pGC->fillStyle == FillTiled)
- exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_SRC);
+ exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_SRC);
if (pGC->stipple)
exaFinishAccess(&pGC->stipple->drawable, EXA_PREPARE_MASK);
}
@@ -66,304 +66,303 @@ exaDrawableLocation(DrawablePtr pDrawable)
{
return exaDrawableIsOffscreen(pDrawable) ? 's' : 'm';
}
-#endif /* DEBUG_TRACE_FALL */
+#endif /* DEBUG_TRACE_FALL */
void
-ExaCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
- DDXPointPtr ppt, int *pwidth, int fSorted)
+ExaCheckFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nspans,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
{
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
- exaPrepareAccessGC (pGC);
- pGC->ops->FillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
- exaFinishAccessGC (pGC);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccessGC(pGC);
+ pGC->ops->FillSpans(pDrawable, pGC, nspans, ppt, pwidth, fSorted);
+ exaFinishAccessGC(pGC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
void
-ExaCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
- DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
+ExaCheckSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
- pGC->ops->SetSpans (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+ pGC->ops->SetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
void
-ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
- int x, int y, int w, int h, int leftPad, int format,
- char *bits)
+ExaCheckPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ char *bits)
{
PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
+
ExaPixmapPriv(pPixmap);
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
if (!pExaScr->prepare_access_reg || !pExaPixmap->pDamage ||
- exaGCReadsDestination(pDrawable, pGC->planemask, pGC->fillStyle,
- pGC->alu, pGC->clientClipType))
- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
+ exaGCReadsDestination(pDrawable, pGC->planemask, pGC->fillStyle,
+ pGC->alu, pGC->clientClipType))
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
else
- pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST,
- DamagePendingRegion(pExaPixmap->pDamage));
- pGC->ops->PutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST,
+ DamagePendingRegion(pExaPixmap->pDamage));
+ pGC->ops->PutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format,
+ bits);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
void
-ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- BoxPtr pbox, int nbox, int dx, int dy, Bool reverse,
- Bool upsidedown, Pixel bitplane, void *closure)
+ExaCheckCopyNtoN(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ BoxPtr pbox, int nbox, int dx, int dy, Bool reverse,
+ Bool upsidedown, Pixel bitplane, void *closure)
{
RegionRec reg;
int xoff, yoff;
+
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrc, pDst,
- exaDrawableLocation(pSrc), exaDrawableLocation(pDst)));
+ exaDrawableLocation(pSrc), exaDrawableLocation(pDst)));
if (pExaScr->prepare_access_reg && RegionInitBoxes(&reg, pbox, nbox)) {
- PixmapPtr pPixmap = exaGetDrawablePixmap(pSrc);
+ PixmapPtr pPixmap = exaGetDrawablePixmap(pSrc);
- exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff);
- RegionTranslate(&reg, xoff + dx, yoff + dy);
- pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, &reg);
- RegionUninit(&reg);
- } else
- exaPrepareAccess (pSrc, EXA_PREPARE_SRC);
+ exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff);
+ RegionTranslate(&reg, xoff + dx, yoff + dy);
+ pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, &reg);
+ RegionUninit(&reg);
+ }
+ else
+ exaPrepareAccess(pSrc, EXA_PREPARE_SRC);
if (pExaScr->prepare_access_reg &&
- !exaGCReadsDestination(pDst, pGC->planemask, pGC->fillStyle,
- pGC->alu, pGC->clientClipType) &&
- RegionInitBoxes (&reg, pbox, nbox)) {
- PixmapPtr pPixmap = exaGetDrawablePixmap(pDst);
-
- exaGetDrawableDeltas(pDst, pPixmap, &xoff, &yoff);
- RegionTranslate(&reg, xoff, yoff);
- pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST, &reg);
- RegionUninit(&reg);
- } else
- exaPrepareAccess (pDst, EXA_PREPARE_DEST);
+ !exaGCReadsDestination(pDst, pGC->planemask, pGC->fillStyle,
+ pGC->alu, pGC->clientClipType) &&
+ RegionInitBoxes(&reg, pbox, nbox)) {
+ PixmapPtr pPixmap = exaGetDrawablePixmap(pDst);
+
+ exaGetDrawableDeltas(pDst, pPixmap, &xoff, &yoff);
+ RegionTranslate(&reg, xoff, yoff);
+ pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST, &reg);
+ RegionUninit(&reg);
+ }
+ else
+ exaPrepareAccess(pDst, EXA_PREPARE_DEST);
/* This will eventually call fbCopyNtoN, with some calculation overhead. */
while (nbox--) {
- pGC->ops->CopyArea (pSrc, pDst, pGC, pbox->x1 - pSrc->x + dx, pbox->y1 - pSrc->y + dy,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, pbox->x1 - pDst->x, pbox->y1 - pDst->y);
- pbox++;
+ pGC->ops->CopyArea(pSrc, pDst, pGC, pbox->x1 - pSrc->x + dx,
+ pbox->y1 - pSrc->y + dy, pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1, pbox->x1 - pDst->x,
+ pbox->y1 - pDst->y);
+ pbox++;
}
- exaFinishAccess (pSrc, EXA_PREPARE_SRC);
- exaFinishAccess (pDst, EXA_PREPARE_DEST);
+ exaFinishAccess(pSrc, EXA_PREPARE_SRC);
+ exaFinishAccess(pDst, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
static void
ExaFallbackPrepareReg(DrawablePtr pDrawable,
- GCPtr pGC,
- int x, int y, int width, int height,
- int index, Bool checkReads)
+ GCPtr pGC,
+ int x, int y, int width, int height,
+ int index, Bool checkReads)
{
ScreenPtr pScreen = pDrawable->pScreen;
+
ExaScreenPriv(pScreen);
if (pExaScr->prepare_access_reg &&
- !(checkReads && exaGCReadsDestination(pDrawable,
- pGC->planemask,
- pGC->fillStyle,
- pGC->alu,
- pGC->clientClipType))) {
- BoxRec box;
- RegionRec reg;
- int xoff, yoff;
- PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
-
- exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
- box.x1 = pDrawable->x + x + xoff;
- box.y1 = pDrawable->y + y + yoff;
- box.x2 = box.x1 + width;
- box.y2 = box.y1 + height;
-
- RegionInit(&reg, &box, 1);
- pExaScr->prepare_access_reg(pPixmap, index, &reg);
- RegionUninit(&reg);
- } else
- exaPrepareAccess(pDrawable, index);
+ !(checkReads && exaGCReadsDestination(pDrawable,
+ pGC->planemask,
+ pGC->fillStyle,
+ pGC->alu, pGC->clientClipType))) {
+ BoxRec box;
+ RegionRec reg;
+ int xoff, yoff;
+ PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
+
+ exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
+ box.x1 = pDrawable->x + x + xoff;
+ box.y1 = pDrawable->y + y + yoff;
+ box.x2 = box.x1 + width;
+ box.y2 = box.y1 + height;
+
+ RegionInit(&reg, &box, 1);
+ pExaScr->prepare_access_reg(pPixmap, index, &reg);
+ RegionUninit(&reg);
+ }
+ else
+ exaPrepareAccess(pDrawable, index);
}
-
RegionPtr
-ExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty)
+ExaCheckCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
{
RegionPtr ret;
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrc, pDst,
- exaDrawableLocation(pSrc), exaDrawableLocation(pDst)));
- ExaFallbackPrepareReg(pSrc, pGC, srcx, srcy, w, h,
- EXA_PREPARE_SRC, FALSE);
- ExaFallbackPrepareReg(pDst, pGC, dstx, dsty, w, h,
- EXA_PREPARE_DEST, TRUE);
- ret = pGC->ops->CopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
- exaFinishAccess (pSrc, EXA_PREPARE_SRC);
- exaFinishAccess (pDst, EXA_PREPARE_DEST);
+ exaDrawableLocation(pSrc), exaDrawableLocation(pDst)));
+ ExaFallbackPrepareReg(pSrc, pGC, srcx, srcy, w, h, EXA_PREPARE_SRC, FALSE);
+ ExaFallbackPrepareReg(pDst, pGC, dstx, dsty, w, h, EXA_PREPARE_DEST, TRUE);
+ ret = pGC->ops->CopyArea(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
+ exaFinishAccess(pSrc, EXA_PREPARE_SRC);
+ exaFinishAccess(pDst, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
return ret;
}
RegionPtr
-ExaCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty,
- unsigned long bitPlane)
+ExaCheckCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty,
+ unsigned long bitPlane)
{
RegionPtr ret;
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrc, pDst,
- exaDrawableLocation(pSrc), exaDrawableLocation(pDst)));
- ExaFallbackPrepareReg(pSrc, pGC, srcx, srcy, w, h,
- EXA_PREPARE_SRC, FALSE);
- ExaFallbackPrepareReg(pDst, pGC, dstx, dsty, w, h,
- EXA_PREPARE_DEST, TRUE);
- ret = pGC->ops->CopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty,
- bitPlane);
- exaFinishAccess (pSrc, EXA_PREPARE_SRC);
- exaFinishAccess (pDst, EXA_PREPARE_DEST);
+ exaDrawableLocation(pSrc), exaDrawableLocation(pDst)));
+ ExaFallbackPrepareReg(pSrc, pGC, srcx, srcy, w, h, EXA_PREPARE_SRC, FALSE);
+ ExaFallbackPrepareReg(pDst, pGC, dstx, dsty, w, h, EXA_PREPARE_DEST, TRUE);
+ ret = pGC->ops->CopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty,
+ bitPlane);
+ exaFinishAccess(pSrc, EXA_PREPARE_SRC);
+ exaFinishAccess(pDst, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
return ret;
}
void
-ExaCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
- DDXPointPtr pptInit)
+ExaCheckPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
+ DDXPointPtr pptInit)
{
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
- pGC->ops->PolyPoint (pDrawable, pGC, mode, npt, pptInit);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+ pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, pptInit);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
void
-ExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr ppt)
+ExaCheckPolylines(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr ppt)
{
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("to %p (%c), width %d, mode %d, count %d\n",
- pDrawable, exaDrawableLocation(pDrawable),
- pGC->lineWidth, mode, npt));
-
- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
- exaPrepareAccessGC (pGC);
- pGC->ops->Polylines (pDrawable, pGC, mode, npt, ppt);
- exaFinishAccessGC (pGC);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ pDrawable, exaDrawableLocation(pDrawable),
+ pGC->lineWidth, mode, npt));
+
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccessGC(pGC);
+ pGC->ops->Polylines(pDrawable, pGC, mode, npt, ppt);
+ exaFinishAccessGC(pGC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
void
-ExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
- int nsegInit, xSegment *pSegInit)
+ExaCheckPolySegment(DrawablePtr pDrawable, GCPtr pGC,
+ int nsegInit, xSegment * pSegInit)
{
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("to %p (%c) width %d, count %d\n", pDrawable,
- exaDrawableLocation(pDrawable), pGC->lineWidth, nsegInit));
+ exaDrawableLocation(pDrawable), pGC->lineWidth, nsegInit));
- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
- exaPrepareAccessGC (pGC);
- pGC->ops->PolySegment (pDrawable, pGC, nsegInit, pSegInit);
- exaFinishAccessGC (pGC);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccessGC(pGC);
+ pGC->ops->PolySegment(pDrawable, pGC, nsegInit, pSegInit);
+ exaFinishAccessGC(pGC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
void
-ExaCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *pArcs)
+ExaCheckPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * pArcs)
{
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
- exaPrepareAccessGC (pGC);
- pGC->ops->PolyArc (pDrawable, pGC, narcs, pArcs);
- exaFinishAccessGC (pGC);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccessGC(pGC);
+ pGC->ops->PolyArc(pDrawable, pGC, narcs, pArcs);
+ exaFinishAccessGC(pGC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
void
-ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
- int nrect, xRectangle *prect)
+ExaCheckPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
+ int nrect, xRectangle *prect)
{
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
- exaPrepareAccessGC (pGC);
- pGC->ops->PolyFillRect (pDrawable, pGC, nrect, prect);
- exaFinishAccessGC (pGC);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccessGC(pGC);
+ pGC->ops->PolyFillRect(pDrawable, pGC, nrect, prect);
+ exaFinishAccessGC(pGC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
void
-ExaCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
+ExaCheckImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
{
EXA_PRE_FALLBACK_GC(pGC);
- EXA_FALLBACK(("to %p (%c)\n", pDrawable,
- exaDrawableLocation(pDrawable)));
- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
- exaPrepareAccessGC (pGC);
- pGC->ops->ImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
- exaFinishAccessGC (pGC);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccessGC(pGC);
+ pGC->ops->ImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ exaFinishAccessGC(pGC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
void
-ExaCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
+ExaCheckPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
{
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("to %p (%c), style %d alu %d\n", pDrawable,
- exaDrawableLocation(pDrawable), pGC->fillStyle, pGC->alu));
- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
- exaPrepareAccessGC (pGC);
- pGC->ops->PolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
- exaFinishAccessGC (pGC);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ exaDrawableLocation(pDrawable), pGC->fillStyle, pGC->alu));
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+ exaPrepareAccessGC(pGC);
+ pGC->ops->PolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ exaFinishAccessGC(pGC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
void
-ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w, int h, int x, int y)
+ExaCheckPushPixels(GCPtr pGC, PixmapPtr pBitmap,
+ DrawablePtr pDrawable, int w, int h, int x, int y)
{
EXA_PRE_FALLBACK_GC(pGC);
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pBitmap, pDrawable,
- exaDrawableLocation(&pBitmap->drawable),
- exaDrawableLocation(pDrawable)));
- ExaFallbackPrepareReg(pDrawable, pGC, x, y, w, h,
- EXA_PREPARE_DEST, TRUE);
+ exaDrawableLocation(&pBitmap->drawable),
+ exaDrawableLocation(pDrawable)));
+ ExaFallbackPrepareReg(pDrawable, pGC, x, y, w, h, EXA_PREPARE_DEST, TRUE);
ExaFallbackPrepareReg(&pBitmap->drawable, pGC, 0, 0, w, h,
- EXA_PREPARE_SRC, FALSE);
- exaPrepareAccessGC (pGC);
- pGC->ops->PushPixels (pGC, pBitmap, pDrawable, w, h, x, y);
- exaFinishAccessGC (pGC);
- exaFinishAccess (&pBitmap->drawable, EXA_PREPARE_SRC);
- exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
+ EXA_PREPARE_SRC, FALSE);
+ exaPrepareAccessGC(pGC);
+ pGC->ops->PushPixels(pGC, pBitmap, pDrawable, w, h, x, y);
+ exaFinishAccessGC(pGC);
+ exaFinishAccess(&pBitmap->drawable, EXA_PREPARE_SRC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK_GC(pGC);
}
@@ -372,77 +371,72 @@ ExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
DrawablePtr pDrawable = &pWin->drawable;
ScreenPtr pScreen = pDrawable->pScreen;
+
EXA_PRE_FALLBACK(pScreen);
EXA_FALLBACK(("from %p\n", pWin));
/* Only need the source bits, the destination region will be overwritten */
if (pExaScr->prepare_access_reg) {
- PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin);
- int xoff, yoff;
+ PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin);
+ int xoff, yoff;
- exaGetDrawableDeltas(&pWin->drawable, pPixmap, &xoff, &yoff);
- RegionTranslate(prgnSrc, xoff, yoff);
- pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, prgnSrc);
- RegionTranslate(prgnSrc, -xoff, -yoff);
- } else
- exaPrepareAccess(pDrawable, EXA_PREPARE_SRC);
+ exaGetDrawableDeltas(&pWin->drawable, pPixmap, &xoff, &yoff);
+ RegionTranslate(prgnSrc, xoff, yoff);
+ pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, prgnSrc);
+ RegionTranslate(prgnSrc, -xoff, -yoff);
+ }
+ else
+ exaPrepareAccess(pDrawable, EXA_PREPARE_SRC);
swap(pExaScr, pScreen, CopyWindow);
- pScreen->CopyWindow (pWin, ptOldOrg, prgnSrc);
+ pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc);
swap(pExaScr, pScreen, CopyWindow);
- exaFinishAccess (pDrawable, EXA_PREPARE_SRC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_SRC);
EXA_POST_FALLBACK(pScreen);
}
void
ExaCheckGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask, char *d)
+ unsigned int format, unsigned long planeMask, char *d)
{
ScreenPtr pScreen = pDrawable->pScreen;
+
EXA_PRE_FALLBACK(pScreen);
- EXA_FALLBACK(("from %p (%c)\n", pDrawable,
- exaDrawableLocation(pDrawable)));
+ EXA_FALLBACK(("from %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
- ExaFallbackPrepareReg(pDrawable, NULL, x, y, w, h,
- EXA_PREPARE_SRC, FALSE);
+ ExaFallbackPrepareReg(pDrawable, NULL, x, y, w, h, EXA_PREPARE_SRC, FALSE);
swap(pExaScr, pScreen, GetImage);
- pScreen->GetImage (pDrawable, x, y, w, h, format, planeMask, d);
+ pScreen->GetImage(pDrawable, x, y, w, h, format, planeMask, d);
swap(pExaScr, pScreen, GetImage);
- exaFinishAccess (pDrawable, EXA_PREPARE_SRC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_SRC);
EXA_POST_FALLBACK(pScreen);
}
void
-ExaCheckGetSpans (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pdstStart)
+ExaCheckGetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)
{
ScreenPtr pScreen = pDrawable->pScreen;
EXA_PRE_FALLBACK(pScreen);
EXA_FALLBACK(("from %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
- exaPrepareAccess (pDrawable, EXA_PREPARE_SRC);
+ exaPrepareAccess(pDrawable, EXA_PREPARE_SRC);
swap(pExaScr, pScreen, GetSpans);
- pScreen->GetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ pScreen->GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
swap(pExaScr, pScreen, GetSpans);
- exaFinishAccess (pDrawable, EXA_PREPARE_SRC);
+ exaFinishAccess(pDrawable, EXA_PREPARE_SRC);
EXA_POST_FALLBACK(pScreen);
}
static void
ExaSrcValidate(DrawablePtr pDrawable,
- int x,
- int y,
- int width,
- int height,
- unsigned int subWindowMode)
+ int x, int y, int width, int height, unsigned int subWindowMode)
{
ScreenPtr pScreen = pDrawable->pScreen;
+
ExaScreenPriv(pScreen);
- PixmapPtr pPix = exaGetDrawablePixmap (pDrawable);
+ PixmapPtr pPix = exaGetDrawablePixmap(pDrawable);
BoxRec box;
RegionRec reg;
RegionPtr dst;
@@ -455,8 +449,7 @@ ExaSrcValidate(DrawablePtr pDrawable,
box.x2 = box.x1 + width;
box.y2 = box.y1 + height;
- dst = (pExaScr->srcPix == pPix) ? &pExaScr->srcReg :
- &pExaScr->maskReg;
+ dst = (pExaScr->srcPix == pPix) ? &pExaScr->srcReg : &pExaScr->maskReg;
RegionInit(&reg, &box, 1);
RegionUnion(dst, dst, &reg);
@@ -470,19 +463,16 @@ ExaSrcValidate(DrawablePtr pDrawable,
}
static Bool
-ExaPrepareCompositeReg(ScreenPtr pScreen,
- CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+ExaPrepareCompositeReg(ScreenPtr pScreen,
+ CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
RegionRec region;
RegionPtr dstReg = NULL;
@@ -491,65 +481,57 @@ ExaPrepareCompositeReg(ScreenPtr pScreen,
PixmapPtr pSrcPix = NULL;
PixmapPtr pMaskPix = NULL;
PixmapPtr pDstPix;
+
ExaScreenPriv(pScreen);
Bool ret;
-
RegionNull(&region);
if (pSrc->pDrawable) {
- pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
- RegionNull(&pExaScr->srcReg);
- srcReg = &pExaScr->srcReg;
- pExaScr->srcPix = pSrcPix;
- if (pSrc != pDst)
- RegionTranslate(pSrc->pCompositeClip,
- -pSrc->pDrawable->x,
- -pSrc->pDrawable->y);
+ pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
+ RegionNull(&pExaScr->srcReg);
+ srcReg = &pExaScr->srcReg;
+ pExaScr->srcPix = pSrcPix;
+ if (pSrc != pDst)
+ RegionTranslate(pSrc->pCompositeClip,
+ -pSrc->pDrawable->x, -pSrc->pDrawable->y);
}
if (pMask && pMask->pDrawable) {
- pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
- RegionNull(&pExaScr->maskReg);
- maskReg = &pExaScr->maskReg;
- if (pMask != pDst && pMask != pSrc)
- RegionTranslate(pMask->pCompositeClip,
- -pMask->pDrawable->x,
- -pMask->pDrawable->y);
+ pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
+ RegionNull(&pExaScr->maskReg);
+ maskReg = &pExaScr->maskReg;
+ if (pMask != pDst && pMask != pSrc)
+ RegionTranslate(pMask->pCompositeClip,
+ -pMask->pDrawable->x, -pMask->pDrawable->y);
}
RegionTranslate(pDst->pCompositeClip,
- -pDst->pDrawable->x,
- -pDst->pDrawable->y);
+ -pDst->pDrawable->x, -pDst->pDrawable->y);
pExaScr->SavedSourceValidate = ExaSrcValidate;
swap(pExaScr, pScreen, SourceValidate);
- ret = miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask,
- xDst,
- yDst,
- width, height);
+ ret = miComputeCompositeRegion(&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask,
+ xDst, yDst, width, height);
swap(pExaScr, pScreen, SourceValidate);
RegionTranslate(pDst->pCompositeClip,
- pDst->pDrawable->x,
- pDst->pDrawable->y);
+ pDst->pDrawable->x, pDst->pDrawable->y);
if (pSrc->pDrawable && pSrc != pDst)
- RegionTranslate(pSrc->pCompositeClip,
- pSrc->pDrawable->x,
- pSrc->pDrawable->y);
+ RegionTranslate(pSrc->pCompositeClip,
+ pSrc->pDrawable->x, pSrc->pDrawable->y);
if (pMask && pMask->pDrawable && pMask != pDst && pMask != pSrc)
- RegionTranslate(pMask->pCompositeClip,
- pMask->pDrawable->x,
- pMask->pDrawable->y);
+ RegionTranslate(pMask->pCompositeClip,
+ pMask->pDrawable->x, pMask->pDrawable->y);
if (!ret) {
- if (srcReg)
- RegionUninit(srcReg);
- if (maskReg)
- RegionUninit(maskReg);
+ if (srcReg)
+ RegionUninit(srcReg);
+ if (maskReg)
+ RegionUninit(maskReg);
- return FALSE;
+ return FALSE;
}
/**
@@ -558,44 +540,40 @@ ExaPrepareCompositeReg(ScreenPtr pScreen,
*/
if (pSrc->alphaMap && pSrc->alphaMap->pDrawable)
- pExaScr->prepare_access_reg(exaGetDrawablePixmap(pSrc->alphaMap->pDrawable),
- EXA_PREPARE_AUX_SRC,
- NULL);
+ pExaScr->
+ prepare_access_reg(exaGetDrawablePixmap(pSrc->alphaMap->pDrawable),
+ EXA_PREPARE_AUX_SRC, NULL);
if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable)
- pExaScr->prepare_access_reg(exaGetDrawablePixmap(pMask->alphaMap->pDrawable),
- EXA_PREPARE_AUX_MASK,
- NULL);
+ pExaScr->
+ prepare_access_reg(exaGetDrawablePixmap(pMask->alphaMap->pDrawable),
+ EXA_PREPARE_AUX_MASK, NULL);
if (pSrcPix)
- pExaScr->prepare_access_reg(pSrcPix,
- EXA_PREPARE_SRC,
- srcReg);
+ pExaScr->prepare_access_reg(pSrcPix, EXA_PREPARE_SRC, srcReg);
if (pMaskPix)
- pExaScr->prepare_access_reg(pMaskPix,
- EXA_PREPARE_MASK,
- maskReg);
+ pExaScr->prepare_access_reg(pMaskPix, EXA_PREPARE_MASK, maskReg);
if (srcReg)
- RegionUninit(srcReg);
+ RegionUninit(srcReg);
if (maskReg)
- RegionUninit(maskReg);
+ RegionUninit(maskReg);
pDstPix = exaGetDrawablePixmap(pDst->pDrawable);
if (!exaOpReadsDestination(op)) {
- int xoff;
- int yoff;
+ int xoff;
+ int yoff;
- exaGetDrawableDeltas (pDst->pDrawable, pDstPix, &xoff, &yoff);
- RegionTranslate(&region, pDst->pDrawable->x + xoff,
- pDst->pDrawable->y + yoff);
- dstReg = &region;
+ exaGetDrawableDeltas(pDst->pDrawable, pDstPix, &xoff, &yoff);
+ RegionTranslate(&region, pDst->pDrawable->x + xoff,
+ pDst->pDrawable->y + yoff);
+ dstReg = &region;
}
if (pDst->alphaMap && pDst->alphaMap->pDrawable)
- pExaScr->prepare_access_reg(exaGetDrawablePixmap(pDst->alphaMap->pDrawable),
- EXA_PREPARE_AUX_DEST,
- dstReg);
+ pExaScr->
+ prepare_access_reg(exaGetDrawablePixmap(pDst->alphaMap->pDrawable),
+ EXA_PREPARE_AUX_DEST, dstReg);
pExaScr->prepare_access_reg(pDstPix, EXA_PREPARE_DEST, dstReg);
RegionUninit(&region);
@@ -603,80 +581,70 @@ ExaPrepareCompositeReg(ScreenPtr pScreen,
}
void
-ExaCheckComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+ExaCheckComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
EXA_PRE_FALLBACK(pScreen);
if (pExaScr->prepare_access_reg) {
- if (!ExaPrepareCompositeReg(pScreen, op, pSrc, pMask, pDst, xSrc,
- ySrc, xMask, yMask, xDst, yDst, width,
- height))
- goto out_no_clip;
- } else {
-
- /* We need to prepare access to any separate alpha maps first,
- * in case the driver doesn't support EXA_PREPARE_AUX*,
- * in which case EXA_PREPARE_SRC may be used for moving them out.
- */
-
- if (pSrc->alphaMap && pSrc->alphaMap->pDrawable)
- exaPrepareAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX_SRC);
- if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable)
- exaPrepareAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX_MASK);
- if (pDst->alphaMap && pDst->alphaMap->pDrawable)
- exaPrepareAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX_DEST);
-
- exaPrepareAccess (pDst->pDrawable, EXA_PREPARE_DEST);
-
- EXA_FALLBACK(("from picts %p/%p to pict %p\n",
- pSrc, pMask, pDst));
-
- if (pSrc->pDrawable != NULL)
- exaPrepareAccess (pSrc->pDrawable, EXA_PREPARE_SRC);
- if (pMask && pMask->pDrawable != NULL)
- exaPrepareAccess (pMask->pDrawable, EXA_PREPARE_MASK);
+ if (!ExaPrepareCompositeReg(pScreen, op, pSrc, pMask, pDst, xSrc,
+ ySrc, xMask, yMask, xDst, yDst, width,
+ height))
+ goto out_no_clip;
+ }
+ else {
+
+ /* We need to prepare access to any separate alpha maps first,
+ * in case the driver doesn't support EXA_PREPARE_AUX*,
+ * in which case EXA_PREPARE_SRC may be used for moving them out.
+ */
+
+ if (pSrc->alphaMap && pSrc->alphaMap->pDrawable)
+ exaPrepareAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX_SRC);
+ if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable)
+ exaPrepareAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX_MASK);
+ if (pDst->alphaMap && pDst->alphaMap->pDrawable)
+ exaPrepareAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX_DEST);
+
+ exaPrepareAccess(pDst->pDrawable, EXA_PREPARE_DEST);
+
+ EXA_FALLBACK(("from picts %p/%p to pict %p\n", pSrc, pMask, pDst));
+
+ if (pSrc->pDrawable != NULL)
+ exaPrepareAccess(pSrc->pDrawable, EXA_PREPARE_SRC);
+ if (pMask && pMask->pDrawable != NULL)
+ exaPrepareAccess(pMask->pDrawable, EXA_PREPARE_MASK);
}
swap(pExaScr, ps, Composite);
- ps->Composite (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
+ ps->Composite(op,
+ pSrc,
+ pMask,
+ pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
swap(pExaScr, ps, Composite);
if (pMask && pMask->pDrawable != NULL)
- exaFinishAccess (pMask->pDrawable, EXA_PREPARE_MASK);
+ exaFinishAccess(pMask->pDrawable, EXA_PREPARE_MASK);
if (pSrc->pDrawable != NULL)
- exaFinishAccess (pSrc->pDrawable, EXA_PREPARE_SRC);
- exaFinishAccess (pDst->pDrawable, EXA_PREPARE_DEST);
+ exaFinishAccess(pSrc->pDrawable, EXA_PREPARE_SRC);
+ exaFinishAccess(pDst->pDrawable, EXA_PREPARE_DEST);
if (pDst->alphaMap && pDst->alphaMap->pDrawable)
- exaFinishAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX_DEST);
+ exaFinishAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX_DEST);
if (pSrc->alphaMap && pSrc->alphaMap->pDrawable)
- exaFinishAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX_SRC);
+ exaFinishAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX_SRC);
if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable)
- exaFinishAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX_MASK);
+ exaFinishAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX_MASK);
-out_no_clip:
+ out_no_clip:
EXA_POST_FALLBACK(pScreen);
}
@@ -684,17 +652,15 @@ out_no_clip:
* Avoid migration ping-pong when using a mask.
*/
void
-ExaCheckGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
+ExaCheckGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
+
EXA_PRE_FALLBACK(pScreen);
miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
@@ -703,21 +669,19 @@ ExaCheckGlyphs (CARD8 op,
}
void
-ExaCheckAddTraps (PicturePtr pPicture,
- INT16 x_off,
- INT16 y_off,
- int ntrap,
- xTrap *traps)
+ExaCheckAddTraps(PicturePtr pPicture,
+ INT16 x_off, INT16 y_off, int ntrap, xTrap * traps)
{
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
EXA_PRE_FALLBACK(pScreen);
EXA_FALLBACK(("to pict %p (%c)\n",
- exaDrawableLocation(pPicture->pDrawable)));
+ exaDrawableLocation(pPicture->pDrawable)));
exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
swap(pExaScr, ps, AddTraps);
- ps->AddTraps (pPicture, x_off, y_off, ntrap, traps);
+ ps->AddTraps(pPicture, x_off, y_off, ntrap, traps);
swap(pExaScr, ps, AddTraps);
exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK(pScreen);
@@ -728,37 +692,37 @@ ExaCheckAddTraps (PicturePtr pPicture,
* that happen to be 1x1. Pixmap must be at least 8bpp.
*/
CARD32
-exaGetPixmapFirstPixel (PixmapPtr pPixmap)
+exaGetPixmapFirstPixel(PixmapPtr pPixmap)
{
switch (pPixmap->drawable.bitsPerPixel) {
case 32:
- {
- CARD32 pixel;
+ {
+ CARD32 pixel;
- pPixmap->drawable.pScreen->GetImage(&pPixmap->drawable, 0, 0, 1, 1,
- ZPixmap, ~0, (char*)&pixel);
- return pixel;
- }
+ pPixmap->drawable.pScreen->GetImage(&pPixmap->drawable, 0, 0, 1, 1,
+ ZPixmap, ~0, (char *) &pixel);
+ return pixel;
+ }
case 16:
- {
- CARD16 pixel;
+ {
+ CARD16 pixel;
- pPixmap->drawable.pScreen->GetImage(&pPixmap->drawable, 0, 0, 1, 1,
- ZPixmap, ~0, (char*)&pixel);
- return pixel;
- }
+ pPixmap->drawable.pScreen->GetImage(&pPixmap->drawable, 0, 0, 1, 1,
+ ZPixmap, ~0, (char *) &pixel);
+ return pixel;
+ }
case 8:
case 4:
case 1:
- {
- CARD8 pixel;
+ {
+ CARD8 pixel;
- pPixmap->drawable.pScreen->GetImage(&pPixmap->drawable, 0, 0, 1, 1,
- ZPixmap, ~0, (char*)&pixel);
- return pixel;
- }
+ pPixmap->drawable.pScreen->GetImage(&pPixmap->drawable, 0, 0, 1, 1,
+ ZPixmap, ~0, (char *) &pixel);
+ return pixel;
+ }
default:
- FatalError("%s called for invalid bpp %d\n", __FUNCTION__,
- pPixmap->drawable.bitsPerPixel);
+ FatalError("%s called for invalid bpp %d\n", __FUNCTION__,
+ pPixmap->drawable.bitsPerPixel);
}
}
diff --git a/xorg-server/fb/fb.h b/xorg-server/fb/fb.h
index a3f93bdae..4843f0803 100644
--- a/xorg-server/fb/fb.h
+++ b/xorg-server/fb/fb.h
@@ -21,7 +21,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-
#ifndef _FB_H_
#define _FB_H_
@@ -86,75 +85,67 @@
#endif
#if FB_SHIFT < LOG2_BITMAP_PAD
- error FB_SHIFT must be >= LOG2_BITMAP_PAD
+error FB_SHIFT must be >= LOG2_BITMAP_PAD
#endif
-
#define FB_UNIT (1 << FB_SHIFT)
#define FB_HALFUNIT (1 << (FB_SHIFT-1))
#define FB_MASK (FB_UNIT - 1)
#define FB_ALLONES ((FbBits) -1)
-
#if GLYPHPADBYTES != 4
#error "GLYPHPADBYTES must be 4"
#endif
-
/* for driver compat - intel UXA needs the second one at least */
#define FB_24BIT
#define FB_24_32BIT
-
#define FB_STIP_SHIFT LOG2_BITMAP_PAD
#define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
#define FB_STIP_MASK (FB_STIP_UNIT - 1)
#define FB_STIP_ALLONES ((FbStip) -1)
-
#define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0)
#define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0)
-
#define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT)))
#define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT)))
-
#define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1))
-
#if FB_SHIFT == 6
-# ifdef WIN32
-typedef unsigned __int64 FbBits;
-# else
-# if defined(__alpha__) || defined(__alpha) || \
+#ifdef WIN32
+typedef unsigned __int64 FbBits;
+#else
+#if defined(__alpha__) || defined(__alpha) || \
defined(ia64) || defined(__ia64__) || \
defined(__sparc64__) || defined(_LP64) || \
defined(__s390x__) || \
defined(amd64) || defined (__amd64__) || \
defined (__powerpc64__)
-typedef unsigned long FbBits;
-# else
-typedef unsigned long long FbBits;
-# endif
-# endif
+typedef unsigned long FbBits;
+#else
+typedef unsigned long long FbBits;
+#endif
+#endif
#endif
#if FB_SHIFT == 5
-typedef CARD32 FbBits;
+typedef CARD32 FbBits;
#endif
#if FB_SHIFT == 4
-typedef CARD16 FbBits;
+typedef CARD16 FbBits;
#endif
#if LOG2_BITMAP_PAD == FB_SHIFT
-typedef FbBits FbStip;
+typedef FbBits FbStip;
#else
-# if LOG2_BITMAP_PAD == 5
-typedef CARD32 FbStip;
-# endif
+#if LOG2_BITMAP_PAD == 5
+typedef CARD32 FbStip;
+#endif
#endif
-typedef int FbStride;
-
+typedef int FbStride;
#ifdef FB_DEBUG
extern _X_EXPORT void fbValidateDrawable(DrawablePtr d);
extern _X_EXPORT void fbInitializeDrawable(DrawablePtr d);
-extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
+extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data);
+
#define FB_HEAD_BITS (FbStip) (0xbaadf00d)
#define FB_TAIL_BITS (FbStip) (0xbaddf0ad)
#else
@@ -207,7 +198,6 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
#define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
-
#define FbMaskBits(x,w,l,n,r) { \
n = (w); \
r = FbRightMask((x)+n); \
@@ -223,7 +213,6 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
n >>= FB_SHIFT; \
}
-
#define FbByteMaskInvalid 0x10
#define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1)))
@@ -416,7 +405,6 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
} \
}
-
#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \
switch (rb) { \
case 1: \
@@ -543,7 +531,7 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
#define FbDashDeclare \
unsigned char *__dash, *__firstDash, *__lastDash
-
+
#define FbDashInit(pGC,pPriv,dashOffset,dashlen,even) { \
(even) = TRUE; \
__firstDash = (pGC)->dash; \
@@ -583,22 +571,21 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
}
extern _X_EXPORT DevPrivateKey
-fbGetGCPrivateKey (void);
+ fbGetGCPrivateKey(void);
extern _X_EXPORT DevPrivateKey
-fbGetWinPrivateKey (void);
-
-extern _X_EXPORT const GCOps fbGCOps;
-extern _X_EXPORT const GCFuncs fbGCFuncs;
+ fbGetWinPrivateKey(void);
+extern _X_EXPORT const GCOps fbGCOps;
+extern _X_EXPORT const GCFuncs fbGCFuncs;
/* Framebuffer access wrapper */
-typedef FbBits (*ReadMemoryProcPtr)(const void *src, int size);
-typedef void (*WriteMemoryProcPtr)(void *dst, FbBits value, int size);
-typedef void (*SetupWrapProcPtr)(ReadMemoryProcPtr *pRead,
- WriteMemoryProcPtr *pWrite,
- DrawablePtr pDraw);
-typedef void (*FinishWrapProcPtr)(DrawablePtr pDraw);
+typedef FbBits(*ReadMemoryProcPtr) (const void *src, int size);
+typedef void (*WriteMemoryProcPtr) (void *dst, FbBits value, int size);
+typedef void (*SetupWrapProcPtr) (ReadMemoryProcPtr * pRead,
+ WriteMemoryProcPtr * pWrite,
+ DrawablePtr pDraw);
+typedef void (*FinishWrapProcPtr) (DrawablePtr pDraw);
#ifdef FB_ACCESS_WRAPPER
@@ -617,17 +604,16 @@ typedef void (*FinishWrapProcPtr)(DrawablePtr pDraw);
#endif
-
extern _X_EXPORT DevPrivateKey
-fbGetScreenPrivateKey(void);
+ fbGetScreenPrivateKey(void);
/* private field of a screen */
typedef struct {
- unsigned char win32bpp; /* window bpp for 32-bpp images */
- unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
+ unsigned char win32bpp; /* window bpp for 32-bpp images */
+ unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
#ifdef FB_ACCESS_WRAPPER
- SetupWrapProcPtr setupWrap; /* driver hook to set pixmap access wrapping */
- FinishWrapProcPtr finishWrap; /* driver hook to clean up pixmap access wrapping */
+ SetupWrapProcPtr setupWrap; /* driver hook to set pixmap access wrapping */
+ FinishWrapProcPtr finishWrap; /* driver hook to clean up pixmap access wrapping */
#endif
} FbScreenPrivRec, *FbScreenPrivPtr;
@@ -636,12 +622,12 @@ typedef struct {
/* private field of GC */
typedef struct {
- FbBits and, xor; /* reduced rop values */
- FbBits bgand, bgxor; /* for stipples */
- FbBits fg, bg, pm; /* expanded and filled */
- unsigned int dashLength; /* total of all dash elements */
- unsigned char evenStipple; /* stipple is even */
- unsigned char bpp; /* current drawable bpp */
+ FbBits and, xor; /* reduced rop values */
+ FbBits bgand, bgxor; /* for stipples */
+ FbBits fg, bg, pm; /* expanded and filled */
+ unsigned int dashLength; /* total of all dash elements */
+ unsigned char evenStipple; /* stipple is even */
+ unsigned char bpp; /* current drawable bpp */
} FbGCPrivRec, *FbGCPrivPtr;
#define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
@@ -738,662 +724,473 @@ typedef struct {
* fb24_32.c
*/
extern _X_EXPORT void
-fb24_32GetSpans(DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart);
-
-extern _X_EXPORT void
-fb24_32SetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *src,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted);
-
-extern _X_EXPORT void
-fb24_32PutZImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- int alu,
- FbBits pm,
- int x,
- int y,
- int width,
- int height,
- CARD8 *src,
- FbStride srcStride);
-
-extern _X_EXPORT void
-fb24_32GetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d);
-
-extern _X_EXPORT void
-fb24_32CopyMtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
+
+fb24_32GetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart);
+
+extern _X_EXPORT void
+
+fb24_32SetSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *src,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
+
+extern _X_EXPORT void
+
+fb24_32PutZImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int alu,
+ FbBits pm,
+ int x,
+ int y, int width, int height, CARD8 *src, FbStride srcStride);
+
+extern _X_EXPORT void
+
+fb24_32GetImage(DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w,
+ int h, unsigned int format, unsigned long planeMask, char *d);
+
+extern _X_EXPORT void
+
+fb24_32CopyMtoN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
extern _X_EXPORT PixmapPtr
-fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel);
-
+ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel);
+
extern _X_EXPORT Bool
-fb24_32CreateScreenResources(ScreenPtr pScreen);
+ fb24_32CreateScreenResources(ScreenPtr pScreen);
extern _X_EXPORT Bool
-fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
- int width,
- int height,
- int depth,
- int bitsPerPixel,
- int devKind,
- pointer pPixData);
+
+fb24_32ModifyPixmapHeader(PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel, int devKind, pointer pPixData);
/*
* fballpriv.c
*/
extern _X_EXPORT Bool
-fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCIndex);
-
+ fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCIndex);
+
/*
* fbarc.c
*/
extern _X_EXPORT void
-fbPolyArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *parcs);
+ fbPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs);
/*
* fbbits.c
*/
extern _X_EXPORT void
-fbBresSolid8(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbBresDash8 (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbDots8 (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbArc8 (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int dx,
- int dy,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbGlyph8 (FbBits *dstLine,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int height,
- int shift);
-
-extern _X_EXPORT void
-fbPolyline8 (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ptsOrig);
-
-extern _X_EXPORT void
-fbPolySegment8 (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg);
-
-extern _X_EXPORT void
-fbBresSolid16(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbBresDash16(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbDots16(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbArc16(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int dx,
- int dy,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbGlyph16(FbBits *dstLine,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int height,
- int shift);
-
-extern _X_EXPORT void
-fbPolyline16 (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ptsOrig);
-
-extern _X_EXPORT void
-fbPolySegment16 (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg);
-
-
-extern _X_EXPORT void
-fbBresSolid24(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbBresDash24(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbDots24(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbArc24(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int dx,
- int dy,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbGlyph24(FbBits *dstLine,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int height,
- int shift);
-
-extern _X_EXPORT void
-fbPolyline24 (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ptsOrig);
-
-extern _X_EXPORT void
-fbPolySegment24 (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg);
-
-
-extern _X_EXPORT void
-fbBresSolid32(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbBresDash32(DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
-
-extern _X_EXPORT void
-fbDots32(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbArc32(FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int dx,
- int dy,
- FbBits and,
- FbBits xor);
-
-extern _X_EXPORT void
-fbGlyph32(FbBits *dstLine,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int height,
- int shift);
-extern _X_EXPORT void
-fbPolyline32 (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ptsOrig);
-
-extern _X_EXPORT void
-fbPolySegment32 (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg);
+
+fbBresSolid8(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbBresDash8(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbDots8(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbArc8(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbGlyph8(FbBits * dstLine,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
+
+extern _X_EXPORT void
+
+fbPolyline8(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
+
+extern _X_EXPORT void
+ fbPolySegment8(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
+
+extern _X_EXPORT void
+
+fbBresSolid16(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbBresDash16(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbDots16(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbArc16(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbGlyph16(FbBits * dstLine,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
+
+extern _X_EXPORT void
+
+fbPolyline16(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
+
+extern _X_EXPORT void
+ fbPolySegment16(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
+
+extern _X_EXPORT void
+
+fbBresSolid24(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbBresDash24(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbDots24(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbArc24(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbGlyph24(FbBits * dstLine,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
+
+extern _X_EXPORT void
+
+fbPolyline24(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
+
+extern _X_EXPORT void
+ fbPolySegment24(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
+
+extern _X_EXPORT void
+
+fbBresSolid32(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbBresDash32(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
+
+extern _X_EXPORT void
+
+fbDots32(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbArc32(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
+
+extern _X_EXPORT void
+
+fbGlyph32(FbBits * dstLine,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
+extern _X_EXPORT void
+
+fbPolyline32(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
+
+extern _X_EXPORT void
+ fbPolySegment32(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
/*
* fbblt.c
*/
extern _X_EXPORT void
-fbBlt (FbBits *src,
- FbStride srcStride,
- int srcX,
-
- FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp,
-
- Bool reverse,
- Bool upsidedown);
-
-extern _X_EXPORT void
-fbBlt24 (FbBits *srcLine,
- FbStride srcStride,
- int srcX,
-
- FbBits *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
-
- Bool reverse,
- Bool upsidedown);
-
-extern _X_EXPORT void
-fbBltStip (FbStip *src,
- FbStride srcStride, /* in FbStip units, not FbBits units */
- int srcX,
-
- FbStip *dst,
- FbStride dstStride, /* in FbStip units, not FbBits units */
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp);
-
+
+fbBlt(FbBits * src,
+ FbStride srcStride,
+ int srcX,
+ FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown);
+
+extern _X_EXPORT void
+
+fbBlt24(FbBits * srcLine,
+ FbStride srcStride,
+ int srcX,
+ FbBits * dstLine,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height, int alu, FbBits pm, Bool reverse, Bool upsidedown);
+
+extern _X_EXPORT void
+ fbBltStip(FbStip * src, FbStride srcStride, /* in FbStip units, not FbBits units */
+ int srcX, FbStip * dst, FbStride dstStride, /* in FbStip units, not FbBits units */
+ int dstX, int width, int height, int alu, FbBits pm, int bpp);
+
/*
* fbbltone.c
*/
extern _X_EXPORT void
-fbBltOne (FbStip *src,
- FbStride srcStride,
- int srcX,
- FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbBits fgand,
- FbBits fbxor,
- FbBits bgand,
- FbBits bgxor);
-
-extern _X_EXPORT void
-fbBltOne24 (FbStip *src,
- FbStride srcStride, /* FbStip units per scanline */
- int srcX, /* bit position of source */
- FbBits *dst,
- FbStride dstStride, /* FbBits units per scanline */
- int dstX, /* bit position of dest */
- int dstBpp, /* bits per destination unit */
-
- int width, /* width in bits of destination */
- int height, /* height in scanlines */
-
- FbBits fgand, /* rrop values */
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor);
-
-extern _X_EXPORT void
-fbBltPlane (FbBits *src,
- FbStride srcStride,
- int srcX,
- int srcBpp,
-
- FbStip *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbStip fgand,
- FbStip fgxor,
- FbStip bgand,
- FbStip bgxor,
- Pixel planeMask);
+
+fbBltOne(FbStip * src,
+ FbStride srcStride,
+ int srcX,
+ FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height, FbBits fgand, FbBits fbxor, FbBits bgand, FbBits bgxor);
+
+extern _X_EXPORT void
+ fbBltOne24(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
+ int srcX, /* bit position of source */
+ FbBits * dst, FbStride dstStride, /* FbBits units per scanline */
+ int dstX, /* bit position of dest */
+ int dstBpp, /* bits per destination unit */
+ int width, /* width in bits of destination */
+ int height, /* height in scanlines */
+ FbBits fgand, /* rrop values */
+ FbBits fgxor, FbBits bgand, FbBits bgxor);
+
+extern _X_EXPORT void
+
+fbBltPlane(FbBits * src,
+ FbStride srcStride,
+ int srcX,
+ int srcBpp,
+ FbStip * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbStip fgand,
+ FbStip fgxor, FbStip bgand, FbStip bgxor, Pixel planeMask);
/*
* fbcmap_mi.c
*/
extern _X_EXPORT int
-fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
+ fbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps);
extern _X_EXPORT void
-fbInstallColormap(ColormapPtr pmap);
+ fbInstallColormap(ColormapPtr pmap);
extern _X_EXPORT void
-fbUninstallColormap(ColormapPtr pmap);
+ fbUninstallColormap(ColormapPtr pmap);
extern _X_EXPORT void
-fbResolveColor(unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual);
+
+fbResolveColor(unsigned short *pred,
+ unsigned short *pgreen,
+ unsigned short *pblue, VisualPtr pVisual);
extern _X_EXPORT Bool
-fbInitializeColormap(ColormapPtr pmap);
+ fbInitializeColormap(ColormapPtr pmap);
extern _X_EXPORT int
-fbExpandDirectColors (ColormapPtr pmap,
- int ndef,
- xColorItem *indefs,
- xColorItem *outdefs);
+
+fbExpandDirectColors(ColormapPtr pmap,
+ int ndef, xColorItem * indefs, xColorItem * outdefs);
extern _X_EXPORT Bool
-fbCreateDefColormap(ScreenPtr pScreen);
+ fbCreateDefColormap(ScreenPtr pScreen);
extern _X_EXPORT void
-fbClearVisualTypes(void);
+ fbClearVisualTypes(void);
extern _X_EXPORT Bool
-fbHasVisualTypes (int depth);
+ fbHasVisualTypes(int depth);
extern _X_EXPORT Bool
-fbSetVisualTypes (int depth, int visuals, int bitsPerRGB);
+ fbSetVisualTypes(int depth, int visuals, int bitsPerRGB);
extern _X_EXPORT Bool
-fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
- Pixel redMask, Pixel greenMask, Pixel blueMask);
+
+fbSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
+ Pixel redMask, Pixel greenMask, Pixel blueMask);
extern _X_EXPORT Bool
-fbInitVisuals (VisualPtr *visualp,
- DepthPtr *depthp,
- int *nvisualp,
- int *ndepthp,
- int *rootDepthp,
- VisualID *defaultVisp,
- unsigned long sizes,
- int bitsPerRGB);
+
+fbInitVisuals(VisualPtr * visualp,
+ DepthPtr * depthp,
+ int *nvisualp,
+ int *ndepthp,
+ int *rootDepthp,
+ VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB);
/*
* fbcopy.c
*/
/* Compatibility definition, to be removed at next ABI change. */
-typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pDstBox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT void
-fbCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT void
-fbCopy1toN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT void
-fbCopyNto1 (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
+typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pDstBox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse,
+ Bool upsidedown, Pixel bitplane, void *closure);
+
+extern _X_EXPORT void
+
+fbCopyNtoN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
+
+extern _X_EXPORT void
+
+fbCopy1toN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
+
+extern _X_EXPORT void
+
+fbCopyNto1(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
extern _X_EXPORT RegionPtr
-fbCopyArea (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut);
+
+fbCopyArea(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut);
extern _X_EXPORT RegionPtr
-fbCopyPlane (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut,
- unsigned long bitplane);
+
+fbCopyPlane(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn,
+ int yIn,
+ int widthSrc,
+ int heightSrc, int xOut, int yOut, unsigned long bitplane);
/*
* fbfill.c
*/
extern _X_EXPORT void
-fbFill (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int width,
- int height);
+ fbFill(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height);
extern _X_EXPORT void
-fbSolidBoxClipped (DrawablePtr pDrawable,
- RegionPtr pClip,
- int xa,
- int ya,
- int xb,
- int yb,
- FbBits and,
- FbBits xor);
+
+fbSolidBoxClipped(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int xa, int ya, int xb, int yb, FbBits and, FbBits xor);
/*
* fbfillrect.c
*/
extern _X_EXPORT void
-fbPolyFillRect(DrawablePtr pDrawable,
- GCPtr pGC,
- int nrectInit,
- xRectangle *prectInit);
+
+fbPolyFillRect(DrawablePtr pDrawable,
+ GCPtr pGC, int nrectInit, xRectangle *prectInit);
#define fbPolyFillArc miPolyFillArc
@@ -1403,155 +1200,117 @@ fbPolyFillRect(DrawablePtr pDrawable,
* fbfillsp.c
*/
extern _X_EXPORT void
-fbFillSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted);
+fbFillSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted);
/*
* fbgc.c
*/
extern _X_EXPORT Bool
-fbCreateGC(GCPtr pGC);
+ fbCreateGC(GCPtr pGC);
extern _X_EXPORT void
-fbPadPixmap (PixmapPtr pPixmap);
-
+ fbPadPixmap(PixmapPtr pPixmap);
+
extern _X_EXPORT void
-fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
+ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
/*
* fbgetsp.c
*/
extern _X_EXPORT void
-fbGetSpans(DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart);
+
+fbGetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart);
/*
* fbglyph.c
*/
extern _X_EXPORT Bool
-fbGlyphIn (RegionPtr pRegion,
- int x,
- int y,
- int width,
- int height);
-
-extern _X_EXPORT void
-fbPolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
-
-extern _X_EXPORT void
-fbImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
+ fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height);
+
+extern _X_EXPORT void
+
+fbPolyGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase);
+
+extern _X_EXPORT void
+
+fbImageGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase);
/*
* fbimage.c
*/
extern _X_EXPORT void
-fbPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage);
-
-extern _X_EXPORT void
-fbPutZImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- int alu,
- FbBits pm,
- int x,
- int y,
- int width,
- int height,
- FbStip *src,
- FbStride srcStride);
-
-extern _X_EXPORT void
-fbPutXYImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- FbBits fg,
- FbBits bg,
- FbBits pm,
- int alu,
- Bool opaque,
-
- int x,
- int y,
- int width,
- int height,
-
- FbStip *src,
- FbStride srcStride,
- int srcX);
-
-extern _X_EXPORT void
-fbGetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d);
+
+fbPutImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h, int leftPad, int format, char *pImage);
+
+extern _X_EXPORT void
+
+fbPutZImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int alu,
+ FbBits pm,
+ int x,
+ int y, int width, int height, FbStip * src, FbStride srcStride);
+
+extern _X_EXPORT void
+
+fbPutXYImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ FbBits fg,
+ FbBits bg,
+ FbBits pm,
+ int alu,
+ Bool opaque,
+ int x,
+ int y,
+ int width, int height, FbStip * src, FbStride srcStride, int srcX);
+
+extern _X_EXPORT void
+
+fbGetImage(DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w, int h, unsigned int format, unsigned long planeMask, char *d);
/*
* fbline.c
*/
extern _X_EXPORT void
-fbZeroLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
+
+fbZeroLine(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
extern _X_EXPORT void
-fbZeroSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSegs);
+ fbZeroSegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs);
extern _X_EXPORT void
-fbPolyLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
+
+fbPolyLine(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
extern _X_EXPORT void
-fbFixCoordModePrevious (int npt,
- DDXPointPtr ppt);
+ fbFixCoordModePrevious(int npt, DDXPointPtr ppt);
extern _X_EXPORT void
-fbPolySegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg);
+ fbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
#define fbPolyRectangle miPolyRectangle
@@ -1560,415 +1319,299 @@ fbPolySegment (DrawablePtr pDrawable,
*/
extern _X_EXPORT Bool
-fbPictureInit (ScreenPtr pScreen,
- PictFormatPtr formats,
- int nformats);
+ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
/*
* fbpixmap.c
*/
extern _X_EXPORT PixmapPtr
-fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
- unsigned usage_hint);
+
+fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
+ unsigned usage_hint);
extern _X_EXPORT PixmapPtr
-fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint);
+
+fbCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint);
extern _X_EXPORT Bool
-fbDestroyPixmap (PixmapPtr pPixmap);
+ fbDestroyPixmap(PixmapPtr pPixmap);
extern _X_EXPORT RegionPtr
-fbPixmapToRegion(PixmapPtr pPix);
+ fbPixmapToRegion(PixmapPtr pPix);
/*
* fbpoint.c
*/
extern _X_EXPORT void
-fbDots (FbBits *dstOrig,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits andOrig,
- FbBits xorOrig);
+
+fbDots(FbBits * dstOrig,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits andOrig, FbBits xorOrig);
extern _X_EXPORT void
-fbPolyPoint (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit);
+
+fbPolyPoint(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, xPoint * pptInit);
/*
* fbpush.c
*/
extern _X_EXPORT void
-fbPushPattern (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
-
- int x,
- int y,
- int width,
- int height);
+fbPushPattern(DrawablePtr pDrawable,
+ GCPtr pGC,
+ FbStip * src,
+ FbStride srcStride,
+ int srcX, int x, int y, int width, int height);
extern _X_EXPORT void
-fbPushFill (DrawablePtr pDrawable,
- GCPtr pGC,
- FbStip *src,
- FbStride srcStride,
- int srcX,
-
- int x,
- int y,
- int width,
- int height);
+fbPushFill(DrawablePtr pDrawable,
+ GCPtr pGC,
+ FbStip * src,
+ FbStride srcStride, int srcX, int x, int y, int width, int height);
extern _X_EXPORT void
-fbPushImage (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
- int x,
- int y,
- int width,
- int height);
+fbPushImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ FbStip * src,
+ FbStride srcStride, int srcX, int x, int y, int width, int height);
extern _X_EXPORT void
-fbPushPixels (GCPtr pGC,
- PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int dx,
- int dy,
- int xOrg,
- int yOrg);
+fbPushPixels(GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg);
/*
* fbscreen.c
*/
extern _X_EXPORT Bool
-fbCloseScreen (int indx, ScreenPtr pScreen);
+ fbCloseScreen(int indx, ScreenPtr pScreen);
extern _X_EXPORT Bool
-fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
+ fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
extern _X_EXPORT Bool
-fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
+ fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
extern _X_EXPORT void
-fbQueryBestSize (int class,
- unsigned short *width, unsigned short *height,
- ScreenPtr pScreen);
+
+fbQueryBestSize(int class,
+ unsigned short *width, unsigned short *height,
+ ScreenPtr pScreen);
extern _X_EXPORT PixmapPtr
-_fbGetWindowPixmap (WindowPtr pWindow);
+ _fbGetWindowPixmap(WindowPtr pWindow);
extern _X_EXPORT void
-_fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap);
+ _fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap);
extern _X_EXPORT Bool
-fbSetupScreen(ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bitmap */
- int xsize, /* in pixels */
- int ysize,
- int dpix, /* dots per inch */
- int dpiy,
- int width, /* pixel width of frame buffer */
- int bpp); /* bits per pixel of frame buffer */
+ fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */
+ int xsize, /* in pixels */
+ int ysize, int dpix, /* dots per inch */
+ int dpiy, int width, /* pixel width of frame buffer */
+ int bpp); /* bits per pixel of frame buffer */
extern _X_EXPORT Bool
-wfbFinishScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp,
- SetupWrapProcPtr setupWrap,
- FinishWrapProcPtr finishWrap);
+
+wfbFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width,
+ int bpp,
+ SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap);
extern _X_EXPORT Bool
-wfbScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp,
- SetupWrapProcPtr setupWrap,
- FinishWrapProcPtr finishWrap);
+
+wfbScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width,
+ int bpp,
+ SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap);
extern _X_EXPORT Bool
-fbFinishScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp);
+
+fbFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize, int dpix, int dpiy, int width, int bpp);
extern _X_EXPORT Bool
-fbScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp);
-
+
+fbScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize, int ysize, int dpix, int dpiy, int width, int bpp);
+
/*
* fbseg.c
*/
-typedef void FbBres (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
+typedef void FbBres(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x, int y, int e, int e1, int e3, int len);
extern _X_EXPORT FbBres fbBresSolid, fbBresDash, fbBresFill, fbBresFillDash;
+
/*
* fbsetsp.c
*/
extern _X_EXPORT void
-fbSetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *src,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted);
-extern _X_EXPORT FbBres *
-fbSelectBres (DrawablePtr pDrawable,
- GCPtr pGC);
+fbSetSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
+
+extern _X_EXPORT FbBres *fbSelectBres(DrawablePtr pDrawable, GCPtr pGC);
extern _X_EXPORT void
-fbBres (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x,
- int y,
- int e,
- int e1,
- int e3,
- int len);
+
+fbBres(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x, int y, int e, int e1, int e3, int len);
extern _X_EXPORT void
-fbSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int xa,
- int ya,
- int xb,
- int yb,
- Bool drawLast,
- int *dashOffset);
+fbSegment(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xa, int ya, int xb, int yb, Bool drawLast, int *dashOffset);
/*
* fbsolid.c
*/
extern _X_EXPORT void
-fbSolid (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int bpp,
-
- int width,
- int height,
- FbBits and,
- FbBits xor);
+fbSolid(FbBits * dst,
+ FbStride dstStride,
+ int dstX, int bpp, int width, int height, FbBits and, FbBits xor);
extern _X_EXPORT void
-fbSolid24 (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int width,
- int height,
-
- FbBits and,
- FbBits xor);
+fbSolid24(FbBits * dst,
+ FbStride dstStride,
+ int dstX, int width, int height, FbBits and, FbBits xor);
/*
* fbstipple.c
*/
extern _X_EXPORT void
-fbTransparentSpan (FbBits *dst,
- FbBits stip,
- FbBits fgxor,
- int n);
+ fbTransparentSpan(FbBits * dst, FbBits stip, FbBits fgxor, int n);
extern _X_EXPORT void
-fbEvenStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipHeight,
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot);
+fbEvenStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipHeight,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
extern _X_EXPORT void
-fbOddStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipWidth,
- int stipHeight,
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot);
+fbOddStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipWidth,
+ int stipHeight,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
extern _X_EXPORT void
-fbStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipWidth,
- int stipHeight,
- Bool even,
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot);
+fbStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipWidth,
+ int stipHeight,
+ Bool even,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
/*
* fbtile.c
*/
extern _X_EXPORT void
-fbEvenTile (FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbBits *tile,
- FbStride tileStride,
- int tileHeight,
- int alu,
- FbBits pm,
- int xRot,
- int yRot);
+fbEvenTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileHeight, int alu, FbBits pm, int xRot, int yRot);
extern _X_EXPORT void
-fbOddTile (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int width,
- int height,
-
- FbBits *tile,
- FbStride tileStride,
- int tileWidth,
- int tileHeight,
-
- int alu,
- FbBits pm,
- int bpp,
-
- int xRot,
- int yRot);
+fbOddTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileWidth,
+ int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot);
extern _X_EXPORT void
-fbTile (FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
- FbBits *tile,
- FbStride tileStride,
- int tileWidth,
- int tileHeight,
-
- int alu,
- FbBits pm,
- int bpp,
-
- int xRot,
- int yRot);
+fbTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileWidth,
+ int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot);
/*
* fbutil.c
*/
-extern _X_EXPORT FbBits
-fbReplicatePixel (Pixel p, int bpp);
+extern _X_EXPORT FbBits fbReplicatePixel(Pixel p, int bpp);
extern _X_EXPORT void
-fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp);
+ fbReduceRasterOp(int rop, FbBits fg, FbBits pm, FbBits * andp, FbBits * xorp);
#ifdef FB_ACCESS_WRAPPER
extern _X_EXPORT ReadMemoryProcPtr wfbReadMemory;
@@ -1980,54 +1623,46 @@ extern _X_EXPORT WriteMemoryProcPtr wfbWriteMemory;
*/
extern _X_EXPORT Bool
-fbCreateWindow(WindowPtr pWin);
+ fbCreateWindow(WindowPtr pWin);
extern _X_EXPORT Bool
-fbDestroyWindow(WindowPtr pWin);
+ fbDestroyWindow(WindowPtr pWin);
extern _X_EXPORT Bool
-fbMapWindow(WindowPtr pWindow);
+ fbMapWindow(WindowPtr pWindow);
extern _X_EXPORT Bool
-fbPositionWindow(WindowPtr pWin, int x, int y);
+ fbPositionWindow(WindowPtr pWin, int x, int y);
extern _X_EXPORT Bool
-fbUnmapWindow(WindowPtr pWindow);
-
-extern _X_EXPORT void
-fbCopyWindowProc (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT void
-fbCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
+ fbUnmapWindow(WindowPtr pWindow);
+
+extern _X_EXPORT void
+
+fbCopyWindowProc(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
+
+extern _X_EXPORT void
+ fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
extern _X_EXPORT Bool
-fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
+ fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
extern _X_EXPORT void
-fbFillRegionSolid (DrawablePtr pDrawable,
- RegionPtr pRegion,
- FbBits and,
- FbBits xor);
-extern _X_EXPORT pixman_image_t *
-image_from_pict (PicturePtr pict,
- Bool has_clip,
- int *xoff,
- int *yoff);
+fbFillRegionSolid(DrawablePtr pDrawable,
+ RegionPtr pRegion, FbBits and, FbBits xor);
-extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
+extern _X_EXPORT pixman_image_t *image_from_pict(PicturePtr pict,
+ Bool has_clip,
+ int *xoff, int *yoff);
-#endif /* _FB_H_ */
+extern _X_EXPORT void free_pixman_pict(PicturePtr, pixman_image_t *);
+#endif /* _FB_H_ */
diff --git a/xorg-server/fb/fb24_32.c b/xorg-server/fb/fb24_32.c
index 033fa46c5..5eb81e8f0 100644
--- a/xorg-server/fb/fb24_32.c
+++ b/xorg-server/fb/fb24_32.c
@@ -51,214 +51,186 @@
(WRITE((a+2), (CARD8) ((p) >> 16))))
#endif
-typedef void (*fb24_32BltFunc) (CARD8 *srcLine,
- FbStride srcStride,
- int srcX,
-
- CARD8 *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm);
+typedef void (*fb24_32BltFunc) (CARD8 *srcLine,
+ FbStride srcStride,
+ int srcX,
+ CARD8 *dstLine,
+ FbStride dstStride,
+ int dstX,
+ int width, int height, int alu, FbBits pm);
static void
-fb24_32BltDown (CARD8 *srcLine,
- FbStride srcStride,
- int srcX,
-
- CARD8 *dstLine,
- FbStride dstStride,
- int dstX,
+fb24_32BltDown(CARD8 *srcLine,
+ FbStride srcStride,
+ int srcX,
+ CARD8 *dstLine,
+ FbStride dstStride,
+ int dstX, int width, int height, int alu, FbBits pm)
+{
+ CARD32 *src;
+ CARD8 *dst;
+ int w;
+ Bool destInvarient;
+ CARD32 pixel, dpixel;
- int width,
- int height,
+ FbDeclareMergeRop();
- int alu,
- FbBits pm)
-{
- CARD32 *src;
- CARD8 *dst;
- int w;
- Bool destInvarient;
- CARD32 pixel, dpixel;
- FbDeclareMergeRop ();
-
srcLine += srcX * 4;
dstLine += dstX * 3;
FbInitializeMergeRop(alu, (pm | ~(FbBits) 0xffffff));
destInvarient = FbDestInvarientMergeRop();
- while (height--)
- {
- src = (CARD32 *) srcLine;
- dst = dstLine;
- srcLine += srcStride;
- dstLine += dstStride;
- w = width;
- if (destInvarient)
- {
- while (((long) dst & 3) && w)
- {
- w--;
- pixel = READ(src++);
- pixel = FbDoDestInvarientMergeRop(pixel);
- Put24 (dst, pixel);
- dst += 3;
- }
- /* Do four aligned pixels at a time */
- while (w >= 4)
- {
- CARD32 s0, s1;
- s0 = READ(src++);
- s0 = FbDoDestInvarientMergeRop(s0);
- s1 = READ(src++);
- s1 = FbDoDestInvarientMergeRop(s1);
+ while (height--) {
+ src = (CARD32 *) srcLine;
+ dst = dstLine;
+ srcLine += srcStride;
+ dstLine += dstStride;
+ w = width;
+ if (destInvarient) {
+ while (((long) dst & 3) && w) {
+ w--;
+ pixel = READ(src++);
+ pixel = FbDoDestInvarientMergeRop(pixel);
+ Put24(dst, pixel);
+ dst += 3;
+ }
+ /* Do four aligned pixels at a time */
+ while (w >= 4) {
+ CARD32 s0, s1;
+
+ s0 = READ(src++);
+ s0 = FbDoDestInvarientMergeRop(s0);
+ s1 = READ(src++);
+ s1 = FbDoDestInvarientMergeRop(s1);
#if BITMAP_BIT_ORDER == LSBFirst
- WRITE((CARD32 *)dst, (s0 & 0xffffff) | (s1 << 24));
+ WRITE((CARD32 *) dst, (s0 & 0xffffff) | (s1 << 24));
#else
- WRITE((CARD32 *)dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
+ WRITE((CARD32 *) dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
#endif
- s0 = READ(src++);
- s0 = FbDoDestInvarientMergeRop(s0);
+ s0 = READ(src++);
+ s0 = FbDoDestInvarientMergeRop(s0);
#if BITMAP_BIT_ORDER == LSBFirst
- WRITE((CARD32 *)(dst+4), ((s1 & 0xffffff) >> 8) | (s0 << 16));
+ WRITE((CARD32 *) (dst + 4),
+ ((s1 & 0xffffff) >> 8) | (s0 << 16));
#else
- WRITE((CARD32 *)(dst+4), (s1 << 16) | ((s0 & 0xffffff) >> 8));
+ WRITE((CARD32 *) (dst + 4),
+ (s1 << 16) | ((s0 & 0xffffff) >> 8));
#endif
- s1 = READ(src++);
- s1 = FbDoDestInvarientMergeRop(s1);
+ s1 = READ(src++);
+ s1 = FbDoDestInvarientMergeRop(s1);
#if BITMAP_BIT_ORDER == LSBFirst
- WRITE((CARD32 *)(dst+8), ((s0 & 0xffffff) >> 16) | (s1 << 8));
+ WRITE((CARD32 *) (dst + 8),
+ ((s0 & 0xffffff) >> 16) | (s1 << 8));
#else
- WRITE((CARD32 *)(dst+8), (s0 << 24) | (s1 & 0xffffff));
+ WRITE((CARD32 *) (dst + 8), (s0 << 24) | (s1 & 0xffffff));
#endif
- dst += 12;
- w -= 4;
- }
- while (w--)
- {
- pixel = READ(src++);
- pixel = FbDoDestInvarientMergeRop(pixel);
- Put24 (dst, pixel);
- dst += 3;
- }
- }
- else
- {
- while (w--)
- {
- pixel = READ(src++);
- dpixel = Get24 (dst);
- pixel = FbDoMergeRop(pixel, dpixel);
- Put24 (dst, pixel);
- dst += 3;
- }
- }
+ dst += 12;
+ w -= 4;
+ }
+ while (w--) {
+ pixel = READ(src++);
+ pixel = FbDoDestInvarientMergeRop(pixel);
+ Put24(dst, pixel);
+ dst += 3;
+ }
+ }
+ else {
+ while (w--) {
+ pixel = READ(src++);
+ dpixel = Get24(dst);
+ pixel = FbDoMergeRop(pixel, dpixel);
+ Put24(dst, pixel);
+ dst += 3;
+ }
+ }
}
}
static void
-fb24_32BltUp (CARD8 *srcLine,
- FbStride srcStride,
- int srcX,
-
- CARD8 *dstLine,
- FbStride dstStride,
- int dstX,
+fb24_32BltUp(CARD8 *srcLine,
+ FbStride srcStride,
+ int srcX,
+ CARD8 *dstLine,
+ FbStride dstStride,
+ int dstX, int width, int height, int alu, FbBits pm)
+{
+ CARD8 *src;
+ CARD32 *dst;
+ int w;
+ Bool destInvarient;
+ CARD32 pixel;
- int width,
- int height,
+ FbDeclareMergeRop();
- int alu,
- FbBits pm)
-{
- CARD8 *src;
- CARD32 *dst;
- int w;
- Bool destInvarient;
- CARD32 pixel;
- FbDeclareMergeRop ();
-
FbInitializeMergeRop(alu, (pm | (~(FbBits) 0xffffff)));
destInvarient = FbDestInvarientMergeRop();
srcLine += srcX * 3;
dstLine += dstX * 4;
- while (height--)
- {
- w = width;
- src = srcLine;
- dst = (CARD32 *) dstLine;
- srcLine += srcStride;
- dstLine += dstStride;
- if (destInvarient)
- {
- while (((long) src & 3) && w)
- {
- w--;
- pixel = Get24(src);
- src += 3;
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- }
- /* Do four aligned pixels at a time */
- while (w >= 4)
- {
- CARD32 s0, s1;
-
- s0 = READ((CARD32 *)src);
+ while (height--) {
+ w = width;
+ src = srcLine;
+ dst = (CARD32 *) dstLine;
+ srcLine += srcStride;
+ dstLine += dstStride;
+ if (destInvarient) {
+ while (((long) src & 3) && w) {
+ w--;
+ pixel = Get24(src);
+ src += 3;
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ }
+ /* Do four aligned pixels at a time */
+ while (w >= 4) {
+ CARD32 s0, s1;
+
+ s0 = READ((CARD32 *) src);
#if BITMAP_BIT_ORDER == LSBFirst
- pixel = s0 & 0xffffff;
+ pixel = s0 & 0xffffff;
#else
- pixel = s0 >> 8;
+ pixel = s0 >> 8;
#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- s1 = READ((CARD32 *)(src+4));
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ s1 = READ((CARD32 *) (src + 4));
#if BITMAP_BIT_ORDER == LSBFirst
- pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff);
+ pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff);
#else
- pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16);
+ pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16);
#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- s0 = READ((CARD32 *)(src+8));
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ s0 = READ((CARD32 *) (src + 8));
#if BITMAP_BIT_ORDER == LSBFirst
- pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff);
+ pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff);
#else
- pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24);
+ pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24);
#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
#if BITMAP_BIT_ORDER == LSBFirst
- pixel = s0 >> 8;
+ pixel = s0 >> 8;
#else
- pixel = s0 & 0xffffff;
+ pixel = s0 & 0xffffff;
#endif
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- src += 12;
- w -= 4;
- }
- while (w)
- {
- w--;
- pixel = Get24(src);
- src += 3;
- WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
- }
- }
- else
- {
- while (w--)
- {
- pixel = Get24(src);
- src += 3;
- WRITE(dst, FbDoMergeRop(pixel, READ(dst)));
- dst++;
- }
- }
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ src += 12;
+ w -= 4;
+ }
+ while (w) {
+ w--;
+ pixel = Get24(src);
+ src += 3;
+ WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+ }
+ }
+ else {
+ while (w--) {
+ pixel = Get24(src);
+ src += 3;
+ WRITE(dst, FbDoMergeRop(pixel, READ(dst)));
+ dst++;
+ }
+ }
}
}
@@ -266,321 +238,265 @@ fb24_32BltUp (CARD8 *srcLine,
* Spans functions; probably unused.
*/
void
-fb24_32GetSpans(DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart)
+fb24_32GetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart)
{
- FbBits *srcBits;
- CARD8 *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- CARD8 *dst;
-
- fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
+ FbBits *srcBits;
+ CARD8 *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ CARD8 *dst;
+
+ fbGetDrawable(pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
src = (CARD8 *) srcBits;
- srcStride *= sizeof (FbBits);
-
- while (nspans--)
- {
- dst = (CARD8 *) pchardstStart;
- fb24_32BltUp (src + (ppt->y + srcYoff) * srcStride, srcStride,
- ppt->x + srcXoff,
-
- dst,
- 1,
- 0,
-
- *pwidth,
- 1,
-
- GXcopy,
- FB_ALLONES);
-
- pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
- ppt++;
- pwidth++;
+ srcStride *= sizeof(FbBits);
+
+ while (nspans--) {
+ dst = (CARD8 *) pchardstStart;
+ fb24_32BltUp(src + (ppt->y + srcYoff) * srcStride, srcStride,
+ ppt->x + srcXoff,
+ dst, 1, 0, *pwidth, 1, GXcopy, FB_ALLONES);
+
+ pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
+ ppt++;
+ pwidth++;
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fb24_32SetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *src,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted)
+fb24_32SetSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *src,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- FbBits *dstBits;
- CARD8 *dst, *d, *s;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- BoxPtr pbox;
- int n;
- int x1, x2;
-
- fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ FbBits *dstBits;
+ CARD8 *dst, *d, *s;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ BoxPtr pbox;
+ int n;
+ int x1, x2;
+
+ fbGetDrawable(pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
dst = (CARD8 *) dstBits;
- dstStride *= sizeof (FbBits);
- while (nspans--)
- {
- d = dst + (ppt->y + dstYoff) * dstStride;
- s = (CARD8 *) src;
- n = RegionNumRects(pClip);
- pbox = RegionRects (pClip);
- while (n--)
- {
- if (pbox->y1 > ppt->y)
- break;
- if (pbox->y2 > ppt->y)
- {
- x1 = ppt->x;
- x2 = x1 + *pwidth;
- if (pbox->x1 > x1)
- x1 = pbox->x1;
- if (pbox->x2 < x2)
- x2 = pbox->x2;
- if (x1 < x2)
- fb24_32BltDown (s,
- 0,
- (x1 - ppt->x),
- d,
- dstStride,
- x1 + dstXoff,
-
- (x2 - x1),
- 1,
- pGC->alu,
- pPriv->pm);
- }
- }
- src += PixmapBytePad (*pwidth, pDrawable->depth);
- ppt++;
- pwidth++;
+ dstStride *= sizeof(FbBits);
+ while (nspans--) {
+ d = dst + (ppt->y + dstYoff) * dstStride;
+ s = (CARD8 *) src;
+ n = RegionNumRects(pClip);
+ pbox = RegionRects(pClip);
+ while (n--) {
+ if (pbox->y1 > ppt->y)
+ break;
+ if (pbox->y2 > ppt->y) {
+ x1 = ppt->x;
+ x2 = x1 + *pwidth;
+ if (pbox->x1 > x1)
+ x1 = pbox->x1;
+ if (pbox->x2 < x2)
+ x2 = pbox->x2;
+ if (x1 < x2)
+ fb24_32BltDown(s,
+ 0,
+ (x1 - ppt->x),
+ d,
+ dstStride,
+ x1 + dstXoff,
+ (x2 - x1), 1, pGC->alu, pPriv->pm);
+ }
+ }
+ src += PixmapBytePad(*pwidth, pDrawable->depth);
+ ppt++;
+ pwidth++;
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
/*
* Clip and put 32bpp Z-format images to a 24bpp drawable
*/
void
-fb24_32PutZImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- int alu,
- FbBits pm,
- int x,
- int y,
- int width,
- int height,
- CARD8 *src,
- FbStride srcStride)
+fb24_32PutZImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int alu,
+ FbBits pm,
+ int x,
+ int y, int width, int height, CARD8 *src, FbStride srcStride)
{
- FbBits *dstBits;
- CARD8 *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- int nbox;
- BoxPtr pbox;
- int x1, y1, x2, y2;
-
- fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
+ FbBits *dstBits;
+ CARD8 *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ int nbox;
+ BoxPtr pbox;
+ int x1, y1, x2, y2;
+
+ fbGetDrawable(pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
dstStride *= sizeof(FbBits);
dst = (CARD8 *) dstBits;
- for (nbox = RegionNumRects (pClip),
- pbox = RegionRects(pClip);
- nbox--;
- pbox++)
- {
- x1 = x;
- y1 = y;
- x2 = x + width;
- y2 = y + height;
- if (x1 < pbox->x1)
- x1 = pbox->x1;
- if (y1 < pbox->y1)
- y1 = pbox->y1;
- if (x2 > pbox->x2)
- x2 = pbox->x2;
- if (y2 > pbox->y2)
- y2 = pbox->y2;
- if (x1 >= x2 || y1 >= y2)
- continue;
- fb24_32BltDown (src + (y1 - y) * srcStride,
- srcStride,
- (x1 - x),
-
- dst + (y1 + dstYoff) * dstStride,
- dstStride,
- x1 + dstXoff,
-
- (x2 - x1),
- (y2 - y1),
-
- alu,
- pm);
+ for (nbox = RegionNumRects(pClip),
+ pbox = RegionRects(pClip); nbox--; pbox++) {
+ x1 = x;
+ y1 = y;
+ x2 = x + width;
+ y2 = y + height;
+ if (x1 < pbox->x1)
+ x1 = pbox->x1;
+ if (y1 < pbox->y1)
+ y1 = pbox->y1;
+ if (x2 > pbox->x2)
+ x2 = pbox->x2;
+ if (y2 > pbox->y2)
+ y2 = pbox->y2;
+ if (x1 >= x2 || y1 >= y2)
+ continue;
+ fb24_32BltDown(src + (y1 - y) * srcStride,
+ srcStride,
+ (x1 - x),
+ dst + (y1 + dstYoff) * dstStride,
+ dstStride, x1 + dstXoff, (x2 - x1), (y2 - y1), alu, pm);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fb24_32GetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d)
+fb24_32GetImage(DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w,
+ int h, unsigned int format, unsigned long planeMask, char *d)
{
- FbBits *srcBits;
- CARD8 *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbStride dstStride;
- FbBits pm;
-
- fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
+ FbBits *srcBits;
+ CARD8 *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ FbStride dstStride;
+ FbBits pm;
+
+ fbGetDrawable(pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
src = (CARD8 *) srcBits;
- srcStride *= sizeof (FbBits);
+ srcStride *= sizeof(FbBits);
x += pDrawable->x;
y += pDrawable->y;
-
- pm = fbReplicatePixel (planeMask, 32);
+
+ pm = fbReplicatePixel(planeMask, 32);
dstStride = PixmapBytePad(w, pDrawable->depth);
if (pm != FB_ALLONES)
- memset (d, 0, dstStride * h);
- fb24_32BltUp (src + (y + srcYoff) * srcStride, srcStride, x + srcXoff,
- (CARD8 *) d, dstStride, 0,
- w, h, GXcopy, pm);
+ memset(d, 0, dstStride * h);
+ fb24_32BltUp(src + (y + srcYoff) * srcStride, srcStride, x + srcXoff,
+ (CARD8 *) d, dstStride, 0, w, h, GXcopy, pm);
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fb24_32CopyMtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
+fb24_32CopyMtoN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- FbBits *srcBits;
- CARD8 *src;
- FbStride srcStride;
- int srcBpp;
- FbBits *dstBits;
- CARD8 *dst;
- FbStride dstStride;
- int dstBpp;
- fb24_32BltFunc blt;
- int srcXoff, srcYoff;
- int dstXoff, dstYoff;
-
- fbGetDrawable (pSrcDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbBits *srcBits;
+ CARD8 *src;
+ FbStride srcStride;
+ int srcBpp;
+ FbBits *dstBits;
+ CARD8 *dst;
+ FbStride dstStride;
+ int dstBpp;
+ fb24_32BltFunc blt;
+ int srcXoff, srcYoff;
+ int dstXoff, dstYoff;
+
+ fbGetDrawable(pSrcDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff);
src = (CARD8 *) srcBits;
- srcStride *= sizeof (FbBits);
- fbGetDrawable (pDstDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
+ srcStride *= sizeof(FbBits);
+ fbGetDrawable(pDstDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff);
dst = (CARD8 *) dstBits;
- dstStride *= sizeof (FbBits);
+ dstStride *= sizeof(FbBits);
if (srcBpp == 24)
- blt = fb24_32BltUp;
+ blt = fb24_32BltUp;
else
- blt = fb24_32BltDown;
-
- while (nbox--)
- {
- (*blt) (src + (pbox->y1 + dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff),
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff),
-
- (pbox->x2 - pbox->x1),
- (pbox->y2 - pbox->y1),
-
- pGC->alu,
- pPriv->pm);
- pbox++;
+ blt = fb24_32BltDown;
+
+ while (nbox--) {
+ (*blt) (src + (pbox->y1 + dy + srcYoff) * srcStride,
+ srcStride,
+ (pbox->x1 + dx + srcXoff),
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff),
+ (pbox->x2 - pbox->x1),
+ (pbox->y2 - pbox->y1), pGC->alu, pPriv->pm);
+ pbox++;
}
- fbFinishAccess (pSrcDrawable);
- fbFinishAccess (pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
+ fbFinishAccess(pDstDrawable);
}
PixmapPtr
fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
{
- ScreenPtr pScreen = pOldTile->drawable.pScreen;
- PixmapPtr pNewTile;
- FbBits *old, *new;
- FbStride oldStride, newStride;
- int oldBpp, newBpp;
- fb24_32BltFunc blt;
- _X_UNUSED int oldXoff, oldYoff;
- _X_UNUSED int newXoff, newYoff;
+ ScreenPtr pScreen = pOldTile->drawable.pScreen;
+ PixmapPtr pNewTile;
+ FbBits *old, *new;
+ FbStride oldStride, newStride;
+ int oldBpp, newBpp;
+ fb24_32BltFunc blt;
+ _X_UNUSED int oldXoff, oldYoff;
+ _X_UNUSED int newXoff, newYoff;
pNewTile = pScreen->CreatePixmap(pScreen, pOldTile->drawable.width,
- pOldTile->drawable.height,
- pOldTile->drawable.depth,
- pOldTile->usage_hint);
+ pOldTile->drawable.height,
+ pOldTile->drawable.depth,
+ pOldTile->usage_hint);
if (!pNewTile)
- return 0;
- fbGetDrawable (&pOldTile->drawable,
- old, oldStride, oldBpp, oldXoff, oldYoff);
- fbGetDrawable (&pNewTile->drawable,
- new, newStride, newBpp, newXoff, newYoff);
+ return 0;
+ fbGetDrawable(&pOldTile->drawable,
+ old, oldStride, oldBpp, oldXoff, oldYoff);
+ fbGetDrawable(&pNewTile->drawable,
+ new, newStride, newBpp, newXoff, newYoff);
if (oldBpp == 24)
- blt = fb24_32BltUp;
+ blt = fb24_32BltUp;
else
- blt = fb24_32BltDown;
+ blt = fb24_32BltDown;
(*blt) ((CARD8 *) old,
- oldStride * sizeof (FbBits),
- 0,
-
- (CARD8 *) new,
- newStride * sizeof (FbBits),
- 0,
+ oldStride * sizeof(FbBits),
+ 0,
+ (CARD8 *) new,
+ newStride * sizeof(FbBits),
+ 0,
+ pOldTile->drawable.width,
+ pOldTile->drawable.height, GXcopy, FB_ALLONES);
- pOldTile->drawable.width,
- pOldTile->drawable.height,
-
- GXcopy,
- FB_ALLONES);
-
- fbFinishAccess (&pOldTile->drawable);
- fbFinishAccess (&pNewTile->drawable);
+ fbFinishAccess(&pOldTile->drawable);
+ fbFinishAccess(&pNewTile->drawable);
return pNewTile;
}
typedef struct {
- pointer pbits;
- int width;
+ pointer pbits;
+ int width;
} miScreenInitParmsRec, *miScreenInitParmsPtr;
Bool
@@ -591,45 +507,42 @@ fb24_32CreateScreenResources(ScreenPtr pScreen)
Bool retval;
/* get the pitch before mi destroys it */
- pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
+ pScrInitParms = (miScreenInitParmsPtr) pScreen->devPrivate;
pitch = BitmapBytePad(pScrInitParms->width * 24);
- if((retval = miCreateScreenResources(pScreen))) {
- /* fix the screen pixmap */
- PixmapPtr pPix = (PixmapPtr)pScreen->devPrivate;
- pPix->drawable.bitsPerPixel = 24;
- pPix->devKind = pitch;
+ if ((retval = miCreateScreenResources(pScreen))) {
+ /* fix the screen pixmap */
+ PixmapPtr pPix = (PixmapPtr) pScreen->devPrivate;
+
+ pPix->drawable.bitsPerPixel = 24;
+ pPix->devKind = pitch;
}
return retval;
}
Bool
-fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
- int width,
- int height,
- int depth,
- int bitsPerPixel,
- int devKind,
- pointer pPixData)
+fb24_32ModifyPixmapHeader(PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
{
- int bpp, w;
+ int bpp, w;
if (!pPixmap)
- return FALSE;
+ return FALSE;
bpp = bitsPerPixel;
if (bpp <= 0)
- bpp = pPixmap->drawable.bitsPerPixel;
- if (bpp == 24)
- {
- if (devKind < 0)
- {
- w = width;
- if (w <= 0)
- w = pPixmap->drawable.width;
- devKind = BitmapBytePad(w * 24);
- }
+ bpp = pPixmap->drawable.bitsPerPixel;
+ if (bpp == 24) {
+ if (devKind < 0) {
+ w = width;
+ if (w <= 0)
+ w = pPixmap->drawable.width;
+ devKind = BitmapBytePad(w * 24);
+ }
}
return miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel,
- devKind, pPixData);
-}
+ devKind, pPixData);
+}
diff --git a/xorg-server/fb/fb24_32.h b/xorg-server/fb/fb24_32.h
index 7c9819eba..1bec00b80 100644
--- a/xorg-server/fb/fb24_32.h
+++ b/xorg-server/fb/fb24_32.h
@@ -29,23 +29,16 @@
#define _FB24_32_H_
Bool
-fb24_32FinishScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp);
+
+fb24_32FinishScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize, int dpix, int dpiy, int width, int bpp);
Bool
-fb24_32ScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp);
+
+fb24_32ScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize, int ysize, int dpix, int dpiy, int width, int bpp);
#endif
diff --git a/xorg-server/fb/fballpriv.c b/xorg-server/fb/fballpriv.c
index 321903628..c6504f915 100644
--- a/xorg-server/fb/fballpriv.c
+++ b/xorg-server/fb/fballpriv.c
@@ -28,28 +28,39 @@
static DevPrivateKeyRec fbScreenPrivateKeyRec;
DevPrivateKey
-fbGetScreenPrivateKey(void) { return &fbScreenPrivateKeyRec; }
+fbGetScreenPrivateKey(void)
+{
+ return &fbScreenPrivateKeyRec;
+}
static DevPrivateKeyRec fbGCPrivateKeyRec;
DevPrivateKey
-fbGetGCPrivateKey (void) { return &fbGCPrivateKeyRec; }
+fbGetGCPrivateKey(void)
+{
+ return &fbGCPrivateKeyRec;
+}
static DevPrivateKeyRec fbWinPrivateKeyRec;
DevPrivateKey
-fbGetWinPrivateKey (void) { return &fbWinPrivateKeyRec; }
+fbGetWinPrivateKey(void)
+{
+ return &fbWinPrivateKeyRec;
+}
Bool
fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
{
if (pGCKey)
- *pGCKey = &fbGCPrivateKeyRec;
-
- if (!dixRegisterPrivateKey(&fbGCPrivateKeyRec, PRIVATE_GC, sizeof(FbGCPrivRec)))
- return FALSE;
- if (!dixRegisterPrivateKey(&fbScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof (FbScreenPrivRec)))
- return FALSE;
+ *pGCKey = &fbGCPrivateKeyRec;
+
+ if (!dixRegisterPrivateKey
+ (&fbGCPrivateKeyRec, PRIVATE_GC, sizeof(FbGCPrivRec)))
+ return FALSE;
+ if (!dixRegisterPrivateKey
+ (&fbScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof(FbScreenPrivRec)))
+ return FALSE;
if (!dixRegisterPrivateKey(&fbWinPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ return FALSE;
return TRUE;
}
diff --git a/xorg-server/fb/fbarc.c b/xorg-server/fb/fbarc.c
index e54c80491..c1b7f7785 100644
--- a/xorg-server/fb/fbarc.c
+++ b/xorg-server/fb/fbarc.c
@@ -28,115 +28,112 @@
#include "mizerarc.h"
#include <limits.h>
-typedef void (*FbArc) (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int dx,
- int dy,
- FbBits and,
- FbBits xor);
+typedef void (*FbArc) (FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ xArc * arc, int dx, int dy, FbBits and, FbBits xor);
void
-fbPolyArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *parcs)
+fbPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
{
- FbArc arc;
-
- if (pGC->lineWidth == 0)
- {
- arc = 0;
- if (pGC->lineStyle == LineSolid && pGC->fillStyle == FillSolid)
- {
- switch (pDrawable->bitsPerPixel)
- {
- case 8: arc = fbArc8; break;
- case 16: arc = fbArc16; break;
- case 24: arc = fbArc24; break;
- case 32: arc = fbArc32; break;
- }
- }
- if (arc)
- {
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- BoxRec box;
- int x2, y2;
- RegionPtr cclip;
+ FbArc arc;
+
+ if (pGC->lineWidth == 0) {
+ arc = 0;
+ if (pGC->lineStyle == LineSolid && pGC->fillStyle == FillSolid) {
+ switch (pDrawable->bitsPerPixel) {
+ case 8:
+ arc = fbArc8;
+ break;
+ case 16:
+ arc = fbArc16;
+ break;
+ case 24:
+ arc = fbArc24;
+ break;
+ case 32:
+ arc = fbArc32;
+ break;
+ }
+ }
+ if (arc) {
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ BoxRec box;
+ int x2, y2;
+ RegionPtr cclip;
+
#ifdef FB_ACCESS_WRAPPER
- int wrapped = 1;
+ int wrapped = 1;
#endif
-
- cclip = fbGetCompositeClip (pGC);
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- while (narcs--)
- {
- if (miCanZeroArc (parcs))
- {
- box.x1 = parcs->x + pDrawable->x;
- box.y1 = parcs->y + pDrawable->y;
- /*
- * Because box.x2 and box.y2 get truncated to 16 bits, and the
- * RECT_IN_REGION test treats the resulting number as a signed
- * integer, the RECT_IN_REGION test alone can go the wrong way.
- * This can result in a server crash because the rendering
- * routines in this file deal directly with cpu addresses
- * of pixels to be stored, and do not clip or otherwise check
- * that all such addresses are within their respective pixmaps.
- * So we only allow the RECT_IN_REGION test to be used for
- * values that can be expressed correctly in a signed short.
- */
- x2 = box.x1 + (int)parcs->width + 1;
- box.x2 = x2;
- y2 = box.y1 + (int)parcs->height + 1;
- box.y2 = y2;
- if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
- (RegionContainsRect(cclip, &box) == rgnIN) ) {
+
+ cclip = fbGetCompositeClip(pGC);
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ while (narcs--) {
+ if (miCanZeroArc(parcs)) {
+ box.x1 = parcs->x + pDrawable->x;
+ box.y1 = parcs->y + pDrawable->y;
+ /*
+ * Because box.x2 and box.y2 get truncated to 16 bits, and the
+ * RECT_IN_REGION test treats the resulting number as a signed
+ * integer, the RECT_IN_REGION test alone can go the wrong way.
+ * This can result in a server crash because the rendering
+ * routines in this file deal directly with cpu addresses
+ * of pixels to be stored, and do not clip or otherwise check
+ * that all such addresses are within their respective pixmaps.
+ * So we only allow the RECT_IN_REGION test to be used for
+ * values that can be expressed correctly in a signed short.
+ */
+ x2 = box.x1 + (int) parcs->width + 1;
+ box.x2 = x2;
+ y2 = box.y1 + (int) parcs->height + 1;
+ box.y2 = y2;
+ if ((x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
+ (RegionContainsRect(cclip, &box) == rgnIN)) {
#ifdef FB_ACCESS_WRAPPER
- if (!wrapped) {
- fbPrepareAccess (pDrawable);
- wrapped = 1;
- }
+ if (!wrapped) {
+ fbPrepareAccess(pDrawable);
+ wrapped = 1;
+ }
#endif
- (*arc) (dst, dstStride, dstBpp,
- parcs, pDrawable->x + dstXoff, pDrawable->y + dstYoff,
- pPriv->and, pPriv->xor);
- } else {
+ (*arc) (dst, dstStride, dstBpp,
+ parcs, pDrawable->x + dstXoff,
+ pDrawable->y + dstYoff, pPriv->and, pPriv->xor);
+ }
+ else {
#ifdef FB_ACCESS_WRAPPER
- if (wrapped) {
- fbFinishAccess (pDrawable);
- wrapped = 0;
- }
+ if (wrapped) {
+ fbFinishAccess(pDrawable);
+ wrapped = 0;
+ }
#endif
- miZeroPolyArc(pDrawable, pGC, 1, parcs);
- }
- }
- else {
+ miZeroPolyArc(pDrawable, pGC, 1, parcs);
+ }
+ }
+ else {
#ifdef FB_ACCESS_WRAPPER
- if (wrapped) {
- fbFinishAccess (pDrawable);
- wrapped = 0;
- }
+ if (wrapped) {
+ fbFinishAccess(pDrawable);
+ wrapped = 0;
+ }
#endif
- miPolyArc(pDrawable, pGC, 1, parcs);
- }
- parcs++;
- }
+ miPolyArc(pDrawable, pGC, 1, parcs);
+ }
+ parcs++;
+ }
#ifdef FB_ACCESS_WRAPPER
- if (wrapped) {
- fbFinishAccess (pDrawable);
- wrapped = 0;
- }
+ if (wrapped) {
+ fbFinishAccess(pDrawable);
+ wrapped = 0;
+ }
#endif
- }
- else
- miZeroPolyArc (pDrawable, pGC, narcs, parcs);
+ }
+ else
+ miZeroPolyArc(pDrawable, pGC, narcs, parcs);
}
else
- miPolyArc (pDrawable, pGC, narcs, parcs);
+ miPolyArc(pDrawable, pGC, narcs, parcs);
}
diff --git a/xorg-server/fb/fbbits.h b/xorg-server/fb/fbbits.h
index 80a61ddeb..be32d8cf0 100644
--- a/xorg-server/fb/fbbits.h
+++ b/xorg-server/fb/fbbits.h
@@ -1,971 +1,875 @@
-/*
- * Copyright © 1998 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This file defines functions for drawing some primitives using
- * underlying datatypes instead of masks
- */
-
-#define isClipped(c,ul,lr) (((c) | ((c) - (ul)) | ((lr) - (c))) & 0x80008000)
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifdef BITSMUL
-#define MUL BITSMUL
-#else
-#define MUL 1
-#endif
-
-#ifdef BITSSTORE
-#define STORE(b,x) BITSSTORE(b,x)
-#else
-#define STORE(b,x) WRITE((b), (x))
-#endif
-
-#ifdef BITSRROP
-#define RROP(b,a,x) BITSRROP(b,a,x)
-#else
-#define RROP(b,a,x) WRITE((b), FbDoRRop (READ(b), (a), (x)))
-#endif
-
-#ifdef BITSUNIT
-#define UNIT BITSUNIT
-#define USE_SOLID
-#else
-#define UNIT BITS
-#endif
-
-/*
- * Define the following before including this file:
- *
- * BRESSOLID name of function for drawing a solid segment
- * BRESDASH name of function for drawing a dashed segment
- * DOTS name of function for drawing dots
- * ARC name of function for drawing a solid arc
- * BITS type of underlying unit
- */
-
-#ifdef BRESSOLID
-void
-BRESSOLID (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
-{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- UNIT *bits;
- FbStride bitsStride;
- FbStride majorStep, minorStep;
- BITS xor = (BITS) pPriv->xor;
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- bits = ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
- bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
- if (signdy < 0)
- bitsStride = -bitsStride;
- if (axis == X_AXIS)
- {
- majorStep = signdx * MUL;
- minorStep = bitsStride;
- }
- else
- {
- majorStep = bitsStride;
- minorStep = signdx * MUL;
- }
- while (len--)
- {
- STORE(bits,xor);
- bits += majorStep;
- e += e1;
- if (e >= 0)
- {
- bits += minorStep;
- e += e3;
- }
- }
-
- fbFinishAccess (pDrawable);
-}
-#endif
-
-#ifdef BRESDASH
-void
-BRESDASH (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
-{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- UNIT *bits;
- FbStride bitsStride;
- FbStride majorStep, minorStep;
- BITS xorfg, xorbg;
- FbDashDeclare;
- int dashlen;
- Bool even;
- Bool doOdd;
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- doOdd = pGC->lineStyle == LineDoubleDash;
- xorfg = (BITS) pPriv->xor;
- xorbg = (BITS) pPriv->bgxor;
-
- FbDashInit (pGC, pPriv, dashOffset, dashlen, even);
-
- bits = ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
- bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
- if (signdy < 0)
- bitsStride = -bitsStride;
- if (axis == X_AXIS)
- {
- majorStep = signdx * MUL;
- minorStep = bitsStride;
- }
- else
- {
- majorStep = bitsStride;
- minorStep = signdx * MUL;
- }
- if (dashlen >= len)
- dashlen = len;
- if (doOdd)
- {
- if (!even)
- goto doubleOdd;
- for (;;)
- {
- len -= dashlen;
- while (dashlen--)
- {
- STORE(bits,xorfg);
- bits += majorStep;
- if ((e += e1) >= 0)
- {
- e += e3;
- bits += minorStep;
- }
- }
- if (!len)
- break;
-
- FbDashNextEven(dashlen);
-
- if (dashlen >= len)
- dashlen = len;
-doubleOdd:
- len -= dashlen;
- while (dashlen--)
- {
- STORE(bits,xorbg);
- bits += majorStep;
- if ((e += e1) >= 0)
- {
- e += e3;
- bits += minorStep;
- }
- }
- if (!len)
- break;
-
- FbDashNextOdd(dashlen);
-
- if (dashlen >= len)
- dashlen = len;
- }
- }
- else
- {
- if (!even)
- goto onOffOdd;
- for (;;)
- {
- len -= dashlen;
- while (dashlen--)
- {
- STORE(bits,xorfg);
- bits += majorStep;
- if ((e += e1) >= 0)
- {
- e += e3;
- bits += minorStep;
- }
- }
- if (!len)
- break;
-
- FbDashNextEven (dashlen);
-
- if (dashlen >= len)
- dashlen = len;
-onOffOdd:
- len -= dashlen;
- while (dashlen--)
- {
- bits += majorStep;
- if ((e += e1) >= 0)
- {
- e += e3;
- bits += minorStep;
- }
- }
- if (!len)
- break;
-
- FbDashNextOdd (dashlen);
-
- if (dashlen >= len)
- dashlen = len;
- }
- }
-
- fbFinishAccess (pDrawable);
-}
-#endif
-
-#ifdef DOTS
-void
-DOTS (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *ptsOrig,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor)
-{
- INT32 *pts = (INT32 *) ptsOrig;
- UNIT *bits = (UNIT *) dst;
- UNIT *point;
- BITS bxor = (BITS) xor;
- BITS band = (BITS) and;
- FbStride bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
- INT32 ul, lr;
- INT32 pt;
-
- ul = coordToInt(pBox->x1 - xorg, pBox->y1 - yorg);
- lr = coordToInt(pBox->x2 - xorg - 1, pBox->y2 - yorg - 1);
-
- bits += bitsStride * (yorg + yoff) + (xorg + xoff) * MUL;
-
- if (and == 0)
- {
- while (npt--)
- {
- pt = *pts++;
- if (!isClipped(pt,ul,lr))
- {
- point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
- STORE(point,bxor);
- }
- }
- }
- else
- {
- while (npt--)
- {
- pt = *pts++;
- if (!isClipped(pt,ul,lr))
- {
- point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
- RROP(point,band,bxor);
- }
- }
- }
-}
-#endif
-
-#ifdef ARC
-
-#define ARCCOPY(d) STORE(d,xorBits)
-#define ARCRROP(d) RROP(d,andBits,xorBits)
-
-void
-ARC (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- xArc *arc,
- int drawX,
- int drawY,
- FbBits and,
- FbBits xor)
-{
- UNIT *bits;
- FbStride bitsStride;
- miZeroArcRec info;
- Bool do360;
- int x;
- UNIT *yorgp, *yorgop;
- BITS andBits, xorBits;
- int yoffset, dyoffset;
- int y, a, b, d, mask;
- int k1, k3, dx, dy;
-
- bits = (UNIT *) dst;
- bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
- andBits = (BITS) and;
- xorBits = (BITS) xor;
- do360 = miZeroArcSetup(arc, &info, TRUE);
- yorgp = bits + ((info.yorg + drawY) * bitsStride);
- yorgop = bits + ((info.yorgo + drawY) * bitsStride);
- info.xorg = (info.xorg + drawX) * MUL;
- info.xorgo = (info.xorgo + drawX) * MUL;
- MIARCSETUP();
- yoffset = y ? bitsStride : 0;
- dyoffset = 0;
- mask = info.initialMask;
-
- if (!(arc->width & 1))
- {
- if (andBits == 0)
- {
- if (mask & 2)
- ARCCOPY(yorgp + info.xorgo);
- if (mask & 8)
- ARCCOPY(yorgop + info.xorgo);
- }
- else
- {
- if (mask & 2)
- ARCRROP(yorgp + info.xorgo);
- if (mask & 8)
- ARCRROP(yorgop + info.xorgo);
- }
- }
- if (!info.end.x || !info.end.y)
- {
- mask = info.end.mask;
- info.end = info.altend;
- }
- if (do360 && (arc->width == arc->height) && !(arc->width & 1))
- {
- int xoffset = bitsStride;
- UNIT *yorghb = yorgp + (info.h * bitsStride) + info.xorg;
- UNIT *yorgohb = yorghb - info.h * MUL;
-
- yorgp += info.xorg;
- yorgop += info.xorg;
- yorghb += info.h * MUL;
- while (1)
- {
- if (andBits == 0)
- {
- ARCCOPY(yorgp + yoffset + x * MUL);
- ARCCOPY(yorgp + yoffset - x * MUL);
- ARCCOPY(yorgop - yoffset - x * MUL);
- ARCCOPY(yorgop - yoffset + x * MUL);
- }
- else
- {
- ARCRROP(yorgp + yoffset + x * MUL);
- ARCRROP(yorgp + yoffset - x * MUL);
- ARCRROP(yorgop - yoffset - x * MUL);
- ARCRROP(yorgop - yoffset + x * MUL);
- }
- if (a < 0)
- break;
- if (andBits == 0)
- {
- ARCCOPY(yorghb - xoffset - y * MUL);
- ARCCOPY(yorgohb - xoffset + y * MUL);
- ARCCOPY(yorgohb + xoffset + y * MUL);
- ARCCOPY(yorghb + xoffset - y * MUL);
- }
- else
- {
- ARCRROP(yorghb - xoffset - y * MUL);
- ARCRROP(yorgohb - xoffset + y * MUL);
- ARCRROP(yorgohb + xoffset + y * MUL);
- ARCRROP(yorghb + xoffset - y * MUL);
- }
- xoffset += bitsStride;
- MIARCCIRCLESTEP(yoffset += bitsStride;);
- }
- yorgp -= info.xorg;
- yorgop -= info.xorg;
- x = info.w;
- yoffset = info.h * bitsStride;
- }
- else if (do360)
- {
- while (y < info.h || x < info.w)
- {
- MIARCOCTANTSHIFT(dyoffset = bitsStride;);
- if (andBits == 0)
- {
- ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
- ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
- ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
- ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
- }
- else
- {
- ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
- ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
- ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
- ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
- }
- MIARCSTEP(yoffset += dyoffset;, yoffset += bitsStride;);
- }
- }
- else
- {
- while (y < info.h || x < info.w)
- {
- MIARCOCTANTSHIFT(dyoffset = bitsStride;);
- if ((x == info.start.x) || (y == info.start.y))
- {
- mask = info.start.mask;
- info.start = info.altstart;
- }
- if (andBits == 0)
- {
- if (mask & 1)
- ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
- if (mask & 2)
- ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
- if (mask & 4)
- ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
- if (mask & 8)
- ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
- }
- else
- {
- if (mask & 1)
- ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
- if (mask & 2)
- ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
- if (mask & 4)
- ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
- if (mask & 8)
- ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
- }
- if ((x == info.end.x) || (y == info.end.y))
- {
- mask = info.end.mask;
- info.end = info.altend;
- }
- MIARCSTEP(yoffset += dyoffset;, yoffset += bitsStride;);
- }
- }
- if ((x == info.start.x) || (y == info.start.y))
- mask = info.start.mask;
- if (andBits == 0)
- {
- if (mask & 1)
- ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
- if (mask & 4)
- ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
- if (arc->height & 1)
- {
- if (mask & 2)
- ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
- if (mask & 8)
- ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
- }
- }
- else
- {
- if (mask & 1)
- ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
- if (mask & 4)
- ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
- if (arc->height & 1)
- {
- if (mask & 2)
- ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
- if (mask & 8)
- ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
- }
- }
-}
-#undef ARCCOPY
-#undef ARCRROP
-#endif
-
-#ifdef GLYPH
-#if BITMAP_BIT_ORDER == LSBFirst
-# define WRITE_ADDR1(n) (n)
-# define WRITE_ADDR2(n) (n)
-# define WRITE_ADDR4(n) (n)
-#else
-# define WRITE_ADDR1(n) ((n) ^ 3)
-# define WRITE_ADDR2(n) ((n) ^ 2)
-# define WRITE_ADDR4(n) ((n))
-#endif
-
-#define WRITE1(d,n,fg) WRITE(d + WRITE_ADDR1(n), (BITS) (fg))
-
-#ifdef BITS2
-# define WRITE2(d,n,fg) WRITE((BITS2 *) &((d)[WRITE_ADDR2(n)]), (BITS2) (fg))
-#else
-# define WRITE2(d,n,fg) (WRITE1(d,n,fg), WRITE1(d,(n)+1,fg))
-#endif
-
-#ifdef BITS4
-# define WRITE4(d,n,fg) WRITE((BITS4 *) &((d)[WRITE_ADDR4(n)]), (BITS4) (fg))
-#else
-# define WRITE4(d,n,fg) (WRITE2(d,n,fg), WRITE2(d,(n)+2,fg))
-#endif
-
-void
-GLYPH (FbBits *dstBits,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int x,
- int height)
-{
- int lshift;
- FbStip bits;
- BITS *dstLine;
- BITS *dst;
- int n;
- int shift;
-
- dstLine = (BITS *) dstBits;
- dstLine += x & ~3;
- dstStride *= (sizeof (FbBits) / sizeof (BITS));
- shift = x & 3;
- lshift = 4 - shift;
- while (height--)
- {
- bits = *stipple++;
- dst = (BITS *) dstLine;
- n = lshift;
- while (bits)
- {
- switch (FbStipMoveLsb (FbLeftStipBits (bits, n), 4, n)) {
- case 0:
- break;
- case 1:
- WRITE1(dst,0,fg);
- break;
- case 2:
- WRITE1(dst,1,fg);
- break;
- case 3:
- WRITE2(dst,0,fg);
- break;
- case 4:
- WRITE1(dst,2,fg);
- break;
- case 5:
- WRITE1(dst,0,fg);
- WRITE1(dst,2,fg);
- break;
- case 6:
- WRITE1(dst,1,fg);
- WRITE1(dst,2,fg);
- break;
- case 7:
- WRITE2(dst,0,fg);
- WRITE1(dst,2,fg);
- break;
- case 8:
- WRITE1(dst,3,fg);
- break;
- case 9:
- WRITE1(dst,0,fg);
- WRITE1(dst,3,fg);
- break;
- case 10:
- WRITE1(dst,1,fg);
- WRITE1(dst,3,fg);
- break;
- case 11:
- WRITE2(dst,0,fg);
- WRITE1(dst,3,fg);
- break;
- case 12:
- WRITE2(dst,2,fg);
- break;
- case 13:
- WRITE1(dst,0,fg);
- WRITE2(dst,2,fg);
- break;
- case 14:
- WRITE1(dst,1,fg);
- WRITE2(dst,2,fg);
- break;
- case 15:
- WRITE4(dst,0,fg);
- break;
- }
- bits = FbStipLeft (bits, n);
- n = 4;
- dst += 4;
- }
- dstLine += dstStride;
- }
-}
-#undef WRITE_ADDR1
-#undef WRITE_ADDR2
-#undef WRITE_ADDR4
-#undef WRITE1
-#undef WRITE2
-#undef WRITE4
-
-#endif
-
-#ifdef POLYLINE
-void
-POLYLINE (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ptsOrig)
-{
- INT32 *pts = (INT32 *) ptsOrig;
- int xoff = pDrawable->x;
- int yoff = pDrawable->y;
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
- BoxPtr pBox = RegionExtents(fbGetCompositeClip (pGC));
-
- FbBits *dst;
- int dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- UNIT *bits, *bitsBase;
- FbStride bitsStride;
- BITS xor = fbGetGCPrivate(pGC)->xor;
- BITS and = fbGetGCPrivate(pGC)->and;
- int dashoffset = 0;
-
- INT32 ul, lr;
- INT32 pt1, pt2;
-
- int e, e1, e3, len;
- int stepmajor, stepminor;
- int octant;
-
- if (mode == CoordModePrevious)
- fbFixCoordModePrevious (npt, ptsOrig);
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
- bitsBase = ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
- ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
- lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1);
-
- pt1 = *pts++;
- npt--;
- pt2 = *pts++;
- npt--;
- for (;;)
- {
- if (isClipped (pt1, ul, lr) | isClipped (pt2, ul, lr))
- {
- fbSegment (pDrawable, pGC,
- intToX(pt1) + xoff, intToY(pt1) + yoff,
- intToX(pt2) + xoff, intToY(pt2) + yoff,
- npt == 0 && pGC->capStyle != CapNotLast,
- &dashoffset);
- if (!npt) {
- fbFinishAccess (pDrawable);
- return;
- }
- pt1 = pt2;
- pt2 = *pts++;
- npt--;
- }
- else
- {
- bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
- for (;;)
- {
- CalcLineDeltas (intToX(pt1), intToY(pt1),
- intToX(pt2), intToY(pt2),
- len, e1, stepmajor, stepminor, 1, bitsStride,
- octant);
- stepmajor *= MUL;
- if (len < e1)
- {
- e3 = len;
- len = e1;
- e1 = e3;
-
- e3 = stepminor;
- stepminor = stepmajor;
- stepmajor = e3;
- SetYMajorOctant(octant);
- }
- e = -len;
- e1 <<= 1;
- e3 = e << 1;
- FIXUP_ERROR (e, octant, bias);
- if (and == 0)
- {
- while (len--)
- {
- STORE(bits,xor);
- bits += stepmajor;
- e += e1;
- if (e >= 0)
- {
- bits += stepminor;
- e += e3;
- }
- }
- }
- else
- {
- while (len--)
- {
- RROP(bits,and,xor);
- bits += stepmajor;
- e += e1;
- if (e >= 0)
- {
- bits += stepminor;
- e += e3;
- }
- }
- }
- if (!npt)
- {
- if (pGC->capStyle != CapNotLast &&
- pt2 != *((INT32 *) ptsOrig))
- {
- RROP(bits,and,xor);
- }
- fbFinishAccess (pDrawable);
- return;
- }
- pt1 = pt2;
- pt2 = *pts++;
- --npt;
- if (isClipped (pt2, ul, lr))
- break;
- }
- }
- }
-
- fbFinishAccess (pDrawable);
-}
-#endif
-
-#ifdef POLYSEGMENT
-void
-POLYSEGMENT (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg)
-{
- INT32 *pts = (INT32 *) pseg;
- int xoff = pDrawable->x;
- int yoff = pDrawable->y;
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
- BoxPtr pBox = RegionExtents(fbGetCompositeClip (pGC));
-
- FbBits *dst;
- int dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- UNIT *bits, *bitsBase;
- FbStride bitsStride;
- FbBits xorBits = fbGetGCPrivate(pGC)->xor;
- FbBits andBits = fbGetGCPrivate(pGC)->and;
- BITS xor = xorBits;
- BITS and = andBits;
- int dashoffset = 0;
-
- INT32 ul, lr;
- INT32 pt1, pt2;
-
- int e, e1, e3, len;
- int stepmajor, stepminor;
- int octant;
- Bool capNotLast;
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
- bitsBase = ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
- ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
- lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1);
-
- capNotLast = pGC->capStyle == CapNotLast;
-
- while (nseg--)
- {
- pt1 = *pts++;
- pt2 = *pts++;
- if (isClipped (pt1, ul, lr) | isClipped (pt2, ul, lr))
- {
- fbSegment (pDrawable, pGC,
- intToX(pt1) + xoff, intToY(pt1) + yoff,
- intToX(pt2) + xoff, intToY(pt2) + yoff,
- !capNotLast, &dashoffset);
- }
- else
- {
- CalcLineDeltas (intToX(pt1), intToY(pt1),
- intToX(pt2), intToY(pt2),
- len, e1, stepmajor, stepminor, 1, bitsStride,
- octant);
- if (e1 == 0 && len > 3
-#if MUL != 1
- && FbCheck24Pix(and) && FbCheck24Pix(xor)
-#endif
- )
- {
- int x1, x2;
- FbBits *dstLine;
- int dstX, width;
- FbBits startmask, endmask;
- int nmiddle;
-
- if (stepmajor < 0)
- {
- x1 = intToX(pt2);
- x2 = intToX(pt1) + 1;
- if (capNotLast)
- x1++;
- }
- else
- {
- x1 = intToX(pt1);
- x2 = intToX(pt2);
- if (!capNotLast)
- x2++;
- }
- dstX = (x1 + xoff + dstXoff) * (sizeof (UNIT) * 8 * MUL);
- width = (x2 - x1) * (sizeof (UNIT) * 8 * MUL);
-
- dstLine = dst + (intToY(pt1) + yoff + dstYoff) * dstStride;
- dstLine += dstX >> FB_SHIFT;
- dstX &= FB_MASK;
- FbMaskBits (dstX, width, startmask, nmiddle, endmask);
- if (startmask)
- {
- WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, startmask));
- dstLine++;
- }
- if (!andBits)
- while (nmiddle--)
- WRITE(dstLine++, xorBits);
- else
- while (nmiddle--)
- {
- WRITE(dstLine, FbDoRRop (READ(dstLine), andBits, xorBits));
- dstLine++;
- }
- if (endmask)
- WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, endmask));
- }
- else
- {
- stepmajor *= MUL;
- bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
- if (len < e1)
- {
- e3 = len;
- len = e1;
- e1 = e3;
-
- e3 = stepminor;
- stepminor = stepmajor;
- stepmajor = e3;
- SetYMajorOctant(octant);
- }
- e = -len;
- e1 <<= 1;
- e3 = e << 1;
- FIXUP_ERROR (e, octant, bias);
- if (!capNotLast)
- len++;
- if (and == 0)
- {
- while (len--)
- {
- STORE(bits,xor);
- bits += stepmajor;
- e += e1;
- if (e >= 0)
- {
- bits += stepminor;
- e += e3;
- }
- }
- }
- else
- {
- while (len--)
- {
- RROP(bits,and,xor);
- bits += stepmajor;
- e += e1;
- if (e >= 0)
- {
- bits += stepminor;
- e += e3;
- }
- }
- }
- }
- }
- }
-
- fbFinishAccess (pDrawable);
-}
-#endif
-
-#undef MUL
-#undef STORE
-#undef RROP
-#undef UNIT
-#undef USE_SOLID
-
-#undef isClipped
+/*
+ * Copyright © 1998 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file defines functions for drawing some primitives using
+ * underlying datatypes instead of masks
+ */
+
+#define isClipped(c,ul,lr) (((c) | ((c) - (ul)) | ((lr) - (c))) & 0x80008000)
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef BITSMUL
+#define MUL BITSMUL
+#else
+#define MUL 1
+#endif
+
+#ifdef BITSSTORE
+#define STORE(b,x) BITSSTORE(b,x)
+#else
+#define STORE(b,x) WRITE((b), (x))
+#endif
+
+#ifdef BITSRROP
+#define RROP(b,a,x) BITSRROP(b,a,x)
+#else
+#define RROP(b,a,x) WRITE((b), FbDoRRop (READ(b), (a), (x)))
+#endif
+
+#ifdef BITSUNIT
+#define UNIT BITSUNIT
+#define USE_SOLID
+#else
+#define UNIT BITS
+#endif
+
+/*
+ * Define the following before including this file:
+ *
+ * BRESSOLID name of function for drawing a solid segment
+ * BRESDASH name of function for drawing a dashed segment
+ * DOTS name of function for drawing dots
+ * ARC name of function for drawing a solid arc
+ * BITS type of underlying unit
+ */
+
+#ifdef BRESSOLID
+void
+BRESSOLID(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
+{
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ UNIT *bits;
+ FbStride bitsStride;
+ FbStride majorStep, minorStep;
+ BITS xor = (BITS) pPriv->xor;
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ bits =
+ ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
+ bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
+ if (signdy < 0)
+ bitsStride = -bitsStride;
+ if (axis == X_AXIS) {
+ majorStep = signdx * MUL;
+ minorStep = bitsStride;
+ }
+ else {
+ majorStep = bitsStride;
+ minorStep = signdx * MUL;
+ }
+ while (len--) {
+ STORE(bits, xor);
+ bits += majorStep;
+ e += e1;
+ if (e >= 0) {
+ bits += minorStep;
+ e += e3;
+ }
+ }
+
+ fbFinishAccess(pDrawable);
+}
+#endif
+
+#ifdef BRESDASH
+void
+BRESDASH(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
+{
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ UNIT *bits;
+ FbStride bitsStride;
+ FbStride majorStep, minorStep;
+ BITS xorfg, xorbg;
+
+ FbDashDeclare;
+ int dashlen;
+ Bool even;
+ Bool doOdd;
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ doOdd = pGC->lineStyle == LineDoubleDash;
+ xorfg = (BITS) pPriv->xor;
+ xorbg = (BITS) pPriv->bgxor;
+
+ FbDashInit(pGC, pPriv, dashOffset, dashlen, even);
+
+ bits =
+ ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
+ bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
+ if (signdy < 0)
+ bitsStride = -bitsStride;
+ if (axis == X_AXIS) {
+ majorStep = signdx * MUL;
+ minorStep = bitsStride;
+ }
+ else {
+ majorStep = bitsStride;
+ minorStep = signdx * MUL;
+ }
+ if (dashlen >= len)
+ dashlen = len;
+ if (doOdd) {
+ if (!even)
+ goto doubleOdd;
+ for (;;) {
+ len -= dashlen;
+ while (dashlen--) {
+ STORE(bits, xorfg);
+ bits += majorStep;
+ if ((e += e1) >= 0) {
+ e += e3;
+ bits += minorStep;
+ }
+ }
+ if (!len)
+ break;
+
+ FbDashNextEven(dashlen);
+
+ if (dashlen >= len)
+ dashlen = len;
+ doubleOdd:
+ len -= dashlen;
+ while (dashlen--) {
+ STORE(bits, xorbg);
+ bits += majorStep;
+ if ((e += e1) >= 0) {
+ e += e3;
+ bits += minorStep;
+ }
+ }
+ if (!len)
+ break;
+
+ FbDashNextOdd(dashlen);
+
+ if (dashlen >= len)
+ dashlen = len;
+ }
+ }
+ else {
+ if (!even)
+ goto onOffOdd;
+ for (;;) {
+ len -= dashlen;
+ while (dashlen--) {
+ STORE(bits, xorfg);
+ bits += majorStep;
+ if ((e += e1) >= 0) {
+ e += e3;
+ bits += minorStep;
+ }
+ }
+ if (!len)
+ break;
+
+ FbDashNextEven(dashlen);
+
+ if (dashlen >= len)
+ dashlen = len;
+ onOffOdd:
+ len -= dashlen;
+ while (dashlen--) {
+ bits += majorStep;
+ if ((e += e1) >= 0) {
+ e += e3;
+ bits += minorStep;
+ }
+ }
+ if (!len)
+ break;
+
+ FbDashNextOdd(dashlen);
+
+ if (dashlen >= len)
+ dashlen = len;
+ }
+ }
+
+ fbFinishAccess(pDrawable);
+}
+#endif
+
+#ifdef DOTS
+void
+DOTS(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * ptsOrig,
+ int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor)
+{
+ INT32 *pts = (INT32 *) ptsOrig;
+ UNIT *bits = (UNIT *) dst;
+ UNIT *point;
+ BITS bxor = (BITS) xor;
+ BITS band = (BITS) and;
+ FbStride bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
+ INT32 ul, lr;
+ INT32 pt;
+
+ ul = coordToInt(pBox->x1 - xorg, pBox->y1 - yorg);
+ lr = coordToInt(pBox->x2 - xorg - 1, pBox->y2 - yorg - 1);
+
+ bits += bitsStride * (yorg + yoff) + (xorg + xoff) * MUL;
+
+ if (and == 0) {
+ while (npt--) {
+ pt = *pts++;
+ if (!isClipped(pt, ul, lr)) {
+ point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
+ STORE(point, bxor);
+ }
+ }
+ }
+ else {
+ while (npt--) {
+ pt = *pts++;
+ if (!isClipped(pt, ul, lr)) {
+ point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
+ RROP(point, band, bxor);
+ }
+ }
+ }
+}
+#endif
+
+#ifdef ARC
+
+#define ARCCOPY(d) STORE(d,xorBits)
+#define ARCRROP(d) RROP(d,andBits,xorBits)
+
+void
+ARC(FbBits * dst,
+ FbStride dstStride,
+ int dstBpp, xArc * arc, int drawX, int drawY, FbBits and, FbBits xor)
+{
+ UNIT *bits;
+ FbStride bitsStride;
+ miZeroArcRec info;
+ Bool do360;
+ int x;
+ UNIT *yorgp, *yorgop;
+ BITS andBits, xorBits;
+ int yoffset, dyoffset;
+ int y, a, b, d, mask;
+ int k1, k3, dx, dy;
+
+ bits = (UNIT *) dst;
+ bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
+ andBits = (BITS) and;
+ xorBits = (BITS) xor;
+ do360 = miZeroArcSetup(arc, &info, TRUE);
+ yorgp = bits + ((info.yorg + drawY) * bitsStride);
+ yorgop = bits + ((info.yorgo + drawY) * bitsStride);
+ info.xorg = (info.xorg + drawX) * MUL;
+ info.xorgo = (info.xorgo + drawX) * MUL;
+ MIARCSETUP();
+ yoffset = y ? bitsStride : 0;
+ dyoffset = 0;
+ mask = info.initialMask;
+
+ if (!(arc->width & 1)) {
+ if (andBits == 0) {
+ if (mask & 2)
+ ARCCOPY(yorgp + info.xorgo);
+ if (mask & 8)
+ ARCCOPY(yorgop + info.xorgo);
+ }
+ else {
+ if (mask & 2)
+ ARCRROP(yorgp + info.xorgo);
+ if (mask & 8)
+ ARCRROP(yorgop + info.xorgo);
+ }
+ }
+ if (!info.end.x || !info.end.y) {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ if (do360 && (arc->width == arc->height) && !(arc->width & 1)) {
+ int xoffset = bitsStride;
+ UNIT *yorghb = yorgp + (info.h * bitsStride) + info.xorg;
+ UNIT *yorgohb = yorghb - info.h * MUL;
+
+ yorgp += info.xorg;
+ yorgop += info.xorg;
+ yorghb += info.h * MUL;
+ while (1) {
+ if (andBits == 0) {
+ ARCCOPY(yorgp + yoffset + x * MUL);
+ ARCCOPY(yorgp + yoffset - x * MUL);
+ ARCCOPY(yorgop - yoffset - x * MUL);
+ ARCCOPY(yorgop - yoffset + x * MUL);
+ }
+ else {
+ ARCRROP(yorgp + yoffset + x * MUL);
+ ARCRROP(yorgp + yoffset - x * MUL);
+ ARCRROP(yorgop - yoffset - x * MUL);
+ ARCRROP(yorgop - yoffset + x * MUL);
+ }
+ if (a < 0)
+ break;
+ if (andBits == 0) {
+ ARCCOPY(yorghb - xoffset - y * MUL);
+ ARCCOPY(yorgohb - xoffset + y * MUL);
+ ARCCOPY(yorgohb + xoffset + y * MUL);
+ ARCCOPY(yorghb + xoffset - y * MUL);
+ }
+ else {
+ ARCRROP(yorghb - xoffset - y * MUL);
+ ARCRROP(yorgohb - xoffset + y * MUL);
+ ARCRROP(yorgohb + xoffset + y * MUL);
+ ARCRROP(yorghb + xoffset - y * MUL);
+ }
+ xoffset += bitsStride;
+ MIARCCIRCLESTEP(yoffset += bitsStride;
+ );
+ }
+ yorgp -= info.xorg;
+ yorgop -= info.xorg;
+ x = info.w;
+ yoffset = info.h * bitsStride;
+ }
+ else if (do360) {
+ while (y < info.h || x < info.w) {
+ MIARCOCTANTSHIFT(dyoffset = bitsStride;
+ );
+ if (andBits == 0) {
+ ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
+ ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
+ ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
+ ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
+ }
+ else {
+ ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
+ ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
+ ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
+ ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
+ }
+ MIARCSTEP(yoffset += dyoffset;
+ , yoffset += bitsStride;
+ );
+ }
+ }
+ else {
+ while (y < info.h || x < info.w) {
+ MIARCOCTANTSHIFT(dyoffset = bitsStride;
+ );
+ if ((x == info.start.x) || (y == info.start.y)) {
+ mask = info.start.mask;
+ info.start = info.altstart;
+ }
+ if (andBits == 0) {
+ if (mask & 1)
+ ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
+ if (mask & 2)
+ ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
+ if (mask & 4)
+ ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
+ if (mask & 8)
+ ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
+ }
+ else {
+ if (mask & 1)
+ ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
+ if (mask & 2)
+ ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
+ if (mask & 4)
+ ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
+ if (mask & 8)
+ ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
+ }
+ if ((x == info.end.x) || (y == info.end.y)) {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ MIARCSTEP(yoffset += dyoffset;
+ , yoffset += bitsStride;
+ );
+ }
+ }
+ if ((x == info.start.x) || (y == info.start.y))
+ mask = info.start.mask;
+ if (andBits == 0) {
+ if (mask & 1)
+ ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
+ if (mask & 4)
+ ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
+ if (arc->height & 1) {
+ if (mask & 2)
+ ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
+ if (mask & 8)
+ ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
+ }
+ }
+ else {
+ if (mask & 1)
+ ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
+ if (mask & 4)
+ ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
+ if (arc->height & 1) {
+ if (mask & 2)
+ ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
+ if (mask & 8)
+ ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
+ }
+ }
+}
+
+#undef ARCCOPY
+#undef ARCRROP
+#endif
+
+#ifdef GLYPH
+#if BITMAP_BIT_ORDER == LSBFirst
+#define WRITE_ADDR1(n) (n)
+#define WRITE_ADDR2(n) (n)
+#define WRITE_ADDR4(n) (n)
+#else
+#define WRITE_ADDR1(n) ((n) ^ 3)
+#define WRITE_ADDR2(n) ((n) ^ 2)
+#define WRITE_ADDR4(n) ((n))
+#endif
+
+#define WRITE1(d,n,fg) WRITE(d + WRITE_ADDR1(n), (BITS) (fg))
+
+#ifdef BITS2
+#define WRITE2(d,n,fg) WRITE((BITS2 *) &((d)[WRITE_ADDR2(n)]), (BITS2) (fg))
+#else
+#define WRITE2(d,n,fg) (WRITE1(d,n,fg), WRITE1(d,(n)+1,fg))
+#endif
+
+#ifdef BITS4
+#define WRITE4(d,n,fg) WRITE((BITS4 *) &((d)[WRITE_ADDR4(n)]), (BITS4) (fg))
+#else
+#define WRITE4(d,n,fg) (WRITE2(d,n,fg), WRITE2(d,(n)+2,fg))
+#endif
+
+void
+GLYPH(FbBits * dstBits,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int x, int height)
+{
+ int lshift;
+ FbStip bits;
+ BITS *dstLine;
+ BITS *dst;
+ int n;
+ int shift;
+
+ dstLine = (BITS *) dstBits;
+ dstLine += x & ~3;
+ dstStride *= (sizeof(FbBits) / sizeof(BITS));
+ shift = x & 3;
+ lshift = 4 - shift;
+ while (height--) {
+ bits = *stipple++;
+ dst = (BITS *) dstLine;
+ n = lshift;
+ while (bits) {
+ switch (FbStipMoveLsb(FbLeftStipBits(bits, n), 4, n)) {
+ case 0:
+ break;
+ case 1:
+ WRITE1(dst, 0, fg);
+ break;
+ case 2:
+ WRITE1(dst, 1, fg);
+ break;
+ case 3:
+ WRITE2(dst, 0, fg);
+ break;
+ case 4:
+ WRITE1(dst, 2, fg);
+ break;
+ case 5:
+ WRITE1(dst, 0, fg);
+ WRITE1(dst, 2, fg);
+ break;
+ case 6:
+ WRITE1(dst, 1, fg);
+ WRITE1(dst, 2, fg);
+ break;
+ case 7:
+ WRITE2(dst, 0, fg);
+ WRITE1(dst, 2, fg);
+ break;
+ case 8:
+ WRITE1(dst, 3, fg);
+ break;
+ case 9:
+ WRITE1(dst, 0, fg);
+ WRITE1(dst, 3, fg);
+ break;
+ case 10:
+ WRITE1(dst, 1, fg);
+ WRITE1(dst, 3, fg);
+ break;
+ case 11:
+ WRITE2(dst, 0, fg);
+ WRITE1(dst, 3, fg);
+ break;
+ case 12:
+ WRITE2(dst, 2, fg);
+ break;
+ case 13:
+ WRITE1(dst, 0, fg);
+ WRITE2(dst, 2, fg);
+ break;
+ case 14:
+ WRITE1(dst, 1, fg);
+ WRITE2(dst, 2, fg);
+ break;
+ case 15:
+ WRITE4(dst, 0, fg);
+ break;
+ }
+ bits = FbStipLeft(bits, n);
+ n = 4;
+ dst += 4;
+ }
+ dstLine += dstStride;
+ }
+}
+
+#undef WRITE_ADDR1
+#undef WRITE_ADDR2
+#undef WRITE_ADDR4
+#undef WRITE1
+#undef WRITE2
+#undef WRITE4
+
+#endif
+
+#ifdef POLYLINE
+void
+POLYLINE(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig)
+{
+ INT32 *pts = (INT32 *) ptsOrig;
+ int xoff = pDrawable->x;
+ int yoff = pDrawable->y;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ BoxPtr pBox = RegionExtents(fbGetCompositeClip(pGC));
+
+ FbBits *dst;
+ int dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+
+ UNIT *bits, *bitsBase;
+ FbStride bitsStride;
+ BITS xor = fbGetGCPrivate(pGC)->xor;
+ BITS and = fbGetGCPrivate(pGC)->and;
+ int dashoffset = 0;
+
+ INT32 ul, lr;
+ INT32 pt1, pt2;
+
+ int e, e1, e3, len;
+ int stepmajor, stepminor;
+ int octant;
+
+ if (mode == CoordModePrevious)
+ fbFixCoordModePrevious(npt, ptsOrig);
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
+ bitsBase =
+ ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
+ ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
+ lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1);
+
+ pt1 = *pts++;
+ npt--;
+ pt2 = *pts++;
+ npt--;
+ for (;;) {
+ if (isClipped(pt1, ul, lr) | isClipped(pt2, ul, lr)) {
+ fbSegment(pDrawable, pGC,
+ intToX(pt1) + xoff, intToY(pt1) + yoff,
+ intToX(pt2) + xoff, intToY(pt2) + yoff,
+ npt == 0 && pGC->capStyle != CapNotLast, &dashoffset);
+ if (!npt) {
+ fbFinishAccess(pDrawable);
+ return;
+ }
+ pt1 = pt2;
+ pt2 = *pts++;
+ npt--;
+ }
+ else {
+ bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
+ for (;;) {
+ CalcLineDeltas(intToX(pt1), intToY(pt1),
+ intToX(pt2), intToY(pt2),
+ len, e1, stepmajor, stepminor, 1, bitsStride,
+ octant);
+ stepmajor *= MUL;
+ if (len < e1) {
+ e3 = len;
+ len = e1;
+ e1 = e3;
+
+ e3 = stepminor;
+ stepminor = stepmajor;
+ stepmajor = e3;
+ SetYMajorOctant(octant);
+ }
+ e = -len;
+ e1 <<= 1;
+ e3 = e << 1;
+ FIXUP_ERROR(e, octant, bias);
+ if (and == 0) {
+ while (len--) {
+ STORE(bits, xor);
+ bits += stepmajor;
+ e += e1;
+ if (e >= 0) {
+ bits += stepminor;
+ e += e3;
+ }
+ }
+ }
+ else {
+ while (len--) {
+ RROP(bits, and, xor);
+ bits += stepmajor;
+ e += e1;
+ if (e >= 0) {
+ bits += stepminor;
+ e += e3;
+ }
+ }
+ }
+ if (!npt) {
+ if (pGC->capStyle != CapNotLast &&
+ pt2 != *((INT32 *) ptsOrig)) {
+ RROP(bits, and, xor);
+ }
+ fbFinishAccess(pDrawable);
+ return;
+ }
+ pt1 = pt2;
+ pt2 = *pts++;
+ --npt;
+ if (isClipped(pt2, ul, lr))
+ break;
+ }
+ }
+ }
+
+ fbFinishAccess(pDrawable);
+}
+#endif
+
+#ifdef POLYSEGMENT
+void
+POLYSEGMENT(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
+{
+ INT32 *pts = (INT32 *) pseg;
+ int xoff = pDrawable->x;
+ int yoff = pDrawable->y;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ BoxPtr pBox = RegionExtents(fbGetCompositeClip(pGC));
+
+ FbBits *dst;
+ int dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+
+ UNIT *bits, *bitsBase;
+ FbStride bitsStride;
+ FbBits xorBits = fbGetGCPrivate(pGC)->xor;
+ FbBits andBits = fbGetGCPrivate(pGC)->and;
+ BITS xor = xorBits;
+ BITS and = andBits;
+ int dashoffset = 0;
+
+ INT32 ul, lr;
+ INT32 pt1, pt2;
+
+ int e, e1, e3, len;
+ int stepmajor, stepminor;
+ int octant;
+ Bool capNotLast;
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ bitsStride = dstStride * (sizeof(FbBits) / sizeof(UNIT));
+ bitsBase =
+ ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
+ ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
+ lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1);
+
+ capNotLast = pGC->capStyle == CapNotLast;
+
+ while (nseg--) {
+ pt1 = *pts++;
+ pt2 = *pts++;
+ if (isClipped(pt1, ul, lr) | isClipped(pt2, ul, lr)) {
+ fbSegment(pDrawable, pGC,
+ intToX(pt1) + xoff, intToY(pt1) + yoff,
+ intToX(pt2) + xoff, intToY(pt2) + yoff,
+ !capNotLast, &dashoffset);
+ }
+ else {
+ CalcLineDeltas(intToX(pt1), intToY(pt1),
+ intToX(pt2), intToY(pt2),
+ len, e1, stepmajor, stepminor, 1, bitsStride,
+ octant);
+ if (e1 == 0 && len > 3
+#if MUL != 1
+ && FbCheck24Pix(and) && FbCheck24Pix(xor)
+#endif
+ ) {
+ int x1, x2;
+ FbBits *dstLine;
+ int dstX, width;
+ FbBits startmask, endmask;
+ int nmiddle;
+
+ if (stepmajor < 0) {
+ x1 = intToX(pt2);
+ x2 = intToX(pt1) + 1;
+ if (capNotLast)
+ x1++;
+ }
+ else {
+ x1 = intToX(pt1);
+ x2 = intToX(pt2);
+ if (!capNotLast)
+ x2++;
+ }
+ dstX = (x1 + xoff + dstXoff) * (sizeof(UNIT) * 8 * MUL);
+ width = (x2 - x1) * (sizeof(UNIT) * 8 * MUL);
+
+ dstLine = dst + (intToY(pt1) + yoff + dstYoff) * dstStride;
+ dstLine += dstX >> FB_SHIFT;
+ dstX &= FB_MASK;
+ FbMaskBits(dstX, width, startmask, nmiddle, endmask);
+ if (startmask) {
+ WRITE(dstLine,
+ FbDoMaskRRop(READ(dstLine), andBits, xorBits,
+ startmask));
+ dstLine++;
+ }
+ if (!andBits)
+ while (nmiddle--)
+ WRITE(dstLine++, xorBits);
+ else
+ while (nmiddle--) {
+ WRITE(dstLine,
+ FbDoRRop(READ(dstLine), andBits, xorBits));
+ dstLine++;
+ }
+ if (endmask)
+ WRITE(dstLine,
+ FbDoMaskRRop(READ(dstLine), andBits, xorBits,
+ endmask));
+ }
+ else {
+ stepmajor *= MUL;
+ bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
+ if (len < e1) {
+ e3 = len;
+ len = e1;
+ e1 = e3;
+
+ e3 = stepminor;
+ stepminor = stepmajor;
+ stepmajor = e3;
+ SetYMajorOctant(octant);
+ }
+ e = -len;
+ e1 <<= 1;
+ e3 = e << 1;
+ FIXUP_ERROR(e, octant, bias);
+ if (!capNotLast)
+ len++;
+ if (and == 0) {
+ while (len--) {
+ STORE(bits, xor);
+ bits += stepmajor;
+ e += e1;
+ if (e >= 0) {
+ bits += stepminor;
+ e += e3;
+ }
+ }
+ }
+ else {
+ while (len--) {
+ RROP(bits, and, xor);
+ bits += stepmajor;
+ e += e1;
+ if (e >= 0) {
+ bits += stepminor;
+ e += e3;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ fbFinishAccess(pDrawable);
+}
+#endif
+
+#undef MUL
+#undef STORE
+#undef RROP
+#undef UNIT
+#undef USE_SOLID
+
+#undef isClipped
diff --git a/xorg-server/fb/fbblt.c b/xorg-server/fb/fbblt.c
index 680940467..17bd6986b 100644
--- a/xorg-server/fb/fbblt.c
+++ b/xorg-server/fb/fbblt.c
@@ -40,47 +40,38 @@
}
void
-fbBlt (FbBits *srcLine,
- FbStride srcStride,
- int srcX,
-
- FbBits *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp,
-
- Bool reverse,
- Bool upsidedown)
+fbBlt(FbBits * srcLine,
+ FbStride srcStride,
+ int srcX,
+ FbBits * dstLine,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown)
{
- FbBits *src, *dst;
- int leftShift, rightShift;
- FbBits startmask, endmask;
- FbBits bits, bits1;
- int n, nmiddle;
- Bool destInvarient;
- int startbyte, endbyte;
- int careful;
- FbDeclareMergeRop ();
-
- if (bpp == 24 && !FbCheck24Pix (pm))
- {
- fbBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX,
- width, height, alu, pm, reverse, upsidedown);
- return;
+ FbBits *src, *dst;
+ int leftShift, rightShift;
+ FbBits startmask, endmask;
+ FbBits bits, bits1;
+ int n, nmiddle;
+ Bool destInvarient;
+ int startbyte, endbyte;
+ int careful;
+
+ FbDeclareMergeRop();
+
+ if (bpp == 24 && !FbCheck24Pix(pm)) {
+ fbBlt24(srcLine, srcStride, srcX, dstLine, dstStride, dstX,
+ width, height, alu, pm, reverse, upsidedown);
+ return;
}
- careful = !((srcLine < dstLine && srcLine + width * (bpp>>3) > dstLine) ||
- (dstLine < srcLine && dstLine + width * (bpp>>3) > srcLine)) ||
- (bpp & 7);
+ careful = !((srcLine < dstLine && srcLine + width * (bpp >> 3) > dstLine) ||
+ (dstLine < srcLine && dstLine + width * (bpp >> 3) > srcLine))
+ || (bpp & 7);
if (alu == GXcopy && pm == FB_ALLONES && !careful &&
- !(srcX & 7) && !(dstX & 7) && !(width & 7)) {
+ !(srcX & 7) && !(dstX & 7) && !(width & 7)) {
int i;
CARD8 *src = (CARD8 *) srcLine;
CARD8 *dst = (CARD8 *) dstLine;
@@ -103,506 +94,423 @@ fbBlt (FbBits *srcLine,
FbInitializeMergeRop(alu, pm);
destInvarient = FbDestInvarientMergeRop();
- if (upsidedown)
- {
- srcLine += (height - 1) * (srcStride);
- dstLine += (height - 1) * (dstStride);
- srcStride = -srcStride;
- dstStride = -dstStride;
+ if (upsidedown) {
+ srcLine += (height - 1) * (srcStride);
+ dstLine += (height - 1) * (dstStride);
+ srcStride = -srcStride;
+ dstStride = -dstStride;
}
- FbMaskBitsBytes (dstX, width, destInvarient, startmask, startbyte,
- nmiddle, endmask, endbyte);
- if (reverse)
- {
- srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1;
- dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1;
- srcX = (srcX + width - 1) & FB_MASK;
- dstX = (dstX + width - 1) & FB_MASK;
+ FbMaskBitsBytes(dstX, width, destInvarient, startmask, startbyte,
+ nmiddle, endmask, endbyte);
+ if (reverse) {
+ srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1;
+ dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1;
+ srcX = (srcX + width - 1) & FB_MASK;
+ dstX = (dstX + width - 1) & FB_MASK;
}
- else
- {
- srcLine += srcX >> FB_SHIFT;
- dstLine += dstX >> FB_SHIFT;
- srcX &= FB_MASK;
- dstX &= FB_MASK;
+ else {
+ srcLine += srcX >> FB_SHIFT;
+ dstLine += dstX >> FB_SHIFT;
+ srcX &= FB_MASK;
+ dstX &= FB_MASK;
}
- if (srcX == dstX)
- {
- while (height--)
- {
- src = srcLine;
- srcLine += srcStride;
- dst = dstLine;
- dstLine += dstStride;
- if (reverse)
- {
- if (endmask)
- {
- bits = READ(--src);
- --dst;
- FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- WRITE(--dst, FbDoDestInvarientMergeRop(READ(--src)));
- }
- else
- {
- while (n--)
- {
- bits = READ(--src);
- --dst;
- WRITE(dst, FbDoMergeRop (bits, READ(dst)));
- }
- }
- if (startmask)
- {
- bits = READ(--src);
- --dst;
- FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
- }
- }
- else
- {
- if (startmask)
- {
- bits = READ(src++);
- FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
- dst++;
- }
- n = nmiddle;
- if (destInvarient)
- {
+ if (srcX == dstX) {
+ while (height--) {
+ src = srcLine;
+ srcLine += srcStride;
+ dst = dstLine;
+ dstLine += dstStride;
+ if (reverse) {
+ if (endmask) {
+ bits = READ(--src);
+ --dst;
+ FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
+ }
+ n = nmiddle;
+ if (destInvarient) {
+ while (n--)
+ WRITE(--dst, FbDoDestInvarientMergeRop(READ(--src)));
+ }
+ else {
+ while (n--) {
+ bits = READ(--src);
+ --dst;
+ WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+ }
+ }
+ if (startmask) {
+ bits = READ(--src);
+ --dst;
+ FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
+ }
+ }
+ else {
+ if (startmask) {
+ bits = READ(src++);
+ FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
+ dst++;
+ }
+ n = nmiddle;
+ if (destInvarient) {
#if 0
- /*
- * This provides some speedup on screen->screen blts
- * over the PCI bus, usually about 10%. But fb
- * isn't usually used for this operation...
- */
- if (_ca2 + 1 == 0 && _cx2 == 0)
- {
- FbBits t1, t2, t3, t4;
- while (n >= 4)
- {
- t1 = *src++;
- t2 = *src++;
- t3 = *src++;
- t4 = *src++;
- *dst++ = t1;
- *dst++ = t2;
- *dst++ = t3;
- *dst++ = t4;
- n -= 4;
- }
- }
+ /*
+ * This provides some speedup on screen->screen blts
+ * over the PCI bus, usually about 10%. But fb
+ * isn't usually used for this operation...
+ */
+ if (_ca2 + 1 == 0 && _cx2 == 0) {
+ FbBits t1, t2, t3, t4;
+
+ while (n >= 4) {
+ t1 = *src++;
+ t2 = *src++;
+ t3 = *src++;
+ t4 = *src++;
+ *dst++ = t1;
+ *dst++ = t2;
+ *dst++ = t3;
+ *dst++ = t4;
+ n -= 4;
+ }
+ }
#endif
- while (n--)
- WRITE(dst++, FbDoDestInvarientMergeRop(READ(src++)));
- }
- else
- {
- while (n--)
- {
- bits = READ(src++);
- WRITE(dst, FbDoMergeRop (bits, READ(dst)));
- dst++;
- }
- }
- if (endmask)
- {
- bits = READ(src);
- FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
- }
- }
- }
+ while (n--)
+ WRITE(dst++, FbDoDestInvarientMergeRop(READ(src++)));
+ }
+ else {
+ while (n--) {
+ bits = READ(src++);
+ WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+ dst++;
+ }
+ }
+ if (endmask) {
+ bits = READ(src);
+ FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
+ }
+ }
+ }
}
- else
- {
- if (srcX > dstX)
- {
- leftShift = srcX - dstX;
- rightShift = FB_UNIT - leftShift;
- }
- else
- {
- rightShift = dstX - srcX;
- leftShift = FB_UNIT - rightShift;
- }
- while (height--)
- {
- src = srcLine;
- srcLine += srcStride;
- dst = dstLine;
- dstLine += dstStride;
-
- bits1 = 0;
- if (reverse)
- {
- if (srcX < dstX)
- bits1 = READ(--src);
- if (endmask)
- {
- bits = FbScrRight(bits1, rightShift);
- if (FbScrRight(endmask, leftShift))
- {
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- }
- --dst;
- FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- {
- bits = FbScrRight(bits1, rightShift);
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- --dst;
- WRITE(dst, FbDoDestInvarientMergeRop(bits));
- }
- }
- else
- {
- while (n--)
- {
- bits = FbScrRight(bits1, rightShift);
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- --dst;
- WRITE(dst, FbDoMergeRop(bits, READ(dst)));
- }
- }
- if (startmask)
- {
- bits = FbScrRight(bits1, rightShift);
- if (FbScrRight(startmask, leftShift))
- {
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- }
- --dst;
- FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask);
- }
- }
- else
- {
- if (srcX > dstX)
- bits1 = READ(src++);
- if (startmask)
- {
- bits = FbScrLeft(bits1, leftShift);
- if (FbScrLeft(startmask, rightShift))
- {
- bits1 = READ(src++);
- bits |= FbScrRight(bits1, rightShift);
- }
- FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask);
- dst++;
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- {
- bits = FbScrLeft(bits1, leftShift);
- bits1 = READ(src++);
- bits |= FbScrRight(bits1, rightShift);
- WRITE(dst, FbDoDestInvarientMergeRop(bits));
- dst++;
- }
- }
- else
- {
- while (n--)
- {
- bits = FbScrLeft(bits1, leftShift);
- bits1 = READ(src++);
- bits |= FbScrRight(bits1, rightShift);
- WRITE(dst, FbDoMergeRop(bits, READ(dst)));
- dst++;
- }
- }
- if (endmask)
- {
- bits = FbScrLeft(bits1, leftShift);
- if (FbScrLeft(endmask, rightShift))
- {
- bits1 = READ(src);
- bits |= FbScrRight(bits1, rightShift);
- }
- FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask);
- }
- }
- }
+ else {
+ if (srcX > dstX) {
+ leftShift = srcX - dstX;
+ rightShift = FB_UNIT - leftShift;
+ }
+ else {
+ rightShift = dstX - srcX;
+ leftShift = FB_UNIT - rightShift;
+ }
+ while (height--) {
+ src = srcLine;
+ srcLine += srcStride;
+ dst = dstLine;
+ dstLine += dstStride;
+
+ bits1 = 0;
+ if (reverse) {
+ if (srcX < dstX)
+ bits1 = READ(--src);
+ if (endmask) {
+ bits = FbScrRight(bits1, rightShift);
+ if (FbScrRight(endmask, leftShift)) {
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ }
+ --dst;
+ FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
+ }
+ n = nmiddle;
+ if (destInvarient) {
+ while (n--) {
+ bits = FbScrRight(bits1, rightShift);
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ --dst;
+ WRITE(dst, FbDoDestInvarientMergeRop(bits));
+ }
+ }
+ else {
+ while (n--) {
+ bits = FbScrRight(bits1, rightShift);
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ --dst;
+ WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+ }
+ }
+ if (startmask) {
+ bits = FbScrRight(bits1, rightShift);
+ if (FbScrRight(startmask, leftShift)) {
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ }
+ --dst;
+ FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
+ }
+ }
+ else {
+ if (srcX > dstX)
+ bits1 = READ(src++);
+ if (startmask) {
+ bits = FbScrLeft(bits1, leftShift);
+ if (FbScrLeft(startmask, rightShift)) {
+ bits1 = READ(src++);
+ bits |= FbScrRight(bits1, rightShift);
+ }
+ FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
+ dst++;
+ }
+ n = nmiddle;
+ if (destInvarient) {
+ while (n--) {
+ bits = FbScrLeft(bits1, leftShift);
+ bits1 = READ(src++);
+ bits |= FbScrRight(bits1, rightShift);
+ WRITE(dst, FbDoDestInvarientMergeRop(bits));
+ dst++;
+ }
+ }
+ else {
+ while (n--) {
+ bits = FbScrLeft(bits1, leftShift);
+ bits1 = READ(src++);
+ bits |= FbScrRight(bits1, rightShift);
+ WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+ dst++;
+ }
+ }
+ if (endmask) {
+ bits = FbScrLeft(bits1, leftShift);
+ if (FbScrLeft(endmask, rightShift)) {
+ bits1 = READ(src);
+ bits |= FbScrRight(bits1, rightShift);
+ }
+ FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
+ }
+ }
+ }
}
}
-
#undef DEBUG_BLT24
#ifdef DEBUG_BLT24
static unsigned long
-getPixel (char *src, int x)
+getPixel(char *src, int x)
{
- unsigned long l;
+ unsigned long l;
l = 0;
- memcpy (&l, src + x * 3, 3);
+ memcpy(&l, src + x * 3, 3);
return l;
}
#endif
static void
-fbBlt24Line (FbBits *src,
- int srcX,
-
- FbBits *dst,
- int dstX,
-
- int width,
-
- int alu,
- FbBits pm,
-
- Bool reverse)
+fbBlt24Line(FbBits * src,
+ int srcX,
+ FbBits * dst, int dstX, int width, int alu, FbBits pm, Bool reverse)
{
#ifdef DEBUG_BLT24
- char *origDst = (char *) dst;
- FbBits *origLine = dst + ((dstX >> FB_SHIFT) - 1);
- int origNlw = ((width + FB_MASK) >> FB_SHIFT) + 3;
- int origX = dstX / 24;
+ char *origDst = (char *) dst;
+ FbBits *origLine = dst + ((dstX >> FB_SHIFT) - 1);
+ int origNlw = ((width + FB_MASK) >> FB_SHIFT) + 3;
+ int origX = dstX / 24;
#endif
-
- int leftShift, rightShift;
- FbBits startmask, endmask;
- int n;
-
- FbBits bits, bits1;
- FbBits mask;
-
- int rot;
- FbDeclareMergeRop ();
-
- FbInitializeMergeRop (alu, FB_ALLONES);
+
+ int leftShift, rightShift;
+ FbBits startmask, endmask;
+ int n;
+
+ FbBits bits, bits1;
+ FbBits mask;
+
+ int rot;
+
+ FbDeclareMergeRop();
+
+ FbInitializeMergeRop(alu, FB_ALLONES);
FbMaskBits(dstX, width, startmask, n, endmask);
#ifdef DEBUG_BLT24
- ErrorF ("dstX %d width %d reverse %d\n", dstX, width, reverse);
+ ErrorF("dstX %d width %d reverse %d\n", dstX, width, reverse);
#endif
- if (reverse)
- {
- src += ((srcX + width - 1) >> FB_SHIFT) + 1;
- dst += ((dstX + width - 1) >> FB_SHIFT) + 1;
- rot = FbFirst24Rot (((dstX + width - 8) & FB_MASK));
- rot = FbPrev24Rot(rot);
+ if (reverse) {
+ src += ((srcX + width - 1) >> FB_SHIFT) + 1;
+ dst += ((dstX + width - 1) >> FB_SHIFT) + 1;
+ rot = FbFirst24Rot(((dstX + width - 8) & FB_MASK));
+ rot = FbPrev24Rot(rot);
#ifdef DEBUG_BLT24
- ErrorF ("dstX + width - 8: %d rot: %d\n", (dstX + width - 8) & FB_MASK, rot);
+ ErrorF("dstX + width - 8: %d rot: %d\n", (dstX + width - 8) & FB_MASK,
+ rot);
#endif
- srcX = (srcX + width - 1) & FB_MASK;
- dstX = (dstX + width - 1) & FB_MASK;
+ srcX = (srcX + width - 1) & FB_MASK;
+ dstX = (dstX + width - 1) & FB_MASK;
}
- else
- {
- src += srcX >> FB_SHIFT;
- dst += dstX >> FB_SHIFT;
- srcX &= FB_MASK;
- dstX &= FB_MASK;
- rot = FbFirst24Rot (dstX);
+ else {
+ src += srcX >> FB_SHIFT;
+ dst += dstX >> FB_SHIFT;
+ srcX &= FB_MASK;
+ dstX &= FB_MASK;
+ rot = FbFirst24Rot(dstX);
#ifdef DEBUG_BLT24
- ErrorF ("dstX: %d rot: %d\n", dstX, rot);
+ ErrorF("dstX: %d rot: %d\n", dstX, rot);
#endif
}
- mask = FbRot24(pm,rot);
+ mask = FbRot24(pm, rot);
#ifdef DEBUG_BLT24
- ErrorF ("pm 0x%x mask 0x%x\n", pm, mask);
+ ErrorF("pm 0x%x mask 0x%x\n", pm, mask);
#endif
- if (srcX == dstX)
- {
- if (reverse)
- {
- if (endmask)
- {
- bits = READ(--src);
- --dst;
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
- mask = FbPrev24Pix (mask);
- }
- while (n--)
- {
- bits = READ(--src);
- --dst;
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask));
- mask = FbPrev24Pix (mask);
- }
- if (startmask)
- {
- bits = READ(--src);
- --dst;
- WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
- }
- }
- else
- {
- if (startmask)
- {
- bits = READ(src++);
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
- dst++;
- mask = FbNext24Pix(mask);
- }
- while (n--)
- {
- bits = READ(src++);
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask));
- dst++;
- mask = FbNext24Pix(mask);
- }
- if (endmask)
- {
- bits = READ(src);
- WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
- }
- }
+ if (srcX == dstX) {
+ if (reverse) {
+ if (endmask) {
+ bits = READ(--src);
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
+ mask = FbPrev24Pix(mask);
+ }
+ while (n--) {
+ bits = READ(--src);
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
+ mask = FbPrev24Pix(mask);
+ }
+ if (startmask) {
+ bits = READ(--src);
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
+ }
+ }
+ else {
+ if (startmask) {
+ bits = READ(src++);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
+ dst++;
+ mask = FbNext24Pix(mask);
+ }
+ while (n--) {
+ bits = READ(src++);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
+ dst++;
+ mask = FbNext24Pix(mask);
+ }
+ if (endmask) {
+ bits = READ(src);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
+ }
+ }
}
- else
- {
- if (srcX > dstX)
- {
- leftShift = srcX - dstX;
- rightShift = FB_UNIT - leftShift;
- }
- else
- {
- rightShift = dstX - srcX;
- leftShift = FB_UNIT - rightShift;
- }
-
- bits1 = 0;
- if (reverse)
- {
- if (srcX < dstX)
- bits1 = READ(--src);
- if (endmask)
- {
- bits = FbScrRight(bits1, rightShift);
- if (FbScrRight(endmask, leftShift))
- {
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- }
- --dst;
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
- mask = FbPrev24Pix(mask);
- }
- while (n--)
- {
- bits = FbScrRight(bits1, rightShift);
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- --dst;
- WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
- mask = FbPrev24Pix(mask);
- }
- if (startmask)
- {
- bits = FbScrRight(bits1, rightShift);
- if (FbScrRight(startmask, leftShift))
- {
- bits1 = READ(--src);
- bits |= FbScrLeft(bits1, leftShift);
- }
- --dst;
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
- }
- }
- else
- {
- if (srcX > dstX)
- bits1 = READ(src++);
- if (startmask)
- {
- bits = FbScrLeft(bits1, leftShift);
- bits1 = READ(src++);
- bits |= FbScrRight(bits1, rightShift);
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
- dst++;
- mask = FbNext24Pix(mask);
- }
- while (n--)
- {
- bits = FbScrLeft(bits1, leftShift);
- bits1 = READ(src++);
- bits |= FbScrRight(bits1, rightShift);
- WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
- dst++;
- mask = FbNext24Pix(mask);
- }
- if (endmask)
- {
- bits = FbScrLeft(bits1, leftShift);
- if (FbScrLeft(endmask, rightShift))
- {
- bits1 = READ(src);
- bits |= FbScrRight(bits1, rightShift);
- }
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
- }
- }
+ else {
+ if (srcX > dstX) {
+ leftShift = srcX - dstX;
+ rightShift = FB_UNIT - leftShift;
+ }
+ else {
+ rightShift = dstX - srcX;
+ leftShift = FB_UNIT - rightShift;
+ }
+
+ bits1 = 0;
+ if (reverse) {
+ if (srcX < dstX)
+ bits1 = READ(--src);
+ if (endmask) {
+ bits = FbScrRight(bits1, rightShift);
+ if (FbScrRight(endmask, leftShift)) {
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ }
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
+ mask = FbPrev24Pix(mask);
+ }
+ while (n--) {
+ bits = FbScrRight(bits1, rightShift);
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
+ mask = FbPrev24Pix(mask);
+ }
+ if (startmask) {
+ bits = FbScrRight(bits1, rightShift);
+ if (FbScrRight(startmask, leftShift)) {
+ bits1 = READ(--src);
+ bits |= FbScrLeft(bits1, leftShift);
+ }
+ --dst;
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
+ }
+ }
+ else {
+ if (srcX > dstX)
+ bits1 = READ(src++);
+ if (startmask) {
+ bits = FbScrLeft(bits1, leftShift);
+ bits1 = READ(src++);
+ bits |= FbScrRight(bits1, rightShift);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
+ dst++;
+ mask = FbNext24Pix(mask);
+ }
+ while (n--) {
+ bits = FbScrLeft(bits1, leftShift);
+ bits1 = READ(src++);
+ bits |= FbScrRight(bits1, rightShift);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
+ dst++;
+ mask = FbNext24Pix(mask);
+ }
+ if (endmask) {
+ bits = FbScrLeft(bits1, leftShift);
+ if (FbScrLeft(endmask, rightShift)) {
+ bits1 = READ(src);
+ bits |= FbScrRight(bits1, rightShift);
+ }
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
+ }
+ }
}
#ifdef DEBUG_BLT24
{
- int firstx, lastx, x;
-
- firstx = origX;
- if (firstx)
- firstx--;
- lastx = origX + width/24 + 1;
- for (x = firstx; x <= lastx; x++)
- ErrorF ("%06x ", getPixel (origDst, x));
- ErrorF ("\n");
- while (origNlw--)
- ErrorF ("%08x ", *origLine++);
- ErrorF ("\n");
+ int firstx, lastx, x;
+
+ firstx = origX;
+ if (firstx)
+ firstx--;
+ lastx = origX + width / 24 + 1;
+ for (x = firstx; x <= lastx; x++)
+ ErrorF("%06x ", getPixel(origDst, x));
+ ErrorF("\n");
+ while (origNlw--)
+ ErrorF("%08x ", *origLine++);
+ ErrorF("\n");
}
#endif
}
void
-fbBlt24 (FbBits *srcLine,
- FbStride srcStride,
- int srcX,
-
- FbBits *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
-
- Bool reverse,
- Bool upsidedown)
+fbBlt24(FbBits * srcLine,
+ FbStride srcStride,
+ int srcX,
+ FbBits * dstLine,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height, int alu, FbBits pm, Bool reverse, Bool upsidedown)
{
- if (upsidedown)
- {
- srcLine += (height-1) * srcStride;
- dstLine += (height-1) * dstStride;
- srcStride = -srcStride;
- dstStride = -dstStride;
+ if (upsidedown) {
+ srcLine += (height - 1) * srcStride;
+ dstLine += (height - 1) * dstStride;
+ srcStride = -srcStride;
+ dstStride = -dstStride;
}
- while (height--)
- {
- fbBlt24Line (srcLine, srcX, dstLine, dstX, width, alu, pm, reverse);
- srcLine += srcStride;
- dstLine += dstStride;
+ while (height--) {
+ fbBlt24Line(srcLine, srcX, dstLine, dstX, width, alu, pm, reverse);
+ srcLine += srcStride;
+ dstLine += dstStride;
}
#ifdef DEBUG_BLT24
- ErrorF ("\n");
+ ErrorF("\n");
#endif
}
@@ -614,49 +522,42 @@ fbBlt24 (FbBits *srcLine,
*/
void
-fbBltOdd (FbBits *srcLine,
- FbStride srcStrideEven,
- FbStride srcStrideOdd,
- int srcXEven,
- int srcXOdd,
-
- FbBits *dstLine,
- FbStride dstStrideEven,
- FbStride dstStrideOdd,
- int dstXEven,
- int dstXOdd,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp)
+fbBltOdd(FbBits * srcLine,
+ FbStride srcStrideEven,
+ FbStride srcStrideOdd,
+ int srcXEven,
+ int srcXOdd,
+ FbBits * dstLine,
+ FbStride dstStrideEven,
+ FbStride dstStrideOdd,
+ int dstXEven,
+ int dstXOdd, int width, int height, int alu, FbBits pm, int bpp)
{
- FbBits *src;
- int leftShiftEven, rightShiftEven;
- FbBits startmaskEven, endmaskEven;
- int nmiddleEven;
-
- FbBits *dst;
- int leftShiftOdd, rightShiftOdd;
- FbBits startmaskOdd, endmaskOdd;
- int nmiddleOdd;
-
- int leftShift, rightShift;
- FbBits startmask, endmask;
- int nmiddle;
-
- int srcX, dstX;
-
- FbBits bits, bits1;
- int n;
-
- Bool destInvarient;
- Bool even;
- FbDeclareMergeRop ();
-
- FbInitializeMergeRop (alu, pm);
+ FbBits *src;
+ int leftShiftEven, rightShiftEven;
+ FbBits startmaskEven, endmaskEven;
+ int nmiddleEven;
+
+ FbBits *dst;
+ int leftShiftOdd, rightShiftOdd;
+ FbBits startmaskOdd, endmaskOdd;
+ int nmiddleOdd;
+
+ int leftShift, rightShift;
+ FbBits startmask, endmask;
+ int nmiddle;
+
+ int srcX, dstX;
+
+ FbBits bits, bits1;
+ int n;
+
+ Bool destInvarient;
+ Bool even;
+
+ FbDeclareMergeRop();
+
+ FbInitializeMergeRop(alu, pm);
destInvarient = FbDestInvarientMergeRop();
srcLine += srcXEven >> FB_SHIFT;
@@ -668,162 +569,133 @@ fbBltOdd (FbBits *srcLine,
FbMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven);
FbMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd);
-
+
even = TRUE;
InitializeShifts(srcXEven, dstXEven, leftShiftEven, rightShiftEven);
InitializeShifts(srcXOdd, dstXOdd, leftShiftOdd, rightShiftOdd);
- while (height--)
- {
- src = srcLine;
- dst = dstLine;
- if (even)
- {
- srcX = srcXEven;
- dstX = dstXEven;
- startmask = startmaskEven;
- endmask = endmaskEven;
- nmiddle = nmiddleEven;
- leftShift = leftShiftEven;
- rightShift = rightShiftEven;
- srcLine += srcStrideEven;
- dstLine += dstStrideEven;
- even = FALSE;
- }
- else
- {
- srcX = srcXOdd;
- dstX = dstXOdd;
- startmask = startmaskOdd;
- endmask = endmaskOdd;
- nmiddle = nmiddleOdd;
- leftShift = leftShiftOdd;
- rightShift = rightShiftOdd;
- srcLine += srcStrideOdd;
- dstLine += dstStrideOdd;
- even = TRUE;
- }
- if (srcX == dstX)
- {
- if (startmask)
- {
- bits = READ(src++);
- WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), startmask));
- dst++;
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- {
- bits = READ(src++);
- WRITE(dst, FbDoDestInvarientMergeRop(bits));
- dst++;
- }
- }
- else
- {
- while (n--)
- {
- bits = READ(src++);
- WRITE(dst, FbDoMergeRop (bits, READ(dst)));
- dst++;
- }
- }
- if (endmask)
- {
- bits = READ(src);
- WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), endmask));
- }
- }
- else
- {
- bits = 0;
- if (srcX > dstX)
- bits = READ(src++);
- if (startmask)
- {
- bits1 = FbScrLeft(bits, leftShift);
- bits = READ(src++);
- bits1 |= FbScrRight(bits, rightShift);
- WRITE(dst, FbDoMaskMergeRop (bits1, READ(dst), startmask));
- dst++;
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- {
- bits1 = FbScrLeft(bits, leftShift);
- bits = READ(src++);
- bits1 |= FbScrRight(bits, rightShift);
- WRITE(dst, FbDoDestInvarientMergeRop(bits1));
- dst++;
- }
- }
- else
- {
- while (n--)
- {
- bits1 = FbScrLeft(bits, leftShift);
- bits = READ(src++);
- bits1 |= FbScrRight(bits, rightShift);
- WRITE(dst, FbDoMergeRop(bits1, READ(dst)));
- dst++;
- }
- }
- if (endmask)
- {
- bits1 = FbScrLeft(bits, leftShift);
- if (FbScrLeft(endmask, rightShift))
- {
- bits = READ(src);
- bits1 |= FbScrRight(bits, rightShift);
- }
- WRITE(dst, FbDoMaskMergeRop (bits1, READ(dst), endmask));
- }
- }
+ while (height--) {
+ src = srcLine;
+ dst = dstLine;
+ if (even) {
+ srcX = srcXEven;
+ dstX = dstXEven;
+ startmask = startmaskEven;
+ endmask = endmaskEven;
+ nmiddle = nmiddleEven;
+ leftShift = leftShiftEven;
+ rightShift = rightShiftEven;
+ srcLine += srcStrideEven;
+ dstLine += dstStrideEven;
+ even = FALSE;
+ }
+ else {
+ srcX = srcXOdd;
+ dstX = dstXOdd;
+ startmask = startmaskOdd;
+ endmask = endmaskOdd;
+ nmiddle = nmiddleOdd;
+ leftShift = leftShiftOdd;
+ rightShift = rightShiftOdd;
+ srcLine += srcStrideOdd;
+ dstLine += dstStrideOdd;
+ even = TRUE;
+ }
+ if (srcX == dstX) {
+ if (startmask) {
+ bits = READ(src++);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), startmask));
+ dst++;
+ }
+ n = nmiddle;
+ if (destInvarient) {
+ while (n--) {
+ bits = READ(src++);
+ WRITE(dst, FbDoDestInvarientMergeRop(bits));
+ dst++;
+ }
+ }
+ else {
+ while (n--) {
+ bits = READ(src++);
+ WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+ dst++;
+ }
+ }
+ if (endmask) {
+ bits = READ(src);
+ WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), endmask));
+ }
+ }
+ else {
+ bits = 0;
+ if (srcX > dstX)
+ bits = READ(src++);
+ if (startmask) {
+ bits1 = FbScrLeft(bits, leftShift);
+ bits = READ(src++);
+ bits1 |= FbScrRight(bits, rightShift);
+ WRITE(dst, FbDoMaskMergeRop(bits1, READ(dst), startmask));
+ dst++;
+ }
+ n = nmiddle;
+ if (destInvarient) {
+ while (n--) {
+ bits1 = FbScrLeft(bits, leftShift);
+ bits = READ(src++);
+ bits1 |= FbScrRight(bits, rightShift);
+ WRITE(dst, FbDoDestInvarientMergeRop(bits1));
+ dst++;
+ }
+ }
+ else {
+ while (n--) {
+ bits1 = FbScrLeft(bits, leftShift);
+ bits = READ(src++);
+ bits1 |= FbScrRight(bits, rightShift);
+ WRITE(dst, FbDoMergeRop(bits1, READ(dst)));
+ dst++;
+ }
+ }
+ if (endmask) {
+ bits1 = FbScrLeft(bits, leftShift);
+ if (FbScrLeft(endmask, rightShift)) {
+ bits = READ(src);
+ bits1 |= FbScrRight(bits, rightShift);
+ }
+ WRITE(dst, FbDoMaskMergeRop(bits1, READ(dst), endmask));
+ }
+ }
}
}
void
-fbBltOdd24 (FbBits *srcLine,
- FbStride srcStrideEven,
- FbStride srcStrideOdd,
- int srcXEven,
- int srcXOdd,
-
- FbBits *dstLine,
- FbStride dstStrideEven,
- FbStride dstStrideOdd,
- int dstXEven,
- int dstXOdd,
-
- int width,
- int height,
-
- int alu,
- FbBits pm)
+fbBltOdd24(FbBits * srcLine,
+ FbStride srcStrideEven,
+ FbStride srcStrideOdd,
+ int srcXEven,
+ int srcXOdd,
+ FbBits * dstLine,
+ FbStride dstStrideEven,
+ FbStride dstStrideOdd,
+ int dstXEven, int dstXOdd, int width, int height, int alu, FbBits pm)
{
- Bool even = TRUE;
-
- while (height--)
- {
- if (even)
- {
- fbBlt24Line (srcLine, srcXEven, dstLine, dstXEven,
- width, alu, pm, FALSE);
- srcLine += srcStrideEven;
- dstLine += dstStrideEven;
- even = FALSE;
- }
- else
- {
- fbBlt24Line (srcLine, srcXOdd, dstLine, dstXOdd,
- width, alu, pm, FALSE);
- srcLine += srcStrideOdd;
- dstLine += dstStrideOdd;
- even = TRUE;
- }
+ Bool even = TRUE;
+
+ while (height--) {
+ if (even) {
+ fbBlt24Line(srcLine, srcXEven, dstLine, dstXEven,
+ width, alu, pm, FALSE);
+ srcLine += srcStrideEven;
+ dstLine += dstStrideEven;
+ even = FALSE;
+ }
+ else {
+ fbBlt24Line(srcLine, srcXOdd, dstLine, dstXOdd,
+ width, alu, pm, FALSE);
+ srcLine += srcStrideOdd;
+ dstLine += dstStrideOdd;
+ even = TRUE;
+ }
}
}
@@ -831,17 +703,15 @@ fbBltOdd24 (FbBits *srcLine,
#if FB_STIP_SHIFT != FB_SHIFT
void
-fbSetBltOdd (FbStip *stip,
- FbStride stipStride,
- int srcX,
- FbBits **bits,
- FbStride *strideEven,
- FbStride *strideOdd,
- int *srcXEven,
- int *srcXOdd)
+fbSetBltOdd(FbStip * stip,
+ FbStride stipStride,
+ int srcX,
+ FbBits ** bits,
+ FbStride * strideEven,
+ FbStride * strideOdd, int *srcXEven, int *srcXOdd)
{
- int srcAdjust;
- int strideAdjust;
+ int srcAdjust;
+ int strideAdjust;
/*
* bytes needed to align source
@@ -853,96 +723,68 @@ fbSetBltOdd (FbStip *stip,
strideAdjust = stipStride & (FB_MASK >> FB_STIP_SHIFT);
*bits = (FbBits *) ((char *) stip - srcAdjust);
- if (srcAdjust)
- {
- *strideEven = FbStipStrideToBitsStride (stipStride + 1);
- *strideOdd = FbStipStrideToBitsStride (stipStride);
+ if (srcAdjust) {
+ *strideEven = FbStipStrideToBitsStride(stipStride + 1);
+ *strideOdd = FbStipStrideToBitsStride(stipStride);
- *srcXEven = srcX + (srcAdjust << 3);
- *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT);
+ *srcXEven = srcX + (srcAdjust << 3);
+ *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT);
}
- else
- {
- *strideEven = FbStipStrideToBitsStride (stipStride);
- *strideOdd = FbStipStrideToBitsStride (stipStride + 1);
-
- *srcXEven = srcX;
- *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT);
+ else {
+ *strideEven = FbStipStrideToBitsStride(stipStride);
+ *strideOdd = FbStipStrideToBitsStride(stipStride + 1);
+
+ *srcXEven = srcX;
+ *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT);
}
}
#endif
void
-fbBltStip (FbStip *src,
- FbStride srcStride, /* in FbStip units, not FbBits units */
- int srcX,
-
- FbStip *dst,
- FbStride dstStride, /* in FbStip units, not FbBits units */
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp)
+fbBltStip(FbStip * src, FbStride srcStride, /* in FbStip units, not FbBits units */
+ int srcX, FbStip * dst, FbStride dstStride, /* in FbStip units, not FbBits units */
+ int dstX, int width, int height, int alu, FbBits pm, int bpp)
{
#if FB_STIP_SHIFT != FB_SHIFT
if (FB_STIP_ODDSTRIDE(srcStride) || FB_STIP_ODDPTR(src) ||
- FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst))
- {
- FbStride srcStrideEven, srcStrideOdd;
- FbStride dstStrideEven, dstStrideOdd;
- int srcXEven, srcXOdd;
- int dstXEven, dstXOdd;
- FbBits *s, *d;
- int sx, dx;
-
- src += srcX >> FB_STIP_SHIFT;
- srcX &= FB_STIP_MASK;
- dst += dstX >> FB_STIP_SHIFT;
- dstX &= FB_STIP_MASK;
-
- fbSetBltOdd (src, srcStride, srcX,
- &s,
- &srcStrideEven, &srcStrideOdd,
- &srcXEven, &srcXOdd);
-
- fbSetBltOdd (dst, dstStride, dstX,
- &d,
- &dstStrideEven, &dstStrideOdd,
- &dstXEven, &dstXOdd);
-
- if (bpp == 24 && !FbCheck24Pix (pm))
- {
- fbBltOdd24 (s, srcStrideEven, srcStrideOdd,
- srcXEven, srcXOdd,
-
- d, dstStrideEven, dstStrideOdd,
- dstXEven, dstXOdd,
-
- width, height, alu, pm);
- }
- else
- {
- fbBltOdd (s, srcStrideEven, srcStrideOdd,
- srcXEven, srcXOdd,
-
- d, dstStrideEven, dstStrideOdd,
- dstXEven, dstXOdd,
-
- width, height, alu, pm, bpp);
- }
+ FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst)) {
+ FbStride srcStrideEven, srcStrideOdd;
+ FbStride dstStrideEven, dstStrideOdd;
+ int srcXEven, srcXOdd;
+ int dstXEven, dstXOdd;
+ FbBits *s, *d;
+ int sx, dx;
+
+ src += srcX >> FB_STIP_SHIFT;
+ srcX &= FB_STIP_MASK;
+ dst += dstX >> FB_STIP_SHIFT;
+ dstX &= FB_STIP_MASK;
+
+ fbSetBltOdd(src, srcStride, srcX,
+ &s, &srcStrideEven, &srcStrideOdd, &srcXEven, &srcXOdd);
+
+ fbSetBltOdd(dst, dstStride, dstX,
+ &d, &dstStrideEven, &dstStrideOdd, &dstXEven, &dstXOdd);
+
+ if (bpp == 24 && !FbCheck24Pix(pm)) {
+ fbBltOdd24(s, srcStrideEven, srcStrideOdd,
+ srcXEven, srcXOdd,
+ d, dstStrideEven, dstStrideOdd,
+ dstXEven, dstXOdd, width, height, alu, pm);
+ }
+ else {
+ fbBltOdd(s, srcStrideEven, srcStrideOdd,
+ srcXEven, srcXOdd,
+ d, dstStrideEven, dstStrideOdd,
+ dstXEven, dstXOdd, width, height, alu, pm, bpp);
+ }
}
else
#endif
{
- fbBlt ((FbBits *) src, FbStipStrideToBitsStride (srcStride),
- srcX,
- (FbBits *) dst, FbStipStrideToBitsStride (dstStride),
- dstX,
- width, height,
- alu, pm, bpp, FALSE, FALSE);
+ fbBlt((FbBits *) src, FbStipStrideToBitsStride(srcStride),
+ srcX,
+ (FbBits *) dst, FbStipStrideToBitsStride(dstStride),
+ dstX, width, height, alu, pm, bpp, FALSE, FALSE);
}
}
diff --git a/xorg-server/fb/fbbltone.c b/xorg-server/fb/fbbltone.c
index 67e7853c6..eb7cf9483 100644
--- a/xorg-server/fb/fbbltone.c
+++ b/xorg-server/fb/fbbltone.c
@@ -61,8 +61,7 @@
} else \
bits = (src < srcEnd ? READ(src++) : 0); \
}
-
-
+
#define LaneCases1(n,a) case n: FbLaneCase(n,a); break
#define LaneCases2(n,a) LaneCases1(n,a); LaneCases1(n+1,a)
#define LaneCases4(n,a) LaneCases2(n,a); LaneCases2(n+2,a)
@@ -72,111 +71,112 @@
#define LaneCases64(n,a) LaneCases32(n,a); LaneCases32(n+32,a)
#define LaneCases128(n,a) LaneCases64(n,a); LaneCases64(n+64,a)
#define LaneCases256(n,a) LaneCases128(n,a); LaneCases128(n+128,a)
-
+
#if FB_SHIFT == 6
#define LaneCases(a) LaneCases256(0,a)
#endif
-
+
#if FB_SHIFT == 5
#define LaneCases(a) LaneCases16(0,a)
#endif
-
+
#if FB_SHIFT == 6
-CARD8 fb8Lane[256] = {
-0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
-22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
-60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
-79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
-98, 99, 100, 101, 102,103,104,105,106,107,108,109,110,111,112,113,114,115,
-116, 117, 118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,
-134, 135, 136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,
-152, 153, 154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,
-170, 171, 172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,
-188, 189, 190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,
-206, 207, 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
-224, 225, 226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-242, 243, 244,245,246,247,248,249,250,251,252,253,254,255,
+CARD8 fb8Lane[256] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+ 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ 113, 114, 115,
+ 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+ 131, 132, 133,
+ 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
+ 149, 150, 151,
+ 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
+ 167, 168, 169,
+ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
+ 185, 186, 187,
+ 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
+ 203, 204, 205,
+ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
+ 221, 222, 223,
+ 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238,
+ 239, 240, 241,
+ 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
};
-CARD8 fb16Lane[256] = {
+CARD8 fb16Lane[256] = {
0x00, 0x03, 0x0c, 0x0f,
0x30, 0x33, 0x3c, 0x3f,
0xc0, 0xc3, 0xcc, 0xcf,
0xf0, 0xf3, 0xfc, 0xff,
};
-CARD8 fb32Lane[16] = {
+CARD8 fb32Lane[16] = {
0x00, 0x0f, 0xf0, 0xff,
};
#endif
#if FB_SHIFT == 5
-CARD8 fb8Lane[16] = {
+CARD8 fb8Lane[16] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
};
-CARD8 fb16Lane[16] = {
- 0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+CARD8 fb16Lane[16] = {
+ 0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-CARD8 fb32Lane[16] = {
- 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+CARD8 fb32Lane[16] = {
+ 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
#endif
-CARD8 *fbLaneTable[33] = {
+CARD8 *fbLaneTable[33] = {
0, 0, 0, 0, 0, 0, 0, 0,
- fb8Lane, 0, 0, 0, 0, 0, 0, 0,
+ fb8Lane, 0, 0, 0, 0, 0, 0, 0,
fb16Lane, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
fb32Lane
};
void
-fbBltOne (FbStip *src,
- FbStride srcStride, /* FbStip units per scanline */
- int srcX, /* bit position of source */
- FbBits *dst,
- FbStride dstStride, /* FbBits units per scanline */
- int dstX, /* bit position of dest */
- int dstBpp, /* bits per destination unit */
-
- int width, /* width in bits of destination */
- int height, /* height in scanlines */
-
- FbBits fgand, /* rrop values */
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor)
+fbBltOne(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
+ int srcX, /* bit position of source */
+ FbBits * dst, FbStride dstStride, /* FbBits units per scanline */
+ int dstX, /* bit position of dest */
+ int dstBpp, /* bits per destination unit */
+ int width, /* width in bits of destination */
+ int height, /* height in scanlines */
+ FbBits fgand, /* rrop values */
+ FbBits fgxor, FbBits bgand, FbBits bgxor)
{
- const FbBits *fbBits;
- FbBits *srcEnd;
- int pixelsPerDst; /* dst pixels per FbBits */
- int unitsPerSrc; /* src patterns per FbStip */
- int leftShift, rightShift; /* align source with dest */
- FbBits startmask, endmask; /* dest scanline masks */
- FbStip bits=0, bitsLeft, bitsRight;/* source bits */
- FbStip left;
- FbBits mask;
- int nDst; /* dest longwords (w.o. end) */
- int w;
- int n, nmiddle;
- int dstS; /* stipple-relative dst X coordinate */
- Bool copy; /* accelerate dest-invariant */
- Bool transparent; /* accelerate 0 nop */
- int srcinc; /* source units consumed */
- Bool endNeedsLoad = FALSE; /* need load for endmask */
- CARD8 *fbLane;
- int startbyte, endbyte;
-
- if (dstBpp == 24)
- {
- fbBltOne24 (src, srcStride, srcX,
- dst, dstStride, dstX, dstBpp,
- width, height,
- fgand, fgxor, bgand, bgxor);
- return;
+ const FbBits *fbBits;
+ FbBits *srcEnd;
+ int pixelsPerDst; /* dst pixels per FbBits */
+ int unitsPerSrc; /* src patterns per FbStip */
+ int leftShift, rightShift; /* align source with dest */
+ FbBits startmask, endmask; /* dest scanline masks */
+ FbStip bits = 0, bitsLeft, bitsRight; /* source bits */
+ FbStip left;
+ FbBits mask;
+ int nDst; /* dest longwords (w.o. end) */
+ int w;
+ int n, nmiddle;
+ int dstS; /* stipple-relative dst X coordinate */
+ Bool copy; /* accelerate dest-invariant */
+ Bool transparent; /* accelerate 0 nop */
+ int srcinc; /* source units consumed */
+ Bool endNeedsLoad = FALSE; /* need load for endmask */
+ CARD8 *fbLane;
+ int startbyte, endbyte;
+
+ if (dstBpp == 24) {
+ fbBltOne24(src, srcStride, srcX,
+ dst, dstStride, dstX, dstBpp,
+ width, height, fgand, fgxor, bgand, bgxor);
+ return;
}
/*
@@ -194,13 +194,13 @@ fbBltOne (FbStip *src,
* Number of source stipple patterns in FbStip
*/
unitsPerSrc = FB_STIP_UNIT / pixelsPerDst;
-
+
copy = FALSE;
transparent = FALSE;
if (bgand == 0 && fgand == 0)
- copy = TRUE;
+ copy = TRUE;
else if (bgand == FB_ALLONES && bgxor == 0)
- transparent = TRUE;
+ transparent = TRUE;
/*
* Adjust source and dest to nearest FbBits boundary
@@ -210,8 +210,8 @@ fbBltOne (FbStip *src,
srcX &= FB_STIP_MASK;
dstX &= FB_MASK;
- FbMaskBitsBytes(dstX, width, copy,
- startmask, startbyte, nmiddle, endmask, endbyte);
+ FbMaskBitsBytes(dstX, width, copy,
+ startmask, startbyte, nmiddle, endmask, endbyte);
/*
* Compute effective dest alignment requirement for
@@ -221,196 +221,175 @@ fbBltOne (FbStip *src,
/*
* Compute shift constants for effective alignement
*/
- if (srcX >= dstS)
- {
- leftShift = srcX - dstS;
- rightShift = FB_STIP_UNIT - leftShift;
+ if (srcX >= dstS) {
+ leftShift = srcX - dstS;
+ rightShift = FB_STIP_UNIT - leftShift;
}
- else
- {
- rightShift = dstS - srcX;
- leftShift = FB_STIP_UNIT - rightShift;
+ else {
+ rightShift = dstS - srcX;
+ leftShift = FB_STIP_UNIT - rightShift;
}
/*
* Get pointer to stipple mask array for this depth
*/
- fbBits = 0; /* unused */
+ fbBits = 0; /* unused */
if (pixelsPerDst <= 8)
- fbBits = fbStippleTable[pixelsPerDst];
+ fbBits = fbStippleTable[pixelsPerDst];
fbLane = 0;
if (transparent && fgand == 0 && dstBpp >= 8)
- fbLane = fbLaneTable[dstBpp];
-
+ fbLane = fbLaneTable[dstBpp];
+
/*
* Compute total number of destination words written, but
* don't count endmask
*/
nDst = nmiddle;
if (startmask)
- nDst++;
-
+ nDst++;
+
dstStride -= nDst;
/*
* Compute total number of source words consumed
*/
-
+
srcinc = (nDst + unitsPerSrc - 1) / unitsPerSrc;
-
+
if (srcX > dstS)
- srcinc++;
- if (endmask)
- {
- endNeedsLoad = nDst % unitsPerSrc == 0;
- if (endNeedsLoad)
- srcinc++;
+ srcinc++;
+ if (endmask) {
+ endNeedsLoad = nDst % unitsPerSrc == 0;
+ if (endNeedsLoad)
+ srcinc++;
}
srcStride -= srcinc;
-
+
/*
* Copy rectangle
*/
- while (height--)
- {
- w = nDst; /* total units across scanline */
- n = unitsPerSrc; /* units avail in single stipple */
- if (n > w)
- n = w;
-
- bitsLeft = 0;
- if (srcX > dstS)
- bitsLeft = READ(src++);
- if (n)
- {
- /*
- * Load first set of stipple bits
- */
- LoadBits;
-
- /*
- * Consume stipple bits for startmask
- */
- if (startmask)
- {
+ while (height--) {
+ w = nDst; /* total units across scanline */
+ n = unitsPerSrc; /* units avail in single stipple */
+ if (n > w)
+ n = w;
+
+ bitsLeft = 0;
+ if (srcX > dstS)
+ bitsLeft = READ(src++);
+ if (n) {
+ /*
+ * Load first set of stipple bits
+ */
+ LoadBits;
+
+ /*
+ * Consume stipple bits for startmask
+ */
+ if (startmask) {
#if FB_UNIT > 32
- if (pixelsPerDst == 16)
- mask = FbStipple16Bits(FbLeftStipBits(bits,16));
- else
+ if (pixelsPerDst == 16)
+ mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
+ else
#endif
- mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
- if (fbLane)
- {
- fbTransparentSpan (dst, mask & startmask, fgxor, 1);
- }
- else
- {
- if (mask || !transparent)
- FbDoLeftMaskByteStippleRRop (dst, mask,
- fgand, fgxor, bgand, bgxor,
- startbyte, startmask);
- }
- bits = FbStipLeft (bits, pixelsPerDst);
- dst++;
- n--;
- w--;
- }
- /*
- * Consume stipple bits across scanline
- */
- for (;;)
- {
- w -= n;
- if (copy)
- {
- while (n--)
- {
+ mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+ if (fbLane) {
+ fbTransparentSpan(dst, mask & startmask, fgxor, 1);
+ }
+ else {
+ if (mask || !transparent)
+ FbDoLeftMaskByteStippleRRop(dst, mask,
+ fgand, fgxor, bgand, bgxor,
+ startbyte, startmask);
+ }
+ bits = FbStipLeft(bits, pixelsPerDst);
+ dst++;
+ n--;
+ w--;
+ }
+ /*
+ * Consume stipple bits across scanline
+ */
+ for (;;) {
+ w -= n;
+ if (copy) {
+ while (n--) {
#if FB_UNIT > 32
- if (pixelsPerDst == 16)
- mask = FbStipple16Bits(FbLeftStipBits(bits,16));
- else
+ if (pixelsPerDst == 16)
+ mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
+ else
#endif
- mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
- WRITE(dst, FbOpaqueStipple (mask, fgxor, bgxor));
- dst++;
- bits = FbStipLeft(bits, pixelsPerDst);
- }
- }
- else
- {
- if (fbLane)
- {
- while (bits && n)
- {
- switch (fbLane[FbLeftStipBits(bits,pixelsPerDst)]) {
- LaneCases((CARD8 *) dst);
- }
- bits = FbStipLeft(bits,pixelsPerDst);
- dst++;
- n--;
- }
- dst += n;
- }
- else
- {
- while (n--)
- {
- left = FbLeftStipBits(bits,pixelsPerDst);
- if (left || !transparent)
- {
- mask = fbBits[left];
- WRITE(dst, FbStippleRRop (READ(dst), mask,
- fgand, fgxor, bgand, bgxor));
- }
- dst++;
- bits = FbStipLeft(bits, pixelsPerDst);
- }
- }
- }
- if (!w)
- break;
- /*
- * Load another set and reset number of available units
- */
- LoadBits;
- n = unitsPerSrc;
- if (n > w)
- n = w;
- }
- }
- /*
- * Consume stipple bits for endmask
- */
- if (endmask)
- {
- if (endNeedsLoad)
- {
- LoadBits;
- }
+ mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+ WRITE(dst, FbOpaqueStipple(mask, fgxor, bgxor));
+ dst++;
+ bits = FbStipLeft(bits, pixelsPerDst);
+ }
+ }
+ else {
+ if (fbLane) {
+ while (bits && n) {
+ switch (fbLane[FbLeftStipBits(bits, pixelsPerDst)]) {
+ LaneCases((CARD8 *) dst);
+ }
+ bits = FbStipLeft(bits, pixelsPerDst);
+ dst++;
+ n--;
+ }
+ dst += n;
+ }
+ else {
+ while (n--) {
+ left = FbLeftStipBits(bits, pixelsPerDst);
+ if (left || !transparent) {
+ mask = fbBits[left];
+ WRITE(dst, FbStippleRRop(READ(dst), mask,
+ fgand, fgxor, bgand,
+ bgxor));
+ }
+ dst++;
+ bits = FbStipLeft(bits, pixelsPerDst);
+ }
+ }
+ }
+ if (!w)
+ break;
+ /*
+ * Load another set and reset number of available units
+ */
+ LoadBits;
+ n = unitsPerSrc;
+ if (n > w)
+ n = w;
+ }
+ }
+ /*
+ * Consume stipple bits for endmask
+ */
+ if (endmask) {
+ if (endNeedsLoad) {
+ LoadBits;
+ }
#if FB_UNIT > 32
- if (pixelsPerDst == 16)
- mask = FbStipple16Bits(FbLeftStipBits(bits,16));
- else
+ if (pixelsPerDst == 16)
+ mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
+ else
#endif
- mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
- if (fbLane)
- {
- fbTransparentSpan (dst, mask & endmask, fgxor, 1);
- }
- else
- {
- if (mask || !transparent)
- FbDoRightMaskByteStippleRRop (dst, mask,
- fgand, fgxor, bgand, bgxor,
- endbyte, endmask);
- }
- }
- dst += dstStride;
- src += srcStride;
+ mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+ if (fbLane) {
+ fbTransparentSpan(dst, mask & endmask, fgxor, 1);
+ }
+ else {
+ if (mask || !transparent)
+ FbDoRightMaskByteStippleRRop(dst, mask,
+ fgand, fgxor, bgand, bgxor,
+ endbyte, endmask);
+ }
+ }
+ dst += dstStride;
+ src += srcStride;
}
}
-
/*
* Crufty macros to initialize the mask array, most of this
* is to avoid compile-time warnings about shift overflow
@@ -447,28 +426,28 @@ fbBltOne (FbStip *src,
#define FbStip24New(rot) (2 + (rot != 0))
#define FbStip24Len 4
-const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
+const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
/* rotate 0 */
{
- C4_24( 0, 0), C4_24( 1, 0), C4_24( 2, 0), C4_24( 3, 0),
- C4_24( 4, 0), C4_24( 5, 0), C4_24( 6, 0), C4_24( 7, 0),
- C4_24( 8, 0), C4_24( 9, 0), C4_24(10, 0), C4_24(11, 0),
- C4_24(12, 0), C4_24(13, 0), C4_24(14, 0), C4_24(15, 0),
- },
+ C4_24(0, 0), C4_24(1, 0), C4_24(2, 0), C4_24(3, 0),
+ C4_24(4, 0), C4_24(5, 0), C4_24(6, 0), C4_24(7, 0),
+ C4_24(8, 0), C4_24(9, 0), C4_24(10, 0), C4_24(11, 0),
+ C4_24(12, 0), C4_24(13, 0), C4_24(14, 0), C4_24(15, 0),
+ },
/* rotate 8 */
{
- C4_24( 0, 8), C4_24( 1, 8), C4_24( 2, 8), C4_24( 3, 8),
- C4_24( 4, 8), C4_24( 5, 8), C4_24( 6, 8), C4_24( 7, 8),
- C4_24( 8, 8), C4_24( 9, 8), C4_24(10, 8), C4_24(11, 8),
- C4_24(12, 8), C4_24(13, 8), C4_24(14, 8), C4_24(15, 8),
- },
+ C4_24(0, 8), C4_24(1, 8), C4_24(2, 8), C4_24(3, 8),
+ C4_24(4, 8), C4_24(5, 8), C4_24(6, 8), C4_24(7, 8),
+ C4_24(8, 8), C4_24(9, 8), C4_24(10, 8), C4_24(11, 8),
+ C4_24(12, 8), C4_24(13, 8), C4_24(14, 8), C4_24(15, 8),
+ },
/* rotate 16 */
{
- C4_24( 0,16), C4_24( 1,16), C4_24( 2,16), C4_24( 3,16),
- C4_24( 4,16), C4_24( 5,16), C4_24( 6,16), C4_24( 7,16),
- C4_24( 8,16), C4_24( 9,16), C4_24(10,16), C4_24(11,16),
- C4_24(12,16), C4_24(13,16), C4_24(14,16), C4_24(15,16),
- }
+ C4_24(0, 16), C4_24(1, 16), C4_24(2, 16), C4_24(3, 16),
+ C4_24(4, 16), C4_24(5, 16), C4_24(6, 16), C4_24(7, 16),
+ C4_24(8, 16), C4_24(9, 16), C4_24(10, 16), C4_24(11, 16),
+ C4_24(12, 16), C4_24(13, 16), C4_24(14, 16), C4_24(15, 16),
+ }
};
#endif
@@ -485,19 +464,19 @@ const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
#define FbStip24New(rot) (1 + (rot == 8))
#endif
-const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
+const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
/* rotate 0 */
{
- C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0),
- },
+ C2_24(0, 0), C2_24(1, 0), C2_24(2, 0), C2_24(3, 0),
+ },
/* rotate 8 */
{
- C2_24( 0, 8), C2_24 ( 1, 8), C2_24 ( 2, 8), C2_24 ( 3, 8),
- },
+ C2_24(0, 8), C2_24(1, 8), C2_24(2, 8), C2_24(3, 8),
+ },
/* rotate 16 */
{
- C2_24( 0,16), C2_24 ( 1,16), C2_24 ( 2,16), C2_24 ( 3,16),
- }
+ C2_24(0, 16), C2_24(1, 16), C2_24(2, 16), C2_24(3, 16),
+ }
};
#endif
@@ -541,7 +520,7 @@ const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
fbFirstStipBits(len,stip); \
stip = FbMergeStip24Bits (0, stip, len); \
}
-
+
#define fbNextStipBits(rot,stip) {\
int __new = FbStip24New(rot); \
FbStip __right; \
@@ -560,32 +539,26 @@ const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
* and text
*/
void
-fbBltOne24 (FbStip *srcLine,
- FbStride srcStride, /* FbStip units per scanline */
- int srcX, /* bit position of source */
- FbBits *dst,
- FbStride dstStride, /* FbBits units per scanline */
- int dstX, /* bit position of dest */
- int dstBpp, /* bits per destination unit */
-
- int width, /* width in bits of destination */
- int height, /* height in scanlines */
-
- FbBits fgand, /* rrop values */
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor)
+fbBltOne24(FbStip * srcLine, FbStride srcStride, /* FbStip units per scanline */
+ int srcX, /* bit position of source */
+ FbBits * dst, FbStride dstStride, /* FbBits units per scanline */
+ int dstX, /* bit position of dest */
+ int dstBpp, /* bits per destination unit */
+ int width, /* width in bits of destination */
+ int height, /* height in scanlines */
+ FbBits fgand, /* rrop values */
+ FbBits fgxor, FbBits bgand, FbBits bgxor)
{
- FbStip *src, *srcEnd;
- FbBits leftMask, rightMask, mask;
- int nlMiddle, nl;
- FbStip stip, bits;
- int remain;
- int dstS;
- int firstlen;
- int rot0, rot;
- int nDst;
-
+ FbStip *src, *srcEnd;
+ FbBits leftMask, rightMask, mask;
+ int nlMiddle, nl;
+ FbStip stip, bits;
+ int remain;
+ int dstS;
+ int firstlen;
+ int rot0, rot;
+ int nDst;
+
/*
* Do not read past the end of the buffer!
*/
@@ -595,146 +568,127 @@ fbBltOne24 (FbStip *srcLine,
dst += dstX >> FB_SHIFT;
srcX &= FB_STIP_MASK;
dstX &= FB_MASK;
- rot0 = FbFirst24Rot (dstX);
-
- FbMaskBits (dstX, width, leftMask, nlMiddle, rightMask);
-
+ rot0 = FbFirst24Rot(dstX);
+
+ FbMaskBits(dstX, width, leftMask, nlMiddle, rightMask);
+
dstS = (dstX + 23) / 24;
firstlen = FbStip24Len - dstS;
-
+
nDst = nlMiddle;
if (leftMask)
- nDst++;
+ nDst++;
dstStride -= nDst;
-
+
/* opaque copy */
- if (bgand == 0 && fgand == 0)
- {
- while (height--)
- {
- rot = rot0;
- src = srcLine;
- srcLine += srcStride;
- fbInitStipBits (srcX,firstlen, stip);
- if (leftMask)
- {
- mask = fbStipple24Bits[rot >> 3][stip];
- WRITE(dst, (READ(dst) & ~leftMask) |
- (FbOpaqueStipple (mask,
- FbRot24(fgxor, rot),
- FbRot24(bgxor, rot))
- & leftMask));
- dst++;
- fbNextStipBits(rot,stip);
- }
- nl = nlMiddle;
- while (nl--)
- {
- mask = fbStipple24Bits[rot>>3][stip];
- WRITE(dst, FbOpaqueStipple (mask,
- FbRot24(fgxor, rot),
- FbRot24(bgxor, rot)));
- dst++;
- fbNextStipBits(rot,stip);
- }
- if (rightMask)
- {
- mask = fbStipple24Bits[rot >> 3][stip];
- WRITE(dst, (READ(dst) & ~rightMask) |
- (FbOpaqueStipple (mask,
- FbRot24(fgxor, rot),
- FbRot24(bgxor, rot))
- & rightMask));
- }
- dst += dstStride;
- src += srcStride;
- }
+ if (bgand == 0 && fgand == 0) {
+ while (height--) {
+ rot = rot0;
+ src = srcLine;
+ srcLine += srcStride;
+ fbInitStipBits(srcX, firstlen, stip);
+ if (leftMask) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, (READ(dst) & ~leftMask) |
+ (FbOpaqueStipple(mask,
+ FbRot24(fgxor, rot), FbRot24(bgxor, rot))
+ & leftMask));
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ nl = nlMiddle;
+ while (nl--) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, FbOpaqueStipple(mask,
+ FbRot24(fgxor, rot),
+ FbRot24(bgxor, rot)));
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ if (rightMask) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, (READ(dst) & ~rightMask) |
+ (FbOpaqueStipple(mask,
+ FbRot24(fgxor, rot), FbRot24(bgxor, rot))
+ & rightMask));
+ }
+ dst += dstStride;
+ src += srcStride;
+ }
}
/* transparent copy */
- else if (bgand == FB_ALLONES && bgxor == 0 && fgand == 0)
- {
- while (height--)
- {
- rot = rot0;
- src = srcLine;
- srcLine += srcStride;
- fbInitStipBits (srcX, firstlen, stip);
- if (leftMask)
- {
- if (stip)
- {
- mask = fbStipple24Bits[rot >> 3][stip] & leftMask;
- WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
- }
- dst++;
- fbNextStipBits (rot, stip);
- }
- nl = nlMiddle;
- while (nl--)
- {
- if (stip)
- {
- mask = fbStipple24Bits[rot>>3][stip];
- WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor,rot) & mask));
- }
- dst++;
- fbNextStipBits (rot, stip);
- }
- if (rightMask)
- {
- if (stip)
- {
- mask = fbStipple24Bits[rot >> 3][stip] & rightMask;
- WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
- }
- }
- dst += dstStride;
- }
+ else if (bgand == FB_ALLONES && bgxor == 0 && fgand == 0) {
+ while (height--) {
+ rot = rot0;
+ src = srcLine;
+ srcLine += srcStride;
+ fbInitStipBits(srcX, firstlen, stip);
+ if (leftMask) {
+ if (stip) {
+ mask = fbStipple24Bits[rot >> 3][stip] & leftMask;
+ WRITE(dst,
+ (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
+ }
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ nl = nlMiddle;
+ while (nl--) {
+ if (stip) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst,
+ (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
+ }
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ if (rightMask) {
+ if (stip) {
+ mask = fbStipple24Bits[rot >> 3][stip] & rightMask;
+ WRITE(dst,
+ (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
+ }
+ }
+ dst += dstStride;
+ }
}
- else
- {
- while (height--)
- {
- rot = rot0;
- src = srcLine;
- srcLine += srcStride;
- fbInitStipBits (srcX, firstlen, stip);
- if (leftMask)
- {
- mask = fbStipple24Bits[rot >> 3][stip];
- WRITE(dst, FbStippleRRopMask (READ(dst), mask,
- FbRot24(fgand, rot),
- FbRot24(fgxor, rot),
- FbRot24(bgand, rot),
- FbRot24(bgxor, rot),
- leftMask));
- dst++;
- fbNextStipBits(rot,stip);
- }
- nl = nlMiddle;
- while (nl--)
- {
- mask = fbStipple24Bits[rot >> 3][stip];
- WRITE(dst, FbStippleRRop (READ(dst), mask,
- FbRot24(fgand, rot),
- FbRot24(fgxor, rot),
- FbRot24(bgand, rot),
- FbRot24(bgxor, rot)));
- dst++;
- fbNextStipBits(rot,stip);
- }
- if (rightMask)
- {
- mask = fbStipple24Bits[rot >> 3][stip];
- WRITE(dst, FbStippleRRopMask (READ(dst), mask,
- FbRot24(fgand, rot),
- FbRot24(fgxor, rot),
- FbRot24(bgand, rot),
- FbRot24(bgxor, rot),
- rightMask));
- }
- dst += dstStride;
- }
+ else {
+ while (height--) {
+ rot = rot0;
+ src = srcLine;
+ srcLine += srcStride;
+ fbInitStipBits(srcX, firstlen, stip);
+ if (leftMask) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, FbStippleRRopMask(READ(dst), mask,
+ FbRot24(fgand, rot),
+ FbRot24(fgxor, rot),
+ FbRot24(bgand, rot),
+ FbRot24(bgxor, rot), leftMask));
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ nl = nlMiddle;
+ while (nl--) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, FbStippleRRop(READ(dst), mask,
+ FbRot24(fgand, rot),
+ FbRot24(fgxor, rot),
+ FbRot24(bgand, rot),
+ FbRot24(bgxor, rot)));
+ dst++;
+ fbNextStipBits(rot, stip);
+ }
+ if (rightMask) {
+ mask = fbStipple24Bits[rot >> 3][stip];
+ WRITE(dst, FbStippleRRopMask(READ(dst), mask,
+ FbRot24(fgand, rot),
+ FbRot24(fgxor, rot),
+ FbRot24(bgand, rot),
+ FbRot24(bgxor, rot), rightMask));
+ }
+ dst += dstStride;
+ }
}
}
@@ -742,121 +696,107 @@ fbBltOne24 (FbStip *srcLine,
* Not very efficient, but simple -- copy a single plane
* from an N bit image to a 1 bit image
*/
-
+
void
-fbBltPlane (FbBits *src,
- FbStride srcStride,
- int srcX,
- int srcBpp,
-
- FbStip *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbStip fgand,
- FbStip fgxor,
- FbStip bgand,
- FbStip bgxor,
- Pixel planeMask)
+fbBltPlane(FbBits * src,
+ FbStride srcStride,
+ int srcX,
+ int srcBpp,
+ FbStip * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbStip fgand,
+ FbStip fgxor, FbStip bgand, FbStip bgxor, Pixel planeMask)
{
- FbBits *s;
- FbBits pm;
- FbBits srcMask;
- FbBits srcMaskFirst;
- FbBits srcMask0 = 0;
- FbBits srcBits;
-
- FbStip dstBits;
- FbStip *d;
- FbStip dstMask;
- FbStip dstMaskFirst;
- FbStip dstUnion;
- int w;
- int wt;
- int rot0;
+ FbBits *s;
+ FbBits pm;
+ FbBits srcMask;
+ FbBits srcMaskFirst;
+ FbBits srcMask0 = 0;
+ FbBits srcBits;
+
+ FbStip dstBits;
+ FbStip *d;
+ FbStip dstMask;
+ FbStip dstMaskFirst;
+ FbStip dstUnion;
+ int w;
+ int wt;
+ int rot0;
if (!width)
- return;
-
+ return;
+
src += srcX >> FB_SHIFT;
srcX &= FB_MASK;
dst += dstX >> FB_STIP_SHIFT;
dstX &= FB_STIP_MASK;
-
+
w = width / srcBpp;
- pm = fbReplicatePixel (planeMask, srcBpp);
- if (srcBpp == 24)
- {
- int w = 24;
+ pm = fbReplicatePixel(planeMask, srcBpp);
+ if (srcBpp == 24) {
+ int w = 24;
- rot0 = FbFirst24Rot (srcX);
- if (srcX + w > FB_UNIT)
- w = FB_UNIT - srcX;
- srcMaskFirst = FbRot24(pm,rot0) & FbBitsMask(srcX,w);
+ rot0 = FbFirst24Rot(srcX);
+ if (srcX + w > FB_UNIT)
+ w = FB_UNIT - srcX;
+ srcMaskFirst = FbRot24(pm, rot0) & FbBitsMask(srcX, w);
}
- else
- {
- rot0 = 0;
- srcMaskFirst = pm & FbBitsMask(srcX, srcBpp);
- srcMask0 = pm & FbBitsMask(0, srcBpp);
+ else {
+ rot0 = 0;
+ srcMaskFirst = pm & FbBitsMask(srcX, srcBpp);
+ srcMask0 = pm & FbBitsMask(0, srcBpp);
}
-
- dstMaskFirst = FbStipMask(dstX,1);
- while (height--)
- {
- d = dst;
- dst += dstStride;
- s = src;
- src += srcStride;
-
- srcMask = srcMaskFirst;
- if (srcBpp == 24)
- srcMask0 = FbRot24(pm,rot0) & FbBitsMask(0, srcBpp);
- srcBits = READ(s++);
-
- dstMask = dstMaskFirst;
- dstUnion = 0;
- dstBits = 0;
-
- wt = w;
-
- while (wt--)
- {
- if (!srcMask)
- {
- srcBits = READ(s++);
- if (srcBpp == 24)
- srcMask0 = FbNext24Pix(srcMask0) & FbBitsMask(0,24);
- srcMask = srcMask0;
- }
- if (!dstMask)
- {
- WRITE(d, FbStippleRRopMask(READ(d), dstBits,
- fgand, fgxor, bgand, bgxor,
- dstUnion));
- d++;
- dstMask = FbStipMask(0,1);
- dstUnion = 0;
- dstBits = 0;
- }
- if (srcBits & srcMask)
- dstBits |= dstMask;
- dstUnion |= dstMask;
- if (srcBpp == FB_UNIT)
- srcMask = 0;
- else
- srcMask = FbScrRight(srcMask,srcBpp);
- dstMask = FbStipRight(dstMask,1);
- }
- if (dstUnion)
- WRITE(d, FbStippleRRopMask(READ(d),dstBits,
- fgand, fgxor, bgand, bgxor,
- dstUnion));
+
+ dstMaskFirst = FbStipMask(dstX, 1);
+ while (height--) {
+ d = dst;
+ dst += dstStride;
+ s = src;
+ src += srcStride;
+
+ srcMask = srcMaskFirst;
+ if (srcBpp == 24)
+ srcMask0 = FbRot24(pm, rot0) & FbBitsMask(0, srcBpp);
+ srcBits = READ(s++);
+
+ dstMask = dstMaskFirst;
+ dstUnion = 0;
+ dstBits = 0;
+
+ wt = w;
+
+ while (wt--) {
+ if (!srcMask) {
+ srcBits = READ(s++);
+ if (srcBpp == 24)
+ srcMask0 = FbNext24Pix(srcMask0) & FbBitsMask(0, 24);
+ srcMask = srcMask0;
+ }
+ if (!dstMask) {
+ WRITE(d, FbStippleRRopMask(READ(d), dstBits,
+ fgand, fgxor, bgand, bgxor,
+ dstUnion));
+ d++;
+ dstMask = FbStipMask(0, 1);
+ dstUnion = 0;
+ dstBits = 0;
+ }
+ if (srcBits & srcMask)
+ dstBits |= dstMask;
+ dstUnion |= dstMask;
+ if (srcBpp == FB_UNIT)
+ srcMask = 0;
+ else
+ srcMask = FbScrRight(srcMask, srcBpp);
+ dstMask = FbStipRight(dstMask, 1);
+ }
+ if (dstUnion)
+ WRITE(d, FbStippleRRopMask(READ(d), dstBits,
+ fgand, fgxor, bgand, bgxor, dstUnion));
}
}
-
diff --git a/xorg-server/fb/fbcmap_mi.c b/xorg-server/fb/fbcmap_mi.c
index 1e567d007..7b6a2c679 100644
--- a/xorg-server/fb/fbcmap_mi.c
+++ b/xorg-server/fb/fbcmap_mi.c
@@ -1,124 +1,117 @@
-/*
- * Copyright (c) 1987, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * This version of fbcmap.c is implemented in terms of mi functions.
- * These functions used to be in fbcmap.c and depended upon the symbol
- * XFree86Server being defined.
- */
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "fb.h"
-#include "micmap.h"
-
-int
-fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
-{
- return miListInstalledColormaps(pScreen, pmaps);
-}
-
-void
-fbInstallColormap(ColormapPtr pmap)
-{
- miInstallColormap(pmap);
-}
-
-void
-fbUninstallColormap(ColormapPtr pmap)
-{
- miUninstallColormap(pmap);
-}
-
-void
-fbResolveColor(unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual)
-{
- miResolveColor(pred, pgreen, pblue, pVisual);
-}
-
-Bool
-fbInitializeColormap(ColormapPtr pmap)
-{
- return miInitializeColormap(pmap);
-}
-
-int
-fbExpandDirectColors (ColormapPtr pmap,
- int ndef,
- xColorItem *indefs,
- xColorItem *outdefs)
-{
- return miExpandDirectColors(pmap, ndef, indefs, outdefs);
-}
-
-Bool
-fbCreateDefColormap(ScreenPtr pScreen)
-{
- return miCreateDefColormap(pScreen);
-}
-
-void
-fbClearVisualTypes(void)
-{
- miClearVisualTypes();
-}
-
-Bool
-fbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
-{
- return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
-}
-
-Bool
-fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
- Pixel redMask, Pixel greenMask, Pixel blueMask)
-{
- return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1,
- redMask, greenMask, blueMask);
-}
-
-/*
- * Given a list of formats for a screen, create a list
- * of visuals and depths for the screen which coorespond to
- * the set which can be used with this version of fb.
- */
-Bool
-fbInitVisuals (VisualPtr *visualp,
- DepthPtr *depthp,
- int *nvisualp,
- int *ndepthp,
- int *rootDepthp,
- VisualID *defaultVisp,
- unsigned long sizes,
- int bitsPerRGB)
-{
- return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
- defaultVisp, sizes, bitsPerRGB, -1);
-}
+/*
+ * Copyright (c) 1987, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * This version of fbcmap.c is implemented in terms of mi functions.
+ * These functions used to be in fbcmap.c and depended upon the symbol
+ * XFree86Server being defined.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include "fb.h"
+#include "micmap.h"
+
+int
+fbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps)
+{
+ return miListInstalledColormaps(pScreen, pmaps);
+}
+
+void
+fbInstallColormap(ColormapPtr pmap)
+{
+ miInstallColormap(pmap);
+}
+
+void
+fbUninstallColormap(ColormapPtr pmap)
+{
+ miUninstallColormap(pmap);
+}
+
+void
+fbResolveColor(unsigned short *pred,
+ unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual)
+{
+ miResolveColor(pred, pgreen, pblue, pVisual);
+}
+
+Bool
+fbInitializeColormap(ColormapPtr pmap)
+{
+ return miInitializeColormap(pmap);
+}
+
+int
+fbExpandDirectColors(ColormapPtr pmap,
+ int ndef, xColorItem * indefs, xColorItem * outdefs)
+{
+ return miExpandDirectColors(pmap, ndef, indefs, outdefs);
+}
+
+Bool
+fbCreateDefColormap(ScreenPtr pScreen)
+{
+ return miCreateDefColormap(pScreen);
+}
+
+void
+fbClearVisualTypes(void)
+{
+ miClearVisualTypes();
+}
+
+Bool
+fbSetVisualTypes(int depth, int visuals, int bitsPerRGB)
+{
+ return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
+}
+
+Bool
+fbSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
+ Pixel redMask, Pixel greenMask, Pixel blueMask)
+{
+ return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1,
+ redMask, greenMask, blueMask);
+}
+
+/*
+ * Given a list of formats for a screen, create a list
+ * of visuals and depths for the screen which coorespond to
+ * the set which can be used with this version of fb.
+ */
+Bool
+fbInitVisuals(VisualPtr * visualp,
+ DepthPtr * depthp,
+ int *nvisualp,
+ int *ndepthp,
+ int *rootDepthp,
+ VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB)
+{
+ return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
+ defaultVisp, sizes, bitsPerRGB, -1);
+}
diff --git a/xorg-server/fb/fbcopy.c b/xorg-server/fb/fbcopy.c
index 3f08345c5..541ef713b 100644
--- a/xorg-server/fb/fbcopy.c
+++ b/xorg-server/fb/fbcopy.c
@@ -29,311 +29,247 @@
#include "fb.h"
void
-fbCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
+fbCopyNtoN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
{
- CARD8 alu = pGC ? pGC->alu : GXcopy;
- FbBits pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES;
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ CARD8 alu = pGC ? pGC->alu : GXcopy;
+ FbBits pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES;
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
- while (nbox--)
- {
-#ifndef FB_ACCESS_WRAPPER /* pixman_blt() doesn't support accessors yet */
- if (pm == FB_ALLONES && alu == GXcopy && !reverse &&
- !upsidedown)
- {
- if (!pixman_blt ((uint32_t *)src, (uint32_t *)dst, srcStride, dstStride, srcBpp, dstBpp,
- (pbox->x1 + dx + srcXoff),
- (pbox->y1 + dy + srcYoff),
- (pbox->x1 + dstXoff),
- (pbox->y1 + dstYoff),
- (pbox->x2 - pbox->x1),
- (pbox->y2 - pbox->y1)))
- goto fallback;
- else
- goto next;
- }
- fallback:
+ fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
+ fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+
+ while (nbox--) {
+#ifndef FB_ACCESS_WRAPPER /* pixman_blt() doesn't support accessors yet */
+ if (pm == FB_ALLONES && alu == GXcopy && !reverse && !upsidedown) {
+ if (!pixman_blt
+ ((uint32_t *) src, (uint32_t *) dst, srcStride, dstStride,
+ srcBpp, dstBpp, (pbox->x1 + dx + srcXoff),
+ (pbox->y1 + dy + srcYoff), (pbox->x1 + dstXoff),
+ (pbox->y1 + dstYoff), (pbox->x2 - pbox->x1),
+ (pbox->y2 - pbox->y1)))
+ goto fallback;
+ else
+ goto next;
+ }
+ fallback:
#endif
- fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
-
- (pbox->x2 - pbox->x1) * dstBpp,
- (pbox->y2 - pbox->y1),
-
- alu,
- pm,
- dstBpp,
-
- reverse,
- upsidedown);
+ fbBlt(src + (pbox->y1 + dy + srcYoff) * srcStride,
+ srcStride,
+ (pbox->x1 + dx + srcXoff) * srcBpp,
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ (pbox->x2 - pbox->x1) * dstBpp,
+ (pbox->y2 - pbox->y1), alu, pm, dstBpp, reverse, upsidedown);
#ifndef FB_ACCESS_WRAPPER
- next:
+ next:
#endif
- pbox++;
- }
- fbFinishAccess (pDstDrawable);
- fbFinishAccess (pSrcDrawable);
+ pbox++;
+ }
+ fbFinishAccess(pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
}
void
-fbCopy1toN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
+fbCopy1toN(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
+ fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- while (nbox--)
- {
- if (dstBpp == 1)
- {
- fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
-
- (pbox->x2 - pbox->x1) * dstBpp,
- (pbox->y2 - pbox->y1),
-
- FbOpaqueStipple1Rop(pGC->alu,
- pGC->fgPixel,pGC->bgPixel),
- pPriv->pm,
- dstBpp,
-
- reverse,
- upsidedown);
- }
- else
- {
- fbBltOne ((FbStip *) (src + (pbox->y1 + dy + srcYoff) * srcStride),
- srcStride*(FB_UNIT/FB_STIP_UNIT),
- (pbox->x1 + dx + srcXoff),
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
- dstBpp,
-
- (pbox->x2 - pbox->x1) * dstBpp,
- (pbox->y2 - pbox->y1),
-
- pPriv->and, pPriv->xor,
- pPriv->bgand, pPriv->bgxor);
- }
- pbox++;
+ while (nbox--) {
+ if (dstBpp == 1) {
+ fbBlt(src + (pbox->y1 + dy + srcYoff) * srcStride,
+ srcStride,
+ (pbox->x1 + dx + srcXoff) * srcBpp,
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ (pbox->x2 - pbox->x1) * dstBpp,
+ (pbox->y2 - pbox->y1),
+ FbOpaqueStipple1Rop(pGC->alu,
+ pGC->fgPixel, pGC->bgPixel),
+ pPriv->pm, dstBpp, reverse, upsidedown);
+ }
+ else {
+ fbBltOne((FbStip *) (src + (pbox->y1 + dy + srcYoff) * srcStride),
+ srcStride * (FB_UNIT / FB_STIP_UNIT),
+ (pbox->x1 + dx + srcXoff),
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ dstBpp,
+ (pbox->x2 - pbox->x1) * dstBpp,
+ (pbox->y2 - pbox->y1),
+ pPriv->and, pPriv->xor, pPriv->bgand, pPriv->bgxor);
+ }
+ pbox++;
}
- fbFinishAccess (pDstDrawable);
- fbFinishAccess (pSrcDrawable);
+ fbFinishAccess(pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
}
void
-fbCopyNto1 (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
+fbCopyNto1(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
-
- while (nbox--)
- {
- if (pDstDrawable->bitsPerPixel == 1)
- {
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
-
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetStipDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- fbBltPlane (src + (pbox->y1+ dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
- srcBpp,
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
-
- (pbox->x2 - pbox->x1) * srcBpp,
- (pbox->y2 - pbox->y1),
-
- (FbStip) pPriv->and, (FbStip) pPriv->xor,
- (FbStip) pPriv->bgand, (FbStip) pPriv->bgxor,
- bitplane);
- fbFinishAccess (pDstDrawable);
- fbFinishAccess (pSrcDrawable);
- }
- else
- {
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+
+ while (nbox--) {
+ if (pDstDrawable->bitsPerPixel == 1) {
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+
+ fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff,
+ srcYoff);
+ fbGetStipDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff,
+ dstYoff);
+ fbBltPlane(src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride,
+ (pbox->x1 + dx + srcXoff) * srcBpp, srcBpp,
+ dst + (pbox->y1 + dstYoff) * dstStride, dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ (pbox->x2 - pbox->x1) * srcBpp, (pbox->y2 - pbox->y1),
+ (FbStip) pPriv->and, (FbStip) pPriv->xor,
+ (FbStip) pPriv->bgand, (FbStip) pPriv->bgxor, bitplane);
+ fbFinishAccess(pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
+ }
+ else {
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+
+ FbStip *tmp;
+ FbStride tmpStride;
+ int width, height;
+
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+
+ tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
+ tmp = malloc(tmpStride * height * sizeof(FbStip));
+ if (!tmp)
+ return;
+
+ fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff,
+ srcYoff);
+ fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff,
+ dstYoff);
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- FbStip *tmp;
- FbStride tmpStride;
- int width, height;
-
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
- tmp = malloc(tmpStride * height * sizeof (FbStip));
- if (!tmp)
- return;
-
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- fbBltPlane (src + (pbox->y1+ dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
- srcBpp,
-
- tmp,
- tmpStride,
- 0,
-
- width * srcBpp,
- height,
-
- fbAndStip(GXcopy,FB_ALLONES,FB_ALLONES),
- fbXorStip(GXcopy,FB_ALLONES,FB_ALLONES),
- fbAndStip(GXcopy,0,FB_ALLONES),
- fbXorStip(GXcopy,0,FB_ALLONES),
- bitplane);
- fbBltOne (tmp,
- tmpStride,
- 0,
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
- dstBpp,
-
- width * dstBpp,
- height,
-
- pPriv->and, pPriv->xor,
- pPriv->bgand, pPriv->bgxor);
- free(tmp);
+ fbBltPlane(src + (pbox->y1 + dy + srcYoff) * srcStride,
+ srcStride,
+ (pbox->x1 + dx + srcXoff) * srcBpp,
+ srcBpp,
+ tmp,
+ tmpStride,
+ 0,
+ width * srcBpp,
+ height,
+ fbAndStip(GXcopy, FB_ALLONES, FB_ALLONES),
+ fbXorStip(GXcopy, FB_ALLONES, FB_ALLONES),
+ fbAndStip(GXcopy, 0, FB_ALLONES),
+ fbXorStip(GXcopy, 0, FB_ALLONES), bitplane);
+ fbBltOne(tmp,
+ tmpStride,
+ 0,
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ dstBpp,
+ width * dstBpp,
+ height,
+ pPriv->and, pPriv->xor, pPriv->bgand, pPriv->bgxor);
+ free(tmp);
- fbFinishAccess (pDstDrawable);
- fbFinishAccess (pSrcDrawable);
- }
- pbox++;
+ fbFinishAccess(pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
+ }
+ pbox++;
}
}
RegionPtr
-fbCopyArea (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut)
+fbCopyArea(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut)
{
- miCopyProc copy;
+ miCopyProc copy;
if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
- copy = fb24_32CopyMtoN;
+ copy = fb24_32CopyMtoN;
else
- copy = fbCopyNtoN;
- return miDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
- widthSrc, heightSrc, xOut, yOut, copy, 0, 0);
+ copy = fbCopyNtoN;
+ return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
+ widthSrc, heightSrc, xOut, yOut, copy, 0, 0);
}
RegionPtr
-fbCopyPlane (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut,
- unsigned long bitplane)
+fbCopyPlane(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn,
+ int yIn,
+ int widthSrc,
+ int heightSrc, int xOut, int yOut, unsigned long bitplane)
{
if (pSrcDrawable->bitsPerPixel > 1)
- return miDoCopy (pSrcDrawable, pDstDrawable, pGC,
- xIn, yIn, widthSrc, heightSrc,
- xOut, yOut, fbCopyNto1, (Pixel) bitplane, 0);
+ return miDoCopy(pSrcDrawable, pDstDrawable, pGC,
+ xIn, yIn, widthSrc, heightSrc,
+ xOut, yOut, fbCopyNto1, (Pixel) bitplane, 0);
else if (bitplane & 1)
- return miDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
- widthSrc, heightSrc, xOut, yOut, fbCopy1toN,
- (Pixel) bitplane, 0);
+ return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
+ widthSrc, heightSrc, xOut, yOut, fbCopy1toN,
+ (Pixel) bitplane, 0);
else
- return miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
- xIn, yIn,
- widthSrc,
- heightSrc,
- xOut, yOut, bitplane);
+ return miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
+ xIn, yIn,
+ widthSrc, heightSrc, xOut, yOut, bitplane);
}
diff --git a/xorg-server/fb/fbfill.c b/xorg-server/fb/fbfill.c
index e62a48ae0..de9d6b313 100644
--- a/xorg-server/fb/fbfill.c
+++ b/xorg-server/fb/fbfill.c
@@ -27,204 +27,166 @@
#include "fb.h"
void
-fbFill (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int width,
- int height)
+fbFill(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height)
{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
switch (pGC->fillStyle) {
case FillSolid:
#ifndef FB_ACCESS_WRAPPER
- if (pPriv->and || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
- x + dstXoff, y + dstYoff,
- width, height,
- pPriv->xor))
-#endif
- fbSolid (dst + (y + dstYoff) * dstStride,
- dstStride,
- (x + dstXoff) * dstBpp,
- dstBpp,
- width * dstBpp, height,
- pPriv->and, pPriv->xor);
- break;
+ if (pPriv->and || !pixman_fill((uint32_t *) dst, dstStride, dstBpp,
+ x + dstXoff, y + dstYoff,
+ width, height, pPriv->xor))
+#endif
+ fbSolid(dst + (y + dstYoff) * dstStride,
+ dstStride,
+ (x + dstXoff) * dstBpp,
+ dstBpp, width * dstBpp, height, pPriv->and, pPriv->xor);
+ break;
case FillStippled:
- case FillOpaqueStippled: {
- PixmapPtr pStip = pGC->stipple;
- int stipWidth = pStip->drawable.width;
- int stipHeight = pStip->drawable.height;
-
- if (dstBpp == 1)
- {
- int alu;
- FbBits *stip;
- FbStride stipStride;
- int stipBpp;
- _X_UNUSED int stipXoff, stipYoff;
-
- if (pGC->fillStyle == FillStippled)
- alu = FbStipple1Rop(pGC->alu,pGC->fgPixel);
- else
- alu = FbOpaqueStipple1Rop(pGC->alu,pGC->fgPixel,pGC->bgPixel);
- fbGetDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
- fbTile (dst + (y + dstYoff) * dstStride,
- dstStride,
- x + dstXoff,
- width, height,
- stip,
- stipStride,
- stipWidth,
- stipHeight,
- alu,
- pPriv->pm,
- dstBpp,
-
- (pGC->patOrg.x + pDrawable->x + dstXoff),
- pGC->patOrg.y + pDrawable->y - y);
- fbFinishAccess (&pStip->drawable);
- }
- else
- {
- FbStip *stip;
- FbStride stipStride;
- int stipBpp;
- _X_UNUSED int stipXoff, stipYoff;
- FbBits fgand, fgxor, bgand, bgxor;
-
- fgand = pPriv->and;
- fgxor = pPriv->xor;
- if (pGC->fillStyle == FillStippled)
- {
- bgand = fbAnd(GXnoop,(FbBits) 0,FB_ALLONES);
- bgxor = fbXor(GXnoop,(FbBits) 0,FB_ALLONES);
- }
- else
- {
- bgand = pPriv->bgand;
- bgxor = pPriv->bgxor;
- }
-
- fbGetStipDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
- fbStipple (dst + (y + dstYoff) * dstStride,
- dstStride,
- (x + dstXoff) * dstBpp,
- dstBpp,
- width * dstBpp, height,
- stip,
- stipStride,
- stipWidth,
- stipHeight,
- pPriv->evenStipple,
- fgand, fgxor,
- bgand, bgxor,
- pGC->patOrg.x + pDrawable->x + dstXoff,
- pGC->patOrg.y + pDrawable->y - y);
- fbFinishAccess (&pStip->drawable);
- }
- break;
+ case FillOpaqueStippled:{
+ PixmapPtr pStip = pGC->stipple;
+ int stipWidth = pStip->drawable.width;
+ int stipHeight = pStip->drawable.height;
+
+ if (dstBpp == 1) {
+ int alu;
+ FbBits *stip;
+ FbStride stipStride;
+ int stipBpp;
+ _X_UNUSED int stipXoff, stipYoff;
+
+ if (pGC->fillStyle == FillStippled)
+ alu = FbStipple1Rop(pGC->alu, pGC->fgPixel);
+ else
+ alu = FbOpaqueStipple1Rop(pGC->alu, pGC->fgPixel, pGC->bgPixel);
+ fbGetDrawable(&pStip->drawable, stip, stipStride, stipBpp, stipXoff,
+ stipYoff);
+ fbTile(dst + (y + dstYoff) * dstStride, dstStride, x + dstXoff,
+ width, height, stip, stipStride, stipWidth, stipHeight, alu,
+ pPriv->pm, dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff),
+ pGC->patOrg.y + pDrawable->y - y);
+ fbFinishAccess(&pStip->drawable);
+ }
+ else {
+ FbStip *stip;
+ FbStride stipStride;
+ int stipBpp;
+ _X_UNUSED int stipXoff, stipYoff;
+ FbBits fgand, fgxor, bgand, bgxor;
+
+ fgand = pPriv->and;
+ fgxor = pPriv->xor;
+ if (pGC->fillStyle == FillStippled) {
+ bgand = fbAnd(GXnoop, (FbBits) 0, FB_ALLONES);
+ bgxor = fbXor(GXnoop, (FbBits) 0, FB_ALLONES);
+ }
+ else {
+ bgand = pPriv->bgand;
+ bgxor = pPriv->bgxor;
+ }
+
+ fbGetStipDrawable(&pStip->drawable, stip, stipStride, stipBpp,
+ stipXoff, stipYoff);
+ fbStipple(dst + (y + dstYoff) * dstStride, dstStride,
+ (x + dstXoff) * dstBpp, dstBpp, width * dstBpp, height,
+ stip, stipStride, stipWidth, stipHeight,
+ pPriv->evenStipple, fgand, fgxor, bgand, bgxor,
+ pGC->patOrg.x + pDrawable->x + dstXoff,
+ pGC->patOrg.y + pDrawable->y - y);
+ fbFinishAccess(&pStip->drawable);
+ }
+ break;
}
- case FillTiled: {
- PixmapPtr pTile = pGC->tile.pixmap;
- FbBits *tile;
- FbStride tileStride;
- int tileBpp;
- int tileWidth;
- int tileHeight;
- _X_UNUSED int tileXoff, tileYoff;
-
- fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff);
- tileWidth = pTile->drawable.width;
- tileHeight = pTile->drawable.height;
- fbTile (dst + (y + dstYoff) * dstStride,
- dstStride,
- (x + dstXoff) * dstBpp,
- width * dstBpp, height,
- tile,
- tileStride,
- tileWidth * tileBpp,
- tileHeight,
- pGC->alu,
- pPriv->pm,
- dstBpp,
- (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp,
- pGC->patOrg.y + pDrawable->y - y);
- fbFinishAccess (&pTile->drawable);
- break;
+ case FillTiled:{
+ PixmapPtr pTile = pGC->tile.pixmap;
+ FbBits *tile;
+ FbStride tileStride;
+ int tileBpp;
+ int tileWidth;
+ int tileHeight;
+ _X_UNUSED int tileXoff, tileYoff;
+
+ fbGetDrawable(&pTile->drawable, tile, tileStride, tileBpp, tileXoff,
+ tileYoff);
+ tileWidth = pTile->drawable.width;
+ tileHeight = pTile->drawable.height;
+ fbTile(dst + (y + dstYoff) * dstStride,
+ dstStride,
+ (x + dstXoff) * dstBpp,
+ width * dstBpp, height,
+ tile,
+ tileStride,
+ tileWidth * tileBpp,
+ tileHeight,
+ pGC->alu,
+ pPriv->pm,
+ dstBpp,
+ (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp,
+ pGC->patOrg.y + pDrawable->y - y);
+ fbFinishAccess(&pTile->drawable);
+ break;
}
}
- fbValidateDrawable (pDrawable);
- fbFinishAccess (pDrawable);
+ fbValidateDrawable(pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fbSolidBoxClipped (DrawablePtr pDrawable,
- RegionPtr pClip,
- int x1,
- int y1,
- int x2,
- int y2,
- FbBits and,
- FbBits xor)
+fbSolidBoxClipped(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int x1, int y1, int x2, int y2, FbBits and, FbBits xor)
{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- BoxPtr pbox;
- int nbox;
- int partX1, partX2, partY1, partY2;
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ BoxPtr pbox;
+ int nbox;
+ int partX1, partX2, partY1, partY2;
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+
for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip);
- nbox--;
- pbox++)
- {
- partX1 = pbox->x1;
- if (partX1 < x1)
- partX1 = x1;
-
- partX2 = pbox->x2;
- if (partX2 > x2)
- partX2 = x2;
-
- if (partX2 <= partX1)
- continue;
-
- partY1 = pbox->y1;
- if (partY1 < y1)
- partY1 = y1;
-
- partY2 = pbox->y2;
- if (partY2 > y2)
- partY2 = y2;
-
- if (partY2 <= partY1)
- continue;
+ nbox--; pbox++) {
+ partX1 = pbox->x1;
+ if (partX1 < x1)
+ partX1 = x1;
+
+ partX2 = pbox->x2;
+ if (partX2 > x2)
+ partX2 = x2;
+
+ if (partX2 <= partX1)
+ continue;
+
+ partY1 = pbox->y1;
+ if (partY1 < y1)
+ partY1 = y1;
+
+ partY2 = pbox->y2;
+ if (partY2 > y2)
+ partY2 = y2;
+
+ if (partY2 <= partY1)
+ continue;
#ifndef FB_ACCESS_WRAPPER
- if (and || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
- partX1 + dstXoff, partY1 + dstYoff,
- (partX2 - partX1), (partY2 - partY1),
- xor))
+ if (and || !pixman_fill((uint32_t *) dst, dstStride, dstBpp,
+ partX1 + dstXoff, partY1 + dstYoff,
+ (partX2 - partX1), (partY2 - partY1), xor))
#endif
- fbSolid (dst + (partY1 + dstYoff) * dstStride,
- dstStride,
- (partX1 + dstXoff) * dstBpp,
- dstBpp,
-
- (partX2 - partX1) * dstBpp,
- (partY2 - partY1),
- and, xor);
+ fbSolid(dst + (partY1 + dstYoff) * dstStride,
+ dstStride,
+ (partX1 + dstXoff) * dstBpp,
+ dstBpp,
+ (partX2 - partX1) * dstBpp, (partY2 - partY1), and, xor);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
diff --git a/xorg-server/fb/fbfillrect.c b/xorg-server/fb/fbfillrect.c
index 66ed77fa5..64ba2b493 100644
--- a/xorg-server/fb/fbfillrect.c
+++ b/xorg-server/fb/fbfillrect.c
@@ -1,112 +1,103 @@
-/*
- * Copyright © 1998 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-
-void
-fbPolyFillRect(DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect)
-{
- RegionPtr pClip = fbGetCompositeClip(pGC);
- register BoxPtr pbox;
- BoxPtr pextent;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1, fullY2;
- int partX1, partX2, partY1, partY2;
- int xorg, yorg;
- int n;
-
- xorg = pDrawable->x;
- yorg = pDrawable->y;
-
- pextent = RegionExtents(pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
- while (nrect--)
- {
- fullX1 = prect->x + xorg;
- fullY1 = prect->y + yorg;
- fullX2 = fullX1 + (int) prect->width;
- fullY2 = fullY1 + (int) prect->height;
- prect++;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullY1 < extentY1)
- fullY1 = extentY1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullY2 > extentY2)
- fullY2 = extentY2;
-
- if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
- continue;
- n = RegionNumRects (pClip);
- if (n == 1)
- {
- fbFill (pDrawable,
- pGC,
- fullX1, fullY1, fullX2-fullX1, fullY2-fullY1);
- }
- else
- {
- pbox = RegionRects(pClip);
- /*
- * clip the rectangle to each box in the clip region
- * this is logically equivalent to calling Intersect()
- */
- while(n--)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partY1 = pbox->y1;
- if (partY1 < fullY1)
- partY1 = fullY1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- partY2 = pbox->y2;
- if (partY2 > fullY2)
- partY2 = fullY2;
-
- pbox++;
-
- if (partX1 < partX2 && partY1 < partY2)
- fbFill (pDrawable, pGC,
- partX1, partY1,
- partX2 - partX1, partY2 - partY1);
- }
- }
- }
-}
+/*
+ * Copyright © 1998 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "fb.h"
+
+void
+fbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrect, xRectangle *prect)
+{
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ register BoxPtr pbox;
+ BoxPtr pextent;
+ int extentX1, extentX2, extentY1, extentY2;
+ int fullX1, fullX2, fullY1, fullY2;
+ int partX1, partX2, partY1, partY2;
+ int xorg, yorg;
+ int n;
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+
+ pextent = RegionExtents(pClip);
+ extentX1 = pextent->x1;
+ extentY1 = pextent->y1;
+ extentX2 = pextent->x2;
+ extentY2 = pextent->y2;
+ while (nrect--) {
+ fullX1 = prect->x + xorg;
+ fullY1 = prect->y + yorg;
+ fullX2 = fullX1 + (int) prect->width;
+ fullY2 = fullY1 + (int) prect->height;
+ prect++;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+
+ if (fullY1 < extentY1)
+ fullY1 = extentY1;
+
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullY2 > extentY2)
+ fullY2 = extentY2;
+
+ if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
+ continue;
+ n = RegionNumRects(pClip);
+ if (n == 1) {
+ fbFill(pDrawable,
+ pGC, fullX1, fullY1, fullX2 - fullX1, fullY2 - fullY1);
+ }
+ else {
+ pbox = RegionRects(pClip);
+ /*
+ * clip the rectangle to each box in the clip region
+ * this is logically equivalent to calling Intersect()
+ */
+ while (n--) {
+ partX1 = pbox->x1;
+ if (partX1 < fullX1)
+ partX1 = fullX1;
+ partY1 = pbox->y1;
+ if (partY1 < fullY1)
+ partY1 = fullY1;
+ partX2 = pbox->x2;
+ if (partX2 > fullX2)
+ partX2 = fullX2;
+ partY2 = pbox->y2;
+ if (partY2 > fullY2)
+ partY2 = fullY2;
+
+ pbox++;
+
+ if (partX1 < partX2 && partY1 < partY2)
+ fbFill(pDrawable, pGC,
+ partX1, partY1, partX2 - partX1, partY2 - partY1);
+ }
+ }
+ }
+}
diff --git a/xorg-server/fb/fbfillsp.c b/xorg-server/fb/fbfillsp.c
index 16c33943f..4debe1ebd 100644
--- a/xorg-server/fb/fbfillsp.c
+++ b/xorg-server/fb/fbfillsp.c
@@ -1,100 +1,87 @@
-/*
- * Copyright © 1998 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-
-void
-fbFillSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted)
-{
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BoxPtr pextent, pbox;
- int nbox;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1;
- int partX1, partX2;
-
- pextent = RegionExtents(pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
- while (n--)
- {
- fullX1 = ppt->x;
- fullY1 = ppt->y;
- fullX2 = fullX1 + (int) *pwidth;
- ppt++;
- pwidth++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- nbox = RegionNumRects (pClip);
- if (nbox == 1)
- {
- fbFill (pDrawable,
- pGC,
- fullX1, fullY1, fullX2-fullX1, 1);
- }
- else
- {
- pbox = RegionRects(pClip);
- while(nbox--)
- {
- if (pbox->y1 <= fullY1 && fullY1 < pbox->y2)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- if (partX2 > partX1)
- {
- fbFill (pDrawable, pGC,
- partX1, fullY1,
- partX2 - partX1, 1);
- }
- }
- pbox++;
- }
- }
- }
-}
+/*
+ * Copyright © 1998 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "fb.h"
+
+void
+fbFillSpans(DrawablePtr pDrawable,
+ GCPtr pGC, int n, DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ BoxPtr pextent, pbox;
+ int nbox;
+ int extentX1, extentX2, extentY1, extentY2;
+ int fullX1, fullX2, fullY1;
+ int partX1, partX2;
+
+ pextent = RegionExtents(pClip);
+ extentX1 = pextent->x1;
+ extentY1 = pextent->y1;
+ extentX2 = pextent->x2;
+ extentY2 = pextent->y2;
+ while (n--) {
+ fullX1 = ppt->x;
+ fullY1 = ppt->y;
+ fullX2 = fullX1 + (int) *pwidth;
+ ppt++;
+ pwidth++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ nbox = RegionNumRects(pClip);
+ if (nbox == 1) {
+ fbFill(pDrawable, pGC, fullX1, fullY1, fullX2 - fullX1, 1);
+ }
+ else {
+ pbox = RegionRects(pClip);
+ while (nbox--) {
+ if (pbox->y1 <= fullY1 && fullY1 < pbox->y2) {
+ partX1 = pbox->x1;
+ if (partX1 < fullX1)
+ partX1 = fullX1;
+ partX2 = pbox->x2;
+ if (partX2 > fullX2)
+ partX2 = fullX2;
+ if (partX2 > partX1) {
+ fbFill(pDrawable, pGC,
+ partX1, fullY1, partX2 - partX1, 1);
+ }
+ }
+ pbox++;
+ }
+ }
+ }
+}
diff --git a/xorg-server/fb/fbgc.c b/xorg-server/fb/fbgc.c
index 8108c3acb..e6f8279b3 100644
--- a/xorg-server/fb/fbgc.c
+++ b/xorg-server/fb/fbgc.c
@@ -38,7 +38,7 @@ const GCFuncs fbGCFuncs = {
miCopyClip,
};
-const GCOps fbGCOps = {
+const GCOps fbGCOps = {
fbFillSpans,
fbSetSpans,
fbPutImage,
@@ -64,14 +64,14 @@ const GCOps fbGCOps = {
Bool
fbCreateGC(GCPtr pGC)
{
- pGC->ops = (GCOps *) &fbGCOps;
- pGC->funcs = (GCFuncs *) &fbGCFuncs;
+ pGC->ops = (GCOps *) & fbGCOps;
+ pGC->funcs = (GCFuncs *) & fbGCFuncs;
/* fb wants to translate before scan conversion */
pGC->miTranslate = 1;
pGC->fExpose = 1;
- fbGetGCPrivate(pGC)->bpp = BitsPerPixel (pGC->depth);
+ fbGetGCPrivate(pGC)->bpp = BitsPerPixel(pGC->depth);
return TRUE;
}
@@ -79,56 +79,53 @@ fbCreateGC(GCPtr pGC)
* Pad pixmap to FB_UNIT bits wide
*/
void
-fbPadPixmap (PixmapPtr pPixmap)
+fbPadPixmap(PixmapPtr pPixmap)
{
- int width;
- FbBits *bits;
- FbBits b;
- FbBits mask;
- int height;
- int w;
- int stride;
- int bpp;
+ int width;
+ FbBits *bits;
+ FbBits b;
+ FbBits mask;
+ int height;
+ int w;
+ int stride;
+ int bpp;
_X_UNUSED int xOff, yOff;
- fbGetDrawable (&pPixmap->drawable, bits, stride, bpp, xOff, yOff);
+ fbGetDrawable(&pPixmap->drawable, bits, stride, bpp, xOff, yOff);
width = pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel;
height = pPixmap->drawable.height;
- mask = FbBitsMask (0, width);
- while (height--)
- {
- b = READ(bits) & mask;
- w = width;
- while (w < FB_UNIT)
- {
- b = b | FbScrRight(b, w);
- w <<= 1;
- }
- WRITE(bits, b);
- bits += stride;
+ mask = FbBitsMask(0, width);
+ while (height--) {
+ b = READ(bits) & mask;
+ w = width;
+ while (w < FB_UNIT) {
+ b = b | FbScrRight(b, w);
+ w <<= 1;
+ }
+ WRITE(bits, b);
+ bits += stride;
}
- fbFinishAccess (&pPixmap->drawable);
+ fbFinishAccess(&pPixmap->drawable);
}
/*
* Verify that 'bits' repeats every 'len' bits
*/
static Bool
-fbBitsRepeat (FbBits bits, int len, int width)
+fbBitsRepeat(FbBits bits, int len, int width)
{
- FbBits mask = FbBitsMask(0, len);
- FbBits orig = bits & mask;
- int i;
-
+ FbBits mask = FbBitsMask(0, len);
+ FbBits orig = bits & mask;
+ int i;
+
if (width > FB_UNIT)
- width = FB_UNIT;
- for (i = 0; i < width / len; i++)
- {
- if ((bits & mask) != orig)
- return FALSE;
- bits = FbScrLeft(bits,len);
+ width = FB_UNIT;
+ for (i = 0; i < width / len; i++) {
+ if ((bits & mask) != orig)
+ return FALSE;
+ bits = FbScrLeft(bits, len);
}
return TRUE;
}
@@ -138,17 +135,17 @@ fbBitsRepeat (FbBits bits, int len, int width)
* the first 'len' bits
*/
static Bool
-fbLineRepeat (FbBits *bits, int len, int width)
+fbLineRepeat(FbBits * bits, int len, int width)
{
- FbBits first = bits[0];
-
- if (!fbBitsRepeat (first, len, width))
- return FALSE;
- width = (width + FB_UNIT-1) >> FB_SHIFT;
+ FbBits first = bits[0];
+
+ if (!fbBitsRepeat(first, len, width))
+ return FALSE;
+ width = (width + FB_UNIT - 1) >> FB_SHIFT;
bits++;
while (--width)
- if (READ(bits) != first)
- return FALSE;
+ if (READ(bits) != first)
+ return FALSE;
return TRUE;
}
@@ -157,41 +154,41 @@ fbLineRepeat (FbBits *bits, int len, int width)
* each scanline to represent the entire stipple
*/
static Bool
-fbCanEvenStipple (PixmapPtr pStipple, int bpp)
+fbCanEvenStipple(PixmapPtr pStipple, int bpp)
{
- int len = FB_UNIT / bpp;
- FbBits *bits;
- int stride;
- int stip_bpp;
+ int len = FB_UNIT / bpp;
+ FbBits *bits;
+ int stride;
+ int stip_bpp;
_X_UNUSED int stipXoff, stipYoff;
- int h;
+ int h;
/* can't even stipple 24bpp drawables */
- if ((bpp & (bpp-1)) != 0)
- return FALSE;
+ if ((bpp & (bpp - 1)) != 0)
+ return FALSE;
/* make sure the stipple width is a multiple of the even stipple width */
if (pStipple->drawable.width % len != 0)
- return FALSE;
- fbGetDrawable (&pStipple->drawable, bits, stride, stip_bpp, stipXoff, stipYoff);
+ return FALSE;
+ fbGetDrawable(&pStipple->drawable, bits, stride, stip_bpp, stipXoff,
+ stipYoff);
h = pStipple->drawable.height;
/* check to see that the stipple repeats horizontally */
- while (h--)
- {
- if (!fbLineRepeat (bits, len, pStipple->drawable.width)) {
- fbFinishAccess (&pStipple->drawable);
- return FALSE;
- }
- bits += stride;
+ while (h--) {
+ if (!fbLineRepeat(bits, len, pStipple->drawable.width)) {
+ fbFinishAccess(&pStipple->drawable);
+ return FALSE;
+ }
+ bits += stride;
}
- fbFinishAccess (&pStipple->drawable);
+ fbFinishAccess(&pStipple->drawable);
return TRUE;
}
void
fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- FbBits mask;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbBits mask;
/*
* if the client clip is different or moved OR the subwindowMode has
@@ -199,109 +196,101 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
* we need to recompute the composite clip
*/
- if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
- (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
- )
- {
- miComputeCompositeClip (pGC, pDrawable);
+ if ((changes &
+ (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
+ ) {
+ miComputeCompositeClip(pGC, pDrawable);
}
-
- if (pPriv->bpp != pDrawable->bitsPerPixel)
- {
- changes |= GCStipple|GCForeground|GCBackground|GCPlaneMask;
- pPriv->bpp = pDrawable->bitsPerPixel;
+
+ if (pPriv->bpp != pDrawable->bitsPerPixel) {
+ changes |= GCStipple | GCForeground | GCBackground | GCPlaneMask;
+ pPriv->bpp = pDrawable->bitsPerPixel;
}
- if ((changes & GCTile) && fbGetRotatedPixmap(pGC))
- {
- (*pGC->pScreen->DestroyPixmap) (fbGetRotatedPixmap(pGC));
- fbGetRotatedPixmap(pGC) = 0;
+ if ((changes & GCTile) && fbGetRotatedPixmap(pGC)) {
+ (*pGC->pScreen->DestroyPixmap) (fbGetRotatedPixmap(pGC));
+ fbGetRotatedPixmap(pGC) = 0;
}
-
- if (pGC->fillStyle == FillTiled)
- {
- PixmapPtr pOldTile, pNewTile;
-
- pOldTile = pGC->tile.pixmap;
- if (pOldTile->drawable.bitsPerPixel != pDrawable->bitsPerPixel)
- {
- pNewTile = fbGetRotatedPixmap(pGC);
- if (!pNewTile || pNewTile ->drawable.bitsPerPixel != pDrawable->bitsPerPixel)
- {
- if (pNewTile)
- (*pGC->pScreen->DestroyPixmap) (pNewTile);
- pNewTile = fb24_32ReformatTile (pOldTile, pDrawable->bitsPerPixel);
- }
- if (pNewTile)
- {
- fbGetRotatedPixmap(pGC) = pOldTile;
- pGC->tile.pixmap = pNewTile;
- changes |= GCTile;
- }
- }
+
+ if (pGC->fillStyle == FillTiled) {
+ PixmapPtr pOldTile, pNewTile;
+
+ pOldTile = pGC->tile.pixmap;
+ if (pOldTile->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
+ pNewTile = fbGetRotatedPixmap(pGC);
+ if (!pNewTile ||
+ pNewTile->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
+ if (pNewTile)
+ (*pGC->pScreen->DestroyPixmap) (pNewTile);
+ pNewTile =
+ fb24_32ReformatTile(pOldTile, pDrawable->bitsPerPixel);
+ }
+ if (pNewTile) {
+ fbGetRotatedPixmap(pGC) = pOldTile;
+ pGC->tile.pixmap = pNewTile;
+ changes |= GCTile;
+ }
+ }
}
- if (changes & GCTile)
- {
- if (!pGC->tileIsPixel &&
- FbEvenTile (pGC->tile.pixmap->drawable.width *
- pDrawable->bitsPerPixel))
- fbPadPixmap (pGC->tile.pixmap);
+ if (changes & GCTile) {
+ if (!pGC->tileIsPixel &&
+ FbEvenTile(pGC->tile.pixmap->drawable.width *
+ pDrawable->bitsPerPixel))
+ fbPadPixmap(pGC->tile.pixmap);
}
- if (changes & GCStipple)
- {
- pPriv->evenStipple = FALSE;
+ if (changes & GCStipple) {
+ pPriv->evenStipple = FALSE;
- if (pGC->stipple) {
+ if (pGC->stipple) {
- /* can we do an even stipple ?? */
- if (FbEvenStip (pGC->stipple->drawable.width,
- pDrawable->bitsPerPixel) &&
- (fbCanEvenStipple (pGC->stipple, pDrawable->bitsPerPixel)))
- pPriv->evenStipple = TRUE;
+ /* can we do an even stipple ?? */
+ if (FbEvenStip(pGC->stipple->drawable.width,
+ pDrawable->bitsPerPixel) &&
+ (fbCanEvenStipple(pGC->stipple, pDrawable->bitsPerPixel)))
+ pPriv->evenStipple = TRUE;
- if (pGC->stipple->drawable.width * pDrawable->bitsPerPixel < FB_UNIT)
- fbPadPixmap (pGC->stipple);
- }
+ if (pGC->stipple->drawable.width * pDrawable->bitsPerPixel <
+ FB_UNIT)
+ fbPadPixmap(pGC->stipple);
+ }
}
/*
* Recompute reduced rop values
*/
- if (changes & (GCForeground|GCBackground|GCPlaneMask|GCFunction))
- {
- int s;
- FbBits depthMask;
-
- mask = FbFullMask(pDrawable->bitsPerPixel);
- depthMask = FbFullMask(pDrawable->depth);
-
- pPriv->fg = pGC->fgPixel & mask;
- pPriv->bg = pGC->bgPixel & mask;
-
- if ((pGC->planemask & depthMask) == depthMask)
- pPriv->pm = mask;
- else
- pPriv->pm = pGC->planemask & mask;
-
- s = pDrawable->bitsPerPixel;
- while (s < FB_UNIT)
- {
- pPriv->fg |= pPriv->fg << s;
- pPriv->bg |= pPriv->bg << s;
- pPriv->pm |= pPriv->pm << s;
- s <<= 1;
- }
- pPriv->and = fbAnd(pGC->alu, pPriv->fg, pPriv->pm);
- pPriv->xor = fbXor(pGC->alu, pPriv->fg, pPriv->pm);
- pPriv->bgand = fbAnd(pGC->alu, pPriv->bg, pPriv->pm);
- pPriv->bgxor = fbXor(pGC->alu, pPriv->bg, pPriv->pm);
+ if (changes & (GCForeground | GCBackground | GCPlaneMask | GCFunction)) {
+ int s;
+ FbBits depthMask;
+
+ mask = FbFullMask(pDrawable->bitsPerPixel);
+ depthMask = FbFullMask(pDrawable->depth);
+
+ pPriv->fg = pGC->fgPixel & mask;
+ pPriv->bg = pGC->bgPixel & mask;
+
+ if ((pGC->planemask & depthMask) == depthMask)
+ pPriv->pm = mask;
+ else
+ pPriv->pm = pGC->planemask & mask;
+
+ s = pDrawable->bitsPerPixel;
+ while (s < FB_UNIT) {
+ pPriv->fg |= pPriv->fg << s;
+ pPriv->bg |= pPriv->bg << s;
+ pPriv->pm |= pPriv->pm << s;
+ s <<= 1;
+ }
+ pPriv->and = fbAnd(pGC->alu, pPriv->fg, pPriv->pm);
+ pPriv->xor = fbXor(pGC->alu, pPriv->fg, pPriv->pm);
+ pPriv->bgand = fbAnd(pGC->alu, pPriv->bg, pPriv->pm);
+ pPriv->bgxor = fbXor(pGC->alu, pPriv->bg, pPriv->pm);
}
- if (changes & GCDashList)
- {
- unsigned short n = pGC->numInDashList;
- unsigned char *dash = pGC->dash;
- unsigned int dashLength = 0;
-
- while (n--)
- dashLength += (unsigned int ) *dash++;
- pPriv->dashLength = dashLength;
+ if (changes & GCDashList) {
+ unsigned short n = pGC->numInDashList;
+ unsigned char *dash = pGC->dash;
+ unsigned int dashLength = 0;
+
+ while (n--)
+ dashLength += (unsigned int) *dash++;
+ pPriv->dashLength = dashLength;
}
}
diff --git a/xorg-server/fb/fbgetsp.c b/xorg-server/fb/fbgetsp.c
index bf9f51eb4..9a163b27e 100644
--- a/xorg-server/fb/fbgetsp.c
+++ b/xorg-server/fb/fbgetsp.c
@@ -27,59 +27,44 @@
#include "fb.h"
void
-fbGetSpans(DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart)
+fbGetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart)
{
- FbBits *src, *dst;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- int xoff;
-
+ FbBits *src, *dst;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ int xoff;
+
/*
* XFree86 DDX empties the root borderClip when the VT is
* switched away; this checks for that case
*/
if (!fbDrawableEnabled(pDrawable))
- return;
-
- if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth))
- {
- fb24_32GetSpans (pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
- return;
- }
-
- fbGetDrawable (pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
-
- while (nspans--)
- {
- xoff = (int) (((long) pchardstStart) & (FB_MASK >> 3));
- dst = (FbBits *) (pchardstStart - xoff);
- xoff <<= 3;
- fbBlt (src + (ppt->y + srcYoff) * srcStride, srcStride,
- (ppt->x + srcXoff) * srcBpp,
-
- dst,
- 1,
- xoff,
+ return;
- *pwidth * srcBpp,
- 1,
+ if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
+ fb24_32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
+ return;
+ }
- GXcopy,
- FB_ALLONES,
- srcBpp,
+ fbGetDrawable(pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- FALSE,
- FALSE);
- pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
- ppt++;
- pwidth++;
+ while (nspans--) {
+ xoff = (int) (((long) pchardstStart) & (FB_MASK >> 3));
+ dst = (FbBits *) (pchardstStart - xoff);
+ xoff <<= 3;
+ fbBlt(src + (ppt->y + srcYoff) * srcStride, srcStride,
+ (ppt->x + srcXoff) * srcBpp,
+ dst,
+ 1,
+ xoff,
+ *pwidth * srcBpp, 1, GXcopy, FB_ALLONES, srcBpp, FALSE, FALSE);
+ pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
+ ppt++;
+ pwidth++;
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
diff --git a/xorg-server/fb/fbglyph.c b/xorg-server/fb/fbglyph.c
index 643cf909f..3080a7728 100644
--- a/xorg-server/fb/fbglyph.c
+++ b/xorg-server/fb/fbglyph.c
@@ -30,26 +30,22 @@
#include "dixfontstr.h"
Bool
-fbGlyphIn (RegionPtr pRegion,
- int x,
- int y,
- int width,
- int height)
+fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height)
{
- BoxRec box;
- BoxPtr pExtents = RegionExtents(pRegion);
+ BoxRec box;
+ BoxPtr pExtents = RegionExtents(pRegion);
/*
* Check extents by hand to avoid 16 bit overflows
*/
- if (x < (int) pExtents->x1)
- return FALSE;
- if ((int) pExtents->x2 < x + width)
- return FALSE;
+ if (x < (int) pExtents->x1)
+ return FALSE;
+ if ((int) pExtents->x2 < x + width)
+ return FALSE;
if (y < (int) pExtents->y1)
- return FALSE;
+ return FALSE;
if ((int) pExtents->y2 < y + height)
- return FALSE;
+ return FALSE;
box.x1 = x;
box.x2 = x + width;
box.y1 = y;
@@ -57,7 +53,6 @@ fbGlyphIn (RegionPtr pRegion,
return RegionContainsRect(pRegion, &box) == rgnIN;
}
-
#define WRITE1(d,n,fg) WRITE((d) + (n), (CARD8) fg)
#define WRITE2(d,n,fg) WRITE((CARD16 *) &(d[n]), (CARD16) fg)
#define WRITE4(d,n,fg) WRITE((CARD32 *) &(d[n]), (CARD32) fg)
@@ -66,7 +61,7 @@ fbGlyphIn (RegionPtr pRegion,
#else
#define WRITE8(d) WRITE4(d,0,_ABCA), WRITE4(d,4,_BCAB)
#endif
-
+
/*
* This is a bit tricky, but it's brief. Write 12 bytes worth
* of dest, which is four pixels, at a time. This gives constant
@@ -126,336 +121,296 @@ fbGlyphIn (RegionPtr pRegion,
#endif
void
-fbGlyph24 (FbBits *dstBits,
- FbStride dstStride,
- int dstBpp,
- FbStip *stipple,
- FbBits fg,
- int x,
- int height)
+fbGlyph24(FbBits * dstBits,
+ FbStride dstStride,
+ int dstBpp, FbStip * stipple, FbBits fg, int x, int height)
{
- int lshift;
- FbStip bits;
- CARD8 *dstLine;
- CARD8 *dst;
- FbStip f0, f1, f2;
- int n;
- int shift;
+ int lshift;
+ FbStip bits;
+ CARD8 *dstLine;
+ CARD8 *dst;
+ FbStip f0, f1, f2;
+ int n;
+ int shift;
f0 = fg;
- f1 = FbRot24(f0,16);
- f2 = FbRot24(f0,8);
-
+ f1 = FbRot24(f0, 16);
+ f2 = FbRot24(f0, 8);
+
dstLine = (CARD8 *) dstBits;
dstLine += (x & ~3) * 3;
- dstStride *= (sizeof (FbBits) / sizeof (CARD8));
+ dstStride *= (sizeof(FbBits) / sizeof(CARD8));
shift = x & 3;
lshift = 4 - shift;
- while (height--)
- {
- bits = READ(stipple++);
- n = lshift;
- dst = dstLine;
- while (bits)
- {
- switch (FbStipMoveLsb (FbLeftStipBits (bits, n), 4, n)) {
- case CASE(0,0,0,0):
- break;
- case CASE(1,0,0,0):
- WRITE2(dst,0,_AB);
- WRITE1(dst,2,_C);
- break;
- case CASE(0,1,0,0):
- WRITE1(dst,3,_A);
- WRITE2(dst,4,_BC);
- break;
- case CASE(1,1,0,0):
- WRITE4(dst,0,_ABCA);
- WRITE2(dst,4,_BC);
- break;
- case CASE(0,0,1,0):
- WRITE2(dst,6,_AB);
- WRITE1(dst,8,_C);
- break;
- case CASE(1,0,1,0):
- WRITE2(dst,0,_AB);
- WRITE1(dst,2,_C);
-
- WRITE2(dst,6,_AB);
- WRITE1(dst,8,_C);
- break;
- case CASE(0,1,1,0):
- WRITE1(dst,3,_A);
- WRITE4(dst,4,_BCAB);
- WRITE1(dst,8,_C);
- break;
- case CASE(1,1,1,0):
- WRITE8(dst);
- WRITE1(dst,8,_C);
- break;
- case CASE(0,0,0,1):
- WRITE1(dst,9,_A);
- WRITE2(dst,10,_BC);
- break;
- case CASE(1,0,0,1):
- WRITE2(dst,0,_AB);
- WRITE1(dst,2,_C);
-
- WRITE1(dst,9,_A);
- WRITE2(dst,10,_BC);
- break;
- case CASE(0,1,0,1):
- WRITE1(dst,3,_A);
- WRITE2(dst,4,_BC);
-
- WRITE1(dst,9,_A);
- WRITE2(dst,10,_BC);
- break;
- case CASE(1,1,0,1):
- WRITE4(dst,0,_ABCA);
- WRITE2(dst,4,_BC);
-
- WRITE1(dst,9,_A);
- WRITE2(dst,10,_BC);
- break;
- case CASE(0,0,1,1):
- WRITE2(dst,6,_AB);
- WRITE4(dst,8,_CABC);
- break;
- case CASE(1,0,1,1):
- WRITE2(dst,0,_AB);
- WRITE1(dst,2,_C);
-
- WRITE2(dst,6,_AB);
- WRITE4(dst,8,_CABC);
- break;
- case CASE(0,1,1,1):
- WRITE1(dst,3,_A);
- WRITE4(dst,4,_BCAB);
- WRITE4(dst,8,_CABC);
- break;
- case CASE(1,1,1,1):
- WRITE8(dst);
- WRITE4(dst,8,_CABC);
- break;
- }
- bits = FbStipLeft (bits, n);
- n = 4;
- dst += 12;
- }
- dstLine += dstStride;
+ while (height--) {
+ bits = READ(stipple++);
+ n = lshift;
+ dst = dstLine;
+ while (bits) {
+ switch (FbStipMoveLsb(FbLeftStipBits(bits, n), 4, n)) {
+ case CASE(0, 0, 0, 0):
+ break;
+ case CASE(1, 0, 0, 0):
+ WRITE2(dst, 0, _AB);
+ WRITE1(dst, 2, _C);
+ break;
+ case CASE(0, 1, 0, 0):
+ WRITE1(dst, 3, _A);
+ WRITE2(dst, 4, _BC);
+ break;
+ case CASE(1, 1, 0, 0):
+ WRITE4(dst, 0, _ABCA);
+ WRITE2(dst, 4, _BC);
+ break;
+ case CASE(0, 0, 1, 0):
+ WRITE2(dst, 6, _AB);
+ WRITE1(dst, 8, _C);
+ break;
+ case CASE(1, 0, 1, 0):
+ WRITE2(dst, 0, _AB);
+ WRITE1(dst, 2, _C);
+
+ WRITE2(dst, 6, _AB);
+ WRITE1(dst, 8, _C);
+ break;
+ case CASE(0, 1, 1, 0):
+ WRITE1(dst, 3, _A);
+ WRITE4(dst, 4, _BCAB);
+ WRITE1(dst, 8, _C);
+ break;
+ case CASE(1, 1, 1, 0):
+ WRITE8(dst);
+ WRITE1(dst, 8, _C);
+ break;
+ case CASE(0, 0, 0, 1):
+ WRITE1(dst, 9, _A);
+ WRITE2(dst, 10, _BC);
+ break;
+ case CASE(1, 0, 0, 1):
+ WRITE2(dst, 0, _AB);
+ WRITE1(dst, 2, _C);
+
+ WRITE1(dst, 9, _A);
+ WRITE2(dst, 10, _BC);
+ break;
+ case CASE(0, 1, 0, 1):
+ WRITE1(dst, 3, _A);
+ WRITE2(dst, 4, _BC);
+
+ WRITE1(dst, 9, _A);
+ WRITE2(dst, 10, _BC);
+ break;
+ case CASE(1, 1, 0, 1):
+ WRITE4(dst, 0, _ABCA);
+ WRITE2(dst, 4, _BC);
+
+ WRITE1(dst, 9, _A);
+ WRITE2(dst, 10, _BC);
+ break;
+ case CASE(0, 0, 1, 1):
+ WRITE2(dst, 6, _AB);
+ WRITE4(dst, 8, _CABC);
+ break;
+ case CASE(1, 0, 1, 1):
+ WRITE2(dst, 0, _AB);
+ WRITE1(dst, 2, _C);
+
+ WRITE2(dst, 6, _AB);
+ WRITE4(dst, 8, _CABC);
+ break;
+ case CASE(0, 1, 1, 1):
+ WRITE1(dst, 3, _A);
+ WRITE4(dst, 4, _BCAB);
+ WRITE4(dst, 8, _CABC);
+ break;
+ case CASE(1, 1, 1, 1):
+ WRITE8(dst);
+ WRITE4(dst, 8, _CABC);
+ break;
+ }
+ bits = FbStipLeft(bits, n);
+ n = 4;
+ dst += 12;
+ }
+ dstLine += dstStride;
}
}
void
-fbPolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
+fbPolyGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- CharInfoPtr pci;
- unsigned char *pglyph; /* pointer bits in glyph */
- int gx, gy;
- int gWidth, gHeight; /* width and height of glyph */
- FbStride gStride; /* stride of glyph */
- void (*glyph) (FbBits *,
- FbStride,
- int,
- FbStip *,
- FbBits,
- int,
- int);
- FbBits *dst = 0;
- FbStride dstStride = 0;
- int dstBpp = 0;
- int dstXoff = 0, dstYoff = 0;
-
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ CharInfoPtr pci;
+ unsigned char *pglyph; /* pointer bits in glyph */
+ int gx, gy;
+ int gWidth, gHeight; /* width and height of glyph */
+ FbStride gStride; /* stride of glyph */
+ void (*glyph) (FbBits *, FbStride, int, FbStip *, FbBits, int, int);
+ FbBits *dst = 0;
+ FbStride dstStride = 0;
+ int dstBpp = 0;
+ int dstXoff = 0, dstYoff = 0;
+
glyph = 0;
- if (pGC->fillStyle == FillSolid && pPriv->and == 0)
- {
- dstBpp = pDrawable->bitsPerPixel;
- switch (dstBpp) {
- case 8: glyph = fbGlyph8; break;
- case 16: glyph = fbGlyph16; break;
- case 24: glyph = fbGlyph24; break;
- case 32: glyph = fbGlyph32; break;
- }
+ if (pGC->fillStyle == FillSolid && pPriv->and == 0) {
+ dstBpp = pDrawable->bitsPerPixel;
+ switch (dstBpp) {
+ case 8:
+ glyph = fbGlyph8;
+ break;
+ case 16:
+ glyph = fbGlyph16;
+ break;
+ case 24:
+ glyph = fbGlyph24;
+ break;
+ case 32:
+ glyph = fbGlyph32;
+ break;
+ }
}
x += pDrawable->x;
y += pDrawable->y;
- while (nglyph--)
- {
- pci = *ppci++;
- pglyph = FONTGLYPHBITS(pglyphBase, pci);
- gWidth = GLYPHWIDTHPIXELS(pci);
- gHeight = GLYPHHEIGHTPIXELS(pci);
- if (gWidth && gHeight)
- {
- gx = x + pci->metrics.leftSideBearing;
- gy = y - pci->metrics.ascent;
- if (glyph && gWidth <= sizeof (FbStip) * 8 &&
- fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
- {
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- (*glyph) (dst + (gy + dstYoff) * dstStride,
- dstStride,
- dstBpp,
- (FbStip *) pglyph,
- pPriv->xor,
- gx + dstXoff,
- gHeight);
- fbFinishAccess (pDrawable);
- }
- else
- {
- gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
- fbPushImage (pDrawable,
- pGC,
-
- (FbStip *) pglyph,
- gStride,
- 0,
-
- gx,
- gy,
- gWidth, gHeight);
- }
- }
- x += pci->metrics.characterWidth;
+ while (nglyph--) {
+ pci = *ppci++;
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ gWidth = GLYPHWIDTHPIXELS(pci);
+ gHeight = GLYPHHEIGHTPIXELS(pci);
+ if (gWidth && gHeight) {
+ gx = x + pci->metrics.leftSideBearing;
+ gy = y - pci->metrics.ascent;
+ if (glyph && gWidth <= sizeof(FbStip) * 8 &&
+ fbGlyphIn(fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) {
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff,
+ dstYoff);
+ (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp,
+ (FbStip *) pglyph, pPriv->xor, gx + dstXoff, gHeight);
+ fbFinishAccess(pDrawable);
+ }
+ else {
+ gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof(FbStip);
+ fbPushImage(pDrawable,
+ pGC,
+ (FbStip *) pglyph,
+ gStride, 0, gx, gy, gWidth, gHeight);
+ }
+ }
+ x += pci->metrics.characterWidth;
}
}
-
void
-fbImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase)
+fbImageGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph, CharInfoPtr * ppciInit, pointer pglyphBase)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- CharInfoPtr *ppci;
- CharInfoPtr pci;
- unsigned char *pglyph; /* pointer bits in glyph */
- int gWidth, gHeight; /* width and height of glyph */
- FbStride gStride; /* stride of glyph */
- Bool opaque;
- int n;
- int gx, gy;
- void (*glyph) (FbBits *,
- FbStride,
- int,
- FbStip *,
- FbBits,
- int,
- int);
- FbBits *dst = 0;
- FbStride dstStride = 0;
- int dstBpp = 0;
- int dstXoff = 0, dstYoff = 0;
-
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ CharInfoPtr *ppci;
+ CharInfoPtr pci;
+ unsigned char *pglyph; /* pointer bits in glyph */
+ int gWidth, gHeight; /* width and height of glyph */
+ FbStride gStride; /* stride of glyph */
+ Bool opaque;
+ int n;
+ int gx, gy;
+ void (*glyph) (FbBits *, FbStride, int, FbStip *, FbBits, int, int);
+ FbBits *dst = 0;
+ FbStride dstStride = 0;
+ int dstBpp = 0;
+ int dstXoff = 0, dstYoff = 0;
+
glyph = 0;
- if (pPriv->and == 0)
- {
- dstBpp = pDrawable->bitsPerPixel;
- switch (dstBpp) {
- case 8: glyph = fbGlyph8; break;
- case 16: glyph = fbGlyph16; break;
- case 24: glyph = fbGlyph24; break;
- case 32: glyph = fbGlyph32; break;
- }
+ if (pPriv->and == 0) {
+ dstBpp = pDrawable->bitsPerPixel;
+ switch (dstBpp) {
+ case 8:
+ glyph = fbGlyph8;
+ break;
+ case 16:
+ glyph = fbGlyph16;
+ break;
+ case 24:
+ glyph = fbGlyph24;
+ break;
+ case 32:
+ glyph = fbGlyph32;
+ break;
+ }
}
-
+
x += pDrawable->x;
y += pDrawable->y;
- if (TERMINALFONT (pGC->font)
- && !glyph
- )
- {
- opaque = TRUE;
+ if (TERMINALFONT(pGC->font)
+ && !glyph) {
+ opaque = TRUE;
}
- else
- {
- int xBack, widthBack;
- int yBack, heightBack;
-
- ppci = ppciInit;
- n = nglyph;
- widthBack = 0;
- while (n--)
- widthBack += (*ppci++)->metrics.characterWidth;
-
+ else {
+ int xBack, widthBack;
+ int yBack, heightBack;
+
+ ppci = ppciInit;
+ n = nglyph;
+ widthBack = 0;
+ while (n--)
+ widthBack += (*ppci++)->metrics.characterWidth;
+
xBack = x;
- if (widthBack < 0)
- {
- xBack += widthBack;
- widthBack = -widthBack;
- }
- yBack = y - FONTASCENT(pGC->font);
- heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- fbSolidBoxClipped (pDrawable,
- fbGetCompositeClip(pGC),
- xBack,
- yBack,
- xBack + widthBack,
- yBack + heightBack,
- fbAnd(GXcopy,pPriv->bg,pPriv->pm),
- fbXor(GXcopy,pPriv->bg,pPriv->pm));
- opaque = FALSE;
+ if (widthBack < 0) {
+ xBack += widthBack;
+ widthBack = -widthBack;
+ }
+ yBack = y - FONTASCENT(pGC->font);
+ heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
+ fbSolidBoxClipped(pDrawable,
+ fbGetCompositeClip(pGC),
+ xBack,
+ yBack,
+ xBack + widthBack,
+ yBack + heightBack,
+ fbAnd(GXcopy, pPriv->bg, pPriv->pm),
+ fbXor(GXcopy, pPriv->bg, pPriv->pm));
+ opaque = FALSE;
}
ppci = ppciInit;
- while (nglyph--)
- {
- pci = *ppci++;
- pglyph = FONTGLYPHBITS(pglyphBase, pci);
- gWidth = GLYPHWIDTHPIXELS(pci);
- gHeight = GLYPHHEIGHTPIXELS(pci);
- if (gWidth && gHeight)
- {
- gx = x + pci->metrics.leftSideBearing;
- gy = y - pci->metrics.ascent;
- if (glyph && gWidth <= sizeof (FbStip) * 8 &&
- fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
- {
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- (*glyph) (dst + (gy + dstYoff) * dstStride,
- dstStride,
- dstBpp,
- (FbStip *) pglyph,
- pPriv->fg,
- gx + dstXoff,
- gHeight);
- fbFinishAccess (pDrawable);
- }
- else
- {
- gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
- fbPutXYImage (pDrawable,
- fbGetCompositeClip(pGC),
- pPriv->fg,
- pPriv->bg,
- pPriv->pm,
- GXcopy,
- opaque,
-
- gx,
- gy,
- gWidth, gHeight,
-
- (FbStip *) pglyph,
- gStride,
- 0);
- }
- }
- x += pci->metrics.characterWidth;
+ while (nglyph--) {
+ pci = *ppci++;
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ gWidth = GLYPHWIDTHPIXELS(pci);
+ gHeight = GLYPHHEIGHTPIXELS(pci);
+ if (gWidth && gHeight) {
+ gx = x + pci->metrics.leftSideBearing;
+ gy = y - pci->metrics.ascent;
+ if (glyph && gWidth <= sizeof(FbStip) * 8 &&
+ fbGlyphIn(fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) {
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff,
+ dstYoff);
+ (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp,
+ (FbStip *) pglyph, pPriv->fg, gx + dstXoff, gHeight);
+ fbFinishAccess(pDrawable);
+ }
+ else {
+ gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof(FbStip);
+ fbPutXYImage(pDrawable,
+ fbGetCompositeClip(pGC),
+ pPriv->fg,
+ pPriv->bg,
+ pPriv->pm,
+ GXcopy,
+ opaque,
+ gx,
+ gy,
+ gWidth, gHeight, (FbStip *) pglyph, gStride, 0);
+ }
+ }
+ x += pci->metrics.characterWidth;
}
}
diff --git a/xorg-server/fb/fbimage.c b/xorg-server/fb/fbimage.c
index 63978cc3b..59daa21bb 100644
--- a/xorg-server/fb/fbimage.c
+++ b/xorg-server/fb/fbimage.c
@@ -29,336 +29,250 @@
#include "fb.h"
void
-fbPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage)
+fbPutImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h, int leftPad, int format, char *pImage)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- unsigned long i;
- FbStride srcStride;
- FbStip *src = (FbStip *) pImage;
-
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ unsigned long i;
+ FbStride srcStride;
+ FbStip *src = (FbStip *) pImage;
+
x += pDrawable->x;
y += pDrawable->y;
-
- switch (format)
- {
+
+ switch (format) {
case XYBitmap:
- srcStride = BitmapBytePad(w + leftPad) / sizeof (FbStip);
- fbPutXYImage (pDrawable,
- fbGetCompositeClip(pGC),
- pPriv->fg,
- pPriv->bg,
- pPriv->pm,
- pGC->alu,
- TRUE,
- x, y, w, h,
- src,
- srcStride,
- leftPad);
- break;
+ srcStride = BitmapBytePad(w + leftPad) / sizeof(FbStip);
+ fbPutXYImage(pDrawable,
+ fbGetCompositeClip(pGC),
+ pPriv->fg,
+ pPriv->bg,
+ pPriv->pm,
+ pGC->alu, TRUE, x, y, w, h, src, srcStride, leftPad);
+ break;
case XYPixmap:
- srcStride = BitmapBytePad(w + leftPad) / sizeof (FbStip);
- for (i = (unsigned long)1 << (pDrawable->depth - 1); i; i >>= 1)
- {
- if (i & pGC->planemask)
- {
- fbPutXYImage (pDrawable,
- fbGetCompositeClip(pGC),
- FB_ALLONES,
- 0,
- fbReplicatePixel (i, pDrawable->bitsPerPixel),
- pGC->alu,
- TRUE,
- x, y, w, h,
- src,
- srcStride,
- leftPad);
- src += srcStride * h;
- }
- }
- break;
+ srcStride = BitmapBytePad(w + leftPad) / sizeof(FbStip);
+ for (i = (unsigned long) 1 << (pDrawable->depth - 1); i; i >>= 1) {
+ if (i & pGC->planemask) {
+ fbPutXYImage(pDrawable,
+ fbGetCompositeClip(pGC),
+ FB_ALLONES,
+ 0,
+ fbReplicatePixel(i, pDrawable->bitsPerPixel),
+ pGC->alu,
+ TRUE, x, y, w, h, src, srcStride, leftPad);
+ src += srcStride * h;
+ }
+ }
+ break;
case ZPixmap:
- if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth))
- {
- srcStride = PixmapBytePad(w, pDrawable->depth);
- fb24_32PutZImage (pDrawable,
- fbGetCompositeClip(pGC),
- pGC->alu,
- (FbBits) pGC->planemask,
- x, y, w, h,
- (CARD8 *) pImage,
- srcStride);
- }
- else
- {
- srcStride = PixmapBytePad(w, pDrawable->depth) / sizeof (FbStip);
- fbPutZImage (pDrawable,
- fbGetCompositeClip(pGC),
- pGC->alu,
- pPriv->pm,
- x, y, w, h,
- src, srcStride);
- }
+ if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
+ srcStride = PixmapBytePad(w, pDrawable->depth);
+ fb24_32PutZImage(pDrawable,
+ fbGetCompositeClip(pGC),
+ pGC->alu,
+ (FbBits) pGC->planemask,
+ x, y, w, h, (CARD8 *) pImage, srcStride);
+ }
+ else {
+ srcStride = PixmapBytePad(w, pDrawable->depth) / sizeof(FbStip);
+ fbPutZImage(pDrawable,
+ fbGetCompositeClip(pGC),
+ pGC->alu, pPriv->pm, x, y, w, h, src, srcStride);
+ }
}
}
void
-fbPutZImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- int alu,
- FbBits pm,
- int x,
- int y,
- int width,
- int height,
- FbStip *src,
- FbStride srcStride)
+fbPutZImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ int alu,
+ FbBits pm,
+ int x,
+ int y, int width, int height, FbStip * src, FbStride srcStride)
{
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- int nbox;
- BoxPtr pbox;
- int x1, y1, x2, y2;
-
- fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ int nbox;
+ BoxPtr pbox;
+ int x1, y1, x2, y2;
- for (nbox = RegionNumRects (pClip),
- pbox = RegionRects(pClip);
- nbox--;
- pbox++)
- {
- x1 = x;
- y1 = y;
- x2 = x + width;
- y2 = y + height;
- if (x1 < pbox->x1)
- x1 = pbox->x1;
- if (y1 < pbox->y1)
- y1 = pbox->y1;
- if (x2 > pbox->x2)
- x2 = pbox->x2;
- if (y2 > pbox->y2)
- y2 = pbox->y2;
- if (x1 >= x2 || y1 >= y2)
- continue;
- fbBltStip (src + (y1 - y) * srcStride,
- srcStride,
- (x1 - x) * dstBpp,
+ fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- dst + (y1 + dstYoff) * dstStride,
- dstStride,
- (x1 + dstXoff) * dstBpp,
-
- (x2 - x1) * dstBpp,
- (y2 - y1),
-
- alu,
- pm,
- dstBpp);
+ for (nbox = RegionNumRects(pClip),
+ pbox = RegionRects(pClip); nbox--; pbox++) {
+ x1 = x;
+ y1 = y;
+ x2 = x + width;
+ y2 = y + height;
+ if (x1 < pbox->x1)
+ x1 = pbox->x1;
+ if (y1 < pbox->y1)
+ y1 = pbox->y1;
+ if (x2 > pbox->x2)
+ x2 = pbox->x2;
+ if (y2 > pbox->y2)
+ y2 = pbox->y2;
+ if (x1 >= x2 || y1 >= y2)
+ continue;
+ fbBltStip(src + (y1 - y) * srcStride,
+ srcStride,
+ (x1 - x) * dstBpp,
+ dst + (y1 + dstYoff) * dstStride,
+ dstStride,
+ (x1 + dstXoff) * dstBpp,
+ (x2 - x1) * dstBpp, (y2 - y1), alu, pm, dstBpp);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
-
-void
-fbPutXYImage (DrawablePtr pDrawable,
- RegionPtr pClip,
- FbBits fg,
- FbBits bg,
- FbBits pm,
- int alu,
- Bool opaque,
-
- int x,
- int y,
- int width,
- int height,
- FbStip *src,
- FbStride srcStride,
- int srcX)
+void
+fbPutXYImage(DrawablePtr pDrawable,
+ RegionPtr pClip,
+ FbBits fg,
+ FbBits bg,
+ FbBits pm,
+ int alu,
+ Bool opaque,
+ int x,
+ int y,
+ int width, int height, FbStip * src, FbStride srcStride, int srcX)
{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- int nbox;
- BoxPtr pbox;
- int x1, y1, x2, y2;
- FbBits fgand = 0, fgxor = 0, bgand = 0, bgxor = 0;
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ int nbox;
+ BoxPtr pbox;
+ int x1, y1, x2, y2;
+ FbBits fgand = 0, fgxor = 0, bgand = 0, bgxor = 0;
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- if (dstBpp == 1)
- {
- if (opaque)
- alu = FbOpaqueStipple1Rop(alu,fg,bg);
- else
- alu = FbStipple1Rop(alu,fg);
+ if (dstBpp == 1) {
+ if (opaque)
+ alu = FbOpaqueStipple1Rop(alu, fg, bg);
+ else
+ alu = FbStipple1Rop(alu, fg);
}
- else
- {
- fgand = fbAnd(alu,fg,pm);
- fgxor = fbXor(alu,fg,pm);
- if (opaque)
- {
- bgand = fbAnd(alu,bg,pm);
- bgxor = fbXor(alu,bg,pm);
- }
- else
- {
- bgand = fbAnd(GXnoop,(FbBits)0,FB_ALLONES);
- bgxor = fbXor(GXnoop,(FbBits)0,FB_ALLONES);
- }
+ else {
+ fgand = fbAnd(alu, fg, pm);
+ fgxor = fbXor(alu, fg, pm);
+ if (opaque) {
+ bgand = fbAnd(alu, bg, pm);
+ bgxor = fbXor(alu, bg, pm);
+ }
+ else {
+ bgand = fbAnd(GXnoop, (FbBits) 0, FB_ALLONES);
+ bgxor = fbXor(GXnoop, (FbBits) 0, FB_ALLONES);
+ }
}
- for (nbox = RegionNumRects (pClip),
- pbox = RegionRects(pClip);
- nbox--;
- pbox++)
- {
- x1 = x;
- y1 = y;
- x2 = x + width;
- y2 = y + height;
- if (x1 < pbox->x1)
- x1 = pbox->x1;
- if (y1 < pbox->y1)
- y1 = pbox->y1;
- if (x2 > pbox->x2)
- x2 = pbox->x2;
- if (y2 > pbox->y2)
- y2 = pbox->y2;
- if (x1 >= x2 || y1 >= y2)
- continue;
- if (dstBpp == 1)
- {
- fbBltStip (src + (y1 - y) * srcStride,
- srcStride,
- (x1 - x) + srcX,
-
- (FbStip *) (dst + (y1 + dstYoff) * dstStride),
- FbBitsStrideToStipStride(dstStride),
- (x1 + dstXoff) * dstBpp,
-
- (x2 - x1) * dstBpp,
- (y2 - y1),
-
- alu,
- pm,
- dstBpp);
- }
- else
- {
- fbBltOne (src + (y1 - y) * srcStride,
- srcStride,
- (x1 - x) + srcX,
-
- dst + (y1 + dstYoff) * dstStride,
- dstStride,
- (x1 + dstXoff) * dstBpp,
- dstBpp,
-
- (x2 - x1) * dstBpp,
- (y2 - y1),
-
- fgand, fgxor, bgand, bgxor);
- }
+ for (nbox = RegionNumRects(pClip),
+ pbox = RegionRects(pClip); nbox--; pbox++) {
+ x1 = x;
+ y1 = y;
+ x2 = x + width;
+ y2 = y + height;
+ if (x1 < pbox->x1)
+ x1 = pbox->x1;
+ if (y1 < pbox->y1)
+ y1 = pbox->y1;
+ if (x2 > pbox->x2)
+ x2 = pbox->x2;
+ if (y2 > pbox->y2)
+ y2 = pbox->y2;
+ if (x1 >= x2 || y1 >= y2)
+ continue;
+ if (dstBpp == 1) {
+ fbBltStip(src + (y1 - y) * srcStride,
+ srcStride,
+ (x1 - x) + srcX,
+ (FbStip *) (dst + (y1 + dstYoff) * dstStride),
+ FbBitsStrideToStipStride(dstStride),
+ (x1 + dstXoff) * dstBpp,
+ (x2 - x1) * dstBpp, (y2 - y1), alu, pm, dstBpp);
+ }
+ else {
+ fbBltOne(src + (y1 - y) * srcStride,
+ srcStride,
+ (x1 - x) + srcX,
+ dst + (y1 + dstYoff) * dstStride,
+ dstStride,
+ (x1 + dstXoff) * dstBpp,
+ dstBpp,
+ (x2 - x1) * dstBpp, (y2 - y1), fgand, fgxor, bgand, bgxor);
+ }
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fbGetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d)
+fbGetImage(DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w, int h, unsigned int format, unsigned long planeMask, char *d)
{
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbStip *dst;
- FbStride dstStride;
-
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ FbStip *dst;
+ FbStride dstStride;
+
/*
* XFree86 DDX empties the root borderClip when the VT is
* switched away; this checks for that case
*/
if (!fbDrawableEnabled(pDrawable))
- return;
-
+ return;
+
if (format == ZPixmap &&
- pDrawable->bitsPerPixel != BitsPerPixel (pDrawable->depth))
- {
- fb24_32GetImage (pDrawable, x, y, w, h, format, planeMask, d);
- return;
+ pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
+ fb24_32GetImage(pDrawable, x, y, w, h, format, planeMask, d);
+ return;
}
-
- fbGetDrawable (pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
-
+
+ fbGetDrawable(pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
+
x += pDrawable->x;
y += pDrawable->y;
-
- dst = (FbStip *) d;
- if (format == ZPixmap || srcBpp == 1)
- {
- FbBits pm;
- pm = fbReplicatePixel (planeMask, srcBpp);
- dstStride = PixmapBytePad(w, pDrawable->depth);
- if (pm != FB_ALLONES)
- memset (d, 0, dstStride * h);
- dstStride /= sizeof (FbStip);
- fbBltStip ((FbStip *) (src + (y + srcYoff) * srcStride),
- FbBitsStrideToStipStride(srcStride),
- (x + srcXoff) * srcBpp,
-
- dst,
- dstStride,
- 0,
-
- w * srcBpp, h,
+ dst = (FbStip *) d;
+ if (format == ZPixmap || srcBpp == 1) {
+ FbBits pm;
- GXcopy,
- pm,
- srcBpp);
+ pm = fbReplicatePixel(planeMask, srcBpp);
+ dstStride = PixmapBytePad(w, pDrawable->depth);
+ if (pm != FB_ALLONES)
+ memset(d, 0, dstStride * h);
+ dstStride /= sizeof(FbStip);
+ fbBltStip((FbStip *) (src + (y + srcYoff) * srcStride),
+ FbBitsStrideToStipStride(srcStride),
+ (x + srcXoff) * srcBpp,
+ dst, dstStride, 0, w * srcBpp, h, GXcopy, pm, srcBpp);
}
- else
- {
- dstStride = BitmapBytePad(w) / sizeof (FbStip);
- fbBltPlane (src + (y + srcYoff) * srcStride,
- srcStride,
- (x + srcXoff) * srcBpp,
- srcBpp,
-
- dst,
- dstStride,
- 0,
-
- w * srcBpp, h,
-
- fbAndStip(GXcopy,FB_STIP_ALLONES,FB_STIP_ALLONES),
- fbXorStip(GXcopy,FB_STIP_ALLONES,FB_STIP_ALLONES),
- fbAndStip(GXcopy,0,FB_STIP_ALLONES),
- fbXorStip(GXcopy,0,FB_STIP_ALLONES),
- planeMask);
+ else {
+ dstStride = BitmapBytePad(w) / sizeof(FbStip);
+ fbBltPlane(src + (y + srcYoff) * srcStride,
+ srcStride,
+ (x + srcXoff) * srcBpp,
+ srcBpp,
+ dst,
+ dstStride,
+ 0,
+ w * srcBpp, h,
+ fbAndStip(GXcopy, FB_STIP_ALLONES, FB_STIP_ALLONES),
+ fbXorStip(GXcopy, FB_STIP_ALLONES, FB_STIP_ALLONES),
+ fbAndStip(GXcopy, 0, FB_STIP_ALLONES),
+ fbXorStip(GXcopy, 0, FB_STIP_ALLONES), planeMask);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
diff --git a/xorg-server/fb/fbline.c b/xorg-server/fb/fbline.c
index e290bf886..80dc89dde 100644
--- a/xorg-server/fb/fbline.c
+++ b/xorg-server/fb/fbline.c
@@ -27,141 +27,129 @@
#include "fb.h"
void
-fbZeroLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
+fbZeroLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
{
- int x1, y1, x2, y2;
- int x, y;
- int dashOffset;
+ int x1, y1, x2, y2;
+ int x, y;
+ int dashOffset;
x = pDrawable->x;
y = pDrawable->y;
x1 = ppt->x;
y1 = ppt->y;
dashOffset = pGC->dashOffset;
- while (--npt)
- {
- ++ppt;
- x2 = ppt->x;
- y2 = ppt->y;
- if (mode == CoordModePrevious)
- {
- x2 += x1;
- y2 += y1;
- }
- fbSegment (pDrawable, pGC, x1 + x, y1 + y,
- x2 + x, y2 + y,
- npt == 1 && pGC->capStyle != CapNotLast,
- &dashOffset);
- x1 = x2;
- y1 = y2;
+ while (--npt) {
+ ++ppt;
+ x2 = ppt->x;
+ y2 = ppt->y;
+ if (mode == CoordModePrevious) {
+ x2 += x1;
+ y2 += y1;
+ }
+ fbSegment(pDrawable, pGC, x1 + x, y1 + y,
+ x2 + x, y2 + y,
+ npt == 1 && pGC->capStyle != CapNotLast, &dashOffset);
+ x1 = x2;
+ y1 = y2;
}
}
void
-fbZeroSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSegs)
+fbZeroSegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs)
{
- int dashOffset;
- int x, y;
- Bool drawLast = pGC->capStyle != CapNotLast;
-
+ int dashOffset;
+ int x, y;
+ Bool drawLast = pGC->capStyle != CapNotLast;
+
x = pDrawable->x;
y = pDrawable->y;
- while (nseg--)
- {
- dashOffset = pGC->dashOffset;
- fbSegment (pDrawable, pGC,
- pSegs->x1 + x, pSegs->y1 + y,
- pSegs->x2 + x, pSegs->y2 + y,
- drawLast,
- &dashOffset);
- pSegs++;
+ while (nseg--) {
+ dashOffset = pGC->dashOffset;
+ fbSegment(pDrawable, pGC,
+ pSegs->x1 + x, pSegs->y1 + y,
+ pSegs->x2 + x, pSegs->y2 + y, drawLast, &dashOffset);
+ pSegs++;
}
}
void
-fbFixCoordModePrevious (int npt,
- DDXPointPtr ppt)
+fbFixCoordModePrevious(int npt, DDXPointPtr ppt)
{
- int x, y;
+ int x, y;
x = ppt->x;
y = ppt->y;
npt--;
- while (npt--)
- {
- ppt++;
- x = (ppt->x += x);
- y = (ppt->y += y);
+ while (npt--) {
+ ppt++;
+ x = (ppt->x += x);
+ y = (ppt->y += y);
}
}
void
-fbPolyLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
+fbPolyLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
{
- void (*line) (DrawablePtr, GCPtr, int mode, int npt, DDXPointPtr ppt);
-
- if (pGC->lineWidth == 0)
- {
- line = fbZeroLine;
- if (pGC->fillStyle == FillSolid &&
- pGC->lineStyle == LineSolid &&
- RegionNumRects (fbGetCompositeClip(pGC)) == 1)
- {
- switch (pDrawable->bitsPerPixel) {
- case 8: line = fbPolyline8; break;
- case 16: line = fbPolyline16; break;
- case 24: line = fbPolyline24; break;
- case 32: line = fbPolyline32; break;
- }
- }
+ void (*line) (DrawablePtr, GCPtr, int mode, int npt, DDXPointPtr ppt);
+
+ if (pGC->lineWidth == 0) {
+ line = fbZeroLine;
+ if (pGC->fillStyle == FillSolid &&
+ pGC->lineStyle == LineSolid &&
+ RegionNumRects(fbGetCompositeClip(pGC)) == 1) {
+ switch (pDrawable->bitsPerPixel) {
+ case 8:
+ line = fbPolyline8;
+ break;
+ case 16:
+ line = fbPolyline16;
+ break;
+ case 24:
+ line = fbPolyline24;
+ break;
+ case 32:
+ line = fbPolyline32;
+ break;
+ }
+ }
}
- else
- {
- if (pGC->lineStyle != LineSolid)
- line = miWideDash;
- else
- line = miWideLine;
+ else {
+ if (pGC->lineStyle != LineSolid)
+ line = miWideDash;
+ else
+ line = miWideLine;
}
(*line) (pDrawable, pGC, mode, npt, ppt);
}
void
-fbPolySegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pseg)
+fbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
{
- void (*seg) (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pseg);
+ void (*seg) (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
- if (pGC->lineWidth == 0)
- {
- seg = fbZeroSegment;
- if (pGC->fillStyle == FillSolid &&
- pGC->lineStyle == LineSolid &&
- RegionNumRects (fbGetCompositeClip(pGC)) == 1)
- {
- switch (pDrawable->bitsPerPixel) {
- case 8: seg = fbPolySegment8; break;
- case 16: seg = fbPolySegment16; break;
- case 24: seg = fbPolySegment24; break;
- case 32: seg = fbPolySegment32; break;
- }
- }
+ if (pGC->lineWidth == 0) {
+ seg = fbZeroSegment;
+ if (pGC->fillStyle == FillSolid &&
+ pGC->lineStyle == LineSolid &&
+ RegionNumRects(fbGetCompositeClip(pGC)) == 1) {
+ switch (pDrawable->bitsPerPixel) {
+ case 8:
+ seg = fbPolySegment8;
+ break;
+ case 16:
+ seg = fbPolySegment16;
+ break;
+ case 24:
+ seg = fbPolySegment24;
+ break;
+ case 32:
+ seg = fbPolySegment32;
+ break;
+ }
+ }
}
- else
- {
- seg = miPolySegment;
+ else {
+ seg = miPolySegment;
}
(*seg) (pDrawable, pGC, nseg, pseg);
}
diff --git a/xorg-server/fb/fboverlay.c b/xorg-server/fb/fboverlay.c
index 255cc23c1..998be66d9 100644
--- a/xorg-server/fb/fboverlay.c
+++ b/xorg-server/fb/fboverlay.c
@@ -22,7 +22,6 @@
* Author: Keith Packard, SuSE, Inc.
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -34,9 +33,11 @@
#include "shmint.h"
static DevPrivateKeyRec fbOverlayScreenPrivateKeyRec;
+
#define fbOverlayScreenPrivateKey (&fbOverlayScreenPrivateKeyRec)
-DevPrivateKey fbOverlayGetScreenPrivateKey(void)
+DevPrivateKey
+fbOverlayGetScreenPrivateKey(void)
{
return fbOverlayScreenPrivateKey;
}
@@ -48,49 +49,46 @@ DevPrivateKey fbOverlayGetScreenPrivateKey(void)
Bool
fbOverlayCreateWindow(WindowPtr pWin)
{
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen);
- int i;
- PixmapPtr pPixmap;
-
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen);
+ int i;
+ PixmapPtr pPixmap;
+
if (pWin->drawable.class != InputOutput)
- return TRUE;
+ return TRUE;
if (pWin->drawable.bitsPerPixel == 32)
- pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
-
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- pPixmap = pScrPriv->layer[i].u.run.pixmap;
- if (pWin->drawable.depth == pPixmap->drawable.depth)
- {
- dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pPixmap);
- /*
- * Make sure layer keys are written correctly by
- * having non-root layers set to full while the
- * root layer is set to empty. This will cause
- * all of the layers to get painted when the root
- * is mapped
- */
- if (!pWin->parent)
- {
- RegionEmpty(&pScrPriv->layer[i].u.run.region);
- }
- return TRUE;
- }
+ pWin->drawable.bitsPerPixel =
+ fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
+
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ pPixmap = pScrPriv->layer[i].u.run.pixmap;
+ if (pWin->drawable.depth == pPixmap->drawable.depth) {
+ dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pPixmap);
+ /*
+ * Make sure layer keys are written correctly by
+ * having non-root layers set to full while the
+ * root layer is set to empty. This will cause
+ * all of the layers to get painted when the root
+ * is mapped
+ */
+ if (!pWin->parent) {
+ RegionEmpty(&pScrPriv->layer[i].u.run.region);
+ }
+ return TRUE;
+ }
}
return FALSE;
}
Bool
-fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen)
+fbOverlayCloseScreen(int iScreen, ScreenPtr pScreen)
{
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- int i;
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+ int i;
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- (*pScreen->DestroyPixmap)(pScrPriv->layer[i].u.run.pixmap);
- RegionUninit(&pScrPriv->layer[i].u.run.region);
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ (*pScreen->DestroyPixmap) (pScrPriv->layer[i].u.run.pixmap);
+ RegionUninit(&pScrPriv->layer[i].u.run.region);
}
return TRUE;
}
@@ -102,103 +100,90 @@ int
fbOverlayWindowLayer(WindowPtr pWin)
{
FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen);
- int i;
+ int i;
for (i = 0; i < pScrPriv->nlayers; i++)
- if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey()) ==
- (pointer) pScrPriv->layer[i].u.run.pixmap)
- return i;
+ if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey()) ==
+ (pointer) pScrPriv->layer[i].u.run.pixmap)
+ return i;
return 0;
}
Bool
fbOverlayCreateScreenResources(ScreenPtr pScreen)
{
- int i;
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- PixmapPtr pPixmap;
- pointer pbits;
- int width;
- int depth;
- BoxRec box;
-
+ int i;
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+ PixmapPtr pPixmap;
+ pointer pbits;
+ int width;
+ int depth;
+ BoxRec box;
+
if (!miCreateScreenResources(pScreen))
- return FALSE;
+ return FALSE;
box.x1 = 0;
box.y1 = 0;
box.x2 = pScreen->width;
box.y2 = pScreen->height;
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- pbits = pScrPriv->layer[i].u.init.pbits;
- width = pScrPriv->layer[i].u.init.width;
- depth = pScrPriv->layer[i].u.init.depth;
- pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0);
- if (!pPixmap)
- return FALSE;
- if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width,
- pScreen->height, depth,
- BitsPerPixel(depth),
- PixmapBytePad(width, depth),
- pbits))
- return FALSE;
- pScrPriv->layer[i].u.run.pixmap = pPixmap;
- RegionInit(&pScrPriv->layer[i].u.run.region, &box, 0);
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ pbits = pScrPriv->layer[i].u.init.pbits;
+ width = pScrPriv->layer[i].u.init.width;
+ depth = pScrPriv->layer[i].u.init.depth;
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, 0);
+ if (!pPixmap)
+ return FALSE;
+ if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScreen->width,
+ pScreen->height, depth,
+ BitsPerPixel(depth),
+ PixmapBytePad(width, depth),
+ pbits))
+ return FALSE;
+ pScrPriv->layer[i].u.run.pixmap = pPixmap;
+ RegionInit(&pScrPriv->layer[i].u.run.region, &box, 0);
}
pScreen->devPrivate = pScrPriv->layer[0].u.run.pixmap;
return TRUE;
}
void
-fbOverlayPaintKey (DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int layer)
+fbOverlayPaintKey(DrawablePtr pDrawable,
+ RegionPtr pRegion, CARD32 pixel, int layer)
{
- fbFillRegionSolid (pDrawable, pRegion, 0,
- fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
+ fbFillRegionSolid(pDrawable, pRegion, 0,
+ fbReplicatePixel(pixel, pDrawable->bitsPerPixel));
}
/*
* Track visible region for each layer
*/
void
-fbOverlayUpdateLayerRegion (ScreenPtr pScreen,
- int layer,
- RegionPtr prgn)
+fbOverlayUpdateLayerRegion(ScreenPtr pScreen, int layer, RegionPtr prgn)
{
FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- int i;
- RegionRec rgnNew;
-
+ int i;
+ RegionRec rgnNew;
+
if (!prgn || !RegionNotEmpty(prgn))
- return;
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- if (i == layer)
- {
- /* add new piece to this fb */
- RegionUnion(&pScrPriv->layer[i].u.run.region,
- &pScrPriv->layer[i].u.run.region,
- prgn);
- }
- else if (RegionNotEmpty(&pScrPriv->layer[i].u.run.region))
- {
- /* paint new piece with chroma key */
- RegionNull(&rgnNew);
- RegionIntersect(&rgnNew, prgn,
- &pScrPriv->layer[i].u.run.region);
- (*pScrPriv->PaintKey) (&pScrPriv->layer[i].u.run.pixmap->drawable,
- &rgnNew,
- pScrPriv->layer[i].key,
- i);
- RegionUninit(&rgnNew);
- /* remove piece from other fbs */
- RegionSubtract(&pScrPriv->layer[i].u.run.region,
- &pScrPriv->layer[i].u.run.region,
- prgn);
- }
+ return;
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ if (i == layer) {
+ /* add new piece to this fb */
+ RegionUnion(&pScrPriv->layer[i].u.run.region,
+ &pScrPriv->layer[i].u.run.region, prgn);
+ }
+ else if (RegionNotEmpty(&pScrPriv->layer[i].u.run.region)) {
+ /* paint new piece with chroma key */
+ RegionNull(&rgnNew);
+ RegionIntersect(&rgnNew, prgn, &pScrPriv->layer[i].u.run.region);
+ (*pScrPriv->PaintKey) (&pScrPriv->layer[i].u.run.pixmap->drawable,
+ &rgnNew, pScrPriv->layer[i].key, i);
+ RegionUninit(&rgnNew);
+ /* remove piece from other fbs */
+ RegionSubtract(&pScrPriv->layer[i].u.run.region,
+ &pScrPriv->layer[i].u.run.region, prgn);
+ }
}
}
@@ -206,17 +191,15 @@ fbOverlayUpdateLayerRegion (ScreenPtr pScreen,
* Copy only areas in each layer containing real bits
*/
void
-fbOverlayCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
+fbOverlayCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- RegionRec rgnDst;
- int dx, dy;
- int i;
- RegionRec layerRgn[FB_OVERLAY_MAX];
- PixmapPtr pPixmap;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+ RegionRec rgnDst;
+ int dx, dy;
+ int i;
+ RegionRec layerRgn[FB_OVERLAY_MAX];
+ PixmapPtr pPixmap;
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
@@ -231,168 +214,146 @@ fbOverlayCopyWindow(WindowPtr pWin,
/*
* Compute the portion of each fb affected by this copy
*/
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- RegionNull(&layerRgn[i]);
- RegionIntersect(&layerRgn[i], &rgnDst,
- &pScrPriv->layer[i].u.run.region);
- if (RegionNotEmpty(&layerRgn[i]))
- {
- RegionTranslate(&layerRgn[i], -dx, -dy);
- pPixmap = pScrPriv->layer[i].u.run.pixmap;
- miCopyRegion (&pPixmap->drawable, &pPixmap->drawable,
- 0,
- &layerRgn[i], dx, dy, pScrPriv->CopyWindow, 0,
- (void *)(long) i);
- }
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ RegionNull(&layerRgn[i]);
+ RegionIntersect(&layerRgn[i], &rgnDst,
+ &pScrPriv->layer[i].u.run.region);
+ if (RegionNotEmpty(&layerRgn[i])) {
+ RegionTranslate(&layerRgn[i], -dx, -dy);
+ pPixmap = pScrPriv->layer[i].u.run.pixmap;
+ miCopyRegion(&pPixmap->drawable, &pPixmap->drawable,
+ 0,
+ &layerRgn[i], dx, dy, pScrPriv->CopyWindow, 0,
+ (void *) (long) i);
+ }
}
/*
* Update regions
*/
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- if (RegionNotEmpty(&layerRgn[i]))
- fbOverlayUpdateLayerRegion (pScreen, i, &layerRgn[i]);
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ if (RegionNotEmpty(&layerRgn[i]))
+ fbOverlayUpdateLayerRegion(pScreen, i, &layerRgn[i]);
- RegionUninit(&layerRgn[i]);
+ RegionUninit(&layerRgn[i]);
}
RegionUninit(&rgnDst);
-}
+}
void
-fbOverlayWindowExposures (WindowPtr pWin,
- RegionPtr prgn,
- RegionPtr other_exposed)
+fbOverlayWindowExposures(WindowPtr pWin,
+ RegionPtr prgn, RegionPtr other_exposed)
{
- fbOverlayUpdateLayerRegion (pWin->drawable.pScreen,
- fbOverlayWindowLayer (pWin),
- prgn);
+ fbOverlayUpdateLayerRegion(pWin->drawable.pScreen,
+ fbOverlayWindowLayer(pWin), prgn);
miWindowExposures(pWin, prgn, other_exposed);
}
Bool
-fbOverlaySetupScreen(ScreenPtr pScreen,
- pointer pbits1,
- pointer pbits2,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width1,
- int width2,
- int bpp1,
- int bpp2)
+fbOverlaySetupScreen(ScreenPtr pScreen,
+ pointer pbits1,
+ pointer pbits2,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy, int width1, int width2, int bpp1, int bpp2)
{
- return fbSetupScreen (pScreen,
- pbits1,
- xsize,
- ysize,
- dpix,
- dpiy,
- width1,
- bpp1);
+ return fbSetupScreen(pScreen,
+ pbits1, xsize, ysize, dpix, dpiy, width1, bpp1);
}
static Bool
fb24_32OverlayCreateScreenResources(ScreenPtr pScreen)
{
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
int pitch;
Bool retval;
int i;
- if((retval = fbOverlayCreateScreenResources(pScreen))) {
- for (i = 0; i < pScrPriv->nlayers; i++)
- {
- /* fix the screen pixmap */
- PixmapPtr pPix = (PixmapPtr) pScrPriv->layer[i].u.run.pixmap;
- if (pPix->drawable.bitsPerPixel == 32) {
- pPix->drawable.bitsPerPixel = 24;
- pitch = BitmapBytePad(pPix->drawable.width * 24);
- pPix->devKind = pitch;
- }
- }
+ if ((retval = fbOverlayCreateScreenResources(pScreen))) {
+ for (i = 0; i < pScrPriv->nlayers; i++) {
+ /* fix the screen pixmap */
+ PixmapPtr pPix = (PixmapPtr) pScrPriv->layer[i].u.run.pixmap;
+
+ if (pPix->drawable.bitsPerPixel == 32) {
+ pPix->drawable.bitsPerPixel = 24;
+ pitch = BitmapBytePad(pPix->drawable.width * 24);
+ pPix->devKind = pitch;
+ }
+ }
}
return retval;
}
Bool
-fbOverlayFinishScreenInit(ScreenPtr pScreen,
- pointer pbits1,
- pointer pbits2,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width1,
- int width2,
- int bpp1,
- int bpp2,
- int depth1,
- int depth2)
+fbOverlayFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits1,
+ pointer pbits2,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width1,
+ int width2,
+ int bpp1, int bpp2, int depth1, int depth2)
{
- VisualPtr visuals;
- DepthPtr depths;
- int nvisuals;
- int ndepths;
- int bpp = 0, imagebpp = 32;
- VisualID defaultVisual;
- FbOverlayScrPrivPtr pScrPriv;
-
- if (!dixRegisterPrivateKey(&fbOverlayScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- pScrPriv = malloc(sizeof (FbOverlayScrPrivRec));
+ VisualPtr visuals;
+ DepthPtr depths;
+ int nvisuals;
+ int ndepths;
+ int bpp = 0, imagebpp = 32;
+ VisualID defaultVisual;
+ FbOverlayScrPrivPtr pScrPriv;
+
+ if (!dixRegisterPrivateKey
+ (&fbOverlayScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ pScrPriv = malloc(sizeof(FbOverlayScrPrivRec));
if (!pScrPriv)
- return FALSE;
-
+ return FALSE;
+
if (bpp1 == 32 || bpp2 == 32)
- bpp = 32;
+ bpp = 32;
else if (bpp1 == 24 || bpp2 == 24)
- bpp = 24;
-
- if (bpp == 24)
- {
- int f;
-
- imagebpp = 32;
- /*
- * Check to see if we're advertising a 24bpp image format,
- * in which case windows will use it in preference to a 32 bit
- * format.
- */
- for (f = 0; f < screenInfo.numPixmapFormats; f++)
- {
- if (screenInfo.formats[f].bitsPerPixel == 24)
- {
- imagebpp = 24;
- break;
- }
- }
+ bpp = 24;
+
+ if (bpp == 24) {
+ int f;
+
+ imagebpp = 32;
+ /*
+ * Check to see if we're advertising a 24bpp image format,
+ * in which case windows will use it in preference to a 32 bit
+ * format.
+ */
+ for (f = 0; f < screenInfo.numPixmapFormats; f++) {
+ if (screenInfo.formats[f].bitsPerPixel == 24) {
+ imagebpp = 24;
+ break;
+ }
+ }
}
- if (imagebpp == 32)
- {
- fbGetScreenPrivate(pScreen)->win32bpp = bpp;
- fbGetScreenPrivate(pScreen)->pix32bpp = bpp;
+ if (imagebpp == 32) {
+ fbGetScreenPrivate(pScreen)->win32bpp = bpp;
+ fbGetScreenPrivate(pScreen)->pix32bpp = bpp;
}
- else
- {
- fbGetScreenPrivate(pScreen)->win32bpp = 32;
- fbGetScreenPrivate(pScreen)->pix32bpp = 32;
+ else {
+ fbGetScreenPrivate(pScreen)->win32bpp = 32;
+ fbGetScreenPrivate(pScreen)->pix32bpp = 32;
}
-
- if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &depth1,
- &defaultVisual, ((unsigned long)1<<(bpp1-1)) |
- ((unsigned long)1<<(bpp2-1)), 8)) {
- free(pScrPriv);
- return FALSE;
+
+ if (!fbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &depth1,
+ &defaultVisual, ((unsigned long) 1 << (bpp1 - 1)) |
+ ((unsigned long) 1 << (bpp2 - 1)), 8)) {
+ free(pScrPriv);
+ return FALSE;
}
- if (! miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0,
- depth1, ndepths, depths,
- defaultVisual, nvisuals, visuals)) {
- free(pScrPriv);
- return FALSE;
+ if (!miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0,
+ depth1, ndepths, depths,
+ defaultVisual, nvisuals, visuals)) {
+ free(pScrPriv);
+ return FALSE;
}
/* MI thinks there's no frame buffer */
#ifdef MITSHM
@@ -400,7 +361,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
#endif
pScreen->minInstalledCmaps = 1;
pScreen->maxInstalledCmaps = 2;
-
+
pScrPriv->nlayers = 2;
pScrPriv->PaintKey = fbOverlayPaintKey;
pScrPriv->CopyWindow = fbCopyWindowProc;
@@ -412,17 +373,16 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
pScrPriv->layer[1].u.init.width = width2;
pScrPriv->layer[1].u.init.depth = depth2;
dixSetPrivate(&pScreen->devPrivates, fbOverlayScreenPrivateKey, pScrPriv);
-
+
/* overwrite miCloseScreen with our own */
pScreen->CloseScreen = fbOverlayCloseScreen;
pScreen->CreateScreenResources = fbOverlayCreateScreenResources;
pScreen->CreateWindow = fbOverlayCreateWindow;
pScreen->WindowExposures = fbOverlayWindowExposures;
pScreen->CopyWindow = fbOverlayCopyWindow;
- if (bpp == 24 && imagebpp == 32)
- {
- pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader;
- pScreen->CreateScreenResources = fb24_32OverlayCreateScreenResources;
+ if (bpp == 24 && imagebpp == 32) {
+ pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader;
+ pScreen->CreateScreenResources = fb24_32OverlayCreateScreenResources;
}
return TRUE;
diff --git a/xorg-server/fb/fboverlay.h b/xorg-server/fb/fboverlay.h
index b626a7702..76198cda5 100644
--- a/xorg-server/fb/fboverlay.h
+++ b/xorg-server/fb/fboverlay.h
@@ -33,91 +33,80 @@ extern _X_EXPORT DevPrivateKey fbOverlayGetScreenPrivateKey(void);
#define FB_OVERLAY_MAX 2
#endif
-typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int);
+typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int);
typedef struct _fbOverlayLayer {
union {
- struct {
- pointer pbits;
- int width;
- int depth;
- } init;
- struct {
- PixmapPtr pixmap;
- RegionRec region;
- } run;
+ struct {
+ pointer pbits;
+ int width;
+ int depth;
+ } init;
+ struct {
+ PixmapPtr pixmap;
+ RegionRec region;
+ } run;
} u;
- CARD32 key; /* special pixel value */
+ CARD32 key; /* special pixel value */
} FbOverlayLayer;
typedef struct _fbOverlayScrPriv {
- int nlayers;
- fbOverlayPaintKeyProc PaintKey;
- miCopyProc CopyWindow;
- FbOverlayLayer layer[FB_OVERLAY_MAX];
+ int nlayers;
+ fbOverlayPaintKeyProc PaintKey;
+ miCopyProc CopyWindow;
+ FbOverlayLayer layer[FB_OVERLAY_MAX];
} FbOverlayScrPrivRec, *FbOverlayScrPrivPtr;
#define fbOverlayGetScrPriv(s) \
dixLookupPrivate(&(s)->devPrivates, fbOverlayGetScreenPrivateKey())
extern _X_EXPORT Bool
-fbOverlayCreateWindow(WindowPtr pWin);
+ fbOverlayCreateWindow(WindowPtr pWin);
extern _X_EXPORT Bool
-fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen);
+ fbOverlayCloseScreen(int iScreen, ScreenPtr pScreen);
extern _X_EXPORT int
-fbOverlayWindowLayer(WindowPtr pWin);
+ fbOverlayWindowLayer(WindowPtr pWin);
extern _X_EXPORT Bool
-fbOverlayCreateScreenResources(ScreenPtr pScreen);
+ fbOverlayCreateScreenResources(ScreenPtr pScreen);
extern _X_EXPORT void
-fbOverlayPaintKey (DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int layer);
+
+fbOverlayPaintKey(DrawablePtr pDrawable,
+ RegionPtr pRegion, CARD32 pixel, int layer);
extern _X_EXPORT void
-fbOverlayUpdateLayerRegion (ScreenPtr pScreen,
- int layer,
- RegionPtr prgn);
+ fbOverlayUpdateLayerRegion(ScreenPtr pScreen, int layer, RegionPtr prgn);
-
extern _X_EXPORT void
-fbOverlayCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-
+ fbOverlayCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+
extern _X_EXPORT void
-fbOverlayWindowExposures (WindowPtr pWin,
- RegionPtr prgn,
- RegionPtr other_exposed);
+
+fbOverlayWindowExposures(WindowPtr pWin,
+ RegionPtr prgn, RegionPtr other_exposed);
extern _X_EXPORT Bool
-fbOverlaySetupScreen(ScreenPtr pScreen,
- pointer pbits1,
- pointer pbits2,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width1,
- int width2,
- int bpp1,
- int bpp2);
+
+fbOverlaySetupScreen(ScreenPtr pScreen,
+ pointer pbits1,
+ pointer pbits2,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy, int width1, int width2, int bpp1, int bpp2);
extern _X_EXPORT Bool
-fbOverlayFinishScreenInit(ScreenPtr pScreen,
- pointer pbits1,
- pointer pbits2,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width1,
- int width2,
- int bpp1,
- int bpp2,
- int depth1,
- int depth2);
-
-#endif /* _FBOVERLAY_H_ */
+
+fbOverlayFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits1,
+ pointer pbits2,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width1,
+ int width2,
+ int bpp1, int bpp2, int depth1, int depth2);
+
+#endif /* _FBOVERLAY_H_ */
diff --git a/xorg-server/fb/fbpict.c b/xorg-server/fb/fbpict.c
index 57c93fd06..097a1a6bd 100644
--- a/xorg-server/fb/fbpict.c
+++ b/xorg-server/fb/fbpict.c
@@ -36,171 +36,165 @@
#include "fbpict.h"
void
-fbComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+fbComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
pixman_image_t *src, *mask, *dest;
int src_xoff, src_yoff;
int msk_xoff, msk_yoff;
int dst_xoff, dst_yoff;
-
- miCompositeSourceValidate (pSrc);
+
+ miCompositeSourceValidate(pSrc);
if (pMask)
- miCompositeSourceValidate (pMask);
-
- src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
- mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
- dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
-
- if (src && dest && !(pMask && !mask))
- {
- pixman_image_composite (op, src, mask, dest,
- xSrc + src_xoff, ySrc + src_yoff,
- xMask + msk_xoff, yMask + msk_yoff,
- xDst + dst_xoff, yDst + dst_yoff,
- width, height);
+ miCompositeSourceValidate(pMask);
+
+ src = image_from_pict(pSrc, FALSE, &src_xoff, &src_yoff);
+ mask = image_from_pict(pMask, FALSE, &msk_xoff, &msk_yoff);
+ dest = image_from_pict(pDst, TRUE, &dst_xoff, &dst_yoff);
+
+ if (src && dest && !(pMask && !mask)) {
+ pixman_image_composite(op, src, mask, dest,
+ xSrc + src_xoff, ySrc + src_yoff,
+ xMask + msk_xoff, yMask + msk_yoff,
+ xDst + dst_xoff, yDst + dst_yoff, width, height);
}
- free_pixman_pict (pSrc, src);
- free_pixman_pict (pMask, mask);
- free_pixman_pict (pDst, dest);
+ free_pixman_pict(pSrc, src);
+ free_pixman_pict(pMask, mask);
+ free_pixman_pict(pDst, dest);
}
static pixman_image_t *
-create_solid_fill_image (PicturePtr pict)
+create_solid_fill_image(PicturePtr pict)
{
PictSolidFill *solid = &pict->pSourcePict->solidFill;
pixman_color_t color;
CARD32 a, r, g, b;
-
+
a = (solid->color & 0xff000000) >> 24;
r = (solid->color & 0x00ff0000) >> 16;
- g = (solid->color & 0x0000ff00) >> 8;
- b = (solid->color & 0x000000ff) >> 0;
-
+ g = (solid->color & 0x0000ff00) >> 8;
+ b = (solid->color & 0x000000ff) >> 0;
+
color.alpha = (a << 8) | a;
- color.red = (r << 8) | r;
+ color.red = (r << 8) | r;
color.green = (g << 8) | g;
- color.blue = (b << 8) | b;
-
- return pixman_image_create_solid_fill (&color);
+ color.blue = (b << 8) | b;
+
+ return pixman_image_create_solid_fill(&color);
}
static pixman_image_t *
-create_linear_gradient_image (PictGradient *gradient)
+create_linear_gradient_image(PictGradient * gradient)
{
- PictLinearGradient *linear = (PictLinearGradient *)gradient;
+ PictLinearGradient *linear = (PictLinearGradient *) gradient;
pixman_point_fixed_t p1;
pixman_point_fixed_t p2;
-
+
p1.x = linear->p1.x;
p1.y = linear->p1.y;
p2.x = linear->p2.x;
p2.y = linear->p2.y;
-
- return pixman_image_create_linear_gradient (
- &p1, &p2, (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
+
+ return pixman_image_create_linear_gradient(&p1, &p2,
+ (pixman_gradient_stop_t *)
+ gradient->stops,
+ gradient->nstops);
}
static pixman_image_t *
-create_radial_gradient_image (PictGradient *gradient)
+create_radial_gradient_image(PictGradient * gradient)
{
- PictRadialGradient *radial = (PictRadialGradient *)gradient;
+ PictRadialGradient *radial = (PictRadialGradient *) gradient;
pixman_point_fixed_t c1;
pixman_point_fixed_t c2;
-
+
c1.x = radial->c1.x;
c1.y = radial->c1.y;
c2.x = radial->c2.x;
c2.y = radial->c2.y;
-
- return pixman_image_create_radial_gradient (
- &c1, &c2, radial->c1.radius,
- radial->c2.radius,
- (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
+
+ return pixman_image_create_radial_gradient(&c1, &c2, radial->c1.radius,
+ radial->c2.radius,
+ (pixman_gradient_stop_t *)
+ gradient->stops,
+ gradient->nstops);
}
static pixman_image_t *
-create_conical_gradient_image (PictGradient *gradient)
+create_conical_gradient_image(PictGradient * gradient)
{
- PictConicalGradient *conical = (PictConicalGradient *)gradient;
+ PictConicalGradient *conical = (PictConicalGradient *) gradient;
pixman_point_fixed_t center;
-
+
center.x = conical->center.x;
center.y = conical->center.y;
-
- return pixman_image_create_conical_gradient (
- &center, conical->angle, (pixman_gradient_stop_t *)gradient->stops,
- gradient->nstops);
+
+ return pixman_image_create_conical_gradient(&center, conical->angle,
+ (pixman_gradient_stop_t *)
+ gradient->stops,
+ gradient->nstops);
}
static pixman_image_t *
-create_bits_picture (PicturePtr pict,
- Bool has_clip,
- int *xoff,
- int *yoff)
+create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
{
PixmapPtr pixmap;
FbBits *bits;
FbStride stride;
int bpp;
pixman_image_t *image;
-
- fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
+
+ fbGetDrawablePixmap(pict->pDrawable, pixmap, *xoff, *yoff);
fbGetPixmapBitsData(pixmap, bits, stride, bpp);
- image = pixman_image_create_bits (
- (pixman_format_code_t)pict->format,
- pixmap->drawable.width, pixmap->drawable.height,
- (uint32_t *)bits, stride * sizeof (FbStride));
+ image = pixman_image_create_bits((pixman_format_code_t) pict->format,
+ pixmap->drawable.width,
+ pixmap->drawable.height, (uint32_t *) bits,
+ stride * sizeof(FbStride));
if (!image)
- return NULL;
-
+ return NULL;
+
#ifdef FB_ACCESS_WRAPPER
#if FB_SHIFT==5
-
- pixman_image_set_accessors (image,
- (pixman_read_memory_func_t)wfbReadMemory,
- (pixman_write_memory_func_t)wfbWriteMemory);
-
+
+ pixman_image_set_accessors(image,
+ (pixman_read_memory_func_t) wfbReadMemory,
+ (pixman_write_memory_func_t) wfbWriteMemory);
+
#else
-
+
#error The pixman library only works when FbBits is 32 bits wide
-
+
#endif
#endif
-
+
/* pCompositeClip is undefined for source pictures, so
* only set the clip region for pictures with drawables
*/
- if (has_clip)
- {
- if (pict->clientClipType != CT_NONE)
- pixman_image_set_has_client_clip (image, TRUE);
+ if (has_clip) {
+ if (pict->clientClipType != CT_NONE)
+ pixman_image_set_has_client_clip(image, TRUE);
- if (*xoff || *yoff)
- pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
+ if (*xoff || *yoff)
+ pixman_region_translate(pict->pCompositeClip, *xoff, *yoff);
- pixman_image_set_clip_region (image, pict->pCompositeClip);
+ pixman_image_set_clip_region(image, pict->pCompositeClip);
- if (*xoff || *yoff)
- pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
+ if (*xoff || *yoff)
+ pixman_region_translate(pict->pCompositeClip, -*xoff, -*yoff);
}
-
+
/* Indexed table */
if (pict->pFormat->index.devPrivate)
- pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
+ pixman_image_set_indexed(image, pict->pFormat->index.devPrivate);
/* Add in drawable origin to position within the image */
*xoff += pict->pDrawable->x;
@@ -209,158 +203,158 @@ create_bits_picture (PicturePtr pict,
return image;
}
-static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map);
+static pixman_image_t *image_from_pict_internal(PicturePtr pict, Bool has_clip,
+ int *xoff, int *yoff,
+ Bool is_alpha_map);
static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
+ int *xoff, int *yoff, Bool is_alpha_map)
{
pixman_repeat_t repeat;
pixman_filter_t filter;
-
- if (pict->transform)
- {
- /* For source images, adjust the transform to account
- * for the drawable offset within the pixman image,
- * then set the offset to 0 as it will be used
- * to compute positions within the transformed image.
- */
- if (!has_clip) {
- struct pixman_transform adjusted;
-
- adjusted = *pict->transform;
- pixman_transform_translate(&adjusted,
- NULL,
- pixman_int_to_fixed(*xoff),
- pixman_int_to_fixed(*yoff));
- pixman_image_set_transform (image, &adjusted);
- *xoff = 0;
- *yoff = 0;
- } else
- pixman_image_set_transform (image, pict->transform);
+
+ if (pict->transform) {
+ /* For source images, adjust the transform to account
+ * for the drawable offset within the pixman image,
+ * then set the offset to 0 as it will be used
+ * to compute positions within the transformed image.
+ */
+ if (!has_clip) {
+ struct pixman_transform adjusted;
+
+ adjusted = *pict->transform;
+ pixman_transform_translate(&adjusted,
+ NULL,
+ pixman_int_to_fixed(*xoff),
+ pixman_int_to_fixed(*yoff));
+ pixman_image_set_transform(image, &adjusted);
+ *xoff = 0;
+ *yoff = 0;
+ }
+ else
+ pixman_image_set_transform(image, pict->transform);
}
-
- switch (pict->repeatType)
- {
+
+ switch (pict->repeatType) {
default:
case RepeatNone:
- repeat = PIXMAN_REPEAT_NONE;
- break;
-
+ repeat = PIXMAN_REPEAT_NONE;
+ break;
+
case RepeatPad:
- repeat = PIXMAN_REPEAT_PAD;
- break;
-
+ repeat = PIXMAN_REPEAT_PAD;
+ break;
+
case RepeatNormal:
- repeat = PIXMAN_REPEAT_NORMAL;
- break;
-
+ repeat = PIXMAN_REPEAT_NORMAL;
+ break;
+
case RepeatReflect:
- repeat = PIXMAN_REPEAT_REFLECT;
- break;
+ repeat = PIXMAN_REPEAT_REFLECT;
+ break;
}
-
- pixman_image_set_repeat (image, repeat);
-
+
+ pixman_image_set_repeat(image, repeat);
+
/* Fetch alpha map unless 'pict' is being used
* as the alpha map for this operation
*/
- if (pict->alphaMap && !is_alpha_map)
- {
- int alpha_xoff, alpha_yoff;
- pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE);
-
- pixman_image_set_alpha_map (
- image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
-
- free_pixman_pict (pict->alphaMap, alpha_map);
+ if (pict->alphaMap && !is_alpha_map) {
+ int alpha_xoff, alpha_yoff;
+ pixman_image_t *alpha_map =
+ image_from_pict_internal(pict->alphaMap, FALSE, &alpha_xoff,
+ &alpha_yoff, TRUE);
+
+ pixman_image_set_alpha_map(image, alpha_map, pict->alphaOrigin.x,
+ pict->alphaOrigin.y);
+
+ free_pixman_pict(pict->alphaMap, alpha_map);
}
-
- pixman_image_set_component_alpha (image, pict->componentAlpha);
- switch (pict->filter)
- {
+ pixman_image_set_component_alpha(image, pict->componentAlpha);
+
+ switch (pict->filter) {
default:
case PictFilterNearest:
case PictFilterFast:
- filter = PIXMAN_FILTER_NEAREST;
- break;
-
+ filter = PIXMAN_FILTER_NEAREST;
+ break;
+
case PictFilterBilinear:
case PictFilterGood:
- filter = PIXMAN_FILTER_BILINEAR;
- break;
-
+ filter = PIXMAN_FILTER_BILINEAR;
+ break;
+
case PictFilterConvolution:
- filter = PIXMAN_FILTER_CONVOLUTION;
- break;
+ filter = PIXMAN_FILTER_CONVOLUTION;
+ break;
}
-
- pixman_image_set_filter (image, filter, (pixman_fixed_t *)pict->filter_params, pict->filter_nparams);
- pixman_image_set_source_clipping (image, TRUE);
+
+ pixman_image_set_filter(image, filter,
+ (pixman_fixed_t *) pict->filter_params,
+ pict->filter_nparams);
+ pixman_image_set_source_clipping(image, TRUE);
}
static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
+ Bool is_alpha_map)
{
pixman_image_t *image = NULL;
if (!pict)
- return NULL;
+ return NULL;
- if (pict->pDrawable)
- {
- image = create_bits_picture (pict, has_clip, xoff, yoff);
+ if (pict->pDrawable) {
+ image = create_bits_picture(pict, has_clip, xoff, yoff);
}
- else if (pict->pSourcePict)
- {
- SourcePict *sp = pict->pSourcePict;
-
- if (sp->type == SourcePictTypeSolidFill)
- {
- image = create_solid_fill_image (pict);
- }
- else
- {
- PictGradient *gradient = &pict->pSourcePict->gradient;
-
- if (sp->type == SourcePictTypeLinear)
- image = create_linear_gradient_image (gradient);
- else if (sp->type == SourcePictTypeRadial)
- image = create_radial_gradient_image (gradient);
- else if (sp->type == SourcePictTypeConical)
- image = create_conical_gradient_image (gradient);
- }
- *xoff = *yoff = 0;
+ else if (pict->pSourcePict) {
+ SourcePict *sp = pict->pSourcePict;
+
+ if (sp->type == SourcePictTypeSolidFill) {
+ image = create_solid_fill_image(pict);
+ }
+ else {
+ PictGradient *gradient = &pict->pSourcePict->gradient;
+
+ if (sp->type == SourcePictTypeLinear)
+ image = create_linear_gradient_image(gradient);
+ else if (sp->type == SourcePictTypeRadial)
+ image = create_radial_gradient_image(gradient);
+ else if (sp->type == SourcePictTypeConical)
+ image = create_conical_gradient_image(gradient);
+ }
+ *xoff = *yoff = 0;
}
-
+
if (image)
- set_image_properties (image, pict, has_clip, xoff, yoff, is_alpha_map);
-
+ set_image_properties(image, pict, has_clip, xoff, yoff, is_alpha_map);
+
return image;
}
pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
{
- return image_from_pict_internal (pict, has_clip, xoff, yoff, FALSE);
+ return image_from_pict_internal(pict, has_clip, xoff, yoff, FALSE);
}
void
-free_pixman_pict (PicturePtr pict, pixman_image_t *image)
+free_pixman_pict(PicturePtr pict, pixman_image_t * image)
{
- if (image && pixman_image_unref (image) && pict->pDrawable)
- fbFinishAccess (pict->pDrawable);
+ if (image && pixman_image_unref(image) && pict->pDrawable)
+ fbFinishAccess(pict->pDrawable);
}
Bool
-fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{
- PictureScreenPtr ps;
+ PictureScreenPtr ps;
- if (!miPictureInit (pScreen, formats, nformats))
- return FALSE;
+ if (!miPictureInit(pScreen, formats, nformats))
+ return FALSE;
ps = GetPictureScreen(pScreen);
ps->Composite = fbComposite;
ps->Glyphs = miGlyphs;
diff --git a/xorg-server/fb/fbpict.h b/xorg-server/fb/fbpict.h
index b880ebbe1..110f32dfe 100644
--- a/xorg-server/fb/fbpict.h
+++ b/xorg-server/fb/fbpict.h
@@ -30,59 +30,46 @@
/* fbpict.c */
extern _X_EXPORT void
-fbComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
+
+fbComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
/* fbtrap.c */
extern _X_EXPORT void
-fbAddTraps (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntrap,
- xTrap *traps);
+
+fbAddTraps(PicturePtr pPicture,
+ INT16 xOff, INT16 yOff, int ntrap, xTrap * traps);
extern _X_EXPORT void
-fbRasterizeTrapezoid (PicturePtr alpha,
- xTrapezoid *trap,
- int x_off,
- int y_off);
+
+fbRasterizeTrapezoid(PicturePtr alpha, xTrapezoid * trap, int x_off, int y_off);
extern _X_EXPORT void
-fbAddTriangles (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntri,
- xTriangle *tris);
+
+fbAddTriangles(PicturePtr pPicture,
+ INT16 xOff, INT16 yOff, int ntri, xTriangle * tris);
extern _X_EXPORT void
-fbTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps);
+
+fbTrapezoids(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps);
extern _X_EXPORT void
-fbTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntris,
- xTriangle *tris);
-
-#endif /* _FBPICT_H_ */
+
+fbTriangles(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris);
+
+#endif /* _FBPICT_H_ */
diff --git a/xorg-server/fb/fbpixmap.c b/xorg-server/fb/fbpixmap.c
index 9b3e687c1..ace078a00 100644
--- a/xorg-server/fb/fbpixmap.c
+++ b/xorg-server/fb/fbpixmap.c
@@ -29,30 +29,30 @@
#include "fb.h"
PixmapPtr
-fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
- unsigned usage_hint)
+fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
+ unsigned usage_hint)
{
- PixmapPtr pPixmap;
- size_t datasize;
- size_t paddedWidth;
- int adjust;
- int base;
+ PixmapPtr pPixmap;
+ size_t datasize;
+ size_t paddedWidth;
+ int adjust;
+ int base;
- paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
+ paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
if (paddedWidth / 4 > 32767 || height > 32767)
- return NullPixmap;
+ return NullPixmap;
datasize = height * paddedWidth;
base = pScreen->totalPixmapSize;
adjust = 0;
if (base & 7)
- adjust = 8 - (base & 7);
+ adjust = 8 - (base & 7);
datasize += adjust;
#ifdef FB_DEBUG
datasize += 2 * paddedWidth;
#endif
pPixmap = AllocatePixmap(pScreen, datasize);
if (!pPixmap)
- return NullPixmap;
+ return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
pPixmap->drawable.class = 0;
pPixmap->drawable.pScreen = pScreen;
@@ -66,11 +66,12 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
pPixmap->drawable.height = height;
pPixmap->devKind = paddedWidth;
pPixmap->refcnt = 1;
- pPixmap->devPrivate.ptr = (pointer) ((char *)pPixmap + base + adjust);
+ pPixmap->devPrivate.ptr = (pointer) ((char *) pPixmap + base + adjust);
#ifdef FB_DEBUG
- pPixmap->devPrivate.ptr = (void *) ((char *) pPixmap->devPrivate.ptr + paddedWidth);
- fbInitializeDrawable (&pPixmap->drawable);
+ pPixmap->devPrivate.ptr =
+ (void *) ((char *) pPixmap->devPrivate.ptr + paddedWidth);
+ fbInitializeDrawable(&pPixmap->drawable);
#endif
#ifdef COMPOSITE
@@ -84,21 +85,22 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
}
PixmapPtr
-fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
+fbCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint)
{
- int bpp;
- bpp = BitsPerPixel (depth);
+ int bpp;
+
+ bpp = BitsPerPixel(depth);
if (bpp == 32 && depth <= 24)
- bpp = fbGetScreenPrivate(pScreen)->pix32bpp;
- return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint);
+ bpp = fbGetScreenPrivate(pScreen)->pix32bpp;
+ return fbCreatePixmapBpp(pScreen, width, height, depth, bpp, usage_hint);
}
Bool
-fbDestroyPixmap (PixmapPtr pPixmap)
+fbDestroyPixmap(PixmapPtr pPixmap)
{
- if(--pPixmap->refcnt)
- return TRUE;
+ if (--pPixmap->refcnt)
+ return TRUE;
FreePixmap(pPixmap);
return TRUE;
}
@@ -138,183 +140,160 @@ if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \
RegionPtr
fbPixmapToRegion(PixmapPtr pPix)
{
- register RegionPtr pReg;
- FbBits *pw, w;
- register int ib;
- int width, h, base, rx1 = 0, crects;
- FbBits *pwLineEnd;
- int irectPrevStart, irectLineStart;
- register BoxPtr prectO, prectN;
- BoxPtr FirstRect, rects, prectLineStart;
- Bool fInBox, fSame;
- register FbBits mask0 = FB_ALLONES & ~FbScrRight(FB_ALLONES, 1);
- FbBits *pwLine;
- int nWidth;
-
+ register RegionPtr pReg;
+ FbBits *pw, w;
+ register int ib;
+ int width, h, base, rx1 = 0, crects;
+ FbBits *pwLineEnd;
+ int irectPrevStart, irectLineStart;
+ register BoxPtr prectO, prectN;
+ BoxPtr FirstRect, rects, prectLineStart;
+ Bool fInBox, fSame;
+ register FbBits mask0 = FB_ALLONES & ~FbScrRight(FB_ALLONES, 1);
+ FbBits *pwLine;
+ int nWidth;
+
pReg = RegionCreate(NULL, 1);
- if(!pReg)
- return NullRegion;
+ if (!pReg)
+ return NullRegion;
FirstRect = RegionBoxptr(pReg);
rects = FirstRect;
fbPrepareAccess(&pPix->drawable);
pwLine = (FbBits *) pPix->devPrivate.ptr;
- nWidth = pPix->devKind >> (FB_SHIFT-3);
+ nWidth = pPix->devKind >> (FB_SHIFT - 3);
width = pPix->drawable.width;
pReg->extents.x1 = width - 1;
pReg->extents.x2 = 0;
irectPrevStart = -1;
- for(h = 0; h < pPix->drawable.height; h++)
- {
- pw = pwLine;
- pwLine += nWidth;
- irectLineStart = rects - FirstRect;
- /* If the Screen left most bit of the word is set, we're starting in
- * a box */
- if(READ(pw) & mask0)
- {
- fInBox = TRUE;
- rx1 = 0;
- }
- else
- fInBox = FALSE;
- /* Process all words which are fully in the pixmap */
- pwLineEnd = pw + (width >> FB_SHIFT);
- for (base = 0; pw < pwLineEnd; base += FB_UNIT)
- {
- w = READ(pw++);
- if (fInBox)
- {
- if (!~w)
- continue;
- }
- else
- {
- if (!w)
- continue;
- }
- for(ib = 0; ib < FB_UNIT; ib++)
- {
- /* If the Screen left most bit of the word is set, we're
- * starting a box */
- if(w & mask0)
- {
- if(!fInBox)
- {
- rx1 = base + ib;
- /* start new box */
- fInBox = TRUE;
- }
- }
- else
- {
- if(fInBox)
- {
- /* end box */
- ADDRECT(pReg, rects, FirstRect,
- rx1, h, base + ib, h + 1);
- fInBox = FALSE;
- }
- }
- /* Shift the word VISUALLY left one. */
- w = FbScrLeft(w, 1);
- }
- }
- if(width & FB_MASK)
- {
- /* Process final partial word on line */
- w = READ(pw++);
- for(ib = 0; ib < (width & FB_MASK); ib++)
- {
- /* If the Screen left most bit of the word is set, we're
- * starting a box */
- if(w & mask0)
- {
- if(!fInBox)
- {
- rx1 = base + ib;
- /* start new box */
- fInBox = TRUE;
- }
- }
- else
- {
- if(fInBox)
- {
- /* end box */
- ADDRECT(pReg, rects, FirstRect,
- rx1, h, base + ib, h + 1);
- fInBox = FALSE;
- }
- }
- /* Shift the word VISUALLY left one. */
- w = FbScrLeft(w, 1);
- }
- }
- /* If scanline ended with last bit set, end the box */
- if(fInBox)
- {
- ADDRECT(pReg, rects, FirstRect,
- rx1, h, base + (width & FB_MASK), h + 1);
- }
- /* if all rectangles on this line have the same x-coords as
- * those on the previous line, then add 1 to all the previous y2s and
- * throw away all the rectangles from this line
- */
- fSame = FALSE;
- if(irectPrevStart != -1)
- {
- crects = irectLineStart - irectPrevStart;
- if(crects == ((rects - FirstRect) - irectLineStart))
- {
- prectO = FirstRect + irectPrevStart;
- prectN = prectLineStart = FirstRect + irectLineStart;
- fSame = TRUE;
- while(prectO < prectLineStart)
- {
- if((prectO->x1 != prectN->x1) || (prectO->x2 != prectN->x2))
- {
- fSame = FALSE;
- break;
- }
- prectO++;
- prectN++;
- }
- if (fSame)
- {
- prectO = FirstRect + irectPrevStart;
- while(prectO < prectLineStart)
- {
- prectO->y2 += 1;
- prectO++;
- }
- rects -= crects;
- pReg->data->numRects -= crects;
- }
- }
- }
- if(!fSame)
- irectPrevStart = irectLineStart;
+ for (h = 0; h < pPix->drawable.height; h++) {
+ pw = pwLine;
+ pwLine += nWidth;
+ irectLineStart = rects - FirstRect;
+ /* If the Screen left most bit of the word is set, we're starting in
+ * a box */
+ if (READ(pw) & mask0) {
+ fInBox = TRUE;
+ rx1 = 0;
+ }
+ else
+ fInBox = FALSE;
+ /* Process all words which are fully in the pixmap */
+ pwLineEnd = pw + (width >> FB_SHIFT);
+ for (base = 0; pw < pwLineEnd; base += FB_UNIT) {
+ w = READ(pw++);
+ if (fInBox) {
+ if (!~w)
+ continue;
+ }
+ else {
+ if (!w)
+ continue;
+ }
+ for (ib = 0; ib < FB_UNIT; ib++) {
+ /* If the Screen left most bit of the word is set, we're
+ * starting a box */
+ if (w & mask0) {
+ if (!fInBox) {
+ rx1 = base + ib;
+ /* start new box */
+ fInBox = TRUE;
+ }
+ }
+ else {
+ if (fInBox) {
+ /* end box */
+ ADDRECT(pReg, rects, FirstRect,
+ rx1, h, base + ib, h + 1);
+ fInBox = FALSE;
+ }
+ }
+ /* Shift the word VISUALLY left one. */
+ w = FbScrLeft(w, 1);
+ }
+ }
+ if (width & FB_MASK) {
+ /* Process final partial word on line */
+ w = READ(pw++);
+ for (ib = 0; ib < (width & FB_MASK); ib++) {
+ /* If the Screen left most bit of the word is set, we're
+ * starting a box */
+ if (w & mask0) {
+ if (!fInBox) {
+ rx1 = base + ib;
+ /* start new box */
+ fInBox = TRUE;
+ }
+ }
+ else {
+ if (fInBox) {
+ /* end box */
+ ADDRECT(pReg, rects, FirstRect,
+ rx1, h, base + ib, h + 1);
+ fInBox = FALSE;
+ }
+ }
+ /* Shift the word VISUALLY left one. */
+ w = FbScrLeft(w, 1);
+ }
+ }
+ /* If scanline ended with last bit set, end the box */
+ if (fInBox) {
+ ADDRECT(pReg, rects, FirstRect,
+ rx1, h, base + (width & FB_MASK), h + 1);
+ }
+ /* if all rectangles on this line have the same x-coords as
+ * those on the previous line, then add 1 to all the previous y2s and
+ * throw away all the rectangles from this line
+ */
+ fSame = FALSE;
+ if (irectPrevStart != -1) {
+ crects = irectLineStart - irectPrevStart;
+ if (crects == ((rects - FirstRect) - irectLineStart)) {
+ prectO = FirstRect + irectPrevStart;
+ prectN = prectLineStart = FirstRect + irectLineStart;
+ fSame = TRUE;
+ while (prectO < prectLineStart) {
+ if ((prectO->x1 != prectN->x1) ||
+ (prectO->x2 != prectN->x2)) {
+ fSame = FALSE;
+ break;
+ }
+ prectO++;
+ prectN++;
+ }
+ if (fSame) {
+ prectO = FirstRect + irectPrevStart;
+ while (prectO < prectLineStart) {
+ prectO->y2 += 1;
+ prectO++;
+ }
+ rects -= crects;
+ pReg->data->numRects -= crects;
+ }
+ }
+ }
+ if (!fSame)
+ irectPrevStart = irectLineStart;
}
if (!pReg->data->numRects)
- pReg->extents.x1 = pReg->extents.x2 = 0;
- else
- {
- pReg->extents.y1 = RegionBoxptr(pReg)->y1;
- pReg->extents.y2 = RegionEnd(pReg)->y2;
- if (pReg->data->numRects == 1)
- {
- free(pReg->data);
- pReg->data = (RegDataPtr)NULL;
- }
+ pReg->extents.x1 = pReg->extents.x2 = 0;
+ else {
+ pReg->extents.y1 = RegionBoxptr(pReg)->y1;
+ pReg->extents.y2 = RegionEnd(pReg)->y2;
+ if (pReg->data->numRects == 1) {
+ free(pReg->data);
+ pReg->data = (RegDataPtr) NULL;
+ }
}
fbFinishAccess(&pPix->drawable);
#ifdef DEBUG
if (!RegionIsValid(pReg))
- FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
+ FatalError("Assertion failed file %s, line %d: expr\n", __FILE__,
+ __LINE__);
#endif
return pReg;
}
@@ -324,58 +303,56 @@ fbPixmapToRegion(PixmapPtr pPix)
#include <stdio.h>
static Bool
-fbValidateBits (FbStip *bits, int stride, FbStip data)
+fbValidateBits(FbStip * bits, int stride, FbStip data)
{
- while (stride--)
- {
- if (*bits != data)
- {
- fprintf (stderr, "fbValidateBits failed at 0x%x (is 0x%x want 0x%x)\n",bits, *bits, data);
- return FALSE;
- }
- bits++;
+ while (stride--) {
+ if (*bits != data) {
+ fprintf (stderr, "fbValidateBits failed at 0x%x (is 0x%x want 0x%x)\n",bits, *bits, data);
+ return FALSE;
+ }
+ bits++;
}
}
void
-fbValidateDrawable (DrawablePtr pDrawable)
+fbValidateDrawable(DrawablePtr pDrawable)
{
- FbStip *bits, *first, *last;
- int stride, bpp;
- int xoff, yoff;
- int height;
- Bool failed;
-
+ FbStip *bits, *first, *last;
+ int stride, bpp;
+ int xoff, yoff;
+ int height;
+ Bool failed;
+
if (pDrawable->type != DRAWABLE_PIXMAP)
- pDrawable = (DrawablePtr) fbGetWindowPixmap(pDrawable);
+ pDrawable = (DrawablePtr) fbGetWindowPixmap(pDrawable);
fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff);
first = bits - stride;
last = bits + stride * pDrawable->height;
- if (!fbValidateBits (first, stride, FB_HEAD_BITS) ||
- !fbValidateBits (last, stride, FB_TAIL_BITS))
- fbInitializeDrawable(pDrawable);
- fbFinishAccess (pDrawable);
+ if (!fbValidateBits(first, stride, FB_HEAD_BITS) ||
+ !fbValidateBits(last, stride, FB_TAIL_BITS))
+ fbInitializeDrawable(pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fbSetBits (FbStip *bits, int stride, FbStip data)
+fbSetBits(FbStip * bits, int stride, FbStip data)
{
while (stride--)
- *bits++ = data;
+ *bits++ = data;
}
void
-fbInitializeDrawable (DrawablePtr pDrawable)
+fbInitializeDrawable(DrawablePtr pDrawable)
{
- FbStip *bits, *first, *last;
- int stride, bpp;
- int xoff, yoff;
-
+ FbStip *bits, *first, *last;
+ int stride, bpp;
+ int xoff, yoff;
+
fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff);
first = bits - stride;
last = bits + stride * pDrawable->height;
- fbSetBits (first, stride, FB_HEAD_BITS);
- fbSetBits (last, stride, FB_TAIL_BITS);
- fbFinishAccess (pDrawable);
+ fbSetBits(first, stride, FB_HEAD_BITS);
+ fbSetBits(last, stride, FB_TAIL_BITS);
+ fbFinishAccess(pDrawable);
}
-#endif /* FB_DEBUG */
+#endif /* FB_DEBUG */
diff --git a/xorg-server/fb/fbpoint.c b/xorg-server/fb/fbpoint.c
index bf617708b..d5129d796 100644
--- a/xorg-server/fb/fbpoint.c
+++ b/xorg-server/fb/fbpoint.c
@@ -26,131 +26,121 @@
#include "fb.h"
-typedef void (*FbDots) (FbBits *dst,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits and,
- FbBits xor);
+typedef void (*FbDots) (FbBits * dst,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg,
+ int yorg, int xoff, int yoff, FbBits and, FbBits xor);
void
-fbDots (FbBits *dstOrig,
- FbStride dstStride,
- int dstBpp,
- BoxPtr pBox,
- xPoint *pts,
- int npt,
- int xorg,
- int yorg,
- int xoff,
- int yoff,
- FbBits andOrig,
- FbBits xorOrig)
+fbDots(FbBits * dstOrig,
+ FbStride dstStride,
+ int dstBpp,
+ BoxPtr pBox,
+ xPoint * pts,
+ int npt,
+ int xorg, int yorg, int xoff, int yoff, FbBits andOrig, FbBits xorOrig)
{
- FbStip *dst = (FbStip *) dstOrig;
- int x1, y1, x2, y2;
- int x, y;
- FbStip *d;
- FbStip and = andOrig;
- FbStip xor = xorOrig;
+ FbStip *dst = (FbStip *) dstOrig;
+ int x1, y1, x2, y2;
+ int x, y;
+ FbStip *d;
+ FbStip and = andOrig;
+ FbStip xor = xorOrig;
- dstStride = FbBitsStrideToStipStride (dstStride);
+ dstStride = FbBitsStrideToStipStride(dstStride);
x1 = pBox->x1;
y1 = pBox->y1;
x2 = pBox->x2;
y2 = pBox->y2;
- while (npt--)
- {
- x = pts->x + xorg;
- y = pts->y + yorg;
- pts++;
- if (x1 <= x && x < x2 && y1 <= y && y < y2)
- {
- x = (x + xoff) * dstBpp;
- d = dst + ((y + yoff) * dstStride) + (x >> FB_STIP_SHIFT);
- x &= FB_STIP_MASK;
- if (dstBpp == 24)
- {
- FbStip leftMask, rightMask;
- int n, rot;
- FbStip andT, xorT;
-
- rot = FbFirst24Rot (x);
- andT = FbRot24Stip(and,rot);
- xorT = FbRot24Stip(xor,rot);
- FbMaskStip (x, 24, leftMask, n, rightMask);
- if (leftMask)
- {
- WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
- andT = FbNext24Stip(andT);
- xorT = FbNext24Stip(xorT);
- d++;
- }
- if (rightMask)
- WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
- }
- else
- {
- FbStip mask;
- mask = FbStipMask(x, dstBpp);
- WRITE(d, FbDoMaskRRop (READ(d), and, xor, mask));
- }
- }
+ while (npt--) {
+ x = pts->x + xorg;
+ y = pts->y + yorg;
+ pts++;
+ if (x1 <= x && x < x2 && y1 <= y && y < y2) {
+ x = (x + xoff) * dstBpp;
+ d = dst + ((y + yoff) * dstStride) + (x >> FB_STIP_SHIFT);
+ x &= FB_STIP_MASK;
+ if (dstBpp == 24) {
+ FbStip leftMask, rightMask;
+ int n, rot;
+ FbStip andT, xorT;
+
+ rot = FbFirst24Rot(x);
+ andT = FbRot24Stip(and, rot);
+ xorT = FbRot24Stip(xor, rot);
+ FbMaskStip(x, 24, leftMask, n, rightMask);
+ if (leftMask) {
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, leftMask));
+ andT = FbNext24Stip(andT);
+ xorT = FbNext24Stip(xorT);
+ d++;
+ }
+ if (rightMask)
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
+ }
+ else {
+ FbStip mask;
+
+ mask = FbStipMask(x, dstBpp);
+ WRITE(d, FbDoMaskRRop(READ(d), and, xor, mask));
+ }
+ }
}
}
void
-fbPolyPoint (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int nptInit,
- xPoint *pptInit)
+fbPolyPoint(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int nptInit, xPoint * pptInit)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbDots dots;
- FbBits and, xor;
- xPoint *ppt;
- int npt;
- BoxPtr pBox;
- int nBox;
-
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbDots dots;
+ FbBits and, xor;
+ xPoint *ppt;
+ int npt;
+ BoxPtr pBox;
+ int nBox;
+
/* make pointlist origin relative */
ppt = pptInit;
npt = nptInit;
- if (mode == CoordModePrevious)
- {
- npt--;
- while(npt--)
- {
- ppt++;
- ppt->x += (ppt-1)->x;
- ppt->y += (ppt-1)->y;
- }
+ if (mode == CoordModePrevious) {
+ npt--;
+ while (npt--) {
+ ppt++;
+ ppt->x += (ppt - 1)->x;
+ ppt->y += (ppt - 1)->y;
+ }
}
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
and = pPriv->and;
xor = pPriv->xor;
dots = fbDots;
switch (dstBpp) {
- case 8: dots = fbDots8; break;
- case 16: dots = fbDots16; break;
- case 24: dots = fbDots24; break;
- case 32: dots = fbDots32; break;
+ case 8:
+ dots = fbDots8;
+ break;
+ case 16:
+ dots = fbDots16;
+ break;
+ case 24:
+ dots = fbDots24;
+ break;
+ case 32:
+ dots = fbDots32;
+ break;
}
- for (nBox = RegionNumRects (pClip), pBox = RegionRects (pClip);
- nBox--; pBox++)
- (*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit,
- pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor);
- fbFinishAccess (pDrawable);
+ for (nBox = RegionNumRects(pClip), pBox = RegionRects(pClip);
+ nBox--; pBox++)
+ (*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit,
+ pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor);
+ fbFinishAccess(pDrawable);
}
diff --git a/xorg-server/fb/fbpush.c b/xorg-server/fb/fbpush.c
index 8dd7c2b59..f0a861cbe 100644
--- a/xorg-server/fb/fbpush.c
+++ b/xorg-server/fb/fbpush.c
@@ -27,219 +27,162 @@
#include "fb.h"
void
-fbPushPattern (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
-
- int x,
- int y,
-
- int width,
- int height)
+fbPushPattern(DrawablePtr pDrawable,
+ GCPtr pGC,
+ FbStip * src,
+ FbStride srcStride, int srcX, int x, int y, int width, int height)
{
- FbStip *s, bitsMask, bitsMask0, bits;
- int xspan;
- int w;
- int lenspan;
-
+ FbStip *s, bitsMask, bitsMask0, bits;
+ int xspan;
+ int w;
+ int lenspan;
+
src += srcX >> FB_STIP_SHIFT;
srcX &= FB_STIP_MASK;
-
- bitsMask0 = FbStipMask (srcX, 1);
-
- while (height--)
- {
- bitsMask = bitsMask0;
- w = width;
- s = src;
- src += srcStride;
- bits = READ(s++);
- xspan = x;
- while (w)
- {
- if (bits & bitsMask)
- {
- lenspan = 0;
- do
- {
- lenspan++;
- if (lenspan == w)
- break;
- bitsMask = FbStipRight (bitsMask, 1);
- if (!bitsMask)
- {
- bits = READ(s++);
- bitsMask = FbBitsMask(0,1);
- }
- } while (bits & bitsMask);
- fbFill (pDrawable, pGC, xspan, y, lenspan, 1);
- xspan += lenspan;
- w -= lenspan;
- }
- else
- {
- do
- {
- w--;
- xspan++;
- if (!w)
- break;
- bitsMask = FbStipRight (bitsMask, 1);
- if (!bitsMask)
- {
- bits = READ(s++);
- bitsMask = FbBitsMask(0,1);
- }
- } while (!(bits & bitsMask));
- }
- }
- y++;
+
+ bitsMask0 = FbStipMask(srcX, 1);
+
+ while (height--) {
+ bitsMask = bitsMask0;
+ w = width;
+ s = src;
+ src += srcStride;
+ bits = READ(s++);
+ xspan = x;
+ while (w) {
+ if (bits & bitsMask) {
+ lenspan = 0;
+ do {
+ lenspan++;
+ if (lenspan == w)
+ break;
+ bitsMask = FbStipRight(bitsMask, 1);
+ if (!bitsMask) {
+ bits = READ(s++);
+ bitsMask = FbBitsMask(0, 1);
+ }
+ } while (bits & bitsMask);
+ fbFill(pDrawable, pGC, xspan, y, lenspan, 1);
+ xspan += lenspan;
+ w -= lenspan;
+ }
+ else {
+ do {
+ w--;
+ xspan++;
+ if (!w)
+ break;
+ bitsMask = FbStipRight(bitsMask, 1);
+ if (!bitsMask) {
+ bits = READ(s++);
+ bitsMask = FbBitsMask(0, 1);
+ }
+ } while (!(bits & bitsMask));
+ }
+ }
+ y++;
}
}
void
-fbPushFill (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
-
- int x,
- int y,
- int width,
- int height)
+fbPushFill(DrawablePtr pDrawable,
+ GCPtr pGC,
+ FbStip * src,
+ FbStride srcStride, int srcX, int x, int y, int width, int height)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
-
- if (pGC->fillStyle == FillSolid)
- {
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- int dstX;
- int dstWidth;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- dst = dst + (y + dstYoff) * dstStride;
- dstX = (x + dstXoff) * dstBpp;
- dstWidth = width * dstBpp;
- if (dstBpp == 1)
- {
- fbBltStip (src,
- srcStride,
- srcX,
-
- (FbStip *) dst,
- FbBitsStrideToStipStride (dstStride),
- dstX,
-
- dstWidth,
- height,
-
- FbStipple1Rop(pGC->alu,pGC->fgPixel),
- pPriv->pm,
- dstBpp);
- }
- else
- {
- fbBltOne (src,
- srcStride,
- srcX,
-
- dst,
- dstStride,
- dstX,
- dstBpp,
-
- dstWidth,
- height,
-
- pPriv->and, pPriv->xor,
- fbAnd(GXnoop,(FbBits) 0,FB_ALLONES),
- fbXor(GXnoop,(FbBits) 0,FB_ALLONES));
- }
- fbFinishAccess (pDrawable);
+ if (pGC->fillStyle == FillSolid) {
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ int dstX;
+ int dstWidth;
+
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ dst = dst + (y + dstYoff) * dstStride;
+ dstX = (x + dstXoff) * dstBpp;
+ dstWidth = width * dstBpp;
+ if (dstBpp == 1) {
+ fbBltStip(src,
+ srcStride,
+ srcX,
+ (FbStip *) dst,
+ FbBitsStrideToStipStride(dstStride),
+ dstX,
+ dstWidth,
+ height,
+ FbStipple1Rop(pGC->alu, pGC->fgPixel), pPriv->pm, dstBpp);
+ }
+ else {
+ fbBltOne(src,
+ srcStride,
+ srcX,
+ dst,
+ dstStride,
+ dstX,
+ dstBpp,
+ dstWidth,
+ height,
+ pPriv->and, pPriv->xor,
+ fbAnd(GXnoop, (FbBits) 0, FB_ALLONES),
+ fbXor(GXnoop, (FbBits) 0, FB_ALLONES));
+ }
+ fbFinishAccess(pDrawable);
}
- else
- {
- fbPushPattern (pDrawable, pGC, src, srcStride, srcX,
- x, y, width, height);
+ else {
+ fbPushPattern(pDrawable, pGC, src, srcStride, srcX,
+ x, y, width, height);
}
}
-
-void
-fbPushImage (DrawablePtr pDrawable,
- GCPtr pGC,
-
- FbStip *src,
- FbStride srcStride,
- int srcX,
- int x,
- int y,
- int width,
- int height)
+void
+fbPushImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ FbStip * src,
+ FbStride srcStride, int srcX, int x, int y, int width, int height)
{
- RegionPtr pClip = fbGetCompositeClip (pGC);
- int nbox;
- BoxPtr pbox;
- int x1, y1, x2, y2;
-
- for (nbox = RegionNumRects (pClip),
- pbox = RegionRects(pClip);
- nbox--;
- pbox++)
- {
- x1 = x;
- y1 = y;
- x2 = x + width;
- y2 = y + height;
- if (x1 < pbox->x1)
- x1 = pbox->x1;
- if (y1 < pbox->y1)
- y1 = pbox->y1;
- if (x2 > pbox->x2)
- x2 = pbox->x2;
- if (y2 > pbox->y2)
- y2 = pbox->y2;
- if (x1 >= x2 || y1 >= y2)
- continue;
- fbPushFill (pDrawable,
- pGC,
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ int nbox;
+ BoxPtr pbox;
+ int x1, y1, x2, y2;
- src + (y1 - y) * srcStride,
- srcStride,
- srcX + (x1 - x),
-
- x1,
- y1,
- x2 - x1,
- y2 - y1);
+ for (nbox = RegionNumRects(pClip),
+ pbox = RegionRects(pClip); nbox--; pbox++) {
+ x1 = x;
+ y1 = y;
+ x2 = x + width;
+ y2 = y + height;
+ if (x1 < pbox->x1)
+ x1 = pbox->x1;
+ if (y1 < pbox->y1)
+ y1 = pbox->y1;
+ if (x2 > pbox->x2)
+ x2 = pbox->x2;
+ if (y2 > pbox->y2)
+ y2 = pbox->y2;
+ if (x1 >= x2 || y1 >= y2)
+ continue;
+ fbPushFill(pDrawable,
+ pGC,
+ src + (y1 - y) * srcStride,
+ srcStride, srcX + (x1 - x), x1, y1, x2 - x1, y2 - y1);
}
}
-
+
void
-fbPushPixels (GCPtr pGC,
- PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int dx,
- int dy,
- int xOrg,
- int yOrg)
+fbPushPixels(GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg)
{
- FbStip *stip;
- FbStride stipStride;
- int stipBpp;
- _X_UNUSED int stipXoff, stipYoff;
+ FbStip *stip;
+ FbStride stipStride;
+ int stipBpp;
+ _X_UNUSED int stipXoff, stipYoff;
- fbGetStipDrawable (&pBitmap->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
+ fbGetStipDrawable(&pBitmap->drawable, stip, stipStride, stipBpp, stipXoff,
+ stipYoff);
- fbPushImage (pDrawable, pGC,
- stip, stipStride, 0,
- xOrg, yOrg, dx, dy);
+ fbPushImage(pDrawable, pGC, stip, stipStride, 0, xOrg, yOrg, dx, dy);
}
diff --git a/xorg-server/fb/fbscreen.c b/xorg-server/fb/fbscreen.c
index 9e6ecf50f..c0903ec5c 100644
--- a/xorg-server/fb/fbscreen.c
+++ b/xorg-server/fb/fbscreen.c
@@ -27,13 +27,13 @@
#include "fb.h"
Bool
-fbCloseScreen (int index, ScreenPtr pScreen)
+fbCloseScreen(int index, ScreenPtr pScreen)
{
- int d;
- DepthPtr depths = pScreen->allowedDepths;
+ int d;
+ DepthPtr depths = pScreen->allowedDepths;
for (d = 0; d < pScreen->numDepths; d++)
- free(depths[d].vids);
+ free(depths[d].vids);
free(depths);
free(pScreen->visuals);
free(pScreen->devPrivate);
@@ -53,57 +53,52 @@ fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
}
void
-fbQueryBestSize (int class,
- unsigned short *width, unsigned short *height,
- ScreenPtr pScreen)
+fbQueryBestSize(int class,
+ unsigned short *width, unsigned short *height,
+ ScreenPtr pScreen)
{
- unsigned short w;
-
+ unsigned short w;
+
switch (class) {
case CursorShape:
- if (*width > pScreen->width)
- *width = pScreen->width;
- if (*height > pScreen->height)
- *height = pScreen->height;
- break;
+ if (*width > pScreen->width)
+ *width = pScreen->width;
+ if (*height > pScreen->height)
+ *height = pScreen->height;
+ break;
case TileShape:
case StippleShape:
- w = *width;
- if ((w & (w - 1)) && w < FB_UNIT)
- {
- for (w = 1; w < *width; w <<= 1)
- ;
- *width = w;
- }
+ w = *width;
+ if ((w & (w - 1)) && w < FB_UNIT) {
+ for (w = 1; w < *width; w <<= 1);
+ *width = w;
+ }
}
}
PixmapPtr
-_fbGetWindowPixmap (WindowPtr pWindow)
+_fbGetWindowPixmap(WindowPtr pWindow)
{
- return fbGetWindowPixmap (pWindow);
+ return fbGetWindowPixmap(pWindow);
}
void
-_fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
+_fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
{
dixSetPrivate(&pWindow->devPrivates, fbGetWinPrivateKey(), pPixmap);
}
Bool
-fbSetupScreen(ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bitmap */
- int xsize, /* in pixels */
- int ysize,
- int dpix, /* dots per inch */
- int dpiy,
- int width, /* pixel width of frame buffer */
- int bpp) /* bits per pixel for screen */
-{
+fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */
+ int xsize, /* in pixels */
+ int ysize, int dpix, /* dots per inch */
+ int dpiy, int width, /* pixel width of frame buffer */
+ int bpp)
+{ /* bits per pixel for screen */
if (!fbAllocatePrivates(pScreen, NULL))
- return FALSE;
+ return FALSE;
pScreen->defColormap = FakeClientID(0);
- /* let CreateDefColormap do whatever it wants for pixels */
+ /* let CreateDefColormap do whatever it wants for pixels */
pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
pScreen->QueryBestSize = fbQueryBestSize;
/* SaveScreen */
@@ -122,14 +117,14 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->UnrealizeFont = fbUnrealizeFont;
pScreen->CreateGC = fbCreateGC;
pScreen->CreateColormap = fbInitializeColormap;
- pScreen->DestroyColormap = (void (*)(ColormapPtr))NoopDDA;
+ pScreen->DestroyColormap = (void (*)(ColormapPtr)) NoopDDA;
pScreen->InstallColormap = fbInstallColormap;
pScreen->UninstallColormap = fbUninstallColormap;
pScreen->ListInstalledColormaps = fbListInstalledColormaps;
- pScreen->StoreColors = (void (*)(ColormapPtr, int, xColorItem *))NoopDDA;
+ pScreen->StoreColors = (void (*)(ColormapPtr, int, xColorItem *)) NoopDDA;
pScreen->ResolveColor = fbResolveColor;
pScreen->BitmapToRegion = fbPixmapToRegion;
-
+
pScreen->GetWindowPixmap = _fbGetWindowPixmap;
pScreen->SetWindowPixmap = _fbSetWindowPixmap;
@@ -138,46 +133,39 @@ fbSetupScreen(ScreenPtr pScreen,
#ifdef FB_ACCESS_WRAPPER
Bool
-wfbFinishScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp,
- SetupWrapProcPtr setupWrap,
- FinishWrapProcPtr finishWrap)
+wfbFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width,
+ int bpp,
+ SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap)
#else
Bool
-fbFinishScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp)
+fbFinishScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize, int ysize, int dpix, int dpiy, int width, int bpp)
#endif
{
- VisualPtr visuals;
- DepthPtr depths;
- int nvisuals;
- int ndepths;
- int rootdepth;
- VisualID defaultVisual;
- int imagebpp = bpp;
+ VisualPtr visuals;
+ DepthPtr depths;
+ int nvisuals;
+ int ndepths;
+ int rootdepth;
+ VisualID defaultVisual;
+ int imagebpp = bpp;
#ifdef FB_DEBUG
- int stride;
-
+ int stride;
+
ysize -= 2;
stride = (width * bpp) / 8;
- fbSetBits ((FbStip *) pbits,
- stride / sizeof (FbStip), FB_HEAD_BITS);
+ fbSetBits((FbStip *) pbits, stride / sizeof(FbStip), FB_HEAD_BITS);
pbits = (void *) ((char *) pbits + stride);
- fbSetBits ((FbStip *) ((char *) pbits + stride * ysize),
- stride / sizeof (FbStip), FB_TAIL_BITS);
+ fbSetBits((FbStip *) ((char *) pbits + stride * ysize),
+ stride / sizeof(FbStip), FB_TAIL_BITS);
#endif
/*
* By default, a 24bpp screen will use 32bpp images, this avoids
@@ -185,53 +173,48 @@ fbFinishScreenInit(ScreenPtr pScreen,
* pixels. If you want real 24bit images, include a 24bpp
* format in the pixmap formats
*/
- if (bpp == 24)
- {
- int f;
-
- imagebpp = 32;
- /*
- * Check to see if we're advertising a 24bpp image format,
- * in which case windows will use it in preference to a 32 bit
- * format.
- */
- for (f = 0; f < screenInfo.numPixmapFormats; f++)
- {
- if (screenInfo.formats[f].bitsPerPixel == 24)
- {
- imagebpp = 24;
- break;
- }
- }
+ if (bpp == 24) {
+ int f;
+
+ imagebpp = 32;
+ /*
+ * Check to see if we're advertising a 24bpp image format,
+ * in which case windows will use it in preference to a 32 bit
+ * format.
+ */
+ for (f = 0; f < screenInfo.numPixmapFormats; f++) {
+ if (screenInfo.formats[f].bitsPerPixel == 24) {
+ imagebpp = 24;
+ break;
+ }
+ }
}
- if (imagebpp == 32)
- {
- fbGetScreenPrivate(pScreen)->win32bpp = bpp;
- fbGetScreenPrivate(pScreen)->pix32bpp = bpp;
+ if (imagebpp == 32) {
+ fbGetScreenPrivate(pScreen)->win32bpp = bpp;
+ fbGetScreenPrivate(pScreen)->pix32bpp = bpp;
}
- else
- {
- fbGetScreenPrivate(pScreen)->win32bpp = 32;
- fbGetScreenPrivate(pScreen)->pix32bpp = 32;
+ else {
+ fbGetScreenPrivate(pScreen)->win32bpp = 32;
+ fbGetScreenPrivate(pScreen)->pix32bpp = 32;
}
#ifdef FB_ACCESS_WRAPPER
fbGetScreenPrivate(pScreen)->setupWrap = setupWrap;
fbGetScreenPrivate(pScreen)->finishWrap = finishWrap;
#endif
rootdepth = 0;
- if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
- &defaultVisual,((unsigned long)1<<(imagebpp-1)), 8))
- return FALSE;
- if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
- rootdepth, ndepths, depths,
- defaultVisual, nvisuals, visuals))
- return FALSE;
+ if (!fbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
+ &defaultVisual, ((unsigned long) 1 << (imagebpp - 1)),
+ 8))
+ return FALSE;
+ if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
+ rootdepth, ndepths, depths,
+ defaultVisual, nvisuals, visuals))
+ return FALSE;
/* overwrite miCloseScreen with our own */
pScreen->CloseScreen = fbCloseScreen;
- if (bpp == 24 && imagebpp == 32)
- {
- pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader;
- pScreen->CreateScreenResources = fb24_32CreateScreenResources;
+ if (bpp == 24 && imagebpp == 32) {
+ pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader;
+ pScreen->CreateScreenResources = fb24_32CreateScreenResources;
}
return TRUE;
}
@@ -239,40 +222,33 @@ fbFinishScreenInit(ScreenPtr pScreen,
/* dts * (inch/dot) * (25.4 mm / inch) = mm */
#ifdef FB_ACCESS_WRAPPER
Bool
-wfbScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp,
- SetupWrapProcPtr setupWrap,
- FinishWrapProcPtr finishWrap)
+wfbScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width,
+ int bpp, SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap)
{
if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp))
- return FALSE;
+ return FALSE;
if (!wfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
- width, bpp, setupWrap, finishWrap))
- return FALSE;
+ width, bpp, setupWrap, finishWrap))
+ return FALSE;
return TRUE;
}
#else
Bool
-fbScreenInit(ScreenPtr pScreen,
- pointer pbits,
- int xsize,
- int ysize,
- int dpix,
- int dpiy,
- int width,
- int bpp)
+fbScreenInit(ScreenPtr pScreen,
+ pointer pbits,
+ int xsize, int ysize, int dpix, int dpiy, int width, int bpp)
{
if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp))
- return FALSE;
- if (!fbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
- width, bpp))
- return FALSE;
+ return FALSE;
+ if (!fbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width, bpp))
+ return FALSE;
return TRUE;
}
#endif
diff --git a/xorg-server/fb/fbseg.c b/xorg-server/fb/fbseg.c
index 5a458fe51..0e4e0a9f7 100644
--- a/xorg-server/fb/fbseg.c
+++ b/xorg-server/fb/fbseg.c
@@ -34,477 +34,398 @@
FbStipRight(mask,bpp)))
void
-fbBresSolid (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresSolid(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- FbStip and = (FbStip) pPriv->and;
- FbStip xor = (FbStip) pPriv->xor;
- FbStip mask, mask0;
- FbStip bits;
-
- fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbStip and = (FbStip) pPriv->and;
+ FbStip xor = (FbStip) pPriv->xor;
+ FbStip mask, mask0;
+ FbStip bits;
+
+ fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
dst += ((y1 + dstYoff) * dstStride);
x1 = (x1 + dstXoff) * dstBpp;
dst += x1 >> FB_STIP_SHIFT;
x1 &= FB_STIP_MASK;
mask0 = FbStipMask(0, dstBpp);
- mask = FbStipRight (mask0, x1);
+ mask = FbStipRight(mask0, x1);
if (signdx < 0)
- mask0 = FbStipRight (mask0, FB_STIP_UNIT - dstBpp);
+ mask0 = FbStipRight(mask0, FB_STIP_UNIT - dstBpp);
if (signdy < 0)
- dstStride = -dstStride;
- if (axis == X_AXIS)
- {
- bits = 0;
- while (len--)
- {
- bits |= mask;
- mask = fbBresShiftMask(mask,signdx,dstBpp);
- if (!mask)
- {
- WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
- bits = 0;
- dst += signdx;
- mask = mask0;
- }
- e += e1;
- if (e >= 0)
- {
- WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
- bits = 0;
- dst += dstStride;
- e += e3;
- }
- }
- if (bits)
- WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
+ dstStride = -dstStride;
+ if (axis == X_AXIS) {
+ bits = 0;
+ while (len--) {
+ bits |= mask;
+ mask = fbBresShiftMask(mask, signdx, dstBpp);
+ if (!mask) {
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
+ bits = 0;
+ dst += signdx;
+ mask = mask0;
+ }
+ e += e1;
+ if (e >= 0) {
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
+ bits = 0;
+ dst += dstStride;
+ e += e3;
+ }
+ }
+ if (bits)
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
}
- else
- {
- while (len--)
- {
- WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, mask));
- dst += dstStride;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- mask = fbBresShiftMask(mask,signdx,dstBpp);
- if (!mask)
- {
- dst += signdx;
- mask = mask0;
- }
- }
- }
+ else {
+ while (len--) {
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask));
+ dst += dstStride;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ mask = fbBresShiftMask(mask, signdx, dstBpp);
+ if (!mask) {
+ dst += signdx;
+ mask = mask0;
+ }
+ }
+ }
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fbBresDash (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresDash(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- FbStip and = (FbStip) pPriv->and;
- FbStip xor = (FbStip) pPriv->xor;
- FbStip bgand = (FbStip) pPriv->bgand;
- FbStip bgxor = (FbStip) pPriv->bgxor;
- FbStip mask, mask0;
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbStip and = (FbStip) pPriv->and;
+ FbStip xor = (FbStip) pPriv->xor;
+ FbStip bgand = (FbStip) pPriv->bgand;
+ FbStip bgxor = (FbStip) pPriv->bgxor;
+ FbStip mask, mask0;
+
FbDashDeclare;
- int dashlen;
- Bool even;
- Bool doOdd;
-
- fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ int dashlen;
+ Bool even;
+ Bool doOdd;
+
+ fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
doOdd = pGC->lineStyle == LineDoubleDash;
- FbDashInit (pGC, pPriv, dashOffset, dashlen, even);
-
+ FbDashInit(pGC, pPriv, dashOffset, dashlen, even);
+
dst += ((y1 + dstYoff) * dstStride);
x1 = (x1 + dstXoff) * dstBpp;
dst += x1 >> FB_STIP_SHIFT;
x1 &= FB_STIP_MASK;
mask0 = FbStipMask(0, dstBpp);
- mask = FbStipRight (mask0, x1);
+ mask = FbStipRight(mask0, x1);
if (signdx < 0)
- mask0 = FbStipRight (mask0, FB_STIP_UNIT - dstBpp);
+ mask0 = FbStipRight(mask0, FB_STIP_UNIT - dstBpp);
if (signdy < 0)
- dstStride = -dstStride;
- while (len--)
- {
- if (even)
- WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, mask));
- else if (doOdd)
- WRITE(dst, FbDoMaskRRop (READ(dst), bgand, bgxor, mask));
- if (axis == X_AXIS)
- {
- mask = fbBresShiftMask(mask,signdx,dstBpp);
- if (!mask)
- {
- dst += signdx;
- mask = mask0;
- }
- e += e1;
- if (e >= 0)
- {
- dst += dstStride;
- e += e3;
- }
- }
- else
- {
- dst += dstStride;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- mask = fbBresShiftMask(mask,signdx,dstBpp);
- if (!mask)
- {
- dst += signdx;
- mask = mask0;
- }
- }
- }
- FbDashStep (dashlen, even);
+ dstStride = -dstStride;
+ while (len--) {
+ if (even)
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask));
+ else if (doOdd)
+ WRITE(dst, FbDoMaskRRop(READ(dst), bgand, bgxor, mask));
+ if (axis == X_AXIS) {
+ mask = fbBresShiftMask(mask, signdx, dstBpp);
+ if (!mask) {
+ dst += signdx;
+ mask = mask0;
+ }
+ e += e1;
+ if (e >= 0) {
+ dst += dstStride;
+ e += e3;
+ }
+ }
+ else {
+ dst += dstStride;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ mask = fbBresShiftMask(mask, signdx, dstBpp);
+ if (!mask) {
+ dst += signdx;
+ mask = mask0;
+ }
+ }
+ }
+ FbDashStep(dashlen, even);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
void
-fbBresFill (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresFill(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- while (len--)
- {
- fbFill (pDrawable, pGC, x1, y1, 1, 1);
- if (axis == X_AXIS)
- {
- x1 += signdx;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- y1 += signdy;
- }
- }
- else
- {
- y1 += signdy;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- x1 += signdx;
- }
- }
+ while (len--) {
+ fbFill(pDrawable, pGC, x1, y1, 1, 1);
+ if (axis == X_AXIS) {
+ x1 += signdx;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ y1 += signdy;
+ }
+ }
+ else {
+ y1 += signdy;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ x1 += signdx;
+ }
+ }
}
}
static void
-fbSetFg (DrawablePtr pDrawable,
- GCPtr pGC,
- Pixel fg)
+fbSetFg(DrawablePtr pDrawable, GCPtr pGC, Pixel fg)
{
- if (fg != pGC->fgPixel)
- {
- ChangeGCVal val;
- val.val = fg;
- ChangeGC (NullClient, pGC, GCForeground, &val);
- ValidateGC (pDrawable, pGC);
+ if (fg != pGC->fgPixel) {
+ ChangeGCVal val;
+
+ val.val = fg;
+ ChangeGC(NullClient, pGC, GCForeground, &val);
+ ValidateGC(pDrawable, pGC);
}
}
void
-fbBresFillDash (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresFillDash(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+
FbDashDeclare;
- int dashlen;
- Bool even;
- Bool doOdd;
- Bool doBg;
- Pixel fg, bg;
-
+ int dashlen;
+ Bool even;
+ Bool doOdd;
+ Bool doBg;
+ Pixel fg, bg;
+
fg = pGC->fgPixel;
bg = pGC->bgPixel;
-
+
/* whether to fill the odd dashes */
doOdd = pGC->lineStyle == LineDoubleDash;
/* whether to switch fg to bg when filling odd dashes */
- doBg = doOdd && (pGC->fillStyle == FillSolid ||
- pGC->fillStyle == FillStippled);
-
+ doBg = doOdd && (pGC->fillStyle == FillSolid ||
+ pGC->fillStyle == FillStippled);
+
/* compute current dash position */
- FbDashInit (pGC, pPriv, dashOffset, dashlen, even);
-
- while (len--)
- {
- if (even || doOdd)
- {
- if (doBg)
- {
- if (even)
- fbSetFg (pDrawable, pGC, fg);
- else
- fbSetFg (pDrawable, pGC, bg);
- }
- fbFill (pDrawable, pGC, x1, y1, 1, 1);
- }
- if (axis == X_AXIS)
- {
- x1 += signdx;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- y1 += signdy;
- }
- }
- else
- {
- y1 += signdy;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- x1 += signdx;
- }
- }
- FbDashStep (dashlen, even);
+ FbDashInit(pGC, pPriv, dashOffset, dashlen, even);
+
+ while (len--) {
+ if (even || doOdd) {
+ if (doBg) {
+ if (even)
+ fbSetFg(pDrawable, pGC, fg);
+ else
+ fbSetFg(pDrawable, pGC, bg);
+ }
+ fbFill(pDrawable, pGC, x1, y1, 1, 1);
+ }
+ if (axis == X_AXIS) {
+ x1 += signdx;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ y1 += signdy;
+ }
+ }
+ else {
+ y1 += signdy;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ x1 += signdx;
+ }
+ }
+ FbDashStep(dashlen, even);
}
if (doBg)
- fbSetFg (pDrawable, pGC, fg);
+ fbSetFg(pDrawable, pGC, fg);
}
static void
-fbBresSolid24RRop (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresSolid24RRop(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- FbStip and = pPriv->and;
- FbStip xor = pPriv->xor;
- FbStip leftMask, rightMask;
- int nl;
- FbStip *d;
- int x;
- int rot;
- FbStip andT, xorT;
-
- fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbStip and = pPriv->and;
+ FbStip xor = pPriv->xor;
+ FbStip leftMask, rightMask;
+ int nl;
+ FbStip *d;
+ int x;
+ int rot;
+ FbStip andT, xorT;
+
+ fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
dst += ((y1 + dstYoff) * dstStride);
x1 = (x1 + dstXoff) * 24;
if (signdy < 0)
- dstStride = -dstStride;
+ dstStride = -dstStride;
signdx *= 24;
- while (len--)
- {
- d = dst + (x1 >> FB_STIP_SHIFT);
- x = x1 & FB_STIP_MASK;
- rot = FbFirst24Rot (x);
- andT = FbRot24Stip(and,rot);
- xorT = FbRot24Stip(xor,rot);
- FbMaskStip (x, 24, leftMask, nl, rightMask);
- if (leftMask)
- {
- WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
- d++;
- andT = FbNext24Stip (andT);
- xorT = FbNext24Stip (xorT);
- }
- if (rightMask)
- WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, rightMask));
- if (axis == X_AXIS)
- {
- x1 += signdx;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- dst += dstStride;
- }
- }
- else
- {
- dst += dstStride;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- x1 += signdx;
- }
- }
+ while (len--) {
+ d = dst + (x1 >> FB_STIP_SHIFT);
+ x = x1 & FB_STIP_MASK;
+ rot = FbFirst24Rot(x);
+ andT = FbRot24Stip(and, rot);
+ xorT = FbRot24Stip(xor, rot);
+ FbMaskStip(x, 24, leftMask, nl, rightMask);
+ if (leftMask) {
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, leftMask));
+ d++;
+ andT = FbNext24Stip(andT);
+ xorT = FbNext24Stip(xorT);
+ }
+ if (rightMask)
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
+ if (axis == X_AXIS) {
+ x1 += signdx;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ dst += dstStride;
+ }
+ }
+ else {
+ dst += dstStride;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ x1 += signdx;
+ }
+ }
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
static void
-fbBresDash24RRop (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBresDash24RRop(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy,
+ int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- FbStip *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- FbStip andT, xorT;
- FbStip fgand = pPriv->and;
- FbStip fgxor = pPriv->xor;
- FbStip bgand = pPriv->bgand;
- FbStip bgxor = pPriv->bgxor;
- FbStip leftMask, rightMask;
- int nl;
- FbStip *d;
- int x;
- int rot;
+ FbStip *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ FbStip andT, xorT;
+ FbStip fgand = pPriv->and;
+ FbStip fgxor = pPriv->xor;
+ FbStip bgand = pPriv->bgand;
+ FbStip bgxor = pPriv->bgxor;
+ FbStip leftMask, rightMask;
+ int nl;
+ FbStip *d;
+ int x;
+ int rot;
+
FbDashDeclare;
- int dashlen;
- Bool even;
- Bool doOdd;
-
- fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ int dashlen;
+ Bool even;
+ Bool doOdd;
+
+ fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
doOdd = pGC->lineStyle == LineDoubleDash;
/* compute current dash position */
FbDashInit(pGC, pPriv, dashOffset, dashlen, even);
-
+
dst += ((y1 + dstYoff) * dstStride);
x1 = (x1 + dstXoff) * 24;
if (signdy < 0)
- dstStride = -dstStride;
+ dstStride = -dstStride;
signdx *= 24;
- while (len--)
- {
- if (even || doOdd)
- {
- if (even)
- {
- andT = fgand;
- xorT = fgxor;
- }
- else
- {
- andT = bgand;
- xorT = bgxor;
- }
- d = dst + (x1 >> FB_STIP_SHIFT);
- x = x1 & FB_STIP_MASK;
- rot = FbFirst24Rot (x);
- andT = FbRot24Stip (andT, rot);
- xorT = FbRot24Stip (xorT, rot);
- FbMaskStip (x, 24, leftMask, nl, rightMask);
- if (leftMask)
- {
- WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
- d++;
- andT = FbNext24Stip (andT);
- xorT = FbNext24Stip (xorT);
- }
- if (rightMask)
- WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, rightMask));
- }
- if (axis == X_AXIS)
- {
- x1 += signdx;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- dst += dstStride;
- }
- }
- else
- {
- dst += dstStride;
- e += e1;
- if (e >= 0)
- {
- e += e3;
- x1 += signdx;
- }
- }
- FbDashStep (dashlen, even);
+ while (len--) {
+ if (even || doOdd) {
+ if (even) {
+ andT = fgand;
+ xorT = fgxor;
+ }
+ else {
+ andT = bgand;
+ xorT = bgxor;
+ }
+ d = dst + (x1 >> FB_STIP_SHIFT);
+ x = x1 & FB_STIP_MASK;
+ rot = FbFirst24Rot(x);
+ andT = FbRot24Stip(andT, rot);
+ xorT = FbRot24Stip(xorT, rot);
+ FbMaskStip(x, 24, leftMask, nl, rightMask);
+ if (leftMask) {
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, leftMask));
+ d++;
+ andT = FbNext24Stip(andT);
+ xorT = FbNext24Stip(xorT);
+ }
+ if (rightMask)
+ WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
+ }
+ if (axis == X_AXIS) {
+ x1 += signdx;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ dst += dstStride;
+ }
+ }
+ else {
+ dst += dstStride;
+ e += e1;
+ if (e >= 0) {
+ e += e3;
+ x1 += signdx;
+ }
+ }
+ FbDashStep(dashlen, even);
}
- fbFinishAccess (pDrawable);
+ fbFinishAccess(pDrawable);
}
/*
@@ -514,209 +435,193 @@ fbBresDash24RRop (DrawablePtr pDrawable,
*/
FbBres *
-fbSelectBres (DrawablePtr pDrawable,
- GCPtr pGC)
+fbSelectBres(DrawablePtr pDrawable, GCPtr pGC)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- int dstBpp = pDrawable->bitsPerPixel;
- FbBres * bres;
-
- if (pGC->lineStyle == LineSolid)
- {
- bres = fbBresFill;
- if (pGC->fillStyle == FillSolid)
- {
- bres = fbBresSolid;
- if (dstBpp == 24)
- bres = fbBresSolid24RRop;
- if (pPriv->and == 0)
- {
- switch (dstBpp) {
- case 8: bres = fbBresSolid8; break;
- case 16: bres = fbBresSolid16; break;
- case 24: bres = fbBresSolid24; break;
- case 32: bres = fbBresSolid32; break;
- }
- }
- }
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ int dstBpp = pDrawable->bitsPerPixel;
+ FbBres *bres;
+
+ if (pGC->lineStyle == LineSolid) {
+ bres = fbBresFill;
+ if (pGC->fillStyle == FillSolid) {
+ bres = fbBresSolid;
+ if (dstBpp == 24)
+ bres = fbBresSolid24RRop;
+ if (pPriv->and == 0) {
+ switch (dstBpp) {
+ case 8:
+ bres = fbBresSolid8;
+ break;
+ case 16:
+ bres = fbBresSolid16;
+ break;
+ case 24:
+ bres = fbBresSolid24;
+ break;
+ case 32:
+ bres = fbBresSolid32;
+ break;
+ }
+ }
+ }
}
- else
- {
- bres = fbBresFillDash;
- if (pGC->fillStyle == FillSolid)
- {
- bres = fbBresDash;
- if (dstBpp == 24)
- bres = fbBresDash24RRop;
- if (pPriv->and == 0 &&
- (pGC->lineStyle == LineOnOffDash || pPriv->bgand == 0))
- {
- switch (dstBpp) {
- case 8: bres = fbBresDash8; break;
- case 16: bres = fbBresDash16; break;
- case 24: bres = fbBresDash24; break;
- case 32: bres = fbBresDash32; break;
- }
- }
- }
+ else {
+ bres = fbBresFillDash;
+ if (pGC->fillStyle == FillSolid) {
+ bres = fbBresDash;
+ if (dstBpp == 24)
+ bres = fbBresDash24RRop;
+ if (pPriv->and == 0 &&
+ (pGC->lineStyle == LineOnOffDash || pPriv->bgand == 0)) {
+ switch (dstBpp) {
+ case 8:
+ bres = fbBresDash8;
+ break;
+ case 16:
+ bres = fbBresDash16;
+ break;
+ case 24:
+ bres = fbBresDash24;
+ break;
+ case 32:
+ bres = fbBresDash32;
+ break;
+ }
+ }
+ }
}
return bres;
}
void
-fbBres (DrawablePtr pDrawable,
- GCPtr pGC,
- int dashOffset,
- int signdx,
- int signdy,
- int axis,
- int x1,
- int y1,
- int e,
- int e1,
- int e3,
- int len)
+fbBres(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int dashOffset,
+ int signdx,
+ int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
{
- (*fbSelectBres (pDrawable, pGC)) (pDrawable, pGC, dashOffset,
- signdx, signdy, axis, x1, y1,
- e, e1, e3, len);
+ (*fbSelectBres(pDrawable, pGC)) (pDrawable, pGC, dashOffset,
+ signdx, signdy, axis, x1, y1,
+ e, e1, e3, len);
}
void
-fbSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int x1,
- int y1,
- int x2,
- int y2,
- Bool drawLast,
- int *dashOffset)
+fbSegment(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x1, int y1, int x2, int y2, Bool drawLast, int *dashOffset)
{
- FbBres * bres;
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BoxPtr pBox;
- int nBox;
- int adx; /* abs values of dx and dy */
- int ady;
- int signdx; /* sign of dx and dy */
- int signdy;
- int e, e1, e2, e3; /* bresenham error and increments */
- int len; /* length of segment */
- int axis; /* major axis */
- int octant;
- int dashoff;
- int doff;
+ FbBres *bres;
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ BoxPtr pBox;
+ int nBox;
+ int adx; /* abs values of dx and dy */
+ int ady;
+ int signdx; /* sign of dx and dy */
+ int signdy;
+ int e, e1, e2, e3; /* bresenham error and increments */
+ int len; /* length of segment */
+ int axis; /* major axis */
+ int octant;
+ int dashoff;
+ int doff;
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
- unsigned int oc1; /* outcode of point 1 */
- unsigned int oc2; /* outcode of point 2 */
-
- nBox = RegionNumRects (pClip);
- pBox = RegionRects (pClip);
-
- bres = fbSelectBres (pDrawable, pGC);
-
- CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
- 1, 1, octant);
-
- if (adx > ady)
- {
- axis = X_AXIS;
- e1 = ady << 1;
- e2 = e1 - (adx << 1);
- e = e1 - adx;
- len = adx;
+ unsigned int oc1; /* outcode of point 1 */
+ unsigned int oc2; /* outcode of point 2 */
+
+ nBox = RegionNumRects(pClip);
+ pBox = RegionRects(pClip);
+
+ bres = fbSelectBres(pDrawable, pGC);
+
+ CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
+
+ if (adx > ady) {
+ axis = X_AXIS;
+ e1 = ady << 1;
+ e2 = e1 - (adx << 1);
+ e = e1 - adx;
+ len = adx;
}
- else
- {
- axis = Y_AXIS;
- e1 = adx << 1;
- e2 = e1 - (ady << 1);
- e = e1 - ady;
- SetYMajorOctant(octant);
- len = ady;
+ else {
+ axis = Y_AXIS;
+ e1 = adx << 1;
+ e2 = e1 - (ady << 1);
+ e = e1 - ady;
+ SetYMajorOctant(octant);
+ len = ady;
}
- FIXUP_ERROR (e, octant, bias);
-
+ FIXUP_ERROR(e, octant, bias);
+
/*
* Adjust error terms to compare against zero
*/
e3 = e2 - e1;
e = e - e1;
-
+
/* we have bresenham parameters and two points.
all we have to do now is clip and draw.
- */
+ */
if (drawLast)
- len++;
+ len++;
dashoff = *dashOffset;
*dashOffset = dashoff + len;
- while(nBox--)
- {
- oc1 = 0;
- oc2 = 0;
- OUTCODES(oc1, x1, y1, pBox);
- OUTCODES(oc2, x2, y2, pBox);
- if ((oc1 | oc2) == 0)
- {
- (*bres) (pDrawable, pGC, dashoff,
- signdx, signdy, axis, x1, y1,
- e, e1, e3, len);
- break;
- }
- else if (oc1 & oc2)
- {
- pBox++;
- }
- else
- {
- int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
- int clip1 = 0, clip2 = 0;
- int clipdx, clipdy;
- int err;
-
- if (miZeroClipLine(pBox->x1, pBox->y1, pBox->x2-1,
- pBox->y2-1,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady, &clip1, &clip2,
- octant, bias, oc1, oc2) == -1)
- {
- pBox++;
- continue;
- }
-
- if (axis == X_AXIS)
- len = abs(new_x2 - new_x1);
- else
- len = abs(new_y2 - new_y1);
- if (clip2 != 0 || drawLast)
- len++;
- if (len)
- {
- /* unwind bresenham error term to first point */
- doff = dashoff;
- err = e;
- if (clip1)
- {
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
- if (axis == X_AXIS)
- {
- doff += clipdx;
- err += e3 * clipdy + e1 * clipdx;
- }
- else
- {
- doff += clipdy;
- err += e3 * clipdx + e1 * clipdy;
- }
- }
- (*bres) (pDrawable, pGC, doff,
- signdx, signdy, axis, new_x1, new_y1,
- err, e1, e3, len);
- }
- pBox++;
- }
- } /* while (nBox--) */
+ while (nBox--) {
+ oc1 = 0;
+ oc2 = 0;
+ OUTCODES(oc1, x1, y1, pBox);
+ OUTCODES(oc2, x2, y2, pBox);
+ if ((oc1 | oc2) == 0) {
+ (*bres) (pDrawable, pGC, dashoff,
+ signdx, signdy, axis, x1, y1, e, e1, e3, len);
+ break;
+ }
+ else if (oc1 & oc2) {
+ pBox++;
+ }
+ else {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int clipdx, clipdy;
+ int err;
+
+ if (miZeroClipLine(pBox->x1, pBox->y1, pBox->x2 - 1,
+ pBox->y2 - 1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1) {
+ pBox++;
+ continue;
+ }
+
+ if (axis == X_AXIS)
+ len = abs(new_x2 - new_x1);
+ else
+ len = abs(new_y2 - new_y1);
+ if (clip2 != 0 || drawLast)
+ len++;
+ if (len) {
+ /* unwind bresenham error term to first point */
+ doff = dashoff;
+ err = e;
+ if (clip1) {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+ if (axis == X_AXIS) {
+ doff += clipdx;
+ err += e3 * clipdy + e1 * clipdx;
+ }
+ else {
+ doff += clipdy;
+ err += e3 * clipdx + e1 * clipdy;
+ }
+ }
+ (*bres) (pDrawable, pGC, doff,
+ signdx, signdy, axis, new_x1, new_y1,
+ err, e1, e3, len);
+ }
+ pBox++;
+ }
+ } /* while (nBox--) */
}
diff --git a/xorg-server/fb/fbsetsp.c b/xorg-server/fb/fbsetsp.c
index 65ec8b874..e09d2e3f3 100644
--- a/xorg-server/fb/fbsetsp.c
+++ b/xorg-server/fb/fbsetsp.c
@@ -27,74 +27,58 @@
#include "fb.h"
void
-fbSetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *src,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted)
+fbSetSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
- FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
- RegionPtr pClip = fbGetCompositeClip(pGC);
- FbBits *dst, *d, *s;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- BoxPtr pbox;
- int n;
- int xoff;
- int x1, x2;
-
- if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth))
- {
- fb24_32SetSpans (pDrawable, pGC, src, ppt, pwidth, nspans, fSorted);
- return;
- }
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- while (nspans--)
- {
- d = dst + (ppt->y + dstYoff) * dstStride;
- xoff = (int) (((long) src) & (FB_MASK >> 3));
- s = (FbBits *) (src - xoff);
- xoff <<= 3;
- n = RegionNumRects(pClip);
- pbox = RegionRects (pClip);
- while (n--)
- {
- if (pbox->y1 > ppt->y)
- break;
- if (pbox->y2 > ppt->y)
- {
- x1 = ppt->x;
- x2 = x1 + *pwidth;
- if (pbox->x1 > x1)
- x1 = pbox->x1;
- if (pbox->x2 < x2)
- x2 = pbox->x2;
- if (x1 < x2)
- fbBlt ((FbBits *) s,
- 0,
- (x1 - ppt->x) * dstBpp + xoff,
- d,
- dstStride,
- (x1 + dstXoff) * dstBpp,
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ FbBits *dst, *d, *s;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ BoxPtr pbox;
+ int n;
+ int xoff;
+ int x1, x2;
- (x2 - x1) * dstBpp,
- 1,
- pGC->alu,
- pPriv->pm,
- dstBpp,
-
- FALSE,
- FALSE);
- }
- }
- src += PixmapBytePad (*pwidth, pDrawable->depth);
- ppt++;
- pwidth++;
+ if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
+ fb24_32SetSpans(pDrawable, pGC, src, ppt, pwidth, nspans, fSorted);
+ return;
+ }
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ while (nspans--) {
+ d = dst + (ppt->y + dstYoff) * dstStride;
+ xoff = (int) (((long) src) & (FB_MASK >> 3));
+ s = (FbBits *) (src - xoff);
+ xoff <<= 3;
+ n = RegionNumRects(pClip);
+ pbox = RegionRects(pClip);
+ while (n--) {
+ if (pbox->y1 > ppt->y)
+ break;
+ if (pbox->y2 > ppt->y) {
+ x1 = ppt->x;
+ x2 = x1 + *pwidth;
+ if (pbox->x1 > x1)
+ x1 = pbox->x1;
+ if (pbox->x2 < x2)
+ x2 = pbox->x2;
+ if (x1 < x2)
+ fbBlt((FbBits *) s,
+ 0,
+ (x1 - ppt->x) * dstBpp + xoff,
+ d,
+ dstStride,
+ (x1 + dstXoff) * dstBpp,
+ (x2 - x1) * dstBpp,
+ 1, pGC->alu, pPriv->pm, dstBpp, FALSE, FALSE);
+ }
+ }
+ src += PixmapBytePad(*pwidth, pDrawable->depth);
+ ppt++;
+ pwidth++;
}
- fbValidateDrawable (pDrawable);
- fbFinishAccess (pDrawable);
+ fbValidateDrawable(pDrawable);
+ fbFinishAccess(pDrawable);
}
-
diff --git a/xorg-server/fb/fbsolid.c b/xorg-server/fb/fbsolid.c
index 414378531..cad286a43 100644
--- a/xorg-server/fb/fbsolid.c
+++ b/xorg-server/fb/fbsolid.c
@@ -29,73 +29,56 @@
#include "fb.h"
void
-fbSolid (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int bpp,
-
- int width,
- int height,
-
- FbBits and,
- FbBits xor)
+fbSolid(FbBits * dst,
+ FbStride dstStride,
+ int dstX, int bpp, int width, int height, FbBits and, FbBits xor)
{
- FbBits startmask, endmask;
- int n, nmiddle;
- int startbyte, endbyte;
+ FbBits startmask, endmask;
+ int n, nmiddle;
+ int startbyte, endbyte;
- if (bpp == 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor)))
- {
- fbSolid24 (dst, dstStride, dstX, width, height, and, xor);
- return;
+ if (bpp == 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor))) {
+ fbSolid24(dst, dstStride, dstX, width, height, and, xor);
+ return;
}
dst += dstX >> FB_SHIFT;
dstX &= FB_MASK;
- FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte,
- nmiddle, endmask, endbyte);
+ FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte,
+ nmiddle, endmask, endbyte);
if (startmask)
- dstStride--;
+ dstStride--;
dstStride -= nmiddle;
- while (height--)
- {
- if (startmask)
- {
- FbDoLeftMaskByteRRop(dst,startbyte,startmask,and,xor);
- dst++;
- }
- n = nmiddle;
- if (!and)
- while (n--)
- WRITE(dst++, xor);
- else
- while (n--)
- {
- WRITE(dst, FbDoRRop (READ(dst), and, xor));
+ while (height--) {
+ if (startmask) {
+ FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
+ dst++;
+ }
+ n = nmiddle;
+ if (!and)
+ while (n--)
+ WRITE(dst++, xor);
+ else
+ while (n--) {
+ WRITE(dst, FbDoRRop(READ(dst), and, xor));
dst++;
- }
- if (endmask)
- FbDoRightMaskByteRRop(dst,endbyte,endmask,and,xor);
- dst += dstStride;
+ }
+ if (endmask)
+ FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
+ dst += dstStride;
}
}
void
-fbSolid24 (FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbBits and,
- FbBits xor)
+fbSolid24(FbBits * dst,
+ FbStride dstStride,
+ int dstX, int width, int height, FbBits and, FbBits xor)
{
- FbBits startmask, endmask;
- FbBits xor0 = 0, xor1 = 0, xor2 = 0;
- FbBits and0 = 0, and1 = 0, and2 = 0;
- FbBits xorS = 0, andS = 0, xorE = 0, andE = 0;
- int n, nmiddle;
- int rotS, rot;
+ FbBits startmask, endmask;
+ FbBits xor0 = 0, xor1 = 0, xor2 = 0;
+ FbBits and0 = 0, and1 = 0, and2 = 0;
+ FbBits xorS = 0, andS = 0, xorE = 0, andE = 0;
+ int n, nmiddle;
+ int rotS, rot;
dst += dstX >> FB_SHIFT;
dstX &= FB_MASK;
@@ -103,107 +86,94 @@ fbSolid24 (FbBits *dst,
* Rotate pixel values this far across the word to align on
* screen pixel boundaries
*/
- rot = FbFirst24Rot (dstX);
- FbMaskBits (dstX, width, startmask, nmiddle, endmask);
+ rot = FbFirst24Rot(dstX);
+ FbMaskBits(dstX, width, startmask, nmiddle, endmask);
if (startmask)
- dstStride--;
+ dstStride--;
dstStride -= nmiddle;
-
+
/*
* Precompute rotated versions of the rasterop values
*/
rotS = rot;
- xor = FbRot24(xor,rotS);
- and = FbRot24(and,rotS);
- if (startmask)
- {
- xorS = xor;
- andS = and;
- xor = FbNext24Pix(xor);
- and = FbNext24Pix(and);
+ xor = FbRot24(xor, rotS);
+ and = FbRot24(and, rotS);
+ if (startmask) {
+ xorS = xor;
+ andS = and;
+ xor = FbNext24Pix(xor);
+ and = FbNext24Pix(and);
}
-
- if (nmiddle)
- {
- xor0 = xor;
- and0 = and;
- xor1 = FbNext24Pix(xor0);
- and1 = FbNext24Pix(and0);
- xor2 = FbNext24Pix(xor1);
- and2 = FbNext24Pix(and1);
+
+ if (nmiddle) {
+ xor0 = xor;
+ and0 = and;
+ xor1 = FbNext24Pix(xor0);
+ and1 = FbNext24Pix(and0);
+ xor2 = FbNext24Pix(xor1);
+ and2 = FbNext24Pix(and1);
}
-
- if (endmask)
- {
- switch (nmiddle % 3) {
- case 0:
- xorE = xor;
- andE = and;
- break;
- case 1:
- xorE = xor1;
- andE = and1;
- break;
- case 2:
- xorE = xor2;
- andE = and2;
- break;
- }
+
+ if (endmask) {
+ switch (nmiddle % 3) {
+ case 0:
+ xorE = xor;
+ andE = and;
+ break;
+ case 1:
+ xorE = xor1;
+ andE = and1;
+ break;
+ case 2:
+ xorE = xor2;
+ andE = and2;
+ break;
+ }
}
-
- while (height--)
- {
- if (startmask)
- {
- WRITE(dst, FbDoMaskRRop(READ(dst), andS, xorS, startmask));
+
+ while (height--) {
+ if (startmask) {
+ WRITE(dst, FbDoMaskRRop(READ(dst), andS, xorS, startmask));
dst++;
- }
- n = nmiddle;
- if (!and0)
- {
- while (n >= 3)
- {
- WRITE(dst++, xor0);
- WRITE(dst++, xor1);
- WRITE(dst++, xor2);
- n -= 3;
- }
- if (n)
- {
- WRITE(dst++, xor0);
- n--;
- if (n)
- {
- WRITE(dst++, xor1);
- }
- }
- }
- else
- {
- while (n >= 3)
- {
- WRITE(dst, FbDoRRop (READ(dst), and0, xor0));
+ }
+ n = nmiddle;
+ if (!and0) {
+ while (n >= 3) {
+ WRITE(dst++, xor0);
+ WRITE(dst++, xor1);
+ WRITE(dst++, xor2);
+ n -= 3;
+ }
+ if (n) {
+ WRITE(dst++, xor0);
+ n--;
+ if (n) {
+ WRITE(dst++, xor1);
+ }
+ }
+ }
+ else {
+ while (n >= 3) {
+ WRITE(dst, FbDoRRop(READ(dst), and0, xor0));
dst++;
- WRITE(dst, FbDoRRop (READ(dst), and1, xor1));
+ WRITE(dst, FbDoRRop(READ(dst), and1, xor1));
dst++;
- WRITE(dst, FbDoRRop (READ(dst), and2, xor2));
+ WRITE(dst, FbDoRRop(READ(dst), and2, xor2));
dst++;
- n -= 3;
- }
- if (n)
- {
- WRITE(dst, FbDoRRop (READ(dst), and0, xor0));
+ n -= 3;
+ }
+ if (n) {
+ WRITE(dst, FbDoRRop(READ(dst), and0, xor0));
dst++;
- n--;
- if (n)
- {
- WRITE(dst, FbDoRRop (READ(dst), and1, xor1));
+ n--;
+ if (n) {
+ WRITE(dst, FbDoRRop(READ(dst), and1, xor1));
dst++;
- }
- }
- }
- if (endmask)
- WRITE(dst, FbDoMaskRRop (READ(dst), andE, xorE, endmask));
- dst += dstStride;
+ }
+ }
+ }
+ if (endmask)
+ WRITE(dst, FbDoMaskRRop(READ(dst), andE, xorE, endmask));
+ dst += dstStride;
}
}
diff --git a/xorg-server/fb/fbstipple.c b/xorg-server/fb/fbstipple.c
index dc1fd468f..f6c84a212 100644
--- a/xorg-server/fb/fbstipple.c
+++ b/xorg-server/fb/fbstipple.c
@@ -42,29 +42,26 @@
#define LaneCases64(c,a) LaneCases32(c,a); LaneCases32(c+32,a)
#define LaneCases128(c,a) LaneCases64(c,a); LaneCases64(c+64,a)
#define LaneCases256(c,a) LaneCases128(c,a); LaneCases128(c+128,a)
-
+
#if FB_SHIFT == 6
#define LaneCases(a) LaneCases256(0,a)
#endif
-
+
#if FB_SHIFT == 5
#define LaneCases(a) LaneCases16(0,a)
#endif
-
+
/*
* Repeat a transparent stipple across a scanline n times
*/
void
-fbTransparentSpan (FbBits *dst,
- FbBits stip,
- FbBits fgxor,
- int n)
+fbTransparentSpan(FbBits * dst, FbBits stip, FbBits fgxor, int n)
{
- FbStip s;
+ FbStip s;
- s = ((FbStip) (stip ) & 0x01);
- s |= ((FbStip) (stip >> 8) & 0x02);
+ s = ((FbStip) (stip) & 0x01);
+ s |= ((FbStip) (stip >> 8) & 0x02);
s |= ((FbStip) (stip >> 16) & 0x04);
s |= ((FbStip) (stip >> 24) & 0x08);
#if FB_SHIFT > 5
@@ -74,235 +71,194 @@ fbTransparentSpan (FbBits *dst,
s |= ((FbStip) (stip >> 56) & 0x80);
#endif
switch (s) {
- LaneCases(dst);
+ LaneCases(dst);
}
}
void
-fbEvenStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipHeight,
-
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot)
+fbEvenStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipHeight,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot)
{
- FbBits startmask, endmask;
- FbBits mask, and, xor;
- int nmiddle, n;
- FbStip *s, *stipEnd, bits;
- int rot, stipX, stipY;
- int pixelsPerDst;
- const FbBits *fbBits;
- Bool transparent;
- int startbyte, endbyte;
-
+ FbBits startmask, endmask;
+ FbBits mask, and, xor;
+ int nmiddle, n;
+ FbStip *s, *stipEnd, bits;
+ int rot, stipX, stipY;
+ int pixelsPerDst;
+ const FbBits *fbBits;
+ Bool transparent;
+ int startbyte, endbyte;
+
/*
* Check for a transparent stipple (stencil)
*/
transparent = FALSE;
- if (dstBpp >= 8 &&
- fgand == 0 && bgand == FB_ALLONES && bgxor == 0)
- transparent = TRUE;
-
+ if (dstBpp >= 8 && fgand == 0 && bgand == FB_ALLONES && bgxor == 0)
+ transparent = TRUE;
+
pixelsPerDst = FB_UNIT / dstBpp;
/*
* Adjust dest pointers
*/
dst += dstX >> FB_SHIFT;
dstX &= FB_MASK;
- FbMaskBitsBytes (dstX, width, fgand == 0 && bgand == 0,
- startmask, startbyte, nmiddle, endmask, endbyte);
-
+ FbMaskBitsBytes(dstX, width, fgand == 0 && bgand == 0,
+ startmask, startbyte, nmiddle, endmask, endbyte);
+
if (startmask)
- dstStride--;
+ dstStride--;
dstStride -= nmiddle;
-
+
xRot *= dstBpp;
/*
* Compute stip start scanline and rotation parameters
*/
stipEnd = stip + stipStride * stipHeight;
- modulus (- yRot, stipHeight, stipY);
+ modulus(-yRot, stipHeight, stipY);
s = stip + stipStride * stipY;
- modulus (- xRot, FB_UNIT, stipX);
+ modulus(-xRot, FB_UNIT, stipX);
rot = stipX;
-
+
/*
* Get pointer to stipple mask array for this depth
*/
/* fbStippleTable covers all valid bpp (4,8,16,32) */
fbBits = fbStippleTable[pixelsPerDst];
-
- while (height--)
- {
- /*
- * Extract stipple bits for this scanline;
- */
- bits = READ(s);
- s += stipStride;
- if (s == stipEnd)
- s = stip;
+
+ while (height--) {
+ /*
+ * Extract stipple bits for this scanline;
+ */
+ bits = READ(s);
+ s += stipStride;
+ if (s == stipEnd)
+ s = stip;
#if FB_UNIT > 32
- if (pixelsPerDst == 16)
- mask = FbStipple16Bits(FbLeftStipBits(bits,16));
- else
+ if (pixelsPerDst == 16)
+ mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
+ else
#endif
- mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
- /*
- * Rotate into position and compute reduced rop values
- */
- mask = FbRotLeft(mask, rot);
- and = (fgand & mask) | (bgand & ~mask);
- xor = (fgxor & mask) | (bgxor & ~mask);
-
- if (transparent)
- {
- if (startmask)
- {
- fbTransparentSpan(dst, mask&startmask, fgxor, 1);
- dst++;
- }
- fbTransparentSpan (dst, mask, fgxor, nmiddle);
- dst += nmiddle;
- if (endmask)
- fbTransparentSpan(dst, mask&endmask, fgxor, 1);
- }
- else
- {
- /*
- * Fill scanline
- */
- if (startmask)
- {
- FbDoLeftMaskByteRRop (dst, startbyte, startmask, and, xor);
- dst++;
- }
- n = nmiddle;
- if (!and)
- while (n--)
- WRITE(dst++, xor);
- else
- {
- while (n--)
- {
- WRITE(dst, FbDoRRop (READ(dst), and, xor));
- dst++;
- }
- }
- if (endmask)
- FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
- }
- dst += dstStride;
+ mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+ /*
+ * Rotate into position and compute reduced rop values
+ */
+ mask = FbRotLeft(mask, rot);
+ and = (fgand & mask) | (bgand & ~mask);
+ xor = (fgxor & mask) | (bgxor & ~mask);
+
+ if (transparent) {
+ if (startmask) {
+ fbTransparentSpan(dst, mask & startmask, fgxor, 1);
+ dst++;
+ }
+ fbTransparentSpan(dst, mask, fgxor, nmiddle);
+ dst += nmiddle;
+ if (endmask)
+ fbTransparentSpan(dst, mask & endmask, fgxor, 1);
+ }
+ else {
+ /*
+ * Fill scanline
+ */
+ if (startmask) {
+ FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
+ dst++;
+ }
+ n = nmiddle;
+ if (!and)
+ while (n--)
+ WRITE(dst++, xor);
+ else {
+ while (n--) {
+ WRITE(dst, FbDoRRop(READ(dst), and, xor));
+ dst++;
+ }
+ }
+ if (endmask)
+ FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
+ }
+ dst += dstStride;
}
}
void
-fbOddStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipWidth,
- int stipHeight,
-
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot)
+fbOddStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipWidth,
+ int stipHeight,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot)
{
- int stipX, stipY, sx;
- int widthTmp;
- int h, w;
- int x, y;
+ int stipX, stipY, sx;
+ int widthTmp;
+ int h, w;
+ int x, y;
- modulus (- yRot, stipHeight, stipY);
- modulus (dstX / dstBpp - xRot, stipWidth, stipX);
+ modulus(-yRot, stipHeight, stipY);
+ modulus(dstX / dstBpp - xRot, stipWidth, stipX);
y = 0;
- while (height)
- {
- h = stipHeight - stipY;
- if (h > height)
- h = height;
- height -= h;
- widthTmp = width;
- x = dstX;
- sx = stipX;
- while (widthTmp)
- {
- w = (stipWidth - sx) * dstBpp;
- if (w > widthTmp)
- w = widthTmp;
- widthTmp -= w;
- fbBltOne (stip + stipY * stipStride,
- stipStride,
- sx,
-
- dst + y * dstStride,
- dstStride,
- x,
- dstBpp,
-
- w, h,
-
- fgand, fgxor, bgand, bgxor);
- x += w;
- sx = 0;
- }
- y += h;
- stipY = 0;
+ while (height) {
+ h = stipHeight - stipY;
+ if (h > height)
+ h = height;
+ height -= h;
+ widthTmp = width;
+ x = dstX;
+ sx = stipX;
+ while (widthTmp) {
+ w = (stipWidth - sx) * dstBpp;
+ if (w > widthTmp)
+ w = widthTmp;
+ widthTmp -= w;
+ fbBltOne(stip + stipY * stipStride,
+ stipStride,
+ sx,
+ dst + y * dstStride,
+ dstStride, x, dstBpp, w, h, fgand, fgxor, bgand, bgxor);
+ x += w;
+ sx = 0;
+ }
+ y += h;
+ stipY = 0;
}
}
void
-fbStipple (FbBits *dst,
- FbStride dstStride,
- int dstX,
- int dstBpp,
-
- int width,
- int height,
-
- FbStip *stip,
- FbStride stipStride,
- int stipWidth,
- int stipHeight,
- Bool even,
-
- FbBits fgand,
- FbBits fgxor,
- FbBits bgand,
- FbBits bgxor,
-
- int xRot,
- int yRot)
+fbStipple(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int dstBpp,
+ int width,
+ int height,
+ FbStip * stip,
+ FbStride stipStride,
+ int stipWidth,
+ int stipHeight,
+ Bool even,
+ FbBits fgand,
+ FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot)
{
if (even)
- fbEvenStipple (dst, dstStride, dstX, dstBpp, width, height,
- stip, stipStride, stipHeight,
- fgand, fgxor, bgand, bgxor, xRot, yRot);
+ fbEvenStipple(dst, dstStride, dstX, dstBpp, width, height,
+ stip, stipStride, stipHeight,
+ fgand, fgxor, bgand, bgxor, xRot, yRot);
else
- fbOddStipple (dst, dstStride, dstX, dstBpp, width, height,
- stip, stipStride, stipWidth, stipHeight,
- fgand, fgxor, bgand, bgxor, xRot, yRot);
+ fbOddStipple(dst, dstStride, dstX, dstBpp, width, height,
+ stip, stipStride, stipWidth, stipHeight,
+ fgand, fgxor, bgand, bgxor, xRot, yRot);
}
diff --git a/xorg-server/fb/fbtile.c b/xorg-server/fb/fbtile.c
index 05a27a17b..785c5f0e4 100644
--- a/xorg-server/fb/fbtile.c
+++ b/xorg-server/fb/fbtile.c
@@ -32,172 +32,132 @@
*/
void
-fbEvenTile (FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbBits *tile,
- FbStride tileStride,
- int tileHeight,
-
- int alu,
- FbBits pm,
- int xRot,
- int yRot)
+fbEvenTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileHeight, int alu, FbBits pm, int xRot, int yRot)
{
- FbBits *t, *tileEnd, bits;
- FbBits startmask, endmask;
- FbBits and, xor;
- int n, nmiddle;
- int tileX, tileY;
- int rot;
- int startbyte, endbyte;
+ FbBits *t, *tileEnd, bits;
+ FbBits startmask, endmask;
+ FbBits and, xor;
+ int n, nmiddle;
+ int tileX, tileY;
+ int rot;
+ int startbyte, endbyte;
dst += dstX >> FB_SHIFT;
dstX &= FB_MASK;
FbMaskBitsBytes(dstX, width, FbDestInvarientRop(alu, pm),
- startmask, startbyte, nmiddle, endmask, endbyte);
+ startmask, startbyte, nmiddle, endmask, endbyte);
if (startmask)
- dstStride--;
+ dstStride--;
dstStride -= nmiddle;
-
+
/*
* Compute tile start scanline and rotation parameters
*/
tileEnd = tile + tileHeight * tileStride;
- modulus (- yRot, tileHeight, tileY);
+ modulus(-yRot, tileHeight, tileY);
t = tile + tileY * tileStride;
- modulus (- xRot, FB_UNIT, tileX);
+ modulus(-xRot, FB_UNIT, tileX);
rot = tileX;
-
- while (height--)
- {
-
- /*
- * Pick up bits for this scanline
- */
- bits = READ(t);
- t += tileStride;
- if (t >= tileEnd) t = tile;
- bits = FbRotLeft(bits,rot);
- and = fbAnd(alu,bits,pm);
- xor = fbXor(alu,bits,pm);
-
- if (startmask)
- {
- FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
- dst++;
- }
- n = nmiddle;
- if (!and)
- while (n--)
- WRITE(dst++, xor);
- else
- while (n--)
- {
- WRITE(dst, FbDoRRop (READ(dst), and, xor));
- dst++;
- }
- if (endmask)
- FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
- dst += dstStride;
+
+ while (height--) {
+
+ /*
+ * Pick up bits for this scanline
+ */
+ bits = READ(t);
+ t += tileStride;
+ if (t >= tileEnd)
+ t = tile;
+ bits = FbRotLeft(bits, rot);
+ and = fbAnd(alu, bits, pm);
+ xor = fbXor(alu, bits, pm);
+
+ if (startmask) {
+ FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
+ dst++;
+ }
+ n = nmiddle;
+ if (!and)
+ while (n--)
+ WRITE(dst++, xor);
+ else
+ while (n--) {
+ WRITE(dst, FbDoRRop(READ(dst), and, xor));
+ dst++;
+ }
+ if (endmask)
+ FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
+ dst += dstStride;
}
}
-
-void
-fbOddTile(FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
- FbBits *tile,
- FbStride tileStride,
- int tileWidth,
- int tileHeight,
-
- int alu,
- FbBits pm,
- int bpp,
-
- int xRot,
- int yRot)
+void
+fbOddTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileWidth,
+ int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot)
{
- int tileX, tileY;
- int widthTmp;
- int h, w;
- int x, y;
+ int tileX, tileY;
+ int widthTmp;
+ int h, w;
+ int x, y;
- modulus (- yRot, tileHeight, tileY);
+ modulus(-yRot, tileHeight, tileY);
y = 0;
- while (height)
- {
- h = tileHeight - tileY;
- if (h > height)
- h = height;
- height -= h;
- widthTmp = width;
- x = dstX;
- modulus (dstX - xRot, tileWidth, tileX);
- while (widthTmp)
- {
- w = tileWidth - tileX;
- if (w > widthTmp)
- w = widthTmp;
- widthTmp -= w;
- fbBlt (tile + tileY * tileStride,
- tileStride,
- tileX,
-
- dst + y * dstStride,
- dstStride,
- x,
-
- w, h,
- alu,
- pm,
- bpp,
-
- FALSE,
- FALSE);
- x += w;
- tileX = 0;
- }
- y += h;
- tileY = 0;
+ while (height) {
+ h = tileHeight - tileY;
+ if (h > height)
+ h = height;
+ height -= h;
+ widthTmp = width;
+ x = dstX;
+ modulus(dstX - xRot, tileWidth, tileX);
+ while (widthTmp) {
+ w = tileWidth - tileX;
+ if (w > widthTmp)
+ w = widthTmp;
+ widthTmp -= w;
+ fbBlt(tile + tileY * tileStride,
+ tileStride,
+ tileX,
+ dst + y * dstStride,
+ dstStride, x, w, h, alu, pm, bpp, FALSE, FALSE);
+ x += w;
+ tileX = 0;
+ }
+ y += h;
+ tileY = 0;
}
}
void
-fbTile (FbBits *dst,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- FbBits *tile,
- FbStride tileStride,
- int tileWidth,
- int tileHeight,
-
- int alu,
- FbBits pm,
- int bpp,
-
- int xRot,
- int yRot)
+fbTile(FbBits * dst,
+ FbStride dstStride,
+ int dstX,
+ int width,
+ int height,
+ FbBits * tile,
+ FbStride tileStride,
+ int tileWidth,
+ int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot)
{
- if (FbEvenTile (tileWidth))
- fbEvenTile (dst, dstStride, dstX, width, height,
- tile, tileStride, tileHeight,
- alu, pm, xRot, yRot);
+ if (FbEvenTile(tileWidth))
+ fbEvenTile(dst, dstStride, dstX, width, height,
+ tile, tileStride, tileHeight, alu, pm, xRot, yRot);
else
- fbOddTile (dst, dstStride, dstX, width, height,
- tile, tileStride, tileWidth, tileHeight,
- alu, pm, bpp, xRot, yRot);
+ fbOddTile(dst, dstStride, dstX, width, height,
+ tile, tileStride, tileWidth, tileHeight,
+ alu, pm, bpp, xRot, yRot);
}
diff --git a/xorg-server/fb/fbtrap.c b/xorg-server/fb/fbtrap.c
index 0b5a6382e..bf82f8f2c 100644
--- a/xorg-server/fb/fbtrap.c
+++ b/xorg-server/fb/fbtrap.c
@@ -32,184 +32,154 @@
#include "damage.h"
void
-fbAddTraps (PicturePtr pPicture,
- INT16 x_off,
- INT16 y_off,
- int ntrap,
- xTrap *traps)
+fbAddTraps(PicturePtr pPicture,
+ INT16 x_off, INT16 y_off, int ntrap, xTrap * traps)
{
pixman_image_t *image;
int dst_xoff, dst_yoff;
- if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
- return;
-
- pixman_add_traps (image, x_off + dst_xoff, y_off + dst_yoff,
- ntrap, (pixman_trap_t *)traps);
+ if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ return;
- free_pixman_pict (pPicture, image);
+ pixman_add_traps(image, x_off + dst_xoff, y_off + dst_yoff,
+ ntrap, (pixman_trap_t *) traps);
+
+ free_pixman_pict(pPicture, image);
}
void
-fbRasterizeTrapezoid (PicturePtr pPicture,
- xTrapezoid *trap,
- int x_off,
- int y_off)
+fbRasterizeTrapezoid(PicturePtr pPicture,
+ xTrapezoid * trap, int x_off, int y_off)
{
pixman_image_t *image;
- int dst_xoff, dst_yoff;
+ int dst_xoff, dst_yoff;
- if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
- return;
+ if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ return;
- pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap,
- x_off + dst_xoff,
- y_off + dst_yoff);
+ pixman_rasterize_trapezoid(image, (pixman_trapezoid_t *) trap,
+ x_off + dst_xoff, y_off + dst_yoff);
- free_pixman_pict (pPicture, image);
+ free_pixman_pict(pPicture, image);
}
void
-fbAddTriangles (PicturePtr pPicture,
- INT16 x_off,
- INT16 y_off,
- int ntri,
- xTriangle *tris)
+fbAddTriangles(PicturePtr pPicture,
+ INT16 x_off, INT16 y_off, int ntri, xTriangle * tris)
{
pixman_image_t *image;
int dst_xoff, dst_yoff;
- if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
- return;
-
- pixman_add_triangles (image,
- dst_xoff + x_off, dst_yoff + y_off,
- ntri, (pixman_triangle_t *)tris);
+ if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ return;
+
+ pixman_add_triangles(image,
+ dst_xoff + x_off, dst_yoff + y_off,
+ ntri, (pixman_triangle_t *) tris);
- free_pixman_pict (pPicture, image);
+ free_pixman_pict(pPicture, image);
}
-typedef void (* CompositeShapesFunc) (pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *dst,
- pixman_format_code_t mask_format,
- int x_src, int y_src,
- int x_dst, int y_dst,
- int n_shapes, const uint8_t *shapes);
+typedef void (*CompositeShapesFunc) (pixman_op_t op,
+ pixman_image_t * src,
+ pixman_image_t * dst,
+ pixman_format_code_t mask_format,
+ int x_src, int y_src,
+ int x_dst, int y_dst,
+ int n_shapes, const uint8_t * shapes);
static void
-fbShapes (CompositeShapesFunc composite,
- pixman_op_t op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- int16_t xSrc,
- int16_t ySrc,
- int nshapes,
- int shape_size,
- const uint8_t * shapes)
+fbShapes(CompositeShapesFunc composite,
+ pixman_op_t op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ int16_t xSrc,
+ int16_t ySrc, int nshapes, int shape_size, const uint8_t * shapes)
{
pixman_image_t *src, *dst;
int src_xoff, src_yoff;
int dst_xoff, dst_yoff;
- miCompositeSourceValidate (pSrc);
-
- src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
- dst = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
-
- if (src && dst)
- {
- pixman_format_code_t format;
-
- DamageRegionAppend (pDst->pDrawable, pDst->pCompositeClip);
-
- if (!maskFormat)
- {
- int i;
-
- if (pDst->polyEdge == PolyEdgeSharp)
- format = PIXMAN_a1;
- else
- format = PIXMAN_a8;
-
- for (i = 0; i < nshapes; ++i)
- {
- composite (op, src, dst, format,
- xSrc + src_xoff,
- ySrc + src_yoff,
- dst_xoff,
- dst_yoff,
- 1, shapes + i * shape_size);
- }
- }
- else
- {
- switch (PICT_FORMAT_A (maskFormat->format))
- {
- case 1:
- format = PIXMAN_a1;
- break;
-
- case 4:
- format = PIXMAN_a4;
- break;
-
- default:
- case 8:
- format = PIXMAN_a8;
- break;
- }
-
- composite (op, src, dst, format,
- xSrc + src_xoff,
- ySrc + src_yoff,
- dst_xoff,
- dst_yoff,
- nshapes, shapes);
- }
-
- DamageRegionProcessPending (pDst->pDrawable);
+ miCompositeSourceValidate(pSrc);
+
+ src = image_from_pict(pSrc, FALSE, &src_xoff, &src_yoff);
+ dst = image_from_pict(pDst, TRUE, &dst_xoff, &dst_yoff);
+
+ if (src && dst) {
+ pixman_format_code_t format;
+
+ DamageRegionAppend(pDst->pDrawable, pDst->pCompositeClip);
+
+ if (!maskFormat) {
+ int i;
+
+ if (pDst->polyEdge == PolyEdgeSharp)
+ format = PIXMAN_a1;
+ else
+ format = PIXMAN_a8;
+
+ for (i = 0; i < nshapes; ++i) {
+ composite(op, src, dst, format,
+ xSrc + src_xoff,
+ ySrc + src_yoff,
+ dst_xoff, dst_yoff, 1, shapes + i * shape_size);
+ }
+ }
+ else {
+ switch (PICT_FORMAT_A(maskFormat->format)) {
+ case 1:
+ format = PIXMAN_a1;
+ break;
+
+ case 4:
+ format = PIXMAN_a4;
+ break;
+
+ default:
+ case 8:
+ format = PIXMAN_a8;
+ break;
+ }
+
+ composite(op, src, dst, format,
+ xSrc + src_xoff,
+ ySrc + src_yoff, dst_xoff, dst_yoff, nshapes, shapes);
+ }
+
+ DamageRegionProcessPending(pDst->pDrawable);
}
- free_pixman_pict (pSrc, src);
- free_pixman_pict (pDst, dst);
+ free_pixman_pict(pSrc, src);
+ free_pixman_pict(pDst, dst);
}
void
-fbTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps)
+fbTrapezoids(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps)
{
xSrc -= (traps[0].left.p1.x >> 16);
ySrc -= (traps[0].left.p1.y >> 16);
-
- fbShapes ((CompositeShapesFunc)pixman_composite_trapezoids,
- op, pSrc, pDst, maskFormat,
- xSrc, ySrc,
- ntrap, sizeof (xTrapezoid), (const uint8_t *)traps);
+
+ fbShapes((CompositeShapesFunc) pixman_composite_trapezoids,
+ op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, ntrap, sizeof(xTrapezoid), (const uint8_t *) traps);
}
void
-fbTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntris,
- xTriangle *tris)
-{
+fbTriangles(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris)
+{
xSrc -= (tris[0].p1.x >> 16);
ySrc -= (tris[0].p1.y >> 16);
-
- fbShapes ((CompositeShapesFunc)pixman_composite_triangles,
- op, pSrc, pDst, maskFormat,
- xSrc, ySrc,
- ntris, sizeof (xTriangle), (const uint8_t *)tris);
+
+ fbShapes((CompositeShapesFunc) pixman_composite_triangles,
+ op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, ntris, sizeof(xTriangle), (const uint8_t *) tris);
}
diff --git a/xorg-server/fb/fbutil.c b/xorg-server/fb/fbutil.c
index 5e232971e..2ca80d1c9 100644
--- a/xorg-server/fb/fbutil.c
+++ b/xorg-server/fb/fbutil.c
@@ -27,91 +27,89 @@
#include "fb.h"
FbBits
-fbReplicatePixel (Pixel p, int bpp)
+fbReplicatePixel(Pixel p, int bpp)
{
- FbBits b = p;
-
- b &= FbFullMask (bpp);
- while (bpp < FB_UNIT)
- {
- b |= b << bpp;
- bpp <<= 1;
+ FbBits b = p;
+
+ b &= FbFullMask(bpp);
+ while (bpp < FB_UNIT) {
+ b |= b << bpp;
+ bpp <<= 1;
}
return b;
}
void
-fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp)
+fbReduceRasterOp(int rop, FbBits fg, FbBits pm, FbBits * andp, FbBits * xorp)
{
- FbBits and, xor;
+ FbBits and, xor;
- switch (rop)
- {
+ switch (rop) {
default:
- case GXclear: /* 0 0 0 0 */
- and = 0;
- xor = 0;
- break;
- case GXand: /* 0 0 0 1 */
- and = fg;
- xor = 0;
- break;
- case GXandReverse: /* 0 0 1 0 */
- and = fg;
- xor = fg;
- break;
- case GXcopy: /* 0 0 1 1 */
- and = 0;
- xor = fg;
- break;
- case GXandInverted: /* 0 1 0 0 */
- and = ~fg;
- xor = 0;
- break;
- case GXnoop: /* 0 1 0 1 */
- and = FB_ALLONES;
- xor = 0;
- break;
- case GXxor: /* 0 1 1 0 */
- and = FB_ALLONES;
- xor = fg;
- break;
- case GXor: /* 0 1 1 1 */
- and = ~fg;
- xor = fg;
- break;
- case GXnor: /* 1 0 0 0 */
- and = ~fg;
- xor = ~fg;
- break;
- case GXequiv: /* 1 0 0 1 */
- and = FB_ALLONES;
- xor = ~fg;
- break;
- case GXinvert: /* 1 0 1 0 */
- and = FB_ALLONES;
- xor = FB_ALLONES;
- break;
- case GXorReverse: /* 1 0 1 1 */
- and = ~fg;
- xor = FB_ALLONES;
- break;
- case GXcopyInverted: /* 1 1 0 0 */
- and = 0;
- xor = ~fg;
- break;
- case GXorInverted: /* 1 1 0 1 */
- and = fg;
- xor = ~fg;
- break;
- case GXnand: /* 1 1 1 0 */
- and = fg;
- xor = FB_ALLONES;
- break;
- case GXset: /* 1 1 1 1 */
- and = 0;
- xor = FB_ALLONES;
- break;
+ case GXclear: /* 0 0 0 0 */
+ and = 0;
+ xor = 0;
+ break;
+ case GXand: /* 0 0 0 1 */
+ and = fg;
+ xor = 0;
+ break;
+ case GXandReverse: /* 0 0 1 0 */
+ and = fg;
+ xor = fg;
+ break;
+ case GXcopy: /* 0 0 1 1 */
+ and = 0;
+ xor = fg;
+ break;
+ case GXandInverted: /* 0 1 0 0 */
+ and = ~fg;
+ xor = 0;
+ break;
+ case GXnoop: /* 0 1 0 1 */
+ and = FB_ALLONES;
+ xor = 0;
+ break;
+ case GXxor: /* 0 1 1 0 */
+ and = FB_ALLONES;
+ xor = fg;
+ break;
+ case GXor: /* 0 1 1 1 */
+ and = ~fg;
+ xor = fg;
+ break;
+ case GXnor: /* 1 0 0 0 */
+ and = ~fg;
+ xor = ~fg;
+ break;
+ case GXequiv: /* 1 0 0 1 */
+ and = FB_ALLONES;
+ xor = ~fg;
+ break;
+ case GXinvert: /* 1 0 1 0 */
+ and = FB_ALLONES;
+ xor = FB_ALLONES;
+ break;
+ case GXorReverse: /* 1 0 1 1 */
+ and = ~fg;
+ xor = FB_ALLONES;
+ break;
+ case GXcopyInverted: /* 1 1 0 0 */
+ and = 0;
+ xor = ~fg;
+ break;
+ case GXorInverted: /* 1 1 0 1 */
+ and = fg;
+ xor = ~fg;
+ break;
+ case GXnand: /* 1 1 1 0 */
+ and = fg;
+ xor = FB_ALLONES;
+ break;
+ case GXset: /* 1 1 1 1 */
+ and = 0;
+ xor = FB_ALLONES;
+ break;
}
and |= ~pm;
xor &= pm;
@@ -123,22 +121,22 @@ fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp)
#define I FB_ALLONES
const FbMergeRopRec FbMergeRopBits[16] = {
- { O,O,O,O }, /* clear 0x0 0 */
- { I,O,O,O }, /* and 0x1 src AND dst */
- { I,O,I,O }, /* andReverse 0x2 src AND NOT dst */
- { O,O,I,O }, /* copy 0x3 src */
- { I,I,O,O }, /* andInverted 0x4 NOT src AND dst */
- { O,I,O,O }, /* noop 0x5 dst */
- { O,I,I,O }, /* xor 0x6 src XOR dst */
- { I,I,I,O }, /* or 0x7 src OR dst */
- { I,I,I,I }, /* nor 0x8 NOT src AND NOT dst */
- { O,I,I,I }, /* equiv 0x9 NOT src XOR dst */
- { O,I,O,I }, /* invert 0xa NOT dst */
- { I,I,O,I }, /* orReverse 0xb src OR NOT dst */
- { O,O,I,I }, /* copyInverted 0xc NOT src */
- { I,O,I,I }, /* orInverted 0xd NOT src OR dst */
- { I,O,O,I }, /* nand 0xe NOT src OR NOT dst */
- { O,O,O,I }, /* set 0xf 1 */
+ {O, O, O, O}, /* clear 0x0 0 */
+ {I, O, O, O}, /* and 0x1 src AND dst */
+ {I, O, I, O}, /* andReverse 0x2 src AND NOT dst */
+ {O, O, I, O}, /* copy 0x3 src */
+ {I, I, O, O}, /* andInverted 0x4 NOT src AND dst */
+ {O, I, O, O}, /* noop 0x5 dst */
+ {O, I, I, O}, /* xor 0x6 src XOR dst */
+ {I, I, I, O}, /* or 0x7 src OR dst */
+ {I, I, I, I}, /* nor 0x8 NOT src AND NOT dst */
+ {O, I, I, I}, /* equiv 0x9 NOT src XOR dst */
+ {O, I, O, I}, /* invert 0xa NOT dst */
+ {I, I, O, I}, /* orReverse 0xb src OR NOT dst */
+ {O, O, I, I}, /* copyInverted 0xc NOT src */
+ {I, O, I, I}, /* orInverted 0xd NOT src OR dst */
+ {I, O, O, I}, /* nand 0xe NOT src OR NOT dst */
+ {O, O, O, I}, /* set 0xf 1 */
};
/*
@@ -151,7 +149,6 @@ const FbMergeRopRec FbMergeRopBits[16] = {
#define Mask(x,w) BitsMask((x)*(w),(w))
-
#define SelMask(b,n,w) ((((b) >> n) & 1) * Mask(n,w))
#define C1(b,w) \
@@ -181,175 +178,187 @@ const FbMergeRopRec FbMergeRopBits[16] = {
#define fbStipple16Bits 0
#define fbStipple8Bits 0
const FbBits fbStipple4Bits[16] = {
- C4( 0,4), C4( 1,4), C4( 2,4), C4( 3,4), C4( 4,4), C4( 5,4),
- C4( 6,4), C4( 7,4), C4( 8,4), C4( 9,4), C4( 10,4), C4( 11,4),
- C4( 12,4), C4( 13,4), C4( 14,4), C4( 15,4),};
+ C4(0, 4), C4(1, 4), C4(2, 4), C4(3, 4), C4(4, 4), C4(5, 4),
+ C4(6, 4), C4(7, 4), C4(8, 4), C4(9, 4), C4(10, 4), C4(11, 4),
+ C4(12, 4), C4(13, 4), C4(14, 4), C4(15, 4),
+};
+
const FbBits fbStipple2Bits[4] = {
- C2( 0,8), C2( 1,8), C2( 2,8), C2( 3,8),
+ C2(0, 8), C2(1, 8), C2(2, 8), C2(3, 8),
};
+
const FbBits fbStipple1Bits[2] = {
- C1( 0,16), C1( 1,16),
+ C1(0, 16), C1(1, 16),
};
#endif
#if FB_UNIT == 32
#define fbStipple16Bits 0
const FbBits fbStipple8Bits[256] = {
- C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4),
- C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4),
- C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4),
- C8( 18,4), C8( 19,4), C8( 20,4), C8( 21,4), C8( 22,4), C8( 23,4),
- C8( 24,4), C8( 25,4), C8( 26,4), C8( 27,4), C8( 28,4), C8( 29,4),
- C8( 30,4), C8( 31,4), C8( 32,4), C8( 33,4), C8( 34,4), C8( 35,4),
- C8( 36,4), C8( 37,4), C8( 38,4), C8( 39,4), C8( 40,4), C8( 41,4),
- C8( 42,4), C8( 43,4), C8( 44,4), C8( 45,4), C8( 46,4), C8( 47,4),
- C8( 48,4), C8( 49,4), C8( 50,4), C8( 51,4), C8( 52,4), C8( 53,4),
- C8( 54,4), C8( 55,4), C8( 56,4), C8( 57,4), C8( 58,4), C8( 59,4),
- C8( 60,4), C8( 61,4), C8( 62,4), C8( 63,4), C8( 64,4), C8( 65,4),
- C8( 66,4), C8( 67,4), C8( 68,4), C8( 69,4), C8( 70,4), C8( 71,4),
- C8( 72,4), C8( 73,4), C8( 74,4), C8( 75,4), C8( 76,4), C8( 77,4),
- C8( 78,4), C8( 79,4), C8( 80,4), C8( 81,4), C8( 82,4), C8( 83,4),
- C8( 84,4), C8( 85,4), C8( 86,4), C8( 87,4), C8( 88,4), C8( 89,4),
- C8( 90,4), C8( 91,4), C8( 92,4), C8( 93,4), C8( 94,4), C8( 95,4),
- C8( 96,4), C8( 97,4), C8( 98,4), C8( 99,4), C8(100,4), C8(101,4),
- C8(102,4), C8(103,4), C8(104,4), C8(105,4), C8(106,4), C8(107,4),
- C8(108,4), C8(109,4), C8(110,4), C8(111,4), C8(112,4), C8(113,4),
- C8(114,4), C8(115,4), C8(116,4), C8(117,4), C8(118,4), C8(119,4),
- C8(120,4), C8(121,4), C8(122,4), C8(123,4), C8(124,4), C8(125,4),
- C8(126,4), C8(127,4), C8(128,4), C8(129,4), C8(130,4), C8(131,4),
- C8(132,4), C8(133,4), C8(134,4), C8(135,4), C8(136,4), C8(137,4),
- C8(138,4), C8(139,4), C8(140,4), C8(141,4), C8(142,4), C8(143,4),
- C8(144,4), C8(145,4), C8(146,4), C8(147,4), C8(148,4), C8(149,4),
- C8(150,4), C8(151,4), C8(152,4), C8(153,4), C8(154,4), C8(155,4),
- C8(156,4), C8(157,4), C8(158,4), C8(159,4), C8(160,4), C8(161,4),
- C8(162,4), C8(163,4), C8(164,4), C8(165,4), C8(166,4), C8(167,4),
- C8(168,4), C8(169,4), C8(170,4), C8(171,4), C8(172,4), C8(173,4),
- C8(174,4), C8(175,4), C8(176,4), C8(177,4), C8(178,4), C8(179,4),
- C8(180,4), C8(181,4), C8(182,4), C8(183,4), C8(184,4), C8(185,4),
- C8(186,4), C8(187,4), C8(188,4), C8(189,4), C8(190,4), C8(191,4),
- C8(192,4), C8(193,4), C8(194,4), C8(195,4), C8(196,4), C8(197,4),
- C8(198,4), C8(199,4), C8(200,4), C8(201,4), C8(202,4), C8(203,4),
- C8(204,4), C8(205,4), C8(206,4), C8(207,4), C8(208,4), C8(209,4),
- C8(210,4), C8(211,4), C8(212,4), C8(213,4), C8(214,4), C8(215,4),
- C8(216,4), C8(217,4), C8(218,4), C8(219,4), C8(220,4), C8(221,4),
- C8(222,4), C8(223,4), C8(224,4), C8(225,4), C8(226,4), C8(227,4),
- C8(228,4), C8(229,4), C8(230,4), C8(231,4), C8(232,4), C8(233,4),
- C8(234,4), C8(235,4), C8(236,4), C8(237,4), C8(238,4), C8(239,4),
- C8(240,4), C8(241,4), C8(242,4), C8(243,4), C8(244,4), C8(245,4),
- C8(246,4), C8(247,4), C8(248,4), C8(249,4), C8(250,4), C8(251,4),
- C8(252,4), C8(253,4), C8(254,4), C8(255,4),
+ C8(0, 4), C8(1, 4), C8(2, 4), C8(3, 4), C8(4, 4), C8(5, 4),
+ C8(6, 4), C8(7, 4), C8(8, 4), C8(9, 4), C8(10, 4), C8(11, 4),
+ C8(12, 4), C8(13, 4), C8(14, 4), C8(15, 4), C8(16, 4), C8(17, 4),
+ C8(18, 4), C8(19, 4), C8(20, 4), C8(21, 4), C8(22, 4), C8(23, 4),
+ C8(24, 4), C8(25, 4), C8(26, 4), C8(27, 4), C8(28, 4), C8(29, 4),
+ C8(30, 4), C8(31, 4), C8(32, 4), C8(33, 4), C8(34, 4), C8(35, 4),
+ C8(36, 4), C8(37, 4), C8(38, 4), C8(39, 4), C8(40, 4), C8(41, 4),
+ C8(42, 4), C8(43, 4), C8(44, 4), C8(45, 4), C8(46, 4), C8(47, 4),
+ C8(48, 4), C8(49, 4), C8(50, 4), C8(51, 4), C8(52, 4), C8(53, 4),
+ C8(54, 4), C8(55, 4), C8(56, 4), C8(57, 4), C8(58, 4), C8(59, 4),
+ C8(60, 4), C8(61, 4), C8(62, 4), C8(63, 4), C8(64, 4), C8(65, 4),
+ C8(66, 4), C8(67, 4), C8(68, 4), C8(69, 4), C8(70, 4), C8(71, 4),
+ C8(72, 4), C8(73, 4), C8(74, 4), C8(75, 4), C8(76, 4), C8(77, 4),
+ C8(78, 4), C8(79, 4), C8(80, 4), C8(81, 4), C8(82, 4), C8(83, 4),
+ C8(84, 4), C8(85, 4), C8(86, 4), C8(87, 4), C8(88, 4), C8(89, 4),
+ C8(90, 4), C8(91, 4), C8(92, 4), C8(93, 4), C8(94, 4), C8(95, 4),
+ C8(96, 4), C8(97, 4), C8(98, 4), C8(99, 4), C8(100, 4), C8(101, 4),
+ C8(102, 4), C8(103, 4), C8(104, 4), C8(105, 4), C8(106, 4), C8(107, 4),
+ C8(108, 4), C8(109, 4), C8(110, 4), C8(111, 4), C8(112, 4), C8(113, 4),
+ C8(114, 4), C8(115, 4), C8(116, 4), C8(117, 4), C8(118, 4), C8(119, 4),
+ C8(120, 4), C8(121, 4), C8(122, 4), C8(123, 4), C8(124, 4), C8(125, 4),
+ C8(126, 4), C8(127, 4), C8(128, 4), C8(129, 4), C8(130, 4), C8(131, 4),
+ C8(132, 4), C8(133, 4), C8(134, 4), C8(135, 4), C8(136, 4), C8(137, 4),
+ C8(138, 4), C8(139, 4), C8(140, 4), C8(141, 4), C8(142, 4), C8(143, 4),
+ C8(144, 4), C8(145, 4), C8(146, 4), C8(147, 4), C8(148, 4), C8(149, 4),
+ C8(150, 4), C8(151, 4), C8(152, 4), C8(153, 4), C8(154, 4), C8(155, 4),
+ C8(156, 4), C8(157, 4), C8(158, 4), C8(159, 4), C8(160, 4), C8(161, 4),
+ C8(162, 4), C8(163, 4), C8(164, 4), C8(165, 4), C8(166, 4), C8(167, 4),
+ C8(168, 4), C8(169, 4), C8(170, 4), C8(171, 4), C8(172, 4), C8(173, 4),
+ C8(174, 4), C8(175, 4), C8(176, 4), C8(177, 4), C8(178, 4), C8(179, 4),
+ C8(180, 4), C8(181, 4), C8(182, 4), C8(183, 4), C8(184, 4), C8(185, 4),
+ C8(186, 4), C8(187, 4), C8(188, 4), C8(189, 4), C8(190, 4), C8(191, 4),
+ C8(192, 4), C8(193, 4), C8(194, 4), C8(195, 4), C8(196, 4), C8(197, 4),
+ C8(198, 4), C8(199, 4), C8(200, 4), C8(201, 4), C8(202, 4), C8(203, 4),
+ C8(204, 4), C8(205, 4), C8(206, 4), C8(207, 4), C8(208, 4), C8(209, 4),
+ C8(210, 4), C8(211, 4), C8(212, 4), C8(213, 4), C8(214, 4), C8(215, 4),
+ C8(216, 4), C8(217, 4), C8(218, 4), C8(219, 4), C8(220, 4), C8(221, 4),
+ C8(222, 4), C8(223, 4), C8(224, 4), C8(225, 4), C8(226, 4), C8(227, 4),
+ C8(228, 4), C8(229, 4), C8(230, 4), C8(231, 4), C8(232, 4), C8(233, 4),
+ C8(234, 4), C8(235, 4), C8(236, 4), C8(237, 4), C8(238, 4), C8(239, 4),
+ C8(240, 4), C8(241, 4), C8(242, 4), C8(243, 4), C8(244, 4), C8(245, 4),
+ C8(246, 4), C8(247, 4), C8(248, 4), C8(249, 4), C8(250, 4), C8(251, 4),
+ C8(252, 4), C8(253, 4), C8(254, 4), C8(255, 4),
};
+
const FbBits fbStipple4Bits[16] = {
- C4( 0,8), C4( 1,8), C4( 2,8), C4( 3,8), C4( 4,8), C4( 5,8),
- C4( 6,8), C4( 7,8), C4( 8,8), C4( 9,8), C4( 10,8), C4( 11,8),
- C4( 12,8), C4( 13,8), C4( 14,8), C4( 15,8),};
+ C4(0, 8), C4(1, 8), C4(2, 8), C4(3, 8), C4(4, 8), C4(5, 8),
+ C4(6, 8), C4(7, 8), C4(8, 8), C4(9, 8), C4(10, 8), C4(11, 8),
+ C4(12, 8), C4(13, 8), C4(14, 8), C4(15, 8),
+};
+
const FbBits fbStipple2Bits[4] = {
- C2( 0,16), C2( 1,16), C2( 2,16), C2( 3,16),
+ C2(0, 16), C2(1, 16), C2(2, 16), C2(3, 16),
};
+
const FbBits fbStipple1Bits[2] = {
- C1( 0,32), C1( 1,32),
+ C1(0, 32), C1(1, 32),
};
#endif
#if FB_UNIT == 64
const FbBits fbStipple16Bits[256] = {
- C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4),
- C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4),
- C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4),
- C8( 18,4), C8( 19,4), C8( 20,4), C8( 21,4), C8( 22,4), C8( 23,4),
- C8( 24,4), C8( 25,4), C8( 26,4), C8( 27,4), C8( 28,4), C8( 29,4),
- C8( 30,4), C8( 31,4), C8( 32,4), C8( 33,4), C8( 34,4), C8( 35,4),
- C8( 36,4), C8( 37,4), C8( 38,4), C8( 39,4), C8( 40,4), C8( 41,4),
- C8( 42,4), C8( 43,4), C8( 44,4), C8( 45,4), C8( 46,4), C8( 47,4),
- C8( 48,4), C8( 49,4), C8( 50,4), C8( 51,4), C8( 52,4), C8( 53,4),
- C8( 54,4), C8( 55,4), C8( 56,4), C8( 57,4), C8( 58,4), C8( 59,4),
- C8( 60,4), C8( 61,4), C8( 62,4), C8( 63,4), C8( 64,4), C8( 65,4),
- C8( 66,4), C8( 67,4), C8( 68,4), C8( 69,4), C8( 70,4), C8( 71,4),
- C8( 72,4), C8( 73,4), C8( 74,4), C8( 75,4), C8( 76,4), C8( 77,4),
- C8( 78,4), C8( 79,4), C8( 80,4), C8( 81,4), C8( 82,4), C8( 83,4),
- C8( 84,4), C8( 85,4), C8( 86,4), C8( 87,4), C8( 88,4), C8( 89,4),
- C8( 90,4), C8( 91,4), C8( 92,4), C8( 93,4), C8( 94,4), C8( 95,4),
- C8( 96,4), C8( 97,4), C8( 98,4), C8( 99,4), C8(100,4), C8(101,4),
- C8(102,4), C8(103,4), C8(104,4), C8(105,4), C8(106,4), C8(107,4),
- C8(108,4), C8(109,4), C8(110,4), C8(111,4), C8(112,4), C8(113,4),
- C8(114,4), C8(115,4), C8(116,4), C8(117,4), C8(118,4), C8(119,4),
- C8(120,4), C8(121,4), C8(122,4), C8(123,4), C8(124,4), C8(125,4),
- C8(126,4), C8(127,4), C8(128,4), C8(129,4), C8(130,4), C8(131,4),
- C8(132,4), C8(133,4), C8(134,4), C8(135,4), C8(136,4), C8(137,4),
- C8(138,4), C8(139,4), C8(140,4), C8(141,4), C8(142,4), C8(143,4),
- C8(144,4), C8(145,4), C8(146,4), C8(147,4), C8(148,4), C8(149,4),
- C8(150,4), C8(151,4), C8(152,4), C8(153,4), C8(154,4), C8(155,4),
- C8(156,4), C8(157,4), C8(158,4), C8(159,4), C8(160,4), C8(161,4),
- C8(162,4), C8(163,4), C8(164,4), C8(165,4), C8(166,4), C8(167,4),
- C8(168,4), C8(169,4), C8(170,4), C8(171,4), C8(172,4), C8(173,4),
- C8(174,4), C8(175,4), C8(176,4), C8(177,4), C8(178,4), C8(179,4),
- C8(180,4), C8(181,4), C8(182,4), C8(183,4), C8(184,4), C8(185,4),
- C8(186,4), C8(187,4), C8(188,4), C8(189,4), C8(190,4), C8(191,4),
- C8(192,4), C8(193,4), C8(194,4), C8(195,4), C8(196,4), C8(197,4),
- C8(198,4), C8(199,4), C8(200,4), C8(201,4), C8(202,4), C8(203,4),
- C8(204,4), C8(205,4), C8(206,4), C8(207,4), C8(208,4), C8(209,4),
- C8(210,4), C8(211,4), C8(212,4), C8(213,4), C8(214,4), C8(215,4),
- C8(216,4), C8(217,4), C8(218,4), C8(219,4), C8(220,4), C8(221,4),
- C8(222,4), C8(223,4), C8(224,4), C8(225,4), C8(226,4), C8(227,4),
- C8(228,4), C8(229,4), C8(230,4), C8(231,4), C8(232,4), C8(233,4),
- C8(234,4), C8(235,4), C8(236,4), C8(237,4), C8(238,4), C8(239,4),
- C8(240,4), C8(241,4), C8(242,4), C8(243,4), C8(244,4), C8(245,4),
- C8(246,4), C8(247,4), C8(248,4), C8(249,4), C8(250,4), C8(251,4),
- C8(252,4), C8(253,4), C8(254,4), C8(255,4),
+ C8(0, 4), C8(1, 4), C8(2, 4), C8(3, 4), C8(4, 4), C8(5, 4),
+ C8(6, 4), C8(7, 4), C8(8, 4), C8(9, 4), C8(10, 4), C8(11, 4),
+ C8(12, 4), C8(13, 4), C8(14, 4), C8(15, 4), C8(16, 4), C8(17, 4),
+ C8(18, 4), C8(19, 4), C8(20, 4), C8(21, 4), C8(22, 4), C8(23, 4),
+ C8(24, 4), C8(25, 4), C8(26, 4), C8(27, 4), C8(28, 4), C8(29, 4),
+ C8(30, 4), C8(31, 4), C8(32, 4), C8(33, 4), C8(34, 4), C8(35, 4),
+ C8(36, 4), C8(37, 4), C8(38, 4), C8(39, 4), C8(40, 4), C8(41, 4),
+ C8(42, 4), C8(43, 4), C8(44, 4), C8(45, 4), C8(46, 4), C8(47, 4),
+ C8(48, 4), C8(49, 4), C8(50, 4), C8(51, 4), C8(52, 4), C8(53, 4),
+ C8(54, 4), C8(55, 4), C8(56, 4), C8(57, 4), C8(58, 4), C8(59, 4),
+ C8(60, 4), C8(61, 4), C8(62, 4), C8(63, 4), C8(64, 4), C8(65, 4),
+ C8(66, 4), C8(67, 4), C8(68, 4), C8(69, 4), C8(70, 4), C8(71, 4),
+ C8(72, 4), C8(73, 4), C8(74, 4), C8(75, 4), C8(76, 4), C8(77, 4),
+ C8(78, 4), C8(79, 4), C8(80, 4), C8(81, 4), C8(82, 4), C8(83, 4),
+ C8(84, 4), C8(85, 4), C8(86, 4), C8(87, 4), C8(88, 4), C8(89, 4),
+ C8(90, 4), C8(91, 4), C8(92, 4), C8(93, 4), C8(94, 4), C8(95, 4),
+ C8(96, 4), C8(97, 4), C8(98, 4), C8(99, 4), C8(100, 4), C8(101, 4),
+ C8(102, 4), C8(103, 4), C8(104, 4), C8(105, 4), C8(106, 4), C8(107, 4),
+ C8(108, 4), C8(109, 4), C8(110, 4), C8(111, 4), C8(112, 4), C8(113, 4),
+ C8(114, 4), C8(115, 4), C8(116, 4), C8(117, 4), C8(118, 4), C8(119, 4),
+ C8(120, 4), C8(121, 4), C8(122, 4), C8(123, 4), C8(124, 4), C8(125, 4),
+ C8(126, 4), C8(127, 4), C8(128, 4), C8(129, 4), C8(130, 4), C8(131, 4),
+ C8(132, 4), C8(133, 4), C8(134, 4), C8(135, 4), C8(136, 4), C8(137, 4),
+ C8(138, 4), C8(139, 4), C8(140, 4), C8(141, 4), C8(142, 4), C8(143, 4),
+ C8(144, 4), C8(145, 4), C8(146, 4), C8(147, 4), C8(148, 4), C8(149, 4),
+ C8(150, 4), C8(151, 4), C8(152, 4), C8(153, 4), C8(154, 4), C8(155, 4),
+ C8(156, 4), C8(157, 4), C8(158, 4), C8(159, 4), C8(160, 4), C8(161, 4),
+ C8(162, 4), C8(163, 4), C8(164, 4), C8(165, 4), C8(166, 4), C8(167, 4),
+ C8(168, 4), C8(169, 4), C8(170, 4), C8(171, 4), C8(172, 4), C8(173, 4),
+ C8(174, 4), C8(175, 4), C8(176, 4), C8(177, 4), C8(178, 4), C8(179, 4),
+ C8(180, 4), C8(181, 4), C8(182, 4), C8(183, 4), C8(184, 4), C8(185, 4),
+ C8(186, 4), C8(187, 4), C8(188, 4), C8(189, 4), C8(190, 4), C8(191, 4),
+ C8(192, 4), C8(193, 4), C8(194, 4), C8(195, 4), C8(196, 4), C8(197, 4),
+ C8(198, 4), C8(199, 4), C8(200, 4), C8(201, 4), C8(202, 4), C8(203, 4),
+ C8(204, 4), C8(205, 4), C8(206, 4), C8(207, 4), C8(208, 4), C8(209, 4),
+ C8(210, 4), C8(211, 4), C8(212, 4), C8(213, 4), C8(214, 4), C8(215, 4),
+ C8(216, 4), C8(217, 4), C8(218, 4), C8(219, 4), C8(220, 4), C8(221, 4),
+ C8(222, 4), C8(223, 4), C8(224, 4), C8(225, 4), C8(226, 4), C8(227, 4),
+ C8(228, 4), C8(229, 4), C8(230, 4), C8(231, 4), C8(232, 4), C8(233, 4),
+ C8(234, 4), C8(235, 4), C8(236, 4), C8(237, 4), C8(238, 4), C8(239, 4),
+ C8(240, 4), C8(241, 4), C8(242, 4), C8(243, 4), C8(244, 4), C8(245, 4),
+ C8(246, 4), C8(247, 4), C8(248, 4), C8(249, 4), C8(250, 4), C8(251, 4),
+ C8(252, 4), C8(253, 4), C8(254, 4), C8(255, 4),
};
+
const FbBits fbStipple8Bits[256] = {
- C8( 0,8), C8( 1,8), C8( 2,8), C8( 3,8), C8( 4,8), C8( 5,8),
- C8( 6,8), C8( 7,8), C8( 8,8), C8( 9,8), C8( 10,8), C8( 11,8),
- C8( 12,8), C8( 13,8), C8( 14,8), C8( 15,8), C8( 16,8), C8( 17,8),
- C8( 18,8), C8( 19,8), C8( 20,8), C8( 21,8), C8( 22,8), C8( 23,8),
- C8( 24,8), C8( 25,8), C8( 26,8), C8( 27,8), C8( 28,8), C8( 29,8),
- C8( 30,8), C8( 31,8), C8( 32,8), C8( 33,8), C8( 34,8), C8( 35,8),
- C8( 36,8), C8( 37,8), C8( 38,8), C8( 39,8), C8( 40,8), C8( 41,8),
- C8( 42,8), C8( 43,8), C8( 44,8), C8( 45,8), C8( 46,8), C8( 47,8),
- C8( 48,8), C8( 49,8), C8( 50,8), C8( 51,8), C8( 52,8), C8( 53,8),
- C8( 54,8), C8( 55,8), C8( 56,8), C8( 57,8), C8( 58,8), C8( 59,8),
- C8( 60,8), C8( 61,8), C8( 62,8), C8( 63,8), C8( 64,8), C8( 65,8),
- C8( 66,8), C8( 67,8), C8( 68,8), C8( 69,8), C8( 70,8), C8( 71,8),
- C8( 72,8), C8( 73,8), C8( 74,8), C8( 75,8), C8( 76,8), C8( 77,8),
- C8( 78,8), C8( 79,8), C8( 80,8), C8( 81,8), C8( 82,8), C8( 83,8),
- C8( 84,8), C8( 85,8), C8( 86,8), C8( 87,8), C8( 88,8), C8( 89,8),
- C8( 90,8), C8( 91,8), C8( 92,8), C8( 93,8), C8( 94,8), C8( 95,8),
- C8( 96,8), C8( 97,8), C8( 98,8), C8( 99,8), C8(100,8), C8(101,8),
- C8(102,8), C8(103,8), C8(104,8), C8(105,8), C8(106,8), C8(107,8),
- C8(108,8), C8(109,8), C8(110,8), C8(111,8), C8(112,8), C8(113,8),
- C8(114,8), C8(115,8), C8(116,8), C8(117,8), C8(118,8), C8(119,8),
- C8(120,8), C8(121,8), C8(122,8), C8(123,8), C8(124,8), C8(125,8),
- C8(126,8), C8(127,8), C8(128,8), C8(129,8), C8(130,8), C8(131,8),
- C8(132,8), C8(133,8), C8(134,8), C8(135,8), C8(136,8), C8(137,8),
- C8(138,8), C8(139,8), C8(140,8), C8(141,8), C8(142,8), C8(143,8),
- C8(144,8), C8(145,8), C8(146,8), C8(147,8), C8(148,8), C8(149,8),
- C8(150,8), C8(151,8), C8(152,8), C8(153,8), C8(154,8), C8(155,8),
- C8(156,8), C8(157,8), C8(158,8), C8(159,8), C8(160,8), C8(161,8),
- C8(162,8), C8(163,8), C8(164,8), C8(165,8), C8(166,8), C8(167,8),
- C8(168,8), C8(169,8), C8(170,8), C8(171,8), C8(172,8), C8(173,8),
- C8(174,8), C8(175,8), C8(176,8), C8(177,8), C8(178,8), C8(179,8),
- C8(180,8), C8(181,8), C8(182,8), C8(183,8), C8(184,8), C8(185,8),
- C8(186,8), C8(187,8), C8(188,8), C8(189,8), C8(190,8), C8(191,8),
- C8(192,8), C8(193,8), C8(194,8), C8(195,8), C8(196,8), C8(197,8),
- C8(198,8), C8(199,8), C8(200,8), C8(201,8), C8(202,8), C8(203,8),
- C8(204,8), C8(205,8), C8(206,8), C8(207,8), C8(208,8), C8(209,8),
- C8(210,8), C8(211,8), C8(212,8), C8(213,8), C8(214,8), C8(215,8),
- C8(216,8), C8(217,8), C8(218,8), C8(219,8), C8(220,8), C8(221,8),
- C8(222,8), C8(223,8), C8(224,8), C8(225,8), C8(226,8), C8(227,8),
- C8(228,8), C8(229,8), C8(230,8), C8(231,8), C8(232,8), C8(233,8),
- C8(234,8), C8(235,8), C8(236,8), C8(237,8), C8(238,8), C8(239,8),
- C8(240,8), C8(241,8), C8(242,8), C8(243,8), C8(244,8), C8(245,8),
- C8(246,8), C8(247,8), C8(248,8), C8(249,8), C8(250,8), C8(251,8),
- C8(252,8), C8(253,8), C8(254,8), C8(255,8),
+ C8(0, 8), C8(1, 8), C8(2, 8), C8(3, 8), C8(4, 8), C8(5, 8),
+ C8(6, 8), C8(7, 8), C8(8, 8), C8(9, 8), C8(10, 8), C8(11, 8),
+ C8(12, 8), C8(13, 8), C8(14, 8), C8(15, 8), C8(16, 8), C8(17, 8),
+ C8(18, 8), C8(19, 8), C8(20, 8), C8(21, 8), C8(22, 8), C8(23, 8),
+ C8(24, 8), C8(25, 8), C8(26, 8), C8(27, 8), C8(28, 8), C8(29, 8),
+ C8(30, 8), C8(31, 8), C8(32, 8), C8(33, 8), C8(34, 8), C8(35, 8),
+ C8(36, 8), C8(37, 8), C8(38, 8), C8(39, 8), C8(40, 8), C8(41, 8),
+ C8(42, 8), C8(43, 8), C8(44, 8), C8(45, 8), C8(46, 8), C8(47, 8),
+ C8(48, 8), C8(49, 8), C8(50, 8), C8(51, 8), C8(52, 8), C8(53, 8),
+ C8(54, 8), C8(55, 8), C8(56, 8), C8(57, 8), C8(58, 8), C8(59, 8),
+ C8(60, 8), C8(61, 8), C8(62, 8), C8(63, 8), C8(64, 8), C8(65, 8),
+ C8(66, 8), C8(67, 8), C8(68, 8), C8(69, 8), C8(70, 8), C8(71, 8),
+ C8(72, 8), C8(73, 8), C8(74, 8), C8(75, 8), C8(76, 8), C8(77, 8),
+ C8(78, 8), C8(79, 8), C8(80, 8), C8(81, 8), C8(82, 8), C8(83, 8),
+ C8(84, 8), C8(85, 8), C8(86, 8), C8(87, 8), C8(88, 8), C8(89, 8),
+ C8(90, 8), C8(91, 8), C8(92, 8), C8(93, 8), C8(94, 8), C8(95, 8),
+ C8(96, 8), C8(97, 8), C8(98, 8), C8(99, 8), C8(100, 8), C8(101, 8),
+ C8(102, 8), C8(103, 8), C8(104, 8), C8(105, 8), C8(106, 8), C8(107, 8),
+ C8(108, 8), C8(109, 8), C8(110, 8), C8(111, 8), C8(112, 8), C8(113, 8),
+ C8(114, 8), C8(115, 8), C8(116, 8), C8(117, 8), C8(118, 8), C8(119, 8),
+ C8(120, 8), C8(121, 8), C8(122, 8), C8(123, 8), C8(124, 8), C8(125, 8),
+ C8(126, 8), C8(127, 8), C8(128, 8), C8(129, 8), C8(130, 8), C8(131, 8),
+ C8(132, 8), C8(133, 8), C8(134, 8), C8(135, 8), C8(136, 8), C8(137, 8),
+ C8(138, 8), C8(139, 8), C8(140, 8), C8(141, 8), C8(142, 8), C8(143, 8),
+ C8(144, 8), C8(145, 8), C8(146, 8), C8(147, 8), C8(148, 8), C8(149, 8),
+ C8(150, 8), C8(151, 8), C8(152, 8), C8(153, 8), C8(154, 8), C8(155, 8),
+ C8(156, 8), C8(157, 8), C8(158, 8), C8(159, 8), C8(160, 8), C8(161, 8),
+ C8(162, 8), C8(163, 8), C8(164, 8), C8(165, 8), C8(166, 8), C8(167, 8),
+ C8(168, 8), C8(169, 8), C8(170, 8), C8(171, 8), C8(172, 8), C8(173, 8),
+ C8(174, 8), C8(175, 8), C8(176, 8), C8(177, 8), C8(178, 8), C8(179, 8),
+ C8(180, 8), C8(181, 8), C8(182, 8), C8(183, 8), C8(184, 8), C8(185, 8),
+ C8(186, 8), C8(187, 8), C8(188, 8), C8(189, 8), C8(190, 8), C8(191, 8),
+ C8(192, 8), C8(193, 8), C8(194, 8), C8(195, 8), C8(196, 8), C8(197, 8),
+ C8(198, 8), C8(199, 8), C8(200, 8), C8(201, 8), C8(202, 8), C8(203, 8),
+ C8(204, 8), C8(205, 8), C8(206, 8), C8(207, 8), C8(208, 8), C8(209, 8),
+ C8(210, 8), C8(211, 8), C8(212, 8), C8(213, 8), C8(214, 8), C8(215, 8),
+ C8(216, 8), C8(217, 8), C8(218, 8), C8(219, 8), C8(220, 8), C8(221, 8),
+ C8(222, 8), C8(223, 8), C8(224, 8), C8(225, 8), C8(226, 8), C8(227, 8),
+ C8(228, 8), C8(229, 8), C8(230, 8), C8(231, 8), C8(232, 8), C8(233, 8),
+ C8(234, 8), C8(235, 8), C8(236, 8), C8(237, 8), C8(238, 8), C8(239, 8),
+ C8(240, 8), C8(241, 8), C8(242, 8), C8(243, 8), C8(244, 8), C8(245, 8),
+ C8(246, 8), C8(247, 8), C8(248, 8), C8(249, 8), C8(250, 8), C8(251, 8),
+ C8(252, 8), C8(253, 8), C8(254, 8), C8(255, 8),
};
+
const FbBits fbStipple4Bits[16] = {
- C4( 0,16), C4( 1,16), C4( 2,16), C4( 3,16), C4( 4,16), C4( 5,16),
- C4( 6,16), C4( 7,16), C4( 8,16), C4( 9,16), C4( 10,16), C4( 11,16),
- C4( 12,16), C4( 13,16), C4( 14,16), C4( 15,16),};
+ C4(0, 16), C4(1, 16), C4(2, 16), C4(3, 16), C4(4, 16), C4(5, 16),
+ C4(6, 16), C4(7, 16), C4(8, 16), C4(9, 16), C4(10, 16), C4(11, 16),
+ C4(12, 16), C4(13, 16), C4(14, 16), C4(15, 16),
+};
+
const FbBits fbStipple2Bits[4] = {
- C2( 0,32), C2( 1,32), C2( 2,32), C2( 3,32),
+ C2(0, 32), C2(1, 32), C2(2, 32), C2(3, 32),
};
+
#define fbStipple1Bits 0
#endif
-const FbBits * const fbStippleTable[] = {
+const FbBits *const fbStippleTable[] = {
0,
fbStipple1Bits,
fbStipple2Bits,
diff --git a/xorg-server/fb/fbwindow.c b/xorg-server/fb/fbwindow.c
index 7906f8dd2..d27ccd4d5 100644
--- a/xorg-server/fb/fbwindow.c
+++ b/xorg-server/fb/fbwindow.c
@@ -32,9 +32,10 @@ Bool
fbCreateWindow(WindowPtr pWin)
{
dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(),
- fbGetScreenPixmap(pWin->drawable.pScreen));
+ fbGetScreenPixmap(pWin->drawable.pScreen));
if (pWin->drawable.bitsPerPixel == 32)
- pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
+ pWin->drawable.bitsPerPixel =
+ fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
return TRUE;
}
@@ -63,87 +64,71 @@ fbUnmapWindow(WindowPtr pWindow)
}
void
-fbCopyWindowProc (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
+fbCopyWindowProc(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
{
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- while (nbox--)
- {
- fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
-
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
-
- (pbox->x2 - pbox->x1) * dstBpp,
- (pbox->y2 - pbox->y1),
-
- GXcopy,
- FB_ALLONES,
- dstBpp,
-
- reverse,
- upsidedown);
- pbox++;
+ FbBits *src;
+ FbStride srcStride;
+ int srcBpp;
+ int srcXoff, srcYoff;
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+
+ fbGetDrawable(pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
+ fbGetDrawable(pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+
+ while (nbox--) {
+ fbBlt(src + (pbox->y1 + dy + srcYoff) * srcStride,
+ srcStride,
+ (pbox->x1 + dx + srcXoff) * srcBpp,
+ dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ (pbox->x2 - pbox->x1) * dstBpp,
+ (pbox->y2 - pbox->y1),
+ GXcopy, FB_ALLONES, dstBpp, reverse, upsidedown);
+ pbox++;
}
- fbFinishAccess (pDstDrawable);
- fbFinishAccess (pSrcDrawable);
+ fbFinishAccess(pDstDrawable);
+ fbFinishAccess(pSrcDrawable);
}
void
-fbCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
+fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- RegionRec rgnDst;
- int dx, dy;
+ RegionRec rgnDst;
+ int dx, dy;
- PixmapPtr pPixmap = fbGetWindowPixmap (pWin);
- DrawablePtr pDrawable = &pPixmap->drawable;
+ PixmapPtr pPixmap = fbGetWindowPixmap(pWin);
+ DrawablePtr pDrawable = &pPixmap->drawable;
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
RegionTranslate(prgnSrc, -dx, -dy);
RegionNull(&rgnDst);
-
+
RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
#ifdef COMPOSITE
if (pPixmap->screen_x || pPixmap->screen_y)
- RegionTranslate(&rgnDst,
- -pPixmap->screen_x, -pPixmap->screen_y);
+ RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y);
#endif
- miCopyRegion (pDrawable, pDrawable,
- 0,
- &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
-
+ miCopyRegion(pDrawable, pDrawable,
+ 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
+
RegionUninit(&rgnDst);
- fbValidateDrawable (&pWin->drawable);
+ fbValidateDrawable(&pWin->drawable);
}
static void
@@ -151,79 +136,70 @@ fbFixupWindowPixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
{
PixmapPtr pPixmap = *ppPixmap;
- if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel)
- {
- pPixmap = fb24_32ReformatTile (pPixmap, pDrawable->bitsPerPixel);
- if (!pPixmap)
- return;
- (*pDrawable->pScreen->DestroyPixmap) (*ppPixmap);
- *ppPixmap = pPixmap;
+ if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
+ pPixmap = fb24_32ReformatTile(pPixmap, pDrawable->bitsPerPixel);
+ if (!pPixmap)
+ return;
+ (*pDrawable->pScreen->DestroyPixmap) (*ppPixmap);
+ *ppPixmap = pPixmap;
}
- if (FbEvenTile (pPixmap->drawable.width *
- pPixmap->drawable.bitsPerPixel))
- fbPadPixmap (pPixmap);
+ if (FbEvenTile(pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel))
+ fbPadPixmap(pPixmap);
}
Bool
fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
- if (mask & CWBackPixmap)
- {
- if (pWin->backgroundState == BackgroundPixmap)
- fbFixupWindowPixmap(&pWin->drawable, &pWin->background.pixmap);
+ if (mask & CWBackPixmap) {
+ if (pWin->backgroundState == BackgroundPixmap)
+ fbFixupWindowPixmap(&pWin->drawable, &pWin->background.pixmap);
}
- if (mask & CWBorderPixmap)
- {
- if (pWin->borderIsPixel == FALSE)
- fbFixupWindowPixmap(&pWin->drawable, &pWin->border.pixmap);
+ if (mask & CWBorderPixmap) {
+ if (pWin->borderIsPixel == FALSE)
+ fbFixupWindowPixmap(&pWin->drawable, &pWin->border.pixmap);
}
return TRUE;
}
void
-fbFillRegionSolid (DrawablePtr pDrawable,
- RegionPtr pRegion,
- FbBits and,
- FbBits xor)
+fbFillRegionSolid(DrawablePtr pDrawable,
+ RegionPtr pRegion, FbBits and, FbBits xor)
{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- int n = RegionNumRects(pRegion);
- BoxPtr pbox = RegionRects(pRegion);
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ int n = RegionNumRects(pRegion);
+ BoxPtr pbox = RegionRects(pRegion);
#ifndef FB_ACCESS_WRAPPER
int try_mmx = 0;
+
if (!and)
try_mmx = 1;
#endif
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- while (n--)
- {
+ fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+
+ while (n--) {
#ifndef FB_ACCESS_WRAPPER
- if (!try_mmx || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
- pbox->x1 + dstXoff, pbox->y1 + dstYoff,
- (pbox->x2 - pbox->x1),
- (pbox->y2 - pbox->y1),
- xor))
- {
+ if (!try_mmx || !pixman_fill((uint32_t *) dst, dstStride, dstBpp,
+ pbox->x1 + dstXoff, pbox->y1 + dstYoff,
+ (pbox->x2 - pbox->x1),
+ (pbox->y2 - pbox->y1), xor)) {
#endif
- fbSolid (dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
- dstBpp,
- (pbox->x2 - pbox->x1) * dstBpp,
- pbox->y2 - pbox->y1,
- and, xor);
+ fbSolid(dst + (pbox->y1 + dstYoff) * dstStride,
+ dstStride,
+ (pbox->x1 + dstXoff) * dstBpp,
+ dstBpp,
+ (pbox->x2 - pbox->x1) * dstBpp,
+ pbox->y2 - pbox->y1, and, xor);
#ifndef FB_ACCESS_WRAPPER
- }
+ }
#endif
- fbValidateDrawable (pDrawable);
- pbox++;
+ fbValidateDrawable(pDrawable);
+ pbox++;
}
-
- fbFinishAccess (pDrawable);
+
+ fbFinishAccess(pDrawable);
}
diff --git a/xorg-server/glx/clientinfo.c b/xorg-server/glx/clientinfo.c
index 3c0e7de45..15bbf15af 100644
--- a/xorg-server/glx/clientinfo.c
+++ b/xorg-server/glx/clientinfo.c
@@ -27,22 +27,26 @@
#include "glxserver.h"
#include "indirect_dispatch.h"
-int __glXDisp_SetClientInfoARB(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
return BadRequest;
}
-int __glXDispSwap_SetClientInfoARB(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
return BadRequest;
}
-int __glXDisp_SetClientInfo2ARB(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_SetClientInfo2ARB(__GLXclientState * cl, GLbyte * pc)
{
return BadRequest;
}
-int __glXDispSwap_SetClientInfo2ARB(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDispSwap_SetClientInfo2ARB(__GLXclientState * cl, GLbyte * pc)
{
return BadRequest;
}
diff --git a/xorg-server/glx/createcontext.c b/xorg-server/glx/createcontext.c
index 785061d5b..9c1eab3e4 100644
--- a/xorg-server/glx/createcontext.c
+++ b/xorg-server/glx/createcontext.c
@@ -27,12 +27,14 @@
#include "glxserver.h"
#include "indirect_dispatch.h"
-int __glXDisp_CreateContextAttribsARB(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
{
return BadRequest;
}
-int __glXDispSwap_CreateContextAttribsARB(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDispSwap_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
{
return BadRequest;
}
diff --git a/xorg-server/glx/dispatch.h b/xorg-server/glx/dispatch.h
index 87c417b27..149b669e3 100644
--- a/xorg-server/glx/dispatch.h
+++ b/xorg-server/glx/dispatch.h
@@ -1,12948 +1,12948 @@
-/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */
-
-/*
- * (C) Copyright IBM Corporation 2005
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#if !defined( _DISPATCH_H_ )
-# define _DISPATCH_H_
-
-
-#include "glapitable.h"
-/**
- * \file main/dispatch.h
- * Macros for handling GL dispatch tables.
- *
- * For each known GL function, there are 3 macros in this file. The first
- * macro is named CALL_FuncName and is used to call that GL function using
- * the specified dispatch table. The other 2 macros, called GET_FuncName
- * can SET_FuncName, are used to get and set the dispatch pointer for the
- * named function in the specified dispatch table.
- */
-
-/* GLXEXT is defined when building the GLX extension in the xserver.
- */
-#if !defined(GLXEXT)
-#include "main/mfeatures.h"
-#endif
-
-#ifdef _MSC_VER
-#define INLINE __inline
-#endif
-#define CALL_by_offset(disp, cast, offset, parameters) \
- (*(cast (GET_by_offset(disp, offset)))) parameters
-#define GET_by_offset(disp, offset) \
- (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL
-#define SET_by_offset(disp, offset, fn) \
- do { \
- if ( (offset) < 0 ) { \
- /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\n", */ \
- /* __func__, __LINE__, disp, offset, # fn); */ \
- /* abort(); */ \
- } \
- else { \
- ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \
- } \
- } while(0)
-
-/* total number of offsets below */
-#define _gloffset_COUNT 977
-
-#define _gloffset_NewList 0
-#define _gloffset_EndList 1
-#define _gloffset_CallList 2
-#define _gloffset_CallLists 3
-#define _gloffset_DeleteLists 4
-#define _gloffset_GenLists 5
-#define _gloffset_ListBase 6
-#define _gloffset_Begin 7
-#define _gloffset_Bitmap 8
-#define _gloffset_Color3b 9
-#define _gloffset_Color3bv 10
-#define _gloffset_Color3d 11
-#define _gloffset_Color3dv 12
-#define _gloffset_Color3f 13
-#define _gloffset_Color3fv 14
-#define _gloffset_Color3i 15
-#define _gloffset_Color3iv 16
-#define _gloffset_Color3s 17
-#define _gloffset_Color3sv 18
-#define _gloffset_Color3ub 19
-#define _gloffset_Color3ubv 20
-#define _gloffset_Color3ui 21
-#define _gloffset_Color3uiv 22
-#define _gloffset_Color3us 23
-#define _gloffset_Color3usv 24
-#define _gloffset_Color4b 25
-#define _gloffset_Color4bv 26
-#define _gloffset_Color4d 27
-#define _gloffset_Color4dv 28
-#define _gloffset_Color4f 29
-#define _gloffset_Color4fv 30
-#define _gloffset_Color4i 31
-#define _gloffset_Color4iv 32
-#define _gloffset_Color4s 33
-#define _gloffset_Color4sv 34
-#define _gloffset_Color4ub 35
-#define _gloffset_Color4ubv 36
-#define _gloffset_Color4ui 37
-#define _gloffset_Color4uiv 38
-#define _gloffset_Color4us 39
-#define _gloffset_Color4usv 40
-#define _gloffset_EdgeFlag 41
-#define _gloffset_EdgeFlagv 42
-#define _gloffset_End 43
-#define _gloffset_Indexd 44
-#define _gloffset_Indexdv 45
-#define _gloffset_Indexf 46
-#define _gloffset_Indexfv 47
-#define _gloffset_Indexi 48
-#define _gloffset_Indexiv 49
-#define _gloffset_Indexs 50
-#define _gloffset_Indexsv 51
-#define _gloffset_Normal3b 52
-#define _gloffset_Normal3bv 53
-#define _gloffset_Normal3d 54
-#define _gloffset_Normal3dv 55
-#define _gloffset_Normal3f 56
-#define _gloffset_Normal3fv 57
-#define _gloffset_Normal3i 58
-#define _gloffset_Normal3iv 59
-#define _gloffset_Normal3s 60
-#define _gloffset_Normal3sv 61
-#define _gloffset_RasterPos2d 62
-#define _gloffset_RasterPos2dv 63
-#define _gloffset_RasterPos2f 64
-#define _gloffset_RasterPos2fv 65
-#define _gloffset_RasterPos2i 66
-#define _gloffset_RasterPos2iv 67
-#define _gloffset_RasterPos2s 68
-#define _gloffset_RasterPos2sv 69
-#define _gloffset_RasterPos3d 70
-#define _gloffset_RasterPos3dv 71
-#define _gloffset_RasterPos3f 72
-#define _gloffset_RasterPos3fv 73
-#define _gloffset_RasterPos3i 74
-#define _gloffset_RasterPos3iv 75
-#define _gloffset_RasterPos3s 76
-#define _gloffset_RasterPos3sv 77
-#define _gloffset_RasterPos4d 78
-#define _gloffset_RasterPos4dv 79
-#define _gloffset_RasterPos4f 80
-#define _gloffset_RasterPos4fv 81
-#define _gloffset_RasterPos4i 82
-#define _gloffset_RasterPos4iv 83
-#define _gloffset_RasterPos4s 84
-#define _gloffset_RasterPos4sv 85
-#define _gloffset_Rectd 86
-#define _gloffset_Rectdv 87
-#define _gloffset_Rectf 88
-#define _gloffset_Rectfv 89
-#define _gloffset_Recti 90
-#define _gloffset_Rectiv 91
-#define _gloffset_Rects 92
-#define _gloffset_Rectsv 93
-#define _gloffset_TexCoord1d 94
-#define _gloffset_TexCoord1dv 95
-#define _gloffset_TexCoord1f 96
-#define _gloffset_TexCoord1fv 97
-#define _gloffset_TexCoord1i 98
-#define _gloffset_TexCoord1iv 99
-#define _gloffset_TexCoord1s 100
-#define _gloffset_TexCoord1sv 101
-#define _gloffset_TexCoord2d 102
-#define _gloffset_TexCoord2dv 103
-#define _gloffset_TexCoord2f 104
-#define _gloffset_TexCoord2fv 105
-#define _gloffset_TexCoord2i 106
-#define _gloffset_TexCoord2iv 107
-#define _gloffset_TexCoord2s 108
-#define _gloffset_TexCoord2sv 109
-#define _gloffset_TexCoord3d 110
-#define _gloffset_TexCoord3dv 111
-#define _gloffset_TexCoord3f 112
-#define _gloffset_TexCoord3fv 113
-#define _gloffset_TexCoord3i 114
-#define _gloffset_TexCoord3iv 115
-#define _gloffset_TexCoord3s 116
-#define _gloffset_TexCoord3sv 117
-#define _gloffset_TexCoord4d 118
-#define _gloffset_TexCoord4dv 119
-#define _gloffset_TexCoord4f 120
-#define _gloffset_TexCoord4fv 121
-#define _gloffset_TexCoord4i 122
-#define _gloffset_TexCoord4iv 123
-#define _gloffset_TexCoord4s 124
-#define _gloffset_TexCoord4sv 125
-#define _gloffset_Vertex2d 126
-#define _gloffset_Vertex2dv 127
-#define _gloffset_Vertex2f 128
-#define _gloffset_Vertex2fv 129
-#define _gloffset_Vertex2i 130
-#define _gloffset_Vertex2iv 131
-#define _gloffset_Vertex2s 132
-#define _gloffset_Vertex2sv 133
-#define _gloffset_Vertex3d 134
-#define _gloffset_Vertex3dv 135
-#define _gloffset_Vertex3f 136
-#define _gloffset_Vertex3fv 137
-#define _gloffset_Vertex3i 138
-#define _gloffset_Vertex3iv 139
-#define _gloffset_Vertex3s 140
-#define _gloffset_Vertex3sv 141
-#define _gloffset_Vertex4d 142
-#define _gloffset_Vertex4dv 143
-#define _gloffset_Vertex4f 144
-#define _gloffset_Vertex4fv 145
-#define _gloffset_Vertex4i 146
-#define _gloffset_Vertex4iv 147
-#define _gloffset_Vertex4s 148
-#define _gloffset_Vertex4sv 149
-#define _gloffset_ClipPlane 150
-#define _gloffset_ColorMaterial 151
-#define _gloffset_CullFace 152
-#define _gloffset_Fogf 153
-#define _gloffset_Fogfv 154
-#define _gloffset_Fogi 155
-#define _gloffset_Fogiv 156
-#define _gloffset_FrontFace 157
-#define _gloffset_Hint 158
-#define _gloffset_Lightf 159
-#define _gloffset_Lightfv 160
-#define _gloffset_Lighti 161
-#define _gloffset_Lightiv 162
-#define _gloffset_LightModelf 163
-#define _gloffset_LightModelfv 164
-#define _gloffset_LightModeli 165
-#define _gloffset_LightModeliv 166
-#define _gloffset_LineStipple 167
-#define _gloffset_LineWidth 168
-#define _gloffset_Materialf 169
-#define _gloffset_Materialfv 170
-#define _gloffset_Materiali 171
-#define _gloffset_Materialiv 172
-#define _gloffset_PointSize 173
-#define _gloffset_PolygonMode 174
-#define _gloffset_PolygonStipple 175
-#define _gloffset_Scissor 176
-#define _gloffset_ShadeModel 177
-#define _gloffset_TexParameterf 178
-#define _gloffset_TexParameterfv 179
-#define _gloffset_TexParameteri 180
-#define _gloffset_TexParameteriv 181
-#define _gloffset_TexImage1D 182
-#define _gloffset_TexImage2D 183
-#define _gloffset_TexEnvf 184
-#define _gloffset_TexEnvfv 185
-#define _gloffset_TexEnvi 186
-#define _gloffset_TexEnviv 187
-#define _gloffset_TexGend 188
-#define _gloffset_TexGendv 189
-#define _gloffset_TexGenf 190
-#define _gloffset_TexGenfv 191
-#define _gloffset_TexGeni 192
-#define _gloffset_TexGeniv 193
-#define _gloffset_FeedbackBuffer 194
-#define _gloffset_SelectBuffer 195
-#define _gloffset_RenderMode 196
-#define _gloffset_InitNames 197
-#define _gloffset_LoadName 198
-#define _gloffset_PassThrough 199
-#define _gloffset_PopName 200
-#define _gloffset_PushName 201
-#define _gloffset_DrawBuffer 202
-#define _gloffset_Clear 203
-#define _gloffset_ClearAccum 204
-#define _gloffset_ClearIndex 205
-#define _gloffset_ClearColor 206
-#define _gloffset_ClearStencil 207
-#define _gloffset_ClearDepth 208
-#define _gloffset_StencilMask 209
-#define _gloffset_ColorMask 210
-#define _gloffset_DepthMask 211
-#define _gloffset_IndexMask 212
-#define _gloffset_Accum 213
-#define _gloffset_Disable 214
-#define _gloffset_Enable 215
-#define _gloffset_Finish 216
-#define _gloffset_Flush 217
-#define _gloffset_PopAttrib 218
-#define _gloffset_PushAttrib 219
-#define _gloffset_Map1d 220
-#define _gloffset_Map1f 221
-#define _gloffset_Map2d 222
-#define _gloffset_Map2f 223
-#define _gloffset_MapGrid1d 224
-#define _gloffset_MapGrid1f 225
-#define _gloffset_MapGrid2d 226
-#define _gloffset_MapGrid2f 227
-#define _gloffset_EvalCoord1d 228
-#define _gloffset_EvalCoord1dv 229
-#define _gloffset_EvalCoord1f 230
-#define _gloffset_EvalCoord1fv 231
-#define _gloffset_EvalCoord2d 232
-#define _gloffset_EvalCoord2dv 233
-#define _gloffset_EvalCoord2f 234
-#define _gloffset_EvalCoord2fv 235
-#define _gloffset_EvalMesh1 236
-#define _gloffset_EvalPoint1 237
-#define _gloffset_EvalMesh2 238
-#define _gloffset_EvalPoint2 239
-#define _gloffset_AlphaFunc 240
-#define _gloffset_BlendFunc 241
-#define _gloffset_LogicOp 242
-#define _gloffset_StencilFunc 243
-#define _gloffset_StencilOp 244
-#define _gloffset_DepthFunc 245
-#define _gloffset_PixelZoom 246
-#define _gloffset_PixelTransferf 247
-#define _gloffset_PixelTransferi 248
-#define _gloffset_PixelStoref 249
-#define _gloffset_PixelStorei 250
-#define _gloffset_PixelMapfv 251
-#define _gloffset_PixelMapuiv 252
-#define _gloffset_PixelMapusv 253
-#define _gloffset_ReadBuffer 254
-#define _gloffset_CopyPixels 255
-#define _gloffset_ReadPixels 256
-#define _gloffset_DrawPixels 257
-#define _gloffset_GetBooleanv 258
-#define _gloffset_GetClipPlane 259
-#define _gloffset_GetDoublev 260
-#define _gloffset_GetError 261
-#define _gloffset_GetFloatv 262
-#define _gloffset_GetIntegerv 263
-#define _gloffset_GetLightfv 264
-#define _gloffset_GetLightiv 265
-#define _gloffset_GetMapdv 266
-#define _gloffset_GetMapfv 267
-#define _gloffset_GetMapiv 268
-#define _gloffset_GetMaterialfv 269
-#define _gloffset_GetMaterialiv 270
-#define _gloffset_GetPixelMapfv 271
-#define _gloffset_GetPixelMapuiv 272
-#define _gloffset_GetPixelMapusv 273
-#define _gloffset_GetPolygonStipple 274
-#define _gloffset_GetString 275
-#define _gloffset_GetTexEnvfv 276
-#define _gloffset_GetTexEnviv 277
-#define _gloffset_GetTexGendv 278
-#define _gloffset_GetTexGenfv 279
-#define _gloffset_GetTexGeniv 280
-#define _gloffset_GetTexImage 281
-#define _gloffset_GetTexParameterfv 282
-#define _gloffset_GetTexParameteriv 283
-#define _gloffset_GetTexLevelParameterfv 284
-#define _gloffset_GetTexLevelParameteriv 285
-#define _gloffset_IsEnabled 286
-#define _gloffset_IsList 287
-#define _gloffset_DepthRange 288
-#define _gloffset_Frustum 289
-#define _gloffset_LoadIdentity 290
-#define _gloffset_LoadMatrixf 291
-#define _gloffset_LoadMatrixd 292
-#define _gloffset_MatrixMode 293
-#define _gloffset_MultMatrixf 294
-#define _gloffset_MultMatrixd 295
-#define _gloffset_Ortho 296
-#define _gloffset_PopMatrix 297
-#define _gloffset_PushMatrix 298
-#define _gloffset_Rotated 299
-#define _gloffset_Rotatef 300
-#define _gloffset_Scaled 301
-#define _gloffset_Scalef 302
-#define _gloffset_Translated 303
-#define _gloffset_Translatef 304
-#define _gloffset_Viewport 305
-#define _gloffset_ArrayElement 306
-#define _gloffset_BindTexture 307
-#define _gloffset_ColorPointer 308
-#define _gloffset_DisableClientState 309
-#define _gloffset_DrawArrays 310
-#define _gloffset_DrawElements 311
-#define _gloffset_EdgeFlagPointer 312
-#define _gloffset_EnableClientState 313
-#define _gloffset_IndexPointer 314
-#define _gloffset_Indexub 315
-#define _gloffset_Indexubv 316
-#define _gloffset_InterleavedArrays 317
-#define _gloffset_NormalPointer 318
-#define _gloffset_PolygonOffset 319
-#define _gloffset_TexCoordPointer 320
-#define _gloffset_VertexPointer 321
-#define _gloffset_AreTexturesResident 322
-#define _gloffset_CopyTexImage1D 323
-#define _gloffset_CopyTexImage2D 324
-#define _gloffset_CopyTexSubImage1D 325
-#define _gloffset_CopyTexSubImage2D 326
-#define _gloffset_DeleteTextures 327
-#define _gloffset_GenTextures 328
-#define _gloffset_GetPointerv 329
-#define _gloffset_IsTexture 330
-#define _gloffset_PrioritizeTextures 331
-#define _gloffset_TexSubImage1D 332
-#define _gloffset_TexSubImage2D 333
-#define _gloffset_PopClientAttrib 334
-#define _gloffset_PushClientAttrib 335
-#define _gloffset_BlendColor 336
-#define _gloffset_BlendEquation 337
-#define _gloffset_DrawRangeElements 338
-#define _gloffset_ColorTable 339
-#define _gloffset_ColorTableParameterfv 340
-#define _gloffset_ColorTableParameteriv 341
-#define _gloffset_CopyColorTable 342
-#define _gloffset_GetColorTable 343
-#define _gloffset_GetColorTableParameterfv 344
-#define _gloffset_GetColorTableParameteriv 345
-#define _gloffset_ColorSubTable 346
-#define _gloffset_CopyColorSubTable 347
-#define _gloffset_ConvolutionFilter1D 348
-#define _gloffset_ConvolutionFilter2D 349
-#define _gloffset_ConvolutionParameterf 350
-#define _gloffset_ConvolutionParameterfv 351
-#define _gloffset_ConvolutionParameteri 352
-#define _gloffset_ConvolutionParameteriv 353
-#define _gloffset_CopyConvolutionFilter1D 354
-#define _gloffset_CopyConvolutionFilter2D 355
-#define _gloffset_GetConvolutionFilter 356
-#define _gloffset_GetConvolutionParameterfv 357
-#define _gloffset_GetConvolutionParameteriv 358
-#define _gloffset_GetSeparableFilter 359
-#define _gloffset_SeparableFilter2D 360
-#define _gloffset_GetHistogram 361
-#define _gloffset_GetHistogramParameterfv 362
-#define _gloffset_GetHistogramParameteriv 363
-#define _gloffset_GetMinmax 364
-#define _gloffset_GetMinmaxParameterfv 365
-#define _gloffset_GetMinmaxParameteriv 366
-#define _gloffset_Histogram 367
-#define _gloffset_Minmax 368
-#define _gloffset_ResetHistogram 369
-#define _gloffset_ResetMinmax 370
-#define _gloffset_TexImage3D 371
-#define _gloffset_TexSubImage3D 372
-#define _gloffset_CopyTexSubImage3D 373
-#define _gloffset_ActiveTextureARB 374
-#define _gloffset_ClientActiveTextureARB 375
-#define _gloffset_MultiTexCoord1dARB 376
-#define _gloffset_MultiTexCoord1dvARB 377
-#define _gloffset_MultiTexCoord1fARB 378
-#define _gloffset_MultiTexCoord1fvARB 379
-#define _gloffset_MultiTexCoord1iARB 380
-#define _gloffset_MultiTexCoord1ivARB 381
-#define _gloffset_MultiTexCoord1sARB 382
-#define _gloffset_MultiTexCoord1svARB 383
-#define _gloffset_MultiTexCoord2dARB 384
-#define _gloffset_MultiTexCoord2dvARB 385
-#define _gloffset_MultiTexCoord2fARB 386
-#define _gloffset_MultiTexCoord2fvARB 387
-#define _gloffset_MultiTexCoord2iARB 388
-#define _gloffset_MultiTexCoord2ivARB 389
-#define _gloffset_MultiTexCoord2sARB 390
-#define _gloffset_MultiTexCoord2svARB 391
-#define _gloffset_MultiTexCoord3dARB 392
-#define _gloffset_MultiTexCoord3dvARB 393
-#define _gloffset_MultiTexCoord3fARB 394
-#define _gloffset_MultiTexCoord3fvARB 395
-#define _gloffset_MultiTexCoord3iARB 396
-#define _gloffset_MultiTexCoord3ivARB 397
-#define _gloffset_MultiTexCoord3sARB 398
-#define _gloffset_MultiTexCoord3svARB 399
-#define _gloffset_MultiTexCoord4dARB 400
-#define _gloffset_MultiTexCoord4dvARB 401
-#define _gloffset_MultiTexCoord4fARB 402
-#define _gloffset_MultiTexCoord4fvARB 403
-#define _gloffset_MultiTexCoord4iARB 404
-#define _gloffset_MultiTexCoord4ivARB 405
-#define _gloffset_MultiTexCoord4sARB 406
-#define _gloffset_MultiTexCoord4svARB 407
-
-#if !FEATURE_remap_table
-
-#define _gloffset_AttachShader 408
-#define _gloffset_CreateProgram 409
-#define _gloffset_CreateShader 410
-#define _gloffset_DeleteProgram 411
-#define _gloffset_DeleteShader 412
-#define _gloffset_DetachShader 413
-#define _gloffset_GetAttachedShaders 414
-#define _gloffset_GetProgramInfoLog 415
-#define _gloffset_GetProgramiv 416
-#define _gloffset_GetShaderInfoLog 417
-#define _gloffset_GetShaderiv 418
-#define _gloffset_IsProgram 419
-#define _gloffset_IsShader 420
-#define _gloffset_StencilFuncSeparate 421
-#define _gloffset_StencilMaskSeparate 422
-#define _gloffset_StencilOpSeparate 423
-#define _gloffset_UniformMatrix2x3fv 424
-#define _gloffset_UniformMatrix2x4fv 425
-#define _gloffset_UniformMatrix3x2fv 426
-#define _gloffset_UniformMatrix3x4fv 427
-#define _gloffset_UniformMatrix4x2fv 428
-#define _gloffset_UniformMatrix4x3fv 429
-#define _gloffset_ClampColor 430
-#define _gloffset_ClearBufferfi 431
-#define _gloffset_ClearBufferfv 432
-#define _gloffset_ClearBufferiv 433
-#define _gloffset_ClearBufferuiv 434
-#define _gloffset_GetStringi 435
-#define _gloffset_TexBuffer 436
-#define _gloffset_FramebufferTexture 437
-#define _gloffset_GetBufferParameteri64v 438
-#define _gloffset_GetInteger64i_v 439
-#define _gloffset_VertexAttribDivisor 440
-#define _gloffset_LoadTransposeMatrixdARB 441
-#define _gloffset_LoadTransposeMatrixfARB 442
-#define _gloffset_MultTransposeMatrixdARB 443
-#define _gloffset_MultTransposeMatrixfARB 444
-#define _gloffset_SampleCoverageARB 445
-#define _gloffset_CompressedTexImage1DARB 446
-#define _gloffset_CompressedTexImage2DARB 447
-#define _gloffset_CompressedTexImage3DARB 448
-#define _gloffset_CompressedTexSubImage1DARB 449
-#define _gloffset_CompressedTexSubImage2DARB 450
-#define _gloffset_CompressedTexSubImage3DARB 451
-#define _gloffset_GetCompressedTexImageARB 452
-#define _gloffset_DisableVertexAttribArrayARB 453
-#define _gloffset_EnableVertexAttribArrayARB 454
-#define _gloffset_GetProgramEnvParameterdvARB 455
-#define _gloffset_GetProgramEnvParameterfvARB 456
-#define _gloffset_GetProgramLocalParameterdvARB 457
-#define _gloffset_GetProgramLocalParameterfvARB 458
-#define _gloffset_GetProgramStringARB 459
-#define _gloffset_GetProgramivARB 460
-#define _gloffset_GetVertexAttribdvARB 461
-#define _gloffset_GetVertexAttribfvARB 462
-#define _gloffset_GetVertexAttribivARB 463
-#define _gloffset_ProgramEnvParameter4dARB 464
-#define _gloffset_ProgramEnvParameter4dvARB 465
-#define _gloffset_ProgramEnvParameter4fARB 466
-#define _gloffset_ProgramEnvParameter4fvARB 467
-#define _gloffset_ProgramLocalParameter4dARB 468
-#define _gloffset_ProgramLocalParameter4dvARB 469
-#define _gloffset_ProgramLocalParameter4fARB 470
-#define _gloffset_ProgramLocalParameter4fvARB 471
-#define _gloffset_ProgramStringARB 472
-#define _gloffset_VertexAttrib1dARB 473
-#define _gloffset_VertexAttrib1dvARB 474
-#define _gloffset_VertexAttrib1fARB 475
-#define _gloffset_VertexAttrib1fvARB 476
-#define _gloffset_VertexAttrib1sARB 477
-#define _gloffset_VertexAttrib1svARB 478
-#define _gloffset_VertexAttrib2dARB 479
-#define _gloffset_VertexAttrib2dvARB 480
-#define _gloffset_VertexAttrib2fARB 481
-#define _gloffset_VertexAttrib2fvARB 482
-#define _gloffset_VertexAttrib2sARB 483
-#define _gloffset_VertexAttrib2svARB 484
-#define _gloffset_VertexAttrib3dARB 485
-#define _gloffset_VertexAttrib3dvARB 486
-#define _gloffset_VertexAttrib3fARB 487
-#define _gloffset_VertexAttrib3fvARB 488
-#define _gloffset_VertexAttrib3sARB 489
-#define _gloffset_VertexAttrib3svARB 490
-#define _gloffset_VertexAttrib4NbvARB 491
-#define _gloffset_VertexAttrib4NivARB 492
-#define _gloffset_VertexAttrib4NsvARB 493
-#define _gloffset_VertexAttrib4NubARB 494
-#define _gloffset_VertexAttrib4NubvARB 495
-#define _gloffset_VertexAttrib4NuivARB 496
-#define _gloffset_VertexAttrib4NusvARB 497
-#define _gloffset_VertexAttrib4bvARB 498
-#define _gloffset_VertexAttrib4dARB 499
-#define _gloffset_VertexAttrib4dvARB 500
-#define _gloffset_VertexAttrib4fARB 501
-#define _gloffset_VertexAttrib4fvARB 502
-#define _gloffset_VertexAttrib4ivARB 503
-#define _gloffset_VertexAttrib4sARB 504
-#define _gloffset_VertexAttrib4svARB 505
-#define _gloffset_VertexAttrib4ubvARB 506
-#define _gloffset_VertexAttrib4uivARB 507
-#define _gloffset_VertexAttrib4usvARB 508
-#define _gloffset_VertexAttribPointerARB 509
-#define _gloffset_BindBufferARB 510
-#define _gloffset_BufferDataARB 511
-#define _gloffset_BufferSubDataARB 512
-#define _gloffset_DeleteBuffersARB 513
-#define _gloffset_GenBuffersARB 514
-#define _gloffset_GetBufferParameterivARB 515
-#define _gloffset_GetBufferPointervARB 516
-#define _gloffset_GetBufferSubDataARB 517
-#define _gloffset_IsBufferARB 518
-#define _gloffset_MapBufferARB 519
-#define _gloffset_UnmapBufferARB 520
-#define _gloffset_BeginQueryARB 521
-#define _gloffset_DeleteQueriesARB 522
-#define _gloffset_EndQueryARB 523
-#define _gloffset_GenQueriesARB 524
-#define _gloffset_GetQueryObjectivARB 525
-#define _gloffset_GetQueryObjectuivARB 526
-#define _gloffset_GetQueryivARB 527
-#define _gloffset_IsQueryARB 528
-#define _gloffset_AttachObjectARB 529
-#define _gloffset_CompileShaderARB 530
-#define _gloffset_CreateProgramObjectARB 531
-#define _gloffset_CreateShaderObjectARB 532
-#define _gloffset_DeleteObjectARB 533
-#define _gloffset_DetachObjectARB 534
-#define _gloffset_GetActiveUniformARB 535
-#define _gloffset_GetAttachedObjectsARB 536
-#define _gloffset_GetHandleARB 537
-#define _gloffset_GetInfoLogARB 538
-#define _gloffset_GetObjectParameterfvARB 539
-#define _gloffset_GetObjectParameterivARB 540
-#define _gloffset_GetShaderSourceARB 541
-#define _gloffset_GetUniformLocationARB 542
-#define _gloffset_GetUniformfvARB 543
-#define _gloffset_GetUniformivARB 544
-#define _gloffset_LinkProgramARB 545
-#define _gloffset_ShaderSourceARB 546
-#define _gloffset_Uniform1fARB 547
-#define _gloffset_Uniform1fvARB 548
-#define _gloffset_Uniform1iARB 549
-#define _gloffset_Uniform1ivARB 550
-#define _gloffset_Uniform2fARB 551
-#define _gloffset_Uniform2fvARB 552
-#define _gloffset_Uniform2iARB 553
-#define _gloffset_Uniform2ivARB 554
-#define _gloffset_Uniform3fARB 555
-#define _gloffset_Uniform3fvARB 556
-#define _gloffset_Uniform3iARB 557
-#define _gloffset_Uniform3ivARB 558
-#define _gloffset_Uniform4fARB 559
-#define _gloffset_Uniform4fvARB 560
-#define _gloffset_Uniform4iARB 561
-#define _gloffset_Uniform4ivARB 562
-#define _gloffset_UniformMatrix2fvARB 563
-#define _gloffset_UniformMatrix3fvARB 564
-#define _gloffset_UniformMatrix4fvARB 565
-#define _gloffset_UseProgramObjectARB 566
-#define _gloffset_ValidateProgramARB 567
-#define _gloffset_BindAttribLocationARB 568
-#define _gloffset_GetActiveAttribARB 569
-#define _gloffset_GetAttribLocationARB 570
-#define _gloffset_DrawBuffersARB 571
-#define _gloffset_ClampColorARB 572
-#define _gloffset_DrawArraysInstancedARB 573
-#define _gloffset_DrawElementsInstancedARB 574
-#define _gloffset_RenderbufferStorageMultisample 575
-#define _gloffset_FramebufferTextureARB 576
-#define _gloffset_FramebufferTextureFaceARB 577
-#define _gloffset_ProgramParameteriARB 578
-#define _gloffset_VertexAttribDivisorARB 579
-#define _gloffset_FlushMappedBufferRange 580
-#define _gloffset_MapBufferRange 581
-#define _gloffset_TexBufferARB 582
-#define _gloffset_BindVertexArray 583
-#define _gloffset_GenVertexArrays 584
-#define _gloffset_CopyBufferSubData 585
-#define _gloffset_ClientWaitSync 586
-#define _gloffset_DeleteSync 587
-#define _gloffset_FenceSync 588
-#define _gloffset_GetInteger64v 589
-#define _gloffset_GetSynciv 590
-#define _gloffset_IsSync 591
-#define _gloffset_WaitSync 592
-#define _gloffset_DrawElementsBaseVertex 593
-#define _gloffset_DrawElementsInstancedBaseVertex 594
-#define _gloffset_DrawRangeElementsBaseVertex 595
-#define _gloffset_MultiDrawElementsBaseVertex 596
-#define _gloffset_BlendEquationSeparateiARB 597
-#define _gloffset_BlendEquationiARB 598
-#define _gloffset_BlendFuncSeparateiARB 599
-#define _gloffset_BlendFunciARB 600
-#define _gloffset_BindSampler 601
-#define _gloffset_DeleteSamplers 602
-#define _gloffset_GenSamplers 603
-#define _gloffset_GetSamplerParameterIiv 604
-#define _gloffset_GetSamplerParameterIuiv 605
-#define _gloffset_GetSamplerParameterfv 606
-#define _gloffset_GetSamplerParameteriv 607
-#define _gloffset_IsSampler 608
-#define _gloffset_SamplerParameterIiv 609
-#define _gloffset_SamplerParameterIuiv 610
-#define _gloffset_SamplerParameterf 611
-#define _gloffset_SamplerParameterfv 612
-#define _gloffset_SamplerParameteri 613
-#define _gloffset_SamplerParameteriv 614
-#define _gloffset_ColorP3ui 615
-#define _gloffset_ColorP3uiv 616
-#define _gloffset_ColorP4ui 617
-#define _gloffset_ColorP4uiv 618
-#define _gloffset_MultiTexCoordP1ui 619
-#define _gloffset_MultiTexCoordP1uiv 620
-#define _gloffset_MultiTexCoordP2ui 621
-#define _gloffset_MultiTexCoordP2uiv 622
-#define _gloffset_MultiTexCoordP3ui 623
-#define _gloffset_MultiTexCoordP3uiv 624
-#define _gloffset_MultiTexCoordP4ui 625
-#define _gloffset_MultiTexCoordP4uiv 626
-#define _gloffset_NormalP3ui 627
-#define _gloffset_NormalP3uiv 628
-#define _gloffset_SecondaryColorP3ui 629
-#define _gloffset_SecondaryColorP3uiv 630
-#define _gloffset_TexCoordP1ui 631
-#define _gloffset_TexCoordP1uiv 632
-#define _gloffset_TexCoordP2ui 633
-#define _gloffset_TexCoordP2uiv 634
-#define _gloffset_TexCoordP3ui 635
-#define _gloffset_TexCoordP3uiv 636
-#define _gloffset_TexCoordP4ui 637
-#define _gloffset_TexCoordP4uiv 638
-#define _gloffset_VertexAttribP1ui 639
-#define _gloffset_VertexAttribP1uiv 640
-#define _gloffset_VertexAttribP2ui 641
-#define _gloffset_VertexAttribP2uiv 642
-#define _gloffset_VertexAttribP3ui 643
-#define _gloffset_VertexAttribP3uiv 644
-#define _gloffset_VertexAttribP4ui 645
-#define _gloffset_VertexAttribP4uiv 646
-#define _gloffset_VertexP2ui 647
-#define _gloffset_VertexP2uiv 648
-#define _gloffset_VertexP3ui 649
-#define _gloffset_VertexP3uiv 650
-#define _gloffset_VertexP4ui 651
-#define _gloffset_VertexP4uiv 652
-#define _gloffset_BindTransformFeedback 653
-#define _gloffset_DeleteTransformFeedbacks 654
-#define _gloffset_DrawTransformFeedback 655
-#define _gloffset_GenTransformFeedbacks 656
-#define _gloffset_IsTransformFeedback 657
-#define _gloffset_PauseTransformFeedback 658
-#define _gloffset_ResumeTransformFeedback 659
-#define _gloffset_ClearDepthf 660
-#define _gloffset_DepthRangef 661
-#define _gloffset_GetShaderPrecisionFormat 662
-#define _gloffset_ReleaseShaderCompiler 663
-#define _gloffset_ShaderBinary 664
-#define _gloffset_DebugMessageCallbackARB 665
-#define _gloffset_DebugMessageControlARB 666
-#define _gloffset_DebugMessageInsertARB 667
-#define _gloffset_GetDebugMessageLogARB 668
-#define _gloffset_GetGraphicsResetStatusARB 669
-#define _gloffset_GetnColorTableARB 670
-#define _gloffset_GetnCompressedTexImageARB 671
-#define _gloffset_GetnConvolutionFilterARB 672
-#define _gloffset_GetnHistogramARB 673
-#define _gloffset_GetnMapdvARB 674
-#define _gloffset_GetnMapfvARB 675
-#define _gloffset_GetnMapivARB 676
-#define _gloffset_GetnMinmaxARB 677
-#define _gloffset_GetnPixelMapfvARB 678
-#define _gloffset_GetnPixelMapuivARB 679
-#define _gloffset_GetnPixelMapusvARB 680
-#define _gloffset_GetnPolygonStippleARB 681
-#define _gloffset_GetnSeparableFilterARB 682
-#define _gloffset_GetnTexImageARB 683
-#define _gloffset_GetnUniformdvARB 684
-#define _gloffset_GetnUniformfvARB 685
-#define _gloffset_GetnUniformivARB 686
-#define _gloffset_GetnUniformuivARB 687
-#define _gloffset_ReadnPixelsARB 688
-#define _gloffset_TexStorage1D 689
-#define _gloffset_TexStorage2D 690
-#define _gloffset_TexStorage3D 691
-#define _gloffset_TextureStorage1DEXT 692
-#define _gloffset_TextureStorage2DEXT 693
-#define _gloffset_TextureStorage3DEXT 694
-#define _gloffset_PolygonOffsetEXT 695
-#define _gloffset_GetPixelTexGenParameterfvSGIS 696
-#define _gloffset_GetPixelTexGenParameterivSGIS 697
-#define _gloffset_PixelTexGenParameterfSGIS 698
-#define _gloffset_PixelTexGenParameterfvSGIS 699
-#define _gloffset_PixelTexGenParameteriSGIS 700
-#define _gloffset_PixelTexGenParameterivSGIS 701
-#define _gloffset_SampleMaskSGIS 702
-#define _gloffset_SamplePatternSGIS 703
-#define _gloffset_ColorPointerEXT 704
-#define _gloffset_EdgeFlagPointerEXT 705
-#define _gloffset_IndexPointerEXT 706
-#define _gloffset_NormalPointerEXT 707
-#define _gloffset_TexCoordPointerEXT 708
-#define _gloffset_VertexPointerEXT 709
-#define _gloffset_PointParameterfEXT 710
-#define _gloffset_PointParameterfvEXT 711
-#define _gloffset_LockArraysEXT 712
-#define _gloffset_UnlockArraysEXT 713
-#define _gloffset_SecondaryColor3bEXT 714
-#define _gloffset_SecondaryColor3bvEXT 715
-#define _gloffset_SecondaryColor3dEXT 716
-#define _gloffset_SecondaryColor3dvEXT 717
-#define _gloffset_SecondaryColor3fEXT 718
-#define _gloffset_SecondaryColor3fvEXT 719
-#define _gloffset_SecondaryColor3iEXT 720
-#define _gloffset_SecondaryColor3ivEXT 721
-#define _gloffset_SecondaryColor3sEXT 722
-#define _gloffset_SecondaryColor3svEXT 723
-#define _gloffset_SecondaryColor3ubEXT 724
-#define _gloffset_SecondaryColor3ubvEXT 725
-#define _gloffset_SecondaryColor3uiEXT 726
-#define _gloffset_SecondaryColor3uivEXT 727
-#define _gloffset_SecondaryColor3usEXT 728
-#define _gloffset_SecondaryColor3usvEXT 729
-#define _gloffset_SecondaryColorPointerEXT 730
-#define _gloffset_MultiDrawArraysEXT 731
-#define _gloffset_MultiDrawElementsEXT 732
-#define _gloffset_FogCoordPointerEXT 733
-#define _gloffset_FogCoorddEXT 734
-#define _gloffset_FogCoorddvEXT 735
-#define _gloffset_FogCoordfEXT 736
-#define _gloffset_FogCoordfvEXT 737
-#define _gloffset_PixelTexGenSGIX 738
-#define _gloffset_BlendFuncSeparateEXT 739
-#define _gloffset_FlushVertexArrayRangeNV 740
-#define _gloffset_VertexArrayRangeNV 741
-#define _gloffset_CombinerInputNV 742
-#define _gloffset_CombinerOutputNV 743
-#define _gloffset_CombinerParameterfNV 744
-#define _gloffset_CombinerParameterfvNV 745
-#define _gloffset_CombinerParameteriNV 746
-#define _gloffset_CombinerParameterivNV 747
-#define _gloffset_FinalCombinerInputNV 748
-#define _gloffset_GetCombinerInputParameterfvNV 749
-#define _gloffset_GetCombinerInputParameterivNV 750
-#define _gloffset_GetCombinerOutputParameterfvNV 751
-#define _gloffset_GetCombinerOutputParameterivNV 752
-#define _gloffset_GetFinalCombinerInputParameterfvNV 753
-#define _gloffset_GetFinalCombinerInputParameterivNV 754
-#define _gloffset_ResizeBuffersMESA 755
-#define _gloffset_WindowPos2dMESA 756
-#define _gloffset_WindowPos2dvMESA 757
-#define _gloffset_WindowPos2fMESA 758
-#define _gloffset_WindowPos2fvMESA 759
-#define _gloffset_WindowPos2iMESA 760
-#define _gloffset_WindowPos2ivMESA 761
-#define _gloffset_WindowPos2sMESA 762
-#define _gloffset_WindowPos2svMESA 763
-#define _gloffset_WindowPos3dMESA 764
-#define _gloffset_WindowPos3dvMESA 765
-#define _gloffset_WindowPos3fMESA 766
-#define _gloffset_WindowPos3fvMESA 767
-#define _gloffset_WindowPos3iMESA 768
-#define _gloffset_WindowPos3ivMESA 769
-#define _gloffset_WindowPos3sMESA 770
-#define _gloffset_WindowPos3svMESA 771
-#define _gloffset_WindowPos4dMESA 772
-#define _gloffset_WindowPos4dvMESA 773
-#define _gloffset_WindowPos4fMESA 774
-#define _gloffset_WindowPos4fvMESA 775
-#define _gloffset_WindowPos4iMESA 776
-#define _gloffset_WindowPos4ivMESA 777
-#define _gloffset_WindowPos4sMESA 778
-#define _gloffset_WindowPos4svMESA 779
-#define _gloffset_MultiModeDrawArraysIBM 780
-#define _gloffset_MultiModeDrawElementsIBM 781
-#define _gloffset_DeleteFencesNV 782
-#define _gloffset_FinishFenceNV 783
-#define _gloffset_GenFencesNV 784
-#define _gloffset_GetFenceivNV 785
-#define _gloffset_IsFenceNV 786
-#define _gloffset_SetFenceNV 787
-#define _gloffset_TestFenceNV 788
-#define _gloffset_AreProgramsResidentNV 789
-#define _gloffset_BindProgramNV 790
-#define _gloffset_DeleteProgramsNV 791
-#define _gloffset_ExecuteProgramNV 792
-#define _gloffset_GenProgramsNV 793
-#define _gloffset_GetProgramParameterdvNV 794
-#define _gloffset_GetProgramParameterfvNV 795
-#define _gloffset_GetProgramStringNV 796
-#define _gloffset_GetProgramivNV 797
-#define _gloffset_GetTrackMatrixivNV 798
-#define _gloffset_GetVertexAttribPointervNV 799
-#define _gloffset_GetVertexAttribdvNV 800
-#define _gloffset_GetVertexAttribfvNV 801
-#define _gloffset_GetVertexAttribivNV 802
-#define _gloffset_IsProgramNV 803
-#define _gloffset_LoadProgramNV 804
-#define _gloffset_ProgramParameters4dvNV 805
-#define _gloffset_ProgramParameters4fvNV 806
-#define _gloffset_RequestResidentProgramsNV 807
-#define _gloffset_TrackMatrixNV 808
-#define _gloffset_VertexAttrib1dNV 809
-#define _gloffset_VertexAttrib1dvNV 810
-#define _gloffset_VertexAttrib1fNV 811
-#define _gloffset_VertexAttrib1fvNV 812
-#define _gloffset_VertexAttrib1sNV 813
-#define _gloffset_VertexAttrib1svNV 814
-#define _gloffset_VertexAttrib2dNV 815
-#define _gloffset_VertexAttrib2dvNV 816
-#define _gloffset_VertexAttrib2fNV 817
-#define _gloffset_VertexAttrib2fvNV 818
-#define _gloffset_VertexAttrib2sNV 819
-#define _gloffset_VertexAttrib2svNV 820
-#define _gloffset_VertexAttrib3dNV 821
-#define _gloffset_VertexAttrib3dvNV 822
-#define _gloffset_VertexAttrib3fNV 823
-#define _gloffset_VertexAttrib3fvNV 824
-#define _gloffset_VertexAttrib3sNV 825
-#define _gloffset_VertexAttrib3svNV 826
-#define _gloffset_VertexAttrib4dNV 827
-#define _gloffset_VertexAttrib4dvNV 828
-#define _gloffset_VertexAttrib4fNV 829
-#define _gloffset_VertexAttrib4fvNV 830
-#define _gloffset_VertexAttrib4sNV 831
-#define _gloffset_VertexAttrib4svNV 832
-#define _gloffset_VertexAttrib4ubNV 833
-#define _gloffset_VertexAttrib4ubvNV 834
-#define _gloffset_VertexAttribPointerNV 835
-#define _gloffset_VertexAttribs1dvNV 836
-#define _gloffset_VertexAttribs1fvNV 837
-#define _gloffset_VertexAttribs1svNV 838
-#define _gloffset_VertexAttribs2dvNV 839
-#define _gloffset_VertexAttribs2fvNV 840
-#define _gloffset_VertexAttribs2svNV 841
-#define _gloffset_VertexAttribs3dvNV 842
-#define _gloffset_VertexAttribs3fvNV 843
-#define _gloffset_VertexAttribs3svNV 844
-#define _gloffset_VertexAttribs4dvNV 845
-#define _gloffset_VertexAttribs4fvNV 846
-#define _gloffset_VertexAttribs4svNV 847
-#define _gloffset_VertexAttribs4ubvNV 848
-#define _gloffset_GetTexBumpParameterfvATI 849
-#define _gloffset_GetTexBumpParameterivATI 850
-#define _gloffset_TexBumpParameterfvATI 851
-#define _gloffset_TexBumpParameterivATI 852
-#define _gloffset_AlphaFragmentOp1ATI 853
-#define _gloffset_AlphaFragmentOp2ATI 854
-#define _gloffset_AlphaFragmentOp3ATI 855
-#define _gloffset_BeginFragmentShaderATI 856
-#define _gloffset_BindFragmentShaderATI 857
-#define _gloffset_ColorFragmentOp1ATI 858
-#define _gloffset_ColorFragmentOp2ATI 859
-#define _gloffset_ColorFragmentOp3ATI 860
-#define _gloffset_DeleteFragmentShaderATI 861
-#define _gloffset_EndFragmentShaderATI 862
-#define _gloffset_GenFragmentShadersATI 863
-#define _gloffset_PassTexCoordATI 864
-#define _gloffset_SampleMapATI 865
-#define _gloffset_SetFragmentShaderConstantATI 866
-#define _gloffset_PointParameteriNV 867
-#define _gloffset_PointParameterivNV 868
-#define _gloffset_ActiveStencilFaceEXT 869
-#define _gloffset_BindVertexArrayAPPLE 870
-#define _gloffset_DeleteVertexArraysAPPLE 871
-#define _gloffset_GenVertexArraysAPPLE 872
-#define _gloffset_IsVertexArrayAPPLE 873
-#define _gloffset_GetProgramNamedParameterdvNV 874
-#define _gloffset_GetProgramNamedParameterfvNV 875
-#define _gloffset_ProgramNamedParameter4dNV 876
-#define _gloffset_ProgramNamedParameter4dvNV 877
-#define _gloffset_ProgramNamedParameter4fNV 878
-#define _gloffset_ProgramNamedParameter4fvNV 879
-#define _gloffset_PrimitiveRestartIndexNV 880
-#define _gloffset_PrimitiveRestartNV 881
-#define _gloffset_DepthBoundsEXT 882
-#define _gloffset_BlendEquationSeparateEXT 883
-#define _gloffset_BindFramebufferEXT 884
-#define _gloffset_BindRenderbufferEXT 885
-#define _gloffset_CheckFramebufferStatusEXT 886
-#define _gloffset_DeleteFramebuffersEXT 887
-#define _gloffset_DeleteRenderbuffersEXT 888
-#define _gloffset_FramebufferRenderbufferEXT 889
-#define _gloffset_FramebufferTexture1DEXT 890
-#define _gloffset_FramebufferTexture2DEXT 891
-#define _gloffset_FramebufferTexture3DEXT 892
-#define _gloffset_GenFramebuffersEXT 893
-#define _gloffset_GenRenderbuffersEXT 894
-#define _gloffset_GenerateMipmapEXT 895
-#define _gloffset_GetFramebufferAttachmentParameterivEXT 896
-#define _gloffset_GetRenderbufferParameterivEXT 897
-#define _gloffset_IsFramebufferEXT 898
-#define _gloffset_IsRenderbufferEXT 899
-#define _gloffset_RenderbufferStorageEXT 900
-#define _gloffset_BlitFramebufferEXT 901
-#define _gloffset_BufferParameteriAPPLE 902
-#define _gloffset_FlushMappedBufferRangeAPPLE 903
-#define _gloffset_BindFragDataLocationEXT 904
-#define _gloffset_GetFragDataLocationEXT 905
-#define _gloffset_GetUniformuivEXT 906
-#define _gloffset_GetVertexAttribIivEXT 907
-#define _gloffset_GetVertexAttribIuivEXT 908
-#define _gloffset_Uniform1uiEXT 909
-#define _gloffset_Uniform1uivEXT 910
-#define _gloffset_Uniform2uiEXT 911
-#define _gloffset_Uniform2uivEXT 912
-#define _gloffset_Uniform3uiEXT 913
-#define _gloffset_Uniform3uivEXT 914
-#define _gloffset_Uniform4uiEXT 915
-#define _gloffset_Uniform4uivEXT 916
-#define _gloffset_VertexAttribI1iEXT 917
-#define _gloffset_VertexAttribI1ivEXT 918
-#define _gloffset_VertexAttribI1uiEXT 919
-#define _gloffset_VertexAttribI1uivEXT 920
-#define _gloffset_VertexAttribI2iEXT 921
-#define _gloffset_VertexAttribI2ivEXT 922
-#define _gloffset_VertexAttribI2uiEXT 923
-#define _gloffset_VertexAttribI2uivEXT 924
-#define _gloffset_VertexAttribI3iEXT 925
-#define _gloffset_VertexAttribI3ivEXT 926
-#define _gloffset_VertexAttribI3uiEXT 927
-#define _gloffset_VertexAttribI3uivEXT 928
-#define _gloffset_VertexAttribI4bvEXT 929
-#define _gloffset_VertexAttribI4iEXT 930
-#define _gloffset_VertexAttribI4ivEXT 931
-#define _gloffset_VertexAttribI4svEXT 932
-#define _gloffset_VertexAttribI4ubvEXT 933
-#define _gloffset_VertexAttribI4uiEXT 934
-#define _gloffset_VertexAttribI4uivEXT 935
-#define _gloffset_VertexAttribI4usvEXT 936
-#define _gloffset_VertexAttribIPointerEXT 937
-#define _gloffset_FramebufferTextureLayerEXT 938
-#define _gloffset_ColorMaskIndexedEXT 939
-#define _gloffset_DisableIndexedEXT 940
-#define _gloffset_EnableIndexedEXT 941
-#define _gloffset_GetBooleanIndexedvEXT 942
-#define _gloffset_GetIntegerIndexedvEXT 943
-#define _gloffset_IsEnabledIndexedEXT 944
-#define _gloffset_ClearColorIiEXT 945
-#define _gloffset_ClearColorIuiEXT 946
-#define _gloffset_GetTexParameterIivEXT 947
-#define _gloffset_GetTexParameterIuivEXT 948
-#define _gloffset_TexParameterIivEXT 949
-#define _gloffset_TexParameterIuivEXT 950
-#define _gloffset_BeginConditionalRenderNV 951
-#define _gloffset_EndConditionalRenderNV 952
-#define _gloffset_BeginTransformFeedbackEXT 953
-#define _gloffset_BindBufferBaseEXT 954
-#define _gloffset_BindBufferOffsetEXT 955
-#define _gloffset_BindBufferRangeEXT 956
-#define _gloffset_EndTransformFeedbackEXT 957
-#define _gloffset_GetTransformFeedbackVaryingEXT 958
-#define _gloffset_TransformFeedbackVaryingsEXT 959
-#define _gloffset_ProvokingVertexEXT 960
-#define _gloffset_GetTexParameterPointervAPPLE 961
-#define _gloffset_TextureRangeAPPLE 962
-#define _gloffset_GetObjectParameterivAPPLE 963
-#define _gloffset_ObjectPurgeableAPPLE 964
-#define _gloffset_ObjectUnpurgeableAPPLE 965
-#define _gloffset_ActiveProgramEXT 966
-#define _gloffset_CreateShaderProgramEXT 967
-#define _gloffset_UseShaderProgramEXT 968
-#define _gloffset_TextureBarrierNV 969
-#define _gloffset_StencilFuncSeparateATI 970
-#define _gloffset_ProgramEnvParameters4fvEXT 971
-#define _gloffset_ProgramLocalParameters4fvEXT 972
-#define _gloffset_GetQueryObjecti64vEXT 973
-#define _gloffset_GetQueryObjectui64vEXT 974
-#define _gloffset_EGLImageTargetRenderbufferStorageOES 975
-#define _gloffset_EGLImageTargetTexture2DOES 976
-
-#else /* !FEATURE_remap_table */
-
-#define driDispatchRemapTable_size 569
-extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
-
-#define AttachShader_remap_index 0
-#define CreateProgram_remap_index 1
-#define CreateShader_remap_index 2
-#define DeleteProgram_remap_index 3
-#define DeleteShader_remap_index 4
-#define DetachShader_remap_index 5
-#define GetAttachedShaders_remap_index 6
-#define GetProgramInfoLog_remap_index 7
-#define GetProgramiv_remap_index 8
-#define GetShaderInfoLog_remap_index 9
-#define GetShaderiv_remap_index 10
-#define IsProgram_remap_index 11
-#define IsShader_remap_index 12
-#define StencilFuncSeparate_remap_index 13
-#define StencilMaskSeparate_remap_index 14
-#define StencilOpSeparate_remap_index 15
-#define UniformMatrix2x3fv_remap_index 16
-#define UniformMatrix2x4fv_remap_index 17
-#define UniformMatrix3x2fv_remap_index 18
-#define UniformMatrix3x4fv_remap_index 19
-#define UniformMatrix4x2fv_remap_index 20
-#define UniformMatrix4x3fv_remap_index 21
-#define ClampColor_remap_index 22
-#define ClearBufferfi_remap_index 23
-#define ClearBufferfv_remap_index 24
-#define ClearBufferiv_remap_index 25
-#define ClearBufferuiv_remap_index 26
-#define GetStringi_remap_index 27
-#define TexBuffer_remap_index 28
-#define FramebufferTexture_remap_index 29
-#define GetBufferParameteri64v_remap_index 30
-#define GetInteger64i_v_remap_index 31
-#define VertexAttribDivisor_remap_index 32
-#define LoadTransposeMatrixdARB_remap_index 33
-#define LoadTransposeMatrixfARB_remap_index 34
-#define MultTransposeMatrixdARB_remap_index 35
-#define MultTransposeMatrixfARB_remap_index 36
-#define SampleCoverageARB_remap_index 37
-#define CompressedTexImage1DARB_remap_index 38
-#define CompressedTexImage2DARB_remap_index 39
-#define CompressedTexImage3DARB_remap_index 40
-#define CompressedTexSubImage1DARB_remap_index 41
-#define CompressedTexSubImage2DARB_remap_index 42
-#define CompressedTexSubImage3DARB_remap_index 43
-#define GetCompressedTexImageARB_remap_index 44
-#define DisableVertexAttribArrayARB_remap_index 45
-#define EnableVertexAttribArrayARB_remap_index 46
-#define GetProgramEnvParameterdvARB_remap_index 47
-#define GetProgramEnvParameterfvARB_remap_index 48
-#define GetProgramLocalParameterdvARB_remap_index 49
-#define GetProgramLocalParameterfvARB_remap_index 50
-#define GetProgramStringARB_remap_index 51
-#define GetProgramivARB_remap_index 52
-#define GetVertexAttribdvARB_remap_index 53
-#define GetVertexAttribfvARB_remap_index 54
-#define GetVertexAttribivARB_remap_index 55
-#define ProgramEnvParameter4dARB_remap_index 56
-#define ProgramEnvParameter4dvARB_remap_index 57
-#define ProgramEnvParameter4fARB_remap_index 58
-#define ProgramEnvParameter4fvARB_remap_index 59
-#define ProgramLocalParameter4dARB_remap_index 60
-#define ProgramLocalParameter4dvARB_remap_index 61
-#define ProgramLocalParameter4fARB_remap_index 62
-#define ProgramLocalParameter4fvARB_remap_index 63
-#define ProgramStringARB_remap_index 64
-#define VertexAttrib1dARB_remap_index 65
-#define VertexAttrib1dvARB_remap_index 66
-#define VertexAttrib1fARB_remap_index 67
-#define VertexAttrib1fvARB_remap_index 68
-#define VertexAttrib1sARB_remap_index 69
-#define VertexAttrib1svARB_remap_index 70
-#define VertexAttrib2dARB_remap_index 71
-#define VertexAttrib2dvARB_remap_index 72
-#define VertexAttrib2fARB_remap_index 73
-#define VertexAttrib2fvARB_remap_index 74
-#define VertexAttrib2sARB_remap_index 75
-#define VertexAttrib2svARB_remap_index 76
-#define VertexAttrib3dARB_remap_index 77
-#define VertexAttrib3dvARB_remap_index 78
-#define VertexAttrib3fARB_remap_index 79
-#define VertexAttrib3fvARB_remap_index 80
-#define VertexAttrib3sARB_remap_index 81
-#define VertexAttrib3svARB_remap_index 82
-#define VertexAttrib4NbvARB_remap_index 83
-#define VertexAttrib4NivARB_remap_index 84
-#define VertexAttrib4NsvARB_remap_index 85
-#define VertexAttrib4NubARB_remap_index 86
-#define VertexAttrib4NubvARB_remap_index 87
-#define VertexAttrib4NuivARB_remap_index 88
-#define VertexAttrib4NusvARB_remap_index 89
-#define VertexAttrib4bvARB_remap_index 90
-#define VertexAttrib4dARB_remap_index 91
-#define VertexAttrib4dvARB_remap_index 92
-#define VertexAttrib4fARB_remap_index 93
-#define VertexAttrib4fvARB_remap_index 94
-#define VertexAttrib4ivARB_remap_index 95
-#define VertexAttrib4sARB_remap_index 96
-#define VertexAttrib4svARB_remap_index 97
-#define VertexAttrib4ubvARB_remap_index 98
-#define VertexAttrib4uivARB_remap_index 99
-#define VertexAttrib4usvARB_remap_index 100
-#define VertexAttribPointerARB_remap_index 101
-#define BindBufferARB_remap_index 102
-#define BufferDataARB_remap_index 103
-#define BufferSubDataARB_remap_index 104
-#define DeleteBuffersARB_remap_index 105
-#define GenBuffersARB_remap_index 106
-#define GetBufferParameterivARB_remap_index 107
-#define GetBufferPointervARB_remap_index 108
-#define GetBufferSubDataARB_remap_index 109
-#define IsBufferARB_remap_index 110
-#define MapBufferARB_remap_index 111
-#define UnmapBufferARB_remap_index 112
-#define BeginQueryARB_remap_index 113
-#define DeleteQueriesARB_remap_index 114
-#define EndQueryARB_remap_index 115
-#define GenQueriesARB_remap_index 116
-#define GetQueryObjectivARB_remap_index 117
-#define GetQueryObjectuivARB_remap_index 118
-#define GetQueryivARB_remap_index 119
-#define IsQueryARB_remap_index 120
-#define AttachObjectARB_remap_index 121
-#define CompileShaderARB_remap_index 122
-#define CreateProgramObjectARB_remap_index 123
-#define CreateShaderObjectARB_remap_index 124
-#define DeleteObjectARB_remap_index 125
-#define DetachObjectARB_remap_index 126
-#define GetActiveUniformARB_remap_index 127
-#define GetAttachedObjectsARB_remap_index 128
-#define GetHandleARB_remap_index 129
-#define GetInfoLogARB_remap_index 130
-#define GetObjectParameterfvARB_remap_index 131
-#define GetObjectParameterivARB_remap_index 132
-#define GetShaderSourceARB_remap_index 133
-#define GetUniformLocationARB_remap_index 134
-#define GetUniformfvARB_remap_index 135
-#define GetUniformivARB_remap_index 136
-#define LinkProgramARB_remap_index 137
-#define ShaderSourceARB_remap_index 138
-#define Uniform1fARB_remap_index 139
-#define Uniform1fvARB_remap_index 140
-#define Uniform1iARB_remap_index 141
-#define Uniform1ivARB_remap_index 142
-#define Uniform2fARB_remap_index 143
-#define Uniform2fvARB_remap_index 144
-#define Uniform2iARB_remap_index 145
-#define Uniform2ivARB_remap_index 146
-#define Uniform3fARB_remap_index 147
-#define Uniform3fvARB_remap_index 148
-#define Uniform3iARB_remap_index 149
-#define Uniform3ivARB_remap_index 150
-#define Uniform4fARB_remap_index 151
-#define Uniform4fvARB_remap_index 152
-#define Uniform4iARB_remap_index 153
-#define Uniform4ivARB_remap_index 154
-#define UniformMatrix2fvARB_remap_index 155
-#define UniformMatrix3fvARB_remap_index 156
-#define UniformMatrix4fvARB_remap_index 157
-#define UseProgramObjectARB_remap_index 158
-#define ValidateProgramARB_remap_index 159
-#define BindAttribLocationARB_remap_index 160
-#define GetActiveAttribARB_remap_index 161
-#define GetAttribLocationARB_remap_index 162
-#define DrawBuffersARB_remap_index 163
-#define ClampColorARB_remap_index 164
-#define DrawArraysInstancedARB_remap_index 165
-#define DrawElementsInstancedARB_remap_index 166
-#define RenderbufferStorageMultisample_remap_index 167
-#define FramebufferTextureARB_remap_index 168
-#define FramebufferTextureFaceARB_remap_index 169
-#define ProgramParameteriARB_remap_index 170
-#define VertexAttribDivisorARB_remap_index 171
-#define FlushMappedBufferRange_remap_index 172
-#define MapBufferRange_remap_index 173
-#define TexBufferARB_remap_index 174
-#define BindVertexArray_remap_index 175
-#define GenVertexArrays_remap_index 176
-#define CopyBufferSubData_remap_index 177
-#define ClientWaitSync_remap_index 178
-#define DeleteSync_remap_index 179
-#define FenceSync_remap_index 180
-#define GetInteger64v_remap_index 181
-#define GetSynciv_remap_index 182
-#define IsSync_remap_index 183
-#define WaitSync_remap_index 184
-#define DrawElementsBaseVertex_remap_index 185
-#define DrawElementsInstancedBaseVertex_remap_index 186
-#define DrawRangeElementsBaseVertex_remap_index 187
-#define MultiDrawElementsBaseVertex_remap_index 188
-#define BlendEquationSeparateiARB_remap_index 189
-#define BlendEquationiARB_remap_index 190
-#define BlendFuncSeparateiARB_remap_index 191
-#define BlendFunciARB_remap_index 192
-#define BindSampler_remap_index 193
-#define DeleteSamplers_remap_index 194
-#define GenSamplers_remap_index 195
-#define GetSamplerParameterIiv_remap_index 196
-#define GetSamplerParameterIuiv_remap_index 197
-#define GetSamplerParameterfv_remap_index 198
-#define GetSamplerParameteriv_remap_index 199
-#define IsSampler_remap_index 200
-#define SamplerParameterIiv_remap_index 201
-#define SamplerParameterIuiv_remap_index 202
-#define SamplerParameterf_remap_index 203
-#define SamplerParameterfv_remap_index 204
-#define SamplerParameteri_remap_index 205
-#define SamplerParameteriv_remap_index 206
-#define ColorP3ui_remap_index 207
-#define ColorP3uiv_remap_index 208
-#define ColorP4ui_remap_index 209
-#define ColorP4uiv_remap_index 210
-#define MultiTexCoordP1ui_remap_index 211
-#define MultiTexCoordP1uiv_remap_index 212
-#define MultiTexCoordP2ui_remap_index 213
-#define MultiTexCoordP2uiv_remap_index 214
-#define MultiTexCoordP3ui_remap_index 215
-#define MultiTexCoordP3uiv_remap_index 216
-#define MultiTexCoordP4ui_remap_index 217
-#define MultiTexCoordP4uiv_remap_index 218
-#define NormalP3ui_remap_index 219
-#define NormalP3uiv_remap_index 220
-#define SecondaryColorP3ui_remap_index 221
-#define SecondaryColorP3uiv_remap_index 222
-#define TexCoordP1ui_remap_index 223
-#define TexCoordP1uiv_remap_index 224
-#define TexCoordP2ui_remap_index 225
-#define TexCoordP2uiv_remap_index 226
-#define TexCoordP3ui_remap_index 227
-#define TexCoordP3uiv_remap_index 228
-#define TexCoordP4ui_remap_index 229
-#define TexCoordP4uiv_remap_index 230
-#define VertexAttribP1ui_remap_index 231
-#define VertexAttribP1uiv_remap_index 232
-#define VertexAttribP2ui_remap_index 233
-#define VertexAttribP2uiv_remap_index 234
-#define VertexAttribP3ui_remap_index 235
-#define VertexAttribP3uiv_remap_index 236
-#define VertexAttribP4ui_remap_index 237
-#define VertexAttribP4uiv_remap_index 238
-#define VertexP2ui_remap_index 239
-#define VertexP2uiv_remap_index 240
-#define VertexP3ui_remap_index 241
-#define VertexP3uiv_remap_index 242
-#define VertexP4ui_remap_index 243
-#define VertexP4uiv_remap_index 244
-#define BindTransformFeedback_remap_index 245
-#define DeleteTransformFeedbacks_remap_index 246
-#define DrawTransformFeedback_remap_index 247
-#define GenTransformFeedbacks_remap_index 248
-#define IsTransformFeedback_remap_index 249
-#define PauseTransformFeedback_remap_index 250
-#define ResumeTransformFeedback_remap_index 251
-#define ClearDepthf_remap_index 252
-#define DepthRangef_remap_index 253
-#define GetShaderPrecisionFormat_remap_index 254
-#define ReleaseShaderCompiler_remap_index 255
-#define ShaderBinary_remap_index 256
-#define DebugMessageCallbackARB_remap_index 257
-#define DebugMessageControlARB_remap_index 258
-#define DebugMessageInsertARB_remap_index 259
-#define GetDebugMessageLogARB_remap_index 260
-#define GetGraphicsResetStatusARB_remap_index 261
-#define GetnColorTableARB_remap_index 262
-#define GetnCompressedTexImageARB_remap_index 263
-#define GetnConvolutionFilterARB_remap_index 264
-#define GetnHistogramARB_remap_index 265
-#define GetnMapdvARB_remap_index 266
-#define GetnMapfvARB_remap_index 267
-#define GetnMapivARB_remap_index 268
-#define GetnMinmaxARB_remap_index 269
-#define GetnPixelMapfvARB_remap_index 270
-#define GetnPixelMapuivARB_remap_index 271
-#define GetnPixelMapusvARB_remap_index 272
-#define GetnPolygonStippleARB_remap_index 273
-#define GetnSeparableFilterARB_remap_index 274
-#define GetnTexImageARB_remap_index 275
-#define GetnUniformdvARB_remap_index 276
-#define GetnUniformfvARB_remap_index 277
-#define GetnUniformivARB_remap_index 278
-#define GetnUniformuivARB_remap_index 279
-#define ReadnPixelsARB_remap_index 280
-#define TexStorage1D_remap_index 281
-#define TexStorage2D_remap_index 282
-#define TexStorage3D_remap_index 283
-#define TextureStorage1DEXT_remap_index 284
-#define TextureStorage2DEXT_remap_index 285
-#define TextureStorage3DEXT_remap_index 286
-#define PolygonOffsetEXT_remap_index 287
-#define GetPixelTexGenParameterfvSGIS_remap_index 288
-#define GetPixelTexGenParameterivSGIS_remap_index 289
-#define PixelTexGenParameterfSGIS_remap_index 290
-#define PixelTexGenParameterfvSGIS_remap_index 291
-#define PixelTexGenParameteriSGIS_remap_index 292
-#define PixelTexGenParameterivSGIS_remap_index 293
-#define SampleMaskSGIS_remap_index 294
-#define SamplePatternSGIS_remap_index 295
-#define ColorPointerEXT_remap_index 296
-#define EdgeFlagPointerEXT_remap_index 297
-#define IndexPointerEXT_remap_index 298
-#define NormalPointerEXT_remap_index 299
-#define TexCoordPointerEXT_remap_index 300
-#define VertexPointerEXT_remap_index 301
-#define PointParameterfEXT_remap_index 302
-#define PointParameterfvEXT_remap_index 303
-#define LockArraysEXT_remap_index 304
-#define UnlockArraysEXT_remap_index 305
-#define SecondaryColor3bEXT_remap_index 306
-#define SecondaryColor3bvEXT_remap_index 307
-#define SecondaryColor3dEXT_remap_index 308
-#define SecondaryColor3dvEXT_remap_index 309
-#define SecondaryColor3fEXT_remap_index 310
-#define SecondaryColor3fvEXT_remap_index 311
-#define SecondaryColor3iEXT_remap_index 312
-#define SecondaryColor3ivEXT_remap_index 313
-#define SecondaryColor3sEXT_remap_index 314
-#define SecondaryColor3svEXT_remap_index 315
-#define SecondaryColor3ubEXT_remap_index 316
-#define SecondaryColor3ubvEXT_remap_index 317
-#define SecondaryColor3uiEXT_remap_index 318
-#define SecondaryColor3uivEXT_remap_index 319
-#define SecondaryColor3usEXT_remap_index 320
-#define SecondaryColor3usvEXT_remap_index 321
-#define SecondaryColorPointerEXT_remap_index 322
-#define MultiDrawArraysEXT_remap_index 323
-#define MultiDrawElementsEXT_remap_index 324
-#define FogCoordPointerEXT_remap_index 325
-#define FogCoorddEXT_remap_index 326
-#define FogCoorddvEXT_remap_index 327
-#define FogCoordfEXT_remap_index 328
-#define FogCoordfvEXT_remap_index 329
-#define PixelTexGenSGIX_remap_index 330
-#define BlendFuncSeparateEXT_remap_index 331
-#define FlushVertexArrayRangeNV_remap_index 332
-#define VertexArrayRangeNV_remap_index 333
-#define CombinerInputNV_remap_index 334
-#define CombinerOutputNV_remap_index 335
-#define CombinerParameterfNV_remap_index 336
-#define CombinerParameterfvNV_remap_index 337
-#define CombinerParameteriNV_remap_index 338
-#define CombinerParameterivNV_remap_index 339
-#define FinalCombinerInputNV_remap_index 340
-#define GetCombinerInputParameterfvNV_remap_index 341
-#define GetCombinerInputParameterivNV_remap_index 342
-#define GetCombinerOutputParameterfvNV_remap_index 343
-#define GetCombinerOutputParameterivNV_remap_index 344
-#define GetFinalCombinerInputParameterfvNV_remap_index 345
-#define GetFinalCombinerInputParameterivNV_remap_index 346
-#define ResizeBuffersMESA_remap_index 347
-#define WindowPos2dMESA_remap_index 348
-#define WindowPos2dvMESA_remap_index 349
-#define WindowPos2fMESA_remap_index 350
-#define WindowPos2fvMESA_remap_index 351
-#define WindowPos2iMESA_remap_index 352
-#define WindowPos2ivMESA_remap_index 353
-#define WindowPos2sMESA_remap_index 354
-#define WindowPos2svMESA_remap_index 355
-#define WindowPos3dMESA_remap_index 356
-#define WindowPos3dvMESA_remap_index 357
-#define WindowPos3fMESA_remap_index 358
-#define WindowPos3fvMESA_remap_index 359
-#define WindowPos3iMESA_remap_index 360
-#define WindowPos3ivMESA_remap_index 361
-#define WindowPos3sMESA_remap_index 362
-#define WindowPos3svMESA_remap_index 363
-#define WindowPos4dMESA_remap_index 364
-#define WindowPos4dvMESA_remap_index 365
-#define WindowPos4fMESA_remap_index 366
-#define WindowPos4fvMESA_remap_index 367
-#define WindowPos4iMESA_remap_index 368
-#define WindowPos4ivMESA_remap_index 369
-#define WindowPos4sMESA_remap_index 370
-#define WindowPos4svMESA_remap_index 371
-#define MultiModeDrawArraysIBM_remap_index 372
-#define MultiModeDrawElementsIBM_remap_index 373
-#define DeleteFencesNV_remap_index 374
-#define FinishFenceNV_remap_index 375
-#define GenFencesNV_remap_index 376
-#define GetFenceivNV_remap_index 377
-#define IsFenceNV_remap_index 378
-#define SetFenceNV_remap_index 379
-#define TestFenceNV_remap_index 380
-#define AreProgramsResidentNV_remap_index 381
-#define BindProgramNV_remap_index 382
-#define DeleteProgramsNV_remap_index 383
-#define ExecuteProgramNV_remap_index 384
-#define GenProgramsNV_remap_index 385
-#define GetProgramParameterdvNV_remap_index 386
-#define GetProgramParameterfvNV_remap_index 387
-#define GetProgramStringNV_remap_index 388
-#define GetProgramivNV_remap_index 389
-#define GetTrackMatrixivNV_remap_index 390
-#define GetVertexAttribPointervNV_remap_index 391
-#define GetVertexAttribdvNV_remap_index 392
-#define GetVertexAttribfvNV_remap_index 393
-#define GetVertexAttribivNV_remap_index 394
-#define IsProgramNV_remap_index 395
-#define LoadProgramNV_remap_index 396
-#define ProgramParameters4dvNV_remap_index 397
-#define ProgramParameters4fvNV_remap_index 398
-#define RequestResidentProgramsNV_remap_index 399
-#define TrackMatrixNV_remap_index 400
-#define VertexAttrib1dNV_remap_index 401
-#define VertexAttrib1dvNV_remap_index 402
-#define VertexAttrib1fNV_remap_index 403
-#define VertexAttrib1fvNV_remap_index 404
-#define VertexAttrib1sNV_remap_index 405
-#define VertexAttrib1svNV_remap_index 406
-#define VertexAttrib2dNV_remap_index 407
-#define VertexAttrib2dvNV_remap_index 408
-#define VertexAttrib2fNV_remap_index 409
-#define VertexAttrib2fvNV_remap_index 410
-#define VertexAttrib2sNV_remap_index 411
-#define VertexAttrib2svNV_remap_index 412
-#define VertexAttrib3dNV_remap_index 413
-#define VertexAttrib3dvNV_remap_index 414
-#define VertexAttrib3fNV_remap_index 415
-#define VertexAttrib3fvNV_remap_index 416
-#define VertexAttrib3sNV_remap_index 417
-#define VertexAttrib3svNV_remap_index 418
-#define VertexAttrib4dNV_remap_index 419
-#define VertexAttrib4dvNV_remap_index 420
-#define VertexAttrib4fNV_remap_index 421
-#define VertexAttrib4fvNV_remap_index 422
-#define VertexAttrib4sNV_remap_index 423
-#define VertexAttrib4svNV_remap_index 424
-#define VertexAttrib4ubNV_remap_index 425
-#define VertexAttrib4ubvNV_remap_index 426
-#define VertexAttribPointerNV_remap_index 427
-#define VertexAttribs1dvNV_remap_index 428
-#define VertexAttribs1fvNV_remap_index 429
-#define VertexAttribs1svNV_remap_index 430
-#define VertexAttribs2dvNV_remap_index 431
-#define VertexAttribs2fvNV_remap_index 432
-#define VertexAttribs2svNV_remap_index 433
-#define VertexAttribs3dvNV_remap_index 434
-#define VertexAttribs3fvNV_remap_index 435
-#define VertexAttribs3svNV_remap_index 436
-#define VertexAttribs4dvNV_remap_index 437
-#define VertexAttribs4fvNV_remap_index 438
-#define VertexAttribs4svNV_remap_index 439
-#define VertexAttribs4ubvNV_remap_index 440
-#define GetTexBumpParameterfvATI_remap_index 441
-#define GetTexBumpParameterivATI_remap_index 442
-#define TexBumpParameterfvATI_remap_index 443
-#define TexBumpParameterivATI_remap_index 444
-#define AlphaFragmentOp1ATI_remap_index 445
-#define AlphaFragmentOp2ATI_remap_index 446
-#define AlphaFragmentOp3ATI_remap_index 447
-#define BeginFragmentShaderATI_remap_index 448
-#define BindFragmentShaderATI_remap_index 449
-#define ColorFragmentOp1ATI_remap_index 450
-#define ColorFragmentOp2ATI_remap_index 451
-#define ColorFragmentOp3ATI_remap_index 452
-#define DeleteFragmentShaderATI_remap_index 453
-#define EndFragmentShaderATI_remap_index 454
-#define GenFragmentShadersATI_remap_index 455
-#define PassTexCoordATI_remap_index 456
-#define SampleMapATI_remap_index 457
-#define SetFragmentShaderConstantATI_remap_index 458
-#define PointParameteriNV_remap_index 459
-#define PointParameterivNV_remap_index 460
-#define ActiveStencilFaceEXT_remap_index 461
-#define BindVertexArrayAPPLE_remap_index 462
-#define DeleteVertexArraysAPPLE_remap_index 463
-#define GenVertexArraysAPPLE_remap_index 464
-#define IsVertexArrayAPPLE_remap_index 465
-#define GetProgramNamedParameterdvNV_remap_index 466
-#define GetProgramNamedParameterfvNV_remap_index 467
-#define ProgramNamedParameter4dNV_remap_index 468
-#define ProgramNamedParameter4dvNV_remap_index 469
-#define ProgramNamedParameter4fNV_remap_index 470
-#define ProgramNamedParameter4fvNV_remap_index 471
-#define PrimitiveRestartIndexNV_remap_index 472
-#define PrimitiveRestartNV_remap_index 473
-#define DepthBoundsEXT_remap_index 474
-#define BlendEquationSeparateEXT_remap_index 475
-#define BindFramebufferEXT_remap_index 476
-#define BindRenderbufferEXT_remap_index 477
-#define CheckFramebufferStatusEXT_remap_index 478
-#define DeleteFramebuffersEXT_remap_index 479
-#define DeleteRenderbuffersEXT_remap_index 480
-#define FramebufferRenderbufferEXT_remap_index 481
-#define FramebufferTexture1DEXT_remap_index 482
-#define FramebufferTexture2DEXT_remap_index 483
-#define FramebufferTexture3DEXT_remap_index 484
-#define GenFramebuffersEXT_remap_index 485
-#define GenRenderbuffersEXT_remap_index 486
-#define GenerateMipmapEXT_remap_index 487
-#define GetFramebufferAttachmentParameterivEXT_remap_index 488
-#define GetRenderbufferParameterivEXT_remap_index 489
-#define IsFramebufferEXT_remap_index 490
-#define IsRenderbufferEXT_remap_index 491
-#define RenderbufferStorageEXT_remap_index 492
-#define BlitFramebufferEXT_remap_index 493
-#define BufferParameteriAPPLE_remap_index 494
-#define FlushMappedBufferRangeAPPLE_remap_index 495
-#define BindFragDataLocationEXT_remap_index 496
-#define GetFragDataLocationEXT_remap_index 497
-#define GetUniformuivEXT_remap_index 498
-#define GetVertexAttribIivEXT_remap_index 499
-#define GetVertexAttribIuivEXT_remap_index 500
-#define Uniform1uiEXT_remap_index 501
-#define Uniform1uivEXT_remap_index 502
-#define Uniform2uiEXT_remap_index 503
-#define Uniform2uivEXT_remap_index 504
-#define Uniform3uiEXT_remap_index 505
-#define Uniform3uivEXT_remap_index 506
-#define Uniform4uiEXT_remap_index 507
-#define Uniform4uivEXT_remap_index 508
-#define VertexAttribI1iEXT_remap_index 509
-#define VertexAttribI1ivEXT_remap_index 510
-#define VertexAttribI1uiEXT_remap_index 511
-#define VertexAttribI1uivEXT_remap_index 512
-#define VertexAttribI2iEXT_remap_index 513
-#define VertexAttribI2ivEXT_remap_index 514
-#define VertexAttribI2uiEXT_remap_index 515
-#define VertexAttribI2uivEXT_remap_index 516
-#define VertexAttribI3iEXT_remap_index 517
-#define VertexAttribI3ivEXT_remap_index 518
-#define VertexAttribI3uiEXT_remap_index 519
-#define VertexAttribI3uivEXT_remap_index 520
-#define VertexAttribI4bvEXT_remap_index 521
-#define VertexAttribI4iEXT_remap_index 522
-#define VertexAttribI4ivEXT_remap_index 523
-#define VertexAttribI4svEXT_remap_index 524
-#define VertexAttribI4ubvEXT_remap_index 525
-#define VertexAttribI4uiEXT_remap_index 526
-#define VertexAttribI4uivEXT_remap_index 527
-#define VertexAttribI4usvEXT_remap_index 528
-#define VertexAttribIPointerEXT_remap_index 529
-#define FramebufferTextureLayerEXT_remap_index 530
-#define ColorMaskIndexedEXT_remap_index 531
-#define DisableIndexedEXT_remap_index 532
-#define EnableIndexedEXT_remap_index 533
-#define GetBooleanIndexedvEXT_remap_index 534
-#define GetIntegerIndexedvEXT_remap_index 535
-#define IsEnabledIndexedEXT_remap_index 536
-#define ClearColorIiEXT_remap_index 537
-#define ClearColorIuiEXT_remap_index 538
-#define GetTexParameterIivEXT_remap_index 539
-#define GetTexParameterIuivEXT_remap_index 540
-#define TexParameterIivEXT_remap_index 541
-#define TexParameterIuivEXT_remap_index 542
-#define BeginConditionalRenderNV_remap_index 543
-#define EndConditionalRenderNV_remap_index 544
-#define BeginTransformFeedbackEXT_remap_index 545
-#define BindBufferBaseEXT_remap_index 546
-#define BindBufferOffsetEXT_remap_index 547
-#define BindBufferRangeEXT_remap_index 548
-#define EndTransformFeedbackEXT_remap_index 549
-#define GetTransformFeedbackVaryingEXT_remap_index 550
-#define TransformFeedbackVaryingsEXT_remap_index 551
-#define ProvokingVertexEXT_remap_index 552
-#define GetTexParameterPointervAPPLE_remap_index 553
-#define TextureRangeAPPLE_remap_index 554
-#define GetObjectParameterivAPPLE_remap_index 555
-#define ObjectPurgeableAPPLE_remap_index 556
-#define ObjectUnpurgeableAPPLE_remap_index 557
-#define ActiveProgramEXT_remap_index 558
-#define CreateShaderProgramEXT_remap_index 559
-#define UseShaderProgramEXT_remap_index 560
-#define TextureBarrierNV_remap_index 561
-#define StencilFuncSeparateATI_remap_index 562
-#define ProgramEnvParameters4fvEXT_remap_index 563
-#define ProgramLocalParameters4fvEXT_remap_index 564
-#define GetQueryObjecti64vEXT_remap_index 565
-#define GetQueryObjectui64vEXT_remap_index 566
-#define EGLImageTargetRenderbufferStorageOES_remap_index 567
-#define EGLImageTargetTexture2DOES_remap_index 568
-
-#define _gloffset_AttachShader driDispatchRemapTable[AttachShader_remap_index]
-#define _gloffset_CreateProgram driDispatchRemapTable[CreateProgram_remap_index]
-#define _gloffset_CreateShader driDispatchRemapTable[CreateShader_remap_index]
-#define _gloffset_DeleteProgram driDispatchRemapTable[DeleteProgram_remap_index]
-#define _gloffset_DeleteShader driDispatchRemapTable[DeleteShader_remap_index]
-#define _gloffset_DetachShader driDispatchRemapTable[DetachShader_remap_index]
-#define _gloffset_GetAttachedShaders driDispatchRemapTable[GetAttachedShaders_remap_index]
-#define _gloffset_GetProgramInfoLog driDispatchRemapTable[GetProgramInfoLog_remap_index]
-#define _gloffset_GetProgramiv driDispatchRemapTable[GetProgramiv_remap_index]
-#define _gloffset_GetShaderInfoLog driDispatchRemapTable[GetShaderInfoLog_remap_index]
-#define _gloffset_GetShaderiv driDispatchRemapTable[GetShaderiv_remap_index]
-#define _gloffset_IsProgram driDispatchRemapTable[IsProgram_remap_index]
-#define _gloffset_IsShader driDispatchRemapTable[IsShader_remap_index]
-#define _gloffset_StencilFuncSeparate driDispatchRemapTable[StencilFuncSeparate_remap_index]
-#define _gloffset_StencilMaskSeparate driDispatchRemapTable[StencilMaskSeparate_remap_index]
-#define _gloffset_StencilOpSeparate driDispatchRemapTable[StencilOpSeparate_remap_index]
-#define _gloffset_UniformMatrix2x3fv driDispatchRemapTable[UniformMatrix2x3fv_remap_index]
-#define _gloffset_UniformMatrix2x4fv driDispatchRemapTable[UniformMatrix2x4fv_remap_index]
-#define _gloffset_UniformMatrix3x2fv driDispatchRemapTable[UniformMatrix3x2fv_remap_index]
-#define _gloffset_UniformMatrix3x4fv driDispatchRemapTable[UniformMatrix3x4fv_remap_index]
-#define _gloffset_UniformMatrix4x2fv driDispatchRemapTable[UniformMatrix4x2fv_remap_index]
-#define _gloffset_UniformMatrix4x3fv driDispatchRemapTable[UniformMatrix4x3fv_remap_index]
-#define _gloffset_ClampColor driDispatchRemapTable[ClampColor_remap_index]
-#define _gloffset_ClearBufferfi driDispatchRemapTable[ClearBufferfi_remap_index]
-#define _gloffset_ClearBufferfv driDispatchRemapTable[ClearBufferfv_remap_index]
-#define _gloffset_ClearBufferiv driDispatchRemapTable[ClearBufferiv_remap_index]
-#define _gloffset_ClearBufferuiv driDispatchRemapTable[ClearBufferuiv_remap_index]
-#define _gloffset_GetStringi driDispatchRemapTable[GetStringi_remap_index]
-#define _gloffset_TexBuffer driDispatchRemapTable[TexBuffer_remap_index]
-#define _gloffset_FramebufferTexture driDispatchRemapTable[FramebufferTexture_remap_index]
-#define _gloffset_GetBufferParameteri64v driDispatchRemapTable[GetBufferParameteri64v_remap_index]
-#define _gloffset_GetInteger64i_v driDispatchRemapTable[GetInteger64i_v_remap_index]
-#define _gloffset_VertexAttribDivisor driDispatchRemapTable[VertexAttribDivisor_remap_index]
-#define _gloffset_LoadTransposeMatrixdARB driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index]
-#define _gloffset_LoadTransposeMatrixfARB driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index]
-#define _gloffset_MultTransposeMatrixdARB driDispatchRemapTable[MultTransposeMatrixdARB_remap_index]
-#define _gloffset_MultTransposeMatrixfARB driDispatchRemapTable[MultTransposeMatrixfARB_remap_index]
-#define _gloffset_SampleCoverageARB driDispatchRemapTable[SampleCoverageARB_remap_index]
-#define _gloffset_CompressedTexImage1DARB driDispatchRemapTable[CompressedTexImage1DARB_remap_index]
-#define _gloffset_CompressedTexImage2DARB driDispatchRemapTable[CompressedTexImage2DARB_remap_index]
-#define _gloffset_CompressedTexImage3DARB driDispatchRemapTable[CompressedTexImage3DARB_remap_index]
-#define _gloffset_CompressedTexSubImage1DARB driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index]
-#define _gloffset_CompressedTexSubImage2DARB driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index]
-#define _gloffset_CompressedTexSubImage3DARB driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index]
-#define _gloffset_GetCompressedTexImageARB driDispatchRemapTable[GetCompressedTexImageARB_remap_index]
-#define _gloffset_DisableVertexAttribArrayARB driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index]
-#define _gloffset_EnableVertexAttribArrayARB driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index]
-#define _gloffset_GetProgramEnvParameterdvARB driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index]
-#define _gloffset_GetProgramEnvParameterfvARB driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index]
-#define _gloffset_GetProgramLocalParameterdvARB driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index]
-#define _gloffset_GetProgramLocalParameterfvARB driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index]
-#define _gloffset_GetProgramStringARB driDispatchRemapTable[GetProgramStringARB_remap_index]
-#define _gloffset_GetProgramivARB driDispatchRemapTable[GetProgramivARB_remap_index]
-#define _gloffset_GetVertexAttribdvARB driDispatchRemapTable[GetVertexAttribdvARB_remap_index]
-#define _gloffset_GetVertexAttribfvARB driDispatchRemapTable[GetVertexAttribfvARB_remap_index]
-#define _gloffset_GetVertexAttribivARB driDispatchRemapTable[GetVertexAttribivARB_remap_index]
-#define _gloffset_ProgramEnvParameter4dARB driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index]
-#define _gloffset_ProgramEnvParameter4dvARB driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index]
-#define _gloffset_ProgramEnvParameter4fARB driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index]
-#define _gloffset_ProgramEnvParameter4fvARB driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index]
-#define _gloffset_ProgramLocalParameter4dARB driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index]
-#define _gloffset_ProgramLocalParameter4dvARB driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index]
-#define _gloffset_ProgramLocalParameter4fARB driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index]
-#define _gloffset_ProgramLocalParameter4fvARB driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index]
-#define _gloffset_ProgramStringARB driDispatchRemapTable[ProgramStringARB_remap_index]
-#define _gloffset_VertexAttrib1dARB driDispatchRemapTable[VertexAttrib1dARB_remap_index]
-#define _gloffset_VertexAttrib1dvARB driDispatchRemapTable[VertexAttrib1dvARB_remap_index]
-#define _gloffset_VertexAttrib1fARB driDispatchRemapTable[VertexAttrib1fARB_remap_index]
-#define _gloffset_VertexAttrib1fvARB driDispatchRemapTable[VertexAttrib1fvARB_remap_index]
-#define _gloffset_VertexAttrib1sARB driDispatchRemapTable[VertexAttrib1sARB_remap_index]
-#define _gloffset_VertexAttrib1svARB driDispatchRemapTable[VertexAttrib1svARB_remap_index]
-#define _gloffset_VertexAttrib2dARB driDispatchRemapTable[VertexAttrib2dARB_remap_index]
-#define _gloffset_VertexAttrib2dvARB driDispatchRemapTable[VertexAttrib2dvARB_remap_index]
-#define _gloffset_VertexAttrib2fARB driDispatchRemapTable[VertexAttrib2fARB_remap_index]
-#define _gloffset_VertexAttrib2fvARB driDispatchRemapTable[VertexAttrib2fvARB_remap_index]
-#define _gloffset_VertexAttrib2sARB driDispatchRemapTable[VertexAttrib2sARB_remap_index]
-#define _gloffset_VertexAttrib2svARB driDispatchRemapTable[VertexAttrib2svARB_remap_index]
-#define _gloffset_VertexAttrib3dARB driDispatchRemapTable[VertexAttrib3dARB_remap_index]
-#define _gloffset_VertexAttrib3dvARB driDispatchRemapTable[VertexAttrib3dvARB_remap_index]
-#define _gloffset_VertexAttrib3fARB driDispatchRemapTable[VertexAttrib3fARB_remap_index]
-#define _gloffset_VertexAttrib3fvARB driDispatchRemapTable[VertexAttrib3fvARB_remap_index]
-#define _gloffset_VertexAttrib3sARB driDispatchRemapTable[VertexAttrib3sARB_remap_index]
-#define _gloffset_VertexAttrib3svARB driDispatchRemapTable[VertexAttrib3svARB_remap_index]
-#define _gloffset_VertexAttrib4NbvARB driDispatchRemapTable[VertexAttrib4NbvARB_remap_index]
-#define _gloffset_VertexAttrib4NivARB driDispatchRemapTable[VertexAttrib4NivARB_remap_index]
-#define _gloffset_VertexAttrib4NsvARB driDispatchRemapTable[VertexAttrib4NsvARB_remap_index]
-#define _gloffset_VertexAttrib4NubARB driDispatchRemapTable[VertexAttrib4NubARB_remap_index]
-#define _gloffset_VertexAttrib4NubvARB driDispatchRemapTable[VertexAttrib4NubvARB_remap_index]
-#define _gloffset_VertexAttrib4NuivARB driDispatchRemapTable[VertexAttrib4NuivARB_remap_index]
-#define _gloffset_VertexAttrib4NusvARB driDispatchRemapTable[VertexAttrib4NusvARB_remap_index]
-#define _gloffset_VertexAttrib4bvARB driDispatchRemapTable[VertexAttrib4bvARB_remap_index]
-#define _gloffset_VertexAttrib4dARB driDispatchRemapTable[VertexAttrib4dARB_remap_index]
-#define _gloffset_VertexAttrib4dvARB driDispatchRemapTable[VertexAttrib4dvARB_remap_index]
-#define _gloffset_VertexAttrib4fARB driDispatchRemapTable[VertexAttrib4fARB_remap_index]
-#define _gloffset_VertexAttrib4fvARB driDispatchRemapTable[VertexAttrib4fvARB_remap_index]
-#define _gloffset_VertexAttrib4ivARB driDispatchRemapTable[VertexAttrib4ivARB_remap_index]
-#define _gloffset_VertexAttrib4sARB driDispatchRemapTable[VertexAttrib4sARB_remap_index]
-#define _gloffset_VertexAttrib4svARB driDispatchRemapTable[VertexAttrib4svARB_remap_index]
-#define _gloffset_VertexAttrib4ubvARB driDispatchRemapTable[VertexAttrib4ubvARB_remap_index]
-#define _gloffset_VertexAttrib4uivARB driDispatchRemapTable[VertexAttrib4uivARB_remap_index]
-#define _gloffset_VertexAttrib4usvARB driDispatchRemapTable[VertexAttrib4usvARB_remap_index]
-#define _gloffset_VertexAttribPointerARB driDispatchRemapTable[VertexAttribPointerARB_remap_index]
-#define _gloffset_BindBufferARB driDispatchRemapTable[BindBufferARB_remap_index]
-#define _gloffset_BufferDataARB driDispatchRemapTable[BufferDataARB_remap_index]
-#define _gloffset_BufferSubDataARB driDispatchRemapTable[BufferSubDataARB_remap_index]
-#define _gloffset_DeleteBuffersARB driDispatchRemapTable[DeleteBuffersARB_remap_index]
-#define _gloffset_GenBuffersARB driDispatchRemapTable[GenBuffersARB_remap_index]
-#define _gloffset_GetBufferParameterivARB driDispatchRemapTable[GetBufferParameterivARB_remap_index]
-#define _gloffset_GetBufferPointervARB driDispatchRemapTable[GetBufferPointervARB_remap_index]
-#define _gloffset_GetBufferSubDataARB driDispatchRemapTable[GetBufferSubDataARB_remap_index]
-#define _gloffset_IsBufferARB driDispatchRemapTable[IsBufferARB_remap_index]
-#define _gloffset_MapBufferARB driDispatchRemapTable[MapBufferARB_remap_index]
-#define _gloffset_UnmapBufferARB driDispatchRemapTable[UnmapBufferARB_remap_index]
-#define _gloffset_BeginQueryARB driDispatchRemapTable[BeginQueryARB_remap_index]
-#define _gloffset_DeleteQueriesARB driDispatchRemapTable[DeleteQueriesARB_remap_index]
-#define _gloffset_EndQueryARB driDispatchRemapTable[EndQueryARB_remap_index]
-#define _gloffset_GenQueriesARB driDispatchRemapTable[GenQueriesARB_remap_index]
-#define _gloffset_GetQueryObjectivARB driDispatchRemapTable[GetQueryObjectivARB_remap_index]
-#define _gloffset_GetQueryObjectuivARB driDispatchRemapTable[GetQueryObjectuivARB_remap_index]
-#define _gloffset_GetQueryivARB driDispatchRemapTable[GetQueryivARB_remap_index]
-#define _gloffset_IsQueryARB driDispatchRemapTable[IsQueryARB_remap_index]
-#define _gloffset_AttachObjectARB driDispatchRemapTable[AttachObjectARB_remap_index]
-#define _gloffset_CompileShaderARB driDispatchRemapTable[CompileShaderARB_remap_index]
-#define _gloffset_CreateProgramObjectARB driDispatchRemapTable[CreateProgramObjectARB_remap_index]
-#define _gloffset_CreateShaderObjectARB driDispatchRemapTable[CreateShaderObjectARB_remap_index]
-#define _gloffset_DeleteObjectARB driDispatchRemapTable[DeleteObjectARB_remap_index]
-#define _gloffset_DetachObjectARB driDispatchRemapTable[DetachObjectARB_remap_index]
-#define _gloffset_GetActiveUniformARB driDispatchRemapTable[GetActiveUniformARB_remap_index]
-#define _gloffset_GetAttachedObjectsARB driDispatchRemapTable[GetAttachedObjectsARB_remap_index]
-#define _gloffset_GetHandleARB driDispatchRemapTable[GetHandleARB_remap_index]
-#define _gloffset_GetInfoLogARB driDispatchRemapTable[GetInfoLogARB_remap_index]
-#define _gloffset_GetObjectParameterfvARB driDispatchRemapTable[GetObjectParameterfvARB_remap_index]
-#define _gloffset_GetObjectParameterivARB driDispatchRemapTable[GetObjectParameterivARB_remap_index]
-#define _gloffset_GetShaderSourceARB driDispatchRemapTable[GetShaderSourceARB_remap_index]
-#define _gloffset_GetUniformLocationARB driDispatchRemapTable[GetUniformLocationARB_remap_index]
-#define _gloffset_GetUniformfvARB driDispatchRemapTable[GetUniformfvARB_remap_index]
-#define _gloffset_GetUniformivARB driDispatchRemapTable[GetUniformivARB_remap_index]
-#define _gloffset_LinkProgramARB driDispatchRemapTable[LinkProgramARB_remap_index]
-#define _gloffset_ShaderSourceARB driDispatchRemapTable[ShaderSourceARB_remap_index]
-#define _gloffset_Uniform1fARB driDispatchRemapTable[Uniform1fARB_remap_index]
-#define _gloffset_Uniform1fvARB driDispatchRemapTable[Uniform1fvARB_remap_index]
-#define _gloffset_Uniform1iARB driDispatchRemapTable[Uniform1iARB_remap_index]
-#define _gloffset_Uniform1ivARB driDispatchRemapTable[Uniform1ivARB_remap_index]
-#define _gloffset_Uniform2fARB driDispatchRemapTable[Uniform2fARB_remap_index]
-#define _gloffset_Uniform2fvARB driDispatchRemapTable[Uniform2fvARB_remap_index]
-#define _gloffset_Uniform2iARB driDispatchRemapTable[Uniform2iARB_remap_index]
-#define _gloffset_Uniform2ivARB driDispatchRemapTable[Uniform2ivARB_remap_index]
-#define _gloffset_Uniform3fARB driDispatchRemapTable[Uniform3fARB_remap_index]
-#define _gloffset_Uniform3fvARB driDispatchRemapTable[Uniform3fvARB_remap_index]
-#define _gloffset_Uniform3iARB driDispatchRemapTable[Uniform3iARB_remap_index]
-#define _gloffset_Uniform3ivARB driDispatchRemapTable[Uniform3ivARB_remap_index]
-#define _gloffset_Uniform4fARB driDispatchRemapTable[Uniform4fARB_remap_index]
-#define _gloffset_Uniform4fvARB driDispatchRemapTable[Uniform4fvARB_remap_index]
-#define _gloffset_Uniform4iARB driDispatchRemapTable[Uniform4iARB_remap_index]
-#define _gloffset_Uniform4ivARB driDispatchRemapTable[Uniform4ivARB_remap_index]
-#define _gloffset_UniformMatrix2fvARB driDispatchRemapTable[UniformMatrix2fvARB_remap_index]
-#define _gloffset_UniformMatrix3fvARB driDispatchRemapTable[UniformMatrix3fvARB_remap_index]
-#define _gloffset_UniformMatrix4fvARB driDispatchRemapTable[UniformMatrix4fvARB_remap_index]
-#define _gloffset_UseProgramObjectARB driDispatchRemapTable[UseProgramObjectARB_remap_index]
-#define _gloffset_ValidateProgramARB driDispatchRemapTable[ValidateProgramARB_remap_index]
-#define _gloffset_BindAttribLocationARB driDispatchRemapTable[BindAttribLocationARB_remap_index]
-#define _gloffset_GetActiveAttribARB driDispatchRemapTable[GetActiveAttribARB_remap_index]
-#define _gloffset_GetAttribLocationARB driDispatchRemapTable[GetAttribLocationARB_remap_index]
-#define _gloffset_DrawBuffersARB driDispatchRemapTable[DrawBuffersARB_remap_index]
-#define _gloffset_ClampColorARB driDispatchRemapTable[ClampColorARB_remap_index]
-#define _gloffset_DrawArraysInstancedARB driDispatchRemapTable[DrawArraysInstancedARB_remap_index]
-#define _gloffset_DrawElementsInstancedARB driDispatchRemapTable[DrawElementsInstancedARB_remap_index]
-#define _gloffset_RenderbufferStorageMultisample driDispatchRemapTable[RenderbufferStorageMultisample_remap_index]
-#define _gloffset_FramebufferTextureARB driDispatchRemapTable[FramebufferTextureARB_remap_index]
-#define _gloffset_FramebufferTextureFaceARB driDispatchRemapTable[FramebufferTextureFaceARB_remap_index]
-#define _gloffset_ProgramParameteriARB driDispatchRemapTable[ProgramParameteriARB_remap_index]
-#define _gloffset_VertexAttribDivisorARB driDispatchRemapTable[VertexAttribDivisorARB_remap_index]
-#define _gloffset_FlushMappedBufferRange driDispatchRemapTable[FlushMappedBufferRange_remap_index]
-#define _gloffset_MapBufferRange driDispatchRemapTable[MapBufferRange_remap_index]
-#define _gloffset_TexBufferARB driDispatchRemapTable[TexBufferARB_remap_index]
-#define _gloffset_BindVertexArray driDispatchRemapTable[BindVertexArray_remap_index]
-#define _gloffset_GenVertexArrays driDispatchRemapTable[GenVertexArrays_remap_index]
-#define _gloffset_CopyBufferSubData driDispatchRemapTable[CopyBufferSubData_remap_index]
-#define _gloffset_ClientWaitSync driDispatchRemapTable[ClientWaitSync_remap_index]
-#define _gloffset_DeleteSync driDispatchRemapTable[DeleteSync_remap_index]
-#define _gloffset_FenceSync driDispatchRemapTable[FenceSync_remap_index]
-#define _gloffset_GetInteger64v driDispatchRemapTable[GetInteger64v_remap_index]
-#define _gloffset_GetSynciv driDispatchRemapTable[GetSynciv_remap_index]
-#define _gloffset_IsSync driDispatchRemapTable[IsSync_remap_index]
-#define _gloffset_WaitSync driDispatchRemapTable[WaitSync_remap_index]
-#define _gloffset_DrawElementsBaseVertex driDispatchRemapTable[DrawElementsBaseVertex_remap_index]
-#define _gloffset_DrawElementsInstancedBaseVertex driDispatchRemapTable[DrawElementsInstancedBaseVertex_remap_index]
-#define _gloffset_DrawRangeElementsBaseVertex driDispatchRemapTable[DrawRangeElementsBaseVertex_remap_index]
-#define _gloffset_MultiDrawElementsBaseVertex driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index]
-#define _gloffset_BlendEquationSeparateiARB driDispatchRemapTable[BlendEquationSeparateiARB_remap_index]
-#define _gloffset_BlendEquationiARB driDispatchRemapTable[BlendEquationiARB_remap_index]
-#define _gloffset_BlendFuncSeparateiARB driDispatchRemapTable[BlendFuncSeparateiARB_remap_index]
-#define _gloffset_BlendFunciARB driDispatchRemapTable[BlendFunciARB_remap_index]
-#define _gloffset_BindSampler driDispatchRemapTable[BindSampler_remap_index]
-#define _gloffset_DeleteSamplers driDispatchRemapTable[DeleteSamplers_remap_index]
-#define _gloffset_GenSamplers driDispatchRemapTable[GenSamplers_remap_index]
-#define _gloffset_GetSamplerParameterIiv driDispatchRemapTable[GetSamplerParameterIiv_remap_index]
-#define _gloffset_GetSamplerParameterIuiv driDispatchRemapTable[GetSamplerParameterIuiv_remap_index]
-#define _gloffset_GetSamplerParameterfv driDispatchRemapTable[GetSamplerParameterfv_remap_index]
-#define _gloffset_GetSamplerParameteriv driDispatchRemapTable[GetSamplerParameteriv_remap_index]
-#define _gloffset_IsSampler driDispatchRemapTable[IsSampler_remap_index]
-#define _gloffset_SamplerParameterIiv driDispatchRemapTable[SamplerParameterIiv_remap_index]
-#define _gloffset_SamplerParameterIuiv driDispatchRemapTable[SamplerParameterIuiv_remap_index]
-#define _gloffset_SamplerParameterf driDispatchRemapTable[SamplerParameterf_remap_index]
-#define _gloffset_SamplerParameterfv driDispatchRemapTable[SamplerParameterfv_remap_index]
-#define _gloffset_SamplerParameteri driDispatchRemapTable[SamplerParameteri_remap_index]
-#define _gloffset_SamplerParameteriv driDispatchRemapTable[SamplerParameteriv_remap_index]
-#define _gloffset_ColorP3ui driDispatchRemapTable[ColorP3ui_remap_index]
-#define _gloffset_ColorP3uiv driDispatchRemapTable[ColorP3uiv_remap_index]
-#define _gloffset_ColorP4ui driDispatchRemapTable[ColorP4ui_remap_index]
-#define _gloffset_ColorP4uiv driDispatchRemapTable[ColorP4uiv_remap_index]
-#define _gloffset_MultiTexCoordP1ui driDispatchRemapTable[MultiTexCoordP1ui_remap_index]
-#define _gloffset_MultiTexCoordP1uiv driDispatchRemapTable[MultiTexCoordP1uiv_remap_index]
-#define _gloffset_MultiTexCoordP2ui driDispatchRemapTable[MultiTexCoordP2ui_remap_index]
-#define _gloffset_MultiTexCoordP2uiv driDispatchRemapTable[MultiTexCoordP2uiv_remap_index]
-#define _gloffset_MultiTexCoordP3ui driDispatchRemapTable[MultiTexCoordP3ui_remap_index]
-#define _gloffset_MultiTexCoordP3uiv driDispatchRemapTable[MultiTexCoordP3uiv_remap_index]
-#define _gloffset_MultiTexCoordP4ui driDispatchRemapTable[MultiTexCoordP4ui_remap_index]
-#define _gloffset_MultiTexCoordP4uiv driDispatchRemapTable[MultiTexCoordP4uiv_remap_index]
-#define _gloffset_NormalP3ui driDispatchRemapTable[NormalP3ui_remap_index]
-#define _gloffset_NormalP3uiv driDispatchRemapTable[NormalP3uiv_remap_index]
-#define _gloffset_SecondaryColorP3ui driDispatchRemapTable[SecondaryColorP3ui_remap_index]
-#define _gloffset_SecondaryColorP3uiv driDispatchRemapTable[SecondaryColorP3uiv_remap_index]
-#define _gloffset_TexCoordP1ui driDispatchRemapTable[TexCoordP1ui_remap_index]
-#define _gloffset_TexCoordP1uiv driDispatchRemapTable[TexCoordP1uiv_remap_index]
-#define _gloffset_TexCoordP2ui driDispatchRemapTable[TexCoordP2ui_remap_index]
-#define _gloffset_TexCoordP2uiv driDispatchRemapTable[TexCoordP2uiv_remap_index]
-#define _gloffset_TexCoordP3ui driDispatchRemapTable[TexCoordP3ui_remap_index]
-#define _gloffset_TexCoordP3uiv driDispatchRemapTable[TexCoordP3uiv_remap_index]
-#define _gloffset_TexCoordP4ui driDispatchRemapTable[TexCoordP4ui_remap_index]
-#define _gloffset_TexCoordP4uiv driDispatchRemapTable[TexCoordP4uiv_remap_index]
-#define _gloffset_VertexAttribP1ui driDispatchRemapTable[VertexAttribP1ui_remap_index]
-#define _gloffset_VertexAttribP1uiv driDispatchRemapTable[VertexAttribP1uiv_remap_index]
-#define _gloffset_VertexAttribP2ui driDispatchRemapTable[VertexAttribP2ui_remap_index]
-#define _gloffset_VertexAttribP2uiv driDispatchRemapTable[VertexAttribP2uiv_remap_index]
-#define _gloffset_VertexAttribP3ui driDispatchRemapTable[VertexAttribP3ui_remap_index]
-#define _gloffset_VertexAttribP3uiv driDispatchRemapTable[VertexAttribP3uiv_remap_index]
-#define _gloffset_VertexAttribP4ui driDispatchRemapTable[VertexAttribP4ui_remap_index]
-#define _gloffset_VertexAttribP4uiv driDispatchRemapTable[VertexAttribP4uiv_remap_index]
-#define _gloffset_VertexP2ui driDispatchRemapTable[VertexP2ui_remap_index]
-#define _gloffset_VertexP2uiv driDispatchRemapTable[VertexP2uiv_remap_index]
-#define _gloffset_VertexP3ui driDispatchRemapTable[VertexP3ui_remap_index]
-#define _gloffset_VertexP3uiv driDispatchRemapTable[VertexP3uiv_remap_index]
-#define _gloffset_VertexP4ui driDispatchRemapTable[VertexP4ui_remap_index]
-#define _gloffset_VertexP4uiv driDispatchRemapTable[VertexP4uiv_remap_index]
-#define _gloffset_BindTransformFeedback driDispatchRemapTable[BindTransformFeedback_remap_index]
-#define _gloffset_DeleteTransformFeedbacks driDispatchRemapTable[DeleteTransformFeedbacks_remap_index]
-#define _gloffset_DrawTransformFeedback driDispatchRemapTable[DrawTransformFeedback_remap_index]
-#define _gloffset_GenTransformFeedbacks driDispatchRemapTable[GenTransformFeedbacks_remap_index]
-#define _gloffset_IsTransformFeedback driDispatchRemapTable[IsTransformFeedback_remap_index]
-#define _gloffset_PauseTransformFeedback driDispatchRemapTable[PauseTransformFeedback_remap_index]
-#define _gloffset_ResumeTransformFeedback driDispatchRemapTable[ResumeTransformFeedback_remap_index]
-#define _gloffset_ClearDepthf driDispatchRemapTable[ClearDepthf_remap_index]
-#define _gloffset_DepthRangef driDispatchRemapTable[DepthRangef_remap_index]
-#define _gloffset_GetShaderPrecisionFormat driDispatchRemapTable[GetShaderPrecisionFormat_remap_index]
-#define _gloffset_ReleaseShaderCompiler driDispatchRemapTable[ReleaseShaderCompiler_remap_index]
-#define _gloffset_ShaderBinary driDispatchRemapTable[ShaderBinary_remap_index]
-#define _gloffset_DebugMessageCallbackARB driDispatchRemapTable[DebugMessageCallbackARB_remap_index]
-#define _gloffset_DebugMessageControlARB driDispatchRemapTable[DebugMessageControlARB_remap_index]
-#define _gloffset_DebugMessageInsertARB driDispatchRemapTable[DebugMessageInsertARB_remap_index]
-#define _gloffset_GetDebugMessageLogARB driDispatchRemapTable[GetDebugMessageLogARB_remap_index]
-#define _gloffset_GetGraphicsResetStatusARB driDispatchRemapTable[GetGraphicsResetStatusARB_remap_index]
-#define _gloffset_GetnColorTableARB driDispatchRemapTable[GetnColorTableARB_remap_index]
-#define _gloffset_GetnCompressedTexImageARB driDispatchRemapTable[GetnCompressedTexImageARB_remap_index]
-#define _gloffset_GetnConvolutionFilterARB driDispatchRemapTable[GetnConvolutionFilterARB_remap_index]
-#define _gloffset_GetnHistogramARB driDispatchRemapTable[GetnHistogramARB_remap_index]
-#define _gloffset_GetnMapdvARB driDispatchRemapTable[GetnMapdvARB_remap_index]
-#define _gloffset_GetnMapfvARB driDispatchRemapTable[GetnMapfvARB_remap_index]
-#define _gloffset_GetnMapivARB driDispatchRemapTable[GetnMapivARB_remap_index]
-#define _gloffset_GetnMinmaxARB driDispatchRemapTable[GetnMinmaxARB_remap_index]
-#define _gloffset_GetnPixelMapfvARB driDispatchRemapTable[GetnPixelMapfvARB_remap_index]
-#define _gloffset_GetnPixelMapuivARB driDispatchRemapTable[GetnPixelMapuivARB_remap_index]
-#define _gloffset_GetnPixelMapusvARB driDispatchRemapTable[GetnPixelMapusvARB_remap_index]
-#define _gloffset_GetnPolygonStippleARB driDispatchRemapTable[GetnPolygonStippleARB_remap_index]
-#define _gloffset_GetnSeparableFilterARB driDispatchRemapTable[GetnSeparableFilterARB_remap_index]
-#define _gloffset_GetnTexImageARB driDispatchRemapTable[GetnTexImageARB_remap_index]
-#define _gloffset_GetnUniformdvARB driDispatchRemapTable[GetnUniformdvARB_remap_index]
-#define _gloffset_GetnUniformfvARB driDispatchRemapTable[GetnUniformfvARB_remap_index]
-#define _gloffset_GetnUniformivARB driDispatchRemapTable[GetnUniformivARB_remap_index]
-#define _gloffset_GetnUniformuivARB driDispatchRemapTable[GetnUniformuivARB_remap_index]
-#define _gloffset_ReadnPixelsARB driDispatchRemapTable[ReadnPixelsARB_remap_index]
-#define _gloffset_TexStorage1D driDispatchRemapTable[TexStorage1D_remap_index]
-#define _gloffset_TexStorage2D driDispatchRemapTable[TexStorage2D_remap_index]
-#define _gloffset_TexStorage3D driDispatchRemapTable[TexStorage3D_remap_index]
-#define _gloffset_TextureStorage1DEXT driDispatchRemapTable[TextureStorage1DEXT_remap_index]
-#define _gloffset_TextureStorage2DEXT driDispatchRemapTable[TextureStorage2DEXT_remap_index]
-#define _gloffset_TextureStorage3DEXT driDispatchRemapTable[TextureStorage3DEXT_remap_index]
-#define _gloffset_PolygonOffsetEXT driDispatchRemapTable[PolygonOffsetEXT_remap_index]
-#define _gloffset_GetPixelTexGenParameterfvSGIS driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index]
-#define _gloffset_GetPixelTexGenParameterivSGIS driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index]
-#define _gloffset_PixelTexGenParameterfSGIS driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index]
-#define _gloffset_PixelTexGenParameterfvSGIS driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index]
-#define _gloffset_PixelTexGenParameteriSGIS driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index]
-#define _gloffset_PixelTexGenParameterivSGIS driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index]
-#define _gloffset_SampleMaskSGIS driDispatchRemapTable[SampleMaskSGIS_remap_index]
-#define _gloffset_SamplePatternSGIS driDispatchRemapTable[SamplePatternSGIS_remap_index]
-#define _gloffset_ColorPointerEXT driDispatchRemapTable[ColorPointerEXT_remap_index]
-#define _gloffset_EdgeFlagPointerEXT driDispatchRemapTable[EdgeFlagPointerEXT_remap_index]
-#define _gloffset_IndexPointerEXT driDispatchRemapTable[IndexPointerEXT_remap_index]
-#define _gloffset_NormalPointerEXT driDispatchRemapTable[NormalPointerEXT_remap_index]
-#define _gloffset_TexCoordPointerEXT driDispatchRemapTable[TexCoordPointerEXT_remap_index]
-#define _gloffset_VertexPointerEXT driDispatchRemapTable[VertexPointerEXT_remap_index]
-#define _gloffset_PointParameterfEXT driDispatchRemapTable[PointParameterfEXT_remap_index]
-#define _gloffset_PointParameterfvEXT driDispatchRemapTable[PointParameterfvEXT_remap_index]
-#define _gloffset_LockArraysEXT driDispatchRemapTable[LockArraysEXT_remap_index]
-#define _gloffset_UnlockArraysEXT driDispatchRemapTable[UnlockArraysEXT_remap_index]
-#define _gloffset_SecondaryColor3bEXT driDispatchRemapTable[SecondaryColor3bEXT_remap_index]
-#define _gloffset_SecondaryColor3bvEXT driDispatchRemapTable[SecondaryColor3bvEXT_remap_index]
-#define _gloffset_SecondaryColor3dEXT driDispatchRemapTable[SecondaryColor3dEXT_remap_index]
-#define _gloffset_SecondaryColor3dvEXT driDispatchRemapTable[SecondaryColor3dvEXT_remap_index]
-#define _gloffset_SecondaryColor3fEXT driDispatchRemapTable[SecondaryColor3fEXT_remap_index]
-#define _gloffset_SecondaryColor3fvEXT driDispatchRemapTable[SecondaryColor3fvEXT_remap_index]
-#define _gloffset_SecondaryColor3iEXT driDispatchRemapTable[SecondaryColor3iEXT_remap_index]
-#define _gloffset_SecondaryColor3ivEXT driDispatchRemapTable[SecondaryColor3ivEXT_remap_index]
-#define _gloffset_SecondaryColor3sEXT driDispatchRemapTable[SecondaryColor3sEXT_remap_index]
-#define _gloffset_SecondaryColor3svEXT driDispatchRemapTable[SecondaryColor3svEXT_remap_index]
-#define _gloffset_SecondaryColor3ubEXT driDispatchRemapTable[SecondaryColor3ubEXT_remap_index]
-#define _gloffset_SecondaryColor3ubvEXT driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index]
-#define _gloffset_SecondaryColor3uiEXT driDispatchRemapTable[SecondaryColor3uiEXT_remap_index]
-#define _gloffset_SecondaryColor3uivEXT driDispatchRemapTable[SecondaryColor3uivEXT_remap_index]
-#define _gloffset_SecondaryColor3usEXT driDispatchRemapTable[SecondaryColor3usEXT_remap_index]
-#define _gloffset_SecondaryColor3usvEXT driDispatchRemapTable[SecondaryColor3usvEXT_remap_index]
-#define _gloffset_SecondaryColorPointerEXT driDispatchRemapTable[SecondaryColorPointerEXT_remap_index]
-#define _gloffset_MultiDrawArraysEXT driDispatchRemapTable[MultiDrawArraysEXT_remap_index]
-#define _gloffset_MultiDrawElementsEXT driDispatchRemapTable[MultiDrawElementsEXT_remap_index]
-#define _gloffset_FogCoordPointerEXT driDispatchRemapTable[FogCoordPointerEXT_remap_index]
-#define _gloffset_FogCoorddEXT driDispatchRemapTable[FogCoorddEXT_remap_index]
-#define _gloffset_FogCoorddvEXT driDispatchRemapTable[FogCoorddvEXT_remap_index]
-#define _gloffset_FogCoordfEXT driDispatchRemapTable[FogCoordfEXT_remap_index]
-#define _gloffset_FogCoordfvEXT driDispatchRemapTable[FogCoordfvEXT_remap_index]
-#define _gloffset_PixelTexGenSGIX driDispatchRemapTable[PixelTexGenSGIX_remap_index]
-#define _gloffset_BlendFuncSeparateEXT driDispatchRemapTable[BlendFuncSeparateEXT_remap_index]
-#define _gloffset_FlushVertexArrayRangeNV driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index]
-#define _gloffset_VertexArrayRangeNV driDispatchRemapTable[VertexArrayRangeNV_remap_index]
-#define _gloffset_CombinerInputNV driDispatchRemapTable[CombinerInputNV_remap_index]
-#define _gloffset_CombinerOutputNV driDispatchRemapTable[CombinerOutputNV_remap_index]
-#define _gloffset_CombinerParameterfNV driDispatchRemapTable[CombinerParameterfNV_remap_index]
-#define _gloffset_CombinerParameterfvNV driDispatchRemapTable[CombinerParameterfvNV_remap_index]
-#define _gloffset_CombinerParameteriNV driDispatchRemapTable[CombinerParameteriNV_remap_index]
-#define _gloffset_CombinerParameterivNV driDispatchRemapTable[CombinerParameterivNV_remap_index]
-#define _gloffset_FinalCombinerInputNV driDispatchRemapTable[FinalCombinerInputNV_remap_index]
-#define _gloffset_GetCombinerInputParameterfvNV driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index]
-#define _gloffset_GetCombinerInputParameterivNV driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index]
-#define _gloffset_GetCombinerOutputParameterfvNV driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index]
-#define _gloffset_GetCombinerOutputParameterivNV driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index]
-#define _gloffset_GetFinalCombinerInputParameterfvNV driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index]
-#define _gloffset_GetFinalCombinerInputParameterivNV driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index]
-#define _gloffset_ResizeBuffersMESA driDispatchRemapTable[ResizeBuffersMESA_remap_index]
-#define _gloffset_WindowPos2dMESA driDispatchRemapTable[WindowPos2dMESA_remap_index]
-#define _gloffset_WindowPos2dvMESA driDispatchRemapTable[WindowPos2dvMESA_remap_index]
-#define _gloffset_WindowPos2fMESA driDispatchRemapTable[WindowPos2fMESA_remap_index]
-#define _gloffset_WindowPos2fvMESA driDispatchRemapTable[WindowPos2fvMESA_remap_index]
-#define _gloffset_WindowPos2iMESA driDispatchRemapTable[WindowPos2iMESA_remap_index]
-#define _gloffset_WindowPos2ivMESA driDispatchRemapTable[WindowPos2ivMESA_remap_index]
-#define _gloffset_WindowPos2sMESA driDispatchRemapTable[WindowPos2sMESA_remap_index]
-#define _gloffset_WindowPos2svMESA driDispatchRemapTable[WindowPos2svMESA_remap_index]
-#define _gloffset_WindowPos3dMESA driDispatchRemapTable[WindowPos3dMESA_remap_index]
-#define _gloffset_WindowPos3dvMESA driDispatchRemapTable[WindowPos3dvMESA_remap_index]
-#define _gloffset_WindowPos3fMESA driDispatchRemapTable[WindowPos3fMESA_remap_index]
-#define _gloffset_WindowPos3fvMESA driDispatchRemapTable[WindowPos3fvMESA_remap_index]
-#define _gloffset_WindowPos3iMESA driDispatchRemapTable[WindowPos3iMESA_remap_index]
-#define _gloffset_WindowPos3ivMESA driDispatchRemapTable[WindowPos3ivMESA_remap_index]
-#define _gloffset_WindowPos3sMESA driDispatchRemapTable[WindowPos3sMESA_remap_index]
-#define _gloffset_WindowPos3svMESA driDispatchRemapTable[WindowPos3svMESA_remap_index]
-#define _gloffset_WindowPos4dMESA driDispatchRemapTable[WindowPos4dMESA_remap_index]
-#define _gloffset_WindowPos4dvMESA driDispatchRemapTable[WindowPos4dvMESA_remap_index]
-#define _gloffset_WindowPos4fMESA driDispatchRemapTable[WindowPos4fMESA_remap_index]
-#define _gloffset_WindowPos4fvMESA driDispatchRemapTable[WindowPos4fvMESA_remap_index]
-#define _gloffset_WindowPos4iMESA driDispatchRemapTable[WindowPos4iMESA_remap_index]
-#define _gloffset_WindowPos4ivMESA driDispatchRemapTable[WindowPos4ivMESA_remap_index]
-#define _gloffset_WindowPos4sMESA driDispatchRemapTable[WindowPos4sMESA_remap_index]
-#define _gloffset_WindowPos4svMESA driDispatchRemapTable[WindowPos4svMESA_remap_index]
-#define _gloffset_MultiModeDrawArraysIBM driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index]
-#define _gloffset_MultiModeDrawElementsIBM driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index]
-#define _gloffset_DeleteFencesNV driDispatchRemapTable[DeleteFencesNV_remap_index]
-#define _gloffset_FinishFenceNV driDispatchRemapTable[FinishFenceNV_remap_index]
-#define _gloffset_GenFencesNV driDispatchRemapTable[GenFencesNV_remap_index]
-#define _gloffset_GetFenceivNV driDispatchRemapTable[GetFenceivNV_remap_index]
-#define _gloffset_IsFenceNV driDispatchRemapTable[IsFenceNV_remap_index]
-#define _gloffset_SetFenceNV driDispatchRemapTable[SetFenceNV_remap_index]
-#define _gloffset_TestFenceNV driDispatchRemapTable[TestFenceNV_remap_index]
-#define _gloffset_AreProgramsResidentNV driDispatchRemapTable[AreProgramsResidentNV_remap_index]
-#define _gloffset_BindProgramNV driDispatchRemapTable[BindProgramNV_remap_index]
-#define _gloffset_DeleteProgramsNV driDispatchRemapTable[DeleteProgramsNV_remap_index]
-#define _gloffset_ExecuteProgramNV driDispatchRemapTable[ExecuteProgramNV_remap_index]
-#define _gloffset_GenProgramsNV driDispatchRemapTable[GenProgramsNV_remap_index]
-#define _gloffset_GetProgramParameterdvNV driDispatchRemapTable[GetProgramParameterdvNV_remap_index]
-#define _gloffset_GetProgramParameterfvNV driDispatchRemapTable[GetProgramParameterfvNV_remap_index]
-#define _gloffset_GetProgramStringNV driDispatchRemapTable[GetProgramStringNV_remap_index]
-#define _gloffset_GetProgramivNV driDispatchRemapTable[GetProgramivNV_remap_index]
-#define _gloffset_GetTrackMatrixivNV driDispatchRemapTable[GetTrackMatrixivNV_remap_index]
-#define _gloffset_GetVertexAttribPointervNV driDispatchRemapTable[GetVertexAttribPointervNV_remap_index]
-#define _gloffset_GetVertexAttribdvNV driDispatchRemapTable[GetVertexAttribdvNV_remap_index]
-#define _gloffset_GetVertexAttribfvNV driDispatchRemapTable[GetVertexAttribfvNV_remap_index]
-#define _gloffset_GetVertexAttribivNV driDispatchRemapTable[GetVertexAttribivNV_remap_index]
-#define _gloffset_IsProgramNV driDispatchRemapTable[IsProgramNV_remap_index]
-#define _gloffset_LoadProgramNV driDispatchRemapTable[LoadProgramNV_remap_index]
-#define _gloffset_ProgramParameters4dvNV driDispatchRemapTable[ProgramParameters4dvNV_remap_index]
-#define _gloffset_ProgramParameters4fvNV driDispatchRemapTable[ProgramParameters4fvNV_remap_index]
-#define _gloffset_RequestResidentProgramsNV driDispatchRemapTable[RequestResidentProgramsNV_remap_index]
-#define _gloffset_TrackMatrixNV driDispatchRemapTable[TrackMatrixNV_remap_index]
-#define _gloffset_VertexAttrib1dNV driDispatchRemapTable[VertexAttrib1dNV_remap_index]
-#define _gloffset_VertexAttrib1dvNV driDispatchRemapTable[VertexAttrib1dvNV_remap_index]
-#define _gloffset_VertexAttrib1fNV driDispatchRemapTable[VertexAttrib1fNV_remap_index]
-#define _gloffset_VertexAttrib1fvNV driDispatchRemapTable[VertexAttrib1fvNV_remap_index]
-#define _gloffset_VertexAttrib1sNV driDispatchRemapTable[VertexAttrib1sNV_remap_index]
-#define _gloffset_VertexAttrib1svNV driDispatchRemapTable[VertexAttrib1svNV_remap_index]
-#define _gloffset_VertexAttrib2dNV driDispatchRemapTable[VertexAttrib2dNV_remap_index]
-#define _gloffset_VertexAttrib2dvNV driDispatchRemapTable[VertexAttrib2dvNV_remap_index]
-#define _gloffset_VertexAttrib2fNV driDispatchRemapTable[VertexAttrib2fNV_remap_index]
-#define _gloffset_VertexAttrib2fvNV driDispatchRemapTable[VertexAttrib2fvNV_remap_index]
-#define _gloffset_VertexAttrib2sNV driDispatchRemapTable[VertexAttrib2sNV_remap_index]
-#define _gloffset_VertexAttrib2svNV driDispatchRemapTable[VertexAttrib2svNV_remap_index]
-#define _gloffset_VertexAttrib3dNV driDispatchRemapTable[VertexAttrib3dNV_remap_index]
-#define _gloffset_VertexAttrib3dvNV driDispatchRemapTable[VertexAttrib3dvNV_remap_index]
-#define _gloffset_VertexAttrib3fNV driDispatchRemapTable[VertexAttrib3fNV_remap_index]
-#define _gloffset_VertexAttrib3fvNV driDispatchRemapTable[VertexAttrib3fvNV_remap_index]
-#define _gloffset_VertexAttrib3sNV driDispatchRemapTable[VertexAttrib3sNV_remap_index]
-#define _gloffset_VertexAttrib3svNV driDispatchRemapTable[VertexAttrib3svNV_remap_index]
-#define _gloffset_VertexAttrib4dNV driDispatchRemapTable[VertexAttrib4dNV_remap_index]
-#define _gloffset_VertexAttrib4dvNV driDispatchRemapTable[VertexAttrib4dvNV_remap_index]
-#define _gloffset_VertexAttrib4fNV driDispatchRemapTable[VertexAttrib4fNV_remap_index]
-#define _gloffset_VertexAttrib4fvNV driDispatchRemapTable[VertexAttrib4fvNV_remap_index]
-#define _gloffset_VertexAttrib4sNV driDispatchRemapTable[VertexAttrib4sNV_remap_index]
-#define _gloffset_VertexAttrib4svNV driDispatchRemapTable[VertexAttrib4svNV_remap_index]
-#define _gloffset_VertexAttrib4ubNV driDispatchRemapTable[VertexAttrib4ubNV_remap_index]
-#define _gloffset_VertexAttrib4ubvNV driDispatchRemapTable[VertexAttrib4ubvNV_remap_index]
-#define _gloffset_VertexAttribPointerNV driDispatchRemapTable[VertexAttribPointerNV_remap_index]
-#define _gloffset_VertexAttribs1dvNV driDispatchRemapTable[VertexAttribs1dvNV_remap_index]
-#define _gloffset_VertexAttribs1fvNV driDispatchRemapTable[VertexAttribs1fvNV_remap_index]
-#define _gloffset_VertexAttribs1svNV driDispatchRemapTable[VertexAttribs1svNV_remap_index]
-#define _gloffset_VertexAttribs2dvNV driDispatchRemapTable[VertexAttribs2dvNV_remap_index]
-#define _gloffset_VertexAttribs2fvNV driDispatchRemapTable[VertexAttribs2fvNV_remap_index]
-#define _gloffset_VertexAttribs2svNV driDispatchRemapTable[VertexAttribs2svNV_remap_index]
-#define _gloffset_VertexAttribs3dvNV driDispatchRemapTable[VertexAttribs3dvNV_remap_index]
-#define _gloffset_VertexAttribs3fvNV driDispatchRemapTable[VertexAttribs3fvNV_remap_index]
-#define _gloffset_VertexAttribs3svNV driDispatchRemapTable[VertexAttribs3svNV_remap_index]
-#define _gloffset_VertexAttribs4dvNV driDispatchRemapTable[VertexAttribs4dvNV_remap_index]
-#define _gloffset_VertexAttribs4fvNV driDispatchRemapTable[VertexAttribs4fvNV_remap_index]
-#define _gloffset_VertexAttribs4svNV driDispatchRemapTable[VertexAttribs4svNV_remap_index]
-#define _gloffset_VertexAttribs4ubvNV driDispatchRemapTable[VertexAttribs4ubvNV_remap_index]
-#define _gloffset_GetTexBumpParameterfvATI driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index]
-#define _gloffset_GetTexBumpParameterivATI driDispatchRemapTable[GetTexBumpParameterivATI_remap_index]
-#define _gloffset_TexBumpParameterfvATI driDispatchRemapTable[TexBumpParameterfvATI_remap_index]
-#define _gloffset_TexBumpParameterivATI driDispatchRemapTable[TexBumpParameterivATI_remap_index]
-#define _gloffset_AlphaFragmentOp1ATI driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index]
-#define _gloffset_AlphaFragmentOp2ATI driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index]
-#define _gloffset_AlphaFragmentOp3ATI driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index]
-#define _gloffset_BeginFragmentShaderATI driDispatchRemapTable[BeginFragmentShaderATI_remap_index]
-#define _gloffset_BindFragmentShaderATI driDispatchRemapTable[BindFragmentShaderATI_remap_index]
-#define _gloffset_ColorFragmentOp1ATI driDispatchRemapTable[ColorFragmentOp1ATI_remap_index]
-#define _gloffset_ColorFragmentOp2ATI driDispatchRemapTable[ColorFragmentOp2ATI_remap_index]
-#define _gloffset_ColorFragmentOp3ATI driDispatchRemapTable[ColorFragmentOp3ATI_remap_index]
-#define _gloffset_DeleteFragmentShaderATI driDispatchRemapTable[DeleteFragmentShaderATI_remap_index]
-#define _gloffset_EndFragmentShaderATI driDispatchRemapTable[EndFragmentShaderATI_remap_index]
-#define _gloffset_GenFragmentShadersATI driDispatchRemapTable[GenFragmentShadersATI_remap_index]
-#define _gloffset_PassTexCoordATI driDispatchRemapTable[PassTexCoordATI_remap_index]
-#define _gloffset_SampleMapATI driDispatchRemapTable[SampleMapATI_remap_index]
-#define _gloffset_SetFragmentShaderConstantATI driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index]
-#define _gloffset_PointParameteriNV driDispatchRemapTable[PointParameteriNV_remap_index]
-#define _gloffset_PointParameterivNV driDispatchRemapTable[PointParameterivNV_remap_index]
-#define _gloffset_ActiveStencilFaceEXT driDispatchRemapTable[ActiveStencilFaceEXT_remap_index]
-#define _gloffset_BindVertexArrayAPPLE driDispatchRemapTable[BindVertexArrayAPPLE_remap_index]
-#define _gloffset_DeleteVertexArraysAPPLE driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index]
-#define _gloffset_GenVertexArraysAPPLE driDispatchRemapTable[GenVertexArraysAPPLE_remap_index]
-#define _gloffset_IsVertexArrayAPPLE driDispatchRemapTable[IsVertexArrayAPPLE_remap_index]
-#define _gloffset_GetProgramNamedParameterdvNV driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index]
-#define _gloffset_GetProgramNamedParameterfvNV driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index]
-#define _gloffset_ProgramNamedParameter4dNV driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index]
-#define _gloffset_ProgramNamedParameter4dvNV driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index]
-#define _gloffset_ProgramNamedParameter4fNV driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index]
-#define _gloffset_ProgramNamedParameter4fvNV driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index]
-#define _gloffset_PrimitiveRestartIndexNV driDispatchRemapTable[PrimitiveRestartIndexNV_remap_index]
-#define _gloffset_PrimitiveRestartNV driDispatchRemapTable[PrimitiveRestartNV_remap_index]
-#define _gloffset_DepthBoundsEXT driDispatchRemapTable[DepthBoundsEXT_remap_index]
-#define _gloffset_BlendEquationSeparateEXT driDispatchRemapTable[BlendEquationSeparateEXT_remap_index]
-#define _gloffset_BindFramebufferEXT driDispatchRemapTable[BindFramebufferEXT_remap_index]
-#define _gloffset_BindRenderbufferEXT driDispatchRemapTable[BindRenderbufferEXT_remap_index]
-#define _gloffset_CheckFramebufferStatusEXT driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index]
-#define _gloffset_DeleteFramebuffersEXT driDispatchRemapTable[DeleteFramebuffersEXT_remap_index]
-#define _gloffset_DeleteRenderbuffersEXT driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index]
-#define _gloffset_FramebufferRenderbufferEXT driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index]
-#define _gloffset_FramebufferTexture1DEXT driDispatchRemapTable[FramebufferTexture1DEXT_remap_index]
-#define _gloffset_FramebufferTexture2DEXT driDispatchRemapTable[FramebufferTexture2DEXT_remap_index]
-#define _gloffset_FramebufferTexture3DEXT driDispatchRemapTable[FramebufferTexture3DEXT_remap_index]
-#define _gloffset_GenFramebuffersEXT driDispatchRemapTable[GenFramebuffersEXT_remap_index]
-#define _gloffset_GenRenderbuffersEXT driDispatchRemapTable[GenRenderbuffersEXT_remap_index]
-#define _gloffset_GenerateMipmapEXT driDispatchRemapTable[GenerateMipmapEXT_remap_index]
-#define _gloffset_GetFramebufferAttachmentParameterivEXT driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index]
-#define _gloffset_GetRenderbufferParameterivEXT driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index]
-#define _gloffset_IsFramebufferEXT driDispatchRemapTable[IsFramebufferEXT_remap_index]
-#define _gloffset_IsRenderbufferEXT driDispatchRemapTable[IsRenderbufferEXT_remap_index]
-#define _gloffset_RenderbufferStorageEXT driDispatchRemapTable[RenderbufferStorageEXT_remap_index]
-#define _gloffset_BlitFramebufferEXT driDispatchRemapTable[BlitFramebufferEXT_remap_index]
-#define _gloffset_BufferParameteriAPPLE driDispatchRemapTable[BufferParameteriAPPLE_remap_index]
-#define _gloffset_FlushMappedBufferRangeAPPLE driDispatchRemapTable[FlushMappedBufferRangeAPPLE_remap_index]
-#define _gloffset_BindFragDataLocationEXT driDispatchRemapTable[BindFragDataLocationEXT_remap_index]
-#define _gloffset_GetFragDataLocationEXT driDispatchRemapTable[GetFragDataLocationEXT_remap_index]
-#define _gloffset_GetUniformuivEXT driDispatchRemapTable[GetUniformuivEXT_remap_index]
-#define _gloffset_GetVertexAttribIivEXT driDispatchRemapTable[GetVertexAttribIivEXT_remap_index]
-#define _gloffset_GetVertexAttribIuivEXT driDispatchRemapTable[GetVertexAttribIuivEXT_remap_index]
-#define _gloffset_Uniform1uiEXT driDispatchRemapTable[Uniform1uiEXT_remap_index]
-#define _gloffset_Uniform1uivEXT driDispatchRemapTable[Uniform1uivEXT_remap_index]
-#define _gloffset_Uniform2uiEXT driDispatchRemapTable[Uniform2uiEXT_remap_index]
-#define _gloffset_Uniform2uivEXT driDispatchRemapTable[Uniform2uivEXT_remap_index]
-#define _gloffset_Uniform3uiEXT driDispatchRemapTable[Uniform3uiEXT_remap_index]
-#define _gloffset_Uniform3uivEXT driDispatchRemapTable[Uniform3uivEXT_remap_index]
-#define _gloffset_Uniform4uiEXT driDispatchRemapTable[Uniform4uiEXT_remap_index]
-#define _gloffset_Uniform4uivEXT driDispatchRemapTable[Uniform4uivEXT_remap_index]
-#define _gloffset_VertexAttribI1iEXT driDispatchRemapTable[VertexAttribI1iEXT_remap_index]
-#define _gloffset_VertexAttribI1ivEXT driDispatchRemapTable[VertexAttribI1ivEXT_remap_index]
-#define _gloffset_VertexAttribI1uiEXT driDispatchRemapTable[VertexAttribI1uiEXT_remap_index]
-#define _gloffset_VertexAttribI1uivEXT driDispatchRemapTable[VertexAttribI1uivEXT_remap_index]
-#define _gloffset_VertexAttribI2iEXT driDispatchRemapTable[VertexAttribI2iEXT_remap_index]
-#define _gloffset_VertexAttribI2ivEXT driDispatchRemapTable[VertexAttribI2ivEXT_remap_index]
-#define _gloffset_VertexAttribI2uiEXT driDispatchRemapTable[VertexAttribI2uiEXT_remap_index]
-#define _gloffset_VertexAttribI2uivEXT driDispatchRemapTable[VertexAttribI2uivEXT_remap_index]
-#define _gloffset_VertexAttribI3iEXT driDispatchRemapTable[VertexAttribI3iEXT_remap_index]
-#define _gloffset_VertexAttribI3ivEXT driDispatchRemapTable[VertexAttribI3ivEXT_remap_index]
-#define _gloffset_VertexAttribI3uiEXT driDispatchRemapTable[VertexAttribI3uiEXT_remap_index]
-#define _gloffset_VertexAttribI3uivEXT driDispatchRemapTable[VertexAttribI3uivEXT_remap_index]
-#define _gloffset_VertexAttribI4bvEXT driDispatchRemapTable[VertexAttribI4bvEXT_remap_index]
-#define _gloffset_VertexAttribI4iEXT driDispatchRemapTable[VertexAttribI4iEXT_remap_index]
-#define _gloffset_VertexAttribI4ivEXT driDispatchRemapTable[VertexAttribI4ivEXT_remap_index]
-#define _gloffset_VertexAttribI4svEXT driDispatchRemapTable[VertexAttribI4svEXT_remap_index]
-#define _gloffset_VertexAttribI4ubvEXT driDispatchRemapTable[VertexAttribI4ubvEXT_remap_index]
-#define _gloffset_VertexAttribI4uiEXT driDispatchRemapTable[VertexAttribI4uiEXT_remap_index]
-#define _gloffset_VertexAttribI4uivEXT driDispatchRemapTable[VertexAttribI4uivEXT_remap_index]
-#define _gloffset_VertexAttribI4usvEXT driDispatchRemapTable[VertexAttribI4usvEXT_remap_index]
-#define _gloffset_VertexAttribIPointerEXT driDispatchRemapTable[VertexAttribIPointerEXT_remap_index]
-#define _gloffset_FramebufferTextureLayerEXT driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index]
-#define _gloffset_ColorMaskIndexedEXT driDispatchRemapTable[ColorMaskIndexedEXT_remap_index]
-#define _gloffset_DisableIndexedEXT driDispatchRemapTable[DisableIndexedEXT_remap_index]
-#define _gloffset_EnableIndexedEXT driDispatchRemapTable[EnableIndexedEXT_remap_index]
-#define _gloffset_GetBooleanIndexedvEXT driDispatchRemapTable[GetBooleanIndexedvEXT_remap_index]
-#define _gloffset_GetIntegerIndexedvEXT driDispatchRemapTable[GetIntegerIndexedvEXT_remap_index]
-#define _gloffset_IsEnabledIndexedEXT driDispatchRemapTable[IsEnabledIndexedEXT_remap_index]
-#define _gloffset_ClearColorIiEXT driDispatchRemapTable[ClearColorIiEXT_remap_index]
-#define _gloffset_ClearColorIuiEXT driDispatchRemapTable[ClearColorIuiEXT_remap_index]
-#define _gloffset_GetTexParameterIivEXT driDispatchRemapTable[GetTexParameterIivEXT_remap_index]
-#define _gloffset_GetTexParameterIuivEXT driDispatchRemapTable[GetTexParameterIuivEXT_remap_index]
-#define _gloffset_TexParameterIivEXT driDispatchRemapTable[TexParameterIivEXT_remap_index]
-#define _gloffset_TexParameterIuivEXT driDispatchRemapTable[TexParameterIuivEXT_remap_index]
-#define _gloffset_BeginConditionalRenderNV driDispatchRemapTable[BeginConditionalRenderNV_remap_index]
-#define _gloffset_EndConditionalRenderNV driDispatchRemapTable[EndConditionalRenderNV_remap_index]
-#define _gloffset_BeginTransformFeedbackEXT driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index]
-#define _gloffset_BindBufferBaseEXT driDispatchRemapTable[BindBufferBaseEXT_remap_index]
-#define _gloffset_BindBufferOffsetEXT driDispatchRemapTable[BindBufferOffsetEXT_remap_index]
-#define _gloffset_BindBufferRangeEXT driDispatchRemapTable[BindBufferRangeEXT_remap_index]
-#define _gloffset_EndTransformFeedbackEXT driDispatchRemapTable[EndTransformFeedbackEXT_remap_index]
-#define _gloffset_GetTransformFeedbackVaryingEXT driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index]
-#define _gloffset_TransformFeedbackVaryingsEXT driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index]
-#define _gloffset_ProvokingVertexEXT driDispatchRemapTable[ProvokingVertexEXT_remap_index]
-#define _gloffset_GetTexParameterPointervAPPLE driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index]
-#define _gloffset_TextureRangeAPPLE driDispatchRemapTable[TextureRangeAPPLE_remap_index]
-#define _gloffset_GetObjectParameterivAPPLE driDispatchRemapTable[GetObjectParameterivAPPLE_remap_index]
-#define _gloffset_ObjectPurgeableAPPLE driDispatchRemapTable[ObjectPurgeableAPPLE_remap_index]
-#define _gloffset_ObjectUnpurgeableAPPLE driDispatchRemapTable[ObjectUnpurgeableAPPLE_remap_index]
-#define _gloffset_ActiveProgramEXT driDispatchRemapTable[ActiveProgramEXT_remap_index]
-#define _gloffset_CreateShaderProgramEXT driDispatchRemapTable[CreateShaderProgramEXT_remap_index]
-#define _gloffset_UseShaderProgramEXT driDispatchRemapTable[UseShaderProgramEXT_remap_index]
-#define _gloffset_TextureBarrierNV driDispatchRemapTable[TextureBarrierNV_remap_index]
-#define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index]
-#define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]
-#define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index]
-#define _gloffset_GetQueryObjecti64vEXT driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index]
-#define _gloffset_GetQueryObjectui64vEXT driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index]
-#define _gloffset_EGLImageTargetRenderbufferStorageOES driDispatchRemapTable[EGLImageTargetRenderbufferStorageOES_remap_index]
-#define _gloffset_EGLImageTargetTexture2DOES driDispatchRemapTable[EGLImageTargetTexture2DOES_remap_index]
-
-#endif /* !FEATURE_remap_table */
-
-typedef void (GLAPIENTRYP _glptr_NewList)(GLuint, GLenum);
-#define CALL_NewList(disp, parameters) \
- (* GET_NewList(disp)) parameters
-static INLINE _glptr_NewList GET_NewList(struct _glapi_table *disp) {
- return (_glptr_NewList) (GET_by_offset(disp, _gloffset_NewList));
-}
-
-static INLINE void SET_NewList(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum)) {
- SET_by_offset(disp, _gloffset_NewList, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EndList)(void);
-#define CALL_EndList(disp, parameters) \
- (* GET_EndList(disp)) parameters
-static INLINE _glptr_EndList GET_EndList(struct _glapi_table *disp) {
- return (_glptr_EndList) (GET_by_offset(disp, _gloffset_EndList));
-}
-
-static INLINE void SET_EndList(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_EndList, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CallList)(GLuint);
-#define CALL_CallList(disp, parameters) \
- (* GET_CallList(disp)) parameters
-static INLINE _glptr_CallList GET_CallList(struct _glapi_table *disp) {
- return (_glptr_CallList) (GET_by_offset(disp, _gloffset_CallList));
-}
-
-static INLINE void SET_CallList(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_CallList, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CallLists)(GLsizei, GLenum, const GLvoid *);
-#define CALL_CallLists(disp, parameters) \
- (* GET_CallLists(disp)) parameters
-static INLINE _glptr_CallLists GET_CallLists(struct _glapi_table *disp) {
- return (_glptr_CallLists) (GET_by_offset(disp, _gloffset_CallLists));
-}
-
-static INLINE void SET_CallLists(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CallLists, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteLists)(GLuint, GLsizei);
-#define CALL_DeleteLists(disp, parameters) \
- (* GET_DeleteLists(disp)) parameters
-static INLINE _glptr_DeleteLists GET_DeleteLists(struct _glapi_table *disp) {
- return (_glptr_DeleteLists) (GET_by_offset(disp, _gloffset_DeleteLists));
-}
-
-static INLINE void SET_DeleteLists(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei)) {
- SET_by_offset(disp, _gloffset_DeleteLists, fn);
-}
-
-typedef GLuint (GLAPIENTRYP _glptr_GenLists)(GLsizei);
-#define CALL_GenLists(disp, parameters) \
- (* GET_GenLists(disp)) parameters
-static INLINE _glptr_GenLists GET_GenLists(struct _glapi_table *disp) {
- return (_glptr_GenLists) (GET_by_offset(disp, _gloffset_GenLists));
-}
-
-static INLINE void SET_GenLists(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(GLsizei)) {
- SET_by_offset(disp, _gloffset_GenLists, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ListBase)(GLuint);
-#define CALL_ListBase(disp, parameters) \
- (* GET_ListBase(disp)) parameters
-static INLINE _glptr_ListBase GET_ListBase(struct _glapi_table *disp) {
- return (_glptr_ListBase) (GET_by_offset(disp, _gloffset_ListBase));
-}
-
-static INLINE void SET_ListBase(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_ListBase, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Begin)(GLenum);
-#define CALL_Begin(disp, parameters) \
- (* GET_Begin(disp)) parameters
-static INLINE _glptr_Begin GET_Begin(struct _glapi_table *disp) {
- return (_glptr_Begin) (GET_by_offset(disp, _gloffset_Begin));
-}
-
-static INLINE void SET_Begin(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_Begin, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Bitmap)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *);
-#define CALL_Bitmap(disp, parameters) \
- (* GET_Bitmap(disp)) parameters
-static INLINE _glptr_Bitmap GET_Bitmap(struct _glapi_table *disp) {
- return (_glptr_Bitmap) (GET_by_offset(disp, _gloffset_Bitmap));
-}
-
-static INLINE void SET_Bitmap(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *)) {
- SET_by_offset(disp, _gloffset_Bitmap, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3b)(GLbyte, GLbyte, GLbyte);
-#define CALL_Color3b(disp, parameters) \
- (* GET_Color3b(disp)) parameters
-static INLINE _glptr_Color3b GET_Color3b(struct _glapi_table *disp) {
- return (_glptr_Color3b) (GET_by_offset(disp, _gloffset_Color3b));
-}
-
-static INLINE void SET_Color3b(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbyte, GLbyte, GLbyte)) {
- SET_by_offset(disp, _gloffset_Color3b, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3bv)(const GLbyte *);
-#define CALL_Color3bv(disp, parameters) \
- (* GET_Color3bv(disp)) parameters
-static INLINE _glptr_Color3bv GET_Color3bv(struct _glapi_table *disp) {
- return (_glptr_Color3bv) (GET_by_offset(disp, _gloffset_Color3bv));
-}
-
-static INLINE void SET_Color3bv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLbyte *)) {
- SET_by_offset(disp, _gloffset_Color3bv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3d)(GLdouble, GLdouble, GLdouble);
-#define CALL_Color3d(disp, parameters) \
- (* GET_Color3d(disp)) parameters
-static INLINE _glptr_Color3d GET_Color3d(struct _glapi_table *disp) {
- return (_glptr_Color3d) (GET_by_offset(disp, _gloffset_Color3d));
-}
-
-static INLINE void SET_Color3d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Color3d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3dv)(const GLdouble *);
-#define CALL_Color3dv(disp, parameters) \
- (* GET_Color3dv(disp)) parameters
-static INLINE _glptr_Color3dv GET_Color3dv(struct _glapi_table *disp) {
- return (_glptr_Color3dv) (GET_by_offset(disp, _gloffset_Color3dv));
-}
-
-static INLINE void SET_Color3dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_Color3dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3f)(GLfloat, GLfloat, GLfloat);
-#define CALL_Color3f(disp, parameters) \
- (* GET_Color3f(disp)) parameters
-static INLINE _glptr_Color3f GET_Color3f(struct _glapi_table *disp) {
- return (_glptr_Color3f) (GET_by_offset(disp, _gloffset_Color3f));
-}
-
-static INLINE void SET_Color3f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Color3f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3fv)(const GLfloat *);
-#define CALL_Color3fv(disp, parameters) \
- (* GET_Color3fv(disp)) parameters
-static INLINE _glptr_Color3fv GET_Color3fv(struct _glapi_table *disp) {
- return (_glptr_Color3fv) (GET_by_offset(disp, _gloffset_Color3fv));
-}
-
-static INLINE void SET_Color3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Color3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3i)(GLint, GLint, GLint);
-#define CALL_Color3i(disp, parameters) \
- (* GET_Color3i(disp)) parameters
-static INLINE _glptr_Color3i GET_Color3i(struct _glapi_table *disp) {
- return (_glptr_Color3i) (GET_by_offset(disp, _gloffset_Color3i));
-}
-
-static INLINE void SET_Color3i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Color3i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3iv)(const GLint *);
-#define CALL_Color3iv(disp, parameters) \
- (* GET_Color3iv(disp)) parameters
-static INLINE _glptr_Color3iv GET_Color3iv(struct _glapi_table *disp) {
- return (_glptr_Color3iv) (GET_by_offset(disp, _gloffset_Color3iv));
-}
-
-static INLINE void SET_Color3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_Color3iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3s)(GLshort, GLshort, GLshort);
-#define CALL_Color3s(disp, parameters) \
- (* GET_Color3s(disp)) parameters
-static INLINE _glptr_Color3s GET_Color3s(struct _glapi_table *disp) {
- return (_glptr_Color3s) (GET_by_offset(disp, _gloffset_Color3s));
-}
-
-static INLINE void SET_Color3s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_Color3s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3sv)(const GLshort *);
-#define CALL_Color3sv(disp, parameters) \
- (* GET_Color3sv(disp)) parameters
-static INLINE _glptr_Color3sv GET_Color3sv(struct _glapi_table *disp) {
- return (_glptr_Color3sv) (GET_by_offset(disp, _gloffset_Color3sv));
-}
-
-static INLINE void SET_Color3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_Color3sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3ub)(GLubyte, GLubyte, GLubyte);
-#define CALL_Color3ub(disp, parameters) \
- (* GET_Color3ub(disp)) parameters
-static INLINE _glptr_Color3ub GET_Color3ub(struct _glapi_table *disp) {
- return (_glptr_Color3ub) (GET_by_offset(disp, _gloffset_Color3ub));
-}
-
-static INLINE void SET_Color3ub(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLubyte, GLubyte, GLubyte)) {
- SET_by_offset(disp, _gloffset_Color3ub, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3ubv)(const GLubyte *);
-#define CALL_Color3ubv(disp, parameters) \
- (* GET_Color3ubv(disp)) parameters
-static INLINE _glptr_Color3ubv GET_Color3ubv(struct _glapi_table *disp) {
- return (_glptr_Color3ubv) (GET_by_offset(disp, _gloffset_Color3ubv));
-}
-
-static INLINE void SET_Color3ubv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLubyte *)) {
- SET_by_offset(disp, _gloffset_Color3ubv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3ui)(GLuint, GLuint, GLuint);
-#define CALL_Color3ui(disp, parameters) \
- (* GET_Color3ui(disp)) parameters
-static INLINE _glptr_Color3ui GET_Color3ui(struct _glapi_table *disp) {
- return (_glptr_Color3ui) (GET_by_offset(disp, _gloffset_Color3ui));
-}
-
-static INLINE void SET_Color3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_Color3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3uiv)(const GLuint *);
-#define CALL_Color3uiv(disp, parameters) \
- (* GET_Color3uiv(disp)) parameters
-static INLINE _glptr_Color3uiv GET_Color3uiv(struct _glapi_table *disp) {
- return (_glptr_Color3uiv) (GET_by_offset(disp, _gloffset_Color3uiv));
-}
-
-static INLINE void SET_Color3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLuint *)) {
- SET_by_offset(disp, _gloffset_Color3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3us)(GLushort, GLushort, GLushort);
-#define CALL_Color3us(disp, parameters) \
- (* GET_Color3us(disp)) parameters
-static INLINE _glptr_Color3us GET_Color3us(struct _glapi_table *disp) {
- return (_glptr_Color3us) (GET_by_offset(disp, _gloffset_Color3us));
-}
-
-static INLINE void SET_Color3us(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLushort, GLushort, GLushort)) {
- SET_by_offset(disp, _gloffset_Color3us, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3usv)(const GLushort *);
-#define CALL_Color3usv(disp, parameters) \
- (* GET_Color3usv(disp)) parameters
-static INLINE _glptr_Color3usv GET_Color3usv(struct _glapi_table *disp) {
- return (_glptr_Color3usv) (GET_by_offset(disp, _gloffset_Color3usv));
-}
-
-static INLINE void SET_Color3usv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLushort *)) {
- SET_by_offset(disp, _gloffset_Color3usv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4b)(GLbyte, GLbyte, GLbyte, GLbyte);
-#define CALL_Color4b(disp, parameters) \
- (* GET_Color4b(disp)) parameters
-static INLINE _glptr_Color4b GET_Color4b(struct _glapi_table *disp) {
- return (_glptr_Color4b) (GET_by_offset(disp, _gloffset_Color4b));
-}
-
-static INLINE void SET_Color4b(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbyte, GLbyte, GLbyte, GLbyte)) {
- SET_by_offset(disp, _gloffset_Color4b, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4bv)(const GLbyte *);
-#define CALL_Color4bv(disp, parameters) \
- (* GET_Color4bv(disp)) parameters
-static INLINE _glptr_Color4bv GET_Color4bv(struct _glapi_table *disp) {
- return (_glptr_Color4bv) (GET_by_offset(disp, _gloffset_Color4bv));
-}
-
-static INLINE void SET_Color4bv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLbyte *)) {
- SET_by_offset(disp, _gloffset_Color4bv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4d)(GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_Color4d(disp, parameters) \
- (* GET_Color4d(disp)) parameters
-static INLINE _glptr_Color4d GET_Color4d(struct _glapi_table *disp) {
- return (_glptr_Color4d) (GET_by_offset(disp, _gloffset_Color4d));
-}
-
-static INLINE void SET_Color4d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Color4d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4dv)(const GLdouble *);
-#define CALL_Color4dv(disp, parameters) \
- (* GET_Color4dv(disp)) parameters
-static INLINE _glptr_Color4dv GET_Color4dv(struct _glapi_table *disp) {
- return (_glptr_Color4dv) (GET_by_offset(disp, _gloffset_Color4dv));
-}
-
-static INLINE void SET_Color4dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_Color4dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4f)(GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_Color4f(disp, parameters) \
- (* GET_Color4f(disp)) parameters
-static INLINE _glptr_Color4f GET_Color4f(struct _glapi_table *disp) {
- return (_glptr_Color4f) (GET_by_offset(disp, _gloffset_Color4f));
-}
-
-static INLINE void SET_Color4f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Color4f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4fv)(const GLfloat *);
-#define CALL_Color4fv(disp, parameters) \
- (* GET_Color4fv(disp)) parameters
-static INLINE _glptr_Color4fv GET_Color4fv(struct _glapi_table *disp) {
- return (_glptr_Color4fv) (GET_by_offset(disp, _gloffset_Color4fv));
-}
-
-static INLINE void SET_Color4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Color4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4i)(GLint, GLint, GLint, GLint);
-#define CALL_Color4i(disp, parameters) \
- (* GET_Color4i(disp)) parameters
-static INLINE _glptr_Color4i GET_Color4i(struct _glapi_table *disp) {
- return (_glptr_Color4i) (GET_by_offset(disp, _gloffset_Color4i));
-}
-
-static INLINE void SET_Color4i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Color4i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4iv)(const GLint *);
-#define CALL_Color4iv(disp, parameters) \
- (* GET_Color4iv(disp)) parameters
-static INLINE _glptr_Color4iv GET_Color4iv(struct _glapi_table *disp) {
- return (_glptr_Color4iv) (GET_by_offset(disp, _gloffset_Color4iv));
-}
-
-static INLINE void SET_Color4iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_Color4iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4s)(GLshort, GLshort, GLshort, GLshort);
-#define CALL_Color4s(disp, parameters) \
- (* GET_Color4s(disp)) parameters
-static INLINE _glptr_Color4s GET_Color4s(struct _glapi_table *disp) {
- return (_glptr_Color4s) (GET_by_offset(disp, _gloffset_Color4s));
-}
-
-static INLINE void SET_Color4s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_Color4s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4sv)(const GLshort *);
-#define CALL_Color4sv(disp, parameters) \
- (* GET_Color4sv(disp)) parameters
-static INLINE _glptr_Color4sv GET_Color4sv(struct _glapi_table *disp) {
- return (_glptr_Color4sv) (GET_by_offset(disp, _gloffset_Color4sv));
-}
-
-static INLINE void SET_Color4sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_Color4sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte);
-#define CALL_Color4ub(disp, parameters) \
- (* GET_Color4ub(disp)) parameters
-static INLINE _glptr_Color4ub GET_Color4ub(struct _glapi_table *disp) {
- return (_glptr_Color4ub) (GET_by_offset(disp, _gloffset_Color4ub));
-}
-
-static INLINE void SET_Color4ub(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLubyte, GLubyte, GLubyte, GLubyte)) {
- SET_by_offset(disp, _gloffset_Color4ub, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4ubv)(const GLubyte *);
-#define CALL_Color4ubv(disp, parameters) \
- (* GET_Color4ubv(disp)) parameters
-static INLINE _glptr_Color4ubv GET_Color4ubv(struct _glapi_table *disp) {
- return (_glptr_Color4ubv) (GET_by_offset(disp, _gloffset_Color4ubv));
-}
-
-static INLINE void SET_Color4ubv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLubyte *)) {
- SET_by_offset(disp, _gloffset_Color4ubv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4ui)(GLuint, GLuint, GLuint, GLuint);
-#define CALL_Color4ui(disp, parameters) \
- (* GET_Color4ui(disp)) parameters
-static INLINE _glptr_Color4ui GET_Color4ui(struct _glapi_table *disp) {
- return (_glptr_Color4ui) (GET_by_offset(disp, _gloffset_Color4ui));
-}
-
-static INLINE void SET_Color4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_Color4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4uiv)(const GLuint *);
-#define CALL_Color4uiv(disp, parameters) \
- (* GET_Color4uiv(disp)) parameters
-static INLINE _glptr_Color4uiv GET_Color4uiv(struct _glapi_table *disp) {
- return (_glptr_Color4uiv) (GET_by_offset(disp, _gloffset_Color4uiv));
-}
-
-static INLINE void SET_Color4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLuint *)) {
- SET_by_offset(disp, _gloffset_Color4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4us)(GLushort, GLushort, GLushort, GLushort);
-#define CALL_Color4us(disp, parameters) \
- (* GET_Color4us(disp)) parameters
-static INLINE _glptr_Color4us GET_Color4us(struct _glapi_table *disp) {
- return (_glptr_Color4us) (GET_by_offset(disp, _gloffset_Color4us));
-}
-
-static INLINE void SET_Color4us(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLushort, GLushort, GLushort, GLushort)) {
- SET_by_offset(disp, _gloffset_Color4us, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4usv)(const GLushort *);
-#define CALL_Color4usv(disp, parameters) \
- (* GET_Color4usv(disp)) parameters
-static INLINE _glptr_Color4usv GET_Color4usv(struct _glapi_table *disp) {
- return (_glptr_Color4usv) (GET_by_offset(disp, _gloffset_Color4usv));
-}
-
-static INLINE void SET_Color4usv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLushort *)) {
- SET_by_offset(disp, _gloffset_Color4usv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EdgeFlag)(GLboolean);
-#define CALL_EdgeFlag(disp, parameters) \
- (* GET_EdgeFlag(disp)) parameters
-static INLINE _glptr_EdgeFlag GET_EdgeFlag(struct _glapi_table *disp) {
- return (_glptr_EdgeFlag) (GET_by_offset(disp, _gloffset_EdgeFlag));
-}
-
-static INLINE void SET_EdgeFlag(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLboolean)) {
- SET_by_offset(disp, _gloffset_EdgeFlag, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EdgeFlagv)(const GLboolean *);
-#define CALL_EdgeFlagv(disp, parameters) \
- (* GET_EdgeFlagv(disp)) parameters
-static INLINE _glptr_EdgeFlagv GET_EdgeFlagv(struct _glapi_table *disp) {
- return (_glptr_EdgeFlagv) (GET_by_offset(disp, _gloffset_EdgeFlagv));
-}
-
-static INLINE void SET_EdgeFlagv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLboolean *)) {
- SET_by_offset(disp, _gloffset_EdgeFlagv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_End)(void);
-#define CALL_End(disp, parameters) \
- (* GET_End(disp)) parameters
-static INLINE _glptr_End GET_End(struct _glapi_table *disp) {
- return (_glptr_End) (GET_by_offset(disp, _gloffset_End));
-}
-
-static INLINE void SET_End(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_End, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexd)(GLdouble);
-#define CALL_Indexd(disp, parameters) \
- (* GET_Indexd(disp)) parameters
-static INLINE _glptr_Indexd GET_Indexd(struct _glapi_table *disp) {
- return (_glptr_Indexd) (GET_by_offset(disp, _gloffset_Indexd));
-}
-
-static INLINE void SET_Indexd(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble)) {
- SET_by_offset(disp, _gloffset_Indexd, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexdv)(const GLdouble *);
-#define CALL_Indexdv(disp, parameters) \
- (* GET_Indexdv(disp)) parameters
-static INLINE _glptr_Indexdv GET_Indexdv(struct _glapi_table *disp) {
- return (_glptr_Indexdv) (GET_by_offset(disp, _gloffset_Indexdv));
-}
-
-static INLINE void SET_Indexdv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_Indexdv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexf)(GLfloat);
-#define CALL_Indexf(disp, parameters) \
- (* GET_Indexf(disp)) parameters
-static INLINE _glptr_Indexf GET_Indexf(struct _glapi_table *disp) {
- return (_glptr_Indexf) (GET_by_offset(disp, _gloffset_Indexf));
-}
-
-static INLINE void SET_Indexf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
- SET_by_offset(disp, _gloffset_Indexf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexfv)(const GLfloat *);
-#define CALL_Indexfv(disp, parameters) \
- (* GET_Indexfv(disp)) parameters
-static INLINE _glptr_Indexfv GET_Indexfv(struct _glapi_table *disp) {
- return (_glptr_Indexfv) (GET_by_offset(disp, _gloffset_Indexfv));
-}
-
-static INLINE void SET_Indexfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Indexfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexi)(GLint);
-#define CALL_Indexi(disp, parameters) \
- (* GET_Indexi(disp)) parameters
-static INLINE _glptr_Indexi GET_Indexi(struct _glapi_table *disp) {
- return (_glptr_Indexi) (GET_by_offset(disp, _gloffset_Indexi));
-}
-
-static INLINE void SET_Indexi(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint)) {
- SET_by_offset(disp, _gloffset_Indexi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexiv)(const GLint *);
-#define CALL_Indexiv(disp, parameters) \
- (* GET_Indexiv(disp)) parameters
-static INLINE _glptr_Indexiv GET_Indexiv(struct _glapi_table *disp) {
- return (_glptr_Indexiv) (GET_by_offset(disp, _gloffset_Indexiv));
-}
-
-static INLINE void SET_Indexiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_Indexiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexs)(GLshort);
-#define CALL_Indexs(disp, parameters) \
- (* GET_Indexs(disp)) parameters
-static INLINE _glptr_Indexs GET_Indexs(struct _glapi_table *disp) {
- return (_glptr_Indexs) (GET_by_offset(disp, _gloffset_Indexs));
-}
-
-static INLINE void SET_Indexs(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort)) {
- SET_by_offset(disp, _gloffset_Indexs, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexsv)(const GLshort *);
-#define CALL_Indexsv(disp, parameters) \
- (* GET_Indexsv(disp)) parameters
-static INLINE _glptr_Indexsv GET_Indexsv(struct _glapi_table *disp) {
- return (_glptr_Indexsv) (GET_by_offset(disp, _gloffset_Indexsv));
-}
-
-static INLINE void SET_Indexsv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_Indexsv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3b)(GLbyte, GLbyte, GLbyte);
-#define CALL_Normal3b(disp, parameters) \
- (* GET_Normal3b(disp)) parameters
-static INLINE _glptr_Normal3b GET_Normal3b(struct _glapi_table *disp) {
- return (_glptr_Normal3b) (GET_by_offset(disp, _gloffset_Normal3b));
-}
-
-static INLINE void SET_Normal3b(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbyte, GLbyte, GLbyte)) {
- SET_by_offset(disp, _gloffset_Normal3b, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3bv)(const GLbyte *);
-#define CALL_Normal3bv(disp, parameters) \
- (* GET_Normal3bv(disp)) parameters
-static INLINE _glptr_Normal3bv GET_Normal3bv(struct _glapi_table *disp) {
- return (_glptr_Normal3bv) (GET_by_offset(disp, _gloffset_Normal3bv));
-}
-
-static INLINE void SET_Normal3bv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLbyte *)) {
- SET_by_offset(disp, _gloffset_Normal3bv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3d)(GLdouble, GLdouble, GLdouble);
-#define CALL_Normal3d(disp, parameters) \
- (* GET_Normal3d(disp)) parameters
-static INLINE _glptr_Normal3d GET_Normal3d(struct _glapi_table *disp) {
- return (_glptr_Normal3d) (GET_by_offset(disp, _gloffset_Normal3d));
-}
-
-static INLINE void SET_Normal3d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Normal3d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3dv)(const GLdouble *);
-#define CALL_Normal3dv(disp, parameters) \
- (* GET_Normal3dv(disp)) parameters
-static INLINE _glptr_Normal3dv GET_Normal3dv(struct _glapi_table *disp) {
- return (_glptr_Normal3dv) (GET_by_offset(disp, _gloffset_Normal3dv));
-}
-
-static INLINE void SET_Normal3dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_Normal3dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3f)(GLfloat, GLfloat, GLfloat);
-#define CALL_Normal3f(disp, parameters) \
- (* GET_Normal3f(disp)) parameters
-static INLINE _glptr_Normal3f GET_Normal3f(struct _glapi_table *disp) {
- return (_glptr_Normal3f) (GET_by_offset(disp, _gloffset_Normal3f));
-}
-
-static INLINE void SET_Normal3f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Normal3f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3fv)(const GLfloat *);
-#define CALL_Normal3fv(disp, parameters) \
- (* GET_Normal3fv(disp)) parameters
-static INLINE _glptr_Normal3fv GET_Normal3fv(struct _glapi_table *disp) {
- return (_glptr_Normal3fv) (GET_by_offset(disp, _gloffset_Normal3fv));
-}
-
-static INLINE void SET_Normal3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Normal3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3i)(GLint, GLint, GLint);
-#define CALL_Normal3i(disp, parameters) \
- (* GET_Normal3i(disp)) parameters
-static INLINE _glptr_Normal3i GET_Normal3i(struct _glapi_table *disp) {
- return (_glptr_Normal3i) (GET_by_offset(disp, _gloffset_Normal3i));
-}
-
-static INLINE void SET_Normal3i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Normal3i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3iv)(const GLint *);
-#define CALL_Normal3iv(disp, parameters) \
- (* GET_Normal3iv(disp)) parameters
-static INLINE _glptr_Normal3iv GET_Normal3iv(struct _glapi_table *disp) {
- return (_glptr_Normal3iv) (GET_by_offset(disp, _gloffset_Normal3iv));
-}
-
-static INLINE void SET_Normal3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_Normal3iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3s)(GLshort, GLshort, GLshort);
-#define CALL_Normal3s(disp, parameters) \
- (* GET_Normal3s(disp)) parameters
-static INLINE _glptr_Normal3s GET_Normal3s(struct _glapi_table *disp) {
- return (_glptr_Normal3s) (GET_by_offset(disp, _gloffset_Normal3s));
-}
-
-static INLINE void SET_Normal3s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_Normal3s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3sv)(const GLshort *);
-#define CALL_Normal3sv(disp, parameters) \
- (* GET_Normal3sv(disp)) parameters
-static INLINE _glptr_Normal3sv GET_Normal3sv(struct _glapi_table *disp) {
- return (_glptr_Normal3sv) (GET_by_offset(disp, _gloffset_Normal3sv));
-}
-
-static INLINE void SET_Normal3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_Normal3sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2d)(GLdouble, GLdouble);
-#define CALL_RasterPos2d(disp, parameters) \
- (* GET_RasterPos2d(disp)) parameters
-static INLINE _glptr_RasterPos2d GET_RasterPos2d(struct _glapi_table *disp) {
- return (_glptr_RasterPos2d) (GET_by_offset(disp, _gloffset_RasterPos2d));
-}
-
-static INLINE void SET_RasterPos2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_RasterPos2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2dv)(const GLdouble *);
-#define CALL_RasterPos2dv(disp, parameters) \
- (* GET_RasterPos2dv(disp)) parameters
-static INLINE _glptr_RasterPos2dv GET_RasterPos2dv(struct _glapi_table *disp) {
- return (_glptr_RasterPos2dv) (GET_by_offset(disp, _gloffset_RasterPos2dv));
-}
-
-static INLINE void SET_RasterPos2dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_RasterPos2dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2f)(GLfloat, GLfloat);
-#define CALL_RasterPos2f(disp, parameters) \
- (* GET_RasterPos2f(disp)) parameters
-static INLINE _glptr_RasterPos2f GET_RasterPos2f(struct _glapi_table *disp) {
- return (_glptr_RasterPos2f) (GET_by_offset(disp, _gloffset_RasterPos2f));
-}
-
-static INLINE void SET_RasterPos2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_RasterPos2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2fv)(const GLfloat *);
-#define CALL_RasterPos2fv(disp, parameters) \
- (* GET_RasterPos2fv(disp)) parameters
-static INLINE _glptr_RasterPos2fv GET_RasterPos2fv(struct _glapi_table *disp) {
- return (_glptr_RasterPos2fv) (GET_by_offset(disp, _gloffset_RasterPos2fv));
-}
-
-static INLINE void SET_RasterPos2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_RasterPos2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2i)(GLint, GLint);
-#define CALL_RasterPos2i(disp, parameters) \
- (* GET_RasterPos2i(disp)) parameters
-static INLINE _glptr_RasterPos2i GET_RasterPos2i(struct _glapi_table *disp) {
- return (_glptr_RasterPos2i) (GET_by_offset(disp, _gloffset_RasterPos2i));
-}
-
-static INLINE void SET_RasterPos2i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
- SET_by_offset(disp, _gloffset_RasterPos2i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2iv)(const GLint *);
-#define CALL_RasterPos2iv(disp, parameters) \
- (* GET_RasterPos2iv(disp)) parameters
-static INLINE _glptr_RasterPos2iv GET_RasterPos2iv(struct _glapi_table *disp) {
- return (_glptr_RasterPos2iv) (GET_by_offset(disp, _gloffset_RasterPos2iv));
-}
-
-static INLINE void SET_RasterPos2iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_RasterPos2iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2s)(GLshort, GLshort);
-#define CALL_RasterPos2s(disp, parameters) \
- (* GET_RasterPos2s(disp)) parameters
-static INLINE _glptr_RasterPos2s GET_RasterPos2s(struct _glapi_table *disp) {
- return (_glptr_RasterPos2s) (GET_by_offset(disp, _gloffset_RasterPos2s));
-}
-
-static INLINE void SET_RasterPos2s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_RasterPos2s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2sv)(const GLshort *);
-#define CALL_RasterPos2sv(disp, parameters) \
- (* GET_RasterPos2sv(disp)) parameters
-static INLINE _glptr_RasterPos2sv GET_RasterPos2sv(struct _glapi_table *disp) {
- return (_glptr_RasterPos2sv) (GET_by_offset(disp, _gloffset_RasterPos2sv));
-}
-
-static INLINE void SET_RasterPos2sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_RasterPos2sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3d)(GLdouble, GLdouble, GLdouble);
-#define CALL_RasterPos3d(disp, parameters) \
- (* GET_RasterPos3d(disp)) parameters
-static INLINE _glptr_RasterPos3d GET_RasterPos3d(struct _glapi_table *disp) {
- return (_glptr_RasterPos3d) (GET_by_offset(disp, _gloffset_RasterPos3d));
-}
-
-static INLINE void SET_RasterPos3d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_RasterPos3d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3dv)(const GLdouble *);
-#define CALL_RasterPos3dv(disp, parameters) \
- (* GET_RasterPos3dv(disp)) parameters
-static INLINE _glptr_RasterPos3dv GET_RasterPos3dv(struct _glapi_table *disp) {
- return (_glptr_RasterPos3dv) (GET_by_offset(disp, _gloffset_RasterPos3dv));
-}
-
-static INLINE void SET_RasterPos3dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_RasterPos3dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3f)(GLfloat, GLfloat, GLfloat);
-#define CALL_RasterPos3f(disp, parameters) \
- (* GET_RasterPos3f(disp)) parameters
-static INLINE _glptr_RasterPos3f GET_RasterPos3f(struct _glapi_table *disp) {
- return (_glptr_RasterPos3f) (GET_by_offset(disp, _gloffset_RasterPos3f));
-}
-
-static INLINE void SET_RasterPos3f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_RasterPos3f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3fv)(const GLfloat *);
-#define CALL_RasterPos3fv(disp, parameters) \
- (* GET_RasterPos3fv(disp)) parameters
-static INLINE _glptr_RasterPos3fv GET_RasterPos3fv(struct _glapi_table *disp) {
- return (_glptr_RasterPos3fv) (GET_by_offset(disp, _gloffset_RasterPos3fv));
-}
-
-static INLINE void SET_RasterPos3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_RasterPos3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3i)(GLint, GLint, GLint);
-#define CALL_RasterPos3i(disp, parameters) \
- (* GET_RasterPos3i(disp)) parameters
-static INLINE _glptr_RasterPos3i GET_RasterPos3i(struct _glapi_table *disp) {
- return (_glptr_RasterPos3i) (GET_by_offset(disp, _gloffset_RasterPos3i));
-}
-
-static INLINE void SET_RasterPos3i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_RasterPos3i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3iv)(const GLint *);
-#define CALL_RasterPos3iv(disp, parameters) \
- (* GET_RasterPos3iv(disp)) parameters
-static INLINE _glptr_RasterPos3iv GET_RasterPos3iv(struct _glapi_table *disp) {
- return (_glptr_RasterPos3iv) (GET_by_offset(disp, _gloffset_RasterPos3iv));
-}
-
-static INLINE void SET_RasterPos3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_RasterPos3iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3s)(GLshort, GLshort, GLshort);
-#define CALL_RasterPos3s(disp, parameters) \
- (* GET_RasterPos3s(disp)) parameters
-static INLINE _glptr_RasterPos3s GET_RasterPos3s(struct _glapi_table *disp) {
- return (_glptr_RasterPos3s) (GET_by_offset(disp, _gloffset_RasterPos3s));
-}
-
-static INLINE void SET_RasterPos3s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_RasterPos3s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3sv)(const GLshort *);
-#define CALL_RasterPos3sv(disp, parameters) \
- (* GET_RasterPos3sv(disp)) parameters
-static INLINE _glptr_RasterPos3sv GET_RasterPos3sv(struct _glapi_table *disp) {
- return (_glptr_RasterPos3sv) (GET_by_offset(disp, _gloffset_RasterPos3sv));
-}
-
-static INLINE void SET_RasterPos3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_RasterPos3sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_RasterPos4d(disp, parameters) \
- (* GET_RasterPos4d(disp)) parameters
-static INLINE _glptr_RasterPos4d GET_RasterPos4d(struct _glapi_table *disp) {
- return (_glptr_RasterPos4d) (GET_by_offset(disp, _gloffset_RasterPos4d));
-}
-
-static INLINE void SET_RasterPos4d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_RasterPos4d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4dv)(const GLdouble *);
-#define CALL_RasterPos4dv(disp, parameters) \
- (* GET_RasterPos4dv(disp)) parameters
-static INLINE _glptr_RasterPos4dv GET_RasterPos4dv(struct _glapi_table *disp) {
- return (_glptr_RasterPos4dv) (GET_by_offset(disp, _gloffset_RasterPos4dv));
-}
-
-static INLINE void SET_RasterPos4dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_RasterPos4dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4f)(GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_RasterPos4f(disp, parameters) \
- (* GET_RasterPos4f(disp)) parameters
-static INLINE _glptr_RasterPos4f GET_RasterPos4f(struct _glapi_table *disp) {
- return (_glptr_RasterPos4f) (GET_by_offset(disp, _gloffset_RasterPos4f));
-}
-
-static INLINE void SET_RasterPos4f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_RasterPos4f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4fv)(const GLfloat *);
-#define CALL_RasterPos4fv(disp, parameters) \
- (* GET_RasterPos4fv(disp)) parameters
-static INLINE _glptr_RasterPos4fv GET_RasterPos4fv(struct _glapi_table *disp) {
- return (_glptr_RasterPos4fv) (GET_by_offset(disp, _gloffset_RasterPos4fv));
-}
-
-static INLINE void SET_RasterPos4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_RasterPos4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4i)(GLint, GLint, GLint, GLint);
-#define CALL_RasterPos4i(disp, parameters) \
- (* GET_RasterPos4i(disp)) parameters
-static INLINE _glptr_RasterPos4i GET_RasterPos4i(struct _glapi_table *disp) {
- return (_glptr_RasterPos4i) (GET_by_offset(disp, _gloffset_RasterPos4i));
-}
-
-static INLINE void SET_RasterPos4i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_RasterPos4i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4iv)(const GLint *);
-#define CALL_RasterPos4iv(disp, parameters) \
- (* GET_RasterPos4iv(disp)) parameters
-static INLINE _glptr_RasterPos4iv GET_RasterPos4iv(struct _glapi_table *disp) {
- return (_glptr_RasterPos4iv) (GET_by_offset(disp, _gloffset_RasterPos4iv));
-}
-
-static INLINE void SET_RasterPos4iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_RasterPos4iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4s)(GLshort, GLshort, GLshort, GLshort);
-#define CALL_RasterPos4s(disp, parameters) \
- (* GET_RasterPos4s(disp)) parameters
-static INLINE _glptr_RasterPos4s GET_RasterPos4s(struct _glapi_table *disp) {
- return (_glptr_RasterPos4s) (GET_by_offset(disp, _gloffset_RasterPos4s));
-}
-
-static INLINE void SET_RasterPos4s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_RasterPos4s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4sv)(const GLshort *);
-#define CALL_RasterPos4sv(disp, parameters) \
- (* GET_RasterPos4sv(disp)) parameters
-static INLINE _glptr_RasterPos4sv GET_RasterPos4sv(struct _glapi_table *disp) {
- return (_glptr_RasterPos4sv) (GET_by_offset(disp, _gloffset_RasterPos4sv));
-}
-
-static INLINE void SET_RasterPos4sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_RasterPos4sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectd)(GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_Rectd(disp, parameters) \
- (* GET_Rectd(disp)) parameters
-static INLINE _glptr_Rectd GET_Rectd(struct _glapi_table *disp) {
- return (_glptr_Rectd) (GET_by_offset(disp, _gloffset_Rectd));
-}
-
-static INLINE void SET_Rectd(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Rectd, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectdv)(const GLdouble *, const GLdouble *);
-#define CALL_Rectdv(disp, parameters) \
- (* GET_Rectdv(disp)) parameters
-static INLINE _glptr_Rectdv GET_Rectdv(struct _glapi_table *disp) {
- return (_glptr_Rectdv) (GET_by_offset(disp, _gloffset_Rectdv));
-}
-
-static INLINE void SET_Rectdv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_Rectdv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectf)(GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_Rectf(disp, parameters) \
- (* GET_Rectf(disp)) parameters
-static INLINE _glptr_Rectf GET_Rectf(struct _glapi_table *disp) {
- return (_glptr_Rectf) (GET_by_offset(disp, _gloffset_Rectf));
-}
-
-static INLINE void SET_Rectf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Rectf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectfv)(const GLfloat *, const GLfloat *);
-#define CALL_Rectfv(disp, parameters) \
- (* GET_Rectfv(disp)) parameters
-static INLINE _glptr_Rectfv GET_Rectfv(struct _glapi_table *disp) {
- return (_glptr_Rectfv) (GET_by_offset(disp, _gloffset_Rectfv));
-}
-
-static INLINE void SET_Rectfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Rectfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Recti)(GLint, GLint, GLint, GLint);
-#define CALL_Recti(disp, parameters) \
- (* GET_Recti(disp)) parameters
-static INLINE _glptr_Recti GET_Recti(struct _glapi_table *disp) {
- return (_glptr_Recti) (GET_by_offset(disp, _gloffset_Recti));
-}
-
-static INLINE void SET_Recti(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Recti, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectiv)(const GLint *, const GLint *);
-#define CALL_Rectiv(disp, parameters) \
- (* GET_Rectiv(disp)) parameters
-static INLINE _glptr_Rectiv GET_Rectiv(struct _glapi_table *disp) {
- return (_glptr_Rectiv) (GET_by_offset(disp, _gloffset_Rectiv));
-}
-
-static INLINE void SET_Rectiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *, const GLint *)) {
- SET_by_offset(disp, _gloffset_Rectiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rects)(GLshort, GLshort, GLshort, GLshort);
-#define CALL_Rects(disp, parameters) \
- (* GET_Rects(disp)) parameters
-static INLINE _glptr_Rects GET_Rects(struct _glapi_table *disp) {
- return (_glptr_Rects) (GET_by_offset(disp, _gloffset_Rects));
-}
-
-static INLINE void SET_Rects(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_Rects, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectsv)(const GLshort *, const GLshort *);
-#define CALL_Rectsv(disp, parameters) \
- (* GET_Rectsv(disp)) parameters
-static INLINE _glptr_Rectsv GET_Rectsv(struct _glapi_table *disp) {
- return (_glptr_Rectsv) (GET_by_offset(disp, _gloffset_Rectsv));
-}
-
-static INLINE void SET_Rectsv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *, const GLshort *)) {
- SET_by_offset(disp, _gloffset_Rectsv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1d)(GLdouble);
-#define CALL_TexCoord1d(disp, parameters) \
- (* GET_TexCoord1d(disp)) parameters
-static INLINE _glptr_TexCoord1d GET_TexCoord1d(struct _glapi_table *disp) {
- return (_glptr_TexCoord1d) (GET_by_offset(disp, _gloffset_TexCoord1d));
-}
-
-static INLINE void SET_TexCoord1d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble)) {
- SET_by_offset(disp, _gloffset_TexCoord1d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1dv)(const GLdouble *);
-#define CALL_TexCoord1dv(disp, parameters) \
- (* GET_TexCoord1dv(disp)) parameters
-static INLINE _glptr_TexCoord1dv GET_TexCoord1dv(struct _glapi_table *disp) {
- return (_glptr_TexCoord1dv) (GET_by_offset(disp, _gloffset_TexCoord1dv));
-}
-
-static INLINE void SET_TexCoord1dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_TexCoord1dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1f)(GLfloat);
-#define CALL_TexCoord1f(disp, parameters) \
- (* GET_TexCoord1f(disp)) parameters
-static INLINE _glptr_TexCoord1f GET_TexCoord1f(struct _glapi_table *disp) {
- return (_glptr_TexCoord1f) (GET_by_offset(disp, _gloffset_TexCoord1f));
-}
-
-static INLINE void SET_TexCoord1f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
- SET_by_offset(disp, _gloffset_TexCoord1f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1fv)(const GLfloat *);
-#define CALL_TexCoord1fv(disp, parameters) \
- (* GET_TexCoord1fv(disp)) parameters
-static INLINE _glptr_TexCoord1fv GET_TexCoord1fv(struct _glapi_table *disp) {
- return (_glptr_TexCoord1fv) (GET_by_offset(disp, _gloffset_TexCoord1fv));
-}
-
-static INLINE void SET_TexCoord1fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_TexCoord1fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1i)(GLint);
-#define CALL_TexCoord1i(disp, parameters) \
- (* GET_TexCoord1i(disp)) parameters
-static INLINE _glptr_TexCoord1i GET_TexCoord1i(struct _glapi_table *disp) {
- return (_glptr_TexCoord1i) (GET_by_offset(disp, _gloffset_TexCoord1i));
-}
-
-static INLINE void SET_TexCoord1i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint)) {
- SET_by_offset(disp, _gloffset_TexCoord1i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1iv)(const GLint *);
-#define CALL_TexCoord1iv(disp, parameters) \
- (* GET_TexCoord1iv(disp)) parameters
-static INLINE _glptr_TexCoord1iv GET_TexCoord1iv(struct _glapi_table *disp) {
- return (_glptr_TexCoord1iv) (GET_by_offset(disp, _gloffset_TexCoord1iv));
-}
-
-static INLINE void SET_TexCoord1iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_TexCoord1iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1s)(GLshort);
-#define CALL_TexCoord1s(disp, parameters) \
- (* GET_TexCoord1s(disp)) parameters
-static INLINE _glptr_TexCoord1s GET_TexCoord1s(struct _glapi_table *disp) {
- return (_glptr_TexCoord1s) (GET_by_offset(disp, _gloffset_TexCoord1s));
-}
-
-static INLINE void SET_TexCoord1s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort)) {
- SET_by_offset(disp, _gloffset_TexCoord1s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1sv)(const GLshort *);
-#define CALL_TexCoord1sv(disp, parameters) \
- (* GET_TexCoord1sv(disp)) parameters
-static INLINE _glptr_TexCoord1sv GET_TexCoord1sv(struct _glapi_table *disp) {
- return (_glptr_TexCoord1sv) (GET_by_offset(disp, _gloffset_TexCoord1sv));
-}
-
-static INLINE void SET_TexCoord1sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_TexCoord1sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2d)(GLdouble, GLdouble);
-#define CALL_TexCoord2d(disp, parameters) \
- (* GET_TexCoord2d(disp)) parameters
-static INLINE _glptr_TexCoord2d GET_TexCoord2d(struct _glapi_table *disp) {
- return (_glptr_TexCoord2d) (GET_by_offset(disp, _gloffset_TexCoord2d));
-}
-
-static INLINE void SET_TexCoord2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_TexCoord2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2dv)(const GLdouble *);
-#define CALL_TexCoord2dv(disp, parameters) \
- (* GET_TexCoord2dv(disp)) parameters
-static INLINE _glptr_TexCoord2dv GET_TexCoord2dv(struct _glapi_table *disp) {
- return (_glptr_TexCoord2dv) (GET_by_offset(disp, _gloffset_TexCoord2dv));
-}
-
-static INLINE void SET_TexCoord2dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_TexCoord2dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2f)(GLfloat, GLfloat);
-#define CALL_TexCoord2f(disp, parameters) \
- (* GET_TexCoord2f(disp)) parameters
-static INLINE _glptr_TexCoord2f GET_TexCoord2f(struct _glapi_table *disp) {
- return (_glptr_TexCoord2f) (GET_by_offset(disp, _gloffset_TexCoord2f));
-}
-
-static INLINE void SET_TexCoord2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_TexCoord2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2fv)(const GLfloat *);
-#define CALL_TexCoord2fv(disp, parameters) \
- (* GET_TexCoord2fv(disp)) parameters
-static INLINE _glptr_TexCoord2fv GET_TexCoord2fv(struct _glapi_table *disp) {
- return (_glptr_TexCoord2fv) (GET_by_offset(disp, _gloffset_TexCoord2fv));
-}
-
-static INLINE void SET_TexCoord2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_TexCoord2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2i)(GLint, GLint);
-#define CALL_TexCoord2i(disp, parameters) \
- (* GET_TexCoord2i(disp)) parameters
-static INLINE _glptr_TexCoord2i GET_TexCoord2i(struct _glapi_table *disp) {
- return (_glptr_TexCoord2i) (GET_by_offset(disp, _gloffset_TexCoord2i));
-}
-
-static INLINE void SET_TexCoord2i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
- SET_by_offset(disp, _gloffset_TexCoord2i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2iv)(const GLint *);
-#define CALL_TexCoord2iv(disp, parameters) \
- (* GET_TexCoord2iv(disp)) parameters
-static INLINE _glptr_TexCoord2iv GET_TexCoord2iv(struct _glapi_table *disp) {
- return (_glptr_TexCoord2iv) (GET_by_offset(disp, _gloffset_TexCoord2iv));
-}
-
-static INLINE void SET_TexCoord2iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_TexCoord2iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2s)(GLshort, GLshort);
-#define CALL_TexCoord2s(disp, parameters) \
- (* GET_TexCoord2s(disp)) parameters
-static INLINE _glptr_TexCoord2s GET_TexCoord2s(struct _glapi_table *disp) {
- return (_glptr_TexCoord2s) (GET_by_offset(disp, _gloffset_TexCoord2s));
-}
-
-static INLINE void SET_TexCoord2s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_TexCoord2s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2sv)(const GLshort *);
-#define CALL_TexCoord2sv(disp, parameters) \
- (* GET_TexCoord2sv(disp)) parameters
-static INLINE _glptr_TexCoord2sv GET_TexCoord2sv(struct _glapi_table *disp) {
- return (_glptr_TexCoord2sv) (GET_by_offset(disp, _gloffset_TexCoord2sv));
-}
-
-static INLINE void SET_TexCoord2sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_TexCoord2sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3d)(GLdouble, GLdouble, GLdouble);
-#define CALL_TexCoord3d(disp, parameters) \
- (* GET_TexCoord3d(disp)) parameters
-static INLINE _glptr_TexCoord3d GET_TexCoord3d(struct _glapi_table *disp) {
- return (_glptr_TexCoord3d) (GET_by_offset(disp, _gloffset_TexCoord3d));
-}
-
-static INLINE void SET_TexCoord3d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_TexCoord3d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3dv)(const GLdouble *);
-#define CALL_TexCoord3dv(disp, parameters) \
- (* GET_TexCoord3dv(disp)) parameters
-static INLINE _glptr_TexCoord3dv GET_TexCoord3dv(struct _glapi_table *disp) {
- return (_glptr_TexCoord3dv) (GET_by_offset(disp, _gloffset_TexCoord3dv));
-}
-
-static INLINE void SET_TexCoord3dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_TexCoord3dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3f)(GLfloat, GLfloat, GLfloat);
-#define CALL_TexCoord3f(disp, parameters) \
- (* GET_TexCoord3f(disp)) parameters
-static INLINE _glptr_TexCoord3f GET_TexCoord3f(struct _glapi_table *disp) {
- return (_glptr_TexCoord3f) (GET_by_offset(disp, _gloffset_TexCoord3f));
-}
-
-static INLINE void SET_TexCoord3f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_TexCoord3f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3fv)(const GLfloat *);
-#define CALL_TexCoord3fv(disp, parameters) \
- (* GET_TexCoord3fv(disp)) parameters
-static INLINE _glptr_TexCoord3fv GET_TexCoord3fv(struct _glapi_table *disp) {
- return (_glptr_TexCoord3fv) (GET_by_offset(disp, _gloffset_TexCoord3fv));
-}
-
-static INLINE void SET_TexCoord3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_TexCoord3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3i)(GLint, GLint, GLint);
-#define CALL_TexCoord3i(disp, parameters) \
- (* GET_TexCoord3i(disp)) parameters
-static INLINE _glptr_TexCoord3i GET_TexCoord3i(struct _glapi_table *disp) {
- return (_glptr_TexCoord3i) (GET_by_offset(disp, _gloffset_TexCoord3i));
-}
-
-static INLINE void SET_TexCoord3i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_TexCoord3i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3iv)(const GLint *);
-#define CALL_TexCoord3iv(disp, parameters) \
- (* GET_TexCoord3iv(disp)) parameters
-static INLINE _glptr_TexCoord3iv GET_TexCoord3iv(struct _glapi_table *disp) {
- return (_glptr_TexCoord3iv) (GET_by_offset(disp, _gloffset_TexCoord3iv));
-}
-
-static INLINE void SET_TexCoord3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_TexCoord3iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3s)(GLshort, GLshort, GLshort);
-#define CALL_TexCoord3s(disp, parameters) \
- (* GET_TexCoord3s(disp)) parameters
-static INLINE _glptr_TexCoord3s GET_TexCoord3s(struct _glapi_table *disp) {
- return (_glptr_TexCoord3s) (GET_by_offset(disp, _gloffset_TexCoord3s));
-}
-
-static INLINE void SET_TexCoord3s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_TexCoord3s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3sv)(const GLshort *);
-#define CALL_TexCoord3sv(disp, parameters) \
- (* GET_TexCoord3sv(disp)) parameters
-static INLINE _glptr_TexCoord3sv GET_TexCoord3sv(struct _glapi_table *disp) {
- return (_glptr_TexCoord3sv) (GET_by_offset(disp, _gloffset_TexCoord3sv));
-}
-
-static INLINE void SET_TexCoord3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_TexCoord3sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4d)(GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_TexCoord4d(disp, parameters) \
- (* GET_TexCoord4d(disp)) parameters
-static INLINE _glptr_TexCoord4d GET_TexCoord4d(struct _glapi_table *disp) {
- return (_glptr_TexCoord4d) (GET_by_offset(disp, _gloffset_TexCoord4d));
-}
-
-static INLINE void SET_TexCoord4d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_TexCoord4d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4dv)(const GLdouble *);
-#define CALL_TexCoord4dv(disp, parameters) \
- (* GET_TexCoord4dv(disp)) parameters
-static INLINE _glptr_TexCoord4dv GET_TexCoord4dv(struct _glapi_table *disp) {
- return (_glptr_TexCoord4dv) (GET_by_offset(disp, _gloffset_TexCoord4dv));
-}
-
-static INLINE void SET_TexCoord4dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_TexCoord4dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4f)(GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_TexCoord4f(disp, parameters) \
- (* GET_TexCoord4f(disp)) parameters
-static INLINE _glptr_TexCoord4f GET_TexCoord4f(struct _glapi_table *disp) {
- return (_glptr_TexCoord4f) (GET_by_offset(disp, _gloffset_TexCoord4f));
-}
-
-static INLINE void SET_TexCoord4f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_TexCoord4f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4fv)(const GLfloat *);
-#define CALL_TexCoord4fv(disp, parameters) \
- (* GET_TexCoord4fv(disp)) parameters
-static INLINE _glptr_TexCoord4fv GET_TexCoord4fv(struct _glapi_table *disp) {
- return (_glptr_TexCoord4fv) (GET_by_offset(disp, _gloffset_TexCoord4fv));
-}
-
-static INLINE void SET_TexCoord4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_TexCoord4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4i)(GLint, GLint, GLint, GLint);
-#define CALL_TexCoord4i(disp, parameters) \
- (* GET_TexCoord4i(disp)) parameters
-static INLINE _glptr_TexCoord4i GET_TexCoord4i(struct _glapi_table *disp) {
- return (_glptr_TexCoord4i) (GET_by_offset(disp, _gloffset_TexCoord4i));
-}
-
-static INLINE void SET_TexCoord4i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_TexCoord4i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4iv)(const GLint *);
-#define CALL_TexCoord4iv(disp, parameters) \
- (* GET_TexCoord4iv(disp)) parameters
-static INLINE _glptr_TexCoord4iv GET_TexCoord4iv(struct _glapi_table *disp) {
- return (_glptr_TexCoord4iv) (GET_by_offset(disp, _gloffset_TexCoord4iv));
-}
-
-static INLINE void SET_TexCoord4iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_TexCoord4iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4s)(GLshort, GLshort, GLshort, GLshort);
-#define CALL_TexCoord4s(disp, parameters) \
- (* GET_TexCoord4s(disp)) parameters
-static INLINE _glptr_TexCoord4s GET_TexCoord4s(struct _glapi_table *disp) {
- return (_glptr_TexCoord4s) (GET_by_offset(disp, _gloffset_TexCoord4s));
-}
-
-static INLINE void SET_TexCoord4s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_TexCoord4s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4sv)(const GLshort *);
-#define CALL_TexCoord4sv(disp, parameters) \
- (* GET_TexCoord4sv(disp)) parameters
-static INLINE _glptr_TexCoord4sv GET_TexCoord4sv(struct _glapi_table *disp) {
- return (_glptr_TexCoord4sv) (GET_by_offset(disp, _gloffset_TexCoord4sv));
-}
-
-static INLINE void SET_TexCoord4sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_TexCoord4sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2d)(GLdouble, GLdouble);
-#define CALL_Vertex2d(disp, parameters) \
- (* GET_Vertex2d(disp)) parameters
-static INLINE _glptr_Vertex2d GET_Vertex2d(struct _glapi_table *disp) {
- return (_glptr_Vertex2d) (GET_by_offset(disp, _gloffset_Vertex2d));
-}
-
-static INLINE void SET_Vertex2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Vertex2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2dv)(const GLdouble *);
-#define CALL_Vertex2dv(disp, parameters) \
- (* GET_Vertex2dv(disp)) parameters
-static INLINE _glptr_Vertex2dv GET_Vertex2dv(struct _glapi_table *disp) {
- return (_glptr_Vertex2dv) (GET_by_offset(disp, _gloffset_Vertex2dv));
-}
-
-static INLINE void SET_Vertex2dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_Vertex2dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2f)(GLfloat, GLfloat);
-#define CALL_Vertex2f(disp, parameters) \
- (* GET_Vertex2f(disp)) parameters
-static INLINE _glptr_Vertex2f GET_Vertex2f(struct _glapi_table *disp) {
- return (_glptr_Vertex2f) (GET_by_offset(disp, _gloffset_Vertex2f));
-}
-
-static INLINE void SET_Vertex2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Vertex2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2fv)(const GLfloat *);
-#define CALL_Vertex2fv(disp, parameters) \
- (* GET_Vertex2fv(disp)) parameters
-static INLINE _glptr_Vertex2fv GET_Vertex2fv(struct _glapi_table *disp) {
- return (_glptr_Vertex2fv) (GET_by_offset(disp, _gloffset_Vertex2fv));
-}
-
-static INLINE void SET_Vertex2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Vertex2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2i)(GLint, GLint);
-#define CALL_Vertex2i(disp, parameters) \
- (* GET_Vertex2i(disp)) parameters
-static INLINE _glptr_Vertex2i GET_Vertex2i(struct _glapi_table *disp) {
- return (_glptr_Vertex2i) (GET_by_offset(disp, _gloffset_Vertex2i));
-}
-
-static INLINE void SET_Vertex2i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Vertex2i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2iv)(const GLint *);
-#define CALL_Vertex2iv(disp, parameters) \
- (* GET_Vertex2iv(disp)) parameters
-static INLINE _glptr_Vertex2iv GET_Vertex2iv(struct _glapi_table *disp) {
- return (_glptr_Vertex2iv) (GET_by_offset(disp, _gloffset_Vertex2iv));
-}
-
-static INLINE void SET_Vertex2iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_Vertex2iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2s)(GLshort, GLshort);
-#define CALL_Vertex2s(disp, parameters) \
- (* GET_Vertex2s(disp)) parameters
-static INLINE _glptr_Vertex2s GET_Vertex2s(struct _glapi_table *disp) {
- return (_glptr_Vertex2s) (GET_by_offset(disp, _gloffset_Vertex2s));
-}
-
-static INLINE void SET_Vertex2s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_Vertex2s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2sv)(const GLshort *);
-#define CALL_Vertex2sv(disp, parameters) \
- (* GET_Vertex2sv(disp)) parameters
-static INLINE _glptr_Vertex2sv GET_Vertex2sv(struct _glapi_table *disp) {
- return (_glptr_Vertex2sv) (GET_by_offset(disp, _gloffset_Vertex2sv));
-}
-
-static INLINE void SET_Vertex2sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_Vertex2sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3d)(GLdouble, GLdouble, GLdouble);
-#define CALL_Vertex3d(disp, parameters) \
- (* GET_Vertex3d(disp)) parameters
-static INLINE _glptr_Vertex3d GET_Vertex3d(struct _glapi_table *disp) {
- return (_glptr_Vertex3d) (GET_by_offset(disp, _gloffset_Vertex3d));
-}
-
-static INLINE void SET_Vertex3d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Vertex3d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3dv)(const GLdouble *);
-#define CALL_Vertex3dv(disp, parameters) \
- (* GET_Vertex3dv(disp)) parameters
-static INLINE _glptr_Vertex3dv GET_Vertex3dv(struct _glapi_table *disp) {
- return (_glptr_Vertex3dv) (GET_by_offset(disp, _gloffset_Vertex3dv));
-}
-
-static INLINE void SET_Vertex3dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_Vertex3dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3f)(GLfloat, GLfloat, GLfloat);
-#define CALL_Vertex3f(disp, parameters) \
- (* GET_Vertex3f(disp)) parameters
-static INLINE _glptr_Vertex3f GET_Vertex3f(struct _glapi_table *disp) {
- return (_glptr_Vertex3f) (GET_by_offset(disp, _gloffset_Vertex3f));
-}
-
-static INLINE void SET_Vertex3f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Vertex3f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3fv)(const GLfloat *);
-#define CALL_Vertex3fv(disp, parameters) \
- (* GET_Vertex3fv(disp)) parameters
-static INLINE _glptr_Vertex3fv GET_Vertex3fv(struct _glapi_table *disp) {
- return (_glptr_Vertex3fv) (GET_by_offset(disp, _gloffset_Vertex3fv));
-}
-
-static INLINE void SET_Vertex3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Vertex3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3i)(GLint, GLint, GLint);
-#define CALL_Vertex3i(disp, parameters) \
- (* GET_Vertex3i(disp)) parameters
-static INLINE _glptr_Vertex3i GET_Vertex3i(struct _glapi_table *disp) {
- return (_glptr_Vertex3i) (GET_by_offset(disp, _gloffset_Vertex3i));
-}
-
-static INLINE void SET_Vertex3i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Vertex3i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3iv)(const GLint *);
-#define CALL_Vertex3iv(disp, parameters) \
- (* GET_Vertex3iv(disp)) parameters
-static INLINE _glptr_Vertex3iv GET_Vertex3iv(struct _glapi_table *disp) {
- return (_glptr_Vertex3iv) (GET_by_offset(disp, _gloffset_Vertex3iv));
-}
-
-static INLINE void SET_Vertex3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_Vertex3iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3s)(GLshort, GLshort, GLshort);
-#define CALL_Vertex3s(disp, parameters) \
- (* GET_Vertex3s(disp)) parameters
-static INLINE _glptr_Vertex3s GET_Vertex3s(struct _glapi_table *disp) {
- return (_glptr_Vertex3s) (GET_by_offset(disp, _gloffset_Vertex3s));
-}
-
-static INLINE void SET_Vertex3s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_Vertex3s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3sv)(const GLshort *);
-#define CALL_Vertex3sv(disp, parameters) \
- (* GET_Vertex3sv(disp)) parameters
-static INLINE _glptr_Vertex3sv GET_Vertex3sv(struct _glapi_table *disp) {
- return (_glptr_Vertex3sv) (GET_by_offset(disp, _gloffset_Vertex3sv));
-}
-
-static INLINE void SET_Vertex3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_Vertex3sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4d)(GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_Vertex4d(disp, parameters) \
- (* GET_Vertex4d(disp)) parameters
-static INLINE _glptr_Vertex4d GET_Vertex4d(struct _glapi_table *disp) {
- return (_glptr_Vertex4d) (GET_by_offset(disp, _gloffset_Vertex4d));
-}
-
-static INLINE void SET_Vertex4d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Vertex4d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4dv)(const GLdouble *);
-#define CALL_Vertex4dv(disp, parameters) \
- (* GET_Vertex4dv(disp)) parameters
-static INLINE _glptr_Vertex4dv GET_Vertex4dv(struct _glapi_table *disp) {
- return (_glptr_Vertex4dv) (GET_by_offset(disp, _gloffset_Vertex4dv));
-}
-
-static INLINE void SET_Vertex4dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_Vertex4dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4f)(GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_Vertex4f(disp, parameters) \
- (* GET_Vertex4f(disp)) parameters
-static INLINE _glptr_Vertex4f GET_Vertex4f(struct _glapi_table *disp) {
- return (_glptr_Vertex4f) (GET_by_offset(disp, _gloffset_Vertex4f));
-}
-
-static INLINE void SET_Vertex4f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Vertex4f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4fv)(const GLfloat *);
-#define CALL_Vertex4fv(disp, parameters) \
- (* GET_Vertex4fv(disp)) parameters
-static INLINE _glptr_Vertex4fv GET_Vertex4fv(struct _glapi_table *disp) {
- return (_glptr_Vertex4fv) (GET_by_offset(disp, _gloffset_Vertex4fv));
-}
-
-static INLINE void SET_Vertex4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Vertex4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4i)(GLint, GLint, GLint, GLint);
-#define CALL_Vertex4i(disp, parameters) \
- (* GET_Vertex4i(disp)) parameters
-static INLINE _glptr_Vertex4i GET_Vertex4i(struct _glapi_table *disp) {
- return (_glptr_Vertex4i) (GET_by_offset(disp, _gloffset_Vertex4i));
-}
-
-static INLINE void SET_Vertex4i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Vertex4i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4iv)(const GLint *);
-#define CALL_Vertex4iv(disp, parameters) \
- (* GET_Vertex4iv(disp)) parameters
-static INLINE _glptr_Vertex4iv GET_Vertex4iv(struct _glapi_table *disp) {
- return (_glptr_Vertex4iv) (GET_by_offset(disp, _gloffset_Vertex4iv));
-}
-
-static INLINE void SET_Vertex4iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_Vertex4iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4s)(GLshort, GLshort, GLshort, GLshort);
-#define CALL_Vertex4s(disp, parameters) \
- (* GET_Vertex4s(disp)) parameters
-static INLINE _glptr_Vertex4s GET_Vertex4s(struct _glapi_table *disp) {
- return (_glptr_Vertex4s) (GET_by_offset(disp, _gloffset_Vertex4s));
-}
-
-static INLINE void SET_Vertex4s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_Vertex4s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4sv)(const GLshort *);
-#define CALL_Vertex4sv(disp, parameters) \
- (* GET_Vertex4sv(disp)) parameters
-static INLINE _glptr_Vertex4sv GET_Vertex4sv(struct _glapi_table *disp) {
- return (_glptr_Vertex4sv) (GET_by_offset(disp, _gloffset_Vertex4sv));
-}
-
-static INLINE void SET_Vertex4sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_Vertex4sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClipPlane)(GLenum, const GLdouble *);
-#define CALL_ClipPlane(disp, parameters) \
- (* GET_ClipPlane(disp)) parameters
-static INLINE _glptr_ClipPlane GET_ClipPlane(struct _glapi_table *disp) {
- return (_glptr_ClipPlane) (GET_by_offset(disp, _gloffset_ClipPlane));
-}
-
-static INLINE void SET_ClipPlane(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_ClipPlane, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorMaterial)(GLenum, GLenum);
-#define CALL_ColorMaterial(disp, parameters) \
- (* GET_ColorMaterial(disp)) parameters
-static INLINE _glptr_ColorMaterial GET_ColorMaterial(struct _glapi_table *disp) {
- return (_glptr_ColorMaterial) (GET_by_offset(disp, _gloffset_ColorMaterial));
-}
-
-static INLINE void SET_ColorMaterial(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_ColorMaterial, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CullFace)(GLenum);
-#define CALL_CullFace(disp, parameters) \
- (* GET_CullFace(disp)) parameters
-static INLINE _glptr_CullFace GET_CullFace(struct _glapi_table *disp) {
- return (_glptr_CullFace) (GET_by_offset(disp, _gloffset_CullFace));
-}
-
-static INLINE void SET_CullFace(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_CullFace, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Fogf)(GLenum, GLfloat);
-#define CALL_Fogf(disp, parameters) \
- (* GET_Fogf(disp)) parameters
-static INLINE _glptr_Fogf GET_Fogf(struct _glapi_table *disp) {
- return (_glptr_Fogf) (GET_by_offset(disp, _gloffset_Fogf));
-}
-
-static INLINE void SET_Fogf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_Fogf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Fogfv)(GLenum, const GLfloat *);
-#define CALL_Fogfv(disp, parameters) \
- (* GET_Fogfv(disp)) parameters
-static INLINE _glptr_Fogfv GET_Fogfv(struct _glapi_table *disp) {
- return (_glptr_Fogfv) (GET_by_offset(disp, _gloffset_Fogfv));
-}
-
-static INLINE void SET_Fogfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Fogfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Fogi)(GLenum, GLint);
-#define CALL_Fogi(disp, parameters) \
- (* GET_Fogi(disp)) parameters
-static INLINE _glptr_Fogi GET_Fogi(struct _glapi_table *disp) {
- return (_glptr_Fogi) (GET_by_offset(disp, _gloffset_Fogi));
-}
-
-static INLINE void SET_Fogi(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_Fogi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Fogiv)(GLenum, const GLint *);
-#define CALL_Fogiv(disp, parameters) \
- (* GET_Fogiv(disp)) parameters
-static INLINE _glptr_Fogiv GET_Fogiv(struct _glapi_table *disp) {
- return (_glptr_Fogiv) (GET_by_offset(disp, _gloffset_Fogiv));
-}
-
-static INLINE void SET_Fogiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_Fogiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FrontFace)(GLenum);
-#define CALL_FrontFace(disp, parameters) \
- (* GET_FrontFace(disp)) parameters
-static INLINE _glptr_FrontFace GET_FrontFace(struct _glapi_table *disp) {
- return (_glptr_FrontFace) (GET_by_offset(disp, _gloffset_FrontFace));
-}
-
-static INLINE void SET_FrontFace(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_FrontFace, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Hint)(GLenum, GLenum);
-#define CALL_Hint(disp, parameters) \
- (* GET_Hint(disp)) parameters
-static INLINE _glptr_Hint GET_Hint(struct _glapi_table *disp) {
- return (_glptr_Hint) (GET_by_offset(disp, _gloffset_Hint));
-}
-
-static INLINE void SET_Hint(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_Hint, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Lightf)(GLenum, GLenum, GLfloat);
-#define CALL_Lightf(disp, parameters) \
- (* GET_Lightf(disp)) parameters
-static INLINE _glptr_Lightf GET_Lightf(struct _glapi_table *disp) {
- return (_glptr_Lightf) (GET_by_offset(disp, _gloffset_Lightf));
-}
-
-static INLINE void SET_Lightf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_Lightf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Lightfv)(GLenum, GLenum, const GLfloat *);
-#define CALL_Lightfv(disp, parameters) \
- (* GET_Lightfv(disp)) parameters
-static INLINE _glptr_Lightfv GET_Lightfv(struct _glapi_table *disp) {
- return (_glptr_Lightfv) (GET_by_offset(disp, _gloffset_Lightfv));
-}
-
-static INLINE void SET_Lightfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Lightfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Lighti)(GLenum, GLenum, GLint);
-#define CALL_Lighti(disp, parameters) \
- (* GET_Lighti(disp)) parameters
-static INLINE _glptr_Lighti GET_Lighti(struct _glapi_table *disp) {
- return (_glptr_Lighti) (GET_by_offset(disp, _gloffset_Lighti));
-}
-
-static INLINE void SET_Lighti(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_Lighti, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Lightiv)(GLenum, GLenum, const GLint *);
-#define CALL_Lightiv(disp, parameters) \
- (* GET_Lightiv(disp)) parameters
-static INLINE _glptr_Lightiv GET_Lightiv(struct _glapi_table *disp) {
- return (_glptr_Lightiv) (GET_by_offset(disp, _gloffset_Lightiv));
-}
-
-static INLINE void SET_Lightiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_Lightiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LightModelf)(GLenum, GLfloat);
-#define CALL_LightModelf(disp, parameters) \
- (* GET_LightModelf(disp)) parameters
-static INLINE _glptr_LightModelf GET_LightModelf(struct _glapi_table *disp) {
- return (_glptr_LightModelf) (GET_by_offset(disp, _gloffset_LightModelf));
-}
-
-static INLINE void SET_LightModelf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_LightModelf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LightModelfv)(GLenum, const GLfloat *);
-#define CALL_LightModelfv(disp, parameters) \
- (* GET_LightModelfv(disp)) parameters
-static INLINE _glptr_LightModelfv GET_LightModelfv(struct _glapi_table *disp) {
- return (_glptr_LightModelfv) (GET_by_offset(disp, _gloffset_LightModelfv));
-}
-
-static INLINE void SET_LightModelfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_LightModelfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LightModeli)(GLenum, GLint);
-#define CALL_LightModeli(disp, parameters) \
- (* GET_LightModeli(disp)) parameters
-static INLINE _glptr_LightModeli GET_LightModeli(struct _glapi_table *disp) {
- return (_glptr_LightModeli) (GET_by_offset(disp, _gloffset_LightModeli));
-}
-
-static INLINE void SET_LightModeli(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_LightModeli, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LightModeliv)(GLenum, const GLint *);
-#define CALL_LightModeliv(disp, parameters) \
- (* GET_LightModeliv(disp)) parameters
-static INLINE _glptr_LightModeliv GET_LightModeliv(struct _glapi_table *disp) {
- return (_glptr_LightModeliv) (GET_by_offset(disp, _gloffset_LightModeliv));
-}
-
-static INLINE void SET_LightModeliv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_LightModeliv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LineStipple)(GLint, GLushort);
-#define CALL_LineStipple(disp, parameters) \
- (* GET_LineStipple(disp)) parameters
-static INLINE _glptr_LineStipple GET_LineStipple(struct _glapi_table *disp) {
- return (_glptr_LineStipple) (GET_by_offset(disp, _gloffset_LineStipple));
-}
-
-static INLINE void SET_LineStipple(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLushort)) {
- SET_by_offset(disp, _gloffset_LineStipple, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LineWidth)(GLfloat);
-#define CALL_LineWidth(disp, parameters) \
- (* GET_LineWidth(disp)) parameters
-static INLINE _glptr_LineWidth GET_LineWidth(struct _glapi_table *disp) {
- return (_glptr_LineWidth) (GET_by_offset(disp, _gloffset_LineWidth));
-}
-
-static INLINE void SET_LineWidth(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
- SET_by_offset(disp, _gloffset_LineWidth, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Materialf)(GLenum, GLenum, GLfloat);
-#define CALL_Materialf(disp, parameters) \
- (* GET_Materialf(disp)) parameters
-static INLINE _glptr_Materialf GET_Materialf(struct _glapi_table *disp) {
- return (_glptr_Materialf) (GET_by_offset(disp, _gloffset_Materialf));
-}
-
-static INLINE void SET_Materialf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_Materialf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Materialfv)(GLenum, GLenum, const GLfloat *);
-#define CALL_Materialfv(disp, parameters) \
- (* GET_Materialfv(disp)) parameters
-static INLINE _glptr_Materialfv GET_Materialfv(struct _glapi_table *disp) {
- return (_glptr_Materialfv) (GET_by_offset(disp, _gloffset_Materialfv));
-}
-
-static INLINE void SET_Materialfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Materialfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Materiali)(GLenum, GLenum, GLint);
-#define CALL_Materiali(disp, parameters) \
- (* GET_Materiali(disp)) parameters
-static INLINE _glptr_Materiali GET_Materiali(struct _glapi_table *disp) {
- return (_glptr_Materiali) (GET_by_offset(disp, _gloffset_Materiali));
-}
-
-static INLINE void SET_Materiali(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_Materiali, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Materialiv)(GLenum, GLenum, const GLint *);
-#define CALL_Materialiv(disp, parameters) \
- (* GET_Materialiv(disp)) parameters
-static INLINE _glptr_Materialiv GET_Materialiv(struct _glapi_table *disp) {
- return (_glptr_Materialiv) (GET_by_offset(disp, _gloffset_Materialiv));
-}
-
-static INLINE void SET_Materialiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_Materialiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PointSize)(GLfloat);
-#define CALL_PointSize(disp, parameters) \
- (* GET_PointSize(disp)) parameters
-static INLINE _glptr_PointSize GET_PointSize(struct _glapi_table *disp) {
- return (_glptr_PointSize) (GET_by_offset(disp, _gloffset_PointSize));
-}
-
-static INLINE void SET_PointSize(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
- SET_by_offset(disp, _gloffset_PointSize, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PolygonMode)(GLenum, GLenum);
-#define CALL_PolygonMode(disp, parameters) \
- (* GET_PolygonMode(disp)) parameters
-static INLINE _glptr_PolygonMode GET_PolygonMode(struct _glapi_table *disp) {
- return (_glptr_PolygonMode) (GET_by_offset(disp, _gloffset_PolygonMode));
-}
-
-static INLINE void SET_PolygonMode(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_PolygonMode, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PolygonStipple)(const GLubyte *);
-#define CALL_PolygonStipple(disp, parameters) \
- (* GET_PolygonStipple(disp)) parameters
-static INLINE _glptr_PolygonStipple GET_PolygonStipple(struct _glapi_table *disp) {
- return (_glptr_PolygonStipple) (GET_by_offset(disp, _gloffset_PolygonStipple));
-}
-
-static INLINE void SET_PolygonStipple(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLubyte *)) {
- SET_by_offset(disp, _gloffset_PolygonStipple, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Scissor)(GLint, GLint, GLsizei, GLsizei);
-#define CALL_Scissor(disp, parameters) \
- (* GET_Scissor(disp)) parameters
-static INLINE _glptr_Scissor GET_Scissor(struct _glapi_table *disp) {
- return (_glptr_Scissor) (GET_by_offset(disp, _gloffset_Scissor));
-}
-
-static INLINE void SET_Scissor(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_Scissor, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ShadeModel)(GLenum);
-#define CALL_ShadeModel(disp, parameters) \
- (* GET_ShadeModel(disp)) parameters
-static INLINE _glptr_ShadeModel GET_ShadeModel(struct _glapi_table *disp) {
- return (_glptr_ShadeModel) (GET_by_offset(disp, _gloffset_ShadeModel));
-}
-
-static INLINE void SET_ShadeModel(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_ShadeModel, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameterf)(GLenum, GLenum, GLfloat);
-#define CALL_TexParameterf(disp, parameters) \
- (* GET_TexParameterf(disp)) parameters
-static INLINE _glptr_TexParameterf GET_TexParameterf(struct _glapi_table *disp) {
- return (_glptr_TexParameterf) (GET_by_offset(disp, _gloffset_TexParameterf));
-}
-
-static INLINE void SET_TexParameterf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_TexParameterf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameterfv)(GLenum, GLenum, const GLfloat *);
-#define CALL_TexParameterfv(disp, parameters) \
- (* GET_TexParameterfv(disp)) parameters
-static INLINE _glptr_TexParameterfv GET_TexParameterfv(struct _glapi_table *disp) {
- return (_glptr_TexParameterfv) (GET_by_offset(disp, _gloffset_TexParameterfv));
-}
-
-static INLINE void SET_TexParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_TexParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameteri)(GLenum, GLenum, GLint);
-#define CALL_TexParameteri(disp, parameters) \
- (* GET_TexParameteri(disp)) parameters
-static INLINE _glptr_TexParameteri GET_TexParameteri(struct _glapi_table *disp) {
- return (_glptr_TexParameteri) (GET_by_offset(disp, _gloffset_TexParameteri));
-}
-
-static INLINE void SET_TexParameteri(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_TexParameteri, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameteriv)(GLenum, GLenum, const GLint *);
-#define CALL_TexParameteriv(disp, parameters) \
- (* GET_TexParameteriv(disp)) parameters
-static INLINE _glptr_TexParameteriv GET_TexParameteriv(struct _glapi_table *disp) {
- return (_glptr_TexParameteriv) (GET_by_offset(disp, _gloffset_TexParameteriv));
-}
-
-static INLINE void SET_TexParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_TexParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-#define CALL_TexImage1D(disp, parameters) \
- (* GET_TexImage1D(disp)) parameters
-static INLINE _glptr_TexImage1D GET_TexImage1D(struct _glapi_table *disp) {
- return (_glptr_TexImage1D) (GET_by_offset(disp, _gloffset_TexImage1D));
-}
-
-static INLINE void SET_TexImage1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_TexImage1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-#define CALL_TexImage2D(disp, parameters) \
- (* GET_TexImage2D(disp)) parameters
-static INLINE _glptr_TexImage2D GET_TexImage2D(struct _glapi_table *disp) {
- return (_glptr_TexImage2D) (GET_by_offset(disp, _gloffset_TexImage2D));
-}
-
-static INLINE void SET_TexImage2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_TexImage2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexEnvf)(GLenum, GLenum, GLfloat);
-#define CALL_TexEnvf(disp, parameters) \
- (* GET_TexEnvf(disp)) parameters
-static INLINE _glptr_TexEnvf GET_TexEnvf(struct _glapi_table *disp) {
- return (_glptr_TexEnvf) (GET_by_offset(disp, _gloffset_TexEnvf));
-}
-
-static INLINE void SET_TexEnvf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_TexEnvf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexEnvfv)(GLenum, GLenum, const GLfloat *);
-#define CALL_TexEnvfv(disp, parameters) \
- (* GET_TexEnvfv(disp)) parameters
-static INLINE _glptr_TexEnvfv GET_TexEnvfv(struct _glapi_table *disp) {
- return (_glptr_TexEnvfv) (GET_by_offset(disp, _gloffset_TexEnvfv));
-}
-
-static INLINE void SET_TexEnvfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_TexEnvfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexEnvi)(GLenum, GLenum, GLint);
-#define CALL_TexEnvi(disp, parameters) \
- (* GET_TexEnvi(disp)) parameters
-static INLINE _glptr_TexEnvi GET_TexEnvi(struct _glapi_table *disp) {
- return (_glptr_TexEnvi) (GET_by_offset(disp, _gloffset_TexEnvi));
-}
-
-static INLINE void SET_TexEnvi(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_TexEnvi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexEnviv)(GLenum, GLenum, const GLint *);
-#define CALL_TexEnviv(disp, parameters) \
- (* GET_TexEnviv(disp)) parameters
-static INLINE _glptr_TexEnviv GET_TexEnviv(struct _glapi_table *disp) {
- return (_glptr_TexEnviv) (GET_by_offset(disp, _gloffset_TexEnviv));
-}
-
-static INLINE void SET_TexEnviv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_TexEnviv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGend)(GLenum, GLenum, GLdouble);
-#define CALL_TexGend(disp, parameters) \
- (* GET_TexGend(disp)) parameters
-static INLINE _glptr_TexGend GET_TexGend(struct _glapi_table *disp) {
- return (_glptr_TexGend) (GET_by_offset(disp, _gloffset_TexGend));
-}
-
-static INLINE void SET_TexGend(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLdouble)) {
- SET_by_offset(disp, _gloffset_TexGend, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGendv)(GLenum, GLenum, const GLdouble *);
-#define CALL_TexGendv(disp, parameters) \
- (* GET_TexGendv(disp)) parameters
-static INLINE _glptr_TexGendv GET_TexGendv(struct _glapi_table *disp) {
- return (_glptr_TexGendv) (GET_by_offset(disp, _gloffset_TexGendv));
-}
-
-static INLINE void SET_TexGendv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_TexGendv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGenf)(GLenum, GLenum, GLfloat);
-#define CALL_TexGenf(disp, parameters) \
- (* GET_TexGenf(disp)) parameters
-static INLINE _glptr_TexGenf GET_TexGenf(struct _glapi_table *disp) {
- return (_glptr_TexGenf) (GET_by_offset(disp, _gloffset_TexGenf));
-}
-
-static INLINE void SET_TexGenf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_TexGenf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGenfv)(GLenum, GLenum, const GLfloat *);
-#define CALL_TexGenfv(disp, parameters) \
- (* GET_TexGenfv(disp)) parameters
-static INLINE _glptr_TexGenfv GET_TexGenfv(struct _glapi_table *disp) {
- return (_glptr_TexGenfv) (GET_by_offset(disp, _gloffset_TexGenfv));
-}
-
-static INLINE void SET_TexGenfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_TexGenfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGeni)(GLenum, GLenum, GLint);
-#define CALL_TexGeni(disp, parameters) \
- (* GET_TexGeni(disp)) parameters
-static INLINE _glptr_TexGeni GET_TexGeni(struct _glapi_table *disp) {
- return (_glptr_TexGeni) (GET_by_offset(disp, _gloffset_TexGeni));
-}
-
-static INLINE void SET_TexGeni(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_TexGeni, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGeniv)(GLenum, GLenum, const GLint *);
-#define CALL_TexGeniv(disp, parameters) \
- (* GET_TexGeniv(disp)) parameters
-static INLINE _glptr_TexGeniv GET_TexGeniv(struct _glapi_table *disp) {
- return (_glptr_TexGeniv) (GET_by_offset(disp, _gloffset_TexGeniv));
-}
-
-static INLINE void SET_TexGeniv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_TexGeniv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FeedbackBuffer)(GLsizei, GLenum, GLfloat *);
-#define CALL_FeedbackBuffer(disp, parameters) \
- (* GET_FeedbackBuffer(disp)) parameters
-static INLINE _glptr_FeedbackBuffer GET_FeedbackBuffer(struct _glapi_table *disp) {
- return (_glptr_FeedbackBuffer) (GET_by_offset(disp, _gloffset_FeedbackBuffer));
-}
-
-static INLINE void SET_FeedbackBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_FeedbackBuffer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SelectBuffer)(GLsizei, GLuint *);
-#define CALL_SelectBuffer(disp, parameters) \
- (* GET_SelectBuffer(disp)) parameters
-static INLINE _glptr_SelectBuffer GET_SelectBuffer(struct _glapi_table *disp) {
- return (_glptr_SelectBuffer) (GET_by_offset(disp, _gloffset_SelectBuffer));
-}
-
-static INLINE void SET_SelectBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_SelectBuffer, fn);
-}
-
-typedef GLint (GLAPIENTRYP _glptr_RenderMode)(GLenum);
-#define CALL_RenderMode(disp, parameters) \
- (* GET_RenderMode(disp)) parameters
-static INLINE _glptr_RenderMode GET_RenderMode(struct _glapi_table *disp) {
- return (_glptr_RenderMode) (GET_by_offset(disp, _gloffset_RenderMode));
-}
-
-static INLINE void SET_RenderMode(struct _glapi_table *disp, GLint (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_RenderMode, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_InitNames)(void);
-#define CALL_InitNames(disp, parameters) \
- (* GET_InitNames(disp)) parameters
-static INLINE _glptr_InitNames GET_InitNames(struct _glapi_table *disp) {
- return (_glptr_InitNames) (GET_by_offset(disp, _gloffset_InitNames));
-}
-
-static INLINE void SET_InitNames(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_InitNames, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadName)(GLuint);
-#define CALL_LoadName(disp, parameters) \
- (* GET_LoadName(disp)) parameters
-static INLINE _glptr_LoadName GET_LoadName(struct _glapi_table *disp) {
- return (_glptr_LoadName) (GET_by_offset(disp, _gloffset_LoadName));
-}
-
-static INLINE void SET_LoadName(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_LoadName, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PassThrough)(GLfloat);
-#define CALL_PassThrough(disp, parameters) \
- (* GET_PassThrough(disp)) parameters
-static INLINE _glptr_PassThrough GET_PassThrough(struct _glapi_table *disp) {
- return (_glptr_PassThrough) (GET_by_offset(disp, _gloffset_PassThrough));
-}
-
-static INLINE void SET_PassThrough(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
- SET_by_offset(disp, _gloffset_PassThrough, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PopName)(void);
-#define CALL_PopName(disp, parameters) \
- (* GET_PopName(disp)) parameters
-static INLINE _glptr_PopName GET_PopName(struct _glapi_table *disp) {
- return (_glptr_PopName) (GET_by_offset(disp, _gloffset_PopName));
-}
-
-static INLINE void SET_PopName(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_PopName, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PushName)(GLuint);
-#define CALL_PushName(disp, parameters) \
- (* GET_PushName(disp)) parameters
-static INLINE _glptr_PushName GET_PushName(struct _glapi_table *disp) {
- return (_glptr_PushName) (GET_by_offset(disp, _gloffset_PushName));
-}
-
-static INLINE void SET_PushName(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_PushName, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawBuffer)(GLenum);
-#define CALL_DrawBuffer(disp, parameters) \
- (* GET_DrawBuffer(disp)) parameters
-static INLINE _glptr_DrawBuffer GET_DrawBuffer(struct _glapi_table *disp) {
- return (_glptr_DrawBuffer) (GET_by_offset(disp, _gloffset_DrawBuffer));
-}
-
-static INLINE void SET_DrawBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_DrawBuffer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Clear)(GLbitfield);
-#define CALL_Clear(disp, parameters) \
- (* GET_Clear(disp)) parameters
-static INLINE _glptr_Clear GET_Clear(struct _glapi_table *disp) {
- return (_glptr_Clear) (GET_by_offset(disp, _gloffset_Clear));
-}
-
-static INLINE void SET_Clear(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbitfield)) {
- SET_by_offset(disp, _gloffset_Clear, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearAccum)(GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_ClearAccum(disp, parameters) \
- (* GET_ClearAccum(disp)) parameters
-static INLINE _glptr_ClearAccum GET_ClearAccum(struct _glapi_table *disp) {
- return (_glptr_ClearAccum) (GET_by_offset(disp, _gloffset_ClearAccum));
-}
-
-static INLINE void SET_ClearAccum(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_ClearAccum, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearIndex)(GLfloat);
-#define CALL_ClearIndex(disp, parameters) \
- (* GET_ClearIndex(disp)) parameters
-static INLINE _glptr_ClearIndex GET_ClearIndex(struct _glapi_table *disp) {
- return (_glptr_ClearIndex) (GET_by_offset(disp, _gloffset_ClearIndex));
-}
-
-static INLINE void SET_ClearIndex(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
- SET_by_offset(disp, _gloffset_ClearIndex, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
-#define CALL_ClearColor(disp, parameters) \
- (* GET_ClearColor(disp)) parameters
-static INLINE _glptr_ClearColor GET_ClearColor(struct _glapi_table *disp) {
- return (_glptr_ClearColor) (GET_by_offset(disp, _gloffset_ClearColor));
-}
-
-static INLINE void SET_ClearColor(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLclampf, GLclampf, GLclampf)) {
- SET_by_offset(disp, _gloffset_ClearColor, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearStencil)(GLint);
-#define CALL_ClearStencil(disp, parameters) \
- (* GET_ClearStencil(disp)) parameters
-static INLINE _glptr_ClearStencil GET_ClearStencil(struct _glapi_table *disp) {
- return (_glptr_ClearStencil) (GET_by_offset(disp, _gloffset_ClearStencil));
-}
-
-static INLINE void SET_ClearStencil(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint)) {
- SET_by_offset(disp, _gloffset_ClearStencil, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearDepth)(GLclampd);
-#define CALL_ClearDepth(disp, parameters) \
- (* GET_ClearDepth(disp)) parameters
-static INLINE _glptr_ClearDepth GET_ClearDepth(struct _glapi_table *disp) {
- return (_glptr_ClearDepth) (GET_by_offset(disp, _gloffset_ClearDepth));
-}
-
-static INLINE void SET_ClearDepth(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampd)) {
- SET_by_offset(disp, _gloffset_ClearDepth, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilMask)(GLuint);
-#define CALL_StencilMask(disp, parameters) \
- (* GET_StencilMask(disp)) parameters
-static INLINE _glptr_StencilMask GET_StencilMask(struct _glapi_table *disp) {
- return (_glptr_StencilMask) (GET_by_offset(disp, _gloffset_StencilMask));
-}
-
-static INLINE void SET_StencilMask(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_StencilMask, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean);
-#define CALL_ColorMask(disp, parameters) \
- (* GET_ColorMask(disp)) parameters
-static INLINE _glptr_ColorMask GET_ColorMask(struct _glapi_table *disp) {
- return (_glptr_ColorMask) (GET_by_offset(disp, _gloffset_ColorMask));
-}
-
-static INLINE void SET_ColorMask(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLboolean, GLboolean, GLboolean, GLboolean)) {
- SET_by_offset(disp, _gloffset_ColorMask, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthMask)(GLboolean);
-#define CALL_DepthMask(disp, parameters) \
- (* GET_DepthMask(disp)) parameters
-static INLINE _glptr_DepthMask GET_DepthMask(struct _glapi_table *disp) {
- return (_glptr_DepthMask) (GET_by_offset(disp, _gloffset_DepthMask));
-}
-
-static INLINE void SET_DepthMask(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLboolean)) {
- SET_by_offset(disp, _gloffset_DepthMask, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_IndexMask)(GLuint);
-#define CALL_IndexMask(disp, parameters) \
- (* GET_IndexMask(disp)) parameters
-static INLINE _glptr_IndexMask GET_IndexMask(struct _glapi_table *disp) {
- return (_glptr_IndexMask) (GET_by_offset(disp, _gloffset_IndexMask));
-}
-
-static INLINE void SET_IndexMask(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IndexMask, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Accum)(GLenum, GLfloat);
-#define CALL_Accum(disp, parameters) \
- (* GET_Accum(disp)) parameters
-static INLINE _glptr_Accum GET_Accum(struct _glapi_table *disp) {
- return (_glptr_Accum) (GET_by_offset(disp, _gloffset_Accum));
-}
-
-static INLINE void SET_Accum(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_Accum, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Disable)(GLenum);
-#define CALL_Disable(disp, parameters) \
- (* GET_Disable(disp)) parameters
-static INLINE _glptr_Disable GET_Disable(struct _glapi_table *disp) {
- return (_glptr_Disable) (GET_by_offset(disp, _gloffset_Disable));
-}
-
-static INLINE void SET_Disable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_Disable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Enable)(GLenum);
-#define CALL_Enable(disp, parameters) \
- (* GET_Enable(disp)) parameters
-static INLINE _glptr_Enable GET_Enable(struct _glapi_table *disp) {
- return (_glptr_Enable) (GET_by_offset(disp, _gloffset_Enable));
-}
-
-static INLINE void SET_Enable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_Enable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Finish)(void);
-#define CALL_Finish(disp, parameters) \
- (* GET_Finish(disp)) parameters
-static INLINE _glptr_Finish GET_Finish(struct _glapi_table *disp) {
- return (_glptr_Finish) (GET_by_offset(disp, _gloffset_Finish));
-}
-
-static INLINE void SET_Finish(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_Finish, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Flush)(void);
-#define CALL_Flush(disp, parameters) \
- (* GET_Flush(disp)) parameters
-static INLINE _glptr_Flush GET_Flush(struct _glapi_table *disp) {
- return (_glptr_Flush) (GET_by_offset(disp, _gloffset_Flush));
-}
-
-static INLINE void SET_Flush(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_Flush, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PopAttrib)(void);
-#define CALL_PopAttrib(disp, parameters) \
- (* GET_PopAttrib(disp)) parameters
-static INLINE _glptr_PopAttrib GET_PopAttrib(struct _glapi_table *disp) {
- return (_glptr_PopAttrib) (GET_by_offset(disp, _gloffset_PopAttrib));
-}
-
-static INLINE void SET_PopAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_PopAttrib, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PushAttrib)(GLbitfield);
-#define CALL_PushAttrib(disp, parameters) \
- (* GET_PushAttrib(disp)) parameters
-static INLINE _glptr_PushAttrib GET_PushAttrib(struct _glapi_table *disp) {
- return (_glptr_PushAttrib) (GET_by_offset(disp, _gloffset_PushAttrib));
-}
-
-static INLINE void SET_PushAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbitfield)) {
- SET_by_offset(disp, _gloffset_PushAttrib, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Map1d)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
-#define CALL_Map1d(disp, parameters) \
- (* GET_Map1d(disp)) parameters
-static INLINE _glptr_Map1d GET_Map1d(struct _glapi_table *disp) {
- return (_glptr_Map1d) (GET_by_offset(disp, _gloffset_Map1d));
-}
-
-static INLINE void SET_Map1d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_Map1d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Map1f)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
-#define CALL_Map1f(disp, parameters) \
- (* GET_Map1f(disp)) parameters
-static INLINE _glptr_Map1f GET_Map1f(struct _glapi_table *disp) {
- return (_glptr_Map1f) (GET_by_offset(disp, _gloffset_Map1f));
-}
-
-static INLINE void SET_Map1f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Map1f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Map2d)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
-#define CALL_Map2d(disp, parameters) \
- (* GET_Map2d(disp)) parameters
-static INLINE _glptr_Map2d GET_Map2d(struct _glapi_table *disp) {
- return (_glptr_Map2d) (GET_by_offset(disp, _gloffset_Map2d));
-}
-
-static INLINE void SET_Map2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_Map2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Map2f)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
-#define CALL_Map2f(disp, parameters) \
- (* GET_Map2f(disp)) parameters
-static INLINE _glptr_Map2f GET_Map2f(struct _glapi_table *disp) {
- return (_glptr_Map2f) (GET_by_offset(disp, _gloffset_Map2f));
-}
-
-static INLINE void SET_Map2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Map2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MapGrid1d)(GLint, GLdouble, GLdouble);
-#define CALL_MapGrid1d(disp, parameters) \
- (* GET_MapGrid1d(disp)) parameters
-static INLINE _glptr_MapGrid1d GET_MapGrid1d(struct _glapi_table *disp) {
- return (_glptr_MapGrid1d) (GET_by_offset(disp, _gloffset_MapGrid1d));
-}
-
-static INLINE void SET_MapGrid1d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_MapGrid1d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MapGrid1f)(GLint, GLfloat, GLfloat);
-#define CALL_MapGrid1f(disp, parameters) \
- (* GET_MapGrid1f(disp)) parameters
-static INLINE _glptr_MapGrid1f GET_MapGrid1f(struct _glapi_table *disp) {
- return (_glptr_MapGrid1f) (GET_by_offset(disp, _gloffset_MapGrid1f));
-}
-
-static INLINE void SET_MapGrid1f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_MapGrid1f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MapGrid2d)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble);
-#define CALL_MapGrid2d(disp, parameters) \
- (* GET_MapGrid2d(disp)) parameters
-static INLINE _glptr_MapGrid2d GET_MapGrid2d(struct _glapi_table *disp) {
- return (_glptr_MapGrid2d) (GET_by_offset(disp, _gloffset_MapGrid2d));
-}
-
-static INLINE void SET_MapGrid2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_MapGrid2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MapGrid2f)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat);
-#define CALL_MapGrid2f(disp, parameters) \
- (* GET_MapGrid2f(disp)) parameters
-static INLINE _glptr_MapGrid2f GET_MapGrid2f(struct _glapi_table *disp) {
- return (_glptr_MapGrid2f) (GET_by_offset(disp, _gloffset_MapGrid2f));
-}
-
-static INLINE void SET_MapGrid2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_MapGrid2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord1d)(GLdouble);
-#define CALL_EvalCoord1d(disp, parameters) \
- (* GET_EvalCoord1d(disp)) parameters
-static INLINE _glptr_EvalCoord1d GET_EvalCoord1d(struct _glapi_table *disp) {
- return (_glptr_EvalCoord1d) (GET_by_offset(disp, _gloffset_EvalCoord1d));
-}
-
-static INLINE void SET_EvalCoord1d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble)) {
- SET_by_offset(disp, _gloffset_EvalCoord1d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord1dv)(const GLdouble *);
-#define CALL_EvalCoord1dv(disp, parameters) \
- (* GET_EvalCoord1dv(disp)) parameters
-static INLINE _glptr_EvalCoord1dv GET_EvalCoord1dv(struct _glapi_table *disp) {
- return (_glptr_EvalCoord1dv) (GET_by_offset(disp, _gloffset_EvalCoord1dv));
-}
-
-static INLINE void SET_EvalCoord1dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_EvalCoord1dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord1f)(GLfloat);
-#define CALL_EvalCoord1f(disp, parameters) \
- (* GET_EvalCoord1f(disp)) parameters
-static INLINE _glptr_EvalCoord1f GET_EvalCoord1f(struct _glapi_table *disp) {
- return (_glptr_EvalCoord1f) (GET_by_offset(disp, _gloffset_EvalCoord1f));
-}
-
-static INLINE void SET_EvalCoord1f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
- SET_by_offset(disp, _gloffset_EvalCoord1f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord1fv)(const GLfloat *);
-#define CALL_EvalCoord1fv(disp, parameters) \
- (* GET_EvalCoord1fv(disp)) parameters
-static INLINE _glptr_EvalCoord1fv GET_EvalCoord1fv(struct _glapi_table *disp) {
- return (_glptr_EvalCoord1fv) (GET_by_offset(disp, _gloffset_EvalCoord1fv));
-}
-
-static INLINE void SET_EvalCoord1fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_EvalCoord1fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord2d)(GLdouble, GLdouble);
-#define CALL_EvalCoord2d(disp, parameters) \
- (* GET_EvalCoord2d(disp)) parameters
-static INLINE _glptr_EvalCoord2d GET_EvalCoord2d(struct _glapi_table *disp) {
- return (_glptr_EvalCoord2d) (GET_by_offset(disp, _gloffset_EvalCoord2d));
-}
-
-static INLINE void SET_EvalCoord2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_EvalCoord2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord2dv)(const GLdouble *);
-#define CALL_EvalCoord2dv(disp, parameters) \
- (* GET_EvalCoord2dv(disp)) parameters
-static INLINE _glptr_EvalCoord2dv GET_EvalCoord2dv(struct _glapi_table *disp) {
- return (_glptr_EvalCoord2dv) (GET_by_offset(disp, _gloffset_EvalCoord2dv));
-}
-
-static INLINE void SET_EvalCoord2dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_EvalCoord2dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord2f)(GLfloat, GLfloat);
-#define CALL_EvalCoord2f(disp, parameters) \
- (* GET_EvalCoord2f(disp)) parameters
-static INLINE _glptr_EvalCoord2f GET_EvalCoord2f(struct _glapi_table *disp) {
- return (_glptr_EvalCoord2f) (GET_by_offset(disp, _gloffset_EvalCoord2f));
-}
-
-static INLINE void SET_EvalCoord2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_EvalCoord2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord2fv)(const GLfloat *);
-#define CALL_EvalCoord2fv(disp, parameters) \
- (* GET_EvalCoord2fv(disp)) parameters
-static INLINE _glptr_EvalCoord2fv GET_EvalCoord2fv(struct _glapi_table *disp) {
- return (_glptr_EvalCoord2fv) (GET_by_offset(disp, _gloffset_EvalCoord2fv));
-}
-
-static INLINE void SET_EvalCoord2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_EvalCoord2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalMesh1)(GLenum, GLint, GLint);
-#define CALL_EvalMesh1(disp, parameters) \
- (* GET_EvalMesh1(disp)) parameters
-static INLINE _glptr_EvalMesh1 GET_EvalMesh1(struct _glapi_table *disp) {
- return (_glptr_EvalMesh1) (GET_by_offset(disp, _gloffset_EvalMesh1));
-}
-
-static INLINE void SET_EvalMesh1(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_EvalMesh1, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalPoint1)(GLint);
-#define CALL_EvalPoint1(disp, parameters) \
- (* GET_EvalPoint1(disp)) parameters
-static INLINE _glptr_EvalPoint1 GET_EvalPoint1(struct _glapi_table *disp) {
- return (_glptr_EvalPoint1) (GET_by_offset(disp, _gloffset_EvalPoint1));
-}
-
-static INLINE void SET_EvalPoint1(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint)) {
- SET_by_offset(disp, _gloffset_EvalPoint1, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalMesh2)(GLenum, GLint, GLint, GLint, GLint);
-#define CALL_EvalMesh2(disp, parameters) \
- (* GET_EvalMesh2(disp)) parameters
-static INLINE _glptr_EvalMesh2 GET_EvalMesh2(struct _glapi_table *disp) {
- return (_glptr_EvalMesh2) (GET_by_offset(disp, _gloffset_EvalMesh2));
-}
-
-static INLINE void SET_EvalMesh2(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_EvalMesh2, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalPoint2)(GLint, GLint);
-#define CALL_EvalPoint2(disp, parameters) \
- (* GET_EvalPoint2(disp)) parameters
-static INLINE _glptr_EvalPoint2 GET_EvalPoint2(struct _glapi_table *disp) {
- return (_glptr_EvalPoint2) (GET_by_offset(disp, _gloffset_EvalPoint2));
-}
-
-static INLINE void SET_EvalPoint2(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
- SET_by_offset(disp, _gloffset_EvalPoint2, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AlphaFunc)(GLenum, GLclampf);
-#define CALL_AlphaFunc(disp, parameters) \
- (* GET_AlphaFunc(disp)) parameters
-static INLINE _glptr_AlphaFunc GET_AlphaFunc(struct _glapi_table *disp) {
- return (_glptr_AlphaFunc) (GET_by_offset(disp, _gloffset_AlphaFunc));
-}
-
-static INLINE void SET_AlphaFunc(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLclampf)) {
- SET_by_offset(disp, _gloffset_AlphaFunc, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendFunc)(GLenum, GLenum);
-#define CALL_BlendFunc(disp, parameters) \
- (* GET_BlendFunc(disp)) parameters
-static INLINE _glptr_BlendFunc GET_BlendFunc(struct _glapi_table *disp) {
- return (_glptr_BlendFunc) (GET_by_offset(disp, _gloffset_BlendFunc));
-}
-
-static INLINE void SET_BlendFunc(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_BlendFunc, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LogicOp)(GLenum);
-#define CALL_LogicOp(disp, parameters) \
- (* GET_LogicOp(disp)) parameters
-static INLINE _glptr_LogicOp GET_LogicOp(struct _glapi_table *disp) {
- return (_glptr_LogicOp) (GET_by_offset(disp, _gloffset_LogicOp));
-}
-
-static INLINE void SET_LogicOp(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_LogicOp, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilFunc)(GLenum, GLint, GLuint);
-#define CALL_StencilFunc(disp, parameters) \
- (* GET_StencilFunc(disp)) parameters
-static INLINE _glptr_StencilFunc GET_StencilFunc(struct _glapi_table *disp) {
- return (_glptr_StencilFunc) (GET_by_offset(disp, _gloffset_StencilFunc));
-}
-
-static INLINE void SET_StencilFunc(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLuint)) {
- SET_by_offset(disp, _gloffset_StencilFunc, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilOp)(GLenum, GLenum, GLenum);
-#define CALL_StencilOp(disp, parameters) \
- (* GET_StencilOp(disp)) parameters
-static INLINE _glptr_StencilOp GET_StencilOp(struct _glapi_table *disp) {
- return (_glptr_StencilOp) (GET_by_offset(disp, _gloffset_StencilOp));
-}
-
-static INLINE void SET_StencilOp(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_StencilOp, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthFunc)(GLenum);
-#define CALL_DepthFunc(disp, parameters) \
- (* GET_DepthFunc(disp)) parameters
-static INLINE _glptr_DepthFunc GET_DepthFunc(struct _glapi_table *disp) {
- return (_glptr_DepthFunc) (GET_by_offset(disp, _gloffset_DepthFunc));
-}
-
-static INLINE void SET_DepthFunc(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_DepthFunc, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelZoom)(GLfloat, GLfloat);
-#define CALL_PixelZoom(disp, parameters) \
- (* GET_PixelZoom(disp)) parameters
-static INLINE _glptr_PixelZoom GET_PixelZoom(struct _glapi_table *disp) {
- return (_glptr_PixelZoom) (GET_by_offset(disp, _gloffset_PixelZoom));
-}
-
-static INLINE void SET_PixelZoom(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_PixelZoom, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTransferf)(GLenum, GLfloat);
-#define CALL_PixelTransferf(disp, parameters) \
- (* GET_PixelTransferf(disp)) parameters
-static INLINE _glptr_PixelTransferf GET_PixelTransferf(struct _glapi_table *disp) {
- return (_glptr_PixelTransferf) (GET_by_offset(disp, _gloffset_PixelTransferf));
-}
-
-static INLINE void SET_PixelTransferf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_PixelTransferf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTransferi)(GLenum, GLint);
-#define CALL_PixelTransferi(disp, parameters) \
- (* GET_PixelTransferi(disp)) parameters
-static INLINE _glptr_PixelTransferi GET_PixelTransferi(struct _glapi_table *disp) {
- return (_glptr_PixelTransferi) (GET_by_offset(disp, _gloffset_PixelTransferi));
-}
-
-static INLINE void SET_PixelTransferi(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_PixelTransferi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelStoref)(GLenum, GLfloat);
-#define CALL_PixelStoref(disp, parameters) \
- (* GET_PixelStoref(disp)) parameters
-static INLINE _glptr_PixelStoref GET_PixelStoref(struct _glapi_table *disp) {
- return (_glptr_PixelStoref) (GET_by_offset(disp, _gloffset_PixelStoref));
-}
-
-static INLINE void SET_PixelStoref(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_PixelStoref, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelStorei)(GLenum, GLint);
-#define CALL_PixelStorei(disp, parameters) \
- (* GET_PixelStorei(disp)) parameters
-static INLINE _glptr_PixelStorei GET_PixelStorei(struct _glapi_table *disp) {
- return (_glptr_PixelStorei) (GET_by_offset(disp, _gloffset_PixelStorei));
-}
-
-static INLINE void SET_PixelStorei(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_PixelStorei, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelMapfv)(GLenum, GLsizei, const GLfloat *);
-#define CALL_PixelMapfv(disp, parameters) \
- (* GET_PixelMapfv(disp)) parameters
-static INLINE _glptr_PixelMapfv GET_PixelMapfv(struct _glapi_table *disp) {
- return (_glptr_PixelMapfv) (GET_by_offset(disp, _gloffset_PixelMapfv));
-}
-
-static INLINE void SET_PixelMapfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_PixelMapfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelMapuiv)(GLenum, GLsizei, const GLuint *);
-#define CALL_PixelMapuiv(disp, parameters) \
- (* GET_PixelMapuiv(disp)) parameters
-static INLINE _glptr_PixelMapuiv GET_PixelMapuiv(struct _glapi_table *disp) {
- return (_glptr_PixelMapuiv) (GET_by_offset(disp, _gloffset_PixelMapuiv));
-}
-
-static INLINE void SET_PixelMapuiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_PixelMapuiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelMapusv)(GLenum, GLsizei, const GLushort *);
-#define CALL_PixelMapusv(disp, parameters) \
- (* GET_PixelMapusv(disp)) parameters
-static INLINE _glptr_PixelMapusv GET_PixelMapusv(struct _glapi_table *disp) {
- return (_glptr_PixelMapusv) (GET_by_offset(disp, _gloffset_PixelMapusv));
-}
-
-static INLINE void SET_PixelMapusv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLushort *)) {
- SET_by_offset(disp, _gloffset_PixelMapusv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ReadBuffer)(GLenum);
-#define CALL_ReadBuffer(disp, parameters) \
- (* GET_ReadBuffer(disp)) parameters
-static INLINE _glptr_ReadBuffer GET_ReadBuffer(struct _glapi_table *disp) {
- return (_glptr_ReadBuffer) (GET_by_offset(disp, _gloffset_ReadBuffer));
-}
-
-static INLINE void SET_ReadBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_ReadBuffer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyPixels)(GLint, GLint, GLsizei, GLsizei, GLenum);
-#define CALL_CopyPixels(disp, parameters) \
- (* GET_CopyPixels(disp)) parameters
-static INLINE _glptr_CopyPixels GET_CopyPixels(struct _glapi_table *disp) {
- return (_glptr_CopyPixels) (GET_by_offset(disp, _gloffset_CopyPixels));
-}
-
-static INLINE void SET_CopyPixels(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLsizei, GLsizei, GLenum)) {
- SET_by_offset(disp, _gloffset_CopyPixels, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
-#define CALL_ReadPixels(disp, parameters) \
- (* GET_ReadPixels(disp)) parameters
-static INLINE _glptr_ReadPixels GET_ReadPixels(struct _glapi_table *disp) {
- return (_glptr_ReadPixels) (GET_by_offset(disp, _gloffset_ReadPixels));
-}
-
-static INLINE void SET_ReadPixels(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *)) {
- SET_by_offset(disp, _gloffset_ReadPixels, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-#define CALL_DrawPixels(disp, parameters) \
- (* GET_DrawPixels(disp)) parameters
-static INLINE _glptr_DrawPixels GET_DrawPixels(struct _glapi_table *disp) {
- return (_glptr_DrawPixels) (GET_by_offset(disp, _gloffset_DrawPixels));
-}
-
-static INLINE void SET_DrawPixels(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_DrawPixels, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBooleanv)(GLenum, GLboolean *);
-#define CALL_GetBooleanv(disp, parameters) \
- (* GET_GetBooleanv(disp)) parameters
-static INLINE _glptr_GetBooleanv GET_GetBooleanv(struct _glapi_table *disp) {
- return (_glptr_GetBooleanv) (GET_by_offset(disp, _gloffset_GetBooleanv));
-}
-
-static INLINE void SET_GetBooleanv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLboolean *)) {
- SET_by_offset(disp, _gloffset_GetBooleanv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetClipPlane)(GLenum, GLdouble *);
-#define CALL_GetClipPlane(disp, parameters) \
- (* GET_GetClipPlane(disp)) parameters
-static INLINE _glptr_GetClipPlane GET_GetClipPlane(struct _glapi_table *disp) {
- return (_glptr_GetClipPlane) (GET_by_offset(disp, _gloffset_GetClipPlane));
-}
-
-static INLINE void SET_GetClipPlane(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetClipPlane, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetDoublev)(GLenum, GLdouble *);
-#define CALL_GetDoublev(disp, parameters) \
- (* GET_GetDoublev(disp)) parameters
-static INLINE _glptr_GetDoublev GET_GetDoublev(struct _glapi_table *disp) {
- return (_glptr_GetDoublev) (GET_by_offset(disp, _gloffset_GetDoublev));
-}
-
-static INLINE void SET_GetDoublev(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetDoublev, fn);
-}
-
-typedef GLenum (GLAPIENTRYP _glptr_GetError)(void);
-#define CALL_GetError(disp, parameters) \
- (* GET_GetError(disp)) parameters
-static INLINE _glptr_GetError GET_GetError(struct _glapi_table *disp) {
- return (_glptr_GetError) (GET_by_offset(disp, _gloffset_GetError));
-}
-
-static INLINE void SET_GetError(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_GetError, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetFloatv)(GLenum, GLfloat *);
-#define CALL_GetFloatv(disp, parameters) \
- (* GET_GetFloatv(disp)) parameters
-static INLINE _glptr_GetFloatv GET_GetFloatv(struct _glapi_table *disp) {
- return (_glptr_GetFloatv) (GET_by_offset(disp, _gloffset_GetFloatv));
-}
-
-static INLINE void SET_GetFloatv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetFloatv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetIntegerv)(GLenum, GLint *);
-#define CALL_GetIntegerv(disp, parameters) \
- (* GET_GetIntegerv(disp)) parameters
-static INLINE _glptr_GetIntegerv GET_GetIntegerv(struct _glapi_table *disp) {
- return (_glptr_GetIntegerv) (GET_by_offset(disp, _gloffset_GetIntegerv));
-}
-
-static INLINE void SET_GetIntegerv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetIntegerv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetLightfv)(GLenum, GLenum, GLfloat *);
-#define CALL_GetLightfv(disp, parameters) \
- (* GET_GetLightfv(disp)) parameters
-static INLINE _glptr_GetLightfv GET_GetLightfv(struct _glapi_table *disp) {
- return (_glptr_GetLightfv) (GET_by_offset(disp, _gloffset_GetLightfv));
-}
-
-static INLINE void SET_GetLightfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetLightfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetLightiv)(GLenum, GLenum, GLint *);
-#define CALL_GetLightiv(disp, parameters) \
- (* GET_GetLightiv(disp)) parameters
-static INLINE _glptr_GetLightiv GET_GetLightiv(struct _glapi_table *disp) {
- return (_glptr_GetLightiv) (GET_by_offset(disp, _gloffset_GetLightiv));
-}
-
-static INLINE void SET_GetLightiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetLightiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMapdv)(GLenum, GLenum, GLdouble *);
-#define CALL_GetMapdv(disp, parameters) \
- (* GET_GetMapdv(disp)) parameters
-static INLINE _glptr_GetMapdv GET_GetMapdv(struct _glapi_table *disp) {
- return (_glptr_GetMapdv) (GET_by_offset(disp, _gloffset_GetMapdv));
-}
-
-static INLINE void SET_GetMapdv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetMapdv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMapfv)(GLenum, GLenum, GLfloat *);
-#define CALL_GetMapfv(disp, parameters) \
- (* GET_GetMapfv(disp)) parameters
-static INLINE _glptr_GetMapfv GET_GetMapfv(struct _glapi_table *disp) {
- return (_glptr_GetMapfv) (GET_by_offset(disp, _gloffset_GetMapfv));
-}
-
-static INLINE void SET_GetMapfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetMapfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMapiv)(GLenum, GLenum, GLint *);
-#define CALL_GetMapiv(disp, parameters) \
- (* GET_GetMapiv(disp)) parameters
-static INLINE _glptr_GetMapiv GET_GetMapiv(struct _glapi_table *disp) {
- return (_glptr_GetMapiv) (GET_by_offset(disp, _gloffset_GetMapiv));
-}
-
-static INLINE void SET_GetMapiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetMapiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMaterialfv)(GLenum, GLenum, GLfloat *);
-#define CALL_GetMaterialfv(disp, parameters) \
- (* GET_GetMaterialfv(disp)) parameters
-static INLINE _glptr_GetMaterialfv GET_GetMaterialfv(struct _glapi_table *disp) {
- return (_glptr_GetMaterialfv) (GET_by_offset(disp, _gloffset_GetMaterialfv));
-}
-
-static INLINE void SET_GetMaterialfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetMaterialfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMaterialiv)(GLenum, GLenum, GLint *);
-#define CALL_GetMaterialiv(disp, parameters) \
- (* GET_GetMaterialiv(disp)) parameters
-static INLINE _glptr_GetMaterialiv GET_GetMaterialiv(struct _glapi_table *disp) {
- return (_glptr_GetMaterialiv) (GET_by_offset(disp, _gloffset_GetMaterialiv));
-}
-
-static INLINE void SET_GetMaterialiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetMaterialiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPixelMapfv)(GLenum, GLfloat *);
-#define CALL_GetPixelMapfv(disp, parameters) \
- (* GET_GetPixelMapfv(disp)) parameters
-static INLINE _glptr_GetPixelMapfv GET_GetPixelMapfv(struct _glapi_table *disp) {
- return (_glptr_GetPixelMapfv) (GET_by_offset(disp, _gloffset_GetPixelMapfv));
-}
-
-static INLINE void SET_GetPixelMapfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetPixelMapfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPixelMapuiv)(GLenum, GLuint *);
-#define CALL_GetPixelMapuiv(disp, parameters) \
- (* GET_GetPixelMapuiv(disp)) parameters
-static INLINE _glptr_GetPixelMapuiv GET_GetPixelMapuiv(struct _glapi_table *disp) {
- return (_glptr_GetPixelMapuiv) (GET_by_offset(disp, _gloffset_GetPixelMapuiv));
-}
-
-static INLINE void SET_GetPixelMapuiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint *)) {
- SET_by_offset(disp, _gloffset_GetPixelMapuiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPixelMapusv)(GLenum, GLushort *);
-#define CALL_GetPixelMapusv(disp, parameters) \
- (* GET_GetPixelMapusv(disp)) parameters
-static INLINE _glptr_GetPixelMapusv GET_GetPixelMapusv(struct _glapi_table *disp) {
- return (_glptr_GetPixelMapusv) (GET_by_offset(disp, _gloffset_GetPixelMapusv));
-}
-
-static INLINE void SET_GetPixelMapusv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLushort *)) {
- SET_by_offset(disp, _gloffset_GetPixelMapusv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPolygonStipple)(GLubyte *);
-#define CALL_GetPolygonStipple(disp, parameters) \
- (* GET_GetPolygonStipple(disp)) parameters
-static INLINE _glptr_GetPolygonStipple GET_GetPolygonStipple(struct _glapi_table *disp) {
- return (_glptr_GetPolygonStipple) (GET_by_offset(disp, _gloffset_GetPolygonStipple));
-}
-
-static INLINE void SET_GetPolygonStipple(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLubyte *)) {
- SET_by_offset(disp, _gloffset_GetPolygonStipple, fn);
-}
-
-typedef const GLubyte * (GLAPIENTRYP _glptr_GetString)(GLenum);
-#define CALL_GetString(disp, parameters) \
- (* GET_GetString(disp)) parameters
-static INLINE _glptr_GetString GET_GetString(struct _glapi_table *disp) {
- return (_glptr_GetString) (GET_by_offset(disp, _gloffset_GetString));
-}
-
-static INLINE void SET_GetString(struct _glapi_table *disp, const GLubyte * (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_GetString, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexEnvfv)(GLenum, GLenum, GLfloat *);
-#define CALL_GetTexEnvfv(disp, parameters) \
- (* GET_GetTexEnvfv(disp)) parameters
-static INLINE _glptr_GetTexEnvfv GET_GetTexEnvfv(struct _glapi_table *disp) {
- return (_glptr_GetTexEnvfv) (GET_by_offset(disp, _gloffset_GetTexEnvfv));
-}
-
-static INLINE void SET_GetTexEnvfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetTexEnvfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexEnviv)(GLenum, GLenum, GLint *);
-#define CALL_GetTexEnviv(disp, parameters) \
- (* GET_GetTexEnviv(disp)) parameters
-static INLINE _glptr_GetTexEnviv GET_GetTexEnviv(struct _glapi_table *disp) {
- return (_glptr_GetTexEnviv) (GET_by_offset(disp, _gloffset_GetTexEnviv));
-}
-
-static INLINE void SET_GetTexEnviv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetTexEnviv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexGendv)(GLenum, GLenum, GLdouble *);
-#define CALL_GetTexGendv(disp, parameters) \
- (* GET_GetTexGendv(disp)) parameters
-static INLINE _glptr_GetTexGendv GET_GetTexGendv(struct _glapi_table *disp) {
- return (_glptr_GetTexGendv) (GET_by_offset(disp, _gloffset_GetTexGendv));
-}
-
-static INLINE void SET_GetTexGendv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetTexGendv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexGenfv)(GLenum, GLenum, GLfloat *);
-#define CALL_GetTexGenfv(disp, parameters) \
- (* GET_GetTexGenfv(disp)) parameters
-static INLINE _glptr_GetTexGenfv GET_GetTexGenfv(struct _glapi_table *disp) {
- return (_glptr_GetTexGenfv) (GET_by_offset(disp, _gloffset_GetTexGenfv));
-}
-
-static INLINE void SET_GetTexGenfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetTexGenfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexGeniv)(GLenum, GLenum, GLint *);
-#define CALL_GetTexGeniv(disp, parameters) \
- (* GET_GetTexGeniv(disp)) parameters
-static INLINE _glptr_GetTexGeniv GET_GetTexGeniv(struct _glapi_table *disp) {
- return (_glptr_GetTexGeniv) (GET_by_offset(disp, _gloffset_GetTexGeniv));
-}
-
-static INLINE void SET_GetTexGeniv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetTexGeniv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *);
-#define CALL_GetTexImage(disp, parameters) \
- (* GET_GetTexImage(disp)) parameters
-static INLINE _glptr_GetTexImage GET_GetTexImage(struct _glapi_table *disp) {
- return (_glptr_GetTexImage) (GET_by_offset(disp, _gloffset_GetTexImage));
-}
-
-static INLINE void SET_GetTexImage(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLenum, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetTexImage, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexParameterfv)(GLenum, GLenum, GLfloat *);
-#define CALL_GetTexParameterfv(disp, parameters) \
- (* GET_GetTexParameterfv(disp)) parameters
-static INLINE _glptr_GetTexParameterfv GET_GetTexParameterfv(struct _glapi_table *disp) {
- return (_glptr_GetTexParameterfv) (GET_by_offset(disp, _gloffset_GetTexParameterfv));
-}
-
-static INLINE void SET_GetTexParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetTexParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexParameteriv)(GLenum, GLenum, GLint *);
-#define CALL_GetTexParameteriv(disp, parameters) \
- (* GET_GetTexParameteriv(disp)) parameters
-static INLINE _glptr_GetTexParameteriv GET_GetTexParameteriv(struct _glapi_table *disp) {
- return (_glptr_GetTexParameteriv) (GET_by_offset(disp, _gloffset_GetTexParameteriv));
-}
-
-static INLINE void SET_GetTexParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetTexParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *);
-#define CALL_GetTexLevelParameterfv(disp, parameters) \
- (* GET_GetTexLevelParameterfv(disp)) parameters
-static INLINE _glptr_GetTexLevelParameterfv GET_GetTexLevelParameterfv(struct _glapi_table *disp) {
- return (_glptr_GetTexLevelParameterfv) (GET_by_offset(disp, _gloffset_GetTexLevelParameterfv));
-}
-
-static INLINE void SET_GetTexLevelParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetTexLevelParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
-#define CALL_GetTexLevelParameteriv(disp, parameters) \
- (* GET_GetTexLevelParameteriv(disp)) parameters
-static INLINE _glptr_GetTexLevelParameteriv GET_GetTexLevelParameteriv(struct _glapi_table *disp) {
- return (_glptr_GetTexLevelParameteriv) (GET_by_offset(disp, _gloffset_GetTexLevelParameteriv));
-}
-
-static INLINE void SET_GetTexLevelParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetTexLevelParameteriv, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsEnabled)(GLenum);
-#define CALL_IsEnabled(disp, parameters) \
- (* GET_IsEnabled(disp)) parameters
-static INLINE _glptr_IsEnabled GET_IsEnabled(struct _glapi_table *disp) {
- return (_glptr_IsEnabled) (GET_by_offset(disp, _gloffset_IsEnabled));
-}
-
-static INLINE void SET_IsEnabled(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_IsEnabled, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsList)(GLuint);
-#define CALL_IsList(disp, parameters) \
- (* GET_IsList(disp)) parameters
-static INLINE _glptr_IsList GET_IsList(struct _glapi_table *disp) {
- return (_glptr_IsList) (GET_by_offset(disp, _gloffset_IsList));
-}
-
-static INLINE void SET_IsList(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsList, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthRange)(GLclampd, GLclampd);
-#define CALL_DepthRange(disp, parameters) \
- (* GET_DepthRange(disp)) parameters
-static INLINE _glptr_DepthRange GET_DepthRange(struct _glapi_table *disp) {
- return (_glptr_DepthRange) (GET_by_offset(disp, _gloffset_DepthRange));
-}
-
-static INLINE void SET_DepthRange(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampd, GLclampd)) {
- SET_by_offset(disp, _gloffset_DepthRange, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Frustum)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_Frustum(disp, parameters) \
- (* GET_Frustum(disp)) parameters
-static INLINE _glptr_Frustum GET_Frustum(struct _glapi_table *disp) {
- return (_glptr_Frustum) (GET_by_offset(disp, _gloffset_Frustum));
-}
-
-static INLINE void SET_Frustum(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Frustum, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadIdentity)(void);
-#define CALL_LoadIdentity(disp, parameters) \
- (* GET_LoadIdentity(disp)) parameters
-static INLINE _glptr_LoadIdentity GET_LoadIdentity(struct _glapi_table *disp) {
- return (_glptr_LoadIdentity) (GET_by_offset(disp, _gloffset_LoadIdentity));
-}
-
-static INLINE void SET_LoadIdentity(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_LoadIdentity, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadMatrixf)(const GLfloat *);
-#define CALL_LoadMatrixf(disp, parameters) \
- (* GET_LoadMatrixf(disp)) parameters
-static INLINE _glptr_LoadMatrixf GET_LoadMatrixf(struct _glapi_table *disp) {
- return (_glptr_LoadMatrixf) (GET_by_offset(disp, _gloffset_LoadMatrixf));
-}
-
-static INLINE void SET_LoadMatrixf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_LoadMatrixf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadMatrixd)(const GLdouble *);
-#define CALL_LoadMatrixd(disp, parameters) \
- (* GET_LoadMatrixd(disp)) parameters
-static INLINE _glptr_LoadMatrixd GET_LoadMatrixd(struct _glapi_table *disp) {
- return (_glptr_LoadMatrixd) (GET_by_offset(disp, _gloffset_LoadMatrixd));
-}
-
-static INLINE void SET_LoadMatrixd(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_LoadMatrixd, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MatrixMode)(GLenum);
-#define CALL_MatrixMode(disp, parameters) \
- (* GET_MatrixMode(disp)) parameters
-static INLINE _glptr_MatrixMode GET_MatrixMode(struct _glapi_table *disp) {
- return (_glptr_MatrixMode) (GET_by_offset(disp, _gloffset_MatrixMode));
-}
-
-static INLINE void SET_MatrixMode(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_MatrixMode, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultMatrixf)(const GLfloat *);
-#define CALL_MultMatrixf(disp, parameters) \
- (* GET_MultMatrixf(disp)) parameters
-static INLINE _glptr_MultMatrixf GET_MultMatrixf(struct _glapi_table *disp) {
- return (_glptr_MultMatrixf) (GET_by_offset(disp, _gloffset_MultMatrixf));
-}
-
-static INLINE void SET_MultMatrixf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_MultMatrixf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultMatrixd)(const GLdouble *);
-#define CALL_MultMatrixd(disp, parameters) \
- (* GET_MultMatrixd(disp)) parameters
-static INLINE _glptr_MultMatrixd GET_MultMatrixd(struct _glapi_table *disp) {
- return (_glptr_MultMatrixd) (GET_by_offset(disp, _gloffset_MultMatrixd));
-}
-
-static INLINE void SET_MultMatrixd(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_MultMatrixd, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Ortho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_Ortho(disp, parameters) \
- (* GET_Ortho(disp)) parameters
-static INLINE _glptr_Ortho GET_Ortho(struct _glapi_table *disp) {
- return (_glptr_Ortho) (GET_by_offset(disp, _gloffset_Ortho));
-}
-
-static INLINE void SET_Ortho(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Ortho, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PopMatrix)(void);
-#define CALL_PopMatrix(disp, parameters) \
- (* GET_PopMatrix(disp)) parameters
-static INLINE _glptr_PopMatrix GET_PopMatrix(struct _glapi_table *disp) {
- return (_glptr_PopMatrix) (GET_by_offset(disp, _gloffset_PopMatrix));
-}
-
-static INLINE void SET_PopMatrix(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_PopMatrix, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PushMatrix)(void);
-#define CALL_PushMatrix(disp, parameters) \
- (* GET_PushMatrix(disp)) parameters
-static INLINE _glptr_PushMatrix GET_PushMatrix(struct _glapi_table *disp) {
- return (_glptr_PushMatrix) (GET_by_offset(disp, _gloffset_PushMatrix));
-}
-
-static INLINE void SET_PushMatrix(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_PushMatrix, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rotated)(GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_Rotated(disp, parameters) \
- (* GET_Rotated(disp)) parameters
-static INLINE _glptr_Rotated GET_Rotated(struct _glapi_table *disp) {
- return (_glptr_Rotated) (GET_by_offset(disp, _gloffset_Rotated));
-}
-
-static INLINE void SET_Rotated(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Rotated, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rotatef)(GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_Rotatef(disp, parameters) \
- (* GET_Rotatef(disp)) parameters
-static INLINE _glptr_Rotatef GET_Rotatef(struct _glapi_table *disp) {
- return (_glptr_Rotatef) (GET_by_offset(disp, _gloffset_Rotatef));
-}
-
-static INLINE void SET_Rotatef(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Rotatef, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Scaled)(GLdouble, GLdouble, GLdouble);
-#define CALL_Scaled(disp, parameters) \
- (* GET_Scaled(disp)) parameters
-static INLINE _glptr_Scaled GET_Scaled(struct _glapi_table *disp) {
- return (_glptr_Scaled) (GET_by_offset(disp, _gloffset_Scaled));
-}
-
-static INLINE void SET_Scaled(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Scaled, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Scalef)(GLfloat, GLfloat, GLfloat);
-#define CALL_Scalef(disp, parameters) \
- (* GET_Scalef(disp)) parameters
-static INLINE _glptr_Scalef GET_Scalef(struct _glapi_table *disp) {
- return (_glptr_Scalef) (GET_by_offset(disp, _gloffset_Scalef));
-}
-
-static INLINE void SET_Scalef(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Scalef, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Translated)(GLdouble, GLdouble, GLdouble);
-#define CALL_Translated(disp, parameters) \
- (* GET_Translated(disp)) parameters
-static INLINE _glptr_Translated GET_Translated(struct _glapi_table *disp) {
- return (_glptr_Translated) (GET_by_offset(disp, _gloffset_Translated));
-}
-
-static INLINE void SET_Translated(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_Translated, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Translatef)(GLfloat, GLfloat, GLfloat);
-#define CALL_Translatef(disp, parameters) \
- (* GET_Translatef(disp)) parameters
-static INLINE _glptr_Translatef GET_Translatef(struct _glapi_table *disp) {
- return (_glptr_Translatef) (GET_by_offset(disp, _gloffset_Translatef));
-}
-
-static INLINE void SET_Translatef(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Translatef, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Viewport)(GLint, GLint, GLsizei, GLsizei);
-#define CALL_Viewport(disp, parameters) \
- (* GET_Viewport(disp)) parameters
-static INLINE _glptr_Viewport GET_Viewport(struct _glapi_table *disp) {
- return (_glptr_Viewport) (GET_by_offset(disp, _gloffset_Viewport));
-}
-
-static INLINE void SET_Viewport(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_Viewport, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ArrayElement)(GLint);
-#define CALL_ArrayElement(disp, parameters) \
- (* GET_ArrayElement(disp)) parameters
-static INLINE _glptr_ArrayElement GET_ArrayElement(struct _glapi_table *disp) {
- return (_glptr_ArrayElement) (GET_by_offset(disp, _gloffset_ArrayElement));
-}
-
-static INLINE void SET_ArrayElement(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint)) {
- SET_by_offset(disp, _gloffset_ArrayElement, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindTexture)(GLenum, GLuint);
-#define CALL_BindTexture(disp, parameters) \
- (* GET_BindTexture(disp)) parameters
-static INLINE _glptr_BindTexture GET_BindTexture(struct _glapi_table *disp) {
- return (_glptr_BindTexture) (GET_by_offset(disp, _gloffset_BindTexture));
-}
-
-static INLINE void SET_BindTexture(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_BindTexture, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *);
-#define CALL_ColorPointer(disp, parameters) \
- (* GET_ColorPointer(disp)) parameters
-static INLINE _glptr_ColorPointer GET_ColorPointer(struct _glapi_table *disp) {
- return (_glptr_ColorPointer) (GET_by_offset(disp, _gloffset_ColorPointer));
-}
-
-static INLINE void SET_ColorPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_ColorPointer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DisableClientState)(GLenum);
-#define CALL_DisableClientState(disp, parameters) \
- (* GET_DisableClientState(disp)) parameters
-static INLINE _glptr_DisableClientState GET_DisableClientState(struct _glapi_table *disp) {
- return (_glptr_DisableClientState) (GET_by_offset(disp, _gloffset_DisableClientState));
-}
-
-static INLINE void SET_DisableClientState(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_DisableClientState, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawArrays)(GLenum, GLint, GLsizei);
-#define CALL_DrawArrays(disp, parameters) \
- (* GET_DrawArrays(disp)) parameters
-static INLINE _glptr_DrawArrays GET_DrawArrays(struct _glapi_table *disp) {
- return (_glptr_DrawArrays) (GET_by_offset(disp, _gloffset_DrawArrays));
-}
-
-static INLINE void SET_DrawArrays(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLsizei)) {
- SET_by_offset(disp, _gloffset_DrawArrays, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawElements)(GLenum, GLsizei, GLenum, const GLvoid *);
-#define CALL_DrawElements(disp, parameters) \
- (* GET_DrawElements(disp)) parameters
-static INLINE _glptr_DrawElements GET_DrawElements(struct _glapi_table *disp) {
- return (_glptr_DrawElements) (GET_by_offset(disp, _gloffset_DrawElements));
-}
-
-static INLINE void SET_DrawElements(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_DrawElements, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EdgeFlagPointer)(GLsizei, const GLvoid *);
-#define CALL_EdgeFlagPointer(disp, parameters) \
- (* GET_EdgeFlagPointer(disp)) parameters
-static INLINE _glptr_EdgeFlagPointer GET_EdgeFlagPointer(struct _glapi_table *disp) {
- return (_glptr_EdgeFlagPointer) (GET_by_offset(disp, _gloffset_EdgeFlagPointer));
-}
-
-static INLINE void SET_EdgeFlagPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_EdgeFlagPointer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EnableClientState)(GLenum);
-#define CALL_EnableClientState(disp, parameters) \
- (* GET_EnableClientState(disp)) parameters
-static INLINE _glptr_EnableClientState GET_EnableClientState(struct _glapi_table *disp) {
- return (_glptr_EnableClientState) (GET_by_offset(disp, _gloffset_EnableClientState));
-}
-
-static INLINE void SET_EnableClientState(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_EnableClientState, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_IndexPointer)(GLenum, GLsizei, const GLvoid *);
-#define CALL_IndexPointer(disp, parameters) \
- (* GET_IndexPointer(disp)) parameters
-static INLINE _glptr_IndexPointer GET_IndexPointer(struct _glapi_table *disp) {
- return (_glptr_IndexPointer) (GET_by_offset(disp, _gloffset_IndexPointer));
-}
-
-static INLINE void SET_IndexPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_IndexPointer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexub)(GLubyte);
-#define CALL_Indexub(disp, parameters) \
- (* GET_Indexub(disp)) parameters
-static INLINE _glptr_Indexub GET_Indexub(struct _glapi_table *disp) {
- return (_glptr_Indexub) (GET_by_offset(disp, _gloffset_Indexub));
-}
-
-static INLINE void SET_Indexub(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLubyte)) {
- SET_by_offset(disp, _gloffset_Indexub, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexubv)(const GLubyte *);
-#define CALL_Indexubv(disp, parameters) \
- (* GET_Indexubv(disp)) parameters
-static INLINE _glptr_Indexubv GET_Indexubv(struct _glapi_table *disp) {
- return (_glptr_Indexubv) (GET_by_offset(disp, _gloffset_Indexubv));
-}
-
-static INLINE void SET_Indexubv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLubyte *)) {
- SET_by_offset(disp, _gloffset_Indexubv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_InterleavedArrays)(GLenum, GLsizei, const GLvoid *);
-#define CALL_InterleavedArrays(disp, parameters) \
- (* GET_InterleavedArrays(disp)) parameters
-static INLINE _glptr_InterleavedArrays GET_InterleavedArrays(struct _glapi_table *disp) {
- return (_glptr_InterleavedArrays) (GET_by_offset(disp, _gloffset_InterleavedArrays));
-}
-
-static INLINE void SET_InterleavedArrays(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_InterleavedArrays, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_NormalPointer)(GLenum, GLsizei, const GLvoid *);
-#define CALL_NormalPointer(disp, parameters) \
- (* GET_NormalPointer(disp)) parameters
-static INLINE _glptr_NormalPointer GET_NormalPointer(struct _glapi_table *disp) {
- return (_glptr_NormalPointer) (GET_by_offset(disp, _gloffset_NormalPointer));
-}
-
-static INLINE void SET_NormalPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_NormalPointer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PolygonOffset)(GLfloat, GLfloat);
-#define CALL_PolygonOffset(disp, parameters) \
- (* GET_PolygonOffset(disp)) parameters
-static INLINE _glptr_PolygonOffset GET_PolygonOffset(struct _glapi_table *disp) {
- return (_glptr_PolygonOffset) (GET_by_offset(disp, _gloffset_PolygonOffset));
-}
-
-static INLINE void SET_PolygonOffset(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_PolygonOffset, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *);
-#define CALL_TexCoordPointer(disp, parameters) \
- (* GET_TexCoordPointer(disp)) parameters
-static INLINE _glptr_TexCoordPointer GET_TexCoordPointer(struct _glapi_table *disp) {
- return (_glptr_TexCoordPointer) (GET_by_offset(disp, _gloffset_TexCoordPointer));
-}
-
-static INLINE void SET_TexCoordPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_TexCoordPointer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *);
-#define CALL_VertexPointer(disp, parameters) \
- (* GET_VertexPointer(disp)) parameters
-static INLINE _glptr_VertexPointer GET_VertexPointer(struct _glapi_table *disp) {
- return (_glptr_VertexPointer) (GET_by_offset(disp, _gloffset_VertexPointer));
-}
-
-static INLINE void SET_VertexPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_VertexPointer, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_AreTexturesResident)(GLsizei, const GLuint *, GLboolean *);
-#define CALL_AreTexturesResident(disp, parameters) \
- (* GET_AreTexturesResident(disp)) parameters
-static INLINE _glptr_AreTexturesResident GET_AreTexturesResident(struct _glapi_table *disp) {
- return (_glptr_AreTexturesResident) (GET_by_offset(disp, _gloffset_AreTexturesResident));
-}
-
-static INLINE void SET_AreTexturesResident(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLsizei, const GLuint *, GLboolean *)) {
- SET_by_offset(disp, _gloffset_AreTexturesResident, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyTexImage1D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
-#define CALL_CopyTexImage1D(disp, parameters) \
- (* GET_CopyTexImage1D(disp)) parameters
-static INLINE _glptr_CopyTexImage1D GET_CopyTexImage1D(struct _glapi_table *disp) {
- return (_glptr_CopyTexImage1D) (GET_by_offset(disp, _gloffset_CopyTexImage1D));
-}
-
-static INLINE void SET_CopyTexImage1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint)) {
- SET_by_offset(disp, _gloffset_CopyTexImage1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
-#define CALL_CopyTexImage2D(disp, parameters) \
- (* GET_CopyTexImage2D(disp)) parameters
-static INLINE _glptr_CopyTexImage2D GET_CopyTexImage2D(struct _glapi_table *disp) {
- return (_glptr_CopyTexImage2D) (GET_by_offset(disp, _gloffset_CopyTexImage2D));
-}
-
-static INLINE void SET_CopyTexImage2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint)) {
- SET_by_offset(disp, _gloffset_CopyTexImage2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint, GLsizei);
-#define CALL_CopyTexSubImage1D(disp, parameters) \
- (* GET_CopyTexSubImage1D(disp)) parameters
-static INLINE _glptr_CopyTexSubImage1D GET_CopyTexSubImage1D(struct _glapi_table *disp) {
- return (_glptr_CopyTexSubImage1D) (GET_by_offset(disp, _gloffset_CopyTexSubImage1D));
-}
-
-static INLINE void SET_CopyTexSubImage1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLsizei)) {
- SET_by_offset(disp, _gloffset_CopyTexSubImage1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-#define CALL_CopyTexSubImage2D(disp, parameters) \
- (* GET_CopyTexSubImage2D(disp)) parameters
-static INLINE _glptr_CopyTexSubImage2D GET_CopyTexSubImage2D(struct _glapi_table *disp) {
- return (_glptr_CopyTexSubImage2D) (GET_by_offset(disp, _gloffset_CopyTexSubImage2D));
-}
-
-static INLINE void SET_CopyTexSubImage2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_CopyTexSubImage2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteTextures)(GLsizei, const GLuint *);
-#define CALL_DeleteTextures(disp, parameters) \
- (* GET_DeleteTextures(disp)) parameters
-static INLINE _glptr_DeleteTextures GET_DeleteTextures(struct _glapi_table *disp) {
- return (_glptr_DeleteTextures) (GET_by_offset(disp, _gloffset_DeleteTextures));
-}
-
-static INLINE void SET_DeleteTextures(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_DeleteTextures, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenTextures)(GLsizei, GLuint *);
-#define CALL_GenTextures(disp, parameters) \
- (* GET_GenTextures(disp)) parameters
-static INLINE _glptr_GenTextures GET_GenTextures(struct _glapi_table *disp) {
- return (_glptr_GenTextures) (GET_by_offset(disp, _gloffset_GenTextures));
-}
-
-static INLINE void SET_GenTextures(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenTextures, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPointerv)(GLenum, GLvoid **);
-#define CALL_GetPointerv(disp, parameters) \
- (* GET_GetPointerv(disp)) parameters
-static INLINE _glptr_GetPointerv GET_GetPointerv(struct _glapi_table *disp) {
- return (_glptr_GetPointerv) (GET_by_offset(disp, _gloffset_GetPointerv));
-}
-
-static INLINE void SET_GetPointerv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLvoid **)) {
- SET_by_offset(disp, _gloffset_GetPointerv, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsTexture)(GLuint);
-#define CALL_IsTexture(disp, parameters) \
- (* GET_IsTexture(disp)) parameters
-static INLINE _glptr_IsTexture GET_IsTexture(struct _glapi_table *disp) {
- return (_glptr_IsTexture) (GET_by_offset(disp, _gloffset_IsTexture));
-}
-
-static INLINE void SET_IsTexture(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsTexture, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PrioritizeTextures)(GLsizei, const GLuint *, const GLclampf *);
-#define CALL_PrioritizeTextures(disp, parameters) \
- (* GET_PrioritizeTextures(disp)) parameters
-static INLINE _glptr_PrioritizeTextures GET_PrioritizeTextures(struct _glapi_table *disp) {
- return (_glptr_PrioritizeTextures) (GET_by_offset(disp, _gloffset_PrioritizeTextures));
-}
-
-static INLINE void SET_PrioritizeTextures(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *, const GLclampf *)) {
- SET_by_offset(disp, _gloffset_PrioritizeTextures, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
-#define CALL_TexSubImage1D(disp, parameters) \
- (* GET_TexSubImage1D(disp)) parameters
-static INLINE _glptr_TexSubImage1D GET_TexSubImage1D(struct _glapi_table *disp) {
- return (_glptr_TexSubImage1D) (GET_by_offset(disp, _gloffset_TexSubImage1D));
-}
-
-static INLINE void SET_TexSubImage1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_TexSubImage1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-#define CALL_TexSubImage2D(disp, parameters) \
- (* GET_TexSubImage2D(disp)) parameters
-static INLINE _glptr_TexSubImage2D GET_TexSubImage2D(struct _glapi_table *disp) {
- return (_glptr_TexSubImage2D) (GET_by_offset(disp, _gloffset_TexSubImage2D));
-}
-
-static INLINE void SET_TexSubImage2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_TexSubImage2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PopClientAttrib)(void);
-#define CALL_PopClientAttrib(disp, parameters) \
- (* GET_PopClientAttrib(disp)) parameters
-static INLINE _glptr_PopClientAttrib GET_PopClientAttrib(struct _glapi_table *disp) {
- return (_glptr_PopClientAttrib) (GET_by_offset(disp, _gloffset_PopClientAttrib));
-}
-
-static INLINE void SET_PopClientAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_PopClientAttrib, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PushClientAttrib)(GLbitfield);
-#define CALL_PushClientAttrib(disp, parameters) \
- (* GET_PushClientAttrib(disp)) parameters
-static INLINE _glptr_PushClientAttrib GET_PushClientAttrib(struct _glapi_table *disp) {
- return (_glptr_PushClientAttrib) (GET_by_offset(disp, _gloffset_PushClientAttrib));
-}
-
-static INLINE void SET_PushClientAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbitfield)) {
- SET_by_offset(disp, _gloffset_PushClientAttrib, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendColor)(GLclampf, GLclampf, GLclampf, GLclampf);
-#define CALL_BlendColor(disp, parameters) \
- (* GET_BlendColor(disp)) parameters
-static INLINE _glptr_BlendColor GET_BlendColor(struct _glapi_table *disp) {
- return (_glptr_BlendColor) (GET_by_offset(disp, _gloffset_BlendColor));
-}
-
-static INLINE void SET_BlendColor(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLclampf, GLclampf, GLclampf)) {
- SET_by_offset(disp, _gloffset_BlendColor, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendEquation)(GLenum);
-#define CALL_BlendEquation(disp, parameters) \
- (* GET_BlendEquation(disp)) parameters
-static INLINE _glptr_BlendEquation GET_BlendEquation(struct _glapi_table *disp) {
- return (_glptr_BlendEquation) (GET_by_offset(disp, _gloffset_BlendEquation));
-}
-
-static INLINE void SET_BlendEquation(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_BlendEquation, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
-#define CALL_DrawRangeElements(disp, parameters) \
- (* GET_DrawRangeElements(disp)) parameters
-static INLINE _glptr_DrawRangeElements GET_DrawRangeElements(struct _glapi_table *disp) {
- return (_glptr_DrawRangeElements) (GET_by_offset(disp, _gloffset_DrawRangeElements));
-}
-
-static INLINE void SET_DrawRangeElements(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_DrawRangeElements, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorTable)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-#define CALL_ColorTable(disp, parameters) \
- (* GET_ColorTable(disp)) parameters
-static INLINE _glptr_ColorTable GET_ColorTable(struct _glapi_table *disp) {
- return (_glptr_ColorTable) (GET_by_offset(disp, _gloffset_ColorTable));
-}
-
-static INLINE void SET_ColorTable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_ColorTable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorTableParameterfv)(GLenum, GLenum, const GLfloat *);
-#define CALL_ColorTableParameterfv(disp, parameters) \
- (* GET_ColorTableParameterfv(disp)) parameters
-static INLINE _glptr_ColorTableParameterfv GET_ColorTableParameterfv(struct _glapi_table *disp) {
- return (_glptr_ColorTableParameterfv) (GET_by_offset(disp, _gloffset_ColorTableParameterfv));
-}
-
-static INLINE void SET_ColorTableParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_ColorTableParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorTableParameteriv)(GLenum, GLenum, const GLint *);
-#define CALL_ColorTableParameteriv(disp, parameters) \
- (* GET_ColorTableParameteriv(disp)) parameters
-static INLINE _glptr_ColorTableParameteriv GET_ColorTableParameteriv(struct _glapi_table *disp) {
- return (_glptr_ColorTableParameteriv) (GET_by_offset(disp, _gloffset_ColorTableParameteriv));
-}
-
-static INLINE void SET_ColorTableParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_ColorTableParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyColorTable)(GLenum, GLenum, GLint, GLint, GLsizei);
-#define CALL_CopyColorTable(disp, parameters) \
- (* GET_CopyColorTable(disp)) parameters
-static INLINE _glptr_CopyColorTable GET_CopyColorTable(struct _glapi_table *disp) {
- return (_glptr_CopyColorTable) (GET_by_offset(disp, _gloffset_CopyColorTable));
-}
-
-static INLINE void SET_CopyColorTable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint, GLint, GLsizei)) {
- SET_by_offset(disp, _gloffset_CopyColorTable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetColorTable)(GLenum, GLenum, GLenum, GLvoid *);
-#define CALL_GetColorTable(disp, parameters) \
- (* GET_GetColorTable(disp)) parameters
-static INLINE _glptr_GetColorTable GET_GetColorTable(struct _glapi_table *disp) {
- return (_glptr_GetColorTable) (GET_by_offset(disp, _gloffset_GetColorTable));
-}
-
-static INLINE void SET_GetColorTable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetColorTable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetColorTableParameterfv)(GLenum, GLenum, GLfloat *);
-#define CALL_GetColorTableParameterfv(disp, parameters) \
- (* GET_GetColorTableParameterfv(disp)) parameters
-static INLINE _glptr_GetColorTableParameterfv GET_GetColorTableParameterfv(struct _glapi_table *disp) {
- return (_glptr_GetColorTableParameterfv) (GET_by_offset(disp, _gloffset_GetColorTableParameterfv));
-}
-
-static INLINE void SET_GetColorTableParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetColorTableParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetColorTableParameteriv)(GLenum, GLenum, GLint *);
-#define CALL_GetColorTableParameteriv(disp, parameters) \
- (* GET_GetColorTableParameteriv(disp)) parameters
-static INLINE _glptr_GetColorTableParameteriv GET_GetColorTableParameteriv(struct _glapi_table *disp) {
- return (_glptr_GetColorTableParameteriv) (GET_by_offset(disp, _gloffset_GetColorTableParameteriv));
-}
-
-static INLINE void SET_GetColorTableParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetColorTableParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorSubTable)(GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-#define CALL_ColorSubTable(disp, parameters) \
- (* GET_ColorSubTable(disp)) parameters
-static INLINE _glptr_ColorSubTable GET_ColorSubTable(struct _glapi_table *disp) {
- return (_glptr_ColorSubTable) (GET_by_offset(disp, _gloffset_ColorSubTable));
-}
-
-static INLINE void SET_ColorSubTable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_ColorSubTable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyColorSubTable)(GLenum, GLsizei, GLint, GLint, GLsizei);
-#define CALL_CopyColorSubTable(disp, parameters) \
- (* GET_CopyColorSubTable(disp)) parameters
-static INLINE _glptr_CopyColorSubTable GET_CopyColorSubTable(struct _glapi_table *disp) {
- return (_glptr_CopyColorSubTable) (GET_by_offset(disp, _gloffset_CopyColorSubTable));
-}
-
-static INLINE void SET_CopyColorSubTable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLint, GLint, GLsizei)) {
- SET_by_offset(disp, _gloffset_CopyColorSubTable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionFilter1D)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-#define CALL_ConvolutionFilter1D(disp, parameters) \
- (* GET_ConvolutionFilter1D(disp)) parameters
-static INLINE _glptr_ConvolutionFilter1D GET_ConvolutionFilter1D(struct _glapi_table *disp) {
- return (_glptr_ConvolutionFilter1D) (GET_by_offset(disp, _gloffset_ConvolutionFilter1D));
-}
-
-static INLINE void SET_ConvolutionFilter1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_ConvolutionFilter1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionFilter2D)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-#define CALL_ConvolutionFilter2D(disp, parameters) \
- (* GET_ConvolutionFilter2D(disp)) parameters
-static INLINE _glptr_ConvolutionFilter2D GET_ConvolutionFilter2D(struct _glapi_table *disp) {
- return (_glptr_ConvolutionFilter2D) (GET_by_offset(disp, _gloffset_ConvolutionFilter2D));
-}
-
-static INLINE void SET_ConvolutionFilter2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_ConvolutionFilter2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionParameterf)(GLenum, GLenum, GLfloat);
-#define CALL_ConvolutionParameterf(disp, parameters) \
- (* GET_ConvolutionParameterf(disp)) parameters
-static INLINE _glptr_ConvolutionParameterf GET_ConvolutionParameterf(struct _glapi_table *disp) {
- return (_glptr_ConvolutionParameterf) (GET_by_offset(disp, _gloffset_ConvolutionParameterf));
-}
-
-static INLINE void SET_ConvolutionParameterf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_ConvolutionParameterf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionParameterfv)(GLenum, GLenum, const GLfloat *);
-#define CALL_ConvolutionParameterfv(disp, parameters) \
- (* GET_ConvolutionParameterfv(disp)) parameters
-static INLINE _glptr_ConvolutionParameterfv GET_ConvolutionParameterfv(struct _glapi_table *disp) {
- return (_glptr_ConvolutionParameterfv) (GET_by_offset(disp, _gloffset_ConvolutionParameterfv));
-}
-
-static INLINE void SET_ConvolutionParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_ConvolutionParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionParameteri)(GLenum, GLenum, GLint);
-#define CALL_ConvolutionParameteri(disp, parameters) \
- (* GET_ConvolutionParameteri(disp)) parameters
-static INLINE _glptr_ConvolutionParameteri GET_ConvolutionParameteri(struct _glapi_table *disp) {
- return (_glptr_ConvolutionParameteri) (GET_by_offset(disp, _gloffset_ConvolutionParameteri));
-}
-
-static INLINE void SET_ConvolutionParameteri(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_ConvolutionParameteri, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionParameteriv)(GLenum, GLenum, const GLint *);
-#define CALL_ConvolutionParameteriv(disp, parameters) \
- (* GET_ConvolutionParameteriv(disp)) parameters
-static INLINE _glptr_ConvolutionParameteriv GET_ConvolutionParameteriv(struct _glapi_table *disp) {
- return (_glptr_ConvolutionParameteriv) (GET_by_offset(disp, _gloffset_ConvolutionParameteriv));
-}
-
-static INLINE void SET_ConvolutionParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_ConvolutionParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyConvolutionFilter1D)(GLenum, GLenum, GLint, GLint, GLsizei);
-#define CALL_CopyConvolutionFilter1D(disp, parameters) \
- (* GET_CopyConvolutionFilter1D(disp)) parameters
-static INLINE _glptr_CopyConvolutionFilter1D GET_CopyConvolutionFilter1D(struct _glapi_table *disp) {
- return (_glptr_CopyConvolutionFilter1D) (GET_by_offset(disp, _gloffset_CopyConvolutionFilter1D));
-}
-
-static INLINE void SET_CopyConvolutionFilter1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint, GLint, GLsizei)) {
- SET_by_offset(disp, _gloffset_CopyConvolutionFilter1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyConvolutionFilter2D)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei);
-#define CALL_CopyConvolutionFilter2D(disp, parameters) \
- (* GET_CopyConvolutionFilter2D(disp)) parameters
-static INLINE _glptr_CopyConvolutionFilter2D GET_CopyConvolutionFilter2D(struct _glapi_table *disp) {
- return (_glptr_CopyConvolutionFilter2D) (GET_by_offset(disp, _gloffset_CopyConvolutionFilter2D));
-}
-
-static INLINE void SET_CopyConvolutionFilter2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_CopyConvolutionFilter2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetConvolutionFilter)(GLenum, GLenum, GLenum, GLvoid *);
-#define CALL_GetConvolutionFilter(disp, parameters) \
- (* GET_GetConvolutionFilter(disp)) parameters
-static INLINE _glptr_GetConvolutionFilter GET_GetConvolutionFilter(struct _glapi_table *disp) {
- return (_glptr_GetConvolutionFilter) (GET_by_offset(disp, _gloffset_GetConvolutionFilter));
-}
-
-static INLINE void SET_GetConvolutionFilter(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetConvolutionFilter, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetConvolutionParameterfv)(GLenum, GLenum, GLfloat *);
-#define CALL_GetConvolutionParameterfv(disp, parameters) \
- (* GET_GetConvolutionParameterfv(disp)) parameters
-static INLINE _glptr_GetConvolutionParameterfv GET_GetConvolutionParameterfv(struct _glapi_table *disp) {
- return (_glptr_GetConvolutionParameterfv) (GET_by_offset(disp, _gloffset_GetConvolutionParameterfv));
-}
-
-static INLINE void SET_GetConvolutionParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetConvolutionParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetConvolutionParameteriv)(GLenum, GLenum, GLint *);
-#define CALL_GetConvolutionParameteriv(disp, parameters) \
- (* GET_GetConvolutionParameteriv(disp)) parameters
-static INLINE _glptr_GetConvolutionParameteriv GET_GetConvolutionParameteriv(struct _glapi_table *disp) {
- return (_glptr_GetConvolutionParameteriv) (GET_by_offset(disp, _gloffset_GetConvolutionParameteriv));
-}
-
-static INLINE void SET_GetConvolutionParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetConvolutionParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSeparableFilter)(GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *);
-#define CALL_GetSeparableFilter(disp, parameters) \
- (* GET_GetSeparableFilter(disp)) parameters
-static INLINE _glptr_GetSeparableFilter GET_GetSeparableFilter(struct _glapi_table *disp) {
- return (_glptr_GetSeparableFilter) (GET_by_offset(disp, _gloffset_GetSeparableFilter));
-}
-
-static INLINE void SET_GetSeparableFilter(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetSeparableFilter, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SeparableFilter2D)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *);
-#define CALL_SeparableFilter2D(disp, parameters) \
- (* GET_SeparableFilter2D(disp)) parameters
-static INLINE _glptr_SeparableFilter2D GET_SeparableFilter2D(struct _glapi_table *disp) {
- return (_glptr_SeparableFilter2D) (GET_by_offset(disp, _gloffset_SeparableFilter2D));
-}
-
-static INLINE void SET_SeparableFilter2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_SeparableFilter2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetHistogram)(GLenum, GLboolean, GLenum, GLenum, GLvoid *);
-#define CALL_GetHistogram(disp, parameters) \
- (* GET_GetHistogram(disp)) parameters
-static INLINE _glptr_GetHistogram GET_GetHistogram(struct _glapi_table *disp) {
- return (_glptr_GetHistogram) (GET_by_offset(disp, _gloffset_GetHistogram));
-}
-
-static INLINE void SET_GetHistogram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLboolean, GLenum, GLenum, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetHistogram, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetHistogramParameterfv)(GLenum, GLenum, GLfloat *);
-#define CALL_GetHistogramParameterfv(disp, parameters) \
- (* GET_GetHistogramParameterfv(disp)) parameters
-static INLINE _glptr_GetHistogramParameterfv GET_GetHistogramParameterfv(struct _glapi_table *disp) {
- return (_glptr_GetHistogramParameterfv) (GET_by_offset(disp, _gloffset_GetHistogramParameterfv));
-}
-
-static INLINE void SET_GetHistogramParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetHistogramParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetHistogramParameteriv)(GLenum, GLenum, GLint *);
-#define CALL_GetHistogramParameteriv(disp, parameters) \
- (* GET_GetHistogramParameteriv(disp)) parameters
-static INLINE _glptr_GetHistogramParameteriv GET_GetHistogramParameteriv(struct _glapi_table *disp) {
- return (_glptr_GetHistogramParameteriv) (GET_by_offset(disp, _gloffset_GetHistogramParameteriv));
-}
-
-static INLINE void SET_GetHistogramParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetHistogramParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMinmax)(GLenum, GLboolean, GLenum, GLenum, GLvoid *);
-#define CALL_GetMinmax(disp, parameters) \
- (* GET_GetMinmax(disp)) parameters
-static INLINE _glptr_GetMinmax GET_GetMinmax(struct _glapi_table *disp) {
- return (_glptr_GetMinmax) (GET_by_offset(disp, _gloffset_GetMinmax));
-}
-
-static INLINE void SET_GetMinmax(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLboolean, GLenum, GLenum, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetMinmax, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMinmaxParameterfv)(GLenum, GLenum, GLfloat *);
-#define CALL_GetMinmaxParameterfv(disp, parameters) \
- (* GET_GetMinmaxParameterfv(disp)) parameters
-static INLINE _glptr_GetMinmaxParameterfv GET_GetMinmaxParameterfv(struct _glapi_table *disp) {
- return (_glptr_GetMinmaxParameterfv) (GET_by_offset(disp, _gloffset_GetMinmaxParameterfv));
-}
-
-static INLINE void SET_GetMinmaxParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetMinmaxParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMinmaxParameteriv)(GLenum, GLenum, GLint *);
-#define CALL_GetMinmaxParameteriv(disp, parameters) \
- (* GET_GetMinmaxParameteriv(disp)) parameters
-static INLINE _glptr_GetMinmaxParameteriv GET_GetMinmaxParameteriv(struct _glapi_table *disp) {
- return (_glptr_GetMinmaxParameteriv) (GET_by_offset(disp, _gloffset_GetMinmaxParameteriv));
-}
-
-static INLINE void SET_GetMinmaxParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetMinmaxParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Histogram)(GLenum, GLsizei, GLenum, GLboolean);
-#define CALL_Histogram(disp, parameters) \
- (* GET_Histogram(disp)) parameters
-static INLINE _glptr_Histogram GET_Histogram(struct _glapi_table *disp) {
- return (_glptr_Histogram) (GET_by_offset(disp, _gloffset_Histogram));
-}
-
-static INLINE void SET_Histogram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, GLboolean)) {
- SET_by_offset(disp, _gloffset_Histogram, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Minmax)(GLenum, GLenum, GLboolean);
-#define CALL_Minmax(disp, parameters) \
- (* GET_Minmax(disp)) parameters
-static INLINE _glptr_Minmax GET_Minmax(struct _glapi_table *disp) {
- return (_glptr_Minmax) (GET_by_offset(disp, _gloffset_Minmax));
-}
-
-static INLINE void SET_Minmax(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLboolean)) {
- SET_by_offset(disp, _gloffset_Minmax, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ResetHistogram)(GLenum);
-#define CALL_ResetHistogram(disp, parameters) \
- (* GET_ResetHistogram(disp)) parameters
-static INLINE _glptr_ResetHistogram GET_ResetHistogram(struct _glapi_table *disp) {
- return (_glptr_ResetHistogram) (GET_by_offset(disp, _gloffset_ResetHistogram));
-}
-
-static INLINE void SET_ResetHistogram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_ResetHistogram, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ResetMinmax)(GLenum);
-#define CALL_ResetMinmax(disp, parameters) \
- (* GET_ResetMinmax(disp)) parameters
-static INLINE _glptr_ResetMinmax GET_ResetMinmax(struct _glapi_table *disp) {
- return (_glptr_ResetMinmax) (GET_by_offset(disp, _gloffset_ResetMinmax));
-}
-
-static INLINE void SET_ResetMinmax(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_ResetMinmax, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-#define CALL_TexImage3D(disp, parameters) \
- (* GET_TexImage3D(disp)) parameters
-static INLINE _glptr_TexImage3D GET_TexImage3D(struct _glapi_table *disp) {
- return (_glptr_TexImage3D) (GET_by_offset(disp, _gloffset_TexImage3D));
-}
-
-static INLINE void SET_TexImage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_TexImage3D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-#define CALL_TexSubImage3D(disp, parameters) \
- (* GET_TexSubImage3D(disp)) parameters
-static INLINE _glptr_TexSubImage3D GET_TexSubImage3D(struct _glapi_table *disp) {
- return (_glptr_TexSubImage3D) (GET_by_offset(disp, _gloffset_TexSubImage3D));
-}
-
-static INLINE void SET_TexSubImage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_TexSubImage3D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-#define CALL_CopyTexSubImage3D(disp, parameters) \
- (* GET_CopyTexSubImage3D(disp)) parameters
-static INLINE _glptr_CopyTexSubImage3D GET_CopyTexSubImage3D(struct _glapi_table *disp) {
- return (_glptr_CopyTexSubImage3D) (GET_by_offset(disp, _gloffset_CopyTexSubImage3D));
-}
-
-static INLINE void SET_CopyTexSubImage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_CopyTexSubImage3D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ActiveTextureARB)(GLenum);
-#define CALL_ActiveTextureARB(disp, parameters) \
- (* GET_ActiveTextureARB(disp)) parameters
-static INLINE _glptr_ActiveTextureARB GET_ActiveTextureARB(struct _glapi_table *disp) {
- return (_glptr_ActiveTextureARB) (GET_by_offset(disp, _gloffset_ActiveTextureARB));
-}
-
-static INLINE void SET_ActiveTextureARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_ActiveTextureARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClientActiveTextureARB)(GLenum);
-#define CALL_ClientActiveTextureARB(disp, parameters) \
- (* GET_ClientActiveTextureARB(disp)) parameters
-static INLINE _glptr_ClientActiveTextureARB GET_ClientActiveTextureARB(struct _glapi_table *disp) {
- return (_glptr_ClientActiveTextureARB) (GET_by_offset(disp, _gloffset_ClientActiveTextureARB));
-}
-
-static INLINE void SET_ClientActiveTextureARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_ClientActiveTextureARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1dARB)(GLenum, GLdouble);
-#define CALL_MultiTexCoord1dARB(disp, parameters) \
- (* GET_MultiTexCoord1dARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord1dARB GET_MultiTexCoord1dARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord1dARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1dARB));
-}
-
-static INLINE void SET_MultiTexCoord1dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord1dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1dvARB)(GLenum, const GLdouble *);
-#define CALL_MultiTexCoord1dvARB(disp, parameters) \
- (* GET_MultiTexCoord1dvARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord1dvARB GET_MultiTexCoord1dvARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord1dvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1dvARB));
-}
-
-static INLINE void SET_MultiTexCoord1dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord1dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1fARB)(GLenum, GLfloat);
-#define CALL_MultiTexCoord1fARB(disp, parameters) \
- (* GET_MultiTexCoord1fARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord1fARB GET_MultiTexCoord1fARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord1fARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1fARB));
-}
-
-static INLINE void SET_MultiTexCoord1fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord1fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1fvARB)(GLenum, const GLfloat *);
-#define CALL_MultiTexCoord1fvARB(disp, parameters) \
- (* GET_MultiTexCoord1fvARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord1fvARB GET_MultiTexCoord1fvARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord1fvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1fvARB));
-}
-
-static INLINE void SET_MultiTexCoord1fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord1fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1iARB)(GLenum, GLint);
-#define CALL_MultiTexCoord1iARB(disp, parameters) \
- (* GET_MultiTexCoord1iARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord1iARB GET_MultiTexCoord1iARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord1iARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1iARB));
-}
-
-static INLINE void SET_MultiTexCoord1iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord1iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1ivARB)(GLenum, const GLint *);
-#define CALL_MultiTexCoord1ivARB(disp, parameters) \
- (* GET_MultiTexCoord1ivARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord1ivARB GET_MultiTexCoord1ivARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord1ivARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1ivARB));
-}
-
-static INLINE void SET_MultiTexCoord1ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord1ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1sARB)(GLenum, GLshort);
-#define CALL_MultiTexCoord1sARB(disp, parameters) \
- (* GET_MultiTexCoord1sARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord1sARB GET_MultiTexCoord1sARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord1sARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1sARB));
-}
-
-static INLINE void SET_MultiTexCoord1sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLshort)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord1sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1svARB)(GLenum, const GLshort *);
-#define CALL_MultiTexCoord1svARB(disp, parameters) \
- (* GET_MultiTexCoord1svARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord1svARB GET_MultiTexCoord1svARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord1svARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1svARB));
-}
-
-static INLINE void SET_MultiTexCoord1svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLshort *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord1svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2dARB)(GLenum, GLdouble, GLdouble);
-#define CALL_MultiTexCoord2dARB(disp, parameters) \
- (* GET_MultiTexCoord2dARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord2dARB GET_MultiTexCoord2dARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord2dARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2dARB));
-}
-
-static INLINE void SET_MultiTexCoord2dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord2dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2dvARB)(GLenum, const GLdouble *);
-#define CALL_MultiTexCoord2dvARB(disp, parameters) \
- (* GET_MultiTexCoord2dvARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord2dvARB GET_MultiTexCoord2dvARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord2dvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2dvARB));
-}
-
-static INLINE void SET_MultiTexCoord2dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord2dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2fARB)(GLenum, GLfloat, GLfloat);
-#define CALL_MultiTexCoord2fARB(disp, parameters) \
- (* GET_MultiTexCoord2fARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord2fARB GET_MultiTexCoord2fARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord2fARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2fARB));
-}
-
-static INLINE void SET_MultiTexCoord2fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord2fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2fvARB)(GLenum, const GLfloat *);
-#define CALL_MultiTexCoord2fvARB(disp, parameters) \
- (* GET_MultiTexCoord2fvARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord2fvARB GET_MultiTexCoord2fvARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord2fvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2fvARB));
-}
-
-static INLINE void SET_MultiTexCoord2fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord2fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2iARB)(GLenum, GLint, GLint);
-#define CALL_MultiTexCoord2iARB(disp, parameters) \
- (* GET_MultiTexCoord2iARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord2iARB GET_MultiTexCoord2iARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord2iARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2iARB));
-}
-
-static INLINE void SET_MultiTexCoord2iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord2iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2ivARB)(GLenum, const GLint *);
-#define CALL_MultiTexCoord2ivARB(disp, parameters) \
- (* GET_MultiTexCoord2ivARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord2ivARB GET_MultiTexCoord2ivARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord2ivARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2ivARB));
-}
-
-static INLINE void SET_MultiTexCoord2ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord2ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2sARB)(GLenum, GLshort, GLshort);
-#define CALL_MultiTexCoord2sARB(disp, parameters) \
- (* GET_MultiTexCoord2sARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord2sARB GET_MultiTexCoord2sARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord2sARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2sARB));
-}
-
-static INLINE void SET_MultiTexCoord2sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord2sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2svARB)(GLenum, const GLshort *);
-#define CALL_MultiTexCoord2svARB(disp, parameters) \
- (* GET_MultiTexCoord2svARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord2svARB GET_MultiTexCoord2svARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord2svARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2svARB));
-}
-
-static INLINE void SET_MultiTexCoord2svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLshort *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord2svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3dARB)(GLenum, GLdouble, GLdouble, GLdouble);
-#define CALL_MultiTexCoord3dARB(disp, parameters) \
- (* GET_MultiTexCoord3dARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord3dARB GET_MultiTexCoord3dARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord3dARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3dARB));
-}
-
-static INLINE void SET_MultiTexCoord3dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord3dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3dvARB)(GLenum, const GLdouble *);
-#define CALL_MultiTexCoord3dvARB(disp, parameters) \
- (* GET_MultiTexCoord3dvARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord3dvARB GET_MultiTexCoord3dvARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord3dvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3dvARB));
-}
-
-static INLINE void SET_MultiTexCoord3dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord3dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3fARB)(GLenum, GLfloat, GLfloat, GLfloat);
-#define CALL_MultiTexCoord3fARB(disp, parameters) \
- (* GET_MultiTexCoord3fARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord3fARB GET_MultiTexCoord3fARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord3fARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3fARB));
-}
-
-static INLINE void SET_MultiTexCoord3fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord3fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3fvARB)(GLenum, const GLfloat *);
-#define CALL_MultiTexCoord3fvARB(disp, parameters) \
- (* GET_MultiTexCoord3fvARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord3fvARB GET_MultiTexCoord3fvARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord3fvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3fvARB));
-}
-
-static INLINE void SET_MultiTexCoord3fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord3fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3iARB)(GLenum, GLint, GLint, GLint);
-#define CALL_MultiTexCoord3iARB(disp, parameters) \
- (* GET_MultiTexCoord3iARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord3iARB GET_MultiTexCoord3iARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord3iARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3iARB));
-}
-
-static INLINE void SET_MultiTexCoord3iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord3iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3ivARB)(GLenum, const GLint *);
-#define CALL_MultiTexCoord3ivARB(disp, parameters) \
- (* GET_MultiTexCoord3ivARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord3ivARB GET_MultiTexCoord3ivARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord3ivARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3ivARB));
-}
-
-static INLINE void SET_MultiTexCoord3ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord3ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3sARB)(GLenum, GLshort, GLshort, GLshort);
-#define CALL_MultiTexCoord3sARB(disp, parameters) \
- (* GET_MultiTexCoord3sARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord3sARB GET_MultiTexCoord3sARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord3sARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3sARB));
-}
-
-static INLINE void SET_MultiTexCoord3sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord3sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3svARB)(GLenum, const GLshort *);
-#define CALL_MultiTexCoord3svARB(disp, parameters) \
- (* GET_MultiTexCoord3svARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord3svARB GET_MultiTexCoord3svARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord3svARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3svARB));
-}
-
-static INLINE void SET_MultiTexCoord3svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLshort *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord3svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4dARB)(GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_MultiTexCoord4dARB(disp, parameters) \
- (* GET_MultiTexCoord4dARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord4dARB GET_MultiTexCoord4dARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord4dARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4dARB));
-}
-
-static INLINE void SET_MultiTexCoord4dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord4dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4dvARB)(GLenum, const GLdouble *);
-#define CALL_MultiTexCoord4dvARB(disp, parameters) \
- (* GET_MultiTexCoord4dvARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord4dvARB GET_MultiTexCoord4dvARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord4dvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4dvARB));
-}
-
-static INLINE void SET_MultiTexCoord4dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord4dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4fARB)(GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_MultiTexCoord4fARB(disp, parameters) \
- (* GET_MultiTexCoord4fARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord4fARB GET_MultiTexCoord4fARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord4fARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4fARB));
-}
-
-static INLINE void SET_MultiTexCoord4fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord4fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4fvARB)(GLenum, const GLfloat *);
-#define CALL_MultiTexCoord4fvARB(disp, parameters) \
- (* GET_MultiTexCoord4fvARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord4fvARB GET_MultiTexCoord4fvARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord4fvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4fvARB));
-}
-
-static INLINE void SET_MultiTexCoord4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4iARB)(GLenum, GLint, GLint, GLint, GLint);
-#define CALL_MultiTexCoord4iARB(disp, parameters) \
- (* GET_MultiTexCoord4iARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord4iARB GET_MultiTexCoord4iARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord4iARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4iARB));
-}
-
-static INLINE void SET_MultiTexCoord4iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord4iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4ivARB)(GLenum, const GLint *);
-#define CALL_MultiTexCoord4ivARB(disp, parameters) \
- (* GET_MultiTexCoord4ivARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord4ivARB GET_MultiTexCoord4ivARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord4ivARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4ivARB));
-}
-
-static INLINE void SET_MultiTexCoord4ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord4ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4sARB)(GLenum, GLshort, GLshort, GLshort, GLshort);
-#define CALL_MultiTexCoord4sARB(disp, parameters) \
- (* GET_MultiTexCoord4sARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord4sARB GET_MultiTexCoord4sARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord4sARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4sARB));
-}
-
-static INLINE void SET_MultiTexCoord4sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLshort, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord4sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4svARB)(GLenum, const GLshort *);
-#define CALL_MultiTexCoord4svARB(disp, parameters) \
- (* GET_MultiTexCoord4svARB(disp)) parameters
-static INLINE _glptr_MultiTexCoord4svARB GET_MultiTexCoord4svARB(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoord4svARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4svARB));
-}
-
-static INLINE void SET_MultiTexCoord4svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLshort *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoord4svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AttachShader)(GLuint, GLuint);
-#define CALL_AttachShader(disp, parameters) \
- (* GET_AttachShader(disp)) parameters
-static INLINE _glptr_AttachShader GET_AttachShader(struct _glapi_table *disp) {
- return (_glptr_AttachShader) (GET_by_offset(disp, _gloffset_AttachShader));
-}
-
-static INLINE void SET_AttachShader(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_AttachShader, fn);
-}
-
-typedef GLuint (GLAPIENTRYP _glptr_CreateProgram)(void);
-#define CALL_CreateProgram(disp, parameters) \
- (* GET_CreateProgram(disp)) parameters
-static INLINE _glptr_CreateProgram GET_CreateProgram(struct _glapi_table *disp) {
- return (_glptr_CreateProgram) (GET_by_offset(disp, _gloffset_CreateProgram));
-}
-
-static INLINE void SET_CreateProgram(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_CreateProgram, fn);
-}
-
-typedef GLuint (GLAPIENTRYP _glptr_CreateShader)(GLenum);
-#define CALL_CreateShader(disp, parameters) \
- (* GET_CreateShader(disp)) parameters
-static INLINE _glptr_CreateShader GET_CreateShader(struct _glapi_table *disp) {
- return (_glptr_CreateShader) (GET_by_offset(disp, _gloffset_CreateShader));
-}
-
-static INLINE void SET_CreateShader(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_CreateShader, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteProgram)(GLuint);
-#define CALL_DeleteProgram(disp, parameters) \
- (* GET_DeleteProgram(disp)) parameters
-static INLINE _glptr_DeleteProgram GET_DeleteProgram(struct _glapi_table *disp) {
- return (_glptr_DeleteProgram) (GET_by_offset(disp, _gloffset_DeleteProgram));
-}
-
-static INLINE void SET_DeleteProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_DeleteProgram, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteShader)(GLuint);
-#define CALL_DeleteShader(disp, parameters) \
- (* GET_DeleteShader(disp)) parameters
-static INLINE _glptr_DeleteShader GET_DeleteShader(struct _glapi_table *disp) {
- return (_glptr_DeleteShader) (GET_by_offset(disp, _gloffset_DeleteShader));
-}
-
-static INLINE void SET_DeleteShader(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_DeleteShader, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DetachShader)(GLuint, GLuint);
-#define CALL_DetachShader(disp, parameters) \
- (* GET_DetachShader(disp)) parameters
-static INLINE _glptr_DetachShader GET_DetachShader(struct _glapi_table *disp) {
- return (_glptr_DetachShader) (GET_by_offset(disp, _gloffset_DetachShader));
-}
-
-static INLINE void SET_DetachShader(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_DetachShader, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetAttachedShaders)(GLuint, GLsizei, GLsizei *, GLuint *);
-#define CALL_GetAttachedShaders(disp, parameters) \
- (* GET_GetAttachedShaders(disp)) parameters
-static INLINE _glptr_GetAttachedShaders GET_GetAttachedShaders(struct _glapi_table *disp) {
- return (_glptr_GetAttachedShaders) (GET_by_offset(disp, _gloffset_GetAttachedShaders));
-}
-
-static INLINE void SET_GetAttachedShaders(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, GLsizei *, GLuint *)) {
- SET_by_offset(disp, _gloffset_GetAttachedShaders, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
-#define CALL_GetProgramInfoLog(disp, parameters) \
- (* GET_GetProgramInfoLog(disp)) parameters
-static INLINE _glptr_GetProgramInfoLog GET_GetProgramInfoLog(struct _glapi_table *disp) {
- return (_glptr_GetProgramInfoLog) (GET_by_offset(disp, _gloffset_GetProgramInfoLog));
-}
-
-static INLINE void SET_GetProgramInfoLog(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, GLsizei *, GLchar *)) {
- SET_by_offset(disp, _gloffset_GetProgramInfoLog, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramiv)(GLuint, GLenum, GLint *);
-#define CALL_GetProgramiv(disp, parameters) \
- (* GET_GetProgramiv(disp)) parameters
-static INLINE _glptr_GetProgramiv GET_GetProgramiv(struct _glapi_table *disp) {
- return (_glptr_GetProgramiv) (GET_by_offset(disp, _gloffset_GetProgramiv));
-}
-
-static INLINE void SET_GetProgramiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetProgramiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
-#define CALL_GetShaderInfoLog(disp, parameters) \
- (* GET_GetShaderInfoLog(disp)) parameters
-static INLINE _glptr_GetShaderInfoLog GET_GetShaderInfoLog(struct _glapi_table *disp) {
- return (_glptr_GetShaderInfoLog) (GET_by_offset(disp, _gloffset_GetShaderInfoLog));
-}
-
-static INLINE void SET_GetShaderInfoLog(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, GLsizei *, GLchar *)) {
- SET_by_offset(disp, _gloffset_GetShaderInfoLog, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetShaderiv)(GLuint, GLenum, GLint *);
-#define CALL_GetShaderiv(disp, parameters) \
- (* GET_GetShaderiv(disp)) parameters
-static INLINE _glptr_GetShaderiv GET_GetShaderiv(struct _glapi_table *disp) {
- return (_glptr_GetShaderiv) (GET_by_offset(disp, _gloffset_GetShaderiv));
-}
-
-static INLINE void SET_GetShaderiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetShaderiv, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsProgram)(GLuint);
-#define CALL_IsProgram(disp, parameters) \
- (* GET_IsProgram(disp)) parameters
-static INLINE _glptr_IsProgram GET_IsProgram(struct _glapi_table *disp) {
- return (_glptr_IsProgram) (GET_by_offset(disp, _gloffset_IsProgram));
-}
-
-static INLINE void SET_IsProgram(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsProgram, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsShader)(GLuint);
-#define CALL_IsShader(disp, parameters) \
- (* GET_IsShader(disp)) parameters
-static INLINE _glptr_IsShader GET_IsShader(struct _glapi_table *disp) {
- return (_glptr_IsShader) (GET_by_offset(disp, _gloffset_IsShader));
-}
-
-static INLINE void SET_IsShader(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsShader, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilFuncSeparate)(GLenum, GLenum, GLint, GLuint);
-#define CALL_StencilFuncSeparate(disp, parameters) \
- (* GET_StencilFuncSeparate(disp)) parameters
-static INLINE _glptr_StencilFuncSeparate GET_StencilFuncSeparate(struct _glapi_table *disp) {
- return (_glptr_StencilFuncSeparate) (GET_by_offset(disp, _gloffset_StencilFuncSeparate));
-}
-
-static INLINE void SET_StencilFuncSeparate(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint, GLuint)) {
- SET_by_offset(disp, _gloffset_StencilFuncSeparate, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilMaskSeparate)(GLenum, GLuint);
-#define CALL_StencilMaskSeparate(disp, parameters) \
- (* GET_StencilMaskSeparate(disp)) parameters
-static INLINE _glptr_StencilMaskSeparate GET_StencilMaskSeparate(struct _glapi_table *disp) {
- return (_glptr_StencilMaskSeparate) (GET_by_offset(disp, _gloffset_StencilMaskSeparate));
-}
-
-static INLINE void SET_StencilMaskSeparate(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_StencilMaskSeparate, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilOpSeparate)(GLenum, GLenum, GLenum, GLenum);
-#define CALL_StencilOpSeparate(disp, parameters) \
- (* GET_StencilOpSeparate(disp)) parameters
-static INLINE _glptr_StencilOpSeparate GET_StencilOpSeparate(struct _glapi_table *disp) {
- return (_glptr_StencilOpSeparate) (GET_by_offset(disp, _gloffset_StencilOpSeparate));
-}
-
-static INLINE void SET_StencilOpSeparate(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_StencilOpSeparate, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix2x3fv)(GLint, GLsizei, GLboolean, const GLfloat *);
-#define CALL_UniformMatrix2x3fv(disp, parameters) \
- (* GET_UniformMatrix2x3fv(disp)) parameters
-static INLINE _glptr_UniformMatrix2x3fv GET_UniformMatrix2x3fv(struct _glapi_table *disp) {
- return (_glptr_UniformMatrix2x3fv) (GET_by_offset(disp, _gloffset_UniformMatrix2x3fv));
-}
-
-static INLINE void SET_UniformMatrix2x3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_UniformMatrix2x3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix2x4fv)(GLint, GLsizei, GLboolean, const GLfloat *);
-#define CALL_UniformMatrix2x4fv(disp, parameters) \
- (* GET_UniformMatrix2x4fv(disp)) parameters
-static INLINE _glptr_UniformMatrix2x4fv GET_UniformMatrix2x4fv(struct _glapi_table *disp) {
- return (_glptr_UniformMatrix2x4fv) (GET_by_offset(disp, _gloffset_UniformMatrix2x4fv));
-}
-
-static INLINE void SET_UniformMatrix2x4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_UniformMatrix2x4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix3x2fv)(GLint, GLsizei, GLboolean, const GLfloat *);
-#define CALL_UniformMatrix3x2fv(disp, parameters) \
- (* GET_UniformMatrix3x2fv(disp)) parameters
-static INLINE _glptr_UniformMatrix3x2fv GET_UniformMatrix3x2fv(struct _glapi_table *disp) {
- return (_glptr_UniformMatrix3x2fv) (GET_by_offset(disp, _gloffset_UniformMatrix3x2fv));
-}
-
-static INLINE void SET_UniformMatrix3x2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_UniformMatrix3x2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix3x4fv)(GLint, GLsizei, GLboolean, const GLfloat *);
-#define CALL_UniformMatrix3x4fv(disp, parameters) \
- (* GET_UniformMatrix3x4fv(disp)) parameters
-static INLINE _glptr_UniformMatrix3x4fv GET_UniformMatrix3x4fv(struct _glapi_table *disp) {
- return (_glptr_UniformMatrix3x4fv) (GET_by_offset(disp, _gloffset_UniformMatrix3x4fv));
-}
-
-static INLINE void SET_UniformMatrix3x4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_UniformMatrix3x4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix4x2fv)(GLint, GLsizei, GLboolean, const GLfloat *);
-#define CALL_UniformMatrix4x2fv(disp, parameters) \
- (* GET_UniformMatrix4x2fv(disp)) parameters
-static INLINE _glptr_UniformMatrix4x2fv GET_UniformMatrix4x2fv(struct _glapi_table *disp) {
- return (_glptr_UniformMatrix4x2fv) (GET_by_offset(disp, _gloffset_UniformMatrix4x2fv));
-}
-
-static INLINE void SET_UniformMatrix4x2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_UniformMatrix4x2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix4x3fv)(GLint, GLsizei, GLboolean, const GLfloat *);
-#define CALL_UniformMatrix4x3fv(disp, parameters) \
- (* GET_UniformMatrix4x3fv(disp)) parameters
-static INLINE _glptr_UniformMatrix4x3fv GET_UniformMatrix4x3fv(struct _glapi_table *disp) {
- return (_glptr_UniformMatrix4x3fv) (GET_by_offset(disp, _gloffset_UniformMatrix4x3fv));
-}
-
-static INLINE void SET_UniformMatrix4x3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_UniformMatrix4x3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClampColor)(GLenum, GLenum);
-#define CALL_ClampColor(disp, parameters) \
- (* GET_ClampColor(disp)) parameters
-static INLINE _glptr_ClampColor GET_ClampColor(struct _glapi_table *disp) {
- return (_glptr_ClampColor) (GET_by_offset(disp, _gloffset_ClampColor));
-}
-
-static INLINE void SET_ClampColor(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_ClampColor, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearBufferfi)(GLenum, GLint, GLfloat, GLint);
-#define CALL_ClearBufferfi(disp, parameters) \
- (* GET_ClearBufferfi(disp)) parameters
-static INLINE _glptr_ClearBufferfi GET_ClearBufferfi(struct _glapi_table *disp) {
- return (_glptr_ClearBufferfi) (GET_by_offset(disp, _gloffset_ClearBufferfi));
-}
-
-static INLINE void SET_ClearBufferfi(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLfloat, GLint)) {
- SET_by_offset(disp, _gloffset_ClearBufferfi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearBufferfv)(GLenum, GLint, const GLfloat *);
-#define CALL_ClearBufferfv(disp, parameters) \
- (* GET_ClearBufferfv(disp)) parameters
-static INLINE _glptr_ClearBufferfv GET_ClearBufferfv(struct _glapi_table *disp) {
- return (_glptr_ClearBufferfv) (GET_by_offset(disp, _gloffset_ClearBufferfv));
-}
-
-static INLINE void SET_ClearBufferfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_ClearBufferfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearBufferiv)(GLenum, GLint, const GLint *);
-#define CALL_ClearBufferiv(disp, parameters) \
- (* GET_ClearBufferiv(disp)) parameters
-static INLINE _glptr_ClearBufferiv GET_ClearBufferiv(struct _glapi_table *disp) {
- return (_glptr_ClearBufferiv) (GET_by_offset(disp, _gloffset_ClearBufferiv));
-}
-
-static INLINE void SET_ClearBufferiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, const GLint *)) {
- SET_by_offset(disp, _gloffset_ClearBufferiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearBufferuiv)(GLenum, GLint, const GLuint *);
-#define CALL_ClearBufferuiv(disp, parameters) \
- (* GET_ClearBufferuiv(disp)) parameters
-static INLINE _glptr_ClearBufferuiv GET_ClearBufferuiv(struct _glapi_table *disp) {
- return (_glptr_ClearBufferuiv) (GET_by_offset(disp, _gloffset_ClearBufferuiv));
-}
-
-static INLINE void SET_ClearBufferuiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, const GLuint *)) {
- SET_by_offset(disp, _gloffset_ClearBufferuiv, fn);
-}
-
-typedef const GLubyte * (GLAPIENTRYP _glptr_GetStringi)(GLenum, GLuint);
-#define CALL_GetStringi(disp, parameters) \
- (* GET_GetStringi(disp)) parameters
-static INLINE _glptr_GetStringi GET_GetStringi(struct _glapi_table *disp) {
- return (_glptr_GetStringi) (GET_by_offset(disp, _gloffset_GetStringi));
-}
-
-static INLINE void SET_GetStringi(struct _glapi_table *disp, const GLubyte * (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_GetStringi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexBuffer)(GLenum, GLenum, GLuint);
-#define CALL_TexBuffer(disp, parameters) \
- (* GET_TexBuffer(disp)) parameters
-static INLINE _glptr_TexBuffer GET_TexBuffer(struct _glapi_table *disp) {
- return (_glptr_TexBuffer) (GET_by_offset(disp, _gloffset_TexBuffer));
-}
-
-static INLINE void SET_TexBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_TexBuffer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTexture)(GLenum, GLenum, GLuint, GLint);
-#define CALL_FramebufferTexture(disp, parameters) \
- (* GET_FramebufferTexture(disp)) parameters
-static INLINE _glptr_FramebufferTexture GET_FramebufferTexture(struct _glapi_table *disp) {
- return (_glptr_FramebufferTexture) (GET_by_offset(disp, _gloffset_FramebufferTexture));
-}
-
-static INLINE void SET_FramebufferTexture(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint, GLint)) {
- SET_by_offset(disp, _gloffset_FramebufferTexture, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBufferParameteri64v)(GLenum, GLenum, GLint64 *);
-#define CALL_GetBufferParameteri64v(disp, parameters) \
- (* GET_GetBufferParameteri64v(disp)) parameters
-static INLINE _glptr_GetBufferParameteri64v GET_GetBufferParameteri64v(struct _glapi_table *disp) {
- return (_glptr_GetBufferParameteri64v) (GET_by_offset(disp, _gloffset_GetBufferParameteri64v));
-}
-
-static INLINE void SET_GetBufferParameteri64v(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint64 *)) {
- SET_by_offset(disp, _gloffset_GetBufferParameteri64v, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetInteger64i_v)(GLenum, GLuint, GLint64 *);
-#define CALL_GetInteger64i_v(disp, parameters) \
- (* GET_GetInteger64i_v(disp)) parameters
-static INLINE _glptr_GetInteger64i_v GET_GetInteger64i_v(struct _glapi_table *disp) {
- return (_glptr_GetInteger64i_v) (GET_by_offset(disp, _gloffset_GetInteger64i_v));
-}
-
-static INLINE void SET_GetInteger64i_v(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLint64 *)) {
- SET_by_offset(disp, _gloffset_GetInteger64i_v, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribDivisor)(GLuint, GLuint);
-#define CALL_VertexAttribDivisor(disp, parameters) \
- (* GET_VertexAttribDivisor(disp)) parameters
-static INLINE _glptr_VertexAttribDivisor GET_VertexAttribDivisor(struct _glapi_table *disp) {
- return (_glptr_VertexAttribDivisor) (GET_by_offset(disp, _gloffset_VertexAttribDivisor));
-}
-
-static INLINE void SET_VertexAttribDivisor(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexAttribDivisor, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadTransposeMatrixdARB)(const GLdouble *);
-#define CALL_LoadTransposeMatrixdARB(disp, parameters) \
- (* GET_LoadTransposeMatrixdARB(disp)) parameters
-static INLINE _glptr_LoadTransposeMatrixdARB GET_LoadTransposeMatrixdARB(struct _glapi_table *disp) {
- return (_glptr_LoadTransposeMatrixdARB) (GET_by_offset(disp, _gloffset_LoadTransposeMatrixdARB));
-}
-
-static INLINE void SET_LoadTransposeMatrixdARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_LoadTransposeMatrixdARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadTransposeMatrixfARB)(const GLfloat *);
-#define CALL_LoadTransposeMatrixfARB(disp, parameters) \
- (* GET_LoadTransposeMatrixfARB(disp)) parameters
-static INLINE _glptr_LoadTransposeMatrixfARB GET_LoadTransposeMatrixfARB(struct _glapi_table *disp) {
- return (_glptr_LoadTransposeMatrixfARB) (GET_by_offset(disp, _gloffset_LoadTransposeMatrixfARB));
-}
-
-static INLINE void SET_LoadTransposeMatrixfARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_LoadTransposeMatrixfARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultTransposeMatrixdARB)(const GLdouble *);
-#define CALL_MultTransposeMatrixdARB(disp, parameters) \
- (* GET_MultTransposeMatrixdARB(disp)) parameters
-static INLINE _glptr_MultTransposeMatrixdARB GET_MultTransposeMatrixdARB(struct _glapi_table *disp) {
- return (_glptr_MultTransposeMatrixdARB) (GET_by_offset(disp, _gloffset_MultTransposeMatrixdARB));
-}
-
-static INLINE void SET_MultTransposeMatrixdARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_MultTransposeMatrixdARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultTransposeMatrixfARB)(const GLfloat *);
-#define CALL_MultTransposeMatrixfARB(disp, parameters) \
- (* GET_MultTransposeMatrixfARB(disp)) parameters
-static INLINE _glptr_MultTransposeMatrixfARB GET_MultTransposeMatrixfARB(struct _glapi_table *disp) {
- return (_glptr_MultTransposeMatrixfARB) (GET_by_offset(disp, _gloffset_MultTransposeMatrixfARB));
-}
-
-static INLINE void SET_MultTransposeMatrixfARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_MultTransposeMatrixfARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SampleCoverageARB)(GLclampf, GLboolean);
-#define CALL_SampleCoverageARB(disp, parameters) \
- (* GET_SampleCoverageARB(disp)) parameters
-static INLINE _glptr_SampleCoverageARB GET_SampleCoverageARB(struct _glapi_table *disp) {
- return (_glptr_SampleCoverageARB) (GET_by_offset(disp, _gloffset_SampleCoverageARB));
-}
-
-static INLINE void SET_SampleCoverageARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLboolean)) {
- SET_by_offset(disp, _gloffset_SampleCoverageARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexImage1DARB)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
-#define CALL_CompressedTexImage1DARB(disp, parameters) \
- (* GET_CompressedTexImage1DARB(disp)) parameters
-static INLINE _glptr_CompressedTexImage1DARB GET_CompressedTexImage1DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexImage1DARB) (GET_by_offset(disp, _gloffset_CompressedTexImage1DARB));
-}
-
-static INLINE void SET_CompressedTexImage1DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexImage1DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-#define CALL_CompressedTexImage2DARB(disp, parameters) \
- (* GET_CompressedTexImage2DARB(disp)) parameters
-static INLINE _glptr_CompressedTexImage2DARB GET_CompressedTexImage2DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexImage2DARB) (GET_by_offset(disp, _gloffset_CompressedTexImage2DARB));
-}
-
-static INLINE void SET_CompressedTexImage2DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexImage2DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexImage3DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-#define CALL_CompressedTexImage3DARB(disp, parameters) \
- (* GET_CompressedTexImage3DARB(disp)) parameters
-static INLINE _glptr_CompressedTexImage3DARB GET_CompressedTexImage3DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexImage3DARB) (GET_by_offset(disp, _gloffset_CompressedTexImage3DARB));
-}
-
-static INLINE void SET_CompressedTexImage3DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexImage3DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage1DARB)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
-#define CALL_CompressedTexSubImage1DARB(disp, parameters) \
- (* GET_CompressedTexSubImage1DARB(disp)) parameters
-static INLINE _glptr_CompressedTexSubImage1DARB GET_CompressedTexSubImage1DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexSubImage1DARB) (GET_by_offset(disp, _gloffset_CompressedTexSubImage1DARB));
-}
-
-static INLINE void SET_CompressedTexSubImage1DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexSubImage1DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage2DARB)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-#define CALL_CompressedTexSubImage2DARB(disp, parameters) \
- (* GET_CompressedTexSubImage2DARB(disp)) parameters
-static INLINE _glptr_CompressedTexSubImage2DARB GET_CompressedTexSubImage2DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexSubImage2DARB) (GET_by_offset(disp, _gloffset_CompressedTexSubImage2DARB));
-}
-
-static INLINE void SET_CompressedTexSubImage2DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexSubImage2DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage3DARB)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-#define CALL_CompressedTexSubImage3DARB(disp, parameters) \
- (* GET_CompressedTexSubImage3DARB(disp)) parameters
-static INLINE _glptr_CompressedTexSubImage3DARB GET_CompressedTexSubImage3DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexSubImage3DARB) (GET_by_offset(disp, _gloffset_CompressedTexSubImage3DARB));
-}
-
-static INLINE void SET_CompressedTexSubImage3DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexSubImage3DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
-#define CALL_GetCompressedTexImageARB(disp, parameters) \
- (* GET_GetCompressedTexImageARB(disp)) parameters
-static INLINE _glptr_GetCompressedTexImageARB GET_GetCompressedTexImageARB(struct _glapi_table *disp) {
- return (_glptr_GetCompressedTexImageARB) (GET_by_offset(disp, _gloffset_GetCompressedTexImageARB));
-}
-
-static INLINE void SET_GetCompressedTexImageARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetCompressedTexImageARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DisableVertexAttribArrayARB)(GLuint);
-#define CALL_DisableVertexAttribArrayARB(disp, parameters) \
- (* GET_DisableVertexAttribArrayARB(disp)) parameters
-static INLINE _glptr_DisableVertexAttribArrayARB GET_DisableVertexAttribArrayARB(struct _glapi_table *disp) {
- return (_glptr_DisableVertexAttribArrayARB) (GET_by_offset(disp, _gloffset_DisableVertexAttribArrayARB));
-}
-
-static INLINE void SET_DisableVertexAttribArrayARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_DisableVertexAttribArrayARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EnableVertexAttribArrayARB)(GLuint);
-#define CALL_EnableVertexAttribArrayARB(disp, parameters) \
- (* GET_EnableVertexAttribArrayARB(disp)) parameters
-static INLINE _glptr_EnableVertexAttribArrayARB GET_EnableVertexAttribArrayARB(struct _glapi_table *disp) {
- return (_glptr_EnableVertexAttribArrayARB) (GET_by_offset(disp, _gloffset_EnableVertexAttribArrayARB));
-}
-
-static INLINE void SET_EnableVertexAttribArrayARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_EnableVertexAttribArrayARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramEnvParameterdvARB)(GLenum, GLuint, GLdouble *);
-#define CALL_GetProgramEnvParameterdvARB(disp, parameters) \
- (* GET_GetProgramEnvParameterdvARB(disp)) parameters
-static INLINE _glptr_GetProgramEnvParameterdvARB GET_GetProgramEnvParameterdvARB(struct _glapi_table *disp) {
- return (_glptr_GetProgramEnvParameterdvARB) (GET_by_offset(disp, _gloffset_GetProgramEnvParameterdvARB));
-}
-
-static INLINE void SET_GetProgramEnvParameterdvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetProgramEnvParameterdvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramEnvParameterfvARB)(GLenum, GLuint, GLfloat *);
-#define CALL_GetProgramEnvParameterfvARB(disp, parameters) \
- (* GET_GetProgramEnvParameterfvARB(disp)) parameters
-static INLINE _glptr_GetProgramEnvParameterfvARB GET_GetProgramEnvParameterfvARB(struct _glapi_table *disp) {
- return (_glptr_GetProgramEnvParameterfvARB) (GET_by_offset(disp, _gloffset_GetProgramEnvParameterfvARB));
-}
-
-static INLINE void SET_GetProgramEnvParameterfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetProgramEnvParameterfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramLocalParameterdvARB)(GLenum, GLuint, GLdouble *);
-#define CALL_GetProgramLocalParameterdvARB(disp, parameters) \
- (* GET_GetProgramLocalParameterdvARB(disp)) parameters
-static INLINE _glptr_GetProgramLocalParameterdvARB GET_GetProgramLocalParameterdvARB(struct _glapi_table *disp) {
- return (_glptr_GetProgramLocalParameterdvARB) (GET_by_offset(disp, _gloffset_GetProgramLocalParameterdvARB));
-}
-
-static INLINE void SET_GetProgramLocalParameterdvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetProgramLocalParameterdvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramLocalParameterfvARB)(GLenum, GLuint, GLfloat *);
-#define CALL_GetProgramLocalParameterfvARB(disp, parameters) \
- (* GET_GetProgramLocalParameterfvARB(disp)) parameters
-static INLINE _glptr_GetProgramLocalParameterfvARB GET_GetProgramLocalParameterfvARB(struct _glapi_table *disp) {
- return (_glptr_GetProgramLocalParameterfvARB) (GET_by_offset(disp, _gloffset_GetProgramLocalParameterfvARB));
-}
-
-static INLINE void SET_GetProgramLocalParameterfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetProgramLocalParameterfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramStringARB)(GLenum, GLenum, GLvoid *);
-#define CALL_GetProgramStringARB(disp, parameters) \
- (* GET_GetProgramStringARB(disp)) parameters
-static INLINE _glptr_GetProgramStringARB GET_GetProgramStringARB(struct _glapi_table *disp) {
- return (_glptr_GetProgramStringARB) (GET_by_offset(disp, _gloffset_GetProgramStringARB));
-}
-
-static INLINE void SET_GetProgramStringARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetProgramStringARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramivARB)(GLenum, GLenum, GLint *);
-#define CALL_GetProgramivARB(disp, parameters) \
- (* GET_GetProgramivARB(disp)) parameters
-static INLINE _glptr_GetProgramivARB GET_GetProgramivARB(struct _glapi_table *disp) {
- return (_glptr_GetProgramivARB) (GET_by_offset(disp, _gloffset_GetProgramivARB));
-}
-
-static INLINE void SET_GetProgramivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetProgramivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribdvARB)(GLuint, GLenum, GLdouble *);
-#define CALL_GetVertexAttribdvARB(disp, parameters) \
- (* GET_GetVertexAttribdvARB(disp)) parameters
-static INLINE _glptr_GetVertexAttribdvARB GET_GetVertexAttribdvARB(struct _glapi_table *disp) {
- return (_glptr_GetVertexAttribdvARB) (GET_by_offset(disp, _gloffset_GetVertexAttribdvARB));
-}
-
-static INLINE void SET_GetVertexAttribdvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetVertexAttribdvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribfvARB)(GLuint, GLenum, GLfloat *);
-#define CALL_GetVertexAttribfvARB(disp, parameters) \
- (* GET_GetVertexAttribfvARB(disp)) parameters
-static INLINE _glptr_GetVertexAttribfvARB GET_GetVertexAttribfvARB(struct _glapi_table *disp) {
- return (_glptr_GetVertexAttribfvARB) (GET_by_offset(disp, _gloffset_GetVertexAttribfvARB));
-}
-
-static INLINE void SET_GetVertexAttribfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetVertexAttribfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribivARB)(GLuint, GLenum, GLint *);
-#define CALL_GetVertexAttribivARB(disp, parameters) \
- (* GET_GetVertexAttribivARB(disp)) parameters
-static INLINE _glptr_GetVertexAttribivARB GET_GetVertexAttribivARB(struct _glapi_table *disp) {
- return (_glptr_GetVertexAttribivARB) (GET_by_offset(disp, _gloffset_GetVertexAttribivARB));
-}
-
-static INLINE void SET_GetVertexAttribivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetVertexAttribivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4dARB)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_ProgramEnvParameter4dARB(disp, parameters) \
- (* GET_ProgramEnvParameter4dARB(disp)) parameters
-static INLINE _glptr_ProgramEnvParameter4dARB GET_ProgramEnvParameter4dARB(struct _glapi_table *disp) {
- return (_glptr_ProgramEnvParameter4dARB) (GET_by_offset(disp, _gloffset_ProgramEnvParameter4dARB));
-}
-
-static INLINE void SET_ProgramEnvParameter4dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_ProgramEnvParameter4dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4dvARB)(GLenum, GLuint, const GLdouble *);
-#define CALL_ProgramEnvParameter4dvARB(disp, parameters) \
- (* GET_ProgramEnvParameter4dvARB(disp)) parameters
-static INLINE _glptr_ProgramEnvParameter4dvARB GET_ProgramEnvParameter4dvARB(struct _glapi_table *disp) {
- return (_glptr_ProgramEnvParameter4dvARB) (GET_by_offset(disp, _gloffset_ProgramEnvParameter4dvARB));
-}
-
-static INLINE void SET_ProgramEnvParameter4dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_ProgramEnvParameter4dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4fARB)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_ProgramEnvParameter4fARB(disp, parameters) \
- (* GET_ProgramEnvParameter4fARB(disp)) parameters
-static INLINE _glptr_ProgramEnvParameter4fARB GET_ProgramEnvParameter4fARB(struct _glapi_table *disp) {
- return (_glptr_ProgramEnvParameter4fARB) (GET_by_offset(disp, _gloffset_ProgramEnvParameter4fARB));
-}
-
-static INLINE void SET_ProgramEnvParameter4fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_ProgramEnvParameter4fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4fvARB)(GLenum, GLuint, const GLfloat *);
-#define CALL_ProgramEnvParameter4fvARB(disp, parameters) \
- (* GET_ProgramEnvParameter4fvARB(disp)) parameters
-static INLINE _glptr_ProgramEnvParameter4fvARB GET_ProgramEnvParameter4fvARB(struct _glapi_table *disp) {
- return (_glptr_ProgramEnvParameter4fvARB) (GET_by_offset(disp, _gloffset_ProgramEnvParameter4fvARB));
-}
-
-static INLINE void SET_ProgramEnvParameter4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_ProgramEnvParameter4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4dARB)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_ProgramLocalParameter4dARB(disp, parameters) \
- (* GET_ProgramLocalParameter4dARB(disp)) parameters
-static INLINE _glptr_ProgramLocalParameter4dARB GET_ProgramLocalParameter4dARB(struct _glapi_table *disp) {
- return (_glptr_ProgramLocalParameter4dARB) (GET_by_offset(disp, _gloffset_ProgramLocalParameter4dARB));
-}
-
-static INLINE void SET_ProgramLocalParameter4dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_ProgramLocalParameter4dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4dvARB)(GLenum, GLuint, const GLdouble *);
-#define CALL_ProgramLocalParameter4dvARB(disp, parameters) \
- (* GET_ProgramLocalParameter4dvARB(disp)) parameters
-static INLINE _glptr_ProgramLocalParameter4dvARB GET_ProgramLocalParameter4dvARB(struct _glapi_table *disp) {
- return (_glptr_ProgramLocalParameter4dvARB) (GET_by_offset(disp, _gloffset_ProgramLocalParameter4dvARB));
-}
-
-static INLINE void SET_ProgramLocalParameter4dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_ProgramLocalParameter4dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4fARB)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_ProgramLocalParameter4fARB(disp, parameters) \
- (* GET_ProgramLocalParameter4fARB(disp)) parameters
-static INLINE _glptr_ProgramLocalParameter4fARB GET_ProgramLocalParameter4fARB(struct _glapi_table *disp) {
- return (_glptr_ProgramLocalParameter4fARB) (GET_by_offset(disp, _gloffset_ProgramLocalParameter4fARB));
-}
-
-static INLINE void SET_ProgramLocalParameter4fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_ProgramLocalParameter4fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4fvARB)(GLenum, GLuint, const GLfloat *);
-#define CALL_ProgramLocalParameter4fvARB(disp, parameters) \
- (* GET_ProgramLocalParameter4fvARB(disp)) parameters
-static INLINE _glptr_ProgramLocalParameter4fvARB GET_ProgramLocalParameter4fvARB(struct _glapi_table *disp) {
- return (_glptr_ProgramLocalParameter4fvARB) (GET_by_offset(disp, _gloffset_ProgramLocalParameter4fvARB));
-}
-
-static INLINE void SET_ProgramLocalParameter4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_ProgramLocalParameter4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramStringARB)(GLenum, GLenum, GLsizei, const GLvoid *);
-#define CALL_ProgramStringARB(disp, parameters) \
- (* GET_ProgramStringARB(disp)) parameters
-static INLINE _glptr_ProgramStringARB GET_ProgramStringARB(struct _glapi_table *disp) {
- return (_glptr_ProgramStringARB) (GET_by_offset(disp, _gloffset_ProgramStringARB));
-}
-
-static INLINE void SET_ProgramStringARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_ProgramStringARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1dARB)(GLuint, GLdouble);
-#define CALL_VertexAttrib1dARB(disp, parameters) \
- (* GET_VertexAttrib1dARB(disp)) parameters
-static INLINE _glptr_VertexAttrib1dARB GET_VertexAttrib1dARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1dARB) (GET_by_offset(disp, _gloffset_VertexAttrib1dARB));
-}
-
-static INLINE void SET_VertexAttrib1dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1dvARB)(GLuint, const GLdouble *);
-#define CALL_VertexAttrib1dvARB(disp, parameters) \
- (* GET_VertexAttrib1dvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib1dvARB GET_VertexAttrib1dvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1dvARB) (GET_by_offset(disp, _gloffset_VertexAttrib1dvARB));
-}
-
-static INLINE void SET_VertexAttrib1dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1fARB)(GLuint, GLfloat);
-#define CALL_VertexAttrib1fARB(disp, parameters) \
- (* GET_VertexAttrib1fARB(disp)) parameters
-static INLINE _glptr_VertexAttrib1fARB GET_VertexAttrib1fARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1fARB) (GET_by_offset(disp, _gloffset_VertexAttrib1fARB));
-}
-
-static INLINE void SET_VertexAttrib1fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1fvARB)(GLuint, const GLfloat *);
-#define CALL_VertexAttrib1fvARB(disp, parameters) \
- (* GET_VertexAttrib1fvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib1fvARB GET_VertexAttrib1fvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1fvARB) (GET_by_offset(disp, _gloffset_VertexAttrib1fvARB));
-}
-
-static INLINE void SET_VertexAttrib1fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1sARB)(GLuint, GLshort);
-#define CALL_VertexAttrib1sARB(disp, parameters) \
- (* GET_VertexAttrib1sARB(disp)) parameters
-static INLINE _glptr_VertexAttrib1sARB GET_VertexAttrib1sARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1sARB) (GET_by_offset(disp, _gloffset_VertexAttrib1sARB));
-}
-
-static INLINE void SET_VertexAttrib1sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1svARB)(GLuint, const GLshort *);
-#define CALL_VertexAttrib1svARB(disp, parameters) \
- (* GET_VertexAttrib1svARB(disp)) parameters
-static INLINE _glptr_VertexAttrib1svARB GET_VertexAttrib1svARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1svARB) (GET_by_offset(disp, _gloffset_VertexAttrib1svARB));
-}
-
-static INLINE void SET_VertexAttrib1svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2dARB)(GLuint, GLdouble, GLdouble);
-#define CALL_VertexAttrib2dARB(disp, parameters) \
- (* GET_VertexAttrib2dARB(disp)) parameters
-static INLINE _glptr_VertexAttrib2dARB GET_VertexAttrib2dARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2dARB) (GET_by_offset(disp, _gloffset_VertexAttrib2dARB));
-}
-
-static INLINE void SET_VertexAttrib2dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2dvARB)(GLuint, const GLdouble *);
-#define CALL_VertexAttrib2dvARB(disp, parameters) \
- (* GET_VertexAttrib2dvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib2dvARB GET_VertexAttrib2dvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2dvARB) (GET_by_offset(disp, _gloffset_VertexAttrib2dvARB));
-}
-
-static INLINE void SET_VertexAttrib2dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2fARB)(GLuint, GLfloat, GLfloat);
-#define CALL_VertexAttrib2fARB(disp, parameters) \
- (* GET_VertexAttrib2fARB(disp)) parameters
-static INLINE _glptr_VertexAttrib2fARB GET_VertexAttrib2fARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2fARB) (GET_by_offset(disp, _gloffset_VertexAttrib2fARB));
-}
-
-static INLINE void SET_VertexAttrib2fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2fvARB)(GLuint, const GLfloat *);
-#define CALL_VertexAttrib2fvARB(disp, parameters) \
- (* GET_VertexAttrib2fvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib2fvARB GET_VertexAttrib2fvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2fvARB) (GET_by_offset(disp, _gloffset_VertexAttrib2fvARB));
-}
-
-static INLINE void SET_VertexAttrib2fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2sARB)(GLuint, GLshort, GLshort);
-#define CALL_VertexAttrib2sARB(disp, parameters) \
- (* GET_VertexAttrib2sARB(disp)) parameters
-static INLINE _glptr_VertexAttrib2sARB GET_VertexAttrib2sARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2sARB) (GET_by_offset(disp, _gloffset_VertexAttrib2sARB));
-}
-
-static INLINE void SET_VertexAttrib2sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2svARB)(GLuint, const GLshort *);
-#define CALL_VertexAttrib2svARB(disp, parameters) \
- (* GET_VertexAttrib2svARB(disp)) parameters
-static INLINE _glptr_VertexAttrib2svARB GET_VertexAttrib2svARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2svARB) (GET_by_offset(disp, _gloffset_VertexAttrib2svARB));
-}
-
-static INLINE void SET_VertexAttrib2svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3dARB)(GLuint, GLdouble, GLdouble, GLdouble);
-#define CALL_VertexAttrib3dARB(disp, parameters) \
- (* GET_VertexAttrib3dARB(disp)) parameters
-static INLINE _glptr_VertexAttrib3dARB GET_VertexAttrib3dARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3dARB) (GET_by_offset(disp, _gloffset_VertexAttrib3dARB));
-}
-
-static INLINE void SET_VertexAttrib3dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3dvARB)(GLuint, const GLdouble *);
-#define CALL_VertexAttrib3dvARB(disp, parameters) \
- (* GET_VertexAttrib3dvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib3dvARB GET_VertexAttrib3dvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3dvARB) (GET_by_offset(disp, _gloffset_VertexAttrib3dvARB));
-}
-
-static INLINE void SET_VertexAttrib3dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3fARB)(GLuint, GLfloat, GLfloat, GLfloat);
-#define CALL_VertexAttrib3fARB(disp, parameters) \
- (* GET_VertexAttrib3fARB(disp)) parameters
-static INLINE _glptr_VertexAttrib3fARB GET_VertexAttrib3fARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3fARB) (GET_by_offset(disp, _gloffset_VertexAttrib3fARB));
-}
-
-static INLINE void SET_VertexAttrib3fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3fvARB)(GLuint, const GLfloat *);
-#define CALL_VertexAttrib3fvARB(disp, parameters) \
- (* GET_VertexAttrib3fvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib3fvARB GET_VertexAttrib3fvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3fvARB) (GET_by_offset(disp, _gloffset_VertexAttrib3fvARB));
-}
-
-static INLINE void SET_VertexAttrib3fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3sARB)(GLuint, GLshort, GLshort, GLshort);
-#define CALL_VertexAttrib3sARB(disp, parameters) \
- (* GET_VertexAttrib3sARB(disp)) parameters
-static INLINE _glptr_VertexAttrib3sARB GET_VertexAttrib3sARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3sARB) (GET_by_offset(disp, _gloffset_VertexAttrib3sARB));
-}
-
-static INLINE void SET_VertexAttrib3sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3svARB)(GLuint, const GLshort *);
-#define CALL_VertexAttrib3svARB(disp, parameters) \
- (* GET_VertexAttrib3svARB(disp)) parameters
-static INLINE _glptr_VertexAttrib3svARB GET_VertexAttrib3svARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3svARB) (GET_by_offset(disp, _gloffset_VertexAttrib3svARB));
-}
-
-static INLINE void SET_VertexAttrib3svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NbvARB)(GLuint, const GLbyte *);
-#define CALL_VertexAttrib4NbvARB(disp, parameters) \
- (* GET_VertexAttrib4NbvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4NbvARB GET_VertexAttrib4NbvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4NbvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NbvARB));
-}
-
-static INLINE void SET_VertexAttrib4NbvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLbyte *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4NbvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NivARB)(GLuint, const GLint *);
-#define CALL_VertexAttrib4NivARB(disp, parameters) \
- (* GET_VertexAttrib4NivARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4NivARB GET_VertexAttrib4NivARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4NivARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NivARB));
-}
-
-static INLINE void SET_VertexAttrib4NivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4NivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NsvARB)(GLuint, const GLshort *);
-#define CALL_VertexAttrib4NsvARB(disp, parameters) \
- (* GET_VertexAttrib4NsvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4NsvARB GET_VertexAttrib4NsvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4NsvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NsvARB));
-}
-
-static INLINE void SET_VertexAttrib4NsvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4NsvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NubARB)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
-#define CALL_VertexAttrib4NubARB(disp, parameters) \
- (* GET_VertexAttrib4NubARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4NubARB GET_VertexAttrib4NubARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4NubARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NubARB));
-}
-
-static INLINE void SET_VertexAttrib4NubARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4NubARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NubvARB)(GLuint, const GLubyte *);
-#define CALL_VertexAttrib4NubvARB(disp, parameters) \
- (* GET_VertexAttrib4NubvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4NubvARB GET_VertexAttrib4NubvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4NubvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NubvARB));
-}
-
-static INLINE void SET_VertexAttrib4NubvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLubyte *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4NubvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NuivARB)(GLuint, const GLuint *);
-#define CALL_VertexAttrib4NuivARB(disp, parameters) \
- (* GET_VertexAttrib4NuivARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4NuivARB GET_VertexAttrib4NuivARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4NuivARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NuivARB));
-}
-
-static INLINE void SET_VertexAttrib4NuivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4NuivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NusvARB)(GLuint, const GLushort *);
-#define CALL_VertexAttrib4NusvARB(disp, parameters) \
- (* GET_VertexAttrib4NusvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4NusvARB GET_VertexAttrib4NusvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4NusvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NusvARB));
-}
-
-static INLINE void SET_VertexAttrib4NusvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLushort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4NusvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4bvARB)(GLuint, const GLbyte *);
-#define CALL_VertexAttrib4bvARB(disp, parameters) \
- (* GET_VertexAttrib4bvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4bvARB GET_VertexAttrib4bvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4bvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4bvARB));
-}
-
-static INLINE void SET_VertexAttrib4bvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLbyte *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4bvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4dARB)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_VertexAttrib4dARB(disp, parameters) \
- (* GET_VertexAttrib4dARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4dARB GET_VertexAttrib4dARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4dARB) (GET_by_offset(disp, _gloffset_VertexAttrib4dARB));
-}
-
-static INLINE void SET_VertexAttrib4dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4dvARB)(GLuint, const GLdouble *);
-#define CALL_VertexAttrib4dvARB(disp, parameters) \
- (* GET_VertexAttrib4dvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4dvARB GET_VertexAttrib4dvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4dvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4dvARB));
-}
-
-static INLINE void SET_VertexAttrib4dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4fARB)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_VertexAttrib4fARB(disp, parameters) \
- (* GET_VertexAttrib4fARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4fARB GET_VertexAttrib4fARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4fARB) (GET_by_offset(disp, _gloffset_VertexAttrib4fARB));
-}
-
-static INLINE void SET_VertexAttrib4fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4fvARB)(GLuint, const GLfloat *);
-#define CALL_VertexAttrib4fvARB(disp, parameters) \
- (* GET_VertexAttrib4fvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4fvARB GET_VertexAttrib4fvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4fvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4fvARB));
-}
-
-static INLINE void SET_VertexAttrib4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4ivARB)(GLuint, const GLint *);
-#define CALL_VertexAttrib4ivARB(disp, parameters) \
- (* GET_VertexAttrib4ivARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4ivARB GET_VertexAttrib4ivARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4ivARB) (GET_by_offset(disp, _gloffset_VertexAttrib4ivARB));
-}
-
-static INLINE void SET_VertexAttrib4ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4sARB)(GLuint, GLshort, GLshort, GLshort, GLshort);
-#define CALL_VertexAttrib4sARB(disp, parameters) \
- (* GET_VertexAttrib4sARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4sARB GET_VertexAttrib4sARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4sARB) (GET_by_offset(disp, _gloffset_VertexAttrib4sARB));
-}
-
-static INLINE void SET_VertexAttrib4sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4svARB)(GLuint, const GLshort *);
-#define CALL_VertexAttrib4svARB(disp, parameters) \
- (* GET_VertexAttrib4svARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4svARB GET_VertexAttrib4svARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4svARB) (GET_by_offset(disp, _gloffset_VertexAttrib4svARB));
-}
-
-static INLINE void SET_VertexAttrib4svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4ubvARB)(GLuint, const GLubyte *);
-#define CALL_VertexAttrib4ubvARB(disp, parameters) \
- (* GET_VertexAttrib4ubvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4ubvARB GET_VertexAttrib4ubvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4ubvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4ubvARB));
-}
-
-static INLINE void SET_VertexAttrib4ubvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLubyte *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4ubvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4uivARB)(GLuint, const GLuint *);
-#define CALL_VertexAttrib4uivARB(disp, parameters) \
- (* GET_VertexAttrib4uivARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4uivARB GET_VertexAttrib4uivARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4uivARB) (GET_by_offset(disp, _gloffset_VertexAttrib4uivARB));
-}
-
-static INLINE void SET_VertexAttrib4uivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4uivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4usvARB)(GLuint, const GLushort *);
-#define CALL_VertexAttrib4usvARB(disp, parameters) \
- (* GET_VertexAttrib4usvARB(disp)) parameters
-static INLINE _glptr_VertexAttrib4usvARB GET_VertexAttrib4usvARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4usvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4usvARB));
-}
-
-static INLINE void SET_VertexAttrib4usvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLushort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4usvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribPointerARB)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
-#define CALL_VertexAttribPointerARB(disp, parameters) \
- (* GET_VertexAttribPointerARB(disp)) parameters
-static INLINE _glptr_VertexAttribPointerARB GET_VertexAttribPointerARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttribPointerARB) (GET_by_offset(disp, _gloffset_VertexAttribPointerARB));
-}
-
-static INLINE void SET_VertexAttribPointerARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_VertexAttribPointerARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindBufferARB)(GLenum, GLuint);
-#define CALL_BindBufferARB(disp, parameters) \
- (* GET_BindBufferARB(disp)) parameters
-static INLINE _glptr_BindBufferARB GET_BindBufferARB(struct _glapi_table *disp) {
- return (_glptr_BindBufferARB) (GET_by_offset(disp, _gloffset_BindBufferARB));
-}
-
-static INLINE void SET_BindBufferARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_BindBufferARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BufferDataARB)(GLenum, GLsizeiptrARB, const GLvoid *, GLenum);
-#define CALL_BufferDataARB(disp, parameters) \
- (* GET_BufferDataARB(disp)) parameters
-static INLINE _glptr_BufferDataARB GET_BufferDataARB(struct _glapi_table *disp) {
- return (_glptr_BufferDataARB) (GET_by_offset(disp, _gloffset_BufferDataARB));
-}
-
-static INLINE void SET_BufferDataARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizeiptrARB, const GLvoid *, GLenum)) {
- SET_by_offset(disp, _gloffset_BufferDataARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BufferSubDataARB)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *);
-#define CALL_BufferSubDataARB(disp, parameters) \
- (* GET_BufferSubDataARB(disp)) parameters
-static INLINE _glptr_BufferSubDataARB GET_BufferSubDataARB(struct _glapi_table *disp) {
- return (_glptr_BufferSubDataARB) (GET_by_offset(disp, _gloffset_BufferSubDataARB));
-}
-
-static INLINE void SET_BufferSubDataARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_BufferSubDataARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteBuffersARB)(GLsizei, const GLuint *);
-#define CALL_DeleteBuffersARB(disp, parameters) \
- (* GET_DeleteBuffersARB(disp)) parameters
-static INLINE _glptr_DeleteBuffersARB GET_DeleteBuffersARB(struct _glapi_table *disp) {
- return (_glptr_DeleteBuffersARB) (GET_by_offset(disp, _gloffset_DeleteBuffersARB));
-}
-
-static INLINE void SET_DeleteBuffersARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_DeleteBuffersARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenBuffersARB)(GLsizei, GLuint *);
-#define CALL_GenBuffersARB(disp, parameters) \
- (* GET_GenBuffersARB(disp)) parameters
-static INLINE _glptr_GenBuffersARB GET_GenBuffersARB(struct _glapi_table *disp) {
- return (_glptr_GenBuffersARB) (GET_by_offset(disp, _gloffset_GenBuffersARB));
-}
-
-static INLINE void SET_GenBuffersARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenBuffersARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBufferParameterivARB)(GLenum, GLenum, GLint *);
-#define CALL_GetBufferParameterivARB(disp, parameters) \
- (* GET_GetBufferParameterivARB(disp)) parameters
-static INLINE _glptr_GetBufferParameterivARB GET_GetBufferParameterivARB(struct _glapi_table *disp) {
- return (_glptr_GetBufferParameterivARB) (GET_by_offset(disp, _gloffset_GetBufferParameterivARB));
-}
-
-static INLINE void SET_GetBufferParameterivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetBufferParameterivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBufferPointervARB)(GLenum, GLenum, GLvoid **);
-#define CALL_GetBufferPointervARB(disp, parameters) \
- (* GET_GetBufferPointervARB(disp)) parameters
-static INLINE _glptr_GetBufferPointervARB GET_GetBufferPointervARB(struct _glapi_table *disp) {
- return (_glptr_GetBufferPointervARB) (GET_by_offset(disp, _gloffset_GetBufferPointervARB));
-}
-
-static INLINE void SET_GetBufferPointervARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLvoid **)) {
- SET_by_offset(disp, _gloffset_GetBufferPointervARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBufferSubDataARB)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *);
-#define CALL_GetBufferSubDataARB(disp, parameters) \
- (* GET_GetBufferSubDataARB(disp)) parameters
-static INLINE _glptr_GetBufferSubDataARB GET_GetBufferSubDataARB(struct _glapi_table *disp) {
- return (_glptr_GetBufferSubDataARB) (GET_by_offset(disp, _gloffset_GetBufferSubDataARB));
-}
-
-static INLINE void SET_GetBufferSubDataARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetBufferSubDataARB, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsBufferARB)(GLuint);
-#define CALL_IsBufferARB(disp, parameters) \
- (* GET_IsBufferARB(disp)) parameters
-static INLINE _glptr_IsBufferARB GET_IsBufferARB(struct _glapi_table *disp) {
- return (_glptr_IsBufferARB) (GET_by_offset(disp, _gloffset_IsBufferARB));
-}
-
-static INLINE void SET_IsBufferARB(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsBufferARB, fn);
-}
-
-typedef GLvoid * (GLAPIENTRYP _glptr_MapBufferARB)(GLenum, GLenum);
-#define CALL_MapBufferARB(disp, parameters) \
- (* GET_MapBufferARB(disp)) parameters
-static INLINE _glptr_MapBufferARB GET_MapBufferARB(struct _glapi_table *disp) {
- return (_glptr_MapBufferARB) (GET_by_offset(disp, _gloffset_MapBufferARB));
-}
-
-static INLINE void SET_MapBufferARB(struct _glapi_table *disp, GLvoid * (GLAPIENTRYP fn)(GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_MapBufferARB, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_UnmapBufferARB)(GLenum);
-#define CALL_UnmapBufferARB(disp, parameters) \
- (* GET_UnmapBufferARB(disp)) parameters
-static INLINE _glptr_UnmapBufferARB GET_UnmapBufferARB(struct _glapi_table *disp) {
- return (_glptr_UnmapBufferARB) (GET_by_offset(disp, _gloffset_UnmapBufferARB));
-}
-
-static INLINE void SET_UnmapBufferARB(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_UnmapBufferARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BeginQueryARB)(GLenum, GLuint);
-#define CALL_BeginQueryARB(disp, parameters) \
- (* GET_BeginQueryARB(disp)) parameters
-static INLINE _glptr_BeginQueryARB GET_BeginQueryARB(struct _glapi_table *disp) {
- return (_glptr_BeginQueryARB) (GET_by_offset(disp, _gloffset_BeginQueryARB));
-}
-
-static INLINE void SET_BeginQueryARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_BeginQueryARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteQueriesARB)(GLsizei, const GLuint *);
-#define CALL_DeleteQueriesARB(disp, parameters) \
- (* GET_DeleteQueriesARB(disp)) parameters
-static INLINE _glptr_DeleteQueriesARB GET_DeleteQueriesARB(struct _glapi_table *disp) {
- return (_glptr_DeleteQueriesARB) (GET_by_offset(disp, _gloffset_DeleteQueriesARB));
-}
-
-static INLINE void SET_DeleteQueriesARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_DeleteQueriesARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EndQueryARB)(GLenum);
-#define CALL_EndQueryARB(disp, parameters) \
- (* GET_EndQueryARB(disp)) parameters
-static INLINE _glptr_EndQueryARB GET_EndQueryARB(struct _glapi_table *disp) {
- return (_glptr_EndQueryARB) (GET_by_offset(disp, _gloffset_EndQueryARB));
-}
-
-static INLINE void SET_EndQueryARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_EndQueryARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenQueriesARB)(GLsizei, GLuint *);
-#define CALL_GenQueriesARB(disp, parameters) \
- (* GET_GenQueriesARB(disp)) parameters
-static INLINE _glptr_GenQueriesARB GET_GenQueriesARB(struct _glapi_table *disp) {
- return (_glptr_GenQueriesARB) (GET_by_offset(disp, _gloffset_GenQueriesARB));
-}
-
-static INLINE void SET_GenQueriesARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenQueriesARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetQueryObjectivARB)(GLuint, GLenum, GLint *);
-#define CALL_GetQueryObjectivARB(disp, parameters) \
- (* GET_GetQueryObjectivARB(disp)) parameters
-static INLINE _glptr_GetQueryObjectivARB GET_GetQueryObjectivARB(struct _glapi_table *disp) {
- return (_glptr_GetQueryObjectivARB) (GET_by_offset(disp, _gloffset_GetQueryObjectivARB));
-}
-
-static INLINE void SET_GetQueryObjectivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetQueryObjectivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetQueryObjectuivARB)(GLuint, GLenum, GLuint *);
-#define CALL_GetQueryObjectuivARB(disp, parameters) \
- (* GET_GetQueryObjectuivARB(disp)) parameters
-static INLINE _glptr_GetQueryObjectuivARB GET_GetQueryObjectuivARB(struct _glapi_table *disp) {
- return (_glptr_GetQueryObjectuivARB) (GET_by_offset(disp, _gloffset_GetQueryObjectuivARB));
-}
-
-static INLINE void SET_GetQueryObjectuivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLuint *)) {
- SET_by_offset(disp, _gloffset_GetQueryObjectuivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetQueryivARB)(GLenum, GLenum, GLint *);
-#define CALL_GetQueryivARB(disp, parameters) \
- (* GET_GetQueryivARB(disp)) parameters
-static INLINE _glptr_GetQueryivARB GET_GetQueryivARB(struct _glapi_table *disp) {
- return (_glptr_GetQueryivARB) (GET_by_offset(disp, _gloffset_GetQueryivARB));
-}
-
-static INLINE void SET_GetQueryivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetQueryivARB, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsQueryARB)(GLuint);
-#define CALL_IsQueryARB(disp, parameters) \
- (* GET_IsQueryARB(disp)) parameters
-static INLINE _glptr_IsQueryARB GET_IsQueryARB(struct _glapi_table *disp) {
- return (_glptr_IsQueryARB) (GET_by_offset(disp, _gloffset_IsQueryARB));
-}
-
-static INLINE void SET_IsQueryARB(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsQueryARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AttachObjectARB)(GLhandleARB, GLhandleARB);
-#define CALL_AttachObjectARB(disp, parameters) \
- (* GET_AttachObjectARB(disp)) parameters
-static INLINE _glptr_AttachObjectARB GET_AttachObjectARB(struct _glapi_table *disp) {
- return (_glptr_AttachObjectARB) (GET_by_offset(disp, _gloffset_AttachObjectARB));
-}
-
-static INLINE void SET_AttachObjectARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLhandleARB)) {
- SET_by_offset(disp, _gloffset_AttachObjectARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompileShaderARB)(GLhandleARB);
-#define CALL_CompileShaderARB(disp, parameters) \
- (* GET_CompileShaderARB(disp)) parameters
-static INLINE _glptr_CompileShaderARB GET_CompileShaderARB(struct _glapi_table *disp) {
- return (_glptr_CompileShaderARB) (GET_by_offset(disp, _gloffset_CompileShaderARB));
-}
-
-static INLINE void SET_CompileShaderARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB)) {
- SET_by_offset(disp, _gloffset_CompileShaderARB, fn);
-}
-
-typedef GLhandleARB (GLAPIENTRYP _glptr_CreateProgramObjectARB)(void);
-#define CALL_CreateProgramObjectARB(disp, parameters) \
- (* GET_CreateProgramObjectARB(disp)) parameters
-static INLINE _glptr_CreateProgramObjectARB GET_CreateProgramObjectARB(struct _glapi_table *disp) {
- return (_glptr_CreateProgramObjectARB) (GET_by_offset(disp, _gloffset_CreateProgramObjectARB));
-}
-
-static INLINE void SET_CreateProgramObjectARB(struct _glapi_table *disp, GLhandleARB (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_CreateProgramObjectARB, fn);
-}
-
-typedef GLhandleARB (GLAPIENTRYP _glptr_CreateShaderObjectARB)(GLenum);
-#define CALL_CreateShaderObjectARB(disp, parameters) \
- (* GET_CreateShaderObjectARB(disp)) parameters
-static INLINE _glptr_CreateShaderObjectARB GET_CreateShaderObjectARB(struct _glapi_table *disp) {
- return (_glptr_CreateShaderObjectARB) (GET_by_offset(disp, _gloffset_CreateShaderObjectARB));
-}
-
-static INLINE void SET_CreateShaderObjectARB(struct _glapi_table *disp, GLhandleARB (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_CreateShaderObjectARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteObjectARB)(GLhandleARB);
-#define CALL_DeleteObjectARB(disp, parameters) \
- (* GET_DeleteObjectARB(disp)) parameters
-static INLINE _glptr_DeleteObjectARB GET_DeleteObjectARB(struct _glapi_table *disp) {
- return (_glptr_DeleteObjectARB) (GET_by_offset(disp, _gloffset_DeleteObjectARB));
-}
-
-static INLINE void SET_DeleteObjectARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB)) {
- SET_by_offset(disp, _gloffset_DeleteObjectARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DetachObjectARB)(GLhandleARB, GLhandleARB);
-#define CALL_DetachObjectARB(disp, parameters) \
- (* GET_DetachObjectARB(disp)) parameters
-static INLINE _glptr_DetachObjectARB GET_DetachObjectARB(struct _glapi_table *disp) {
- return (_glptr_DetachObjectARB) (GET_by_offset(disp, _gloffset_DetachObjectARB));
-}
-
-static INLINE void SET_DetachObjectARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLhandleARB)) {
- SET_by_offset(disp, _gloffset_DetachObjectARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetActiveUniformARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
-#define CALL_GetActiveUniformARB(disp, parameters) \
- (* GET_GetActiveUniformARB(disp)) parameters
-static INLINE _glptr_GetActiveUniformARB GET_GetActiveUniformARB(struct _glapi_table *disp) {
- return (_glptr_GetActiveUniformARB) (GET_by_offset(disp, _gloffset_GetActiveUniformARB));
-}
-
-static INLINE void SET_GetActiveUniformARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)) {
- SET_by_offset(disp, _gloffset_GetActiveUniformARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetAttachedObjectsARB)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
-#define CALL_GetAttachedObjectsARB(disp, parameters) \
- (* GET_GetAttachedObjectsARB(disp)) parameters
-static INLINE _glptr_GetAttachedObjectsARB GET_GetAttachedObjectsARB(struct _glapi_table *disp) {
- return (_glptr_GetAttachedObjectsARB) (GET_by_offset(disp, _gloffset_GetAttachedObjectsARB));
-}
-
-static INLINE void SET_GetAttachedObjectsARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *)) {
- SET_by_offset(disp, _gloffset_GetAttachedObjectsARB, fn);
-}
-
-typedef GLhandleARB (GLAPIENTRYP _glptr_GetHandleARB)(GLenum);
-#define CALL_GetHandleARB(disp, parameters) \
- (* GET_GetHandleARB(disp)) parameters
-static INLINE _glptr_GetHandleARB GET_GetHandleARB(struct _glapi_table *disp) {
- return (_glptr_GetHandleARB) (GET_by_offset(disp, _gloffset_GetHandleARB));
-}
-
-static INLINE void SET_GetHandleARB(struct _glapi_table *disp, GLhandleARB (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_GetHandleARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetInfoLogARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
-#define CALL_GetInfoLogARB(disp, parameters) \
- (* GET_GetInfoLogARB(disp)) parameters
-static INLINE _glptr_GetInfoLogARB GET_GetInfoLogARB(struct _glapi_table *disp) {
- return (_glptr_GetInfoLogARB) (GET_by_offset(disp, _gloffset_GetInfoLogARB));
-}
-
-static INLINE void SET_GetInfoLogARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)) {
- SET_by_offset(disp, _gloffset_GetInfoLogARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetObjectParameterfvARB)(GLhandleARB, GLenum, GLfloat *);
-#define CALL_GetObjectParameterfvARB(disp, parameters) \
- (* GET_GetObjectParameterfvARB(disp)) parameters
-static INLINE _glptr_GetObjectParameterfvARB GET_GetObjectParameterfvARB(struct _glapi_table *disp) {
- return (_glptr_GetObjectParameterfvARB) (GET_by_offset(disp, _gloffset_GetObjectParameterfvARB));
-}
-
-static INLINE void SET_GetObjectParameterfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetObjectParameterfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetObjectParameterivARB)(GLhandleARB, GLenum, GLint *);
-#define CALL_GetObjectParameterivARB(disp, parameters) \
- (* GET_GetObjectParameterivARB(disp)) parameters
-static INLINE _glptr_GetObjectParameterivARB GET_GetObjectParameterivARB(struct _glapi_table *disp) {
- return (_glptr_GetObjectParameterivARB) (GET_by_offset(disp, _gloffset_GetObjectParameterivARB));
-}
-
-static INLINE void SET_GetObjectParameterivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetObjectParameterivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetShaderSourceARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
-#define CALL_GetShaderSourceARB(disp, parameters) \
- (* GET_GetShaderSourceARB(disp)) parameters
-static INLINE _glptr_GetShaderSourceARB GET_GetShaderSourceARB(struct _glapi_table *disp) {
- return (_glptr_GetShaderSourceARB) (GET_by_offset(disp, _gloffset_GetShaderSourceARB));
-}
-
-static INLINE void SET_GetShaderSourceARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)) {
- SET_by_offset(disp, _gloffset_GetShaderSourceARB, fn);
-}
-
-typedef GLint (GLAPIENTRYP _glptr_GetUniformLocationARB)(GLhandleARB, const GLcharARB *);
-#define CALL_GetUniformLocationARB(disp, parameters) \
- (* GET_GetUniformLocationARB(disp)) parameters
-static INLINE _glptr_GetUniformLocationARB GET_GetUniformLocationARB(struct _glapi_table *disp) {
- return (_glptr_GetUniformLocationARB) (GET_by_offset(disp, _gloffset_GetUniformLocationARB));
-}
-
-static INLINE void SET_GetUniformLocationARB(struct _glapi_table *disp, GLint (GLAPIENTRYP fn)(GLhandleARB, const GLcharARB *)) {
- SET_by_offset(disp, _gloffset_GetUniformLocationARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetUniformfvARB)(GLhandleARB, GLint, GLfloat *);
-#define CALL_GetUniformfvARB(disp, parameters) \
- (* GET_GetUniformfvARB(disp)) parameters
-static INLINE _glptr_GetUniformfvARB GET_GetUniformfvARB(struct _glapi_table *disp) {
- return (_glptr_GetUniformfvARB) (GET_by_offset(disp, _gloffset_GetUniformfvARB));
-}
-
-static INLINE void SET_GetUniformfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetUniformfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetUniformivARB)(GLhandleARB, GLint, GLint *);
-#define CALL_GetUniformivARB(disp, parameters) \
- (* GET_GetUniformivARB(disp)) parameters
-static INLINE _glptr_GetUniformivARB GET_GetUniformivARB(struct _glapi_table *disp) {
- return (_glptr_GetUniformivARB) (GET_by_offset(disp, _gloffset_GetUniformivARB));
-}
-
-static INLINE void SET_GetUniformivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLint *)) {
- SET_by_offset(disp, _gloffset_GetUniformivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LinkProgramARB)(GLhandleARB);
-#define CALL_LinkProgramARB(disp, parameters) \
- (* GET_LinkProgramARB(disp)) parameters
-static INLINE _glptr_LinkProgramARB GET_LinkProgramARB(struct _glapi_table *disp) {
- return (_glptr_LinkProgramARB) (GET_by_offset(disp, _gloffset_LinkProgramARB));
-}
-
-static INLINE void SET_LinkProgramARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB)) {
- SET_by_offset(disp, _gloffset_LinkProgramARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ShaderSourceARB)(GLhandleARB, GLsizei, const GLcharARB **, const GLint *);
-#define CALL_ShaderSourceARB(disp, parameters) \
- (* GET_ShaderSourceARB(disp)) parameters
-static INLINE _glptr_ShaderSourceARB GET_ShaderSourceARB(struct _glapi_table *disp) {
- return (_glptr_ShaderSourceARB) (GET_by_offset(disp, _gloffset_ShaderSourceARB));
-}
-
-static INLINE void SET_ShaderSourceARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLsizei, const GLcharARB **, const GLint *)) {
- SET_by_offset(disp, _gloffset_ShaderSourceARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1fARB)(GLint, GLfloat);
-#define CALL_Uniform1fARB(disp, parameters) \
- (* GET_Uniform1fARB(disp)) parameters
-static INLINE _glptr_Uniform1fARB GET_Uniform1fARB(struct _glapi_table *disp) {
- return (_glptr_Uniform1fARB) (GET_by_offset(disp, _gloffset_Uniform1fARB));
-}
-
-static INLINE void SET_Uniform1fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat)) {
- SET_by_offset(disp, _gloffset_Uniform1fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1fvARB)(GLint, GLsizei, const GLfloat *);
-#define CALL_Uniform1fvARB(disp, parameters) \
- (* GET_Uniform1fvARB(disp)) parameters
-static INLINE _glptr_Uniform1fvARB GET_Uniform1fvARB(struct _glapi_table *disp) {
- return (_glptr_Uniform1fvARB) (GET_by_offset(disp, _gloffset_Uniform1fvARB));
-}
-
-static INLINE void SET_Uniform1fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Uniform1fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1iARB)(GLint, GLint);
-#define CALL_Uniform1iARB(disp, parameters) \
- (* GET_Uniform1iARB(disp)) parameters
-static INLINE _glptr_Uniform1iARB GET_Uniform1iARB(struct _glapi_table *disp) {
- return (_glptr_Uniform1iARB) (GET_by_offset(disp, _gloffset_Uniform1iARB));
-}
-
-static INLINE void SET_Uniform1iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Uniform1iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1ivARB)(GLint, GLsizei, const GLint *);
-#define CALL_Uniform1ivARB(disp, parameters) \
- (* GET_Uniform1ivARB(disp)) parameters
-static INLINE _glptr_Uniform1ivARB GET_Uniform1ivARB(struct _glapi_table *disp) {
- return (_glptr_Uniform1ivARB) (GET_by_offset(disp, _gloffset_Uniform1ivARB));
-}
-
-static INLINE void SET_Uniform1ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLint *)) {
- SET_by_offset(disp, _gloffset_Uniform1ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2fARB)(GLint, GLfloat, GLfloat);
-#define CALL_Uniform2fARB(disp, parameters) \
- (* GET_Uniform2fARB(disp)) parameters
-static INLINE _glptr_Uniform2fARB GET_Uniform2fARB(struct _glapi_table *disp) {
- return (_glptr_Uniform2fARB) (GET_by_offset(disp, _gloffset_Uniform2fARB));
-}
-
-static INLINE void SET_Uniform2fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Uniform2fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2fvARB)(GLint, GLsizei, const GLfloat *);
-#define CALL_Uniform2fvARB(disp, parameters) \
- (* GET_Uniform2fvARB(disp)) parameters
-static INLINE _glptr_Uniform2fvARB GET_Uniform2fvARB(struct _glapi_table *disp) {
- return (_glptr_Uniform2fvARB) (GET_by_offset(disp, _gloffset_Uniform2fvARB));
-}
-
-static INLINE void SET_Uniform2fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Uniform2fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2iARB)(GLint, GLint, GLint);
-#define CALL_Uniform2iARB(disp, parameters) \
- (* GET_Uniform2iARB(disp)) parameters
-static INLINE _glptr_Uniform2iARB GET_Uniform2iARB(struct _glapi_table *disp) {
- return (_glptr_Uniform2iARB) (GET_by_offset(disp, _gloffset_Uniform2iARB));
-}
-
-static INLINE void SET_Uniform2iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Uniform2iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2ivARB)(GLint, GLsizei, const GLint *);
-#define CALL_Uniform2ivARB(disp, parameters) \
- (* GET_Uniform2ivARB(disp)) parameters
-static INLINE _glptr_Uniform2ivARB GET_Uniform2ivARB(struct _glapi_table *disp) {
- return (_glptr_Uniform2ivARB) (GET_by_offset(disp, _gloffset_Uniform2ivARB));
-}
-
-static INLINE void SET_Uniform2ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLint *)) {
- SET_by_offset(disp, _gloffset_Uniform2ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3fARB)(GLint, GLfloat, GLfloat, GLfloat);
-#define CALL_Uniform3fARB(disp, parameters) \
- (* GET_Uniform3fARB(disp)) parameters
-static INLINE _glptr_Uniform3fARB GET_Uniform3fARB(struct _glapi_table *disp) {
- return (_glptr_Uniform3fARB) (GET_by_offset(disp, _gloffset_Uniform3fARB));
-}
-
-static INLINE void SET_Uniform3fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Uniform3fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3fvARB)(GLint, GLsizei, const GLfloat *);
-#define CALL_Uniform3fvARB(disp, parameters) \
- (* GET_Uniform3fvARB(disp)) parameters
-static INLINE _glptr_Uniform3fvARB GET_Uniform3fvARB(struct _glapi_table *disp) {
- return (_glptr_Uniform3fvARB) (GET_by_offset(disp, _gloffset_Uniform3fvARB));
-}
-
-static INLINE void SET_Uniform3fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Uniform3fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3iARB)(GLint, GLint, GLint, GLint);
-#define CALL_Uniform3iARB(disp, parameters) \
- (* GET_Uniform3iARB(disp)) parameters
-static INLINE _glptr_Uniform3iARB GET_Uniform3iARB(struct _glapi_table *disp) {
- return (_glptr_Uniform3iARB) (GET_by_offset(disp, _gloffset_Uniform3iARB));
-}
-
-static INLINE void SET_Uniform3iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Uniform3iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3ivARB)(GLint, GLsizei, const GLint *);
-#define CALL_Uniform3ivARB(disp, parameters) \
- (* GET_Uniform3ivARB(disp)) parameters
-static INLINE _glptr_Uniform3ivARB GET_Uniform3ivARB(struct _glapi_table *disp) {
- return (_glptr_Uniform3ivARB) (GET_by_offset(disp, _gloffset_Uniform3ivARB));
-}
-
-static INLINE void SET_Uniform3ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLint *)) {
- SET_by_offset(disp, _gloffset_Uniform3ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4fARB)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_Uniform4fARB(disp, parameters) \
- (* GET_Uniform4fARB(disp)) parameters
-static INLINE _glptr_Uniform4fARB GET_Uniform4fARB(struct _glapi_table *disp) {
- return (_glptr_Uniform4fARB) (GET_by_offset(disp, _gloffset_Uniform4fARB));
-}
-
-static INLINE void SET_Uniform4fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_Uniform4fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4fvARB)(GLint, GLsizei, const GLfloat *);
-#define CALL_Uniform4fvARB(disp, parameters) \
- (* GET_Uniform4fvARB(disp)) parameters
-static INLINE _glptr_Uniform4fvARB GET_Uniform4fvARB(struct _glapi_table *disp) {
- return (_glptr_Uniform4fvARB) (GET_by_offset(disp, _gloffset_Uniform4fvARB));
-}
-
-static INLINE void SET_Uniform4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_Uniform4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4iARB)(GLint, GLint, GLint, GLint, GLint);
-#define CALL_Uniform4iARB(disp, parameters) \
- (* GET_Uniform4iARB(disp)) parameters
-static INLINE _glptr_Uniform4iARB GET_Uniform4iARB(struct _glapi_table *disp) {
- return (_glptr_Uniform4iARB) (GET_by_offset(disp, _gloffset_Uniform4iARB));
-}
-
-static INLINE void SET_Uniform4iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_Uniform4iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4ivARB)(GLint, GLsizei, const GLint *);
-#define CALL_Uniform4ivARB(disp, parameters) \
- (* GET_Uniform4ivARB(disp)) parameters
-static INLINE _glptr_Uniform4ivARB GET_Uniform4ivARB(struct _glapi_table *disp) {
- return (_glptr_Uniform4ivARB) (GET_by_offset(disp, _gloffset_Uniform4ivARB));
-}
-
-static INLINE void SET_Uniform4ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLint *)) {
- SET_by_offset(disp, _gloffset_Uniform4ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix2fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
-#define CALL_UniformMatrix2fvARB(disp, parameters) \
- (* GET_UniformMatrix2fvARB(disp)) parameters
-static INLINE _glptr_UniformMatrix2fvARB GET_UniformMatrix2fvARB(struct _glapi_table *disp) {
- return (_glptr_UniformMatrix2fvARB) (GET_by_offset(disp, _gloffset_UniformMatrix2fvARB));
-}
-
-static INLINE void SET_UniformMatrix2fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_UniformMatrix2fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix3fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
-#define CALL_UniformMatrix3fvARB(disp, parameters) \
- (* GET_UniformMatrix3fvARB(disp)) parameters
-static INLINE _glptr_UniformMatrix3fvARB GET_UniformMatrix3fvARB(struct _glapi_table *disp) {
- return (_glptr_UniformMatrix3fvARB) (GET_by_offset(disp, _gloffset_UniformMatrix3fvARB));
-}
-
-static INLINE void SET_UniformMatrix3fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_UniformMatrix3fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix4fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
-#define CALL_UniformMatrix4fvARB(disp, parameters) \
- (* GET_UniformMatrix4fvARB(disp)) parameters
-static INLINE _glptr_UniformMatrix4fvARB GET_UniformMatrix4fvARB(struct _glapi_table *disp) {
- return (_glptr_UniformMatrix4fvARB) (GET_by_offset(disp, _gloffset_UniformMatrix4fvARB));
-}
-
-static INLINE void SET_UniformMatrix4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_UniformMatrix4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UseProgramObjectARB)(GLhandleARB);
-#define CALL_UseProgramObjectARB(disp, parameters) \
- (* GET_UseProgramObjectARB(disp)) parameters
-static INLINE _glptr_UseProgramObjectARB GET_UseProgramObjectARB(struct _glapi_table *disp) {
- return (_glptr_UseProgramObjectARB) (GET_by_offset(disp, _gloffset_UseProgramObjectARB));
-}
-
-static INLINE void SET_UseProgramObjectARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB)) {
- SET_by_offset(disp, _gloffset_UseProgramObjectARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ValidateProgramARB)(GLhandleARB);
-#define CALL_ValidateProgramARB(disp, parameters) \
- (* GET_ValidateProgramARB(disp)) parameters
-static INLINE _glptr_ValidateProgramARB GET_ValidateProgramARB(struct _glapi_table *disp) {
- return (_glptr_ValidateProgramARB) (GET_by_offset(disp, _gloffset_ValidateProgramARB));
-}
-
-static INLINE void SET_ValidateProgramARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB)) {
- SET_by_offset(disp, _gloffset_ValidateProgramARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindAttribLocationARB)(GLhandleARB, GLuint, const GLcharARB *);
-#define CALL_BindAttribLocationARB(disp, parameters) \
- (* GET_BindAttribLocationARB(disp)) parameters
-static INLINE _glptr_BindAttribLocationARB GET_BindAttribLocationARB(struct _glapi_table *disp) {
- return (_glptr_BindAttribLocationARB) (GET_by_offset(disp, _gloffset_BindAttribLocationARB));
-}
-
-static INLINE void SET_BindAttribLocationARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLuint, const GLcharARB *)) {
- SET_by_offset(disp, _gloffset_BindAttribLocationARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
-#define CALL_GetActiveAttribARB(disp, parameters) \
- (* GET_GetActiveAttribARB(disp)) parameters
-static INLINE _glptr_GetActiveAttribARB GET_GetActiveAttribARB(struct _glapi_table *disp) {
- return (_glptr_GetActiveAttribARB) (GET_by_offset(disp, _gloffset_GetActiveAttribARB));
-}
-
-static INLINE void SET_GetActiveAttribARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)) {
- SET_by_offset(disp, _gloffset_GetActiveAttribARB, fn);
-}
-
-typedef GLint (GLAPIENTRYP _glptr_GetAttribLocationARB)(GLhandleARB, const GLcharARB *);
-#define CALL_GetAttribLocationARB(disp, parameters) \
- (* GET_GetAttribLocationARB(disp)) parameters
-static INLINE _glptr_GetAttribLocationARB GET_GetAttribLocationARB(struct _glapi_table *disp) {
- return (_glptr_GetAttribLocationARB) (GET_by_offset(disp, _gloffset_GetAttribLocationARB));
-}
-
-static INLINE void SET_GetAttribLocationARB(struct _glapi_table *disp, GLint (GLAPIENTRYP fn)(GLhandleARB, const GLcharARB *)) {
- SET_by_offset(disp, _gloffset_GetAttribLocationARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawBuffersARB)(GLsizei, const GLenum *);
-#define CALL_DrawBuffersARB(disp, parameters) \
- (* GET_DrawBuffersARB(disp)) parameters
-static INLINE _glptr_DrawBuffersARB GET_DrawBuffersARB(struct _glapi_table *disp) {
- return (_glptr_DrawBuffersARB) (GET_by_offset(disp, _gloffset_DrawBuffersARB));
-}
-
-static INLINE void SET_DrawBuffersARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLenum *)) {
- SET_by_offset(disp, _gloffset_DrawBuffersARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClampColorARB)(GLenum, GLenum);
-#define CALL_ClampColorARB(disp, parameters) \
- (* GET_ClampColorARB(disp)) parameters
-static INLINE _glptr_ClampColorARB GET_ClampColorARB(struct _glapi_table *disp) {
- return (_glptr_ClampColorARB) (GET_by_offset(disp, _gloffset_ClampColorARB));
-}
-
-static INLINE void SET_ClampColorARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_ClampColorARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawArraysInstancedARB)(GLenum, GLint, GLsizei, GLsizei);
-#define CALL_DrawArraysInstancedARB(disp, parameters) \
- (* GET_DrawArraysInstancedARB(disp)) parameters
-static INLINE _glptr_DrawArraysInstancedARB GET_DrawArraysInstancedARB(struct _glapi_table *disp) {
- return (_glptr_DrawArraysInstancedARB) (GET_by_offset(disp, _gloffset_DrawArraysInstancedARB));
-}
-
-static INLINE void SET_DrawArraysInstancedARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_DrawArraysInstancedARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawElementsInstancedARB)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei);
-#define CALL_DrawElementsInstancedARB(disp, parameters) \
- (* GET_DrawElementsInstancedARB(disp)) parameters
-static INLINE _glptr_DrawElementsInstancedARB GET_DrawElementsInstancedARB(struct _glapi_table *disp) {
- return (_glptr_DrawElementsInstancedARB) (GET_by_offset(disp, _gloffset_DrawElementsInstancedARB));
-}
-
-static INLINE void SET_DrawElementsInstancedARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei)) {
- SET_by_offset(disp, _gloffset_DrawElementsInstancedARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RenderbufferStorageMultisample)(GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-#define CALL_RenderbufferStorageMultisample(disp, parameters) \
- (* GET_RenderbufferStorageMultisample(disp)) parameters
-static INLINE _glptr_RenderbufferStorageMultisample GET_RenderbufferStorageMultisample(struct _glapi_table *disp) {
- return (_glptr_RenderbufferStorageMultisample) (GET_by_offset(disp, _gloffset_RenderbufferStorageMultisample));
-}
-
-static INLINE void SET_RenderbufferStorageMultisample(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_RenderbufferStorageMultisample, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTextureARB)(GLenum, GLenum, GLuint, GLint);
-#define CALL_FramebufferTextureARB(disp, parameters) \
- (* GET_FramebufferTextureARB(disp)) parameters
-static INLINE _glptr_FramebufferTextureARB GET_FramebufferTextureARB(struct _glapi_table *disp) {
- return (_glptr_FramebufferTextureARB) (GET_by_offset(disp, _gloffset_FramebufferTextureARB));
-}
-
-static INLINE void SET_FramebufferTextureARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint, GLint)) {
- SET_by_offset(disp, _gloffset_FramebufferTextureARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTextureFaceARB)(GLenum, GLenum, GLuint, GLint, GLenum);
-#define CALL_FramebufferTextureFaceARB(disp, parameters) \
- (* GET_FramebufferTextureFaceARB(disp)) parameters
-static INLINE _glptr_FramebufferTextureFaceARB GET_FramebufferTextureFaceARB(struct _glapi_table *disp) {
- return (_glptr_FramebufferTextureFaceARB) (GET_by_offset(disp, _gloffset_FramebufferTextureFaceARB));
-}
-
-static INLINE void SET_FramebufferTextureFaceARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint, GLint, GLenum)) {
- SET_by_offset(disp, _gloffset_FramebufferTextureFaceARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramParameteriARB)(GLuint, GLenum, GLint);
-#define CALL_ProgramParameteriARB(disp, parameters) \
- (* GET_ProgramParameteriARB(disp)) parameters
-static INLINE _glptr_ProgramParameteriARB GET_ProgramParameteriARB(struct _glapi_table *disp) {
- return (_glptr_ProgramParameteriARB) (GET_by_offset(disp, _gloffset_ProgramParameteriARB));
-}
-
-static INLINE void SET_ProgramParameteriARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_ProgramParameteriARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribDivisorARB)(GLuint, GLuint);
-#define CALL_VertexAttribDivisorARB(disp, parameters) \
- (* GET_VertexAttribDivisorARB(disp)) parameters
-static INLINE _glptr_VertexAttribDivisorARB GET_VertexAttribDivisorARB(struct _glapi_table *disp) {
- return (_glptr_VertexAttribDivisorARB) (GET_by_offset(disp, _gloffset_VertexAttribDivisorARB));
-}
-
-static INLINE void SET_VertexAttribDivisorARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexAttribDivisorARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FlushMappedBufferRange)(GLenum, GLintptr, GLsizeiptr);
-#define CALL_FlushMappedBufferRange(disp, parameters) \
- (* GET_FlushMappedBufferRange(disp)) parameters
-static INLINE _glptr_FlushMappedBufferRange GET_FlushMappedBufferRange(struct _glapi_table *disp) {
- return (_glptr_FlushMappedBufferRange) (GET_by_offset(disp, _gloffset_FlushMappedBufferRange));
-}
-
-static INLINE void SET_FlushMappedBufferRange(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLintptr, GLsizeiptr)) {
- SET_by_offset(disp, _gloffset_FlushMappedBufferRange, fn);
-}
-
-typedef GLvoid * (GLAPIENTRYP _glptr_MapBufferRange)(GLenum, GLintptr, GLsizeiptr, GLbitfield);
-#define CALL_MapBufferRange(disp, parameters) \
- (* GET_MapBufferRange(disp)) parameters
-static INLINE _glptr_MapBufferRange GET_MapBufferRange(struct _glapi_table *disp) {
- return (_glptr_MapBufferRange) (GET_by_offset(disp, _gloffset_MapBufferRange));
-}
-
-static INLINE void SET_MapBufferRange(struct _glapi_table *disp, GLvoid * (GLAPIENTRYP fn)(GLenum, GLintptr, GLsizeiptr, GLbitfield)) {
- SET_by_offset(disp, _gloffset_MapBufferRange, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexBufferARB)(GLenum, GLenum, GLuint);
-#define CALL_TexBufferARB(disp, parameters) \
- (* GET_TexBufferARB(disp)) parameters
-static INLINE _glptr_TexBufferARB GET_TexBufferARB(struct _glapi_table *disp) {
- return (_glptr_TexBufferARB) (GET_by_offset(disp, _gloffset_TexBufferARB));
-}
-
-static INLINE void SET_TexBufferARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_TexBufferARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindVertexArray)(GLuint);
-#define CALL_BindVertexArray(disp, parameters) \
- (* GET_BindVertexArray(disp)) parameters
-static INLINE _glptr_BindVertexArray GET_BindVertexArray(struct _glapi_table *disp) {
- return (_glptr_BindVertexArray) (GET_by_offset(disp, _gloffset_BindVertexArray));
-}
-
-static INLINE void SET_BindVertexArray(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_BindVertexArray, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenVertexArrays)(GLsizei, GLuint *);
-#define CALL_GenVertexArrays(disp, parameters) \
- (* GET_GenVertexArrays(disp)) parameters
-static INLINE _glptr_GenVertexArrays GET_GenVertexArrays(struct _glapi_table *disp) {
- return (_glptr_GenVertexArrays) (GET_by_offset(disp, _gloffset_GenVertexArrays));
-}
-
-static INLINE void SET_GenVertexArrays(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenVertexArrays, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyBufferSubData)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr);
-#define CALL_CopyBufferSubData(disp, parameters) \
- (* GET_CopyBufferSubData(disp)) parameters
-static INLINE _glptr_CopyBufferSubData GET_CopyBufferSubData(struct _glapi_table *disp) {
- return (_glptr_CopyBufferSubData) (GET_by_offset(disp, _gloffset_CopyBufferSubData));
-}
-
-static INLINE void SET_CopyBufferSubData(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr)) {
- SET_by_offset(disp, _gloffset_CopyBufferSubData, fn);
-}
-
-typedef GLenum (GLAPIENTRYP _glptr_ClientWaitSync)(GLsync, GLbitfield, GLuint64);
-#define CALL_ClientWaitSync(disp, parameters) \
- (* GET_ClientWaitSync(disp)) parameters
-static INLINE _glptr_ClientWaitSync GET_ClientWaitSync(struct _glapi_table *disp) {
- return (_glptr_ClientWaitSync) (GET_by_offset(disp, _gloffset_ClientWaitSync));
-}
-
-static INLINE void SET_ClientWaitSync(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(GLsync, GLbitfield, GLuint64)) {
- SET_by_offset(disp, _gloffset_ClientWaitSync, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteSync)(GLsync);
-#define CALL_DeleteSync(disp, parameters) \
- (* GET_DeleteSync(disp)) parameters
-static INLINE _glptr_DeleteSync GET_DeleteSync(struct _glapi_table *disp) {
- return (_glptr_DeleteSync) (GET_by_offset(disp, _gloffset_DeleteSync));
-}
-
-static INLINE void SET_DeleteSync(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsync)) {
- SET_by_offset(disp, _gloffset_DeleteSync, fn);
-}
-
-typedef GLsync (GLAPIENTRYP _glptr_FenceSync)(GLenum, GLbitfield);
-#define CALL_FenceSync(disp, parameters) \
- (* GET_FenceSync(disp)) parameters
-static INLINE _glptr_FenceSync GET_FenceSync(struct _glapi_table *disp) {
- return (_glptr_FenceSync) (GET_by_offset(disp, _gloffset_FenceSync));
-}
-
-static INLINE void SET_FenceSync(struct _glapi_table *disp, GLsync (GLAPIENTRYP fn)(GLenum, GLbitfield)) {
- SET_by_offset(disp, _gloffset_FenceSync, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetInteger64v)(GLenum, GLint64 *);
-#define CALL_GetInteger64v(disp, parameters) \
- (* GET_GetInteger64v(disp)) parameters
-static INLINE _glptr_GetInteger64v GET_GetInteger64v(struct _glapi_table *disp) {
- return (_glptr_GetInteger64v) (GET_by_offset(disp, _gloffset_GetInteger64v));
-}
-
-static INLINE void SET_GetInteger64v(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint64 *)) {
- SET_by_offset(disp, _gloffset_GetInteger64v, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSynciv)(GLsync, GLenum, GLsizei, GLsizei *, GLint *);
-#define CALL_GetSynciv(disp, parameters) \
- (* GET_GetSynciv(disp)) parameters
-static INLINE _glptr_GetSynciv GET_GetSynciv(struct _glapi_table *disp) {
- return (_glptr_GetSynciv) (GET_by_offset(disp, _gloffset_GetSynciv));
-}
-
-static INLINE void SET_GetSynciv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsync, GLenum, GLsizei, GLsizei *, GLint *)) {
- SET_by_offset(disp, _gloffset_GetSynciv, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsSync)(GLsync);
-#define CALL_IsSync(disp, parameters) \
- (* GET_IsSync(disp)) parameters
-static INLINE _glptr_IsSync GET_IsSync(struct _glapi_table *disp) {
- return (_glptr_IsSync) (GET_by_offset(disp, _gloffset_IsSync));
-}
-
-static INLINE void SET_IsSync(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLsync)) {
- SET_by_offset(disp, _gloffset_IsSync, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WaitSync)(GLsync, GLbitfield, GLuint64);
-#define CALL_WaitSync(disp, parameters) \
- (* GET_WaitSync(disp)) parameters
-static INLINE _glptr_WaitSync GET_WaitSync(struct _glapi_table *disp) {
- return (_glptr_WaitSync) (GET_by_offset(disp, _gloffset_WaitSync));
-}
-
-static INLINE void SET_WaitSync(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsync, GLbitfield, GLuint64)) {
- SET_by_offset(disp, _gloffset_WaitSync, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawElementsBaseVertex)(GLenum, GLsizei, GLenum, const GLvoid *, GLint);
-#define CALL_DrawElementsBaseVertex(disp, parameters) \
- (* GET_DrawElementsBaseVertex(disp)) parameters
-static INLINE _glptr_DrawElementsBaseVertex GET_DrawElementsBaseVertex(struct _glapi_table *disp) {
- return (_glptr_DrawElementsBaseVertex) (GET_by_offset(disp, _gloffset_DrawElementsBaseVertex));
-}
-
-static INLINE void SET_DrawElementsBaseVertex(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, const GLvoid *, GLint)) {
- SET_by_offset(disp, _gloffset_DrawElementsBaseVertex, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawElementsInstancedBaseVertex)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei, GLint);
-#define CALL_DrawElementsInstancedBaseVertex(disp, parameters) \
- (* GET_DrawElementsInstancedBaseVertex(disp)) parameters
-static INLINE _glptr_DrawElementsInstancedBaseVertex GET_DrawElementsInstancedBaseVertex(struct _glapi_table *disp) {
- return (_glptr_DrawElementsInstancedBaseVertex) (GET_by_offset(disp, _gloffset_DrawElementsInstancedBaseVertex));
-}
-
-static INLINE void SET_DrawElementsInstancedBaseVertex(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei, GLint)) {
- SET_by_offset(disp, _gloffset_DrawElementsInstancedBaseVertex, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawRangeElementsBaseVertex)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint);
-#define CALL_DrawRangeElementsBaseVertex(disp, parameters) \
- (* GET_DrawRangeElementsBaseVertex(disp)) parameters
-static INLINE _glptr_DrawRangeElementsBaseVertex GET_DrawRangeElementsBaseVertex(struct _glapi_table *disp) {
- return (_glptr_DrawRangeElementsBaseVertex) (GET_by_offset(disp, _gloffset_DrawRangeElementsBaseVertex));
-}
-
-static INLINE void SET_DrawRangeElementsBaseVertex(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint)) {
- SET_by_offset(disp, _gloffset_DrawRangeElementsBaseVertex, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiDrawElementsBaseVertex)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei, const GLint *);
-#define CALL_MultiDrawElementsBaseVertex(disp, parameters) \
- (* GET_MultiDrawElementsBaseVertex(disp)) parameters
-static INLINE _glptr_MultiDrawElementsBaseVertex GET_MultiDrawElementsBaseVertex(struct _glapi_table *disp) {
- return (_glptr_MultiDrawElementsBaseVertex) (GET_by_offset(disp, _gloffset_MultiDrawElementsBaseVertex));
-}
-
-static INLINE void SET_MultiDrawElementsBaseVertex(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei, const GLint *)) {
- SET_by_offset(disp, _gloffset_MultiDrawElementsBaseVertex, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendEquationSeparateiARB)(GLuint, GLenum, GLenum);
-#define CALL_BlendEquationSeparateiARB(disp, parameters) \
- (* GET_BlendEquationSeparateiARB(disp)) parameters
-static INLINE _glptr_BlendEquationSeparateiARB GET_BlendEquationSeparateiARB(struct _glapi_table *disp) {
- return (_glptr_BlendEquationSeparateiARB) (GET_by_offset(disp, _gloffset_BlendEquationSeparateiARB));
-}
-
-static INLINE void SET_BlendEquationSeparateiARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_BlendEquationSeparateiARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendEquationiARB)(GLuint, GLenum);
-#define CALL_BlendEquationiARB(disp, parameters) \
- (* GET_BlendEquationiARB(disp)) parameters
-static INLINE _glptr_BlendEquationiARB GET_BlendEquationiARB(struct _glapi_table *disp) {
- return (_glptr_BlendEquationiARB) (GET_by_offset(disp, _gloffset_BlendEquationiARB));
-}
-
-static INLINE void SET_BlendEquationiARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum)) {
- SET_by_offset(disp, _gloffset_BlendEquationiARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendFuncSeparateiARB)(GLuint, GLenum, GLenum, GLenum, GLenum);
-#define CALL_BlendFuncSeparateiARB(disp, parameters) \
- (* GET_BlendFuncSeparateiARB(disp)) parameters
-static INLINE _glptr_BlendFuncSeparateiARB GET_BlendFuncSeparateiARB(struct _glapi_table *disp) {
- return (_glptr_BlendFuncSeparateiARB) (GET_by_offset(disp, _gloffset_BlendFuncSeparateiARB));
-}
-
-static INLINE void SET_BlendFuncSeparateiARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLenum, GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_BlendFuncSeparateiARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendFunciARB)(GLuint, GLenum, GLenum);
-#define CALL_BlendFunciARB(disp, parameters) \
- (* GET_BlendFunciARB(disp)) parameters
-static INLINE _glptr_BlendFunciARB GET_BlendFunciARB(struct _glapi_table *disp) {
- return (_glptr_BlendFunciARB) (GET_by_offset(disp, _gloffset_BlendFunciARB));
-}
-
-static INLINE void SET_BlendFunciARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_BlendFunciARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindSampler)(GLuint, GLuint);
-#define CALL_BindSampler(disp, parameters) \
- (* GET_BindSampler(disp)) parameters
-static INLINE _glptr_BindSampler GET_BindSampler(struct _glapi_table *disp) {
- return (_glptr_BindSampler) (GET_by_offset(disp, _gloffset_BindSampler));
-}
-
-static INLINE void SET_BindSampler(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_BindSampler, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteSamplers)(GLsizei, const GLuint *);
-#define CALL_DeleteSamplers(disp, parameters) \
- (* GET_DeleteSamplers(disp)) parameters
-static INLINE _glptr_DeleteSamplers GET_DeleteSamplers(struct _glapi_table *disp) {
- return (_glptr_DeleteSamplers) (GET_by_offset(disp, _gloffset_DeleteSamplers));
-}
-
-static INLINE void SET_DeleteSamplers(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_DeleteSamplers, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenSamplers)(GLsizei, GLuint *);
-#define CALL_GenSamplers(disp, parameters) \
- (* GET_GenSamplers(disp)) parameters
-static INLINE _glptr_GenSamplers GET_GenSamplers(struct _glapi_table *disp) {
- return (_glptr_GenSamplers) (GET_by_offset(disp, _gloffset_GenSamplers));
-}
-
-static INLINE void SET_GenSamplers(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenSamplers, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSamplerParameterIiv)(GLuint, GLenum, GLint *);
-#define CALL_GetSamplerParameterIiv(disp, parameters) \
- (* GET_GetSamplerParameterIiv(disp)) parameters
-static INLINE _glptr_GetSamplerParameterIiv GET_GetSamplerParameterIiv(struct _glapi_table *disp) {
- return (_glptr_GetSamplerParameterIiv) (GET_by_offset(disp, _gloffset_GetSamplerParameterIiv));
-}
-
-static INLINE void SET_GetSamplerParameterIiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetSamplerParameterIiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSamplerParameterIuiv)(GLuint, GLenum, GLuint *);
-#define CALL_GetSamplerParameterIuiv(disp, parameters) \
- (* GET_GetSamplerParameterIuiv(disp)) parameters
-static INLINE _glptr_GetSamplerParameterIuiv GET_GetSamplerParameterIuiv(struct _glapi_table *disp) {
- return (_glptr_GetSamplerParameterIuiv) (GET_by_offset(disp, _gloffset_GetSamplerParameterIuiv));
-}
-
-static INLINE void SET_GetSamplerParameterIuiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLuint *)) {
- SET_by_offset(disp, _gloffset_GetSamplerParameterIuiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSamplerParameterfv)(GLuint, GLenum, GLfloat *);
-#define CALL_GetSamplerParameterfv(disp, parameters) \
- (* GET_GetSamplerParameterfv(disp)) parameters
-static INLINE _glptr_GetSamplerParameterfv GET_GetSamplerParameterfv(struct _glapi_table *disp) {
- return (_glptr_GetSamplerParameterfv) (GET_by_offset(disp, _gloffset_GetSamplerParameterfv));
-}
-
-static INLINE void SET_GetSamplerParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetSamplerParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSamplerParameteriv)(GLuint, GLenum, GLint *);
-#define CALL_GetSamplerParameteriv(disp, parameters) \
- (* GET_GetSamplerParameteriv(disp)) parameters
-static INLINE _glptr_GetSamplerParameteriv GET_GetSamplerParameteriv(struct _glapi_table *disp) {
- return (_glptr_GetSamplerParameteriv) (GET_by_offset(disp, _gloffset_GetSamplerParameteriv));
-}
-
-static INLINE void SET_GetSamplerParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetSamplerParameteriv, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsSampler)(GLuint);
-#define CALL_IsSampler(disp, parameters) \
- (* GET_IsSampler(disp)) parameters
-static INLINE _glptr_IsSampler GET_IsSampler(struct _glapi_table *disp) {
- return (_glptr_IsSampler) (GET_by_offset(disp, _gloffset_IsSampler));
-}
-
-static INLINE void SET_IsSampler(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsSampler, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameterIiv)(GLuint, GLenum, const GLint *);
-#define CALL_SamplerParameterIiv(disp, parameters) \
- (* GET_SamplerParameterIiv(disp)) parameters
-static INLINE _glptr_SamplerParameterIiv GET_SamplerParameterIiv(struct _glapi_table *disp) {
- return (_glptr_SamplerParameterIiv) (GET_by_offset(disp, _gloffset_SamplerParameterIiv));
-}
-
-static INLINE void SET_SamplerParameterIiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_SamplerParameterIiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameterIuiv)(GLuint, GLenum, const GLuint *);
-#define CALL_SamplerParameterIuiv(disp, parameters) \
- (* GET_SamplerParameterIuiv(disp)) parameters
-static INLINE _glptr_SamplerParameterIuiv GET_SamplerParameterIuiv(struct _glapi_table *disp) {
- return (_glptr_SamplerParameterIuiv) (GET_by_offset(disp, _gloffset_SamplerParameterIuiv));
-}
-
-static INLINE void SET_SamplerParameterIuiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_SamplerParameterIuiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameterf)(GLuint, GLenum, GLfloat);
-#define CALL_SamplerParameterf(disp, parameters) \
- (* GET_SamplerParameterf(disp)) parameters
-static INLINE _glptr_SamplerParameterf GET_SamplerParameterf(struct _glapi_table *disp) {
- return (_glptr_SamplerParameterf) (GET_by_offset(disp, _gloffset_SamplerParameterf));
-}
-
-static INLINE void SET_SamplerParameterf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_SamplerParameterf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameterfv)(GLuint, GLenum, const GLfloat *);
-#define CALL_SamplerParameterfv(disp, parameters) \
- (* GET_SamplerParameterfv(disp)) parameters
-static INLINE _glptr_SamplerParameterfv GET_SamplerParameterfv(struct _glapi_table *disp) {
- return (_glptr_SamplerParameterfv) (GET_by_offset(disp, _gloffset_SamplerParameterfv));
-}
-
-static INLINE void SET_SamplerParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_SamplerParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameteri)(GLuint, GLenum, GLint);
-#define CALL_SamplerParameteri(disp, parameters) \
- (* GET_SamplerParameteri(disp)) parameters
-static INLINE _glptr_SamplerParameteri GET_SamplerParameteri(struct _glapi_table *disp) {
- return (_glptr_SamplerParameteri) (GET_by_offset(disp, _gloffset_SamplerParameteri));
-}
-
-static INLINE void SET_SamplerParameteri(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_SamplerParameteri, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameteriv)(GLuint, GLenum, const GLint *);
-#define CALL_SamplerParameteriv(disp, parameters) \
- (* GET_SamplerParameteriv(disp)) parameters
-static INLINE _glptr_SamplerParameteriv GET_SamplerParameteriv(struct _glapi_table *disp) {
- return (_glptr_SamplerParameteriv) (GET_by_offset(disp, _gloffset_SamplerParameteriv));
-}
-
-static INLINE void SET_SamplerParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_SamplerParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorP3ui)(GLenum, GLuint);
-#define CALL_ColorP3ui(disp, parameters) \
- (* GET_ColorP3ui(disp)) parameters
-static INLINE _glptr_ColorP3ui GET_ColorP3ui(struct _glapi_table *disp) {
- return (_glptr_ColorP3ui) (GET_by_offset(disp, _gloffset_ColorP3ui));
-}
-
-static INLINE void SET_ColorP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_ColorP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorP3uiv)(GLenum, const GLuint *);
-#define CALL_ColorP3uiv(disp, parameters) \
- (* GET_ColorP3uiv(disp)) parameters
-static INLINE _glptr_ColorP3uiv GET_ColorP3uiv(struct _glapi_table *disp) {
- return (_glptr_ColorP3uiv) (GET_by_offset(disp, _gloffset_ColorP3uiv));
-}
-
-static INLINE void SET_ColorP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_ColorP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorP4ui)(GLenum, GLuint);
-#define CALL_ColorP4ui(disp, parameters) \
- (* GET_ColorP4ui(disp)) parameters
-static INLINE _glptr_ColorP4ui GET_ColorP4ui(struct _glapi_table *disp) {
- return (_glptr_ColorP4ui) (GET_by_offset(disp, _gloffset_ColorP4ui));
-}
-
-static INLINE void SET_ColorP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_ColorP4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorP4uiv)(GLenum, const GLuint *);
-#define CALL_ColorP4uiv(disp, parameters) \
- (* GET_ColorP4uiv(disp)) parameters
-static INLINE _glptr_ColorP4uiv GET_ColorP4uiv(struct _glapi_table *disp) {
- return (_glptr_ColorP4uiv) (GET_by_offset(disp, _gloffset_ColorP4uiv));
-}
-
-static INLINE void SET_ColorP4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_ColorP4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP1ui)(GLenum, GLenum, GLuint);
-#define CALL_MultiTexCoordP1ui(disp, parameters) \
- (* GET_MultiTexCoordP1ui(disp)) parameters
-static INLINE _glptr_MultiTexCoordP1ui GET_MultiTexCoordP1ui(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoordP1ui) (GET_by_offset(disp, _gloffset_MultiTexCoordP1ui));
-}
-
-static INLINE void SET_MultiTexCoordP1ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_MultiTexCoordP1ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP1uiv)(GLenum, GLenum, const GLuint *);
-#define CALL_MultiTexCoordP1uiv(disp, parameters) \
- (* GET_MultiTexCoordP1uiv(disp)) parameters
-static INLINE _glptr_MultiTexCoordP1uiv GET_MultiTexCoordP1uiv(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoordP1uiv) (GET_by_offset(disp, _gloffset_MultiTexCoordP1uiv));
-}
-
-static INLINE void SET_MultiTexCoordP1uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoordP1uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP2ui)(GLenum, GLenum, GLuint);
-#define CALL_MultiTexCoordP2ui(disp, parameters) \
- (* GET_MultiTexCoordP2ui(disp)) parameters
-static INLINE _glptr_MultiTexCoordP2ui GET_MultiTexCoordP2ui(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoordP2ui) (GET_by_offset(disp, _gloffset_MultiTexCoordP2ui));
-}
-
-static INLINE void SET_MultiTexCoordP2ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_MultiTexCoordP2ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP2uiv)(GLenum, GLenum, const GLuint *);
-#define CALL_MultiTexCoordP2uiv(disp, parameters) \
- (* GET_MultiTexCoordP2uiv(disp)) parameters
-static INLINE _glptr_MultiTexCoordP2uiv GET_MultiTexCoordP2uiv(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoordP2uiv) (GET_by_offset(disp, _gloffset_MultiTexCoordP2uiv));
-}
-
-static INLINE void SET_MultiTexCoordP2uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoordP2uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP3ui)(GLenum, GLenum, GLuint);
-#define CALL_MultiTexCoordP3ui(disp, parameters) \
- (* GET_MultiTexCoordP3ui(disp)) parameters
-static INLINE _glptr_MultiTexCoordP3ui GET_MultiTexCoordP3ui(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoordP3ui) (GET_by_offset(disp, _gloffset_MultiTexCoordP3ui));
-}
-
-static INLINE void SET_MultiTexCoordP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_MultiTexCoordP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP3uiv)(GLenum, GLenum, const GLuint *);
-#define CALL_MultiTexCoordP3uiv(disp, parameters) \
- (* GET_MultiTexCoordP3uiv(disp)) parameters
-static INLINE _glptr_MultiTexCoordP3uiv GET_MultiTexCoordP3uiv(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoordP3uiv) (GET_by_offset(disp, _gloffset_MultiTexCoordP3uiv));
-}
-
-static INLINE void SET_MultiTexCoordP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoordP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP4ui)(GLenum, GLenum, GLuint);
-#define CALL_MultiTexCoordP4ui(disp, parameters) \
- (* GET_MultiTexCoordP4ui(disp)) parameters
-static INLINE _glptr_MultiTexCoordP4ui GET_MultiTexCoordP4ui(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoordP4ui) (GET_by_offset(disp, _gloffset_MultiTexCoordP4ui));
-}
-
-static INLINE void SET_MultiTexCoordP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_MultiTexCoordP4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP4uiv)(GLenum, GLenum, const GLuint *);
-#define CALL_MultiTexCoordP4uiv(disp, parameters) \
- (* GET_MultiTexCoordP4uiv(disp)) parameters
-static INLINE _glptr_MultiTexCoordP4uiv GET_MultiTexCoordP4uiv(struct _glapi_table *disp) {
- return (_glptr_MultiTexCoordP4uiv) (GET_by_offset(disp, _gloffset_MultiTexCoordP4uiv));
-}
-
-static INLINE void SET_MultiTexCoordP4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_MultiTexCoordP4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_NormalP3ui)(GLenum, GLuint);
-#define CALL_NormalP3ui(disp, parameters) \
- (* GET_NormalP3ui(disp)) parameters
-static INLINE _glptr_NormalP3ui GET_NormalP3ui(struct _glapi_table *disp) {
- return (_glptr_NormalP3ui) (GET_by_offset(disp, _gloffset_NormalP3ui));
-}
-
-static INLINE void SET_NormalP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_NormalP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_NormalP3uiv)(GLenum, const GLuint *);
-#define CALL_NormalP3uiv(disp, parameters) \
- (* GET_NormalP3uiv(disp)) parameters
-static INLINE _glptr_NormalP3uiv GET_NormalP3uiv(struct _glapi_table *disp) {
- return (_glptr_NormalP3uiv) (GET_by_offset(disp, _gloffset_NormalP3uiv));
-}
-
-static INLINE void SET_NormalP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_NormalP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColorP3ui)(GLenum, GLuint);
-#define CALL_SecondaryColorP3ui(disp, parameters) \
- (* GET_SecondaryColorP3ui(disp)) parameters
-static INLINE _glptr_SecondaryColorP3ui GET_SecondaryColorP3ui(struct _glapi_table *disp) {
- return (_glptr_SecondaryColorP3ui) (GET_by_offset(disp, _gloffset_SecondaryColorP3ui));
-}
-
-static INLINE void SET_SecondaryColorP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_SecondaryColorP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColorP3uiv)(GLenum, const GLuint *);
-#define CALL_SecondaryColorP3uiv(disp, parameters) \
- (* GET_SecondaryColorP3uiv(disp)) parameters
-static INLINE _glptr_SecondaryColorP3uiv GET_SecondaryColorP3uiv(struct _glapi_table *disp) {
- return (_glptr_SecondaryColorP3uiv) (GET_by_offset(disp, _gloffset_SecondaryColorP3uiv));
-}
-
-static INLINE void SET_SecondaryColorP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_SecondaryColorP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP1ui)(GLenum, GLuint);
-#define CALL_TexCoordP1ui(disp, parameters) \
- (* GET_TexCoordP1ui(disp)) parameters
-static INLINE _glptr_TexCoordP1ui GET_TexCoordP1ui(struct _glapi_table *disp) {
- return (_glptr_TexCoordP1ui) (GET_by_offset(disp, _gloffset_TexCoordP1ui));
-}
-
-static INLINE void SET_TexCoordP1ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_TexCoordP1ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP1uiv)(GLenum, const GLuint *);
-#define CALL_TexCoordP1uiv(disp, parameters) \
- (* GET_TexCoordP1uiv(disp)) parameters
-static INLINE _glptr_TexCoordP1uiv GET_TexCoordP1uiv(struct _glapi_table *disp) {
- return (_glptr_TexCoordP1uiv) (GET_by_offset(disp, _gloffset_TexCoordP1uiv));
-}
-
-static INLINE void SET_TexCoordP1uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_TexCoordP1uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP2ui)(GLenum, GLuint);
-#define CALL_TexCoordP2ui(disp, parameters) \
- (* GET_TexCoordP2ui(disp)) parameters
-static INLINE _glptr_TexCoordP2ui GET_TexCoordP2ui(struct _glapi_table *disp) {
- return (_glptr_TexCoordP2ui) (GET_by_offset(disp, _gloffset_TexCoordP2ui));
-}
-
-static INLINE void SET_TexCoordP2ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_TexCoordP2ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP2uiv)(GLenum, const GLuint *);
-#define CALL_TexCoordP2uiv(disp, parameters) \
- (* GET_TexCoordP2uiv(disp)) parameters
-static INLINE _glptr_TexCoordP2uiv GET_TexCoordP2uiv(struct _glapi_table *disp) {
- return (_glptr_TexCoordP2uiv) (GET_by_offset(disp, _gloffset_TexCoordP2uiv));
-}
-
-static INLINE void SET_TexCoordP2uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_TexCoordP2uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP3ui)(GLenum, GLuint);
-#define CALL_TexCoordP3ui(disp, parameters) \
- (* GET_TexCoordP3ui(disp)) parameters
-static INLINE _glptr_TexCoordP3ui GET_TexCoordP3ui(struct _glapi_table *disp) {
- return (_glptr_TexCoordP3ui) (GET_by_offset(disp, _gloffset_TexCoordP3ui));
-}
-
-static INLINE void SET_TexCoordP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_TexCoordP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP3uiv)(GLenum, const GLuint *);
-#define CALL_TexCoordP3uiv(disp, parameters) \
- (* GET_TexCoordP3uiv(disp)) parameters
-static INLINE _glptr_TexCoordP3uiv GET_TexCoordP3uiv(struct _glapi_table *disp) {
- return (_glptr_TexCoordP3uiv) (GET_by_offset(disp, _gloffset_TexCoordP3uiv));
-}
-
-static INLINE void SET_TexCoordP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_TexCoordP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP4ui)(GLenum, GLuint);
-#define CALL_TexCoordP4ui(disp, parameters) \
- (* GET_TexCoordP4ui(disp)) parameters
-static INLINE _glptr_TexCoordP4ui GET_TexCoordP4ui(struct _glapi_table *disp) {
- return (_glptr_TexCoordP4ui) (GET_by_offset(disp, _gloffset_TexCoordP4ui));
-}
-
-static INLINE void SET_TexCoordP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_TexCoordP4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP4uiv)(GLenum, const GLuint *);
-#define CALL_TexCoordP4uiv(disp, parameters) \
- (* GET_TexCoordP4uiv(disp)) parameters
-static INLINE _glptr_TexCoordP4uiv GET_TexCoordP4uiv(struct _glapi_table *disp) {
- return (_glptr_TexCoordP4uiv) (GET_by_offset(disp, _gloffset_TexCoordP4uiv));
-}
-
-static INLINE void SET_TexCoordP4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_TexCoordP4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP1ui)(GLuint, GLenum, GLboolean, GLuint);
-#define CALL_VertexAttribP1ui(disp, parameters) \
- (* GET_VertexAttribP1ui(disp)) parameters
-static INLINE _glptr_VertexAttribP1ui GET_VertexAttribP1ui(struct _glapi_table *disp) {
- return (_glptr_VertexAttribP1ui) (GET_by_offset(disp, _gloffset_VertexAttribP1ui));
-}
-
-static INLINE void SET_VertexAttribP1ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexAttribP1ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP1uiv)(GLuint, GLenum, GLboolean, const GLuint *);
-#define CALL_VertexAttribP1uiv(disp, parameters) \
- (* GET_VertexAttribP1uiv(disp)) parameters
-static INLINE _glptr_VertexAttribP1uiv GET_VertexAttribP1uiv(struct _glapi_table *disp) {
- return (_glptr_VertexAttribP1uiv) (GET_by_offset(disp, _gloffset_VertexAttribP1uiv));
-}
-
-static INLINE void SET_VertexAttribP1uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribP1uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP2ui)(GLuint, GLenum, GLboolean, GLuint);
-#define CALL_VertexAttribP2ui(disp, parameters) \
- (* GET_VertexAttribP2ui(disp)) parameters
-static INLINE _glptr_VertexAttribP2ui GET_VertexAttribP2ui(struct _glapi_table *disp) {
- return (_glptr_VertexAttribP2ui) (GET_by_offset(disp, _gloffset_VertexAttribP2ui));
-}
-
-static INLINE void SET_VertexAttribP2ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexAttribP2ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP2uiv)(GLuint, GLenum, GLboolean, const GLuint *);
-#define CALL_VertexAttribP2uiv(disp, parameters) \
- (* GET_VertexAttribP2uiv(disp)) parameters
-static INLINE _glptr_VertexAttribP2uiv GET_VertexAttribP2uiv(struct _glapi_table *disp) {
- return (_glptr_VertexAttribP2uiv) (GET_by_offset(disp, _gloffset_VertexAttribP2uiv));
-}
-
-static INLINE void SET_VertexAttribP2uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribP2uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP3ui)(GLuint, GLenum, GLboolean, GLuint);
-#define CALL_VertexAttribP3ui(disp, parameters) \
- (* GET_VertexAttribP3ui(disp)) parameters
-static INLINE _glptr_VertexAttribP3ui GET_VertexAttribP3ui(struct _glapi_table *disp) {
- return (_glptr_VertexAttribP3ui) (GET_by_offset(disp, _gloffset_VertexAttribP3ui));
-}
-
-static INLINE void SET_VertexAttribP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexAttribP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP3uiv)(GLuint, GLenum, GLboolean, const GLuint *);
-#define CALL_VertexAttribP3uiv(disp, parameters) \
- (* GET_VertexAttribP3uiv(disp)) parameters
-static INLINE _glptr_VertexAttribP3uiv GET_VertexAttribP3uiv(struct _glapi_table *disp) {
- return (_glptr_VertexAttribP3uiv) (GET_by_offset(disp, _gloffset_VertexAttribP3uiv));
-}
-
-static INLINE void SET_VertexAttribP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP4ui)(GLuint, GLenum, GLboolean, GLuint);
-#define CALL_VertexAttribP4ui(disp, parameters) \
- (* GET_VertexAttribP4ui(disp)) parameters
-static INLINE _glptr_VertexAttribP4ui GET_VertexAttribP4ui(struct _glapi_table *disp) {
- return (_glptr_VertexAttribP4ui) (GET_by_offset(disp, _gloffset_VertexAttribP4ui));
-}
-
-static INLINE void SET_VertexAttribP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexAttribP4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP4uiv)(GLuint, GLenum, GLboolean, const GLuint *);
-#define CALL_VertexAttribP4uiv(disp, parameters) \
- (* GET_VertexAttribP4uiv(disp)) parameters
-static INLINE _glptr_VertexAttribP4uiv GET_VertexAttribP4uiv(struct _glapi_table *disp) {
- return (_glptr_VertexAttribP4uiv) (GET_by_offset(disp, _gloffset_VertexAttribP4uiv));
-}
-
-static INLINE void SET_VertexAttribP4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribP4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP2ui)(GLenum, GLuint);
-#define CALL_VertexP2ui(disp, parameters) \
- (* GET_VertexP2ui(disp)) parameters
-static INLINE _glptr_VertexP2ui GET_VertexP2ui(struct _glapi_table *disp) {
- return (_glptr_VertexP2ui) (GET_by_offset(disp, _gloffset_VertexP2ui));
-}
-
-static INLINE void SET_VertexP2ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexP2ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP2uiv)(GLenum, const GLuint *);
-#define CALL_VertexP2uiv(disp, parameters) \
- (* GET_VertexP2uiv(disp)) parameters
-static INLINE _glptr_VertexP2uiv GET_VertexP2uiv(struct _glapi_table *disp) {
- return (_glptr_VertexP2uiv) (GET_by_offset(disp, _gloffset_VertexP2uiv));
-}
-
-static INLINE void SET_VertexP2uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexP2uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP3ui)(GLenum, GLuint);
-#define CALL_VertexP3ui(disp, parameters) \
- (* GET_VertexP3ui(disp)) parameters
-static INLINE _glptr_VertexP3ui GET_VertexP3ui(struct _glapi_table *disp) {
- return (_glptr_VertexP3ui) (GET_by_offset(disp, _gloffset_VertexP3ui));
-}
-
-static INLINE void SET_VertexP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP3uiv)(GLenum, const GLuint *);
-#define CALL_VertexP3uiv(disp, parameters) \
- (* GET_VertexP3uiv(disp)) parameters
-static INLINE _glptr_VertexP3uiv GET_VertexP3uiv(struct _glapi_table *disp) {
- return (_glptr_VertexP3uiv) (GET_by_offset(disp, _gloffset_VertexP3uiv));
-}
-
-static INLINE void SET_VertexP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP4ui)(GLenum, GLuint);
-#define CALL_VertexP4ui(disp, parameters) \
- (* GET_VertexP4ui(disp)) parameters
-static INLINE _glptr_VertexP4ui GET_VertexP4ui(struct _glapi_table *disp) {
- return (_glptr_VertexP4ui) (GET_by_offset(disp, _gloffset_VertexP4ui));
-}
-
-static INLINE void SET_VertexP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexP4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP4uiv)(GLenum, const GLuint *);
-#define CALL_VertexP4uiv(disp, parameters) \
- (* GET_VertexP4uiv(disp)) parameters
-static INLINE _glptr_VertexP4uiv GET_VertexP4uiv(struct _glapi_table *disp) {
- return (_glptr_VertexP4uiv) (GET_by_offset(disp, _gloffset_VertexP4uiv));
-}
-
-static INLINE void SET_VertexP4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexP4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindTransformFeedback)(GLenum, GLuint);
-#define CALL_BindTransformFeedback(disp, parameters) \
- (* GET_BindTransformFeedback(disp)) parameters
-static INLINE _glptr_BindTransformFeedback GET_BindTransformFeedback(struct _glapi_table *disp) {
- return (_glptr_BindTransformFeedback) (GET_by_offset(disp, _gloffset_BindTransformFeedback));
-}
-
-static INLINE void SET_BindTransformFeedback(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_BindTransformFeedback, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteTransformFeedbacks)(GLsizei, const GLuint *);
-#define CALL_DeleteTransformFeedbacks(disp, parameters) \
- (* GET_DeleteTransformFeedbacks(disp)) parameters
-static INLINE _glptr_DeleteTransformFeedbacks GET_DeleteTransformFeedbacks(struct _glapi_table *disp) {
- return (_glptr_DeleteTransformFeedbacks) (GET_by_offset(disp, _gloffset_DeleteTransformFeedbacks));
-}
-
-static INLINE void SET_DeleteTransformFeedbacks(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_DeleteTransformFeedbacks, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawTransformFeedback)(GLenum, GLuint);
-#define CALL_DrawTransformFeedback(disp, parameters) \
- (* GET_DrawTransformFeedback(disp)) parameters
-static INLINE _glptr_DrawTransformFeedback GET_DrawTransformFeedback(struct _glapi_table *disp) {
- return (_glptr_DrawTransformFeedback) (GET_by_offset(disp, _gloffset_DrawTransformFeedback));
-}
-
-static INLINE void SET_DrawTransformFeedback(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_DrawTransformFeedback, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenTransformFeedbacks)(GLsizei, GLuint *);
-#define CALL_GenTransformFeedbacks(disp, parameters) \
- (* GET_GenTransformFeedbacks(disp)) parameters
-static INLINE _glptr_GenTransformFeedbacks GET_GenTransformFeedbacks(struct _glapi_table *disp) {
- return (_glptr_GenTransformFeedbacks) (GET_by_offset(disp, _gloffset_GenTransformFeedbacks));
-}
-
-static INLINE void SET_GenTransformFeedbacks(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenTransformFeedbacks, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsTransformFeedback)(GLuint);
-#define CALL_IsTransformFeedback(disp, parameters) \
- (* GET_IsTransformFeedback(disp)) parameters
-static INLINE _glptr_IsTransformFeedback GET_IsTransformFeedback(struct _glapi_table *disp) {
- return (_glptr_IsTransformFeedback) (GET_by_offset(disp, _gloffset_IsTransformFeedback));
-}
-
-static INLINE void SET_IsTransformFeedback(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsTransformFeedback, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PauseTransformFeedback)(void);
-#define CALL_PauseTransformFeedback(disp, parameters) \
- (* GET_PauseTransformFeedback(disp)) parameters
-static INLINE _glptr_PauseTransformFeedback GET_PauseTransformFeedback(struct _glapi_table *disp) {
- return (_glptr_PauseTransformFeedback) (GET_by_offset(disp, _gloffset_PauseTransformFeedback));
-}
-
-static INLINE void SET_PauseTransformFeedback(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_PauseTransformFeedback, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ResumeTransformFeedback)(void);
-#define CALL_ResumeTransformFeedback(disp, parameters) \
- (* GET_ResumeTransformFeedback(disp)) parameters
-static INLINE _glptr_ResumeTransformFeedback GET_ResumeTransformFeedback(struct _glapi_table *disp) {
- return (_glptr_ResumeTransformFeedback) (GET_by_offset(disp, _gloffset_ResumeTransformFeedback));
-}
-
-static INLINE void SET_ResumeTransformFeedback(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_ResumeTransformFeedback, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearDepthf)(GLclampf);
-#define CALL_ClearDepthf(disp, parameters) \
- (* GET_ClearDepthf(disp)) parameters
-static INLINE _glptr_ClearDepthf GET_ClearDepthf(struct _glapi_table *disp) {
- return (_glptr_ClearDepthf) (GET_by_offset(disp, _gloffset_ClearDepthf));
-}
-
-static INLINE void SET_ClearDepthf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf)) {
- SET_by_offset(disp, _gloffset_ClearDepthf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthRangef)(GLclampf, GLclampf);
-#define CALL_DepthRangef(disp, parameters) \
- (* GET_DepthRangef(disp)) parameters
-static INLINE _glptr_DepthRangef GET_DepthRangef(struct _glapi_table *disp) {
- return (_glptr_DepthRangef) (GET_by_offset(disp, _gloffset_DepthRangef));
-}
-
-static INLINE void SET_DepthRangef(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLclampf)) {
- SET_by_offset(disp, _gloffset_DepthRangef, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetShaderPrecisionFormat)(GLenum, GLenum, GLint *, GLint *);
-#define CALL_GetShaderPrecisionFormat(disp, parameters) \
- (* GET_GetShaderPrecisionFormat(disp)) parameters
-static INLINE _glptr_GetShaderPrecisionFormat GET_GetShaderPrecisionFormat(struct _glapi_table *disp) {
- return (_glptr_GetShaderPrecisionFormat) (GET_by_offset(disp, _gloffset_GetShaderPrecisionFormat));
-}
-
-static INLINE void SET_GetShaderPrecisionFormat(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *, GLint *)) {
- SET_by_offset(disp, _gloffset_GetShaderPrecisionFormat, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ReleaseShaderCompiler)(void);
-#define CALL_ReleaseShaderCompiler(disp, parameters) \
- (* GET_ReleaseShaderCompiler(disp)) parameters
-static INLINE _glptr_ReleaseShaderCompiler GET_ReleaseShaderCompiler(struct _glapi_table *disp) {
- return (_glptr_ReleaseShaderCompiler) (GET_by_offset(disp, _gloffset_ReleaseShaderCompiler));
-}
-
-static INLINE void SET_ReleaseShaderCompiler(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_ReleaseShaderCompiler, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ShaderBinary)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei);
-#define CALL_ShaderBinary(disp, parameters) \
- (* GET_ShaderBinary(disp)) parameters
-static INLINE _glptr_ShaderBinary GET_ShaderBinary(struct _glapi_table *disp) {
- return (_glptr_ShaderBinary) (GET_by_offset(disp, _gloffset_ShaderBinary));
-}
-
-static INLINE void SET_ShaderBinary(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei)) {
- SET_by_offset(disp, _gloffset_ShaderBinary, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DebugMessageCallbackARB)(GLDEBUGPROCARB, GLvoid *);
-#define CALL_DebugMessageCallbackARB(disp, parameters) \
- (* GET_DebugMessageCallbackARB(disp)) parameters
-static INLINE _glptr_DebugMessageCallbackARB GET_DebugMessageCallbackARB(struct _glapi_table *disp) {
- return (_glptr_DebugMessageCallbackARB) (GET_by_offset(disp, _gloffset_DebugMessageCallbackARB));
-}
-
-static INLINE void SET_DebugMessageCallbackARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLDEBUGPROCARB, GLvoid *)) {
- SET_by_offset(disp, _gloffset_DebugMessageCallbackARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DebugMessageControlARB)(GLenum, GLenum, GLenum, GLsizei, const GLuint *, GLboolean);
-#define CALL_DebugMessageControlARB(disp, parameters) \
- (* GET_DebugMessageControlARB(disp)) parameters
-static INLINE _glptr_DebugMessageControlARB GET_DebugMessageControlARB(struct _glapi_table *disp) {
- return (_glptr_DebugMessageControlARB) (GET_by_offset(disp, _gloffset_DebugMessageControlARB));
-}
-
-static INLINE void SET_DebugMessageControlARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLsizei, const GLuint *, GLboolean)) {
- SET_by_offset(disp, _gloffset_DebugMessageControlARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DebugMessageInsertARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLcharARB *);
-#define CALL_DebugMessageInsertARB(disp, parameters) \
- (* GET_DebugMessageInsertARB(disp)) parameters
-static INLINE _glptr_DebugMessageInsertARB GET_DebugMessageInsertARB(struct _glapi_table *disp) {
- return (_glptr_DebugMessageInsertARB) (GET_by_offset(disp, _gloffset_DebugMessageInsertARB));
-}
-
-static INLINE void SET_DebugMessageInsertARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLcharARB *)) {
- SET_by_offset(disp, _gloffset_DebugMessageInsertARB, fn);
-}
-
-typedef GLuint (GLAPIENTRYP _glptr_GetDebugMessageLogARB)(GLuint, GLsizei, GLenum *, GLenum *, GLuint *, GLenum *, GLsizei *, GLcharARB *);
-#define CALL_GetDebugMessageLogARB(disp, parameters) \
- (* GET_GetDebugMessageLogARB(disp)) parameters
-static INLINE _glptr_GetDebugMessageLogARB GET_GetDebugMessageLogARB(struct _glapi_table *disp) {
- return (_glptr_GetDebugMessageLogARB) (GET_by_offset(disp, _gloffset_GetDebugMessageLogARB));
-}
-
-static INLINE void SET_GetDebugMessageLogARB(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(GLuint, GLsizei, GLenum *, GLenum *, GLuint *, GLenum *, GLsizei *, GLcharARB *)) {
- SET_by_offset(disp, _gloffset_GetDebugMessageLogARB, fn);
-}
-
-typedef GLenum (GLAPIENTRYP _glptr_GetGraphicsResetStatusARB)(void);
-#define CALL_GetGraphicsResetStatusARB(disp, parameters) \
- (* GET_GetGraphicsResetStatusARB(disp)) parameters
-static INLINE _glptr_GetGraphicsResetStatusARB GET_GetGraphicsResetStatusARB(struct _glapi_table *disp) {
- return (_glptr_GetGraphicsResetStatusARB) (GET_by_offset(disp, _gloffset_GetGraphicsResetStatusARB));
-}
-
-static INLINE void SET_GetGraphicsResetStatusARB(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_GetGraphicsResetStatusARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnColorTableARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *);
-#define CALL_GetnColorTableARB(disp, parameters) \
- (* GET_GetnColorTableARB(disp)) parameters
-static INLINE _glptr_GetnColorTableARB GET_GetnColorTableARB(struct _glapi_table *disp) {
- return (_glptr_GetnColorTableARB) (GET_by_offset(disp, _gloffset_GetnColorTableARB));
-}
-
-static INLINE void SET_GetnColorTableARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLsizei, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetnColorTableARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnCompressedTexImageARB)(GLenum, GLint, GLsizei, GLvoid *);
-#define CALL_GetnCompressedTexImageARB(disp, parameters) \
- (* GET_GetnCompressedTexImageARB(disp)) parameters
-static INLINE _glptr_GetnCompressedTexImageARB GET_GetnCompressedTexImageARB(struct _glapi_table *disp) {
- return (_glptr_GetnCompressedTexImageARB) (GET_by_offset(disp, _gloffset_GetnCompressedTexImageARB));
-}
-
-static INLINE void SET_GetnCompressedTexImageARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLsizei, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetnCompressedTexImageARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnConvolutionFilterARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *);
-#define CALL_GetnConvolutionFilterARB(disp, parameters) \
- (* GET_GetnConvolutionFilterARB(disp)) parameters
-static INLINE _glptr_GetnConvolutionFilterARB GET_GetnConvolutionFilterARB(struct _glapi_table *disp) {
- return (_glptr_GetnConvolutionFilterARB) (GET_by_offset(disp, _gloffset_GetnConvolutionFilterARB));
-}
-
-static INLINE void SET_GetnConvolutionFilterARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLsizei, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetnConvolutionFilterARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnHistogramARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *);
-#define CALL_GetnHistogramARB(disp, parameters) \
- (* GET_GetnHistogramARB(disp)) parameters
-static INLINE _glptr_GetnHistogramARB GET_GetnHistogramARB(struct _glapi_table *disp) {
- return (_glptr_GetnHistogramARB) (GET_by_offset(disp, _gloffset_GetnHistogramARB));
-}
-
-static INLINE void SET_GetnHistogramARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetnHistogramARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnMapdvARB)(GLenum, GLenum, GLsizei, GLdouble *);
-#define CALL_GetnMapdvARB(disp, parameters) \
- (* GET_GetnMapdvARB(disp)) parameters
-static INLINE _glptr_GetnMapdvARB GET_GetnMapdvARB(struct _glapi_table *disp) {
- return (_glptr_GetnMapdvARB) (GET_by_offset(disp, _gloffset_GetnMapdvARB));
-}
-
-static INLINE void SET_GetnMapdvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetnMapdvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnMapfvARB)(GLenum, GLenum, GLsizei, GLfloat *);
-#define CALL_GetnMapfvARB(disp, parameters) \
- (* GET_GetnMapfvARB(disp)) parameters
-static INLINE _glptr_GetnMapfvARB GET_GetnMapfvARB(struct _glapi_table *disp) {
- return (_glptr_GetnMapfvARB) (GET_by_offset(disp, _gloffset_GetnMapfvARB));
-}
-
-static INLINE void SET_GetnMapfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetnMapfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnMapivARB)(GLenum, GLenum, GLsizei, GLint *);
-#define CALL_GetnMapivARB(disp, parameters) \
- (* GET_GetnMapivARB(disp)) parameters
-static INLINE _glptr_GetnMapivARB GET_GetnMapivARB(struct _glapi_table *disp) {
- return (_glptr_GetnMapivARB) (GET_by_offset(disp, _gloffset_GetnMapivARB));
-}
-
-static INLINE void SET_GetnMapivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLint *)) {
- SET_by_offset(disp, _gloffset_GetnMapivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnMinmaxARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *);
-#define CALL_GetnMinmaxARB(disp, parameters) \
- (* GET_GetnMinmaxARB(disp)) parameters
-static INLINE _glptr_GetnMinmaxARB GET_GetnMinmaxARB(struct _glapi_table *disp) {
- return (_glptr_GetnMinmaxARB) (GET_by_offset(disp, _gloffset_GetnMinmaxARB));
-}
-
-static INLINE void SET_GetnMinmaxARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetnMinmaxARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnPixelMapfvARB)(GLenum, GLsizei, GLfloat *);
-#define CALL_GetnPixelMapfvARB(disp, parameters) \
- (* GET_GetnPixelMapfvARB(disp)) parameters
-static INLINE _glptr_GetnPixelMapfvARB GET_GetnPixelMapfvARB(struct _glapi_table *disp) {
- return (_glptr_GetnPixelMapfvARB) (GET_by_offset(disp, _gloffset_GetnPixelMapfvARB));
-}
-
-static INLINE void SET_GetnPixelMapfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetnPixelMapfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnPixelMapuivARB)(GLenum, GLsizei, GLuint *);
-#define CALL_GetnPixelMapuivARB(disp, parameters) \
- (* GET_GetnPixelMapuivARB(disp)) parameters
-static INLINE _glptr_GetnPixelMapuivARB GET_GetnPixelMapuivARB(struct _glapi_table *disp) {
- return (_glptr_GetnPixelMapuivARB) (GET_by_offset(disp, _gloffset_GetnPixelMapuivARB));
-}
-
-static INLINE void SET_GetnPixelMapuivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GetnPixelMapuivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnPixelMapusvARB)(GLenum, GLsizei, GLushort *);
-#define CALL_GetnPixelMapusvARB(disp, parameters) \
- (* GET_GetnPixelMapusvARB(disp)) parameters
-static INLINE _glptr_GetnPixelMapusvARB GET_GetnPixelMapusvARB(struct _glapi_table *disp) {
- return (_glptr_GetnPixelMapusvARB) (GET_by_offset(disp, _gloffset_GetnPixelMapusvARB));
-}
-
-static INLINE void SET_GetnPixelMapusvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLushort *)) {
- SET_by_offset(disp, _gloffset_GetnPixelMapusvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnPolygonStippleARB)(GLsizei, GLubyte *);
-#define CALL_GetnPolygonStippleARB(disp, parameters) \
- (* GET_GetnPolygonStippleARB(disp)) parameters
-static INLINE _glptr_GetnPolygonStippleARB GET_GetnPolygonStippleARB(struct _glapi_table *disp) {
- return (_glptr_GetnPolygonStippleARB) (GET_by_offset(disp, _gloffset_GetnPolygonStippleARB));
-}
-
-static INLINE void SET_GetnPolygonStippleARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLubyte *)) {
- SET_by_offset(disp, _gloffset_GetnPolygonStippleARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnSeparableFilterARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *, GLsizei, GLvoid *, GLvoid *);
-#define CALL_GetnSeparableFilterARB(disp, parameters) \
- (* GET_GetnSeparableFilterARB(disp)) parameters
-static INLINE _glptr_GetnSeparableFilterARB GET_GetnSeparableFilterARB(struct _glapi_table *disp) {
- return (_glptr_GetnSeparableFilterARB) (GET_by_offset(disp, _gloffset_GetnSeparableFilterARB));
-}
-
-static INLINE void SET_GetnSeparableFilterARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLsizei, GLvoid *, GLsizei, GLvoid *, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetnSeparableFilterARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnTexImageARB)(GLenum, GLint, GLenum, GLenum, GLsizei, GLvoid *);
-#define CALL_GetnTexImageARB(disp, parameters) \
- (* GET_GetnTexImageARB(disp)) parameters
-static INLINE _glptr_GetnTexImageARB GET_GetnTexImageARB(struct _glapi_table *disp) {
- return (_glptr_GetnTexImageARB) (GET_by_offset(disp, _gloffset_GetnTexImageARB));
-}
-
-static INLINE void SET_GetnTexImageARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLenum, GLsizei, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetnTexImageARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnUniformdvARB)(GLhandleARB, GLint, GLsizei, GLdouble *);
-#define CALL_GetnUniformdvARB(disp, parameters) \
- (* GET_GetnUniformdvARB(disp)) parameters
-static INLINE _glptr_GetnUniformdvARB GET_GetnUniformdvARB(struct _glapi_table *disp) {
- return (_glptr_GetnUniformdvARB) (GET_by_offset(disp, _gloffset_GetnUniformdvARB));
-}
-
-static INLINE void SET_GetnUniformdvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLsizei, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetnUniformdvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnUniformfvARB)(GLhandleARB, GLint, GLsizei, GLfloat *);
-#define CALL_GetnUniformfvARB(disp, parameters) \
- (* GET_GetnUniformfvARB(disp)) parameters
-static INLINE _glptr_GetnUniformfvARB GET_GetnUniformfvARB(struct _glapi_table *disp) {
- return (_glptr_GetnUniformfvARB) (GET_by_offset(disp, _gloffset_GetnUniformfvARB));
-}
-
-static INLINE void SET_GetnUniformfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLsizei, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetnUniformfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnUniformivARB)(GLhandleARB, GLint, GLsizei, GLint *);
-#define CALL_GetnUniformivARB(disp, parameters) \
- (* GET_GetnUniformivARB(disp)) parameters
-static INLINE _glptr_GetnUniformivARB GET_GetnUniformivARB(struct _glapi_table *disp) {
- return (_glptr_GetnUniformivARB) (GET_by_offset(disp, _gloffset_GetnUniformivARB));
-}
-
-static INLINE void SET_GetnUniformivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLsizei, GLint *)) {
- SET_by_offset(disp, _gloffset_GetnUniformivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnUniformuivARB)(GLhandleARB, GLint, GLsizei, GLuint *);
-#define CALL_GetnUniformuivARB(disp, parameters) \
- (* GET_GetnUniformuivARB(disp)) parameters
-static INLINE _glptr_GetnUniformuivARB GET_GetnUniformuivARB(struct _glapi_table *disp) {
- return (_glptr_GetnUniformuivARB) (GET_by_offset(disp, _gloffset_GetnUniformuivARB));
-}
-
-static INLINE void SET_GetnUniformuivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GetnUniformuivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ReadnPixelsARB)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, GLvoid *);
-#define CALL_ReadnPixelsARB(disp, parameters) \
- (* GET_ReadnPixelsARB(disp)) parameters
-static INLINE _glptr_ReadnPixelsARB GET_ReadnPixelsARB(struct _glapi_table *disp) {
- return (_glptr_ReadnPixelsARB) (GET_by_offset(disp, _gloffset_ReadnPixelsARB));
-}
-
-static INLINE void SET_ReadnPixelsARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, GLvoid *)) {
- SET_by_offset(disp, _gloffset_ReadnPixelsARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexStorage1D)(GLenum, GLsizei, GLenum, GLsizei);
-#define CALL_TexStorage1D(disp, parameters) \
- (* GET_TexStorage1D(disp)) parameters
-static INLINE _glptr_TexStorage1D GET_TexStorage1D(struct _glapi_table *disp) {
- return (_glptr_TexStorage1D) (GET_by_offset(disp, _gloffset_TexStorage1D));
-}
-
-static INLINE void SET_TexStorage1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, GLsizei)) {
- SET_by_offset(disp, _gloffset_TexStorage1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexStorage2D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-#define CALL_TexStorage2D(disp, parameters) \
- (* GET_TexStorage2D(disp)) parameters
-static INLINE _glptr_TexStorage2D GET_TexStorage2D(struct _glapi_table *disp) {
- return (_glptr_TexStorage2D) (GET_by_offset(disp, _gloffset_TexStorage2D));
-}
-
-static INLINE void SET_TexStorage2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_TexStorage2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexStorage3D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei);
-#define CALL_TexStorage3D(disp, parameters) \
- (* GET_TexStorage3D(disp)) parameters
-static INLINE _glptr_TexStorage3D GET_TexStorage3D(struct _glapi_table *disp) {
- return (_glptr_TexStorage3D) (GET_by_offset(disp, _gloffset_TexStorage3D));
-}
-
-static INLINE void SET_TexStorage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_TexStorage3D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TextureStorage1DEXT)(GLuint, GLenum, GLsizei, GLenum, GLsizei);
-#define CALL_TextureStorage1DEXT(disp, parameters) \
- (* GET_TextureStorage1DEXT(disp)) parameters
-static INLINE _glptr_TextureStorage1DEXT GET_TextureStorage1DEXT(struct _glapi_table *disp) {
- return (_glptr_TextureStorage1DEXT) (GET_by_offset(disp, _gloffset_TextureStorage1DEXT));
-}
-
-static INLINE void SET_TextureStorage1DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLsizei, GLenum, GLsizei)) {
- SET_by_offset(disp, _gloffset_TextureStorage1DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TextureStorage2DEXT)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-#define CALL_TextureStorage2DEXT(disp, parameters) \
- (* GET_TextureStorage2DEXT(disp)) parameters
-static INLINE _glptr_TextureStorage2DEXT GET_TextureStorage2DEXT(struct _glapi_table *disp) {
- return (_glptr_TextureStorage2DEXT) (GET_by_offset(disp, _gloffset_TextureStorage2DEXT));
-}
-
-static INLINE void SET_TextureStorage2DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_TextureStorage2DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TextureStorage3DEXT)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei);
-#define CALL_TextureStorage3DEXT(disp, parameters) \
- (* GET_TextureStorage3DEXT(disp)) parameters
-static INLINE _glptr_TextureStorage3DEXT GET_TextureStorage3DEXT(struct _glapi_table *disp) {
- return (_glptr_TextureStorage3DEXT) (GET_by_offset(disp, _gloffset_TextureStorage3DEXT));
-}
-
-static INLINE void SET_TextureStorage3DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_TextureStorage3DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PolygonOffsetEXT)(GLfloat, GLfloat);
-#define CALL_PolygonOffsetEXT(disp, parameters) \
- (* GET_PolygonOffsetEXT(disp)) parameters
-static INLINE _glptr_PolygonOffsetEXT GET_PolygonOffsetEXT(struct _glapi_table *disp) {
- return (_glptr_PolygonOffsetEXT) (GET_by_offset(disp, _gloffset_PolygonOffsetEXT));
-}
-
-static INLINE void SET_PolygonOffsetEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_PolygonOffsetEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPixelTexGenParameterfvSGIS)(GLenum, GLfloat *);
-#define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) \
- (* GET_GetPixelTexGenParameterfvSGIS(disp)) parameters
-static INLINE _glptr_GetPixelTexGenParameterfvSGIS GET_GetPixelTexGenParameterfvSGIS(struct _glapi_table *disp) {
- return (_glptr_GetPixelTexGenParameterfvSGIS) (GET_by_offset(disp, _gloffset_GetPixelTexGenParameterfvSGIS));
-}
-
-static INLINE void SET_GetPixelTexGenParameterfvSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetPixelTexGenParameterfvSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPixelTexGenParameterivSGIS)(GLenum, GLint *);
-#define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) \
- (* GET_GetPixelTexGenParameterivSGIS(disp)) parameters
-static INLINE _glptr_GetPixelTexGenParameterivSGIS GET_GetPixelTexGenParameterivSGIS(struct _glapi_table *disp) {
- return (_glptr_GetPixelTexGenParameterivSGIS) (GET_by_offset(disp, _gloffset_GetPixelTexGenParameterivSGIS));
-}
-
-static INLINE void SET_GetPixelTexGenParameterivSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetPixelTexGenParameterivSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTexGenParameterfSGIS)(GLenum, GLfloat);
-#define CALL_PixelTexGenParameterfSGIS(disp, parameters) \
- (* GET_PixelTexGenParameterfSGIS(disp)) parameters
-static INLINE _glptr_PixelTexGenParameterfSGIS GET_PixelTexGenParameterfSGIS(struct _glapi_table *disp) {
- return (_glptr_PixelTexGenParameterfSGIS) (GET_by_offset(disp, _gloffset_PixelTexGenParameterfSGIS));
-}
-
-static INLINE void SET_PixelTexGenParameterfSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_PixelTexGenParameterfSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTexGenParameterfvSGIS)(GLenum, const GLfloat *);
-#define CALL_PixelTexGenParameterfvSGIS(disp, parameters) \
- (* GET_PixelTexGenParameterfvSGIS(disp)) parameters
-static INLINE _glptr_PixelTexGenParameterfvSGIS GET_PixelTexGenParameterfvSGIS(struct _glapi_table *disp) {
- return (_glptr_PixelTexGenParameterfvSGIS) (GET_by_offset(disp, _gloffset_PixelTexGenParameterfvSGIS));
-}
-
-static INLINE void SET_PixelTexGenParameterfvSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_PixelTexGenParameterfvSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTexGenParameteriSGIS)(GLenum, GLint);
-#define CALL_PixelTexGenParameteriSGIS(disp, parameters) \
- (* GET_PixelTexGenParameteriSGIS(disp)) parameters
-static INLINE _glptr_PixelTexGenParameteriSGIS GET_PixelTexGenParameteriSGIS(struct _glapi_table *disp) {
- return (_glptr_PixelTexGenParameteriSGIS) (GET_by_offset(disp, _gloffset_PixelTexGenParameteriSGIS));
-}
-
-static INLINE void SET_PixelTexGenParameteriSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_PixelTexGenParameteriSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTexGenParameterivSGIS)(GLenum, const GLint *);
-#define CALL_PixelTexGenParameterivSGIS(disp, parameters) \
- (* GET_PixelTexGenParameterivSGIS(disp)) parameters
-static INLINE _glptr_PixelTexGenParameterivSGIS GET_PixelTexGenParameterivSGIS(struct _glapi_table *disp) {
- return (_glptr_PixelTexGenParameterivSGIS) (GET_by_offset(disp, _gloffset_PixelTexGenParameterivSGIS));
-}
-
-static INLINE void SET_PixelTexGenParameterivSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_PixelTexGenParameterivSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SampleMaskSGIS)(GLclampf, GLboolean);
-#define CALL_SampleMaskSGIS(disp, parameters) \
- (* GET_SampleMaskSGIS(disp)) parameters
-static INLINE _glptr_SampleMaskSGIS GET_SampleMaskSGIS(struct _glapi_table *disp) {
- return (_glptr_SampleMaskSGIS) (GET_by_offset(disp, _gloffset_SampleMaskSGIS));
-}
-
-static INLINE void SET_SampleMaskSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLboolean)) {
- SET_by_offset(disp, _gloffset_SampleMaskSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplePatternSGIS)(GLenum);
-#define CALL_SamplePatternSGIS(disp, parameters) \
- (* GET_SamplePatternSGIS(disp)) parameters
-static INLINE _glptr_SamplePatternSGIS GET_SamplePatternSGIS(struct _glapi_table *disp) {
- return (_glptr_SamplePatternSGIS) (GET_by_offset(disp, _gloffset_SamplePatternSGIS));
-}
-
-static INLINE void SET_SamplePatternSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_SamplePatternSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorPointerEXT)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
-#define CALL_ColorPointerEXT(disp, parameters) \
- (* GET_ColorPointerEXT(disp)) parameters
-static INLINE _glptr_ColorPointerEXT GET_ColorPointerEXT(struct _glapi_table *disp) {
- return (_glptr_ColorPointerEXT) (GET_by_offset(disp, _gloffset_ColorPointerEXT));
-}
-
-static INLINE void SET_ColorPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_ColorPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EdgeFlagPointerEXT)(GLsizei, GLsizei, const GLboolean *);
-#define CALL_EdgeFlagPointerEXT(disp, parameters) \
- (* GET_EdgeFlagPointerEXT(disp)) parameters
-static INLINE _glptr_EdgeFlagPointerEXT GET_EdgeFlagPointerEXT(struct _glapi_table *disp) {
- return (_glptr_EdgeFlagPointerEXT) (GET_by_offset(disp, _gloffset_EdgeFlagPointerEXT));
-}
-
-static INLINE void SET_EdgeFlagPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLsizei, const GLboolean *)) {
- SET_by_offset(disp, _gloffset_EdgeFlagPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_IndexPointerEXT)(GLenum, GLsizei, GLsizei, const GLvoid *);
-#define CALL_IndexPointerEXT(disp, parameters) \
- (* GET_IndexPointerEXT(disp)) parameters
-static INLINE _glptr_IndexPointerEXT GET_IndexPointerEXT(struct _glapi_table *disp) {
- return (_glptr_IndexPointerEXT) (GET_by_offset(disp, _gloffset_IndexPointerEXT));
-}
-
-static INLINE void SET_IndexPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_IndexPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_NormalPointerEXT)(GLenum, GLsizei, GLsizei, const GLvoid *);
-#define CALL_NormalPointerEXT(disp, parameters) \
- (* GET_NormalPointerEXT(disp)) parameters
-static INLINE _glptr_NormalPointerEXT GET_NormalPointerEXT(struct _glapi_table *disp) {
- return (_glptr_NormalPointerEXT) (GET_by_offset(disp, _gloffset_NormalPointerEXT));
-}
-
-static INLINE void SET_NormalPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_NormalPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordPointerEXT)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
-#define CALL_TexCoordPointerEXT(disp, parameters) \
- (* GET_TexCoordPointerEXT(disp)) parameters
-static INLINE _glptr_TexCoordPointerEXT GET_TexCoordPointerEXT(struct _glapi_table *disp) {
- return (_glptr_TexCoordPointerEXT) (GET_by_offset(disp, _gloffset_TexCoordPointerEXT));
-}
-
-static INLINE void SET_TexCoordPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_TexCoordPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexPointerEXT)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
-#define CALL_VertexPointerEXT(disp, parameters) \
- (* GET_VertexPointerEXT(disp)) parameters
-static INLINE _glptr_VertexPointerEXT GET_VertexPointerEXT(struct _glapi_table *disp) {
- return (_glptr_VertexPointerEXT) (GET_by_offset(disp, _gloffset_VertexPointerEXT));
-}
-
-static INLINE void SET_VertexPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_VertexPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PointParameterfEXT)(GLenum, GLfloat);
-#define CALL_PointParameterfEXT(disp, parameters) \
- (* GET_PointParameterfEXT(disp)) parameters
-static INLINE _glptr_PointParameterfEXT GET_PointParameterfEXT(struct _glapi_table *disp) {
- return (_glptr_PointParameterfEXT) (GET_by_offset(disp, _gloffset_PointParameterfEXT));
-}
-
-static INLINE void SET_PointParameterfEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_PointParameterfEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PointParameterfvEXT)(GLenum, const GLfloat *);
-#define CALL_PointParameterfvEXT(disp, parameters) \
- (* GET_PointParameterfvEXT(disp)) parameters
-static INLINE _glptr_PointParameterfvEXT GET_PointParameterfvEXT(struct _glapi_table *disp) {
- return (_glptr_PointParameterfvEXT) (GET_by_offset(disp, _gloffset_PointParameterfvEXT));
-}
-
-static INLINE void SET_PointParameterfvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_PointParameterfvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LockArraysEXT)(GLint, GLsizei);
-#define CALL_LockArraysEXT(disp, parameters) \
- (* GET_LockArraysEXT(disp)) parameters
-static INLINE _glptr_LockArraysEXT GET_LockArraysEXT(struct _glapi_table *disp) {
- return (_glptr_LockArraysEXT) (GET_by_offset(disp, _gloffset_LockArraysEXT));
-}
-
-static INLINE void SET_LockArraysEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei)) {
- SET_by_offset(disp, _gloffset_LockArraysEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UnlockArraysEXT)(void);
-#define CALL_UnlockArraysEXT(disp, parameters) \
- (* GET_UnlockArraysEXT(disp)) parameters
-static INLINE _glptr_UnlockArraysEXT GET_UnlockArraysEXT(struct _glapi_table *disp) {
- return (_glptr_UnlockArraysEXT) (GET_by_offset(disp, _gloffset_UnlockArraysEXT));
-}
-
-static INLINE void SET_UnlockArraysEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_UnlockArraysEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3bEXT)(GLbyte, GLbyte, GLbyte);
-#define CALL_SecondaryColor3bEXT(disp, parameters) \
- (* GET_SecondaryColor3bEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3bEXT GET_SecondaryColor3bEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3bEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3bEXT));
-}
-
-static INLINE void SET_SecondaryColor3bEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbyte, GLbyte, GLbyte)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3bEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3bvEXT)(const GLbyte *);
-#define CALL_SecondaryColor3bvEXT(disp, parameters) \
- (* GET_SecondaryColor3bvEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3bvEXT GET_SecondaryColor3bvEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3bvEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3bvEXT));
-}
-
-static INLINE void SET_SecondaryColor3bvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLbyte *)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3bvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3dEXT)(GLdouble, GLdouble, GLdouble);
-#define CALL_SecondaryColor3dEXT(disp, parameters) \
- (* GET_SecondaryColor3dEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3dEXT GET_SecondaryColor3dEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3dEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3dEXT));
-}
-
-static INLINE void SET_SecondaryColor3dEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3dEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3dvEXT)(const GLdouble *);
-#define CALL_SecondaryColor3dvEXT(disp, parameters) \
- (* GET_SecondaryColor3dvEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3dvEXT GET_SecondaryColor3dvEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3dvEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3dvEXT));
-}
-
-static INLINE void SET_SecondaryColor3dvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3dvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3fEXT)(GLfloat, GLfloat, GLfloat);
-#define CALL_SecondaryColor3fEXT(disp, parameters) \
- (* GET_SecondaryColor3fEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3fEXT GET_SecondaryColor3fEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3fEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3fEXT));
-}
-
-static INLINE void SET_SecondaryColor3fEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3fEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3fvEXT)(const GLfloat *);
-#define CALL_SecondaryColor3fvEXT(disp, parameters) \
- (* GET_SecondaryColor3fvEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3fvEXT GET_SecondaryColor3fvEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3fvEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3fvEXT));
-}
-
-static INLINE void SET_SecondaryColor3fvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3fvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3iEXT)(GLint, GLint, GLint);
-#define CALL_SecondaryColor3iEXT(disp, parameters) \
- (* GET_SecondaryColor3iEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3iEXT GET_SecondaryColor3iEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3iEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3iEXT));
-}
-
-static INLINE void SET_SecondaryColor3iEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3iEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3ivEXT)(const GLint *);
-#define CALL_SecondaryColor3ivEXT(disp, parameters) \
- (* GET_SecondaryColor3ivEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3ivEXT GET_SecondaryColor3ivEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3ivEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3ivEXT));
-}
-
-static INLINE void SET_SecondaryColor3ivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3ivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3sEXT)(GLshort, GLshort, GLshort);
-#define CALL_SecondaryColor3sEXT(disp, parameters) \
- (* GET_SecondaryColor3sEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3sEXT GET_SecondaryColor3sEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3sEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3sEXT));
-}
-
-static INLINE void SET_SecondaryColor3sEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3sEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3svEXT)(const GLshort *);
-#define CALL_SecondaryColor3svEXT(disp, parameters) \
- (* GET_SecondaryColor3svEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3svEXT GET_SecondaryColor3svEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3svEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3svEXT));
-}
-
-static INLINE void SET_SecondaryColor3svEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3svEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3ubEXT)(GLubyte, GLubyte, GLubyte);
-#define CALL_SecondaryColor3ubEXT(disp, parameters) \
- (* GET_SecondaryColor3ubEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3ubEXT GET_SecondaryColor3ubEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3ubEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3ubEXT));
-}
-
-static INLINE void SET_SecondaryColor3ubEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLubyte, GLubyte, GLubyte)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3ubEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3ubvEXT)(const GLubyte *);
-#define CALL_SecondaryColor3ubvEXT(disp, parameters) \
- (* GET_SecondaryColor3ubvEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3ubvEXT GET_SecondaryColor3ubvEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3ubvEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3ubvEXT));
-}
-
-static INLINE void SET_SecondaryColor3ubvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLubyte *)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3ubvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3uiEXT)(GLuint, GLuint, GLuint);
-#define CALL_SecondaryColor3uiEXT(disp, parameters) \
- (* GET_SecondaryColor3uiEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3uiEXT GET_SecondaryColor3uiEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3uiEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3uiEXT));
-}
-
-static INLINE void SET_SecondaryColor3uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3uivEXT)(const GLuint *);
-#define CALL_SecondaryColor3uivEXT(disp, parameters) \
- (* GET_SecondaryColor3uivEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3uivEXT GET_SecondaryColor3uivEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3uivEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3uivEXT));
-}
-
-static INLINE void SET_SecondaryColor3uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLuint *)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3usEXT)(GLushort, GLushort, GLushort);
-#define CALL_SecondaryColor3usEXT(disp, parameters) \
- (* GET_SecondaryColor3usEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3usEXT GET_SecondaryColor3usEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3usEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3usEXT));
-}
-
-static INLINE void SET_SecondaryColor3usEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLushort, GLushort, GLushort)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3usEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3usvEXT)(const GLushort *);
-#define CALL_SecondaryColor3usvEXT(disp, parameters) \
- (* GET_SecondaryColor3usvEXT(disp)) parameters
-static INLINE _glptr_SecondaryColor3usvEXT GET_SecondaryColor3usvEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColor3usvEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3usvEXT));
-}
-
-static INLINE void SET_SecondaryColor3usvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLushort *)) {
- SET_by_offset(disp, _gloffset_SecondaryColor3usvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColorPointerEXT)(GLint, GLenum, GLsizei, const GLvoid *);
-#define CALL_SecondaryColorPointerEXT(disp, parameters) \
- (* GET_SecondaryColorPointerEXT(disp)) parameters
-static INLINE _glptr_SecondaryColorPointerEXT GET_SecondaryColorPointerEXT(struct _glapi_table *disp) {
- return (_glptr_SecondaryColorPointerEXT) (GET_by_offset(disp, _gloffset_SecondaryColorPointerEXT));
-}
-
-static INLINE void SET_SecondaryColorPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_SecondaryColorPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiDrawArraysEXT)(GLenum, const GLint *, const GLsizei *, GLsizei);
-#define CALL_MultiDrawArraysEXT(disp, parameters) \
- (* GET_MultiDrawArraysEXT(disp)) parameters
-static INLINE _glptr_MultiDrawArraysEXT GET_MultiDrawArraysEXT(struct _glapi_table *disp) {
- return (_glptr_MultiDrawArraysEXT) (GET_by_offset(disp, _gloffset_MultiDrawArraysEXT));
-}
-
-static INLINE void SET_MultiDrawArraysEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *, const GLsizei *, GLsizei)) {
- SET_by_offset(disp, _gloffset_MultiDrawArraysEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiDrawElementsEXT)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei);
-#define CALL_MultiDrawElementsEXT(disp, parameters) \
- (* GET_MultiDrawElementsEXT(disp)) parameters
-static INLINE _glptr_MultiDrawElementsEXT GET_MultiDrawElementsEXT(struct _glapi_table *disp) {
- return (_glptr_MultiDrawElementsEXT) (GET_by_offset(disp, _gloffset_MultiDrawElementsEXT));
-}
-
-static INLINE void SET_MultiDrawElementsEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei)) {
- SET_by_offset(disp, _gloffset_MultiDrawElementsEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FogCoordPointerEXT)(GLenum, GLsizei, const GLvoid *);
-#define CALL_FogCoordPointerEXT(disp, parameters) \
- (* GET_FogCoordPointerEXT(disp)) parameters
-static INLINE _glptr_FogCoordPointerEXT GET_FogCoordPointerEXT(struct _glapi_table *disp) {
- return (_glptr_FogCoordPointerEXT) (GET_by_offset(disp, _gloffset_FogCoordPointerEXT));
-}
-
-static INLINE void SET_FogCoordPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_FogCoordPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FogCoorddEXT)(GLdouble);
-#define CALL_FogCoorddEXT(disp, parameters) \
- (* GET_FogCoorddEXT(disp)) parameters
-static INLINE _glptr_FogCoorddEXT GET_FogCoorddEXT(struct _glapi_table *disp) {
- return (_glptr_FogCoorddEXT) (GET_by_offset(disp, _gloffset_FogCoorddEXT));
-}
-
-static INLINE void SET_FogCoorddEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble)) {
- SET_by_offset(disp, _gloffset_FogCoorddEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FogCoorddvEXT)(const GLdouble *);
-#define CALL_FogCoorddvEXT(disp, parameters) \
- (* GET_FogCoorddvEXT(disp)) parameters
-static INLINE _glptr_FogCoorddvEXT GET_FogCoorddvEXT(struct _glapi_table *disp) {
- return (_glptr_FogCoorddvEXT) (GET_by_offset(disp, _gloffset_FogCoorddvEXT));
-}
-
-static INLINE void SET_FogCoorddvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_FogCoorddvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FogCoordfEXT)(GLfloat);
-#define CALL_FogCoordfEXT(disp, parameters) \
- (* GET_FogCoordfEXT(disp)) parameters
-static INLINE _glptr_FogCoordfEXT GET_FogCoordfEXT(struct _glapi_table *disp) {
- return (_glptr_FogCoordfEXT) (GET_by_offset(disp, _gloffset_FogCoordfEXT));
-}
-
-static INLINE void SET_FogCoordfEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
- SET_by_offset(disp, _gloffset_FogCoordfEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FogCoordfvEXT)(const GLfloat *);
-#define CALL_FogCoordfvEXT(disp, parameters) \
- (* GET_FogCoordfvEXT(disp)) parameters
-static INLINE _glptr_FogCoordfvEXT GET_FogCoordfvEXT(struct _glapi_table *disp) {
- return (_glptr_FogCoordfvEXT) (GET_by_offset(disp, _gloffset_FogCoordfvEXT));
-}
-
-static INLINE void SET_FogCoordfvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_FogCoordfvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTexGenSGIX)(GLenum);
-#define CALL_PixelTexGenSGIX(disp, parameters) \
- (* GET_PixelTexGenSGIX(disp)) parameters
-static INLINE _glptr_PixelTexGenSGIX GET_PixelTexGenSGIX(struct _glapi_table *disp) {
- return (_glptr_PixelTexGenSGIX) (GET_by_offset(disp, _gloffset_PixelTexGenSGIX));
-}
-
-static INLINE void SET_PixelTexGenSGIX(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_PixelTexGenSGIX, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendFuncSeparateEXT)(GLenum, GLenum, GLenum, GLenum);
-#define CALL_BlendFuncSeparateEXT(disp, parameters) \
- (* GET_BlendFuncSeparateEXT(disp)) parameters
-static INLINE _glptr_BlendFuncSeparateEXT GET_BlendFuncSeparateEXT(struct _glapi_table *disp) {
- return (_glptr_BlendFuncSeparateEXT) (GET_by_offset(disp, _gloffset_BlendFuncSeparateEXT));
-}
-
-static INLINE void SET_BlendFuncSeparateEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_BlendFuncSeparateEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FlushVertexArrayRangeNV)(void);
-#define CALL_FlushVertexArrayRangeNV(disp, parameters) \
- (* GET_FlushVertexArrayRangeNV(disp)) parameters
-static INLINE _glptr_FlushVertexArrayRangeNV GET_FlushVertexArrayRangeNV(struct _glapi_table *disp) {
- return (_glptr_FlushVertexArrayRangeNV) (GET_by_offset(disp, _gloffset_FlushVertexArrayRangeNV));
-}
-
-static INLINE void SET_FlushVertexArrayRangeNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_FlushVertexArrayRangeNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexArrayRangeNV)(GLsizei, const GLvoid *);
-#define CALL_VertexArrayRangeNV(disp, parameters) \
- (* GET_VertexArrayRangeNV(disp)) parameters
-static INLINE _glptr_VertexArrayRangeNV GET_VertexArrayRangeNV(struct _glapi_table *disp) {
- return (_glptr_VertexArrayRangeNV) (GET_by_offset(disp, _gloffset_VertexArrayRangeNV));
-}
-
-static INLINE void SET_VertexArrayRangeNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_VertexArrayRangeNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerInputNV)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum);
-#define CALL_CombinerInputNV(disp, parameters) \
- (* GET_CombinerInputNV(disp)) parameters
-static INLINE _glptr_CombinerInputNV GET_CombinerInputNV(struct _glapi_table *disp) {
- return (_glptr_CombinerInputNV) (GET_by_offset(disp, _gloffset_CombinerInputNV));
-}
-
-static INLINE void SET_CombinerInputNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_CombinerInputNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerOutputNV)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean);
-#define CALL_CombinerOutputNV(disp, parameters) \
- (* GET_CombinerOutputNV(disp)) parameters
-static INLINE _glptr_CombinerOutputNV GET_CombinerOutputNV(struct _glapi_table *disp) {
- return (_glptr_CombinerOutputNV) (GET_by_offset(disp, _gloffset_CombinerOutputNV));
-}
-
-static INLINE void SET_CombinerOutputNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean)) {
- SET_by_offset(disp, _gloffset_CombinerOutputNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerParameterfNV)(GLenum, GLfloat);
-#define CALL_CombinerParameterfNV(disp, parameters) \
- (* GET_CombinerParameterfNV(disp)) parameters
-static INLINE _glptr_CombinerParameterfNV GET_CombinerParameterfNV(struct _glapi_table *disp) {
- return (_glptr_CombinerParameterfNV) (GET_by_offset(disp, _gloffset_CombinerParameterfNV));
-}
-
-static INLINE void SET_CombinerParameterfNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
- SET_by_offset(disp, _gloffset_CombinerParameterfNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerParameterfvNV)(GLenum, const GLfloat *);
-#define CALL_CombinerParameterfvNV(disp, parameters) \
- (* GET_CombinerParameterfvNV(disp)) parameters
-static INLINE _glptr_CombinerParameterfvNV GET_CombinerParameterfvNV(struct _glapi_table *disp) {
- return (_glptr_CombinerParameterfvNV) (GET_by_offset(disp, _gloffset_CombinerParameterfvNV));
-}
-
-static INLINE void SET_CombinerParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_CombinerParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerParameteriNV)(GLenum, GLint);
-#define CALL_CombinerParameteriNV(disp, parameters) \
- (* GET_CombinerParameteriNV(disp)) parameters
-static INLINE _glptr_CombinerParameteriNV GET_CombinerParameteriNV(struct _glapi_table *disp) {
- return (_glptr_CombinerParameteriNV) (GET_by_offset(disp, _gloffset_CombinerParameteriNV));
-}
-
-static INLINE void SET_CombinerParameteriNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_CombinerParameteriNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerParameterivNV)(GLenum, const GLint *);
-#define CALL_CombinerParameterivNV(disp, parameters) \
- (* GET_CombinerParameterivNV(disp)) parameters
-static INLINE _glptr_CombinerParameterivNV GET_CombinerParameterivNV(struct _glapi_table *disp) {
- return (_glptr_CombinerParameterivNV) (GET_by_offset(disp, _gloffset_CombinerParameterivNV));
-}
-
-static INLINE void SET_CombinerParameterivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_CombinerParameterivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FinalCombinerInputNV)(GLenum, GLenum, GLenum, GLenum);
-#define CALL_FinalCombinerInputNV(disp, parameters) \
- (* GET_FinalCombinerInputNV(disp)) parameters
-static INLINE _glptr_FinalCombinerInputNV GET_FinalCombinerInputNV(struct _glapi_table *disp) {
- return (_glptr_FinalCombinerInputNV) (GET_by_offset(disp, _gloffset_FinalCombinerInputNV));
-}
-
-static INLINE void SET_FinalCombinerInputNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_FinalCombinerInputNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCombinerInputParameterfvNV)(GLenum, GLenum, GLenum, GLenum, GLfloat *);
-#define CALL_GetCombinerInputParameterfvNV(disp, parameters) \
- (* GET_GetCombinerInputParameterfvNV(disp)) parameters
-static INLINE _glptr_GetCombinerInputParameterfvNV GET_GetCombinerInputParameterfvNV(struct _glapi_table *disp) {
- return (_glptr_GetCombinerInputParameterfvNV) (GET_by_offset(disp, _gloffset_GetCombinerInputParameterfvNV));
-}
-
-static INLINE void SET_GetCombinerInputParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetCombinerInputParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCombinerInputParameterivNV)(GLenum, GLenum, GLenum, GLenum, GLint *);
-#define CALL_GetCombinerInputParameterivNV(disp, parameters) \
- (* GET_GetCombinerInputParameterivNV(disp)) parameters
-static INLINE _glptr_GetCombinerInputParameterivNV GET_GetCombinerInputParameterivNV(struct _glapi_table *disp) {
- return (_glptr_GetCombinerInputParameterivNV) (GET_by_offset(disp, _gloffset_GetCombinerInputParameterivNV));
-}
-
-static INLINE void SET_GetCombinerInputParameterivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetCombinerInputParameterivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCombinerOutputParameterfvNV)(GLenum, GLenum, GLenum, GLfloat *);
-#define CALL_GetCombinerOutputParameterfvNV(disp, parameters) \
- (* GET_GetCombinerOutputParameterfvNV(disp)) parameters
-static INLINE _glptr_GetCombinerOutputParameterfvNV GET_GetCombinerOutputParameterfvNV(struct _glapi_table *disp) {
- return (_glptr_GetCombinerOutputParameterfvNV) (GET_by_offset(disp, _gloffset_GetCombinerOutputParameterfvNV));
-}
-
-static INLINE void SET_GetCombinerOutputParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetCombinerOutputParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCombinerOutputParameterivNV)(GLenum, GLenum, GLenum, GLint *);
-#define CALL_GetCombinerOutputParameterivNV(disp, parameters) \
- (* GET_GetCombinerOutputParameterivNV(disp)) parameters
-static INLINE _glptr_GetCombinerOutputParameterivNV GET_GetCombinerOutputParameterivNV(struct _glapi_table *disp) {
- return (_glptr_GetCombinerOutputParameterivNV) (GET_by_offset(disp, _gloffset_GetCombinerOutputParameterivNV));
-}
-
-static INLINE void SET_GetCombinerOutputParameterivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetCombinerOutputParameterivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetFinalCombinerInputParameterfvNV)(GLenum, GLenum, GLfloat *);
-#define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) \
- (* GET_GetFinalCombinerInputParameterfvNV(disp)) parameters
-static INLINE _glptr_GetFinalCombinerInputParameterfvNV GET_GetFinalCombinerInputParameterfvNV(struct _glapi_table *disp) {
- return (_glptr_GetFinalCombinerInputParameterfvNV) (GET_by_offset(disp, _gloffset_GetFinalCombinerInputParameterfvNV));
-}
-
-static INLINE void SET_GetFinalCombinerInputParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetFinalCombinerInputParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetFinalCombinerInputParameterivNV)(GLenum, GLenum, GLint *);
-#define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) \
- (* GET_GetFinalCombinerInputParameterivNV(disp)) parameters
-static INLINE _glptr_GetFinalCombinerInputParameterivNV GET_GetFinalCombinerInputParameterivNV(struct _glapi_table *disp) {
- return (_glptr_GetFinalCombinerInputParameterivNV) (GET_by_offset(disp, _gloffset_GetFinalCombinerInputParameterivNV));
-}
-
-static INLINE void SET_GetFinalCombinerInputParameterivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetFinalCombinerInputParameterivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ResizeBuffersMESA)(void);
-#define CALL_ResizeBuffersMESA(disp, parameters) \
- (* GET_ResizeBuffersMESA(disp)) parameters
-static INLINE _glptr_ResizeBuffersMESA GET_ResizeBuffersMESA(struct _glapi_table *disp) {
- return (_glptr_ResizeBuffersMESA) (GET_by_offset(disp, _gloffset_ResizeBuffersMESA));
-}
-
-static INLINE void SET_ResizeBuffersMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_ResizeBuffersMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2dMESA)(GLdouble, GLdouble);
-#define CALL_WindowPos2dMESA(disp, parameters) \
- (* GET_WindowPos2dMESA(disp)) parameters
-static INLINE _glptr_WindowPos2dMESA GET_WindowPos2dMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos2dMESA) (GET_by_offset(disp, _gloffset_WindowPos2dMESA));
-}
-
-static INLINE void SET_WindowPos2dMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_WindowPos2dMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2dvMESA)(const GLdouble *);
-#define CALL_WindowPos2dvMESA(disp, parameters) \
- (* GET_WindowPos2dvMESA(disp)) parameters
-static INLINE _glptr_WindowPos2dvMESA GET_WindowPos2dvMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos2dvMESA) (GET_by_offset(disp, _gloffset_WindowPos2dvMESA));
-}
-
-static INLINE void SET_WindowPos2dvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_WindowPos2dvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2fMESA)(GLfloat, GLfloat);
-#define CALL_WindowPos2fMESA(disp, parameters) \
- (* GET_WindowPos2fMESA(disp)) parameters
-static INLINE _glptr_WindowPos2fMESA GET_WindowPos2fMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos2fMESA) (GET_by_offset(disp, _gloffset_WindowPos2fMESA));
-}
-
-static INLINE void SET_WindowPos2fMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_WindowPos2fMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2fvMESA)(const GLfloat *);
-#define CALL_WindowPos2fvMESA(disp, parameters) \
- (* GET_WindowPos2fvMESA(disp)) parameters
-static INLINE _glptr_WindowPos2fvMESA GET_WindowPos2fvMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos2fvMESA) (GET_by_offset(disp, _gloffset_WindowPos2fvMESA));
-}
-
-static INLINE void SET_WindowPos2fvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_WindowPos2fvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2iMESA)(GLint, GLint);
-#define CALL_WindowPos2iMESA(disp, parameters) \
- (* GET_WindowPos2iMESA(disp)) parameters
-static INLINE _glptr_WindowPos2iMESA GET_WindowPos2iMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos2iMESA) (GET_by_offset(disp, _gloffset_WindowPos2iMESA));
-}
-
-static INLINE void SET_WindowPos2iMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
- SET_by_offset(disp, _gloffset_WindowPos2iMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2ivMESA)(const GLint *);
-#define CALL_WindowPos2ivMESA(disp, parameters) \
- (* GET_WindowPos2ivMESA(disp)) parameters
-static INLINE _glptr_WindowPos2ivMESA GET_WindowPos2ivMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos2ivMESA) (GET_by_offset(disp, _gloffset_WindowPos2ivMESA));
-}
-
-static INLINE void SET_WindowPos2ivMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_WindowPos2ivMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2sMESA)(GLshort, GLshort);
-#define CALL_WindowPos2sMESA(disp, parameters) \
- (* GET_WindowPos2sMESA(disp)) parameters
-static INLINE _glptr_WindowPos2sMESA GET_WindowPos2sMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos2sMESA) (GET_by_offset(disp, _gloffset_WindowPos2sMESA));
-}
-
-static INLINE void SET_WindowPos2sMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_WindowPos2sMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2svMESA)(const GLshort *);
-#define CALL_WindowPos2svMESA(disp, parameters) \
- (* GET_WindowPos2svMESA(disp)) parameters
-static INLINE _glptr_WindowPos2svMESA GET_WindowPos2svMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos2svMESA) (GET_by_offset(disp, _gloffset_WindowPos2svMESA));
-}
-
-static INLINE void SET_WindowPos2svMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_WindowPos2svMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3dMESA)(GLdouble, GLdouble, GLdouble);
-#define CALL_WindowPos3dMESA(disp, parameters) \
- (* GET_WindowPos3dMESA(disp)) parameters
-static INLINE _glptr_WindowPos3dMESA GET_WindowPos3dMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos3dMESA) (GET_by_offset(disp, _gloffset_WindowPos3dMESA));
-}
-
-static INLINE void SET_WindowPos3dMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_WindowPos3dMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3dvMESA)(const GLdouble *);
-#define CALL_WindowPos3dvMESA(disp, parameters) \
- (* GET_WindowPos3dvMESA(disp)) parameters
-static INLINE _glptr_WindowPos3dvMESA GET_WindowPos3dvMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos3dvMESA) (GET_by_offset(disp, _gloffset_WindowPos3dvMESA));
-}
-
-static INLINE void SET_WindowPos3dvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_WindowPos3dvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3fMESA)(GLfloat, GLfloat, GLfloat);
-#define CALL_WindowPos3fMESA(disp, parameters) \
- (* GET_WindowPos3fMESA(disp)) parameters
-static INLINE _glptr_WindowPos3fMESA GET_WindowPos3fMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos3fMESA) (GET_by_offset(disp, _gloffset_WindowPos3fMESA));
-}
-
-static INLINE void SET_WindowPos3fMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_WindowPos3fMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3fvMESA)(const GLfloat *);
-#define CALL_WindowPos3fvMESA(disp, parameters) \
- (* GET_WindowPos3fvMESA(disp)) parameters
-static INLINE _glptr_WindowPos3fvMESA GET_WindowPos3fvMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos3fvMESA) (GET_by_offset(disp, _gloffset_WindowPos3fvMESA));
-}
-
-static INLINE void SET_WindowPos3fvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_WindowPos3fvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3iMESA)(GLint, GLint, GLint);
-#define CALL_WindowPos3iMESA(disp, parameters) \
- (* GET_WindowPos3iMESA(disp)) parameters
-static INLINE _glptr_WindowPos3iMESA GET_WindowPos3iMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos3iMESA) (GET_by_offset(disp, _gloffset_WindowPos3iMESA));
-}
-
-static INLINE void SET_WindowPos3iMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_WindowPos3iMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3ivMESA)(const GLint *);
-#define CALL_WindowPos3ivMESA(disp, parameters) \
- (* GET_WindowPos3ivMESA(disp)) parameters
-static INLINE _glptr_WindowPos3ivMESA GET_WindowPos3ivMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos3ivMESA) (GET_by_offset(disp, _gloffset_WindowPos3ivMESA));
-}
-
-static INLINE void SET_WindowPos3ivMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_WindowPos3ivMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3sMESA)(GLshort, GLshort, GLshort);
-#define CALL_WindowPos3sMESA(disp, parameters) \
- (* GET_WindowPos3sMESA(disp)) parameters
-static INLINE _glptr_WindowPos3sMESA GET_WindowPos3sMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos3sMESA) (GET_by_offset(disp, _gloffset_WindowPos3sMESA));
-}
-
-static INLINE void SET_WindowPos3sMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_WindowPos3sMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3svMESA)(const GLshort *);
-#define CALL_WindowPos3svMESA(disp, parameters) \
- (* GET_WindowPos3svMESA(disp)) parameters
-static INLINE _glptr_WindowPos3svMESA GET_WindowPos3svMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos3svMESA) (GET_by_offset(disp, _gloffset_WindowPos3svMESA));
-}
-
-static INLINE void SET_WindowPos3svMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_WindowPos3svMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4dMESA)(GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_WindowPos4dMESA(disp, parameters) \
- (* GET_WindowPos4dMESA(disp)) parameters
-static INLINE _glptr_WindowPos4dMESA GET_WindowPos4dMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos4dMESA) (GET_by_offset(disp, _gloffset_WindowPos4dMESA));
-}
-
-static INLINE void SET_WindowPos4dMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_WindowPos4dMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4dvMESA)(const GLdouble *);
-#define CALL_WindowPos4dvMESA(disp, parameters) \
- (* GET_WindowPos4dvMESA(disp)) parameters
-static INLINE _glptr_WindowPos4dvMESA GET_WindowPos4dvMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos4dvMESA) (GET_by_offset(disp, _gloffset_WindowPos4dvMESA));
-}
-
-static INLINE void SET_WindowPos4dvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
- SET_by_offset(disp, _gloffset_WindowPos4dvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4fMESA)(GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_WindowPos4fMESA(disp, parameters) \
- (* GET_WindowPos4fMESA(disp)) parameters
-static INLINE _glptr_WindowPos4fMESA GET_WindowPos4fMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos4fMESA) (GET_by_offset(disp, _gloffset_WindowPos4fMESA));
-}
-
-static INLINE void SET_WindowPos4fMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_WindowPos4fMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4fvMESA)(const GLfloat *);
-#define CALL_WindowPos4fvMESA(disp, parameters) \
- (* GET_WindowPos4fvMESA(disp)) parameters
-static INLINE _glptr_WindowPos4fvMESA GET_WindowPos4fvMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos4fvMESA) (GET_by_offset(disp, _gloffset_WindowPos4fvMESA));
-}
-
-static INLINE void SET_WindowPos4fvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
- SET_by_offset(disp, _gloffset_WindowPos4fvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4iMESA)(GLint, GLint, GLint, GLint);
-#define CALL_WindowPos4iMESA(disp, parameters) \
- (* GET_WindowPos4iMESA(disp)) parameters
-static INLINE _glptr_WindowPos4iMESA GET_WindowPos4iMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos4iMESA) (GET_by_offset(disp, _gloffset_WindowPos4iMESA));
-}
-
-static INLINE void SET_WindowPos4iMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_WindowPos4iMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4ivMESA)(const GLint *);
-#define CALL_WindowPos4ivMESA(disp, parameters) \
- (* GET_WindowPos4ivMESA(disp)) parameters
-static INLINE _glptr_WindowPos4ivMESA GET_WindowPos4ivMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos4ivMESA) (GET_by_offset(disp, _gloffset_WindowPos4ivMESA));
-}
-
-static INLINE void SET_WindowPos4ivMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
- SET_by_offset(disp, _gloffset_WindowPos4ivMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4sMESA)(GLshort, GLshort, GLshort, GLshort);
-#define CALL_WindowPos4sMESA(disp, parameters) \
- (* GET_WindowPos4sMESA(disp)) parameters
-static INLINE _glptr_WindowPos4sMESA GET_WindowPos4sMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos4sMESA) (GET_by_offset(disp, _gloffset_WindowPos4sMESA));
-}
-
-static INLINE void SET_WindowPos4sMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_WindowPos4sMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4svMESA)(const GLshort *);
-#define CALL_WindowPos4svMESA(disp, parameters) \
- (* GET_WindowPos4svMESA(disp)) parameters
-static INLINE _glptr_WindowPos4svMESA GET_WindowPos4svMESA(struct _glapi_table *disp) {
- return (_glptr_WindowPos4svMESA) (GET_by_offset(disp, _gloffset_WindowPos4svMESA));
-}
-
-static INLINE void SET_WindowPos4svMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
- SET_by_offset(disp, _gloffset_WindowPos4svMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiModeDrawArraysIBM)(const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint);
-#define CALL_MultiModeDrawArraysIBM(disp, parameters) \
- (* GET_MultiModeDrawArraysIBM(disp)) parameters
-static INLINE _glptr_MultiModeDrawArraysIBM GET_MultiModeDrawArraysIBM(struct _glapi_table *disp) {
- return (_glptr_MultiModeDrawArraysIBM) (GET_by_offset(disp, _gloffset_MultiModeDrawArraysIBM));
-}
-
-static INLINE void SET_MultiModeDrawArraysIBM(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint)) {
- SET_by_offset(disp, _gloffset_MultiModeDrawArraysIBM, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiModeDrawElementsIBM)(const GLenum *, const GLsizei *, GLenum, const GLvoid * const *, GLsizei, GLint);
-#define CALL_MultiModeDrawElementsIBM(disp, parameters) \
- (* GET_MultiModeDrawElementsIBM(disp)) parameters
-static INLINE _glptr_MultiModeDrawElementsIBM GET_MultiModeDrawElementsIBM(struct _glapi_table *disp) {
- return (_glptr_MultiModeDrawElementsIBM) (GET_by_offset(disp, _gloffset_MultiModeDrawElementsIBM));
-}
-
-static INLINE void SET_MultiModeDrawElementsIBM(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLenum *, const GLsizei *, GLenum, const GLvoid * const *, GLsizei, GLint)) {
- SET_by_offset(disp, _gloffset_MultiModeDrawElementsIBM, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteFencesNV)(GLsizei, const GLuint *);
-#define CALL_DeleteFencesNV(disp, parameters) \
- (* GET_DeleteFencesNV(disp)) parameters
-static INLINE _glptr_DeleteFencesNV GET_DeleteFencesNV(struct _glapi_table *disp) {
- return (_glptr_DeleteFencesNV) (GET_by_offset(disp, _gloffset_DeleteFencesNV));
-}
-
-static INLINE void SET_DeleteFencesNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_DeleteFencesNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FinishFenceNV)(GLuint);
-#define CALL_FinishFenceNV(disp, parameters) \
- (* GET_FinishFenceNV(disp)) parameters
-static INLINE _glptr_FinishFenceNV GET_FinishFenceNV(struct _glapi_table *disp) {
- return (_glptr_FinishFenceNV) (GET_by_offset(disp, _gloffset_FinishFenceNV));
-}
-
-static INLINE void SET_FinishFenceNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_FinishFenceNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenFencesNV)(GLsizei, GLuint *);
-#define CALL_GenFencesNV(disp, parameters) \
- (* GET_GenFencesNV(disp)) parameters
-static INLINE _glptr_GenFencesNV GET_GenFencesNV(struct _glapi_table *disp) {
- return (_glptr_GenFencesNV) (GET_by_offset(disp, _gloffset_GenFencesNV));
-}
-
-static INLINE void SET_GenFencesNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenFencesNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetFenceivNV)(GLuint, GLenum, GLint *);
-#define CALL_GetFenceivNV(disp, parameters) \
- (* GET_GetFenceivNV(disp)) parameters
-static INLINE _glptr_GetFenceivNV GET_GetFenceivNV(struct _glapi_table *disp) {
- return (_glptr_GetFenceivNV) (GET_by_offset(disp, _gloffset_GetFenceivNV));
-}
-
-static INLINE void SET_GetFenceivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetFenceivNV, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsFenceNV)(GLuint);
-#define CALL_IsFenceNV(disp, parameters) \
- (* GET_IsFenceNV(disp)) parameters
-static INLINE _glptr_IsFenceNV GET_IsFenceNV(struct _glapi_table *disp) {
- return (_glptr_IsFenceNV) (GET_by_offset(disp, _gloffset_IsFenceNV));
-}
-
-static INLINE void SET_IsFenceNV(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsFenceNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SetFenceNV)(GLuint, GLenum);
-#define CALL_SetFenceNV(disp, parameters) \
- (* GET_SetFenceNV(disp)) parameters
-static INLINE _glptr_SetFenceNV GET_SetFenceNV(struct _glapi_table *disp) {
- return (_glptr_SetFenceNV) (GET_by_offset(disp, _gloffset_SetFenceNV));
-}
-
-static INLINE void SET_SetFenceNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum)) {
- SET_by_offset(disp, _gloffset_SetFenceNV, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_TestFenceNV)(GLuint);
-#define CALL_TestFenceNV(disp, parameters) \
- (* GET_TestFenceNV(disp)) parameters
-static INLINE _glptr_TestFenceNV GET_TestFenceNV(struct _glapi_table *disp) {
- return (_glptr_TestFenceNV) (GET_by_offset(disp, _gloffset_TestFenceNV));
-}
-
-static INLINE void SET_TestFenceNV(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_TestFenceNV, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_AreProgramsResidentNV)(GLsizei, const GLuint *, GLboolean *);
-#define CALL_AreProgramsResidentNV(disp, parameters) \
- (* GET_AreProgramsResidentNV(disp)) parameters
-static INLINE _glptr_AreProgramsResidentNV GET_AreProgramsResidentNV(struct _glapi_table *disp) {
- return (_glptr_AreProgramsResidentNV) (GET_by_offset(disp, _gloffset_AreProgramsResidentNV));
-}
-
-static INLINE void SET_AreProgramsResidentNV(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLsizei, const GLuint *, GLboolean *)) {
- SET_by_offset(disp, _gloffset_AreProgramsResidentNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindProgramNV)(GLenum, GLuint);
-#define CALL_BindProgramNV(disp, parameters) \
- (* GET_BindProgramNV(disp)) parameters
-static INLINE _glptr_BindProgramNV GET_BindProgramNV(struct _glapi_table *disp) {
- return (_glptr_BindProgramNV) (GET_by_offset(disp, _gloffset_BindProgramNV));
-}
-
-static INLINE void SET_BindProgramNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_BindProgramNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteProgramsNV)(GLsizei, const GLuint *);
-#define CALL_DeleteProgramsNV(disp, parameters) \
- (* GET_DeleteProgramsNV(disp)) parameters
-static INLINE _glptr_DeleteProgramsNV GET_DeleteProgramsNV(struct _glapi_table *disp) {
- return (_glptr_DeleteProgramsNV) (GET_by_offset(disp, _gloffset_DeleteProgramsNV));
-}
-
-static INLINE void SET_DeleteProgramsNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_DeleteProgramsNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ExecuteProgramNV)(GLenum, GLuint, const GLfloat *);
-#define CALL_ExecuteProgramNV(disp, parameters) \
- (* GET_ExecuteProgramNV(disp)) parameters
-static INLINE _glptr_ExecuteProgramNV GET_ExecuteProgramNV(struct _glapi_table *disp) {
- return (_glptr_ExecuteProgramNV) (GET_by_offset(disp, _gloffset_ExecuteProgramNV));
-}
-
-static INLINE void SET_ExecuteProgramNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_ExecuteProgramNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenProgramsNV)(GLsizei, GLuint *);
-#define CALL_GenProgramsNV(disp, parameters) \
- (* GET_GenProgramsNV(disp)) parameters
-static INLINE _glptr_GenProgramsNV GET_GenProgramsNV(struct _glapi_table *disp) {
- return (_glptr_GenProgramsNV) (GET_by_offset(disp, _gloffset_GenProgramsNV));
-}
-
-static INLINE void SET_GenProgramsNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenProgramsNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramParameterdvNV)(GLenum, GLuint, GLenum, GLdouble *);
-#define CALL_GetProgramParameterdvNV(disp, parameters) \
- (* GET_GetProgramParameterdvNV(disp)) parameters
-static INLINE _glptr_GetProgramParameterdvNV GET_GetProgramParameterdvNV(struct _glapi_table *disp) {
- return (_glptr_GetProgramParameterdvNV) (GET_by_offset(disp, _gloffset_GetProgramParameterdvNV));
-}
-
-static INLINE void SET_GetProgramParameterdvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetProgramParameterdvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramParameterfvNV)(GLenum, GLuint, GLenum, GLfloat *);
-#define CALL_GetProgramParameterfvNV(disp, parameters) \
- (* GET_GetProgramParameterfvNV(disp)) parameters
-static INLINE _glptr_GetProgramParameterfvNV GET_GetProgramParameterfvNV(struct _glapi_table *disp) {
- return (_glptr_GetProgramParameterfvNV) (GET_by_offset(disp, _gloffset_GetProgramParameterfvNV));
-}
-
-static INLINE void SET_GetProgramParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetProgramParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramStringNV)(GLuint, GLenum, GLubyte *);
-#define CALL_GetProgramStringNV(disp, parameters) \
- (* GET_GetProgramStringNV(disp)) parameters
-static INLINE _glptr_GetProgramStringNV GET_GetProgramStringNV(struct _glapi_table *disp) {
- return (_glptr_GetProgramStringNV) (GET_by_offset(disp, _gloffset_GetProgramStringNV));
-}
-
-static INLINE void SET_GetProgramStringNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLubyte *)) {
- SET_by_offset(disp, _gloffset_GetProgramStringNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramivNV)(GLuint, GLenum, GLint *);
-#define CALL_GetProgramivNV(disp, parameters) \
- (* GET_GetProgramivNV(disp)) parameters
-static INLINE _glptr_GetProgramivNV GET_GetProgramivNV(struct _glapi_table *disp) {
- return (_glptr_GetProgramivNV) (GET_by_offset(disp, _gloffset_GetProgramivNV));
-}
-
-static INLINE void SET_GetProgramivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetProgramivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTrackMatrixivNV)(GLenum, GLuint, GLenum, GLint *);
-#define CALL_GetTrackMatrixivNV(disp, parameters) \
- (* GET_GetTrackMatrixivNV(disp)) parameters
-static INLINE _glptr_GetTrackMatrixivNV GET_GetTrackMatrixivNV(struct _glapi_table *disp) {
- return (_glptr_GetTrackMatrixivNV) (GET_by_offset(disp, _gloffset_GetTrackMatrixivNV));
-}
-
-static INLINE void SET_GetTrackMatrixivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetTrackMatrixivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribPointervNV)(GLuint, GLenum, GLvoid **);
-#define CALL_GetVertexAttribPointervNV(disp, parameters) \
- (* GET_GetVertexAttribPointervNV(disp)) parameters
-static INLINE _glptr_GetVertexAttribPointervNV GET_GetVertexAttribPointervNV(struct _glapi_table *disp) {
- return (_glptr_GetVertexAttribPointervNV) (GET_by_offset(disp, _gloffset_GetVertexAttribPointervNV));
-}
-
-static INLINE void SET_GetVertexAttribPointervNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLvoid **)) {
- SET_by_offset(disp, _gloffset_GetVertexAttribPointervNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribdvNV)(GLuint, GLenum, GLdouble *);
-#define CALL_GetVertexAttribdvNV(disp, parameters) \
- (* GET_GetVertexAttribdvNV(disp)) parameters
-static INLINE _glptr_GetVertexAttribdvNV GET_GetVertexAttribdvNV(struct _glapi_table *disp) {
- return (_glptr_GetVertexAttribdvNV) (GET_by_offset(disp, _gloffset_GetVertexAttribdvNV));
-}
-
-static INLINE void SET_GetVertexAttribdvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetVertexAttribdvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribfvNV)(GLuint, GLenum, GLfloat *);
-#define CALL_GetVertexAttribfvNV(disp, parameters) \
- (* GET_GetVertexAttribfvNV(disp)) parameters
-static INLINE _glptr_GetVertexAttribfvNV GET_GetVertexAttribfvNV(struct _glapi_table *disp) {
- return (_glptr_GetVertexAttribfvNV) (GET_by_offset(disp, _gloffset_GetVertexAttribfvNV));
-}
-
-static INLINE void SET_GetVertexAttribfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetVertexAttribfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribivNV)(GLuint, GLenum, GLint *);
-#define CALL_GetVertexAttribivNV(disp, parameters) \
- (* GET_GetVertexAttribivNV(disp)) parameters
-static INLINE _glptr_GetVertexAttribivNV GET_GetVertexAttribivNV(struct _glapi_table *disp) {
- return (_glptr_GetVertexAttribivNV) (GET_by_offset(disp, _gloffset_GetVertexAttribivNV));
-}
-
-static INLINE void SET_GetVertexAttribivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetVertexAttribivNV, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsProgramNV)(GLuint);
-#define CALL_IsProgramNV(disp, parameters) \
- (* GET_IsProgramNV(disp)) parameters
-static INLINE _glptr_IsProgramNV GET_IsProgramNV(struct _glapi_table *disp) {
- return (_glptr_IsProgramNV) (GET_by_offset(disp, _gloffset_IsProgramNV));
-}
-
-static INLINE void SET_IsProgramNV(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsProgramNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadProgramNV)(GLenum, GLuint, GLsizei, const GLubyte *);
-#define CALL_LoadProgramNV(disp, parameters) \
- (* GET_LoadProgramNV(disp)) parameters
-static INLINE _glptr_LoadProgramNV GET_LoadProgramNV(struct _glapi_table *disp) {
- return (_glptr_LoadProgramNV) (GET_by_offset(disp, _gloffset_LoadProgramNV));
-}
-
-static INLINE void SET_LoadProgramNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLsizei, const GLubyte *)) {
- SET_by_offset(disp, _gloffset_LoadProgramNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramParameters4dvNV)(GLenum, GLuint, GLsizei, const GLdouble *);
-#define CALL_ProgramParameters4dvNV(disp, parameters) \
- (* GET_ProgramParameters4dvNV(disp)) parameters
-static INLINE _glptr_ProgramParameters4dvNV GET_ProgramParameters4dvNV(struct _glapi_table *disp) {
- return (_glptr_ProgramParameters4dvNV) (GET_by_offset(disp, _gloffset_ProgramParameters4dvNV));
-}
-
-static INLINE void SET_ProgramParameters4dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLsizei, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_ProgramParameters4dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramParameters4fvNV)(GLenum, GLuint, GLsizei, const GLfloat *);
-#define CALL_ProgramParameters4fvNV(disp, parameters) \
- (* GET_ProgramParameters4fvNV(disp)) parameters
-static INLINE _glptr_ProgramParameters4fvNV GET_ProgramParameters4fvNV(struct _glapi_table *disp) {
- return (_glptr_ProgramParameters4fvNV) (GET_by_offset(disp, _gloffset_ProgramParameters4fvNV));
-}
-
-static INLINE void SET_ProgramParameters4fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_ProgramParameters4fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RequestResidentProgramsNV)(GLsizei, const GLuint *);
-#define CALL_RequestResidentProgramsNV(disp, parameters) \
- (* GET_RequestResidentProgramsNV(disp)) parameters
-static INLINE _glptr_RequestResidentProgramsNV GET_RequestResidentProgramsNV(struct _glapi_table *disp) {
- return (_glptr_RequestResidentProgramsNV) (GET_by_offset(disp, _gloffset_RequestResidentProgramsNV));
-}
-
-static INLINE void SET_RequestResidentProgramsNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_RequestResidentProgramsNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TrackMatrixNV)(GLenum, GLuint, GLenum, GLenum);
-#define CALL_TrackMatrixNV(disp, parameters) \
- (* GET_TrackMatrixNV(disp)) parameters
-static INLINE _glptr_TrackMatrixNV GET_TrackMatrixNV(struct _glapi_table *disp) {
- return (_glptr_TrackMatrixNV) (GET_by_offset(disp, _gloffset_TrackMatrixNV));
-}
-
-static INLINE void SET_TrackMatrixNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_TrackMatrixNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1dNV)(GLuint, GLdouble);
-#define CALL_VertexAttrib1dNV(disp, parameters) \
- (* GET_VertexAttrib1dNV(disp)) parameters
-static INLINE _glptr_VertexAttrib1dNV GET_VertexAttrib1dNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1dNV) (GET_by_offset(disp, _gloffset_VertexAttrib1dNV));
-}
-
-static INLINE void SET_VertexAttrib1dNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1dNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1dvNV)(GLuint, const GLdouble *);
-#define CALL_VertexAttrib1dvNV(disp, parameters) \
- (* GET_VertexAttrib1dvNV(disp)) parameters
-static INLINE _glptr_VertexAttrib1dvNV GET_VertexAttrib1dvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1dvNV) (GET_by_offset(disp, _gloffset_VertexAttrib1dvNV));
-}
-
-static INLINE void SET_VertexAttrib1dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1fNV)(GLuint, GLfloat);
-#define CALL_VertexAttrib1fNV(disp, parameters) \
- (* GET_VertexAttrib1fNV(disp)) parameters
-static INLINE _glptr_VertexAttrib1fNV GET_VertexAttrib1fNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1fNV) (GET_by_offset(disp, _gloffset_VertexAttrib1fNV));
-}
-
-static INLINE void SET_VertexAttrib1fNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1fNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1fvNV)(GLuint, const GLfloat *);
-#define CALL_VertexAttrib1fvNV(disp, parameters) \
- (* GET_VertexAttrib1fvNV(disp)) parameters
-static INLINE _glptr_VertexAttrib1fvNV GET_VertexAttrib1fvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1fvNV) (GET_by_offset(disp, _gloffset_VertexAttrib1fvNV));
-}
-
-static INLINE void SET_VertexAttrib1fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1sNV)(GLuint, GLshort);
-#define CALL_VertexAttrib1sNV(disp, parameters) \
- (* GET_VertexAttrib1sNV(disp)) parameters
-static INLINE _glptr_VertexAttrib1sNV GET_VertexAttrib1sNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1sNV) (GET_by_offset(disp, _gloffset_VertexAttrib1sNV));
-}
-
-static INLINE void SET_VertexAttrib1sNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1sNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1svNV)(GLuint, const GLshort *);
-#define CALL_VertexAttrib1svNV(disp, parameters) \
- (* GET_VertexAttrib1svNV(disp)) parameters
-static INLINE _glptr_VertexAttrib1svNV GET_VertexAttrib1svNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib1svNV) (GET_by_offset(disp, _gloffset_VertexAttrib1svNV));
-}
-
-static INLINE void SET_VertexAttrib1svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib1svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2dNV)(GLuint, GLdouble, GLdouble);
-#define CALL_VertexAttrib2dNV(disp, parameters) \
- (* GET_VertexAttrib2dNV(disp)) parameters
-static INLINE _glptr_VertexAttrib2dNV GET_VertexAttrib2dNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2dNV) (GET_by_offset(disp, _gloffset_VertexAttrib2dNV));
-}
-
-static INLINE void SET_VertexAttrib2dNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2dNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2dvNV)(GLuint, const GLdouble *);
-#define CALL_VertexAttrib2dvNV(disp, parameters) \
- (* GET_VertexAttrib2dvNV(disp)) parameters
-static INLINE _glptr_VertexAttrib2dvNV GET_VertexAttrib2dvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2dvNV) (GET_by_offset(disp, _gloffset_VertexAttrib2dvNV));
-}
-
-static INLINE void SET_VertexAttrib2dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2fNV)(GLuint, GLfloat, GLfloat);
-#define CALL_VertexAttrib2fNV(disp, parameters) \
- (* GET_VertexAttrib2fNV(disp)) parameters
-static INLINE _glptr_VertexAttrib2fNV GET_VertexAttrib2fNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2fNV) (GET_by_offset(disp, _gloffset_VertexAttrib2fNV));
-}
-
-static INLINE void SET_VertexAttrib2fNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2fNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2fvNV)(GLuint, const GLfloat *);
-#define CALL_VertexAttrib2fvNV(disp, parameters) \
- (* GET_VertexAttrib2fvNV(disp)) parameters
-static INLINE _glptr_VertexAttrib2fvNV GET_VertexAttrib2fvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2fvNV) (GET_by_offset(disp, _gloffset_VertexAttrib2fvNV));
-}
-
-static INLINE void SET_VertexAttrib2fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2sNV)(GLuint, GLshort, GLshort);
-#define CALL_VertexAttrib2sNV(disp, parameters) \
- (* GET_VertexAttrib2sNV(disp)) parameters
-static INLINE _glptr_VertexAttrib2sNV GET_VertexAttrib2sNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2sNV) (GET_by_offset(disp, _gloffset_VertexAttrib2sNV));
-}
-
-static INLINE void SET_VertexAttrib2sNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2sNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2svNV)(GLuint, const GLshort *);
-#define CALL_VertexAttrib2svNV(disp, parameters) \
- (* GET_VertexAttrib2svNV(disp)) parameters
-static INLINE _glptr_VertexAttrib2svNV GET_VertexAttrib2svNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib2svNV) (GET_by_offset(disp, _gloffset_VertexAttrib2svNV));
-}
-
-static INLINE void SET_VertexAttrib2svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib2svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3dNV)(GLuint, GLdouble, GLdouble, GLdouble);
-#define CALL_VertexAttrib3dNV(disp, parameters) \
- (* GET_VertexAttrib3dNV(disp)) parameters
-static INLINE _glptr_VertexAttrib3dNV GET_VertexAttrib3dNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3dNV) (GET_by_offset(disp, _gloffset_VertexAttrib3dNV));
-}
-
-static INLINE void SET_VertexAttrib3dNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3dNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3dvNV)(GLuint, const GLdouble *);
-#define CALL_VertexAttrib3dvNV(disp, parameters) \
- (* GET_VertexAttrib3dvNV(disp)) parameters
-static INLINE _glptr_VertexAttrib3dvNV GET_VertexAttrib3dvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3dvNV) (GET_by_offset(disp, _gloffset_VertexAttrib3dvNV));
-}
-
-static INLINE void SET_VertexAttrib3dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3fNV)(GLuint, GLfloat, GLfloat, GLfloat);
-#define CALL_VertexAttrib3fNV(disp, parameters) \
- (* GET_VertexAttrib3fNV(disp)) parameters
-static INLINE _glptr_VertexAttrib3fNV GET_VertexAttrib3fNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3fNV) (GET_by_offset(disp, _gloffset_VertexAttrib3fNV));
-}
-
-static INLINE void SET_VertexAttrib3fNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3fNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3fvNV)(GLuint, const GLfloat *);
-#define CALL_VertexAttrib3fvNV(disp, parameters) \
- (* GET_VertexAttrib3fvNV(disp)) parameters
-static INLINE _glptr_VertexAttrib3fvNV GET_VertexAttrib3fvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3fvNV) (GET_by_offset(disp, _gloffset_VertexAttrib3fvNV));
-}
-
-static INLINE void SET_VertexAttrib3fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3sNV)(GLuint, GLshort, GLshort, GLshort);
-#define CALL_VertexAttrib3sNV(disp, parameters) \
- (* GET_VertexAttrib3sNV(disp)) parameters
-static INLINE _glptr_VertexAttrib3sNV GET_VertexAttrib3sNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3sNV) (GET_by_offset(disp, _gloffset_VertexAttrib3sNV));
-}
-
-static INLINE void SET_VertexAttrib3sNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3sNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3svNV)(GLuint, const GLshort *);
-#define CALL_VertexAttrib3svNV(disp, parameters) \
- (* GET_VertexAttrib3svNV(disp)) parameters
-static INLINE _glptr_VertexAttrib3svNV GET_VertexAttrib3svNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib3svNV) (GET_by_offset(disp, _gloffset_VertexAttrib3svNV));
-}
-
-static INLINE void SET_VertexAttrib3svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib3svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4dNV)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_VertexAttrib4dNV(disp, parameters) \
- (* GET_VertexAttrib4dNV(disp)) parameters
-static INLINE _glptr_VertexAttrib4dNV GET_VertexAttrib4dNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4dNV) (GET_by_offset(disp, _gloffset_VertexAttrib4dNV));
-}
-
-static INLINE void SET_VertexAttrib4dNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4dNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4dvNV)(GLuint, const GLdouble *);
-#define CALL_VertexAttrib4dvNV(disp, parameters) \
- (* GET_VertexAttrib4dvNV(disp)) parameters
-static INLINE _glptr_VertexAttrib4dvNV GET_VertexAttrib4dvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4dvNV) (GET_by_offset(disp, _gloffset_VertexAttrib4dvNV));
-}
-
-static INLINE void SET_VertexAttrib4dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4fNV)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_VertexAttrib4fNV(disp, parameters) \
- (* GET_VertexAttrib4fNV(disp)) parameters
-static INLINE _glptr_VertexAttrib4fNV GET_VertexAttrib4fNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4fNV) (GET_by_offset(disp, _gloffset_VertexAttrib4fNV));
-}
-
-static INLINE void SET_VertexAttrib4fNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4fNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4fvNV)(GLuint, const GLfloat *);
-#define CALL_VertexAttrib4fvNV(disp, parameters) \
- (* GET_VertexAttrib4fvNV(disp)) parameters
-static INLINE _glptr_VertexAttrib4fvNV GET_VertexAttrib4fvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4fvNV) (GET_by_offset(disp, _gloffset_VertexAttrib4fvNV));
-}
-
-static INLINE void SET_VertexAttrib4fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4sNV)(GLuint, GLshort, GLshort, GLshort, GLshort);
-#define CALL_VertexAttrib4sNV(disp, parameters) \
- (* GET_VertexAttrib4sNV(disp)) parameters
-static INLINE _glptr_VertexAttrib4sNV GET_VertexAttrib4sNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4sNV) (GET_by_offset(disp, _gloffset_VertexAttrib4sNV));
-}
-
-static INLINE void SET_VertexAttrib4sNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort, GLshort, GLshort)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4sNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4svNV)(GLuint, const GLshort *);
-#define CALL_VertexAttrib4svNV(disp, parameters) \
- (* GET_VertexAttrib4svNV(disp)) parameters
-static INLINE _glptr_VertexAttrib4svNV GET_VertexAttrib4svNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4svNV) (GET_by_offset(disp, _gloffset_VertexAttrib4svNV));
-}
-
-static INLINE void SET_VertexAttrib4svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4ubNV)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
-#define CALL_VertexAttrib4ubNV(disp, parameters) \
- (* GET_VertexAttrib4ubNV(disp)) parameters
-static INLINE _glptr_VertexAttrib4ubNV GET_VertexAttrib4ubNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4ubNV) (GET_by_offset(disp, _gloffset_VertexAttrib4ubNV));
-}
-
-static INLINE void SET_VertexAttrib4ubNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4ubNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4ubvNV)(GLuint, const GLubyte *);
-#define CALL_VertexAttrib4ubvNV(disp, parameters) \
- (* GET_VertexAttrib4ubvNV(disp)) parameters
-static INLINE _glptr_VertexAttrib4ubvNV GET_VertexAttrib4ubvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttrib4ubvNV) (GET_by_offset(disp, _gloffset_VertexAttrib4ubvNV));
-}
-
-static INLINE void SET_VertexAttrib4ubvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLubyte *)) {
- SET_by_offset(disp, _gloffset_VertexAttrib4ubvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribPointerNV)(GLuint, GLint, GLenum, GLsizei, const GLvoid *);
-#define CALL_VertexAttribPointerNV(disp, parameters) \
- (* GET_VertexAttribPointerNV(disp)) parameters
-static INLINE _glptr_VertexAttribPointerNV GET_VertexAttribPointerNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribPointerNV) (GET_by_offset(disp, _gloffset_VertexAttribPointerNV));
-}
-
-static INLINE void SET_VertexAttribPointerNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_VertexAttribPointerNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs1dvNV)(GLuint, GLsizei, const GLdouble *);
-#define CALL_VertexAttribs1dvNV(disp, parameters) \
- (* GET_VertexAttribs1dvNV(disp)) parameters
-static INLINE _glptr_VertexAttribs1dvNV GET_VertexAttribs1dvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs1dvNV) (GET_by_offset(disp, _gloffset_VertexAttribs1dvNV));
-}
-
-static INLINE void SET_VertexAttribs1dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs1dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs1fvNV)(GLuint, GLsizei, const GLfloat *);
-#define CALL_VertexAttribs1fvNV(disp, parameters) \
- (* GET_VertexAttribs1fvNV(disp)) parameters
-static INLINE _glptr_VertexAttribs1fvNV GET_VertexAttribs1fvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs1fvNV) (GET_by_offset(disp, _gloffset_VertexAttribs1fvNV));
-}
-
-static INLINE void SET_VertexAttribs1fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs1fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs1svNV)(GLuint, GLsizei, const GLshort *);
-#define CALL_VertexAttribs1svNV(disp, parameters) \
- (* GET_VertexAttribs1svNV(disp)) parameters
-static INLINE _glptr_VertexAttribs1svNV GET_VertexAttribs1svNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs1svNV) (GET_by_offset(disp, _gloffset_VertexAttribs1svNV));
-}
-
-static INLINE void SET_VertexAttribs1svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs1svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs2dvNV)(GLuint, GLsizei, const GLdouble *);
-#define CALL_VertexAttribs2dvNV(disp, parameters) \
- (* GET_VertexAttribs2dvNV(disp)) parameters
-static INLINE _glptr_VertexAttribs2dvNV GET_VertexAttribs2dvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs2dvNV) (GET_by_offset(disp, _gloffset_VertexAttribs2dvNV));
-}
-
-static INLINE void SET_VertexAttribs2dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs2dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs2fvNV)(GLuint, GLsizei, const GLfloat *);
-#define CALL_VertexAttribs2fvNV(disp, parameters) \
- (* GET_VertexAttribs2fvNV(disp)) parameters
-static INLINE _glptr_VertexAttribs2fvNV GET_VertexAttribs2fvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs2fvNV) (GET_by_offset(disp, _gloffset_VertexAttribs2fvNV));
-}
-
-static INLINE void SET_VertexAttribs2fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs2fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs2svNV)(GLuint, GLsizei, const GLshort *);
-#define CALL_VertexAttribs2svNV(disp, parameters) \
- (* GET_VertexAttribs2svNV(disp)) parameters
-static INLINE _glptr_VertexAttribs2svNV GET_VertexAttribs2svNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs2svNV) (GET_by_offset(disp, _gloffset_VertexAttribs2svNV));
-}
-
-static INLINE void SET_VertexAttribs2svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs2svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs3dvNV)(GLuint, GLsizei, const GLdouble *);
-#define CALL_VertexAttribs3dvNV(disp, parameters) \
- (* GET_VertexAttribs3dvNV(disp)) parameters
-static INLINE _glptr_VertexAttribs3dvNV GET_VertexAttribs3dvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs3dvNV) (GET_by_offset(disp, _gloffset_VertexAttribs3dvNV));
-}
-
-static INLINE void SET_VertexAttribs3dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs3dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs3fvNV)(GLuint, GLsizei, const GLfloat *);
-#define CALL_VertexAttribs3fvNV(disp, parameters) \
- (* GET_VertexAttribs3fvNV(disp)) parameters
-static INLINE _glptr_VertexAttribs3fvNV GET_VertexAttribs3fvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs3fvNV) (GET_by_offset(disp, _gloffset_VertexAttribs3fvNV));
-}
-
-static INLINE void SET_VertexAttribs3fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs3fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs3svNV)(GLuint, GLsizei, const GLshort *);
-#define CALL_VertexAttribs3svNV(disp, parameters) \
- (* GET_VertexAttribs3svNV(disp)) parameters
-static INLINE _glptr_VertexAttribs3svNV GET_VertexAttribs3svNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs3svNV) (GET_by_offset(disp, _gloffset_VertexAttribs3svNV));
-}
-
-static INLINE void SET_VertexAttribs3svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs3svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs4dvNV)(GLuint, GLsizei, const GLdouble *);
-#define CALL_VertexAttribs4dvNV(disp, parameters) \
- (* GET_VertexAttribs4dvNV(disp)) parameters
-static INLINE _glptr_VertexAttribs4dvNV GET_VertexAttribs4dvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs4dvNV) (GET_by_offset(disp, _gloffset_VertexAttribs4dvNV));
-}
-
-static INLINE void SET_VertexAttribs4dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs4dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs4fvNV)(GLuint, GLsizei, const GLfloat *);
-#define CALL_VertexAttribs4fvNV(disp, parameters) \
- (* GET_VertexAttribs4fvNV(disp)) parameters
-static INLINE _glptr_VertexAttribs4fvNV GET_VertexAttribs4fvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs4fvNV) (GET_by_offset(disp, _gloffset_VertexAttribs4fvNV));
-}
-
-static INLINE void SET_VertexAttribs4fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs4fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs4svNV)(GLuint, GLsizei, const GLshort *);
-#define CALL_VertexAttribs4svNV(disp, parameters) \
- (* GET_VertexAttribs4svNV(disp)) parameters
-static INLINE _glptr_VertexAttribs4svNV GET_VertexAttribs4svNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs4svNV) (GET_by_offset(disp, _gloffset_VertexAttribs4svNV));
-}
-
-static INLINE void SET_VertexAttribs4svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs4svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs4ubvNV)(GLuint, GLsizei, const GLubyte *);
-#define CALL_VertexAttribs4ubvNV(disp, parameters) \
- (* GET_VertexAttribs4ubvNV(disp)) parameters
-static INLINE _glptr_VertexAttribs4ubvNV GET_VertexAttribs4ubvNV(struct _glapi_table *disp) {
- return (_glptr_VertexAttribs4ubvNV) (GET_by_offset(disp, _gloffset_VertexAttribs4ubvNV));
-}
-
-static INLINE void SET_VertexAttribs4ubvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *)) {
- SET_by_offset(disp, _gloffset_VertexAttribs4ubvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexBumpParameterfvATI)(GLenum, GLfloat *);
-#define CALL_GetTexBumpParameterfvATI(disp, parameters) \
- (* GET_GetTexBumpParameterfvATI(disp)) parameters
-static INLINE _glptr_GetTexBumpParameterfvATI GET_GetTexBumpParameterfvATI(struct _glapi_table *disp) {
- return (_glptr_GetTexBumpParameterfvATI) (GET_by_offset(disp, _gloffset_GetTexBumpParameterfvATI));
-}
-
-static INLINE void SET_GetTexBumpParameterfvATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetTexBumpParameterfvATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexBumpParameterivATI)(GLenum, GLint *);
-#define CALL_GetTexBumpParameterivATI(disp, parameters) \
- (* GET_GetTexBumpParameterivATI(disp)) parameters
-static INLINE _glptr_GetTexBumpParameterivATI GET_GetTexBumpParameterivATI(struct _glapi_table *disp) {
- return (_glptr_GetTexBumpParameterivATI) (GET_by_offset(disp, _gloffset_GetTexBumpParameterivATI));
-}
-
-static INLINE void SET_GetTexBumpParameterivATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetTexBumpParameterivATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexBumpParameterfvATI)(GLenum, const GLfloat *);
-#define CALL_TexBumpParameterfvATI(disp, parameters) \
- (* GET_TexBumpParameterfvATI(disp)) parameters
-static INLINE _glptr_TexBumpParameterfvATI GET_TexBumpParameterfvATI(struct _glapi_table *disp) {
- return (_glptr_TexBumpParameterfvATI) (GET_by_offset(disp, _gloffset_TexBumpParameterfvATI));
-}
-
-static INLINE void SET_TexBumpParameterfvATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_TexBumpParameterfvATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexBumpParameterivATI)(GLenum, const GLint *);
-#define CALL_TexBumpParameterivATI(disp, parameters) \
- (* GET_TexBumpParameterivATI(disp)) parameters
-static INLINE _glptr_TexBumpParameterivATI GET_TexBumpParameterivATI(struct _glapi_table *disp) {
- return (_glptr_TexBumpParameterivATI) (GET_by_offset(disp, _gloffset_TexBumpParameterivATI));
-}
-
-static INLINE void SET_TexBumpParameterivATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_TexBumpParameterivATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AlphaFragmentOp1ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
-#define CALL_AlphaFragmentOp1ATI(disp, parameters) \
- (* GET_AlphaFragmentOp1ATI(disp)) parameters
-static INLINE _glptr_AlphaFragmentOp1ATI GET_AlphaFragmentOp1ATI(struct _glapi_table *disp) {
- return (_glptr_AlphaFragmentOp1ATI) (GET_by_offset(disp, _gloffset_AlphaFragmentOp1ATI));
-}
-
-static INLINE void SET_AlphaFragmentOp1ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_AlphaFragmentOp1ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AlphaFragmentOp2ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-#define CALL_AlphaFragmentOp2ATI(disp, parameters) \
- (* GET_AlphaFragmentOp2ATI(disp)) parameters
-static INLINE _glptr_AlphaFragmentOp2ATI GET_AlphaFragmentOp2ATI(struct _glapi_table *disp) {
- return (_glptr_AlphaFragmentOp2ATI) (GET_by_offset(disp, _gloffset_AlphaFragmentOp2ATI));
-}
-
-static INLINE void SET_AlphaFragmentOp2ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_AlphaFragmentOp2ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AlphaFragmentOp3ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-#define CALL_AlphaFragmentOp3ATI(disp, parameters) \
- (* GET_AlphaFragmentOp3ATI(disp)) parameters
-static INLINE _glptr_AlphaFragmentOp3ATI GET_AlphaFragmentOp3ATI(struct _glapi_table *disp) {
- return (_glptr_AlphaFragmentOp3ATI) (GET_by_offset(disp, _gloffset_AlphaFragmentOp3ATI));
-}
-
-static INLINE void SET_AlphaFragmentOp3ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_AlphaFragmentOp3ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BeginFragmentShaderATI)(void);
-#define CALL_BeginFragmentShaderATI(disp, parameters) \
- (* GET_BeginFragmentShaderATI(disp)) parameters
-static INLINE _glptr_BeginFragmentShaderATI GET_BeginFragmentShaderATI(struct _glapi_table *disp) {
- return (_glptr_BeginFragmentShaderATI) (GET_by_offset(disp, _gloffset_BeginFragmentShaderATI));
-}
-
-static INLINE void SET_BeginFragmentShaderATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_BeginFragmentShaderATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindFragmentShaderATI)(GLuint);
-#define CALL_BindFragmentShaderATI(disp, parameters) \
- (* GET_BindFragmentShaderATI(disp)) parameters
-static INLINE _glptr_BindFragmentShaderATI GET_BindFragmentShaderATI(struct _glapi_table *disp) {
- return (_glptr_BindFragmentShaderATI) (GET_by_offset(disp, _gloffset_BindFragmentShaderATI));
-}
-
-static INLINE void SET_BindFragmentShaderATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_BindFragmentShaderATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorFragmentOp1ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-#define CALL_ColorFragmentOp1ATI(disp, parameters) \
- (* GET_ColorFragmentOp1ATI(disp)) parameters
-static INLINE _glptr_ColorFragmentOp1ATI GET_ColorFragmentOp1ATI(struct _glapi_table *disp) {
- return (_glptr_ColorFragmentOp1ATI) (GET_by_offset(disp, _gloffset_ColorFragmentOp1ATI));
-}
-
-static INLINE void SET_ColorFragmentOp1ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_ColorFragmentOp1ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorFragmentOp2ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-#define CALL_ColorFragmentOp2ATI(disp, parameters) \
- (* GET_ColorFragmentOp2ATI(disp)) parameters
-static INLINE _glptr_ColorFragmentOp2ATI GET_ColorFragmentOp2ATI(struct _glapi_table *disp) {
- return (_glptr_ColorFragmentOp2ATI) (GET_by_offset(disp, _gloffset_ColorFragmentOp2ATI));
-}
-
-static INLINE void SET_ColorFragmentOp2ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_ColorFragmentOp2ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorFragmentOp3ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-#define CALL_ColorFragmentOp3ATI(disp, parameters) \
- (* GET_ColorFragmentOp3ATI(disp)) parameters
-static INLINE _glptr_ColorFragmentOp3ATI GET_ColorFragmentOp3ATI(struct _glapi_table *disp) {
- return (_glptr_ColorFragmentOp3ATI) (GET_by_offset(disp, _gloffset_ColorFragmentOp3ATI));
-}
-
-static INLINE void SET_ColorFragmentOp3ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_ColorFragmentOp3ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteFragmentShaderATI)(GLuint);
-#define CALL_DeleteFragmentShaderATI(disp, parameters) \
- (* GET_DeleteFragmentShaderATI(disp)) parameters
-static INLINE _glptr_DeleteFragmentShaderATI GET_DeleteFragmentShaderATI(struct _glapi_table *disp) {
- return (_glptr_DeleteFragmentShaderATI) (GET_by_offset(disp, _gloffset_DeleteFragmentShaderATI));
-}
-
-static INLINE void SET_DeleteFragmentShaderATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_DeleteFragmentShaderATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EndFragmentShaderATI)(void);
-#define CALL_EndFragmentShaderATI(disp, parameters) \
- (* GET_EndFragmentShaderATI(disp)) parameters
-static INLINE _glptr_EndFragmentShaderATI GET_EndFragmentShaderATI(struct _glapi_table *disp) {
- return (_glptr_EndFragmentShaderATI) (GET_by_offset(disp, _gloffset_EndFragmentShaderATI));
-}
-
-static INLINE void SET_EndFragmentShaderATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_EndFragmentShaderATI, fn);
-}
-
-typedef GLuint (GLAPIENTRYP _glptr_GenFragmentShadersATI)(GLuint);
-#define CALL_GenFragmentShadersATI(disp, parameters) \
- (* GET_GenFragmentShadersATI(disp)) parameters
-static INLINE _glptr_GenFragmentShadersATI GET_GenFragmentShadersATI(struct _glapi_table *disp) {
- return (_glptr_GenFragmentShadersATI) (GET_by_offset(disp, _gloffset_GenFragmentShadersATI));
-}
-
-static INLINE void SET_GenFragmentShadersATI(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_GenFragmentShadersATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PassTexCoordATI)(GLuint, GLuint, GLenum);
-#define CALL_PassTexCoordATI(disp, parameters) \
- (* GET_PassTexCoordATI(disp)) parameters
-static INLINE _glptr_PassTexCoordATI GET_PassTexCoordATI(struct _glapi_table *disp) {
- return (_glptr_PassTexCoordATI) (GET_by_offset(disp, _gloffset_PassTexCoordATI));
-}
-
-static INLINE void SET_PassTexCoordATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLenum)) {
- SET_by_offset(disp, _gloffset_PassTexCoordATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SampleMapATI)(GLuint, GLuint, GLenum);
-#define CALL_SampleMapATI(disp, parameters) \
- (* GET_SampleMapATI(disp)) parameters
-static INLINE _glptr_SampleMapATI GET_SampleMapATI(struct _glapi_table *disp) {
- return (_glptr_SampleMapATI) (GET_by_offset(disp, _gloffset_SampleMapATI));
-}
-
-static INLINE void SET_SampleMapATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLenum)) {
- SET_by_offset(disp, _gloffset_SampleMapATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SetFragmentShaderConstantATI)(GLuint, const GLfloat *);
-#define CALL_SetFragmentShaderConstantATI(disp, parameters) \
- (* GET_SetFragmentShaderConstantATI(disp)) parameters
-static INLINE _glptr_SetFragmentShaderConstantATI GET_SetFragmentShaderConstantATI(struct _glapi_table *disp) {
- return (_glptr_SetFragmentShaderConstantATI) (GET_by_offset(disp, _gloffset_SetFragmentShaderConstantATI));
-}
-
-static INLINE void SET_SetFragmentShaderConstantATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_SetFragmentShaderConstantATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PointParameteriNV)(GLenum, GLint);
-#define CALL_PointParameteriNV(disp, parameters) \
- (* GET_PointParameteriNV(disp)) parameters
-static INLINE _glptr_PointParameteriNV GET_PointParameteriNV(struct _glapi_table *disp) {
- return (_glptr_PointParameteriNV) (GET_by_offset(disp, _gloffset_PointParameteriNV));
-}
-
-static INLINE void SET_PointParameteriNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_PointParameteriNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PointParameterivNV)(GLenum, const GLint *);
-#define CALL_PointParameterivNV(disp, parameters) \
- (* GET_PointParameterivNV(disp)) parameters
-static INLINE _glptr_PointParameterivNV GET_PointParameterivNV(struct _glapi_table *disp) {
- return (_glptr_PointParameterivNV) (GET_by_offset(disp, _gloffset_PointParameterivNV));
-}
-
-static INLINE void SET_PointParameterivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_PointParameterivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ActiveStencilFaceEXT)(GLenum);
-#define CALL_ActiveStencilFaceEXT(disp, parameters) \
- (* GET_ActiveStencilFaceEXT(disp)) parameters
-static INLINE _glptr_ActiveStencilFaceEXT GET_ActiveStencilFaceEXT(struct _glapi_table *disp) {
- return (_glptr_ActiveStencilFaceEXT) (GET_by_offset(disp, _gloffset_ActiveStencilFaceEXT));
-}
-
-static INLINE void SET_ActiveStencilFaceEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_ActiveStencilFaceEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindVertexArrayAPPLE)(GLuint);
-#define CALL_BindVertexArrayAPPLE(disp, parameters) \
- (* GET_BindVertexArrayAPPLE(disp)) parameters
-static INLINE _glptr_BindVertexArrayAPPLE GET_BindVertexArrayAPPLE(struct _glapi_table *disp) {
- return (_glptr_BindVertexArrayAPPLE) (GET_by_offset(disp, _gloffset_BindVertexArrayAPPLE));
-}
-
-static INLINE void SET_BindVertexArrayAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_BindVertexArrayAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteVertexArraysAPPLE)(GLsizei, const GLuint *);
-#define CALL_DeleteVertexArraysAPPLE(disp, parameters) \
- (* GET_DeleteVertexArraysAPPLE(disp)) parameters
-static INLINE _glptr_DeleteVertexArraysAPPLE GET_DeleteVertexArraysAPPLE(struct _glapi_table *disp) {
- return (_glptr_DeleteVertexArraysAPPLE) (GET_by_offset(disp, _gloffset_DeleteVertexArraysAPPLE));
-}
-
-static INLINE void SET_DeleteVertexArraysAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_DeleteVertexArraysAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenVertexArraysAPPLE)(GLsizei, GLuint *);
-#define CALL_GenVertexArraysAPPLE(disp, parameters) \
- (* GET_GenVertexArraysAPPLE(disp)) parameters
-static INLINE _glptr_GenVertexArraysAPPLE GET_GenVertexArraysAPPLE(struct _glapi_table *disp) {
- return (_glptr_GenVertexArraysAPPLE) (GET_by_offset(disp, _gloffset_GenVertexArraysAPPLE));
-}
-
-static INLINE void SET_GenVertexArraysAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenVertexArraysAPPLE, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsVertexArrayAPPLE)(GLuint);
-#define CALL_IsVertexArrayAPPLE(disp, parameters) \
- (* GET_IsVertexArrayAPPLE(disp)) parameters
-static INLINE _glptr_IsVertexArrayAPPLE GET_IsVertexArrayAPPLE(struct _glapi_table *disp) {
- return (_glptr_IsVertexArrayAPPLE) (GET_by_offset(disp, _gloffset_IsVertexArrayAPPLE));
-}
-
-static INLINE void SET_IsVertexArrayAPPLE(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsVertexArrayAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramNamedParameterdvNV)(GLuint, GLsizei, const GLubyte *, GLdouble *);
-#define CALL_GetProgramNamedParameterdvNV(disp, parameters) \
- (* GET_GetProgramNamedParameterdvNV(disp)) parameters
-static INLINE _glptr_GetProgramNamedParameterdvNV GET_GetProgramNamedParameterdvNV(struct _glapi_table *disp) {
- return (_glptr_GetProgramNamedParameterdvNV) (GET_by_offset(disp, _gloffset_GetProgramNamedParameterdvNV));
-}
-
-static INLINE void SET_GetProgramNamedParameterdvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, GLdouble *)) {
- SET_by_offset(disp, _gloffset_GetProgramNamedParameterdvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramNamedParameterfvNV)(GLuint, GLsizei, const GLubyte *, GLfloat *);
-#define CALL_GetProgramNamedParameterfvNV(disp, parameters) \
- (* GET_GetProgramNamedParameterfvNV(disp)) parameters
-static INLINE _glptr_GetProgramNamedParameterfvNV GET_GetProgramNamedParameterfvNV(struct _glapi_table *disp) {
- return (_glptr_GetProgramNamedParameterfvNV) (GET_by_offset(disp, _gloffset_GetProgramNamedParameterfvNV));
-}
-
-static INLINE void SET_GetProgramNamedParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, GLfloat *)) {
- SET_by_offset(disp, _gloffset_GetProgramNamedParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4dNV)(GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble);
-#define CALL_ProgramNamedParameter4dNV(disp, parameters) \
- (* GET_ProgramNamedParameter4dNV(disp)) parameters
-static INLINE _glptr_ProgramNamedParameter4dNV GET_ProgramNamedParameter4dNV(struct _glapi_table *disp) {
- return (_glptr_ProgramNamedParameter4dNV) (GET_by_offset(disp, _gloffset_ProgramNamedParameter4dNV));
-}
-
-static INLINE void SET_ProgramNamedParameter4dNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble)) {
- SET_by_offset(disp, _gloffset_ProgramNamedParameter4dNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4dvNV)(GLuint, GLsizei, const GLubyte *, const GLdouble *);
-#define CALL_ProgramNamedParameter4dvNV(disp, parameters) \
- (* GET_ProgramNamedParameter4dvNV(disp)) parameters
-static INLINE _glptr_ProgramNamedParameter4dvNV GET_ProgramNamedParameter4dvNV(struct _glapi_table *disp) {
- return (_glptr_ProgramNamedParameter4dvNV) (GET_by_offset(disp, _gloffset_ProgramNamedParameter4dvNV));
-}
-
-static INLINE void SET_ProgramNamedParameter4dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, const GLdouble *)) {
- SET_by_offset(disp, _gloffset_ProgramNamedParameter4dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4fNV)(GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat);
-#define CALL_ProgramNamedParameter4fNV(disp, parameters) \
- (* GET_ProgramNamedParameter4fNV(disp)) parameters
-static INLINE _glptr_ProgramNamedParameter4fNV GET_ProgramNamedParameter4fNV(struct _glapi_table *disp) {
- return (_glptr_ProgramNamedParameter4fNV) (GET_by_offset(disp, _gloffset_ProgramNamedParameter4fNV));
-}
-
-static INLINE void SET_ProgramNamedParameter4fNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat)) {
- SET_by_offset(disp, _gloffset_ProgramNamedParameter4fNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4fvNV)(GLuint, GLsizei, const GLubyte *, const GLfloat *);
-#define CALL_ProgramNamedParameter4fvNV(disp, parameters) \
- (* GET_ProgramNamedParameter4fvNV(disp)) parameters
-static INLINE _glptr_ProgramNamedParameter4fvNV GET_ProgramNamedParameter4fvNV(struct _glapi_table *disp) {
- return (_glptr_ProgramNamedParameter4fvNV) (GET_by_offset(disp, _gloffset_ProgramNamedParameter4fvNV));
-}
-
-static INLINE void SET_ProgramNamedParameter4fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_ProgramNamedParameter4fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PrimitiveRestartIndexNV)(GLuint);
-#define CALL_PrimitiveRestartIndexNV(disp, parameters) \
- (* GET_PrimitiveRestartIndexNV(disp)) parameters
-static INLINE _glptr_PrimitiveRestartIndexNV GET_PrimitiveRestartIndexNV(struct _glapi_table *disp) {
- return (_glptr_PrimitiveRestartIndexNV) (GET_by_offset(disp, _gloffset_PrimitiveRestartIndexNV));
-}
-
-static INLINE void SET_PrimitiveRestartIndexNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_PrimitiveRestartIndexNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PrimitiveRestartNV)(void);
-#define CALL_PrimitiveRestartNV(disp, parameters) \
- (* GET_PrimitiveRestartNV(disp)) parameters
-static INLINE _glptr_PrimitiveRestartNV GET_PrimitiveRestartNV(struct _glapi_table *disp) {
- return (_glptr_PrimitiveRestartNV) (GET_by_offset(disp, _gloffset_PrimitiveRestartNV));
-}
-
-static INLINE void SET_PrimitiveRestartNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_PrimitiveRestartNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthBoundsEXT)(GLclampd, GLclampd);
-#define CALL_DepthBoundsEXT(disp, parameters) \
- (* GET_DepthBoundsEXT(disp)) parameters
-static INLINE _glptr_DepthBoundsEXT GET_DepthBoundsEXT(struct _glapi_table *disp) {
- return (_glptr_DepthBoundsEXT) (GET_by_offset(disp, _gloffset_DepthBoundsEXT));
-}
-
-static INLINE void SET_DepthBoundsEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampd, GLclampd)) {
- SET_by_offset(disp, _gloffset_DepthBoundsEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendEquationSeparateEXT)(GLenum, GLenum);
-#define CALL_BlendEquationSeparateEXT(disp, parameters) \
- (* GET_BlendEquationSeparateEXT(disp)) parameters
-static INLINE _glptr_BlendEquationSeparateEXT GET_BlendEquationSeparateEXT(struct _glapi_table *disp) {
- return (_glptr_BlendEquationSeparateEXT) (GET_by_offset(disp, _gloffset_BlendEquationSeparateEXT));
-}
-
-static INLINE void SET_BlendEquationSeparateEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
- SET_by_offset(disp, _gloffset_BlendEquationSeparateEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindFramebufferEXT)(GLenum, GLuint);
-#define CALL_BindFramebufferEXT(disp, parameters) \
- (* GET_BindFramebufferEXT(disp)) parameters
-static INLINE _glptr_BindFramebufferEXT GET_BindFramebufferEXT(struct _glapi_table *disp) {
- return (_glptr_BindFramebufferEXT) (GET_by_offset(disp, _gloffset_BindFramebufferEXT));
-}
-
-static INLINE void SET_BindFramebufferEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_BindFramebufferEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindRenderbufferEXT)(GLenum, GLuint);
-#define CALL_BindRenderbufferEXT(disp, parameters) \
- (* GET_BindRenderbufferEXT(disp)) parameters
-static INLINE _glptr_BindRenderbufferEXT GET_BindRenderbufferEXT(struct _glapi_table *disp) {
- return (_glptr_BindRenderbufferEXT) (GET_by_offset(disp, _gloffset_BindRenderbufferEXT));
-}
-
-static INLINE void SET_BindRenderbufferEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_BindRenderbufferEXT, fn);
-}
-
-typedef GLenum (GLAPIENTRYP _glptr_CheckFramebufferStatusEXT)(GLenum);
-#define CALL_CheckFramebufferStatusEXT(disp, parameters) \
- (* GET_CheckFramebufferStatusEXT(disp)) parameters
-static INLINE _glptr_CheckFramebufferStatusEXT GET_CheckFramebufferStatusEXT(struct _glapi_table *disp) {
- return (_glptr_CheckFramebufferStatusEXT) (GET_by_offset(disp, _gloffset_CheckFramebufferStatusEXT));
-}
-
-static INLINE void SET_CheckFramebufferStatusEXT(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_CheckFramebufferStatusEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteFramebuffersEXT)(GLsizei, const GLuint *);
-#define CALL_DeleteFramebuffersEXT(disp, parameters) \
- (* GET_DeleteFramebuffersEXT(disp)) parameters
-static INLINE _glptr_DeleteFramebuffersEXT GET_DeleteFramebuffersEXT(struct _glapi_table *disp) {
- return (_glptr_DeleteFramebuffersEXT) (GET_by_offset(disp, _gloffset_DeleteFramebuffersEXT));
-}
-
-static INLINE void SET_DeleteFramebuffersEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_DeleteFramebuffersEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteRenderbuffersEXT)(GLsizei, const GLuint *);
-#define CALL_DeleteRenderbuffersEXT(disp, parameters) \
- (* GET_DeleteRenderbuffersEXT(disp)) parameters
-static INLINE _glptr_DeleteRenderbuffersEXT GET_DeleteRenderbuffersEXT(struct _glapi_table *disp) {
- return (_glptr_DeleteRenderbuffersEXT) (GET_by_offset(disp, _gloffset_DeleteRenderbuffersEXT));
-}
-
-static INLINE void SET_DeleteRenderbuffersEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_DeleteRenderbuffersEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferRenderbufferEXT)(GLenum, GLenum, GLenum, GLuint);
-#define CALL_FramebufferRenderbufferEXT(disp, parameters) \
- (* GET_FramebufferRenderbufferEXT(disp)) parameters
-static INLINE _glptr_FramebufferRenderbufferEXT GET_FramebufferRenderbufferEXT(struct _glapi_table *disp) {
- return (_glptr_FramebufferRenderbufferEXT) (GET_by_offset(disp, _gloffset_FramebufferRenderbufferEXT));
-}
-
-static INLINE void SET_FramebufferRenderbufferEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_FramebufferRenderbufferEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTexture1DEXT)(GLenum, GLenum, GLenum, GLuint, GLint);
-#define CALL_FramebufferTexture1DEXT(disp, parameters) \
- (* GET_FramebufferTexture1DEXT(disp)) parameters
-static INLINE _glptr_FramebufferTexture1DEXT GET_FramebufferTexture1DEXT(struct _glapi_table *disp) {
- return (_glptr_FramebufferTexture1DEXT) (GET_by_offset(disp, _gloffset_FramebufferTexture1DEXT));
-}
-
-static INLINE void SET_FramebufferTexture1DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLuint, GLint)) {
- SET_by_offset(disp, _gloffset_FramebufferTexture1DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTexture2DEXT)(GLenum, GLenum, GLenum, GLuint, GLint);
-#define CALL_FramebufferTexture2DEXT(disp, parameters) \
- (* GET_FramebufferTexture2DEXT(disp)) parameters
-static INLINE _glptr_FramebufferTexture2DEXT GET_FramebufferTexture2DEXT(struct _glapi_table *disp) {
- return (_glptr_FramebufferTexture2DEXT) (GET_by_offset(disp, _gloffset_FramebufferTexture2DEXT));
-}
-
-static INLINE void SET_FramebufferTexture2DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLuint, GLint)) {
- SET_by_offset(disp, _gloffset_FramebufferTexture2DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTexture3DEXT)(GLenum, GLenum, GLenum, GLuint, GLint, GLint);
-#define CALL_FramebufferTexture3DEXT(disp, parameters) \
- (* GET_FramebufferTexture3DEXT(disp)) parameters
-static INLINE _glptr_FramebufferTexture3DEXT GET_FramebufferTexture3DEXT(struct _glapi_table *disp) {
- return (_glptr_FramebufferTexture3DEXT) (GET_by_offset(disp, _gloffset_FramebufferTexture3DEXT));
-}
-
-static INLINE void SET_FramebufferTexture3DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLuint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_FramebufferTexture3DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenFramebuffersEXT)(GLsizei, GLuint *);
-#define CALL_GenFramebuffersEXT(disp, parameters) \
- (* GET_GenFramebuffersEXT(disp)) parameters
-static INLINE _glptr_GenFramebuffersEXT GET_GenFramebuffersEXT(struct _glapi_table *disp) {
- return (_glptr_GenFramebuffersEXT) (GET_by_offset(disp, _gloffset_GenFramebuffersEXT));
-}
-
-static INLINE void SET_GenFramebuffersEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenFramebuffersEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenRenderbuffersEXT)(GLsizei, GLuint *);
-#define CALL_GenRenderbuffersEXT(disp, parameters) \
- (* GET_GenRenderbuffersEXT(disp)) parameters
-static INLINE _glptr_GenRenderbuffersEXT GET_GenRenderbuffersEXT(struct _glapi_table *disp) {
- return (_glptr_GenRenderbuffersEXT) (GET_by_offset(disp, _gloffset_GenRenderbuffersEXT));
-}
-
-static INLINE void SET_GenRenderbuffersEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
- SET_by_offset(disp, _gloffset_GenRenderbuffersEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenerateMipmapEXT)(GLenum);
-#define CALL_GenerateMipmapEXT(disp, parameters) \
- (* GET_GenerateMipmapEXT(disp)) parameters
-static INLINE _glptr_GenerateMipmapEXT GET_GenerateMipmapEXT(struct _glapi_table *disp) {
- return (_glptr_GenerateMipmapEXT) (GET_by_offset(disp, _gloffset_GenerateMipmapEXT));
-}
-
-static INLINE void SET_GenerateMipmapEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_GenerateMipmapEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetFramebufferAttachmentParameterivEXT)(GLenum, GLenum, GLenum, GLint *);
-#define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) \
- (* GET_GetFramebufferAttachmentParameterivEXT(disp)) parameters
-static INLINE _glptr_GetFramebufferAttachmentParameterivEXT GET_GetFramebufferAttachmentParameterivEXT(struct _glapi_table *disp) {
- return (_glptr_GetFramebufferAttachmentParameterivEXT) (GET_by_offset(disp, _gloffset_GetFramebufferAttachmentParameterivEXT));
-}
-
-static INLINE void SET_GetFramebufferAttachmentParameterivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetFramebufferAttachmentParameterivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetRenderbufferParameterivEXT)(GLenum, GLenum, GLint *);
-#define CALL_GetRenderbufferParameterivEXT(disp, parameters) \
- (* GET_GetRenderbufferParameterivEXT(disp)) parameters
-static INLINE _glptr_GetRenderbufferParameterivEXT GET_GetRenderbufferParameterivEXT(struct _glapi_table *disp) {
- return (_glptr_GetRenderbufferParameterivEXT) (GET_by_offset(disp, _gloffset_GetRenderbufferParameterivEXT));
-}
-
-static INLINE void SET_GetRenderbufferParameterivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetRenderbufferParameterivEXT, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsFramebufferEXT)(GLuint);
-#define CALL_IsFramebufferEXT(disp, parameters) \
- (* GET_IsFramebufferEXT(disp)) parameters
-static INLINE _glptr_IsFramebufferEXT GET_IsFramebufferEXT(struct _glapi_table *disp) {
- return (_glptr_IsFramebufferEXT) (GET_by_offset(disp, _gloffset_IsFramebufferEXT));
-}
-
-static INLINE void SET_IsFramebufferEXT(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsFramebufferEXT, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsRenderbufferEXT)(GLuint);
-#define CALL_IsRenderbufferEXT(disp, parameters) \
- (* GET_IsRenderbufferEXT(disp)) parameters
-static INLINE _glptr_IsRenderbufferEXT GET_IsRenderbufferEXT(struct _glapi_table *disp) {
- return (_glptr_IsRenderbufferEXT) (GET_by_offset(disp, _gloffset_IsRenderbufferEXT));
-}
-
-static INLINE void SET_IsRenderbufferEXT(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_IsRenderbufferEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RenderbufferStorageEXT)(GLenum, GLenum, GLsizei, GLsizei);
-#define CALL_RenderbufferStorageEXT(disp, parameters) \
- (* GET_RenderbufferStorageEXT(disp)) parameters
-static INLINE _glptr_RenderbufferStorageEXT GET_RenderbufferStorageEXT(struct _glapi_table *disp) {
- return (_glptr_RenderbufferStorageEXT) (GET_by_offset(disp, _gloffset_RenderbufferStorageEXT));
-}
-
-static INLINE void SET_RenderbufferStorageEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLsizei)) {
- SET_by_offset(disp, _gloffset_RenderbufferStorageEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlitFramebufferEXT)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
-#define CALL_BlitFramebufferEXT(disp, parameters) \
- (* GET_BlitFramebufferEXT(disp)) parameters
-static INLINE _glptr_BlitFramebufferEXT GET_BlitFramebufferEXT(struct _glapi_table *disp) {
- return (_glptr_BlitFramebufferEXT) (GET_by_offset(disp, _gloffset_BlitFramebufferEXT));
-}
-
-static INLINE void SET_BlitFramebufferEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum)) {
- SET_by_offset(disp, _gloffset_BlitFramebufferEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BufferParameteriAPPLE)(GLenum, GLenum, GLint);
-#define CALL_BufferParameteriAPPLE(disp, parameters) \
- (* GET_BufferParameteriAPPLE(disp)) parameters
-static INLINE _glptr_BufferParameteriAPPLE GET_BufferParameteriAPPLE(struct _glapi_table *disp) {
- return (_glptr_BufferParameteriAPPLE) (GET_by_offset(disp, _gloffset_BufferParameteriAPPLE));
-}
-
-static INLINE void SET_BufferParameteriAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
- SET_by_offset(disp, _gloffset_BufferParameteriAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FlushMappedBufferRangeAPPLE)(GLenum, GLintptr, GLsizeiptr);
-#define CALL_FlushMappedBufferRangeAPPLE(disp, parameters) \
- (* GET_FlushMappedBufferRangeAPPLE(disp)) parameters
-static INLINE _glptr_FlushMappedBufferRangeAPPLE GET_FlushMappedBufferRangeAPPLE(struct _glapi_table *disp) {
- return (_glptr_FlushMappedBufferRangeAPPLE) (GET_by_offset(disp, _gloffset_FlushMappedBufferRangeAPPLE));
-}
-
-static INLINE void SET_FlushMappedBufferRangeAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLintptr, GLsizeiptr)) {
- SET_by_offset(disp, _gloffset_FlushMappedBufferRangeAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindFragDataLocationEXT)(GLuint, GLuint, const GLchar *);
-#define CALL_BindFragDataLocationEXT(disp, parameters) \
- (* GET_BindFragDataLocationEXT(disp)) parameters
-static INLINE _glptr_BindFragDataLocationEXT GET_BindFragDataLocationEXT(struct _glapi_table *disp) {
- return (_glptr_BindFragDataLocationEXT) (GET_by_offset(disp, _gloffset_BindFragDataLocationEXT));
-}
-
-static INLINE void SET_BindFragDataLocationEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, const GLchar *)) {
- SET_by_offset(disp, _gloffset_BindFragDataLocationEXT, fn);
-}
-
-typedef GLint (GLAPIENTRYP _glptr_GetFragDataLocationEXT)(GLuint, const GLchar *);
-#define CALL_GetFragDataLocationEXT(disp, parameters) \
- (* GET_GetFragDataLocationEXT(disp)) parameters
-static INLINE _glptr_GetFragDataLocationEXT GET_GetFragDataLocationEXT(struct _glapi_table *disp) {
- return (_glptr_GetFragDataLocationEXT) (GET_by_offset(disp, _gloffset_GetFragDataLocationEXT));
-}
-
-static INLINE void SET_GetFragDataLocationEXT(struct _glapi_table *disp, GLint (GLAPIENTRYP fn)(GLuint, const GLchar *)) {
- SET_by_offset(disp, _gloffset_GetFragDataLocationEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetUniformuivEXT)(GLuint, GLint, GLuint *);
-#define CALL_GetUniformuivEXT(disp, parameters) \
- (* GET_GetUniformuivEXT(disp)) parameters
-static INLINE _glptr_GetUniformuivEXT GET_GetUniformuivEXT(struct _glapi_table *disp) {
- return (_glptr_GetUniformuivEXT) (GET_by_offset(disp, _gloffset_GetUniformuivEXT));
-}
-
-static INLINE void SET_GetUniformuivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLuint *)) {
- SET_by_offset(disp, _gloffset_GetUniformuivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribIivEXT)(GLuint, GLenum, GLint *);
-#define CALL_GetVertexAttribIivEXT(disp, parameters) \
- (* GET_GetVertexAttribIivEXT(disp)) parameters
-static INLINE _glptr_GetVertexAttribIivEXT GET_GetVertexAttribIivEXT(struct _glapi_table *disp) {
- return (_glptr_GetVertexAttribIivEXT) (GET_by_offset(disp, _gloffset_GetVertexAttribIivEXT));
-}
-
-static INLINE void SET_GetVertexAttribIivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetVertexAttribIivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribIuivEXT)(GLuint, GLenum, GLuint *);
-#define CALL_GetVertexAttribIuivEXT(disp, parameters) \
- (* GET_GetVertexAttribIuivEXT(disp)) parameters
-static INLINE _glptr_GetVertexAttribIuivEXT GET_GetVertexAttribIuivEXT(struct _glapi_table *disp) {
- return (_glptr_GetVertexAttribIuivEXT) (GET_by_offset(disp, _gloffset_GetVertexAttribIuivEXT));
-}
-
-static INLINE void SET_GetVertexAttribIuivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLuint *)) {
- SET_by_offset(disp, _gloffset_GetVertexAttribIuivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1uiEXT)(GLint, GLuint);
-#define CALL_Uniform1uiEXT(disp, parameters) \
- (* GET_Uniform1uiEXT(disp)) parameters
-static INLINE _glptr_Uniform1uiEXT GET_Uniform1uiEXT(struct _glapi_table *disp) {
- return (_glptr_Uniform1uiEXT) (GET_by_offset(disp, _gloffset_Uniform1uiEXT));
-}
-
-static INLINE void SET_Uniform1uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLuint)) {
- SET_by_offset(disp, _gloffset_Uniform1uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1uivEXT)(GLint, GLsizei, const GLuint *);
-#define CALL_Uniform1uivEXT(disp, parameters) \
- (* GET_Uniform1uivEXT(disp)) parameters
-static INLINE _glptr_Uniform1uivEXT GET_Uniform1uivEXT(struct _glapi_table *disp) {
- return (_glptr_Uniform1uivEXT) (GET_by_offset(disp, _gloffset_Uniform1uivEXT));
-}
-
-static INLINE void SET_Uniform1uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_Uniform1uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2uiEXT)(GLint, GLuint, GLuint);
-#define CALL_Uniform2uiEXT(disp, parameters) \
- (* GET_Uniform2uiEXT(disp)) parameters
-static INLINE _glptr_Uniform2uiEXT GET_Uniform2uiEXT(struct _glapi_table *disp) {
- return (_glptr_Uniform2uiEXT) (GET_by_offset(disp, _gloffset_Uniform2uiEXT));
-}
-
-static INLINE void SET_Uniform2uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_Uniform2uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2uivEXT)(GLint, GLsizei, const GLuint *);
-#define CALL_Uniform2uivEXT(disp, parameters) \
- (* GET_Uniform2uivEXT(disp)) parameters
-static INLINE _glptr_Uniform2uivEXT GET_Uniform2uivEXT(struct _glapi_table *disp) {
- return (_glptr_Uniform2uivEXT) (GET_by_offset(disp, _gloffset_Uniform2uivEXT));
-}
-
-static INLINE void SET_Uniform2uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_Uniform2uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3uiEXT)(GLint, GLuint, GLuint, GLuint);
-#define CALL_Uniform3uiEXT(disp, parameters) \
- (* GET_Uniform3uiEXT(disp)) parameters
-static INLINE _glptr_Uniform3uiEXT GET_Uniform3uiEXT(struct _glapi_table *disp) {
- return (_glptr_Uniform3uiEXT) (GET_by_offset(disp, _gloffset_Uniform3uiEXT));
-}
-
-static INLINE void SET_Uniform3uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_Uniform3uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3uivEXT)(GLint, GLsizei, const GLuint *);
-#define CALL_Uniform3uivEXT(disp, parameters) \
- (* GET_Uniform3uivEXT(disp)) parameters
-static INLINE _glptr_Uniform3uivEXT GET_Uniform3uivEXT(struct _glapi_table *disp) {
- return (_glptr_Uniform3uivEXT) (GET_by_offset(disp, _gloffset_Uniform3uivEXT));
-}
-
-static INLINE void SET_Uniform3uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_Uniform3uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4uiEXT)(GLint, GLuint, GLuint, GLuint, GLuint);
-#define CALL_Uniform4uiEXT(disp, parameters) \
- (* GET_Uniform4uiEXT(disp)) parameters
-static INLINE _glptr_Uniform4uiEXT GET_Uniform4uiEXT(struct _glapi_table *disp) {
- return (_glptr_Uniform4uiEXT) (GET_by_offset(disp, _gloffset_Uniform4uiEXT));
-}
-
-static INLINE void SET_Uniform4uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_Uniform4uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4uivEXT)(GLint, GLsizei, const GLuint *);
-#define CALL_Uniform4uivEXT(disp, parameters) \
- (* GET_Uniform4uivEXT(disp)) parameters
-static INLINE _glptr_Uniform4uivEXT GET_Uniform4uivEXT(struct _glapi_table *disp) {
- return (_glptr_Uniform4uivEXT) (GET_by_offset(disp, _gloffset_Uniform4uivEXT));
-}
-
-static INLINE void SET_Uniform4uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLuint *)) {
- SET_by_offset(disp, _gloffset_Uniform4uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI1iEXT)(GLuint, GLint);
-#define CALL_VertexAttribI1iEXT(disp, parameters) \
- (* GET_VertexAttribI1iEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI1iEXT GET_VertexAttribI1iEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI1iEXT) (GET_by_offset(disp, _gloffset_VertexAttribI1iEXT));
-}
-
-static INLINE void SET_VertexAttribI1iEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint)) {
- SET_by_offset(disp, _gloffset_VertexAttribI1iEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI1ivEXT)(GLuint, const GLint *);
-#define CALL_VertexAttribI1ivEXT(disp, parameters) \
- (* GET_VertexAttribI1ivEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI1ivEXT GET_VertexAttribI1ivEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI1ivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI1ivEXT));
-}
-
-static INLINE void SET_VertexAttribI1ivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI1ivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI1uiEXT)(GLuint, GLuint);
-#define CALL_VertexAttribI1uiEXT(disp, parameters) \
- (* GET_VertexAttribI1uiEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI1uiEXT GET_VertexAttribI1uiEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI1uiEXT) (GET_by_offset(disp, _gloffset_VertexAttribI1uiEXT));
-}
-
-static INLINE void SET_VertexAttribI1uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexAttribI1uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI1uivEXT)(GLuint, const GLuint *);
-#define CALL_VertexAttribI1uivEXT(disp, parameters) \
- (* GET_VertexAttribI1uivEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI1uivEXT GET_VertexAttribI1uivEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI1uivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI1uivEXT));
-}
-
-static INLINE void SET_VertexAttribI1uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI1uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI2iEXT)(GLuint, GLint, GLint);
-#define CALL_VertexAttribI2iEXT(disp, parameters) \
- (* GET_VertexAttribI2iEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI2iEXT GET_VertexAttribI2iEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI2iEXT) (GET_by_offset(disp, _gloffset_VertexAttribI2iEXT));
-}
-
-static INLINE void SET_VertexAttribI2iEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_VertexAttribI2iEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI2ivEXT)(GLuint, const GLint *);
-#define CALL_VertexAttribI2ivEXT(disp, parameters) \
- (* GET_VertexAttribI2ivEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI2ivEXT GET_VertexAttribI2ivEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI2ivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI2ivEXT));
-}
-
-static INLINE void SET_VertexAttribI2ivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI2ivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI2uiEXT)(GLuint, GLuint, GLuint);
-#define CALL_VertexAttribI2uiEXT(disp, parameters) \
- (* GET_VertexAttribI2uiEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI2uiEXT GET_VertexAttribI2uiEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI2uiEXT) (GET_by_offset(disp, _gloffset_VertexAttribI2uiEXT));
-}
-
-static INLINE void SET_VertexAttribI2uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexAttribI2uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI2uivEXT)(GLuint, const GLuint *);
-#define CALL_VertexAttribI2uivEXT(disp, parameters) \
- (* GET_VertexAttribI2uivEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI2uivEXT GET_VertexAttribI2uivEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI2uivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI2uivEXT));
-}
-
-static INLINE void SET_VertexAttribI2uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI2uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI3iEXT)(GLuint, GLint, GLint, GLint);
-#define CALL_VertexAttribI3iEXT(disp, parameters) \
- (* GET_VertexAttribI3iEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI3iEXT GET_VertexAttribI3iEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI3iEXT) (GET_by_offset(disp, _gloffset_VertexAttribI3iEXT));
-}
-
-static INLINE void SET_VertexAttribI3iEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_VertexAttribI3iEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI3ivEXT)(GLuint, const GLint *);
-#define CALL_VertexAttribI3ivEXT(disp, parameters) \
- (* GET_VertexAttribI3ivEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI3ivEXT GET_VertexAttribI3ivEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI3ivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI3ivEXT));
-}
-
-static INLINE void SET_VertexAttribI3ivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI3ivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI3uiEXT)(GLuint, GLuint, GLuint, GLuint);
-#define CALL_VertexAttribI3uiEXT(disp, parameters) \
- (* GET_VertexAttribI3uiEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI3uiEXT GET_VertexAttribI3uiEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI3uiEXT) (GET_by_offset(disp, _gloffset_VertexAttribI3uiEXT));
-}
-
-static INLINE void SET_VertexAttribI3uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexAttribI3uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI3uivEXT)(GLuint, const GLuint *);
-#define CALL_VertexAttribI3uivEXT(disp, parameters) \
- (* GET_VertexAttribI3uivEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI3uivEXT GET_VertexAttribI3uivEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI3uivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI3uivEXT));
-}
-
-static INLINE void SET_VertexAttribI3uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI3uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4bvEXT)(GLuint, const GLbyte *);
-#define CALL_VertexAttribI4bvEXT(disp, parameters) \
- (* GET_VertexAttribI4bvEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI4bvEXT GET_VertexAttribI4bvEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI4bvEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4bvEXT));
-}
-
-static INLINE void SET_VertexAttribI4bvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLbyte *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI4bvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4iEXT)(GLuint, GLint, GLint, GLint, GLint);
-#define CALL_VertexAttribI4iEXT(disp, parameters) \
- (* GET_VertexAttribI4iEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI4iEXT GET_VertexAttribI4iEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI4iEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4iEXT));
-}
-
-static INLINE void SET_VertexAttribI4iEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_VertexAttribI4iEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4ivEXT)(GLuint, const GLint *);
-#define CALL_VertexAttribI4ivEXT(disp, parameters) \
- (* GET_VertexAttribI4ivEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI4ivEXT GET_VertexAttribI4ivEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI4ivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4ivEXT));
-}
-
-static INLINE void SET_VertexAttribI4ivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI4ivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4svEXT)(GLuint, const GLshort *);
-#define CALL_VertexAttribI4svEXT(disp, parameters) \
- (* GET_VertexAttribI4svEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI4svEXT GET_VertexAttribI4svEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI4svEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4svEXT));
-}
-
-static INLINE void SET_VertexAttribI4svEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI4svEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4ubvEXT)(GLuint, const GLubyte *);
-#define CALL_VertexAttribI4ubvEXT(disp, parameters) \
- (* GET_VertexAttribI4ubvEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI4ubvEXT GET_VertexAttribI4ubvEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI4ubvEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4ubvEXT));
-}
-
-static INLINE void SET_VertexAttribI4ubvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLubyte *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI4ubvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4uiEXT)(GLuint, GLuint, GLuint, GLuint, GLuint);
-#define CALL_VertexAttribI4uiEXT(disp, parameters) \
- (* GET_VertexAttribI4uiEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI4uiEXT GET_VertexAttribI4uiEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI4uiEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4uiEXT));
-}
-
-static INLINE void SET_VertexAttribI4uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_VertexAttribI4uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4uivEXT)(GLuint, const GLuint *);
-#define CALL_VertexAttribI4uivEXT(disp, parameters) \
- (* GET_VertexAttribI4uivEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI4uivEXT GET_VertexAttribI4uivEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI4uivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4uivEXT));
-}
-
-static INLINE void SET_VertexAttribI4uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI4uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4usvEXT)(GLuint, const GLushort *);
-#define CALL_VertexAttribI4usvEXT(disp, parameters) \
- (* GET_VertexAttribI4usvEXT(disp)) parameters
-static INLINE _glptr_VertexAttribI4usvEXT GET_VertexAttribI4usvEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribI4usvEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4usvEXT));
-}
-
-static INLINE void SET_VertexAttribI4usvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLushort *)) {
- SET_by_offset(disp, _gloffset_VertexAttribI4usvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribIPointerEXT)(GLuint, GLint, GLenum, GLsizei, const GLvoid *);
-#define CALL_VertexAttribIPointerEXT(disp, parameters) \
- (* GET_VertexAttribIPointerEXT(disp)) parameters
-static INLINE _glptr_VertexAttribIPointerEXT GET_VertexAttribIPointerEXT(struct _glapi_table *disp) {
- return (_glptr_VertexAttribIPointerEXT) (GET_by_offset(disp, _gloffset_VertexAttribIPointerEXT));
-}
-
-static INLINE void SET_VertexAttribIPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_VertexAttribIPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTextureLayerEXT)(GLenum, GLenum, GLuint, GLint, GLint);
-#define CALL_FramebufferTextureLayerEXT(disp, parameters) \
- (* GET_FramebufferTextureLayerEXT(disp)) parameters
-static INLINE _glptr_FramebufferTextureLayerEXT GET_FramebufferTextureLayerEXT(struct _glapi_table *disp) {
- return (_glptr_FramebufferTextureLayerEXT) (GET_by_offset(disp, _gloffset_FramebufferTextureLayerEXT));
-}
-
-static INLINE void SET_FramebufferTextureLayerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_FramebufferTextureLayerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorMaskIndexedEXT)(GLuint, GLboolean, GLboolean, GLboolean, GLboolean);
-#define CALL_ColorMaskIndexedEXT(disp, parameters) \
- (* GET_ColorMaskIndexedEXT(disp)) parameters
-static INLINE _glptr_ColorMaskIndexedEXT GET_ColorMaskIndexedEXT(struct _glapi_table *disp) {
- return (_glptr_ColorMaskIndexedEXT) (GET_by_offset(disp, _gloffset_ColorMaskIndexedEXT));
-}
-
-static INLINE void SET_ColorMaskIndexedEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLboolean, GLboolean, GLboolean, GLboolean)) {
- SET_by_offset(disp, _gloffset_ColorMaskIndexedEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DisableIndexedEXT)(GLenum, GLuint);
-#define CALL_DisableIndexedEXT(disp, parameters) \
- (* GET_DisableIndexedEXT(disp)) parameters
-static INLINE _glptr_DisableIndexedEXT GET_DisableIndexedEXT(struct _glapi_table *disp) {
- return (_glptr_DisableIndexedEXT) (GET_by_offset(disp, _gloffset_DisableIndexedEXT));
-}
-
-static INLINE void SET_DisableIndexedEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_DisableIndexedEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EnableIndexedEXT)(GLenum, GLuint);
-#define CALL_EnableIndexedEXT(disp, parameters) \
- (* GET_EnableIndexedEXT(disp)) parameters
-static INLINE _glptr_EnableIndexedEXT GET_EnableIndexedEXT(struct _glapi_table *disp) {
- return (_glptr_EnableIndexedEXT) (GET_by_offset(disp, _gloffset_EnableIndexedEXT));
-}
-
-static INLINE void SET_EnableIndexedEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_EnableIndexedEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBooleanIndexedvEXT)(GLenum, GLuint, GLboolean *);
-#define CALL_GetBooleanIndexedvEXT(disp, parameters) \
- (* GET_GetBooleanIndexedvEXT(disp)) parameters
-static INLINE _glptr_GetBooleanIndexedvEXT GET_GetBooleanIndexedvEXT(struct _glapi_table *disp) {
- return (_glptr_GetBooleanIndexedvEXT) (GET_by_offset(disp, _gloffset_GetBooleanIndexedvEXT));
-}
-
-static INLINE void SET_GetBooleanIndexedvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLboolean *)) {
- SET_by_offset(disp, _gloffset_GetBooleanIndexedvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetIntegerIndexedvEXT)(GLenum, GLuint, GLint *);
-#define CALL_GetIntegerIndexedvEXT(disp, parameters) \
- (* GET_GetIntegerIndexedvEXT(disp)) parameters
-static INLINE _glptr_GetIntegerIndexedvEXT GET_GetIntegerIndexedvEXT(struct _glapi_table *disp) {
- return (_glptr_GetIntegerIndexedvEXT) (GET_by_offset(disp, _gloffset_GetIntegerIndexedvEXT));
-}
-
-static INLINE void SET_GetIntegerIndexedvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLint *)) {
- SET_by_offset(disp, _gloffset_GetIntegerIndexedvEXT, fn);
-}
-
-typedef GLboolean (GLAPIENTRYP _glptr_IsEnabledIndexedEXT)(GLenum, GLuint);
-#define CALL_IsEnabledIndexedEXT(disp, parameters) \
- (* GET_IsEnabledIndexedEXT(disp)) parameters
-static INLINE _glptr_IsEnabledIndexedEXT GET_IsEnabledIndexedEXT(struct _glapi_table *disp) {
- return (_glptr_IsEnabledIndexedEXT) (GET_by_offset(disp, _gloffset_IsEnabledIndexedEXT));
-}
-
-static INLINE void SET_IsEnabledIndexedEXT(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_IsEnabledIndexedEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearColorIiEXT)(GLint, GLint, GLint, GLint);
-#define CALL_ClearColorIiEXT(disp, parameters) \
- (* GET_ClearColorIiEXT(disp)) parameters
-static INLINE _glptr_ClearColorIiEXT GET_ClearColorIiEXT(struct _glapi_table *disp) {
- return (_glptr_ClearColorIiEXT) (GET_by_offset(disp, _gloffset_ClearColorIiEXT));
-}
-
-static INLINE void SET_ClearColorIiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
- SET_by_offset(disp, _gloffset_ClearColorIiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearColorIuiEXT)(GLuint, GLuint, GLuint, GLuint);
-#define CALL_ClearColorIuiEXT(disp, parameters) \
- (* GET_ClearColorIuiEXT(disp)) parameters
-static INLINE _glptr_ClearColorIuiEXT GET_ClearColorIuiEXT(struct _glapi_table *disp) {
- return (_glptr_ClearColorIuiEXT) (GET_by_offset(disp, _gloffset_ClearColorIuiEXT));
-}
-
-static INLINE void SET_ClearColorIuiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_ClearColorIuiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexParameterIivEXT)(GLenum, GLenum, GLint *);
-#define CALL_GetTexParameterIivEXT(disp, parameters) \
- (* GET_GetTexParameterIivEXT(disp)) parameters
-static INLINE _glptr_GetTexParameterIivEXT GET_GetTexParameterIivEXT(struct _glapi_table *disp) {
- return (_glptr_GetTexParameterIivEXT) (GET_by_offset(disp, _gloffset_GetTexParameterIivEXT));
-}
-
-static INLINE void SET_GetTexParameterIivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetTexParameterIivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexParameterIuivEXT)(GLenum, GLenum, GLuint *);
-#define CALL_GetTexParameterIuivEXT(disp, parameters) \
- (* GET_GetTexParameterIuivEXT(disp)) parameters
-static INLINE _glptr_GetTexParameterIuivEXT GET_GetTexParameterIuivEXT(struct _glapi_table *disp) {
- return (_glptr_GetTexParameterIuivEXT) (GET_by_offset(disp, _gloffset_GetTexParameterIuivEXT));
-}
-
-static INLINE void SET_GetTexParameterIuivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint *)) {
- SET_by_offset(disp, _gloffset_GetTexParameterIuivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameterIivEXT)(GLenum, GLenum, const GLint *);
-#define CALL_TexParameterIivEXT(disp, parameters) \
- (* GET_TexParameterIivEXT(disp)) parameters
-static INLINE _glptr_TexParameterIivEXT GET_TexParameterIivEXT(struct _glapi_table *disp) {
- return (_glptr_TexParameterIivEXT) (GET_by_offset(disp, _gloffset_TexParameterIivEXT));
-}
-
-static INLINE void SET_TexParameterIivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
- SET_by_offset(disp, _gloffset_TexParameterIivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameterIuivEXT)(GLenum, GLenum, const GLuint *);
-#define CALL_TexParameterIuivEXT(disp, parameters) \
- (* GET_TexParameterIuivEXT(disp)) parameters
-static INLINE _glptr_TexParameterIuivEXT GET_TexParameterIuivEXT(struct _glapi_table *disp) {
- return (_glptr_TexParameterIuivEXT) (GET_by_offset(disp, _gloffset_TexParameterIuivEXT));
-}
-
-static INLINE void SET_TexParameterIuivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLuint *)) {
- SET_by_offset(disp, _gloffset_TexParameterIuivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BeginConditionalRenderNV)(GLuint, GLenum);
-#define CALL_BeginConditionalRenderNV(disp, parameters) \
- (* GET_BeginConditionalRenderNV(disp)) parameters
-static INLINE _glptr_BeginConditionalRenderNV GET_BeginConditionalRenderNV(struct _glapi_table *disp) {
- return (_glptr_BeginConditionalRenderNV) (GET_by_offset(disp, _gloffset_BeginConditionalRenderNV));
-}
-
-static INLINE void SET_BeginConditionalRenderNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum)) {
- SET_by_offset(disp, _gloffset_BeginConditionalRenderNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EndConditionalRenderNV)(void);
-#define CALL_EndConditionalRenderNV(disp, parameters) \
- (* GET_EndConditionalRenderNV(disp)) parameters
-static INLINE _glptr_EndConditionalRenderNV GET_EndConditionalRenderNV(struct _glapi_table *disp) {
- return (_glptr_EndConditionalRenderNV) (GET_by_offset(disp, _gloffset_EndConditionalRenderNV));
-}
-
-static INLINE void SET_EndConditionalRenderNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_EndConditionalRenderNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BeginTransformFeedbackEXT)(GLenum);
-#define CALL_BeginTransformFeedbackEXT(disp, parameters) \
- (* GET_BeginTransformFeedbackEXT(disp)) parameters
-static INLINE _glptr_BeginTransformFeedbackEXT GET_BeginTransformFeedbackEXT(struct _glapi_table *disp) {
- return (_glptr_BeginTransformFeedbackEXT) (GET_by_offset(disp, _gloffset_BeginTransformFeedbackEXT));
-}
-
-static INLINE void SET_BeginTransformFeedbackEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_BeginTransformFeedbackEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindBufferBaseEXT)(GLenum, GLuint, GLuint);
-#define CALL_BindBufferBaseEXT(disp, parameters) \
- (* GET_BindBufferBaseEXT(disp)) parameters
-static INLINE _glptr_BindBufferBaseEXT GET_BindBufferBaseEXT(struct _glapi_table *disp) {
- return (_glptr_BindBufferBaseEXT) (GET_by_offset(disp, _gloffset_BindBufferBaseEXT));
-}
-
-static INLINE void SET_BindBufferBaseEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint)) {
- SET_by_offset(disp, _gloffset_BindBufferBaseEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindBufferOffsetEXT)(GLenum, GLuint, GLuint, GLintptr);
-#define CALL_BindBufferOffsetEXT(disp, parameters) \
- (* GET_BindBufferOffsetEXT(disp)) parameters
-static INLINE _glptr_BindBufferOffsetEXT GET_BindBufferOffsetEXT(struct _glapi_table *disp) {
- return (_glptr_BindBufferOffsetEXT) (GET_by_offset(disp, _gloffset_BindBufferOffsetEXT));
-}
-
-static INLINE void SET_BindBufferOffsetEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLintptr)) {
- SET_by_offset(disp, _gloffset_BindBufferOffsetEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindBufferRangeEXT)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
-#define CALL_BindBufferRangeEXT(disp, parameters) \
- (* GET_BindBufferRangeEXT(disp)) parameters
-static INLINE _glptr_BindBufferRangeEXT GET_BindBufferRangeEXT(struct _glapi_table *disp) {
- return (_glptr_BindBufferRangeEXT) (GET_by_offset(disp, _gloffset_BindBufferRangeEXT));
-}
-
-static INLINE void SET_BindBufferRangeEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr)) {
- SET_by_offset(disp, _gloffset_BindBufferRangeEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EndTransformFeedbackEXT)(void);
-#define CALL_EndTransformFeedbackEXT(disp, parameters) \
- (* GET_EndTransformFeedbackEXT(disp)) parameters
-static INLINE _glptr_EndTransformFeedbackEXT GET_EndTransformFeedbackEXT(struct _glapi_table *disp) {
- return (_glptr_EndTransformFeedbackEXT) (GET_by_offset(disp, _gloffset_EndTransformFeedbackEXT));
-}
-
-static INLINE void SET_EndTransformFeedbackEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_EndTransformFeedbackEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTransformFeedbackVaryingEXT)(GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
-#define CALL_GetTransformFeedbackVaryingEXT(disp, parameters) \
- (* GET_GetTransformFeedbackVaryingEXT(disp)) parameters
-static INLINE _glptr_GetTransformFeedbackVaryingEXT GET_GetTransformFeedbackVaryingEXT(struct _glapi_table *disp) {
- return (_glptr_GetTransformFeedbackVaryingEXT) (GET_by_offset(disp, _gloffset_GetTransformFeedbackVaryingEXT));
-}
-
-static INLINE void SET_GetTransformFeedbackVaryingEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *)) {
- SET_by_offset(disp, _gloffset_GetTransformFeedbackVaryingEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TransformFeedbackVaryingsEXT)(GLuint, GLsizei, const char **, GLenum);
-#define CALL_TransformFeedbackVaryingsEXT(disp, parameters) \
- (* GET_TransformFeedbackVaryingsEXT(disp)) parameters
-static INLINE _glptr_TransformFeedbackVaryingsEXT GET_TransformFeedbackVaryingsEXT(struct _glapi_table *disp) {
- return (_glptr_TransformFeedbackVaryingsEXT) (GET_by_offset(disp, _gloffset_TransformFeedbackVaryingsEXT));
-}
-
-static INLINE void SET_TransformFeedbackVaryingsEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const char **, GLenum)) {
- SET_by_offset(disp, _gloffset_TransformFeedbackVaryingsEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProvokingVertexEXT)(GLenum);
-#define CALL_ProvokingVertexEXT(disp, parameters) \
- (* GET_ProvokingVertexEXT(disp)) parameters
-static INLINE _glptr_ProvokingVertexEXT GET_ProvokingVertexEXT(struct _glapi_table *disp) {
- return (_glptr_ProvokingVertexEXT) (GET_by_offset(disp, _gloffset_ProvokingVertexEXT));
-}
-
-static INLINE void SET_ProvokingVertexEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
- SET_by_offset(disp, _gloffset_ProvokingVertexEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexParameterPointervAPPLE)(GLenum, GLenum, GLvoid **);
-#define CALL_GetTexParameterPointervAPPLE(disp, parameters) \
- (* GET_GetTexParameterPointervAPPLE(disp)) parameters
-static INLINE _glptr_GetTexParameterPointervAPPLE GET_GetTexParameterPointervAPPLE(struct _glapi_table *disp) {
- return (_glptr_GetTexParameterPointervAPPLE) (GET_by_offset(disp, _gloffset_GetTexParameterPointervAPPLE));
-}
-
-static INLINE void SET_GetTexParameterPointervAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLvoid **)) {
- SET_by_offset(disp, _gloffset_GetTexParameterPointervAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TextureRangeAPPLE)(GLenum, GLsizei, GLvoid *);
-#define CALL_TextureRangeAPPLE(disp, parameters) \
- (* GET_TextureRangeAPPLE(disp)) parameters
-static INLINE _glptr_TextureRangeAPPLE GET_TextureRangeAPPLE(struct _glapi_table *disp) {
- return (_glptr_TextureRangeAPPLE) (GET_by_offset(disp, _gloffset_TextureRangeAPPLE));
-}
-
-static INLINE void SET_TextureRangeAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLvoid *)) {
- SET_by_offset(disp, _gloffset_TextureRangeAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetObjectParameterivAPPLE)(GLenum, GLuint, GLenum, GLint *);
-#define CALL_GetObjectParameterivAPPLE(disp, parameters) \
- (* GET_GetObjectParameterivAPPLE(disp)) parameters
-static INLINE _glptr_GetObjectParameterivAPPLE GET_GetObjectParameterivAPPLE(struct _glapi_table *disp) {
- return (_glptr_GetObjectParameterivAPPLE) (GET_by_offset(disp, _gloffset_GetObjectParameterivAPPLE));
-}
-
-static INLINE void SET_GetObjectParameterivAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLint *)) {
- SET_by_offset(disp, _gloffset_GetObjectParameterivAPPLE, fn);
-}
-
-typedef GLenum (GLAPIENTRYP _glptr_ObjectPurgeableAPPLE)(GLenum, GLuint, GLenum);
-#define CALL_ObjectPurgeableAPPLE(disp, parameters) \
- (* GET_ObjectPurgeableAPPLE(disp)) parameters
-static INLINE _glptr_ObjectPurgeableAPPLE GET_ObjectPurgeableAPPLE(struct _glapi_table *disp) {
- return (_glptr_ObjectPurgeableAPPLE) (GET_by_offset(disp, _gloffset_ObjectPurgeableAPPLE));
-}
-
-static INLINE void SET_ObjectPurgeableAPPLE(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(GLenum, GLuint, GLenum)) {
- SET_by_offset(disp, _gloffset_ObjectPurgeableAPPLE, fn);
-}
-
-typedef GLenum (GLAPIENTRYP _glptr_ObjectUnpurgeableAPPLE)(GLenum, GLuint, GLenum);
-#define CALL_ObjectUnpurgeableAPPLE(disp, parameters) \
- (* GET_ObjectUnpurgeableAPPLE(disp)) parameters
-static INLINE _glptr_ObjectUnpurgeableAPPLE GET_ObjectUnpurgeableAPPLE(struct _glapi_table *disp) {
- return (_glptr_ObjectUnpurgeableAPPLE) (GET_by_offset(disp, _gloffset_ObjectUnpurgeableAPPLE));
-}
-
-static INLINE void SET_ObjectUnpurgeableAPPLE(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(GLenum, GLuint, GLenum)) {
- SET_by_offset(disp, _gloffset_ObjectUnpurgeableAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ActiveProgramEXT)(GLuint);
-#define CALL_ActiveProgramEXT(disp, parameters) \
- (* GET_ActiveProgramEXT(disp)) parameters
-static INLINE _glptr_ActiveProgramEXT GET_ActiveProgramEXT(struct _glapi_table *disp) {
- return (_glptr_ActiveProgramEXT) (GET_by_offset(disp, _gloffset_ActiveProgramEXT));
-}
-
-static INLINE void SET_ActiveProgramEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_ActiveProgramEXT, fn);
-}
-
-typedef GLuint (GLAPIENTRYP _glptr_CreateShaderProgramEXT)(GLenum, const GLchar *);
-#define CALL_CreateShaderProgramEXT(disp, parameters) \
- (* GET_CreateShaderProgramEXT(disp)) parameters
-static INLINE _glptr_CreateShaderProgramEXT GET_CreateShaderProgramEXT(struct _glapi_table *disp) {
- return (_glptr_CreateShaderProgramEXT) (GET_by_offset(disp, _gloffset_CreateShaderProgramEXT));
-}
-
-static INLINE void SET_CreateShaderProgramEXT(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(GLenum, const GLchar *)) {
- SET_by_offset(disp, _gloffset_CreateShaderProgramEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UseShaderProgramEXT)(GLenum, GLuint);
-#define CALL_UseShaderProgramEXT(disp, parameters) \
- (* GET_UseShaderProgramEXT(disp)) parameters
-static INLINE _glptr_UseShaderProgramEXT GET_UseShaderProgramEXT(struct _glapi_table *disp) {
- return (_glptr_UseShaderProgramEXT) (GET_by_offset(disp, _gloffset_UseShaderProgramEXT));
-}
-
-static INLINE void SET_UseShaderProgramEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
- SET_by_offset(disp, _gloffset_UseShaderProgramEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TextureBarrierNV)(void);
-#define CALL_TextureBarrierNV(disp, parameters) \
- (* GET_TextureBarrierNV(disp)) parameters
-static INLINE _glptr_TextureBarrierNV GET_TextureBarrierNV(struct _glapi_table *disp) {
- return (_glptr_TextureBarrierNV) (GET_by_offset(disp, _gloffset_TextureBarrierNV));
-}
-
-static INLINE void SET_TextureBarrierNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_TextureBarrierNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilFuncSeparateATI)(GLenum, GLenum, GLint, GLuint);
-#define CALL_StencilFuncSeparateATI(disp, parameters) \
- (* GET_StencilFuncSeparateATI(disp)) parameters
-static INLINE _glptr_StencilFuncSeparateATI GET_StencilFuncSeparateATI(struct _glapi_table *disp) {
- return (_glptr_StencilFuncSeparateATI) (GET_by_offset(disp, _gloffset_StencilFuncSeparateATI));
-}
-
-static INLINE void SET_StencilFuncSeparateATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint, GLuint)) {
- SET_by_offset(disp, _gloffset_StencilFuncSeparateATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramEnvParameters4fvEXT)(GLenum, GLuint, GLsizei, const GLfloat *);
-#define CALL_ProgramEnvParameters4fvEXT(disp, parameters) \
- (* GET_ProgramEnvParameters4fvEXT(disp)) parameters
-static INLINE _glptr_ProgramEnvParameters4fvEXT GET_ProgramEnvParameters4fvEXT(struct _glapi_table *disp) {
- return (_glptr_ProgramEnvParameters4fvEXT) (GET_by_offset(disp, _gloffset_ProgramEnvParameters4fvEXT));
-}
-
-static INLINE void SET_ProgramEnvParameters4fvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_ProgramEnvParameters4fvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramLocalParameters4fvEXT)(GLenum, GLuint, GLsizei, const GLfloat *);
-#define CALL_ProgramLocalParameters4fvEXT(disp, parameters) \
- (* GET_ProgramLocalParameters4fvEXT(disp)) parameters
-static INLINE _glptr_ProgramLocalParameters4fvEXT GET_ProgramLocalParameters4fvEXT(struct _glapi_table *disp) {
- return (_glptr_ProgramLocalParameters4fvEXT) (GET_by_offset(disp, _gloffset_ProgramLocalParameters4fvEXT));
-}
-
-static INLINE void SET_ProgramLocalParameters4fvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLsizei, const GLfloat *)) {
- SET_by_offset(disp, _gloffset_ProgramLocalParameters4fvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetQueryObjecti64vEXT)(GLuint, GLenum, GLint64EXT *);
-#define CALL_GetQueryObjecti64vEXT(disp, parameters) \
- (* GET_GetQueryObjecti64vEXT(disp)) parameters
-static INLINE _glptr_GetQueryObjecti64vEXT GET_GetQueryObjecti64vEXT(struct _glapi_table *disp) {
- return (_glptr_GetQueryObjecti64vEXT) (GET_by_offset(disp, _gloffset_GetQueryObjecti64vEXT));
-}
-
-static INLINE void SET_GetQueryObjecti64vEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint64EXT *)) {
- SET_by_offset(disp, _gloffset_GetQueryObjecti64vEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetQueryObjectui64vEXT)(GLuint, GLenum, GLuint64EXT *);
-#define CALL_GetQueryObjectui64vEXT(disp, parameters) \
- (* GET_GetQueryObjectui64vEXT(disp)) parameters
-static INLINE _glptr_GetQueryObjectui64vEXT GET_GetQueryObjectui64vEXT(struct _glapi_table *disp) {
- return (_glptr_GetQueryObjectui64vEXT) (GET_by_offset(disp, _gloffset_GetQueryObjectui64vEXT));
-}
-
-static INLINE void SET_GetQueryObjectui64vEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLuint64EXT *)) {
- SET_by_offset(disp, _gloffset_GetQueryObjectui64vEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EGLImageTargetRenderbufferStorageOES)(GLenum, GLvoid *);
-#define CALL_EGLImageTargetRenderbufferStorageOES(disp, parameters) \
- (* GET_EGLImageTargetRenderbufferStorageOES(disp)) parameters
-static INLINE _glptr_EGLImageTargetRenderbufferStorageOES GET_EGLImageTargetRenderbufferStorageOES(struct _glapi_table *disp) {
- return (_glptr_EGLImageTargetRenderbufferStorageOES) (GET_by_offset(disp, _gloffset_EGLImageTargetRenderbufferStorageOES));
-}
-
-static INLINE void SET_EGLImageTargetRenderbufferStorageOES(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLvoid *)) {
- SET_by_offset(disp, _gloffset_EGLImageTargetRenderbufferStorageOES, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EGLImageTargetTexture2DOES)(GLenum, GLvoid *);
-#define CALL_EGLImageTargetTexture2DOES(disp, parameters) \
- (* GET_EGLImageTargetTexture2DOES(disp)) parameters
-static INLINE _glptr_EGLImageTargetTexture2DOES GET_EGLImageTargetTexture2DOES(struct _glapi_table *disp) {
- return (_glptr_EGLImageTargetTexture2DOES) (GET_by_offset(disp, _gloffset_EGLImageTargetTexture2DOES));
-}
-
-static INLINE void SET_EGLImageTargetTexture2DOES(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLvoid *)) {
- SET_by_offset(disp, _gloffset_EGLImageTargetTexture2DOES, fn);
-}
-
-
-#endif /* !defined( _DISPATCH_H_ ) */
+/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */
+
+/*
+ * (C) Copyright IBM Corporation 2005
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#if !defined( _DISPATCH_H_ )
+# define _DISPATCH_H_
+
+
+#include "glapitable.h"
+/**
+ * \file main/dispatch.h
+ * Macros for handling GL dispatch tables.
+ *
+ * For each known GL function, there are 3 macros in this file. The first
+ * macro is named CALL_FuncName and is used to call that GL function using
+ * the specified dispatch table. The other 2 macros, called GET_FuncName
+ * can SET_FuncName, are used to get and set the dispatch pointer for the
+ * named function in the specified dispatch table.
+ */
+
+/* GLXEXT is defined when building the GLX extension in the xserver.
+ */
+#if !defined(GLXEXT)
+#include "main/mfeatures.h"
+#endif
+
+#ifdef _MSC_VER
+#define INLINE __inline
+#endif
+#define CALL_by_offset(disp, cast, offset, parameters) \
+ (*(cast (GET_by_offset(disp, offset)))) parameters
+#define GET_by_offset(disp, offset) \
+ (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL
+#define SET_by_offset(disp, offset, fn) \
+ do { \
+ if ( (offset) < 0 ) { \
+ /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\n", */ \
+ /* __func__, __LINE__, disp, offset, # fn); */ \
+ /* abort(); */ \
+ } \
+ else { \
+ ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \
+ } \
+ } while(0)
+
+/* total number of offsets below */
+#define _gloffset_COUNT 977
+
+#define _gloffset_NewList 0
+#define _gloffset_EndList 1
+#define _gloffset_CallList 2
+#define _gloffset_CallLists 3
+#define _gloffset_DeleteLists 4
+#define _gloffset_GenLists 5
+#define _gloffset_ListBase 6
+#define _gloffset_Begin 7
+#define _gloffset_Bitmap 8
+#define _gloffset_Color3b 9
+#define _gloffset_Color3bv 10
+#define _gloffset_Color3d 11
+#define _gloffset_Color3dv 12
+#define _gloffset_Color3f 13
+#define _gloffset_Color3fv 14
+#define _gloffset_Color3i 15
+#define _gloffset_Color3iv 16
+#define _gloffset_Color3s 17
+#define _gloffset_Color3sv 18
+#define _gloffset_Color3ub 19
+#define _gloffset_Color3ubv 20
+#define _gloffset_Color3ui 21
+#define _gloffset_Color3uiv 22
+#define _gloffset_Color3us 23
+#define _gloffset_Color3usv 24
+#define _gloffset_Color4b 25
+#define _gloffset_Color4bv 26
+#define _gloffset_Color4d 27
+#define _gloffset_Color4dv 28
+#define _gloffset_Color4f 29
+#define _gloffset_Color4fv 30
+#define _gloffset_Color4i 31
+#define _gloffset_Color4iv 32
+#define _gloffset_Color4s 33
+#define _gloffset_Color4sv 34
+#define _gloffset_Color4ub 35
+#define _gloffset_Color4ubv 36
+#define _gloffset_Color4ui 37
+#define _gloffset_Color4uiv 38
+#define _gloffset_Color4us 39
+#define _gloffset_Color4usv 40
+#define _gloffset_EdgeFlag 41
+#define _gloffset_EdgeFlagv 42
+#define _gloffset_End 43
+#define _gloffset_Indexd 44
+#define _gloffset_Indexdv 45
+#define _gloffset_Indexf 46
+#define _gloffset_Indexfv 47
+#define _gloffset_Indexi 48
+#define _gloffset_Indexiv 49
+#define _gloffset_Indexs 50
+#define _gloffset_Indexsv 51
+#define _gloffset_Normal3b 52
+#define _gloffset_Normal3bv 53
+#define _gloffset_Normal3d 54
+#define _gloffset_Normal3dv 55
+#define _gloffset_Normal3f 56
+#define _gloffset_Normal3fv 57
+#define _gloffset_Normal3i 58
+#define _gloffset_Normal3iv 59
+#define _gloffset_Normal3s 60
+#define _gloffset_Normal3sv 61
+#define _gloffset_RasterPos2d 62
+#define _gloffset_RasterPos2dv 63
+#define _gloffset_RasterPos2f 64
+#define _gloffset_RasterPos2fv 65
+#define _gloffset_RasterPos2i 66
+#define _gloffset_RasterPos2iv 67
+#define _gloffset_RasterPos2s 68
+#define _gloffset_RasterPos2sv 69
+#define _gloffset_RasterPos3d 70
+#define _gloffset_RasterPos3dv 71
+#define _gloffset_RasterPos3f 72
+#define _gloffset_RasterPos3fv 73
+#define _gloffset_RasterPos3i 74
+#define _gloffset_RasterPos3iv 75
+#define _gloffset_RasterPos3s 76
+#define _gloffset_RasterPos3sv 77
+#define _gloffset_RasterPos4d 78
+#define _gloffset_RasterPos4dv 79
+#define _gloffset_RasterPos4f 80
+#define _gloffset_RasterPos4fv 81
+#define _gloffset_RasterPos4i 82
+#define _gloffset_RasterPos4iv 83
+#define _gloffset_RasterPos4s 84
+#define _gloffset_RasterPos4sv 85
+#define _gloffset_Rectd 86
+#define _gloffset_Rectdv 87
+#define _gloffset_Rectf 88
+#define _gloffset_Rectfv 89
+#define _gloffset_Recti 90
+#define _gloffset_Rectiv 91
+#define _gloffset_Rects 92
+#define _gloffset_Rectsv 93
+#define _gloffset_TexCoord1d 94
+#define _gloffset_TexCoord1dv 95
+#define _gloffset_TexCoord1f 96
+#define _gloffset_TexCoord1fv 97
+#define _gloffset_TexCoord1i 98
+#define _gloffset_TexCoord1iv 99
+#define _gloffset_TexCoord1s 100
+#define _gloffset_TexCoord1sv 101
+#define _gloffset_TexCoord2d 102
+#define _gloffset_TexCoord2dv 103
+#define _gloffset_TexCoord2f 104
+#define _gloffset_TexCoord2fv 105
+#define _gloffset_TexCoord2i 106
+#define _gloffset_TexCoord2iv 107
+#define _gloffset_TexCoord2s 108
+#define _gloffset_TexCoord2sv 109
+#define _gloffset_TexCoord3d 110
+#define _gloffset_TexCoord3dv 111
+#define _gloffset_TexCoord3f 112
+#define _gloffset_TexCoord3fv 113
+#define _gloffset_TexCoord3i 114
+#define _gloffset_TexCoord3iv 115
+#define _gloffset_TexCoord3s 116
+#define _gloffset_TexCoord3sv 117
+#define _gloffset_TexCoord4d 118
+#define _gloffset_TexCoord4dv 119
+#define _gloffset_TexCoord4f 120
+#define _gloffset_TexCoord4fv 121
+#define _gloffset_TexCoord4i 122
+#define _gloffset_TexCoord4iv 123
+#define _gloffset_TexCoord4s 124
+#define _gloffset_TexCoord4sv 125
+#define _gloffset_Vertex2d 126
+#define _gloffset_Vertex2dv 127
+#define _gloffset_Vertex2f 128
+#define _gloffset_Vertex2fv 129
+#define _gloffset_Vertex2i 130
+#define _gloffset_Vertex2iv 131
+#define _gloffset_Vertex2s 132
+#define _gloffset_Vertex2sv 133
+#define _gloffset_Vertex3d 134
+#define _gloffset_Vertex3dv 135
+#define _gloffset_Vertex3f 136
+#define _gloffset_Vertex3fv 137
+#define _gloffset_Vertex3i 138
+#define _gloffset_Vertex3iv 139
+#define _gloffset_Vertex3s 140
+#define _gloffset_Vertex3sv 141
+#define _gloffset_Vertex4d 142
+#define _gloffset_Vertex4dv 143
+#define _gloffset_Vertex4f 144
+#define _gloffset_Vertex4fv 145
+#define _gloffset_Vertex4i 146
+#define _gloffset_Vertex4iv 147
+#define _gloffset_Vertex4s 148
+#define _gloffset_Vertex4sv 149
+#define _gloffset_ClipPlane 150
+#define _gloffset_ColorMaterial 151
+#define _gloffset_CullFace 152
+#define _gloffset_Fogf 153
+#define _gloffset_Fogfv 154
+#define _gloffset_Fogi 155
+#define _gloffset_Fogiv 156
+#define _gloffset_FrontFace 157
+#define _gloffset_Hint 158
+#define _gloffset_Lightf 159
+#define _gloffset_Lightfv 160
+#define _gloffset_Lighti 161
+#define _gloffset_Lightiv 162
+#define _gloffset_LightModelf 163
+#define _gloffset_LightModelfv 164
+#define _gloffset_LightModeli 165
+#define _gloffset_LightModeliv 166
+#define _gloffset_LineStipple 167
+#define _gloffset_LineWidth 168
+#define _gloffset_Materialf 169
+#define _gloffset_Materialfv 170
+#define _gloffset_Materiali 171
+#define _gloffset_Materialiv 172
+#define _gloffset_PointSize 173
+#define _gloffset_PolygonMode 174
+#define _gloffset_PolygonStipple 175
+#define _gloffset_Scissor 176
+#define _gloffset_ShadeModel 177
+#define _gloffset_TexParameterf 178
+#define _gloffset_TexParameterfv 179
+#define _gloffset_TexParameteri 180
+#define _gloffset_TexParameteriv 181
+#define _gloffset_TexImage1D 182
+#define _gloffset_TexImage2D 183
+#define _gloffset_TexEnvf 184
+#define _gloffset_TexEnvfv 185
+#define _gloffset_TexEnvi 186
+#define _gloffset_TexEnviv 187
+#define _gloffset_TexGend 188
+#define _gloffset_TexGendv 189
+#define _gloffset_TexGenf 190
+#define _gloffset_TexGenfv 191
+#define _gloffset_TexGeni 192
+#define _gloffset_TexGeniv 193
+#define _gloffset_FeedbackBuffer 194
+#define _gloffset_SelectBuffer 195
+#define _gloffset_RenderMode 196
+#define _gloffset_InitNames 197
+#define _gloffset_LoadName 198
+#define _gloffset_PassThrough 199
+#define _gloffset_PopName 200
+#define _gloffset_PushName 201
+#define _gloffset_DrawBuffer 202
+#define _gloffset_Clear 203
+#define _gloffset_ClearAccum 204
+#define _gloffset_ClearIndex 205
+#define _gloffset_ClearColor 206
+#define _gloffset_ClearStencil 207
+#define _gloffset_ClearDepth 208
+#define _gloffset_StencilMask 209
+#define _gloffset_ColorMask 210
+#define _gloffset_DepthMask 211
+#define _gloffset_IndexMask 212
+#define _gloffset_Accum 213
+#define _gloffset_Disable 214
+#define _gloffset_Enable 215
+#define _gloffset_Finish 216
+#define _gloffset_Flush 217
+#define _gloffset_PopAttrib 218
+#define _gloffset_PushAttrib 219
+#define _gloffset_Map1d 220
+#define _gloffset_Map1f 221
+#define _gloffset_Map2d 222
+#define _gloffset_Map2f 223
+#define _gloffset_MapGrid1d 224
+#define _gloffset_MapGrid1f 225
+#define _gloffset_MapGrid2d 226
+#define _gloffset_MapGrid2f 227
+#define _gloffset_EvalCoord1d 228
+#define _gloffset_EvalCoord1dv 229
+#define _gloffset_EvalCoord1f 230
+#define _gloffset_EvalCoord1fv 231
+#define _gloffset_EvalCoord2d 232
+#define _gloffset_EvalCoord2dv 233
+#define _gloffset_EvalCoord2f 234
+#define _gloffset_EvalCoord2fv 235
+#define _gloffset_EvalMesh1 236
+#define _gloffset_EvalPoint1 237
+#define _gloffset_EvalMesh2 238
+#define _gloffset_EvalPoint2 239
+#define _gloffset_AlphaFunc 240
+#define _gloffset_BlendFunc 241
+#define _gloffset_LogicOp 242
+#define _gloffset_StencilFunc 243
+#define _gloffset_StencilOp 244
+#define _gloffset_DepthFunc 245
+#define _gloffset_PixelZoom 246
+#define _gloffset_PixelTransferf 247
+#define _gloffset_PixelTransferi 248
+#define _gloffset_PixelStoref 249
+#define _gloffset_PixelStorei 250
+#define _gloffset_PixelMapfv 251
+#define _gloffset_PixelMapuiv 252
+#define _gloffset_PixelMapusv 253
+#define _gloffset_ReadBuffer 254
+#define _gloffset_CopyPixels 255
+#define _gloffset_ReadPixels 256
+#define _gloffset_DrawPixels 257
+#define _gloffset_GetBooleanv 258
+#define _gloffset_GetClipPlane 259
+#define _gloffset_GetDoublev 260
+#define _gloffset_GetError 261
+#define _gloffset_GetFloatv 262
+#define _gloffset_GetIntegerv 263
+#define _gloffset_GetLightfv 264
+#define _gloffset_GetLightiv 265
+#define _gloffset_GetMapdv 266
+#define _gloffset_GetMapfv 267
+#define _gloffset_GetMapiv 268
+#define _gloffset_GetMaterialfv 269
+#define _gloffset_GetMaterialiv 270
+#define _gloffset_GetPixelMapfv 271
+#define _gloffset_GetPixelMapuiv 272
+#define _gloffset_GetPixelMapusv 273
+#define _gloffset_GetPolygonStipple 274
+#define _gloffset_GetString 275
+#define _gloffset_GetTexEnvfv 276
+#define _gloffset_GetTexEnviv 277
+#define _gloffset_GetTexGendv 278
+#define _gloffset_GetTexGenfv 279
+#define _gloffset_GetTexGeniv 280
+#define _gloffset_GetTexImage 281
+#define _gloffset_GetTexParameterfv 282
+#define _gloffset_GetTexParameteriv 283
+#define _gloffset_GetTexLevelParameterfv 284
+#define _gloffset_GetTexLevelParameteriv 285
+#define _gloffset_IsEnabled 286
+#define _gloffset_IsList 287
+#define _gloffset_DepthRange 288
+#define _gloffset_Frustum 289
+#define _gloffset_LoadIdentity 290
+#define _gloffset_LoadMatrixf 291
+#define _gloffset_LoadMatrixd 292
+#define _gloffset_MatrixMode 293
+#define _gloffset_MultMatrixf 294
+#define _gloffset_MultMatrixd 295
+#define _gloffset_Ortho 296
+#define _gloffset_PopMatrix 297
+#define _gloffset_PushMatrix 298
+#define _gloffset_Rotated 299
+#define _gloffset_Rotatef 300
+#define _gloffset_Scaled 301
+#define _gloffset_Scalef 302
+#define _gloffset_Translated 303
+#define _gloffset_Translatef 304
+#define _gloffset_Viewport 305
+#define _gloffset_ArrayElement 306
+#define _gloffset_BindTexture 307
+#define _gloffset_ColorPointer 308
+#define _gloffset_DisableClientState 309
+#define _gloffset_DrawArrays 310
+#define _gloffset_DrawElements 311
+#define _gloffset_EdgeFlagPointer 312
+#define _gloffset_EnableClientState 313
+#define _gloffset_IndexPointer 314
+#define _gloffset_Indexub 315
+#define _gloffset_Indexubv 316
+#define _gloffset_InterleavedArrays 317
+#define _gloffset_NormalPointer 318
+#define _gloffset_PolygonOffset 319
+#define _gloffset_TexCoordPointer 320
+#define _gloffset_VertexPointer 321
+#define _gloffset_AreTexturesResident 322
+#define _gloffset_CopyTexImage1D 323
+#define _gloffset_CopyTexImage2D 324
+#define _gloffset_CopyTexSubImage1D 325
+#define _gloffset_CopyTexSubImage2D 326
+#define _gloffset_DeleteTextures 327
+#define _gloffset_GenTextures 328
+#define _gloffset_GetPointerv 329
+#define _gloffset_IsTexture 330
+#define _gloffset_PrioritizeTextures 331
+#define _gloffset_TexSubImage1D 332
+#define _gloffset_TexSubImage2D 333
+#define _gloffset_PopClientAttrib 334
+#define _gloffset_PushClientAttrib 335
+#define _gloffset_BlendColor 336
+#define _gloffset_BlendEquation 337
+#define _gloffset_DrawRangeElements 338
+#define _gloffset_ColorTable 339
+#define _gloffset_ColorTableParameterfv 340
+#define _gloffset_ColorTableParameteriv 341
+#define _gloffset_CopyColorTable 342
+#define _gloffset_GetColorTable 343
+#define _gloffset_GetColorTableParameterfv 344
+#define _gloffset_GetColorTableParameteriv 345
+#define _gloffset_ColorSubTable 346
+#define _gloffset_CopyColorSubTable 347
+#define _gloffset_ConvolutionFilter1D 348
+#define _gloffset_ConvolutionFilter2D 349
+#define _gloffset_ConvolutionParameterf 350
+#define _gloffset_ConvolutionParameterfv 351
+#define _gloffset_ConvolutionParameteri 352
+#define _gloffset_ConvolutionParameteriv 353
+#define _gloffset_CopyConvolutionFilter1D 354
+#define _gloffset_CopyConvolutionFilter2D 355
+#define _gloffset_GetConvolutionFilter 356
+#define _gloffset_GetConvolutionParameterfv 357
+#define _gloffset_GetConvolutionParameteriv 358
+#define _gloffset_GetSeparableFilter 359
+#define _gloffset_SeparableFilter2D 360
+#define _gloffset_GetHistogram 361
+#define _gloffset_GetHistogramParameterfv 362
+#define _gloffset_GetHistogramParameteriv 363
+#define _gloffset_GetMinmax 364
+#define _gloffset_GetMinmaxParameterfv 365
+#define _gloffset_GetMinmaxParameteriv 366
+#define _gloffset_Histogram 367
+#define _gloffset_Minmax 368
+#define _gloffset_ResetHistogram 369
+#define _gloffset_ResetMinmax 370
+#define _gloffset_TexImage3D 371
+#define _gloffset_TexSubImage3D 372
+#define _gloffset_CopyTexSubImage3D 373
+#define _gloffset_ActiveTextureARB 374
+#define _gloffset_ClientActiveTextureARB 375
+#define _gloffset_MultiTexCoord1dARB 376
+#define _gloffset_MultiTexCoord1dvARB 377
+#define _gloffset_MultiTexCoord1fARB 378
+#define _gloffset_MultiTexCoord1fvARB 379
+#define _gloffset_MultiTexCoord1iARB 380
+#define _gloffset_MultiTexCoord1ivARB 381
+#define _gloffset_MultiTexCoord1sARB 382
+#define _gloffset_MultiTexCoord1svARB 383
+#define _gloffset_MultiTexCoord2dARB 384
+#define _gloffset_MultiTexCoord2dvARB 385
+#define _gloffset_MultiTexCoord2fARB 386
+#define _gloffset_MultiTexCoord2fvARB 387
+#define _gloffset_MultiTexCoord2iARB 388
+#define _gloffset_MultiTexCoord2ivARB 389
+#define _gloffset_MultiTexCoord2sARB 390
+#define _gloffset_MultiTexCoord2svARB 391
+#define _gloffset_MultiTexCoord3dARB 392
+#define _gloffset_MultiTexCoord3dvARB 393
+#define _gloffset_MultiTexCoord3fARB 394
+#define _gloffset_MultiTexCoord3fvARB 395
+#define _gloffset_MultiTexCoord3iARB 396
+#define _gloffset_MultiTexCoord3ivARB 397
+#define _gloffset_MultiTexCoord3sARB 398
+#define _gloffset_MultiTexCoord3svARB 399
+#define _gloffset_MultiTexCoord4dARB 400
+#define _gloffset_MultiTexCoord4dvARB 401
+#define _gloffset_MultiTexCoord4fARB 402
+#define _gloffset_MultiTexCoord4fvARB 403
+#define _gloffset_MultiTexCoord4iARB 404
+#define _gloffset_MultiTexCoord4ivARB 405
+#define _gloffset_MultiTexCoord4sARB 406
+#define _gloffset_MultiTexCoord4svARB 407
+
+#if !FEATURE_remap_table
+
+#define _gloffset_AttachShader 408
+#define _gloffset_CreateProgram 409
+#define _gloffset_CreateShader 410
+#define _gloffset_DeleteProgram 411
+#define _gloffset_DeleteShader 412
+#define _gloffset_DetachShader 413
+#define _gloffset_GetAttachedShaders 414
+#define _gloffset_GetProgramInfoLog 415
+#define _gloffset_GetProgramiv 416
+#define _gloffset_GetShaderInfoLog 417
+#define _gloffset_GetShaderiv 418
+#define _gloffset_IsProgram 419
+#define _gloffset_IsShader 420
+#define _gloffset_StencilFuncSeparate 421
+#define _gloffset_StencilMaskSeparate 422
+#define _gloffset_StencilOpSeparate 423
+#define _gloffset_UniformMatrix2x3fv 424
+#define _gloffset_UniformMatrix2x4fv 425
+#define _gloffset_UniformMatrix3x2fv 426
+#define _gloffset_UniformMatrix3x4fv 427
+#define _gloffset_UniformMatrix4x2fv 428
+#define _gloffset_UniformMatrix4x3fv 429
+#define _gloffset_ClampColor 430
+#define _gloffset_ClearBufferfi 431
+#define _gloffset_ClearBufferfv 432
+#define _gloffset_ClearBufferiv 433
+#define _gloffset_ClearBufferuiv 434
+#define _gloffset_GetStringi 435
+#define _gloffset_TexBuffer 436
+#define _gloffset_FramebufferTexture 437
+#define _gloffset_GetBufferParameteri64v 438
+#define _gloffset_GetInteger64i_v 439
+#define _gloffset_VertexAttribDivisor 440
+#define _gloffset_LoadTransposeMatrixdARB 441
+#define _gloffset_LoadTransposeMatrixfARB 442
+#define _gloffset_MultTransposeMatrixdARB 443
+#define _gloffset_MultTransposeMatrixfARB 444
+#define _gloffset_SampleCoverageARB 445
+#define _gloffset_CompressedTexImage1DARB 446
+#define _gloffset_CompressedTexImage2DARB 447
+#define _gloffset_CompressedTexImage3DARB 448
+#define _gloffset_CompressedTexSubImage1DARB 449
+#define _gloffset_CompressedTexSubImage2DARB 450
+#define _gloffset_CompressedTexSubImage3DARB 451
+#define _gloffset_GetCompressedTexImageARB 452
+#define _gloffset_DisableVertexAttribArrayARB 453
+#define _gloffset_EnableVertexAttribArrayARB 454
+#define _gloffset_GetProgramEnvParameterdvARB 455
+#define _gloffset_GetProgramEnvParameterfvARB 456
+#define _gloffset_GetProgramLocalParameterdvARB 457
+#define _gloffset_GetProgramLocalParameterfvARB 458
+#define _gloffset_GetProgramStringARB 459
+#define _gloffset_GetProgramivARB 460
+#define _gloffset_GetVertexAttribdvARB 461
+#define _gloffset_GetVertexAttribfvARB 462
+#define _gloffset_GetVertexAttribivARB 463
+#define _gloffset_ProgramEnvParameter4dARB 464
+#define _gloffset_ProgramEnvParameter4dvARB 465
+#define _gloffset_ProgramEnvParameter4fARB 466
+#define _gloffset_ProgramEnvParameter4fvARB 467
+#define _gloffset_ProgramLocalParameter4dARB 468
+#define _gloffset_ProgramLocalParameter4dvARB 469
+#define _gloffset_ProgramLocalParameter4fARB 470
+#define _gloffset_ProgramLocalParameter4fvARB 471
+#define _gloffset_ProgramStringARB 472
+#define _gloffset_VertexAttrib1dARB 473
+#define _gloffset_VertexAttrib1dvARB 474
+#define _gloffset_VertexAttrib1fARB 475
+#define _gloffset_VertexAttrib1fvARB 476
+#define _gloffset_VertexAttrib1sARB 477
+#define _gloffset_VertexAttrib1svARB 478
+#define _gloffset_VertexAttrib2dARB 479
+#define _gloffset_VertexAttrib2dvARB 480
+#define _gloffset_VertexAttrib2fARB 481
+#define _gloffset_VertexAttrib2fvARB 482
+#define _gloffset_VertexAttrib2sARB 483
+#define _gloffset_VertexAttrib2svARB 484
+#define _gloffset_VertexAttrib3dARB 485
+#define _gloffset_VertexAttrib3dvARB 486
+#define _gloffset_VertexAttrib3fARB 487
+#define _gloffset_VertexAttrib3fvARB 488
+#define _gloffset_VertexAttrib3sARB 489
+#define _gloffset_VertexAttrib3svARB 490
+#define _gloffset_VertexAttrib4NbvARB 491
+#define _gloffset_VertexAttrib4NivARB 492
+#define _gloffset_VertexAttrib4NsvARB 493
+#define _gloffset_VertexAttrib4NubARB 494
+#define _gloffset_VertexAttrib4NubvARB 495
+#define _gloffset_VertexAttrib4NuivARB 496
+#define _gloffset_VertexAttrib4NusvARB 497
+#define _gloffset_VertexAttrib4bvARB 498
+#define _gloffset_VertexAttrib4dARB 499
+#define _gloffset_VertexAttrib4dvARB 500
+#define _gloffset_VertexAttrib4fARB 501
+#define _gloffset_VertexAttrib4fvARB 502
+#define _gloffset_VertexAttrib4ivARB 503
+#define _gloffset_VertexAttrib4sARB 504
+#define _gloffset_VertexAttrib4svARB 505
+#define _gloffset_VertexAttrib4ubvARB 506
+#define _gloffset_VertexAttrib4uivARB 507
+#define _gloffset_VertexAttrib4usvARB 508
+#define _gloffset_VertexAttribPointerARB 509
+#define _gloffset_BindBufferARB 510
+#define _gloffset_BufferDataARB 511
+#define _gloffset_BufferSubDataARB 512
+#define _gloffset_DeleteBuffersARB 513
+#define _gloffset_GenBuffersARB 514
+#define _gloffset_GetBufferParameterivARB 515
+#define _gloffset_GetBufferPointervARB 516
+#define _gloffset_GetBufferSubDataARB 517
+#define _gloffset_IsBufferARB 518
+#define _gloffset_MapBufferARB 519
+#define _gloffset_UnmapBufferARB 520
+#define _gloffset_BeginQueryARB 521
+#define _gloffset_DeleteQueriesARB 522
+#define _gloffset_EndQueryARB 523
+#define _gloffset_GenQueriesARB 524
+#define _gloffset_GetQueryObjectivARB 525
+#define _gloffset_GetQueryObjectuivARB 526
+#define _gloffset_GetQueryivARB 527
+#define _gloffset_IsQueryARB 528
+#define _gloffset_AttachObjectARB 529
+#define _gloffset_CompileShaderARB 530
+#define _gloffset_CreateProgramObjectARB 531
+#define _gloffset_CreateShaderObjectARB 532
+#define _gloffset_DeleteObjectARB 533
+#define _gloffset_DetachObjectARB 534
+#define _gloffset_GetActiveUniformARB 535
+#define _gloffset_GetAttachedObjectsARB 536
+#define _gloffset_GetHandleARB 537
+#define _gloffset_GetInfoLogARB 538
+#define _gloffset_GetObjectParameterfvARB 539
+#define _gloffset_GetObjectParameterivARB 540
+#define _gloffset_GetShaderSourceARB 541
+#define _gloffset_GetUniformLocationARB 542
+#define _gloffset_GetUniformfvARB 543
+#define _gloffset_GetUniformivARB 544
+#define _gloffset_LinkProgramARB 545
+#define _gloffset_ShaderSourceARB 546
+#define _gloffset_Uniform1fARB 547
+#define _gloffset_Uniform1fvARB 548
+#define _gloffset_Uniform1iARB 549
+#define _gloffset_Uniform1ivARB 550
+#define _gloffset_Uniform2fARB 551
+#define _gloffset_Uniform2fvARB 552
+#define _gloffset_Uniform2iARB 553
+#define _gloffset_Uniform2ivARB 554
+#define _gloffset_Uniform3fARB 555
+#define _gloffset_Uniform3fvARB 556
+#define _gloffset_Uniform3iARB 557
+#define _gloffset_Uniform3ivARB 558
+#define _gloffset_Uniform4fARB 559
+#define _gloffset_Uniform4fvARB 560
+#define _gloffset_Uniform4iARB 561
+#define _gloffset_Uniform4ivARB 562
+#define _gloffset_UniformMatrix2fvARB 563
+#define _gloffset_UniformMatrix3fvARB 564
+#define _gloffset_UniformMatrix4fvARB 565
+#define _gloffset_UseProgramObjectARB 566
+#define _gloffset_ValidateProgramARB 567
+#define _gloffset_BindAttribLocationARB 568
+#define _gloffset_GetActiveAttribARB 569
+#define _gloffset_GetAttribLocationARB 570
+#define _gloffset_DrawBuffersARB 571
+#define _gloffset_ClampColorARB 572
+#define _gloffset_DrawArraysInstancedARB 573
+#define _gloffset_DrawElementsInstancedARB 574
+#define _gloffset_RenderbufferStorageMultisample 575
+#define _gloffset_FramebufferTextureARB 576
+#define _gloffset_FramebufferTextureFaceARB 577
+#define _gloffset_ProgramParameteriARB 578
+#define _gloffset_VertexAttribDivisorARB 579
+#define _gloffset_FlushMappedBufferRange 580
+#define _gloffset_MapBufferRange 581
+#define _gloffset_TexBufferARB 582
+#define _gloffset_BindVertexArray 583
+#define _gloffset_GenVertexArrays 584
+#define _gloffset_CopyBufferSubData 585
+#define _gloffset_ClientWaitSync 586
+#define _gloffset_DeleteSync 587
+#define _gloffset_FenceSync 588
+#define _gloffset_GetInteger64v 589
+#define _gloffset_GetSynciv 590
+#define _gloffset_IsSync 591
+#define _gloffset_WaitSync 592
+#define _gloffset_DrawElementsBaseVertex 593
+#define _gloffset_DrawElementsInstancedBaseVertex 594
+#define _gloffset_DrawRangeElementsBaseVertex 595
+#define _gloffset_MultiDrawElementsBaseVertex 596
+#define _gloffset_BlendEquationSeparateiARB 597
+#define _gloffset_BlendEquationiARB 598
+#define _gloffset_BlendFuncSeparateiARB 599
+#define _gloffset_BlendFunciARB 600
+#define _gloffset_BindSampler 601
+#define _gloffset_DeleteSamplers 602
+#define _gloffset_GenSamplers 603
+#define _gloffset_GetSamplerParameterIiv 604
+#define _gloffset_GetSamplerParameterIuiv 605
+#define _gloffset_GetSamplerParameterfv 606
+#define _gloffset_GetSamplerParameteriv 607
+#define _gloffset_IsSampler 608
+#define _gloffset_SamplerParameterIiv 609
+#define _gloffset_SamplerParameterIuiv 610
+#define _gloffset_SamplerParameterf 611
+#define _gloffset_SamplerParameterfv 612
+#define _gloffset_SamplerParameteri 613
+#define _gloffset_SamplerParameteriv 614
+#define _gloffset_ColorP3ui 615
+#define _gloffset_ColorP3uiv 616
+#define _gloffset_ColorP4ui 617
+#define _gloffset_ColorP4uiv 618
+#define _gloffset_MultiTexCoordP1ui 619
+#define _gloffset_MultiTexCoordP1uiv 620
+#define _gloffset_MultiTexCoordP2ui 621
+#define _gloffset_MultiTexCoordP2uiv 622
+#define _gloffset_MultiTexCoordP3ui 623
+#define _gloffset_MultiTexCoordP3uiv 624
+#define _gloffset_MultiTexCoordP4ui 625
+#define _gloffset_MultiTexCoordP4uiv 626
+#define _gloffset_NormalP3ui 627
+#define _gloffset_NormalP3uiv 628
+#define _gloffset_SecondaryColorP3ui 629
+#define _gloffset_SecondaryColorP3uiv 630
+#define _gloffset_TexCoordP1ui 631
+#define _gloffset_TexCoordP1uiv 632
+#define _gloffset_TexCoordP2ui 633
+#define _gloffset_TexCoordP2uiv 634
+#define _gloffset_TexCoordP3ui 635
+#define _gloffset_TexCoordP3uiv 636
+#define _gloffset_TexCoordP4ui 637
+#define _gloffset_TexCoordP4uiv 638
+#define _gloffset_VertexAttribP1ui 639
+#define _gloffset_VertexAttribP1uiv 640
+#define _gloffset_VertexAttribP2ui 641
+#define _gloffset_VertexAttribP2uiv 642
+#define _gloffset_VertexAttribP3ui 643
+#define _gloffset_VertexAttribP3uiv 644
+#define _gloffset_VertexAttribP4ui 645
+#define _gloffset_VertexAttribP4uiv 646
+#define _gloffset_VertexP2ui 647
+#define _gloffset_VertexP2uiv 648
+#define _gloffset_VertexP3ui 649
+#define _gloffset_VertexP3uiv 650
+#define _gloffset_VertexP4ui 651
+#define _gloffset_VertexP4uiv 652
+#define _gloffset_BindTransformFeedback 653
+#define _gloffset_DeleteTransformFeedbacks 654
+#define _gloffset_DrawTransformFeedback 655
+#define _gloffset_GenTransformFeedbacks 656
+#define _gloffset_IsTransformFeedback 657
+#define _gloffset_PauseTransformFeedback 658
+#define _gloffset_ResumeTransformFeedback 659
+#define _gloffset_ClearDepthf 660
+#define _gloffset_DepthRangef 661
+#define _gloffset_GetShaderPrecisionFormat 662
+#define _gloffset_ReleaseShaderCompiler 663
+#define _gloffset_ShaderBinary 664
+#define _gloffset_DebugMessageCallbackARB 665
+#define _gloffset_DebugMessageControlARB 666
+#define _gloffset_DebugMessageInsertARB 667
+#define _gloffset_GetDebugMessageLogARB 668
+#define _gloffset_GetGraphicsResetStatusARB 669
+#define _gloffset_GetnColorTableARB 670
+#define _gloffset_GetnCompressedTexImageARB 671
+#define _gloffset_GetnConvolutionFilterARB 672
+#define _gloffset_GetnHistogramARB 673
+#define _gloffset_GetnMapdvARB 674
+#define _gloffset_GetnMapfvARB 675
+#define _gloffset_GetnMapivARB 676
+#define _gloffset_GetnMinmaxARB 677
+#define _gloffset_GetnPixelMapfvARB 678
+#define _gloffset_GetnPixelMapuivARB 679
+#define _gloffset_GetnPixelMapusvARB 680
+#define _gloffset_GetnPolygonStippleARB 681
+#define _gloffset_GetnSeparableFilterARB 682
+#define _gloffset_GetnTexImageARB 683
+#define _gloffset_GetnUniformdvARB 684
+#define _gloffset_GetnUniformfvARB 685
+#define _gloffset_GetnUniformivARB 686
+#define _gloffset_GetnUniformuivARB 687
+#define _gloffset_ReadnPixelsARB 688
+#define _gloffset_TexStorage1D 689
+#define _gloffset_TexStorage2D 690
+#define _gloffset_TexStorage3D 691
+#define _gloffset_TextureStorage1DEXT 692
+#define _gloffset_TextureStorage2DEXT 693
+#define _gloffset_TextureStorage3DEXT 694
+#define _gloffset_PolygonOffsetEXT 695
+#define _gloffset_GetPixelTexGenParameterfvSGIS 696
+#define _gloffset_GetPixelTexGenParameterivSGIS 697
+#define _gloffset_PixelTexGenParameterfSGIS 698
+#define _gloffset_PixelTexGenParameterfvSGIS 699
+#define _gloffset_PixelTexGenParameteriSGIS 700
+#define _gloffset_PixelTexGenParameterivSGIS 701
+#define _gloffset_SampleMaskSGIS 702
+#define _gloffset_SamplePatternSGIS 703
+#define _gloffset_ColorPointerEXT 704
+#define _gloffset_EdgeFlagPointerEXT 705
+#define _gloffset_IndexPointerEXT 706
+#define _gloffset_NormalPointerEXT 707
+#define _gloffset_TexCoordPointerEXT 708
+#define _gloffset_VertexPointerEXT 709
+#define _gloffset_PointParameterfEXT 710
+#define _gloffset_PointParameterfvEXT 711
+#define _gloffset_LockArraysEXT 712
+#define _gloffset_UnlockArraysEXT 713
+#define _gloffset_SecondaryColor3bEXT 714
+#define _gloffset_SecondaryColor3bvEXT 715
+#define _gloffset_SecondaryColor3dEXT 716
+#define _gloffset_SecondaryColor3dvEXT 717
+#define _gloffset_SecondaryColor3fEXT 718
+#define _gloffset_SecondaryColor3fvEXT 719
+#define _gloffset_SecondaryColor3iEXT 720
+#define _gloffset_SecondaryColor3ivEXT 721
+#define _gloffset_SecondaryColor3sEXT 722
+#define _gloffset_SecondaryColor3svEXT 723
+#define _gloffset_SecondaryColor3ubEXT 724
+#define _gloffset_SecondaryColor3ubvEXT 725
+#define _gloffset_SecondaryColor3uiEXT 726
+#define _gloffset_SecondaryColor3uivEXT 727
+#define _gloffset_SecondaryColor3usEXT 728
+#define _gloffset_SecondaryColor3usvEXT 729
+#define _gloffset_SecondaryColorPointerEXT 730
+#define _gloffset_MultiDrawArraysEXT 731
+#define _gloffset_MultiDrawElementsEXT 732
+#define _gloffset_FogCoordPointerEXT 733
+#define _gloffset_FogCoorddEXT 734
+#define _gloffset_FogCoorddvEXT 735
+#define _gloffset_FogCoordfEXT 736
+#define _gloffset_FogCoordfvEXT 737
+#define _gloffset_PixelTexGenSGIX 738
+#define _gloffset_BlendFuncSeparateEXT 739
+#define _gloffset_FlushVertexArrayRangeNV 740
+#define _gloffset_VertexArrayRangeNV 741
+#define _gloffset_CombinerInputNV 742
+#define _gloffset_CombinerOutputNV 743
+#define _gloffset_CombinerParameterfNV 744
+#define _gloffset_CombinerParameterfvNV 745
+#define _gloffset_CombinerParameteriNV 746
+#define _gloffset_CombinerParameterivNV 747
+#define _gloffset_FinalCombinerInputNV 748
+#define _gloffset_GetCombinerInputParameterfvNV 749
+#define _gloffset_GetCombinerInputParameterivNV 750
+#define _gloffset_GetCombinerOutputParameterfvNV 751
+#define _gloffset_GetCombinerOutputParameterivNV 752
+#define _gloffset_GetFinalCombinerInputParameterfvNV 753
+#define _gloffset_GetFinalCombinerInputParameterivNV 754
+#define _gloffset_ResizeBuffersMESA 755
+#define _gloffset_WindowPos2dMESA 756
+#define _gloffset_WindowPos2dvMESA 757
+#define _gloffset_WindowPos2fMESA 758
+#define _gloffset_WindowPos2fvMESA 759
+#define _gloffset_WindowPos2iMESA 760
+#define _gloffset_WindowPos2ivMESA 761
+#define _gloffset_WindowPos2sMESA 762
+#define _gloffset_WindowPos2svMESA 763
+#define _gloffset_WindowPos3dMESA 764
+#define _gloffset_WindowPos3dvMESA 765
+#define _gloffset_WindowPos3fMESA 766
+#define _gloffset_WindowPos3fvMESA 767
+#define _gloffset_WindowPos3iMESA 768
+#define _gloffset_WindowPos3ivMESA 769
+#define _gloffset_WindowPos3sMESA 770
+#define _gloffset_WindowPos3svMESA 771
+#define _gloffset_WindowPos4dMESA 772
+#define _gloffset_WindowPos4dvMESA 773
+#define _gloffset_WindowPos4fMESA 774
+#define _gloffset_WindowPos4fvMESA 775
+#define _gloffset_WindowPos4iMESA 776
+#define _gloffset_WindowPos4ivMESA 777
+#define _gloffset_WindowPos4sMESA 778
+#define _gloffset_WindowPos4svMESA 779
+#define _gloffset_MultiModeDrawArraysIBM 780
+#define _gloffset_MultiModeDrawElementsIBM 781
+#define _gloffset_DeleteFencesNV 782
+#define _gloffset_FinishFenceNV 783
+#define _gloffset_GenFencesNV 784
+#define _gloffset_GetFenceivNV 785
+#define _gloffset_IsFenceNV 786
+#define _gloffset_SetFenceNV 787
+#define _gloffset_TestFenceNV 788
+#define _gloffset_AreProgramsResidentNV 789
+#define _gloffset_BindProgramNV 790
+#define _gloffset_DeleteProgramsNV 791
+#define _gloffset_ExecuteProgramNV 792
+#define _gloffset_GenProgramsNV 793
+#define _gloffset_GetProgramParameterdvNV 794
+#define _gloffset_GetProgramParameterfvNV 795
+#define _gloffset_GetProgramStringNV 796
+#define _gloffset_GetProgramivNV 797
+#define _gloffset_GetTrackMatrixivNV 798
+#define _gloffset_GetVertexAttribPointervNV 799
+#define _gloffset_GetVertexAttribdvNV 800
+#define _gloffset_GetVertexAttribfvNV 801
+#define _gloffset_GetVertexAttribivNV 802
+#define _gloffset_IsProgramNV 803
+#define _gloffset_LoadProgramNV 804
+#define _gloffset_ProgramParameters4dvNV 805
+#define _gloffset_ProgramParameters4fvNV 806
+#define _gloffset_RequestResidentProgramsNV 807
+#define _gloffset_TrackMatrixNV 808
+#define _gloffset_VertexAttrib1dNV 809
+#define _gloffset_VertexAttrib1dvNV 810
+#define _gloffset_VertexAttrib1fNV 811
+#define _gloffset_VertexAttrib1fvNV 812
+#define _gloffset_VertexAttrib1sNV 813
+#define _gloffset_VertexAttrib1svNV 814
+#define _gloffset_VertexAttrib2dNV 815
+#define _gloffset_VertexAttrib2dvNV 816
+#define _gloffset_VertexAttrib2fNV 817
+#define _gloffset_VertexAttrib2fvNV 818
+#define _gloffset_VertexAttrib2sNV 819
+#define _gloffset_VertexAttrib2svNV 820
+#define _gloffset_VertexAttrib3dNV 821
+#define _gloffset_VertexAttrib3dvNV 822
+#define _gloffset_VertexAttrib3fNV 823
+#define _gloffset_VertexAttrib3fvNV 824
+#define _gloffset_VertexAttrib3sNV 825
+#define _gloffset_VertexAttrib3svNV 826
+#define _gloffset_VertexAttrib4dNV 827
+#define _gloffset_VertexAttrib4dvNV 828
+#define _gloffset_VertexAttrib4fNV 829
+#define _gloffset_VertexAttrib4fvNV 830
+#define _gloffset_VertexAttrib4sNV 831
+#define _gloffset_VertexAttrib4svNV 832
+#define _gloffset_VertexAttrib4ubNV 833
+#define _gloffset_VertexAttrib4ubvNV 834
+#define _gloffset_VertexAttribPointerNV 835
+#define _gloffset_VertexAttribs1dvNV 836
+#define _gloffset_VertexAttribs1fvNV 837
+#define _gloffset_VertexAttribs1svNV 838
+#define _gloffset_VertexAttribs2dvNV 839
+#define _gloffset_VertexAttribs2fvNV 840
+#define _gloffset_VertexAttribs2svNV 841
+#define _gloffset_VertexAttribs3dvNV 842
+#define _gloffset_VertexAttribs3fvNV 843
+#define _gloffset_VertexAttribs3svNV 844
+#define _gloffset_VertexAttribs4dvNV 845
+#define _gloffset_VertexAttribs4fvNV 846
+#define _gloffset_VertexAttribs4svNV 847
+#define _gloffset_VertexAttribs4ubvNV 848
+#define _gloffset_GetTexBumpParameterfvATI 849
+#define _gloffset_GetTexBumpParameterivATI 850
+#define _gloffset_TexBumpParameterfvATI 851
+#define _gloffset_TexBumpParameterivATI 852
+#define _gloffset_AlphaFragmentOp1ATI 853
+#define _gloffset_AlphaFragmentOp2ATI 854
+#define _gloffset_AlphaFragmentOp3ATI 855
+#define _gloffset_BeginFragmentShaderATI 856
+#define _gloffset_BindFragmentShaderATI 857
+#define _gloffset_ColorFragmentOp1ATI 858
+#define _gloffset_ColorFragmentOp2ATI 859
+#define _gloffset_ColorFragmentOp3ATI 860
+#define _gloffset_DeleteFragmentShaderATI 861
+#define _gloffset_EndFragmentShaderATI 862
+#define _gloffset_GenFragmentShadersATI 863
+#define _gloffset_PassTexCoordATI 864
+#define _gloffset_SampleMapATI 865
+#define _gloffset_SetFragmentShaderConstantATI 866
+#define _gloffset_PointParameteriNV 867
+#define _gloffset_PointParameterivNV 868
+#define _gloffset_ActiveStencilFaceEXT 869
+#define _gloffset_BindVertexArrayAPPLE 870
+#define _gloffset_DeleteVertexArraysAPPLE 871
+#define _gloffset_GenVertexArraysAPPLE 872
+#define _gloffset_IsVertexArrayAPPLE 873
+#define _gloffset_GetProgramNamedParameterdvNV 874
+#define _gloffset_GetProgramNamedParameterfvNV 875
+#define _gloffset_ProgramNamedParameter4dNV 876
+#define _gloffset_ProgramNamedParameter4dvNV 877
+#define _gloffset_ProgramNamedParameter4fNV 878
+#define _gloffset_ProgramNamedParameter4fvNV 879
+#define _gloffset_PrimitiveRestartIndexNV 880
+#define _gloffset_PrimitiveRestartNV 881
+#define _gloffset_DepthBoundsEXT 882
+#define _gloffset_BlendEquationSeparateEXT 883
+#define _gloffset_BindFramebufferEXT 884
+#define _gloffset_BindRenderbufferEXT 885
+#define _gloffset_CheckFramebufferStatusEXT 886
+#define _gloffset_DeleteFramebuffersEXT 887
+#define _gloffset_DeleteRenderbuffersEXT 888
+#define _gloffset_FramebufferRenderbufferEXT 889
+#define _gloffset_FramebufferTexture1DEXT 890
+#define _gloffset_FramebufferTexture2DEXT 891
+#define _gloffset_FramebufferTexture3DEXT 892
+#define _gloffset_GenFramebuffersEXT 893
+#define _gloffset_GenRenderbuffersEXT 894
+#define _gloffset_GenerateMipmapEXT 895
+#define _gloffset_GetFramebufferAttachmentParameterivEXT 896
+#define _gloffset_GetRenderbufferParameterivEXT 897
+#define _gloffset_IsFramebufferEXT 898
+#define _gloffset_IsRenderbufferEXT 899
+#define _gloffset_RenderbufferStorageEXT 900
+#define _gloffset_BlitFramebufferEXT 901
+#define _gloffset_BufferParameteriAPPLE 902
+#define _gloffset_FlushMappedBufferRangeAPPLE 903
+#define _gloffset_BindFragDataLocationEXT 904
+#define _gloffset_GetFragDataLocationEXT 905
+#define _gloffset_GetUniformuivEXT 906
+#define _gloffset_GetVertexAttribIivEXT 907
+#define _gloffset_GetVertexAttribIuivEXT 908
+#define _gloffset_Uniform1uiEXT 909
+#define _gloffset_Uniform1uivEXT 910
+#define _gloffset_Uniform2uiEXT 911
+#define _gloffset_Uniform2uivEXT 912
+#define _gloffset_Uniform3uiEXT 913
+#define _gloffset_Uniform3uivEXT 914
+#define _gloffset_Uniform4uiEXT 915
+#define _gloffset_Uniform4uivEXT 916
+#define _gloffset_VertexAttribI1iEXT 917
+#define _gloffset_VertexAttribI1ivEXT 918
+#define _gloffset_VertexAttribI1uiEXT 919
+#define _gloffset_VertexAttribI1uivEXT 920
+#define _gloffset_VertexAttribI2iEXT 921
+#define _gloffset_VertexAttribI2ivEXT 922
+#define _gloffset_VertexAttribI2uiEXT 923
+#define _gloffset_VertexAttribI2uivEXT 924
+#define _gloffset_VertexAttribI3iEXT 925
+#define _gloffset_VertexAttribI3ivEXT 926
+#define _gloffset_VertexAttribI3uiEXT 927
+#define _gloffset_VertexAttribI3uivEXT 928
+#define _gloffset_VertexAttribI4bvEXT 929
+#define _gloffset_VertexAttribI4iEXT 930
+#define _gloffset_VertexAttribI4ivEXT 931
+#define _gloffset_VertexAttribI4svEXT 932
+#define _gloffset_VertexAttribI4ubvEXT 933
+#define _gloffset_VertexAttribI4uiEXT 934
+#define _gloffset_VertexAttribI4uivEXT 935
+#define _gloffset_VertexAttribI4usvEXT 936
+#define _gloffset_VertexAttribIPointerEXT 937
+#define _gloffset_FramebufferTextureLayerEXT 938
+#define _gloffset_ColorMaskIndexedEXT 939
+#define _gloffset_DisableIndexedEXT 940
+#define _gloffset_EnableIndexedEXT 941
+#define _gloffset_GetBooleanIndexedvEXT 942
+#define _gloffset_GetIntegerIndexedvEXT 943
+#define _gloffset_IsEnabledIndexedEXT 944
+#define _gloffset_ClearColorIiEXT 945
+#define _gloffset_ClearColorIuiEXT 946
+#define _gloffset_GetTexParameterIivEXT 947
+#define _gloffset_GetTexParameterIuivEXT 948
+#define _gloffset_TexParameterIivEXT 949
+#define _gloffset_TexParameterIuivEXT 950
+#define _gloffset_BeginConditionalRenderNV 951
+#define _gloffset_EndConditionalRenderNV 952
+#define _gloffset_BeginTransformFeedbackEXT 953
+#define _gloffset_BindBufferBaseEXT 954
+#define _gloffset_BindBufferOffsetEXT 955
+#define _gloffset_BindBufferRangeEXT 956
+#define _gloffset_EndTransformFeedbackEXT 957
+#define _gloffset_GetTransformFeedbackVaryingEXT 958
+#define _gloffset_TransformFeedbackVaryingsEXT 959
+#define _gloffset_ProvokingVertexEXT 960
+#define _gloffset_GetTexParameterPointervAPPLE 961
+#define _gloffset_TextureRangeAPPLE 962
+#define _gloffset_GetObjectParameterivAPPLE 963
+#define _gloffset_ObjectPurgeableAPPLE 964
+#define _gloffset_ObjectUnpurgeableAPPLE 965
+#define _gloffset_ActiveProgramEXT 966
+#define _gloffset_CreateShaderProgramEXT 967
+#define _gloffset_UseShaderProgramEXT 968
+#define _gloffset_TextureBarrierNV 969
+#define _gloffset_StencilFuncSeparateATI 970
+#define _gloffset_ProgramEnvParameters4fvEXT 971
+#define _gloffset_ProgramLocalParameters4fvEXT 972
+#define _gloffset_GetQueryObjecti64vEXT 973
+#define _gloffset_GetQueryObjectui64vEXT 974
+#define _gloffset_EGLImageTargetRenderbufferStorageOES 975
+#define _gloffset_EGLImageTargetTexture2DOES 976
+
+#else /* !FEATURE_remap_table */
+
+#define driDispatchRemapTable_size 569
+extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
+
+#define AttachShader_remap_index 0
+#define CreateProgram_remap_index 1
+#define CreateShader_remap_index 2
+#define DeleteProgram_remap_index 3
+#define DeleteShader_remap_index 4
+#define DetachShader_remap_index 5
+#define GetAttachedShaders_remap_index 6
+#define GetProgramInfoLog_remap_index 7
+#define GetProgramiv_remap_index 8
+#define GetShaderInfoLog_remap_index 9
+#define GetShaderiv_remap_index 10
+#define IsProgram_remap_index 11
+#define IsShader_remap_index 12
+#define StencilFuncSeparate_remap_index 13
+#define StencilMaskSeparate_remap_index 14
+#define StencilOpSeparate_remap_index 15
+#define UniformMatrix2x3fv_remap_index 16
+#define UniformMatrix2x4fv_remap_index 17
+#define UniformMatrix3x2fv_remap_index 18
+#define UniformMatrix3x4fv_remap_index 19
+#define UniformMatrix4x2fv_remap_index 20
+#define UniformMatrix4x3fv_remap_index 21
+#define ClampColor_remap_index 22
+#define ClearBufferfi_remap_index 23
+#define ClearBufferfv_remap_index 24
+#define ClearBufferiv_remap_index 25
+#define ClearBufferuiv_remap_index 26
+#define GetStringi_remap_index 27
+#define TexBuffer_remap_index 28
+#define FramebufferTexture_remap_index 29
+#define GetBufferParameteri64v_remap_index 30
+#define GetInteger64i_v_remap_index 31
+#define VertexAttribDivisor_remap_index 32
+#define LoadTransposeMatrixdARB_remap_index 33
+#define LoadTransposeMatrixfARB_remap_index 34
+#define MultTransposeMatrixdARB_remap_index 35
+#define MultTransposeMatrixfARB_remap_index 36
+#define SampleCoverageARB_remap_index 37
+#define CompressedTexImage1DARB_remap_index 38
+#define CompressedTexImage2DARB_remap_index 39
+#define CompressedTexImage3DARB_remap_index 40
+#define CompressedTexSubImage1DARB_remap_index 41
+#define CompressedTexSubImage2DARB_remap_index 42
+#define CompressedTexSubImage3DARB_remap_index 43
+#define GetCompressedTexImageARB_remap_index 44
+#define DisableVertexAttribArrayARB_remap_index 45
+#define EnableVertexAttribArrayARB_remap_index 46
+#define GetProgramEnvParameterdvARB_remap_index 47
+#define GetProgramEnvParameterfvARB_remap_index 48
+#define GetProgramLocalParameterdvARB_remap_index 49
+#define GetProgramLocalParameterfvARB_remap_index 50
+#define GetProgramStringARB_remap_index 51
+#define GetProgramivARB_remap_index 52
+#define GetVertexAttribdvARB_remap_index 53
+#define GetVertexAttribfvARB_remap_index 54
+#define GetVertexAttribivARB_remap_index 55
+#define ProgramEnvParameter4dARB_remap_index 56
+#define ProgramEnvParameter4dvARB_remap_index 57
+#define ProgramEnvParameter4fARB_remap_index 58
+#define ProgramEnvParameter4fvARB_remap_index 59
+#define ProgramLocalParameter4dARB_remap_index 60
+#define ProgramLocalParameter4dvARB_remap_index 61
+#define ProgramLocalParameter4fARB_remap_index 62
+#define ProgramLocalParameter4fvARB_remap_index 63
+#define ProgramStringARB_remap_index 64
+#define VertexAttrib1dARB_remap_index 65
+#define VertexAttrib1dvARB_remap_index 66
+#define VertexAttrib1fARB_remap_index 67
+#define VertexAttrib1fvARB_remap_index 68
+#define VertexAttrib1sARB_remap_index 69
+#define VertexAttrib1svARB_remap_index 70
+#define VertexAttrib2dARB_remap_index 71
+#define VertexAttrib2dvARB_remap_index 72
+#define VertexAttrib2fARB_remap_index 73
+#define VertexAttrib2fvARB_remap_index 74
+#define VertexAttrib2sARB_remap_index 75
+#define VertexAttrib2svARB_remap_index 76
+#define VertexAttrib3dARB_remap_index 77
+#define VertexAttrib3dvARB_remap_index 78
+#define VertexAttrib3fARB_remap_index 79
+#define VertexAttrib3fvARB_remap_index 80
+#define VertexAttrib3sARB_remap_index 81
+#define VertexAttrib3svARB_remap_index 82
+#define VertexAttrib4NbvARB_remap_index 83
+#define VertexAttrib4NivARB_remap_index 84
+#define VertexAttrib4NsvARB_remap_index 85
+#define VertexAttrib4NubARB_remap_index 86
+#define VertexAttrib4NubvARB_remap_index 87
+#define VertexAttrib4NuivARB_remap_index 88
+#define VertexAttrib4NusvARB_remap_index 89
+#define VertexAttrib4bvARB_remap_index 90
+#define VertexAttrib4dARB_remap_index 91
+#define VertexAttrib4dvARB_remap_index 92
+#define VertexAttrib4fARB_remap_index 93
+#define VertexAttrib4fvARB_remap_index 94
+#define VertexAttrib4ivARB_remap_index 95
+#define VertexAttrib4sARB_remap_index 96
+#define VertexAttrib4svARB_remap_index 97
+#define VertexAttrib4ubvARB_remap_index 98
+#define VertexAttrib4uivARB_remap_index 99
+#define VertexAttrib4usvARB_remap_index 100
+#define VertexAttribPointerARB_remap_index 101
+#define BindBufferARB_remap_index 102
+#define BufferDataARB_remap_index 103
+#define BufferSubDataARB_remap_index 104
+#define DeleteBuffersARB_remap_index 105
+#define GenBuffersARB_remap_index 106
+#define GetBufferParameterivARB_remap_index 107
+#define GetBufferPointervARB_remap_index 108
+#define GetBufferSubDataARB_remap_index 109
+#define IsBufferARB_remap_index 110
+#define MapBufferARB_remap_index 111
+#define UnmapBufferARB_remap_index 112
+#define BeginQueryARB_remap_index 113
+#define DeleteQueriesARB_remap_index 114
+#define EndQueryARB_remap_index 115
+#define GenQueriesARB_remap_index 116
+#define GetQueryObjectivARB_remap_index 117
+#define GetQueryObjectuivARB_remap_index 118
+#define GetQueryivARB_remap_index 119
+#define IsQueryARB_remap_index 120
+#define AttachObjectARB_remap_index 121
+#define CompileShaderARB_remap_index 122
+#define CreateProgramObjectARB_remap_index 123
+#define CreateShaderObjectARB_remap_index 124
+#define DeleteObjectARB_remap_index 125
+#define DetachObjectARB_remap_index 126
+#define GetActiveUniformARB_remap_index 127
+#define GetAttachedObjectsARB_remap_index 128
+#define GetHandleARB_remap_index 129
+#define GetInfoLogARB_remap_index 130
+#define GetObjectParameterfvARB_remap_index 131
+#define GetObjectParameterivARB_remap_index 132
+#define GetShaderSourceARB_remap_index 133
+#define GetUniformLocationARB_remap_index 134
+#define GetUniformfvARB_remap_index 135
+#define GetUniformivARB_remap_index 136
+#define LinkProgramARB_remap_index 137
+#define ShaderSourceARB_remap_index 138
+#define Uniform1fARB_remap_index 139
+#define Uniform1fvARB_remap_index 140
+#define Uniform1iARB_remap_index 141
+#define Uniform1ivARB_remap_index 142
+#define Uniform2fARB_remap_index 143
+#define Uniform2fvARB_remap_index 144
+#define Uniform2iARB_remap_index 145
+#define Uniform2ivARB_remap_index 146
+#define Uniform3fARB_remap_index 147
+#define Uniform3fvARB_remap_index 148
+#define Uniform3iARB_remap_index 149
+#define Uniform3ivARB_remap_index 150
+#define Uniform4fARB_remap_index 151
+#define Uniform4fvARB_remap_index 152
+#define Uniform4iARB_remap_index 153
+#define Uniform4ivARB_remap_index 154
+#define UniformMatrix2fvARB_remap_index 155
+#define UniformMatrix3fvARB_remap_index 156
+#define UniformMatrix4fvARB_remap_index 157
+#define UseProgramObjectARB_remap_index 158
+#define ValidateProgramARB_remap_index 159
+#define BindAttribLocationARB_remap_index 160
+#define GetActiveAttribARB_remap_index 161
+#define GetAttribLocationARB_remap_index 162
+#define DrawBuffersARB_remap_index 163
+#define ClampColorARB_remap_index 164
+#define DrawArraysInstancedARB_remap_index 165
+#define DrawElementsInstancedARB_remap_index 166
+#define RenderbufferStorageMultisample_remap_index 167
+#define FramebufferTextureARB_remap_index 168
+#define FramebufferTextureFaceARB_remap_index 169
+#define ProgramParameteriARB_remap_index 170
+#define VertexAttribDivisorARB_remap_index 171
+#define FlushMappedBufferRange_remap_index 172
+#define MapBufferRange_remap_index 173
+#define TexBufferARB_remap_index 174
+#define BindVertexArray_remap_index 175
+#define GenVertexArrays_remap_index 176
+#define CopyBufferSubData_remap_index 177
+#define ClientWaitSync_remap_index 178
+#define DeleteSync_remap_index 179
+#define FenceSync_remap_index 180
+#define GetInteger64v_remap_index 181
+#define GetSynciv_remap_index 182
+#define IsSync_remap_index 183
+#define WaitSync_remap_index 184
+#define DrawElementsBaseVertex_remap_index 185
+#define DrawElementsInstancedBaseVertex_remap_index 186
+#define DrawRangeElementsBaseVertex_remap_index 187
+#define MultiDrawElementsBaseVertex_remap_index 188
+#define BlendEquationSeparateiARB_remap_index 189
+#define BlendEquationiARB_remap_index 190
+#define BlendFuncSeparateiARB_remap_index 191
+#define BlendFunciARB_remap_index 192
+#define BindSampler_remap_index 193
+#define DeleteSamplers_remap_index 194
+#define GenSamplers_remap_index 195
+#define GetSamplerParameterIiv_remap_index 196
+#define GetSamplerParameterIuiv_remap_index 197
+#define GetSamplerParameterfv_remap_index 198
+#define GetSamplerParameteriv_remap_index 199
+#define IsSampler_remap_index 200
+#define SamplerParameterIiv_remap_index 201
+#define SamplerParameterIuiv_remap_index 202
+#define SamplerParameterf_remap_index 203
+#define SamplerParameterfv_remap_index 204
+#define SamplerParameteri_remap_index 205
+#define SamplerParameteriv_remap_index 206
+#define ColorP3ui_remap_index 207
+#define ColorP3uiv_remap_index 208
+#define ColorP4ui_remap_index 209
+#define ColorP4uiv_remap_index 210
+#define MultiTexCoordP1ui_remap_index 211
+#define MultiTexCoordP1uiv_remap_index 212
+#define MultiTexCoordP2ui_remap_index 213
+#define MultiTexCoordP2uiv_remap_index 214
+#define MultiTexCoordP3ui_remap_index 215
+#define MultiTexCoordP3uiv_remap_index 216
+#define MultiTexCoordP4ui_remap_index 217
+#define MultiTexCoordP4uiv_remap_index 218
+#define NormalP3ui_remap_index 219
+#define NormalP3uiv_remap_index 220
+#define SecondaryColorP3ui_remap_index 221
+#define SecondaryColorP3uiv_remap_index 222
+#define TexCoordP1ui_remap_index 223
+#define TexCoordP1uiv_remap_index 224
+#define TexCoordP2ui_remap_index 225
+#define TexCoordP2uiv_remap_index 226
+#define TexCoordP3ui_remap_index 227
+#define TexCoordP3uiv_remap_index 228
+#define TexCoordP4ui_remap_index 229
+#define TexCoordP4uiv_remap_index 230
+#define VertexAttribP1ui_remap_index 231
+#define VertexAttribP1uiv_remap_index 232
+#define VertexAttribP2ui_remap_index 233
+#define VertexAttribP2uiv_remap_index 234
+#define VertexAttribP3ui_remap_index 235
+#define VertexAttribP3uiv_remap_index 236
+#define VertexAttribP4ui_remap_index 237
+#define VertexAttribP4uiv_remap_index 238
+#define VertexP2ui_remap_index 239
+#define VertexP2uiv_remap_index 240
+#define VertexP3ui_remap_index 241
+#define VertexP3uiv_remap_index 242
+#define VertexP4ui_remap_index 243
+#define VertexP4uiv_remap_index 244
+#define BindTransformFeedback_remap_index 245
+#define DeleteTransformFeedbacks_remap_index 246
+#define DrawTransformFeedback_remap_index 247
+#define GenTransformFeedbacks_remap_index 248
+#define IsTransformFeedback_remap_index 249
+#define PauseTransformFeedback_remap_index 250
+#define ResumeTransformFeedback_remap_index 251
+#define ClearDepthf_remap_index 252
+#define DepthRangef_remap_index 253
+#define GetShaderPrecisionFormat_remap_index 254
+#define ReleaseShaderCompiler_remap_index 255
+#define ShaderBinary_remap_index 256
+#define DebugMessageCallbackARB_remap_index 257
+#define DebugMessageControlARB_remap_index 258
+#define DebugMessageInsertARB_remap_index 259
+#define GetDebugMessageLogARB_remap_index 260
+#define GetGraphicsResetStatusARB_remap_index 261
+#define GetnColorTableARB_remap_index 262
+#define GetnCompressedTexImageARB_remap_index 263
+#define GetnConvolutionFilterARB_remap_index 264
+#define GetnHistogramARB_remap_index 265
+#define GetnMapdvARB_remap_index 266
+#define GetnMapfvARB_remap_index 267
+#define GetnMapivARB_remap_index 268
+#define GetnMinmaxARB_remap_index 269
+#define GetnPixelMapfvARB_remap_index 270
+#define GetnPixelMapuivARB_remap_index 271
+#define GetnPixelMapusvARB_remap_index 272
+#define GetnPolygonStippleARB_remap_index 273
+#define GetnSeparableFilterARB_remap_index 274
+#define GetnTexImageARB_remap_index 275
+#define GetnUniformdvARB_remap_index 276
+#define GetnUniformfvARB_remap_index 277
+#define GetnUniformivARB_remap_index 278
+#define GetnUniformuivARB_remap_index 279
+#define ReadnPixelsARB_remap_index 280
+#define TexStorage1D_remap_index 281
+#define TexStorage2D_remap_index 282
+#define TexStorage3D_remap_index 283
+#define TextureStorage1DEXT_remap_index 284
+#define TextureStorage2DEXT_remap_index 285
+#define TextureStorage3DEXT_remap_index 286
+#define PolygonOffsetEXT_remap_index 287
+#define GetPixelTexGenParameterfvSGIS_remap_index 288
+#define GetPixelTexGenParameterivSGIS_remap_index 289
+#define PixelTexGenParameterfSGIS_remap_index 290
+#define PixelTexGenParameterfvSGIS_remap_index 291
+#define PixelTexGenParameteriSGIS_remap_index 292
+#define PixelTexGenParameterivSGIS_remap_index 293
+#define SampleMaskSGIS_remap_index 294
+#define SamplePatternSGIS_remap_index 295
+#define ColorPointerEXT_remap_index 296
+#define EdgeFlagPointerEXT_remap_index 297
+#define IndexPointerEXT_remap_index 298
+#define NormalPointerEXT_remap_index 299
+#define TexCoordPointerEXT_remap_index 300
+#define VertexPointerEXT_remap_index 301
+#define PointParameterfEXT_remap_index 302
+#define PointParameterfvEXT_remap_index 303
+#define LockArraysEXT_remap_index 304
+#define UnlockArraysEXT_remap_index 305
+#define SecondaryColor3bEXT_remap_index 306
+#define SecondaryColor3bvEXT_remap_index 307
+#define SecondaryColor3dEXT_remap_index 308
+#define SecondaryColor3dvEXT_remap_index 309
+#define SecondaryColor3fEXT_remap_index 310
+#define SecondaryColor3fvEXT_remap_index 311
+#define SecondaryColor3iEXT_remap_index 312
+#define SecondaryColor3ivEXT_remap_index 313
+#define SecondaryColor3sEXT_remap_index 314
+#define SecondaryColor3svEXT_remap_index 315
+#define SecondaryColor3ubEXT_remap_index 316
+#define SecondaryColor3ubvEXT_remap_index 317
+#define SecondaryColor3uiEXT_remap_index 318
+#define SecondaryColor3uivEXT_remap_index 319
+#define SecondaryColor3usEXT_remap_index 320
+#define SecondaryColor3usvEXT_remap_index 321
+#define SecondaryColorPointerEXT_remap_index 322
+#define MultiDrawArraysEXT_remap_index 323
+#define MultiDrawElementsEXT_remap_index 324
+#define FogCoordPointerEXT_remap_index 325
+#define FogCoorddEXT_remap_index 326
+#define FogCoorddvEXT_remap_index 327
+#define FogCoordfEXT_remap_index 328
+#define FogCoordfvEXT_remap_index 329
+#define PixelTexGenSGIX_remap_index 330
+#define BlendFuncSeparateEXT_remap_index 331
+#define FlushVertexArrayRangeNV_remap_index 332
+#define VertexArrayRangeNV_remap_index 333
+#define CombinerInputNV_remap_index 334
+#define CombinerOutputNV_remap_index 335
+#define CombinerParameterfNV_remap_index 336
+#define CombinerParameterfvNV_remap_index 337
+#define CombinerParameteriNV_remap_index 338
+#define CombinerParameterivNV_remap_index 339
+#define FinalCombinerInputNV_remap_index 340
+#define GetCombinerInputParameterfvNV_remap_index 341
+#define GetCombinerInputParameterivNV_remap_index 342
+#define GetCombinerOutputParameterfvNV_remap_index 343
+#define GetCombinerOutputParameterivNV_remap_index 344
+#define GetFinalCombinerInputParameterfvNV_remap_index 345
+#define GetFinalCombinerInputParameterivNV_remap_index 346
+#define ResizeBuffersMESA_remap_index 347
+#define WindowPos2dMESA_remap_index 348
+#define WindowPos2dvMESA_remap_index 349
+#define WindowPos2fMESA_remap_index 350
+#define WindowPos2fvMESA_remap_index 351
+#define WindowPos2iMESA_remap_index 352
+#define WindowPos2ivMESA_remap_index 353
+#define WindowPos2sMESA_remap_index 354
+#define WindowPos2svMESA_remap_index 355
+#define WindowPos3dMESA_remap_index 356
+#define WindowPos3dvMESA_remap_index 357
+#define WindowPos3fMESA_remap_index 358
+#define WindowPos3fvMESA_remap_index 359
+#define WindowPos3iMESA_remap_index 360
+#define WindowPos3ivMESA_remap_index 361
+#define WindowPos3sMESA_remap_index 362
+#define WindowPos3svMESA_remap_index 363
+#define WindowPos4dMESA_remap_index 364
+#define WindowPos4dvMESA_remap_index 365
+#define WindowPos4fMESA_remap_index 366
+#define WindowPos4fvMESA_remap_index 367
+#define WindowPos4iMESA_remap_index 368
+#define WindowPos4ivMESA_remap_index 369
+#define WindowPos4sMESA_remap_index 370
+#define WindowPos4svMESA_remap_index 371
+#define MultiModeDrawArraysIBM_remap_index 372
+#define MultiModeDrawElementsIBM_remap_index 373
+#define DeleteFencesNV_remap_index 374
+#define FinishFenceNV_remap_index 375
+#define GenFencesNV_remap_index 376
+#define GetFenceivNV_remap_index 377
+#define IsFenceNV_remap_index 378
+#define SetFenceNV_remap_index 379
+#define TestFenceNV_remap_index 380
+#define AreProgramsResidentNV_remap_index 381
+#define BindProgramNV_remap_index 382
+#define DeleteProgramsNV_remap_index 383
+#define ExecuteProgramNV_remap_index 384
+#define GenProgramsNV_remap_index 385
+#define GetProgramParameterdvNV_remap_index 386
+#define GetProgramParameterfvNV_remap_index 387
+#define GetProgramStringNV_remap_index 388
+#define GetProgramivNV_remap_index 389
+#define GetTrackMatrixivNV_remap_index 390
+#define GetVertexAttribPointervNV_remap_index 391
+#define GetVertexAttribdvNV_remap_index 392
+#define GetVertexAttribfvNV_remap_index 393
+#define GetVertexAttribivNV_remap_index 394
+#define IsProgramNV_remap_index 395
+#define LoadProgramNV_remap_index 396
+#define ProgramParameters4dvNV_remap_index 397
+#define ProgramParameters4fvNV_remap_index 398
+#define RequestResidentProgramsNV_remap_index 399
+#define TrackMatrixNV_remap_index 400
+#define VertexAttrib1dNV_remap_index 401
+#define VertexAttrib1dvNV_remap_index 402
+#define VertexAttrib1fNV_remap_index 403
+#define VertexAttrib1fvNV_remap_index 404
+#define VertexAttrib1sNV_remap_index 405
+#define VertexAttrib1svNV_remap_index 406
+#define VertexAttrib2dNV_remap_index 407
+#define VertexAttrib2dvNV_remap_index 408
+#define VertexAttrib2fNV_remap_index 409
+#define VertexAttrib2fvNV_remap_index 410
+#define VertexAttrib2sNV_remap_index 411
+#define VertexAttrib2svNV_remap_index 412
+#define VertexAttrib3dNV_remap_index 413
+#define VertexAttrib3dvNV_remap_index 414
+#define VertexAttrib3fNV_remap_index 415
+#define VertexAttrib3fvNV_remap_index 416
+#define VertexAttrib3sNV_remap_index 417
+#define VertexAttrib3svNV_remap_index 418
+#define VertexAttrib4dNV_remap_index 419
+#define VertexAttrib4dvNV_remap_index 420
+#define VertexAttrib4fNV_remap_index 421
+#define VertexAttrib4fvNV_remap_index 422
+#define VertexAttrib4sNV_remap_index 423
+#define VertexAttrib4svNV_remap_index 424
+#define VertexAttrib4ubNV_remap_index 425
+#define VertexAttrib4ubvNV_remap_index 426
+#define VertexAttribPointerNV_remap_index 427
+#define VertexAttribs1dvNV_remap_index 428
+#define VertexAttribs1fvNV_remap_index 429
+#define VertexAttribs1svNV_remap_index 430
+#define VertexAttribs2dvNV_remap_index 431
+#define VertexAttribs2fvNV_remap_index 432
+#define VertexAttribs2svNV_remap_index 433
+#define VertexAttribs3dvNV_remap_index 434
+#define VertexAttribs3fvNV_remap_index 435
+#define VertexAttribs3svNV_remap_index 436
+#define VertexAttribs4dvNV_remap_index 437
+#define VertexAttribs4fvNV_remap_index 438
+#define VertexAttribs4svNV_remap_index 439
+#define VertexAttribs4ubvNV_remap_index 440
+#define GetTexBumpParameterfvATI_remap_index 441
+#define GetTexBumpParameterivATI_remap_index 442
+#define TexBumpParameterfvATI_remap_index 443
+#define TexBumpParameterivATI_remap_index 444
+#define AlphaFragmentOp1ATI_remap_index 445
+#define AlphaFragmentOp2ATI_remap_index 446
+#define AlphaFragmentOp3ATI_remap_index 447
+#define BeginFragmentShaderATI_remap_index 448
+#define BindFragmentShaderATI_remap_index 449
+#define ColorFragmentOp1ATI_remap_index 450
+#define ColorFragmentOp2ATI_remap_index 451
+#define ColorFragmentOp3ATI_remap_index 452
+#define DeleteFragmentShaderATI_remap_index 453
+#define EndFragmentShaderATI_remap_index 454
+#define GenFragmentShadersATI_remap_index 455
+#define PassTexCoordATI_remap_index 456
+#define SampleMapATI_remap_index 457
+#define SetFragmentShaderConstantATI_remap_index 458
+#define PointParameteriNV_remap_index 459
+#define PointParameterivNV_remap_index 460
+#define ActiveStencilFaceEXT_remap_index 461
+#define BindVertexArrayAPPLE_remap_index 462
+#define DeleteVertexArraysAPPLE_remap_index 463
+#define GenVertexArraysAPPLE_remap_index 464
+#define IsVertexArrayAPPLE_remap_index 465
+#define GetProgramNamedParameterdvNV_remap_index 466
+#define GetProgramNamedParameterfvNV_remap_index 467
+#define ProgramNamedParameter4dNV_remap_index 468
+#define ProgramNamedParameter4dvNV_remap_index 469
+#define ProgramNamedParameter4fNV_remap_index 470
+#define ProgramNamedParameter4fvNV_remap_index 471
+#define PrimitiveRestartIndexNV_remap_index 472
+#define PrimitiveRestartNV_remap_index 473
+#define DepthBoundsEXT_remap_index 474
+#define BlendEquationSeparateEXT_remap_index 475
+#define BindFramebufferEXT_remap_index 476
+#define BindRenderbufferEXT_remap_index 477
+#define CheckFramebufferStatusEXT_remap_index 478
+#define DeleteFramebuffersEXT_remap_index 479
+#define DeleteRenderbuffersEXT_remap_index 480
+#define FramebufferRenderbufferEXT_remap_index 481
+#define FramebufferTexture1DEXT_remap_index 482
+#define FramebufferTexture2DEXT_remap_index 483
+#define FramebufferTexture3DEXT_remap_index 484
+#define GenFramebuffersEXT_remap_index 485
+#define GenRenderbuffersEXT_remap_index 486
+#define GenerateMipmapEXT_remap_index 487
+#define GetFramebufferAttachmentParameterivEXT_remap_index 488
+#define GetRenderbufferParameterivEXT_remap_index 489
+#define IsFramebufferEXT_remap_index 490
+#define IsRenderbufferEXT_remap_index 491
+#define RenderbufferStorageEXT_remap_index 492
+#define BlitFramebufferEXT_remap_index 493
+#define BufferParameteriAPPLE_remap_index 494
+#define FlushMappedBufferRangeAPPLE_remap_index 495
+#define BindFragDataLocationEXT_remap_index 496
+#define GetFragDataLocationEXT_remap_index 497
+#define GetUniformuivEXT_remap_index 498
+#define GetVertexAttribIivEXT_remap_index 499
+#define GetVertexAttribIuivEXT_remap_index 500
+#define Uniform1uiEXT_remap_index 501
+#define Uniform1uivEXT_remap_index 502
+#define Uniform2uiEXT_remap_index 503
+#define Uniform2uivEXT_remap_index 504
+#define Uniform3uiEXT_remap_index 505
+#define Uniform3uivEXT_remap_index 506
+#define Uniform4uiEXT_remap_index 507
+#define Uniform4uivEXT_remap_index 508
+#define VertexAttribI1iEXT_remap_index 509
+#define VertexAttribI1ivEXT_remap_index 510
+#define VertexAttribI1uiEXT_remap_index 511
+#define VertexAttribI1uivEXT_remap_index 512
+#define VertexAttribI2iEXT_remap_index 513
+#define VertexAttribI2ivEXT_remap_index 514
+#define VertexAttribI2uiEXT_remap_index 515
+#define VertexAttribI2uivEXT_remap_index 516
+#define VertexAttribI3iEXT_remap_index 517
+#define VertexAttribI3ivEXT_remap_index 518
+#define VertexAttribI3uiEXT_remap_index 519
+#define VertexAttribI3uivEXT_remap_index 520
+#define VertexAttribI4bvEXT_remap_index 521
+#define VertexAttribI4iEXT_remap_index 522
+#define VertexAttribI4ivEXT_remap_index 523
+#define VertexAttribI4svEXT_remap_index 524
+#define VertexAttribI4ubvEXT_remap_index 525
+#define VertexAttribI4uiEXT_remap_index 526
+#define VertexAttribI4uivEXT_remap_index 527
+#define VertexAttribI4usvEXT_remap_index 528
+#define VertexAttribIPointerEXT_remap_index 529
+#define FramebufferTextureLayerEXT_remap_index 530
+#define ColorMaskIndexedEXT_remap_index 531
+#define DisableIndexedEXT_remap_index 532
+#define EnableIndexedEXT_remap_index 533
+#define GetBooleanIndexedvEXT_remap_index 534
+#define GetIntegerIndexedvEXT_remap_index 535
+#define IsEnabledIndexedEXT_remap_index 536
+#define ClearColorIiEXT_remap_index 537
+#define ClearColorIuiEXT_remap_index 538
+#define GetTexParameterIivEXT_remap_index 539
+#define GetTexParameterIuivEXT_remap_index 540
+#define TexParameterIivEXT_remap_index 541
+#define TexParameterIuivEXT_remap_index 542
+#define BeginConditionalRenderNV_remap_index 543
+#define EndConditionalRenderNV_remap_index 544
+#define BeginTransformFeedbackEXT_remap_index 545
+#define BindBufferBaseEXT_remap_index 546
+#define BindBufferOffsetEXT_remap_index 547
+#define BindBufferRangeEXT_remap_index 548
+#define EndTransformFeedbackEXT_remap_index 549
+#define GetTransformFeedbackVaryingEXT_remap_index 550
+#define TransformFeedbackVaryingsEXT_remap_index 551
+#define ProvokingVertexEXT_remap_index 552
+#define GetTexParameterPointervAPPLE_remap_index 553
+#define TextureRangeAPPLE_remap_index 554
+#define GetObjectParameterivAPPLE_remap_index 555
+#define ObjectPurgeableAPPLE_remap_index 556
+#define ObjectUnpurgeableAPPLE_remap_index 557
+#define ActiveProgramEXT_remap_index 558
+#define CreateShaderProgramEXT_remap_index 559
+#define UseShaderProgramEXT_remap_index 560
+#define TextureBarrierNV_remap_index 561
+#define StencilFuncSeparateATI_remap_index 562
+#define ProgramEnvParameters4fvEXT_remap_index 563
+#define ProgramLocalParameters4fvEXT_remap_index 564
+#define GetQueryObjecti64vEXT_remap_index 565
+#define GetQueryObjectui64vEXT_remap_index 566
+#define EGLImageTargetRenderbufferStorageOES_remap_index 567
+#define EGLImageTargetTexture2DOES_remap_index 568
+
+#define _gloffset_AttachShader driDispatchRemapTable[AttachShader_remap_index]
+#define _gloffset_CreateProgram driDispatchRemapTable[CreateProgram_remap_index]
+#define _gloffset_CreateShader driDispatchRemapTable[CreateShader_remap_index]
+#define _gloffset_DeleteProgram driDispatchRemapTable[DeleteProgram_remap_index]
+#define _gloffset_DeleteShader driDispatchRemapTable[DeleteShader_remap_index]
+#define _gloffset_DetachShader driDispatchRemapTable[DetachShader_remap_index]
+#define _gloffset_GetAttachedShaders driDispatchRemapTable[GetAttachedShaders_remap_index]
+#define _gloffset_GetProgramInfoLog driDispatchRemapTable[GetProgramInfoLog_remap_index]
+#define _gloffset_GetProgramiv driDispatchRemapTable[GetProgramiv_remap_index]
+#define _gloffset_GetShaderInfoLog driDispatchRemapTable[GetShaderInfoLog_remap_index]
+#define _gloffset_GetShaderiv driDispatchRemapTable[GetShaderiv_remap_index]
+#define _gloffset_IsProgram driDispatchRemapTable[IsProgram_remap_index]
+#define _gloffset_IsShader driDispatchRemapTable[IsShader_remap_index]
+#define _gloffset_StencilFuncSeparate driDispatchRemapTable[StencilFuncSeparate_remap_index]
+#define _gloffset_StencilMaskSeparate driDispatchRemapTable[StencilMaskSeparate_remap_index]
+#define _gloffset_StencilOpSeparate driDispatchRemapTable[StencilOpSeparate_remap_index]
+#define _gloffset_UniformMatrix2x3fv driDispatchRemapTable[UniformMatrix2x3fv_remap_index]
+#define _gloffset_UniformMatrix2x4fv driDispatchRemapTable[UniformMatrix2x4fv_remap_index]
+#define _gloffset_UniformMatrix3x2fv driDispatchRemapTable[UniformMatrix3x2fv_remap_index]
+#define _gloffset_UniformMatrix3x4fv driDispatchRemapTable[UniformMatrix3x4fv_remap_index]
+#define _gloffset_UniformMatrix4x2fv driDispatchRemapTable[UniformMatrix4x2fv_remap_index]
+#define _gloffset_UniformMatrix4x3fv driDispatchRemapTable[UniformMatrix4x3fv_remap_index]
+#define _gloffset_ClampColor driDispatchRemapTable[ClampColor_remap_index]
+#define _gloffset_ClearBufferfi driDispatchRemapTable[ClearBufferfi_remap_index]
+#define _gloffset_ClearBufferfv driDispatchRemapTable[ClearBufferfv_remap_index]
+#define _gloffset_ClearBufferiv driDispatchRemapTable[ClearBufferiv_remap_index]
+#define _gloffset_ClearBufferuiv driDispatchRemapTable[ClearBufferuiv_remap_index]
+#define _gloffset_GetStringi driDispatchRemapTable[GetStringi_remap_index]
+#define _gloffset_TexBuffer driDispatchRemapTable[TexBuffer_remap_index]
+#define _gloffset_FramebufferTexture driDispatchRemapTable[FramebufferTexture_remap_index]
+#define _gloffset_GetBufferParameteri64v driDispatchRemapTable[GetBufferParameteri64v_remap_index]
+#define _gloffset_GetInteger64i_v driDispatchRemapTable[GetInteger64i_v_remap_index]
+#define _gloffset_VertexAttribDivisor driDispatchRemapTable[VertexAttribDivisor_remap_index]
+#define _gloffset_LoadTransposeMatrixdARB driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index]
+#define _gloffset_LoadTransposeMatrixfARB driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index]
+#define _gloffset_MultTransposeMatrixdARB driDispatchRemapTable[MultTransposeMatrixdARB_remap_index]
+#define _gloffset_MultTransposeMatrixfARB driDispatchRemapTable[MultTransposeMatrixfARB_remap_index]
+#define _gloffset_SampleCoverageARB driDispatchRemapTable[SampleCoverageARB_remap_index]
+#define _gloffset_CompressedTexImage1DARB driDispatchRemapTable[CompressedTexImage1DARB_remap_index]
+#define _gloffset_CompressedTexImage2DARB driDispatchRemapTable[CompressedTexImage2DARB_remap_index]
+#define _gloffset_CompressedTexImage3DARB driDispatchRemapTable[CompressedTexImage3DARB_remap_index]
+#define _gloffset_CompressedTexSubImage1DARB driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index]
+#define _gloffset_CompressedTexSubImage2DARB driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index]
+#define _gloffset_CompressedTexSubImage3DARB driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index]
+#define _gloffset_GetCompressedTexImageARB driDispatchRemapTable[GetCompressedTexImageARB_remap_index]
+#define _gloffset_DisableVertexAttribArrayARB driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index]
+#define _gloffset_EnableVertexAttribArrayARB driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index]
+#define _gloffset_GetProgramEnvParameterdvARB driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index]
+#define _gloffset_GetProgramEnvParameterfvARB driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index]
+#define _gloffset_GetProgramLocalParameterdvARB driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index]
+#define _gloffset_GetProgramLocalParameterfvARB driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index]
+#define _gloffset_GetProgramStringARB driDispatchRemapTable[GetProgramStringARB_remap_index]
+#define _gloffset_GetProgramivARB driDispatchRemapTable[GetProgramivARB_remap_index]
+#define _gloffset_GetVertexAttribdvARB driDispatchRemapTable[GetVertexAttribdvARB_remap_index]
+#define _gloffset_GetVertexAttribfvARB driDispatchRemapTable[GetVertexAttribfvARB_remap_index]
+#define _gloffset_GetVertexAttribivARB driDispatchRemapTable[GetVertexAttribivARB_remap_index]
+#define _gloffset_ProgramEnvParameter4dARB driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index]
+#define _gloffset_ProgramEnvParameter4dvARB driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index]
+#define _gloffset_ProgramEnvParameter4fARB driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index]
+#define _gloffset_ProgramEnvParameter4fvARB driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index]
+#define _gloffset_ProgramLocalParameter4dARB driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index]
+#define _gloffset_ProgramLocalParameter4dvARB driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index]
+#define _gloffset_ProgramLocalParameter4fARB driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index]
+#define _gloffset_ProgramLocalParameter4fvARB driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index]
+#define _gloffset_ProgramStringARB driDispatchRemapTable[ProgramStringARB_remap_index]
+#define _gloffset_VertexAttrib1dARB driDispatchRemapTable[VertexAttrib1dARB_remap_index]
+#define _gloffset_VertexAttrib1dvARB driDispatchRemapTable[VertexAttrib1dvARB_remap_index]
+#define _gloffset_VertexAttrib1fARB driDispatchRemapTable[VertexAttrib1fARB_remap_index]
+#define _gloffset_VertexAttrib1fvARB driDispatchRemapTable[VertexAttrib1fvARB_remap_index]
+#define _gloffset_VertexAttrib1sARB driDispatchRemapTable[VertexAttrib1sARB_remap_index]
+#define _gloffset_VertexAttrib1svARB driDispatchRemapTable[VertexAttrib1svARB_remap_index]
+#define _gloffset_VertexAttrib2dARB driDispatchRemapTable[VertexAttrib2dARB_remap_index]
+#define _gloffset_VertexAttrib2dvARB driDispatchRemapTable[VertexAttrib2dvARB_remap_index]
+#define _gloffset_VertexAttrib2fARB driDispatchRemapTable[VertexAttrib2fARB_remap_index]
+#define _gloffset_VertexAttrib2fvARB driDispatchRemapTable[VertexAttrib2fvARB_remap_index]
+#define _gloffset_VertexAttrib2sARB driDispatchRemapTable[VertexAttrib2sARB_remap_index]
+#define _gloffset_VertexAttrib2svARB driDispatchRemapTable[VertexAttrib2svARB_remap_index]
+#define _gloffset_VertexAttrib3dARB driDispatchRemapTable[VertexAttrib3dARB_remap_index]
+#define _gloffset_VertexAttrib3dvARB driDispatchRemapTable[VertexAttrib3dvARB_remap_index]
+#define _gloffset_VertexAttrib3fARB driDispatchRemapTable[VertexAttrib3fARB_remap_index]
+#define _gloffset_VertexAttrib3fvARB driDispatchRemapTable[VertexAttrib3fvARB_remap_index]
+#define _gloffset_VertexAttrib3sARB driDispatchRemapTable[VertexAttrib3sARB_remap_index]
+#define _gloffset_VertexAttrib3svARB driDispatchRemapTable[VertexAttrib3svARB_remap_index]
+#define _gloffset_VertexAttrib4NbvARB driDispatchRemapTable[VertexAttrib4NbvARB_remap_index]
+#define _gloffset_VertexAttrib4NivARB driDispatchRemapTable[VertexAttrib4NivARB_remap_index]
+#define _gloffset_VertexAttrib4NsvARB driDispatchRemapTable[VertexAttrib4NsvARB_remap_index]
+#define _gloffset_VertexAttrib4NubARB driDispatchRemapTable[VertexAttrib4NubARB_remap_index]
+#define _gloffset_VertexAttrib4NubvARB driDispatchRemapTable[VertexAttrib4NubvARB_remap_index]
+#define _gloffset_VertexAttrib4NuivARB driDispatchRemapTable[VertexAttrib4NuivARB_remap_index]
+#define _gloffset_VertexAttrib4NusvARB driDispatchRemapTable[VertexAttrib4NusvARB_remap_index]
+#define _gloffset_VertexAttrib4bvARB driDispatchRemapTable[VertexAttrib4bvARB_remap_index]
+#define _gloffset_VertexAttrib4dARB driDispatchRemapTable[VertexAttrib4dARB_remap_index]
+#define _gloffset_VertexAttrib4dvARB driDispatchRemapTable[VertexAttrib4dvARB_remap_index]
+#define _gloffset_VertexAttrib4fARB driDispatchRemapTable[VertexAttrib4fARB_remap_index]
+#define _gloffset_VertexAttrib4fvARB driDispatchRemapTable[VertexAttrib4fvARB_remap_index]
+#define _gloffset_VertexAttrib4ivARB driDispatchRemapTable[VertexAttrib4ivARB_remap_index]
+#define _gloffset_VertexAttrib4sARB driDispatchRemapTable[VertexAttrib4sARB_remap_index]
+#define _gloffset_VertexAttrib4svARB driDispatchRemapTable[VertexAttrib4svARB_remap_index]
+#define _gloffset_VertexAttrib4ubvARB driDispatchRemapTable[VertexAttrib4ubvARB_remap_index]
+#define _gloffset_VertexAttrib4uivARB driDispatchRemapTable[VertexAttrib4uivARB_remap_index]
+#define _gloffset_VertexAttrib4usvARB driDispatchRemapTable[VertexAttrib4usvARB_remap_index]
+#define _gloffset_VertexAttribPointerARB driDispatchRemapTable[VertexAttribPointerARB_remap_index]
+#define _gloffset_BindBufferARB driDispatchRemapTable[BindBufferARB_remap_index]
+#define _gloffset_BufferDataARB driDispatchRemapTable[BufferDataARB_remap_index]
+#define _gloffset_BufferSubDataARB driDispatchRemapTable[BufferSubDataARB_remap_index]
+#define _gloffset_DeleteBuffersARB driDispatchRemapTable[DeleteBuffersARB_remap_index]
+#define _gloffset_GenBuffersARB driDispatchRemapTable[GenBuffersARB_remap_index]
+#define _gloffset_GetBufferParameterivARB driDispatchRemapTable[GetBufferParameterivARB_remap_index]
+#define _gloffset_GetBufferPointervARB driDispatchRemapTable[GetBufferPointervARB_remap_index]
+#define _gloffset_GetBufferSubDataARB driDispatchRemapTable[GetBufferSubDataARB_remap_index]
+#define _gloffset_IsBufferARB driDispatchRemapTable[IsBufferARB_remap_index]
+#define _gloffset_MapBufferARB driDispatchRemapTable[MapBufferARB_remap_index]
+#define _gloffset_UnmapBufferARB driDispatchRemapTable[UnmapBufferARB_remap_index]
+#define _gloffset_BeginQueryARB driDispatchRemapTable[BeginQueryARB_remap_index]
+#define _gloffset_DeleteQueriesARB driDispatchRemapTable[DeleteQueriesARB_remap_index]
+#define _gloffset_EndQueryARB driDispatchRemapTable[EndQueryARB_remap_index]
+#define _gloffset_GenQueriesARB driDispatchRemapTable[GenQueriesARB_remap_index]
+#define _gloffset_GetQueryObjectivARB driDispatchRemapTable[GetQueryObjectivARB_remap_index]
+#define _gloffset_GetQueryObjectuivARB driDispatchRemapTable[GetQueryObjectuivARB_remap_index]
+#define _gloffset_GetQueryivARB driDispatchRemapTable[GetQueryivARB_remap_index]
+#define _gloffset_IsQueryARB driDispatchRemapTable[IsQueryARB_remap_index]
+#define _gloffset_AttachObjectARB driDispatchRemapTable[AttachObjectARB_remap_index]
+#define _gloffset_CompileShaderARB driDispatchRemapTable[CompileShaderARB_remap_index]
+#define _gloffset_CreateProgramObjectARB driDispatchRemapTable[CreateProgramObjectARB_remap_index]
+#define _gloffset_CreateShaderObjectARB driDispatchRemapTable[CreateShaderObjectARB_remap_index]
+#define _gloffset_DeleteObjectARB driDispatchRemapTable[DeleteObjectARB_remap_index]
+#define _gloffset_DetachObjectARB driDispatchRemapTable[DetachObjectARB_remap_index]
+#define _gloffset_GetActiveUniformARB driDispatchRemapTable[GetActiveUniformARB_remap_index]
+#define _gloffset_GetAttachedObjectsARB driDispatchRemapTable[GetAttachedObjectsARB_remap_index]
+#define _gloffset_GetHandleARB driDispatchRemapTable[GetHandleARB_remap_index]
+#define _gloffset_GetInfoLogARB driDispatchRemapTable[GetInfoLogARB_remap_index]
+#define _gloffset_GetObjectParameterfvARB driDispatchRemapTable[GetObjectParameterfvARB_remap_index]
+#define _gloffset_GetObjectParameterivARB driDispatchRemapTable[GetObjectParameterivARB_remap_index]
+#define _gloffset_GetShaderSourceARB driDispatchRemapTable[GetShaderSourceARB_remap_index]
+#define _gloffset_GetUniformLocationARB driDispatchRemapTable[GetUniformLocationARB_remap_index]
+#define _gloffset_GetUniformfvARB driDispatchRemapTable[GetUniformfvARB_remap_index]
+#define _gloffset_GetUniformivARB driDispatchRemapTable[GetUniformivARB_remap_index]
+#define _gloffset_LinkProgramARB driDispatchRemapTable[LinkProgramARB_remap_index]
+#define _gloffset_ShaderSourceARB driDispatchRemapTable[ShaderSourceARB_remap_index]
+#define _gloffset_Uniform1fARB driDispatchRemapTable[Uniform1fARB_remap_index]
+#define _gloffset_Uniform1fvARB driDispatchRemapTable[Uniform1fvARB_remap_index]
+#define _gloffset_Uniform1iARB driDispatchRemapTable[Uniform1iARB_remap_index]
+#define _gloffset_Uniform1ivARB driDispatchRemapTable[Uniform1ivARB_remap_index]
+#define _gloffset_Uniform2fARB driDispatchRemapTable[Uniform2fARB_remap_index]
+#define _gloffset_Uniform2fvARB driDispatchRemapTable[Uniform2fvARB_remap_index]
+#define _gloffset_Uniform2iARB driDispatchRemapTable[Uniform2iARB_remap_index]
+#define _gloffset_Uniform2ivARB driDispatchRemapTable[Uniform2ivARB_remap_index]
+#define _gloffset_Uniform3fARB driDispatchRemapTable[Uniform3fARB_remap_index]
+#define _gloffset_Uniform3fvARB driDispatchRemapTable[Uniform3fvARB_remap_index]
+#define _gloffset_Uniform3iARB driDispatchRemapTable[Uniform3iARB_remap_index]
+#define _gloffset_Uniform3ivARB driDispatchRemapTable[Uniform3ivARB_remap_index]
+#define _gloffset_Uniform4fARB driDispatchRemapTable[Uniform4fARB_remap_index]
+#define _gloffset_Uniform4fvARB driDispatchRemapTable[Uniform4fvARB_remap_index]
+#define _gloffset_Uniform4iARB driDispatchRemapTable[Uniform4iARB_remap_index]
+#define _gloffset_Uniform4ivARB driDispatchRemapTable[Uniform4ivARB_remap_index]
+#define _gloffset_UniformMatrix2fvARB driDispatchRemapTable[UniformMatrix2fvARB_remap_index]
+#define _gloffset_UniformMatrix3fvARB driDispatchRemapTable[UniformMatrix3fvARB_remap_index]
+#define _gloffset_UniformMatrix4fvARB driDispatchRemapTable[UniformMatrix4fvARB_remap_index]
+#define _gloffset_UseProgramObjectARB driDispatchRemapTable[UseProgramObjectARB_remap_index]
+#define _gloffset_ValidateProgramARB driDispatchRemapTable[ValidateProgramARB_remap_index]
+#define _gloffset_BindAttribLocationARB driDispatchRemapTable[BindAttribLocationARB_remap_index]
+#define _gloffset_GetActiveAttribARB driDispatchRemapTable[GetActiveAttribARB_remap_index]
+#define _gloffset_GetAttribLocationARB driDispatchRemapTable[GetAttribLocationARB_remap_index]
+#define _gloffset_DrawBuffersARB driDispatchRemapTable[DrawBuffersARB_remap_index]
+#define _gloffset_ClampColorARB driDispatchRemapTable[ClampColorARB_remap_index]
+#define _gloffset_DrawArraysInstancedARB driDispatchRemapTable[DrawArraysInstancedARB_remap_index]
+#define _gloffset_DrawElementsInstancedARB driDispatchRemapTable[DrawElementsInstancedARB_remap_index]
+#define _gloffset_RenderbufferStorageMultisample driDispatchRemapTable[RenderbufferStorageMultisample_remap_index]
+#define _gloffset_FramebufferTextureARB driDispatchRemapTable[FramebufferTextureARB_remap_index]
+#define _gloffset_FramebufferTextureFaceARB driDispatchRemapTable[FramebufferTextureFaceARB_remap_index]
+#define _gloffset_ProgramParameteriARB driDispatchRemapTable[ProgramParameteriARB_remap_index]
+#define _gloffset_VertexAttribDivisorARB driDispatchRemapTable[VertexAttribDivisorARB_remap_index]
+#define _gloffset_FlushMappedBufferRange driDispatchRemapTable[FlushMappedBufferRange_remap_index]
+#define _gloffset_MapBufferRange driDispatchRemapTable[MapBufferRange_remap_index]
+#define _gloffset_TexBufferARB driDispatchRemapTable[TexBufferARB_remap_index]
+#define _gloffset_BindVertexArray driDispatchRemapTable[BindVertexArray_remap_index]
+#define _gloffset_GenVertexArrays driDispatchRemapTable[GenVertexArrays_remap_index]
+#define _gloffset_CopyBufferSubData driDispatchRemapTable[CopyBufferSubData_remap_index]
+#define _gloffset_ClientWaitSync driDispatchRemapTable[ClientWaitSync_remap_index]
+#define _gloffset_DeleteSync driDispatchRemapTable[DeleteSync_remap_index]
+#define _gloffset_FenceSync driDispatchRemapTable[FenceSync_remap_index]
+#define _gloffset_GetInteger64v driDispatchRemapTable[GetInteger64v_remap_index]
+#define _gloffset_GetSynciv driDispatchRemapTable[GetSynciv_remap_index]
+#define _gloffset_IsSync driDispatchRemapTable[IsSync_remap_index]
+#define _gloffset_WaitSync driDispatchRemapTable[WaitSync_remap_index]
+#define _gloffset_DrawElementsBaseVertex driDispatchRemapTable[DrawElementsBaseVertex_remap_index]
+#define _gloffset_DrawElementsInstancedBaseVertex driDispatchRemapTable[DrawElementsInstancedBaseVertex_remap_index]
+#define _gloffset_DrawRangeElementsBaseVertex driDispatchRemapTable[DrawRangeElementsBaseVertex_remap_index]
+#define _gloffset_MultiDrawElementsBaseVertex driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index]
+#define _gloffset_BlendEquationSeparateiARB driDispatchRemapTable[BlendEquationSeparateiARB_remap_index]
+#define _gloffset_BlendEquationiARB driDispatchRemapTable[BlendEquationiARB_remap_index]
+#define _gloffset_BlendFuncSeparateiARB driDispatchRemapTable[BlendFuncSeparateiARB_remap_index]
+#define _gloffset_BlendFunciARB driDispatchRemapTable[BlendFunciARB_remap_index]
+#define _gloffset_BindSampler driDispatchRemapTable[BindSampler_remap_index]
+#define _gloffset_DeleteSamplers driDispatchRemapTable[DeleteSamplers_remap_index]
+#define _gloffset_GenSamplers driDispatchRemapTable[GenSamplers_remap_index]
+#define _gloffset_GetSamplerParameterIiv driDispatchRemapTable[GetSamplerParameterIiv_remap_index]
+#define _gloffset_GetSamplerParameterIuiv driDispatchRemapTable[GetSamplerParameterIuiv_remap_index]
+#define _gloffset_GetSamplerParameterfv driDispatchRemapTable[GetSamplerParameterfv_remap_index]
+#define _gloffset_GetSamplerParameteriv driDispatchRemapTable[GetSamplerParameteriv_remap_index]
+#define _gloffset_IsSampler driDispatchRemapTable[IsSampler_remap_index]
+#define _gloffset_SamplerParameterIiv driDispatchRemapTable[SamplerParameterIiv_remap_index]
+#define _gloffset_SamplerParameterIuiv driDispatchRemapTable[SamplerParameterIuiv_remap_index]
+#define _gloffset_SamplerParameterf driDispatchRemapTable[SamplerParameterf_remap_index]
+#define _gloffset_SamplerParameterfv driDispatchRemapTable[SamplerParameterfv_remap_index]
+#define _gloffset_SamplerParameteri driDispatchRemapTable[SamplerParameteri_remap_index]
+#define _gloffset_SamplerParameteriv driDispatchRemapTable[SamplerParameteriv_remap_index]
+#define _gloffset_ColorP3ui driDispatchRemapTable[ColorP3ui_remap_index]
+#define _gloffset_ColorP3uiv driDispatchRemapTable[ColorP3uiv_remap_index]
+#define _gloffset_ColorP4ui driDispatchRemapTable[ColorP4ui_remap_index]
+#define _gloffset_ColorP4uiv driDispatchRemapTable[ColorP4uiv_remap_index]
+#define _gloffset_MultiTexCoordP1ui driDispatchRemapTable[MultiTexCoordP1ui_remap_index]
+#define _gloffset_MultiTexCoordP1uiv driDispatchRemapTable[MultiTexCoordP1uiv_remap_index]
+#define _gloffset_MultiTexCoordP2ui driDispatchRemapTable[MultiTexCoordP2ui_remap_index]
+#define _gloffset_MultiTexCoordP2uiv driDispatchRemapTable[MultiTexCoordP2uiv_remap_index]
+#define _gloffset_MultiTexCoordP3ui driDispatchRemapTable[MultiTexCoordP3ui_remap_index]
+#define _gloffset_MultiTexCoordP3uiv driDispatchRemapTable[MultiTexCoordP3uiv_remap_index]
+#define _gloffset_MultiTexCoordP4ui driDispatchRemapTable[MultiTexCoordP4ui_remap_index]
+#define _gloffset_MultiTexCoordP4uiv driDispatchRemapTable[MultiTexCoordP4uiv_remap_index]
+#define _gloffset_NormalP3ui driDispatchRemapTable[NormalP3ui_remap_index]
+#define _gloffset_NormalP3uiv driDispatchRemapTable[NormalP3uiv_remap_index]
+#define _gloffset_SecondaryColorP3ui driDispatchRemapTable[SecondaryColorP3ui_remap_index]
+#define _gloffset_SecondaryColorP3uiv driDispatchRemapTable[SecondaryColorP3uiv_remap_index]
+#define _gloffset_TexCoordP1ui driDispatchRemapTable[TexCoordP1ui_remap_index]
+#define _gloffset_TexCoordP1uiv driDispatchRemapTable[TexCoordP1uiv_remap_index]
+#define _gloffset_TexCoordP2ui driDispatchRemapTable[TexCoordP2ui_remap_index]
+#define _gloffset_TexCoordP2uiv driDispatchRemapTable[TexCoordP2uiv_remap_index]
+#define _gloffset_TexCoordP3ui driDispatchRemapTable[TexCoordP3ui_remap_index]
+#define _gloffset_TexCoordP3uiv driDispatchRemapTable[TexCoordP3uiv_remap_index]
+#define _gloffset_TexCoordP4ui driDispatchRemapTable[TexCoordP4ui_remap_index]
+#define _gloffset_TexCoordP4uiv driDispatchRemapTable[TexCoordP4uiv_remap_index]
+#define _gloffset_VertexAttribP1ui driDispatchRemapTable[VertexAttribP1ui_remap_index]
+#define _gloffset_VertexAttribP1uiv driDispatchRemapTable[VertexAttribP1uiv_remap_index]
+#define _gloffset_VertexAttribP2ui driDispatchRemapTable[VertexAttribP2ui_remap_index]
+#define _gloffset_VertexAttribP2uiv driDispatchRemapTable[VertexAttribP2uiv_remap_index]
+#define _gloffset_VertexAttribP3ui driDispatchRemapTable[VertexAttribP3ui_remap_index]
+#define _gloffset_VertexAttribP3uiv driDispatchRemapTable[VertexAttribP3uiv_remap_index]
+#define _gloffset_VertexAttribP4ui driDispatchRemapTable[VertexAttribP4ui_remap_index]
+#define _gloffset_VertexAttribP4uiv driDispatchRemapTable[VertexAttribP4uiv_remap_index]
+#define _gloffset_VertexP2ui driDispatchRemapTable[VertexP2ui_remap_index]
+#define _gloffset_VertexP2uiv driDispatchRemapTable[VertexP2uiv_remap_index]
+#define _gloffset_VertexP3ui driDispatchRemapTable[VertexP3ui_remap_index]
+#define _gloffset_VertexP3uiv driDispatchRemapTable[VertexP3uiv_remap_index]
+#define _gloffset_VertexP4ui driDispatchRemapTable[VertexP4ui_remap_index]
+#define _gloffset_VertexP4uiv driDispatchRemapTable[VertexP4uiv_remap_index]
+#define _gloffset_BindTransformFeedback driDispatchRemapTable[BindTransformFeedback_remap_index]
+#define _gloffset_DeleteTransformFeedbacks driDispatchRemapTable[DeleteTransformFeedbacks_remap_index]
+#define _gloffset_DrawTransformFeedback driDispatchRemapTable[DrawTransformFeedback_remap_index]
+#define _gloffset_GenTransformFeedbacks driDispatchRemapTable[GenTransformFeedbacks_remap_index]
+#define _gloffset_IsTransformFeedback driDispatchRemapTable[IsTransformFeedback_remap_index]
+#define _gloffset_PauseTransformFeedback driDispatchRemapTable[PauseTransformFeedback_remap_index]
+#define _gloffset_ResumeTransformFeedback driDispatchRemapTable[ResumeTransformFeedback_remap_index]
+#define _gloffset_ClearDepthf driDispatchRemapTable[ClearDepthf_remap_index]
+#define _gloffset_DepthRangef driDispatchRemapTable[DepthRangef_remap_index]
+#define _gloffset_GetShaderPrecisionFormat driDispatchRemapTable[GetShaderPrecisionFormat_remap_index]
+#define _gloffset_ReleaseShaderCompiler driDispatchRemapTable[ReleaseShaderCompiler_remap_index]
+#define _gloffset_ShaderBinary driDispatchRemapTable[ShaderBinary_remap_index]
+#define _gloffset_DebugMessageCallbackARB driDispatchRemapTable[DebugMessageCallbackARB_remap_index]
+#define _gloffset_DebugMessageControlARB driDispatchRemapTable[DebugMessageControlARB_remap_index]
+#define _gloffset_DebugMessageInsertARB driDispatchRemapTable[DebugMessageInsertARB_remap_index]
+#define _gloffset_GetDebugMessageLogARB driDispatchRemapTable[GetDebugMessageLogARB_remap_index]
+#define _gloffset_GetGraphicsResetStatusARB driDispatchRemapTable[GetGraphicsResetStatusARB_remap_index]
+#define _gloffset_GetnColorTableARB driDispatchRemapTable[GetnColorTableARB_remap_index]
+#define _gloffset_GetnCompressedTexImageARB driDispatchRemapTable[GetnCompressedTexImageARB_remap_index]
+#define _gloffset_GetnConvolutionFilterARB driDispatchRemapTable[GetnConvolutionFilterARB_remap_index]
+#define _gloffset_GetnHistogramARB driDispatchRemapTable[GetnHistogramARB_remap_index]
+#define _gloffset_GetnMapdvARB driDispatchRemapTable[GetnMapdvARB_remap_index]
+#define _gloffset_GetnMapfvARB driDispatchRemapTable[GetnMapfvARB_remap_index]
+#define _gloffset_GetnMapivARB driDispatchRemapTable[GetnMapivARB_remap_index]
+#define _gloffset_GetnMinmaxARB driDispatchRemapTable[GetnMinmaxARB_remap_index]
+#define _gloffset_GetnPixelMapfvARB driDispatchRemapTable[GetnPixelMapfvARB_remap_index]
+#define _gloffset_GetnPixelMapuivARB driDispatchRemapTable[GetnPixelMapuivARB_remap_index]
+#define _gloffset_GetnPixelMapusvARB driDispatchRemapTable[GetnPixelMapusvARB_remap_index]
+#define _gloffset_GetnPolygonStippleARB driDispatchRemapTable[GetnPolygonStippleARB_remap_index]
+#define _gloffset_GetnSeparableFilterARB driDispatchRemapTable[GetnSeparableFilterARB_remap_index]
+#define _gloffset_GetnTexImageARB driDispatchRemapTable[GetnTexImageARB_remap_index]
+#define _gloffset_GetnUniformdvARB driDispatchRemapTable[GetnUniformdvARB_remap_index]
+#define _gloffset_GetnUniformfvARB driDispatchRemapTable[GetnUniformfvARB_remap_index]
+#define _gloffset_GetnUniformivARB driDispatchRemapTable[GetnUniformivARB_remap_index]
+#define _gloffset_GetnUniformuivARB driDispatchRemapTable[GetnUniformuivARB_remap_index]
+#define _gloffset_ReadnPixelsARB driDispatchRemapTable[ReadnPixelsARB_remap_index]
+#define _gloffset_TexStorage1D driDispatchRemapTable[TexStorage1D_remap_index]
+#define _gloffset_TexStorage2D driDispatchRemapTable[TexStorage2D_remap_index]
+#define _gloffset_TexStorage3D driDispatchRemapTable[TexStorage3D_remap_index]
+#define _gloffset_TextureStorage1DEXT driDispatchRemapTable[TextureStorage1DEXT_remap_index]
+#define _gloffset_TextureStorage2DEXT driDispatchRemapTable[TextureStorage2DEXT_remap_index]
+#define _gloffset_TextureStorage3DEXT driDispatchRemapTable[TextureStorage3DEXT_remap_index]
+#define _gloffset_PolygonOffsetEXT driDispatchRemapTable[PolygonOffsetEXT_remap_index]
+#define _gloffset_GetPixelTexGenParameterfvSGIS driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index]
+#define _gloffset_GetPixelTexGenParameterivSGIS driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index]
+#define _gloffset_PixelTexGenParameterfSGIS driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index]
+#define _gloffset_PixelTexGenParameterfvSGIS driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index]
+#define _gloffset_PixelTexGenParameteriSGIS driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index]
+#define _gloffset_PixelTexGenParameterivSGIS driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index]
+#define _gloffset_SampleMaskSGIS driDispatchRemapTable[SampleMaskSGIS_remap_index]
+#define _gloffset_SamplePatternSGIS driDispatchRemapTable[SamplePatternSGIS_remap_index]
+#define _gloffset_ColorPointerEXT driDispatchRemapTable[ColorPointerEXT_remap_index]
+#define _gloffset_EdgeFlagPointerEXT driDispatchRemapTable[EdgeFlagPointerEXT_remap_index]
+#define _gloffset_IndexPointerEXT driDispatchRemapTable[IndexPointerEXT_remap_index]
+#define _gloffset_NormalPointerEXT driDispatchRemapTable[NormalPointerEXT_remap_index]
+#define _gloffset_TexCoordPointerEXT driDispatchRemapTable[TexCoordPointerEXT_remap_index]
+#define _gloffset_VertexPointerEXT driDispatchRemapTable[VertexPointerEXT_remap_index]
+#define _gloffset_PointParameterfEXT driDispatchRemapTable[PointParameterfEXT_remap_index]
+#define _gloffset_PointParameterfvEXT driDispatchRemapTable[PointParameterfvEXT_remap_index]
+#define _gloffset_LockArraysEXT driDispatchRemapTable[LockArraysEXT_remap_index]
+#define _gloffset_UnlockArraysEXT driDispatchRemapTable[UnlockArraysEXT_remap_index]
+#define _gloffset_SecondaryColor3bEXT driDispatchRemapTable[SecondaryColor3bEXT_remap_index]
+#define _gloffset_SecondaryColor3bvEXT driDispatchRemapTable[SecondaryColor3bvEXT_remap_index]
+#define _gloffset_SecondaryColor3dEXT driDispatchRemapTable[SecondaryColor3dEXT_remap_index]
+#define _gloffset_SecondaryColor3dvEXT driDispatchRemapTable[SecondaryColor3dvEXT_remap_index]
+#define _gloffset_SecondaryColor3fEXT driDispatchRemapTable[SecondaryColor3fEXT_remap_index]
+#define _gloffset_SecondaryColor3fvEXT driDispatchRemapTable[SecondaryColor3fvEXT_remap_index]
+#define _gloffset_SecondaryColor3iEXT driDispatchRemapTable[SecondaryColor3iEXT_remap_index]
+#define _gloffset_SecondaryColor3ivEXT driDispatchRemapTable[SecondaryColor3ivEXT_remap_index]
+#define _gloffset_SecondaryColor3sEXT driDispatchRemapTable[SecondaryColor3sEXT_remap_index]
+#define _gloffset_SecondaryColor3svEXT driDispatchRemapTable[SecondaryColor3svEXT_remap_index]
+#define _gloffset_SecondaryColor3ubEXT driDispatchRemapTable[SecondaryColor3ubEXT_remap_index]
+#define _gloffset_SecondaryColor3ubvEXT driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index]
+#define _gloffset_SecondaryColor3uiEXT driDispatchRemapTable[SecondaryColor3uiEXT_remap_index]
+#define _gloffset_SecondaryColor3uivEXT driDispatchRemapTable[SecondaryColor3uivEXT_remap_index]
+#define _gloffset_SecondaryColor3usEXT driDispatchRemapTable[SecondaryColor3usEXT_remap_index]
+#define _gloffset_SecondaryColor3usvEXT driDispatchRemapTable[SecondaryColor3usvEXT_remap_index]
+#define _gloffset_SecondaryColorPointerEXT driDispatchRemapTable[SecondaryColorPointerEXT_remap_index]
+#define _gloffset_MultiDrawArraysEXT driDispatchRemapTable[MultiDrawArraysEXT_remap_index]
+#define _gloffset_MultiDrawElementsEXT driDispatchRemapTable[MultiDrawElementsEXT_remap_index]
+#define _gloffset_FogCoordPointerEXT driDispatchRemapTable[FogCoordPointerEXT_remap_index]
+#define _gloffset_FogCoorddEXT driDispatchRemapTable[FogCoorddEXT_remap_index]
+#define _gloffset_FogCoorddvEXT driDispatchRemapTable[FogCoorddvEXT_remap_index]
+#define _gloffset_FogCoordfEXT driDispatchRemapTable[FogCoordfEXT_remap_index]
+#define _gloffset_FogCoordfvEXT driDispatchRemapTable[FogCoordfvEXT_remap_index]
+#define _gloffset_PixelTexGenSGIX driDispatchRemapTable[PixelTexGenSGIX_remap_index]
+#define _gloffset_BlendFuncSeparateEXT driDispatchRemapTable[BlendFuncSeparateEXT_remap_index]
+#define _gloffset_FlushVertexArrayRangeNV driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index]
+#define _gloffset_VertexArrayRangeNV driDispatchRemapTable[VertexArrayRangeNV_remap_index]
+#define _gloffset_CombinerInputNV driDispatchRemapTable[CombinerInputNV_remap_index]
+#define _gloffset_CombinerOutputNV driDispatchRemapTable[CombinerOutputNV_remap_index]
+#define _gloffset_CombinerParameterfNV driDispatchRemapTable[CombinerParameterfNV_remap_index]
+#define _gloffset_CombinerParameterfvNV driDispatchRemapTable[CombinerParameterfvNV_remap_index]
+#define _gloffset_CombinerParameteriNV driDispatchRemapTable[CombinerParameteriNV_remap_index]
+#define _gloffset_CombinerParameterivNV driDispatchRemapTable[CombinerParameterivNV_remap_index]
+#define _gloffset_FinalCombinerInputNV driDispatchRemapTable[FinalCombinerInputNV_remap_index]
+#define _gloffset_GetCombinerInputParameterfvNV driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index]
+#define _gloffset_GetCombinerInputParameterivNV driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index]
+#define _gloffset_GetCombinerOutputParameterfvNV driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index]
+#define _gloffset_GetCombinerOutputParameterivNV driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index]
+#define _gloffset_GetFinalCombinerInputParameterfvNV driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index]
+#define _gloffset_GetFinalCombinerInputParameterivNV driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index]
+#define _gloffset_ResizeBuffersMESA driDispatchRemapTable[ResizeBuffersMESA_remap_index]
+#define _gloffset_WindowPos2dMESA driDispatchRemapTable[WindowPos2dMESA_remap_index]
+#define _gloffset_WindowPos2dvMESA driDispatchRemapTable[WindowPos2dvMESA_remap_index]
+#define _gloffset_WindowPos2fMESA driDispatchRemapTable[WindowPos2fMESA_remap_index]
+#define _gloffset_WindowPos2fvMESA driDispatchRemapTable[WindowPos2fvMESA_remap_index]
+#define _gloffset_WindowPos2iMESA driDispatchRemapTable[WindowPos2iMESA_remap_index]
+#define _gloffset_WindowPos2ivMESA driDispatchRemapTable[WindowPos2ivMESA_remap_index]
+#define _gloffset_WindowPos2sMESA driDispatchRemapTable[WindowPos2sMESA_remap_index]
+#define _gloffset_WindowPos2svMESA driDispatchRemapTable[WindowPos2svMESA_remap_index]
+#define _gloffset_WindowPos3dMESA driDispatchRemapTable[WindowPos3dMESA_remap_index]
+#define _gloffset_WindowPos3dvMESA driDispatchRemapTable[WindowPos3dvMESA_remap_index]
+#define _gloffset_WindowPos3fMESA driDispatchRemapTable[WindowPos3fMESA_remap_index]
+#define _gloffset_WindowPos3fvMESA driDispatchRemapTable[WindowPos3fvMESA_remap_index]
+#define _gloffset_WindowPos3iMESA driDispatchRemapTable[WindowPos3iMESA_remap_index]
+#define _gloffset_WindowPos3ivMESA driDispatchRemapTable[WindowPos3ivMESA_remap_index]
+#define _gloffset_WindowPos3sMESA driDispatchRemapTable[WindowPos3sMESA_remap_index]
+#define _gloffset_WindowPos3svMESA driDispatchRemapTable[WindowPos3svMESA_remap_index]
+#define _gloffset_WindowPos4dMESA driDispatchRemapTable[WindowPos4dMESA_remap_index]
+#define _gloffset_WindowPos4dvMESA driDispatchRemapTable[WindowPos4dvMESA_remap_index]
+#define _gloffset_WindowPos4fMESA driDispatchRemapTable[WindowPos4fMESA_remap_index]
+#define _gloffset_WindowPos4fvMESA driDispatchRemapTable[WindowPos4fvMESA_remap_index]
+#define _gloffset_WindowPos4iMESA driDispatchRemapTable[WindowPos4iMESA_remap_index]
+#define _gloffset_WindowPos4ivMESA driDispatchRemapTable[WindowPos4ivMESA_remap_index]
+#define _gloffset_WindowPos4sMESA driDispatchRemapTable[WindowPos4sMESA_remap_index]
+#define _gloffset_WindowPos4svMESA driDispatchRemapTable[WindowPos4svMESA_remap_index]
+#define _gloffset_MultiModeDrawArraysIBM driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index]
+#define _gloffset_MultiModeDrawElementsIBM driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index]
+#define _gloffset_DeleteFencesNV driDispatchRemapTable[DeleteFencesNV_remap_index]
+#define _gloffset_FinishFenceNV driDispatchRemapTable[FinishFenceNV_remap_index]
+#define _gloffset_GenFencesNV driDispatchRemapTable[GenFencesNV_remap_index]
+#define _gloffset_GetFenceivNV driDispatchRemapTable[GetFenceivNV_remap_index]
+#define _gloffset_IsFenceNV driDispatchRemapTable[IsFenceNV_remap_index]
+#define _gloffset_SetFenceNV driDispatchRemapTable[SetFenceNV_remap_index]
+#define _gloffset_TestFenceNV driDispatchRemapTable[TestFenceNV_remap_index]
+#define _gloffset_AreProgramsResidentNV driDispatchRemapTable[AreProgramsResidentNV_remap_index]
+#define _gloffset_BindProgramNV driDispatchRemapTable[BindProgramNV_remap_index]
+#define _gloffset_DeleteProgramsNV driDispatchRemapTable[DeleteProgramsNV_remap_index]
+#define _gloffset_ExecuteProgramNV driDispatchRemapTable[ExecuteProgramNV_remap_index]
+#define _gloffset_GenProgramsNV driDispatchRemapTable[GenProgramsNV_remap_index]
+#define _gloffset_GetProgramParameterdvNV driDispatchRemapTable[GetProgramParameterdvNV_remap_index]
+#define _gloffset_GetProgramParameterfvNV driDispatchRemapTable[GetProgramParameterfvNV_remap_index]
+#define _gloffset_GetProgramStringNV driDispatchRemapTable[GetProgramStringNV_remap_index]
+#define _gloffset_GetProgramivNV driDispatchRemapTable[GetProgramivNV_remap_index]
+#define _gloffset_GetTrackMatrixivNV driDispatchRemapTable[GetTrackMatrixivNV_remap_index]
+#define _gloffset_GetVertexAttribPointervNV driDispatchRemapTable[GetVertexAttribPointervNV_remap_index]
+#define _gloffset_GetVertexAttribdvNV driDispatchRemapTable[GetVertexAttribdvNV_remap_index]
+#define _gloffset_GetVertexAttribfvNV driDispatchRemapTable[GetVertexAttribfvNV_remap_index]
+#define _gloffset_GetVertexAttribivNV driDispatchRemapTable[GetVertexAttribivNV_remap_index]
+#define _gloffset_IsProgramNV driDispatchRemapTable[IsProgramNV_remap_index]
+#define _gloffset_LoadProgramNV driDispatchRemapTable[LoadProgramNV_remap_index]
+#define _gloffset_ProgramParameters4dvNV driDispatchRemapTable[ProgramParameters4dvNV_remap_index]
+#define _gloffset_ProgramParameters4fvNV driDispatchRemapTable[ProgramParameters4fvNV_remap_index]
+#define _gloffset_RequestResidentProgramsNV driDispatchRemapTable[RequestResidentProgramsNV_remap_index]
+#define _gloffset_TrackMatrixNV driDispatchRemapTable[TrackMatrixNV_remap_index]
+#define _gloffset_VertexAttrib1dNV driDispatchRemapTable[VertexAttrib1dNV_remap_index]
+#define _gloffset_VertexAttrib1dvNV driDispatchRemapTable[VertexAttrib1dvNV_remap_index]
+#define _gloffset_VertexAttrib1fNV driDispatchRemapTable[VertexAttrib1fNV_remap_index]
+#define _gloffset_VertexAttrib1fvNV driDispatchRemapTable[VertexAttrib1fvNV_remap_index]
+#define _gloffset_VertexAttrib1sNV driDispatchRemapTable[VertexAttrib1sNV_remap_index]
+#define _gloffset_VertexAttrib1svNV driDispatchRemapTable[VertexAttrib1svNV_remap_index]
+#define _gloffset_VertexAttrib2dNV driDispatchRemapTable[VertexAttrib2dNV_remap_index]
+#define _gloffset_VertexAttrib2dvNV driDispatchRemapTable[VertexAttrib2dvNV_remap_index]
+#define _gloffset_VertexAttrib2fNV driDispatchRemapTable[VertexAttrib2fNV_remap_index]
+#define _gloffset_VertexAttrib2fvNV driDispatchRemapTable[VertexAttrib2fvNV_remap_index]
+#define _gloffset_VertexAttrib2sNV driDispatchRemapTable[VertexAttrib2sNV_remap_index]
+#define _gloffset_VertexAttrib2svNV driDispatchRemapTable[VertexAttrib2svNV_remap_index]
+#define _gloffset_VertexAttrib3dNV driDispatchRemapTable[VertexAttrib3dNV_remap_index]
+#define _gloffset_VertexAttrib3dvNV driDispatchRemapTable[VertexAttrib3dvNV_remap_index]
+#define _gloffset_VertexAttrib3fNV driDispatchRemapTable[VertexAttrib3fNV_remap_index]
+#define _gloffset_VertexAttrib3fvNV driDispatchRemapTable[VertexAttrib3fvNV_remap_index]
+#define _gloffset_VertexAttrib3sNV driDispatchRemapTable[VertexAttrib3sNV_remap_index]
+#define _gloffset_VertexAttrib3svNV driDispatchRemapTable[VertexAttrib3svNV_remap_index]
+#define _gloffset_VertexAttrib4dNV driDispatchRemapTable[VertexAttrib4dNV_remap_index]
+#define _gloffset_VertexAttrib4dvNV driDispatchRemapTable[VertexAttrib4dvNV_remap_index]
+#define _gloffset_VertexAttrib4fNV driDispatchRemapTable[VertexAttrib4fNV_remap_index]
+#define _gloffset_VertexAttrib4fvNV driDispatchRemapTable[VertexAttrib4fvNV_remap_index]
+#define _gloffset_VertexAttrib4sNV driDispatchRemapTable[VertexAttrib4sNV_remap_index]
+#define _gloffset_VertexAttrib4svNV driDispatchRemapTable[VertexAttrib4svNV_remap_index]
+#define _gloffset_VertexAttrib4ubNV driDispatchRemapTable[VertexAttrib4ubNV_remap_index]
+#define _gloffset_VertexAttrib4ubvNV driDispatchRemapTable[VertexAttrib4ubvNV_remap_index]
+#define _gloffset_VertexAttribPointerNV driDispatchRemapTable[VertexAttribPointerNV_remap_index]
+#define _gloffset_VertexAttribs1dvNV driDispatchRemapTable[VertexAttribs1dvNV_remap_index]
+#define _gloffset_VertexAttribs1fvNV driDispatchRemapTable[VertexAttribs1fvNV_remap_index]
+#define _gloffset_VertexAttribs1svNV driDispatchRemapTable[VertexAttribs1svNV_remap_index]
+#define _gloffset_VertexAttribs2dvNV driDispatchRemapTable[VertexAttribs2dvNV_remap_index]
+#define _gloffset_VertexAttribs2fvNV driDispatchRemapTable[VertexAttribs2fvNV_remap_index]
+#define _gloffset_VertexAttribs2svNV driDispatchRemapTable[VertexAttribs2svNV_remap_index]
+#define _gloffset_VertexAttribs3dvNV driDispatchRemapTable[VertexAttribs3dvNV_remap_index]
+#define _gloffset_VertexAttribs3fvNV driDispatchRemapTable[VertexAttribs3fvNV_remap_index]
+#define _gloffset_VertexAttribs3svNV driDispatchRemapTable[VertexAttribs3svNV_remap_index]
+#define _gloffset_VertexAttribs4dvNV driDispatchRemapTable[VertexAttribs4dvNV_remap_index]
+#define _gloffset_VertexAttribs4fvNV driDispatchRemapTable[VertexAttribs4fvNV_remap_index]
+#define _gloffset_VertexAttribs4svNV driDispatchRemapTable[VertexAttribs4svNV_remap_index]
+#define _gloffset_VertexAttribs4ubvNV driDispatchRemapTable[VertexAttribs4ubvNV_remap_index]
+#define _gloffset_GetTexBumpParameterfvATI driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index]
+#define _gloffset_GetTexBumpParameterivATI driDispatchRemapTable[GetTexBumpParameterivATI_remap_index]
+#define _gloffset_TexBumpParameterfvATI driDispatchRemapTable[TexBumpParameterfvATI_remap_index]
+#define _gloffset_TexBumpParameterivATI driDispatchRemapTable[TexBumpParameterivATI_remap_index]
+#define _gloffset_AlphaFragmentOp1ATI driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index]
+#define _gloffset_AlphaFragmentOp2ATI driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index]
+#define _gloffset_AlphaFragmentOp3ATI driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index]
+#define _gloffset_BeginFragmentShaderATI driDispatchRemapTable[BeginFragmentShaderATI_remap_index]
+#define _gloffset_BindFragmentShaderATI driDispatchRemapTable[BindFragmentShaderATI_remap_index]
+#define _gloffset_ColorFragmentOp1ATI driDispatchRemapTable[ColorFragmentOp1ATI_remap_index]
+#define _gloffset_ColorFragmentOp2ATI driDispatchRemapTable[ColorFragmentOp2ATI_remap_index]
+#define _gloffset_ColorFragmentOp3ATI driDispatchRemapTable[ColorFragmentOp3ATI_remap_index]
+#define _gloffset_DeleteFragmentShaderATI driDispatchRemapTable[DeleteFragmentShaderATI_remap_index]
+#define _gloffset_EndFragmentShaderATI driDispatchRemapTable[EndFragmentShaderATI_remap_index]
+#define _gloffset_GenFragmentShadersATI driDispatchRemapTable[GenFragmentShadersATI_remap_index]
+#define _gloffset_PassTexCoordATI driDispatchRemapTable[PassTexCoordATI_remap_index]
+#define _gloffset_SampleMapATI driDispatchRemapTable[SampleMapATI_remap_index]
+#define _gloffset_SetFragmentShaderConstantATI driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index]
+#define _gloffset_PointParameteriNV driDispatchRemapTable[PointParameteriNV_remap_index]
+#define _gloffset_PointParameterivNV driDispatchRemapTable[PointParameterivNV_remap_index]
+#define _gloffset_ActiveStencilFaceEXT driDispatchRemapTable[ActiveStencilFaceEXT_remap_index]
+#define _gloffset_BindVertexArrayAPPLE driDispatchRemapTable[BindVertexArrayAPPLE_remap_index]
+#define _gloffset_DeleteVertexArraysAPPLE driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index]
+#define _gloffset_GenVertexArraysAPPLE driDispatchRemapTable[GenVertexArraysAPPLE_remap_index]
+#define _gloffset_IsVertexArrayAPPLE driDispatchRemapTable[IsVertexArrayAPPLE_remap_index]
+#define _gloffset_GetProgramNamedParameterdvNV driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index]
+#define _gloffset_GetProgramNamedParameterfvNV driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index]
+#define _gloffset_ProgramNamedParameter4dNV driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index]
+#define _gloffset_ProgramNamedParameter4dvNV driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index]
+#define _gloffset_ProgramNamedParameter4fNV driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index]
+#define _gloffset_ProgramNamedParameter4fvNV driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index]
+#define _gloffset_PrimitiveRestartIndexNV driDispatchRemapTable[PrimitiveRestartIndexNV_remap_index]
+#define _gloffset_PrimitiveRestartNV driDispatchRemapTable[PrimitiveRestartNV_remap_index]
+#define _gloffset_DepthBoundsEXT driDispatchRemapTable[DepthBoundsEXT_remap_index]
+#define _gloffset_BlendEquationSeparateEXT driDispatchRemapTable[BlendEquationSeparateEXT_remap_index]
+#define _gloffset_BindFramebufferEXT driDispatchRemapTable[BindFramebufferEXT_remap_index]
+#define _gloffset_BindRenderbufferEXT driDispatchRemapTable[BindRenderbufferEXT_remap_index]
+#define _gloffset_CheckFramebufferStatusEXT driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index]
+#define _gloffset_DeleteFramebuffersEXT driDispatchRemapTable[DeleteFramebuffersEXT_remap_index]
+#define _gloffset_DeleteRenderbuffersEXT driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index]
+#define _gloffset_FramebufferRenderbufferEXT driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index]
+#define _gloffset_FramebufferTexture1DEXT driDispatchRemapTable[FramebufferTexture1DEXT_remap_index]
+#define _gloffset_FramebufferTexture2DEXT driDispatchRemapTable[FramebufferTexture2DEXT_remap_index]
+#define _gloffset_FramebufferTexture3DEXT driDispatchRemapTable[FramebufferTexture3DEXT_remap_index]
+#define _gloffset_GenFramebuffersEXT driDispatchRemapTable[GenFramebuffersEXT_remap_index]
+#define _gloffset_GenRenderbuffersEXT driDispatchRemapTable[GenRenderbuffersEXT_remap_index]
+#define _gloffset_GenerateMipmapEXT driDispatchRemapTable[GenerateMipmapEXT_remap_index]
+#define _gloffset_GetFramebufferAttachmentParameterivEXT driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index]
+#define _gloffset_GetRenderbufferParameterivEXT driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index]
+#define _gloffset_IsFramebufferEXT driDispatchRemapTable[IsFramebufferEXT_remap_index]
+#define _gloffset_IsRenderbufferEXT driDispatchRemapTable[IsRenderbufferEXT_remap_index]
+#define _gloffset_RenderbufferStorageEXT driDispatchRemapTable[RenderbufferStorageEXT_remap_index]
+#define _gloffset_BlitFramebufferEXT driDispatchRemapTable[BlitFramebufferEXT_remap_index]
+#define _gloffset_BufferParameteriAPPLE driDispatchRemapTable[BufferParameteriAPPLE_remap_index]
+#define _gloffset_FlushMappedBufferRangeAPPLE driDispatchRemapTable[FlushMappedBufferRangeAPPLE_remap_index]
+#define _gloffset_BindFragDataLocationEXT driDispatchRemapTable[BindFragDataLocationEXT_remap_index]
+#define _gloffset_GetFragDataLocationEXT driDispatchRemapTable[GetFragDataLocationEXT_remap_index]
+#define _gloffset_GetUniformuivEXT driDispatchRemapTable[GetUniformuivEXT_remap_index]
+#define _gloffset_GetVertexAttribIivEXT driDispatchRemapTable[GetVertexAttribIivEXT_remap_index]
+#define _gloffset_GetVertexAttribIuivEXT driDispatchRemapTable[GetVertexAttribIuivEXT_remap_index]
+#define _gloffset_Uniform1uiEXT driDispatchRemapTable[Uniform1uiEXT_remap_index]
+#define _gloffset_Uniform1uivEXT driDispatchRemapTable[Uniform1uivEXT_remap_index]
+#define _gloffset_Uniform2uiEXT driDispatchRemapTable[Uniform2uiEXT_remap_index]
+#define _gloffset_Uniform2uivEXT driDispatchRemapTable[Uniform2uivEXT_remap_index]
+#define _gloffset_Uniform3uiEXT driDispatchRemapTable[Uniform3uiEXT_remap_index]
+#define _gloffset_Uniform3uivEXT driDispatchRemapTable[Uniform3uivEXT_remap_index]
+#define _gloffset_Uniform4uiEXT driDispatchRemapTable[Uniform4uiEXT_remap_index]
+#define _gloffset_Uniform4uivEXT driDispatchRemapTable[Uniform4uivEXT_remap_index]
+#define _gloffset_VertexAttribI1iEXT driDispatchRemapTable[VertexAttribI1iEXT_remap_index]
+#define _gloffset_VertexAttribI1ivEXT driDispatchRemapTable[VertexAttribI1ivEXT_remap_index]
+#define _gloffset_VertexAttribI1uiEXT driDispatchRemapTable[VertexAttribI1uiEXT_remap_index]
+#define _gloffset_VertexAttribI1uivEXT driDispatchRemapTable[VertexAttribI1uivEXT_remap_index]
+#define _gloffset_VertexAttribI2iEXT driDispatchRemapTable[VertexAttribI2iEXT_remap_index]
+#define _gloffset_VertexAttribI2ivEXT driDispatchRemapTable[VertexAttribI2ivEXT_remap_index]
+#define _gloffset_VertexAttribI2uiEXT driDispatchRemapTable[VertexAttribI2uiEXT_remap_index]
+#define _gloffset_VertexAttribI2uivEXT driDispatchRemapTable[VertexAttribI2uivEXT_remap_index]
+#define _gloffset_VertexAttribI3iEXT driDispatchRemapTable[VertexAttribI3iEXT_remap_index]
+#define _gloffset_VertexAttribI3ivEXT driDispatchRemapTable[VertexAttribI3ivEXT_remap_index]
+#define _gloffset_VertexAttribI3uiEXT driDispatchRemapTable[VertexAttribI3uiEXT_remap_index]
+#define _gloffset_VertexAttribI3uivEXT driDispatchRemapTable[VertexAttribI3uivEXT_remap_index]
+#define _gloffset_VertexAttribI4bvEXT driDispatchRemapTable[VertexAttribI4bvEXT_remap_index]
+#define _gloffset_VertexAttribI4iEXT driDispatchRemapTable[VertexAttribI4iEXT_remap_index]
+#define _gloffset_VertexAttribI4ivEXT driDispatchRemapTable[VertexAttribI4ivEXT_remap_index]
+#define _gloffset_VertexAttribI4svEXT driDispatchRemapTable[VertexAttribI4svEXT_remap_index]
+#define _gloffset_VertexAttribI4ubvEXT driDispatchRemapTable[VertexAttribI4ubvEXT_remap_index]
+#define _gloffset_VertexAttribI4uiEXT driDispatchRemapTable[VertexAttribI4uiEXT_remap_index]
+#define _gloffset_VertexAttribI4uivEXT driDispatchRemapTable[VertexAttribI4uivEXT_remap_index]
+#define _gloffset_VertexAttribI4usvEXT driDispatchRemapTable[VertexAttribI4usvEXT_remap_index]
+#define _gloffset_VertexAttribIPointerEXT driDispatchRemapTable[VertexAttribIPointerEXT_remap_index]
+#define _gloffset_FramebufferTextureLayerEXT driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index]
+#define _gloffset_ColorMaskIndexedEXT driDispatchRemapTable[ColorMaskIndexedEXT_remap_index]
+#define _gloffset_DisableIndexedEXT driDispatchRemapTable[DisableIndexedEXT_remap_index]
+#define _gloffset_EnableIndexedEXT driDispatchRemapTable[EnableIndexedEXT_remap_index]
+#define _gloffset_GetBooleanIndexedvEXT driDispatchRemapTable[GetBooleanIndexedvEXT_remap_index]
+#define _gloffset_GetIntegerIndexedvEXT driDispatchRemapTable[GetIntegerIndexedvEXT_remap_index]
+#define _gloffset_IsEnabledIndexedEXT driDispatchRemapTable[IsEnabledIndexedEXT_remap_index]
+#define _gloffset_ClearColorIiEXT driDispatchRemapTable[ClearColorIiEXT_remap_index]
+#define _gloffset_ClearColorIuiEXT driDispatchRemapTable[ClearColorIuiEXT_remap_index]
+#define _gloffset_GetTexParameterIivEXT driDispatchRemapTable[GetTexParameterIivEXT_remap_index]
+#define _gloffset_GetTexParameterIuivEXT driDispatchRemapTable[GetTexParameterIuivEXT_remap_index]
+#define _gloffset_TexParameterIivEXT driDispatchRemapTable[TexParameterIivEXT_remap_index]
+#define _gloffset_TexParameterIuivEXT driDispatchRemapTable[TexParameterIuivEXT_remap_index]
+#define _gloffset_BeginConditionalRenderNV driDispatchRemapTable[BeginConditionalRenderNV_remap_index]
+#define _gloffset_EndConditionalRenderNV driDispatchRemapTable[EndConditionalRenderNV_remap_index]
+#define _gloffset_BeginTransformFeedbackEXT driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index]
+#define _gloffset_BindBufferBaseEXT driDispatchRemapTable[BindBufferBaseEXT_remap_index]
+#define _gloffset_BindBufferOffsetEXT driDispatchRemapTable[BindBufferOffsetEXT_remap_index]
+#define _gloffset_BindBufferRangeEXT driDispatchRemapTable[BindBufferRangeEXT_remap_index]
+#define _gloffset_EndTransformFeedbackEXT driDispatchRemapTable[EndTransformFeedbackEXT_remap_index]
+#define _gloffset_GetTransformFeedbackVaryingEXT driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index]
+#define _gloffset_TransformFeedbackVaryingsEXT driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index]
+#define _gloffset_ProvokingVertexEXT driDispatchRemapTable[ProvokingVertexEXT_remap_index]
+#define _gloffset_GetTexParameterPointervAPPLE driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index]
+#define _gloffset_TextureRangeAPPLE driDispatchRemapTable[TextureRangeAPPLE_remap_index]
+#define _gloffset_GetObjectParameterivAPPLE driDispatchRemapTable[GetObjectParameterivAPPLE_remap_index]
+#define _gloffset_ObjectPurgeableAPPLE driDispatchRemapTable[ObjectPurgeableAPPLE_remap_index]
+#define _gloffset_ObjectUnpurgeableAPPLE driDispatchRemapTable[ObjectUnpurgeableAPPLE_remap_index]
+#define _gloffset_ActiveProgramEXT driDispatchRemapTable[ActiveProgramEXT_remap_index]
+#define _gloffset_CreateShaderProgramEXT driDispatchRemapTable[CreateShaderProgramEXT_remap_index]
+#define _gloffset_UseShaderProgramEXT driDispatchRemapTable[UseShaderProgramEXT_remap_index]
+#define _gloffset_TextureBarrierNV driDispatchRemapTable[TextureBarrierNV_remap_index]
+#define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index]
+#define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]
+#define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index]
+#define _gloffset_GetQueryObjecti64vEXT driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index]
+#define _gloffset_GetQueryObjectui64vEXT driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index]
+#define _gloffset_EGLImageTargetRenderbufferStorageOES driDispatchRemapTable[EGLImageTargetRenderbufferStorageOES_remap_index]
+#define _gloffset_EGLImageTargetTexture2DOES driDispatchRemapTable[EGLImageTargetTexture2DOES_remap_index]
+
+#endif /* !FEATURE_remap_table */
+
+typedef void (GLAPIENTRYP _glptr_NewList)(GLuint, GLenum);
+#define CALL_NewList(disp, parameters) \
+ (* GET_NewList(disp)) parameters
+static INLINE _glptr_NewList GET_NewList(struct _glapi_table *disp) {
+ return (_glptr_NewList) (GET_by_offset(disp, _gloffset_NewList));
+}
+
+static INLINE void SET_NewList(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum)) {
+ SET_by_offset(disp, _gloffset_NewList, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EndList)(void);
+#define CALL_EndList(disp, parameters) \
+ (* GET_EndList(disp)) parameters
+static INLINE _glptr_EndList GET_EndList(struct _glapi_table *disp) {
+ return (_glptr_EndList) (GET_by_offset(disp, _gloffset_EndList));
+}
+
+static INLINE void SET_EndList(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_EndList, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CallList)(GLuint);
+#define CALL_CallList(disp, parameters) \
+ (* GET_CallList(disp)) parameters
+static INLINE _glptr_CallList GET_CallList(struct _glapi_table *disp) {
+ return (_glptr_CallList) (GET_by_offset(disp, _gloffset_CallList));
+}
+
+static INLINE void SET_CallList(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_CallList, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CallLists)(GLsizei, GLenum, const GLvoid *);
+#define CALL_CallLists(disp, parameters) \
+ (* GET_CallLists(disp)) parameters
+static INLINE _glptr_CallLists GET_CallLists(struct _glapi_table *disp) {
+ return (_glptr_CallLists) (GET_by_offset(disp, _gloffset_CallLists));
+}
+
+static INLINE void SET_CallLists(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_CallLists, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteLists)(GLuint, GLsizei);
+#define CALL_DeleteLists(disp, parameters) \
+ (* GET_DeleteLists(disp)) parameters
+static INLINE _glptr_DeleteLists GET_DeleteLists(struct _glapi_table *disp) {
+ return (_glptr_DeleteLists) (GET_by_offset(disp, _gloffset_DeleteLists));
+}
+
+static INLINE void SET_DeleteLists(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei)) {
+ SET_by_offset(disp, _gloffset_DeleteLists, fn);
+}
+
+typedef GLuint (GLAPIENTRYP _glptr_GenLists)(GLsizei);
+#define CALL_GenLists(disp, parameters) \
+ (* GET_GenLists(disp)) parameters
+static INLINE _glptr_GenLists GET_GenLists(struct _glapi_table *disp) {
+ return (_glptr_GenLists) (GET_by_offset(disp, _gloffset_GenLists));
+}
+
+static INLINE void SET_GenLists(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(GLsizei)) {
+ SET_by_offset(disp, _gloffset_GenLists, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ListBase)(GLuint);
+#define CALL_ListBase(disp, parameters) \
+ (* GET_ListBase(disp)) parameters
+static INLINE _glptr_ListBase GET_ListBase(struct _glapi_table *disp) {
+ return (_glptr_ListBase) (GET_by_offset(disp, _gloffset_ListBase));
+}
+
+static INLINE void SET_ListBase(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_ListBase, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Begin)(GLenum);
+#define CALL_Begin(disp, parameters) \
+ (* GET_Begin(disp)) parameters
+static INLINE _glptr_Begin GET_Begin(struct _glapi_table *disp) {
+ return (_glptr_Begin) (GET_by_offset(disp, _gloffset_Begin));
+}
+
+static INLINE void SET_Begin(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_Begin, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Bitmap)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *);
+#define CALL_Bitmap(disp, parameters) \
+ (* GET_Bitmap(disp)) parameters
+static INLINE _glptr_Bitmap GET_Bitmap(struct _glapi_table *disp) {
+ return (_glptr_Bitmap) (GET_by_offset(disp, _gloffset_Bitmap));
+}
+
+static INLINE void SET_Bitmap(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_Bitmap, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3b)(GLbyte, GLbyte, GLbyte);
+#define CALL_Color3b(disp, parameters) \
+ (* GET_Color3b(disp)) parameters
+static INLINE _glptr_Color3b GET_Color3b(struct _glapi_table *disp) {
+ return (_glptr_Color3b) (GET_by_offset(disp, _gloffset_Color3b));
+}
+
+static INLINE void SET_Color3b(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbyte, GLbyte, GLbyte)) {
+ SET_by_offset(disp, _gloffset_Color3b, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3bv)(const GLbyte *);
+#define CALL_Color3bv(disp, parameters) \
+ (* GET_Color3bv(disp)) parameters
+static INLINE _glptr_Color3bv GET_Color3bv(struct _glapi_table *disp) {
+ return (_glptr_Color3bv) (GET_by_offset(disp, _gloffset_Color3bv));
+}
+
+static INLINE void SET_Color3bv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLbyte *)) {
+ SET_by_offset(disp, _gloffset_Color3bv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3d)(GLdouble, GLdouble, GLdouble);
+#define CALL_Color3d(disp, parameters) \
+ (* GET_Color3d(disp)) parameters
+static INLINE _glptr_Color3d GET_Color3d(struct _glapi_table *disp) {
+ return (_glptr_Color3d) (GET_by_offset(disp, _gloffset_Color3d));
+}
+
+static INLINE void SET_Color3d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Color3d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3dv)(const GLdouble *);
+#define CALL_Color3dv(disp, parameters) \
+ (* GET_Color3dv(disp)) parameters
+static INLINE _glptr_Color3dv GET_Color3dv(struct _glapi_table *disp) {
+ return (_glptr_Color3dv) (GET_by_offset(disp, _gloffset_Color3dv));
+}
+
+static INLINE void SET_Color3dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_Color3dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3f)(GLfloat, GLfloat, GLfloat);
+#define CALL_Color3f(disp, parameters) \
+ (* GET_Color3f(disp)) parameters
+static INLINE _glptr_Color3f GET_Color3f(struct _glapi_table *disp) {
+ return (_glptr_Color3f) (GET_by_offset(disp, _gloffset_Color3f));
+}
+
+static INLINE void SET_Color3f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Color3f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3fv)(const GLfloat *);
+#define CALL_Color3fv(disp, parameters) \
+ (* GET_Color3fv(disp)) parameters
+static INLINE _glptr_Color3fv GET_Color3fv(struct _glapi_table *disp) {
+ return (_glptr_Color3fv) (GET_by_offset(disp, _gloffset_Color3fv));
+}
+
+static INLINE void SET_Color3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Color3fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3i)(GLint, GLint, GLint);
+#define CALL_Color3i(disp, parameters) \
+ (* GET_Color3i(disp)) parameters
+static INLINE _glptr_Color3i GET_Color3i(struct _glapi_table *disp) {
+ return (_glptr_Color3i) (GET_by_offset(disp, _gloffset_Color3i));
+}
+
+static INLINE void SET_Color3i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Color3i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3iv)(const GLint *);
+#define CALL_Color3iv(disp, parameters) \
+ (* GET_Color3iv(disp)) parameters
+static INLINE _glptr_Color3iv GET_Color3iv(struct _glapi_table *disp) {
+ return (_glptr_Color3iv) (GET_by_offset(disp, _gloffset_Color3iv));
+}
+
+static INLINE void SET_Color3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_Color3iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3s)(GLshort, GLshort, GLshort);
+#define CALL_Color3s(disp, parameters) \
+ (* GET_Color3s(disp)) parameters
+static INLINE _glptr_Color3s GET_Color3s(struct _glapi_table *disp) {
+ return (_glptr_Color3s) (GET_by_offset(disp, _gloffset_Color3s));
+}
+
+static INLINE void SET_Color3s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_Color3s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3sv)(const GLshort *);
+#define CALL_Color3sv(disp, parameters) \
+ (* GET_Color3sv(disp)) parameters
+static INLINE _glptr_Color3sv GET_Color3sv(struct _glapi_table *disp) {
+ return (_glptr_Color3sv) (GET_by_offset(disp, _gloffset_Color3sv));
+}
+
+static INLINE void SET_Color3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_Color3sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3ub)(GLubyte, GLubyte, GLubyte);
+#define CALL_Color3ub(disp, parameters) \
+ (* GET_Color3ub(disp)) parameters
+static INLINE _glptr_Color3ub GET_Color3ub(struct _glapi_table *disp) {
+ return (_glptr_Color3ub) (GET_by_offset(disp, _gloffset_Color3ub));
+}
+
+static INLINE void SET_Color3ub(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLubyte, GLubyte, GLubyte)) {
+ SET_by_offset(disp, _gloffset_Color3ub, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3ubv)(const GLubyte *);
+#define CALL_Color3ubv(disp, parameters) \
+ (* GET_Color3ubv(disp)) parameters
+static INLINE _glptr_Color3ubv GET_Color3ubv(struct _glapi_table *disp) {
+ return (_glptr_Color3ubv) (GET_by_offset(disp, _gloffset_Color3ubv));
+}
+
+static INLINE void SET_Color3ubv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_Color3ubv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3ui)(GLuint, GLuint, GLuint);
+#define CALL_Color3ui(disp, parameters) \
+ (* GET_Color3ui(disp)) parameters
+static INLINE _glptr_Color3ui GET_Color3ui(struct _glapi_table *disp) {
+ return (_glptr_Color3ui) (GET_by_offset(disp, _gloffset_Color3ui));
+}
+
+static INLINE void SET_Color3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_Color3ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3uiv)(const GLuint *);
+#define CALL_Color3uiv(disp, parameters) \
+ (* GET_Color3uiv(disp)) parameters
+static INLINE _glptr_Color3uiv GET_Color3uiv(struct _glapi_table *disp) {
+ return (_glptr_Color3uiv) (GET_by_offset(disp, _gloffset_Color3uiv));
+}
+
+static INLINE void SET_Color3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLuint *)) {
+ SET_by_offset(disp, _gloffset_Color3uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3us)(GLushort, GLushort, GLushort);
+#define CALL_Color3us(disp, parameters) \
+ (* GET_Color3us(disp)) parameters
+static INLINE _glptr_Color3us GET_Color3us(struct _glapi_table *disp) {
+ return (_glptr_Color3us) (GET_by_offset(disp, _gloffset_Color3us));
+}
+
+static INLINE void SET_Color3us(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLushort, GLushort, GLushort)) {
+ SET_by_offset(disp, _gloffset_Color3us, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color3usv)(const GLushort *);
+#define CALL_Color3usv(disp, parameters) \
+ (* GET_Color3usv(disp)) parameters
+static INLINE _glptr_Color3usv GET_Color3usv(struct _glapi_table *disp) {
+ return (_glptr_Color3usv) (GET_by_offset(disp, _gloffset_Color3usv));
+}
+
+static INLINE void SET_Color3usv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLushort *)) {
+ SET_by_offset(disp, _gloffset_Color3usv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4b)(GLbyte, GLbyte, GLbyte, GLbyte);
+#define CALL_Color4b(disp, parameters) \
+ (* GET_Color4b(disp)) parameters
+static INLINE _glptr_Color4b GET_Color4b(struct _glapi_table *disp) {
+ return (_glptr_Color4b) (GET_by_offset(disp, _gloffset_Color4b));
+}
+
+static INLINE void SET_Color4b(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbyte, GLbyte, GLbyte, GLbyte)) {
+ SET_by_offset(disp, _gloffset_Color4b, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4bv)(const GLbyte *);
+#define CALL_Color4bv(disp, parameters) \
+ (* GET_Color4bv(disp)) parameters
+static INLINE _glptr_Color4bv GET_Color4bv(struct _glapi_table *disp) {
+ return (_glptr_Color4bv) (GET_by_offset(disp, _gloffset_Color4bv));
+}
+
+static INLINE void SET_Color4bv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLbyte *)) {
+ SET_by_offset(disp, _gloffset_Color4bv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4d)(GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_Color4d(disp, parameters) \
+ (* GET_Color4d(disp)) parameters
+static INLINE _glptr_Color4d GET_Color4d(struct _glapi_table *disp) {
+ return (_glptr_Color4d) (GET_by_offset(disp, _gloffset_Color4d));
+}
+
+static INLINE void SET_Color4d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Color4d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4dv)(const GLdouble *);
+#define CALL_Color4dv(disp, parameters) \
+ (* GET_Color4dv(disp)) parameters
+static INLINE _glptr_Color4dv GET_Color4dv(struct _glapi_table *disp) {
+ return (_glptr_Color4dv) (GET_by_offset(disp, _gloffset_Color4dv));
+}
+
+static INLINE void SET_Color4dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_Color4dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4f)(GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_Color4f(disp, parameters) \
+ (* GET_Color4f(disp)) parameters
+static INLINE _glptr_Color4f GET_Color4f(struct _glapi_table *disp) {
+ return (_glptr_Color4f) (GET_by_offset(disp, _gloffset_Color4f));
+}
+
+static INLINE void SET_Color4f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Color4f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4fv)(const GLfloat *);
+#define CALL_Color4fv(disp, parameters) \
+ (* GET_Color4fv(disp)) parameters
+static INLINE _glptr_Color4fv GET_Color4fv(struct _glapi_table *disp) {
+ return (_glptr_Color4fv) (GET_by_offset(disp, _gloffset_Color4fv));
+}
+
+static INLINE void SET_Color4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Color4fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4i)(GLint, GLint, GLint, GLint);
+#define CALL_Color4i(disp, parameters) \
+ (* GET_Color4i(disp)) parameters
+static INLINE _glptr_Color4i GET_Color4i(struct _glapi_table *disp) {
+ return (_glptr_Color4i) (GET_by_offset(disp, _gloffset_Color4i));
+}
+
+static INLINE void SET_Color4i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Color4i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4iv)(const GLint *);
+#define CALL_Color4iv(disp, parameters) \
+ (* GET_Color4iv(disp)) parameters
+static INLINE _glptr_Color4iv GET_Color4iv(struct _glapi_table *disp) {
+ return (_glptr_Color4iv) (GET_by_offset(disp, _gloffset_Color4iv));
+}
+
+static INLINE void SET_Color4iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_Color4iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4s)(GLshort, GLshort, GLshort, GLshort);
+#define CALL_Color4s(disp, parameters) \
+ (* GET_Color4s(disp)) parameters
+static INLINE _glptr_Color4s GET_Color4s(struct _glapi_table *disp) {
+ return (_glptr_Color4s) (GET_by_offset(disp, _gloffset_Color4s));
+}
+
+static INLINE void SET_Color4s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_Color4s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4sv)(const GLshort *);
+#define CALL_Color4sv(disp, parameters) \
+ (* GET_Color4sv(disp)) parameters
+static INLINE _glptr_Color4sv GET_Color4sv(struct _glapi_table *disp) {
+ return (_glptr_Color4sv) (GET_by_offset(disp, _gloffset_Color4sv));
+}
+
+static INLINE void SET_Color4sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_Color4sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte);
+#define CALL_Color4ub(disp, parameters) \
+ (* GET_Color4ub(disp)) parameters
+static INLINE _glptr_Color4ub GET_Color4ub(struct _glapi_table *disp) {
+ return (_glptr_Color4ub) (GET_by_offset(disp, _gloffset_Color4ub));
+}
+
+static INLINE void SET_Color4ub(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLubyte, GLubyte, GLubyte, GLubyte)) {
+ SET_by_offset(disp, _gloffset_Color4ub, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4ubv)(const GLubyte *);
+#define CALL_Color4ubv(disp, parameters) \
+ (* GET_Color4ubv(disp)) parameters
+static INLINE _glptr_Color4ubv GET_Color4ubv(struct _glapi_table *disp) {
+ return (_glptr_Color4ubv) (GET_by_offset(disp, _gloffset_Color4ubv));
+}
+
+static INLINE void SET_Color4ubv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_Color4ubv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4ui)(GLuint, GLuint, GLuint, GLuint);
+#define CALL_Color4ui(disp, parameters) \
+ (* GET_Color4ui(disp)) parameters
+static INLINE _glptr_Color4ui GET_Color4ui(struct _glapi_table *disp) {
+ return (_glptr_Color4ui) (GET_by_offset(disp, _gloffset_Color4ui));
+}
+
+static INLINE void SET_Color4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_Color4ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4uiv)(const GLuint *);
+#define CALL_Color4uiv(disp, parameters) \
+ (* GET_Color4uiv(disp)) parameters
+static INLINE _glptr_Color4uiv GET_Color4uiv(struct _glapi_table *disp) {
+ return (_glptr_Color4uiv) (GET_by_offset(disp, _gloffset_Color4uiv));
+}
+
+static INLINE void SET_Color4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLuint *)) {
+ SET_by_offset(disp, _gloffset_Color4uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4us)(GLushort, GLushort, GLushort, GLushort);
+#define CALL_Color4us(disp, parameters) \
+ (* GET_Color4us(disp)) parameters
+static INLINE _glptr_Color4us GET_Color4us(struct _glapi_table *disp) {
+ return (_glptr_Color4us) (GET_by_offset(disp, _gloffset_Color4us));
+}
+
+static INLINE void SET_Color4us(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLushort, GLushort, GLushort, GLushort)) {
+ SET_by_offset(disp, _gloffset_Color4us, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Color4usv)(const GLushort *);
+#define CALL_Color4usv(disp, parameters) \
+ (* GET_Color4usv(disp)) parameters
+static INLINE _glptr_Color4usv GET_Color4usv(struct _glapi_table *disp) {
+ return (_glptr_Color4usv) (GET_by_offset(disp, _gloffset_Color4usv));
+}
+
+static INLINE void SET_Color4usv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLushort *)) {
+ SET_by_offset(disp, _gloffset_Color4usv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EdgeFlag)(GLboolean);
+#define CALL_EdgeFlag(disp, parameters) \
+ (* GET_EdgeFlag(disp)) parameters
+static INLINE _glptr_EdgeFlag GET_EdgeFlag(struct _glapi_table *disp) {
+ return (_glptr_EdgeFlag) (GET_by_offset(disp, _gloffset_EdgeFlag));
+}
+
+static INLINE void SET_EdgeFlag(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLboolean)) {
+ SET_by_offset(disp, _gloffset_EdgeFlag, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EdgeFlagv)(const GLboolean *);
+#define CALL_EdgeFlagv(disp, parameters) \
+ (* GET_EdgeFlagv(disp)) parameters
+static INLINE _glptr_EdgeFlagv GET_EdgeFlagv(struct _glapi_table *disp) {
+ return (_glptr_EdgeFlagv) (GET_by_offset(disp, _gloffset_EdgeFlagv));
+}
+
+static INLINE void SET_EdgeFlagv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLboolean *)) {
+ SET_by_offset(disp, _gloffset_EdgeFlagv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_End)(void);
+#define CALL_End(disp, parameters) \
+ (* GET_End(disp)) parameters
+static INLINE _glptr_End GET_End(struct _glapi_table *disp) {
+ return (_glptr_End) (GET_by_offset(disp, _gloffset_End));
+}
+
+static INLINE void SET_End(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_End, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Indexd)(GLdouble);
+#define CALL_Indexd(disp, parameters) \
+ (* GET_Indexd(disp)) parameters
+static INLINE _glptr_Indexd GET_Indexd(struct _glapi_table *disp) {
+ return (_glptr_Indexd) (GET_by_offset(disp, _gloffset_Indexd));
+}
+
+static INLINE void SET_Indexd(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble)) {
+ SET_by_offset(disp, _gloffset_Indexd, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Indexdv)(const GLdouble *);
+#define CALL_Indexdv(disp, parameters) \
+ (* GET_Indexdv(disp)) parameters
+static INLINE _glptr_Indexdv GET_Indexdv(struct _glapi_table *disp) {
+ return (_glptr_Indexdv) (GET_by_offset(disp, _gloffset_Indexdv));
+}
+
+static INLINE void SET_Indexdv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_Indexdv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Indexf)(GLfloat);
+#define CALL_Indexf(disp, parameters) \
+ (* GET_Indexf(disp)) parameters
+static INLINE _glptr_Indexf GET_Indexf(struct _glapi_table *disp) {
+ return (_glptr_Indexf) (GET_by_offset(disp, _gloffset_Indexf));
+}
+
+static INLINE void SET_Indexf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
+ SET_by_offset(disp, _gloffset_Indexf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Indexfv)(const GLfloat *);
+#define CALL_Indexfv(disp, parameters) \
+ (* GET_Indexfv(disp)) parameters
+static INLINE _glptr_Indexfv GET_Indexfv(struct _glapi_table *disp) {
+ return (_glptr_Indexfv) (GET_by_offset(disp, _gloffset_Indexfv));
+}
+
+static INLINE void SET_Indexfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Indexfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Indexi)(GLint);
+#define CALL_Indexi(disp, parameters) \
+ (* GET_Indexi(disp)) parameters
+static INLINE _glptr_Indexi GET_Indexi(struct _glapi_table *disp) {
+ return (_glptr_Indexi) (GET_by_offset(disp, _gloffset_Indexi));
+}
+
+static INLINE void SET_Indexi(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint)) {
+ SET_by_offset(disp, _gloffset_Indexi, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Indexiv)(const GLint *);
+#define CALL_Indexiv(disp, parameters) \
+ (* GET_Indexiv(disp)) parameters
+static INLINE _glptr_Indexiv GET_Indexiv(struct _glapi_table *disp) {
+ return (_glptr_Indexiv) (GET_by_offset(disp, _gloffset_Indexiv));
+}
+
+static INLINE void SET_Indexiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_Indexiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Indexs)(GLshort);
+#define CALL_Indexs(disp, parameters) \
+ (* GET_Indexs(disp)) parameters
+static INLINE _glptr_Indexs GET_Indexs(struct _glapi_table *disp) {
+ return (_glptr_Indexs) (GET_by_offset(disp, _gloffset_Indexs));
+}
+
+static INLINE void SET_Indexs(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort)) {
+ SET_by_offset(disp, _gloffset_Indexs, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Indexsv)(const GLshort *);
+#define CALL_Indexsv(disp, parameters) \
+ (* GET_Indexsv(disp)) parameters
+static INLINE _glptr_Indexsv GET_Indexsv(struct _glapi_table *disp) {
+ return (_glptr_Indexsv) (GET_by_offset(disp, _gloffset_Indexsv));
+}
+
+static INLINE void SET_Indexsv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_Indexsv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Normal3b)(GLbyte, GLbyte, GLbyte);
+#define CALL_Normal3b(disp, parameters) \
+ (* GET_Normal3b(disp)) parameters
+static INLINE _glptr_Normal3b GET_Normal3b(struct _glapi_table *disp) {
+ return (_glptr_Normal3b) (GET_by_offset(disp, _gloffset_Normal3b));
+}
+
+static INLINE void SET_Normal3b(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbyte, GLbyte, GLbyte)) {
+ SET_by_offset(disp, _gloffset_Normal3b, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Normal3bv)(const GLbyte *);
+#define CALL_Normal3bv(disp, parameters) \
+ (* GET_Normal3bv(disp)) parameters
+static INLINE _glptr_Normal3bv GET_Normal3bv(struct _glapi_table *disp) {
+ return (_glptr_Normal3bv) (GET_by_offset(disp, _gloffset_Normal3bv));
+}
+
+static INLINE void SET_Normal3bv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLbyte *)) {
+ SET_by_offset(disp, _gloffset_Normal3bv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Normal3d)(GLdouble, GLdouble, GLdouble);
+#define CALL_Normal3d(disp, parameters) \
+ (* GET_Normal3d(disp)) parameters
+static INLINE _glptr_Normal3d GET_Normal3d(struct _glapi_table *disp) {
+ return (_glptr_Normal3d) (GET_by_offset(disp, _gloffset_Normal3d));
+}
+
+static INLINE void SET_Normal3d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Normal3d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Normal3dv)(const GLdouble *);
+#define CALL_Normal3dv(disp, parameters) \
+ (* GET_Normal3dv(disp)) parameters
+static INLINE _glptr_Normal3dv GET_Normal3dv(struct _glapi_table *disp) {
+ return (_glptr_Normal3dv) (GET_by_offset(disp, _gloffset_Normal3dv));
+}
+
+static INLINE void SET_Normal3dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_Normal3dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Normal3f)(GLfloat, GLfloat, GLfloat);
+#define CALL_Normal3f(disp, parameters) \
+ (* GET_Normal3f(disp)) parameters
+static INLINE _glptr_Normal3f GET_Normal3f(struct _glapi_table *disp) {
+ return (_glptr_Normal3f) (GET_by_offset(disp, _gloffset_Normal3f));
+}
+
+static INLINE void SET_Normal3f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Normal3f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Normal3fv)(const GLfloat *);
+#define CALL_Normal3fv(disp, parameters) \
+ (* GET_Normal3fv(disp)) parameters
+static INLINE _glptr_Normal3fv GET_Normal3fv(struct _glapi_table *disp) {
+ return (_glptr_Normal3fv) (GET_by_offset(disp, _gloffset_Normal3fv));
+}
+
+static INLINE void SET_Normal3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Normal3fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Normal3i)(GLint, GLint, GLint);
+#define CALL_Normal3i(disp, parameters) \
+ (* GET_Normal3i(disp)) parameters
+static INLINE _glptr_Normal3i GET_Normal3i(struct _glapi_table *disp) {
+ return (_glptr_Normal3i) (GET_by_offset(disp, _gloffset_Normal3i));
+}
+
+static INLINE void SET_Normal3i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Normal3i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Normal3iv)(const GLint *);
+#define CALL_Normal3iv(disp, parameters) \
+ (* GET_Normal3iv(disp)) parameters
+static INLINE _glptr_Normal3iv GET_Normal3iv(struct _glapi_table *disp) {
+ return (_glptr_Normal3iv) (GET_by_offset(disp, _gloffset_Normal3iv));
+}
+
+static INLINE void SET_Normal3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_Normal3iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Normal3s)(GLshort, GLshort, GLshort);
+#define CALL_Normal3s(disp, parameters) \
+ (* GET_Normal3s(disp)) parameters
+static INLINE _glptr_Normal3s GET_Normal3s(struct _glapi_table *disp) {
+ return (_glptr_Normal3s) (GET_by_offset(disp, _gloffset_Normal3s));
+}
+
+static INLINE void SET_Normal3s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_Normal3s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Normal3sv)(const GLshort *);
+#define CALL_Normal3sv(disp, parameters) \
+ (* GET_Normal3sv(disp)) parameters
+static INLINE _glptr_Normal3sv GET_Normal3sv(struct _glapi_table *disp) {
+ return (_glptr_Normal3sv) (GET_by_offset(disp, _gloffset_Normal3sv));
+}
+
+static INLINE void SET_Normal3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_Normal3sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos2d)(GLdouble, GLdouble);
+#define CALL_RasterPos2d(disp, parameters) \
+ (* GET_RasterPos2d(disp)) parameters
+static INLINE _glptr_RasterPos2d GET_RasterPos2d(struct _glapi_table *disp) {
+ return (_glptr_RasterPos2d) (GET_by_offset(disp, _gloffset_RasterPos2d));
+}
+
+static INLINE void SET_RasterPos2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_RasterPos2d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos2dv)(const GLdouble *);
+#define CALL_RasterPos2dv(disp, parameters) \
+ (* GET_RasterPos2dv(disp)) parameters
+static INLINE _glptr_RasterPos2dv GET_RasterPos2dv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos2dv) (GET_by_offset(disp, _gloffset_RasterPos2dv));
+}
+
+static INLINE void SET_RasterPos2dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_RasterPos2dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos2f)(GLfloat, GLfloat);
+#define CALL_RasterPos2f(disp, parameters) \
+ (* GET_RasterPos2f(disp)) parameters
+static INLINE _glptr_RasterPos2f GET_RasterPos2f(struct _glapi_table *disp) {
+ return (_glptr_RasterPos2f) (GET_by_offset(disp, _gloffset_RasterPos2f));
+}
+
+static INLINE void SET_RasterPos2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_RasterPos2f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos2fv)(const GLfloat *);
+#define CALL_RasterPos2fv(disp, parameters) \
+ (* GET_RasterPos2fv(disp)) parameters
+static INLINE _glptr_RasterPos2fv GET_RasterPos2fv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos2fv) (GET_by_offset(disp, _gloffset_RasterPos2fv));
+}
+
+static INLINE void SET_RasterPos2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_RasterPos2fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos2i)(GLint, GLint);
+#define CALL_RasterPos2i(disp, parameters) \
+ (* GET_RasterPos2i(disp)) parameters
+static INLINE _glptr_RasterPos2i GET_RasterPos2i(struct _glapi_table *disp) {
+ return (_glptr_RasterPos2i) (GET_by_offset(disp, _gloffset_RasterPos2i));
+}
+
+static INLINE void SET_RasterPos2i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_RasterPos2i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos2iv)(const GLint *);
+#define CALL_RasterPos2iv(disp, parameters) \
+ (* GET_RasterPos2iv(disp)) parameters
+static INLINE _glptr_RasterPos2iv GET_RasterPos2iv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos2iv) (GET_by_offset(disp, _gloffset_RasterPos2iv));
+}
+
+static INLINE void SET_RasterPos2iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_RasterPos2iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos2s)(GLshort, GLshort);
+#define CALL_RasterPos2s(disp, parameters) \
+ (* GET_RasterPos2s(disp)) parameters
+static INLINE _glptr_RasterPos2s GET_RasterPos2s(struct _glapi_table *disp) {
+ return (_glptr_RasterPos2s) (GET_by_offset(disp, _gloffset_RasterPos2s));
+}
+
+static INLINE void SET_RasterPos2s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_RasterPos2s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos2sv)(const GLshort *);
+#define CALL_RasterPos2sv(disp, parameters) \
+ (* GET_RasterPos2sv(disp)) parameters
+static INLINE _glptr_RasterPos2sv GET_RasterPos2sv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos2sv) (GET_by_offset(disp, _gloffset_RasterPos2sv));
+}
+
+static INLINE void SET_RasterPos2sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_RasterPos2sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos3d)(GLdouble, GLdouble, GLdouble);
+#define CALL_RasterPos3d(disp, parameters) \
+ (* GET_RasterPos3d(disp)) parameters
+static INLINE _glptr_RasterPos3d GET_RasterPos3d(struct _glapi_table *disp) {
+ return (_glptr_RasterPos3d) (GET_by_offset(disp, _gloffset_RasterPos3d));
+}
+
+static INLINE void SET_RasterPos3d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_RasterPos3d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos3dv)(const GLdouble *);
+#define CALL_RasterPos3dv(disp, parameters) \
+ (* GET_RasterPos3dv(disp)) parameters
+static INLINE _glptr_RasterPos3dv GET_RasterPos3dv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos3dv) (GET_by_offset(disp, _gloffset_RasterPos3dv));
+}
+
+static INLINE void SET_RasterPos3dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_RasterPos3dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos3f)(GLfloat, GLfloat, GLfloat);
+#define CALL_RasterPos3f(disp, parameters) \
+ (* GET_RasterPos3f(disp)) parameters
+static INLINE _glptr_RasterPos3f GET_RasterPos3f(struct _glapi_table *disp) {
+ return (_glptr_RasterPos3f) (GET_by_offset(disp, _gloffset_RasterPos3f));
+}
+
+static INLINE void SET_RasterPos3f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_RasterPos3f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos3fv)(const GLfloat *);
+#define CALL_RasterPos3fv(disp, parameters) \
+ (* GET_RasterPos3fv(disp)) parameters
+static INLINE _glptr_RasterPos3fv GET_RasterPos3fv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos3fv) (GET_by_offset(disp, _gloffset_RasterPos3fv));
+}
+
+static INLINE void SET_RasterPos3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_RasterPos3fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos3i)(GLint, GLint, GLint);
+#define CALL_RasterPos3i(disp, parameters) \
+ (* GET_RasterPos3i(disp)) parameters
+static INLINE _glptr_RasterPos3i GET_RasterPos3i(struct _glapi_table *disp) {
+ return (_glptr_RasterPos3i) (GET_by_offset(disp, _gloffset_RasterPos3i));
+}
+
+static INLINE void SET_RasterPos3i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_RasterPos3i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos3iv)(const GLint *);
+#define CALL_RasterPos3iv(disp, parameters) \
+ (* GET_RasterPos3iv(disp)) parameters
+static INLINE _glptr_RasterPos3iv GET_RasterPos3iv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos3iv) (GET_by_offset(disp, _gloffset_RasterPos3iv));
+}
+
+static INLINE void SET_RasterPos3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_RasterPos3iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos3s)(GLshort, GLshort, GLshort);
+#define CALL_RasterPos3s(disp, parameters) \
+ (* GET_RasterPos3s(disp)) parameters
+static INLINE _glptr_RasterPos3s GET_RasterPos3s(struct _glapi_table *disp) {
+ return (_glptr_RasterPos3s) (GET_by_offset(disp, _gloffset_RasterPos3s));
+}
+
+static INLINE void SET_RasterPos3s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_RasterPos3s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos3sv)(const GLshort *);
+#define CALL_RasterPos3sv(disp, parameters) \
+ (* GET_RasterPos3sv(disp)) parameters
+static INLINE _glptr_RasterPos3sv GET_RasterPos3sv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos3sv) (GET_by_offset(disp, _gloffset_RasterPos3sv));
+}
+
+static INLINE void SET_RasterPos3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_RasterPos3sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_RasterPos4d(disp, parameters) \
+ (* GET_RasterPos4d(disp)) parameters
+static INLINE _glptr_RasterPos4d GET_RasterPos4d(struct _glapi_table *disp) {
+ return (_glptr_RasterPos4d) (GET_by_offset(disp, _gloffset_RasterPos4d));
+}
+
+static INLINE void SET_RasterPos4d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_RasterPos4d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos4dv)(const GLdouble *);
+#define CALL_RasterPos4dv(disp, parameters) \
+ (* GET_RasterPos4dv(disp)) parameters
+static INLINE _glptr_RasterPos4dv GET_RasterPos4dv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos4dv) (GET_by_offset(disp, _gloffset_RasterPos4dv));
+}
+
+static INLINE void SET_RasterPos4dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_RasterPos4dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos4f)(GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_RasterPos4f(disp, parameters) \
+ (* GET_RasterPos4f(disp)) parameters
+static INLINE _glptr_RasterPos4f GET_RasterPos4f(struct _glapi_table *disp) {
+ return (_glptr_RasterPos4f) (GET_by_offset(disp, _gloffset_RasterPos4f));
+}
+
+static INLINE void SET_RasterPos4f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_RasterPos4f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos4fv)(const GLfloat *);
+#define CALL_RasterPos4fv(disp, parameters) \
+ (* GET_RasterPos4fv(disp)) parameters
+static INLINE _glptr_RasterPos4fv GET_RasterPos4fv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos4fv) (GET_by_offset(disp, _gloffset_RasterPos4fv));
+}
+
+static INLINE void SET_RasterPos4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_RasterPos4fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos4i)(GLint, GLint, GLint, GLint);
+#define CALL_RasterPos4i(disp, parameters) \
+ (* GET_RasterPos4i(disp)) parameters
+static INLINE _glptr_RasterPos4i GET_RasterPos4i(struct _glapi_table *disp) {
+ return (_glptr_RasterPos4i) (GET_by_offset(disp, _gloffset_RasterPos4i));
+}
+
+static INLINE void SET_RasterPos4i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_RasterPos4i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos4iv)(const GLint *);
+#define CALL_RasterPos4iv(disp, parameters) \
+ (* GET_RasterPos4iv(disp)) parameters
+static INLINE _glptr_RasterPos4iv GET_RasterPos4iv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos4iv) (GET_by_offset(disp, _gloffset_RasterPos4iv));
+}
+
+static INLINE void SET_RasterPos4iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_RasterPos4iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos4s)(GLshort, GLshort, GLshort, GLshort);
+#define CALL_RasterPos4s(disp, parameters) \
+ (* GET_RasterPos4s(disp)) parameters
+static INLINE _glptr_RasterPos4s GET_RasterPos4s(struct _glapi_table *disp) {
+ return (_glptr_RasterPos4s) (GET_by_offset(disp, _gloffset_RasterPos4s));
+}
+
+static INLINE void SET_RasterPos4s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_RasterPos4s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RasterPos4sv)(const GLshort *);
+#define CALL_RasterPos4sv(disp, parameters) \
+ (* GET_RasterPos4sv(disp)) parameters
+static INLINE _glptr_RasterPos4sv GET_RasterPos4sv(struct _glapi_table *disp) {
+ return (_glptr_RasterPos4sv) (GET_by_offset(disp, _gloffset_RasterPos4sv));
+}
+
+static INLINE void SET_RasterPos4sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_RasterPos4sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Rectd)(GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_Rectd(disp, parameters) \
+ (* GET_Rectd(disp)) parameters
+static INLINE _glptr_Rectd GET_Rectd(struct _glapi_table *disp) {
+ return (_glptr_Rectd) (GET_by_offset(disp, _gloffset_Rectd));
+}
+
+static INLINE void SET_Rectd(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Rectd, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Rectdv)(const GLdouble *, const GLdouble *);
+#define CALL_Rectdv(disp, parameters) \
+ (* GET_Rectdv(disp)) parameters
+static INLINE _glptr_Rectdv GET_Rectdv(struct _glapi_table *disp) {
+ return (_glptr_Rectdv) (GET_by_offset(disp, _gloffset_Rectdv));
+}
+
+static INLINE void SET_Rectdv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_Rectdv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Rectf)(GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_Rectf(disp, parameters) \
+ (* GET_Rectf(disp)) parameters
+static INLINE _glptr_Rectf GET_Rectf(struct _glapi_table *disp) {
+ return (_glptr_Rectf) (GET_by_offset(disp, _gloffset_Rectf));
+}
+
+static INLINE void SET_Rectf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Rectf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Rectfv)(const GLfloat *, const GLfloat *);
+#define CALL_Rectfv(disp, parameters) \
+ (* GET_Rectfv(disp)) parameters
+static INLINE _glptr_Rectfv GET_Rectfv(struct _glapi_table *disp) {
+ return (_glptr_Rectfv) (GET_by_offset(disp, _gloffset_Rectfv));
+}
+
+static INLINE void SET_Rectfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Rectfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Recti)(GLint, GLint, GLint, GLint);
+#define CALL_Recti(disp, parameters) \
+ (* GET_Recti(disp)) parameters
+static INLINE _glptr_Recti GET_Recti(struct _glapi_table *disp) {
+ return (_glptr_Recti) (GET_by_offset(disp, _gloffset_Recti));
+}
+
+static INLINE void SET_Recti(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Recti, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Rectiv)(const GLint *, const GLint *);
+#define CALL_Rectiv(disp, parameters) \
+ (* GET_Rectiv(disp)) parameters
+static INLINE _glptr_Rectiv GET_Rectiv(struct _glapi_table *disp) {
+ return (_glptr_Rectiv) (GET_by_offset(disp, _gloffset_Rectiv));
+}
+
+static INLINE void SET_Rectiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *, const GLint *)) {
+ SET_by_offset(disp, _gloffset_Rectiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Rects)(GLshort, GLshort, GLshort, GLshort);
+#define CALL_Rects(disp, parameters) \
+ (* GET_Rects(disp)) parameters
+static INLINE _glptr_Rects GET_Rects(struct _glapi_table *disp) {
+ return (_glptr_Rects) (GET_by_offset(disp, _gloffset_Rects));
+}
+
+static INLINE void SET_Rects(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_Rects, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Rectsv)(const GLshort *, const GLshort *);
+#define CALL_Rectsv(disp, parameters) \
+ (* GET_Rectsv(disp)) parameters
+static INLINE _glptr_Rectsv GET_Rectsv(struct _glapi_table *disp) {
+ return (_glptr_Rectsv) (GET_by_offset(disp, _gloffset_Rectsv));
+}
+
+static INLINE void SET_Rectsv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_Rectsv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord1d)(GLdouble);
+#define CALL_TexCoord1d(disp, parameters) \
+ (* GET_TexCoord1d(disp)) parameters
+static INLINE _glptr_TexCoord1d GET_TexCoord1d(struct _glapi_table *disp) {
+ return (_glptr_TexCoord1d) (GET_by_offset(disp, _gloffset_TexCoord1d));
+}
+
+static INLINE void SET_TexCoord1d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble)) {
+ SET_by_offset(disp, _gloffset_TexCoord1d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord1dv)(const GLdouble *);
+#define CALL_TexCoord1dv(disp, parameters) \
+ (* GET_TexCoord1dv(disp)) parameters
+static INLINE _glptr_TexCoord1dv GET_TexCoord1dv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord1dv) (GET_by_offset(disp, _gloffset_TexCoord1dv));
+}
+
+static INLINE void SET_TexCoord1dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_TexCoord1dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord1f)(GLfloat);
+#define CALL_TexCoord1f(disp, parameters) \
+ (* GET_TexCoord1f(disp)) parameters
+static INLINE _glptr_TexCoord1f GET_TexCoord1f(struct _glapi_table *disp) {
+ return (_glptr_TexCoord1f) (GET_by_offset(disp, _gloffset_TexCoord1f));
+}
+
+static INLINE void SET_TexCoord1f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
+ SET_by_offset(disp, _gloffset_TexCoord1f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord1fv)(const GLfloat *);
+#define CALL_TexCoord1fv(disp, parameters) \
+ (* GET_TexCoord1fv(disp)) parameters
+static INLINE _glptr_TexCoord1fv GET_TexCoord1fv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord1fv) (GET_by_offset(disp, _gloffset_TexCoord1fv));
+}
+
+static INLINE void SET_TexCoord1fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_TexCoord1fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord1i)(GLint);
+#define CALL_TexCoord1i(disp, parameters) \
+ (* GET_TexCoord1i(disp)) parameters
+static INLINE _glptr_TexCoord1i GET_TexCoord1i(struct _glapi_table *disp) {
+ return (_glptr_TexCoord1i) (GET_by_offset(disp, _gloffset_TexCoord1i));
+}
+
+static INLINE void SET_TexCoord1i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint)) {
+ SET_by_offset(disp, _gloffset_TexCoord1i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord1iv)(const GLint *);
+#define CALL_TexCoord1iv(disp, parameters) \
+ (* GET_TexCoord1iv(disp)) parameters
+static INLINE _glptr_TexCoord1iv GET_TexCoord1iv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord1iv) (GET_by_offset(disp, _gloffset_TexCoord1iv));
+}
+
+static INLINE void SET_TexCoord1iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_TexCoord1iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord1s)(GLshort);
+#define CALL_TexCoord1s(disp, parameters) \
+ (* GET_TexCoord1s(disp)) parameters
+static INLINE _glptr_TexCoord1s GET_TexCoord1s(struct _glapi_table *disp) {
+ return (_glptr_TexCoord1s) (GET_by_offset(disp, _gloffset_TexCoord1s));
+}
+
+static INLINE void SET_TexCoord1s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort)) {
+ SET_by_offset(disp, _gloffset_TexCoord1s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord1sv)(const GLshort *);
+#define CALL_TexCoord1sv(disp, parameters) \
+ (* GET_TexCoord1sv(disp)) parameters
+static INLINE _glptr_TexCoord1sv GET_TexCoord1sv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord1sv) (GET_by_offset(disp, _gloffset_TexCoord1sv));
+}
+
+static INLINE void SET_TexCoord1sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_TexCoord1sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord2d)(GLdouble, GLdouble);
+#define CALL_TexCoord2d(disp, parameters) \
+ (* GET_TexCoord2d(disp)) parameters
+static INLINE _glptr_TexCoord2d GET_TexCoord2d(struct _glapi_table *disp) {
+ return (_glptr_TexCoord2d) (GET_by_offset(disp, _gloffset_TexCoord2d));
+}
+
+static INLINE void SET_TexCoord2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_TexCoord2d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord2dv)(const GLdouble *);
+#define CALL_TexCoord2dv(disp, parameters) \
+ (* GET_TexCoord2dv(disp)) parameters
+static INLINE _glptr_TexCoord2dv GET_TexCoord2dv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord2dv) (GET_by_offset(disp, _gloffset_TexCoord2dv));
+}
+
+static INLINE void SET_TexCoord2dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_TexCoord2dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord2f)(GLfloat, GLfloat);
+#define CALL_TexCoord2f(disp, parameters) \
+ (* GET_TexCoord2f(disp)) parameters
+static INLINE _glptr_TexCoord2f GET_TexCoord2f(struct _glapi_table *disp) {
+ return (_glptr_TexCoord2f) (GET_by_offset(disp, _gloffset_TexCoord2f));
+}
+
+static INLINE void SET_TexCoord2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_TexCoord2f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord2fv)(const GLfloat *);
+#define CALL_TexCoord2fv(disp, parameters) \
+ (* GET_TexCoord2fv(disp)) parameters
+static INLINE _glptr_TexCoord2fv GET_TexCoord2fv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord2fv) (GET_by_offset(disp, _gloffset_TexCoord2fv));
+}
+
+static INLINE void SET_TexCoord2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_TexCoord2fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord2i)(GLint, GLint);
+#define CALL_TexCoord2i(disp, parameters) \
+ (* GET_TexCoord2i(disp)) parameters
+static INLINE _glptr_TexCoord2i GET_TexCoord2i(struct _glapi_table *disp) {
+ return (_glptr_TexCoord2i) (GET_by_offset(disp, _gloffset_TexCoord2i));
+}
+
+static INLINE void SET_TexCoord2i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_TexCoord2i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord2iv)(const GLint *);
+#define CALL_TexCoord2iv(disp, parameters) \
+ (* GET_TexCoord2iv(disp)) parameters
+static INLINE _glptr_TexCoord2iv GET_TexCoord2iv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord2iv) (GET_by_offset(disp, _gloffset_TexCoord2iv));
+}
+
+static INLINE void SET_TexCoord2iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_TexCoord2iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord2s)(GLshort, GLshort);
+#define CALL_TexCoord2s(disp, parameters) \
+ (* GET_TexCoord2s(disp)) parameters
+static INLINE _glptr_TexCoord2s GET_TexCoord2s(struct _glapi_table *disp) {
+ return (_glptr_TexCoord2s) (GET_by_offset(disp, _gloffset_TexCoord2s));
+}
+
+static INLINE void SET_TexCoord2s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_TexCoord2s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord2sv)(const GLshort *);
+#define CALL_TexCoord2sv(disp, parameters) \
+ (* GET_TexCoord2sv(disp)) parameters
+static INLINE _glptr_TexCoord2sv GET_TexCoord2sv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord2sv) (GET_by_offset(disp, _gloffset_TexCoord2sv));
+}
+
+static INLINE void SET_TexCoord2sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_TexCoord2sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord3d)(GLdouble, GLdouble, GLdouble);
+#define CALL_TexCoord3d(disp, parameters) \
+ (* GET_TexCoord3d(disp)) parameters
+static INLINE _glptr_TexCoord3d GET_TexCoord3d(struct _glapi_table *disp) {
+ return (_glptr_TexCoord3d) (GET_by_offset(disp, _gloffset_TexCoord3d));
+}
+
+static INLINE void SET_TexCoord3d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_TexCoord3d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord3dv)(const GLdouble *);
+#define CALL_TexCoord3dv(disp, parameters) \
+ (* GET_TexCoord3dv(disp)) parameters
+static INLINE _glptr_TexCoord3dv GET_TexCoord3dv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord3dv) (GET_by_offset(disp, _gloffset_TexCoord3dv));
+}
+
+static INLINE void SET_TexCoord3dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_TexCoord3dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord3f)(GLfloat, GLfloat, GLfloat);
+#define CALL_TexCoord3f(disp, parameters) \
+ (* GET_TexCoord3f(disp)) parameters
+static INLINE _glptr_TexCoord3f GET_TexCoord3f(struct _glapi_table *disp) {
+ return (_glptr_TexCoord3f) (GET_by_offset(disp, _gloffset_TexCoord3f));
+}
+
+static INLINE void SET_TexCoord3f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_TexCoord3f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord3fv)(const GLfloat *);
+#define CALL_TexCoord3fv(disp, parameters) \
+ (* GET_TexCoord3fv(disp)) parameters
+static INLINE _glptr_TexCoord3fv GET_TexCoord3fv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord3fv) (GET_by_offset(disp, _gloffset_TexCoord3fv));
+}
+
+static INLINE void SET_TexCoord3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_TexCoord3fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord3i)(GLint, GLint, GLint);
+#define CALL_TexCoord3i(disp, parameters) \
+ (* GET_TexCoord3i(disp)) parameters
+static INLINE _glptr_TexCoord3i GET_TexCoord3i(struct _glapi_table *disp) {
+ return (_glptr_TexCoord3i) (GET_by_offset(disp, _gloffset_TexCoord3i));
+}
+
+static INLINE void SET_TexCoord3i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_TexCoord3i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord3iv)(const GLint *);
+#define CALL_TexCoord3iv(disp, parameters) \
+ (* GET_TexCoord3iv(disp)) parameters
+static INLINE _glptr_TexCoord3iv GET_TexCoord3iv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord3iv) (GET_by_offset(disp, _gloffset_TexCoord3iv));
+}
+
+static INLINE void SET_TexCoord3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_TexCoord3iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord3s)(GLshort, GLshort, GLshort);
+#define CALL_TexCoord3s(disp, parameters) \
+ (* GET_TexCoord3s(disp)) parameters
+static INLINE _glptr_TexCoord3s GET_TexCoord3s(struct _glapi_table *disp) {
+ return (_glptr_TexCoord3s) (GET_by_offset(disp, _gloffset_TexCoord3s));
+}
+
+static INLINE void SET_TexCoord3s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_TexCoord3s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord3sv)(const GLshort *);
+#define CALL_TexCoord3sv(disp, parameters) \
+ (* GET_TexCoord3sv(disp)) parameters
+static INLINE _glptr_TexCoord3sv GET_TexCoord3sv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord3sv) (GET_by_offset(disp, _gloffset_TexCoord3sv));
+}
+
+static INLINE void SET_TexCoord3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_TexCoord3sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord4d)(GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_TexCoord4d(disp, parameters) \
+ (* GET_TexCoord4d(disp)) parameters
+static INLINE _glptr_TexCoord4d GET_TexCoord4d(struct _glapi_table *disp) {
+ return (_glptr_TexCoord4d) (GET_by_offset(disp, _gloffset_TexCoord4d));
+}
+
+static INLINE void SET_TexCoord4d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_TexCoord4d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord4dv)(const GLdouble *);
+#define CALL_TexCoord4dv(disp, parameters) \
+ (* GET_TexCoord4dv(disp)) parameters
+static INLINE _glptr_TexCoord4dv GET_TexCoord4dv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord4dv) (GET_by_offset(disp, _gloffset_TexCoord4dv));
+}
+
+static INLINE void SET_TexCoord4dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_TexCoord4dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord4f)(GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_TexCoord4f(disp, parameters) \
+ (* GET_TexCoord4f(disp)) parameters
+static INLINE _glptr_TexCoord4f GET_TexCoord4f(struct _glapi_table *disp) {
+ return (_glptr_TexCoord4f) (GET_by_offset(disp, _gloffset_TexCoord4f));
+}
+
+static INLINE void SET_TexCoord4f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_TexCoord4f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord4fv)(const GLfloat *);
+#define CALL_TexCoord4fv(disp, parameters) \
+ (* GET_TexCoord4fv(disp)) parameters
+static INLINE _glptr_TexCoord4fv GET_TexCoord4fv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord4fv) (GET_by_offset(disp, _gloffset_TexCoord4fv));
+}
+
+static INLINE void SET_TexCoord4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_TexCoord4fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord4i)(GLint, GLint, GLint, GLint);
+#define CALL_TexCoord4i(disp, parameters) \
+ (* GET_TexCoord4i(disp)) parameters
+static INLINE _glptr_TexCoord4i GET_TexCoord4i(struct _glapi_table *disp) {
+ return (_glptr_TexCoord4i) (GET_by_offset(disp, _gloffset_TexCoord4i));
+}
+
+static INLINE void SET_TexCoord4i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_TexCoord4i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord4iv)(const GLint *);
+#define CALL_TexCoord4iv(disp, parameters) \
+ (* GET_TexCoord4iv(disp)) parameters
+static INLINE _glptr_TexCoord4iv GET_TexCoord4iv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord4iv) (GET_by_offset(disp, _gloffset_TexCoord4iv));
+}
+
+static INLINE void SET_TexCoord4iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_TexCoord4iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord4s)(GLshort, GLshort, GLshort, GLshort);
+#define CALL_TexCoord4s(disp, parameters) \
+ (* GET_TexCoord4s(disp)) parameters
+static INLINE _glptr_TexCoord4s GET_TexCoord4s(struct _glapi_table *disp) {
+ return (_glptr_TexCoord4s) (GET_by_offset(disp, _gloffset_TexCoord4s));
+}
+
+static INLINE void SET_TexCoord4s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_TexCoord4s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoord4sv)(const GLshort *);
+#define CALL_TexCoord4sv(disp, parameters) \
+ (* GET_TexCoord4sv(disp)) parameters
+static INLINE _glptr_TexCoord4sv GET_TexCoord4sv(struct _glapi_table *disp) {
+ return (_glptr_TexCoord4sv) (GET_by_offset(disp, _gloffset_TexCoord4sv));
+}
+
+static INLINE void SET_TexCoord4sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_TexCoord4sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex2d)(GLdouble, GLdouble);
+#define CALL_Vertex2d(disp, parameters) \
+ (* GET_Vertex2d(disp)) parameters
+static INLINE _glptr_Vertex2d GET_Vertex2d(struct _glapi_table *disp) {
+ return (_glptr_Vertex2d) (GET_by_offset(disp, _gloffset_Vertex2d));
+}
+
+static INLINE void SET_Vertex2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Vertex2d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex2dv)(const GLdouble *);
+#define CALL_Vertex2dv(disp, parameters) \
+ (* GET_Vertex2dv(disp)) parameters
+static INLINE _glptr_Vertex2dv GET_Vertex2dv(struct _glapi_table *disp) {
+ return (_glptr_Vertex2dv) (GET_by_offset(disp, _gloffset_Vertex2dv));
+}
+
+static INLINE void SET_Vertex2dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_Vertex2dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex2f)(GLfloat, GLfloat);
+#define CALL_Vertex2f(disp, parameters) \
+ (* GET_Vertex2f(disp)) parameters
+static INLINE _glptr_Vertex2f GET_Vertex2f(struct _glapi_table *disp) {
+ return (_glptr_Vertex2f) (GET_by_offset(disp, _gloffset_Vertex2f));
+}
+
+static INLINE void SET_Vertex2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Vertex2f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex2fv)(const GLfloat *);
+#define CALL_Vertex2fv(disp, parameters) \
+ (* GET_Vertex2fv(disp)) parameters
+static INLINE _glptr_Vertex2fv GET_Vertex2fv(struct _glapi_table *disp) {
+ return (_glptr_Vertex2fv) (GET_by_offset(disp, _gloffset_Vertex2fv));
+}
+
+static INLINE void SET_Vertex2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Vertex2fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex2i)(GLint, GLint);
+#define CALL_Vertex2i(disp, parameters) \
+ (* GET_Vertex2i(disp)) parameters
+static INLINE _glptr_Vertex2i GET_Vertex2i(struct _glapi_table *disp) {
+ return (_glptr_Vertex2i) (GET_by_offset(disp, _gloffset_Vertex2i));
+}
+
+static INLINE void SET_Vertex2i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Vertex2i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex2iv)(const GLint *);
+#define CALL_Vertex2iv(disp, parameters) \
+ (* GET_Vertex2iv(disp)) parameters
+static INLINE _glptr_Vertex2iv GET_Vertex2iv(struct _glapi_table *disp) {
+ return (_glptr_Vertex2iv) (GET_by_offset(disp, _gloffset_Vertex2iv));
+}
+
+static INLINE void SET_Vertex2iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_Vertex2iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex2s)(GLshort, GLshort);
+#define CALL_Vertex2s(disp, parameters) \
+ (* GET_Vertex2s(disp)) parameters
+static INLINE _glptr_Vertex2s GET_Vertex2s(struct _glapi_table *disp) {
+ return (_glptr_Vertex2s) (GET_by_offset(disp, _gloffset_Vertex2s));
+}
+
+static INLINE void SET_Vertex2s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_Vertex2s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex2sv)(const GLshort *);
+#define CALL_Vertex2sv(disp, parameters) \
+ (* GET_Vertex2sv(disp)) parameters
+static INLINE _glptr_Vertex2sv GET_Vertex2sv(struct _glapi_table *disp) {
+ return (_glptr_Vertex2sv) (GET_by_offset(disp, _gloffset_Vertex2sv));
+}
+
+static INLINE void SET_Vertex2sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_Vertex2sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex3d)(GLdouble, GLdouble, GLdouble);
+#define CALL_Vertex3d(disp, parameters) \
+ (* GET_Vertex3d(disp)) parameters
+static INLINE _glptr_Vertex3d GET_Vertex3d(struct _glapi_table *disp) {
+ return (_glptr_Vertex3d) (GET_by_offset(disp, _gloffset_Vertex3d));
+}
+
+static INLINE void SET_Vertex3d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Vertex3d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex3dv)(const GLdouble *);
+#define CALL_Vertex3dv(disp, parameters) \
+ (* GET_Vertex3dv(disp)) parameters
+static INLINE _glptr_Vertex3dv GET_Vertex3dv(struct _glapi_table *disp) {
+ return (_glptr_Vertex3dv) (GET_by_offset(disp, _gloffset_Vertex3dv));
+}
+
+static INLINE void SET_Vertex3dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_Vertex3dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex3f)(GLfloat, GLfloat, GLfloat);
+#define CALL_Vertex3f(disp, parameters) \
+ (* GET_Vertex3f(disp)) parameters
+static INLINE _glptr_Vertex3f GET_Vertex3f(struct _glapi_table *disp) {
+ return (_glptr_Vertex3f) (GET_by_offset(disp, _gloffset_Vertex3f));
+}
+
+static INLINE void SET_Vertex3f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Vertex3f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex3fv)(const GLfloat *);
+#define CALL_Vertex3fv(disp, parameters) \
+ (* GET_Vertex3fv(disp)) parameters
+static INLINE _glptr_Vertex3fv GET_Vertex3fv(struct _glapi_table *disp) {
+ return (_glptr_Vertex3fv) (GET_by_offset(disp, _gloffset_Vertex3fv));
+}
+
+static INLINE void SET_Vertex3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Vertex3fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex3i)(GLint, GLint, GLint);
+#define CALL_Vertex3i(disp, parameters) \
+ (* GET_Vertex3i(disp)) parameters
+static INLINE _glptr_Vertex3i GET_Vertex3i(struct _glapi_table *disp) {
+ return (_glptr_Vertex3i) (GET_by_offset(disp, _gloffset_Vertex3i));
+}
+
+static INLINE void SET_Vertex3i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Vertex3i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex3iv)(const GLint *);
+#define CALL_Vertex3iv(disp, parameters) \
+ (* GET_Vertex3iv(disp)) parameters
+static INLINE _glptr_Vertex3iv GET_Vertex3iv(struct _glapi_table *disp) {
+ return (_glptr_Vertex3iv) (GET_by_offset(disp, _gloffset_Vertex3iv));
+}
+
+static INLINE void SET_Vertex3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_Vertex3iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex3s)(GLshort, GLshort, GLshort);
+#define CALL_Vertex3s(disp, parameters) \
+ (* GET_Vertex3s(disp)) parameters
+static INLINE _glptr_Vertex3s GET_Vertex3s(struct _glapi_table *disp) {
+ return (_glptr_Vertex3s) (GET_by_offset(disp, _gloffset_Vertex3s));
+}
+
+static INLINE void SET_Vertex3s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_Vertex3s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex3sv)(const GLshort *);
+#define CALL_Vertex3sv(disp, parameters) \
+ (* GET_Vertex3sv(disp)) parameters
+static INLINE _glptr_Vertex3sv GET_Vertex3sv(struct _glapi_table *disp) {
+ return (_glptr_Vertex3sv) (GET_by_offset(disp, _gloffset_Vertex3sv));
+}
+
+static INLINE void SET_Vertex3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_Vertex3sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex4d)(GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_Vertex4d(disp, parameters) \
+ (* GET_Vertex4d(disp)) parameters
+static INLINE _glptr_Vertex4d GET_Vertex4d(struct _glapi_table *disp) {
+ return (_glptr_Vertex4d) (GET_by_offset(disp, _gloffset_Vertex4d));
+}
+
+static INLINE void SET_Vertex4d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Vertex4d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex4dv)(const GLdouble *);
+#define CALL_Vertex4dv(disp, parameters) \
+ (* GET_Vertex4dv(disp)) parameters
+static INLINE _glptr_Vertex4dv GET_Vertex4dv(struct _glapi_table *disp) {
+ return (_glptr_Vertex4dv) (GET_by_offset(disp, _gloffset_Vertex4dv));
+}
+
+static INLINE void SET_Vertex4dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_Vertex4dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex4f)(GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_Vertex4f(disp, parameters) \
+ (* GET_Vertex4f(disp)) parameters
+static INLINE _glptr_Vertex4f GET_Vertex4f(struct _glapi_table *disp) {
+ return (_glptr_Vertex4f) (GET_by_offset(disp, _gloffset_Vertex4f));
+}
+
+static INLINE void SET_Vertex4f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Vertex4f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex4fv)(const GLfloat *);
+#define CALL_Vertex4fv(disp, parameters) \
+ (* GET_Vertex4fv(disp)) parameters
+static INLINE _glptr_Vertex4fv GET_Vertex4fv(struct _glapi_table *disp) {
+ return (_glptr_Vertex4fv) (GET_by_offset(disp, _gloffset_Vertex4fv));
+}
+
+static INLINE void SET_Vertex4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Vertex4fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex4i)(GLint, GLint, GLint, GLint);
+#define CALL_Vertex4i(disp, parameters) \
+ (* GET_Vertex4i(disp)) parameters
+static INLINE _glptr_Vertex4i GET_Vertex4i(struct _glapi_table *disp) {
+ return (_glptr_Vertex4i) (GET_by_offset(disp, _gloffset_Vertex4i));
+}
+
+static INLINE void SET_Vertex4i(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Vertex4i, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex4iv)(const GLint *);
+#define CALL_Vertex4iv(disp, parameters) \
+ (* GET_Vertex4iv(disp)) parameters
+static INLINE _glptr_Vertex4iv GET_Vertex4iv(struct _glapi_table *disp) {
+ return (_glptr_Vertex4iv) (GET_by_offset(disp, _gloffset_Vertex4iv));
+}
+
+static INLINE void SET_Vertex4iv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_Vertex4iv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex4s)(GLshort, GLshort, GLshort, GLshort);
+#define CALL_Vertex4s(disp, parameters) \
+ (* GET_Vertex4s(disp)) parameters
+static INLINE _glptr_Vertex4s GET_Vertex4s(struct _glapi_table *disp) {
+ return (_glptr_Vertex4s) (GET_by_offset(disp, _gloffset_Vertex4s));
+}
+
+static INLINE void SET_Vertex4s(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_Vertex4s, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Vertex4sv)(const GLshort *);
+#define CALL_Vertex4sv(disp, parameters) \
+ (* GET_Vertex4sv(disp)) parameters
+static INLINE _glptr_Vertex4sv GET_Vertex4sv(struct _glapi_table *disp) {
+ return (_glptr_Vertex4sv) (GET_by_offset(disp, _gloffset_Vertex4sv));
+}
+
+static INLINE void SET_Vertex4sv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_Vertex4sv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClipPlane)(GLenum, const GLdouble *);
+#define CALL_ClipPlane(disp, parameters) \
+ (* GET_ClipPlane(disp)) parameters
+static INLINE _glptr_ClipPlane GET_ClipPlane(struct _glapi_table *disp) {
+ return (_glptr_ClipPlane) (GET_by_offset(disp, _gloffset_ClipPlane));
+}
+
+static INLINE void SET_ClipPlane(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_ClipPlane, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorMaterial)(GLenum, GLenum);
+#define CALL_ColorMaterial(disp, parameters) \
+ (* GET_ColorMaterial(disp)) parameters
+static INLINE _glptr_ColorMaterial GET_ColorMaterial(struct _glapi_table *disp) {
+ return (_glptr_ColorMaterial) (GET_by_offset(disp, _gloffset_ColorMaterial));
+}
+
+static INLINE void SET_ColorMaterial(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_ColorMaterial, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CullFace)(GLenum);
+#define CALL_CullFace(disp, parameters) \
+ (* GET_CullFace(disp)) parameters
+static INLINE _glptr_CullFace GET_CullFace(struct _glapi_table *disp) {
+ return (_glptr_CullFace) (GET_by_offset(disp, _gloffset_CullFace));
+}
+
+static INLINE void SET_CullFace(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_CullFace, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Fogf)(GLenum, GLfloat);
+#define CALL_Fogf(disp, parameters) \
+ (* GET_Fogf(disp)) parameters
+static INLINE _glptr_Fogf GET_Fogf(struct _glapi_table *disp) {
+ return (_glptr_Fogf) (GET_by_offset(disp, _gloffset_Fogf));
+}
+
+static INLINE void SET_Fogf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Fogf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Fogfv)(GLenum, const GLfloat *);
+#define CALL_Fogfv(disp, parameters) \
+ (* GET_Fogfv(disp)) parameters
+static INLINE _glptr_Fogfv GET_Fogfv(struct _glapi_table *disp) {
+ return (_glptr_Fogfv) (GET_by_offset(disp, _gloffset_Fogfv));
+}
+
+static INLINE void SET_Fogfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Fogfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Fogi)(GLenum, GLint);
+#define CALL_Fogi(disp, parameters) \
+ (* GET_Fogi(disp)) parameters
+static INLINE _glptr_Fogi GET_Fogi(struct _glapi_table *disp) {
+ return (_glptr_Fogi) (GET_by_offset(disp, _gloffset_Fogi));
+}
+
+static INLINE void SET_Fogi(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_Fogi, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Fogiv)(GLenum, const GLint *);
+#define CALL_Fogiv(disp, parameters) \
+ (* GET_Fogiv(disp)) parameters
+static INLINE _glptr_Fogiv GET_Fogiv(struct _glapi_table *disp) {
+ return (_glptr_Fogiv) (GET_by_offset(disp, _gloffset_Fogiv));
+}
+
+static INLINE void SET_Fogiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_Fogiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FrontFace)(GLenum);
+#define CALL_FrontFace(disp, parameters) \
+ (* GET_FrontFace(disp)) parameters
+static INLINE _glptr_FrontFace GET_FrontFace(struct _glapi_table *disp) {
+ return (_glptr_FrontFace) (GET_by_offset(disp, _gloffset_FrontFace));
+}
+
+static INLINE void SET_FrontFace(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_FrontFace, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Hint)(GLenum, GLenum);
+#define CALL_Hint(disp, parameters) \
+ (* GET_Hint(disp)) parameters
+static INLINE _glptr_Hint GET_Hint(struct _glapi_table *disp) {
+ return (_glptr_Hint) (GET_by_offset(disp, _gloffset_Hint));
+}
+
+static INLINE void SET_Hint(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_Hint, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Lightf)(GLenum, GLenum, GLfloat);
+#define CALL_Lightf(disp, parameters) \
+ (* GET_Lightf(disp)) parameters
+static INLINE _glptr_Lightf GET_Lightf(struct _glapi_table *disp) {
+ return (_glptr_Lightf) (GET_by_offset(disp, _gloffset_Lightf));
+}
+
+static INLINE void SET_Lightf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Lightf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Lightfv)(GLenum, GLenum, const GLfloat *);
+#define CALL_Lightfv(disp, parameters) \
+ (* GET_Lightfv(disp)) parameters
+static INLINE _glptr_Lightfv GET_Lightfv(struct _glapi_table *disp) {
+ return (_glptr_Lightfv) (GET_by_offset(disp, _gloffset_Lightfv));
+}
+
+static INLINE void SET_Lightfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Lightfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Lighti)(GLenum, GLenum, GLint);
+#define CALL_Lighti(disp, parameters) \
+ (* GET_Lighti(disp)) parameters
+static INLINE _glptr_Lighti GET_Lighti(struct _glapi_table *disp) {
+ return (_glptr_Lighti) (GET_by_offset(disp, _gloffset_Lighti));
+}
+
+static INLINE void SET_Lighti(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_Lighti, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Lightiv)(GLenum, GLenum, const GLint *);
+#define CALL_Lightiv(disp, parameters) \
+ (* GET_Lightiv(disp)) parameters
+static INLINE _glptr_Lightiv GET_Lightiv(struct _glapi_table *disp) {
+ return (_glptr_Lightiv) (GET_by_offset(disp, _gloffset_Lightiv));
+}
+
+static INLINE void SET_Lightiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_Lightiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LightModelf)(GLenum, GLfloat);
+#define CALL_LightModelf(disp, parameters) \
+ (* GET_LightModelf(disp)) parameters
+static INLINE _glptr_LightModelf GET_LightModelf(struct _glapi_table *disp) {
+ return (_glptr_LightModelf) (GET_by_offset(disp, _gloffset_LightModelf));
+}
+
+static INLINE void SET_LightModelf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_LightModelf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LightModelfv)(GLenum, const GLfloat *);
+#define CALL_LightModelfv(disp, parameters) \
+ (* GET_LightModelfv(disp)) parameters
+static INLINE _glptr_LightModelfv GET_LightModelfv(struct _glapi_table *disp) {
+ return (_glptr_LightModelfv) (GET_by_offset(disp, _gloffset_LightModelfv));
+}
+
+static INLINE void SET_LightModelfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_LightModelfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LightModeli)(GLenum, GLint);
+#define CALL_LightModeli(disp, parameters) \
+ (* GET_LightModeli(disp)) parameters
+static INLINE _glptr_LightModeli GET_LightModeli(struct _glapi_table *disp) {
+ return (_glptr_LightModeli) (GET_by_offset(disp, _gloffset_LightModeli));
+}
+
+static INLINE void SET_LightModeli(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_LightModeli, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LightModeliv)(GLenum, const GLint *);
+#define CALL_LightModeliv(disp, parameters) \
+ (* GET_LightModeliv(disp)) parameters
+static INLINE _glptr_LightModeliv GET_LightModeliv(struct _glapi_table *disp) {
+ return (_glptr_LightModeliv) (GET_by_offset(disp, _gloffset_LightModeliv));
+}
+
+static INLINE void SET_LightModeliv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_LightModeliv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LineStipple)(GLint, GLushort);
+#define CALL_LineStipple(disp, parameters) \
+ (* GET_LineStipple(disp)) parameters
+static INLINE _glptr_LineStipple GET_LineStipple(struct _glapi_table *disp) {
+ return (_glptr_LineStipple) (GET_by_offset(disp, _gloffset_LineStipple));
+}
+
+static INLINE void SET_LineStipple(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLushort)) {
+ SET_by_offset(disp, _gloffset_LineStipple, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LineWidth)(GLfloat);
+#define CALL_LineWidth(disp, parameters) \
+ (* GET_LineWidth(disp)) parameters
+static INLINE _glptr_LineWidth GET_LineWidth(struct _glapi_table *disp) {
+ return (_glptr_LineWidth) (GET_by_offset(disp, _gloffset_LineWidth));
+}
+
+static INLINE void SET_LineWidth(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
+ SET_by_offset(disp, _gloffset_LineWidth, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Materialf)(GLenum, GLenum, GLfloat);
+#define CALL_Materialf(disp, parameters) \
+ (* GET_Materialf(disp)) parameters
+static INLINE _glptr_Materialf GET_Materialf(struct _glapi_table *disp) {
+ return (_glptr_Materialf) (GET_by_offset(disp, _gloffset_Materialf));
+}
+
+static INLINE void SET_Materialf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Materialf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Materialfv)(GLenum, GLenum, const GLfloat *);
+#define CALL_Materialfv(disp, parameters) \
+ (* GET_Materialfv(disp)) parameters
+static INLINE _glptr_Materialfv GET_Materialfv(struct _glapi_table *disp) {
+ return (_glptr_Materialfv) (GET_by_offset(disp, _gloffset_Materialfv));
+}
+
+static INLINE void SET_Materialfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Materialfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Materiali)(GLenum, GLenum, GLint);
+#define CALL_Materiali(disp, parameters) \
+ (* GET_Materiali(disp)) parameters
+static INLINE _glptr_Materiali GET_Materiali(struct _glapi_table *disp) {
+ return (_glptr_Materiali) (GET_by_offset(disp, _gloffset_Materiali));
+}
+
+static INLINE void SET_Materiali(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_Materiali, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Materialiv)(GLenum, GLenum, const GLint *);
+#define CALL_Materialiv(disp, parameters) \
+ (* GET_Materialiv(disp)) parameters
+static INLINE _glptr_Materialiv GET_Materialiv(struct _glapi_table *disp) {
+ return (_glptr_Materialiv) (GET_by_offset(disp, _gloffset_Materialiv));
+}
+
+static INLINE void SET_Materialiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_Materialiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PointSize)(GLfloat);
+#define CALL_PointSize(disp, parameters) \
+ (* GET_PointSize(disp)) parameters
+static INLINE _glptr_PointSize GET_PointSize(struct _glapi_table *disp) {
+ return (_glptr_PointSize) (GET_by_offset(disp, _gloffset_PointSize));
+}
+
+static INLINE void SET_PointSize(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
+ SET_by_offset(disp, _gloffset_PointSize, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PolygonMode)(GLenum, GLenum);
+#define CALL_PolygonMode(disp, parameters) \
+ (* GET_PolygonMode(disp)) parameters
+static INLINE _glptr_PolygonMode GET_PolygonMode(struct _glapi_table *disp) {
+ return (_glptr_PolygonMode) (GET_by_offset(disp, _gloffset_PolygonMode));
+}
+
+static INLINE void SET_PolygonMode(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_PolygonMode, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PolygonStipple)(const GLubyte *);
+#define CALL_PolygonStipple(disp, parameters) \
+ (* GET_PolygonStipple(disp)) parameters
+static INLINE _glptr_PolygonStipple GET_PolygonStipple(struct _glapi_table *disp) {
+ return (_glptr_PolygonStipple) (GET_by_offset(disp, _gloffset_PolygonStipple));
+}
+
+static INLINE void SET_PolygonStipple(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_PolygonStipple, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Scissor)(GLint, GLint, GLsizei, GLsizei);
+#define CALL_Scissor(disp, parameters) \
+ (* GET_Scissor(disp)) parameters
+static INLINE _glptr_Scissor GET_Scissor(struct _glapi_table *disp) {
+ return (_glptr_Scissor) (GET_by_offset(disp, _gloffset_Scissor));
+}
+
+static INLINE void SET_Scissor(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_Scissor, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ShadeModel)(GLenum);
+#define CALL_ShadeModel(disp, parameters) \
+ (* GET_ShadeModel(disp)) parameters
+static INLINE _glptr_ShadeModel GET_ShadeModel(struct _glapi_table *disp) {
+ return (_glptr_ShadeModel) (GET_by_offset(disp, _gloffset_ShadeModel));
+}
+
+static INLINE void SET_ShadeModel(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_ShadeModel, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexParameterf)(GLenum, GLenum, GLfloat);
+#define CALL_TexParameterf(disp, parameters) \
+ (* GET_TexParameterf(disp)) parameters
+static INLINE _glptr_TexParameterf GET_TexParameterf(struct _glapi_table *disp) {
+ return (_glptr_TexParameterf) (GET_by_offset(disp, _gloffset_TexParameterf));
+}
+
+static INLINE void SET_TexParameterf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_TexParameterf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexParameterfv)(GLenum, GLenum, const GLfloat *);
+#define CALL_TexParameterfv(disp, parameters) \
+ (* GET_TexParameterfv(disp)) parameters
+static INLINE _glptr_TexParameterfv GET_TexParameterfv(struct _glapi_table *disp) {
+ return (_glptr_TexParameterfv) (GET_by_offset(disp, _gloffset_TexParameterfv));
+}
+
+static INLINE void SET_TexParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_TexParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexParameteri)(GLenum, GLenum, GLint);
+#define CALL_TexParameteri(disp, parameters) \
+ (* GET_TexParameteri(disp)) parameters
+static INLINE _glptr_TexParameteri GET_TexParameteri(struct _glapi_table *disp) {
+ return (_glptr_TexParameteri) (GET_by_offset(disp, _gloffset_TexParameteri));
+}
+
+static INLINE void SET_TexParameteri(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_TexParameteri, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexParameteriv)(GLenum, GLenum, const GLint *);
+#define CALL_TexParameteriv(disp, parameters) \
+ (* GET_TexParameteriv(disp)) parameters
+static INLINE _glptr_TexParameteriv GET_TexParameteriv(struct _glapi_table *disp) {
+ return (_glptr_TexParameteriv) (GET_by_offset(disp, _gloffset_TexParameteriv));
+}
+
+static INLINE void SET_TexParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_TexParameteriv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+#define CALL_TexImage1D(disp, parameters) \
+ (* GET_TexImage1D(disp)) parameters
+static INLINE _glptr_TexImage1D GET_TexImage1D(struct _glapi_table *disp) {
+ return (_glptr_TexImage1D) (GET_by_offset(disp, _gloffset_TexImage1D));
+}
+
+static INLINE void SET_TexImage1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_TexImage1D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+#define CALL_TexImage2D(disp, parameters) \
+ (* GET_TexImage2D(disp)) parameters
+static INLINE _glptr_TexImage2D GET_TexImage2D(struct _glapi_table *disp) {
+ return (_glptr_TexImage2D) (GET_by_offset(disp, _gloffset_TexImage2D));
+}
+
+static INLINE void SET_TexImage2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_TexImage2D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexEnvf)(GLenum, GLenum, GLfloat);
+#define CALL_TexEnvf(disp, parameters) \
+ (* GET_TexEnvf(disp)) parameters
+static INLINE _glptr_TexEnvf GET_TexEnvf(struct _glapi_table *disp) {
+ return (_glptr_TexEnvf) (GET_by_offset(disp, _gloffset_TexEnvf));
+}
+
+static INLINE void SET_TexEnvf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_TexEnvf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexEnvfv)(GLenum, GLenum, const GLfloat *);
+#define CALL_TexEnvfv(disp, parameters) \
+ (* GET_TexEnvfv(disp)) parameters
+static INLINE _glptr_TexEnvfv GET_TexEnvfv(struct _glapi_table *disp) {
+ return (_glptr_TexEnvfv) (GET_by_offset(disp, _gloffset_TexEnvfv));
+}
+
+static INLINE void SET_TexEnvfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_TexEnvfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexEnvi)(GLenum, GLenum, GLint);
+#define CALL_TexEnvi(disp, parameters) \
+ (* GET_TexEnvi(disp)) parameters
+static INLINE _glptr_TexEnvi GET_TexEnvi(struct _glapi_table *disp) {
+ return (_glptr_TexEnvi) (GET_by_offset(disp, _gloffset_TexEnvi));
+}
+
+static INLINE void SET_TexEnvi(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_TexEnvi, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexEnviv)(GLenum, GLenum, const GLint *);
+#define CALL_TexEnviv(disp, parameters) \
+ (* GET_TexEnviv(disp)) parameters
+static INLINE _glptr_TexEnviv GET_TexEnviv(struct _glapi_table *disp) {
+ return (_glptr_TexEnviv) (GET_by_offset(disp, _gloffset_TexEnviv));
+}
+
+static INLINE void SET_TexEnviv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_TexEnviv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexGend)(GLenum, GLenum, GLdouble);
+#define CALL_TexGend(disp, parameters) \
+ (* GET_TexGend(disp)) parameters
+static INLINE _glptr_TexGend GET_TexGend(struct _glapi_table *disp) {
+ return (_glptr_TexGend) (GET_by_offset(disp, _gloffset_TexGend));
+}
+
+static INLINE void SET_TexGend(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLdouble)) {
+ SET_by_offset(disp, _gloffset_TexGend, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexGendv)(GLenum, GLenum, const GLdouble *);
+#define CALL_TexGendv(disp, parameters) \
+ (* GET_TexGendv(disp)) parameters
+static INLINE _glptr_TexGendv GET_TexGendv(struct _glapi_table *disp) {
+ return (_glptr_TexGendv) (GET_by_offset(disp, _gloffset_TexGendv));
+}
+
+static INLINE void SET_TexGendv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_TexGendv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexGenf)(GLenum, GLenum, GLfloat);
+#define CALL_TexGenf(disp, parameters) \
+ (* GET_TexGenf(disp)) parameters
+static INLINE _glptr_TexGenf GET_TexGenf(struct _glapi_table *disp) {
+ return (_glptr_TexGenf) (GET_by_offset(disp, _gloffset_TexGenf));
+}
+
+static INLINE void SET_TexGenf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_TexGenf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexGenfv)(GLenum, GLenum, const GLfloat *);
+#define CALL_TexGenfv(disp, parameters) \
+ (* GET_TexGenfv(disp)) parameters
+static INLINE _glptr_TexGenfv GET_TexGenfv(struct _glapi_table *disp) {
+ return (_glptr_TexGenfv) (GET_by_offset(disp, _gloffset_TexGenfv));
+}
+
+static INLINE void SET_TexGenfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_TexGenfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexGeni)(GLenum, GLenum, GLint);
+#define CALL_TexGeni(disp, parameters) \
+ (* GET_TexGeni(disp)) parameters
+static INLINE _glptr_TexGeni GET_TexGeni(struct _glapi_table *disp) {
+ return (_glptr_TexGeni) (GET_by_offset(disp, _gloffset_TexGeni));
+}
+
+static INLINE void SET_TexGeni(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_TexGeni, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexGeniv)(GLenum, GLenum, const GLint *);
+#define CALL_TexGeniv(disp, parameters) \
+ (* GET_TexGeniv(disp)) parameters
+static INLINE _glptr_TexGeniv GET_TexGeniv(struct _glapi_table *disp) {
+ return (_glptr_TexGeniv) (GET_by_offset(disp, _gloffset_TexGeniv));
+}
+
+static INLINE void SET_TexGeniv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_TexGeniv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FeedbackBuffer)(GLsizei, GLenum, GLfloat *);
+#define CALL_FeedbackBuffer(disp, parameters) \
+ (* GET_FeedbackBuffer(disp)) parameters
+static INLINE _glptr_FeedbackBuffer GET_FeedbackBuffer(struct _glapi_table *disp) {
+ return (_glptr_FeedbackBuffer) (GET_by_offset(disp, _gloffset_FeedbackBuffer));
+}
+
+static INLINE void SET_FeedbackBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_FeedbackBuffer, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SelectBuffer)(GLsizei, GLuint *);
+#define CALL_SelectBuffer(disp, parameters) \
+ (* GET_SelectBuffer(disp)) parameters
+static INLINE _glptr_SelectBuffer GET_SelectBuffer(struct _glapi_table *disp) {
+ return (_glptr_SelectBuffer) (GET_by_offset(disp, _gloffset_SelectBuffer));
+}
+
+static INLINE void SET_SelectBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_SelectBuffer, fn);
+}
+
+typedef GLint (GLAPIENTRYP _glptr_RenderMode)(GLenum);
+#define CALL_RenderMode(disp, parameters) \
+ (* GET_RenderMode(disp)) parameters
+static INLINE _glptr_RenderMode GET_RenderMode(struct _glapi_table *disp) {
+ return (_glptr_RenderMode) (GET_by_offset(disp, _gloffset_RenderMode));
+}
+
+static INLINE void SET_RenderMode(struct _glapi_table *disp, GLint (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_RenderMode, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_InitNames)(void);
+#define CALL_InitNames(disp, parameters) \
+ (* GET_InitNames(disp)) parameters
+static INLINE _glptr_InitNames GET_InitNames(struct _glapi_table *disp) {
+ return (_glptr_InitNames) (GET_by_offset(disp, _gloffset_InitNames));
+}
+
+static INLINE void SET_InitNames(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_InitNames, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LoadName)(GLuint);
+#define CALL_LoadName(disp, parameters) \
+ (* GET_LoadName(disp)) parameters
+static INLINE _glptr_LoadName GET_LoadName(struct _glapi_table *disp) {
+ return (_glptr_LoadName) (GET_by_offset(disp, _gloffset_LoadName));
+}
+
+static INLINE void SET_LoadName(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_LoadName, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PassThrough)(GLfloat);
+#define CALL_PassThrough(disp, parameters) \
+ (* GET_PassThrough(disp)) parameters
+static INLINE _glptr_PassThrough GET_PassThrough(struct _glapi_table *disp) {
+ return (_glptr_PassThrough) (GET_by_offset(disp, _gloffset_PassThrough));
+}
+
+static INLINE void SET_PassThrough(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
+ SET_by_offset(disp, _gloffset_PassThrough, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PopName)(void);
+#define CALL_PopName(disp, parameters) \
+ (* GET_PopName(disp)) parameters
+static INLINE _glptr_PopName GET_PopName(struct _glapi_table *disp) {
+ return (_glptr_PopName) (GET_by_offset(disp, _gloffset_PopName));
+}
+
+static INLINE void SET_PopName(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_PopName, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PushName)(GLuint);
+#define CALL_PushName(disp, parameters) \
+ (* GET_PushName(disp)) parameters
+static INLINE _glptr_PushName GET_PushName(struct _glapi_table *disp) {
+ return (_glptr_PushName) (GET_by_offset(disp, _gloffset_PushName));
+}
+
+static INLINE void SET_PushName(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_PushName, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawBuffer)(GLenum);
+#define CALL_DrawBuffer(disp, parameters) \
+ (* GET_DrawBuffer(disp)) parameters
+static INLINE _glptr_DrawBuffer GET_DrawBuffer(struct _glapi_table *disp) {
+ return (_glptr_DrawBuffer) (GET_by_offset(disp, _gloffset_DrawBuffer));
+}
+
+static INLINE void SET_DrawBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_DrawBuffer, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Clear)(GLbitfield);
+#define CALL_Clear(disp, parameters) \
+ (* GET_Clear(disp)) parameters
+static INLINE _glptr_Clear GET_Clear(struct _glapi_table *disp) {
+ return (_glptr_Clear) (GET_by_offset(disp, _gloffset_Clear));
+}
+
+static INLINE void SET_Clear(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbitfield)) {
+ SET_by_offset(disp, _gloffset_Clear, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearAccum)(GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_ClearAccum(disp, parameters) \
+ (* GET_ClearAccum(disp)) parameters
+static INLINE _glptr_ClearAccum GET_ClearAccum(struct _glapi_table *disp) {
+ return (_glptr_ClearAccum) (GET_by_offset(disp, _gloffset_ClearAccum));
+}
+
+static INLINE void SET_ClearAccum(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_ClearAccum, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearIndex)(GLfloat);
+#define CALL_ClearIndex(disp, parameters) \
+ (* GET_ClearIndex(disp)) parameters
+static INLINE _glptr_ClearIndex GET_ClearIndex(struct _glapi_table *disp) {
+ return (_glptr_ClearIndex) (GET_by_offset(disp, _gloffset_ClearIndex));
+}
+
+static INLINE void SET_ClearIndex(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
+ SET_by_offset(disp, _gloffset_ClearIndex, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
+#define CALL_ClearColor(disp, parameters) \
+ (* GET_ClearColor(disp)) parameters
+static INLINE _glptr_ClearColor GET_ClearColor(struct _glapi_table *disp) {
+ return (_glptr_ClearColor) (GET_by_offset(disp, _gloffset_ClearColor));
+}
+
+static INLINE void SET_ClearColor(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLclampf, GLclampf, GLclampf)) {
+ SET_by_offset(disp, _gloffset_ClearColor, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearStencil)(GLint);
+#define CALL_ClearStencil(disp, parameters) \
+ (* GET_ClearStencil(disp)) parameters
+static INLINE _glptr_ClearStencil GET_ClearStencil(struct _glapi_table *disp) {
+ return (_glptr_ClearStencil) (GET_by_offset(disp, _gloffset_ClearStencil));
+}
+
+static INLINE void SET_ClearStencil(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint)) {
+ SET_by_offset(disp, _gloffset_ClearStencil, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearDepth)(GLclampd);
+#define CALL_ClearDepth(disp, parameters) \
+ (* GET_ClearDepth(disp)) parameters
+static INLINE _glptr_ClearDepth GET_ClearDepth(struct _glapi_table *disp) {
+ return (_glptr_ClearDepth) (GET_by_offset(disp, _gloffset_ClearDepth));
+}
+
+static INLINE void SET_ClearDepth(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampd)) {
+ SET_by_offset(disp, _gloffset_ClearDepth, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_StencilMask)(GLuint);
+#define CALL_StencilMask(disp, parameters) \
+ (* GET_StencilMask(disp)) parameters
+static INLINE _glptr_StencilMask GET_StencilMask(struct _glapi_table *disp) {
+ return (_glptr_StencilMask) (GET_by_offset(disp, _gloffset_StencilMask));
+}
+
+static INLINE void SET_StencilMask(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_StencilMask, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean);
+#define CALL_ColorMask(disp, parameters) \
+ (* GET_ColorMask(disp)) parameters
+static INLINE _glptr_ColorMask GET_ColorMask(struct _glapi_table *disp) {
+ return (_glptr_ColorMask) (GET_by_offset(disp, _gloffset_ColorMask));
+}
+
+static INLINE void SET_ColorMask(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLboolean, GLboolean, GLboolean, GLboolean)) {
+ SET_by_offset(disp, _gloffset_ColorMask, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DepthMask)(GLboolean);
+#define CALL_DepthMask(disp, parameters) \
+ (* GET_DepthMask(disp)) parameters
+static INLINE _glptr_DepthMask GET_DepthMask(struct _glapi_table *disp) {
+ return (_glptr_DepthMask) (GET_by_offset(disp, _gloffset_DepthMask));
+}
+
+static INLINE void SET_DepthMask(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLboolean)) {
+ SET_by_offset(disp, _gloffset_DepthMask, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_IndexMask)(GLuint);
+#define CALL_IndexMask(disp, parameters) \
+ (* GET_IndexMask(disp)) parameters
+static INLINE _glptr_IndexMask GET_IndexMask(struct _glapi_table *disp) {
+ return (_glptr_IndexMask) (GET_by_offset(disp, _gloffset_IndexMask));
+}
+
+static INLINE void SET_IndexMask(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IndexMask, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Accum)(GLenum, GLfloat);
+#define CALL_Accum(disp, parameters) \
+ (* GET_Accum(disp)) parameters
+static INLINE _glptr_Accum GET_Accum(struct _glapi_table *disp) {
+ return (_glptr_Accum) (GET_by_offset(disp, _gloffset_Accum));
+}
+
+static INLINE void SET_Accum(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Accum, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Disable)(GLenum);
+#define CALL_Disable(disp, parameters) \
+ (* GET_Disable(disp)) parameters
+static INLINE _glptr_Disable GET_Disable(struct _glapi_table *disp) {
+ return (_glptr_Disable) (GET_by_offset(disp, _gloffset_Disable));
+}
+
+static INLINE void SET_Disable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_Disable, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Enable)(GLenum);
+#define CALL_Enable(disp, parameters) \
+ (* GET_Enable(disp)) parameters
+static INLINE _glptr_Enable GET_Enable(struct _glapi_table *disp) {
+ return (_glptr_Enable) (GET_by_offset(disp, _gloffset_Enable));
+}
+
+static INLINE void SET_Enable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_Enable, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Finish)(void);
+#define CALL_Finish(disp, parameters) \
+ (* GET_Finish(disp)) parameters
+static INLINE _glptr_Finish GET_Finish(struct _glapi_table *disp) {
+ return (_glptr_Finish) (GET_by_offset(disp, _gloffset_Finish));
+}
+
+static INLINE void SET_Finish(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_Finish, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Flush)(void);
+#define CALL_Flush(disp, parameters) \
+ (* GET_Flush(disp)) parameters
+static INLINE _glptr_Flush GET_Flush(struct _glapi_table *disp) {
+ return (_glptr_Flush) (GET_by_offset(disp, _gloffset_Flush));
+}
+
+static INLINE void SET_Flush(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_Flush, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PopAttrib)(void);
+#define CALL_PopAttrib(disp, parameters) \
+ (* GET_PopAttrib(disp)) parameters
+static INLINE _glptr_PopAttrib GET_PopAttrib(struct _glapi_table *disp) {
+ return (_glptr_PopAttrib) (GET_by_offset(disp, _gloffset_PopAttrib));
+}
+
+static INLINE void SET_PopAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_PopAttrib, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PushAttrib)(GLbitfield);
+#define CALL_PushAttrib(disp, parameters) \
+ (* GET_PushAttrib(disp)) parameters
+static INLINE _glptr_PushAttrib GET_PushAttrib(struct _glapi_table *disp) {
+ return (_glptr_PushAttrib) (GET_by_offset(disp, _gloffset_PushAttrib));
+}
+
+static INLINE void SET_PushAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbitfield)) {
+ SET_by_offset(disp, _gloffset_PushAttrib, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Map1d)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
+#define CALL_Map1d(disp, parameters) \
+ (* GET_Map1d(disp)) parameters
+static INLINE _glptr_Map1d GET_Map1d(struct _glapi_table *disp) {
+ return (_glptr_Map1d) (GET_by_offset(disp, _gloffset_Map1d));
+}
+
+static INLINE void SET_Map1d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_Map1d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Map1f)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
+#define CALL_Map1f(disp, parameters) \
+ (* GET_Map1f(disp)) parameters
+static INLINE _glptr_Map1f GET_Map1f(struct _glapi_table *disp) {
+ return (_glptr_Map1f) (GET_by_offset(disp, _gloffset_Map1f));
+}
+
+static INLINE void SET_Map1f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Map1f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Map2d)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
+#define CALL_Map2d(disp, parameters) \
+ (* GET_Map2d(disp)) parameters
+static INLINE _glptr_Map2d GET_Map2d(struct _glapi_table *disp) {
+ return (_glptr_Map2d) (GET_by_offset(disp, _gloffset_Map2d));
+}
+
+static INLINE void SET_Map2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_Map2d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Map2f)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
+#define CALL_Map2f(disp, parameters) \
+ (* GET_Map2f(disp)) parameters
+static INLINE _glptr_Map2f GET_Map2f(struct _glapi_table *disp) {
+ return (_glptr_Map2f) (GET_by_offset(disp, _gloffset_Map2f));
+}
+
+static INLINE void SET_Map2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Map2f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MapGrid1d)(GLint, GLdouble, GLdouble);
+#define CALL_MapGrid1d(disp, parameters) \
+ (* GET_MapGrid1d(disp)) parameters
+static INLINE _glptr_MapGrid1d GET_MapGrid1d(struct _glapi_table *disp) {
+ return (_glptr_MapGrid1d) (GET_by_offset(disp, _gloffset_MapGrid1d));
+}
+
+static INLINE void SET_MapGrid1d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_MapGrid1d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MapGrid1f)(GLint, GLfloat, GLfloat);
+#define CALL_MapGrid1f(disp, parameters) \
+ (* GET_MapGrid1f(disp)) parameters
+static INLINE _glptr_MapGrid1f GET_MapGrid1f(struct _glapi_table *disp) {
+ return (_glptr_MapGrid1f) (GET_by_offset(disp, _gloffset_MapGrid1f));
+}
+
+static INLINE void SET_MapGrid1f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_MapGrid1f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MapGrid2d)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble);
+#define CALL_MapGrid2d(disp, parameters) \
+ (* GET_MapGrid2d(disp)) parameters
+static INLINE _glptr_MapGrid2d GET_MapGrid2d(struct _glapi_table *disp) {
+ return (_glptr_MapGrid2d) (GET_by_offset(disp, _gloffset_MapGrid2d));
+}
+
+static INLINE void SET_MapGrid2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_MapGrid2d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MapGrid2f)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat);
+#define CALL_MapGrid2f(disp, parameters) \
+ (* GET_MapGrid2f(disp)) parameters
+static INLINE _glptr_MapGrid2f GET_MapGrid2f(struct _glapi_table *disp) {
+ return (_glptr_MapGrid2f) (GET_by_offset(disp, _gloffset_MapGrid2f));
+}
+
+static INLINE void SET_MapGrid2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_MapGrid2f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalCoord1d)(GLdouble);
+#define CALL_EvalCoord1d(disp, parameters) \
+ (* GET_EvalCoord1d(disp)) parameters
+static INLINE _glptr_EvalCoord1d GET_EvalCoord1d(struct _glapi_table *disp) {
+ return (_glptr_EvalCoord1d) (GET_by_offset(disp, _gloffset_EvalCoord1d));
+}
+
+static INLINE void SET_EvalCoord1d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble)) {
+ SET_by_offset(disp, _gloffset_EvalCoord1d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalCoord1dv)(const GLdouble *);
+#define CALL_EvalCoord1dv(disp, parameters) \
+ (* GET_EvalCoord1dv(disp)) parameters
+static INLINE _glptr_EvalCoord1dv GET_EvalCoord1dv(struct _glapi_table *disp) {
+ return (_glptr_EvalCoord1dv) (GET_by_offset(disp, _gloffset_EvalCoord1dv));
+}
+
+static INLINE void SET_EvalCoord1dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_EvalCoord1dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalCoord1f)(GLfloat);
+#define CALL_EvalCoord1f(disp, parameters) \
+ (* GET_EvalCoord1f(disp)) parameters
+static INLINE _glptr_EvalCoord1f GET_EvalCoord1f(struct _glapi_table *disp) {
+ return (_glptr_EvalCoord1f) (GET_by_offset(disp, _gloffset_EvalCoord1f));
+}
+
+static INLINE void SET_EvalCoord1f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
+ SET_by_offset(disp, _gloffset_EvalCoord1f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalCoord1fv)(const GLfloat *);
+#define CALL_EvalCoord1fv(disp, parameters) \
+ (* GET_EvalCoord1fv(disp)) parameters
+static INLINE _glptr_EvalCoord1fv GET_EvalCoord1fv(struct _glapi_table *disp) {
+ return (_glptr_EvalCoord1fv) (GET_by_offset(disp, _gloffset_EvalCoord1fv));
+}
+
+static INLINE void SET_EvalCoord1fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_EvalCoord1fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalCoord2d)(GLdouble, GLdouble);
+#define CALL_EvalCoord2d(disp, parameters) \
+ (* GET_EvalCoord2d(disp)) parameters
+static INLINE _glptr_EvalCoord2d GET_EvalCoord2d(struct _glapi_table *disp) {
+ return (_glptr_EvalCoord2d) (GET_by_offset(disp, _gloffset_EvalCoord2d));
+}
+
+static INLINE void SET_EvalCoord2d(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_EvalCoord2d, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalCoord2dv)(const GLdouble *);
+#define CALL_EvalCoord2dv(disp, parameters) \
+ (* GET_EvalCoord2dv(disp)) parameters
+static INLINE _glptr_EvalCoord2dv GET_EvalCoord2dv(struct _glapi_table *disp) {
+ return (_glptr_EvalCoord2dv) (GET_by_offset(disp, _gloffset_EvalCoord2dv));
+}
+
+static INLINE void SET_EvalCoord2dv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_EvalCoord2dv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalCoord2f)(GLfloat, GLfloat);
+#define CALL_EvalCoord2f(disp, parameters) \
+ (* GET_EvalCoord2f(disp)) parameters
+static INLINE _glptr_EvalCoord2f GET_EvalCoord2f(struct _glapi_table *disp) {
+ return (_glptr_EvalCoord2f) (GET_by_offset(disp, _gloffset_EvalCoord2f));
+}
+
+static INLINE void SET_EvalCoord2f(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_EvalCoord2f, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalCoord2fv)(const GLfloat *);
+#define CALL_EvalCoord2fv(disp, parameters) \
+ (* GET_EvalCoord2fv(disp)) parameters
+static INLINE _glptr_EvalCoord2fv GET_EvalCoord2fv(struct _glapi_table *disp) {
+ return (_glptr_EvalCoord2fv) (GET_by_offset(disp, _gloffset_EvalCoord2fv));
+}
+
+static INLINE void SET_EvalCoord2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_EvalCoord2fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalMesh1)(GLenum, GLint, GLint);
+#define CALL_EvalMesh1(disp, parameters) \
+ (* GET_EvalMesh1(disp)) parameters
+static INLINE _glptr_EvalMesh1 GET_EvalMesh1(struct _glapi_table *disp) {
+ return (_glptr_EvalMesh1) (GET_by_offset(disp, _gloffset_EvalMesh1));
+}
+
+static INLINE void SET_EvalMesh1(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_EvalMesh1, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalPoint1)(GLint);
+#define CALL_EvalPoint1(disp, parameters) \
+ (* GET_EvalPoint1(disp)) parameters
+static INLINE _glptr_EvalPoint1 GET_EvalPoint1(struct _glapi_table *disp) {
+ return (_glptr_EvalPoint1) (GET_by_offset(disp, _gloffset_EvalPoint1));
+}
+
+static INLINE void SET_EvalPoint1(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint)) {
+ SET_by_offset(disp, _gloffset_EvalPoint1, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalMesh2)(GLenum, GLint, GLint, GLint, GLint);
+#define CALL_EvalMesh2(disp, parameters) \
+ (* GET_EvalMesh2(disp)) parameters
+static INLINE _glptr_EvalMesh2 GET_EvalMesh2(struct _glapi_table *disp) {
+ return (_glptr_EvalMesh2) (GET_by_offset(disp, _gloffset_EvalMesh2));
+}
+
+static INLINE void SET_EvalMesh2(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_EvalMesh2, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EvalPoint2)(GLint, GLint);
+#define CALL_EvalPoint2(disp, parameters) \
+ (* GET_EvalPoint2(disp)) parameters
+static INLINE _glptr_EvalPoint2 GET_EvalPoint2(struct _glapi_table *disp) {
+ return (_glptr_EvalPoint2) (GET_by_offset(disp, _gloffset_EvalPoint2));
+}
+
+static INLINE void SET_EvalPoint2(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_EvalPoint2, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_AlphaFunc)(GLenum, GLclampf);
+#define CALL_AlphaFunc(disp, parameters) \
+ (* GET_AlphaFunc(disp)) parameters
+static INLINE _glptr_AlphaFunc GET_AlphaFunc(struct _glapi_table *disp) {
+ return (_glptr_AlphaFunc) (GET_by_offset(disp, _gloffset_AlphaFunc));
+}
+
+static INLINE void SET_AlphaFunc(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLclampf)) {
+ SET_by_offset(disp, _gloffset_AlphaFunc, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BlendFunc)(GLenum, GLenum);
+#define CALL_BlendFunc(disp, parameters) \
+ (* GET_BlendFunc(disp)) parameters
+static INLINE _glptr_BlendFunc GET_BlendFunc(struct _glapi_table *disp) {
+ return (_glptr_BlendFunc) (GET_by_offset(disp, _gloffset_BlendFunc));
+}
+
+static INLINE void SET_BlendFunc(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_BlendFunc, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LogicOp)(GLenum);
+#define CALL_LogicOp(disp, parameters) \
+ (* GET_LogicOp(disp)) parameters
+static INLINE _glptr_LogicOp GET_LogicOp(struct _glapi_table *disp) {
+ return (_glptr_LogicOp) (GET_by_offset(disp, _gloffset_LogicOp));
+}
+
+static INLINE void SET_LogicOp(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_LogicOp, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_StencilFunc)(GLenum, GLint, GLuint);
+#define CALL_StencilFunc(disp, parameters) \
+ (* GET_StencilFunc(disp)) parameters
+static INLINE _glptr_StencilFunc GET_StencilFunc(struct _glapi_table *disp) {
+ return (_glptr_StencilFunc) (GET_by_offset(disp, _gloffset_StencilFunc));
+}
+
+static INLINE void SET_StencilFunc(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLuint)) {
+ SET_by_offset(disp, _gloffset_StencilFunc, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_StencilOp)(GLenum, GLenum, GLenum);
+#define CALL_StencilOp(disp, parameters) \
+ (* GET_StencilOp(disp)) parameters
+static INLINE _glptr_StencilOp GET_StencilOp(struct _glapi_table *disp) {
+ return (_glptr_StencilOp) (GET_by_offset(disp, _gloffset_StencilOp));
+}
+
+static INLINE void SET_StencilOp(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_StencilOp, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DepthFunc)(GLenum);
+#define CALL_DepthFunc(disp, parameters) \
+ (* GET_DepthFunc(disp)) parameters
+static INLINE _glptr_DepthFunc GET_DepthFunc(struct _glapi_table *disp) {
+ return (_glptr_DepthFunc) (GET_by_offset(disp, _gloffset_DepthFunc));
+}
+
+static INLINE void SET_DepthFunc(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_DepthFunc, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelZoom)(GLfloat, GLfloat);
+#define CALL_PixelZoom(disp, parameters) \
+ (* GET_PixelZoom(disp)) parameters
+static INLINE _glptr_PixelZoom GET_PixelZoom(struct _glapi_table *disp) {
+ return (_glptr_PixelZoom) (GET_by_offset(disp, _gloffset_PixelZoom));
+}
+
+static INLINE void SET_PixelZoom(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_PixelZoom, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelTransferf)(GLenum, GLfloat);
+#define CALL_PixelTransferf(disp, parameters) \
+ (* GET_PixelTransferf(disp)) parameters
+static INLINE _glptr_PixelTransferf GET_PixelTransferf(struct _glapi_table *disp) {
+ return (_glptr_PixelTransferf) (GET_by_offset(disp, _gloffset_PixelTransferf));
+}
+
+static INLINE void SET_PixelTransferf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_PixelTransferf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelTransferi)(GLenum, GLint);
+#define CALL_PixelTransferi(disp, parameters) \
+ (* GET_PixelTransferi(disp)) parameters
+static INLINE _glptr_PixelTransferi GET_PixelTransferi(struct _glapi_table *disp) {
+ return (_glptr_PixelTransferi) (GET_by_offset(disp, _gloffset_PixelTransferi));
+}
+
+static INLINE void SET_PixelTransferi(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_PixelTransferi, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelStoref)(GLenum, GLfloat);
+#define CALL_PixelStoref(disp, parameters) \
+ (* GET_PixelStoref(disp)) parameters
+static INLINE _glptr_PixelStoref GET_PixelStoref(struct _glapi_table *disp) {
+ return (_glptr_PixelStoref) (GET_by_offset(disp, _gloffset_PixelStoref));
+}
+
+static INLINE void SET_PixelStoref(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_PixelStoref, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelStorei)(GLenum, GLint);
+#define CALL_PixelStorei(disp, parameters) \
+ (* GET_PixelStorei(disp)) parameters
+static INLINE _glptr_PixelStorei GET_PixelStorei(struct _glapi_table *disp) {
+ return (_glptr_PixelStorei) (GET_by_offset(disp, _gloffset_PixelStorei));
+}
+
+static INLINE void SET_PixelStorei(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_PixelStorei, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelMapfv)(GLenum, GLsizei, const GLfloat *);
+#define CALL_PixelMapfv(disp, parameters) \
+ (* GET_PixelMapfv(disp)) parameters
+static INLINE _glptr_PixelMapfv GET_PixelMapfv(struct _glapi_table *disp) {
+ return (_glptr_PixelMapfv) (GET_by_offset(disp, _gloffset_PixelMapfv));
+}
+
+static INLINE void SET_PixelMapfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_PixelMapfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelMapuiv)(GLenum, GLsizei, const GLuint *);
+#define CALL_PixelMapuiv(disp, parameters) \
+ (* GET_PixelMapuiv(disp)) parameters
+static INLINE _glptr_PixelMapuiv GET_PixelMapuiv(struct _glapi_table *disp) {
+ return (_glptr_PixelMapuiv) (GET_by_offset(disp, _gloffset_PixelMapuiv));
+}
+
+static INLINE void SET_PixelMapuiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_PixelMapuiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelMapusv)(GLenum, GLsizei, const GLushort *);
+#define CALL_PixelMapusv(disp, parameters) \
+ (* GET_PixelMapusv(disp)) parameters
+static INLINE _glptr_PixelMapusv GET_PixelMapusv(struct _glapi_table *disp) {
+ return (_glptr_PixelMapusv) (GET_by_offset(disp, _gloffset_PixelMapusv));
+}
+
+static INLINE void SET_PixelMapusv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLushort *)) {
+ SET_by_offset(disp, _gloffset_PixelMapusv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ReadBuffer)(GLenum);
+#define CALL_ReadBuffer(disp, parameters) \
+ (* GET_ReadBuffer(disp)) parameters
+static INLINE _glptr_ReadBuffer GET_ReadBuffer(struct _glapi_table *disp) {
+ return (_glptr_ReadBuffer) (GET_by_offset(disp, _gloffset_ReadBuffer));
+}
+
+static INLINE void SET_ReadBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_ReadBuffer, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyPixels)(GLint, GLint, GLsizei, GLsizei, GLenum);
+#define CALL_CopyPixels(disp, parameters) \
+ (* GET_CopyPixels(disp)) parameters
+static INLINE _glptr_CopyPixels GET_CopyPixels(struct _glapi_table *disp) {
+ return (_glptr_CopyPixels) (GET_by_offset(disp, _gloffset_CopyPixels));
+}
+
+static INLINE void SET_CopyPixels(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLsizei, GLsizei, GLenum)) {
+ SET_by_offset(disp, _gloffset_CopyPixels, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
+#define CALL_ReadPixels(disp, parameters) \
+ (* GET_ReadPixels(disp)) parameters
+static INLINE _glptr_ReadPixels GET_ReadPixels(struct _glapi_table *disp) {
+ return (_glptr_ReadPixels) (GET_by_offset(disp, _gloffset_ReadPixels));
+}
+
+static INLINE void SET_ReadPixels(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_ReadPixels, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+#define CALL_DrawPixels(disp, parameters) \
+ (* GET_DrawPixels(disp)) parameters
+static INLINE _glptr_DrawPixels GET_DrawPixels(struct _glapi_table *disp) {
+ return (_glptr_DrawPixels) (GET_by_offset(disp, _gloffset_DrawPixels));
+}
+
+static INLINE void SET_DrawPixels(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_DrawPixels, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetBooleanv)(GLenum, GLboolean *);
+#define CALL_GetBooleanv(disp, parameters) \
+ (* GET_GetBooleanv(disp)) parameters
+static INLINE _glptr_GetBooleanv GET_GetBooleanv(struct _glapi_table *disp) {
+ return (_glptr_GetBooleanv) (GET_by_offset(disp, _gloffset_GetBooleanv));
+}
+
+static INLINE void SET_GetBooleanv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLboolean *)) {
+ SET_by_offset(disp, _gloffset_GetBooleanv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetClipPlane)(GLenum, GLdouble *);
+#define CALL_GetClipPlane(disp, parameters) \
+ (* GET_GetClipPlane(disp)) parameters
+static INLINE _glptr_GetClipPlane GET_GetClipPlane(struct _glapi_table *disp) {
+ return (_glptr_GetClipPlane) (GET_by_offset(disp, _gloffset_GetClipPlane));
+}
+
+static INLINE void SET_GetClipPlane(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetClipPlane, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetDoublev)(GLenum, GLdouble *);
+#define CALL_GetDoublev(disp, parameters) \
+ (* GET_GetDoublev(disp)) parameters
+static INLINE _glptr_GetDoublev GET_GetDoublev(struct _glapi_table *disp) {
+ return (_glptr_GetDoublev) (GET_by_offset(disp, _gloffset_GetDoublev));
+}
+
+static INLINE void SET_GetDoublev(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetDoublev, fn);
+}
+
+typedef GLenum (GLAPIENTRYP _glptr_GetError)(void);
+#define CALL_GetError(disp, parameters) \
+ (* GET_GetError(disp)) parameters
+static INLINE _glptr_GetError GET_GetError(struct _glapi_table *disp) {
+ return (_glptr_GetError) (GET_by_offset(disp, _gloffset_GetError));
+}
+
+static INLINE void SET_GetError(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_GetError, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetFloatv)(GLenum, GLfloat *);
+#define CALL_GetFloatv(disp, parameters) \
+ (* GET_GetFloatv(disp)) parameters
+static INLINE _glptr_GetFloatv GET_GetFloatv(struct _glapi_table *disp) {
+ return (_glptr_GetFloatv) (GET_by_offset(disp, _gloffset_GetFloatv));
+}
+
+static INLINE void SET_GetFloatv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetFloatv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetIntegerv)(GLenum, GLint *);
+#define CALL_GetIntegerv(disp, parameters) \
+ (* GET_GetIntegerv(disp)) parameters
+static INLINE _glptr_GetIntegerv GET_GetIntegerv(struct _glapi_table *disp) {
+ return (_glptr_GetIntegerv) (GET_by_offset(disp, _gloffset_GetIntegerv));
+}
+
+static INLINE void SET_GetIntegerv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetIntegerv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetLightfv)(GLenum, GLenum, GLfloat *);
+#define CALL_GetLightfv(disp, parameters) \
+ (* GET_GetLightfv(disp)) parameters
+static INLINE _glptr_GetLightfv GET_GetLightfv(struct _glapi_table *disp) {
+ return (_glptr_GetLightfv) (GET_by_offset(disp, _gloffset_GetLightfv));
+}
+
+static INLINE void SET_GetLightfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetLightfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetLightiv)(GLenum, GLenum, GLint *);
+#define CALL_GetLightiv(disp, parameters) \
+ (* GET_GetLightiv(disp)) parameters
+static INLINE _glptr_GetLightiv GET_GetLightiv(struct _glapi_table *disp) {
+ return (_glptr_GetLightiv) (GET_by_offset(disp, _gloffset_GetLightiv));
+}
+
+static INLINE void SET_GetLightiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetLightiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetMapdv)(GLenum, GLenum, GLdouble *);
+#define CALL_GetMapdv(disp, parameters) \
+ (* GET_GetMapdv(disp)) parameters
+static INLINE _glptr_GetMapdv GET_GetMapdv(struct _glapi_table *disp) {
+ return (_glptr_GetMapdv) (GET_by_offset(disp, _gloffset_GetMapdv));
+}
+
+static INLINE void SET_GetMapdv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetMapdv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetMapfv)(GLenum, GLenum, GLfloat *);
+#define CALL_GetMapfv(disp, parameters) \
+ (* GET_GetMapfv(disp)) parameters
+static INLINE _glptr_GetMapfv GET_GetMapfv(struct _glapi_table *disp) {
+ return (_glptr_GetMapfv) (GET_by_offset(disp, _gloffset_GetMapfv));
+}
+
+static INLINE void SET_GetMapfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetMapfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetMapiv)(GLenum, GLenum, GLint *);
+#define CALL_GetMapiv(disp, parameters) \
+ (* GET_GetMapiv(disp)) parameters
+static INLINE _glptr_GetMapiv GET_GetMapiv(struct _glapi_table *disp) {
+ return (_glptr_GetMapiv) (GET_by_offset(disp, _gloffset_GetMapiv));
+}
+
+static INLINE void SET_GetMapiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetMapiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetMaterialfv)(GLenum, GLenum, GLfloat *);
+#define CALL_GetMaterialfv(disp, parameters) \
+ (* GET_GetMaterialfv(disp)) parameters
+static INLINE _glptr_GetMaterialfv GET_GetMaterialfv(struct _glapi_table *disp) {
+ return (_glptr_GetMaterialfv) (GET_by_offset(disp, _gloffset_GetMaterialfv));
+}
+
+static INLINE void SET_GetMaterialfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetMaterialfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetMaterialiv)(GLenum, GLenum, GLint *);
+#define CALL_GetMaterialiv(disp, parameters) \
+ (* GET_GetMaterialiv(disp)) parameters
+static INLINE _glptr_GetMaterialiv GET_GetMaterialiv(struct _glapi_table *disp) {
+ return (_glptr_GetMaterialiv) (GET_by_offset(disp, _gloffset_GetMaterialiv));
+}
+
+static INLINE void SET_GetMaterialiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetMaterialiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetPixelMapfv)(GLenum, GLfloat *);
+#define CALL_GetPixelMapfv(disp, parameters) \
+ (* GET_GetPixelMapfv(disp)) parameters
+static INLINE _glptr_GetPixelMapfv GET_GetPixelMapfv(struct _glapi_table *disp) {
+ return (_glptr_GetPixelMapfv) (GET_by_offset(disp, _gloffset_GetPixelMapfv));
+}
+
+static INLINE void SET_GetPixelMapfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetPixelMapfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetPixelMapuiv)(GLenum, GLuint *);
+#define CALL_GetPixelMapuiv(disp, parameters) \
+ (* GET_GetPixelMapuiv(disp)) parameters
+static INLINE _glptr_GetPixelMapuiv GET_GetPixelMapuiv(struct _glapi_table *disp) {
+ return (_glptr_GetPixelMapuiv) (GET_by_offset(disp, _gloffset_GetPixelMapuiv));
+}
+
+static INLINE void SET_GetPixelMapuiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GetPixelMapuiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetPixelMapusv)(GLenum, GLushort *);
+#define CALL_GetPixelMapusv(disp, parameters) \
+ (* GET_GetPixelMapusv(disp)) parameters
+static INLINE _glptr_GetPixelMapusv GET_GetPixelMapusv(struct _glapi_table *disp) {
+ return (_glptr_GetPixelMapusv) (GET_by_offset(disp, _gloffset_GetPixelMapusv));
+}
+
+static INLINE void SET_GetPixelMapusv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLushort *)) {
+ SET_by_offset(disp, _gloffset_GetPixelMapusv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetPolygonStipple)(GLubyte *);
+#define CALL_GetPolygonStipple(disp, parameters) \
+ (* GET_GetPolygonStipple(disp)) parameters
+static INLINE _glptr_GetPolygonStipple GET_GetPolygonStipple(struct _glapi_table *disp) {
+ return (_glptr_GetPolygonStipple) (GET_by_offset(disp, _gloffset_GetPolygonStipple));
+}
+
+static INLINE void SET_GetPolygonStipple(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLubyte *)) {
+ SET_by_offset(disp, _gloffset_GetPolygonStipple, fn);
+}
+
+typedef const GLubyte * (GLAPIENTRYP _glptr_GetString)(GLenum);
+#define CALL_GetString(disp, parameters) \
+ (* GET_GetString(disp)) parameters
+static INLINE _glptr_GetString GET_GetString(struct _glapi_table *disp) {
+ return (_glptr_GetString) (GET_by_offset(disp, _gloffset_GetString));
+}
+
+static INLINE void SET_GetString(struct _glapi_table *disp, const GLubyte * (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_GetString, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexEnvfv)(GLenum, GLenum, GLfloat *);
+#define CALL_GetTexEnvfv(disp, parameters) \
+ (* GET_GetTexEnvfv(disp)) parameters
+static INLINE _glptr_GetTexEnvfv GET_GetTexEnvfv(struct _glapi_table *disp) {
+ return (_glptr_GetTexEnvfv) (GET_by_offset(disp, _gloffset_GetTexEnvfv));
+}
+
+static INLINE void SET_GetTexEnvfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetTexEnvfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexEnviv)(GLenum, GLenum, GLint *);
+#define CALL_GetTexEnviv(disp, parameters) \
+ (* GET_GetTexEnviv(disp)) parameters
+static INLINE _glptr_GetTexEnviv GET_GetTexEnviv(struct _glapi_table *disp) {
+ return (_glptr_GetTexEnviv) (GET_by_offset(disp, _gloffset_GetTexEnviv));
+}
+
+static INLINE void SET_GetTexEnviv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetTexEnviv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexGendv)(GLenum, GLenum, GLdouble *);
+#define CALL_GetTexGendv(disp, parameters) \
+ (* GET_GetTexGendv(disp)) parameters
+static INLINE _glptr_GetTexGendv GET_GetTexGendv(struct _glapi_table *disp) {
+ return (_glptr_GetTexGendv) (GET_by_offset(disp, _gloffset_GetTexGendv));
+}
+
+static INLINE void SET_GetTexGendv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetTexGendv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexGenfv)(GLenum, GLenum, GLfloat *);
+#define CALL_GetTexGenfv(disp, parameters) \
+ (* GET_GetTexGenfv(disp)) parameters
+static INLINE _glptr_GetTexGenfv GET_GetTexGenfv(struct _glapi_table *disp) {
+ return (_glptr_GetTexGenfv) (GET_by_offset(disp, _gloffset_GetTexGenfv));
+}
+
+static INLINE void SET_GetTexGenfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetTexGenfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexGeniv)(GLenum, GLenum, GLint *);
+#define CALL_GetTexGeniv(disp, parameters) \
+ (* GET_GetTexGeniv(disp)) parameters
+static INLINE _glptr_GetTexGeniv GET_GetTexGeniv(struct _glapi_table *disp) {
+ return (_glptr_GetTexGeniv) (GET_by_offset(disp, _gloffset_GetTexGeniv));
+}
+
+static INLINE void SET_GetTexGeniv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetTexGeniv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *);
+#define CALL_GetTexImage(disp, parameters) \
+ (* GET_GetTexImage(disp)) parameters
+static INLINE _glptr_GetTexImage GET_GetTexImage(struct _glapi_table *disp) {
+ return (_glptr_GetTexImage) (GET_by_offset(disp, _gloffset_GetTexImage));
+}
+
+static INLINE void SET_GetTexImage(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLenum, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetTexImage, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexParameterfv)(GLenum, GLenum, GLfloat *);
+#define CALL_GetTexParameterfv(disp, parameters) \
+ (* GET_GetTexParameterfv(disp)) parameters
+static INLINE _glptr_GetTexParameterfv GET_GetTexParameterfv(struct _glapi_table *disp) {
+ return (_glptr_GetTexParameterfv) (GET_by_offset(disp, _gloffset_GetTexParameterfv));
+}
+
+static INLINE void SET_GetTexParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetTexParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexParameteriv)(GLenum, GLenum, GLint *);
+#define CALL_GetTexParameteriv(disp, parameters) \
+ (* GET_GetTexParameteriv(disp)) parameters
+static INLINE _glptr_GetTexParameteriv GET_GetTexParameteriv(struct _glapi_table *disp) {
+ return (_glptr_GetTexParameteriv) (GET_by_offset(disp, _gloffset_GetTexParameteriv));
+}
+
+static INLINE void SET_GetTexParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetTexParameteriv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *);
+#define CALL_GetTexLevelParameterfv(disp, parameters) \
+ (* GET_GetTexLevelParameterfv(disp)) parameters
+static INLINE _glptr_GetTexLevelParameterfv GET_GetTexLevelParameterfv(struct _glapi_table *disp) {
+ return (_glptr_GetTexLevelParameterfv) (GET_by_offset(disp, _gloffset_GetTexLevelParameterfv));
+}
+
+static INLINE void SET_GetTexLevelParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetTexLevelParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
+#define CALL_GetTexLevelParameteriv(disp, parameters) \
+ (* GET_GetTexLevelParameteriv(disp)) parameters
+static INLINE _glptr_GetTexLevelParameteriv GET_GetTexLevelParameteriv(struct _glapi_table *disp) {
+ return (_glptr_GetTexLevelParameteriv) (GET_by_offset(disp, _gloffset_GetTexLevelParameteriv));
+}
+
+static INLINE void SET_GetTexLevelParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetTexLevelParameteriv, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsEnabled)(GLenum);
+#define CALL_IsEnabled(disp, parameters) \
+ (* GET_IsEnabled(disp)) parameters
+static INLINE _glptr_IsEnabled GET_IsEnabled(struct _glapi_table *disp) {
+ return (_glptr_IsEnabled) (GET_by_offset(disp, _gloffset_IsEnabled));
+}
+
+static INLINE void SET_IsEnabled(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_IsEnabled, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsList)(GLuint);
+#define CALL_IsList(disp, parameters) \
+ (* GET_IsList(disp)) parameters
+static INLINE _glptr_IsList GET_IsList(struct _glapi_table *disp) {
+ return (_glptr_IsList) (GET_by_offset(disp, _gloffset_IsList));
+}
+
+static INLINE void SET_IsList(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsList, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DepthRange)(GLclampd, GLclampd);
+#define CALL_DepthRange(disp, parameters) \
+ (* GET_DepthRange(disp)) parameters
+static INLINE _glptr_DepthRange GET_DepthRange(struct _glapi_table *disp) {
+ return (_glptr_DepthRange) (GET_by_offset(disp, _gloffset_DepthRange));
+}
+
+static INLINE void SET_DepthRange(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampd, GLclampd)) {
+ SET_by_offset(disp, _gloffset_DepthRange, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Frustum)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_Frustum(disp, parameters) \
+ (* GET_Frustum(disp)) parameters
+static INLINE _glptr_Frustum GET_Frustum(struct _glapi_table *disp) {
+ return (_glptr_Frustum) (GET_by_offset(disp, _gloffset_Frustum));
+}
+
+static INLINE void SET_Frustum(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Frustum, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LoadIdentity)(void);
+#define CALL_LoadIdentity(disp, parameters) \
+ (* GET_LoadIdentity(disp)) parameters
+static INLINE _glptr_LoadIdentity GET_LoadIdentity(struct _glapi_table *disp) {
+ return (_glptr_LoadIdentity) (GET_by_offset(disp, _gloffset_LoadIdentity));
+}
+
+static INLINE void SET_LoadIdentity(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_LoadIdentity, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LoadMatrixf)(const GLfloat *);
+#define CALL_LoadMatrixf(disp, parameters) \
+ (* GET_LoadMatrixf(disp)) parameters
+static INLINE _glptr_LoadMatrixf GET_LoadMatrixf(struct _glapi_table *disp) {
+ return (_glptr_LoadMatrixf) (GET_by_offset(disp, _gloffset_LoadMatrixf));
+}
+
+static INLINE void SET_LoadMatrixf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_LoadMatrixf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LoadMatrixd)(const GLdouble *);
+#define CALL_LoadMatrixd(disp, parameters) \
+ (* GET_LoadMatrixd(disp)) parameters
+static INLINE _glptr_LoadMatrixd GET_LoadMatrixd(struct _glapi_table *disp) {
+ return (_glptr_LoadMatrixd) (GET_by_offset(disp, _gloffset_LoadMatrixd));
+}
+
+static INLINE void SET_LoadMatrixd(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_LoadMatrixd, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MatrixMode)(GLenum);
+#define CALL_MatrixMode(disp, parameters) \
+ (* GET_MatrixMode(disp)) parameters
+static INLINE _glptr_MatrixMode GET_MatrixMode(struct _glapi_table *disp) {
+ return (_glptr_MatrixMode) (GET_by_offset(disp, _gloffset_MatrixMode));
+}
+
+static INLINE void SET_MatrixMode(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_MatrixMode, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultMatrixf)(const GLfloat *);
+#define CALL_MultMatrixf(disp, parameters) \
+ (* GET_MultMatrixf(disp)) parameters
+static INLINE _glptr_MultMatrixf GET_MultMatrixf(struct _glapi_table *disp) {
+ return (_glptr_MultMatrixf) (GET_by_offset(disp, _gloffset_MultMatrixf));
+}
+
+static INLINE void SET_MultMatrixf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_MultMatrixf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultMatrixd)(const GLdouble *);
+#define CALL_MultMatrixd(disp, parameters) \
+ (* GET_MultMatrixd(disp)) parameters
+static INLINE _glptr_MultMatrixd GET_MultMatrixd(struct _glapi_table *disp) {
+ return (_glptr_MultMatrixd) (GET_by_offset(disp, _gloffset_MultMatrixd));
+}
+
+static INLINE void SET_MultMatrixd(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_MultMatrixd, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Ortho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_Ortho(disp, parameters) \
+ (* GET_Ortho(disp)) parameters
+static INLINE _glptr_Ortho GET_Ortho(struct _glapi_table *disp) {
+ return (_glptr_Ortho) (GET_by_offset(disp, _gloffset_Ortho));
+}
+
+static INLINE void SET_Ortho(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Ortho, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PopMatrix)(void);
+#define CALL_PopMatrix(disp, parameters) \
+ (* GET_PopMatrix(disp)) parameters
+static INLINE _glptr_PopMatrix GET_PopMatrix(struct _glapi_table *disp) {
+ return (_glptr_PopMatrix) (GET_by_offset(disp, _gloffset_PopMatrix));
+}
+
+static INLINE void SET_PopMatrix(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_PopMatrix, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PushMatrix)(void);
+#define CALL_PushMatrix(disp, parameters) \
+ (* GET_PushMatrix(disp)) parameters
+static INLINE _glptr_PushMatrix GET_PushMatrix(struct _glapi_table *disp) {
+ return (_glptr_PushMatrix) (GET_by_offset(disp, _gloffset_PushMatrix));
+}
+
+static INLINE void SET_PushMatrix(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_PushMatrix, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Rotated)(GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_Rotated(disp, parameters) \
+ (* GET_Rotated(disp)) parameters
+static INLINE _glptr_Rotated GET_Rotated(struct _glapi_table *disp) {
+ return (_glptr_Rotated) (GET_by_offset(disp, _gloffset_Rotated));
+}
+
+static INLINE void SET_Rotated(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Rotated, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Rotatef)(GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_Rotatef(disp, parameters) \
+ (* GET_Rotatef(disp)) parameters
+static INLINE _glptr_Rotatef GET_Rotatef(struct _glapi_table *disp) {
+ return (_glptr_Rotatef) (GET_by_offset(disp, _gloffset_Rotatef));
+}
+
+static INLINE void SET_Rotatef(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Rotatef, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Scaled)(GLdouble, GLdouble, GLdouble);
+#define CALL_Scaled(disp, parameters) \
+ (* GET_Scaled(disp)) parameters
+static INLINE _glptr_Scaled GET_Scaled(struct _glapi_table *disp) {
+ return (_glptr_Scaled) (GET_by_offset(disp, _gloffset_Scaled));
+}
+
+static INLINE void SET_Scaled(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Scaled, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Scalef)(GLfloat, GLfloat, GLfloat);
+#define CALL_Scalef(disp, parameters) \
+ (* GET_Scalef(disp)) parameters
+static INLINE _glptr_Scalef GET_Scalef(struct _glapi_table *disp) {
+ return (_glptr_Scalef) (GET_by_offset(disp, _gloffset_Scalef));
+}
+
+static INLINE void SET_Scalef(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Scalef, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Translated)(GLdouble, GLdouble, GLdouble);
+#define CALL_Translated(disp, parameters) \
+ (* GET_Translated(disp)) parameters
+static INLINE _glptr_Translated GET_Translated(struct _glapi_table *disp) {
+ return (_glptr_Translated) (GET_by_offset(disp, _gloffset_Translated));
+}
+
+static INLINE void SET_Translated(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_Translated, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Translatef)(GLfloat, GLfloat, GLfloat);
+#define CALL_Translatef(disp, parameters) \
+ (* GET_Translatef(disp)) parameters
+static INLINE _glptr_Translatef GET_Translatef(struct _glapi_table *disp) {
+ return (_glptr_Translatef) (GET_by_offset(disp, _gloffset_Translatef));
+}
+
+static INLINE void SET_Translatef(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Translatef, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Viewport)(GLint, GLint, GLsizei, GLsizei);
+#define CALL_Viewport(disp, parameters) \
+ (* GET_Viewport(disp)) parameters
+static INLINE _glptr_Viewport GET_Viewport(struct _glapi_table *disp) {
+ return (_glptr_Viewport) (GET_by_offset(disp, _gloffset_Viewport));
+}
+
+static INLINE void SET_Viewport(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_Viewport, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ArrayElement)(GLint);
+#define CALL_ArrayElement(disp, parameters) \
+ (* GET_ArrayElement(disp)) parameters
+static INLINE _glptr_ArrayElement GET_ArrayElement(struct _glapi_table *disp) {
+ return (_glptr_ArrayElement) (GET_by_offset(disp, _gloffset_ArrayElement));
+}
+
+static INLINE void SET_ArrayElement(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint)) {
+ SET_by_offset(disp, _gloffset_ArrayElement, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindTexture)(GLenum, GLuint);
+#define CALL_BindTexture(disp, parameters) \
+ (* GET_BindTexture(disp)) parameters
+static INLINE _glptr_BindTexture GET_BindTexture(struct _glapi_table *disp) {
+ return (_glptr_BindTexture) (GET_by_offset(disp, _gloffset_BindTexture));
+}
+
+static INLINE void SET_BindTexture(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_BindTexture, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *);
+#define CALL_ColorPointer(disp, parameters) \
+ (* GET_ColorPointer(disp)) parameters
+static INLINE _glptr_ColorPointer GET_ColorPointer(struct _glapi_table *disp) {
+ return (_glptr_ColorPointer) (GET_by_offset(disp, _gloffset_ColorPointer));
+}
+
+static INLINE void SET_ColorPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_ColorPointer, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DisableClientState)(GLenum);
+#define CALL_DisableClientState(disp, parameters) \
+ (* GET_DisableClientState(disp)) parameters
+static INLINE _glptr_DisableClientState GET_DisableClientState(struct _glapi_table *disp) {
+ return (_glptr_DisableClientState) (GET_by_offset(disp, _gloffset_DisableClientState));
+}
+
+static INLINE void SET_DisableClientState(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_DisableClientState, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawArrays)(GLenum, GLint, GLsizei);
+#define CALL_DrawArrays(disp, parameters) \
+ (* GET_DrawArrays(disp)) parameters
+static INLINE _glptr_DrawArrays GET_DrawArrays(struct _glapi_table *disp) {
+ return (_glptr_DrawArrays) (GET_by_offset(disp, _gloffset_DrawArrays));
+}
+
+static INLINE void SET_DrawArrays(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLsizei)) {
+ SET_by_offset(disp, _gloffset_DrawArrays, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawElements)(GLenum, GLsizei, GLenum, const GLvoid *);
+#define CALL_DrawElements(disp, parameters) \
+ (* GET_DrawElements(disp)) parameters
+static INLINE _glptr_DrawElements GET_DrawElements(struct _glapi_table *disp) {
+ return (_glptr_DrawElements) (GET_by_offset(disp, _gloffset_DrawElements));
+}
+
+static INLINE void SET_DrawElements(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_DrawElements, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EdgeFlagPointer)(GLsizei, const GLvoid *);
+#define CALL_EdgeFlagPointer(disp, parameters) \
+ (* GET_EdgeFlagPointer(disp)) parameters
+static INLINE _glptr_EdgeFlagPointer GET_EdgeFlagPointer(struct _glapi_table *disp) {
+ return (_glptr_EdgeFlagPointer) (GET_by_offset(disp, _gloffset_EdgeFlagPointer));
+}
+
+static INLINE void SET_EdgeFlagPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_EdgeFlagPointer, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EnableClientState)(GLenum);
+#define CALL_EnableClientState(disp, parameters) \
+ (* GET_EnableClientState(disp)) parameters
+static INLINE _glptr_EnableClientState GET_EnableClientState(struct _glapi_table *disp) {
+ return (_glptr_EnableClientState) (GET_by_offset(disp, _gloffset_EnableClientState));
+}
+
+static INLINE void SET_EnableClientState(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_EnableClientState, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_IndexPointer)(GLenum, GLsizei, const GLvoid *);
+#define CALL_IndexPointer(disp, parameters) \
+ (* GET_IndexPointer(disp)) parameters
+static INLINE _glptr_IndexPointer GET_IndexPointer(struct _glapi_table *disp) {
+ return (_glptr_IndexPointer) (GET_by_offset(disp, _gloffset_IndexPointer));
+}
+
+static INLINE void SET_IndexPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_IndexPointer, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Indexub)(GLubyte);
+#define CALL_Indexub(disp, parameters) \
+ (* GET_Indexub(disp)) parameters
+static INLINE _glptr_Indexub GET_Indexub(struct _glapi_table *disp) {
+ return (_glptr_Indexub) (GET_by_offset(disp, _gloffset_Indexub));
+}
+
+static INLINE void SET_Indexub(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLubyte)) {
+ SET_by_offset(disp, _gloffset_Indexub, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Indexubv)(const GLubyte *);
+#define CALL_Indexubv(disp, parameters) \
+ (* GET_Indexubv(disp)) parameters
+static INLINE _glptr_Indexubv GET_Indexubv(struct _glapi_table *disp) {
+ return (_glptr_Indexubv) (GET_by_offset(disp, _gloffset_Indexubv));
+}
+
+static INLINE void SET_Indexubv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_Indexubv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_InterleavedArrays)(GLenum, GLsizei, const GLvoid *);
+#define CALL_InterleavedArrays(disp, parameters) \
+ (* GET_InterleavedArrays(disp)) parameters
+static INLINE _glptr_InterleavedArrays GET_InterleavedArrays(struct _glapi_table *disp) {
+ return (_glptr_InterleavedArrays) (GET_by_offset(disp, _gloffset_InterleavedArrays));
+}
+
+static INLINE void SET_InterleavedArrays(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_InterleavedArrays, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_NormalPointer)(GLenum, GLsizei, const GLvoid *);
+#define CALL_NormalPointer(disp, parameters) \
+ (* GET_NormalPointer(disp)) parameters
+static INLINE _glptr_NormalPointer GET_NormalPointer(struct _glapi_table *disp) {
+ return (_glptr_NormalPointer) (GET_by_offset(disp, _gloffset_NormalPointer));
+}
+
+static INLINE void SET_NormalPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_NormalPointer, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PolygonOffset)(GLfloat, GLfloat);
+#define CALL_PolygonOffset(disp, parameters) \
+ (* GET_PolygonOffset(disp)) parameters
+static INLINE _glptr_PolygonOffset GET_PolygonOffset(struct _glapi_table *disp) {
+ return (_glptr_PolygonOffset) (GET_by_offset(disp, _gloffset_PolygonOffset));
+}
+
+static INLINE void SET_PolygonOffset(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_PolygonOffset, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *);
+#define CALL_TexCoordPointer(disp, parameters) \
+ (* GET_TexCoordPointer(disp)) parameters
+static INLINE _glptr_TexCoordPointer GET_TexCoordPointer(struct _glapi_table *disp) {
+ return (_glptr_TexCoordPointer) (GET_by_offset(disp, _gloffset_TexCoordPointer));
+}
+
+static INLINE void SET_TexCoordPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_TexCoordPointer, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *);
+#define CALL_VertexPointer(disp, parameters) \
+ (* GET_VertexPointer(disp)) parameters
+static INLINE _glptr_VertexPointer GET_VertexPointer(struct _glapi_table *disp) {
+ return (_glptr_VertexPointer) (GET_by_offset(disp, _gloffset_VertexPointer));
+}
+
+static INLINE void SET_VertexPointer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_VertexPointer, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_AreTexturesResident)(GLsizei, const GLuint *, GLboolean *);
+#define CALL_AreTexturesResident(disp, parameters) \
+ (* GET_AreTexturesResident(disp)) parameters
+static INLINE _glptr_AreTexturesResident GET_AreTexturesResident(struct _glapi_table *disp) {
+ return (_glptr_AreTexturesResident) (GET_by_offset(disp, _gloffset_AreTexturesResident));
+}
+
+static INLINE void SET_AreTexturesResident(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLsizei, const GLuint *, GLboolean *)) {
+ SET_by_offset(disp, _gloffset_AreTexturesResident, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyTexImage1D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
+#define CALL_CopyTexImage1D(disp, parameters) \
+ (* GET_CopyTexImage1D(disp)) parameters
+static INLINE _glptr_CopyTexImage1D GET_CopyTexImage1D(struct _glapi_table *disp) {
+ return (_glptr_CopyTexImage1D) (GET_by_offset(disp, _gloffset_CopyTexImage1D));
+}
+
+static INLINE void SET_CopyTexImage1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint)) {
+ SET_by_offset(disp, _gloffset_CopyTexImage1D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
+#define CALL_CopyTexImage2D(disp, parameters) \
+ (* GET_CopyTexImage2D(disp)) parameters
+static INLINE _glptr_CopyTexImage2D GET_CopyTexImage2D(struct _glapi_table *disp) {
+ return (_glptr_CopyTexImage2D) (GET_by_offset(disp, _gloffset_CopyTexImage2D));
+}
+
+static INLINE void SET_CopyTexImage2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint)) {
+ SET_by_offset(disp, _gloffset_CopyTexImage2D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint, GLsizei);
+#define CALL_CopyTexSubImage1D(disp, parameters) \
+ (* GET_CopyTexSubImage1D(disp)) parameters
+static INLINE _glptr_CopyTexSubImage1D GET_CopyTexSubImage1D(struct _glapi_table *disp) {
+ return (_glptr_CopyTexSubImage1D) (GET_by_offset(disp, _gloffset_CopyTexSubImage1D));
+}
+
+static INLINE void SET_CopyTexSubImage1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLsizei)) {
+ SET_by_offset(disp, _gloffset_CopyTexSubImage1D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+#define CALL_CopyTexSubImage2D(disp, parameters) \
+ (* GET_CopyTexSubImage2D(disp)) parameters
+static INLINE _glptr_CopyTexSubImage2D GET_CopyTexSubImage2D(struct _glapi_table *disp) {
+ return (_glptr_CopyTexSubImage2D) (GET_by_offset(disp, _gloffset_CopyTexSubImage2D));
+}
+
+static INLINE void SET_CopyTexSubImage2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_CopyTexSubImage2D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteTextures)(GLsizei, const GLuint *);
+#define CALL_DeleteTextures(disp, parameters) \
+ (* GET_DeleteTextures(disp)) parameters
+static INLINE _glptr_DeleteTextures GET_DeleteTextures(struct _glapi_table *disp) {
+ return (_glptr_DeleteTextures) (GET_by_offset(disp, _gloffset_DeleteTextures));
+}
+
+static INLINE void SET_DeleteTextures(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_DeleteTextures, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenTextures)(GLsizei, GLuint *);
+#define CALL_GenTextures(disp, parameters) \
+ (* GET_GenTextures(disp)) parameters
+static INLINE _glptr_GenTextures GET_GenTextures(struct _glapi_table *disp) {
+ return (_glptr_GenTextures) (GET_by_offset(disp, _gloffset_GenTextures));
+}
+
+static INLINE void SET_GenTextures(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenTextures, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetPointerv)(GLenum, GLvoid **);
+#define CALL_GetPointerv(disp, parameters) \
+ (* GET_GetPointerv(disp)) parameters
+static INLINE _glptr_GetPointerv GET_GetPointerv(struct _glapi_table *disp) {
+ return (_glptr_GetPointerv) (GET_by_offset(disp, _gloffset_GetPointerv));
+}
+
+static INLINE void SET_GetPointerv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLvoid **)) {
+ SET_by_offset(disp, _gloffset_GetPointerv, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsTexture)(GLuint);
+#define CALL_IsTexture(disp, parameters) \
+ (* GET_IsTexture(disp)) parameters
+static INLINE _glptr_IsTexture GET_IsTexture(struct _glapi_table *disp) {
+ return (_glptr_IsTexture) (GET_by_offset(disp, _gloffset_IsTexture));
+}
+
+static INLINE void SET_IsTexture(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsTexture, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PrioritizeTextures)(GLsizei, const GLuint *, const GLclampf *);
+#define CALL_PrioritizeTextures(disp, parameters) \
+ (* GET_PrioritizeTextures(disp)) parameters
+static INLINE _glptr_PrioritizeTextures GET_PrioritizeTextures(struct _glapi_table *disp) {
+ return (_glptr_PrioritizeTextures) (GET_by_offset(disp, _gloffset_PrioritizeTextures));
+}
+
+static INLINE void SET_PrioritizeTextures(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *, const GLclampf *)) {
+ SET_by_offset(disp, _gloffset_PrioritizeTextures, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
+#define CALL_TexSubImage1D(disp, parameters) \
+ (* GET_TexSubImage1D(disp)) parameters
+static INLINE _glptr_TexSubImage1D GET_TexSubImage1D(struct _glapi_table *disp) {
+ return (_glptr_TexSubImage1D) (GET_by_offset(disp, _gloffset_TexSubImage1D));
+}
+
+static INLINE void SET_TexSubImage1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_TexSubImage1D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+#define CALL_TexSubImage2D(disp, parameters) \
+ (* GET_TexSubImage2D(disp)) parameters
+static INLINE _glptr_TexSubImage2D GET_TexSubImage2D(struct _glapi_table *disp) {
+ return (_glptr_TexSubImage2D) (GET_by_offset(disp, _gloffset_TexSubImage2D));
+}
+
+static INLINE void SET_TexSubImage2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_TexSubImage2D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PopClientAttrib)(void);
+#define CALL_PopClientAttrib(disp, parameters) \
+ (* GET_PopClientAttrib(disp)) parameters
+static INLINE _glptr_PopClientAttrib GET_PopClientAttrib(struct _glapi_table *disp) {
+ return (_glptr_PopClientAttrib) (GET_by_offset(disp, _gloffset_PopClientAttrib));
+}
+
+static INLINE void SET_PopClientAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_PopClientAttrib, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PushClientAttrib)(GLbitfield);
+#define CALL_PushClientAttrib(disp, parameters) \
+ (* GET_PushClientAttrib(disp)) parameters
+static INLINE _glptr_PushClientAttrib GET_PushClientAttrib(struct _glapi_table *disp) {
+ return (_glptr_PushClientAttrib) (GET_by_offset(disp, _gloffset_PushClientAttrib));
+}
+
+static INLINE void SET_PushClientAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbitfield)) {
+ SET_by_offset(disp, _gloffset_PushClientAttrib, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BlendColor)(GLclampf, GLclampf, GLclampf, GLclampf);
+#define CALL_BlendColor(disp, parameters) \
+ (* GET_BlendColor(disp)) parameters
+static INLINE _glptr_BlendColor GET_BlendColor(struct _glapi_table *disp) {
+ return (_glptr_BlendColor) (GET_by_offset(disp, _gloffset_BlendColor));
+}
+
+static INLINE void SET_BlendColor(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLclampf, GLclampf, GLclampf)) {
+ SET_by_offset(disp, _gloffset_BlendColor, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BlendEquation)(GLenum);
+#define CALL_BlendEquation(disp, parameters) \
+ (* GET_BlendEquation(disp)) parameters
+static INLINE _glptr_BlendEquation GET_BlendEquation(struct _glapi_table *disp) {
+ return (_glptr_BlendEquation) (GET_by_offset(disp, _gloffset_BlendEquation));
+}
+
+static INLINE void SET_BlendEquation(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_BlendEquation, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
+#define CALL_DrawRangeElements(disp, parameters) \
+ (* GET_DrawRangeElements(disp)) parameters
+static INLINE _glptr_DrawRangeElements GET_DrawRangeElements(struct _glapi_table *disp) {
+ return (_glptr_DrawRangeElements) (GET_by_offset(disp, _gloffset_DrawRangeElements));
+}
+
+static INLINE void SET_DrawRangeElements(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_DrawRangeElements, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorTable)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
+#define CALL_ColorTable(disp, parameters) \
+ (* GET_ColorTable(disp)) parameters
+static INLINE _glptr_ColorTable GET_ColorTable(struct _glapi_table *disp) {
+ return (_glptr_ColorTable) (GET_by_offset(disp, _gloffset_ColorTable));
+}
+
+static INLINE void SET_ColorTable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_ColorTable, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorTableParameterfv)(GLenum, GLenum, const GLfloat *);
+#define CALL_ColorTableParameterfv(disp, parameters) \
+ (* GET_ColorTableParameterfv(disp)) parameters
+static INLINE _glptr_ColorTableParameterfv GET_ColorTableParameterfv(struct _glapi_table *disp) {
+ return (_glptr_ColorTableParameterfv) (GET_by_offset(disp, _gloffset_ColorTableParameterfv));
+}
+
+static INLINE void SET_ColorTableParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_ColorTableParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorTableParameteriv)(GLenum, GLenum, const GLint *);
+#define CALL_ColorTableParameteriv(disp, parameters) \
+ (* GET_ColorTableParameteriv(disp)) parameters
+static INLINE _glptr_ColorTableParameteriv GET_ColorTableParameteriv(struct _glapi_table *disp) {
+ return (_glptr_ColorTableParameteriv) (GET_by_offset(disp, _gloffset_ColorTableParameteriv));
+}
+
+static INLINE void SET_ColorTableParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_ColorTableParameteriv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyColorTable)(GLenum, GLenum, GLint, GLint, GLsizei);
+#define CALL_CopyColorTable(disp, parameters) \
+ (* GET_CopyColorTable(disp)) parameters
+static INLINE _glptr_CopyColorTable GET_CopyColorTable(struct _glapi_table *disp) {
+ return (_glptr_CopyColorTable) (GET_by_offset(disp, _gloffset_CopyColorTable));
+}
+
+static INLINE void SET_CopyColorTable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint, GLint, GLsizei)) {
+ SET_by_offset(disp, _gloffset_CopyColorTable, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetColorTable)(GLenum, GLenum, GLenum, GLvoid *);
+#define CALL_GetColorTable(disp, parameters) \
+ (* GET_GetColorTable(disp)) parameters
+static INLINE _glptr_GetColorTable GET_GetColorTable(struct _glapi_table *disp) {
+ return (_glptr_GetColorTable) (GET_by_offset(disp, _gloffset_GetColorTable));
+}
+
+static INLINE void SET_GetColorTable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetColorTable, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetColorTableParameterfv)(GLenum, GLenum, GLfloat *);
+#define CALL_GetColorTableParameterfv(disp, parameters) \
+ (* GET_GetColorTableParameterfv(disp)) parameters
+static INLINE _glptr_GetColorTableParameterfv GET_GetColorTableParameterfv(struct _glapi_table *disp) {
+ return (_glptr_GetColorTableParameterfv) (GET_by_offset(disp, _gloffset_GetColorTableParameterfv));
+}
+
+static INLINE void SET_GetColorTableParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetColorTableParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetColorTableParameteriv)(GLenum, GLenum, GLint *);
+#define CALL_GetColorTableParameteriv(disp, parameters) \
+ (* GET_GetColorTableParameteriv(disp)) parameters
+static INLINE _glptr_GetColorTableParameteriv GET_GetColorTableParameteriv(struct _glapi_table *disp) {
+ return (_glptr_GetColorTableParameteriv) (GET_by_offset(disp, _gloffset_GetColorTableParameteriv));
+}
+
+static INLINE void SET_GetColorTableParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetColorTableParameteriv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorSubTable)(GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+#define CALL_ColorSubTable(disp, parameters) \
+ (* GET_ColorSubTable(disp)) parameters
+static INLINE _glptr_ColorSubTable GET_ColorSubTable(struct _glapi_table *disp) {
+ return (_glptr_ColorSubTable) (GET_by_offset(disp, _gloffset_ColorSubTable));
+}
+
+static INLINE void SET_ColorSubTable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_ColorSubTable, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyColorSubTable)(GLenum, GLsizei, GLint, GLint, GLsizei);
+#define CALL_CopyColorSubTable(disp, parameters) \
+ (* GET_CopyColorSubTable(disp)) parameters
+static INLINE _glptr_CopyColorSubTable GET_CopyColorSubTable(struct _glapi_table *disp) {
+ return (_glptr_CopyColorSubTable) (GET_by_offset(disp, _gloffset_CopyColorSubTable));
+}
+
+static INLINE void SET_CopyColorSubTable(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLint, GLint, GLsizei)) {
+ SET_by_offset(disp, _gloffset_CopyColorSubTable, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ConvolutionFilter1D)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
+#define CALL_ConvolutionFilter1D(disp, parameters) \
+ (* GET_ConvolutionFilter1D(disp)) parameters
+static INLINE _glptr_ConvolutionFilter1D GET_ConvolutionFilter1D(struct _glapi_table *disp) {
+ return (_glptr_ConvolutionFilter1D) (GET_by_offset(disp, _gloffset_ConvolutionFilter1D));
+}
+
+static INLINE void SET_ConvolutionFilter1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_ConvolutionFilter1D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ConvolutionFilter2D)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+#define CALL_ConvolutionFilter2D(disp, parameters) \
+ (* GET_ConvolutionFilter2D(disp)) parameters
+static INLINE _glptr_ConvolutionFilter2D GET_ConvolutionFilter2D(struct _glapi_table *disp) {
+ return (_glptr_ConvolutionFilter2D) (GET_by_offset(disp, _gloffset_ConvolutionFilter2D));
+}
+
+static INLINE void SET_ConvolutionFilter2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_ConvolutionFilter2D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ConvolutionParameterf)(GLenum, GLenum, GLfloat);
+#define CALL_ConvolutionParameterf(disp, parameters) \
+ (* GET_ConvolutionParameterf(disp)) parameters
+static INLINE _glptr_ConvolutionParameterf GET_ConvolutionParameterf(struct _glapi_table *disp) {
+ return (_glptr_ConvolutionParameterf) (GET_by_offset(disp, _gloffset_ConvolutionParameterf));
+}
+
+static INLINE void SET_ConvolutionParameterf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_ConvolutionParameterf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ConvolutionParameterfv)(GLenum, GLenum, const GLfloat *);
+#define CALL_ConvolutionParameterfv(disp, parameters) \
+ (* GET_ConvolutionParameterfv(disp)) parameters
+static INLINE _glptr_ConvolutionParameterfv GET_ConvolutionParameterfv(struct _glapi_table *disp) {
+ return (_glptr_ConvolutionParameterfv) (GET_by_offset(disp, _gloffset_ConvolutionParameterfv));
+}
+
+static INLINE void SET_ConvolutionParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_ConvolutionParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ConvolutionParameteri)(GLenum, GLenum, GLint);
+#define CALL_ConvolutionParameteri(disp, parameters) \
+ (* GET_ConvolutionParameteri(disp)) parameters
+static INLINE _glptr_ConvolutionParameteri GET_ConvolutionParameteri(struct _glapi_table *disp) {
+ return (_glptr_ConvolutionParameteri) (GET_by_offset(disp, _gloffset_ConvolutionParameteri));
+}
+
+static INLINE void SET_ConvolutionParameteri(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_ConvolutionParameteri, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ConvolutionParameteriv)(GLenum, GLenum, const GLint *);
+#define CALL_ConvolutionParameteriv(disp, parameters) \
+ (* GET_ConvolutionParameteriv(disp)) parameters
+static INLINE _glptr_ConvolutionParameteriv GET_ConvolutionParameteriv(struct _glapi_table *disp) {
+ return (_glptr_ConvolutionParameteriv) (GET_by_offset(disp, _gloffset_ConvolutionParameteriv));
+}
+
+static INLINE void SET_ConvolutionParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_ConvolutionParameteriv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyConvolutionFilter1D)(GLenum, GLenum, GLint, GLint, GLsizei);
+#define CALL_CopyConvolutionFilter1D(disp, parameters) \
+ (* GET_CopyConvolutionFilter1D(disp)) parameters
+static INLINE _glptr_CopyConvolutionFilter1D GET_CopyConvolutionFilter1D(struct _glapi_table *disp) {
+ return (_glptr_CopyConvolutionFilter1D) (GET_by_offset(disp, _gloffset_CopyConvolutionFilter1D));
+}
+
+static INLINE void SET_CopyConvolutionFilter1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint, GLint, GLsizei)) {
+ SET_by_offset(disp, _gloffset_CopyConvolutionFilter1D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyConvolutionFilter2D)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei);
+#define CALL_CopyConvolutionFilter2D(disp, parameters) \
+ (* GET_CopyConvolutionFilter2D(disp)) parameters
+static INLINE _glptr_CopyConvolutionFilter2D GET_CopyConvolutionFilter2D(struct _glapi_table *disp) {
+ return (_glptr_CopyConvolutionFilter2D) (GET_by_offset(disp, _gloffset_CopyConvolutionFilter2D));
+}
+
+static INLINE void SET_CopyConvolutionFilter2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_CopyConvolutionFilter2D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetConvolutionFilter)(GLenum, GLenum, GLenum, GLvoid *);
+#define CALL_GetConvolutionFilter(disp, parameters) \
+ (* GET_GetConvolutionFilter(disp)) parameters
+static INLINE _glptr_GetConvolutionFilter GET_GetConvolutionFilter(struct _glapi_table *disp) {
+ return (_glptr_GetConvolutionFilter) (GET_by_offset(disp, _gloffset_GetConvolutionFilter));
+}
+
+static INLINE void SET_GetConvolutionFilter(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetConvolutionFilter, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetConvolutionParameterfv)(GLenum, GLenum, GLfloat *);
+#define CALL_GetConvolutionParameterfv(disp, parameters) \
+ (* GET_GetConvolutionParameterfv(disp)) parameters
+static INLINE _glptr_GetConvolutionParameterfv GET_GetConvolutionParameterfv(struct _glapi_table *disp) {
+ return (_glptr_GetConvolutionParameterfv) (GET_by_offset(disp, _gloffset_GetConvolutionParameterfv));
+}
+
+static INLINE void SET_GetConvolutionParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetConvolutionParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetConvolutionParameteriv)(GLenum, GLenum, GLint *);
+#define CALL_GetConvolutionParameteriv(disp, parameters) \
+ (* GET_GetConvolutionParameteriv(disp)) parameters
+static INLINE _glptr_GetConvolutionParameteriv GET_GetConvolutionParameteriv(struct _glapi_table *disp) {
+ return (_glptr_GetConvolutionParameteriv) (GET_by_offset(disp, _gloffset_GetConvolutionParameteriv));
+}
+
+static INLINE void SET_GetConvolutionParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetConvolutionParameteriv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetSeparableFilter)(GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *);
+#define CALL_GetSeparableFilter(disp, parameters) \
+ (* GET_GetSeparableFilter(disp)) parameters
+static INLINE _glptr_GetSeparableFilter GET_GetSeparableFilter(struct _glapi_table *disp) {
+ return (_glptr_GetSeparableFilter) (GET_by_offset(disp, _gloffset_GetSeparableFilter));
+}
+
+static INLINE void SET_GetSeparableFilter(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetSeparableFilter, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SeparableFilter2D)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *);
+#define CALL_SeparableFilter2D(disp, parameters) \
+ (* GET_SeparableFilter2D(disp)) parameters
+static INLINE _glptr_SeparableFilter2D GET_SeparableFilter2D(struct _glapi_table *disp) {
+ return (_glptr_SeparableFilter2D) (GET_by_offset(disp, _gloffset_SeparableFilter2D));
+}
+
+static INLINE void SET_SeparableFilter2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_SeparableFilter2D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetHistogram)(GLenum, GLboolean, GLenum, GLenum, GLvoid *);
+#define CALL_GetHistogram(disp, parameters) \
+ (* GET_GetHistogram(disp)) parameters
+static INLINE _glptr_GetHistogram GET_GetHistogram(struct _glapi_table *disp) {
+ return (_glptr_GetHistogram) (GET_by_offset(disp, _gloffset_GetHistogram));
+}
+
+static INLINE void SET_GetHistogram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLboolean, GLenum, GLenum, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetHistogram, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetHistogramParameterfv)(GLenum, GLenum, GLfloat *);
+#define CALL_GetHistogramParameterfv(disp, parameters) \
+ (* GET_GetHistogramParameterfv(disp)) parameters
+static INLINE _glptr_GetHistogramParameterfv GET_GetHistogramParameterfv(struct _glapi_table *disp) {
+ return (_glptr_GetHistogramParameterfv) (GET_by_offset(disp, _gloffset_GetHistogramParameterfv));
+}
+
+static INLINE void SET_GetHistogramParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetHistogramParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetHistogramParameteriv)(GLenum, GLenum, GLint *);
+#define CALL_GetHistogramParameteriv(disp, parameters) \
+ (* GET_GetHistogramParameteriv(disp)) parameters
+static INLINE _glptr_GetHistogramParameteriv GET_GetHistogramParameteriv(struct _glapi_table *disp) {
+ return (_glptr_GetHistogramParameteriv) (GET_by_offset(disp, _gloffset_GetHistogramParameteriv));
+}
+
+static INLINE void SET_GetHistogramParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetHistogramParameteriv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetMinmax)(GLenum, GLboolean, GLenum, GLenum, GLvoid *);
+#define CALL_GetMinmax(disp, parameters) \
+ (* GET_GetMinmax(disp)) parameters
+static INLINE _glptr_GetMinmax GET_GetMinmax(struct _glapi_table *disp) {
+ return (_glptr_GetMinmax) (GET_by_offset(disp, _gloffset_GetMinmax));
+}
+
+static INLINE void SET_GetMinmax(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLboolean, GLenum, GLenum, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetMinmax, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetMinmaxParameterfv)(GLenum, GLenum, GLfloat *);
+#define CALL_GetMinmaxParameterfv(disp, parameters) \
+ (* GET_GetMinmaxParameterfv(disp)) parameters
+static INLINE _glptr_GetMinmaxParameterfv GET_GetMinmaxParameterfv(struct _glapi_table *disp) {
+ return (_glptr_GetMinmaxParameterfv) (GET_by_offset(disp, _gloffset_GetMinmaxParameterfv));
+}
+
+static INLINE void SET_GetMinmaxParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetMinmaxParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetMinmaxParameteriv)(GLenum, GLenum, GLint *);
+#define CALL_GetMinmaxParameteriv(disp, parameters) \
+ (* GET_GetMinmaxParameteriv(disp)) parameters
+static INLINE _glptr_GetMinmaxParameteriv GET_GetMinmaxParameteriv(struct _glapi_table *disp) {
+ return (_glptr_GetMinmaxParameteriv) (GET_by_offset(disp, _gloffset_GetMinmaxParameteriv));
+}
+
+static INLINE void SET_GetMinmaxParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetMinmaxParameteriv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Histogram)(GLenum, GLsizei, GLenum, GLboolean);
+#define CALL_Histogram(disp, parameters) \
+ (* GET_Histogram(disp)) parameters
+static INLINE _glptr_Histogram GET_Histogram(struct _glapi_table *disp) {
+ return (_glptr_Histogram) (GET_by_offset(disp, _gloffset_Histogram));
+}
+
+static INLINE void SET_Histogram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, GLboolean)) {
+ SET_by_offset(disp, _gloffset_Histogram, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Minmax)(GLenum, GLenum, GLboolean);
+#define CALL_Minmax(disp, parameters) \
+ (* GET_Minmax(disp)) parameters
+static INLINE _glptr_Minmax GET_Minmax(struct _glapi_table *disp) {
+ return (_glptr_Minmax) (GET_by_offset(disp, _gloffset_Minmax));
+}
+
+static INLINE void SET_Minmax(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLboolean)) {
+ SET_by_offset(disp, _gloffset_Minmax, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ResetHistogram)(GLenum);
+#define CALL_ResetHistogram(disp, parameters) \
+ (* GET_ResetHistogram(disp)) parameters
+static INLINE _glptr_ResetHistogram GET_ResetHistogram(struct _glapi_table *disp) {
+ return (_glptr_ResetHistogram) (GET_by_offset(disp, _gloffset_ResetHistogram));
+}
+
+static INLINE void SET_ResetHistogram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_ResetHistogram, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ResetMinmax)(GLenum);
+#define CALL_ResetMinmax(disp, parameters) \
+ (* GET_ResetMinmax(disp)) parameters
+static INLINE _glptr_ResetMinmax GET_ResetMinmax(struct _glapi_table *disp) {
+ return (_glptr_ResetMinmax) (GET_by_offset(disp, _gloffset_ResetMinmax));
+}
+
+static INLINE void SET_ResetMinmax(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_ResetMinmax, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+#define CALL_TexImage3D(disp, parameters) \
+ (* GET_TexImage3D(disp)) parameters
+static INLINE _glptr_TexImage3D GET_TexImage3D(struct _glapi_table *disp) {
+ return (_glptr_TexImage3D) (GET_by_offset(disp, _gloffset_TexImage3D));
+}
+
+static INLINE void SET_TexImage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_TexImage3D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+#define CALL_TexSubImage3D(disp, parameters) \
+ (* GET_TexSubImage3D(disp)) parameters
+static INLINE _glptr_TexSubImage3D GET_TexSubImage3D(struct _glapi_table *disp) {
+ return (_glptr_TexSubImage3D) (GET_by_offset(disp, _gloffset_TexSubImage3D));
+}
+
+static INLINE void SET_TexSubImage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_TexSubImage3D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+#define CALL_CopyTexSubImage3D(disp, parameters) \
+ (* GET_CopyTexSubImage3D(disp)) parameters
+static INLINE _glptr_CopyTexSubImage3D GET_CopyTexSubImage3D(struct _glapi_table *disp) {
+ return (_glptr_CopyTexSubImage3D) (GET_by_offset(disp, _gloffset_CopyTexSubImage3D));
+}
+
+static INLINE void SET_CopyTexSubImage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_CopyTexSubImage3D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ActiveTextureARB)(GLenum);
+#define CALL_ActiveTextureARB(disp, parameters) \
+ (* GET_ActiveTextureARB(disp)) parameters
+static INLINE _glptr_ActiveTextureARB GET_ActiveTextureARB(struct _glapi_table *disp) {
+ return (_glptr_ActiveTextureARB) (GET_by_offset(disp, _gloffset_ActiveTextureARB));
+}
+
+static INLINE void SET_ActiveTextureARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_ActiveTextureARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClientActiveTextureARB)(GLenum);
+#define CALL_ClientActiveTextureARB(disp, parameters) \
+ (* GET_ClientActiveTextureARB(disp)) parameters
+static INLINE _glptr_ClientActiveTextureARB GET_ClientActiveTextureARB(struct _glapi_table *disp) {
+ return (_glptr_ClientActiveTextureARB) (GET_by_offset(disp, _gloffset_ClientActiveTextureARB));
+}
+
+static INLINE void SET_ClientActiveTextureARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_ClientActiveTextureARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord1dARB)(GLenum, GLdouble);
+#define CALL_MultiTexCoord1dARB(disp, parameters) \
+ (* GET_MultiTexCoord1dARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord1dARB GET_MultiTexCoord1dARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord1dARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1dARB));
+}
+
+static INLINE void SET_MultiTexCoord1dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord1dARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord1dvARB)(GLenum, const GLdouble *);
+#define CALL_MultiTexCoord1dvARB(disp, parameters) \
+ (* GET_MultiTexCoord1dvARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord1dvARB GET_MultiTexCoord1dvARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord1dvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1dvARB));
+}
+
+static INLINE void SET_MultiTexCoord1dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord1dvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord1fARB)(GLenum, GLfloat);
+#define CALL_MultiTexCoord1fARB(disp, parameters) \
+ (* GET_MultiTexCoord1fARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord1fARB GET_MultiTexCoord1fARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord1fARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1fARB));
+}
+
+static INLINE void SET_MultiTexCoord1fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord1fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord1fvARB)(GLenum, const GLfloat *);
+#define CALL_MultiTexCoord1fvARB(disp, parameters) \
+ (* GET_MultiTexCoord1fvARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord1fvARB GET_MultiTexCoord1fvARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord1fvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1fvARB));
+}
+
+static INLINE void SET_MultiTexCoord1fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord1fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord1iARB)(GLenum, GLint);
+#define CALL_MultiTexCoord1iARB(disp, parameters) \
+ (* GET_MultiTexCoord1iARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord1iARB GET_MultiTexCoord1iARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord1iARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1iARB));
+}
+
+static INLINE void SET_MultiTexCoord1iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord1iARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord1ivARB)(GLenum, const GLint *);
+#define CALL_MultiTexCoord1ivARB(disp, parameters) \
+ (* GET_MultiTexCoord1ivARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord1ivARB GET_MultiTexCoord1ivARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord1ivARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1ivARB));
+}
+
+static INLINE void SET_MultiTexCoord1ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord1ivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord1sARB)(GLenum, GLshort);
+#define CALL_MultiTexCoord1sARB(disp, parameters) \
+ (* GET_MultiTexCoord1sARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord1sARB GET_MultiTexCoord1sARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord1sARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1sARB));
+}
+
+static INLINE void SET_MultiTexCoord1sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLshort)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord1sARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord1svARB)(GLenum, const GLshort *);
+#define CALL_MultiTexCoord1svARB(disp, parameters) \
+ (* GET_MultiTexCoord1svARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord1svARB GET_MultiTexCoord1svARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord1svARB) (GET_by_offset(disp, _gloffset_MultiTexCoord1svARB));
+}
+
+static INLINE void SET_MultiTexCoord1svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord1svARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord2dARB)(GLenum, GLdouble, GLdouble);
+#define CALL_MultiTexCoord2dARB(disp, parameters) \
+ (* GET_MultiTexCoord2dARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord2dARB GET_MultiTexCoord2dARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord2dARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2dARB));
+}
+
+static INLINE void SET_MultiTexCoord2dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord2dARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord2dvARB)(GLenum, const GLdouble *);
+#define CALL_MultiTexCoord2dvARB(disp, parameters) \
+ (* GET_MultiTexCoord2dvARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord2dvARB GET_MultiTexCoord2dvARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord2dvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2dvARB));
+}
+
+static INLINE void SET_MultiTexCoord2dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord2dvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord2fARB)(GLenum, GLfloat, GLfloat);
+#define CALL_MultiTexCoord2fARB(disp, parameters) \
+ (* GET_MultiTexCoord2fARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord2fARB GET_MultiTexCoord2fARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord2fARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2fARB));
+}
+
+static INLINE void SET_MultiTexCoord2fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord2fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord2fvARB)(GLenum, const GLfloat *);
+#define CALL_MultiTexCoord2fvARB(disp, parameters) \
+ (* GET_MultiTexCoord2fvARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord2fvARB GET_MultiTexCoord2fvARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord2fvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2fvARB));
+}
+
+static INLINE void SET_MultiTexCoord2fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord2fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord2iARB)(GLenum, GLint, GLint);
+#define CALL_MultiTexCoord2iARB(disp, parameters) \
+ (* GET_MultiTexCoord2iARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord2iARB GET_MultiTexCoord2iARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord2iARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2iARB));
+}
+
+static INLINE void SET_MultiTexCoord2iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord2iARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord2ivARB)(GLenum, const GLint *);
+#define CALL_MultiTexCoord2ivARB(disp, parameters) \
+ (* GET_MultiTexCoord2ivARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord2ivARB GET_MultiTexCoord2ivARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord2ivARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2ivARB));
+}
+
+static INLINE void SET_MultiTexCoord2ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord2ivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord2sARB)(GLenum, GLshort, GLshort);
+#define CALL_MultiTexCoord2sARB(disp, parameters) \
+ (* GET_MultiTexCoord2sARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord2sARB GET_MultiTexCoord2sARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord2sARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2sARB));
+}
+
+static INLINE void SET_MultiTexCoord2sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord2sARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord2svARB)(GLenum, const GLshort *);
+#define CALL_MultiTexCoord2svARB(disp, parameters) \
+ (* GET_MultiTexCoord2svARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord2svARB GET_MultiTexCoord2svARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord2svARB) (GET_by_offset(disp, _gloffset_MultiTexCoord2svARB));
+}
+
+static INLINE void SET_MultiTexCoord2svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord2svARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord3dARB)(GLenum, GLdouble, GLdouble, GLdouble);
+#define CALL_MultiTexCoord3dARB(disp, parameters) \
+ (* GET_MultiTexCoord3dARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord3dARB GET_MultiTexCoord3dARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord3dARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3dARB));
+}
+
+static INLINE void SET_MultiTexCoord3dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord3dARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord3dvARB)(GLenum, const GLdouble *);
+#define CALL_MultiTexCoord3dvARB(disp, parameters) \
+ (* GET_MultiTexCoord3dvARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord3dvARB GET_MultiTexCoord3dvARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord3dvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3dvARB));
+}
+
+static INLINE void SET_MultiTexCoord3dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord3dvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord3fARB)(GLenum, GLfloat, GLfloat, GLfloat);
+#define CALL_MultiTexCoord3fARB(disp, parameters) \
+ (* GET_MultiTexCoord3fARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord3fARB GET_MultiTexCoord3fARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord3fARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3fARB));
+}
+
+static INLINE void SET_MultiTexCoord3fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord3fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord3fvARB)(GLenum, const GLfloat *);
+#define CALL_MultiTexCoord3fvARB(disp, parameters) \
+ (* GET_MultiTexCoord3fvARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord3fvARB GET_MultiTexCoord3fvARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord3fvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3fvARB));
+}
+
+static INLINE void SET_MultiTexCoord3fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord3fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord3iARB)(GLenum, GLint, GLint, GLint);
+#define CALL_MultiTexCoord3iARB(disp, parameters) \
+ (* GET_MultiTexCoord3iARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord3iARB GET_MultiTexCoord3iARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord3iARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3iARB));
+}
+
+static INLINE void SET_MultiTexCoord3iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord3iARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord3ivARB)(GLenum, const GLint *);
+#define CALL_MultiTexCoord3ivARB(disp, parameters) \
+ (* GET_MultiTexCoord3ivARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord3ivARB GET_MultiTexCoord3ivARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord3ivARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3ivARB));
+}
+
+static INLINE void SET_MultiTexCoord3ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord3ivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord3sARB)(GLenum, GLshort, GLshort, GLshort);
+#define CALL_MultiTexCoord3sARB(disp, parameters) \
+ (* GET_MultiTexCoord3sARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord3sARB GET_MultiTexCoord3sARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord3sARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3sARB));
+}
+
+static INLINE void SET_MultiTexCoord3sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord3sARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord3svARB)(GLenum, const GLshort *);
+#define CALL_MultiTexCoord3svARB(disp, parameters) \
+ (* GET_MultiTexCoord3svARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord3svARB GET_MultiTexCoord3svARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord3svARB) (GET_by_offset(disp, _gloffset_MultiTexCoord3svARB));
+}
+
+static INLINE void SET_MultiTexCoord3svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord3svARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord4dARB)(GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_MultiTexCoord4dARB(disp, parameters) \
+ (* GET_MultiTexCoord4dARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord4dARB GET_MultiTexCoord4dARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord4dARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4dARB));
+}
+
+static INLINE void SET_MultiTexCoord4dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord4dARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord4dvARB)(GLenum, const GLdouble *);
+#define CALL_MultiTexCoord4dvARB(disp, parameters) \
+ (* GET_MultiTexCoord4dvARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord4dvARB GET_MultiTexCoord4dvARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord4dvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4dvARB));
+}
+
+static INLINE void SET_MultiTexCoord4dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord4dvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord4fARB)(GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_MultiTexCoord4fARB(disp, parameters) \
+ (* GET_MultiTexCoord4fARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord4fARB GET_MultiTexCoord4fARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord4fARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4fARB));
+}
+
+static INLINE void SET_MultiTexCoord4fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord4fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord4fvARB)(GLenum, const GLfloat *);
+#define CALL_MultiTexCoord4fvARB(disp, parameters) \
+ (* GET_MultiTexCoord4fvARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord4fvARB GET_MultiTexCoord4fvARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord4fvARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4fvARB));
+}
+
+static INLINE void SET_MultiTexCoord4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord4fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord4iARB)(GLenum, GLint, GLint, GLint, GLint);
+#define CALL_MultiTexCoord4iARB(disp, parameters) \
+ (* GET_MultiTexCoord4iARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord4iARB GET_MultiTexCoord4iARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord4iARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4iARB));
+}
+
+static INLINE void SET_MultiTexCoord4iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord4iARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord4ivARB)(GLenum, const GLint *);
+#define CALL_MultiTexCoord4ivARB(disp, parameters) \
+ (* GET_MultiTexCoord4ivARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord4ivARB GET_MultiTexCoord4ivARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord4ivARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4ivARB));
+}
+
+static INLINE void SET_MultiTexCoord4ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord4ivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord4sARB)(GLenum, GLshort, GLshort, GLshort, GLshort);
+#define CALL_MultiTexCoord4sARB(disp, parameters) \
+ (* GET_MultiTexCoord4sARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord4sARB GET_MultiTexCoord4sARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord4sARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4sARB));
+}
+
+static INLINE void SET_MultiTexCoord4sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLshort, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord4sARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoord4svARB)(GLenum, const GLshort *);
+#define CALL_MultiTexCoord4svARB(disp, parameters) \
+ (* GET_MultiTexCoord4svARB(disp)) parameters
+static INLINE _glptr_MultiTexCoord4svARB GET_MultiTexCoord4svARB(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoord4svARB) (GET_by_offset(disp, _gloffset_MultiTexCoord4svARB));
+}
+
+static INLINE void SET_MultiTexCoord4svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoord4svARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_AttachShader)(GLuint, GLuint);
+#define CALL_AttachShader(disp, parameters) \
+ (* GET_AttachShader(disp)) parameters
+static INLINE _glptr_AttachShader GET_AttachShader(struct _glapi_table *disp) {
+ return (_glptr_AttachShader) (GET_by_offset(disp, _gloffset_AttachShader));
+}
+
+static INLINE void SET_AttachShader(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_AttachShader, fn);
+}
+
+typedef GLuint (GLAPIENTRYP _glptr_CreateProgram)(void);
+#define CALL_CreateProgram(disp, parameters) \
+ (* GET_CreateProgram(disp)) parameters
+static INLINE _glptr_CreateProgram GET_CreateProgram(struct _glapi_table *disp) {
+ return (_glptr_CreateProgram) (GET_by_offset(disp, _gloffset_CreateProgram));
+}
+
+static INLINE void SET_CreateProgram(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_CreateProgram, fn);
+}
+
+typedef GLuint (GLAPIENTRYP _glptr_CreateShader)(GLenum);
+#define CALL_CreateShader(disp, parameters) \
+ (* GET_CreateShader(disp)) parameters
+static INLINE _glptr_CreateShader GET_CreateShader(struct _glapi_table *disp) {
+ return (_glptr_CreateShader) (GET_by_offset(disp, _gloffset_CreateShader));
+}
+
+static INLINE void SET_CreateShader(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_CreateShader, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteProgram)(GLuint);
+#define CALL_DeleteProgram(disp, parameters) \
+ (* GET_DeleteProgram(disp)) parameters
+static INLINE _glptr_DeleteProgram GET_DeleteProgram(struct _glapi_table *disp) {
+ return (_glptr_DeleteProgram) (GET_by_offset(disp, _gloffset_DeleteProgram));
+}
+
+static INLINE void SET_DeleteProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_DeleteProgram, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteShader)(GLuint);
+#define CALL_DeleteShader(disp, parameters) \
+ (* GET_DeleteShader(disp)) parameters
+static INLINE _glptr_DeleteShader GET_DeleteShader(struct _glapi_table *disp) {
+ return (_glptr_DeleteShader) (GET_by_offset(disp, _gloffset_DeleteShader));
+}
+
+static INLINE void SET_DeleteShader(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_DeleteShader, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DetachShader)(GLuint, GLuint);
+#define CALL_DetachShader(disp, parameters) \
+ (* GET_DetachShader(disp)) parameters
+static INLINE _glptr_DetachShader GET_DetachShader(struct _glapi_table *disp) {
+ return (_glptr_DetachShader) (GET_by_offset(disp, _gloffset_DetachShader));
+}
+
+static INLINE void SET_DetachShader(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_DetachShader, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetAttachedShaders)(GLuint, GLsizei, GLsizei *, GLuint *);
+#define CALL_GetAttachedShaders(disp, parameters) \
+ (* GET_GetAttachedShaders(disp)) parameters
+static INLINE _glptr_GetAttachedShaders GET_GetAttachedShaders(struct _glapi_table *disp) {
+ return (_glptr_GetAttachedShaders) (GET_by_offset(disp, _gloffset_GetAttachedShaders));
+}
+
+static INLINE void SET_GetAttachedShaders(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, GLsizei *, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GetAttachedShaders, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
+#define CALL_GetProgramInfoLog(disp, parameters) \
+ (* GET_GetProgramInfoLog(disp)) parameters
+static INLINE _glptr_GetProgramInfoLog GET_GetProgramInfoLog(struct _glapi_table *disp) {
+ return (_glptr_GetProgramInfoLog) (GET_by_offset(disp, _gloffset_GetProgramInfoLog));
+}
+
+static INLINE void SET_GetProgramInfoLog(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, GLsizei *, GLchar *)) {
+ SET_by_offset(disp, _gloffset_GetProgramInfoLog, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramiv)(GLuint, GLenum, GLint *);
+#define CALL_GetProgramiv(disp, parameters) \
+ (* GET_GetProgramiv(disp)) parameters
+static INLINE _glptr_GetProgramiv GET_GetProgramiv(struct _glapi_table *disp) {
+ return (_glptr_GetProgramiv) (GET_by_offset(disp, _gloffset_GetProgramiv));
+}
+
+static INLINE void SET_GetProgramiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetProgramiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
+#define CALL_GetShaderInfoLog(disp, parameters) \
+ (* GET_GetShaderInfoLog(disp)) parameters
+static INLINE _glptr_GetShaderInfoLog GET_GetShaderInfoLog(struct _glapi_table *disp) {
+ return (_glptr_GetShaderInfoLog) (GET_by_offset(disp, _gloffset_GetShaderInfoLog));
+}
+
+static INLINE void SET_GetShaderInfoLog(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, GLsizei *, GLchar *)) {
+ SET_by_offset(disp, _gloffset_GetShaderInfoLog, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetShaderiv)(GLuint, GLenum, GLint *);
+#define CALL_GetShaderiv(disp, parameters) \
+ (* GET_GetShaderiv(disp)) parameters
+static INLINE _glptr_GetShaderiv GET_GetShaderiv(struct _glapi_table *disp) {
+ return (_glptr_GetShaderiv) (GET_by_offset(disp, _gloffset_GetShaderiv));
+}
+
+static INLINE void SET_GetShaderiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetShaderiv, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsProgram)(GLuint);
+#define CALL_IsProgram(disp, parameters) \
+ (* GET_IsProgram(disp)) parameters
+static INLINE _glptr_IsProgram GET_IsProgram(struct _glapi_table *disp) {
+ return (_glptr_IsProgram) (GET_by_offset(disp, _gloffset_IsProgram));
+}
+
+static INLINE void SET_IsProgram(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsProgram, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsShader)(GLuint);
+#define CALL_IsShader(disp, parameters) \
+ (* GET_IsShader(disp)) parameters
+static INLINE _glptr_IsShader GET_IsShader(struct _glapi_table *disp) {
+ return (_glptr_IsShader) (GET_by_offset(disp, _gloffset_IsShader));
+}
+
+static INLINE void SET_IsShader(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsShader, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_StencilFuncSeparate)(GLenum, GLenum, GLint, GLuint);
+#define CALL_StencilFuncSeparate(disp, parameters) \
+ (* GET_StencilFuncSeparate(disp)) parameters
+static INLINE _glptr_StencilFuncSeparate GET_StencilFuncSeparate(struct _glapi_table *disp) {
+ return (_glptr_StencilFuncSeparate) (GET_by_offset(disp, _gloffset_StencilFuncSeparate));
+}
+
+static INLINE void SET_StencilFuncSeparate(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint, GLuint)) {
+ SET_by_offset(disp, _gloffset_StencilFuncSeparate, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_StencilMaskSeparate)(GLenum, GLuint);
+#define CALL_StencilMaskSeparate(disp, parameters) \
+ (* GET_StencilMaskSeparate(disp)) parameters
+static INLINE _glptr_StencilMaskSeparate GET_StencilMaskSeparate(struct _glapi_table *disp) {
+ return (_glptr_StencilMaskSeparate) (GET_by_offset(disp, _gloffset_StencilMaskSeparate));
+}
+
+static INLINE void SET_StencilMaskSeparate(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_StencilMaskSeparate, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_StencilOpSeparate)(GLenum, GLenum, GLenum, GLenum);
+#define CALL_StencilOpSeparate(disp, parameters) \
+ (* GET_StencilOpSeparate(disp)) parameters
+static INLINE _glptr_StencilOpSeparate GET_StencilOpSeparate(struct _glapi_table *disp) {
+ return (_glptr_StencilOpSeparate) (GET_by_offset(disp, _gloffset_StencilOpSeparate));
+}
+
+static INLINE void SET_StencilOpSeparate(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_StencilOpSeparate, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UniformMatrix2x3fv)(GLint, GLsizei, GLboolean, const GLfloat *);
+#define CALL_UniformMatrix2x3fv(disp, parameters) \
+ (* GET_UniformMatrix2x3fv(disp)) parameters
+static INLINE _glptr_UniformMatrix2x3fv GET_UniformMatrix2x3fv(struct _glapi_table *disp) {
+ return (_glptr_UniformMatrix2x3fv) (GET_by_offset(disp, _gloffset_UniformMatrix2x3fv));
+}
+
+static INLINE void SET_UniformMatrix2x3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_UniformMatrix2x3fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UniformMatrix2x4fv)(GLint, GLsizei, GLboolean, const GLfloat *);
+#define CALL_UniformMatrix2x4fv(disp, parameters) \
+ (* GET_UniformMatrix2x4fv(disp)) parameters
+static INLINE _glptr_UniformMatrix2x4fv GET_UniformMatrix2x4fv(struct _glapi_table *disp) {
+ return (_glptr_UniformMatrix2x4fv) (GET_by_offset(disp, _gloffset_UniformMatrix2x4fv));
+}
+
+static INLINE void SET_UniformMatrix2x4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_UniformMatrix2x4fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UniformMatrix3x2fv)(GLint, GLsizei, GLboolean, const GLfloat *);
+#define CALL_UniformMatrix3x2fv(disp, parameters) \
+ (* GET_UniformMatrix3x2fv(disp)) parameters
+static INLINE _glptr_UniformMatrix3x2fv GET_UniformMatrix3x2fv(struct _glapi_table *disp) {
+ return (_glptr_UniformMatrix3x2fv) (GET_by_offset(disp, _gloffset_UniformMatrix3x2fv));
+}
+
+static INLINE void SET_UniformMatrix3x2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_UniformMatrix3x2fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UniformMatrix3x4fv)(GLint, GLsizei, GLboolean, const GLfloat *);
+#define CALL_UniformMatrix3x4fv(disp, parameters) \
+ (* GET_UniformMatrix3x4fv(disp)) parameters
+static INLINE _glptr_UniformMatrix3x4fv GET_UniformMatrix3x4fv(struct _glapi_table *disp) {
+ return (_glptr_UniformMatrix3x4fv) (GET_by_offset(disp, _gloffset_UniformMatrix3x4fv));
+}
+
+static INLINE void SET_UniformMatrix3x4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_UniformMatrix3x4fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UniformMatrix4x2fv)(GLint, GLsizei, GLboolean, const GLfloat *);
+#define CALL_UniformMatrix4x2fv(disp, parameters) \
+ (* GET_UniformMatrix4x2fv(disp)) parameters
+static INLINE _glptr_UniformMatrix4x2fv GET_UniformMatrix4x2fv(struct _glapi_table *disp) {
+ return (_glptr_UniformMatrix4x2fv) (GET_by_offset(disp, _gloffset_UniformMatrix4x2fv));
+}
+
+static INLINE void SET_UniformMatrix4x2fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_UniformMatrix4x2fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UniformMatrix4x3fv)(GLint, GLsizei, GLboolean, const GLfloat *);
+#define CALL_UniformMatrix4x3fv(disp, parameters) \
+ (* GET_UniformMatrix4x3fv(disp)) parameters
+static INLINE _glptr_UniformMatrix4x3fv GET_UniformMatrix4x3fv(struct _glapi_table *disp) {
+ return (_glptr_UniformMatrix4x3fv) (GET_by_offset(disp, _gloffset_UniformMatrix4x3fv));
+}
+
+static INLINE void SET_UniformMatrix4x3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_UniformMatrix4x3fv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClampColor)(GLenum, GLenum);
+#define CALL_ClampColor(disp, parameters) \
+ (* GET_ClampColor(disp)) parameters
+static INLINE _glptr_ClampColor GET_ClampColor(struct _glapi_table *disp) {
+ return (_glptr_ClampColor) (GET_by_offset(disp, _gloffset_ClampColor));
+}
+
+static INLINE void SET_ClampColor(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_ClampColor, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearBufferfi)(GLenum, GLint, GLfloat, GLint);
+#define CALL_ClearBufferfi(disp, parameters) \
+ (* GET_ClearBufferfi(disp)) parameters
+static INLINE _glptr_ClearBufferfi GET_ClearBufferfi(struct _glapi_table *disp) {
+ return (_glptr_ClearBufferfi) (GET_by_offset(disp, _gloffset_ClearBufferfi));
+}
+
+static INLINE void SET_ClearBufferfi(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLfloat, GLint)) {
+ SET_by_offset(disp, _gloffset_ClearBufferfi, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearBufferfv)(GLenum, GLint, const GLfloat *);
+#define CALL_ClearBufferfv(disp, parameters) \
+ (* GET_ClearBufferfv(disp)) parameters
+static INLINE _glptr_ClearBufferfv GET_ClearBufferfv(struct _glapi_table *disp) {
+ return (_glptr_ClearBufferfv) (GET_by_offset(disp, _gloffset_ClearBufferfv));
+}
+
+static INLINE void SET_ClearBufferfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_ClearBufferfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearBufferiv)(GLenum, GLint, const GLint *);
+#define CALL_ClearBufferiv(disp, parameters) \
+ (* GET_ClearBufferiv(disp)) parameters
+static INLINE _glptr_ClearBufferiv GET_ClearBufferiv(struct _glapi_table *disp) {
+ return (_glptr_ClearBufferiv) (GET_by_offset(disp, _gloffset_ClearBufferiv));
+}
+
+static INLINE void SET_ClearBufferiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, const GLint *)) {
+ SET_by_offset(disp, _gloffset_ClearBufferiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearBufferuiv)(GLenum, GLint, const GLuint *);
+#define CALL_ClearBufferuiv(disp, parameters) \
+ (* GET_ClearBufferuiv(disp)) parameters
+static INLINE _glptr_ClearBufferuiv GET_ClearBufferuiv(struct _glapi_table *disp) {
+ return (_glptr_ClearBufferuiv) (GET_by_offset(disp, _gloffset_ClearBufferuiv));
+}
+
+static INLINE void SET_ClearBufferuiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_ClearBufferuiv, fn);
+}
+
+typedef const GLubyte * (GLAPIENTRYP _glptr_GetStringi)(GLenum, GLuint);
+#define CALL_GetStringi(disp, parameters) \
+ (* GET_GetStringi(disp)) parameters
+static INLINE _glptr_GetStringi GET_GetStringi(struct _glapi_table *disp) {
+ return (_glptr_GetStringi) (GET_by_offset(disp, _gloffset_GetStringi));
+}
+
+static INLINE void SET_GetStringi(struct _glapi_table *disp, const GLubyte * (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_GetStringi, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexBuffer)(GLenum, GLenum, GLuint);
+#define CALL_TexBuffer(disp, parameters) \
+ (* GET_TexBuffer(disp)) parameters
+static INLINE _glptr_TexBuffer GET_TexBuffer(struct _glapi_table *disp) {
+ return (_glptr_TexBuffer) (GET_by_offset(disp, _gloffset_TexBuffer));
+}
+
+static INLINE void SET_TexBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_TexBuffer, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FramebufferTexture)(GLenum, GLenum, GLuint, GLint);
+#define CALL_FramebufferTexture(disp, parameters) \
+ (* GET_FramebufferTexture(disp)) parameters
+static INLINE _glptr_FramebufferTexture GET_FramebufferTexture(struct _glapi_table *disp) {
+ return (_glptr_FramebufferTexture) (GET_by_offset(disp, _gloffset_FramebufferTexture));
+}
+
+static INLINE void SET_FramebufferTexture(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint, GLint)) {
+ SET_by_offset(disp, _gloffset_FramebufferTexture, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetBufferParameteri64v)(GLenum, GLenum, GLint64 *);
+#define CALL_GetBufferParameteri64v(disp, parameters) \
+ (* GET_GetBufferParameteri64v(disp)) parameters
+static INLINE _glptr_GetBufferParameteri64v GET_GetBufferParameteri64v(struct _glapi_table *disp) {
+ return (_glptr_GetBufferParameteri64v) (GET_by_offset(disp, _gloffset_GetBufferParameteri64v));
+}
+
+static INLINE void SET_GetBufferParameteri64v(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint64 *)) {
+ SET_by_offset(disp, _gloffset_GetBufferParameteri64v, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetInteger64i_v)(GLenum, GLuint, GLint64 *);
+#define CALL_GetInteger64i_v(disp, parameters) \
+ (* GET_GetInteger64i_v(disp)) parameters
+static INLINE _glptr_GetInteger64i_v GET_GetInteger64i_v(struct _glapi_table *disp) {
+ return (_glptr_GetInteger64i_v) (GET_by_offset(disp, _gloffset_GetInteger64i_v));
+}
+
+static INLINE void SET_GetInteger64i_v(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLint64 *)) {
+ SET_by_offset(disp, _gloffset_GetInteger64i_v, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribDivisor)(GLuint, GLuint);
+#define CALL_VertexAttribDivisor(disp, parameters) \
+ (* GET_VertexAttribDivisor(disp)) parameters
+static INLINE _glptr_VertexAttribDivisor GET_VertexAttribDivisor(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribDivisor) (GET_by_offset(disp, _gloffset_VertexAttribDivisor));
+}
+
+static INLINE void SET_VertexAttribDivisor(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribDivisor, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LoadTransposeMatrixdARB)(const GLdouble *);
+#define CALL_LoadTransposeMatrixdARB(disp, parameters) \
+ (* GET_LoadTransposeMatrixdARB(disp)) parameters
+static INLINE _glptr_LoadTransposeMatrixdARB GET_LoadTransposeMatrixdARB(struct _glapi_table *disp) {
+ return (_glptr_LoadTransposeMatrixdARB) (GET_by_offset(disp, _gloffset_LoadTransposeMatrixdARB));
+}
+
+static INLINE void SET_LoadTransposeMatrixdARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_LoadTransposeMatrixdARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LoadTransposeMatrixfARB)(const GLfloat *);
+#define CALL_LoadTransposeMatrixfARB(disp, parameters) \
+ (* GET_LoadTransposeMatrixfARB(disp)) parameters
+static INLINE _glptr_LoadTransposeMatrixfARB GET_LoadTransposeMatrixfARB(struct _glapi_table *disp) {
+ return (_glptr_LoadTransposeMatrixfARB) (GET_by_offset(disp, _gloffset_LoadTransposeMatrixfARB));
+}
+
+static INLINE void SET_LoadTransposeMatrixfARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_LoadTransposeMatrixfARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultTransposeMatrixdARB)(const GLdouble *);
+#define CALL_MultTransposeMatrixdARB(disp, parameters) \
+ (* GET_MultTransposeMatrixdARB(disp)) parameters
+static INLINE _glptr_MultTransposeMatrixdARB GET_MultTransposeMatrixdARB(struct _glapi_table *disp) {
+ return (_glptr_MultTransposeMatrixdARB) (GET_by_offset(disp, _gloffset_MultTransposeMatrixdARB));
+}
+
+static INLINE void SET_MultTransposeMatrixdARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_MultTransposeMatrixdARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultTransposeMatrixfARB)(const GLfloat *);
+#define CALL_MultTransposeMatrixfARB(disp, parameters) \
+ (* GET_MultTransposeMatrixfARB(disp)) parameters
+static INLINE _glptr_MultTransposeMatrixfARB GET_MultTransposeMatrixfARB(struct _glapi_table *disp) {
+ return (_glptr_MultTransposeMatrixfARB) (GET_by_offset(disp, _gloffset_MultTransposeMatrixfARB));
+}
+
+static INLINE void SET_MultTransposeMatrixfARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_MultTransposeMatrixfARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SampleCoverageARB)(GLclampf, GLboolean);
+#define CALL_SampleCoverageARB(disp, parameters) \
+ (* GET_SampleCoverageARB(disp)) parameters
+static INLINE _glptr_SampleCoverageARB GET_SampleCoverageARB(struct _glapi_table *disp) {
+ return (_glptr_SampleCoverageARB) (GET_by_offset(disp, _gloffset_SampleCoverageARB));
+}
+
+static INLINE void SET_SampleCoverageARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLboolean)) {
+ SET_by_offset(disp, _gloffset_SampleCoverageARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CompressedTexImage1DARB)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
+#define CALL_CompressedTexImage1DARB(disp, parameters) \
+ (* GET_CompressedTexImage1DARB(disp)) parameters
+static INLINE _glptr_CompressedTexImage1DARB GET_CompressedTexImage1DARB(struct _glapi_table *disp) {
+ return (_glptr_CompressedTexImage1DARB) (GET_by_offset(disp, _gloffset_CompressedTexImage1DARB));
+}
+
+static INLINE void SET_CompressedTexImage1DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_CompressedTexImage1DARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+#define CALL_CompressedTexImage2DARB(disp, parameters) \
+ (* GET_CompressedTexImage2DARB(disp)) parameters
+static INLINE _glptr_CompressedTexImage2DARB GET_CompressedTexImage2DARB(struct _glapi_table *disp) {
+ return (_glptr_CompressedTexImage2DARB) (GET_by_offset(disp, _gloffset_CompressedTexImage2DARB));
+}
+
+static INLINE void SET_CompressedTexImage2DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_CompressedTexImage2DARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CompressedTexImage3DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+#define CALL_CompressedTexImage3DARB(disp, parameters) \
+ (* GET_CompressedTexImage3DARB(disp)) parameters
+static INLINE _glptr_CompressedTexImage3DARB GET_CompressedTexImage3DARB(struct _glapi_table *disp) {
+ return (_glptr_CompressedTexImage3DARB) (GET_by_offset(disp, _gloffset_CompressedTexImage3DARB));
+}
+
+static INLINE void SET_CompressedTexImage3DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_CompressedTexImage3DARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage1DARB)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
+#define CALL_CompressedTexSubImage1DARB(disp, parameters) \
+ (* GET_CompressedTexSubImage1DARB(disp)) parameters
+static INLINE _glptr_CompressedTexSubImage1DARB GET_CompressedTexSubImage1DARB(struct _glapi_table *disp) {
+ return (_glptr_CompressedTexSubImage1DARB) (GET_by_offset(disp, _gloffset_CompressedTexSubImage1DARB));
+}
+
+static INLINE void SET_CompressedTexSubImage1DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_CompressedTexSubImage1DARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage2DARB)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+#define CALL_CompressedTexSubImage2DARB(disp, parameters) \
+ (* GET_CompressedTexSubImage2DARB(disp)) parameters
+static INLINE _glptr_CompressedTexSubImage2DARB GET_CompressedTexSubImage2DARB(struct _glapi_table *disp) {
+ return (_glptr_CompressedTexSubImage2DARB) (GET_by_offset(disp, _gloffset_CompressedTexSubImage2DARB));
+}
+
+static INLINE void SET_CompressedTexSubImage2DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_CompressedTexSubImage2DARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage3DARB)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+#define CALL_CompressedTexSubImage3DARB(disp, parameters) \
+ (* GET_CompressedTexSubImage3DARB(disp)) parameters
+static INLINE _glptr_CompressedTexSubImage3DARB GET_CompressedTexSubImage3DARB(struct _glapi_table *disp) {
+ return (_glptr_CompressedTexSubImage3DARB) (GET_by_offset(disp, _gloffset_CompressedTexSubImage3DARB));
+}
+
+static INLINE void SET_CompressedTexSubImage3DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_CompressedTexSubImage3DARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
+#define CALL_GetCompressedTexImageARB(disp, parameters) \
+ (* GET_GetCompressedTexImageARB(disp)) parameters
+static INLINE _glptr_GetCompressedTexImageARB GET_GetCompressedTexImageARB(struct _glapi_table *disp) {
+ return (_glptr_GetCompressedTexImageARB) (GET_by_offset(disp, _gloffset_GetCompressedTexImageARB));
+}
+
+static INLINE void SET_GetCompressedTexImageARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetCompressedTexImageARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DisableVertexAttribArrayARB)(GLuint);
+#define CALL_DisableVertexAttribArrayARB(disp, parameters) \
+ (* GET_DisableVertexAttribArrayARB(disp)) parameters
+static INLINE _glptr_DisableVertexAttribArrayARB GET_DisableVertexAttribArrayARB(struct _glapi_table *disp) {
+ return (_glptr_DisableVertexAttribArrayARB) (GET_by_offset(disp, _gloffset_DisableVertexAttribArrayARB));
+}
+
+static INLINE void SET_DisableVertexAttribArrayARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_DisableVertexAttribArrayARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EnableVertexAttribArrayARB)(GLuint);
+#define CALL_EnableVertexAttribArrayARB(disp, parameters) \
+ (* GET_EnableVertexAttribArrayARB(disp)) parameters
+static INLINE _glptr_EnableVertexAttribArrayARB GET_EnableVertexAttribArrayARB(struct _glapi_table *disp) {
+ return (_glptr_EnableVertexAttribArrayARB) (GET_by_offset(disp, _gloffset_EnableVertexAttribArrayARB));
+}
+
+static INLINE void SET_EnableVertexAttribArrayARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_EnableVertexAttribArrayARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramEnvParameterdvARB)(GLenum, GLuint, GLdouble *);
+#define CALL_GetProgramEnvParameterdvARB(disp, parameters) \
+ (* GET_GetProgramEnvParameterdvARB(disp)) parameters
+static INLINE _glptr_GetProgramEnvParameterdvARB GET_GetProgramEnvParameterdvARB(struct _glapi_table *disp) {
+ return (_glptr_GetProgramEnvParameterdvARB) (GET_by_offset(disp, _gloffset_GetProgramEnvParameterdvARB));
+}
+
+static INLINE void SET_GetProgramEnvParameterdvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetProgramEnvParameterdvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramEnvParameterfvARB)(GLenum, GLuint, GLfloat *);
+#define CALL_GetProgramEnvParameterfvARB(disp, parameters) \
+ (* GET_GetProgramEnvParameterfvARB(disp)) parameters
+static INLINE _glptr_GetProgramEnvParameterfvARB GET_GetProgramEnvParameterfvARB(struct _glapi_table *disp) {
+ return (_glptr_GetProgramEnvParameterfvARB) (GET_by_offset(disp, _gloffset_GetProgramEnvParameterfvARB));
+}
+
+static INLINE void SET_GetProgramEnvParameterfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetProgramEnvParameterfvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramLocalParameterdvARB)(GLenum, GLuint, GLdouble *);
+#define CALL_GetProgramLocalParameterdvARB(disp, parameters) \
+ (* GET_GetProgramLocalParameterdvARB(disp)) parameters
+static INLINE _glptr_GetProgramLocalParameterdvARB GET_GetProgramLocalParameterdvARB(struct _glapi_table *disp) {
+ return (_glptr_GetProgramLocalParameterdvARB) (GET_by_offset(disp, _gloffset_GetProgramLocalParameterdvARB));
+}
+
+static INLINE void SET_GetProgramLocalParameterdvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetProgramLocalParameterdvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramLocalParameterfvARB)(GLenum, GLuint, GLfloat *);
+#define CALL_GetProgramLocalParameterfvARB(disp, parameters) \
+ (* GET_GetProgramLocalParameterfvARB(disp)) parameters
+static INLINE _glptr_GetProgramLocalParameterfvARB GET_GetProgramLocalParameterfvARB(struct _glapi_table *disp) {
+ return (_glptr_GetProgramLocalParameterfvARB) (GET_by_offset(disp, _gloffset_GetProgramLocalParameterfvARB));
+}
+
+static INLINE void SET_GetProgramLocalParameterfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetProgramLocalParameterfvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramStringARB)(GLenum, GLenum, GLvoid *);
+#define CALL_GetProgramStringARB(disp, parameters) \
+ (* GET_GetProgramStringARB(disp)) parameters
+static INLINE _glptr_GetProgramStringARB GET_GetProgramStringARB(struct _glapi_table *disp) {
+ return (_glptr_GetProgramStringARB) (GET_by_offset(disp, _gloffset_GetProgramStringARB));
+}
+
+static INLINE void SET_GetProgramStringARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetProgramStringARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramivARB)(GLenum, GLenum, GLint *);
+#define CALL_GetProgramivARB(disp, parameters) \
+ (* GET_GetProgramivARB(disp)) parameters
+static INLINE _glptr_GetProgramivARB GET_GetProgramivARB(struct _glapi_table *disp) {
+ return (_glptr_GetProgramivARB) (GET_by_offset(disp, _gloffset_GetProgramivARB));
+}
+
+static INLINE void SET_GetProgramivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetProgramivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetVertexAttribdvARB)(GLuint, GLenum, GLdouble *);
+#define CALL_GetVertexAttribdvARB(disp, parameters) \
+ (* GET_GetVertexAttribdvARB(disp)) parameters
+static INLINE _glptr_GetVertexAttribdvARB GET_GetVertexAttribdvARB(struct _glapi_table *disp) {
+ return (_glptr_GetVertexAttribdvARB) (GET_by_offset(disp, _gloffset_GetVertexAttribdvARB));
+}
+
+static INLINE void SET_GetVertexAttribdvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetVertexAttribdvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetVertexAttribfvARB)(GLuint, GLenum, GLfloat *);
+#define CALL_GetVertexAttribfvARB(disp, parameters) \
+ (* GET_GetVertexAttribfvARB(disp)) parameters
+static INLINE _glptr_GetVertexAttribfvARB GET_GetVertexAttribfvARB(struct _glapi_table *disp) {
+ return (_glptr_GetVertexAttribfvARB) (GET_by_offset(disp, _gloffset_GetVertexAttribfvARB));
+}
+
+static INLINE void SET_GetVertexAttribfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetVertexAttribfvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetVertexAttribivARB)(GLuint, GLenum, GLint *);
+#define CALL_GetVertexAttribivARB(disp, parameters) \
+ (* GET_GetVertexAttribivARB(disp)) parameters
+static INLINE _glptr_GetVertexAttribivARB GET_GetVertexAttribivARB(struct _glapi_table *disp) {
+ return (_glptr_GetVertexAttribivARB) (GET_by_offset(disp, _gloffset_GetVertexAttribivARB));
+}
+
+static INLINE void SET_GetVertexAttribivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetVertexAttribivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4dARB)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_ProgramEnvParameter4dARB(disp, parameters) \
+ (* GET_ProgramEnvParameter4dARB(disp)) parameters
+static INLINE _glptr_ProgramEnvParameter4dARB GET_ProgramEnvParameter4dARB(struct _glapi_table *disp) {
+ return (_glptr_ProgramEnvParameter4dARB) (GET_by_offset(disp, _gloffset_ProgramEnvParameter4dARB));
+}
+
+static INLINE void SET_ProgramEnvParameter4dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_ProgramEnvParameter4dARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4dvARB)(GLenum, GLuint, const GLdouble *);
+#define CALL_ProgramEnvParameter4dvARB(disp, parameters) \
+ (* GET_ProgramEnvParameter4dvARB(disp)) parameters
+static INLINE _glptr_ProgramEnvParameter4dvARB GET_ProgramEnvParameter4dvARB(struct _glapi_table *disp) {
+ return (_glptr_ProgramEnvParameter4dvARB) (GET_by_offset(disp, _gloffset_ProgramEnvParameter4dvARB));
+}
+
+static INLINE void SET_ProgramEnvParameter4dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_ProgramEnvParameter4dvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4fARB)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_ProgramEnvParameter4fARB(disp, parameters) \
+ (* GET_ProgramEnvParameter4fARB(disp)) parameters
+static INLINE _glptr_ProgramEnvParameter4fARB GET_ProgramEnvParameter4fARB(struct _glapi_table *disp) {
+ return (_glptr_ProgramEnvParameter4fARB) (GET_by_offset(disp, _gloffset_ProgramEnvParameter4fARB));
+}
+
+static INLINE void SET_ProgramEnvParameter4fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_ProgramEnvParameter4fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4fvARB)(GLenum, GLuint, const GLfloat *);
+#define CALL_ProgramEnvParameter4fvARB(disp, parameters) \
+ (* GET_ProgramEnvParameter4fvARB(disp)) parameters
+static INLINE _glptr_ProgramEnvParameter4fvARB GET_ProgramEnvParameter4fvARB(struct _glapi_table *disp) {
+ return (_glptr_ProgramEnvParameter4fvARB) (GET_by_offset(disp, _gloffset_ProgramEnvParameter4fvARB));
+}
+
+static INLINE void SET_ProgramEnvParameter4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_ProgramEnvParameter4fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4dARB)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_ProgramLocalParameter4dARB(disp, parameters) \
+ (* GET_ProgramLocalParameter4dARB(disp)) parameters
+static INLINE _glptr_ProgramLocalParameter4dARB GET_ProgramLocalParameter4dARB(struct _glapi_table *disp) {
+ return (_glptr_ProgramLocalParameter4dARB) (GET_by_offset(disp, _gloffset_ProgramLocalParameter4dARB));
+}
+
+static INLINE void SET_ProgramLocalParameter4dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_ProgramLocalParameter4dARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4dvARB)(GLenum, GLuint, const GLdouble *);
+#define CALL_ProgramLocalParameter4dvARB(disp, parameters) \
+ (* GET_ProgramLocalParameter4dvARB(disp)) parameters
+static INLINE _glptr_ProgramLocalParameter4dvARB GET_ProgramLocalParameter4dvARB(struct _glapi_table *disp) {
+ return (_glptr_ProgramLocalParameter4dvARB) (GET_by_offset(disp, _gloffset_ProgramLocalParameter4dvARB));
+}
+
+static INLINE void SET_ProgramLocalParameter4dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_ProgramLocalParameter4dvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4fARB)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_ProgramLocalParameter4fARB(disp, parameters) \
+ (* GET_ProgramLocalParameter4fARB(disp)) parameters
+static INLINE _glptr_ProgramLocalParameter4fARB GET_ProgramLocalParameter4fARB(struct _glapi_table *disp) {
+ return (_glptr_ProgramLocalParameter4fARB) (GET_by_offset(disp, _gloffset_ProgramLocalParameter4fARB));
+}
+
+static INLINE void SET_ProgramLocalParameter4fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_ProgramLocalParameter4fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4fvARB)(GLenum, GLuint, const GLfloat *);
+#define CALL_ProgramLocalParameter4fvARB(disp, parameters) \
+ (* GET_ProgramLocalParameter4fvARB(disp)) parameters
+static INLINE _glptr_ProgramLocalParameter4fvARB GET_ProgramLocalParameter4fvARB(struct _glapi_table *disp) {
+ return (_glptr_ProgramLocalParameter4fvARB) (GET_by_offset(disp, _gloffset_ProgramLocalParameter4fvARB));
+}
+
+static INLINE void SET_ProgramLocalParameter4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_ProgramLocalParameter4fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramStringARB)(GLenum, GLenum, GLsizei, const GLvoid *);
+#define CALL_ProgramStringARB(disp, parameters) \
+ (* GET_ProgramStringARB(disp)) parameters
+static INLINE _glptr_ProgramStringARB GET_ProgramStringARB(struct _glapi_table *disp) {
+ return (_glptr_ProgramStringARB) (GET_by_offset(disp, _gloffset_ProgramStringARB));
+}
+
+static INLINE void SET_ProgramStringARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_ProgramStringARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1dARB)(GLuint, GLdouble);
+#define CALL_VertexAttrib1dARB(disp, parameters) \
+ (* GET_VertexAttrib1dARB(disp)) parameters
+static INLINE _glptr_VertexAttrib1dARB GET_VertexAttrib1dARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1dARB) (GET_by_offset(disp, _gloffset_VertexAttrib1dARB));
+}
+
+static INLINE void SET_VertexAttrib1dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1dARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1dvARB)(GLuint, const GLdouble *);
+#define CALL_VertexAttrib1dvARB(disp, parameters) \
+ (* GET_VertexAttrib1dvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib1dvARB GET_VertexAttrib1dvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1dvARB) (GET_by_offset(disp, _gloffset_VertexAttrib1dvARB));
+}
+
+static INLINE void SET_VertexAttrib1dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1dvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1fARB)(GLuint, GLfloat);
+#define CALL_VertexAttrib1fARB(disp, parameters) \
+ (* GET_VertexAttrib1fARB(disp)) parameters
+static INLINE _glptr_VertexAttrib1fARB GET_VertexAttrib1fARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1fARB) (GET_by_offset(disp, _gloffset_VertexAttrib1fARB));
+}
+
+static INLINE void SET_VertexAttrib1fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1fvARB)(GLuint, const GLfloat *);
+#define CALL_VertexAttrib1fvARB(disp, parameters) \
+ (* GET_VertexAttrib1fvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib1fvARB GET_VertexAttrib1fvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1fvARB) (GET_by_offset(disp, _gloffset_VertexAttrib1fvARB));
+}
+
+static INLINE void SET_VertexAttrib1fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1sARB)(GLuint, GLshort);
+#define CALL_VertexAttrib1sARB(disp, parameters) \
+ (* GET_VertexAttrib1sARB(disp)) parameters
+static INLINE _glptr_VertexAttrib1sARB GET_VertexAttrib1sARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1sARB) (GET_by_offset(disp, _gloffset_VertexAttrib1sARB));
+}
+
+static INLINE void SET_VertexAttrib1sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1sARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1svARB)(GLuint, const GLshort *);
+#define CALL_VertexAttrib1svARB(disp, parameters) \
+ (* GET_VertexAttrib1svARB(disp)) parameters
+static INLINE _glptr_VertexAttrib1svARB GET_VertexAttrib1svARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1svARB) (GET_by_offset(disp, _gloffset_VertexAttrib1svARB));
+}
+
+static INLINE void SET_VertexAttrib1svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1svARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2dARB)(GLuint, GLdouble, GLdouble);
+#define CALL_VertexAttrib2dARB(disp, parameters) \
+ (* GET_VertexAttrib2dARB(disp)) parameters
+static INLINE _glptr_VertexAttrib2dARB GET_VertexAttrib2dARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2dARB) (GET_by_offset(disp, _gloffset_VertexAttrib2dARB));
+}
+
+static INLINE void SET_VertexAttrib2dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2dARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2dvARB)(GLuint, const GLdouble *);
+#define CALL_VertexAttrib2dvARB(disp, parameters) \
+ (* GET_VertexAttrib2dvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib2dvARB GET_VertexAttrib2dvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2dvARB) (GET_by_offset(disp, _gloffset_VertexAttrib2dvARB));
+}
+
+static INLINE void SET_VertexAttrib2dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2dvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2fARB)(GLuint, GLfloat, GLfloat);
+#define CALL_VertexAttrib2fARB(disp, parameters) \
+ (* GET_VertexAttrib2fARB(disp)) parameters
+static INLINE _glptr_VertexAttrib2fARB GET_VertexAttrib2fARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2fARB) (GET_by_offset(disp, _gloffset_VertexAttrib2fARB));
+}
+
+static INLINE void SET_VertexAttrib2fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2fvARB)(GLuint, const GLfloat *);
+#define CALL_VertexAttrib2fvARB(disp, parameters) \
+ (* GET_VertexAttrib2fvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib2fvARB GET_VertexAttrib2fvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2fvARB) (GET_by_offset(disp, _gloffset_VertexAttrib2fvARB));
+}
+
+static INLINE void SET_VertexAttrib2fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2sARB)(GLuint, GLshort, GLshort);
+#define CALL_VertexAttrib2sARB(disp, parameters) \
+ (* GET_VertexAttrib2sARB(disp)) parameters
+static INLINE _glptr_VertexAttrib2sARB GET_VertexAttrib2sARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2sARB) (GET_by_offset(disp, _gloffset_VertexAttrib2sARB));
+}
+
+static INLINE void SET_VertexAttrib2sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2sARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2svARB)(GLuint, const GLshort *);
+#define CALL_VertexAttrib2svARB(disp, parameters) \
+ (* GET_VertexAttrib2svARB(disp)) parameters
+static INLINE _glptr_VertexAttrib2svARB GET_VertexAttrib2svARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2svARB) (GET_by_offset(disp, _gloffset_VertexAttrib2svARB));
+}
+
+static INLINE void SET_VertexAttrib2svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2svARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3dARB)(GLuint, GLdouble, GLdouble, GLdouble);
+#define CALL_VertexAttrib3dARB(disp, parameters) \
+ (* GET_VertexAttrib3dARB(disp)) parameters
+static INLINE _glptr_VertexAttrib3dARB GET_VertexAttrib3dARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3dARB) (GET_by_offset(disp, _gloffset_VertexAttrib3dARB));
+}
+
+static INLINE void SET_VertexAttrib3dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3dARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3dvARB)(GLuint, const GLdouble *);
+#define CALL_VertexAttrib3dvARB(disp, parameters) \
+ (* GET_VertexAttrib3dvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib3dvARB GET_VertexAttrib3dvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3dvARB) (GET_by_offset(disp, _gloffset_VertexAttrib3dvARB));
+}
+
+static INLINE void SET_VertexAttrib3dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3dvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3fARB)(GLuint, GLfloat, GLfloat, GLfloat);
+#define CALL_VertexAttrib3fARB(disp, parameters) \
+ (* GET_VertexAttrib3fARB(disp)) parameters
+static INLINE _glptr_VertexAttrib3fARB GET_VertexAttrib3fARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3fARB) (GET_by_offset(disp, _gloffset_VertexAttrib3fARB));
+}
+
+static INLINE void SET_VertexAttrib3fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3fvARB)(GLuint, const GLfloat *);
+#define CALL_VertexAttrib3fvARB(disp, parameters) \
+ (* GET_VertexAttrib3fvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib3fvARB GET_VertexAttrib3fvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3fvARB) (GET_by_offset(disp, _gloffset_VertexAttrib3fvARB));
+}
+
+static INLINE void SET_VertexAttrib3fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3sARB)(GLuint, GLshort, GLshort, GLshort);
+#define CALL_VertexAttrib3sARB(disp, parameters) \
+ (* GET_VertexAttrib3sARB(disp)) parameters
+static INLINE _glptr_VertexAttrib3sARB GET_VertexAttrib3sARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3sARB) (GET_by_offset(disp, _gloffset_VertexAttrib3sARB));
+}
+
+static INLINE void SET_VertexAttrib3sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3sARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3svARB)(GLuint, const GLshort *);
+#define CALL_VertexAttrib3svARB(disp, parameters) \
+ (* GET_VertexAttrib3svARB(disp)) parameters
+static INLINE _glptr_VertexAttrib3svARB GET_VertexAttrib3svARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3svARB) (GET_by_offset(disp, _gloffset_VertexAttrib3svARB));
+}
+
+static INLINE void SET_VertexAttrib3svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3svARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4NbvARB)(GLuint, const GLbyte *);
+#define CALL_VertexAttrib4NbvARB(disp, parameters) \
+ (* GET_VertexAttrib4NbvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4NbvARB GET_VertexAttrib4NbvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4NbvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NbvARB));
+}
+
+static INLINE void SET_VertexAttrib4NbvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLbyte *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4NbvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4NivARB)(GLuint, const GLint *);
+#define CALL_VertexAttrib4NivARB(disp, parameters) \
+ (* GET_VertexAttrib4NivARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4NivARB GET_VertexAttrib4NivARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4NivARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NivARB));
+}
+
+static INLINE void SET_VertexAttrib4NivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4NivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4NsvARB)(GLuint, const GLshort *);
+#define CALL_VertexAttrib4NsvARB(disp, parameters) \
+ (* GET_VertexAttrib4NsvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4NsvARB GET_VertexAttrib4NsvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4NsvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NsvARB));
+}
+
+static INLINE void SET_VertexAttrib4NsvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4NsvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4NubARB)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
+#define CALL_VertexAttrib4NubARB(disp, parameters) \
+ (* GET_VertexAttrib4NubARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4NubARB GET_VertexAttrib4NubARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4NubARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NubARB));
+}
+
+static INLINE void SET_VertexAttrib4NubARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4NubARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4NubvARB)(GLuint, const GLubyte *);
+#define CALL_VertexAttrib4NubvARB(disp, parameters) \
+ (* GET_VertexAttrib4NubvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4NubvARB GET_VertexAttrib4NubvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4NubvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NubvARB));
+}
+
+static INLINE void SET_VertexAttrib4NubvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4NubvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4NuivARB)(GLuint, const GLuint *);
+#define CALL_VertexAttrib4NuivARB(disp, parameters) \
+ (* GET_VertexAttrib4NuivARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4NuivARB GET_VertexAttrib4NuivARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4NuivARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NuivARB));
+}
+
+static INLINE void SET_VertexAttrib4NuivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4NuivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4NusvARB)(GLuint, const GLushort *);
+#define CALL_VertexAttrib4NusvARB(disp, parameters) \
+ (* GET_VertexAttrib4NusvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4NusvARB GET_VertexAttrib4NusvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4NusvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4NusvARB));
+}
+
+static INLINE void SET_VertexAttrib4NusvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLushort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4NusvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4bvARB)(GLuint, const GLbyte *);
+#define CALL_VertexAttrib4bvARB(disp, parameters) \
+ (* GET_VertexAttrib4bvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4bvARB GET_VertexAttrib4bvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4bvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4bvARB));
+}
+
+static INLINE void SET_VertexAttrib4bvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLbyte *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4bvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4dARB)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_VertexAttrib4dARB(disp, parameters) \
+ (* GET_VertexAttrib4dARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4dARB GET_VertexAttrib4dARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4dARB) (GET_by_offset(disp, _gloffset_VertexAttrib4dARB));
+}
+
+static INLINE void SET_VertexAttrib4dARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4dARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4dvARB)(GLuint, const GLdouble *);
+#define CALL_VertexAttrib4dvARB(disp, parameters) \
+ (* GET_VertexAttrib4dvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4dvARB GET_VertexAttrib4dvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4dvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4dvARB));
+}
+
+static INLINE void SET_VertexAttrib4dvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4dvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4fARB)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_VertexAttrib4fARB(disp, parameters) \
+ (* GET_VertexAttrib4fARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4fARB GET_VertexAttrib4fARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4fARB) (GET_by_offset(disp, _gloffset_VertexAttrib4fARB));
+}
+
+static INLINE void SET_VertexAttrib4fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4fvARB)(GLuint, const GLfloat *);
+#define CALL_VertexAttrib4fvARB(disp, parameters) \
+ (* GET_VertexAttrib4fvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4fvARB GET_VertexAttrib4fvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4fvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4fvARB));
+}
+
+static INLINE void SET_VertexAttrib4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4ivARB)(GLuint, const GLint *);
+#define CALL_VertexAttrib4ivARB(disp, parameters) \
+ (* GET_VertexAttrib4ivARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4ivARB GET_VertexAttrib4ivARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4ivARB) (GET_by_offset(disp, _gloffset_VertexAttrib4ivARB));
+}
+
+static INLINE void SET_VertexAttrib4ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4ivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4sARB)(GLuint, GLshort, GLshort, GLshort, GLshort);
+#define CALL_VertexAttrib4sARB(disp, parameters) \
+ (* GET_VertexAttrib4sARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4sARB GET_VertexAttrib4sARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4sARB) (GET_by_offset(disp, _gloffset_VertexAttrib4sARB));
+}
+
+static INLINE void SET_VertexAttrib4sARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4sARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4svARB)(GLuint, const GLshort *);
+#define CALL_VertexAttrib4svARB(disp, parameters) \
+ (* GET_VertexAttrib4svARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4svARB GET_VertexAttrib4svARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4svARB) (GET_by_offset(disp, _gloffset_VertexAttrib4svARB));
+}
+
+static INLINE void SET_VertexAttrib4svARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4svARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4ubvARB)(GLuint, const GLubyte *);
+#define CALL_VertexAttrib4ubvARB(disp, parameters) \
+ (* GET_VertexAttrib4ubvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4ubvARB GET_VertexAttrib4ubvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4ubvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4ubvARB));
+}
+
+static INLINE void SET_VertexAttrib4ubvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4ubvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4uivARB)(GLuint, const GLuint *);
+#define CALL_VertexAttrib4uivARB(disp, parameters) \
+ (* GET_VertexAttrib4uivARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4uivARB GET_VertexAttrib4uivARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4uivARB) (GET_by_offset(disp, _gloffset_VertexAttrib4uivARB));
+}
+
+static INLINE void SET_VertexAttrib4uivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4uivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4usvARB)(GLuint, const GLushort *);
+#define CALL_VertexAttrib4usvARB(disp, parameters) \
+ (* GET_VertexAttrib4usvARB(disp)) parameters
+static INLINE _glptr_VertexAttrib4usvARB GET_VertexAttrib4usvARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4usvARB) (GET_by_offset(disp, _gloffset_VertexAttrib4usvARB));
+}
+
+static INLINE void SET_VertexAttrib4usvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLushort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4usvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribPointerARB)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
+#define CALL_VertexAttribPointerARB(disp, parameters) \
+ (* GET_VertexAttribPointerARB(disp)) parameters
+static INLINE _glptr_VertexAttribPointerARB GET_VertexAttribPointerARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribPointerARB) (GET_by_offset(disp, _gloffset_VertexAttribPointerARB));
+}
+
+static INLINE void SET_VertexAttribPointerARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribPointerARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindBufferARB)(GLenum, GLuint);
+#define CALL_BindBufferARB(disp, parameters) \
+ (* GET_BindBufferARB(disp)) parameters
+static INLINE _glptr_BindBufferARB GET_BindBufferARB(struct _glapi_table *disp) {
+ return (_glptr_BindBufferARB) (GET_by_offset(disp, _gloffset_BindBufferARB));
+}
+
+static INLINE void SET_BindBufferARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_BindBufferARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BufferDataARB)(GLenum, GLsizeiptrARB, const GLvoid *, GLenum);
+#define CALL_BufferDataARB(disp, parameters) \
+ (* GET_BufferDataARB(disp)) parameters
+static INLINE _glptr_BufferDataARB GET_BufferDataARB(struct _glapi_table *disp) {
+ return (_glptr_BufferDataARB) (GET_by_offset(disp, _gloffset_BufferDataARB));
+}
+
+static INLINE void SET_BufferDataARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizeiptrARB, const GLvoid *, GLenum)) {
+ SET_by_offset(disp, _gloffset_BufferDataARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BufferSubDataARB)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *);
+#define CALL_BufferSubDataARB(disp, parameters) \
+ (* GET_BufferSubDataARB(disp)) parameters
+static INLINE _glptr_BufferSubDataARB GET_BufferSubDataARB(struct _glapi_table *disp) {
+ return (_glptr_BufferSubDataARB) (GET_by_offset(disp, _gloffset_BufferSubDataARB));
+}
+
+static INLINE void SET_BufferSubDataARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_BufferSubDataARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteBuffersARB)(GLsizei, const GLuint *);
+#define CALL_DeleteBuffersARB(disp, parameters) \
+ (* GET_DeleteBuffersARB(disp)) parameters
+static INLINE _glptr_DeleteBuffersARB GET_DeleteBuffersARB(struct _glapi_table *disp) {
+ return (_glptr_DeleteBuffersARB) (GET_by_offset(disp, _gloffset_DeleteBuffersARB));
+}
+
+static INLINE void SET_DeleteBuffersARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_DeleteBuffersARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenBuffersARB)(GLsizei, GLuint *);
+#define CALL_GenBuffersARB(disp, parameters) \
+ (* GET_GenBuffersARB(disp)) parameters
+static INLINE _glptr_GenBuffersARB GET_GenBuffersARB(struct _glapi_table *disp) {
+ return (_glptr_GenBuffersARB) (GET_by_offset(disp, _gloffset_GenBuffersARB));
+}
+
+static INLINE void SET_GenBuffersARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenBuffersARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetBufferParameterivARB)(GLenum, GLenum, GLint *);
+#define CALL_GetBufferParameterivARB(disp, parameters) \
+ (* GET_GetBufferParameterivARB(disp)) parameters
+static INLINE _glptr_GetBufferParameterivARB GET_GetBufferParameterivARB(struct _glapi_table *disp) {
+ return (_glptr_GetBufferParameterivARB) (GET_by_offset(disp, _gloffset_GetBufferParameterivARB));
+}
+
+static INLINE void SET_GetBufferParameterivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetBufferParameterivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetBufferPointervARB)(GLenum, GLenum, GLvoid **);
+#define CALL_GetBufferPointervARB(disp, parameters) \
+ (* GET_GetBufferPointervARB(disp)) parameters
+static INLINE _glptr_GetBufferPointervARB GET_GetBufferPointervARB(struct _glapi_table *disp) {
+ return (_glptr_GetBufferPointervARB) (GET_by_offset(disp, _gloffset_GetBufferPointervARB));
+}
+
+static INLINE void SET_GetBufferPointervARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLvoid **)) {
+ SET_by_offset(disp, _gloffset_GetBufferPointervARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetBufferSubDataARB)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *);
+#define CALL_GetBufferSubDataARB(disp, parameters) \
+ (* GET_GetBufferSubDataARB(disp)) parameters
+static INLINE _glptr_GetBufferSubDataARB GET_GetBufferSubDataARB(struct _glapi_table *disp) {
+ return (_glptr_GetBufferSubDataARB) (GET_by_offset(disp, _gloffset_GetBufferSubDataARB));
+}
+
+static INLINE void SET_GetBufferSubDataARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetBufferSubDataARB, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsBufferARB)(GLuint);
+#define CALL_IsBufferARB(disp, parameters) \
+ (* GET_IsBufferARB(disp)) parameters
+static INLINE _glptr_IsBufferARB GET_IsBufferARB(struct _glapi_table *disp) {
+ return (_glptr_IsBufferARB) (GET_by_offset(disp, _gloffset_IsBufferARB));
+}
+
+static INLINE void SET_IsBufferARB(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsBufferARB, fn);
+}
+
+typedef GLvoid * (GLAPIENTRYP _glptr_MapBufferARB)(GLenum, GLenum);
+#define CALL_MapBufferARB(disp, parameters) \
+ (* GET_MapBufferARB(disp)) parameters
+static INLINE _glptr_MapBufferARB GET_MapBufferARB(struct _glapi_table *disp) {
+ return (_glptr_MapBufferARB) (GET_by_offset(disp, _gloffset_MapBufferARB));
+}
+
+static INLINE void SET_MapBufferARB(struct _glapi_table *disp, GLvoid * (GLAPIENTRYP fn)(GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_MapBufferARB, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_UnmapBufferARB)(GLenum);
+#define CALL_UnmapBufferARB(disp, parameters) \
+ (* GET_UnmapBufferARB(disp)) parameters
+static INLINE _glptr_UnmapBufferARB GET_UnmapBufferARB(struct _glapi_table *disp) {
+ return (_glptr_UnmapBufferARB) (GET_by_offset(disp, _gloffset_UnmapBufferARB));
+}
+
+static INLINE void SET_UnmapBufferARB(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_UnmapBufferARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BeginQueryARB)(GLenum, GLuint);
+#define CALL_BeginQueryARB(disp, parameters) \
+ (* GET_BeginQueryARB(disp)) parameters
+static INLINE _glptr_BeginQueryARB GET_BeginQueryARB(struct _glapi_table *disp) {
+ return (_glptr_BeginQueryARB) (GET_by_offset(disp, _gloffset_BeginQueryARB));
+}
+
+static INLINE void SET_BeginQueryARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_BeginQueryARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteQueriesARB)(GLsizei, const GLuint *);
+#define CALL_DeleteQueriesARB(disp, parameters) \
+ (* GET_DeleteQueriesARB(disp)) parameters
+static INLINE _glptr_DeleteQueriesARB GET_DeleteQueriesARB(struct _glapi_table *disp) {
+ return (_glptr_DeleteQueriesARB) (GET_by_offset(disp, _gloffset_DeleteQueriesARB));
+}
+
+static INLINE void SET_DeleteQueriesARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_DeleteQueriesARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EndQueryARB)(GLenum);
+#define CALL_EndQueryARB(disp, parameters) \
+ (* GET_EndQueryARB(disp)) parameters
+static INLINE _glptr_EndQueryARB GET_EndQueryARB(struct _glapi_table *disp) {
+ return (_glptr_EndQueryARB) (GET_by_offset(disp, _gloffset_EndQueryARB));
+}
+
+static INLINE void SET_EndQueryARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_EndQueryARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenQueriesARB)(GLsizei, GLuint *);
+#define CALL_GenQueriesARB(disp, parameters) \
+ (* GET_GenQueriesARB(disp)) parameters
+static INLINE _glptr_GenQueriesARB GET_GenQueriesARB(struct _glapi_table *disp) {
+ return (_glptr_GenQueriesARB) (GET_by_offset(disp, _gloffset_GenQueriesARB));
+}
+
+static INLINE void SET_GenQueriesARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenQueriesARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetQueryObjectivARB)(GLuint, GLenum, GLint *);
+#define CALL_GetQueryObjectivARB(disp, parameters) \
+ (* GET_GetQueryObjectivARB(disp)) parameters
+static INLINE _glptr_GetQueryObjectivARB GET_GetQueryObjectivARB(struct _glapi_table *disp) {
+ return (_glptr_GetQueryObjectivARB) (GET_by_offset(disp, _gloffset_GetQueryObjectivARB));
+}
+
+static INLINE void SET_GetQueryObjectivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetQueryObjectivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetQueryObjectuivARB)(GLuint, GLenum, GLuint *);
+#define CALL_GetQueryObjectuivARB(disp, parameters) \
+ (* GET_GetQueryObjectuivARB(disp)) parameters
+static INLINE _glptr_GetQueryObjectuivARB GET_GetQueryObjectuivARB(struct _glapi_table *disp) {
+ return (_glptr_GetQueryObjectuivARB) (GET_by_offset(disp, _gloffset_GetQueryObjectuivARB));
+}
+
+static INLINE void SET_GetQueryObjectuivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GetQueryObjectuivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetQueryivARB)(GLenum, GLenum, GLint *);
+#define CALL_GetQueryivARB(disp, parameters) \
+ (* GET_GetQueryivARB(disp)) parameters
+static INLINE _glptr_GetQueryivARB GET_GetQueryivARB(struct _glapi_table *disp) {
+ return (_glptr_GetQueryivARB) (GET_by_offset(disp, _gloffset_GetQueryivARB));
+}
+
+static INLINE void SET_GetQueryivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetQueryivARB, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsQueryARB)(GLuint);
+#define CALL_IsQueryARB(disp, parameters) \
+ (* GET_IsQueryARB(disp)) parameters
+static INLINE _glptr_IsQueryARB GET_IsQueryARB(struct _glapi_table *disp) {
+ return (_glptr_IsQueryARB) (GET_by_offset(disp, _gloffset_IsQueryARB));
+}
+
+static INLINE void SET_IsQueryARB(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsQueryARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_AttachObjectARB)(GLhandleARB, GLhandleARB);
+#define CALL_AttachObjectARB(disp, parameters) \
+ (* GET_AttachObjectARB(disp)) parameters
+static INLINE _glptr_AttachObjectARB GET_AttachObjectARB(struct _glapi_table *disp) {
+ return (_glptr_AttachObjectARB) (GET_by_offset(disp, _gloffset_AttachObjectARB));
+}
+
+static INLINE void SET_AttachObjectARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLhandleARB)) {
+ SET_by_offset(disp, _gloffset_AttachObjectARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CompileShaderARB)(GLhandleARB);
+#define CALL_CompileShaderARB(disp, parameters) \
+ (* GET_CompileShaderARB(disp)) parameters
+static INLINE _glptr_CompileShaderARB GET_CompileShaderARB(struct _glapi_table *disp) {
+ return (_glptr_CompileShaderARB) (GET_by_offset(disp, _gloffset_CompileShaderARB));
+}
+
+static INLINE void SET_CompileShaderARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB)) {
+ SET_by_offset(disp, _gloffset_CompileShaderARB, fn);
+}
+
+typedef GLhandleARB (GLAPIENTRYP _glptr_CreateProgramObjectARB)(void);
+#define CALL_CreateProgramObjectARB(disp, parameters) \
+ (* GET_CreateProgramObjectARB(disp)) parameters
+static INLINE _glptr_CreateProgramObjectARB GET_CreateProgramObjectARB(struct _glapi_table *disp) {
+ return (_glptr_CreateProgramObjectARB) (GET_by_offset(disp, _gloffset_CreateProgramObjectARB));
+}
+
+static INLINE void SET_CreateProgramObjectARB(struct _glapi_table *disp, GLhandleARB (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_CreateProgramObjectARB, fn);
+}
+
+typedef GLhandleARB (GLAPIENTRYP _glptr_CreateShaderObjectARB)(GLenum);
+#define CALL_CreateShaderObjectARB(disp, parameters) \
+ (* GET_CreateShaderObjectARB(disp)) parameters
+static INLINE _glptr_CreateShaderObjectARB GET_CreateShaderObjectARB(struct _glapi_table *disp) {
+ return (_glptr_CreateShaderObjectARB) (GET_by_offset(disp, _gloffset_CreateShaderObjectARB));
+}
+
+static INLINE void SET_CreateShaderObjectARB(struct _glapi_table *disp, GLhandleARB (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_CreateShaderObjectARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteObjectARB)(GLhandleARB);
+#define CALL_DeleteObjectARB(disp, parameters) \
+ (* GET_DeleteObjectARB(disp)) parameters
+static INLINE _glptr_DeleteObjectARB GET_DeleteObjectARB(struct _glapi_table *disp) {
+ return (_glptr_DeleteObjectARB) (GET_by_offset(disp, _gloffset_DeleteObjectARB));
+}
+
+static INLINE void SET_DeleteObjectARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB)) {
+ SET_by_offset(disp, _gloffset_DeleteObjectARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DetachObjectARB)(GLhandleARB, GLhandleARB);
+#define CALL_DetachObjectARB(disp, parameters) \
+ (* GET_DetachObjectARB(disp)) parameters
+static INLINE _glptr_DetachObjectARB GET_DetachObjectARB(struct _glapi_table *disp) {
+ return (_glptr_DetachObjectARB) (GET_by_offset(disp, _gloffset_DetachObjectARB));
+}
+
+static INLINE void SET_DetachObjectARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLhandleARB)) {
+ SET_by_offset(disp, _gloffset_DetachObjectARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetActiveUniformARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
+#define CALL_GetActiveUniformARB(disp, parameters) \
+ (* GET_GetActiveUniformARB(disp)) parameters
+static INLINE _glptr_GetActiveUniformARB GET_GetActiveUniformARB(struct _glapi_table *disp) {
+ return (_glptr_GetActiveUniformARB) (GET_by_offset(disp, _gloffset_GetActiveUniformARB));
+}
+
+static INLINE void SET_GetActiveUniformARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)) {
+ SET_by_offset(disp, _gloffset_GetActiveUniformARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetAttachedObjectsARB)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
+#define CALL_GetAttachedObjectsARB(disp, parameters) \
+ (* GET_GetAttachedObjectsARB(disp)) parameters
+static INLINE _glptr_GetAttachedObjectsARB GET_GetAttachedObjectsARB(struct _glapi_table *disp) {
+ return (_glptr_GetAttachedObjectsARB) (GET_by_offset(disp, _gloffset_GetAttachedObjectsARB));
+}
+
+static INLINE void SET_GetAttachedObjectsARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *)) {
+ SET_by_offset(disp, _gloffset_GetAttachedObjectsARB, fn);
+}
+
+typedef GLhandleARB (GLAPIENTRYP _glptr_GetHandleARB)(GLenum);
+#define CALL_GetHandleARB(disp, parameters) \
+ (* GET_GetHandleARB(disp)) parameters
+static INLINE _glptr_GetHandleARB GET_GetHandleARB(struct _glapi_table *disp) {
+ return (_glptr_GetHandleARB) (GET_by_offset(disp, _gloffset_GetHandleARB));
+}
+
+static INLINE void SET_GetHandleARB(struct _glapi_table *disp, GLhandleARB (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_GetHandleARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetInfoLogARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
+#define CALL_GetInfoLogARB(disp, parameters) \
+ (* GET_GetInfoLogARB(disp)) parameters
+static INLINE _glptr_GetInfoLogARB GET_GetInfoLogARB(struct _glapi_table *disp) {
+ return (_glptr_GetInfoLogARB) (GET_by_offset(disp, _gloffset_GetInfoLogARB));
+}
+
+static INLINE void SET_GetInfoLogARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)) {
+ SET_by_offset(disp, _gloffset_GetInfoLogARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetObjectParameterfvARB)(GLhandleARB, GLenum, GLfloat *);
+#define CALL_GetObjectParameterfvARB(disp, parameters) \
+ (* GET_GetObjectParameterfvARB(disp)) parameters
+static INLINE _glptr_GetObjectParameterfvARB GET_GetObjectParameterfvARB(struct _glapi_table *disp) {
+ return (_glptr_GetObjectParameterfvARB) (GET_by_offset(disp, _gloffset_GetObjectParameterfvARB));
+}
+
+static INLINE void SET_GetObjectParameterfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetObjectParameterfvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetObjectParameterivARB)(GLhandleARB, GLenum, GLint *);
+#define CALL_GetObjectParameterivARB(disp, parameters) \
+ (* GET_GetObjectParameterivARB(disp)) parameters
+static INLINE _glptr_GetObjectParameterivARB GET_GetObjectParameterivARB(struct _glapi_table *disp) {
+ return (_glptr_GetObjectParameterivARB) (GET_by_offset(disp, _gloffset_GetObjectParameterivARB));
+}
+
+static INLINE void SET_GetObjectParameterivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetObjectParameterivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetShaderSourceARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
+#define CALL_GetShaderSourceARB(disp, parameters) \
+ (* GET_GetShaderSourceARB(disp)) parameters
+static INLINE _glptr_GetShaderSourceARB GET_GetShaderSourceARB(struct _glapi_table *disp) {
+ return (_glptr_GetShaderSourceARB) (GET_by_offset(disp, _gloffset_GetShaderSourceARB));
+}
+
+static INLINE void SET_GetShaderSourceARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)) {
+ SET_by_offset(disp, _gloffset_GetShaderSourceARB, fn);
+}
+
+typedef GLint (GLAPIENTRYP _glptr_GetUniformLocationARB)(GLhandleARB, const GLcharARB *);
+#define CALL_GetUniformLocationARB(disp, parameters) \
+ (* GET_GetUniformLocationARB(disp)) parameters
+static INLINE _glptr_GetUniformLocationARB GET_GetUniformLocationARB(struct _glapi_table *disp) {
+ return (_glptr_GetUniformLocationARB) (GET_by_offset(disp, _gloffset_GetUniformLocationARB));
+}
+
+static INLINE void SET_GetUniformLocationARB(struct _glapi_table *disp, GLint (GLAPIENTRYP fn)(GLhandleARB, const GLcharARB *)) {
+ SET_by_offset(disp, _gloffset_GetUniformLocationARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetUniformfvARB)(GLhandleARB, GLint, GLfloat *);
+#define CALL_GetUniformfvARB(disp, parameters) \
+ (* GET_GetUniformfvARB(disp)) parameters
+static INLINE _glptr_GetUniformfvARB GET_GetUniformfvARB(struct _glapi_table *disp) {
+ return (_glptr_GetUniformfvARB) (GET_by_offset(disp, _gloffset_GetUniformfvARB));
+}
+
+static INLINE void SET_GetUniformfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetUniformfvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetUniformivARB)(GLhandleARB, GLint, GLint *);
+#define CALL_GetUniformivARB(disp, parameters) \
+ (* GET_GetUniformivARB(disp)) parameters
+static INLINE _glptr_GetUniformivARB GET_GetUniformivARB(struct _glapi_table *disp) {
+ return (_glptr_GetUniformivARB) (GET_by_offset(disp, _gloffset_GetUniformivARB));
+}
+
+static INLINE void SET_GetUniformivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetUniformivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LinkProgramARB)(GLhandleARB);
+#define CALL_LinkProgramARB(disp, parameters) \
+ (* GET_LinkProgramARB(disp)) parameters
+static INLINE _glptr_LinkProgramARB GET_LinkProgramARB(struct _glapi_table *disp) {
+ return (_glptr_LinkProgramARB) (GET_by_offset(disp, _gloffset_LinkProgramARB));
+}
+
+static INLINE void SET_LinkProgramARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB)) {
+ SET_by_offset(disp, _gloffset_LinkProgramARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ShaderSourceARB)(GLhandleARB, GLsizei, const GLcharARB **, const GLint *);
+#define CALL_ShaderSourceARB(disp, parameters) \
+ (* GET_ShaderSourceARB(disp)) parameters
+static INLINE _glptr_ShaderSourceARB GET_ShaderSourceARB(struct _glapi_table *disp) {
+ return (_glptr_ShaderSourceARB) (GET_by_offset(disp, _gloffset_ShaderSourceARB));
+}
+
+static INLINE void SET_ShaderSourceARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLsizei, const GLcharARB **, const GLint *)) {
+ SET_by_offset(disp, _gloffset_ShaderSourceARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform1fARB)(GLint, GLfloat);
+#define CALL_Uniform1fARB(disp, parameters) \
+ (* GET_Uniform1fARB(disp)) parameters
+static INLINE _glptr_Uniform1fARB GET_Uniform1fARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform1fARB) (GET_by_offset(disp, _gloffset_Uniform1fARB));
+}
+
+static INLINE void SET_Uniform1fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Uniform1fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform1fvARB)(GLint, GLsizei, const GLfloat *);
+#define CALL_Uniform1fvARB(disp, parameters) \
+ (* GET_Uniform1fvARB(disp)) parameters
+static INLINE _glptr_Uniform1fvARB GET_Uniform1fvARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform1fvARB) (GET_by_offset(disp, _gloffset_Uniform1fvARB));
+}
+
+static INLINE void SET_Uniform1fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Uniform1fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform1iARB)(GLint, GLint);
+#define CALL_Uniform1iARB(disp, parameters) \
+ (* GET_Uniform1iARB(disp)) parameters
+static INLINE _glptr_Uniform1iARB GET_Uniform1iARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform1iARB) (GET_by_offset(disp, _gloffset_Uniform1iARB));
+}
+
+static INLINE void SET_Uniform1iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Uniform1iARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform1ivARB)(GLint, GLsizei, const GLint *);
+#define CALL_Uniform1ivARB(disp, parameters) \
+ (* GET_Uniform1ivARB(disp)) parameters
+static INLINE _glptr_Uniform1ivARB GET_Uniform1ivARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform1ivARB) (GET_by_offset(disp, _gloffset_Uniform1ivARB));
+}
+
+static INLINE void SET_Uniform1ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLint *)) {
+ SET_by_offset(disp, _gloffset_Uniform1ivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform2fARB)(GLint, GLfloat, GLfloat);
+#define CALL_Uniform2fARB(disp, parameters) \
+ (* GET_Uniform2fARB(disp)) parameters
+static INLINE _glptr_Uniform2fARB GET_Uniform2fARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform2fARB) (GET_by_offset(disp, _gloffset_Uniform2fARB));
+}
+
+static INLINE void SET_Uniform2fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Uniform2fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform2fvARB)(GLint, GLsizei, const GLfloat *);
+#define CALL_Uniform2fvARB(disp, parameters) \
+ (* GET_Uniform2fvARB(disp)) parameters
+static INLINE _glptr_Uniform2fvARB GET_Uniform2fvARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform2fvARB) (GET_by_offset(disp, _gloffset_Uniform2fvARB));
+}
+
+static INLINE void SET_Uniform2fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Uniform2fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform2iARB)(GLint, GLint, GLint);
+#define CALL_Uniform2iARB(disp, parameters) \
+ (* GET_Uniform2iARB(disp)) parameters
+static INLINE _glptr_Uniform2iARB GET_Uniform2iARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform2iARB) (GET_by_offset(disp, _gloffset_Uniform2iARB));
+}
+
+static INLINE void SET_Uniform2iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Uniform2iARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform2ivARB)(GLint, GLsizei, const GLint *);
+#define CALL_Uniform2ivARB(disp, parameters) \
+ (* GET_Uniform2ivARB(disp)) parameters
+static INLINE _glptr_Uniform2ivARB GET_Uniform2ivARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform2ivARB) (GET_by_offset(disp, _gloffset_Uniform2ivARB));
+}
+
+static INLINE void SET_Uniform2ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLint *)) {
+ SET_by_offset(disp, _gloffset_Uniform2ivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform3fARB)(GLint, GLfloat, GLfloat, GLfloat);
+#define CALL_Uniform3fARB(disp, parameters) \
+ (* GET_Uniform3fARB(disp)) parameters
+static INLINE _glptr_Uniform3fARB GET_Uniform3fARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform3fARB) (GET_by_offset(disp, _gloffset_Uniform3fARB));
+}
+
+static INLINE void SET_Uniform3fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Uniform3fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform3fvARB)(GLint, GLsizei, const GLfloat *);
+#define CALL_Uniform3fvARB(disp, parameters) \
+ (* GET_Uniform3fvARB(disp)) parameters
+static INLINE _glptr_Uniform3fvARB GET_Uniform3fvARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform3fvARB) (GET_by_offset(disp, _gloffset_Uniform3fvARB));
+}
+
+static INLINE void SET_Uniform3fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Uniform3fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform3iARB)(GLint, GLint, GLint, GLint);
+#define CALL_Uniform3iARB(disp, parameters) \
+ (* GET_Uniform3iARB(disp)) parameters
+static INLINE _glptr_Uniform3iARB GET_Uniform3iARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform3iARB) (GET_by_offset(disp, _gloffset_Uniform3iARB));
+}
+
+static INLINE void SET_Uniform3iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Uniform3iARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform3ivARB)(GLint, GLsizei, const GLint *);
+#define CALL_Uniform3ivARB(disp, parameters) \
+ (* GET_Uniform3ivARB(disp)) parameters
+static INLINE _glptr_Uniform3ivARB GET_Uniform3ivARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform3ivARB) (GET_by_offset(disp, _gloffset_Uniform3ivARB));
+}
+
+static INLINE void SET_Uniform3ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLint *)) {
+ SET_by_offset(disp, _gloffset_Uniform3ivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform4fARB)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_Uniform4fARB(disp, parameters) \
+ (* GET_Uniform4fARB(disp)) parameters
+static INLINE _glptr_Uniform4fARB GET_Uniform4fARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform4fARB) (GET_by_offset(disp, _gloffset_Uniform4fARB));
+}
+
+static INLINE void SET_Uniform4fARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_Uniform4fARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform4fvARB)(GLint, GLsizei, const GLfloat *);
+#define CALL_Uniform4fvARB(disp, parameters) \
+ (* GET_Uniform4fvARB(disp)) parameters
+static INLINE _glptr_Uniform4fvARB GET_Uniform4fvARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform4fvARB) (GET_by_offset(disp, _gloffset_Uniform4fvARB));
+}
+
+static INLINE void SET_Uniform4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_Uniform4fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform4iARB)(GLint, GLint, GLint, GLint, GLint);
+#define CALL_Uniform4iARB(disp, parameters) \
+ (* GET_Uniform4iARB(disp)) parameters
+static INLINE _glptr_Uniform4iARB GET_Uniform4iARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform4iARB) (GET_by_offset(disp, _gloffset_Uniform4iARB));
+}
+
+static INLINE void SET_Uniform4iARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_Uniform4iARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform4ivARB)(GLint, GLsizei, const GLint *);
+#define CALL_Uniform4ivARB(disp, parameters) \
+ (* GET_Uniform4ivARB(disp)) parameters
+static INLINE _glptr_Uniform4ivARB GET_Uniform4ivARB(struct _glapi_table *disp) {
+ return (_glptr_Uniform4ivARB) (GET_by_offset(disp, _gloffset_Uniform4ivARB));
+}
+
+static INLINE void SET_Uniform4ivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLint *)) {
+ SET_by_offset(disp, _gloffset_Uniform4ivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UniformMatrix2fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
+#define CALL_UniformMatrix2fvARB(disp, parameters) \
+ (* GET_UniformMatrix2fvARB(disp)) parameters
+static INLINE _glptr_UniformMatrix2fvARB GET_UniformMatrix2fvARB(struct _glapi_table *disp) {
+ return (_glptr_UniformMatrix2fvARB) (GET_by_offset(disp, _gloffset_UniformMatrix2fvARB));
+}
+
+static INLINE void SET_UniformMatrix2fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_UniformMatrix2fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UniformMatrix3fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
+#define CALL_UniformMatrix3fvARB(disp, parameters) \
+ (* GET_UniformMatrix3fvARB(disp)) parameters
+static INLINE _glptr_UniformMatrix3fvARB GET_UniformMatrix3fvARB(struct _glapi_table *disp) {
+ return (_glptr_UniformMatrix3fvARB) (GET_by_offset(disp, _gloffset_UniformMatrix3fvARB));
+}
+
+static INLINE void SET_UniformMatrix3fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_UniformMatrix3fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UniformMatrix4fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
+#define CALL_UniformMatrix4fvARB(disp, parameters) \
+ (* GET_UniformMatrix4fvARB(disp)) parameters
+static INLINE _glptr_UniformMatrix4fvARB GET_UniformMatrix4fvARB(struct _glapi_table *disp) {
+ return (_glptr_UniformMatrix4fvARB) (GET_by_offset(disp, _gloffset_UniformMatrix4fvARB));
+}
+
+static INLINE void SET_UniformMatrix4fvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, GLboolean, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_UniformMatrix4fvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UseProgramObjectARB)(GLhandleARB);
+#define CALL_UseProgramObjectARB(disp, parameters) \
+ (* GET_UseProgramObjectARB(disp)) parameters
+static INLINE _glptr_UseProgramObjectARB GET_UseProgramObjectARB(struct _glapi_table *disp) {
+ return (_glptr_UseProgramObjectARB) (GET_by_offset(disp, _gloffset_UseProgramObjectARB));
+}
+
+static INLINE void SET_UseProgramObjectARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB)) {
+ SET_by_offset(disp, _gloffset_UseProgramObjectARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ValidateProgramARB)(GLhandleARB);
+#define CALL_ValidateProgramARB(disp, parameters) \
+ (* GET_ValidateProgramARB(disp)) parameters
+static INLINE _glptr_ValidateProgramARB GET_ValidateProgramARB(struct _glapi_table *disp) {
+ return (_glptr_ValidateProgramARB) (GET_by_offset(disp, _gloffset_ValidateProgramARB));
+}
+
+static INLINE void SET_ValidateProgramARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB)) {
+ SET_by_offset(disp, _gloffset_ValidateProgramARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindAttribLocationARB)(GLhandleARB, GLuint, const GLcharARB *);
+#define CALL_BindAttribLocationARB(disp, parameters) \
+ (* GET_BindAttribLocationARB(disp)) parameters
+static INLINE _glptr_BindAttribLocationARB GET_BindAttribLocationARB(struct _glapi_table *disp) {
+ return (_glptr_BindAttribLocationARB) (GET_by_offset(disp, _gloffset_BindAttribLocationARB));
+}
+
+static INLINE void SET_BindAttribLocationARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLuint, const GLcharARB *)) {
+ SET_by_offset(disp, _gloffset_BindAttribLocationARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
+#define CALL_GetActiveAttribARB(disp, parameters) \
+ (* GET_GetActiveAttribARB(disp)) parameters
+static INLINE _glptr_GetActiveAttribARB GET_GetActiveAttribARB(struct _glapi_table *disp) {
+ return (_glptr_GetActiveAttribARB) (GET_by_offset(disp, _gloffset_GetActiveAttribARB));
+}
+
+static INLINE void SET_GetActiveAttribARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)) {
+ SET_by_offset(disp, _gloffset_GetActiveAttribARB, fn);
+}
+
+typedef GLint (GLAPIENTRYP _glptr_GetAttribLocationARB)(GLhandleARB, const GLcharARB *);
+#define CALL_GetAttribLocationARB(disp, parameters) \
+ (* GET_GetAttribLocationARB(disp)) parameters
+static INLINE _glptr_GetAttribLocationARB GET_GetAttribLocationARB(struct _glapi_table *disp) {
+ return (_glptr_GetAttribLocationARB) (GET_by_offset(disp, _gloffset_GetAttribLocationARB));
+}
+
+static INLINE void SET_GetAttribLocationARB(struct _glapi_table *disp, GLint (GLAPIENTRYP fn)(GLhandleARB, const GLcharARB *)) {
+ SET_by_offset(disp, _gloffset_GetAttribLocationARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawBuffersARB)(GLsizei, const GLenum *);
+#define CALL_DrawBuffersARB(disp, parameters) \
+ (* GET_DrawBuffersARB(disp)) parameters
+static INLINE _glptr_DrawBuffersARB GET_DrawBuffersARB(struct _glapi_table *disp) {
+ return (_glptr_DrawBuffersARB) (GET_by_offset(disp, _gloffset_DrawBuffersARB));
+}
+
+static INLINE void SET_DrawBuffersARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLenum *)) {
+ SET_by_offset(disp, _gloffset_DrawBuffersARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClampColorARB)(GLenum, GLenum);
+#define CALL_ClampColorARB(disp, parameters) \
+ (* GET_ClampColorARB(disp)) parameters
+static INLINE _glptr_ClampColorARB GET_ClampColorARB(struct _glapi_table *disp) {
+ return (_glptr_ClampColorARB) (GET_by_offset(disp, _gloffset_ClampColorARB));
+}
+
+static INLINE void SET_ClampColorARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_ClampColorARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawArraysInstancedARB)(GLenum, GLint, GLsizei, GLsizei);
+#define CALL_DrawArraysInstancedARB(disp, parameters) \
+ (* GET_DrawArraysInstancedARB(disp)) parameters
+static INLINE _glptr_DrawArraysInstancedARB GET_DrawArraysInstancedARB(struct _glapi_table *disp) {
+ return (_glptr_DrawArraysInstancedARB) (GET_by_offset(disp, _gloffset_DrawArraysInstancedARB));
+}
+
+static INLINE void SET_DrawArraysInstancedARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_DrawArraysInstancedARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawElementsInstancedARB)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei);
+#define CALL_DrawElementsInstancedARB(disp, parameters) \
+ (* GET_DrawElementsInstancedARB(disp)) parameters
+static INLINE _glptr_DrawElementsInstancedARB GET_DrawElementsInstancedARB(struct _glapi_table *disp) {
+ return (_glptr_DrawElementsInstancedARB) (GET_by_offset(disp, _gloffset_DrawElementsInstancedARB));
+}
+
+static INLINE void SET_DrawElementsInstancedARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei)) {
+ SET_by_offset(disp, _gloffset_DrawElementsInstancedARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RenderbufferStorageMultisample)(GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+#define CALL_RenderbufferStorageMultisample(disp, parameters) \
+ (* GET_RenderbufferStorageMultisample(disp)) parameters
+static INLINE _glptr_RenderbufferStorageMultisample GET_RenderbufferStorageMultisample(struct _glapi_table *disp) {
+ return (_glptr_RenderbufferStorageMultisample) (GET_by_offset(disp, _gloffset_RenderbufferStorageMultisample));
+}
+
+static INLINE void SET_RenderbufferStorageMultisample(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_RenderbufferStorageMultisample, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FramebufferTextureARB)(GLenum, GLenum, GLuint, GLint);
+#define CALL_FramebufferTextureARB(disp, parameters) \
+ (* GET_FramebufferTextureARB(disp)) parameters
+static INLINE _glptr_FramebufferTextureARB GET_FramebufferTextureARB(struct _glapi_table *disp) {
+ return (_glptr_FramebufferTextureARB) (GET_by_offset(disp, _gloffset_FramebufferTextureARB));
+}
+
+static INLINE void SET_FramebufferTextureARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint, GLint)) {
+ SET_by_offset(disp, _gloffset_FramebufferTextureARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FramebufferTextureFaceARB)(GLenum, GLenum, GLuint, GLint, GLenum);
+#define CALL_FramebufferTextureFaceARB(disp, parameters) \
+ (* GET_FramebufferTextureFaceARB(disp)) parameters
+static INLINE _glptr_FramebufferTextureFaceARB GET_FramebufferTextureFaceARB(struct _glapi_table *disp) {
+ return (_glptr_FramebufferTextureFaceARB) (GET_by_offset(disp, _gloffset_FramebufferTextureFaceARB));
+}
+
+static INLINE void SET_FramebufferTextureFaceARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint, GLint, GLenum)) {
+ SET_by_offset(disp, _gloffset_FramebufferTextureFaceARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramParameteriARB)(GLuint, GLenum, GLint);
+#define CALL_ProgramParameteriARB(disp, parameters) \
+ (* GET_ProgramParameteriARB(disp)) parameters
+static INLINE _glptr_ProgramParameteriARB GET_ProgramParameteriARB(struct _glapi_table *disp) {
+ return (_glptr_ProgramParameteriARB) (GET_by_offset(disp, _gloffset_ProgramParameteriARB));
+}
+
+static INLINE void SET_ProgramParameteriARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_ProgramParameteriARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribDivisorARB)(GLuint, GLuint);
+#define CALL_VertexAttribDivisorARB(disp, parameters) \
+ (* GET_VertexAttribDivisorARB(disp)) parameters
+static INLINE _glptr_VertexAttribDivisorARB GET_VertexAttribDivisorARB(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribDivisorARB) (GET_by_offset(disp, _gloffset_VertexAttribDivisorARB));
+}
+
+static INLINE void SET_VertexAttribDivisorARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribDivisorARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FlushMappedBufferRange)(GLenum, GLintptr, GLsizeiptr);
+#define CALL_FlushMappedBufferRange(disp, parameters) \
+ (* GET_FlushMappedBufferRange(disp)) parameters
+static INLINE _glptr_FlushMappedBufferRange GET_FlushMappedBufferRange(struct _glapi_table *disp) {
+ return (_glptr_FlushMappedBufferRange) (GET_by_offset(disp, _gloffset_FlushMappedBufferRange));
+}
+
+static INLINE void SET_FlushMappedBufferRange(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLintptr, GLsizeiptr)) {
+ SET_by_offset(disp, _gloffset_FlushMappedBufferRange, fn);
+}
+
+typedef GLvoid * (GLAPIENTRYP _glptr_MapBufferRange)(GLenum, GLintptr, GLsizeiptr, GLbitfield);
+#define CALL_MapBufferRange(disp, parameters) \
+ (* GET_MapBufferRange(disp)) parameters
+static INLINE _glptr_MapBufferRange GET_MapBufferRange(struct _glapi_table *disp) {
+ return (_glptr_MapBufferRange) (GET_by_offset(disp, _gloffset_MapBufferRange));
+}
+
+static INLINE void SET_MapBufferRange(struct _glapi_table *disp, GLvoid * (GLAPIENTRYP fn)(GLenum, GLintptr, GLsizeiptr, GLbitfield)) {
+ SET_by_offset(disp, _gloffset_MapBufferRange, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexBufferARB)(GLenum, GLenum, GLuint);
+#define CALL_TexBufferARB(disp, parameters) \
+ (* GET_TexBufferARB(disp)) parameters
+static INLINE _glptr_TexBufferARB GET_TexBufferARB(struct _glapi_table *disp) {
+ return (_glptr_TexBufferARB) (GET_by_offset(disp, _gloffset_TexBufferARB));
+}
+
+static INLINE void SET_TexBufferARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_TexBufferARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindVertexArray)(GLuint);
+#define CALL_BindVertexArray(disp, parameters) \
+ (* GET_BindVertexArray(disp)) parameters
+static INLINE _glptr_BindVertexArray GET_BindVertexArray(struct _glapi_table *disp) {
+ return (_glptr_BindVertexArray) (GET_by_offset(disp, _gloffset_BindVertexArray));
+}
+
+static INLINE void SET_BindVertexArray(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_BindVertexArray, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenVertexArrays)(GLsizei, GLuint *);
+#define CALL_GenVertexArrays(disp, parameters) \
+ (* GET_GenVertexArrays(disp)) parameters
+static INLINE _glptr_GenVertexArrays GET_GenVertexArrays(struct _glapi_table *disp) {
+ return (_glptr_GenVertexArrays) (GET_by_offset(disp, _gloffset_GenVertexArrays));
+}
+
+static INLINE void SET_GenVertexArrays(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenVertexArrays, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CopyBufferSubData)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr);
+#define CALL_CopyBufferSubData(disp, parameters) \
+ (* GET_CopyBufferSubData(disp)) parameters
+static INLINE _glptr_CopyBufferSubData GET_CopyBufferSubData(struct _glapi_table *disp) {
+ return (_glptr_CopyBufferSubData) (GET_by_offset(disp, _gloffset_CopyBufferSubData));
+}
+
+static INLINE void SET_CopyBufferSubData(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr)) {
+ SET_by_offset(disp, _gloffset_CopyBufferSubData, fn);
+}
+
+typedef GLenum (GLAPIENTRYP _glptr_ClientWaitSync)(GLsync, GLbitfield, GLuint64);
+#define CALL_ClientWaitSync(disp, parameters) \
+ (* GET_ClientWaitSync(disp)) parameters
+static INLINE _glptr_ClientWaitSync GET_ClientWaitSync(struct _glapi_table *disp) {
+ return (_glptr_ClientWaitSync) (GET_by_offset(disp, _gloffset_ClientWaitSync));
+}
+
+static INLINE void SET_ClientWaitSync(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(GLsync, GLbitfield, GLuint64)) {
+ SET_by_offset(disp, _gloffset_ClientWaitSync, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteSync)(GLsync);
+#define CALL_DeleteSync(disp, parameters) \
+ (* GET_DeleteSync(disp)) parameters
+static INLINE _glptr_DeleteSync GET_DeleteSync(struct _glapi_table *disp) {
+ return (_glptr_DeleteSync) (GET_by_offset(disp, _gloffset_DeleteSync));
+}
+
+static INLINE void SET_DeleteSync(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsync)) {
+ SET_by_offset(disp, _gloffset_DeleteSync, fn);
+}
+
+typedef GLsync (GLAPIENTRYP _glptr_FenceSync)(GLenum, GLbitfield);
+#define CALL_FenceSync(disp, parameters) \
+ (* GET_FenceSync(disp)) parameters
+static INLINE _glptr_FenceSync GET_FenceSync(struct _glapi_table *disp) {
+ return (_glptr_FenceSync) (GET_by_offset(disp, _gloffset_FenceSync));
+}
+
+static INLINE void SET_FenceSync(struct _glapi_table *disp, GLsync (GLAPIENTRYP fn)(GLenum, GLbitfield)) {
+ SET_by_offset(disp, _gloffset_FenceSync, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetInteger64v)(GLenum, GLint64 *);
+#define CALL_GetInteger64v(disp, parameters) \
+ (* GET_GetInteger64v(disp)) parameters
+static INLINE _glptr_GetInteger64v GET_GetInteger64v(struct _glapi_table *disp) {
+ return (_glptr_GetInteger64v) (GET_by_offset(disp, _gloffset_GetInteger64v));
+}
+
+static INLINE void SET_GetInteger64v(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint64 *)) {
+ SET_by_offset(disp, _gloffset_GetInteger64v, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetSynciv)(GLsync, GLenum, GLsizei, GLsizei *, GLint *);
+#define CALL_GetSynciv(disp, parameters) \
+ (* GET_GetSynciv(disp)) parameters
+static INLINE _glptr_GetSynciv GET_GetSynciv(struct _glapi_table *disp) {
+ return (_glptr_GetSynciv) (GET_by_offset(disp, _gloffset_GetSynciv));
+}
+
+static INLINE void SET_GetSynciv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsync, GLenum, GLsizei, GLsizei *, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetSynciv, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsSync)(GLsync);
+#define CALL_IsSync(disp, parameters) \
+ (* GET_IsSync(disp)) parameters
+static INLINE _glptr_IsSync GET_IsSync(struct _glapi_table *disp) {
+ return (_glptr_IsSync) (GET_by_offset(disp, _gloffset_IsSync));
+}
+
+static INLINE void SET_IsSync(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLsync)) {
+ SET_by_offset(disp, _gloffset_IsSync, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WaitSync)(GLsync, GLbitfield, GLuint64);
+#define CALL_WaitSync(disp, parameters) \
+ (* GET_WaitSync(disp)) parameters
+static INLINE _glptr_WaitSync GET_WaitSync(struct _glapi_table *disp) {
+ return (_glptr_WaitSync) (GET_by_offset(disp, _gloffset_WaitSync));
+}
+
+static INLINE void SET_WaitSync(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsync, GLbitfield, GLuint64)) {
+ SET_by_offset(disp, _gloffset_WaitSync, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawElementsBaseVertex)(GLenum, GLsizei, GLenum, const GLvoid *, GLint);
+#define CALL_DrawElementsBaseVertex(disp, parameters) \
+ (* GET_DrawElementsBaseVertex(disp)) parameters
+static INLINE _glptr_DrawElementsBaseVertex GET_DrawElementsBaseVertex(struct _glapi_table *disp) {
+ return (_glptr_DrawElementsBaseVertex) (GET_by_offset(disp, _gloffset_DrawElementsBaseVertex));
+}
+
+static INLINE void SET_DrawElementsBaseVertex(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, const GLvoid *, GLint)) {
+ SET_by_offset(disp, _gloffset_DrawElementsBaseVertex, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawElementsInstancedBaseVertex)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei, GLint);
+#define CALL_DrawElementsInstancedBaseVertex(disp, parameters) \
+ (* GET_DrawElementsInstancedBaseVertex(disp)) parameters
+static INLINE _glptr_DrawElementsInstancedBaseVertex GET_DrawElementsInstancedBaseVertex(struct _glapi_table *disp) {
+ return (_glptr_DrawElementsInstancedBaseVertex) (GET_by_offset(disp, _gloffset_DrawElementsInstancedBaseVertex));
+}
+
+static INLINE void SET_DrawElementsInstancedBaseVertex(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei, GLint)) {
+ SET_by_offset(disp, _gloffset_DrawElementsInstancedBaseVertex, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawRangeElementsBaseVertex)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint);
+#define CALL_DrawRangeElementsBaseVertex(disp, parameters) \
+ (* GET_DrawRangeElementsBaseVertex(disp)) parameters
+static INLINE _glptr_DrawRangeElementsBaseVertex GET_DrawRangeElementsBaseVertex(struct _glapi_table *disp) {
+ return (_glptr_DrawRangeElementsBaseVertex) (GET_by_offset(disp, _gloffset_DrawRangeElementsBaseVertex));
+}
+
+static INLINE void SET_DrawRangeElementsBaseVertex(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint)) {
+ SET_by_offset(disp, _gloffset_DrawRangeElementsBaseVertex, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiDrawElementsBaseVertex)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei, const GLint *);
+#define CALL_MultiDrawElementsBaseVertex(disp, parameters) \
+ (* GET_MultiDrawElementsBaseVertex(disp)) parameters
+static INLINE _glptr_MultiDrawElementsBaseVertex GET_MultiDrawElementsBaseVertex(struct _glapi_table *disp) {
+ return (_glptr_MultiDrawElementsBaseVertex) (GET_by_offset(disp, _gloffset_MultiDrawElementsBaseVertex));
+}
+
+static INLINE void SET_MultiDrawElementsBaseVertex(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei, const GLint *)) {
+ SET_by_offset(disp, _gloffset_MultiDrawElementsBaseVertex, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BlendEquationSeparateiARB)(GLuint, GLenum, GLenum);
+#define CALL_BlendEquationSeparateiARB(disp, parameters) \
+ (* GET_BlendEquationSeparateiARB(disp)) parameters
+static INLINE _glptr_BlendEquationSeparateiARB GET_BlendEquationSeparateiARB(struct _glapi_table *disp) {
+ return (_glptr_BlendEquationSeparateiARB) (GET_by_offset(disp, _gloffset_BlendEquationSeparateiARB));
+}
+
+static INLINE void SET_BlendEquationSeparateiARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_BlendEquationSeparateiARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BlendEquationiARB)(GLuint, GLenum);
+#define CALL_BlendEquationiARB(disp, parameters) \
+ (* GET_BlendEquationiARB(disp)) parameters
+static INLINE _glptr_BlendEquationiARB GET_BlendEquationiARB(struct _glapi_table *disp) {
+ return (_glptr_BlendEquationiARB) (GET_by_offset(disp, _gloffset_BlendEquationiARB));
+}
+
+static INLINE void SET_BlendEquationiARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum)) {
+ SET_by_offset(disp, _gloffset_BlendEquationiARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BlendFuncSeparateiARB)(GLuint, GLenum, GLenum, GLenum, GLenum);
+#define CALL_BlendFuncSeparateiARB(disp, parameters) \
+ (* GET_BlendFuncSeparateiARB(disp)) parameters
+static INLINE _glptr_BlendFuncSeparateiARB GET_BlendFuncSeparateiARB(struct _glapi_table *disp) {
+ return (_glptr_BlendFuncSeparateiARB) (GET_by_offset(disp, _gloffset_BlendFuncSeparateiARB));
+}
+
+static INLINE void SET_BlendFuncSeparateiARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLenum, GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_BlendFuncSeparateiARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BlendFunciARB)(GLuint, GLenum, GLenum);
+#define CALL_BlendFunciARB(disp, parameters) \
+ (* GET_BlendFunciARB(disp)) parameters
+static INLINE _glptr_BlendFunciARB GET_BlendFunciARB(struct _glapi_table *disp) {
+ return (_glptr_BlendFunciARB) (GET_by_offset(disp, _gloffset_BlendFunciARB));
+}
+
+static INLINE void SET_BlendFunciARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_BlendFunciARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindSampler)(GLuint, GLuint);
+#define CALL_BindSampler(disp, parameters) \
+ (* GET_BindSampler(disp)) parameters
+static INLINE _glptr_BindSampler GET_BindSampler(struct _glapi_table *disp) {
+ return (_glptr_BindSampler) (GET_by_offset(disp, _gloffset_BindSampler));
+}
+
+static INLINE void SET_BindSampler(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_BindSampler, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteSamplers)(GLsizei, const GLuint *);
+#define CALL_DeleteSamplers(disp, parameters) \
+ (* GET_DeleteSamplers(disp)) parameters
+static INLINE _glptr_DeleteSamplers GET_DeleteSamplers(struct _glapi_table *disp) {
+ return (_glptr_DeleteSamplers) (GET_by_offset(disp, _gloffset_DeleteSamplers));
+}
+
+static INLINE void SET_DeleteSamplers(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_DeleteSamplers, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenSamplers)(GLsizei, GLuint *);
+#define CALL_GenSamplers(disp, parameters) \
+ (* GET_GenSamplers(disp)) parameters
+static INLINE _glptr_GenSamplers GET_GenSamplers(struct _glapi_table *disp) {
+ return (_glptr_GenSamplers) (GET_by_offset(disp, _gloffset_GenSamplers));
+}
+
+static INLINE void SET_GenSamplers(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenSamplers, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetSamplerParameterIiv)(GLuint, GLenum, GLint *);
+#define CALL_GetSamplerParameterIiv(disp, parameters) \
+ (* GET_GetSamplerParameterIiv(disp)) parameters
+static INLINE _glptr_GetSamplerParameterIiv GET_GetSamplerParameterIiv(struct _glapi_table *disp) {
+ return (_glptr_GetSamplerParameterIiv) (GET_by_offset(disp, _gloffset_GetSamplerParameterIiv));
+}
+
+static INLINE void SET_GetSamplerParameterIiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetSamplerParameterIiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetSamplerParameterIuiv)(GLuint, GLenum, GLuint *);
+#define CALL_GetSamplerParameterIuiv(disp, parameters) \
+ (* GET_GetSamplerParameterIuiv(disp)) parameters
+static INLINE _glptr_GetSamplerParameterIuiv GET_GetSamplerParameterIuiv(struct _glapi_table *disp) {
+ return (_glptr_GetSamplerParameterIuiv) (GET_by_offset(disp, _gloffset_GetSamplerParameterIuiv));
+}
+
+static INLINE void SET_GetSamplerParameterIuiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GetSamplerParameterIuiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetSamplerParameterfv)(GLuint, GLenum, GLfloat *);
+#define CALL_GetSamplerParameterfv(disp, parameters) \
+ (* GET_GetSamplerParameterfv(disp)) parameters
+static INLINE _glptr_GetSamplerParameterfv GET_GetSamplerParameterfv(struct _glapi_table *disp) {
+ return (_glptr_GetSamplerParameterfv) (GET_by_offset(disp, _gloffset_GetSamplerParameterfv));
+}
+
+static INLINE void SET_GetSamplerParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetSamplerParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetSamplerParameteriv)(GLuint, GLenum, GLint *);
+#define CALL_GetSamplerParameteriv(disp, parameters) \
+ (* GET_GetSamplerParameteriv(disp)) parameters
+static INLINE _glptr_GetSamplerParameteriv GET_GetSamplerParameteriv(struct _glapi_table *disp) {
+ return (_glptr_GetSamplerParameteriv) (GET_by_offset(disp, _gloffset_GetSamplerParameteriv));
+}
+
+static INLINE void SET_GetSamplerParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetSamplerParameteriv, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsSampler)(GLuint);
+#define CALL_IsSampler(disp, parameters) \
+ (* GET_IsSampler(disp)) parameters
+static INLINE _glptr_IsSampler GET_IsSampler(struct _glapi_table *disp) {
+ return (_glptr_IsSampler) (GET_by_offset(disp, _gloffset_IsSampler));
+}
+
+static INLINE void SET_IsSampler(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsSampler, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SamplerParameterIiv)(GLuint, GLenum, const GLint *);
+#define CALL_SamplerParameterIiv(disp, parameters) \
+ (* GET_SamplerParameterIiv(disp)) parameters
+static INLINE _glptr_SamplerParameterIiv GET_SamplerParameterIiv(struct _glapi_table *disp) {
+ return (_glptr_SamplerParameterIiv) (GET_by_offset(disp, _gloffset_SamplerParameterIiv));
+}
+
+static INLINE void SET_SamplerParameterIiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_SamplerParameterIiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SamplerParameterIuiv)(GLuint, GLenum, const GLuint *);
+#define CALL_SamplerParameterIuiv(disp, parameters) \
+ (* GET_SamplerParameterIuiv(disp)) parameters
+static INLINE _glptr_SamplerParameterIuiv GET_SamplerParameterIuiv(struct _glapi_table *disp) {
+ return (_glptr_SamplerParameterIuiv) (GET_by_offset(disp, _gloffset_SamplerParameterIuiv));
+}
+
+static INLINE void SET_SamplerParameterIuiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_SamplerParameterIuiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SamplerParameterf)(GLuint, GLenum, GLfloat);
+#define CALL_SamplerParameterf(disp, parameters) \
+ (* GET_SamplerParameterf(disp)) parameters
+static INLINE _glptr_SamplerParameterf GET_SamplerParameterf(struct _glapi_table *disp) {
+ return (_glptr_SamplerParameterf) (GET_by_offset(disp, _gloffset_SamplerParameterf));
+}
+
+static INLINE void SET_SamplerParameterf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_SamplerParameterf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SamplerParameterfv)(GLuint, GLenum, const GLfloat *);
+#define CALL_SamplerParameterfv(disp, parameters) \
+ (* GET_SamplerParameterfv(disp)) parameters
+static INLINE _glptr_SamplerParameterfv GET_SamplerParameterfv(struct _glapi_table *disp) {
+ return (_glptr_SamplerParameterfv) (GET_by_offset(disp, _gloffset_SamplerParameterfv));
+}
+
+static INLINE void SET_SamplerParameterfv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_SamplerParameterfv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SamplerParameteri)(GLuint, GLenum, GLint);
+#define CALL_SamplerParameteri(disp, parameters) \
+ (* GET_SamplerParameteri(disp)) parameters
+static INLINE _glptr_SamplerParameteri GET_SamplerParameteri(struct _glapi_table *disp) {
+ return (_glptr_SamplerParameteri) (GET_by_offset(disp, _gloffset_SamplerParameteri));
+}
+
+static INLINE void SET_SamplerParameteri(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_SamplerParameteri, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SamplerParameteriv)(GLuint, GLenum, const GLint *);
+#define CALL_SamplerParameteriv(disp, parameters) \
+ (* GET_SamplerParameteriv(disp)) parameters
+static INLINE _glptr_SamplerParameteriv GET_SamplerParameteriv(struct _glapi_table *disp) {
+ return (_glptr_SamplerParameteriv) (GET_by_offset(disp, _gloffset_SamplerParameteriv));
+}
+
+static INLINE void SET_SamplerParameteriv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_SamplerParameteriv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorP3ui)(GLenum, GLuint);
+#define CALL_ColorP3ui(disp, parameters) \
+ (* GET_ColorP3ui(disp)) parameters
+static INLINE _glptr_ColorP3ui GET_ColorP3ui(struct _glapi_table *disp) {
+ return (_glptr_ColorP3ui) (GET_by_offset(disp, _gloffset_ColorP3ui));
+}
+
+static INLINE void SET_ColorP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_ColorP3ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorP3uiv)(GLenum, const GLuint *);
+#define CALL_ColorP3uiv(disp, parameters) \
+ (* GET_ColorP3uiv(disp)) parameters
+static INLINE _glptr_ColorP3uiv GET_ColorP3uiv(struct _glapi_table *disp) {
+ return (_glptr_ColorP3uiv) (GET_by_offset(disp, _gloffset_ColorP3uiv));
+}
+
+static INLINE void SET_ColorP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_ColorP3uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorP4ui)(GLenum, GLuint);
+#define CALL_ColorP4ui(disp, parameters) \
+ (* GET_ColorP4ui(disp)) parameters
+static INLINE _glptr_ColorP4ui GET_ColorP4ui(struct _glapi_table *disp) {
+ return (_glptr_ColorP4ui) (GET_by_offset(disp, _gloffset_ColorP4ui));
+}
+
+static INLINE void SET_ColorP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_ColorP4ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorP4uiv)(GLenum, const GLuint *);
+#define CALL_ColorP4uiv(disp, parameters) \
+ (* GET_ColorP4uiv(disp)) parameters
+static INLINE _glptr_ColorP4uiv GET_ColorP4uiv(struct _glapi_table *disp) {
+ return (_glptr_ColorP4uiv) (GET_by_offset(disp, _gloffset_ColorP4uiv));
+}
+
+static INLINE void SET_ColorP4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_ColorP4uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoordP1ui)(GLenum, GLenum, GLuint);
+#define CALL_MultiTexCoordP1ui(disp, parameters) \
+ (* GET_MultiTexCoordP1ui(disp)) parameters
+static INLINE _glptr_MultiTexCoordP1ui GET_MultiTexCoordP1ui(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoordP1ui) (GET_by_offset(disp, _gloffset_MultiTexCoordP1ui));
+}
+
+static INLINE void SET_MultiTexCoordP1ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoordP1ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoordP1uiv)(GLenum, GLenum, const GLuint *);
+#define CALL_MultiTexCoordP1uiv(disp, parameters) \
+ (* GET_MultiTexCoordP1uiv(disp)) parameters
+static INLINE _glptr_MultiTexCoordP1uiv GET_MultiTexCoordP1uiv(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoordP1uiv) (GET_by_offset(disp, _gloffset_MultiTexCoordP1uiv));
+}
+
+static INLINE void SET_MultiTexCoordP1uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoordP1uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoordP2ui)(GLenum, GLenum, GLuint);
+#define CALL_MultiTexCoordP2ui(disp, parameters) \
+ (* GET_MultiTexCoordP2ui(disp)) parameters
+static INLINE _glptr_MultiTexCoordP2ui GET_MultiTexCoordP2ui(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoordP2ui) (GET_by_offset(disp, _gloffset_MultiTexCoordP2ui));
+}
+
+static INLINE void SET_MultiTexCoordP2ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoordP2ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoordP2uiv)(GLenum, GLenum, const GLuint *);
+#define CALL_MultiTexCoordP2uiv(disp, parameters) \
+ (* GET_MultiTexCoordP2uiv(disp)) parameters
+static INLINE _glptr_MultiTexCoordP2uiv GET_MultiTexCoordP2uiv(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoordP2uiv) (GET_by_offset(disp, _gloffset_MultiTexCoordP2uiv));
+}
+
+static INLINE void SET_MultiTexCoordP2uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoordP2uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoordP3ui)(GLenum, GLenum, GLuint);
+#define CALL_MultiTexCoordP3ui(disp, parameters) \
+ (* GET_MultiTexCoordP3ui(disp)) parameters
+static INLINE _glptr_MultiTexCoordP3ui GET_MultiTexCoordP3ui(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoordP3ui) (GET_by_offset(disp, _gloffset_MultiTexCoordP3ui));
+}
+
+static INLINE void SET_MultiTexCoordP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoordP3ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoordP3uiv)(GLenum, GLenum, const GLuint *);
+#define CALL_MultiTexCoordP3uiv(disp, parameters) \
+ (* GET_MultiTexCoordP3uiv(disp)) parameters
+static INLINE _glptr_MultiTexCoordP3uiv GET_MultiTexCoordP3uiv(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoordP3uiv) (GET_by_offset(disp, _gloffset_MultiTexCoordP3uiv));
+}
+
+static INLINE void SET_MultiTexCoordP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoordP3uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoordP4ui)(GLenum, GLenum, GLuint);
+#define CALL_MultiTexCoordP4ui(disp, parameters) \
+ (* GET_MultiTexCoordP4ui(disp)) parameters
+static INLINE _glptr_MultiTexCoordP4ui GET_MultiTexCoordP4ui(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoordP4ui) (GET_by_offset(disp, _gloffset_MultiTexCoordP4ui));
+}
+
+static INLINE void SET_MultiTexCoordP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoordP4ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiTexCoordP4uiv)(GLenum, GLenum, const GLuint *);
+#define CALL_MultiTexCoordP4uiv(disp, parameters) \
+ (* GET_MultiTexCoordP4uiv(disp)) parameters
+static INLINE _glptr_MultiTexCoordP4uiv GET_MultiTexCoordP4uiv(struct _glapi_table *disp) {
+ return (_glptr_MultiTexCoordP4uiv) (GET_by_offset(disp, _gloffset_MultiTexCoordP4uiv));
+}
+
+static INLINE void SET_MultiTexCoordP4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_MultiTexCoordP4uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_NormalP3ui)(GLenum, GLuint);
+#define CALL_NormalP3ui(disp, parameters) \
+ (* GET_NormalP3ui(disp)) parameters
+static INLINE _glptr_NormalP3ui GET_NormalP3ui(struct _glapi_table *disp) {
+ return (_glptr_NormalP3ui) (GET_by_offset(disp, _gloffset_NormalP3ui));
+}
+
+static INLINE void SET_NormalP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_NormalP3ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_NormalP3uiv)(GLenum, const GLuint *);
+#define CALL_NormalP3uiv(disp, parameters) \
+ (* GET_NormalP3uiv(disp)) parameters
+static INLINE _glptr_NormalP3uiv GET_NormalP3uiv(struct _glapi_table *disp) {
+ return (_glptr_NormalP3uiv) (GET_by_offset(disp, _gloffset_NormalP3uiv));
+}
+
+static INLINE void SET_NormalP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_NormalP3uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColorP3ui)(GLenum, GLuint);
+#define CALL_SecondaryColorP3ui(disp, parameters) \
+ (* GET_SecondaryColorP3ui(disp)) parameters
+static INLINE _glptr_SecondaryColorP3ui GET_SecondaryColorP3ui(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColorP3ui) (GET_by_offset(disp, _gloffset_SecondaryColorP3ui));
+}
+
+static INLINE void SET_SecondaryColorP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_SecondaryColorP3ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColorP3uiv)(GLenum, const GLuint *);
+#define CALL_SecondaryColorP3uiv(disp, parameters) \
+ (* GET_SecondaryColorP3uiv(disp)) parameters
+static INLINE _glptr_SecondaryColorP3uiv GET_SecondaryColorP3uiv(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColorP3uiv) (GET_by_offset(disp, _gloffset_SecondaryColorP3uiv));
+}
+
+static INLINE void SET_SecondaryColorP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_SecondaryColorP3uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoordP1ui)(GLenum, GLuint);
+#define CALL_TexCoordP1ui(disp, parameters) \
+ (* GET_TexCoordP1ui(disp)) parameters
+static INLINE _glptr_TexCoordP1ui GET_TexCoordP1ui(struct _glapi_table *disp) {
+ return (_glptr_TexCoordP1ui) (GET_by_offset(disp, _gloffset_TexCoordP1ui));
+}
+
+static INLINE void SET_TexCoordP1ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_TexCoordP1ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoordP1uiv)(GLenum, const GLuint *);
+#define CALL_TexCoordP1uiv(disp, parameters) \
+ (* GET_TexCoordP1uiv(disp)) parameters
+static INLINE _glptr_TexCoordP1uiv GET_TexCoordP1uiv(struct _glapi_table *disp) {
+ return (_glptr_TexCoordP1uiv) (GET_by_offset(disp, _gloffset_TexCoordP1uiv));
+}
+
+static INLINE void SET_TexCoordP1uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_TexCoordP1uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoordP2ui)(GLenum, GLuint);
+#define CALL_TexCoordP2ui(disp, parameters) \
+ (* GET_TexCoordP2ui(disp)) parameters
+static INLINE _glptr_TexCoordP2ui GET_TexCoordP2ui(struct _glapi_table *disp) {
+ return (_glptr_TexCoordP2ui) (GET_by_offset(disp, _gloffset_TexCoordP2ui));
+}
+
+static INLINE void SET_TexCoordP2ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_TexCoordP2ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoordP2uiv)(GLenum, const GLuint *);
+#define CALL_TexCoordP2uiv(disp, parameters) \
+ (* GET_TexCoordP2uiv(disp)) parameters
+static INLINE _glptr_TexCoordP2uiv GET_TexCoordP2uiv(struct _glapi_table *disp) {
+ return (_glptr_TexCoordP2uiv) (GET_by_offset(disp, _gloffset_TexCoordP2uiv));
+}
+
+static INLINE void SET_TexCoordP2uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_TexCoordP2uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoordP3ui)(GLenum, GLuint);
+#define CALL_TexCoordP3ui(disp, parameters) \
+ (* GET_TexCoordP3ui(disp)) parameters
+static INLINE _glptr_TexCoordP3ui GET_TexCoordP3ui(struct _glapi_table *disp) {
+ return (_glptr_TexCoordP3ui) (GET_by_offset(disp, _gloffset_TexCoordP3ui));
+}
+
+static INLINE void SET_TexCoordP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_TexCoordP3ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoordP3uiv)(GLenum, const GLuint *);
+#define CALL_TexCoordP3uiv(disp, parameters) \
+ (* GET_TexCoordP3uiv(disp)) parameters
+static INLINE _glptr_TexCoordP3uiv GET_TexCoordP3uiv(struct _glapi_table *disp) {
+ return (_glptr_TexCoordP3uiv) (GET_by_offset(disp, _gloffset_TexCoordP3uiv));
+}
+
+static INLINE void SET_TexCoordP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_TexCoordP3uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoordP4ui)(GLenum, GLuint);
+#define CALL_TexCoordP4ui(disp, parameters) \
+ (* GET_TexCoordP4ui(disp)) parameters
+static INLINE _glptr_TexCoordP4ui GET_TexCoordP4ui(struct _glapi_table *disp) {
+ return (_glptr_TexCoordP4ui) (GET_by_offset(disp, _gloffset_TexCoordP4ui));
+}
+
+static INLINE void SET_TexCoordP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_TexCoordP4ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoordP4uiv)(GLenum, const GLuint *);
+#define CALL_TexCoordP4uiv(disp, parameters) \
+ (* GET_TexCoordP4uiv(disp)) parameters
+static INLINE _glptr_TexCoordP4uiv GET_TexCoordP4uiv(struct _glapi_table *disp) {
+ return (_glptr_TexCoordP4uiv) (GET_by_offset(disp, _gloffset_TexCoordP4uiv));
+}
+
+static INLINE void SET_TexCoordP4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_TexCoordP4uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribP1ui)(GLuint, GLenum, GLboolean, GLuint);
+#define CALL_VertexAttribP1ui(disp, parameters) \
+ (* GET_VertexAttribP1ui(disp)) parameters
+static INLINE _glptr_VertexAttribP1ui GET_VertexAttribP1ui(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribP1ui) (GET_by_offset(disp, _gloffset_VertexAttribP1ui));
+}
+
+static INLINE void SET_VertexAttribP1ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribP1ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribP1uiv)(GLuint, GLenum, GLboolean, const GLuint *);
+#define CALL_VertexAttribP1uiv(disp, parameters) \
+ (* GET_VertexAttribP1uiv(disp)) parameters
+static INLINE _glptr_VertexAttribP1uiv GET_VertexAttribP1uiv(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribP1uiv) (GET_by_offset(disp, _gloffset_VertexAttribP1uiv));
+}
+
+static INLINE void SET_VertexAttribP1uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribP1uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribP2ui)(GLuint, GLenum, GLboolean, GLuint);
+#define CALL_VertexAttribP2ui(disp, parameters) \
+ (* GET_VertexAttribP2ui(disp)) parameters
+static INLINE _glptr_VertexAttribP2ui GET_VertexAttribP2ui(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribP2ui) (GET_by_offset(disp, _gloffset_VertexAttribP2ui));
+}
+
+static INLINE void SET_VertexAttribP2ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribP2ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribP2uiv)(GLuint, GLenum, GLboolean, const GLuint *);
+#define CALL_VertexAttribP2uiv(disp, parameters) \
+ (* GET_VertexAttribP2uiv(disp)) parameters
+static INLINE _glptr_VertexAttribP2uiv GET_VertexAttribP2uiv(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribP2uiv) (GET_by_offset(disp, _gloffset_VertexAttribP2uiv));
+}
+
+static INLINE void SET_VertexAttribP2uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribP2uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribP3ui)(GLuint, GLenum, GLboolean, GLuint);
+#define CALL_VertexAttribP3ui(disp, parameters) \
+ (* GET_VertexAttribP3ui(disp)) parameters
+static INLINE _glptr_VertexAttribP3ui GET_VertexAttribP3ui(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribP3ui) (GET_by_offset(disp, _gloffset_VertexAttribP3ui));
+}
+
+static INLINE void SET_VertexAttribP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribP3ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribP3uiv)(GLuint, GLenum, GLboolean, const GLuint *);
+#define CALL_VertexAttribP3uiv(disp, parameters) \
+ (* GET_VertexAttribP3uiv(disp)) parameters
+static INLINE _glptr_VertexAttribP3uiv GET_VertexAttribP3uiv(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribP3uiv) (GET_by_offset(disp, _gloffset_VertexAttribP3uiv));
+}
+
+static INLINE void SET_VertexAttribP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribP3uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribP4ui)(GLuint, GLenum, GLboolean, GLuint);
+#define CALL_VertexAttribP4ui(disp, parameters) \
+ (* GET_VertexAttribP4ui(disp)) parameters
+static INLINE _glptr_VertexAttribP4ui GET_VertexAttribP4ui(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribP4ui) (GET_by_offset(disp, _gloffset_VertexAttribP4ui));
+}
+
+static INLINE void SET_VertexAttribP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribP4ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribP4uiv)(GLuint, GLenum, GLboolean, const GLuint *);
+#define CALL_VertexAttribP4uiv(disp, parameters) \
+ (* GET_VertexAttribP4uiv(disp)) parameters
+static INLINE _glptr_VertexAttribP4uiv GET_VertexAttribP4uiv(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribP4uiv) (GET_by_offset(disp, _gloffset_VertexAttribP4uiv));
+}
+
+static INLINE void SET_VertexAttribP4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLboolean, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribP4uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexP2ui)(GLenum, GLuint);
+#define CALL_VertexP2ui(disp, parameters) \
+ (* GET_VertexP2ui(disp)) parameters
+static INLINE _glptr_VertexP2ui GET_VertexP2ui(struct _glapi_table *disp) {
+ return (_glptr_VertexP2ui) (GET_by_offset(disp, _gloffset_VertexP2ui));
+}
+
+static INLINE void SET_VertexP2ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexP2ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexP2uiv)(GLenum, const GLuint *);
+#define CALL_VertexP2uiv(disp, parameters) \
+ (* GET_VertexP2uiv(disp)) parameters
+static INLINE _glptr_VertexP2uiv GET_VertexP2uiv(struct _glapi_table *disp) {
+ return (_glptr_VertexP2uiv) (GET_by_offset(disp, _gloffset_VertexP2uiv));
+}
+
+static INLINE void SET_VertexP2uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexP2uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexP3ui)(GLenum, GLuint);
+#define CALL_VertexP3ui(disp, parameters) \
+ (* GET_VertexP3ui(disp)) parameters
+static INLINE _glptr_VertexP3ui GET_VertexP3ui(struct _glapi_table *disp) {
+ return (_glptr_VertexP3ui) (GET_by_offset(disp, _gloffset_VertexP3ui));
+}
+
+static INLINE void SET_VertexP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexP3ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexP3uiv)(GLenum, const GLuint *);
+#define CALL_VertexP3uiv(disp, parameters) \
+ (* GET_VertexP3uiv(disp)) parameters
+static INLINE _glptr_VertexP3uiv GET_VertexP3uiv(struct _glapi_table *disp) {
+ return (_glptr_VertexP3uiv) (GET_by_offset(disp, _gloffset_VertexP3uiv));
+}
+
+static INLINE void SET_VertexP3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexP3uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexP4ui)(GLenum, GLuint);
+#define CALL_VertexP4ui(disp, parameters) \
+ (* GET_VertexP4ui(disp)) parameters
+static INLINE _glptr_VertexP4ui GET_VertexP4ui(struct _glapi_table *disp) {
+ return (_glptr_VertexP4ui) (GET_by_offset(disp, _gloffset_VertexP4ui));
+}
+
+static INLINE void SET_VertexP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexP4ui, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexP4uiv)(GLenum, const GLuint *);
+#define CALL_VertexP4uiv(disp, parameters) \
+ (* GET_VertexP4uiv(disp)) parameters
+static INLINE _glptr_VertexP4uiv GET_VertexP4uiv(struct _glapi_table *disp) {
+ return (_glptr_VertexP4uiv) (GET_by_offset(disp, _gloffset_VertexP4uiv));
+}
+
+static INLINE void SET_VertexP4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexP4uiv, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindTransformFeedback)(GLenum, GLuint);
+#define CALL_BindTransformFeedback(disp, parameters) \
+ (* GET_BindTransformFeedback(disp)) parameters
+static INLINE _glptr_BindTransformFeedback GET_BindTransformFeedback(struct _glapi_table *disp) {
+ return (_glptr_BindTransformFeedback) (GET_by_offset(disp, _gloffset_BindTransformFeedback));
+}
+
+static INLINE void SET_BindTransformFeedback(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_BindTransformFeedback, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteTransformFeedbacks)(GLsizei, const GLuint *);
+#define CALL_DeleteTransformFeedbacks(disp, parameters) \
+ (* GET_DeleteTransformFeedbacks(disp)) parameters
+static INLINE _glptr_DeleteTransformFeedbacks GET_DeleteTransformFeedbacks(struct _glapi_table *disp) {
+ return (_glptr_DeleteTransformFeedbacks) (GET_by_offset(disp, _gloffset_DeleteTransformFeedbacks));
+}
+
+static INLINE void SET_DeleteTransformFeedbacks(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_DeleteTransformFeedbacks, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DrawTransformFeedback)(GLenum, GLuint);
+#define CALL_DrawTransformFeedback(disp, parameters) \
+ (* GET_DrawTransformFeedback(disp)) parameters
+static INLINE _glptr_DrawTransformFeedback GET_DrawTransformFeedback(struct _glapi_table *disp) {
+ return (_glptr_DrawTransformFeedback) (GET_by_offset(disp, _gloffset_DrawTransformFeedback));
+}
+
+static INLINE void SET_DrawTransformFeedback(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_DrawTransformFeedback, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenTransformFeedbacks)(GLsizei, GLuint *);
+#define CALL_GenTransformFeedbacks(disp, parameters) \
+ (* GET_GenTransformFeedbacks(disp)) parameters
+static INLINE _glptr_GenTransformFeedbacks GET_GenTransformFeedbacks(struct _glapi_table *disp) {
+ return (_glptr_GenTransformFeedbacks) (GET_by_offset(disp, _gloffset_GenTransformFeedbacks));
+}
+
+static INLINE void SET_GenTransformFeedbacks(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenTransformFeedbacks, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsTransformFeedback)(GLuint);
+#define CALL_IsTransformFeedback(disp, parameters) \
+ (* GET_IsTransformFeedback(disp)) parameters
+static INLINE _glptr_IsTransformFeedback GET_IsTransformFeedback(struct _glapi_table *disp) {
+ return (_glptr_IsTransformFeedback) (GET_by_offset(disp, _gloffset_IsTransformFeedback));
+}
+
+static INLINE void SET_IsTransformFeedback(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsTransformFeedback, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PauseTransformFeedback)(void);
+#define CALL_PauseTransformFeedback(disp, parameters) \
+ (* GET_PauseTransformFeedback(disp)) parameters
+static INLINE _glptr_PauseTransformFeedback GET_PauseTransformFeedback(struct _glapi_table *disp) {
+ return (_glptr_PauseTransformFeedback) (GET_by_offset(disp, _gloffset_PauseTransformFeedback));
+}
+
+static INLINE void SET_PauseTransformFeedback(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_PauseTransformFeedback, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ResumeTransformFeedback)(void);
+#define CALL_ResumeTransformFeedback(disp, parameters) \
+ (* GET_ResumeTransformFeedback(disp)) parameters
+static INLINE _glptr_ResumeTransformFeedback GET_ResumeTransformFeedback(struct _glapi_table *disp) {
+ return (_glptr_ResumeTransformFeedback) (GET_by_offset(disp, _gloffset_ResumeTransformFeedback));
+}
+
+static INLINE void SET_ResumeTransformFeedback(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_ResumeTransformFeedback, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearDepthf)(GLclampf);
+#define CALL_ClearDepthf(disp, parameters) \
+ (* GET_ClearDepthf(disp)) parameters
+static INLINE _glptr_ClearDepthf GET_ClearDepthf(struct _glapi_table *disp) {
+ return (_glptr_ClearDepthf) (GET_by_offset(disp, _gloffset_ClearDepthf));
+}
+
+static INLINE void SET_ClearDepthf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf)) {
+ SET_by_offset(disp, _gloffset_ClearDepthf, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DepthRangef)(GLclampf, GLclampf);
+#define CALL_DepthRangef(disp, parameters) \
+ (* GET_DepthRangef(disp)) parameters
+static INLINE _glptr_DepthRangef GET_DepthRangef(struct _glapi_table *disp) {
+ return (_glptr_DepthRangef) (GET_by_offset(disp, _gloffset_DepthRangef));
+}
+
+static INLINE void SET_DepthRangef(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLclampf)) {
+ SET_by_offset(disp, _gloffset_DepthRangef, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetShaderPrecisionFormat)(GLenum, GLenum, GLint *, GLint *);
+#define CALL_GetShaderPrecisionFormat(disp, parameters) \
+ (* GET_GetShaderPrecisionFormat(disp)) parameters
+static INLINE _glptr_GetShaderPrecisionFormat GET_GetShaderPrecisionFormat(struct _glapi_table *disp) {
+ return (_glptr_GetShaderPrecisionFormat) (GET_by_offset(disp, _gloffset_GetShaderPrecisionFormat));
+}
+
+static INLINE void SET_GetShaderPrecisionFormat(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetShaderPrecisionFormat, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ReleaseShaderCompiler)(void);
+#define CALL_ReleaseShaderCompiler(disp, parameters) \
+ (* GET_ReleaseShaderCompiler(disp)) parameters
+static INLINE _glptr_ReleaseShaderCompiler GET_ReleaseShaderCompiler(struct _glapi_table *disp) {
+ return (_glptr_ReleaseShaderCompiler) (GET_by_offset(disp, _gloffset_ReleaseShaderCompiler));
+}
+
+static INLINE void SET_ReleaseShaderCompiler(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_ReleaseShaderCompiler, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ShaderBinary)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei);
+#define CALL_ShaderBinary(disp, parameters) \
+ (* GET_ShaderBinary(disp)) parameters
+static INLINE _glptr_ShaderBinary GET_ShaderBinary(struct _glapi_table *disp) {
+ return (_glptr_ShaderBinary) (GET_by_offset(disp, _gloffset_ShaderBinary));
+}
+
+static INLINE void SET_ShaderBinary(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei)) {
+ SET_by_offset(disp, _gloffset_ShaderBinary, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DebugMessageCallbackARB)(GLDEBUGPROCARB, GLvoid *);
+#define CALL_DebugMessageCallbackARB(disp, parameters) \
+ (* GET_DebugMessageCallbackARB(disp)) parameters
+static INLINE _glptr_DebugMessageCallbackARB GET_DebugMessageCallbackARB(struct _glapi_table *disp) {
+ return (_glptr_DebugMessageCallbackARB) (GET_by_offset(disp, _gloffset_DebugMessageCallbackARB));
+}
+
+static INLINE void SET_DebugMessageCallbackARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLDEBUGPROCARB, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_DebugMessageCallbackARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DebugMessageControlARB)(GLenum, GLenum, GLenum, GLsizei, const GLuint *, GLboolean);
+#define CALL_DebugMessageControlARB(disp, parameters) \
+ (* GET_DebugMessageControlARB(disp)) parameters
+static INLINE _glptr_DebugMessageControlARB GET_DebugMessageControlARB(struct _glapi_table *disp) {
+ return (_glptr_DebugMessageControlARB) (GET_by_offset(disp, _gloffset_DebugMessageControlARB));
+}
+
+static INLINE void SET_DebugMessageControlARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLsizei, const GLuint *, GLboolean)) {
+ SET_by_offset(disp, _gloffset_DebugMessageControlARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DebugMessageInsertARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLcharARB *);
+#define CALL_DebugMessageInsertARB(disp, parameters) \
+ (* GET_DebugMessageInsertARB(disp)) parameters
+static INLINE _glptr_DebugMessageInsertARB GET_DebugMessageInsertARB(struct _glapi_table *disp) {
+ return (_glptr_DebugMessageInsertARB) (GET_by_offset(disp, _gloffset_DebugMessageInsertARB));
+}
+
+static INLINE void SET_DebugMessageInsertARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLcharARB *)) {
+ SET_by_offset(disp, _gloffset_DebugMessageInsertARB, fn);
+}
+
+typedef GLuint (GLAPIENTRYP _glptr_GetDebugMessageLogARB)(GLuint, GLsizei, GLenum *, GLenum *, GLuint *, GLenum *, GLsizei *, GLcharARB *);
+#define CALL_GetDebugMessageLogARB(disp, parameters) \
+ (* GET_GetDebugMessageLogARB(disp)) parameters
+static INLINE _glptr_GetDebugMessageLogARB GET_GetDebugMessageLogARB(struct _glapi_table *disp) {
+ return (_glptr_GetDebugMessageLogARB) (GET_by_offset(disp, _gloffset_GetDebugMessageLogARB));
+}
+
+static INLINE void SET_GetDebugMessageLogARB(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(GLuint, GLsizei, GLenum *, GLenum *, GLuint *, GLenum *, GLsizei *, GLcharARB *)) {
+ SET_by_offset(disp, _gloffset_GetDebugMessageLogARB, fn);
+}
+
+typedef GLenum (GLAPIENTRYP _glptr_GetGraphicsResetStatusARB)(void);
+#define CALL_GetGraphicsResetStatusARB(disp, parameters) \
+ (* GET_GetGraphicsResetStatusARB(disp)) parameters
+static INLINE _glptr_GetGraphicsResetStatusARB GET_GetGraphicsResetStatusARB(struct _glapi_table *disp) {
+ return (_glptr_GetGraphicsResetStatusARB) (GET_by_offset(disp, _gloffset_GetGraphicsResetStatusARB));
+}
+
+static INLINE void SET_GetGraphicsResetStatusARB(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_GetGraphicsResetStatusARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnColorTableARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *);
+#define CALL_GetnColorTableARB(disp, parameters) \
+ (* GET_GetnColorTableARB(disp)) parameters
+static INLINE _glptr_GetnColorTableARB GET_GetnColorTableARB(struct _glapi_table *disp) {
+ return (_glptr_GetnColorTableARB) (GET_by_offset(disp, _gloffset_GetnColorTableARB));
+}
+
+static INLINE void SET_GetnColorTableARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLsizei, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetnColorTableARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnCompressedTexImageARB)(GLenum, GLint, GLsizei, GLvoid *);
+#define CALL_GetnCompressedTexImageARB(disp, parameters) \
+ (* GET_GetnCompressedTexImageARB(disp)) parameters
+static INLINE _glptr_GetnCompressedTexImageARB GET_GetnCompressedTexImageARB(struct _glapi_table *disp) {
+ return (_glptr_GetnCompressedTexImageARB) (GET_by_offset(disp, _gloffset_GetnCompressedTexImageARB));
+}
+
+static INLINE void SET_GetnCompressedTexImageARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLsizei, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetnCompressedTexImageARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnConvolutionFilterARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *);
+#define CALL_GetnConvolutionFilterARB(disp, parameters) \
+ (* GET_GetnConvolutionFilterARB(disp)) parameters
+static INLINE _glptr_GetnConvolutionFilterARB GET_GetnConvolutionFilterARB(struct _glapi_table *disp) {
+ return (_glptr_GetnConvolutionFilterARB) (GET_by_offset(disp, _gloffset_GetnConvolutionFilterARB));
+}
+
+static INLINE void SET_GetnConvolutionFilterARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLsizei, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetnConvolutionFilterARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnHistogramARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *);
+#define CALL_GetnHistogramARB(disp, parameters) \
+ (* GET_GetnHistogramARB(disp)) parameters
+static INLINE _glptr_GetnHistogramARB GET_GetnHistogramARB(struct _glapi_table *disp) {
+ return (_glptr_GetnHistogramARB) (GET_by_offset(disp, _gloffset_GetnHistogramARB));
+}
+
+static INLINE void SET_GetnHistogramARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetnHistogramARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnMapdvARB)(GLenum, GLenum, GLsizei, GLdouble *);
+#define CALL_GetnMapdvARB(disp, parameters) \
+ (* GET_GetnMapdvARB(disp)) parameters
+static INLINE _glptr_GetnMapdvARB GET_GetnMapdvARB(struct _glapi_table *disp) {
+ return (_glptr_GetnMapdvARB) (GET_by_offset(disp, _gloffset_GetnMapdvARB));
+}
+
+static INLINE void SET_GetnMapdvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetnMapdvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnMapfvARB)(GLenum, GLenum, GLsizei, GLfloat *);
+#define CALL_GetnMapfvARB(disp, parameters) \
+ (* GET_GetnMapfvARB(disp)) parameters
+static INLINE _glptr_GetnMapfvARB GET_GetnMapfvARB(struct _glapi_table *disp) {
+ return (_glptr_GetnMapfvARB) (GET_by_offset(disp, _gloffset_GetnMapfvARB));
+}
+
+static INLINE void SET_GetnMapfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetnMapfvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnMapivARB)(GLenum, GLenum, GLsizei, GLint *);
+#define CALL_GetnMapivARB(disp, parameters) \
+ (* GET_GetnMapivARB(disp)) parameters
+static INLINE _glptr_GetnMapivARB GET_GetnMapivARB(struct _glapi_table *disp) {
+ return (_glptr_GetnMapivARB) (GET_by_offset(disp, _gloffset_GetnMapivARB));
+}
+
+static INLINE void SET_GetnMapivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetnMapivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnMinmaxARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *);
+#define CALL_GetnMinmaxARB(disp, parameters) \
+ (* GET_GetnMinmaxARB(disp)) parameters
+static INLINE _glptr_GetnMinmaxARB GET_GetnMinmaxARB(struct _glapi_table *disp) {
+ return (_glptr_GetnMinmaxARB) (GET_by_offset(disp, _gloffset_GetnMinmaxARB));
+}
+
+static INLINE void SET_GetnMinmaxARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetnMinmaxARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnPixelMapfvARB)(GLenum, GLsizei, GLfloat *);
+#define CALL_GetnPixelMapfvARB(disp, parameters) \
+ (* GET_GetnPixelMapfvARB(disp)) parameters
+static INLINE _glptr_GetnPixelMapfvARB GET_GetnPixelMapfvARB(struct _glapi_table *disp) {
+ return (_glptr_GetnPixelMapfvARB) (GET_by_offset(disp, _gloffset_GetnPixelMapfvARB));
+}
+
+static INLINE void SET_GetnPixelMapfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetnPixelMapfvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnPixelMapuivARB)(GLenum, GLsizei, GLuint *);
+#define CALL_GetnPixelMapuivARB(disp, parameters) \
+ (* GET_GetnPixelMapuivARB(disp)) parameters
+static INLINE _glptr_GetnPixelMapuivARB GET_GetnPixelMapuivARB(struct _glapi_table *disp) {
+ return (_glptr_GetnPixelMapuivARB) (GET_by_offset(disp, _gloffset_GetnPixelMapuivARB));
+}
+
+static INLINE void SET_GetnPixelMapuivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GetnPixelMapuivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnPixelMapusvARB)(GLenum, GLsizei, GLushort *);
+#define CALL_GetnPixelMapusvARB(disp, parameters) \
+ (* GET_GetnPixelMapusvARB(disp)) parameters
+static INLINE _glptr_GetnPixelMapusvARB GET_GetnPixelMapusvARB(struct _glapi_table *disp) {
+ return (_glptr_GetnPixelMapusvARB) (GET_by_offset(disp, _gloffset_GetnPixelMapusvARB));
+}
+
+static INLINE void SET_GetnPixelMapusvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLushort *)) {
+ SET_by_offset(disp, _gloffset_GetnPixelMapusvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnPolygonStippleARB)(GLsizei, GLubyte *);
+#define CALL_GetnPolygonStippleARB(disp, parameters) \
+ (* GET_GetnPolygonStippleARB(disp)) parameters
+static INLINE _glptr_GetnPolygonStippleARB GET_GetnPolygonStippleARB(struct _glapi_table *disp) {
+ return (_glptr_GetnPolygonStippleARB) (GET_by_offset(disp, _gloffset_GetnPolygonStippleARB));
+}
+
+static INLINE void SET_GetnPolygonStippleARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLubyte *)) {
+ SET_by_offset(disp, _gloffset_GetnPolygonStippleARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnSeparableFilterARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *, GLsizei, GLvoid *, GLvoid *);
+#define CALL_GetnSeparableFilterARB(disp, parameters) \
+ (* GET_GetnSeparableFilterARB(disp)) parameters
+static INLINE _glptr_GetnSeparableFilterARB GET_GetnSeparableFilterARB(struct _glapi_table *disp) {
+ return (_glptr_GetnSeparableFilterARB) (GET_by_offset(disp, _gloffset_GetnSeparableFilterARB));
+}
+
+static INLINE void SET_GetnSeparableFilterARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLsizei, GLvoid *, GLsizei, GLvoid *, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetnSeparableFilterARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnTexImageARB)(GLenum, GLint, GLenum, GLenum, GLsizei, GLvoid *);
+#define CALL_GetnTexImageARB(disp, parameters) \
+ (* GET_GetnTexImageARB(disp)) parameters
+static INLINE _glptr_GetnTexImageARB GET_GetnTexImageARB(struct _glapi_table *disp) {
+ return (_glptr_GetnTexImageARB) (GET_by_offset(disp, _gloffset_GetnTexImageARB));
+}
+
+static INLINE void SET_GetnTexImageARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLenum, GLsizei, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_GetnTexImageARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnUniformdvARB)(GLhandleARB, GLint, GLsizei, GLdouble *);
+#define CALL_GetnUniformdvARB(disp, parameters) \
+ (* GET_GetnUniformdvARB(disp)) parameters
+static INLINE _glptr_GetnUniformdvARB GET_GetnUniformdvARB(struct _glapi_table *disp) {
+ return (_glptr_GetnUniformdvARB) (GET_by_offset(disp, _gloffset_GetnUniformdvARB));
+}
+
+static INLINE void SET_GetnUniformdvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLsizei, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetnUniformdvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnUniformfvARB)(GLhandleARB, GLint, GLsizei, GLfloat *);
+#define CALL_GetnUniformfvARB(disp, parameters) \
+ (* GET_GetnUniformfvARB(disp)) parameters
+static INLINE _glptr_GetnUniformfvARB GET_GetnUniformfvARB(struct _glapi_table *disp) {
+ return (_glptr_GetnUniformfvARB) (GET_by_offset(disp, _gloffset_GetnUniformfvARB));
+}
+
+static INLINE void SET_GetnUniformfvARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLsizei, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetnUniformfvARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnUniformivARB)(GLhandleARB, GLint, GLsizei, GLint *);
+#define CALL_GetnUniformivARB(disp, parameters) \
+ (* GET_GetnUniformivARB(disp)) parameters
+static INLINE _glptr_GetnUniformivARB GET_GetnUniformivARB(struct _glapi_table *disp) {
+ return (_glptr_GetnUniformivARB) (GET_by_offset(disp, _gloffset_GetnUniformivARB));
+}
+
+static INLINE void SET_GetnUniformivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLsizei, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetnUniformivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetnUniformuivARB)(GLhandleARB, GLint, GLsizei, GLuint *);
+#define CALL_GetnUniformuivARB(disp, parameters) \
+ (* GET_GetnUniformuivARB(disp)) parameters
+static INLINE _glptr_GetnUniformuivARB GET_GetnUniformuivARB(struct _glapi_table *disp) {
+ return (_glptr_GetnUniformuivARB) (GET_by_offset(disp, _gloffset_GetnUniformuivARB));
+}
+
+static INLINE void SET_GetnUniformuivARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLhandleARB, GLint, GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GetnUniformuivARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ReadnPixelsARB)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, GLvoid *);
+#define CALL_ReadnPixelsARB(disp, parameters) \
+ (* GET_ReadnPixelsARB(disp)) parameters
+static INLINE _glptr_ReadnPixelsARB GET_ReadnPixelsARB(struct _glapi_table *disp) {
+ return (_glptr_ReadnPixelsARB) (GET_by_offset(disp, _gloffset_ReadnPixelsARB));
+}
+
+static INLINE void SET_ReadnPixelsARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_ReadnPixelsARB, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexStorage1D)(GLenum, GLsizei, GLenum, GLsizei);
+#define CALL_TexStorage1D(disp, parameters) \
+ (* GET_TexStorage1D(disp)) parameters
+static INLINE _glptr_TexStorage1D GET_TexStorage1D(struct _glapi_table *disp) {
+ return (_glptr_TexStorage1D) (GET_by_offset(disp, _gloffset_TexStorage1D));
+}
+
+static INLINE void SET_TexStorage1D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, GLsizei)) {
+ SET_by_offset(disp, _gloffset_TexStorage1D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexStorage2D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+#define CALL_TexStorage2D(disp, parameters) \
+ (* GET_TexStorage2D(disp)) parameters
+static INLINE _glptr_TexStorage2D GET_TexStorage2D(struct _glapi_table *disp) {
+ return (_glptr_TexStorage2D) (GET_by_offset(disp, _gloffset_TexStorage2D));
+}
+
+static INLINE void SET_TexStorage2D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_TexStorage2D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexStorage3D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei);
+#define CALL_TexStorage3D(disp, parameters) \
+ (* GET_TexStorage3D(disp)) parameters
+static INLINE _glptr_TexStorage3D GET_TexStorage3D(struct _glapi_table *disp) {
+ return (_glptr_TexStorage3D) (GET_by_offset(disp, _gloffset_TexStorage3D));
+}
+
+static INLINE void SET_TexStorage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_TexStorage3D, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TextureStorage1DEXT)(GLuint, GLenum, GLsizei, GLenum, GLsizei);
+#define CALL_TextureStorage1DEXT(disp, parameters) \
+ (* GET_TextureStorage1DEXT(disp)) parameters
+static INLINE _glptr_TextureStorage1DEXT GET_TextureStorage1DEXT(struct _glapi_table *disp) {
+ return (_glptr_TextureStorage1DEXT) (GET_by_offset(disp, _gloffset_TextureStorage1DEXT));
+}
+
+static INLINE void SET_TextureStorage1DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLsizei, GLenum, GLsizei)) {
+ SET_by_offset(disp, _gloffset_TextureStorage1DEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TextureStorage2DEXT)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+#define CALL_TextureStorage2DEXT(disp, parameters) \
+ (* GET_TextureStorage2DEXT(disp)) parameters
+static INLINE _glptr_TextureStorage2DEXT GET_TextureStorage2DEXT(struct _glapi_table *disp) {
+ return (_glptr_TextureStorage2DEXT) (GET_by_offset(disp, _gloffset_TextureStorage2DEXT));
+}
+
+static INLINE void SET_TextureStorage2DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_TextureStorage2DEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TextureStorage3DEXT)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei);
+#define CALL_TextureStorage3DEXT(disp, parameters) \
+ (* GET_TextureStorage3DEXT(disp)) parameters
+static INLINE _glptr_TextureStorage3DEXT GET_TextureStorage3DEXT(struct _glapi_table *disp) {
+ return (_glptr_TextureStorage3DEXT) (GET_by_offset(disp, _gloffset_TextureStorage3DEXT));
+}
+
+static INLINE void SET_TextureStorage3DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_TextureStorage3DEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PolygonOffsetEXT)(GLfloat, GLfloat);
+#define CALL_PolygonOffsetEXT(disp, parameters) \
+ (* GET_PolygonOffsetEXT(disp)) parameters
+static INLINE _glptr_PolygonOffsetEXT GET_PolygonOffsetEXT(struct _glapi_table *disp) {
+ return (_glptr_PolygonOffsetEXT) (GET_by_offset(disp, _gloffset_PolygonOffsetEXT));
+}
+
+static INLINE void SET_PolygonOffsetEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_PolygonOffsetEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetPixelTexGenParameterfvSGIS)(GLenum, GLfloat *);
+#define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) \
+ (* GET_GetPixelTexGenParameterfvSGIS(disp)) parameters
+static INLINE _glptr_GetPixelTexGenParameterfvSGIS GET_GetPixelTexGenParameterfvSGIS(struct _glapi_table *disp) {
+ return (_glptr_GetPixelTexGenParameterfvSGIS) (GET_by_offset(disp, _gloffset_GetPixelTexGenParameterfvSGIS));
+}
+
+static INLINE void SET_GetPixelTexGenParameterfvSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetPixelTexGenParameterfvSGIS, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetPixelTexGenParameterivSGIS)(GLenum, GLint *);
+#define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) \
+ (* GET_GetPixelTexGenParameterivSGIS(disp)) parameters
+static INLINE _glptr_GetPixelTexGenParameterivSGIS GET_GetPixelTexGenParameterivSGIS(struct _glapi_table *disp) {
+ return (_glptr_GetPixelTexGenParameterivSGIS) (GET_by_offset(disp, _gloffset_GetPixelTexGenParameterivSGIS));
+}
+
+static INLINE void SET_GetPixelTexGenParameterivSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetPixelTexGenParameterivSGIS, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelTexGenParameterfSGIS)(GLenum, GLfloat);
+#define CALL_PixelTexGenParameterfSGIS(disp, parameters) \
+ (* GET_PixelTexGenParameterfSGIS(disp)) parameters
+static INLINE _glptr_PixelTexGenParameterfSGIS GET_PixelTexGenParameterfSGIS(struct _glapi_table *disp) {
+ return (_glptr_PixelTexGenParameterfSGIS) (GET_by_offset(disp, _gloffset_PixelTexGenParameterfSGIS));
+}
+
+static INLINE void SET_PixelTexGenParameterfSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_PixelTexGenParameterfSGIS, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelTexGenParameterfvSGIS)(GLenum, const GLfloat *);
+#define CALL_PixelTexGenParameterfvSGIS(disp, parameters) \
+ (* GET_PixelTexGenParameterfvSGIS(disp)) parameters
+static INLINE _glptr_PixelTexGenParameterfvSGIS GET_PixelTexGenParameterfvSGIS(struct _glapi_table *disp) {
+ return (_glptr_PixelTexGenParameterfvSGIS) (GET_by_offset(disp, _gloffset_PixelTexGenParameterfvSGIS));
+}
+
+static INLINE void SET_PixelTexGenParameterfvSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_PixelTexGenParameterfvSGIS, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelTexGenParameteriSGIS)(GLenum, GLint);
+#define CALL_PixelTexGenParameteriSGIS(disp, parameters) \
+ (* GET_PixelTexGenParameteriSGIS(disp)) parameters
+static INLINE _glptr_PixelTexGenParameteriSGIS GET_PixelTexGenParameteriSGIS(struct _glapi_table *disp) {
+ return (_glptr_PixelTexGenParameteriSGIS) (GET_by_offset(disp, _gloffset_PixelTexGenParameteriSGIS));
+}
+
+static INLINE void SET_PixelTexGenParameteriSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_PixelTexGenParameteriSGIS, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelTexGenParameterivSGIS)(GLenum, const GLint *);
+#define CALL_PixelTexGenParameterivSGIS(disp, parameters) \
+ (* GET_PixelTexGenParameterivSGIS(disp)) parameters
+static INLINE _glptr_PixelTexGenParameterivSGIS GET_PixelTexGenParameterivSGIS(struct _glapi_table *disp) {
+ return (_glptr_PixelTexGenParameterivSGIS) (GET_by_offset(disp, _gloffset_PixelTexGenParameterivSGIS));
+}
+
+static INLINE void SET_PixelTexGenParameterivSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_PixelTexGenParameterivSGIS, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SampleMaskSGIS)(GLclampf, GLboolean);
+#define CALL_SampleMaskSGIS(disp, parameters) \
+ (* GET_SampleMaskSGIS(disp)) parameters
+static INLINE _glptr_SampleMaskSGIS GET_SampleMaskSGIS(struct _glapi_table *disp) {
+ return (_glptr_SampleMaskSGIS) (GET_by_offset(disp, _gloffset_SampleMaskSGIS));
+}
+
+static INLINE void SET_SampleMaskSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLboolean)) {
+ SET_by_offset(disp, _gloffset_SampleMaskSGIS, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SamplePatternSGIS)(GLenum);
+#define CALL_SamplePatternSGIS(disp, parameters) \
+ (* GET_SamplePatternSGIS(disp)) parameters
+static INLINE _glptr_SamplePatternSGIS GET_SamplePatternSGIS(struct _glapi_table *disp) {
+ return (_glptr_SamplePatternSGIS) (GET_by_offset(disp, _gloffset_SamplePatternSGIS));
+}
+
+static INLINE void SET_SamplePatternSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_SamplePatternSGIS, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorPointerEXT)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
+#define CALL_ColorPointerEXT(disp, parameters) \
+ (* GET_ColorPointerEXT(disp)) parameters
+static INLINE _glptr_ColorPointerEXT GET_ColorPointerEXT(struct _glapi_table *disp) {
+ return (_glptr_ColorPointerEXT) (GET_by_offset(disp, _gloffset_ColorPointerEXT));
+}
+
+static INLINE void SET_ColorPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_ColorPointerEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EdgeFlagPointerEXT)(GLsizei, GLsizei, const GLboolean *);
+#define CALL_EdgeFlagPointerEXT(disp, parameters) \
+ (* GET_EdgeFlagPointerEXT(disp)) parameters
+static INLINE _glptr_EdgeFlagPointerEXT GET_EdgeFlagPointerEXT(struct _glapi_table *disp) {
+ return (_glptr_EdgeFlagPointerEXT) (GET_by_offset(disp, _gloffset_EdgeFlagPointerEXT));
+}
+
+static INLINE void SET_EdgeFlagPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLsizei, const GLboolean *)) {
+ SET_by_offset(disp, _gloffset_EdgeFlagPointerEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_IndexPointerEXT)(GLenum, GLsizei, GLsizei, const GLvoid *);
+#define CALL_IndexPointerEXT(disp, parameters) \
+ (* GET_IndexPointerEXT(disp)) parameters
+static INLINE _glptr_IndexPointerEXT GET_IndexPointerEXT(struct _glapi_table *disp) {
+ return (_glptr_IndexPointerEXT) (GET_by_offset(disp, _gloffset_IndexPointerEXT));
+}
+
+static INLINE void SET_IndexPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_IndexPointerEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_NormalPointerEXT)(GLenum, GLsizei, GLsizei, const GLvoid *);
+#define CALL_NormalPointerEXT(disp, parameters) \
+ (* GET_NormalPointerEXT(disp)) parameters
+static INLINE _glptr_NormalPointerEXT GET_NormalPointerEXT(struct _glapi_table *disp) {
+ return (_glptr_NormalPointerEXT) (GET_by_offset(disp, _gloffset_NormalPointerEXT));
+}
+
+static INLINE void SET_NormalPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_NormalPointerEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexCoordPointerEXT)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
+#define CALL_TexCoordPointerEXT(disp, parameters) \
+ (* GET_TexCoordPointerEXT(disp)) parameters
+static INLINE _glptr_TexCoordPointerEXT GET_TexCoordPointerEXT(struct _glapi_table *disp) {
+ return (_glptr_TexCoordPointerEXT) (GET_by_offset(disp, _gloffset_TexCoordPointerEXT));
+}
+
+static INLINE void SET_TexCoordPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_TexCoordPointerEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexPointerEXT)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
+#define CALL_VertexPointerEXT(disp, parameters) \
+ (* GET_VertexPointerEXT(disp)) parameters
+static INLINE _glptr_VertexPointerEXT GET_VertexPointerEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexPointerEXT) (GET_by_offset(disp, _gloffset_VertexPointerEXT));
+}
+
+static INLINE void SET_VertexPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_VertexPointerEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PointParameterfEXT)(GLenum, GLfloat);
+#define CALL_PointParameterfEXT(disp, parameters) \
+ (* GET_PointParameterfEXT(disp)) parameters
+static INLINE _glptr_PointParameterfEXT GET_PointParameterfEXT(struct _glapi_table *disp) {
+ return (_glptr_PointParameterfEXT) (GET_by_offset(disp, _gloffset_PointParameterfEXT));
+}
+
+static INLINE void SET_PointParameterfEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_PointParameterfEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PointParameterfvEXT)(GLenum, const GLfloat *);
+#define CALL_PointParameterfvEXT(disp, parameters) \
+ (* GET_PointParameterfvEXT(disp)) parameters
+static INLINE _glptr_PointParameterfvEXT GET_PointParameterfvEXT(struct _glapi_table *disp) {
+ return (_glptr_PointParameterfvEXT) (GET_by_offset(disp, _gloffset_PointParameterfvEXT));
+}
+
+static INLINE void SET_PointParameterfvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_PointParameterfvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LockArraysEXT)(GLint, GLsizei);
+#define CALL_LockArraysEXT(disp, parameters) \
+ (* GET_LockArraysEXT(disp)) parameters
+static INLINE _glptr_LockArraysEXT GET_LockArraysEXT(struct _glapi_table *disp) {
+ return (_glptr_LockArraysEXT) (GET_by_offset(disp, _gloffset_LockArraysEXT));
+}
+
+static INLINE void SET_LockArraysEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei)) {
+ SET_by_offset(disp, _gloffset_LockArraysEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UnlockArraysEXT)(void);
+#define CALL_UnlockArraysEXT(disp, parameters) \
+ (* GET_UnlockArraysEXT(disp)) parameters
+static INLINE _glptr_UnlockArraysEXT GET_UnlockArraysEXT(struct _glapi_table *disp) {
+ return (_glptr_UnlockArraysEXT) (GET_by_offset(disp, _gloffset_UnlockArraysEXT));
+}
+
+static INLINE void SET_UnlockArraysEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_UnlockArraysEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3bEXT)(GLbyte, GLbyte, GLbyte);
+#define CALL_SecondaryColor3bEXT(disp, parameters) \
+ (* GET_SecondaryColor3bEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3bEXT GET_SecondaryColor3bEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3bEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3bEXT));
+}
+
+static INLINE void SET_SecondaryColor3bEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLbyte, GLbyte, GLbyte)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3bEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3bvEXT)(const GLbyte *);
+#define CALL_SecondaryColor3bvEXT(disp, parameters) \
+ (* GET_SecondaryColor3bvEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3bvEXT GET_SecondaryColor3bvEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3bvEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3bvEXT));
+}
+
+static INLINE void SET_SecondaryColor3bvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLbyte *)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3bvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3dEXT)(GLdouble, GLdouble, GLdouble);
+#define CALL_SecondaryColor3dEXT(disp, parameters) \
+ (* GET_SecondaryColor3dEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3dEXT GET_SecondaryColor3dEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3dEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3dEXT));
+}
+
+static INLINE void SET_SecondaryColor3dEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3dEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3dvEXT)(const GLdouble *);
+#define CALL_SecondaryColor3dvEXT(disp, parameters) \
+ (* GET_SecondaryColor3dvEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3dvEXT GET_SecondaryColor3dvEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3dvEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3dvEXT));
+}
+
+static INLINE void SET_SecondaryColor3dvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3dvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3fEXT)(GLfloat, GLfloat, GLfloat);
+#define CALL_SecondaryColor3fEXT(disp, parameters) \
+ (* GET_SecondaryColor3fEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3fEXT GET_SecondaryColor3fEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3fEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3fEXT));
+}
+
+static INLINE void SET_SecondaryColor3fEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3fEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3fvEXT)(const GLfloat *);
+#define CALL_SecondaryColor3fvEXT(disp, parameters) \
+ (* GET_SecondaryColor3fvEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3fvEXT GET_SecondaryColor3fvEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3fvEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3fvEXT));
+}
+
+static INLINE void SET_SecondaryColor3fvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3fvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3iEXT)(GLint, GLint, GLint);
+#define CALL_SecondaryColor3iEXT(disp, parameters) \
+ (* GET_SecondaryColor3iEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3iEXT GET_SecondaryColor3iEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3iEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3iEXT));
+}
+
+static INLINE void SET_SecondaryColor3iEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3iEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3ivEXT)(const GLint *);
+#define CALL_SecondaryColor3ivEXT(disp, parameters) \
+ (* GET_SecondaryColor3ivEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3ivEXT GET_SecondaryColor3ivEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3ivEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3ivEXT));
+}
+
+static INLINE void SET_SecondaryColor3ivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3ivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3sEXT)(GLshort, GLshort, GLshort);
+#define CALL_SecondaryColor3sEXT(disp, parameters) \
+ (* GET_SecondaryColor3sEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3sEXT GET_SecondaryColor3sEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3sEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3sEXT));
+}
+
+static INLINE void SET_SecondaryColor3sEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3sEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3svEXT)(const GLshort *);
+#define CALL_SecondaryColor3svEXT(disp, parameters) \
+ (* GET_SecondaryColor3svEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3svEXT GET_SecondaryColor3svEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3svEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3svEXT));
+}
+
+static INLINE void SET_SecondaryColor3svEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3svEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3ubEXT)(GLubyte, GLubyte, GLubyte);
+#define CALL_SecondaryColor3ubEXT(disp, parameters) \
+ (* GET_SecondaryColor3ubEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3ubEXT GET_SecondaryColor3ubEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3ubEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3ubEXT));
+}
+
+static INLINE void SET_SecondaryColor3ubEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLubyte, GLubyte, GLubyte)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3ubEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3ubvEXT)(const GLubyte *);
+#define CALL_SecondaryColor3ubvEXT(disp, parameters) \
+ (* GET_SecondaryColor3ubvEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3ubvEXT GET_SecondaryColor3ubvEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3ubvEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3ubvEXT));
+}
+
+static INLINE void SET_SecondaryColor3ubvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3ubvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3uiEXT)(GLuint, GLuint, GLuint);
+#define CALL_SecondaryColor3uiEXT(disp, parameters) \
+ (* GET_SecondaryColor3uiEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3uiEXT GET_SecondaryColor3uiEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3uiEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3uiEXT));
+}
+
+static INLINE void SET_SecondaryColor3uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3uiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3uivEXT)(const GLuint *);
+#define CALL_SecondaryColor3uivEXT(disp, parameters) \
+ (* GET_SecondaryColor3uivEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3uivEXT GET_SecondaryColor3uivEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3uivEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3uivEXT));
+}
+
+static INLINE void SET_SecondaryColor3uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLuint *)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3uivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3usEXT)(GLushort, GLushort, GLushort);
+#define CALL_SecondaryColor3usEXT(disp, parameters) \
+ (* GET_SecondaryColor3usEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3usEXT GET_SecondaryColor3usEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3usEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3usEXT));
+}
+
+static INLINE void SET_SecondaryColor3usEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLushort, GLushort, GLushort)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3usEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColor3usvEXT)(const GLushort *);
+#define CALL_SecondaryColor3usvEXT(disp, parameters) \
+ (* GET_SecondaryColor3usvEXT(disp)) parameters
+static INLINE _glptr_SecondaryColor3usvEXT GET_SecondaryColor3usvEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColor3usvEXT) (GET_by_offset(disp, _gloffset_SecondaryColor3usvEXT));
+}
+
+static INLINE void SET_SecondaryColor3usvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLushort *)) {
+ SET_by_offset(disp, _gloffset_SecondaryColor3usvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SecondaryColorPointerEXT)(GLint, GLenum, GLsizei, const GLvoid *);
+#define CALL_SecondaryColorPointerEXT(disp, parameters) \
+ (* GET_SecondaryColorPointerEXT(disp)) parameters
+static INLINE _glptr_SecondaryColorPointerEXT GET_SecondaryColorPointerEXT(struct _glapi_table *disp) {
+ return (_glptr_SecondaryColorPointerEXT) (GET_by_offset(disp, _gloffset_SecondaryColorPointerEXT));
+}
+
+static INLINE void SET_SecondaryColorPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_SecondaryColorPointerEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiDrawArraysEXT)(GLenum, const GLint *, const GLsizei *, GLsizei);
+#define CALL_MultiDrawArraysEXT(disp, parameters) \
+ (* GET_MultiDrawArraysEXT(disp)) parameters
+static INLINE _glptr_MultiDrawArraysEXT GET_MultiDrawArraysEXT(struct _glapi_table *disp) {
+ return (_glptr_MultiDrawArraysEXT) (GET_by_offset(disp, _gloffset_MultiDrawArraysEXT));
+}
+
+static INLINE void SET_MultiDrawArraysEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *, const GLsizei *, GLsizei)) {
+ SET_by_offset(disp, _gloffset_MultiDrawArraysEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiDrawElementsEXT)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei);
+#define CALL_MultiDrawElementsEXT(disp, parameters) \
+ (* GET_MultiDrawElementsEXT(disp)) parameters
+static INLINE _glptr_MultiDrawElementsEXT GET_MultiDrawElementsEXT(struct _glapi_table *disp) {
+ return (_glptr_MultiDrawElementsEXT) (GET_by_offset(disp, _gloffset_MultiDrawElementsEXT));
+}
+
+static INLINE void SET_MultiDrawElementsEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei)) {
+ SET_by_offset(disp, _gloffset_MultiDrawElementsEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FogCoordPointerEXT)(GLenum, GLsizei, const GLvoid *);
+#define CALL_FogCoordPointerEXT(disp, parameters) \
+ (* GET_FogCoordPointerEXT(disp)) parameters
+static INLINE _glptr_FogCoordPointerEXT GET_FogCoordPointerEXT(struct _glapi_table *disp) {
+ return (_glptr_FogCoordPointerEXT) (GET_by_offset(disp, _gloffset_FogCoordPointerEXT));
+}
+
+static INLINE void SET_FogCoordPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_FogCoordPointerEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FogCoorddEXT)(GLdouble);
+#define CALL_FogCoorddEXT(disp, parameters) \
+ (* GET_FogCoorddEXT(disp)) parameters
+static INLINE _glptr_FogCoorddEXT GET_FogCoorddEXT(struct _glapi_table *disp) {
+ return (_glptr_FogCoorddEXT) (GET_by_offset(disp, _gloffset_FogCoorddEXT));
+}
+
+static INLINE void SET_FogCoorddEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble)) {
+ SET_by_offset(disp, _gloffset_FogCoorddEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FogCoorddvEXT)(const GLdouble *);
+#define CALL_FogCoorddvEXT(disp, parameters) \
+ (* GET_FogCoorddvEXT(disp)) parameters
+static INLINE _glptr_FogCoorddvEXT GET_FogCoorddvEXT(struct _glapi_table *disp) {
+ return (_glptr_FogCoorddvEXT) (GET_by_offset(disp, _gloffset_FogCoorddvEXT));
+}
+
+static INLINE void SET_FogCoorddvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_FogCoorddvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FogCoordfEXT)(GLfloat);
+#define CALL_FogCoordfEXT(disp, parameters) \
+ (* GET_FogCoordfEXT(disp)) parameters
+static INLINE _glptr_FogCoordfEXT GET_FogCoordfEXT(struct _glapi_table *disp) {
+ return (_glptr_FogCoordfEXT) (GET_by_offset(disp, _gloffset_FogCoordfEXT));
+}
+
+static INLINE void SET_FogCoordfEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat)) {
+ SET_by_offset(disp, _gloffset_FogCoordfEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FogCoordfvEXT)(const GLfloat *);
+#define CALL_FogCoordfvEXT(disp, parameters) \
+ (* GET_FogCoordfvEXT(disp)) parameters
+static INLINE _glptr_FogCoordfvEXT GET_FogCoordfvEXT(struct _glapi_table *disp) {
+ return (_glptr_FogCoordfvEXT) (GET_by_offset(disp, _gloffset_FogCoordfvEXT));
+}
+
+static INLINE void SET_FogCoordfvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_FogCoordfvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PixelTexGenSGIX)(GLenum);
+#define CALL_PixelTexGenSGIX(disp, parameters) \
+ (* GET_PixelTexGenSGIX(disp)) parameters
+static INLINE _glptr_PixelTexGenSGIX GET_PixelTexGenSGIX(struct _glapi_table *disp) {
+ return (_glptr_PixelTexGenSGIX) (GET_by_offset(disp, _gloffset_PixelTexGenSGIX));
+}
+
+static INLINE void SET_PixelTexGenSGIX(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_PixelTexGenSGIX, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BlendFuncSeparateEXT)(GLenum, GLenum, GLenum, GLenum);
+#define CALL_BlendFuncSeparateEXT(disp, parameters) \
+ (* GET_BlendFuncSeparateEXT(disp)) parameters
+static INLINE _glptr_BlendFuncSeparateEXT GET_BlendFuncSeparateEXT(struct _glapi_table *disp) {
+ return (_glptr_BlendFuncSeparateEXT) (GET_by_offset(disp, _gloffset_BlendFuncSeparateEXT));
+}
+
+static INLINE void SET_BlendFuncSeparateEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_BlendFuncSeparateEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FlushVertexArrayRangeNV)(void);
+#define CALL_FlushVertexArrayRangeNV(disp, parameters) \
+ (* GET_FlushVertexArrayRangeNV(disp)) parameters
+static INLINE _glptr_FlushVertexArrayRangeNV GET_FlushVertexArrayRangeNV(struct _glapi_table *disp) {
+ return (_glptr_FlushVertexArrayRangeNV) (GET_by_offset(disp, _gloffset_FlushVertexArrayRangeNV));
+}
+
+static INLINE void SET_FlushVertexArrayRangeNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_FlushVertexArrayRangeNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexArrayRangeNV)(GLsizei, const GLvoid *);
+#define CALL_VertexArrayRangeNV(disp, parameters) \
+ (* GET_VertexArrayRangeNV(disp)) parameters
+static INLINE _glptr_VertexArrayRangeNV GET_VertexArrayRangeNV(struct _glapi_table *disp) {
+ return (_glptr_VertexArrayRangeNV) (GET_by_offset(disp, _gloffset_VertexArrayRangeNV));
+}
+
+static INLINE void SET_VertexArrayRangeNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_VertexArrayRangeNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CombinerInputNV)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum);
+#define CALL_CombinerInputNV(disp, parameters) \
+ (* GET_CombinerInputNV(disp)) parameters
+static INLINE _glptr_CombinerInputNV GET_CombinerInputNV(struct _glapi_table *disp) {
+ return (_glptr_CombinerInputNV) (GET_by_offset(disp, _gloffset_CombinerInputNV));
+}
+
+static INLINE void SET_CombinerInputNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_CombinerInputNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CombinerOutputNV)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean);
+#define CALL_CombinerOutputNV(disp, parameters) \
+ (* GET_CombinerOutputNV(disp)) parameters
+static INLINE _glptr_CombinerOutputNV GET_CombinerOutputNV(struct _glapi_table *disp) {
+ return (_glptr_CombinerOutputNV) (GET_by_offset(disp, _gloffset_CombinerOutputNV));
+}
+
+static INLINE void SET_CombinerOutputNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean)) {
+ SET_by_offset(disp, _gloffset_CombinerOutputNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CombinerParameterfNV)(GLenum, GLfloat);
+#define CALL_CombinerParameterfNV(disp, parameters) \
+ (* GET_CombinerParameterfNV(disp)) parameters
+static INLINE _glptr_CombinerParameterfNV GET_CombinerParameterfNV(struct _glapi_table *disp) {
+ return (_glptr_CombinerParameterfNV) (GET_by_offset(disp, _gloffset_CombinerParameterfNV));
+}
+
+static INLINE void SET_CombinerParameterfNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat)) {
+ SET_by_offset(disp, _gloffset_CombinerParameterfNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CombinerParameterfvNV)(GLenum, const GLfloat *);
+#define CALL_CombinerParameterfvNV(disp, parameters) \
+ (* GET_CombinerParameterfvNV(disp)) parameters
+static INLINE _glptr_CombinerParameterfvNV GET_CombinerParameterfvNV(struct _glapi_table *disp) {
+ return (_glptr_CombinerParameterfvNV) (GET_by_offset(disp, _gloffset_CombinerParameterfvNV));
+}
+
+static INLINE void SET_CombinerParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_CombinerParameterfvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CombinerParameteriNV)(GLenum, GLint);
+#define CALL_CombinerParameteriNV(disp, parameters) \
+ (* GET_CombinerParameteriNV(disp)) parameters
+static INLINE _glptr_CombinerParameteriNV GET_CombinerParameteriNV(struct _glapi_table *disp) {
+ return (_glptr_CombinerParameteriNV) (GET_by_offset(disp, _gloffset_CombinerParameteriNV));
+}
+
+static INLINE void SET_CombinerParameteriNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_CombinerParameteriNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_CombinerParameterivNV)(GLenum, const GLint *);
+#define CALL_CombinerParameterivNV(disp, parameters) \
+ (* GET_CombinerParameterivNV(disp)) parameters
+static INLINE _glptr_CombinerParameterivNV GET_CombinerParameterivNV(struct _glapi_table *disp) {
+ return (_glptr_CombinerParameterivNV) (GET_by_offset(disp, _gloffset_CombinerParameterivNV));
+}
+
+static INLINE void SET_CombinerParameterivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_CombinerParameterivNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FinalCombinerInputNV)(GLenum, GLenum, GLenum, GLenum);
+#define CALL_FinalCombinerInputNV(disp, parameters) \
+ (* GET_FinalCombinerInputNV(disp)) parameters
+static INLINE _glptr_FinalCombinerInputNV GET_FinalCombinerInputNV(struct _glapi_table *disp) {
+ return (_glptr_FinalCombinerInputNV) (GET_by_offset(disp, _gloffset_FinalCombinerInputNV));
+}
+
+static INLINE void SET_FinalCombinerInputNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_FinalCombinerInputNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetCombinerInputParameterfvNV)(GLenum, GLenum, GLenum, GLenum, GLfloat *);
+#define CALL_GetCombinerInputParameterfvNV(disp, parameters) \
+ (* GET_GetCombinerInputParameterfvNV(disp)) parameters
+static INLINE _glptr_GetCombinerInputParameterfvNV GET_GetCombinerInputParameterfvNV(struct _glapi_table *disp) {
+ return (_glptr_GetCombinerInputParameterfvNV) (GET_by_offset(disp, _gloffset_GetCombinerInputParameterfvNV));
+}
+
+static INLINE void SET_GetCombinerInputParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetCombinerInputParameterfvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetCombinerInputParameterivNV)(GLenum, GLenum, GLenum, GLenum, GLint *);
+#define CALL_GetCombinerInputParameterivNV(disp, parameters) \
+ (* GET_GetCombinerInputParameterivNV(disp)) parameters
+static INLINE _glptr_GetCombinerInputParameterivNV GET_GetCombinerInputParameterivNV(struct _glapi_table *disp) {
+ return (_glptr_GetCombinerInputParameterivNV) (GET_by_offset(disp, _gloffset_GetCombinerInputParameterivNV));
+}
+
+static INLINE void SET_GetCombinerInputParameterivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetCombinerInputParameterivNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetCombinerOutputParameterfvNV)(GLenum, GLenum, GLenum, GLfloat *);
+#define CALL_GetCombinerOutputParameterfvNV(disp, parameters) \
+ (* GET_GetCombinerOutputParameterfvNV(disp)) parameters
+static INLINE _glptr_GetCombinerOutputParameterfvNV GET_GetCombinerOutputParameterfvNV(struct _glapi_table *disp) {
+ return (_glptr_GetCombinerOutputParameterfvNV) (GET_by_offset(disp, _gloffset_GetCombinerOutputParameterfvNV));
+}
+
+static INLINE void SET_GetCombinerOutputParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetCombinerOutputParameterfvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetCombinerOutputParameterivNV)(GLenum, GLenum, GLenum, GLint *);
+#define CALL_GetCombinerOutputParameterivNV(disp, parameters) \
+ (* GET_GetCombinerOutputParameterivNV(disp)) parameters
+static INLINE _glptr_GetCombinerOutputParameterivNV GET_GetCombinerOutputParameterivNV(struct _glapi_table *disp) {
+ return (_glptr_GetCombinerOutputParameterivNV) (GET_by_offset(disp, _gloffset_GetCombinerOutputParameterivNV));
+}
+
+static INLINE void SET_GetCombinerOutputParameterivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetCombinerOutputParameterivNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetFinalCombinerInputParameterfvNV)(GLenum, GLenum, GLfloat *);
+#define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) \
+ (* GET_GetFinalCombinerInputParameterfvNV(disp)) parameters
+static INLINE _glptr_GetFinalCombinerInputParameterfvNV GET_GetFinalCombinerInputParameterfvNV(struct _glapi_table *disp) {
+ return (_glptr_GetFinalCombinerInputParameterfvNV) (GET_by_offset(disp, _gloffset_GetFinalCombinerInputParameterfvNV));
+}
+
+static INLINE void SET_GetFinalCombinerInputParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetFinalCombinerInputParameterfvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetFinalCombinerInputParameterivNV)(GLenum, GLenum, GLint *);
+#define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) \
+ (* GET_GetFinalCombinerInputParameterivNV(disp)) parameters
+static INLINE _glptr_GetFinalCombinerInputParameterivNV GET_GetFinalCombinerInputParameterivNV(struct _glapi_table *disp) {
+ return (_glptr_GetFinalCombinerInputParameterivNV) (GET_by_offset(disp, _gloffset_GetFinalCombinerInputParameterivNV));
+}
+
+static INLINE void SET_GetFinalCombinerInputParameterivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetFinalCombinerInputParameterivNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ResizeBuffersMESA)(void);
+#define CALL_ResizeBuffersMESA(disp, parameters) \
+ (* GET_ResizeBuffersMESA(disp)) parameters
+static INLINE _glptr_ResizeBuffersMESA GET_ResizeBuffersMESA(struct _glapi_table *disp) {
+ return (_glptr_ResizeBuffersMESA) (GET_by_offset(disp, _gloffset_ResizeBuffersMESA));
+}
+
+static INLINE void SET_ResizeBuffersMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_ResizeBuffersMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos2dMESA)(GLdouble, GLdouble);
+#define CALL_WindowPos2dMESA(disp, parameters) \
+ (* GET_WindowPos2dMESA(disp)) parameters
+static INLINE _glptr_WindowPos2dMESA GET_WindowPos2dMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos2dMESA) (GET_by_offset(disp, _gloffset_WindowPos2dMESA));
+}
+
+static INLINE void SET_WindowPos2dMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_WindowPos2dMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos2dvMESA)(const GLdouble *);
+#define CALL_WindowPos2dvMESA(disp, parameters) \
+ (* GET_WindowPos2dvMESA(disp)) parameters
+static INLINE _glptr_WindowPos2dvMESA GET_WindowPos2dvMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos2dvMESA) (GET_by_offset(disp, _gloffset_WindowPos2dvMESA));
+}
+
+static INLINE void SET_WindowPos2dvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_WindowPos2dvMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos2fMESA)(GLfloat, GLfloat);
+#define CALL_WindowPos2fMESA(disp, parameters) \
+ (* GET_WindowPos2fMESA(disp)) parameters
+static INLINE _glptr_WindowPos2fMESA GET_WindowPos2fMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos2fMESA) (GET_by_offset(disp, _gloffset_WindowPos2fMESA));
+}
+
+static INLINE void SET_WindowPos2fMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_WindowPos2fMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos2fvMESA)(const GLfloat *);
+#define CALL_WindowPos2fvMESA(disp, parameters) \
+ (* GET_WindowPos2fvMESA(disp)) parameters
+static INLINE _glptr_WindowPos2fvMESA GET_WindowPos2fvMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos2fvMESA) (GET_by_offset(disp, _gloffset_WindowPos2fvMESA));
+}
+
+static INLINE void SET_WindowPos2fvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_WindowPos2fvMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos2iMESA)(GLint, GLint);
+#define CALL_WindowPos2iMESA(disp, parameters) \
+ (* GET_WindowPos2iMESA(disp)) parameters
+static INLINE _glptr_WindowPos2iMESA GET_WindowPos2iMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos2iMESA) (GET_by_offset(disp, _gloffset_WindowPos2iMESA));
+}
+
+static INLINE void SET_WindowPos2iMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_WindowPos2iMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos2ivMESA)(const GLint *);
+#define CALL_WindowPos2ivMESA(disp, parameters) \
+ (* GET_WindowPos2ivMESA(disp)) parameters
+static INLINE _glptr_WindowPos2ivMESA GET_WindowPos2ivMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos2ivMESA) (GET_by_offset(disp, _gloffset_WindowPos2ivMESA));
+}
+
+static INLINE void SET_WindowPos2ivMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_WindowPos2ivMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos2sMESA)(GLshort, GLshort);
+#define CALL_WindowPos2sMESA(disp, parameters) \
+ (* GET_WindowPos2sMESA(disp)) parameters
+static INLINE _glptr_WindowPos2sMESA GET_WindowPos2sMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos2sMESA) (GET_by_offset(disp, _gloffset_WindowPos2sMESA));
+}
+
+static INLINE void SET_WindowPos2sMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_WindowPos2sMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos2svMESA)(const GLshort *);
+#define CALL_WindowPos2svMESA(disp, parameters) \
+ (* GET_WindowPos2svMESA(disp)) parameters
+static INLINE _glptr_WindowPos2svMESA GET_WindowPos2svMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos2svMESA) (GET_by_offset(disp, _gloffset_WindowPos2svMESA));
+}
+
+static INLINE void SET_WindowPos2svMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_WindowPos2svMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos3dMESA)(GLdouble, GLdouble, GLdouble);
+#define CALL_WindowPos3dMESA(disp, parameters) \
+ (* GET_WindowPos3dMESA(disp)) parameters
+static INLINE _glptr_WindowPos3dMESA GET_WindowPos3dMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos3dMESA) (GET_by_offset(disp, _gloffset_WindowPos3dMESA));
+}
+
+static INLINE void SET_WindowPos3dMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_WindowPos3dMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos3dvMESA)(const GLdouble *);
+#define CALL_WindowPos3dvMESA(disp, parameters) \
+ (* GET_WindowPos3dvMESA(disp)) parameters
+static INLINE _glptr_WindowPos3dvMESA GET_WindowPos3dvMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos3dvMESA) (GET_by_offset(disp, _gloffset_WindowPos3dvMESA));
+}
+
+static INLINE void SET_WindowPos3dvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_WindowPos3dvMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos3fMESA)(GLfloat, GLfloat, GLfloat);
+#define CALL_WindowPos3fMESA(disp, parameters) \
+ (* GET_WindowPos3fMESA(disp)) parameters
+static INLINE _glptr_WindowPos3fMESA GET_WindowPos3fMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos3fMESA) (GET_by_offset(disp, _gloffset_WindowPos3fMESA));
+}
+
+static INLINE void SET_WindowPos3fMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_WindowPos3fMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos3fvMESA)(const GLfloat *);
+#define CALL_WindowPos3fvMESA(disp, parameters) \
+ (* GET_WindowPos3fvMESA(disp)) parameters
+static INLINE _glptr_WindowPos3fvMESA GET_WindowPos3fvMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos3fvMESA) (GET_by_offset(disp, _gloffset_WindowPos3fvMESA));
+}
+
+static INLINE void SET_WindowPos3fvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_WindowPos3fvMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos3iMESA)(GLint, GLint, GLint);
+#define CALL_WindowPos3iMESA(disp, parameters) \
+ (* GET_WindowPos3iMESA(disp)) parameters
+static INLINE _glptr_WindowPos3iMESA GET_WindowPos3iMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos3iMESA) (GET_by_offset(disp, _gloffset_WindowPos3iMESA));
+}
+
+static INLINE void SET_WindowPos3iMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_WindowPos3iMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos3ivMESA)(const GLint *);
+#define CALL_WindowPos3ivMESA(disp, parameters) \
+ (* GET_WindowPos3ivMESA(disp)) parameters
+static INLINE _glptr_WindowPos3ivMESA GET_WindowPos3ivMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos3ivMESA) (GET_by_offset(disp, _gloffset_WindowPos3ivMESA));
+}
+
+static INLINE void SET_WindowPos3ivMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_WindowPos3ivMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos3sMESA)(GLshort, GLshort, GLshort);
+#define CALL_WindowPos3sMESA(disp, parameters) \
+ (* GET_WindowPos3sMESA(disp)) parameters
+static INLINE _glptr_WindowPos3sMESA GET_WindowPos3sMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos3sMESA) (GET_by_offset(disp, _gloffset_WindowPos3sMESA));
+}
+
+static INLINE void SET_WindowPos3sMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_WindowPos3sMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos3svMESA)(const GLshort *);
+#define CALL_WindowPos3svMESA(disp, parameters) \
+ (* GET_WindowPos3svMESA(disp)) parameters
+static INLINE _glptr_WindowPos3svMESA GET_WindowPos3svMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos3svMESA) (GET_by_offset(disp, _gloffset_WindowPos3svMESA));
+}
+
+static INLINE void SET_WindowPos3svMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_WindowPos3svMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos4dMESA)(GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_WindowPos4dMESA(disp, parameters) \
+ (* GET_WindowPos4dMESA(disp)) parameters
+static INLINE _glptr_WindowPos4dMESA GET_WindowPos4dMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos4dMESA) (GET_by_offset(disp, _gloffset_WindowPos4dMESA));
+}
+
+static INLINE void SET_WindowPos4dMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_WindowPos4dMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos4dvMESA)(const GLdouble *);
+#define CALL_WindowPos4dvMESA(disp, parameters) \
+ (* GET_WindowPos4dvMESA(disp)) parameters
+static INLINE _glptr_WindowPos4dvMESA GET_WindowPos4dvMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos4dvMESA) (GET_by_offset(disp, _gloffset_WindowPos4dvMESA));
+}
+
+static INLINE void SET_WindowPos4dvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_WindowPos4dvMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos4fMESA)(GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_WindowPos4fMESA(disp, parameters) \
+ (* GET_WindowPos4fMESA(disp)) parameters
+static INLINE _glptr_WindowPos4fMESA GET_WindowPos4fMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos4fMESA) (GET_by_offset(disp, _gloffset_WindowPos4fMESA));
+}
+
+static INLINE void SET_WindowPos4fMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_WindowPos4fMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos4fvMESA)(const GLfloat *);
+#define CALL_WindowPos4fvMESA(disp, parameters) \
+ (* GET_WindowPos4fvMESA(disp)) parameters
+static INLINE _glptr_WindowPos4fvMESA GET_WindowPos4fvMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos4fvMESA) (GET_by_offset(disp, _gloffset_WindowPos4fvMESA));
+}
+
+static INLINE void SET_WindowPos4fvMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_WindowPos4fvMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos4iMESA)(GLint, GLint, GLint, GLint);
+#define CALL_WindowPos4iMESA(disp, parameters) \
+ (* GET_WindowPos4iMESA(disp)) parameters
+static INLINE _glptr_WindowPos4iMESA GET_WindowPos4iMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos4iMESA) (GET_by_offset(disp, _gloffset_WindowPos4iMESA));
+}
+
+static INLINE void SET_WindowPos4iMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_WindowPos4iMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos4ivMESA)(const GLint *);
+#define CALL_WindowPos4ivMESA(disp, parameters) \
+ (* GET_WindowPos4ivMESA(disp)) parameters
+static INLINE _glptr_WindowPos4ivMESA GET_WindowPos4ivMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos4ivMESA) (GET_by_offset(disp, _gloffset_WindowPos4ivMESA));
+}
+
+static INLINE void SET_WindowPos4ivMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLint *)) {
+ SET_by_offset(disp, _gloffset_WindowPos4ivMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos4sMESA)(GLshort, GLshort, GLshort, GLshort);
+#define CALL_WindowPos4sMESA(disp, parameters) \
+ (* GET_WindowPos4sMESA(disp)) parameters
+static INLINE _glptr_WindowPos4sMESA GET_WindowPos4sMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos4sMESA) (GET_by_offset(disp, _gloffset_WindowPos4sMESA));
+}
+
+static INLINE void SET_WindowPos4sMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLshort, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_WindowPos4sMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_WindowPos4svMESA)(const GLshort *);
+#define CALL_WindowPos4svMESA(disp, parameters) \
+ (* GET_WindowPos4svMESA(disp)) parameters
+static INLINE _glptr_WindowPos4svMESA GET_WindowPos4svMESA(struct _glapi_table *disp) {
+ return (_glptr_WindowPos4svMESA) (GET_by_offset(disp, _gloffset_WindowPos4svMESA));
+}
+
+static INLINE void SET_WindowPos4svMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLshort *)) {
+ SET_by_offset(disp, _gloffset_WindowPos4svMESA, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiModeDrawArraysIBM)(const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint);
+#define CALL_MultiModeDrawArraysIBM(disp, parameters) \
+ (* GET_MultiModeDrawArraysIBM(disp)) parameters
+static INLINE _glptr_MultiModeDrawArraysIBM GET_MultiModeDrawArraysIBM(struct _glapi_table *disp) {
+ return (_glptr_MultiModeDrawArraysIBM) (GET_by_offset(disp, _gloffset_MultiModeDrawArraysIBM));
+}
+
+static INLINE void SET_MultiModeDrawArraysIBM(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint)) {
+ SET_by_offset(disp, _gloffset_MultiModeDrawArraysIBM, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_MultiModeDrawElementsIBM)(const GLenum *, const GLsizei *, GLenum, const GLvoid * const *, GLsizei, GLint);
+#define CALL_MultiModeDrawElementsIBM(disp, parameters) \
+ (* GET_MultiModeDrawElementsIBM(disp)) parameters
+static INLINE _glptr_MultiModeDrawElementsIBM GET_MultiModeDrawElementsIBM(struct _glapi_table *disp) {
+ return (_glptr_MultiModeDrawElementsIBM) (GET_by_offset(disp, _gloffset_MultiModeDrawElementsIBM));
+}
+
+static INLINE void SET_MultiModeDrawElementsIBM(struct _glapi_table *disp, void (GLAPIENTRYP fn)(const GLenum *, const GLsizei *, GLenum, const GLvoid * const *, GLsizei, GLint)) {
+ SET_by_offset(disp, _gloffset_MultiModeDrawElementsIBM, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteFencesNV)(GLsizei, const GLuint *);
+#define CALL_DeleteFencesNV(disp, parameters) \
+ (* GET_DeleteFencesNV(disp)) parameters
+static INLINE _glptr_DeleteFencesNV GET_DeleteFencesNV(struct _glapi_table *disp) {
+ return (_glptr_DeleteFencesNV) (GET_by_offset(disp, _gloffset_DeleteFencesNV));
+}
+
+static INLINE void SET_DeleteFencesNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_DeleteFencesNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FinishFenceNV)(GLuint);
+#define CALL_FinishFenceNV(disp, parameters) \
+ (* GET_FinishFenceNV(disp)) parameters
+static INLINE _glptr_FinishFenceNV GET_FinishFenceNV(struct _glapi_table *disp) {
+ return (_glptr_FinishFenceNV) (GET_by_offset(disp, _gloffset_FinishFenceNV));
+}
+
+static INLINE void SET_FinishFenceNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_FinishFenceNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenFencesNV)(GLsizei, GLuint *);
+#define CALL_GenFencesNV(disp, parameters) \
+ (* GET_GenFencesNV(disp)) parameters
+static INLINE _glptr_GenFencesNV GET_GenFencesNV(struct _glapi_table *disp) {
+ return (_glptr_GenFencesNV) (GET_by_offset(disp, _gloffset_GenFencesNV));
+}
+
+static INLINE void SET_GenFencesNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenFencesNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetFenceivNV)(GLuint, GLenum, GLint *);
+#define CALL_GetFenceivNV(disp, parameters) \
+ (* GET_GetFenceivNV(disp)) parameters
+static INLINE _glptr_GetFenceivNV GET_GetFenceivNV(struct _glapi_table *disp) {
+ return (_glptr_GetFenceivNV) (GET_by_offset(disp, _gloffset_GetFenceivNV));
+}
+
+static INLINE void SET_GetFenceivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetFenceivNV, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsFenceNV)(GLuint);
+#define CALL_IsFenceNV(disp, parameters) \
+ (* GET_IsFenceNV(disp)) parameters
+static INLINE _glptr_IsFenceNV GET_IsFenceNV(struct _glapi_table *disp) {
+ return (_glptr_IsFenceNV) (GET_by_offset(disp, _gloffset_IsFenceNV));
+}
+
+static INLINE void SET_IsFenceNV(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsFenceNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SetFenceNV)(GLuint, GLenum);
+#define CALL_SetFenceNV(disp, parameters) \
+ (* GET_SetFenceNV(disp)) parameters
+static INLINE _glptr_SetFenceNV GET_SetFenceNV(struct _glapi_table *disp) {
+ return (_glptr_SetFenceNV) (GET_by_offset(disp, _gloffset_SetFenceNV));
+}
+
+static INLINE void SET_SetFenceNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum)) {
+ SET_by_offset(disp, _gloffset_SetFenceNV, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_TestFenceNV)(GLuint);
+#define CALL_TestFenceNV(disp, parameters) \
+ (* GET_TestFenceNV(disp)) parameters
+static INLINE _glptr_TestFenceNV GET_TestFenceNV(struct _glapi_table *disp) {
+ return (_glptr_TestFenceNV) (GET_by_offset(disp, _gloffset_TestFenceNV));
+}
+
+static INLINE void SET_TestFenceNV(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_TestFenceNV, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_AreProgramsResidentNV)(GLsizei, const GLuint *, GLboolean *);
+#define CALL_AreProgramsResidentNV(disp, parameters) \
+ (* GET_AreProgramsResidentNV(disp)) parameters
+static INLINE _glptr_AreProgramsResidentNV GET_AreProgramsResidentNV(struct _glapi_table *disp) {
+ return (_glptr_AreProgramsResidentNV) (GET_by_offset(disp, _gloffset_AreProgramsResidentNV));
+}
+
+static INLINE void SET_AreProgramsResidentNV(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLsizei, const GLuint *, GLboolean *)) {
+ SET_by_offset(disp, _gloffset_AreProgramsResidentNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindProgramNV)(GLenum, GLuint);
+#define CALL_BindProgramNV(disp, parameters) \
+ (* GET_BindProgramNV(disp)) parameters
+static INLINE _glptr_BindProgramNV GET_BindProgramNV(struct _glapi_table *disp) {
+ return (_glptr_BindProgramNV) (GET_by_offset(disp, _gloffset_BindProgramNV));
+}
+
+static INLINE void SET_BindProgramNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_BindProgramNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteProgramsNV)(GLsizei, const GLuint *);
+#define CALL_DeleteProgramsNV(disp, parameters) \
+ (* GET_DeleteProgramsNV(disp)) parameters
+static INLINE _glptr_DeleteProgramsNV GET_DeleteProgramsNV(struct _glapi_table *disp) {
+ return (_glptr_DeleteProgramsNV) (GET_by_offset(disp, _gloffset_DeleteProgramsNV));
+}
+
+static INLINE void SET_DeleteProgramsNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_DeleteProgramsNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ExecuteProgramNV)(GLenum, GLuint, const GLfloat *);
+#define CALL_ExecuteProgramNV(disp, parameters) \
+ (* GET_ExecuteProgramNV(disp)) parameters
+static INLINE _glptr_ExecuteProgramNV GET_ExecuteProgramNV(struct _glapi_table *disp) {
+ return (_glptr_ExecuteProgramNV) (GET_by_offset(disp, _gloffset_ExecuteProgramNV));
+}
+
+static INLINE void SET_ExecuteProgramNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_ExecuteProgramNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenProgramsNV)(GLsizei, GLuint *);
+#define CALL_GenProgramsNV(disp, parameters) \
+ (* GET_GenProgramsNV(disp)) parameters
+static INLINE _glptr_GenProgramsNV GET_GenProgramsNV(struct _glapi_table *disp) {
+ return (_glptr_GenProgramsNV) (GET_by_offset(disp, _gloffset_GenProgramsNV));
+}
+
+static INLINE void SET_GenProgramsNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenProgramsNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramParameterdvNV)(GLenum, GLuint, GLenum, GLdouble *);
+#define CALL_GetProgramParameterdvNV(disp, parameters) \
+ (* GET_GetProgramParameterdvNV(disp)) parameters
+static INLINE _glptr_GetProgramParameterdvNV GET_GetProgramParameterdvNV(struct _glapi_table *disp) {
+ return (_glptr_GetProgramParameterdvNV) (GET_by_offset(disp, _gloffset_GetProgramParameterdvNV));
+}
+
+static INLINE void SET_GetProgramParameterdvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetProgramParameterdvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramParameterfvNV)(GLenum, GLuint, GLenum, GLfloat *);
+#define CALL_GetProgramParameterfvNV(disp, parameters) \
+ (* GET_GetProgramParameterfvNV(disp)) parameters
+static INLINE _glptr_GetProgramParameterfvNV GET_GetProgramParameterfvNV(struct _glapi_table *disp) {
+ return (_glptr_GetProgramParameterfvNV) (GET_by_offset(disp, _gloffset_GetProgramParameterfvNV));
+}
+
+static INLINE void SET_GetProgramParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetProgramParameterfvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramStringNV)(GLuint, GLenum, GLubyte *);
+#define CALL_GetProgramStringNV(disp, parameters) \
+ (* GET_GetProgramStringNV(disp)) parameters
+static INLINE _glptr_GetProgramStringNV GET_GetProgramStringNV(struct _glapi_table *disp) {
+ return (_glptr_GetProgramStringNV) (GET_by_offset(disp, _gloffset_GetProgramStringNV));
+}
+
+static INLINE void SET_GetProgramStringNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLubyte *)) {
+ SET_by_offset(disp, _gloffset_GetProgramStringNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramivNV)(GLuint, GLenum, GLint *);
+#define CALL_GetProgramivNV(disp, parameters) \
+ (* GET_GetProgramivNV(disp)) parameters
+static INLINE _glptr_GetProgramivNV GET_GetProgramivNV(struct _glapi_table *disp) {
+ return (_glptr_GetProgramivNV) (GET_by_offset(disp, _gloffset_GetProgramivNV));
+}
+
+static INLINE void SET_GetProgramivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetProgramivNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTrackMatrixivNV)(GLenum, GLuint, GLenum, GLint *);
+#define CALL_GetTrackMatrixivNV(disp, parameters) \
+ (* GET_GetTrackMatrixivNV(disp)) parameters
+static INLINE _glptr_GetTrackMatrixivNV GET_GetTrackMatrixivNV(struct _glapi_table *disp) {
+ return (_glptr_GetTrackMatrixivNV) (GET_by_offset(disp, _gloffset_GetTrackMatrixivNV));
+}
+
+static INLINE void SET_GetTrackMatrixivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetTrackMatrixivNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetVertexAttribPointervNV)(GLuint, GLenum, GLvoid **);
+#define CALL_GetVertexAttribPointervNV(disp, parameters) \
+ (* GET_GetVertexAttribPointervNV(disp)) parameters
+static INLINE _glptr_GetVertexAttribPointervNV GET_GetVertexAttribPointervNV(struct _glapi_table *disp) {
+ return (_glptr_GetVertexAttribPointervNV) (GET_by_offset(disp, _gloffset_GetVertexAttribPointervNV));
+}
+
+static INLINE void SET_GetVertexAttribPointervNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLvoid **)) {
+ SET_by_offset(disp, _gloffset_GetVertexAttribPointervNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetVertexAttribdvNV)(GLuint, GLenum, GLdouble *);
+#define CALL_GetVertexAttribdvNV(disp, parameters) \
+ (* GET_GetVertexAttribdvNV(disp)) parameters
+static INLINE _glptr_GetVertexAttribdvNV GET_GetVertexAttribdvNV(struct _glapi_table *disp) {
+ return (_glptr_GetVertexAttribdvNV) (GET_by_offset(disp, _gloffset_GetVertexAttribdvNV));
+}
+
+static INLINE void SET_GetVertexAttribdvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetVertexAttribdvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetVertexAttribfvNV)(GLuint, GLenum, GLfloat *);
+#define CALL_GetVertexAttribfvNV(disp, parameters) \
+ (* GET_GetVertexAttribfvNV(disp)) parameters
+static INLINE _glptr_GetVertexAttribfvNV GET_GetVertexAttribfvNV(struct _glapi_table *disp) {
+ return (_glptr_GetVertexAttribfvNV) (GET_by_offset(disp, _gloffset_GetVertexAttribfvNV));
+}
+
+static INLINE void SET_GetVertexAttribfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetVertexAttribfvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetVertexAttribivNV)(GLuint, GLenum, GLint *);
+#define CALL_GetVertexAttribivNV(disp, parameters) \
+ (* GET_GetVertexAttribivNV(disp)) parameters
+static INLINE _glptr_GetVertexAttribivNV GET_GetVertexAttribivNV(struct _glapi_table *disp) {
+ return (_glptr_GetVertexAttribivNV) (GET_by_offset(disp, _gloffset_GetVertexAttribivNV));
+}
+
+static INLINE void SET_GetVertexAttribivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetVertexAttribivNV, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsProgramNV)(GLuint);
+#define CALL_IsProgramNV(disp, parameters) \
+ (* GET_IsProgramNV(disp)) parameters
+static INLINE _glptr_IsProgramNV GET_IsProgramNV(struct _glapi_table *disp) {
+ return (_glptr_IsProgramNV) (GET_by_offset(disp, _gloffset_IsProgramNV));
+}
+
+static INLINE void SET_IsProgramNV(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsProgramNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_LoadProgramNV)(GLenum, GLuint, GLsizei, const GLubyte *);
+#define CALL_LoadProgramNV(disp, parameters) \
+ (* GET_LoadProgramNV(disp)) parameters
+static INLINE _glptr_LoadProgramNV GET_LoadProgramNV(struct _glapi_table *disp) {
+ return (_glptr_LoadProgramNV) (GET_by_offset(disp, _gloffset_LoadProgramNV));
+}
+
+static INLINE void SET_LoadProgramNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLsizei, const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_LoadProgramNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramParameters4dvNV)(GLenum, GLuint, GLsizei, const GLdouble *);
+#define CALL_ProgramParameters4dvNV(disp, parameters) \
+ (* GET_ProgramParameters4dvNV(disp)) parameters
+static INLINE _glptr_ProgramParameters4dvNV GET_ProgramParameters4dvNV(struct _glapi_table *disp) {
+ return (_glptr_ProgramParameters4dvNV) (GET_by_offset(disp, _gloffset_ProgramParameters4dvNV));
+}
+
+static INLINE void SET_ProgramParameters4dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLsizei, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_ProgramParameters4dvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramParameters4fvNV)(GLenum, GLuint, GLsizei, const GLfloat *);
+#define CALL_ProgramParameters4fvNV(disp, parameters) \
+ (* GET_ProgramParameters4fvNV(disp)) parameters
+static INLINE _glptr_ProgramParameters4fvNV GET_ProgramParameters4fvNV(struct _glapi_table *disp) {
+ return (_glptr_ProgramParameters4fvNV) (GET_by_offset(disp, _gloffset_ProgramParameters4fvNV));
+}
+
+static INLINE void SET_ProgramParameters4fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_ProgramParameters4fvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RequestResidentProgramsNV)(GLsizei, const GLuint *);
+#define CALL_RequestResidentProgramsNV(disp, parameters) \
+ (* GET_RequestResidentProgramsNV(disp)) parameters
+static INLINE _glptr_RequestResidentProgramsNV GET_RequestResidentProgramsNV(struct _glapi_table *disp) {
+ return (_glptr_RequestResidentProgramsNV) (GET_by_offset(disp, _gloffset_RequestResidentProgramsNV));
+}
+
+static INLINE void SET_RequestResidentProgramsNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_RequestResidentProgramsNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TrackMatrixNV)(GLenum, GLuint, GLenum, GLenum);
+#define CALL_TrackMatrixNV(disp, parameters) \
+ (* GET_TrackMatrixNV(disp)) parameters
+static INLINE _glptr_TrackMatrixNV GET_TrackMatrixNV(struct _glapi_table *disp) {
+ return (_glptr_TrackMatrixNV) (GET_by_offset(disp, _gloffset_TrackMatrixNV));
+}
+
+static INLINE void SET_TrackMatrixNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_TrackMatrixNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1dNV)(GLuint, GLdouble);
+#define CALL_VertexAttrib1dNV(disp, parameters) \
+ (* GET_VertexAttrib1dNV(disp)) parameters
+static INLINE _glptr_VertexAttrib1dNV GET_VertexAttrib1dNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1dNV) (GET_by_offset(disp, _gloffset_VertexAttrib1dNV));
+}
+
+static INLINE void SET_VertexAttrib1dNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1dNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1dvNV)(GLuint, const GLdouble *);
+#define CALL_VertexAttrib1dvNV(disp, parameters) \
+ (* GET_VertexAttrib1dvNV(disp)) parameters
+static INLINE _glptr_VertexAttrib1dvNV GET_VertexAttrib1dvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1dvNV) (GET_by_offset(disp, _gloffset_VertexAttrib1dvNV));
+}
+
+static INLINE void SET_VertexAttrib1dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1dvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1fNV)(GLuint, GLfloat);
+#define CALL_VertexAttrib1fNV(disp, parameters) \
+ (* GET_VertexAttrib1fNV(disp)) parameters
+static INLINE _glptr_VertexAttrib1fNV GET_VertexAttrib1fNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1fNV) (GET_by_offset(disp, _gloffset_VertexAttrib1fNV));
+}
+
+static INLINE void SET_VertexAttrib1fNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1fNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1fvNV)(GLuint, const GLfloat *);
+#define CALL_VertexAttrib1fvNV(disp, parameters) \
+ (* GET_VertexAttrib1fvNV(disp)) parameters
+static INLINE _glptr_VertexAttrib1fvNV GET_VertexAttrib1fvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1fvNV) (GET_by_offset(disp, _gloffset_VertexAttrib1fvNV));
+}
+
+static INLINE void SET_VertexAttrib1fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1fvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1sNV)(GLuint, GLshort);
+#define CALL_VertexAttrib1sNV(disp, parameters) \
+ (* GET_VertexAttrib1sNV(disp)) parameters
+static INLINE _glptr_VertexAttrib1sNV GET_VertexAttrib1sNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1sNV) (GET_by_offset(disp, _gloffset_VertexAttrib1sNV));
+}
+
+static INLINE void SET_VertexAttrib1sNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1sNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib1svNV)(GLuint, const GLshort *);
+#define CALL_VertexAttrib1svNV(disp, parameters) \
+ (* GET_VertexAttrib1svNV(disp)) parameters
+static INLINE _glptr_VertexAttrib1svNV GET_VertexAttrib1svNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib1svNV) (GET_by_offset(disp, _gloffset_VertexAttrib1svNV));
+}
+
+static INLINE void SET_VertexAttrib1svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib1svNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2dNV)(GLuint, GLdouble, GLdouble);
+#define CALL_VertexAttrib2dNV(disp, parameters) \
+ (* GET_VertexAttrib2dNV(disp)) parameters
+static INLINE _glptr_VertexAttrib2dNV GET_VertexAttrib2dNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2dNV) (GET_by_offset(disp, _gloffset_VertexAttrib2dNV));
+}
+
+static INLINE void SET_VertexAttrib2dNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2dNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2dvNV)(GLuint, const GLdouble *);
+#define CALL_VertexAttrib2dvNV(disp, parameters) \
+ (* GET_VertexAttrib2dvNV(disp)) parameters
+static INLINE _glptr_VertexAttrib2dvNV GET_VertexAttrib2dvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2dvNV) (GET_by_offset(disp, _gloffset_VertexAttrib2dvNV));
+}
+
+static INLINE void SET_VertexAttrib2dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2dvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2fNV)(GLuint, GLfloat, GLfloat);
+#define CALL_VertexAttrib2fNV(disp, parameters) \
+ (* GET_VertexAttrib2fNV(disp)) parameters
+static INLINE _glptr_VertexAttrib2fNV GET_VertexAttrib2fNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2fNV) (GET_by_offset(disp, _gloffset_VertexAttrib2fNV));
+}
+
+static INLINE void SET_VertexAttrib2fNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2fNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2fvNV)(GLuint, const GLfloat *);
+#define CALL_VertexAttrib2fvNV(disp, parameters) \
+ (* GET_VertexAttrib2fvNV(disp)) parameters
+static INLINE _glptr_VertexAttrib2fvNV GET_VertexAttrib2fvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2fvNV) (GET_by_offset(disp, _gloffset_VertexAttrib2fvNV));
+}
+
+static INLINE void SET_VertexAttrib2fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2fvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2sNV)(GLuint, GLshort, GLshort);
+#define CALL_VertexAttrib2sNV(disp, parameters) \
+ (* GET_VertexAttrib2sNV(disp)) parameters
+static INLINE _glptr_VertexAttrib2sNV GET_VertexAttrib2sNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2sNV) (GET_by_offset(disp, _gloffset_VertexAttrib2sNV));
+}
+
+static INLINE void SET_VertexAttrib2sNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2sNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib2svNV)(GLuint, const GLshort *);
+#define CALL_VertexAttrib2svNV(disp, parameters) \
+ (* GET_VertexAttrib2svNV(disp)) parameters
+static INLINE _glptr_VertexAttrib2svNV GET_VertexAttrib2svNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib2svNV) (GET_by_offset(disp, _gloffset_VertexAttrib2svNV));
+}
+
+static INLINE void SET_VertexAttrib2svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib2svNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3dNV)(GLuint, GLdouble, GLdouble, GLdouble);
+#define CALL_VertexAttrib3dNV(disp, parameters) \
+ (* GET_VertexAttrib3dNV(disp)) parameters
+static INLINE _glptr_VertexAttrib3dNV GET_VertexAttrib3dNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3dNV) (GET_by_offset(disp, _gloffset_VertexAttrib3dNV));
+}
+
+static INLINE void SET_VertexAttrib3dNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3dNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3dvNV)(GLuint, const GLdouble *);
+#define CALL_VertexAttrib3dvNV(disp, parameters) \
+ (* GET_VertexAttrib3dvNV(disp)) parameters
+static INLINE _glptr_VertexAttrib3dvNV GET_VertexAttrib3dvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3dvNV) (GET_by_offset(disp, _gloffset_VertexAttrib3dvNV));
+}
+
+static INLINE void SET_VertexAttrib3dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3dvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3fNV)(GLuint, GLfloat, GLfloat, GLfloat);
+#define CALL_VertexAttrib3fNV(disp, parameters) \
+ (* GET_VertexAttrib3fNV(disp)) parameters
+static INLINE _glptr_VertexAttrib3fNV GET_VertexAttrib3fNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3fNV) (GET_by_offset(disp, _gloffset_VertexAttrib3fNV));
+}
+
+static INLINE void SET_VertexAttrib3fNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3fNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3fvNV)(GLuint, const GLfloat *);
+#define CALL_VertexAttrib3fvNV(disp, parameters) \
+ (* GET_VertexAttrib3fvNV(disp)) parameters
+static INLINE _glptr_VertexAttrib3fvNV GET_VertexAttrib3fvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3fvNV) (GET_by_offset(disp, _gloffset_VertexAttrib3fvNV));
+}
+
+static INLINE void SET_VertexAttrib3fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3fvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3sNV)(GLuint, GLshort, GLshort, GLshort);
+#define CALL_VertexAttrib3sNV(disp, parameters) \
+ (* GET_VertexAttrib3sNV(disp)) parameters
+static INLINE _glptr_VertexAttrib3sNV GET_VertexAttrib3sNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3sNV) (GET_by_offset(disp, _gloffset_VertexAttrib3sNV));
+}
+
+static INLINE void SET_VertexAttrib3sNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3sNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib3svNV)(GLuint, const GLshort *);
+#define CALL_VertexAttrib3svNV(disp, parameters) \
+ (* GET_VertexAttrib3svNV(disp)) parameters
+static INLINE _glptr_VertexAttrib3svNV GET_VertexAttrib3svNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib3svNV) (GET_by_offset(disp, _gloffset_VertexAttrib3svNV));
+}
+
+static INLINE void SET_VertexAttrib3svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib3svNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4dNV)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_VertexAttrib4dNV(disp, parameters) \
+ (* GET_VertexAttrib4dNV(disp)) parameters
+static INLINE _glptr_VertexAttrib4dNV GET_VertexAttrib4dNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4dNV) (GET_by_offset(disp, _gloffset_VertexAttrib4dNV));
+}
+
+static INLINE void SET_VertexAttrib4dNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4dNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4dvNV)(GLuint, const GLdouble *);
+#define CALL_VertexAttrib4dvNV(disp, parameters) \
+ (* GET_VertexAttrib4dvNV(disp)) parameters
+static INLINE _glptr_VertexAttrib4dvNV GET_VertexAttrib4dvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4dvNV) (GET_by_offset(disp, _gloffset_VertexAttrib4dvNV));
+}
+
+static INLINE void SET_VertexAttrib4dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4dvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4fNV)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_VertexAttrib4fNV(disp, parameters) \
+ (* GET_VertexAttrib4fNV(disp)) parameters
+static INLINE _glptr_VertexAttrib4fNV GET_VertexAttrib4fNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4fNV) (GET_by_offset(disp, _gloffset_VertexAttrib4fNV));
+}
+
+static INLINE void SET_VertexAttrib4fNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4fNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4fvNV)(GLuint, const GLfloat *);
+#define CALL_VertexAttrib4fvNV(disp, parameters) \
+ (* GET_VertexAttrib4fvNV(disp)) parameters
+static INLINE _glptr_VertexAttrib4fvNV GET_VertexAttrib4fvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4fvNV) (GET_by_offset(disp, _gloffset_VertexAttrib4fvNV));
+}
+
+static INLINE void SET_VertexAttrib4fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4fvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4sNV)(GLuint, GLshort, GLshort, GLshort, GLshort);
+#define CALL_VertexAttrib4sNV(disp, parameters) \
+ (* GET_VertexAttrib4sNV(disp)) parameters
+static INLINE _glptr_VertexAttrib4sNV GET_VertexAttrib4sNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4sNV) (GET_by_offset(disp, _gloffset_VertexAttrib4sNV));
+}
+
+static INLINE void SET_VertexAttrib4sNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLshort, GLshort, GLshort, GLshort)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4sNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4svNV)(GLuint, const GLshort *);
+#define CALL_VertexAttrib4svNV(disp, parameters) \
+ (* GET_VertexAttrib4svNV(disp)) parameters
+static INLINE _glptr_VertexAttrib4svNV GET_VertexAttrib4svNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4svNV) (GET_by_offset(disp, _gloffset_VertexAttrib4svNV));
+}
+
+static INLINE void SET_VertexAttrib4svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4svNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4ubNV)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
+#define CALL_VertexAttrib4ubNV(disp, parameters) \
+ (* GET_VertexAttrib4ubNV(disp)) parameters
+static INLINE _glptr_VertexAttrib4ubNV GET_VertexAttrib4ubNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4ubNV) (GET_by_offset(disp, _gloffset_VertexAttrib4ubNV));
+}
+
+static INLINE void SET_VertexAttrib4ubNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4ubNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttrib4ubvNV)(GLuint, const GLubyte *);
+#define CALL_VertexAttrib4ubvNV(disp, parameters) \
+ (* GET_VertexAttrib4ubvNV(disp)) parameters
+static INLINE _glptr_VertexAttrib4ubvNV GET_VertexAttrib4ubvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttrib4ubvNV) (GET_by_offset(disp, _gloffset_VertexAttrib4ubvNV));
+}
+
+static INLINE void SET_VertexAttrib4ubvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_VertexAttrib4ubvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribPointerNV)(GLuint, GLint, GLenum, GLsizei, const GLvoid *);
+#define CALL_VertexAttribPointerNV(disp, parameters) \
+ (* GET_VertexAttribPointerNV(disp)) parameters
+static INLINE _glptr_VertexAttribPointerNV GET_VertexAttribPointerNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribPointerNV) (GET_by_offset(disp, _gloffset_VertexAttribPointerNV));
+}
+
+static INLINE void SET_VertexAttribPointerNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribPointerNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs1dvNV)(GLuint, GLsizei, const GLdouble *);
+#define CALL_VertexAttribs1dvNV(disp, parameters) \
+ (* GET_VertexAttribs1dvNV(disp)) parameters
+static INLINE _glptr_VertexAttribs1dvNV GET_VertexAttribs1dvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs1dvNV) (GET_by_offset(disp, _gloffset_VertexAttribs1dvNV));
+}
+
+static INLINE void SET_VertexAttribs1dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs1dvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs1fvNV)(GLuint, GLsizei, const GLfloat *);
+#define CALL_VertexAttribs1fvNV(disp, parameters) \
+ (* GET_VertexAttribs1fvNV(disp)) parameters
+static INLINE _glptr_VertexAttribs1fvNV GET_VertexAttribs1fvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs1fvNV) (GET_by_offset(disp, _gloffset_VertexAttribs1fvNV));
+}
+
+static INLINE void SET_VertexAttribs1fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs1fvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs1svNV)(GLuint, GLsizei, const GLshort *);
+#define CALL_VertexAttribs1svNV(disp, parameters) \
+ (* GET_VertexAttribs1svNV(disp)) parameters
+static INLINE _glptr_VertexAttribs1svNV GET_VertexAttribs1svNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs1svNV) (GET_by_offset(disp, _gloffset_VertexAttribs1svNV));
+}
+
+static INLINE void SET_VertexAttribs1svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs1svNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs2dvNV)(GLuint, GLsizei, const GLdouble *);
+#define CALL_VertexAttribs2dvNV(disp, parameters) \
+ (* GET_VertexAttribs2dvNV(disp)) parameters
+static INLINE _glptr_VertexAttribs2dvNV GET_VertexAttribs2dvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs2dvNV) (GET_by_offset(disp, _gloffset_VertexAttribs2dvNV));
+}
+
+static INLINE void SET_VertexAttribs2dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs2dvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs2fvNV)(GLuint, GLsizei, const GLfloat *);
+#define CALL_VertexAttribs2fvNV(disp, parameters) \
+ (* GET_VertexAttribs2fvNV(disp)) parameters
+static INLINE _glptr_VertexAttribs2fvNV GET_VertexAttribs2fvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs2fvNV) (GET_by_offset(disp, _gloffset_VertexAttribs2fvNV));
+}
+
+static INLINE void SET_VertexAttribs2fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs2fvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs2svNV)(GLuint, GLsizei, const GLshort *);
+#define CALL_VertexAttribs2svNV(disp, parameters) \
+ (* GET_VertexAttribs2svNV(disp)) parameters
+static INLINE _glptr_VertexAttribs2svNV GET_VertexAttribs2svNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs2svNV) (GET_by_offset(disp, _gloffset_VertexAttribs2svNV));
+}
+
+static INLINE void SET_VertexAttribs2svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs2svNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs3dvNV)(GLuint, GLsizei, const GLdouble *);
+#define CALL_VertexAttribs3dvNV(disp, parameters) \
+ (* GET_VertexAttribs3dvNV(disp)) parameters
+static INLINE _glptr_VertexAttribs3dvNV GET_VertexAttribs3dvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs3dvNV) (GET_by_offset(disp, _gloffset_VertexAttribs3dvNV));
+}
+
+static INLINE void SET_VertexAttribs3dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs3dvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs3fvNV)(GLuint, GLsizei, const GLfloat *);
+#define CALL_VertexAttribs3fvNV(disp, parameters) \
+ (* GET_VertexAttribs3fvNV(disp)) parameters
+static INLINE _glptr_VertexAttribs3fvNV GET_VertexAttribs3fvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs3fvNV) (GET_by_offset(disp, _gloffset_VertexAttribs3fvNV));
+}
+
+static INLINE void SET_VertexAttribs3fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs3fvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs3svNV)(GLuint, GLsizei, const GLshort *);
+#define CALL_VertexAttribs3svNV(disp, parameters) \
+ (* GET_VertexAttribs3svNV(disp)) parameters
+static INLINE _glptr_VertexAttribs3svNV GET_VertexAttribs3svNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs3svNV) (GET_by_offset(disp, _gloffset_VertexAttribs3svNV));
+}
+
+static INLINE void SET_VertexAttribs3svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs3svNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs4dvNV)(GLuint, GLsizei, const GLdouble *);
+#define CALL_VertexAttribs4dvNV(disp, parameters) \
+ (* GET_VertexAttribs4dvNV(disp)) parameters
+static INLINE _glptr_VertexAttribs4dvNV GET_VertexAttribs4dvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs4dvNV) (GET_by_offset(disp, _gloffset_VertexAttribs4dvNV));
+}
+
+static INLINE void SET_VertexAttribs4dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs4dvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs4fvNV)(GLuint, GLsizei, const GLfloat *);
+#define CALL_VertexAttribs4fvNV(disp, parameters) \
+ (* GET_VertexAttribs4fvNV(disp)) parameters
+static INLINE _glptr_VertexAttribs4fvNV GET_VertexAttribs4fvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs4fvNV) (GET_by_offset(disp, _gloffset_VertexAttribs4fvNV));
+}
+
+static INLINE void SET_VertexAttribs4fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs4fvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs4svNV)(GLuint, GLsizei, const GLshort *);
+#define CALL_VertexAttribs4svNV(disp, parameters) \
+ (* GET_VertexAttribs4svNV(disp)) parameters
+static INLINE _glptr_VertexAttribs4svNV GET_VertexAttribs4svNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs4svNV) (GET_by_offset(disp, _gloffset_VertexAttribs4svNV));
+}
+
+static INLINE void SET_VertexAttribs4svNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs4svNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribs4ubvNV)(GLuint, GLsizei, const GLubyte *);
+#define CALL_VertexAttribs4ubvNV(disp, parameters) \
+ (* GET_VertexAttribs4ubvNV(disp)) parameters
+static INLINE _glptr_VertexAttribs4ubvNV GET_VertexAttribs4ubvNV(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribs4ubvNV) (GET_by_offset(disp, _gloffset_VertexAttribs4ubvNV));
+}
+
+static INLINE void SET_VertexAttribs4ubvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribs4ubvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexBumpParameterfvATI)(GLenum, GLfloat *);
+#define CALL_GetTexBumpParameterfvATI(disp, parameters) \
+ (* GET_GetTexBumpParameterfvATI(disp)) parameters
+static INLINE _glptr_GetTexBumpParameterfvATI GET_GetTexBumpParameterfvATI(struct _glapi_table *disp) {
+ return (_glptr_GetTexBumpParameterfvATI) (GET_by_offset(disp, _gloffset_GetTexBumpParameterfvATI));
+}
+
+static INLINE void SET_GetTexBumpParameterfvATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetTexBumpParameterfvATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexBumpParameterivATI)(GLenum, GLint *);
+#define CALL_GetTexBumpParameterivATI(disp, parameters) \
+ (* GET_GetTexBumpParameterivATI(disp)) parameters
+static INLINE _glptr_GetTexBumpParameterivATI GET_GetTexBumpParameterivATI(struct _glapi_table *disp) {
+ return (_glptr_GetTexBumpParameterivATI) (GET_by_offset(disp, _gloffset_GetTexBumpParameterivATI));
+}
+
+static INLINE void SET_GetTexBumpParameterivATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetTexBumpParameterivATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexBumpParameterfvATI)(GLenum, const GLfloat *);
+#define CALL_TexBumpParameterfvATI(disp, parameters) \
+ (* GET_TexBumpParameterfvATI(disp)) parameters
+static INLINE _glptr_TexBumpParameterfvATI GET_TexBumpParameterfvATI(struct _glapi_table *disp) {
+ return (_glptr_TexBumpParameterfvATI) (GET_by_offset(disp, _gloffset_TexBumpParameterfvATI));
+}
+
+static INLINE void SET_TexBumpParameterfvATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_TexBumpParameterfvATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexBumpParameterivATI)(GLenum, const GLint *);
+#define CALL_TexBumpParameterivATI(disp, parameters) \
+ (* GET_TexBumpParameterivATI(disp)) parameters
+static INLINE _glptr_TexBumpParameterivATI GET_TexBumpParameterivATI(struct _glapi_table *disp) {
+ return (_glptr_TexBumpParameterivATI) (GET_by_offset(disp, _gloffset_TexBumpParameterivATI));
+}
+
+static INLINE void SET_TexBumpParameterivATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_TexBumpParameterivATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_AlphaFragmentOp1ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
+#define CALL_AlphaFragmentOp1ATI(disp, parameters) \
+ (* GET_AlphaFragmentOp1ATI(disp)) parameters
+static INLINE _glptr_AlphaFragmentOp1ATI GET_AlphaFragmentOp1ATI(struct _glapi_table *disp) {
+ return (_glptr_AlphaFragmentOp1ATI) (GET_by_offset(disp, _gloffset_AlphaFragmentOp1ATI));
+}
+
+static INLINE void SET_AlphaFragmentOp1ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_AlphaFragmentOp1ATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_AlphaFragmentOp2ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
+#define CALL_AlphaFragmentOp2ATI(disp, parameters) \
+ (* GET_AlphaFragmentOp2ATI(disp)) parameters
+static INLINE _glptr_AlphaFragmentOp2ATI GET_AlphaFragmentOp2ATI(struct _glapi_table *disp) {
+ return (_glptr_AlphaFragmentOp2ATI) (GET_by_offset(disp, _gloffset_AlphaFragmentOp2ATI));
+}
+
+static INLINE void SET_AlphaFragmentOp2ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_AlphaFragmentOp2ATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_AlphaFragmentOp3ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
+#define CALL_AlphaFragmentOp3ATI(disp, parameters) \
+ (* GET_AlphaFragmentOp3ATI(disp)) parameters
+static INLINE _glptr_AlphaFragmentOp3ATI GET_AlphaFragmentOp3ATI(struct _glapi_table *disp) {
+ return (_glptr_AlphaFragmentOp3ATI) (GET_by_offset(disp, _gloffset_AlphaFragmentOp3ATI));
+}
+
+static INLINE void SET_AlphaFragmentOp3ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_AlphaFragmentOp3ATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BeginFragmentShaderATI)(void);
+#define CALL_BeginFragmentShaderATI(disp, parameters) \
+ (* GET_BeginFragmentShaderATI(disp)) parameters
+static INLINE _glptr_BeginFragmentShaderATI GET_BeginFragmentShaderATI(struct _glapi_table *disp) {
+ return (_glptr_BeginFragmentShaderATI) (GET_by_offset(disp, _gloffset_BeginFragmentShaderATI));
+}
+
+static INLINE void SET_BeginFragmentShaderATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_BeginFragmentShaderATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindFragmentShaderATI)(GLuint);
+#define CALL_BindFragmentShaderATI(disp, parameters) \
+ (* GET_BindFragmentShaderATI(disp)) parameters
+static INLINE _glptr_BindFragmentShaderATI GET_BindFragmentShaderATI(struct _glapi_table *disp) {
+ return (_glptr_BindFragmentShaderATI) (GET_by_offset(disp, _gloffset_BindFragmentShaderATI));
+}
+
+static INLINE void SET_BindFragmentShaderATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_BindFragmentShaderATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorFragmentOp1ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
+#define CALL_ColorFragmentOp1ATI(disp, parameters) \
+ (* GET_ColorFragmentOp1ATI(disp)) parameters
+static INLINE _glptr_ColorFragmentOp1ATI GET_ColorFragmentOp1ATI(struct _glapi_table *disp) {
+ return (_glptr_ColorFragmentOp1ATI) (GET_by_offset(disp, _gloffset_ColorFragmentOp1ATI));
+}
+
+static INLINE void SET_ColorFragmentOp1ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_ColorFragmentOp1ATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorFragmentOp2ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
+#define CALL_ColorFragmentOp2ATI(disp, parameters) \
+ (* GET_ColorFragmentOp2ATI(disp)) parameters
+static INLINE _glptr_ColorFragmentOp2ATI GET_ColorFragmentOp2ATI(struct _glapi_table *disp) {
+ return (_glptr_ColorFragmentOp2ATI) (GET_by_offset(disp, _gloffset_ColorFragmentOp2ATI));
+}
+
+static INLINE void SET_ColorFragmentOp2ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_ColorFragmentOp2ATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorFragmentOp3ATI)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
+#define CALL_ColorFragmentOp3ATI(disp, parameters) \
+ (* GET_ColorFragmentOp3ATI(disp)) parameters
+static INLINE _glptr_ColorFragmentOp3ATI GET_ColorFragmentOp3ATI(struct _glapi_table *disp) {
+ return (_glptr_ColorFragmentOp3ATI) (GET_by_offset(disp, _gloffset_ColorFragmentOp3ATI));
+}
+
+static INLINE void SET_ColorFragmentOp3ATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_ColorFragmentOp3ATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteFragmentShaderATI)(GLuint);
+#define CALL_DeleteFragmentShaderATI(disp, parameters) \
+ (* GET_DeleteFragmentShaderATI(disp)) parameters
+static INLINE _glptr_DeleteFragmentShaderATI GET_DeleteFragmentShaderATI(struct _glapi_table *disp) {
+ return (_glptr_DeleteFragmentShaderATI) (GET_by_offset(disp, _gloffset_DeleteFragmentShaderATI));
+}
+
+static INLINE void SET_DeleteFragmentShaderATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_DeleteFragmentShaderATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EndFragmentShaderATI)(void);
+#define CALL_EndFragmentShaderATI(disp, parameters) \
+ (* GET_EndFragmentShaderATI(disp)) parameters
+static INLINE _glptr_EndFragmentShaderATI GET_EndFragmentShaderATI(struct _glapi_table *disp) {
+ return (_glptr_EndFragmentShaderATI) (GET_by_offset(disp, _gloffset_EndFragmentShaderATI));
+}
+
+static INLINE void SET_EndFragmentShaderATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_EndFragmentShaderATI, fn);
+}
+
+typedef GLuint (GLAPIENTRYP _glptr_GenFragmentShadersATI)(GLuint);
+#define CALL_GenFragmentShadersATI(disp, parameters) \
+ (* GET_GenFragmentShadersATI(disp)) parameters
+static INLINE _glptr_GenFragmentShadersATI GET_GenFragmentShadersATI(struct _glapi_table *disp) {
+ return (_glptr_GenFragmentShadersATI) (GET_by_offset(disp, _gloffset_GenFragmentShadersATI));
+}
+
+static INLINE void SET_GenFragmentShadersATI(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_GenFragmentShadersATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PassTexCoordATI)(GLuint, GLuint, GLenum);
+#define CALL_PassTexCoordATI(disp, parameters) \
+ (* GET_PassTexCoordATI(disp)) parameters
+static INLINE _glptr_PassTexCoordATI GET_PassTexCoordATI(struct _glapi_table *disp) {
+ return (_glptr_PassTexCoordATI) (GET_by_offset(disp, _gloffset_PassTexCoordATI));
+}
+
+static INLINE void SET_PassTexCoordATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLenum)) {
+ SET_by_offset(disp, _gloffset_PassTexCoordATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SampleMapATI)(GLuint, GLuint, GLenum);
+#define CALL_SampleMapATI(disp, parameters) \
+ (* GET_SampleMapATI(disp)) parameters
+static INLINE _glptr_SampleMapATI GET_SampleMapATI(struct _glapi_table *disp) {
+ return (_glptr_SampleMapATI) (GET_by_offset(disp, _gloffset_SampleMapATI));
+}
+
+static INLINE void SET_SampleMapATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLenum)) {
+ SET_by_offset(disp, _gloffset_SampleMapATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_SetFragmentShaderConstantATI)(GLuint, const GLfloat *);
+#define CALL_SetFragmentShaderConstantATI(disp, parameters) \
+ (* GET_SetFragmentShaderConstantATI(disp)) parameters
+static INLINE _glptr_SetFragmentShaderConstantATI GET_SetFragmentShaderConstantATI(struct _glapi_table *disp) {
+ return (_glptr_SetFragmentShaderConstantATI) (GET_by_offset(disp, _gloffset_SetFragmentShaderConstantATI));
+}
+
+static INLINE void SET_SetFragmentShaderConstantATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_SetFragmentShaderConstantATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PointParameteriNV)(GLenum, GLint);
+#define CALL_PointParameteriNV(disp, parameters) \
+ (* GET_PointParameteriNV(disp)) parameters
+static INLINE _glptr_PointParameteriNV GET_PointParameteriNV(struct _glapi_table *disp) {
+ return (_glptr_PointParameteriNV) (GET_by_offset(disp, _gloffset_PointParameteriNV));
+}
+
+static INLINE void SET_PointParameteriNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_PointParameteriNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PointParameterivNV)(GLenum, const GLint *);
+#define CALL_PointParameterivNV(disp, parameters) \
+ (* GET_PointParameterivNV(disp)) parameters
+static INLINE _glptr_PointParameterivNV GET_PointParameterivNV(struct _glapi_table *disp) {
+ return (_glptr_PointParameterivNV) (GET_by_offset(disp, _gloffset_PointParameterivNV));
+}
+
+static INLINE void SET_PointParameterivNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_PointParameterivNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ActiveStencilFaceEXT)(GLenum);
+#define CALL_ActiveStencilFaceEXT(disp, parameters) \
+ (* GET_ActiveStencilFaceEXT(disp)) parameters
+static INLINE _glptr_ActiveStencilFaceEXT GET_ActiveStencilFaceEXT(struct _glapi_table *disp) {
+ return (_glptr_ActiveStencilFaceEXT) (GET_by_offset(disp, _gloffset_ActiveStencilFaceEXT));
+}
+
+static INLINE void SET_ActiveStencilFaceEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_ActiveStencilFaceEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindVertexArrayAPPLE)(GLuint);
+#define CALL_BindVertexArrayAPPLE(disp, parameters) \
+ (* GET_BindVertexArrayAPPLE(disp)) parameters
+static INLINE _glptr_BindVertexArrayAPPLE GET_BindVertexArrayAPPLE(struct _glapi_table *disp) {
+ return (_glptr_BindVertexArrayAPPLE) (GET_by_offset(disp, _gloffset_BindVertexArrayAPPLE));
+}
+
+static INLINE void SET_BindVertexArrayAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_BindVertexArrayAPPLE, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteVertexArraysAPPLE)(GLsizei, const GLuint *);
+#define CALL_DeleteVertexArraysAPPLE(disp, parameters) \
+ (* GET_DeleteVertexArraysAPPLE(disp)) parameters
+static INLINE _glptr_DeleteVertexArraysAPPLE GET_DeleteVertexArraysAPPLE(struct _glapi_table *disp) {
+ return (_glptr_DeleteVertexArraysAPPLE) (GET_by_offset(disp, _gloffset_DeleteVertexArraysAPPLE));
+}
+
+static INLINE void SET_DeleteVertexArraysAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_DeleteVertexArraysAPPLE, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenVertexArraysAPPLE)(GLsizei, GLuint *);
+#define CALL_GenVertexArraysAPPLE(disp, parameters) \
+ (* GET_GenVertexArraysAPPLE(disp)) parameters
+static INLINE _glptr_GenVertexArraysAPPLE GET_GenVertexArraysAPPLE(struct _glapi_table *disp) {
+ return (_glptr_GenVertexArraysAPPLE) (GET_by_offset(disp, _gloffset_GenVertexArraysAPPLE));
+}
+
+static INLINE void SET_GenVertexArraysAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenVertexArraysAPPLE, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsVertexArrayAPPLE)(GLuint);
+#define CALL_IsVertexArrayAPPLE(disp, parameters) \
+ (* GET_IsVertexArrayAPPLE(disp)) parameters
+static INLINE _glptr_IsVertexArrayAPPLE GET_IsVertexArrayAPPLE(struct _glapi_table *disp) {
+ return (_glptr_IsVertexArrayAPPLE) (GET_by_offset(disp, _gloffset_IsVertexArrayAPPLE));
+}
+
+static INLINE void SET_IsVertexArrayAPPLE(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsVertexArrayAPPLE, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramNamedParameterdvNV)(GLuint, GLsizei, const GLubyte *, GLdouble *);
+#define CALL_GetProgramNamedParameterdvNV(disp, parameters) \
+ (* GET_GetProgramNamedParameterdvNV(disp)) parameters
+static INLINE _glptr_GetProgramNamedParameterdvNV GET_GetProgramNamedParameterdvNV(struct _glapi_table *disp) {
+ return (_glptr_GetProgramNamedParameterdvNV) (GET_by_offset(disp, _gloffset_GetProgramNamedParameterdvNV));
+}
+
+static INLINE void SET_GetProgramNamedParameterdvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, GLdouble *)) {
+ SET_by_offset(disp, _gloffset_GetProgramNamedParameterdvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetProgramNamedParameterfvNV)(GLuint, GLsizei, const GLubyte *, GLfloat *);
+#define CALL_GetProgramNamedParameterfvNV(disp, parameters) \
+ (* GET_GetProgramNamedParameterfvNV(disp)) parameters
+static INLINE _glptr_GetProgramNamedParameterfvNV GET_GetProgramNamedParameterfvNV(struct _glapi_table *disp) {
+ return (_glptr_GetProgramNamedParameterfvNV) (GET_by_offset(disp, _gloffset_GetProgramNamedParameterfvNV));
+}
+
+static INLINE void SET_GetProgramNamedParameterfvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, GLfloat *)) {
+ SET_by_offset(disp, _gloffset_GetProgramNamedParameterfvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4dNV)(GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble);
+#define CALL_ProgramNamedParameter4dNV(disp, parameters) \
+ (* GET_ProgramNamedParameter4dNV(disp)) parameters
+static INLINE _glptr_ProgramNamedParameter4dNV GET_ProgramNamedParameter4dNV(struct _glapi_table *disp) {
+ return (_glptr_ProgramNamedParameter4dNV) (GET_by_offset(disp, _gloffset_ProgramNamedParameter4dNV));
+}
+
+static INLINE void SET_ProgramNamedParameter4dNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble)) {
+ SET_by_offset(disp, _gloffset_ProgramNamedParameter4dNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4dvNV)(GLuint, GLsizei, const GLubyte *, const GLdouble *);
+#define CALL_ProgramNamedParameter4dvNV(disp, parameters) \
+ (* GET_ProgramNamedParameter4dvNV(disp)) parameters
+static INLINE _glptr_ProgramNamedParameter4dvNV GET_ProgramNamedParameter4dvNV(struct _glapi_table *disp) {
+ return (_glptr_ProgramNamedParameter4dvNV) (GET_by_offset(disp, _gloffset_ProgramNamedParameter4dvNV));
+}
+
+static INLINE void SET_ProgramNamedParameter4dvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, const GLdouble *)) {
+ SET_by_offset(disp, _gloffset_ProgramNamedParameter4dvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4fNV)(GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat);
+#define CALL_ProgramNamedParameter4fNV(disp, parameters) \
+ (* GET_ProgramNamedParameter4fNV(disp)) parameters
+static INLINE _glptr_ProgramNamedParameter4fNV GET_ProgramNamedParameter4fNV(struct _glapi_table *disp) {
+ return (_glptr_ProgramNamedParameter4fNV) (GET_by_offset(disp, _gloffset_ProgramNamedParameter4fNV));
+}
+
+static INLINE void SET_ProgramNamedParameter4fNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat)) {
+ SET_by_offset(disp, _gloffset_ProgramNamedParameter4fNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4fvNV)(GLuint, GLsizei, const GLubyte *, const GLfloat *);
+#define CALL_ProgramNamedParameter4fvNV(disp, parameters) \
+ (* GET_ProgramNamedParameter4fvNV(disp)) parameters
+static INLINE _glptr_ProgramNamedParameter4fvNV GET_ProgramNamedParameter4fvNV(struct _glapi_table *disp) {
+ return (_glptr_ProgramNamedParameter4fvNV) (GET_by_offset(disp, _gloffset_ProgramNamedParameter4fvNV));
+}
+
+static INLINE void SET_ProgramNamedParameter4fvNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLubyte *, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_ProgramNamedParameter4fvNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PrimitiveRestartIndexNV)(GLuint);
+#define CALL_PrimitiveRestartIndexNV(disp, parameters) \
+ (* GET_PrimitiveRestartIndexNV(disp)) parameters
+static INLINE _glptr_PrimitiveRestartIndexNV GET_PrimitiveRestartIndexNV(struct _glapi_table *disp) {
+ return (_glptr_PrimitiveRestartIndexNV) (GET_by_offset(disp, _gloffset_PrimitiveRestartIndexNV));
+}
+
+static INLINE void SET_PrimitiveRestartIndexNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_PrimitiveRestartIndexNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_PrimitiveRestartNV)(void);
+#define CALL_PrimitiveRestartNV(disp, parameters) \
+ (* GET_PrimitiveRestartNV(disp)) parameters
+static INLINE _glptr_PrimitiveRestartNV GET_PrimitiveRestartNV(struct _glapi_table *disp) {
+ return (_glptr_PrimitiveRestartNV) (GET_by_offset(disp, _gloffset_PrimitiveRestartNV));
+}
+
+static INLINE void SET_PrimitiveRestartNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_PrimitiveRestartNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DepthBoundsEXT)(GLclampd, GLclampd);
+#define CALL_DepthBoundsEXT(disp, parameters) \
+ (* GET_DepthBoundsEXT(disp)) parameters
+static INLINE _glptr_DepthBoundsEXT GET_DepthBoundsEXT(struct _glapi_table *disp) {
+ return (_glptr_DepthBoundsEXT) (GET_by_offset(disp, _gloffset_DepthBoundsEXT));
+}
+
+static INLINE void SET_DepthBoundsEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampd, GLclampd)) {
+ SET_by_offset(disp, _gloffset_DepthBoundsEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BlendEquationSeparateEXT)(GLenum, GLenum);
+#define CALL_BlendEquationSeparateEXT(disp, parameters) \
+ (* GET_BlendEquationSeparateEXT(disp)) parameters
+static INLINE _glptr_BlendEquationSeparateEXT GET_BlendEquationSeparateEXT(struct _glapi_table *disp) {
+ return (_glptr_BlendEquationSeparateEXT) (GET_by_offset(disp, _gloffset_BlendEquationSeparateEXT));
+}
+
+static INLINE void SET_BlendEquationSeparateEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum)) {
+ SET_by_offset(disp, _gloffset_BlendEquationSeparateEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindFramebufferEXT)(GLenum, GLuint);
+#define CALL_BindFramebufferEXT(disp, parameters) \
+ (* GET_BindFramebufferEXT(disp)) parameters
+static INLINE _glptr_BindFramebufferEXT GET_BindFramebufferEXT(struct _glapi_table *disp) {
+ return (_glptr_BindFramebufferEXT) (GET_by_offset(disp, _gloffset_BindFramebufferEXT));
+}
+
+static INLINE void SET_BindFramebufferEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_BindFramebufferEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindRenderbufferEXT)(GLenum, GLuint);
+#define CALL_BindRenderbufferEXT(disp, parameters) \
+ (* GET_BindRenderbufferEXT(disp)) parameters
+static INLINE _glptr_BindRenderbufferEXT GET_BindRenderbufferEXT(struct _glapi_table *disp) {
+ return (_glptr_BindRenderbufferEXT) (GET_by_offset(disp, _gloffset_BindRenderbufferEXT));
+}
+
+static INLINE void SET_BindRenderbufferEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_BindRenderbufferEXT, fn);
+}
+
+typedef GLenum (GLAPIENTRYP _glptr_CheckFramebufferStatusEXT)(GLenum);
+#define CALL_CheckFramebufferStatusEXT(disp, parameters) \
+ (* GET_CheckFramebufferStatusEXT(disp)) parameters
+static INLINE _glptr_CheckFramebufferStatusEXT GET_CheckFramebufferStatusEXT(struct _glapi_table *disp) {
+ return (_glptr_CheckFramebufferStatusEXT) (GET_by_offset(disp, _gloffset_CheckFramebufferStatusEXT));
+}
+
+static INLINE void SET_CheckFramebufferStatusEXT(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_CheckFramebufferStatusEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteFramebuffersEXT)(GLsizei, const GLuint *);
+#define CALL_DeleteFramebuffersEXT(disp, parameters) \
+ (* GET_DeleteFramebuffersEXT(disp)) parameters
+static INLINE _glptr_DeleteFramebuffersEXT GET_DeleteFramebuffersEXT(struct _glapi_table *disp) {
+ return (_glptr_DeleteFramebuffersEXT) (GET_by_offset(disp, _gloffset_DeleteFramebuffersEXT));
+}
+
+static INLINE void SET_DeleteFramebuffersEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_DeleteFramebuffersEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DeleteRenderbuffersEXT)(GLsizei, const GLuint *);
+#define CALL_DeleteRenderbuffersEXT(disp, parameters) \
+ (* GET_DeleteRenderbuffersEXT(disp)) parameters
+static INLINE _glptr_DeleteRenderbuffersEXT GET_DeleteRenderbuffersEXT(struct _glapi_table *disp) {
+ return (_glptr_DeleteRenderbuffersEXT) (GET_by_offset(disp, _gloffset_DeleteRenderbuffersEXT));
+}
+
+static INLINE void SET_DeleteRenderbuffersEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_DeleteRenderbuffersEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FramebufferRenderbufferEXT)(GLenum, GLenum, GLenum, GLuint);
+#define CALL_FramebufferRenderbufferEXT(disp, parameters) \
+ (* GET_FramebufferRenderbufferEXT(disp)) parameters
+static INLINE _glptr_FramebufferRenderbufferEXT GET_FramebufferRenderbufferEXT(struct _glapi_table *disp) {
+ return (_glptr_FramebufferRenderbufferEXT) (GET_by_offset(disp, _gloffset_FramebufferRenderbufferEXT));
+}
+
+static INLINE void SET_FramebufferRenderbufferEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_FramebufferRenderbufferEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FramebufferTexture1DEXT)(GLenum, GLenum, GLenum, GLuint, GLint);
+#define CALL_FramebufferTexture1DEXT(disp, parameters) \
+ (* GET_FramebufferTexture1DEXT(disp)) parameters
+static INLINE _glptr_FramebufferTexture1DEXT GET_FramebufferTexture1DEXT(struct _glapi_table *disp) {
+ return (_glptr_FramebufferTexture1DEXT) (GET_by_offset(disp, _gloffset_FramebufferTexture1DEXT));
+}
+
+static INLINE void SET_FramebufferTexture1DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLuint, GLint)) {
+ SET_by_offset(disp, _gloffset_FramebufferTexture1DEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FramebufferTexture2DEXT)(GLenum, GLenum, GLenum, GLuint, GLint);
+#define CALL_FramebufferTexture2DEXT(disp, parameters) \
+ (* GET_FramebufferTexture2DEXT(disp)) parameters
+static INLINE _glptr_FramebufferTexture2DEXT GET_FramebufferTexture2DEXT(struct _glapi_table *disp) {
+ return (_glptr_FramebufferTexture2DEXT) (GET_by_offset(disp, _gloffset_FramebufferTexture2DEXT));
+}
+
+static INLINE void SET_FramebufferTexture2DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLuint, GLint)) {
+ SET_by_offset(disp, _gloffset_FramebufferTexture2DEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FramebufferTexture3DEXT)(GLenum, GLenum, GLenum, GLuint, GLint, GLint);
+#define CALL_FramebufferTexture3DEXT(disp, parameters) \
+ (* GET_FramebufferTexture3DEXT(disp)) parameters
+static INLINE _glptr_FramebufferTexture3DEXT GET_FramebufferTexture3DEXT(struct _glapi_table *disp) {
+ return (_glptr_FramebufferTexture3DEXT) (GET_by_offset(disp, _gloffset_FramebufferTexture3DEXT));
+}
+
+static INLINE void SET_FramebufferTexture3DEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLuint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_FramebufferTexture3DEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenFramebuffersEXT)(GLsizei, GLuint *);
+#define CALL_GenFramebuffersEXT(disp, parameters) \
+ (* GET_GenFramebuffersEXT(disp)) parameters
+static INLINE _glptr_GenFramebuffersEXT GET_GenFramebuffersEXT(struct _glapi_table *disp) {
+ return (_glptr_GenFramebuffersEXT) (GET_by_offset(disp, _gloffset_GenFramebuffersEXT));
+}
+
+static INLINE void SET_GenFramebuffersEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenFramebuffersEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenRenderbuffersEXT)(GLsizei, GLuint *);
+#define CALL_GenRenderbuffersEXT(disp, parameters) \
+ (* GET_GenRenderbuffersEXT(disp)) parameters
+static INLINE _glptr_GenRenderbuffersEXT GET_GenRenderbuffersEXT(struct _glapi_table *disp) {
+ return (_glptr_GenRenderbuffersEXT) (GET_by_offset(disp, _gloffset_GenRenderbuffersEXT));
+}
+
+static INLINE void SET_GenRenderbuffersEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GenRenderbuffersEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GenerateMipmapEXT)(GLenum);
+#define CALL_GenerateMipmapEXT(disp, parameters) \
+ (* GET_GenerateMipmapEXT(disp)) parameters
+static INLINE _glptr_GenerateMipmapEXT GET_GenerateMipmapEXT(struct _glapi_table *disp) {
+ return (_glptr_GenerateMipmapEXT) (GET_by_offset(disp, _gloffset_GenerateMipmapEXT));
+}
+
+static INLINE void SET_GenerateMipmapEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_GenerateMipmapEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetFramebufferAttachmentParameterivEXT)(GLenum, GLenum, GLenum, GLint *);
+#define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) \
+ (* GET_GetFramebufferAttachmentParameterivEXT(disp)) parameters
+static INLINE _glptr_GetFramebufferAttachmentParameterivEXT GET_GetFramebufferAttachmentParameterivEXT(struct _glapi_table *disp) {
+ return (_glptr_GetFramebufferAttachmentParameterivEXT) (GET_by_offset(disp, _gloffset_GetFramebufferAttachmentParameterivEXT));
+}
+
+static INLINE void SET_GetFramebufferAttachmentParameterivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetFramebufferAttachmentParameterivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetRenderbufferParameterivEXT)(GLenum, GLenum, GLint *);
+#define CALL_GetRenderbufferParameterivEXT(disp, parameters) \
+ (* GET_GetRenderbufferParameterivEXT(disp)) parameters
+static INLINE _glptr_GetRenderbufferParameterivEXT GET_GetRenderbufferParameterivEXT(struct _glapi_table *disp) {
+ return (_glptr_GetRenderbufferParameterivEXT) (GET_by_offset(disp, _gloffset_GetRenderbufferParameterivEXT));
+}
+
+static INLINE void SET_GetRenderbufferParameterivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetRenderbufferParameterivEXT, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsFramebufferEXT)(GLuint);
+#define CALL_IsFramebufferEXT(disp, parameters) \
+ (* GET_IsFramebufferEXT(disp)) parameters
+static INLINE _glptr_IsFramebufferEXT GET_IsFramebufferEXT(struct _glapi_table *disp) {
+ return (_glptr_IsFramebufferEXT) (GET_by_offset(disp, _gloffset_IsFramebufferEXT));
+}
+
+static INLINE void SET_IsFramebufferEXT(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsFramebufferEXT, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsRenderbufferEXT)(GLuint);
+#define CALL_IsRenderbufferEXT(disp, parameters) \
+ (* GET_IsRenderbufferEXT(disp)) parameters
+static INLINE _glptr_IsRenderbufferEXT GET_IsRenderbufferEXT(struct _glapi_table *disp) {
+ return (_glptr_IsRenderbufferEXT) (GET_by_offset(disp, _gloffset_IsRenderbufferEXT));
+}
+
+static INLINE void SET_IsRenderbufferEXT(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_IsRenderbufferEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_RenderbufferStorageEXT)(GLenum, GLenum, GLsizei, GLsizei);
+#define CALL_RenderbufferStorageEXT(disp, parameters) \
+ (* GET_RenderbufferStorageEXT(disp)) parameters
+static INLINE _glptr_RenderbufferStorageEXT GET_RenderbufferStorageEXT(struct _glapi_table *disp) {
+ return (_glptr_RenderbufferStorageEXT) (GET_by_offset(disp, _gloffset_RenderbufferStorageEXT));
+}
+
+static INLINE void SET_RenderbufferStorageEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLsizei, GLsizei)) {
+ SET_by_offset(disp, _gloffset_RenderbufferStorageEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BlitFramebufferEXT)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
+#define CALL_BlitFramebufferEXT(disp, parameters) \
+ (* GET_BlitFramebufferEXT(disp)) parameters
+static INLINE _glptr_BlitFramebufferEXT GET_BlitFramebufferEXT(struct _glapi_table *disp) {
+ return (_glptr_BlitFramebufferEXT) (GET_by_offset(disp, _gloffset_BlitFramebufferEXT));
+}
+
+static INLINE void SET_BlitFramebufferEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum)) {
+ SET_by_offset(disp, _gloffset_BlitFramebufferEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BufferParameteriAPPLE)(GLenum, GLenum, GLint);
+#define CALL_BufferParameteriAPPLE(disp, parameters) \
+ (* GET_BufferParameteriAPPLE(disp)) parameters
+static INLINE _glptr_BufferParameteriAPPLE GET_BufferParameteriAPPLE(struct _glapi_table *disp) {
+ return (_glptr_BufferParameteriAPPLE) (GET_by_offset(disp, _gloffset_BufferParameteriAPPLE));
+}
+
+static INLINE void SET_BufferParameteriAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint)) {
+ SET_by_offset(disp, _gloffset_BufferParameteriAPPLE, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FlushMappedBufferRangeAPPLE)(GLenum, GLintptr, GLsizeiptr);
+#define CALL_FlushMappedBufferRangeAPPLE(disp, parameters) \
+ (* GET_FlushMappedBufferRangeAPPLE(disp)) parameters
+static INLINE _glptr_FlushMappedBufferRangeAPPLE GET_FlushMappedBufferRangeAPPLE(struct _glapi_table *disp) {
+ return (_glptr_FlushMappedBufferRangeAPPLE) (GET_by_offset(disp, _gloffset_FlushMappedBufferRangeAPPLE));
+}
+
+static INLINE void SET_FlushMappedBufferRangeAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLintptr, GLsizeiptr)) {
+ SET_by_offset(disp, _gloffset_FlushMappedBufferRangeAPPLE, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindFragDataLocationEXT)(GLuint, GLuint, const GLchar *);
+#define CALL_BindFragDataLocationEXT(disp, parameters) \
+ (* GET_BindFragDataLocationEXT(disp)) parameters
+static INLINE _glptr_BindFragDataLocationEXT GET_BindFragDataLocationEXT(struct _glapi_table *disp) {
+ return (_glptr_BindFragDataLocationEXT) (GET_by_offset(disp, _gloffset_BindFragDataLocationEXT));
+}
+
+static INLINE void SET_BindFragDataLocationEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, const GLchar *)) {
+ SET_by_offset(disp, _gloffset_BindFragDataLocationEXT, fn);
+}
+
+typedef GLint (GLAPIENTRYP _glptr_GetFragDataLocationEXT)(GLuint, const GLchar *);
+#define CALL_GetFragDataLocationEXT(disp, parameters) \
+ (* GET_GetFragDataLocationEXT(disp)) parameters
+static INLINE _glptr_GetFragDataLocationEXT GET_GetFragDataLocationEXT(struct _glapi_table *disp) {
+ return (_glptr_GetFragDataLocationEXT) (GET_by_offset(disp, _gloffset_GetFragDataLocationEXT));
+}
+
+static INLINE void SET_GetFragDataLocationEXT(struct _glapi_table *disp, GLint (GLAPIENTRYP fn)(GLuint, const GLchar *)) {
+ SET_by_offset(disp, _gloffset_GetFragDataLocationEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetUniformuivEXT)(GLuint, GLint, GLuint *);
+#define CALL_GetUniformuivEXT(disp, parameters) \
+ (* GET_GetUniformuivEXT(disp)) parameters
+static INLINE _glptr_GetUniformuivEXT GET_GetUniformuivEXT(struct _glapi_table *disp) {
+ return (_glptr_GetUniformuivEXT) (GET_by_offset(disp, _gloffset_GetUniformuivEXT));
+}
+
+static INLINE void SET_GetUniformuivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GetUniformuivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetVertexAttribIivEXT)(GLuint, GLenum, GLint *);
+#define CALL_GetVertexAttribIivEXT(disp, parameters) \
+ (* GET_GetVertexAttribIivEXT(disp)) parameters
+static INLINE _glptr_GetVertexAttribIivEXT GET_GetVertexAttribIivEXT(struct _glapi_table *disp) {
+ return (_glptr_GetVertexAttribIivEXT) (GET_by_offset(disp, _gloffset_GetVertexAttribIivEXT));
+}
+
+static INLINE void SET_GetVertexAttribIivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetVertexAttribIivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetVertexAttribIuivEXT)(GLuint, GLenum, GLuint *);
+#define CALL_GetVertexAttribIuivEXT(disp, parameters) \
+ (* GET_GetVertexAttribIuivEXT(disp)) parameters
+static INLINE _glptr_GetVertexAttribIuivEXT GET_GetVertexAttribIuivEXT(struct _glapi_table *disp) {
+ return (_glptr_GetVertexAttribIuivEXT) (GET_by_offset(disp, _gloffset_GetVertexAttribIuivEXT));
+}
+
+static INLINE void SET_GetVertexAttribIuivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GetVertexAttribIuivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform1uiEXT)(GLint, GLuint);
+#define CALL_Uniform1uiEXT(disp, parameters) \
+ (* GET_Uniform1uiEXT(disp)) parameters
+static INLINE _glptr_Uniform1uiEXT GET_Uniform1uiEXT(struct _glapi_table *disp) {
+ return (_glptr_Uniform1uiEXT) (GET_by_offset(disp, _gloffset_Uniform1uiEXT));
+}
+
+static INLINE void SET_Uniform1uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLuint)) {
+ SET_by_offset(disp, _gloffset_Uniform1uiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform1uivEXT)(GLint, GLsizei, const GLuint *);
+#define CALL_Uniform1uivEXT(disp, parameters) \
+ (* GET_Uniform1uivEXT(disp)) parameters
+static INLINE _glptr_Uniform1uivEXT GET_Uniform1uivEXT(struct _glapi_table *disp) {
+ return (_glptr_Uniform1uivEXT) (GET_by_offset(disp, _gloffset_Uniform1uivEXT));
+}
+
+static INLINE void SET_Uniform1uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_Uniform1uivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform2uiEXT)(GLint, GLuint, GLuint);
+#define CALL_Uniform2uiEXT(disp, parameters) \
+ (* GET_Uniform2uiEXT(disp)) parameters
+static INLINE _glptr_Uniform2uiEXT GET_Uniform2uiEXT(struct _glapi_table *disp) {
+ return (_glptr_Uniform2uiEXT) (GET_by_offset(disp, _gloffset_Uniform2uiEXT));
+}
+
+static INLINE void SET_Uniform2uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_Uniform2uiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform2uivEXT)(GLint, GLsizei, const GLuint *);
+#define CALL_Uniform2uivEXT(disp, parameters) \
+ (* GET_Uniform2uivEXT(disp)) parameters
+static INLINE _glptr_Uniform2uivEXT GET_Uniform2uivEXT(struct _glapi_table *disp) {
+ return (_glptr_Uniform2uivEXT) (GET_by_offset(disp, _gloffset_Uniform2uivEXT));
+}
+
+static INLINE void SET_Uniform2uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_Uniform2uivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform3uiEXT)(GLint, GLuint, GLuint, GLuint);
+#define CALL_Uniform3uiEXT(disp, parameters) \
+ (* GET_Uniform3uiEXT(disp)) parameters
+static INLINE _glptr_Uniform3uiEXT GET_Uniform3uiEXT(struct _glapi_table *disp) {
+ return (_glptr_Uniform3uiEXT) (GET_by_offset(disp, _gloffset_Uniform3uiEXT));
+}
+
+static INLINE void SET_Uniform3uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_Uniform3uiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform3uivEXT)(GLint, GLsizei, const GLuint *);
+#define CALL_Uniform3uivEXT(disp, parameters) \
+ (* GET_Uniform3uivEXT(disp)) parameters
+static INLINE _glptr_Uniform3uivEXT GET_Uniform3uivEXT(struct _glapi_table *disp) {
+ return (_glptr_Uniform3uivEXT) (GET_by_offset(disp, _gloffset_Uniform3uivEXT));
+}
+
+static INLINE void SET_Uniform3uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_Uniform3uivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform4uiEXT)(GLint, GLuint, GLuint, GLuint, GLuint);
+#define CALL_Uniform4uiEXT(disp, parameters) \
+ (* GET_Uniform4uiEXT(disp)) parameters
+static INLINE _glptr_Uniform4uiEXT GET_Uniform4uiEXT(struct _glapi_table *disp) {
+ return (_glptr_Uniform4uiEXT) (GET_by_offset(disp, _gloffset_Uniform4uiEXT));
+}
+
+static INLINE void SET_Uniform4uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_Uniform4uiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_Uniform4uivEXT)(GLint, GLsizei, const GLuint *);
+#define CALL_Uniform4uivEXT(disp, parameters) \
+ (* GET_Uniform4uivEXT(disp)) parameters
+static INLINE _glptr_Uniform4uivEXT GET_Uniform4uivEXT(struct _glapi_table *disp) {
+ return (_glptr_Uniform4uivEXT) (GET_by_offset(disp, _gloffset_Uniform4uivEXT));
+}
+
+static INLINE void SET_Uniform4uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLsizei, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_Uniform4uivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI1iEXT)(GLuint, GLint);
+#define CALL_VertexAttribI1iEXT(disp, parameters) \
+ (* GET_VertexAttribI1iEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI1iEXT GET_VertexAttribI1iEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI1iEXT) (GET_by_offset(disp, _gloffset_VertexAttribI1iEXT));
+}
+
+static INLINE void SET_VertexAttribI1iEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI1iEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI1ivEXT)(GLuint, const GLint *);
+#define CALL_VertexAttribI1ivEXT(disp, parameters) \
+ (* GET_VertexAttribI1ivEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI1ivEXT GET_VertexAttribI1ivEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI1ivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI1ivEXT));
+}
+
+static INLINE void SET_VertexAttribI1ivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI1ivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI1uiEXT)(GLuint, GLuint);
+#define CALL_VertexAttribI1uiEXT(disp, parameters) \
+ (* GET_VertexAttribI1uiEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI1uiEXT GET_VertexAttribI1uiEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI1uiEXT) (GET_by_offset(disp, _gloffset_VertexAttribI1uiEXT));
+}
+
+static INLINE void SET_VertexAttribI1uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI1uiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI1uivEXT)(GLuint, const GLuint *);
+#define CALL_VertexAttribI1uivEXT(disp, parameters) \
+ (* GET_VertexAttribI1uivEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI1uivEXT GET_VertexAttribI1uivEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI1uivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI1uivEXT));
+}
+
+static INLINE void SET_VertexAttribI1uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI1uivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI2iEXT)(GLuint, GLint, GLint);
+#define CALL_VertexAttribI2iEXT(disp, parameters) \
+ (* GET_VertexAttribI2iEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI2iEXT GET_VertexAttribI2iEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI2iEXT) (GET_by_offset(disp, _gloffset_VertexAttribI2iEXT));
+}
+
+static INLINE void SET_VertexAttribI2iEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI2iEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI2ivEXT)(GLuint, const GLint *);
+#define CALL_VertexAttribI2ivEXT(disp, parameters) \
+ (* GET_VertexAttribI2ivEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI2ivEXT GET_VertexAttribI2ivEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI2ivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI2ivEXT));
+}
+
+static INLINE void SET_VertexAttribI2ivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI2ivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI2uiEXT)(GLuint, GLuint, GLuint);
+#define CALL_VertexAttribI2uiEXT(disp, parameters) \
+ (* GET_VertexAttribI2uiEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI2uiEXT GET_VertexAttribI2uiEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI2uiEXT) (GET_by_offset(disp, _gloffset_VertexAttribI2uiEXT));
+}
+
+static INLINE void SET_VertexAttribI2uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI2uiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI2uivEXT)(GLuint, const GLuint *);
+#define CALL_VertexAttribI2uivEXT(disp, parameters) \
+ (* GET_VertexAttribI2uivEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI2uivEXT GET_VertexAttribI2uivEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI2uivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI2uivEXT));
+}
+
+static INLINE void SET_VertexAttribI2uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI2uivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI3iEXT)(GLuint, GLint, GLint, GLint);
+#define CALL_VertexAttribI3iEXT(disp, parameters) \
+ (* GET_VertexAttribI3iEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI3iEXT GET_VertexAttribI3iEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI3iEXT) (GET_by_offset(disp, _gloffset_VertexAttribI3iEXT));
+}
+
+static INLINE void SET_VertexAttribI3iEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI3iEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI3ivEXT)(GLuint, const GLint *);
+#define CALL_VertexAttribI3ivEXT(disp, parameters) \
+ (* GET_VertexAttribI3ivEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI3ivEXT GET_VertexAttribI3ivEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI3ivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI3ivEXT));
+}
+
+static INLINE void SET_VertexAttribI3ivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI3ivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI3uiEXT)(GLuint, GLuint, GLuint, GLuint);
+#define CALL_VertexAttribI3uiEXT(disp, parameters) \
+ (* GET_VertexAttribI3uiEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI3uiEXT GET_VertexAttribI3uiEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI3uiEXT) (GET_by_offset(disp, _gloffset_VertexAttribI3uiEXT));
+}
+
+static INLINE void SET_VertexAttribI3uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI3uiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI3uivEXT)(GLuint, const GLuint *);
+#define CALL_VertexAttribI3uivEXT(disp, parameters) \
+ (* GET_VertexAttribI3uivEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI3uivEXT GET_VertexAttribI3uivEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI3uivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI3uivEXT));
+}
+
+static INLINE void SET_VertexAttribI3uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI3uivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI4bvEXT)(GLuint, const GLbyte *);
+#define CALL_VertexAttribI4bvEXT(disp, parameters) \
+ (* GET_VertexAttribI4bvEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI4bvEXT GET_VertexAttribI4bvEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI4bvEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4bvEXT));
+}
+
+static INLINE void SET_VertexAttribI4bvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLbyte *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI4bvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI4iEXT)(GLuint, GLint, GLint, GLint, GLint);
+#define CALL_VertexAttribI4iEXT(disp, parameters) \
+ (* GET_VertexAttribI4iEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI4iEXT GET_VertexAttribI4iEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI4iEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4iEXT));
+}
+
+static INLINE void SET_VertexAttribI4iEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI4iEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI4ivEXT)(GLuint, const GLint *);
+#define CALL_VertexAttribI4ivEXT(disp, parameters) \
+ (* GET_VertexAttribI4ivEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI4ivEXT GET_VertexAttribI4ivEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI4ivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4ivEXT));
+}
+
+static INLINE void SET_VertexAttribI4ivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI4ivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI4svEXT)(GLuint, const GLshort *);
+#define CALL_VertexAttribI4svEXT(disp, parameters) \
+ (* GET_VertexAttribI4svEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI4svEXT GET_VertexAttribI4svEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI4svEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4svEXT));
+}
+
+static INLINE void SET_VertexAttribI4svEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLshort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI4svEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI4ubvEXT)(GLuint, const GLubyte *);
+#define CALL_VertexAttribI4ubvEXT(disp, parameters) \
+ (* GET_VertexAttribI4ubvEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI4ubvEXT GET_VertexAttribI4ubvEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI4ubvEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4ubvEXT));
+}
+
+static INLINE void SET_VertexAttribI4ubvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLubyte *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI4ubvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI4uiEXT)(GLuint, GLuint, GLuint, GLuint, GLuint);
+#define CALL_VertexAttribI4uiEXT(disp, parameters) \
+ (* GET_VertexAttribI4uiEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI4uiEXT GET_VertexAttribI4uiEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI4uiEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4uiEXT));
+}
+
+static INLINE void SET_VertexAttribI4uiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI4uiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI4uivEXT)(GLuint, const GLuint *);
+#define CALL_VertexAttribI4uivEXT(disp, parameters) \
+ (* GET_VertexAttribI4uivEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI4uivEXT GET_VertexAttribI4uivEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI4uivEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4uivEXT));
+}
+
+static INLINE void SET_VertexAttribI4uivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI4uivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribI4usvEXT)(GLuint, const GLushort *);
+#define CALL_VertexAttribI4usvEXT(disp, parameters) \
+ (* GET_VertexAttribI4usvEXT(disp)) parameters
+static INLINE _glptr_VertexAttribI4usvEXT GET_VertexAttribI4usvEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribI4usvEXT) (GET_by_offset(disp, _gloffset_VertexAttribI4usvEXT));
+}
+
+static INLINE void SET_VertexAttribI4usvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, const GLushort *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribI4usvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_VertexAttribIPointerEXT)(GLuint, GLint, GLenum, GLsizei, const GLvoid *);
+#define CALL_VertexAttribIPointerEXT(disp, parameters) \
+ (* GET_VertexAttribIPointerEXT(disp)) parameters
+static INLINE _glptr_VertexAttribIPointerEXT GET_VertexAttribIPointerEXT(struct _glapi_table *disp) {
+ return (_glptr_VertexAttribIPointerEXT) (GET_by_offset(disp, _gloffset_VertexAttribIPointerEXT));
+}
+
+static INLINE void SET_VertexAttribIPointerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLint, GLenum, GLsizei, const GLvoid *)) {
+ SET_by_offset(disp, _gloffset_VertexAttribIPointerEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_FramebufferTextureLayerEXT)(GLenum, GLenum, GLuint, GLint, GLint);
+#define CALL_FramebufferTextureLayerEXT(disp, parameters) \
+ (* GET_FramebufferTextureLayerEXT(disp)) parameters
+static INLINE _glptr_FramebufferTextureLayerEXT GET_FramebufferTextureLayerEXT(struct _glapi_table *disp) {
+ return (_glptr_FramebufferTextureLayerEXT) (GET_by_offset(disp, _gloffset_FramebufferTextureLayerEXT));
+}
+
+static INLINE void SET_FramebufferTextureLayerEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_FramebufferTextureLayerEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ColorMaskIndexedEXT)(GLuint, GLboolean, GLboolean, GLboolean, GLboolean);
+#define CALL_ColorMaskIndexedEXT(disp, parameters) \
+ (* GET_ColorMaskIndexedEXT(disp)) parameters
+static INLINE _glptr_ColorMaskIndexedEXT GET_ColorMaskIndexedEXT(struct _glapi_table *disp) {
+ return (_glptr_ColorMaskIndexedEXT) (GET_by_offset(disp, _gloffset_ColorMaskIndexedEXT));
+}
+
+static INLINE void SET_ColorMaskIndexedEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLboolean, GLboolean, GLboolean, GLboolean)) {
+ SET_by_offset(disp, _gloffset_ColorMaskIndexedEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_DisableIndexedEXT)(GLenum, GLuint);
+#define CALL_DisableIndexedEXT(disp, parameters) \
+ (* GET_DisableIndexedEXT(disp)) parameters
+static INLINE _glptr_DisableIndexedEXT GET_DisableIndexedEXT(struct _glapi_table *disp) {
+ return (_glptr_DisableIndexedEXT) (GET_by_offset(disp, _gloffset_DisableIndexedEXT));
+}
+
+static INLINE void SET_DisableIndexedEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_DisableIndexedEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EnableIndexedEXT)(GLenum, GLuint);
+#define CALL_EnableIndexedEXT(disp, parameters) \
+ (* GET_EnableIndexedEXT(disp)) parameters
+static INLINE _glptr_EnableIndexedEXT GET_EnableIndexedEXT(struct _glapi_table *disp) {
+ return (_glptr_EnableIndexedEXT) (GET_by_offset(disp, _gloffset_EnableIndexedEXT));
+}
+
+static INLINE void SET_EnableIndexedEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_EnableIndexedEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetBooleanIndexedvEXT)(GLenum, GLuint, GLboolean *);
+#define CALL_GetBooleanIndexedvEXT(disp, parameters) \
+ (* GET_GetBooleanIndexedvEXT(disp)) parameters
+static INLINE _glptr_GetBooleanIndexedvEXT GET_GetBooleanIndexedvEXT(struct _glapi_table *disp) {
+ return (_glptr_GetBooleanIndexedvEXT) (GET_by_offset(disp, _gloffset_GetBooleanIndexedvEXT));
+}
+
+static INLINE void SET_GetBooleanIndexedvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLboolean *)) {
+ SET_by_offset(disp, _gloffset_GetBooleanIndexedvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetIntegerIndexedvEXT)(GLenum, GLuint, GLint *);
+#define CALL_GetIntegerIndexedvEXT(disp, parameters) \
+ (* GET_GetIntegerIndexedvEXT(disp)) parameters
+static INLINE _glptr_GetIntegerIndexedvEXT GET_GetIntegerIndexedvEXT(struct _glapi_table *disp) {
+ return (_glptr_GetIntegerIndexedvEXT) (GET_by_offset(disp, _gloffset_GetIntegerIndexedvEXT));
+}
+
+static INLINE void SET_GetIntegerIndexedvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetIntegerIndexedvEXT, fn);
+}
+
+typedef GLboolean (GLAPIENTRYP _glptr_IsEnabledIndexedEXT)(GLenum, GLuint);
+#define CALL_IsEnabledIndexedEXT(disp, parameters) \
+ (* GET_IsEnabledIndexedEXT(disp)) parameters
+static INLINE _glptr_IsEnabledIndexedEXT GET_IsEnabledIndexedEXT(struct _glapi_table *disp) {
+ return (_glptr_IsEnabledIndexedEXT) (GET_by_offset(disp, _gloffset_IsEnabledIndexedEXT));
+}
+
+static INLINE void SET_IsEnabledIndexedEXT(struct _glapi_table *disp, GLboolean (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_IsEnabledIndexedEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearColorIiEXT)(GLint, GLint, GLint, GLint);
+#define CALL_ClearColorIiEXT(disp, parameters) \
+ (* GET_ClearColorIiEXT(disp)) parameters
+static INLINE _glptr_ClearColorIiEXT GET_ClearColorIiEXT(struct _glapi_table *disp) {
+ return (_glptr_ClearColorIiEXT) (GET_by_offset(disp, _gloffset_ClearColorIiEXT));
+}
+
+static INLINE void SET_ClearColorIiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLint, GLint, GLint, GLint)) {
+ SET_by_offset(disp, _gloffset_ClearColorIiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ClearColorIuiEXT)(GLuint, GLuint, GLuint, GLuint);
+#define CALL_ClearColorIuiEXT(disp, parameters) \
+ (* GET_ClearColorIuiEXT(disp)) parameters
+static INLINE _glptr_ClearColorIuiEXT GET_ClearColorIuiEXT(struct _glapi_table *disp) {
+ return (_glptr_ClearColorIuiEXT) (GET_by_offset(disp, _gloffset_ClearColorIuiEXT));
+}
+
+static INLINE void SET_ClearColorIuiEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_ClearColorIuiEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexParameterIivEXT)(GLenum, GLenum, GLint *);
+#define CALL_GetTexParameterIivEXT(disp, parameters) \
+ (* GET_GetTexParameterIivEXT(disp)) parameters
+static INLINE _glptr_GetTexParameterIivEXT GET_GetTexParameterIivEXT(struct _glapi_table *disp) {
+ return (_glptr_GetTexParameterIivEXT) (GET_by_offset(disp, _gloffset_GetTexParameterIivEXT));
+}
+
+static INLINE void SET_GetTexParameterIivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetTexParameterIivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexParameterIuivEXT)(GLenum, GLenum, GLuint *);
+#define CALL_GetTexParameterIuivEXT(disp, parameters) \
+ (* GET_GetTexParameterIuivEXT(disp)) parameters
+static INLINE _glptr_GetTexParameterIuivEXT GET_GetTexParameterIuivEXT(struct _glapi_table *disp) {
+ return (_glptr_GetTexParameterIuivEXT) (GET_by_offset(disp, _gloffset_GetTexParameterIuivEXT));
+}
+
+static INLINE void SET_GetTexParameterIuivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLuint *)) {
+ SET_by_offset(disp, _gloffset_GetTexParameterIuivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexParameterIivEXT)(GLenum, GLenum, const GLint *);
+#define CALL_TexParameterIivEXT(disp, parameters) \
+ (* GET_TexParameterIivEXT(disp)) parameters
+static INLINE _glptr_TexParameterIivEXT GET_TexParameterIivEXT(struct _glapi_table *disp) {
+ return (_glptr_TexParameterIivEXT) (GET_by_offset(disp, _gloffset_TexParameterIivEXT));
+}
+
+static INLINE void SET_TexParameterIivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLint *)) {
+ SET_by_offset(disp, _gloffset_TexParameterIivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TexParameterIuivEXT)(GLenum, GLenum, const GLuint *);
+#define CALL_TexParameterIuivEXT(disp, parameters) \
+ (* GET_TexParameterIuivEXT(disp)) parameters
+static INLINE _glptr_TexParameterIuivEXT GET_TexParameterIuivEXT(struct _glapi_table *disp) {
+ return (_glptr_TexParameterIuivEXT) (GET_by_offset(disp, _gloffset_TexParameterIuivEXT));
+}
+
+static INLINE void SET_TexParameterIuivEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, const GLuint *)) {
+ SET_by_offset(disp, _gloffset_TexParameterIuivEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BeginConditionalRenderNV)(GLuint, GLenum);
+#define CALL_BeginConditionalRenderNV(disp, parameters) \
+ (* GET_BeginConditionalRenderNV(disp)) parameters
+static INLINE _glptr_BeginConditionalRenderNV GET_BeginConditionalRenderNV(struct _glapi_table *disp) {
+ return (_glptr_BeginConditionalRenderNV) (GET_by_offset(disp, _gloffset_BeginConditionalRenderNV));
+}
+
+static INLINE void SET_BeginConditionalRenderNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum)) {
+ SET_by_offset(disp, _gloffset_BeginConditionalRenderNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EndConditionalRenderNV)(void);
+#define CALL_EndConditionalRenderNV(disp, parameters) \
+ (* GET_EndConditionalRenderNV(disp)) parameters
+static INLINE _glptr_EndConditionalRenderNV GET_EndConditionalRenderNV(struct _glapi_table *disp) {
+ return (_glptr_EndConditionalRenderNV) (GET_by_offset(disp, _gloffset_EndConditionalRenderNV));
+}
+
+static INLINE void SET_EndConditionalRenderNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_EndConditionalRenderNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BeginTransformFeedbackEXT)(GLenum);
+#define CALL_BeginTransformFeedbackEXT(disp, parameters) \
+ (* GET_BeginTransformFeedbackEXT(disp)) parameters
+static INLINE _glptr_BeginTransformFeedbackEXT GET_BeginTransformFeedbackEXT(struct _glapi_table *disp) {
+ return (_glptr_BeginTransformFeedbackEXT) (GET_by_offset(disp, _gloffset_BeginTransformFeedbackEXT));
+}
+
+static INLINE void SET_BeginTransformFeedbackEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_BeginTransformFeedbackEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindBufferBaseEXT)(GLenum, GLuint, GLuint);
+#define CALL_BindBufferBaseEXT(disp, parameters) \
+ (* GET_BindBufferBaseEXT(disp)) parameters
+static INLINE _glptr_BindBufferBaseEXT GET_BindBufferBaseEXT(struct _glapi_table *disp) {
+ return (_glptr_BindBufferBaseEXT) (GET_by_offset(disp, _gloffset_BindBufferBaseEXT));
+}
+
+static INLINE void SET_BindBufferBaseEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint)) {
+ SET_by_offset(disp, _gloffset_BindBufferBaseEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindBufferOffsetEXT)(GLenum, GLuint, GLuint, GLintptr);
+#define CALL_BindBufferOffsetEXT(disp, parameters) \
+ (* GET_BindBufferOffsetEXT(disp)) parameters
+static INLINE _glptr_BindBufferOffsetEXT GET_BindBufferOffsetEXT(struct _glapi_table *disp) {
+ return (_glptr_BindBufferOffsetEXT) (GET_by_offset(disp, _gloffset_BindBufferOffsetEXT));
+}
+
+static INLINE void SET_BindBufferOffsetEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLintptr)) {
+ SET_by_offset(disp, _gloffset_BindBufferOffsetEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_BindBufferRangeEXT)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
+#define CALL_BindBufferRangeEXT(disp, parameters) \
+ (* GET_BindBufferRangeEXT(disp)) parameters
+static INLINE _glptr_BindBufferRangeEXT GET_BindBufferRangeEXT(struct _glapi_table *disp) {
+ return (_glptr_BindBufferRangeEXT) (GET_by_offset(disp, _gloffset_BindBufferRangeEXT));
+}
+
+static INLINE void SET_BindBufferRangeEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr)) {
+ SET_by_offset(disp, _gloffset_BindBufferRangeEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EndTransformFeedbackEXT)(void);
+#define CALL_EndTransformFeedbackEXT(disp, parameters) \
+ (* GET_EndTransformFeedbackEXT(disp)) parameters
+static INLINE _glptr_EndTransformFeedbackEXT GET_EndTransformFeedbackEXT(struct _glapi_table *disp) {
+ return (_glptr_EndTransformFeedbackEXT) (GET_by_offset(disp, _gloffset_EndTransformFeedbackEXT));
+}
+
+static INLINE void SET_EndTransformFeedbackEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_EndTransformFeedbackEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTransformFeedbackVaryingEXT)(GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
+#define CALL_GetTransformFeedbackVaryingEXT(disp, parameters) \
+ (* GET_GetTransformFeedbackVaryingEXT(disp)) parameters
+static INLINE _glptr_GetTransformFeedbackVaryingEXT GET_GetTransformFeedbackVaryingEXT(struct _glapi_table *disp) {
+ return (_glptr_GetTransformFeedbackVaryingEXT) (GET_by_offset(disp, _gloffset_GetTransformFeedbackVaryingEXT));
+}
+
+static INLINE void SET_GetTransformFeedbackVaryingEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *)) {
+ SET_by_offset(disp, _gloffset_GetTransformFeedbackVaryingEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TransformFeedbackVaryingsEXT)(GLuint, GLsizei, const char **, GLenum);
+#define CALL_TransformFeedbackVaryingsEXT(disp, parameters) \
+ (* GET_TransformFeedbackVaryingsEXT(disp)) parameters
+static INLINE _glptr_TransformFeedbackVaryingsEXT GET_TransformFeedbackVaryingsEXT(struct _glapi_table *disp) {
+ return (_glptr_TransformFeedbackVaryingsEXT) (GET_by_offset(disp, _gloffset_TransformFeedbackVaryingsEXT));
+}
+
+static INLINE void SET_TransformFeedbackVaryingsEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const char **, GLenum)) {
+ SET_by_offset(disp, _gloffset_TransformFeedbackVaryingsEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProvokingVertexEXT)(GLenum);
+#define CALL_ProvokingVertexEXT(disp, parameters) \
+ (* GET_ProvokingVertexEXT(disp)) parameters
+static INLINE _glptr_ProvokingVertexEXT GET_ProvokingVertexEXT(struct _glapi_table *disp) {
+ return (_glptr_ProvokingVertexEXT) (GET_by_offset(disp, _gloffset_ProvokingVertexEXT));
+}
+
+static INLINE void SET_ProvokingVertexEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum)) {
+ SET_by_offset(disp, _gloffset_ProvokingVertexEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetTexParameterPointervAPPLE)(GLenum, GLenum, GLvoid **);
+#define CALL_GetTexParameterPointervAPPLE(disp, parameters) \
+ (* GET_GetTexParameterPointervAPPLE(disp)) parameters
+static INLINE _glptr_GetTexParameterPointervAPPLE GET_GetTexParameterPointervAPPLE(struct _glapi_table *disp) {
+ return (_glptr_GetTexParameterPointervAPPLE) (GET_by_offset(disp, _gloffset_GetTexParameterPointervAPPLE));
+}
+
+static INLINE void SET_GetTexParameterPointervAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLvoid **)) {
+ SET_by_offset(disp, _gloffset_GetTexParameterPointervAPPLE, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TextureRangeAPPLE)(GLenum, GLsizei, GLvoid *);
+#define CALL_TextureRangeAPPLE(disp, parameters) \
+ (* GET_TextureRangeAPPLE(disp)) parameters
+static INLINE _glptr_TextureRangeAPPLE GET_TextureRangeAPPLE(struct _glapi_table *disp) {
+ return (_glptr_TextureRangeAPPLE) (GET_by_offset(disp, _gloffset_TextureRangeAPPLE));
+}
+
+static INLINE void SET_TextureRangeAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLsizei, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_TextureRangeAPPLE, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetObjectParameterivAPPLE)(GLenum, GLuint, GLenum, GLint *);
+#define CALL_GetObjectParameterivAPPLE(disp, parameters) \
+ (* GET_GetObjectParameterivAPPLE(disp)) parameters
+static INLINE _glptr_GetObjectParameterivAPPLE GET_GetObjectParameterivAPPLE(struct _glapi_table *disp) {
+ return (_glptr_GetObjectParameterivAPPLE) (GET_by_offset(disp, _gloffset_GetObjectParameterivAPPLE));
+}
+
+static INLINE void SET_GetObjectParameterivAPPLE(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLenum, GLint *)) {
+ SET_by_offset(disp, _gloffset_GetObjectParameterivAPPLE, fn);
+}
+
+typedef GLenum (GLAPIENTRYP _glptr_ObjectPurgeableAPPLE)(GLenum, GLuint, GLenum);
+#define CALL_ObjectPurgeableAPPLE(disp, parameters) \
+ (* GET_ObjectPurgeableAPPLE(disp)) parameters
+static INLINE _glptr_ObjectPurgeableAPPLE GET_ObjectPurgeableAPPLE(struct _glapi_table *disp) {
+ return (_glptr_ObjectPurgeableAPPLE) (GET_by_offset(disp, _gloffset_ObjectPurgeableAPPLE));
+}
+
+static INLINE void SET_ObjectPurgeableAPPLE(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(GLenum, GLuint, GLenum)) {
+ SET_by_offset(disp, _gloffset_ObjectPurgeableAPPLE, fn);
+}
+
+typedef GLenum (GLAPIENTRYP _glptr_ObjectUnpurgeableAPPLE)(GLenum, GLuint, GLenum);
+#define CALL_ObjectUnpurgeableAPPLE(disp, parameters) \
+ (* GET_ObjectUnpurgeableAPPLE(disp)) parameters
+static INLINE _glptr_ObjectUnpurgeableAPPLE GET_ObjectUnpurgeableAPPLE(struct _glapi_table *disp) {
+ return (_glptr_ObjectUnpurgeableAPPLE) (GET_by_offset(disp, _gloffset_ObjectUnpurgeableAPPLE));
+}
+
+static INLINE void SET_ObjectUnpurgeableAPPLE(struct _glapi_table *disp, GLenum (GLAPIENTRYP fn)(GLenum, GLuint, GLenum)) {
+ SET_by_offset(disp, _gloffset_ObjectUnpurgeableAPPLE, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ActiveProgramEXT)(GLuint);
+#define CALL_ActiveProgramEXT(disp, parameters) \
+ (* GET_ActiveProgramEXT(disp)) parameters
+static INLINE _glptr_ActiveProgramEXT GET_ActiveProgramEXT(struct _glapi_table *disp) {
+ return (_glptr_ActiveProgramEXT) (GET_by_offset(disp, _gloffset_ActiveProgramEXT));
+}
+
+static INLINE void SET_ActiveProgramEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
+ SET_by_offset(disp, _gloffset_ActiveProgramEXT, fn);
+}
+
+typedef GLuint (GLAPIENTRYP _glptr_CreateShaderProgramEXT)(GLenum, const GLchar *);
+#define CALL_CreateShaderProgramEXT(disp, parameters) \
+ (* GET_CreateShaderProgramEXT(disp)) parameters
+static INLINE _glptr_CreateShaderProgramEXT GET_CreateShaderProgramEXT(struct _glapi_table *disp) {
+ return (_glptr_CreateShaderProgramEXT) (GET_by_offset(disp, _gloffset_CreateShaderProgramEXT));
+}
+
+static INLINE void SET_CreateShaderProgramEXT(struct _glapi_table *disp, GLuint (GLAPIENTRYP fn)(GLenum, const GLchar *)) {
+ SET_by_offset(disp, _gloffset_CreateShaderProgramEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_UseShaderProgramEXT)(GLenum, GLuint);
+#define CALL_UseShaderProgramEXT(disp, parameters) \
+ (* GET_UseShaderProgramEXT(disp)) parameters
+static INLINE _glptr_UseShaderProgramEXT GET_UseShaderProgramEXT(struct _glapi_table *disp) {
+ return (_glptr_UseShaderProgramEXT) (GET_by_offset(disp, _gloffset_UseShaderProgramEXT));
+}
+
+static INLINE void SET_UseShaderProgramEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint)) {
+ SET_by_offset(disp, _gloffset_UseShaderProgramEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_TextureBarrierNV)(void);
+#define CALL_TextureBarrierNV(disp, parameters) \
+ (* GET_TextureBarrierNV(disp)) parameters
+static INLINE _glptr_TextureBarrierNV GET_TextureBarrierNV(struct _glapi_table *disp) {
+ return (_glptr_TextureBarrierNV) (GET_by_offset(disp, _gloffset_TextureBarrierNV));
+}
+
+static INLINE void SET_TextureBarrierNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
+ SET_by_offset(disp, _gloffset_TextureBarrierNV, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_StencilFuncSeparateATI)(GLenum, GLenum, GLint, GLuint);
+#define CALL_StencilFuncSeparateATI(disp, parameters) \
+ (* GET_StencilFuncSeparateATI(disp)) parameters
+static INLINE _glptr_StencilFuncSeparateATI GET_StencilFuncSeparateATI(struct _glapi_table *disp) {
+ return (_glptr_StencilFuncSeparateATI) (GET_by_offset(disp, _gloffset_StencilFuncSeparateATI));
+}
+
+static INLINE void SET_StencilFuncSeparateATI(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint, GLuint)) {
+ SET_by_offset(disp, _gloffset_StencilFuncSeparateATI, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramEnvParameters4fvEXT)(GLenum, GLuint, GLsizei, const GLfloat *);
+#define CALL_ProgramEnvParameters4fvEXT(disp, parameters) \
+ (* GET_ProgramEnvParameters4fvEXT(disp)) parameters
+static INLINE _glptr_ProgramEnvParameters4fvEXT GET_ProgramEnvParameters4fvEXT(struct _glapi_table *disp) {
+ return (_glptr_ProgramEnvParameters4fvEXT) (GET_by_offset(disp, _gloffset_ProgramEnvParameters4fvEXT));
+}
+
+static INLINE void SET_ProgramEnvParameters4fvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_ProgramEnvParameters4fvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_ProgramLocalParameters4fvEXT)(GLenum, GLuint, GLsizei, const GLfloat *);
+#define CALL_ProgramLocalParameters4fvEXT(disp, parameters) \
+ (* GET_ProgramLocalParameters4fvEXT(disp)) parameters
+static INLINE _glptr_ProgramLocalParameters4fvEXT GET_ProgramLocalParameters4fvEXT(struct _glapi_table *disp) {
+ return (_glptr_ProgramLocalParameters4fvEXT) (GET_by_offset(disp, _gloffset_ProgramLocalParameters4fvEXT));
+}
+
+static INLINE void SET_ProgramLocalParameters4fvEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLuint, GLsizei, const GLfloat *)) {
+ SET_by_offset(disp, _gloffset_ProgramLocalParameters4fvEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetQueryObjecti64vEXT)(GLuint, GLenum, GLint64EXT *);
+#define CALL_GetQueryObjecti64vEXT(disp, parameters) \
+ (* GET_GetQueryObjecti64vEXT(disp)) parameters
+static INLINE _glptr_GetQueryObjecti64vEXT GET_GetQueryObjecti64vEXT(struct _glapi_table *disp) {
+ return (_glptr_GetQueryObjecti64vEXT) (GET_by_offset(disp, _gloffset_GetQueryObjecti64vEXT));
+}
+
+static INLINE void SET_GetQueryObjecti64vEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLint64EXT *)) {
+ SET_by_offset(disp, _gloffset_GetQueryObjecti64vEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_GetQueryObjectui64vEXT)(GLuint, GLenum, GLuint64EXT *);
+#define CALL_GetQueryObjectui64vEXT(disp, parameters) \
+ (* GET_GetQueryObjectui64vEXT(disp)) parameters
+static INLINE _glptr_GetQueryObjectui64vEXT GET_GetQueryObjectui64vEXT(struct _glapi_table *disp) {
+ return (_glptr_GetQueryObjectui64vEXT) (GET_by_offset(disp, _gloffset_GetQueryObjectui64vEXT));
+}
+
+static INLINE void SET_GetQueryObjectui64vEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLuint64EXT *)) {
+ SET_by_offset(disp, _gloffset_GetQueryObjectui64vEXT, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EGLImageTargetRenderbufferStorageOES)(GLenum, GLvoid *);
+#define CALL_EGLImageTargetRenderbufferStorageOES(disp, parameters) \
+ (* GET_EGLImageTargetRenderbufferStorageOES(disp)) parameters
+static INLINE _glptr_EGLImageTargetRenderbufferStorageOES GET_EGLImageTargetRenderbufferStorageOES(struct _glapi_table *disp) {
+ return (_glptr_EGLImageTargetRenderbufferStorageOES) (GET_by_offset(disp, _gloffset_EGLImageTargetRenderbufferStorageOES));
+}
+
+static INLINE void SET_EGLImageTargetRenderbufferStorageOES(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_EGLImageTargetRenderbufferStorageOES, fn);
+}
+
+typedef void (GLAPIENTRYP _glptr_EGLImageTargetTexture2DOES)(GLenum, GLvoid *);
+#define CALL_EGLImageTargetTexture2DOES(disp, parameters) \
+ (* GET_EGLImageTargetTexture2DOES(disp)) parameters
+static INLINE _glptr_EGLImageTargetTexture2DOES GET_EGLImageTargetTexture2DOES(struct _glapi_table *disp) {
+ return (_glptr_EGLImageTargetTexture2DOES) (GET_by_offset(disp, _gloffset_EGLImageTargetTexture2DOES));
+}
+
+static INLINE void SET_EGLImageTargetTexture2DOES(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLvoid *)) {
+ SET_by_offset(disp, _gloffset_EGLImageTargetTexture2DOES, fn);
+}
+
+
+#endif /* !defined( _DISPATCH_H_ ) */
diff --git a/xorg-server/glx/glapi.c b/xorg-server/glx/glapi.c
index a7913a3a1..29a28f414 100644
--- a/xorg-server/glx/glapi.c
+++ b/xorg-server/glx/glapi.c
@@ -85,9 +85,9 @@ static void init_glapi_relocs(void);
/*@{*/
#if defined(GLX_USE_TLS)
-PUBLIC TLS struct _glapi_table * _glapi_tls_Dispatch = NULL;
+PUBLIC TLS struct _glapi_table *_glapi_tls_Dispatch = NULL;
-PUBLIC TLS void * _glapi_tls_Context;
+PUBLIC TLS void *_glapi_tls_Context;
PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL;
PUBLIC const void *_glapi_Context = NULL;
@@ -100,20 +100,21 @@ _glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */
static _glthread_TSD ContextTSD; /**< Per-thread context pointer */
#if defined(WIN32_THREADS)
-void FreeTSD(_glthread_TSD *p);
-void FreeAllTSD(void)
+void FreeTSD(_glthread_TSD * p);
+void
+FreeAllTSD(void)
{
- FreeTSD(&_gl_DispatchTSD);
- FreeTSD(&ContextTSD);
+ FreeTSD(&_gl_DispatchTSD);
+ FreeTSD(&ContextTSD);
}
-#endif /* defined(WIN32_THREADS) */
+#endif /* defined(WIN32_THREADS) */
-#endif /* defined(THREADS) */
+#endif /* defined(THREADS) */
PUBLIC struct _glapi_table *_glapi_Dispatch = NULL;
PUBLIC void *_glapi_Context = NULL;
-#endif /* defined(GLX_USE_TLS) */
+#endif /* defined(GLX_USE_TLS) */
/*@}*/
/*
@@ -133,17 +134,15 @@ void
_glapi_set_context(void *context)
{
#if defined(GLX_USE_TLS)
- _glapi_tls_Context = context;
+ _glapi_tls_Context = context;
#elif defined(THREADS)
- _glthread_SetTSD(&ContextTSD, context);
- _glapi_Context = context;
+ _glthread_SetTSD(&ContextTSD, context);
+ _glapi_Context = context;
#else
- _glapi_Context = context;
+ _glapi_Context = context;
#endif
}
-
-
/**
* Get the current context pointer for this thread.
* The context pointer is an opaque type which should be cast from
@@ -153,14 +152,12 @@ void *
_glapi_get_context(void)
{
#if defined(GLX_USE_TLS)
- return _glapi_tls_Context;
+ return _glapi_tls_Context;
#else
- return _glapi_Context;
+ return _glapi_Context;
#endif
}
-
-
/**
* Set the global or per-thread dispatch table pointer.
*/
@@ -168,77 +165,74 @@ void
_glapi_set_dispatch(struct _glapi_table *dispatch)
{
#if defined(PTHREADS) || defined(GLX_USE_TLS)
- static pthread_once_t once_control = PTHREAD_ONCE_INIT;
- pthread_once( & once_control, init_glapi_relocs );
+ static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+
+ pthread_once(&once_control, init_glapi_relocs);
#endif
#if defined(GLX_USE_TLS)
- _glapi_tls_Dispatch = dispatch;
+ _glapi_tls_Dispatch = dispatch;
#elif defined(THREADS)
- _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch);
- _glapi_Dispatch = dispatch;
+ _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch);
+ _glapi_Dispatch = dispatch;
#else /*THREADS*/
- _glapi_Dispatch = dispatch;
+ _glapi_Dispatch = dispatch;
#endif /*THREADS*/
}
-
-
/**
* Return pointer to current dispatch table for calling thread.
*/
struct _glapi_table *
_glapi_get_dispatch(void)
{
- struct _glapi_table * api;
+ struct _glapi_table *api;
+
#if defined(GLX_USE_TLS)
- api = _glapi_tls_Dispatch;
+ api = _glapi_tls_Dispatch;
#else
- api = _glapi_Dispatch;
+ api = _glapi_Dispatch;
#endif
- return api;
+ return api;
}
-
-
/***
*** The rest of this file is pretty much concerned with GetProcAddress
*** functionality.
***/
#if defined(USE_X64_64_ASM) && defined(GLX_USE_TLS)
-# define DISPATCH_FUNCTION_SIZE 16
+#define DISPATCH_FUNCTION_SIZE 16
#elif defined(USE_X86_ASM)
-# if defined(THREADS) && !defined(GLX_USE_TLS)
-# define DISPATCH_FUNCTION_SIZE 32
-# else
-# define DISPATCH_FUNCTION_SIZE 16
-# endif
+#if defined(THREADS) && !defined(GLX_USE_TLS)
+#define DISPATCH_FUNCTION_SIZE 32
+#else
+#define DISPATCH_FUNCTION_SIZE 16
+#endif
#endif
-
/* The code in this file is auto-generated with Python */
#include "glprocs.h"
-
/**
* Search the table of static entrypoint functions for the named function
* and return the corresponding glprocs_table_t entry.
*/
static const glprocs_table_t *
-find_entry( const char * n )
+find_entry(const char *n)
{
- GLuint i;
- for (i = 0; static_functions[i].Name_offset >= 0; i++) {
- const char *testName = gl_string_table + static_functions[i].Name_offset;
- if (strcmp(testName, n) == 0) {
- return &static_functions[i];
- }
- }
- return NULL;
+ GLuint i;
+
+ for (i = 0; static_functions[i].Name_offset >= 0; i++) {
+ const char *testName =
+ gl_string_table + static_functions[i].Name_offset;
+ if (strcmp(testName, n) == 0) {
+ return &static_functions[i];
+ }
+ }
+ return NULL;
}
-
/**
* Return dispatch table offset of the named static (built-in) function.
* Return -1 if function not found.
@@ -246,14 +240,13 @@ find_entry( const char * n )
static GLint
get_static_proc_offset(const char *funcName)
{
- const glprocs_table_t * const f = find_entry( funcName );
- if (f) {
- return f->Offset;
- }
- return -1;
-}
-
+ const glprocs_table_t *const f = find_entry(funcName);
+ if (f) {
+ return f->Offset;
+ }
+ return -1;
+}
/**********************************************************************
* Extension function management.
@@ -264,7 +257,6 @@ get_static_proc_offset(const char *funcName)
*/
#define MAX_EXTENSION_FUNCS 300
-
/*
* The dispatch table size (number of entries) is the size of the
* _glapi_table struct plus the number of dynamic entries we can add.
@@ -273,7 +265,6 @@ get_static_proc_offset(const char *funcName)
*/
#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS)
-
/**
* Track information about a function added to the GL API.
*/
@@ -281,7 +272,7 @@ struct _glapi_function {
/**
* Name of the function.
*/
- const char * name;
+ const char *name;
/**
* Text string that describes the types of the parameters passed to the
@@ -292,14 +283,14 @@ struct _glapi_function {
* - 'f' for \c GLfloat and \c GLclampf
* - 'd' for \c GLdouble and \c GLclampd
*/
- const char * parameter_signature;
+ const char *parameter_signature;
/**
* Offset in the dispatch table where the pointer to the real function is
* located. If the driver has not requested that the named function be
* added to the dispatch table, this will have the value ~0.
*/
- unsigned dispatch_offset;
+ unsigned dispatch_offset;
};
static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS];
@@ -319,22 +310,21 @@ static GLuint NumExtEntryPoints = 0;
*/
static struct _glapi_function *
-add_function_name( const char * funcName )
+add_function_name(const char *funcName)
{
- struct _glapi_function * entry = NULL;
-
- if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) {
- entry = &ExtEntryTable[NumExtEntryPoints];
-
- ExtEntryTable[NumExtEntryPoints].name = strdup(funcName);
- ExtEntryTable[NumExtEntryPoints].parameter_signature = NULL;
- ExtEntryTable[NumExtEntryPoints].dispatch_offset = ~0;
- NumExtEntryPoints++;
- }
-
- return entry;
-}
+ struct _glapi_function *entry = NULL;
+
+ if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) {
+ entry = &ExtEntryTable[NumExtEntryPoints];
+
+ ExtEntryTable[NumExtEntryPoints].name = strdup(funcName);
+ ExtEntryTable[NumExtEntryPoints].parameter_signature = NULL;
+ ExtEntryTable[NumExtEntryPoints].dispatch_offset = ~0;
+ NumExtEntryPoints++;
+ }
+ return entry;
+}
/**
* Fill-in the dispatch stub for the named function.
@@ -384,90 +374,91 @@ add_function_name( const char * funcName )
*/
PUBLIC int
-_glapi_add_dispatch( const char * const * function_names,
- const char * parameter_signature )
+_glapi_add_dispatch(const char *const *function_names,
+ const char *parameter_signature)
{
- static int next_dynamic_offset = FIRST_DYNAMIC_OFFSET;
- const char * const real_sig = (parameter_signature != NULL)
- ? parameter_signature : "";
- struct _glapi_function * entry[8];
- GLboolean is_static[8];
- unsigned i;
- unsigned j;
- int offset = ~0;
- int new_offset;
-
-
- (void) memset(is_static, 0, sizeof(is_static));
- (void) memset(entry, 0, sizeof(entry));
-
- for (i = 0 ; function_names[i] != NULL ; i++) {
- /* Do some trivial validation on the name of the function. */
-
- if (function_names[i][0] != 'g' || function_names[i][1] != 'l')
- return GL_FALSE;
-
- /* Determine if the named function already exists. If the function does
- * exist, it must have the same parameter signature as the function
- * being added.
- */
-
- new_offset = get_static_proc_offset(function_names[i]);
- if (new_offset >= 0) {
- /* FIXME: Make sure the parameter signatures match! How do we get
- * FIXME: the parameter signature for static functions?
- */
-
- if ((offset != ~0) && (new_offset != offset)) {
- return -1;
- }
-
- is_static[i] = GL_TRUE;
- offset = new_offset;
- }
-
- for (j = 0; j < NumExtEntryPoints; j++) {
- if (strcmp(ExtEntryTable[j].name, function_names[i]) == 0) {
- /* The offset may be ~0 if the function name was added by
- * glXGetProcAddress but never filled in by the driver.
- */
-
- if (ExtEntryTable[j].dispatch_offset != ~0) {
- if (strcmp(real_sig, ExtEntryTable[j].parameter_signature) != 0)
- return -1;
-
- if ((offset != ~0) && (ExtEntryTable[j].dispatch_offset != offset)) {
- return -1;
- }
-
- offset = ExtEntryTable[j].dispatch_offset;
- }
-
- entry[i] = & ExtEntryTable[j];
- break;
- }
- }
- }
-
- if (offset == ~0) {
- offset = next_dynamic_offset;
- next_dynamic_offset++;
- }
-
- for (i = 0 ; function_names[i] != NULL ; i++) {
- if (!is_static[i]) {
- if (entry[i] == NULL) {
- entry[i] = add_function_name(function_names[i]);
- if (entry[i] == NULL)
- return -1;
- }
-
- entry[i]->parameter_signature = strdup(real_sig);
- entry[i]->dispatch_offset = offset;
- }
- }
-
- return offset;
+ static int next_dynamic_offset = FIRST_DYNAMIC_OFFSET;
+ const char *const real_sig = (parameter_signature != NULL)
+ ? parameter_signature : "";
+ struct _glapi_function *entry[8];
+ GLboolean is_static[8];
+ unsigned i;
+ unsigned j;
+ int offset = ~0;
+ int new_offset;
+
+ (void) memset(is_static, 0, sizeof(is_static));
+ (void) memset(entry, 0, sizeof(entry));
+
+ for (i = 0; function_names[i] != NULL; i++) {
+ /* Do some trivial validation on the name of the function. */
+
+ if (function_names[i][0] != 'g' || function_names[i][1] != 'l')
+ return GL_FALSE;
+
+ /* Determine if the named function already exists. If the function does
+ * exist, it must have the same parameter signature as the function
+ * being added.
+ */
+
+ new_offset = get_static_proc_offset(function_names[i]);
+ if (new_offset >= 0) {
+ /* FIXME: Make sure the parameter signatures match! How do we get
+ * FIXME: the parameter signature for static functions?
+ */
+
+ if ((offset != ~0) && (new_offset != offset)) {
+ return -1;
+ }
+
+ is_static[i] = GL_TRUE;
+ offset = new_offset;
+ }
+
+ for (j = 0; j < NumExtEntryPoints; j++) {
+ if (strcmp(ExtEntryTable[j].name, function_names[i]) == 0) {
+ /* The offset may be ~0 if the function name was added by
+ * glXGetProcAddress but never filled in by the driver.
+ */
+
+ if (ExtEntryTable[j].dispatch_offset != ~0) {
+ if (strcmp(real_sig, ExtEntryTable[j].parameter_signature)
+ != 0)
+ return -1;
+
+ if ((offset != ~0) &&
+ (ExtEntryTable[j].dispatch_offset != offset)) {
+ return -1;
+ }
+
+ offset = ExtEntryTable[j].dispatch_offset;
+ }
+
+ entry[i] = &ExtEntryTable[j];
+ break;
+ }
+ }
+ }
+
+ if (offset == ~0) {
+ offset = next_dynamic_offset;
+ next_dynamic_offset++;
+ }
+
+ for (i = 0; function_names[i] != NULL; i++) {
+ if (!is_static[i]) {
+ if (entry[i] == NULL) {
+ entry[i] = add_function_name(function_names[i]);
+ if (entry[i] == NULL)
+ return -1;
+ }
+
+ entry[i]->parameter_signature = strdup(real_sig);
+ entry[i]->dispatch_offset = offset;
+ }
+ }
+
+ return offset;
}
/*
@@ -488,7 +479,7 @@ _glapi_get_proc_address(const char *funcName)
GLuint
_glapi_get_dispatch_table_size(void)
{
- return DISPATCH_TABLE_SIZE;
+ return DISPATCH_TABLE_SIZE;
}
#if defined(PTHREADS) || defined(GLX_USE_TLS)
@@ -496,22 +487,23 @@ _glapi_get_dispatch_table_size(void)
* Perform platform-specific GL API entry-point fixups.
*/
static void
-init_glapi_relocs( void )
+init_glapi_relocs(void)
{
#if defined(USE_X86_ASM) && defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT)
extern unsigned long _x86_get_dispatch(void);
+
char run_time_patch[] = {
- 0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
+ 0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
};
- GLuint *offset = (GLuint *) &run_time_patch[2]; /* 32-bits for x86/32 */
- const GLubyte * const get_disp = (const GLubyte *) run_time_patch;
- GLubyte * curr_func = (GLubyte *) gl_dispatch_functions_start;
+ GLuint *offset = (GLuint *) & run_time_patch[2]; /* 32-bits for x86/32 */
+ const GLubyte *const get_disp = (const GLubyte *) run_time_patch;
+ GLubyte *curr_func = (GLubyte *) gl_dispatch_functions_start;
*offset = _x86_get_dispatch();
- while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) {
- (void) memcpy( curr_func, get_disp, sizeof(run_time_patch));
- curr_func += DISPATCH_FUNCTION_SIZE;
+ while (curr_func != (GLubyte *) gl_dispatch_functions_end) {
+ (void) memcpy(curr_func, get_disp, sizeof(run_time_patch));
+ curr_func += DISPATCH_FUNCTION_SIZE;
}
#endif
}
-#endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */
+#endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */
diff --git a/xorg-server/glx/glapi_gentable.c b/xorg-server/glx/glapi_gentable.c
index abb0d0109..fd9fe33b2 100644
--- a/xorg-server/glx/glapi_gentable.c
+++ b/xorg-server/glx/glapi_gentable.c
@@ -1,9516 +1,9516 @@
-/* DO NOT EDIT - This file generated automatically by gl_gen_table.py (from Mesa) script */
-
-/*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- * (C) Copyright IBM Corporation 2004, 2005
- * (C) Copyright Apple Inc 2011
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL, IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* GLXEXT is the define used in the xserver when the GLX extension is being
- * built. Hijack this to determine whether this file is being built for the
- * server or the client.
- */
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \
- || (!defined(GLXEXT) && defined(DEBUG) && !defined(_WIN32_WCE))
-#define USE_BACKTRACE
-#endif
-
-#ifdef USE_BACKTRACE
-#include <execinfo.h>
-#endif
-
-#include <dlfcn.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <GL/gl.h>
-
-#include "glapi.h"
-#include "glapitable.h"
-
-#ifdef GLXEXT
-#include "os.h"
-#endif
-
-static void
-__glapi_gentable_NoOp(void) {
- const char *fstr = "Unknown";
-
- /* Silence potential GCC warning for some #ifdef paths.
- */
- (void) fstr;
-#if defined(USE_BACKTRACE)
-#if !defined(GLXEXT)
- if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
-#endif
- {
- void *frames[2];
-
- if(backtrace(frames, 2) == 2) {
- Dl_info info;
- dladdr(frames[1], &info);
- if(info.dli_sname)
- fstr = info.dli_sname;
- }
-
-#if !defined(GLXEXT)
- fprintf(stderr, "Call to unimplemented API: %s\n", fstr);
-#endif
- }
-#endif
-#if defined(GLXEXT)
- LogMessage(X_ERROR, "GLX: Call to unimplemented API: %s\n", fstr);
-#endif
-}
-
-static void
-__glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
- GLuint entries = _glapi_get_dispatch_table_size();
- void **dispatch = (void **) disp;
- int i;
-
- /* ISO C is annoying sometimes */
- union {_glapi_proc p; void *v;} p;
- p.p = __glapi_gentable_NoOp;
-
- for(i=0; i < entries; i++)
- if(dispatch[i] == NULL)
- dispatch[i] = p.v;
-}
-
-struct _glapi_table *
-_glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
- struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table));
- char symboln[512];
-
- if(!disp)
- return NULL;
-
- if(symbol_prefix == NULL)
- symbol_prefix = "";
-
-
- if(!disp->NewList) {
- void ** procp = (void **) &disp->NewList;
- snprintf(symboln, sizeof(symboln), "%sNewList", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EndList) {
- void ** procp = (void **) &disp->EndList;
- snprintf(symboln, sizeof(symboln), "%sEndList", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CallList) {
- void ** procp = (void **) &disp->CallList;
- snprintf(symboln, sizeof(symboln), "%sCallList", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CallLists) {
- void ** procp = (void **) &disp->CallLists;
- snprintf(symboln, sizeof(symboln), "%sCallLists", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteLists) {
- void ** procp = (void **) &disp->DeleteLists;
- snprintf(symboln, sizeof(symboln), "%sDeleteLists", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenLists) {
- void ** procp = (void **) &disp->GenLists;
- snprintf(symboln, sizeof(symboln), "%sGenLists", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ListBase) {
- void ** procp = (void **) &disp->ListBase;
- snprintf(symboln, sizeof(symboln), "%sListBase", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Begin) {
- void ** procp = (void **) &disp->Begin;
- snprintf(symboln, sizeof(symboln), "%sBegin", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Bitmap) {
- void ** procp = (void **) &disp->Bitmap;
- snprintf(symboln, sizeof(symboln), "%sBitmap", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3b) {
- void ** procp = (void **) &disp->Color3b;
- snprintf(symboln, sizeof(symboln), "%sColor3b", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3bv) {
- void ** procp = (void **) &disp->Color3bv;
- snprintf(symboln, sizeof(symboln), "%sColor3bv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3d) {
- void ** procp = (void **) &disp->Color3d;
- snprintf(symboln, sizeof(symboln), "%sColor3d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3dv) {
- void ** procp = (void **) &disp->Color3dv;
- snprintf(symboln, sizeof(symboln), "%sColor3dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3f) {
- void ** procp = (void **) &disp->Color3f;
- snprintf(symboln, sizeof(symboln), "%sColor3f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3fv) {
- void ** procp = (void **) &disp->Color3fv;
- snprintf(symboln, sizeof(symboln), "%sColor3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3i) {
- void ** procp = (void **) &disp->Color3i;
- snprintf(symboln, sizeof(symboln), "%sColor3i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3iv) {
- void ** procp = (void **) &disp->Color3iv;
- snprintf(symboln, sizeof(symboln), "%sColor3iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3s) {
- void ** procp = (void **) &disp->Color3s;
- snprintf(symboln, sizeof(symboln), "%sColor3s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3sv) {
- void ** procp = (void **) &disp->Color3sv;
- snprintf(symboln, sizeof(symboln), "%sColor3sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3ub) {
- void ** procp = (void **) &disp->Color3ub;
- snprintf(symboln, sizeof(symboln), "%sColor3ub", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3ubv) {
- void ** procp = (void **) &disp->Color3ubv;
- snprintf(symboln, sizeof(symboln), "%sColor3ubv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3ui) {
- void ** procp = (void **) &disp->Color3ui;
- snprintf(symboln, sizeof(symboln), "%sColor3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3uiv) {
- void ** procp = (void **) &disp->Color3uiv;
- snprintf(symboln, sizeof(symboln), "%sColor3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3us) {
- void ** procp = (void **) &disp->Color3us;
- snprintf(symboln, sizeof(symboln), "%sColor3us", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color3usv) {
- void ** procp = (void **) &disp->Color3usv;
- snprintf(symboln, sizeof(symboln), "%sColor3usv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4b) {
- void ** procp = (void **) &disp->Color4b;
- snprintf(symboln, sizeof(symboln), "%sColor4b", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4bv) {
- void ** procp = (void **) &disp->Color4bv;
- snprintf(symboln, sizeof(symboln), "%sColor4bv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4d) {
- void ** procp = (void **) &disp->Color4d;
- snprintf(symboln, sizeof(symboln), "%sColor4d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4dv) {
- void ** procp = (void **) &disp->Color4dv;
- snprintf(symboln, sizeof(symboln), "%sColor4dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4f) {
- void ** procp = (void **) &disp->Color4f;
- snprintf(symboln, sizeof(symboln), "%sColor4f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4fv) {
- void ** procp = (void **) &disp->Color4fv;
- snprintf(symboln, sizeof(symboln), "%sColor4fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4i) {
- void ** procp = (void **) &disp->Color4i;
- snprintf(symboln, sizeof(symboln), "%sColor4i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4iv) {
- void ** procp = (void **) &disp->Color4iv;
- snprintf(symboln, sizeof(symboln), "%sColor4iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4s) {
- void ** procp = (void **) &disp->Color4s;
- snprintf(symboln, sizeof(symboln), "%sColor4s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4sv) {
- void ** procp = (void **) &disp->Color4sv;
- snprintf(symboln, sizeof(symboln), "%sColor4sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4ub) {
- void ** procp = (void **) &disp->Color4ub;
- snprintf(symboln, sizeof(symboln), "%sColor4ub", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4ubv) {
- void ** procp = (void **) &disp->Color4ubv;
- snprintf(symboln, sizeof(symboln), "%sColor4ubv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4ui) {
- void ** procp = (void **) &disp->Color4ui;
- snprintf(symboln, sizeof(symboln), "%sColor4ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4uiv) {
- void ** procp = (void **) &disp->Color4uiv;
- snprintf(symboln, sizeof(symboln), "%sColor4uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4us) {
- void ** procp = (void **) &disp->Color4us;
- snprintf(symboln, sizeof(symboln), "%sColor4us", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Color4usv) {
- void ** procp = (void **) &disp->Color4usv;
- snprintf(symboln, sizeof(symboln), "%sColor4usv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EdgeFlag) {
- void ** procp = (void **) &disp->EdgeFlag;
- snprintf(symboln, sizeof(symboln), "%sEdgeFlag", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EdgeFlagv) {
- void ** procp = (void **) &disp->EdgeFlagv;
- snprintf(symboln, sizeof(symboln), "%sEdgeFlagv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->End) {
- void ** procp = (void **) &disp->End;
- snprintf(symboln, sizeof(symboln), "%sEnd", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Indexd) {
- void ** procp = (void **) &disp->Indexd;
- snprintf(symboln, sizeof(symboln), "%sIndexd", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Indexdv) {
- void ** procp = (void **) &disp->Indexdv;
- snprintf(symboln, sizeof(symboln), "%sIndexdv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Indexf) {
- void ** procp = (void **) &disp->Indexf;
- snprintf(symboln, sizeof(symboln), "%sIndexf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Indexfv) {
- void ** procp = (void **) &disp->Indexfv;
- snprintf(symboln, sizeof(symboln), "%sIndexfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Indexi) {
- void ** procp = (void **) &disp->Indexi;
- snprintf(symboln, sizeof(symboln), "%sIndexi", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Indexiv) {
- void ** procp = (void **) &disp->Indexiv;
- snprintf(symboln, sizeof(symboln), "%sIndexiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Indexs) {
- void ** procp = (void **) &disp->Indexs;
- snprintf(symboln, sizeof(symboln), "%sIndexs", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Indexsv) {
- void ** procp = (void **) &disp->Indexsv;
- snprintf(symboln, sizeof(symboln), "%sIndexsv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Normal3b) {
- void ** procp = (void **) &disp->Normal3b;
- snprintf(symboln, sizeof(symboln), "%sNormal3b", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Normal3bv) {
- void ** procp = (void **) &disp->Normal3bv;
- snprintf(symboln, sizeof(symboln), "%sNormal3bv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Normal3d) {
- void ** procp = (void **) &disp->Normal3d;
- snprintf(symboln, sizeof(symboln), "%sNormal3d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Normal3dv) {
- void ** procp = (void **) &disp->Normal3dv;
- snprintf(symboln, sizeof(symboln), "%sNormal3dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Normal3f) {
- void ** procp = (void **) &disp->Normal3f;
- snprintf(symboln, sizeof(symboln), "%sNormal3f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Normal3fv) {
- void ** procp = (void **) &disp->Normal3fv;
- snprintf(symboln, sizeof(symboln), "%sNormal3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Normal3i) {
- void ** procp = (void **) &disp->Normal3i;
- snprintf(symboln, sizeof(symboln), "%sNormal3i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Normal3iv) {
- void ** procp = (void **) &disp->Normal3iv;
- snprintf(symboln, sizeof(symboln), "%sNormal3iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Normal3s) {
- void ** procp = (void **) &disp->Normal3s;
- snprintf(symboln, sizeof(symboln), "%sNormal3s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Normal3sv) {
- void ** procp = (void **) &disp->Normal3sv;
- snprintf(symboln, sizeof(symboln), "%sNormal3sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos2d) {
- void ** procp = (void **) &disp->RasterPos2d;
- snprintf(symboln, sizeof(symboln), "%sRasterPos2d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos2dv) {
- void ** procp = (void **) &disp->RasterPos2dv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos2dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos2f) {
- void ** procp = (void **) &disp->RasterPos2f;
- snprintf(symboln, sizeof(symboln), "%sRasterPos2f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos2fv) {
- void ** procp = (void **) &disp->RasterPos2fv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos2i) {
- void ** procp = (void **) &disp->RasterPos2i;
- snprintf(symboln, sizeof(symboln), "%sRasterPos2i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos2iv) {
- void ** procp = (void **) &disp->RasterPos2iv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos2iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos2s) {
- void ** procp = (void **) &disp->RasterPos2s;
- snprintf(symboln, sizeof(symboln), "%sRasterPos2s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos2sv) {
- void ** procp = (void **) &disp->RasterPos2sv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos2sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos3d) {
- void ** procp = (void **) &disp->RasterPos3d;
- snprintf(symboln, sizeof(symboln), "%sRasterPos3d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos3dv) {
- void ** procp = (void **) &disp->RasterPos3dv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos3dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos3f) {
- void ** procp = (void **) &disp->RasterPos3f;
- snprintf(symboln, sizeof(symboln), "%sRasterPos3f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos3fv) {
- void ** procp = (void **) &disp->RasterPos3fv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos3i) {
- void ** procp = (void **) &disp->RasterPos3i;
- snprintf(symboln, sizeof(symboln), "%sRasterPos3i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos3iv) {
- void ** procp = (void **) &disp->RasterPos3iv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos3iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos3s) {
- void ** procp = (void **) &disp->RasterPos3s;
- snprintf(symboln, sizeof(symboln), "%sRasterPos3s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos3sv) {
- void ** procp = (void **) &disp->RasterPos3sv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos3sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos4d) {
- void ** procp = (void **) &disp->RasterPos4d;
- snprintf(symboln, sizeof(symboln), "%sRasterPos4d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos4dv) {
- void ** procp = (void **) &disp->RasterPos4dv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos4dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos4f) {
- void ** procp = (void **) &disp->RasterPos4f;
- snprintf(symboln, sizeof(symboln), "%sRasterPos4f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos4fv) {
- void ** procp = (void **) &disp->RasterPos4fv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos4fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos4i) {
- void ** procp = (void **) &disp->RasterPos4i;
- snprintf(symboln, sizeof(symboln), "%sRasterPos4i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos4iv) {
- void ** procp = (void **) &disp->RasterPos4iv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos4iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos4s) {
- void ** procp = (void **) &disp->RasterPos4s;
- snprintf(symboln, sizeof(symboln), "%sRasterPos4s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RasterPos4sv) {
- void ** procp = (void **) &disp->RasterPos4sv;
- snprintf(symboln, sizeof(symboln), "%sRasterPos4sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Rectd) {
- void ** procp = (void **) &disp->Rectd;
- snprintf(symboln, sizeof(symboln), "%sRectd", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Rectdv) {
- void ** procp = (void **) &disp->Rectdv;
- snprintf(symboln, sizeof(symboln), "%sRectdv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Rectf) {
- void ** procp = (void **) &disp->Rectf;
- snprintf(symboln, sizeof(symboln), "%sRectf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Rectfv) {
- void ** procp = (void **) &disp->Rectfv;
- snprintf(symboln, sizeof(symboln), "%sRectfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Recti) {
- void ** procp = (void **) &disp->Recti;
- snprintf(symboln, sizeof(symboln), "%sRecti", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Rectiv) {
- void ** procp = (void **) &disp->Rectiv;
- snprintf(symboln, sizeof(symboln), "%sRectiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Rects) {
- void ** procp = (void **) &disp->Rects;
- snprintf(symboln, sizeof(symboln), "%sRects", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Rectsv) {
- void ** procp = (void **) &disp->Rectsv;
- snprintf(symboln, sizeof(symboln), "%sRectsv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord1d) {
- void ** procp = (void **) &disp->TexCoord1d;
- snprintf(symboln, sizeof(symboln), "%sTexCoord1d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord1dv) {
- void ** procp = (void **) &disp->TexCoord1dv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord1dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord1f) {
- void ** procp = (void **) &disp->TexCoord1f;
- snprintf(symboln, sizeof(symboln), "%sTexCoord1f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord1fv) {
- void ** procp = (void **) &disp->TexCoord1fv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord1fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord1i) {
- void ** procp = (void **) &disp->TexCoord1i;
- snprintf(symboln, sizeof(symboln), "%sTexCoord1i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord1iv) {
- void ** procp = (void **) &disp->TexCoord1iv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord1iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord1s) {
- void ** procp = (void **) &disp->TexCoord1s;
- snprintf(symboln, sizeof(symboln), "%sTexCoord1s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord1sv) {
- void ** procp = (void **) &disp->TexCoord1sv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord1sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord2d) {
- void ** procp = (void **) &disp->TexCoord2d;
- snprintf(symboln, sizeof(symboln), "%sTexCoord2d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord2dv) {
- void ** procp = (void **) &disp->TexCoord2dv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord2dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord2f) {
- void ** procp = (void **) &disp->TexCoord2f;
- snprintf(symboln, sizeof(symboln), "%sTexCoord2f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord2fv) {
- void ** procp = (void **) &disp->TexCoord2fv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord2i) {
- void ** procp = (void **) &disp->TexCoord2i;
- snprintf(symboln, sizeof(symboln), "%sTexCoord2i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord2iv) {
- void ** procp = (void **) &disp->TexCoord2iv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord2iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord2s) {
- void ** procp = (void **) &disp->TexCoord2s;
- snprintf(symboln, sizeof(symboln), "%sTexCoord2s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord2sv) {
- void ** procp = (void **) &disp->TexCoord2sv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord2sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord3d) {
- void ** procp = (void **) &disp->TexCoord3d;
- snprintf(symboln, sizeof(symboln), "%sTexCoord3d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord3dv) {
- void ** procp = (void **) &disp->TexCoord3dv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord3dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord3f) {
- void ** procp = (void **) &disp->TexCoord3f;
- snprintf(symboln, sizeof(symboln), "%sTexCoord3f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord3fv) {
- void ** procp = (void **) &disp->TexCoord3fv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord3i) {
- void ** procp = (void **) &disp->TexCoord3i;
- snprintf(symboln, sizeof(symboln), "%sTexCoord3i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord3iv) {
- void ** procp = (void **) &disp->TexCoord3iv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord3iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord3s) {
- void ** procp = (void **) &disp->TexCoord3s;
- snprintf(symboln, sizeof(symboln), "%sTexCoord3s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord3sv) {
- void ** procp = (void **) &disp->TexCoord3sv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord3sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord4d) {
- void ** procp = (void **) &disp->TexCoord4d;
- snprintf(symboln, sizeof(symboln), "%sTexCoord4d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord4dv) {
- void ** procp = (void **) &disp->TexCoord4dv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord4dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord4f) {
- void ** procp = (void **) &disp->TexCoord4f;
- snprintf(symboln, sizeof(symboln), "%sTexCoord4f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord4fv) {
- void ** procp = (void **) &disp->TexCoord4fv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord4fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord4i) {
- void ** procp = (void **) &disp->TexCoord4i;
- snprintf(symboln, sizeof(symboln), "%sTexCoord4i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord4iv) {
- void ** procp = (void **) &disp->TexCoord4iv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord4iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord4s) {
- void ** procp = (void **) &disp->TexCoord4s;
- snprintf(symboln, sizeof(symboln), "%sTexCoord4s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoord4sv) {
- void ** procp = (void **) &disp->TexCoord4sv;
- snprintf(symboln, sizeof(symboln), "%sTexCoord4sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex2d) {
- void ** procp = (void **) &disp->Vertex2d;
- snprintf(symboln, sizeof(symboln), "%sVertex2d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex2dv) {
- void ** procp = (void **) &disp->Vertex2dv;
- snprintf(symboln, sizeof(symboln), "%sVertex2dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex2f) {
- void ** procp = (void **) &disp->Vertex2f;
- snprintf(symboln, sizeof(symboln), "%sVertex2f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex2fv) {
- void ** procp = (void **) &disp->Vertex2fv;
- snprintf(symboln, sizeof(symboln), "%sVertex2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex2i) {
- void ** procp = (void **) &disp->Vertex2i;
- snprintf(symboln, sizeof(symboln), "%sVertex2i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex2iv) {
- void ** procp = (void **) &disp->Vertex2iv;
- snprintf(symboln, sizeof(symboln), "%sVertex2iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex2s) {
- void ** procp = (void **) &disp->Vertex2s;
- snprintf(symboln, sizeof(symboln), "%sVertex2s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex2sv) {
- void ** procp = (void **) &disp->Vertex2sv;
- snprintf(symboln, sizeof(symboln), "%sVertex2sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex3d) {
- void ** procp = (void **) &disp->Vertex3d;
- snprintf(symboln, sizeof(symboln), "%sVertex3d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex3dv) {
- void ** procp = (void **) &disp->Vertex3dv;
- snprintf(symboln, sizeof(symboln), "%sVertex3dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex3f) {
- void ** procp = (void **) &disp->Vertex3f;
- snprintf(symboln, sizeof(symboln), "%sVertex3f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex3fv) {
- void ** procp = (void **) &disp->Vertex3fv;
- snprintf(symboln, sizeof(symboln), "%sVertex3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex3i) {
- void ** procp = (void **) &disp->Vertex3i;
- snprintf(symboln, sizeof(symboln), "%sVertex3i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex3iv) {
- void ** procp = (void **) &disp->Vertex3iv;
- snprintf(symboln, sizeof(symboln), "%sVertex3iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex3s) {
- void ** procp = (void **) &disp->Vertex3s;
- snprintf(symboln, sizeof(symboln), "%sVertex3s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex3sv) {
- void ** procp = (void **) &disp->Vertex3sv;
- snprintf(symboln, sizeof(symboln), "%sVertex3sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex4d) {
- void ** procp = (void **) &disp->Vertex4d;
- snprintf(symboln, sizeof(symboln), "%sVertex4d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex4dv) {
- void ** procp = (void **) &disp->Vertex4dv;
- snprintf(symboln, sizeof(symboln), "%sVertex4dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex4f) {
- void ** procp = (void **) &disp->Vertex4f;
- snprintf(symboln, sizeof(symboln), "%sVertex4f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex4fv) {
- void ** procp = (void **) &disp->Vertex4fv;
- snprintf(symboln, sizeof(symboln), "%sVertex4fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex4i) {
- void ** procp = (void **) &disp->Vertex4i;
- snprintf(symboln, sizeof(symboln), "%sVertex4i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex4iv) {
- void ** procp = (void **) &disp->Vertex4iv;
- snprintf(symboln, sizeof(symboln), "%sVertex4iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex4s) {
- void ** procp = (void **) &disp->Vertex4s;
- snprintf(symboln, sizeof(symboln), "%sVertex4s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Vertex4sv) {
- void ** procp = (void **) &disp->Vertex4sv;
- snprintf(symboln, sizeof(symboln), "%sVertex4sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClipPlane) {
- void ** procp = (void **) &disp->ClipPlane;
- snprintf(symboln, sizeof(symboln), "%sClipPlane", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorMaterial) {
- void ** procp = (void **) &disp->ColorMaterial;
- snprintf(symboln, sizeof(symboln), "%sColorMaterial", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CullFace) {
- void ** procp = (void **) &disp->CullFace;
- snprintf(symboln, sizeof(symboln), "%sCullFace", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Fogf) {
- void ** procp = (void **) &disp->Fogf;
- snprintf(symboln, sizeof(symboln), "%sFogf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Fogfv) {
- void ** procp = (void **) &disp->Fogfv;
- snprintf(symboln, sizeof(symboln), "%sFogfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Fogi) {
- void ** procp = (void **) &disp->Fogi;
- snprintf(symboln, sizeof(symboln), "%sFogi", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Fogiv) {
- void ** procp = (void **) &disp->Fogiv;
- snprintf(symboln, sizeof(symboln), "%sFogiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FrontFace) {
- void ** procp = (void **) &disp->FrontFace;
- snprintf(symboln, sizeof(symboln), "%sFrontFace", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Hint) {
- void ** procp = (void **) &disp->Hint;
- snprintf(symboln, sizeof(symboln), "%sHint", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Lightf) {
- void ** procp = (void **) &disp->Lightf;
- snprintf(symboln, sizeof(symboln), "%sLightf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Lightfv) {
- void ** procp = (void **) &disp->Lightfv;
- snprintf(symboln, sizeof(symboln), "%sLightfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Lighti) {
- void ** procp = (void **) &disp->Lighti;
- snprintf(symboln, sizeof(symboln), "%sLighti", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Lightiv) {
- void ** procp = (void **) &disp->Lightiv;
- snprintf(symboln, sizeof(symboln), "%sLightiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LightModelf) {
- void ** procp = (void **) &disp->LightModelf;
- snprintf(symboln, sizeof(symboln), "%sLightModelf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LightModelfv) {
- void ** procp = (void **) &disp->LightModelfv;
- snprintf(symboln, sizeof(symboln), "%sLightModelfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LightModeli) {
- void ** procp = (void **) &disp->LightModeli;
- snprintf(symboln, sizeof(symboln), "%sLightModeli", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LightModeliv) {
- void ** procp = (void **) &disp->LightModeliv;
- snprintf(symboln, sizeof(symboln), "%sLightModeliv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LineStipple) {
- void ** procp = (void **) &disp->LineStipple;
- snprintf(symboln, sizeof(symboln), "%sLineStipple", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LineWidth) {
- void ** procp = (void **) &disp->LineWidth;
- snprintf(symboln, sizeof(symboln), "%sLineWidth", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Materialf) {
- void ** procp = (void **) &disp->Materialf;
- snprintf(symboln, sizeof(symboln), "%sMaterialf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Materialfv) {
- void ** procp = (void **) &disp->Materialfv;
- snprintf(symboln, sizeof(symboln), "%sMaterialfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Materiali) {
- void ** procp = (void **) &disp->Materiali;
- snprintf(symboln, sizeof(symboln), "%sMateriali", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Materialiv) {
- void ** procp = (void **) &disp->Materialiv;
- snprintf(symboln, sizeof(symboln), "%sMaterialiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointSize) {
- void ** procp = (void **) &disp->PointSize;
- snprintf(symboln, sizeof(symboln), "%sPointSize", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PolygonMode) {
- void ** procp = (void **) &disp->PolygonMode;
- snprintf(symboln, sizeof(symboln), "%sPolygonMode", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PolygonStipple) {
- void ** procp = (void **) &disp->PolygonStipple;
- snprintf(symboln, sizeof(symboln), "%sPolygonStipple", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Scissor) {
- void ** procp = (void **) &disp->Scissor;
- snprintf(symboln, sizeof(symboln), "%sScissor", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ShadeModel) {
- void ** procp = (void **) &disp->ShadeModel;
- snprintf(symboln, sizeof(symboln), "%sShadeModel", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexParameterf) {
- void ** procp = (void **) &disp->TexParameterf;
- snprintf(symboln, sizeof(symboln), "%sTexParameterf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexParameterfv) {
- void ** procp = (void **) &disp->TexParameterfv;
- snprintf(symboln, sizeof(symboln), "%sTexParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexParameteri) {
- void ** procp = (void **) &disp->TexParameteri;
- snprintf(symboln, sizeof(symboln), "%sTexParameteri", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexParameteriv) {
- void ** procp = (void **) &disp->TexParameteriv;
- snprintf(symboln, sizeof(symboln), "%sTexParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexImage1D) {
- void ** procp = (void **) &disp->TexImage1D;
- snprintf(symboln, sizeof(symboln), "%sTexImage1D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexImage2D) {
- void ** procp = (void **) &disp->TexImage2D;
- snprintf(symboln, sizeof(symboln), "%sTexImage2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexEnvf) {
- void ** procp = (void **) &disp->TexEnvf;
- snprintf(symboln, sizeof(symboln), "%sTexEnvf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexEnvfv) {
- void ** procp = (void **) &disp->TexEnvfv;
- snprintf(symboln, sizeof(symboln), "%sTexEnvfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexEnvi) {
- void ** procp = (void **) &disp->TexEnvi;
- snprintf(symboln, sizeof(symboln), "%sTexEnvi", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexEnviv) {
- void ** procp = (void **) &disp->TexEnviv;
- snprintf(symboln, sizeof(symboln), "%sTexEnviv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexGend) {
- void ** procp = (void **) &disp->TexGend;
- snprintf(symboln, sizeof(symboln), "%sTexGend", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexGendv) {
- void ** procp = (void **) &disp->TexGendv;
- snprintf(symboln, sizeof(symboln), "%sTexGendv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexGenf) {
- void ** procp = (void **) &disp->TexGenf;
- snprintf(symboln, sizeof(symboln), "%sTexGenf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexGenfv) {
- void ** procp = (void **) &disp->TexGenfv;
- snprintf(symboln, sizeof(symboln), "%sTexGenfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexGeni) {
- void ** procp = (void **) &disp->TexGeni;
- snprintf(symboln, sizeof(symboln), "%sTexGeni", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexGeniv) {
- void ** procp = (void **) &disp->TexGeniv;
- snprintf(symboln, sizeof(symboln), "%sTexGeniv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FeedbackBuffer) {
- void ** procp = (void **) &disp->FeedbackBuffer;
- snprintf(symboln, sizeof(symboln), "%sFeedbackBuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SelectBuffer) {
- void ** procp = (void **) &disp->SelectBuffer;
- snprintf(symboln, sizeof(symboln), "%sSelectBuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RenderMode) {
- void ** procp = (void **) &disp->RenderMode;
- snprintf(symboln, sizeof(symboln), "%sRenderMode", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->InitNames) {
- void ** procp = (void **) &disp->InitNames;
- snprintf(symboln, sizeof(symboln), "%sInitNames", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LoadName) {
- void ** procp = (void **) &disp->LoadName;
- snprintf(symboln, sizeof(symboln), "%sLoadName", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PassThrough) {
- void ** procp = (void **) &disp->PassThrough;
- snprintf(symboln, sizeof(symboln), "%sPassThrough", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PopName) {
- void ** procp = (void **) &disp->PopName;
- snprintf(symboln, sizeof(symboln), "%sPopName", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PushName) {
- void ** procp = (void **) &disp->PushName;
- snprintf(symboln, sizeof(symboln), "%sPushName", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawBuffer) {
- void ** procp = (void **) &disp->DrawBuffer;
- snprintf(symboln, sizeof(symboln), "%sDrawBuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Clear) {
- void ** procp = (void **) &disp->Clear;
- snprintf(symboln, sizeof(symboln), "%sClear", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearAccum) {
- void ** procp = (void **) &disp->ClearAccum;
- snprintf(symboln, sizeof(symboln), "%sClearAccum", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearIndex) {
- void ** procp = (void **) &disp->ClearIndex;
- snprintf(symboln, sizeof(symboln), "%sClearIndex", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearColor) {
- void ** procp = (void **) &disp->ClearColor;
- snprintf(symboln, sizeof(symboln), "%sClearColor", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearStencil) {
- void ** procp = (void **) &disp->ClearStencil;
- snprintf(symboln, sizeof(symboln), "%sClearStencil", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearDepth) {
- void ** procp = (void **) &disp->ClearDepth;
- snprintf(symboln, sizeof(symboln), "%sClearDepth", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->StencilMask) {
- void ** procp = (void **) &disp->StencilMask;
- snprintf(symboln, sizeof(symboln), "%sStencilMask", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorMask) {
- void ** procp = (void **) &disp->ColorMask;
- snprintf(symboln, sizeof(symboln), "%sColorMask", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DepthMask) {
- void ** procp = (void **) &disp->DepthMask;
- snprintf(symboln, sizeof(symboln), "%sDepthMask", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IndexMask) {
- void ** procp = (void **) &disp->IndexMask;
- snprintf(symboln, sizeof(symboln), "%sIndexMask", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Accum) {
- void ** procp = (void **) &disp->Accum;
- snprintf(symboln, sizeof(symboln), "%sAccum", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Disable) {
- void ** procp = (void **) &disp->Disable;
- snprintf(symboln, sizeof(symboln), "%sDisable", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Enable) {
- void ** procp = (void **) &disp->Enable;
- snprintf(symboln, sizeof(symboln), "%sEnable", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Finish) {
- void ** procp = (void **) &disp->Finish;
- snprintf(symboln, sizeof(symboln), "%sFinish", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Flush) {
- void ** procp = (void **) &disp->Flush;
- snprintf(symboln, sizeof(symboln), "%sFlush", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PopAttrib) {
- void ** procp = (void **) &disp->PopAttrib;
- snprintf(symboln, sizeof(symboln), "%sPopAttrib", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PushAttrib) {
- void ** procp = (void **) &disp->PushAttrib;
- snprintf(symboln, sizeof(symboln), "%sPushAttrib", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Map1d) {
- void ** procp = (void **) &disp->Map1d;
- snprintf(symboln, sizeof(symboln), "%sMap1d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Map1f) {
- void ** procp = (void **) &disp->Map1f;
- snprintf(symboln, sizeof(symboln), "%sMap1f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Map2d) {
- void ** procp = (void **) &disp->Map2d;
- snprintf(symboln, sizeof(symboln), "%sMap2d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Map2f) {
- void ** procp = (void **) &disp->Map2f;
- snprintf(symboln, sizeof(symboln), "%sMap2f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MapGrid1d) {
- void ** procp = (void **) &disp->MapGrid1d;
- snprintf(symboln, sizeof(symboln), "%sMapGrid1d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MapGrid1f) {
- void ** procp = (void **) &disp->MapGrid1f;
- snprintf(symboln, sizeof(symboln), "%sMapGrid1f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MapGrid2d) {
- void ** procp = (void **) &disp->MapGrid2d;
- snprintf(symboln, sizeof(symboln), "%sMapGrid2d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MapGrid2f) {
- void ** procp = (void **) &disp->MapGrid2f;
- snprintf(symboln, sizeof(symboln), "%sMapGrid2f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalCoord1d) {
- void ** procp = (void **) &disp->EvalCoord1d;
- snprintf(symboln, sizeof(symboln), "%sEvalCoord1d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalCoord1dv) {
- void ** procp = (void **) &disp->EvalCoord1dv;
- snprintf(symboln, sizeof(symboln), "%sEvalCoord1dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalCoord1f) {
- void ** procp = (void **) &disp->EvalCoord1f;
- snprintf(symboln, sizeof(symboln), "%sEvalCoord1f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalCoord1fv) {
- void ** procp = (void **) &disp->EvalCoord1fv;
- snprintf(symboln, sizeof(symboln), "%sEvalCoord1fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalCoord2d) {
- void ** procp = (void **) &disp->EvalCoord2d;
- snprintf(symboln, sizeof(symboln), "%sEvalCoord2d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalCoord2dv) {
- void ** procp = (void **) &disp->EvalCoord2dv;
- snprintf(symboln, sizeof(symboln), "%sEvalCoord2dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalCoord2f) {
- void ** procp = (void **) &disp->EvalCoord2f;
- snprintf(symboln, sizeof(symboln), "%sEvalCoord2f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalCoord2fv) {
- void ** procp = (void **) &disp->EvalCoord2fv;
- snprintf(symboln, sizeof(symboln), "%sEvalCoord2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalMesh1) {
- void ** procp = (void **) &disp->EvalMesh1;
- snprintf(symboln, sizeof(symboln), "%sEvalMesh1", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalPoint1) {
- void ** procp = (void **) &disp->EvalPoint1;
- snprintf(symboln, sizeof(symboln), "%sEvalPoint1", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalMesh2) {
- void ** procp = (void **) &disp->EvalMesh2;
- snprintf(symboln, sizeof(symboln), "%sEvalMesh2", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EvalPoint2) {
- void ** procp = (void **) &disp->EvalPoint2;
- snprintf(symboln, sizeof(symboln), "%sEvalPoint2", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->AlphaFunc) {
- void ** procp = (void **) &disp->AlphaFunc;
- snprintf(symboln, sizeof(symboln), "%sAlphaFunc", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendFunc) {
- void ** procp = (void **) &disp->BlendFunc;
- snprintf(symboln, sizeof(symboln), "%sBlendFunc", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LogicOp) {
- void ** procp = (void **) &disp->LogicOp;
- snprintf(symboln, sizeof(symboln), "%sLogicOp", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->StencilFunc) {
- void ** procp = (void **) &disp->StencilFunc;
- snprintf(symboln, sizeof(symboln), "%sStencilFunc", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->StencilOp) {
- void ** procp = (void **) &disp->StencilOp;
- snprintf(symboln, sizeof(symboln), "%sStencilOp", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DepthFunc) {
- void ** procp = (void **) &disp->DepthFunc;
- snprintf(symboln, sizeof(symboln), "%sDepthFunc", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelZoom) {
- void ** procp = (void **) &disp->PixelZoom;
- snprintf(symboln, sizeof(symboln), "%sPixelZoom", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelTransferf) {
- void ** procp = (void **) &disp->PixelTransferf;
- snprintf(symboln, sizeof(symboln), "%sPixelTransferf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelTransferi) {
- void ** procp = (void **) &disp->PixelTransferi;
- snprintf(symboln, sizeof(symboln), "%sPixelTransferi", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelStoref) {
- void ** procp = (void **) &disp->PixelStoref;
- snprintf(symboln, sizeof(symboln), "%sPixelStoref", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelStorei) {
- void ** procp = (void **) &disp->PixelStorei;
- snprintf(symboln, sizeof(symboln), "%sPixelStorei", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelMapfv) {
- void ** procp = (void **) &disp->PixelMapfv;
- snprintf(symboln, sizeof(symboln), "%sPixelMapfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelMapuiv) {
- void ** procp = (void **) &disp->PixelMapuiv;
- snprintf(symboln, sizeof(symboln), "%sPixelMapuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelMapusv) {
- void ** procp = (void **) &disp->PixelMapusv;
- snprintf(symboln, sizeof(symboln), "%sPixelMapusv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ReadBuffer) {
- void ** procp = (void **) &disp->ReadBuffer;
- snprintf(symboln, sizeof(symboln), "%sReadBuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyPixels) {
- void ** procp = (void **) &disp->CopyPixels;
- snprintf(symboln, sizeof(symboln), "%sCopyPixels", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ReadPixels) {
- void ** procp = (void **) &disp->ReadPixels;
- snprintf(symboln, sizeof(symboln), "%sReadPixels", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawPixels) {
- void ** procp = (void **) &disp->DrawPixels;
- snprintf(symboln, sizeof(symboln), "%sDrawPixels", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetBooleanv) {
- void ** procp = (void **) &disp->GetBooleanv;
- snprintf(symboln, sizeof(symboln), "%sGetBooleanv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetClipPlane) {
- void ** procp = (void **) &disp->GetClipPlane;
- snprintf(symboln, sizeof(symboln), "%sGetClipPlane", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetDoublev) {
- void ** procp = (void **) &disp->GetDoublev;
- snprintf(symboln, sizeof(symboln), "%sGetDoublev", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetError) {
- void ** procp = (void **) &disp->GetError;
- snprintf(symboln, sizeof(symboln), "%sGetError", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetFloatv) {
- void ** procp = (void **) &disp->GetFloatv;
- snprintf(symboln, sizeof(symboln), "%sGetFloatv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetIntegerv) {
- void ** procp = (void **) &disp->GetIntegerv;
- snprintf(symboln, sizeof(symboln), "%sGetIntegerv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetLightfv) {
- void ** procp = (void **) &disp->GetLightfv;
- snprintf(symboln, sizeof(symboln), "%sGetLightfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetLightiv) {
- void ** procp = (void **) &disp->GetLightiv;
- snprintf(symboln, sizeof(symboln), "%sGetLightiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMapdv) {
- void ** procp = (void **) &disp->GetMapdv;
- snprintf(symboln, sizeof(symboln), "%sGetMapdv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMapfv) {
- void ** procp = (void **) &disp->GetMapfv;
- snprintf(symboln, sizeof(symboln), "%sGetMapfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMapiv) {
- void ** procp = (void **) &disp->GetMapiv;
- snprintf(symboln, sizeof(symboln), "%sGetMapiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMaterialfv) {
- void ** procp = (void **) &disp->GetMaterialfv;
- snprintf(symboln, sizeof(symboln), "%sGetMaterialfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMaterialiv) {
- void ** procp = (void **) &disp->GetMaterialiv;
- snprintf(symboln, sizeof(symboln), "%sGetMaterialiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetPixelMapfv) {
- void ** procp = (void **) &disp->GetPixelMapfv;
- snprintf(symboln, sizeof(symboln), "%sGetPixelMapfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetPixelMapuiv) {
- void ** procp = (void **) &disp->GetPixelMapuiv;
- snprintf(symboln, sizeof(symboln), "%sGetPixelMapuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetPixelMapusv) {
- void ** procp = (void **) &disp->GetPixelMapusv;
- snprintf(symboln, sizeof(symboln), "%sGetPixelMapusv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetPolygonStipple) {
- void ** procp = (void **) &disp->GetPolygonStipple;
- snprintf(symboln, sizeof(symboln), "%sGetPolygonStipple", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetString) {
- void ** procp = (void **) &disp->GetString;
- snprintf(symboln, sizeof(symboln), "%sGetString", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexEnvfv) {
- void ** procp = (void **) &disp->GetTexEnvfv;
- snprintf(symboln, sizeof(symboln), "%sGetTexEnvfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexEnviv) {
- void ** procp = (void **) &disp->GetTexEnviv;
- snprintf(symboln, sizeof(symboln), "%sGetTexEnviv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexGendv) {
- void ** procp = (void **) &disp->GetTexGendv;
- snprintf(symboln, sizeof(symboln), "%sGetTexGendv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexGenfv) {
- void ** procp = (void **) &disp->GetTexGenfv;
- snprintf(symboln, sizeof(symboln), "%sGetTexGenfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexGeniv) {
- void ** procp = (void **) &disp->GetTexGeniv;
- snprintf(symboln, sizeof(symboln), "%sGetTexGeniv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexImage) {
- void ** procp = (void **) &disp->GetTexImage;
- snprintf(symboln, sizeof(symboln), "%sGetTexImage", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexParameterfv) {
- void ** procp = (void **) &disp->GetTexParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetTexParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexParameteriv) {
- void ** procp = (void **) &disp->GetTexParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetTexParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexLevelParameterfv) {
- void ** procp = (void **) &disp->GetTexLevelParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetTexLevelParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexLevelParameteriv) {
- void ** procp = (void **) &disp->GetTexLevelParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetTexLevelParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsEnabled) {
- void ** procp = (void **) &disp->IsEnabled;
- snprintf(symboln, sizeof(symboln), "%sIsEnabled", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsList) {
- void ** procp = (void **) &disp->IsList;
- snprintf(symboln, sizeof(symboln), "%sIsList", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DepthRange) {
- void ** procp = (void **) &disp->DepthRange;
- snprintf(symboln, sizeof(symboln), "%sDepthRange", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Frustum) {
- void ** procp = (void **) &disp->Frustum;
- snprintf(symboln, sizeof(symboln), "%sFrustum", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LoadIdentity) {
- void ** procp = (void **) &disp->LoadIdentity;
- snprintf(symboln, sizeof(symboln), "%sLoadIdentity", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LoadMatrixf) {
- void ** procp = (void **) &disp->LoadMatrixf;
- snprintf(symboln, sizeof(symboln), "%sLoadMatrixf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LoadMatrixd) {
- void ** procp = (void **) &disp->LoadMatrixd;
- snprintf(symboln, sizeof(symboln), "%sLoadMatrixd", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MatrixMode) {
- void ** procp = (void **) &disp->MatrixMode;
- snprintf(symboln, sizeof(symboln), "%sMatrixMode", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultMatrixf) {
- void ** procp = (void **) &disp->MultMatrixf;
- snprintf(symboln, sizeof(symboln), "%sMultMatrixf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultMatrixd) {
- void ** procp = (void **) &disp->MultMatrixd;
- snprintf(symboln, sizeof(symboln), "%sMultMatrixd", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Ortho) {
- void ** procp = (void **) &disp->Ortho;
- snprintf(symboln, sizeof(symboln), "%sOrtho", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PopMatrix) {
- void ** procp = (void **) &disp->PopMatrix;
- snprintf(symboln, sizeof(symboln), "%sPopMatrix", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PushMatrix) {
- void ** procp = (void **) &disp->PushMatrix;
- snprintf(symboln, sizeof(symboln), "%sPushMatrix", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Rotated) {
- void ** procp = (void **) &disp->Rotated;
- snprintf(symboln, sizeof(symboln), "%sRotated", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Rotatef) {
- void ** procp = (void **) &disp->Rotatef;
- snprintf(symboln, sizeof(symboln), "%sRotatef", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Scaled) {
- void ** procp = (void **) &disp->Scaled;
- snprintf(symboln, sizeof(symboln), "%sScaled", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Scalef) {
- void ** procp = (void **) &disp->Scalef;
- snprintf(symboln, sizeof(symboln), "%sScalef", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Translated) {
- void ** procp = (void **) &disp->Translated;
- snprintf(symboln, sizeof(symboln), "%sTranslated", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Translatef) {
- void ** procp = (void **) &disp->Translatef;
- snprintf(symboln, sizeof(symboln), "%sTranslatef", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Viewport) {
- void ** procp = (void **) &disp->Viewport;
- snprintf(symboln, sizeof(symboln), "%sViewport", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ArrayElement) {
- void ** procp = (void **) &disp->ArrayElement;
- snprintf(symboln, sizeof(symboln), "%sArrayElement", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ArrayElement) {
- void ** procp = (void **) &disp->ArrayElement;
- snprintf(symboln, sizeof(symboln), "%sArrayElementEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindTexture) {
- void ** procp = (void **) &disp->BindTexture;
- snprintf(symboln, sizeof(symboln), "%sBindTexture", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindTexture) {
- void ** procp = (void **) &disp->BindTexture;
- snprintf(symboln, sizeof(symboln), "%sBindTextureEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorPointer) {
- void ** procp = (void **) &disp->ColorPointer;
- snprintf(symboln, sizeof(symboln), "%sColorPointer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DisableClientState) {
- void ** procp = (void **) &disp->DisableClientState;
- snprintf(symboln, sizeof(symboln), "%sDisableClientState", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawArrays) {
- void ** procp = (void **) &disp->DrawArrays;
- snprintf(symboln, sizeof(symboln), "%sDrawArrays", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawArrays) {
- void ** procp = (void **) &disp->DrawArrays;
- snprintf(symboln, sizeof(symboln), "%sDrawArraysEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawElements) {
- void ** procp = (void **) &disp->DrawElements;
- snprintf(symboln, sizeof(symboln), "%sDrawElements", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EdgeFlagPointer) {
- void ** procp = (void **) &disp->EdgeFlagPointer;
- snprintf(symboln, sizeof(symboln), "%sEdgeFlagPointer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EnableClientState) {
- void ** procp = (void **) &disp->EnableClientState;
- snprintf(symboln, sizeof(symboln), "%sEnableClientState", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IndexPointer) {
- void ** procp = (void **) &disp->IndexPointer;
- snprintf(symboln, sizeof(symboln), "%sIndexPointer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Indexub) {
- void ** procp = (void **) &disp->Indexub;
- snprintf(symboln, sizeof(symboln), "%sIndexub", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Indexubv) {
- void ** procp = (void **) &disp->Indexubv;
- snprintf(symboln, sizeof(symboln), "%sIndexubv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->InterleavedArrays) {
- void ** procp = (void **) &disp->InterleavedArrays;
- snprintf(symboln, sizeof(symboln), "%sInterleavedArrays", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->NormalPointer) {
- void ** procp = (void **) &disp->NormalPointer;
- snprintf(symboln, sizeof(symboln), "%sNormalPointer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PolygonOffset) {
- void ** procp = (void **) &disp->PolygonOffset;
- snprintf(symboln, sizeof(symboln), "%sPolygonOffset", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoordPointer) {
- void ** procp = (void **) &disp->TexCoordPointer;
- snprintf(symboln, sizeof(symboln), "%sTexCoordPointer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexPointer) {
- void ** procp = (void **) &disp->VertexPointer;
- snprintf(symboln, sizeof(symboln), "%sVertexPointer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->AreTexturesResident) {
- void ** procp = (void **) &disp->AreTexturesResident;
- snprintf(symboln, sizeof(symboln), "%sAreTexturesResident", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->AreTexturesResident) {
- void ** procp = (void **) &disp->AreTexturesResident;
- snprintf(symboln, sizeof(symboln), "%sAreTexturesResidentEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyTexImage1D) {
- void ** procp = (void **) &disp->CopyTexImage1D;
- snprintf(symboln, sizeof(symboln), "%sCopyTexImage1D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyTexImage1D) {
- void ** procp = (void **) &disp->CopyTexImage1D;
- snprintf(symboln, sizeof(symboln), "%sCopyTexImage1DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyTexImage2D) {
- void ** procp = (void **) &disp->CopyTexImage2D;
- snprintf(symboln, sizeof(symboln), "%sCopyTexImage2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyTexImage2D) {
- void ** procp = (void **) &disp->CopyTexImage2D;
- snprintf(symboln, sizeof(symboln), "%sCopyTexImage2DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyTexSubImage1D) {
- void ** procp = (void **) &disp->CopyTexSubImage1D;
- snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage1D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyTexSubImage1D) {
- void ** procp = (void **) &disp->CopyTexSubImage1D;
- snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage1DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyTexSubImage2D) {
- void ** procp = (void **) &disp->CopyTexSubImage2D;
- snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyTexSubImage2D) {
- void ** procp = (void **) &disp->CopyTexSubImage2D;
- snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage2DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteTextures) {
- void ** procp = (void **) &disp->DeleteTextures;
- snprintf(symboln, sizeof(symboln), "%sDeleteTextures", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteTextures) {
- void ** procp = (void **) &disp->DeleteTextures;
- snprintf(symboln, sizeof(symboln), "%sDeleteTexturesEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenTextures) {
- void ** procp = (void **) &disp->GenTextures;
- snprintf(symboln, sizeof(symboln), "%sGenTextures", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenTextures) {
- void ** procp = (void **) &disp->GenTextures;
- snprintf(symboln, sizeof(symboln), "%sGenTexturesEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetPointerv) {
- void ** procp = (void **) &disp->GetPointerv;
- snprintf(symboln, sizeof(symboln), "%sGetPointerv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetPointerv) {
- void ** procp = (void **) &disp->GetPointerv;
- snprintf(symboln, sizeof(symboln), "%sGetPointervEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsTexture) {
- void ** procp = (void **) &disp->IsTexture;
- snprintf(symboln, sizeof(symboln), "%sIsTexture", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsTexture) {
- void ** procp = (void **) &disp->IsTexture;
- snprintf(symboln, sizeof(symboln), "%sIsTextureEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PrioritizeTextures) {
- void ** procp = (void **) &disp->PrioritizeTextures;
- snprintf(symboln, sizeof(symboln), "%sPrioritizeTextures", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PrioritizeTextures) {
- void ** procp = (void **) &disp->PrioritizeTextures;
- snprintf(symboln, sizeof(symboln), "%sPrioritizeTexturesEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexSubImage1D) {
- void ** procp = (void **) &disp->TexSubImage1D;
- snprintf(symboln, sizeof(symboln), "%sTexSubImage1D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexSubImage1D) {
- void ** procp = (void **) &disp->TexSubImage1D;
- snprintf(symboln, sizeof(symboln), "%sTexSubImage1DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexSubImage2D) {
- void ** procp = (void **) &disp->TexSubImage2D;
- snprintf(symboln, sizeof(symboln), "%sTexSubImage2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexSubImage2D) {
- void ** procp = (void **) &disp->TexSubImage2D;
- snprintf(symboln, sizeof(symboln), "%sTexSubImage2DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PopClientAttrib) {
- void ** procp = (void **) &disp->PopClientAttrib;
- snprintf(symboln, sizeof(symboln), "%sPopClientAttrib", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PushClientAttrib) {
- void ** procp = (void **) &disp->PushClientAttrib;
- snprintf(symboln, sizeof(symboln), "%sPushClientAttrib", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendColor) {
- void ** procp = (void **) &disp->BlendColor;
- snprintf(symboln, sizeof(symboln), "%sBlendColor", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendColor) {
- void ** procp = (void **) &disp->BlendColor;
- snprintf(symboln, sizeof(symboln), "%sBlendColorEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendEquation) {
- void ** procp = (void **) &disp->BlendEquation;
- snprintf(symboln, sizeof(symboln), "%sBlendEquation", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendEquation) {
- void ** procp = (void **) &disp->BlendEquation;
- snprintf(symboln, sizeof(symboln), "%sBlendEquationEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawRangeElements) {
- void ** procp = (void **) &disp->DrawRangeElements;
- snprintf(symboln, sizeof(symboln), "%sDrawRangeElements", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawRangeElements) {
- void ** procp = (void **) &disp->DrawRangeElements;
- snprintf(symboln, sizeof(symboln), "%sDrawRangeElementsEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorTable) {
- void ** procp = (void **) &disp->ColorTable;
- snprintf(symboln, sizeof(symboln), "%sColorTable", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorTable) {
- void ** procp = (void **) &disp->ColorTable;
- snprintf(symboln, sizeof(symboln), "%sColorTableSGI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorTable) {
- void ** procp = (void **) &disp->ColorTable;
- snprintf(symboln, sizeof(symboln), "%sColorTableEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorTableParameterfv) {
- void ** procp = (void **) &disp->ColorTableParameterfv;
- snprintf(symboln, sizeof(symboln), "%sColorTableParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorTableParameterfv) {
- void ** procp = (void **) &disp->ColorTableParameterfv;
- snprintf(symboln, sizeof(symboln), "%sColorTableParameterfvSGI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorTableParameteriv) {
- void ** procp = (void **) &disp->ColorTableParameteriv;
- snprintf(symboln, sizeof(symboln), "%sColorTableParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorTableParameteriv) {
- void ** procp = (void **) &disp->ColorTableParameteriv;
- snprintf(symboln, sizeof(symboln), "%sColorTableParameterivSGI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyColorTable) {
- void ** procp = (void **) &disp->CopyColorTable;
- snprintf(symboln, sizeof(symboln), "%sCopyColorTable", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyColorTable) {
- void ** procp = (void **) &disp->CopyColorTable;
- snprintf(symboln, sizeof(symboln), "%sCopyColorTableSGI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetColorTable) {
- void ** procp = (void **) &disp->GetColorTable;
- snprintf(symboln, sizeof(symboln), "%sGetColorTable", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetColorTable) {
- void ** procp = (void **) &disp->GetColorTable;
- snprintf(symboln, sizeof(symboln), "%sGetColorTableSGI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetColorTable) {
- void ** procp = (void **) &disp->GetColorTable;
- snprintf(symboln, sizeof(symboln), "%sGetColorTableEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetColorTableParameterfv) {
- void ** procp = (void **) &disp->GetColorTableParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetColorTableParameterfv) {
- void ** procp = (void **) &disp->GetColorTableParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterfvSGI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetColorTableParameterfv) {
- void ** procp = (void **) &disp->GetColorTableParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterfvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetColorTableParameteriv) {
- void ** procp = (void **) &disp->GetColorTableParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetColorTableParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetColorTableParameteriv) {
- void ** procp = (void **) &disp->GetColorTableParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterivSGI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetColorTableParameteriv) {
- void ** procp = (void **) &disp->GetColorTableParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorSubTable) {
- void ** procp = (void **) &disp->ColorSubTable;
- snprintf(symboln, sizeof(symboln), "%sColorSubTable", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorSubTable) {
- void ** procp = (void **) &disp->ColorSubTable;
- snprintf(symboln, sizeof(symboln), "%sColorSubTableEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyColorSubTable) {
- void ** procp = (void **) &disp->CopyColorSubTable;
- snprintf(symboln, sizeof(symboln), "%sCopyColorSubTable", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyColorSubTable) {
- void ** procp = (void **) &disp->CopyColorSubTable;
- snprintf(symboln, sizeof(symboln), "%sCopyColorSubTableEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionFilter1D) {
- void ** procp = (void **) &disp->ConvolutionFilter1D;
- snprintf(symboln, sizeof(symboln), "%sConvolutionFilter1D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionFilter1D) {
- void ** procp = (void **) &disp->ConvolutionFilter1D;
- snprintf(symboln, sizeof(symboln), "%sConvolutionFilter1DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionFilter2D) {
- void ** procp = (void **) &disp->ConvolutionFilter2D;
- snprintf(symboln, sizeof(symboln), "%sConvolutionFilter2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionFilter2D) {
- void ** procp = (void **) &disp->ConvolutionFilter2D;
- snprintf(symboln, sizeof(symboln), "%sConvolutionFilter2DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionParameterf) {
- void ** procp = (void **) &disp->ConvolutionParameterf;
- snprintf(symboln, sizeof(symboln), "%sConvolutionParameterf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionParameterf) {
- void ** procp = (void **) &disp->ConvolutionParameterf;
- snprintf(symboln, sizeof(symboln), "%sConvolutionParameterfEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionParameterfv) {
- void ** procp = (void **) &disp->ConvolutionParameterfv;
- snprintf(symboln, sizeof(symboln), "%sConvolutionParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionParameterfv) {
- void ** procp = (void **) &disp->ConvolutionParameterfv;
- snprintf(symboln, sizeof(symboln), "%sConvolutionParameterfvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionParameteri) {
- void ** procp = (void **) &disp->ConvolutionParameteri;
- snprintf(symboln, sizeof(symboln), "%sConvolutionParameteri", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionParameteri) {
- void ** procp = (void **) &disp->ConvolutionParameteri;
- snprintf(symboln, sizeof(symboln), "%sConvolutionParameteriEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionParameteriv) {
- void ** procp = (void **) &disp->ConvolutionParameteriv;
- snprintf(symboln, sizeof(symboln), "%sConvolutionParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ConvolutionParameteriv) {
- void ** procp = (void **) &disp->ConvolutionParameteriv;
- snprintf(symboln, sizeof(symboln), "%sConvolutionParameterivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyConvolutionFilter1D) {
- void ** procp = (void **) &disp->CopyConvolutionFilter1D;
- snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter1D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyConvolutionFilter1D) {
- void ** procp = (void **) &disp->CopyConvolutionFilter1D;
- snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter1DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyConvolutionFilter2D) {
- void ** procp = (void **) &disp->CopyConvolutionFilter2D;
- snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyConvolutionFilter2D) {
- void ** procp = (void **) &disp->CopyConvolutionFilter2D;
- snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter2DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetConvolutionFilter) {
- void ** procp = (void **) &disp->GetConvolutionFilter;
- snprintf(symboln, sizeof(symboln), "%sGetConvolutionFilter", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetConvolutionFilter) {
- void ** procp = (void **) &disp->GetConvolutionFilter;
- snprintf(symboln, sizeof(symboln), "%sGetConvolutionFilterEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetConvolutionParameterfv) {
- void ** procp = (void **) &disp->GetConvolutionParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetConvolutionParameterfv) {
- void ** procp = (void **) &disp->GetConvolutionParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameterfvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetConvolutionParameteriv) {
- void ** procp = (void **) &disp->GetConvolutionParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetConvolutionParameteriv) {
- void ** procp = (void **) &disp->GetConvolutionParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameterivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetSeparableFilter) {
- void ** procp = (void **) &disp->GetSeparableFilter;
- snprintf(symboln, sizeof(symboln), "%sGetSeparableFilter", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetSeparableFilter) {
- void ** procp = (void **) &disp->GetSeparableFilter;
- snprintf(symboln, sizeof(symboln), "%sGetSeparableFilterEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SeparableFilter2D) {
- void ** procp = (void **) &disp->SeparableFilter2D;
- snprintf(symboln, sizeof(symboln), "%sSeparableFilter2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SeparableFilter2D) {
- void ** procp = (void **) &disp->SeparableFilter2D;
- snprintf(symboln, sizeof(symboln), "%sSeparableFilter2DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetHistogram) {
- void ** procp = (void **) &disp->GetHistogram;
- snprintf(symboln, sizeof(symboln), "%sGetHistogram", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetHistogram) {
- void ** procp = (void **) &disp->GetHistogram;
- snprintf(symboln, sizeof(symboln), "%sGetHistogramEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetHistogramParameterfv) {
- void ** procp = (void **) &disp->GetHistogramParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetHistogramParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetHistogramParameterfv) {
- void ** procp = (void **) &disp->GetHistogramParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetHistogramParameterfvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetHistogramParameteriv) {
- void ** procp = (void **) &disp->GetHistogramParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetHistogramParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetHistogramParameteriv) {
- void ** procp = (void **) &disp->GetHistogramParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetHistogramParameterivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMinmax) {
- void ** procp = (void **) &disp->GetMinmax;
- snprintf(symboln, sizeof(symboln), "%sGetMinmax", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMinmax) {
- void ** procp = (void **) &disp->GetMinmax;
- snprintf(symboln, sizeof(symboln), "%sGetMinmaxEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMinmaxParameterfv) {
- void ** procp = (void **) &disp->GetMinmaxParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMinmaxParameterfv) {
- void ** procp = (void **) &disp->GetMinmaxParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameterfvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMinmaxParameteriv) {
- void ** procp = (void **) &disp->GetMinmaxParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetMinmaxParameteriv) {
- void ** procp = (void **) &disp->GetMinmaxParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameterivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Histogram) {
- void ** procp = (void **) &disp->Histogram;
- snprintf(symboln, sizeof(symboln), "%sHistogram", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Histogram) {
- void ** procp = (void **) &disp->Histogram;
- snprintf(symboln, sizeof(symboln), "%sHistogramEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Minmax) {
- void ** procp = (void **) &disp->Minmax;
- snprintf(symboln, sizeof(symboln), "%sMinmax", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Minmax) {
- void ** procp = (void **) &disp->Minmax;
- snprintf(symboln, sizeof(symboln), "%sMinmaxEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ResetHistogram) {
- void ** procp = (void **) &disp->ResetHistogram;
- snprintf(symboln, sizeof(symboln), "%sResetHistogram", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ResetHistogram) {
- void ** procp = (void **) &disp->ResetHistogram;
- snprintf(symboln, sizeof(symboln), "%sResetHistogramEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ResetMinmax) {
- void ** procp = (void **) &disp->ResetMinmax;
- snprintf(symboln, sizeof(symboln), "%sResetMinmax", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ResetMinmax) {
- void ** procp = (void **) &disp->ResetMinmax;
- snprintf(symboln, sizeof(symboln), "%sResetMinmaxEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexImage3D) {
- void ** procp = (void **) &disp->TexImage3D;
- snprintf(symboln, sizeof(symboln), "%sTexImage3D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexImage3D) {
- void ** procp = (void **) &disp->TexImage3D;
- snprintf(symboln, sizeof(symboln), "%sTexImage3DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexSubImage3D) {
- void ** procp = (void **) &disp->TexSubImage3D;
- snprintf(symboln, sizeof(symboln), "%sTexSubImage3D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexSubImage3D) {
- void ** procp = (void **) &disp->TexSubImage3D;
- snprintf(symboln, sizeof(symboln), "%sTexSubImage3DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyTexSubImage3D) {
- void ** procp = (void **) &disp->CopyTexSubImage3D;
- snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage3D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyTexSubImage3D) {
- void ** procp = (void **) &disp->CopyTexSubImage3D;
- snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage3DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ActiveTextureARB) {
- void ** procp = (void **) &disp->ActiveTextureARB;
- snprintf(symboln, sizeof(symboln), "%sActiveTexture", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ActiveTextureARB) {
- void ** procp = (void **) &disp->ActiveTextureARB;
- snprintf(symboln, sizeof(symboln), "%sActiveTextureARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClientActiveTextureARB) {
- void ** procp = (void **) &disp->ClientActiveTextureARB;
- snprintf(symboln, sizeof(symboln), "%sClientActiveTexture", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClientActiveTextureARB) {
- void ** procp = (void **) &disp->ClientActiveTextureARB;
- snprintf(symboln, sizeof(symboln), "%sClientActiveTextureARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1dARB) {
- void ** procp = (void **) &disp->MultiTexCoord1dARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1dARB) {
- void ** procp = (void **) &disp->MultiTexCoord1dARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1dvARB) {
- void ** procp = (void **) &disp->MultiTexCoord1dvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1dvARB) {
- void ** procp = (void **) &disp->MultiTexCoord1dvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1fARB) {
- void ** procp = (void **) &disp->MultiTexCoord1fARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1fARB) {
- void ** procp = (void **) &disp->MultiTexCoord1fARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1fvARB) {
- void ** procp = (void **) &disp->MultiTexCoord1fvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1fvARB) {
- void ** procp = (void **) &disp->MultiTexCoord1fvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1iARB) {
- void ** procp = (void **) &disp->MultiTexCoord1iARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1iARB) {
- void ** procp = (void **) &disp->MultiTexCoord1iARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1iARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1ivARB) {
- void ** procp = (void **) &disp->MultiTexCoord1ivARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1ivARB) {
- void ** procp = (void **) &disp->MultiTexCoord1ivARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1sARB) {
- void ** procp = (void **) &disp->MultiTexCoord1sARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1sARB) {
- void ** procp = (void **) &disp->MultiTexCoord1sARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1sARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1svARB) {
- void ** procp = (void **) &disp->MultiTexCoord1svARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord1svARB) {
- void ** procp = (void **) &disp->MultiTexCoord1svARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1svARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2dARB) {
- void ** procp = (void **) &disp->MultiTexCoord2dARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2dARB) {
- void ** procp = (void **) &disp->MultiTexCoord2dARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2dvARB) {
- void ** procp = (void **) &disp->MultiTexCoord2dvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2dvARB) {
- void ** procp = (void **) &disp->MultiTexCoord2dvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2fARB) {
- void ** procp = (void **) &disp->MultiTexCoord2fARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2fARB) {
- void ** procp = (void **) &disp->MultiTexCoord2fARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2fvARB) {
- void ** procp = (void **) &disp->MultiTexCoord2fvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2fvARB) {
- void ** procp = (void **) &disp->MultiTexCoord2fvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2iARB) {
- void ** procp = (void **) &disp->MultiTexCoord2iARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2iARB) {
- void ** procp = (void **) &disp->MultiTexCoord2iARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2iARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2ivARB) {
- void ** procp = (void **) &disp->MultiTexCoord2ivARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2ivARB) {
- void ** procp = (void **) &disp->MultiTexCoord2ivARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2sARB) {
- void ** procp = (void **) &disp->MultiTexCoord2sARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2sARB) {
- void ** procp = (void **) &disp->MultiTexCoord2sARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2sARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2svARB) {
- void ** procp = (void **) &disp->MultiTexCoord2svARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord2svARB) {
- void ** procp = (void **) &disp->MultiTexCoord2svARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2svARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3dARB) {
- void ** procp = (void **) &disp->MultiTexCoord3dARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3dARB) {
- void ** procp = (void **) &disp->MultiTexCoord3dARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3dvARB) {
- void ** procp = (void **) &disp->MultiTexCoord3dvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3dvARB) {
- void ** procp = (void **) &disp->MultiTexCoord3dvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3fARB) {
- void ** procp = (void **) &disp->MultiTexCoord3fARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3fARB) {
- void ** procp = (void **) &disp->MultiTexCoord3fARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3fvARB) {
- void ** procp = (void **) &disp->MultiTexCoord3fvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3fvARB) {
- void ** procp = (void **) &disp->MultiTexCoord3fvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3iARB) {
- void ** procp = (void **) &disp->MultiTexCoord3iARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3iARB) {
- void ** procp = (void **) &disp->MultiTexCoord3iARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3iARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3ivARB) {
- void ** procp = (void **) &disp->MultiTexCoord3ivARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3ivARB) {
- void ** procp = (void **) &disp->MultiTexCoord3ivARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3sARB) {
- void ** procp = (void **) &disp->MultiTexCoord3sARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3sARB) {
- void ** procp = (void **) &disp->MultiTexCoord3sARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3sARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3svARB) {
- void ** procp = (void **) &disp->MultiTexCoord3svARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord3svARB) {
- void ** procp = (void **) &disp->MultiTexCoord3svARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3svARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4dARB) {
- void ** procp = (void **) &disp->MultiTexCoord4dARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4dARB) {
- void ** procp = (void **) &disp->MultiTexCoord4dARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4dvARB) {
- void ** procp = (void **) &disp->MultiTexCoord4dvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4dvARB) {
- void ** procp = (void **) &disp->MultiTexCoord4dvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4fARB) {
- void ** procp = (void **) &disp->MultiTexCoord4fARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4fARB) {
- void ** procp = (void **) &disp->MultiTexCoord4fARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4fvARB) {
- void ** procp = (void **) &disp->MultiTexCoord4fvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4fvARB) {
- void ** procp = (void **) &disp->MultiTexCoord4fvARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4iARB) {
- void ** procp = (void **) &disp->MultiTexCoord4iARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4iARB) {
- void ** procp = (void **) &disp->MultiTexCoord4iARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4iARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4ivARB) {
- void ** procp = (void **) &disp->MultiTexCoord4ivARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4ivARB) {
- void ** procp = (void **) &disp->MultiTexCoord4ivARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4sARB) {
- void ** procp = (void **) &disp->MultiTexCoord4sARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4sARB) {
- void ** procp = (void **) &disp->MultiTexCoord4sARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4sARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4svARB) {
- void ** procp = (void **) &disp->MultiTexCoord4svARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoord4svARB) {
- void ** procp = (void **) &disp->MultiTexCoord4svARB;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4svARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->AttachShader) {
- void ** procp = (void **) &disp->AttachShader;
- snprintf(symboln, sizeof(symboln), "%sAttachShader", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CreateProgram) {
- void ** procp = (void **) &disp->CreateProgram;
- snprintf(symboln, sizeof(symboln), "%sCreateProgram", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CreateShader) {
- void ** procp = (void **) &disp->CreateShader;
- snprintf(symboln, sizeof(symboln), "%sCreateShader", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteProgram) {
- void ** procp = (void **) &disp->DeleteProgram;
- snprintf(symboln, sizeof(symboln), "%sDeleteProgram", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteShader) {
- void ** procp = (void **) &disp->DeleteShader;
- snprintf(symboln, sizeof(symboln), "%sDeleteShader", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DetachShader) {
- void ** procp = (void **) &disp->DetachShader;
- snprintf(symboln, sizeof(symboln), "%sDetachShader", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetAttachedShaders) {
- void ** procp = (void **) &disp->GetAttachedShaders;
- snprintf(symboln, sizeof(symboln), "%sGetAttachedShaders", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramInfoLog) {
- void ** procp = (void **) &disp->GetProgramInfoLog;
- snprintf(symboln, sizeof(symboln), "%sGetProgramInfoLog", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramiv) {
- void ** procp = (void **) &disp->GetProgramiv;
- snprintf(symboln, sizeof(symboln), "%sGetProgramiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetShaderInfoLog) {
- void ** procp = (void **) &disp->GetShaderInfoLog;
- snprintf(symboln, sizeof(symboln), "%sGetShaderInfoLog", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetShaderiv) {
- void ** procp = (void **) &disp->GetShaderiv;
- snprintf(symboln, sizeof(symboln), "%sGetShaderiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsProgram) {
- void ** procp = (void **) &disp->IsProgram;
- snprintf(symboln, sizeof(symboln), "%sIsProgram", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsShader) {
- void ** procp = (void **) &disp->IsShader;
- snprintf(symboln, sizeof(symboln), "%sIsShader", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->StencilFuncSeparate) {
- void ** procp = (void **) &disp->StencilFuncSeparate;
- snprintf(symboln, sizeof(symboln), "%sStencilFuncSeparate", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->StencilMaskSeparate) {
- void ** procp = (void **) &disp->StencilMaskSeparate;
- snprintf(symboln, sizeof(symboln), "%sStencilMaskSeparate", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->StencilOpSeparate) {
- void ** procp = (void **) &disp->StencilOpSeparate;
- snprintf(symboln, sizeof(symboln), "%sStencilOpSeparate", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->StencilOpSeparate) {
- void ** procp = (void **) &disp->StencilOpSeparate;
- snprintf(symboln, sizeof(symboln), "%sStencilOpSeparateATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix2x3fv) {
- void ** procp = (void **) &disp->UniformMatrix2x3fv;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix2x3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix2x4fv) {
- void ** procp = (void **) &disp->UniformMatrix2x4fv;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix2x4fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix3x2fv) {
- void ** procp = (void **) &disp->UniformMatrix3x2fv;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix3x2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix3x4fv) {
- void ** procp = (void **) &disp->UniformMatrix3x4fv;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix3x4fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix4x2fv) {
- void ** procp = (void **) &disp->UniformMatrix4x2fv;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix4x2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix4x3fv) {
- void ** procp = (void **) &disp->UniformMatrix4x3fv;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix4x3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClampColor) {
- void ** procp = (void **) &disp->ClampColor;
- snprintf(symboln, sizeof(symboln), "%sClampColor", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearBufferfi) {
- void ** procp = (void **) &disp->ClearBufferfi;
- snprintf(symboln, sizeof(symboln), "%sClearBufferfi", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearBufferfv) {
- void ** procp = (void **) &disp->ClearBufferfv;
- snprintf(symboln, sizeof(symboln), "%sClearBufferfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearBufferiv) {
- void ** procp = (void **) &disp->ClearBufferiv;
- snprintf(symboln, sizeof(symboln), "%sClearBufferiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearBufferuiv) {
- void ** procp = (void **) &disp->ClearBufferuiv;
- snprintf(symboln, sizeof(symboln), "%sClearBufferuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetStringi) {
- void ** procp = (void **) &disp->GetStringi;
- snprintf(symboln, sizeof(symboln), "%sGetStringi", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexBuffer) {
- void ** procp = (void **) &disp->TexBuffer;
- snprintf(symboln, sizeof(symboln), "%sTexBuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTexture) {
- void ** procp = (void **) &disp->FramebufferTexture;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTexture", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetBufferParameteri64v) {
- void ** procp = (void **) &disp->GetBufferParameteri64v;
- snprintf(symboln, sizeof(symboln), "%sGetBufferParameteri64v", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetInteger64i_v) {
- void ** procp = (void **) &disp->GetInteger64i_v;
- snprintf(symboln, sizeof(symboln), "%sGetInteger64i_v", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribDivisor) {
- void ** procp = (void **) &disp->VertexAttribDivisor;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribDivisor", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LoadTransposeMatrixdARB) {
- void ** procp = (void **) &disp->LoadTransposeMatrixdARB;
- snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixd", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LoadTransposeMatrixdARB) {
- void ** procp = (void **) &disp->LoadTransposeMatrixdARB;
- snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixdARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LoadTransposeMatrixfARB) {
- void ** procp = (void **) &disp->LoadTransposeMatrixfARB;
- snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LoadTransposeMatrixfARB) {
- void ** procp = (void **) &disp->LoadTransposeMatrixfARB;
- snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixfARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultTransposeMatrixdARB) {
- void ** procp = (void **) &disp->MultTransposeMatrixdARB;
- snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixd", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultTransposeMatrixdARB) {
- void ** procp = (void **) &disp->MultTransposeMatrixdARB;
- snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixdARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultTransposeMatrixfARB) {
- void ** procp = (void **) &disp->MultTransposeMatrixfARB;
- snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultTransposeMatrixfARB) {
- void ** procp = (void **) &disp->MultTransposeMatrixfARB;
- snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixfARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SampleCoverageARB) {
- void ** procp = (void **) &disp->SampleCoverageARB;
- snprintf(symboln, sizeof(symboln), "%sSampleCoverage", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SampleCoverageARB) {
- void ** procp = (void **) &disp->SampleCoverageARB;
- snprintf(symboln, sizeof(symboln), "%sSampleCoverageARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexImage1DARB) {
- void ** procp = (void **) &disp->CompressedTexImage1DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexImage1D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexImage1DARB) {
- void ** procp = (void **) &disp->CompressedTexImage1DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexImage1DARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexImage2DARB) {
- void ** procp = (void **) &disp->CompressedTexImage2DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexImage2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexImage2DARB) {
- void ** procp = (void **) &disp->CompressedTexImage2DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexImage2DARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexImage3DARB) {
- void ** procp = (void **) &disp->CompressedTexImage3DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexImage3D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexImage3DARB) {
- void ** procp = (void **) &disp->CompressedTexImage3DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexImage3DARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexSubImage1DARB) {
- void ** procp = (void **) &disp->CompressedTexSubImage1DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage1D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexSubImage1DARB) {
- void ** procp = (void **) &disp->CompressedTexSubImage1DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage1DARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexSubImage2DARB) {
- void ** procp = (void **) &disp->CompressedTexSubImage2DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexSubImage2DARB) {
- void ** procp = (void **) &disp->CompressedTexSubImage2DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage2DARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexSubImage3DARB) {
- void ** procp = (void **) &disp->CompressedTexSubImage3DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage3D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompressedTexSubImage3DARB) {
- void ** procp = (void **) &disp->CompressedTexSubImage3DARB;
- snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage3DARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetCompressedTexImageARB) {
- void ** procp = (void **) &disp->GetCompressedTexImageARB;
- snprintf(symboln, sizeof(symboln), "%sGetCompressedTexImage", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetCompressedTexImageARB) {
- void ** procp = (void **) &disp->GetCompressedTexImageARB;
- snprintf(symboln, sizeof(symboln), "%sGetCompressedTexImageARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DisableVertexAttribArrayARB) {
- void ** procp = (void **) &disp->DisableVertexAttribArrayARB;
- snprintf(symboln, sizeof(symboln), "%sDisableVertexAttribArray", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DisableVertexAttribArrayARB) {
- void ** procp = (void **) &disp->DisableVertexAttribArrayARB;
- snprintf(symboln, sizeof(symboln), "%sDisableVertexAttribArrayARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EnableVertexAttribArrayARB) {
- void ** procp = (void **) &disp->EnableVertexAttribArrayARB;
- snprintf(symboln, sizeof(symboln), "%sEnableVertexAttribArray", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EnableVertexAttribArrayARB) {
- void ** procp = (void **) &disp->EnableVertexAttribArrayARB;
- snprintf(symboln, sizeof(symboln), "%sEnableVertexAttribArrayARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramEnvParameterdvARB) {
- void ** procp = (void **) &disp->GetProgramEnvParameterdvARB;
- snprintf(symboln, sizeof(symboln), "%sGetProgramEnvParameterdvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramEnvParameterfvARB) {
- void ** procp = (void **) &disp->GetProgramEnvParameterfvARB;
- snprintf(symboln, sizeof(symboln), "%sGetProgramEnvParameterfvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramLocalParameterdvARB) {
- void ** procp = (void **) &disp->GetProgramLocalParameterdvARB;
- snprintf(symboln, sizeof(symboln), "%sGetProgramLocalParameterdvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramLocalParameterfvARB) {
- void ** procp = (void **) &disp->GetProgramLocalParameterfvARB;
- snprintf(symboln, sizeof(symboln), "%sGetProgramLocalParameterfvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramStringARB) {
- void ** procp = (void **) &disp->GetProgramStringARB;
- snprintf(symboln, sizeof(symboln), "%sGetProgramStringARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramivARB) {
- void ** procp = (void **) &disp->GetProgramivARB;
- snprintf(symboln, sizeof(symboln), "%sGetProgramivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribdvARB) {
- void ** procp = (void **) &disp->GetVertexAttribdvARB;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribdv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribdvARB) {
- void ** procp = (void **) &disp->GetVertexAttribdvARB;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribdvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribfvARB) {
- void ** procp = (void **) &disp->GetVertexAttribfvARB;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribfvARB) {
- void ** procp = (void **) &disp->GetVertexAttribfvARB;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribfvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribivARB) {
- void ** procp = (void **) &disp->GetVertexAttribivARB;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribivARB) {
- void ** procp = (void **) &disp->GetVertexAttribivARB;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramEnvParameter4dARB) {
- void ** procp = (void **) &disp->ProgramEnvParameter4dARB;
- snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramEnvParameter4dARB) {
- void ** procp = (void **) &disp->ProgramEnvParameter4dARB;
- snprintf(symboln, sizeof(symboln), "%sProgramParameter4dNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramEnvParameter4dvARB) {
- void ** procp = (void **) &disp->ProgramEnvParameter4dvARB;
- snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramEnvParameter4dvARB) {
- void ** procp = (void **) &disp->ProgramEnvParameter4dvARB;
- snprintf(symboln, sizeof(symboln), "%sProgramParameter4dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramEnvParameter4fARB) {
- void ** procp = (void **) &disp->ProgramEnvParameter4fARB;
- snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramEnvParameter4fARB) {
- void ** procp = (void **) &disp->ProgramEnvParameter4fARB;
- snprintf(symboln, sizeof(symboln), "%sProgramParameter4fNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramEnvParameter4fvARB) {
- void ** procp = (void **) &disp->ProgramEnvParameter4fvARB;
- snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramEnvParameter4fvARB) {
- void ** procp = (void **) &disp->ProgramEnvParameter4fvARB;
- snprintf(symboln, sizeof(symboln), "%sProgramParameter4fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramLocalParameter4dARB) {
- void ** procp = (void **) &disp->ProgramLocalParameter4dARB;
- snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramLocalParameter4dvARB) {
- void ** procp = (void **) &disp->ProgramLocalParameter4dvARB;
- snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramLocalParameter4fARB) {
- void ** procp = (void **) &disp->ProgramLocalParameter4fARB;
- snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramLocalParameter4fvARB) {
- void ** procp = (void **) &disp->ProgramLocalParameter4fvARB;
- snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramStringARB) {
- void ** procp = (void **) &disp->ProgramStringARB;
- snprintf(symboln, sizeof(symboln), "%sProgramStringARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1dARB) {
- void ** procp = (void **) &disp->VertexAttrib1dARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1dARB) {
- void ** procp = (void **) &disp->VertexAttrib1dARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1dvARB) {
- void ** procp = (void **) &disp->VertexAttrib1dvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1dvARB) {
- void ** procp = (void **) &disp->VertexAttrib1dvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1fARB) {
- void ** procp = (void **) &disp->VertexAttrib1fARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1fARB) {
- void ** procp = (void **) &disp->VertexAttrib1fARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1fvARB) {
- void ** procp = (void **) &disp->VertexAttrib1fvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1fvARB) {
- void ** procp = (void **) &disp->VertexAttrib1fvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1sARB) {
- void ** procp = (void **) &disp->VertexAttrib1sARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1sARB) {
- void ** procp = (void **) &disp->VertexAttrib1sARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1sARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1svARB) {
- void ** procp = (void **) &disp->VertexAttrib1svARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1svARB) {
- void ** procp = (void **) &disp->VertexAttrib1svARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1svARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2dARB) {
- void ** procp = (void **) &disp->VertexAttrib2dARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2dARB) {
- void ** procp = (void **) &disp->VertexAttrib2dARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2dvARB) {
- void ** procp = (void **) &disp->VertexAttrib2dvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2dvARB) {
- void ** procp = (void **) &disp->VertexAttrib2dvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2fARB) {
- void ** procp = (void **) &disp->VertexAttrib2fARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2fARB) {
- void ** procp = (void **) &disp->VertexAttrib2fARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2fvARB) {
- void ** procp = (void **) &disp->VertexAttrib2fvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2fvARB) {
- void ** procp = (void **) &disp->VertexAttrib2fvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2sARB) {
- void ** procp = (void **) &disp->VertexAttrib2sARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2sARB) {
- void ** procp = (void **) &disp->VertexAttrib2sARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2sARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2svARB) {
- void ** procp = (void **) &disp->VertexAttrib2svARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2svARB) {
- void ** procp = (void **) &disp->VertexAttrib2svARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2svARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3dARB) {
- void ** procp = (void **) &disp->VertexAttrib3dARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3dARB) {
- void ** procp = (void **) &disp->VertexAttrib3dARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3dvARB) {
- void ** procp = (void **) &disp->VertexAttrib3dvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3dvARB) {
- void ** procp = (void **) &disp->VertexAttrib3dvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3fARB) {
- void ** procp = (void **) &disp->VertexAttrib3fARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3fARB) {
- void ** procp = (void **) &disp->VertexAttrib3fARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3fvARB) {
- void ** procp = (void **) &disp->VertexAttrib3fvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3fvARB) {
- void ** procp = (void **) &disp->VertexAttrib3fvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3sARB) {
- void ** procp = (void **) &disp->VertexAttrib3sARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3sARB) {
- void ** procp = (void **) &disp->VertexAttrib3sARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3sARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3svARB) {
- void ** procp = (void **) &disp->VertexAttrib3svARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3svARB) {
- void ** procp = (void **) &disp->VertexAttrib3svARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3svARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NbvARB) {
- void ** procp = (void **) &disp->VertexAttrib4NbvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nbv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NbvARB) {
- void ** procp = (void **) &disp->VertexAttrib4NbvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NbvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NivARB) {
- void ** procp = (void **) &disp->VertexAttrib4NivARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Niv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NivARB) {
- void ** procp = (void **) &disp->VertexAttrib4NivARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NsvARB) {
- void ** procp = (void **) &disp->VertexAttrib4NsvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nsv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NsvARB) {
- void ** procp = (void **) &disp->VertexAttrib4NsvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NsvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NubARB) {
- void ** procp = (void **) &disp->VertexAttrib4NubARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nub", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NubARB) {
- void ** procp = (void **) &disp->VertexAttrib4NubARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NubARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NubvARB) {
- void ** procp = (void **) &disp->VertexAttrib4NubvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nubv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NubvARB) {
- void ** procp = (void **) &disp->VertexAttrib4NubvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NubvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NuivARB) {
- void ** procp = (void **) &disp->VertexAttrib4NuivARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NuivARB) {
- void ** procp = (void **) &disp->VertexAttrib4NuivARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NuivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NusvARB) {
- void ** procp = (void **) &disp->VertexAttrib4NusvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nusv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4NusvARB) {
- void ** procp = (void **) &disp->VertexAttrib4NusvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NusvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4bvARB) {
- void ** procp = (void **) &disp->VertexAttrib4bvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4bv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4bvARB) {
- void ** procp = (void **) &disp->VertexAttrib4bvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4bvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4dARB) {
- void ** procp = (void **) &disp->VertexAttrib4dARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4dARB) {
- void ** procp = (void **) &disp->VertexAttrib4dARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4dvARB) {
- void ** procp = (void **) &disp->VertexAttrib4dvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4dvARB) {
- void ** procp = (void **) &disp->VertexAttrib4dvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4fARB) {
- void ** procp = (void **) &disp->VertexAttrib4fARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4fARB) {
- void ** procp = (void **) &disp->VertexAttrib4fARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4fvARB) {
- void ** procp = (void **) &disp->VertexAttrib4fvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4fvARB) {
- void ** procp = (void **) &disp->VertexAttrib4fvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4ivARB) {
- void ** procp = (void **) &disp->VertexAttrib4ivARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4ivARB) {
- void ** procp = (void **) &disp->VertexAttrib4ivARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4sARB) {
- void ** procp = (void **) &disp->VertexAttrib4sARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4sARB) {
- void ** procp = (void **) &disp->VertexAttrib4sARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4sARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4svARB) {
- void ** procp = (void **) &disp->VertexAttrib4svARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4svARB) {
- void ** procp = (void **) &disp->VertexAttrib4svARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4svARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4ubvARB) {
- void ** procp = (void **) &disp->VertexAttrib4ubvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4ubvARB) {
- void ** procp = (void **) &disp->VertexAttrib4ubvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4uivARB) {
- void ** procp = (void **) &disp->VertexAttrib4uivARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4uivARB) {
- void ** procp = (void **) &disp->VertexAttrib4uivARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4uivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4usvARB) {
- void ** procp = (void **) &disp->VertexAttrib4usvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4usv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4usvARB) {
- void ** procp = (void **) &disp->VertexAttrib4usvARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4usvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribPointerARB) {
- void ** procp = (void **) &disp->VertexAttribPointerARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribPointer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribPointerARB) {
- void ** procp = (void **) &disp->VertexAttribPointerARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribPointerARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindBufferARB) {
- void ** procp = (void **) &disp->BindBufferARB;
- snprintf(symboln, sizeof(symboln), "%sBindBuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindBufferARB) {
- void ** procp = (void **) &disp->BindBufferARB;
- snprintf(symboln, sizeof(symboln), "%sBindBufferARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BufferDataARB) {
- void ** procp = (void **) &disp->BufferDataARB;
- snprintf(symboln, sizeof(symboln), "%sBufferData", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BufferDataARB) {
- void ** procp = (void **) &disp->BufferDataARB;
- snprintf(symboln, sizeof(symboln), "%sBufferDataARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BufferSubDataARB) {
- void ** procp = (void **) &disp->BufferSubDataARB;
- snprintf(symboln, sizeof(symboln), "%sBufferSubData", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BufferSubDataARB) {
- void ** procp = (void **) &disp->BufferSubDataARB;
- snprintf(symboln, sizeof(symboln), "%sBufferSubDataARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteBuffersARB) {
- void ** procp = (void **) &disp->DeleteBuffersARB;
- snprintf(symboln, sizeof(symboln), "%sDeleteBuffers", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteBuffersARB) {
- void ** procp = (void **) &disp->DeleteBuffersARB;
- snprintf(symboln, sizeof(symboln), "%sDeleteBuffersARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenBuffersARB) {
- void ** procp = (void **) &disp->GenBuffersARB;
- snprintf(symboln, sizeof(symboln), "%sGenBuffers", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenBuffersARB) {
- void ** procp = (void **) &disp->GenBuffersARB;
- snprintf(symboln, sizeof(symboln), "%sGenBuffersARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetBufferParameterivARB) {
- void ** procp = (void **) &disp->GetBufferParameterivARB;
- snprintf(symboln, sizeof(symboln), "%sGetBufferParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetBufferParameterivARB) {
- void ** procp = (void **) &disp->GetBufferParameterivARB;
- snprintf(symboln, sizeof(symboln), "%sGetBufferParameterivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetBufferPointervARB) {
- void ** procp = (void **) &disp->GetBufferPointervARB;
- snprintf(symboln, sizeof(symboln), "%sGetBufferPointerv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetBufferPointervARB) {
- void ** procp = (void **) &disp->GetBufferPointervARB;
- snprintf(symboln, sizeof(symboln), "%sGetBufferPointervARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetBufferSubDataARB) {
- void ** procp = (void **) &disp->GetBufferSubDataARB;
- snprintf(symboln, sizeof(symboln), "%sGetBufferSubData", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetBufferSubDataARB) {
- void ** procp = (void **) &disp->GetBufferSubDataARB;
- snprintf(symboln, sizeof(symboln), "%sGetBufferSubDataARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsBufferARB) {
- void ** procp = (void **) &disp->IsBufferARB;
- snprintf(symboln, sizeof(symboln), "%sIsBuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsBufferARB) {
- void ** procp = (void **) &disp->IsBufferARB;
- snprintf(symboln, sizeof(symboln), "%sIsBufferARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MapBufferARB) {
- void ** procp = (void **) &disp->MapBufferARB;
- snprintf(symboln, sizeof(symboln), "%sMapBuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MapBufferARB) {
- void ** procp = (void **) &disp->MapBufferARB;
- snprintf(symboln, sizeof(symboln), "%sMapBufferARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UnmapBufferARB) {
- void ** procp = (void **) &disp->UnmapBufferARB;
- snprintf(symboln, sizeof(symboln), "%sUnmapBuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UnmapBufferARB) {
- void ** procp = (void **) &disp->UnmapBufferARB;
- snprintf(symboln, sizeof(symboln), "%sUnmapBufferARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BeginQueryARB) {
- void ** procp = (void **) &disp->BeginQueryARB;
- snprintf(symboln, sizeof(symboln), "%sBeginQuery", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BeginQueryARB) {
- void ** procp = (void **) &disp->BeginQueryARB;
- snprintf(symboln, sizeof(symboln), "%sBeginQueryARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteQueriesARB) {
- void ** procp = (void **) &disp->DeleteQueriesARB;
- snprintf(symboln, sizeof(symboln), "%sDeleteQueries", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteQueriesARB) {
- void ** procp = (void **) &disp->DeleteQueriesARB;
- snprintf(symboln, sizeof(symboln), "%sDeleteQueriesARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EndQueryARB) {
- void ** procp = (void **) &disp->EndQueryARB;
- snprintf(symboln, sizeof(symboln), "%sEndQuery", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EndQueryARB) {
- void ** procp = (void **) &disp->EndQueryARB;
- snprintf(symboln, sizeof(symboln), "%sEndQueryARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenQueriesARB) {
- void ** procp = (void **) &disp->GenQueriesARB;
- snprintf(symboln, sizeof(symboln), "%sGenQueries", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenQueriesARB) {
- void ** procp = (void **) &disp->GenQueriesARB;
- snprintf(symboln, sizeof(symboln), "%sGenQueriesARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetQueryObjectivARB) {
- void ** procp = (void **) &disp->GetQueryObjectivARB;
- snprintf(symboln, sizeof(symboln), "%sGetQueryObjectiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetQueryObjectivARB) {
- void ** procp = (void **) &disp->GetQueryObjectivARB;
- snprintf(symboln, sizeof(symboln), "%sGetQueryObjectivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetQueryObjectuivARB) {
- void ** procp = (void **) &disp->GetQueryObjectuivARB;
- snprintf(symboln, sizeof(symboln), "%sGetQueryObjectuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetQueryObjectuivARB) {
- void ** procp = (void **) &disp->GetQueryObjectuivARB;
- snprintf(symboln, sizeof(symboln), "%sGetQueryObjectuivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetQueryivARB) {
- void ** procp = (void **) &disp->GetQueryivARB;
- snprintf(symboln, sizeof(symboln), "%sGetQueryiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetQueryivARB) {
- void ** procp = (void **) &disp->GetQueryivARB;
- snprintf(symboln, sizeof(symboln), "%sGetQueryivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsQueryARB) {
- void ** procp = (void **) &disp->IsQueryARB;
- snprintf(symboln, sizeof(symboln), "%sIsQuery", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsQueryARB) {
- void ** procp = (void **) &disp->IsQueryARB;
- snprintf(symboln, sizeof(symboln), "%sIsQueryARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->AttachObjectARB) {
- void ** procp = (void **) &disp->AttachObjectARB;
- snprintf(symboln, sizeof(symboln), "%sAttachObjectARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompileShaderARB) {
- void ** procp = (void **) &disp->CompileShaderARB;
- snprintf(symboln, sizeof(symboln), "%sCompileShader", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CompileShaderARB) {
- void ** procp = (void **) &disp->CompileShaderARB;
- snprintf(symboln, sizeof(symboln), "%sCompileShaderARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CreateProgramObjectARB) {
- void ** procp = (void **) &disp->CreateProgramObjectARB;
- snprintf(symboln, sizeof(symboln), "%sCreateProgramObjectARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CreateShaderObjectARB) {
- void ** procp = (void **) &disp->CreateShaderObjectARB;
- snprintf(symboln, sizeof(symboln), "%sCreateShaderObjectARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteObjectARB) {
- void ** procp = (void **) &disp->DeleteObjectARB;
- snprintf(symboln, sizeof(symboln), "%sDeleteObjectARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DetachObjectARB) {
- void ** procp = (void **) &disp->DetachObjectARB;
- snprintf(symboln, sizeof(symboln), "%sDetachObjectARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetActiveUniformARB) {
- void ** procp = (void **) &disp->GetActiveUniformARB;
- snprintf(symboln, sizeof(symboln), "%sGetActiveUniform", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetActiveUniformARB) {
- void ** procp = (void **) &disp->GetActiveUniformARB;
- snprintf(symboln, sizeof(symboln), "%sGetActiveUniformARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetAttachedObjectsARB) {
- void ** procp = (void **) &disp->GetAttachedObjectsARB;
- snprintf(symboln, sizeof(symboln), "%sGetAttachedObjectsARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetHandleARB) {
- void ** procp = (void **) &disp->GetHandleARB;
- snprintf(symboln, sizeof(symboln), "%sGetHandleARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetInfoLogARB) {
- void ** procp = (void **) &disp->GetInfoLogARB;
- snprintf(symboln, sizeof(symboln), "%sGetInfoLogARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetObjectParameterfvARB) {
- void ** procp = (void **) &disp->GetObjectParameterfvARB;
- snprintf(symboln, sizeof(symboln), "%sGetObjectParameterfvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetObjectParameterivARB) {
- void ** procp = (void **) &disp->GetObjectParameterivARB;
- snprintf(symboln, sizeof(symboln), "%sGetObjectParameterivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetShaderSourceARB) {
- void ** procp = (void **) &disp->GetShaderSourceARB;
- snprintf(symboln, sizeof(symboln), "%sGetShaderSource", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetShaderSourceARB) {
- void ** procp = (void **) &disp->GetShaderSourceARB;
- snprintf(symboln, sizeof(symboln), "%sGetShaderSourceARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetUniformLocationARB) {
- void ** procp = (void **) &disp->GetUniformLocationARB;
- snprintf(symboln, sizeof(symboln), "%sGetUniformLocation", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetUniformLocationARB) {
- void ** procp = (void **) &disp->GetUniformLocationARB;
- snprintf(symboln, sizeof(symboln), "%sGetUniformLocationARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetUniformfvARB) {
- void ** procp = (void **) &disp->GetUniformfvARB;
- snprintf(symboln, sizeof(symboln), "%sGetUniformfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetUniformfvARB) {
- void ** procp = (void **) &disp->GetUniformfvARB;
- snprintf(symboln, sizeof(symboln), "%sGetUniformfvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetUniformivARB) {
- void ** procp = (void **) &disp->GetUniformivARB;
- snprintf(symboln, sizeof(symboln), "%sGetUniformiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetUniformivARB) {
- void ** procp = (void **) &disp->GetUniformivARB;
- snprintf(symboln, sizeof(symboln), "%sGetUniformivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LinkProgramARB) {
- void ** procp = (void **) &disp->LinkProgramARB;
- snprintf(symboln, sizeof(symboln), "%sLinkProgram", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LinkProgramARB) {
- void ** procp = (void **) &disp->LinkProgramARB;
- snprintf(symboln, sizeof(symboln), "%sLinkProgramARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ShaderSourceARB) {
- void ** procp = (void **) &disp->ShaderSourceARB;
- snprintf(symboln, sizeof(symboln), "%sShaderSource", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ShaderSourceARB) {
- void ** procp = (void **) &disp->ShaderSourceARB;
- snprintf(symboln, sizeof(symboln), "%sShaderSourceARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1fARB) {
- void ** procp = (void **) &disp->Uniform1fARB;
- snprintf(symboln, sizeof(symboln), "%sUniform1f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1fARB) {
- void ** procp = (void **) &disp->Uniform1fARB;
- snprintf(symboln, sizeof(symboln), "%sUniform1fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1fvARB) {
- void ** procp = (void **) &disp->Uniform1fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniform1fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1fvARB) {
- void ** procp = (void **) &disp->Uniform1fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniform1fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1iARB) {
- void ** procp = (void **) &disp->Uniform1iARB;
- snprintf(symboln, sizeof(symboln), "%sUniform1i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1iARB) {
- void ** procp = (void **) &disp->Uniform1iARB;
- snprintf(symboln, sizeof(symboln), "%sUniform1iARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1ivARB) {
- void ** procp = (void **) &disp->Uniform1ivARB;
- snprintf(symboln, sizeof(symboln), "%sUniform1iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1ivARB) {
- void ** procp = (void **) &disp->Uniform1ivARB;
- snprintf(symboln, sizeof(symboln), "%sUniform1ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2fARB) {
- void ** procp = (void **) &disp->Uniform2fARB;
- snprintf(symboln, sizeof(symboln), "%sUniform2f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2fARB) {
- void ** procp = (void **) &disp->Uniform2fARB;
- snprintf(symboln, sizeof(symboln), "%sUniform2fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2fvARB) {
- void ** procp = (void **) &disp->Uniform2fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniform2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2fvARB) {
- void ** procp = (void **) &disp->Uniform2fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniform2fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2iARB) {
- void ** procp = (void **) &disp->Uniform2iARB;
- snprintf(symboln, sizeof(symboln), "%sUniform2i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2iARB) {
- void ** procp = (void **) &disp->Uniform2iARB;
- snprintf(symboln, sizeof(symboln), "%sUniform2iARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2ivARB) {
- void ** procp = (void **) &disp->Uniform2ivARB;
- snprintf(symboln, sizeof(symboln), "%sUniform2iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2ivARB) {
- void ** procp = (void **) &disp->Uniform2ivARB;
- snprintf(symboln, sizeof(symboln), "%sUniform2ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3fARB) {
- void ** procp = (void **) &disp->Uniform3fARB;
- snprintf(symboln, sizeof(symboln), "%sUniform3f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3fARB) {
- void ** procp = (void **) &disp->Uniform3fARB;
- snprintf(symboln, sizeof(symboln), "%sUniform3fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3fvARB) {
- void ** procp = (void **) &disp->Uniform3fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniform3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3fvARB) {
- void ** procp = (void **) &disp->Uniform3fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniform3fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3iARB) {
- void ** procp = (void **) &disp->Uniform3iARB;
- snprintf(symboln, sizeof(symboln), "%sUniform3i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3iARB) {
- void ** procp = (void **) &disp->Uniform3iARB;
- snprintf(symboln, sizeof(symboln), "%sUniform3iARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3ivARB) {
- void ** procp = (void **) &disp->Uniform3ivARB;
- snprintf(symboln, sizeof(symboln), "%sUniform3iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3ivARB) {
- void ** procp = (void **) &disp->Uniform3ivARB;
- snprintf(symboln, sizeof(symboln), "%sUniform3ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4fARB) {
- void ** procp = (void **) &disp->Uniform4fARB;
- snprintf(symboln, sizeof(symboln), "%sUniform4f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4fARB) {
- void ** procp = (void **) &disp->Uniform4fARB;
- snprintf(symboln, sizeof(symboln), "%sUniform4fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4fvARB) {
- void ** procp = (void **) &disp->Uniform4fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniform4fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4fvARB) {
- void ** procp = (void **) &disp->Uniform4fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniform4fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4iARB) {
- void ** procp = (void **) &disp->Uniform4iARB;
- snprintf(symboln, sizeof(symboln), "%sUniform4i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4iARB) {
- void ** procp = (void **) &disp->Uniform4iARB;
- snprintf(symboln, sizeof(symboln), "%sUniform4iARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4ivARB) {
- void ** procp = (void **) &disp->Uniform4ivARB;
- snprintf(symboln, sizeof(symboln), "%sUniform4iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4ivARB) {
- void ** procp = (void **) &disp->Uniform4ivARB;
- snprintf(symboln, sizeof(symboln), "%sUniform4ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix2fvARB) {
- void ** procp = (void **) &disp->UniformMatrix2fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix2fvARB) {
- void ** procp = (void **) &disp->UniformMatrix2fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix2fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix3fvARB) {
- void ** procp = (void **) &disp->UniformMatrix3fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix3fvARB) {
- void ** procp = (void **) &disp->UniformMatrix3fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix3fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix4fvARB) {
- void ** procp = (void **) &disp->UniformMatrix4fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix4fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UniformMatrix4fvARB) {
- void ** procp = (void **) &disp->UniformMatrix4fvARB;
- snprintf(symboln, sizeof(symboln), "%sUniformMatrix4fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UseProgramObjectARB) {
- void ** procp = (void **) &disp->UseProgramObjectARB;
- snprintf(symboln, sizeof(symboln), "%sUseProgram", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UseProgramObjectARB) {
- void ** procp = (void **) &disp->UseProgramObjectARB;
- snprintf(symboln, sizeof(symboln), "%sUseProgramObjectARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ValidateProgramARB) {
- void ** procp = (void **) &disp->ValidateProgramARB;
- snprintf(symboln, sizeof(symboln), "%sValidateProgram", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ValidateProgramARB) {
- void ** procp = (void **) &disp->ValidateProgramARB;
- snprintf(symboln, sizeof(symboln), "%sValidateProgramARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindAttribLocationARB) {
- void ** procp = (void **) &disp->BindAttribLocationARB;
- snprintf(symboln, sizeof(symboln), "%sBindAttribLocation", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindAttribLocationARB) {
- void ** procp = (void **) &disp->BindAttribLocationARB;
- snprintf(symboln, sizeof(symboln), "%sBindAttribLocationARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetActiveAttribARB) {
- void ** procp = (void **) &disp->GetActiveAttribARB;
- snprintf(symboln, sizeof(symboln), "%sGetActiveAttrib", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetActiveAttribARB) {
- void ** procp = (void **) &disp->GetActiveAttribARB;
- snprintf(symboln, sizeof(symboln), "%sGetActiveAttribARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetAttribLocationARB) {
- void ** procp = (void **) &disp->GetAttribLocationARB;
- snprintf(symboln, sizeof(symboln), "%sGetAttribLocation", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetAttribLocationARB) {
- void ** procp = (void **) &disp->GetAttribLocationARB;
- snprintf(symboln, sizeof(symboln), "%sGetAttribLocationARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawBuffersARB) {
- void ** procp = (void **) &disp->DrawBuffersARB;
- snprintf(symboln, sizeof(symboln), "%sDrawBuffers", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawBuffersARB) {
- void ** procp = (void **) &disp->DrawBuffersARB;
- snprintf(symboln, sizeof(symboln), "%sDrawBuffersARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawBuffersARB) {
- void ** procp = (void **) &disp->DrawBuffersARB;
- snprintf(symboln, sizeof(symboln), "%sDrawBuffersATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawBuffersARB) {
- void ** procp = (void **) &disp->DrawBuffersARB;
- snprintf(symboln, sizeof(symboln), "%sDrawBuffersNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClampColorARB) {
- void ** procp = (void **) &disp->ClampColorARB;
- snprintf(symboln, sizeof(symboln), "%sClampColorARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawArraysInstancedARB) {
- void ** procp = (void **) &disp->DrawArraysInstancedARB;
- snprintf(symboln, sizeof(symboln), "%sDrawArraysInstancedARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawArraysInstancedARB) {
- void ** procp = (void **) &disp->DrawArraysInstancedARB;
- snprintf(symboln, sizeof(symboln), "%sDrawArraysInstancedEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawArraysInstancedARB) {
- void ** procp = (void **) &disp->DrawArraysInstancedARB;
- snprintf(symboln, sizeof(symboln), "%sDrawArraysInstanced", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawElementsInstancedARB) {
- void ** procp = (void **) &disp->DrawElementsInstancedARB;
- snprintf(symboln, sizeof(symboln), "%sDrawElementsInstancedARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawElementsInstancedARB) {
- void ** procp = (void **) &disp->DrawElementsInstancedARB;
- snprintf(symboln, sizeof(symboln), "%sDrawElementsInstancedEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawElementsInstancedARB) {
- void ** procp = (void **) &disp->DrawElementsInstancedARB;
- snprintf(symboln, sizeof(symboln), "%sDrawElementsInstanced", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RenderbufferStorageMultisample) {
- void ** procp = (void **) &disp->RenderbufferStorageMultisample;
- snprintf(symboln, sizeof(symboln), "%sRenderbufferStorageMultisample", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RenderbufferStorageMultisample) {
- void ** procp = (void **) &disp->RenderbufferStorageMultisample;
- snprintf(symboln, sizeof(symboln), "%sRenderbufferStorageMultisampleEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTextureARB) {
- void ** procp = (void **) &disp->FramebufferTextureARB;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTextureARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTextureFaceARB) {
- void ** procp = (void **) &disp->FramebufferTextureFaceARB;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTextureFaceARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramParameteriARB) {
- void ** procp = (void **) &disp->ProgramParameteriARB;
- snprintf(symboln, sizeof(symboln), "%sProgramParameteriARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribDivisorARB) {
- void ** procp = (void **) &disp->VertexAttribDivisorARB;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribDivisorARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FlushMappedBufferRange) {
- void ** procp = (void **) &disp->FlushMappedBufferRange;
- snprintf(symboln, sizeof(symboln), "%sFlushMappedBufferRange", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MapBufferRange) {
- void ** procp = (void **) &disp->MapBufferRange;
- snprintf(symboln, sizeof(symboln), "%sMapBufferRange", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexBufferARB) {
- void ** procp = (void **) &disp->TexBufferARB;
- snprintf(symboln, sizeof(symboln), "%sTexBufferARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindVertexArray) {
- void ** procp = (void **) &disp->BindVertexArray;
- snprintf(symboln, sizeof(symboln), "%sBindVertexArray", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenVertexArrays) {
- void ** procp = (void **) &disp->GenVertexArrays;
- snprintf(symboln, sizeof(symboln), "%sGenVertexArrays", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CopyBufferSubData) {
- void ** procp = (void **) &disp->CopyBufferSubData;
- snprintf(symboln, sizeof(symboln), "%sCopyBufferSubData", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClientWaitSync) {
- void ** procp = (void **) &disp->ClientWaitSync;
- snprintf(symboln, sizeof(symboln), "%sClientWaitSync", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteSync) {
- void ** procp = (void **) &disp->DeleteSync;
- snprintf(symboln, sizeof(symboln), "%sDeleteSync", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FenceSync) {
- void ** procp = (void **) &disp->FenceSync;
- snprintf(symboln, sizeof(symboln), "%sFenceSync", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetInteger64v) {
- void ** procp = (void **) &disp->GetInteger64v;
- snprintf(symboln, sizeof(symboln), "%sGetInteger64v", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetSynciv) {
- void ** procp = (void **) &disp->GetSynciv;
- snprintf(symboln, sizeof(symboln), "%sGetSynciv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsSync) {
- void ** procp = (void **) &disp->IsSync;
- snprintf(symboln, sizeof(symboln), "%sIsSync", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WaitSync) {
- void ** procp = (void **) &disp->WaitSync;
- snprintf(symboln, sizeof(symboln), "%sWaitSync", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawElementsBaseVertex) {
- void ** procp = (void **) &disp->DrawElementsBaseVertex;
- snprintf(symboln, sizeof(symboln), "%sDrawElementsBaseVertex", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawElementsInstancedBaseVertex) {
- void ** procp = (void **) &disp->DrawElementsInstancedBaseVertex;
- snprintf(symboln, sizeof(symboln), "%sDrawElementsInstancedBaseVertex", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawRangeElementsBaseVertex) {
- void ** procp = (void **) &disp->DrawRangeElementsBaseVertex;
- snprintf(symboln, sizeof(symboln), "%sDrawRangeElementsBaseVertex", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiDrawElementsBaseVertex) {
- void ** procp = (void **) &disp->MultiDrawElementsBaseVertex;
- snprintf(symboln, sizeof(symboln), "%sMultiDrawElementsBaseVertex", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendEquationSeparateiARB) {
- void ** procp = (void **) &disp->BlendEquationSeparateiARB;
- snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateiARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendEquationSeparateiARB) {
- void ** procp = (void **) &disp->BlendEquationSeparateiARB;
- snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateIndexedAMD", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendEquationiARB) {
- void ** procp = (void **) &disp->BlendEquationiARB;
- snprintf(symboln, sizeof(symboln), "%sBlendEquationiARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendEquationiARB) {
- void ** procp = (void **) &disp->BlendEquationiARB;
- snprintf(symboln, sizeof(symboln), "%sBlendEquationIndexedAMD", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendFuncSeparateiARB) {
- void ** procp = (void **) &disp->BlendFuncSeparateiARB;
- snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateiARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendFuncSeparateiARB) {
- void ** procp = (void **) &disp->BlendFuncSeparateiARB;
- snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateIndexedAMD", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendFunciARB) {
- void ** procp = (void **) &disp->BlendFunciARB;
- snprintf(symboln, sizeof(symboln), "%sBlendFunciARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendFunciARB) {
- void ** procp = (void **) &disp->BlendFunciARB;
- snprintf(symboln, sizeof(symboln), "%sBlendFuncIndexedAMD", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindSampler) {
- void ** procp = (void **) &disp->BindSampler;
- snprintf(symboln, sizeof(symboln), "%sBindSampler", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteSamplers) {
- void ** procp = (void **) &disp->DeleteSamplers;
- snprintf(symboln, sizeof(symboln), "%sDeleteSamplers", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenSamplers) {
- void ** procp = (void **) &disp->GenSamplers;
- snprintf(symboln, sizeof(symboln), "%sGenSamplers", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetSamplerParameterIiv) {
- void ** procp = (void **) &disp->GetSamplerParameterIiv;
- snprintf(symboln, sizeof(symboln), "%sGetSamplerParameterIiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetSamplerParameterIuiv) {
- void ** procp = (void **) &disp->GetSamplerParameterIuiv;
- snprintf(symboln, sizeof(symboln), "%sGetSamplerParameterIuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetSamplerParameterfv) {
- void ** procp = (void **) &disp->GetSamplerParameterfv;
- snprintf(symboln, sizeof(symboln), "%sGetSamplerParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetSamplerParameteriv) {
- void ** procp = (void **) &disp->GetSamplerParameteriv;
- snprintf(symboln, sizeof(symboln), "%sGetSamplerParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsSampler) {
- void ** procp = (void **) &disp->IsSampler;
- snprintf(symboln, sizeof(symboln), "%sIsSampler", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SamplerParameterIiv) {
- void ** procp = (void **) &disp->SamplerParameterIiv;
- snprintf(symboln, sizeof(symboln), "%sSamplerParameterIiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SamplerParameterIuiv) {
- void ** procp = (void **) &disp->SamplerParameterIuiv;
- snprintf(symboln, sizeof(symboln), "%sSamplerParameterIuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SamplerParameterf) {
- void ** procp = (void **) &disp->SamplerParameterf;
- snprintf(symboln, sizeof(symboln), "%sSamplerParameterf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SamplerParameterfv) {
- void ** procp = (void **) &disp->SamplerParameterfv;
- snprintf(symboln, sizeof(symboln), "%sSamplerParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SamplerParameteri) {
- void ** procp = (void **) &disp->SamplerParameteri;
- snprintf(symboln, sizeof(symboln), "%sSamplerParameteri", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SamplerParameteriv) {
- void ** procp = (void **) &disp->SamplerParameteriv;
- snprintf(symboln, sizeof(symboln), "%sSamplerParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorP3ui) {
- void ** procp = (void **) &disp->ColorP3ui;
- snprintf(symboln, sizeof(symboln), "%sColorP3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorP3uiv) {
- void ** procp = (void **) &disp->ColorP3uiv;
- snprintf(symboln, sizeof(symboln), "%sColorP3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorP4ui) {
- void ** procp = (void **) &disp->ColorP4ui;
- snprintf(symboln, sizeof(symboln), "%sColorP4ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorP4uiv) {
- void ** procp = (void **) &disp->ColorP4uiv;
- snprintf(symboln, sizeof(symboln), "%sColorP4uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoordP1ui) {
- void ** procp = (void **) &disp->MultiTexCoordP1ui;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP1ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoordP1uiv) {
- void ** procp = (void **) &disp->MultiTexCoordP1uiv;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP1uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoordP2ui) {
- void ** procp = (void **) &disp->MultiTexCoordP2ui;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP2ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoordP2uiv) {
- void ** procp = (void **) &disp->MultiTexCoordP2uiv;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP2uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoordP3ui) {
- void ** procp = (void **) &disp->MultiTexCoordP3ui;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoordP3uiv) {
- void ** procp = (void **) &disp->MultiTexCoordP3uiv;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoordP4ui) {
- void ** procp = (void **) &disp->MultiTexCoordP4ui;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP4ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiTexCoordP4uiv) {
- void ** procp = (void **) &disp->MultiTexCoordP4uiv;
- snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP4uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->NormalP3ui) {
- void ** procp = (void **) &disp->NormalP3ui;
- snprintf(symboln, sizeof(symboln), "%sNormalP3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->NormalP3uiv) {
- void ** procp = (void **) &disp->NormalP3uiv;
- snprintf(symboln, sizeof(symboln), "%sNormalP3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColorP3ui) {
- void ** procp = (void **) &disp->SecondaryColorP3ui;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColorP3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColorP3uiv) {
- void ** procp = (void **) &disp->SecondaryColorP3uiv;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColorP3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoordP1ui) {
- void ** procp = (void **) &disp->TexCoordP1ui;
- snprintf(symboln, sizeof(symboln), "%sTexCoordP1ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoordP1uiv) {
- void ** procp = (void **) &disp->TexCoordP1uiv;
- snprintf(symboln, sizeof(symboln), "%sTexCoordP1uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoordP2ui) {
- void ** procp = (void **) &disp->TexCoordP2ui;
- snprintf(symboln, sizeof(symboln), "%sTexCoordP2ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoordP2uiv) {
- void ** procp = (void **) &disp->TexCoordP2uiv;
- snprintf(symboln, sizeof(symboln), "%sTexCoordP2uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoordP3ui) {
- void ** procp = (void **) &disp->TexCoordP3ui;
- snprintf(symboln, sizeof(symboln), "%sTexCoordP3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoordP3uiv) {
- void ** procp = (void **) &disp->TexCoordP3uiv;
- snprintf(symboln, sizeof(symboln), "%sTexCoordP3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoordP4ui) {
- void ** procp = (void **) &disp->TexCoordP4ui;
- snprintf(symboln, sizeof(symboln), "%sTexCoordP4ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoordP4uiv) {
- void ** procp = (void **) &disp->TexCoordP4uiv;
- snprintf(symboln, sizeof(symboln), "%sTexCoordP4uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribP1ui) {
- void ** procp = (void **) &disp->VertexAttribP1ui;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribP1ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribP1uiv) {
- void ** procp = (void **) &disp->VertexAttribP1uiv;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribP1uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribP2ui) {
- void ** procp = (void **) &disp->VertexAttribP2ui;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribP2ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribP2uiv) {
- void ** procp = (void **) &disp->VertexAttribP2uiv;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribP2uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribP3ui) {
- void ** procp = (void **) &disp->VertexAttribP3ui;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribP3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribP3uiv) {
- void ** procp = (void **) &disp->VertexAttribP3uiv;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribP3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribP4ui) {
- void ** procp = (void **) &disp->VertexAttribP4ui;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribP4ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribP4uiv) {
- void ** procp = (void **) &disp->VertexAttribP4uiv;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribP4uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexP2ui) {
- void ** procp = (void **) &disp->VertexP2ui;
- snprintf(symboln, sizeof(symboln), "%sVertexP2ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexP2uiv) {
- void ** procp = (void **) &disp->VertexP2uiv;
- snprintf(symboln, sizeof(symboln), "%sVertexP2uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexP3ui) {
- void ** procp = (void **) &disp->VertexP3ui;
- snprintf(symboln, sizeof(symboln), "%sVertexP3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexP3uiv) {
- void ** procp = (void **) &disp->VertexP3uiv;
- snprintf(symboln, sizeof(symboln), "%sVertexP3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexP4ui) {
- void ** procp = (void **) &disp->VertexP4ui;
- snprintf(symboln, sizeof(symboln), "%sVertexP4ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexP4uiv) {
- void ** procp = (void **) &disp->VertexP4uiv;
- snprintf(symboln, sizeof(symboln), "%sVertexP4uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindTransformFeedback) {
- void ** procp = (void **) &disp->BindTransformFeedback;
- snprintf(symboln, sizeof(symboln), "%sBindTransformFeedback", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteTransformFeedbacks) {
- void ** procp = (void **) &disp->DeleteTransformFeedbacks;
- snprintf(symboln, sizeof(symboln), "%sDeleteTransformFeedbacks", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DrawTransformFeedback) {
- void ** procp = (void **) &disp->DrawTransformFeedback;
- snprintf(symboln, sizeof(symboln), "%sDrawTransformFeedback", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenTransformFeedbacks) {
- void ** procp = (void **) &disp->GenTransformFeedbacks;
- snprintf(symboln, sizeof(symboln), "%sGenTransformFeedbacks", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsTransformFeedback) {
- void ** procp = (void **) &disp->IsTransformFeedback;
- snprintf(symboln, sizeof(symboln), "%sIsTransformFeedback", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PauseTransformFeedback) {
- void ** procp = (void **) &disp->PauseTransformFeedback;
- snprintf(symboln, sizeof(symboln), "%sPauseTransformFeedback", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ResumeTransformFeedback) {
- void ** procp = (void **) &disp->ResumeTransformFeedback;
- snprintf(symboln, sizeof(symboln), "%sResumeTransformFeedback", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearDepthf) {
- void ** procp = (void **) &disp->ClearDepthf;
- snprintf(symboln, sizeof(symboln), "%sClearDepthf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DepthRangef) {
- void ** procp = (void **) &disp->DepthRangef;
- snprintf(symboln, sizeof(symboln), "%sDepthRangef", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetShaderPrecisionFormat) {
- void ** procp = (void **) &disp->GetShaderPrecisionFormat;
- snprintf(symboln, sizeof(symboln), "%sGetShaderPrecisionFormat", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ReleaseShaderCompiler) {
- void ** procp = (void **) &disp->ReleaseShaderCompiler;
- snprintf(symboln, sizeof(symboln), "%sReleaseShaderCompiler", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ShaderBinary) {
- void ** procp = (void **) &disp->ShaderBinary;
- snprintf(symboln, sizeof(symboln), "%sShaderBinary", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DebugMessageCallbackARB) {
- void ** procp = (void **) &disp->DebugMessageCallbackARB;
- snprintf(symboln, sizeof(symboln), "%sDebugMessageCallbackARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DebugMessageControlARB) {
- void ** procp = (void **) &disp->DebugMessageControlARB;
- snprintf(symboln, sizeof(symboln), "%sDebugMessageControlARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DebugMessageInsertARB) {
- void ** procp = (void **) &disp->DebugMessageInsertARB;
- snprintf(symboln, sizeof(symboln), "%sDebugMessageInsertARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetDebugMessageLogARB) {
- void ** procp = (void **) &disp->GetDebugMessageLogARB;
- snprintf(symboln, sizeof(symboln), "%sGetDebugMessageLogARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetGraphicsResetStatusARB) {
- void ** procp = (void **) &disp->GetGraphicsResetStatusARB;
- snprintf(symboln, sizeof(symboln), "%sGetGraphicsResetStatusARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnColorTableARB) {
- void ** procp = (void **) &disp->GetnColorTableARB;
- snprintf(symboln, sizeof(symboln), "%sGetnColorTableARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnCompressedTexImageARB) {
- void ** procp = (void **) &disp->GetnCompressedTexImageARB;
- snprintf(symboln, sizeof(symboln), "%sGetnCompressedTexImageARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnConvolutionFilterARB) {
- void ** procp = (void **) &disp->GetnConvolutionFilterARB;
- snprintf(symboln, sizeof(symboln), "%sGetnConvolutionFilterARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnHistogramARB) {
- void ** procp = (void **) &disp->GetnHistogramARB;
- snprintf(symboln, sizeof(symboln), "%sGetnHistogramARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnMapdvARB) {
- void ** procp = (void **) &disp->GetnMapdvARB;
- snprintf(symboln, sizeof(symboln), "%sGetnMapdvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnMapfvARB) {
- void ** procp = (void **) &disp->GetnMapfvARB;
- snprintf(symboln, sizeof(symboln), "%sGetnMapfvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnMapivARB) {
- void ** procp = (void **) &disp->GetnMapivARB;
- snprintf(symboln, sizeof(symboln), "%sGetnMapivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnMinmaxARB) {
- void ** procp = (void **) &disp->GetnMinmaxARB;
- snprintf(symboln, sizeof(symboln), "%sGetnMinmaxARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnPixelMapfvARB) {
- void ** procp = (void **) &disp->GetnPixelMapfvARB;
- snprintf(symboln, sizeof(symboln), "%sGetnPixelMapfvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnPixelMapuivARB) {
- void ** procp = (void **) &disp->GetnPixelMapuivARB;
- snprintf(symboln, sizeof(symboln), "%sGetnPixelMapuivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnPixelMapusvARB) {
- void ** procp = (void **) &disp->GetnPixelMapusvARB;
- snprintf(symboln, sizeof(symboln), "%sGetnPixelMapusvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnPolygonStippleARB) {
- void ** procp = (void **) &disp->GetnPolygonStippleARB;
- snprintf(symboln, sizeof(symboln), "%sGetnPolygonStippleARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnSeparableFilterARB) {
- void ** procp = (void **) &disp->GetnSeparableFilterARB;
- snprintf(symboln, sizeof(symboln), "%sGetnSeparableFilterARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnTexImageARB) {
- void ** procp = (void **) &disp->GetnTexImageARB;
- snprintf(symboln, sizeof(symboln), "%sGetnTexImageARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnUniformdvARB) {
- void ** procp = (void **) &disp->GetnUniformdvARB;
- snprintf(symboln, sizeof(symboln), "%sGetnUniformdvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnUniformfvARB) {
- void ** procp = (void **) &disp->GetnUniformfvARB;
- snprintf(symboln, sizeof(symboln), "%sGetnUniformfvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnUniformivARB) {
- void ** procp = (void **) &disp->GetnUniformivARB;
- snprintf(symboln, sizeof(symboln), "%sGetnUniformivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetnUniformuivARB) {
- void ** procp = (void **) &disp->GetnUniformuivARB;
- snprintf(symboln, sizeof(symboln), "%sGetnUniformuivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ReadnPixelsARB) {
- void ** procp = (void **) &disp->ReadnPixelsARB;
- snprintf(symboln, sizeof(symboln), "%sReadnPixelsARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexStorage1D) {
- void ** procp = (void **) &disp->TexStorage1D;
- snprintf(symboln, sizeof(symboln), "%sTexStorage1D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexStorage2D) {
- void ** procp = (void **) &disp->TexStorage2D;
- snprintf(symboln, sizeof(symboln), "%sTexStorage2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexStorage3D) {
- void ** procp = (void **) &disp->TexStorage3D;
- snprintf(symboln, sizeof(symboln), "%sTexStorage3D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TextureStorage1DEXT) {
- void ** procp = (void **) &disp->TextureStorage1DEXT;
- snprintf(symboln, sizeof(symboln), "%sTextureStorage1DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TextureStorage2DEXT) {
- void ** procp = (void **) &disp->TextureStorage2DEXT;
- snprintf(symboln, sizeof(symboln), "%sTextureStorage2DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TextureStorage3DEXT) {
- void ** procp = (void **) &disp->TextureStorage3DEXT;
- snprintf(symboln, sizeof(symboln), "%sTextureStorage3DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PolygonOffsetEXT) {
- void ** procp = (void **) &disp->PolygonOffsetEXT;
- snprintf(symboln, sizeof(symboln), "%sPolygonOffsetEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetPixelTexGenParameterfvSGIS) {
- void ** procp = (void **) &disp->GetPixelTexGenParameterfvSGIS;
- snprintf(symboln, sizeof(symboln), "%sGetPixelTexGenParameterfvSGIS", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetPixelTexGenParameterivSGIS) {
- void ** procp = (void **) &disp->GetPixelTexGenParameterivSGIS;
- snprintf(symboln, sizeof(symboln), "%sGetPixelTexGenParameterivSGIS", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelTexGenParameterfSGIS) {
- void ** procp = (void **) &disp->PixelTexGenParameterfSGIS;
- snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameterfSGIS", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelTexGenParameterfvSGIS) {
- void ** procp = (void **) &disp->PixelTexGenParameterfvSGIS;
- snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameterfvSGIS", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelTexGenParameteriSGIS) {
- void ** procp = (void **) &disp->PixelTexGenParameteriSGIS;
- snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameteriSGIS", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelTexGenParameterivSGIS) {
- void ** procp = (void **) &disp->PixelTexGenParameterivSGIS;
- snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameterivSGIS", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SampleMaskSGIS) {
- void ** procp = (void **) &disp->SampleMaskSGIS;
- snprintf(symboln, sizeof(symboln), "%sSampleMaskSGIS", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SampleMaskSGIS) {
- void ** procp = (void **) &disp->SampleMaskSGIS;
- snprintf(symboln, sizeof(symboln), "%sSampleMaskEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SamplePatternSGIS) {
- void ** procp = (void **) &disp->SamplePatternSGIS;
- snprintf(symboln, sizeof(symboln), "%sSamplePatternSGIS", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SamplePatternSGIS) {
- void ** procp = (void **) &disp->SamplePatternSGIS;
- snprintf(symboln, sizeof(symboln), "%sSamplePatternEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorPointerEXT) {
- void ** procp = (void **) &disp->ColorPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sColorPointerEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EdgeFlagPointerEXT) {
- void ** procp = (void **) &disp->EdgeFlagPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sEdgeFlagPointerEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IndexPointerEXT) {
- void ** procp = (void **) &disp->IndexPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sIndexPointerEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->NormalPointerEXT) {
- void ** procp = (void **) &disp->NormalPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sNormalPointerEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexCoordPointerEXT) {
- void ** procp = (void **) &disp->TexCoordPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sTexCoordPointerEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexPointerEXT) {
- void ** procp = (void **) &disp->VertexPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexPointerEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameterfEXT) {
- void ** procp = (void **) &disp->PointParameterfEXT;
- snprintf(symboln, sizeof(symboln), "%sPointParameterf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameterfEXT) {
- void ** procp = (void **) &disp->PointParameterfEXT;
- snprintf(symboln, sizeof(symboln), "%sPointParameterfARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameterfEXT) {
- void ** procp = (void **) &disp->PointParameterfEXT;
- snprintf(symboln, sizeof(symboln), "%sPointParameterfEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameterfEXT) {
- void ** procp = (void **) &disp->PointParameterfEXT;
- snprintf(symboln, sizeof(symboln), "%sPointParameterfSGIS", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameterfvEXT) {
- void ** procp = (void **) &disp->PointParameterfvEXT;
- snprintf(symboln, sizeof(symboln), "%sPointParameterfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameterfvEXT) {
- void ** procp = (void **) &disp->PointParameterfvEXT;
- snprintf(symboln, sizeof(symboln), "%sPointParameterfvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameterfvEXT) {
- void ** procp = (void **) &disp->PointParameterfvEXT;
- snprintf(symboln, sizeof(symboln), "%sPointParameterfvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameterfvEXT) {
- void ** procp = (void **) &disp->PointParameterfvEXT;
- snprintf(symboln, sizeof(symboln), "%sPointParameterfvSGIS", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LockArraysEXT) {
- void ** procp = (void **) &disp->LockArraysEXT;
- snprintf(symboln, sizeof(symboln), "%sLockArraysEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UnlockArraysEXT) {
- void ** procp = (void **) &disp->UnlockArraysEXT;
- snprintf(symboln, sizeof(symboln), "%sUnlockArraysEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3bEXT) {
- void ** procp = (void **) &disp->SecondaryColor3bEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3b", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3bEXT) {
- void ** procp = (void **) &disp->SecondaryColor3bEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3bEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3bvEXT) {
- void ** procp = (void **) &disp->SecondaryColor3bvEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3bv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3bvEXT) {
- void ** procp = (void **) &disp->SecondaryColor3bvEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3bvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3dEXT) {
- void ** procp = (void **) &disp->SecondaryColor3dEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3dEXT) {
- void ** procp = (void **) &disp->SecondaryColor3dEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3dEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3dvEXT) {
- void ** procp = (void **) &disp->SecondaryColor3dvEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3dvEXT) {
- void ** procp = (void **) &disp->SecondaryColor3dvEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3dvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3fEXT) {
- void ** procp = (void **) &disp->SecondaryColor3fEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3fEXT) {
- void ** procp = (void **) &disp->SecondaryColor3fEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3fEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3fvEXT) {
- void ** procp = (void **) &disp->SecondaryColor3fvEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3fvEXT) {
- void ** procp = (void **) &disp->SecondaryColor3fvEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3fvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3iEXT) {
- void ** procp = (void **) &disp->SecondaryColor3iEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3iEXT) {
- void ** procp = (void **) &disp->SecondaryColor3iEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3iEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3ivEXT) {
- void ** procp = (void **) &disp->SecondaryColor3ivEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3ivEXT) {
- void ** procp = (void **) &disp->SecondaryColor3ivEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3sEXT) {
- void ** procp = (void **) &disp->SecondaryColor3sEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3sEXT) {
- void ** procp = (void **) &disp->SecondaryColor3sEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3sEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3svEXT) {
- void ** procp = (void **) &disp->SecondaryColor3svEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3svEXT) {
- void ** procp = (void **) &disp->SecondaryColor3svEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3svEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3ubEXT) {
- void ** procp = (void **) &disp->SecondaryColor3ubEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ub", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3ubEXT) {
- void ** procp = (void **) &disp->SecondaryColor3ubEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ubEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3ubvEXT) {
- void ** procp = (void **) &disp->SecondaryColor3ubvEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ubv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3ubvEXT) {
- void ** procp = (void **) &disp->SecondaryColor3ubvEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ubvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3uiEXT) {
- void ** procp = (void **) &disp->SecondaryColor3uiEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3uiEXT) {
- void ** procp = (void **) &disp->SecondaryColor3uiEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3uiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3uivEXT) {
- void ** procp = (void **) &disp->SecondaryColor3uivEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3uivEXT) {
- void ** procp = (void **) &disp->SecondaryColor3uivEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3uivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3usEXT) {
- void ** procp = (void **) &disp->SecondaryColor3usEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3us", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3usEXT) {
- void ** procp = (void **) &disp->SecondaryColor3usEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3usEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3usvEXT) {
- void ** procp = (void **) &disp->SecondaryColor3usvEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3usv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColor3usvEXT) {
- void ** procp = (void **) &disp->SecondaryColor3usvEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColor3usvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColorPointerEXT) {
- void ** procp = (void **) &disp->SecondaryColorPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColorPointer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SecondaryColorPointerEXT) {
- void ** procp = (void **) &disp->SecondaryColorPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sSecondaryColorPointerEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiDrawArraysEXT) {
- void ** procp = (void **) &disp->MultiDrawArraysEXT;
- snprintf(symboln, sizeof(symboln), "%sMultiDrawArrays", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiDrawArraysEXT) {
- void ** procp = (void **) &disp->MultiDrawArraysEXT;
- snprintf(symboln, sizeof(symboln), "%sMultiDrawArraysEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiDrawElementsEXT) {
- void ** procp = (void **) &disp->MultiDrawElementsEXT;
- snprintf(symboln, sizeof(symboln), "%sMultiDrawElements", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiDrawElementsEXT) {
- void ** procp = (void **) &disp->MultiDrawElementsEXT;
- snprintf(symboln, sizeof(symboln), "%sMultiDrawElementsEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FogCoordPointerEXT) {
- void ** procp = (void **) &disp->FogCoordPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sFogCoordPointer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FogCoordPointerEXT) {
- void ** procp = (void **) &disp->FogCoordPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sFogCoordPointerEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FogCoorddEXT) {
- void ** procp = (void **) &disp->FogCoorddEXT;
- snprintf(symboln, sizeof(symboln), "%sFogCoordd", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FogCoorddEXT) {
- void ** procp = (void **) &disp->FogCoorddEXT;
- snprintf(symboln, sizeof(symboln), "%sFogCoorddEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FogCoorddvEXT) {
- void ** procp = (void **) &disp->FogCoorddvEXT;
- snprintf(symboln, sizeof(symboln), "%sFogCoorddv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FogCoorddvEXT) {
- void ** procp = (void **) &disp->FogCoorddvEXT;
- snprintf(symboln, sizeof(symboln), "%sFogCoorddvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FogCoordfEXT) {
- void ** procp = (void **) &disp->FogCoordfEXT;
- snprintf(symboln, sizeof(symboln), "%sFogCoordf", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FogCoordfEXT) {
- void ** procp = (void **) &disp->FogCoordfEXT;
- snprintf(symboln, sizeof(symboln), "%sFogCoordfEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FogCoordfvEXT) {
- void ** procp = (void **) &disp->FogCoordfvEXT;
- snprintf(symboln, sizeof(symboln), "%sFogCoordfv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FogCoordfvEXT) {
- void ** procp = (void **) &disp->FogCoordfvEXT;
- snprintf(symboln, sizeof(symboln), "%sFogCoordfvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PixelTexGenSGIX) {
- void ** procp = (void **) &disp->PixelTexGenSGIX;
- snprintf(symboln, sizeof(symboln), "%sPixelTexGenSGIX", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendFuncSeparateEXT) {
- void ** procp = (void **) &disp->BlendFuncSeparateEXT;
- snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparate", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendFuncSeparateEXT) {
- void ** procp = (void **) &disp->BlendFuncSeparateEXT;
- snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendFuncSeparateEXT) {
- void ** procp = (void **) &disp->BlendFuncSeparateEXT;
- snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateINGR", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FlushVertexArrayRangeNV) {
- void ** procp = (void **) &disp->FlushVertexArrayRangeNV;
- snprintf(symboln, sizeof(symboln), "%sFlushVertexArrayRangeNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexArrayRangeNV) {
- void ** procp = (void **) &disp->VertexArrayRangeNV;
- snprintf(symboln, sizeof(symboln), "%sVertexArrayRangeNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CombinerInputNV) {
- void ** procp = (void **) &disp->CombinerInputNV;
- snprintf(symboln, sizeof(symboln), "%sCombinerInputNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CombinerOutputNV) {
- void ** procp = (void **) &disp->CombinerOutputNV;
- snprintf(symboln, sizeof(symboln), "%sCombinerOutputNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CombinerParameterfNV) {
- void ** procp = (void **) &disp->CombinerParameterfNV;
- snprintf(symboln, sizeof(symboln), "%sCombinerParameterfNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CombinerParameterfvNV) {
- void ** procp = (void **) &disp->CombinerParameterfvNV;
- snprintf(symboln, sizeof(symboln), "%sCombinerParameterfvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CombinerParameteriNV) {
- void ** procp = (void **) &disp->CombinerParameteriNV;
- snprintf(symboln, sizeof(symboln), "%sCombinerParameteriNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CombinerParameterivNV) {
- void ** procp = (void **) &disp->CombinerParameterivNV;
- snprintf(symboln, sizeof(symboln), "%sCombinerParameterivNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FinalCombinerInputNV) {
- void ** procp = (void **) &disp->FinalCombinerInputNV;
- snprintf(symboln, sizeof(symboln), "%sFinalCombinerInputNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetCombinerInputParameterfvNV) {
- void ** procp = (void **) &disp->GetCombinerInputParameterfvNV;
- snprintf(symboln, sizeof(symboln), "%sGetCombinerInputParameterfvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetCombinerInputParameterivNV) {
- void ** procp = (void **) &disp->GetCombinerInputParameterivNV;
- snprintf(symboln, sizeof(symboln), "%sGetCombinerInputParameterivNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetCombinerOutputParameterfvNV) {
- void ** procp = (void **) &disp->GetCombinerOutputParameterfvNV;
- snprintf(symboln, sizeof(symboln), "%sGetCombinerOutputParameterfvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetCombinerOutputParameterivNV) {
- void ** procp = (void **) &disp->GetCombinerOutputParameterivNV;
- snprintf(symboln, sizeof(symboln), "%sGetCombinerOutputParameterivNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetFinalCombinerInputParameterfvNV) {
- void ** procp = (void **) &disp->GetFinalCombinerInputParameterfvNV;
- snprintf(symboln, sizeof(symboln), "%sGetFinalCombinerInputParameterfvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetFinalCombinerInputParameterivNV) {
- void ** procp = (void **) &disp->GetFinalCombinerInputParameterivNV;
- snprintf(symboln, sizeof(symboln), "%sGetFinalCombinerInputParameterivNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ResizeBuffersMESA) {
- void ** procp = (void **) &disp->ResizeBuffersMESA;
- snprintf(symboln, sizeof(symboln), "%sResizeBuffersMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2dMESA) {
- void ** procp = (void **) &disp->WindowPos2dMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2dMESA) {
- void ** procp = (void **) &disp->WindowPos2dMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2dMESA) {
- void ** procp = (void **) &disp->WindowPos2dMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2dMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2dvMESA) {
- void ** procp = (void **) &disp->WindowPos2dvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2dvMESA) {
- void ** procp = (void **) &disp->WindowPos2dvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2dvMESA) {
- void ** procp = (void **) &disp->WindowPos2dvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2dvMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2fMESA) {
- void ** procp = (void **) &disp->WindowPos2fMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2fMESA) {
- void ** procp = (void **) &disp->WindowPos2fMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2fMESA) {
- void ** procp = (void **) &disp->WindowPos2fMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2fMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2fvMESA) {
- void ** procp = (void **) &disp->WindowPos2fvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2fvMESA) {
- void ** procp = (void **) &disp->WindowPos2fvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2fvMESA) {
- void ** procp = (void **) &disp->WindowPos2fvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2fvMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2iMESA) {
- void ** procp = (void **) &disp->WindowPos2iMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2iMESA) {
- void ** procp = (void **) &disp->WindowPos2iMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2iARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2iMESA) {
- void ** procp = (void **) &disp->WindowPos2iMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2iMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2ivMESA) {
- void ** procp = (void **) &disp->WindowPos2ivMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2ivMESA) {
- void ** procp = (void **) &disp->WindowPos2ivMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2ivMESA) {
- void ** procp = (void **) &disp->WindowPos2ivMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2ivMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2sMESA) {
- void ** procp = (void **) &disp->WindowPos2sMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2sMESA) {
- void ** procp = (void **) &disp->WindowPos2sMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2sARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2sMESA) {
- void ** procp = (void **) &disp->WindowPos2sMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2sMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2svMESA) {
- void ** procp = (void **) &disp->WindowPos2svMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2svMESA) {
- void ** procp = (void **) &disp->WindowPos2svMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2svARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos2svMESA) {
- void ** procp = (void **) &disp->WindowPos2svMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos2svMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3dMESA) {
- void ** procp = (void **) &disp->WindowPos3dMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3d", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3dMESA) {
- void ** procp = (void **) &disp->WindowPos3dMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3dARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3dMESA) {
- void ** procp = (void **) &disp->WindowPos3dMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3dMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3dvMESA) {
- void ** procp = (void **) &disp->WindowPos3dvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3dv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3dvMESA) {
- void ** procp = (void **) &disp->WindowPos3dvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3dvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3dvMESA) {
- void ** procp = (void **) &disp->WindowPos3dvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3dvMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3fMESA) {
- void ** procp = (void **) &disp->WindowPos3fMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3f", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3fMESA) {
- void ** procp = (void **) &disp->WindowPos3fMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3fARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3fMESA) {
- void ** procp = (void **) &disp->WindowPos3fMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3fMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3fvMESA) {
- void ** procp = (void **) &disp->WindowPos3fvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3fv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3fvMESA) {
- void ** procp = (void **) &disp->WindowPos3fvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3fvARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3fvMESA) {
- void ** procp = (void **) &disp->WindowPos3fvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3fvMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3iMESA) {
- void ** procp = (void **) &disp->WindowPos3iMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3iMESA) {
- void ** procp = (void **) &disp->WindowPos3iMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3iARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3iMESA) {
- void ** procp = (void **) &disp->WindowPos3iMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3iMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3ivMESA) {
- void ** procp = (void **) &disp->WindowPos3ivMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3ivMESA) {
- void ** procp = (void **) &disp->WindowPos3ivMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3ivARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3ivMESA) {
- void ** procp = (void **) &disp->WindowPos3ivMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3ivMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3sMESA) {
- void ** procp = (void **) &disp->WindowPos3sMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3s", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3sMESA) {
- void ** procp = (void **) &disp->WindowPos3sMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3sARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3sMESA) {
- void ** procp = (void **) &disp->WindowPos3sMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3sMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3svMESA) {
- void ** procp = (void **) &disp->WindowPos3svMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3svMESA) {
- void ** procp = (void **) &disp->WindowPos3svMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3svARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos3svMESA) {
- void ** procp = (void **) &disp->WindowPos3svMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos3svMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos4dMESA) {
- void ** procp = (void **) &disp->WindowPos4dMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos4dMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos4dvMESA) {
- void ** procp = (void **) &disp->WindowPos4dvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos4dvMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos4fMESA) {
- void ** procp = (void **) &disp->WindowPos4fMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos4fMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos4fvMESA) {
- void ** procp = (void **) &disp->WindowPos4fvMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos4fvMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos4iMESA) {
- void ** procp = (void **) &disp->WindowPos4iMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos4iMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos4ivMESA) {
- void ** procp = (void **) &disp->WindowPos4ivMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos4ivMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos4sMESA) {
- void ** procp = (void **) &disp->WindowPos4sMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos4sMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->WindowPos4svMESA) {
- void ** procp = (void **) &disp->WindowPos4svMESA;
- snprintf(symboln, sizeof(symboln), "%sWindowPos4svMESA", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiModeDrawArraysIBM) {
- void ** procp = (void **) &disp->MultiModeDrawArraysIBM;
- snprintf(symboln, sizeof(symboln), "%sMultiModeDrawArraysIBM", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->MultiModeDrawElementsIBM) {
- void ** procp = (void **) &disp->MultiModeDrawElementsIBM;
- snprintf(symboln, sizeof(symboln), "%sMultiModeDrawElementsIBM", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteFencesNV) {
- void ** procp = (void **) &disp->DeleteFencesNV;
- snprintf(symboln, sizeof(symboln), "%sDeleteFencesNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FinishFenceNV) {
- void ** procp = (void **) &disp->FinishFenceNV;
- snprintf(symboln, sizeof(symboln), "%sFinishFenceNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenFencesNV) {
- void ** procp = (void **) &disp->GenFencesNV;
- snprintf(symboln, sizeof(symboln), "%sGenFencesNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetFenceivNV) {
- void ** procp = (void **) &disp->GetFenceivNV;
- snprintf(symboln, sizeof(symboln), "%sGetFenceivNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsFenceNV) {
- void ** procp = (void **) &disp->IsFenceNV;
- snprintf(symboln, sizeof(symboln), "%sIsFenceNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SetFenceNV) {
- void ** procp = (void **) &disp->SetFenceNV;
- snprintf(symboln, sizeof(symboln), "%sSetFenceNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TestFenceNV) {
- void ** procp = (void **) &disp->TestFenceNV;
- snprintf(symboln, sizeof(symboln), "%sTestFenceNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->AreProgramsResidentNV) {
- void ** procp = (void **) &disp->AreProgramsResidentNV;
- snprintf(symboln, sizeof(symboln), "%sAreProgramsResidentNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindProgramNV) {
- void ** procp = (void **) &disp->BindProgramNV;
- snprintf(symboln, sizeof(symboln), "%sBindProgramARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindProgramNV) {
- void ** procp = (void **) &disp->BindProgramNV;
- snprintf(symboln, sizeof(symboln), "%sBindProgramNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteProgramsNV) {
- void ** procp = (void **) &disp->DeleteProgramsNV;
- snprintf(symboln, sizeof(symboln), "%sDeleteProgramsARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteProgramsNV) {
- void ** procp = (void **) &disp->DeleteProgramsNV;
- snprintf(symboln, sizeof(symboln), "%sDeleteProgramsNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ExecuteProgramNV) {
- void ** procp = (void **) &disp->ExecuteProgramNV;
- snprintf(symboln, sizeof(symboln), "%sExecuteProgramNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenProgramsNV) {
- void ** procp = (void **) &disp->GenProgramsNV;
- snprintf(symboln, sizeof(symboln), "%sGenProgramsARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenProgramsNV) {
- void ** procp = (void **) &disp->GenProgramsNV;
- snprintf(symboln, sizeof(symboln), "%sGenProgramsNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramParameterdvNV) {
- void ** procp = (void **) &disp->GetProgramParameterdvNV;
- snprintf(symboln, sizeof(symboln), "%sGetProgramParameterdvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramParameterfvNV) {
- void ** procp = (void **) &disp->GetProgramParameterfvNV;
- snprintf(symboln, sizeof(symboln), "%sGetProgramParameterfvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramStringNV) {
- void ** procp = (void **) &disp->GetProgramStringNV;
- snprintf(symboln, sizeof(symboln), "%sGetProgramStringNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramivNV) {
- void ** procp = (void **) &disp->GetProgramivNV;
- snprintf(symboln, sizeof(symboln), "%sGetProgramivNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTrackMatrixivNV) {
- void ** procp = (void **) &disp->GetTrackMatrixivNV;
- snprintf(symboln, sizeof(symboln), "%sGetTrackMatrixivNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribPointervNV) {
- void ** procp = (void **) &disp->GetVertexAttribPointervNV;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribPointerv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribPointervNV) {
- void ** procp = (void **) &disp->GetVertexAttribPointervNV;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribPointervARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribPointervNV) {
- void ** procp = (void **) &disp->GetVertexAttribPointervNV;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribPointervNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribdvNV) {
- void ** procp = (void **) &disp->GetVertexAttribdvNV;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribdvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribfvNV) {
- void ** procp = (void **) &disp->GetVertexAttribfvNV;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribfvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribivNV) {
- void ** procp = (void **) &disp->GetVertexAttribivNV;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribivNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsProgramNV) {
- void ** procp = (void **) &disp->IsProgramNV;
- snprintf(symboln, sizeof(symboln), "%sIsProgramARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsProgramNV) {
- void ** procp = (void **) &disp->IsProgramNV;
- snprintf(symboln, sizeof(symboln), "%sIsProgramNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->LoadProgramNV) {
- void ** procp = (void **) &disp->LoadProgramNV;
- snprintf(symboln, sizeof(symboln), "%sLoadProgramNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramParameters4dvNV) {
- void ** procp = (void **) &disp->ProgramParameters4dvNV;
- snprintf(symboln, sizeof(symboln), "%sProgramParameters4dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramParameters4fvNV) {
- void ** procp = (void **) &disp->ProgramParameters4fvNV;
- snprintf(symboln, sizeof(symboln), "%sProgramParameters4fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RequestResidentProgramsNV) {
- void ** procp = (void **) &disp->RequestResidentProgramsNV;
- snprintf(symboln, sizeof(symboln), "%sRequestResidentProgramsNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TrackMatrixNV) {
- void ** procp = (void **) &disp->TrackMatrixNV;
- snprintf(symboln, sizeof(symboln), "%sTrackMatrixNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1dNV) {
- void ** procp = (void **) &disp->VertexAttrib1dNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1dvNV) {
- void ** procp = (void **) &disp->VertexAttrib1dvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1fNV) {
- void ** procp = (void **) &disp->VertexAttrib1fNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1fvNV) {
- void ** procp = (void **) &disp->VertexAttrib1fvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1sNV) {
- void ** procp = (void **) &disp->VertexAttrib1sNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1sNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib1svNV) {
- void ** procp = (void **) &disp->VertexAttrib1svNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib1svNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2dNV) {
- void ** procp = (void **) &disp->VertexAttrib2dNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2dvNV) {
- void ** procp = (void **) &disp->VertexAttrib2dvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2fNV) {
- void ** procp = (void **) &disp->VertexAttrib2fNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2fvNV) {
- void ** procp = (void **) &disp->VertexAttrib2fvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2sNV) {
- void ** procp = (void **) &disp->VertexAttrib2sNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2sNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib2svNV) {
- void ** procp = (void **) &disp->VertexAttrib2svNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib2svNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3dNV) {
- void ** procp = (void **) &disp->VertexAttrib3dNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3dvNV) {
- void ** procp = (void **) &disp->VertexAttrib3dvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3fNV) {
- void ** procp = (void **) &disp->VertexAttrib3fNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3fvNV) {
- void ** procp = (void **) &disp->VertexAttrib3fvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3sNV) {
- void ** procp = (void **) &disp->VertexAttrib3sNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3sNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib3svNV) {
- void ** procp = (void **) &disp->VertexAttrib3svNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib3svNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4dNV) {
- void ** procp = (void **) &disp->VertexAttrib4dNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4dvNV) {
- void ** procp = (void **) &disp->VertexAttrib4dvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4fNV) {
- void ** procp = (void **) &disp->VertexAttrib4fNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4fvNV) {
- void ** procp = (void **) &disp->VertexAttrib4fvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4sNV) {
- void ** procp = (void **) &disp->VertexAttrib4sNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4sNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4svNV) {
- void ** procp = (void **) &disp->VertexAttrib4svNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4svNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4ubNV) {
- void ** procp = (void **) &disp->VertexAttrib4ubNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttrib4ubvNV) {
- void ** procp = (void **) &disp->VertexAttrib4ubvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribPointerNV) {
- void ** procp = (void **) &disp->VertexAttribPointerNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribPointerNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs1dvNV) {
- void ** procp = (void **) &disp->VertexAttribs1dvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs1dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs1fvNV) {
- void ** procp = (void **) &disp->VertexAttribs1fvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs1fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs1svNV) {
- void ** procp = (void **) &disp->VertexAttribs1svNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs1svNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs2dvNV) {
- void ** procp = (void **) &disp->VertexAttribs2dvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs2dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs2fvNV) {
- void ** procp = (void **) &disp->VertexAttribs2fvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs2fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs2svNV) {
- void ** procp = (void **) &disp->VertexAttribs2svNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs2svNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs3dvNV) {
- void ** procp = (void **) &disp->VertexAttribs3dvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs3dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs3fvNV) {
- void ** procp = (void **) &disp->VertexAttribs3fvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs3fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs3svNV) {
- void ** procp = (void **) &disp->VertexAttribs3svNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs3svNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs4dvNV) {
- void ** procp = (void **) &disp->VertexAttribs4dvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs4dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs4fvNV) {
- void ** procp = (void **) &disp->VertexAttribs4fvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs4fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs4svNV) {
- void ** procp = (void **) &disp->VertexAttribs4svNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs4svNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribs4ubvNV) {
- void ** procp = (void **) &disp->VertexAttribs4ubvNV;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribs4ubvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexBumpParameterfvATI) {
- void ** procp = (void **) &disp->GetTexBumpParameterfvATI;
- snprintf(symboln, sizeof(symboln), "%sGetTexBumpParameterfvATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexBumpParameterivATI) {
- void ** procp = (void **) &disp->GetTexBumpParameterivATI;
- snprintf(symboln, sizeof(symboln), "%sGetTexBumpParameterivATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexBumpParameterfvATI) {
- void ** procp = (void **) &disp->TexBumpParameterfvATI;
- snprintf(symboln, sizeof(symboln), "%sTexBumpParameterfvATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexBumpParameterivATI) {
- void ** procp = (void **) &disp->TexBumpParameterivATI;
- snprintf(symboln, sizeof(symboln), "%sTexBumpParameterivATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->AlphaFragmentOp1ATI) {
- void ** procp = (void **) &disp->AlphaFragmentOp1ATI;
- snprintf(symboln, sizeof(symboln), "%sAlphaFragmentOp1ATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->AlphaFragmentOp2ATI) {
- void ** procp = (void **) &disp->AlphaFragmentOp2ATI;
- snprintf(symboln, sizeof(symboln), "%sAlphaFragmentOp2ATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->AlphaFragmentOp3ATI) {
- void ** procp = (void **) &disp->AlphaFragmentOp3ATI;
- snprintf(symboln, sizeof(symboln), "%sAlphaFragmentOp3ATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BeginFragmentShaderATI) {
- void ** procp = (void **) &disp->BeginFragmentShaderATI;
- snprintf(symboln, sizeof(symboln), "%sBeginFragmentShaderATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindFragmentShaderATI) {
- void ** procp = (void **) &disp->BindFragmentShaderATI;
- snprintf(symboln, sizeof(symboln), "%sBindFragmentShaderATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorFragmentOp1ATI) {
- void ** procp = (void **) &disp->ColorFragmentOp1ATI;
- snprintf(symboln, sizeof(symboln), "%sColorFragmentOp1ATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorFragmentOp2ATI) {
- void ** procp = (void **) &disp->ColorFragmentOp2ATI;
- snprintf(symboln, sizeof(symboln), "%sColorFragmentOp2ATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorFragmentOp3ATI) {
- void ** procp = (void **) &disp->ColorFragmentOp3ATI;
- snprintf(symboln, sizeof(symboln), "%sColorFragmentOp3ATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteFragmentShaderATI) {
- void ** procp = (void **) &disp->DeleteFragmentShaderATI;
- snprintf(symboln, sizeof(symboln), "%sDeleteFragmentShaderATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EndFragmentShaderATI) {
- void ** procp = (void **) &disp->EndFragmentShaderATI;
- snprintf(symboln, sizeof(symboln), "%sEndFragmentShaderATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenFragmentShadersATI) {
- void ** procp = (void **) &disp->GenFragmentShadersATI;
- snprintf(symboln, sizeof(symboln), "%sGenFragmentShadersATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PassTexCoordATI) {
- void ** procp = (void **) &disp->PassTexCoordATI;
- snprintf(symboln, sizeof(symboln), "%sPassTexCoordATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SampleMapATI) {
- void ** procp = (void **) &disp->SampleMapATI;
- snprintf(symboln, sizeof(symboln), "%sSampleMapATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->SetFragmentShaderConstantATI) {
- void ** procp = (void **) &disp->SetFragmentShaderConstantATI;
- snprintf(symboln, sizeof(symboln), "%sSetFragmentShaderConstantATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameteriNV) {
- void ** procp = (void **) &disp->PointParameteriNV;
- snprintf(symboln, sizeof(symboln), "%sPointParameteri", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameteriNV) {
- void ** procp = (void **) &disp->PointParameteriNV;
- snprintf(symboln, sizeof(symboln), "%sPointParameteriNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameterivNV) {
- void ** procp = (void **) &disp->PointParameterivNV;
- snprintf(symboln, sizeof(symboln), "%sPointParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PointParameterivNV) {
- void ** procp = (void **) &disp->PointParameterivNV;
- snprintf(symboln, sizeof(symboln), "%sPointParameterivNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ActiveStencilFaceEXT) {
- void ** procp = (void **) &disp->ActiveStencilFaceEXT;
- snprintf(symboln, sizeof(symboln), "%sActiveStencilFaceEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindVertexArrayAPPLE) {
- void ** procp = (void **) &disp->BindVertexArrayAPPLE;
- snprintf(symboln, sizeof(symboln), "%sBindVertexArrayAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteVertexArraysAPPLE) {
- void ** procp = (void **) &disp->DeleteVertexArraysAPPLE;
- snprintf(symboln, sizeof(symboln), "%sDeleteVertexArrays", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteVertexArraysAPPLE) {
- void ** procp = (void **) &disp->DeleteVertexArraysAPPLE;
- snprintf(symboln, sizeof(symboln), "%sDeleteVertexArraysAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenVertexArraysAPPLE) {
- void ** procp = (void **) &disp->GenVertexArraysAPPLE;
- snprintf(symboln, sizeof(symboln), "%sGenVertexArraysAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsVertexArrayAPPLE) {
- void ** procp = (void **) &disp->IsVertexArrayAPPLE;
- snprintf(symboln, sizeof(symboln), "%sIsVertexArray", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsVertexArrayAPPLE) {
- void ** procp = (void **) &disp->IsVertexArrayAPPLE;
- snprintf(symboln, sizeof(symboln), "%sIsVertexArrayAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramNamedParameterdvNV) {
- void ** procp = (void **) &disp->GetProgramNamedParameterdvNV;
- snprintf(symboln, sizeof(symboln), "%sGetProgramNamedParameterdvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetProgramNamedParameterfvNV) {
- void ** procp = (void **) &disp->GetProgramNamedParameterfvNV;
- snprintf(symboln, sizeof(symboln), "%sGetProgramNamedParameterfvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramNamedParameter4dNV) {
- void ** procp = (void **) &disp->ProgramNamedParameter4dNV;
- snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4dNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramNamedParameter4dvNV) {
- void ** procp = (void **) &disp->ProgramNamedParameter4dvNV;
- snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4dvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramNamedParameter4fNV) {
- void ** procp = (void **) &disp->ProgramNamedParameter4fNV;
- snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4fNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramNamedParameter4fvNV) {
- void ** procp = (void **) &disp->ProgramNamedParameter4fvNV;
- snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4fvNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PrimitiveRestartIndexNV) {
- void ** procp = (void **) &disp->PrimitiveRestartIndexNV;
- snprintf(symboln, sizeof(symboln), "%sPrimitiveRestartIndexNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PrimitiveRestartIndexNV) {
- void ** procp = (void **) &disp->PrimitiveRestartIndexNV;
- snprintf(symboln, sizeof(symboln), "%sPrimitiveRestartIndex", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->PrimitiveRestartNV) {
- void ** procp = (void **) &disp->PrimitiveRestartNV;
- snprintf(symboln, sizeof(symboln), "%sPrimitiveRestartNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DepthBoundsEXT) {
- void ** procp = (void **) &disp->DepthBoundsEXT;
- snprintf(symboln, sizeof(symboln), "%sDepthBoundsEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendEquationSeparateEXT) {
- void ** procp = (void **) &disp->BlendEquationSeparateEXT;
- snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparate", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendEquationSeparateEXT) {
- void ** procp = (void **) &disp->BlendEquationSeparateEXT;
- snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlendEquationSeparateEXT) {
- void ** procp = (void **) &disp->BlendEquationSeparateEXT;
- snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindFramebufferEXT) {
- void ** procp = (void **) &disp->BindFramebufferEXT;
- snprintf(symboln, sizeof(symboln), "%sBindFramebuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindFramebufferEXT) {
- void ** procp = (void **) &disp->BindFramebufferEXT;
- snprintf(symboln, sizeof(symboln), "%sBindFramebufferEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindRenderbufferEXT) {
- void ** procp = (void **) &disp->BindRenderbufferEXT;
- snprintf(symboln, sizeof(symboln), "%sBindRenderbuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindRenderbufferEXT) {
- void ** procp = (void **) &disp->BindRenderbufferEXT;
- snprintf(symboln, sizeof(symboln), "%sBindRenderbufferEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CheckFramebufferStatusEXT) {
- void ** procp = (void **) &disp->CheckFramebufferStatusEXT;
- snprintf(symboln, sizeof(symboln), "%sCheckFramebufferStatus", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CheckFramebufferStatusEXT) {
- void ** procp = (void **) &disp->CheckFramebufferStatusEXT;
- snprintf(symboln, sizeof(symboln), "%sCheckFramebufferStatusEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteFramebuffersEXT) {
- void ** procp = (void **) &disp->DeleteFramebuffersEXT;
- snprintf(symboln, sizeof(symboln), "%sDeleteFramebuffers", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteFramebuffersEXT) {
- void ** procp = (void **) &disp->DeleteFramebuffersEXT;
- snprintf(symboln, sizeof(symboln), "%sDeleteFramebuffersEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteRenderbuffersEXT) {
- void ** procp = (void **) &disp->DeleteRenderbuffersEXT;
- snprintf(symboln, sizeof(symboln), "%sDeleteRenderbuffers", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DeleteRenderbuffersEXT) {
- void ** procp = (void **) &disp->DeleteRenderbuffersEXT;
- snprintf(symboln, sizeof(symboln), "%sDeleteRenderbuffersEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferRenderbufferEXT) {
- void ** procp = (void **) &disp->FramebufferRenderbufferEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferRenderbuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferRenderbufferEXT) {
- void ** procp = (void **) &disp->FramebufferRenderbufferEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferRenderbufferEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTexture1DEXT) {
- void ** procp = (void **) &disp->FramebufferTexture1DEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTexture1D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTexture1DEXT) {
- void ** procp = (void **) &disp->FramebufferTexture1DEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTexture1DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTexture2DEXT) {
- void ** procp = (void **) &disp->FramebufferTexture2DEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTexture2D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTexture2DEXT) {
- void ** procp = (void **) &disp->FramebufferTexture2DEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTexture2DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTexture3DEXT) {
- void ** procp = (void **) &disp->FramebufferTexture3DEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTexture3D", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTexture3DEXT) {
- void ** procp = (void **) &disp->FramebufferTexture3DEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTexture3DEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenFramebuffersEXT) {
- void ** procp = (void **) &disp->GenFramebuffersEXT;
- snprintf(symboln, sizeof(symboln), "%sGenFramebuffers", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenFramebuffersEXT) {
- void ** procp = (void **) &disp->GenFramebuffersEXT;
- snprintf(symboln, sizeof(symboln), "%sGenFramebuffersEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenRenderbuffersEXT) {
- void ** procp = (void **) &disp->GenRenderbuffersEXT;
- snprintf(symboln, sizeof(symboln), "%sGenRenderbuffers", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenRenderbuffersEXT) {
- void ** procp = (void **) &disp->GenRenderbuffersEXT;
- snprintf(symboln, sizeof(symboln), "%sGenRenderbuffersEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenerateMipmapEXT) {
- void ** procp = (void **) &disp->GenerateMipmapEXT;
- snprintf(symboln, sizeof(symboln), "%sGenerateMipmap", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GenerateMipmapEXT) {
- void ** procp = (void **) &disp->GenerateMipmapEXT;
- snprintf(symboln, sizeof(symboln), "%sGenerateMipmapEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetFramebufferAttachmentParameterivEXT) {
- void ** procp = (void **) &disp->GetFramebufferAttachmentParameterivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetFramebufferAttachmentParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetFramebufferAttachmentParameterivEXT) {
- void ** procp = (void **) &disp->GetFramebufferAttachmentParameterivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetFramebufferAttachmentParameterivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetRenderbufferParameterivEXT) {
- void ** procp = (void **) &disp->GetRenderbufferParameterivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetRenderbufferParameteriv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetRenderbufferParameterivEXT) {
- void ** procp = (void **) &disp->GetRenderbufferParameterivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetRenderbufferParameterivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsFramebufferEXT) {
- void ** procp = (void **) &disp->IsFramebufferEXT;
- snprintf(symboln, sizeof(symboln), "%sIsFramebuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsFramebufferEXT) {
- void ** procp = (void **) &disp->IsFramebufferEXT;
- snprintf(symboln, sizeof(symboln), "%sIsFramebufferEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsRenderbufferEXT) {
- void ** procp = (void **) &disp->IsRenderbufferEXT;
- snprintf(symboln, sizeof(symboln), "%sIsRenderbuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsRenderbufferEXT) {
- void ** procp = (void **) &disp->IsRenderbufferEXT;
- snprintf(symboln, sizeof(symboln), "%sIsRenderbufferEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RenderbufferStorageEXT) {
- void ** procp = (void **) &disp->RenderbufferStorageEXT;
- snprintf(symboln, sizeof(symboln), "%sRenderbufferStorage", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->RenderbufferStorageEXT) {
- void ** procp = (void **) &disp->RenderbufferStorageEXT;
- snprintf(symboln, sizeof(symboln), "%sRenderbufferStorageEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlitFramebufferEXT) {
- void ** procp = (void **) &disp->BlitFramebufferEXT;
- snprintf(symboln, sizeof(symboln), "%sBlitFramebuffer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BlitFramebufferEXT) {
- void ** procp = (void **) &disp->BlitFramebufferEXT;
- snprintf(symboln, sizeof(symboln), "%sBlitFramebufferEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BufferParameteriAPPLE) {
- void ** procp = (void **) &disp->BufferParameteriAPPLE;
- snprintf(symboln, sizeof(symboln), "%sBufferParameteriAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FlushMappedBufferRangeAPPLE) {
- void ** procp = (void **) &disp->FlushMappedBufferRangeAPPLE;
- snprintf(symboln, sizeof(symboln), "%sFlushMappedBufferRangeAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindFragDataLocationEXT) {
- void ** procp = (void **) &disp->BindFragDataLocationEXT;
- snprintf(symboln, sizeof(symboln), "%sBindFragDataLocationEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindFragDataLocationEXT) {
- void ** procp = (void **) &disp->BindFragDataLocationEXT;
- snprintf(symboln, sizeof(symboln), "%sBindFragDataLocation", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetFragDataLocationEXT) {
- void ** procp = (void **) &disp->GetFragDataLocationEXT;
- snprintf(symboln, sizeof(symboln), "%sGetFragDataLocationEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetFragDataLocationEXT) {
- void ** procp = (void **) &disp->GetFragDataLocationEXT;
- snprintf(symboln, sizeof(symboln), "%sGetFragDataLocation", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetUniformuivEXT) {
- void ** procp = (void **) &disp->GetUniformuivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetUniformuivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetUniformuivEXT) {
- void ** procp = (void **) &disp->GetUniformuivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetUniformuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribIivEXT) {
- void ** procp = (void **) &disp->GetVertexAttribIivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribIivEXT) {
- void ** procp = (void **) &disp->GetVertexAttribIivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribIuivEXT) {
- void ** procp = (void **) &disp->GetVertexAttribIuivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIuivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetVertexAttribIuivEXT) {
- void ** procp = (void **) &disp->GetVertexAttribIuivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1uiEXT) {
- void ** procp = (void **) &disp->Uniform1uiEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform1uiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1uiEXT) {
- void ** procp = (void **) &disp->Uniform1uiEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform1ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1uivEXT) {
- void ** procp = (void **) &disp->Uniform1uivEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform1uivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform1uivEXT) {
- void ** procp = (void **) &disp->Uniform1uivEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform1uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2uiEXT) {
- void ** procp = (void **) &disp->Uniform2uiEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform2uiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2uiEXT) {
- void ** procp = (void **) &disp->Uniform2uiEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform2ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2uivEXT) {
- void ** procp = (void **) &disp->Uniform2uivEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform2uivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform2uivEXT) {
- void ** procp = (void **) &disp->Uniform2uivEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform2uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3uiEXT) {
- void ** procp = (void **) &disp->Uniform3uiEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform3uiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3uiEXT) {
- void ** procp = (void **) &disp->Uniform3uiEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3uivEXT) {
- void ** procp = (void **) &disp->Uniform3uivEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform3uivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform3uivEXT) {
- void ** procp = (void **) &disp->Uniform3uivEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4uiEXT) {
- void ** procp = (void **) &disp->Uniform4uiEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform4uiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4uiEXT) {
- void ** procp = (void **) &disp->Uniform4uiEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform4ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4uivEXT) {
- void ** procp = (void **) &disp->Uniform4uivEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform4uivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->Uniform4uivEXT) {
- void ** procp = (void **) &disp->Uniform4uivEXT;
- snprintf(symboln, sizeof(symboln), "%sUniform4uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI1iEXT) {
- void ** procp = (void **) &disp->VertexAttribI1iEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI1iEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI1iEXT) {
- void ** procp = (void **) &disp->VertexAttribI1iEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI1i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI1ivEXT) {
- void ** procp = (void **) &disp->VertexAttribI1ivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI1ivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI1ivEXT) {
- void ** procp = (void **) &disp->VertexAttribI1ivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI1iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI1uiEXT) {
- void ** procp = (void **) &disp->VertexAttribI1uiEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI1uiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI1uiEXT) {
- void ** procp = (void **) &disp->VertexAttribI1uiEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI1ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI1uivEXT) {
- void ** procp = (void **) &disp->VertexAttribI1uivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI1uivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI1uivEXT) {
- void ** procp = (void **) &disp->VertexAttribI1uivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI1uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI2iEXT) {
- void ** procp = (void **) &disp->VertexAttribI2iEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI2iEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI2iEXT) {
- void ** procp = (void **) &disp->VertexAttribI2iEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI2i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI2ivEXT) {
- void ** procp = (void **) &disp->VertexAttribI2ivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI2ivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI2ivEXT) {
- void ** procp = (void **) &disp->VertexAttribI2ivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI2iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI2uiEXT) {
- void ** procp = (void **) &disp->VertexAttribI2uiEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI2uiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI2uiEXT) {
- void ** procp = (void **) &disp->VertexAttribI2uiEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI2ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI2uivEXT) {
- void ** procp = (void **) &disp->VertexAttribI2uivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI2uivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI2uivEXT) {
- void ** procp = (void **) &disp->VertexAttribI2uivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI2uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI3iEXT) {
- void ** procp = (void **) &disp->VertexAttribI3iEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI3iEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI3iEXT) {
- void ** procp = (void **) &disp->VertexAttribI3iEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI3i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI3ivEXT) {
- void ** procp = (void **) &disp->VertexAttribI3ivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI3ivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI3ivEXT) {
- void ** procp = (void **) &disp->VertexAttribI3ivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI3iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI3uiEXT) {
- void ** procp = (void **) &disp->VertexAttribI3uiEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI3uiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI3uiEXT) {
- void ** procp = (void **) &disp->VertexAttribI3uiEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI3ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI3uivEXT) {
- void ** procp = (void **) &disp->VertexAttribI3uivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI3uivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI3uivEXT) {
- void ** procp = (void **) &disp->VertexAttribI3uivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI3uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4bvEXT) {
- void ** procp = (void **) &disp->VertexAttribI4bvEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4bvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4bvEXT) {
- void ** procp = (void **) &disp->VertexAttribI4bvEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4bv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4iEXT) {
- void ** procp = (void **) &disp->VertexAttribI4iEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4iEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4iEXT) {
- void ** procp = (void **) &disp->VertexAttribI4iEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4i", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4ivEXT) {
- void ** procp = (void **) &disp->VertexAttribI4ivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4ivEXT) {
- void ** procp = (void **) &disp->VertexAttribI4ivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4iv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4svEXT) {
- void ** procp = (void **) &disp->VertexAttribI4svEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4svEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4svEXT) {
- void ** procp = (void **) &disp->VertexAttribI4svEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4sv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4ubvEXT) {
- void ** procp = (void **) &disp->VertexAttribI4ubvEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ubvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4ubvEXT) {
- void ** procp = (void **) &disp->VertexAttribI4ubvEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ubv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4uiEXT) {
- void ** procp = (void **) &disp->VertexAttribI4uiEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4uiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4uiEXT) {
- void ** procp = (void **) &disp->VertexAttribI4uiEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ui", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4uivEXT) {
- void ** procp = (void **) &disp->VertexAttribI4uivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4uivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4uivEXT) {
- void ** procp = (void **) &disp->VertexAttribI4uivEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4uiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4usvEXT) {
- void ** procp = (void **) &disp->VertexAttribI4usvEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4usvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribI4usvEXT) {
- void ** procp = (void **) &disp->VertexAttribI4usvEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribI4usv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribIPointerEXT) {
- void ** procp = (void **) &disp->VertexAttribIPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribIPointerEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->VertexAttribIPointerEXT) {
- void ** procp = (void **) &disp->VertexAttribIPointerEXT;
- snprintf(symboln, sizeof(symboln), "%sVertexAttribIPointer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTextureLayerEXT) {
- void ** procp = (void **) &disp->FramebufferTextureLayerEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTextureLayer", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTextureLayerEXT) {
- void ** procp = (void **) &disp->FramebufferTextureLayerEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTextureLayerARB", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->FramebufferTextureLayerEXT) {
- void ** procp = (void **) &disp->FramebufferTextureLayerEXT;
- snprintf(symboln, sizeof(symboln), "%sFramebufferTextureLayerEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorMaskIndexedEXT) {
- void ** procp = (void **) &disp->ColorMaskIndexedEXT;
- snprintf(symboln, sizeof(symboln), "%sColorMaskIndexedEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ColorMaskIndexedEXT) {
- void ** procp = (void **) &disp->ColorMaskIndexedEXT;
- snprintf(symboln, sizeof(symboln), "%sColorMaski", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DisableIndexedEXT) {
- void ** procp = (void **) &disp->DisableIndexedEXT;
- snprintf(symboln, sizeof(symboln), "%sDisableIndexedEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->DisableIndexedEXT) {
- void ** procp = (void **) &disp->DisableIndexedEXT;
- snprintf(symboln, sizeof(symboln), "%sDisablei", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EnableIndexedEXT) {
- void ** procp = (void **) &disp->EnableIndexedEXT;
- snprintf(symboln, sizeof(symboln), "%sEnableIndexedEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EnableIndexedEXT) {
- void ** procp = (void **) &disp->EnableIndexedEXT;
- snprintf(symboln, sizeof(symboln), "%sEnablei", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetBooleanIndexedvEXT) {
- void ** procp = (void **) &disp->GetBooleanIndexedvEXT;
- snprintf(symboln, sizeof(symboln), "%sGetBooleanIndexedvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetBooleanIndexedvEXT) {
- void ** procp = (void **) &disp->GetBooleanIndexedvEXT;
- snprintf(symboln, sizeof(symboln), "%sGetBooleani_v", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetIntegerIndexedvEXT) {
- void ** procp = (void **) &disp->GetIntegerIndexedvEXT;
- snprintf(symboln, sizeof(symboln), "%sGetIntegerIndexedvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetIntegerIndexedvEXT) {
- void ** procp = (void **) &disp->GetIntegerIndexedvEXT;
- snprintf(symboln, sizeof(symboln), "%sGetIntegeri_v", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsEnabledIndexedEXT) {
- void ** procp = (void **) &disp->IsEnabledIndexedEXT;
- snprintf(symboln, sizeof(symboln), "%sIsEnabledIndexedEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->IsEnabledIndexedEXT) {
- void ** procp = (void **) &disp->IsEnabledIndexedEXT;
- snprintf(symboln, sizeof(symboln), "%sIsEnabledi", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearColorIiEXT) {
- void ** procp = (void **) &disp->ClearColorIiEXT;
- snprintf(symboln, sizeof(symboln), "%sClearColorIiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ClearColorIuiEXT) {
- void ** procp = (void **) &disp->ClearColorIuiEXT;
- snprintf(symboln, sizeof(symboln), "%sClearColorIuiEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexParameterIivEXT) {
- void ** procp = (void **) &disp->GetTexParameterIivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetTexParameterIivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexParameterIivEXT) {
- void ** procp = (void **) &disp->GetTexParameterIivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetTexParameterIiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexParameterIuivEXT) {
- void ** procp = (void **) &disp->GetTexParameterIuivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetTexParameterIuivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexParameterIuivEXT) {
- void ** procp = (void **) &disp->GetTexParameterIuivEXT;
- snprintf(symboln, sizeof(symboln), "%sGetTexParameterIuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexParameterIivEXT) {
- void ** procp = (void **) &disp->TexParameterIivEXT;
- snprintf(symboln, sizeof(symboln), "%sTexParameterIivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexParameterIivEXT) {
- void ** procp = (void **) &disp->TexParameterIivEXT;
- snprintf(symboln, sizeof(symboln), "%sTexParameterIiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexParameterIuivEXT) {
- void ** procp = (void **) &disp->TexParameterIuivEXT;
- snprintf(symboln, sizeof(symboln), "%sTexParameterIuivEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TexParameterIuivEXT) {
- void ** procp = (void **) &disp->TexParameterIuivEXT;
- snprintf(symboln, sizeof(symboln), "%sTexParameterIuiv", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BeginConditionalRenderNV) {
- void ** procp = (void **) &disp->BeginConditionalRenderNV;
- snprintf(symboln, sizeof(symboln), "%sBeginConditionalRenderNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BeginConditionalRenderNV) {
- void ** procp = (void **) &disp->BeginConditionalRenderNV;
- snprintf(symboln, sizeof(symboln), "%sBeginConditionalRender", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EndConditionalRenderNV) {
- void ** procp = (void **) &disp->EndConditionalRenderNV;
- snprintf(symboln, sizeof(symboln), "%sEndConditionalRenderNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EndConditionalRenderNV) {
- void ** procp = (void **) &disp->EndConditionalRenderNV;
- snprintf(symboln, sizeof(symboln), "%sEndConditionalRender", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BeginTransformFeedbackEXT) {
- void ** procp = (void **) &disp->BeginTransformFeedbackEXT;
- snprintf(symboln, sizeof(symboln), "%sBeginTransformFeedbackEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BeginTransformFeedbackEXT) {
- void ** procp = (void **) &disp->BeginTransformFeedbackEXT;
- snprintf(symboln, sizeof(symboln), "%sBeginTransformFeedback", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindBufferBaseEXT) {
- void ** procp = (void **) &disp->BindBufferBaseEXT;
- snprintf(symboln, sizeof(symboln), "%sBindBufferBaseEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindBufferBaseEXT) {
- void ** procp = (void **) &disp->BindBufferBaseEXT;
- snprintf(symboln, sizeof(symboln), "%sBindBufferBase", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindBufferOffsetEXT) {
- void ** procp = (void **) &disp->BindBufferOffsetEXT;
- snprintf(symboln, sizeof(symboln), "%sBindBufferOffsetEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindBufferRangeEXT) {
- void ** procp = (void **) &disp->BindBufferRangeEXT;
- snprintf(symboln, sizeof(symboln), "%sBindBufferRangeEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->BindBufferRangeEXT) {
- void ** procp = (void **) &disp->BindBufferRangeEXT;
- snprintf(symboln, sizeof(symboln), "%sBindBufferRange", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EndTransformFeedbackEXT) {
- void ** procp = (void **) &disp->EndTransformFeedbackEXT;
- snprintf(symboln, sizeof(symboln), "%sEndTransformFeedbackEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EndTransformFeedbackEXT) {
- void ** procp = (void **) &disp->EndTransformFeedbackEXT;
- snprintf(symboln, sizeof(symboln), "%sEndTransformFeedback", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTransformFeedbackVaryingEXT) {
- void ** procp = (void **) &disp->GetTransformFeedbackVaryingEXT;
- snprintf(symboln, sizeof(symboln), "%sGetTransformFeedbackVaryingEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTransformFeedbackVaryingEXT) {
- void ** procp = (void **) &disp->GetTransformFeedbackVaryingEXT;
- snprintf(symboln, sizeof(symboln), "%sGetTransformFeedbackVarying", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TransformFeedbackVaryingsEXT) {
- void ** procp = (void **) &disp->TransformFeedbackVaryingsEXT;
- snprintf(symboln, sizeof(symboln), "%sTransformFeedbackVaryingsEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TransformFeedbackVaryingsEXT) {
- void ** procp = (void **) &disp->TransformFeedbackVaryingsEXT;
- snprintf(symboln, sizeof(symboln), "%sTransformFeedbackVaryings", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProvokingVertexEXT) {
- void ** procp = (void **) &disp->ProvokingVertexEXT;
- snprintf(symboln, sizeof(symboln), "%sProvokingVertexEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProvokingVertexEXT) {
- void ** procp = (void **) &disp->ProvokingVertexEXT;
- snprintf(symboln, sizeof(symboln), "%sProvokingVertex", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetTexParameterPointervAPPLE) {
- void ** procp = (void **) &disp->GetTexParameterPointervAPPLE;
- snprintf(symboln, sizeof(symboln), "%sGetTexParameterPointervAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TextureRangeAPPLE) {
- void ** procp = (void **) &disp->TextureRangeAPPLE;
- snprintf(symboln, sizeof(symboln), "%sTextureRangeAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetObjectParameterivAPPLE) {
- void ** procp = (void **) &disp->GetObjectParameterivAPPLE;
- snprintf(symboln, sizeof(symboln), "%sGetObjectParameterivAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ObjectPurgeableAPPLE) {
- void ** procp = (void **) &disp->ObjectPurgeableAPPLE;
- snprintf(symboln, sizeof(symboln), "%sObjectPurgeableAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ObjectUnpurgeableAPPLE) {
- void ** procp = (void **) &disp->ObjectUnpurgeableAPPLE;
- snprintf(symboln, sizeof(symboln), "%sObjectUnpurgeableAPPLE", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ActiveProgramEXT) {
- void ** procp = (void **) &disp->ActiveProgramEXT;
- snprintf(symboln, sizeof(symboln), "%sActiveProgramEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->CreateShaderProgramEXT) {
- void ** procp = (void **) &disp->CreateShaderProgramEXT;
- snprintf(symboln, sizeof(symboln), "%sCreateShaderProgramEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->UseShaderProgramEXT) {
- void ** procp = (void **) &disp->UseShaderProgramEXT;
- snprintf(symboln, sizeof(symboln), "%sUseShaderProgramEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->TextureBarrierNV) {
- void ** procp = (void **) &disp->TextureBarrierNV;
- snprintf(symboln, sizeof(symboln), "%sTextureBarrierNV", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->StencilFuncSeparateATI) {
- void ** procp = (void **) &disp->StencilFuncSeparateATI;
- snprintf(symboln, sizeof(symboln), "%sStencilFuncSeparateATI", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramEnvParameters4fvEXT) {
- void ** procp = (void **) &disp->ProgramEnvParameters4fvEXT;
- snprintf(symboln, sizeof(symboln), "%sProgramEnvParameters4fvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->ProgramLocalParameters4fvEXT) {
- void ** procp = (void **) &disp->ProgramLocalParameters4fvEXT;
- snprintf(symboln, sizeof(symboln), "%sProgramLocalParameters4fvEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetQueryObjecti64vEXT) {
- void ** procp = (void **) &disp->GetQueryObjecti64vEXT;
- snprintf(symboln, sizeof(symboln), "%sGetQueryObjecti64vEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->GetQueryObjectui64vEXT) {
- void ** procp = (void **) &disp->GetQueryObjectui64vEXT;
- snprintf(symboln, sizeof(symboln), "%sGetQueryObjectui64vEXT", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EGLImageTargetRenderbufferStorageOES) {
- void ** procp = (void **) &disp->EGLImageTargetRenderbufferStorageOES;
- snprintf(symboln, sizeof(symboln), "%sEGLImageTargetRenderbufferStorageOES", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- if(!disp->EGLImageTargetTexture2DOES) {
- void ** procp = (void **) &disp->EGLImageTargetTexture2DOES;
- snprintf(symboln, sizeof(symboln), "%sEGLImageTargetTexture2DOES", symbol_prefix);
- *procp = dlsym(handle, symboln);
- }
-
-
- __glapi_gentable_set_remaining_noop(disp);
-
- return disp;
-}
-
+/* DO NOT EDIT - This file generated automatically by gl_gen_table.py (from Mesa) script */
+
+/*
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * (C) Copyright IBM Corporation 2004, 2005
+ * (C) Copyright Apple Inc 2011
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL, IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* GLXEXT is the define used in the xserver when the GLX extension is being
+ * built. Hijack this to determine whether this file is being built for the
+ * server or the client.
+ */
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \
+ || (!defined(GLXEXT) && defined(DEBUG) && !defined(_WIN32_WCE))
+#define USE_BACKTRACE
+#endif
+
+#ifdef USE_BACKTRACE
+#include <execinfo.h>
+#endif
+
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <GL/gl.h>
+
+#include "glapi.h"
+#include "glapitable.h"
+
+#ifdef GLXEXT
+#include "os.h"
+#endif
+
+static void
+__glapi_gentable_NoOp(void) {
+ const char *fstr = "Unknown";
+
+ /* Silence potential GCC warning for some #ifdef paths.
+ */
+ (void) fstr;
+#if defined(USE_BACKTRACE)
+#if !defined(GLXEXT)
+ if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
+#endif
+ {
+ void *frames[2];
+
+ if(backtrace(frames, 2) == 2) {
+ Dl_info info;
+ dladdr(frames[1], &info);
+ if(info.dli_sname)
+ fstr = info.dli_sname;
+ }
+
+#if !defined(GLXEXT)
+ fprintf(stderr, "Call to unimplemented API: %s\n", fstr);
+#endif
+ }
+#endif
+#if defined(GLXEXT)
+ LogMessage(X_ERROR, "GLX: Call to unimplemented API: %s\n", fstr);
+#endif
+}
+
+static void
+__glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
+ GLuint entries = _glapi_get_dispatch_table_size();
+ void **dispatch = (void **) disp;
+ int i;
+
+ /* ISO C is annoying sometimes */
+ union {_glapi_proc p; void *v;} p;
+ p.p = __glapi_gentable_NoOp;
+
+ for(i=0; i < entries; i++)
+ if(dispatch[i] == NULL)
+ dispatch[i] = p.v;
+}
+
+struct _glapi_table *
+_glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
+ struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table));
+ char symboln[512];
+
+ if(!disp)
+ return NULL;
+
+ if(symbol_prefix == NULL)
+ symbol_prefix = "";
+
+
+ if(!disp->NewList) {
+ void ** procp = (void **) &disp->NewList;
+ snprintf(symboln, sizeof(symboln), "%sNewList", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EndList) {
+ void ** procp = (void **) &disp->EndList;
+ snprintf(symboln, sizeof(symboln), "%sEndList", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CallList) {
+ void ** procp = (void **) &disp->CallList;
+ snprintf(symboln, sizeof(symboln), "%sCallList", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CallLists) {
+ void ** procp = (void **) &disp->CallLists;
+ snprintf(symboln, sizeof(symboln), "%sCallLists", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteLists) {
+ void ** procp = (void **) &disp->DeleteLists;
+ snprintf(symboln, sizeof(symboln), "%sDeleteLists", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenLists) {
+ void ** procp = (void **) &disp->GenLists;
+ snprintf(symboln, sizeof(symboln), "%sGenLists", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ListBase) {
+ void ** procp = (void **) &disp->ListBase;
+ snprintf(symboln, sizeof(symboln), "%sListBase", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Begin) {
+ void ** procp = (void **) &disp->Begin;
+ snprintf(symboln, sizeof(symboln), "%sBegin", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Bitmap) {
+ void ** procp = (void **) &disp->Bitmap;
+ snprintf(symboln, sizeof(symboln), "%sBitmap", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3b) {
+ void ** procp = (void **) &disp->Color3b;
+ snprintf(symboln, sizeof(symboln), "%sColor3b", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3bv) {
+ void ** procp = (void **) &disp->Color3bv;
+ snprintf(symboln, sizeof(symboln), "%sColor3bv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3d) {
+ void ** procp = (void **) &disp->Color3d;
+ snprintf(symboln, sizeof(symboln), "%sColor3d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3dv) {
+ void ** procp = (void **) &disp->Color3dv;
+ snprintf(symboln, sizeof(symboln), "%sColor3dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3f) {
+ void ** procp = (void **) &disp->Color3f;
+ snprintf(symboln, sizeof(symboln), "%sColor3f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3fv) {
+ void ** procp = (void **) &disp->Color3fv;
+ snprintf(symboln, sizeof(symboln), "%sColor3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3i) {
+ void ** procp = (void **) &disp->Color3i;
+ snprintf(symboln, sizeof(symboln), "%sColor3i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3iv) {
+ void ** procp = (void **) &disp->Color3iv;
+ snprintf(symboln, sizeof(symboln), "%sColor3iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3s) {
+ void ** procp = (void **) &disp->Color3s;
+ snprintf(symboln, sizeof(symboln), "%sColor3s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3sv) {
+ void ** procp = (void **) &disp->Color3sv;
+ snprintf(symboln, sizeof(symboln), "%sColor3sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3ub) {
+ void ** procp = (void **) &disp->Color3ub;
+ snprintf(symboln, sizeof(symboln), "%sColor3ub", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3ubv) {
+ void ** procp = (void **) &disp->Color3ubv;
+ snprintf(symboln, sizeof(symboln), "%sColor3ubv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3ui) {
+ void ** procp = (void **) &disp->Color3ui;
+ snprintf(symboln, sizeof(symboln), "%sColor3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3uiv) {
+ void ** procp = (void **) &disp->Color3uiv;
+ snprintf(symboln, sizeof(symboln), "%sColor3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3us) {
+ void ** procp = (void **) &disp->Color3us;
+ snprintf(symboln, sizeof(symboln), "%sColor3us", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color3usv) {
+ void ** procp = (void **) &disp->Color3usv;
+ snprintf(symboln, sizeof(symboln), "%sColor3usv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4b) {
+ void ** procp = (void **) &disp->Color4b;
+ snprintf(symboln, sizeof(symboln), "%sColor4b", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4bv) {
+ void ** procp = (void **) &disp->Color4bv;
+ snprintf(symboln, sizeof(symboln), "%sColor4bv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4d) {
+ void ** procp = (void **) &disp->Color4d;
+ snprintf(symboln, sizeof(symboln), "%sColor4d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4dv) {
+ void ** procp = (void **) &disp->Color4dv;
+ snprintf(symboln, sizeof(symboln), "%sColor4dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4f) {
+ void ** procp = (void **) &disp->Color4f;
+ snprintf(symboln, sizeof(symboln), "%sColor4f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4fv) {
+ void ** procp = (void **) &disp->Color4fv;
+ snprintf(symboln, sizeof(symboln), "%sColor4fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4i) {
+ void ** procp = (void **) &disp->Color4i;
+ snprintf(symboln, sizeof(symboln), "%sColor4i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4iv) {
+ void ** procp = (void **) &disp->Color4iv;
+ snprintf(symboln, sizeof(symboln), "%sColor4iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4s) {
+ void ** procp = (void **) &disp->Color4s;
+ snprintf(symboln, sizeof(symboln), "%sColor4s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4sv) {
+ void ** procp = (void **) &disp->Color4sv;
+ snprintf(symboln, sizeof(symboln), "%sColor4sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4ub) {
+ void ** procp = (void **) &disp->Color4ub;
+ snprintf(symboln, sizeof(symboln), "%sColor4ub", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4ubv) {
+ void ** procp = (void **) &disp->Color4ubv;
+ snprintf(symboln, sizeof(symboln), "%sColor4ubv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4ui) {
+ void ** procp = (void **) &disp->Color4ui;
+ snprintf(symboln, sizeof(symboln), "%sColor4ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4uiv) {
+ void ** procp = (void **) &disp->Color4uiv;
+ snprintf(symboln, sizeof(symboln), "%sColor4uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4us) {
+ void ** procp = (void **) &disp->Color4us;
+ snprintf(symboln, sizeof(symboln), "%sColor4us", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Color4usv) {
+ void ** procp = (void **) &disp->Color4usv;
+ snprintf(symboln, sizeof(symboln), "%sColor4usv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EdgeFlag) {
+ void ** procp = (void **) &disp->EdgeFlag;
+ snprintf(symboln, sizeof(symboln), "%sEdgeFlag", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EdgeFlagv) {
+ void ** procp = (void **) &disp->EdgeFlagv;
+ snprintf(symboln, sizeof(symboln), "%sEdgeFlagv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->End) {
+ void ** procp = (void **) &disp->End;
+ snprintf(symboln, sizeof(symboln), "%sEnd", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Indexd) {
+ void ** procp = (void **) &disp->Indexd;
+ snprintf(symboln, sizeof(symboln), "%sIndexd", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Indexdv) {
+ void ** procp = (void **) &disp->Indexdv;
+ snprintf(symboln, sizeof(symboln), "%sIndexdv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Indexf) {
+ void ** procp = (void **) &disp->Indexf;
+ snprintf(symboln, sizeof(symboln), "%sIndexf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Indexfv) {
+ void ** procp = (void **) &disp->Indexfv;
+ snprintf(symboln, sizeof(symboln), "%sIndexfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Indexi) {
+ void ** procp = (void **) &disp->Indexi;
+ snprintf(symboln, sizeof(symboln), "%sIndexi", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Indexiv) {
+ void ** procp = (void **) &disp->Indexiv;
+ snprintf(symboln, sizeof(symboln), "%sIndexiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Indexs) {
+ void ** procp = (void **) &disp->Indexs;
+ snprintf(symboln, sizeof(symboln), "%sIndexs", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Indexsv) {
+ void ** procp = (void **) &disp->Indexsv;
+ snprintf(symboln, sizeof(symboln), "%sIndexsv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Normal3b) {
+ void ** procp = (void **) &disp->Normal3b;
+ snprintf(symboln, sizeof(symboln), "%sNormal3b", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Normal3bv) {
+ void ** procp = (void **) &disp->Normal3bv;
+ snprintf(symboln, sizeof(symboln), "%sNormal3bv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Normal3d) {
+ void ** procp = (void **) &disp->Normal3d;
+ snprintf(symboln, sizeof(symboln), "%sNormal3d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Normal3dv) {
+ void ** procp = (void **) &disp->Normal3dv;
+ snprintf(symboln, sizeof(symboln), "%sNormal3dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Normal3f) {
+ void ** procp = (void **) &disp->Normal3f;
+ snprintf(symboln, sizeof(symboln), "%sNormal3f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Normal3fv) {
+ void ** procp = (void **) &disp->Normal3fv;
+ snprintf(symboln, sizeof(symboln), "%sNormal3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Normal3i) {
+ void ** procp = (void **) &disp->Normal3i;
+ snprintf(symboln, sizeof(symboln), "%sNormal3i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Normal3iv) {
+ void ** procp = (void **) &disp->Normal3iv;
+ snprintf(symboln, sizeof(symboln), "%sNormal3iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Normal3s) {
+ void ** procp = (void **) &disp->Normal3s;
+ snprintf(symboln, sizeof(symboln), "%sNormal3s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Normal3sv) {
+ void ** procp = (void **) &disp->Normal3sv;
+ snprintf(symboln, sizeof(symboln), "%sNormal3sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos2d) {
+ void ** procp = (void **) &disp->RasterPos2d;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos2d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos2dv) {
+ void ** procp = (void **) &disp->RasterPos2dv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos2dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos2f) {
+ void ** procp = (void **) &disp->RasterPos2f;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos2f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos2fv) {
+ void ** procp = (void **) &disp->RasterPos2fv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos2i) {
+ void ** procp = (void **) &disp->RasterPos2i;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos2i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos2iv) {
+ void ** procp = (void **) &disp->RasterPos2iv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos2iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos2s) {
+ void ** procp = (void **) &disp->RasterPos2s;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos2s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos2sv) {
+ void ** procp = (void **) &disp->RasterPos2sv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos2sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos3d) {
+ void ** procp = (void **) &disp->RasterPos3d;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos3d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos3dv) {
+ void ** procp = (void **) &disp->RasterPos3dv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos3dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos3f) {
+ void ** procp = (void **) &disp->RasterPos3f;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos3f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos3fv) {
+ void ** procp = (void **) &disp->RasterPos3fv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos3i) {
+ void ** procp = (void **) &disp->RasterPos3i;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos3i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos3iv) {
+ void ** procp = (void **) &disp->RasterPos3iv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos3iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos3s) {
+ void ** procp = (void **) &disp->RasterPos3s;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos3s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos3sv) {
+ void ** procp = (void **) &disp->RasterPos3sv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos3sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos4d) {
+ void ** procp = (void **) &disp->RasterPos4d;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos4d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos4dv) {
+ void ** procp = (void **) &disp->RasterPos4dv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos4dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos4f) {
+ void ** procp = (void **) &disp->RasterPos4f;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos4f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos4fv) {
+ void ** procp = (void **) &disp->RasterPos4fv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos4fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos4i) {
+ void ** procp = (void **) &disp->RasterPos4i;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos4i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos4iv) {
+ void ** procp = (void **) &disp->RasterPos4iv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos4iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos4s) {
+ void ** procp = (void **) &disp->RasterPos4s;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos4s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RasterPos4sv) {
+ void ** procp = (void **) &disp->RasterPos4sv;
+ snprintf(symboln, sizeof(symboln), "%sRasterPos4sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Rectd) {
+ void ** procp = (void **) &disp->Rectd;
+ snprintf(symboln, sizeof(symboln), "%sRectd", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Rectdv) {
+ void ** procp = (void **) &disp->Rectdv;
+ snprintf(symboln, sizeof(symboln), "%sRectdv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Rectf) {
+ void ** procp = (void **) &disp->Rectf;
+ snprintf(symboln, sizeof(symboln), "%sRectf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Rectfv) {
+ void ** procp = (void **) &disp->Rectfv;
+ snprintf(symboln, sizeof(symboln), "%sRectfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Recti) {
+ void ** procp = (void **) &disp->Recti;
+ snprintf(symboln, sizeof(symboln), "%sRecti", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Rectiv) {
+ void ** procp = (void **) &disp->Rectiv;
+ snprintf(symboln, sizeof(symboln), "%sRectiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Rects) {
+ void ** procp = (void **) &disp->Rects;
+ snprintf(symboln, sizeof(symboln), "%sRects", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Rectsv) {
+ void ** procp = (void **) &disp->Rectsv;
+ snprintf(symboln, sizeof(symboln), "%sRectsv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord1d) {
+ void ** procp = (void **) &disp->TexCoord1d;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord1d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord1dv) {
+ void ** procp = (void **) &disp->TexCoord1dv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord1dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord1f) {
+ void ** procp = (void **) &disp->TexCoord1f;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord1f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord1fv) {
+ void ** procp = (void **) &disp->TexCoord1fv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord1fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord1i) {
+ void ** procp = (void **) &disp->TexCoord1i;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord1i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord1iv) {
+ void ** procp = (void **) &disp->TexCoord1iv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord1iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord1s) {
+ void ** procp = (void **) &disp->TexCoord1s;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord1s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord1sv) {
+ void ** procp = (void **) &disp->TexCoord1sv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord1sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord2d) {
+ void ** procp = (void **) &disp->TexCoord2d;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord2d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord2dv) {
+ void ** procp = (void **) &disp->TexCoord2dv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord2dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord2f) {
+ void ** procp = (void **) &disp->TexCoord2f;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord2f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord2fv) {
+ void ** procp = (void **) &disp->TexCoord2fv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord2i) {
+ void ** procp = (void **) &disp->TexCoord2i;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord2i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord2iv) {
+ void ** procp = (void **) &disp->TexCoord2iv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord2iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord2s) {
+ void ** procp = (void **) &disp->TexCoord2s;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord2s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord2sv) {
+ void ** procp = (void **) &disp->TexCoord2sv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord2sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord3d) {
+ void ** procp = (void **) &disp->TexCoord3d;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord3d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord3dv) {
+ void ** procp = (void **) &disp->TexCoord3dv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord3dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord3f) {
+ void ** procp = (void **) &disp->TexCoord3f;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord3f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord3fv) {
+ void ** procp = (void **) &disp->TexCoord3fv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord3i) {
+ void ** procp = (void **) &disp->TexCoord3i;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord3i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord3iv) {
+ void ** procp = (void **) &disp->TexCoord3iv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord3iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord3s) {
+ void ** procp = (void **) &disp->TexCoord3s;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord3s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord3sv) {
+ void ** procp = (void **) &disp->TexCoord3sv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord3sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord4d) {
+ void ** procp = (void **) &disp->TexCoord4d;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord4d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord4dv) {
+ void ** procp = (void **) &disp->TexCoord4dv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord4dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord4f) {
+ void ** procp = (void **) &disp->TexCoord4f;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord4f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord4fv) {
+ void ** procp = (void **) &disp->TexCoord4fv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord4fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord4i) {
+ void ** procp = (void **) &disp->TexCoord4i;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord4i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord4iv) {
+ void ** procp = (void **) &disp->TexCoord4iv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord4iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord4s) {
+ void ** procp = (void **) &disp->TexCoord4s;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord4s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoord4sv) {
+ void ** procp = (void **) &disp->TexCoord4sv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoord4sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex2d) {
+ void ** procp = (void **) &disp->Vertex2d;
+ snprintf(symboln, sizeof(symboln), "%sVertex2d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex2dv) {
+ void ** procp = (void **) &disp->Vertex2dv;
+ snprintf(symboln, sizeof(symboln), "%sVertex2dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex2f) {
+ void ** procp = (void **) &disp->Vertex2f;
+ snprintf(symboln, sizeof(symboln), "%sVertex2f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex2fv) {
+ void ** procp = (void **) &disp->Vertex2fv;
+ snprintf(symboln, sizeof(symboln), "%sVertex2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex2i) {
+ void ** procp = (void **) &disp->Vertex2i;
+ snprintf(symboln, sizeof(symboln), "%sVertex2i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex2iv) {
+ void ** procp = (void **) &disp->Vertex2iv;
+ snprintf(symboln, sizeof(symboln), "%sVertex2iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex2s) {
+ void ** procp = (void **) &disp->Vertex2s;
+ snprintf(symboln, sizeof(symboln), "%sVertex2s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex2sv) {
+ void ** procp = (void **) &disp->Vertex2sv;
+ snprintf(symboln, sizeof(symboln), "%sVertex2sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex3d) {
+ void ** procp = (void **) &disp->Vertex3d;
+ snprintf(symboln, sizeof(symboln), "%sVertex3d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex3dv) {
+ void ** procp = (void **) &disp->Vertex3dv;
+ snprintf(symboln, sizeof(symboln), "%sVertex3dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex3f) {
+ void ** procp = (void **) &disp->Vertex3f;
+ snprintf(symboln, sizeof(symboln), "%sVertex3f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex3fv) {
+ void ** procp = (void **) &disp->Vertex3fv;
+ snprintf(symboln, sizeof(symboln), "%sVertex3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex3i) {
+ void ** procp = (void **) &disp->Vertex3i;
+ snprintf(symboln, sizeof(symboln), "%sVertex3i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex3iv) {
+ void ** procp = (void **) &disp->Vertex3iv;
+ snprintf(symboln, sizeof(symboln), "%sVertex3iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex3s) {
+ void ** procp = (void **) &disp->Vertex3s;
+ snprintf(symboln, sizeof(symboln), "%sVertex3s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex3sv) {
+ void ** procp = (void **) &disp->Vertex3sv;
+ snprintf(symboln, sizeof(symboln), "%sVertex3sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex4d) {
+ void ** procp = (void **) &disp->Vertex4d;
+ snprintf(symboln, sizeof(symboln), "%sVertex4d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex4dv) {
+ void ** procp = (void **) &disp->Vertex4dv;
+ snprintf(symboln, sizeof(symboln), "%sVertex4dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex4f) {
+ void ** procp = (void **) &disp->Vertex4f;
+ snprintf(symboln, sizeof(symboln), "%sVertex4f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex4fv) {
+ void ** procp = (void **) &disp->Vertex4fv;
+ snprintf(symboln, sizeof(symboln), "%sVertex4fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex4i) {
+ void ** procp = (void **) &disp->Vertex4i;
+ snprintf(symboln, sizeof(symboln), "%sVertex4i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex4iv) {
+ void ** procp = (void **) &disp->Vertex4iv;
+ snprintf(symboln, sizeof(symboln), "%sVertex4iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex4s) {
+ void ** procp = (void **) &disp->Vertex4s;
+ snprintf(symboln, sizeof(symboln), "%sVertex4s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Vertex4sv) {
+ void ** procp = (void **) &disp->Vertex4sv;
+ snprintf(symboln, sizeof(symboln), "%sVertex4sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClipPlane) {
+ void ** procp = (void **) &disp->ClipPlane;
+ snprintf(symboln, sizeof(symboln), "%sClipPlane", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorMaterial) {
+ void ** procp = (void **) &disp->ColorMaterial;
+ snprintf(symboln, sizeof(symboln), "%sColorMaterial", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CullFace) {
+ void ** procp = (void **) &disp->CullFace;
+ snprintf(symboln, sizeof(symboln), "%sCullFace", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Fogf) {
+ void ** procp = (void **) &disp->Fogf;
+ snprintf(symboln, sizeof(symboln), "%sFogf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Fogfv) {
+ void ** procp = (void **) &disp->Fogfv;
+ snprintf(symboln, sizeof(symboln), "%sFogfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Fogi) {
+ void ** procp = (void **) &disp->Fogi;
+ snprintf(symboln, sizeof(symboln), "%sFogi", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Fogiv) {
+ void ** procp = (void **) &disp->Fogiv;
+ snprintf(symboln, sizeof(symboln), "%sFogiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FrontFace) {
+ void ** procp = (void **) &disp->FrontFace;
+ snprintf(symboln, sizeof(symboln), "%sFrontFace", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Hint) {
+ void ** procp = (void **) &disp->Hint;
+ snprintf(symboln, sizeof(symboln), "%sHint", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Lightf) {
+ void ** procp = (void **) &disp->Lightf;
+ snprintf(symboln, sizeof(symboln), "%sLightf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Lightfv) {
+ void ** procp = (void **) &disp->Lightfv;
+ snprintf(symboln, sizeof(symboln), "%sLightfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Lighti) {
+ void ** procp = (void **) &disp->Lighti;
+ snprintf(symboln, sizeof(symboln), "%sLighti", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Lightiv) {
+ void ** procp = (void **) &disp->Lightiv;
+ snprintf(symboln, sizeof(symboln), "%sLightiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LightModelf) {
+ void ** procp = (void **) &disp->LightModelf;
+ snprintf(symboln, sizeof(symboln), "%sLightModelf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LightModelfv) {
+ void ** procp = (void **) &disp->LightModelfv;
+ snprintf(symboln, sizeof(symboln), "%sLightModelfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LightModeli) {
+ void ** procp = (void **) &disp->LightModeli;
+ snprintf(symboln, sizeof(symboln), "%sLightModeli", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LightModeliv) {
+ void ** procp = (void **) &disp->LightModeliv;
+ snprintf(symboln, sizeof(symboln), "%sLightModeliv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LineStipple) {
+ void ** procp = (void **) &disp->LineStipple;
+ snprintf(symboln, sizeof(symboln), "%sLineStipple", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LineWidth) {
+ void ** procp = (void **) &disp->LineWidth;
+ snprintf(symboln, sizeof(symboln), "%sLineWidth", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Materialf) {
+ void ** procp = (void **) &disp->Materialf;
+ snprintf(symboln, sizeof(symboln), "%sMaterialf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Materialfv) {
+ void ** procp = (void **) &disp->Materialfv;
+ snprintf(symboln, sizeof(symboln), "%sMaterialfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Materiali) {
+ void ** procp = (void **) &disp->Materiali;
+ snprintf(symboln, sizeof(symboln), "%sMateriali", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Materialiv) {
+ void ** procp = (void **) &disp->Materialiv;
+ snprintf(symboln, sizeof(symboln), "%sMaterialiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointSize) {
+ void ** procp = (void **) &disp->PointSize;
+ snprintf(symboln, sizeof(symboln), "%sPointSize", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PolygonMode) {
+ void ** procp = (void **) &disp->PolygonMode;
+ snprintf(symboln, sizeof(symboln), "%sPolygonMode", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PolygonStipple) {
+ void ** procp = (void **) &disp->PolygonStipple;
+ snprintf(symboln, sizeof(symboln), "%sPolygonStipple", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Scissor) {
+ void ** procp = (void **) &disp->Scissor;
+ snprintf(symboln, sizeof(symboln), "%sScissor", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ShadeModel) {
+ void ** procp = (void **) &disp->ShadeModel;
+ snprintf(symboln, sizeof(symboln), "%sShadeModel", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexParameterf) {
+ void ** procp = (void **) &disp->TexParameterf;
+ snprintf(symboln, sizeof(symboln), "%sTexParameterf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexParameterfv) {
+ void ** procp = (void **) &disp->TexParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sTexParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexParameteri) {
+ void ** procp = (void **) &disp->TexParameteri;
+ snprintf(symboln, sizeof(symboln), "%sTexParameteri", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexParameteriv) {
+ void ** procp = (void **) &disp->TexParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sTexParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexImage1D) {
+ void ** procp = (void **) &disp->TexImage1D;
+ snprintf(symboln, sizeof(symboln), "%sTexImage1D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexImage2D) {
+ void ** procp = (void **) &disp->TexImage2D;
+ snprintf(symboln, sizeof(symboln), "%sTexImage2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexEnvf) {
+ void ** procp = (void **) &disp->TexEnvf;
+ snprintf(symboln, sizeof(symboln), "%sTexEnvf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexEnvfv) {
+ void ** procp = (void **) &disp->TexEnvfv;
+ snprintf(symboln, sizeof(symboln), "%sTexEnvfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexEnvi) {
+ void ** procp = (void **) &disp->TexEnvi;
+ snprintf(symboln, sizeof(symboln), "%sTexEnvi", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexEnviv) {
+ void ** procp = (void **) &disp->TexEnviv;
+ snprintf(symboln, sizeof(symboln), "%sTexEnviv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexGend) {
+ void ** procp = (void **) &disp->TexGend;
+ snprintf(symboln, sizeof(symboln), "%sTexGend", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexGendv) {
+ void ** procp = (void **) &disp->TexGendv;
+ snprintf(symboln, sizeof(symboln), "%sTexGendv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexGenf) {
+ void ** procp = (void **) &disp->TexGenf;
+ snprintf(symboln, sizeof(symboln), "%sTexGenf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexGenfv) {
+ void ** procp = (void **) &disp->TexGenfv;
+ snprintf(symboln, sizeof(symboln), "%sTexGenfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexGeni) {
+ void ** procp = (void **) &disp->TexGeni;
+ snprintf(symboln, sizeof(symboln), "%sTexGeni", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexGeniv) {
+ void ** procp = (void **) &disp->TexGeniv;
+ snprintf(symboln, sizeof(symboln), "%sTexGeniv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FeedbackBuffer) {
+ void ** procp = (void **) &disp->FeedbackBuffer;
+ snprintf(symboln, sizeof(symboln), "%sFeedbackBuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SelectBuffer) {
+ void ** procp = (void **) &disp->SelectBuffer;
+ snprintf(symboln, sizeof(symboln), "%sSelectBuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RenderMode) {
+ void ** procp = (void **) &disp->RenderMode;
+ snprintf(symboln, sizeof(symboln), "%sRenderMode", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->InitNames) {
+ void ** procp = (void **) &disp->InitNames;
+ snprintf(symboln, sizeof(symboln), "%sInitNames", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LoadName) {
+ void ** procp = (void **) &disp->LoadName;
+ snprintf(symboln, sizeof(symboln), "%sLoadName", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PassThrough) {
+ void ** procp = (void **) &disp->PassThrough;
+ snprintf(symboln, sizeof(symboln), "%sPassThrough", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PopName) {
+ void ** procp = (void **) &disp->PopName;
+ snprintf(symboln, sizeof(symboln), "%sPopName", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PushName) {
+ void ** procp = (void **) &disp->PushName;
+ snprintf(symboln, sizeof(symboln), "%sPushName", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawBuffer) {
+ void ** procp = (void **) &disp->DrawBuffer;
+ snprintf(symboln, sizeof(symboln), "%sDrawBuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Clear) {
+ void ** procp = (void **) &disp->Clear;
+ snprintf(symboln, sizeof(symboln), "%sClear", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearAccum) {
+ void ** procp = (void **) &disp->ClearAccum;
+ snprintf(symboln, sizeof(symboln), "%sClearAccum", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearIndex) {
+ void ** procp = (void **) &disp->ClearIndex;
+ snprintf(symboln, sizeof(symboln), "%sClearIndex", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearColor) {
+ void ** procp = (void **) &disp->ClearColor;
+ snprintf(symboln, sizeof(symboln), "%sClearColor", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearStencil) {
+ void ** procp = (void **) &disp->ClearStencil;
+ snprintf(symboln, sizeof(symboln), "%sClearStencil", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearDepth) {
+ void ** procp = (void **) &disp->ClearDepth;
+ snprintf(symboln, sizeof(symboln), "%sClearDepth", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->StencilMask) {
+ void ** procp = (void **) &disp->StencilMask;
+ snprintf(symboln, sizeof(symboln), "%sStencilMask", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorMask) {
+ void ** procp = (void **) &disp->ColorMask;
+ snprintf(symboln, sizeof(symboln), "%sColorMask", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DepthMask) {
+ void ** procp = (void **) &disp->DepthMask;
+ snprintf(symboln, sizeof(symboln), "%sDepthMask", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IndexMask) {
+ void ** procp = (void **) &disp->IndexMask;
+ snprintf(symboln, sizeof(symboln), "%sIndexMask", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Accum) {
+ void ** procp = (void **) &disp->Accum;
+ snprintf(symboln, sizeof(symboln), "%sAccum", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Disable) {
+ void ** procp = (void **) &disp->Disable;
+ snprintf(symboln, sizeof(symboln), "%sDisable", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Enable) {
+ void ** procp = (void **) &disp->Enable;
+ snprintf(symboln, sizeof(symboln), "%sEnable", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Finish) {
+ void ** procp = (void **) &disp->Finish;
+ snprintf(symboln, sizeof(symboln), "%sFinish", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Flush) {
+ void ** procp = (void **) &disp->Flush;
+ snprintf(symboln, sizeof(symboln), "%sFlush", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PopAttrib) {
+ void ** procp = (void **) &disp->PopAttrib;
+ snprintf(symboln, sizeof(symboln), "%sPopAttrib", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PushAttrib) {
+ void ** procp = (void **) &disp->PushAttrib;
+ snprintf(symboln, sizeof(symboln), "%sPushAttrib", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Map1d) {
+ void ** procp = (void **) &disp->Map1d;
+ snprintf(symboln, sizeof(symboln), "%sMap1d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Map1f) {
+ void ** procp = (void **) &disp->Map1f;
+ snprintf(symboln, sizeof(symboln), "%sMap1f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Map2d) {
+ void ** procp = (void **) &disp->Map2d;
+ snprintf(symboln, sizeof(symboln), "%sMap2d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Map2f) {
+ void ** procp = (void **) &disp->Map2f;
+ snprintf(symboln, sizeof(symboln), "%sMap2f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MapGrid1d) {
+ void ** procp = (void **) &disp->MapGrid1d;
+ snprintf(symboln, sizeof(symboln), "%sMapGrid1d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MapGrid1f) {
+ void ** procp = (void **) &disp->MapGrid1f;
+ snprintf(symboln, sizeof(symboln), "%sMapGrid1f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MapGrid2d) {
+ void ** procp = (void **) &disp->MapGrid2d;
+ snprintf(symboln, sizeof(symboln), "%sMapGrid2d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MapGrid2f) {
+ void ** procp = (void **) &disp->MapGrid2f;
+ snprintf(symboln, sizeof(symboln), "%sMapGrid2f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalCoord1d) {
+ void ** procp = (void **) &disp->EvalCoord1d;
+ snprintf(symboln, sizeof(symboln), "%sEvalCoord1d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalCoord1dv) {
+ void ** procp = (void **) &disp->EvalCoord1dv;
+ snprintf(symboln, sizeof(symboln), "%sEvalCoord1dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalCoord1f) {
+ void ** procp = (void **) &disp->EvalCoord1f;
+ snprintf(symboln, sizeof(symboln), "%sEvalCoord1f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalCoord1fv) {
+ void ** procp = (void **) &disp->EvalCoord1fv;
+ snprintf(symboln, sizeof(symboln), "%sEvalCoord1fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalCoord2d) {
+ void ** procp = (void **) &disp->EvalCoord2d;
+ snprintf(symboln, sizeof(symboln), "%sEvalCoord2d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalCoord2dv) {
+ void ** procp = (void **) &disp->EvalCoord2dv;
+ snprintf(symboln, sizeof(symboln), "%sEvalCoord2dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalCoord2f) {
+ void ** procp = (void **) &disp->EvalCoord2f;
+ snprintf(symboln, sizeof(symboln), "%sEvalCoord2f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalCoord2fv) {
+ void ** procp = (void **) &disp->EvalCoord2fv;
+ snprintf(symboln, sizeof(symboln), "%sEvalCoord2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalMesh1) {
+ void ** procp = (void **) &disp->EvalMesh1;
+ snprintf(symboln, sizeof(symboln), "%sEvalMesh1", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalPoint1) {
+ void ** procp = (void **) &disp->EvalPoint1;
+ snprintf(symboln, sizeof(symboln), "%sEvalPoint1", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalMesh2) {
+ void ** procp = (void **) &disp->EvalMesh2;
+ snprintf(symboln, sizeof(symboln), "%sEvalMesh2", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EvalPoint2) {
+ void ** procp = (void **) &disp->EvalPoint2;
+ snprintf(symboln, sizeof(symboln), "%sEvalPoint2", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->AlphaFunc) {
+ void ** procp = (void **) &disp->AlphaFunc;
+ snprintf(symboln, sizeof(symboln), "%sAlphaFunc", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendFunc) {
+ void ** procp = (void **) &disp->BlendFunc;
+ snprintf(symboln, sizeof(symboln), "%sBlendFunc", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LogicOp) {
+ void ** procp = (void **) &disp->LogicOp;
+ snprintf(symboln, sizeof(symboln), "%sLogicOp", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->StencilFunc) {
+ void ** procp = (void **) &disp->StencilFunc;
+ snprintf(symboln, sizeof(symboln), "%sStencilFunc", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->StencilOp) {
+ void ** procp = (void **) &disp->StencilOp;
+ snprintf(symboln, sizeof(symboln), "%sStencilOp", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DepthFunc) {
+ void ** procp = (void **) &disp->DepthFunc;
+ snprintf(symboln, sizeof(symboln), "%sDepthFunc", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelZoom) {
+ void ** procp = (void **) &disp->PixelZoom;
+ snprintf(symboln, sizeof(symboln), "%sPixelZoom", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelTransferf) {
+ void ** procp = (void **) &disp->PixelTransferf;
+ snprintf(symboln, sizeof(symboln), "%sPixelTransferf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelTransferi) {
+ void ** procp = (void **) &disp->PixelTransferi;
+ snprintf(symboln, sizeof(symboln), "%sPixelTransferi", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelStoref) {
+ void ** procp = (void **) &disp->PixelStoref;
+ snprintf(symboln, sizeof(symboln), "%sPixelStoref", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelStorei) {
+ void ** procp = (void **) &disp->PixelStorei;
+ snprintf(symboln, sizeof(symboln), "%sPixelStorei", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelMapfv) {
+ void ** procp = (void **) &disp->PixelMapfv;
+ snprintf(symboln, sizeof(symboln), "%sPixelMapfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelMapuiv) {
+ void ** procp = (void **) &disp->PixelMapuiv;
+ snprintf(symboln, sizeof(symboln), "%sPixelMapuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelMapusv) {
+ void ** procp = (void **) &disp->PixelMapusv;
+ snprintf(symboln, sizeof(symboln), "%sPixelMapusv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ReadBuffer) {
+ void ** procp = (void **) &disp->ReadBuffer;
+ snprintf(symboln, sizeof(symboln), "%sReadBuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyPixels) {
+ void ** procp = (void **) &disp->CopyPixels;
+ snprintf(symboln, sizeof(symboln), "%sCopyPixels", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ReadPixels) {
+ void ** procp = (void **) &disp->ReadPixels;
+ snprintf(symboln, sizeof(symboln), "%sReadPixels", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawPixels) {
+ void ** procp = (void **) &disp->DrawPixels;
+ snprintf(symboln, sizeof(symboln), "%sDrawPixels", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetBooleanv) {
+ void ** procp = (void **) &disp->GetBooleanv;
+ snprintf(symboln, sizeof(symboln), "%sGetBooleanv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetClipPlane) {
+ void ** procp = (void **) &disp->GetClipPlane;
+ snprintf(symboln, sizeof(symboln), "%sGetClipPlane", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetDoublev) {
+ void ** procp = (void **) &disp->GetDoublev;
+ snprintf(symboln, sizeof(symboln), "%sGetDoublev", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetError) {
+ void ** procp = (void **) &disp->GetError;
+ snprintf(symboln, sizeof(symboln), "%sGetError", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetFloatv) {
+ void ** procp = (void **) &disp->GetFloatv;
+ snprintf(symboln, sizeof(symboln), "%sGetFloatv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetIntegerv) {
+ void ** procp = (void **) &disp->GetIntegerv;
+ snprintf(symboln, sizeof(symboln), "%sGetIntegerv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetLightfv) {
+ void ** procp = (void **) &disp->GetLightfv;
+ snprintf(symboln, sizeof(symboln), "%sGetLightfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetLightiv) {
+ void ** procp = (void **) &disp->GetLightiv;
+ snprintf(symboln, sizeof(symboln), "%sGetLightiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMapdv) {
+ void ** procp = (void **) &disp->GetMapdv;
+ snprintf(symboln, sizeof(symboln), "%sGetMapdv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMapfv) {
+ void ** procp = (void **) &disp->GetMapfv;
+ snprintf(symboln, sizeof(symboln), "%sGetMapfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMapiv) {
+ void ** procp = (void **) &disp->GetMapiv;
+ snprintf(symboln, sizeof(symboln), "%sGetMapiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMaterialfv) {
+ void ** procp = (void **) &disp->GetMaterialfv;
+ snprintf(symboln, sizeof(symboln), "%sGetMaterialfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMaterialiv) {
+ void ** procp = (void **) &disp->GetMaterialiv;
+ snprintf(symboln, sizeof(symboln), "%sGetMaterialiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetPixelMapfv) {
+ void ** procp = (void **) &disp->GetPixelMapfv;
+ snprintf(symboln, sizeof(symboln), "%sGetPixelMapfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetPixelMapuiv) {
+ void ** procp = (void **) &disp->GetPixelMapuiv;
+ snprintf(symboln, sizeof(symboln), "%sGetPixelMapuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetPixelMapusv) {
+ void ** procp = (void **) &disp->GetPixelMapusv;
+ snprintf(symboln, sizeof(symboln), "%sGetPixelMapusv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetPolygonStipple) {
+ void ** procp = (void **) &disp->GetPolygonStipple;
+ snprintf(symboln, sizeof(symboln), "%sGetPolygonStipple", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetString) {
+ void ** procp = (void **) &disp->GetString;
+ snprintf(symboln, sizeof(symboln), "%sGetString", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexEnvfv) {
+ void ** procp = (void **) &disp->GetTexEnvfv;
+ snprintf(symboln, sizeof(symboln), "%sGetTexEnvfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexEnviv) {
+ void ** procp = (void **) &disp->GetTexEnviv;
+ snprintf(symboln, sizeof(symboln), "%sGetTexEnviv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexGendv) {
+ void ** procp = (void **) &disp->GetTexGendv;
+ snprintf(symboln, sizeof(symboln), "%sGetTexGendv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexGenfv) {
+ void ** procp = (void **) &disp->GetTexGenfv;
+ snprintf(symboln, sizeof(symboln), "%sGetTexGenfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexGeniv) {
+ void ** procp = (void **) &disp->GetTexGeniv;
+ snprintf(symboln, sizeof(symboln), "%sGetTexGeniv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexImage) {
+ void ** procp = (void **) &disp->GetTexImage;
+ snprintf(symboln, sizeof(symboln), "%sGetTexImage", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexParameterfv) {
+ void ** procp = (void **) &disp->GetTexParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetTexParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexParameteriv) {
+ void ** procp = (void **) &disp->GetTexParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetTexParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexLevelParameterfv) {
+ void ** procp = (void **) &disp->GetTexLevelParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetTexLevelParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexLevelParameteriv) {
+ void ** procp = (void **) &disp->GetTexLevelParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetTexLevelParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsEnabled) {
+ void ** procp = (void **) &disp->IsEnabled;
+ snprintf(symboln, sizeof(symboln), "%sIsEnabled", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsList) {
+ void ** procp = (void **) &disp->IsList;
+ snprintf(symboln, sizeof(symboln), "%sIsList", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DepthRange) {
+ void ** procp = (void **) &disp->DepthRange;
+ snprintf(symboln, sizeof(symboln), "%sDepthRange", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Frustum) {
+ void ** procp = (void **) &disp->Frustum;
+ snprintf(symboln, sizeof(symboln), "%sFrustum", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LoadIdentity) {
+ void ** procp = (void **) &disp->LoadIdentity;
+ snprintf(symboln, sizeof(symboln), "%sLoadIdentity", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LoadMatrixf) {
+ void ** procp = (void **) &disp->LoadMatrixf;
+ snprintf(symboln, sizeof(symboln), "%sLoadMatrixf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LoadMatrixd) {
+ void ** procp = (void **) &disp->LoadMatrixd;
+ snprintf(symboln, sizeof(symboln), "%sLoadMatrixd", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MatrixMode) {
+ void ** procp = (void **) &disp->MatrixMode;
+ snprintf(symboln, sizeof(symboln), "%sMatrixMode", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultMatrixf) {
+ void ** procp = (void **) &disp->MultMatrixf;
+ snprintf(symboln, sizeof(symboln), "%sMultMatrixf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultMatrixd) {
+ void ** procp = (void **) &disp->MultMatrixd;
+ snprintf(symboln, sizeof(symboln), "%sMultMatrixd", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Ortho) {
+ void ** procp = (void **) &disp->Ortho;
+ snprintf(symboln, sizeof(symboln), "%sOrtho", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PopMatrix) {
+ void ** procp = (void **) &disp->PopMatrix;
+ snprintf(symboln, sizeof(symboln), "%sPopMatrix", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PushMatrix) {
+ void ** procp = (void **) &disp->PushMatrix;
+ snprintf(symboln, sizeof(symboln), "%sPushMatrix", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Rotated) {
+ void ** procp = (void **) &disp->Rotated;
+ snprintf(symboln, sizeof(symboln), "%sRotated", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Rotatef) {
+ void ** procp = (void **) &disp->Rotatef;
+ snprintf(symboln, sizeof(symboln), "%sRotatef", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Scaled) {
+ void ** procp = (void **) &disp->Scaled;
+ snprintf(symboln, sizeof(symboln), "%sScaled", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Scalef) {
+ void ** procp = (void **) &disp->Scalef;
+ snprintf(symboln, sizeof(symboln), "%sScalef", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Translated) {
+ void ** procp = (void **) &disp->Translated;
+ snprintf(symboln, sizeof(symboln), "%sTranslated", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Translatef) {
+ void ** procp = (void **) &disp->Translatef;
+ snprintf(symboln, sizeof(symboln), "%sTranslatef", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Viewport) {
+ void ** procp = (void **) &disp->Viewport;
+ snprintf(symboln, sizeof(symboln), "%sViewport", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ArrayElement) {
+ void ** procp = (void **) &disp->ArrayElement;
+ snprintf(symboln, sizeof(symboln), "%sArrayElement", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ArrayElement) {
+ void ** procp = (void **) &disp->ArrayElement;
+ snprintf(symboln, sizeof(symboln), "%sArrayElementEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindTexture) {
+ void ** procp = (void **) &disp->BindTexture;
+ snprintf(symboln, sizeof(symboln), "%sBindTexture", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindTexture) {
+ void ** procp = (void **) &disp->BindTexture;
+ snprintf(symboln, sizeof(symboln), "%sBindTextureEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorPointer) {
+ void ** procp = (void **) &disp->ColorPointer;
+ snprintf(symboln, sizeof(symboln), "%sColorPointer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DisableClientState) {
+ void ** procp = (void **) &disp->DisableClientState;
+ snprintf(symboln, sizeof(symboln), "%sDisableClientState", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawArrays) {
+ void ** procp = (void **) &disp->DrawArrays;
+ snprintf(symboln, sizeof(symboln), "%sDrawArrays", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawArrays) {
+ void ** procp = (void **) &disp->DrawArrays;
+ snprintf(symboln, sizeof(symboln), "%sDrawArraysEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawElements) {
+ void ** procp = (void **) &disp->DrawElements;
+ snprintf(symboln, sizeof(symboln), "%sDrawElements", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EdgeFlagPointer) {
+ void ** procp = (void **) &disp->EdgeFlagPointer;
+ snprintf(symboln, sizeof(symboln), "%sEdgeFlagPointer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EnableClientState) {
+ void ** procp = (void **) &disp->EnableClientState;
+ snprintf(symboln, sizeof(symboln), "%sEnableClientState", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IndexPointer) {
+ void ** procp = (void **) &disp->IndexPointer;
+ snprintf(symboln, sizeof(symboln), "%sIndexPointer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Indexub) {
+ void ** procp = (void **) &disp->Indexub;
+ snprintf(symboln, sizeof(symboln), "%sIndexub", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Indexubv) {
+ void ** procp = (void **) &disp->Indexubv;
+ snprintf(symboln, sizeof(symboln), "%sIndexubv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->InterleavedArrays) {
+ void ** procp = (void **) &disp->InterleavedArrays;
+ snprintf(symboln, sizeof(symboln), "%sInterleavedArrays", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->NormalPointer) {
+ void ** procp = (void **) &disp->NormalPointer;
+ snprintf(symboln, sizeof(symboln), "%sNormalPointer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PolygonOffset) {
+ void ** procp = (void **) &disp->PolygonOffset;
+ snprintf(symboln, sizeof(symboln), "%sPolygonOffset", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoordPointer) {
+ void ** procp = (void **) &disp->TexCoordPointer;
+ snprintf(symboln, sizeof(symboln), "%sTexCoordPointer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexPointer) {
+ void ** procp = (void **) &disp->VertexPointer;
+ snprintf(symboln, sizeof(symboln), "%sVertexPointer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->AreTexturesResident) {
+ void ** procp = (void **) &disp->AreTexturesResident;
+ snprintf(symboln, sizeof(symboln), "%sAreTexturesResident", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->AreTexturesResident) {
+ void ** procp = (void **) &disp->AreTexturesResident;
+ snprintf(symboln, sizeof(symboln), "%sAreTexturesResidentEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyTexImage1D) {
+ void ** procp = (void **) &disp->CopyTexImage1D;
+ snprintf(symboln, sizeof(symboln), "%sCopyTexImage1D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyTexImage1D) {
+ void ** procp = (void **) &disp->CopyTexImage1D;
+ snprintf(symboln, sizeof(symboln), "%sCopyTexImage1DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyTexImage2D) {
+ void ** procp = (void **) &disp->CopyTexImage2D;
+ snprintf(symboln, sizeof(symboln), "%sCopyTexImage2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyTexImage2D) {
+ void ** procp = (void **) &disp->CopyTexImage2D;
+ snprintf(symboln, sizeof(symboln), "%sCopyTexImage2DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyTexSubImage1D) {
+ void ** procp = (void **) &disp->CopyTexSubImage1D;
+ snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage1D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyTexSubImage1D) {
+ void ** procp = (void **) &disp->CopyTexSubImage1D;
+ snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage1DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyTexSubImage2D) {
+ void ** procp = (void **) &disp->CopyTexSubImage2D;
+ snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyTexSubImage2D) {
+ void ** procp = (void **) &disp->CopyTexSubImage2D;
+ snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage2DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteTextures) {
+ void ** procp = (void **) &disp->DeleteTextures;
+ snprintf(symboln, sizeof(symboln), "%sDeleteTextures", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteTextures) {
+ void ** procp = (void **) &disp->DeleteTextures;
+ snprintf(symboln, sizeof(symboln), "%sDeleteTexturesEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenTextures) {
+ void ** procp = (void **) &disp->GenTextures;
+ snprintf(symboln, sizeof(symboln), "%sGenTextures", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenTextures) {
+ void ** procp = (void **) &disp->GenTextures;
+ snprintf(symboln, sizeof(symboln), "%sGenTexturesEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetPointerv) {
+ void ** procp = (void **) &disp->GetPointerv;
+ snprintf(symboln, sizeof(symboln), "%sGetPointerv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetPointerv) {
+ void ** procp = (void **) &disp->GetPointerv;
+ snprintf(symboln, sizeof(symboln), "%sGetPointervEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsTexture) {
+ void ** procp = (void **) &disp->IsTexture;
+ snprintf(symboln, sizeof(symboln), "%sIsTexture", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsTexture) {
+ void ** procp = (void **) &disp->IsTexture;
+ snprintf(symboln, sizeof(symboln), "%sIsTextureEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PrioritizeTextures) {
+ void ** procp = (void **) &disp->PrioritizeTextures;
+ snprintf(symboln, sizeof(symboln), "%sPrioritizeTextures", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PrioritizeTextures) {
+ void ** procp = (void **) &disp->PrioritizeTextures;
+ snprintf(symboln, sizeof(symboln), "%sPrioritizeTexturesEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexSubImage1D) {
+ void ** procp = (void **) &disp->TexSubImage1D;
+ snprintf(symboln, sizeof(symboln), "%sTexSubImage1D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexSubImage1D) {
+ void ** procp = (void **) &disp->TexSubImage1D;
+ snprintf(symboln, sizeof(symboln), "%sTexSubImage1DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexSubImage2D) {
+ void ** procp = (void **) &disp->TexSubImage2D;
+ snprintf(symboln, sizeof(symboln), "%sTexSubImage2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexSubImage2D) {
+ void ** procp = (void **) &disp->TexSubImage2D;
+ snprintf(symboln, sizeof(symboln), "%sTexSubImage2DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PopClientAttrib) {
+ void ** procp = (void **) &disp->PopClientAttrib;
+ snprintf(symboln, sizeof(symboln), "%sPopClientAttrib", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PushClientAttrib) {
+ void ** procp = (void **) &disp->PushClientAttrib;
+ snprintf(symboln, sizeof(symboln), "%sPushClientAttrib", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendColor) {
+ void ** procp = (void **) &disp->BlendColor;
+ snprintf(symboln, sizeof(symboln), "%sBlendColor", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendColor) {
+ void ** procp = (void **) &disp->BlendColor;
+ snprintf(symboln, sizeof(symboln), "%sBlendColorEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendEquation) {
+ void ** procp = (void **) &disp->BlendEquation;
+ snprintf(symboln, sizeof(symboln), "%sBlendEquation", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendEquation) {
+ void ** procp = (void **) &disp->BlendEquation;
+ snprintf(symboln, sizeof(symboln), "%sBlendEquationEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawRangeElements) {
+ void ** procp = (void **) &disp->DrawRangeElements;
+ snprintf(symboln, sizeof(symboln), "%sDrawRangeElements", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawRangeElements) {
+ void ** procp = (void **) &disp->DrawRangeElements;
+ snprintf(symboln, sizeof(symboln), "%sDrawRangeElementsEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorTable) {
+ void ** procp = (void **) &disp->ColorTable;
+ snprintf(symboln, sizeof(symboln), "%sColorTable", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorTable) {
+ void ** procp = (void **) &disp->ColorTable;
+ snprintf(symboln, sizeof(symboln), "%sColorTableSGI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorTable) {
+ void ** procp = (void **) &disp->ColorTable;
+ snprintf(symboln, sizeof(symboln), "%sColorTableEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorTableParameterfv) {
+ void ** procp = (void **) &disp->ColorTableParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sColorTableParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorTableParameterfv) {
+ void ** procp = (void **) &disp->ColorTableParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sColorTableParameterfvSGI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorTableParameteriv) {
+ void ** procp = (void **) &disp->ColorTableParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sColorTableParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorTableParameteriv) {
+ void ** procp = (void **) &disp->ColorTableParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sColorTableParameterivSGI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyColorTable) {
+ void ** procp = (void **) &disp->CopyColorTable;
+ snprintf(symboln, sizeof(symboln), "%sCopyColorTable", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyColorTable) {
+ void ** procp = (void **) &disp->CopyColorTable;
+ snprintf(symboln, sizeof(symboln), "%sCopyColorTableSGI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetColorTable) {
+ void ** procp = (void **) &disp->GetColorTable;
+ snprintf(symboln, sizeof(symboln), "%sGetColorTable", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetColorTable) {
+ void ** procp = (void **) &disp->GetColorTable;
+ snprintf(symboln, sizeof(symboln), "%sGetColorTableSGI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetColorTable) {
+ void ** procp = (void **) &disp->GetColorTable;
+ snprintf(symboln, sizeof(symboln), "%sGetColorTableEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetColorTableParameterfv) {
+ void ** procp = (void **) &disp->GetColorTableParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetColorTableParameterfv) {
+ void ** procp = (void **) &disp->GetColorTableParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterfvSGI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetColorTableParameterfv) {
+ void ** procp = (void **) &disp->GetColorTableParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterfvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetColorTableParameteriv) {
+ void ** procp = (void **) &disp->GetColorTableParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetColorTableParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetColorTableParameteriv) {
+ void ** procp = (void **) &disp->GetColorTableParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterivSGI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetColorTableParameteriv) {
+ void ** procp = (void **) &disp->GetColorTableParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorSubTable) {
+ void ** procp = (void **) &disp->ColorSubTable;
+ snprintf(symboln, sizeof(symboln), "%sColorSubTable", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorSubTable) {
+ void ** procp = (void **) &disp->ColorSubTable;
+ snprintf(symboln, sizeof(symboln), "%sColorSubTableEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyColorSubTable) {
+ void ** procp = (void **) &disp->CopyColorSubTable;
+ snprintf(symboln, sizeof(symboln), "%sCopyColorSubTable", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyColorSubTable) {
+ void ** procp = (void **) &disp->CopyColorSubTable;
+ snprintf(symboln, sizeof(symboln), "%sCopyColorSubTableEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionFilter1D) {
+ void ** procp = (void **) &disp->ConvolutionFilter1D;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionFilter1D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionFilter1D) {
+ void ** procp = (void **) &disp->ConvolutionFilter1D;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionFilter1DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionFilter2D) {
+ void ** procp = (void **) &disp->ConvolutionFilter2D;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionFilter2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionFilter2D) {
+ void ** procp = (void **) &disp->ConvolutionFilter2D;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionFilter2DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionParameterf) {
+ void ** procp = (void **) &disp->ConvolutionParameterf;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionParameterf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionParameterf) {
+ void ** procp = (void **) &disp->ConvolutionParameterf;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionParameterfEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionParameterfv) {
+ void ** procp = (void **) &disp->ConvolutionParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionParameterfv) {
+ void ** procp = (void **) &disp->ConvolutionParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionParameterfvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionParameteri) {
+ void ** procp = (void **) &disp->ConvolutionParameteri;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionParameteri", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionParameteri) {
+ void ** procp = (void **) &disp->ConvolutionParameteri;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionParameteriEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionParameteriv) {
+ void ** procp = (void **) &disp->ConvolutionParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ConvolutionParameteriv) {
+ void ** procp = (void **) &disp->ConvolutionParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sConvolutionParameterivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyConvolutionFilter1D) {
+ void ** procp = (void **) &disp->CopyConvolutionFilter1D;
+ snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter1D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyConvolutionFilter1D) {
+ void ** procp = (void **) &disp->CopyConvolutionFilter1D;
+ snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter1DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyConvolutionFilter2D) {
+ void ** procp = (void **) &disp->CopyConvolutionFilter2D;
+ snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyConvolutionFilter2D) {
+ void ** procp = (void **) &disp->CopyConvolutionFilter2D;
+ snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter2DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetConvolutionFilter) {
+ void ** procp = (void **) &disp->GetConvolutionFilter;
+ snprintf(symboln, sizeof(symboln), "%sGetConvolutionFilter", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetConvolutionFilter) {
+ void ** procp = (void **) &disp->GetConvolutionFilter;
+ snprintf(symboln, sizeof(symboln), "%sGetConvolutionFilterEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetConvolutionParameterfv) {
+ void ** procp = (void **) &disp->GetConvolutionParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetConvolutionParameterfv) {
+ void ** procp = (void **) &disp->GetConvolutionParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameterfvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetConvolutionParameteriv) {
+ void ** procp = (void **) &disp->GetConvolutionParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetConvolutionParameteriv) {
+ void ** procp = (void **) &disp->GetConvolutionParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameterivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetSeparableFilter) {
+ void ** procp = (void **) &disp->GetSeparableFilter;
+ snprintf(symboln, sizeof(symboln), "%sGetSeparableFilter", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetSeparableFilter) {
+ void ** procp = (void **) &disp->GetSeparableFilter;
+ snprintf(symboln, sizeof(symboln), "%sGetSeparableFilterEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SeparableFilter2D) {
+ void ** procp = (void **) &disp->SeparableFilter2D;
+ snprintf(symboln, sizeof(symboln), "%sSeparableFilter2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SeparableFilter2D) {
+ void ** procp = (void **) &disp->SeparableFilter2D;
+ snprintf(symboln, sizeof(symboln), "%sSeparableFilter2DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetHistogram) {
+ void ** procp = (void **) &disp->GetHistogram;
+ snprintf(symboln, sizeof(symboln), "%sGetHistogram", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetHistogram) {
+ void ** procp = (void **) &disp->GetHistogram;
+ snprintf(symboln, sizeof(symboln), "%sGetHistogramEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetHistogramParameterfv) {
+ void ** procp = (void **) &disp->GetHistogramParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetHistogramParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetHistogramParameterfv) {
+ void ** procp = (void **) &disp->GetHistogramParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetHistogramParameterfvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetHistogramParameteriv) {
+ void ** procp = (void **) &disp->GetHistogramParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetHistogramParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetHistogramParameteriv) {
+ void ** procp = (void **) &disp->GetHistogramParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetHistogramParameterivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMinmax) {
+ void ** procp = (void **) &disp->GetMinmax;
+ snprintf(symboln, sizeof(symboln), "%sGetMinmax", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMinmax) {
+ void ** procp = (void **) &disp->GetMinmax;
+ snprintf(symboln, sizeof(symboln), "%sGetMinmaxEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMinmaxParameterfv) {
+ void ** procp = (void **) &disp->GetMinmaxParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMinmaxParameterfv) {
+ void ** procp = (void **) &disp->GetMinmaxParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameterfvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMinmaxParameteriv) {
+ void ** procp = (void **) &disp->GetMinmaxParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetMinmaxParameteriv) {
+ void ** procp = (void **) &disp->GetMinmaxParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameterivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Histogram) {
+ void ** procp = (void **) &disp->Histogram;
+ snprintf(symboln, sizeof(symboln), "%sHistogram", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Histogram) {
+ void ** procp = (void **) &disp->Histogram;
+ snprintf(symboln, sizeof(symboln), "%sHistogramEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Minmax) {
+ void ** procp = (void **) &disp->Minmax;
+ snprintf(symboln, sizeof(symboln), "%sMinmax", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Minmax) {
+ void ** procp = (void **) &disp->Minmax;
+ snprintf(symboln, sizeof(symboln), "%sMinmaxEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ResetHistogram) {
+ void ** procp = (void **) &disp->ResetHistogram;
+ snprintf(symboln, sizeof(symboln), "%sResetHistogram", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ResetHistogram) {
+ void ** procp = (void **) &disp->ResetHistogram;
+ snprintf(symboln, sizeof(symboln), "%sResetHistogramEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ResetMinmax) {
+ void ** procp = (void **) &disp->ResetMinmax;
+ snprintf(symboln, sizeof(symboln), "%sResetMinmax", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ResetMinmax) {
+ void ** procp = (void **) &disp->ResetMinmax;
+ snprintf(symboln, sizeof(symboln), "%sResetMinmaxEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexImage3D) {
+ void ** procp = (void **) &disp->TexImage3D;
+ snprintf(symboln, sizeof(symboln), "%sTexImage3D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexImage3D) {
+ void ** procp = (void **) &disp->TexImage3D;
+ snprintf(symboln, sizeof(symboln), "%sTexImage3DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexSubImage3D) {
+ void ** procp = (void **) &disp->TexSubImage3D;
+ snprintf(symboln, sizeof(symboln), "%sTexSubImage3D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexSubImage3D) {
+ void ** procp = (void **) &disp->TexSubImage3D;
+ snprintf(symboln, sizeof(symboln), "%sTexSubImage3DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyTexSubImage3D) {
+ void ** procp = (void **) &disp->CopyTexSubImage3D;
+ snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage3D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyTexSubImage3D) {
+ void ** procp = (void **) &disp->CopyTexSubImage3D;
+ snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage3DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ActiveTextureARB) {
+ void ** procp = (void **) &disp->ActiveTextureARB;
+ snprintf(symboln, sizeof(symboln), "%sActiveTexture", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ActiveTextureARB) {
+ void ** procp = (void **) &disp->ActiveTextureARB;
+ snprintf(symboln, sizeof(symboln), "%sActiveTextureARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClientActiveTextureARB) {
+ void ** procp = (void **) &disp->ClientActiveTextureARB;
+ snprintf(symboln, sizeof(symboln), "%sClientActiveTexture", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClientActiveTextureARB) {
+ void ** procp = (void **) &disp->ClientActiveTextureARB;
+ snprintf(symboln, sizeof(symboln), "%sClientActiveTextureARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1dARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1dARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1dARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1dARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1dvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1dvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1dvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1dvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1fARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1fARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1fARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1fARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1fvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1fvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1fvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1fvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1iARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1iARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1iARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1iARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1iARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1ivARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1ivARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1ivARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1ivARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1sARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1sARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1sARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1sARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1sARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1svARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1svARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord1svARB) {
+ void ** procp = (void **) &disp->MultiTexCoord1svARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1svARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2dARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2dARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2dARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2dARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2dvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2dvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2dvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2dvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2fARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2fARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2fARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2fARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2fvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2fvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2fvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2fvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2iARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2iARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2iARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2iARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2iARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2ivARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2ivARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2ivARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2ivARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2sARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2sARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2sARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2sARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2sARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2svARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2svARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord2svARB) {
+ void ** procp = (void **) &disp->MultiTexCoord2svARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2svARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3dARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3dARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3dARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3dARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3dvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3dvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3dvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3dvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3fARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3fARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3fARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3fARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3fvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3fvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3fvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3fvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3iARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3iARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3iARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3iARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3iARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3ivARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3ivARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3ivARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3ivARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3sARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3sARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3sARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3sARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3sARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3svARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3svARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord3svARB) {
+ void ** procp = (void **) &disp->MultiTexCoord3svARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3svARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4dARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4dARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4dARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4dARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4dvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4dvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4dvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4dvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4fARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4fARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4fARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4fARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4fvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4fvARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4iARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4iARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4iARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4iARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4iARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4ivARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4ivARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4ivARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4ivARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4sARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4sARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4sARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4sARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4sARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4svARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4svARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoord4svARB) {
+ void ** procp = (void **) &disp->MultiTexCoord4svARB;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4svARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->AttachShader) {
+ void ** procp = (void **) &disp->AttachShader;
+ snprintf(symboln, sizeof(symboln), "%sAttachShader", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CreateProgram) {
+ void ** procp = (void **) &disp->CreateProgram;
+ snprintf(symboln, sizeof(symboln), "%sCreateProgram", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CreateShader) {
+ void ** procp = (void **) &disp->CreateShader;
+ snprintf(symboln, sizeof(symboln), "%sCreateShader", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteProgram) {
+ void ** procp = (void **) &disp->DeleteProgram;
+ snprintf(symboln, sizeof(symboln), "%sDeleteProgram", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteShader) {
+ void ** procp = (void **) &disp->DeleteShader;
+ snprintf(symboln, sizeof(symboln), "%sDeleteShader", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DetachShader) {
+ void ** procp = (void **) &disp->DetachShader;
+ snprintf(symboln, sizeof(symboln), "%sDetachShader", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetAttachedShaders) {
+ void ** procp = (void **) &disp->GetAttachedShaders;
+ snprintf(symboln, sizeof(symboln), "%sGetAttachedShaders", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramInfoLog) {
+ void ** procp = (void **) &disp->GetProgramInfoLog;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramInfoLog", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramiv) {
+ void ** procp = (void **) &disp->GetProgramiv;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetShaderInfoLog) {
+ void ** procp = (void **) &disp->GetShaderInfoLog;
+ snprintf(symboln, sizeof(symboln), "%sGetShaderInfoLog", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetShaderiv) {
+ void ** procp = (void **) &disp->GetShaderiv;
+ snprintf(symboln, sizeof(symboln), "%sGetShaderiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsProgram) {
+ void ** procp = (void **) &disp->IsProgram;
+ snprintf(symboln, sizeof(symboln), "%sIsProgram", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsShader) {
+ void ** procp = (void **) &disp->IsShader;
+ snprintf(symboln, sizeof(symboln), "%sIsShader", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->StencilFuncSeparate) {
+ void ** procp = (void **) &disp->StencilFuncSeparate;
+ snprintf(symboln, sizeof(symboln), "%sStencilFuncSeparate", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->StencilMaskSeparate) {
+ void ** procp = (void **) &disp->StencilMaskSeparate;
+ snprintf(symboln, sizeof(symboln), "%sStencilMaskSeparate", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->StencilOpSeparate) {
+ void ** procp = (void **) &disp->StencilOpSeparate;
+ snprintf(symboln, sizeof(symboln), "%sStencilOpSeparate", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->StencilOpSeparate) {
+ void ** procp = (void **) &disp->StencilOpSeparate;
+ snprintf(symboln, sizeof(symboln), "%sStencilOpSeparateATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix2x3fv) {
+ void ** procp = (void **) &disp->UniformMatrix2x3fv;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix2x3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix2x4fv) {
+ void ** procp = (void **) &disp->UniformMatrix2x4fv;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix2x4fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix3x2fv) {
+ void ** procp = (void **) &disp->UniformMatrix3x2fv;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix3x2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix3x4fv) {
+ void ** procp = (void **) &disp->UniformMatrix3x4fv;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix3x4fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix4x2fv) {
+ void ** procp = (void **) &disp->UniformMatrix4x2fv;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix4x2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix4x3fv) {
+ void ** procp = (void **) &disp->UniformMatrix4x3fv;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix4x3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClampColor) {
+ void ** procp = (void **) &disp->ClampColor;
+ snprintf(symboln, sizeof(symboln), "%sClampColor", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearBufferfi) {
+ void ** procp = (void **) &disp->ClearBufferfi;
+ snprintf(symboln, sizeof(symboln), "%sClearBufferfi", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearBufferfv) {
+ void ** procp = (void **) &disp->ClearBufferfv;
+ snprintf(symboln, sizeof(symboln), "%sClearBufferfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearBufferiv) {
+ void ** procp = (void **) &disp->ClearBufferiv;
+ snprintf(symboln, sizeof(symboln), "%sClearBufferiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearBufferuiv) {
+ void ** procp = (void **) &disp->ClearBufferuiv;
+ snprintf(symboln, sizeof(symboln), "%sClearBufferuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetStringi) {
+ void ** procp = (void **) &disp->GetStringi;
+ snprintf(symboln, sizeof(symboln), "%sGetStringi", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexBuffer) {
+ void ** procp = (void **) &disp->TexBuffer;
+ snprintf(symboln, sizeof(symboln), "%sTexBuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTexture) {
+ void ** procp = (void **) &disp->FramebufferTexture;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTexture", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetBufferParameteri64v) {
+ void ** procp = (void **) &disp->GetBufferParameteri64v;
+ snprintf(symboln, sizeof(symboln), "%sGetBufferParameteri64v", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetInteger64i_v) {
+ void ** procp = (void **) &disp->GetInteger64i_v;
+ snprintf(symboln, sizeof(symboln), "%sGetInteger64i_v", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribDivisor) {
+ void ** procp = (void **) &disp->VertexAttribDivisor;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribDivisor", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LoadTransposeMatrixdARB) {
+ void ** procp = (void **) &disp->LoadTransposeMatrixdARB;
+ snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixd", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LoadTransposeMatrixdARB) {
+ void ** procp = (void **) &disp->LoadTransposeMatrixdARB;
+ snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixdARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LoadTransposeMatrixfARB) {
+ void ** procp = (void **) &disp->LoadTransposeMatrixfARB;
+ snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LoadTransposeMatrixfARB) {
+ void ** procp = (void **) &disp->LoadTransposeMatrixfARB;
+ snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixfARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultTransposeMatrixdARB) {
+ void ** procp = (void **) &disp->MultTransposeMatrixdARB;
+ snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixd", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultTransposeMatrixdARB) {
+ void ** procp = (void **) &disp->MultTransposeMatrixdARB;
+ snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixdARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultTransposeMatrixfARB) {
+ void ** procp = (void **) &disp->MultTransposeMatrixfARB;
+ snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultTransposeMatrixfARB) {
+ void ** procp = (void **) &disp->MultTransposeMatrixfARB;
+ snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixfARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SampleCoverageARB) {
+ void ** procp = (void **) &disp->SampleCoverageARB;
+ snprintf(symboln, sizeof(symboln), "%sSampleCoverage", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SampleCoverageARB) {
+ void ** procp = (void **) &disp->SampleCoverageARB;
+ snprintf(symboln, sizeof(symboln), "%sSampleCoverageARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexImage1DARB) {
+ void ** procp = (void **) &disp->CompressedTexImage1DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexImage1D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexImage1DARB) {
+ void ** procp = (void **) &disp->CompressedTexImage1DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexImage1DARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexImage2DARB) {
+ void ** procp = (void **) &disp->CompressedTexImage2DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexImage2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexImage2DARB) {
+ void ** procp = (void **) &disp->CompressedTexImage2DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexImage2DARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexImage3DARB) {
+ void ** procp = (void **) &disp->CompressedTexImage3DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexImage3D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexImage3DARB) {
+ void ** procp = (void **) &disp->CompressedTexImage3DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexImage3DARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexSubImage1DARB) {
+ void ** procp = (void **) &disp->CompressedTexSubImage1DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage1D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexSubImage1DARB) {
+ void ** procp = (void **) &disp->CompressedTexSubImage1DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage1DARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexSubImage2DARB) {
+ void ** procp = (void **) &disp->CompressedTexSubImage2DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexSubImage2DARB) {
+ void ** procp = (void **) &disp->CompressedTexSubImage2DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage2DARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexSubImage3DARB) {
+ void ** procp = (void **) &disp->CompressedTexSubImage3DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage3D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompressedTexSubImage3DARB) {
+ void ** procp = (void **) &disp->CompressedTexSubImage3DARB;
+ snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage3DARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetCompressedTexImageARB) {
+ void ** procp = (void **) &disp->GetCompressedTexImageARB;
+ snprintf(symboln, sizeof(symboln), "%sGetCompressedTexImage", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetCompressedTexImageARB) {
+ void ** procp = (void **) &disp->GetCompressedTexImageARB;
+ snprintf(symboln, sizeof(symboln), "%sGetCompressedTexImageARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DisableVertexAttribArrayARB) {
+ void ** procp = (void **) &disp->DisableVertexAttribArrayARB;
+ snprintf(symboln, sizeof(symboln), "%sDisableVertexAttribArray", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DisableVertexAttribArrayARB) {
+ void ** procp = (void **) &disp->DisableVertexAttribArrayARB;
+ snprintf(symboln, sizeof(symboln), "%sDisableVertexAttribArrayARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EnableVertexAttribArrayARB) {
+ void ** procp = (void **) &disp->EnableVertexAttribArrayARB;
+ snprintf(symboln, sizeof(symboln), "%sEnableVertexAttribArray", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EnableVertexAttribArrayARB) {
+ void ** procp = (void **) &disp->EnableVertexAttribArrayARB;
+ snprintf(symboln, sizeof(symboln), "%sEnableVertexAttribArrayARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramEnvParameterdvARB) {
+ void ** procp = (void **) &disp->GetProgramEnvParameterdvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramEnvParameterdvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramEnvParameterfvARB) {
+ void ** procp = (void **) &disp->GetProgramEnvParameterfvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramEnvParameterfvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramLocalParameterdvARB) {
+ void ** procp = (void **) &disp->GetProgramLocalParameterdvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramLocalParameterdvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramLocalParameterfvARB) {
+ void ** procp = (void **) &disp->GetProgramLocalParameterfvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramLocalParameterfvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramStringARB) {
+ void ** procp = (void **) &disp->GetProgramStringARB;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramStringARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramivARB) {
+ void ** procp = (void **) &disp->GetProgramivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribdvARB) {
+ void ** procp = (void **) &disp->GetVertexAttribdvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribdv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribdvARB) {
+ void ** procp = (void **) &disp->GetVertexAttribdvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribdvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribfvARB) {
+ void ** procp = (void **) &disp->GetVertexAttribfvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribfvARB) {
+ void ** procp = (void **) &disp->GetVertexAttribfvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribfvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribivARB) {
+ void ** procp = (void **) &disp->GetVertexAttribivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribivARB) {
+ void ** procp = (void **) &disp->GetVertexAttribivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramEnvParameter4dARB) {
+ void ** procp = (void **) &disp->ProgramEnvParameter4dARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramEnvParameter4dARB) {
+ void ** procp = (void **) &disp->ProgramEnvParameter4dARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramParameter4dNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramEnvParameter4dvARB) {
+ void ** procp = (void **) &disp->ProgramEnvParameter4dvARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramEnvParameter4dvARB) {
+ void ** procp = (void **) &disp->ProgramEnvParameter4dvARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramParameter4dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramEnvParameter4fARB) {
+ void ** procp = (void **) &disp->ProgramEnvParameter4fARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramEnvParameter4fARB) {
+ void ** procp = (void **) &disp->ProgramEnvParameter4fARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramParameter4fNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramEnvParameter4fvARB) {
+ void ** procp = (void **) &disp->ProgramEnvParameter4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramEnvParameter4fvARB) {
+ void ** procp = (void **) &disp->ProgramEnvParameter4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramParameter4fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramLocalParameter4dARB) {
+ void ** procp = (void **) &disp->ProgramLocalParameter4dARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramLocalParameter4dvARB) {
+ void ** procp = (void **) &disp->ProgramLocalParameter4dvARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramLocalParameter4fARB) {
+ void ** procp = (void **) &disp->ProgramLocalParameter4fARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramLocalParameter4fvARB) {
+ void ** procp = (void **) &disp->ProgramLocalParameter4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramStringARB) {
+ void ** procp = (void **) &disp->ProgramStringARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramStringARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1dARB) {
+ void ** procp = (void **) &disp->VertexAttrib1dARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1dARB) {
+ void ** procp = (void **) &disp->VertexAttrib1dARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1dvARB) {
+ void ** procp = (void **) &disp->VertexAttrib1dvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1dvARB) {
+ void ** procp = (void **) &disp->VertexAttrib1dvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1fARB) {
+ void ** procp = (void **) &disp->VertexAttrib1fARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1fARB) {
+ void ** procp = (void **) &disp->VertexAttrib1fARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1fvARB) {
+ void ** procp = (void **) &disp->VertexAttrib1fvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1fvARB) {
+ void ** procp = (void **) &disp->VertexAttrib1fvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1sARB) {
+ void ** procp = (void **) &disp->VertexAttrib1sARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1sARB) {
+ void ** procp = (void **) &disp->VertexAttrib1sARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1sARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1svARB) {
+ void ** procp = (void **) &disp->VertexAttrib1svARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1svARB) {
+ void ** procp = (void **) &disp->VertexAttrib1svARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1svARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2dARB) {
+ void ** procp = (void **) &disp->VertexAttrib2dARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2dARB) {
+ void ** procp = (void **) &disp->VertexAttrib2dARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2dvARB) {
+ void ** procp = (void **) &disp->VertexAttrib2dvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2dvARB) {
+ void ** procp = (void **) &disp->VertexAttrib2dvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2fARB) {
+ void ** procp = (void **) &disp->VertexAttrib2fARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2fARB) {
+ void ** procp = (void **) &disp->VertexAttrib2fARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2fvARB) {
+ void ** procp = (void **) &disp->VertexAttrib2fvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2fvARB) {
+ void ** procp = (void **) &disp->VertexAttrib2fvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2sARB) {
+ void ** procp = (void **) &disp->VertexAttrib2sARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2sARB) {
+ void ** procp = (void **) &disp->VertexAttrib2sARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2sARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2svARB) {
+ void ** procp = (void **) &disp->VertexAttrib2svARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2svARB) {
+ void ** procp = (void **) &disp->VertexAttrib2svARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2svARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3dARB) {
+ void ** procp = (void **) &disp->VertexAttrib3dARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3dARB) {
+ void ** procp = (void **) &disp->VertexAttrib3dARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3dvARB) {
+ void ** procp = (void **) &disp->VertexAttrib3dvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3dvARB) {
+ void ** procp = (void **) &disp->VertexAttrib3dvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3fARB) {
+ void ** procp = (void **) &disp->VertexAttrib3fARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3fARB) {
+ void ** procp = (void **) &disp->VertexAttrib3fARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3fvARB) {
+ void ** procp = (void **) &disp->VertexAttrib3fvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3fvARB) {
+ void ** procp = (void **) &disp->VertexAttrib3fvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3sARB) {
+ void ** procp = (void **) &disp->VertexAttrib3sARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3sARB) {
+ void ** procp = (void **) &disp->VertexAttrib3sARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3sARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3svARB) {
+ void ** procp = (void **) &disp->VertexAttrib3svARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3svARB) {
+ void ** procp = (void **) &disp->VertexAttrib3svARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3svARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NbvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NbvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nbv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NbvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NbvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NbvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NivARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NivARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Niv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NivARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NivARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NsvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NsvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nsv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NsvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NsvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NsvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NubARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NubARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nub", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NubARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NubARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NubARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NubvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NubvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nubv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NubvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NubvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NubvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NuivARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NuivARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NuivARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NuivARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NuivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NusvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NusvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nusv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4NusvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4NusvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NusvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4bvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4bvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4bv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4bvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4bvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4bvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4dARB) {
+ void ** procp = (void **) &disp->VertexAttrib4dARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4dARB) {
+ void ** procp = (void **) &disp->VertexAttrib4dARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4dvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4dvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4dvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4dvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4fARB) {
+ void ** procp = (void **) &disp->VertexAttrib4fARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4fARB) {
+ void ** procp = (void **) &disp->VertexAttrib4fARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4fvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4fvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4ivARB) {
+ void ** procp = (void **) &disp->VertexAttrib4ivARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4ivARB) {
+ void ** procp = (void **) &disp->VertexAttrib4ivARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4sARB) {
+ void ** procp = (void **) &disp->VertexAttrib4sARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4sARB) {
+ void ** procp = (void **) &disp->VertexAttrib4sARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4sARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4svARB) {
+ void ** procp = (void **) &disp->VertexAttrib4svARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4svARB) {
+ void ** procp = (void **) &disp->VertexAttrib4svARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4svARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4ubvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4ubvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4ubvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4ubvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4uivARB) {
+ void ** procp = (void **) &disp->VertexAttrib4uivARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4uivARB) {
+ void ** procp = (void **) &disp->VertexAttrib4uivARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4uivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4usvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4usvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4usv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4usvARB) {
+ void ** procp = (void **) &disp->VertexAttrib4usvARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4usvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribPointerARB) {
+ void ** procp = (void **) &disp->VertexAttribPointerARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribPointer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribPointerARB) {
+ void ** procp = (void **) &disp->VertexAttribPointerARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribPointerARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindBufferARB) {
+ void ** procp = (void **) &disp->BindBufferARB;
+ snprintf(symboln, sizeof(symboln), "%sBindBuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindBufferARB) {
+ void ** procp = (void **) &disp->BindBufferARB;
+ snprintf(symboln, sizeof(symboln), "%sBindBufferARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BufferDataARB) {
+ void ** procp = (void **) &disp->BufferDataARB;
+ snprintf(symboln, sizeof(symboln), "%sBufferData", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BufferDataARB) {
+ void ** procp = (void **) &disp->BufferDataARB;
+ snprintf(symboln, sizeof(symboln), "%sBufferDataARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BufferSubDataARB) {
+ void ** procp = (void **) &disp->BufferSubDataARB;
+ snprintf(symboln, sizeof(symboln), "%sBufferSubData", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BufferSubDataARB) {
+ void ** procp = (void **) &disp->BufferSubDataARB;
+ snprintf(symboln, sizeof(symboln), "%sBufferSubDataARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteBuffersARB) {
+ void ** procp = (void **) &disp->DeleteBuffersARB;
+ snprintf(symboln, sizeof(symboln), "%sDeleteBuffers", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteBuffersARB) {
+ void ** procp = (void **) &disp->DeleteBuffersARB;
+ snprintf(symboln, sizeof(symboln), "%sDeleteBuffersARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenBuffersARB) {
+ void ** procp = (void **) &disp->GenBuffersARB;
+ snprintf(symboln, sizeof(symboln), "%sGenBuffers", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenBuffersARB) {
+ void ** procp = (void **) &disp->GenBuffersARB;
+ snprintf(symboln, sizeof(symboln), "%sGenBuffersARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetBufferParameterivARB) {
+ void ** procp = (void **) &disp->GetBufferParameterivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetBufferParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetBufferParameterivARB) {
+ void ** procp = (void **) &disp->GetBufferParameterivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetBufferParameterivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetBufferPointervARB) {
+ void ** procp = (void **) &disp->GetBufferPointervARB;
+ snprintf(symboln, sizeof(symboln), "%sGetBufferPointerv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetBufferPointervARB) {
+ void ** procp = (void **) &disp->GetBufferPointervARB;
+ snprintf(symboln, sizeof(symboln), "%sGetBufferPointervARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetBufferSubDataARB) {
+ void ** procp = (void **) &disp->GetBufferSubDataARB;
+ snprintf(symboln, sizeof(symboln), "%sGetBufferSubData", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetBufferSubDataARB) {
+ void ** procp = (void **) &disp->GetBufferSubDataARB;
+ snprintf(symboln, sizeof(symboln), "%sGetBufferSubDataARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsBufferARB) {
+ void ** procp = (void **) &disp->IsBufferARB;
+ snprintf(symboln, sizeof(symboln), "%sIsBuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsBufferARB) {
+ void ** procp = (void **) &disp->IsBufferARB;
+ snprintf(symboln, sizeof(symboln), "%sIsBufferARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MapBufferARB) {
+ void ** procp = (void **) &disp->MapBufferARB;
+ snprintf(symboln, sizeof(symboln), "%sMapBuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MapBufferARB) {
+ void ** procp = (void **) &disp->MapBufferARB;
+ snprintf(symboln, sizeof(symboln), "%sMapBufferARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UnmapBufferARB) {
+ void ** procp = (void **) &disp->UnmapBufferARB;
+ snprintf(symboln, sizeof(symboln), "%sUnmapBuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UnmapBufferARB) {
+ void ** procp = (void **) &disp->UnmapBufferARB;
+ snprintf(symboln, sizeof(symboln), "%sUnmapBufferARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BeginQueryARB) {
+ void ** procp = (void **) &disp->BeginQueryARB;
+ snprintf(symboln, sizeof(symboln), "%sBeginQuery", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BeginQueryARB) {
+ void ** procp = (void **) &disp->BeginQueryARB;
+ snprintf(symboln, sizeof(symboln), "%sBeginQueryARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteQueriesARB) {
+ void ** procp = (void **) &disp->DeleteQueriesARB;
+ snprintf(symboln, sizeof(symboln), "%sDeleteQueries", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteQueriesARB) {
+ void ** procp = (void **) &disp->DeleteQueriesARB;
+ snprintf(symboln, sizeof(symboln), "%sDeleteQueriesARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EndQueryARB) {
+ void ** procp = (void **) &disp->EndQueryARB;
+ snprintf(symboln, sizeof(symboln), "%sEndQuery", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EndQueryARB) {
+ void ** procp = (void **) &disp->EndQueryARB;
+ snprintf(symboln, sizeof(symboln), "%sEndQueryARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenQueriesARB) {
+ void ** procp = (void **) &disp->GenQueriesARB;
+ snprintf(symboln, sizeof(symboln), "%sGenQueries", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenQueriesARB) {
+ void ** procp = (void **) &disp->GenQueriesARB;
+ snprintf(symboln, sizeof(symboln), "%sGenQueriesARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetQueryObjectivARB) {
+ void ** procp = (void **) &disp->GetQueryObjectivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetQueryObjectiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetQueryObjectivARB) {
+ void ** procp = (void **) &disp->GetQueryObjectivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetQueryObjectivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetQueryObjectuivARB) {
+ void ** procp = (void **) &disp->GetQueryObjectuivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetQueryObjectuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetQueryObjectuivARB) {
+ void ** procp = (void **) &disp->GetQueryObjectuivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetQueryObjectuivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetQueryivARB) {
+ void ** procp = (void **) &disp->GetQueryivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetQueryiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetQueryivARB) {
+ void ** procp = (void **) &disp->GetQueryivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetQueryivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsQueryARB) {
+ void ** procp = (void **) &disp->IsQueryARB;
+ snprintf(symboln, sizeof(symboln), "%sIsQuery", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsQueryARB) {
+ void ** procp = (void **) &disp->IsQueryARB;
+ snprintf(symboln, sizeof(symboln), "%sIsQueryARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->AttachObjectARB) {
+ void ** procp = (void **) &disp->AttachObjectARB;
+ snprintf(symboln, sizeof(symboln), "%sAttachObjectARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompileShaderARB) {
+ void ** procp = (void **) &disp->CompileShaderARB;
+ snprintf(symboln, sizeof(symboln), "%sCompileShader", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CompileShaderARB) {
+ void ** procp = (void **) &disp->CompileShaderARB;
+ snprintf(symboln, sizeof(symboln), "%sCompileShaderARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CreateProgramObjectARB) {
+ void ** procp = (void **) &disp->CreateProgramObjectARB;
+ snprintf(symboln, sizeof(symboln), "%sCreateProgramObjectARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CreateShaderObjectARB) {
+ void ** procp = (void **) &disp->CreateShaderObjectARB;
+ snprintf(symboln, sizeof(symboln), "%sCreateShaderObjectARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteObjectARB) {
+ void ** procp = (void **) &disp->DeleteObjectARB;
+ snprintf(symboln, sizeof(symboln), "%sDeleteObjectARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DetachObjectARB) {
+ void ** procp = (void **) &disp->DetachObjectARB;
+ snprintf(symboln, sizeof(symboln), "%sDetachObjectARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetActiveUniformARB) {
+ void ** procp = (void **) &disp->GetActiveUniformARB;
+ snprintf(symboln, sizeof(symboln), "%sGetActiveUniform", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetActiveUniformARB) {
+ void ** procp = (void **) &disp->GetActiveUniformARB;
+ snprintf(symboln, sizeof(symboln), "%sGetActiveUniformARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetAttachedObjectsARB) {
+ void ** procp = (void **) &disp->GetAttachedObjectsARB;
+ snprintf(symboln, sizeof(symboln), "%sGetAttachedObjectsARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetHandleARB) {
+ void ** procp = (void **) &disp->GetHandleARB;
+ snprintf(symboln, sizeof(symboln), "%sGetHandleARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetInfoLogARB) {
+ void ** procp = (void **) &disp->GetInfoLogARB;
+ snprintf(symboln, sizeof(symboln), "%sGetInfoLogARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetObjectParameterfvARB) {
+ void ** procp = (void **) &disp->GetObjectParameterfvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetObjectParameterfvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetObjectParameterivARB) {
+ void ** procp = (void **) &disp->GetObjectParameterivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetObjectParameterivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetShaderSourceARB) {
+ void ** procp = (void **) &disp->GetShaderSourceARB;
+ snprintf(symboln, sizeof(symboln), "%sGetShaderSource", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetShaderSourceARB) {
+ void ** procp = (void **) &disp->GetShaderSourceARB;
+ snprintf(symboln, sizeof(symboln), "%sGetShaderSourceARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetUniformLocationARB) {
+ void ** procp = (void **) &disp->GetUniformLocationARB;
+ snprintf(symboln, sizeof(symboln), "%sGetUniformLocation", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetUniformLocationARB) {
+ void ** procp = (void **) &disp->GetUniformLocationARB;
+ snprintf(symboln, sizeof(symboln), "%sGetUniformLocationARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetUniformfvARB) {
+ void ** procp = (void **) &disp->GetUniformfvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetUniformfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetUniformfvARB) {
+ void ** procp = (void **) &disp->GetUniformfvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetUniformfvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetUniformivARB) {
+ void ** procp = (void **) &disp->GetUniformivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetUniformiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetUniformivARB) {
+ void ** procp = (void **) &disp->GetUniformivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetUniformivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LinkProgramARB) {
+ void ** procp = (void **) &disp->LinkProgramARB;
+ snprintf(symboln, sizeof(symboln), "%sLinkProgram", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LinkProgramARB) {
+ void ** procp = (void **) &disp->LinkProgramARB;
+ snprintf(symboln, sizeof(symboln), "%sLinkProgramARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ShaderSourceARB) {
+ void ** procp = (void **) &disp->ShaderSourceARB;
+ snprintf(symboln, sizeof(symboln), "%sShaderSource", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ShaderSourceARB) {
+ void ** procp = (void **) &disp->ShaderSourceARB;
+ snprintf(symboln, sizeof(symboln), "%sShaderSourceARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1fARB) {
+ void ** procp = (void **) &disp->Uniform1fARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform1f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1fARB) {
+ void ** procp = (void **) &disp->Uniform1fARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform1fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1fvARB) {
+ void ** procp = (void **) &disp->Uniform1fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform1fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1fvARB) {
+ void ** procp = (void **) &disp->Uniform1fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform1fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1iARB) {
+ void ** procp = (void **) &disp->Uniform1iARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform1i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1iARB) {
+ void ** procp = (void **) &disp->Uniform1iARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform1iARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1ivARB) {
+ void ** procp = (void **) &disp->Uniform1ivARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform1iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1ivARB) {
+ void ** procp = (void **) &disp->Uniform1ivARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform1ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2fARB) {
+ void ** procp = (void **) &disp->Uniform2fARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform2f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2fARB) {
+ void ** procp = (void **) &disp->Uniform2fARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform2fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2fvARB) {
+ void ** procp = (void **) &disp->Uniform2fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2fvARB) {
+ void ** procp = (void **) &disp->Uniform2fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform2fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2iARB) {
+ void ** procp = (void **) &disp->Uniform2iARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform2i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2iARB) {
+ void ** procp = (void **) &disp->Uniform2iARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform2iARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2ivARB) {
+ void ** procp = (void **) &disp->Uniform2ivARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform2iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2ivARB) {
+ void ** procp = (void **) &disp->Uniform2ivARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform2ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3fARB) {
+ void ** procp = (void **) &disp->Uniform3fARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform3f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3fARB) {
+ void ** procp = (void **) &disp->Uniform3fARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform3fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3fvARB) {
+ void ** procp = (void **) &disp->Uniform3fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3fvARB) {
+ void ** procp = (void **) &disp->Uniform3fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform3fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3iARB) {
+ void ** procp = (void **) &disp->Uniform3iARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform3i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3iARB) {
+ void ** procp = (void **) &disp->Uniform3iARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform3iARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3ivARB) {
+ void ** procp = (void **) &disp->Uniform3ivARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform3iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3ivARB) {
+ void ** procp = (void **) &disp->Uniform3ivARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform3ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4fARB) {
+ void ** procp = (void **) &disp->Uniform4fARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform4f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4fARB) {
+ void ** procp = (void **) &disp->Uniform4fARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform4fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4fvARB) {
+ void ** procp = (void **) &disp->Uniform4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform4fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4fvARB) {
+ void ** procp = (void **) &disp->Uniform4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform4fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4iARB) {
+ void ** procp = (void **) &disp->Uniform4iARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform4i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4iARB) {
+ void ** procp = (void **) &disp->Uniform4iARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform4iARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4ivARB) {
+ void ** procp = (void **) &disp->Uniform4ivARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform4iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4ivARB) {
+ void ** procp = (void **) &disp->Uniform4ivARB;
+ snprintf(symboln, sizeof(symboln), "%sUniform4ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix2fvARB) {
+ void ** procp = (void **) &disp->UniformMatrix2fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix2fvARB) {
+ void ** procp = (void **) &disp->UniformMatrix2fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix2fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix3fvARB) {
+ void ** procp = (void **) &disp->UniformMatrix3fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix3fvARB) {
+ void ** procp = (void **) &disp->UniformMatrix3fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix3fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix4fvARB) {
+ void ** procp = (void **) &disp->UniformMatrix4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix4fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UniformMatrix4fvARB) {
+ void ** procp = (void **) &disp->UniformMatrix4fvARB;
+ snprintf(symboln, sizeof(symboln), "%sUniformMatrix4fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UseProgramObjectARB) {
+ void ** procp = (void **) &disp->UseProgramObjectARB;
+ snprintf(symboln, sizeof(symboln), "%sUseProgram", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UseProgramObjectARB) {
+ void ** procp = (void **) &disp->UseProgramObjectARB;
+ snprintf(symboln, sizeof(symboln), "%sUseProgramObjectARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ValidateProgramARB) {
+ void ** procp = (void **) &disp->ValidateProgramARB;
+ snprintf(symboln, sizeof(symboln), "%sValidateProgram", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ValidateProgramARB) {
+ void ** procp = (void **) &disp->ValidateProgramARB;
+ snprintf(symboln, sizeof(symboln), "%sValidateProgramARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindAttribLocationARB) {
+ void ** procp = (void **) &disp->BindAttribLocationARB;
+ snprintf(symboln, sizeof(symboln), "%sBindAttribLocation", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindAttribLocationARB) {
+ void ** procp = (void **) &disp->BindAttribLocationARB;
+ snprintf(symboln, sizeof(symboln), "%sBindAttribLocationARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetActiveAttribARB) {
+ void ** procp = (void **) &disp->GetActiveAttribARB;
+ snprintf(symboln, sizeof(symboln), "%sGetActiveAttrib", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetActiveAttribARB) {
+ void ** procp = (void **) &disp->GetActiveAttribARB;
+ snprintf(symboln, sizeof(symboln), "%sGetActiveAttribARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetAttribLocationARB) {
+ void ** procp = (void **) &disp->GetAttribLocationARB;
+ snprintf(symboln, sizeof(symboln), "%sGetAttribLocation", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetAttribLocationARB) {
+ void ** procp = (void **) &disp->GetAttribLocationARB;
+ snprintf(symboln, sizeof(symboln), "%sGetAttribLocationARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawBuffersARB) {
+ void ** procp = (void **) &disp->DrawBuffersARB;
+ snprintf(symboln, sizeof(symboln), "%sDrawBuffers", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawBuffersARB) {
+ void ** procp = (void **) &disp->DrawBuffersARB;
+ snprintf(symboln, sizeof(symboln), "%sDrawBuffersARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawBuffersARB) {
+ void ** procp = (void **) &disp->DrawBuffersARB;
+ snprintf(symboln, sizeof(symboln), "%sDrawBuffersATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawBuffersARB) {
+ void ** procp = (void **) &disp->DrawBuffersARB;
+ snprintf(symboln, sizeof(symboln), "%sDrawBuffersNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClampColorARB) {
+ void ** procp = (void **) &disp->ClampColorARB;
+ snprintf(symboln, sizeof(symboln), "%sClampColorARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawArraysInstancedARB) {
+ void ** procp = (void **) &disp->DrawArraysInstancedARB;
+ snprintf(symboln, sizeof(symboln), "%sDrawArraysInstancedARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawArraysInstancedARB) {
+ void ** procp = (void **) &disp->DrawArraysInstancedARB;
+ snprintf(symboln, sizeof(symboln), "%sDrawArraysInstancedEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawArraysInstancedARB) {
+ void ** procp = (void **) &disp->DrawArraysInstancedARB;
+ snprintf(symboln, sizeof(symboln), "%sDrawArraysInstanced", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawElementsInstancedARB) {
+ void ** procp = (void **) &disp->DrawElementsInstancedARB;
+ snprintf(symboln, sizeof(symboln), "%sDrawElementsInstancedARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawElementsInstancedARB) {
+ void ** procp = (void **) &disp->DrawElementsInstancedARB;
+ snprintf(symboln, sizeof(symboln), "%sDrawElementsInstancedEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawElementsInstancedARB) {
+ void ** procp = (void **) &disp->DrawElementsInstancedARB;
+ snprintf(symboln, sizeof(symboln), "%sDrawElementsInstanced", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RenderbufferStorageMultisample) {
+ void ** procp = (void **) &disp->RenderbufferStorageMultisample;
+ snprintf(symboln, sizeof(symboln), "%sRenderbufferStorageMultisample", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RenderbufferStorageMultisample) {
+ void ** procp = (void **) &disp->RenderbufferStorageMultisample;
+ snprintf(symboln, sizeof(symboln), "%sRenderbufferStorageMultisampleEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTextureARB) {
+ void ** procp = (void **) &disp->FramebufferTextureARB;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTextureARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTextureFaceARB) {
+ void ** procp = (void **) &disp->FramebufferTextureFaceARB;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTextureFaceARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramParameteriARB) {
+ void ** procp = (void **) &disp->ProgramParameteriARB;
+ snprintf(symboln, sizeof(symboln), "%sProgramParameteriARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribDivisorARB) {
+ void ** procp = (void **) &disp->VertexAttribDivisorARB;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribDivisorARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FlushMappedBufferRange) {
+ void ** procp = (void **) &disp->FlushMappedBufferRange;
+ snprintf(symboln, sizeof(symboln), "%sFlushMappedBufferRange", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MapBufferRange) {
+ void ** procp = (void **) &disp->MapBufferRange;
+ snprintf(symboln, sizeof(symboln), "%sMapBufferRange", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexBufferARB) {
+ void ** procp = (void **) &disp->TexBufferARB;
+ snprintf(symboln, sizeof(symboln), "%sTexBufferARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindVertexArray) {
+ void ** procp = (void **) &disp->BindVertexArray;
+ snprintf(symboln, sizeof(symboln), "%sBindVertexArray", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenVertexArrays) {
+ void ** procp = (void **) &disp->GenVertexArrays;
+ snprintf(symboln, sizeof(symboln), "%sGenVertexArrays", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CopyBufferSubData) {
+ void ** procp = (void **) &disp->CopyBufferSubData;
+ snprintf(symboln, sizeof(symboln), "%sCopyBufferSubData", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClientWaitSync) {
+ void ** procp = (void **) &disp->ClientWaitSync;
+ snprintf(symboln, sizeof(symboln), "%sClientWaitSync", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteSync) {
+ void ** procp = (void **) &disp->DeleteSync;
+ snprintf(symboln, sizeof(symboln), "%sDeleteSync", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FenceSync) {
+ void ** procp = (void **) &disp->FenceSync;
+ snprintf(symboln, sizeof(symboln), "%sFenceSync", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetInteger64v) {
+ void ** procp = (void **) &disp->GetInteger64v;
+ snprintf(symboln, sizeof(symboln), "%sGetInteger64v", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetSynciv) {
+ void ** procp = (void **) &disp->GetSynciv;
+ snprintf(symboln, sizeof(symboln), "%sGetSynciv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsSync) {
+ void ** procp = (void **) &disp->IsSync;
+ snprintf(symboln, sizeof(symboln), "%sIsSync", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WaitSync) {
+ void ** procp = (void **) &disp->WaitSync;
+ snprintf(symboln, sizeof(symboln), "%sWaitSync", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawElementsBaseVertex) {
+ void ** procp = (void **) &disp->DrawElementsBaseVertex;
+ snprintf(symboln, sizeof(symboln), "%sDrawElementsBaseVertex", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawElementsInstancedBaseVertex) {
+ void ** procp = (void **) &disp->DrawElementsInstancedBaseVertex;
+ snprintf(symboln, sizeof(symboln), "%sDrawElementsInstancedBaseVertex", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawRangeElementsBaseVertex) {
+ void ** procp = (void **) &disp->DrawRangeElementsBaseVertex;
+ snprintf(symboln, sizeof(symboln), "%sDrawRangeElementsBaseVertex", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiDrawElementsBaseVertex) {
+ void ** procp = (void **) &disp->MultiDrawElementsBaseVertex;
+ snprintf(symboln, sizeof(symboln), "%sMultiDrawElementsBaseVertex", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendEquationSeparateiARB) {
+ void ** procp = (void **) &disp->BlendEquationSeparateiARB;
+ snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateiARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendEquationSeparateiARB) {
+ void ** procp = (void **) &disp->BlendEquationSeparateiARB;
+ snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateIndexedAMD", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendEquationiARB) {
+ void ** procp = (void **) &disp->BlendEquationiARB;
+ snprintf(symboln, sizeof(symboln), "%sBlendEquationiARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendEquationiARB) {
+ void ** procp = (void **) &disp->BlendEquationiARB;
+ snprintf(symboln, sizeof(symboln), "%sBlendEquationIndexedAMD", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendFuncSeparateiARB) {
+ void ** procp = (void **) &disp->BlendFuncSeparateiARB;
+ snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateiARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendFuncSeparateiARB) {
+ void ** procp = (void **) &disp->BlendFuncSeparateiARB;
+ snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateIndexedAMD", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendFunciARB) {
+ void ** procp = (void **) &disp->BlendFunciARB;
+ snprintf(symboln, sizeof(symboln), "%sBlendFunciARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendFunciARB) {
+ void ** procp = (void **) &disp->BlendFunciARB;
+ snprintf(symboln, sizeof(symboln), "%sBlendFuncIndexedAMD", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindSampler) {
+ void ** procp = (void **) &disp->BindSampler;
+ snprintf(symboln, sizeof(symboln), "%sBindSampler", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteSamplers) {
+ void ** procp = (void **) &disp->DeleteSamplers;
+ snprintf(symboln, sizeof(symboln), "%sDeleteSamplers", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenSamplers) {
+ void ** procp = (void **) &disp->GenSamplers;
+ snprintf(symboln, sizeof(symboln), "%sGenSamplers", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetSamplerParameterIiv) {
+ void ** procp = (void **) &disp->GetSamplerParameterIiv;
+ snprintf(symboln, sizeof(symboln), "%sGetSamplerParameterIiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetSamplerParameterIuiv) {
+ void ** procp = (void **) &disp->GetSamplerParameterIuiv;
+ snprintf(symboln, sizeof(symboln), "%sGetSamplerParameterIuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetSamplerParameterfv) {
+ void ** procp = (void **) &disp->GetSamplerParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sGetSamplerParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetSamplerParameteriv) {
+ void ** procp = (void **) &disp->GetSamplerParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sGetSamplerParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsSampler) {
+ void ** procp = (void **) &disp->IsSampler;
+ snprintf(symboln, sizeof(symboln), "%sIsSampler", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SamplerParameterIiv) {
+ void ** procp = (void **) &disp->SamplerParameterIiv;
+ snprintf(symboln, sizeof(symboln), "%sSamplerParameterIiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SamplerParameterIuiv) {
+ void ** procp = (void **) &disp->SamplerParameterIuiv;
+ snprintf(symboln, sizeof(symboln), "%sSamplerParameterIuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SamplerParameterf) {
+ void ** procp = (void **) &disp->SamplerParameterf;
+ snprintf(symboln, sizeof(symboln), "%sSamplerParameterf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SamplerParameterfv) {
+ void ** procp = (void **) &disp->SamplerParameterfv;
+ snprintf(symboln, sizeof(symboln), "%sSamplerParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SamplerParameteri) {
+ void ** procp = (void **) &disp->SamplerParameteri;
+ snprintf(symboln, sizeof(symboln), "%sSamplerParameteri", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SamplerParameteriv) {
+ void ** procp = (void **) &disp->SamplerParameteriv;
+ snprintf(symboln, sizeof(symboln), "%sSamplerParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorP3ui) {
+ void ** procp = (void **) &disp->ColorP3ui;
+ snprintf(symboln, sizeof(symboln), "%sColorP3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorP3uiv) {
+ void ** procp = (void **) &disp->ColorP3uiv;
+ snprintf(symboln, sizeof(symboln), "%sColorP3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorP4ui) {
+ void ** procp = (void **) &disp->ColorP4ui;
+ snprintf(symboln, sizeof(symboln), "%sColorP4ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorP4uiv) {
+ void ** procp = (void **) &disp->ColorP4uiv;
+ snprintf(symboln, sizeof(symboln), "%sColorP4uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoordP1ui) {
+ void ** procp = (void **) &disp->MultiTexCoordP1ui;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP1ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoordP1uiv) {
+ void ** procp = (void **) &disp->MultiTexCoordP1uiv;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP1uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoordP2ui) {
+ void ** procp = (void **) &disp->MultiTexCoordP2ui;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP2ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoordP2uiv) {
+ void ** procp = (void **) &disp->MultiTexCoordP2uiv;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP2uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoordP3ui) {
+ void ** procp = (void **) &disp->MultiTexCoordP3ui;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoordP3uiv) {
+ void ** procp = (void **) &disp->MultiTexCoordP3uiv;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoordP4ui) {
+ void ** procp = (void **) &disp->MultiTexCoordP4ui;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP4ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiTexCoordP4uiv) {
+ void ** procp = (void **) &disp->MultiTexCoordP4uiv;
+ snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP4uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->NormalP3ui) {
+ void ** procp = (void **) &disp->NormalP3ui;
+ snprintf(symboln, sizeof(symboln), "%sNormalP3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->NormalP3uiv) {
+ void ** procp = (void **) &disp->NormalP3uiv;
+ snprintf(symboln, sizeof(symboln), "%sNormalP3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColorP3ui) {
+ void ** procp = (void **) &disp->SecondaryColorP3ui;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColorP3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColorP3uiv) {
+ void ** procp = (void **) &disp->SecondaryColorP3uiv;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColorP3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoordP1ui) {
+ void ** procp = (void **) &disp->TexCoordP1ui;
+ snprintf(symboln, sizeof(symboln), "%sTexCoordP1ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoordP1uiv) {
+ void ** procp = (void **) &disp->TexCoordP1uiv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoordP1uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoordP2ui) {
+ void ** procp = (void **) &disp->TexCoordP2ui;
+ snprintf(symboln, sizeof(symboln), "%sTexCoordP2ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoordP2uiv) {
+ void ** procp = (void **) &disp->TexCoordP2uiv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoordP2uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoordP3ui) {
+ void ** procp = (void **) &disp->TexCoordP3ui;
+ snprintf(symboln, sizeof(symboln), "%sTexCoordP3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoordP3uiv) {
+ void ** procp = (void **) &disp->TexCoordP3uiv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoordP3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoordP4ui) {
+ void ** procp = (void **) &disp->TexCoordP4ui;
+ snprintf(symboln, sizeof(symboln), "%sTexCoordP4ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoordP4uiv) {
+ void ** procp = (void **) &disp->TexCoordP4uiv;
+ snprintf(symboln, sizeof(symboln), "%sTexCoordP4uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribP1ui) {
+ void ** procp = (void **) &disp->VertexAttribP1ui;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribP1ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribP1uiv) {
+ void ** procp = (void **) &disp->VertexAttribP1uiv;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribP1uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribP2ui) {
+ void ** procp = (void **) &disp->VertexAttribP2ui;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribP2ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribP2uiv) {
+ void ** procp = (void **) &disp->VertexAttribP2uiv;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribP2uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribP3ui) {
+ void ** procp = (void **) &disp->VertexAttribP3ui;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribP3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribP3uiv) {
+ void ** procp = (void **) &disp->VertexAttribP3uiv;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribP3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribP4ui) {
+ void ** procp = (void **) &disp->VertexAttribP4ui;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribP4ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribP4uiv) {
+ void ** procp = (void **) &disp->VertexAttribP4uiv;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribP4uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexP2ui) {
+ void ** procp = (void **) &disp->VertexP2ui;
+ snprintf(symboln, sizeof(symboln), "%sVertexP2ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexP2uiv) {
+ void ** procp = (void **) &disp->VertexP2uiv;
+ snprintf(symboln, sizeof(symboln), "%sVertexP2uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexP3ui) {
+ void ** procp = (void **) &disp->VertexP3ui;
+ snprintf(symboln, sizeof(symboln), "%sVertexP3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexP3uiv) {
+ void ** procp = (void **) &disp->VertexP3uiv;
+ snprintf(symboln, sizeof(symboln), "%sVertexP3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexP4ui) {
+ void ** procp = (void **) &disp->VertexP4ui;
+ snprintf(symboln, sizeof(symboln), "%sVertexP4ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexP4uiv) {
+ void ** procp = (void **) &disp->VertexP4uiv;
+ snprintf(symboln, sizeof(symboln), "%sVertexP4uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindTransformFeedback) {
+ void ** procp = (void **) &disp->BindTransformFeedback;
+ snprintf(symboln, sizeof(symboln), "%sBindTransformFeedback", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteTransformFeedbacks) {
+ void ** procp = (void **) &disp->DeleteTransformFeedbacks;
+ snprintf(symboln, sizeof(symboln), "%sDeleteTransformFeedbacks", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DrawTransformFeedback) {
+ void ** procp = (void **) &disp->DrawTransformFeedback;
+ snprintf(symboln, sizeof(symboln), "%sDrawTransformFeedback", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenTransformFeedbacks) {
+ void ** procp = (void **) &disp->GenTransformFeedbacks;
+ snprintf(symboln, sizeof(symboln), "%sGenTransformFeedbacks", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsTransformFeedback) {
+ void ** procp = (void **) &disp->IsTransformFeedback;
+ snprintf(symboln, sizeof(symboln), "%sIsTransformFeedback", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PauseTransformFeedback) {
+ void ** procp = (void **) &disp->PauseTransformFeedback;
+ snprintf(symboln, sizeof(symboln), "%sPauseTransformFeedback", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ResumeTransformFeedback) {
+ void ** procp = (void **) &disp->ResumeTransformFeedback;
+ snprintf(symboln, sizeof(symboln), "%sResumeTransformFeedback", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearDepthf) {
+ void ** procp = (void **) &disp->ClearDepthf;
+ snprintf(symboln, sizeof(symboln), "%sClearDepthf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DepthRangef) {
+ void ** procp = (void **) &disp->DepthRangef;
+ snprintf(symboln, sizeof(symboln), "%sDepthRangef", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetShaderPrecisionFormat) {
+ void ** procp = (void **) &disp->GetShaderPrecisionFormat;
+ snprintf(symboln, sizeof(symboln), "%sGetShaderPrecisionFormat", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ReleaseShaderCompiler) {
+ void ** procp = (void **) &disp->ReleaseShaderCompiler;
+ snprintf(symboln, sizeof(symboln), "%sReleaseShaderCompiler", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ShaderBinary) {
+ void ** procp = (void **) &disp->ShaderBinary;
+ snprintf(symboln, sizeof(symboln), "%sShaderBinary", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DebugMessageCallbackARB) {
+ void ** procp = (void **) &disp->DebugMessageCallbackARB;
+ snprintf(symboln, sizeof(symboln), "%sDebugMessageCallbackARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DebugMessageControlARB) {
+ void ** procp = (void **) &disp->DebugMessageControlARB;
+ snprintf(symboln, sizeof(symboln), "%sDebugMessageControlARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DebugMessageInsertARB) {
+ void ** procp = (void **) &disp->DebugMessageInsertARB;
+ snprintf(symboln, sizeof(symboln), "%sDebugMessageInsertARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetDebugMessageLogARB) {
+ void ** procp = (void **) &disp->GetDebugMessageLogARB;
+ snprintf(symboln, sizeof(symboln), "%sGetDebugMessageLogARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetGraphicsResetStatusARB) {
+ void ** procp = (void **) &disp->GetGraphicsResetStatusARB;
+ snprintf(symboln, sizeof(symboln), "%sGetGraphicsResetStatusARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnColorTableARB) {
+ void ** procp = (void **) &disp->GetnColorTableARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnColorTableARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnCompressedTexImageARB) {
+ void ** procp = (void **) &disp->GetnCompressedTexImageARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnCompressedTexImageARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnConvolutionFilterARB) {
+ void ** procp = (void **) &disp->GetnConvolutionFilterARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnConvolutionFilterARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnHistogramARB) {
+ void ** procp = (void **) &disp->GetnHistogramARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnHistogramARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnMapdvARB) {
+ void ** procp = (void **) &disp->GetnMapdvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnMapdvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnMapfvARB) {
+ void ** procp = (void **) &disp->GetnMapfvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnMapfvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnMapivARB) {
+ void ** procp = (void **) &disp->GetnMapivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnMapivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnMinmaxARB) {
+ void ** procp = (void **) &disp->GetnMinmaxARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnMinmaxARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnPixelMapfvARB) {
+ void ** procp = (void **) &disp->GetnPixelMapfvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnPixelMapfvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnPixelMapuivARB) {
+ void ** procp = (void **) &disp->GetnPixelMapuivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnPixelMapuivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnPixelMapusvARB) {
+ void ** procp = (void **) &disp->GetnPixelMapusvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnPixelMapusvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnPolygonStippleARB) {
+ void ** procp = (void **) &disp->GetnPolygonStippleARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnPolygonStippleARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnSeparableFilterARB) {
+ void ** procp = (void **) &disp->GetnSeparableFilterARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnSeparableFilterARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnTexImageARB) {
+ void ** procp = (void **) &disp->GetnTexImageARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnTexImageARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnUniformdvARB) {
+ void ** procp = (void **) &disp->GetnUniformdvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnUniformdvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnUniformfvARB) {
+ void ** procp = (void **) &disp->GetnUniformfvARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnUniformfvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnUniformivARB) {
+ void ** procp = (void **) &disp->GetnUniformivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnUniformivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetnUniformuivARB) {
+ void ** procp = (void **) &disp->GetnUniformuivARB;
+ snprintf(symboln, sizeof(symboln), "%sGetnUniformuivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ReadnPixelsARB) {
+ void ** procp = (void **) &disp->ReadnPixelsARB;
+ snprintf(symboln, sizeof(symboln), "%sReadnPixelsARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexStorage1D) {
+ void ** procp = (void **) &disp->TexStorage1D;
+ snprintf(symboln, sizeof(symboln), "%sTexStorage1D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexStorage2D) {
+ void ** procp = (void **) &disp->TexStorage2D;
+ snprintf(symboln, sizeof(symboln), "%sTexStorage2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexStorage3D) {
+ void ** procp = (void **) &disp->TexStorage3D;
+ snprintf(symboln, sizeof(symboln), "%sTexStorage3D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TextureStorage1DEXT) {
+ void ** procp = (void **) &disp->TextureStorage1DEXT;
+ snprintf(symboln, sizeof(symboln), "%sTextureStorage1DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TextureStorage2DEXT) {
+ void ** procp = (void **) &disp->TextureStorage2DEXT;
+ snprintf(symboln, sizeof(symboln), "%sTextureStorage2DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TextureStorage3DEXT) {
+ void ** procp = (void **) &disp->TextureStorage3DEXT;
+ snprintf(symboln, sizeof(symboln), "%sTextureStorage3DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PolygonOffsetEXT) {
+ void ** procp = (void **) &disp->PolygonOffsetEXT;
+ snprintf(symboln, sizeof(symboln), "%sPolygonOffsetEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetPixelTexGenParameterfvSGIS) {
+ void ** procp = (void **) &disp->GetPixelTexGenParameterfvSGIS;
+ snprintf(symboln, sizeof(symboln), "%sGetPixelTexGenParameterfvSGIS", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetPixelTexGenParameterivSGIS) {
+ void ** procp = (void **) &disp->GetPixelTexGenParameterivSGIS;
+ snprintf(symboln, sizeof(symboln), "%sGetPixelTexGenParameterivSGIS", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelTexGenParameterfSGIS) {
+ void ** procp = (void **) &disp->PixelTexGenParameterfSGIS;
+ snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameterfSGIS", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelTexGenParameterfvSGIS) {
+ void ** procp = (void **) &disp->PixelTexGenParameterfvSGIS;
+ snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameterfvSGIS", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelTexGenParameteriSGIS) {
+ void ** procp = (void **) &disp->PixelTexGenParameteriSGIS;
+ snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameteriSGIS", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelTexGenParameterivSGIS) {
+ void ** procp = (void **) &disp->PixelTexGenParameterivSGIS;
+ snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameterivSGIS", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SampleMaskSGIS) {
+ void ** procp = (void **) &disp->SampleMaskSGIS;
+ snprintf(symboln, sizeof(symboln), "%sSampleMaskSGIS", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SampleMaskSGIS) {
+ void ** procp = (void **) &disp->SampleMaskSGIS;
+ snprintf(symboln, sizeof(symboln), "%sSampleMaskEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SamplePatternSGIS) {
+ void ** procp = (void **) &disp->SamplePatternSGIS;
+ snprintf(symboln, sizeof(symboln), "%sSamplePatternSGIS", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SamplePatternSGIS) {
+ void ** procp = (void **) &disp->SamplePatternSGIS;
+ snprintf(symboln, sizeof(symboln), "%sSamplePatternEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorPointerEXT) {
+ void ** procp = (void **) &disp->ColorPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sColorPointerEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EdgeFlagPointerEXT) {
+ void ** procp = (void **) &disp->EdgeFlagPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sEdgeFlagPointerEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IndexPointerEXT) {
+ void ** procp = (void **) &disp->IndexPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sIndexPointerEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->NormalPointerEXT) {
+ void ** procp = (void **) &disp->NormalPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sNormalPointerEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexCoordPointerEXT) {
+ void ** procp = (void **) &disp->TexCoordPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sTexCoordPointerEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexPointerEXT) {
+ void ** procp = (void **) &disp->VertexPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexPointerEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameterfEXT) {
+ void ** procp = (void **) &disp->PointParameterfEXT;
+ snprintf(symboln, sizeof(symboln), "%sPointParameterf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameterfEXT) {
+ void ** procp = (void **) &disp->PointParameterfEXT;
+ snprintf(symboln, sizeof(symboln), "%sPointParameterfARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameterfEXT) {
+ void ** procp = (void **) &disp->PointParameterfEXT;
+ snprintf(symboln, sizeof(symboln), "%sPointParameterfEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameterfEXT) {
+ void ** procp = (void **) &disp->PointParameterfEXT;
+ snprintf(symboln, sizeof(symboln), "%sPointParameterfSGIS", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameterfvEXT) {
+ void ** procp = (void **) &disp->PointParameterfvEXT;
+ snprintf(symboln, sizeof(symboln), "%sPointParameterfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameterfvEXT) {
+ void ** procp = (void **) &disp->PointParameterfvEXT;
+ snprintf(symboln, sizeof(symboln), "%sPointParameterfvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameterfvEXT) {
+ void ** procp = (void **) &disp->PointParameterfvEXT;
+ snprintf(symboln, sizeof(symboln), "%sPointParameterfvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameterfvEXT) {
+ void ** procp = (void **) &disp->PointParameterfvEXT;
+ snprintf(symboln, sizeof(symboln), "%sPointParameterfvSGIS", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LockArraysEXT) {
+ void ** procp = (void **) &disp->LockArraysEXT;
+ snprintf(symboln, sizeof(symboln), "%sLockArraysEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UnlockArraysEXT) {
+ void ** procp = (void **) &disp->UnlockArraysEXT;
+ snprintf(symboln, sizeof(symboln), "%sUnlockArraysEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3bEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3bEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3b", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3bEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3bEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3bEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3bvEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3bvEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3bv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3bvEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3bvEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3bvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3dEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3dEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3dEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3dEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3dEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3dvEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3dvEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3dvEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3dvEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3dvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3fEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3fEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3fEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3fEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3fEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3fvEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3fvEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3fvEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3fvEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3fvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3iEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3iEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3iEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3iEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3iEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3ivEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3ivEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3ivEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3ivEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3sEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3sEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3sEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3sEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3sEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3svEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3svEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3svEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3svEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3svEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3ubEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3ubEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ub", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3ubEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3ubEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ubEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3ubvEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3ubvEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ubv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3ubvEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3ubvEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ubvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3uiEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3uiEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3uiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3uivEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3uivEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3uivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3usEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3usEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3us", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3usEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3usEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3usEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3usvEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3usvEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3usv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColor3usvEXT) {
+ void ** procp = (void **) &disp->SecondaryColor3usvEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColor3usvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColorPointerEXT) {
+ void ** procp = (void **) &disp->SecondaryColorPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColorPointer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SecondaryColorPointerEXT) {
+ void ** procp = (void **) &disp->SecondaryColorPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sSecondaryColorPointerEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiDrawArraysEXT) {
+ void ** procp = (void **) &disp->MultiDrawArraysEXT;
+ snprintf(symboln, sizeof(symboln), "%sMultiDrawArrays", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiDrawArraysEXT) {
+ void ** procp = (void **) &disp->MultiDrawArraysEXT;
+ snprintf(symboln, sizeof(symboln), "%sMultiDrawArraysEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiDrawElementsEXT) {
+ void ** procp = (void **) &disp->MultiDrawElementsEXT;
+ snprintf(symboln, sizeof(symboln), "%sMultiDrawElements", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiDrawElementsEXT) {
+ void ** procp = (void **) &disp->MultiDrawElementsEXT;
+ snprintf(symboln, sizeof(symboln), "%sMultiDrawElementsEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FogCoordPointerEXT) {
+ void ** procp = (void **) &disp->FogCoordPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sFogCoordPointer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FogCoordPointerEXT) {
+ void ** procp = (void **) &disp->FogCoordPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sFogCoordPointerEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FogCoorddEXT) {
+ void ** procp = (void **) &disp->FogCoorddEXT;
+ snprintf(symboln, sizeof(symboln), "%sFogCoordd", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FogCoorddEXT) {
+ void ** procp = (void **) &disp->FogCoorddEXT;
+ snprintf(symboln, sizeof(symboln), "%sFogCoorddEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FogCoorddvEXT) {
+ void ** procp = (void **) &disp->FogCoorddvEXT;
+ snprintf(symboln, sizeof(symboln), "%sFogCoorddv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FogCoorddvEXT) {
+ void ** procp = (void **) &disp->FogCoorddvEXT;
+ snprintf(symboln, sizeof(symboln), "%sFogCoorddvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FogCoordfEXT) {
+ void ** procp = (void **) &disp->FogCoordfEXT;
+ snprintf(symboln, sizeof(symboln), "%sFogCoordf", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FogCoordfEXT) {
+ void ** procp = (void **) &disp->FogCoordfEXT;
+ snprintf(symboln, sizeof(symboln), "%sFogCoordfEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FogCoordfvEXT) {
+ void ** procp = (void **) &disp->FogCoordfvEXT;
+ snprintf(symboln, sizeof(symboln), "%sFogCoordfv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FogCoordfvEXT) {
+ void ** procp = (void **) &disp->FogCoordfvEXT;
+ snprintf(symboln, sizeof(symboln), "%sFogCoordfvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PixelTexGenSGIX) {
+ void ** procp = (void **) &disp->PixelTexGenSGIX;
+ snprintf(symboln, sizeof(symboln), "%sPixelTexGenSGIX", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendFuncSeparateEXT) {
+ void ** procp = (void **) &disp->BlendFuncSeparateEXT;
+ snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparate", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendFuncSeparateEXT) {
+ void ** procp = (void **) &disp->BlendFuncSeparateEXT;
+ snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendFuncSeparateEXT) {
+ void ** procp = (void **) &disp->BlendFuncSeparateEXT;
+ snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateINGR", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FlushVertexArrayRangeNV) {
+ void ** procp = (void **) &disp->FlushVertexArrayRangeNV;
+ snprintf(symboln, sizeof(symboln), "%sFlushVertexArrayRangeNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexArrayRangeNV) {
+ void ** procp = (void **) &disp->VertexArrayRangeNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexArrayRangeNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CombinerInputNV) {
+ void ** procp = (void **) &disp->CombinerInputNV;
+ snprintf(symboln, sizeof(symboln), "%sCombinerInputNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CombinerOutputNV) {
+ void ** procp = (void **) &disp->CombinerOutputNV;
+ snprintf(symboln, sizeof(symboln), "%sCombinerOutputNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CombinerParameterfNV) {
+ void ** procp = (void **) &disp->CombinerParameterfNV;
+ snprintf(symboln, sizeof(symboln), "%sCombinerParameterfNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CombinerParameterfvNV) {
+ void ** procp = (void **) &disp->CombinerParameterfvNV;
+ snprintf(symboln, sizeof(symboln), "%sCombinerParameterfvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CombinerParameteriNV) {
+ void ** procp = (void **) &disp->CombinerParameteriNV;
+ snprintf(symboln, sizeof(symboln), "%sCombinerParameteriNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CombinerParameterivNV) {
+ void ** procp = (void **) &disp->CombinerParameterivNV;
+ snprintf(symboln, sizeof(symboln), "%sCombinerParameterivNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FinalCombinerInputNV) {
+ void ** procp = (void **) &disp->FinalCombinerInputNV;
+ snprintf(symboln, sizeof(symboln), "%sFinalCombinerInputNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetCombinerInputParameterfvNV) {
+ void ** procp = (void **) &disp->GetCombinerInputParameterfvNV;
+ snprintf(symboln, sizeof(symboln), "%sGetCombinerInputParameterfvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetCombinerInputParameterivNV) {
+ void ** procp = (void **) &disp->GetCombinerInputParameterivNV;
+ snprintf(symboln, sizeof(symboln), "%sGetCombinerInputParameterivNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetCombinerOutputParameterfvNV) {
+ void ** procp = (void **) &disp->GetCombinerOutputParameterfvNV;
+ snprintf(symboln, sizeof(symboln), "%sGetCombinerOutputParameterfvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetCombinerOutputParameterivNV) {
+ void ** procp = (void **) &disp->GetCombinerOutputParameterivNV;
+ snprintf(symboln, sizeof(symboln), "%sGetCombinerOutputParameterivNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetFinalCombinerInputParameterfvNV) {
+ void ** procp = (void **) &disp->GetFinalCombinerInputParameterfvNV;
+ snprintf(symboln, sizeof(symboln), "%sGetFinalCombinerInputParameterfvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetFinalCombinerInputParameterivNV) {
+ void ** procp = (void **) &disp->GetFinalCombinerInputParameterivNV;
+ snprintf(symboln, sizeof(symboln), "%sGetFinalCombinerInputParameterivNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ResizeBuffersMESA) {
+ void ** procp = (void **) &disp->ResizeBuffersMESA;
+ snprintf(symboln, sizeof(symboln), "%sResizeBuffersMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2dMESA) {
+ void ** procp = (void **) &disp->WindowPos2dMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2dMESA) {
+ void ** procp = (void **) &disp->WindowPos2dMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2dMESA) {
+ void ** procp = (void **) &disp->WindowPos2dMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2dMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2dvMESA) {
+ void ** procp = (void **) &disp->WindowPos2dvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2dvMESA) {
+ void ** procp = (void **) &disp->WindowPos2dvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2dvMESA) {
+ void ** procp = (void **) &disp->WindowPos2dvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2dvMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2fMESA) {
+ void ** procp = (void **) &disp->WindowPos2fMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2fMESA) {
+ void ** procp = (void **) &disp->WindowPos2fMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2fMESA) {
+ void ** procp = (void **) &disp->WindowPos2fMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2fMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2fvMESA) {
+ void ** procp = (void **) &disp->WindowPos2fvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2fvMESA) {
+ void ** procp = (void **) &disp->WindowPos2fvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2fvMESA) {
+ void ** procp = (void **) &disp->WindowPos2fvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2fvMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2iMESA) {
+ void ** procp = (void **) &disp->WindowPos2iMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2iMESA) {
+ void ** procp = (void **) &disp->WindowPos2iMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2iARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2iMESA) {
+ void ** procp = (void **) &disp->WindowPos2iMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2iMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2ivMESA) {
+ void ** procp = (void **) &disp->WindowPos2ivMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2ivMESA) {
+ void ** procp = (void **) &disp->WindowPos2ivMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2ivMESA) {
+ void ** procp = (void **) &disp->WindowPos2ivMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2ivMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2sMESA) {
+ void ** procp = (void **) &disp->WindowPos2sMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2sMESA) {
+ void ** procp = (void **) &disp->WindowPos2sMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2sARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2sMESA) {
+ void ** procp = (void **) &disp->WindowPos2sMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2sMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2svMESA) {
+ void ** procp = (void **) &disp->WindowPos2svMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2svMESA) {
+ void ** procp = (void **) &disp->WindowPos2svMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2svARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos2svMESA) {
+ void ** procp = (void **) &disp->WindowPos2svMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos2svMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3dMESA) {
+ void ** procp = (void **) &disp->WindowPos3dMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3d", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3dMESA) {
+ void ** procp = (void **) &disp->WindowPos3dMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3dARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3dMESA) {
+ void ** procp = (void **) &disp->WindowPos3dMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3dMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3dvMESA) {
+ void ** procp = (void **) &disp->WindowPos3dvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3dv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3dvMESA) {
+ void ** procp = (void **) &disp->WindowPos3dvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3dvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3dvMESA) {
+ void ** procp = (void **) &disp->WindowPos3dvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3dvMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3fMESA) {
+ void ** procp = (void **) &disp->WindowPos3fMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3f", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3fMESA) {
+ void ** procp = (void **) &disp->WindowPos3fMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3fARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3fMESA) {
+ void ** procp = (void **) &disp->WindowPos3fMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3fMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3fvMESA) {
+ void ** procp = (void **) &disp->WindowPos3fvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3fv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3fvMESA) {
+ void ** procp = (void **) &disp->WindowPos3fvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3fvARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3fvMESA) {
+ void ** procp = (void **) &disp->WindowPos3fvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3fvMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3iMESA) {
+ void ** procp = (void **) &disp->WindowPos3iMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3iMESA) {
+ void ** procp = (void **) &disp->WindowPos3iMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3iARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3iMESA) {
+ void ** procp = (void **) &disp->WindowPos3iMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3iMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3ivMESA) {
+ void ** procp = (void **) &disp->WindowPos3ivMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3ivMESA) {
+ void ** procp = (void **) &disp->WindowPos3ivMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3ivARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3ivMESA) {
+ void ** procp = (void **) &disp->WindowPos3ivMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3ivMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3sMESA) {
+ void ** procp = (void **) &disp->WindowPos3sMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3s", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3sMESA) {
+ void ** procp = (void **) &disp->WindowPos3sMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3sARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3sMESA) {
+ void ** procp = (void **) &disp->WindowPos3sMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3sMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3svMESA) {
+ void ** procp = (void **) &disp->WindowPos3svMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3svMESA) {
+ void ** procp = (void **) &disp->WindowPos3svMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3svARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos3svMESA) {
+ void ** procp = (void **) &disp->WindowPos3svMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos3svMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos4dMESA) {
+ void ** procp = (void **) &disp->WindowPos4dMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos4dMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos4dvMESA) {
+ void ** procp = (void **) &disp->WindowPos4dvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos4dvMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos4fMESA) {
+ void ** procp = (void **) &disp->WindowPos4fMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos4fMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos4fvMESA) {
+ void ** procp = (void **) &disp->WindowPos4fvMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos4fvMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos4iMESA) {
+ void ** procp = (void **) &disp->WindowPos4iMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos4iMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos4ivMESA) {
+ void ** procp = (void **) &disp->WindowPos4ivMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos4ivMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos4sMESA) {
+ void ** procp = (void **) &disp->WindowPos4sMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos4sMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->WindowPos4svMESA) {
+ void ** procp = (void **) &disp->WindowPos4svMESA;
+ snprintf(symboln, sizeof(symboln), "%sWindowPos4svMESA", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiModeDrawArraysIBM) {
+ void ** procp = (void **) &disp->MultiModeDrawArraysIBM;
+ snprintf(symboln, sizeof(symboln), "%sMultiModeDrawArraysIBM", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->MultiModeDrawElementsIBM) {
+ void ** procp = (void **) &disp->MultiModeDrawElementsIBM;
+ snprintf(symboln, sizeof(symboln), "%sMultiModeDrawElementsIBM", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteFencesNV) {
+ void ** procp = (void **) &disp->DeleteFencesNV;
+ snprintf(symboln, sizeof(symboln), "%sDeleteFencesNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FinishFenceNV) {
+ void ** procp = (void **) &disp->FinishFenceNV;
+ snprintf(symboln, sizeof(symboln), "%sFinishFenceNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenFencesNV) {
+ void ** procp = (void **) &disp->GenFencesNV;
+ snprintf(symboln, sizeof(symboln), "%sGenFencesNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetFenceivNV) {
+ void ** procp = (void **) &disp->GetFenceivNV;
+ snprintf(symboln, sizeof(symboln), "%sGetFenceivNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsFenceNV) {
+ void ** procp = (void **) &disp->IsFenceNV;
+ snprintf(symboln, sizeof(symboln), "%sIsFenceNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SetFenceNV) {
+ void ** procp = (void **) &disp->SetFenceNV;
+ snprintf(symboln, sizeof(symboln), "%sSetFenceNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TestFenceNV) {
+ void ** procp = (void **) &disp->TestFenceNV;
+ snprintf(symboln, sizeof(symboln), "%sTestFenceNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->AreProgramsResidentNV) {
+ void ** procp = (void **) &disp->AreProgramsResidentNV;
+ snprintf(symboln, sizeof(symboln), "%sAreProgramsResidentNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindProgramNV) {
+ void ** procp = (void **) &disp->BindProgramNV;
+ snprintf(symboln, sizeof(symboln), "%sBindProgramARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindProgramNV) {
+ void ** procp = (void **) &disp->BindProgramNV;
+ snprintf(symboln, sizeof(symboln), "%sBindProgramNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteProgramsNV) {
+ void ** procp = (void **) &disp->DeleteProgramsNV;
+ snprintf(symboln, sizeof(symboln), "%sDeleteProgramsARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteProgramsNV) {
+ void ** procp = (void **) &disp->DeleteProgramsNV;
+ snprintf(symboln, sizeof(symboln), "%sDeleteProgramsNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ExecuteProgramNV) {
+ void ** procp = (void **) &disp->ExecuteProgramNV;
+ snprintf(symboln, sizeof(symboln), "%sExecuteProgramNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenProgramsNV) {
+ void ** procp = (void **) &disp->GenProgramsNV;
+ snprintf(symboln, sizeof(symboln), "%sGenProgramsARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenProgramsNV) {
+ void ** procp = (void **) &disp->GenProgramsNV;
+ snprintf(symboln, sizeof(symboln), "%sGenProgramsNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramParameterdvNV) {
+ void ** procp = (void **) &disp->GetProgramParameterdvNV;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramParameterdvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramParameterfvNV) {
+ void ** procp = (void **) &disp->GetProgramParameterfvNV;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramParameterfvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramStringNV) {
+ void ** procp = (void **) &disp->GetProgramStringNV;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramStringNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramivNV) {
+ void ** procp = (void **) &disp->GetProgramivNV;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramivNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTrackMatrixivNV) {
+ void ** procp = (void **) &disp->GetTrackMatrixivNV;
+ snprintf(symboln, sizeof(symboln), "%sGetTrackMatrixivNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribPointervNV) {
+ void ** procp = (void **) &disp->GetVertexAttribPointervNV;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribPointerv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribPointervNV) {
+ void ** procp = (void **) &disp->GetVertexAttribPointervNV;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribPointervARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribPointervNV) {
+ void ** procp = (void **) &disp->GetVertexAttribPointervNV;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribPointervNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribdvNV) {
+ void ** procp = (void **) &disp->GetVertexAttribdvNV;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribdvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribfvNV) {
+ void ** procp = (void **) &disp->GetVertexAttribfvNV;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribfvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribivNV) {
+ void ** procp = (void **) &disp->GetVertexAttribivNV;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribivNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsProgramNV) {
+ void ** procp = (void **) &disp->IsProgramNV;
+ snprintf(symboln, sizeof(symboln), "%sIsProgramARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsProgramNV) {
+ void ** procp = (void **) &disp->IsProgramNV;
+ snprintf(symboln, sizeof(symboln), "%sIsProgramNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->LoadProgramNV) {
+ void ** procp = (void **) &disp->LoadProgramNV;
+ snprintf(symboln, sizeof(symboln), "%sLoadProgramNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramParameters4dvNV) {
+ void ** procp = (void **) &disp->ProgramParameters4dvNV;
+ snprintf(symboln, sizeof(symboln), "%sProgramParameters4dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramParameters4fvNV) {
+ void ** procp = (void **) &disp->ProgramParameters4fvNV;
+ snprintf(symboln, sizeof(symboln), "%sProgramParameters4fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RequestResidentProgramsNV) {
+ void ** procp = (void **) &disp->RequestResidentProgramsNV;
+ snprintf(symboln, sizeof(symboln), "%sRequestResidentProgramsNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TrackMatrixNV) {
+ void ** procp = (void **) &disp->TrackMatrixNV;
+ snprintf(symboln, sizeof(symboln), "%sTrackMatrixNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1dNV) {
+ void ** procp = (void **) &disp->VertexAttrib1dNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1dvNV) {
+ void ** procp = (void **) &disp->VertexAttrib1dvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1fNV) {
+ void ** procp = (void **) &disp->VertexAttrib1fNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1fvNV) {
+ void ** procp = (void **) &disp->VertexAttrib1fvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1sNV) {
+ void ** procp = (void **) &disp->VertexAttrib1sNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1sNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib1svNV) {
+ void ** procp = (void **) &disp->VertexAttrib1svNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib1svNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2dNV) {
+ void ** procp = (void **) &disp->VertexAttrib2dNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2dvNV) {
+ void ** procp = (void **) &disp->VertexAttrib2dvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2fNV) {
+ void ** procp = (void **) &disp->VertexAttrib2fNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2fvNV) {
+ void ** procp = (void **) &disp->VertexAttrib2fvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2sNV) {
+ void ** procp = (void **) &disp->VertexAttrib2sNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2sNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib2svNV) {
+ void ** procp = (void **) &disp->VertexAttrib2svNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib2svNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3dNV) {
+ void ** procp = (void **) &disp->VertexAttrib3dNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3dvNV) {
+ void ** procp = (void **) &disp->VertexAttrib3dvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3fNV) {
+ void ** procp = (void **) &disp->VertexAttrib3fNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3fvNV) {
+ void ** procp = (void **) &disp->VertexAttrib3fvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3sNV) {
+ void ** procp = (void **) &disp->VertexAttrib3sNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3sNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib3svNV) {
+ void ** procp = (void **) &disp->VertexAttrib3svNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib3svNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4dNV) {
+ void ** procp = (void **) &disp->VertexAttrib4dNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4dvNV) {
+ void ** procp = (void **) &disp->VertexAttrib4dvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4fNV) {
+ void ** procp = (void **) &disp->VertexAttrib4fNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4fvNV) {
+ void ** procp = (void **) &disp->VertexAttrib4fvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4sNV) {
+ void ** procp = (void **) &disp->VertexAttrib4sNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4sNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4svNV) {
+ void ** procp = (void **) &disp->VertexAttrib4svNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4svNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4ubNV) {
+ void ** procp = (void **) &disp->VertexAttrib4ubNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttrib4ubvNV) {
+ void ** procp = (void **) &disp->VertexAttrib4ubvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribPointerNV) {
+ void ** procp = (void **) &disp->VertexAttribPointerNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribPointerNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs1dvNV) {
+ void ** procp = (void **) &disp->VertexAttribs1dvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs1dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs1fvNV) {
+ void ** procp = (void **) &disp->VertexAttribs1fvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs1fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs1svNV) {
+ void ** procp = (void **) &disp->VertexAttribs1svNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs1svNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs2dvNV) {
+ void ** procp = (void **) &disp->VertexAttribs2dvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs2dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs2fvNV) {
+ void ** procp = (void **) &disp->VertexAttribs2fvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs2fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs2svNV) {
+ void ** procp = (void **) &disp->VertexAttribs2svNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs2svNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs3dvNV) {
+ void ** procp = (void **) &disp->VertexAttribs3dvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs3dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs3fvNV) {
+ void ** procp = (void **) &disp->VertexAttribs3fvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs3fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs3svNV) {
+ void ** procp = (void **) &disp->VertexAttribs3svNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs3svNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs4dvNV) {
+ void ** procp = (void **) &disp->VertexAttribs4dvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs4dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs4fvNV) {
+ void ** procp = (void **) &disp->VertexAttribs4fvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs4fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs4svNV) {
+ void ** procp = (void **) &disp->VertexAttribs4svNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs4svNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribs4ubvNV) {
+ void ** procp = (void **) &disp->VertexAttribs4ubvNV;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribs4ubvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexBumpParameterfvATI) {
+ void ** procp = (void **) &disp->GetTexBumpParameterfvATI;
+ snprintf(symboln, sizeof(symboln), "%sGetTexBumpParameterfvATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexBumpParameterivATI) {
+ void ** procp = (void **) &disp->GetTexBumpParameterivATI;
+ snprintf(symboln, sizeof(symboln), "%sGetTexBumpParameterivATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexBumpParameterfvATI) {
+ void ** procp = (void **) &disp->TexBumpParameterfvATI;
+ snprintf(symboln, sizeof(symboln), "%sTexBumpParameterfvATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexBumpParameterivATI) {
+ void ** procp = (void **) &disp->TexBumpParameterivATI;
+ snprintf(symboln, sizeof(symboln), "%sTexBumpParameterivATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->AlphaFragmentOp1ATI) {
+ void ** procp = (void **) &disp->AlphaFragmentOp1ATI;
+ snprintf(symboln, sizeof(symboln), "%sAlphaFragmentOp1ATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->AlphaFragmentOp2ATI) {
+ void ** procp = (void **) &disp->AlphaFragmentOp2ATI;
+ snprintf(symboln, sizeof(symboln), "%sAlphaFragmentOp2ATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->AlphaFragmentOp3ATI) {
+ void ** procp = (void **) &disp->AlphaFragmentOp3ATI;
+ snprintf(symboln, sizeof(symboln), "%sAlphaFragmentOp3ATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BeginFragmentShaderATI) {
+ void ** procp = (void **) &disp->BeginFragmentShaderATI;
+ snprintf(symboln, sizeof(symboln), "%sBeginFragmentShaderATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindFragmentShaderATI) {
+ void ** procp = (void **) &disp->BindFragmentShaderATI;
+ snprintf(symboln, sizeof(symboln), "%sBindFragmentShaderATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorFragmentOp1ATI) {
+ void ** procp = (void **) &disp->ColorFragmentOp1ATI;
+ snprintf(symboln, sizeof(symboln), "%sColorFragmentOp1ATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorFragmentOp2ATI) {
+ void ** procp = (void **) &disp->ColorFragmentOp2ATI;
+ snprintf(symboln, sizeof(symboln), "%sColorFragmentOp2ATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorFragmentOp3ATI) {
+ void ** procp = (void **) &disp->ColorFragmentOp3ATI;
+ snprintf(symboln, sizeof(symboln), "%sColorFragmentOp3ATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteFragmentShaderATI) {
+ void ** procp = (void **) &disp->DeleteFragmentShaderATI;
+ snprintf(symboln, sizeof(symboln), "%sDeleteFragmentShaderATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EndFragmentShaderATI) {
+ void ** procp = (void **) &disp->EndFragmentShaderATI;
+ snprintf(symboln, sizeof(symboln), "%sEndFragmentShaderATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenFragmentShadersATI) {
+ void ** procp = (void **) &disp->GenFragmentShadersATI;
+ snprintf(symboln, sizeof(symboln), "%sGenFragmentShadersATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PassTexCoordATI) {
+ void ** procp = (void **) &disp->PassTexCoordATI;
+ snprintf(symboln, sizeof(symboln), "%sPassTexCoordATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SampleMapATI) {
+ void ** procp = (void **) &disp->SampleMapATI;
+ snprintf(symboln, sizeof(symboln), "%sSampleMapATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->SetFragmentShaderConstantATI) {
+ void ** procp = (void **) &disp->SetFragmentShaderConstantATI;
+ snprintf(symboln, sizeof(symboln), "%sSetFragmentShaderConstantATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameteriNV) {
+ void ** procp = (void **) &disp->PointParameteriNV;
+ snprintf(symboln, sizeof(symboln), "%sPointParameteri", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameteriNV) {
+ void ** procp = (void **) &disp->PointParameteriNV;
+ snprintf(symboln, sizeof(symboln), "%sPointParameteriNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameterivNV) {
+ void ** procp = (void **) &disp->PointParameterivNV;
+ snprintf(symboln, sizeof(symboln), "%sPointParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PointParameterivNV) {
+ void ** procp = (void **) &disp->PointParameterivNV;
+ snprintf(symboln, sizeof(symboln), "%sPointParameterivNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ActiveStencilFaceEXT) {
+ void ** procp = (void **) &disp->ActiveStencilFaceEXT;
+ snprintf(symboln, sizeof(symboln), "%sActiveStencilFaceEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindVertexArrayAPPLE) {
+ void ** procp = (void **) &disp->BindVertexArrayAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sBindVertexArrayAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteVertexArraysAPPLE) {
+ void ** procp = (void **) &disp->DeleteVertexArraysAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sDeleteVertexArrays", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteVertexArraysAPPLE) {
+ void ** procp = (void **) &disp->DeleteVertexArraysAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sDeleteVertexArraysAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenVertexArraysAPPLE) {
+ void ** procp = (void **) &disp->GenVertexArraysAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sGenVertexArraysAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsVertexArrayAPPLE) {
+ void ** procp = (void **) &disp->IsVertexArrayAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sIsVertexArray", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsVertexArrayAPPLE) {
+ void ** procp = (void **) &disp->IsVertexArrayAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sIsVertexArrayAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramNamedParameterdvNV) {
+ void ** procp = (void **) &disp->GetProgramNamedParameterdvNV;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramNamedParameterdvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetProgramNamedParameterfvNV) {
+ void ** procp = (void **) &disp->GetProgramNamedParameterfvNV;
+ snprintf(symboln, sizeof(symboln), "%sGetProgramNamedParameterfvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramNamedParameter4dNV) {
+ void ** procp = (void **) &disp->ProgramNamedParameter4dNV;
+ snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4dNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramNamedParameter4dvNV) {
+ void ** procp = (void **) &disp->ProgramNamedParameter4dvNV;
+ snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4dvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramNamedParameter4fNV) {
+ void ** procp = (void **) &disp->ProgramNamedParameter4fNV;
+ snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4fNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramNamedParameter4fvNV) {
+ void ** procp = (void **) &disp->ProgramNamedParameter4fvNV;
+ snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4fvNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PrimitiveRestartIndexNV) {
+ void ** procp = (void **) &disp->PrimitiveRestartIndexNV;
+ snprintf(symboln, sizeof(symboln), "%sPrimitiveRestartIndexNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PrimitiveRestartIndexNV) {
+ void ** procp = (void **) &disp->PrimitiveRestartIndexNV;
+ snprintf(symboln, sizeof(symboln), "%sPrimitiveRestartIndex", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->PrimitiveRestartNV) {
+ void ** procp = (void **) &disp->PrimitiveRestartNV;
+ snprintf(symboln, sizeof(symboln), "%sPrimitiveRestartNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DepthBoundsEXT) {
+ void ** procp = (void **) &disp->DepthBoundsEXT;
+ snprintf(symboln, sizeof(symboln), "%sDepthBoundsEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendEquationSeparateEXT) {
+ void ** procp = (void **) &disp->BlendEquationSeparateEXT;
+ snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparate", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendEquationSeparateEXT) {
+ void ** procp = (void **) &disp->BlendEquationSeparateEXT;
+ snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlendEquationSeparateEXT) {
+ void ** procp = (void **) &disp->BlendEquationSeparateEXT;
+ snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindFramebufferEXT) {
+ void ** procp = (void **) &disp->BindFramebufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindFramebuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindFramebufferEXT) {
+ void ** procp = (void **) &disp->BindFramebufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindFramebufferEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindRenderbufferEXT) {
+ void ** procp = (void **) &disp->BindRenderbufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindRenderbuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindRenderbufferEXT) {
+ void ** procp = (void **) &disp->BindRenderbufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindRenderbufferEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CheckFramebufferStatusEXT) {
+ void ** procp = (void **) &disp->CheckFramebufferStatusEXT;
+ snprintf(symboln, sizeof(symboln), "%sCheckFramebufferStatus", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CheckFramebufferStatusEXT) {
+ void ** procp = (void **) &disp->CheckFramebufferStatusEXT;
+ snprintf(symboln, sizeof(symboln), "%sCheckFramebufferStatusEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteFramebuffersEXT) {
+ void ** procp = (void **) &disp->DeleteFramebuffersEXT;
+ snprintf(symboln, sizeof(symboln), "%sDeleteFramebuffers", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteFramebuffersEXT) {
+ void ** procp = (void **) &disp->DeleteFramebuffersEXT;
+ snprintf(symboln, sizeof(symboln), "%sDeleteFramebuffersEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteRenderbuffersEXT) {
+ void ** procp = (void **) &disp->DeleteRenderbuffersEXT;
+ snprintf(symboln, sizeof(symboln), "%sDeleteRenderbuffers", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DeleteRenderbuffersEXT) {
+ void ** procp = (void **) &disp->DeleteRenderbuffersEXT;
+ snprintf(symboln, sizeof(symboln), "%sDeleteRenderbuffersEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferRenderbufferEXT) {
+ void ** procp = (void **) &disp->FramebufferRenderbufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferRenderbuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferRenderbufferEXT) {
+ void ** procp = (void **) &disp->FramebufferRenderbufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferRenderbufferEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTexture1DEXT) {
+ void ** procp = (void **) &disp->FramebufferTexture1DEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTexture1D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTexture1DEXT) {
+ void ** procp = (void **) &disp->FramebufferTexture1DEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTexture1DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTexture2DEXT) {
+ void ** procp = (void **) &disp->FramebufferTexture2DEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTexture2D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTexture2DEXT) {
+ void ** procp = (void **) &disp->FramebufferTexture2DEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTexture2DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTexture3DEXT) {
+ void ** procp = (void **) &disp->FramebufferTexture3DEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTexture3D", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTexture3DEXT) {
+ void ** procp = (void **) &disp->FramebufferTexture3DEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTexture3DEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenFramebuffersEXT) {
+ void ** procp = (void **) &disp->GenFramebuffersEXT;
+ snprintf(symboln, sizeof(symboln), "%sGenFramebuffers", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenFramebuffersEXT) {
+ void ** procp = (void **) &disp->GenFramebuffersEXT;
+ snprintf(symboln, sizeof(symboln), "%sGenFramebuffersEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenRenderbuffersEXT) {
+ void ** procp = (void **) &disp->GenRenderbuffersEXT;
+ snprintf(symboln, sizeof(symboln), "%sGenRenderbuffers", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenRenderbuffersEXT) {
+ void ** procp = (void **) &disp->GenRenderbuffersEXT;
+ snprintf(symboln, sizeof(symboln), "%sGenRenderbuffersEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenerateMipmapEXT) {
+ void ** procp = (void **) &disp->GenerateMipmapEXT;
+ snprintf(symboln, sizeof(symboln), "%sGenerateMipmap", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GenerateMipmapEXT) {
+ void ** procp = (void **) &disp->GenerateMipmapEXT;
+ snprintf(symboln, sizeof(symboln), "%sGenerateMipmapEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetFramebufferAttachmentParameterivEXT) {
+ void ** procp = (void **) &disp->GetFramebufferAttachmentParameterivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetFramebufferAttachmentParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetFramebufferAttachmentParameterivEXT) {
+ void ** procp = (void **) &disp->GetFramebufferAttachmentParameterivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetFramebufferAttachmentParameterivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetRenderbufferParameterivEXT) {
+ void ** procp = (void **) &disp->GetRenderbufferParameterivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetRenderbufferParameteriv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetRenderbufferParameterivEXT) {
+ void ** procp = (void **) &disp->GetRenderbufferParameterivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetRenderbufferParameterivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsFramebufferEXT) {
+ void ** procp = (void **) &disp->IsFramebufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sIsFramebuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsFramebufferEXT) {
+ void ** procp = (void **) &disp->IsFramebufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sIsFramebufferEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsRenderbufferEXT) {
+ void ** procp = (void **) &disp->IsRenderbufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sIsRenderbuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsRenderbufferEXT) {
+ void ** procp = (void **) &disp->IsRenderbufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sIsRenderbufferEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RenderbufferStorageEXT) {
+ void ** procp = (void **) &disp->RenderbufferStorageEXT;
+ snprintf(symboln, sizeof(symboln), "%sRenderbufferStorage", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->RenderbufferStorageEXT) {
+ void ** procp = (void **) &disp->RenderbufferStorageEXT;
+ snprintf(symboln, sizeof(symboln), "%sRenderbufferStorageEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlitFramebufferEXT) {
+ void ** procp = (void **) &disp->BlitFramebufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sBlitFramebuffer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BlitFramebufferEXT) {
+ void ** procp = (void **) &disp->BlitFramebufferEXT;
+ snprintf(symboln, sizeof(symboln), "%sBlitFramebufferEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BufferParameteriAPPLE) {
+ void ** procp = (void **) &disp->BufferParameteriAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sBufferParameteriAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FlushMappedBufferRangeAPPLE) {
+ void ** procp = (void **) &disp->FlushMappedBufferRangeAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sFlushMappedBufferRangeAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindFragDataLocationEXT) {
+ void ** procp = (void **) &disp->BindFragDataLocationEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindFragDataLocationEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindFragDataLocationEXT) {
+ void ** procp = (void **) &disp->BindFragDataLocationEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindFragDataLocation", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetFragDataLocationEXT) {
+ void ** procp = (void **) &disp->GetFragDataLocationEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetFragDataLocationEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetFragDataLocationEXT) {
+ void ** procp = (void **) &disp->GetFragDataLocationEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetFragDataLocation", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetUniformuivEXT) {
+ void ** procp = (void **) &disp->GetUniformuivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetUniformuivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetUniformuivEXT) {
+ void ** procp = (void **) &disp->GetUniformuivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetUniformuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribIivEXT) {
+ void ** procp = (void **) &disp->GetVertexAttribIivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribIivEXT) {
+ void ** procp = (void **) &disp->GetVertexAttribIivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribIuivEXT) {
+ void ** procp = (void **) &disp->GetVertexAttribIuivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIuivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetVertexAttribIuivEXT) {
+ void ** procp = (void **) &disp->GetVertexAttribIuivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1uiEXT) {
+ void ** procp = (void **) &disp->Uniform1uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform1uiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1uiEXT) {
+ void ** procp = (void **) &disp->Uniform1uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform1ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1uivEXT) {
+ void ** procp = (void **) &disp->Uniform1uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform1uivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform1uivEXT) {
+ void ** procp = (void **) &disp->Uniform1uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform1uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2uiEXT) {
+ void ** procp = (void **) &disp->Uniform2uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform2uiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2uiEXT) {
+ void ** procp = (void **) &disp->Uniform2uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform2ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2uivEXT) {
+ void ** procp = (void **) &disp->Uniform2uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform2uivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform2uivEXT) {
+ void ** procp = (void **) &disp->Uniform2uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform2uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3uiEXT) {
+ void ** procp = (void **) &disp->Uniform3uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform3uiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3uiEXT) {
+ void ** procp = (void **) &disp->Uniform3uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3uivEXT) {
+ void ** procp = (void **) &disp->Uniform3uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform3uivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform3uivEXT) {
+ void ** procp = (void **) &disp->Uniform3uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4uiEXT) {
+ void ** procp = (void **) &disp->Uniform4uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform4uiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4uiEXT) {
+ void ** procp = (void **) &disp->Uniform4uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform4ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4uivEXT) {
+ void ** procp = (void **) &disp->Uniform4uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform4uivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->Uniform4uivEXT) {
+ void ** procp = (void **) &disp->Uniform4uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sUniform4uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI1iEXT) {
+ void ** procp = (void **) &disp->VertexAttribI1iEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI1iEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI1iEXT) {
+ void ** procp = (void **) &disp->VertexAttribI1iEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI1i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI1ivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI1ivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI1ivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI1ivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI1ivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI1iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI1uiEXT) {
+ void ** procp = (void **) &disp->VertexAttribI1uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI1uiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI1uiEXT) {
+ void ** procp = (void **) &disp->VertexAttribI1uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI1ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI1uivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI1uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI1uivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI1uivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI1uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI1uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI2iEXT) {
+ void ** procp = (void **) &disp->VertexAttribI2iEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI2iEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI2iEXT) {
+ void ** procp = (void **) &disp->VertexAttribI2iEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI2i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI2ivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI2ivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI2ivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI2ivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI2ivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI2iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI2uiEXT) {
+ void ** procp = (void **) &disp->VertexAttribI2uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI2uiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI2uiEXT) {
+ void ** procp = (void **) &disp->VertexAttribI2uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI2ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI2uivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI2uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI2uivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI2uivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI2uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI2uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI3iEXT) {
+ void ** procp = (void **) &disp->VertexAttribI3iEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI3iEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI3iEXT) {
+ void ** procp = (void **) &disp->VertexAttribI3iEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI3i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI3ivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI3ivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI3ivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI3ivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI3ivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI3iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI3uiEXT) {
+ void ** procp = (void **) &disp->VertexAttribI3uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI3uiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI3uiEXT) {
+ void ** procp = (void **) &disp->VertexAttribI3uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI3ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI3uivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI3uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI3uivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI3uivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI3uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI3uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4bvEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4bvEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4bvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4bvEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4bvEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4bv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4iEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4iEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4iEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4iEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4iEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4i", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4ivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4ivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4ivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4ivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4iv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4svEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4svEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4svEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4svEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4svEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4sv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4ubvEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4ubvEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ubvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4ubvEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4ubvEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ubv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4uiEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4uiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4uiEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4uiEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ui", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4uivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4uivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4uivEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4uivEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4uiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4usvEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4usvEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4usvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribI4usvEXT) {
+ void ** procp = (void **) &disp->VertexAttribI4usvEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribI4usv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribIPointerEXT) {
+ void ** procp = (void **) &disp->VertexAttribIPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribIPointerEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->VertexAttribIPointerEXT) {
+ void ** procp = (void **) &disp->VertexAttribIPointerEXT;
+ snprintf(symboln, sizeof(symboln), "%sVertexAttribIPointer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTextureLayerEXT) {
+ void ** procp = (void **) &disp->FramebufferTextureLayerEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTextureLayer", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTextureLayerEXT) {
+ void ** procp = (void **) &disp->FramebufferTextureLayerEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTextureLayerARB", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->FramebufferTextureLayerEXT) {
+ void ** procp = (void **) &disp->FramebufferTextureLayerEXT;
+ snprintf(symboln, sizeof(symboln), "%sFramebufferTextureLayerEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorMaskIndexedEXT) {
+ void ** procp = (void **) &disp->ColorMaskIndexedEXT;
+ snprintf(symboln, sizeof(symboln), "%sColorMaskIndexedEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ColorMaskIndexedEXT) {
+ void ** procp = (void **) &disp->ColorMaskIndexedEXT;
+ snprintf(symboln, sizeof(symboln), "%sColorMaski", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DisableIndexedEXT) {
+ void ** procp = (void **) &disp->DisableIndexedEXT;
+ snprintf(symboln, sizeof(symboln), "%sDisableIndexedEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->DisableIndexedEXT) {
+ void ** procp = (void **) &disp->DisableIndexedEXT;
+ snprintf(symboln, sizeof(symboln), "%sDisablei", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EnableIndexedEXT) {
+ void ** procp = (void **) &disp->EnableIndexedEXT;
+ snprintf(symboln, sizeof(symboln), "%sEnableIndexedEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EnableIndexedEXT) {
+ void ** procp = (void **) &disp->EnableIndexedEXT;
+ snprintf(symboln, sizeof(symboln), "%sEnablei", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetBooleanIndexedvEXT) {
+ void ** procp = (void **) &disp->GetBooleanIndexedvEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetBooleanIndexedvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetBooleanIndexedvEXT) {
+ void ** procp = (void **) &disp->GetBooleanIndexedvEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetBooleani_v", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetIntegerIndexedvEXT) {
+ void ** procp = (void **) &disp->GetIntegerIndexedvEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetIntegerIndexedvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetIntegerIndexedvEXT) {
+ void ** procp = (void **) &disp->GetIntegerIndexedvEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetIntegeri_v", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsEnabledIndexedEXT) {
+ void ** procp = (void **) &disp->IsEnabledIndexedEXT;
+ snprintf(symboln, sizeof(symboln), "%sIsEnabledIndexedEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->IsEnabledIndexedEXT) {
+ void ** procp = (void **) &disp->IsEnabledIndexedEXT;
+ snprintf(symboln, sizeof(symboln), "%sIsEnabledi", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearColorIiEXT) {
+ void ** procp = (void **) &disp->ClearColorIiEXT;
+ snprintf(symboln, sizeof(symboln), "%sClearColorIiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ClearColorIuiEXT) {
+ void ** procp = (void **) &disp->ClearColorIuiEXT;
+ snprintf(symboln, sizeof(symboln), "%sClearColorIuiEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexParameterIivEXT) {
+ void ** procp = (void **) &disp->GetTexParameterIivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetTexParameterIivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexParameterIivEXT) {
+ void ** procp = (void **) &disp->GetTexParameterIivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetTexParameterIiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexParameterIuivEXT) {
+ void ** procp = (void **) &disp->GetTexParameterIuivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetTexParameterIuivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexParameterIuivEXT) {
+ void ** procp = (void **) &disp->GetTexParameterIuivEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetTexParameterIuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexParameterIivEXT) {
+ void ** procp = (void **) &disp->TexParameterIivEXT;
+ snprintf(symboln, sizeof(symboln), "%sTexParameterIivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexParameterIivEXT) {
+ void ** procp = (void **) &disp->TexParameterIivEXT;
+ snprintf(symboln, sizeof(symboln), "%sTexParameterIiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexParameterIuivEXT) {
+ void ** procp = (void **) &disp->TexParameterIuivEXT;
+ snprintf(symboln, sizeof(symboln), "%sTexParameterIuivEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TexParameterIuivEXT) {
+ void ** procp = (void **) &disp->TexParameterIuivEXT;
+ snprintf(symboln, sizeof(symboln), "%sTexParameterIuiv", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BeginConditionalRenderNV) {
+ void ** procp = (void **) &disp->BeginConditionalRenderNV;
+ snprintf(symboln, sizeof(symboln), "%sBeginConditionalRenderNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BeginConditionalRenderNV) {
+ void ** procp = (void **) &disp->BeginConditionalRenderNV;
+ snprintf(symboln, sizeof(symboln), "%sBeginConditionalRender", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EndConditionalRenderNV) {
+ void ** procp = (void **) &disp->EndConditionalRenderNV;
+ snprintf(symboln, sizeof(symboln), "%sEndConditionalRenderNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EndConditionalRenderNV) {
+ void ** procp = (void **) &disp->EndConditionalRenderNV;
+ snprintf(symboln, sizeof(symboln), "%sEndConditionalRender", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BeginTransformFeedbackEXT) {
+ void ** procp = (void **) &disp->BeginTransformFeedbackEXT;
+ snprintf(symboln, sizeof(symboln), "%sBeginTransformFeedbackEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BeginTransformFeedbackEXT) {
+ void ** procp = (void **) &disp->BeginTransformFeedbackEXT;
+ snprintf(symboln, sizeof(symboln), "%sBeginTransformFeedback", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindBufferBaseEXT) {
+ void ** procp = (void **) &disp->BindBufferBaseEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindBufferBaseEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindBufferBaseEXT) {
+ void ** procp = (void **) &disp->BindBufferBaseEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindBufferBase", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindBufferOffsetEXT) {
+ void ** procp = (void **) &disp->BindBufferOffsetEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindBufferOffsetEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindBufferRangeEXT) {
+ void ** procp = (void **) &disp->BindBufferRangeEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindBufferRangeEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->BindBufferRangeEXT) {
+ void ** procp = (void **) &disp->BindBufferRangeEXT;
+ snprintf(symboln, sizeof(symboln), "%sBindBufferRange", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EndTransformFeedbackEXT) {
+ void ** procp = (void **) &disp->EndTransformFeedbackEXT;
+ snprintf(symboln, sizeof(symboln), "%sEndTransformFeedbackEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EndTransformFeedbackEXT) {
+ void ** procp = (void **) &disp->EndTransformFeedbackEXT;
+ snprintf(symboln, sizeof(symboln), "%sEndTransformFeedback", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTransformFeedbackVaryingEXT) {
+ void ** procp = (void **) &disp->GetTransformFeedbackVaryingEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetTransformFeedbackVaryingEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTransformFeedbackVaryingEXT) {
+ void ** procp = (void **) &disp->GetTransformFeedbackVaryingEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetTransformFeedbackVarying", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TransformFeedbackVaryingsEXT) {
+ void ** procp = (void **) &disp->TransformFeedbackVaryingsEXT;
+ snprintf(symboln, sizeof(symboln), "%sTransformFeedbackVaryingsEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TransformFeedbackVaryingsEXT) {
+ void ** procp = (void **) &disp->TransformFeedbackVaryingsEXT;
+ snprintf(symboln, sizeof(symboln), "%sTransformFeedbackVaryings", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProvokingVertexEXT) {
+ void ** procp = (void **) &disp->ProvokingVertexEXT;
+ snprintf(symboln, sizeof(symboln), "%sProvokingVertexEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProvokingVertexEXT) {
+ void ** procp = (void **) &disp->ProvokingVertexEXT;
+ snprintf(symboln, sizeof(symboln), "%sProvokingVertex", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetTexParameterPointervAPPLE) {
+ void ** procp = (void **) &disp->GetTexParameterPointervAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sGetTexParameterPointervAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TextureRangeAPPLE) {
+ void ** procp = (void **) &disp->TextureRangeAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sTextureRangeAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetObjectParameterivAPPLE) {
+ void ** procp = (void **) &disp->GetObjectParameterivAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sGetObjectParameterivAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ObjectPurgeableAPPLE) {
+ void ** procp = (void **) &disp->ObjectPurgeableAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sObjectPurgeableAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ObjectUnpurgeableAPPLE) {
+ void ** procp = (void **) &disp->ObjectUnpurgeableAPPLE;
+ snprintf(symboln, sizeof(symboln), "%sObjectUnpurgeableAPPLE", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ActiveProgramEXT) {
+ void ** procp = (void **) &disp->ActiveProgramEXT;
+ snprintf(symboln, sizeof(symboln), "%sActiveProgramEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->CreateShaderProgramEXT) {
+ void ** procp = (void **) &disp->CreateShaderProgramEXT;
+ snprintf(symboln, sizeof(symboln), "%sCreateShaderProgramEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->UseShaderProgramEXT) {
+ void ** procp = (void **) &disp->UseShaderProgramEXT;
+ snprintf(symboln, sizeof(symboln), "%sUseShaderProgramEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->TextureBarrierNV) {
+ void ** procp = (void **) &disp->TextureBarrierNV;
+ snprintf(symboln, sizeof(symboln), "%sTextureBarrierNV", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->StencilFuncSeparateATI) {
+ void ** procp = (void **) &disp->StencilFuncSeparateATI;
+ snprintf(symboln, sizeof(symboln), "%sStencilFuncSeparateATI", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramEnvParameters4fvEXT) {
+ void ** procp = (void **) &disp->ProgramEnvParameters4fvEXT;
+ snprintf(symboln, sizeof(symboln), "%sProgramEnvParameters4fvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->ProgramLocalParameters4fvEXT) {
+ void ** procp = (void **) &disp->ProgramLocalParameters4fvEXT;
+ snprintf(symboln, sizeof(symboln), "%sProgramLocalParameters4fvEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetQueryObjecti64vEXT) {
+ void ** procp = (void **) &disp->GetQueryObjecti64vEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetQueryObjecti64vEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->GetQueryObjectui64vEXT) {
+ void ** procp = (void **) &disp->GetQueryObjectui64vEXT;
+ snprintf(symboln, sizeof(symboln), "%sGetQueryObjectui64vEXT", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EGLImageTargetRenderbufferStorageOES) {
+ void ** procp = (void **) &disp->EGLImageTargetRenderbufferStorageOES;
+ snprintf(symboln, sizeof(symboln), "%sEGLImageTargetRenderbufferStorageOES", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ if(!disp->EGLImageTargetTexture2DOES) {
+ void ** procp = (void **) &disp->EGLImageTargetTexture2DOES;
+ snprintf(symboln, sizeof(symboln), "%sEGLImageTargetTexture2DOES", symbol_prefix);
+ *procp = dlsym(handle, symboln);
+ }
+
+
+ __glapi_gentable_set_remaining_noop(disp);
+
+ return disp;
+}
+
diff --git a/xorg-server/glx/glapitable.h b/xorg-server/glx/glapitable.h
index 4bc95cf94..84833b5a9 100644
--- a/xorg-server/glx/glapitable.h
+++ b/xorg-server/glx/glapitable.h
@@ -1,1022 +1,1022 @@
-/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */
-
-/*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
- * (C) Copyright IBM Corporation 2004
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL, IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#if !defined( _GLAPI_TABLE_H_ )
-# define _GLAPI_TABLE_H_
-
-#ifndef GLAPIENTRYP
-# ifndef GLAPIENTRY
-# define GLAPIENTRY
-# endif
-
-# define GLAPIENTRYP GLAPIENTRY *
-#endif
-
-
-struct _glapi_table
-{
- void (GLAPIENTRYP NewList)(GLuint list, GLenum mode); /* 0 */
- void (GLAPIENTRYP EndList)(void); /* 1 */
- void (GLAPIENTRYP CallList)(GLuint list); /* 2 */
- void (GLAPIENTRYP CallLists)(GLsizei n, GLenum type, const GLvoid * lists); /* 3 */
- void (GLAPIENTRYP DeleteLists)(GLuint list, GLsizei range); /* 4 */
- GLuint (GLAPIENTRYP GenLists)(GLsizei range); /* 5 */
- void (GLAPIENTRYP ListBase)(GLuint base); /* 6 */
- void (GLAPIENTRYP Begin)(GLenum mode); /* 7 */
- void (GLAPIENTRYP Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); /* 8 */
- void (GLAPIENTRYP Color3b)(GLbyte red, GLbyte green, GLbyte blue); /* 9 */
- void (GLAPIENTRYP Color3bv)(const GLbyte * v); /* 10 */
- void (GLAPIENTRYP Color3d)(GLdouble red, GLdouble green, GLdouble blue); /* 11 */
- void (GLAPIENTRYP Color3dv)(const GLdouble * v); /* 12 */
- void (GLAPIENTRYP Color3f)(GLfloat red, GLfloat green, GLfloat blue); /* 13 */
- void (GLAPIENTRYP Color3fv)(const GLfloat * v); /* 14 */
- void (GLAPIENTRYP Color3i)(GLint red, GLint green, GLint blue); /* 15 */
- void (GLAPIENTRYP Color3iv)(const GLint * v); /* 16 */
- void (GLAPIENTRYP Color3s)(GLshort red, GLshort green, GLshort blue); /* 17 */
- void (GLAPIENTRYP Color3sv)(const GLshort * v); /* 18 */
- void (GLAPIENTRYP Color3ub)(GLubyte red, GLubyte green, GLubyte blue); /* 19 */
- void (GLAPIENTRYP Color3ubv)(const GLubyte * v); /* 20 */
- void (GLAPIENTRYP Color3ui)(GLuint red, GLuint green, GLuint blue); /* 21 */
- void (GLAPIENTRYP Color3uiv)(const GLuint * v); /* 22 */
- void (GLAPIENTRYP Color3us)(GLushort red, GLushort green, GLushort blue); /* 23 */
- void (GLAPIENTRYP Color3usv)(const GLushort * v); /* 24 */
- void (GLAPIENTRYP Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); /* 25 */
- void (GLAPIENTRYP Color4bv)(const GLbyte * v); /* 26 */
- void (GLAPIENTRYP Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); /* 27 */
- void (GLAPIENTRYP Color4dv)(const GLdouble * v); /* 28 */
- void (GLAPIENTRYP Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 29 */
- void (GLAPIENTRYP Color4fv)(const GLfloat * v); /* 30 */
- void (GLAPIENTRYP Color4i)(GLint red, GLint green, GLint blue, GLint alpha); /* 31 */
- void (GLAPIENTRYP Color4iv)(const GLint * v); /* 32 */
- void (GLAPIENTRYP Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); /* 33 */
- void (GLAPIENTRYP Color4sv)(const GLshort * v); /* 34 */
- void (GLAPIENTRYP Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); /* 35 */
- void (GLAPIENTRYP Color4ubv)(const GLubyte * v); /* 36 */
- void (GLAPIENTRYP Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); /* 37 */
- void (GLAPIENTRYP Color4uiv)(const GLuint * v); /* 38 */
- void (GLAPIENTRYP Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); /* 39 */
- void (GLAPIENTRYP Color4usv)(const GLushort * v); /* 40 */
- void (GLAPIENTRYP EdgeFlag)(GLboolean flag); /* 41 */
- void (GLAPIENTRYP EdgeFlagv)(const GLboolean * flag); /* 42 */
- void (GLAPIENTRYP End)(void); /* 43 */
- void (GLAPIENTRYP Indexd)(GLdouble c); /* 44 */
- void (GLAPIENTRYP Indexdv)(const GLdouble * c); /* 45 */
- void (GLAPIENTRYP Indexf)(GLfloat c); /* 46 */
- void (GLAPIENTRYP Indexfv)(const GLfloat * c); /* 47 */
- void (GLAPIENTRYP Indexi)(GLint c); /* 48 */
- void (GLAPIENTRYP Indexiv)(const GLint * c); /* 49 */
- void (GLAPIENTRYP Indexs)(GLshort c); /* 50 */
- void (GLAPIENTRYP Indexsv)(const GLshort * c); /* 51 */
- void (GLAPIENTRYP Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); /* 52 */
- void (GLAPIENTRYP Normal3bv)(const GLbyte * v); /* 53 */
- void (GLAPIENTRYP Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); /* 54 */
- void (GLAPIENTRYP Normal3dv)(const GLdouble * v); /* 55 */
- void (GLAPIENTRYP Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); /* 56 */
- void (GLAPIENTRYP Normal3fv)(const GLfloat * v); /* 57 */
- void (GLAPIENTRYP Normal3i)(GLint nx, GLint ny, GLint nz); /* 58 */
- void (GLAPIENTRYP Normal3iv)(const GLint * v); /* 59 */
- void (GLAPIENTRYP Normal3s)(GLshort nx, GLshort ny, GLshort nz); /* 60 */
- void (GLAPIENTRYP Normal3sv)(const GLshort * v); /* 61 */
- void (GLAPIENTRYP RasterPos2d)(GLdouble x, GLdouble y); /* 62 */
- void (GLAPIENTRYP RasterPos2dv)(const GLdouble * v); /* 63 */
- void (GLAPIENTRYP RasterPos2f)(GLfloat x, GLfloat y); /* 64 */
- void (GLAPIENTRYP RasterPos2fv)(const GLfloat * v); /* 65 */
- void (GLAPIENTRYP RasterPos2i)(GLint x, GLint y); /* 66 */
- void (GLAPIENTRYP RasterPos2iv)(const GLint * v); /* 67 */
- void (GLAPIENTRYP RasterPos2s)(GLshort x, GLshort y); /* 68 */
- void (GLAPIENTRYP RasterPos2sv)(const GLshort * v); /* 69 */
- void (GLAPIENTRYP RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); /* 70 */
- void (GLAPIENTRYP RasterPos3dv)(const GLdouble * v); /* 71 */
- void (GLAPIENTRYP RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); /* 72 */
- void (GLAPIENTRYP RasterPos3fv)(const GLfloat * v); /* 73 */
- void (GLAPIENTRYP RasterPos3i)(GLint x, GLint y, GLint z); /* 74 */
- void (GLAPIENTRYP RasterPos3iv)(const GLint * v); /* 75 */
- void (GLAPIENTRYP RasterPos3s)(GLshort x, GLshort y, GLshort z); /* 76 */
- void (GLAPIENTRYP RasterPos3sv)(const GLshort * v); /* 77 */
- void (GLAPIENTRYP RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 78 */
- void (GLAPIENTRYP RasterPos4dv)(const GLdouble * v); /* 79 */
- void (GLAPIENTRYP RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 80 */
- void (GLAPIENTRYP RasterPos4fv)(const GLfloat * v); /* 81 */
- void (GLAPIENTRYP RasterPos4i)(GLint x, GLint y, GLint z, GLint w); /* 82 */
- void (GLAPIENTRYP RasterPos4iv)(const GLint * v); /* 83 */
- void (GLAPIENTRYP RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 84 */
- void (GLAPIENTRYP RasterPos4sv)(const GLshort * v); /* 85 */
- void (GLAPIENTRYP Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); /* 86 */
- void (GLAPIENTRYP Rectdv)(const GLdouble * v1, const GLdouble * v2); /* 87 */
- void (GLAPIENTRYP Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); /* 88 */
- void (GLAPIENTRYP Rectfv)(const GLfloat * v1, const GLfloat * v2); /* 89 */
- void (GLAPIENTRYP Recti)(GLint x1, GLint y1, GLint x2, GLint y2); /* 90 */
- void (GLAPIENTRYP Rectiv)(const GLint * v1, const GLint * v2); /* 91 */
- void (GLAPIENTRYP Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); /* 92 */
- void (GLAPIENTRYP Rectsv)(const GLshort * v1, const GLshort * v2); /* 93 */
- void (GLAPIENTRYP TexCoord1d)(GLdouble s); /* 94 */
- void (GLAPIENTRYP TexCoord1dv)(const GLdouble * v); /* 95 */
- void (GLAPIENTRYP TexCoord1f)(GLfloat s); /* 96 */
- void (GLAPIENTRYP TexCoord1fv)(const GLfloat * v); /* 97 */
- void (GLAPIENTRYP TexCoord1i)(GLint s); /* 98 */
- void (GLAPIENTRYP TexCoord1iv)(const GLint * v); /* 99 */
- void (GLAPIENTRYP TexCoord1s)(GLshort s); /* 100 */
- void (GLAPIENTRYP TexCoord1sv)(const GLshort * v); /* 101 */
- void (GLAPIENTRYP TexCoord2d)(GLdouble s, GLdouble t); /* 102 */
- void (GLAPIENTRYP TexCoord2dv)(const GLdouble * v); /* 103 */
- void (GLAPIENTRYP TexCoord2f)(GLfloat s, GLfloat t); /* 104 */
- void (GLAPIENTRYP TexCoord2fv)(const GLfloat * v); /* 105 */
- void (GLAPIENTRYP TexCoord2i)(GLint s, GLint t); /* 106 */
- void (GLAPIENTRYP TexCoord2iv)(const GLint * v); /* 107 */
- void (GLAPIENTRYP TexCoord2s)(GLshort s, GLshort t); /* 108 */
- void (GLAPIENTRYP TexCoord2sv)(const GLshort * v); /* 109 */
- void (GLAPIENTRYP TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); /* 110 */
- void (GLAPIENTRYP TexCoord3dv)(const GLdouble * v); /* 111 */
- void (GLAPIENTRYP TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); /* 112 */
- void (GLAPIENTRYP TexCoord3fv)(const GLfloat * v); /* 113 */
- void (GLAPIENTRYP TexCoord3i)(GLint s, GLint t, GLint r); /* 114 */
- void (GLAPIENTRYP TexCoord3iv)(const GLint * v); /* 115 */
- void (GLAPIENTRYP TexCoord3s)(GLshort s, GLshort t, GLshort r); /* 116 */
- void (GLAPIENTRYP TexCoord3sv)(const GLshort * v); /* 117 */
- void (GLAPIENTRYP TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 118 */
- void (GLAPIENTRYP TexCoord4dv)(const GLdouble * v); /* 119 */
- void (GLAPIENTRYP TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 120 */
- void (GLAPIENTRYP TexCoord4fv)(const GLfloat * v); /* 121 */
- void (GLAPIENTRYP TexCoord4i)(GLint s, GLint t, GLint r, GLint q); /* 122 */
- void (GLAPIENTRYP TexCoord4iv)(const GLint * v); /* 123 */
- void (GLAPIENTRYP TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); /* 124 */
- void (GLAPIENTRYP TexCoord4sv)(const GLshort * v); /* 125 */
- void (GLAPIENTRYP Vertex2d)(GLdouble x, GLdouble y); /* 126 */
- void (GLAPIENTRYP Vertex2dv)(const GLdouble * v); /* 127 */
- void (GLAPIENTRYP Vertex2f)(GLfloat x, GLfloat y); /* 128 */
- void (GLAPIENTRYP Vertex2fv)(const GLfloat * v); /* 129 */
- void (GLAPIENTRYP Vertex2i)(GLint x, GLint y); /* 130 */
- void (GLAPIENTRYP Vertex2iv)(const GLint * v); /* 131 */
- void (GLAPIENTRYP Vertex2s)(GLshort x, GLshort y); /* 132 */
- void (GLAPIENTRYP Vertex2sv)(const GLshort * v); /* 133 */
- void (GLAPIENTRYP Vertex3d)(GLdouble x, GLdouble y, GLdouble z); /* 134 */
- void (GLAPIENTRYP Vertex3dv)(const GLdouble * v); /* 135 */
- void (GLAPIENTRYP Vertex3f)(GLfloat x, GLfloat y, GLfloat z); /* 136 */
- void (GLAPIENTRYP Vertex3fv)(const GLfloat * v); /* 137 */
- void (GLAPIENTRYP Vertex3i)(GLint x, GLint y, GLint z); /* 138 */
- void (GLAPIENTRYP Vertex3iv)(const GLint * v); /* 139 */
- void (GLAPIENTRYP Vertex3s)(GLshort x, GLshort y, GLshort z); /* 140 */
- void (GLAPIENTRYP Vertex3sv)(const GLshort * v); /* 141 */
- void (GLAPIENTRYP Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 142 */
- void (GLAPIENTRYP Vertex4dv)(const GLdouble * v); /* 143 */
- void (GLAPIENTRYP Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 144 */
- void (GLAPIENTRYP Vertex4fv)(const GLfloat * v); /* 145 */
- void (GLAPIENTRYP Vertex4i)(GLint x, GLint y, GLint z, GLint w); /* 146 */
- void (GLAPIENTRYP Vertex4iv)(const GLint * v); /* 147 */
- void (GLAPIENTRYP Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 148 */
- void (GLAPIENTRYP Vertex4sv)(const GLshort * v); /* 149 */
- void (GLAPIENTRYP ClipPlane)(GLenum plane, const GLdouble * equation); /* 150 */
- void (GLAPIENTRYP ColorMaterial)(GLenum face, GLenum mode); /* 151 */
- void (GLAPIENTRYP CullFace)(GLenum mode); /* 152 */
- void (GLAPIENTRYP Fogf)(GLenum pname, GLfloat param); /* 153 */
- void (GLAPIENTRYP Fogfv)(GLenum pname, const GLfloat * params); /* 154 */
- void (GLAPIENTRYP Fogi)(GLenum pname, GLint param); /* 155 */
- void (GLAPIENTRYP Fogiv)(GLenum pname, const GLint * params); /* 156 */
- void (GLAPIENTRYP FrontFace)(GLenum mode); /* 157 */
- void (GLAPIENTRYP Hint)(GLenum target, GLenum mode); /* 158 */
- void (GLAPIENTRYP Lightf)(GLenum light, GLenum pname, GLfloat param); /* 159 */
- void (GLAPIENTRYP Lightfv)(GLenum light, GLenum pname, const GLfloat * params); /* 160 */
- void (GLAPIENTRYP Lighti)(GLenum light, GLenum pname, GLint param); /* 161 */
- void (GLAPIENTRYP Lightiv)(GLenum light, GLenum pname, const GLint * params); /* 162 */
- void (GLAPIENTRYP LightModelf)(GLenum pname, GLfloat param); /* 163 */
- void (GLAPIENTRYP LightModelfv)(GLenum pname, const GLfloat * params); /* 164 */
- void (GLAPIENTRYP LightModeli)(GLenum pname, GLint param); /* 165 */
- void (GLAPIENTRYP LightModeliv)(GLenum pname, const GLint * params); /* 166 */
- void (GLAPIENTRYP LineStipple)(GLint factor, GLushort pattern); /* 167 */
- void (GLAPIENTRYP LineWidth)(GLfloat width); /* 168 */
- void (GLAPIENTRYP Materialf)(GLenum face, GLenum pname, GLfloat param); /* 169 */
- void (GLAPIENTRYP Materialfv)(GLenum face, GLenum pname, const GLfloat * params); /* 170 */
- void (GLAPIENTRYP Materiali)(GLenum face, GLenum pname, GLint param); /* 171 */
- void (GLAPIENTRYP Materialiv)(GLenum face, GLenum pname, const GLint * params); /* 172 */
- void (GLAPIENTRYP PointSize)(GLfloat size); /* 173 */
- void (GLAPIENTRYP PolygonMode)(GLenum face, GLenum mode); /* 174 */
- void (GLAPIENTRYP PolygonStipple)(const GLubyte * mask); /* 175 */
- void (GLAPIENTRYP Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); /* 176 */
- void (GLAPIENTRYP ShadeModel)(GLenum mode); /* 177 */
- void (GLAPIENTRYP TexParameterf)(GLenum target, GLenum pname, GLfloat param); /* 178 */
- void (GLAPIENTRYP TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 179 */
- void (GLAPIENTRYP TexParameteri)(GLenum target, GLenum pname, GLint param); /* 180 */
- void (GLAPIENTRYP TexParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 181 */
- void (GLAPIENTRYP TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 182 */
- void (GLAPIENTRYP TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 183 */
- void (GLAPIENTRYP TexEnvf)(GLenum target, GLenum pname, GLfloat param); /* 184 */
- void (GLAPIENTRYP TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params); /* 185 */
- void (GLAPIENTRYP TexEnvi)(GLenum target, GLenum pname, GLint param); /* 186 */
- void (GLAPIENTRYP TexEnviv)(GLenum target, GLenum pname, const GLint * params); /* 187 */
- void (GLAPIENTRYP TexGend)(GLenum coord, GLenum pname, GLdouble param); /* 188 */
- void (GLAPIENTRYP TexGendv)(GLenum coord, GLenum pname, const GLdouble * params); /* 189 */
- void (GLAPIENTRYP TexGenf)(GLenum coord, GLenum pname, GLfloat param); /* 190 */
- void (GLAPIENTRYP TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params); /* 191 */
- void (GLAPIENTRYP TexGeni)(GLenum coord, GLenum pname, GLint param); /* 192 */
- void (GLAPIENTRYP TexGeniv)(GLenum coord, GLenum pname, const GLint * params); /* 193 */
- void (GLAPIENTRYP FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer); /* 194 */
- void (GLAPIENTRYP SelectBuffer)(GLsizei size, GLuint * buffer); /* 195 */
- GLint (GLAPIENTRYP RenderMode)(GLenum mode); /* 196 */
- void (GLAPIENTRYP InitNames)(void); /* 197 */
- void (GLAPIENTRYP LoadName)(GLuint name); /* 198 */
- void (GLAPIENTRYP PassThrough)(GLfloat token); /* 199 */
- void (GLAPIENTRYP PopName)(void); /* 200 */
- void (GLAPIENTRYP PushName)(GLuint name); /* 201 */
- void (GLAPIENTRYP DrawBuffer)(GLenum mode); /* 202 */
- void (GLAPIENTRYP Clear)(GLbitfield mask); /* 203 */
- void (GLAPIENTRYP ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 204 */
- void (GLAPIENTRYP ClearIndex)(GLfloat c); /* 205 */
- void (GLAPIENTRYP ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 206 */
- void (GLAPIENTRYP ClearStencil)(GLint s); /* 207 */
- void (GLAPIENTRYP ClearDepth)(GLclampd depth); /* 208 */
- void (GLAPIENTRYP StencilMask)(GLuint mask); /* 209 */
- void (GLAPIENTRYP ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); /* 210 */
- void (GLAPIENTRYP DepthMask)(GLboolean flag); /* 211 */
- void (GLAPIENTRYP IndexMask)(GLuint mask); /* 212 */
- void (GLAPIENTRYP Accum)(GLenum op, GLfloat value); /* 213 */
- void (GLAPIENTRYP Disable)(GLenum cap); /* 214 */
- void (GLAPIENTRYP Enable)(GLenum cap); /* 215 */
- void (GLAPIENTRYP Finish)(void); /* 216 */
- void (GLAPIENTRYP Flush)(void); /* 217 */
- void (GLAPIENTRYP PopAttrib)(void); /* 218 */
- void (GLAPIENTRYP PushAttrib)(GLbitfield mask); /* 219 */
- void (GLAPIENTRYP Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); /* 220 */
- void (GLAPIENTRYP Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); /* 221 */
- void (GLAPIENTRYP Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); /* 222 */
- void (GLAPIENTRYP Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); /* 223 */
- void (GLAPIENTRYP MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); /* 224 */
- void (GLAPIENTRYP MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); /* 225 */
- void (GLAPIENTRYP MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); /* 226 */
- void (GLAPIENTRYP MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); /* 227 */
- void (GLAPIENTRYP EvalCoord1d)(GLdouble u); /* 228 */
- void (GLAPIENTRYP EvalCoord1dv)(const GLdouble * u); /* 229 */
- void (GLAPIENTRYP EvalCoord1f)(GLfloat u); /* 230 */
- void (GLAPIENTRYP EvalCoord1fv)(const GLfloat * u); /* 231 */
- void (GLAPIENTRYP EvalCoord2d)(GLdouble u, GLdouble v); /* 232 */
- void (GLAPIENTRYP EvalCoord2dv)(const GLdouble * u); /* 233 */
- void (GLAPIENTRYP EvalCoord2f)(GLfloat u, GLfloat v); /* 234 */
- void (GLAPIENTRYP EvalCoord2fv)(const GLfloat * u); /* 235 */
- void (GLAPIENTRYP EvalMesh1)(GLenum mode, GLint i1, GLint i2); /* 236 */
- void (GLAPIENTRYP EvalPoint1)(GLint i); /* 237 */
- void (GLAPIENTRYP EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); /* 238 */
- void (GLAPIENTRYP EvalPoint2)(GLint i, GLint j); /* 239 */
- void (GLAPIENTRYP AlphaFunc)(GLenum func, GLclampf ref); /* 240 */
- void (GLAPIENTRYP BlendFunc)(GLenum sfactor, GLenum dfactor); /* 241 */
- void (GLAPIENTRYP LogicOp)(GLenum opcode); /* 242 */
- void (GLAPIENTRYP StencilFunc)(GLenum func, GLint ref, GLuint mask); /* 243 */
- void (GLAPIENTRYP StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); /* 244 */
- void (GLAPIENTRYP DepthFunc)(GLenum func); /* 245 */
- void (GLAPIENTRYP PixelZoom)(GLfloat xfactor, GLfloat yfactor); /* 246 */
- void (GLAPIENTRYP PixelTransferf)(GLenum pname, GLfloat param); /* 247 */
- void (GLAPIENTRYP PixelTransferi)(GLenum pname, GLint param); /* 248 */
- void (GLAPIENTRYP PixelStoref)(GLenum pname, GLfloat param); /* 249 */
- void (GLAPIENTRYP PixelStorei)(GLenum pname, GLint param); /* 250 */
- void (GLAPIENTRYP PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values); /* 251 */
- void (GLAPIENTRYP PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values); /* 252 */
- void (GLAPIENTRYP PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values); /* 253 */
- void (GLAPIENTRYP ReadBuffer)(GLenum mode); /* 254 */
- void (GLAPIENTRYP CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); /* 255 */
- void (GLAPIENTRYP ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels); /* 256 */
- void (GLAPIENTRYP DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 257 */
- void (GLAPIENTRYP GetBooleanv)(GLenum pname, GLboolean * params); /* 258 */
- void (GLAPIENTRYP GetClipPlane)(GLenum plane, GLdouble * equation); /* 259 */
- void (GLAPIENTRYP GetDoublev)(GLenum pname, GLdouble * params); /* 260 */
- GLenum (GLAPIENTRYP GetError)(void); /* 261 */
- void (GLAPIENTRYP GetFloatv)(GLenum pname, GLfloat * params); /* 262 */
- void (GLAPIENTRYP GetIntegerv)(GLenum pname, GLint * params); /* 263 */
- void (GLAPIENTRYP GetLightfv)(GLenum light, GLenum pname, GLfloat * params); /* 264 */
- void (GLAPIENTRYP GetLightiv)(GLenum light, GLenum pname, GLint * params); /* 265 */
- void (GLAPIENTRYP GetMapdv)(GLenum target, GLenum query, GLdouble * v); /* 266 */
- void (GLAPIENTRYP GetMapfv)(GLenum target, GLenum query, GLfloat * v); /* 267 */
- void (GLAPIENTRYP GetMapiv)(GLenum target, GLenum query, GLint * v); /* 268 */
- void (GLAPIENTRYP GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params); /* 269 */
- void (GLAPIENTRYP GetMaterialiv)(GLenum face, GLenum pname, GLint * params); /* 270 */
- void (GLAPIENTRYP GetPixelMapfv)(GLenum map, GLfloat * values); /* 271 */
- void (GLAPIENTRYP GetPixelMapuiv)(GLenum map, GLuint * values); /* 272 */
- void (GLAPIENTRYP GetPixelMapusv)(GLenum map, GLushort * values); /* 273 */
- void (GLAPIENTRYP GetPolygonStipple)(GLubyte * mask); /* 274 */
- const GLubyte * (GLAPIENTRYP GetString)(GLenum name); /* 275 */
- void (GLAPIENTRYP GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params); /* 276 */
- void (GLAPIENTRYP GetTexEnviv)(GLenum target, GLenum pname, GLint * params); /* 277 */
- void (GLAPIENTRYP GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params); /* 278 */
- void (GLAPIENTRYP GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params); /* 279 */
- void (GLAPIENTRYP GetTexGeniv)(GLenum coord, GLenum pname, GLint * params); /* 280 */
- void (GLAPIENTRYP GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels); /* 281 */
- void (GLAPIENTRYP GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 282 */
- void (GLAPIENTRYP GetTexParameteriv)(GLenum target, GLenum pname, GLint * params); /* 283 */
- void (GLAPIENTRYP GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params); /* 284 */
- void (GLAPIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); /* 285 */
- GLboolean (GLAPIENTRYP IsEnabled)(GLenum cap); /* 286 */
- GLboolean (GLAPIENTRYP IsList)(GLuint list); /* 287 */
- void (GLAPIENTRYP DepthRange)(GLclampd zNear, GLclampd zFar); /* 288 */
- void (GLAPIENTRYP Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 289 */
- void (GLAPIENTRYP LoadIdentity)(void); /* 290 */
- void (GLAPIENTRYP LoadMatrixf)(const GLfloat * m); /* 291 */
- void (GLAPIENTRYP LoadMatrixd)(const GLdouble * m); /* 292 */
- void (GLAPIENTRYP MatrixMode)(GLenum mode); /* 293 */
- void (GLAPIENTRYP MultMatrixf)(const GLfloat * m); /* 294 */
- void (GLAPIENTRYP MultMatrixd)(const GLdouble * m); /* 295 */
- void (GLAPIENTRYP Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 296 */
- void (GLAPIENTRYP PopMatrix)(void); /* 297 */
- void (GLAPIENTRYP PushMatrix)(void); /* 298 */
- void (GLAPIENTRYP Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); /* 299 */
- void (GLAPIENTRYP Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); /* 300 */
- void (GLAPIENTRYP Scaled)(GLdouble x, GLdouble y, GLdouble z); /* 301 */
- void (GLAPIENTRYP Scalef)(GLfloat x, GLfloat y, GLfloat z); /* 302 */
- void (GLAPIENTRYP Translated)(GLdouble x, GLdouble y, GLdouble z); /* 303 */
- void (GLAPIENTRYP Translatef)(GLfloat x, GLfloat y, GLfloat z); /* 304 */
- void (GLAPIENTRYP Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); /* 305 */
- void (GLAPIENTRYP ArrayElement)(GLint i); /* 306 */
- void (GLAPIENTRYP BindTexture)(GLenum target, GLuint texture); /* 307 */
- void (GLAPIENTRYP ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 308 */
- void (GLAPIENTRYP DisableClientState)(GLenum array); /* 309 */
- void (GLAPIENTRYP DrawArrays)(GLenum mode, GLint first, GLsizei count); /* 310 */
- void (GLAPIENTRYP DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); /* 311 */
- void (GLAPIENTRYP EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer); /* 312 */
- void (GLAPIENTRYP EnableClientState)(GLenum array); /* 313 */
- void (GLAPIENTRYP IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 314 */
- void (GLAPIENTRYP Indexub)(GLubyte c); /* 315 */
- void (GLAPIENTRYP Indexubv)(const GLubyte * c); /* 316 */
- void (GLAPIENTRYP InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer); /* 317 */
- void (GLAPIENTRYP NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 318 */
- void (GLAPIENTRYP PolygonOffset)(GLfloat factor, GLfloat units); /* 319 */
- void (GLAPIENTRYP TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 320 */
- void (GLAPIENTRYP VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 321 */
- GLboolean (GLAPIENTRYP AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 322 */
- void (GLAPIENTRYP CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); /* 323 */
- void (GLAPIENTRYP CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); /* 324 */
- void (GLAPIENTRYP CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); /* 325 */
- void (GLAPIENTRYP CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 326 */
- void (GLAPIENTRYP DeleteTextures)(GLsizei n, const GLuint * textures); /* 327 */
- void (GLAPIENTRYP GenTextures)(GLsizei n, GLuint * textures); /* 328 */
- void (GLAPIENTRYP GetPointerv)(GLenum pname, GLvoid ** params); /* 329 */
- GLboolean (GLAPIENTRYP IsTexture)(GLuint texture); /* 330 */
- void (GLAPIENTRYP PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities); /* 331 */
- void (GLAPIENTRYP TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels); /* 332 */
- void (GLAPIENTRYP TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 333 */
- void (GLAPIENTRYP PopClientAttrib)(void); /* 334 */
- void (GLAPIENTRYP PushClientAttrib)(GLbitfield mask); /* 335 */
- void (GLAPIENTRYP BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 336 */
- void (GLAPIENTRYP BlendEquation)(GLenum mode); /* 337 */
- void (GLAPIENTRYP DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); /* 338 */
- void (GLAPIENTRYP ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table); /* 339 */
- void (GLAPIENTRYP ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 340 */
- void (GLAPIENTRYP ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 341 */
- void (GLAPIENTRYP CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 342 */
- void (GLAPIENTRYP GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 343 */
- void (GLAPIENTRYP GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 344 */
- void (GLAPIENTRYP GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params); /* 345 */
- void (GLAPIENTRYP ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data); /* 346 */
- void (GLAPIENTRYP CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); /* 347 */
- void (GLAPIENTRYP ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image); /* 348 */
- void (GLAPIENTRYP ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image); /* 349 */
- void (GLAPIENTRYP ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params); /* 350 */
- void (GLAPIENTRYP ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 351 */
- void (GLAPIENTRYP ConvolutionParameteri)(GLenum target, GLenum pname, GLint params); /* 352 */
- void (GLAPIENTRYP ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 353 */
- void (GLAPIENTRYP CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 354 */
- void (GLAPIENTRYP CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); /* 355 */
- void (GLAPIENTRYP GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 356 */
- void (GLAPIENTRYP GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 357 */
- void (GLAPIENTRYP GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params); /* 358 */
- void (GLAPIENTRYP GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 359 */
- void (GLAPIENTRYP SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column); /* 360 */
- void (GLAPIENTRYP GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 361 */
- void (GLAPIENTRYP GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 362 */
- void (GLAPIENTRYP GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params); /* 363 */
- void (GLAPIENTRYP GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 364 */
- void (GLAPIENTRYP GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 365 */
- void (GLAPIENTRYP GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params); /* 366 */
- void (GLAPIENTRYP Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); /* 367 */
- void (GLAPIENTRYP Minmax)(GLenum target, GLenum internalformat, GLboolean sink); /* 368 */
- void (GLAPIENTRYP ResetHistogram)(GLenum target); /* 369 */
- void (GLAPIENTRYP ResetMinmax)(GLenum target); /* 370 */
- void (GLAPIENTRYP TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */
- void (GLAPIENTRYP TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels); /* 372 */
- void (GLAPIENTRYP CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 373 */
- void (GLAPIENTRYP ActiveTextureARB)(GLenum texture); /* 374 */
- void (GLAPIENTRYP ClientActiveTextureARB)(GLenum texture); /* 375 */
- void (GLAPIENTRYP MultiTexCoord1dARB)(GLenum target, GLdouble s); /* 376 */
- void (GLAPIENTRYP MultiTexCoord1dvARB)(GLenum target, const GLdouble * v); /* 377 */
- void (GLAPIENTRYP MultiTexCoord1fARB)(GLenum target, GLfloat s); /* 378 */
- void (GLAPIENTRYP MultiTexCoord1fvARB)(GLenum target, const GLfloat * v); /* 379 */
- void (GLAPIENTRYP MultiTexCoord1iARB)(GLenum target, GLint s); /* 380 */
- void (GLAPIENTRYP MultiTexCoord1ivARB)(GLenum target, const GLint * v); /* 381 */
- void (GLAPIENTRYP MultiTexCoord1sARB)(GLenum target, GLshort s); /* 382 */
- void (GLAPIENTRYP MultiTexCoord1svARB)(GLenum target, const GLshort * v); /* 383 */
- void (GLAPIENTRYP MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); /* 384 */
- void (GLAPIENTRYP MultiTexCoord2dvARB)(GLenum target, const GLdouble * v); /* 385 */
- void (GLAPIENTRYP MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); /* 386 */
- void (GLAPIENTRYP MultiTexCoord2fvARB)(GLenum target, const GLfloat * v); /* 387 */
- void (GLAPIENTRYP MultiTexCoord2iARB)(GLenum target, GLint s, GLint t); /* 388 */
- void (GLAPIENTRYP MultiTexCoord2ivARB)(GLenum target, const GLint * v); /* 389 */
- void (GLAPIENTRYP MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t); /* 390 */
- void (GLAPIENTRYP MultiTexCoord2svARB)(GLenum target, const GLshort * v); /* 391 */
- void (GLAPIENTRYP MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r); /* 392 */
- void (GLAPIENTRYP MultiTexCoord3dvARB)(GLenum target, const GLdouble * v); /* 393 */
- void (GLAPIENTRYP MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r); /* 394 */
- void (GLAPIENTRYP MultiTexCoord3fvARB)(GLenum target, const GLfloat * v); /* 395 */
- void (GLAPIENTRYP MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r); /* 396 */
- void (GLAPIENTRYP MultiTexCoord3ivARB)(GLenum target, const GLint * v); /* 397 */
- void (GLAPIENTRYP MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r); /* 398 */
- void (GLAPIENTRYP MultiTexCoord3svARB)(GLenum target, const GLshort * v); /* 399 */
- void (GLAPIENTRYP MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 400 */
- void (GLAPIENTRYP MultiTexCoord4dvARB)(GLenum target, const GLdouble * v); /* 401 */
- void (GLAPIENTRYP MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 402 */
- void (GLAPIENTRYP MultiTexCoord4fvARB)(GLenum target, const GLfloat * v); /* 403 */
- void (GLAPIENTRYP MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q); /* 404 */
- void (GLAPIENTRYP MultiTexCoord4ivARB)(GLenum target, const GLint * v); /* 405 */
- void (GLAPIENTRYP MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); /* 406 */
- void (GLAPIENTRYP MultiTexCoord4svARB)(GLenum target, const GLshort * v); /* 407 */
- void (GLAPIENTRYP AttachShader)(GLuint program, GLuint shader); /* 408 */
- GLuint (GLAPIENTRYP CreateProgram)(void); /* 409 */
- GLuint (GLAPIENTRYP CreateShader)(GLenum type); /* 410 */
- void (GLAPIENTRYP DeleteProgram)(GLuint program); /* 411 */
- void (GLAPIENTRYP DeleteShader)(GLuint program); /* 412 */
- void (GLAPIENTRYP DetachShader)(GLuint program, GLuint shader); /* 413 */
- void (GLAPIENTRYP GetAttachedShaders)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * obj); /* 414 */
- void (GLAPIENTRYP GetProgramInfoLog)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog); /* 415 */
- void (GLAPIENTRYP GetProgramiv)(GLuint program, GLenum pname, GLint * params); /* 416 */
- void (GLAPIENTRYP GetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog); /* 417 */
- void (GLAPIENTRYP GetShaderiv)(GLuint shader, GLenum pname, GLint * params); /* 418 */
- GLboolean (GLAPIENTRYP IsProgram)(GLuint program); /* 419 */
- GLboolean (GLAPIENTRYP IsShader)(GLuint shader); /* 420 */
- void (GLAPIENTRYP StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); /* 421 */
- void (GLAPIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); /* 422 */
- void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); /* 423 */
- void (GLAPIENTRYP UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 424 */
- void (GLAPIENTRYP UniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 425 */
- void (GLAPIENTRYP UniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 426 */
- void (GLAPIENTRYP UniformMatrix3x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 427 */
- void (GLAPIENTRYP UniformMatrix4x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 428 */
- void (GLAPIENTRYP UniformMatrix4x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 429 */
- void (GLAPIENTRYP ClampColor)(GLenum target, GLenum clamp); /* 430 */
- void (GLAPIENTRYP ClearBufferfi)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); /* 431 */
- void (GLAPIENTRYP ClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat * value); /* 432 */
- void (GLAPIENTRYP ClearBufferiv)(GLenum buffer, GLint drawbuffer, const GLint * value); /* 433 */
- void (GLAPIENTRYP ClearBufferuiv)(GLenum buffer, GLint drawbuffer, const GLuint * value); /* 434 */
- const GLubyte * (GLAPIENTRYP GetStringi)(GLenum name, GLuint index); /* 435 */
- void (GLAPIENTRYP TexBuffer)(GLenum target, GLenum internalFormat, GLuint buffer); /* 436 */
- void (GLAPIENTRYP FramebufferTexture)(GLenum target, GLenum attachment, GLuint texture, GLint level); /* 437 */
- void (GLAPIENTRYP GetBufferParameteri64v)(GLenum target, GLenum pname, GLint64 * params); /* 438 */
- void (GLAPIENTRYP GetInteger64i_v)(GLenum cap, GLuint index, GLint64 * data); /* 439 */
- void (GLAPIENTRYP VertexAttribDivisor)(GLuint index, GLuint divisor); /* 440 */
- void (GLAPIENTRYP LoadTransposeMatrixdARB)(const GLdouble * m); /* 441 */
- void (GLAPIENTRYP LoadTransposeMatrixfARB)(const GLfloat * m); /* 442 */
- void (GLAPIENTRYP MultTransposeMatrixdARB)(const GLdouble * m); /* 443 */
- void (GLAPIENTRYP MultTransposeMatrixfARB)(const GLfloat * m); /* 444 */
- void (GLAPIENTRYP SampleCoverageARB)(GLclampf value, GLboolean invert); /* 445 */
- void (GLAPIENTRYP CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 446 */
- void (GLAPIENTRYP CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 447 */
- void (GLAPIENTRYP CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 448 */
- void (GLAPIENTRYP CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 449 */
- void (GLAPIENTRYP CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 450 */
- void (GLAPIENTRYP CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 451 */
- void (GLAPIENTRYP GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img); /* 452 */
- void (GLAPIENTRYP DisableVertexAttribArrayARB)(GLuint index); /* 453 */
- void (GLAPIENTRYP EnableVertexAttribArrayARB)(GLuint index); /* 454 */
- void (GLAPIENTRYP GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 455 */
- void (GLAPIENTRYP GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 456 */
- void (GLAPIENTRYP GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 457 */
- void (GLAPIENTRYP GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 458 */
- void (GLAPIENTRYP GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string); /* 459 */
- void (GLAPIENTRYP GetProgramivARB)(GLenum target, GLenum pname, GLint * params); /* 460 */
- void (GLAPIENTRYP GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble * params); /* 461 */
- void (GLAPIENTRYP GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat * params); /* 462 */
- void (GLAPIENTRYP GetVertexAttribivARB)(GLuint index, GLenum pname, GLint * params); /* 463 */
- void (GLAPIENTRYP ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 464 */
- void (GLAPIENTRYP ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 465 */
- void (GLAPIENTRYP ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 466 */
- void (GLAPIENTRYP ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 467 */
- void (GLAPIENTRYP ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 468 */
- void (GLAPIENTRYP ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 469 */
- void (GLAPIENTRYP ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 470 */
- void (GLAPIENTRYP ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 471 */
- void (GLAPIENTRYP ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string); /* 472 */
- void (GLAPIENTRYP VertexAttrib1dARB)(GLuint index, GLdouble x); /* 473 */
- void (GLAPIENTRYP VertexAttrib1dvARB)(GLuint index, const GLdouble * v); /* 474 */
- void (GLAPIENTRYP VertexAttrib1fARB)(GLuint index, GLfloat x); /* 475 */
- void (GLAPIENTRYP VertexAttrib1fvARB)(GLuint index, const GLfloat * v); /* 476 */
- void (GLAPIENTRYP VertexAttrib1sARB)(GLuint index, GLshort x); /* 477 */
- void (GLAPIENTRYP VertexAttrib1svARB)(GLuint index, const GLshort * v); /* 478 */
- void (GLAPIENTRYP VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y); /* 479 */
- void (GLAPIENTRYP VertexAttrib2dvARB)(GLuint index, const GLdouble * v); /* 480 */
- void (GLAPIENTRYP VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y); /* 481 */
- void (GLAPIENTRYP VertexAttrib2fvARB)(GLuint index, const GLfloat * v); /* 482 */
- void (GLAPIENTRYP VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y); /* 483 */
- void (GLAPIENTRYP VertexAttrib2svARB)(GLuint index, const GLshort * v); /* 484 */
- void (GLAPIENTRYP VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 485 */
- void (GLAPIENTRYP VertexAttrib3dvARB)(GLuint index, const GLdouble * v); /* 486 */
- void (GLAPIENTRYP VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 487 */
- void (GLAPIENTRYP VertexAttrib3fvARB)(GLuint index, const GLfloat * v); /* 488 */
- void (GLAPIENTRYP VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z); /* 489 */
- void (GLAPIENTRYP VertexAttrib3svARB)(GLuint index, const GLshort * v); /* 490 */
- void (GLAPIENTRYP VertexAttrib4NbvARB)(GLuint index, const GLbyte * v); /* 491 */
- void (GLAPIENTRYP VertexAttrib4NivARB)(GLuint index, const GLint * v); /* 492 */
- void (GLAPIENTRYP VertexAttrib4NsvARB)(GLuint index, const GLshort * v); /* 493 */
- void (GLAPIENTRYP VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 494 */
- void (GLAPIENTRYP VertexAttrib4NubvARB)(GLuint index, const GLubyte * v); /* 495 */
- void (GLAPIENTRYP VertexAttrib4NuivARB)(GLuint index, const GLuint * v); /* 496 */
- void (GLAPIENTRYP VertexAttrib4NusvARB)(GLuint index, const GLushort * v); /* 497 */
- void (GLAPIENTRYP VertexAttrib4bvARB)(GLuint index, const GLbyte * v); /* 498 */
- void (GLAPIENTRYP VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 499 */
- void (GLAPIENTRYP VertexAttrib4dvARB)(GLuint index, const GLdouble * v); /* 500 */
- void (GLAPIENTRYP VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 501 */
- void (GLAPIENTRYP VertexAttrib4fvARB)(GLuint index, const GLfloat * v); /* 502 */
- void (GLAPIENTRYP VertexAttrib4ivARB)(GLuint index, const GLint * v); /* 503 */
- void (GLAPIENTRYP VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 504 */
- void (GLAPIENTRYP VertexAttrib4svARB)(GLuint index, const GLshort * v); /* 505 */
- void (GLAPIENTRYP VertexAttrib4ubvARB)(GLuint index, const GLubyte * v); /* 506 */
- void (GLAPIENTRYP VertexAttrib4uivARB)(GLuint index, const GLuint * v); /* 507 */
- void (GLAPIENTRYP VertexAttrib4usvARB)(GLuint index, const GLushort * v); /* 508 */
- void (GLAPIENTRYP VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); /* 509 */
- void (GLAPIENTRYP BindBufferARB)(GLenum target, GLuint buffer); /* 510 */
- void (GLAPIENTRYP BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); /* 511 */
- void (GLAPIENTRYP BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); /* 512 */
- void (GLAPIENTRYP DeleteBuffersARB)(GLsizei n, const GLuint * buffer); /* 513 */
- void (GLAPIENTRYP GenBuffersARB)(GLsizei n, GLuint * buffer); /* 514 */
- void (GLAPIENTRYP GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params); /* 515 */
- void (GLAPIENTRYP GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params); /* 516 */
- void (GLAPIENTRYP GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data); /* 517 */
- GLboolean (GLAPIENTRYP IsBufferARB)(GLuint buffer); /* 518 */
- GLvoid * (GLAPIENTRYP MapBufferARB)(GLenum target, GLenum access); /* 519 */
- GLboolean (GLAPIENTRYP UnmapBufferARB)(GLenum target); /* 520 */
- void (GLAPIENTRYP BeginQueryARB)(GLenum target, GLuint id); /* 521 */
- void (GLAPIENTRYP DeleteQueriesARB)(GLsizei n, const GLuint * ids); /* 522 */
- void (GLAPIENTRYP EndQueryARB)(GLenum target); /* 523 */
- void (GLAPIENTRYP GenQueriesARB)(GLsizei n, GLuint * ids); /* 524 */
- void (GLAPIENTRYP GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params); /* 525 */
- void (GLAPIENTRYP GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params); /* 526 */
- void (GLAPIENTRYP GetQueryivARB)(GLenum target, GLenum pname, GLint * params); /* 527 */
- GLboolean (GLAPIENTRYP IsQueryARB)(GLuint id); /* 528 */
- void (GLAPIENTRYP AttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj); /* 529 */
- void (GLAPIENTRYP CompileShaderARB)(GLhandleARB shader); /* 530 */
- GLhandleARB (GLAPIENTRYP CreateProgramObjectARB)(void); /* 531 */
- GLhandleARB (GLAPIENTRYP CreateShaderObjectARB)(GLenum shaderType); /* 532 */
- void (GLAPIENTRYP DeleteObjectARB)(GLhandleARB obj); /* 533 */
- void (GLAPIENTRYP DetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj); /* 534 */
- void (GLAPIENTRYP GetActiveUniformARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 535 */
- void (GLAPIENTRYP GetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxLength, GLsizei * length, GLhandleARB * infoLog); /* 536 */
- GLhandleARB (GLAPIENTRYP GetHandleARB)(GLenum pname); /* 537 */
- void (GLAPIENTRYP GetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog); /* 538 */
- void (GLAPIENTRYP GetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat * params); /* 539 */
- void (GLAPIENTRYP GetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint * params); /* 540 */
- void (GLAPIENTRYP GetShaderSourceARB)(GLhandleARB shader, GLsizei bufSize, GLsizei * length, GLcharARB * source); /* 541 */
- GLint (GLAPIENTRYP GetUniformLocationARB)(GLhandleARB program, const GLcharARB * name); /* 542 */
- void (GLAPIENTRYP GetUniformfvARB)(GLhandleARB program, GLint location, GLfloat * params); /* 543 */
- void (GLAPIENTRYP GetUniformivARB)(GLhandleARB program, GLint location, GLint * params); /* 544 */
- void (GLAPIENTRYP LinkProgramARB)(GLhandleARB program); /* 545 */
- void (GLAPIENTRYP ShaderSourceARB)(GLhandleARB shader, GLsizei count, const GLcharARB ** string, const GLint * length); /* 546 */
- void (GLAPIENTRYP Uniform1fARB)(GLint location, GLfloat v0); /* 547 */
- void (GLAPIENTRYP Uniform1fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 548 */
- void (GLAPIENTRYP Uniform1iARB)(GLint location, GLint v0); /* 549 */
- void (GLAPIENTRYP Uniform1ivARB)(GLint location, GLsizei count, const GLint * value); /* 550 */
- void (GLAPIENTRYP Uniform2fARB)(GLint location, GLfloat v0, GLfloat v1); /* 551 */
- void (GLAPIENTRYP Uniform2fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 552 */
- void (GLAPIENTRYP Uniform2iARB)(GLint location, GLint v0, GLint v1); /* 553 */
- void (GLAPIENTRYP Uniform2ivARB)(GLint location, GLsizei count, const GLint * value); /* 554 */
- void (GLAPIENTRYP Uniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); /* 555 */
- void (GLAPIENTRYP Uniform3fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 556 */
- void (GLAPIENTRYP Uniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2); /* 557 */
- void (GLAPIENTRYP Uniform3ivARB)(GLint location, GLsizei count, const GLint * value); /* 558 */
- void (GLAPIENTRYP Uniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); /* 559 */
- void (GLAPIENTRYP Uniform4fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 560 */
- void (GLAPIENTRYP Uniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); /* 561 */
- void (GLAPIENTRYP Uniform4ivARB)(GLint location, GLsizei count, const GLint * value); /* 562 */
- void (GLAPIENTRYP UniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 563 */
- void (GLAPIENTRYP UniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 564 */
- void (GLAPIENTRYP UniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 565 */
- void (GLAPIENTRYP UseProgramObjectARB)(GLhandleARB program); /* 566 */
- void (GLAPIENTRYP ValidateProgramARB)(GLhandleARB program); /* 567 */
- void (GLAPIENTRYP BindAttribLocationARB)(GLhandleARB program, GLuint index, const GLcharARB * name); /* 568 */
- void (GLAPIENTRYP GetActiveAttribARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 569 */
- GLint (GLAPIENTRYP GetAttribLocationARB)(GLhandleARB program, const GLcharARB * name); /* 570 */
- void (GLAPIENTRYP DrawBuffersARB)(GLsizei n, const GLenum * bufs); /* 571 */
- void (GLAPIENTRYP ClampColorARB)(GLenum target, GLenum clamp); /* 572 */
- void (GLAPIENTRYP DrawArraysInstancedARB)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); /* 573 */
- void (GLAPIENTRYP DrawElementsInstancedARB)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei primcount); /* 574 */
- void (GLAPIENTRYP RenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); /* 575 */
- void (GLAPIENTRYP FramebufferTextureARB)(GLenum target, GLenum attachment, GLuint texture, GLint level); /* 576 */
- void (GLAPIENTRYP FramebufferTextureFaceARB)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); /* 577 */
- void (GLAPIENTRYP ProgramParameteriARB)(GLuint program, GLenum pname, GLint value); /* 578 */
- void (GLAPIENTRYP VertexAttribDivisorARB)(GLuint index, GLuint divisor); /* 579 */
- void (GLAPIENTRYP FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length); /* 580 */
- GLvoid * (GLAPIENTRYP MapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); /* 581 */
- void (GLAPIENTRYP TexBufferARB)(GLenum target, GLenum internalFormat, GLuint buffer); /* 582 */
- void (GLAPIENTRYP BindVertexArray)(GLuint array); /* 583 */
- void (GLAPIENTRYP GenVertexArrays)(GLsizei n, GLuint * arrays); /* 584 */
- void (GLAPIENTRYP CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); /* 585 */
- GLenum (GLAPIENTRYP ClientWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); /* 586 */
- void (GLAPIENTRYP DeleteSync)(GLsync sync); /* 587 */
- GLsync (GLAPIENTRYP FenceSync)(GLenum condition, GLbitfield flags); /* 588 */
- void (GLAPIENTRYP GetInteger64v)(GLenum pname, GLint64 * params); /* 589 */
- void (GLAPIENTRYP GetSynciv)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values); /* 590 */
- GLboolean (GLAPIENTRYP IsSync)(GLsync sync); /* 591 */
- void (GLAPIENTRYP WaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); /* 592 */
- void (GLAPIENTRYP DrawElementsBaseVertex)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); /* 593 */
- void (GLAPIENTRYP DrawElementsInstancedBaseVertex)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei primcount, GLint basevertex); /* 594 */
- void (GLAPIENTRYP DrawRangeElementsBaseVertex)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); /* 595 */
- void (GLAPIENTRYP MultiDrawElementsBaseVertex)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount, const GLint * basevertex); /* 596 */
- void (GLAPIENTRYP BlendEquationSeparateiARB)(GLuint buf, GLenum modeRGB, GLenum modeA); /* 597 */
- void (GLAPIENTRYP BlendEquationiARB)(GLuint buf, GLenum mode); /* 598 */
- void (GLAPIENTRYP BlendFuncSeparateiARB)(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcA, GLenum dstA); /* 599 */
- void (GLAPIENTRYP BlendFunciARB)(GLuint buf, GLenum src, GLenum dst); /* 600 */
- void (GLAPIENTRYP BindSampler)(GLuint unit, GLuint sampler); /* 601 */
- void (GLAPIENTRYP DeleteSamplers)(GLsizei count, const GLuint * samplers); /* 602 */
- void (GLAPIENTRYP GenSamplers)(GLsizei count, GLuint * samplers); /* 603 */
- void (GLAPIENTRYP GetSamplerParameterIiv)(GLuint sampler, GLenum pname, GLint * params); /* 604 */
- void (GLAPIENTRYP GetSamplerParameterIuiv)(GLuint sampler, GLenum pname, GLuint * params); /* 605 */
- void (GLAPIENTRYP GetSamplerParameterfv)(GLuint sampler, GLenum pname, GLfloat * params); /* 606 */
- void (GLAPIENTRYP GetSamplerParameteriv)(GLuint sampler, GLenum pname, GLint * params); /* 607 */
- GLboolean (GLAPIENTRYP IsSampler)(GLuint sampler); /* 608 */
- void (GLAPIENTRYP SamplerParameterIiv)(GLuint sampler, GLenum pname, const GLint * params); /* 609 */
- void (GLAPIENTRYP SamplerParameterIuiv)(GLuint sampler, GLenum pname, const GLuint * params); /* 610 */
- void (GLAPIENTRYP SamplerParameterf)(GLuint sampler, GLenum pname, GLfloat param); /* 611 */
- void (GLAPIENTRYP SamplerParameterfv)(GLuint sampler, GLenum pname, const GLfloat * params); /* 612 */
- void (GLAPIENTRYP SamplerParameteri)(GLuint sampler, GLenum pname, GLint param); /* 613 */
- void (GLAPIENTRYP SamplerParameteriv)(GLuint sampler, GLenum pname, const GLint * params); /* 614 */
- void (GLAPIENTRYP ColorP3ui)(GLenum type, GLuint color); /* 615 */
- void (GLAPIENTRYP ColorP3uiv)(GLenum type, const GLuint * color); /* 616 */
- void (GLAPIENTRYP ColorP4ui)(GLenum type, GLuint color); /* 617 */
- void (GLAPIENTRYP ColorP4uiv)(GLenum type, const GLuint * color); /* 618 */
- void (GLAPIENTRYP MultiTexCoordP1ui)(GLenum texture, GLenum type, GLuint coords); /* 619 */
- void (GLAPIENTRYP MultiTexCoordP1uiv)(GLenum texture, GLenum type, const GLuint * coords); /* 620 */
- void (GLAPIENTRYP MultiTexCoordP2ui)(GLenum texture, GLenum type, GLuint coords); /* 621 */
- void (GLAPIENTRYP MultiTexCoordP2uiv)(GLenum texture, GLenum type, const GLuint * coords); /* 622 */
- void (GLAPIENTRYP MultiTexCoordP3ui)(GLenum texture, GLenum type, GLuint coords); /* 623 */
- void (GLAPIENTRYP MultiTexCoordP3uiv)(GLenum texture, GLenum type, const GLuint * coords); /* 624 */
- void (GLAPIENTRYP MultiTexCoordP4ui)(GLenum texture, GLenum type, GLuint coords); /* 625 */
- void (GLAPIENTRYP MultiTexCoordP4uiv)(GLenum texture, GLenum type, const GLuint * coords); /* 626 */
- void (GLAPIENTRYP NormalP3ui)(GLenum type, GLuint coords); /* 627 */
- void (GLAPIENTRYP NormalP3uiv)(GLenum type, const GLuint * coords); /* 628 */
- void (GLAPIENTRYP SecondaryColorP3ui)(GLenum type, GLuint color); /* 629 */
- void (GLAPIENTRYP SecondaryColorP3uiv)(GLenum type, const GLuint * color); /* 630 */
- void (GLAPIENTRYP TexCoordP1ui)(GLenum type, GLuint coords); /* 631 */
- void (GLAPIENTRYP TexCoordP1uiv)(GLenum type, const GLuint * coords); /* 632 */
- void (GLAPIENTRYP TexCoordP2ui)(GLenum type, GLuint coords); /* 633 */
- void (GLAPIENTRYP TexCoordP2uiv)(GLenum type, const GLuint * coords); /* 634 */
- void (GLAPIENTRYP TexCoordP3ui)(GLenum type, GLuint coords); /* 635 */
- void (GLAPIENTRYP TexCoordP3uiv)(GLenum type, const GLuint * coords); /* 636 */
- void (GLAPIENTRYP TexCoordP4ui)(GLenum type, GLuint coords); /* 637 */
- void (GLAPIENTRYP TexCoordP4uiv)(GLenum type, const GLuint * coords); /* 638 */
- void (GLAPIENTRYP VertexAttribP1ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); /* 639 */
- void (GLAPIENTRYP VertexAttribP1uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); /* 640 */
- void (GLAPIENTRYP VertexAttribP2ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); /* 641 */
- void (GLAPIENTRYP VertexAttribP2uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); /* 642 */
- void (GLAPIENTRYP VertexAttribP3ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); /* 643 */
- void (GLAPIENTRYP VertexAttribP3uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); /* 644 */
- void (GLAPIENTRYP VertexAttribP4ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); /* 645 */
- void (GLAPIENTRYP VertexAttribP4uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); /* 646 */
- void (GLAPIENTRYP VertexP2ui)(GLenum type, GLuint value); /* 647 */
- void (GLAPIENTRYP VertexP2uiv)(GLenum type, const GLuint * value); /* 648 */
- void (GLAPIENTRYP VertexP3ui)(GLenum type, GLuint value); /* 649 */
- void (GLAPIENTRYP VertexP3uiv)(GLenum type, const GLuint * value); /* 650 */
- void (GLAPIENTRYP VertexP4ui)(GLenum type, GLuint value); /* 651 */
- void (GLAPIENTRYP VertexP4uiv)(GLenum type, const GLuint * value); /* 652 */
- void (GLAPIENTRYP BindTransformFeedback)(GLenum target, GLuint id); /* 653 */
- void (GLAPIENTRYP DeleteTransformFeedbacks)(GLsizei n, const GLuint * ids); /* 654 */
- void (GLAPIENTRYP DrawTransformFeedback)(GLenum mode, GLuint id); /* 655 */
- void (GLAPIENTRYP GenTransformFeedbacks)(GLsizei n, GLuint * ids); /* 656 */
- GLboolean (GLAPIENTRYP IsTransformFeedback)(GLuint id); /* 657 */
- void (GLAPIENTRYP PauseTransformFeedback)(void); /* 658 */
- void (GLAPIENTRYP ResumeTransformFeedback)(void); /* 659 */
- void (GLAPIENTRYP ClearDepthf)(GLclampf depth); /* 660 */
- void (GLAPIENTRYP DepthRangef)(GLclampf zNear, GLclampf zFar); /* 661 */
- void (GLAPIENTRYP GetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision); /* 662 */
- void (GLAPIENTRYP ReleaseShaderCompiler)(void); /* 663 */
- void (GLAPIENTRYP ShaderBinary)(GLsizei n, const GLuint * shaders, GLenum binaryformat, const GLvoid * binary, GLsizei length); /* 664 */
- void (GLAPIENTRYP DebugMessageCallbackARB)(GLDEBUGPROCARB callback, GLvoid * userParam); /* 665 */
- void (GLAPIENTRYP DebugMessageControlARB)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled); /* 666 */
- void (GLAPIENTRYP DebugMessageInsertARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLcharARB * buf); /* 667 */
- GLuint (GLAPIENTRYP GetDebugMessageLogARB)(GLuint count, GLsizei bufsize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLcharARB * messageLog); /* 668 */
- GLenum (GLAPIENTRYP GetGraphicsResetStatusARB)(void); /* 669 */
- void (GLAPIENTRYP GetnColorTableARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * table); /* 670 */
- void (GLAPIENTRYP GetnCompressedTexImageARB)(GLenum target, GLint lod, GLsizei bufSize, GLvoid * img); /* 671 */
- void (GLAPIENTRYP GetnConvolutionFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * image); /* 672 */
- void (GLAPIENTRYP GetnHistogramARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values); /* 673 */
- void (GLAPIENTRYP GetnMapdvARB)(GLenum target, GLenum query, GLsizei bufSize, GLdouble * v); /* 674 */
- void (GLAPIENTRYP GetnMapfvARB)(GLenum target, GLenum query, GLsizei bufSize, GLfloat * v); /* 675 */
- void (GLAPIENTRYP GetnMapivARB)(GLenum target, GLenum query, GLsizei bufSize, GLint * v); /* 676 */
- void (GLAPIENTRYP GetnMinmaxARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values); /* 677 */
- void (GLAPIENTRYP GetnPixelMapfvARB)(GLenum map, GLsizei bufSize, GLfloat * values); /* 678 */
- void (GLAPIENTRYP GetnPixelMapuivARB)(GLenum map, GLsizei bufSize, GLuint * values); /* 679 */
- void (GLAPIENTRYP GetnPixelMapusvARB)(GLenum map, GLsizei bufSize, GLushort * values); /* 680 */
- void (GLAPIENTRYP GetnPolygonStippleARB)(GLsizei bufSize, GLubyte * pattern); /* 681 */
- void (GLAPIENTRYP GetnSeparableFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid * row, GLsizei columnBufSize, GLvoid * column, GLvoid * span); /* 682 */
- void (GLAPIENTRYP GetnTexImageARB)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid * img); /* 683 */
- void (GLAPIENTRYP GetnUniformdvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLdouble * params); /* 684 */
- void (GLAPIENTRYP GetnUniformfvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLfloat * params); /* 685 */
- void (GLAPIENTRYP GetnUniformivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLint * params); /* 686 */
- void (GLAPIENTRYP GetnUniformuivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLuint * params); /* 687 */
- void (GLAPIENTRYP ReadnPixelsARB)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid * data); /* 688 */
- void (GLAPIENTRYP TexStorage1D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width); /* 689 */
- void (GLAPIENTRYP TexStorage2D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height); /* 690 */
- void (GLAPIENTRYP TexStorage3D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth); /* 691 */
- void (GLAPIENTRYP TextureStorage1DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width); /* 692 */
- void (GLAPIENTRYP TextureStorage2DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height); /* 693 */
- void (GLAPIENTRYP TextureStorage3DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth); /* 694 */
- void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 695 */
- void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 696 */
- void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 697 */
- void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 698 */
- void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 699 */
- void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 700 */
- void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 701 */
- void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 702 */
- void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 703 */
- void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 704 */
- void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 705 */
- void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 706 */
- void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 707 */
- void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 708 */
- void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 709 */
- void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 710 */
- void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 711 */
- void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 712 */
- void (GLAPIENTRYP UnlockArraysEXT)(void); /* 713 */
- void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 714 */
- void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 715 */
- void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 716 */
- void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 717 */
- void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 718 */
- void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 719 */
- void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 720 */
- void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 721 */
- void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 722 */
- void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 723 */
- void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 724 */
- void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 725 */
- void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 726 */
- void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 727 */
- void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 728 */
- void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 729 */
- void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 730 */
- void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 731 */
- void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 732 */
- void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 733 */
- void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 734 */
- void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 735 */
- void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 736 */
- void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 737 */
- void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 738 */
- void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 739 */
- void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 740 */
- void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 741 */
- void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 742 */
- void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 743 */
- void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 744 */
- void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 745 */
- void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 746 */
- void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 747 */
- void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 748 */
- void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 749 */
- void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 750 */
- void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 751 */
- void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 752 */
- void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 753 */
- void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 754 */
- void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 755 */
- void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 756 */
- void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 757 */
- void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 758 */
- void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 759 */
- void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 760 */
- void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 761 */
- void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 762 */
- void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 763 */
- void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 764 */
- void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 765 */
- void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 766 */
- void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 767 */
- void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 768 */
- void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 769 */
- void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 770 */
- void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 771 */
- void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 772 */
- void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 773 */
- void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 774 */
- void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 775 */
- void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 776 */
- void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 777 */
- void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 778 */
- void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 779 */
- void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 780 */
- void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 781 */
- void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 782 */
- void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 783 */
- void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 784 */
- void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 785 */
- GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 786 */
- void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 787 */
- GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 788 */
- GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 789 */
- void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 790 */
- void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 791 */
- void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 792 */
- void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 793 */
- void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 794 */
- void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 795 */
- void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 796 */
- void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 797 */
- void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 798 */
- void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 799 */
- void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 800 */
- void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 801 */
- void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 802 */
- GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 803 */
- void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 804 */
- void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLsizei num, const GLdouble * params); /* 805 */
- void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLsizei num, const GLfloat * params); /* 806 */
- void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 807 */
- void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 808 */
- void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 809 */
- void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 810 */
- void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 811 */
- void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 812 */
- void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 813 */
- void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 814 */
- void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 815 */
- void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 816 */
- void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 817 */
- void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 818 */
- void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 819 */
- void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 820 */
- void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 821 */
- void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 822 */
- void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 823 */
- void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 824 */
- void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 825 */
- void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 826 */
- void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 827 */
- void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 828 */
- void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 829 */
- void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 830 */
- void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 831 */
- void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 832 */
- void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 833 */
- void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 834 */
- void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 835 */
- void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 836 */
- void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 837 */
- void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 838 */
- void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 839 */
- void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 840 */
- void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 841 */
- void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 842 */
- void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 843 */
- void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 844 */
- void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 845 */
- void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 846 */
- void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 847 */
- void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 848 */
- void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 849 */
- void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 850 */
- void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 851 */
- void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 852 */
- void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 853 */
- void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 854 */
- void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 855 */
- void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 856 */
- void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 857 */
- void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 858 */
- void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 859 */
- void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 860 */
- void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 861 */
- void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 862 */
- GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 863 */
- void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 864 */
- void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 865 */
- void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 866 */
- void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 867 */
- void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 868 */
- void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 869 */
- void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 870 */
- void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 871 */
- void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 872 */
- GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 873 */
- void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 874 */
- void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 875 */
- void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 876 */
- void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 877 */
- void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 878 */
- void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 879 */
- void (GLAPIENTRYP PrimitiveRestartIndexNV)(GLuint index); /* 880 */
- void (GLAPIENTRYP PrimitiveRestartNV)(void); /* 881 */
- void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 882 */
- void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 883 */
- void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 884 */
- void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 885 */
- GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 886 */
- void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 887 */
- void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 888 */
- void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 889 */
- void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 890 */
- void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 891 */
- void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 892 */
- void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 893 */
- void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 894 */
- void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 895 */
- void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 896 */
- void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 897 */
- GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 898 */
- GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 899 */
- void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 900 */
- void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 901 */
- void (GLAPIENTRYP BufferParameteriAPPLE)(GLenum target, GLenum pname, GLint param); /* 902 */
- void (GLAPIENTRYP FlushMappedBufferRangeAPPLE)(GLenum target, GLintptr offset, GLsizeiptr size); /* 903 */
- void (GLAPIENTRYP BindFragDataLocationEXT)(GLuint program, GLuint colorNumber, const GLchar * name); /* 904 */
- GLint (GLAPIENTRYP GetFragDataLocationEXT)(GLuint program, const GLchar * name); /* 905 */
- void (GLAPIENTRYP GetUniformuivEXT)(GLuint program, GLint location, GLuint * params); /* 906 */
- void (GLAPIENTRYP GetVertexAttribIivEXT)(GLuint index, GLenum pname, GLint * params); /* 907 */
- void (GLAPIENTRYP GetVertexAttribIuivEXT)(GLuint index, GLenum pname, GLuint * params); /* 908 */
- void (GLAPIENTRYP Uniform1uiEXT)(GLint location, GLuint x); /* 909 */
- void (GLAPIENTRYP Uniform1uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 910 */
- void (GLAPIENTRYP Uniform2uiEXT)(GLint location, GLuint x, GLuint y); /* 911 */
- void (GLAPIENTRYP Uniform2uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 912 */
- void (GLAPIENTRYP Uniform3uiEXT)(GLint location, GLuint x, GLuint y, GLuint z); /* 913 */
- void (GLAPIENTRYP Uniform3uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 914 */
- void (GLAPIENTRYP Uniform4uiEXT)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w); /* 915 */
- void (GLAPIENTRYP Uniform4uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 916 */
- void (GLAPIENTRYP VertexAttribI1iEXT)(GLuint index, GLint x); /* 917 */
- void (GLAPIENTRYP VertexAttribI1ivEXT)(GLuint index, const GLint * v); /* 918 */
- void (GLAPIENTRYP VertexAttribI1uiEXT)(GLuint index, GLuint x); /* 919 */
- void (GLAPIENTRYP VertexAttribI1uivEXT)(GLuint index, const GLuint * v); /* 920 */
- void (GLAPIENTRYP VertexAttribI2iEXT)(GLuint index, GLint x, GLint y); /* 921 */
- void (GLAPIENTRYP VertexAttribI2ivEXT)(GLuint index, const GLint * v); /* 922 */
- void (GLAPIENTRYP VertexAttribI2uiEXT)(GLuint index, GLuint x, GLuint y); /* 923 */
- void (GLAPIENTRYP VertexAttribI2uivEXT)(GLuint index, const GLuint * v); /* 924 */
- void (GLAPIENTRYP VertexAttribI3iEXT)(GLuint index, GLint x, GLint y, GLint z); /* 925 */
- void (GLAPIENTRYP VertexAttribI3ivEXT)(GLuint index, const GLint * v); /* 926 */
- void (GLAPIENTRYP VertexAttribI3uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z); /* 927 */
- void (GLAPIENTRYP VertexAttribI3uivEXT)(GLuint index, const GLuint * v); /* 928 */
- void (GLAPIENTRYP VertexAttribI4bvEXT)(GLuint index, const GLbyte * v); /* 929 */
- void (GLAPIENTRYP VertexAttribI4iEXT)(GLuint index, GLint x, GLint y, GLint z, GLint w); /* 930 */
- void (GLAPIENTRYP VertexAttribI4ivEXT)(GLuint index, const GLint * v); /* 931 */
- void (GLAPIENTRYP VertexAttribI4svEXT)(GLuint index, const GLshort * v); /* 932 */
- void (GLAPIENTRYP VertexAttribI4ubvEXT)(GLuint index, const GLubyte * v); /* 933 */
- void (GLAPIENTRYP VertexAttribI4uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); /* 934 */
- void (GLAPIENTRYP VertexAttribI4uivEXT)(GLuint index, const GLuint * v); /* 935 */
- void (GLAPIENTRYP VertexAttribI4usvEXT)(GLuint index, const GLushort * v); /* 936 */
- void (GLAPIENTRYP VertexAttribIPointerEXT)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 937 */
- void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 938 */
- void (GLAPIENTRYP ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); /* 939 */
- void (GLAPIENTRYP DisableIndexedEXT)(GLenum target, GLuint index); /* 940 */
- void (GLAPIENTRYP EnableIndexedEXT)(GLenum target, GLuint index); /* 941 */
- void (GLAPIENTRYP GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean * data); /* 942 */
- void (GLAPIENTRYP GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint * data); /* 943 */
- GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 944 */
- void (GLAPIENTRYP ClearColorIiEXT)(GLint r, GLint g, GLint b, GLint a); /* 945 */
- void (GLAPIENTRYP ClearColorIuiEXT)(GLuint r, GLuint g, GLuint b, GLuint a); /* 946 */
- void (GLAPIENTRYP GetTexParameterIivEXT)(GLenum target, GLenum pname, GLint * params); /* 947 */
- void (GLAPIENTRYP GetTexParameterIuivEXT)(GLenum target, GLenum pname, GLuint * params); /* 948 */
- void (GLAPIENTRYP TexParameterIivEXT)(GLenum target, GLenum pname, const GLint * params); /* 949 */
- void (GLAPIENTRYP TexParameterIuivEXT)(GLenum target, GLenum pname, const GLuint * params); /* 950 */
- void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 951 */
- void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 952 */
- void (GLAPIENTRYP BeginTransformFeedbackEXT)(GLenum mode); /* 953 */
- void (GLAPIENTRYP BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); /* 954 */
- void (GLAPIENTRYP BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); /* 955 */
- void (GLAPIENTRYP BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); /* 956 */
- void (GLAPIENTRYP EndTransformFeedbackEXT)(void); /* 957 */
- void (GLAPIENTRYP GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); /* 958 */
- void (GLAPIENTRYP TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode); /* 959 */
- void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 960 */
- void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 961 */
- void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 962 */
- void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 963 */
- GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 964 */
- GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 965 */
- void (GLAPIENTRYP ActiveProgramEXT)(GLuint program); /* 966 */
- GLuint (GLAPIENTRYP CreateShaderProgramEXT)(GLenum type, const GLchar * string); /* 967 */
- void (GLAPIENTRYP UseShaderProgramEXT)(GLenum type, GLuint program); /* 968 */
- void (GLAPIENTRYP TextureBarrierNV)(void); /* 969 */
- void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 970 */
- void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 971 */
- void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 972 */
- void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 973 */
- void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 974 */
- void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 975 */
- void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 976 */
-};
-
-#endif /* !defined( _GLAPI_TABLE_H_ ) */
+/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */
+
+/*
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * (C) Copyright IBM Corporation 2004
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL, IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#if !defined( _GLAPI_TABLE_H_ )
+# define _GLAPI_TABLE_H_
+
+#ifndef GLAPIENTRYP
+# ifndef GLAPIENTRY
+# define GLAPIENTRY
+# endif
+
+# define GLAPIENTRYP GLAPIENTRY *
+#endif
+
+
+struct _glapi_table
+{
+ void (GLAPIENTRYP NewList)(GLuint list, GLenum mode); /* 0 */
+ void (GLAPIENTRYP EndList)(void); /* 1 */
+ void (GLAPIENTRYP CallList)(GLuint list); /* 2 */
+ void (GLAPIENTRYP CallLists)(GLsizei n, GLenum type, const GLvoid * lists); /* 3 */
+ void (GLAPIENTRYP DeleteLists)(GLuint list, GLsizei range); /* 4 */
+ GLuint (GLAPIENTRYP GenLists)(GLsizei range); /* 5 */
+ void (GLAPIENTRYP ListBase)(GLuint base); /* 6 */
+ void (GLAPIENTRYP Begin)(GLenum mode); /* 7 */
+ void (GLAPIENTRYP Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); /* 8 */
+ void (GLAPIENTRYP Color3b)(GLbyte red, GLbyte green, GLbyte blue); /* 9 */
+ void (GLAPIENTRYP Color3bv)(const GLbyte * v); /* 10 */
+ void (GLAPIENTRYP Color3d)(GLdouble red, GLdouble green, GLdouble blue); /* 11 */
+ void (GLAPIENTRYP Color3dv)(const GLdouble * v); /* 12 */
+ void (GLAPIENTRYP Color3f)(GLfloat red, GLfloat green, GLfloat blue); /* 13 */
+ void (GLAPIENTRYP Color3fv)(const GLfloat * v); /* 14 */
+ void (GLAPIENTRYP Color3i)(GLint red, GLint green, GLint blue); /* 15 */
+ void (GLAPIENTRYP Color3iv)(const GLint * v); /* 16 */
+ void (GLAPIENTRYP Color3s)(GLshort red, GLshort green, GLshort blue); /* 17 */
+ void (GLAPIENTRYP Color3sv)(const GLshort * v); /* 18 */
+ void (GLAPIENTRYP Color3ub)(GLubyte red, GLubyte green, GLubyte blue); /* 19 */
+ void (GLAPIENTRYP Color3ubv)(const GLubyte * v); /* 20 */
+ void (GLAPIENTRYP Color3ui)(GLuint red, GLuint green, GLuint blue); /* 21 */
+ void (GLAPIENTRYP Color3uiv)(const GLuint * v); /* 22 */
+ void (GLAPIENTRYP Color3us)(GLushort red, GLushort green, GLushort blue); /* 23 */
+ void (GLAPIENTRYP Color3usv)(const GLushort * v); /* 24 */
+ void (GLAPIENTRYP Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); /* 25 */
+ void (GLAPIENTRYP Color4bv)(const GLbyte * v); /* 26 */
+ void (GLAPIENTRYP Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); /* 27 */
+ void (GLAPIENTRYP Color4dv)(const GLdouble * v); /* 28 */
+ void (GLAPIENTRYP Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 29 */
+ void (GLAPIENTRYP Color4fv)(const GLfloat * v); /* 30 */
+ void (GLAPIENTRYP Color4i)(GLint red, GLint green, GLint blue, GLint alpha); /* 31 */
+ void (GLAPIENTRYP Color4iv)(const GLint * v); /* 32 */
+ void (GLAPIENTRYP Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); /* 33 */
+ void (GLAPIENTRYP Color4sv)(const GLshort * v); /* 34 */
+ void (GLAPIENTRYP Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); /* 35 */
+ void (GLAPIENTRYP Color4ubv)(const GLubyte * v); /* 36 */
+ void (GLAPIENTRYP Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); /* 37 */
+ void (GLAPIENTRYP Color4uiv)(const GLuint * v); /* 38 */
+ void (GLAPIENTRYP Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); /* 39 */
+ void (GLAPIENTRYP Color4usv)(const GLushort * v); /* 40 */
+ void (GLAPIENTRYP EdgeFlag)(GLboolean flag); /* 41 */
+ void (GLAPIENTRYP EdgeFlagv)(const GLboolean * flag); /* 42 */
+ void (GLAPIENTRYP End)(void); /* 43 */
+ void (GLAPIENTRYP Indexd)(GLdouble c); /* 44 */
+ void (GLAPIENTRYP Indexdv)(const GLdouble * c); /* 45 */
+ void (GLAPIENTRYP Indexf)(GLfloat c); /* 46 */
+ void (GLAPIENTRYP Indexfv)(const GLfloat * c); /* 47 */
+ void (GLAPIENTRYP Indexi)(GLint c); /* 48 */
+ void (GLAPIENTRYP Indexiv)(const GLint * c); /* 49 */
+ void (GLAPIENTRYP Indexs)(GLshort c); /* 50 */
+ void (GLAPIENTRYP Indexsv)(const GLshort * c); /* 51 */
+ void (GLAPIENTRYP Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); /* 52 */
+ void (GLAPIENTRYP Normal3bv)(const GLbyte * v); /* 53 */
+ void (GLAPIENTRYP Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); /* 54 */
+ void (GLAPIENTRYP Normal3dv)(const GLdouble * v); /* 55 */
+ void (GLAPIENTRYP Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); /* 56 */
+ void (GLAPIENTRYP Normal3fv)(const GLfloat * v); /* 57 */
+ void (GLAPIENTRYP Normal3i)(GLint nx, GLint ny, GLint nz); /* 58 */
+ void (GLAPIENTRYP Normal3iv)(const GLint * v); /* 59 */
+ void (GLAPIENTRYP Normal3s)(GLshort nx, GLshort ny, GLshort nz); /* 60 */
+ void (GLAPIENTRYP Normal3sv)(const GLshort * v); /* 61 */
+ void (GLAPIENTRYP RasterPos2d)(GLdouble x, GLdouble y); /* 62 */
+ void (GLAPIENTRYP RasterPos2dv)(const GLdouble * v); /* 63 */
+ void (GLAPIENTRYP RasterPos2f)(GLfloat x, GLfloat y); /* 64 */
+ void (GLAPIENTRYP RasterPos2fv)(const GLfloat * v); /* 65 */
+ void (GLAPIENTRYP RasterPos2i)(GLint x, GLint y); /* 66 */
+ void (GLAPIENTRYP RasterPos2iv)(const GLint * v); /* 67 */
+ void (GLAPIENTRYP RasterPos2s)(GLshort x, GLshort y); /* 68 */
+ void (GLAPIENTRYP RasterPos2sv)(const GLshort * v); /* 69 */
+ void (GLAPIENTRYP RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); /* 70 */
+ void (GLAPIENTRYP RasterPos3dv)(const GLdouble * v); /* 71 */
+ void (GLAPIENTRYP RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); /* 72 */
+ void (GLAPIENTRYP RasterPos3fv)(const GLfloat * v); /* 73 */
+ void (GLAPIENTRYP RasterPos3i)(GLint x, GLint y, GLint z); /* 74 */
+ void (GLAPIENTRYP RasterPos3iv)(const GLint * v); /* 75 */
+ void (GLAPIENTRYP RasterPos3s)(GLshort x, GLshort y, GLshort z); /* 76 */
+ void (GLAPIENTRYP RasterPos3sv)(const GLshort * v); /* 77 */
+ void (GLAPIENTRYP RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 78 */
+ void (GLAPIENTRYP RasterPos4dv)(const GLdouble * v); /* 79 */
+ void (GLAPIENTRYP RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 80 */
+ void (GLAPIENTRYP RasterPos4fv)(const GLfloat * v); /* 81 */
+ void (GLAPIENTRYP RasterPos4i)(GLint x, GLint y, GLint z, GLint w); /* 82 */
+ void (GLAPIENTRYP RasterPos4iv)(const GLint * v); /* 83 */
+ void (GLAPIENTRYP RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 84 */
+ void (GLAPIENTRYP RasterPos4sv)(const GLshort * v); /* 85 */
+ void (GLAPIENTRYP Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); /* 86 */
+ void (GLAPIENTRYP Rectdv)(const GLdouble * v1, const GLdouble * v2); /* 87 */
+ void (GLAPIENTRYP Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); /* 88 */
+ void (GLAPIENTRYP Rectfv)(const GLfloat * v1, const GLfloat * v2); /* 89 */
+ void (GLAPIENTRYP Recti)(GLint x1, GLint y1, GLint x2, GLint y2); /* 90 */
+ void (GLAPIENTRYP Rectiv)(const GLint * v1, const GLint * v2); /* 91 */
+ void (GLAPIENTRYP Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); /* 92 */
+ void (GLAPIENTRYP Rectsv)(const GLshort * v1, const GLshort * v2); /* 93 */
+ void (GLAPIENTRYP TexCoord1d)(GLdouble s); /* 94 */
+ void (GLAPIENTRYP TexCoord1dv)(const GLdouble * v); /* 95 */
+ void (GLAPIENTRYP TexCoord1f)(GLfloat s); /* 96 */
+ void (GLAPIENTRYP TexCoord1fv)(const GLfloat * v); /* 97 */
+ void (GLAPIENTRYP TexCoord1i)(GLint s); /* 98 */
+ void (GLAPIENTRYP TexCoord1iv)(const GLint * v); /* 99 */
+ void (GLAPIENTRYP TexCoord1s)(GLshort s); /* 100 */
+ void (GLAPIENTRYP TexCoord1sv)(const GLshort * v); /* 101 */
+ void (GLAPIENTRYP TexCoord2d)(GLdouble s, GLdouble t); /* 102 */
+ void (GLAPIENTRYP TexCoord2dv)(const GLdouble * v); /* 103 */
+ void (GLAPIENTRYP TexCoord2f)(GLfloat s, GLfloat t); /* 104 */
+ void (GLAPIENTRYP TexCoord2fv)(const GLfloat * v); /* 105 */
+ void (GLAPIENTRYP TexCoord2i)(GLint s, GLint t); /* 106 */
+ void (GLAPIENTRYP TexCoord2iv)(const GLint * v); /* 107 */
+ void (GLAPIENTRYP TexCoord2s)(GLshort s, GLshort t); /* 108 */
+ void (GLAPIENTRYP TexCoord2sv)(const GLshort * v); /* 109 */
+ void (GLAPIENTRYP TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); /* 110 */
+ void (GLAPIENTRYP TexCoord3dv)(const GLdouble * v); /* 111 */
+ void (GLAPIENTRYP TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); /* 112 */
+ void (GLAPIENTRYP TexCoord3fv)(const GLfloat * v); /* 113 */
+ void (GLAPIENTRYP TexCoord3i)(GLint s, GLint t, GLint r); /* 114 */
+ void (GLAPIENTRYP TexCoord3iv)(const GLint * v); /* 115 */
+ void (GLAPIENTRYP TexCoord3s)(GLshort s, GLshort t, GLshort r); /* 116 */
+ void (GLAPIENTRYP TexCoord3sv)(const GLshort * v); /* 117 */
+ void (GLAPIENTRYP TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 118 */
+ void (GLAPIENTRYP TexCoord4dv)(const GLdouble * v); /* 119 */
+ void (GLAPIENTRYP TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 120 */
+ void (GLAPIENTRYP TexCoord4fv)(const GLfloat * v); /* 121 */
+ void (GLAPIENTRYP TexCoord4i)(GLint s, GLint t, GLint r, GLint q); /* 122 */
+ void (GLAPIENTRYP TexCoord4iv)(const GLint * v); /* 123 */
+ void (GLAPIENTRYP TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); /* 124 */
+ void (GLAPIENTRYP TexCoord4sv)(const GLshort * v); /* 125 */
+ void (GLAPIENTRYP Vertex2d)(GLdouble x, GLdouble y); /* 126 */
+ void (GLAPIENTRYP Vertex2dv)(const GLdouble * v); /* 127 */
+ void (GLAPIENTRYP Vertex2f)(GLfloat x, GLfloat y); /* 128 */
+ void (GLAPIENTRYP Vertex2fv)(const GLfloat * v); /* 129 */
+ void (GLAPIENTRYP Vertex2i)(GLint x, GLint y); /* 130 */
+ void (GLAPIENTRYP Vertex2iv)(const GLint * v); /* 131 */
+ void (GLAPIENTRYP Vertex2s)(GLshort x, GLshort y); /* 132 */
+ void (GLAPIENTRYP Vertex2sv)(const GLshort * v); /* 133 */
+ void (GLAPIENTRYP Vertex3d)(GLdouble x, GLdouble y, GLdouble z); /* 134 */
+ void (GLAPIENTRYP Vertex3dv)(const GLdouble * v); /* 135 */
+ void (GLAPIENTRYP Vertex3f)(GLfloat x, GLfloat y, GLfloat z); /* 136 */
+ void (GLAPIENTRYP Vertex3fv)(const GLfloat * v); /* 137 */
+ void (GLAPIENTRYP Vertex3i)(GLint x, GLint y, GLint z); /* 138 */
+ void (GLAPIENTRYP Vertex3iv)(const GLint * v); /* 139 */
+ void (GLAPIENTRYP Vertex3s)(GLshort x, GLshort y, GLshort z); /* 140 */
+ void (GLAPIENTRYP Vertex3sv)(const GLshort * v); /* 141 */
+ void (GLAPIENTRYP Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 142 */
+ void (GLAPIENTRYP Vertex4dv)(const GLdouble * v); /* 143 */
+ void (GLAPIENTRYP Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 144 */
+ void (GLAPIENTRYP Vertex4fv)(const GLfloat * v); /* 145 */
+ void (GLAPIENTRYP Vertex4i)(GLint x, GLint y, GLint z, GLint w); /* 146 */
+ void (GLAPIENTRYP Vertex4iv)(const GLint * v); /* 147 */
+ void (GLAPIENTRYP Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 148 */
+ void (GLAPIENTRYP Vertex4sv)(const GLshort * v); /* 149 */
+ void (GLAPIENTRYP ClipPlane)(GLenum plane, const GLdouble * equation); /* 150 */
+ void (GLAPIENTRYP ColorMaterial)(GLenum face, GLenum mode); /* 151 */
+ void (GLAPIENTRYP CullFace)(GLenum mode); /* 152 */
+ void (GLAPIENTRYP Fogf)(GLenum pname, GLfloat param); /* 153 */
+ void (GLAPIENTRYP Fogfv)(GLenum pname, const GLfloat * params); /* 154 */
+ void (GLAPIENTRYP Fogi)(GLenum pname, GLint param); /* 155 */
+ void (GLAPIENTRYP Fogiv)(GLenum pname, const GLint * params); /* 156 */
+ void (GLAPIENTRYP FrontFace)(GLenum mode); /* 157 */
+ void (GLAPIENTRYP Hint)(GLenum target, GLenum mode); /* 158 */
+ void (GLAPIENTRYP Lightf)(GLenum light, GLenum pname, GLfloat param); /* 159 */
+ void (GLAPIENTRYP Lightfv)(GLenum light, GLenum pname, const GLfloat * params); /* 160 */
+ void (GLAPIENTRYP Lighti)(GLenum light, GLenum pname, GLint param); /* 161 */
+ void (GLAPIENTRYP Lightiv)(GLenum light, GLenum pname, const GLint * params); /* 162 */
+ void (GLAPIENTRYP LightModelf)(GLenum pname, GLfloat param); /* 163 */
+ void (GLAPIENTRYP LightModelfv)(GLenum pname, const GLfloat * params); /* 164 */
+ void (GLAPIENTRYP LightModeli)(GLenum pname, GLint param); /* 165 */
+ void (GLAPIENTRYP LightModeliv)(GLenum pname, const GLint * params); /* 166 */
+ void (GLAPIENTRYP LineStipple)(GLint factor, GLushort pattern); /* 167 */
+ void (GLAPIENTRYP LineWidth)(GLfloat width); /* 168 */
+ void (GLAPIENTRYP Materialf)(GLenum face, GLenum pname, GLfloat param); /* 169 */
+ void (GLAPIENTRYP Materialfv)(GLenum face, GLenum pname, const GLfloat * params); /* 170 */
+ void (GLAPIENTRYP Materiali)(GLenum face, GLenum pname, GLint param); /* 171 */
+ void (GLAPIENTRYP Materialiv)(GLenum face, GLenum pname, const GLint * params); /* 172 */
+ void (GLAPIENTRYP PointSize)(GLfloat size); /* 173 */
+ void (GLAPIENTRYP PolygonMode)(GLenum face, GLenum mode); /* 174 */
+ void (GLAPIENTRYP PolygonStipple)(const GLubyte * mask); /* 175 */
+ void (GLAPIENTRYP Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); /* 176 */
+ void (GLAPIENTRYP ShadeModel)(GLenum mode); /* 177 */
+ void (GLAPIENTRYP TexParameterf)(GLenum target, GLenum pname, GLfloat param); /* 178 */
+ void (GLAPIENTRYP TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 179 */
+ void (GLAPIENTRYP TexParameteri)(GLenum target, GLenum pname, GLint param); /* 180 */
+ void (GLAPIENTRYP TexParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 181 */
+ void (GLAPIENTRYP TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 182 */
+ void (GLAPIENTRYP TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 183 */
+ void (GLAPIENTRYP TexEnvf)(GLenum target, GLenum pname, GLfloat param); /* 184 */
+ void (GLAPIENTRYP TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params); /* 185 */
+ void (GLAPIENTRYP TexEnvi)(GLenum target, GLenum pname, GLint param); /* 186 */
+ void (GLAPIENTRYP TexEnviv)(GLenum target, GLenum pname, const GLint * params); /* 187 */
+ void (GLAPIENTRYP TexGend)(GLenum coord, GLenum pname, GLdouble param); /* 188 */
+ void (GLAPIENTRYP TexGendv)(GLenum coord, GLenum pname, const GLdouble * params); /* 189 */
+ void (GLAPIENTRYP TexGenf)(GLenum coord, GLenum pname, GLfloat param); /* 190 */
+ void (GLAPIENTRYP TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params); /* 191 */
+ void (GLAPIENTRYP TexGeni)(GLenum coord, GLenum pname, GLint param); /* 192 */
+ void (GLAPIENTRYP TexGeniv)(GLenum coord, GLenum pname, const GLint * params); /* 193 */
+ void (GLAPIENTRYP FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer); /* 194 */
+ void (GLAPIENTRYP SelectBuffer)(GLsizei size, GLuint * buffer); /* 195 */
+ GLint (GLAPIENTRYP RenderMode)(GLenum mode); /* 196 */
+ void (GLAPIENTRYP InitNames)(void); /* 197 */
+ void (GLAPIENTRYP LoadName)(GLuint name); /* 198 */
+ void (GLAPIENTRYP PassThrough)(GLfloat token); /* 199 */
+ void (GLAPIENTRYP PopName)(void); /* 200 */
+ void (GLAPIENTRYP PushName)(GLuint name); /* 201 */
+ void (GLAPIENTRYP DrawBuffer)(GLenum mode); /* 202 */
+ void (GLAPIENTRYP Clear)(GLbitfield mask); /* 203 */
+ void (GLAPIENTRYP ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 204 */
+ void (GLAPIENTRYP ClearIndex)(GLfloat c); /* 205 */
+ void (GLAPIENTRYP ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 206 */
+ void (GLAPIENTRYP ClearStencil)(GLint s); /* 207 */
+ void (GLAPIENTRYP ClearDepth)(GLclampd depth); /* 208 */
+ void (GLAPIENTRYP StencilMask)(GLuint mask); /* 209 */
+ void (GLAPIENTRYP ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); /* 210 */
+ void (GLAPIENTRYP DepthMask)(GLboolean flag); /* 211 */
+ void (GLAPIENTRYP IndexMask)(GLuint mask); /* 212 */
+ void (GLAPIENTRYP Accum)(GLenum op, GLfloat value); /* 213 */
+ void (GLAPIENTRYP Disable)(GLenum cap); /* 214 */
+ void (GLAPIENTRYP Enable)(GLenum cap); /* 215 */
+ void (GLAPIENTRYP Finish)(void); /* 216 */
+ void (GLAPIENTRYP Flush)(void); /* 217 */
+ void (GLAPIENTRYP PopAttrib)(void); /* 218 */
+ void (GLAPIENTRYP PushAttrib)(GLbitfield mask); /* 219 */
+ void (GLAPIENTRYP Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); /* 220 */
+ void (GLAPIENTRYP Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); /* 221 */
+ void (GLAPIENTRYP Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); /* 222 */
+ void (GLAPIENTRYP Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); /* 223 */
+ void (GLAPIENTRYP MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); /* 224 */
+ void (GLAPIENTRYP MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); /* 225 */
+ void (GLAPIENTRYP MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); /* 226 */
+ void (GLAPIENTRYP MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); /* 227 */
+ void (GLAPIENTRYP EvalCoord1d)(GLdouble u); /* 228 */
+ void (GLAPIENTRYP EvalCoord1dv)(const GLdouble * u); /* 229 */
+ void (GLAPIENTRYP EvalCoord1f)(GLfloat u); /* 230 */
+ void (GLAPIENTRYP EvalCoord1fv)(const GLfloat * u); /* 231 */
+ void (GLAPIENTRYP EvalCoord2d)(GLdouble u, GLdouble v); /* 232 */
+ void (GLAPIENTRYP EvalCoord2dv)(const GLdouble * u); /* 233 */
+ void (GLAPIENTRYP EvalCoord2f)(GLfloat u, GLfloat v); /* 234 */
+ void (GLAPIENTRYP EvalCoord2fv)(const GLfloat * u); /* 235 */
+ void (GLAPIENTRYP EvalMesh1)(GLenum mode, GLint i1, GLint i2); /* 236 */
+ void (GLAPIENTRYP EvalPoint1)(GLint i); /* 237 */
+ void (GLAPIENTRYP EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); /* 238 */
+ void (GLAPIENTRYP EvalPoint2)(GLint i, GLint j); /* 239 */
+ void (GLAPIENTRYP AlphaFunc)(GLenum func, GLclampf ref); /* 240 */
+ void (GLAPIENTRYP BlendFunc)(GLenum sfactor, GLenum dfactor); /* 241 */
+ void (GLAPIENTRYP LogicOp)(GLenum opcode); /* 242 */
+ void (GLAPIENTRYP StencilFunc)(GLenum func, GLint ref, GLuint mask); /* 243 */
+ void (GLAPIENTRYP StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); /* 244 */
+ void (GLAPIENTRYP DepthFunc)(GLenum func); /* 245 */
+ void (GLAPIENTRYP PixelZoom)(GLfloat xfactor, GLfloat yfactor); /* 246 */
+ void (GLAPIENTRYP PixelTransferf)(GLenum pname, GLfloat param); /* 247 */
+ void (GLAPIENTRYP PixelTransferi)(GLenum pname, GLint param); /* 248 */
+ void (GLAPIENTRYP PixelStoref)(GLenum pname, GLfloat param); /* 249 */
+ void (GLAPIENTRYP PixelStorei)(GLenum pname, GLint param); /* 250 */
+ void (GLAPIENTRYP PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values); /* 251 */
+ void (GLAPIENTRYP PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values); /* 252 */
+ void (GLAPIENTRYP PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values); /* 253 */
+ void (GLAPIENTRYP ReadBuffer)(GLenum mode); /* 254 */
+ void (GLAPIENTRYP CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); /* 255 */
+ void (GLAPIENTRYP ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels); /* 256 */
+ void (GLAPIENTRYP DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 257 */
+ void (GLAPIENTRYP GetBooleanv)(GLenum pname, GLboolean * params); /* 258 */
+ void (GLAPIENTRYP GetClipPlane)(GLenum plane, GLdouble * equation); /* 259 */
+ void (GLAPIENTRYP GetDoublev)(GLenum pname, GLdouble * params); /* 260 */
+ GLenum (GLAPIENTRYP GetError)(void); /* 261 */
+ void (GLAPIENTRYP GetFloatv)(GLenum pname, GLfloat * params); /* 262 */
+ void (GLAPIENTRYP GetIntegerv)(GLenum pname, GLint * params); /* 263 */
+ void (GLAPIENTRYP GetLightfv)(GLenum light, GLenum pname, GLfloat * params); /* 264 */
+ void (GLAPIENTRYP GetLightiv)(GLenum light, GLenum pname, GLint * params); /* 265 */
+ void (GLAPIENTRYP GetMapdv)(GLenum target, GLenum query, GLdouble * v); /* 266 */
+ void (GLAPIENTRYP GetMapfv)(GLenum target, GLenum query, GLfloat * v); /* 267 */
+ void (GLAPIENTRYP GetMapiv)(GLenum target, GLenum query, GLint * v); /* 268 */
+ void (GLAPIENTRYP GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params); /* 269 */
+ void (GLAPIENTRYP GetMaterialiv)(GLenum face, GLenum pname, GLint * params); /* 270 */
+ void (GLAPIENTRYP GetPixelMapfv)(GLenum map, GLfloat * values); /* 271 */
+ void (GLAPIENTRYP GetPixelMapuiv)(GLenum map, GLuint * values); /* 272 */
+ void (GLAPIENTRYP GetPixelMapusv)(GLenum map, GLushort * values); /* 273 */
+ void (GLAPIENTRYP GetPolygonStipple)(GLubyte * mask); /* 274 */
+ const GLubyte * (GLAPIENTRYP GetString)(GLenum name); /* 275 */
+ void (GLAPIENTRYP GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params); /* 276 */
+ void (GLAPIENTRYP GetTexEnviv)(GLenum target, GLenum pname, GLint * params); /* 277 */
+ void (GLAPIENTRYP GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params); /* 278 */
+ void (GLAPIENTRYP GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params); /* 279 */
+ void (GLAPIENTRYP GetTexGeniv)(GLenum coord, GLenum pname, GLint * params); /* 280 */
+ void (GLAPIENTRYP GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels); /* 281 */
+ void (GLAPIENTRYP GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 282 */
+ void (GLAPIENTRYP GetTexParameteriv)(GLenum target, GLenum pname, GLint * params); /* 283 */
+ void (GLAPIENTRYP GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params); /* 284 */
+ void (GLAPIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); /* 285 */
+ GLboolean (GLAPIENTRYP IsEnabled)(GLenum cap); /* 286 */
+ GLboolean (GLAPIENTRYP IsList)(GLuint list); /* 287 */
+ void (GLAPIENTRYP DepthRange)(GLclampd zNear, GLclampd zFar); /* 288 */
+ void (GLAPIENTRYP Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 289 */
+ void (GLAPIENTRYP LoadIdentity)(void); /* 290 */
+ void (GLAPIENTRYP LoadMatrixf)(const GLfloat * m); /* 291 */
+ void (GLAPIENTRYP LoadMatrixd)(const GLdouble * m); /* 292 */
+ void (GLAPIENTRYP MatrixMode)(GLenum mode); /* 293 */
+ void (GLAPIENTRYP MultMatrixf)(const GLfloat * m); /* 294 */
+ void (GLAPIENTRYP MultMatrixd)(const GLdouble * m); /* 295 */
+ void (GLAPIENTRYP Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 296 */
+ void (GLAPIENTRYP PopMatrix)(void); /* 297 */
+ void (GLAPIENTRYP PushMatrix)(void); /* 298 */
+ void (GLAPIENTRYP Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); /* 299 */
+ void (GLAPIENTRYP Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); /* 300 */
+ void (GLAPIENTRYP Scaled)(GLdouble x, GLdouble y, GLdouble z); /* 301 */
+ void (GLAPIENTRYP Scalef)(GLfloat x, GLfloat y, GLfloat z); /* 302 */
+ void (GLAPIENTRYP Translated)(GLdouble x, GLdouble y, GLdouble z); /* 303 */
+ void (GLAPIENTRYP Translatef)(GLfloat x, GLfloat y, GLfloat z); /* 304 */
+ void (GLAPIENTRYP Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); /* 305 */
+ void (GLAPIENTRYP ArrayElement)(GLint i); /* 306 */
+ void (GLAPIENTRYP BindTexture)(GLenum target, GLuint texture); /* 307 */
+ void (GLAPIENTRYP ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 308 */
+ void (GLAPIENTRYP DisableClientState)(GLenum array); /* 309 */
+ void (GLAPIENTRYP DrawArrays)(GLenum mode, GLint first, GLsizei count); /* 310 */
+ void (GLAPIENTRYP DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); /* 311 */
+ void (GLAPIENTRYP EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer); /* 312 */
+ void (GLAPIENTRYP EnableClientState)(GLenum array); /* 313 */
+ void (GLAPIENTRYP IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 314 */
+ void (GLAPIENTRYP Indexub)(GLubyte c); /* 315 */
+ void (GLAPIENTRYP Indexubv)(const GLubyte * c); /* 316 */
+ void (GLAPIENTRYP InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer); /* 317 */
+ void (GLAPIENTRYP NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 318 */
+ void (GLAPIENTRYP PolygonOffset)(GLfloat factor, GLfloat units); /* 319 */
+ void (GLAPIENTRYP TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 320 */
+ void (GLAPIENTRYP VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 321 */
+ GLboolean (GLAPIENTRYP AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 322 */
+ void (GLAPIENTRYP CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); /* 323 */
+ void (GLAPIENTRYP CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); /* 324 */
+ void (GLAPIENTRYP CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); /* 325 */
+ void (GLAPIENTRYP CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 326 */
+ void (GLAPIENTRYP DeleteTextures)(GLsizei n, const GLuint * textures); /* 327 */
+ void (GLAPIENTRYP GenTextures)(GLsizei n, GLuint * textures); /* 328 */
+ void (GLAPIENTRYP GetPointerv)(GLenum pname, GLvoid ** params); /* 329 */
+ GLboolean (GLAPIENTRYP IsTexture)(GLuint texture); /* 330 */
+ void (GLAPIENTRYP PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities); /* 331 */
+ void (GLAPIENTRYP TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels); /* 332 */
+ void (GLAPIENTRYP TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 333 */
+ void (GLAPIENTRYP PopClientAttrib)(void); /* 334 */
+ void (GLAPIENTRYP PushClientAttrib)(GLbitfield mask); /* 335 */
+ void (GLAPIENTRYP BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 336 */
+ void (GLAPIENTRYP BlendEquation)(GLenum mode); /* 337 */
+ void (GLAPIENTRYP DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); /* 338 */
+ void (GLAPIENTRYP ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table); /* 339 */
+ void (GLAPIENTRYP ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 340 */
+ void (GLAPIENTRYP ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 341 */
+ void (GLAPIENTRYP CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 342 */
+ void (GLAPIENTRYP GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 343 */
+ void (GLAPIENTRYP GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 344 */
+ void (GLAPIENTRYP GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params); /* 345 */
+ void (GLAPIENTRYP ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data); /* 346 */
+ void (GLAPIENTRYP CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); /* 347 */
+ void (GLAPIENTRYP ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image); /* 348 */
+ void (GLAPIENTRYP ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image); /* 349 */
+ void (GLAPIENTRYP ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params); /* 350 */
+ void (GLAPIENTRYP ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 351 */
+ void (GLAPIENTRYP ConvolutionParameteri)(GLenum target, GLenum pname, GLint params); /* 352 */
+ void (GLAPIENTRYP ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 353 */
+ void (GLAPIENTRYP CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 354 */
+ void (GLAPIENTRYP CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); /* 355 */
+ void (GLAPIENTRYP GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 356 */
+ void (GLAPIENTRYP GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 357 */
+ void (GLAPIENTRYP GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params); /* 358 */
+ void (GLAPIENTRYP GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 359 */
+ void (GLAPIENTRYP SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column); /* 360 */
+ void (GLAPIENTRYP GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 361 */
+ void (GLAPIENTRYP GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 362 */
+ void (GLAPIENTRYP GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params); /* 363 */
+ void (GLAPIENTRYP GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 364 */
+ void (GLAPIENTRYP GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 365 */
+ void (GLAPIENTRYP GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params); /* 366 */
+ void (GLAPIENTRYP Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); /* 367 */
+ void (GLAPIENTRYP Minmax)(GLenum target, GLenum internalformat, GLboolean sink); /* 368 */
+ void (GLAPIENTRYP ResetHistogram)(GLenum target); /* 369 */
+ void (GLAPIENTRYP ResetMinmax)(GLenum target); /* 370 */
+ void (GLAPIENTRYP TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */
+ void (GLAPIENTRYP TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels); /* 372 */
+ void (GLAPIENTRYP CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 373 */
+ void (GLAPIENTRYP ActiveTextureARB)(GLenum texture); /* 374 */
+ void (GLAPIENTRYP ClientActiveTextureARB)(GLenum texture); /* 375 */
+ void (GLAPIENTRYP MultiTexCoord1dARB)(GLenum target, GLdouble s); /* 376 */
+ void (GLAPIENTRYP MultiTexCoord1dvARB)(GLenum target, const GLdouble * v); /* 377 */
+ void (GLAPIENTRYP MultiTexCoord1fARB)(GLenum target, GLfloat s); /* 378 */
+ void (GLAPIENTRYP MultiTexCoord1fvARB)(GLenum target, const GLfloat * v); /* 379 */
+ void (GLAPIENTRYP MultiTexCoord1iARB)(GLenum target, GLint s); /* 380 */
+ void (GLAPIENTRYP MultiTexCoord1ivARB)(GLenum target, const GLint * v); /* 381 */
+ void (GLAPIENTRYP MultiTexCoord1sARB)(GLenum target, GLshort s); /* 382 */
+ void (GLAPIENTRYP MultiTexCoord1svARB)(GLenum target, const GLshort * v); /* 383 */
+ void (GLAPIENTRYP MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); /* 384 */
+ void (GLAPIENTRYP MultiTexCoord2dvARB)(GLenum target, const GLdouble * v); /* 385 */
+ void (GLAPIENTRYP MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); /* 386 */
+ void (GLAPIENTRYP MultiTexCoord2fvARB)(GLenum target, const GLfloat * v); /* 387 */
+ void (GLAPIENTRYP MultiTexCoord2iARB)(GLenum target, GLint s, GLint t); /* 388 */
+ void (GLAPIENTRYP MultiTexCoord2ivARB)(GLenum target, const GLint * v); /* 389 */
+ void (GLAPIENTRYP MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t); /* 390 */
+ void (GLAPIENTRYP MultiTexCoord2svARB)(GLenum target, const GLshort * v); /* 391 */
+ void (GLAPIENTRYP MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r); /* 392 */
+ void (GLAPIENTRYP MultiTexCoord3dvARB)(GLenum target, const GLdouble * v); /* 393 */
+ void (GLAPIENTRYP MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r); /* 394 */
+ void (GLAPIENTRYP MultiTexCoord3fvARB)(GLenum target, const GLfloat * v); /* 395 */
+ void (GLAPIENTRYP MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r); /* 396 */
+ void (GLAPIENTRYP MultiTexCoord3ivARB)(GLenum target, const GLint * v); /* 397 */
+ void (GLAPIENTRYP MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r); /* 398 */
+ void (GLAPIENTRYP MultiTexCoord3svARB)(GLenum target, const GLshort * v); /* 399 */
+ void (GLAPIENTRYP MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 400 */
+ void (GLAPIENTRYP MultiTexCoord4dvARB)(GLenum target, const GLdouble * v); /* 401 */
+ void (GLAPIENTRYP MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 402 */
+ void (GLAPIENTRYP MultiTexCoord4fvARB)(GLenum target, const GLfloat * v); /* 403 */
+ void (GLAPIENTRYP MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q); /* 404 */
+ void (GLAPIENTRYP MultiTexCoord4ivARB)(GLenum target, const GLint * v); /* 405 */
+ void (GLAPIENTRYP MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); /* 406 */
+ void (GLAPIENTRYP MultiTexCoord4svARB)(GLenum target, const GLshort * v); /* 407 */
+ void (GLAPIENTRYP AttachShader)(GLuint program, GLuint shader); /* 408 */
+ GLuint (GLAPIENTRYP CreateProgram)(void); /* 409 */
+ GLuint (GLAPIENTRYP CreateShader)(GLenum type); /* 410 */
+ void (GLAPIENTRYP DeleteProgram)(GLuint program); /* 411 */
+ void (GLAPIENTRYP DeleteShader)(GLuint program); /* 412 */
+ void (GLAPIENTRYP DetachShader)(GLuint program, GLuint shader); /* 413 */
+ void (GLAPIENTRYP GetAttachedShaders)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * obj); /* 414 */
+ void (GLAPIENTRYP GetProgramInfoLog)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog); /* 415 */
+ void (GLAPIENTRYP GetProgramiv)(GLuint program, GLenum pname, GLint * params); /* 416 */
+ void (GLAPIENTRYP GetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog); /* 417 */
+ void (GLAPIENTRYP GetShaderiv)(GLuint shader, GLenum pname, GLint * params); /* 418 */
+ GLboolean (GLAPIENTRYP IsProgram)(GLuint program); /* 419 */
+ GLboolean (GLAPIENTRYP IsShader)(GLuint shader); /* 420 */
+ void (GLAPIENTRYP StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); /* 421 */
+ void (GLAPIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); /* 422 */
+ void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); /* 423 */
+ void (GLAPIENTRYP UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 424 */
+ void (GLAPIENTRYP UniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 425 */
+ void (GLAPIENTRYP UniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 426 */
+ void (GLAPIENTRYP UniformMatrix3x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 427 */
+ void (GLAPIENTRYP UniformMatrix4x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 428 */
+ void (GLAPIENTRYP UniformMatrix4x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 429 */
+ void (GLAPIENTRYP ClampColor)(GLenum target, GLenum clamp); /* 430 */
+ void (GLAPIENTRYP ClearBufferfi)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); /* 431 */
+ void (GLAPIENTRYP ClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat * value); /* 432 */
+ void (GLAPIENTRYP ClearBufferiv)(GLenum buffer, GLint drawbuffer, const GLint * value); /* 433 */
+ void (GLAPIENTRYP ClearBufferuiv)(GLenum buffer, GLint drawbuffer, const GLuint * value); /* 434 */
+ const GLubyte * (GLAPIENTRYP GetStringi)(GLenum name, GLuint index); /* 435 */
+ void (GLAPIENTRYP TexBuffer)(GLenum target, GLenum internalFormat, GLuint buffer); /* 436 */
+ void (GLAPIENTRYP FramebufferTexture)(GLenum target, GLenum attachment, GLuint texture, GLint level); /* 437 */
+ void (GLAPIENTRYP GetBufferParameteri64v)(GLenum target, GLenum pname, GLint64 * params); /* 438 */
+ void (GLAPIENTRYP GetInteger64i_v)(GLenum cap, GLuint index, GLint64 * data); /* 439 */
+ void (GLAPIENTRYP VertexAttribDivisor)(GLuint index, GLuint divisor); /* 440 */
+ void (GLAPIENTRYP LoadTransposeMatrixdARB)(const GLdouble * m); /* 441 */
+ void (GLAPIENTRYP LoadTransposeMatrixfARB)(const GLfloat * m); /* 442 */
+ void (GLAPIENTRYP MultTransposeMatrixdARB)(const GLdouble * m); /* 443 */
+ void (GLAPIENTRYP MultTransposeMatrixfARB)(const GLfloat * m); /* 444 */
+ void (GLAPIENTRYP SampleCoverageARB)(GLclampf value, GLboolean invert); /* 445 */
+ void (GLAPIENTRYP CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 446 */
+ void (GLAPIENTRYP CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 447 */
+ void (GLAPIENTRYP CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 448 */
+ void (GLAPIENTRYP CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 449 */
+ void (GLAPIENTRYP CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 450 */
+ void (GLAPIENTRYP CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 451 */
+ void (GLAPIENTRYP GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img); /* 452 */
+ void (GLAPIENTRYP DisableVertexAttribArrayARB)(GLuint index); /* 453 */
+ void (GLAPIENTRYP EnableVertexAttribArrayARB)(GLuint index); /* 454 */
+ void (GLAPIENTRYP GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 455 */
+ void (GLAPIENTRYP GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 456 */
+ void (GLAPIENTRYP GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 457 */
+ void (GLAPIENTRYP GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 458 */
+ void (GLAPIENTRYP GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string); /* 459 */
+ void (GLAPIENTRYP GetProgramivARB)(GLenum target, GLenum pname, GLint * params); /* 460 */
+ void (GLAPIENTRYP GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble * params); /* 461 */
+ void (GLAPIENTRYP GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat * params); /* 462 */
+ void (GLAPIENTRYP GetVertexAttribivARB)(GLuint index, GLenum pname, GLint * params); /* 463 */
+ void (GLAPIENTRYP ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 464 */
+ void (GLAPIENTRYP ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 465 */
+ void (GLAPIENTRYP ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 466 */
+ void (GLAPIENTRYP ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 467 */
+ void (GLAPIENTRYP ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 468 */
+ void (GLAPIENTRYP ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 469 */
+ void (GLAPIENTRYP ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 470 */
+ void (GLAPIENTRYP ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 471 */
+ void (GLAPIENTRYP ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string); /* 472 */
+ void (GLAPIENTRYP VertexAttrib1dARB)(GLuint index, GLdouble x); /* 473 */
+ void (GLAPIENTRYP VertexAttrib1dvARB)(GLuint index, const GLdouble * v); /* 474 */
+ void (GLAPIENTRYP VertexAttrib1fARB)(GLuint index, GLfloat x); /* 475 */
+ void (GLAPIENTRYP VertexAttrib1fvARB)(GLuint index, const GLfloat * v); /* 476 */
+ void (GLAPIENTRYP VertexAttrib1sARB)(GLuint index, GLshort x); /* 477 */
+ void (GLAPIENTRYP VertexAttrib1svARB)(GLuint index, const GLshort * v); /* 478 */
+ void (GLAPIENTRYP VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y); /* 479 */
+ void (GLAPIENTRYP VertexAttrib2dvARB)(GLuint index, const GLdouble * v); /* 480 */
+ void (GLAPIENTRYP VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y); /* 481 */
+ void (GLAPIENTRYP VertexAttrib2fvARB)(GLuint index, const GLfloat * v); /* 482 */
+ void (GLAPIENTRYP VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y); /* 483 */
+ void (GLAPIENTRYP VertexAttrib2svARB)(GLuint index, const GLshort * v); /* 484 */
+ void (GLAPIENTRYP VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 485 */
+ void (GLAPIENTRYP VertexAttrib3dvARB)(GLuint index, const GLdouble * v); /* 486 */
+ void (GLAPIENTRYP VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 487 */
+ void (GLAPIENTRYP VertexAttrib3fvARB)(GLuint index, const GLfloat * v); /* 488 */
+ void (GLAPIENTRYP VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z); /* 489 */
+ void (GLAPIENTRYP VertexAttrib3svARB)(GLuint index, const GLshort * v); /* 490 */
+ void (GLAPIENTRYP VertexAttrib4NbvARB)(GLuint index, const GLbyte * v); /* 491 */
+ void (GLAPIENTRYP VertexAttrib4NivARB)(GLuint index, const GLint * v); /* 492 */
+ void (GLAPIENTRYP VertexAttrib4NsvARB)(GLuint index, const GLshort * v); /* 493 */
+ void (GLAPIENTRYP VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 494 */
+ void (GLAPIENTRYP VertexAttrib4NubvARB)(GLuint index, const GLubyte * v); /* 495 */
+ void (GLAPIENTRYP VertexAttrib4NuivARB)(GLuint index, const GLuint * v); /* 496 */
+ void (GLAPIENTRYP VertexAttrib4NusvARB)(GLuint index, const GLushort * v); /* 497 */
+ void (GLAPIENTRYP VertexAttrib4bvARB)(GLuint index, const GLbyte * v); /* 498 */
+ void (GLAPIENTRYP VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 499 */
+ void (GLAPIENTRYP VertexAttrib4dvARB)(GLuint index, const GLdouble * v); /* 500 */
+ void (GLAPIENTRYP VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 501 */
+ void (GLAPIENTRYP VertexAttrib4fvARB)(GLuint index, const GLfloat * v); /* 502 */
+ void (GLAPIENTRYP VertexAttrib4ivARB)(GLuint index, const GLint * v); /* 503 */
+ void (GLAPIENTRYP VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 504 */
+ void (GLAPIENTRYP VertexAttrib4svARB)(GLuint index, const GLshort * v); /* 505 */
+ void (GLAPIENTRYP VertexAttrib4ubvARB)(GLuint index, const GLubyte * v); /* 506 */
+ void (GLAPIENTRYP VertexAttrib4uivARB)(GLuint index, const GLuint * v); /* 507 */
+ void (GLAPIENTRYP VertexAttrib4usvARB)(GLuint index, const GLushort * v); /* 508 */
+ void (GLAPIENTRYP VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); /* 509 */
+ void (GLAPIENTRYP BindBufferARB)(GLenum target, GLuint buffer); /* 510 */
+ void (GLAPIENTRYP BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); /* 511 */
+ void (GLAPIENTRYP BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); /* 512 */
+ void (GLAPIENTRYP DeleteBuffersARB)(GLsizei n, const GLuint * buffer); /* 513 */
+ void (GLAPIENTRYP GenBuffersARB)(GLsizei n, GLuint * buffer); /* 514 */
+ void (GLAPIENTRYP GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params); /* 515 */
+ void (GLAPIENTRYP GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params); /* 516 */
+ void (GLAPIENTRYP GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data); /* 517 */
+ GLboolean (GLAPIENTRYP IsBufferARB)(GLuint buffer); /* 518 */
+ GLvoid * (GLAPIENTRYP MapBufferARB)(GLenum target, GLenum access); /* 519 */
+ GLboolean (GLAPIENTRYP UnmapBufferARB)(GLenum target); /* 520 */
+ void (GLAPIENTRYP BeginQueryARB)(GLenum target, GLuint id); /* 521 */
+ void (GLAPIENTRYP DeleteQueriesARB)(GLsizei n, const GLuint * ids); /* 522 */
+ void (GLAPIENTRYP EndQueryARB)(GLenum target); /* 523 */
+ void (GLAPIENTRYP GenQueriesARB)(GLsizei n, GLuint * ids); /* 524 */
+ void (GLAPIENTRYP GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params); /* 525 */
+ void (GLAPIENTRYP GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params); /* 526 */
+ void (GLAPIENTRYP GetQueryivARB)(GLenum target, GLenum pname, GLint * params); /* 527 */
+ GLboolean (GLAPIENTRYP IsQueryARB)(GLuint id); /* 528 */
+ void (GLAPIENTRYP AttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj); /* 529 */
+ void (GLAPIENTRYP CompileShaderARB)(GLhandleARB shader); /* 530 */
+ GLhandleARB (GLAPIENTRYP CreateProgramObjectARB)(void); /* 531 */
+ GLhandleARB (GLAPIENTRYP CreateShaderObjectARB)(GLenum shaderType); /* 532 */
+ void (GLAPIENTRYP DeleteObjectARB)(GLhandleARB obj); /* 533 */
+ void (GLAPIENTRYP DetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj); /* 534 */
+ void (GLAPIENTRYP GetActiveUniformARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 535 */
+ void (GLAPIENTRYP GetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxLength, GLsizei * length, GLhandleARB * infoLog); /* 536 */
+ GLhandleARB (GLAPIENTRYP GetHandleARB)(GLenum pname); /* 537 */
+ void (GLAPIENTRYP GetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog); /* 538 */
+ void (GLAPIENTRYP GetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat * params); /* 539 */
+ void (GLAPIENTRYP GetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint * params); /* 540 */
+ void (GLAPIENTRYP GetShaderSourceARB)(GLhandleARB shader, GLsizei bufSize, GLsizei * length, GLcharARB * source); /* 541 */
+ GLint (GLAPIENTRYP GetUniformLocationARB)(GLhandleARB program, const GLcharARB * name); /* 542 */
+ void (GLAPIENTRYP GetUniformfvARB)(GLhandleARB program, GLint location, GLfloat * params); /* 543 */
+ void (GLAPIENTRYP GetUniformivARB)(GLhandleARB program, GLint location, GLint * params); /* 544 */
+ void (GLAPIENTRYP LinkProgramARB)(GLhandleARB program); /* 545 */
+ void (GLAPIENTRYP ShaderSourceARB)(GLhandleARB shader, GLsizei count, const GLcharARB ** string, const GLint * length); /* 546 */
+ void (GLAPIENTRYP Uniform1fARB)(GLint location, GLfloat v0); /* 547 */
+ void (GLAPIENTRYP Uniform1fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 548 */
+ void (GLAPIENTRYP Uniform1iARB)(GLint location, GLint v0); /* 549 */
+ void (GLAPIENTRYP Uniform1ivARB)(GLint location, GLsizei count, const GLint * value); /* 550 */
+ void (GLAPIENTRYP Uniform2fARB)(GLint location, GLfloat v0, GLfloat v1); /* 551 */
+ void (GLAPIENTRYP Uniform2fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 552 */
+ void (GLAPIENTRYP Uniform2iARB)(GLint location, GLint v0, GLint v1); /* 553 */
+ void (GLAPIENTRYP Uniform2ivARB)(GLint location, GLsizei count, const GLint * value); /* 554 */
+ void (GLAPIENTRYP Uniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); /* 555 */
+ void (GLAPIENTRYP Uniform3fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 556 */
+ void (GLAPIENTRYP Uniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2); /* 557 */
+ void (GLAPIENTRYP Uniform3ivARB)(GLint location, GLsizei count, const GLint * value); /* 558 */
+ void (GLAPIENTRYP Uniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); /* 559 */
+ void (GLAPIENTRYP Uniform4fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 560 */
+ void (GLAPIENTRYP Uniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); /* 561 */
+ void (GLAPIENTRYP Uniform4ivARB)(GLint location, GLsizei count, const GLint * value); /* 562 */
+ void (GLAPIENTRYP UniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 563 */
+ void (GLAPIENTRYP UniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 564 */
+ void (GLAPIENTRYP UniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 565 */
+ void (GLAPIENTRYP UseProgramObjectARB)(GLhandleARB program); /* 566 */
+ void (GLAPIENTRYP ValidateProgramARB)(GLhandleARB program); /* 567 */
+ void (GLAPIENTRYP BindAttribLocationARB)(GLhandleARB program, GLuint index, const GLcharARB * name); /* 568 */
+ void (GLAPIENTRYP GetActiveAttribARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 569 */
+ GLint (GLAPIENTRYP GetAttribLocationARB)(GLhandleARB program, const GLcharARB * name); /* 570 */
+ void (GLAPIENTRYP DrawBuffersARB)(GLsizei n, const GLenum * bufs); /* 571 */
+ void (GLAPIENTRYP ClampColorARB)(GLenum target, GLenum clamp); /* 572 */
+ void (GLAPIENTRYP DrawArraysInstancedARB)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); /* 573 */
+ void (GLAPIENTRYP DrawElementsInstancedARB)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei primcount); /* 574 */
+ void (GLAPIENTRYP RenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); /* 575 */
+ void (GLAPIENTRYP FramebufferTextureARB)(GLenum target, GLenum attachment, GLuint texture, GLint level); /* 576 */
+ void (GLAPIENTRYP FramebufferTextureFaceARB)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); /* 577 */
+ void (GLAPIENTRYP ProgramParameteriARB)(GLuint program, GLenum pname, GLint value); /* 578 */
+ void (GLAPIENTRYP VertexAttribDivisorARB)(GLuint index, GLuint divisor); /* 579 */
+ void (GLAPIENTRYP FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length); /* 580 */
+ GLvoid * (GLAPIENTRYP MapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); /* 581 */
+ void (GLAPIENTRYP TexBufferARB)(GLenum target, GLenum internalFormat, GLuint buffer); /* 582 */
+ void (GLAPIENTRYP BindVertexArray)(GLuint array); /* 583 */
+ void (GLAPIENTRYP GenVertexArrays)(GLsizei n, GLuint * arrays); /* 584 */
+ void (GLAPIENTRYP CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); /* 585 */
+ GLenum (GLAPIENTRYP ClientWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); /* 586 */
+ void (GLAPIENTRYP DeleteSync)(GLsync sync); /* 587 */
+ GLsync (GLAPIENTRYP FenceSync)(GLenum condition, GLbitfield flags); /* 588 */
+ void (GLAPIENTRYP GetInteger64v)(GLenum pname, GLint64 * params); /* 589 */
+ void (GLAPIENTRYP GetSynciv)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values); /* 590 */
+ GLboolean (GLAPIENTRYP IsSync)(GLsync sync); /* 591 */
+ void (GLAPIENTRYP WaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); /* 592 */
+ void (GLAPIENTRYP DrawElementsBaseVertex)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); /* 593 */
+ void (GLAPIENTRYP DrawElementsInstancedBaseVertex)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei primcount, GLint basevertex); /* 594 */
+ void (GLAPIENTRYP DrawRangeElementsBaseVertex)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); /* 595 */
+ void (GLAPIENTRYP MultiDrawElementsBaseVertex)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount, const GLint * basevertex); /* 596 */
+ void (GLAPIENTRYP BlendEquationSeparateiARB)(GLuint buf, GLenum modeRGB, GLenum modeA); /* 597 */
+ void (GLAPIENTRYP BlendEquationiARB)(GLuint buf, GLenum mode); /* 598 */
+ void (GLAPIENTRYP BlendFuncSeparateiARB)(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcA, GLenum dstA); /* 599 */
+ void (GLAPIENTRYP BlendFunciARB)(GLuint buf, GLenum src, GLenum dst); /* 600 */
+ void (GLAPIENTRYP BindSampler)(GLuint unit, GLuint sampler); /* 601 */
+ void (GLAPIENTRYP DeleteSamplers)(GLsizei count, const GLuint * samplers); /* 602 */
+ void (GLAPIENTRYP GenSamplers)(GLsizei count, GLuint * samplers); /* 603 */
+ void (GLAPIENTRYP GetSamplerParameterIiv)(GLuint sampler, GLenum pname, GLint * params); /* 604 */
+ void (GLAPIENTRYP GetSamplerParameterIuiv)(GLuint sampler, GLenum pname, GLuint * params); /* 605 */
+ void (GLAPIENTRYP GetSamplerParameterfv)(GLuint sampler, GLenum pname, GLfloat * params); /* 606 */
+ void (GLAPIENTRYP GetSamplerParameteriv)(GLuint sampler, GLenum pname, GLint * params); /* 607 */
+ GLboolean (GLAPIENTRYP IsSampler)(GLuint sampler); /* 608 */
+ void (GLAPIENTRYP SamplerParameterIiv)(GLuint sampler, GLenum pname, const GLint * params); /* 609 */
+ void (GLAPIENTRYP SamplerParameterIuiv)(GLuint sampler, GLenum pname, const GLuint * params); /* 610 */
+ void (GLAPIENTRYP SamplerParameterf)(GLuint sampler, GLenum pname, GLfloat param); /* 611 */
+ void (GLAPIENTRYP SamplerParameterfv)(GLuint sampler, GLenum pname, const GLfloat * params); /* 612 */
+ void (GLAPIENTRYP SamplerParameteri)(GLuint sampler, GLenum pname, GLint param); /* 613 */
+ void (GLAPIENTRYP SamplerParameteriv)(GLuint sampler, GLenum pname, const GLint * params); /* 614 */
+ void (GLAPIENTRYP ColorP3ui)(GLenum type, GLuint color); /* 615 */
+ void (GLAPIENTRYP ColorP3uiv)(GLenum type, const GLuint * color); /* 616 */
+ void (GLAPIENTRYP ColorP4ui)(GLenum type, GLuint color); /* 617 */
+ void (GLAPIENTRYP ColorP4uiv)(GLenum type, const GLuint * color); /* 618 */
+ void (GLAPIENTRYP MultiTexCoordP1ui)(GLenum texture, GLenum type, GLuint coords); /* 619 */
+ void (GLAPIENTRYP MultiTexCoordP1uiv)(GLenum texture, GLenum type, const GLuint * coords); /* 620 */
+ void (GLAPIENTRYP MultiTexCoordP2ui)(GLenum texture, GLenum type, GLuint coords); /* 621 */
+ void (GLAPIENTRYP MultiTexCoordP2uiv)(GLenum texture, GLenum type, const GLuint * coords); /* 622 */
+ void (GLAPIENTRYP MultiTexCoordP3ui)(GLenum texture, GLenum type, GLuint coords); /* 623 */
+ void (GLAPIENTRYP MultiTexCoordP3uiv)(GLenum texture, GLenum type, const GLuint * coords); /* 624 */
+ void (GLAPIENTRYP MultiTexCoordP4ui)(GLenum texture, GLenum type, GLuint coords); /* 625 */
+ void (GLAPIENTRYP MultiTexCoordP4uiv)(GLenum texture, GLenum type, const GLuint * coords); /* 626 */
+ void (GLAPIENTRYP NormalP3ui)(GLenum type, GLuint coords); /* 627 */
+ void (GLAPIENTRYP NormalP3uiv)(GLenum type, const GLuint * coords); /* 628 */
+ void (GLAPIENTRYP SecondaryColorP3ui)(GLenum type, GLuint color); /* 629 */
+ void (GLAPIENTRYP SecondaryColorP3uiv)(GLenum type, const GLuint * color); /* 630 */
+ void (GLAPIENTRYP TexCoordP1ui)(GLenum type, GLuint coords); /* 631 */
+ void (GLAPIENTRYP TexCoordP1uiv)(GLenum type, const GLuint * coords); /* 632 */
+ void (GLAPIENTRYP TexCoordP2ui)(GLenum type, GLuint coords); /* 633 */
+ void (GLAPIENTRYP TexCoordP2uiv)(GLenum type, const GLuint * coords); /* 634 */
+ void (GLAPIENTRYP TexCoordP3ui)(GLenum type, GLuint coords); /* 635 */
+ void (GLAPIENTRYP TexCoordP3uiv)(GLenum type, const GLuint * coords); /* 636 */
+ void (GLAPIENTRYP TexCoordP4ui)(GLenum type, GLuint coords); /* 637 */
+ void (GLAPIENTRYP TexCoordP4uiv)(GLenum type, const GLuint * coords); /* 638 */
+ void (GLAPIENTRYP VertexAttribP1ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); /* 639 */
+ void (GLAPIENTRYP VertexAttribP1uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); /* 640 */
+ void (GLAPIENTRYP VertexAttribP2ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); /* 641 */
+ void (GLAPIENTRYP VertexAttribP2uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); /* 642 */
+ void (GLAPIENTRYP VertexAttribP3ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); /* 643 */
+ void (GLAPIENTRYP VertexAttribP3uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); /* 644 */
+ void (GLAPIENTRYP VertexAttribP4ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value); /* 645 */
+ void (GLAPIENTRYP VertexAttribP4uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); /* 646 */
+ void (GLAPIENTRYP VertexP2ui)(GLenum type, GLuint value); /* 647 */
+ void (GLAPIENTRYP VertexP2uiv)(GLenum type, const GLuint * value); /* 648 */
+ void (GLAPIENTRYP VertexP3ui)(GLenum type, GLuint value); /* 649 */
+ void (GLAPIENTRYP VertexP3uiv)(GLenum type, const GLuint * value); /* 650 */
+ void (GLAPIENTRYP VertexP4ui)(GLenum type, GLuint value); /* 651 */
+ void (GLAPIENTRYP VertexP4uiv)(GLenum type, const GLuint * value); /* 652 */
+ void (GLAPIENTRYP BindTransformFeedback)(GLenum target, GLuint id); /* 653 */
+ void (GLAPIENTRYP DeleteTransformFeedbacks)(GLsizei n, const GLuint * ids); /* 654 */
+ void (GLAPIENTRYP DrawTransformFeedback)(GLenum mode, GLuint id); /* 655 */
+ void (GLAPIENTRYP GenTransformFeedbacks)(GLsizei n, GLuint * ids); /* 656 */
+ GLboolean (GLAPIENTRYP IsTransformFeedback)(GLuint id); /* 657 */
+ void (GLAPIENTRYP PauseTransformFeedback)(void); /* 658 */
+ void (GLAPIENTRYP ResumeTransformFeedback)(void); /* 659 */
+ void (GLAPIENTRYP ClearDepthf)(GLclampf depth); /* 660 */
+ void (GLAPIENTRYP DepthRangef)(GLclampf zNear, GLclampf zFar); /* 661 */
+ void (GLAPIENTRYP GetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision); /* 662 */
+ void (GLAPIENTRYP ReleaseShaderCompiler)(void); /* 663 */
+ void (GLAPIENTRYP ShaderBinary)(GLsizei n, const GLuint * shaders, GLenum binaryformat, const GLvoid * binary, GLsizei length); /* 664 */
+ void (GLAPIENTRYP DebugMessageCallbackARB)(GLDEBUGPROCARB callback, GLvoid * userParam); /* 665 */
+ void (GLAPIENTRYP DebugMessageControlARB)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled); /* 666 */
+ void (GLAPIENTRYP DebugMessageInsertARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLcharARB * buf); /* 667 */
+ GLuint (GLAPIENTRYP GetDebugMessageLogARB)(GLuint count, GLsizei bufsize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLcharARB * messageLog); /* 668 */
+ GLenum (GLAPIENTRYP GetGraphicsResetStatusARB)(void); /* 669 */
+ void (GLAPIENTRYP GetnColorTableARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * table); /* 670 */
+ void (GLAPIENTRYP GetnCompressedTexImageARB)(GLenum target, GLint lod, GLsizei bufSize, GLvoid * img); /* 671 */
+ void (GLAPIENTRYP GetnConvolutionFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * image); /* 672 */
+ void (GLAPIENTRYP GetnHistogramARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values); /* 673 */
+ void (GLAPIENTRYP GetnMapdvARB)(GLenum target, GLenum query, GLsizei bufSize, GLdouble * v); /* 674 */
+ void (GLAPIENTRYP GetnMapfvARB)(GLenum target, GLenum query, GLsizei bufSize, GLfloat * v); /* 675 */
+ void (GLAPIENTRYP GetnMapivARB)(GLenum target, GLenum query, GLsizei bufSize, GLint * v); /* 676 */
+ void (GLAPIENTRYP GetnMinmaxARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values); /* 677 */
+ void (GLAPIENTRYP GetnPixelMapfvARB)(GLenum map, GLsizei bufSize, GLfloat * values); /* 678 */
+ void (GLAPIENTRYP GetnPixelMapuivARB)(GLenum map, GLsizei bufSize, GLuint * values); /* 679 */
+ void (GLAPIENTRYP GetnPixelMapusvARB)(GLenum map, GLsizei bufSize, GLushort * values); /* 680 */
+ void (GLAPIENTRYP GetnPolygonStippleARB)(GLsizei bufSize, GLubyte * pattern); /* 681 */
+ void (GLAPIENTRYP GetnSeparableFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid * row, GLsizei columnBufSize, GLvoid * column, GLvoid * span); /* 682 */
+ void (GLAPIENTRYP GetnTexImageARB)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid * img); /* 683 */
+ void (GLAPIENTRYP GetnUniformdvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLdouble * params); /* 684 */
+ void (GLAPIENTRYP GetnUniformfvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLfloat * params); /* 685 */
+ void (GLAPIENTRYP GetnUniformivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLint * params); /* 686 */
+ void (GLAPIENTRYP GetnUniformuivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLuint * params); /* 687 */
+ void (GLAPIENTRYP ReadnPixelsARB)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid * data); /* 688 */
+ void (GLAPIENTRYP TexStorage1D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width); /* 689 */
+ void (GLAPIENTRYP TexStorage2D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height); /* 690 */
+ void (GLAPIENTRYP TexStorage3D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth); /* 691 */
+ void (GLAPIENTRYP TextureStorage1DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width); /* 692 */
+ void (GLAPIENTRYP TextureStorage2DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height); /* 693 */
+ void (GLAPIENTRYP TextureStorage3DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth); /* 694 */
+ void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 695 */
+ void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 696 */
+ void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 697 */
+ void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 698 */
+ void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 699 */
+ void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 700 */
+ void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 701 */
+ void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 702 */
+ void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 703 */
+ void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 704 */
+ void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 705 */
+ void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 706 */
+ void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 707 */
+ void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 708 */
+ void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 709 */
+ void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 710 */
+ void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 711 */
+ void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 712 */
+ void (GLAPIENTRYP UnlockArraysEXT)(void); /* 713 */
+ void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 714 */
+ void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 715 */
+ void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 716 */
+ void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 717 */
+ void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 718 */
+ void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 719 */
+ void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 720 */
+ void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 721 */
+ void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 722 */
+ void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 723 */
+ void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 724 */
+ void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 725 */
+ void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 726 */
+ void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 727 */
+ void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 728 */
+ void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 729 */
+ void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 730 */
+ void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 731 */
+ void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 732 */
+ void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 733 */
+ void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 734 */
+ void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 735 */
+ void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 736 */
+ void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 737 */
+ void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 738 */
+ void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 739 */
+ void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 740 */
+ void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 741 */
+ void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 742 */
+ void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 743 */
+ void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 744 */
+ void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 745 */
+ void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 746 */
+ void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 747 */
+ void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 748 */
+ void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 749 */
+ void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 750 */
+ void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 751 */
+ void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 752 */
+ void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 753 */
+ void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 754 */
+ void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 755 */
+ void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 756 */
+ void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 757 */
+ void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 758 */
+ void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 759 */
+ void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 760 */
+ void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 761 */
+ void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 762 */
+ void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 763 */
+ void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 764 */
+ void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 765 */
+ void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 766 */
+ void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 767 */
+ void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 768 */
+ void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 769 */
+ void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 770 */
+ void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 771 */
+ void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 772 */
+ void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 773 */
+ void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 774 */
+ void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 775 */
+ void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 776 */
+ void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 777 */
+ void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 778 */
+ void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 779 */
+ void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 780 */
+ void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 781 */
+ void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 782 */
+ void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 783 */
+ void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 784 */
+ void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 785 */
+ GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 786 */
+ void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 787 */
+ GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 788 */
+ GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 789 */
+ void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 790 */
+ void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 791 */
+ void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 792 */
+ void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 793 */
+ void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 794 */
+ void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 795 */
+ void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 796 */
+ void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 797 */
+ void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 798 */
+ void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 799 */
+ void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 800 */
+ void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 801 */
+ void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 802 */
+ GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 803 */
+ void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 804 */
+ void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLsizei num, const GLdouble * params); /* 805 */
+ void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLsizei num, const GLfloat * params); /* 806 */
+ void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 807 */
+ void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 808 */
+ void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 809 */
+ void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 810 */
+ void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 811 */
+ void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 812 */
+ void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 813 */
+ void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 814 */
+ void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 815 */
+ void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 816 */
+ void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 817 */
+ void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 818 */
+ void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 819 */
+ void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 820 */
+ void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 821 */
+ void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 822 */
+ void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 823 */
+ void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 824 */
+ void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 825 */
+ void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 826 */
+ void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 827 */
+ void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 828 */
+ void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 829 */
+ void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 830 */
+ void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 831 */
+ void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 832 */
+ void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 833 */
+ void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 834 */
+ void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 835 */
+ void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 836 */
+ void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 837 */
+ void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 838 */
+ void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 839 */
+ void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 840 */
+ void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 841 */
+ void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 842 */
+ void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 843 */
+ void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 844 */
+ void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 845 */
+ void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 846 */
+ void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 847 */
+ void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 848 */
+ void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 849 */
+ void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 850 */
+ void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 851 */
+ void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 852 */
+ void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 853 */
+ void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 854 */
+ void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 855 */
+ void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 856 */
+ void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 857 */
+ void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 858 */
+ void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 859 */
+ void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 860 */
+ void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 861 */
+ void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 862 */
+ GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 863 */
+ void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 864 */
+ void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 865 */
+ void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 866 */
+ void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 867 */
+ void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 868 */
+ void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 869 */
+ void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 870 */
+ void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 871 */
+ void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 872 */
+ GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 873 */
+ void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 874 */
+ void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 875 */
+ void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 876 */
+ void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 877 */
+ void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 878 */
+ void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 879 */
+ void (GLAPIENTRYP PrimitiveRestartIndexNV)(GLuint index); /* 880 */
+ void (GLAPIENTRYP PrimitiveRestartNV)(void); /* 881 */
+ void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 882 */
+ void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 883 */
+ void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 884 */
+ void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 885 */
+ GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 886 */
+ void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 887 */
+ void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 888 */
+ void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 889 */
+ void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 890 */
+ void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 891 */
+ void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 892 */
+ void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 893 */
+ void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 894 */
+ void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 895 */
+ void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 896 */
+ void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 897 */
+ GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 898 */
+ GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 899 */
+ void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 900 */
+ void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 901 */
+ void (GLAPIENTRYP BufferParameteriAPPLE)(GLenum target, GLenum pname, GLint param); /* 902 */
+ void (GLAPIENTRYP FlushMappedBufferRangeAPPLE)(GLenum target, GLintptr offset, GLsizeiptr size); /* 903 */
+ void (GLAPIENTRYP BindFragDataLocationEXT)(GLuint program, GLuint colorNumber, const GLchar * name); /* 904 */
+ GLint (GLAPIENTRYP GetFragDataLocationEXT)(GLuint program, const GLchar * name); /* 905 */
+ void (GLAPIENTRYP GetUniformuivEXT)(GLuint program, GLint location, GLuint * params); /* 906 */
+ void (GLAPIENTRYP GetVertexAttribIivEXT)(GLuint index, GLenum pname, GLint * params); /* 907 */
+ void (GLAPIENTRYP GetVertexAttribIuivEXT)(GLuint index, GLenum pname, GLuint * params); /* 908 */
+ void (GLAPIENTRYP Uniform1uiEXT)(GLint location, GLuint x); /* 909 */
+ void (GLAPIENTRYP Uniform1uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 910 */
+ void (GLAPIENTRYP Uniform2uiEXT)(GLint location, GLuint x, GLuint y); /* 911 */
+ void (GLAPIENTRYP Uniform2uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 912 */
+ void (GLAPIENTRYP Uniform3uiEXT)(GLint location, GLuint x, GLuint y, GLuint z); /* 913 */
+ void (GLAPIENTRYP Uniform3uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 914 */
+ void (GLAPIENTRYP Uniform4uiEXT)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w); /* 915 */
+ void (GLAPIENTRYP Uniform4uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 916 */
+ void (GLAPIENTRYP VertexAttribI1iEXT)(GLuint index, GLint x); /* 917 */
+ void (GLAPIENTRYP VertexAttribI1ivEXT)(GLuint index, const GLint * v); /* 918 */
+ void (GLAPIENTRYP VertexAttribI1uiEXT)(GLuint index, GLuint x); /* 919 */
+ void (GLAPIENTRYP VertexAttribI1uivEXT)(GLuint index, const GLuint * v); /* 920 */
+ void (GLAPIENTRYP VertexAttribI2iEXT)(GLuint index, GLint x, GLint y); /* 921 */
+ void (GLAPIENTRYP VertexAttribI2ivEXT)(GLuint index, const GLint * v); /* 922 */
+ void (GLAPIENTRYP VertexAttribI2uiEXT)(GLuint index, GLuint x, GLuint y); /* 923 */
+ void (GLAPIENTRYP VertexAttribI2uivEXT)(GLuint index, const GLuint * v); /* 924 */
+ void (GLAPIENTRYP VertexAttribI3iEXT)(GLuint index, GLint x, GLint y, GLint z); /* 925 */
+ void (GLAPIENTRYP VertexAttribI3ivEXT)(GLuint index, const GLint * v); /* 926 */
+ void (GLAPIENTRYP VertexAttribI3uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z); /* 927 */
+ void (GLAPIENTRYP VertexAttribI3uivEXT)(GLuint index, const GLuint * v); /* 928 */
+ void (GLAPIENTRYP VertexAttribI4bvEXT)(GLuint index, const GLbyte * v); /* 929 */
+ void (GLAPIENTRYP VertexAttribI4iEXT)(GLuint index, GLint x, GLint y, GLint z, GLint w); /* 930 */
+ void (GLAPIENTRYP VertexAttribI4ivEXT)(GLuint index, const GLint * v); /* 931 */
+ void (GLAPIENTRYP VertexAttribI4svEXT)(GLuint index, const GLshort * v); /* 932 */
+ void (GLAPIENTRYP VertexAttribI4ubvEXT)(GLuint index, const GLubyte * v); /* 933 */
+ void (GLAPIENTRYP VertexAttribI4uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); /* 934 */
+ void (GLAPIENTRYP VertexAttribI4uivEXT)(GLuint index, const GLuint * v); /* 935 */
+ void (GLAPIENTRYP VertexAttribI4usvEXT)(GLuint index, const GLushort * v); /* 936 */
+ void (GLAPIENTRYP VertexAttribIPointerEXT)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 937 */
+ void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 938 */
+ void (GLAPIENTRYP ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); /* 939 */
+ void (GLAPIENTRYP DisableIndexedEXT)(GLenum target, GLuint index); /* 940 */
+ void (GLAPIENTRYP EnableIndexedEXT)(GLenum target, GLuint index); /* 941 */
+ void (GLAPIENTRYP GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean * data); /* 942 */
+ void (GLAPIENTRYP GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint * data); /* 943 */
+ GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 944 */
+ void (GLAPIENTRYP ClearColorIiEXT)(GLint r, GLint g, GLint b, GLint a); /* 945 */
+ void (GLAPIENTRYP ClearColorIuiEXT)(GLuint r, GLuint g, GLuint b, GLuint a); /* 946 */
+ void (GLAPIENTRYP GetTexParameterIivEXT)(GLenum target, GLenum pname, GLint * params); /* 947 */
+ void (GLAPIENTRYP GetTexParameterIuivEXT)(GLenum target, GLenum pname, GLuint * params); /* 948 */
+ void (GLAPIENTRYP TexParameterIivEXT)(GLenum target, GLenum pname, const GLint * params); /* 949 */
+ void (GLAPIENTRYP TexParameterIuivEXT)(GLenum target, GLenum pname, const GLuint * params); /* 950 */
+ void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 951 */
+ void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 952 */
+ void (GLAPIENTRYP BeginTransformFeedbackEXT)(GLenum mode); /* 953 */
+ void (GLAPIENTRYP BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); /* 954 */
+ void (GLAPIENTRYP BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); /* 955 */
+ void (GLAPIENTRYP BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); /* 956 */
+ void (GLAPIENTRYP EndTransformFeedbackEXT)(void); /* 957 */
+ void (GLAPIENTRYP GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); /* 958 */
+ void (GLAPIENTRYP TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode); /* 959 */
+ void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 960 */
+ void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 961 */
+ void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 962 */
+ void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 963 */
+ GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 964 */
+ GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 965 */
+ void (GLAPIENTRYP ActiveProgramEXT)(GLuint program); /* 966 */
+ GLuint (GLAPIENTRYP CreateShaderProgramEXT)(GLenum type, const GLchar * string); /* 967 */
+ void (GLAPIENTRYP UseShaderProgramEXT)(GLenum type, GLuint program); /* 968 */
+ void (GLAPIENTRYP TextureBarrierNV)(void); /* 969 */
+ void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 970 */
+ void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 971 */
+ void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 972 */
+ void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 973 */
+ void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 974 */
+ void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 975 */
+ void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 976 */
+};
+
+#endif /* !defined( _GLAPI_TABLE_H_ ) */
diff --git a/xorg-server/glx/glprocs.h b/xorg-server/glx/glprocs.h
index 3047d2f49..0b2d1b117 100644
--- a/xorg-server/glx/glprocs.h
+++ b/xorg-server/glx/glprocs.h
@@ -1,2849 +1,2849 @@
-/* DO NOT EDIT - This file generated automatically by gl_procs.py (from Mesa) script */
-
-/*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- * (C) Copyright IBM Corporation 2004, 2006
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL, IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-
-/* This file is only included by glapi.c and is used for
- * the GetProcAddress() function
- */
-
-typedef struct {
- GLint Name_offset;
-#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
- _glapi_proc Address;
-#endif
- GLuint Offset;
-} glprocs_table_t;
-
-#if !defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
-# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , o }
-#elif defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
-# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f1 , o }
-#elif defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
-# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f2 , o }
-#elif !defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
-# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f3 , o }
-#endif
-
-
-
-static const char gl_string_table[] =
- "glNewList\0"
- "glEndList\0"
- "glCallList\0"
- "glCallLists\0"
- "glDeleteLists\0"
- "glGenLists\0"
- "glListBase\0"
- "glBegin\0"
- "glBitmap\0"
- "glColor3b\0"
- "glColor3bv\0"
- "glColor3d\0"
- "glColor3dv\0"
- "glColor3f\0"
- "glColor3fv\0"
- "glColor3i\0"
- "glColor3iv\0"
- "glColor3s\0"
- "glColor3sv\0"
- "glColor3ub\0"
- "glColor3ubv\0"
- "glColor3ui\0"
- "glColor3uiv\0"
- "glColor3us\0"
- "glColor3usv\0"
- "glColor4b\0"
- "glColor4bv\0"
- "glColor4d\0"
- "glColor4dv\0"
- "glColor4f\0"
- "glColor4fv\0"
- "glColor4i\0"
- "glColor4iv\0"
- "glColor4s\0"
- "glColor4sv\0"
- "glColor4ub\0"
- "glColor4ubv\0"
- "glColor4ui\0"
- "glColor4uiv\0"
- "glColor4us\0"
- "glColor4usv\0"
- "glEdgeFlag\0"
- "glEdgeFlagv\0"
- "glEnd\0"
- "glIndexd\0"
- "glIndexdv\0"
- "glIndexf\0"
- "glIndexfv\0"
- "glIndexi\0"
- "glIndexiv\0"
- "glIndexs\0"
- "glIndexsv\0"
- "glNormal3b\0"
- "glNormal3bv\0"
- "glNormal3d\0"
- "glNormal3dv\0"
- "glNormal3f\0"
- "glNormal3fv\0"
- "glNormal3i\0"
- "glNormal3iv\0"
- "glNormal3s\0"
- "glNormal3sv\0"
- "glRasterPos2d\0"
- "glRasterPos2dv\0"
- "glRasterPos2f\0"
- "glRasterPos2fv\0"
- "glRasterPos2i\0"
- "glRasterPos2iv\0"
- "glRasterPos2s\0"
- "glRasterPos2sv\0"
- "glRasterPos3d\0"
- "glRasterPos3dv\0"
- "glRasterPos3f\0"
- "glRasterPos3fv\0"
- "glRasterPos3i\0"
- "glRasterPos3iv\0"
- "glRasterPos3s\0"
- "glRasterPos3sv\0"
- "glRasterPos4d\0"
- "glRasterPos4dv\0"
- "glRasterPos4f\0"
- "glRasterPos4fv\0"
- "glRasterPos4i\0"
- "glRasterPos4iv\0"
- "glRasterPos4s\0"
- "glRasterPos4sv\0"
- "glRectd\0"
- "glRectdv\0"
- "glRectf\0"
- "glRectfv\0"
- "glRecti\0"
- "glRectiv\0"
- "glRects\0"
- "glRectsv\0"
- "glTexCoord1d\0"
- "glTexCoord1dv\0"
- "glTexCoord1f\0"
- "glTexCoord1fv\0"
- "glTexCoord1i\0"
- "glTexCoord1iv\0"
- "glTexCoord1s\0"
- "glTexCoord1sv\0"
- "glTexCoord2d\0"
- "glTexCoord2dv\0"
- "glTexCoord2f\0"
- "glTexCoord2fv\0"
- "glTexCoord2i\0"
- "glTexCoord2iv\0"
- "glTexCoord2s\0"
- "glTexCoord2sv\0"
- "glTexCoord3d\0"
- "glTexCoord3dv\0"
- "glTexCoord3f\0"
- "glTexCoord3fv\0"
- "glTexCoord3i\0"
- "glTexCoord3iv\0"
- "glTexCoord3s\0"
- "glTexCoord3sv\0"
- "glTexCoord4d\0"
- "glTexCoord4dv\0"
- "glTexCoord4f\0"
- "glTexCoord4fv\0"
- "glTexCoord4i\0"
- "glTexCoord4iv\0"
- "glTexCoord4s\0"
- "glTexCoord4sv\0"
- "glVertex2d\0"
- "glVertex2dv\0"
- "glVertex2f\0"
- "glVertex2fv\0"
- "glVertex2i\0"
- "glVertex2iv\0"
- "glVertex2s\0"
- "glVertex2sv\0"
- "glVertex3d\0"
- "glVertex3dv\0"
- "glVertex3f\0"
- "glVertex3fv\0"
- "glVertex3i\0"
- "glVertex3iv\0"
- "glVertex3s\0"
- "glVertex3sv\0"
- "glVertex4d\0"
- "glVertex4dv\0"
- "glVertex4f\0"
- "glVertex4fv\0"
- "glVertex4i\0"
- "glVertex4iv\0"
- "glVertex4s\0"
- "glVertex4sv\0"
- "glClipPlane\0"
- "glColorMaterial\0"
- "glCullFace\0"
- "glFogf\0"
- "glFogfv\0"
- "glFogi\0"
- "glFogiv\0"
- "glFrontFace\0"
- "glHint\0"
- "glLightf\0"
- "glLightfv\0"
- "glLighti\0"
- "glLightiv\0"
- "glLightModelf\0"
- "glLightModelfv\0"
- "glLightModeli\0"
- "glLightModeliv\0"
- "glLineStipple\0"
- "glLineWidth\0"
- "glMaterialf\0"
- "glMaterialfv\0"
- "glMateriali\0"
- "glMaterialiv\0"
- "glPointSize\0"
- "glPolygonMode\0"
- "glPolygonStipple\0"
- "glScissor\0"
- "glShadeModel\0"
- "glTexParameterf\0"
- "glTexParameterfv\0"
- "glTexParameteri\0"
- "glTexParameteriv\0"
- "glTexImage1D\0"
- "glTexImage2D\0"
- "glTexEnvf\0"
- "glTexEnvfv\0"
- "glTexEnvi\0"
- "glTexEnviv\0"
- "glTexGend\0"
- "glTexGendv\0"
- "glTexGenf\0"
- "glTexGenfv\0"
- "glTexGeni\0"
- "glTexGeniv\0"
- "glFeedbackBuffer\0"
- "glSelectBuffer\0"
- "glRenderMode\0"
- "glInitNames\0"
- "glLoadName\0"
- "glPassThrough\0"
- "glPopName\0"
- "glPushName\0"
- "glDrawBuffer\0"
- "glClear\0"
- "glClearAccum\0"
- "glClearIndex\0"
- "glClearColor\0"
- "glClearStencil\0"
- "glClearDepth\0"
- "glStencilMask\0"
- "glColorMask\0"
- "glDepthMask\0"
- "glIndexMask\0"
- "glAccum\0"
- "glDisable\0"
- "glEnable\0"
- "glFinish\0"
- "glFlush\0"
- "glPopAttrib\0"
- "glPushAttrib\0"
- "glMap1d\0"
- "glMap1f\0"
- "glMap2d\0"
- "glMap2f\0"
- "glMapGrid1d\0"
- "glMapGrid1f\0"
- "glMapGrid2d\0"
- "glMapGrid2f\0"
- "glEvalCoord1d\0"
- "glEvalCoord1dv\0"
- "glEvalCoord1f\0"
- "glEvalCoord1fv\0"
- "glEvalCoord2d\0"
- "glEvalCoord2dv\0"
- "glEvalCoord2f\0"
- "glEvalCoord2fv\0"
- "glEvalMesh1\0"
- "glEvalPoint1\0"
- "glEvalMesh2\0"
- "glEvalPoint2\0"
- "glAlphaFunc\0"
- "glBlendFunc\0"
- "glLogicOp\0"
- "glStencilFunc\0"
- "glStencilOp\0"
- "glDepthFunc\0"
- "glPixelZoom\0"
- "glPixelTransferf\0"
- "glPixelTransferi\0"
- "glPixelStoref\0"
- "glPixelStorei\0"
- "glPixelMapfv\0"
- "glPixelMapuiv\0"
- "glPixelMapusv\0"
- "glReadBuffer\0"
- "glCopyPixels\0"
- "glReadPixels\0"
- "glDrawPixels\0"
- "glGetBooleanv\0"
- "glGetClipPlane\0"
- "glGetDoublev\0"
- "glGetError\0"
- "glGetFloatv\0"
- "glGetIntegerv\0"
- "glGetLightfv\0"
- "glGetLightiv\0"
- "glGetMapdv\0"
- "glGetMapfv\0"
- "glGetMapiv\0"
- "glGetMaterialfv\0"
- "glGetMaterialiv\0"
- "glGetPixelMapfv\0"
- "glGetPixelMapuiv\0"
- "glGetPixelMapusv\0"
- "glGetPolygonStipple\0"
- "glGetString\0"
- "glGetTexEnvfv\0"
- "glGetTexEnviv\0"
- "glGetTexGendv\0"
- "glGetTexGenfv\0"
- "glGetTexGeniv\0"
- "glGetTexImage\0"
- "glGetTexParameterfv\0"
- "glGetTexParameteriv\0"
- "glGetTexLevelParameterfv\0"
- "glGetTexLevelParameteriv\0"
- "glIsEnabled\0"
- "glIsList\0"
- "glDepthRange\0"
- "glFrustum\0"
- "glLoadIdentity\0"
- "glLoadMatrixf\0"
- "glLoadMatrixd\0"
- "glMatrixMode\0"
- "glMultMatrixf\0"
- "glMultMatrixd\0"
- "glOrtho\0"
- "glPopMatrix\0"
- "glPushMatrix\0"
- "glRotated\0"
- "glRotatef\0"
- "glScaled\0"
- "glScalef\0"
- "glTranslated\0"
- "glTranslatef\0"
- "glViewport\0"
- "glArrayElement\0"
- "glBindTexture\0"
- "glColorPointer\0"
- "glDisableClientState\0"
- "glDrawArrays\0"
- "glDrawElements\0"
- "glEdgeFlagPointer\0"
- "glEnableClientState\0"
- "glIndexPointer\0"
- "glIndexub\0"
- "glIndexubv\0"
- "glInterleavedArrays\0"
- "glNormalPointer\0"
- "glPolygonOffset\0"
- "glTexCoordPointer\0"
- "glVertexPointer\0"
- "glAreTexturesResident\0"
- "glCopyTexImage1D\0"
- "glCopyTexImage2D\0"
- "glCopyTexSubImage1D\0"
- "glCopyTexSubImage2D\0"
- "glDeleteTextures\0"
- "glGenTextures\0"
- "glGetPointerv\0"
- "glIsTexture\0"
- "glPrioritizeTextures\0"
- "glTexSubImage1D\0"
- "glTexSubImage2D\0"
- "glPopClientAttrib\0"
- "glPushClientAttrib\0"
- "glBlendColor\0"
- "glBlendEquation\0"
- "glDrawRangeElements\0"
- "glColorTable\0"
- "glColorTableParameterfv\0"
- "glColorTableParameteriv\0"
- "glCopyColorTable\0"
- "glGetColorTable\0"
- "glGetColorTableParameterfv\0"
- "glGetColorTableParameteriv\0"
- "glColorSubTable\0"
- "glCopyColorSubTable\0"
- "glConvolutionFilter1D\0"
- "glConvolutionFilter2D\0"
- "glConvolutionParameterf\0"
- "glConvolutionParameterfv\0"
- "glConvolutionParameteri\0"
- "glConvolutionParameteriv\0"
- "glCopyConvolutionFilter1D\0"
- "glCopyConvolutionFilter2D\0"
- "glGetConvolutionFilter\0"
- "glGetConvolutionParameterfv\0"
- "glGetConvolutionParameteriv\0"
- "glGetSeparableFilter\0"
- "glSeparableFilter2D\0"
- "glGetHistogram\0"
- "glGetHistogramParameterfv\0"
- "glGetHistogramParameteriv\0"
- "glGetMinmax\0"
- "glGetMinmaxParameterfv\0"
- "glGetMinmaxParameteriv\0"
- "glHistogram\0"
- "glMinmax\0"
- "glResetHistogram\0"
- "glResetMinmax\0"
- "glTexImage3D\0"
- "glTexSubImage3D\0"
- "glCopyTexSubImage3D\0"
- "glActiveTextureARB\0"
- "glClientActiveTextureARB\0"
- "glMultiTexCoord1dARB\0"
- "glMultiTexCoord1dvARB\0"
- "glMultiTexCoord1fARB\0"
- "glMultiTexCoord1fvARB\0"
- "glMultiTexCoord1iARB\0"
- "glMultiTexCoord1ivARB\0"
- "glMultiTexCoord1sARB\0"
- "glMultiTexCoord1svARB\0"
- "glMultiTexCoord2dARB\0"
- "glMultiTexCoord2dvARB\0"
- "glMultiTexCoord2fARB\0"
- "glMultiTexCoord2fvARB\0"
- "glMultiTexCoord2iARB\0"
- "glMultiTexCoord2ivARB\0"
- "glMultiTexCoord2sARB\0"
- "glMultiTexCoord2svARB\0"
- "glMultiTexCoord3dARB\0"
- "glMultiTexCoord3dvARB\0"
- "glMultiTexCoord3fARB\0"
- "glMultiTexCoord3fvARB\0"
- "glMultiTexCoord3iARB\0"
- "glMultiTexCoord3ivARB\0"
- "glMultiTexCoord3sARB\0"
- "glMultiTexCoord3svARB\0"
- "glMultiTexCoord4dARB\0"
- "glMultiTexCoord4dvARB\0"
- "glMultiTexCoord4fARB\0"
- "glMultiTexCoord4fvARB\0"
- "glMultiTexCoord4iARB\0"
- "glMultiTexCoord4ivARB\0"
- "glMultiTexCoord4sARB\0"
- "glMultiTexCoord4svARB\0"
- "glAttachShader\0"
- "glCreateProgram\0"
- "glCreateShader\0"
- "glDeleteProgram\0"
- "glDeleteShader\0"
- "glDetachShader\0"
- "glGetAttachedShaders\0"
- "glGetProgramInfoLog\0"
- "glGetProgramiv\0"
- "glGetShaderInfoLog\0"
- "glGetShaderiv\0"
- "glIsProgram\0"
- "glIsShader\0"
- "glStencilFuncSeparate\0"
- "glStencilMaskSeparate\0"
- "glStencilOpSeparate\0"
- "glUniformMatrix2x3fv\0"
- "glUniformMatrix2x4fv\0"
- "glUniformMatrix3x2fv\0"
- "glUniformMatrix3x4fv\0"
- "glUniformMatrix4x2fv\0"
- "glUniformMatrix4x3fv\0"
- "glClampColor\0"
- "glClearBufferfi\0"
- "glClearBufferfv\0"
- "glClearBufferiv\0"
- "glClearBufferuiv\0"
- "glGetStringi\0"
- "glTexBuffer\0"
- "glFramebufferTexture\0"
- "glGetBufferParameteri64v\0"
- "glGetInteger64i_v\0"
- "glVertexAttribDivisor\0"
- "glLoadTransposeMatrixdARB\0"
- "glLoadTransposeMatrixfARB\0"
- "glMultTransposeMatrixdARB\0"
- "glMultTransposeMatrixfARB\0"
- "glSampleCoverageARB\0"
- "glCompressedTexImage1DARB\0"
- "glCompressedTexImage2DARB\0"
- "glCompressedTexImage3DARB\0"
- "glCompressedTexSubImage1DARB\0"
- "glCompressedTexSubImage2DARB\0"
- "glCompressedTexSubImage3DARB\0"
- "glGetCompressedTexImageARB\0"
- "glDisableVertexAttribArrayARB\0"
- "glEnableVertexAttribArrayARB\0"
- "glGetProgramEnvParameterdvARB\0"
- "glGetProgramEnvParameterfvARB\0"
- "glGetProgramLocalParameterdvARB\0"
- "glGetProgramLocalParameterfvARB\0"
- "glGetProgramStringARB\0"
- "glGetProgramivARB\0"
- "glGetVertexAttribdvARB\0"
- "glGetVertexAttribfvARB\0"
- "glGetVertexAttribivARB\0"
- "glProgramEnvParameter4dARB\0"
- "glProgramEnvParameter4dvARB\0"
- "glProgramEnvParameter4fARB\0"
- "glProgramEnvParameter4fvARB\0"
- "glProgramLocalParameter4dARB\0"
- "glProgramLocalParameter4dvARB\0"
- "glProgramLocalParameter4fARB\0"
- "glProgramLocalParameter4fvARB\0"
- "glProgramStringARB\0"
- "glVertexAttrib1dARB\0"
- "glVertexAttrib1dvARB\0"
- "glVertexAttrib1fARB\0"
- "glVertexAttrib1fvARB\0"
- "glVertexAttrib1sARB\0"
- "glVertexAttrib1svARB\0"
- "glVertexAttrib2dARB\0"
- "glVertexAttrib2dvARB\0"
- "glVertexAttrib2fARB\0"
- "glVertexAttrib2fvARB\0"
- "glVertexAttrib2sARB\0"
- "glVertexAttrib2svARB\0"
- "glVertexAttrib3dARB\0"
- "glVertexAttrib3dvARB\0"
- "glVertexAttrib3fARB\0"
- "glVertexAttrib3fvARB\0"
- "glVertexAttrib3sARB\0"
- "glVertexAttrib3svARB\0"
- "glVertexAttrib4NbvARB\0"
- "glVertexAttrib4NivARB\0"
- "glVertexAttrib4NsvARB\0"
- "glVertexAttrib4NubARB\0"
- "glVertexAttrib4NubvARB\0"
- "glVertexAttrib4NuivARB\0"
- "glVertexAttrib4NusvARB\0"
- "glVertexAttrib4bvARB\0"
- "glVertexAttrib4dARB\0"
- "glVertexAttrib4dvARB\0"
- "glVertexAttrib4fARB\0"
- "glVertexAttrib4fvARB\0"
- "glVertexAttrib4ivARB\0"
- "glVertexAttrib4sARB\0"
- "glVertexAttrib4svARB\0"
- "glVertexAttrib4ubvARB\0"
- "glVertexAttrib4uivARB\0"
- "glVertexAttrib4usvARB\0"
- "glVertexAttribPointerARB\0"
- "glBindBufferARB\0"
- "glBufferDataARB\0"
- "glBufferSubDataARB\0"
- "glDeleteBuffersARB\0"
- "glGenBuffersARB\0"
- "glGetBufferParameterivARB\0"
- "glGetBufferPointervARB\0"
- "glGetBufferSubDataARB\0"
- "glIsBufferARB\0"
- "glMapBufferARB\0"
- "glUnmapBufferARB\0"
- "glBeginQueryARB\0"
- "glDeleteQueriesARB\0"
- "glEndQueryARB\0"
- "glGenQueriesARB\0"
- "glGetQueryObjectivARB\0"
- "glGetQueryObjectuivARB\0"
- "glGetQueryivARB\0"
- "glIsQueryARB\0"
- "glAttachObjectARB\0"
- "glCompileShaderARB\0"
- "glCreateProgramObjectARB\0"
- "glCreateShaderObjectARB\0"
- "glDeleteObjectARB\0"
- "glDetachObjectARB\0"
- "glGetActiveUniformARB\0"
- "glGetAttachedObjectsARB\0"
- "glGetHandleARB\0"
- "glGetInfoLogARB\0"
- "glGetObjectParameterfvARB\0"
- "glGetObjectParameterivARB\0"
- "glGetShaderSourceARB\0"
- "glGetUniformLocationARB\0"
- "glGetUniformfvARB\0"
- "glGetUniformivARB\0"
- "glLinkProgramARB\0"
- "glShaderSourceARB\0"
- "glUniform1fARB\0"
- "glUniform1fvARB\0"
- "glUniform1iARB\0"
- "glUniform1ivARB\0"
- "glUniform2fARB\0"
- "glUniform2fvARB\0"
- "glUniform2iARB\0"
- "glUniform2ivARB\0"
- "glUniform3fARB\0"
- "glUniform3fvARB\0"
- "glUniform3iARB\0"
- "glUniform3ivARB\0"
- "glUniform4fARB\0"
- "glUniform4fvARB\0"
- "glUniform4iARB\0"
- "glUniform4ivARB\0"
- "glUniformMatrix2fvARB\0"
- "glUniformMatrix3fvARB\0"
- "glUniformMatrix4fvARB\0"
- "glUseProgramObjectARB\0"
- "glValidateProgramARB\0"
- "glBindAttribLocationARB\0"
- "glGetActiveAttribARB\0"
- "glGetAttribLocationARB\0"
- "glDrawBuffersARB\0"
- "glClampColorARB\0"
- "glDrawArraysInstancedARB\0"
- "glDrawElementsInstancedARB\0"
- "glRenderbufferStorageMultisample\0"
- "glFramebufferTextureARB\0"
- "glFramebufferTextureFaceARB\0"
- "glProgramParameteriARB\0"
- "glVertexAttribDivisorARB\0"
- "glFlushMappedBufferRange\0"
- "glMapBufferRange\0"
- "glTexBufferARB\0"
- "glBindVertexArray\0"
- "glGenVertexArrays\0"
- "glCopyBufferSubData\0"
- "glClientWaitSync\0"
- "glDeleteSync\0"
- "glFenceSync\0"
- "glGetInteger64v\0"
- "glGetSynciv\0"
- "glIsSync\0"
- "glWaitSync\0"
- "glDrawElementsBaseVertex\0"
- "glDrawElementsInstancedBaseVertex\0"
- "glDrawRangeElementsBaseVertex\0"
- "glMultiDrawElementsBaseVertex\0"
- "glBlendEquationSeparateiARB\0"
- "glBlendEquationiARB\0"
- "glBlendFuncSeparateiARB\0"
- "glBlendFunciARB\0"
- "glBindSampler\0"
- "glDeleteSamplers\0"
- "glGenSamplers\0"
- "glGetSamplerParameterIiv\0"
- "glGetSamplerParameterIuiv\0"
- "glGetSamplerParameterfv\0"
- "glGetSamplerParameteriv\0"
- "glIsSampler\0"
- "glSamplerParameterIiv\0"
- "glSamplerParameterIuiv\0"
- "glSamplerParameterf\0"
- "glSamplerParameterfv\0"
- "glSamplerParameteri\0"
- "glSamplerParameteriv\0"
- "glColorP3ui\0"
- "glColorP3uiv\0"
- "glColorP4ui\0"
- "glColorP4uiv\0"
- "glMultiTexCoordP1ui\0"
- "glMultiTexCoordP1uiv\0"
- "glMultiTexCoordP2ui\0"
- "glMultiTexCoordP2uiv\0"
- "glMultiTexCoordP3ui\0"
- "glMultiTexCoordP3uiv\0"
- "glMultiTexCoordP4ui\0"
- "glMultiTexCoordP4uiv\0"
- "glNormalP3ui\0"
- "glNormalP3uiv\0"
- "glSecondaryColorP3ui\0"
- "glSecondaryColorP3uiv\0"
- "glTexCoordP1ui\0"
- "glTexCoordP1uiv\0"
- "glTexCoordP2ui\0"
- "glTexCoordP2uiv\0"
- "glTexCoordP3ui\0"
- "glTexCoordP3uiv\0"
- "glTexCoordP4ui\0"
- "glTexCoordP4uiv\0"
- "glVertexAttribP1ui\0"
- "glVertexAttribP1uiv\0"
- "glVertexAttribP2ui\0"
- "glVertexAttribP2uiv\0"
- "glVertexAttribP3ui\0"
- "glVertexAttribP3uiv\0"
- "glVertexAttribP4ui\0"
- "glVertexAttribP4uiv\0"
- "glVertexP2ui\0"
- "glVertexP2uiv\0"
- "glVertexP3ui\0"
- "glVertexP3uiv\0"
- "glVertexP4ui\0"
- "glVertexP4uiv\0"
- "glBindTransformFeedback\0"
- "glDeleteTransformFeedbacks\0"
- "glDrawTransformFeedback\0"
- "glGenTransformFeedbacks\0"
- "glIsTransformFeedback\0"
- "glPauseTransformFeedback\0"
- "glResumeTransformFeedback\0"
- "glClearDepthf\0"
- "glDepthRangef\0"
- "glGetShaderPrecisionFormat\0"
- "glReleaseShaderCompiler\0"
- "glShaderBinary\0"
- "glDebugMessageCallbackARB\0"
- "glDebugMessageControlARB\0"
- "glDebugMessageInsertARB\0"
- "glGetDebugMessageLogARB\0"
- "glGetGraphicsResetStatusARB\0"
- "glGetnColorTableARB\0"
- "glGetnCompressedTexImageARB\0"
- "glGetnConvolutionFilterARB\0"
- "glGetnHistogramARB\0"
- "glGetnMapdvARB\0"
- "glGetnMapfvARB\0"
- "glGetnMapivARB\0"
- "glGetnMinmaxARB\0"
- "glGetnPixelMapfvARB\0"
- "glGetnPixelMapuivARB\0"
- "glGetnPixelMapusvARB\0"
- "glGetnPolygonStippleARB\0"
- "glGetnSeparableFilterARB\0"
- "glGetnTexImageARB\0"
- "glGetnUniformdvARB\0"
- "glGetnUniformfvARB\0"
- "glGetnUniformivARB\0"
- "glGetnUniformuivARB\0"
- "glReadnPixelsARB\0"
- "glTexStorage1D\0"
- "glTexStorage2D\0"
- "glTexStorage3D\0"
- "glTextureStorage1DEXT\0"
- "glTextureStorage2DEXT\0"
- "glTextureStorage3DEXT\0"
- "glPolygonOffsetEXT\0"
- "glGetPixelTexGenParameterfvSGIS\0"
- "glGetPixelTexGenParameterivSGIS\0"
- "glPixelTexGenParameterfSGIS\0"
- "glPixelTexGenParameterfvSGIS\0"
- "glPixelTexGenParameteriSGIS\0"
- "glPixelTexGenParameterivSGIS\0"
- "glSampleMaskSGIS\0"
- "glSamplePatternSGIS\0"
- "glColorPointerEXT\0"
- "glEdgeFlagPointerEXT\0"
- "glIndexPointerEXT\0"
- "glNormalPointerEXT\0"
- "glTexCoordPointerEXT\0"
- "glVertexPointerEXT\0"
- "glPointParameterfEXT\0"
- "glPointParameterfvEXT\0"
- "glLockArraysEXT\0"
- "glUnlockArraysEXT\0"
- "glSecondaryColor3bEXT\0"
- "glSecondaryColor3bvEXT\0"
- "glSecondaryColor3dEXT\0"
- "glSecondaryColor3dvEXT\0"
- "glSecondaryColor3fEXT\0"
- "glSecondaryColor3fvEXT\0"
- "glSecondaryColor3iEXT\0"
- "glSecondaryColor3ivEXT\0"
- "glSecondaryColor3sEXT\0"
- "glSecondaryColor3svEXT\0"
- "glSecondaryColor3ubEXT\0"
- "glSecondaryColor3ubvEXT\0"
- "glSecondaryColor3uiEXT\0"
- "glSecondaryColor3uivEXT\0"
- "glSecondaryColor3usEXT\0"
- "glSecondaryColor3usvEXT\0"
- "glSecondaryColorPointerEXT\0"
- "glMultiDrawArraysEXT\0"
- "glMultiDrawElementsEXT\0"
- "glFogCoordPointerEXT\0"
- "glFogCoorddEXT\0"
- "glFogCoorddvEXT\0"
- "glFogCoordfEXT\0"
- "glFogCoordfvEXT\0"
- "glPixelTexGenSGIX\0"
- "glBlendFuncSeparateEXT\0"
- "glFlushVertexArrayRangeNV\0"
- "glVertexArrayRangeNV\0"
- "glCombinerInputNV\0"
- "glCombinerOutputNV\0"
- "glCombinerParameterfNV\0"
- "glCombinerParameterfvNV\0"
- "glCombinerParameteriNV\0"
- "glCombinerParameterivNV\0"
- "glFinalCombinerInputNV\0"
- "glGetCombinerInputParameterfvNV\0"
- "glGetCombinerInputParameterivNV\0"
- "glGetCombinerOutputParameterfvNV\0"
- "glGetCombinerOutputParameterivNV\0"
- "glGetFinalCombinerInputParameterfvNV\0"
- "glGetFinalCombinerInputParameterivNV\0"
- "glResizeBuffersMESA\0"
- "glWindowPos2dMESA\0"
- "glWindowPos2dvMESA\0"
- "glWindowPos2fMESA\0"
- "glWindowPos2fvMESA\0"
- "glWindowPos2iMESA\0"
- "glWindowPos2ivMESA\0"
- "glWindowPos2sMESA\0"
- "glWindowPos2svMESA\0"
- "glWindowPos3dMESA\0"
- "glWindowPos3dvMESA\0"
- "glWindowPos3fMESA\0"
- "glWindowPos3fvMESA\0"
- "glWindowPos3iMESA\0"
- "glWindowPos3ivMESA\0"
- "glWindowPos3sMESA\0"
- "glWindowPos3svMESA\0"
- "glWindowPos4dMESA\0"
- "glWindowPos4dvMESA\0"
- "glWindowPos4fMESA\0"
- "glWindowPos4fvMESA\0"
- "glWindowPos4iMESA\0"
- "glWindowPos4ivMESA\0"
- "glWindowPos4sMESA\0"
- "glWindowPos4svMESA\0"
- "glMultiModeDrawArraysIBM\0"
- "glMultiModeDrawElementsIBM\0"
- "glDeleteFencesNV\0"
- "glFinishFenceNV\0"
- "glGenFencesNV\0"
- "glGetFenceivNV\0"
- "glIsFenceNV\0"
- "glSetFenceNV\0"
- "glTestFenceNV\0"
- "glAreProgramsResidentNV\0"
- "glBindProgramNV\0"
- "glDeleteProgramsNV\0"
- "glExecuteProgramNV\0"
- "glGenProgramsNV\0"
- "glGetProgramParameterdvNV\0"
- "glGetProgramParameterfvNV\0"
- "glGetProgramStringNV\0"
- "glGetProgramivNV\0"
- "glGetTrackMatrixivNV\0"
- "glGetVertexAttribPointervNV\0"
- "glGetVertexAttribdvNV\0"
- "glGetVertexAttribfvNV\0"
- "glGetVertexAttribivNV\0"
- "glIsProgramNV\0"
- "glLoadProgramNV\0"
- "glProgramParameters4dvNV\0"
- "glProgramParameters4fvNV\0"
- "glRequestResidentProgramsNV\0"
- "glTrackMatrixNV\0"
- "glVertexAttrib1dNV\0"
- "glVertexAttrib1dvNV\0"
- "glVertexAttrib1fNV\0"
- "glVertexAttrib1fvNV\0"
- "glVertexAttrib1sNV\0"
- "glVertexAttrib1svNV\0"
- "glVertexAttrib2dNV\0"
- "glVertexAttrib2dvNV\0"
- "glVertexAttrib2fNV\0"
- "glVertexAttrib2fvNV\0"
- "glVertexAttrib2sNV\0"
- "glVertexAttrib2svNV\0"
- "glVertexAttrib3dNV\0"
- "glVertexAttrib3dvNV\0"
- "glVertexAttrib3fNV\0"
- "glVertexAttrib3fvNV\0"
- "glVertexAttrib3sNV\0"
- "glVertexAttrib3svNV\0"
- "glVertexAttrib4dNV\0"
- "glVertexAttrib4dvNV\0"
- "glVertexAttrib4fNV\0"
- "glVertexAttrib4fvNV\0"
- "glVertexAttrib4sNV\0"
- "glVertexAttrib4svNV\0"
- "glVertexAttrib4ubNV\0"
- "glVertexAttrib4ubvNV\0"
- "glVertexAttribPointerNV\0"
- "glVertexAttribs1dvNV\0"
- "glVertexAttribs1fvNV\0"
- "glVertexAttribs1svNV\0"
- "glVertexAttribs2dvNV\0"
- "glVertexAttribs2fvNV\0"
- "glVertexAttribs2svNV\0"
- "glVertexAttribs3dvNV\0"
- "glVertexAttribs3fvNV\0"
- "glVertexAttribs3svNV\0"
- "glVertexAttribs4dvNV\0"
- "glVertexAttribs4fvNV\0"
- "glVertexAttribs4svNV\0"
- "glVertexAttribs4ubvNV\0"
- "glGetTexBumpParameterfvATI\0"
- "glGetTexBumpParameterivATI\0"
- "glTexBumpParameterfvATI\0"
- "glTexBumpParameterivATI\0"
- "glAlphaFragmentOp1ATI\0"
- "glAlphaFragmentOp2ATI\0"
- "glAlphaFragmentOp3ATI\0"
- "glBeginFragmentShaderATI\0"
- "glBindFragmentShaderATI\0"
- "glColorFragmentOp1ATI\0"
- "glColorFragmentOp2ATI\0"
- "glColorFragmentOp3ATI\0"
- "glDeleteFragmentShaderATI\0"
- "glEndFragmentShaderATI\0"
- "glGenFragmentShadersATI\0"
- "glPassTexCoordATI\0"
- "glSampleMapATI\0"
- "glSetFragmentShaderConstantATI\0"
- "glPointParameteriNV\0"
- "glPointParameterivNV\0"
- "glActiveStencilFaceEXT\0"
- "glBindVertexArrayAPPLE\0"
- "glDeleteVertexArraysAPPLE\0"
- "glGenVertexArraysAPPLE\0"
- "glIsVertexArrayAPPLE\0"
- "glGetProgramNamedParameterdvNV\0"
- "glGetProgramNamedParameterfvNV\0"
- "glProgramNamedParameter4dNV\0"
- "glProgramNamedParameter4dvNV\0"
- "glProgramNamedParameter4fNV\0"
- "glProgramNamedParameter4fvNV\0"
- "glPrimitiveRestartIndexNV\0"
- "glPrimitiveRestartNV\0"
- "glDepthBoundsEXT\0"
- "glBlendEquationSeparateEXT\0"
- "glBindFramebufferEXT\0"
- "glBindRenderbufferEXT\0"
- "glCheckFramebufferStatusEXT\0"
- "glDeleteFramebuffersEXT\0"
- "glDeleteRenderbuffersEXT\0"
- "glFramebufferRenderbufferEXT\0"
- "glFramebufferTexture1DEXT\0"
- "glFramebufferTexture2DEXT\0"
- "glFramebufferTexture3DEXT\0"
- "glGenFramebuffersEXT\0"
- "glGenRenderbuffersEXT\0"
- "glGenerateMipmapEXT\0"
- "glGetFramebufferAttachmentParameterivEXT\0"
- "glGetRenderbufferParameterivEXT\0"
- "glIsFramebufferEXT\0"
- "glIsRenderbufferEXT\0"
- "glRenderbufferStorageEXT\0"
- "glBlitFramebufferEXT\0"
- "glBufferParameteriAPPLE\0"
- "glFlushMappedBufferRangeAPPLE\0"
- "glBindFragDataLocationEXT\0"
- "glGetFragDataLocationEXT\0"
- "glGetUniformuivEXT\0"
- "glGetVertexAttribIivEXT\0"
- "glGetVertexAttribIuivEXT\0"
- "glUniform1uiEXT\0"
- "glUniform1uivEXT\0"
- "glUniform2uiEXT\0"
- "glUniform2uivEXT\0"
- "glUniform3uiEXT\0"
- "glUniform3uivEXT\0"
- "glUniform4uiEXT\0"
- "glUniform4uivEXT\0"
- "glVertexAttribI1iEXT\0"
- "glVertexAttribI1ivEXT\0"
- "glVertexAttribI1uiEXT\0"
- "glVertexAttribI1uivEXT\0"
- "glVertexAttribI2iEXT\0"
- "glVertexAttribI2ivEXT\0"
- "glVertexAttribI2uiEXT\0"
- "glVertexAttribI2uivEXT\0"
- "glVertexAttribI3iEXT\0"
- "glVertexAttribI3ivEXT\0"
- "glVertexAttribI3uiEXT\0"
- "glVertexAttribI3uivEXT\0"
- "glVertexAttribI4bvEXT\0"
- "glVertexAttribI4iEXT\0"
- "glVertexAttribI4ivEXT\0"
- "glVertexAttribI4svEXT\0"
- "glVertexAttribI4ubvEXT\0"
- "glVertexAttribI4uiEXT\0"
- "glVertexAttribI4uivEXT\0"
- "glVertexAttribI4usvEXT\0"
- "glVertexAttribIPointerEXT\0"
- "glFramebufferTextureLayerEXT\0"
- "glColorMaskIndexedEXT\0"
- "glDisableIndexedEXT\0"
- "glEnableIndexedEXT\0"
- "glGetBooleanIndexedvEXT\0"
- "glGetIntegerIndexedvEXT\0"
- "glIsEnabledIndexedEXT\0"
- "glClearColorIiEXT\0"
- "glClearColorIuiEXT\0"
- "glGetTexParameterIivEXT\0"
- "glGetTexParameterIuivEXT\0"
- "glTexParameterIivEXT\0"
- "glTexParameterIuivEXT\0"
- "glBeginConditionalRenderNV\0"
- "glEndConditionalRenderNV\0"
- "glBeginTransformFeedbackEXT\0"
- "glBindBufferBaseEXT\0"
- "glBindBufferOffsetEXT\0"
- "glBindBufferRangeEXT\0"
- "glEndTransformFeedbackEXT\0"
- "glGetTransformFeedbackVaryingEXT\0"
- "glTransformFeedbackVaryingsEXT\0"
- "glProvokingVertexEXT\0"
- "glGetTexParameterPointervAPPLE\0"
- "glTextureRangeAPPLE\0"
- "glGetObjectParameterivAPPLE\0"
- "glObjectPurgeableAPPLE\0"
- "glObjectUnpurgeableAPPLE\0"
- "glActiveProgramEXT\0"
- "glCreateShaderProgramEXT\0"
- "glUseShaderProgramEXT\0"
- "glTextureBarrierNV\0"
- "glStencilFuncSeparateATI\0"
- "glProgramEnvParameters4fvEXT\0"
- "glProgramLocalParameters4fvEXT\0"
- "glGetQueryObjecti64vEXT\0"
- "glGetQueryObjectui64vEXT\0"
- "glEGLImageTargetRenderbufferStorageOES\0"
- "glEGLImageTargetTexture2DOES\0"
- "glArrayElementEXT\0"
- "glBindTextureEXT\0"
- "glDrawArraysEXT\0"
- "glAreTexturesResidentEXT\0"
- "glCopyTexImage1DEXT\0"
- "glCopyTexImage2DEXT\0"
- "glCopyTexSubImage1DEXT\0"
- "glCopyTexSubImage2DEXT\0"
- "glDeleteTexturesEXT\0"
- "glGenTexturesEXT\0"
- "glGetPointervEXT\0"
- "glIsTextureEXT\0"
- "glPrioritizeTexturesEXT\0"
- "glTexSubImage1DEXT\0"
- "glTexSubImage2DEXT\0"
- "glBlendColorEXT\0"
- "glBlendEquationEXT\0"
- "glDrawRangeElementsEXT\0"
- "glColorTableSGI\0"
- "glColorTableEXT\0"
- "glColorTableParameterfvSGI\0"
- "glColorTableParameterivSGI\0"
- "glCopyColorTableSGI\0"
- "glGetColorTableSGI\0"
- "glGetColorTableEXT\0"
- "glGetColorTableParameterfvSGI\0"
- "glGetColorTableParameterfvEXT\0"
- "glGetColorTableParameterivSGI\0"
- "glGetColorTableParameterivEXT\0"
- "glColorSubTableEXT\0"
- "glCopyColorSubTableEXT\0"
- "glConvolutionFilter1DEXT\0"
- "glConvolutionFilter2DEXT\0"
- "glConvolutionParameterfEXT\0"
- "glConvolutionParameterfvEXT\0"
- "glConvolutionParameteriEXT\0"
- "glConvolutionParameterivEXT\0"
- "glCopyConvolutionFilter1DEXT\0"
- "glCopyConvolutionFilter2DEXT\0"
- "glGetConvolutionFilterEXT\0"
- "glGetConvolutionParameterfvEXT\0"
- "glGetConvolutionParameterivEXT\0"
- "glGetSeparableFilterEXT\0"
- "glSeparableFilter2DEXT\0"
- "glGetHistogramEXT\0"
- "glGetHistogramParameterfvEXT\0"
- "glGetHistogramParameterivEXT\0"
- "glGetMinmaxEXT\0"
- "glGetMinmaxParameterfvEXT\0"
- "glGetMinmaxParameterivEXT\0"
- "glHistogramEXT\0"
- "glMinmaxEXT\0"
- "glResetHistogramEXT\0"
- "glResetMinmaxEXT\0"
- "glTexImage3DEXT\0"
- "glTexSubImage3DEXT\0"
- "glCopyTexSubImage3DEXT\0"
- "glActiveTexture\0"
- "glClientActiveTexture\0"
- "glMultiTexCoord1d\0"
- "glMultiTexCoord1dv\0"
- "glMultiTexCoord1f\0"
- "glMultiTexCoord1fv\0"
- "glMultiTexCoord1i\0"
- "glMultiTexCoord1iv\0"
- "glMultiTexCoord1s\0"
- "glMultiTexCoord1sv\0"
- "glMultiTexCoord2d\0"
- "glMultiTexCoord2dv\0"
- "glMultiTexCoord2f\0"
- "glMultiTexCoord2fv\0"
- "glMultiTexCoord2i\0"
- "glMultiTexCoord2iv\0"
- "glMultiTexCoord2s\0"
- "glMultiTexCoord2sv\0"
- "glMultiTexCoord3d\0"
- "glMultiTexCoord3dv\0"
- "glMultiTexCoord3f\0"
- "glMultiTexCoord3fv\0"
- "glMultiTexCoord3i\0"
- "glMultiTexCoord3iv\0"
- "glMultiTexCoord3s\0"
- "glMultiTexCoord3sv\0"
- "glMultiTexCoord4d\0"
- "glMultiTexCoord4dv\0"
- "glMultiTexCoord4f\0"
- "glMultiTexCoord4fv\0"
- "glMultiTexCoord4i\0"
- "glMultiTexCoord4iv\0"
- "glMultiTexCoord4s\0"
- "glMultiTexCoord4sv\0"
- "glStencilOpSeparateATI\0"
- "glLoadTransposeMatrixd\0"
- "glLoadTransposeMatrixf\0"
- "glMultTransposeMatrixd\0"
- "glMultTransposeMatrixf\0"
- "glSampleCoverage\0"
- "glCompressedTexImage1D\0"
- "glCompressedTexImage2D\0"
- "glCompressedTexImage3D\0"
- "glCompressedTexSubImage1D\0"
- "glCompressedTexSubImage2D\0"
- "glCompressedTexSubImage3D\0"
- "glGetCompressedTexImage\0"
- "glDisableVertexAttribArray\0"
- "glEnableVertexAttribArray\0"
- "glGetVertexAttribdv\0"
- "glGetVertexAttribfv\0"
- "glGetVertexAttribiv\0"
- "glProgramParameter4dNV\0"
- "glProgramParameter4dvNV\0"
- "glProgramParameter4fNV\0"
- "glProgramParameter4fvNV\0"
- "glVertexAttrib1d\0"
- "glVertexAttrib1dv\0"
- "glVertexAttrib1f\0"
- "glVertexAttrib1fv\0"
- "glVertexAttrib1s\0"
- "glVertexAttrib1sv\0"
- "glVertexAttrib2d\0"
- "glVertexAttrib2dv\0"
- "glVertexAttrib2f\0"
- "glVertexAttrib2fv\0"
- "glVertexAttrib2s\0"
- "glVertexAttrib2sv\0"
- "glVertexAttrib3d\0"
- "glVertexAttrib3dv\0"
- "glVertexAttrib3f\0"
- "glVertexAttrib3fv\0"
- "glVertexAttrib3s\0"
- "glVertexAttrib3sv\0"
- "glVertexAttrib4Nbv\0"
- "glVertexAttrib4Niv\0"
- "glVertexAttrib4Nsv\0"
- "glVertexAttrib4Nub\0"
- "glVertexAttrib4Nubv\0"
- "glVertexAttrib4Nuiv\0"
- "glVertexAttrib4Nusv\0"
- "glVertexAttrib4bv\0"
- "glVertexAttrib4d\0"
- "glVertexAttrib4dv\0"
- "glVertexAttrib4f\0"
- "glVertexAttrib4fv\0"
- "glVertexAttrib4iv\0"
- "glVertexAttrib4s\0"
- "glVertexAttrib4sv\0"
- "glVertexAttrib4ubv\0"
- "glVertexAttrib4uiv\0"
- "glVertexAttrib4usv\0"
- "glVertexAttribPointer\0"
- "glBindBuffer\0"
- "glBufferData\0"
- "glBufferSubData\0"
- "glDeleteBuffers\0"
- "glGenBuffers\0"
- "glGetBufferParameteriv\0"
- "glGetBufferPointerv\0"
- "glGetBufferSubData\0"
- "glIsBuffer\0"
- "glMapBuffer\0"
- "glUnmapBuffer\0"
- "glBeginQuery\0"
- "glDeleteQueries\0"
- "glEndQuery\0"
- "glGenQueries\0"
- "glGetQueryObjectiv\0"
- "glGetQueryObjectuiv\0"
- "glGetQueryiv\0"
- "glIsQuery\0"
- "glCompileShader\0"
- "glGetActiveUniform\0"
- "glGetShaderSource\0"
- "glGetUniformLocation\0"
- "glGetUniformfv\0"
- "glGetUniformiv\0"
- "glLinkProgram\0"
- "glShaderSource\0"
- "glUniform1f\0"
- "glUniform1fv\0"
- "glUniform1i\0"
- "glUniform1iv\0"
- "glUniform2f\0"
- "glUniform2fv\0"
- "glUniform2i\0"
- "glUniform2iv\0"
- "glUniform3f\0"
- "glUniform3fv\0"
- "glUniform3i\0"
- "glUniform3iv\0"
- "glUniform4f\0"
- "glUniform4fv\0"
- "glUniform4i\0"
- "glUniform4iv\0"
- "glUniformMatrix2fv\0"
- "glUniformMatrix3fv\0"
- "glUniformMatrix4fv\0"
- "glUseProgram\0"
- "glValidateProgram\0"
- "glBindAttribLocation\0"
- "glGetActiveAttrib\0"
- "glGetAttribLocation\0"
- "glDrawBuffers\0"
- "glDrawBuffersATI\0"
- "glDrawBuffersNV\0"
- "glDrawArraysInstancedEXT\0"
- "glDrawArraysInstanced\0"
- "glDrawElementsInstancedEXT\0"
- "glDrawElementsInstanced\0"
- "glRenderbufferStorageMultisampleEXT\0"
- "glBlendEquationSeparateIndexedAMD\0"
- "glBlendEquationIndexedAMD\0"
- "glBlendFuncSeparateIndexedAMD\0"
- "glBlendFuncIndexedAMD\0"
- "glSampleMaskEXT\0"
- "glSamplePatternEXT\0"
- "glPointParameterf\0"
- "glPointParameterfARB\0"
- "glPointParameterfSGIS\0"
- "glPointParameterfv\0"
- "glPointParameterfvARB\0"
- "glPointParameterfvSGIS\0"
- "glSecondaryColor3b\0"
- "glSecondaryColor3bv\0"
- "glSecondaryColor3d\0"
- "glSecondaryColor3dv\0"
- "glSecondaryColor3f\0"
- "glSecondaryColor3fv\0"
- "glSecondaryColor3i\0"
- "glSecondaryColor3iv\0"
- "glSecondaryColor3s\0"
- "glSecondaryColor3sv\0"
- "glSecondaryColor3ub\0"
- "glSecondaryColor3ubv\0"
- "glSecondaryColor3ui\0"
- "glSecondaryColor3uiv\0"
- "glSecondaryColor3us\0"
- "glSecondaryColor3usv\0"
- "glSecondaryColorPointer\0"
- "glMultiDrawArrays\0"
- "glMultiDrawElements\0"
- "glFogCoordPointer\0"
- "glFogCoordd\0"
- "glFogCoorddv\0"
- "glFogCoordf\0"
- "glFogCoordfv\0"
- "glBlendFuncSeparate\0"
- "glBlendFuncSeparateINGR\0"
- "glWindowPos2d\0"
- "glWindowPos2dARB\0"
- "glWindowPos2dv\0"
- "glWindowPos2dvARB\0"
- "glWindowPos2f\0"
- "glWindowPos2fARB\0"
- "glWindowPos2fv\0"
- "glWindowPos2fvARB\0"
- "glWindowPos2i\0"
- "glWindowPos2iARB\0"
- "glWindowPos2iv\0"
- "glWindowPos2ivARB\0"
- "glWindowPos2s\0"
- "glWindowPos2sARB\0"
- "glWindowPos2sv\0"
- "glWindowPos2svARB\0"
- "glWindowPos3d\0"
- "glWindowPos3dARB\0"
- "glWindowPos3dv\0"
- "glWindowPos3dvARB\0"
- "glWindowPos3f\0"
- "glWindowPos3fARB\0"
- "glWindowPos3fv\0"
- "glWindowPos3fvARB\0"
- "glWindowPos3i\0"
- "glWindowPos3iARB\0"
- "glWindowPos3iv\0"
- "glWindowPos3ivARB\0"
- "glWindowPos3s\0"
- "glWindowPos3sARB\0"
- "glWindowPos3sv\0"
- "glWindowPos3svARB\0"
- "glBindProgramARB\0"
- "glDeleteProgramsARB\0"
- "glGenProgramsARB\0"
- "glGetVertexAttribPointerv\0"
- "glGetVertexAttribPointervARB\0"
- "glIsProgramARB\0"
- "glPointParameteri\0"
- "glPointParameteriv\0"
- "glDeleteVertexArrays\0"
- "glIsVertexArray\0"
- "glPrimitiveRestartIndex\0"
- "glBlendEquationSeparate\0"
- "glBlendEquationSeparateATI\0"
- "glBindFramebuffer\0"
- "glBindRenderbuffer\0"
- "glCheckFramebufferStatus\0"
- "glDeleteFramebuffers\0"
- "glDeleteRenderbuffers\0"
- "glFramebufferRenderbuffer\0"
- "glFramebufferTexture1D\0"
- "glFramebufferTexture2D\0"
- "glFramebufferTexture3D\0"
- "glGenFramebuffers\0"
- "glGenRenderbuffers\0"
- "glGenerateMipmap\0"
- "glGetFramebufferAttachmentParameteriv\0"
- "glGetRenderbufferParameteriv\0"
- "glIsFramebuffer\0"
- "glIsRenderbuffer\0"
- "glRenderbufferStorage\0"
- "glBlitFramebuffer\0"
- "glBindFragDataLocation\0"
- "glGetFragDataLocation\0"
- "glGetUniformuiv\0"
- "glGetVertexAttribIiv\0"
- "glGetVertexAttribIuiv\0"
- "glUniform1ui\0"
- "glUniform1uiv\0"
- "glUniform2ui\0"
- "glUniform2uiv\0"
- "glUniform3ui\0"
- "glUniform3uiv\0"
- "glUniform4ui\0"
- "glUniform4uiv\0"
- "glVertexAttribI1i\0"
- "glVertexAttribI1iv\0"
- "glVertexAttribI1ui\0"
- "glVertexAttribI1uiv\0"
- "glVertexAttribI2i\0"
- "glVertexAttribI2iv\0"
- "glVertexAttribI2ui\0"
- "glVertexAttribI2uiv\0"
- "glVertexAttribI3i\0"
- "glVertexAttribI3iv\0"
- "glVertexAttribI3ui\0"
- "glVertexAttribI3uiv\0"
- "glVertexAttribI4bv\0"
- "glVertexAttribI4i\0"
- "glVertexAttribI4iv\0"
- "glVertexAttribI4sv\0"
- "glVertexAttribI4ubv\0"
- "glVertexAttribI4ui\0"
- "glVertexAttribI4uiv\0"
- "glVertexAttribI4usv\0"
- "glVertexAttribIPointer\0"
- "glFramebufferTextureLayer\0"
- "glFramebufferTextureLayerARB\0"
- "glColorMaski\0"
- "glDisablei\0"
- "glEnablei\0"
- "glGetBooleani_v\0"
- "glGetIntegeri_v\0"
- "glIsEnabledi\0"
- "glGetTexParameterIiv\0"
- "glGetTexParameterIuiv\0"
- "glTexParameterIiv\0"
- "glTexParameterIuiv\0"
- "glBeginConditionalRender\0"
- "glEndConditionalRender\0"
- "glBeginTransformFeedback\0"
- "glBindBufferBase\0"
- "glBindBufferRange\0"
- "glEndTransformFeedback\0"
- "glGetTransformFeedbackVarying\0"
- "glTransformFeedbackVaryings\0"
- "glProvokingVertex\0"
- ;
-
-
-#ifdef USE_MGL_NAMESPACE
-#define gl_dispatch_stub_343 mgl_dispatch_stub_343
-#define gl_dispatch_stub_344 mgl_dispatch_stub_344
-#define gl_dispatch_stub_345 mgl_dispatch_stub_345
-#define gl_dispatch_stub_356 mgl_dispatch_stub_356
-#define gl_dispatch_stub_357 mgl_dispatch_stub_357
-#define gl_dispatch_stub_358 mgl_dispatch_stub_358
-#define gl_dispatch_stub_359 mgl_dispatch_stub_359
-#define gl_dispatch_stub_361 mgl_dispatch_stub_361
-#define gl_dispatch_stub_362 mgl_dispatch_stub_362
-#define gl_dispatch_stub_363 mgl_dispatch_stub_363
-#define gl_dispatch_stub_364 mgl_dispatch_stub_364
-#define gl_dispatch_stub_365 mgl_dispatch_stub_365
-#define gl_dispatch_stub_366 mgl_dispatch_stub_366
-#define gl_dispatch_stub_696 mgl_dispatch_stub_696
-#define gl_dispatch_stub_697 mgl_dispatch_stub_697
-#define gl_dispatch_stub_698 mgl_dispatch_stub_698
-#define gl_dispatch_stub_699 mgl_dispatch_stub_699
-#define gl_dispatch_stub_700 mgl_dispatch_stub_700
-#define gl_dispatch_stub_701 mgl_dispatch_stub_701
-#define gl_dispatch_stub_702 mgl_dispatch_stub_702
-#define gl_dispatch_stub_703 mgl_dispatch_stub_703
-#define gl_dispatch_stub_738 mgl_dispatch_stub_738
-#define gl_dispatch_stub_780 mgl_dispatch_stub_780
-#define gl_dispatch_stub_781 mgl_dispatch_stub_781
-#define gl_dispatch_stub_782 mgl_dispatch_stub_782
-#define gl_dispatch_stub_783 mgl_dispatch_stub_783
-#define gl_dispatch_stub_784 mgl_dispatch_stub_784
-#define gl_dispatch_stub_785 mgl_dispatch_stub_785
-#define gl_dispatch_stub_786 mgl_dispatch_stub_786
-#define gl_dispatch_stub_787 mgl_dispatch_stub_787
-#define gl_dispatch_stub_788 mgl_dispatch_stub_788
-#define gl_dispatch_stub_869 mgl_dispatch_stub_869
-#define gl_dispatch_stub_870 mgl_dispatch_stub_870
-#define gl_dispatch_stub_871 mgl_dispatch_stub_871
-#define gl_dispatch_stub_872 mgl_dispatch_stub_872
-#define gl_dispatch_stub_873 mgl_dispatch_stub_873
-#define gl_dispatch_stub_882 mgl_dispatch_stub_882
-#define gl_dispatch_stub_883 mgl_dispatch_stub_883
-#define gl_dispatch_stub_901 mgl_dispatch_stub_901
-#define gl_dispatch_stub_902 mgl_dispatch_stub_902
-#define gl_dispatch_stub_903 mgl_dispatch_stub_903
-#define gl_dispatch_stub_961 mgl_dispatch_stub_961
-#define gl_dispatch_stub_962 mgl_dispatch_stub_962
-#define gl_dispatch_stub_970 mgl_dispatch_stub_970
-#define gl_dispatch_stub_971 mgl_dispatch_stub_971
-#define gl_dispatch_stub_972 mgl_dispatch_stub_972
-#define gl_dispatch_stub_973 mgl_dispatch_stub_973
-#define gl_dispatch_stub_974 mgl_dispatch_stub_974
-#endif /* USE_MGL_NAMESPACE */
-
-
-#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
-void GLAPIENTRY gl_dispatch_stub_343(GLenum target, GLenum format, GLenum type, GLvoid * table);
-void GLAPIENTRY gl_dispatch_stub_344(GLenum target, GLenum pname, GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_345(GLenum target, GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, GLvoid * image);
-void GLAPIENTRY gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_359(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span);
-void GLAPIENTRY gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
-void GLAPIENTRY gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
-void GLAPIENTRY gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_696(GLenum pname, GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_697(GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_698(GLenum pname, GLfloat param);
-void GLAPIENTRY gl_dispatch_stub_699(GLenum pname, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_700(GLenum pname, GLint param);
-void GLAPIENTRY gl_dispatch_stub_701(GLenum pname, const GLint * params);
-void GLAPIENTRY gl_dispatch_stub_702(GLclampf value, GLboolean invert);
-void GLAPIENTRY gl_dispatch_stub_703(GLenum pattern);
-void GLAPIENTRY gl_dispatch_stub_738(GLenum mode);
-void GLAPIENTRY gl_dispatch_stub_780(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);
-void GLAPIENTRY gl_dispatch_stub_781(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride);
-void GLAPIENTRY gl_dispatch_stub_782(GLsizei n, const GLuint * fences);
-void GLAPIENTRY gl_dispatch_stub_783(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_784(GLsizei n, GLuint * fences);
-void GLAPIENTRY gl_dispatch_stub_785(GLuint fence, GLenum pname, GLint * params);
-GLboolean GLAPIENTRY gl_dispatch_stub_786(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_787(GLuint fence, GLenum condition);
-GLboolean GLAPIENTRY gl_dispatch_stub_788(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_869(GLenum face);
-void GLAPIENTRY gl_dispatch_stub_870(GLuint array);
-void GLAPIENTRY gl_dispatch_stub_871(GLsizei n, const GLuint * arrays);
-void GLAPIENTRY gl_dispatch_stub_872(GLsizei n, GLuint * arrays);
-GLboolean GLAPIENTRY gl_dispatch_stub_873(GLuint array);
-void GLAPIENTRY gl_dispatch_stub_882(GLclampd zmin, GLclampd zmax);
-void GLAPIENTRY gl_dispatch_stub_883(GLenum modeRGB, GLenum modeA);
-void GLAPIENTRY gl_dispatch_stub_901(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-void GLAPIENTRY gl_dispatch_stub_902(GLenum target, GLenum pname, GLint param);
-void GLAPIENTRY gl_dispatch_stub_903(GLenum target, GLintptr offset, GLsizeiptr size);
-void GLAPIENTRY gl_dispatch_stub_961(GLenum target, GLenum pname, GLvoid ** params);
-void GLAPIENTRY gl_dispatch_stub_962(GLenum target, GLsizei length, GLvoid * pointer);
-void GLAPIENTRY gl_dispatch_stub_970(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-void GLAPIENTRY gl_dispatch_stub_971(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_972(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_973(GLuint id, GLenum pname, GLint64EXT * params);
-void GLAPIENTRY gl_dispatch_stub_974(GLuint id, GLenum pname, GLuint64EXT * params);
-#endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */
-
-static const glprocs_table_t static_functions[] = {
- NAME_FUNC_OFFSET( 0, glNewList, glNewList, NULL, 0),
- NAME_FUNC_OFFSET( 10, glEndList, glEndList, NULL, 1),
- NAME_FUNC_OFFSET( 20, glCallList, glCallList, NULL, 2),
- NAME_FUNC_OFFSET( 31, glCallLists, glCallLists, NULL, 3),
- NAME_FUNC_OFFSET( 43, glDeleteLists, glDeleteLists, NULL, 4),
- NAME_FUNC_OFFSET( 57, glGenLists, glGenLists, NULL, 5),
- NAME_FUNC_OFFSET( 68, glListBase, glListBase, NULL, 6),
- NAME_FUNC_OFFSET( 79, glBegin, glBegin, NULL, 7),
- NAME_FUNC_OFFSET( 87, glBitmap, glBitmap, NULL, 8),
- NAME_FUNC_OFFSET( 96, glColor3b, glColor3b, NULL, 9),
- NAME_FUNC_OFFSET( 106, glColor3bv, glColor3bv, NULL, 10),
- NAME_FUNC_OFFSET( 117, glColor3d, glColor3d, NULL, 11),
- NAME_FUNC_OFFSET( 127, glColor3dv, glColor3dv, NULL, 12),
- NAME_FUNC_OFFSET( 138, glColor3f, glColor3f, NULL, 13),
- NAME_FUNC_OFFSET( 148, glColor3fv, glColor3fv, NULL, 14),
- NAME_FUNC_OFFSET( 159, glColor3i, glColor3i, NULL, 15),
- NAME_FUNC_OFFSET( 169, glColor3iv, glColor3iv, NULL, 16),
- NAME_FUNC_OFFSET( 180, glColor3s, glColor3s, NULL, 17),
- NAME_FUNC_OFFSET( 190, glColor3sv, glColor3sv, NULL, 18),
- NAME_FUNC_OFFSET( 201, glColor3ub, glColor3ub, NULL, 19),
- NAME_FUNC_OFFSET( 212, glColor3ubv, glColor3ubv, NULL, 20),
- NAME_FUNC_OFFSET( 224, glColor3ui, glColor3ui, NULL, 21),
- NAME_FUNC_OFFSET( 235, glColor3uiv, glColor3uiv, NULL, 22),
- NAME_FUNC_OFFSET( 247, glColor3us, glColor3us, NULL, 23),
- NAME_FUNC_OFFSET( 258, glColor3usv, glColor3usv, NULL, 24),
- NAME_FUNC_OFFSET( 270, glColor4b, glColor4b, NULL, 25),
- NAME_FUNC_OFFSET( 280, glColor4bv, glColor4bv, NULL, 26),
- NAME_FUNC_OFFSET( 291, glColor4d, glColor4d, NULL, 27),
- NAME_FUNC_OFFSET( 301, glColor4dv, glColor4dv, NULL, 28),
- NAME_FUNC_OFFSET( 312, glColor4f, glColor4f, NULL, 29),
- NAME_FUNC_OFFSET( 322, glColor4fv, glColor4fv, NULL, 30),
- NAME_FUNC_OFFSET( 333, glColor4i, glColor4i, NULL, 31),
- NAME_FUNC_OFFSET( 343, glColor4iv, glColor4iv, NULL, 32),
- NAME_FUNC_OFFSET( 354, glColor4s, glColor4s, NULL, 33),
- NAME_FUNC_OFFSET( 364, glColor4sv, glColor4sv, NULL, 34),
- NAME_FUNC_OFFSET( 375, glColor4ub, glColor4ub, NULL, 35),
- NAME_FUNC_OFFSET( 386, glColor4ubv, glColor4ubv, NULL, 36),
- NAME_FUNC_OFFSET( 398, glColor4ui, glColor4ui, NULL, 37),
- NAME_FUNC_OFFSET( 409, glColor4uiv, glColor4uiv, NULL, 38),
- NAME_FUNC_OFFSET( 421, glColor4us, glColor4us, NULL, 39),
- NAME_FUNC_OFFSET( 432, glColor4usv, glColor4usv, NULL, 40),
- NAME_FUNC_OFFSET( 444, glEdgeFlag, glEdgeFlag, NULL, 41),
- NAME_FUNC_OFFSET( 455, glEdgeFlagv, glEdgeFlagv, NULL, 42),
- NAME_FUNC_OFFSET( 467, glEnd, glEnd, NULL, 43),
- NAME_FUNC_OFFSET( 473, glIndexd, glIndexd, NULL, 44),
- NAME_FUNC_OFFSET( 482, glIndexdv, glIndexdv, NULL, 45),
- NAME_FUNC_OFFSET( 492, glIndexf, glIndexf, NULL, 46),
- NAME_FUNC_OFFSET( 501, glIndexfv, glIndexfv, NULL, 47),
- NAME_FUNC_OFFSET( 511, glIndexi, glIndexi, NULL, 48),
- NAME_FUNC_OFFSET( 520, glIndexiv, glIndexiv, NULL, 49),
- NAME_FUNC_OFFSET( 530, glIndexs, glIndexs, NULL, 50),
- NAME_FUNC_OFFSET( 539, glIndexsv, glIndexsv, NULL, 51),
- NAME_FUNC_OFFSET( 549, glNormal3b, glNormal3b, NULL, 52),
- NAME_FUNC_OFFSET( 560, glNormal3bv, glNormal3bv, NULL, 53),
- NAME_FUNC_OFFSET( 572, glNormal3d, glNormal3d, NULL, 54),
- NAME_FUNC_OFFSET( 583, glNormal3dv, glNormal3dv, NULL, 55),
- NAME_FUNC_OFFSET( 595, glNormal3f, glNormal3f, NULL, 56),
- NAME_FUNC_OFFSET( 606, glNormal3fv, glNormal3fv, NULL, 57),
- NAME_FUNC_OFFSET( 618, glNormal3i, glNormal3i, NULL, 58),
- NAME_FUNC_OFFSET( 629, glNormal3iv, glNormal3iv, NULL, 59),
- NAME_FUNC_OFFSET( 641, glNormal3s, glNormal3s, NULL, 60),
- NAME_FUNC_OFFSET( 652, glNormal3sv, glNormal3sv, NULL, 61),
- NAME_FUNC_OFFSET( 664, glRasterPos2d, glRasterPos2d, NULL, 62),
- NAME_FUNC_OFFSET( 678, glRasterPos2dv, glRasterPos2dv, NULL, 63),
- NAME_FUNC_OFFSET( 693, glRasterPos2f, glRasterPos2f, NULL, 64),
- NAME_FUNC_OFFSET( 707, glRasterPos2fv, glRasterPos2fv, NULL, 65),
- NAME_FUNC_OFFSET( 722, glRasterPos2i, glRasterPos2i, NULL, 66),
- NAME_FUNC_OFFSET( 736, glRasterPos2iv, glRasterPos2iv, NULL, 67),
- NAME_FUNC_OFFSET( 751, glRasterPos2s, glRasterPos2s, NULL, 68),
- NAME_FUNC_OFFSET( 765, glRasterPos2sv, glRasterPos2sv, NULL, 69),
- NAME_FUNC_OFFSET( 780, glRasterPos3d, glRasterPos3d, NULL, 70),
- NAME_FUNC_OFFSET( 794, glRasterPos3dv, glRasterPos3dv, NULL, 71),
- NAME_FUNC_OFFSET( 809, glRasterPos3f, glRasterPos3f, NULL, 72),
- NAME_FUNC_OFFSET( 823, glRasterPos3fv, glRasterPos3fv, NULL, 73),
- NAME_FUNC_OFFSET( 838, glRasterPos3i, glRasterPos3i, NULL, 74),
- NAME_FUNC_OFFSET( 852, glRasterPos3iv, glRasterPos3iv, NULL, 75),
- NAME_FUNC_OFFSET( 867, glRasterPos3s, glRasterPos3s, NULL, 76),
- NAME_FUNC_OFFSET( 881, glRasterPos3sv, glRasterPos3sv, NULL, 77),
- NAME_FUNC_OFFSET( 896, glRasterPos4d, glRasterPos4d, NULL, 78),
- NAME_FUNC_OFFSET( 910, glRasterPos4dv, glRasterPos4dv, NULL, 79),
- NAME_FUNC_OFFSET( 925, glRasterPos4f, glRasterPos4f, NULL, 80),
- NAME_FUNC_OFFSET( 939, glRasterPos4fv, glRasterPos4fv, NULL, 81),
- NAME_FUNC_OFFSET( 954, glRasterPos4i, glRasterPos4i, NULL, 82),
- NAME_FUNC_OFFSET( 968, glRasterPos4iv, glRasterPos4iv, NULL, 83),
- NAME_FUNC_OFFSET( 983, glRasterPos4s, glRasterPos4s, NULL, 84),
- NAME_FUNC_OFFSET( 997, glRasterPos4sv, glRasterPos4sv, NULL, 85),
- NAME_FUNC_OFFSET( 1012, glRectd, glRectd, NULL, 86),
- NAME_FUNC_OFFSET( 1020, glRectdv, glRectdv, NULL, 87),
- NAME_FUNC_OFFSET( 1029, glRectf, glRectf, NULL, 88),
- NAME_FUNC_OFFSET( 1037, glRectfv, glRectfv, NULL, 89),
- NAME_FUNC_OFFSET( 1046, glRecti, glRecti, NULL, 90),
- NAME_FUNC_OFFSET( 1054, glRectiv, glRectiv, NULL, 91),
- NAME_FUNC_OFFSET( 1063, glRects, glRects, NULL, 92),
- NAME_FUNC_OFFSET( 1071, glRectsv, glRectsv, NULL, 93),
- NAME_FUNC_OFFSET( 1080, glTexCoord1d, glTexCoord1d, NULL, 94),
- NAME_FUNC_OFFSET( 1093, glTexCoord1dv, glTexCoord1dv, NULL, 95),
- NAME_FUNC_OFFSET( 1107, glTexCoord1f, glTexCoord1f, NULL, 96),
- NAME_FUNC_OFFSET( 1120, glTexCoord1fv, glTexCoord1fv, NULL, 97),
- NAME_FUNC_OFFSET( 1134, glTexCoord1i, glTexCoord1i, NULL, 98),
- NAME_FUNC_OFFSET( 1147, glTexCoord1iv, glTexCoord1iv, NULL, 99),
- NAME_FUNC_OFFSET( 1161, glTexCoord1s, glTexCoord1s, NULL, 100),
- NAME_FUNC_OFFSET( 1174, glTexCoord1sv, glTexCoord1sv, NULL, 101),
- NAME_FUNC_OFFSET( 1188, glTexCoord2d, glTexCoord2d, NULL, 102),
- NAME_FUNC_OFFSET( 1201, glTexCoord2dv, glTexCoord2dv, NULL, 103),
- NAME_FUNC_OFFSET( 1215, glTexCoord2f, glTexCoord2f, NULL, 104),
- NAME_FUNC_OFFSET( 1228, glTexCoord2fv, glTexCoord2fv, NULL, 105),
- NAME_FUNC_OFFSET( 1242, glTexCoord2i, glTexCoord2i, NULL, 106),
- NAME_FUNC_OFFSET( 1255, glTexCoord2iv, glTexCoord2iv, NULL, 107),
- NAME_FUNC_OFFSET( 1269, glTexCoord2s, glTexCoord2s, NULL, 108),
- NAME_FUNC_OFFSET( 1282, glTexCoord2sv, glTexCoord2sv, NULL, 109),
- NAME_FUNC_OFFSET( 1296, glTexCoord3d, glTexCoord3d, NULL, 110),
- NAME_FUNC_OFFSET( 1309, glTexCoord3dv, glTexCoord3dv, NULL, 111),
- NAME_FUNC_OFFSET( 1323, glTexCoord3f, glTexCoord3f, NULL, 112),
- NAME_FUNC_OFFSET( 1336, glTexCoord3fv, glTexCoord3fv, NULL, 113),
- NAME_FUNC_OFFSET( 1350, glTexCoord3i, glTexCoord3i, NULL, 114),
- NAME_FUNC_OFFSET( 1363, glTexCoord3iv, glTexCoord3iv, NULL, 115),
- NAME_FUNC_OFFSET( 1377, glTexCoord3s, glTexCoord3s, NULL, 116),
- NAME_FUNC_OFFSET( 1390, glTexCoord3sv, glTexCoord3sv, NULL, 117),
- NAME_FUNC_OFFSET( 1404, glTexCoord4d, glTexCoord4d, NULL, 118),
- NAME_FUNC_OFFSET( 1417, glTexCoord4dv, glTexCoord4dv, NULL, 119),
- NAME_FUNC_OFFSET( 1431, glTexCoord4f, glTexCoord4f, NULL, 120),
- NAME_FUNC_OFFSET( 1444, glTexCoord4fv, glTexCoord4fv, NULL, 121),
- NAME_FUNC_OFFSET( 1458, glTexCoord4i, glTexCoord4i, NULL, 122),
- NAME_FUNC_OFFSET( 1471, glTexCoord4iv, glTexCoord4iv, NULL, 123),
- NAME_FUNC_OFFSET( 1485, glTexCoord4s, glTexCoord4s, NULL, 124),
- NAME_FUNC_OFFSET( 1498, glTexCoord4sv, glTexCoord4sv, NULL, 125),
- NAME_FUNC_OFFSET( 1512, glVertex2d, glVertex2d, NULL, 126),
- NAME_FUNC_OFFSET( 1523, glVertex2dv, glVertex2dv, NULL, 127),
- NAME_FUNC_OFFSET( 1535, glVertex2f, glVertex2f, NULL, 128),
- NAME_FUNC_OFFSET( 1546, glVertex2fv, glVertex2fv, NULL, 129),
- NAME_FUNC_OFFSET( 1558, glVertex2i, glVertex2i, NULL, 130),
- NAME_FUNC_OFFSET( 1569, glVertex2iv, glVertex2iv, NULL, 131),
- NAME_FUNC_OFFSET( 1581, glVertex2s, glVertex2s, NULL, 132),
- NAME_FUNC_OFFSET( 1592, glVertex2sv, glVertex2sv, NULL, 133),
- NAME_FUNC_OFFSET( 1604, glVertex3d, glVertex3d, NULL, 134),
- NAME_FUNC_OFFSET( 1615, glVertex3dv, glVertex3dv, NULL, 135),
- NAME_FUNC_OFFSET( 1627, glVertex3f, glVertex3f, NULL, 136),
- NAME_FUNC_OFFSET( 1638, glVertex3fv, glVertex3fv, NULL, 137),
- NAME_FUNC_OFFSET( 1650, glVertex3i, glVertex3i, NULL, 138),
- NAME_FUNC_OFFSET( 1661, glVertex3iv, glVertex3iv, NULL, 139),
- NAME_FUNC_OFFSET( 1673, glVertex3s, glVertex3s, NULL, 140),
- NAME_FUNC_OFFSET( 1684, glVertex3sv, glVertex3sv, NULL, 141),
- NAME_FUNC_OFFSET( 1696, glVertex4d, glVertex4d, NULL, 142),
- NAME_FUNC_OFFSET( 1707, glVertex4dv, glVertex4dv, NULL, 143),
- NAME_FUNC_OFFSET( 1719, glVertex4f, glVertex4f, NULL, 144),
- NAME_FUNC_OFFSET( 1730, glVertex4fv, glVertex4fv, NULL, 145),
- NAME_FUNC_OFFSET( 1742, glVertex4i, glVertex4i, NULL, 146),
- NAME_FUNC_OFFSET( 1753, glVertex4iv, glVertex4iv, NULL, 147),
- NAME_FUNC_OFFSET( 1765, glVertex4s, glVertex4s, NULL, 148),
- NAME_FUNC_OFFSET( 1776, glVertex4sv, glVertex4sv, NULL, 149),
- NAME_FUNC_OFFSET( 1788, glClipPlane, glClipPlane, NULL, 150),
- NAME_FUNC_OFFSET( 1800, glColorMaterial, glColorMaterial, NULL, 151),
- NAME_FUNC_OFFSET( 1816, glCullFace, glCullFace, NULL, 152),
- NAME_FUNC_OFFSET( 1827, glFogf, glFogf, NULL, 153),
- NAME_FUNC_OFFSET( 1834, glFogfv, glFogfv, NULL, 154),
- NAME_FUNC_OFFSET( 1842, glFogi, glFogi, NULL, 155),
- NAME_FUNC_OFFSET( 1849, glFogiv, glFogiv, NULL, 156),
- NAME_FUNC_OFFSET( 1857, glFrontFace, glFrontFace, NULL, 157),
- NAME_FUNC_OFFSET( 1869, glHint, glHint, NULL, 158),
- NAME_FUNC_OFFSET( 1876, glLightf, glLightf, NULL, 159),
- NAME_FUNC_OFFSET( 1885, glLightfv, glLightfv, NULL, 160),
- NAME_FUNC_OFFSET( 1895, glLighti, glLighti, NULL, 161),
- NAME_FUNC_OFFSET( 1904, glLightiv, glLightiv, NULL, 162),
- NAME_FUNC_OFFSET( 1914, glLightModelf, glLightModelf, NULL, 163),
- NAME_FUNC_OFFSET( 1928, glLightModelfv, glLightModelfv, NULL, 164),
- NAME_FUNC_OFFSET( 1943, glLightModeli, glLightModeli, NULL, 165),
- NAME_FUNC_OFFSET( 1957, glLightModeliv, glLightModeliv, NULL, 166),
- NAME_FUNC_OFFSET( 1972, glLineStipple, glLineStipple, NULL, 167),
- NAME_FUNC_OFFSET( 1986, glLineWidth, glLineWidth, NULL, 168),
- NAME_FUNC_OFFSET( 1998, glMaterialf, glMaterialf, NULL, 169),
- NAME_FUNC_OFFSET( 2010, glMaterialfv, glMaterialfv, NULL, 170),
- NAME_FUNC_OFFSET( 2023, glMateriali, glMateriali, NULL, 171),
- NAME_FUNC_OFFSET( 2035, glMaterialiv, glMaterialiv, NULL, 172),
- NAME_FUNC_OFFSET( 2048, glPointSize, glPointSize, NULL, 173),
- NAME_FUNC_OFFSET( 2060, glPolygonMode, glPolygonMode, NULL, 174),
- NAME_FUNC_OFFSET( 2074, glPolygonStipple, glPolygonStipple, NULL, 175),
- NAME_FUNC_OFFSET( 2091, glScissor, glScissor, NULL, 176),
- NAME_FUNC_OFFSET( 2101, glShadeModel, glShadeModel, NULL, 177),
- NAME_FUNC_OFFSET( 2114, glTexParameterf, glTexParameterf, NULL, 178),
- NAME_FUNC_OFFSET( 2130, glTexParameterfv, glTexParameterfv, NULL, 179),
- NAME_FUNC_OFFSET( 2147, glTexParameteri, glTexParameteri, NULL, 180),
- NAME_FUNC_OFFSET( 2163, glTexParameteriv, glTexParameteriv, NULL, 181),
- NAME_FUNC_OFFSET( 2180, glTexImage1D, glTexImage1D, NULL, 182),
- NAME_FUNC_OFFSET( 2193, glTexImage2D, glTexImage2D, NULL, 183),
- NAME_FUNC_OFFSET( 2206, glTexEnvf, glTexEnvf, NULL, 184),
- NAME_FUNC_OFFSET( 2216, glTexEnvfv, glTexEnvfv, NULL, 185),
- NAME_FUNC_OFFSET( 2227, glTexEnvi, glTexEnvi, NULL, 186),
- NAME_FUNC_OFFSET( 2237, glTexEnviv, glTexEnviv, NULL, 187),
- NAME_FUNC_OFFSET( 2248, glTexGend, glTexGend, NULL, 188),
- NAME_FUNC_OFFSET( 2258, glTexGendv, glTexGendv, NULL, 189),
- NAME_FUNC_OFFSET( 2269, glTexGenf, glTexGenf, NULL, 190),
- NAME_FUNC_OFFSET( 2279, glTexGenfv, glTexGenfv, NULL, 191),
- NAME_FUNC_OFFSET( 2290, glTexGeni, glTexGeni, NULL, 192),
- NAME_FUNC_OFFSET( 2300, glTexGeniv, glTexGeniv, NULL, 193),
- NAME_FUNC_OFFSET( 2311, glFeedbackBuffer, glFeedbackBuffer, NULL, 194),
- NAME_FUNC_OFFSET( 2328, glSelectBuffer, glSelectBuffer, NULL, 195),
- NAME_FUNC_OFFSET( 2343, glRenderMode, glRenderMode, NULL, 196),
- NAME_FUNC_OFFSET( 2356, glInitNames, glInitNames, NULL, 197),
- NAME_FUNC_OFFSET( 2368, glLoadName, glLoadName, NULL, 198),
- NAME_FUNC_OFFSET( 2379, glPassThrough, glPassThrough, NULL, 199),
- NAME_FUNC_OFFSET( 2393, glPopName, glPopName, NULL, 200),
- NAME_FUNC_OFFSET( 2403, glPushName, glPushName, NULL, 201),
- NAME_FUNC_OFFSET( 2414, glDrawBuffer, glDrawBuffer, NULL, 202),
- NAME_FUNC_OFFSET( 2427, glClear, glClear, NULL, 203),
- NAME_FUNC_OFFSET( 2435, glClearAccum, glClearAccum, NULL, 204),
- NAME_FUNC_OFFSET( 2448, glClearIndex, glClearIndex, NULL, 205),
- NAME_FUNC_OFFSET( 2461, glClearColor, glClearColor, NULL, 206),
- NAME_FUNC_OFFSET( 2474, glClearStencil, glClearStencil, NULL, 207),
- NAME_FUNC_OFFSET( 2489, glClearDepth, glClearDepth, NULL, 208),
- NAME_FUNC_OFFSET( 2502, glStencilMask, glStencilMask, NULL, 209),
- NAME_FUNC_OFFSET( 2516, glColorMask, glColorMask, NULL, 210),
- NAME_FUNC_OFFSET( 2528, glDepthMask, glDepthMask, NULL, 211),
- NAME_FUNC_OFFSET( 2540, glIndexMask, glIndexMask, NULL, 212),
- NAME_FUNC_OFFSET( 2552, glAccum, glAccum, NULL, 213),
- NAME_FUNC_OFFSET( 2560, glDisable, glDisable, NULL, 214),
- NAME_FUNC_OFFSET( 2570, glEnable, glEnable, NULL, 215),
- NAME_FUNC_OFFSET( 2579, glFinish, glFinish, NULL, 216),
- NAME_FUNC_OFFSET( 2588, glFlush, glFlush, NULL, 217),
- NAME_FUNC_OFFSET( 2596, glPopAttrib, glPopAttrib, NULL, 218),
- NAME_FUNC_OFFSET( 2608, glPushAttrib, glPushAttrib, NULL, 219),
- NAME_FUNC_OFFSET( 2621, glMap1d, glMap1d, NULL, 220),
- NAME_FUNC_OFFSET( 2629, glMap1f, glMap1f, NULL, 221),
- NAME_FUNC_OFFSET( 2637, glMap2d, glMap2d, NULL, 222),
- NAME_FUNC_OFFSET( 2645, glMap2f, glMap2f, NULL, 223),
- NAME_FUNC_OFFSET( 2653, glMapGrid1d, glMapGrid1d, NULL, 224),
- NAME_FUNC_OFFSET( 2665, glMapGrid1f, glMapGrid1f, NULL, 225),
- NAME_FUNC_OFFSET( 2677, glMapGrid2d, glMapGrid2d, NULL, 226),
- NAME_FUNC_OFFSET( 2689, glMapGrid2f, glMapGrid2f, NULL, 227),
- NAME_FUNC_OFFSET( 2701, glEvalCoord1d, glEvalCoord1d, NULL, 228),
- NAME_FUNC_OFFSET( 2715, glEvalCoord1dv, glEvalCoord1dv, NULL, 229),
- NAME_FUNC_OFFSET( 2730, glEvalCoord1f, glEvalCoord1f, NULL, 230),
- NAME_FUNC_OFFSET( 2744, glEvalCoord1fv, glEvalCoord1fv, NULL, 231),
- NAME_FUNC_OFFSET( 2759, glEvalCoord2d, glEvalCoord2d, NULL, 232),
- NAME_FUNC_OFFSET( 2773, glEvalCoord2dv, glEvalCoord2dv, NULL, 233),
- NAME_FUNC_OFFSET( 2788, glEvalCoord2f, glEvalCoord2f, NULL, 234),
- NAME_FUNC_OFFSET( 2802, glEvalCoord2fv, glEvalCoord2fv, NULL, 235),
- NAME_FUNC_OFFSET( 2817, glEvalMesh1, glEvalMesh1, NULL, 236),
- NAME_FUNC_OFFSET( 2829, glEvalPoint1, glEvalPoint1, NULL, 237),
- NAME_FUNC_OFFSET( 2842, glEvalMesh2, glEvalMesh2, NULL, 238),
- NAME_FUNC_OFFSET( 2854, glEvalPoint2, glEvalPoint2, NULL, 239),
- NAME_FUNC_OFFSET( 2867, glAlphaFunc, glAlphaFunc, NULL, 240),
- NAME_FUNC_OFFSET( 2879, glBlendFunc, glBlendFunc, NULL, 241),
- NAME_FUNC_OFFSET( 2891, glLogicOp, glLogicOp, NULL, 242),
- NAME_FUNC_OFFSET( 2901, glStencilFunc, glStencilFunc, NULL, 243),
- NAME_FUNC_OFFSET( 2915, glStencilOp, glStencilOp, NULL, 244),
- NAME_FUNC_OFFSET( 2927, glDepthFunc, glDepthFunc, NULL, 245),
- NAME_FUNC_OFFSET( 2939, glPixelZoom, glPixelZoom, NULL, 246),
- NAME_FUNC_OFFSET( 2951, glPixelTransferf, glPixelTransferf, NULL, 247),
- NAME_FUNC_OFFSET( 2968, glPixelTransferi, glPixelTransferi, NULL, 248),
- NAME_FUNC_OFFSET( 2985, glPixelStoref, glPixelStoref, NULL, 249),
- NAME_FUNC_OFFSET( 2999, glPixelStorei, glPixelStorei, NULL, 250),
- NAME_FUNC_OFFSET( 3013, glPixelMapfv, glPixelMapfv, NULL, 251),
- NAME_FUNC_OFFSET( 3026, glPixelMapuiv, glPixelMapuiv, NULL, 252),
- NAME_FUNC_OFFSET( 3040, glPixelMapusv, glPixelMapusv, NULL, 253),
- NAME_FUNC_OFFSET( 3054, glReadBuffer, glReadBuffer, NULL, 254),
- NAME_FUNC_OFFSET( 3067, glCopyPixels, glCopyPixels, NULL, 255),
- NAME_FUNC_OFFSET( 3080, glReadPixels, glReadPixels, NULL, 256),
- NAME_FUNC_OFFSET( 3093, glDrawPixels, glDrawPixels, NULL, 257),
- NAME_FUNC_OFFSET( 3106, glGetBooleanv, glGetBooleanv, NULL, 258),
- NAME_FUNC_OFFSET( 3120, glGetClipPlane, glGetClipPlane, NULL, 259),
- NAME_FUNC_OFFSET( 3135, glGetDoublev, glGetDoublev, NULL, 260),
- NAME_FUNC_OFFSET( 3148, glGetError, glGetError, NULL, 261),
- NAME_FUNC_OFFSET( 3159, glGetFloatv, glGetFloatv, NULL, 262),
- NAME_FUNC_OFFSET( 3171, glGetIntegerv, glGetIntegerv, NULL, 263),
- NAME_FUNC_OFFSET( 3185, glGetLightfv, glGetLightfv, NULL, 264),
- NAME_FUNC_OFFSET( 3198, glGetLightiv, glGetLightiv, NULL, 265),
- NAME_FUNC_OFFSET( 3211, glGetMapdv, glGetMapdv, NULL, 266),
- NAME_FUNC_OFFSET( 3222, glGetMapfv, glGetMapfv, NULL, 267),
- NAME_FUNC_OFFSET( 3233, glGetMapiv, glGetMapiv, NULL, 268),
- NAME_FUNC_OFFSET( 3244, glGetMaterialfv, glGetMaterialfv, NULL, 269),
- NAME_FUNC_OFFSET( 3260, glGetMaterialiv, glGetMaterialiv, NULL, 270),
- NAME_FUNC_OFFSET( 3276, glGetPixelMapfv, glGetPixelMapfv, NULL, 271),
- NAME_FUNC_OFFSET( 3292, glGetPixelMapuiv, glGetPixelMapuiv, NULL, 272),
- NAME_FUNC_OFFSET( 3309, glGetPixelMapusv, glGetPixelMapusv, NULL, 273),
- NAME_FUNC_OFFSET( 3326, glGetPolygonStipple, glGetPolygonStipple, NULL, 274),
- NAME_FUNC_OFFSET( 3346, glGetString, glGetString, NULL, 275),
- NAME_FUNC_OFFSET( 3358, glGetTexEnvfv, glGetTexEnvfv, NULL, 276),
- NAME_FUNC_OFFSET( 3372, glGetTexEnviv, glGetTexEnviv, NULL, 277),
- NAME_FUNC_OFFSET( 3386, glGetTexGendv, glGetTexGendv, NULL, 278),
- NAME_FUNC_OFFSET( 3400, glGetTexGenfv, glGetTexGenfv, NULL, 279),
- NAME_FUNC_OFFSET( 3414, glGetTexGeniv, glGetTexGeniv, NULL, 280),
- NAME_FUNC_OFFSET( 3428, glGetTexImage, glGetTexImage, NULL, 281),
- NAME_FUNC_OFFSET( 3442, glGetTexParameterfv, glGetTexParameterfv, NULL, 282),
- NAME_FUNC_OFFSET( 3462, glGetTexParameteriv, glGetTexParameteriv, NULL, 283),
- NAME_FUNC_OFFSET( 3482, glGetTexLevelParameterfv, glGetTexLevelParameterfv, NULL, 284),
- NAME_FUNC_OFFSET( 3507, glGetTexLevelParameteriv, glGetTexLevelParameteriv, NULL, 285),
- NAME_FUNC_OFFSET( 3532, glIsEnabled, glIsEnabled, NULL, 286),
- NAME_FUNC_OFFSET( 3544, glIsList, glIsList, NULL, 287),
- NAME_FUNC_OFFSET( 3553, glDepthRange, glDepthRange, NULL, 288),
- NAME_FUNC_OFFSET( 3566, glFrustum, glFrustum, NULL, 289),
- NAME_FUNC_OFFSET( 3576, glLoadIdentity, glLoadIdentity, NULL, 290),
- NAME_FUNC_OFFSET( 3591, glLoadMatrixf, glLoadMatrixf, NULL, 291),
- NAME_FUNC_OFFSET( 3605, glLoadMatrixd, glLoadMatrixd, NULL, 292),
- NAME_FUNC_OFFSET( 3619, glMatrixMode, glMatrixMode, NULL, 293),
- NAME_FUNC_OFFSET( 3632, glMultMatrixf, glMultMatrixf, NULL, 294),
- NAME_FUNC_OFFSET( 3646, glMultMatrixd, glMultMatrixd, NULL, 295),
- NAME_FUNC_OFFSET( 3660, glOrtho, glOrtho, NULL, 296),
- NAME_FUNC_OFFSET( 3668, glPopMatrix, glPopMatrix, NULL, 297),
- NAME_FUNC_OFFSET( 3680, glPushMatrix, glPushMatrix, NULL, 298),
- NAME_FUNC_OFFSET( 3693, glRotated, glRotated, NULL, 299),
- NAME_FUNC_OFFSET( 3703, glRotatef, glRotatef, NULL, 300),
- NAME_FUNC_OFFSET( 3713, glScaled, glScaled, NULL, 301),
- NAME_FUNC_OFFSET( 3722, glScalef, glScalef, NULL, 302),
- NAME_FUNC_OFFSET( 3731, glTranslated, glTranslated, NULL, 303),
- NAME_FUNC_OFFSET( 3744, glTranslatef, glTranslatef, NULL, 304),
- NAME_FUNC_OFFSET( 3757, glViewport, glViewport, NULL, 305),
- NAME_FUNC_OFFSET( 3768, glArrayElement, glArrayElement, NULL, 306),
- NAME_FUNC_OFFSET( 3783, glBindTexture, glBindTexture, NULL, 307),
- NAME_FUNC_OFFSET( 3797, glColorPointer, glColorPointer, NULL, 308),
- NAME_FUNC_OFFSET( 3812, glDisableClientState, glDisableClientState, NULL, 309),
- NAME_FUNC_OFFSET( 3833, glDrawArrays, glDrawArrays, NULL, 310),
- NAME_FUNC_OFFSET( 3846, glDrawElements, glDrawElements, NULL, 311),
- NAME_FUNC_OFFSET( 3861, glEdgeFlagPointer, glEdgeFlagPointer, NULL, 312),
- NAME_FUNC_OFFSET( 3879, glEnableClientState, glEnableClientState, NULL, 313),
- NAME_FUNC_OFFSET( 3899, glIndexPointer, glIndexPointer, NULL, 314),
- NAME_FUNC_OFFSET( 3914, glIndexub, glIndexub, NULL, 315),
- NAME_FUNC_OFFSET( 3924, glIndexubv, glIndexubv, NULL, 316),
- NAME_FUNC_OFFSET( 3935, glInterleavedArrays, glInterleavedArrays, NULL, 317),
- NAME_FUNC_OFFSET( 3955, glNormalPointer, glNormalPointer, NULL, 318),
- NAME_FUNC_OFFSET( 3971, glPolygonOffset, glPolygonOffset, NULL, 319),
- NAME_FUNC_OFFSET( 3987, glTexCoordPointer, glTexCoordPointer, NULL, 320),
- NAME_FUNC_OFFSET( 4005, glVertexPointer, glVertexPointer, NULL, 321),
- NAME_FUNC_OFFSET( 4021, glAreTexturesResident, glAreTexturesResident, NULL, 322),
- NAME_FUNC_OFFSET( 4043, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
- NAME_FUNC_OFFSET( 4060, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
- NAME_FUNC_OFFSET( 4077, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, 325),
- NAME_FUNC_OFFSET( 4097, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, 326),
- NAME_FUNC_OFFSET( 4117, glDeleteTextures, glDeleteTextures, NULL, 327),
- NAME_FUNC_OFFSET( 4134, glGenTextures, glGenTextures, NULL, 328),
- NAME_FUNC_OFFSET( 4148, glGetPointerv, glGetPointerv, NULL, 329),
- NAME_FUNC_OFFSET( 4162, glIsTexture, glIsTexture, NULL, 330),
- NAME_FUNC_OFFSET( 4174, glPrioritizeTextures, glPrioritizeTextures, NULL, 331),
- NAME_FUNC_OFFSET( 4195, glTexSubImage1D, glTexSubImage1D, NULL, 332),
- NAME_FUNC_OFFSET( 4211, glTexSubImage2D, glTexSubImage2D, NULL, 333),
- NAME_FUNC_OFFSET( 4227, glPopClientAttrib, glPopClientAttrib, NULL, 334),
- NAME_FUNC_OFFSET( 4245, glPushClientAttrib, glPushClientAttrib, NULL, 335),
- NAME_FUNC_OFFSET( 4264, glBlendColor, glBlendColor, NULL, 336),
- NAME_FUNC_OFFSET( 4277, glBlendEquation, glBlendEquation, NULL, 337),
- NAME_FUNC_OFFSET( 4293, glDrawRangeElements, glDrawRangeElements, NULL, 338),
- NAME_FUNC_OFFSET( 4313, glColorTable, glColorTable, NULL, 339),
- NAME_FUNC_OFFSET( 4326, glColorTableParameterfv, glColorTableParameterfv, NULL, 340),
- NAME_FUNC_OFFSET( 4350, glColorTableParameteriv, glColorTableParameteriv, NULL, 341),
- NAME_FUNC_OFFSET( 4374, glCopyColorTable, glCopyColorTable, NULL, 342),
- NAME_FUNC_OFFSET( 4391, glGetColorTable, glGetColorTable, NULL, 343),
- NAME_FUNC_OFFSET( 4407, glGetColorTableParameterfv, glGetColorTableParameterfv, NULL, 344),
- NAME_FUNC_OFFSET( 4434, glGetColorTableParameteriv, glGetColorTableParameteriv, NULL, 345),
- NAME_FUNC_OFFSET( 4461, glColorSubTable, glColorSubTable, NULL, 346),
- NAME_FUNC_OFFSET( 4477, glCopyColorSubTable, glCopyColorSubTable, NULL, 347),
- NAME_FUNC_OFFSET( 4497, glConvolutionFilter1D, glConvolutionFilter1D, NULL, 348),
- NAME_FUNC_OFFSET( 4519, glConvolutionFilter2D, glConvolutionFilter2D, NULL, 349),
- NAME_FUNC_OFFSET( 4541, glConvolutionParameterf, glConvolutionParameterf, NULL, 350),
- NAME_FUNC_OFFSET( 4565, glConvolutionParameterfv, glConvolutionParameterfv, NULL, 351),
- NAME_FUNC_OFFSET( 4590, glConvolutionParameteri, glConvolutionParameteri, NULL, 352),
- NAME_FUNC_OFFSET( 4614, glConvolutionParameteriv, glConvolutionParameteriv, NULL, 353),
- NAME_FUNC_OFFSET( 4639, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, 354),
- NAME_FUNC_OFFSET( 4665, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, 355),
- NAME_FUNC_OFFSET( 4691, glGetConvolutionFilter, glGetConvolutionFilter, NULL, 356),
- NAME_FUNC_OFFSET( 4714, glGetConvolutionParameterfv, glGetConvolutionParameterfv, NULL, 357),
- NAME_FUNC_OFFSET( 4742, glGetConvolutionParameteriv, glGetConvolutionParameteriv, NULL, 358),
- NAME_FUNC_OFFSET( 4770, glGetSeparableFilter, glGetSeparableFilter, NULL, 359),
- NAME_FUNC_OFFSET( 4791, glSeparableFilter2D, glSeparableFilter2D, NULL, 360),
- NAME_FUNC_OFFSET( 4811, glGetHistogram, glGetHistogram, NULL, 361),
- NAME_FUNC_OFFSET( 4826, glGetHistogramParameterfv, glGetHistogramParameterfv, NULL, 362),
- NAME_FUNC_OFFSET( 4852, glGetHistogramParameteriv, glGetHistogramParameteriv, NULL, 363),
- NAME_FUNC_OFFSET( 4878, glGetMinmax, glGetMinmax, NULL, 364),
- NAME_FUNC_OFFSET( 4890, glGetMinmaxParameterfv, glGetMinmaxParameterfv, NULL, 365),
- NAME_FUNC_OFFSET( 4913, glGetMinmaxParameteriv, glGetMinmaxParameteriv, NULL, 366),
- NAME_FUNC_OFFSET( 4936, glHistogram, glHistogram, NULL, 367),
- NAME_FUNC_OFFSET( 4948, glMinmax, glMinmax, NULL, 368),
- NAME_FUNC_OFFSET( 4957, glResetHistogram, glResetHistogram, NULL, 369),
- NAME_FUNC_OFFSET( 4974, glResetMinmax, glResetMinmax, NULL, 370),
- NAME_FUNC_OFFSET( 4988, glTexImage3D, glTexImage3D, NULL, 371),
- NAME_FUNC_OFFSET( 5001, glTexSubImage3D, glTexSubImage3D, NULL, 372),
- NAME_FUNC_OFFSET( 5017, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, 373),
- NAME_FUNC_OFFSET( 5037, glActiveTextureARB, glActiveTextureARB, NULL, 374),
- NAME_FUNC_OFFSET( 5056, glClientActiveTextureARB, glClientActiveTextureARB, NULL, 375),
- NAME_FUNC_OFFSET( 5081, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, 376),
- NAME_FUNC_OFFSET( 5102, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, 377),
- NAME_FUNC_OFFSET( 5124, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, 378),
- NAME_FUNC_OFFSET( 5145, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, 379),
- NAME_FUNC_OFFSET( 5167, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, 380),
- NAME_FUNC_OFFSET( 5188, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, 381),
- NAME_FUNC_OFFSET( 5210, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, 382),
- NAME_FUNC_OFFSET( 5231, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, 383),
- NAME_FUNC_OFFSET( 5253, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, 384),
- NAME_FUNC_OFFSET( 5274, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, 385),
- NAME_FUNC_OFFSET( 5296, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, 386),
- NAME_FUNC_OFFSET( 5317, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, 387),
- NAME_FUNC_OFFSET( 5339, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, 388),
- NAME_FUNC_OFFSET( 5360, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, 389),
- NAME_FUNC_OFFSET( 5382, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, 390),
- NAME_FUNC_OFFSET( 5403, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, 391),
- NAME_FUNC_OFFSET( 5425, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, 392),
- NAME_FUNC_OFFSET( 5446, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, 393),
- NAME_FUNC_OFFSET( 5468, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, 394),
- NAME_FUNC_OFFSET( 5489, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, 395),
- NAME_FUNC_OFFSET( 5511, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, 396),
- NAME_FUNC_OFFSET( 5532, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, 397),
- NAME_FUNC_OFFSET( 5554, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, 398),
- NAME_FUNC_OFFSET( 5575, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, 399),
- NAME_FUNC_OFFSET( 5597, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, 400),
- NAME_FUNC_OFFSET( 5618, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, 401),
- NAME_FUNC_OFFSET( 5640, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, 402),
- NAME_FUNC_OFFSET( 5661, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, 403),
- NAME_FUNC_OFFSET( 5683, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, 404),
- NAME_FUNC_OFFSET( 5704, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, 405),
- NAME_FUNC_OFFSET( 5726, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, 406),
- NAME_FUNC_OFFSET( 5747, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, 407),
- NAME_FUNC_OFFSET( 5769, glAttachShader, glAttachShader, NULL, 408),
- NAME_FUNC_OFFSET( 5784, glCreateProgram, glCreateProgram, NULL, 409),
- NAME_FUNC_OFFSET( 5800, glCreateShader, glCreateShader, NULL, 410),
- NAME_FUNC_OFFSET( 5815, glDeleteProgram, glDeleteProgram, NULL, 411),
- NAME_FUNC_OFFSET( 5831, glDeleteShader, glDeleteShader, NULL, 412),
- NAME_FUNC_OFFSET( 5846, glDetachShader, glDetachShader, NULL, 413),
- NAME_FUNC_OFFSET( 5861, glGetAttachedShaders, glGetAttachedShaders, NULL, 414),
- NAME_FUNC_OFFSET( 5882, glGetProgramInfoLog, glGetProgramInfoLog, NULL, 415),
- NAME_FUNC_OFFSET( 5902, glGetProgramiv, glGetProgramiv, NULL, 416),
- NAME_FUNC_OFFSET( 5917, glGetShaderInfoLog, glGetShaderInfoLog, NULL, 417),
- NAME_FUNC_OFFSET( 5936, glGetShaderiv, glGetShaderiv, NULL, 418),
- NAME_FUNC_OFFSET( 5950, glIsProgram, glIsProgram, NULL, 419),
- NAME_FUNC_OFFSET( 5962, glIsShader, glIsShader, NULL, 420),
- NAME_FUNC_OFFSET( 5973, glStencilFuncSeparate, glStencilFuncSeparate, NULL, 421),
- NAME_FUNC_OFFSET( 5995, glStencilMaskSeparate, glStencilMaskSeparate, NULL, 422),
- NAME_FUNC_OFFSET( 6017, glStencilOpSeparate, glStencilOpSeparate, NULL, 423),
- NAME_FUNC_OFFSET( 6037, glUniformMatrix2x3fv, glUniformMatrix2x3fv, NULL, 424),
- NAME_FUNC_OFFSET( 6058, glUniformMatrix2x4fv, glUniformMatrix2x4fv, NULL, 425),
- NAME_FUNC_OFFSET( 6079, glUniformMatrix3x2fv, glUniformMatrix3x2fv, NULL, 426),
- NAME_FUNC_OFFSET( 6100, glUniformMatrix3x4fv, glUniformMatrix3x4fv, NULL, 427),
- NAME_FUNC_OFFSET( 6121, glUniformMatrix4x2fv, glUniformMatrix4x2fv, NULL, 428),
- NAME_FUNC_OFFSET( 6142, glUniformMatrix4x3fv, glUniformMatrix4x3fv, NULL, 429),
- NAME_FUNC_OFFSET( 6163, glClampColor, glClampColor, NULL, 430),
- NAME_FUNC_OFFSET( 6176, glClearBufferfi, glClearBufferfi, NULL, 431),
- NAME_FUNC_OFFSET( 6192, glClearBufferfv, glClearBufferfv, NULL, 432),
- NAME_FUNC_OFFSET( 6208, glClearBufferiv, glClearBufferiv, NULL, 433),
- NAME_FUNC_OFFSET( 6224, glClearBufferuiv, glClearBufferuiv, NULL, 434),
- NAME_FUNC_OFFSET( 6241, glGetStringi, glGetStringi, NULL, 435),
- NAME_FUNC_OFFSET( 6254, glTexBuffer, glTexBuffer, NULL, 436),
- NAME_FUNC_OFFSET( 6266, glFramebufferTexture, glFramebufferTexture, NULL, 437),
- NAME_FUNC_OFFSET( 6287, glGetBufferParameteri64v, glGetBufferParameteri64v, NULL, 438),
- NAME_FUNC_OFFSET( 6312, glGetInteger64i_v, glGetInteger64i_v, NULL, 439),
- NAME_FUNC_OFFSET( 6330, glVertexAttribDivisor, glVertexAttribDivisor, NULL, 440),
- NAME_FUNC_OFFSET( 6352, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, 441),
- NAME_FUNC_OFFSET( 6378, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, 442),
- NAME_FUNC_OFFSET( 6404, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, 443),
- NAME_FUNC_OFFSET( 6430, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, 444),
- NAME_FUNC_OFFSET( 6456, glSampleCoverageARB, glSampleCoverageARB, NULL, 445),
- NAME_FUNC_OFFSET( 6476, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, 446),
- NAME_FUNC_OFFSET( 6502, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, 447),
- NAME_FUNC_OFFSET( 6528, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, 448),
- NAME_FUNC_OFFSET( 6554, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, 449),
- NAME_FUNC_OFFSET( 6583, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, 450),
- NAME_FUNC_OFFSET( 6612, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, 451),
- NAME_FUNC_OFFSET( 6641, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, 452),
- NAME_FUNC_OFFSET( 6668, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, 453),
- NAME_FUNC_OFFSET( 6698, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, 454),
- NAME_FUNC_OFFSET( 6727, glGetProgramEnvParameterdvARB, glGetProgramEnvParameterdvARB, NULL, 455),
- NAME_FUNC_OFFSET( 6757, glGetProgramEnvParameterfvARB, glGetProgramEnvParameterfvARB, NULL, 456),
- NAME_FUNC_OFFSET( 6787, glGetProgramLocalParameterdvARB, glGetProgramLocalParameterdvARB, NULL, 457),
- NAME_FUNC_OFFSET( 6819, glGetProgramLocalParameterfvARB, glGetProgramLocalParameterfvARB, NULL, 458),
- NAME_FUNC_OFFSET( 6851, glGetProgramStringARB, glGetProgramStringARB, NULL, 459),
- NAME_FUNC_OFFSET( 6873, glGetProgramivARB, glGetProgramivARB, NULL, 460),
- NAME_FUNC_OFFSET( 6891, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, 461),
- NAME_FUNC_OFFSET( 6914, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, 462),
- NAME_FUNC_OFFSET( 6937, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, 463),
- NAME_FUNC_OFFSET( 6960, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, 464),
- NAME_FUNC_OFFSET( 6987, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, 465),
- NAME_FUNC_OFFSET( 7015, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, 466),
- NAME_FUNC_OFFSET( 7042, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, 467),
- NAME_FUNC_OFFSET( 7070, glProgramLocalParameter4dARB, glProgramLocalParameter4dARB, NULL, 468),
- NAME_FUNC_OFFSET( 7099, glProgramLocalParameter4dvARB, glProgramLocalParameter4dvARB, NULL, 469),
- NAME_FUNC_OFFSET( 7129, glProgramLocalParameter4fARB, glProgramLocalParameter4fARB, NULL, 470),
- NAME_FUNC_OFFSET( 7158, glProgramLocalParameter4fvARB, glProgramLocalParameter4fvARB, NULL, 471),
- NAME_FUNC_OFFSET( 7188, glProgramStringARB, glProgramStringARB, NULL, 472),
- NAME_FUNC_OFFSET( 7207, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, 473),
- NAME_FUNC_OFFSET( 7227, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, 474),
- NAME_FUNC_OFFSET( 7248, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, 475),
- NAME_FUNC_OFFSET( 7268, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, 476),
- NAME_FUNC_OFFSET( 7289, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, 477),
- NAME_FUNC_OFFSET( 7309, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, 478),
- NAME_FUNC_OFFSET( 7330, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, 479),
- NAME_FUNC_OFFSET( 7350, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, 480),
- NAME_FUNC_OFFSET( 7371, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, 481),
- NAME_FUNC_OFFSET( 7391, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, 482),
- NAME_FUNC_OFFSET( 7412, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, 483),
- NAME_FUNC_OFFSET( 7432, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, 484),
- NAME_FUNC_OFFSET( 7453, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, 485),
- NAME_FUNC_OFFSET( 7473, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, 486),
- NAME_FUNC_OFFSET( 7494, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, 487),
- NAME_FUNC_OFFSET( 7514, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, 488),
- NAME_FUNC_OFFSET( 7535, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, 489),
- NAME_FUNC_OFFSET( 7555, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, 490),
- NAME_FUNC_OFFSET( 7576, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, 491),
- NAME_FUNC_OFFSET( 7598, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, 492),
- NAME_FUNC_OFFSET( 7620, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, 493),
- NAME_FUNC_OFFSET( 7642, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, 494),
- NAME_FUNC_OFFSET( 7664, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, 495),
- NAME_FUNC_OFFSET( 7687, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, 496),
- NAME_FUNC_OFFSET( 7710, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, 497),
- NAME_FUNC_OFFSET( 7733, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, 498),
- NAME_FUNC_OFFSET( 7754, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, 499),
- NAME_FUNC_OFFSET( 7774, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, 500),
- NAME_FUNC_OFFSET( 7795, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, 501),
- NAME_FUNC_OFFSET( 7815, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, 502),
- NAME_FUNC_OFFSET( 7836, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, 503),
- NAME_FUNC_OFFSET( 7857, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, 504),
- NAME_FUNC_OFFSET( 7877, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, 505),
- NAME_FUNC_OFFSET( 7898, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, 506),
- NAME_FUNC_OFFSET( 7920, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, 507),
- NAME_FUNC_OFFSET( 7942, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, 508),
- NAME_FUNC_OFFSET( 7964, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, 509),
- NAME_FUNC_OFFSET( 7989, glBindBufferARB, glBindBufferARB, NULL, 510),
- NAME_FUNC_OFFSET( 8005, glBufferDataARB, glBufferDataARB, NULL, 511),
- NAME_FUNC_OFFSET( 8021, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
- NAME_FUNC_OFFSET( 8040, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
- NAME_FUNC_OFFSET( 8059, glGenBuffersARB, glGenBuffersARB, NULL, 514),
- NAME_FUNC_OFFSET( 8075, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, 515),
- NAME_FUNC_OFFSET( 8101, glGetBufferPointervARB, glGetBufferPointervARB, NULL, 516),
- NAME_FUNC_OFFSET( 8124, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, 517),
- NAME_FUNC_OFFSET( 8146, glIsBufferARB, glIsBufferARB, NULL, 518),
- NAME_FUNC_OFFSET( 8160, glMapBufferARB, glMapBufferARB, NULL, 519),
- NAME_FUNC_OFFSET( 8175, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
- NAME_FUNC_OFFSET( 8192, glBeginQueryARB, glBeginQueryARB, NULL, 521),
- NAME_FUNC_OFFSET( 8208, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
- NAME_FUNC_OFFSET( 8227, glEndQueryARB, glEndQueryARB, NULL, 523),
- NAME_FUNC_OFFSET( 8241, glGenQueriesARB, glGenQueriesARB, NULL, 524),
- NAME_FUNC_OFFSET( 8257, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, 525),
- NAME_FUNC_OFFSET( 8279, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, 526),
- NAME_FUNC_OFFSET( 8302, glGetQueryivARB, glGetQueryivARB, NULL, 527),
- NAME_FUNC_OFFSET( 8318, glIsQueryARB, glIsQueryARB, NULL, 528),
- NAME_FUNC_OFFSET( 8331, glAttachObjectARB, glAttachObjectARB, NULL, 529),
- NAME_FUNC_OFFSET( 8349, glCompileShaderARB, glCompileShaderARB, NULL, 530),
- NAME_FUNC_OFFSET( 8368, glCreateProgramObjectARB, glCreateProgramObjectARB, NULL, 531),
- NAME_FUNC_OFFSET( 8393, glCreateShaderObjectARB, glCreateShaderObjectARB, NULL, 532),
- NAME_FUNC_OFFSET( 8417, glDeleteObjectARB, glDeleteObjectARB, NULL, 533),
- NAME_FUNC_OFFSET( 8435, glDetachObjectARB, glDetachObjectARB, NULL, 534),
- NAME_FUNC_OFFSET( 8453, glGetActiveUniformARB, glGetActiveUniformARB, NULL, 535),
- NAME_FUNC_OFFSET( 8475, glGetAttachedObjectsARB, glGetAttachedObjectsARB, NULL, 536),
- NAME_FUNC_OFFSET( 8499, glGetHandleARB, glGetHandleARB, NULL, 537),
- NAME_FUNC_OFFSET( 8514, glGetInfoLogARB, glGetInfoLogARB, NULL, 538),
- NAME_FUNC_OFFSET( 8530, glGetObjectParameterfvARB, glGetObjectParameterfvARB, NULL, 539),
- NAME_FUNC_OFFSET( 8556, glGetObjectParameterivARB, glGetObjectParameterivARB, NULL, 540),
- NAME_FUNC_OFFSET( 8582, glGetShaderSourceARB, glGetShaderSourceARB, NULL, 541),
- NAME_FUNC_OFFSET( 8603, glGetUniformLocationARB, glGetUniformLocationARB, NULL, 542),
- NAME_FUNC_OFFSET( 8627, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
- NAME_FUNC_OFFSET( 8645, glGetUniformivARB, glGetUniformivARB, NULL, 544),
- NAME_FUNC_OFFSET( 8663, glLinkProgramARB, glLinkProgramARB, NULL, 545),
- NAME_FUNC_OFFSET( 8680, glShaderSourceARB, glShaderSourceARB, NULL, 546),
- NAME_FUNC_OFFSET( 8698, glUniform1fARB, glUniform1fARB, NULL, 547),
- NAME_FUNC_OFFSET( 8713, glUniform1fvARB, glUniform1fvARB, NULL, 548),
- NAME_FUNC_OFFSET( 8729, glUniform1iARB, glUniform1iARB, NULL, 549),
- NAME_FUNC_OFFSET( 8744, glUniform1ivARB, glUniform1ivARB, NULL, 550),
- NAME_FUNC_OFFSET( 8760, glUniform2fARB, glUniform2fARB, NULL, 551),
- NAME_FUNC_OFFSET( 8775, glUniform2fvARB, glUniform2fvARB, NULL, 552),
- NAME_FUNC_OFFSET( 8791, glUniform2iARB, glUniform2iARB, NULL, 553),
- NAME_FUNC_OFFSET( 8806, glUniform2ivARB, glUniform2ivARB, NULL, 554),
- NAME_FUNC_OFFSET( 8822, glUniform3fARB, glUniform3fARB, NULL, 555),
- NAME_FUNC_OFFSET( 8837, glUniform3fvARB, glUniform3fvARB, NULL, 556),
- NAME_FUNC_OFFSET( 8853, glUniform3iARB, glUniform3iARB, NULL, 557),
- NAME_FUNC_OFFSET( 8868, glUniform3ivARB, glUniform3ivARB, NULL, 558),
- NAME_FUNC_OFFSET( 8884, glUniform4fARB, glUniform4fARB, NULL, 559),
- NAME_FUNC_OFFSET( 8899, glUniform4fvARB, glUniform4fvARB, NULL, 560),
- NAME_FUNC_OFFSET( 8915, glUniform4iARB, glUniform4iARB, NULL, 561),
- NAME_FUNC_OFFSET( 8930, glUniform4ivARB, glUniform4ivARB, NULL, 562),
- NAME_FUNC_OFFSET( 8946, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, 563),
- NAME_FUNC_OFFSET( 8968, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, 564),
- NAME_FUNC_OFFSET( 8990, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, 565),
- NAME_FUNC_OFFSET( 9012, glUseProgramObjectARB, glUseProgramObjectARB, NULL, 566),
- NAME_FUNC_OFFSET( 9034, glValidateProgramARB, glValidateProgramARB, NULL, 567),
- NAME_FUNC_OFFSET( 9055, glBindAttribLocationARB, glBindAttribLocationARB, NULL, 568),
- NAME_FUNC_OFFSET( 9079, glGetActiveAttribARB, glGetActiveAttribARB, NULL, 569),
- NAME_FUNC_OFFSET( 9100, glGetAttribLocationARB, glGetAttribLocationARB, NULL, 570),
- NAME_FUNC_OFFSET( 9123, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
- NAME_FUNC_OFFSET( 9140, glClampColorARB, glClampColorARB, NULL, 572),
- NAME_FUNC_OFFSET( 9156, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 573),
- NAME_FUNC_OFFSET( 9181, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 574),
- NAME_FUNC_OFFSET( 9208, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, 575),
- NAME_FUNC_OFFSET( 9241, glFramebufferTextureARB, glFramebufferTextureARB, NULL, 576),
- NAME_FUNC_OFFSET( 9265, glFramebufferTextureFaceARB, glFramebufferTextureFaceARB, NULL, 577),
- NAME_FUNC_OFFSET( 9293, glProgramParameteriARB, glProgramParameteriARB, NULL, 578),
- NAME_FUNC_OFFSET( 9316, glVertexAttribDivisorARB, glVertexAttribDivisorARB, NULL, 579),
- NAME_FUNC_OFFSET( 9341, glFlushMappedBufferRange, glFlushMappedBufferRange, NULL, 580),
- NAME_FUNC_OFFSET( 9366, glMapBufferRange, glMapBufferRange, NULL, 581),
- NAME_FUNC_OFFSET( 9383, glTexBufferARB, glTexBufferARB, NULL, 582),
- NAME_FUNC_OFFSET( 9398, glBindVertexArray, glBindVertexArray, NULL, 583),
- NAME_FUNC_OFFSET( 9416, glGenVertexArrays, glGenVertexArrays, NULL, 584),
- NAME_FUNC_OFFSET( 9434, glCopyBufferSubData, glCopyBufferSubData, NULL, 585),
- NAME_FUNC_OFFSET( 9454, glClientWaitSync, glClientWaitSync, NULL, 586),
- NAME_FUNC_OFFSET( 9471, glDeleteSync, glDeleteSync, NULL, 587),
- NAME_FUNC_OFFSET( 9484, glFenceSync, glFenceSync, NULL, 588),
- NAME_FUNC_OFFSET( 9496, glGetInteger64v, glGetInteger64v, NULL, 589),
- NAME_FUNC_OFFSET( 9512, glGetSynciv, glGetSynciv, NULL, 590),
- NAME_FUNC_OFFSET( 9524, glIsSync, glIsSync, NULL, 591),
- NAME_FUNC_OFFSET( 9533, glWaitSync, glWaitSync, NULL, 592),
- NAME_FUNC_OFFSET( 9544, glDrawElementsBaseVertex, glDrawElementsBaseVertex, NULL, 593),
- NAME_FUNC_OFFSET( 9569, glDrawElementsInstancedBaseVertex, glDrawElementsInstancedBaseVertex, NULL, 594),
- NAME_FUNC_OFFSET( 9603, glDrawRangeElementsBaseVertex, glDrawRangeElementsBaseVertex, NULL, 595),
- NAME_FUNC_OFFSET( 9633, glMultiDrawElementsBaseVertex, glMultiDrawElementsBaseVertex, NULL, 596),
- NAME_FUNC_OFFSET( 9663, glBlendEquationSeparateiARB, glBlendEquationSeparateiARB, NULL, 597),
- NAME_FUNC_OFFSET( 9691, glBlendEquationiARB, glBlendEquationiARB, NULL, 598),
- NAME_FUNC_OFFSET( 9711, glBlendFuncSeparateiARB, glBlendFuncSeparateiARB, NULL, 599),
- NAME_FUNC_OFFSET( 9735, glBlendFunciARB, glBlendFunciARB, NULL, 600),
- NAME_FUNC_OFFSET( 9751, glBindSampler, glBindSampler, NULL, 601),
- NAME_FUNC_OFFSET( 9765, glDeleteSamplers, glDeleteSamplers, NULL, 602),
- NAME_FUNC_OFFSET( 9782, glGenSamplers, glGenSamplers, NULL, 603),
- NAME_FUNC_OFFSET( 9796, glGetSamplerParameterIiv, glGetSamplerParameterIiv, NULL, 604),
- NAME_FUNC_OFFSET( 9821, glGetSamplerParameterIuiv, glGetSamplerParameterIuiv, NULL, 605),
- NAME_FUNC_OFFSET( 9847, glGetSamplerParameterfv, glGetSamplerParameterfv, NULL, 606),
- NAME_FUNC_OFFSET( 9871, glGetSamplerParameteriv, glGetSamplerParameteriv, NULL, 607),
- NAME_FUNC_OFFSET( 9895, glIsSampler, glIsSampler, NULL, 608),
- NAME_FUNC_OFFSET( 9907, glSamplerParameterIiv, glSamplerParameterIiv, NULL, 609),
- NAME_FUNC_OFFSET( 9929, glSamplerParameterIuiv, glSamplerParameterIuiv, NULL, 610),
- NAME_FUNC_OFFSET( 9952, glSamplerParameterf, glSamplerParameterf, NULL, 611),
- NAME_FUNC_OFFSET( 9972, glSamplerParameterfv, glSamplerParameterfv, NULL, 612),
- NAME_FUNC_OFFSET( 9993, glSamplerParameteri, glSamplerParameteri, NULL, 613),
- NAME_FUNC_OFFSET(10013, glSamplerParameteriv, glSamplerParameteriv, NULL, 614),
- NAME_FUNC_OFFSET(10034, glColorP3ui, glColorP3ui, NULL, 615),
- NAME_FUNC_OFFSET(10046, glColorP3uiv, glColorP3uiv, NULL, 616),
- NAME_FUNC_OFFSET(10059, glColorP4ui, glColorP4ui, NULL, 617),
- NAME_FUNC_OFFSET(10071, glColorP4uiv, glColorP4uiv, NULL, 618),
- NAME_FUNC_OFFSET(10084, glMultiTexCoordP1ui, glMultiTexCoordP1ui, NULL, 619),
- NAME_FUNC_OFFSET(10104, glMultiTexCoordP1uiv, glMultiTexCoordP1uiv, NULL, 620),
- NAME_FUNC_OFFSET(10125, glMultiTexCoordP2ui, glMultiTexCoordP2ui, NULL, 621),
- NAME_FUNC_OFFSET(10145, glMultiTexCoordP2uiv, glMultiTexCoordP2uiv, NULL, 622),
- NAME_FUNC_OFFSET(10166, glMultiTexCoordP3ui, glMultiTexCoordP3ui, NULL, 623),
- NAME_FUNC_OFFSET(10186, glMultiTexCoordP3uiv, glMultiTexCoordP3uiv, NULL, 624),
- NAME_FUNC_OFFSET(10207, glMultiTexCoordP4ui, glMultiTexCoordP4ui, NULL, 625),
- NAME_FUNC_OFFSET(10227, glMultiTexCoordP4uiv, glMultiTexCoordP4uiv, NULL, 626),
- NAME_FUNC_OFFSET(10248, glNormalP3ui, glNormalP3ui, NULL, 627),
- NAME_FUNC_OFFSET(10261, glNormalP3uiv, glNormalP3uiv, NULL, 628),
- NAME_FUNC_OFFSET(10275, glSecondaryColorP3ui, glSecondaryColorP3ui, NULL, 629),
- NAME_FUNC_OFFSET(10296, glSecondaryColorP3uiv, glSecondaryColorP3uiv, NULL, 630),
- NAME_FUNC_OFFSET(10318, glTexCoordP1ui, glTexCoordP1ui, NULL, 631),
- NAME_FUNC_OFFSET(10333, glTexCoordP1uiv, glTexCoordP1uiv, NULL, 632),
- NAME_FUNC_OFFSET(10349, glTexCoordP2ui, glTexCoordP2ui, NULL, 633),
- NAME_FUNC_OFFSET(10364, glTexCoordP2uiv, glTexCoordP2uiv, NULL, 634),
- NAME_FUNC_OFFSET(10380, glTexCoordP3ui, glTexCoordP3ui, NULL, 635),
- NAME_FUNC_OFFSET(10395, glTexCoordP3uiv, glTexCoordP3uiv, NULL, 636),
- NAME_FUNC_OFFSET(10411, glTexCoordP4ui, glTexCoordP4ui, NULL, 637),
- NAME_FUNC_OFFSET(10426, glTexCoordP4uiv, glTexCoordP4uiv, NULL, 638),
- NAME_FUNC_OFFSET(10442, glVertexAttribP1ui, glVertexAttribP1ui, NULL, 639),
- NAME_FUNC_OFFSET(10461, glVertexAttribP1uiv, glVertexAttribP1uiv, NULL, 640),
- NAME_FUNC_OFFSET(10481, glVertexAttribP2ui, glVertexAttribP2ui, NULL, 641),
- NAME_FUNC_OFFSET(10500, glVertexAttribP2uiv, glVertexAttribP2uiv, NULL, 642),
- NAME_FUNC_OFFSET(10520, glVertexAttribP3ui, glVertexAttribP3ui, NULL, 643),
- NAME_FUNC_OFFSET(10539, glVertexAttribP3uiv, glVertexAttribP3uiv, NULL, 644),
- NAME_FUNC_OFFSET(10559, glVertexAttribP4ui, glVertexAttribP4ui, NULL, 645),
- NAME_FUNC_OFFSET(10578, glVertexAttribP4uiv, glVertexAttribP4uiv, NULL, 646),
- NAME_FUNC_OFFSET(10598, glVertexP2ui, glVertexP2ui, NULL, 647),
- NAME_FUNC_OFFSET(10611, glVertexP2uiv, glVertexP2uiv, NULL, 648),
- NAME_FUNC_OFFSET(10625, glVertexP3ui, glVertexP3ui, NULL, 649),
- NAME_FUNC_OFFSET(10638, glVertexP3uiv, glVertexP3uiv, NULL, 650),
- NAME_FUNC_OFFSET(10652, glVertexP4ui, glVertexP4ui, NULL, 651),
- NAME_FUNC_OFFSET(10665, glVertexP4uiv, glVertexP4uiv, NULL, 652),
- NAME_FUNC_OFFSET(10679, glBindTransformFeedback, glBindTransformFeedback, NULL, 653),
- NAME_FUNC_OFFSET(10703, glDeleteTransformFeedbacks, glDeleteTransformFeedbacks, NULL, 654),
- NAME_FUNC_OFFSET(10730, glDrawTransformFeedback, glDrawTransformFeedback, NULL, 655),
- NAME_FUNC_OFFSET(10754, glGenTransformFeedbacks, glGenTransformFeedbacks, NULL, 656),
- NAME_FUNC_OFFSET(10778, glIsTransformFeedback, glIsTransformFeedback, NULL, 657),
- NAME_FUNC_OFFSET(10800, glPauseTransformFeedback, glPauseTransformFeedback, NULL, 658),
- NAME_FUNC_OFFSET(10825, glResumeTransformFeedback, glResumeTransformFeedback, NULL, 659),
- NAME_FUNC_OFFSET(10851, glClearDepthf, glClearDepthf, NULL, 660),
- NAME_FUNC_OFFSET(10865, glDepthRangef, glDepthRangef, NULL, 661),
- NAME_FUNC_OFFSET(10879, glGetShaderPrecisionFormat, glGetShaderPrecisionFormat, NULL, 662),
- NAME_FUNC_OFFSET(10906, glReleaseShaderCompiler, glReleaseShaderCompiler, NULL, 663),
- NAME_FUNC_OFFSET(10930, glShaderBinary, glShaderBinary, NULL, 664),
- NAME_FUNC_OFFSET(10945, glDebugMessageCallbackARB, glDebugMessageCallbackARB, NULL, 665),
- NAME_FUNC_OFFSET(10971, glDebugMessageControlARB, glDebugMessageControlARB, NULL, 666),
- NAME_FUNC_OFFSET(10996, glDebugMessageInsertARB, glDebugMessageInsertARB, NULL, 667),
- NAME_FUNC_OFFSET(11020, glGetDebugMessageLogARB, glGetDebugMessageLogARB, NULL, 668),
- NAME_FUNC_OFFSET(11044, glGetGraphicsResetStatusARB, glGetGraphicsResetStatusARB, NULL, 669),
- NAME_FUNC_OFFSET(11072, glGetnColorTableARB, glGetnColorTableARB, NULL, 670),
- NAME_FUNC_OFFSET(11092, glGetnCompressedTexImageARB, glGetnCompressedTexImageARB, NULL, 671),
- NAME_FUNC_OFFSET(11120, glGetnConvolutionFilterARB, glGetnConvolutionFilterARB, NULL, 672),
- NAME_FUNC_OFFSET(11147, glGetnHistogramARB, glGetnHistogramARB, NULL, 673),
- NAME_FUNC_OFFSET(11166, glGetnMapdvARB, glGetnMapdvARB, NULL, 674),
- NAME_FUNC_OFFSET(11181, glGetnMapfvARB, glGetnMapfvARB, NULL, 675),
- NAME_FUNC_OFFSET(11196, glGetnMapivARB, glGetnMapivARB, NULL, 676),
- NAME_FUNC_OFFSET(11211, glGetnMinmaxARB, glGetnMinmaxARB, NULL, 677),
- NAME_FUNC_OFFSET(11227, glGetnPixelMapfvARB, glGetnPixelMapfvARB, NULL, 678),
- NAME_FUNC_OFFSET(11247, glGetnPixelMapuivARB, glGetnPixelMapuivARB, NULL, 679),
- NAME_FUNC_OFFSET(11268, glGetnPixelMapusvARB, glGetnPixelMapusvARB, NULL, 680),
- NAME_FUNC_OFFSET(11289, glGetnPolygonStippleARB, glGetnPolygonStippleARB, NULL, 681),
- NAME_FUNC_OFFSET(11313, glGetnSeparableFilterARB, glGetnSeparableFilterARB, NULL, 682),
- NAME_FUNC_OFFSET(11338, glGetnTexImageARB, glGetnTexImageARB, NULL, 683),
- NAME_FUNC_OFFSET(11356, glGetnUniformdvARB, glGetnUniformdvARB, NULL, 684),
- NAME_FUNC_OFFSET(11375, glGetnUniformfvARB, glGetnUniformfvARB, NULL, 685),
- NAME_FUNC_OFFSET(11394, glGetnUniformivARB, glGetnUniformivARB, NULL, 686),
- NAME_FUNC_OFFSET(11413, glGetnUniformuivARB, glGetnUniformuivARB, NULL, 687),
- NAME_FUNC_OFFSET(11433, glReadnPixelsARB, glReadnPixelsARB, NULL, 688),
- NAME_FUNC_OFFSET(11450, glTexStorage1D, glTexStorage1D, NULL, 689),
- NAME_FUNC_OFFSET(11465, glTexStorage2D, glTexStorage2D, NULL, 690),
- NAME_FUNC_OFFSET(11480, glTexStorage3D, glTexStorage3D, NULL, 691),
- NAME_FUNC_OFFSET(11495, glTextureStorage1DEXT, glTextureStorage1DEXT, NULL, 692),
- NAME_FUNC_OFFSET(11517, glTextureStorage2DEXT, glTextureStorage2DEXT, NULL, 693),
- NAME_FUNC_OFFSET(11539, glTextureStorage3DEXT, glTextureStorage3DEXT, NULL, 694),
- NAME_FUNC_OFFSET(11561, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, 695),
- NAME_FUNC_OFFSET(11580, gl_dispatch_stub_696, gl_dispatch_stub_696, NULL, 696),
- NAME_FUNC_OFFSET(11612, gl_dispatch_stub_697, gl_dispatch_stub_697, NULL, 697),
- NAME_FUNC_OFFSET(11644, gl_dispatch_stub_698, gl_dispatch_stub_698, NULL, 698),
- NAME_FUNC_OFFSET(11672, gl_dispatch_stub_699, gl_dispatch_stub_699, NULL, 699),
- NAME_FUNC_OFFSET(11701, gl_dispatch_stub_700, gl_dispatch_stub_700, NULL, 700),
- NAME_FUNC_OFFSET(11729, gl_dispatch_stub_701, gl_dispatch_stub_701, NULL, 701),
- NAME_FUNC_OFFSET(11758, gl_dispatch_stub_702, gl_dispatch_stub_702, NULL, 702),
- NAME_FUNC_OFFSET(11775, gl_dispatch_stub_703, gl_dispatch_stub_703, NULL, 703),
- NAME_FUNC_OFFSET(11795, glColorPointerEXT, glColorPointerEXT, NULL, 704),
- NAME_FUNC_OFFSET(11813, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, 705),
- NAME_FUNC_OFFSET(11834, glIndexPointerEXT, glIndexPointerEXT, NULL, 706),
- NAME_FUNC_OFFSET(11852, glNormalPointerEXT, glNormalPointerEXT, NULL, 707),
- NAME_FUNC_OFFSET(11871, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, 708),
- NAME_FUNC_OFFSET(11892, glVertexPointerEXT, glVertexPointerEXT, NULL, 709),
- NAME_FUNC_OFFSET(11911, glPointParameterfEXT, glPointParameterfEXT, NULL, 710),
- NAME_FUNC_OFFSET(11932, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 711),
- NAME_FUNC_OFFSET(11954, glLockArraysEXT, glLockArraysEXT, NULL, 712),
- NAME_FUNC_OFFSET(11970, glUnlockArraysEXT, glUnlockArraysEXT, NULL, 713),
- NAME_FUNC_OFFSET(11988, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 714),
- NAME_FUNC_OFFSET(12010, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 715),
- NAME_FUNC_OFFSET(12033, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 716),
- NAME_FUNC_OFFSET(12055, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 717),
- NAME_FUNC_OFFSET(12078, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 718),
- NAME_FUNC_OFFSET(12100, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 719),
- NAME_FUNC_OFFSET(12123, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 720),
- NAME_FUNC_OFFSET(12145, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 721),
- NAME_FUNC_OFFSET(12168, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 722),
- NAME_FUNC_OFFSET(12190, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 723),
- NAME_FUNC_OFFSET(12213, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 724),
- NAME_FUNC_OFFSET(12236, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 725),
- NAME_FUNC_OFFSET(12260, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 726),
- NAME_FUNC_OFFSET(12283, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 727),
- NAME_FUNC_OFFSET(12307, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 728),
- NAME_FUNC_OFFSET(12330, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 729),
- NAME_FUNC_OFFSET(12354, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 730),
- NAME_FUNC_OFFSET(12381, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 731),
- NAME_FUNC_OFFSET(12402, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 732),
- NAME_FUNC_OFFSET(12425, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 733),
- NAME_FUNC_OFFSET(12446, glFogCoorddEXT, glFogCoorddEXT, NULL, 734),
- NAME_FUNC_OFFSET(12461, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 735),
- NAME_FUNC_OFFSET(12477, glFogCoordfEXT, glFogCoordfEXT, NULL, 736),
- NAME_FUNC_OFFSET(12492, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 737),
- NAME_FUNC_OFFSET(12508, gl_dispatch_stub_738, gl_dispatch_stub_738, NULL, 738),
- NAME_FUNC_OFFSET(12526, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 739),
- NAME_FUNC_OFFSET(12549, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, 740),
- NAME_FUNC_OFFSET(12575, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, 741),
- NAME_FUNC_OFFSET(12596, glCombinerInputNV, glCombinerInputNV, NULL, 742),
- NAME_FUNC_OFFSET(12614, glCombinerOutputNV, glCombinerOutputNV, NULL, 743),
- NAME_FUNC_OFFSET(12633, glCombinerParameterfNV, glCombinerParameterfNV, NULL, 744),
- NAME_FUNC_OFFSET(12656, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, 745),
- NAME_FUNC_OFFSET(12680, glCombinerParameteriNV, glCombinerParameteriNV, NULL, 746),
- NAME_FUNC_OFFSET(12703, glCombinerParameterivNV, glCombinerParameterivNV, NULL, 747),
- NAME_FUNC_OFFSET(12727, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, 748),
- NAME_FUNC_OFFSET(12750, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, 749),
- NAME_FUNC_OFFSET(12782, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, 750),
- NAME_FUNC_OFFSET(12814, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, 751),
- NAME_FUNC_OFFSET(12847, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, 752),
- NAME_FUNC_OFFSET(12880, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, 753),
- NAME_FUNC_OFFSET(12917, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, 754),
- NAME_FUNC_OFFSET(12954, glResizeBuffersMESA, glResizeBuffersMESA, NULL, 755),
- NAME_FUNC_OFFSET(12974, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 756),
- NAME_FUNC_OFFSET(12992, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 757),
- NAME_FUNC_OFFSET(13011, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 758),
- NAME_FUNC_OFFSET(13029, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 759),
- NAME_FUNC_OFFSET(13048, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 760),
- NAME_FUNC_OFFSET(13066, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 761),
- NAME_FUNC_OFFSET(13085, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 762),
- NAME_FUNC_OFFSET(13103, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 763),
- NAME_FUNC_OFFSET(13122, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 764),
- NAME_FUNC_OFFSET(13140, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 765),
- NAME_FUNC_OFFSET(13159, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 766),
- NAME_FUNC_OFFSET(13177, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 767),
- NAME_FUNC_OFFSET(13196, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 768),
- NAME_FUNC_OFFSET(13214, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 769),
- NAME_FUNC_OFFSET(13233, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 770),
- NAME_FUNC_OFFSET(13251, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 771),
- NAME_FUNC_OFFSET(13270, glWindowPos4dMESA, glWindowPos4dMESA, NULL, 772),
- NAME_FUNC_OFFSET(13288, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, 773),
- NAME_FUNC_OFFSET(13307, glWindowPos4fMESA, glWindowPos4fMESA, NULL, 774),
- NAME_FUNC_OFFSET(13325, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, 775),
- NAME_FUNC_OFFSET(13344, glWindowPos4iMESA, glWindowPos4iMESA, NULL, 776),
- NAME_FUNC_OFFSET(13362, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, 777),
- NAME_FUNC_OFFSET(13381, glWindowPos4sMESA, glWindowPos4sMESA, NULL, 778),
- NAME_FUNC_OFFSET(13399, glWindowPos4svMESA, glWindowPos4svMESA, NULL, 779),
- NAME_FUNC_OFFSET(13418, gl_dispatch_stub_780, gl_dispatch_stub_780, NULL, 780),
- NAME_FUNC_OFFSET(13443, gl_dispatch_stub_781, gl_dispatch_stub_781, NULL, 781),
- NAME_FUNC_OFFSET(13470, gl_dispatch_stub_782, gl_dispatch_stub_782, NULL, 782),
- NAME_FUNC_OFFSET(13487, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, 783),
- NAME_FUNC_OFFSET(13503, gl_dispatch_stub_784, gl_dispatch_stub_784, NULL, 784),
- NAME_FUNC_OFFSET(13517, gl_dispatch_stub_785, gl_dispatch_stub_785, NULL, 785),
- NAME_FUNC_OFFSET(13532, gl_dispatch_stub_786, gl_dispatch_stub_786, NULL, 786),
- NAME_FUNC_OFFSET(13544, gl_dispatch_stub_787, gl_dispatch_stub_787, NULL, 787),
- NAME_FUNC_OFFSET(13557, gl_dispatch_stub_788, gl_dispatch_stub_788, NULL, 788),
- NAME_FUNC_OFFSET(13571, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, 789),
- NAME_FUNC_OFFSET(13595, glBindProgramNV, glBindProgramNV, NULL, 790),
- NAME_FUNC_OFFSET(13611, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 791),
- NAME_FUNC_OFFSET(13630, glExecuteProgramNV, glExecuteProgramNV, NULL, 792),
- NAME_FUNC_OFFSET(13649, glGenProgramsNV, glGenProgramsNV, NULL, 793),
- NAME_FUNC_OFFSET(13665, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, 794),
- NAME_FUNC_OFFSET(13691, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, 795),
- NAME_FUNC_OFFSET(13717, glGetProgramStringNV, glGetProgramStringNV, NULL, 796),
- NAME_FUNC_OFFSET(13738, glGetProgramivNV, glGetProgramivNV, NULL, 797),
- NAME_FUNC_OFFSET(13755, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, 798),
- NAME_FUNC_OFFSET(13776, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 799),
- NAME_FUNC_OFFSET(13804, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, 800),
- NAME_FUNC_OFFSET(13826, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, 801),
- NAME_FUNC_OFFSET(13848, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, 802),
- NAME_FUNC_OFFSET(13870, glIsProgramNV, glIsProgramNV, NULL, 803),
- NAME_FUNC_OFFSET(13884, glLoadProgramNV, glLoadProgramNV, NULL, 804),
- NAME_FUNC_OFFSET(13900, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, 805),
- NAME_FUNC_OFFSET(13925, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, 806),
- NAME_FUNC_OFFSET(13950, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, 807),
- NAME_FUNC_OFFSET(13978, glTrackMatrixNV, glTrackMatrixNV, NULL, 808),
- NAME_FUNC_OFFSET(13994, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, 809),
- NAME_FUNC_OFFSET(14013, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, 810),
- NAME_FUNC_OFFSET(14033, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, 811),
- NAME_FUNC_OFFSET(14052, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, 812),
- NAME_FUNC_OFFSET(14072, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, 813),
- NAME_FUNC_OFFSET(14091, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, 814),
- NAME_FUNC_OFFSET(14111, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, 815),
- NAME_FUNC_OFFSET(14130, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, 816),
- NAME_FUNC_OFFSET(14150, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, 817),
- NAME_FUNC_OFFSET(14169, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, 818),
- NAME_FUNC_OFFSET(14189, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, 819),
- NAME_FUNC_OFFSET(14208, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, 820),
- NAME_FUNC_OFFSET(14228, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, 821),
- NAME_FUNC_OFFSET(14247, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, 822),
- NAME_FUNC_OFFSET(14267, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, 823),
- NAME_FUNC_OFFSET(14286, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, 824),
- NAME_FUNC_OFFSET(14306, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, 825),
- NAME_FUNC_OFFSET(14325, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, 826),
- NAME_FUNC_OFFSET(14345, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, 827),
- NAME_FUNC_OFFSET(14364, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, 828),
- NAME_FUNC_OFFSET(14384, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, 829),
- NAME_FUNC_OFFSET(14403, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, 830),
- NAME_FUNC_OFFSET(14423, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, 831),
- NAME_FUNC_OFFSET(14442, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, 832),
- NAME_FUNC_OFFSET(14462, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, 833),
- NAME_FUNC_OFFSET(14482, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, 834),
- NAME_FUNC_OFFSET(14503, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, 835),
- NAME_FUNC_OFFSET(14527, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, 836),
- NAME_FUNC_OFFSET(14548, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, 837),
- NAME_FUNC_OFFSET(14569, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, 838),
- NAME_FUNC_OFFSET(14590, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, 839),
- NAME_FUNC_OFFSET(14611, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, 840),
- NAME_FUNC_OFFSET(14632, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, 841),
- NAME_FUNC_OFFSET(14653, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, 842),
- NAME_FUNC_OFFSET(14674, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, 843),
- NAME_FUNC_OFFSET(14695, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, 844),
- NAME_FUNC_OFFSET(14716, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, 845),
- NAME_FUNC_OFFSET(14737, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, 846),
- NAME_FUNC_OFFSET(14758, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, 847),
- NAME_FUNC_OFFSET(14779, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, 848),
- NAME_FUNC_OFFSET(14801, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, 849),
- NAME_FUNC_OFFSET(14828, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, 850),
- NAME_FUNC_OFFSET(14855, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, 851),
- NAME_FUNC_OFFSET(14879, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, 852),
- NAME_FUNC_OFFSET(14903, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, 853),
- NAME_FUNC_OFFSET(14925, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, 854),
- NAME_FUNC_OFFSET(14947, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, 855),
- NAME_FUNC_OFFSET(14969, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, 856),
- NAME_FUNC_OFFSET(14994, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, 857),
- NAME_FUNC_OFFSET(15018, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, 858),
- NAME_FUNC_OFFSET(15040, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, 859),
- NAME_FUNC_OFFSET(15062, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, 860),
- NAME_FUNC_OFFSET(15084, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, 861),
- NAME_FUNC_OFFSET(15110, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, 862),
- NAME_FUNC_OFFSET(15133, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, 863),
- NAME_FUNC_OFFSET(15157, glPassTexCoordATI, glPassTexCoordATI, NULL, 864),
- NAME_FUNC_OFFSET(15175, glSampleMapATI, glSampleMapATI, NULL, 865),
- NAME_FUNC_OFFSET(15190, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, 866),
- NAME_FUNC_OFFSET(15221, glPointParameteriNV, glPointParameteriNV, NULL, 867),
- NAME_FUNC_OFFSET(15241, glPointParameterivNV, glPointParameterivNV, NULL, 868),
- NAME_FUNC_OFFSET(15262, gl_dispatch_stub_869, gl_dispatch_stub_869, NULL, 869),
- NAME_FUNC_OFFSET(15285, gl_dispatch_stub_870, gl_dispatch_stub_870, NULL, 870),
- NAME_FUNC_OFFSET(15308, gl_dispatch_stub_871, gl_dispatch_stub_871, NULL, 871),
- NAME_FUNC_OFFSET(15334, gl_dispatch_stub_872, gl_dispatch_stub_872, NULL, 872),
- NAME_FUNC_OFFSET(15357, gl_dispatch_stub_873, gl_dispatch_stub_873, NULL, 873),
- NAME_FUNC_OFFSET(15378, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, 874),
- NAME_FUNC_OFFSET(15409, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, 875),
- NAME_FUNC_OFFSET(15440, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, 876),
- NAME_FUNC_OFFSET(15468, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, 877),
- NAME_FUNC_OFFSET(15497, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, 878),
- NAME_FUNC_OFFSET(15525, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, 879),
- NAME_FUNC_OFFSET(15554, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 880),
- NAME_FUNC_OFFSET(15580, glPrimitiveRestartNV, glPrimitiveRestartNV, NULL, 881),
- NAME_FUNC_OFFSET(15601, gl_dispatch_stub_882, gl_dispatch_stub_882, NULL, 882),
- NAME_FUNC_OFFSET(15618, gl_dispatch_stub_883, gl_dispatch_stub_883, NULL, 883),
- NAME_FUNC_OFFSET(15645, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 884),
- NAME_FUNC_OFFSET(15666, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 885),
- NAME_FUNC_OFFSET(15688, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 886),
- NAME_FUNC_OFFSET(15716, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 887),
- NAME_FUNC_OFFSET(15740, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 888),
- NAME_FUNC_OFFSET(15765, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 889),
- NAME_FUNC_OFFSET(15794, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 890),
- NAME_FUNC_OFFSET(15820, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 891),
- NAME_FUNC_OFFSET(15846, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 892),
- NAME_FUNC_OFFSET(15872, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 893),
- NAME_FUNC_OFFSET(15893, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 894),
- NAME_FUNC_OFFSET(15915, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 895),
- NAME_FUNC_OFFSET(15935, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 896),
- NAME_FUNC_OFFSET(15976, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 897),
- NAME_FUNC_OFFSET(16008, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 898),
- NAME_FUNC_OFFSET(16027, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 899),
- NAME_FUNC_OFFSET(16047, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 900),
- NAME_FUNC_OFFSET(16072, gl_dispatch_stub_901, gl_dispatch_stub_901, NULL, 901),
- NAME_FUNC_OFFSET(16093, gl_dispatch_stub_902, gl_dispatch_stub_902, NULL, 902),
- NAME_FUNC_OFFSET(16117, gl_dispatch_stub_903, gl_dispatch_stub_903, NULL, 903),
- NAME_FUNC_OFFSET(16147, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 904),
- NAME_FUNC_OFFSET(16173, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 905),
- NAME_FUNC_OFFSET(16198, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 906),
- NAME_FUNC_OFFSET(16217, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 907),
- NAME_FUNC_OFFSET(16241, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 908),
- NAME_FUNC_OFFSET(16266, glUniform1uiEXT, glUniform1uiEXT, NULL, 909),
- NAME_FUNC_OFFSET(16282, glUniform1uivEXT, glUniform1uivEXT, NULL, 910),
- NAME_FUNC_OFFSET(16299, glUniform2uiEXT, glUniform2uiEXT, NULL, 911),
- NAME_FUNC_OFFSET(16315, glUniform2uivEXT, glUniform2uivEXT, NULL, 912),
- NAME_FUNC_OFFSET(16332, glUniform3uiEXT, glUniform3uiEXT, NULL, 913),
- NAME_FUNC_OFFSET(16348, glUniform3uivEXT, glUniform3uivEXT, NULL, 914),
- NAME_FUNC_OFFSET(16365, glUniform4uiEXT, glUniform4uiEXT, NULL, 915),
- NAME_FUNC_OFFSET(16381, glUniform4uivEXT, glUniform4uivEXT, NULL, 916),
- NAME_FUNC_OFFSET(16398, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 917),
- NAME_FUNC_OFFSET(16419, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 918),
- NAME_FUNC_OFFSET(16441, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 919),
- NAME_FUNC_OFFSET(16463, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 920),
- NAME_FUNC_OFFSET(16486, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 921),
- NAME_FUNC_OFFSET(16507, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 922),
- NAME_FUNC_OFFSET(16529, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 923),
- NAME_FUNC_OFFSET(16551, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 924),
- NAME_FUNC_OFFSET(16574, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 925),
- NAME_FUNC_OFFSET(16595, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 926),
- NAME_FUNC_OFFSET(16617, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 927),
- NAME_FUNC_OFFSET(16639, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 928),
- NAME_FUNC_OFFSET(16662, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 929),
- NAME_FUNC_OFFSET(16684, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 930),
- NAME_FUNC_OFFSET(16705, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 931),
- NAME_FUNC_OFFSET(16727, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 932),
- NAME_FUNC_OFFSET(16749, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 933),
- NAME_FUNC_OFFSET(16772, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 934),
- NAME_FUNC_OFFSET(16794, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 935),
- NAME_FUNC_OFFSET(16817, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 936),
- NAME_FUNC_OFFSET(16840, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 937),
- NAME_FUNC_OFFSET(16866, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 938),
- NAME_FUNC_OFFSET(16895, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 939),
- NAME_FUNC_OFFSET(16917, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 940),
- NAME_FUNC_OFFSET(16937, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 941),
- NAME_FUNC_OFFSET(16956, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 942),
- NAME_FUNC_OFFSET(16980, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 943),
- NAME_FUNC_OFFSET(17004, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 944),
- NAME_FUNC_OFFSET(17026, glClearColorIiEXT, glClearColorIiEXT, NULL, 945),
- NAME_FUNC_OFFSET(17044, glClearColorIuiEXT, glClearColorIuiEXT, NULL, 946),
- NAME_FUNC_OFFSET(17063, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 947),
- NAME_FUNC_OFFSET(17087, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 948),
- NAME_FUNC_OFFSET(17112, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 949),
- NAME_FUNC_OFFSET(17133, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 950),
- NAME_FUNC_OFFSET(17155, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 951),
- NAME_FUNC_OFFSET(17182, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 952),
- NAME_FUNC_OFFSET(17207, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 953),
- NAME_FUNC_OFFSET(17235, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 954),
- NAME_FUNC_OFFSET(17255, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL, 955),
- NAME_FUNC_OFFSET(17277, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 956),
- NAME_FUNC_OFFSET(17298, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 957),
- NAME_FUNC_OFFSET(17324, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 958),
- NAME_FUNC_OFFSET(17357, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 959),
- NAME_FUNC_OFFSET(17388, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 960),
- NAME_FUNC_OFFSET(17409, gl_dispatch_stub_961, gl_dispatch_stub_961, NULL, 961),
- NAME_FUNC_OFFSET(17440, gl_dispatch_stub_962, gl_dispatch_stub_962, NULL, 962),
- NAME_FUNC_OFFSET(17460, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, 963),
- NAME_FUNC_OFFSET(17488, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, 964),
- NAME_FUNC_OFFSET(17511, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, 965),
- NAME_FUNC_OFFSET(17536, glActiveProgramEXT, glActiveProgramEXT, NULL, 966),
- NAME_FUNC_OFFSET(17555, glCreateShaderProgramEXT, glCreateShaderProgramEXT, NULL, 967),
- NAME_FUNC_OFFSET(17580, glUseShaderProgramEXT, glUseShaderProgramEXT, NULL, 968),
- NAME_FUNC_OFFSET(17602, glTextureBarrierNV, glTextureBarrierNV, NULL, 969),
- NAME_FUNC_OFFSET(17621, gl_dispatch_stub_970, gl_dispatch_stub_970, NULL, 970),
- NAME_FUNC_OFFSET(17646, gl_dispatch_stub_971, gl_dispatch_stub_971, NULL, 971),
- NAME_FUNC_OFFSET(17675, gl_dispatch_stub_972, gl_dispatch_stub_972, NULL, 972),
- NAME_FUNC_OFFSET(17706, gl_dispatch_stub_973, gl_dispatch_stub_973, NULL, 973),
- NAME_FUNC_OFFSET(17730, gl_dispatch_stub_974, gl_dispatch_stub_974, NULL, 974),
- NAME_FUNC_OFFSET(17755, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, 975),
- NAME_FUNC_OFFSET(17794, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, 976),
- NAME_FUNC_OFFSET(17823, glArrayElement, glArrayElement, NULL, 306),
- NAME_FUNC_OFFSET(17841, glBindTexture, glBindTexture, NULL, 307),
- NAME_FUNC_OFFSET(17858, glDrawArrays, glDrawArrays, NULL, 310),
- NAME_FUNC_OFFSET(17874, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, 322),
- NAME_FUNC_OFFSET(17899, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
- NAME_FUNC_OFFSET(17919, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
- NAME_FUNC_OFFSET(17939, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, 325),
- NAME_FUNC_OFFSET(17962, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, 326),
- NAME_FUNC_OFFSET(17985, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, 327),
- NAME_FUNC_OFFSET(18005, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, 328),
- NAME_FUNC_OFFSET(18022, glGetPointerv, glGetPointerv, NULL, 329),
- NAME_FUNC_OFFSET(18039, glIsTexture, glIsTextureEXT, glIsTextureEXT, 330),
- NAME_FUNC_OFFSET(18054, glPrioritizeTextures, glPrioritizeTextures, NULL, 331),
- NAME_FUNC_OFFSET(18078, glTexSubImage1D, glTexSubImage1D, NULL, 332),
- NAME_FUNC_OFFSET(18097, glTexSubImage2D, glTexSubImage2D, NULL, 333),
- NAME_FUNC_OFFSET(18116, glBlendColor, glBlendColor, NULL, 336),
- NAME_FUNC_OFFSET(18132, glBlendEquation, glBlendEquation, NULL, 337),
- NAME_FUNC_OFFSET(18151, glDrawRangeElements, glDrawRangeElements, NULL, 338),
- NAME_FUNC_OFFSET(18174, glColorTable, glColorTable, NULL, 339),
- NAME_FUNC_OFFSET(18190, glColorTable, glColorTable, NULL, 339),
- NAME_FUNC_OFFSET(18206, glColorTableParameterfv, glColorTableParameterfv, NULL, 340),
- NAME_FUNC_OFFSET(18233, glColorTableParameteriv, glColorTableParameteriv, NULL, 341),
- NAME_FUNC_OFFSET(18260, glCopyColorTable, glCopyColorTable, NULL, 342),
- NAME_FUNC_OFFSET(18280, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
- NAME_FUNC_OFFSET(18299, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
- NAME_FUNC_OFFSET(18318, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
- NAME_FUNC_OFFSET(18348, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
- NAME_FUNC_OFFSET(18378, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
- NAME_FUNC_OFFSET(18408, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
- NAME_FUNC_OFFSET(18438, glColorSubTable, glColorSubTable, NULL, 346),
- NAME_FUNC_OFFSET(18457, glCopyColorSubTable, glCopyColorSubTable, NULL, 347),
- NAME_FUNC_OFFSET(18480, glConvolutionFilter1D, glConvolutionFilter1D, NULL, 348),
- NAME_FUNC_OFFSET(18505, glConvolutionFilter2D, glConvolutionFilter2D, NULL, 349),
- NAME_FUNC_OFFSET(18530, glConvolutionParameterf, glConvolutionParameterf, NULL, 350),
- NAME_FUNC_OFFSET(18557, glConvolutionParameterfv, glConvolutionParameterfv, NULL, 351),
- NAME_FUNC_OFFSET(18585, glConvolutionParameteri, glConvolutionParameteri, NULL, 352),
- NAME_FUNC_OFFSET(18612, glConvolutionParameteriv, glConvolutionParameteriv, NULL, 353),
- NAME_FUNC_OFFSET(18640, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, 354),
- NAME_FUNC_OFFSET(18669, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, 355),
- NAME_FUNC_OFFSET(18698, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, 356),
- NAME_FUNC_OFFSET(18724, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, 357),
- NAME_FUNC_OFFSET(18755, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, 358),
- NAME_FUNC_OFFSET(18786, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, 359),
- NAME_FUNC_OFFSET(18810, glSeparableFilter2D, glSeparableFilter2D, NULL, 360),
- NAME_FUNC_OFFSET(18833, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, 361),
- NAME_FUNC_OFFSET(18851, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, 362),
- NAME_FUNC_OFFSET(18880, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, 363),
- NAME_FUNC_OFFSET(18909, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, 364),
- NAME_FUNC_OFFSET(18924, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, 365),
- NAME_FUNC_OFFSET(18950, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, 366),
- NAME_FUNC_OFFSET(18976, glHistogram, glHistogram, NULL, 367),
- NAME_FUNC_OFFSET(18991, glMinmax, glMinmax, NULL, 368),
- NAME_FUNC_OFFSET(19003, glResetHistogram, glResetHistogram, NULL, 369),
- NAME_FUNC_OFFSET(19023, glResetMinmax, glResetMinmax, NULL, 370),
- NAME_FUNC_OFFSET(19040, glTexImage3D, glTexImage3D, NULL, 371),
- NAME_FUNC_OFFSET(19056, glTexSubImage3D, glTexSubImage3D, NULL, 372),
- NAME_FUNC_OFFSET(19075, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, 373),
- NAME_FUNC_OFFSET(19098, glActiveTextureARB, glActiveTextureARB, NULL, 374),
- NAME_FUNC_OFFSET(19114, glClientActiveTextureARB, glClientActiveTextureARB, NULL, 375),
- NAME_FUNC_OFFSET(19136, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, 376),
- NAME_FUNC_OFFSET(19154, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, 377),
- NAME_FUNC_OFFSET(19173, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, 378),
- NAME_FUNC_OFFSET(19191, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, 379),
- NAME_FUNC_OFFSET(19210, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, 380),
- NAME_FUNC_OFFSET(19228, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, 381),
- NAME_FUNC_OFFSET(19247, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, 382),
- NAME_FUNC_OFFSET(19265, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, 383),
- NAME_FUNC_OFFSET(19284, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, 384),
- NAME_FUNC_OFFSET(19302, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, 385),
- NAME_FUNC_OFFSET(19321, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, 386),
- NAME_FUNC_OFFSET(19339, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, 387),
- NAME_FUNC_OFFSET(19358, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, 388),
- NAME_FUNC_OFFSET(19376, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, 389),
- NAME_FUNC_OFFSET(19395, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, 390),
- NAME_FUNC_OFFSET(19413, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, 391),
- NAME_FUNC_OFFSET(19432, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, 392),
- NAME_FUNC_OFFSET(19450, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, 393),
- NAME_FUNC_OFFSET(19469, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, 394),
- NAME_FUNC_OFFSET(19487, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, 395),
- NAME_FUNC_OFFSET(19506, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, 396),
- NAME_FUNC_OFFSET(19524, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, 397),
- NAME_FUNC_OFFSET(19543, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, 398),
- NAME_FUNC_OFFSET(19561, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, 399),
- NAME_FUNC_OFFSET(19580, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, 400),
- NAME_FUNC_OFFSET(19598, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, 401),
- NAME_FUNC_OFFSET(19617, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, 402),
- NAME_FUNC_OFFSET(19635, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, 403),
- NAME_FUNC_OFFSET(19654, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, 404),
- NAME_FUNC_OFFSET(19672, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, 405),
- NAME_FUNC_OFFSET(19691, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, 406),
- NAME_FUNC_OFFSET(19709, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, 407),
- NAME_FUNC_OFFSET(19728, glStencilOpSeparate, glStencilOpSeparate, NULL, 423),
- NAME_FUNC_OFFSET(19751, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, 441),
- NAME_FUNC_OFFSET(19774, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, 442),
- NAME_FUNC_OFFSET(19797, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, 443),
- NAME_FUNC_OFFSET(19820, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, 444),
- NAME_FUNC_OFFSET(19843, glSampleCoverageARB, glSampleCoverageARB, NULL, 445),
- NAME_FUNC_OFFSET(19860, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, 446),
- NAME_FUNC_OFFSET(19883, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, 447),
- NAME_FUNC_OFFSET(19906, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, 448),
- NAME_FUNC_OFFSET(19929, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, 449),
- NAME_FUNC_OFFSET(19955, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, 450),
- NAME_FUNC_OFFSET(19981, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, 451),
- NAME_FUNC_OFFSET(20007, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, 452),
- NAME_FUNC_OFFSET(20031, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, 453),
- NAME_FUNC_OFFSET(20058, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, 454),
- NAME_FUNC_OFFSET(20084, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, 461),
- NAME_FUNC_OFFSET(20104, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, 462),
- NAME_FUNC_OFFSET(20124, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, 463),
- NAME_FUNC_OFFSET(20144, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, 464),
- NAME_FUNC_OFFSET(20167, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, 465),
- NAME_FUNC_OFFSET(20191, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, 466),
- NAME_FUNC_OFFSET(20214, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, 467),
- NAME_FUNC_OFFSET(20238, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, 473),
- NAME_FUNC_OFFSET(20255, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, 474),
- NAME_FUNC_OFFSET(20273, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, 475),
- NAME_FUNC_OFFSET(20290, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, 476),
- NAME_FUNC_OFFSET(20308, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, 477),
- NAME_FUNC_OFFSET(20325, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, 478),
- NAME_FUNC_OFFSET(20343, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, 479),
- NAME_FUNC_OFFSET(20360, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, 480),
- NAME_FUNC_OFFSET(20378, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, 481),
- NAME_FUNC_OFFSET(20395, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, 482),
- NAME_FUNC_OFFSET(20413, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, 483),
- NAME_FUNC_OFFSET(20430, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, 484),
- NAME_FUNC_OFFSET(20448, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, 485),
- NAME_FUNC_OFFSET(20465, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, 486),
- NAME_FUNC_OFFSET(20483, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, 487),
- NAME_FUNC_OFFSET(20500, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, 488),
- NAME_FUNC_OFFSET(20518, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, 489),
- NAME_FUNC_OFFSET(20535, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, 490),
- NAME_FUNC_OFFSET(20553, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, 491),
- NAME_FUNC_OFFSET(20572, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, 492),
- NAME_FUNC_OFFSET(20591, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, 493),
- NAME_FUNC_OFFSET(20610, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, 494),
- NAME_FUNC_OFFSET(20629, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, 495),
- NAME_FUNC_OFFSET(20649, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, 496),
- NAME_FUNC_OFFSET(20669, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, 497),
- NAME_FUNC_OFFSET(20689, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, 498),
- NAME_FUNC_OFFSET(20707, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, 499),
- NAME_FUNC_OFFSET(20724, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, 500),
- NAME_FUNC_OFFSET(20742, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, 501),
- NAME_FUNC_OFFSET(20759, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, 502),
- NAME_FUNC_OFFSET(20777, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, 503),
- NAME_FUNC_OFFSET(20795, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, 504),
- NAME_FUNC_OFFSET(20812, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, 505),
- NAME_FUNC_OFFSET(20830, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, 506),
- NAME_FUNC_OFFSET(20849, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, 507),
- NAME_FUNC_OFFSET(20868, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, 508),
- NAME_FUNC_OFFSET(20887, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, 509),
- NAME_FUNC_OFFSET(20909, glBindBufferARB, glBindBufferARB, NULL, 510),
- NAME_FUNC_OFFSET(20922, glBufferDataARB, glBufferDataARB, NULL, 511),
- NAME_FUNC_OFFSET(20935, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
- NAME_FUNC_OFFSET(20951, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
- NAME_FUNC_OFFSET(20967, glGenBuffersARB, glGenBuffersARB, NULL, 514),
- NAME_FUNC_OFFSET(20980, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, 515),
- NAME_FUNC_OFFSET(21003, glGetBufferPointervARB, glGetBufferPointervARB, NULL, 516),
- NAME_FUNC_OFFSET(21023, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, 517),
- NAME_FUNC_OFFSET(21042, glIsBufferARB, glIsBufferARB, NULL, 518),
- NAME_FUNC_OFFSET(21053, glMapBufferARB, glMapBufferARB, NULL, 519),
- NAME_FUNC_OFFSET(21065, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
- NAME_FUNC_OFFSET(21079, glBeginQueryARB, glBeginQueryARB, NULL, 521),
- NAME_FUNC_OFFSET(21092, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
- NAME_FUNC_OFFSET(21108, glEndQueryARB, glEndQueryARB, NULL, 523),
- NAME_FUNC_OFFSET(21119, glGenQueriesARB, glGenQueriesARB, NULL, 524),
- NAME_FUNC_OFFSET(21132, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, 525),
- NAME_FUNC_OFFSET(21151, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, 526),
- NAME_FUNC_OFFSET(21171, glGetQueryivARB, glGetQueryivARB, NULL, 527),
- NAME_FUNC_OFFSET(21184, glIsQueryARB, glIsQueryARB, NULL, 528),
- NAME_FUNC_OFFSET(21194, glCompileShaderARB, glCompileShaderARB, NULL, 530),
- NAME_FUNC_OFFSET(21210, glGetActiveUniformARB, glGetActiveUniformARB, NULL, 535),
- NAME_FUNC_OFFSET(21229, glGetShaderSourceARB, glGetShaderSourceARB, NULL, 541),
- NAME_FUNC_OFFSET(21247, glGetUniformLocationARB, glGetUniformLocationARB, NULL, 542),
- NAME_FUNC_OFFSET(21268, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
- NAME_FUNC_OFFSET(21283, glGetUniformivARB, glGetUniformivARB, NULL, 544),
- NAME_FUNC_OFFSET(21298, glLinkProgramARB, glLinkProgramARB, NULL, 545),
- NAME_FUNC_OFFSET(21312, glShaderSourceARB, glShaderSourceARB, NULL, 546),
- NAME_FUNC_OFFSET(21327, glUniform1fARB, glUniform1fARB, NULL, 547),
- NAME_FUNC_OFFSET(21339, glUniform1fvARB, glUniform1fvARB, NULL, 548),
- NAME_FUNC_OFFSET(21352, glUniform1iARB, glUniform1iARB, NULL, 549),
- NAME_FUNC_OFFSET(21364, glUniform1ivARB, glUniform1ivARB, NULL, 550),
- NAME_FUNC_OFFSET(21377, glUniform2fARB, glUniform2fARB, NULL, 551),
- NAME_FUNC_OFFSET(21389, glUniform2fvARB, glUniform2fvARB, NULL, 552),
- NAME_FUNC_OFFSET(21402, glUniform2iARB, glUniform2iARB, NULL, 553),
- NAME_FUNC_OFFSET(21414, glUniform2ivARB, glUniform2ivARB, NULL, 554),
- NAME_FUNC_OFFSET(21427, glUniform3fARB, glUniform3fARB, NULL, 555),
- NAME_FUNC_OFFSET(21439, glUniform3fvARB, glUniform3fvARB, NULL, 556),
- NAME_FUNC_OFFSET(21452, glUniform3iARB, glUniform3iARB, NULL, 557),
- NAME_FUNC_OFFSET(21464, glUniform3ivARB, glUniform3ivARB, NULL, 558),
- NAME_FUNC_OFFSET(21477, glUniform4fARB, glUniform4fARB, NULL, 559),
- NAME_FUNC_OFFSET(21489, glUniform4fvARB, glUniform4fvARB, NULL, 560),
- NAME_FUNC_OFFSET(21502, glUniform4iARB, glUniform4iARB, NULL, 561),
- NAME_FUNC_OFFSET(21514, glUniform4ivARB, glUniform4ivARB, NULL, 562),
- NAME_FUNC_OFFSET(21527, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, 563),
- NAME_FUNC_OFFSET(21546, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, 564),
- NAME_FUNC_OFFSET(21565, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, 565),
- NAME_FUNC_OFFSET(21584, glUseProgramObjectARB, glUseProgramObjectARB, NULL, 566),
- NAME_FUNC_OFFSET(21597, glValidateProgramARB, glValidateProgramARB, NULL, 567),
- NAME_FUNC_OFFSET(21615, glBindAttribLocationARB, glBindAttribLocationARB, NULL, 568),
- NAME_FUNC_OFFSET(21636, glGetActiveAttribARB, glGetActiveAttribARB, NULL, 569),
- NAME_FUNC_OFFSET(21654, glGetAttribLocationARB, glGetAttribLocationARB, NULL, 570),
- NAME_FUNC_OFFSET(21674, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
- NAME_FUNC_OFFSET(21688, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
- NAME_FUNC_OFFSET(21705, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
- NAME_FUNC_OFFSET(21721, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 573),
- NAME_FUNC_OFFSET(21746, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 573),
- NAME_FUNC_OFFSET(21768, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 574),
- NAME_FUNC_OFFSET(21795, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 574),
- NAME_FUNC_OFFSET(21819, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, 575),
- NAME_FUNC_OFFSET(21855, glBlendEquationSeparateiARB, glBlendEquationSeparateiARB, NULL, 597),
- NAME_FUNC_OFFSET(21889, glBlendEquationiARB, glBlendEquationiARB, NULL, 598),
- NAME_FUNC_OFFSET(21915, glBlendFuncSeparateiARB, glBlendFuncSeparateiARB, NULL, 599),
- NAME_FUNC_OFFSET(21945, glBlendFunciARB, glBlendFunciARB, NULL, 600),
- NAME_FUNC_OFFSET(21967, gl_dispatch_stub_702, gl_dispatch_stub_702, NULL, 702),
- NAME_FUNC_OFFSET(21983, gl_dispatch_stub_703, gl_dispatch_stub_703, NULL, 703),
- NAME_FUNC_OFFSET(22002, glPointParameterfEXT, glPointParameterfEXT, NULL, 710),
- NAME_FUNC_OFFSET(22020, glPointParameterfEXT, glPointParameterfEXT, NULL, 710),
- NAME_FUNC_OFFSET(22041, glPointParameterfEXT, glPointParameterfEXT, NULL, 710),
- NAME_FUNC_OFFSET(22063, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 711),
- NAME_FUNC_OFFSET(22082, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 711),
- NAME_FUNC_OFFSET(22104, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 711),
- NAME_FUNC_OFFSET(22127, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 714),
- NAME_FUNC_OFFSET(22146, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 715),
- NAME_FUNC_OFFSET(22166, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 716),
- NAME_FUNC_OFFSET(22185, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 717),
- NAME_FUNC_OFFSET(22205, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 718),
- NAME_FUNC_OFFSET(22224, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 719),
- NAME_FUNC_OFFSET(22244, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 720),
- NAME_FUNC_OFFSET(22263, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 721),
- NAME_FUNC_OFFSET(22283, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 722),
- NAME_FUNC_OFFSET(22302, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 723),
- NAME_FUNC_OFFSET(22322, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 724),
- NAME_FUNC_OFFSET(22342, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 725),
- NAME_FUNC_OFFSET(22363, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 726),
- NAME_FUNC_OFFSET(22383, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 727),
- NAME_FUNC_OFFSET(22404, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 728),
- NAME_FUNC_OFFSET(22424, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 729),
- NAME_FUNC_OFFSET(22445, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 730),
- NAME_FUNC_OFFSET(22469, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 731),
- NAME_FUNC_OFFSET(22487, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 732),
- NAME_FUNC_OFFSET(22507, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 733),
- NAME_FUNC_OFFSET(22525, glFogCoorddEXT, glFogCoorddEXT, NULL, 734),
- NAME_FUNC_OFFSET(22537, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 735),
- NAME_FUNC_OFFSET(22550, glFogCoordfEXT, glFogCoordfEXT, NULL, 736),
- NAME_FUNC_OFFSET(22562, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 737),
- NAME_FUNC_OFFSET(22575, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 739),
- NAME_FUNC_OFFSET(22595, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 739),
- NAME_FUNC_OFFSET(22619, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 756),
- NAME_FUNC_OFFSET(22633, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 756),
- NAME_FUNC_OFFSET(22650, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 757),
- NAME_FUNC_OFFSET(22665, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 757),
- NAME_FUNC_OFFSET(22683, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 758),
- NAME_FUNC_OFFSET(22697, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 758),
- NAME_FUNC_OFFSET(22714, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 759),
- NAME_FUNC_OFFSET(22729, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 759),
- NAME_FUNC_OFFSET(22747, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 760),
- NAME_FUNC_OFFSET(22761, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 760),
- NAME_FUNC_OFFSET(22778, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 761),
- NAME_FUNC_OFFSET(22793, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 761),
- NAME_FUNC_OFFSET(22811, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 762),
- NAME_FUNC_OFFSET(22825, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 762),
- NAME_FUNC_OFFSET(22842, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 763),
- NAME_FUNC_OFFSET(22857, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 763),
- NAME_FUNC_OFFSET(22875, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 764),
- NAME_FUNC_OFFSET(22889, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 764),
- NAME_FUNC_OFFSET(22906, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 765),
- NAME_FUNC_OFFSET(22921, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 765),
- NAME_FUNC_OFFSET(22939, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 766),
- NAME_FUNC_OFFSET(22953, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 766),
- NAME_FUNC_OFFSET(22970, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 767),
- NAME_FUNC_OFFSET(22985, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 767),
- NAME_FUNC_OFFSET(23003, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 768),
- NAME_FUNC_OFFSET(23017, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 768),
- NAME_FUNC_OFFSET(23034, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 769),
- NAME_FUNC_OFFSET(23049, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 769),
- NAME_FUNC_OFFSET(23067, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 770),
- NAME_FUNC_OFFSET(23081, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 770),
- NAME_FUNC_OFFSET(23098, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 771),
- NAME_FUNC_OFFSET(23113, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 771),
- NAME_FUNC_OFFSET(23131, glBindProgramNV, glBindProgramNV, NULL, 790),
- NAME_FUNC_OFFSET(23148, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 791),
- NAME_FUNC_OFFSET(23168, glGenProgramsNV, glGenProgramsNV, NULL, 793),
- NAME_FUNC_OFFSET(23185, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 799),
- NAME_FUNC_OFFSET(23211, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 799),
- NAME_FUNC_OFFSET(23240, glIsProgramNV, glIsProgramNV, NULL, 803),
- NAME_FUNC_OFFSET(23255, glPointParameteriNV, glPointParameteriNV, NULL, 867),
- NAME_FUNC_OFFSET(23273, glPointParameterivNV, glPointParameterivNV, NULL, 868),
- NAME_FUNC_OFFSET(23292, gl_dispatch_stub_871, gl_dispatch_stub_871, NULL, 871),
- NAME_FUNC_OFFSET(23313, gl_dispatch_stub_873, gl_dispatch_stub_873, NULL, 873),
- NAME_FUNC_OFFSET(23329, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 880),
- NAME_FUNC_OFFSET(23353, gl_dispatch_stub_883, gl_dispatch_stub_883, NULL, 883),
- NAME_FUNC_OFFSET(23377, gl_dispatch_stub_883, gl_dispatch_stub_883, NULL, 883),
- NAME_FUNC_OFFSET(23404, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 884),
- NAME_FUNC_OFFSET(23422, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 885),
- NAME_FUNC_OFFSET(23441, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 886),
- NAME_FUNC_OFFSET(23466, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 887),
- NAME_FUNC_OFFSET(23487, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 888),
- NAME_FUNC_OFFSET(23509, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 889),
- NAME_FUNC_OFFSET(23535, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 890),
- NAME_FUNC_OFFSET(23558, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 891),
- NAME_FUNC_OFFSET(23581, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 892),
- NAME_FUNC_OFFSET(23604, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 893),
- NAME_FUNC_OFFSET(23622, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 894),
- NAME_FUNC_OFFSET(23641, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 895),
- NAME_FUNC_OFFSET(23658, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 896),
- NAME_FUNC_OFFSET(23696, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 897),
- NAME_FUNC_OFFSET(23725, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 898),
- NAME_FUNC_OFFSET(23741, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 899),
- NAME_FUNC_OFFSET(23758, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 900),
- NAME_FUNC_OFFSET(23780, gl_dispatch_stub_901, gl_dispatch_stub_901, NULL, 901),
- NAME_FUNC_OFFSET(23798, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 904),
- NAME_FUNC_OFFSET(23821, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 905),
- NAME_FUNC_OFFSET(23843, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 906),
- NAME_FUNC_OFFSET(23859, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 907),
- NAME_FUNC_OFFSET(23880, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 908),
- NAME_FUNC_OFFSET(23902, glUniform1uiEXT, glUniform1uiEXT, NULL, 909),
- NAME_FUNC_OFFSET(23915, glUniform1uivEXT, glUniform1uivEXT, NULL, 910),
- NAME_FUNC_OFFSET(23929, glUniform2uiEXT, glUniform2uiEXT, NULL, 911),
- NAME_FUNC_OFFSET(23942, glUniform2uivEXT, glUniform2uivEXT, NULL, 912),
- NAME_FUNC_OFFSET(23956, glUniform3uiEXT, glUniform3uiEXT, NULL, 913),
- NAME_FUNC_OFFSET(23969, glUniform3uivEXT, glUniform3uivEXT, NULL, 914),
- NAME_FUNC_OFFSET(23983, glUniform4uiEXT, glUniform4uiEXT, NULL, 915),
- NAME_FUNC_OFFSET(23996, glUniform4uivEXT, glUniform4uivEXT, NULL, 916),
- NAME_FUNC_OFFSET(24010, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 917),
- NAME_FUNC_OFFSET(24028, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 918),
- NAME_FUNC_OFFSET(24047, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 919),
- NAME_FUNC_OFFSET(24066, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 920),
- NAME_FUNC_OFFSET(24086, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 921),
- NAME_FUNC_OFFSET(24104, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 922),
- NAME_FUNC_OFFSET(24123, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 923),
- NAME_FUNC_OFFSET(24142, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 924),
- NAME_FUNC_OFFSET(24162, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 925),
- NAME_FUNC_OFFSET(24180, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 926),
- NAME_FUNC_OFFSET(24199, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 927),
- NAME_FUNC_OFFSET(24218, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 928),
- NAME_FUNC_OFFSET(24238, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 929),
- NAME_FUNC_OFFSET(24257, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 930),
- NAME_FUNC_OFFSET(24275, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 931),
- NAME_FUNC_OFFSET(24294, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 932),
- NAME_FUNC_OFFSET(24313, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 933),
- NAME_FUNC_OFFSET(24333, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 934),
- NAME_FUNC_OFFSET(24352, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 935),
- NAME_FUNC_OFFSET(24372, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 936),
- NAME_FUNC_OFFSET(24392, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 937),
- NAME_FUNC_OFFSET(24415, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 938),
- NAME_FUNC_OFFSET(24441, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 938),
- NAME_FUNC_OFFSET(24470, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 939),
- NAME_FUNC_OFFSET(24483, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 940),
- NAME_FUNC_OFFSET(24494, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 941),
- NAME_FUNC_OFFSET(24504, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 942),
- NAME_FUNC_OFFSET(24520, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 943),
- NAME_FUNC_OFFSET(24536, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 944),
- NAME_FUNC_OFFSET(24549, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 947),
- NAME_FUNC_OFFSET(24570, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 948),
- NAME_FUNC_OFFSET(24592, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 949),
- NAME_FUNC_OFFSET(24610, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 950),
- NAME_FUNC_OFFSET(24629, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 951),
- NAME_FUNC_OFFSET(24654, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 952),
- NAME_FUNC_OFFSET(24677, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 953),
- NAME_FUNC_OFFSET(24702, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 954),
- NAME_FUNC_OFFSET(24719, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 956),
- NAME_FUNC_OFFSET(24737, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 957),
- NAME_FUNC_OFFSET(24760, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 958),
- NAME_FUNC_OFFSET(24790, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 959),
- NAME_FUNC_OFFSET(24818, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 960),
- NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)
-};
-
-#undef NAME_FUNC_OFFSET
+/* DO NOT EDIT - This file generated automatically by gl_procs.py (from Mesa) script */
+
+/*
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * (C) Copyright IBM Corporation 2004, 2006
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL, IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+
+/* This file is only included by glapi.c and is used for
+ * the GetProcAddress() function
+ */
+
+typedef struct {
+ GLint Name_offset;
+#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
+ _glapi_proc Address;
+#endif
+ GLuint Offset;
+} glprocs_table_t;
+
+#if !defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , o }
+#elif defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f1 , o }
+#elif defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f2 , o }
+#elif !defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f3 , o }
+#endif
+
+
+
+static const char gl_string_table[] =
+ "glNewList\0"
+ "glEndList\0"
+ "glCallList\0"
+ "glCallLists\0"
+ "glDeleteLists\0"
+ "glGenLists\0"
+ "glListBase\0"
+ "glBegin\0"
+ "glBitmap\0"
+ "glColor3b\0"
+ "glColor3bv\0"
+ "glColor3d\0"
+ "glColor3dv\0"
+ "glColor3f\0"
+ "glColor3fv\0"
+ "glColor3i\0"
+ "glColor3iv\0"
+ "glColor3s\0"
+ "glColor3sv\0"
+ "glColor3ub\0"
+ "glColor3ubv\0"
+ "glColor3ui\0"
+ "glColor3uiv\0"
+ "glColor3us\0"
+ "glColor3usv\0"
+ "glColor4b\0"
+ "glColor4bv\0"
+ "glColor4d\0"
+ "glColor4dv\0"
+ "glColor4f\0"
+ "glColor4fv\0"
+ "glColor4i\0"
+ "glColor4iv\0"
+ "glColor4s\0"
+ "glColor4sv\0"
+ "glColor4ub\0"
+ "glColor4ubv\0"
+ "glColor4ui\0"
+ "glColor4uiv\0"
+ "glColor4us\0"
+ "glColor4usv\0"
+ "glEdgeFlag\0"
+ "glEdgeFlagv\0"
+ "glEnd\0"
+ "glIndexd\0"
+ "glIndexdv\0"
+ "glIndexf\0"
+ "glIndexfv\0"
+ "glIndexi\0"
+ "glIndexiv\0"
+ "glIndexs\0"
+ "glIndexsv\0"
+ "glNormal3b\0"
+ "glNormal3bv\0"
+ "glNormal3d\0"
+ "glNormal3dv\0"
+ "glNormal3f\0"
+ "glNormal3fv\0"
+ "glNormal3i\0"
+ "glNormal3iv\0"
+ "glNormal3s\0"
+ "glNormal3sv\0"
+ "glRasterPos2d\0"
+ "glRasterPos2dv\0"
+ "glRasterPos2f\0"
+ "glRasterPos2fv\0"
+ "glRasterPos2i\0"
+ "glRasterPos2iv\0"
+ "glRasterPos2s\0"
+ "glRasterPos2sv\0"
+ "glRasterPos3d\0"
+ "glRasterPos3dv\0"
+ "glRasterPos3f\0"
+ "glRasterPos3fv\0"
+ "glRasterPos3i\0"
+ "glRasterPos3iv\0"
+ "glRasterPos3s\0"
+ "glRasterPos3sv\0"
+ "glRasterPos4d\0"
+ "glRasterPos4dv\0"
+ "glRasterPos4f\0"
+ "glRasterPos4fv\0"
+ "glRasterPos4i\0"
+ "glRasterPos4iv\0"
+ "glRasterPos4s\0"
+ "glRasterPos4sv\0"
+ "glRectd\0"
+ "glRectdv\0"
+ "glRectf\0"
+ "glRectfv\0"
+ "glRecti\0"
+ "glRectiv\0"
+ "glRects\0"
+ "glRectsv\0"
+ "glTexCoord1d\0"
+ "glTexCoord1dv\0"
+ "glTexCoord1f\0"
+ "glTexCoord1fv\0"
+ "glTexCoord1i\0"
+ "glTexCoord1iv\0"
+ "glTexCoord1s\0"
+ "glTexCoord1sv\0"
+ "glTexCoord2d\0"
+ "glTexCoord2dv\0"
+ "glTexCoord2f\0"
+ "glTexCoord2fv\0"
+ "glTexCoord2i\0"
+ "glTexCoord2iv\0"
+ "glTexCoord2s\0"
+ "glTexCoord2sv\0"
+ "glTexCoord3d\0"
+ "glTexCoord3dv\0"
+ "glTexCoord3f\0"
+ "glTexCoord3fv\0"
+ "glTexCoord3i\0"
+ "glTexCoord3iv\0"
+ "glTexCoord3s\0"
+ "glTexCoord3sv\0"
+ "glTexCoord4d\0"
+ "glTexCoord4dv\0"
+ "glTexCoord4f\0"
+ "glTexCoord4fv\0"
+ "glTexCoord4i\0"
+ "glTexCoord4iv\0"
+ "glTexCoord4s\0"
+ "glTexCoord4sv\0"
+ "glVertex2d\0"
+ "glVertex2dv\0"
+ "glVertex2f\0"
+ "glVertex2fv\0"
+ "glVertex2i\0"
+ "glVertex2iv\0"
+ "glVertex2s\0"
+ "glVertex2sv\0"
+ "glVertex3d\0"
+ "glVertex3dv\0"
+ "glVertex3f\0"
+ "glVertex3fv\0"
+ "glVertex3i\0"
+ "glVertex3iv\0"
+ "glVertex3s\0"
+ "glVertex3sv\0"
+ "glVertex4d\0"
+ "glVertex4dv\0"
+ "glVertex4f\0"
+ "glVertex4fv\0"
+ "glVertex4i\0"
+ "glVertex4iv\0"
+ "glVertex4s\0"
+ "glVertex4sv\0"
+ "glClipPlane\0"
+ "glColorMaterial\0"
+ "glCullFace\0"
+ "glFogf\0"
+ "glFogfv\0"
+ "glFogi\0"
+ "glFogiv\0"
+ "glFrontFace\0"
+ "glHint\0"
+ "glLightf\0"
+ "glLightfv\0"
+ "glLighti\0"
+ "glLightiv\0"
+ "glLightModelf\0"
+ "glLightModelfv\0"
+ "glLightModeli\0"
+ "glLightModeliv\0"
+ "glLineStipple\0"
+ "glLineWidth\0"
+ "glMaterialf\0"
+ "glMaterialfv\0"
+ "glMateriali\0"
+ "glMaterialiv\0"
+ "glPointSize\0"
+ "glPolygonMode\0"
+ "glPolygonStipple\0"
+ "glScissor\0"
+ "glShadeModel\0"
+ "glTexParameterf\0"
+ "glTexParameterfv\0"
+ "glTexParameteri\0"
+ "glTexParameteriv\0"
+ "glTexImage1D\0"
+ "glTexImage2D\0"
+ "glTexEnvf\0"
+ "glTexEnvfv\0"
+ "glTexEnvi\0"
+ "glTexEnviv\0"
+ "glTexGend\0"
+ "glTexGendv\0"
+ "glTexGenf\0"
+ "glTexGenfv\0"
+ "glTexGeni\0"
+ "glTexGeniv\0"
+ "glFeedbackBuffer\0"
+ "glSelectBuffer\0"
+ "glRenderMode\0"
+ "glInitNames\0"
+ "glLoadName\0"
+ "glPassThrough\0"
+ "glPopName\0"
+ "glPushName\0"
+ "glDrawBuffer\0"
+ "glClear\0"
+ "glClearAccum\0"
+ "glClearIndex\0"
+ "glClearColor\0"
+ "glClearStencil\0"
+ "glClearDepth\0"
+ "glStencilMask\0"
+ "glColorMask\0"
+ "glDepthMask\0"
+ "glIndexMask\0"
+ "glAccum\0"
+ "glDisable\0"
+ "glEnable\0"
+ "glFinish\0"
+ "glFlush\0"
+ "glPopAttrib\0"
+ "glPushAttrib\0"
+ "glMap1d\0"
+ "glMap1f\0"
+ "glMap2d\0"
+ "glMap2f\0"
+ "glMapGrid1d\0"
+ "glMapGrid1f\0"
+ "glMapGrid2d\0"
+ "glMapGrid2f\0"
+ "glEvalCoord1d\0"
+ "glEvalCoord1dv\0"
+ "glEvalCoord1f\0"
+ "glEvalCoord1fv\0"
+ "glEvalCoord2d\0"
+ "glEvalCoord2dv\0"
+ "glEvalCoord2f\0"
+ "glEvalCoord2fv\0"
+ "glEvalMesh1\0"
+ "glEvalPoint1\0"
+ "glEvalMesh2\0"
+ "glEvalPoint2\0"
+ "glAlphaFunc\0"
+ "glBlendFunc\0"
+ "glLogicOp\0"
+ "glStencilFunc\0"
+ "glStencilOp\0"
+ "glDepthFunc\0"
+ "glPixelZoom\0"
+ "glPixelTransferf\0"
+ "glPixelTransferi\0"
+ "glPixelStoref\0"
+ "glPixelStorei\0"
+ "glPixelMapfv\0"
+ "glPixelMapuiv\0"
+ "glPixelMapusv\0"
+ "glReadBuffer\0"
+ "glCopyPixels\0"
+ "glReadPixels\0"
+ "glDrawPixels\0"
+ "glGetBooleanv\0"
+ "glGetClipPlane\0"
+ "glGetDoublev\0"
+ "glGetError\0"
+ "glGetFloatv\0"
+ "glGetIntegerv\0"
+ "glGetLightfv\0"
+ "glGetLightiv\0"
+ "glGetMapdv\0"
+ "glGetMapfv\0"
+ "glGetMapiv\0"
+ "glGetMaterialfv\0"
+ "glGetMaterialiv\0"
+ "glGetPixelMapfv\0"
+ "glGetPixelMapuiv\0"
+ "glGetPixelMapusv\0"
+ "glGetPolygonStipple\0"
+ "glGetString\0"
+ "glGetTexEnvfv\0"
+ "glGetTexEnviv\0"
+ "glGetTexGendv\0"
+ "glGetTexGenfv\0"
+ "glGetTexGeniv\0"
+ "glGetTexImage\0"
+ "glGetTexParameterfv\0"
+ "glGetTexParameteriv\0"
+ "glGetTexLevelParameterfv\0"
+ "glGetTexLevelParameteriv\0"
+ "glIsEnabled\0"
+ "glIsList\0"
+ "glDepthRange\0"
+ "glFrustum\0"
+ "glLoadIdentity\0"
+ "glLoadMatrixf\0"
+ "glLoadMatrixd\0"
+ "glMatrixMode\0"
+ "glMultMatrixf\0"
+ "glMultMatrixd\0"
+ "glOrtho\0"
+ "glPopMatrix\0"
+ "glPushMatrix\0"
+ "glRotated\0"
+ "glRotatef\0"
+ "glScaled\0"
+ "glScalef\0"
+ "glTranslated\0"
+ "glTranslatef\0"
+ "glViewport\0"
+ "glArrayElement\0"
+ "glBindTexture\0"
+ "glColorPointer\0"
+ "glDisableClientState\0"
+ "glDrawArrays\0"
+ "glDrawElements\0"
+ "glEdgeFlagPointer\0"
+ "glEnableClientState\0"
+ "glIndexPointer\0"
+ "glIndexub\0"
+ "glIndexubv\0"
+ "glInterleavedArrays\0"
+ "glNormalPointer\0"
+ "glPolygonOffset\0"
+ "glTexCoordPointer\0"
+ "glVertexPointer\0"
+ "glAreTexturesResident\0"
+ "glCopyTexImage1D\0"
+ "glCopyTexImage2D\0"
+ "glCopyTexSubImage1D\0"
+ "glCopyTexSubImage2D\0"
+ "glDeleteTextures\0"
+ "glGenTextures\0"
+ "glGetPointerv\0"
+ "glIsTexture\0"
+ "glPrioritizeTextures\0"
+ "glTexSubImage1D\0"
+ "glTexSubImage2D\0"
+ "glPopClientAttrib\0"
+ "glPushClientAttrib\0"
+ "glBlendColor\0"
+ "glBlendEquation\0"
+ "glDrawRangeElements\0"
+ "glColorTable\0"
+ "glColorTableParameterfv\0"
+ "glColorTableParameteriv\0"
+ "glCopyColorTable\0"
+ "glGetColorTable\0"
+ "glGetColorTableParameterfv\0"
+ "glGetColorTableParameteriv\0"
+ "glColorSubTable\0"
+ "glCopyColorSubTable\0"
+ "glConvolutionFilter1D\0"
+ "glConvolutionFilter2D\0"
+ "glConvolutionParameterf\0"
+ "glConvolutionParameterfv\0"
+ "glConvolutionParameteri\0"
+ "glConvolutionParameteriv\0"
+ "glCopyConvolutionFilter1D\0"
+ "glCopyConvolutionFilter2D\0"
+ "glGetConvolutionFilter\0"
+ "glGetConvolutionParameterfv\0"
+ "glGetConvolutionParameteriv\0"
+ "glGetSeparableFilter\0"
+ "glSeparableFilter2D\0"
+ "glGetHistogram\0"
+ "glGetHistogramParameterfv\0"
+ "glGetHistogramParameteriv\0"
+ "glGetMinmax\0"
+ "glGetMinmaxParameterfv\0"
+ "glGetMinmaxParameteriv\0"
+ "glHistogram\0"
+ "glMinmax\0"
+ "glResetHistogram\0"
+ "glResetMinmax\0"
+ "glTexImage3D\0"
+ "glTexSubImage3D\0"
+ "glCopyTexSubImage3D\0"
+ "glActiveTextureARB\0"
+ "glClientActiveTextureARB\0"
+ "glMultiTexCoord1dARB\0"
+ "glMultiTexCoord1dvARB\0"
+ "glMultiTexCoord1fARB\0"
+ "glMultiTexCoord1fvARB\0"
+ "glMultiTexCoord1iARB\0"
+ "glMultiTexCoord1ivARB\0"
+ "glMultiTexCoord1sARB\0"
+ "glMultiTexCoord1svARB\0"
+ "glMultiTexCoord2dARB\0"
+ "glMultiTexCoord2dvARB\0"
+ "glMultiTexCoord2fARB\0"
+ "glMultiTexCoord2fvARB\0"
+ "glMultiTexCoord2iARB\0"
+ "glMultiTexCoord2ivARB\0"
+ "glMultiTexCoord2sARB\0"
+ "glMultiTexCoord2svARB\0"
+ "glMultiTexCoord3dARB\0"
+ "glMultiTexCoord3dvARB\0"
+ "glMultiTexCoord3fARB\0"
+ "glMultiTexCoord3fvARB\0"
+ "glMultiTexCoord3iARB\0"
+ "glMultiTexCoord3ivARB\0"
+ "glMultiTexCoord3sARB\0"
+ "glMultiTexCoord3svARB\0"
+ "glMultiTexCoord4dARB\0"
+ "glMultiTexCoord4dvARB\0"
+ "glMultiTexCoord4fARB\0"
+ "glMultiTexCoord4fvARB\0"
+ "glMultiTexCoord4iARB\0"
+ "glMultiTexCoord4ivARB\0"
+ "glMultiTexCoord4sARB\0"
+ "glMultiTexCoord4svARB\0"
+ "glAttachShader\0"
+ "glCreateProgram\0"
+ "glCreateShader\0"
+ "glDeleteProgram\0"
+ "glDeleteShader\0"
+ "glDetachShader\0"
+ "glGetAttachedShaders\0"
+ "glGetProgramInfoLog\0"
+ "glGetProgramiv\0"
+ "glGetShaderInfoLog\0"
+ "glGetShaderiv\0"
+ "glIsProgram\0"
+ "glIsShader\0"
+ "glStencilFuncSeparate\0"
+ "glStencilMaskSeparate\0"
+ "glStencilOpSeparate\0"
+ "glUniformMatrix2x3fv\0"
+ "glUniformMatrix2x4fv\0"
+ "glUniformMatrix3x2fv\0"
+ "glUniformMatrix3x4fv\0"
+ "glUniformMatrix4x2fv\0"
+ "glUniformMatrix4x3fv\0"
+ "glClampColor\0"
+ "glClearBufferfi\0"
+ "glClearBufferfv\0"
+ "glClearBufferiv\0"
+ "glClearBufferuiv\0"
+ "glGetStringi\0"
+ "glTexBuffer\0"
+ "glFramebufferTexture\0"
+ "glGetBufferParameteri64v\0"
+ "glGetInteger64i_v\0"
+ "glVertexAttribDivisor\0"
+ "glLoadTransposeMatrixdARB\0"
+ "glLoadTransposeMatrixfARB\0"
+ "glMultTransposeMatrixdARB\0"
+ "glMultTransposeMatrixfARB\0"
+ "glSampleCoverageARB\0"
+ "glCompressedTexImage1DARB\0"
+ "glCompressedTexImage2DARB\0"
+ "glCompressedTexImage3DARB\0"
+ "glCompressedTexSubImage1DARB\0"
+ "glCompressedTexSubImage2DARB\0"
+ "glCompressedTexSubImage3DARB\0"
+ "glGetCompressedTexImageARB\0"
+ "glDisableVertexAttribArrayARB\0"
+ "glEnableVertexAttribArrayARB\0"
+ "glGetProgramEnvParameterdvARB\0"
+ "glGetProgramEnvParameterfvARB\0"
+ "glGetProgramLocalParameterdvARB\0"
+ "glGetProgramLocalParameterfvARB\0"
+ "glGetProgramStringARB\0"
+ "glGetProgramivARB\0"
+ "glGetVertexAttribdvARB\0"
+ "glGetVertexAttribfvARB\0"
+ "glGetVertexAttribivARB\0"
+ "glProgramEnvParameter4dARB\0"
+ "glProgramEnvParameter4dvARB\0"
+ "glProgramEnvParameter4fARB\0"
+ "glProgramEnvParameter4fvARB\0"
+ "glProgramLocalParameter4dARB\0"
+ "glProgramLocalParameter4dvARB\0"
+ "glProgramLocalParameter4fARB\0"
+ "glProgramLocalParameter4fvARB\0"
+ "glProgramStringARB\0"
+ "glVertexAttrib1dARB\0"
+ "glVertexAttrib1dvARB\0"
+ "glVertexAttrib1fARB\0"
+ "glVertexAttrib1fvARB\0"
+ "glVertexAttrib1sARB\0"
+ "glVertexAttrib1svARB\0"
+ "glVertexAttrib2dARB\0"
+ "glVertexAttrib2dvARB\0"
+ "glVertexAttrib2fARB\0"
+ "glVertexAttrib2fvARB\0"
+ "glVertexAttrib2sARB\0"
+ "glVertexAttrib2svARB\0"
+ "glVertexAttrib3dARB\0"
+ "glVertexAttrib3dvARB\0"
+ "glVertexAttrib3fARB\0"
+ "glVertexAttrib3fvARB\0"
+ "glVertexAttrib3sARB\0"
+ "glVertexAttrib3svARB\0"
+ "glVertexAttrib4NbvARB\0"
+ "glVertexAttrib4NivARB\0"
+ "glVertexAttrib4NsvARB\0"
+ "glVertexAttrib4NubARB\0"
+ "glVertexAttrib4NubvARB\0"
+ "glVertexAttrib4NuivARB\0"
+ "glVertexAttrib4NusvARB\0"
+ "glVertexAttrib4bvARB\0"
+ "glVertexAttrib4dARB\0"
+ "glVertexAttrib4dvARB\0"
+ "glVertexAttrib4fARB\0"
+ "glVertexAttrib4fvARB\0"
+ "glVertexAttrib4ivARB\0"
+ "glVertexAttrib4sARB\0"
+ "glVertexAttrib4svARB\0"
+ "glVertexAttrib4ubvARB\0"
+ "glVertexAttrib4uivARB\0"
+ "glVertexAttrib4usvARB\0"
+ "glVertexAttribPointerARB\0"
+ "glBindBufferARB\0"
+ "glBufferDataARB\0"
+ "glBufferSubDataARB\0"
+ "glDeleteBuffersARB\0"
+ "glGenBuffersARB\0"
+ "glGetBufferParameterivARB\0"
+ "glGetBufferPointervARB\0"
+ "glGetBufferSubDataARB\0"
+ "glIsBufferARB\0"
+ "glMapBufferARB\0"
+ "glUnmapBufferARB\0"
+ "glBeginQueryARB\0"
+ "glDeleteQueriesARB\0"
+ "glEndQueryARB\0"
+ "glGenQueriesARB\0"
+ "glGetQueryObjectivARB\0"
+ "glGetQueryObjectuivARB\0"
+ "glGetQueryivARB\0"
+ "glIsQueryARB\0"
+ "glAttachObjectARB\0"
+ "glCompileShaderARB\0"
+ "glCreateProgramObjectARB\0"
+ "glCreateShaderObjectARB\0"
+ "glDeleteObjectARB\0"
+ "glDetachObjectARB\0"
+ "glGetActiveUniformARB\0"
+ "glGetAttachedObjectsARB\0"
+ "glGetHandleARB\0"
+ "glGetInfoLogARB\0"
+ "glGetObjectParameterfvARB\0"
+ "glGetObjectParameterivARB\0"
+ "glGetShaderSourceARB\0"
+ "glGetUniformLocationARB\0"
+ "glGetUniformfvARB\0"
+ "glGetUniformivARB\0"
+ "glLinkProgramARB\0"
+ "glShaderSourceARB\0"
+ "glUniform1fARB\0"
+ "glUniform1fvARB\0"
+ "glUniform1iARB\0"
+ "glUniform1ivARB\0"
+ "glUniform2fARB\0"
+ "glUniform2fvARB\0"
+ "glUniform2iARB\0"
+ "glUniform2ivARB\0"
+ "glUniform3fARB\0"
+ "glUniform3fvARB\0"
+ "glUniform3iARB\0"
+ "glUniform3ivARB\0"
+ "glUniform4fARB\0"
+ "glUniform4fvARB\0"
+ "glUniform4iARB\0"
+ "glUniform4ivARB\0"
+ "glUniformMatrix2fvARB\0"
+ "glUniformMatrix3fvARB\0"
+ "glUniformMatrix4fvARB\0"
+ "glUseProgramObjectARB\0"
+ "glValidateProgramARB\0"
+ "glBindAttribLocationARB\0"
+ "glGetActiveAttribARB\0"
+ "glGetAttribLocationARB\0"
+ "glDrawBuffersARB\0"
+ "glClampColorARB\0"
+ "glDrawArraysInstancedARB\0"
+ "glDrawElementsInstancedARB\0"
+ "glRenderbufferStorageMultisample\0"
+ "glFramebufferTextureARB\0"
+ "glFramebufferTextureFaceARB\0"
+ "glProgramParameteriARB\0"
+ "glVertexAttribDivisorARB\0"
+ "glFlushMappedBufferRange\0"
+ "glMapBufferRange\0"
+ "glTexBufferARB\0"
+ "glBindVertexArray\0"
+ "glGenVertexArrays\0"
+ "glCopyBufferSubData\0"
+ "glClientWaitSync\0"
+ "glDeleteSync\0"
+ "glFenceSync\0"
+ "glGetInteger64v\0"
+ "glGetSynciv\0"
+ "glIsSync\0"
+ "glWaitSync\0"
+ "glDrawElementsBaseVertex\0"
+ "glDrawElementsInstancedBaseVertex\0"
+ "glDrawRangeElementsBaseVertex\0"
+ "glMultiDrawElementsBaseVertex\0"
+ "glBlendEquationSeparateiARB\0"
+ "glBlendEquationiARB\0"
+ "glBlendFuncSeparateiARB\0"
+ "glBlendFunciARB\0"
+ "glBindSampler\0"
+ "glDeleteSamplers\0"
+ "glGenSamplers\0"
+ "glGetSamplerParameterIiv\0"
+ "glGetSamplerParameterIuiv\0"
+ "glGetSamplerParameterfv\0"
+ "glGetSamplerParameteriv\0"
+ "glIsSampler\0"
+ "glSamplerParameterIiv\0"
+ "glSamplerParameterIuiv\0"
+ "glSamplerParameterf\0"
+ "glSamplerParameterfv\0"
+ "glSamplerParameteri\0"
+ "glSamplerParameteriv\0"
+ "glColorP3ui\0"
+ "glColorP3uiv\0"
+ "glColorP4ui\0"
+ "glColorP4uiv\0"
+ "glMultiTexCoordP1ui\0"
+ "glMultiTexCoordP1uiv\0"
+ "glMultiTexCoordP2ui\0"
+ "glMultiTexCoordP2uiv\0"
+ "glMultiTexCoordP3ui\0"
+ "glMultiTexCoordP3uiv\0"
+ "glMultiTexCoordP4ui\0"
+ "glMultiTexCoordP4uiv\0"
+ "glNormalP3ui\0"
+ "glNormalP3uiv\0"
+ "glSecondaryColorP3ui\0"
+ "glSecondaryColorP3uiv\0"
+ "glTexCoordP1ui\0"
+ "glTexCoordP1uiv\0"
+ "glTexCoordP2ui\0"
+ "glTexCoordP2uiv\0"
+ "glTexCoordP3ui\0"
+ "glTexCoordP3uiv\0"
+ "glTexCoordP4ui\0"
+ "glTexCoordP4uiv\0"
+ "glVertexAttribP1ui\0"
+ "glVertexAttribP1uiv\0"
+ "glVertexAttribP2ui\0"
+ "glVertexAttribP2uiv\0"
+ "glVertexAttribP3ui\0"
+ "glVertexAttribP3uiv\0"
+ "glVertexAttribP4ui\0"
+ "glVertexAttribP4uiv\0"
+ "glVertexP2ui\0"
+ "glVertexP2uiv\0"
+ "glVertexP3ui\0"
+ "glVertexP3uiv\0"
+ "glVertexP4ui\0"
+ "glVertexP4uiv\0"
+ "glBindTransformFeedback\0"
+ "glDeleteTransformFeedbacks\0"
+ "glDrawTransformFeedback\0"
+ "glGenTransformFeedbacks\0"
+ "glIsTransformFeedback\0"
+ "glPauseTransformFeedback\0"
+ "glResumeTransformFeedback\0"
+ "glClearDepthf\0"
+ "glDepthRangef\0"
+ "glGetShaderPrecisionFormat\0"
+ "glReleaseShaderCompiler\0"
+ "glShaderBinary\0"
+ "glDebugMessageCallbackARB\0"
+ "glDebugMessageControlARB\0"
+ "glDebugMessageInsertARB\0"
+ "glGetDebugMessageLogARB\0"
+ "glGetGraphicsResetStatusARB\0"
+ "glGetnColorTableARB\0"
+ "glGetnCompressedTexImageARB\0"
+ "glGetnConvolutionFilterARB\0"
+ "glGetnHistogramARB\0"
+ "glGetnMapdvARB\0"
+ "glGetnMapfvARB\0"
+ "glGetnMapivARB\0"
+ "glGetnMinmaxARB\0"
+ "glGetnPixelMapfvARB\0"
+ "glGetnPixelMapuivARB\0"
+ "glGetnPixelMapusvARB\0"
+ "glGetnPolygonStippleARB\0"
+ "glGetnSeparableFilterARB\0"
+ "glGetnTexImageARB\0"
+ "glGetnUniformdvARB\0"
+ "glGetnUniformfvARB\0"
+ "glGetnUniformivARB\0"
+ "glGetnUniformuivARB\0"
+ "glReadnPixelsARB\0"
+ "glTexStorage1D\0"
+ "glTexStorage2D\0"
+ "glTexStorage3D\0"
+ "glTextureStorage1DEXT\0"
+ "glTextureStorage2DEXT\0"
+ "glTextureStorage3DEXT\0"
+ "glPolygonOffsetEXT\0"
+ "glGetPixelTexGenParameterfvSGIS\0"
+ "glGetPixelTexGenParameterivSGIS\0"
+ "glPixelTexGenParameterfSGIS\0"
+ "glPixelTexGenParameterfvSGIS\0"
+ "glPixelTexGenParameteriSGIS\0"
+ "glPixelTexGenParameterivSGIS\0"
+ "glSampleMaskSGIS\0"
+ "glSamplePatternSGIS\0"
+ "glColorPointerEXT\0"
+ "glEdgeFlagPointerEXT\0"
+ "glIndexPointerEXT\0"
+ "glNormalPointerEXT\0"
+ "glTexCoordPointerEXT\0"
+ "glVertexPointerEXT\0"
+ "glPointParameterfEXT\0"
+ "glPointParameterfvEXT\0"
+ "glLockArraysEXT\0"
+ "glUnlockArraysEXT\0"
+ "glSecondaryColor3bEXT\0"
+ "glSecondaryColor3bvEXT\0"
+ "glSecondaryColor3dEXT\0"
+ "glSecondaryColor3dvEXT\0"
+ "glSecondaryColor3fEXT\0"
+ "glSecondaryColor3fvEXT\0"
+ "glSecondaryColor3iEXT\0"
+ "glSecondaryColor3ivEXT\0"
+ "glSecondaryColor3sEXT\0"
+ "glSecondaryColor3svEXT\0"
+ "glSecondaryColor3ubEXT\0"
+ "glSecondaryColor3ubvEXT\0"
+ "glSecondaryColor3uiEXT\0"
+ "glSecondaryColor3uivEXT\0"
+ "glSecondaryColor3usEXT\0"
+ "glSecondaryColor3usvEXT\0"
+ "glSecondaryColorPointerEXT\0"
+ "glMultiDrawArraysEXT\0"
+ "glMultiDrawElementsEXT\0"
+ "glFogCoordPointerEXT\0"
+ "glFogCoorddEXT\0"
+ "glFogCoorddvEXT\0"
+ "glFogCoordfEXT\0"
+ "glFogCoordfvEXT\0"
+ "glPixelTexGenSGIX\0"
+ "glBlendFuncSeparateEXT\0"
+ "glFlushVertexArrayRangeNV\0"
+ "glVertexArrayRangeNV\0"
+ "glCombinerInputNV\0"
+ "glCombinerOutputNV\0"
+ "glCombinerParameterfNV\0"
+ "glCombinerParameterfvNV\0"
+ "glCombinerParameteriNV\0"
+ "glCombinerParameterivNV\0"
+ "glFinalCombinerInputNV\0"
+ "glGetCombinerInputParameterfvNV\0"
+ "glGetCombinerInputParameterivNV\0"
+ "glGetCombinerOutputParameterfvNV\0"
+ "glGetCombinerOutputParameterivNV\0"
+ "glGetFinalCombinerInputParameterfvNV\0"
+ "glGetFinalCombinerInputParameterivNV\0"
+ "glResizeBuffersMESA\0"
+ "glWindowPos2dMESA\0"
+ "glWindowPos2dvMESA\0"
+ "glWindowPos2fMESA\0"
+ "glWindowPos2fvMESA\0"
+ "glWindowPos2iMESA\0"
+ "glWindowPos2ivMESA\0"
+ "glWindowPos2sMESA\0"
+ "glWindowPos2svMESA\0"
+ "glWindowPos3dMESA\0"
+ "glWindowPos3dvMESA\0"
+ "glWindowPos3fMESA\0"
+ "glWindowPos3fvMESA\0"
+ "glWindowPos3iMESA\0"
+ "glWindowPos3ivMESA\0"
+ "glWindowPos3sMESA\0"
+ "glWindowPos3svMESA\0"
+ "glWindowPos4dMESA\0"
+ "glWindowPos4dvMESA\0"
+ "glWindowPos4fMESA\0"
+ "glWindowPos4fvMESA\0"
+ "glWindowPos4iMESA\0"
+ "glWindowPos4ivMESA\0"
+ "glWindowPos4sMESA\0"
+ "glWindowPos4svMESA\0"
+ "glMultiModeDrawArraysIBM\0"
+ "glMultiModeDrawElementsIBM\0"
+ "glDeleteFencesNV\0"
+ "glFinishFenceNV\0"
+ "glGenFencesNV\0"
+ "glGetFenceivNV\0"
+ "glIsFenceNV\0"
+ "glSetFenceNV\0"
+ "glTestFenceNV\0"
+ "glAreProgramsResidentNV\0"
+ "glBindProgramNV\0"
+ "glDeleteProgramsNV\0"
+ "glExecuteProgramNV\0"
+ "glGenProgramsNV\0"
+ "glGetProgramParameterdvNV\0"
+ "glGetProgramParameterfvNV\0"
+ "glGetProgramStringNV\0"
+ "glGetProgramivNV\0"
+ "glGetTrackMatrixivNV\0"
+ "glGetVertexAttribPointervNV\0"
+ "glGetVertexAttribdvNV\0"
+ "glGetVertexAttribfvNV\0"
+ "glGetVertexAttribivNV\0"
+ "glIsProgramNV\0"
+ "glLoadProgramNV\0"
+ "glProgramParameters4dvNV\0"
+ "glProgramParameters4fvNV\0"
+ "glRequestResidentProgramsNV\0"
+ "glTrackMatrixNV\0"
+ "glVertexAttrib1dNV\0"
+ "glVertexAttrib1dvNV\0"
+ "glVertexAttrib1fNV\0"
+ "glVertexAttrib1fvNV\0"
+ "glVertexAttrib1sNV\0"
+ "glVertexAttrib1svNV\0"
+ "glVertexAttrib2dNV\0"
+ "glVertexAttrib2dvNV\0"
+ "glVertexAttrib2fNV\0"
+ "glVertexAttrib2fvNV\0"
+ "glVertexAttrib2sNV\0"
+ "glVertexAttrib2svNV\0"
+ "glVertexAttrib3dNV\0"
+ "glVertexAttrib3dvNV\0"
+ "glVertexAttrib3fNV\0"
+ "glVertexAttrib3fvNV\0"
+ "glVertexAttrib3sNV\0"
+ "glVertexAttrib3svNV\0"
+ "glVertexAttrib4dNV\0"
+ "glVertexAttrib4dvNV\0"
+ "glVertexAttrib4fNV\0"
+ "glVertexAttrib4fvNV\0"
+ "glVertexAttrib4sNV\0"
+ "glVertexAttrib4svNV\0"
+ "glVertexAttrib4ubNV\0"
+ "glVertexAttrib4ubvNV\0"
+ "glVertexAttribPointerNV\0"
+ "glVertexAttribs1dvNV\0"
+ "glVertexAttribs1fvNV\0"
+ "glVertexAttribs1svNV\0"
+ "glVertexAttribs2dvNV\0"
+ "glVertexAttribs2fvNV\0"
+ "glVertexAttribs2svNV\0"
+ "glVertexAttribs3dvNV\0"
+ "glVertexAttribs3fvNV\0"
+ "glVertexAttribs3svNV\0"
+ "glVertexAttribs4dvNV\0"
+ "glVertexAttribs4fvNV\0"
+ "glVertexAttribs4svNV\0"
+ "glVertexAttribs4ubvNV\0"
+ "glGetTexBumpParameterfvATI\0"
+ "glGetTexBumpParameterivATI\0"
+ "glTexBumpParameterfvATI\0"
+ "glTexBumpParameterivATI\0"
+ "glAlphaFragmentOp1ATI\0"
+ "glAlphaFragmentOp2ATI\0"
+ "glAlphaFragmentOp3ATI\0"
+ "glBeginFragmentShaderATI\0"
+ "glBindFragmentShaderATI\0"
+ "glColorFragmentOp1ATI\0"
+ "glColorFragmentOp2ATI\0"
+ "glColorFragmentOp3ATI\0"
+ "glDeleteFragmentShaderATI\0"
+ "glEndFragmentShaderATI\0"
+ "glGenFragmentShadersATI\0"
+ "glPassTexCoordATI\0"
+ "glSampleMapATI\0"
+ "glSetFragmentShaderConstantATI\0"
+ "glPointParameteriNV\0"
+ "glPointParameterivNV\0"
+ "glActiveStencilFaceEXT\0"
+ "glBindVertexArrayAPPLE\0"
+ "glDeleteVertexArraysAPPLE\0"
+ "glGenVertexArraysAPPLE\0"
+ "glIsVertexArrayAPPLE\0"
+ "glGetProgramNamedParameterdvNV\0"
+ "glGetProgramNamedParameterfvNV\0"
+ "glProgramNamedParameter4dNV\0"
+ "glProgramNamedParameter4dvNV\0"
+ "glProgramNamedParameter4fNV\0"
+ "glProgramNamedParameter4fvNV\0"
+ "glPrimitiveRestartIndexNV\0"
+ "glPrimitiveRestartNV\0"
+ "glDepthBoundsEXT\0"
+ "glBlendEquationSeparateEXT\0"
+ "glBindFramebufferEXT\0"
+ "glBindRenderbufferEXT\0"
+ "glCheckFramebufferStatusEXT\0"
+ "glDeleteFramebuffersEXT\0"
+ "glDeleteRenderbuffersEXT\0"
+ "glFramebufferRenderbufferEXT\0"
+ "glFramebufferTexture1DEXT\0"
+ "glFramebufferTexture2DEXT\0"
+ "glFramebufferTexture3DEXT\0"
+ "glGenFramebuffersEXT\0"
+ "glGenRenderbuffersEXT\0"
+ "glGenerateMipmapEXT\0"
+ "glGetFramebufferAttachmentParameterivEXT\0"
+ "glGetRenderbufferParameterivEXT\0"
+ "glIsFramebufferEXT\0"
+ "glIsRenderbufferEXT\0"
+ "glRenderbufferStorageEXT\0"
+ "glBlitFramebufferEXT\0"
+ "glBufferParameteriAPPLE\0"
+ "glFlushMappedBufferRangeAPPLE\0"
+ "glBindFragDataLocationEXT\0"
+ "glGetFragDataLocationEXT\0"
+ "glGetUniformuivEXT\0"
+ "glGetVertexAttribIivEXT\0"
+ "glGetVertexAttribIuivEXT\0"
+ "glUniform1uiEXT\0"
+ "glUniform1uivEXT\0"
+ "glUniform2uiEXT\0"
+ "glUniform2uivEXT\0"
+ "glUniform3uiEXT\0"
+ "glUniform3uivEXT\0"
+ "glUniform4uiEXT\0"
+ "glUniform4uivEXT\0"
+ "glVertexAttribI1iEXT\0"
+ "glVertexAttribI1ivEXT\0"
+ "glVertexAttribI1uiEXT\0"
+ "glVertexAttribI1uivEXT\0"
+ "glVertexAttribI2iEXT\0"
+ "glVertexAttribI2ivEXT\0"
+ "glVertexAttribI2uiEXT\0"
+ "glVertexAttribI2uivEXT\0"
+ "glVertexAttribI3iEXT\0"
+ "glVertexAttribI3ivEXT\0"
+ "glVertexAttribI3uiEXT\0"
+ "glVertexAttribI3uivEXT\0"
+ "glVertexAttribI4bvEXT\0"
+ "glVertexAttribI4iEXT\0"
+ "glVertexAttribI4ivEXT\0"
+ "glVertexAttribI4svEXT\0"
+ "glVertexAttribI4ubvEXT\0"
+ "glVertexAttribI4uiEXT\0"
+ "glVertexAttribI4uivEXT\0"
+ "glVertexAttribI4usvEXT\0"
+ "glVertexAttribIPointerEXT\0"
+ "glFramebufferTextureLayerEXT\0"
+ "glColorMaskIndexedEXT\0"
+ "glDisableIndexedEXT\0"
+ "glEnableIndexedEXT\0"
+ "glGetBooleanIndexedvEXT\0"
+ "glGetIntegerIndexedvEXT\0"
+ "glIsEnabledIndexedEXT\0"
+ "glClearColorIiEXT\0"
+ "glClearColorIuiEXT\0"
+ "glGetTexParameterIivEXT\0"
+ "glGetTexParameterIuivEXT\0"
+ "glTexParameterIivEXT\0"
+ "glTexParameterIuivEXT\0"
+ "glBeginConditionalRenderNV\0"
+ "glEndConditionalRenderNV\0"
+ "glBeginTransformFeedbackEXT\0"
+ "glBindBufferBaseEXT\0"
+ "glBindBufferOffsetEXT\0"
+ "glBindBufferRangeEXT\0"
+ "glEndTransformFeedbackEXT\0"
+ "glGetTransformFeedbackVaryingEXT\0"
+ "glTransformFeedbackVaryingsEXT\0"
+ "glProvokingVertexEXT\0"
+ "glGetTexParameterPointervAPPLE\0"
+ "glTextureRangeAPPLE\0"
+ "glGetObjectParameterivAPPLE\0"
+ "glObjectPurgeableAPPLE\0"
+ "glObjectUnpurgeableAPPLE\0"
+ "glActiveProgramEXT\0"
+ "glCreateShaderProgramEXT\0"
+ "glUseShaderProgramEXT\0"
+ "glTextureBarrierNV\0"
+ "glStencilFuncSeparateATI\0"
+ "glProgramEnvParameters4fvEXT\0"
+ "glProgramLocalParameters4fvEXT\0"
+ "glGetQueryObjecti64vEXT\0"
+ "glGetQueryObjectui64vEXT\0"
+ "glEGLImageTargetRenderbufferStorageOES\0"
+ "glEGLImageTargetTexture2DOES\0"
+ "glArrayElementEXT\0"
+ "glBindTextureEXT\0"
+ "glDrawArraysEXT\0"
+ "glAreTexturesResidentEXT\0"
+ "glCopyTexImage1DEXT\0"
+ "glCopyTexImage2DEXT\0"
+ "glCopyTexSubImage1DEXT\0"
+ "glCopyTexSubImage2DEXT\0"
+ "glDeleteTexturesEXT\0"
+ "glGenTexturesEXT\0"
+ "glGetPointervEXT\0"
+ "glIsTextureEXT\0"
+ "glPrioritizeTexturesEXT\0"
+ "glTexSubImage1DEXT\0"
+ "glTexSubImage2DEXT\0"
+ "glBlendColorEXT\0"
+ "glBlendEquationEXT\0"
+ "glDrawRangeElementsEXT\0"
+ "glColorTableSGI\0"
+ "glColorTableEXT\0"
+ "glColorTableParameterfvSGI\0"
+ "glColorTableParameterivSGI\0"
+ "glCopyColorTableSGI\0"
+ "glGetColorTableSGI\0"
+ "glGetColorTableEXT\0"
+ "glGetColorTableParameterfvSGI\0"
+ "glGetColorTableParameterfvEXT\0"
+ "glGetColorTableParameterivSGI\0"
+ "glGetColorTableParameterivEXT\0"
+ "glColorSubTableEXT\0"
+ "glCopyColorSubTableEXT\0"
+ "glConvolutionFilter1DEXT\0"
+ "glConvolutionFilter2DEXT\0"
+ "glConvolutionParameterfEXT\0"
+ "glConvolutionParameterfvEXT\0"
+ "glConvolutionParameteriEXT\0"
+ "glConvolutionParameterivEXT\0"
+ "glCopyConvolutionFilter1DEXT\0"
+ "glCopyConvolutionFilter2DEXT\0"
+ "glGetConvolutionFilterEXT\0"
+ "glGetConvolutionParameterfvEXT\0"
+ "glGetConvolutionParameterivEXT\0"
+ "glGetSeparableFilterEXT\0"
+ "glSeparableFilter2DEXT\0"
+ "glGetHistogramEXT\0"
+ "glGetHistogramParameterfvEXT\0"
+ "glGetHistogramParameterivEXT\0"
+ "glGetMinmaxEXT\0"
+ "glGetMinmaxParameterfvEXT\0"
+ "glGetMinmaxParameterivEXT\0"
+ "glHistogramEXT\0"
+ "glMinmaxEXT\0"
+ "glResetHistogramEXT\0"
+ "glResetMinmaxEXT\0"
+ "glTexImage3DEXT\0"
+ "glTexSubImage3DEXT\0"
+ "glCopyTexSubImage3DEXT\0"
+ "glActiveTexture\0"
+ "glClientActiveTexture\0"
+ "glMultiTexCoord1d\0"
+ "glMultiTexCoord1dv\0"
+ "glMultiTexCoord1f\0"
+ "glMultiTexCoord1fv\0"
+ "glMultiTexCoord1i\0"
+ "glMultiTexCoord1iv\0"
+ "glMultiTexCoord1s\0"
+ "glMultiTexCoord1sv\0"
+ "glMultiTexCoord2d\0"
+ "glMultiTexCoord2dv\0"
+ "glMultiTexCoord2f\0"
+ "glMultiTexCoord2fv\0"
+ "glMultiTexCoord2i\0"
+ "glMultiTexCoord2iv\0"
+ "glMultiTexCoord2s\0"
+ "glMultiTexCoord2sv\0"
+ "glMultiTexCoord3d\0"
+ "glMultiTexCoord3dv\0"
+ "glMultiTexCoord3f\0"
+ "glMultiTexCoord3fv\0"
+ "glMultiTexCoord3i\0"
+ "glMultiTexCoord3iv\0"
+ "glMultiTexCoord3s\0"
+ "glMultiTexCoord3sv\0"
+ "glMultiTexCoord4d\0"
+ "glMultiTexCoord4dv\0"
+ "glMultiTexCoord4f\0"
+ "glMultiTexCoord4fv\0"
+ "glMultiTexCoord4i\0"
+ "glMultiTexCoord4iv\0"
+ "glMultiTexCoord4s\0"
+ "glMultiTexCoord4sv\0"
+ "glStencilOpSeparateATI\0"
+ "glLoadTransposeMatrixd\0"
+ "glLoadTransposeMatrixf\0"
+ "glMultTransposeMatrixd\0"
+ "glMultTransposeMatrixf\0"
+ "glSampleCoverage\0"
+ "glCompressedTexImage1D\0"
+ "glCompressedTexImage2D\0"
+ "glCompressedTexImage3D\0"
+ "glCompressedTexSubImage1D\0"
+ "glCompressedTexSubImage2D\0"
+ "glCompressedTexSubImage3D\0"
+ "glGetCompressedTexImage\0"
+ "glDisableVertexAttribArray\0"
+ "glEnableVertexAttribArray\0"
+ "glGetVertexAttribdv\0"
+ "glGetVertexAttribfv\0"
+ "glGetVertexAttribiv\0"
+ "glProgramParameter4dNV\0"
+ "glProgramParameter4dvNV\0"
+ "glProgramParameter4fNV\0"
+ "glProgramParameter4fvNV\0"
+ "glVertexAttrib1d\0"
+ "glVertexAttrib1dv\0"
+ "glVertexAttrib1f\0"
+ "glVertexAttrib1fv\0"
+ "glVertexAttrib1s\0"
+ "glVertexAttrib1sv\0"
+ "glVertexAttrib2d\0"
+ "glVertexAttrib2dv\0"
+ "glVertexAttrib2f\0"
+ "glVertexAttrib2fv\0"
+ "glVertexAttrib2s\0"
+ "glVertexAttrib2sv\0"
+ "glVertexAttrib3d\0"
+ "glVertexAttrib3dv\0"
+ "glVertexAttrib3f\0"
+ "glVertexAttrib3fv\0"
+ "glVertexAttrib3s\0"
+ "glVertexAttrib3sv\0"
+ "glVertexAttrib4Nbv\0"
+ "glVertexAttrib4Niv\0"
+ "glVertexAttrib4Nsv\0"
+ "glVertexAttrib4Nub\0"
+ "glVertexAttrib4Nubv\0"
+ "glVertexAttrib4Nuiv\0"
+ "glVertexAttrib4Nusv\0"
+ "glVertexAttrib4bv\0"
+ "glVertexAttrib4d\0"
+ "glVertexAttrib4dv\0"
+ "glVertexAttrib4f\0"
+ "glVertexAttrib4fv\0"
+ "glVertexAttrib4iv\0"
+ "glVertexAttrib4s\0"
+ "glVertexAttrib4sv\0"
+ "glVertexAttrib4ubv\0"
+ "glVertexAttrib4uiv\0"
+ "glVertexAttrib4usv\0"
+ "glVertexAttribPointer\0"
+ "glBindBuffer\0"
+ "glBufferData\0"
+ "glBufferSubData\0"
+ "glDeleteBuffers\0"
+ "glGenBuffers\0"
+ "glGetBufferParameteriv\0"
+ "glGetBufferPointerv\0"
+ "glGetBufferSubData\0"
+ "glIsBuffer\0"
+ "glMapBuffer\0"
+ "glUnmapBuffer\0"
+ "glBeginQuery\0"
+ "glDeleteQueries\0"
+ "glEndQuery\0"
+ "glGenQueries\0"
+ "glGetQueryObjectiv\0"
+ "glGetQueryObjectuiv\0"
+ "glGetQueryiv\0"
+ "glIsQuery\0"
+ "glCompileShader\0"
+ "glGetActiveUniform\0"
+ "glGetShaderSource\0"
+ "glGetUniformLocation\0"
+ "glGetUniformfv\0"
+ "glGetUniformiv\0"
+ "glLinkProgram\0"
+ "glShaderSource\0"
+ "glUniform1f\0"
+ "glUniform1fv\0"
+ "glUniform1i\0"
+ "glUniform1iv\0"
+ "glUniform2f\0"
+ "glUniform2fv\0"
+ "glUniform2i\0"
+ "glUniform2iv\0"
+ "glUniform3f\0"
+ "glUniform3fv\0"
+ "glUniform3i\0"
+ "glUniform3iv\0"
+ "glUniform4f\0"
+ "glUniform4fv\0"
+ "glUniform4i\0"
+ "glUniform4iv\0"
+ "glUniformMatrix2fv\0"
+ "glUniformMatrix3fv\0"
+ "glUniformMatrix4fv\0"
+ "glUseProgram\0"
+ "glValidateProgram\0"
+ "glBindAttribLocation\0"
+ "glGetActiveAttrib\0"
+ "glGetAttribLocation\0"
+ "glDrawBuffers\0"
+ "glDrawBuffersATI\0"
+ "glDrawBuffersNV\0"
+ "glDrawArraysInstancedEXT\0"
+ "glDrawArraysInstanced\0"
+ "glDrawElementsInstancedEXT\0"
+ "glDrawElementsInstanced\0"
+ "glRenderbufferStorageMultisampleEXT\0"
+ "glBlendEquationSeparateIndexedAMD\0"
+ "glBlendEquationIndexedAMD\0"
+ "glBlendFuncSeparateIndexedAMD\0"
+ "glBlendFuncIndexedAMD\0"
+ "glSampleMaskEXT\0"
+ "glSamplePatternEXT\0"
+ "glPointParameterf\0"
+ "glPointParameterfARB\0"
+ "glPointParameterfSGIS\0"
+ "glPointParameterfv\0"
+ "glPointParameterfvARB\0"
+ "glPointParameterfvSGIS\0"
+ "glSecondaryColor3b\0"
+ "glSecondaryColor3bv\0"
+ "glSecondaryColor3d\0"
+ "glSecondaryColor3dv\0"
+ "glSecondaryColor3f\0"
+ "glSecondaryColor3fv\0"
+ "glSecondaryColor3i\0"
+ "glSecondaryColor3iv\0"
+ "glSecondaryColor3s\0"
+ "glSecondaryColor3sv\0"
+ "glSecondaryColor3ub\0"
+ "glSecondaryColor3ubv\0"
+ "glSecondaryColor3ui\0"
+ "glSecondaryColor3uiv\0"
+ "glSecondaryColor3us\0"
+ "glSecondaryColor3usv\0"
+ "glSecondaryColorPointer\0"
+ "glMultiDrawArrays\0"
+ "glMultiDrawElements\0"
+ "glFogCoordPointer\0"
+ "glFogCoordd\0"
+ "glFogCoorddv\0"
+ "glFogCoordf\0"
+ "glFogCoordfv\0"
+ "glBlendFuncSeparate\0"
+ "glBlendFuncSeparateINGR\0"
+ "glWindowPos2d\0"
+ "glWindowPos2dARB\0"
+ "glWindowPos2dv\0"
+ "glWindowPos2dvARB\0"
+ "glWindowPos2f\0"
+ "glWindowPos2fARB\0"
+ "glWindowPos2fv\0"
+ "glWindowPos2fvARB\0"
+ "glWindowPos2i\0"
+ "glWindowPos2iARB\0"
+ "glWindowPos2iv\0"
+ "glWindowPos2ivARB\0"
+ "glWindowPos2s\0"
+ "glWindowPos2sARB\0"
+ "glWindowPos2sv\0"
+ "glWindowPos2svARB\0"
+ "glWindowPos3d\0"
+ "glWindowPos3dARB\0"
+ "glWindowPos3dv\0"
+ "glWindowPos3dvARB\0"
+ "glWindowPos3f\0"
+ "glWindowPos3fARB\0"
+ "glWindowPos3fv\0"
+ "glWindowPos3fvARB\0"
+ "glWindowPos3i\0"
+ "glWindowPos3iARB\0"
+ "glWindowPos3iv\0"
+ "glWindowPos3ivARB\0"
+ "glWindowPos3s\0"
+ "glWindowPos3sARB\0"
+ "glWindowPos3sv\0"
+ "glWindowPos3svARB\0"
+ "glBindProgramARB\0"
+ "glDeleteProgramsARB\0"
+ "glGenProgramsARB\0"
+ "glGetVertexAttribPointerv\0"
+ "glGetVertexAttribPointervARB\0"
+ "glIsProgramARB\0"
+ "glPointParameteri\0"
+ "glPointParameteriv\0"
+ "glDeleteVertexArrays\0"
+ "glIsVertexArray\0"
+ "glPrimitiveRestartIndex\0"
+ "glBlendEquationSeparate\0"
+ "glBlendEquationSeparateATI\0"
+ "glBindFramebuffer\0"
+ "glBindRenderbuffer\0"
+ "glCheckFramebufferStatus\0"
+ "glDeleteFramebuffers\0"
+ "glDeleteRenderbuffers\0"
+ "glFramebufferRenderbuffer\0"
+ "glFramebufferTexture1D\0"
+ "glFramebufferTexture2D\0"
+ "glFramebufferTexture3D\0"
+ "glGenFramebuffers\0"
+ "glGenRenderbuffers\0"
+ "glGenerateMipmap\0"
+ "glGetFramebufferAttachmentParameteriv\0"
+ "glGetRenderbufferParameteriv\0"
+ "glIsFramebuffer\0"
+ "glIsRenderbuffer\0"
+ "glRenderbufferStorage\0"
+ "glBlitFramebuffer\0"
+ "glBindFragDataLocation\0"
+ "glGetFragDataLocation\0"
+ "glGetUniformuiv\0"
+ "glGetVertexAttribIiv\0"
+ "glGetVertexAttribIuiv\0"
+ "glUniform1ui\0"
+ "glUniform1uiv\0"
+ "glUniform2ui\0"
+ "glUniform2uiv\0"
+ "glUniform3ui\0"
+ "glUniform3uiv\0"
+ "glUniform4ui\0"
+ "glUniform4uiv\0"
+ "glVertexAttribI1i\0"
+ "glVertexAttribI1iv\0"
+ "glVertexAttribI1ui\0"
+ "glVertexAttribI1uiv\0"
+ "glVertexAttribI2i\0"
+ "glVertexAttribI2iv\0"
+ "glVertexAttribI2ui\0"
+ "glVertexAttribI2uiv\0"
+ "glVertexAttribI3i\0"
+ "glVertexAttribI3iv\0"
+ "glVertexAttribI3ui\0"
+ "glVertexAttribI3uiv\0"
+ "glVertexAttribI4bv\0"
+ "glVertexAttribI4i\0"
+ "glVertexAttribI4iv\0"
+ "glVertexAttribI4sv\0"
+ "glVertexAttribI4ubv\0"
+ "glVertexAttribI4ui\0"
+ "glVertexAttribI4uiv\0"
+ "glVertexAttribI4usv\0"
+ "glVertexAttribIPointer\0"
+ "glFramebufferTextureLayer\0"
+ "glFramebufferTextureLayerARB\0"
+ "glColorMaski\0"
+ "glDisablei\0"
+ "glEnablei\0"
+ "glGetBooleani_v\0"
+ "glGetIntegeri_v\0"
+ "glIsEnabledi\0"
+ "glGetTexParameterIiv\0"
+ "glGetTexParameterIuiv\0"
+ "glTexParameterIiv\0"
+ "glTexParameterIuiv\0"
+ "glBeginConditionalRender\0"
+ "glEndConditionalRender\0"
+ "glBeginTransformFeedback\0"
+ "glBindBufferBase\0"
+ "glBindBufferRange\0"
+ "glEndTransformFeedback\0"
+ "glGetTransformFeedbackVarying\0"
+ "glTransformFeedbackVaryings\0"
+ "glProvokingVertex\0"
+ ;
+
+
+#ifdef USE_MGL_NAMESPACE
+#define gl_dispatch_stub_343 mgl_dispatch_stub_343
+#define gl_dispatch_stub_344 mgl_dispatch_stub_344
+#define gl_dispatch_stub_345 mgl_dispatch_stub_345
+#define gl_dispatch_stub_356 mgl_dispatch_stub_356
+#define gl_dispatch_stub_357 mgl_dispatch_stub_357
+#define gl_dispatch_stub_358 mgl_dispatch_stub_358
+#define gl_dispatch_stub_359 mgl_dispatch_stub_359
+#define gl_dispatch_stub_361 mgl_dispatch_stub_361
+#define gl_dispatch_stub_362 mgl_dispatch_stub_362
+#define gl_dispatch_stub_363 mgl_dispatch_stub_363
+#define gl_dispatch_stub_364 mgl_dispatch_stub_364
+#define gl_dispatch_stub_365 mgl_dispatch_stub_365
+#define gl_dispatch_stub_366 mgl_dispatch_stub_366
+#define gl_dispatch_stub_696 mgl_dispatch_stub_696
+#define gl_dispatch_stub_697 mgl_dispatch_stub_697
+#define gl_dispatch_stub_698 mgl_dispatch_stub_698
+#define gl_dispatch_stub_699 mgl_dispatch_stub_699
+#define gl_dispatch_stub_700 mgl_dispatch_stub_700
+#define gl_dispatch_stub_701 mgl_dispatch_stub_701
+#define gl_dispatch_stub_702 mgl_dispatch_stub_702
+#define gl_dispatch_stub_703 mgl_dispatch_stub_703
+#define gl_dispatch_stub_738 mgl_dispatch_stub_738
+#define gl_dispatch_stub_780 mgl_dispatch_stub_780
+#define gl_dispatch_stub_781 mgl_dispatch_stub_781
+#define gl_dispatch_stub_782 mgl_dispatch_stub_782
+#define gl_dispatch_stub_783 mgl_dispatch_stub_783
+#define gl_dispatch_stub_784 mgl_dispatch_stub_784
+#define gl_dispatch_stub_785 mgl_dispatch_stub_785
+#define gl_dispatch_stub_786 mgl_dispatch_stub_786
+#define gl_dispatch_stub_787 mgl_dispatch_stub_787
+#define gl_dispatch_stub_788 mgl_dispatch_stub_788
+#define gl_dispatch_stub_869 mgl_dispatch_stub_869
+#define gl_dispatch_stub_870 mgl_dispatch_stub_870
+#define gl_dispatch_stub_871 mgl_dispatch_stub_871
+#define gl_dispatch_stub_872 mgl_dispatch_stub_872
+#define gl_dispatch_stub_873 mgl_dispatch_stub_873
+#define gl_dispatch_stub_882 mgl_dispatch_stub_882
+#define gl_dispatch_stub_883 mgl_dispatch_stub_883
+#define gl_dispatch_stub_901 mgl_dispatch_stub_901
+#define gl_dispatch_stub_902 mgl_dispatch_stub_902
+#define gl_dispatch_stub_903 mgl_dispatch_stub_903
+#define gl_dispatch_stub_961 mgl_dispatch_stub_961
+#define gl_dispatch_stub_962 mgl_dispatch_stub_962
+#define gl_dispatch_stub_970 mgl_dispatch_stub_970
+#define gl_dispatch_stub_971 mgl_dispatch_stub_971
+#define gl_dispatch_stub_972 mgl_dispatch_stub_972
+#define gl_dispatch_stub_973 mgl_dispatch_stub_973
+#define gl_dispatch_stub_974 mgl_dispatch_stub_974
+#endif /* USE_MGL_NAMESPACE */
+
+
+#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
+void GLAPIENTRY gl_dispatch_stub_343(GLenum target, GLenum format, GLenum type, GLvoid * table);
+void GLAPIENTRY gl_dispatch_stub_344(GLenum target, GLenum pname, GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_345(GLenum target, GLenum pname, GLint * params);
+void GLAPIENTRY gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, GLvoid * image);
+void GLAPIENTRY gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params);
+void GLAPIENTRY gl_dispatch_stub_359(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span);
+void GLAPIENTRY gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
+void GLAPIENTRY gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params);
+void GLAPIENTRY gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
+void GLAPIENTRY gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params);
+void GLAPIENTRY gl_dispatch_stub_696(GLenum pname, GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_697(GLenum pname, GLint * params);
+void GLAPIENTRY gl_dispatch_stub_698(GLenum pname, GLfloat param);
+void GLAPIENTRY gl_dispatch_stub_699(GLenum pname, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_700(GLenum pname, GLint param);
+void GLAPIENTRY gl_dispatch_stub_701(GLenum pname, const GLint * params);
+void GLAPIENTRY gl_dispatch_stub_702(GLclampf value, GLboolean invert);
+void GLAPIENTRY gl_dispatch_stub_703(GLenum pattern);
+void GLAPIENTRY gl_dispatch_stub_738(GLenum mode);
+void GLAPIENTRY gl_dispatch_stub_780(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);
+void GLAPIENTRY gl_dispatch_stub_781(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride);
+void GLAPIENTRY gl_dispatch_stub_782(GLsizei n, const GLuint * fences);
+void GLAPIENTRY gl_dispatch_stub_783(GLuint fence);
+void GLAPIENTRY gl_dispatch_stub_784(GLsizei n, GLuint * fences);
+void GLAPIENTRY gl_dispatch_stub_785(GLuint fence, GLenum pname, GLint * params);
+GLboolean GLAPIENTRY gl_dispatch_stub_786(GLuint fence);
+void GLAPIENTRY gl_dispatch_stub_787(GLuint fence, GLenum condition);
+GLboolean GLAPIENTRY gl_dispatch_stub_788(GLuint fence);
+void GLAPIENTRY gl_dispatch_stub_869(GLenum face);
+void GLAPIENTRY gl_dispatch_stub_870(GLuint array);
+void GLAPIENTRY gl_dispatch_stub_871(GLsizei n, const GLuint * arrays);
+void GLAPIENTRY gl_dispatch_stub_872(GLsizei n, GLuint * arrays);
+GLboolean GLAPIENTRY gl_dispatch_stub_873(GLuint array);
+void GLAPIENTRY gl_dispatch_stub_882(GLclampd zmin, GLclampd zmax);
+void GLAPIENTRY gl_dispatch_stub_883(GLenum modeRGB, GLenum modeA);
+void GLAPIENTRY gl_dispatch_stub_901(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+void GLAPIENTRY gl_dispatch_stub_902(GLenum target, GLenum pname, GLint param);
+void GLAPIENTRY gl_dispatch_stub_903(GLenum target, GLintptr offset, GLsizeiptr size);
+void GLAPIENTRY gl_dispatch_stub_961(GLenum target, GLenum pname, GLvoid ** params);
+void GLAPIENTRY gl_dispatch_stub_962(GLenum target, GLsizei length, GLvoid * pointer);
+void GLAPIENTRY gl_dispatch_stub_970(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+void GLAPIENTRY gl_dispatch_stub_971(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_972(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_973(GLuint id, GLenum pname, GLint64EXT * params);
+void GLAPIENTRY gl_dispatch_stub_974(GLuint id, GLenum pname, GLuint64EXT * params);
+#endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */
+
+static const glprocs_table_t static_functions[] = {
+ NAME_FUNC_OFFSET( 0, glNewList, glNewList, NULL, 0),
+ NAME_FUNC_OFFSET( 10, glEndList, glEndList, NULL, 1),
+ NAME_FUNC_OFFSET( 20, glCallList, glCallList, NULL, 2),
+ NAME_FUNC_OFFSET( 31, glCallLists, glCallLists, NULL, 3),
+ NAME_FUNC_OFFSET( 43, glDeleteLists, glDeleteLists, NULL, 4),
+ NAME_FUNC_OFFSET( 57, glGenLists, glGenLists, NULL, 5),
+ NAME_FUNC_OFFSET( 68, glListBase, glListBase, NULL, 6),
+ NAME_FUNC_OFFSET( 79, glBegin, glBegin, NULL, 7),
+ NAME_FUNC_OFFSET( 87, glBitmap, glBitmap, NULL, 8),
+ NAME_FUNC_OFFSET( 96, glColor3b, glColor3b, NULL, 9),
+ NAME_FUNC_OFFSET( 106, glColor3bv, glColor3bv, NULL, 10),
+ NAME_FUNC_OFFSET( 117, glColor3d, glColor3d, NULL, 11),
+ NAME_FUNC_OFFSET( 127, glColor3dv, glColor3dv, NULL, 12),
+ NAME_FUNC_OFFSET( 138, glColor3f, glColor3f, NULL, 13),
+ NAME_FUNC_OFFSET( 148, glColor3fv, glColor3fv, NULL, 14),
+ NAME_FUNC_OFFSET( 159, glColor3i, glColor3i, NULL, 15),
+ NAME_FUNC_OFFSET( 169, glColor3iv, glColor3iv, NULL, 16),
+ NAME_FUNC_OFFSET( 180, glColor3s, glColor3s, NULL, 17),
+ NAME_FUNC_OFFSET( 190, glColor3sv, glColor3sv, NULL, 18),
+ NAME_FUNC_OFFSET( 201, glColor3ub, glColor3ub, NULL, 19),
+ NAME_FUNC_OFFSET( 212, glColor3ubv, glColor3ubv, NULL, 20),
+ NAME_FUNC_OFFSET( 224, glColor3ui, glColor3ui, NULL, 21),
+ NAME_FUNC_OFFSET( 235, glColor3uiv, glColor3uiv, NULL, 22),
+ NAME_FUNC_OFFSET( 247, glColor3us, glColor3us, NULL, 23),
+ NAME_FUNC_OFFSET( 258, glColor3usv, glColor3usv, NULL, 24),
+ NAME_FUNC_OFFSET( 270, glColor4b, glColor4b, NULL, 25),
+ NAME_FUNC_OFFSET( 280, glColor4bv, glColor4bv, NULL, 26),
+ NAME_FUNC_OFFSET( 291, glColor4d, glColor4d, NULL, 27),
+ NAME_FUNC_OFFSET( 301, glColor4dv, glColor4dv, NULL, 28),
+ NAME_FUNC_OFFSET( 312, glColor4f, glColor4f, NULL, 29),
+ NAME_FUNC_OFFSET( 322, glColor4fv, glColor4fv, NULL, 30),
+ NAME_FUNC_OFFSET( 333, glColor4i, glColor4i, NULL, 31),
+ NAME_FUNC_OFFSET( 343, glColor4iv, glColor4iv, NULL, 32),
+ NAME_FUNC_OFFSET( 354, glColor4s, glColor4s, NULL, 33),
+ NAME_FUNC_OFFSET( 364, glColor4sv, glColor4sv, NULL, 34),
+ NAME_FUNC_OFFSET( 375, glColor4ub, glColor4ub, NULL, 35),
+ NAME_FUNC_OFFSET( 386, glColor4ubv, glColor4ubv, NULL, 36),
+ NAME_FUNC_OFFSET( 398, glColor4ui, glColor4ui, NULL, 37),
+ NAME_FUNC_OFFSET( 409, glColor4uiv, glColor4uiv, NULL, 38),
+ NAME_FUNC_OFFSET( 421, glColor4us, glColor4us, NULL, 39),
+ NAME_FUNC_OFFSET( 432, glColor4usv, glColor4usv, NULL, 40),
+ NAME_FUNC_OFFSET( 444, glEdgeFlag, glEdgeFlag, NULL, 41),
+ NAME_FUNC_OFFSET( 455, glEdgeFlagv, glEdgeFlagv, NULL, 42),
+ NAME_FUNC_OFFSET( 467, glEnd, glEnd, NULL, 43),
+ NAME_FUNC_OFFSET( 473, glIndexd, glIndexd, NULL, 44),
+ NAME_FUNC_OFFSET( 482, glIndexdv, glIndexdv, NULL, 45),
+ NAME_FUNC_OFFSET( 492, glIndexf, glIndexf, NULL, 46),
+ NAME_FUNC_OFFSET( 501, glIndexfv, glIndexfv, NULL, 47),
+ NAME_FUNC_OFFSET( 511, glIndexi, glIndexi, NULL, 48),
+ NAME_FUNC_OFFSET( 520, glIndexiv, glIndexiv, NULL, 49),
+ NAME_FUNC_OFFSET( 530, glIndexs, glIndexs, NULL, 50),
+ NAME_FUNC_OFFSET( 539, glIndexsv, glIndexsv, NULL, 51),
+ NAME_FUNC_OFFSET( 549, glNormal3b, glNormal3b, NULL, 52),
+ NAME_FUNC_OFFSET( 560, glNormal3bv, glNormal3bv, NULL, 53),
+ NAME_FUNC_OFFSET( 572, glNormal3d, glNormal3d, NULL, 54),
+ NAME_FUNC_OFFSET( 583, glNormal3dv, glNormal3dv, NULL, 55),
+ NAME_FUNC_OFFSET( 595, glNormal3f, glNormal3f, NULL, 56),
+ NAME_FUNC_OFFSET( 606, glNormal3fv, glNormal3fv, NULL, 57),
+ NAME_FUNC_OFFSET( 618, glNormal3i, glNormal3i, NULL, 58),
+ NAME_FUNC_OFFSET( 629, glNormal3iv, glNormal3iv, NULL, 59),
+ NAME_FUNC_OFFSET( 641, glNormal3s, glNormal3s, NULL, 60),
+ NAME_FUNC_OFFSET( 652, glNormal3sv, glNormal3sv, NULL, 61),
+ NAME_FUNC_OFFSET( 664, glRasterPos2d, glRasterPos2d, NULL, 62),
+ NAME_FUNC_OFFSET( 678, glRasterPos2dv, glRasterPos2dv, NULL, 63),
+ NAME_FUNC_OFFSET( 693, glRasterPos2f, glRasterPos2f, NULL, 64),
+ NAME_FUNC_OFFSET( 707, glRasterPos2fv, glRasterPos2fv, NULL, 65),
+ NAME_FUNC_OFFSET( 722, glRasterPos2i, glRasterPos2i, NULL, 66),
+ NAME_FUNC_OFFSET( 736, glRasterPos2iv, glRasterPos2iv, NULL, 67),
+ NAME_FUNC_OFFSET( 751, glRasterPos2s, glRasterPos2s, NULL, 68),
+ NAME_FUNC_OFFSET( 765, glRasterPos2sv, glRasterPos2sv, NULL, 69),
+ NAME_FUNC_OFFSET( 780, glRasterPos3d, glRasterPos3d, NULL, 70),
+ NAME_FUNC_OFFSET( 794, glRasterPos3dv, glRasterPos3dv, NULL, 71),
+ NAME_FUNC_OFFSET( 809, glRasterPos3f, glRasterPos3f, NULL, 72),
+ NAME_FUNC_OFFSET( 823, glRasterPos3fv, glRasterPos3fv, NULL, 73),
+ NAME_FUNC_OFFSET( 838, glRasterPos3i, glRasterPos3i, NULL, 74),
+ NAME_FUNC_OFFSET( 852, glRasterPos3iv, glRasterPos3iv, NULL, 75),
+ NAME_FUNC_OFFSET( 867, glRasterPos3s, glRasterPos3s, NULL, 76),
+ NAME_FUNC_OFFSET( 881, glRasterPos3sv, glRasterPos3sv, NULL, 77),
+ NAME_FUNC_OFFSET( 896, glRasterPos4d, glRasterPos4d, NULL, 78),
+ NAME_FUNC_OFFSET( 910, glRasterPos4dv, glRasterPos4dv, NULL, 79),
+ NAME_FUNC_OFFSET( 925, glRasterPos4f, glRasterPos4f, NULL, 80),
+ NAME_FUNC_OFFSET( 939, glRasterPos4fv, glRasterPos4fv, NULL, 81),
+ NAME_FUNC_OFFSET( 954, glRasterPos4i, glRasterPos4i, NULL, 82),
+ NAME_FUNC_OFFSET( 968, glRasterPos4iv, glRasterPos4iv, NULL, 83),
+ NAME_FUNC_OFFSET( 983, glRasterPos4s, glRasterPos4s, NULL, 84),
+ NAME_FUNC_OFFSET( 997, glRasterPos4sv, glRasterPos4sv, NULL, 85),
+ NAME_FUNC_OFFSET( 1012, glRectd, glRectd, NULL, 86),
+ NAME_FUNC_OFFSET( 1020, glRectdv, glRectdv, NULL, 87),
+ NAME_FUNC_OFFSET( 1029, glRectf, glRectf, NULL, 88),
+ NAME_FUNC_OFFSET( 1037, glRectfv, glRectfv, NULL, 89),
+ NAME_FUNC_OFFSET( 1046, glRecti, glRecti, NULL, 90),
+ NAME_FUNC_OFFSET( 1054, glRectiv, glRectiv, NULL, 91),
+ NAME_FUNC_OFFSET( 1063, glRects, glRects, NULL, 92),
+ NAME_FUNC_OFFSET( 1071, glRectsv, glRectsv, NULL, 93),
+ NAME_FUNC_OFFSET( 1080, glTexCoord1d, glTexCoord1d, NULL, 94),
+ NAME_FUNC_OFFSET( 1093, glTexCoord1dv, glTexCoord1dv, NULL, 95),
+ NAME_FUNC_OFFSET( 1107, glTexCoord1f, glTexCoord1f, NULL, 96),
+ NAME_FUNC_OFFSET( 1120, glTexCoord1fv, glTexCoord1fv, NULL, 97),
+ NAME_FUNC_OFFSET( 1134, glTexCoord1i, glTexCoord1i, NULL, 98),
+ NAME_FUNC_OFFSET( 1147, glTexCoord1iv, glTexCoord1iv, NULL, 99),
+ NAME_FUNC_OFFSET( 1161, glTexCoord1s, glTexCoord1s, NULL, 100),
+ NAME_FUNC_OFFSET( 1174, glTexCoord1sv, glTexCoord1sv, NULL, 101),
+ NAME_FUNC_OFFSET( 1188, glTexCoord2d, glTexCoord2d, NULL, 102),
+ NAME_FUNC_OFFSET( 1201, glTexCoord2dv, glTexCoord2dv, NULL, 103),
+ NAME_FUNC_OFFSET( 1215, glTexCoord2f, glTexCoord2f, NULL, 104),
+ NAME_FUNC_OFFSET( 1228, glTexCoord2fv, glTexCoord2fv, NULL, 105),
+ NAME_FUNC_OFFSET( 1242, glTexCoord2i, glTexCoord2i, NULL, 106),
+ NAME_FUNC_OFFSET( 1255, glTexCoord2iv, glTexCoord2iv, NULL, 107),
+ NAME_FUNC_OFFSET( 1269, glTexCoord2s, glTexCoord2s, NULL, 108),
+ NAME_FUNC_OFFSET( 1282, glTexCoord2sv, glTexCoord2sv, NULL, 109),
+ NAME_FUNC_OFFSET( 1296, glTexCoord3d, glTexCoord3d, NULL, 110),
+ NAME_FUNC_OFFSET( 1309, glTexCoord3dv, glTexCoord3dv, NULL, 111),
+ NAME_FUNC_OFFSET( 1323, glTexCoord3f, glTexCoord3f, NULL, 112),
+ NAME_FUNC_OFFSET( 1336, glTexCoord3fv, glTexCoord3fv, NULL, 113),
+ NAME_FUNC_OFFSET( 1350, glTexCoord3i, glTexCoord3i, NULL, 114),
+ NAME_FUNC_OFFSET( 1363, glTexCoord3iv, glTexCoord3iv, NULL, 115),
+ NAME_FUNC_OFFSET( 1377, glTexCoord3s, glTexCoord3s, NULL, 116),
+ NAME_FUNC_OFFSET( 1390, glTexCoord3sv, glTexCoord3sv, NULL, 117),
+ NAME_FUNC_OFFSET( 1404, glTexCoord4d, glTexCoord4d, NULL, 118),
+ NAME_FUNC_OFFSET( 1417, glTexCoord4dv, glTexCoord4dv, NULL, 119),
+ NAME_FUNC_OFFSET( 1431, glTexCoord4f, glTexCoord4f, NULL, 120),
+ NAME_FUNC_OFFSET( 1444, glTexCoord4fv, glTexCoord4fv, NULL, 121),
+ NAME_FUNC_OFFSET( 1458, glTexCoord4i, glTexCoord4i, NULL, 122),
+ NAME_FUNC_OFFSET( 1471, glTexCoord4iv, glTexCoord4iv, NULL, 123),
+ NAME_FUNC_OFFSET( 1485, glTexCoord4s, glTexCoord4s, NULL, 124),
+ NAME_FUNC_OFFSET( 1498, glTexCoord4sv, glTexCoord4sv, NULL, 125),
+ NAME_FUNC_OFFSET( 1512, glVertex2d, glVertex2d, NULL, 126),
+ NAME_FUNC_OFFSET( 1523, glVertex2dv, glVertex2dv, NULL, 127),
+ NAME_FUNC_OFFSET( 1535, glVertex2f, glVertex2f, NULL, 128),
+ NAME_FUNC_OFFSET( 1546, glVertex2fv, glVertex2fv, NULL, 129),
+ NAME_FUNC_OFFSET( 1558, glVertex2i, glVertex2i, NULL, 130),
+ NAME_FUNC_OFFSET( 1569, glVertex2iv, glVertex2iv, NULL, 131),
+ NAME_FUNC_OFFSET( 1581, glVertex2s, glVertex2s, NULL, 132),
+ NAME_FUNC_OFFSET( 1592, glVertex2sv, glVertex2sv, NULL, 133),
+ NAME_FUNC_OFFSET( 1604, glVertex3d, glVertex3d, NULL, 134),
+ NAME_FUNC_OFFSET( 1615, glVertex3dv, glVertex3dv, NULL, 135),
+ NAME_FUNC_OFFSET( 1627, glVertex3f, glVertex3f, NULL, 136),
+ NAME_FUNC_OFFSET( 1638, glVertex3fv, glVertex3fv, NULL, 137),
+ NAME_FUNC_OFFSET( 1650, glVertex3i, glVertex3i, NULL, 138),
+ NAME_FUNC_OFFSET( 1661, glVertex3iv, glVertex3iv, NULL, 139),
+ NAME_FUNC_OFFSET( 1673, glVertex3s, glVertex3s, NULL, 140),
+ NAME_FUNC_OFFSET( 1684, glVertex3sv, glVertex3sv, NULL, 141),
+ NAME_FUNC_OFFSET( 1696, glVertex4d, glVertex4d, NULL, 142),
+ NAME_FUNC_OFFSET( 1707, glVertex4dv, glVertex4dv, NULL, 143),
+ NAME_FUNC_OFFSET( 1719, glVertex4f, glVertex4f, NULL, 144),
+ NAME_FUNC_OFFSET( 1730, glVertex4fv, glVertex4fv, NULL, 145),
+ NAME_FUNC_OFFSET( 1742, glVertex4i, glVertex4i, NULL, 146),
+ NAME_FUNC_OFFSET( 1753, glVertex4iv, glVertex4iv, NULL, 147),
+ NAME_FUNC_OFFSET( 1765, glVertex4s, glVertex4s, NULL, 148),
+ NAME_FUNC_OFFSET( 1776, glVertex4sv, glVertex4sv, NULL, 149),
+ NAME_FUNC_OFFSET( 1788, glClipPlane, glClipPlane, NULL, 150),
+ NAME_FUNC_OFFSET( 1800, glColorMaterial, glColorMaterial, NULL, 151),
+ NAME_FUNC_OFFSET( 1816, glCullFace, glCullFace, NULL, 152),
+ NAME_FUNC_OFFSET( 1827, glFogf, glFogf, NULL, 153),
+ NAME_FUNC_OFFSET( 1834, glFogfv, glFogfv, NULL, 154),
+ NAME_FUNC_OFFSET( 1842, glFogi, glFogi, NULL, 155),
+ NAME_FUNC_OFFSET( 1849, glFogiv, glFogiv, NULL, 156),
+ NAME_FUNC_OFFSET( 1857, glFrontFace, glFrontFace, NULL, 157),
+ NAME_FUNC_OFFSET( 1869, glHint, glHint, NULL, 158),
+ NAME_FUNC_OFFSET( 1876, glLightf, glLightf, NULL, 159),
+ NAME_FUNC_OFFSET( 1885, glLightfv, glLightfv, NULL, 160),
+ NAME_FUNC_OFFSET( 1895, glLighti, glLighti, NULL, 161),
+ NAME_FUNC_OFFSET( 1904, glLightiv, glLightiv, NULL, 162),
+ NAME_FUNC_OFFSET( 1914, glLightModelf, glLightModelf, NULL, 163),
+ NAME_FUNC_OFFSET( 1928, glLightModelfv, glLightModelfv, NULL, 164),
+ NAME_FUNC_OFFSET( 1943, glLightModeli, glLightModeli, NULL, 165),
+ NAME_FUNC_OFFSET( 1957, glLightModeliv, glLightModeliv, NULL, 166),
+ NAME_FUNC_OFFSET( 1972, glLineStipple, glLineStipple, NULL, 167),
+ NAME_FUNC_OFFSET( 1986, glLineWidth, glLineWidth, NULL, 168),
+ NAME_FUNC_OFFSET( 1998, glMaterialf, glMaterialf, NULL, 169),
+ NAME_FUNC_OFFSET( 2010, glMaterialfv, glMaterialfv, NULL, 170),
+ NAME_FUNC_OFFSET( 2023, glMateriali, glMateriali, NULL, 171),
+ NAME_FUNC_OFFSET( 2035, glMaterialiv, glMaterialiv, NULL, 172),
+ NAME_FUNC_OFFSET( 2048, glPointSize, glPointSize, NULL, 173),
+ NAME_FUNC_OFFSET( 2060, glPolygonMode, glPolygonMode, NULL, 174),
+ NAME_FUNC_OFFSET( 2074, glPolygonStipple, glPolygonStipple, NULL, 175),
+ NAME_FUNC_OFFSET( 2091, glScissor, glScissor, NULL, 176),
+ NAME_FUNC_OFFSET( 2101, glShadeModel, glShadeModel, NULL, 177),
+ NAME_FUNC_OFFSET( 2114, glTexParameterf, glTexParameterf, NULL, 178),
+ NAME_FUNC_OFFSET( 2130, glTexParameterfv, glTexParameterfv, NULL, 179),
+ NAME_FUNC_OFFSET( 2147, glTexParameteri, glTexParameteri, NULL, 180),
+ NAME_FUNC_OFFSET( 2163, glTexParameteriv, glTexParameteriv, NULL, 181),
+ NAME_FUNC_OFFSET( 2180, glTexImage1D, glTexImage1D, NULL, 182),
+ NAME_FUNC_OFFSET( 2193, glTexImage2D, glTexImage2D, NULL, 183),
+ NAME_FUNC_OFFSET( 2206, glTexEnvf, glTexEnvf, NULL, 184),
+ NAME_FUNC_OFFSET( 2216, glTexEnvfv, glTexEnvfv, NULL, 185),
+ NAME_FUNC_OFFSET( 2227, glTexEnvi, glTexEnvi, NULL, 186),
+ NAME_FUNC_OFFSET( 2237, glTexEnviv, glTexEnviv, NULL, 187),
+ NAME_FUNC_OFFSET( 2248, glTexGend, glTexGend, NULL, 188),
+ NAME_FUNC_OFFSET( 2258, glTexGendv, glTexGendv, NULL, 189),
+ NAME_FUNC_OFFSET( 2269, glTexGenf, glTexGenf, NULL, 190),
+ NAME_FUNC_OFFSET( 2279, glTexGenfv, glTexGenfv, NULL, 191),
+ NAME_FUNC_OFFSET( 2290, glTexGeni, glTexGeni, NULL, 192),
+ NAME_FUNC_OFFSET( 2300, glTexGeniv, glTexGeniv, NULL, 193),
+ NAME_FUNC_OFFSET( 2311, glFeedbackBuffer, glFeedbackBuffer, NULL, 194),
+ NAME_FUNC_OFFSET( 2328, glSelectBuffer, glSelectBuffer, NULL, 195),
+ NAME_FUNC_OFFSET( 2343, glRenderMode, glRenderMode, NULL, 196),
+ NAME_FUNC_OFFSET( 2356, glInitNames, glInitNames, NULL, 197),
+ NAME_FUNC_OFFSET( 2368, glLoadName, glLoadName, NULL, 198),
+ NAME_FUNC_OFFSET( 2379, glPassThrough, glPassThrough, NULL, 199),
+ NAME_FUNC_OFFSET( 2393, glPopName, glPopName, NULL, 200),
+ NAME_FUNC_OFFSET( 2403, glPushName, glPushName, NULL, 201),
+ NAME_FUNC_OFFSET( 2414, glDrawBuffer, glDrawBuffer, NULL, 202),
+ NAME_FUNC_OFFSET( 2427, glClear, glClear, NULL, 203),
+ NAME_FUNC_OFFSET( 2435, glClearAccum, glClearAccum, NULL, 204),
+ NAME_FUNC_OFFSET( 2448, glClearIndex, glClearIndex, NULL, 205),
+ NAME_FUNC_OFFSET( 2461, glClearColor, glClearColor, NULL, 206),
+ NAME_FUNC_OFFSET( 2474, glClearStencil, glClearStencil, NULL, 207),
+ NAME_FUNC_OFFSET( 2489, glClearDepth, glClearDepth, NULL, 208),
+ NAME_FUNC_OFFSET( 2502, glStencilMask, glStencilMask, NULL, 209),
+ NAME_FUNC_OFFSET( 2516, glColorMask, glColorMask, NULL, 210),
+ NAME_FUNC_OFFSET( 2528, glDepthMask, glDepthMask, NULL, 211),
+ NAME_FUNC_OFFSET( 2540, glIndexMask, glIndexMask, NULL, 212),
+ NAME_FUNC_OFFSET( 2552, glAccum, glAccum, NULL, 213),
+ NAME_FUNC_OFFSET( 2560, glDisable, glDisable, NULL, 214),
+ NAME_FUNC_OFFSET( 2570, glEnable, glEnable, NULL, 215),
+ NAME_FUNC_OFFSET( 2579, glFinish, glFinish, NULL, 216),
+ NAME_FUNC_OFFSET( 2588, glFlush, glFlush, NULL, 217),
+ NAME_FUNC_OFFSET( 2596, glPopAttrib, glPopAttrib, NULL, 218),
+ NAME_FUNC_OFFSET( 2608, glPushAttrib, glPushAttrib, NULL, 219),
+ NAME_FUNC_OFFSET( 2621, glMap1d, glMap1d, NULL, 220),
+ NAME_FUNC_OFFSET( 2629, glMap1f, glMap1f, NULL, 221),
+ NAME_FUNC_OFFSET( 2637, glMap2d, glMap2d, NULL, 222),
+ NAME_FUNC_OFFSET( 2645, glMap2f, glMap2f, NULL, 223),
+ NAME_FUNC_OFFSET( 2653, glMapGrid1d, glMapGrid1d, NULL, 224),
+ NAME_FUNC_OFFSET( 2665, glMapGrid1f, glMapGrid1f, NULL, 225),
+ NAME_FUNC_OFFSET( 2677, glMapGrid2d, glMapGrid2d, NULL, 226),
+ NAME_FUNC_OFFSET( 2689, glMapGrid2f, glMapGrid2f, NULL, 227),
+ NAME_FUNC_OFFSET( 2701, glEvalCoord1d, glEvalCoord1d, NULL, 228),
+ NAME_FUNC_OFFSET( 2715, glEvalCoord1dv, glEvalCoord1dv, NULL, 229),
+ NAME_FUNC_OFFSET( 2730, glEvalCoord1f, glEvalCoord1f, NULL, 230),
+ NAME_FUNC_OFFSET( 2744, glEvalCoord1fv, glEvalCoord1fv, NULL, 231),
+ NAME_FUNC_OFFSET( 2759, glEvalCoord2d, glEvalCoord2d, NULL, 232),
+ NAME_FUNC_OFFSET( 2773, glEvalCoord2dv, glEvalCoord2dv, NULL, 233),
+ NAME_FUNC_OFFSET( 2788, glEvalCoord2f, glEvalCoord2f, NULL, 234),
+ NAME_FUNC_OFFSET( 2802, glEvalCoord2fv, glEvalCoord2fv, NULL, 235),
+ NAME_FUNC_OFFSET( 2817, glEvalMesh1, glEvalMesh1, NULL, 236),
+ NAME_FUNC_OFFSET( 2829, glEvalPoint1, glEvalPoint1, NULL, 237),
+ NAME_FUNC_OFFSET( 2842, glEvalMesh2, glEvalMesh2, NULL, 238),
+ NAME_FUNC_OFFSET( 2854, glEvalPoint2, glEvalPoint2, NULL, 239),
+ NAME_FUNC_OFFSET( 2867, glAlphaFunc, glAlphaFunc, NULL, 240),
+ NAME_FUNC_OFFSET( 2879, glBlendFunc, glBlendFunc, NULL, 241),
+ NAME_FUNC_OFFSET( 2891, glLogicOp, glLogicOp, NULL, 242),
+ NAME_FUNC_OFFSET( 2901, glStencilFunc, glStencilFunc, NULL, 243),
+ NAME_FUNC_OFFSET( 2915, glStencilOp, glStencilOp, NULL, 244),
+ NAME_FUNC_OFFSET( 2927, glDepthFunc, glDepthFunc, NULL, 245),
+ NAME_FUNC_OFFSET( 2939, glPixelZoom, glPixelZoom, NULL, 246),
+ NAME_FUNC_OFFSET( 2951, glPixelTransferf, glPixelTransferf, NULL, 247),
+ NAME_FUNC_OFFSET( 2968, glPixelTransferi, glPixelTransferi, NULL, 248),
+ NAME_FUNC_OFFSET( 2985, glPixelStoref, glPixelStoref, NULL, 249),
+ NAME_FUNC_OFFSET( 2999, glPixelStorei, glPixelStorei, NULL, 250),
+ NAME_FUNC_OFFSET( 3013, glPixelMapfv, glPixelMapfv, NULL, 251),
+ NAME_FUNC_OFFSET( 3026, glPixelMapuiv, glPixelMapuiv, NULL, 252),
+ NAME_FUNC_OFFSET( 3040, glPixelMapusv, glPixelMapusv, NULL, 253),
+ NAME_FUNC_OFFSET( 3054, glReadBuffer, glReadBuffer, NULL, 254),
+ NAME_FUNC_OFFSET( 3067, glCopyPixels, glCopyPixels, NULL, 255),
+ NAME_FUNC_OFFSET( 3080, glReadPixels, glReadPixels, NULL, 256),
+ NAME_FUNC_OFFSET( 3093, glDrawPixels, glDrawPixels, NULL, 257),
+ NAME_FUNC_OFFSET( 3106, glGetBooleanv, glGetBooleanv, NULL, 258),
+ NAME_FUNC_OFFSET( 3120, glGetClipPlane, glGetClipPlane, NULL, 259),
+ NAME_FUNC_OFFSET( 3135, glGetDoublev, glGetDoublev, NULL, 260),
+ NAME_FUNC_OFFSET( 3148, glGetError, glGetError, NULL, 261),
+ NAME_FUNC_OFFSET( 3159, glGetFloatv, glGetFloatv, NULL, 262),
+ NAME_FUNC_OFFSET( 3171, glGetIntegerv, glGetIntegerv, NULL, 263),
+ NAME_FUNC_OFFSET( 3185, glGetLightfv, glGetLightfv, NULL, 264),
+ NAME_FUNC_OFFSET( 3198, glGetLightiv, glGetLightiv, NULL, 265),
+ NAME_FUNC_OFFSET( 3211, glGetMapdv, glGetMapdv, NULL, 266),
+ NAME_FUNC_OFFSET( 3222, glGetMapfv, glGetMapfv, NULL, 267),
+ NAME_FUNC_OFFSET( 3233, glGetMapiv, glGetMapiv, NULL, 268),
+ NAME_FUNC_OFFSET( 3244, glGetMaterialfv, glGetMaterialfv, NULL, 269),
+ NAME_FUNC_OFFSET( 3260, glGetMaterialiv, glGetMaterialiv, NULL, 270),
+ NAME_FUNC_OFFSET( 3276, glGetPixelMapfv, glGetPixelMapfv, NULL, 271),
+ NAME_FUNC_OFFSET( 3292, glGetPixelMapuiv, glGetPixelMapuiv, NULL, 272),
+ NAME_FUNC_OFFSET( 3309, glGetPixelMapusv, glGetPixelMapusv, NULL, 273),
+ NAME_FUNC_OFFSET( 3326, glGetPolygonStipple, glGetPolygonStipple, NULL, 274),
+ NAME_FUNC_OFFSET( 3346, glGetString, glGetString, NULL, 275),
+ NAME_FUNC_OFFSET( 3358, glGetTexEnvfv, glGetTexEnvfv, NULL, 276),
+ NAME_FUNC_OFFSET( 3372, glGetTexEnviv, glGetTexEnviv, NULL, 277),
+ NAME_FUNC_OFFSET( 3386, glGetTexGendv, glGetTexGendv, NULL, 278),
+ NAME_FUNC_OFFSET( 3400, glGetTexGenfv, glGetTexGenfv, NULL, 279),
+ NAME_FUNC_OFFSET( 3414, glGetTexGeniv, glGetTexGeniv, NULL, 280),
+ NAME_FUNC_OFFSET( 3428, glGetTexImage, glGetTexImage, NULL, 281),
+ NAME_FUNC_OFFSET( 3442, glGetTexParameterfv, glGetTexParameterfv, NULL, 282),
+ NAME_FUNC_OFFSET( 3462, glGetTexParameteriv, glGetTexParameteriv, NULL, 283),
+ NAME_FUNC_OFFSET( 3482, glGetTexLevelParameterfv, glGetTexLevelParameterfv, NULL, 284),
+ NAME_FUNC_OFFSET( 3507, glGetTexLevelParameteriv, glGetTexLevelParameteriv, NULL, 285),
+ NAME_FUNC_OFFSET( 3532, glIsEnabled, glIsEnabled, NULL, 286),
+ NAME_FUNC_OFFSET( 3544, glIsList, glIsList, NULL, 287),
+ NAME_FUNC_OFFSET( 3553, glDepthRange, glDepthRange, NULL, 288),
+ NAME_FUNC_OFFSET( 3566, glFrustum, glFrustum, NULL, 289),
+ NAME_FUNC_OFFSET( 3576, glLoadIdentity, glLoadIdentity, NULL, 290),
+ NAME_FUNC_OFFSET( 3591, glLoadMatrixf, glLoadMatrixf, NULL, 291),
+ NAME_FUNC_OFFSET( 3605, glLoadMatrixd, glLoadMatrixd, NULL, 292),
+ NAME_FUNC_OFFSET( 3619, glMatrixMode, glMatrixMode, NULL, 293),
+ NAME_FUNC_OFFSET( 3632, glMultMatrixf, glMultMatrixf, NULL, 294),
+ NAME_FUNC_OFFSET( 3646, glMultMatrixd, glMultMatrixd, NULL, 295),
+ NAME_FUNC_OFFSET( 3660, glOrtho, glOrtho, NULL, 296),
+ NAME_FUNC_OFFSET( 3668, glPopMatrix, glPopMatrix, NULL, 297),
+ NAME_FUNC_OFFSET( 3680, glPushMatrix, glPushMatrix, NULL, 298),
+ NAME_FUNC_OFFSET( 3693, glRotated, glRotated, NULL, 299),
+ NAME_FUNC_OFFSET( 3703, glRotatef, glRotatef, NULL, 300),
+ NAME_FUNC_OFFSET( 3713, glScaled, glScaled, NULL, 301),
+ NAME_FUNC_OFFSET( 3722, glScalef, glScalef, NULL, 302),
+ NAME_FUNC_OFFSET( 3731, glTranslated, glTranslated, NULL, 303),
+ NAME_FUNC_OFFSET( 3744, glTranslatef, glTranslatef, NULL, 304),
+ NAME_FUNC_OFFSET( 3757, glViewport, glViewport, NULL, 305),
+ NAME_FUNC_OFFSET( 3768, glArrayElement, glArrayElement, NULL, 306),
+ NAME_FUNC_OFFSET( 3783, glBindTexture, glBindTexture, NULL, 307),
+ NAME_FUNC_OFFSET( 3797, glColorPointer, glColorPointer, NULL, 308),
+ NAME_FUNC_OFFSET( 3812, glDisableClientState, glDisableClientState, NULL, 309),
+ NAME_FUNC_OFFSET( 3833, glDrawArrays, glDrawArrays, NULL, 310),
+ NAME_FUNC_OFFSET( 3846, glDrawElements, glDrawElements, NULL, 311),
+ NAME_FUNC_OFFSET( 3861, glEdgeFlagPointer, glEdgeFlagPointer, NULL, 312),
+ NAME_FUNC_OFFSET( 3879, glEnableClientState, glEnableClientState, NULL, 313),
+ NAME_FUNC_OFFSET( 3899, glIndexPointer, glIndexPointer, NULL, 314),
+ NAME_FUNC_OFFSET( 3914, glIndexub, glIndexub, NULL, 315),
+ NAME_FUNC_OFFSET( 3924, glIndexubv, glIndexubv, NULL, 316),
+ NAME_FUNC_OFFSET( 3935, glInterleavedArrays, glInterleavedArrays, NULL, 317),
+ NAME_FUNC_OFFSET( 3955, glNormalPointer, glNormalPointer, NULL, 318),
+ NAME_FUNC_OFFSET( 3971, glPolygonOffset, glPolygonOffset, NULL, 319),
+ NAME_FUNC_OFFSET( 3987, glTexCoordPointer, glTexCoordPointer, NULL, 320),
+ NAME_FUNC_OFFSET( 4005, glVertexPointer, glVertexPointer, NULL, 321),
+ NAME_FUNC_OFFSET( 4021, glAreTexturesResident, glAreTexturesResident, NULL, 322),
+ NAME_FUNC_OFFSET( 4043, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
+ NAME_FUNC_OFFSET( 4060, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
+ NAME_FUNC_OFFSET( 4077, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, 325),
+ NAME_FUNC_OFFSET( 4097, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, 326),
+ NAME_FUNC_OFFSET( 4117, glDeleteTextures, glDeleteTextures, NULL, 327),
+ NAME_FUNC_OFFSET( 4134, glGenTextures, glGenTextures, NULL, 328),
+ NAME_FUNC_OFFSET( 4148, glGetPointerv, glGetPointerv, NULL, 329),
+ NAME_FUNC_OFFSET( 4162, glIsTexture, glIsTexture, NULL, 330),
+ NAME_FUNC_OFFSET( 4174, glPrioritizeTextures, glPrioritizeTextures, NULL, 331),
+ NAME_FUNC_OFFSET( 4195, glTexSubImage1D, glTexSubImage1D, NULL, 332),
+ NAME_FUNC_OFFSET( 4211, glTexSubImage2D, glTexSubImage2D, NULL, 333),
+ NAME_FUNC_OFFSET( 4227, glPopClientAttrib, glPopClientAttrib, NULL, 334),
+ NAME_FUNC_OFFSET( 4245, glPushClientAttrib, glPushClientAttrib, NULL, 335),
+ NAME_FUNC_OFFSET( 4264, glBlendColor, glBlendColor, NULL, 336),
+ NAME_FUNC_OFFSET( 4277, glBlendEquation, glBlendEquation, NULL, 337),
+ NAME_FUNC_OFFSET( 4293, glDrawRangeElements, glDrawRangeElements, NULL, 338),
+ NAME_FUNC_OFFSET( 4313, glColorTable, glColorTable, NULL, 339),
+ NAME_FUNC_OFFSET( 4326, glColorTableParameterfv, glColorTableParameterfv, NULL, 340),
+ NAME_FUNC_OFFSET( 4350, glColorTableParameteriv, glColorTableParameteriv, NULL, 341),
+ NAME_FUNC_OFFSET( 4374, glCopyColorTable, glCopyColorTable, NULL, 342),
+ NAME_FUNC_OFFSET( 4391, glGetColorTable, glGetColorTable, NULL, 343),
+ NAME_FUNC_OFFSET( 4407, glGetColorTableParameterfv, glGetColorTableParameterfv, NULL, 344),
+ NAME_FUNC_OFFSET( 4434, glGetColorTableParameteriv, glGetColorTableParameteriv, NULL, 345),
+ NAME_FUNC_OFFSET( 4461, glColorSubTable, glColorSubTable, NULL, 346),
+ NAME_FUNC_OFFSET( 4477, glCopyColorSubTable, glCopyColorSubTable, NULL, 347),
+ NAME_FUNC_OFFSET( 4497, glConvolutionFilter1D, glConvolutionFilter1D, NULL, 348),
+ NAME_FUNC_OFFSET( 4519, glConvolutionFilter2D, glConvolutionFilter2D, NULL, 349),
+ NAME_FUNC_OFFSET( 4541, glConvolutionParameterf, glConvolutionParameterf, NULL, 350),
+ NAME_FUNC_OFFSET( 4565, glConvolutionParameterfv, glConvolutionParameterfv, NULL, 351),
+ NAME_FUNC_OFFSET( 4590, glConvolutionParameteri, glConvolutionParameteri, NULL, 352),
+ NAME_FUNC_OFFSET( 4614, glConvolutionParameteriv, glConvolutionParameteriv, NULL, 353),
+ NAME_FUNC_OFFSET( 4639, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, 354),
+ NAME_FUNC_OFFSET( 4665, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, 355),
+ NAME_FUNC_OFFSET( 4691, glGetConvolutionFilter, glGetConvolutionFilter, NULL, 356),
+ NAME_FUNC_OFFSET( 4714, glGetConvolutionParameterfv, glGetConvolutionParameterfv, NULL, 357),
+ NAME_FUNC_OFFSET( 4742, glGetConvolutionParameteriv, glGetConvolutionParameteriv, NULL, 358),
+ NAME_FUNC_OFFSET( 4770, glGetSeparableFilter, glGetSeparableFilter, NULL, 359),
+ NAME_FUNC_OFFSET( 4791, glSeparableFilter2D, glSeparableFilter2D, NULL, 360),
+ NAME_FUNC_OFFSET( 4811, glGetHistogram, glGetHistogram, NULL, 361),
+ NAME_FUNC_OFFSET( 4826, glGetHistogramParameterfv, glGetHistogramParameterfv, NULL, 362),
+ NAME_FUNC_OFFSET( 4852, glGetHistogramParameteriv, glGetHistogramParameteriv, NULL, 363),
+ NAME_FUNC_OFFSET( 4878, glGetMinmax, glGetMinmax, NULL, 364),
+ NAME_FUNC_OFFSET( 4890, glGetMinmaxParameterfv, glGetMinmaxParameterfv, NULL, 365),
+ NAME_FUNC_OFFSET( 4913, glGetMinmaxParameteriv, glGetMinmaxParameteriv, NULL, 366),
+ NAME_FUNC_OFFSET( 4936, glHistogram, glHistogram, NULL, 367),
+ NAME_FUNC_OFFSET( 4948, glMinmax, glMinmax, NULL, 368),
+ NAME_FUNC_OFFSET( 4957, glResetHistogram, glResetHistogram, NULL, 369),
+ NAME_FUNC_OFFSET( 4974, glResetMinmax, glResetMinmax, NULL, 370),
+ NAME_FUNC_OFFSET( 4988, glTexImage3D, glTexImage3D, NULL, 371),
+ NAME_FUNC_OFFSET( 5001, glTexSubImage3D, glTexSubImage3D, NULL, 372),
+ NAME_FUNC_OFFSET( 5017, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, 373),
+ NAME_FUNC_OFFSET( 5037, glActiveTextureARB, glActiveTextureARB, NULL, 374),
+ NAME_FUNC_OFFSET( 5056, glClientActiveTextureARB, glClientActiveTextureARB, NULL, 375),
+ NAME_FUNC_OFFSET( 5081, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, 376),
+ NAME_FUNC_OFFSET( 5102, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, 377),
+ NAME_FUNC_OFFSET( 5124, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, 378),
+ NAME_FUNC_OFFSET( 5145, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, 379),
+ NAME_FUNC_OFFSET( 5167, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, 380),
+ NAME_FUNC_OFFSET( 5188, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, 381),
+ NAME_FUNC_OFFSET( 5210, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, 382),
+ NAME_FUNC_OFFSET( 5231, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, 383),
+ NAME_FUNC_OFFSET( 5253, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, 384),
+ NAME_FUNC_OFFSET( 5274, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, 385),
+ NAME_FUNC_OFFSET( 5296, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, 386),
+ NAME_FUNC_OFFSET( 5317, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, 387),
+ NAME_FUNC_OFFSET( 5339, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, 388),
+ NAME_FUNC_OFFSET( 5360, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, 389),
+ NAME_FUNC_OFFSET( 5382, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, 390),
+ NAME_FUNC_OFFSET( 5403, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, 391),
+ NAME_FUNC_OFFSET( 5425, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, 392),
+ NAME_FUNC_OFFSET( 5446, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, 393),
+ NAME_FUNC_OFFSET( 5468, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, 394),
+ NAME_FUNC_OFFSET( 5489, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, 395),
+ NAME_FUNC_OFFSET( 5511, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, 396),
+ NAME_FUNC_OFFSET( 5532, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, 397),
+ NAME_FUNC_OFFSET( 5554, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, 398),
+ NAME_FUNC_OFFSET( 5575, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, 399),
+ NAME_FUNC_OFFSET( 5597, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, 400),
+ NAME_FUNC_OFFSET( 5618, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, 401),
+ NAME_FUNC_OFFSET( 5640, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, 402),
+ NAME_FUNC_OFFSET( 5661, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, 403),
+ NAME_FUNC_OFFSET( 5683, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, 404),
+ NAME_FUNC_OFFSET( 5704, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, 405),
+ NAME_FUNC_OFFSET( 5726, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, 406),
+ NAME_FUNC_OFFSET( 5747, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, 407),
+ NAME_FUNC_OFFSET( 5769, glAttachShader, glAttachShader, NULL, 408),
+ NAME_FUNC_OFFSET( 5784, glCreateProgram, glCreateProgram, NULL, 409),
+ NAME_FUNC_OFFSET( 5800, glCreateShader, glCreateShader, NULL, 410),
+ NAME_FUNC_OFFSET( 5815, glDeleteProgram, glDeleteProgram, NULL, 411),
+ NAME_FUNC_OFFSET( 5831, glDeleteShader, glDeleteShader, NULL, 412),
+ NAME_FUNC_OFFSET( 5846, glDetachShader, glDetachShader, NULL, 413),
+ NAME_FUNC_OFFSET( 5861, glGetAttachedShaders, glGetAttachedShaders, NULL, 414),
+ NAME_FUNC_OFFSET( 5882, glGetProgramInfoLog, glGetProgramInfoLog, NULL, 415),
+ NAME_FUNC_OFFSET( 5902, glGetProgramiv, glGetProgramiv, NULL, 416),
+ NAME_FUNC_OFFSET( 5917, glGetShaderInfoLog, glGetShaderInfoLog, NULL, 417),
+ NAME_FUNC_OFFSET( 5936, glGetShaderiv, glGetShaderiv, NULL, 418),
+ NAME_FUNC_OFFSET( 5950, glIsProgram, glIsProgram, NULL, 419),
+ NAME_FUNC_OFFSET( 5962, glIsShader, glIsShader, NULL, 420),
+ NAME_FUNC_OFFSET( 5973, glStencilFuncSeparate, glStencilFuncSeparate, NULL, 421),
+ NAME_FUNC_OFFSET( 5995, glStencilMaskSeparate, glStencilMaskSeparate, NULL, 422),
+ NAME_FUNC_OFFSET( 6017, glStencilOpSeparate, glStencilOpSeparate, NULL, 423),
+ NAME_FUNC_OFFSET( 6037, glUniformMatrix2x3fv, glUniformMatrix2x3fv, NULL, 424),
+ NAME_FUNC_OFFSET( 6058, glUniformMatrix2x4fv, glUniformMatrix2x4fv, NULL, 425),
+ NAME_FUNC_OFFSET( 6079, glUniformMatrix3x2fv, glUniformMatrix3x2fv, NULL, 426),
+ NAME_FUNC_OFFSET( 6100, glUniformMatrix3x4fv, glUniformMatrix3x4fv, NULL, 427),
+ NAME_FUNC_OFFSET( 6121, glUniformMatrix4x2fv, glUniformMatrix4x2fv, NULL, 428),
+ NAME_FUNC_OFFSET( 6142, glUniformMatrix4x3fv, glUniformMatrix4x3fv, NULL, 429),
+ NAME_FUNC_OFFSET( 6163, glClampColor, glClampColor, NULL, 430),
+ NAME_FUNC_OFFSET( 6176, glClearBufferfi, glClearBufferfi, NULL, 431),
+ NAME_FUNC_OFFSET( 6192, glClearBufferfv, glClearBufferfv, NULL, 432),
+ NAME_FUNC_OFFSET( 6208, glClearBufferiv, glClearBufferiv, NULL, 433),
+ NAME_FUNC_OFFSET( 6224, glClearBufferuiv, glClearBufferuiv, NULL, 434),
+ NAME_FUNC_OFFSET( 6241, glGetStringi, glGetStringi, NULL, 435),
+ NAME_FUNC_OFFSET( 6254, glTexBuffer, glTexBuffer, NULL, 436),
+ NAME_FUNC_OFFSET( 6266, glFramebufferTexture, glFramebufferTexture, NULL, 437),
+ NAME_FUNC_OFFSET( 6287, glGetBufferParameteri64v, glGetBufferParameteri64v, NULL, 438),
+ NAME_FUNC_OFFSET( 6312, glGetInteger64i_v, glGetInteger64i_v, NULL, 439),
+ NAME_FUNC_OFFSET( 6330, glVertexAttribDivisor, glVertexAttribDivisor, NULL, 440),
+ NAME_FUNC_OFFSET( 6352, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, 441),
+ NAME_FUNC_OFFSET( 6378, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, 442),
+ NAME_FUNC_OFFSET( 6404, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, 443),
+ NAME_FUNC_OFFSET( 6430, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, 444),
+ NAME_FUNC_OFFSET( 6456, glSampleCoverageARB, glSampleCoverageARB, NULL, 445),
+ NAME_FUNC_OFFSET( 6476, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, 446),
+ NAME_FUNC_OFFSET( 6502, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, 447),
+ NAME_FUNC_OFFSET( 6528, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, 448),
+ NAME_FUNC_OFFSET( 6554, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, 449),
+ NAME_FUNC_OFFSET( 6583, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, 450),
+ NAME_FUNC_OFFSET( 6612, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, 451),
+ NAME_FUNC_OFFSET( 6641, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, 452),
+ NAME_FUNC_OFFSET( 6668, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, 453),
+ NAME_FUNC_OFFSET( 6698, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, 454),
+ NAME_FUNC_OFFSET( 6727, glGetProgramEnvParameterdvARB, glGetProgramEnvParameterdvARB, NULL, 455),
+ NAME_FUNC_OFFSET( 6757, glGetProgramEnvParameterfvARB, glGetProgramEnvParameterfvARB, NULL, 456),
+ NAME_FUNC_OFFSET( 6787, glGetProgramLocalParameterdvARB, glGetProgramLocalParameterdvARB, NULL, 457),
+ NAME_FUNC_OFFSET( 6819, glGetProgramLocalParameterfvARB, glGetProgramLocalParameterfvARB, NULL, 458),
+ NAME_FUNC_OFFSET( 6851, glGetProgramStringARB, glGetProgramStringARB, NULL, 459),
+ NAME_FUNC_OFFSET( 6873, glGetProgramivARB, glGetProgramivARB, NULL, 460),
+ NAME_FUNC_OFFSET( 6891, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, 461),
+ NAME_FUNC_OFFSET( 6914, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, 462),
+ NAME_FUNC_OFFSET( 6937, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, 463),
+ NAME_FUNC_OFFSET( 6960, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, 464),
+ NAME_FUNC_OFFSET( 6987, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, 465),
+ NAME_FUNC_OFFSET( 7015, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, 466),
+ NAME_FUNC_OFFSET( 7042, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, 467),
+ NAME_FUNC_OFFSET( 7070, glProgramLocalParameter4dARB, glProgramLocalParameter4dARB, NULL, 468),
+ NAME_FUNC_OFFSET( 7099, glProgramLocalParameter4dvARB, glProgramLocalParameter4dvARB, NULL, 469),
+ NAME_FUNC_OFFSET( 7129, glProgramLocalParameter4fARB, glProgramLocalParameter4fARB, NULL, 470),
+ NAME_FUNC_OFFSET( 7158, glProgramLocalParameter4fvARB, glProgramLocalParameter4fvARB, NULL, 471),
+ NAME_FUNC_OFFSET( 7188, glProgramStringARB, glProgramStringARB, NULL, 472),
+ NAME_FUNC_OFFSET( 7207, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, 473),
+ NAME_FUNC_OFFSET( 7227, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, 474),
+ NAME_FUNC_OFFSET( 7248, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, 475),
+ NAME_FUNC_OFFSET( 7268, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, 476),
+ NAME_FUNC_OFFSET( 7289, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, 477),
+ NAME_FUNC_OFFSET( 7309, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, 478),
+ NAME_FUNC_OFFSET( 7330, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, 479),
+ NAME_FUNC_OFFSET( 7350, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, 480),
+ NAME_FUNC_OFFSET( 7371, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, 481),
+ NAME_FUNC_OFFSET( 7391, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, 482),
+ NAME_FUNC_OFFSET( 7412, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, 483),
+ NAME_FUNC_OFFSET( 7432, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, 484),
+ NAME_FUNC_OFFSET( 7453, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, 485),
+ NAME_FUNC_OFFSET( 7473, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, 486),
+ NAME_FUNC_OFFSET( 7494, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, 487),
+ NAME_FUNC_OFFSET( 7514, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, 488),
+ NAME_FUNC_OFFSET( 7535, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, 489),
+ NAME_FUNC_OFFSET( 7555, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, 490),
+ NAME_FUNC_OFFSET( 7576, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, 491),
+ NAME_FUNC_OFFSET( 7598, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, 492),
+ NAME_FUNC_OFFSET( 7620, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, 493),
+ NAME_FUNC_OFFSET( 7642, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, 494),
+ NAME_FUNC_OFFSET( 7664, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, 495),
+ NAME_FUNC_OFFSET( 7687, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, 496),
+ NAME_FUNC_OFFSET( 7710, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, 497),
+ NAME_FUNC_OFFSET( 7733, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, 498),
+ NAME_FUNC_OFFSET( 7754, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, 499),
+ NAME_FUNC_OFFSET( 7774, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, 500),
+ NAME_FUNC_OFFSET( 7795, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, 501),
+ NAME_FUNC_OFFSET( 7815, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, 502),
+ NAME_FUNC_OFFSET( 7836, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, 503),
+ NAME_FUNC_OFFSET( 7857, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, 504),
+ NAME_FUNC_OFFSET( 7877, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, 505),
+ NAME_FUNC_OFFSET( 7898, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, 506),
+ NAME_FUNC_OFFSET( 7920, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, 507),
+ NAME_FUNC_OFFSET( 7942, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, 508),
+ NAME_FUNC_OFFSET( 7964, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, 509),
+ NAME_FUNC_OFFSET( 7989, glBindBufferARB, glBindBufferARB, NULL, 510),
+ NAME_FUNC_OFFSET( 8005, glBufferDataARB, glBufferDataARB, NULL, 511),
+ NAME_FUNC_OFFSET( 8021, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
+ NAME_FUNC_OFFSET( 8040, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
+ NAME_FUNC_OFFSET( 8059, glGenBuffersARB, glGenBuffersARB, NULL, 514),
+ NAME_FUNC_OFFSET( 8075, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, 515),
+ NAME_FUNC_OFFSET( 8101, glGetBufferPointervARB, glGetBufferPointervARB, NULL, 516),
+ NAME_FUNC_OFFSET( 8124, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, 517),
+ NAME_FUNC_OFFSET( 8146, glIsBufferARB, glIsBufferARB, NULL, 518),
+ NAME_FUNC_OFFSET( 8160, glMapBufferARB, glMapBufferARB, NULL, 519),
+ NAME_FUNC_OFFSET( 8175, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
+ NAME_FUNC_OFFSET( 8192, glBeginQueryARB, glBeginQueryARB, NULL, 521),
+ NAME_FUNC_OFFSET( 8208, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
+ NAME_FUNC_OFFSET( 8227, glEndQueryARB, glEndQueryARB, NULL, 523),
+ NAME_FUNC_OFFSET( 8241, glGenQueriesARB, glGenQueriesARB, NULL, 524),
+ NAME_FUNC_OFFSET( 8257, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, 525),
+ NAME_FUNC_OFFSET( 8279, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, 526),
+ NAME_FUNC_OFFSET( 8302, glGetQueryivARB, glGetQueryivARB, NULL, 527),
+ NAME_FUNC_OFFSET( 8318, glIsQueryARB, glIsQueryARB, NULL, 528),
+ NAME_FUNC_OFFSET( 8331, glAttachObjectARB, glAttachObjectARB, NULL, 529),
+ NAME_FUNC_OFFSET( 8349, glCompileShaderARB, glCompileShaderARB, NULL, 530),
+ NAME_FUNC_OFFSET( 8368, glCreateProgramObjectARB, glCreateProgramObjectARB, NULL, 531),
+ NAME_FUNC_OFFSET( 8393, glCreateShaderObjectARB, glCreateShaderObjectARB, NULL, 532),
+ NAME_FUNC_OFFSET( 8417, glDeleteObjectARB, glDeleteObjectARB, NULL, 533),
+ NAME_FUNC_OFFSET( 8435, glDetachObjectARB, glDetachObjectARB, NULL, 534),
+ NAME_FUNC_OFFSET( 8453, glGetActiveUniformARB, glGetActiveUniformARB, NULL, 535),
+ NAME_FUNC_OFFSET( 8475, glGetAttachedObjectsARB, glGetAttachedObjectsARB, NULL, 536),
+ NAME_FUNC_OFFSET( 8499, glGetHandleARB, glGetHandleARB, NULL, 537),
+ NAME_FUNC_OFFSET( 8514, glGetInfoLogARB, glGetInfoLogARB, NULL, 538),
+ NAME_FUNC_OFFSET( 8530, glGetObjectParameterfvARB, glGetObjectParameterfvARB, NULL, 539),
+ NAME_FUNC_OFFSET( 8556, glGetObjectParameterivARB, glGetObjectParameterivARB, NULL, 540),
+ NAME_FUNC_OFFSET( 8582, glGetShaderSourceARB, glGetShaderSourceARB, NULL, 541),
+ NAME_FUNC_OFFSET( 8603, glGetUniformLocationARB, glGetUniformLocationARB, NULL, 542),
+ NAME_FUNC_OFFSET( 8627, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
+ NAME_FUNC_OFFSET( 8645, glGetUniformivARB, glGetUniformivARB, NULL, 544),
+ NAME_FUNC_OFFSET( 8663, glLinkProgramARB, glLinkProgramARB, NULL, 545),
+ NAME_FUNC_OFFSET( 8680, glShaderSourceARB, glShaderSourceARB, NULL, 546),
+ NAME_FUNC_OFFSET( 8698, glUniform1fARB, glUniform1fARB, NULL, 547),
+ NAME_FUNC_OFFSET( 8713, glUniform1fvARB, glUniform1fvARB, NULL, 548),
+ NAME_FUNC_OFFSET( 8729, glUniform1iARB, glUniform1iARB, NULL, 549),
+ NAME_FUNC_OFFSET( 8744, glUniform1ivARB, glUniform1ivARB, NULL, 550),
+ NAME_FUNC_OFFSET( 8760, glUniform2fARB, glUniform2fARB, NULL, 551),
+ NAME_FUNC_OFFSET( 8775, glUniform2fvARB, glUniform2fvARB, NULL, 552),
+ NAME_FUNC_OFFSET( 8791, glUniform2iARB, glUniform2iARB, NULL, 553),
+ NAME_FUNC_OFFSET( 8806, glUniform2ivARB, glUniform2ivARB, NULL, 554),
+ NAME_FUNC_OFFSET( 8822, glUniform3fARB, glUniform3fARB, NULL, 555),
+ NAME_FUNC_OFFSET( 8837, glUniform3fvARB, glUniform3fvARB, NULL, 556),
+ NAME_FUNC_OFFSET( 8853, glUniform3iARB, glUniform3iARB, NULL, 557),
+ NAME_FUNC_OFFSET( 8868, glUniform3ivARB, glUniform3ivARB, NULL, 558),
+ NAME_FUNC_OFFSET( 8884, glUniform4fARB, glUniform4fARB, NULL, 559),
+ NAME_FUNC_OFFSET( 8899, glUniform4fvARB, glUniform4fvARB, NULL, 560),
+ NAME_FUNC_OFFSET( 8915, glUniform4iARB, glUniform4iARB, NULL, 561),
+ NAME_FUNC_OFFSET( 8930, glUniform4ivARB, glUniform4ivARB, NULL, 562),
+ NAME_FUNC_OFFSET( 8946, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, 563),
+ NAME_FUNC_OFFSET( 8968, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, 564),
+ NAME_FUNC_OFFSET( 8990, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, 565),
+ NAME_FUNC_OFFSET( 9012, glUseProgramObjectARB, glUseProgramObjectARB, NULL, 566),
+ NAME_FUNC_OFFSET( 9034, glValidateProgramARB, glValidateProgramARB, NULL, 567),
+ NAME_FUNC_OFFSET( 9055, glBindAttribLocationARB, glBindAttribLocationARB, NULL, 568),
+ NAME_FUNC_OFFSET( 9079, glGetActiveAttribARB, glGetActiveAttribARB, NULL, 569),
+ NAME_FUNC_OFFSET( 9100, glGetAttribLocationARB, glGetAttribLocationARB, NULL, 570),
+ NAME_FUNC_OFFSET( 9123, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
+ NAME_FUNC_OFFSET( 9140, glClampColorARB, glClampColorARB, NULL, 572),
+ NAME_FUNC_OFFSET( 9156, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 573),
+ NAME_FUNC_OFFSET( 9181, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 574),
+ NAME_FUNC_OFFSET( 9208, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, 575),
+ NAME_FUNC_OFFSET( 9241, glFramebufferTextureARB, glFramebufferTextureARB, NULL, 576),
+ NAME_FUNC_OFFSET( 9265, glFramebufferTextureFaceARB, glFramebufferTextureFaceARB, NULL, 577),
+ NAME_FUNC_OFFSET( 9293, glProgramParameteriARB, glProgramParameteriARB, NULL, 578),
+ NAME_FUNC_OFFSET( 9316, glVertexAttribDivisorARB, glVertexAttribDivisorARB, NULL, 579),
+ NAME_FUNC_OFFSET( 9341, glFlushMappedBufferRange, glFlushMappedBufferRange, NULL, 580),
+ NAME_FUNC_OFFSET( 9366, glMapBufferRange, glMapBufferRange, NULL, 581),
+ NAME_FUNC_OFFSET( 9383, glTexBufferARB, glTexBufferARB, NULL, 582),
+ NAME_FUNC_OFFSET( 9398, glBindVertexArray, glBindVertexArray, NULL, 583),
+ NAME_FUNC_OFFSET( 9416, glGenVertexArrays, glGenVertexArrays, NULL, 584),
+ NAME_FUNC_OFFSET( 9434, glCopyBufferSubData, glCopyBufferSubData, NULL, 585),
+ NAME_FUNC_OFFSET( 9454, glClientWaitSync, glClientWaitSync, NULL, 586),
+ NAME_FUNC_OFFSET( 9471, glDeleteSync, glDeleteSync, NULL, 587),
+ NAME_FUNC_OFFSET( 9484, glFenceSync, glFenceSync, NULL, 588),
+ NAME_FUNC_OFFSET( 9496, glGetInteger64v, glGetInteger64v, NULL, 589),
+ NAME_FUNC_OFFSET( 9512, glGetSynciv, glGetSynciv, NULL, 590),
+ NAME_FUNC_OFFSET( 9524, glIsSync, glIsSync, NULL, 591),
+ NAME_FUNC_OFFSET( 9533, glWaitSync, glWaitSync, NULL, 592),
+ NAME_FUNC_OFFSET( 9544, glDrawElementsBaseVertex, glDrawElementsBaseVertex, NULL, 593),
+ NAME_FUNC_OFFSET( 9569, glDrawElementsInstancedBaseVertex, glDrawElementsInstancedBaseVertex, NULL, 594),
+ NAME_FUNC_OFFSET( 9603, glDrawRangeElementsBaseVertex, glDrawRangeElementsBaseVertex, NULL, 595),
+ NAME_FUNC_OFFSET( 9633, glMultiDrawElementsBaseVertex, glMultiDrawElementsBaseVertex, NULL, 596),
+ NAME_FUNC_OFFSET( 9663, glBlendEquationSeparateiARB, glBlendEquationSeparateiARB, NULL, 597),
+ NAME_FUNC_OFFSET( 9691, glBlendEquationiARB, glBlendEquationiARB, NULL, 598),
+ NAME_FUNC_OFFSET( 9711, glBlendFuncSeparateiARB, glBlendFuncSeparateiARB, NULL, 599),
+ NAME_FUNC_OFFSET( 9735, glBlendFunciARB, glBlendFunciARB, NULL, 600),
+ NAME_FUNC_OFFSET( 9751, glBindSampler, glBindSampler, NULL, 601),
+ NAME_FUNC_OFFSET( 9765, glDeleteSamplers, glDeleteSamplers, NULL, 602),
+ NAME_FUNC_OFFSET( 9782, glGenSamplers, glGenSamplers, NULL, 603),
+ NAME_FUNC_OFFSET( 9796, glGetSamplerParameterIiv, glGetSamplerParameterIiv, NULL, 604),
+ NAME_FUNC_OFFSET( 9821, glGetSamplerParameterIuiv, glGetSamplerParameterIuiv, NULL, 605),
+ NAME_FUNC_OFFSET( 9847, glGetSamplerParameterfv, glGetSamplerParameterfv, NULL, 606),
+ NAME_FUNC_OFFSET( 9871, glGetSamplerParameteriv, glGetSamplerParameteriv, NULL, 607),
+ NAME_FUNC_OFFSET( 9895, glIsSampler, glIsSampler, NULL, 608),
+ NAME_FUNC_OFFSET( 9907, glSamplerParameterIiv, glSamplerParameterIiv, NULL, 609),
+ NAME_FUNC_OFFSET( 9929, glSamplerParameterIuiv, glSamplerParameterIuiv, NULL, 610),
+ NAME_FUNC_OFFSET( 9952, glSamplerParameterf, glSamplerParameterf, NULL, 611),
+ NAME_FUNC_OFFSET( 9972, glSamplerParameterfv, glSamplerParameterfv, NULL, 612),
+ NAME_FUNC_OFFSET( 9993, glSamplerParameteri, glSamplerParameteri, NULL, 613),
+ NAME_FUNC_OFFSET(10013, glSamplerParameteriv, glSamplerParameteriv, NULL, 614),
+ NAME_FUNC_OFFSET(10034, glColorP3ui, glColorP3ui, NULL, 615),
+ NAME_FUNC_OFFSET(10046, glColorP3uiv, glColorP3uiv, NULL, 616),
+ NAME_FUNC_OFFSET(10059, glColorP4ui, glColorP4ui, NULL, 617),
+ NAME_FUNC_OFFSET(10071, glColorP4uiv, glColorP4uiv, NULL, 618),
+ NAME_FUNC_OFFSET(10084, glMultiTexCoordP1ui, glMultiTexCoordP1ui, NULL, 619),
+ NAME_FUNC_OFFSET(10104, glMultiTexCoordP1uiv, glMultiTexCoordP1uiv, NULL, 620),
+ NAME_FUNC_OFFSET(10125, glMultiTexCoordP2ui, glMultiTexCoordP2ui, NULL, 621),
+ NAME_FUNC_OFFSET(10145, glMultiTexCoordP2uiv, glMultiTexCoordP2uiv, NULL, 622),
+ NAME_FUNC_OFFSET(10166, glMultiTexCoordP3ui, glMultiTexCoordP3ui, NULL, 623),
+ NAME_FUNC_OFFSET(10186, glMultiTexCoordP3uiv, glMultiTexCoordP3uiv, NULL, 624),
+ NAME_FUNC_OFFSET(10207, glMultiTexCoordP4ui, glMultiTexCoordP4ui, NULL, 625),
+ NAME_FUNC_OFFSET(10227, glMultiTexCoordP4uiv, glMultiTexCoordP4uiv, NULL, 626),
+ NAME_FUNC_OFFSET(10248, glNormalP3ui, glNormalP3ui, NULL, 627),
+ NAME_FUNC_OFFSET(10261, glNormalP3uiv, glNormalP3uiv, NULL, 628),
+ NAME_FUNC_OFFSET(10275, glSecondaryColorP3ui, glSecondaryColorP3ui, NULL, 629),
+ NAME_FUNC_OFFSET(10296, glSecondaryColorP3uiv, glSecondaryColorP3uiv, NULL, 630),
+ NAME_FUNC_OFFSET(10318, glTexCoordP1ui, glTexCoordP1ui, NULL, 631),
+ NAME_FUNC_OFFSET(10333, glTexCoordP1uiv, glTexCoordP1uiv, NULL, 632),
+ NAME_FUNC_OFFSET(10349, glTexCoordP2ui, glTexCoordP2ui, NULL, 633),
+ NAME_FUNC_OFFSET(10364, glTexCoordP2uiv, glTexCoordP2uiv, NULL, 634),
+ NAME_FUNC_OFFSET(10380, glTexCoordP3ui, glTexCoordP3ui, NULL, 635),
+ NAME_FUNC_OFFSET(10395, glTexCoordP3uiv, glTexCoordP3uiv, NULL, 636),
+ NAME_FUNC_OFFSET(10411, glTexCoordP4ui, glTexCoordP4ui, NULL, 637),
+ NAME_FUNC_OFFSET(10426, glTexCoordP4uiv, glTexCoordP4uiv, NULL, 638),
+ NAME_FUNC_OFFSET(10442, glVertexAttribP1ui, glVertexAttribP1ui, NULL, 639),
+ NAME_FUNC_OFFSET(10461, glVertexAttribP1uiv, glVertexAttribP1uiv, NULL, 640),
+ NAME_FUNC_OFFSET(10481, glVertexAttribP2ui, glVertexAttribP2ui, NULL, 641),
+ NAME_FUNC_OFFSET(10500, glVertexAttribP2uiv, glVertexAttribP2uiv, NULL, 642),
+ NAME_FUNC_OFFSET(10520, glVertexAttribP3ui, glVertexAttribP3ui, NULL, 643),
+ NAME_FUNC_OFFSET(10539, glVertexAttribP3uiv, glVertexAttribP3uiv, NULL, 644),
+ NAME_FUNC_OFFSET(10559, glVertexAttribP4ui, glVertexAttribP4ui, NULL, 645),
+ NAME_FUNC_OFFSET(10578, glVertexAttribP4uiv, glVertexAttribP4uiv, NULL, 646),
+ NAME_FUNC_OFFSET(10598, glVertexP2ui, glVertexP2ui, NULL, 647),
+ NAME_FUNC_OFFSET(10611, glVertexP2uiv, glVertexP2uiv, NULL, 648),
+ NAME_FUNC_OFFSET(10625, glVertexP3ui, glVertexP3ui, NULL, 649),
+ NAME_FUNC_OFFSET(10638, glVertexP3uiv, glVertexP3uiv, NULL, 650),
+ NAME_FUNC_OFFSET(10652, glVertexP4ui, glVertexP4ui, NULL, 651),
+ NAME_FUNC_OFFSET(10665, glVertexP4uiv, glVertexP4uiv, NULL, 652),
+ NAME_FUNC_OFFSET(10679, glBindTransformFeedback, glBindTransformFeedback, NULL, 653),
+ NAME_FUNC_OFFSET(10703, glDeleteTransformFeedbacks, glDeleteTransformFeedbacks, NULL, 654),
+ NAME_FUNC_OFFSET(10730, glDrawTransformFeedback, glDrawTransformFeedback, NULL, 655),
+ NAME_FUNC_OFFSET(10754, glGenTransformFeedbacks, glGenTransformFeedbacks, NULL, 656),
+ NAME_FUNC_OFFSET(10778, glIsTransformFeedback, glIsTransformFeedback, NULL, 657),
+ NAME_FUNC_OFFSET(10800, glPauseTransformFeedback, glPauseTransformFeedback, NULL, 658),
+ NAME_FUNC_OFFSET(10825, glResumeTransformFeedback, glResumeTransformFeedback, NULL, 659),
+ NAME_FUNC_OFFSET(10851, glClearDepthf, glClearDepthf, NULL, 660),
+ NAME_FUNC_OFFSET(10865, glDepthRangef, glDepthRangef, NULL, 661),
+ NAME_FUNC_OFFSET(10879, glGetShaderPrecisionFormat, glGetShaderPrecisionFormat, NULL, 662),
+ NAME_FUNC_OFFSET(10906, glReleaseShaderCompiler, glReleaseShaderCompiler, NULL, 663),
+ NAME_FUNC_OFFSET(10930, glShaderBinary, glShaderBinary, NULL, 664),
+ NAME_FUNC_OFFSET(10945, glDebugMessageCallbackARB, glDebugMessageCallbackARB, NULL, 665),
+ NAME_FUNC_OFFSET(10971, glDebugMessageControlARB, glDebugMessageControlARB, NULL, 666),
+ NAME_FUNC_OFFSET(10996, glDebugMessageInsertARB, glDebugMessageInsertARB, NULL, 667),
+ NAME_FUNC_OFFSET(11020, glGetDebugMessageLogARB, glGetDebugMessageLogARB, NULL, 668),
+ NAME_FUNC_OFFSET(11044, glGetGraphicsResetStatusARB, glGetGraphicsResetStatusARB, NULL, 669),
+ NAME_FUNC_OFFSET(11072, glGetnColorTableARB, glGetnColorTableARB, NULL, 670),
+ NAME_FUNC_OFFSET(11092, glGetnCompressedTexImageARB, glGetnCompressedTexImageARB, NULL, 671),
+ NAME_FUNC_OFFSET(11120, glGetnConvolutionFilterARB, glGetnConvolutionFilterARB, NULL, 672),
+ NAME_FUNC_OFFSET(11147, glGetnHistogramARB, glGetnHistogramARB, NULL, 673),
+ NAME_FUNC_OFFSET(11166, glGetnMapdvARB, glGetnMapdvARB, NULL, 674),
+ NAME_FUNC_OFFSET(11181, glGetnMapfvARB, glGetnMapfvARB, NULL, 675),
+ NAME_FUNC_OFFSET(11196, glGetnMapivARB, glGetnMapivARB, NULL, 676),
+ NAME_FUNC_OFFSET(11211, glGetnMinmaxARB, glGetnMinmaxARB, NULL, 677),
+ NAME_FUNC_OFFSET(11227, glGetnPixelMapfvARB, glGetnPixelMapfvARB, NULL, 678),
+ NAME_FUNC_OFFSET(11247, glGetnPixelMapuivARB, glGetnPixelMapuivARB, NULL, 679),
+ NAME_FUNC_OFFSET(11268, glGetnPixelMapusvARB, glGetnPixelMapusvARB, NULL, 680),
+ NAME_FUNC_OFFSET(11289, glGetnPolygonStippleARB, glGetnPolygonStippleARB, NULL, 681),
+ NAME_FUNC_OFFSET(11313, glGetnSeparableFilterARB, glGetnSeparableFilterARB, NULL, 682),
+ NAME_FUNC_OFFSET(11338, glGetnTexImageARB, glGetnTexImageARB, NULL, 683),
+ NAME_FUNC_OFFSET(11356, glGetnUniformdvARB, glGetnUniformdvARB, NULL, 684),
+ NAME_FUNC_OFFSET(11375, glGetnUniformfvARB, glGetnUniformfvARB, NULL, 685),
+ NAME_FUNC_OFFSET(11394, glGetnUniformivARB, glGetnUniformivARB, NULL, 686),
+ NAME_FUNC_OFFSET(11413, glGetnUniformuivARB, glGetnUniformuivARB, NULL, 687),
+ NAME_FUNC_OFFSET(11433, glReadnPixelsARB, glReadnPixelsARB, NULL, 688),
+ NAME_FUNC_OFFSET(11450, glTexStorage1D, glTexStorage1D, NULL, 689),
+ NAME_FUNC_OFFSET(11465, glTexStorage2D, glTexStorage2D, NULL, 690),
+ NAME_FUNC_OFFSET(11480, glTexStorage3D, glTexStorage3D, NULL, 691),
+ NAME_FUNC_OFFSET(11495, glTextureStorage1DEXT, glTextureStorage1DEXT, NULL, 692),
+ NAME_FUNC_OFFSET(11517, glTextureStorage2DEXT, glTextureStorage2DEXT, NULL, 693),
+ NAME_FUNC_OFFSET(11539, glTextureStorage3DEXT, glTextureStorage3DEXT, NULL, 694),
+ NAME_FUNC_OFFSET(11561, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, 695),
+ NAME_FUNC_OFFSET(11580, gl_dispatch_stub_696, gl_dispatch_stub_696, NULL, 696),
+ NAME_FUNC_OFFSET(11612, gl_dispatch_stub_697, gl_dispatch_stub_697, NULL, 697),
+ NAME_FUNC_OFFSET(11644, gl_dispatch_stub_698, gl_dispatch_stub_698, NULL, 698),
+ NAME_FUNC_OFFSET(11672, gl_dispatch_stub_699, gl_dispatch_stub_699, NULL, 699),
+ NAME_FUNC_OFFSET(11701, gl_dispatch_stub_700, gl_dispatch_stub_700, NULL, 700),
+ NAME_FUNC_OFFSET(11729, gl_dispatch_stub_701, gl_dispatch_stub_701, NULL, 701),
+ NAME_FUNC_OFFSET(11758, gl_dispatch_stub_702, gl_dispatch_stub_702, NULL, 702),
+ NAME_FUNC_OFFSET(11775, gl_dispatch_stub_703, gl_dispatch_stub_703, NULL, 703),
+ NAME_FUNC_OFFSET(11795, glColorPointerEXT, glColorPointerEXT, NULL, 704),
+ NAME_FUNC_OFFSET(11813, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, 705),
+ NAME_FUNC_OFFSET(11834, glIndexPointerEXT, glIndexPointerEXT, NULL, 706),
+ NAME_FUNC_OFFSET(11852, glNormalPointerEXT, glNormalPointerEXT, NULL, 707),
+ NAME_FUNC_OFFSET(11871, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, 708),
+ NAME_FUNC_OFFSET(11892, glVertexPointerEXT, glVertexPointerEXT, NULL, 709),
+ NAME_FUNC_OFFSET(11911, glPointParameterfEXT, glPointParameterfEXT, NULL, 710),
+ NAME_FUNC_OFFSET(11932, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 711),
+ NAME_FUNC_OFFSET(11954, glLockArraysEXT, glLockArraysEXT, NULL, 712),
+ NAME_FUNC_OFFSET(11970, glUnlockArraysEXT, glUnlockArraysEXT, NULL, 713),
+ NAME_FUNC_OFFSET(11988, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 714),
+ NAME_FUNC_OFFSET(12010, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 715),
+ NAME_FUNC_OFFSET(12033, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 716),
+ NAME_FUNC_OFFSET(12055, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 717),
+ NAME_FUNC_OFFSET(12078, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 718),
+ NAME_FUNC_OFFSET(12100, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 719),
+ NAME_FUNC_OFFSET(12123, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 720),
+ NAME_FUNC_OFFSET(12145, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 721),
+ NAME_FUNC_OFFSET(12168, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 722),
+ NAME_FUNC_OFFSET(12190, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 723),
+ NAME_FUNC_OFFSET(12213, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 724),
+ NAME_FUNC_OFFSET(12236, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 725),
+ NAME_FUNC_OFFSET(12260, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 726),
+ NAME_FUNC_OFFSET(12283, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 727),
+ NAME_FUNC_OFFSET(12307, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 728),
+ NAME_FUNC_OFFSET(12330, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 729),
+ NAME_FUNC_OFFSET(12354, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 730),
+ NAME_FUNC_OFFSET(12381, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 731),
+ NAME_FUNC_OFFSET(12402, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 732),
+ NAME_FUNC_OFFSET(12425, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 733),
+ NAME_FUNC_OFFSET(12446, glFogCoorddEXT, glFogCoorddEXT, NULL, 734),
+ NAME_FUNC_OFFSET(12461, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 735),
+ NAME_FUNC_OFFSET(12477, glFogCoordfEXT, glFogCoordfEXT, NULL, 736),
+ NAME_FUNC_OFFSET(12492, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 737),
+ NAME_FUNC_OFFSET(12508, gl_dispatch_stub_738, gl_dispatch_stub_738, NULL, 738),
+ NAME_FUNC_OFFSET(12526, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 739),
+ NAME_FUNC_OFFSET(12549, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, 740),
+ NAME_FUNC_OFFSET(12575, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, 741),
+ NAME_FUNC_OFFSET(12596, glCombinerInputNV, glCombinerInputNV, NULL, 742),
+ NAME_FUNC_OFFSET(12614, glCombinerOutputNV, glCombinerOutputNV, NULL, 743),
+ NAME_FUNC_OFFSET(12633, glCombinerParameterfNV, glCombinerParameterfNV, NULL, 744),
+ NAME_FUNC_OFFSET(12656, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, 745),
+ NAME_FUNC_OFFSET(12680, glCombinerParameteriNV, glCombinerParameteriNV, NULL, 746),
+ NAME_FUNC_OFFSET(12703, glCombinerParameterivNV, glCombinerParameterivNV, NULL, 747),
+ NAME_FUNC_OFFSET(12727, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, 748),
+ NAME_FUNC_OFFSET(12750, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, 749),
+ NAME_FUNC_OFFSET(12782, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, 750),
+ NAME_FUNC_OFFSET(12814, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, 751),
+ NAME_FUNC_OFFSET(12847, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, 752),
+ NAME_FUNC_OFFSET(12880, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, 753),
+ NAME_FUNC_OFFSET(12917, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, 754),
+ NAME_FUNC_OFFSET(12954, glResizeBuffersMESA, glResizeBuffersMESA, NULL, 755),
+ NAME_FUNC_OFFSET(12974, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 756),
+ NAME_FUNC_OFFSET(12992, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 757),
+ NAME_FUNC_OFFSET(13011, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 758),
+ NAME_FUNC_OFFSET(13029, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 759),
+ NAME_FUNC_OFFSET(13048, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 760),
+ NAME_FUNC_OFFSET(13066, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 761),
+ NAME_FUNC_OFFSET(13085, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 762),
+ NAME_FUNC_OFFSET(13103, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 763),
+ NAME_FUNC_OFFSET(13122, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 764),
+ NAME_FUNC_OFFSET(13140, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 765),
+ NAME_FUNC_OFFSET(13159, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 766),
+ NAME_FUNC_OFFSET(13177, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 767),
+ NAME_FUNC_OFFSET(13196, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 768),
+ NAME_FUNC_OFFSET(13214, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 769),
+ NAME_FUNC_OFFSET(13233, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 770),
+ NAME_FUNC_OFFSET(13251, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 771),
+ NAME_FUNC_OFFSET(13270, glWindowPos4dMESA, glWindowPos4dMESA, NULL, 772),
+ NAME_FUNC_OFFSET(13288, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, 773),
+ NAME_FUNC_OFFSET(13307, glWindowPos4fMESA, glWindowPos4fMESA, NULL, 774),
+ NAME_FUNC_OFFSET(13325, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, 775),
+ NAME_FUNC_OFFSET(13344, glWindowPos4iMESA, glWindowPos4iMESA, NULL, 776),
+ NAME_FUNC_OFFSET(13362, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, 777),
+ NAME_FUNC_OFFSET(13381, glWindowPos4sMESA, glWindowPos4sMESA, NULL, 778),
+ NAME_FUNC_OFFSET(13399, glWindowPos4svMESA, glWindowPos4svMESA, NULL, 779),
+ NAME_FUNC_OFFSET(13418, gl_dispatch_stub_780, gl_dispatch_stub_780, NULL, 780),
+ NAME_FUNC_OFFSET(13443, gl_dispatch_stub_781, gl_dispatch_stub_781, NULL, 781),
+ NAME_FUNC_OFFSET(13470, gl_dispatch_stub_782, gl_dispatch_stub_782, NULL, 782),
+ NAME_FUNC_OFFSET(13487, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, 783),
+ NAME_FUNC_OFFSET(13503, gl_dispatch_stub_784, gl_dispatch_stub_784, NULL, 784),
+ NAME_FUNC_OFFSET(13517, gl_dispatch_stub_785, gl_dispatch_stub_785, NULL, 785),
+ NAME_FUNC_OFFSET(13532, gl_dispatch_stub_786, gl_dispatch_stub_786, NULL, 786),
+ NAME_FUNC_OFFSET(13544, gl_dispatch_stub_787, gl_dispatch_stub_787, NULL, 787),
+ NAME_FUNC_OFFSET(13557, gl_dispatch_stub_788, gl_dispatch_stub_788, NULL, 788),
+ NAME_FUNC_OFFSET(13571, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, 789),
+ NAME_FUNC_OFFSET(13595, glBindProgramNV, glBindProgramNV, NULL, 790),
+ NAME_FUNC_OFFSET(13611, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 791),
+ NAME_FUNC_OFFSET(13630, glExecuteProgramNV, glExecuteProgramNV, NULL, 792),
+ NAME_FUNC_OFFSET(13649, glGenProgramsNV, glGenProgramsNV, NULL, 793),
+ NAME_FUNC_OFFSET(13665, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, 794),
+ NAME_FUNC_OFFSET(13691, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, 795),
+ NAME_FUNC_OFFSET(13717, glGetProgramStringNV, glGetProgramStringNV, NULL, 796),
+ NAME_FUNC_OFFSET(13738, glGetProgramivNV, glGetProgramivNV, NULL, 797),
+ NAME_FUNC_OFFSET(13755, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, 798),
+ NAME_FUNC_OFFSET(13776, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 799),
+ NAME_FUNC_OFFSET(13804, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, 800),
+ NAME_FUNC_OFFSET(13826, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, 801),
+ NAME_FUNC_OFFSET(13848, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, 802),
+ NAME_FUNC_OFFSET(13870, glIsProgramNV, glIsProgramNV, NULL, 803),
+ NAME_FUNC_OFFSET(13884, glLoadProgramNV, glLoadProgramNV, NULL, 804),
+ NAME_FUNC_OFFSET(13900, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, 805),
+ NAME_FUNC_OFFSET(13925, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, 806),
+ NAME_FUNC_OFFSET(13950, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, 807),
+ NAME_FUNC_OFFSET(13978, glTrackMatrixNV, glTrackMatrixNV, NULL, 808),
+ NAME_FUNC_OFFSET(13994, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, 809),
+ NAME_FUNC_OFFSET(14013, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, 810),
+ NAME_FUNC_OFFSET(14033, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, 811),
+ NAME_FUNC_OFFSET(14052, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, 812),
+ NAME_FUNC_OFFSET(14072, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, 813),
+ NAME_FUNC_OFFSET(14091, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, 814),
+ NAME_FUNC_OFFSET(14111, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, 815),
+ NAME_FUNC_OFFSET(14130, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, 816),
+ NAME_FUNC_OFFSET(14150, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, 817),
+ NAME_FUNC_OFFSET(14169, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, 818),
+ NAME_FUNC_OFFSET(14189, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, 819),
+ NAME_FUNC_OFFSET(14208, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, 820),
+ NAME_FUNC_OFFSET(14228, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, 821),
+ NAME_FUNC_OFFSET(14247, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, 822),
+ NAME_FUNC_OFFSET(14267, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, 823),
+ NAME_FUNC_OFFSET(14286, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, 824),
+ NAME_FUNC_OFFSET(14306, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, 825),
+ NAME_FUNC_OFFSET(14325, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, 826),
+ NAME_FUNC_OFFSET(14345, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, 827),
+ NAME_FUNC_OFFSET(14364, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, 828),
+ NAME_FUNC_OFFSET(14384, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, 829),
+ NAME_FUNC_OFFSET(14403, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, 830),
+ NAME_FUNC_OFFSET(14423, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, 831),
+ NAME_FUNC_OFFSET(14442, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, 832),
+ NAME_FUNC_OFFSET(14462, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, 833),
+ NAME_FUNC_OFFSET(14482, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, 834),
+ NAME_FUNC_OFFSET(14503, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, 835),
+ NAME_FUNC_OFFSET(14527, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, 836),
+ NAME_FUNC_OFFSET(14548, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, 837),
+ NAME_FUNC_OFFSET(14569, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, 838),
+ NAME_FUNC_OFFSET(14590, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, 839),
+ NAME_FUNC_OFFSET(14611, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, 840),
+ NAME_FUNC_OFFSET(14632, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, 841),
+ NAME_FUNC_OFFSET(14653, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, 842),
+ NAME_FUNC_OFFSET(14674, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, 843),
+ NAME_FUNC_OFFSET(14695, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, 844),
+ NAME_FUNC_OFFSET(14716, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, 845),
+ NAME_FUNC_OFFSET(14737, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, 846),
+ NAME_FUNC_OFFSET(14758, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, 847),
+ NAME_FUNC_OFFSET(14779, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, 848),
+ NAME_FUNC_OFFSET(14801, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, 849),
+ NAME_FUNC_OFFSET(14828, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, 850),
+ NAME_FUNC_OFFSET(14855, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, 851),
+ NAME_FUNC_OFFSET(14879, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, 852),
+ NAME_FUNC_OFFSET(14903, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, 853),
+ NAME_FUNC_OFFSET(14925, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, 854),
+ NAME_FUNC_OFFSET(14947, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, 855),
+ NAME_FUNC_OFFSET(14969, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, 856),
+ NAME_FUNC_OFFSET(14994, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, 857),
+ NAME_FUNC_OFFSET(15018, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, 858),
+ NAME_FUNC_OFFSET(15040, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, 859),
+ NAME_FUNC_OFFSET(15062, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, 860),
+ NAME_FUNC_OFFSET(15084, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, 861),
+ NAME_FUNC_OFFSET(15110, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, 862),
+ NAME_FUNC_OFFSET(15133, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, 863),
+ NAME_FUNC_OFFSET(15157, glPassTexCoordATI, glPassTexCoordATI, NULL, 864),
+ NAME_FUNC_OFFSET(15175, glSampleMapATI, glSampleMapATI, NULL, 865),
+ NAME_FUNC_OFFSET(15190, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, 866),
+ NAME_FUNC_OFFSET(15221, glPointParameteriNV, glPointParameteriNV, NULL, 867),
+ NAME_FUNC_OFFSET(15241, glPointParameterivNV, glPointParameterivNV, NULL, 868),
+ NAME_FUNC_OFFSET(15262, gl_dispatch_stub_869, gl_dispatch_stub_869, NULL, 869),
+ NAME_FUNC_OFFSET(15285, gl_dispatch_stub_870, gl_dispatch_stub_870, NULL, 870),
+ NAME_FUNC_OFFSET(15308, gl_dispatch_stub_871, gl_dispatch_stub_871, NULL, 871),
+ NAME_FUNC_OFFSET(15334, gl_dispatch_stub_872, gl_dispatch_stub_872, NULL, 872),
+ NAME_FUNC_OFFSET(15357, gl_dispatch_stub_873, gl_dispatch_stub_873, NULL, 873),
+ NAME_FUNC_OFFSET(15378, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, 874),
+ NAME_FUNC_OFFSET(15409, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, 875),
+ NAME_FUNC_OFFSET(15440, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, 876),
+ NAME_FUNC_OFFSET(15468, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, 877),
+ NAME_FUNC_OFFSET(15497, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, 878),
+ NAME_FUNC_OFFSET(15525, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, 879),
+ NAME_FUNC_OFFSET(15554, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 880),
+ NAME_FUNC_OFFSET(15580, glPrimitiveRestartNV, glPrimitiveRestartNV, NULL, 881),
+ NAME_FUNC_OFFSET(15601, gl_dispatch_stub_882, gl_dispatch_stub_882, NULL, 882),
+ NAME_FUNC_OFFSET(15618, gl_dispatch_stub_883, gl_dispatch_stub_883, NULL, 883),
+ NAME_FUNC_OFFSET(15645, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 884),
+ NAME_FUNC_OFFSET(15666, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 885),
+ NAME_FUNC_OFFSET(15688, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 886),
+ NAME_FUNC_OFFSET(15716, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 887),
+ NAME_FUNC_OFFSET(15740, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 888),
+ NAME_FUNC_OFFSET(15765, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 889),
+ NAME_FUNC_OFFSET(15794, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 890),
+ NAME_FUNC_OFFSET(15820, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 891),
+ NAME_FUNC_OFFSET(15846, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 892),
+ NAME_FUNC_OFFSET(15872, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 893),
+ NAME_FUNC_OFFSET(15893, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 894),
+ NAME_FUNC_OFFSET(15915, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 895),
+ NAME_FUNC_OFFSET(15935, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 896),
+ NAME_FUNC_OFFSET(15976, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 897),
+ NAME_FUNC_OFFSET(16008, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 898),
+ NAME_FUNC_OFFSET(16027, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 899),
+ NAME_FUNC_OFFSET(16047, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 900),
+ NAME_FUNC_OFFSET(16072, gl_dispatch_stub_901, gl_dispatch_stub_901, NULL, 901),
+ NAME_FUNC_OFFSET(16093, gl_dispatch_stub_902, gl_dispatch_stub_902, NULL, 902),
+ NAME_FUNC_OFFSET(16117, gl_dispatch_stub_903, gl_dispatch_stub_903, NULL, 903),
+ NAME_FUNC_OFFSET(16147, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 904),
+ NAME_FUNC_OFFSET(16173, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 905),
+ NAME_FUNC_OFFSET(16198, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 906),
+ NAME_FUNC_OFFSET(16217, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 907),
+ NAME_FUNC_OFFSET(16241, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 908),
+ NAME_FUNC_OFFSET(16266, glUniform1uiEXT, glUniform1uiEXT, NULL, 909),
+ NAME_FUNC_OFFSET(16282, glUniform1uivEXT, glUniform1uivEXT, NULL, 910),
+ NAME_FUNC_OFFSET(16299, glUniform2uiEXT, glUniform2uiEXT, NULL, 911),
+ NAME_FUNC_OFFSET(16315, glUniform2uivEXT, glUniform2uivEXT, NULL, 912),
+ NAME_FUNC_OFFSET(16332, glUniform3uiEXT, glUniform3uiEXT, NULL, 913),
+ NAME_FUNC_OFFSET(16348, glUniform3uivEXT, glUniform3uivEXT, NULL, 914),
+ NAME_FUNC_OFFSET(16365, glUniform4uiEXT, glUniform4uiEXT, NULL, 915),
+ NAME_FUNC_OFFSET(16381, glUniform4uivEXT, glUniform4uivEXT, NULL, 916),
+ NAME_FUNC_OFFSET(16398, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 917),
+ NAME_FUNC_OFFSET(16419, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 918),
+ NAME_FUNC_OFFSET(16441, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 919),
+ NAME_FUNC_OFFSET(16463, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 920),
+ NAME_FUNC_OFFSET(16486, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 921),
+ NAME_FUNC_OFFSET(16507, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 922),
+ NAME_FUNC_OFFSET(16529, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 923),
+ NAME_FUNC_OFFSET(16551, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 924),
+ NAME_FUNC_OFFSET(16574, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 925),
+ NAME_FUNC_OFFSET(16595, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 926),
+ NAME_FUNC_OFFSET(16617, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 927),
+ NAME_FUNC_OFFSET(16639, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 928),
+ NAME_FUNC_OFFSET(16662, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 929),
+ NAME_FUNC_OFFSET(16684, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 930),
+ NAME_FUNC_OFFSET(16705, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 931),
+ NAME_FUNC_OFFSET(16727, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 932),
+ NAME_FUNC_OFFSET(16749, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 933),
+ NAME_FUNC_OFFSET(16772, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 934),
+ NAME_FUNC_OFFSET(16794, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 935),
+ NAME_FUNC_OFFSET(16817, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 936),
+ NAME_FUNC_OFFSET(16840, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 937),
+ NAME_FUNC_OFFSET(16866, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 938),
+ NAME_FUNC_OFFSET(16895, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 939),
+ NAME_FUNC_OFFSET(16917, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 940),
+ NAME_FUNC_OFFSET(16937, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 941),
+ NAME_FUNC_OFFSET(16956, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 942),
+ NAME_FUNC_OFFSET(16980, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 943),
+ NAME_FUNC_OFFSET(17004, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 944),
+ NAME_FUNC_OFFSET(17026, glClearColorIiEXT, glClearColorIiEXT, NULL, 945),
+ NAME_FUNC_OFFSET(17044, glClearColorIuiEXT, glClearColorIuiEXT, NULL, 946),
+ NAME_FUNC_OFFSET(17063, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 947),
+ NAME_FUNC_OFFSET(17087, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 948),
+ NAME_FUNC_OFFSET(17112, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 949),
+ NAME_FUNC_OFFSET(17133, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 950),
+ NAME_FUNC_OFFSET(17155, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 951),
+ NAME_FUNC_OFFSET(17182, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 952),
+ NAME_FUNC_OFFSET(17207, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 953),
+ NAME_FUNC_OFFSET(17235, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 954),
+ NAME_FUNC_OFFSET(17255, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL, 955),
+ NAME_FUNC_OFFSET(17277, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 956),
+ NAME_FUNC_OFFSET(17298, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 957),
+ NAME_FUNC_OFFSET(17324, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 958),
+ NAME_FUNC_OFFSET(17357, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 959),
+ NAME_FUNC_OFFSET(17388, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 960),
+ NAME_FUNC_OFFSET(17409, gl_dispatch_stub_961, gl_dispatch_stub_961, NULL, 961),
+ NAME_FUNC_OFFSET(17440, gl_dispatch_stub_962, gl_dispatch_stub_962, NULL, 962),
+ NAME_FUNC_OFFSET(17460, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, 963),
+ NAME_FUNC_OFFSET(17488, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, 964),
+ NAME_FUNC_OFFSET(17511, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, 965),
+ NAME_FUNC_OFFSET(17536, glActiveProgramEXT, glActiveProgramEXT, NULL, 966),
+ NAME_FUNC_OFFSET(17555, glCreateShaderProgramEXT, glCreateShaderProgramEXT, NULL, 967),
+ NAME_FUNC_OFFSET(17580, glUseShaderProgramEXT, glUseShaderProgramEXT, NULL, 968),
+ NAME_FUNC_OFFSET(17602, glTextureBarrierNV, glTextureBarrierNV, NULL, 969),
+ NAME_FUNC_OFFSET(17621, gl_dispatch_stub_970, gl_dispatch_stub_970, NULL, 970),
+ NAME_FUNC_OFFSET(17646, gl_dispatch_stub_971, gl_dispatch_stub_971, NULL, 971),
+ NAME_FUNC_OFFSET(17675, gl_dispatch_stub_972, gl_dispatch_stub_972, NULL, 972),
+ NAME_FUNC_OFFSET(17706, gl_dispatch_stub_973, gl_dispatch_stub_973, NULL, 973),
+ NAME_FUNC_OFFSET(17730, gl_dispatch_stub_974, gl_dispatch_stub_974, NULL, 974),
+ NAME_FUNC_OFFSET(17755, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, 975),
+ NAME_FUNC_OFFSET(17794, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, 976),
+ NAME_FUNC_OFFSET(17823, glArrayElement, glArrayElement, NULL, 306),
+ NAME_FUNC_OFFSET(17841, glBindTexture, glBindTexture, NULL, 307),
+ NAME_FUNC_OFFSET(17858, glDrawArrays, glDrawArrays, NULL, 310),
+ NAME_FUNC_OFFSET(17874, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, 322),
+ NAME_FUNC_OFFSET(17899, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
+ NAME_FUNC_OFFSET(17919, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
+ NAME_FUNC_OFFSET(17939, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, 325),
+ NAME_FUNC_OFFSET(17962, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, 326),
+ NAME_FUNC_OFFSET(17985, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, 327),
+ NAME_FUNC_OFFSET(18005, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, 328),
+ NAME_FUNC_OFFSET(18022, glGetPointerv, glGetPointerv, NULL, 329),
+ NAME_FUNC_OFFSET(18039, glIsTexture, glIsTextureEXT, glIsTextureEXT, 330),
+ NAME_FUNC_OFFSET(18054, glPrioritizeTextures, glPrioritizeTextures, NULL, 331),
+ NAME_FUNC_OFFSET(18078, glTexSubImage1D, glTexSubImage1D, NULL, 332),
+ NAME_FUNC_OFFSET(18097, glTexSubImage2D, glTexSubImage2D, NULL, 333),
+ NAME_FUNC_OFFSET(18116, glBlendColor, glBlendColor, NULL, 336),
+ NAME_FUNC_OFFSET(18132, glBlendEquation, glBlendEquation, NULL, 337),
+ NAME_FUNC_OFFSET(18151, glDrawRangeElements, glDrawRangeElements, NULL, 338),
+ NAME_FUNC_OFFSET(18174, glColorTable, glColorTable, NULL, 339),
+ NAME_FUNC_OFFSET(18190, glColorTable, glColorTable, NULL, 339),
+ NAME_FUNC_OFFSET(18206, glColorTableParameterfv, glColorTableParameterfv, NULL, 340),
+ NAME_FUNC_OFFSET(18233, glColorTableParameteriv, glColorTableParameteriv, NULL, 341),
+ NAME_FUNC_OFFSET(18260, glCopyColorTable, glCopyColorTable, NULL, 342),
+ NAME_FUNC_OFFSET(18280, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
+ NAME_FUNC_OFFSET(18299, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
+ NAME_FUNC_OFFSET(18318, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
+ NAME_FUNC_OFFSET(18348, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
+ NAME_FUNC_OFFSET(18378, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
+ NAME_FUNC_OFFSET(18408, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
+ NAME_FUNC_OFFSET(18438, glColorSubTable, glColorSubTable, NULL, 346),
+ NAME_FUNC_OFFSET(18457, glCopyColorSubTable, glCopyColorSubTable, NULL, 347),
+ NAME_FUNC_OFFSET(18480, glConvolutionFilter1D, glConvolutionFilter1D, NULL, 348),
+ NAME_FUNC_OFFSET(18505, glConvolutionFilter2D, glConvolutionFilter2D, NULL, 349),
+ NAME_FUNC_OFFSET(18530, glConvolutionParameterf, glConvolutionParameterf, NULL, 350),
+ NAME_FUNC_OFFSET(18557, glConvolutionParameterfv, glConvolutionParameterfv, NULL, 351),
+ NAME_FUNC_OFFSET(18585, glConvolutionParameteri, glConvolutionParameteri, NULL, 352),
+ NAME_FUNC_OFFSET(18612, glConvolutionParameteriv, glConvolutionParameteriv, NULL, 353),
+ NAME_FUNC_OFFSET(18640, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, 354),
+ NAME_FUNC_OFFSET(18669, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, 355),
+ NAME_FUNC_OFFSET(18698, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, 356),
+ NAME_FUNC_OFFSET(18724, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, 357),
+ NAME_FUNC_OFFSET(18755, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, 358),
+ NAME_FUNC_OFFSET(18786, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, 359),
+ NAME_FUNC_OFFSET(18810, glSeparableFilter2D, glSeparableFilter2D, NULL, 360),
+ NAME_FUNC_OFFSET(18833, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, 361),
+ NAME_FUNC_OFFSET(18851, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, 362),
+ NAME_FUNC_OFFSET(18880, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, 363),
+ NAME_FUNC_OFFSET(18909, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, 364),
+ NAME_FUNC_OFFSET(18924, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, 365),
+ NAME_FUNC_OFFSET(18950, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, 366),
+ NAME_FUNC_OFFSET(18976, glHistogram, glHistogram, NULL, 367),
+ NAME_FUNC_OFFSET(18991, glMinmax, glMinmax, NULL, 368),
+ NAME_FUNC_OFFSET(19003, glResetHistogram, glResetHistogram, NULL, 369),
+ NAME_FUNC_OFFSET(19023, glResetMinmax, glResetMinmax, NULL, 370),
+ NAME_FUNC_OFFSET(19040, glTexImage3D, glTexImage3D, NULL, 371),
+ NAME_FUNC_OFFSET(19056, glTexSubImage3D, glTexSubImage3D, NULL, 372),
+ NAME_FUNC_OFFSET(19075, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, 373),
+ NAME_FUNC_OFFSET(19098, glActiveTextureARB, glActiveTextureARB, NULL, 374),
+ NAME_FUNC_OFFSET(19114, glClientActiveTextureARB, glClientActiveTextureARB, NULL, 375),
+ NAME_FUNC_OFFSET(19136, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, 376),
+ NAME_FUNC_OFFSET(19154, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, 377),
+ NAME_FUNC_OFFSET(19173, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, 378),
+ NAME_FUNC_OFFSET(19191, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, 379),
+ NAME_FUNC_OFFSET(19210, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, 380),
+ NAME_FUNC_OFFSET(19228, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, 381),
+ NAME_FUNC_OFFSET(19247, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, 382),
+ NAME_FUNC_OFFSET(19265, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, 383),
+ NAME_FUNC_OFFSET(19284, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, 384),
+ NAME_FUNC_OFFSET(19302, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, 385),
+ NAME_FUNC_OFFSET(19321, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, 386),
+ NAME_FUNC_OFFSET(19339, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, 387),
+ NAME_FUNC_OFFSET(19358, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, 388),
+ NAME_FUNC_OFFSET(19376, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, 389),
+ NAME_FUNC_OFFSET(19395, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, 390),
+ NAME_FUNC_OFFSET(19413, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, 391),
+ NAME_FUNC_OFFSET(19432, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, 392),
+ NAME_FUNC_OFFSET(19450, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, 393),
+ NAME_FUNC_OFFSET(19469, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, 394),
+ NAME_FUNC_OFFSET(19487, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, 395),
+ NAME_FUNC_OFFSET(19506, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, 396),
+ NAME_FUNC_OFFSET(19524, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, 397),
+ NAME_FUNC_OFFSET(19543, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, 398),
+ NAME_FUNC_OFFSET(19561, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, 399),
+ NAME_FUNC_OFFSET(19580, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, 400),
+ NAME_FUNC_OFFSET(19598, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, 401),
+ NAME_FUNC_OFFSET(19617, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, 402),
+ NAME_FUNC_OFFSET(19635, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, 403),
+ NAME_FUNC_OFFSET(19654, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, 404),
+ NAME_FUNC_OFFSET(19672, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, 405),
+ NAME_FUNC_OFFSET(19691, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, 406),
+ NAME_FUNC_OFFSET(19709, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, 407),
+ NAME_FUNC_OFFSET(19728, glStencilOpSeparate, glStencilOpSeparate, NULL, 423),
+ NAME_FUNC_OFFSET(19751, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, 441),
+ NAME_FUNC_OFFSET(19774, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, 442),
+ NAME_FUNC_OFFSET(19797, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, 443),
+ NAME_FUNC_OFFSET(19820, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, 444),
+ NAME_FUNC_OFFSET(19843, glSampleCoverageARB, glSampleCoverageARB, NULL, 445),
+ NAME_FUNC_OFFSET(19860, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, 446),
+ NAME_FUNC_OFFSET(19883, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, 447),
+ NAME_FUNC_OFFSET(19906, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, 448),
+ NAME_FUNC_OFFSET(19929, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, 449),
+ NAME_FUNC_OFFSET(19955, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, 450),
+ NAME_FUNC_OFFSET(19981, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, 451),
+ NAME_FUNC_OFFSET(20007, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, 452),
+ NAME_FUNC_OFFSET(20031, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, 453),
+ NAME_FUNC_OFFSET(20058, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, 454),
+ NAME_FUNC_OFFSET(20084, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, 461),
+ NAME_FUNC_OFFSET(20104, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, 462),
+ NAME_FUNC_OFFSET(20124, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, 463),
+ NAME_FUNC_OFFSET(20144, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, 464),
+ NAME_FUNC_OFFSET(20167, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, 465),
+ NAME_FUNC_OFFSET(20191, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, 466),
+ NAME_FUNC_OFFSET(20214, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, 467),
+ NAME_FUNC_OFFSET(20238, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, 473),
+ NAME_FUNC_OFFSET(20255, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, 474),
+ NAME_FUNC_OFFSET(20273, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, 475),
+ NAME_FUNC_OFFSET(20290, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, 476),
+ NAME_FUNC_OFFSET(20308, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, 477),
+ NAME_FUNC_OFFSET(20325, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, 478),
+ NAME_FUNC_OFFSET(20343, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, 479),
+ NAME_FUNC_OFFSET(20360, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, 480),
+ NAME_FUNC_OFFSET(20378, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, 481),
+ NAME_FUNC_OFFSET(20395, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, 482),
+ NAME_FUNC_OFFSET(20413, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, 483),
+ NAME_FUNC_OFFSET(20430, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, 484),
+ NAME_FUNC_OFFSET(20448, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, 485),
+ NAME_FUNC_OFFSET(20465, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, 486),
+ NAME_FUNC_OFFSET(20483, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, 487),
+ NAME_FUNC_OFFSET(20500, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, 488),
+ NAME_FUNC_OFFSET(20518, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, 489),
+ NAME_FUNC_OFFSET(20535, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, 490),
+ NAME_FUNC_OFFSET(20553, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, 491),
+ NAME_FUNC_OFFSET(20572, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, 492),
+ NAME_FUNC_OFFSET(20591, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, 493),
+ NAME_FUNC_OFFSET(20610, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, 494),
+ NAME_FUNC_OFFSET(20629, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, 495),
+ NAME_FUNC_OFFSET(20649, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, 496),
+ NAME_FUNC_OFFSET(20669, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, 497),
+ NAME_FUNC_OFFSET(20689, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, 498),
+ NAME_FUNC_OFFSET(20707, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, 499),
+ NAME_FUNC_OFFSET(20724, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, 500),
+ NAME_FUNC_OFFSET(20742, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, 501),
+ NAME_FUNC_OFFSET(20759, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, 502),
+ NAME_FUNC_OFFSET(20777, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, 503),
+ NAME_FUNC_OFFSET(20795, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, 504),
+ NAME_FUNC_OFFSET(20812, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, 505),
+ NAME_FUNC_OFFSET(20830, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, 506),
+ NAME_FUNC_OFFSET(20849, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, 507),
+ NAME_FUNC_OFFSET(20868, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, 508),
+ NAME_FUNC_OFFSET(20887, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, 509),
+ NAME_FUNC_OFFSET(20909, glBindBufferARB, glBindBufferARB, NULL, 510),
+ NAME_FUNC_OFFSET(20922, glBufferDataARB, glBufferDataARB, NULL, 511),
+ NAME_FUNC_OFFSET(20935, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
+ NAME_FUNC_OFFSET(20951, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
+ NAME_FUNC_OFFSET(20967, glGenBuffersARB, glGenBuffersARB, NULL, 514),
+ NAME_FUNC_OFFSET(20980, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, 515),
+ NAME_FUNC_OFFSET(21003, glGetBufferPointervARB, glGetBufferPointervARB, NULL, 516),
+ NAME_FUNC_OFFSET(21023, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, 517),
+ NAME_FUNC_OFFSET(21042, glIsBufferARB, glIsBufferARB, NULL, 518),
+ NAME_FUNC_OFFSET(21053, glMapBufferARB, glMapBufferARB, NULL, 519),
+ NAME_FUNC_OFFSET(21065, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
+ NAME_FUNC_OFFSET(21079, glBeginQueryARB, glBeginQueryARB, NULL, 521),
+ NAME_FUNC_OFFSET(21092, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
+ NAME_FUNC_OFFSET(21108, glEndQueryARB, glEndQueryARB, NULL, 523),
+ NAME_FUNC_OFFSET(21119, glGenQueriesARB, glGenQueriesARB, NULL, 524),
+ NAME_FUNC_OFFSET(21132, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, 525),
+ NAME_FUNC_OFFSET(21151, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, 526),
+ NAME_FUNC_OFFSET(21171, glGetQueryivARB, glGetQueryivARB, NULL, 527),
+ NAME_FUNC_OFFSET(21184, glIsQueryARB, glIsQueryARB, NULL, 528),
+ NAME_FUNC_OFFSET(21194, glCompileShaderARB, glCompileShaderARB, NULL, 530),
+ NAME_FUNC_OFFSET(21210, glGetActiveUniformARB, glGetActiveUniformARB, NULL, 535),
+ NAME_FUNC_OFFSET(21229, glGetShaderSourceARB, glGetShaderSourceARB, NULL, 541),
+ NAME_FUNC_OFFSET(21247, glGetUniformLocationARB, glGetUniformLocationARB, NULL, 542),
+ NAME_FUNC_OFFSET(21268, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
+ NAME_FUNC_OFFSET(21283, glGetUniformivARB, glGetUniformivARB, NULL, 544),
+ NAME_FUNC_OFFSET(21298, glLinkProgramARB, glLinkProgramARB, NULL, 545),
+ NAME_FUNC_OFFSET(21312, glShaderSourceARB, glShaderSourceARB, NULL, 546),
+ NAME_FUNC_OFFSET(21327, glUniform1fARB, glUniform1fARB, NULL, 547),
+ NAME_FUNC_OFFSET(21339, glUniform1fvARB, glUniform1fvARB, NULL, 548),
+ NAME_FUNC_OFFSET(21352, glUniform1iARB, glUniform1iARB, NULL, 549),
+ NAME_FUNC_OFFSET(21364, glUniform1ivARB, glUniform1ivARB, NULL, 550),
+ NAME_FUNC_OFFSET(21377, glUniform2fARB, glUniform2fARB, NULL, 551),
+ NAME_FUNC_OFFSET(21389, glUniform2fvARB, glUniform2fvARB, NULL, 552),
+ NAME_FUNC_OFFSET(21402, glUniform2iARB, glUniform2iARB, NULL, 553),
+ NAME_FUNC_OFFSET(21414, glUniform2ivARB, glUniform2ivARB, NULL, 554),
+ NAME_FUNC_OFFSET(21427, glUniform3fARB, glUniform3fARB, NULL, 555),
+ NAME_FUNC_OFFSET(21439, glUniform3fvARB, glUniform3fvARB, NULL, 556),
+ NAME_FUNC_OFFSET(21452, glUniform3iARB, glUniform3iARB, NULL, 557),
+ NAME_FUNC_OFFSET(21464, glUniform3ivARB, glUniform3ivARB, NULL, 558),
+ NAME_FUNC_OFFSET(21477, glUniform4fARB, glUniform4fARB, NULL, 559),
+ NAME_FUNC_OFFSET(21489, glUniform4fvARB, glUniform4fvARB, NULL, 560),
+ NAME_FUNC_OFFSET(21502, glUniform4iARB, glUniform4iARB, NULL, 561),
+ NAME_FUNC_OFFSET(21514, glUniform4ivARB, glUniform4ivARB, NULL, 562),
+ NAME_FUNC_OFFSET(21527, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, 563),
+ NAME_FUNC_OFFSET(21546, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, 564),
+ NAME_FUNC_OFFSET(21565, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, 565),
+ NAME_FUNC_OFFSET(21584, glUseProgramObjectARB, glUseProgramObjectARB, NULL, 566),
+ NAME_FUNC_OFFSET(21597, glValidateProgramARB, glValidateProgramARB, NULL, 567),
+ NAME_FUNC_OFFSET(21615, glBindAttribLocationARB, glBindAttribLocationARB, NULL, 568),
+ NAME_FUNC_OFFSET(21636, glGetActiveAttribARB, glGetActiveAttribARB, NULL, 569),
+ NAME_FUNC_OFFSET(21654, glGetAttribLocationARB, glGetAttribLocationARB, NULL, 570),
+ NAME_FUNC_OFFSET(21674, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
+ NAME_FUNC_OFFSET(21688, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
+ NAME_FUNC_OFFSET(21705, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
+ NAME_FUNC_OFFSET(21721, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 573),
+ NAME_FUNC_OFFSET(21746, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 573),
+ NAME_FUNC_OFFSET(21768, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 574),
+ NAME_FUNC_OFFSET(21795, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 574),
+ NAME_FUNC_OFFSET(21819, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, 575),
+ NAME_FUNC_OFFSET(21855, glBlendEquationSeparateiARB, glBlendEquationSeparateiARB, NULL, 597),
+ NAME_FUNC_OFFSET(21889, glBlendEquationiARB, glBlendEquationiARB, NULL, 598),
+ NAME_FUNC_OFFSET(21915, glBlendFuncSeparateiARB, glBlendFuncSeparateiARB, NULL, 599),
+ NAME_FUNC_OFFSET(21945, glBlendFunciARB, glBlendFunciARB, NULL, 600),
+ NAME_FUNC_OFFSET(21967, gl_dispatch_stub_702, gl_dispatch_stub_702, NULL, 702),
+ NAME_FUNC_OFFSET(21983, gl_dispatch_stub_703, gl_dispatch_stub_703, NULL, 703),
+ NAME_FUNC_OFFSET(22002, glPointParameterfEXT, glPointParameterfEXT, NULL, 710),
+ NAME_FUNC_OFFSET(22020, glPointParameterfEXT, glPointParameterfEXT, NULL, 710),
+ NAME_FUNC_OFFSET(22041, glPointParameterfEXT, glPointParameterfEXT, NULL, 710),
+ NAME_FUNC_OFFSET(22063, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 711),
+ NAME_FUNC_OFFSET(22082, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 711),
+ NAME_FUNC_OFFSET(22104, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 711),
+ NAME_FUNC_OFFSET(22127, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 714),
+ NAME_FUNC_OFFSET(22146, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 715),
+ NAME_FUNC_OFFSET(22166, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 716),
+ NAME_FUNC_OFFSET(22185, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 717),
+ NAME_FUNC_OFFSET(22205, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 718),
+ NAME_FUNC_OFFSET(22224, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 719),
+ NAME_FUNC_OFFSET(22244, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 720),
+ NAME_FUNC_OFFSET(22263, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 721),
+ NAME_FUNC_OFFSET(22283, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 722),
+ NAME_FUNC_OFFSET(22302, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 723),
+ NAME_FUNC_OFFSET(22322, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 724),
+ NAME_FUNC_OFFSET(22342, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 725),
+ NAME_FUNC_OFFSET(22363, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 726),
+ NAME_FUNC_OFFSET(22383, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 727),
+ NAME_FUNC_OFFSET(22404, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 728),
+ NAME_FUNC_OFFSET(22424, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 729),
+ NAME_FUNC_OFFSET(22445, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 730),
+ NAME_FUNC_OFFSET(22469, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 731),
+ NAME_FUNC_OFFSET(22487, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 732),
+ NAME_FUNC_OFFSET(22507, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 733),
+ NAME_FUNC_OFFSET(22525, glFogCoorddEXT, glFogCoorddEXT, NULL, 734),
+ NAME_FUNC_OFFSET(22537, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 735),
+ NAME_FUNC_OFFSET(22550, glFogCoordfEXT, glFogCoordfEXT, NULL, 736),
+ NAME_FUNC_OFFSET(22562, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 737),
+ NAME_FUNC_OFFSET(22575, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 739),
+ NAME_FUNC_OFFSET(22595, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 739),
+ NAME_FUNC_OFFSET(22619, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 756),
+ NAME_FUNC_OFFSET(22633, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 756),
+ NAME_FUNC_OFFSET(22650, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 757),
+ NAME_FUNC_OFFSET(22665, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 757),
+ NAME_FUNC_OFFSET(22683, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 758),
+ NAME_FUNC_OFFSET(22697, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 758),
+ NAME_FUNC_OFFSET(22714, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 759),
+ NAME_FUNC_OFFSET(22729, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 759),
+ NAME_FUNC_OFFSET(22747, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 760),
+ NAME_FUNC_OFFSET(22761, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 760),
+ NAME_FUNC_OFFSET(22778, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 761),
+ NAME_FUNC_OFFSET(22793, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 761),
+ NAME_FUNC_OFFSET(22811, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 762),
+ NAME_FUNC_OFFSET(22825, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 762),
+ NAME_FUNC_OFFSET(22842, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 763),
+ NAME_FUNC_OFFSET(22857, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 763),
+ NAME_FUNC_OFFSET(22875, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 764),
+ NAME_FUNC_OFFSET(22889, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 764),
+ NAME_FUNC_OFFSET(22906, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 765),
+ NAME_FUNC_OFFSET(22921, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 765),
+ NAME_FUNC_OFFSET(22939, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 766),
+ NAME_FUNC_OFFSET(22953, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 766),
+ NAME_FUNC_OFFSET(22970, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 767),
+ NAME_FUNC_OFFSET(22985, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 767),
+ NAME_FUNC_OFFSET(23003, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 768),
+ NAME_FUNC_OFFSET(23017, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 768),
+ NAME_FUNC_OFFSET(23034, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 769),
+ NAME_FUNC_OFFSET(23049, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 769),
+ NAME_FUNC_OFFSET(23067, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 770),
+ NAME_FUNC_OFFSET(23081, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 770),
+ NAME_FUNC_OFFSET(23098, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 771),
+ NAME_FUNC_OFFSET(23113, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 771),
+ NAME_FUNC_OFFSET(23131, glBindProgramNV, glBindProgramNV, NULL, 790),
+ NAME_FUNC_OFFSET(23148, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 791),
+ NAME_FUNC_OFFSET(23168, glGenProgramsNV, glGenProgramsNV, NULL, 793),
+ NAME_FUNC_OFFSET(23185, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 799),
+ NAME_FUNC_OFFSET(23211, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 799),
+ NAME_FUNC_OFFSET(23240, glIsProgramNV, glIsProgramNV, NULL, 803),
+ NAME_FUNC_OFFSET(23255, glPointParameteriNV, glPointParameteriNV, NULL, 867),
+ NAME_FUNC_OFFSET(23273, glPointParameterivNV, glPointParameterivNV, NULL, 868),
+ NAME_FUNC_OFFSET(23292, gl_dispatch_stub_871, gl_dispatch_stub_871, NULL, 871),
+ NAME_FUNC_OFFSET(23313, gl_dispatch_stub_873, gl_dispatch_stub_873, NULL, 873),
+ NAME_FUNC_OFFSET(23329, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 880),
+ NAME_FUNC_OFFSET(23353, gl_dispatch_stub_883, gl_dispatch_stub_883, NULL, 883),
+ NAME_FUNC_OFFSET(23377, gl_dispatch_stub_883, gl_dispatch_stub_883, NULL, 883),
+ NAME_FUNC_OFFSET(23404, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 884),
+ NAME_FUNC_OFFSET(23422, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 885),
+ NAME_FUNC_OFFSET(23441, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 886),
+ NAME_FUNC_OFFSET(23466, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 887),
+ NAME_FUNC_OFFSET(23487, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 888),
+ NAME_FUNC_OFFSET(23509, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 889),
+ NAME_FUNC_OFFSET(23535, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 890),
+ NAME_FUNC_OFFSET(23558, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 891),
+ NAME_FUNC_OFFSET(23581, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 892),
+ NAME_FUNC_OFFSET(23604, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 893),
+ NAME_FUNC_OFFSET(23622, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 894),
+ NAME_FUNC_OFFSET(23641, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 895),
+ NAME_FUNC_OFFSET(23658, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 896),
+ NAME_FUNC_OFFSET(23696, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 897),
+ NAME_FUNC_OFFSET(23725, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 898),
+ NAME_FUNC_OFFSET(23741, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 899),
+ NAME_FUNC_OFFSET(23758, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 900),
+ NAME_FUNC_OFFSET(23780, gl_dispatch_stub_901, gl_dispatch_stub_901, NULL, 901),
+ NAME_FUNC_OFFSET(23798, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 904),
+ NAME_FUNC_OFFSET(23821, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 905),
+ NAME_FUNC_OFFSET(23843, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 906),
+ NAME_FUNC_OFFSET(23859, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 907),
+ NAME_FUNC_OFFSET(23880, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 908),
+ NAME_FUNC_OFFSET(23902, glUniform1uiEXT, glUniform1uiEXT, NULL, 909),
+ NAME_FUNC_OFFSET(23915, glUniform1uivEXT, glUniform1uivEXT, NULL, 910),
+ NAME_FUNC_OFFSET(23929, glUniform2uiEXT, glUniform2uiEXT, NULL, 911),
+ NAME_FUNC_OFFSET(23942, glUniform2uivEXT, glUniform2uivEXT, NULL, 912),
+ NAME_FUNC_OFFSET(23956, glUniform3uiEXT, glUniform3uiEXT, NULL, 913),
+ NAME_FUNC_OFFSET(23969, glUniform3uivEXT, glUniform3uivEXT, NULL, 914),
+ NAME_FUNC_OFFSET(23983, glUniform4uiEXT, glUniform4uiEXT, NULL, 915),
+ NAME_FUNC_OFFSET(23996, glUniform4uivEXT, glUniform4uivEXT, NULL, 916),
+ NAME_FUNC_OFFSET(24010, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 917),
+ NAME_FUNC_OFFSET(24028, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 918),
+ NAME_FUNC_OFFSET(24047, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 919),
+ NAME_FUNC_OFFSET(24066, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 920),
+ NAME_FUNC_OFFSET(24086, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 921),
+ NAME_FUNC_OFFSET(24104, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 922),
+ NAME_FUNC_OFFSET(24123, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 923),
+ NAME_FUNC_OFFSET(24142, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 924),
+ NAME_FUNC_OFFSET(24162, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 925),
+ NAME_FUNC_OFFSET(24180, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 926),
+ NAME_FUNC_OFFSET(24199, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 927),
+ NAME_FUNC_OFFSET(24218, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 928),
+ NAME_FUNC_OFFSET(24238, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 929),
+ NAME_FUNC_OFFSET(24257, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 930),
+ NAME_FUNC_OFFSET(24275, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 931),
+ NAME_FUNC_OFFSET(24294, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 932),
+ NAME_FUNC_OFFSET(24313, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 933),
+ NAME_FUNC_OFFSET(24333, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 934),
+ NAME_FUNC_OFFSET(24352, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 935),
+ NAME_FUNC_OFFSET(24372, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 936),
+ NAME_FUNC_OFFSET(24392, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 937),
+ NAME_FUNC_OFFSET(24415, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 938),
+ NAME_FUNC_OFFSET(24441, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 938),
+ NAME_FUNC_OFFSET(24470, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 939),
+ NAME_FUNC_OFFSET(24483, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 940),
+ NAME_FUNC_OFFSET(24494, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 941),
+ NAME_FUNC_OFFSET(24504, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 942),
+ NAME_FUNC_OFFSET(24520, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 943),
+ NAME_FUNC_OFFSET(24536, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 944),
+ NAME_FUNC_OFFSET(24549, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 947),
+ NAME_FUNC_OFFSET(24570, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 948),
+ NAME_FUNC_OFFSET(24592, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 949),
+ NAME_FUNC_OFFSET(24610, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 950),
+ NAME_FUNC_OFFSET(24629, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 951),
+ NAME_FUNC_OFFSET(24654, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 952),
+ NAME_FUNC_OFFSET(24677, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 953),
+ NAME_FUNC_OFFSET(24702, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 954),
+ NAME_FUNC_OFFSET(24719, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 956),
+ NAME_FUNC_OFFSET(24737, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 957),
+ NAME_FUNC_OFFSET(24760, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 958),
+ NAME_FUNC_OFFSET(24790, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 959),
+ NAME_FUNC_OFFSET(24818, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 960),
+ NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)
+};
+
+#undef NAME_FUNC_OFFSET
diff --git a/xorg-server/glx/glthread.c b/xorg-server/glx/glthread.c
index 5da7e433c..fd4c6cc09 100644
--- a/xorg-server/glx/glthread.c
+++ b/xorg-server/glx/glthread.c
@@ -22,13 +22,11 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
/*
* XXX There's probably some work to do in order to make this file
* truly reusable outside of Mesa.
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/Xfuncproto.h>
@@ -38,7 +36,6 @@
#include <stdio.h>
#include "glthread.h"
-
/*
* This file should still compile even when THREADS is not defined.
* This is to make things easier to deal with on the makefile scene..
@@ -53,7 +50,6 @@
#define GET_TSD_ERROR "_glthread_: failed to get thread specific data"
#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data"
-
/*
* Magic number to determine if a TSD object has been initialized.
* Kind of a hack but there doesn't appear to be a better cross-platform
@@ -61,8 +57,6 @@
*/
#define INIT_MAGIC 0xff8adc98
-
-
/*
* POSIX Threads -- The best way to go if your platform supports them.
* Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly
@@ -75,44 +69,41 @@
_X_EXPORT unsigned long
_glthread_GetID(void)
{
- return (unsigned long) pthread_self();
+ return (unsigned long) pthread_self();
}
-
void
-_glthread_InitTSD(_glthread_TSD *tsd)
+_glthread_InitTSD(_glthread_TSD * tsd)
{
- if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
- perror(INIT_TSD_ERROR);
- exit(-1);
- }
- tsd->initMagic = INIT_MAGIC;
+ if (pthread_key_create(&tsd->key, NULL /*free */ ) != 0) {
+ perror(INIT_TSD_ERROR);
+ exit(-1);
+ }
+ tsd->initMagic = INIT_MAGIC;
}
-
void *
-_glthread_GetTSD(_glthread_TSD *tsd)
+_glthread_GetTSD(_glthread_TSD * tsd)
{
- if (tsd->initMagic != (int) INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- return pthread_getspecific(tsd->key);
+ if (tsd->initMagic != (int) INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ return pthread_getspecific(tsd->key);
}
-
void
-_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
+_glthread_SetTSD(_glthread_TSD * tsd, void *ptr)
{
- if (tsd->initMagic != (int) INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- if (pthread_setspecific(tsd->key, ptr) != 0) {
- perror(SET_TSD_ERROR);
- exit(-1);
- }
+ if (tsd->initMagic != (int) INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ if (pthread_setspecific(tsd->key, ptr) != 0) {
+ perror(SET_TSD_ERROR);
+ exit(-1);
+ }
}
-#endif /* PTHREADS */
+#endif /* PTHREADS */
/*
* Win32 Threads. The only available option for Windows 95/NT.
@@ -121,65 +112,64 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
*/
#ifdef WIN32_THREADS
-void FreeTSD(_glthread_TSD *p)
+void
+FreeTSD(_glthread_TSD * p)
{
- if (p->initMagic==INIT_MAGIC) {
- TlsFree(p->key);
- p->initMagic=0;
- }
+ if (p->initMagic == INIT_MAGIC) {
+ TlsFree(p->key);
+ p->initMagic = 0;
+ }
}
-void InsteadOf_exit(int nCode)
+void
+InsteadOf_exit(int nCode)
{
- DWORD dwErr=GetLastError();
+ DWORD dwErr = GetLastError();
}
unsigned long
_glthread_GetID(void)
{
- return GetCurrentThreadId();
+ return GetCurrentThreadId();
}
-
void
-_glthread_InitTSD(_glthread_TSD *tsd)
+_glthread_InitTSD(_glthread_TSD * tsd)
{
- tsd->key = TlsAlloc();
- if (tsd->key == TLS_OUT_OF_INDEXES) {
- perror("Mesa:_glthread_InitTSD");
- InsteadOf_exit(-1);
- }
- tsd->initMagic = INIT_MAGIC;
+ tsd->key = TlsAlloc();
+ if (tsd->key == TLS_OUT_OF_INDEXES) {
+ perror("Mesa:_glthread_InitTSD");
+ InsteadOf_exit(-1);
+ }
+ tsd->initMagic = INIT_MAGIC;
}
-
void *
-_glthread_GetTSD(_glthread_TSD *tsd)
+_glthread_GetTSD(_glthread_TSD * tsd)
{
- if (tsd->initMagic != INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- return TlsGetValue(tsd->key);
+ if (tsd->initMagic != INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ return TlsGetValue(tsd->key);
}
-
void
-_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
+_glthread_SetTSD(_glthread_TSD * tsd, void *ptr)
{
- /* the following code assumes that the _glthread_TSD has been initialized
- to zero at creation */
- if (tsd->initMagic != INIT_MAGIC) {
- _glthread_InitTSD(tsd);
- }
- if (TlsSetValue(tsd->key, ptr) == 0) {
- perror("Mesa:_glthread_SetTSD");
- InsteadOf_exit(-1);
- }
+ /* the following code assumes that the _glthread_TSD has been initialized
+ to zero at creation */
+ if (tsd->initMagic != INIT_MAGIC) {
+ _glthread_InitTSD(tsd);
+ }
+ if (TlsSetValue(tsd->key, ptr) == 0) {
+ perror("Mesa:_glthread_SetTSD");
+ InsteadOf_exit(-1);
+ }
}
-#endif /* WIN32_THREADS */
+#endif /* WIN32_THREADS */
-#else /* THREADS */
+#else /* THREADS */
/*
* no-op functions
@@ -188,31 +178,27 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
_X_EXPORT unsigned long
_glthread_GetID(void)
{
- return 0;
+ return 0;
}
-
void
-_glthread_InitTSD(_glthread_TSD *tsd)
+_glthread_InitTSD(_glthread_TSD * tsd)
{
- (void) tsd;
+ (void) tsd;
}
-
void *
-_glthread_GetTSD(_glthread_TSD *tsd)
+_glthread_GetTSD(_glthread_TSD * tsd)
{
- (void) tsd;
- return NULL;
+ (void) tsd;
+ return NULL;
}
-
void
-_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
+_glthread_SetTSD(_glthread_TSD * tsd, void *ptr)
{
- (void) tsd;
- (void) ptr;
+ (void) tsd;
+ (void) ptr;
}
-
-#endif /* THREADS */
+#endif /* THREADS */
diff --git a/xorg-server/glx/glthread.h b/xorg-server/glx/glthread.h
index 532401a73..62c9bd4f1 100644
--- a/xorg-server/glx/glthread.h
+++ b/xorg-server/glx/glthread.h
@@ -22,7 +22,6 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
/*
* Thread support for gl dispatch.
*
@@ -63,14 +62,13 @@
#ifndef GLTHREAD_H
#define GLTHREAD_H
-
#if defined(USE_MGL_NAMESPACE)
#define _glapi_Dispatch _mglapi_Dispatch
#endif
#if (defined(PTHREADS) || defined(WIN32_THREADS)) \
&& !defined(THREADS)
-# define THREADS
+#define THREADS
#endif
#ifdef VMS
@@ -87,11 +85,11 @@
* proper compiling for MT-safe libc etc.
*/
#if defined(PTHREADS)
-#include <pthread.h> /* POSIX threads headers */
+#include <pthread.h> /* POSIX threads headers */
typedef struct {
- pthread_key_t key;
- int initMagic;
+ pthread_key_t key;
+ int initMagic;
} _glthread_TSD;
typedef pthread_t _glthread_Thread;
@@ -113,10 +111,7 @@ typedef pthread_mutex_t _glthread_Mutex;
#define _glthread_UNLOCK_MUTEX(name) \
(void) pthread_mutex_unlock(&(name))
-#endif /* PTHREADS */
-
-
-
+#endif /* PTHREADS */
/*
* Solaris threads. Use only up to Solaris 2.4.
@@ -125,9 +120,6 @@ typedef pthread_mutex_t _glthread_Mutex;
* use -D_REENTRANT if using gcc.
*/
-
-
-
/*
* Windows threads. Should work with Windows NT and 95.
* IMPORTANT: Link with multithreaded runtime library when THREADS are
@@ -137,8 +129,8 @@ typedef pthread_mutex_t _glthread_Mutex;
#include <windows.h>
typedef struct {
- DWORD key;
- int initMagic;
+ DWORD key;
+ int initMagic;
} _glthread_TSD;
typedef HANDLE _glthread_Thread;
@@ -151,7 +143,7 @@ typedef CRITICAL_SECTION _glthread_Mutex;
#define _glthread_LOCK_MUTEX(name) EnterCriticalSection(&name)
#define _glthread_UNLOCK_MUTEX(name) LeaveCriticalSection(&name)
-#endif /* WIN32_THREADS */
+#endif /* WIN32_THREADS */
/*
* BeOS threads. R5.x required.
@@ -162,16 +154,16 @@ typedef CRITICAL_SECTION _glthread_Mutex;
#include <support/TLS.h>
typedef struct {
- int32 key;
- int initMagic;
+ int32 key;
+ int initMagic;
} _glthread_TSD;
typedef thread_id _glthread_Thread;
/* Use Benaphore, aka speeder semaphore */
typedef struct {
- int32 lock;
- sem_id sem;
+ int32 lock;
+ sem_id sem;
} benaphore;
typedef benaphore _glthread_Mutex;
@@ -182,9 +174,7 @@ typedef benaphore _glthread_Mutex;
if (atomic_add(&(name.lock), 1) >= 1) acquire_sem(name.sem)
#define _glthread_UNLOCK_MUTEX(name) if (atomic_add(&(name.lock), -1) > 1) release_sem(name.sem)
-#endif /* BEOS_THREADS */
-
-
+#endif /* BEOS_THREADS */
#ifndef THREADS
@@ -208,44 +198,37 @@ typedef int _glthread_Mutex;
#define _glthread_UNLOCK_MUTEX(name) (void) name
-#endif /* THREADS */
-
-
+#endif /* THREADS */
/*
* Platform independent thread specific data API.
*/
extern unsigned long
-_glthread_GetID(void);
-
+ _glthread_GetID(void);
extern void
-_glthread_InitTSD(_glthread_TSD *);
-
-
-extern void *
-_glthread_GetTSD(_glthread_TSD *);
+ _glthread_InitTSD(_glthread_TSD *);
+extern void *_glthread_GetTSD(_glthread_TSD *);
extern void
-_glthread_SetTSD(_glthread_TSD *, void *);
+ _glthread_SetTSD(_glthread_TSD *, void *);
#if defined(GLX_USE_TLS)
-extern TLS struct _glapi_table * _glapi_tls_Dispatch;
+extern TLS struct _glapi_table *_glapi_tls_Dispatch;
#define GET_DISPATCH() _glapi_tls_Dispatch
#elif !defined(GL_CALL)
-# if defined(THREADS)
-# define GET_DISPATCH() \
+#if defined(THREADS)
+#define GET_DISPATCH() \
((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \
? _glapi_Dispatch : _glapi_get_dispatch())
-# else
-# define GET_DISPATCH() _glapi_Dispatch
-# endif /* defined(THREADS) */
-#endif /* ndef GL_CALL */
-
+#else
+#define GET_DISPATCH() _glapi_Dispatch
+#endif /* defined(THREADS) */
+#endif /* ndef GL_CALL */
-#endif /* THREADS_H */
+#endif /* THREADS_H */
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index b88d6f663..a74f3fcf7 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -55,15 +55,16 @@
#include "indirect_util.h"
static int
-validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
+validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen,
+ int *err)
{
/*
- ** Check if screen exists.
- */
+ ** Check if screen exists.
+ */
if (screen < 0 || screen >= screenInfo.numScreens) {
- client->errorValue = screen;
- *err = BadValue;
- return FALSE;
+ client->errorValue = screen;
+ *err = BadValue;
+ return FALSE;
}
*pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
@@ -71,16 +72,16 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
}
static int
-validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
- __GLXconfig **config, int *err)
+validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen, XID id,
+ __GLXconfig ** config, int *err)
{
__GLXconfig *m;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next)
- if (m->fbconfigID == id) {
- *config = m;
- return TRUE;
- }
+ if (m->fbconfigID == id) {
+ *config = m;
+ return TRUE;
+ }
client->errorValue = id;
*err = __glXError(GLXBadFBConfig);
@@ -89,16 +90,16 @@ validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
}
static int
-validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
- __GLXconfig **config, int *err)
+validGlxVisual(ClientPtr client, __GLXscreen * pGlxScreen, XID id,
+ __GLXconfig ** config, int *err)
{
int i;
for (i = 0; i < pGlxScreen->numVisuals; i++)
- if (pGlxScreen->visuals[i]->visualID == id) {
- *config = pGlxScreen->visuals[i];
- return TRUE;
- }
+ if (pGlxScreen->visuals[i]->visualID == id) {
+ *config = pGlxScreen->visuals[i];
+ return TRUE;
+ }
client->errorValue = id;
*err = BadValue;
@@ -107,28 +108,28 @@ validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
}
static int
-validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
- DrawablePtr pDraw, int *err)
+validGlxFBConfigForWindow(ClientPtr client, __GLXconfig * config,
+ DrawablePtr pDraw, int *err)
{
ScreenPtr pScreen = pDraw->pScreen;
VisualPtr pVisual = NULL;
XID vid;
int i;
- vid = wVisual((WindowPtr)pDraw);
+ vid = wVisual((WindowPtr) pDraw);
for (i = 0; i < pScreen->numVisuals; i++) {
- if (pScreen->visuals[i].vid == vid) {
- pVisual = &pScreen->visuals[i];
- break;
- }
+ if (pScreen->visuals[i].vid == vid) {
+ pVisual = &pScreen->visuals[i];
+ break;
+ }
}
/* FIXME: What exactly should we check here... */
if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
- !(config->drawableType & GLX_WINDOW_BIT)) {
- client->errorValue = pDraw->id;
- *err = BadMatch;
- return FALSE;
+ !(config->drawableType & GLX_WINDOW_BIT)) {
+ client->errorValue = pDraw->id;
+ *err = BadMatch;
+ return FALSE;
}
return TRUE;
@@ -136,15 +137,15 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
static int
validGlxContext(ClientPtr client, XID id, int access_mode,
- __GLXcontext **context, int *err)
+ __GLXcontext ** context, int *err)
{
*err = dixLookupResourceByType((pointer *) context, id,
- __glXContextRes, client, access_mode);
+ __glXContextRes, client, access_mode);
if (*err != Success || (*context)->idExists == GL_FALSE) {
- client->errorValue = id;
- if (*err == BadValue || *err == Success)
- *err = __glXError(GLXBadContext);
- return FALSE;
+ client->errorValue = id;
+ if (*err == BadValue || *err == Success)
+ *err = __glXError(GLXBadContext);
+ return FALSE;
}
return TRUE;
@@ -152,65 +153,66 @@ validGlxContext(ClientPtr client, XID id, int access_mode,
static int
validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
- __GLXdrawable **drawable, int *err)
+ __GLXdrawable ** drawable, int *err)
{
int rc;
rc = dixLookupResourceByType((pointer *) drawable, id,
- __glXDrawableRes, client, access_mode);
+ __glXDrawableRes, client, access_mode);
if (rc != Success && rc != BadValue) {
- *err = rc;
- client->errorValue = id;
- return FALSE;
+ *err = rc;
+ client->errorValue = id;
+ return FALSE;
}
/* If the ID of the glx drawable we looked up doesn't match the id
* we looked for, it's because we looked it up under the X
* drawable ID (see DoCreateGLXDrawable). */
if (rc == BadValue ||
- (*drawable)->drawId != id ||
- (type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) {
- client->errorValue = id;
- switch (type) {
- case GLX_DRAWABLE_WINDOW:
- *err = __glXError(GLXBadWindow);
- return FALSE;
- case GLX_DRAWABLE_PIXMAP:
- *err = __glXError(GLXBadPixmap);
- return FALSE;
- case GLX_DRAWABLE_PBUFFER:
- *err = __glXError(GLXBadPbuffer);
- return FALSE;
- case GLX_DRAWABLE_ANY:
- *err = __glXError(GLXBadDrawable);
- return FALSE;
- }
+ (*drawable)->drawId != id ||
+ (type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) {
+ client->errorValue = id;
+ switch (type) {
+ case GLX_DRAWABLE_WINDOW:
+ *err = __glXError(GLXBadWindow);
+ return FALSE;
+ case GLX_DRAWABLE_PIXMAP:
+ *err = __glXError(GLXBadPixmap);
+ return FALSE;
+ case GLX_DRAWABLE_PBUFFER:
+ *err = __glXError(GLXBadPbuffer);
+ return FALSE;
+ case GLX_DRAWABLE_ANY:
+ *err = __glXError(GLXBadDrawable);
+ return FALSE;
+ }
}
return TRUE;
}
void
-__glXContextDestroy(__GLXcontext *context)
+__glXContextDestroy(__GLXcontext * context)
{
__glXFlushContextCache();
}
-static void __glXdirectContextDestroy(__GLXcontext *context)
+static void
+__glXdirectContextDestroy(__GLXcontext * context)
{
__glXContextDestroy(context);
free(context);
}
-static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
- __GLXconfig *modes,
- __GLXcontext *shareContext)
+static __GLXcontext *
+__glXdirectContextCreate(__GLXscreen * screen,
+ __GLXconfig * modes, __GLXcontext * shareContext)
{
__GLXcontext *context;
- context = calloc(1, sizeof (__GLXcontext));
+ context = calloc(1, sizeof(__GLXcontext));
if (context == NULL)
- return NULL;
+ return NULL;
context->destroy = __glXdirectContextDestroy;
@@ -232,84 +234,86 @@ void FlushContext(__GLXcontext *cx)
*/
static int
-DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
- GLXContextID shareList, __GLXconfig *config,
- __GLXscreen *pGlxScreen, GLboolean isDirect)
+DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
+ GLXContextID shareList, __GLXconfig * config,
+ __GLXscreen * pGlxScreen, GLboolean isDirect)
{
ClientPtr client = cl->client;
__GLXcontext *glxc, *shareglxc;
int err;
-
+
LEGAL_NEW_RESOURCE(gcId, client);
/*
- ** Find the display list space that we want to share.
- **
- ** NOTE: In a multithreaded X server, we would need to keep a reference
- ** count for each display list so that if one client detroyed a list that
- ** another client was using, the list would not really be freed until it
- ** was no longer in use. Since this sample implementation has no support
- ** for multithreaded servers, we don't do this.
- */
+ ** Find the display list space that we want to share.
+ **
+ ** NOTE: In a multithreaded X server, we would need to keep a reference
+ ** count for each display list so that if one client detroyed a list that
+ ** another client was using, the list would not really be freed until it
+ ** was no longer in use. Since this sample implementation has no support
+ ** for multithreaded servers, we don't do this.
+ */
if (shareList == None) {
- shareglxc = 0;
- } else {
- if (!validGlxContext(client, shareList, DixReadAccess,
- &shareglxc, &err))
- return err;
-
- if (shareglxc->isDirect) {
- /*
- ** NOTE: no support for sharing display lists between direct
- ** contexts, even if they are in the same address space.
- */
+ shareglxc = 0;
+ }
+ else {
+ if (!validGlxContext(client, shareList, DixReadAccess,
+ &shareglxc, &err))
+ return err;
+
+ if (shareglxc->isDirect) {
+ /*
+ ** NOTE: no support for sharing display lists between direct
+ ** contexts, even if they are in the same address space.
+ */
#if 0
/* Disabling this code seems to allow shared display lists
* and texture objects to work. We'll leave it disabled for now.
*/
- client->errorValue = shareList;
- return BadMatch;
+ client->errorValue = shareList;
+ return BadMatch;
#endif
- } else {
- /*
- ** Create an indirect context regardless of what the client asked
- ** for; this way we can share display list space with shareList.
- */
- isDirect = GL_FALSE;
- }
+ }
+ else {
+ /*
+ ** Create an indirect context regardless of what the client asked
+ ** for; this way we can share display list space with shareList.
+ */
+ isDirect = GL_FALSE;
+ }
}
/*
- ** Allocate memory for the new context
- */
+ ** Allocate memory for the new context
+ */
if (!isDirect)
- glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
+ glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
else
- glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
+ glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
if (!glxc) {
- return BadAlloc;
+ return BadAlloc;
}
/*
- ** Initially, setup the part of the context that could be used by
- ** a GL core that needs windowing information (e.g., Mesa).
- */
+ ** Initially, setup the part of the context that could be used by
+ ** a GL core that needs windowing information (e.g., Mesa).
+ */
glxc->pGlxScreen = pGlxScreen;
glxc->config = config;
/*
- ** Register this context as a resource.
- */
- if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
- (*glxc->destroy)(glxc);
- client->errorValue = gcId;
- return BadAlloc;
- }
-
+ ** Register this context as a resource.
+ */
+ if (!AddResource(gcId, __glXContextRes, (pointer) glxc)) {
+ (*glxc->destroy) (glxc);
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
+
/*
- ** Finally, now that everything is working, setup the rest of the
- ** context.
- */
+ ** Finally, now that everything is working, setup the rest of the
+ ** context.
+ */
glxc->id = gcId;
glxc->share_id = shareList;
glxc->idExists = GL_TRUE;
@@ -322,7 +326,8 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
return Success;
}
-int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CreateContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
@@ -333,15 +338,16 @@ int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
REQUEST_SIZE_MATCH(xGLXCreateContextReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
- return err;
+ return err;
return DoCreateContext(cl, req->context, req->shareList,
- config, pGlxScreen, req->isDirect);
+ config, pGlxScreen, req->isDirect);
}
-int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CreateNewContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
@@ -352,19 +358,20 @@ int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
REQUEST_SIZE_MATCH(xGLXCreateNewContextReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
- return err;
+ return err;
return DoCreateContext(cl, req->context, req->shareList,
- config, pGlxScreen, req->isDirect);
+ config, pGlxScreen, req->isDirect);
}
-int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXCreateContextWithConfigSGIXReq *req =
- (xGLXCreateContextWithConfigSGIXReq *) pc;
+ xGLXCreateContextWithConfigSGIXReq *req =
+ (xGLXCreateContextWithConfigSGIXReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
@@ -372,15 +379,16 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
- return err;
+ return err;
return DoCreateContext(cl, req->context, req->shareList,
- config, pGlxScreen, req->isDirect);
+ config, pGlxScreen, req->isDirect);
}
-int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_DestroyContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
@@ -390,8 +398,8 @@ int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
if (!validGlxContext(cl->client, req->context, DixDestroyAccess,
- &glxc, &err))
- return err;
+ &glxc, &err))
+ return err;
glxc->idExists = GL_FALSE;
if (!glxc->isCurrent)
@@ -409,11 +417,12 @@ int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
* way to destruction. Notice that DoMakeCurrent calls validGlxContext
* for new contexts but __glXLookupContextByTag for previous contexts.
*/
-__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
+__GLXcontext *
+__glXLookupContextByTag(__GLXclientState * cl, GLXContextTag tag)
{
__GLXcontext *ret;
- if (dixLookupResourceByType((void **)&ret, tag, __glXContextRes,
+ if (dixLookupResourceByType((void **) &ret, tag, __glXContextRes,
cl->client, DixUseAccess) == Success)
return ret;
@@ -422,24 +431,26 @@ __GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
/*****************************************************************************/
-static void StopUsingContext(__GLXcontext *glxc)
+static void
+StopUsingContext(__GLXcontext * glxc)
{
if (glxc) {
- if (glxc == __glXLastContext) {
- /* Tell server GL library */
- __glXLastContext = 0;
- }
- glxc->isCurrent = GL_FALSE;
- if (!glxc->idExists) {
+ if (glxc == __glXLastContext) {
+ /* Tell server GL library */
+ __glXLastContext = 0;
+ }
+ glxc->isCurrent = GL_FALSE;
+ if (!glxc->idExists) {
FreeResourceByType(glxc->id, __glXContextRes, FALSE);
- }
+ }
}
}
-static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
+static void
+StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc)
{
glxc->isCurrent = GL_TRUE;
- __glXLastContext = glxc;
+ __glXLastContext = glxc;
}
/**
@@ -449,29 +460,29 @@ static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
* sure it's an X window and create a GLX drawable one the fly.
*/
static __GLXdrawable *
-__glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
- int *error)
+__glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
+ int *error)
{
DrawablePtr pDraw;
__GLXdrawable *pGlxDraw;
int rc;
if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
- DixWriteAccess, &pGlxDraw, &rc)) {
- if (glxc != NULL && pGlxDraw->config != glxc->config) {
- client->errorValue = drawId;
- *error = BadMatch;
- return NULL;
- }
+ DixWriteAccess, &pGlxDraw, &rc)) {
+ if (glxc != NULL && pGlxDraw->config != glxc->config) {
+ client->errorValue = drawId;
+ *error = BadMatch;
+ return NULL;
+ }
- return pGlxDraw;
+ return pGlxDraw;
}
/* No active context and an unknown drawable, bail. */
if (glxc == NULL) {
- client->errorValue = drawId;
- *error = BadMatch;
- return NULL;
+ client->errorValue = drawId;
+ *error = BadMatch;
+ return NULL;
}
/* The drawId wasn't a GLX drawable. Make sure it's a window and
@@ -481,36 +492,36 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
- client->errorValue = drawId;
- *error = __glXError(GLXBadDrawable);
- return NULL;
+ client->errorValue = drawId;
+ *error = __glXError(GLXBadDrawable);
+ return NULL;
}
if (!glxc || pDraw->pScreen != glxc->pGlxScreen->pScreen) {
- client->errorValue = pDraw->pScreen->myNum;
- *error = BadMatch;
- return NULL;
+ client->errorValue = pDraw->pScreen->myNum;
+ *error = BadMatch;
+ return NULL;
}
if (!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
- return NULL;
+ return NULL;
pGlxDraw = glxc->pGlxScreen->createDrawable(client, glxc->pGlxScreen,
- pDraw, drawId,
- GLX_DRAWABLE_WINDOW,
- drawId, glxc->config);
- if (!pGlxDraw)
- {
- client->errorValue = drawId;
- *error = BadMatch;
- return NULL;
- }
+ pDraw, drawId,
+ GLX_DRAWABLE_WINDOW,
+ drawId, glxc->config);
+ if (!pGlxDraw)
+ {
+ client->errorValue = drawId;
+ *error = BadMatch;
+ return NULL;
+ }
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
- pGlxDraw->destroy (pGlxDraw);
- *error = BadAlloc;
- return NULL;
+ pGlxDraw->destroy(pGlxDraw);
+ *error = BadAlloc;
+ return NULL;
}
return pGlxDraw;
@@ -522,9 +533,9 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
*/
static int
-DoMakeCurrent(__GLXclientState *cl,
- GLXDrawable drawId, GLXDrawable readId,
- GLXContextID contextId, GLXContextTag tag)
+DoMakeCurrent(__GLXclientState * cl,
+ GLXDrawable drawId, GLXDrawable readId,
+ GLXContextID contextId, GLXContextTag tag)
{
ClientPtr client = cl->client;
xGLXMakeCurrentReply reply;
@@ -532,121 +543,123 @@ DoMakeCurrent(__GLXclientState *cl,
__GLXdrawable *drawPriv = NULL;
__GLXdrawable *readPriv = NULL;
int error;
- GLuint mask;
+ GLuint mask;
/*
- ** If one is None and the other isn't, it's a bad match.
- */
+ ** If one is None and the other isn't, it's a bad match.
+ */
- mask = (drawId == None) ? (1 << 0) : 0;
- mask |= (readId == None) ? (1 << 1) : 0;
+ mask = (drawId == None) ? (1 << 0) : 0;
+ mask |= (readId == None) ? (1 << 1) : 0;
mask |= (contextId == None) ? (1 << 2) : 0;
- if ( (mask != 0x00) && (mask != 0x07) ) {
- return BadMatch;
+ if ((mask != 0x00) && (mask != 0x07)) {
+ return BadMatch;
}
-
+
/*
- ** Lookup old context. If we have one, it must be in a usable state.
- */
+ ** Lookup old context. If we have one, it must be in a usable state.
+ */
if (tag != 0) {
- prevglxc = __glXLookupContextByTag(cl, tag);
- if (!prevglxc) {
- /*
- ** Tag for previous context is invalid.
- */
- return __glXError(GLXBadContextTag);
- }
- if (prevglxc->renderMode != GL_RENDER) {
- /* Oops. Not in render mode render. */
- client->errorValue = prevglxc->id;
- return __glXError(GLXBadContextState);
- }
- } else {
- prevglxc = 0;
+ prevglxc = __glXLookupContextByTag(cl, tag);
+ if (!prevglxc) {
+ /*
+ ** Tag for previous context is invalid.
+ */
+ return __glXError(GLXBadContextTag);
+ }
+ if (prevglxc->renderMode != GL_RENDER) {
+ /* Oops. Not in render mode render. */
+ client->errorValue = prevglxc->id;
+ return __glXError(GLXBadContextState);
+ }
+ }
+ else {
+ prevglxc = 0;
}
/*
- ** Lookup new context. It must not be current for someone else.
- */
+ ** Lookup new context. It must not be current for someone else.
+ */
if (contextId != None) {
- int status;
+ int status;
- if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
- return error;
- if ((glxc != prevglxc) && glxc->isCurrent) {
- /* Context is current to somebody else */
- return BadAccess;
- }
+ if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
+ return error;
+ if ((glxc != prevglxc) && glxc->isCurrent) {
+ /* Context is current to somebody else */
+ return BadAccess;
+ }
- assert( drawId != None );
- assert( readId != None );
+ assert(drawId != None);
+ assert(readId != None);
- drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
- if (drawPriv == NULL)
- return status;
+ drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
+ if (drawPriv == NULL)
+ return status;
- readPriv = __glXGetDrawable(glxc, readId, client, &status);
- if (readPriv == NULL)
- return status;
+ readPriv = __glXGetDrawable(glxc, readId, client, &status);
+ if (readPriv == NULL)
+ return status;
- } else {
- /* Switching to no context. Ignore new drawable. */
- glxc = 0;
- drawPriv = 0;
- readPriv = 0;
}
-
+ else {
+ /* Switching to no context. Ignore new drawable. */
+ glxc = 0;
+ drawPriv = 0;
+ readPriv = 0;
+ }
if (prevglxc) {
- /*
- ** Flush the previous context if needed.
- */
- if (prevglxc->hasUnflushedCommands) {
- if (__glXForceCurrent(cl, tag, (int *)&error)) {
- CALL_Flush( GET_DISPATCH(), () );
- prevglxc->hasUnflushedCommands = GL_FALSE;
- } else {
- return error;
- }
- }
-
- /*
- ** Make the previous context not current.
- */
- if (!(*prevglxc->loseCurrent)(prevglxc)) {
- return __glXError(GLXBadContext);
- }
- __glXFlushContextCache();
- if (!prevglxc->isDirect) {
- prevglxc->drawPriv = NULL;
- prevglxc->readPriv = NULL;
- }
- }
-
+ /*
+ ** Flush the previous context if needed.
+ */
+ if (prevglxc->hasUnflushedCommands) {
+ if (__glXForceCurrent(cl, tag, (int *) &error)) {
+ CALL_Flush(GET_DISPATCH(), ());
+ prevglxc->hasUnflushedCommands = GL_FALSE;
+ }
+ else {
+ return error;
+ }
+ }
+
+ /*
+ ** Make the previous context not current.
+ */
+ if (!(*prevglxc->loseCurrent) (prevglxc)) {
+ return __glXError(GLXBadContext);
+ }
+ __glXFlushContextCache();
+ if (!prevglxc->isDirect) {
+ prevglxc->drawPriv = NULL;
+ prevglxc->readPriv = NULL;
+ }
+ }
if ((glxc != 0) && !glxc->isDirect) {
- glxc->drawPriv = drawPriv;
- glxc->readPriv = readPriv;
+ glxc->drawPriv = drawPriv;
+ glxc->readPriv = readPriv;
- /* make the context current */
- if (!(*glxc->makeCurrent)(glxc)) {
- glxc->drawPriv = NULL;
- glxc->readPriv = NULL;
- return __glXError(GLXBadContext);
- }
+ /* make the context current */
+ if (!(*glxc->makeCurrent) (glxc)) {
+ glxc->drawPriv = NULL;
+ glxc->readPriv = NULL;
+ return __glXError(GLXBadContext);
+ }
- glxc->isCurrent = GL_TRUE;
+ glxc->isCurrent = GL_TRUE;
}
StopUsingContext(prevglxc);
if (glxc) {
- StartUsingContext(cl, glxc);
- reply.contextTag = glxc->id;
- } else {
- reply.contextTag = 0;
+ StartUsingContext(cl, glxc);
+ reply.contextTag = glxc->id;
+ }
+ else {
+ reply.contextTag = 0;
}
reply.length = 0;
@@ -654,47 +667,52 @@ DoMakeCurrent(__GLXclientState *cl,
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __glXSwapMakeCurrentReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)&reply);
+ __glXSwapMakeCurrentReply(client, &reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXMakeCurrentReply, (char *) &reply);
}
return Success;
}
-int __glXDisp_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_MakeCurrent(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
REQUEST_SIZE_MATCH(xGLXMakeCurrentReq);
- return DoMakeCurrent( cl, req->drawable, req->drawable,
- req->context, req->oldContextTag );
+ return DoMakeCurrent(cl, req->drawable, req->drawable,
+ req->context, req->oldContextTag);
}
-int __glXDisp_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_MakeContextCurrent(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq);
- return DoMakeCurrent( cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag );
+ return DoMakeCurrent(cl, req->drawable, req->readdrawable,
+ req->context, req->oldContextTag);
}
-int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_MakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq);
- return DoMakeCurrent( cl, req->drawable, req->readable,
- req->context, req->oldContextTag );
+ return DoMakeCurrent(cl, req->drawable, req->readable,
+ req->context, req->oldContextTag);
}
-int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
@@ -705,7 +723,7 @@ int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc)
REQUEST_SIZE_MATCH(xGLXIsDirectReq);
if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
- return err;
+ return err;
reply.isDirect = glxc->isDirect;
reply.length = 0;
@@ -713,15 +731,17 @@ int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __glXSwapIsDirectReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
+ __glXSwapIsDirectReply(client, &reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply);
}
return Success;
}
-int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
@@ -732,14 +752,14 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
major = req->majorVersion;
minor = req->minorVersion;
- (void)major;
- (void)minor;
+ (void) major;
+ (void) minor;
/*
- ** Server should take into consideration the version numbers sent by the
- ** client if it wants to work with older clients; however, in this
- ** implementation the server just returns its version number.
- */
+ ** Server should take into consideration the version numbers sent by the
+ ** client if it wants to work with older clients; however, in this
+ ** implementation the server just returns its version number.
+ */
reply.majorVersion = glxMajorVersion;
reply.minorVersion = glxMinorVersion;
reply.length = 0;
@@ -747,17 +767,19 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __glXSwapQueryVersionReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
+ __glXSwapQueryVersionReply(client, &reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply);
}
return Success;
}
-int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_WaitGL(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
+ xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
GLXContextTag tag;
__GLXcontext *glxc = NULL;
int error;
@@ -766,26 +788,27 @@ int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc)
tag = req->contextTag;
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc)
- return __glXError(GLXBadContextTag);
-
- if (!__glXForceCurrent(cl, req->contextTag, &error))
- return error;
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc)
+ return __glXError(GLXBadContextTag);
+
+ if (!__glXForceCurrent(cl, req->contextTag, &error))
+ return error;
- CALL_Finish( GET_DISPATCH(), () );
+ CALL_Finish(GET_DISPATCH(), ());
}
if (glxc && glxc->drawPriv->waitGL)
- (*glxc->drawPriv->waitGL)(glxc->drawPriv);
+ (*glxc->drawPriv->waitGL) (glxc->drawPriv);
return Success;
}
-int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_WaitX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
+ xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
GLXContextTag tag;
__GLXcontext *glxc = NULL;
int error;
@@ -794,21 +817,22 @@ int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc)
tag = req->contextTag;
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc)
- return __glXError(GLXBadContextTag);
-
- if (!__glXForceCurrent(cl, req->contextTag, &error))
- return error;
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc)
+ return __glXError(GLXBadContextTag);
+
+ if (!__glXForceCurrent(cl, req->contextTag, &error))
+ return error;
}
if (glxc && glxc->drawPriv->waitX)
- (*glxc->drawPriv->waitX)(glxc->drawPriv);
+ (*glxc->drawPriv->waitX) (glxc->drawPriv);
return Success;
}
-int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
@@ -826,62 +850,62 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc)
tag = req->contextTag;
mask = req->mask;
if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error))
- return error;
+ return error;
if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error))
- return error;
+ return error;
/*
- ** They must be in the same address space, and same screen.
- ** NOTE: no support for direct rendering contexts here.
- */
- if (src->isDirect || dst->isDirect ||
- (src->pGlxScreen != dst->pGlxScreen)) {
- client->errorValue = source;
- return BadMatch;
+ ** They must be in the same address space, and same screen.
+ ** NOTE: no support for direct rendering contexts here.
+ */
+ if (src->isDirect || dst->isDirect || (src->pGlxScreen != dst->pGlxScreen)) {
+ client->errorValue = source;
+ return BadMatch;
}
/*
- ** The destination context must not be current for any client.
- */
+ ** The destination context must not be current for any client.
+ */
if (dst->isCurrent) {
- client->errorValue = dest;
- return BadAccess;
+ client->errorValue = dest;
+ return BadAccess;
}
if (tag) {
- __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
-
- if (!tagcx) {
- return __glXError(GLXBadContextTag);
- }
- if (tagcx != src) {
- /*
- ** This would be caused by a faulty implementation of the client
- ** library.
- */
- return BadMatch;
- }
- /*
- ** In this case, glXCopyContext is in both GL and X streams, in terms
- ** of sequentiality.
- */
- if (__glXForceCurrent(cl, tag, &error)) {
- /*
- ** Do whatever is needed to make sure that all preceding requests
- ** in both streams are completed before the copy is executed.
- */
- CALL_Finish( GET_DISPATCH(), () );
- tagcx->hasUnflushedCommands = GL_FALSE;
- } else {
- return error;
- }
+ __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
+
+ if (!tagcx) {
+ return __glXError(GLXBadContextTag);
+ }
+ if (tagcx != src) {
+ /*
+ ** This would be caused by a faulty implementation of the client
+ ** library.
+ */
+ return BadMatch;
+ }
+ /*
+ ** In this case, glXCopyContext is in both GL and X streams, in terms
+ ** of sequentiality.
+ */
+ if (__glXForceCurrent(cl, tag, &error)) {
+ /*
+ ** Do whatever is needed to make sure that all preceding requests
+ ** in both streams are completed before the copy is executed.
+ */
+ CALL_Finish(GET_DISPATCH(), ());
+ tagcx->hasUnflushedCommands = GL_FALSE;
+ }
+ else {
+ return error;
+ }
}
/*
- ** Issue copy. The only reason for failure is a bad mask.
- */
- if (!(*dst->copy)(dst, src, mask)) {
- client->errorValue = mask;
- return BadValue;
+ ** Issue copy. The only reason for failure is a bad mask.
+ */
+ if (!(*dst->copy) (dst, src, mask)) {
+ client->errorValue = mask;
+ return BadValue;
}
return Success;
}
@@ -895,7 +919,8 @@ enum {
GLX_VIS_CONFIG_TOTAL = GLX_VIS_CONFIG_UNPAIRED + GLX_VIS_CONFIG_PAIRED
};
-int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
{
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
ClientPtr client = cl->client;
@@ -904,85 +929,87 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
__GLXconfig *modes;
CARD32 buf[GLX_VIS_CONFIG_TOTAL];
int p, i, err;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
reply.numVisuals = pGlxScreen->numVisuals;
reply.numProps = GLX_VIS_CONFIG_TOTAL;
- reply.length = (reply.numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2;
+ reply.length =
+ (reply.numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numVisuals);
- __GLX_SWAP_INT(&reply.numProps);
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numVisuals);
+ __GLX_SWAP_INT(&reply.numProps);
}
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
for (i = 0; i < pGlxScreen->numVisuals; i++) {
- modes = pGlxScreen->visuals[i];
-
- p = 0;
- buf[p++] = modes->visualID;
- buf[p++] = glxConvertToXVisualType( modes->visualType );
- buf[p++] = (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE;
-
- buf[p++] = modes->redBits;
- buf[p++] = modes->greenBits;
- buf[p++] = modes->blueBits;
- buf[p++] = modes->alphaBits;
- buf[p++] = modes->accumRedBits;
- buf[p++] = modes->accumGreenBits;
- buf[p++] = modes->accumBlueBits;
- buf[p++] = modes->accumAlphaBits;
-
- buf[p++] = modes->doubleBufferMode;
- buf[p++] = modes->stereoMode;
-
- buf[p++] = modes->rgbBits;
- buf[p++] = modes->depthBits;
- buf[p++] = modes->stencilBits;
- buf[p++] = modes->numAuxBuffers;
- buf[p++] = modes->level;
-
- assert(p == GLX_VIS_CONFIG_UNPAIRED);
- /*
- ** Add token/value pairs for extensions.
- */
- buf[p++] = GLX_VISUAL_CAVEAT_EXT;
- buf[p++] = modes->visualRating;
- buf[p++] = GLX_TRANSPARENT_TYPE;
- buf[p++] = modes->transparentPixel;
- buf[p++] = GLX_TRANSPARENT_RED_VALUE;
- buf[p++] = modes->transparentRed;
- buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
- buf[p++] = modes->transparentGreen;
- buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
- buf[p++] = modes->transparentBlue;
- buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
- buf[p++] = modes->transparentAlpha;
- buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
- buf[p++] = modes->transparentIndex;
- buf[p++] = GLX_SAMPLES_SGIS;
- buf[p++] = modes->samples;
- buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
- buf[p++] = modes->sampleBuffers;
- buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
- buf[p++] = 0;
-
- assert(p == GLX_VIS_CONFIG_TOTAL);
- if (client->swapped) {
- __GLX_SWAP_INT_ARRAY(buf, p);
- }
- WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *)buf);
+ modes = pGlxScreen->visuals[i];
+
+ p = 0;
+ buf[p++] = modes->visualID;
+ buf[p++] = glxConvertToXVisualType(modes->visualType);
+ buf[p++] = (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE;
+
+ buf[p++] = modes->redBits;
+ buf[p++] = modes->greenBits;
+ buf[p++] = modes->blueBits;
+ buf[p++] = modes->alphaBits;
+ buf[p++] = modes->accumRedBits;
+ buf[p++] = modes->accumGreenBits;
+ buf[p++] = modes->accumBlueBits;
+ buf[p++] = modes->accumAlphaBits;
+
+ buf[p++] = modes->doubleBufferMode;
+ buf[p++] = modes->stereoMode;
+
+ buf[p++] = modes->rgbBits;
+ buf[p++] = modes->depthBits;
+ buf[p++] = modes->stencilBits;
+ buf[p++] = modes->numAuxBuffers;
+ buf[p++] = modes->level;
+
+ assert(p == GLX_VIS_CONFIG_UNPAIRED);
+ /*
+ ** Add token/value pairs for extensions.
+ */
+ buf[p++] = GLX_VISUAL_CAVEAT_EXT;
+ buf[p++] = modes->visualRating;
+ buf[p++] = GLX_TRANSPARENT_TYPE;
+ buf[p++] = modes->transparentPixel;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE;
+ buf[p++] = modes->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
+ buf[p++] = modes->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
+ buf[p++] = modes->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
+ buf[p++] = modes->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
+ buf[p++] = modes->transparentIndex;
+ buf[p++] = GLX_SAMPLES_SGIS;
+ buf[p++] = modes->samples;
+ buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+ buf[p++] = modes->sampleBuffers;
+ buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
+ buf[p++] = 0;
+
+ assert(p == GLX_VIS_CONFIG_TOTAL);
+ if (client->swapped) {
+ __GLX_SWAP_INT_ARRAY(buf, p);
+ }
+ WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *) buf);
}
return Success;
}
@@ -1000,7 +1027,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
*/
static int
-DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
+DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
{
ClientPtr client = cl->client;
xGLXGetFBConfigsReply reply;
@@ -1008,11 +1035,12 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH];
int p, err;
__GLXconfig *modes;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
- return err;
+ return err;
reply.numFBConfigs = pGlxScreen->numFBConfigs;
reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
@@ -1021,92 +1049,96 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numFBConfigs);
- __GLX_SWAP_INT(&reply.numAttribs);
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numFBConfigs);
+ __GLX_SWAP_INT(&reply.numAttribs);
}
- WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
+ WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *) &reply);
for (modes = pGlxScreen->fbconfigs; modes != NULL; modes = modes->next) {
- p = 0;
+ p = 0;
#define WRITE_PAIR(tag,value) \
do { buf[p++] = tag ; buf[p++] = value ; } while( 0 )
- WRITE_PAIR( GLX_VISUAL_ID, modes->visualID );
- WRITE_PAIR( GLX_FBCONFIG_ID, modes->fbconfigID );
- WRITE_PAIR( GLX_X_RENDERABLE, GL_TRUE );
-
- WRITE_PAIR( GLX_RGBA,
- (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE );
- WRITE_PAIR( GLX_RENDER_TYPE, modes->renderType );
- WRITE_PAIR( GLX_DOUBLEBUFFER, modes->doubleBufferMode );
- WRITE_PAIR( GLX_STEREO, modes->stereoMode );
-
- WRITE_PAIR( GLX_BUFFER_SIZE, modes->rgbBits );
- WRITE_PAIR( GLX_LEVEL, modes->level );
- WRITE_PAIR( GLX_AUX_BUFFERS, modes->numAuxBuffers );
- WRITE_PAIR( GLX_RED_SIZE, modes->redBits );
- WRITE_PAIR( GLX_GREEN_SIZE, modes->greenBits );
- WRITE_PAIR( GLX_BLUE_SIZE, modes->blueBits );
- WRITE_PAIR( GLX_ALPHA_SIZE, modes->alphaBits );
- WRITE_PAIR( GLX_ACCUM_RED_SIZE, modes->accumRedBits );
- WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits );
- WRITE_PAIR( GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits );
- WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits );
- WRITE_PAIR( GLX_DEPTH_SIZE, modes->depthBits );
- WRITE_PAIR( GLX_STENCIL_SIZE, modes->stencilBits );
- WRITE_PAIR( GLX_X_VISUAL_TYPE, modes->visualType );
- WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating );
- WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel );
- WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed );
- WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen );
- WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue );
- WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
- WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
- WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
- WRITE_PAIR( GLX_SAMPLES_SGIS, modes->samples );
- WRITE_PAIR( GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers );
- /* GLX_VISUAL_SELECT_GROUP_SGIX ? */
- WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
- WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
- WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );
- WRITE_PAIR( GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture );
- WRITE_PAIR( GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets );
-
- if (client->swapped) {
- __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
- }
- WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH,
- (char *)buf);
+ WRITE_PAIR(GLX_VISUAL_ID, modes->visualID);
+ WRITE_PAIR(GLX_FBCONFIG_ID, modes->fbconfigID);
+ WRITE_PAIR(GLX_X_RENDERABLE, GL_TRUE);
+
+ WRITE_PAIR(GLX_RGBA,
+ (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE);
+ WRITE_PAIR(GLX_RENDER_TYPE, modes->renderType);
+ WRITE_PAIR(GLX_DOUBLEBUFFER, modes->doubleBufferMode);
+ WRITE_PAIR(GLX_STEREO, modes->stereoMode);
+
+ WRITE_PAIR(GLX_BUFFER_SIZE, modes->rgbBits);
+ WRITE_PAIR(GLX_LEVEL, modes->level);
+ WRITE_PAIR(GLX_AUX_BUFFERS, modes->numAuxBuffers);
+ WRITE_PAIR(GLX_RED_SIZE, modes->redBits);
+ WRITE_PAIR(GLX_GREEN_SIZE, modes->greenBits);
+ WRITE_PAIR(GLX_BLUE_SIZE, modes->blueBits);
+ WRITE_PAIR(GLX_ALPHA_SIZE, modes->alphaBits);
+ WRITE_PAIR(GLX_ACCUM_RED_SIZE, modes->accumRedBits);
+ WRITE_PAIR(GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits);
+ WRITE_PAIR(GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits);
+ WRITE_PAIR(GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits);
+ WRITE_PAIR(GLX_DEPTH_SIZE, modes->depthBits);
+ WRITE_PAIR(GLX_STENCIL_SIZE, modes->stencilBits);
+ WRITE_PAIR(GLX_X_VISUAL_TYPE, modes->visualType);
+ WRITE_PAIR(GLX_CONFIG_CAVEAT, modes->visualRating);
+ WRITE_PAIR(GLX_TRANSPARENT_TYPE, modes->transparentPixel);
+ WRITE_PAIR(GLX_TRANSPARENT_RED_VALUE, modes->transparentRed);
+ WRITE_PAIR(GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen);
+ WRITE_PAIR(GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue);
+ WRITE_PAIR(GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha);
+ WRITE_PAIR(GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex);
+ WRITE_PAIR(GLX_SWAP_METHOD_OML, modes->swapMethod);
+ WRITE_PAIR(GLX_SAMPLES_SGIS, modes->samples);
+ WRITE_PAIR(GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers);
+ /* GLX_VISUAL_SELECT_GROUP_SGIX ? */
+ WRITE_PAIR(GLX_DRAWABLE_TYPE, modes->drawableType);
+ WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb);
+ WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba);
+ WRITE_PAIR(GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture);
+ WRITE_PAIR(GLX_BIND_TO_TEXTURE_TARGETS_EXT,
+ modes->bindToTextureTargets);
+
+ if (client->swapped) {
+ __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
+ }
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH,
+ (char *) buf);
}
return Success;
}
-
-int __glXDisp_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_GetFBConfigs(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+
REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq);
return DoGetFBConfigs(cl, req->screen);
}
-int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_GetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
+
/* work around mesa bug, don't use REQUEST_SIZE_MATCH */
REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq);
return DoGetFBConfigs(cl, req->screen);
}
GLboolean
-__glXDrawableInit(__GLXdrawable *drawable,
- __GLXscreen *screen, DrawablePtr pDraw, int type,
- XID drawId, __GLXconfig *config)
+__glXDrawableInit(__GLXdrawable * drawable,
+ __GLXscreen * screen, DrawablePtr pDraw, int type,
+ XID drawId, __GLXconfig * config)
{
drawable->pDraw = pDraw;
drawable->type = type;
@@ -1118,29 +1150,29 @@ __glXDrawableInit(__GLXdrawable *drawable,
}
void
-__glXDrawableRelease(__GLXdrawable *drawable)
+__glXDrawableRelease(__GLXdrawable * drawable)
{
}
-static int
-DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen,
- __GLXconfig *config, DrawablePtr pDraw, XID drawableId,
- XID glxDrawableId, int type)
+static int
+DoCreateGLXDrawable(ClientPtr client, __GLXscreen * pGlxScreen,
+ __GLXconfig * config, DrawablePtr pDraw, XID drawableId,
+ XID glxDrawableId, int type)
{
__GLXdrawable *pGlxDraw;
if (pGlxScreen->pScreen != pDraw->pScreen)
- return BadMatch;
+ return BadMatch;
pGlxDraw = pGlxScreen->createDrawable(client, pGlxScreen, pDraw,
- drawableId, type,
- glxDrawableId, config);
+ drawableId, type,
+ glxDrawableId, config);
if (pGlxDraw == NULL)
- return BadAlloc;
+ return BadAlloc;
if (!AddResource(glxDrawableId, __glXDrawableRes, pGlxDraw)) {
- pGlxDraw->destroy (pGlxDraw);
- return BadAlloc;
+ pGlxDraw->destroy(pGlxDraw);
+ return BadAlloc;
}
/*
@@ -1148,17 +1180,17 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen,
* so we get called regardless of destruction order.
*/
if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW &&
- !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
- pGlxDraw->destroy (pGlxDraw);
- return BadAlloc;
+ !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
+ pGlxDraw->destroy(pGlxDraw);
+ return BadAlloc;
}
return Success;
}
static int
-DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
- XID drawableId, XID glxDrawableId)
+DoCreateGLXPixmap(ClientPtr client, __GLXscreen * pGlxScreen,
+ __GLXconfig * config, XID drawableId, XID glxDrawableId)
{
DrawablePtr pDraw;
int err;
@@ -1167,25 +1199,25 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess);
if (err != Success) {
- client->errorValue = drawableId;
- return err;
+ client->errorValue = drawableId;
+ return err;
}
if (pDraw->type != DRAWABLE_PIXMAP) {
- client->errorValue = drawableId;
- return BadPixmap;
+ client->errorValue = drawableId;
+ return BadPixmap;
}
err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId,
- glxDrawableId, GLX_DRAWABLE_PIXMAP);
+ glxDrawableId, GLX_DRAWABLE_PIXMAP);
- ((PixmapPtr)pDraw)->refcnt++;
+ ((PixmapPtr) pDraw)->refcnt++;
return err;
}
static void
determineTextureTarget(ClientPtr client, XID glxDrawableID,
- CARD32 *attribs, CARD32 numAttribs)
+ CARD32 *attribs, CARD32 numAttribs)
{
GLenum target = 0;
GLenum format = 0;
@@ -1193,40 +1225,41 @@ determineTextureTarget(ClientPtr client, XID glxDrawableID,
__GLXdrawable *pGlxDraw;
if (!validGlxDrawable(client, glxDrawableID, GLX_DRAWABLE_PIXMAP,
- DixWriteAccess, &pGlxDraw, &err))
- /* We just added it in CreatePixmap, so we should never get here. */
- return;
+ DixWriteAccess, &pGlxDraw, &err))
+ /* We just added it in CreatePixmap, so we should never get here. */
+ return;
for (i = 0; i < numAttribs; i++) {
- if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
- switch (attribs[2 * i + 1]) {
- case GLX_TEXTURE_2D_EXT:
- target = GL_TEXTURE_2D;
- break;
- case GLX_TEXTURE_RECTANGLE_EXT:
- target = GL_TEXTURE_RECTANGLE_ARB;
- break;
- }
- }
-
- if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
- format = attribs[2 * i + 1];
- }
-
+ if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
+ switch (attribs[2 * i + 1]) {
+ case GLX_TEXTURE_2D_EXT:
+ target = GL_TEXTURE_2D;
+ break;
+ case GLX_TEXTURE_RECTANGLE_EXT:
+ target = GL_TEXTURE_RECTANGLE_ARB;
+ break;
+ }
+ }
+
+ if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
+ format = attribs[2 * i + 1];
+ }
+
if (!target) {
- int w = pGlxDraw->pDraw->width, h = pGlxDraw->pDraw->height;
-
- if (h & (h - 1) || w & (w - 1))
- target = GL_TEXTURE_RECTANGLE_ARB;
- else
- target = GL_TEXTURE_2D;
+ int w = pGlxDraw->pDraw->width, h = pGlxDraw->pDraw->height;
+
+ if (h & (h - 1) || w & (w - 1))
+ target = GL_TEXTURE_RECTANGLE_ARB;
+ else
+ target = GL_TEXTURE_2D;
}
pGlxDraw->target = target;
pGlxDraw->format = format;
}
-int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CreateGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
@@ -1237,15 +1270,16 @@ int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
- return err;
+ return err;
return DoCreateGLXPixmap(cl->client, pGlxScreen, config,
- req->pixmap, req->glxpixmap);
+ req->pixmap, req->glxpixmap);
}
-int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CreatePixmap(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
@@ -1255,32 +1289,33 @@ int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq);
if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
+ client->errorValue = req->numAttribs;
+ return BadValue;
}
REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
- return err;
+ return err;
err = DoCreateGLXPixmap(cl->client, pGlxScreen, config,
- req->pixmap, req->glxpixmap);
+ req->pixmap, req->glxpixmap);
if (err != Success)
- return err;
+ return err;
determineTextureTarget(cl->client, req->glxpixmap,
- (CARD32*) (req + 1), req->numAttribs);
+ (CARD32 *) (req + 1), req->numAttribs);
return Success;
}
-int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXCreateGLXPixmapWithConfigSGIXReq *req =
- (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
+ xGLXCreateGLXPixmapWithConfigSGIXReq *req =
+ (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
@@ -1288,30 +1323,31 @@ int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq);
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
- return err;
+ return err;
return DoCreateGLXPixmap(cl->client, pGlxScreen,
- config, req->pixmap, req->glxpixmap);
+ config, req->pixmap, req->glxpixmap);
}
-
-static int DoDestroyDrawable(__GLXclientState *cl, XID glxdrawable, int type)
+static int
+DoDestroyDrawable(__GLXclientState * cl, XID glxdrawable, int type)
{
__GLXdrawable *pGlxDraw;
int err;
if (!validGlxDrawable(cl->client, glxdrawable, type,
- DixDestroyAccess, &pGlxDraw, &err))
- return err;
+ DixDestroyAccess, &pGlxDraw, &err))
+ return err;
FreeResource(glxdrawable, FALSE);
return Success;
}
-int __glXDisp_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_DestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
@@ -1321,7 +1357,8 @@ int __glXDisp_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
}
-int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_DestroyPixmap(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
@@ -1335,23 +1372,24 @@ int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
static int
DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
- int width, int height, XID glxDrawableId)
+ int width, int height, XID glxDrawableId)
{
- __GLXconfig *config;
- __GLXscreen *pGlxScreen;
- PixmapPtr pPixmap;
- int err;
+ __GLXconfig *config;
+ __GLXscreen *pGlxScreen;
+ PixmapPtr pPixmap;
+ int err;
LEGAL_NEW_RESOURCE(glxDrawableId, client);
if (!validGlxScreen(client, screenNum, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err))
- return err;
+ return err;
__glXenterServer(GL_FALSE);
pPixmap = (*pGlxScreen->pScreen->CreatePixmap) (pGlxScreen->pScreen,
- width, height, config->rgbBits, 0);
+ width, height,
+ config->rgbBits, 0);
__glXleaveServer(GL_FALSE);
/* Assign the pixmap the same id as the pbuffer and add it as a
@@ -1359,24 +1397,25 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
* pbuffer is destroyed. */
pPixmap->drawable.id = glxDrawableId;
if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap))
- return BadAlloc;
+ return BadAlloc;
return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,
- glxDrawableId, glxDrawableId,
- GLX_DRAWABLE_PBUFFER);
+ glxDrawableId, glxDrawableId,
+ GLX_DRAWABLE_PBUFFER);
}
-int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CreatePbuffer(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
- CARD32 *attrs;
- int width, height, i;
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
+ CARD32 *attrs;
+ int width, height, i;
REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq);
if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
+ client->errorValue = req->numAttribs;
+ return BadValue;
}
REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
@@ -1385,25 +1424,26 @@ int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
height = 0;
for (i = 0; i < req->numAttribs; i++) {
- switch (attrs[i * 2]) {
- case GLX_PBUFFER_WIDTH:
- width = attrs[i * 2 + 1];
- break;
- case GLX_PBUFFER_HEIGHT:
- height = attrs[i * 2 + 1];
- break;
- case GLX_LARGEST_PBUFFER:
- case GLX_PRESERVED_CONTENTS:
- /* FIXME: huh... */
- break;
- }
+ switch (attrs[i * 2]) {
+ case GLX_PBUFFER_WIDTH:
+ width = attrs[i * 2 + 1];
+ break;
+ case GLX_PBUFFER_HEIGHT:
+ height = attrs[i * 2 + 1];
+ break;
+ case GLX_LARGEST_PBUFFER:
+ case GLX_PRESERVED_CONTENTS:
+ /* FIXME: huh... */
+ break;
+ }
}
return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
- width, height, req->pbuffer);
+ width, height, req->pbuffer);
}
-int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CreateGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
@@ -1411,10 +1451,11 @@ int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
- req->width, req->height, req->pbuffer);
+ req->width, req->height, req->pbuffer);
}
-int __glXDisp_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_DestroyPbuffer(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
@@ -1424,7 +1465,8 @@ int __glXDisp_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
}
-int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_DestroyGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
@@ -1436,107 +1478,113 @@ int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
static int
DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable,
- int numAttribs, CARD32 *attribs)
+ int numAttribs, CARD32 *attribs)
{
__GLXdrawable *pGlxDraw;
int i, err;
if (!validGlxDrawable(client, glxdrawable, GLX_DRAWABLE_ANY,
- DixSetAttrAccess, &pGlxDraw, &err))
- return err;
+ DixSetAttrAccess, &pGlxDraw, &err))
+ return err;
for (i = 0; i < numAttribs; i++) {
- switch(attribs[i * 2]) {
- case GLX_EVENT_MASK:
- /* All we do is to record the event mask so we can send it
- * back when queried. We never actually clobber the
- * pbuffers, so we never need to send out the event. */
- pGlxDraw->eventMask = attribs[i * 2 + 1];
- break;
- }
+ switch (attribs[i * 2]) {
+ case GLX_EVENT_MASK:
+ /* All we do is to record the event mask so we can send it
+ * back when queried. We never actually clobber the
+ * pbuffers, so we never need to send out the event. */
+ pGlxDraw->eventMask = attribs[i * 2 + 1];
+ break;
+ }
}
return Success;
}
-int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_ChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXChangeDrawableAttributesReq *req =
- (xGLXChangeDrawableAttributesReq *) pc;
+ (xGLXChangeDrawableAttributesReq *) pc;
REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq);
if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
+ client->errorValue = req->numAttribs;
+ return BadValue;
}
#if 0
/* mesa sends an additional 8 bytes */
REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
#else
- if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len)
- return BadLength;
+ if (((sizeof(xGLXChangeDrawableAttributesReq) +
+ (req->numAttribs << 3)) >> 2) < client->req_len)
+ return BadLength;
#endif
return DoChangeDrawableAttributes(cl->client, req->drawable,
- req->numAttribs, (CARD32 *) (req + 1));
+ req->numAttribs, (CARD32 *) (req + 1));
}
-int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXChangeDrawableAttributesSGIXReq *req =
- (xGLXChangeDrawableAttributesSGIXReq *)pc;
+ (xGLXChangeDrawableAttributesSGIXReq *) pc;
REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq);
if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
+ client->errorValue = req->numAttribs;
+ return BadValue;
}
- REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3);
+ REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq,
+ req->numAttribs << 3);
return DoChangeDrawableAttributes(cl->client, req->drawable,
- req->numAttribs, (CARD32 *) (req + 1));
+ req->numAttribs, (CARD32 *) (req + 1));
}
-int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CreateWindow(__GLXclientState * cl, GLbyte * pc)
{
- xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
- __GLXconfig *config;
- __GLXscreen *pGlxScreen;
- ClientPtr client = cl->client;
- DrawablePtr pDraw;
- int err;
+ xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+ __GLXconfig *config;
+ __GLXscreen *pGlxScreen;
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ int err;
REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq);
if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
+ client->errorValue = req->numAttribs;
+ return BadValue;
}
REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
LEGAL_NEW_RESOURCE(req->glxwindow, client);
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err))
- return err;
+ return err;
err = dixLookupDrawable(&pDraw, req->window, client, 0, DixAddAccess);
if (err != Success || pDraw->type != DRAWABLE_WINDOW) {
- client->errorValue = req->window;
- return BadWindow;
+ client->errorValue = req->window;
+ return BadWindow;
}
if (!validGlxFBConfigForWindow(client, config, pDraw, &err))
- return err;
+ return err;
return DoCreateGLXDrawable(client, pGlxScreen, config,
- pDraw, req->window,
- req->glxwindow, GLX_DRAWABLE_WINDOW);
+ pDraw, req->window,
+ req->glxwindow, GLX_DRAWABLE_WINDOW);
}
-int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_DestroyWindow(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
@@ -1547,7 +1595,6 @@ int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW);
}
-
/*****************************************************************************/
/*
@@ -1555,7 +1602,8 @@ int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
** this time that is of value. Consequently, this code must be
** implemented by somebody other than SGI.
*/
-int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_SwapBuffers(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
@@ -1570,41 +1618,41 @@ int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
tag = req->contextTag;
drawId = req->drawable;
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc) {
- return __glXError(GLXBadContextTag);
- }
- /*
- ** The calling thread is swapping its current drawable. In this case,
- ** glxSwapBuffers is in both GL and X streams, in terms of
- ** sequentiality.
- */
- if (__glXForceCurrent(cl, tag, &error)) {
- /*
- ** Do whatever is needed to make sure that all preceding requests
- ** in both streams are completed before the swap is executed.
- */
- CALL_Finish( GET_DISPATCH(), () );
- glxc->hasUnflushedCommands = GL_FALSE;
- } else {
- return error;
- }
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXError(GLXBadContextTag);
+ }
+ /*
+ ** The calling thread is swapping its current drawable. In this case,
+ ** glxSwapBuffers is in both GL and X streams, in terms of
+ ** sequentiality.
+ */
+ if (__glXForceCurrent(cl, tag, &error)) {
+ /*
+ ** Do whatever is needed to make sure that all preceding requests
+ ** in both streams are completed before the swap is executed.
+ */
+ CALL_Finish(GET_DISPATCH(), ());
+ glxc->hasUnflushedCommands = GL_FALSE;
+ }
+ else {
+ return error;
+ }
}
pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
if (pGlxDraw == NULL)
- return error;
+ return error;
if (pGlxDraw->type == DRAWABLE_WINDOW &&
- (*pGlxDraw->swapBuffers)(cl->client, pGlxDraw) == GL_FALSE)
- return __glXError(GLXBadDrawable);
+ (*pGlxDraw->swapBuffers) (cl->client, pGlxDraw) == GL_FALSE)
+ return __glXError(GLXBadDrawable);
return Success;
}
-
static int
-DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
+DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
@@ -1615,7 +1663,7 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
int err;
if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
- return err;
+ return err;
nProps = 3;
reply.length = nProps << 1;
@@ -1624,30 +1672,32 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
reply.n = nProps;
nReplyBytes = reply.length << 2;
- sendBuf = (int *)malloc((size_t)nReplyBytes);
+ sendBuf = (int *) malloc((size_t) nReplyBytes);
if (sendBuf == NULL) {
- return __glXError(GLXBadContext); /* XXX: Is this correct? */
+ return __glXError(GLXBadContext); /* XXX: Is this correct? */
}
pSendBuf = sendBuf;
*pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
- *pSendBuf++ = (int)(ctx->share_id);
+ *pSendBuf++ = (int) (ctx->share_id);
*pSendBuf++ = GLX_VISUAL_ID_EXT;
- *pSendBuf++ = (int)(ctx->config->visualID);
+ *pSendBuf++ = (int) (ctx->config->visualID);
*pSendBuf++ = GLX_SCREEN_EXT;
- *pSendBuf++ = (int)(ctx->pGlxScreen->pScreen->myNum);
+ *pSendBuf++ = (int) (ctx->pGlxScreen->pScreen->myNum);
if (client->swapped) {
- __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
- } else {
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
- WriteToClient(client, nReplyBytes, (char *)sendBuf);
+ __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
}
- free((char *)sendBuf);
+ else {
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) &reply);
+ WriteToClient(client, nReplyBytes, (char *) sendBuf);
+ }
+ free((char *) sendBuf);
return Success;
}
-int __glXDisp_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_QueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
@@ -1657,7 +1707,8 @@ int __glXDisp_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
return DoQueryContext(cl, req->context);
}
-int __glXDisp_QueryContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_QueryContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
@@ -1667,93 +1718,93 @@ int __glXDisp_QueryContext(__GLXclientState *cl, GLbyte *pc)
return DoQueryContext(cl, req->context);
}
-int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_BindTexImageEXT(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- ClientPtr client = cl->client;
- __GLXcontext *context;
- __GLXdrawable *pGlxDraw;
- GLXDrawable drawId;
- int buffer;
- int error;
- CARD32 num_attribs;
+ ClientPtr client = cl->client;
+ __GLXcontext *context;
+ __GLXdrawable *pGlxDraw;
+ GLXDrawable drawId;
+ int buffer;
+ int error;
+ CARD32 num_attribs;
if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len)
- return BadLength;
+ return BadLength;
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc));
- buffer = *((INT32 *) (pc + 4));
+ buffer = *((INT32 *) (pc + 4));
num_attribs = *((CARD32 *) (pc + 8));
if (num_attribs > (UINT32_MAX >> 3)) {
- client->errorValue = num_attribs;
- return BadValue;
+ client->errorValue = num_attribs;
+ return BadValue;
}
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 12 + (num_attribs << 3));
if (buffer != GLX_FRONT_LEFT_EXT)
- return __glXError(GLXBadPixmap);
+ return __glXError(GLXBadPixmap);
- context = __glXForceCurrent (cl, req->contextTag, &error);
+ context = __glXForceCurrent(cl, req->contextTag, &error);
if (!context)
- return error;
+ return error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
- DixReadAccess, &pGlxDraw, &error))
- return error;
+ DixReadAccess, &pGlxDraw, &error))
+ return error;
if (!context->textureFromPixmap)
- return __glXError(GLXUnsupportedPrivateRequest);
+ return __glXError(GLXUnsupportedPrivateRequest);
- return context->textureFromPixmap->bindTexImage(context,
- buffer,
- pGlxDraw);
+ return context->textureFromPixmap->bindTexImage(context, buffer, pGlxDraw);
}
-int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_ReleaseTexImageEXT(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- ClientPtr client = cl->client;
- __GLXdrawable *pGlxDraw;
- __GLXcontext *context;
- GLXDrawable drawId;
- int buffer;
- int error;
+ ClientPtr client = cl->client;
+ __GLXdrawable *pGlxDraw;
+ __GLXcontext *context;
+ GLXDrawable drawId;
+ int buffer;
+ int error;
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc));
- buffer = *((INT32 *) (pc + 4));
-
- context = __glXForceCurrent (cl, req->contextTag, &error);
+ buffer = *((INT32 *) (pc + 4));
+
+ context = __glXForceCurrent(cl, req->contextTag, &error);
if (!context)
- return error;
+ return error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
- DixReadAccess, &pGlxDraw, &error))
- return error;
+ DixReadAccess, &pGlxDraw, &error))
+ return error;
if (!context->textureFromPixmap)
- return __glXError(GLXUnsupportedPrivateRequest);
+ return __glXError(GLXUnsupportedPrivateRequest);
return context->textureFromPixmap->releaseTexImage(context,
- buffer,
- pGlxDraw);
+ buffer, pGlxDraw);
}
-int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- GLXContextTag tag = req->contextTag;
- __GLXcontext *glxc = NULL;
- __GLXdrawable *pGlxDraw;
- ClientPtr client = cl->client;
- GLXDrawable drawId;
- int error;
- int x, y, width, height;
+ GLXContextTag tag = req->contextTag;
+ __GLXcontext *glxc = NULL;
+ __GLXdrawable *pGlxDraw;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId;
+ int error;
+ int x, y, width, height;
(void) client;
(void) req;
@@ -1763,43 +1814,44 @@ int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc));
- x = *((INT32 *) (pc + 4));
- y = *((INT32 *) (pc + 8));
- width = *((INT32 *) (pc + 12));
- height = *((INT32 *) (pc + 16));
+ x = *((INT32 *) (pc + 4));
+ y = *((INT32 *) (pc + 8));
+ width = *((INT32 *) (pc + 12));
+ height = *((INT32 *) (pc + 16));
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc) {
- return __glXError(GLXBadContextTag);
- }
- /*
- ** The calling thread is swapping its current drawable. In this case,
- ** glxSwapBuffers is in both GL and X streams, in terms of
- ** sequentiality.
- */
- if (__glXForceCurrent(cl, tag, &error)) {
- /*
- ** Do whatever is needed to make sure that all preceding requests
- ** in both streams are completed before the swap is executed.
- */
- CALL_Finish( GET_DISPATCH(), () );
- glxc->hasUnflushedCommands = GL_FALSE;
- } else {
- return error;
- }
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXError(GLXBadContextTag);
+ }
+ /*
+ ** The calling thread is swapping its current drawable. In this case,
+ ** glxSwapBuffers is in both GL and X streams, in terms of
+ ** sequentiality.
+ */
+ if (__glXForceCurrent(cl, tag, &error)) {
+ /*
+ ** Do whatever is needed to make sure that all preceding requests
+ ** in both streams are completed before the swap is executed.
+ */
+ CALL_Finish(GET_DISPATCH(), ());
+ glxc->hasUnflushedCommands = GL_FALSE;
+ }
+ else {
+ return error;
+ }
}
pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
if (!pGlxDraw)
- return error;
+ return error;
if (pGlxDraw == NULL ||
- pGlxDraw->type != GLX_DRAWABLE_WINDOW ||
- pGlxDraw->copySubBuffer == NULL)
- return __glXError(GLXBadDrawable);
+ pGlxDraw->type != GLX_DRAWABLE_WINDOW ||
+ pGlxDraw->copySubBuffer == NULL)
+ return __glXError(GLXBadDrawable);
- (*pGlxDraw->copySubBuffer)(pGlxDraw, x, y, width, height);
+ (*pGlxDraw->copySubBuffer) (pGlxDraw, x, y, width, height);
return Success;
}
@@ -1808,7 +1860,7 @@ int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
** Get drawable attributes
*/
static int
-DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
+DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
{
ClientPtr client = cl->client;
xGLXGetDrawableAttributesReply reply;
@@ -1817,8 +1869,8 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
int numAttribs, error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
- DixGetAttrAccess, &pGlxDraw, &error))
- return error;
+ DixGetAttrAccess, &pGlxDraw, &error))
+ return error;
numAttribs = 3;
reply.length = numAttribs << 1;
@@ -1828,28 +1880,30 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
attributes[0] = GLX_TEXTURE_TARGET_EXT;
attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
- GLX_TEXTURE_RECTANGLE_EXT;
+ GLX_TEXTURE_RECTANGLE_EXT;
attributes[2] = GLX_Y_INVERTED_EXT;
attributes[3] = GL_FALSE;
attributes[4] = GLX_EVENT_MASK;
attributes[5] = pGlxDraw->eventMask;
if (client->swapped) {
- __glXSwapGetDrawableAttributesReply(client, &reply, attributes);
- } else {
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
- (char *)&reply);
- WriteToClient(client, reply.length * sizeof (CARD32),
- (char *)attributes);
+ __glXSwapGetDrawableAttributesReply(client, &reply, attributes);
+ }
+ else {
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
+ (char *) &reply);
+ WriteToClient(client, reply.length * sizeof(CARD32),
+ (char *) attributes);
}
return Success;
}
-int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_GetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc;
/* this should be REQUEST_SIZE_MATCH, but mesa sends an additional 4 bytes */
REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
@@ -1857,12 +1911,13 @@ int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
return DoGetDrawableAttributes(cl, req->drawable);
}
-int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_GetDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXGetDrawableAttributesSGIXReq *req =
- (xGLXGetDrawableAttributesSGIXReq *)pc;
-
+ (xGLXGetDrawableAttributesSGIXReq *) pc;
+
REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq);
return DoGetDrawableAttributes(cl, req->drawable);
@@ -1878,28 +1933,30 @@ int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
/*
** Execute all the drawing commands in a request.
*/
-int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_Render(__GLXclientState * cl, GLbyte * pc)
{
xGLXRenderReq *req;
- ClientPtr client= cl->client;
+ ClientPtr client = cl->client;
int left, cmdlen, error;
int commandsDone;
CARD16 opcode;
__GLXrenderHeader *hdr;
__GLXcontext *glxc;
+
__GLX_DECLARE_SWAP_VARIABLES;
REQUEST_AT_LEAST_SIZE(xGLXRenderReq);
req = (xGLXRenderReq *) pc;
if (client->swapped) {
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
}
glxc = __glXForceCurrent(cl, req->contextTag, &error);
if (!glxc) {
- return error;
+ return error;
}
commandsDone = 0;
@@ -1908,278 +1965,284 @@ int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc)
while (left > 0) {
__GLXrenderSizeData entry;
int extra;
- __GLXdispatchRenderProcPtr proc;
- int err;
-
- if (left < sizeof(__GLXrenderHeader))
- return BadLength;
-
- /*
- ** Verify that the header length and the overall length agree.
- ** Also, each command must be word aligned.
- */
- hdr = (__GLXrenderHeader *) pc;
- if (client->swapped) {
- __GLX_SWAP_SHORT(&hdr->length);
- __GLX_SWAP_SHORT(&hdr->opcode);
- }
- cmdlen = hdr->length;
- opcode = hdr->opcode;
-
- /*
- ** Check for core opcodes and grab entry data.
- */
- err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
- proc = (__GLXdispatchRenderProcPtr)
- __glXGetProtocolDecodeFunction(& Render_dispatch_info,
- opcode, client->swapped);
-
- if ((err < 0) || (proc == NULL)) {
- client->errorValue = commandsDone;
- return __glXError(GLXBadRenderRequest);
- }
+ __GLXdispatchRenderProcPtr proc;
+ int err;
+
+ if (left < sizeof(__GLXrenderHeader))
+ return BadLength;
+
+ /*
+ ** Verify that the header length and the overall length agree.
+ ** Also, each command must be word aligned.
+ */
+ hdr = (__GLXrenderHeader *) pc;
+ if (client->swapped) {
+ __GLX_SWAP_SHORT(&hdr->length);
+ __GLX_SWAP_SHORT(&hdr->opcode);
+ }
+ cmdlen = hdr->length;
+ opcode = hdr->opcode;
+
+ /*
+ ** Check for core opcodes and grab entry data.
+ */
+ err = __glXGetProtocolSizeData(&Render_dispatch_info, opcode, &entry);
+ proc = (__GLXdispatchRenderProcPtr)
+ __glXGetProtocolDecodeFunction(&Render_dispatch_info,
+ opcode, client->swapped);
+
+ if ((err < 0) || (proc == NULL)) {
+ client->errorValue = commandsDone;
+ return __glXError(GLXBadRenderRequest);
+ }
if (entry.varsize) {
/* variable size command */
- extra = (*entry.varsize)(pc + __GLX_RENDER_HDR_SIZE,
- client->swapped);
+ extra = (*entry.varsize) (pc + __GLX_RENDER_HDR_SIZE,
+ client->swapped);
if (extra < 0) {
extra = 0;
}
if (cmdlen != __GLX_PAD(entry.bytes + extra)) {
return BadLength;
}
- } else {
+ }
+ else {
/* constant size command */
if (cmdlen != __GLX_PAD(entry.bytes)) {
return BadLength;
}
}
- if (left < cmdlen) {
- return BadLength;
- }
-
- /*
- ** Skip over the header and execute the command. We allow the
- ** caller to trash the command memory. This is useful especially
- ** for things that require double alignment - they can just shift
- ** the data towards lower memory (trashing the header) by 4 bytes
- ** and achieve the required alignment.
- */
- (*proc)(pc + __GLX_RENDER_HDR_SIZE);
- pc += cmdlen;
- left -= cmdlen;
- commandsDone++;
+ if (left < cmdlen) {
+ return BadLength;
+ }
+
+ /*
+ ** Skip over the header and execute the command. We allow the
+ ** caller to trash the command memory. This is useful especially
+ ** for things that require double alignment - they can just shift
+ ** the data towards lower memory (trashing the header) by 4 bytes
+ ** and achieve the required alignment.
+ */
+ (*proc) (pc + __GLX_RENDER_HDR_SIZE);
+ pc += cmdlen;
+ left -= cmdlen;
+ commandsDone++;
}
glxc->hasUnflushedCommands = GL_TRUE;
return Success;
}
-
/*
** Execute a large rendering request (one that spans multiple X requests).
*/
-int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc)
{
xGLXRenderLargeReq *req;
- ClientPtr client= cl->client;
+ ClientPtr client = cl->client;
size_t dataBytes;
__GLXrenderLargeHeader *hdr;
__GLXcontext *glxc;
int error;
CARD16 opcode;
+
__GLX_DECLARE_SWAP_VARIABLES;
-
+
req = (xGLXRenderLargeReq *) pc;
if (client->swapped) {
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
- __GLX_SWAP_INT(&req->dataBytes);
- __GLX_SWAP_SHORT(&req->requestNumber);
- __GLX_SWAP_SHORT(&req->requestTotal);
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->dataBytes);
+ __GLX_SWAP_SHORT(&req->requestNumber);
+ __GLX_SWAP_SHORT(&req->requestTotal);
}
glxc = __glXForceCurrent(cl, req->contextTag, &error);
if (!glxc) {
- /* Reset in case this isn't 1st request. */
- __glXResetLargeCommandStatus(cl);
- return error;
+ /* Reset in case this isn't 1st request. */
+ __glXResetLargeCommandStatus(cl);
+ return error;
}
dataBytes = req->dataBytes;
/*
- ** Check the request length.
- */
+ ** Check the request length.
+ */
if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) {
- client->errorValue = req->length;
- /* Reset in case this isn't 1st request. */
- __glXResetLargeCommandStatus(cl);
- return BadLength;
+ client->errorValue = req->length;
+ /* Reset in case this isn't 1st request. */
+ __glXResetLargeCommandStatus(cl);
+ return BadLength;
}
pc += sz_xGLXRenderLargeReq;
-
+
if (cl->largeCmdRequestsSoFar == 0) {
- __GLXrenderSizeData entry;
- int extra;
- size_t cmdlen;
- int err;
-
- /*
- ** This is the first request of a multi request command.
- ** Make enough space in the buffer, then copy the entire request.
- */
- if (req->requestNumber != 1) {
- client->errorValue = req->requestNumber;
- return __glXError(GLXBadLargeRequest);
- }
-
- hdr = (__GLXrenderLargeHeader *) pc;
- if (client->swapped) {
- __GLX_SWAP_INT(&hdr->length);
- __GLX_SWAP_INT(&hdr->opcode);
- }
- cmdlen = hdr->length;
- opcode = hdr->opcode;
-
- /*
- ** Check for core opcodes and grab entry data.
- */
- err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
- if (err < 0) {
- client->errorValue = opcode;
- return __glXError(GLXBadLargeRequest);
- }
-
- if (entry.varsize) {
- /*
- ** If it's a variable-size command (a command whose length must
- ** be computed from its parameters), all the parameters needed
- ** will be in the 1st request, so it's okay to do this.
- */
- extra = (*entry.varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE,
- client->swapped);
- if (extra < 0) {
- extra = 0;
- }
- /* large command's header is 4 bytes longer, so add 4 */
- if (cmdlen != __GLX_PAD(entry.bytes + 4 + extra)) {
- return BadLength;
- }
- } else {
- /* constant size command */
- if (cmdlen != __GLX_PAD(entry.bytes + 4)) {
- return BadLength;
- }
- }
- /*
- ** Make enough space in the buffer, then copy the entire request.
- */
- if (cl->largeCmdBufSize < cmdlen) {
- if (!cl->largeCmdBuf) {
- cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
- } else {
- cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
- }
- if (!cl->largeCmdBuf) {
- return BadAlloc;
- }
- cl->largeCmdBufSize = cmdlen;
- }
- memcpy(cl->largeCmdBuf, pc, dataBytes);
-
- cl->largeCmdBytesSoFar = dataBytes;
- cl->largeCmdBytesTotal = cmdlen;
- cl->largeCmdRequestsSoFar = 1;
- cl->largeCmdRequestsTotal = req->requestTotal;
- return Success;
-
- } else {
- /*
- ** We are receiving subsequent (i.e. not the first) requests of a
- ** multi request command.
- */
-
- /*
- ** Check the request number and the total request count.
- */
- if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
- client->errorValue = req->requestNumber;
- __glXResetLargeCommandStatus(cl);
- return __glXError(GLXBadLargeRequest);
- }
- if (req->requestTotal != cl->largeCmdRequestsTotal) {
- client->errorValue = req->requestTotal;
- __glXResetLargeCommandStatus(cl);
- return __glXError(GLXBadLargeRequest);
- }
-
- /*
- ** Check that we didn't get too much data.
- */
- if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
- client->errorValue = dataBytes;
- __glXResetLargeCommandStatus(cl);
- return __glXError(GLXBadLargeRequest);
- }
- memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
- cl->largeCmdBytesSoFar += dataBytes;
- cl->largeCmdRequestsSoFar++;
-
- if (req->requestNumber == cl->largeCmdRequestsTotal) {
- __GLXdispatchRenderProcPtr proc;
-
- /*
- ** This is the last request; it must have enough bytes to complete
- ** the command.
- */
- /* NOTE: the two pad macros have been added below; they are needed
- ** because the client library pads the total byte count, but not
- ** the per-request byte counts. The Protocol Encoding says the
- ** total byte count should not be padded, so a proposal will be
- ** made to the ARB to relax the padding constraint on the total
- ** byte count, thus preserving backward compatibility. Meanwhile,
- ** the padding done below fixes a bug that did not allow
- ** large commands of odd sizes to be accepted by the server.
- */
- if (__GLX_PAD(cl->largeCmdBytesSoFar) !=
- __GLX_PAD(cl->largeCmdBytesTotal)) {
- client->errorValue = dataBytes;
- __glXResetLargeCommandStatus(cl);
- return __glXError(GLXBadLargeRequest);
- }
- hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
- /*
- ** The opcode and length field in the header had already been
- ** swapped when the first request was received.
- **
- ** Use the opcode to index into the procedure table.
- */
- opcode = hdr->opcode;
-
- proc = (__GLXdispatchRenderProcPtr)
- __glXGetProtocolDecodeFunction(& Render_dispatch_info, opcode,
- client->swapped);
- if (proc == NULL) {
- client->errorValue = opcode;
- return __glXError(GLXBadLargeRequest);
- }
-
- /*
- ** Skip over the header and execute the command.
- */
- (*proc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
- glxc->hasUnflushedCommands = GL_TRUE;
-
- /*
- ** Reset for the next RenderLarge series.
- */
- __glXResetLargeCommandStatus(cl);
- } else {
- /*
- ** This is neither the first nor the last request.
- */
- }
- return Success;
+ __GLXrenderSizeData entry;
+ int extra;
+ size_t cmdlen;
+ int err;
+
+ /*
+ ** This is the first request of a multi request command.
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (req->requestNumber != 1) {
+ client->errorValue = req->requestNumber;
+ return __glXError(GLXBadLargeRequest);
+ }
+
+ hdr = (__GLXrenderLargeHeader *) pc;
+ if (client->swapped) {
+ __GLX_SWAP_INT(&hdr->length);
+ __GLX_SWAP_INT(&hdr->opcode);
+ }
+ cmdlen = hdr->length;
+ opcode = hdr->opcode;
+
+ /*
+ ** Check for core opcodes and grab entry data.
+ */
+ err = __glXGetProtocolSizeData(&Render_dispatch_info, opcode, &entry);
+ if (err < 0) {
+ client->errorValue = opcode;
+ return __glXError(GLXBadLargeRequest);
+ }
+
+ if (entry.varsize) {
+ /*
+ ** If it's a variable-size command (a command whose length must
+ ** be computed from its parameters), all the parameters needed
+ ** will be in the 1st request, so it's okay to do this.
+ */
+ extra = (*entry.varsize) (pc + __GLX_RENDER_LARGE_HDR_SIZE,
+ client->swapped);
+ if (extra < 0) {
+ extra = 0;
+ }
+ /* large command's header is 4 bytes longer, so add 4 */
+ if (cmdlen != __GLX_PAD(entry.bytes + 4 + extra)) {
+ return BadLength;
+ }
+ }
+ else {
+ /* constant size command */
+ if (cmdlen != __GLX_PAD(entry.bytes + 4)) {
+ return BadLength;
+ }
+ }
+ /*
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (cl->largeCmdBufSize < cmdlen) {
+ if (!cl->largeCmdBuf) {
+ cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
+ }
+ else {
+ cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
+ }
+ if (!cl->largeCmdBuf) {
+ return BadAlloc;
+ }
+ cl->largeCmdBufSize = cmdlen;
+ }
+ memcpy(cl->largeCmdBuf, pc, dataBytes);
+
+ cl->largeCmdBytesSoFar = dataBytes;
+ cl->largeCmdBytesTotal = cmdlen;
+ cl->largeCmdRequestsSoFar = 1;
+ cl->largeCmdRequestsTotal = req->requestTotal;
+ return Success;
+
+ }
+ else {
+ /*
+ ** We are receiving subsequent (i.e. not the first) requests of a
+ ** multi request command.
+ */
+
+ /*
+ ** Check the request number and the total request count.
+ */
+ if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
+ client->errorValue = req->requestNumber;
+ __glXResetLargeCommandStatus(cl);
+ return __glXError(GLXBadLargeRequest);
+ }
+ if (req->requestTotal != cl->largeCmdRequestsTotal) {
+ client->errorValue = req->requestTotal;
+ __glXResetLargeCommandStatus(cl);
+ return __glXError(GLXBadLargeRequest);
+ }
+
+ /*
+ ** Check that we didn't get too much data.
+ */
+ if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
+ client->errorValue = dataBytes;
+ __glXResetLargeCommandStatus(cl);
+ return __glXError(GLXBadLargeRequest);
+ }
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
+ cl->largeCmdBytesSoFar += dataBytes;
+ cl->largeCmdRequestsSoFar++;
+
+ if (req->requestNumber == cl->largeCmdRequestsTotal) {
+ __GLXdispatchRenderProcPtr proc;
+
+ /*
+ ** This is the last request; it must have enough bytes to complete
+ ** the command.
+ */
+ /* NOTE: the two pad macros have been added below; they are needed
+ ** because the client library pads the total byte count, but not
+ ** the per-request byte counts. The Protocol Encoding says the
+ ** total byte count should not be padded, so a proposal will be
+ ** made to the ARB to relax the padding constraint on the total
+ ** byte count, thus preserving backward compatibility. Meanwhile,
+ ** the padding done below fixes a bug that did not allow
+ ** large commands of odd sizes to be accepted by the server.
+ */
+ if (__GLX_PAD(cl->largeCmdBytesSoFar) !=
+ __GLX_PAD(cl->largeCmdBytesTotal)) {
+ client->errorValue = dataBytes;
+ __glXResetLargeCommandStatus(cl);
+ return __glXError(GLXBadLargeRequest);
+ }
+ hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
+ /*
+ ** The opcode and length field in the header had already been
+ ** swapped when the first request was received.
+ **
+ ** Use the opcode to index into the procedure table.
+ */
+ opcode = hdr->opcode;
+
+ proc = (__GLXdispatchRenderProcPtr)
+ __glXGetProtocolDecodeFunction(&Render_dispatch_info, opcode,
+ client->swapped);
+ if (proc == NULL) {
+ client->errorValue = opcode;
+ return __glXError(GLXBadLargeRequest);
+ }
+
+ /*
+ ** Skip over the header and execute the command.
+ */
+ (*proc) (cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
+ glxc->hasUnflushedCommands = GL_TRUE;
+
+ /*
+ ** Reset for the next RenderLarge series.
+ */
+ __glXResetLargeCommandStatus(cl);
+ }
+ else {
+ /*
+ ** This is neither the first nor the last request.
+ */
+ }
+ return Success;
}
}
@@ -2190,7 +2253,8 @@ int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
** allocating the entry points in the dispatch table.
*/
-int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_VendorPrivate(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
@@ -2200,18 +2264,19 @@ int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc)
REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq);
proc = (__GLXdispatchVendorPrivProcPtr)
- __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
- vendorcode, 0);
+ __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info,
+ vendorcode, 0);
if (proc != NULL) {
- (*proc)(cl, (GLbyte*)req);
- return Success;
+ (*proc) (cl, (GLbyte *) req);
+ return Success;
}
cl->client->errorValue = req->vendorCode;
return __glXError(GLXUnsupportedPrivateRequest);
}
-int __glXDisp_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_VendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
@@ -2221,17 +2286,18 @@ int __glXDisp_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq);
proc = (__GLXdispatchVendorPrivProcPtr)
- __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
- vendorcode, 0);
+ __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info,
+ vendorcode, 0);
if (proc != NULL) {
- return (*proc)(cl, (GLbyte*)req);
+ return (*proc) (cl, (GLbyte *) req);
}
cl->client->errorValue = vendorcode;
return __glXError(GLXUnsupportedPrivateRequest);
}
-int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
@@ -2244,7 +2310,7 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq);
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
- return err;
+ return err;
n = strlen(pGlxScreen->GLXextensions) + 1;
length = __GLX_PAD(n) >> 2;
@@ -2253,7 +2319,7 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
reply.length = length;
reply.n = n;
- /* Allocate buffer to make sure it's a multiple of 4 bytes big.*/
+ /* Allocate buffer to make sure it's a multiple of 4 bytes big. */
buf = (char *) malloc(length << 2);
if (buf == NULL)
return BadAlloc;
@@ -2261,16 +2327,19 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
if (client->swapped) {
glxSwapQueryExtensionsStringReply(client, &reply, buf);
- } else {
- WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
- WriteToClient(client, (int)(length << 2), (char *)buf);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply,
+ (char *) &reply);
+ WriteToClient(client, (int) (length << 2), (char *) buf);
}
free(buf);
return Success;
}
-int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
@@ -2285,24 +2354,24 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
REQUEST_SIZE_MATCH(xGLXQueryServerStringReq);
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
- return err;
-
- switch(req->name) {
- case GLX_VENDOR:
- ptr = pGlxScreen->GLXvendor;
- break;
- case GLX_VERSION:
- /* Return to the server version rather than the screen version
- * to prevent confusion when they do not match.
- */
- snprintf(ver_str, 16, "%d.%d", glxMajorVersion, glxMinorVersion);
- ptr = ver_str;
- break;
- case GLX_EXTENSIONS:
- ptr = pGlxScreen->GLXextensions;
- break;
- default:
- return BadValue;
+ return err;
+
+ switch (req->name) {
+ case GLX_VENDOR:
+ ptr = pGlxScreen->GLXvendor;
+ break;
+ case GLX_VERSION:
+ /* Return to the server version rather than the screen version
+ * to prevent confusion when they do not match.
+ */
+ snprintf(ver_str, 16, "%d.%d", glxMajorVersion, glxMinorVersion);
+ ptr = ver_str;
+ break;
+ case GLX_EXTENSIONS:
+ ptr = pGlxScreen->GLXextensions;
+ break;
+ default:
+ return BadValue;
}
n = strlen(ptr) + 1;
@@ -2320,26 +2389,28 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
if (client->swapped) {
glxSwapQueryServerStringReply(client, &reply, buf);
- } else {
- WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
- WriteToClient(client, (int)(length << 2), buf);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) &reply);
+ WriteToClient(client, (int) (length << 2), buf);
}
free(buf);
return Success;
}
-int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_ClientInfo(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
const char *buf;
-
+
REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq);
- buf = (const char *)(req+1);
+ buf = (const char *) (req + 1);
if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq)))
- return BadLength;
+ return BadLength;
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
diff --git a/xorg-server/glx/glxcmdsswap.c b/xorg-server/glx/glxcmdsswap.c
index 4725cb788..04bf8d8c8 100644
--- a/xorg-server/glx/glxcmdsswap.c
+++ b/xorg-server/glx/glxcmdsswap.c
@@ -1,926 +1,1018 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#else
-
-#include "glheader.h"
-
-#endif
-
-#include <string.h>
-#include "glxserver.h"
-#include "glxutil.h"
-#include <GL/glxtokens.h>
-#include <unpack.h>
-#include <pixmapstr.h>
-#include <windowstr.h>
-#include "glxext.h"
-#include "GL/gl.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
-#include "indirect_dispatch.h"
-#include "indirect_table.h"
-#include "indirect_util.h"
-
-
-/************************************************************************/
-
-/*
-** Byteswapping versions of GLX commands. In most cases they just swap
-** the incoming arguments and then call the unswapped routine. For commands
-** that have replies, a separate swapping routine for the reply is provided;
-** it is called at the end of the unswapped routine.
-*/
-
-int __glXDispSwap_CreateContext(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXCreateContextReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->visual);
- __GLX_SWAP_INT(&req->screen);
- __GLX_SWAP_INT(&req->shareList);
-
- return __glXDisp_CreateContext(cl, pc);
-}
-
-int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXCreateNewContextReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->fbconfig);
- __GLX_SWAP_INT(&req->screen);
- __GLX_SWAP_INT(&req->renderType);
- __GLX_SWAP_INT(&req->shareList);
-
- return __glXDisp_CreateNewContext(cl, pc);
-}
-
-int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreateContextWithConfigSGIXReq *req =
- (xGLXCreateContextWithConfigSGIXReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->fbconfig);
- __GLX_SWAP_INT(&req->screen);
- __GLX_SWAP_INT(&req->renderType);
- __GLX_SWAP_INT(&req->shareList);
-
- return __glXDisp_CreateContextWithConfigSGIX(cl, pc);
-}
-
-int __glXDispSwap_DestroyContext(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->context);
-
- return __glXDisp_DestroyContext(cl, pc);
-}
-
-int __glXDispSwap_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXMakeCurrentReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->oldContextTag);
-
- return __glXDisp_MakeCurrent(cl, pc);
-}
-
-int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->readdrawable);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->oldContextTag);
-
- return __glXDisp_MakeContextCurrent(cl, pc);
-}
-
-int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->readable);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->oldContextTag);
-
- return __glXDisp_MakeCurrentReadSGI(cl, pc);
-}
-
-int __glXDispSwap_IsDirect(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXIsDirectReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->context);
-
- return __glXDisp_IsDirect(cl, pc);
-}
-
-int __glXDispSwap_QueryVersion(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXQueryVersionReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->majorVersion);
- __GLX_SWAP_INT(&req->minorVersion);
-
- return __glXDisp_QueryVersion(cl, pc);
-}
-
-int __glXDispSwap_WaitGL(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXWaitGLReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- return __glXDisp_WaitGL(cl, pc);
-}
-
-int __glXDispSwap_WaitX(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXWaitXReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- return __glXDisp_WaitX(cl, pc);
-}
-
-int __glXDispSwap_CopyContext(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXCopyContextReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->source);
- __GLX_SWAP_INT(&req->dest);
- __GLX_SWAP_INT(&req->mask);
-
- return __glXDisp_CopyContext(cl, pc);
-}
-
-int __glXDispSwap_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq);
-
- __GLX_SWAP_INT(&req->screen);
- return __glXDisp_GetVisualConfigs(cl, pc);
-}
-
-int __glXDispSwap_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq);
-
- __GLX_SWAP_INT(&req->screen);
- return __glXDisp_GetFBConfigs(cl, pc);
-}
-
-int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq);
-
- __GLX_SWAP_INT(&req->screen);
- return __glXDisp_GetFBConfigsSGIX(cl, pc);
-}
-
-int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->screen);
- __GLX_SWAP_INT(&req->visual);
- __GLX_SWAP_INT(&req->pixmap);
- __GLX_SWAP_INT(&req->glxpixmap);
-
- return __glXDisp_CreateGLXPixmap(cl, pc);
-}
-
-int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
- CARD32 *attribs;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->screen);
- __GLX_SWAP_INT(&req->fbconfig);
- __GLX_SWAP_INT(&req->pixmap);
- __GLX_SWAP_INT(&req->glxpixmap);
- __GLX_SWAP_INT(&req->numAttribs);
-
- if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
- }
- REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
- attribs = (CARD32*)(req + 1);
- __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
-
- return __glXDisp_CreatePixmap(cl, pc);
-}
-
-int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreateGLXPixmapWithConfigSGIXReq *req =
- (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->screen);
- __GLX_SWAP_INT(&req->fbconfig);
- __GLX_SWAP_INT(&req->pixmap);
- __GLX_SWAP_INT(&req->glxpixmap);
-
- return __glXDisp_CreateGLXPixmapWithConfigSGIX(cl, pc);
-}
-
-int __glXDispSwap_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->glxpixmap);
-
- return __glXDisp_DestroyGLXPixmap(cl, pc);
-}
-
-int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_AT_LEAST_SIZE(xGLXDestroyGLXPixmapReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->glxpixmap);
-
- return __glXDisp_DestroyGLXPixmap(cl, pc);
-}
-
-int __glXDispSwap_QueryContext(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXQueryContextReq);
-
- __GLX_SWAP_INT(&req->context);
-
- return __glXDisp_QueryContext(cl, pc);
-}
-
-int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- CARD32 *attribs;
-
- REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq);
-
- __GLX_SWAP_INT(&req->screen);
- __GLX_SWAP_INT(&req->fbconfig);
- __GLX_SWAP_INT(&req->pbuffer);
- __GLX_SWAP_INT(&req->numAttribs);
-
- if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
- }
- REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
- attribs = (CARD32*)(req + 1);
- __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
-
- return __glXDisp_CreatePbuffer(cl, pc);
-}
-
-int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
-
- __GLX_SWAP_INT(&req->screen);
- __GLX_SWAP_INT(&req->fbconfig);
- __GLX_SWAP_INT(&req->pbuffer);
- __GLX_SWAP_INT(&req->width);
- __GLX_SWAP_INT(&req->height);
-
- return __glXDisp_CreateGLXPbufferSGIX(cl, pc);
-}
-
-int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq);
-
- __GLX_SWAP_INT(&req->pbuffer);
-
- return __glXDisp_DestroyPbuffer(cl, pc);
-}
-
-int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq);
-
- __GLX_SWAP_INT(&req->pbuffer);
-
- return __glXDisp_DestroyGLXPbufferSGIX(cl, pc);
-}
-
-int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXChangeDrawableAttributesReq *req =
- (xGLXChangeDrawableAttributesReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- CARD32 *attribs;
-
- REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq);
-
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->numAttribs);
-
- if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
- }
- if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len)
- return BadLength;
-
- attribs = (CARD32*)(req + 1);
- __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
-
- return __glXDisp_ChangeDrawableAttributes(cl, pc);
-}
-
-int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl,
- GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXChangeDrawableAttributesSGIXReq *req =
- (xGLXChangeDrawableAttributesSGIXReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- CARD32 *attribs;
-
- REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq);
-
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->numAttribs);
-
- if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
- }
- REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3);
- attribs = (CARD32*)(req + 1);
- __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
-
- return __glXDisp_ChangeDrawableAttributesSGIX(cl, pc);
-}
-
-int __glXDispSwap_CreateWindow(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- CARD32 *attribs;
-
- REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq);
-
- __GLX_SWAP_INT(&req->screen);
- __GLX_SWAP_INT(&req->fbconfig);
- __GLX_SWAP_INT(&req->window);
- __GLX_SWAP_INT(&req->glxwindow);
- __GLX_SWAP_INT(&req->numAttribs);
-
- if (req->numAttribs > (UINT32_MAX >> 3)) {
- client->errorValue = req->numAttribs;
- return BadValue;
- }
- REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
- attribs = (CARD32*)(req + 1);
- __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
-
- return __glXDisp_CreateWindow(cl, pc);
-}
-
-int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq);
-
- __GLX_SWAP_INT(&req->glxwindow);
-
- return __glXDisp_DestroyWindow(cl, pc);
-}
-
-int __glXDispSwap_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXSwapBuffersReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
- __GLX_SWAP_INT(&req->drawable);
-
- return __glXDisp_SwapBuffers(cl, pc);
-}
-
-int __glXDispSwap_UseXFont(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXUseXFontReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
- __GLX_SWAP_INT(&req->font);
- __GLX_SWAP_INT(&req->first);
- __GLX_SWAP_INT(&req->count);
- __GLX_SWAP_INT(&req->listBase);
-
- return __glXDisp_UseXFont(cl, pc);
-}
-
-
-int __glXDispSwap_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->screen);
-
- return __glXDisp_QueryExtensionsString(cl, pc);
-}
-
-int __glXDispSwap_QueryServerString(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXQueryServerStringReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->screen);
- __GLX_SWAP_INT(&req->name);
-
- return __glXDisp_QueryServerString(cl, pc);
-}
-
-int __glXDispSwap_ClientInfo(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->major);
- __GLX_SWAP_INT(&req->minor);
- __GLX_SWAP_INT(&req->numbytes);
-
- return __glXDisp_ClientInfo(cl, pc);
-}
-
-int __glXDispSwap_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->context);
-
- return __glXDisp_QueryContextInfoEXT(cl, pc);
-}
-
-int __glXDispSwap_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- GLXDrawable *drawId;
- int *buffer;
- CARD32 *num_attribs;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len)
- return BadLength;
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
-
- drawId = ((GLXDrawable *) (pc));
- buffer = ((int *) (pc + 4));
- num_attribs = ((CARD32 *) (pc + 8));
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
- __GLX_SWAP_INT(drawId);
- __GLX_SWAP_INT(buffer);
- __GLX_SWAP_INT(num_attribs);
-
- return __glXDisp_BindTexImageEXT(cl, (GLbyte *)pc);
-}
-
-int __glXDispSwap_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- GLXDrawable *drawId;
- int *buffer;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
-
- drawId = ((GLXDrawable *) (pc));
- buffer = ((int *) (pc + 4));
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
- __GLX_SWAP_INT(drawId);
- __GLX_SWAP_INT(buffer);
-
- return __glXDisp_ReleaseTexImageEXT(cl, (GLbyte *)pc);
-}
-
-int __glXDispSwap_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- GLXDrawable *drawId;
- int *buffer;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20);
-
- (void) drawId;
- (void) buffer;
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
- __GLX_SWAP_INT(pc);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
-
- return __glXDisp_CopySubBufferMESA(cl, pc);
-
-}
-
-int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *)pc;
- CARD32 *data;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq);
-
- data = (CARD32 *) (req + 1);
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
- __GLX_SWAP_INT(data);
-
- return __glXDisp_GetDrawableAttributesSGIX(cl, pc);
-}
-
-int __glXDispSwap_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->drawable);
-
- return __glXDisp_GetDrawableAttributes(cl, pc);
-}
-
-
-/************************************************************************/
-
-/*
-** Swap replies.
-*/
-
-void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply *reply)
-{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->contextTag);
- WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)reply);
-}
-
-void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply)
-{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- WriteToClient(client, sz_xGLXIsDirectReply, (char *)reply);
-}
-
-void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply)
-{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->majorVersion);
- __GLX_SWAP_INT(&reply->minorVersion);
- WriteToClient(client, sz_xGLXQueryVersionReply, (char *)reply);
-}
-
-void glxSwapQueryExtensionsStringReply(ClientPtr client,
- xGLXQueryExtensionsStringReply *reply, char *buf)
-{
- int length = reply->length;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply);
- __GLX_SWAP_INT_ARRAY((int *)buf, length);
- WriteToClient(client, length << 2, buf);
-}
-
-void glxSwapQueryServerStringReply(ClientPtr client,
- xGLXQueryServerStringReply *reply, char *buf)
-{
- int length = reply->length;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)reply);
- /** no swap is needed for an array of chars **/
- /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
- WriteToClient(client, length << 2, buf);
-}
-
-void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf)
-{
- int length = reply->length;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply);
- __GLX_SWAP_INT_ARRAY((int *)buf, length);
- WriteToClient(client, length << 2, (char *)buf);
-}
-
-void __glXSwapGetDrawableAttributesReply(ClientPtr client,
- xGLXGetDrawableAttributesReply *reply, CARD32 *buf)
-{
- int length = reply->length;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->numAttribs);
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)reply);
- __GLX_SWAP_INT_ARRAY((int *)buf, length);
- WriteToClient(client, length << 2, (char *)buf);
-}
-
-/************************************************************************/
-
-/*
-** Render and Renderlarge are not in the GLX API. They are used by the GLX
-** client library to send batches of GL rendering commands.
-*/
-
-int __glXDispSwap_Render(__GLXclientState *cl, GLbyte *pc)
-{
- return __glXDisp_Render(cl, pc);
-}
-
-/*
-** Execute a large rendering request (one that spans multiple X requests).
-*/
-int __glXDispSwap_RenderLarge(__GLXclientState *cl, GLbyte *pc)
-{
- return __glXDisp_RenderLarge(cl, pc);
-}
-
-/************************************************************************/
-
-/*
-** No support is provided for the vendor-private requests other than
-** allocating these entry points in the dispatch table.
-*/
-
-int __glXDispSwap_VendorPrivate(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq *req;
- GLint vendorcode;
- __GLXdispatchVendorPrivProcPtr proc;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- req = (xGLXVendorPrivateReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
-
- vendorcode = req->vendorCode;
-
- proc = (__GLXdispatchVendorPrivProcPtr)
- __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
- vendorcode, 1);
- if (proc != NULL) {
- (*proc)(cl, (GLbyte*)req);
- return Success;
- }
-
- cl->client->errorValue = req->vendorCode;
- return __glXError(GLXUnsupportedPrivateRequest);
-}
-
-
-int __glXDispSwap_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateWithReplyReq *req;
- GLint vendorcode;
- __GLXdispatchVendorPrivProcPtr proc;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- req = (xGLXVendorPrivateWithReplyReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
-
- vendorcode = req->vendorCode;
-
- proc = (__GLXdispatchVendorPrivProcPtr)
- __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
- vendorcode, 1);
- if (proc != NULL) {
- return (*proc)(cl, (GLbyte*)req);
- }
-
- cl->client->errorValue = req->vendorCode;
- return __glXError(GLXUnsupportedPrivateRequest);
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
+#endif
+
+#include <string.h>
+#include "glxserver.h"
+#include "glxutil.h"
+#include <GL/glxtokens.h>
+#include <unpack.h>
+#include <pixmapstr.h>
+#include <windowstr.h>
+#include "glxext.h"
+#include "GL/gl.h"
+#include "glapitable.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+#include "indirect_dispatch.h"
+#include "indirect_table.h"
+#include "indirect_util.h"
+
+/************************************************************************/
+
+/*
+** Byteswapping versions of GLX commands. In most cases they just swap
+** the incoming arguments and then call the unswapped routine. For commands
+** that have replies, a separate swapping routine for the reply is provided;
+** it is called at the end of the unswapped routine.
+*/
+
+int
+__glXDispSwap_CreateContext(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXCreateContextReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->visual);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->shareList);
+
+ return __glXDisp_CreateContext(cl, pc);
+}
+
+int
+__glXDispSwap_CreateNewContext(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXCreateNewContextReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->renderType);
+ __GLX_SWAP_INT(&req->shareList);
+
+ return __glXDisp_CreateNewContext(cl, pc);
+}
+
+int
+__glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateContextWithConfigSGIXReq *req =
+ (xGLXCreateContextWithConfigSGIXReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->renderType);
+ __GLX_SWAP_INT(&req->shareList);
+
+ return __glXDisp_CreateContextWithConfigSGIX(cl, pc);
+}
+
+int
+__glXDispSwap_DestroyContext(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+
+ return __glXDisp_DestroyContext(cl, pc);
+}
+
+int
+__glXDispSwap_MakeCurrent(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXMakeCurrentReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->oldContextTag);
+
+ return __glXDisp_MakeCurrent(cl, pc);
+}
+
+int
+__glXDispSwap_MakeContextCurrent(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->readdrawable);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->oldContextTag);
+
+ return __glXDisp_MakeContextCurrent(cl, pc);
+}
+
+int
+__glXDispSwap_MakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->readable);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->oldContextTag);
+
+ return __glXDisp_MakeCurrentReadSGI(cl, pc);
+}
+
+int
+__glXDispSwap_IsDirect(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXIsDirectReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+
+ return __glXDisp_IsDirect(cl, pc);
+}
+
+int
+__glXDispSwap_QueryVersion(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXQueryVersionReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->majorVersion);
+ __GLX_SWAP_INT(&req->minorVersion);
+
+ return __glXDisp_QueryVersion(cl, pc);
+}
+
+int
+__glXDispSwap_WaitGL(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXWaitGLReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ return __glXDisp_WaitGL(cl, pc);
+}
+
+int
+__glXDispSwap_WaitX(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXWaitXReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ return __glXDisp_WaitX(cl, pc);
+}
+
+int
+__glXDispSwap_CopyContext(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXCopyContextReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->source);
+ __GLX_SWAP_INT(&req->dest);
+ __GLX_SWAP_INT(&req->mask);
+
+ return __glXDisp_CopyContext(cl, pc);
+}
+
+int
+__glXDispSwap_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq);
+
+ __GLX_SWAP_INT(&req->screen);
+ return __glXDisp_GetVisualConfigs(cl, pc);
+}
+
+int
+__glXDispSwap_GetFBConfigs(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq);
+
+ __GLX_SWAP_INT(&req->screen);
+ return __glXDisp_GetFBConfigs(cl, pc);
+}
+
+int
+__glXDispSwap_GetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq);
+
+ __GLX_SWAP_INT(&req->screen);
+ return __glXDisp_GetFBConfigsSGIX(cl, pc);
+}
+
+int
+__glXDispSwap_CreateGLXPixmap(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->visual);
+ __GLX_SWAP_INT(&req->pixmap);
+ __GLX_SWAP_INT(&req->glxpixmap);
+
+ return __glXDisp_CreateGLXPixmap(cl, pc);
+}
+
+int
+__glXDispSwap_CreatePixmap(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
+ CARD32 *attribs;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->pixmap);
+ __GLX_SWAP_INT(&req->glxpixmap);
+ __GLX_SWAP_INT(&req->numAttribs);
+
+ if (req->numAttribs > (UINT32_MAX >> 3)) {
+ client->errorValue = req->numAttribs;
+ return BadValue;
+ }
+ REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
+ attribs = (CARD32 *) (req + 1);
+ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
+
+ return __glXDisp_CreatePixmap(cl, pc);
+}
+
+int
+__glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateGLXPixmapWithConfigSGIXReq *req =
+ (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->pixmap);
+ __GLX_SWAP_INT(&req->glxpixmap);
+
+ return __glXDisp_CreateGLXPixmapWithConfigSGIX(cl, pc);
+}
+
+int
+__glXDispSwap_DestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->glxpixmap);
+
+ return __glXDisp_DestroyGLXPixmap(cl, pc);
+}
+
+int
+__glXDispSwap_DestroyPixmap(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_AT_LEAST_SIZE(xGLXDestroyGLXPixmapReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->glxpixmap);
+
+ return __glXDisp_DestroyGLXPixmap(cl, pc);
+}
+
+int
+__glXDispSwap_QueryContext(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXQueryContextReq);
+
+ __GLX_SWAP_INT(&req->context);
+
+ return __glXDisp_QueryContext(cl, pc);
+}
+
+int
+__glXDispSwap_CreatePbuffer(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ CARD32 *attribs;
+
+ REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq);
+
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->pbuffer);
+ __GLX_SWAP_INT(&req->numAttribs);
+
+ if (req->numAttribs > (UINT32_MAX >> 3)) {
+ client->errorValue = req->numAttribs;
+ return BadValue;
+ }
+ REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
+ attribs = (CARD32 *) (req + 1);
+ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
+
+ return __glXDisp_CreatePbuffer(cl, pc);
+}
+
+int
+__glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
+
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->pbuffer);
+ __GLX_SWAP_INT(&req->width);
+ __GLX_SWAP_INT(&req->height);
+
+ return __glXDisp_CreateGLXPbufferSGIX(cl, pc);
+}
+
+int
+__glXDispSwap_DestroyPbuffer(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq);
+
+ __GLX_SWAP_INT(&req->pbuffer);
+
+ return __glXDisp_DestroyPbuffer(cl, pc);
+}
+
+int
+__glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq);
+
+ __GLX_SWAP_INT(&req->pbuffer);
+
+ return __glXDisp_DestroyGLXPbufferSGIX(cl, pc);
+}
+
+int
+__glXDispSwap_ChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXChangeDrawableAttributesReq *req =
+ (xGLXChangeDrawableAttributesReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ CARD32 *attribs;
+
+ REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq);
+
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->numAttribs);
+
+ if (req->numAttribs > (UINT32_MAX >> 3)) {
+ client->errorValue = req->numAttribs;
+ return BadValue;
+ }
+ if (((sizeof(xGLXChangeDrawableAttributesReq) +
+ (req->numAttribs << 3)) >> 2) < client->req_len)
+ return BadLength;
+
+ attribs = (CARD32 *) (req + 1);
+ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
+
+ return __glXDisp_ChangeDrawableAttributes(cl, pc);
+}
+
+int
+__glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXChangeDrawableAttributesSGIXReq *req =
+ (xGLXChangeDrawableAttributesSGIXReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ CARD32 *attribs;
+
+ REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq);
+
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->numAttribs);
+
+ if (req->numAttribs > (UINT32_MAX >> 3)) {
+ client->errorValue = req->numAttribs;
+ return BadValue;
+ }
+ REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq,
+ req->numAttribs << 3);
+ attribs = (CARD32 *) (req + 1);
+ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
+
+ return __glXDisp_ChangeDrawableAttributesSGIX(cl, pc);
+}
+
+int
+__glXDispSwap_CreateWindow(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ CARD32 *attribs;
+
+ REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq);
+
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->window);
+ __GLX_SWAP_INT(&req->glxwindow);
+ __GLX_SWAP_INT(&req->numAttribs);
+
+ if (req->numAttribs > (UINT32_MAX >> 3)) {
+ client->errorValue = req->numAttribs;
+ return BadValue;
+ }
+ REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
+ attribs = (CARD32 *) (req + 1);
+ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
+
+ return __glXDisp_CreateWindow(cl, pc);
+}
+
+int
+__glXDispSwap_DestroyWindow(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq);
+
+ __GLX_SWAP_INT(&req->glxwindow);
+
+ return __glXDisp_DestroyWindow(cl, pc);
+}
+
+int
+__glXDispSwap_SwapBuffers(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXSwapBuffersReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->drawable);
+
+ return __glXDisp_SwapBuffers(cl, pc);
+}
+
+int
+__glXDispSwap_UseXFont(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXUseXFontReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->font);
+ __GLX_SWAP_INT(&req->first);
+ __GLX_SWAP_INT(&req->count);
+ __GLX_SWAP_INT(&req->listBase);
+
+ return __glXDisp_UseXFont(cl, pc);
+}
+
+int
+__glXDispSwap_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+
+ return __glXDisp_QueryExtensionsString(cl, pc);
+}
+
+int
+__glXDispSwap_QueryServerString(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXQueryServerStringReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->name);
+
+ return __glXDisp_QueryServerString(cl, pc);
+}
+
+int
+__glXDispSwap_ClientInfo(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->major);
+ __GLX_SWAP_INT(&req->minor);
+ __GLX_SWAP_INT(&req->numbytes);
+
+ return __glXDisp_ClientInfo(cl, pc);
+}
+
+int
+__glXDispSwap_QueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+
+ return __glXDisp_QueryContextInfoEXT(cl, pc);
+}
+
+int
+__glXDispSwap_BindTexImageEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ GLXDrawable *drawId;
+ int *buffer;
+ CARD32 *num_attribs;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len)
+ return BadLength;
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+
+ drawId = ((GLXDrawable *) (pc));
+ buffer = ((int *) (pc + 4));
+ num_attribs = ((CARD32 *) (pc + 8));
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(drawId);
+ __GLX_SWAP_INT(buffer);
+ __GLX_SWAP_INT(num_attribs);
+
+ return __glXDisp_BindTexImageEXT(cl, (GLbyte *) pc);
+}
+
+int
+__glXDispSwap_ReleaseTexImageEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ GLXDrawable *drawId;
+ int *buffer;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+
+ drawId = ((GLXDrawable *) (pc));
+ buffer = ((int *) (pc + 4));
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(drawId);
+ __GLX_SWAP_INT(buffer);
+
+ return __glXDisp_ReleaseTexImageEXT(cl, (GLbyte *) pc);
+}
+
+int
+__glXDispSwap_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ GLXDrawable *drawId;
+ int *buffer;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20);
+
+ (void) drawId;
+ (void) buffer;
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(pc);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+
+ return __glXDisp_CopySubBufferMESA(cl, pc);
+
+}
+
+int
+__glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *) pc;
+ CARD32 *data;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq);
+
+ data = (CARD32 *) (req + 1);
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(data);
+
+ return __glXDisp_GetDrawableAttributesSGIX(cl, pc);
+}
+
+int
+__glXDispSwap_GetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+
+ return __glXDisp_GetDrawableAttributes(cl, pc);
+}
+
+/************************************************************************/
+
+/*
+** Swap replies.
+*/
+
+void
+__glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply * reply)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->contextTag);
+ WriteToClient(client, sz_xGLXMakeCurrentReply, (char *) reply);
+}
+
+void
+__glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *) reply);
+}
+
+void
+__glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->majorVersion);
+ __GLX_SWAP_INT(&reply->minorVersion);
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *) reply);
+}
+
+void
+glxSwapQueryExtensionsStringReply(ClientPtr client,
+ xGLXQueryExtensionsStringReply * reply,
+ char *buf)
+{
+ int length = reply->length;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->n);
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *) reply);
+ __GLX_SWAP_INT_ARRAY((int *) buf, length);
+ WriteToClient(client, length << 2, buf);
+}
+
+void
+glxSwapQueryServerStringReply(ClientPtr client,
+ xGLXQueryServerStringReply * reply, char *buf)
+{
+ int length = reply->length;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->n);
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) reply);
+ /** no swap is needed for an array of chars **/
+ /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
+ WriteToClient(client, length << 2, buf);
+}
+
+void
+__glXSwapQueryContextInfoEXTReply(ClientPtr client,
+ xGLXQueryContextInfoEXTReply * reply,
+ int *buf)
+{
+ int length = reply->length;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->n);
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) reply);
+ __GLX_SWAP_INT_ARRAY((int *) buf, length);
+ WriteToClient(client, length << 2, (char *) buf);
+}
+
+void
+__glXSwapGetDrawableAttributesReply(ClientPtr client,
+ xGLXGetDrawableAttributesReply * reply,
+ CARD32 *buf)
+{
+ int length = reply->length;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->numAttribs);
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *) reply);
+ __GLX_SWAP_INT_ARRAY((int *) buf, length);
+ WriteToClient(client, length << 2, (char *) buf);
+}
+
+/************************************************************************/
+
+/*
+** Render and Renderlarge are not in the GLX API. They are used by the GLX
+** client library to send batches of GL rendering commands.
+*/
+
+int
+__glXDispSwap_Render(__GLXclientState * cl, GLbyte * pc)
+{
+ return __glXDisp_Render(cl, pc);
+}
+
+/*
+** Execute a large rendering request (one that spans multiple X requests).
+*/
+int
+__glXDispSwap_RenderLarge(__GLXclientState * cl, GLbyte * pc)
+{
+ return __glXDisp_RenderLarge(cl, pc);
+}
+
+/************************************************************************/
+
+/*
+** No support is provided for the vendor-private requests other than
+** allocating these entry points in the dispatch table.
+*/
+
+int
+__glXDispSwap_VendorPrivate(__GLXclientState * cl, GLbyte * pc)
+{
+ xGLXVendorPrivateReq *req;
+ GLint vendorcode;
+ __GLXdispatchVendorPrivProcPtr proc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ req = (xGLXVendorPrivateReq *) pc;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+
+ vendorcode = req->vendorCode;
+
+ proc = (__GLXdispatchVendorPrivProcPtr)
+ __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info,
+ vendorcode, 1);
+ if (proc != NULL) {
+ (*proc) (cl, (GLbyte *) req);
+ return Success;
+ }
+
+ cl->client->errorValue = req->vendorCode;
+ return __glXError(GLXUnsupportedPrivateRequest);
+}
+
+int
+__glXDispSwap_VendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc)
+{
+ xGLXVendorPrivateWithReplyReq *req;
+ GLint vendorcode;
+ __GLXdispatchVendorPrivProcPtr proc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ req = (xGLXVendorPrivateWithReplyReq *) pc;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+
+ vendorcode = req->vendorCode;
+
+ proc = (__GLXdispatchVendorPrivProcPtr)
+ __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info,
+ vendorcode, 1);
+ if (proc != NULL) {
+ return (*proc) (cl, (GLbyte *) req);
+ }
+
+ cl->client->errorValue = req->vendorCode;
+ return __glXError(GLXUnsupportedPrivateRequest);
+}
diff --git a/xorg-server/glx/glxcontext.h b/xorg-server/glx/glxcontext.h
index 052db81c5..ef2c4dbd5 100644
--- a/xorg-server/glx/glxcontext.h
+++ b/xorg-server/glx/glxcontext.h
@@ -1,131 +1,124 @@
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _GLX_context_h_
-#define _GLX_context_h_
-
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
-struct __GLXtextureFromPixmap {
- int (*bindTexImage) (__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap);
- int (*releaseTexImage) (__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap);
-};
-
-
-struct __GLXcontext {
- void (*destroy) (__GLXcontext *context);
- int (*makeCurrent) (__GLXcontext *context);
- int (*loseCurrent) (__GLXcontext *context);
- int (*copy) (__GLXcontext *dst,
- __GLXcontext *src,
- unsigned long mask);
- Bool (*wait) (__GLXcontext *context,
- __GLXclientState *cl,
- int *error);
-
- __GLXtextureFromPixmap *textureFromPixmap;
-
- /*
- ** list of context structs
- */
- __GLXcontext *last;
- __GLXcontext *next;
-
- /*
- ** config struct for this context
- */
- __GLXconfig *config;
-
- /*
- ** Pointer to screen info data for this context. This is set
- ** when the context is created.
- */
- __GLXscreen *pGlxScreen;
-
- /*
- ** The XID of this context.
- */
- XID id;
-
- /*
- ** The XID of the shareList context.
- */
- XID share_id;
-
- /*
- ** Whether this context's ID still exists.
- */
- GLboolean idExists;
-
- /*
- ** Whether this context is current for some client.
- */
- GLboolean isCurrent;
-
- /*
- ** Whether this context is a direct rendering context.
- */
- GLboolean isDirect;
-
- /*
- ** This flag keeps track of whether there are unflushed GL commands.
- */
- GLboolean hasUnflushedCommands;
-
- /*
- ** Current rendering mode for this context.
- */
- GLenum renderMode;
-
- /*
- ** Buffers for feedback and selection.
- */
- GLfloat *feedbackBuf;
- GLint feedbackBufSize; /* number of elements allocated */
- GLuint *selectBuf;
- GLint selectBufSize; /* number of elements allocated */
-
- /*
- ** The drawable private this context is bound to
- */
- __GLXdrawable *drawPriv;
- __GLXdrawable *readPriv;
-};
-
-void __glXContextDestroy(__GLXcontext *context);
-
-#endif /* !__GLX_context_h__ */
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _GLX_context_h_
+#define _GLX_context_h_
+
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
+struct __GLXtextureFromPixmap {
+ int (*bindTexImage) (__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap);
+ int (*releaseTexImage) (__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap);
+};
+
+struct __GLXcontext {
+ void (*destroy) (__GLXcontext * context);
+ int (*makeCurrent) (__GLXcontext * context);
+ int (*loseCurrent) (__GLXcontext * context);
+ int (*copy) (__GLXcontext * dst, __GLXcontext * src, unsigned long mask);
+ Bool (*wait) (__GLXcontext * context, __GLXclientState * cl, int *error);
+
+ __GLXtextureFromPixmap *textureFromPixmap;
+
+ /*
+ ** list of context structs
+ */
+ __GLXcontext *last;
+ __GLXcontext *next;
+
+ /*
+ ** config struct for this context
+ */
+ __GLXconfig *config;
+
+ /*
+ ** Pointer to screen info data for this context. This is set
+ ** when the context is created.
+ */
+ __GLXscreen *pGlxScreen;
+
+ /*
+ ** The XID of this context.
+ */
+ XID id;
+
+ /*
+ ** The XID of the shareList context.
+ */
+ XID share_id;
+
+ /*
+ ** Whether this context's ID still exists.
+ */
+ GLboolean idExists;
+
+ /*
+ ** Whether this context is current for some client.
+ */
+ GLboolean isCurrent;
+
+ /*
+ ** Whether this context is a direct rendering context.
+ */
+ GLboolean isDirect;
+
+ /*
+ ** This flag keeps track of whether there are unflushed GL commands.
+ */
+ GLboolean hasUnflushedCommands;
+
+ /*
+ ** Current rendering mode for this context.
+ */
+ GLenum renderMode;
+
+ /*
+ ** Buffers for feedback and selection.
+ */
+ GLfloat *feedbackBuf;
+ GLint feedbackBufSize; /* number of elements allocated */
+ GLuint *selectBuf;
+ GLint selectBufSize; /* number of elements allocated */
+
+ /*
+ ** The drawable private this context is bound to
+ */
+ __GLXdrawable *drawPriv;
+ __GLXdrawable *readPriv;
+};
+
+void __glXContextDestroy(__GLXcontext * context);
+
+#endif /* !__GLX_context_h__ */
diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c
index dc1adb9de..f256949c3 100644
--- a/xorg-server/glx/glxdri.c
+++ b/xorg-server/glx/glxdri.c
@@ -65,17 +65,17 @@
#include "dispatch.h"
#include "extension_string.h"
-typedef struct __GLXDRIscreen __GLXDRIscreen;
-typedef struct __GLXDRIcontext __GLXDRIcontext;
+typedef struct __GLXDRIscreen __GLXDRIscreen;
+typedef struct __GLXDRIcontext __GLXDRIcontext;
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
struct __GLXDRIscreen {
- __GLXscreen base;
- __DRIscreen *driScreen;
- void *driver;
+ __GLXscreen base;
+ __DRIscreen *driScreen;
+ void *driver;
- xf86EnterVTProc *enterVT;
- xf86LeaveVTProc *leaveVT;
+ xf86EnterVTProc *enterVT;
+ xf86LeaveVTProc *leaveVT;
const __DRIcoreExtension *core;
const __DRIlegacyExtension *legacy;
@@ -119,128 +119,127 @@ __glXDRIleaveServer(GLboolean rendering)
int i;
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
- __GLXDRIscreen * const screen =
- (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
- GLuint lastOverride = screen->lastTexOffsetOverride;
-
- if (lastOverride) {
- __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
- int j;
-
- for (j = 0; j < lastOverride; j++) {
- __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
-
- if (pGlxPix && pGlxPix->texname) {
- pGlxPix->offset =
- screen->texOffsetStart((PixmapPtr)pGlxPix->base.pDraw);
- }
- }
- }
+ __GLXDRIscreen *const screen =
+ (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
+ GLuint lastOverride = screen->lastTexOffsetOverride;
+
+ if (lastOverride) {
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
+ int j;
+
+ for (j = 0; j < lastOverride; j++) {
+ __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
+
+ if (pGlxPix && pGlxPix->texname) {
+ pGlxPix->offset =
+ screen->texOffsetStart((PixmapPtr) pGlxPix->base.pDraw);
+ }
+ }
+ }
}
DRIBlockHandler(NULL, NULL, NULL);
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
- __GLXDRIscreen * const screen =
- (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
- GLuint lastOverride = screen->lastTexOffsetOverride;
-
- if (lastOverride) {
- __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
- int j;
-
- for (j = 0; j < lastOverride; j++) {
- __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
-
- if (pGlxPix && pGlxPix->texname) {
- screen->texOffset->setTexOffset(pGlxPix->ctx->driContext,
- pGlxPix->texname,
- pGlxPix->offset,
- pGlxPix->base.pDraw->depth,
- ((PixmapPtr)pGlxPix->base.pDraw)->devKind);
- }
- }
- }
+ __GLXDRIscreen *const screen =
+ (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
+ GLuint lastOverride = screen->lastTexOffsetOverride;
+
+ if (lastOverride) {
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
+ int j;
+
+ for (j = 0; j < lastOverride; j++) {
+ __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
+
+ if (pGlxPix && pGlxPix->texname) {
+ screen->texOffset->setTexOffset(pGlxPix->ctx->driContext,
+ pGlxPix->texname,
+ pGlxPix->offset,
+ pGlxPix->base.pDraw->depth,
+ ((PixmapPtr) pGlxPix->base.
+ pDraw)->devKind);
+ }
+ }
+ }
}
}
-
+
static void
__glXDRIenterServer(GLboolean rendering)
{
int i;
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
- __GLXDRIscreen * const screen = (__GLXDRIscreen *)
- glxGetScreen(screenInfo.screens[i]);
+ __GLXDRIscreen *const screen = (__GLXDRIscreen *)
+ glxGetScreen(screenInfo.screens[i]);
- if (screen->lastTexOffsetOverride) {
- CALL_Flush(GET_DISPATCH(), ());
- break;
- }
+ if (screen->lastTexOffsetOverride) {
+ CALL_Flush(GET_DISPATCH(), ());
+ break;
+ }
}
DRIWakeupHandler(NULL, 0, NULL);
}
-
static void
-__glXDRIdoReleaseTexImage(__GLXDRIscreen *screen, __GLXDRIdrawable *drawable)
+__glXDRIdoReleaseTexImage(__GLXDRIscreen * screen, __GLXDRIdrawable * drawable)
{
GLuint lastOverride = screen->lastTexOffsetOverride;
if (lastOverride) {
- __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
- int i;
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
+ int i;
- for (i = 0; i < lastOverride; i++) {
- if (texOffsetOverride[i] == drawable) {
- if (screen->texOffsetFinish)
- screen->texOffsetFinish((PixmapPtr)drawable->base.pDraw);
+ for (i = 0; i < lastOverride; i++) {
+ if (texOffsetOverride[i] == drawable) {
+ if (screen->texOffsetFinish)
+ screen->texOffsetFinish((PixmapPtr) drawable->base.pDraw);
- texOffsetOverride[i] = NULL;
+ texOffsetOverride[i] = NULL;
- if (i + 1 == lastOverride) {
- lastOverride = 0;
+ if (i + 1 == lastOverride) {
+ lastOverride = 0;
- while (i--) {
- if (texOffsetOverride[i]) {
- lastOverride = i + 1;
- break;
- }
- }
+ while (i--) {
+ if (texOffsetOverride[i]) {
+ lastOverride = i + 1;
+ break;
+ }
+ }
- screen->lastTexOffsetOverride = lastOverride;
+ screen->lastTexOffsetOverride = lastOverride;
- break;
- }
- }
- }
+ break;
+ }
+ }
+ }
}
}
-
static void
-__glXDRIdrawableDestroy(__GLXdrawable *drawable)
+__glXDRIdrawableDestroy(__GLXdrawable * drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
__GLXDRIscreen *screen;
int i;
for (i = 0; i < screenInfo.numScreens; i++) {
- screen = (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
- __glXDRIdoReleaseTexImage(screen, private);
+ screen = (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
+ __glXDRIdoReleaseTexImage(screen, private);
}
/* If the X window was destroyed, the dri DestroyWindow hook will
* aready have taken care of this, so only call if pDraw isn't NULL. */
if (drawable->pDraw != NULL) {
- screen = (__GLXDRIscreen *) glxGetScreen(drawable->pDraw->pScreen);
- (*screen->core->destroyDrawable)(private->driDrawable);
+ screen = (__GLXDRIscreen *) glxGetScreen(drawable->pDraw->pScreen);
+ (*screen->core->destroyDrawable) (private->driDrawable);
- __glXenterServer(GL_FALSE);
- DRIDestroyDrawable(drawable->pDraw->pScreen,
- serverClient, drawable->pDraw);
- __glXleaveServer(GL_FALSE);
+ __glXenterServer(GL_FALSE);
+ DRIDestroyDrawable(drawable->pDraw->pScreen,
+ serverClient, drawable->pDraw);
+ __glXleaveServer(GL_FALSE);
}
__glXDrawableRelease(drawable);
@@ -249,46 +248,44 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
}
static GLboolean
-__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *basePrivate)
+__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable * basePrivate)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
__GLXDRIscreen *screen =
- (__GLXDRIscreen *) glxGetScreen(basePrivate->pDraw->pScreen);
+ (__GLXDRIscreen *) glxGetScreen(basePrivate->pDraw->pScreen);
- (*screen->core->swapBuffers)(private->driDrawable);
+ (*screen->core->swapBuffers) (private->driDrawable);
return TRUE;
}
-
static int
-__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
+__glXDRIdrawableSwapInterval(__GLXdrawable * baseDrawable, int interval)
{
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
__GLXDRIscreen *screen =
- (__GLXDRIscreen *) glxGetScreen(baseDrawable->pDraw->pScreen);
+ (__GLXDRIscreen *) glxGetScreen(baseDrawable->pDraw->pScreen);
if (screen->swapControl)
- screen->swapControl->setSwapInterval(draw->driDrawable, interval);
+ screen->swapControl->setSwapInterval(draw->driDrawable, interval);
return 0;
}
-
static void
-__glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
- int x, int y, int w, int h)
+__glXDRIdrawableCopySubBuffer(__GLXdrawable * basePrivate,
+ int x, int y, int w, int h)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
__GLXDRIscreen *screen = (__GLXDRIscreen *)
- glxGetScreen(basePrivate->pDraw->pScreen);
+ glxGetScreen(basePrivate->pDraw->pScreen);
if (screen->copySubBuffer)
- screen->copySubBuffer->copySubBuffer(private->driDrawable, x, y, w, h);
+ screen->copySubBuffer->copySubBuffer(private->driDrawable, x, y, w, h);
}
static void
-__glXDRIcontextDestroy(__GLXcontext *baseContext)
+__glXDRIcontextDestroy(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
@@ -298,7 +295,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext)
__glXenterServer(GL_FALSE);
retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen,
- context->hwContextID);
+ context->hwContextID);
__glXleaveServer(GL_FALSE);
__glXContextDestroy(&context->base);
@@ -306,54 +303,52 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext)
}
static int
-__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
+__glXDRIcontextMakeCurrent(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
- return (*screen->core->bindContext)(context->driContext,
- draw->driDrawable,
- read->driDrawable);
-}
+ return (*screen->core->bindContext) (context->driContext,
+ draw->driDrawable, read->driDrawable);
+}
static int
-__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
+__glXDRIcontextLoseCurrent(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
- return (*screen->core->unbindContext)(context->driContext);
+ return (*screen->core->unbindContext) (context->driContext);
}
static int
-__glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
- unsigned long mask)
+__glXDRIcontextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc,
+ unsigned long mask)
{
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
__GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
- return (*screen->core->copyContext)(dst->driContext,
- src->driContext, mask);
+ return (*screen->core->copyContext) (dst->driContext,
+ src->driContext, mask);
}
static void
-glxFillAlphaChannel (CARD32 *pixels, CARD32 rowstride, int width, int height)
+glxFillAlphaChannel(CARD32 *pixels, CARD32 rowstride, int width, int height)
{
int i;
CARD32 *p, *end;
rowstride /= 4;
-
- for (i = 0; i < height; i++)
- {
- p = pixels;
- end = p + width;
- while (p < end)
- *p++ |= 0xFF000000;
- pixels += rowstride;
+
+ for (i = 0; i < height; i++) {
+ p = pixels;
+ end = p + width;
+ while (p < end)
+ *p++ |= 0xFF000000;
+ pixels += rowstride;
}
}
@@ -363,7 +358,7 @@ testTexOffset(__GLXDRIscreen * const screen, PixmapPtr pPixmap)
Bool ret;
if (!screen->texOffsetStart || !screen->texOffset)
- return FALSE;
+ return FALSE;
__glXenterServer(GL_FALSE);
ret = screen->texOffsetStart(pPixmap) != ~0ULL;
@@ -385,195 +380,191 @@ testTexOffset(__GLXDRIscreen * const screen, PixmapPtr pPixmap)
*/
static int
-__glXDRIbindTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *glxPixmap)
+__glXDRIbindTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * glxPixmap)
{
- RegionPtr pRegion = NULL;
- PixmapPtr pixmap;
- int bpp, override = 0, texname;
- GLenum format, type;
+ RegionPtr pRegion = NULL;
+ PixmapPtr pixmap;
+ int bpp, override = 0, texname;
+ GLenum format, type;
ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
__GLXDRIdrawable *driDraw = (__GLXDRIdrawable *) glxPixmap;
- __GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
+ __GLXDRIscreen *const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
- GL_TEXTURE_BINDING_2D :
- GL_TEXTURE_BINDING_RECTANGLE_NV,
- &texname));
+ GL_TEXTURE_BINDING_2D :
+ GL_TEXTURE_BINDING_RECTANGLE_NV,
+ &texname));
if (!texname)
- return __glXError(GLXBadContextState);
+ return __glXError(GLXBadContextState);
pixmap = (PixmapPtr) glxPixmap->pDraw;
if (testTexOffset(screen, pixmap)) {
- __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
- int i, firstEmpty = 16;
+ __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
+ int i, firstEmpty = 16;
- for (i = 0; i < 16; i++) {
- if (texOffsetOverride[i] == driDraw)
- goto alreadyin;
+ for (i = 0; i < 16; i++) {
+ if (texOffsetOverride[i] == driDraw)
+ goto alreadyin;
- if (firstEmpty == 16 && !texOffsetOverride[i])
- firstEmpty = i;
- }
+ if (firstEmpty == 16 && !texOffsetOverride[i])
+ firstEmpty = i;
+ }
- if (firstEmpty == 16) {
- ErrorF("%s: Failed to register texture offset override\n", __func__);
- goto nooverride;
- }
+ if (firstEmpty == 16) {
+ ErrorF("%s: Failed to register texture offset override\n",
+ __func__);
+ goto nooverride;
+ }
- if (firstEmpty >= screen->lastTexOffsetOverride)
- screen->lastTexOffsetOverride = firstEmpty + 1;
+ if (firstEmpty >= screen->lastTexOffsetOverride)
+ screen->lastTexOffsetOverride = firstEmpty + 1;
- texOffsetOverride[firstEmpty] = driDraw;
+ texOffsetOverride[firstEmpty] = driDraw;
-alreadyin:
- override = 1;
+ alreadyin:
+ override = 1;
- driDraw->ctx = (__GLXDRIcontext*)baseContext;
+ driDraw->ctx = (__GLXDRIcontext *) baseContext;
- if (texname == driDraw->texname)
- return Success;
+ if (texname == driDraw->texname)
+ return Success;
- driDraw->texname = texname;
+ driDraw->texname = texname;
- screen->texOffset->setTexOffset(driDraw->ctx->driContext, texname, 0,
- pixmap->drawable.depth,
- pixmap->devKind);
+ screen->texOffset->setTexOffset(driDraw->ctx->driContext, texname, 0,
+ pixmap->drawable.depth,
+ pixmap->devKind);
}
-nooverride:
+ nooverride:
if (!driDraw->pDamage) {
- if (!override) {
- driDraw->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
- TRUE, pScreen, NULL);
- if (!driDraw->pDamage)
- return BadAlloc;
-
- DamageRegister ((DrawablePtr) pixmap, driDraw->pDamage);
- }
-
- pRegion = NULL;
- } else {
- pRegion = DamageRegion(driDraw->pDamage);
- if (RegionNil(pRegion))
- return Success;
+ if (!override) {
+ driDraw->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
+ TRUE, pScreen, NULL);
+ if (!driDraw->pDamage)
+ return BadAlloc;
+
+ DamageRegister((DrawablePtr) pixmap, driDraw->pDamage);
+ }
+
+ pRegion = NULL;
+ }
+ else {
+ pRegion = DamageRegion(driDraw->pDamage);
+ if (RegionNil(pRegion))
+ return Success;
}
/* XXX 24bpp packed, 8, etc */
if (pixmap->drawable.depth >= 24) {
- bpp = 4;
- format = GL_BGRA;
- type =
+ bpp = 4;
+ format = GL_BGRA;
+ type =
#if X_BYTE_ORDER == X_BIG_ENDIAN
- !override ? GL_UNSIGNED_INT_8_8_8_8_REV :
+ !override ? GL_UNSIGNED_INT_8_8_8_8_REV :
#endif
- GL_UNSIGNED_BYTE;
- } else {
- bpp = 2;
- format = GL_RGB;
- type = GL_UNSIGNED_SHORT_5_6_5;
+ GL_UNSIGNED_BYTE;
+ }
+ else {
+ bpp = 2;
+ format = GL_RGB;
+ type = GL_UNSIGNED_SHORT_5_6_5;
}
- if (pRegion == NULL)
- {
- void *data = NULL;
-
- if (!override) {
- unsigned pitch = PixmapBytePad(pixmap->drawable.width,
- pixmap->drawable.depth);
-
- data = malloc(pitch * pixmap->drawable.height);
-
- __glXenterServer(GL_FALSE);
- pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x*/,
- 0 /*pixmap->drawable.y*/, pixmap->drawable.width,
- pixmap->drawable.height, ZPixmap, ~0, data);
- __glXleaveServer(GL_FALSE);
-
- if (pixmap->drawable.depth == 24)
- glxFillAlphaChannel(data,
- pitch,
- pixmap->drawable.width,
- pixmap->drawable.height);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
- pitch / bpp) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) );
- }
-
- CALL_TexImage2D( GET_DISPATCH(),
- (glxPixmap->target,
- 0,
- bpp == 4 ? 4 : 3,
- pixmap->drawable.width,
- pixmap->drawable.height,
- 0,
- format,
- type,
- data) );
-
- free(data);
- } else if (!override) {
+ if (pRegion == NULL) {
+ void *data = NULL;
+
+ if (!override) {
+ unsigned pitch = PixmapBytePad(pixmap->drawable.width,
+ pixmap->drawable.depth);
+
+ data = malloc(pitch * pixmap->drawable.height);
+
+ __glXenterServer(GL_FALSE);
+ pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x */ ,
+ 0 /*pixmap->drawable.y */ ,
+ pixmap->drawable.width,
+ pixmap->drawable.height, ZPixmap, ~0, data);
+ __glXleaveServer(GL_FALSE);
+
+ if (pixmap->drawable.depth == 24)
+ glxFillAlphaChannel(data,
+ pitch,
+ pixmap->drawable.width,
+ pixmap->drawable.height);
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
+ pitch / bpp));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0));
+ }
+
+ CALL_TexImage2D(GET_DISPATCH(),
+ (glxPixmap->target,
+ 0,
+ bpp == 4 ? 4 : 3,
+ pixmap->drawable.width,
+ pixmap->drawable.height, 0, format, type, data));
+
+ free(data);
+ }
+ else if (!override) {
int i, numRects;
- BoxPtr p;
-
- numRects = RegionNumRects (pRegion);
- p = RegionRects (pRegion);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) );
-
- for (i = 0; i < numRects; i++)
- {
- unsigned pitch = PixmapBytePad(p[i].x2 - p[i].x1,
- pixmap->drawable.depth);
- void *data = malloc(pitch * (p[i].y2 - p[i].y1));
-
- __glXenterServer(GL_FALSE);
- pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x +*/ p[i].x1,
- /*pixmap->drawable.y*/ + p[i].y1, p[i].x2 - p[i].x1,
- p[i].y2 - p[i].y1, ZPixmap, ~0, data);
- __glXleaveServer(GL_FALSE);
-
- if (pixmap->drawable.depth == 24)
- glxFillAlphaChannel(data,
- pitch,
- p[i].x2 - p[i].x1,
- p[i].y2 - p[i].y1);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
- pitch / bpp) );
-
- CALL_TexSubImage2D( GET_DISPATCH(),
- (glxPixmap->target,
- 0,
- p[i].x1, p[i].y1,
- p[i].x2 - p[i].x1, p[i].y2 - p[i].y1,
- format,
- type,
- data) );
-
- free(data);
- }
+ BoxPtr p;
+
+ numRects = RegionNumRects(pRegion);
+ p = RegionRects(pRegion);
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0));
+
+ for (i = 0; i < numRects; i++) {
+ unsigned pitch = PixmapBytePad(p[i].x2 - p[i].x1,
+ pixmap->drawable.depth);
+ void *data = malloc(pitch * (p[i].y2 - p[i].y1));
+
+ __glXenterServer(GL_FALSE);
+ pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x + */
+ p[i].x1,
+ /*pixmap->drawable.y */ +p[i].y1,
+ p[i].x2 - p[i].x1,
+ p[i].y2 - p[i].y1, ZPixmap, ~0, data);
+ __glXleaveServer(GL_FALSE);
+
+ if (pixmap->drawable.depth == 24)
+ glxFillAlphaChannel(data,
+ pitch,
+ p[i].x2 - p[i].x1, p[i].y2 - p[i].y1);
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
+ pitch / bpp));
+
+ CALL_TexSubImage2D(GET_DISPATCH(),
+ (glxPixmap->target,
+ 0,
+ p[i].x1, p[i].y1,
+ p[i].x2 - p[i].x1, p[i].y2 - p[i].y1,
+ format, type, data));
+
+ free(data);
+ }
}
if (!override)
- DamageEmpty(driDraw->pDamage);
+ DamageEmpty(driDraw->pDamage);
return Success;
}
static int
-__glXDRIreleaseTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap)
+__glXDRIreleaseTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap)
{
__GLXDRIscreen *screen =
- (__GLXDRIscreen *) glxGetScreen(pixmap->pDraw->pScreen);
+ (__GLXDRIscreen *) glxGetScreen(pixmap->pDraw->pScreen);
__GLXDRIdrawable *drawable = (__GLXDRIdrawable *) pixmap;
__glXDRIdoReleaseTexImage(screen, drawable);
@@ -587,7 +578,7 @@ static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
};
static void
-__glXDRIscreenDestroy(__GLXscreen *baseScreen)
+__glXDRIscreenDestroy(__GLXscreen * baseScreen)
{
int i;
@@ -600,18 +591,18 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
__glXScreenDestroy(baseScreen);
if (screen->driConfigs) {
- for (i = 0; screen->driConfigs[i] != NULL; i++)
- free((__DRIconfig **)screen->driConfigs[i]);
- free(screen->driConfigs);
+ for (i = 0; screen->driConfigs[i] != NULL; i++)
+ free((__DRIconfig **) screen->driConfigs[i]);
+ free(screen->driConfigs);
}
free(screen);
}
static __GLXcontext *
-__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
- __GLXconfig *glxConfig,
- __GLXcontext *baseShareContext)
+__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
+ __GLXconfig * glxConfig,
+ __GLXcontext * baseShareContext)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -625,55 +616,51 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
- driShare = shareContext->driContext;
+ driShare = shareContext->driContext;
else
- driShare = NULL;
+ driShare = NULL;
if (baseShareContext && baseShareContext->isDirect)
return NULL;
context = calloc(1, sizeof *context);
if (context == NULL)
- return NULL;
+ return NULL;
- context->base.destroy = __glXDRIcontextDestroy;
- context->base.makeCurrent = __glXDRIcontextMakeCurrent;
- context->base.loseCurrent = __glXDRIcontextLoseCurrent;
- context->base.copy = __glXDRIcontextCopy;
+ context->base.destroy = __glXDRIcontextDestroy;
+ context->base.makeCurrent = __glXDRIcontextMakeCurrent;
+ context->base.loseCurrent = __glXDRIcontextLoseCurrent;
+ context->base.copy = __glXDRIcontextCopy;
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
/* Find the requested X visual */
visual = pScreen->visuals;
for (i = 0; i < pScreen->numVisuals; i++, visual++)
- if (visual->vid == glxConfig->visualID)
- break;
+ if (visual->vid == glxConfig->visualID)
+ break;
if (i == pScreen->numVisuals)
- return NULL;
+ return NULL;
context->hwContextID = FakeClientID(0);
__glXenterServer(GL_FALSE);
retval = DRICreateContext(baseScreen->pScreen, visual,
- context->hwContextID, &hwContext);
+ context->hwContextID, &hwContext);
__glXleaveServer(GL_FALSE);
if (!retval)
- return NULL;
+ return NULL;
- context->driContext =
- screen->legacy->createNewContext(screen->driScreen,
- config->driConfig,
- 0, /* render type */
- driShare,
- hwContext,
- context);
+ context->driContext = screen->legacy->createNewContext(screen->driScreen, config->driConfig, 0, /* render type */
+ driShare,
+ hwContext, context);
if (context->driContext == NULL) {
- __glXenterServer(GL_FALSE);
- retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
- __glXleaveServer(GL_FALSE);
- free(context);
- return NULL;
+ __glXenterServer(GL_FALSE);
+ retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
+ __glXleaveServer(GL_FALSE);
+ free(context);
+ return NULL;
}
return &context->base;
@@ -681,12 +668,10 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
static __GLXdrawable *
__glXDRIscreenCreateDrawable(ClientPtr client,
- __GLXscreen *screen,
- DrawablePtr pDraw,
- XID drawId,
- int type,
- XID glxDrawId,
- __GLXconfig *glxConfig)
+ __GLXscreen * screen,
+ DrawablePtr pDraw,
+ XID drawId,
+ int type, XID glxDrawId, __GLXconfig * glxConfig)
{
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
@@ -696,57 +681,57 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private = calloc(1, sizeof *private);
if (private == NULL)
- return NULL;
+ return NULL;
if (!__glXDrawableInit(&private->base, screen,
- pDraw, type, glxDrawId, glxConfig)) {
+ pDraw, type, glxDrawId, glxConfig)) {
free(private);
- return NULL;
+ return NULL;
}
- private->base.destroy = __glXDRIdrawableDestroy;
- private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
+ private->base.destroy = __glXDRIdrawableDestroy;
+ private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
- private->base.waitX = NULL;
- private->base.waitGL = NULL;
+ private->base.waitX = NULL;
+ private->base.waitGL = NULL;
__glXenterServer(GL_FALSE);
retval = DRICreateDrawable(screen->pScreen, serverClient,
- pDraw, &hwDrawable);
+ pDraw, &hwDrawable);
__glXleaveServer(GL_FALSE);
if (!retval) {
free(private);
- return NULL;
+ return NULL;
}
/* The last argument is 'attrs', which is used with pbuffers which
* we currently don't support. */
private->driDrawable =
- (driScreen->legacy->createNewDrawable)(driScreen->driScreen,
- config->driConfig,
- hwDrawable, 0, NULL, private);
+ (driScreen->legacy->createNewDrawable) (driScreen->driScreen,
+ config->driConfig,
+ hwDrawable, 0, NULL, private);
if (private->driDrawable == NULL) {
- __glXenterServer(GL_FALSE);
- DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
- __glXleaveServer(GL_FALSE);
- free(private);
- return NULL;
+ __glXenterServer(GL_FALSE);
+ DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
+ __glXleaveServer(GL_FALSE);
+ free(private);
+ return NULL;
}
return &private->base;
}
static GLboolean
-getDrawableInfo(__DRIdrawable *driDrawable,
- unsigned int *index, unsigned int *stamp,
- int *x, int *y, int *width, int *height,
- int *numClipRects, drm_clip_rect_t **ppClipRects,
- int *backX, int *backY,
- int *numBackClipRects, drm_clip_rect_t **ppBackClipRects,
- void *data)
+getDrawableInfo(__DRIdrawable * driDrawable,
+ unsigned int *index, unsigned int *stamp,
+ int *x, int *y, int *width, int *height,
+ int *numClipRects, drm_clip_rect_t ** ppClipRects,
+ int *backX, int *backY,
+ int *numBackClipRects, drm_clip_rect_t ** ppBackClipRects,
+ void *data)
{
__GLXDRIdrawable *drawable = data;
ScreenPtr pScreen;
@@ -756,72 +741,72 @@ getDrawableInfo(__DRIdrawable *driDrawable,
/* If the X window has been destroyed, give up here. */
if (drawable->base.pDraw == NULL)
- return GL_FALSE;
+ return GL_FALSE;
pScreen = drawable->base.pDraw->pScreen;
__glXenterServer(GL_FALSE);
retval = DRIGetDrawableInfo(pScreen, drawable->base.pDraw, index, stamp,
- x, y, width, height,
- numClipRects, &pClipRects,
- backX, backY,
- numBackClipRects, &pBackClipRects);
+ x, y, width, height,
+ numClipRects, &pClipRects,
+ backX, backY,
+ numBackClipRects, &pBackClipRects);
__glXleaveServer(GL_FALSE);
if (retval && *numClipRects > 0) {
- size = sizeof (drm_clip_rect_t) * *numClipRects;
- *ppClipRects = malloc(size);
-
- /* Clip cliprects to screen dimensions (redirected windows) */
- if (*ppClipRects != NULL) {
- int i, j;
-
- for (i = 0, j = 0; i < *numClipRects; i++) {
- (*ppClipRects)[j].x1 = max(pClipRects[i].x1, 0);
- (*ppClipRects)[j].y1 = max(pClipRects[i].y1, 0);
- (*ppClipRects)[j].x2 = min(pClipRects[i].x2, pScreen->width);
- (*ppClipRects)[j].y2 = min(pClipRects[i].y2, pScreen->height);
-
- if ((*ppClipRects)[j].x1 < (*ppClipRects)[j].x2 &&
- (*ppClipRects)[j].y1 < (*ppClipRects)[j].y2) {
- j++;
- }
- }
-
- if (*numClipRects != j) {
- *numClipRects = j;
- *ppClipRects = realloc(*ppClipRects,
- sizeof (drm_clip_rect_t) *
- *numClipRects);
- }
- } else
- *numClipRects = 0;
+ size = sizeof(drm_clip_rect_t) * *numClipRects;
+ *ppClipRects = malloc(size);
+
+ /* Clip cliprects to screen dimensions (redirected windows) */
+ if (*ppClipRects != NULL) {
+ int i, j;
+
+ for (i = 0, j = 0; i < *numClipRects; i++) {
+ (*ppClipRects)[j].x1 = max(pClipRects[i].x1, 0);
+ (*ppClipRects)[j].y1 = max(pClipRects[i].y1, 0);
+ (*ppClipRects)[j].x2 = min(pClipRects[i].x2, pScreen->width);
+ (*ppClipRects)[j].y2 = min(pClipRects[i].y2, pScreen->height);
+
+ if ((*ppClipRects)[j].x1 < (*ppClipRects)[j].x2 &&
+ (*ppClipRects)[j].y1 < (*ppClipRects)[j].y2) {
+ j++;
+ }
+ }
+
+ if (*numClipRects != j) {
+ *numClipRects = j;
+ *ppClipRects = realloc(*ppClipRects,
+ sizeof(drm_clip_rect_t) * *numClipRects);
+ }
+ }
+ else
+ *numClipRects = 0;
}
else {
- *ppClipRects = NULL;
- *numClipRects = 0;
+ *ppClipRects = NULL;
+ *numClipRects = 0;
}
-
+
if (retval && *numBackClipRects > 0) {
- size = sizeof (drm_clip_rect_t) * *numBackClipRects;
- *ppBackClipRects = malloc(size);
- if (*ppBackClipRects != NULL)
- memcpy (*ppBackClipRects, pBackClipRects, size);
- else
- *numBackClipRects = 0;
+ size = sizeof(drm_clip_rect_t) * *numBackClipRects;
+ *ppBackClipRects = malloc(size);
+ if (*ppBackClipRects != NULL)
+ memcpy(*ppBackClipRects, pBackClipRects, size);
+ else
+ *numBackClipRects = 0;
}
else {
- *ppBackClipRects = NULL;
- *numBackClipRects = 0;
+ *ppBackClipRects = NULL;
+ *numBackClipRects = 0;
}
return retval;
}
-static void __glXReportDamage(__DRIdrawable *driDraw,
- int x, int y,
- drm_clip_rect_t *rects, int num_rects,
- GLboolean front_buffer,
- void *data)
+static void
+__glXReportDamage(__DRIdrawable * driDraw,
+ int x, int y,
+ drm_clip_rect_t * rects, int num_rects,
+ GLboolean front_buffer, void *data)
{
__GLXDRIdrawable *drawable = data;
DrawablePtr pDraw = drawable->base.pDraw;
@@ -830,29 +815,29 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
__glXenterServer(GL_FALSE);
if (RegionInitBoxes(&region, (BoxPtr) rects, num_rects)) {
- RegionTranslate(&region, pDraw->x, pDraw->y);
- DamageDamageRegion(pDraw, &region);
- RegionUninit(&region);
+ RegionTranslate(&region, pDraw->x, pDraw->y);
+ DamageDamageRegion(pDraw, &region);
+ RegionUninit(&region);
}
else {
- while (num_rects--) {
- RegionInit (&region, (BoxPtr) rects++, 1);
- RegionTranslate(&region, pDraw->x, pDraw->y);
- DamageDamageRegion(pDraw, &region);
- RegionUninit(&region);
- }
+ while (num_rects--) {
+ RegionInit(&region, (BoxPtr) rects++, 1);
+ RegionTranslate(&region, pDraw->x, pDraw->y);
+ DamageDamageRegion(pDraw, &region);
+ RegionUninit(&region);
+ }
}
__glXleaveServer(GL_FALSE);
}
static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = {
- { __DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION },
+ {__DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION},
getDrawableInfo
};
static const __DRIdamageExtension damageExtension = {
- { __DRI_DAMAGE, __DRI_DAMAGE_VERSION },
+ {__DRI_DAMAGE, __DRI_DAMAGE_VERSION},
__glXReportDamage,
};
@@ -863,39 +848,37 @@ static const __DRIextension *loader_extensions[] = {
NULL
};
-
-
static Bool
-glxDRIEnterVT (int index, int flags)
+glxDRIEnterVT(int index, int flags)
{
ScrnInfoPtr scrn = xf86Screens[index];
- Bool ret;
- __GLXDRIscreen *screen = (__GLXDRIscreen *)
- glxGetScreen(screenInfo.screens[index]);
+ Bool ret;
+ __GLXDRIscreen *screen = (__GLXDRIscreen *)
+ glxGetScreen(screenInfo.screens[index]);
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
scrn->EnterVT = screen->enterVT;
- ret = scrn->EnterVT (index, flags);
+ ret = scrn->EnterVT(index, flags);
screen->enterVT = scrn->EnterVT;
scrn->EnterVT = glxDRIEnterVT;
if (!ret)
- return FALSE;
-
+ return FALSE;
+
glxResumeClients();
return TRUE;
}
static void
-glxDRILeaveVT (int index, int flags)
+glxDRILeaveVT(int index, int flags)
{
ScrnInfoPtr scrn = xf86Screens[index];
__GLXDRIscreen *screen = (__GLXDRIscreen *)
- glxGetScreen(screenInfo.screens[index]);
+ glxGetScreen(screenInfo.screens[index]);
LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
@@ -908,7 +891,7 @@ glxDRILeaveVT (int index, int flags)
}
static void
-initializeExtensions(__GLXDRIscreen *screen)
+initializeExtensions(__GLXDRIscreen * screen)
{
const __DRIextension **extensions;
int i;
@@ -917,86 +900,88 @@ initializeExtensions(__GLXDRIscreen *screen)
for (i = 0; extensions[i]; i++) {
#ifdef __DRI_READ_DRAWABLE
- if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_SGI_make_current_read");
-
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
- }
+ if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_make_current_read");
+
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
+ }
#endif
#ifdef __DRI_COPY_SUB_BUFFER
- if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
- screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_MESA_copy_sub_buffer");
-
- LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
- }
+ if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
+ screen->copySubBuffer =
+ (__DRIcopySubBufferExtension *) extensions[i];
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_copy_sub_buffer");
+
+ LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
+ }
#endif
#ifdef __DRI_SWAP_CONTROL
- if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
- screen->swapControl = (__DRIswapControlExtension *) extensions[i];
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_SGI_swap_control");
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_MESA_swap_control");
-
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
- }
+ if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
+ screen->swapControl = (__DRIswapControlExtension *) extensions[i];
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_swap_control");
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_swap_control");
+
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
+ }
#endif
#ifdef __DRI_TEX_OFFSET
- if (strcmp(extensions[i]->name, __DRI_TEX_OFFSET) == 0) {
- screen->texOffset = (__DRItexOffsetExtension *) extensions[i];
- LogMessage(X_INFO, "AIGLX: enabled GLX_texture_from_pixmap with driver support\n");
- }
+ if (strcmp(extensions[i]->name, __DRI_TEX_OFFSET) == 0) {
+ screen->texOffset = (__DRItexOffsetExtension *) extensions[i];
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_texture_from_pixmap with driver support\n");
+ }
#endif
- /* Ignore unknown extensions */
+ /* Ignore unknown extensions */
}
}
-
+
static __GLXscreen *
__glXDRIscreenProbe(ScreenPtr pScreen)
{
drm_handle_t hSAREA;
drmAddress pSAREA = NULL;
char *BusID;
- __DRIversion ddx_version;
- __DRIversion dri_version;
- __DRIversion drm_version;
- __DRIframebuffer framebuffer;
- int fd = -1;
- int status;
+ __DRIversion ddx_version;
+ __DRIversion dri_version;
+ __DRIversion drm_version;
+ __DRIframebuffer framebuffer;
+ int fd = -1;
+ int status;
drm_magic_t magic;
drmVersionPtr version;
int newlyopened;
char *driverName;
- drm_handle_t hFB;
- int junk;
+ drm_handle_t hFB;
+ int junk;
__GLXDRIscreen *screen;
Bool isCapable;
size_t buffer_size;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
- !DRIQueryDirectRenderingCapable(pScreen, &isCapable) ||
- !isCapable) {
- LogMessage(X_INFO,
- "AIGLX: Screen %d is not DRI capable\n", pScreen->myNum);
- return NULL;
+ !DRIQueryDirectRenderingCapable(pScreen, &isCapable) || !isCapable) {
+ LogMessage(X_INFO,
+ "AIGLX: Screen %d is not DRI capable\n", pScreen->myNum);
+ return NULL;
}
screen = calloc(1, sizeof *screen);
if (screen == NULL)
- return NULL;
+ return NULL;
- screen->base.destroy = __glXDRIscreenDestroy;
- screen->base.createContext = __glXDRIscreenCreateContext;
+ screen->base.destroy = __glXDRIscreenDestroy;
+ screen->base.createContext = __glXDRIscreenCreateContext;
screen->base.createDrawable = __glXDRIscreenCreateDrawable;
- screen->base.swapInterval = __glXDRIdrawableSwapInterval;
- screen->base.pScreen = pScreen;
+ screen->base.swapInterval = __glXDRIdrawableSwapInterval;
+ screen->base.pScreen = pScreen;
__glXInitExtensionEnableBits(screen->glx_enable_bits);
@@ -1006,62 +991,61 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
dri_version.patch = XF86DRI_PATCH_VERSION;
if (!DRIOpenConnection(pScreen, &hSAREA, &BusID)) {
- LogMessage(X_ERROR, "AIGLX error: DRIOpenConnection failed\n");
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: DRIOpenConnection failed\n");
+ goto handle_error;
}
fd = drmOpenOnce(NULL, BusID, &newlyopened);
if (fd < 0) {
- LogMessage(X_ERROR, "AIGLX error: drmOpenOnce failed (%s)\n",
- strerror(-fd));
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: drmOpenOnce failed (%s)\n",
+ strerror(-fd));
+ goto handle_error;
}
if (drmGetMagic(fd, &magic)) {
- LogMessage(X_ERROR, "AIGLX error: drmGetMagic failed\n");
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: drmGetMagic failed\n");
+ goto handle_error;
}
version = drmGetVersion(fd);
if (version) {
- drm_version.major = version->version_major;
- drm_version.minor = version->version_minor;
- drm_version.patch = version->version_patchlevel;
- drmFreeVersion(version);
+ drm_version.major = version->version_major;
+ drm_version.minor = version->version_minor;
+ drm_version.patch = version->version_patchlevel;
+ drmFreeVersion(version);
}
else {
- drm_version.major = -1;
- drm_version.minor = -1;
- drm_version.patch = -1;
+ drm_version.major = -1;
+ drm_version.minor = -1;
+ drm_version.patch = -1;
}
if (newlyopened && !DRIAuthConnection(pScreen, magic)) {
- LogMessage(X_ERROR, "AIGLX error: DRIAuthConnection failed\n");
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: DRIAuthConnection failed\n");
+ goto handle_error;
}
/* Get device name (like "tdfx") and the ddx version numbers.
* We'll check the version in each DRI driver's "createNewScreen"
* function. */
if (!DRIGetClientDriverName(pScreen,
- &ddx_version.major,
- &ddx_version.minor,
- &ddx_version.patch,
- &driverName)) {
- LogMessage(X_ERROR, "AIGLX error: DRIGetClientDriverName failed\n");
- goto handle_error;
+ &ddx_version.major,
+ &ddx_version.minor,
+ &ddx_version.patch, &driverName)) {
+ LogMessage(X_ERROR, "AIGLX error: DRIGetClientDriverName failed\n");
+ goto handle_error;
}
screen->driver = glxProbeDriver(driverName,
- (void **)&screen->core,
- __DRI_CORE, __DRI_CORE_VERSION,
- (void **)&screen->legacy,
- __DRI_LEGACY, __DRI_LEGACY_VERSION);
+ (void **) &screen->core,
+ __DRI_CORE, __DRI_CORE_VERSION,
+ (void **) &screen->legacy,
+ __DRI_LEGACY, __DRI_LEGACY_VERSION);
if (screen->driver == NULL) {
goto handle_error;
}
-
+
/*
* Get device-specific info. pDevPriv will point to a struct
* (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) that
@@ -1069,22 +1053,22 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
* buffers, DRM mmap handles, etc.
*/
if (!DRIGetDeviceInfo(pScreen, &hFB, &junk,
- &framebuffer.size, &framebuffer.stride,
- &framebuffer.dev_priv_size, &framebuffer.dev_priv)) {
- LogMessage(X_ERROR, "AIGLX error: XF86DRIGetDeviceInfo failed\n");
- goto handle_error;
+ &framebuffer.size, &framebuffer.stride,
+ &framebuffer.dev_priv_size, &framebuffer.dev_priv)) {
+ LogMessage(X_ERROR, "AIGLX error: XF86DRIGetDeviceInfo failed\n");
+ goto handle_error;
}
framebuffer.width = pScreen->width;
framebuffer.height = pScreen->height;
/* Map the framebuffer region. */
- status = drmMap(fd, hFB, framebuffer.size,
- (drmAddressPtr)&framebuffer.base);
+ status = drmMap(fd, hFB, framebuffer.size,
+ (drmAddressPtr) & framebuffer.base);
if (status != 0) {
- LogMessage(X_ERROR, "AIGLX error: drmMap of framebuffer failed (%s)\n",
- strerror(-status));
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: drmMap of framebuffer failed (%s)\n",
+ strerror(-status));
+ goto handle_error;
}
/* Map the SAREA region. Further mmap regions may be setup in
@@ -1092,37 +1076,35 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
*/
status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA);
if (status != 0) {
- LogMessage(X_ERROR, "AIGLX error: drmMap of SAREA failed (%s)\n",
- strerror(-status));
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: drmMap of SAREA failed (%s)\n",
+ strerror(-status));
+ goto handle_error;
}
-
+
screen->driScreen =
- (*screen->legacy->createNewScreen)(pScreen->myNum,
- &ddx_version,
- &dri_version,
- &drm_version,
- &framebuffer,
- pSAREA,
- fd,
- loader_extensions,
- &screen->driConfigs,
- screen);
+ (*screen->legacy->createNewScreen) (pScreen->myNum,
+ &ddx_version,
+ &dri_version,
+ &drm_version,
+ &framebuffer,
+ pSAREA,
+ fd,
+ loader_extensions,
+ &screen->driConfigs, screen);
if (screen->driScreen == NULL) {
- LogMessage(X_ERROR,
- "AIGLX error: Calling driver entry point failed\n");
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed\n");
+ goto handle_error;
}
screen->base.fbconfigs = glxConvertConfigs(screen->core,
- screen->driConfigs,
- GLX_WINDOW_BIT);
+ screen->driConfigs,
+ GLX_WINDOW_BIT);
initializeExtensions(screen);
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
- &screen->texOffsetFinish);
+ &screen->texOffsetFinish);
__glXScreenInit(&screen->base, pScreen);
@@ -1132,11 +1114,11 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
*/
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) {
- free(screen->base.GLXextensions);
+ free(screen->base.GLXextensions);
- screen->base.GLXextensions = xnfalloc(buffer_size);
- (void) __glXGetExtensionString(screen->glx_enable_bits,
- screen->base.GLXextensions);
+ screen->base.GLXextensions = xnfalloc(buffer_size);
+ (void) __glXGetExtensionString(screen->glx_enable_bits,
+ screen->base.GLXextensions);
}
__glXsetEnterLeaveServerFuncs(__glXDRIenterServer, __glXDRIleaveServer);
@@ -1146,20 +1128,19 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen->leaveVT = pScrn->LeaveVT;
pScrn->LeaveVT = glxDRILeaveVT;
- LogMessage(X_INFO,
- "AIGLX: Loaded and initialized %s\n", driverName);
+ LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
return &screen->base;
handle_error:
if (pSAREA != NULL)
- drmUnmap(pSAREA, SAREA_MAX);
+ drmUnmap(pSAREA, SAREA_MAX);
if (framebuffer.base != NULL)
- drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
+ drmUnmap((drmAddress) framebuffer.base, framebuffer.size);
if (fd >= 0)
- drmCloseOnce(fd);
+ drmCloseOnce(fd);
DRICloseConnection(pScreen);
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index 5e524db99..aa38295fa 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -54,18 +54,18 @@
#include "dispatch.h"
#include "extension_string.h"
-typedef struct __GLXDRIscreen __GLXDRIscreen;
-typedef struct __GLXDRIcontext __GLXDRIcontext;
+typedef struct __GLXDRIscreen __GLXDRIscreen;
+typedef struct __GLXDRIcontext __GLXDRIcontext;
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
struct __GLXDRIscreen {
- __GLXscreen base;
- __DRIscreen *driScreen;
- void *driver;
- int fd;
+ __GLXscreen base;
+ __DRIscreen *driScreen;
+ void *driver;
+ int fd;
- xf86EnterVTProc *enterVT;
- xf86LeaveVTProc *leaveVT;
+ xf86EnterVTProc *enterVT;
+ xf86LeaveVTProc *leaveVT;
const __DRIcoreExtension *core;
const __DRIdri2Extension *dri2;
@@ -79,16 +79,16 @@ struct __GLXDRIscreen {
};
struct __GLXDRIcontext {
- __GLXcontext base;
- __DRIcontext *driContext;
+ __GLXcontext base;
+ __DRIcontext *driContext;
};
#define MAX_DRAWABLE_BUFFERS 5
struct __GLXDRIdrawable {
- __GLXdrawable base;
- __DRIdrawable *driDrawable;
- __GLXDRIscreen *screen;
+ __GLXdrawable base;
+ __DRIdrawable *driDrawable;
+ __GLXDRIscreen *screen;
/* Dimensions as last reported by DRI2GetBuffers. */
int width;
@@ -98,12 +98,12 @@ struct __GLXDRIdrawable {
};
static void
-__glXDRIdrawableDestroy(__GLXdrawable *drawable)
+__glXDRIdrawableDestroy(__GLXdrawable * drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
const __DRIcoreExtension *core = private->screen->core;
-
- (*core->destroyDrawable)(private->driDrawable);
+
+ (*core->destroyDrawable) (private->driDrawable);
__glXDrawableRelease(drawable);
@@ -111,8 +111,8 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
}
static void
-__glXDRIdrawableCopySubBuffer(__GLXdrawable *drawable,
- int x, int y, int w, int h)
+__glXDRIdrawableCopySubBuffer(__GLXdrawable * drawable,
+ int x, int y, int w, int h)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
BoxRec box;
@@ -125,11 +125,11 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *drawable,
RegionInit(&region, &box, 0);
DRI2CopyRegion(drawable->pDraw, &region,
- DRI2BufferFrontLeft, DRI2BufferBackLeft);
+ DRI2BufferFrontLeft, DRI2BufferBackLeft);
}
static void
-__glXDRIdrawableWaitX(__GLXdrawable *drawable)
+__glXDRIdrawableWaitX(__GLXdrawable * drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
BoxRec box;
@@ -142,11 +142,11 @@ __glXDRIdrawableWaitX(__GLXdrawable *drawable)
RegionInit(&region, &box, 0);
DRI2CopyRegion(drawable->pDraw, &region,
- DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+ DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
}
static void
-__glXDRIdrawableWaitGL(__GLXdrawable *drawable)
+__glXDRIdrawableWaitGL(__GLXdrawable * drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
BoxRec box;
@@ -159,34 +159,34 @@ __glXDRIdrawableWaitGL(__GLXdrawable *drawable)
RegionInit(&region, &box, 0);
DRI2CopyRegion(drawable->pDraw, &region,
- DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
+ DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
}
static void
__glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
- CARD64 msc, CARD32 sbc)
+ CARD64 msc, CARD32 sbc)
{
__GLXdrawable *drawable = data;
xGLXBufferSwapComplete2 wire;
if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
- return;
+ return;
wire.type = __glXEventBase + GLX_BufferSwapComplete;
switch (type) {
case DRI2_EXCHANGE_COMPLETE:
- wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
- break;
+ wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+ break;
case DRI2_BLIT_COMPLETE:
- wire.event_type = GLX_BLIT_COMPLETE_INTEL;
- break;
+ wire.event_type = GLX_BLIT_COMPLETE_INTEL;
+ break;
case DRI2_FLIP_COMPLETE:
- wire.event_type = GLX_FLIP_COMPLETE_INTEL;
- break;
+ wire.event_type = GLX_FLIP_COMPLETE_INTEL;
+ break;
default:
- /* unknown swap completion type */
- wire.event_type = 0;
- break;
+ /* unknown swap completion type */
+ wire.event_type = 0;
+ break;
}
wire.drawable = drawable->drawId;
wire.ust_hi = ust >> 32;
@@ -205,7 +205,7 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
* swap should happen, then perform the copy when we receive it.
*/
static GLboolean
-__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable)
+__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable * drawable)
{
__GLXDRIdrawable *priv = (__GLXDRIdrawable *) drawable;
__GLXDRIscreen *screen = priv->screen;
@@ -213,26 +213,26 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable)
#if __DRI2_FLUSH_VERSION >= 3
if (screen->flush) {
- (*screen->flush->flush)(priv->driDrawable);
- (*screen->flush->invalidate)(priv->driDrawable);
+ (*screen->flush->flush) (priv->driDrawable);
+ (*screen->flush->invalidate) (priv->driDrawable);
}
#else
if (screen->flush)
- (*screen->flush->flushInvalidate)(priv->driDrawable);
+ (*screen->flush->flushInvalidate) (priv->driDrawable);
#endif
if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
- __glXdriSwapEvent, drawable) != Success)
- return FALSE;
+ __glXdriSwapEvent, drawable) != Success)
+ return FALSE;
return TRUE;
}
static int
-__glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval)
+__glXDRIdrawableSwapInterval(__GLXdrawable * drawable, int interval)
{
- if (interval <= 0) /* || interval > BIGNUM? */
- return GLX_BAD_VALUE;
+ if (interval <= 0) /* || interval > BIGNUM? */
+ return GLX_BAD_VALUE;
DRI2SwapInterval(drawable->pDraw, interval);
@@ -240,57 +240,56 @@ __glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval)
}
static void
-__glXDRIcontextDestroy(__GLXcontext *baseContext)
+__glXDRIcontextDestroy(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
- (*screen->core->destroyContext)(context->driContext);
+ (*screen->core->destroyContext) (context->driContext);
__glXContextDestroy(&context->base);
free(context);
}
static int
-__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
+__glXDRIcontextMakeCurrent(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
- return (*screen->core->bindContext)(context->driContext,
- draw->driDrawable,
- read->driDrawable);
-}
+ return (*screen->core->bindContext) (context->driContext,
+ draw->driDrawable, read->driDrawable);
+}
static int
-__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
+__glXDRIcontextLoseCurrent(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
- return (*screen->core->unbindContext)(context->driContext);
+ return (*screen->core->unbindContext) (context->driContext);
}
static int
-__glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
- unsigned long mask)
+__glXDRIcontextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc,
+ unsigned long mask)
{
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
__GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
- return (*screen->core->copyContext)(dst->driContext,
- src->driContext, mask);
+ return (*screen->core->copyContext) (dst->driContext,
+ src->driContext, mask);
}
static Bool
-__glXDRIcontextWait(__GLXcontext *baseContext,
- __GLXclientState *cl, int *error)
+__glXDRIcontextWait(__GLXcontext * baseContext,
+ __GLXclientState * cl, int *error)
{
if (DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw)) {
- *error = cl->client->noClientException;
- return TRUE;
+ *error = cl->client->noClientException;
+ return TRUE;
}
return FALSE;
@@ -299,9 +298,8 @@ __glXDRIcontextWait(__GLXcontext *baseContext,
#ifdef __DRI_TEX_BUFFER
static int
-__glXDRIbindTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *glxPixmap)
+__glXDRIbindTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * glxPixmap)
{
__GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap;
const __DRItexBufferExtension *texBuffer = drawable->screen->texBuffer;
@@ -312,25 +310,23 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
#if __DRI_TEX_BUFFER_VERSION >= 2
if (texBuffer->base.version >= 2 && texBuffer->setTexBuffer2 != NULL) {
- (*texBuffer->setTexBuffer2)(context->driContext,
- glxPixmap->target,
- glxPixmap->format,
- drawable->driDrawable);
- } else
+ (*texBuffer->setTexBuffer2) (context->driContext,
+ glxPixmap->target,
+ glxPixmap->format, drawable->driDrawable);
+ }
+ else
#endif
{
- texBuffer->setTexBuffer(context->driContext,
- glxPixmap->target,
- drawable->driDrawable);
+ texBuffer->setTexBuffer(context->driContext,
+ glxPixmap->target, drawable->driDrawable);
}
return Success;
}
static int
-__glXDRIreleaseTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap)
+__glXDRIreleaseTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap)
{
/* FIXME: Just unbind the texture? */
return Success;
@@ -339,17 +335,15 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext,
#else
static int
-__glXDRIbindTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *glxPixmap)
+__glXDRIbindTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * glxPixmap)
{
return Success;
}
static int
-__glXDRIreleaseTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap)
+__glXDRIreleaseTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap)
{
return Success;
}
@@ -362,31 +356,31 @@ static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
};
static void
-__glXDRIscreenDestroy(__GLXscreen *baseScreen)
+__glXDRIscreenDestroy(__GLXscreen * baseScreen)
{
int i;
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
- (*screen->core->destroyScreen)(screen->driScreen);
+ (*screen->core->destroyScreen) (screen->driScreen);
dlclose(screen->driver);
__glXScreenDestroy(baseScreen);
if (screen->driConfigs) {
- for (i = 0; screen->driConfigs[i] != NULL; i++)
- free((__DRIconfig **)screen->driConfigs[i]);
- free(screen->driConfigs);
+ for (i = 0; screen->driConfigs[i] != NULL; i++)
+ free((__DRIconfig **) screen->driConfigs[i]);
+ free(screen->driConfigs);
}
free(screen);
}
static __GLXcontext *
-__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
- __GLXconfig *glxConfig,
- __GLXcontext *baseShareContext)
+__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
+ __GLXconfig * glxConfig,
+ __GLXcontext * baseShareContext)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -395,27 +389,27 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
- driShare = shareContext->driContext;
+ driShare = shareContext->driContext;
else
- driShare = NULL;
+ driShare = NULL;
context = calloc(1, sizeof *context);
if (context == NULL)
- return NULL;
+ return NULL;
- context->base.destroy = __glXDRIcontextDestroy;
- context->base.makeCurrent = __glXDRIcontextMakeCurrent;
- context->base.loseCurrent = __glXDRIcontextLoseCurrent;
- context->base.copy = __glXDRIcontextCopy;
+ context->base.destroy = __glXDRIcontextDestroy;
+ context->base.makeCurrent = __glXDRIcontextMakeCurrent;
+ context->base.loseCurrent = __glXDRIcontextLoseCurrent;
+ context->base.copy = __glXDRIcontextCopy;
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
- context->base.wait = __glXDRIcontextWait;
+ context->base.wait = __glXDRIcontextWait;
context->driContext =
- (*screen->dri2->createNewContext)(screen->driScreen,
- config->driConfig,
- driShare, context);
+ (*screen->dri2->createNewContext) (screen->driScreen,
+ config->driConfig,
+ driShare, context);
if (context->driContext == NULL) {
- free(context);
+ free(context);
return NULL;
}
@@ -430,18 +424,16 @@ __glXDRIinvalidateBuffers(DrawablePtr pDraw, void *priv, XID id)
__GLXDRIscreen *screen = private->screen;
if (screen->flush)
- (*screen->flush->invalidate)(private->driDrawable);
+ (*screen->flush->invalidate) (private->driDrawable);
#endif
}
static __GLXdrawable *
__glXDRIscreenCreateDrawable(ClientPtr client,
- __GLXscreen *screen,
- DrawablePtr pDraw,
- XID drawId,
- int type,
- XID glxDrawId,
- __GLXconfig *glxConfig)
+ __GLXscreen * screen,
+ DrawablePtr pDraw,
+ XID drawId,
+ int type, XID glxDrawId, __GLXconfig * glxConfig)
{
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
@@ -449,39 +441,39 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private = calloc(1, sizeof *private);
if (private == NULL)
- return NULL;
+ return NULL;
private->screen = driScreen;
if (!__glXDrawableInit(&private->base, screen,
- pDraw, type, glxDrawId, glxConfig)) {
+ pDraw, type, glxDrawId, glxConfig)) {
free(private);
- return NULL;
+ return NULL;
}
- private->base.destroy = __glXDRIdrawableDestroy;
- private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
+ private->base.destroy = __glXDRIdrawableDestroy;
+ private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
- private->base.waitGL = __glXDRIdrawableWaitGL;
- private->base.waitX = __glXDRIdrawableWaitX;
+ private->base.waitGL = __glXDRIdrawableWaitGL;
+ private->base.waitX = __glXDRIdrawableWaitX;
if (DRI2CreateDrawable(client, pDraw, drawId,
- __glXDRIinvalidateBuffers, private)) {
- free(private);
- return NULL;
+ __glXDRIinvalidateBuffers, private)) {
+ free(private);
+ return NULL;
}
private->driDrawable =
- (*driScreen->dri2->createNewDrawable)(driScreen->driScreen,
- config->driConfig, private);
+ (*driScreen->dri2->createNewDrawable) (driScreen->driScreen,
+ config->driConfig, private);
return &private->base;
}
static __DRIbuffer *
-dri2GetBuffers(__DRIdrawable *driDrawable,
- int *width, int *height,
- unsigned int *attachments, int count,
- int *out_count, void *loaderPrivate)
+dri2GetBuffers(__DRIdrawable * driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate)
{
__GLXDRIdrawable *private = loaderPrivate;
DRI2BufferPtr *buffers;
@@ -489,12 +481,12 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
int j;
buffers = DRI2GetBuffers(private->base.pDraw,
- width, height, attachments, count, out_count);
+ width, height, attachments, count, out_count);
if (*out_count > MAX_DRAWABLE_BUFFERS) {
- *out_count = 0;
- return NULL;
+ *out_count = 0;
+ return NULL;
}
-
+
private->width = *width;
private->height = *height;
@@ -502,19 +494,19 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
* __DRIbuffer tokens. */
j = 0;
for (i = 0; i < *out_count; i++) {
- /* Do not send the real front buffer of a window to the client.
- */
- if ((private->base.pDraw->type == DRAWABLE_WINDOW)
- && (buffers[i]->attachment == DRI2BufferFrontLeft)) {
- continue;
- }
-
- private->buffers[j].attachment = buffers[i]->attachment;
- private->buffers[j].name = buffers[i]->name;
- private->buffers[j].pitch = buffers[i]->pitch;
- private->buffers[j].cpp = buffers[i]->cpp;
- private->buffers[j].flags = buffers[i]->flags;
- j++;
+ /* Do not send the real front buffer of a window to the client.
+ */
+ if ((private->base.pDraw->type == DRAWABLE_WINDOW)
+ && (buffers[i]->attachment == DRI2BufferFrontLeft)) {
+ continue;
+ }
+
+ private->buffers[j].attachment = buffers[i]->attachment;
+ private->buffers[j].name = buffers[i]->name;
+ private->buffers[j].pitch = buffers[i]->pitch;
+ private->buffers[j].cpp = buffers[i]->cpp;
+ private->buffers[j].flags = buffers[i]->flags;
+ j++;
}
*out_count = j;
@@ -522,10 +514,10 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
}
static __DRIbuffer *
-dri2GetBuffersWithFormat(__DRIdrawable *driDrawable,
- int *width, int *height,
- unsigned int *attachments, int count,
- int *out_count, void *loaderPrivate)
+dri2GetBuffersWithFormat(__DRIdrawable * driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate)
{
__GLXDRIdrawable *private = loaderPrivate;
DRI2BufferPtr *buffers;
@@ -533,11 +525,11 @@ dri2GetBuffersWithFormat(__DRIdrawable *driDrawable,
int j = 0;
buffers = DRI2GetBuffersWithFormat(private->base.pDraw,
- width, height, attachments, count,
- out_count);
+ width, height, attachments, count,
+ out_count);
if (*out_count > MAX_DRAWABLE_BUFFERS) {
- *out_count = 0;
- return NULL;
+ *out_count = 0;
+ return NULL;
}
private->width = *width;
@@ -546,34 +538,34 @@ dri2GetBuffersWithFormat(__DRIdrawable *driDrawable,
/* This assumes the DRI2 buffer attachment tokens matches the
* __DRIbuffer tokens. */
for (i = 0; i < *out_count; i++) {
- /* Do not send the real front buffer of a window to the client.
- */
- if ((private->base.pDraw->type == DRAWABLE_WINDOW)
- && (buffers[i]->attachment == DRI2BufferFrontLeft)) {
- continue;
- }
-
- private->buffers[j].attachment = buffers[i]->attachment;
- private->buffers[j].name = buffers[i]->name;
- private->buffers[j].pitch = buffers[i]->pitch;
- private->buffers[j].cpp = buffers[i]->cpp;
- private->buffers[j].flags = buffers[i]->flags;
- j++;
+ /* Do not send the real front buffer of a window to the client.
+ */
+ if ((private->base.pDraw->type == DRAWABLE_WINDOW)
+ && (buffers[i]->attachment == DRI2BufferFrontLeft)) {
+ continue;
+ }
+
+ private->buffers[j].attachment = buffers[i]->attachment;
+ private->buffers[j].name = buffers[i]->name;
+ private->buffers[j].pitch = buffers[i]->pitch;
+ private->buffers[j].cpp = buffers[i]->cpp;
+ private->buffers[j].flags = buffers[i]->flags;
+ j++;
}
*out_count = j;
return private->buffers;
}
-static void
-dri2FlushFrontBuffer(__DRIdrawable *driDrawable, void *loaderPrivate)
+static void
+dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate)
{
(void) driDrawable;
__glXDRIdrawableWaitGL((__GLXdrawable *) loaderPrivate);
}
static const __DRIdri2LoaderExtension loaderExtension = {
- { __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
+ {__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
dri2GetBuffers,
dri2FlushFrontBuffer,
dri2GetBuffersWithFormat,
@@ -581,7 +573,7 @@ static const __DRIdri2LoaderExtension loaderExtension = {
#ifdef __DRI_USE_INVALIDATE
static const __DRIuseInvalidateExtension dri2UseInvalidate = {
- { __DRI_USE_INVALIDATE, __DRI_USE_INVALIDATE_VERSION }
+ {__DRI_USE_INVALIDATE, __DRI_USE_INVALIDATE_VERSION}
};
#endif
@@ -595,36 +587,36 @@ static const __DRIextension *loader_extensions[] = {
};
static Bool
-glxDRIEnterVT (int index, int flags)
+glxDRIEnterVT(int index, int flags)
{
ScrnInfoPtr scrn = xf86Screens[index];
- Bool ret;
- __GLXDRIscreen *screen = (__GLXDRIscreen *)
- glxGetScreen(screenInfo.screens[index]);
+ Bool ret;
+ __GLXDRIscreen *screen = (__GLXDRIscreen *)
+ glxGetScreen(screenInfo.screens[index]);
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
scrn->EnterVT = screen->enterVT;
- ret = scrn->EnterVT (index, flags);
+ ret = scrn->EnterVT(index, flags);
screen->enterVT = scrn->EnterVT;
scrn->EnterVT = glxDRIEnterVT;
if (!ret)
- return FALSE;
-
+ return FALSE;
+
glxResumeClients();
return TRUE;
}
static void
-glxDRILeaveVT (int index, int flags)
+glxDRILeaveVT(int index, int flags)
{
ScrnInfoPtr scrn = xf86Screens[index];
__GLXDRIscreen *screen = (__GLXDRIscreen *)
- glxGetScreen(screenInfo.screens[index]);
+ glxGetScreen(screenInfo.screens[index]);
LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
@@ -637,7 +629,7 @@ glxDRILeaveVT (int index, int flags)
}
static void
-initializeExtensions(__GLXDRIscreen *screen)
+initializeExtensions(__GLXDRIscreen * screen)
{
ScreenPtr pScreen = screen->base.pScreen;
const __DRIextension **extensions;
@@ -645,48 +637,46 @@ initializeExtensions(__GLXDRIscreen *screen)
extensions = screen->core->getExtensions(screen->driScreen);
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_MESA_copy_sub_buffer");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
__glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n");
if (DRI2HasSwapControl(pScreen)) {
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_SGI_swap_control");
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_MESA_swap_control");
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_swap_control");
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
}
for (i = 0; extensions[i]; i++) {
#ifdef __DRI_READ_DRAWABLE
- if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
- __glXEnableExtension(screen->glx_enable_bits,
- "GLX_SGI_make_current_read");
+ if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_make_current_read");
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
- }
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
+ }
#endif
#ifdef __DRI_TEX_BUFFER
- if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
- screen->texBuffer =
- (const __DRItexBufferExtension *) extensions[i];
- /* GLX_EXT_texture_from_pixmap is always enabled. */
- LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n");
- }
+ if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
+ screen->texBuffer = (const __DRItexBufferExtension *) extensions[i];
+ /* GLX_EXT_texture_from_pixmap is always enabled. */
+ LogMessage(X_INFO,
+ "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n");
+ }
#endif
#ifdef __DRI2_FLUSH
- if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0 &&
- extensions[i]->version >= 3) {
- screen->flush = (__DRI2flushExtension *) extensions[i];
- }
+ if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0 &&
+ extensions[i]->version >= 3) {
+ screen->flush = (__DRI2flushExtension *) extensions[i];
+ }
#endif
- /* Ignore unknown extensions */
+ /* Ignore unknown extensions */
}
}
@@ -700,49 +690,48 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen = calloc(1, sizeof *screen);
if (screen == NULL)
- return NULL;
+ return NULL;
if (!xf86LoaderCheckSymbol("DRI2Connect") ||
- !DRI2Connect(pScreen, DRI2DriverDRI,
- &screen->fd, &driverName, &deviceName)) {
- LogMessage(X_INFO,
- "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
- return NULL;
+ !DRI2Connect(pScreen, DRI2DriverDRI,
+ &screen->fd, &driverName, &deviceName)) {
+ LogMessage(X_INFO,
+ "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
+ return NULL;
}
- screen->base.destroy = __glXDRIscreenDestroy;
- screen->base.createContext = __glXDRIscreenCreateContext;
+ screen->base.destroy = __glXDRIscreenDestroy;
+ screen->base.createContext = __glXDRIscreenCreateContext;
screen->base.createDrawable = __glXDRIscreenCreateDrawable;
- screen->base.swapInterval = __glXDRIdrawableSwapInterval;
- screen->base.pScreen = pScreen;
+ screen->base.swapInterval = __glXDRIdrawableSwapInterval;
+ screen->base.pScreen = pScreen;
__glXInitExtensionEnableBits(screen->glx_enable_bits);
- screen->driver = glxProbeDriver(driverName, (void **)&screen->core, __DRI_CORE, 1,
- (void **)&screen->dri2, __DRI_DRI2, 1);
+ screen->driver =
+ glxProbeDriver(driverName, (void **) &screen->core, __DRI_CORE, 1,
+ (void **) &screen->dri2, __DRI_DRI2, 1);
if (screen->driver == NULL) {
goto handle_error;
}
-
+
screen->driScreen =
- (*screen->dri2->createNewScreen)(pScreen->myNum,
- screen->fd,
- loader_extensions,
- &screen->driConfigs,
- screen);
+ (*screen->dri2->createNewScreen) (pScreen->myNum,
+ screen->fd,
+ loader_extensions,
+ &screen->driConfigs, screen);
if (screen->driScreen == NULL) {
- LogMessage(X_ERROR,
- "AIGLX error: Calling driver entry point failed\n");
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed\n");
+ goto handle_error;
}
initializeExtensions(screen);
screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs,
- GLX_WINDOW_BIT |
- GLX_PIXMAP_BIT |
- GLX_PBUFFER_BIT);
+ GLX_WINDOW_BIT |
+ GLX_PIXMAP_BIT |
+ GLX_PBUFFER_BIT);
__glXScreenInit(&screen->base, pScreen);
@@ -752,11 +741,11 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
*/
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) {
- free(screen->base.GLXextensions);
+ free(screen->base.GLXextensions);
- screen->base.GLXextensions = xnfalloc(buffer_size);
- (void) __glXGetExtensionString(screen->glx_enable_bits,
- screen->base.GLXextensions);
+ screen->base.GLXextensions = xnfalloc(buffer_size);
+ (void) __glXGetExtensionString(screen->glx_enable_bits,
+ screen->base.GLXextensions);
}
/* We're going to assume (perhaps incorrectly?) that all DRI2-enabled
@@ -770,14 +759,13 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
*/
screen->base.GLXmajor = 1;
screen->base.GLXminor = 4;
-
+
screen->enterVT = pScrn->EnterVT;
- pScrn->EnterVT = glxDRIEnterVT;
+ pScrn->EnterVT = glxDRIEnterVT;
screen->leaveVT = pScrn->LeaveVT;
pScrn->LeaveVT = glxDRILeaveVT;
- LogMessage(X_INFO,
- "AIGLX: Loaded and initialized %s\n", driverName);
+ LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
return &screen->base;
diff --git a/xorg-server/glx/glxdricommon.c b/xorg-server/glx/glxdricommon.c
index a51d6621a..6e310f1cd 100644
--- a/xorg-server/glx/glxdricommon.c
+++ b/xorg-server/glx/glxdricommon.c
@@ -1,295 +1,298 @@
-/*
- * Copyright © 2008 Red Hat, Inc
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of the
- * copyright holders not be used in advertising or publicity
- * pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied
- * warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#else
-
-#include "glheader.h"
-
-#endif
-
-#include <stdint.h>
-#include <errno.h>
-#include <dlfcn.h>
-#include <sys/time.h>
-#include <GL/gl.h>
-#include <GL/glxtokens.h>
-#include <GL/internal/dri_interface.h>
-#include <os.h>
-#include "glxserver.h"
-#include "glxcontext.h"
-#include "glxscreens.h"
-#include "glxdricommon.h"
-
-#ifdef _MSC_VER
-#define dlerror() "Getting loadlibrary error string not implemented"
-#endif
-
-static int
-getUST(int64_t *ust)
-{
- struct timeval tv;
-
- if (ust == NULL)
- return -EFAULT;
-
-#ifdef _MSC_VER
- __asm int 3;
-#else
- if (gettimeofday(&tv, NULL) == 0) {
- ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
- return 0;
- } else {
- return -errno;
- }
- #endif
-}
-
-const __DRIsystemTimeExtension systemTimeExtension = {
- { __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
- getUST,
- NULL,
-};
-
-#define __ATTRIB(attrib, field) \
- { attrib, offsetof(__GLXconfig, field) }
-
-static const struct { unsigned int attrib, offset; } attribMap[] = {
- __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
- __ATTRIB(__DRI_ATTRIB_LEVEL, level),
- __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
- __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
- __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
- __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
- __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
- __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
- __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
- __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
- __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
- __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
- __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
- __ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
- __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
- __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
- __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
- __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
- __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel),
- __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
- __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
- __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
- __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
- __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
- __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
- __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
- __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
- __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
- __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
- __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
- __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
- __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
- __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
- __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
- __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
- __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
- __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
-};
-
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
-static void
-setScalar(__GLXconfig *config, unsigned int attrib, unsigned int value)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(attribMap); i++)
- if (attribMap[i].attrib == attrib) {
- *(unsigned int *) ((char *) config + attribMap[i].offset) = value;
- return;
- }
-}
-
-static __GLXconfig *
-createModeFromConfig(const __DRIcoreExtension *core,
- const __DRIconfig *driConfig,
- unsigned int visualType, unsigned int drawableType)
-{
- __GLXDRIconfig *config;
- unsigned int attrib, value;
- int i;
-
- config = malloc(sizeof *config);
-
- config->driConfig = driConfig;
-
- i = 0;
- while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
- switch (attrib) {
- case __DRI_ATTRIB_RENDER_TYPE:
- config->config.renderType = 0;
- if (value & __DRI_ATTRIB_RGBA_BIT)
- config->config.renderType |= GLX_RGBA_BIT;
- if (value & __DRI_ATTRIB_COLOR_INDEX_BIT)
- config->config.renderType |= GLX_COLOR_INDEX_BIT;
- break;
- case __DRI_ATTRIB_CONFIG_CAVEAT:
- if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
- config->config.visualRating = GLX_NON_CONFORMANT_CONFIG;
- else if (value & __DRI_ATTRIB_SLOW_BIT)
- config->config.visualRating = GLX_SLOW_CONFIG;
- else
- config->config.visualRating = GLX_NONE;
- break;
- case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
- config->config.bindToTextureTargets = 0;
- if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
- config->config.bindToTextureTargets |= GLX_TEXTURE_1D_BIT_EXT;
- if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
- config->config.bindToTextureTargets |= GLX_TEXTURE_2D_BIT_EXT;
- if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
- config->config.bindToTextureTargets |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
- break;
- default:
- setScalar(&config->config, attrib, value);
- break;
- }
- }
-
- config->config.next = NULL;
- config->config.xRenderable = GL_TRUE;
- config->config.visualType = visualType;
- config->config.drawableType = drawableType;
-
- return &config->config;
-}
-
-__GLXconfig *
-glxConvertConfigs(const __DRIcoreExtension *core,
- const __DRIconfig **configs, unsigned int drawableType)
-{
- __GLXconfig head, *tail;
- int i;
-
- tail = &head;
- head.next = NULL;
-
- for (i = 0; configs[i]; i++) {
- tail->next = createModeFromConfig(core,
- configs[i], GLX_TRUE_COLOR,
- drawableType);
- if (tail->next == NULL)
- break;
-
- tail = tail->next;
- }
-
- for (i = 0; configs[i]; i++) {
- tail->next = createModeFromConfig(core,
- configs[i], GLX_DIRECT_COLOR,
- drawableType);
- if (tail->next == NULL)
- break;
-
- tail = tail->next;
- }
-
- return head.next;
-}
-
-static const char dri_driver_path[] = DRI_DRIVER_PATH;
-
-void *
-glxProbeDriver(const char *driverName,
- void **coreExt, const char *coreName, int coreVersion,
- void **renderExt, const char *renderName, int renderVersion)
-{
- int i;
- void *driver;
- char filename[PATH_MAX];
- const __DRIextension **extensions;
-
-#ifdef _MSC_VER
-#ifdef _DEBUG
-#define DLLNAME "%s%s_dri_dbg.dll"
-#else
-#define DLLNAME "%s%s_dri.dll"
-#endif
- snprintf(filename, sizeof filename, DLLNAME,
- dri_driver_path, driverName);
-
- driver = LoadLibrary(filename);
-#else
- snprintf(filename, sizeof filename, "%s/%s_dri.so",
- dri_driver_path, driverName);
-
- driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
-#endif
- if (driver == NULL) {
- LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n",
- filename, dlerror());
- goto cleanup_failure;
- }
-
-#ifdef _MSC_VER
- extensions = (const __DRIextension **)GetProcAddress(driver, __DRI_DRIVER_EXTENSIONS);
-#else
- extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS);
-#endif
- if (extensions == NULL) {
- LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
- driverName, dlerror());
- goto cleanup_failure;
- }
-
- for (i = 0; extensions[i]; i++) {
- if (strcmp(extensions[i]->name, coreName) == 0 &&
- extensions[i]->version >= coreVersion) {
- *coreExt = (void *)extensions[i];
- }
-
- if (strcmp(extensions[i]->name, renderName) == 0 &&
- extensions[i]->version >= renderVersion) {
- *renderExt = (void *)extensions[i];
- }
- }
-
- if (*coreExt == NULL || *renderExt == NULL) {
- LogMessage(X_ERROR,
- "AIGLX error: %s does not export required DRI extension\n",
- driverName);
- goto cleanup_failure;
- }
- return driver;
-
-cleanup_failure:
- if (driver)
-#ifdef _MSC_VER
- FreeLibrary(driver);
-#else
- dlclose(driver);
-#endif
- *coreExt = *renderExt = NULL;
- return NULL;
-}
+/*
+ * Copyright © 2008 Red Hat, Inc
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
+#endif
+
+#include <stdint.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+#include <GL/gl.h>
+#include <GL/glxtokens.h>
+#include <GL/internal/dri_interface.h>
+#include <os.h>
+#include "glxserver.h"
+#include "glxcontext.h"
+#include "glxscreens.h"
+#include "glxdricommon.h"
+
+#ifdef _MSC_VER
+#define dlerror() "Getting loadlibrary error string not implemented"
+#endif
+
+static int
+getUST(int64_t * ust)
+{
+ struct timeval tv;
+
+ if (ust == NULL)
+ return -EFAULT;
+
+#ifdef _MSC_VER
+ __asm int 3;
+#else
+ if (gettimeofday(&tv, NULL) == 0) {
+ ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
+ return 0;
+ }
+ else {
+ return -errno;
+ }
+ #endif
+}
+
+const __DRIsystemTimeExtension systemTimeExtension = {
+ {__DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION},
+ getUST,
+ NULL,
+};
+
+#define __ATTRIB(attrib, field) \
+ { attrib, offsetof(__GLXconfig, field) }
+
+static const struct {
+ unsigned int attrib, offset;
+} attribMap[] = {
+__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
+ __ATTRIB(__DRI_ATTRIB_LEVEL, level),
+ __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
+ __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
+ __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
+ __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
+ __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
+ __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
+ __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
+ __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
+ __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
+ __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
+ __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
+ __ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
+ __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
+ __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
+ __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
+ __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
+ __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel),
+ __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
+ __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
+ __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
+ __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
+ __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
+ __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
+ __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
+ __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
+ __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
+ __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
+ __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
+ __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
+ __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
+ __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
+ __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
+ __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
+ __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
+ __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),};
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
+static void
+setScalar(__GLXconfig * config, unsigned int attrib, unsigned int value)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(attribMap); i++)
+ if (attribMap[i].attrib == attrib) {
+ *(unsigned int *) ((char *) config + attribMap[i].offset) = value;
+ return;
+ }
+}
+
+static __GLXconfig *
+createModeFromConfig(const __DRIcoreExtension * core,
+ const __DRIconfig * driConfig,
+ unsigned int visualType, unsigned int drawableType)
+{
+ __GLXDRIconfig *config;
+ unsigned int attrib, value;
+ int i;
+
+ config = malloc(sizeof *config);
+
+ config->driConfig = driConfig;
+
+ i = 0;
+ while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
+ switch (attrib) {
+ case __DRI_ATTRIB_RENDER_TYPE:
+ config->config.renderType = 0;
+ if (value & __DRI_ATTRIB_RGBA_BIT)
+ config->config.renderType |= GLX_RGBA_BIT;
+ if (value & __DRI_ATTRIB_COLOR_INDEX_BIT)
+ config->config.renderType |= GLX_COLOR_INDEX_BIT;
+ break;
+ case __DRI_ATTRIB_CONFIG_CAVEAT:
+ if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
+ config->config.visualRating = GLX_NON_CONFORMANT_CONFIG;
+ else if (value & __DRI_ATTRIB_SLOW_BIT)
+ config->config.visualRating = GLX_SLOW_CONFIG;
+ else
+ config->config.visualRating = GLX_NONE;
+ break;
+ case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
+ config->config.bindToTextureTargets = 0;
+ if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
+ config->config.bindToTextureTargets |= GLX_TEXTURE_1D_BIT_EXT;
+ if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
+ config->config.bindToTextureTargets |= GLX_TEXTURE_2D_BIT_EXT;
+ if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
+ config->config.bindToTextureTargets |=
+ GLX_TEXTURE_RECTANGLE_BIT_EXT;
+ break;
+ default:
+ setScalar(&config->config, attrib, value);
+ break;
+ }
+ }
+
+ config->config.next = NULL;
+ config->config.xRenderable = GL_TRUE;
+ config->config.visualType = visualType;
+ config->config.drawableType = drawableType;
+
+ return &config->config;
+}
+
+__GLXconfig *
+glxConvertConfigs(const __DRIcoreExtension * core,
+ const __DRIconfig ** configs, unsigned int drawableType)
+{
+ __GLXconfig head, *tail;
+ int i;
+
+ tail = &head;
+ head.next = NULL;
+
+ for (i = 0; configs[i]; i++) {
+ tail->next = createModeFromConfig(core,
+ configs[i], GLX_TRUE_COLOR,
+ drawableType);
+ if (tail->next == NULL)
+ break;
+
+ tail = tail->next;
+ }
+
+ for (i = 0; configs[i]; i++) {
+ tail->next = createModeFromConfig(core,
+ configs[i], GLX_DIRECT_COLOR,
+ drawableType);
+ if (tail->next == NULL)
+ break;
+
+ tail = tail->next;
+ }
+
+ return head.next;
+}
+
+static const char dri_driver_path[] = DRI_DRIVER_PATH;
+
+void *
+glxProbeDriver(const char *driverName,
+ void **coreExt, const char *coreName, int coreVersion,
+ void **renderExt, const char *renderName, int renderVersion)
+{
+ int i;
+ void *driver;
+ char filename[PATH_MAX];
+ const __DRIextension **extensions;
+
+#ifdef _MSC_VER
+#ifdef _DEBUG
+#define DLLNAME "%s%s_dri_dbg.dll"
+#else
+#define DLLNAME "%s%s_dri.dll"
+#endif
+ snprintf(filename, sizeof filename, DLLNAME,
+ dri_driver_path, driverName);
+
+ driver = LoadLibrary(filename);
+#else
+ snprintf(filename, sizeof filename, "%s/%s_dri.so",
+ dri_driver_path, driverName);
+
+ driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
+#endif
+ if (driver == NULL) {
+ LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n",
+ filename, dlerror());
+ goto cleanup_failure;
+ }
+
+#ifdef _MSC_VER
+ extensions = (const __DRIextension **)GetProcAddress(driver, __DRI_DRIVER_EXTENSIONS);
+#else
+ extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS);
+#endif
+ if (extensions == NULL) {
+ LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
+ driverName, dlerror());
+ goto cleanup_failure;
+ }
+
+ for (i = 0; extensions[i]; i++) {
+ if (strcmp(extensions[i]->name, coreName) == 0 &&
+ extensions[i]->version >= coreVersion) {
+ *coreExt = (void *) extensions[i];
+ }
+
+ if (strcmp(extensions[i]->name, renderName) == 0 &&
+ extensions[i]->version >= renderVersion) {
+ *renderExt = (void *) extensions[i];
+ }
+ }
+
+ if (*coreExt == NULL || *renderExt == NULL) {
+ LogMessage(X_ERROR,
+ "AIGLX error: %s does not export required DRI extension\n",
+ driverName);
+ goto cleanup_failure;
+ }
+ return driver;
+
+ cleanup_failure:
+ if (driver)
+#ifdef _MSC_VER
+ FreeLibrary(driver);
+#else
+ dlclose(driver);
+#endif
+ *coreExt = *renderExt = NULL;
+ return NULL;
+}
diff --git a/xorg-server/glx/glxdricommon.h b/xorg-server/glx/glxdricommon.h
index ef7b531f6..f4fcf009e 100644
--- a/xorg-server/glx/glxdricommon.h
+++ b/xorg-server/glx/glxdricommon.h
@@ -1,46 +1,46 @@
-/*
- * Copyright © 2008 Red Hat, Inc
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of the
- * copyright holders not be used in advertising or publicity
- * pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied
- * warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#ifndef _GLX_dri_common_h
-#define _GLX_dri_common_h
-
-typedef struct __GLXDRIconfig __GLXDRIconfig;
-struct __GLXDRIconfig {
- __GLXconfig config;
- const __DRIconfig *driConfig;
-};
-
-__GLXconfig *
-glxConvertConfigs(const __DRIcoreExtension *core,
- const __DRIconfig **configs, unsigned int drawableType);
-
-extern const __DRIsystemTimeExtension systemTimeExtension;
-
-void *
-glxProbeDriver(const char *name,
- void **coreExt, const char *coreName, int coreVersion,
- void **renderExt, const char *renderName, int renderVersion);
-
-#endif
+/*
+ * Copyright © 2008 Red Hat, Inc
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef _GLX_dri_common_h
+#define _GLX_dri_common_h
+
+typedef struct __GLXDRIconfig __GLXDRIconfig;
+struct __GLXDRIconfig {
+ __GLXconfig config;
+ const __DRIconfig *driConfig;
+};
+
+__GLXconfig *glxConvertConfigs(const __DRIcoreExtension * core,
+ const __DRIconfig ** configs,
+ unsigned int drawableType);
+
+extern const __DRIsystemTimeExtension systemTimeExtension;
+
+void *glxProbeDriver(const char *name,
+ void **coreExt, const char *coreName, int coreVersion,
+ void **renderExt, const char *renderName,
+ int renderVersion);
+
+#endif
diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c
index 434653e70..9fe2b6d7a 100644
--- a/xorg-server/glx/glxdriswrast.c
+++ b/xorg-server/glx/glxdriswrast.c
@@ -58,14 +58,14 @@
#include "dispatch.h"
#include "extension_string.h"
-typedef struct __GLXDRIscreen __GLXDRIscreen;
-typedef struct __GLXDRIcontext __GLXDRIcontext;
+typedef struct __GLXDRIscreen __GLXDRIscreen;
+typedef struct __GLXDRIcontext __GLXDRIcontext;
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
struct __GLXDRIscreen {
- __GLXscreen base;
- __DRIscreen *driScreen;
- void *driver;
+ __GLXscreen base;
+ __DRIscreen *driScreen;
+ void *driver;
const __DRIcoreExtension *core;
const __DRIswrastExtension *swrast;
@@ -75,29 +75,29 @@ struct __GLXDRIscreen {
};
struct __GLXDRIcontext {
- __GLXcontext base;
- __DRIcontext *driContext;
+ __GLXcontext base;
+ __DRIcontext *driContext;
};
struct __GLXDRIdrawable {
- __GLXdrawable base;
- __DRIdrawable *driDrawable;
- __GLXDRIscreen *screen;
+ __GLXdrawable base;
+ __DRIdrawable *driDrawable;
+ __GLXDRIscreen *screen;
- GCPtr gc; /* scratch GC for span drawing */
- GCPtr swapgc; /* GC for swapping the color buffers */
+ GCPtr gc; /* scratch GC for span drawing */
+ GCPtr swapgc; /* GC for swapping the color buffers */
};
static void
-__glXDRIdrawableDestroy(__GLXdrawable *drawable)
+__glXDRIdrawableDestroy(__GLXdrawable * drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
const __DRIcoreExtension *core = private->screen->core;
- (*core->destroyDrawable)(private->driDrawable);
+ (*core->destroyDrawable) (private->driDrawable);
- FreeGC(private->gc, (GContext)0);
- FreeGC(private->swapgc, (GContext)0);
+ FreeGC(private->gc, (GContext) 0);
+ FreeGC(private->swapgc, (GContext) 0);
__glXDrawableRelease(drawable);
@@ -105,79 +105,77 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
}
static GLboolean
-__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable)
+__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable * drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
const __DRIcoreExtension *core = private->screen->core;
- (*core->swapBuffers)(private->driDrawable);
+ (*core->swapBuffers) (private->driDrawable);
return TRUE;
}
static void
-__glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
- int x, int y, int w, int h)
+__glXDRIdrawableCopySubBuffer(__GLXdrawable * basePrivate,
+ int x, int y, int w, int h)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
const __DRIcopySubBufferExtension *copySubBuffer =
- private->screen->copySubBuffer;
+ private->screen->copySubBuffer;
if (copySubBuffer)
- (*copySubBuffer->copySubBuffer)(private->driDrawable, x, y, w, h);
+ (*copySubBuffer->copySubBuffer) (private->driDrawable, x, y, w, h);
}
static void
-__glXDRIcontextDestroy(__GLXcontext *baseContext)
+__glXDRIcontextDestroy(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
- (*screen->core->destroyContext)(context->driContext);
+ (*screen->core->destroyContext) (context->driContext);
__glXContextDestroy(&context->base);
free(context);
}
static int
-__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
+__glXDRIcontextMakeCurrent(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
- return (*screen->core->bindContext)(context->driContext,
- draw->driDrawable,
- read->driDrawable);
+ return (*screen->core->bindContext) (context->driContext,
+ draw->driDrawable, read->driDrawable);
}
static int
-__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
+__glXDRIcontextLoseCurrent(__GLXcontext * baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
- return (*screen->core->unbindContext)(context->driContext);
+ return (*screen->core->unbindContext) (context->driContext);
}
static int
-__glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
- unsigned long mask)
+__glXDRIcontextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc,
+ unsigned long mask)
{
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
__GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
- return (*screen->core->copyContext)(dst->driContext,
- src->driContext, mask);
+ return (*screen->core->copyContext) (dst->driContext,
+ src->driContext, mask);
}
#ifdef __DRI_TEX_BUFFER
static int
-__glXDRIbindTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *glxPixmap)
+__glXDRIbindTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * glxPixmap)
{
__GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap;
const __DRItexBufferExtension *texBuffer = drawable->screen->texBuffer;
@@ -188,23 +186,21 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
#if __DRI_TEX_BUFFER_VERSION >= 2
if (texBuffer->base.version >= 2 && texBuffer->setTexBuffer2 != NULL) {
- (*texBuffer->setTexBuffer2)(context->driContext,
- glxPixmap->target,
- glxPixmap->format,
- drawable->driDrawable);
- } else
+ (*texBuffer->setTexBuffer2) (context->driContext,
+ glxPixmap->target,
+ glxPixmap->format, drawable->driDrawable);
+ }
+ else
#endif
- texBuffer->setTexBuffer(context->driContext,
- glxPixmap->target,
- drawable->driDrawable);
+ texBuffer->setTexBuffer(context->driContext,
+ glxPixmap->target, drawable->driDrawable);
return Success;
}
static int
-__glXDRIreleaseTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap)
+__glXDRIreleaseTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap)
{
/* FIXME: Just unbind the texture? */
return Success;
@@ -213,17 +209,15 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext,
#else
static int
-__glXDRIbindTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *glxPixmap)
+__glXDRIbindTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * glxPixmap)
{
return Success;
}
static int
-__glXDRIreleaseTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap)
+__glXDRIreleaseTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap)
{
return Success;
}
@@ -236,13 +230,13 @@ static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
};
static void
-__glXDRIscreenDestroy(__GLXscreen *baseScreen)
+__glXDRIscreenDestroy(__GLXscreen * baseScreen)
{
int i;
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
- (*screen->core->destroyScreen)(screen->driScreen);
+ (*screen->core->destroyScreen) (screen->driScreen);
#ifdef _MSC_VER
FreeLibrary(screen->driver);
@@ -253,18 +247,18 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
__glXScreenDestroy(baseScreen);
if (screen->driConfigs) {
- for (i = 0; screen->driConfigs[i] != NULL; i++)
- free((__DRIconfig **)screen->driConfigs[i]);
- free((void*)screen->driConfigs);
+ for (i = 0; screen->driConfigs[i] != NULL; i++)
+ free((__DRIconfig **) screen->driConfigs[i]);
+ free((void*)screen->driConfigs);
}
free(screen);
}
static __GLXcontext *
-__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
- __GLXconfig *glxConfig,
- __GLXcontext *baseShareContext)
+__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
+ __GLXconfig * glxConfig,
+ __GLXcontext * baseShareContext)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -274,35 +268,33 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
- driShare = shareContext->driContext;
+ driShare = shareContext->driContext;
else
- driShare = NULL;
+ driShare = NULL;
context = calloc(1, sizeof *context);
if (context == NULL)
- return NULL;
+ return NULL;
- context->base.destroy = __glXDRIcontextDestroy;
- context->base.makeCurrent = __glXDRIcontextMakeCurrent;
- context->base.loseCurrent = __glXDRIcontextLoseCurrent;
- context->base.copy = __glXDRIcontextCopy;
+ context->base.destroy = __glXDRIcontextDestroy;
+ context->base.makeCurrent = __glXDRIcontextMakeCurrent;
+ context->base.loseCurrent = __glXDRIcontextLoseCurrent;
+ context->base.copy = __glXDRIcontextCopy;
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
context->driContext =
- (*core->createNewContext)(screen->driScreen,
- config->driConfig, driShare, context);
+ (*core->createNewContext) (screen->driScreen,
+ config->driConfig, driShare, context);
return &context->base;
}
static __GLXdrawable *
__glXDRIscreenCreateDrawable(ClientPtr client,
- __GLXscreen *screen,
- DrawablePtr pDraw,
- XID drawId,
- int type,
- XID glxDrawId,
- __GLXconfig *glxConfig)
+ __GLXscreen * screen,
+ DrawablePtr pDraw,
+ XID drawId,
+ int type, XID glxDrawId, __GLXconfig * glxConfig)
{
XID gcvals[2];
int status;
@@ -312,43 +304,44 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private = calloc(1, sizeof *private);
if (private == NULL)
- return NULL;
+ return NULL;
private->screen = driScreen;
if (!__glXDrawableInit(&private->base, screen,
- pDraw, type, glxDrawId, glxConfig)) {
+ pDraw, type, glxDrawId, glxConfig)) {
free(private);
- return NULL;
+ return NULL;
}
- private->base.destroy = __glXDRIdrawableDestroy;
- private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
+ private->base.destroy = __glXDRIdrawableDestroy;
+ private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
gcvals[0] = GXcopy;
- private->gc = CreateGC(pDraw, GCFunction, gcvals, &status, (XID)0, serverClient);
+ private->gc =
+ CreateGC(pDraw, GCFunction, gcvals, &status, (XID) 0, serverClient);
gcvals[1] = FALSE;
- private->swapgc = CreateGC(pDraw, GCFunction | GCGraphicsExposures, gcvals, &status, (XID)0, serverClient);
+ private->swapgc =
+ CreateGC(pDraw, GCFunction | GCGraphicsExposures, gcvals, &status,
+ (XID) 0, serverClient);
private->driDrawable =
- (*driScreen->swrast->createNewDrawable)(driScreen->driScreen,
- config->driConfig,
- private);
- if (!private->driDrawable)
- {
- FreeGC(private->gc, (GContext)0);
- FreeGC(private->swapgc, (GContext)0);
- free(private);
- return NULL;
- }
+ (*driScreen->swrast->createNewDrawable) (driScreen->driScreen,
+ config->driConfig, private);
+ if (!private->driDrawable)
+ {
+ FreeGC(private->gc, (GContext)0);
+ FreeGC(private->swapgc, (GContext)0);
+ free(private);
+ return NULL;
+ }
return &private->base;
}
static void
-swrastGetDrawableInfo(__DRIdrawable *draw,
- int *x, int *y, int *w, int *h,
- void *loaderPrivate)
+swrastGetDrawableInfo(__DRIdrawable * draw,
+ int *x, int *y, int *w, int *h, void *loaderPrivate)
{
__GLXDRIdrawable *drawable = loaderPrivate;
DrawablePtr pDraw = drawable->base.pDraw;
@@ -360,9 +353,8 @@ swrastGetDrawableInfo(__DRIdrawable *draw,
}
static void
-swrastPutImage(__DRIdrawable *draw, int op,
- int x, int y, int w, int h, char *data,
- void *loaderPrivate)
+swrastPutImage(__DRIdrawable * draw, int op,
+ int x, int y, int w, int h, char *data, void *loaderPrivate)
{
__GLXDRIdrawable *drawable = loaderPrivate;
DrawablePtr pDraw = drawable->base.pDraw;
@@ -370,25 +362,23 @@ swrastPutImage(__DRIdrawable *draw, int op,
switch (op) {
case __DRI_SWRAST_IMAGE_OP_DRAW:
- gc = drawable->gc;
- break;
+ gc = drawable->gc;
+ break;
case __DRI_SWRAST_IMAGE_OP_SWAP:
- gc = drawable->swapgc;
- break;
+ gc = drawable->swapgc;
+ break;
default:
- return;
+ return;
}
ValidateGC(pDraw, gc);
- gc->ops->PutImage(pDraw, gc, pDraw->depth,
- x, y, w, h, 0, ZPixmap, data);
+ gc->ops->PutImage(pDraw, gc, pDraw->depth, x, y, w, h, 0, ZPixmap, data);
}
static void
-swrastGetImage(__DRIdrawable *draw,
- int x, int y, int w, int h, char *data,
- void *loaderPrivate)
+swrastGetImage(__DRIdrawable * draw,
+ int x, int y, int w, int h, char *data, void *loaderPrivate)
{
__GLXDRIdrawable *drawable = loaderPrivate;
DrawablePtr pDraw = drawable->base.pDraw;
@@ -398,7 +388,7 @@ swrastGetImage(__DRIdrawable *draw,
}
static const __DRIswrastLoaderExtension swrastLoaderExtension = {
- { __DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION },
+ {__DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION},
swrastGetDrawableInfo,
swrastPutImage,
swrastGetImage
@@ -411,7 +401,7 @@ static const __DRIextension *loader_extensions[] = {
};
static void
-initializeExtensions(__GLXDRIscreen *screen)
+initializeExtensions(__GLXDRIscreen * screen)
{
const __DRIextension **extensions;
int i;
@@ -420,21 +410,20 @@ initializeExtensions(__GLXDRIscreen *screen)
for (i = 0; extensions[i]; i++) {
#ifdef __DRI_COPY_SUB_BUFFER
- if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
- screen->copySubBuffer =
- (const __DRIcopySubBufferExtension *) extensions[i];
- /* GLX_MESA_copy_sub_buffer is always enabled. */
- }
+ if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
+ screen->copySubBuffer =
+ (const __DRIcopySubBufferExtension *) extensions[i];
+ /* GLX_MESA_copy_sub_buffer is always enabled. */
+ }
#endif
#ifdef __DRI_TEX_BUFFER
- if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
- screen->texBuffer =
- (const __DRItexBufferExtension *) extensions[i];
- /* GLX_EXT_texture_from_pixmap is always enabled. */
- }
+ if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
+ screen->texBuffer = (const __DRItexBufferExtension *) extensions[i];
+ /* GLX_EXT_texture_from_pixmap is always enabled. */
+ }
#endif
- /* Ignore unknown extensions */
+ /* Ignore unknown extensions */
}
}
@@ -453,56 +442,53 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen = calloc(1, sizeof *screen);
if (screen == NULL)
- return NULL;
+ return NULL;
- screen->base.destroy = __glXDRIscreenDestroy;
- screen->base.createContext = __glXDRIscreenCreateContext;
+ screen->base.destroy = __glXDRIscreenDestroy;
+ screen->base.createContext = __glXDRIscreenCreateContext;
screen->base.createDrawable = __glXDRIscreenCreateDrawable;
- screen->base.swapInterval = NULL;
- screen->base.pScreen = pScreen;
+ screen->base.swapInterval = NULL;
+ screen->base.pScreen = pScreen;
screen->driver = glxProbeDriver(driverName,
- (void **)&screen->core,
- __DRI_CORE, __DRI_CORE_VERSION,
- (void **)&screen->swrast,
- __DRI_SWRAST, __DRI_SWRAST_VERSION);
+ (void **) &screen->core,
+ __DRI_CORE, __DRI_CORE_VERSION,
+ (void **) &screen->swrast,
+ __DRI_SWRAST, __DRI_SWRAST_VERSION);
if (screen->driver == NULL) {
goto handle_error;
}
screen->driScreen =
- (*screen->swrast->createNewScreen)(pScreen->myNum,
- loader_extensions,
- &screen->driConfigs,
- screen);
+ (*screen->swrast->createNewScreen) (pScreen->myNum,
+ loader_extensions,
+ &screen->driConfigs, screen);
if (screen->driScreen == NULL) {
- LogMessage(X_ERROR,
- "AIGLX error: Calling driver entry point failed\n");
- goto handle_error;
+ LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed\n");
+ goto handle_error;
}
initializeExtensions(screen);
screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs,
- GLX_WINDOW_BIT |
- GLX_PIXMAP_BIT |
- GLX_PBUFFER_BIT);
+ GLX_WINDOW_BIT |
+ GLX_PIXMAP_BIT |
+ GLX_PBUFFER_BIT);
__glXScreenInit(&screen->base, pScreen);
screen->base.GLXmajor = 1;
screen->base.GLXminor = 4;
- LogMessage(X_INFO,
- "AIGLX: Loaded and initialized %s\n", driverName);
+ LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
return &screen->base;
handle_error:
if (screen->driver)
#ifdef _MSC_VER
- FreeLibrary(screen->driver);
+ FreeLibrary(screen->driver);
#else
dlclose(screen->driver);
#endif
diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c
index 88e109c88..8671ed026 100644
--- a/xorg-server/glx/glxext.c
+++ b/xorg-server/glx/glxext.c
@@ -70,6 +70,7 @@ RESTYPE __glXDrawableRes;
xGLXSingleReply __glXReply;
static DevPrivateKeyRec glxClientPrivateKeyRec;
+
#define glxClientPrivateKey (&glxClientPrivateKeyRec)
/*
@@ -80,7 +81,8 @@ static int __glXDispatch(ClientPtr);
/*
** Called when the extension is reset.
*/
-static void ResetExtension(ExtensionEntry* extEntry)
+static void
+ResetExtension(ExtensionEntry * extEntry)
{
__glXFlushContextCache();
}
@@ -88,7 +90,8 @@ static void ResetExtension(ExtensionEntry* extEntry)
/*
** Reset state used to keep track of large (multi-request) commands.
*/
-void __glXResetLargeCommandStatus(__GLXclientState *cl)
+void
+__glXResetLargeCommandStatus(__GLXclientState * cl)
{
cl->largeCmdBytesSoFar = 0;
cl->largeCmdBytesTotal = 0;
@@ -102,11 +105,12 @@ void __glXResetLargeCommandStatus(__GLXclientState *cl)
** flag that the ID is no longer valid, and (maybe) free the context.
** use.
*/
-static int ContextGone(__GLXcontext* cx, XID id)
+static int
+ContextGone(__GLXcontext * cx, XID id)
{
cx->idExists = GL_FALSE;
if (!cx->isCurrent) {
- __glXFreeContext(cx);
+ __glXFreeContext(cx);
}
return True;
@@ -121,7 +125,8 @@ static int glxBlockClients;
** Destroy routine that gets called when a drawable is freed. A drawable
** contains the ancillary buffers needed for rendering.
*/
-static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
+static Bool
+DrawableGone(__GLXdrawable * glxPriv, XID xid)
{
__GLXcontext *c, *next;
@@ -137,63 +142,67 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
}
for (c = glxAllContexts; c; c = next) {
- next = c->next;
- if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
- if (GET_DISPATCH()) FlushContext(c); /* Only flush if we still have a context */
-
- (*c->loseCurrent)(c);
- c->isCurrent = GL_FALSE;
- if (c == __glXLastContext)
- __glXFlushContextCache();
- }
- if (c->drawPriv == glxPriv)
- c->drawPriv = NULL;
- if (c->readPriv == glxPriv)
- c->readPriv = NULL;
+ next = c->next;
+ if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
+ if (GET_DISPATCH()) FlushContext(c); /* Only flush if we still have a context */
+
+ (*c->loseCurrent) (c);
+ c->isCurrent = GL_FALSE;
+ if (c == __glXLastContext)
+ __glXFlushContextCache();
+ }
+ if (c->drawPriv == glxPriv)
+ c->drawPriv = NULL;
+ if (c->readPriv == glxPriv)
+ c->readPriv = NULL;
}
/* drop our reference to any backing pixmap */
if (glxPriv->type == GLX_DRAWABLE_PIXMAP)
- glxPriv->pDraw->pScreen->DestroyPixmap((PixmapPtr)glxPriv->pDraw);
+ glxPriv->pDraw->pScreen->DestroyPixmap((PixmapPtr) glxPriv->pDraw);
glxPriv->destroy(glxPriv);
return True;
}
-void __glXAddToContextList(__GLXcontext *cx)
+void
+__glXAddToContextList(__GLXcontext * cx)
{
cx->next = glxAllContexts;
glxAllContexts = cx;
}
-static void __glXRemoveFromContextList(__GLXcontext *cx)
+static void
+__glXRemoveFromContextList(__GLXcontext * cx)
{
__GLXcontext *c, *prev;
if (cx == glxAllContexts)
- glxAllContexts = cx->next;
+ glxAllContexts = cx->next;
else {
- prev = glxAllContexts;
- for (c = glxAllContexts; c; c = c->next) {
- if (c == cx)
- prev->next = c->next;
- prev = c;
- }
+ prev = glxAllContexts;
+ for (c = glxAllContexts; c; c = c->next) {
+ if (c == cx)
+ prev->next = c->next;
+ prev = c;
+ }
}
}
/*
** Free a context.
*/
-GLboolean __glXFreeContext(__GLXcontext *cx)
+GLboolean
+__glXFreeContext(__GLXcontext * cx)
{
- if (cx->idExists || cx->isCurrent) return GL_FALSE;
-
+ if (cx->idExists || cx->isCurrent)
+ return GL_FALSE;
+
free(cx->feedbackBuf);
free(cx->selectBuf);
if (cx == __glXLastContext) {
- __glXFlushContextCache();
+ __glXFlushContextCache();
}
__glXRemoveFromContextList(cx);
@@ -203,12 +212,13 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
* the latter case we need to lift the DRI lock manually. */
if (!glxBlockClients) {
- __glXleaveServer(GL_FALSE);
- cx->destroy(cx);
- __glXenterServer(GL_FALSE);
- } else {
- cx->next = glxPendingDestroyContexts;
- glxPendingDestroyContexts = cx;
+ __glXleaveServer(GL_FALSE);
+ cx->destroy(cx);
+ __glXenterServer(GL_FALSE);
+ }
+ else {
+ cx->next = glxPendingDestroyContexts;
+ glxPendingDestroyContexts = cx;
}
return GL_TRUE;
@@ -228,7 +238,8 @@ static GLboolean errorOccured = GL_FALSE;
/*
** The GL was will call this routine if an error occurs.
*/
-void __glXErrorCallBack(GLenum code)
+void
+__glXErrorCallBack(GLenum code)
{
errorOccured = GL_TRUE;
}
@@ -236,7 +247,8 @@ void __glXErrorCallBack(GLenum code)
/*
** Clear the error flag before calling the GL command.
*/
-void __glXClearErrorOccured(void)
+void
+__glXClearErrorOccured(void)
{
errorOccured = GL_FALSE;
}
@@ -244,7 +256,8 @@ void __glXClearErrorOccured(void)
/*
** Check if the GL command caused an error.
*/
-GLboolean __glXErrorOccured(void)
+GLboolean
+__glXErrorOccured(void)
{
return errorOccured;
}
@@ -252,7 +265,8 @@ GLboolean __glXErrorOccured(void)
static int __glXErrorBase;
int __glXEventBase;
-int __glXError(int error)
+int
+__glXError(int error)
{
return __glXErrorBase + error;
}
@@ -264,33 +278,31 @@ glxGetClient(ClientPtr pClient)
}
static void
-glxClientCallback (CallbackListPtr *list,
- pointer closure,
- pointer data)
+glxClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- __GLXclientState *cl = glxGetClient(pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ __GLXclientState *cl = glxGetClient(pClient);
switch (pClient->clientState) {
case ClientStateRunning:
- /*
- ** By default, assume that the client supports
- ** GLX major version 1 minor version 0 protocol.
- */
- cl->GLClientmajorVersion = 1;
- cl->GLClientminorVersion = 0;
- cl->client = pClient;
- break;
+ /*
+ ** By default, assume that the client supports
+ ** GLX major version 1 minor version 0 protocol.
+ */
+ cl->GLClientmajorVersion = 1;
+ cl->GLClientminorVersion = 0;
+ cl->client = pClient;
+ break;
case ClientStateGone:
- free(cl->returnBuf);
- free(cl->largeCmdBuf);
- free(cl->GLClientextensions);
- break;
+ free(cl->returnBuf);
+ free(cl->largeCmdBuf);
+ free(cl->GLClientextensions);
+ break;
default:
- break;
+ break;
}
}
@@ -298,7 +310,8 @@ glxClientCallback (CallbackListPtr *list,
static __GLXprovider *__glXProviderStack;
-void GlxPushProvider(__GLXprovider *provider)
+void
+GlxPushProvider(__GLXprovider * provider)
{
provider->next = __glXProviderStack;
__glXProviderStack = provider;
@@ -307,7 +320,8 @@ void GlxPushProvider(__GLXprovider *provider)
/*
** Initialize the GLX extension.
*/
-void GlxExtensionInit(void)
+void
+GlxExtensionInit(void)
{
ExtensionEntry *extEntry;
ScreenPtr pScreen;
@@ -315,61 +329,61 @@ void GlxExtensionInit(void)
__GLXprovider *p;
Bool glx_provided = False;
- __glXContextRes = CreateNewResourceType((DeleteType)ContextGone,
- "GLXContext");
- __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone,
- "GLXDrawable");
+ __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
+ "GLXContext");
+ __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,
+ "GLXDrawable");
if (!__glXContextRes || !__glXDrawableRes)
- return;
+ return;
- if (!dixRegisterPrivateKey(&glxClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (__GLXclientState)))
- return;
- if (!AddCallback (&ClientStateCallback, glxClientCallback, 0))
- return;
+ if (!dixRegisterPrivateKey
+ (&glxClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(__GLXclientState)))
+ return;
+ if (!AddCallback(&ClientStateCallback, glxClientCallback, 0))
+ return;
for (i = 0; i < screenInfo.numScreens; i++) {
- pScreen = screenInfo.screens[i];
-
- for (p = __glXProviderStack; p != NULL; p = p->next) {
- __GLXscreen *glxScreen;
-
- glxScreen = p->screenProbe(pScreen);
- if (glxScreen != NULL) {
- if (glxScreen->GLXminor < glxMinorVersion)
- glxMinorVersion = glxScreen->GLXminor;
- LogMessage(X_INFO,
- "GLX: Initialized %s GL provider for screen %d\n",
- p->name, i);
- break;
- }
-
- }
-
- if (!p)
- LogMessage(X_INFO,
- "GLX: no usable GL providers found for screen %d\n", i);
- else
- glx_provided = True;
+ pScreen = screenInfo.screens[i];
+
+ for (p = __glXProviderStack; p != NULL; p = p->next) {
+ __GLXscreen *glxScreen;
+
+ glxScreen = p->screenProbe(pScreen);
+ if (glxScreen != NULL) {
+ if (glxScreen->GLXminor < glxMinorVersion)
+ glxMinorVersion = glxScreen->GLXminor;
+ LogMessage(X_INFO,
+ "GLX: Initialized %s GL provider for screen %d\n",
+ p->name, i);
+ break;
+ }
+
+ }
+
+ if (!p)
+ LogMessage(X_INFO,
+ "GLX: no usable GL providers found for screen %d\n", i);
+ else
+ glx_provided = True;
}
/* don't register extension if GL is not provided on any screen */
if (!glx_provided)
- return;
+ return;
/*
- ** Add extension to server extensions.
- */
+ ** Add extension to server extensions.
+ */
extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
- __GLX_NUMBER_ERRORS, __glXDispatch,
- __glXDispatch, ResetExtension,
- StandardMinorOpcode);
+ __GLX_NUMBER_ERRORS, __glXDispatch,
+ __glXDispatch, ResetExtension, StandardMinorOpcode);
if (!extEntry) {
- FatalError("__glXExtensionInit: AddExtensions failed\n");
- return;
+ FatalError("__glXExtensionInit: AddExtensions failed\n");
+ return;
}
if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) {
- ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
- return;
+ ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
+ return;
}
__glXErrorBase = extEntry->errorBase;
@@ -378,7 +392,8 @@ void GlxExtensionInit(void)
/************************************************************************/
-void __glXFlushContextCache(void)
+void
+__glXFlushContextCache(void)
{
__glXLastContext = 0;
}
@@ -389,50 +404,50 @@ void __glXFlushContextCache(void)
** switching it between different contexts). While we are at it, look up
** a context by its tag and return its (__GLXcontext *).
*/
-__GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
- int *error)
+__GLXcontext *
+__glXForceCurrent(__GLXclientState * cl, GLXContextTag tag, int *error)
{
__GLXcontext *cx;
/*
- ** See if the context tag is legal; it is managed by the extension,
- ** so if it's invalid, we have an implementation error.
- */
+ ** See if the context tag is legal; it is managed by the extension,
+ ** so if it's invalid, we have an implementation error.
+ */
cx = __glXLookupContextByTag(cl, tag);
if (!cx) {
- cl->client->errorValue = tag;
- *error = __glXError(GLXBadContextTag);
- return 0;
+ cl->client->errorValue = tag;
+ *error = __glXError(GLXBadContextTag);
+ return 0;
}
if (!cx->isDirect) {
- if (cx->drawPriv == NULL) {
- /*
- ** The drawable has vanished. It must be a window, because only
- ** windows can be destroyed from under us; GLX pixmaps are
- ** refcounted and don't go away until no one is using them.
- */
- *error = __glXError(GLXBadCurrentWindow);
- return 0;
- }
+ if (cx->drawPriv == NULL) {
+ /*
+ ** The drawable has vanished. It must be a window, because only
+ ** windows can be destroyed from under us; GLX pixmaps are
+ ** refcounted and don't go away until no one is using them.
+ */
+ *error = __glXError(GLXBadCurrentWindow);
+ return 0;
+ }
}
-
- if (cx->wait && (*cx->wait)(cx, cl, error))
- return NULL;
+
+ if (cx->wait && (*cx->wait) (cx, cl, error))
+ return NULL;
if (cx == __glXLastContext && GET_DISPATCH()) {
- /* No need to re-bind */
- return cx;
+ /* No need to re-bind */
+ return cx;
}
/* Make this context the current one for the GL. */
if (!cx->isDirect) {
- if (!(*cx->makeCurrent)(cx)) {
- /* Bind failed, and set the error code. Bummer */
- cl->client->errorValue = cx->id;
- *error = __glXError(GLXBadContextState);
- return 0;
- }
+ if (!(*cx->makeCurrent) (cx)) {
+ /* Bind failed, and set the error code. Bummer */
+ cl->client->errorValue = cx->id;
+ *error = __glXError(GLXBadContextState);
+ return 0;
+ }
}
__glXLastContext = cx;
return cx;
@@ -440,19 +455,21 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
/************************************************************************/
-void glxSuspendClients(void)
+void
+glxSuspendClients(void)
{
int i;
for (i = 1; i < currentMaxClients; i++) {
- if (clients[i] && glxGetClient(clients[i])->inUse)
- IgnoreClient(clients[i]);
+ if (clients[i] && glxGetClient(clients[i])->inUse)
+ IgnoreClient(clients[i]);
}
glxBlockClients = TRUE;
}
-void glxResumeClients(void)
+void
+glxResumeClients(void)
{
__GLXcontext *cx, *next;
int i;
@@ -460,15 +477,15 @@ void glxResumeClients(void)
glxBlockClients = FALSE;
for (i = 1; i < currentMaxClients; i++) {
- if (clients[i] && glxGetClient(clients[i])->inUse)
- AttendClient(clients[i]);
+ if (clients[i] && glxGetClient(clients[i])->inUse)
+ AttendClient(clients[i]);
}
__glXleaveServer(GL_FALSE);
for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) {
- next = cx->next;
+ next = cx->next;
- cx->destroy(cx);
+ cx->destroy(cx);
}
glxPendingDestroyContexts = NULL;
__glXenterServer(GL_FALSE);
@@ -478,43 +495,46 @@ static void
__glXnopEnterServer(GLboolean rendering)
{
}
-
+
static void
__glXnopLeaveServer(GLboolean rendering)
{
}
-static void (*__glXenterServerFunc)(GLboolean) = __glXnopEnterServer;
-static void (*__glXleaveServerFunc)(GLboolean) = __glXnopLeaveServer;
+static void (*__glXenterServerFunc) (GLboolean) = __glXnopEnterServer;
+static void (*__glXleaveServerFunc) (GLboolean) = __glXnopLeaveServer;
-void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
- void (*leave)(GLboolean))
+void
+__glXsetEnterLeaveServerFuncs(void (*enter) (GLboolean),
+ void (*leave) (GLboolean))
{
- __glXenterServerFunc = enter;
- __glXleaveServerFunc = leave;
+ __glXenterServerFunc = enter;
+ __glXleaveServerFunc = leave;
}
-
-void __glXenterServer(GLboolean rendering)
+void
+__glXenterServer(GLboolean rendering)
{
- glxServerLeaveCount--;
+ glxServerLeaveCount--;
- if (glxServerLeaveCount == 0)
- (*__glXenterServerFunc)(rendering);
+ if (glxServerLeaveCount == 0)
+ (*__glXenterServerFunc) (rendering);
}
-void __glXleaveServer(GLboolean rendering)
+void
+__glXleaveServer(GLboolean rendering)
{
- if (glxServerLeaveCount == 0)
- (*__glXleaveServerFunc)(rendering);
+ if (glxServerLeaveCount == 0)
+ (*__glXleaveServerFunc) (rendering);
- glxServerLeaveCount++;
+ glxServerLeaveCount++;
}
/*
** Top level dispatcher; all commands are executed from here down.
*/
-static int __glXDispatch(ClientPtr client)
+static int
+__glXDispatch(ClientPtr client)
{
REQUEST(xGLXSingleReq);
CARD8 opcode;
@@ -528,37 +548,38 @@ static int __glXDispatch(ClientPtr client)
cl->inUse = TRUE;
/*
- ** If we're expecting a glXRenderLarge request, this better be one.
- */
+ ** If we're expecting a glXRenderLarge request, this better be one.
+ */
if ((cl->largeCmdRequestsSoFar != 0) && (opcode != X_GLXRenderLarge)) {
- client->errorValue = stuff->glxCode;
- return __glXError(GLXBadLargeRequest);
+ client->errorValue = stuff->glxCode;
+ return __glXError(GLXBadLargeRequest);
}
/* If we're currently blocking GLX clients, just put this guy to
* sleep, reset the request and return. */
if (glxBlockClients) {
- ResetCurrentRequest(client);
- client->sequence--;
- IgnoreClient(client);
- return Success;
+ ResetCurrentRequest(client);
+ client->sequence--;
+ IgnoreClient(client);
+ return Success;
}
/*
- ** Use the opcode to index into the procedure table.
- */
- proc = __glXGetProtocolDecodeFunction(& Single_dispatch_info, opcode,
+ ** Use the opcode to index into the procedure table.
+ */
+ proc = __glXGetProtocolDecodeFunction(&Single_dispatch_info, opcode,
client->swapped);
if (proc != NULL) {
- GLboolean rendering = opcode <= X_GLXRenderLarge;
- __glXleaveServer(rendering);
+ GLboolean rendering = opcode <= X_GLXRenderLarge;
+
+ __glXleaveServer(rendering);
- retval = (*proc)(cl, (GLbyte *) stuff);
+ retval = (*proc) (cl, (GLbyte *) stuff);
- __glXenterServer(rendering);
+ __glXenterServer(rendering);
}
else {
- retval = BadRequest;
+ retval = BadRequest;
}
return retval;
diff --git a/xorg-server/glx/glxscreens.c b/xorg-server/glx/glxscreens.c
index d75f48a2b..1ece23038 100644
--- a/xorg-server/glx/glxscreens.c
+++ b/xorg-server/glx/glxscreens.c
@@ -49,118 +49,116 @@
#include "protocol-versions.h"
static DevPrivateKeyRec glxScreenPrivateKeyRec;
+
#define glxScreenPrivateKey (&glxScreenPrivateKeyRec)
const char GLServerVersion[] = "1.4";
-static const char GLServerExtensions[] =
- "GL_ARB_depth_texture "
- "GL_ARB_draw_buffers "
- "GL_ARB_fragment_program "
- "GL_ARB_fragment_program_shadow "
- "GL_ARB_imaging "
- "GL_ARB_multisample "
- "GL_ARB_multitexture "
- "GL_ARB_occlusion_query "
- "GL_ARB_point_parameters "
- "GL_ARB_point_sprite "
- "GL_ARB_shadow "
- "GL_ARB_shadow_ambient "
- "GL_ARB_texture_border_clamp "
- "GL_ARB_texture_compression "
- "GL_ARB_texture_cube_map "
- "GL_ARB_texture_env_add "
- "GL_ARB_texture_env_combine "
- "GL_ARB_texture_env_crossbar "
- "GL_ARB_texture_env_dot3 "
- "GL_ARB_texture_mirrored_repeat "
- "GL_ARB_texture_non_power_of_two "
- "GL_ARB_transpose_matrix "
- "GL_ARB_vertex_program "
- "GL_ARB_window_pos "
- "GL_EXT_abgr "
- "GL_EXT_bgra "
- "GL_EXT_blend_color "
- "GL_EXT_blend_equation_separate "
- "GL_EXT_blend_func_separate "
- "GL_EXT_blend_logic_op "
- "GL_EXT_blend_minmax "
- "GL_EXT_blend_subtract "
- "GL_EXT_clip_volume_hint "
- "GL_EXT_copy_texture "
- "GL_EXT_draw_range_elements "
- "GL_EXT_fog_coord "
- "GL_EXT_framebuffer_object "
- "GL_EXT_multi_draw_arrays "
- "GL_EXT_packed_pixels "
- "GL_EXT_paletted_texture "
- "GL_EXT_point_parameters "
- "GL_EXT_polygon_offset "
- "GL_EXT_rescale_normal "
- "GL_EXT_secondary_color "
- "GL_EXT_separate_specular_color "
- "GL_EXT_shadow_funcs "
- "GL_EXT_shared_texture_palette "
- "GL_EXT_stencil_two_side "
- "GL_EXT_stencil_wrap "
- "GL_EXT_subtexture "
- "GL_EXT_texture "
- "GL_EXT_texture3D "
- "GL_EXT_texture_compression_dxt1 "
- "GL_EXT_texture_compression_s3tc "
- "GL_EXT_texture_edge_clamp "
- "GL_EXT_texture_env_add "
- "GL_EXT_texture_env_combine "
- "GL_EXT_texture_env_dot3 "
- "GL_EXT_texture_filter_anisotropic "
- "GL_EXT_texture_lod "
- "GL_EXT_texture_lod_bias "
- "GL_EXT_texture_mirror_clamp "
- "GL_EXT_texture_object "
- "GL_EXT_texture_rectangle "
- "GL_EXT_vertex_array "
- "GL_3DFX_texture_compression_FXT1 "
- "GL_APPLE_packed_pixels "
- "GL_ATI_draw_buffers "
- "GL_ATI_texture_env_combine3 "
- "GL_ATI_texture_mirror_once "
- "GL_HP_occlusion_test "
- "GL_IBM_texture_mirrored_repeat "
- "GL_INGR_blend_func_separate "
- "GL_MESA_pack_invert "
- "GL_MESA_ycbcr_texture "
- "GL_NV_blend_square "
- "GL_NV_depth_clamp "
- "GL_NV_fog_distance "
- "GL_NV_fragment_program "
- "GL_NV_fragment_program_option "
- "GL_NV_fragment_program2 "
- "GL_NV_light_max_exponent "
- "GL_NV_multisample_filter_hint "
- "GL_NV_point_sprite "
- "GL_NV_texgen_reflection "
- "GL_NV_texture_compression_vtc "
- "GL_NV_texture_env_combine4 "
- "GL_NV_texture_expand_normal "
- "GL_NV_texture_rectangle "
- "GL_NV_vertex_program "
- "GL_NV_vertex_program1_1 "
- "GL_NV_vertex_program2 "
- "GL_NV_vertex_program2_option "
- "GL_NV_vertex_program3 "
- "GL_OES_compressed_paletted_texture "
- "GL_SGI_color_matrix "
- "GL_SGI_color_table "
- "GL_SGIS_generate_mipmap "
- "GL_SGIS_multisample "
- "GL_SGIS_point_parameters "
- "GL_SGIS_texture_border_clamp "
- "GL_SGIS_texture_edge_clamp "
- "GL_SGIS_texture_lod "
- "GL_SGIX_depth_texture "
- "GL_SGIX_shadow "
- "GL_SGIX_shadow_ambient "
- "GL_SUN_slice_accum "
- ;
+static const char GLServerExtensions[] =
+ "GL_ARB_depth_texture "
+ "GL_ARB_draw_buffers "
+ "GL_ARB_fragment_program "
+ "GL_ARB_fragment_program_shadow "
+ "GL_ARB_imaging "
+ "GL_ARB_multisample "
+ "GL_ARB_multitexture "
+ "GL_ARB_occlusion_query "
+ "GL_ARB_point_parameters "
+ "GL_ARB_point_sprite "
+ "GL_ARB_shadow "
+ "GL_ARB_shadow_ambient "
+ "GL_ARB_texture_border_clamp "
+ "GL_ARB_texture_compression "
+ "GL_ARB_texture_cube_map "
+ "GL_ARB_texture_env_add "
+ "GL_ARB_texture_env_combine "
+ "GL_ARB_texture_env_crossbar "
+ "GL_ARB_texture_env_dot3 "
+ "GL_ARB_texture_mirrored_repeat "
+ "GL_ARB_texture_non_power_of_two "
+ "GL_ARB_transpose_matrix "
+ "GL_ARB_vertex_program "
+ "GL_ARB_window_pos "
+ "GL_EXT_abgr "
+ "GL_EXT_bgra "
+ "GL_EXT_blend_color "
+ "GL_EXT_blend_equation_separate "
+ "GL_EXT_blend_func_separate "
+ "GL_EXT_blend_logic_op "
+ "GL_EXT_blend_minmax "
+ "GL_EXT_blend_subtract "
+ "GL_EXT_clip_volume_hint "
+ "GL_EXT_copy_texture "
+ "GL_EXT_draw_range_elements "
+ "GL_EXT_fog_coord "
+ "GL_EXT_framebuffer_object "
+ "GL_EXT_multi_draw_arrays "
+ "GL_EXT_packed_pixels "
+ "GL_EXT_paletted_texture "
+ "GL_EXT_point_parameters "
+ "GL_EXT_polygon_offset "
+ "GL_EXT_rescale_normal "
+ "GL_EXT_secondary_color "
+ "GL_EXT_separate_specular_color "
+ "GL_EXT_shadow_funcs "
+ "GL_EXT_shared_texture_palette "
+ "GL_EXT_stencil_two_side "
+ "GL_EXT_stencil_wrap "
+ "GL_EXT_subtexture "
+ "GL_EXT_texture "
+ "GL_EXT_texture3D "
+ "GL_EXT_texture_compression_dxt1 "
+ "GL_EXT_texture_compression_s3tc "
+ "GL_EXT_texture_edge_clamp "
+ "GL_EXT_texture_env_add "
+ "GL_EXT_texture_env_combine "
+ "GL_EXT_texture_env_dot3 "
+ "GL_EXT_texture_filter_anisotropic "
+ "GL_EXT_texture_lod "
+ "GL_EXT_texture_lod_bias "
+ "GL_EXT_texture_mirror_clamp "
+ "GL_EXT_texture_object "
+ "GL_EXT_texture_rectangle "
+ "GL_EXT_vertex_array "
+ "GL_3DFX_texture_compression_FXT1 "
+ "GL_APPLE_packed_pixels "
+ "GL_ATI_draw_buffers "
+ "GL_ATI_texture_env_combine3 "
+ "GL_ATI_texture_mirror_once "
+ "GL_HP_occlusion_test "
+ "GL_IBM_texture_mirrored_repeat "
+ "GL_INGR_blend_func_separate "
+ "GL_MESA_pack_invert "
+ "GL_MESA_ycbcr_texture "
+ "GL_NV_blend_square "
+ "GL_NV_depth_clamp "
+ "GL_NV_fog_distance "
+ "GL_NV_fragment_program "
+ "GL_NV_fragment_program_option "
+ "GL_NV_fragment_program2 "
+ "GL_NV_light_max_exponent "
+ "GL_NV_multisample_filter_hint "
+ "GL_NV_point_sprite "
+ "GL_NV_texgen_reflection "
+ "GL_NV_texture_compression_vtc "
+ "GL_NV_texture_env_combine4 "
+ "GL_NV_texture_expand_normal "
+ "GL_NV_texture_rectangle "
+ "GL_NV_vertex_program "
+ "GL_NV_vertex_program1_1 "
+ "GL_NV_vertex_program2 "
+ "GL_NV_vertex_program2_option "
+ "GL_NV_vertex_program3 "
+ "GL_OES_compressed_paletted_texture "
+ "GL_SGI_color_matrix "
+ "GL_SGI_color_table "
+ "GL_SGIS_generate_mipmap "
+ "GL_SGIS_multisample "
+ "GL_SGIS_point_parameters "
+ "GL_SGIS_texture_border_clamp "
+ "GL_SGIS_texture_edge_clamp "
+ "GL_SGIS_texture_lod "
+ "GL_SGIX_depth_texture "
+ "GL_SGIX_shadow " "GL_SGIX_shadow_ambient " "GL_SUN_slice_accum ";
/*
** We have made the simplifying assuption that the same extensions are
@@ -170,24 +168,20 @@ static char GLXServerVendorName[] = "SGI";
unsigned glxMajorVersion = SERVER_GLX_MAJOR_VERSION;
unsigned glxMinorVersion = SERVER_GLX_MINOR_VERSION;
static char GLXServerExtensions[] =
- "GLX_ARB_multisample "
- "GLX_EXT_visual_info "
- "GLX_EXT_visual_rating "
- "GLX_EXT_import_context "
- "GLX_EXT_texture_from_pixmap "
- "GLX_OML_swap_method "
- "GLX_SGI_make_current_read "
+ "GLX_ARB_multisample "
+ "GLX_EXT_visual_info "
+ "GLX_EXT_visual_rating "
+ "GLX_EXT_import_context "
+ "GLX_EXT_texture_from_pixmap "
+ "GLX_OML_swap_method " "GLX_SGI_make_current_read "
#ifndef __APPLE__
- "GLX_SGIS_multisample "
+ "GLX_SGIS_multisample "
#endif
- "GLX_SGIX_fbconfig "
- "GLX_SGIX_pbuffer "
- "GLX_MESA_copy_sub_buffer "
- "GLX_INTEL_swap_event"
- ;
+ "GLX_SGIX_fbconfig "
+ "GLX_SGIX_pbuffer " "GLX_MESA_copy_sub_buffer " "GLX_INTEL_swap_event";
static Bool
-glxCloseScreen (int index, ScreenPtr pScreen)
+glxCloseScreen(int index, ScreenPtr pScreen)
{
__GLXscreen *pGlxScreen = glxGetScreen(pScreen);
@@ -204,23 +198,24 @@ glxGetScreen(ScreenPtr pScreen)
return dixLookupPrivate(&pScreen->devPrivates, glxScreenPrivateKey);
}
-_X_EXPORT void GlxSetVisualConfigs(int nconfigs,
- void *configs, void **privates)
+_X_EXPORT void
+GlxSetVisualConfigs(int nconfigs, void *configs, void **privates)
{
/* We keep this stub around for the DDX drivers that still
* call it. */
}
-GLint glxConvertToXVisualType(int visualType)
+GLint
+glxConvertToXVisualType(int visualType)
{
static const int x_visual_types[] = {
- TrueColor, DirectColor,
- PseudoColor, StaticColor,
- GrayScale, StaticGray
+ TrueColor, DirectColor,
+ PseudoColor, StaticColor,
+ GrayScale, StaticGray
};
- return ( (unsigned) (visualType - GLX_TRUE_COLOR) < 6 )
- ? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1;
+ return ((unsigned) (visualType - GLX_TRUE_COLOR) < 6)
+ ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1;
}
/* This code inspired by composite/compinit.c. We could move this to
@@ -229,23 +224,23 @@ GLint glxConvertToXVisualType(int visualType)
static VisualPtr
AddScreenVisuals(ScreenPtr pScreen, int count, int d)
{
- int i;
- DepthPtr depth;
+ int i;
+ DepthPtr depth;
depth = NULL;
for (i = 0; i < pScreen->numDepths; i++) {
- if (pScreen->allowedDepths[i].depth == d) {
- depth = &pScreen->allowedDepths[i];
- break;
- }
+ if (pScreen->allowedDepths[i].depth == d) {
+ depth = &pScreen->allowedDepths[i];
+ break;
+ }
}
if (depth == NULL)
- return NULL;
+ return NULL;
if (ResizeVisualArray(pScreen, count, depth) == FALSE)
return NULL;
- /* Return a pointer to the first of the added visuals. */
+ /* Return a pointer to the first of the added visuals. */
return pScreen->visuals + pScreen->numVisuals - count;
}
@@ -255,16 +250,17 @@ findFirstSet(unsigned int v)
int i;
for (i = 0; i < 32; i++)
- if (v & (1 << i))
- return i;
+ if (v & (1 << i))
+ return i;
return -1;
}
static void
-initGlxVisual(VisualPtr visual, __GLXconfig *config)
+initGlxVisual(VisualPtr visual, __GLXconfig * config)
{
int maxBits;
+
maxBits = max(config->redBits, max(config->greenBits, config->blueBits));
config->visualID = visual->vid;
@@ -282,59 +278,60 @@ initGlxVisual(VisualPtr visual, __GLXconfig *config)
}
static __GLXconfig *
-pickFBConfig(__GLXscreen *pGlxScreen, VisualPtr visual)
+pickFBConfig(__GLXscreen * pGlxScreen, VisualPtr visual)
{
__GLXconfig *best = NULL, *config;
int best_score = 0;
for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
- int score = 0;
-
- if (config->redMask != visual->redMask ||
- config->greenMask != visual->greenMask ||
- config->blueMask != visual->blueMask)
- continue;
- if (config->visualRating != GLX_NONE)
- continue;
- if (glxConvertToXVisualType(config->visualType) != visual->class)
- continue;
- /* If it's the 32-bit RGBA visual, demand a 32-bit fbconfig. */
- if (visual->nplanes == 32 && config->rgbBits != 32)
- continue;
- /* Can't use the same FBconfig for multiple X visuals. I think. */
- if (config->visualID != 0)
- continue;
-
- if (config->doubleBufferMode > 0)
- score += 8;
- if (config->depthBits > 0)
- score += 4;
- if (config->stencilBits > 0)
- score += 2;
- if (config->alphaBits > 0)
- score++;
-
- if (score > best_score) {
- best = config;
- best_score = score;
- }
+ int score = 0;
+
+ if (config->redMask != visual->redMask ||
+ config->greenMask != visual->greenMask ||
+ config->blueMask != visual->blueMask)
+ continue;
+ if (config->visualRating != GLX_NONE)
+ continue;
+ if (glxConvertToXVisualType(config->visualType) != visual->class)
+ continue;
+ /* If it's the 32-bit RGBA visual, demand a 32-bit fbconfig. */
+ if (visual->nplanes == 32 && config->rgbBits != 32)
+ continue;
+ /* Can't use the same FBconfig for multiple X visuals. I think. */
+ if (config->visualID != 0)
+ continue;
+
+ if (config->doubleBufferMode > 0)
+ score += 8;
+ if (config->depthBits > 0)
+ score += 4;
+ if (config->stencilBits > 0)
+ score += 2;
+ if (config->alphaBits > 0)
+ score++;
+
+ if (score > best_score) {
+ best = config;
+ best_score = score;
+ }
}
return best;
}
-void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
+void
+__glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
{
__GLXconfig *m;
__GLXconfig *config;
int i;
if (!dixRegisterPrivateKey(&glxScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return;
+ return;
- pGlxScreen->pScreen = pScreen;
- pGlxScreen->GLextensions = strdup(GLServerExtensions);
- pGlxScreen->GLXvendor = strdup(GLXServerVendorName);
+ pGlxScreen->pScreen = pScreen;
+ pGlxScreen->GLextensions = strdup(GLServerExtensions);
+ pGlxScreen->GLXvendor = strdup(GLXServerVendorName);
pGlxScreen->GLXextensions = strdup(GLXServerExtensions);
/* All GLX providers must support all of the functionality required for at
@@ -343,22 +340,22 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
* most providers, the screen-probe routine is the caller of this
* function.
*/
- pGlxScreen->GLXmajor = 1;
- pGlxScreen->GLXminor = 2;
+ pGlxScreen->GLXmajor = 1;
+ pGlxScreen->GLXminor = 2;
pGlxScreen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = glxCloseScreen;
i = 0;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {
- m->fbconfigID = FakeClientID(0);
- m->visualID = 0;
- i++;
+ m->fbconfigID = FakeClientID(0);
+ m->visualID = 0;
+ i++;
}
pGlxScreen->numFBConfigs = i;
pGlxScreen->visuals =
- calloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *));
+ calloc(pGlxScreen->numFBConfigs, sizeof(__GLXconfig *));
/* First, try to choose featureful FBconfigs for the existing X visuals.
* Note that if multiple X visuals end up with the same FBconfig being
@@ -366,62 +363,63 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
* prioritize the root visual being GLX).
*/
for (i = 0; i < pScreen->numVisuals; i++) {
- VisualPtr visual = &pScreen->visuals[i];
+ VisualPtr visual = &pScreen->visuals[i];
- config = pickFBConfig(pGlxScreen, visual);
- if (config) {
- pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
- config->visualID = visual->vid;
- }
+ config = pickFBConfig(pGlxScreen, visual);
+ if (config) {
+ pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
+ config->visualID = visual->vid;
+ }
}
/* Then, add new visuals corresponding to all FBconfigs that didn't have
* an existing, appropriate visual.
*/
for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
- int depth;
-
- VisualPtr visual;
-
- if (config->visualID != 0)
- continue;
-
- /* Only count RGB bits and not alpha, as we're not trying to create
- * visuals for compositing (that's what the 32-bit composite visual
- * set up above is for.
- */
- depth = config->redBits + config->greenBits + config->blueBits;
-
- /* Make sure that our FBconfig's depth can actually be displayed
- * (corresponds to an existing visual).
- */
- for (i = 0; i < pScreen->numVisuals; i++) {
- if (depth == pScreen->visuals[i].nplanes)
- break;
- }
- /* if it can't, fix up the fbconfig to not advertise window support */
- if (i == pScreen->numVisuals)
- config->drawableType &= ~(GLX_WINDOW_BIT);
-
- /* fbconfig must support window drawables */
- if (!(config->drawableType & GLX_WINDOW_BIT)) {
- config->visualID = 0;
- continue;
- }
-
- /* Create a new X visual for our FBconfig. */
- visual = AddScreenVisuals(pScreen, 1, depth);
- if (visual == NULL)
- continue;
-
- pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
- initGlxVisual(visual, config);
+ int depth;
+
+ VisualPtr visual;
+
+ if (config->visualID != 0)
+ continue;
+
+ /* Only count RGB bits and not alpha, as we're not trying to create
+ * visuals for compositing (that's what the 32-bit composite visual
+ * set up above is for.
+ */
+ depth = config->redBits + config->greenBits + config->blueBits;
+
+ /* Make sure that our FBconfig's depth can actually be displayed
+ * (corresponds to an existing visual).
+ */
+ for (i = 0; i < pScreen->numVisuals; i++) {
+ if (depth == pScreen->visuals[i].nplanes)
+ break;
+ }
+ /* if it can't, fix up the fbconfig to not advertise window support */
+ if (i == pScreen->numVisuals)
+ config->drawableType &= ~(GLX_WINDOW_BIT);
+
+ /* fbconfig must support window drawables */
+ if (!(config->drawableType & GLX_WINDOW_BIT)) {
+ config->visualID = 0;
+ continue;
+ }
+
+ /* Create a new X visual for our FBconfig. */
+ visual = AddScreenVisuals(pScreen, 1, depth);
+ if (visual == NULL)
+ continue;
+
+ pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
+ initGlxVisual(visual, config);
}
dixSetPrivate(&pScreen->devPrivates, glxScreenPrivateKey, pGlxScreen);
}
-void __glXScreenDestroy(__GLXscreen *screen)
+void
+__glXScreenDestroy(__GLXscreen * screen)
{
free(screen->GLXvendor);
free(screen->GLXextensions);
diff --git a/xorg-server/glx/glxscreens.h b/xorg-server/glx/glxscreens.h
index eb2926045..d5420ee8d 100644
--- a/xorg-server/glx/glxscreens.h
+++ b/xorg-server/glx/glxscreens.h
@@ -41,10 +41,10 @@ struct __GLXconfig {
GLuint doubleBufferMode;
GLuint stereoMode;
- GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
+ GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
GLuint redMask, greenMask, blueMask, alphaMask;
- GLint rgbBits; /* total bits for rgb */
- GLint indexBits; /* total bits for colorindex */
+ GLint rgbBits; /* total bits for rgb */
+ GLint indexBits; /* total bits for colorindex */
GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
GLint depthBits;
@@ -67,7 +67,7 @@ struct __GLXconfig {
/* EXT_visual_info / GLX 1.2 */
GLint transparentPixel;
- /* colors are floats scaled to ints */
+ /* colors are floats scaled to ints */
GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
GLint transparentIndex;
@@ -85,8 +85,8 @@ struct __GLXconfig {
GLint maxPbufferWidth;
GLint maxPbufferHeight;
GLint maxPbufferPixels;
- GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */
- GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
+ GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */
+ GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
/* SGIX_visual_select_group */
GLint visualSelectGroup;
@@ -113,21 +113,19 @@ GLint glxConvertToXVisualType(int visualType);
*/
typedef struct __GLXscreen __GLXscreen;
struct __GLXscreen {
- void (*destroy) (__GLXscreen *screen);
-
- __GLXcontext *(*createContext) (__GLXscreen *screen,
- __GLXconfig *modes,
- __GLXcontext *shareContext);
-
- __GLXdrawable *(*createDrawable)(ClientPtr client,
- __GLXscreen *context,
- DrawablePtr pDraw,
- XID drawId,
- int type,
- XID glxDrawId,
- __GLXconfig *modes);
- int (*swapInterval) (__GLXdrawable *drawable,
- int interval);
+ void (*destroy) (__GLXscreen * screen);
+
+ __GLXcontext *(*createContext) (__GLXscreen * screen,
+ __GLXconfig * modes,
+ __GLXcontext * shareContext);
+
+ __GLXdrawable *(*createDrawable) (ClientPtr client,
+ __GLXscreen * context,
+ DrawablePtr pDraw,
+ XID drawId,
+ int type,
+ XID glxDrawId, __GLXconfig * modes);
+ int (*swapInterval) (__GLXdrawable * drawable, int interval);
ScreenPtr pScreen;
@@ -150,16 +148,15 @@ struct __GLXscreen {
* Since the GLX version advertised by the server is for the whole server,
* the GLX protocol code uses the minimum version supported on all screens.
*/
- /*@{*/
+ /*@{ */
unsigned GLXmajor;
unsigned GLXminor;
- /*@}*/
+ /*@} */
- Bool (*CloseScreen)(int index, ScreenPtr pScreen);
+ Bool (*CloseScreen) (int index, ScreenPtr pScreen);
};
+void __glXScreenInit(__GLXscreen * screen, ScreenPtr pScreen);
+void __glXScreenDestroy(__GLXscreen * screen);
-void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen);
-void __glXScreenDestroy(__GLXscreen *screen);
-
-#endif /* !__GLX_screens_h__ */
+#endif /* !__GLX_screens_h__ */
diff --git a/xorg-server/glx/glxserver.h b/xorg-server/glx/glxserver.h
index 40a20e372..32279590e 100644
--- a/xorg-server/glx/glxserver.h
+++ b/xorg-server/glx/glxserver.h
@@ -46,7 +46,7 @@
#include <resource.h>
#include <scrnintstr.h>
-#define GL_GLEXT_PROTOTYPES /* we want prototypes */
+#define GL_GLEXT_PROTOTYPES /* we want prototypes */
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glxproto.h>
@@ -80,16 +80,16 @@ extern __GLXclientState *glxGetClient(ClientPtr pClient);
void GlxExtensionInit(void);
-void GlxSetVisualConfigs(int nconfigs,
- void *configs, void **privates);
+void GlxSetVisualConfigs(int nconfigs, void *configs, void **privates);
-void __glXScreenInitVisuals(__GLXscreen *screen);
+void __glXScreenInitVisuals(__GLXscreen * screen);
/*
** The last context used (from the server's persective) is cached.
*/
extern __GLXcontext *__glXLastContext;
-extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
+extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
+ int *);
int __glXError(int error);
@@ -97,12 +97,12 @@ int __glXError(int error);
typedef struct __GLXprovider __GLXprovider;
struct __GLXprovider {
- __GLXscreen *(*screenProbe)(ScreenPtr pScreen);
- const char *name;
+ __GLXscreen *(*screenProbe) (ScreenPtr pScreen);
+ const char *name;
__GLXprovider *next;
};
-void GlxPushProvider(__GLXprovider *provider);
+void GlxPushProvider(__GLXprovider * provider);
enum {
GLX_MINIMAL_VISUALS,
@@ -110,8 +110,8 @@ enum {
GLX_ALL_VISUALS
};
-void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
- void (*leave)(GLboolean));
+void __glXsetEnterLeaveServerFuncs(void (*enter) (GLboolean),
+ void (*leave) (GLboolean));
void __glXenterServer(GLboolean rendering);
void __glXleaveServer(GLboolean rendering);
@@ -123,23 +123,23 @@ void glxResumeClients(void);
*/
struct __GLXclientStateRec {
/*
- ** Whether this structure is currently being used to support a client.
- */
+ ** Whether this structure is currently being used to support a client.
+ */
Bool inUse;
/*
- ** Buffer for returned data.
- */
+ ** Buffer for returned data.
+ */
GLbyte *returnBuf;
GLint returnBufSize;
/*
- ** Keep track of large rendering commands, which span multiple requests.
- */
- GLint largeCmdBytesSoFar; /* bytes received so far */
- GLint largeCmdBytesTotal; /* total bytes expected */
- GLint largeCmdRequestsSoFar; /* requests received so far */
- GLint largeCmdRequestsTotal; /* total requests expected */
+ ** Keep track of large rendering commands, which span multiple requests.
+ */
+ GLint largeCmdBytesSoFar; /* bytes received so far */
+ GLint largeCmdBytesTotal; /* total bytes expected */
+ GLint largeCmdRequestsSoFar; /* requests received so far */
+ GLint largeCmdRequestsTotal; /* total requests expected */
GLbyte *largeCmdBuf;
GLint largeCmdBufSize;
@@ -156,19 +156,19 @@ struct __GLXclientStateRec {
/*
** Dispatch tables.
*/
-typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *);
-typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *);
-typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *);
+typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *);
+typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *);
+typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *);
/*
* Dispatch for GLX commands.
*/
-typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc);
+typedef int (*__GLXprocPtr) (__GLXclientState *, char *pc);
/*
* Tables for computing the size of each rendering command.
*/
-typedef int (*gl_proto_size_func)(const GLbyte *, Bool);
+typedef int (*gl_proto_size_func) (const GLbyte *, Bool);
typedef struct {
int bytes;
@@ -198,21 +198,22 @@ extern char *__glXcombine_strings(const char *, const char *);
*/
extern void __glXSwapMakeCurrentReply(ClientPtr client,
- xGLXMakeCurrentReply *reply);
-extern void __glXSwapIsDirectReply(ClientPtr client,
- xGLXIsDirectReply *reply);
+ xGLXMakeCurrentReply * reply);
+extern void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply);
extern void __glXSwapQueryVersionReply(ClientPtr client,
- xGLXQueryVersionReply *reply);
+ xGLXQueryVersionReply * reply);
extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
- xGLXQueryContextInfoEXTReply *reply,
- int *buf);
+ xGLXQueryContextInfoEXTReply *
+ reply, int *buf);
extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
- xGLXGetDrawableAttributesReply *reply, CARD32 *buf);
+ xGLXGetDrawableAttributesReply *
+ reply, CARD32 *buf);
extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
- xGLXQueryExtensionsStringReply *reply, char *buf);
+ xGLXQueryExtensionsStringReply *
+ reply, char *buf);
extern void glxSwapQueryServerStringReply(ClientPtr client,
- xGLXQueryServerStringReply *reply, char *buf);
-
+ xGLXQueryServerStringReply * reply,
+ char *buf);
/*
* Routines for computing the size of variably-sized rendering commands.
@@ -220,13 +221,13 @@ extern void glxSwapQueryServerStringReply(ClientPtr client,
extern int __glXTypeSize(GLenum enm);
extern int __glXImageSize(GLenum format, GLenum type,
- GLenum target, GLsizei w, GLsizei h, GLsizei d,
- GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows,
- GLint alignment);
+ GLenum target, GLsizei w, GLsizei h, GLsizei d,
+ GLint imageHeight, GLint rowLength, GLint skipImages,
+ GLint skipRows, GLint alignment);
extern unsigned glxMajorVersion;
extern unsigned glxMinorVersion;
extern int __glXEventBase;
-#endif /* !__GLX_server_h__ */
+#endif /* !__GLX_server_h__ */
diff --git a/xorg-server/glx/indirect_dispatch.c b/xorg-server/glx/indirect_dispatch.c
index 5c325d25e..d824957d3 100644
--- a/xorg-server/glx/indirect_dispatch.c
+++ b/xorg-server/glx/indirect_dispatch.c
@@ -1,5938 +1,5938 @@
-/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */
-
-/*
- * (C) Copyright IBM Corporation 2005
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#else
-
-#include "glheader.h"
-
-#endif
-
-#include <X11/Xmd.h>
-#include <GL/gl.h>
-#include <GL/glxproto.h>
-#include <inttypes.h>
-#include "indirect_size.h"
-#include "indirect_size_get.h"
-#include "indirect_dispatch.h"
-#include "glxserver.h"
-#include "glxbyteorder.h"
-#include "indirect_util.h"
-#include "singlesize.h"
-#include "glapi.h"
-#include "glapitable.h"
-#include "glthread.h"
-#include "dispatch.h"
-
-#define __GLX_PAD(x) (((x) + 3) & ~3)
-
-typedef struct {
- __GLX_PIXEL_3D_HDR;
-} __GLXpixel3DHeader;
-
-extern GLboolean __glXErrorOccured( void );
-extern void __glXClearErrorOccured( void );
-
-static const unsigned dummy_answer[2] = {0, 0};
-
-int __glXDisp_NewList(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- CALL_NewList( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- *(GLenum *)(pc + 4)
- ) );
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_EndList(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- CALL_EndList( GET_DISPATCH(), () );
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_CallList(GLbyte * pc)
-{
- CALL_CallList( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_CallLists(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 0);
- const GLenum type = *(GLenum *)(pc + 4);
- const GLvoid * lists = (const GLvoid *)(pc + 8);
-
- CALL_CallLists( GET_DISPATCH(), (
- n,
- type,
- lists
- ) );
-}
-
-int __glXDisp_DeleteLists(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- CALL_DeleteLists( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- *(GLsizei *)(pc + 4)
- ) );
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GenLists(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLuint retval;
- retval = CALL_GenLists( GET_DISPATCH(), (
- *(GLsizei *)(pc + 0)
- ) );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_ListBase(GLbyte * pc)
-{
- CALL_ListBase( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Begin(GLbyte * pc)
-{
- CALL_Begin( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Bitmap(GLbyte * pc)
-{
- const GLubyte * const bitmap = (const GLubyte *) (pc + 44);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_Bitmap( GET_DISPATCH(), (
- *(GLsizei *)(pc + 20),
- *(GLsizei *)(pc + 24),
- *(GLfloat *)(pc + 28),
- *(GLfloat *)(pc + 32),
- *(GLfloat *)(pc + 36),
- *(GLfloat *)(pc + 40),
- bitmap
- ) );
-}
-
-void __glXDisp_Color3bv(GLbyte * pc)
-{
- CALL_Color3bv( GET_DISPATCH(), (
- (const GLbyte *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color3dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_Color3dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color3fv(GLbyte * pc)
-{
- CALL_Color3fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color3iv(GLbyte * pc)
-{
- CALL_Color3iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color3sv(GLbyte * pc)
-{
- CALL_Color3sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color3ubv(GLbyte * pc)
-{
- CALL_Color3ubv( GET_DISPATCH(), (
- (const GLubyte *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color3uiv(GLbyte * pc)
-{
- CALL_Color3uiv( GET_DISPATCH(), (
- (const GLuint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color3usv(GLbyte * pc)
-{
- CALL_Color3usv( GET_DISPATCH(), (
- (const GLushort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color4bv(GLbyte * pc)
-{
- CALL_Color4bv( GET_DISPATCH(), (
- (const GLbyte *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color4dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_Color4dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color4fv(GLbyte * pc)
-{
- CALL_Color4fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color4iv(GLbyte * pc)
-{
- CALL_Color4iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color4sv(GLbyte * pc)
-{
- CALL_Color4sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color4ubv(GLbyte * pc)
-{
- CALL_Color4ubv( GET_DISPATCH(), (
- (const GLubyte *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color4uiv(GLbyte * pc)
-{
- CALL_Color4uiv( GET_DISPATCH(), (
- (const GLuint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Color4usv(GLbyte * pc)
-{
- CALL_Color4usv( GET_DISPATCH(), (
- (const GLushort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_EdgeFlagv(GLbyte * pc)
-{
- CALL_EdgeFlagv( GET_DISPATCH(), (
- (const GLboolean *)(pc + 0)
- ) );
-}
-
-void __glXDisp_End(GLbyte * pc)
-{
- CALL_End( GET_DISPATCH(), () );
-}
-
-void __glXDisp_Indexdv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 8);
- pc -= 4;
- }
-#endif
-
- CALL_Indexdv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Indexfv(GLbyte * pc)
-{
- CALL_Indexfv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Indexiv(GLbyte * pc)
-{
- CALL_Indexiv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Indexsv(GLbyte * pc)
-{
- CALL_Indexsv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Normal3bv(GLbyte * pc)
-{
- CALL_Normal3bv( GET_DISPATCH(), (
- (const GLbyte *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Normal3dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_Normal3dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Normal3fv(GLbyte * pc)
-{
- CALL_Normal3fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Normal3iv(GLbyte * pc)
-{
- CALL_Normal3iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Normal3sv(GLbyte * pc)
-{
- CALL_Normal3sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos2dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_RasterPos2dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos2fv(GLbyte * pc)
-{
- CALL_RasterPos2fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos2iv(GLbyte * pc)
-{
- CALL_RasterPos2iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos2sv(GLbyte * pc)
-{
- CALL_RasterPos2sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos3dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_RasterPos3dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos3fv(GLbyte * pc)
-{
- CALL_RasterPos3fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos3iv(GLbyte * pc)
-{
- CALL_RasterPos3iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos3sv(GLbyte * pc)
-{
- CALL_RasterPos3sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos4dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_RasterPos4dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos4fv(GLbyte * pc)
-{
- CALL_RasterPos4fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos4iv(GLbyte * pc)
-{
- CALL_RasterPos4iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_RasterPos4sv(GLbyte * pc)
-{
- CALL_RasterPos4sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Rectdv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_Rectdv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0),
- (const GLdouble *)(pc + 16)
- ) );
-}
-
-void __glXDisp_Rectfv(GLbyte * pc)
-{
- CALL_Rectfv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0),
- (const GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_Rectiv(GLbyte * pc)
-{
- CALL_Rectiv( GET_DISPATCH(), (
- (const GLint *)(pc + 0),
- (const GLint *)(pc + 8)
- ) );
-}
-
-void __glXDisp_Rectsv(GLbyte * pc)
-{
- CALL_Rectsv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_TexCoord1dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 8);
- pc -= 4;
- }
-#endif
-
- CALL_TexCoord1dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord1fv(GLbyte * pc)
-{
- CALL_TexCoord1fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord1iv(GLbyte * pc)
-{
- CALL_TexCoord1iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord1sv(GLbyte * pc)
-{
- CALL_TexCoord1sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord2dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_TexCoord2dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord2fv(GLbyte * pc)
-{
- CALL_TexCoord2fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord2iv(GLbyte * pc)
-{
- CALL_TexCoord2iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord2sv(GLbyte * pc)
-{
- CALL_TexCoord2sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord3dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_TexCoord3dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord3fv(GLbyte * pc)
-{
- CALL_TexCoord3fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord3iv(GLbyte * pc)
-{
- CALL_TexCoord3iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord3sv(GLbyte * pc)
-{
- CALL_TexCoord3sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord4dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_TexCoord4dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord4fv(GLbyte * pc)
-{
- CALL_TexCoord4fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord4iv(GLbyte * pc)
-{
- CALL_TexCoord4iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexCoord4sv(GLbyte * pc)
-{
- CALL_TexCoord4sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex2dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_Vertex2dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex2fv(GLbyte * pc)
-{
- CALL_Vertex2fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex2iv(GLbyte * pc)
-{
- CALL_Vertex2iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex2sv(GLbyte * pc)
-{
- CALL_Vertex2sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex3dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_Vertex3dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex3fv(GLbyte * pc)
-{
- CALL_Vertex3fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex3iv(GLbyte * pc)
-{
- CALL_Vertex3iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex3sv(GLbyte * pc)
-{
- CALL_Vertex3sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex4dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_Vertex4dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex4fv(GLbyte * pc)
-{
- CALL_Vertex4fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex4iv(GLbyte * pc)
-{
- CALL_Vertex4iv( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Vertex4sv(GLbyte * pc)
-{
- CALL_Vertex4sv( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_ClipPlane(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 36);
- pc -= 4;
- }
-#endif
-
- CALL_ClipPlane( GET_DISPATCH(), (
- *(GLenum *)(pc + 32),
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_ColorMaterial(GLbyte * pc)
-{
- CALL_ColorMaterial( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4)
- ) );
-}
-
-void __glXDisp_CullFace(GLbyte * pc)
-{
- CALL_CullFace( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Fogf(GLbyte * pc)
-{
- CALL_Fogf( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_Fogfv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 0);
- const GLfloat * params;
-
- params = (const GLfloat *) (pc + 4);
-
- CALL_Fogfv( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDisp_Fogi(GLbyte * pc)
-{
- CALL_Fogi( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_Fogiv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 0);
- const GLint * params;
-
- params = (const GLint *) (pc + 4);
-
- CALL_Fogiv( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDisp_FrontFace(GLbyte * pc)
-{
- CALL_FrontFace( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Hint(GLbyte * pc)
-{
- CALL_Hint( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4)
- ) );
-}
-
-void __glXDisp_Lightf(GLbyte * pc)
-{
- CALL_Lightf( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_Lightfv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLfloat * params;
-
- params = (const GLfloat *) (pc + 8);
-
- CALL_Lightfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_Lighti(GLbyte * pc)
-{
- CALL_Lighti( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLint *)(pc + 8)
- ) );
-}
-
-void __glXDisp_Lightiv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLint * params;
-
- params = (const GLint *) (pc + 8);
-
- CALL_Lightiv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_LightModelf(GLbyte * pc)
-{
- CALL_LightModelf( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_LightModelfv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 0);
- const GLfloat * params;
-
- params = (const GLfloat *) (pc + 4);
-
- CALL_LightModelfv( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDisp_LightModeli(GLbyte * pc)
-{
- CALL_LightModeli( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_LightModeliv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 0);
- const GLint * params;
-
- params = (const GLint *) (pc + 4);
-
- CALL_LightModeliv( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDisp_LineStipple(GLbyte * pc)
-{
- CALL_LineStipple( GET_DISPATCH(), (
- *(GLint *)(pc + 0),
- *(GLushort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_LineWidth(GLbyte * pc)
-{
- CALL_LineWidth( GET_DISPATCH(), (
- *(GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Materialf(GLbyte * pc)
-{
- CALL_Materialf( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_Materialfv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLfloat * params;
-
- params = (const GLfloat *) (pc + 8);
-
- CALL_Materialfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_Materiali(GLbyte * pc)
-{
- CALL_Materiali( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLint *)(pc + 8)
- ) );
-}
-
-void __glXDisp_Materialiv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLint * params;
-
- params = (const GLint *) (pc + 8);
-
- CALL_Materialiv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_PointSize(GLbyte * pc)
-{
- CALL_PointSize( GET_DISPATCH(), (
- *(GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_PolygonMode(GLbyte * pc)
-{
- CALL_PolygonMode( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4)
- ) );
-}
-
-void __glXDisp_PolygonStipple(GLbyte * pc)
-{
- const GLubyte * const mask = (const GLubyte *) (pc + 20);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_PolygonStipple( GET_DISPATCH(), (
- mask
- ) );
-}
-
-void __glXDisp_Scissor(GLbyte * pc)
-{
- CALL_Scissor( GET_DISPATCH(), (
- *(GLint *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLsizei *)(pc + 8),
- *(GLsizei *)(pc + 12)
- ) );
-}
-
-void __glXDisp_ShadeModel(GLbyte * pc)
-{
- CALL_ShadeModel( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexParameterf(GLbyte * pc)
-{
- CALL_TexParameterf( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_TexParameterfv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLfloat * params;
-
- params = (const GLfloat *) (pc + 8);
-
- CALL_TexParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_TexParameteri(GLbyte * pc)
-{
- CALL_TexParameteri( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLint *)(pc + 8)
- ) );
-}
-
-void __glXDisp_TexParameteriv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLint * params;
-
- params = (const GLint *) (pc + 8);
-
- CALL_TexParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_TexImage1D(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 52);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_TexImage1D( GET_DISPATCH(), (
- *(GLenum *)(pc + 20),
- *(GLint *)(pc + 24),
- *(GLint *)(pc + 28),
- *(GLsizei *)(pc + 32),
- *(GLint *)(pc + 40),
- *(GLenum *)(pc + 44),
- *(GLenum *)(pc + 48),
- pixels
- ) );
-}
-
-void __glXDisp_TexImage2D(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 52);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_TexImage2D( GET_DISPATCH(), (
- *(GLenum *)(pc + 20),
- *(GLint *)(pc + 24),
- *(GLint *)(pc + 28),
- *(GLsizei *)(pc + 32),
- *(GLsizei *)(pc + 36),
- *(GLint *)(pc + 40),
- *(GLenum *)(pc + 44),
- *(GLenum *)(pc + 48),
- pixels
- ) );
-}
-
-void __glXDisp_TexEnvf(GLbyte * pc)
-{
- CALL_TexEnvf( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_TexEnvfv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLfloat * params;
-
- params = (const GLfloat *) (pc + 8);
-
- CALL_TexEnvfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_TexEnvi(GLbyte * pc)
-{
- CALL_TexEnvi( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLint *)(pc + 8)
- ) );
-}
-
-void __glXDisp_TexEnviv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLint * params;
-
- params = (const GLint *) (pc + 8);
-
- CALL_TexEnviv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_TexGend(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_TexGend( GET_DISPATCH(), (
- *(GLenum *)(pc + 8),
- *(GLenum *)(pc + 12),
- *(GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexGendv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLdouble * params;
-
-#ifdef __GLX_ALIGN64
- const GLuint compsize = __glTexGendv_size(pname);
- const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- params = (const GLdouble *) (pc + 8);
-
- CALL_TexGendv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_TexGenf(GLbyte * pc)
-{
- CALL_TexGenf( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_TexGenfv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLfloat * params;
-
- params = (const GLfloat *) (pc + 8);
-
- CALL_TexGenfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_TexGeni(GLbyte * pc)
-{
- CALL_TexGeni( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLint *)(pc + 8)
- ) );
-}
-
-void __glXDisp_TexGeniv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLint * params;
-
- params = (const GLint *) (pc + 8);
-
- CALL_TexGeniv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_InitNames(GLbyte * pc)
-{
- CALL_InitNames( GET_DISPATCH(), () );
-}
-
-void __glXDisp_LoadName(GLbyte * pc)
-{
- CALL_LoadName( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_PassThrough(GLbyte * pc)
-{
- CALL_PassThrough( GET_DISPATCH(), (
- *(GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_PopName(GLbyte * pc)
-{
- CALL_PopName( GET_DISPATCH(), () );
-}
-
-void __glXDisp_PushName(GLbyte * pc)
-{
- CALL_PushName( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_DrawBuffer(GLbyte * pc)
-{
- CALL_DrawBuffer( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Clear(GLbyte * pc)
-{
- CALL_Clear( GET_DISPATCH(), (
- *(GLbitfield *)(pc + 0)
- ) );
-}
-
-void __glXDisp_ClearAccum(GLbyte * pc)
-{
- CALL_ClearAccum( GET_DISPATCH(), (
- *(GLfloat *)(pc + 0),
- *(GLfloat *)(pc + 4),
- *(GLfloat *)(pc + 8),
- *(GLfloat *)(pc + 12)
- ) );
-}
-
-void __glXDisp_ClearIndex(GLbyte * pc)
-{
- CALL_ClearIndex( GET_DISPATCH(), (
- *(GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_ClearColor(GLbyte * pc)
-{
- CALL_ClearColor( GET_DISPATCH(), (
- *(GLclampf *)(pc + 0),
- *(GLclampf *)(pc + 4),
- *(GLclampf *)(pc + 8),
- *(GLclampf *)(pc + 12)
- ) );
-}
-
-void __glXDisp_ClearStencil(GLbyte * pc)
-{
- CALL_ClearStencil( GET_DISPATCH(), (
- *(GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_ClearDepth(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 8);
- pc -= 4;
- }
-#endif
-
- CALL_ClearDepth( GET_DISPATCH(), (
- *(GLclampd *)(pc + 0)
- ) );
-}
-
-void __glXDisp_StencilMask(GLbyte * pc)
-{
- CALL_StencilMask( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_ColorMask(GLbyte * pc)
-{
- CALL_ColorMask( GET_DISPATCH(), (
- *(GLboolean *)(pc + 0),
- *(GLboolean *)(pc + 1),
- *(GLboolean *)(pc + 2),
- *(GLboolean *)(pc + 3)
- ) );
-}
-
-void __glXDisp_DepthMask(GLbyte * pc)
-{
- CALL_DepthMask( GET_DISPATCH(), (
- *(GLboolean *)(pc + 0)
- ) );
-}
-
-void __glXDisp_IndexMask(GLbyte * pc)
-{
- CALL_IndexMask( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Accum(GLbyte * pc)
-{
- CALL_Accum( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_Disable(GLbyte * pc)
-{
- CALL_Disable( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Enable(GLbyte * pc)
-{
- CALL_Enable( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_PopAttrib(GLbyte * pc)
-{
- CALL_PopAttrib( GET_DISPATCH(), () );
-}
-
-void __glXDisp_PushAttrib(GLbyte * pc)
-{
- CALL_PushAttrib( GET_DISPATCH(), (
- *(GLbitfield *)(pc + 0)
- ) );
-}
-
-void __glXDisp_MapGrid1d(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 20);
- pc -= 4;
- }
-#endif
-
- CALL_MapGrid1d( GET_DISPATCH(), (
- *(GLint *)(pc + 16),
- *(GLdouble *)(pc + 0),
- *(GLdouble *)(pc + 8)
- ) );
-}
-
-void __glXDisp_MapGrid1f(GLbyte * pc)
-{
- CALL_MapGrid1f( GET_DISPATCH(), (
- *(GLint *)(pc + 0),
- *(GLfloat *)(pc + 4),
- *(GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_MapGrid2d(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 40);
- pc -= 4;
- }
-#endif
-
- CALL_MapGrid2d( GET_DISPATCH(), (
- *(GLint *)(pc + 32),
- *(GLdouble *)(pc + 0),
- *(GLdouble *)(pc + 8),
- *(GLint *)(pc + 36),
- *(GLdouble *)(pc + 16),
- *(GLdouble *)(pc + 24)
- ) );
-}
-
-void __glXDisp_MapGrid2f(GLbyte * pc)
-{
- CALL_MapGrid2f( GET_DISPATCH(), (
- *(GLint *)(pc + 0),
- *(GLfloat *)(pc + 4),
- *(GLfloat *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLfloat *)(pc + 16),
- *(GLfloat *)(pc + 20)
- ) );
-}
-
-void __glXDisp_EvalCoord1dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 8);
- pc -= 4;
- }
-#endif
-
- CALL_EvalCoord1dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_EvalCoord1fv(GLbyte * pc)
-{
- CALL_EvalCoord1fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_EvalCoord2dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_EvalCoord2dv( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_EvalCoord2fv(GLbyte * pc)
-{
- CALL_EvalCoord2fv( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_EvalMesh1(GLbyte * pc)
-{
- CALL_EvalMesh1( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLint *)(pc + 8)
- ) );
-}
-
-void __glXDisp_EvalPoint1(GLbyte * pc)
-{
- CALL_EvalPoint1( GET_DISPATCH(), (
- *(GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_EvalMesh2(GLbyte * pc)
-{
- CALL_EvalMesh2( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLint *)(pc + 16)
- ) );
-}
-
-void __glXDisp_EvalPoint2(GLbyte * pc)
-{
- CALL_EvalPoint2( GET_DISPATCH(), (
- *(GLint *)(pc + 0),
- *(GLint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_AlphaFunc(GLbyte * pc)
-{
- CALL_AlphaFunc( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLclampf *)(pc + 4)
- ) );
-}
-
-void __glXDisp_BlendFunc(GLbyte * pc)
-{
- CALL_BlendFunc( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4)
- ) );
-}
-
-void __glXDisp_LogicOp(GLbyte * pc)
-{
- CALL_LogicOp( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_StencilFunc(GLbyte * pc)
-{
- CALL_StencilFunc( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLuint *)(pc + 8)
- ) );
-}
-
-void __glXDisp_StencilOp(GLbyte * pc)
-{
- CALL_StencilOp( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8)
- ) );
-}
-
-void __glXDisp_DepthFunc(GLbyte * pc)
-{
- CALL_DepthFunc( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_PixelZoom(GLbyte * pc)
-{
- CALL_PixelZoom( GET_DISPATCH(), (
- *(GLfloat *)(pc + 0),
- *(GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_PixelTransferf(GLbyte * pc)
-{
- CALL_PixelTransferf( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_PixelTransferi(GLbyte * pc)
-{
- CALL_PixelTransferi( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4)
- ) );
-}
-
-int __glXDisp_PixelStoref(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- CALL_PixelStoref( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLfloat *)(pc + 4)
- ) );
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_PixelStorei(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- CALL_PixelStorei( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4)
- ) );
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_PixelMapfv(GLbyte * pc)
-{
- const GLsizei mapsize = *(GLsizei *)(pc + 4);
-
- CALL_PixelMapfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- mapsize,
- (const GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_PixelMapuiv(GLbyte * pc)
-{
- const GLsizei mapsize = *(GLsizei *)(pc + 4);
-
- CALL_PixelMapuiv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- mapsize,
- (const GLuint *)(pc + 8)
- ) );
-}
-
-void __glXDisp_PixelMapusv(GLbyte * pc)
-{
- const GLsizei mapsize = *(GLsizei *)(pc + 4);
-
- CALL_PixelMapusv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- mapsize,
- (const GLushort *)(pc + 8)
- ) );
-}
-
-void __glXDisp_ReadBuffer(GLbyte * pc)
-{
- CALL_ReadBuffer( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_CopyPixels(GLbyte * pc)
-{
- CALL_CopyPixels( GET_DISPATCH(), (
- *(GLint *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLsizei *)(pc + 8),
- *(GLsizei *)(pc + 12),
- *(GLenum *)(pc + 16)
- ) );
-}
-
-void __glXDisp_DrawPixels(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 36);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_DrawPixels( GET_DISPATCH(), (
- *(GLsizei *)(pc + 20),
- *(GLsizei *)(pc + 24),
- *(GLenum *)(pc + 28),
- *(GLenum *)(pc + 32),
- pixels
- ) );
-}
-
-int __glXDisp_GetBooleanv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 0);
-
- const GLuint compsize = __glGetBooleanv_size(pname);
- GLboolean answerBuffer[200];
- GLboolean * params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetBooleanv( GET_DISPATCH(), (
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 1, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLdouble equation[4];
- CALL_GetClipPlane( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- equation
- ) );
- __glXSendReply(cl->client, equation, 4, 8, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetDoublev(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 0);
-
- const GLuint compsize = __glGetDoublev_size(pname);
- GLdouble answerBuffer[200];
- GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetDoublev( GET_DISPATCH(), (
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetError(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLenum retval;
- retval = CALL_GetError( GET_DISPATCH(), () );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetFloatv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 0);
-
- const GLuint compsize = __glGetFloatv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetFloatv( GET_DISPATCH(), (
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetIntegerv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 0);
-
- const GLuint compsize = __glGetIntegerv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetIntegerv( GET_DISPATCH(), (
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetLightfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetLightfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetLightfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetLightiv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetLightiv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetLightiv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum target = *(GLenum *)(pc + 0);
- const GLenum query = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetMapdv_size(target,query);
- GLdouble answerBuffer[200];
- GLdouble * v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
-
- if (v == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMapdv( GET_DISPATCH(), (
- target,
- query,
- v
- ) );
- __glXSendReply(cl->client, v, compsize, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum target = *(GLenum *)(pc + 0);
- const GLenum query = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetMapfv_size(target,query);
- GLfloat answerBuffer[200];
- GLfloat * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (v == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMapfv( GET_DISPATCH(), (
- target,
- query,
- v
- ) );
- __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum target = *(GLenum *)(pc + 0);
- const GLenum query = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetMapiv_size(target,query);
- GLint answerBuffer[200];
- GLint * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (v == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMapiv( GET_DISPATCH(), (
- target,
- query,
- v
- ) );
- __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetMaterialfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetMaterialfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMaterialfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetMaterialiv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetMaterialiv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMaterialiv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum map = *(GLenum *)(pc + 0);
-
- const GLuint compsize = __glGetPixelMapfv_size(map);
- GLfloat answerBuffer[200];
- GLfloat * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (values == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetPixelMapfv( GET_DISPATCH(), (
- map,
- values
- ) );
- __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum map = *(GLenum *)(pc + 0);
-
- const GLuint compsize = __glGetPixelMapuiv_size(map);
- GLuint answerBuffer[200];
- GLuint * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (values == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetPixelMapuiv( GET_DISPATCH(), (
- map,
- values
- ) );
- __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum map = *(GLenum *)(pc + 0);
-
- const GLuint compsize = __glGetPixelMapusv_size(map);
- GLushort answerBuffer[200];
- GLushort * values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2);
-
- if (values == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetPixelMapusv( GET_DISPATCH(), (
- map,
- values
- ) );
- __glXSendReply(cl->client, values, compsize, 2, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetTexEnvfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexEnvfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetTexEnviv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetTexEnviv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexEnviv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetTexGendv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetTexGendv_size(pname);
- GLdouble answerBuffer[200];
- GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexGendv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetTexGenfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetTexGenfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexGenfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetTexGeniv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetTexGeniv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexGeniv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetTexParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetTexParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 8);
-
- const GLuint compsize = __glGetTexLevelParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexLevelParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 8);
-
- const GLuint compsize = __glGetTexLevelParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexLevelParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_IsEnabled(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsEnabled( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_IsList(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsList( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_DepthRange(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_DepthRange( GET_DISPATCH(), (
- *(GLclampd *)(pc + 0),
- *(GLclampd *)(pc + 8)
- ) );
-}
-
-void __glXDisp_Frustum(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 48);
- pc -= 4;
- }
-#endif
-
- CALL_Frustum( GET_DISPATCH(), (
- *(GLdouble *)(pc + 0),
- *(GLdouble *)(pc + 8),
- *(GLdouble *)(pc + 16),
- *(GLdouble *)(pc + 24),
- *(GLdouble *)(pc + 32),
- *(GLdouble *)(pc + 40)
- ) );
-}
-
-void __glXDisp_LoadIdentity(GLbyte * pc)
-{
- CALL_LoadIdentity( GET_DISPATCH(), () );
-}
-
-void __glXDisp_LoadMatrixf(GLbyte * pc)
-{
- CALL_LoadMatrixf( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_LoadMatrixd(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 128);
- pc -= 4;
- }
-#endif
-
- CALL_LoadMatrixd( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_MatrixMode(GLbyte * pc)
-{
- CALL_MatrixMode( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_MultMatrixf(GLbyte * pc)
-{
- CALL_MultMatrixf( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_MultMatrixd(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 128);
- pc -= 4;
- }
-#endif
-
- CALL_MultMatrixd( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_Ortho(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 48);
- pc -= 4;
- }
-#endif
-
- CALL_Ortho( GET_DISPATCH(), (
- *(GLdouble *)(pc + 0),
- *(GLdouble *)(pc + 8),
- *(GLdouble *)(pc + 16),
- *(GLdouble *)(pc + 24),
- *(GLdouble *)(pc + 32),
- *(GLdouble *)(pc + 40)
- ) );
-}
-
-void __glXDisp_PopMatrix(GLbyte * pc)
-{
- CALL_PopMatrix( GET_DISPATCH(), () );
-}
-
-void __glXDisp_PushMatrix(GLbyte * pc)
-{
- CALL_PushMatrix( GET_DISPATCH(), () );
-}
-
-void __glXDisp_Rotated(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_Rotated( GET_DISPATCH(), (
- *(GLdouble *)(pc + 0),
- *(GLdouble *)(pc + 8),
- *(GLdouble *)(pc + 16),
- *(GLdouble *)(pc + 24)
- ) );
-}
-
-void __glXDisp_Rotatef(GLbyte * pc)
-{
- CALL_Rotatef( GET_DISPATCH(), (
- *(GLfloat *)(pc + 0),
- *(GLfloat *)(pc + 4),
- *(GLfloat *)(pc + 8),
- *(GLfloat *)(pc + 12)
- ) );
-}
-
-void __glXDisp_Scaled(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_Scaled( GET_DISPATCH(), (
- *(GLdouble *)(pc + 0),
- *(GLdouble *)(pc + 8),
- *(GLdouble *)(pc + 16)
- ) );
-}
-
-void __glXDisp_Scalef(GLbyte * pc)
-{
- CALL_Scalef( GET_DISPATCH(), (
- *(GLfloat *)(pc + 0),
- *(GLfloat *)(pc + 4),
- *(GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_Translated(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_Translated( GET_DISPATCH(), (
- *(GLdouble *)(pc + 0),
- *(GLdouble *)(pc + 8),
- *(GLdouble *)(pc + 16)
- ) );
-}
-
-void __glXDisp_Translatef(GLbyte * pc)
-{
- CALL_Translatef( GET_DISPATCH(), (
- *(GLfloat *)(pc + 0),
- *(GLfloat *)(pc + 4),
- *(GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_Viewport(GLbyte * pc)
-{
- CALL_Viewport( GET_DISPATCH(), (
- *(GLint *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLsizei *)(pc + 8),
- *(GLsizei *)(pc + 12)
- ) );
-}
-
-void __glXDisp_BindTexture(GLbyte * pc)
-{
- CALL_BindTexture( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_Indexubv(GLbyte * pc)
-{
- CALL_Indexubv( GET_DISPATCH(), (
- (const GLubyte *)(pc + 0)
- ) );
-}
-
-void __glXDisp_PolygonOffset(GLbyte * pc)
-{
- CALL_PolygonOffset( GET_DISPATCH(), (
- *(GLfloat *)(pc + 0),
- *(GLfloat *)(pc + 4)
- ) );
-}
-
-int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- GLboolean retval;
- GLboolean answerBuffer[200];
- GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
- retval = CALL_AreTexturesResident( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4),
- residences
- ) );
- __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- GLboolean retval;
- GLboolean answerBuffer[200];
- GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
- retval = CALL_AreTexturesResident( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4),
- residences
- ) );
- __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_CopyTexImage1D(GLbyte * pc)
-{
- CALL_CopyTexImage1D( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLint *)(pc + 16),
- *(GLsizei *)(pc + 20),
- *(GLint *)(pc + 24)
- ) );
-}
-
-void __glXDisp_CopyTexImage2D(GLbyte * pc)
-{
- CALL_CopyTexImage2D( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLint *)(pc + 16),
- *(GLsizei *)(pc + 20),
- *(GLsizei *)(pc + 24),
- *(GLint *)(pc + 28)
- ) );
-}
-
-void __glXDisp_CopyTexSubImage1D(GLbyte * pc)
-{
- CALL_CopyTexSubImage1D( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLint *)(pc + 16),
- *(GLsizei *)(pc + 20)
- ) );
-}
-
-void __glXDisp_CopyTexSubImage2D(GLbyte * pc)
-{
- CALL_CopyTexSubImage2D( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLint *)(pc + 16),
- *(GLint *)(pc + 20),
- *(GLsizei *)(pc + 24),
- *(GLsizei *)(pc + 28)
- ) );
-}
-
-int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- CALL_DeleteTextures( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4)
- ) );
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- CALL_DeleteTextures( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4)
- ) );
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- GLuint answerBuffer[200];
- GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenTextures( GET_DISPATCH(), (
- n,
- textures
- ) );
- __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- GLuint answerBuffer[200];
- GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenTextures( GET_DISPATCH(), (
- n,
- textures
- ) );
- __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsTexture( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsTexture( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_PrioritizeTextures(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- CALL_PrioritizeTextures( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4),
- (const GLclampf *)(pc + 4)
- ) );
-}
-
-void __glXDisp_TexSubImage1D(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 56);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_TexSubImage1D( GET_DISPATCH(), (
- *(GLenum *)(pc + 20),
- *(GLint *)(pc + 24),
- *(GLint *)(pc + 28),
- *(GLsizei *)(pc + 36),
- *(GLenum *)(pc + 44),
- *(GLenum *)(pc + 48),
- pixels
- ) );
-}
-
-void __glXDisp_TexSubImage2D(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 56);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_TexSubImage2D( GET_DISPATCH(), (
- *(GLenum *)(pc + 20),
- *(GLint *)(pc + 24),
- *(GLint *)(pc + 28),
- *(GLint *)(pc + 32),
- *(GLsizei *)(pc + 36),
- *(GLsizei *)(pc + 40),
- *(GLenum *)(pc + 44),
- *(GLenum *)(pc + 48),
- pixels
- ) );
-}
-
-void __glXDisp_BlendColor(GLbyte * pc)
-{
- CALL_BlendColor( GET_DISPATCH(), (
- *(GLclampf *)(pc + 0),
- *(GLclampf *)(pc + 4),
- *(GLclampf *)(pc + 8),
- *(GLclampf *)(pc + 12)
- ) );
-}
-
-void __glXDisp_BlendEquation(GLbyte * pc)
-{
- CALL_BlendEquation( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_ColorTable(GLbyte * pc)
-{
- const GLvoid * const table = (const GLvoid *) (pc + 40);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_ColorTable( GET_DISPATCH(), (
- *(GLenum *)(pc + 20),
- *(GLenum *)(pc + 24),
- *(GLsizei *)(pc + 28),
- *(GLenum *)(pc + 32),
- *(GLenum *)(pc + 36),
- table
- ) );
-}
-
-void __glXDisp_ColorTableParameterfv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLfloat * params;
-
- params = (const GLfloat *) (pc + 8);
-
- CALL_ColorTableParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_ColorTableParameteriv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLint * params;
-
- params = (const GLint *) (pc + 8);
-
- CALL_ColorTableParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_CopyColorTable(GLbyte * pc)
-{
- CALL_CopyColorTable( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLsizei *)(pc + 16)
- ) );
-}
-
-int __glXDisp_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetColorTableParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetColorTableParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetColorTableParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetColorTableParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetColorTableParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetColorTableParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetColorTableParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetColorTableParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_ColorSubTable(GLbyte * pc)
-{
- const GLvoid * const data = (const GLvoid *) (pc + 40);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_ColorSubTable( GET_DISPATCH(), (
- *(GLenum *)(pc + 20),
- *(GLsizei *)(pc + 24),
- *(GLsizei *)(pc + 28),
- *(GLenum *)(pc + 32),
- *(GLenum *)(pc + 36),
- data
- ) );
-}
-
-void __glXDisp_CopyColorSubTable(GLbyte * pc)
-{
- CALL_CopyColorSubTable( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLsizei *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLsizei *)(pc + 16)
- ) );
-}
-
-void __glXDisp_ConvolutionFilter1D(GLbyte * pc)
-{
- const GLvoid * const image = (const GLvoid *) (pc + 44);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_ConvolutionFilter1D( GET_DISPATCH(), (
- *(GLenum *)(pc + 20),
- *(GLenum *)(pc + 24),
- *(GLsizei *)(pc + 28),
- *(GLenum *)(pc + 36),
- *(GLenum *)(pc + 40),
- image
- ) );
-}
-
-void __glXDisp_ConvolutionFilter2D(GLbyte * pc)
-{
- const GLvoid * const image = (const GLvoid *) (pc + 44);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_ConvolutionFilter2D( GET_DISPATCH(), (
- *(GLenum *)(pc + 20),
- *(GLenum *)(pc + 24),
- *(GLsizei *)(pc + 28),
- *(GLsizei *)(pc + 32),
- *(GLenum *)(pc + 36),
- *(GLenum *)(pc + 40),
- image
- ) );
-}
-
-void __glXDisp_ConvolutionParameterf(GLbyte * pc)
-{
- CALL_ConvolutionParameterf( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_ConvolutionParameterfv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLfloat * params;
-
- params = (const GLfloat *) (pc + 8);
-
- CALL_ConvolutionParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_ConvolutionParameteri(GLbyte * pc)
-{
- CALL_ConvolutionParameteri( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLint *)(pc + 8)
- ) );
-}
-
-void __glXDisp_ConvolutionParameteriv(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 4);
- const GLint * params;
-
- params = (const GLint *) (pc + 8);
-
- CALL_ConvolutionParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
-}
-
-void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc)
-{
- CALL_CopyConvolutionFilter1D( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLsizei *)(pc + 16)
- ) );
-}
-
-void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc)
-{
- CALL_CopyConvolutionFilter2D( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLsizei *)(pc + 16),
- *(GLsizei *)(pc + 20)
- ) );
-}
-
-int __glXDisp_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetConvolutionParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetConvolutionParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetConvolutionParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetConvolutionParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetConvolutionParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetConvolutionParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetConvolutionParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetConvolutionParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetHistogramParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetHistogramParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetHistogramParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetHistogramParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetHistogramParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetHistogramParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetHistogramParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetHistogramParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetMinmaxParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMinmaxParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetMinmaxParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMinmaxParameterfv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetMinmaxParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMinmaxParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetMinmaxParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMinmaxParameteriv( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_Histogram(GLbyte * pc)
-{
- CALL_Histogram( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLsizei *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLboolean *)(pc + 12)
- ) );
-}
-
-void __glXDisp_Minmax(GLbyte * pc)
-{
- CALL_Minmax( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLboolean *)(pc + 8)
- ) );
-}
-
-void __glXDisp_ResetHistogram(GLbyte * pc)
-{
- CALL_ResetHistogram( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_ResetMinmax(GLbyte * pc)
-{
- CALL_ResetMinmax( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_TexImage3D(GLbyte * pc)
-{
- const CARD32 ptr_is_null = *(CARD32 *)(pc + 76);
- const GLvoid * const pixels = (const GLvoid *) ((ptr_is_null != 0) ? NULL : (pc + 80));
- __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_TexImage3D( GET_DISPATCH(), (
- *(GLenum *)(pc + 36),
- *(GLint *)(pc + 40),
- *(GLint *)(pc + 44),
- *(GLsizei *)(pc + 48),
- *(GLsizei *)(pc + 52),
- *(GLsizei *)(pc + 56),
- *(GLint *)(pc + 64),
- *(GLenum *)(pc + 68),
- *(GLenum *)(pc + 72),
- pixels
- ) );
-}
-
-void __glXDisp_TexSubImage3D(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 88);
- __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
-
- CALL_TexSubImage3D( GET_DISPATCH(), (
- *(GLenum *)(pc + 36),
- *(GLint *)(pc + 40),
- *(GLint *)(pc + 44),
- *(GLint *)(pc + 48),
- *(GLint *)(pc + 52),
- *(GLsizei *)(pc + 60),
- *(GLsizei *)(pc + 64),
- *(GLsizei *)(pc + 68),
- *(GLenum *)(pc + 76),
- *(GLenum *)(pc + 80),
- pixels
- ) );
-}
-
-void __glXDisp_CopyTexSubImage3D(GLbyte * pc)
-{
- CALL_CopyTexSubImage3D( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLint *)(pc + 16),
- *(GLint *)(pc + 20),
- *(GLint *)(pc + 24),
- *(GLsizei *)(pc + 28),
- *(GLsizei *)(pc + 32)
- ) );
-}
-
-void __glXDisp_ActiveTextureARB(GLbyte * pc)
-{
- CALL_ActiveTextureARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 12);
- pc -= 4;
- }
-#endif
-
- CALL_MultiTexCoord1dvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 8),
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc)
-{
- CALL_MultiTexCoord1fvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc)
-{
- CALL_MultiTexCoord1ivARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord1svARB(GLbyte * pc)
-{
- CALL_MultiTexCoord1svARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 20);
- pc -= 4;
- }
-#endif
-
- CALL_MultiTexCoord2dvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 16),
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc)
-{
- CALL_MultiTexCoord2fvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc)
-{
- CALL_MultiTexCoord2ivARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord2svARB(GLbyte * pc)
-{
- CALL_MultiTexCoord2svARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 28);
- pc -= 4;
- }
-#endif
-
- CALL_MultiTexCoord3dvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 24),
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc)
-{
- CALL_MultiTexCoord3fvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc)
-{
- CALL_MultiTexCoord3ivARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord3svARB(GLbyte * pc)
-{
- CALL_MultiTexCoord3svARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 36);
- pc -= 4;
- }
-#endif
-
- CALL_MultiTexCoord4dvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 32),
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc)
-{
- CALL_MultiTexCoord4fvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc)
-{
- CALL_MultiTexCoord4ivARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_MultiTexCoord4svARB(GLbyte * pc)
-{
- CALL_MultiTexCoord4svARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_SampleCoverageARB(GLbyte * pc)
-{
- CALL_SampleCoverageARB( GET_DISPATCH(), (
- *(GLclampf *)(pc + 0),
- *(GLboolean *)(pc + 4)
- ) );
-}
-
-void __glXDisp_CompressedTexImage1DARB(GLbyte * pc)
-{
- const GLsizei imageSize = *(GLsizei *)(pc + 20);
-
- CALL_CompressedTexImage1DARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLsizei *)(pc + 12),
- *(GLint *)(pc + 16),
- imageSize,
- (const GLvoid *)(pc + 24)
- ) );
-}
-
-void __glXDisp_CompressedTexImage2DARB(GLbyte * pc)
-{
- const GLsizei imageSize = *(GLsizei *)(pc + 24);
-
- CALL_CompressedTexImage2DARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLsizei *)(pc + 12),
- *(GLsizei *)(pc + 16),
- *(GLint *)(pc + 20),
- imageSize,
- (const GLvoid *)(pc + 28)
- ) );
-}
-
-void __glXDisp_CompressedTexImage3DARB(GLbyte * pc)
-{
- const GLsizei imageSize = *(GLsizei *)(pc + 28);
-
- CALL_CompressedTexImage3DARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLsizei *)(pc + 12),
- *(GLsizei *)(pc + 16),
- *(GLsizei *)(pc + 20),
- *(GLint *)(pc + 24),
- imageSize,
- (const GLvoid *)(pc + 32)
- ) );
-}
-
-void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc)
-{
- const GLsizei imageSize = *(GLsizei *)(pc + 20);
-
- CALL_CompressedTexSubImage1DARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLsizei *)(pc + 12),
- *(GLenum *)(pc + 16),
- imageSize,
- (const GLvoid *)(pc + 24)
- ) );
-}
-
-void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc)
-{
- const GLsizei imageSize = *(GLsizei *)(pc + 28);
-
- CALL_CompressedTexSubImage2DARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLsizei *)(pc + 16),
- *(GLsizei *)(pc + 20),
- *(GLenum *)(pc + 24),
- imageSize,
- (const GLvoid *)(pc + 32)
- ) );
-}
-
-void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc)
-{
- const GLsizei imageSize = *(GLsizei *)(pc + 36);
-
- CALL_CompressedTexSubImage3DARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLint *)(pc + 16),
- *(GLsizei *)(pc + 20),
- *(GLsizei *)(pc + 24),
- *(GLsizei *)(pc + 28),
- *(GLenum *)(pc + 32),
- imageSize,
- (const GLvoid *)(pc + 40)
- ) );
-}
-
-int __glXDisp_GetProgramEnvParameterdvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLdouble params[4];
- CALL_GetProgramEnvParameterdvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- params
- ) );
- __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetProgramEnvParameterfvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLfloat params[4];
- CALL_GetProgramEnvParameterfvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- params
- ) );
- __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetProgramLocalParameterdvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLdouble params[4];
- CALL_GetProgramLocalParameterdvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- params
- ) );
- __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetProgramLocalParameterfvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLfloat params[4];
- CALL_GetProgramLocalParameterfvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- params
- ) );
- __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetProgramivARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetProgramivARB_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetProgramivARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetVertexAttribdvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetVertexAttribdvARB_size(pname);
- GLdouble answerBuffer[200];
- GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribdvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetVertexAttribfvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetVertexAttribfvARB_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribfvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetVertexAttribivARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetVertexAttribivARB_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribivARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 40);
- pc -= 4;
- }
-#endif
-
- CALL_ProgramEnvParameter4dvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- (const GLdouble *)(pc + 8)
- ) );
-}
-
-void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc)
-{
- CALL_ProgramEnvParameter4fvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- (const GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 40);
- pc -= 4;
- }
-#endif
-
- CALL_ProgramLocalParameter4dvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- (const GLdouble *)(pc + 8)
- ) );
-}
-
-void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc)
-{
- CALL_ProgramLocalParameter4fvARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- (const GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_ProgramStringARB(GLbyte * pc)
-{
- const GLsizei len = *(GLsizei *)(pc + 8);
-
- CALL_ProgramStringARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- len,
- (const GLvoid *)(pc + 12)
- ) );
-}
-
-void __glXDisp_VertexAttrib1dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 12);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib1dvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLdouble *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib1fvARB(GLbyte * pc)
-{
- CALL_VertexAttrib1fvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib1svARB(GLbyte * pc)
-{
- CALL_VertexAttrib1svARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib2dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 20);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib2dvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLdouble *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib2fvARB(GLbyte * pc)
-{
- CALL_VertexAttrib2fvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib2svARB(GLbyte * pc)
-{
- CALL_VertexAttrib2svARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib3dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 28);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib3dvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLdouble *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib3fvARB(GLbyte * pc)
-{
- CALL_VertexAttrib3fvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib3svARB(GLbyte * pc)
-{
- CALL_VertexAttrib3svARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NbvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLbyte *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4NivARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NivARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NsvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NubvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLubyte *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NuivARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLuint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NusvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLushort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4bvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4bvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLbyte *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 36);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib4dvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLdouble *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4fvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4fvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4ivARB(GLbyte * pc)
-{
- CALL_VertexAttrib4ivARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4svARB(GLbyte * pc)
-{
- CALL_VertexAttrib4svARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4ubvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLubyte *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4uivARB(GLbyte * pc)
-{
- CALL_VertexAttrib4uivARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLuint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4usvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4usvARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLushort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_BeginQueryARB(GLbyte * pc)
-{
- CALL_BeginQueryARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4)
- ) );
-}
-
-int __glXDisp_DeleteQueriesARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- CALL_DeleteQueriesARB( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4)
- ) );
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_EndQueryARB(GLbyte * pc)
-{
- CALL_EndQueryARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-int __glXDisp_GenQueriesARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- GLuint answerBuffer[200];
- GLuint * ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenQueriesARB( GET_DISPATCH(), (
- n,
- ids
- ) );
- __glXSendReply(cl->client, ids, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetQueryObjectivARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetQueryObjectivARB_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetQueryObjectivARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetQueryObjectuivARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetQueryObjectuivARB_size(pname);
- GLuint answerBuffer[200];
- GLuint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetQueryObjectuivARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetQueryivARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetQueryivARB_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetQueryivARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_IsQueryARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsQueryARB( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_DrawBuffersARB(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- CALL_DrawBuffersARB( GET_DISPATCH(), (
- n,
- (const GLenum *)(pc + 4)
- ) );
-}
-
-void __glXDisp_ClampColorARB(GLbyte * pc)
-{
- CALL_ClampColorARB( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4)
- ) );
-}
-
-void __glXDisp_RenderbufferStorageMultisample(GLbyte * pc)
-{
- CALL_RenderbufferStorageMultisample( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLsizei *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLsizei *)(pc + 12),
- *(GLsizei *)(pc + 16)
- ) );
-}
-
-void __glXDisp_SampleMaskSGIS(GLbyte * pc)
-{
- CALL_SampleMaskSGIS( GET_DISPATCH(), (
- *(GLclampf *)(pc + 0),
- *(GLboolean *)(pc + 4)
- ) );
-}
-
-void __glXDisp_SamplePatternSGIS(GLbyte * pc)
-{
- CALL_SamplePatternSGIS( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-void __glXDisp_PointParameterfEXT(GLbyte * pc)
-{
- CALL_PointParameterfEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_PointParameterfvEXT(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 0);
- const GLfloat * params;
-
- params = (const GLfloat *) (pc + 4);
-
- CALL_PointParameterfvEXT( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3bvEXT( GET_DISPATCH(), (
- (const GLbyte *)(pc + 0)
- ) );
-}
-
-void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_SecondaryColor3dvEXT( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3fvEXT( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3ivEXT( GET_DISPATCH(), (
- (const GLint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_SecondaryColor3svEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3svEXT( GET_DISPATCH(), (
- (const GLshort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3ubvEXT( GET_DISPATCH(), (
- (const GLubyte *)(pc + 0)
- ) );
-}
-
-void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3uivEXT( GET_DISPATCH(), (
- (const GLuint *)(pc + 0)
- ) );
-}
-
-void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3usvEXT( GET_DISPATCH(), (
- (const GLushort *)(pc + 0)
- ) );
-}
-
-void __glXDisp_FogCoorddvEXT(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 8);
- pc -= 4;
- }
-#endif
-
- CALL_FogCoorddvEXT( GET_DISPATCH(), (
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_FogCoordfvEXT(GLbyte * pc)
-{
- CALL_FogCoordfvEXT( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc)
-{
- CALL_BlendFuncSeparateEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLenum *)(pc + 12)
- ) );
-}
-
-void __glXDisp_WindowPos3fvMESA(GLbyte * pc)
-{
- CALL_WindowPos3fvMESA( GET_DISPATCH(), (
- (const GLfloat *)(pc + 0)
- ) );
-}
-
-int __glXDisp_AreProgramsResidentNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- GLboolean retval;
- GLboolean answerBuffer[200];
- GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
- retval = CALL_AreProgramsResidentNV( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4),
- residences
- ) );
- __glXSendReply(cl->client, residences, n, 1, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_BindProgramNV(GLbyte * pc)
-{
- CALL_BindProgramNV( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4)
- ) );
-}
-
-int __glXDisp_DeleteProgramsNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- CALL_DeleteProgramsNV( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4)
- ) );
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_ExecuteProgramNV(GLbyte * pc)
-{
- CALL_ExecuteProgramNV( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- (const GLfloat *)(pc + 8)
- ) );
-}
-
-int __glXDisp_GenProgramsNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- GLuint answerBuffer[200];
- GLuint * programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenProgramsNV( GET_DISPATCH(), (
- n,
- programs
- ) );
- __glXSendReply(cl->client, programs, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetProgramParameterdvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLdouble params[4];
- CALL_GetProgramParameterdvNV( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- *(GLenum *)(pc + 8),
- params
- ) );
- __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetProgramParameterfvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLfloat params[4];
- CALL_GetProgramParameterfvNV( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- *(GLenum *)(pc + 8),
- params
- ) );
- __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetProgramivNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetProgramivNV_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetProgramivNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetTrackMatrixivNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLint params[1];
- CALL_GetTrackMatrixivNV( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- *(GLenum *)(pc + 8),
- params
- ) );
- __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetVertexAttribdvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetVertexAttribdvNV_size(pname);
- GLdouble answerBuffer[200];
- GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribdvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetVertexAttribfvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetVertexAttribfvNV_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribfvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetVertexAttribivNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = *(GLenum *)(pc + 4);
-
- const GLuint compsize = __glGetVertexAttribivNV_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribivNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- pname,
- params
- ) );
- __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_IsProgramNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsProgramNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_LoadProgramNV(GLbyte * pc)
-{
- const GLsizei len = *(GLsizei *)(pc + 8);
-
- CALL_LoadProgramNV( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- len,
- (const GLubyte *)(pc + 12)
- ) );
-}
-
-void __glXDisp_ProgramParameters4dvNV(GLbyte * pc)
-{
- const GLsizei num = *(GLsizei *)(pc + 8);
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_ProgramParameters4dvNV( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- num,
- (const GLdouble *)(pc + 12)
- ) );
-}
-
-void __glXDisp_ProgramParameters4fvNV(GLbyte * pc)
-{
- const GLsizei num = *(GLsizei *)(pc + 8);
-
- CALL_ProgramParameters4fvNV( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- num,
- (const GLfloat *)(pc + 12)
- ) );
-}
-
-void __glXDisp_RequestResidentProgramsNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- CALL_RequestResidentProgramsNV( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_TrackMatrixNV(GLbyte * pc)
-{
- CALL_TrackMatrixNV( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLenum *)(pc + 12)
- ) );
-}
-
-void __glXDisp_VertexAttrib1dvNV(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 12);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib1dvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLdouble *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib1fvNV(GLbyte * pc)
-{
- CALL_VertexAttrib1fvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib1svNV(GLbyte * pc)
-{
- CALL_VertexAttrib1svNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib2dvNV(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 20);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib2dvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLdouble *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib2fvNV(GLbyte * pc)
-{
- CALL_VertexAttrib2fvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib2svNV(GLbyte * pc)
-{
- CALL_VertexAttrib2svNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib3dvNV(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 28);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib3dvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLdouble *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib3fvNV(GLbyte * pc)
-{
- CALL_VertexAttrib3fvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib3svNV(GLbyte * pc)
-{
- CALL_VertexAttrib3svNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4dvNV(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 36);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib4dvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLdouble *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4fvNV(GLbyte * pc)
-{
- CALL_VertexAttrib4fvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLfloat *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4svNV(GLbyte * pc)
-{
- CALL_VertexAttrib4svNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLshort *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc)
-{
- CALL_VertexAttrib4ubvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- (const GLubyte *)(pc + 4)
- ) );
-}
-
-void __glXDisp_VertexAttribs1dvNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttribs1dvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLdouble *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs1fvNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
- CALL_VertexAttribs1fvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs1svNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
- CALL_VertexAttribs1svNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLshort *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs2dvNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttribs2dvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLdouble *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs2fvNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
- CALL_VertexAttribs2fvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs2svNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
- CALL_VertexAttribs2svNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLshort *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs3dvNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttribs3dvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLdouble *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs3fvNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
- CALL_VertexAttribs3fvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs3svNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
- CALL_VertexAttribs3svNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLshort *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs4dvNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttribs4dvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLdouble *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs4fvNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
- CALL_VertexAttribs4fvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs4svNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
- CALL_VertexAttribs4svNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLshort *)(pc + 8)
- ) );
-}
-
-void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 4);
-
- CALL_VertexAttribs4ubvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- n,
- (const GLubyte *)(pc + 8)
- ) );
-}
-
-void __glXDisp_PointParameteriNV(GLbyte * pc)
-{
- CALL_PointParameteriNV( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_PointParameterivNV(GLbyte * pc)
-{
- const GLenum pname = *(GLenum *)(pc + 0);
- const GLint * params;
-
- params = (const GLint *) (pc + 4);
-
- CALL_PointParameterivNV( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc)
-{
- CALL_ActiveStencilFaceEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-int __glXDisp_GetProgramNamedParameterdvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei len = *(GLsizei *)(pc + 4);
-
- GLdouble params[4];
- CALL_GetProgramNamedParameterdvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- len,
- (const GLubyte *)(pc + 8),
- params
- ) );
- __glXSendReply(cl->client, params, 4, 8, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetProgramNamedParameterfvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei len = *(GLsizei *)(pc + 4);
-
- GLfloat params[4];
- CALL_GetProgramNamedParameterfvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- len,
- (const GLubyte *)(pc + 8),
- params
- ) );
- __glXSendReply(cl->client, params, 4, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc)
-{
- const GLsizei len = *(GLsizei *)(pc + 36);
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 44 + __GLX_PAD(len) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_ProgramNamedParameter4dvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 32),
- len,
- (const GLubyte *)(pc + 40),
- (const GLdouble *)(pc + 0)
- ) );
-}
-
-void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc)
-{
- const GLsizei len = *(GLsizei *)(pc + 4);
-
- CALL_ProgramNamedParameter4fvNV( GET_DISPATCH(), (
- *(GLuint *)(pc + 0),
- len,
- (const GLubyte *)(pc + 24),
- (const GLfloat *)(pc + 8)
- ) );
-}
-
-void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc)
-{
- CALL_BlendEquationSeparateEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4)
- ) );
-}
-
-void __glXDisp_BindFramebufferEXT(GLbyte * pc)
-{
- CALL_BindFramebufferEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_BindRenderbufferEXT(GLbyte * pc)
-{
- CALL_BindRenderbufferEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLuint *)(pc + 4)
- ) );
-}
-
-int __glXDisp_CheckFramebufferStatusEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLenum retval;
- retval = CALL_CheckFramebufferStatusEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- CALL_DeleteFramebuffersEXT( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc)
-{
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- CALL_DeleteRenderbuffersEXT( GET_DISPATCH(), (
- n,
- (const GLuint *)(pc + 4)
- ) );
-}
-
-void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc)
-{
- CALL_FramebufferRenderbufferEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLuint *)(pc + 12)
- ) );
-}
-
-void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc)
-{
- CALL_FramebufferTexture1DEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLuint *)(pc + 12),
- *(GLint *)(pc + 16)
- ) );
-}
-
-void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc)
-{
- CALL_FramebufferTexture2DEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLuint *)(pc + 12),
- *(GLint *)(pc + 16)
- ) );
-}
-
-void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc)
-{
- CALL_FramebufferTexture3DEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLuint *)(pc + 12),
- *(GLint *)(pc + 16),
- *(GLint *)(pc + 20)
- ) );
-}
-
-int __glXDisp_GenFramebuffersEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- GLuint answerBuffer[200];
- GLuint * framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenFramebuffersEXT( GET_DISPATCH(), (
- n,
- framebuffers
- ) );
- __glXSendReply(cl->client, framebuffers, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GenRenderbuffersEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = *(GLsizei *)(pc + 0);
-
- GLuint answerBuffer[200];
- GLuint * renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenRenderbuffersEXT( GET_DISPATCH(), (
- n,
- renderbuffers
- ) );
- __glXSendReply(cl->client, renderbuffers, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_GenerateMipmapEXT(GLbyte * pc)
-{
- CALL_GenerateMipmapEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0)
- ) );
-}
-
-int __glXDisp_GetFramebufferAttachmentParameterivEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLint params[1];
- CALL_GetFramebufferAttachmentParameterivEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- params
- ) );
- __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_GetRenderbufferParameterivEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLint params[1];
- CALL_GetRenderbufferParameterivEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- params
- ) );
- __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_IsFramebufferEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsFramebufferEXT( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDisp_IsRenderbufferEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsRenderbufferEXT( GET_DISPATCH(), (
- *(GLuint *)(pc + 0)
- ) );
- __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDisp_RenderbufferStorageEXT(GLbyte * pc)
-{
- CALL_RenderbufferStorageEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLsizei *)(pc + 8),
- *(GLsizei *)(pc + 12)
- ) );
-}
-
-void __glXDisp_BlitFramebufferEXT(GLbyte * pc)
-{
- CALL_BlitFramebufferEXT( GET_DISPATCH(), (
- *(GLint *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLint *)(pc + 16),
- *(GLint *)(pc + 20),
- *(GLint *)(pc + 24),
- *(GLint *)(pc + 28),
- *(GLbitfield *)(pc + 32),
- *(GLenum *)(pc + 36)
- ) );
-}
-
-void __glXDisp_FramebufferTextureLayerEXT(GLbyte * pc)
-{
- CALL_FramebufferTextureLayerEXT( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLuint *)(pc + 8),
- *(GLint *)(pc + 12),
- *(GLint *)(pc + 16)
- ) );
-}
-
+/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */
+
+/*
+ * (C) Copyright IBM Corporation 2005
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
+#endif
+
+#include <X11/Xmd.h>
+#include <GL/gl.h>
+#include <GL/glxproto.h>
+#include <inttypes.h>
+#include "indirect_size.h"
+#include "indirect_size_get.h"
+#include "indirect_dispatch.h"
+#include "glxserver.h"
+#include "glxbyteorder.h"
+#include "indirect_util.h"
+#include "singlesize.h"
+#include "glapi.h"
+#include "glapitable.h"
+#include "glthread.h"
+#include "dispatch.h"
+
+#define __GLX_PAD(x) (((x) + 3) & ~3)
+
+typedef struct {
+ __GLX_PIXEL_3D_HDR;
+} __GLXpixel3DHeader;
+
+extern GLboolean __glXErrorOccured( void );
+extern void __glXClearErrorOccured( void );
+
+static const unsigned dummy_answer[2] = {0, 0};
+
+int __glXDisp_NewList(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ CALL_NewList( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_EndList(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ CALL_EndList( GET_DISPATCH(), () );
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_CallList(GLbyte * pc)
+{
+ CALL_CallList( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_CallLists(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 0);
+ const GLenum type = *(GLenum *)(pc + 4);
+ const GLvoid * lists = (const GLvoid *)(pc + 8);
+
+ CALL_CallLists( GET_DISPATCH(), (
+ n,
+ type,
+ lists
+ ) );
+}
+
+int __glXDisp_DeleteLists(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ CALL_DeleteLists( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ *(GLsizei *)(pc + 4)
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GenLists(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLuint retval;
+ retval = CALL_GenLists( GET_DISPATCH(), (
+ *(GLsizei *)(pc + 0)
+ ) );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_ListBase(GLbyte * pc)
+{
+ CALL_ListBase( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Begin(GLbyte * pc)
+{
+ CALL_Begin( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Bitmap(GLbyte * pc)
+{
+ const GLubyte * const bitmap = (const GLubyte *) (pc + 44);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_Bitmap( GET_DISPATCH(), (
+ *(GLsizei *)(pc + 20),
+ *(GLsizei *)(pc + 24),
+ *(GLfloat *)(pc + 28),
+ *(GLfloat *)(pc + 32),
+ *(GLfloat *)(pc + 36),
+ *(GLfloat *)(pc + 40),
+ bitmap
+ ) );
+}
+
+void __glXDisp_Color3bv(GLbyte * pc)
+{
+ CALL_Color3bv( GET_DISPATCH(), (
+ (const GLbyte *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color3dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Color3dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color3fv(GLbyte * pc)
+{
+ CALL_Color3fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color3iv(GLbyte * pc)
+{
+ CALL_Color3iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color3sv(GLbyte * pc)
+{
+ CALL_Color3sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color3ubv(GLbyte * pc)
+{
+ CALL_Color3ubv( GET_DISPATCH(), (
+ (const GLubyte *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color3uiv(GLbyte * pc)
+{
+ CALL_Color3uiv( GET_DISPATCH(), (
+ (const GLuint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color3usv(GLbyte * pc)
+{
+ CALL_Color3usv( GET_DISPATCH(), (
+ (const GLushort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color4bv(GLbyte * pc)
+{
+ CALL_Color4bv( GET_DISPATCH(), (
+ (const GLbyte *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color4dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Color4dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color4fv(GLbyte * pc)
+{
+ CALL_Color4fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color4iv(GLbyte * pc)
+{
+ CALL_Color4iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color4sv(GLbyte * pc)
+{
+ CALL_Color4sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color4ubv(GLbyte * pc)
+{
+ CALL_Color4ubv( GET_DISPATCH(), (
+ (const GLubyte *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color4uiv(GLbyte * pc)
+{
+ CALL_Color4uiv( GET_DISPATCH(), (
+ (const GLuint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Color4usv(GLbyte * pc)
+{
+ CALL_Color4usv( GET_DISPATCH(), (
+ (const GLushort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_EdgeFlagv(GLbyte * pc)
+{
+ CALL_EdgeFlagv( GET_DISPATCH(), (
+ (const GLboolean *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_End(GLbyte * pc)
+{
+ CALL_End( GET_DISPATCH(), () );
+}
+
+void __glXDisp_Indexdv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Indexdv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Indexfv(GLbyte * pc)
+{
+ CALL_Indexfv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Indexiv(GLbyte * pc)
+{
+ CALL_Indexiv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Indexsv(GLbyte * pc)
+{
+ CALL_Indexsv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Normal3bv(GLbyte * pc)
+{
+ CALL_Normal3bv( GET_DISPATCH(), (
+ (const GLbyte *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Normal3dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Normal3dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Normal3fv(GLbyte * pc)
+{
+ CALL_Normal3fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Normal3iv(GLbyte * pc)
+{
+ CALL_Normal3iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Normal3sv(GLbyte * pc)
+{
+ CALL_Normal3sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos2dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_RasterPos2dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos2fv(GLbyte * pc)
+{
+ CALL_RasterPos2fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos2iv(GLbyte * pc)
+{
+ CALL_RasterPos2iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos2sv(GLbyte * pc)
+{
+ CALL_RasterPos2sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos3dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_RasterPos3dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos3fv(GLbyte * pc)
+{
+ CALL_RasterPos3fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos3iv(GLbyte * pc)
+{
+ CALL_RasterPos3iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos3sv(GLbyte * pc)
+{
+ CALL_RasterPos3sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos4dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_RasterPos4dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos4fv(GLbyte * pc)
+{
+ CALL_RasterPos4fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos4iv(GLbyte * pc)
+{
+ CALL_RasterPos4iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_RasterPos4sv(GLbyte * pc)
+{
+ CALL_RasterPos4sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Rectdv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Rectdv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0),
+ (const GLdouble *)(pc + 16)
+ ) );
+}
+
+void __glXDisp_Rectfv(GLbyte * pc)
+{
+ CALL_Rectfv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0),
+ (const GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_Rectiv(GLbyte * pc)
+{
+ CALL_Rectiv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0),
+ (const GLint *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_Rectsv(GLbyte * pc)
+{
+ CALL_Rectsv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_TexCoord1dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+
+ CALL_TexCoord1dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord1fv(GLbyte * pc)
+{
+ CALL_TexCoord1fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord1iv(GLbyte * pc)
+{
+ CALL_TexCoord1iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord1sv(GLbyte * pc)
+{
+ CALL_TexCoord1sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord2dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_TexCoord2dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord2fv(GLbyte * pc)
+{
+ CALL_TexCoord2fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord2iv(GLbyte * pc)
+{
+ CALL_TexCoord2iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord2sv(GLbyte * pc)
+{
+ CALL_TexCoord2sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord3dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_TexCoord3dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord3fv(GLbyte * pc)
+{
+ CALL_TexCoord3fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord3iv(GLbyte * pc)
+{
+ CALL_TexCoord3iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord3sv(GLbyte * pc)
+{
+ CALL_TexCoord3sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord4dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_TexCoord4dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord4fv(GLbyte * pc)
+{
+ CALL_TexCoord4fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord4iv(GLbyte * pc)
+{
+ CALL_TexCoord4iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexCoord4sv(GLbyte * pc)
+{
+ CALL_TexCoord4sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex2dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Vertex2dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex2fv(GLbyte * pc)
+{
+ CALL_Vertex2fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex2iv(GLbyte * pc)
+{
+ CALL_Vertex2iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex2sv(GLbyte * pc)
+{
+ CALL_Vertex2sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex3dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Vertex3dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex3fv(GLbyte * pc)
+{
+ CALL_Vertex3fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex3iv(GLbyte * pc)
+{
+ CALL_Vertex3iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex3sv(GLbyte * pc)
+{
+ CALL_Vertex3sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex4dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Vertex4dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex4fv(GLbyte * pc)
+{
+ CALL_Vertex4fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex4iv(GLbyte * pc)
+{
+ CALL_Vertex4iv( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Vertex4sv(GLbyte * pc)
+{
+ CALL_Vertex4sv( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_ClipPlane(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ClipPlane( GET_DISPATCH(), (
+ *(GLenum *)(pc + 32),
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_ColorMaterial(GLbyte * pc)
+{
+ CALL_ColorMaterial( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_CullFace(GLbyte * pc)
+{
+ CALL_CullFace( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Fogf(GLbyte * pc)
+{
+ CALL_Fogf( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_Fogfv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 0);
+ const GLfloat * params;
+
+ params = (const GLfloat *) (pc + 4);
+
+ CALL_Fogfv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_Fogi(GLbyte * pc)
+{
+ CALL_Fogi( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_Fogiv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 0);
+ const GLint * params;
+
+ params = (const GLint *) (pc + 4);
+
+ CALL_Fogiv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_FrontFace(GLbyte * pc)
+{
+ CALL_FrontFace( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Hint(GLbyte * pc)
+{
+ CALL_Hint( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_Lightf(GLbyte * pc)
+{
+ CALL_Lightf( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_Lightfv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLfloat * params;
+
+ params = (const GLfloat *) (pc + 8);
+
+ CALL_Lightfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_Lighti(GLbyte * pc)
+{
+ CALL_Lighti( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_Lightiv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLint * params;
+
+ params = (const GLint *) (pc + 8);
+
+ CALL_Lightiv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_LightModelf(GLbyte * pc)
+{
+ CALL_LightModelf( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_LightModelfv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 0);
+ const GLfloat * params;
+
+ params = (const GLfloat *) (pc + 4);
+
+ CALL_LightModelfv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_LightModeli(GLbyte * pc)
+{
+ CALL_LightModeli( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_LightModeliv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 0);
+ const GLint * params;
+
+ params = (const GLint *) (pc + 4);
+
+ CALL_LightModeliv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_LineStipple(GLbyte * pc)
+{
+ CALL_LineStipple( GET_DISPATCH(), (
+ *(GLint *)(pc + 0),
+ *(GLushort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_LineWidth(GLbyte * pc)
+{
+ CALL_LineWidth( GET_DISPATCH(), (
+ *(GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Materialf(GLbyte * pc)
+{
+ CALL_Materialf( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_Materialfv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLfloat * params;
+
+ params = (const GLfloat *) (pc + 8);
+
+ CALL_Materialfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_Materiali(GLbyte * pc)
+{
+ CALL_Materiali( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_Materialiv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLint * params;
+
+ params = (const GLint *) (pc + 8);
+
+ CALL_Materialiv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_PointSize(GLbyte * pc)
+{
+ CALL_PointSize( GET_DISPATCH(), (
+ *(GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_PolygonMode(GLbyte * pc)
+{
+ CALL_PolygonMode( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_PolygonStipple(GLbyte * pc)
+{
+ const GLubyte * const mask = (const GLubyte *) (pc + 20);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_PolygonStipple( GET_DISPATCH(), (
+ mask
+ ) );
+}
+
+void __glXDisp_Scissor(GLbyte * pc)
+{
+ CALL_Scissor( GET_DISPATCH(), (
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_ShadeModel(GLbyte * pc)
+{
+ CALL_ShadeModel( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexParameterf(GLbyte * pc)
+{
+ CALL_TexParameterf( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_TexParameterfv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLfloat * params;
+
+ params = (const GLfloat *) (pc + 8);
+
+ CALL_TexParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_TexParameteri(GLbyte * pc)
+{
+ CALL_TexParameteri( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_TexParameteriv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLint * params;
+
+ params = (const GLint *) (pc + 8);
+
+ CALL_TexParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_TexImage1D(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 52);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_TexImage1D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 20),
+ *(GLint *)(pc + 24),
+ *(GLint *)(pc + 28),
+ *(GLsizei *)(pc + 32),
+ *(GLint *)(pc + 40),
+ *(GLenum *)(pc + 44),
+ *(GLenum *)(pc + 48),
+ pixels
+ ) );
+}
+
+void __glXDisp_TexImage2D(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 52);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_TexImage2D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 20),
+ *(GLint *)(pc + 24),
+ *(GLint *)(pc + 28),
+ *(GLsizei *)(pc + 32),
+ *(GLsizei *)(pc + 36),
+ *(GLint *)(pc + 40),
+ *(GLenum *)(pc + 44),
+ *(GLenum *)(pc + 48),
+ pixels
+ ) );
+}
+
+void __glXDisp_TexEnvf(GLbyte * pc)
+{
+ CALL_TexEnvf( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_TexEnvfv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLfloat * params;
+
+ params = (const GLfloat *) (pc + 8);
+
+ CALL_TexEnvfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_TexEnvi(GLbyte * pc)
+{
+ CALL_TexEnvi( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_TexEnviv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLint * params;
+
+ params = (const GLint *) (pc + 8);
+
+ CALL_TexEnviv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_TexGend(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_TexGend( GET_DISPATCH(), (
+ *(GLenum *)(pc + 8),
+ *(GLenum *)(pc + 12),
+ *(GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexGendv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLdouble * params;
+
+#ifdef __GLX_ALIGN64
+ const GLuint compsize = __glTexGendv_size(pname);
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ params = (const GLdouble *) (pc + 8);
+
+ CALL_TexGendv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_TexGenf(GLbyte * pc)
+{
+ CALL_TexGenf( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_TexGenfv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLfloat * params;
+
+ params = (const GLfloat *) (pc + 8);
+
+ CALL_TexGenfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_TexGeni(GLbyte * pc)
+{
+ CALL_TexGeni( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_TexGeniv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLint * params;
+
+ params = (const GLint *) (pc + 8);
+
+ CALL_TexGeniv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_InitNames(GLbyte * pc)
+{
+ CALL_InitNames( GET_DISPATCH(), () );
+}
+
+void __glXDisp_LoadName(GLbyte * pc)
+{
+ CALL_LoadName( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_PassThrough(GLbyte * pc)
+{
+ CALL_PassThrough( GET_DISPATCH(), (
+ *(GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_PopName(GLbyte * pc)
+{
+ CALL_PopName( GET_DISPATCH(), () );
+}
+
+void __glXDisp_PushName(GLbyte * pc)
+{
+ CALL_PushName( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_DrawBuffer(GLbyte * pc)
+{
+ CALL_DrawBuffer( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Clear(GLbyte * pc)
+{
+ CALL_Clear( GET_DISPATCH(), (
+ *(GLbitfield *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_ClearAccum(GLbyte * pc)
+{
+ CALL_ClearAccum( GET_DISPATCH(), (
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8),
+ *(GLfloat *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_ClearIndex(GLbyte * pc)
+{
+ CALL_ClearIndex( GET_DISPATCH(), (
+ *(GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_ClearColor(GLbyte * pc)
+{
+ CALL_ClearColor( GET_DISPATCH(), (
+ *(GLclampf *)(pc + 0),
+ *(GLclampf *)(pc + 4),
+ *(GLclampf *)(pc + 8),
+ *(GLclampf *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_ClearStencil(GLbyte * pc)
+{
+ CALL_ClearStencil( GET_DISPATCH(), (
+ *(GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_ClearDepth(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ClearDepth( GET_DISPATCH(), (
+ *(GLclampd *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_StencilMask(GLbyte * pc)
+{
+ CALL_StencilMask( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_ColorMask(GLbyte * pc)
+{
+ CALL_ColorMask( GET_DISPATCH(), (
+ *(GLboolean *)(pc + 0),
+ *(GLboolean *)(pc + 1),
+ *(GLboolean *)(pc + 2),
+ *(GLboolean *)(pc + 3)
+ ) );
+}
+
+void __glXDisp_DepthMask(GLbyte * pc)
+{
+ CALL_DepthMask( GET_DISPATCH(), (
+ *(GLboolean *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_IndexMask(GLbyte * pc)
+{
+ CALL_IndexMask( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Accum(GLbyte * pc)
+{
+ CALL_Accum( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_Disable(GLbyte * pc)
+{
+ CALL_Disable( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Enable(GLbyte * pc)
+{
+ CALL_Enable( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_PopAttrib(GLbyte * pc)
+{
+ CALL_PopAttrib( GET_DISPATCH(), () );
+}
+
+void __glXDisp_PushAttrib(GLbyte * pc)
+{
+ CALL_PushAttrib( GET_DISPATCH(), (
+ *(GLbitfield *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_MapGrid1d(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MapGrid1d( GET_DISPATCH(), (
+ *(GLint *)(pc + 16),
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_MapGrid1f(GLbyte * pc)
+{
+ CALL_MapGrid1f( GET_DISPATCH(), (
+ *(GLint *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_MapGrid2d(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 40);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MapGrid2d( GET_DISPATCH(), (
+ *(GLint *)(pc + 32),
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLint *)(pc + 36),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24)
+ ) );
+}
+
+void __glXDisp_MapGrid2f(GLbyte * pc)
+{
+ CALL_MapGrid2f( GET_DISPATCH(), (
+ *(GLint *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLfloat *)(pc + 16),
+ *(GLfloat *)(pc + 20)
+ ) );
+}
+
+void __glXDisp_EvalCoord1dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+
+ CALL_EvalCoord1dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_EvalCoord1fv(GLbyte * pc)
+{
+ CALL_EvalCoord1fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_EvalCoord2dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_EvalCoord2dv( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_EvalCoord2fv(GLbyte * pc)
+{
+ CALL_EvalCoord2fv( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_EvalMesh1(GLbyte * pc)
+{
+ CALL_EvalMesh1( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_EvalPoint1(GLbyte * pc)
+{
+ CALL_EvalPoint1( GET_DISPATCH(), (
+ *(GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_EvalMesh2(GLbyte * pc)
+{
+ CALL_EvalMesh2( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16)
+ ) );
+}
+
+void __glXDisp_EvalPoint2(GLbyte * pc)
+{
+ CALL_EvalPoint2( GET_DISPATCH(), (
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_AlphaFunc(GLbyte * pc)
+{
+ CALL_AlphaFunc( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLclampf *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_BlendFunc(GLbyte * pc)
+{
+ CALL_BlendFunc( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_LogicOp(GLbyte * pc)
+{
+ CALL_LogicOp( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_StencilFunc(GLbyte * pc)
+{
+ CALL_StencilFunc( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLuint *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_StencilOp(GLbyte * pc)
+{
+ CALL_StencilOp( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLenum *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_DepthFunc(GLbyte * pc)
+{
+ CALL_DepthFunc( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_PixelZoom(GLbyte * pc)
+{
+ CALL_PixelZoom( GET_DISPATCH(), (
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_PixelTransferf(GLbyte * pc)
+{
+ CALL_PixelTransferf( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_PixelTransferi(GLbyte * pc)
+{
+ CALL_PixelTransferi( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ ) );
+}
+
+int __glXDisp_PixelStoref(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ CALL_PixelStoref( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_PixelStorei(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ CALL_PixelStorei( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_PixelMapfv(GLbyte * pc)
+{
+ const GLsizei mapsize = *(GLsizei *)(pc + 4);
+
+ CALL_PixelMapfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ mapsize,
+ (const GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_PixelMapuiv(GLbyte * pc)
+{
+ const GLsizei mapsize = *(GLsizei *)(pc + 4);
+
+ CALL_PixelMapuiv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ mapsize,
+ (const GLuint *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_PixelMapusv(GLbyte * pc)
+{
+ const GLsizei mapsize = *(GLsizei *)(pc + 4);
+
+ CALL_PixelMapusv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ mapsize,
+ (const GLushort *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_ReadBuffer(GLbyte * pc)
+{
+ CALL_ReadBuffer( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_CopyPixels(GLbyte * pc)
+{
+ CALL_CopyPixels( GET_DISPATCH(), (
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12),
+ *(GLenum *)(pc + 16)
+ ) );
+}
+
+void __glXDisp_DrawPixels(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 36);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_DrawPixels( GET_DISPATCH(), (
+ *(GLsizei *)(pc + 20),
+ *(GLsizei *)(pc + 24),
+ *(GLenum *)(pc + 28),
+ *(GLenum *)(pc + 32),
+ pixels
+ ) );
+}
+
+int __glXDisp_GetBooleanv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 0);
+
+ const GLuint compsize = __glGetBooleanv_size(pname);
+ GLboolean answerBuffer[200];
+ GLboolean * params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetBooleanv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 1, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLdouble equation[4];
+ CALL_GetClipPlane( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ equation
+ ) );
+ __glXSendReply(cl->client, equation, 4, 8, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetDoublev(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 0);
+
+ const GLuint compsize = __glGetDoublev_size(pname);
+ GLdouble answerBuffer[200];
+ GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetDoublev( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetError(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLenum retval;
+ retval = CALL_GetError( GET_DISPATCH(), () );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetFloatv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 0);
+
+ const GLuint compsize = __glGetFloatv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetFloatv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetIntegerv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 0);
+
+ const GLuint compsize = __glGetIntegerv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetIntegerv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetLightfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetLightfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetLightfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetLightiv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetLightiv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetLightiv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum target = *(GLenum *)(pc + 0);
+ const GLenum query = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetMapdv_size(target,query);
+ GLdouble answerBuffer[200];
+ GLdouble * v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
+
+ if (v == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMapdv( GET_DISPATCH(), (
+ target,
+ query,
+ v
+ ) );
+ __glXSendReply(cl->client, v, compsize, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum target = *(GLenum *)(pc + 0);
+ const GLenum query = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetMapfv_size(target,query);
+ GLfloat answerBuffer[200];
+ GLfloat * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (v == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMapfv( GET_DISPATCH(), (
+ target,
+ query,
+ v
+ ) );
+ __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum target = *(GLenum *)(pc + 0);
+ const GLenum query = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetMapiv_size(target,query);
+ GLint answerBuffer[200];
+ GLint * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (v == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMapiv( GET_DISPATCH(), (
+ target,
+ query,
+ v
+ ) );
+ __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetMaterialfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetMaterialfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMaterialfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetMaterialiv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetMaterialiv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMaterialiv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum map = *(GLenum *)(pc + 0);
+
+ const GLuint compsize = __glGetPixelMapfv_size(map);
+ GLfloat answerBuffer[200];
+ GLfloat * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (values == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetPixelMapfv( GET_DISPATCH(), (
+ map,
+ values
+ ) );
+ __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum map = *(GLenum *)(pc + 0);
+
+ const GLuint compsize = __glGetPixelMapuiv_size(map);
+ GLuint answerBuffer[200];
+ GLuint * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (values == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetPixelMapuiv( GET_DISPATCH(), (
+ map,
+ values
+ ) );
+ __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum map = *(GLenum *)(pc + 0);
+
+ const GLuint compsize = __glGetPixelMapusv_size(map);
+ GLushort answerBuffer[200];
+ GLushort * values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2);
+
+ if (values == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetPixelMapusv( GET_DISPATCH(), (
+ map,
+ values
+ ) );
+ __glXSendReply(cl->client, values, compsize, 2, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetTexEnvfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexEnvfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetTexEnviv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetTexEnviv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexEnviv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetTexGendv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetTexGendv_size(pname);
+ GLdouble answerBuffer[200];
+ GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexGendv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetTexGenfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetTexGenfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexGenfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetTexGeniv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetTexGeniv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexGeniv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetTexParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetTexParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 8);
+
+ const GLuint compsize = __glGetTexLevelParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexLevelParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 8);
+
+ const GLuint compsize = __glGetTexLevelParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexLevelParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_IsEnabled(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsEnabled( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_IsList(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsList( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_DepthRange(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_DepthRange( GET_DISPATCH(), (
+ *(GLclampd *)(pc + 0),
+ *(GLclampd *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_Frustum(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 48);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Frustum( GET_DISPATCH(), (
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24),
+ *(GLdouble *)(pc + 32),
+ *(GLdouble *)(pc + 40)
+ ) );
+}
+
+void __glXDisp_LoadIdentity(GLbyte * pc)
+{
+ CALL_LoadIdentity( GET_DISPATCH(), () );
+}
+
+void __glXDisp_LoadMatrixf(GLbyte * pc)
+{
+ CALL_LoadMatrixf( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_LoadMatrixd(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 128);
+ pc -= 4;
+ }
+#endif
+
+ CALL_LoadMatrixd( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_MatrixMode(GLbyte * pc)
+{
+ CALL_MatrixMode( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_MultMatrixf(GLbyte * pc)
+{
+ CALL_MultMatrixf( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_MultMatrixd(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 128);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MultMatrixd( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_Ortho(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 48);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Ortho( GET_DISPATCH(), (
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24),
+ *(GLdouble *)(pc + 32),
+ *(GLdouble *)(pc + 40)
+ ) );
+}
+
+void __glXDisp_PopMatrix(GLbyte * pc)
+{
+ CALL_PopMatrix( GET_DISPATCH(), () );
+}
+
+void __glXDisp_PushMatrix(GLbyte * pc)
+{
+ CALL_PushMatrix( GET_DISPATCH(), () );
+}
+
+void __glXDisp_Rotated(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Rotated( GET_DISPATCH(), (
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24)
+ ) );
+}
+
+void __glXDisp_Rotatef(GLbyte * pc)
+{
+ CALL_Rotatef( GET_DISPATCH(), (
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8),
+ *(GLfloat *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_Scaled(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Scaled( GET_DISPATCH(), (
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16)
+ ) );
+}
+
+void __glXDisp_Scalef(GLbyte * pc)
+{
+ CALL_Scalef( GET_DISPATCH(), (
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_Translated(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Translated( GET_DISPATCH(), (
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16)
+ ) );
+}
+
+void __glXDisp_Translatef(GLbyte * pc)
+{
+ CALL_Translatef( GET_DISPATCH(), (
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_Viewport(GLbyte * pc)
+{
+ CALL_Viewport( GET_DISPATCH(), (
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_BindTexture(GLbyte * pc)
+{
+ CALL_BindTexture( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_Indexubv(GLbyte * pc)
+{
+ CALL_Indexubv( GET_DISPATCH(), (
+ (const GLubyte *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_PolygonOffset(GLbyte * pc)
+{
+ CALL_PolygonOffset( GET_DISPATCH(), (
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ ) );
+}
+
+int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ GLboolean retval;
+ GLboolean answerBuffer[200];
+ GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
+ retval = CALL_AreTexturesResident( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4),
+ residences
+ ) );
+ __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ GLboolean retval;
+ GLboolean answerBuffer[200];
+ GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
+ retval = CALL_AreTexturesResident( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4),
+ residences
+ ) );
+ __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_CopyTexImage1D(GLbyte * pc)
+{
+ CALL_CopyTexImage1D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLsizei *)(pc + 20),
+ *(GLint *)(pc + 24)
+ ) );
+}
+
+void __glXDisp_CopyTexImage2D(GLbyte * pc)
+{
+ CALL_CopyTexImage2D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLsizei *)(pc + 20),
+ *(GLsizei *)(pc + 24),
+ *(GLint *)(pc + 28)
+ ) );
+}
+
+void __glXDisp_CopyTexSubImage1D(GLbyte * pc)
+{
+ CALL_CopyTexSubImage1D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLsizei *)(pc + 20)
+ ) );
+}
+
+void __glXDisp_CopyTexSubImage2D(GLbyte * pc)
+{
+ CALL_CopyTexSubImage2D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLint *)(pc + 20),
+ *(GLsizei *)(pc + 24),
+ *(GLsizei *)(pc + 28)
+ ) );
+}
+
+int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ CALL_DeleteTextures( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4)
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ CALL_DeleteTextures( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4)
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ GLuint answerBuffer[200];
+ GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenTextures( GET_DISPATCH(), (
+ n,
+ textures
+ ) );
+ __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ GLuint answerBuffer[200];
+ GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenTextures( GET_DISPATCH(), (
+ n,
+ textures
+ ) );
+ __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsTexture( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsTexture( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_PrioritizeTextures(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ CALL_PrioritizeTextures( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4),
+ (const GLclampf *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_TexSubImage1D(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 56);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_TexSubImage1D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 20),
+ *(GLint *)(pc + 24),
+ *(GLint *)(pc + 28),
+ *(GLsizei *)(pc + 36),
+ *(GLenum *)(pc + 44),
+ *(GLenum *)(pc + 48),
+ pixels
+ ) );
+}
+
+void __glXDisp_TexSubImage2D(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 56);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_TexSubImage2D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 20),
+ *(GLint *)(pc + 24),
+ *(GLint *)(pc + 28),
+ *(GLint *)(pc + 32),
+ *(GLsizei *)(pc + 36),
+ *(GLsizei *)(pc + 40),
+ *(GLenum *)(pc + 44),
+ *(GLenum *)(pc + 48),
+ pixels
+ ) );
+}
+
+void __glXDisp_BlendColor(GLbyte * pc)
+{
+ CALL_BlendColor( GET_DISPATCH(), (
+ *(GLclampf *)(pc + 0),
+ *(GLclampf *)(pc + 4),
+ *(GLclampf *)(pc + 8),
+ *(GLclampf *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_BlendEquation(GLbyte * pc)
+{
+ CALL_BlendEquation( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_ColorTable(GLbyte * pc)
+{
+ const GLvoid * const table = (const GLvoid *) (pc + 40);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_ColorTable( GET_DISPATCH(), (
+ *(GLenum *)(pc + 20),
+ *(GLenum *)(pc + 24),
+ *(GLsizei *)(pc + 28),
+ *(GLenum *)(pc + 32),
+ *(GLenum *)(pc + 36),
+ table
+ ) );
+}
+
+void __glXDisp_ColorTableParameterfv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLfloat * params;
+
+ params = (const GLfloat *) (pc + 8);
+
+ CALL_ColorTableParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_ColorTableParameteriv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLint * params;
+
+ params = (const GLint *) (pc + 8);
+
+ CALL_ColorTableParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_CopyColorTable(GLbyte * pc)
+{
+ CALL_CopyColorTable( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLsizei *)(pc + 16)
+ ) );
+}
+
+int __glXDisp_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetColorTableParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetColorTableParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetColorTableParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetColorTableParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetColorTableParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetColorTableParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetColorTableParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetColorTableParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_ColorSubTable(GLbyte * pc)
+{
+ const GLvoid * const data = (const GLvoid *) (pc + 40);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_ColorSubTable( GET_DISPATCH(), (
+ *(GLenum *)(pc + 20),
+ *(GLsizei *)(pc + 24),
+ *(GLsizei *)(pc + 28),
+ *(GLenum *)(pc + 32),
+ *(GLenum *)(pc + 36),
+ data
+ ) );
+}
+
+void __glXDisp_CopyColorSubTable(GLbyte * pc)
+{
+ CALL_CopyColorSubTable( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLsizei *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLsizei *)(pc + 16)
+ ) );
+}
+
+void __glXDisp_ConvolutionFilter1D(GLbyte * pc)
+{
+ const GLvoid * const image = (const GLvoid *) (pc + 44);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_ConvolutionFilter1D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 20),
+ *(GLenum *)(pc + 24),
+ *(GLsizei *)(pc + 28),
+ *(GLenum *)(pc + 36),
+ *(GLenum *)(pc + 40),
+ image
+ ) );
+}
+
+void __glXDisp_ConvolutionFilter2D(GLbyte * pc)
+{
+ const GLvoid * const image = (const GLvoid *) (pc + 44);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_ConvolutionFilter2D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 20),
+ *(GLenum *)(pc + 24),
+ *(GLsizei *)(pc + 28),
+ *(GLsizei *)(pc + 32),
+ *(GLenum *)(pc + 36),
+ *(GLenum *)(pc + 40),
+ image
+ ) );
+}
+
+void __glXDisp_ConvolutionParameterf(GLbyte * pc)
+{
+ CALL_ConvolutionParameterf( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_ConvolutionParameterfv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLfloat * params;
+
+ params = (const GLfloat *) (pc + 8);
+
+ CALL_ConvolutionParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_ConvolutionParameteri(GLbyte * pc)
+{
+ CALL_ConvolutionParameteri( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_ConvolutionParameteriv(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 4);
+ const GLint * params;
+
+ params = (const GLint *) (pc + 8);
+
+ CALL_ConvolutionParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc)
+{
+ CALL_CopyConvolutionFilter1D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLsizei *)(pc + 16)
+ ) );
+}
+
+void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc)
+{
+ CALL_CopyConvolutionFilter2D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLsizei *)(pc + 16),
+ *(GLsizei *)(pc + 20)
+ ) );
+}
+
+int __glXDisp_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetConvolutionParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetConvolutionParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetConvolutionParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetConvolutionParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetConvolutionParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetConvolutionParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetConvolutionParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetConvolutionParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetHistogramParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetHistogramParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetHistogramParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetHistogramParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetHistogramParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetHistogramParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetHistogramParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetHistogramParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetMinmaxParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMinmaxParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetMinmaxParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMinmaxParameterfv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetMinmaxParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMinmaxParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetMinmaxParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMinmaxParameteriv( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_Histogram(GLbyte * pc)
+{
+ CALL_Histogram( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLsizei *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLboolean *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_Minmax(GLbyte * pc)
+{
+ CALL_Minmax( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLboolean *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_ResetHistogram(GLbyte * pc)
+{
+ CALL_ResetHistogram( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_ResetMinmax(GLbyte * pc)
+{
+ CALL_ResetMinmax( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_TexImage3D(GLbyte * pc)
+{
+ const CARD32 ptr_is_null = *(CARD32 *)(pc + 76);
+ const GLvoid * const pixels = (const GLvoid *) ((ptr_is_null != 0) ? NULL : (pc + 80));
+ __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_TexImage3D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 36),
+ *(GLint *)(pc + 40),
+ *(GLint *)(pc + 44),
+ *(GLsizei *)(pc + 48),
+ *(GLsizei *)(pc + 52),
+ *(GLsizei *)(pc + 56),
+ *(GLint *)(pc + 64),
+ *(GLenum *)(pc + 68),
+ *(GLenum *)(pc + 72),
+ pixels
+ ) );
+}
+
+void __glXDisp_TexSubImage3D(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 88);
+ __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) );
+
+ CALL_TexSubImage3D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 36),
+ *(GLint *)(pc + 40),
+ *(GLint *)(pc + 44),
+ *(GLint *)(pc + 48),
+ *(GLint *)(pc + 52),
+ *(GLsizei *)(pc + 60),
+ *(GLsizei *)(pc + 64),
+ *(GLsizei *)(pc + 68),
+ *(GLenum *)(pc + 76),
+ *(GLenum *)(pc + 80),
+ pixels
+ ) );
+}
+
+void __glXDisp_CopyTexSubImage3D(GLbyte * pc)
+{
+ CALL_CopyTexSubImage3D( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLint *)(pc + 20),
+ *(GLint *)(pc + 24),
+ *(GLsizei *)(pc + 28),
+ *(GLsizei *)(pc + 32)
+ ) );
+}
+
+void __glXDisp_ActiveTextureARB(GLbyte * pc)
+{
+ CALL_ActiveTextureARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 12);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MultiTexCoord1dvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 8),
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord1fvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord1ivARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord1svARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord1svARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MultiTexCoord2dvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 16),
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord2fvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord2ivARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord2svARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord2svARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 28);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MultiTexCoord3dvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 24),
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord3fvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord3ivARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord3svARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord3svARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MultiTexCoord4dvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 32),
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord4fvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord4ivARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_MultiTexCoord4svARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord4svARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_SampleCoverageARB(GLbyte * pc)
+{
+ CALL_SampleCoverageARB( GET_DISPATCH(), (
+ *(GLclampf *)(pc + 0),
+ *(GLboolean *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_CompressedTexImage1DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = *(GLsizei *)(pc + 20);
+
+ CALL_CompressedTexImage1DARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLsizei *)(pc + 12),
+ *(GLint *)(pc + 16),
+ imageSize,
+ (const GLvoid *)(pc + 24)
+ ) );
+}
+
+void __glXDisp_CompressedTexImage2DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = *(GLsizei *)(pc + 24);
+
+ CALL_CompressedTexImage2DARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLsizei *)(pc + 12),
+ *(GLsizei *)(pc + 16),
+ *(GLint *)(pc + 20),
+ imageSize,
+ (const GLvoid *)(pc + 28)
+ ) );
+}
+
+void __glXDisp_CompressedTexImage3DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = *(GLsizei *)(pc + 28);
+
+ CALL_CompressedTexImage3DARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLsizei *)(pc + 12),
+ *(GLsizei *)(pc + 16),
+ *(GLsizei *)(pc + 20),
+ *(GLint *)(pc + 24),
+ imageSize,
+ (const GLvoid *)(pc + 32)
+ ) );
+}
+
+void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = *(GLsizei *)(pc + 20);
+
+ CALL_CompressedTexSubImage1DARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLsizei *)(pc + 12),
+ *(GLenum *)(pc + 16),
+ imageSize,
+ (const GLvoid *)(pc + 24)
+ ) );
+}
+
+void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = *(GLsizei *)(pc + 28);
+
+ CALL_CompressedTexSubImage2DARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLsizei *)(pc + 16),
+ *(GLsizei *)(pc + 20),
+ *(GLenum *)(pc + 24),
+ imageSize,
+ (const GLvoid *)(pc + 32)
+ ) );
+}
+
+void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = *(GLsizei *)(pc + 36);
+
+ CALL_CompressedTexSubImage3DARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLsizei *)(pc + 20),
+ *(GLsizei *)(pc + 24),
+ *(GLsizei *)(pc + 28),
+ *(GLenum *)(pc + 32),
+ imageSize,
+ (const GLvoid *)(pc + 40)
+ ) );
+}
+
+int __glXDisp_GetProgramEnvParameterdvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLdouble params[4];
+ CALL_GetProgramEnvParameterdvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetProgramEnvParameterfvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLfloat params[4];
+ CALL_GetProgramEnvParameterfvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetProgramLocalParameterdvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLdouble params[4];
+ CALL_GetProgramLocalParameterdvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetProgramLocalParameterfvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLfloat params[4];
+ CALL_GetProgramLocalParameterfvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetProgramivARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetProgramivARB_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetProgramivARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetVertexAttribdvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetVertexAttribdvARB_size(pname);
+ GLdouble answerBuffer[200];
+ GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribdvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetVertexAttribfvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetVertexAttribfvARB_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribfvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetVertexAttribivARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetVertexAttribivARB_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribivARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 40);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ProgramEnvParameter4dvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ (const GLdouble *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc)
+{
+ CALL_ProgramEnvParameter4fvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ (const GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 40);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ProgramLocalParameter4dvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ (const GLdouble *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc)
+{
+ CALL_ProgramLocalParameter4fvARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ (const GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_ProgramStringARB(GLbyte * pc)
+{
+ const GLsizei len = *(GLsizei *)(pc + 8);
+
+ CALL_ProgramStringARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ len,
+ (const GLvoid *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_VertexAttrib1dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 12);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib1dvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLdouble *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib1fvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib1fvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib1svARB(GLbyte * pc)
+{
+ CALL_VertexAttrib1svARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib2dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib2dvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLdouble *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib2fvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib2fvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib2svARB(GLbyte * pc)
+{
+ CALL_VertexAttrib2svARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib3dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 28);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib3dvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLdouble *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib3fvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib3fvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib3svARB(GLbyte * pc)
+{
+ CALL_VertexAttrib3svARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NbvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLbyte *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4NivARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NivARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NsvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NubvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLubyte *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NuivARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLuint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NusvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLushort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4bvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4bvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLbyte *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib4dvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLdouble *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4fvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4fvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4ivARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4ivARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4svARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4svARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4ubvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLubyte *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4uivARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4uivARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLuint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4usvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4usvARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLushort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_BeginQueryARB(GLbyte * pc)
+{
+ CALL_BeginQueryARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4)
+ ) );
+}
+
+int __glXDisp_DeleteQueriesARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ CALL_DeleteQueriesARB( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4)
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_EndQueryARB(GLbyte * pc)
+{
+ CALL_EndQueryARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+int __glXDisp_GenQueriesARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ GLuint answerBuffer[200];
+ GLuint * ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenQueriesARB( GET_DISPATCH(), (
+ n,
+ ids
+ ) );
+ __glXSendReply(cl->client, ids, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetQueryObjectivARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetQueryObjectivARB_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetQueryObjectivARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetQueryObjectuivARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetQueryObjectuivARB_size(pname);
+ GLuint answerBuffer[200];
+ GLuint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetQueryObjectuivARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetQueryivARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetQueryivARB_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetQueryivARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_IsQueryARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsQueryARB( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_DrawBuffersARB(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ CALL_DrawBuffersARB( GET_DISPATCH(), (
+ n,
+ (const GLenum *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_ClampColorARB(GLbyte * pc)
+{
+ CALL_ClampColorARB( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_RenderbufferStorageMultisample(GLbyte * pc)
+{
+ CALL_RenderbufferStorageMultisample( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLsizei *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLsizei *)(pc + 12),
+ *(GLsizei *)(pc + 16)
+ ) );
+}
+
+void __glXDisp_SampleMaskSGIS(GLbyte * pc)
+{
+ CALL_SampleMaskSGIS( GET_DISPATCH(), (
+ *(GLclampf *)(pc + 0),
+ *(GLboolean *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_SamplePatternSGIS(GLbyte * pc)
+{
+ CALL_SamplePatternSGIS( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_PointParameterfEXT(GLbyte * pc)
+{
+ CALL_PointParameterfEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_PointParameterfvEXT(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 0);
+ const GLfloat * params;
+
+ params = (const GLfloat *) (pc + 4);
+
+ CALL_PointParameterfvEXT( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3bvEXT( GET_DISPATCH(), (
+ (const GLbyte *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_SecondaryColor3dvEXT( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3fvEXT( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3ivEXT( GET_DISPATCH(), (
+ (const GLint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_SecondaryColor3svEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3svEXT( GET_DISPATCH(), (
+ (const GLshort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3ubvEXT( GET_DISPATCH(), (
+ (const GLubyte *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3uivEXT( GET_DISPATCH(), (
+ (const GLuint *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3usvEXT( GET_DISPATCH(), (
+ (const GLushort *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_FogCoorddvEXT(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+
+ CALL_FogCoorddvEXT( GET_DISPATCH(), (
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_FogCoordfvEXT(GLbyte * pc)
+{
+ CALL_FogCoordfvEXT( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc)
+{
+ CALL_BlendFuncSeparateEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLenum *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_WindowPos3fvMESA(GLbyte * pc)
+{
+ CALL_WindowPos3fvMESA( GET_DISPATCH(), (
+ (const GLfloat *)(pc + 0)
+ ) );
+}
+
+int __glXDisp_AreProgramsResidentNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ GLboolean retval;
+ GLboolean answerBuffer[200];
+ GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
+ retval = CALL_AreProgramsResidentNV( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4),
+ residences
+ ) );
+ __glXSendReply(cl->client, residences, n, 1, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_BindProgramNV(GLbyte * pc)
+{
+ CALL_BindProgramNV( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4)
+ ) );
+}
+
+int __glXDisp_DeleteProgramsNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ CALL_DeleteProgramsNV( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4)
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_ExecuteProgramNV(GLbyte * pc)
+{
+ CALL_ExecuteProgramNV( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ (const GLfloat *)(pc + 8)
+ ) );
+}
+
+int __glXDisp_GenProgramsNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ GLuint answerBuffer[200];
+ GLuint * programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenProgramsNV( GET_DISPATCH(), (
+ n,
+ programs
+ ) );
+ __glXSendReply(cl->client, programs, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetProgramParameterdvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLdouble params[4];
+ CALL_GetProgramParameterdvNV( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetProgramParameterfvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLfloat params[4];
+ CALL_GetProgramParameterfvNV( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetProgramivNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetProgramivNV_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetProgramivNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetTrackMatrixivNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLint params[1];
+ CALL_GetTrackMatrixivNV( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetVertexAttribdvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetVertexAttribdvNV_size(pname);
+ GLdouble answerBuffer[200];
+ GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribdvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetVertexAttribfvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetVertexAttribfvNV_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribfvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetVertexAttribivNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = *(GLenum *)(pc + 4);
+
+ const GLuint compsize = __glGetVertexAttribivNV_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribivNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ pname,
+ params
+ ) );
+ __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_IsProgramNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsProgramNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_LoadProgramNV(GLbyte * pc)
+{
+ const GLsizei len = *(GLsizei *)(pc + 8);
+
+ CALL_LoadProgramNV( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ len,
+ (const GLubyte *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_ProgramParameters4dvNV(GLbyte * pc)
+{
+ const GLsizei num = *(GLsizei *)(pc + 8);
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ProgramParameters4dvNV( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ num,
+ (const GLdouble *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_ProgramParameters4fvNV(GLbyte * pc)
+{
+ const GLsizei num = *(GLsizei *)(pc + 8);
+
+ CALL_ProgramParameters4fvNV( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ num,
+ (const GLfloat *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_RequestResidentProgramsNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ CALL_RequestResidentProgramsNV( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_TrackMatrixNV(GLbyte * pc)
+{
+ CALL_TrackMatrixNV( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLenum *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_VertexAttrib1dvNV(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 12);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib1dvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLdouble *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib1fvNV(GLbyte * pc)
+{
+ CALL_VertexAttrib1fvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib1svNV(GLbyte * pc)
+{
+ CALL_VertexAttrib1svNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib2dvNV(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib2dvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLdouble *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib2fvNV(GLbyte * pc)
+{
+ CALL_VertexAttrib2fvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib2svNV(GLbyte * pc)
+{
+ CALL_VertexAttrib2svNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib3dvNV(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 28);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib3dvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLdouble *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib3fvNV(GLbyte * pc)
+{
+ CALL_VertexAttrib3fvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib3svNV(GLbyte * pc)
+{
+ CALL_VertexAttrib3svNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4dvNV(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib4dvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLdouble *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4fvNV(GLbyte * pc)
+{
+ CALL_VertexAttrib4fvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLfloat *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4svNV(GLbyte * pc)
+{
+ CALL_VertexAttrib4svNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLshort *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc)
+{
+ CALL_VertexAttrib4ubvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ (const GLubyte *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_VertexAttribs1dvNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttribs1dvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLdouble *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs1fvNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+ CALL_VertexAttribs1fvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs1svNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+ CALL_VertexAttribs1svNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLshort *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs2dvNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttribs2dvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLdouble *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs2fvNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+ CALL_VertexAttribs2fvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs2svNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+ CALL_VertexAttribs2svNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLshort *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs3dvNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttribs3dvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLdouble *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs3fvNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+ CALL_VertexAttribs3fvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs3svNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+ CALL_VertexAttribs3svNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLshort *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs4dvNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttribs4dvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLdouble *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs4fvNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+ CALL_VertexAttribs4fvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs4svNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+ CALL_VertexAttribs4svNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLshort *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 4);
+
+ CALL_VertexAttribs4ubvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ n,
+ (const GLubyte *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_PointParameteriNV(GLbyte * pc)
+{
+ CALL_PointParameteriNV( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_PointParameterivNV(GLbyte * pc)
+{
+ const GLenum pname = *(GLenum *)(pc + 0);
+ const GLint * params;
+
+ params = (const GLint *) (pc + 4);
+
+ CALL_PointParameterivNV( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc)
+{
+ CALL_ActiveStencilFaceEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+int __glXDisp_GetProgramNamedParameterdvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei len = *(GLsizei *)(pc + 4);
+
+ GLdouble params[4];
+ CALL_GetProgramNamedParameterdvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ len,
+ (const GLubyte *)(pc + 8),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 4, 8, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetProgramNamedParameterfvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei len = *(GLsizei *)(pc + 4);
+
+ GLfloat params[4];
+ CALL_GetProgramNamedParameterfvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ len,
+ (const GLubyte *)(pc + 8),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 4, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc)
+{
+ const GLsizei len = *(GLsizei *)(pc + 36);
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 44 + __GLX_PAD(len) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ProgramNamedParameter4dvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 32),
+ len,
+ (const GLubyte *)(pc + 40),
+ (const GLdouble *)(pc + 0)
+ ) );
+}
+
+void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc)
+{
+ const GLsizei len = *(GLsizei *)(pc + 4);
+
+ CALL_ProgramNamedParameter4fvNV( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0),
+ len,
+ (const GLubyte *)(pc + 24),
+ (const GLfloat *)(pc + 8)
+ ) );
+}
+
+void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc)
+{
+ CALL_BlendEquationSeparateEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_BindFramebufferEXT(GLbyte * pc)
+{
+ CALL_BindFramebufferEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_BindRenderbufferEXT(GLbyte * pc)
+{
+ CALL_BindRenderbufferEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4)
+ ) );
+}
+
+int __glXDisp_CheckFramebufferStatusEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLenum retval;
+ retval = CALL_CheckFramebufferStatusEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ CALL_DeleteFramebuffersEXT( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc)
+{
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ CALL_DeleteRenderbuffersEXT( GET_DISPATCH(), (
+ n,
+ (const GLuint *)(pc + 4)
+ ) );
+}
+
+void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc)
+{
+ CALL_FramebufferRenderbufferEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLuint *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc)
+{
+ CALL_FramebufferTexture1DEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLuint *)(pc + 12),
+ *(GLint *)(pc + 16)
+ ) );
+}
+
+void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc)
+{
+ CALL_FramebufferTexture2DEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLuint *)(pc + 12),
+ *(GLint *)(pc + 16)
+ ) );
+}
+
+void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc)
+{
+ CALL_FramebufferTexture3DEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLuint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLint *)(pc + 20)
+ ) );
+}
+
+int __glXDisp_GenFramebuffersEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ GLuint answerBuffer[200];
+ GLuint * framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenFramebuffersEXT( GET_DISPATCH(), (
+ n,
+ framebuffers
+ ) );
+ __glXSendReply(cl->client, framebuffers, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GenRenderbuffersEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = *(GLsizei *)(pc + 0);
+
+ GLuint answerBuffer[200];
+ GLuint * renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenRenderbuffersEXT( GET_DISPATCH(), (
+ n,
+ renderbuffers
+ ) );
+ __glXSendReply(cl->client, renderbuffers, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_GenerateMipmapEXT(GLbyte * pc)
+{
+ CALL_GenerateMipmapEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0)
+ ) );
+}
+
+int __glXDisp_GetFramebufferAttachmentParameterivEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLint params[1];
+ CALL_GetFramebufferAttachmentParameterivEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_GetRenderbufferParameterivEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLint params[1];
+ CALL_GetRenderbufferParameterivEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ params
+ ) );
+ __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_IsFramebufferEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsFramebufferEXT( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDisp_IsRenderbufferEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsRenderbufferEXT( GET_DISPATCH(), (
+ *(GLuint *)(pc + 0)
+ ) );
+ __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDisp_RenderbufferStorageEXT(GLbyte * pc)
+{
+ CALL_RenderbufferStorageEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12)
+ ) );
+}
+
+void __glXDisp_BlitFramebufferEXT(GLbyte * pc)
+{
+ CALL_BlitFramebufferEXT( GET_DISPATCH(), (
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLint *)(pc + 20),
+ *(GLint *)(pc + 24),
+ *(GLint *)(pc + 28),
+ *(GLbitfield *)(pc + 32),
+ *(GLenum *)(pc + 36)
+ ) );
+}
+
+void __glXDisp_FramebufferTextureLayerEXT(GLbyte * pc)
+{
+ CALL_FramebufferTextureLayerEXT( GET_DISPATCH(), (
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLuint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16)
+ ) );
+}
+
diff --git a/xorg-server/glx/indirect_dispatch.h b/xorg-server/glx/indirect_dispatch.h
index 4418131ce..9220638be 100644
--- a/xorg-server/glx/indirect_dispatch.h
+++ b/xorg-server/glx/indirect_dispatch.h
@@ -1,1050 +1,1050 @@
-/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */
-
-/*
- * (C) Copyright IBM Corporation 2005
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#if !defined( _INDIRECT_DISPATCH_H_ )
-# define _INDIRECT_DISPATCH_H_
-
-# include <X11/Xfuncproto.h>
-
-struct __GLXclientStateRec;
-
-extern _X_HIDDEN void __glXDisp_MapGrid1d(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MapGrid1d(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MapGrid1f(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MapGrid1f(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_NewList(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_NewList(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_LoadIdentity(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LoadIdentity(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SampleCoverageARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SampleCoverageARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ConvolutionFilter1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BeginQueryARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BeginQueryARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_RasterPos3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PointParameteriNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PointParameteriNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord1iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord1iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord4sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord4sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ActiveTextureARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ActiveTextureARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BlitFramebufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BlitFramebufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Histogram(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Histogram(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetMapfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMapfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_RasterPos4dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos4dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PolygonStipple(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PolygonStipple(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Color3uiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color3uiv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_IsEnabled(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsEnabled(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_EvalCoord2fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EvalCoord2fv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetMapiv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMapiv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_SwapBuffers(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_SwapBuffers(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Indexubv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Indexubv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_Render(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_Render(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetQueryivARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetQueryivARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_TexImage3D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexImage3D(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Color3ubv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color3ubv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetQueryObjectivARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetQueryObjectivARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Vertex3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs3fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_LightModeliv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LightModeliv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs1dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Normal3bv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Normal3bv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_VendorPrivate(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_VendorPrivate(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Vertex3iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex3iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BlendColor(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BlendColor(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Scalef(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Scalef(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Normal3iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Normal3iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PassThrough(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PassThrough(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_FramebufferTextureLayerEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FramebufferTextureLayerEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Viewport(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Viewport(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CopyTexSubImage2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_DepthRange(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DepthRange(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ResetHistogram(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ResetHistogram(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramNamedParameterfvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramNamedParameterfvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_PointParameterfEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PointParameterfEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord2sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord2sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Vertex4dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex4dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexImage3DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color3sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color3sv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Vertex2dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex2dv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord3iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord3iv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_CopyContext(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CopyContext(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Color3fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color3fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PointSize(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PointSize(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PopName(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PopName(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Vertex4sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex4sv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_LineStipple(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LineStipple(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexEnvi(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexEnvi(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetClipPlane(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetClipPlane(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttribs3dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_LightModeli(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LightModeli(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs4fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Scaled(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Scaled(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CallLists(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CallLists(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_AlphaFunc(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_AlphaFunc(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord2iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord2iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexImage1DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Rotated(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Rotated(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_ReadPixels(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EdgeFlagv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexParameterf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexParameterf(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexParameteri(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexParameteri(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_DestroyContext(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DestroyContext(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_DrawPixels(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DrawPixels(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord2svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_GenerateMipmapEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GenLists(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenLists(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_MapGrid2d(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MapGrid2d(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MapGrid2f(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MapGrid2f(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Scissor(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Scissor(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Fogf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Fogf(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexSubImage1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexSubImage1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color4usv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color4usv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Fogi(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Fogi(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_RasterPos3iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos3iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PixelMapfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PixelMapfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color3usv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color3usv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PointParameterfvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color3bv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color3bv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_RenderbufferStorageEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ColorTable(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ColorTable(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Accum(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Accum(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetTexImage(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTexImage(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_ConvolutionFilter2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_Finish(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_Finish(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_ClearStencil(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ClearStencil(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib3dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ConvolutionParameteriv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_RasterPos2fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos2fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord1fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord1fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_RasterPos4fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos4fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ClearIndex(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ClearIndex(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_LoadMatrixd(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LoadMatrixd(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PushMatrix(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PushMatrix(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ConvolutionParameterfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetTexGendv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTexGendv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribfvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribfvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_LoadProgramNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LoadProgramNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_EndList(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_EndList(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_EvalCoord1fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EvalCoord1fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_EvalMesh2(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EvalMesh2(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Vertex4fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex4fv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_CheckFramebufferStatusEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CheckFramebufferStatusEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribivARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribivARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_CreateNewContext(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CreateNewContext(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetMinmax(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMinmax(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Normal3fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Normal3fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_End(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_End(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs2dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramParameterfvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramParameterfvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_BindTexture(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BindTexture(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexSubImage2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexSubImage2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexGenfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexGenfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4bvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_BlendEquation(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BlendEquation(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetError(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetError(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_TexCoord3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Indexdv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Indexdv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PushName(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PushName(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord1svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_EndQueryARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EndQueryARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_DepthMask(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DepthMask(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color4iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_StencilOp(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_StencilOp(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord3svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexEnvfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexEnvfv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_QueryServerString(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_QueryServerString(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_LoadMatrixf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LoadMatrixf(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color4bv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color4bv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib2fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_DeleteLists(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DeleteLists(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_LogicOp(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LogicOp(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_RenderbufferStorageMultisample(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RenderbufferStorageMultisample(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord4fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord4fv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_WaitX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_WaitX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GenTextures(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenTextures(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_RasterPos2sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos2sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color4ubv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color4ubv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_DrawBuffer(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DrawBuffer(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord2fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord2fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord1sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord1sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexGeniv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexGeniv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_DepthFunc(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DepthFunc(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PixelMapusv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PixelMapusv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PointParameterivNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PointParameterivNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BlendFunc(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BlendFunc(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_WaitGL(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_WaitGL(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_Flush(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_Flush(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Color4uiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color4uiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_RasterPos3sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos3sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BindFramebufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BindFramebufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PushAttrib(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PushAttrib(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_TexParameteriv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexParameteriv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_WindowPos3fvMESA(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_RasterPos3fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos3fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CopyTexSubImage3D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetColorTable(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetColorTable(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Indexiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Indexiv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_CreateContext(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CreateContext(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_CopyColorTable(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CopyColorTable(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Frustum(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Frustum(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetString(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetString(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_TexEnvf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexEnvf(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_DeleteTextures(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DeleteTextures(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_ClearAccum(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ClearAccum(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_QueryVersion(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_QueryVersion(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribfvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribfvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord4iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord4iv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_ColorTableParameteriv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ColorTableParameteriv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CopyTexImage2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CopyTexImage2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Lightfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Lightfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ClearDepth(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ClearDepth(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ColorSubTable(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ColorSubTable(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color4fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color4fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_CreatePixmap(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CreatePixmap(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Lightiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Lightiv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetQueryObjectuivARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetQueryObjectuivARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GenRenderbuffersEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenRenderbuffersEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib2dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs2svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Rectdv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Rectdv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Materialiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Materialiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SampleMaskSGIS(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SampleMaskSGIS(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PolygonMode(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PolygonMode(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib2dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribivNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribivNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_IsQueryARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsQueryARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_TexGeni(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexGeni(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexGenf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexGenf(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexGend(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexGend(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib2svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_DestroyWindow(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DestroyWindow(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Color4sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color4sv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_IsProgramNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsProgramNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_PixelZoom(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PixelZoom(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ColorTableParameterfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ColorTableParameterfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PixelMapuiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PixelMapuiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color3dv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_IsTexture(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsTexture(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetMapdv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMapdv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_SamplePatternSGIS(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SamplePatternSGIS(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_PixelStoref(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_PixelStoref(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_PrioritizeTextures(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PrioritizeTextures(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_PixelStorei(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EvalCoord2dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib3svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ColorMaterial(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ColorMaterial(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_IsFramebufferEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsFramebufferEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_RequestResidentProgramsNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_RasterPos2iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos2iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexImage1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexImage1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_FrontFace(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FrontFace(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_RenderLarge(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_RenderLarge(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PolygonOffset(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PolygonOffset(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ExecuteProgramNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ExecuteProgramNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Normal3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Normal3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Lightf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Lightf(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MatrixMode(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MatrixMode(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Lighti(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Lighti(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetDoublev(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetDoublev(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_MultMatrixd(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultMatrixd(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultMatrixf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultMatrixf(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_RasterPos4sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos4sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib3fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ClearColor(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ClearColor(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_IsDirect(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsDirect(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexEnviv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexEnviv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexSubImage3D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexSubImage3D(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Bitmap(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Bitmap(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GenFramebuffersEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenFramebuffersEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetProgramParameterdvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramParameterdvNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Vertex2sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex2sv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetIntegerv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetIntegerv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetTrackMatrixivNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTrackMatrixivNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib3svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_SeparableFilter2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SeparableFilter2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Map1d(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Map1d(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Map1f(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Map1f(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexImage2DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexImage2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexImage2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramParameters4fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramivNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramivNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_PixelTransferf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PixelTransferf(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CopyTexImage1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CopyTexImage1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Fogiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Fogiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord1dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord1dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PixelTransferi(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PixelTransferi(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib3fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Clear(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Clear(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ReadBuffer(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ReadBuffer(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ConvolutionParameteri(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ConvolutionParameteri(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Ortho(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Ortho(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ListBase(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ListBase(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ConvolutionParameterf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ConvolutionParameterf(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_CallList(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CallList(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs2fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Rectiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Rectiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Vertex2fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex2fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BindRenderbufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Vertex3sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex3sv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_DeleteProgramsNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DeleteProgramsNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_EvalMesh1(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EvalMesh1(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs1fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Vertex2iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex2iv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramStringNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_LineWidth(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LineWidth(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib2fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexGendv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexGendv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ResetMinmax(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ResetMinmax(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttribs4dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_UseXFont(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_UseXFont(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_ShadeModel(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ShadeModel(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Materialfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Materialfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord3fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord3fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_FogCoordfvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FogCoordfvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_DrawArrays(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DrawArrays(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color3iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color3iv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Rotatef(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramParameters4dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_EvalPoint2(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EvalPoint2(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_EvalPoint1(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EvalPoint1(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PopMatrix(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PopMatrix(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_MakeCurrent(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_MakeCurrent(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Map2d(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Map2d(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Map2f(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Map2f(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramStringARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramStringARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetHistogram(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetHistogram(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Materialf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Materialf(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Materiali(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Materiali(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Indexsv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Indexsv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord4svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_LightModelfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LightModelfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexCoord2dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord2dv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GenQueriesARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenQueriesARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_EvalCoord1dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EvalCoord1dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Translated(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Translated(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Translatef(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Translatef(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_StencilMask(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_StencilMask(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ClampColorARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ClampColorARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_CreateWindow(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CreateWindow(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetLightiv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetLightiv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_IsList(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsList(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_RenderMode(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_RenderMode(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_DrawBuffersARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DrawBuffersARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_LoadName(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LoadName(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CopyTexSubImage1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CullFace(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CullFace(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttribs3svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_StencilFunc(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_StencilFunc(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CopyPixels(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CopyPixels(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Rectsv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Rectsv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TexParameterfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexParameterfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4uivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ClipPlane(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ClipPlane(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TrackMatrixNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TrackMatrixNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Indexfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Indexfv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_QueryContext(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_QueryContext(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3svEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_IndexMask(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_IndexMask(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BindProgramNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BindProgramNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetFloatv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetFloatv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_TexCoord3sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord3sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PopAttrib(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PopAttrib(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Fogfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Fogfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_InitNames(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_InitNames(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Normal3sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Normal3sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Minmax(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Minmax(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_FogCoorddvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FogCoorddvEXT(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetBooleanv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetBooleanv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Hint(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Hint(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Color4dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Color4dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib2svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_AreProgramsResidentNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_AreProgramsResidentNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_CopyColorSubTable(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CopyColorSubTable(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib3dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Vertex4iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex4iv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_TexCoord4dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TexCoord4dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Begin(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Begin(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_ClientInfo(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_ClientInfo(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Rectfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Rectfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_LightModelf(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LightModelf(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetLightfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetLightfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_Disable(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Disable(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetRenderbufferParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetRenderbufferParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_SelectBuffer(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_SelectBuffer(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_ColorMask(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ColorMask(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_RasterPos4iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RasterPos4iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Enable(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Enable(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs4svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs1svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_Vertex3fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_Vertex3fv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GenProgramsNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenProgramsNV(struct __GLXclientStateRec *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc);
-
-#endif /* !defined( _INDIRECT_DISPATCH_H_ ) */
+/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */
+
+/*
+ * (C) Copyright IBM Corporation 2005
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#if !defined( _INDIRECT_DISPATCH_H_ )
+# define _INDIRECT_DISPATCH_H_
+
+# include <X11/Xfuncproto.h>
+
+struct __GLXclientStateRec;
+
+extern _X_HIDDEN void __glXDisp_MapGrid1d(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MapGrid1d(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MapGrid1f(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MapGrid1f(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_NewList(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_NewList(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_LoadIdentity(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LoadIdentity(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SampleCoverageARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SampleCoverageARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ConvolutionFilter1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BeginQueryARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BeginQueryARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_RasterPos3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PointParameteriNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PointParameteriNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord1iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord1iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord4sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord4sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ActiveTextureARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ActiveTextureARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BlitFramebufferEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BlitFramebufferEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Histogram(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Histogram(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetMapfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMapfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_RasterPos4dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos4dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PolygonStipple(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PolygonStipple(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Color3uiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color3uiv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_IsEnabled(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsEnabled(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_EvalCoord2fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EvalCoord2fv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetMapiv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMapiv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_SwapBuffers(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_SwapBuffers(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Indexubv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Indexubv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_Render(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_Render(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetQueryivARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetQueryivARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_TexImage3D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexImage3D(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Color3ubv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color3ubv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetQueryObjectivARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetQueryObjectivARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Vertex3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs3fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_LightModeliv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LightModeliv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs1dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Normal3bv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Normal3bv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_VendorPrivate(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_VendorPrivate(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Vertex3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BlendColor(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BlendColor(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Scalef(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Scalef(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Normal3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Normal3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PassThrough(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PassThrough(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_FramebufferTextureLayerEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FramebufferTextureLayerEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Viewport(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Viewport(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CopyTexSubImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_DepthRange(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DepthRange(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ResetHistogram(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ResetHistogram(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramNamedParameterfvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramNamedParameterfvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_PointParameterfEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PointParameterfEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord2sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord2sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Vertex4dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex4dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexImage3DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color3sv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Vertex2dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex2dv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord3iv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_CopyContext(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CopyContext(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Color3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PointSize(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PointSize(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PopName(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PopName(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Vertex4sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex4sv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_LineStipple(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LineStipple(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexEnvi(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexEnvi(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetClipPlane(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetClipPlane(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttribs3dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_LightModeli(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LightModeli(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs4fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Scaled(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Scaled(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CallLists(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CallLists(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_AlphaFunc(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_AlphaFunc(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord2iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord2iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexImage1DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Rotated(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Rotated(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_ReadPixels(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EdgeFlagv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexParameterf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexParameterf(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexParameteri(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexParameteri(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_DestroyContext(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DestroyContext(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_DrawPixels(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DrawPixels(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord2svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_GenerateMipmapEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GenLists(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenLists(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_MapGrid2d(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MapGrid2d(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MapGrid2f(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MapGrid2f(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Scissor(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Scissor(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Fogf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Fogf(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexSubImage1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexSubImage1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color4usv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color4usv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Fogi(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Fogi(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_RasterPos3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PixelMapfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PixelMapfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color3usv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color3usv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PointParameterfvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color3bv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color3bv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_RenderbufferStorageEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ColorTable(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ColorTable(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Accum(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Accum(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetTexImage(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTexImage(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_ConvolutionFilter2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_Finish(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_Finish(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_ClearStencil(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ClearStencil(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib3dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ConvolutionParameteriv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_RasterPos2fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos2fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord1fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord1fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_RasterPos4fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos4fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ClearIndex(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ClearIndex(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_LoadMatrixd(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LoadMatrixd(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PushMatrix(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PushMatrix(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ConvolutionParameterfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetTexGendv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTexGendv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetVertexAttribfvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetVertexAttribfvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_LoadProgramNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LoadProgramNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_EndList(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_EndList(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_EvalCoord1fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EvalCoord1fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_EvalMesh2(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EvalMesh2(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Vertex4fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex4fv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_CheckFramebufferStatusEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CheckFramebufferStatusEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetVertexAttribivARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetVertexAttribivARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_CreateNewContext(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CreateNewContext(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetMinmax(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMinmax(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Normal3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Normal3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4ivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_End(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_End(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs2dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramParameterfvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramParameterfvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_BindTexture(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BindTexture(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexSubImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexSubImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexGenfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexGenfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4bvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_BlendEquation(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BlendEquation(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetError(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetError(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_TexCoord3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Indexdv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Indexdv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PushName(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PushName(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord1svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_EndQueryARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EndQueryARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_DepthMask(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DepthMask(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color4iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_StencilOp(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_StencilOp(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord3svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexEnvfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexEnvfv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_QueryServerString(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_QueryServerString(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_LoadMatrixf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LoadMatrixf(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color4bv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color4bv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib2fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_DeleteLists(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DeleteLists(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_LogicOp(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LogicOp(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_RenderbufferStorageMultisample(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RenderbufferStorageMultisample(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord4fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord4fv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_WaitX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_WaitX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GenTextures(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenTextures(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_RasterPos2sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos2sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color4ubv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color4ubv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_DrawBuffer(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DrawBuffer(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord2fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord2fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord1sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord1sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexGeniv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexGeniv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_DepthFunc(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DepthFunc(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PixelMapusv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PixelMapusv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PointParameterivNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PointParameterivNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BlendFunc(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BlendFunc(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_WaitGL(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_WaitGL(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_Flush(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_Flush(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Color4uiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color4uiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_RasterPos3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BindFramebufferEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BindFramebufferEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PushAttrib(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PushAttrib(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_TexParameteriv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexParameteriv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_WindowPos3fvMESA(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_RasterPos3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CopyTexSubImage3D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetColorTable(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetColorTable(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Indexiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Indexiv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_CreateContext(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CreateContext(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_CopyColorTable(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CopyColorTable(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Frustum(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Frustum(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetString(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetString(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_TexEnvf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexEnvf(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_DeleteTextures(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DeleteTextures(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_ClearAccum(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ClearAccum(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_QueryVersion(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_QueryVersion(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetVertexAttribfvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetVertexAttribfvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord4iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord4iv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_ColorTableParameteriv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ColorTableParameteriv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CopyTexImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CopyTexImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Lightfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Lightfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ClearDepth(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ClearDepth(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ColorSubTable(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ColorSubTable(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color4fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color4fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_CreatePixmap(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CreatePixmap(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Lightiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Lightiv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetQueryObjectuivARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetQueryObjectuivARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GenRenderbuffersEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenRenderbuffersEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib2dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs2svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Rectdv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Rectdv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4NivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Materialiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Materialiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SampleMaskSGIS(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SampleMaskSGIS(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PolygonMode(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PolygonMode(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib2dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetVertexAttribivNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetVertexAttribivNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_IsQueryARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsQueryARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_TexGeni(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexGeni(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexGenf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexGenf(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexGend(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexGend(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib2svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_DestroyWindow(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DestroyWindow(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Color4sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color4sv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_IsProgramNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsProgramNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_PixelZoom(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PixelZoom(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ColorTableParameterfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ColorTableParameterfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PixelMapuiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PixelMapuiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color3dv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_IsTexture(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsTexture(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetMapdv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMapdv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_SamplePatternSGIS(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SamplePatternSGIS(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_PixelStoref(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_PixelStoref(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_PrioritizeTextures(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PrioritizeTextures(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_PixelStorei(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EvalCoord2dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib3svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ColorMaterial(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ColorMaterial(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_IsFramebufferEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsFramebufferEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_RequestResidentProgramsNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_RasterPos2iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos2iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexImage1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexImage1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_FrontFace(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FrontFace(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_RenderLarge(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_RenderLarge(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PolygonOffset(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PolygonOffset(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ExecuteProgramNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ExecuteProgramNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Normal3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Normal3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Lightf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Lightf(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MatrixMode(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MatrixMode(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Lighti(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Lighti(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetDoublev(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetDoublev(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_MultMatrixd(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultMatrixd(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultMatrixf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultMatrixf(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_RasterPos4sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos4sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib3fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ClearColor(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ClearColor(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_IsDirect(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsDirect(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexEnviv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexEnviv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexSubImage3D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexSubImage3D(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Bitmap(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Bitmap(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GenFramebuffersEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenFramebuffersEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetProgramParameterdvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramParameterdvNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Vertex2sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex2sv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetIntegerv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetIntegerv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetTrackMatrixivNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTrackMatrixivNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib3svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_SeparableFilter2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SeparableFilter2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Map1d(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Map1d(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Map1f(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Map1f(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexImage2DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ProgramParameters4fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramivNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramivNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_PixelTransferf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PixelTransferf(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CopyTexImage1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CopyTexImage1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Fogiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Fogiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord1dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord1dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PixelTransferi(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PixelTransferi(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib3fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Clear(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Clear(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ReadBuffer(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ReadBuffer(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ConvolutionParameteri(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ConvolutionParameteri(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Ortho(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Ortho(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ListBase(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ListBase(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ConvolutionParameterf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ConvolutionParameterf(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_CallList(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CallList(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs2fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Rectiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Rectiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Vertex2fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex2fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BindRenderbufferEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Vertex3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex3sv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_DeleteProgramsNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DeleteProgramsNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_EvalMesh1(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EvalMesh1(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs1fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Vertex2iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex2iv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramStringNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_LineWidth(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LineWidth(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib2fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexGendv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexGendv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ResetMinmax(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ResetMinmax(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttribs4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_UseXFont(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_UseXFont(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_ShadeModel(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ShadeModel(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Materialfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Materialfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_FogCoordfvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FogCoordfvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_DrawArrays(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DrawArrays(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color3iv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Rotatef(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ProgramParameters4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_EvalPoint2(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EvalPoint2(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_EvalPoint1(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EvalPoint1(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PopMatrix(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PopMatrix(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_MakeCurrent(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_MakeCurrent(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Map2d(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Map2d(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Map2f(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Map2f(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ProgramStringARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ProgramStringARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetHistogram(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetHistogram(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Materialf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Materialf(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Materiali(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Materiali(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Indexsv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Indexsv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord4svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_LightModelfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LightModelfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexCoord2dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord2dv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GenQueriesARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenQueriesARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_EvalCoord1dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EvalCoord1dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Translated(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Translated(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Translatef(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Translatef(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_StencilMask(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_StencilMask(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ClampColorARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ClampColorARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_CreateWindow(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CreateWindow(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetLightiv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetLightiv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_IsList(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsList(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_RenderMode(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_RenderMode(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_DrawBuffersARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DrawBuffersARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_LoadName(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LoadName(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CopyTexSubImage1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CullFace(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CullFace(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttribs3svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_StencilFunc(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_StencilFunc(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CopyPixels(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CopyPixels(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Rectsv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Rectsv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TexParameterfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexParameterfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4uivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ClipPlane(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ClipPlane(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_TrackMatrixNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TrackMatrixNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Indexfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Indexfv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_QueryContext(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_QueryContext(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3svEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_IndexMask(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_IndexMask(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BindProgramNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BindProgramNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetFloatv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetFloatv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_TexCoord3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PopAttrib(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PopAttrib(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Fogfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Fogfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_InitNames(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_InitNames(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Normal3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Normal3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Minmax(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Minmax(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_FogCoorddvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FogCoorddvEXT(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetBooleanv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetBooleanv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Hint(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Hint(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Color4dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Color4dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib2svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_AreProgramsResidentNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_AreProgramsResidentNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_CopyColorSubTable(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CopyColorSubTable(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib3dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Vertex4iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex4iv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_TexCoord4dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_TexCoord4dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Begin(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Begin(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_ClientInfo(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_ClientInfo(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Rectfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Rectfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_LightModelf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_LightModelf(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetLightfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetLightfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_Disable(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Disable(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetRenderbufferParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetRenderbufferParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_SelectBuffer(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_SelectBuffer(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_ColorMask(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ColorMask(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_RasterPos4iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RasterPos4iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Enable(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Enable(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs4svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs1svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_Vertex3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_Vertex3fv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDisp_GenProgramsNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenProgramsNV(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc);
+
+#endif /* !defined( _INDIRECT_DISPATCH_H_ ) */
diff --git a/xorg-server/glx/indirect_dispatch_swap.c b/xorg-server/glx/indirect_dispatch_swap.c
index 096bd7f30..629d5085a 100644
--- a/xorg-server/glx/indirect_dispatch_swap.c
+++ b/xorg-server/glx/indirect_dispatch_swap.c
@@ -1,6110 +1,6110 @@
-/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */
-
-/*
- * (C) Copyright IBM Corporation 2005
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#else
-
-#include "glheader.h"
-
-#endif
-
-#include <X11/Xmd.h>
-#include <GL/gl.h>
-#include <GL/glxproto.h>
-#include <inttypes.h>
-#include "indirect_size.h"
-#include "indirect_size_get.h"
-#include "indirect_dispatch.h"
-#include "glxserver.h"
-#include "glxbyteorder.h"
-#include "indirect_util.h"
-#include "singlesize.h"
-#include "glapi.h"
-#include "glapitable.h"
-#include "glthread.h"
-#include "dispatch.h"
-
-#define __GLX_PAD(x) (((x) + 3) & ~3)
-
-typedef struct {
- __GLX_PIXEL_3D_HDR;
-} __GLXpixel3DHeader;
-
-extern GLboolean __glXErrorOccured( void );
-extern void __glXClearErrorOccured( void );
-
-static const unsigned dummy_answer[2] = {0, 0};
-
-static GLsizei
-bswap_CARD32( const void * src )
-{
- union { uint32_t dst; GLsizei ret; } x;
- x.dst = bswap_32( *(uint32_t *) src );
- return x.ret;
-}
-
-static GLshort
-bswap_CARD16( const void * src )
-{
- union { uint16_t dst; GLshort ret; } x;
- x.dst = bswap_16( *(uint16_t *) src );
- return x.ret;
-}
-
-static GLenum
-bswap_ENUM( const void * src )
-{
- union { uint32_t dst; GLenum ret; } x;
- x.dst = bswap_32( *(uint32_t *) src );
- return x.ret;
-}
-
-static GLsync
-bswap_CARD64( const void * src )
-{
- union { uint64_t dst; GLsync ret; } x;
- x.dst = bswap_64( *(uint64_t *) src );
- return x.ret;
-}
-
-static GLdouble
-bswap_FLOAT64( const void * src )
-{
- union { uint64_t dst; GLdouble ret; } x;
- x.dst = bswap_64( *(uint64_t *) src );
- return x.ret;
-}
-
-static GLfloat
-bswap_FLOAT32( const void * src )
-{
- union { uint32_t dst; GLfloat ret; } x;
- x.dst = bswap_32( *(uint32_t *) src );
- return x.ret;
-}
-
-static void *
-bswap_16_array( uint16_t * src, unsigned count )
-{
- unsigned i;
-
- for ( i = 0 ; i < count ; i++ ) {
- uint16_t temp = bswap_16( src[i] );
- src[i] = temp;
- }
-
- return src;
-}
-
-static void *
-bswap_32_array( uint32_t * src, unsigned count )
-{
- unsigned i;
-
- for ( i = 0 ; i < count ; i++ ) {
- uint32_t temp = bswap_32( src[i] );
- src[i] = temp;
- }
-
- return src;
-}
-
-static void *
-bswap_64_array( uint64_t * src, unsigned count )
-{
- unsigned i;
-
- for ( i = 0 ; i < count ; i++ ) {
- uint64_t temp = bswap_64( src[i] );
- src[i] = temp;
- }
-
- return src;
-}
-
-int __glXDispSwap_NewList(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- CALL_NewList( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 )
- ) );
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_EndList(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- CALL_EndList( GET_DISPATCH(), () );
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_CallList(GLbyte * pc)
-{
- CALL_CallList( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_CallLists(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
- const GLenum type = (GLenum )bswap_ENUM ( pc + 4 );
- const GLvoid * lists;
-
- switch(type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_2_BYTES:
- case GL_3_BYTES:
- case GL_4_BYTES:
- lists = (const GLvoid *) (pc + 8); break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- lists = (const GLvoid *) bswap_16_array( (uint16_t *) (pc + 8), n ); break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- lists = (const GLvoid *) bswap_32_array( (uint32_t *) (pc + 8), n ); break;
- default:
- return;
- }
-
- CALL_CallLists( GET_DISPATCH(), (
- n,
- type,
- lists
- ) );
-}
-
-int __glXDispSwap_DeleteLists(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- CALL_DeleteLists( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (GLsizei )bswap_CARD32 ( pc + 4 )
- ) );
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GenLists(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLuint retval;
- retval = CALL_GenLists( GET_DISPATCH(), (
- (GLsizei )bswap_CARD32 ( pc + 0 )
- ) );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_ListBase(GLbyte * pc)
-{
- CALL_ListBase( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_Begin(GLbyte * pc)
-{
- CALL_Begin( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_Bitmap(GLbyte * pc)
-{
- const GLubyte * const bitmap = (const GLubyte *) (pc + 44);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_Bitmap( GET_DISPATCH(), (
- (GLsizei )bswap_CARD32 ( pc + 20 ),
- (GLsizei )bswap_CARD32 ( pc + 24 ),
- (GLfloat )bswap_FLOAT32( pc + 28 ),
- (GLfloat )bswap_FLOAT32( pc + 32 ),
- (GLfloat )bswap_FLOAT32( pc + 36 ),
- (GLfloat )bswap_FLOAT32( pc + 40 ),
- bitmap
- ) );
-}
-
-void __glXDispSwap_Color3bv(GLbyte * pc)
-{
- CALL_Color3bv( GET_DISPATCH(), (
- (const GLbyte *)(pc + 0)
- ) );
-}
-
-void __glXDispSwap_Color3dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_Color3dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Color3fv(GLbyte * pc)
-{
- CALL_Color3fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Color3iv(GLbyte * pc)
-{
- CALL_Color3iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Color3sv(GLbyte * pc)
-{
- CALL_Color3sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Color3ubv(GLbyte * pc)
-{
- CALL_Color3ubv( GET_DISPATCH(), (
- (const GLubyte *)(pc + 0)
- ) );
-}
-
-void __glXDispSwap_Color3uiv(GLbyte * pc)
-{
- CALL_Color3uiv( GET_DISPATCH(), (
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Color3usv(GLbyte * pc)
-{
- CALL_Color3usv( GET_DISPATCH(), (
- (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Color4bv(GLbyte * pc)
-{
- CALL_Color4bv( GET_DISPATCH(), (
- (const GLbyte *)(pc + 0)
- ) );
-}
-
-void __glXDispSwap_Color4dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_Color4dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_Color4fv(GLbyte * pc)
-{
- CALL_Color4fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_Color4iv(GLbyte * pc)
-{
- CALL_Color4iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_Color4sv(GLbyte * pc)
-{
- CALL_Color4sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_Color4ubv(GLbyte * pc)
-{
- CALL_Color4ubv( GET_DISPATCH(), (
- (const GLubyte *)(pc + 0)
- ) );
-}
-
-void __glXDispSwap_Color4uiv(GLbyte * pc)
-{
- CALL_Color4uiv( GET_DISPATCH(), (
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_Color4usv(GLbyte * pc)
-{
- CALL_Color4usv( GET_DISPATCH(), (
- (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_EdgeFlagv(GLbyte * pc)
-{
- CALL_EdgeFlagv( GET_DISPATCH(), (
- (const GLboolean *)(pc + 0)
- ) );
-}
-
-void __glXDispSwap_End(GLbyte * pc)
-{
- CALL_End( GET_DISPATCH(), () );
-}
-
-void __glXDispSwap_Indexdv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 8);
- pc -= 4;
- }
-#endif
-
- CALL_Indexdv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_Indexfv(GLbyte * pc)
-{
- CALL_Indexfv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_Indexiv(GLbyte * pc)
-{
- CALL_Indexiv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_Indexsv(GLbyte * pc)
-{
- CALL_Indexsv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_Normal3bv(GLbyte * pc)
-{
- CALL_Normal3bv( GET_DISPATCH(), (
- (const GLbyte *)(pc + 0)
- ) );
-}
-
-void __glXDispSwap_Normal3dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_Normal3dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Normal3fv(GLbyte * pc)
-{
- CALL_Normal3fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Normal3iv(GLbyte * pc)
-{
- CALL_Normal3iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Normal3sv(GLbyte * pc)
-{
- CALL_Normal3sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_RasterPos2dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_RasterPos2dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_RasterPos2fv(GLbyte * pc)
-{
- CALL_RasterPos2fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_RasterPos2iv(GLbyte * pc)
-{
- CALL_RasterPos2iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_RasterPos2sv(GLbyte * pc)
-{
- CALL_RasterPos2sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_RasterPos3dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_RasterPos3dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_RasterPos3fv(GLbyte * pc)
-{
- CALL_RasterPos3fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_RasterPos3iv(GLbyte * pc)
-{
- CALL_RasterPos3iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_RasterPos3sv(GLbyte * pc)
-{
- CALL_RasterPos3sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_RasterPos4dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_RasterPos4dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_RasterPos4fv(GLbyte * pc)
-{
- CALL_RasterPos4fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_RasterPos4iv(GLbyte * pc)
-{
- CALL_RasterPos4iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_RasterPos4sv(GLbyte * pc)
-{
- CALL_RasterPos4sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_Rectdv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_Rectdv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 16), 2 )
- ) );
-}
-
-void __glXDispSwap_Rectfv(GLbyte * pc)
-{
- CALL_Rectfv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 2 )
- ) );
-}
-
-void __glXDispSwap_Rectiv(GLbyte * pc)
-{
- CALL_Rectiv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ),
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 8), 2 )
- ) );
-}
-
-void __glXDispSwap_Rectsv(GLbyte * pc)
-{
- CALL_Rectsv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 )
- ) );
-}
-
-void __glXDispSwap_TexCoord1dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 8);
- pc -= 4;
- }
-#endif
-
- CALL_TexCoord1dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_TexCoord1fv(GLbyte * pc)
-{
- CALL_TexCoord1fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_TexCoord1iv(GLbyte * pc)
-{
- CALL_TexCoord1iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_TexCoord1sv(GLbyte * pc)
-{
- CALL_TexCoord1sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_TexCoord2dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_TexCoord2dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_TexCoord2fv(GLbyte * pc)
-{
- CALL_TexCoord2fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_TexCoord2iv(GLbyte * pc)
-{
- CALL_TexCoord2iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_TexCoord2sv(GLbyte * pc)
-{
- CALL_TexCoord2sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_TexCoord3dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_TexCoord3dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_TexCoord3fv(GLbyte * pc)
-{
- CALL_TexCoord3fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_TexCoord3iv(GLbyte * pc)
-{
- CALL_TexCoord3iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_TexCoord3sv(GLbyte * pc)
-{
- CALL_TexCoord3sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_TexCoord4dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_TexCoord4dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_TexCoord4fv(GLbyte * pc)
-{
- CALL_TexCoord4fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_TexCoord4iv(GLbyte * pc)
-{
- CALL_TexCoord4iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_TexCoord4sv(GLbyte * pc)
-{
- CALL_TexCoord4sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_Vertex2dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_Vertex2dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_Vertex2fv(GLbyte * pc)
-{
- CALL_Vertex2fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_Vertex2iv(GLbyte * pc)
-{
- CALL_Vertex2iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_Vertex2sv(GLbyte * pc)
-{
- CALL_Vertex2sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_Vertex3dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_Vertex3dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Vertex3fv(GLbyte * pc)
-{
- CALL_Vertex3fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Vertex3iv(GLbyte * pc)
-{
- CALL_Vertex3iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Vertex3sv(GLbyte * pc)
-{
- CALL_Vertex3sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_Vertex4dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_Vertex4dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_Vertex4fv(GLbyte * pc)
-{
- CALL_Vertex4fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_Vertex4iv(GLbyte * pc)
-{
- CALL_Vertex4iv( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_Vertex4sv(GLbyte * pc)
-{
- CALL_Vertex4sv( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_ClipPlane(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 36);
- pc -= 4;
- }
-#endif
-
- CALL_ClipPlane( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 32 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_ColorMaterial(GLbyte * pc)
-{
- CALL_ColorMaterial( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_CullFace(GLbyte * pc)
-{
- CALL_CullFace( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_Fogf(GLbyte * pc)
-{
- CALL_Fogf( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_Fogfv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
- const GLfloat * params;
-
- params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glFogfv_size(pname) );
-
- CALL_Fogfv( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_Fogi(GLbyte * pc)
-{
- CALL_Fogi( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_Fogiv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
- const GLint * params;
-
- params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glFogiv_size(pname) );
-
- CALL_Fogiv( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_FrontFace(GLbyte * pc)
-{
- CALL_FrontFace( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_Hint(GLbyte * pc)
-{
- CALL_Hint( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_Lightf(GLbyte * pc)
-{
- CALL_Lightf( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_Lightfv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLfloat * params;
-
- params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glLightfv_size(pname) );
-
- CALL_Lightfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_Lighti(GLbyte * pc)
-{
- CALL_Lighti( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_Lightiv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLint * params;
-
- params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glLightiv_size(pname) );
-
- CALL_Lightiv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_LightModelf(GLbyte * pc)
-{
- CALL_LightModelf( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_LightModelfv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
- const GLfloat * params;
-
- params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glLightModelfv_size(pname) );
-
- CALL_LightModelfv( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_LightModeli(GLbyte * pc)
-{
- CALL_LightModeli( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_LightModeliv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
- const GLint * params;
-
- params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glLightModeliv_size(pname) );
-
- CALL_LightModeliv( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_LineStipple(GLbyte * pc)
-{
- CALL_LineStipple( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 0 ),
- (GLushort)bswap_CARD16 ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_LineWidth(GLbyte * pc)
-{
- CALL_LineWidth( GET_DISPATCH(), (
- (GLfloat )bswap_FLOAT32( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_Materialf(GLbyte * pc)
-{
- CALL_Materialf( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_Materialfv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLfloat * params;
-
- params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glMaterialfv_size(pname) );
-
- CALL_Materialfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_Materiali(GLbyte * pc)
-{
- CALL_Materiali( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_Materialiv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLint * params;
-
- params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glMaterialiv_size(pname) );
-
- CALL_Materialiv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_PointSize(GLbyte * pc)
-{
- CALL_PointSize( GET_DISPATCH(), (
- (GLfloat )bswap_FLOAT32( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_PolygonMode(GLbyte * pc)
-{
- CALL_PolygonMode( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_PolygonStipple(GLbyte * pc)
-{
- const GLubyte * const mask = (const GLubyte *) (pc + 20);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_PolygonStipple( GET_DISPATCH(), (
- mask
- ) );
-}
-
-void __glXDispSwap_Scissor(GLbyte * pc)
-{
- CALL_Scissor( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLsizei )bswap_CARD32 ( pc + 8 ),
- (GLsizei )bswap_CARD32 ( pc + 12 )
- ) );
-}
-
-void __glXDispSwap_ShadeModel(GLbyte * pc)
-{
- CALL_ShadeModel( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_TexParameterf(GLbyte * pc)
-{
- CALL_TexParameterf( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_TexParameterfv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLfloat * params;
-
- params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexParameterfv_size(pname) );
-
- CALL_TexParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_TexParameteri(GLbyte * pc)
-{
- CALL_TexParameteri( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_TexParameteriv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLint * params;
-
- params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexParameteriv_size(pname) );
-
- CALL_TexParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_TexImage1D(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 52);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_TexImage1D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 20 ),
- (GLint )bswap_CARD32 ( pc + 24 ),
- (GLint )bswap_CARD32 ( pc + 28 ),
- (GLsizei )bswap_CARD32 ( pc + 32 ),
- (GLint )bswap_CARD32 ( pc + 40 ),
- (GLenum )bswap_ENUM ( pc + 44 ),
- (GLenum )bswap_ENUM ( pc + 48 ),
- pixels
- ) );
-}
-
-void __glXDispSwap_TexImage2D(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 52);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_TexImage2D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 20 ),
- (GLint )bswap_CARD32 ( pc + 24 ),
- (GLint )bswap_CARD32 ( pc + 28 ),
- (GLsizei )bswap_CARD32 ( pc + 32 ),
- (GLsizei )bswap_CARD32 ( pc + 36 ),
- (GLint )bswap_CARD32 ( pc + 40 ),
- (GLenum )bswap_ENUM ( pc + 44 ),
- (GLenum )bswap_ENUM ( pc + 48 ),
- pixels
- ) );
-}
-
-void __glXDispSwap_TexEnvf(GLbyte * pc)
-{
- CALL_TexEnvf( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_TexEnvfv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLfloat * params;
-
- params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexEnvfv_size(pname) );
-
- CALL_TexEnvfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_TexEnvi(GLbyte * pc)
-{
- CALL_TexEnvi( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_TexEnviv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLint * params;
-
- params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexEnviv_size(pname) );
-
- CALL_TexEnviv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_TexGend(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_TexGend( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLenum )bswap_ENUM ( pc + 12 ),
- (GLdouble)bswap_FLOAT64( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_TexGendv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLdouble * params;
-
-#ifdef __GLX_ALIGN64
- const GLuint compsize = __glTexGendv_size(pname);
- const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- params = (const GLdouble *) bswap_64_array( (uint64_t *) (pc + 8), __glTexGendv_size(pname) );
-
- CALL_TexGendv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_TexGenf(GLbyte * pc)
-{
- CALL_TexGenf( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_TexGenfv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLfloat * params;
-
- params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexGenfv_size(pname) );
-
- CALL_TexGenfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_TexGeni(GLbyte * pc)
-{
- CALL_TexGeni( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_TexGeniv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLint * params;
-
- params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexGeniv_size(pname) );
-
- CALL_TexGeniv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_InitNames(GLbyte * pc)
-{
- CALL_InitNames( GET_DISPATCH(), () );
-}
-
-void __glXDispSwap_LoadName(GLbyte * pc)
-{
- CALL_LoadName( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_PassThrough(GLbyte * pc)
-{
- CALL_PassThrough( GET_DISPATCH(), (
- (GLfloat )bswap_FLOAT32( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_PopName(GLbyte * pc)
-{
- CALL_PopName( GET_DISPATCH(), () );
-}
-
-void __glXDispSwap_PushName(GLbyte * pc)
-{
- CALL_PushName( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_DrawBuffer(GLbyte * pc)
-{
- CALL_DrawBuffer( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_Clear(GLbyte * pc)
-{
- CALL_Clear( GET_DISPATCH(), (
- (GLbitfield)bswap_CARD32 ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_ClearAccum(GLbyte * pc)
-{
- CALL_ClearAccum( GET_DISPATCH(), (
- (GLfloat )bswap_FLOAT32( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 ),
- (GLfloat )bswap_FLOAT32( pc + 12 )
- ) );
-}
-
-void __glXDispSwap_ClearIndex(GLbyte * pc)
-{
- CALL_ClearIndex( GET_DISPATCH(), (
- (GLfloat )bswap_FLOAT32( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_ClearColor(GLbyte * pc)
-{
- CALL_ClearColor( GET_DISPATCH(), (
- (GLclampf)bswap_FLOAT32( pc + 0 ),
- (GLclampf)bswap_FLOAT32( pc + 4 ),
- (GLclampf)bswap_FLOAT32( pc + 8 ),
- (GLclampf)bswap_FLOAT32( pc + 12 )
- ) );
-}
-
-void __glXDispSwap_ClearStencil(GLbyte * pc)
-{
- CALL_ClearStencil( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_ClearDepth(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 8);
- pc -= 4;
- }
-#endif
-
- CALL_ClearDepth( GET_DISPATCH(), (
- (GLclampd)bswap_FLOAT64( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_StencilMask(GLbyte * pc)
-{
- CALL_StencilMask( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_ColorMask(GLbyte * pc)
-{
- CALL_ColorMask( GET_DISPATCH(), (
- *(GLboolean *)(pc + 0),
- *(GLboolean *)(pc + 1),
- *(GLboolean *)(pc + 2),
- *(GLboolean *)(pc + 3)
- ) );
-}
-
-void __glXDispSwap_DepthMask(GLbyte * pc)
-{
- CALL_DepthMask( GET_DISPATCH(), (
- *(GLboolean *)(pc + 0)
- ) );
-}
-
-void __glXDispSwap_IndexMask(GLbyte * pc)
-{
- CALL_IndexMask( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_Accum(GLbyte * pc)
-{
- CALL_Accum( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_Disable(GLbyte * pc)
-{
- CALL_Disable( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_Enable(GLbyte * pc)
-{
- CALL_Enable( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_PopAttrib(GLbyte * pc)
-{
- CALL_PopAttrib( GET_DISPATCH(), () );
-}
-
-void __glXDispSwap_PushAttrib(GLbyte * pc)
-{
- CALL_PushAttrib( GET_DISPATCH(), (
- (GLbitfield)bswap_CARD32 ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_MapGrid1d(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 20);
- pc -= 4;
- }
-#endif
-
- CALL_MapGrid1d( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 16 ),
- (GLdouble)bswap_FLOAT64( pc + 0 ),
- (GLdouble)bswap_FLOAT64( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_MapGrid1f(GLbyte * pc)
-{
- CALL_MapGrid1f( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_MapGrid2d(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 40);
- pc -= 4;
- }
-#endif
-
- CALL_MapGrid2d( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 32 ),
- (GLdouble)bswap_FLOAT64( pc + 0 ),
- (GLdouble)bswap_FLOAT64( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 36 ),
- (GLdouble)bswap_FLOAT64( pc + 16 ),
- (GLdouble)bswap_FLOAT64( pc + 24 )
- ) );
-}
-
-void __glXDispSwap_MapGrid2f(GLbyte * pc)
-{
- CALL_MapGrid2f( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLfloat )bswap_FLOAT32( pc + 16 ),
- (GLfloat )bswap_FLOAT32( pc + 20 )
- ) );
-}
-
-void __glXDispSwap_EvalCoord1dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 8);
- pc -= 4;
- }
-#endif
-
- CALL_EvalCoord1dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_EvalCoord1fv(GLbyte * pc)
-{
- CALL_EvalCoord1fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_EvalCoord2dv(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_EvalCoord2dv( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_EvalCoord2fv(GLbyte * pc)
-{
- CALL_EvalCoord2fv( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_EvalMesh1(GLbyte * pc)
-{
- CALL_EvalMesh1( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_EvalPoint1(GLbyte * pc)
-{
- CALL_EvalPoint1( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_EvalMesh2(GLbyte * pc)
-{
- CALL_EvalMesh2( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 )
- ) );
-}
-
-void __glXDispSwap_EvalPoint2(GLbyte * pc)
-{
- CALL_EvalPoint2( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_AlphaFunc(GLbyte * pc)
-{
- CALL_AlphaFunc( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLclampf)bswap_FLOAT32( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_BlendFunc(GLbyte * pc)
-{
- CALL_BlendFunc( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_LogicOp(GLbyte * pc)
-{
- CALL_LogicOp( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_StencilFunc(GLbyte * pc)
-{
- CALL_StencilFunc( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLuint )bswap_CARD32 ( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_StencilOp(GLbyte * pc)
-{
- CALL_StencilOp( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_DepthFunc(GLbyte * pc)
-{
- CALL_DepthFunc( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_PixelZoom(GLbyte * pc)
-{
- CALL_PixelZoom( GET_DISPATCH(), (
- (GLfloat )bswap_FLOAT32( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_PixelTransferf(GLbyte * pc)
-{
- CALL_PixelTransferf( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_PixelTransferi(GLbyte * pc)
-{
- CALL_PixelTransferi( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 )
- ) );
-}
-
-int __glXDispSwap_PixelStoref(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- CALL_PixelStoref( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 )
- ) );
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_PixelStorei(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- CALL_PixelStorei( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 )
- ) );
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_PixelMapfv(GLbyte * pc)
-{
- const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_PixelMapfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- mapsize,
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_PixelMapuiv(GLbyte * pc)
-{
- const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_PixelMapuiv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- mapsize,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_PixelMapusv(GLbyte * pc)
-{
- const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_PixelMapusv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- mapsize,
- (const GLushort *)bswap_16_array( (uint16_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_ReadBuffer(GLbyte * pc)
-{
- CALL_ReadBuffer( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_CopyPixels(GLbyte * pc)
-{
- CALL_CopyPixels( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLsizei )bswap_CARD32 ( pc + 8 ),
- (GLsizei )bswap_CARD32 ( pc + 12 ),
- (GLenum )bswap_ENUM ( pc + 16 )
- ) );
-}
-
-void __glXDispSwap_DrawPixels(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 36);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_DrawPixels( GET_DISPATCH(), (
- (GLsizei )bswap_CARD32 ( pc + 20 ),
- (GLsizei )bswap_CARD32 ( pc + 24 ),
- (GLenum )bswap_ENUM ( pc + 28 ),
- (GLenum )bswap_ENUM ( pc + 32 ),
- pixels
- ) );
-}
-
-int __glXDispSwap_GetBooleanv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
-
- const GLuint compsize = __glGetBooleanv_size(pname);
- GLboolean answerBuffer[200];
- GLboolean * params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetBooleanv( GET_DISPATCH(), (
- pname,
- params
- ) );
- __glXSendReplySwap(cl->client, params, compsize, 1, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLdouble equation[4];
- CALL_GetClipPlane( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- equation
- ) );
- (void) bswap_64_array( (uint64_t *) equation, 4 );
- __glXSendReplySwap(cl->client, equation, 4, 8, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetDoublev(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
-
- const GLuint compsize = __glGetDoublev_size(pname);
- GLdouble answerBuffer[200];
- GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetDoublev( GET_DISPATCH(), (
- pname,
- params
- ) );
- (void) bswap_64_array( (uint64_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetError(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLenum retval;
- retval = CALL_GetError( GET_DISPATCH(), () );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetFloatv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
-
- const GLuint compsize = __glGetFloatv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetFloatv( GET_DISPATCH(), (
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetIntegerv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
-
- const GLuint compsize = __glGetIntegerv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetIntegerv( GET_DISPATCH(), (
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetLightfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetLightfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetLightfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetLightiv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetLightiv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetLightiv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum target = (GLenum )bswap_ENUM ( pc + 0 );
- const GLenum query = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetMapdv_size(target,query);
- GLdouble answerBuffer[200];
- GLdouble * v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
-
- if (v == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMapdv( GET_DISPATCH(), (
- target,
- query,
- v
- ) );
- (void) bswap_64_array( (uint64_t *) v, compsize );
- __glXSendReplySwap(cl->client, v, compsize, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum target = (GLenum )bswap_ENUM ( pc + 0 );
- const GLenum query = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetMapfv_size(target,query);
- GLfloat answerBuffer[200];
- GLfloat * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (v == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMapfv( GET_DISPATCH(), (
- target,
- query,
- v
- ) );
- (void) bswap_32_array( (uint32_t *) v, compsize );
- __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum target = (GLenum )bswap_ENUM ( pc + 0 );
- const GLenum query = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetMapiv_size(target,query);
- GLint answerBuffer[200];
- GLint * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (v == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMapiv( GET_DISPATCH(), (
- target,
- query,
- v
- ) );
- (void) bswap_32_array( (uint32_t *) v, compsize );
- __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetMaterialfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetMaterialfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMaterialfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetMaterialiv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetMaterialiv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMaterialiv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum map = (GLenum )bswap_ENUM ( pc + 0 );
-
- const GLuint compsize = __glGetPixelMapfv_size(map);
- GLfloat answerBuffer[200];
- GLfloat * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (values == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetPixelMapfv( GET_DISPATCH(), (
- map,
- values
- ) );
- (void) bswap_32_array( (uint32_t *) values, compsize );
- __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum map = (GLenum )bswap_ENUM ( pc + 0 );
-
- const GLuint compsize = __glGetPixelMapuiv_size(map);
- GLuint answerBuffer[200];
- GLuint * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (values == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetPixelMapuiv( GET_DISPATCH(), (
- map,
- values
- ) );
- (void) bswap_32_array( (uint32_t *) values, compsize );
- __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum map = (GLenum )bswap_ENUM ( pc + 0 );
-
- const GLuint compsize = __glGetPixelMapusv_size(map);
- GLushort answerBuffer[200];
- GLushort * values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2);
-
- if (values == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetPixelMapusv( GET_DISPATCH(), (
- map,
- values
- ) );
- (void) bswap_16_array( (uint16_t *) values, compsize );
- __glXSendReplySwap(cl->client, values, compsize, 2, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetTexEnvfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexEnvfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetTexEnviv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetTexEnviv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexEnviv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetTexGendv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetTexGendv_size(pname);
- GLdouble answerBuffer[200];
- GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexGendv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_64_array( (uint64_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetTexGenfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetTexGenfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexGenfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetTexGeniv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetTexGeniv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexGeniv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetTexParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetTexParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 8 );
-
- const GLuint compsize = __glGetTexLevelParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexLevelParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 8 );
-
- const GLuint compsize = __glGetTexLevelParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetTexLevelParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_IsEnabled(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsEnabled( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_IsList(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsList( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_DepthRange(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 16);
- pc -= 4;
- }
-#endif
-
- CALL_DepthRange( GET_DISPATCH(), (
- (GLclampd)bswap_FLOAT64( pc + 0 ),
- (GLclampd)bswap_FLOAT64( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_Frustum(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 48);
- pc -= 4;
- }
-#endif
-
- CALL_Frustum( GET_DISPATCH(), (
- (GLdouble)bswap_FLOAT64( pc + 0 ),
- (GLdouble)bswap_FLOAT64( pc + 8 ),
- (GLdouble)bswap_FLOAT64( pc + 16 ),
- (GLdouble)bswap_FLOAT64( pc + 24 ),
- (GLdouble)bswap_FLOAT64( pc + 32 ),
- (GLdouble)bswap_FLOAT64( pc + 40 )
- ) );
-}
-
-void __glXDispSwap_LoadIdentity(GLbyte * pc)
-{
- CALL_LoadIdentity( GET_DISPATCH(), () );
-}
-
-void __glXDispSwap_LoadMatrixf(GLbyte * pc)
-{
- CALL_LoadMatrixf( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 16 )
- ) );
-}
-
-void __glXDispSwap_LoadMatrixd(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 128);
- pc -= 4;
- }
-#endif
-
- CALL_LoadMatrixd( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 16 )
- ) );
-}
-
-void __glXDispSwap_MatrixMode(GLbyte * pc)
-{
- CALL_MatrixMode( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_MultMatrixf(GLbyte * pc)
-{
- CALL_MultMatrixf( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 16 )
- ) );
-}
-
-void __glXDispSwap_MultMatrixd(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 128);
- pc -= 4;
- }
-#endif
-
- CALL_MultMatrixd( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 16 )
- ) );
-}
-
-void __glXDispSwap_Ortho(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 48);
- pc -= 4;
- }
-#endif
-
- CALL_Ortho( GET_DISPATCH(), (
- (GLdouble)bswap_FLOAT64( pc + 0 ),
- (GLdouble)bswap_FLOAT64( pc + 8 ),
- (GLdouble)bswap_FLOAT64( pc + 16 ),
- (GLdouble)bswap_FLOAT64( pc + 24 ),
- (GLdouble)bswap_FLOAT64( pc + 32 ),
- (GLdouble)bswap_FLOAT64( pc + 40 )
- ) );
-}
-
-void __glXDispSwap_PopMatrix(GLbyte * pc)
-{
- CALL_PopMatrix( GET_DISPATCH(), () );
-}
-
-void __glXDispSwap_PushMatrix(GLbyte * pc)
-{
- CALL_PushMatrix( GET_DISPATCH(), () );
-}
-
-void __glXDispSwap_Rotated(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 32);
- pc -= 4;
- }
-#endif
-
- CALL_Rotated( GET_DISPATCH(), (
- (GLdouble)bswap_FLOAT64( pc + 0 ),
- (GLdouble)bswap_FLOAT64( pc + 8 ),
- (GLdouble)bswap_FLOAT64( pc + 16 ),
- (GLdouble)bswap_FLOAT64( pc + 24 )
- ) );
-}
-
-void __glXDispSwap_Rotatef(GLbyte * pc)
-{
- CALL_Rotatef( GET_DISPATCH(), (
- (GLfloat )bswap_FLOAT32( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 ),
- (GLfloat )bswap_FLOAT32( pc + 12 )
- ) );
-}
-
-void __glXDispSwap_Scaled(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_Scaled( GET_DISPATCH(), (
- (GLdouble)bswap_FLOAT64( pc + 0 ),
- (GLdouble)bswap_FLOAT64( pc + 8 ),
- (GLdouble)bswap_FLOAT64( pc + 16 )
- ) );
-}
-
-void __glXDispSwap_Scalef(GLbyte * pc)
-{
- CALL_Scalef( GET_DISPATCH(), (
- (GLfloat )bswap_FLOAT32( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_Translated(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_Translated( GET_DISPATCH(), (
- (GLdouble)bswap_FLOAT64( pc + 0 ),
- (GLdouble)bswap_FLOAT64( pc + 8 ),
- (GLdouble)bswap_FLOAT64( pc + 16 )
- ) );
-}
-
-void __glXDispSwap_Translatef(GLbyte * pc)
-{
- CALL_Translatef( GET_DISPATCH(), (
- (GLfloat )bswap_FLOAT32( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_Viewport(GLbyte * pc)
-{
- CALL_Viewport( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLsizei )bswap_CARD32 ( pc + 8 ),
- (GLsizei )bswap_CARD32 ( pc + 12 )
- ) );
-}
-
-void __glXDispSwap_BindTexture(GLbyte * pc)
-{
- CALL_BindTexture( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_Indexubv(GLbyte * pc)
-{
- CALL_Indexubv( GET_DISPATCH(), (
- (const GLubyte *)(pc + 0)
- ) );
-}
-
-void __glXDispSwap_PolygonOffset(GLbyte * pc)
-{
- CALL_PolygonOffset( GET_DISPATCH(), (
- (GLfloat )bswap_FLOAT32( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 )
- ) );
-}
-
-int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- GLboolean retval;
- GLboolean answerBuffer[200];
- GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
- retval = CALL_AreTexturesResident( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ),
- residences
- ) );
- __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- GLboolean retval;
- GLboolean answerBuffer[200];
- GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
- retval = CALL_AreTexturesResident( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ),
- residences
- ) );
- __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_CopyTexImage1D(GLbyte * pc)
-{
- CALL_CopyTexImage1D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 ),
- (GLsizei )bswap_CARD32 ( pc + 20 ),
- (GLint )bswap_CARD32 ( pc + 24 )
- ) );
-}
-
-void __glXDispSwap_CopyTexImage2D(GLbyte * pc)
-{
- CALL_CopyTexImage2D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 ),
- (GLsizei )bswap_CARD32 ( pc + 20 ),
- (GLsizei )bswap_CARD32 ( pc + 24 ),
- (GLint )bswap_CARD32 ( pc + 28 )
- ) );
-}
-
-void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc)
-{
- CALL_CopyTexSubImage1D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 ),
- (GLsizei )bswap_CARD32 ( pc + 20 )
- ) );
-}
-
-void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc)
-{
- CALL_CopyTexSubImage2D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 ),
- (GLint )bswap_CARD32 ( pc + 20 ),
- (GLsizei )bswap_CARD32 ( pc + 24 ),
- (GLsizei )bswap_CARD32 ( pc + 28 )
- ) );
-}
-
-int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- CALL_DeleteTextures( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
- ) );
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- CALL_DeleteTextures( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
- ) );
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- GLuint answerBuffer[200];
- GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenTextures( GET_DISPATCH(), (
- n,
- textures
- ) );
- (void) bswap_32_array( (uint32_t *) textures, n );
- __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- GLuint answerBuffer[200];
- GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenTextures( GET_DISPATCH(), (
- n,
- textures
- ) );
- (void) bswap_32_array( (uint32_t *) textures, n );
- __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsTexture( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsTexture( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_PrioritizeTextures(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- CALL_PrioritizeTextures( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ),
- (const GLclampf *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
- ) );
-}
-
-void __glXDispSwap_TexSubImage1D(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 56);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_TexSubImage1D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 20 ),
- (GLint )bswap_CARD32 ( pc + 24 ),
- (GLint )bswap_CARD32 ( pc + 28 ),
- (GLsizei )bswap_CARD32 ( pc + 36 ),
- (GLenum )bswap_ENUM ( pc + 44 ),
- (GLenum )bswap_ENUM ( pc + 48 ),
- pixels
- ) );
-}
-
-void __glXDispSwap_TexSubImage2D(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 56);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_TexSubImage2D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 20 ),
- (GLint )bswap_CARD32 ( pc + 24 ),
- (GLint )bswap_CARD32 ( pc + 28 ),
- (GLint )bswap_CARD32 ( pc + 32 ),
- (GLsizei )bswap_CARD32 ( pc + 36 ),
- (GLsizei )bswap_CARD32 ( pc + 40 ),
- (GLenum )bswap_ENUM ( pc + 44 ),
- (GLenum )bswap_ENUM ( pc + 48 ),
- pixels
- ) );
-}
-
-void __glXDispSwap_BlendColor(GLbyte * pc)
-{
- CALL_BlendColor( GET_DISPATCH(), (
- (GLclampf)bswap_FLOAT32( pc + 0 ),
- (GLclampf)bswap_FLOAT32( pc + 4 ),
- (GLclampf)bswap_FLOAT32( pc + 8 ),
- (GLclampf)bswap_FLOAT32( pc + 12 )
- ) );
-}
-
-void __glXDispSwap_BlendEquation(GLbyte * pc)
-{
- CALL_BlendEquation( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_ColorTable(GLbyte * pc)
-{
- const GLvoid * const table = (const GLvoid *) (pc + 40);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_ColorTable( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 20 ),
- (GLenum )bswap_ENUM ( pc + 24 ),
- (GLsizei )bswap_CARD32 ( pc + 28 ),
- (GLenum )bswap_ENUM ( pc + 32 ),
- (GLenum )bswap_ENUM ( pc + 36 ),
- table
- ) );
-}
-
-void __glXDispSwap_ColorTableParameterfv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLfloat * params;
-
- params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glColorTableParameterfv_size(pname) );
-
- CALL_ColorTableParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_ColorTableParameteriv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLint * params;
-
- params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glColorTableParameteriv_size(pname) );
-
- CALL_ColorTableParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_CopyColorTable(GLbyte * pc)
-{
- CALL_CopyColorTable( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLsizei )bswap_CARD32 ( pc + 16 )
- ) );
-}
-
-int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetColorTableParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetColorTableParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetColorTableParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetColorTableParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetColorTableParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetColorTableParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetColorTableParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetColorTableParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_ColorSubTable(GLbyte * pc)
-{
- const GLvoid * const data = (const GLvoid *) (pc + 40);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_ColorSubTable( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 20 ),
- (GLsizei )bswap_CARD32 ( pc + 24 ),
- (GLsizei )bswap_CARD32 ( pc + 28 ),
- (GLenum )bswap_ENUM ( pc + 32 ),
- (GLenum )bswap_ENUM ( pc + 36 ),
- data
- ) );
-}
-
-void __glXDispSwap_CopyColorSubTable(GLbyte * pc)
-{
- CALL_CopyColorSubTable( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLsizei )bswap_CARD32 ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLsizei )bswap_CARD32 ( pc + 16 )
- ) );
-}
-
-void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc)
-{
- const GLvoid * const image = (const GLvoid *) (pc + 44);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_ConvolutionFilter1D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 20 ),
- (GLenum )bswap_ENUM ( pc + 24 ),
- (GLsizei )bswap_CARD32 ( pc + 28 ),
- (GLenum )bswap_ENUM ( pc + 36 ),
- (GLenum )bswap_ENUM ( pc + 40 ),
- image
- ) );
-}
-
-void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc)
-{
- const GLvoid * const image = (const GLvoid *) (pc + 44);
- __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_ConvolutionFilter2D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 20 ),
- (GLenum )bswap_ENUM ( pc + 24 ),
- (GLsizei )bswap_CARD32 ( pc + 28 ),
- (GLsizei )bswap_CARD32 ( pc + 32 ),
- (GLenum )bswap_ENUM ( pc + 36 ),
- (GLenum )bswap_ENUM ( pc + 40 ),
- image
- ) );
-}
-
-void __glXDispSwap_ConvolutionParameterf(GLbyte * pc)
-{
- CALL_ConvolutionParameterf( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLfloat )bswap_FLOAT32( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLfloat * params;
-
- params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glConvolutionParameterfv_size(pname) );
-
- CALL_ConvolutionParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_ConvolutionParameteri(GLbyte * pc)
-{
- CALL_ConvolutionParameteri( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 )
- ) );
-}
-
-void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
- const GLint * params;
-
- params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glConvolutionParameteriv_size(pname) );
-
- CALL_ConvolutionParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc)
-{
- CALL_CopyConvolutionFilter1D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLsizei )bswap_CARD32 ( pc + 16 )
- ) );
-}
-
-void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc)
-{
- CALL_CopyConvolutionFilter2D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLsizei )bswap_CARD32 ( pc + 16 ),
- (GLsizei )bswap_CARD32 ( pc + 20 )
- ) );
-}
-
-int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetConvolutionParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetConvolutionParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetConvolutionParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetConvolutionParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetConvolutionParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetConvolutionParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetConvolutionParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetConvolutionParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetHistogramParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetHistogramParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetHistogramParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetHistogramParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetHistogramParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetHistogramParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetHistogramParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetHistogramParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetMinmaxParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMinmaxParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetMinmaxParameterfv_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMinmaxParameterfv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetMinmaxParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMinmaxParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetMinmaxParameteriv_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetMinmaxParameteriv( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_Histogram(GLbyte * pc)
-{
- CALL_Histogram( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLsizei )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- *(GLboolean *)(pc + 12)
- ) );
-}
-
-void __glXDispSwap_Minmax(GLbyte * pc)
-{
- CALL_Minmax( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- *(GLboolean *)(pc + 8)
- ) );
-}
-
-void __glXDispSwap_ResetHistogram(GLbyte * pc)
-{
- CALL_ResetHistogram( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_ResetMinmax(GLbyte * pc)
-{
- CALL_ResetMinmax( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_TexImage3D(GLbyte * pc)
-{
- const CARD32 ptr_is_null = *(CARD32 *)(pc + 76);
- const GLvoid * const pixels = (const GLvoid *) ((ptr_is_null != 0) ? NULL : (pc + 80));
- __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32( & hdr->imageHeight )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32( & hdr->skipImages )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_TexImage3D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 36 ),
- (GLint )bswap_CARD32 ( pc + 40 ),
- (GLint )bswap_CARD32 ( pc + 44 ),
- (GLsizei )bswap_CARD32 ( pc + 48 ),
- (GLsizei )bswap_CARD32 ( pc + 52 ),
- (GLsizei )bswap_CARD32 ( pc + 56 ),
- (GLint )bswap_CARD32 ( pc + 64 ),
- (GLenum )bswap_ENUM ( pc + 68 ),
- (GLenum )bswap_ENUM ( pc + 72 ),
- pixels
- ) );
-}
-
-void __glXDispSwap_TexSubImage3D(GLbyte * pc)
-{
- const GLvoid * const pixels = (const GLvoid *) (pc + 88);
- __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32( & hdr->imageHeight )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32( & hdr->skipImages )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
-
- CALL_TexSubImage3D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 36 ),
- (GLint )bswap_CARD32 ( pc + 40 ),
- (GLint )bswap_CARD32 ( pc + 44 ),
- (GLint )bswap_CARD32 ( pc + 48 ),
- (GLint )bswap_CARD32 ( pc + 52 ),
- (GLsizei )bswap_CARD32 ( pc + 60 ),
- (GLsizei )bswap_CARD32 ( pc + 64 ),
- (GLsizei )bswap_CARD32 ( pc + 68 ),
- (GLenum )bswap_ENUM ( pc + 76 ),
- (GLenum )bswap_ENUM ( pc + 80 ),
- pixels
- ) );
-}
-
-void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc)
-{
- CALL_CopyTexSubImage3D( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 ),
- (GLint )bswap_CARD32 ( pc + 20 ),
- (GLint )bswap_CARD32 ( pc + 24 ),
- (GLsizei )bswap_CARD32 ( pc + 28 ),
- (GLsizei )bswap_CARD32 ( pc + 32 )
- ) );
-}
-
-void __glXDispSwap_ActiveTextureARB(GLbyte * pc)
-{
- CALL_ActiveTextureARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 12);
- pc -= 4;
- }
-#endif
-
- CALL_MultiTexCoord1dvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 8 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc)
-{
- CALL_MultiTexCoord1fvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc)
-{
- CALL_MultiTexCoord1ivARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 1 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc)
-{
- CALL_MultiTexCoord1svARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 20);
- pc -= 4;
- }
-#endif
-
- CALL_MultiTexCoord2dvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 16 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc)
-{
- CALL_MultiTexCoord2fvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc)
-{
- CALL_MultiTexCoord2ivARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 2 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc)
-{
- CALL_MultiTexCoord2svARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 28);
- pc -= 4;
- }
-#endif
-
- CALL_MultiTexCoord3dvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 24 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc)
-{
- CALL_MultiTexCoord3fvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc)
-{
- CALL_MultiTexCoord3ivARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 3 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc)
-{
- CALL_MultiTexCoord3svARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 36);
- pc -= 4;
- }
-#endif
-
- CALL_MultiTexCoord4dvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 32 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc)
-{
- CALL_MultiTexCoord4fvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc)
-{
- CALL_MultiTexCoord4ivARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc)
-{
- CALL_MultiTexCoord4svARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_SampleCoverageARB(GLbyte * pc)
-{
- CALL_SampleCoverageARB( GET_DISPATCH(), (
- (GLclampf)bswap_FLOAT32( pc + 0 ),
- *(GLboolean *)(pc + 4)
- ) );
-}
-
-void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc)
-{
- const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 20 );
-
- CALL_CompressedTexImage1DARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLsizei )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 ),
- imageSize,
- (const GLvoid *)(pc + 24)
- ) );
-}
-
-void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc)
-{
- const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 24 );
-
- CALL_CompressedTexImage2DARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLsizei )bswap_CARD32 ( pc + 12 ),
- (GLsizei )bswap_CARD32 ( pc + 16 ),
- (GLint )bswap_CARD32 ( pc + 20 ),
- imageSize,
- (const GLvoid *)(pc + 28)
- ) );
-}
-
-void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc)
-{
- const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 28 );
-
- CALL_CompressedTexImage3DARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLsizei )bswap_CARD32 ( pc + 12 ),
- (GLsizei )bswap_CARD32 ( pc + 16 ),
- (GLsizei )bswap_CARD32 ( pc + 20 ),
- (GLint )bswap_CARD32 ( pc + 24 ),
- imageSize,
- (const GLvoid *)(pc + 32)
- ) );
-}
-
-void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc)
-{
- const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 20 );
-
- CALL_CompressedTexSubImage1DARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLsizei )bswap_CARD32 ( pc + 12 ),
- (GLenum )bswap_ENUM ( pc + 16 ),
- imageSize,
- (const GLvoid *)(pc + 24)
- ) );
-}
-
-void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc)
-{
- const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 28 );
-
- CALL_CompressedTexSubImage2DARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLsizei )bswap_CARD32 ( pc + 16 ),
- (GLsizei )bswap_CARD32 ( pc + 20 ),
- (GLenum )bswap_ENUM ( pc + 24 ),
- imageSize,
- (const GLvoid *)(pc + 32)
- ) );
-}
-
-void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc)
-{
- const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 36 );
-
- CALL_CompressedTexSubImage3DARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 ),
- (GLsizei )bswap_CARD32 ( pc + 20 ),
- (GLsizei )bswap_CARD32 ( pc + 24 ),
- (GLsizei )bswap_CARD32 ( pc + 28 ),
- (GLenum )bswap_ENUM ( pc + 32 ),
- imageSize,
- (const GLvoid *)(pc + 40)
- ) );
-}
-
-int __glXDispSwap_GetProgramEnvParameterdvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLdouble params[4];
- CALL_GetProgramEnvParameterdvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- params
- ) );
- (void) bswap_64_array( (uint64_t *) params, 4 );
- __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetProgramEnvParameterfvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLfloat params[4];
- CALL_GetProgramEnvParameterfvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, 4 );
- __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetProgramLocalParameterdvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLdouble params[4];
- CALL_GetProgramLocalParameterdvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- params
- ) );
- (void) bswap_64_array( (uint64_t *) params, 4 );
- __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetProgramLocalParameterfvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLfloat params[4];
- CALL_GetProgramLocalParameterfvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, 4 );
- __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetProgramivARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetProgramivARB_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetProgramivARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetVertexAttribdvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetVertexAttribdvARB_size(pname);
- GLdouble answerBuffer[200];
- GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribdvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_64_array( (uint64_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetVertexAttribfvARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetVertexAttribfvARB_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribfvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetVertexAttribivARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetVertexAttribivARB_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribivARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 40);
- pc -= 4;
- }
-#endif
-
- CALL_ProgramEnvParameter4dvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 )
- ) );
-}
-
-void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc)
-{
- CALL_ProgramEnvParameter4fvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 )
- ) );
-}
-
-void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 40);
- pc -= 4;
- }
-#endif
-
- CALL_ProgramLocalParameter4dvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 )
- ) );
-}
-
-void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc)
-{
- CALL_ProgramLocalParameter4fvARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 )
- ) );
-}
-
-void __glXDispSwap_ProgramStringARB(GLbyte * pc)
-{
- const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 8 );
-
- CALL_ProgramStringARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- len,
- (const GLvoid *)(pc + 12)
- ) );
-}
-
-void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 12);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib1dvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 1 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc)
-{
- CALL_VertexAttrib1fvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc)
-{
- CALL_VertexAttrib1svARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 20);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib2dvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 2 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc)
-{
- CALL_VertexAttrib2fvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc)
-{
- CALL_VertexAttrib2svARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 28);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib3dvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 3 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc)
-{
- CALL_VertexAttrib3fvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc)
-{
- CALL_VertexAttrib3svARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NbvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLbyte *)(pc + 4)
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NivARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NsvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NubvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLubyte *)(pc + 4)
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NuivARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4NusvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLushort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4bvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLbyte *)(pc + 4)
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 36);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib4dvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4fvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc)
-{
- CALL_VertexAttrib4ivARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc)
-{
- CALL_VertexAttrib4svARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4ubvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLubyte *)(pc + 4)
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc)
-{
- CALL_VertexAttrib4uivARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc)
-{
- CALL_VertexAttrib4usvARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLushort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_BeginQueryARB(GLbyte * pc)
-{
- CALL_BeginQueryARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 )
- ) );
-}
-
-int __glXDispSwap_DeleteQueriesARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- CALL_DeleteQueriesARB( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
- ) );
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_EndQueryARB(GLbyte * pc)
-{
- CALL_EndQueryARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-int __glXDispSwap_GenQueriesARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- GLuint answerBuffer[200];
- GLuint * ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenQueriesARB( GET_DISPATCH(), (
- n,
- ids
- ) );
- (void) bswap_32_array( (uint32_t *) ids, n );
- __glXSendReplySwap(cl->client, ids, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetQueryObjectivARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetQueryObjectivARB_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetQueryObjectivARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetQueryObjectuivARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetQueryObjectuivARB_size(pname);
- GLuint answerBuffer[200];
- GLuint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetQueryObjectuivARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetQueryivARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetQueryivARB_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetQueryivARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_IsQueryARB(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsQueryARB( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_DrawBuffersARB(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- CALL_DrawBuffersARB( GET_DISPATCH(), (
- n,
- (const GLenum *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
- ) );
-}
-
-void __glXDispSwap_ClampColorARB(GLbyte * pc)
-{
- CALL_ClampColorARB( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_RenderbufferStorageMultisample(GLbyte * pc)
-{
- CALL_RenderbufferStorageMultisample( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLsizei )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLsizei )bswap_CARD32 ( pc + 12 ),
- (GLsizei )bswap_CARD32 ( pc + 16 )
- ) );
-}
-
-void __glXDispSwap_SampleMaskSGIS(GLbyte * pc)
-{
- CALL_SampleMaskSGIS( GET_DISPATCH(), (
- (GLclampf)bswap_FLOAT32( pc + 0 ),
- *(GLboolean *)(pc + 4)
- ) );
-}
-
-void __glXDispSwap_SamplePatternSGIS(GLbyte * pc)
-{
- CALL_SamplePatternSGIS( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-void __glXDispSwap_PointParameterfEXT(GLbyte * pc)
-{
- CALL_PointParameterfEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLfloat )bswap_FLOAT32( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_PointParameterfvEXT(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
- const GLfloat * params;
-
- params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glPointParameterfvEXT_size(pname) );
-
- CALL_PointParameterfvEXT( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3bvEXT( GET_DISPATCH(), (
- (const GLbyte *)(pc + 0)
- ) );
-}
-
-void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 24);
- pc -= 4;
- }
-#endif
-
- CALL_SecondaryColor3dvEXT( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3fvEXT( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3ivEXT( GET_DISPATCH(), (
- (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3svEXT( GET_DISPATCH(), (
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3ubvEXT( GET_DISPATCH(), (
- (const GLubyte *)(pc + 0)
- ) );
-}
-
-void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3uivEXT( GET_DISPATCH(), (
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc)
-{
- CALL_SecondaryColor3usvEXT( GET_DISPATCH(), (
- (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
- ) );
-}
-
-void __glXDispSwap_FogCoorddvEXT(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 8);
- pc -= 4;
- }
-#endif
-
- CALL_FogCoorddvEXT( GET_DISPATCH(), (
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_FogCoordfvEXT(GLbyte * pc)
-{
- CALL_FogCoordfvEXT( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
- ) );
-}
-
-void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc)
-{
- CALL_BlendFuncSeparateEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLenum )bswap_ENUM ( pc + 12 )
- ) );
-}
-
-void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc)
-{
- CALL_WindowPos3fvMESA( GET_DISPATCH(), (
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
- ) );
-}
-
-int __glXDispSwap_AreProgramsResidentNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- GLboolean retval;
- GLboolean answerBuffer[200];
- GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
- retval = CALL_AreProgramsResidentNV( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ),
- residences
- ) );
- __glXSendReplySwap(cl->client, residences, n, 1, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_BindProgramNV(GLbyte * pc)
-{
- CALL_BindProgramNV( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 )
- ) );
-}
-
-int __glXDispSwap_DeleteProgramsNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- CALL_DeleteProgramsNV( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
- ) );
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_ExecuteProgramNV(GLbyte * pc)
-{
- CALL_ExecuteProgramNV( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 )
- ) );
-}
-
-int __glXDispSwap_GenProgramsNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- GLuint answerBuffer[200];
- GLuint * programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenProgramsNV( GET_DISPATCH(), (
- n,
- programs
- ) );
- (void) bswap_32_array( (uint32_t *) programs, n );
- __glXSendReplySwap(cl->client, programs, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetProgramParameterdvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLdouble params[4];
- CALL_GetProgramParameterdvNV( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- params
- ) );
- (void) bswap_64_array( (uint64_t *) params, 4 );
- __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetProgramParameterfvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLfloat params[4];
- CALL_GetProgramParameterfvNV( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, 4 );
- __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetProgramivNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetProgramivNV_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetProgramivNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetTrackMatrixivNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLint params[1];
- CALL_GetTrackMatrixivNV( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, 1 );
- __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetVertexAttribdvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetVertexAttribdvNV_size(pname);
- GLdouble answerBuffer[200];
- GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribdvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_64_array( (uint64_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetVertexAttribfvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetVertexAttribfvNV_size(pname);
- GLfloat answerBuffer[200];
- GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribfvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetVertexAttribivNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
-
- const GLuint compsize = __glGetVertexAttribivNV_size(pname);
- GLint answerBuffer[200];
- GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
-
- if (params == NULL) return BadAlloc;
- __glXClearErrorOccured();
-
- CALL_GetVertexAttribivNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- pname,
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, compsize );
- __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_IsProgramNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsProgramNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_LoadProgramNV(GLbyte * pc)
-{
- const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 8 );
-
- CALL_LoadProgramNV( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- len,
- (const GLubyte *)(pc + 12)
- ) );
-}
-
-void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc)
-{
- const GLsizei num = (GLsizei )bswap_CARD32 ( pc + 8 );
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_ProgramParameters4dvNV( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- num,
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 12), 0 )
- ) );
-}
-
-void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc)
-{
- const GLsizei num = (GLsizei )bswap_CARD32 ( pc + 8 );
-
- CALL_ProgramParameters4fvNV( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- num,
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 12), 0 )
- ) );
-}
-
-void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- CALL_RequestResidentProgramsNV( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
- ) );
-}
-
-void __glXDispSwap_TrackMatrixNV(GLbyte * pc)
-{
- CALL_TrackMatrixNV( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLenum )bswap_ENUM ( pc + 12 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 12);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib1dvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 1 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc)
-{
- CALL_VertexAttrib1fvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc)
-{
- CALL_VertexAttrib1svNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 20);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib2dvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 2 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc)
-{
- CALL_VertexAttrib2fvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc)
-{
- CALL_VertexAttrib2svNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 28);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib3dvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 3 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc)
-{
- CALL_VertexAttrib3fvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc)
-{
- CALL_VertexAttrib3svNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, 36);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttrib4dvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc)
-{
- CALL_VertexAttrib4fvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc)
-{
- CALL_VertexAttrib4svNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
- ) );
-}
-
-void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc)
-{
- CALL_VertexAttrib4ubvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- (const GLubyte *)(pc + 4)
- ) );
-}
-
-void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttribs1dvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_VertexAttribs1fvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_VertexAttribs1svNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttribs2dvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_VertexAttribs2fvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_VertexAttribs2svNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttribs3dvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_VertexAttribs3fvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_VertexAttribs3svNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_VertexAttribs4dvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_VertexAttribs4fvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_VertexAttribs4svNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 )
- ) );
-}
-
-void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_VertexAttribs4ubvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- n,
- (const GLubyte *)(pc + 8)
- ) );
-}
-
-void __glXDispSwap_PointParameteriNV(GLbyte * pc)
-{
- CALL_PointParameteriNV( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_PointParameterivNV(GLbyte * pc)
-{
- const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
- const GLint * params;
-
- params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glPointParameterivNV_size(pname) );
-
- CALL_PointParameterivNV( GET_DISPATCH(), (
- pname,
- params
- ) );
-}
-
-void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc)
-{
- CALL_ActiveStencilFaceEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-int __glXDispSwap_GetProgramNamedParameterdvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- GLdouble params[4];
- CALL_GetProgramNamedParameterdvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- len,
- (const GLubyte *)(pc + 8),
- params
- ) );
- (void) bswap_64_array( (uint64_t *) params, 4 );
- __glXSendReplySwap(cl->client, params, 4, 8, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetProgramNamedParameterfvNV(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- GLfloat params[4];
- CALL_GetProgramNamedParameterfvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- len,
- (const GLubyte *)(pc + 8),
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, 4 );
- __glXSendReplySwap(cl->client, params, 4, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc)
-{
- const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 36 );
-
-#ifdef __GLX_ALIGN64
- const GLuint cmdlen = 44 + __GLX_PAD(len) - 4;
- if ((unsigned long)(pc) & 7) {
- (void) memmove(pc-4, pc, cmdlen);
- pc -= 4;
- }
-#endif
-
- CALL_ProgramNamedParameter4dvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 32 ),
- len,
- (const GLubyte *)(pc + 40),
- (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
- ) );
-}
-
-void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc)
-{
- const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 );
-
- CALL_ProgramNamedParameter4fvNV( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 ),
- len,
- (const GLubyte *)(pc + 24),
- (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 )
- ) );
-}
-
-void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc)
-{
- CALL_BlendEquationSeparateEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_BindFramebufferEXT(GLbyte * pc)
-{
- CALL_BindFramebufferEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 )
- ) );
-}
-
-void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc)
-{
- CALL_BindRenderbufferEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLuint )bswap_CARD32 ( pc + 4 )
- ) );
-}
-
-int __glXDispSwap_CheckFramebufferStatusEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLenum retval;
- retval = CALL_CheckFramebufferStatusEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- CALL_DeleteFramebuffersEXT( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
- ) );
-}
-
-void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc)
-{
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- CALL_DeleteRenderbuffersEXT( GET_DISPATCH(), (
- n,
- (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
- ) );
-}
-
-void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc)
-{
- CALL_FramebufferRenderbufferEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLuint )bswap_CARD32 ( pc + 12 )
- ) );
-}
-
-void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc)
-{
- CALL_FramebufferTexture1DEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLuint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 )
- ) );
-}
-
-void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc)
-{
- CALL_FramebufferTexture2DEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLuint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 )
- ) );
-}
-
-void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc)
-{
- CALL_FramebufferTexture3DEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- (GLuint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 ),
- (GLint )bswap_CARD32 ( pc + 20 )
- ) );
-}
-
-int __glXDispSwap_GenFramebuffersEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- GLuint answerBuffer[200];
- GLuint * framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenFramebuffersEXT( GET_DISPATCH(), (
- n,
- framebuffers
- ) );
- (void) bswap_32_array( (uint32_t *) framebuffers, n );
- __glXSendReplySwap(cl->client, framebuffers, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GenRenderbuffersEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
-
- GLuint answerBuffer[200];
- GLuint * renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
- CALL_GenRenderbuffersEXT( GET_DISPATCH(), (
- n,
- renderbuffers
- ) );
- (void) bswap_32_array( (uint32_t *) renderbuffers, n );
- __glXSendReplySwap(cl->client, renderbuffers, n, 4, GL_TRUE, 0);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc)
-{
- CALL_GenerateMipmapEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 )
- ) );
-}
-
-int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLint params[1];
- CALL_GetFramebufferAttachmentParameterivEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLenum )bswap_ENUM ( pc + 8 ),
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, 1 );
- __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_GetRenderbufferParameterivEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLint params[1];
- CALL_GetRenderbufferParameterivEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- params
- ) );
- (void) bswap_32_array( (uint32_t *) params, 1 );
- __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_IsFramebufferEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsFramebufferEXT( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-int __glXDispSwap_IsRenderbufferEXT(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
- int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
-
- pc += __GLX_VENDPRIV_HDR_SIZE;
- if ( cx != NULL ) {
- GLboolean retval;
- retval = CALL_IsRenderbufferEXT( GET_DISPATCH(), (
- (GLuint )bswap_CARD32 ( pc + 0 )
- ) );
- __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
- error = Success;
- }
-
- return error;
-}
-
-void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc)
-{
- CALL_RenderbufferStorageEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLsizei )bswap_CARD32 ( pc + 8 ),
- (GLsizei )bswap_CARD32 ( pc + 12 )
- ) );
-}
-
-void __glXDispSwap_BlitFramebufferEXT(GLbyte * pc)
-{
- CALL_BlitFramebufferEXT( GET_DISPATCH(), (
- (GLint )bswap_CARD32 ( pc + 0 ),
- (GLint )bswap_CARD32 ( pc + 4 ),
- (GLint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 ),
- (GLint )bswap_CARD32 ( pc + 20 ),
- (GLint )bswap_CARD32 ( pc + 24 ),
- (GLint )bswap_CARD32 ( pc + 28 ),
- (GLbitfield)bswap_CARD32 ( pc + 32 ),
- (GLenum )bswap_ENUM ( pc + 36 )
- ) );
-}
-
-void __glXDispSwap_FramebufferTextureLayerEXT(GLbyte * pc)
-{
- CALL_FramebufferTextureLayerEXT( GET_DISPATCH(), (
- (GLenum )bswap_ENUM ( pc + 0 ),
- (GLenum )bswap_ENUM ( pc + 4 ),
- (GLuint )bswap_CARD32 ( pc + 8 ),
- (GLint )bswap_CARD32 ( pc + 12 ),
- (GLint )bswap_CARD32 ( pc + 16 )
- ) );
-}
-
+/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */
+
+/*
+ * (C) Copyright IBM Corporation 2005
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
+#endif
+
+#include <X11/Xmd.h>
+#include <GL/gl.h>
+#include <GL/glxproto.h>
+#include <inttypes.h>
+#include "indirect_size.h"
+#include "indirect_size_get.h"
+#include "indirect_dispatch.h"
+#include "glxserver.h"
+#include "glxbyteorder.h"
+#include "indirect_util.h"
+#include "singlesize.h"
+#include "glapi.h"
+#include "glapitable.h"
+#include "glthread.h"
+#include "dispatch.h"
+
+#define __GLX_PAD(x) (((x) + 3) & ~3)
+
+typedef struct {
+ __GLX_PIXEL_3D_HDR;
+} __GLXpixel3DHeader;
+
+extern GLboolean __glXErrorOccured( void );
+extern void __glXClearErrorOccured( void );
+
+static const unsigned dummy_answer[2] = {0, 0};
+
+static GLsizei
+bswap_CARD32( const void * src )
+{
+ union { uint32_t dst; GLsizei ret; } x;
+ x.dst = bswap_32( *(uint32_t *) src );
+ return x.ret;
+}
+
+static GLshort
+bswap_CARD16( const void * src )
+{
+ union { uint16_t dst; GLshort ret; } x;
+ x.dst = bswap_16( *(uint16_t *) src );
+ return x.ret;
+}
+
+static GLenum
+bswap_ENUM( const void * src )
+{
+ union { uint32_t dst; GLenum ret; } x;
+ x.dst = bswap_32( *(uint32_t *) src );
+ return x.ret;
+}
+
+static GLsync
+bswap_CARD64( const void * src )
+{
+ union { uint64_t dst; GLsync ret; } x;
+ x.dst = bswap_64( *(uint64_t *) src );
+ return x.ret;
+}
+
+static GLdouble
+bswap_FLOAT64( const void * src )
+{
+ union { uint64_t dst; GLdouble ret; } x;
+ x.dst = bswap_64( *(uint64_t *) src );
+ return x.ret;
+}
+
+static GLfloat
+bswap_FLOAT32( const void * src )
+{
+ union { uint32_t dst; GLfloat ret; } x;
+ x.dst = bswap_32( *(uint32_t *) src );
+ return x.ret;
+}
+
+static void *
+bswap_16_array( uint16_t * src, unsigned count )
+{
+ unsigned i;
+
+ for ( i = 0 ; i < count ; i++ ) {
+ uint16_t temp = bswap_16( src[i] );
+ src[i] = temp;
+ }
+
+ return src;
+}
+
+static void *
+bswap_32_array( uint32_t * src, unsigned count )
+{
+ unsigned i;
+
+ for ( i = 0 ; i < count ; i++ ) {
+ uint32_t temp = bswap_32( src[i] );
+ src[i] = temp;
+ }
+
+ return src;
+}
+
+static void *
+bswap_64_array( uint64_t * src, unsigned count )
+{
+ unsigned i;
+
+ for ( i = 0 ; i < count ; i++ ) {
+ uint64_t temp = bswap_64( src[i] );
+ src[i] = temp;
+ }
+
+ return src;
+}
+
+int __glXDispSwap_NewList(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ CALL_NewList( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 )
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_EndList(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ CALL_EndList( GET_DISPATCH(), () );
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_CallList(GLbyte * pc)
+{
+ CALL_CallList( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_CallLists(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+ const GLenum type = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLvoid * lists;
+
+ switch(type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_2_BYTES:
+ case GL_3_BYTES:
+ case GL_4_BYTES:
+ lists = (const GLvoid *) (pc + 8); break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ lists = (const GLvoid *) bswap_16_array( (uint16_t *) (pc + 8), n ); break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ lists = (const GLvoid *) bswap_32_array( (uint32_t *) (pc + 8), n ); break;
+ default:
+ return;
+ }
+
+ CALL_CallLists( GET_DISPATCH(), (
+ n,
+ type,
+ lists
+ ) );
+}
+
+int __glXDispSwap_DeleteLists(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ CALL_DeleteLists( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (GLsizei )bswap_CARD32 ( pc + 4 )
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GenLists(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLuint retval;
+ retval = CALL_GenLists( GET_DISPATCH(), (
+ (GLsizei )bswap_CARD32 ( pc + 0 )
+ ) );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_ListBase(GLbyte * pc)
+{
+ CALL_ListBase( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_Begin(GLbyte * pc)
+{
+ CALL_Begin( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_Bitmap(GLbyte * pc)
+{
+ const GLubyte * const bitmap = (const GLubyte *) (pc + 44);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_Bitmap( GET_DISPATCH(), (
+ (GLsizei )bswap_CARD32 ( pc + 20 ),
+ (GLsizei )bswap_CARD32 ( pc + 24 ),
+ (GLfloat )bswap_FLOAT32( pc + 28 ),
+ (GLfloat )bswap_FLOAT32( pc + 32 ),
+ (GLfloat )bswap_FLOAT32( pc + 36 ),
+ (GLfloat )bswap_FLOAT32( pc + 40 ),
+ bitmap
+ ) );
+}
+
+void __glXDispSwap_Color3bv(GLbyte * pc)
+{
+ CALL_Color3bv( GET_DISPATCH(), (
+ (const GLbyte *)(pc + 0)
+ ) );
+}
+
+void __glXDispSwap_Color3dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Color3dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Color3fv(GLbyte * pc)
+{
+ CALL_Color3fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Color3iv(GLbyte * pc)
+{
+ CALL_Color3iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Color3sv(GLbyte * pc)
+{
+ CALL_Color3sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Color3ubv(GLbyte * pc)
+{
+ CALL_Color3ubv( GET_DISPATCH(), (
+ (const GLubyte *)(pc + 0)
+ ) );
+}
+
+void __glXDispSwap_Color3uiv(GLbyte * pc)
+{
+ CALL_Color3uiv( GET_DISPATCH(), (
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Color3usv(GLbyte * pc)
+{
+ CALL_Color3usv( GET_DISPATCH(), (
+ (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Color4bv(GLbyte * pc)
+{
+ CALL_Color4bv( GET_DISPATCH(), (
+ (const GLbyte *)(pc + 0)
+ ) );
+}
+
+void __glXDispSwap_Color4dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Color4dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_Color4fv(GLbyte * pc)
+{
+ CALL_Color4fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_Color4iv(GLbyte * pc)
+{
+ CALL_Color4iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_Color4sv(GLbyte * pc)
+{
+ CALL_Color4sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_Color4ubv(GLbyte * pc)
+{
+ CALL_Color4ubv( GET_DISPATCH(), (
+ (const GLubyte *)(pc + 0)
+ ) );
+}
+
+void __glXDispSwap_Color4uiv(GLbyte * pc)
+{
+ CALL_Color4uiv( GET_DISPATCH(), (
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_Color4usv(GLbyte * pc)
+{
+ CALL_Color4usv( GET_DISPATCH(), (
+ (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_EdgeFlagv(GLbyte * pc)
+{
+ CALL_EdgeFlagv( GET_DISPATCH(), (
+ (const GLboolean *)(pc + 0)
+ ) );
+}
+
+void __glXDispSwap_End(GLbyte * pc)
+{
+ CALL_End( GET_DISPATCH(), () );
+}
+
+void __glXDispSwap_Indexdv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Indexdv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_Indexfv(GLbyte * pc)
+{
+ CALL_Indexfv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_Indexiv(GLbyte * pc)
+{
+ CALL_Indexiv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_Indexsv(GLbyte * pc)
+{
+ CALL_Indexsv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_Normal3bv(GLbyte * pc)
+{
+ CALL_Normal3bv( GET_DISPATCH(), (
+ (const GLbyte *)(pc + 0)
+ ) );
+}
+
+void __glXDispSwap_Normal3dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Normal3dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Normal3fv(GLbyte * pc)
+{
+ CALL_Normal3fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Normal3iv(GLbyte * pc)
+{
+ CALL_Normal3iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Normal3sv(GLbyte * pc)
+{
+ CALL_Normal3sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos2dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_RasterPos2dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos2fv(GLbyte * pc)
+{
+ CALL_RasterPos2fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos2iv(GLbyte * pc)
+{
+ CALL_RasterPos2iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos2sv(GLbyte * pc)
+{
+ CALL_RasterPos2sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos3dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_RasterPos3dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos3fv(GLbyte * pc)
+{
+ CALL_RasterPos3fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos3iv(GLbyte * pc)
+{
+ CALL_RasterPos3iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos3sv(GLbyte * pc)
+{
+ CALL_RasterPos3sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos4dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_RasterPos4dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos4fv(GLbyte * pc)
+{
+ CALL_RasterPos4fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos4iv(GLbyte * pc)
+{
+ CALL_RasterPos4iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_RasterPos4sv(GLbyte * pc)
+{
+ CALL_RasterPos4sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_Rectdv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Rectdv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 16), 2 )
+ ) );
+}
+
+void __glXDispSwap_Rectfv(GLbyte * pc)
+{
+ CALL_Rectfv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 2 )
+ ) );
+}
+
+void __glXDispSwap_Rectiv(GLbyte * pc)
+{
+ CALL_Rectiv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ),
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 8), 2 )
+ ) );
+}
+
+void __glXDispSwap_Rectsv(GLbyte * pc)
+{
+ CALL_Rectsv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord1dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+
+ CALL_TexCoord1dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord1fv(GLbyte * pc)
+{
+ CALL_TexCoord1fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord1iv(GLbyte * pc)
+{
+ CALL_TexCoord1iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord1sv(GLbyte * pc)
+{
+ CALL_TexCoord1sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord2dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_TexCoord2dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord2fv(GLbyte * pc)
+{
+ CALL_TexCoord2fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord2iv(GLbyte * pc)
+{
+ CALL_TexCoord2iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord2sv(GLbyte * pc)
+{
+ CALL_TexCoord2sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord3dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_TexCoord3dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord3fv(GLbyte * pc)
+{
+ CALL_TexCoord3fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord3iv(GLbyte * pc)
+{
+ CALL_TexCoord3iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord3sv(GLbyte * pc)
+{
+ CALL_TexCoord3sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord4dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_TexCoord4dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord4fv(GLbyte * pc)
+{
+ CALL_TexCoord4fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord4iv(GLbyte * pc)
+{
+ CALL_TexCoord4iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_TexCoord4sv(GLbyte * pc)
+{
+ CALL_TexCoord4sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_Vertex2dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Vertex2dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_Vertex2fv(GLbyte * pc)
+{
+ CALL_Vertex2fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_Vertex2iv(GLbyte * pc)
+{
+ CALL_Vertex2iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_Vertex2sv(GLbyte * pc)
+{
+ CALL_Vertex2sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_Vertex3dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Vertex3dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Vertex3fv(GLbyte * pc)
+{
+ CALL_Vertex3fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Vertex3iv(GLbyte * pc)
+{
+ CALL_Vertex3iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Vertex3sv(GLbyte * pc)
+{
+ CALL_Vertex3sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_Vertex4dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Vertex4dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_Vertex4fv(GLbyte * pc)
+{
+ CALL_Vertex4fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_Vertex4iv(GLbyte * pc)
+{
+ CALL_Vertex4iv( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_Vertex4sv(GLbyte * pc)
+{
+ CALL_Vertex4sv( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_ClipPlane(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ClipPlane( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 32 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_ColorMaterial(GLbyte * pc)
+{
+ CALL_ColorMaterial( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_CullFace(GLbyte * pc)
+{
+ CALL_CullFace( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_Fogf(GLbyte * pc)
+{
+ CALL_Fogf( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_Fogfv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
+ const GLfloat * params;
+
+ params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glFogfv_size(pname) );
+
+ CALL_Fogfv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_Fogi(GLbyte * pc)
+{
+ CALL_Fogi( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_Fogiv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
+ const GLint * params;
+
+ params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glFogiv_size(pname) );
+
+ CALL_Fogiv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_FrontFace(GLbyte * pc)
+{
+ CALL_FrontFace( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_Hint(GLbyte * pc)
+{
+ CALL_Hint( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_Lightf(GLbyte * pc)
+{
+ CALL_Lightf( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_Lightfv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLfloat * params;
+
+ params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glLightfv_size(pname) );
+
+ CALL_Lightfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_Lighti(GLbyte * pc)
+{
+ CALL_Lighti( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_Lightiv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLint * params;
+
+ params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glLightiv_size(pname) );
+
+ CALL_Lightiv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_LightModelf(GLbyte * pc)
+{
+ CALL_LightModelf( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_LightModelfv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
+ const GLfloat * params;
+
+ params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glLightModelfv_size(pname) );
+
+ CALL_LightModelfv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_LightModeli(GLbyte * pc)
+{
+ CALL_LightModeli( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_LightModeliv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
+ const GLint * params;
+
+ params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glLightModeliv_size(pname) );
+
+ CALL_LightModeliv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_LineStipple(GLbyte * pc)
+{
+ CALL_LineStipple( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 0 ),
+ (GLushort)bswap_CARD16 ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_LineWidth(GLbyte * pc)
+{
+ CALL_LineWidth( GET_DISPATCH(), (
+ (GLfloat )bswap_FLOAT32( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_Materialf(GLbyte * pc)
+{
+ CALL_Materialf( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_Materialfv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLfloat * params;
+
+ params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glMaterialfv_size(pname) );
+
+ CALL_Materialfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_Materiali(GLbyte * pc)
+{
+ CALL_Materiali( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_Materialiv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLint * params;
+
+ params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glMaterialiv_size(pname) );
+
+ CALL_Materialiv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_PointSize(GLbyte * pc)
+{
+ CALL_PointSize( GET_DISPATCH(), (
+ (GLfloat )bswap_FLOAT32( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_PolygonMode(GLbyte * pc)
+{
+ CALL_PolygonMode( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_PolygonStipple(GLbyte * pc)
+{
+ const GLubyte * const mask = (const GLubyte *) (pc + 20);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_PolygonStipple( GET_DISPATCH(), (
+ mask
+ ) );
+}
+
+void __glXDispSwap_Scissor(GLbyte * pc)
+{
+ CALL_Scissor( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLsizei )bswap_CARD32 ( pc + 8 ),
+ (GLsizei )bswap_CARD32 ( pc + 12 )
+ ) );
+}
+
+void __glXDispSwap_ShadeModel(GLbyte * pc)
+{
+ CALL_ShadeModel( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_TexParameterf(GLbyte * pc)
+{
+ CALL_TexParameterf( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_TexParameterfv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLfloat * params;
+
+ params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexParameterfv_size(pname) );
+
+ CALL_TexParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_TexParameteri(GLbyte * pc)
+{
+ CALL_TexParameteri( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_TexParameteriv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLint * params;
+
+ params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexParameteriv_size(pname) );
+
+ CALL_TexParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_TexImage1D(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 52);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_TexImage1D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 20 ),
+ (GLint )bswap_CARD32 ( pc + 24 ),
+ (GLint )bswap_CARD32 ( pc + 28 ),
+ (GLsizei )bswap_CARD32 ( pc + 32 ),
+ (GLint )bswap_CARD32 ( pc + 40 ),
+ (GLenum )bswap_ENUM ( pc + 44 ),
+ (GLenum )bswap_ENUM ( pc + 48 ),
+ pixels
+ ) );
+}
+
+void __glXDispSwap_TexImage2D(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 52);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_TexImage2D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 20 ),
+ (GLint )bswap_CARD32 ( pc + 24 ),
+ (GLint )bswap_CARD32 ( pc + 28 ),
+ (GLsizei )bswap_CARD32 ( pc + 32 ),
+ (GLsizei )bswap_CARD32 ( pc + 36 ),
+ (GLint )bswap_CARD32 ( pc + 40 ),
+ (GLenum )bswap_ENUM ( pc + 44 ),
+ (GLenum )bswap_ENUM ( pc + 48 ),
+ pixels
+ ) );
+}
+
+void __glXDispSwap_TexEnvf(GLbyte * pc)
+{
+ CALL_TexEnvf( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_TexEnvfv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLfloat * params;
+
+ params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexEnvfv_size(pname) );
+
+ CALL_TexEnvfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_TexEnvi(GLbyte * pc)
+{
+ CALL_TexEnvi( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_TexEnviv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLint * params;
+
+ params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexEnviv_size(pname) );
+
+ CALL_TexEnviv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_TexGend(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_TexGend( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLenum )bswap_ENUM ( pc + 12 ),
+ (GLdouble)bswap_FLOAT64( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_TexGendv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLdouble * params;
+
+#ifdef __GLX_ALIGN64
+ const GLuint compsize = __glTexGendv_size(pname);
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ params = (const GLdouble *) bswap_64_array( (uint64_t *) (pc + 8), __glTexGendv_size(pname) );
+
+ CALL_TexGendv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_TexGenf(GLbyte * pc)
+{
+ CALL_TexGenf( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_TexGenfv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLfloat * params;
+
+ params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexGenfv_size(pname) );
+
+ CALL_TexGenfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_TexGeni(GLbyte * pc)
+{
+ CALL_TexGeni( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_TexGeniv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLint * params;
+
+ params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexGeniv_size(pname) );
+
+ CALL_TexGeniv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_InitNames(GLbyte * pc)
+{
+ CALL_InitNames( GET_DISPATCH(), () );
+}
+
+void __glXDispSwap_LoadName(GLbyte * pc)
+{
+ CALL_LoadName( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_PassThrough(GLbyte * pc)
+{
+ CALL_PassThrough( GET_DISPATCH(), (
+ (GLfloat )bswap_FLOAT32( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_PopName(GLbyte * pc)
+{
+ CALL_PopName( GET_DISPATCH(), () );
+}
+
+void __glXDispSwap_PushName(GLbyte * pc)
+{
+ CALL_PushName( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_DrawBuffer(GLbyte * pc)
+{
+ CALL_DrawBuffer( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_Clear(GLbyte * pc)
+{
+ CALL_Clear( GET_DISPATCH(), (
+ (GLbitfield)bswap_CARD32 ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_ClearAccum(GLbyte * pc)
+{
+ CALL_ClearAccum( GET_DISPATCH(), (
+ (GLfloat )bswap_FLOAT32( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 ),
+ (GLfloat )bswap_FLOAT32( pc + 12 )
+ ) );
+}
+
+void __glXDispSwap_ClearIndex(GLbyte * pc)
+{
+ CALL_ClearIndex( GET_DISPATCH(), (
+ (GLfloat )bswap_FLOAT32( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_ClearColor(GLbyte * pc)
+{
+ CALL_ClearColor( GET_DISPATCH(), (
+ (GLclampf)bswap_FLOAT32( pc + 0 ),
+ (GLclampf)bswap_FLOAT32( pc + 4 ),
+ (GLclampf)bswap_FLOAT32( pc + 8 ),
+ (GLclampf)bswap_FLOAT32( pc + 12 )
+ ) );
+}
+
+void __glXDispSwap_ClearStencil(GLbyte * pc)
+{
+ CALL_ClearStencil( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_ClearDepth(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ClearDepth( GET_DISPATCH(), (
+ (GLclampd)bswap_FLOAT64( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_StencilMask(GLbyte * pc)
+{
+ CALL_StencilMask( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_ColorMask(GLbyte * pc)
+{
+ CALL_ColorMask( GET_DISPATCH(), (
+ *(GLboolean *)(pc + 0),
+ *(GLboolean *)(pc + 1),
+ *(GLboolean *)(pc + 2),
+ *(GLboolean *)(pc + 3)
+ ) );
+}
+
+void __glXDispSwap_DepthMask(GLbyte * pc)
+{
+ CALL_DepthMask( GET_DISPATCH(), (
+ *(GLboolean *)(pc + 0)
+ ) );
+}
+
+void __glXDispSwap_IndexMask(GLbyte * pc)
+{
+ CALL_IndexMask( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_Accum(GLbyte * pc)
+{
+ CALL_Accum( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_Disable(GLbyte * pc)
+{
+ CALL_Disable( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_Enable(GLbyte * pc)
+{
+ CALL_Enable( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_PopAttrib(GLbyte * pc)
+{
+ CALL_PopAttrib( GET_DISPATCH(), () );
+}
+
+void __glXDispSwap_PushAttrib(GLbyte * pc)
+{
+ CALL_PushAttrib( GET_DISPATCH(), (
+ (GLbitfield)bswap_CARD32 ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_MapGrid1d(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MapGrid1d( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 16 ),
+ (GLdouble)bswap_FLOAT64( pc + 0 ),
+ (GLdouble)bswap_FLOAT64( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_MapGrid1f(GLbyte * pc)
+{
+ CALL_MapGrid1f( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_MapGrid2d(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 40);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MapGrid2d( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 32 ),
+ (GLdouble)bswap_FLOAT64( pc + 0 ),
+ (GLdouble)bswap_FLOAT64( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 36 ),
+ (GLdouble)bswap_FLOAT64( pc + 16 ),
+ (GLdouble)bswap_FLOAT64( pc + 24 )
+ ) );
+}
+
+void __glXDispSwap_MapGrid2f(GLbyte * pc)
+{
+ CALL_MapGrid2f( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLfloat )bswap_FLOAT32( pc + 16 ),
+ (GLfloat )bswap_FLOAT32( pc + 20 )
+ ) );
+}
+
+void __glXDispSwap_EvalCoord1dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+
+ CALL_EvalCoord1dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_EvalCoord1fv(GLbyte * pc)
+{
+ CALL_EvalCoord1fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_EvalCoord2dv(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_EvalCoord2dv( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_EvalCoord2fv(GLbyte * pc)
+{
+ CALL_EvalCoord2fv( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_EvalMesh1(GLbyte * pc)
+{
+ CALL_EvalMesh1( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_EvalPoint1(GLbyte * pc)
+{
+ CALL_EvalPoint1( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_EvalMesh2(GLbyte * pc)
+{
+ CALL_EvalMesh2( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 )
+ ) );
+}
+
+void __glXDispSwap_EvalPoint2(GLbyte * pc)
+{
+ CALL_EvalPoint2( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_AlphaFunc(GLbyte * pc)
+{
+ CALL_AlphaFunc( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLclampf)bswap_FLOAT32( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_BlendFunc(GLbyte * pc)
+{
+ CALL_BlendFunc( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_LogicOp(GLbyte * pc)
+{
+ CALL_LogicOp( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_StencilFunc(GLbyte * pc)
+{
+ CALL_StencilFunc( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLuint )bswap_CARD32 ( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_StencilOp(GLbyte * pc)
+{
+ CALL_StencilOp( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_DepthFunc(GLbyte * pc)
+{
+ CALL_DepthFunc( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_PixelZoom(GLbyte * pc)
+{
+ CALL_PixelZoom( GET_DISPATCH(), (
+ (GLfloat )bswap_FLOAT32( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_PixelTransferf(GLbyte * pc)
+{
+ CALL_PixelTransferf( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_PixelTransferi(GLbyte * pc)
+{
+ CALL_PixelTransferi( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 )
+ ) );
+}
+
+int __glXDispSwap_PixelStoref(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ CALL_PixelStoref( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 )
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_PixelStorei(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ CALL_PixelStorei( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 )
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_PixelMapfv(GLbyte * pc)
+{
+ const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_PixelMapfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ mapsize,
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_PixelMapuiv(GLbyte * pc)
+{
+ const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_PixelMapuiv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ mapsize,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_PixelMapusv(GLbyte * pc)
+{
+ const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_PixelMapusv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ mapsize,
+ (const GLushort *)bswap_16_array( (uint16_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_ReadBuffer(GLbyte * pc)
+{
+ CALL_ReadBuffer( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_CopyPixels(GLbyte * pc)
+{
+ CALL_CopyPixels( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLsizei )bswap_CARD32 ( pc + 8 ),
+ (GLsizei )bswap_CARD32 ( pc + 12 ),
+ (GLenum )bswap_ENUM ( pc + 16 )
+ ) );
+}
+
+void __glXDispSwap_DrawPixels(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 36);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_DrawPixels( GET_DISPATCH(), (
+ (GLsizei )bswap_CARD32 ( pc + 20 ),
+ (GLsizei )bswap_CARD32 ( pc + 24 ),
+ (GLenum )bswap_ENUM ( pc + 28 ),
+ (GLenum )bswap_ENUM ( pc + 32 ),
+ pixels
+ ) );
+}
+
+int __glXDispSwap_GetBooleanv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
+
+ const GLuint compsize = __glGetBooleanv_size(pname);
+ GLboolean answerBuffer[200];
+ GLboolean * params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetBooleanv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+ __glXSendReplySwap(cl->client, params, compsize, 1, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLdouble equation[4];
+ CALL_GetClipPlane( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ equation
+ ) );
+ (void) bswap_64_array( (uint64_t *) equation, 4 );
+ __glXSendReplySwap(cl->client, equation, 4, 8, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetDoublev(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
+
+ const GLuint compsize = __glGetDoublev_size(pname);
+ GLdouble answerBuffer[200];
+ GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetDoublev( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+ (void) bswap_64_array( (uint64_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetError(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLenum retval;
+ retval = CALL_GetError( GET_DISPATCH(), () );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetFloatv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
+
+ const GLuint compsize = __glGetFloatv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetFloatv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetIntegerv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
+
+ const GLuint compsize = __glGetIntegerv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetIntegerv( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetLightfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetLightfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetLightfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetLightiv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetLightiv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetLightiv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum target = (GLenum )bswap_ENUM ( pc + 0 );
+ const GLenum query = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetMapdv_size(target,query);
+ GLdouble answerBuffer[200];
+ GLdouble * v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
+
+ if (v == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMapdv( GET_DISPATCH(), (
+ target,
+ query,
+ v
+ ) );
+ (void) bswap_64_array( (uint64_t *) v, compsize );
+ __glXSendReplySwap(cl->client, v, compsize, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum target = (GLenum )bswap_ENUM ( pc + 0 );
+ const GLenum query = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetMapfv_size(target,query);
+ GLfloat answerBuffer[200];
+ GLfloat * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (v == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMapfv( GET_DISPATCH(), (
+ target,
+ query,
+ v
+ ) );
+ (void) bswap_32_array( (uint32_t *) v, compsize );
+ __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum target = (GLenum )bswap_ENUM ( pc + 0 );
+ const GLenum query = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetMapiv_size(target,query);
+ GLint answerBuffer[200];
+ GLint * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (v == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMapiv( GET_DISPATCH(), (
+ target,
+ query,
+ v
+ ) );
+ (void) bswap_32_array( (uint32_t *) v, compsize );
+ __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetMaterialfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetMaterialfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMaterialfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetMaterialiv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetMaterialiv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMaterialiv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum map = (GLenum )bswap_ENUM ( pc + 0 );
+
+ const GLuint compsize = __glGetPixelMapfv_size(map);
+ GLfloat answerBuffer[200];
+ GLfloat * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (values == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetPixelMapfv( GET_DISPATCH(), (
+ map,
+ values
+ ) );
+ (void) bswap_32_array( (uint32_t *) values, compsize );
+ __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum map = (GLenum )bswap_ENUM ( pc + 0 );
+
+ const GLuint compsize = __glGetPixelMapuiv_size(map);
+ GLuint answerBuffer[200];
+ GLuint * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (values == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetPixelMapuiv( GET_DISPATCH(), (
+ map,
+ values
+ ) );
+ (void) bswap_32_array( (uint32_t *) values, compsize );
+ __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum map = (GLenum )bswap_ENUM ( pc + 0 );
+
+ const GLuint compsize = __glGetPixelMapusv_size(map);
+ GLushort answerBuffer[200];
+ GLushort * values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2);
+
+ if (values == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetPixelMapusv( GET_DISPATCH(), (
+ map,
+ values
+ ) );
+ (void) bswap_16_array( (uint16_t *) values, compsize );
+ __glXSendReplySwap(cl->client, values, compsize, 2, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetTexEnvfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexEnvfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetTexEnviv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetTexEnviv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexEnviv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetTexGendv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetTexGendv_size(pname);
+ GLdouble answerBuffer[200];
+ GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexGendv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_64_array( (uint64_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetTexGenfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetTexGenfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexGenfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetTexGeniv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetTexGeniv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexGeniv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetTexParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetTexParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 8 );
+
+ const GLuint compsize = __glGetTexLevelParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexLevelParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 8 );
+
+ const GLuint compsize = __glGetTexLevelParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetTexLevelParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_IsEnabled(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsEnabled( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_IsList(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsList( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_DepthRange(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+
+ CALL_DepthRange( GET_DISPATCH(), (
+ (GLclampd)bswap_FLOAT64( pc + 0 ),
+ (GLclampd)bswap_FLOAT64( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_Frustum(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 48);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Frustum( GET_DISPATCH(), (
+ (GLdouble)bswap_FLOAT64( pc + 0 ),
+ (GLdouble)bswap_FLOAT64( pc + 8 ),
+ (GLdouble)bswap_FLOAT64( pc + 16 ),
+ (GLdouble)bswap_FLOAT64( pc + 24 ),
+ (GLdouble)bswap_FLOAT64( pc + 32 ),
+ (GLdouble)bswap_FLOAT64( pc + 40 )
+ ) );
+}
+
+void __glXDispSwap_LoadIdentity(GLbyte * pc)
+{
+ CALL_LoadIdentity( GET_DISPATCH(), () );
+}
+
+void __glXDispSwap_LoadMatrixf(GLbyte * pc)
+{
+ CALL_LoadMatrixf( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 16 )
+ ) );
+}
+
+void __glXDispSwap_LoadMatrixd(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 128);
+ pc -= 4;
+ }
+#endif
+
+ CALL_LoadMatrixd( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 16 )
+ ) );
+}
+
+void __glXDispSwap_MatrixMode(GLbyte * pc)
+{
+ CALL_MatrixMode( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_MultMatrixf(GLbyte * pc)
+{
+ CALL_MultMatrixf( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 16 )
+ ) );
+}
+
+void __glXDispSwap_MultMatrixd(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 128);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MultMatrixd( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 16 )
+ ) );
+}
+
+void __glXDispSwap_Ortho(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 48);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Ortho( GET_DISPATCH(), (
+ (GLdouble)bswap_FLOAT64( pc + 0 ),
+ (GLdouble)bswap_FLOAT64( pc + 8 ),
+ (GLdouble)bswap_FLOAT64( pc + 16 ),
+ (GLdouble)bswap_FLOAT64( pc + 24 ),
+ (GLdouble)bswap_FLOAT64( pc + 32 ),
+ (GLdouble)bswap_FLOAT64( pc + 40 )
+ ) );
+}
+
+void __glXDispSwap_PopMatrix(GLbyte * pc)
+{
+ CALL_PopMatrix( GET_DISPATCH(), () );
+}
+
+void __glXDispSwap_PushMatrix(GLbyte * pc)
+{
+ CALL_PushMatrix( GET_DISPATCH(), () );
+}
+
+void __glXDispSwap_Rotated(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Rotated( GET_DISPATCH(), (
+ (GLdouble)bswap_FLOAT64( pc + 0 ),
+ (GLdouble)bswap_FLOAT64( pc + 8 ),
+ (GLdouble)bswap_FLOAT64( pc + 16 ),
+ (GLdouble)bswap_FLOAT64( pc + 24 )
+ ) );
+}
+
+void __glXDispSwap_Rotatef(GLbyte * pc)
+{
+ CALL_Rotatef( GET_DISPATCH(), (
+ (GLfloat )bswap_FLOAT32( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 ),
+ (GLfloat )bswap_FLOAT32( pc + 12 )
+ ) );
+}
+
+void __glXDispSwap_Scaled(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Scaled( GET_DISPATCH(), (
+ (GLdouble)bswap_FLOAT64( pc + 0 ),
+ (GLdouble)bswap_FLOAT64( pc + 8 ),
+ (GLdouble)bswap_FLOAT64( pc + 16 )
+ ) );
+}
+
+void __glXDispSwap_Scalef(GLbyte * pc)
+{
+ CALL_Scalef( GET_DISPATCH(), (
+ (GLfloat )bswap_FLOAT32( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_Translated(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_Translated( GET_DISPATCH(), (
+ (GLdouble)bswap_FLOAT64( pc + 0 ),
+ (GLdouble)bswap_FLOAT64( pc + 8 ),
+ (GLdouble)bswap_FLOAT64( pc + 16 )
+ ) );
+}
+
+void __glXDispSwap_Translatef(GLbyte * pc)
+{
+ CALL_Translatef( GET_DISPATCH(), (
+ (GLfloat )bswap_FLOAT32( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_Viewport(GLbyte * pc)
+{
+ CALL_Viewport( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLsizei )bswap_CARD32 ( pc + 8 ),
+ (GLsizei )bswap_CARD32 ( pc + 12 )
+ ) );
+}
+
+void __glXDispSwap_BindTexture(GLbyte * pc)
+{
+ CALL_BindTexture( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_Indexubv(GLbyte * pc)
+{
+ CALL_Indexubv( GET_DISPATCH(), (
+ (const GLubyte *)(pc + 0)
+ ) );
+}
+
+void __glXDispSwap_PolygonOffset(GLbyte * pc)
+{
+ CALL_PolygonOffset( GET_DISPATCH(), (
+ (GLfloat )bswap_FLOAT32( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 )
+ ) );
+}
+
+int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ GLboolean retval;
+ GLboolean answerBuffer[200];
+ GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
+ retval = CALL_AreTexturesResident( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ),
+ residences
+ ) );
+ __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ GLboolean retval;
+ GLboolean answerBuffer[200];
+ GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
+ retval = CALL_AreTexturesResident( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ),
+ residences
+ ) );
+ __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_CopyTexImage1D(GLbyte * pc)
+{
+ CALL_CopyTexImage1D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 ),
+ (GLsizei )bswap_CARD32 ( pc + 20 ),
+ (GLint )bswap_CARD32 ( pc + 24 )
+ ) );
+}
+
+void __glXDispSwap_CopyTexImage2D(GLbyte * pc)
+{
+ CALL_CopyTexImage2D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 ),
+ (GLsizei )bswap_CARD32 ( pc + 20 ),
+ (GLsizei )bswap_CARD32 ( pc + 24 ),
+ (GLint )bswap_CARD32 ( pc + 28 )
+ ) );
+}
+
+void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc)
+{
+ CALL_CopyTexSubImage1D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 ),
+ (GLsizei )bswap_CARD32 ( pc + 20 )
+ ) );
+}
+
+void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc)
+{
+ CALL_CopyTexSubImage2D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 ),
+ (GLint )bswap_CARD32 ( pc + 20 ),
+ (GLsizei )bswap_CARD32 ( pc + 24 ),
+ (GLsizei )bswap_CARD32 ( pc + 28 )
+ ) );
+}
+
+int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ CALL_DeleteTextures( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ CALL_DeleteTextures( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ GLuint answerBuffer[200];
+ GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenTextures( GET_DISPATCH(), (
+ n,
+ textures
+ ) );
+ (void) bswap_32_array( (uint32_t *) textures, n );
+ __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ GLuint answerBuffer[200];
+ GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenTextures( GET_DISPATCH(), (
+ n,
+ textures
+ ) );
+ (void) bswap_32_array( (uint32_t *) textures, n );
+ __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsTexture( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsTexture( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_PrioritizeTextures(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ CALL_PrioritizeTextures( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ),
+ (const GLclampf *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
+ ) );
+}
+
+void __glXDispSwap_TexSubImage1D(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 56);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_TexSubImage1D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 20 ),
+ (GLint )bswap_CARD32 ( pc + 24 ),
+ (GLint )bswap_CARD32 ( pc + 28 ),
+ (GLsizei )bswap_CARD32 ( pc + 36 ),
+ (GLenum )bswap_ENUM ( pc + 44 ),
+ (GLenum )bswap_ENUM ( pc + 48 ),
+ pixels
+ ) );
+}
+
+void __glXDispSwap_TexSubImage2D(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 56);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_TexSubImage2D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 20 ),
+ (GLint )bswap_CARD32 ( pc + 24 ),
+ (GLint )bswap_CARD32 ( pc + 28 ),
+ (GLint )bswap_CARD32 ( pc + 32 ),
+ (GLsizei )bswap_CARD32 ( pc + 36 ),
+ (GLsizei )bswap_CARD32 ( pc + 40 ),
+ (GLenum )bswap_ENUM ( pc + 44 ),
+ (GLenum )bswap_ENUM ( pc + 48 ),
+ pixels
+ ) );
+}
+
+void __glXDispSwap_BlendColor(GLbyte * pc)
+{
+ CALL_BlendColor( GET_DISPATCH(), (
+ (GLclampf)bswap_FLOAT32( pc + 0 ),
+ (GLclampf)bswap_FLOAT32( pc + 4 ),
+ (GLclampf)bswap_FLOAT32( pc + 8 ),
+ (GLclampf)bswap_FLOAT32( pc + 12 )
+ ) );
+}
+
+void __glXDispSwap_BlendEquation(GLbyte * pc)
+{
+ CALL_BlendEquation( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_ColorTable(GLbyte * pc)
+{
+ const GLvoid * const table = (const GLvoid *) (pc + 40);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_ColorTable( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 20 ),
+ (GLenum )bswap_ENUM ( pc + 24 ),
+ (GLsizei )bswap_CARD32 ( pc + 28 ),
+ (GLenum )bswap_ENUM ( pc + 32 ),
+ (GLenum )bswap_ENUM ( pc + 36 ),
+ table
+ ) );
+}
+
+void __glXDispSwap_ColorTableParameterfv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLfloat * params;
+
+ params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glColorTableParameterfv_size(pname) );
+
+ CALL_ColorTableParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_ColorTableParameteriv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLint * params;
+
+ params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glColorTableParameteriv_size(pname) );
+
+ CALL_ColorTableParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_CopyColorTable(GLbyte * pc)
+{
+ CALL_CopyColorTable( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLsizei )bswap_CARD32 ( pc + 16 )
+ ) );
+}
+
+int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetColorTableParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetColorTableParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetColorTableParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetColorTableParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetColorTableParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetColorTableParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetColorTableParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetColorTableParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_ColorSubTable(GLbyte * pc)
+{
+ const GLvoid * const data = (const GLvoid *) (pc + 40);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_ColorSubTable( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 20 ),
+ (GLsizei )bswap_CARD32 ( pc + 24 ),
+ (GLsizei )bswap_CARD32 ( pc + 28 ),
+ (GLenum )bswap_ENUM ( pc + 32 ),
+ (GLenum )bswap_ENUM ( pc + 36 ),
+ data
+ ) );
+}
+
+void __glXDispSwap_CopyColorSubTable(GLbyte * pc)
+{
+ CALL_CopyColorSubTable( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLsizei )bswap_CARD32 ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLsizei )bswap_CARD32 ( pc + 16 )
+ ) );
+}
+
+void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc)
+{
+ const GLvoid * const image = (const GLvoid *) (pc + 44);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_ConvolutionFilter1D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 20 ),
+ (GLenum )bswap_ENUM ( pc + 24 ),
+ (GLsizei )bswap_CARD32 ( pc + 28 ),
+ (GLenum )bswap_ENUM ( pc + 36 ),
+ (GLenum )bswap_ENUM ( pc + 40 ),
+ image
+ ) );
+}
+
+void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc)
+{
+ const GLvoid * const image = (const GLvoid *) (pc + 44);
+ __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_ConvolutionFilter2D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 20 ),
+ (GLenum )bswap_ENUM ( pc + 24 ),
+ (GLsizei )bswap_CARD32 ( pc + 28 ),
+ (GLsizei )bswap_CARD32 ( pc + 32 ),
+ (GLenum )bswap_ENUM ( pc + 36 ),
+ (GLenum )bswap_ENUM ( pc + 40 ),
+ image
+ ) );
+}
+
+void __glXDispSwap_ConvolutionParameterf(GLbyte * pc)
+{
+ CALL_ConvolutionParameterf( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLfloat )bswap_FLOAT32( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLfloat * params;
+
+ params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glConvolutionParameterfv_size(pname) );
+
+ CALL_ConvolutionParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_ConvolutionParameteri(GLbyte * pc)
+{
+ CALL_ConvolutionParameteri( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 )
+ ) );
+}
+
+void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+ const GLint * params;
+
+ params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glConvolutionParameteriv_size(pname) );
+
+ CALL_ConvolutionParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc)
+{
+ CALL_CopyConvolutionFilter1D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLsizei )bswap_CARD32 ( pc + 16 )
+ ) );
+}
+
+void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc)
+{
+ CALL_CopyConvolutionFilter2D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLsizei )bswap_CARD32 ( pc + 16 ),
+ (GLsizei )bswap_CARD32 ( pc + 20 )
+ ) );
+}
+
+int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetConvolutionParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetConvolutionParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetConvolutionParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetConvolutionParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetConvolutionParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetConvolutionParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetConvolutionParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetConvolutionParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetHistogramParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetHistogramParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetHistogramParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetHistogramParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetHistogramParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetHistogramParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetHistogramParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetHistogramParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetMinmaxParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMinmaxParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetMinmaxParameterfv_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMinmaxParameterfv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetMinmaxParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMinmaxParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetMinmaxParameteriv_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetMinmaxParameteriv( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_Histogram(GLbyte * pc)
+{
+ CALL_Histogram( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLsizei )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ *(GLboolean *)(pc + 12)
+ ) );
+}
+
+void __glXDispSwap_Minmax(GLbyte * pc)
+{
+ CALL_Minmax( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ *(GLboolean *)(pc + 8)
+ ) );
+}
+
+void __glXDispSwap_ResetHistogram(GLbyte * pc)
+{
+ CALL_ResetHistogram( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_ResetMinmax(GLbyte * pc)
+{
+ CALL_ResetMinmax( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_TexImage3D(GLbyte * pc)
+{
+ const CARD32 ptr_is_null = *(CARD32 *)(pc + 76);
+ const GLvoid * const pixels = (const GLvoid *) ((ptr_is_null != 0) ? NULL : (pc + 80));
+ __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32( & hdr->imageHeight )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32( & hdr->skipImages )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_TexImage3D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 36 ),
+ (GLint )bswap_CARD32 ( pc + 40 ),
+ (GLint )bswap_CARD32 ( pc + 44 ),
+ (GLsizei )bswap_CARD32 ( pc + 48 ),
+ (GLsizei )bswap_CARD32 ( pc + 52 ),
+ (GLsizei )bswap_CARD32 ( pc + 56 ),
+ (GLint )bswap_CARD32 ( pc + 64 ),
+ (GLenum )bswap_ENUM ( pc + 68 ),
+ (GLenum )bswap_ENUM ( pc + 72 ),
+ pixels
+ ) );
+}
+
+void __glXDispSwap_TexSubImage3D(GLbyte * pc)
+{
+ const GLvoid * const pixels = (const GLvoid *) (pc + 88);
+ __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);
+
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32( & hdr->imageHeight )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32( & hdr->skipImages )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) );
+ CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) );
+
+ CALL_TexSubImage3D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 36 ),
+ (GLint )bswap_CARD32 ( pc + 40 ),
+ (GLint )bswap_CARD32 ( pc + 44 ),
+ (GLint )bswap_CARD32 ( pc + 48 ),
+ (GLint )bswap_CARD32 ( pc + 52 ),
+ (GLsizei )bswap_CARD32 ( pc + 60 ),
+ (GLsizei )bswap_CARD32 ( pc + 64 ),
+ (GLsizei )bswap_CARD32 ( pc + 68 ),
+ (GLenum )bswap_ENUM ( pc + 76 ),
+ (GLenum )bswap_ENUM ( pc + 80 ),
+ pixels
+ ) );
+}
+
+void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc)
+{
+ CALL_CopyTexSubImage3D( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 ),
+ (GLint )bswap_CARD32 ( pc + 20 ),
+ (GLint )bswap_CARD32 ( pc + 24 ),
+ (GLsizei )bswap_CARD32 ( pc + 28 ),
+ (GLsizei )bswap_CARD32 ( pc + 32 )
+ ) );
+}
+
+void __glXDispSwap_ActiveTextureARB(GLbyte * pc)
+{
+ CALL_ActiveTextureARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 12);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MultiTexCoord1dvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord1fvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord1ivARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 1 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord1svARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MultiTexCoord2dvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 16 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord2fvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord2ivARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 2 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord2svARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 28);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MultiTexCoord3dvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 24 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord3fvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord3ivARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 3 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord3svARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+
+ CALL_MultiTexCoord4dvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 32 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord4fvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord4ivARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc)
+{
+ CALL_MultiTexCoord4svARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_SampleCoverageARB(GLbyte * pc)
+{
+ CALL_SampleCoverageARB( GET_DISPATCH(), (
+ (GLclampf)bswap_FLOAT32( pc + 0 ),
+ *(GLboolean *)(pc + 4)
+ ) );
+}
+
+void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 20 );
+
+ CALL_CompressedTexImage1DARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLsizei )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 ),
+ imageSize,
+ (const GLvoid *)(pc + 24)
+ ) );
+}
+
+void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 24 );
+
+ CALL_CompressedTexImage2DARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLsizei )bswap_CARD32 ( pc + 12 ),
+ (GLsizei )bswap_CARD32 ( pc + 16 ),
+ (GLint )bswap_CARD32 ( pc + 20 ),
+ imageSize,
+ (const GLvoid *)(pc + 28)
+ ) );
+}
+
+void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 28 );
+
+ CALL_CompressedTexImage3DARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLsizei )bswap_CARD32 ( pc + 12 ),
+ (GLsizei )bswap_CARD32 ( pc + 16 ),
+ (GLsizei )bswap_CARD32 ( pc + 20 ),
+ (GLint )bswap_CARD32 ( pc + 24 ),
+ imageSize,
+ (const GLvoid *)(pc + 32)
+ ) );
+}
+
+void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 20 );
+
+ CALL_CompressedTexSubImage1DARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLsizei )bswap_CARD32 ( pc + 12 ),
+ (GLenum )bswap_ENUM ( pc + 16 ),
+ imageSize,
+ (const GLvoid *)(pc + 24)
+ ) );
+}
+
+void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 28 );
+
+ CALL_CompressedTexSubImage2DARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLsizei )bswap_CARD32 ( pc + 16 ),
+ (GLsizei )bswap_CARD32 ( pc + 20 ),
+ (GLenum )bswap_ENUM ( pc + 24 ),
+ imageSize,
+ (const GLvoid *)(pc + 32)
+ ) );
+}
+
+void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc)
+{
+ const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 36 );
+
+ CALL_CompressedTexSubImage3DARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 ),
+ (GLsizei )bswap_CARD32 ( pc + 20 ),
+ (GLsizei )bswap_CARD32 ( pc + 24 ),
+ (GLsizei )bswap_CARD32 ( pc + 28 ),
+ (GLenum )bswap_ENUM ( pc + 32 ),
+ imageSize,
+ (const GLvoid *)(pc + 40)
+ ) );
+}
+
+int __glXDispSwap_GetProgramEnvParameterdvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLdouble params[4];
+ CALL_GetProgramEnvParameterdvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ params
+ ) );
+ (void) bswap_64_array( (uint64_t *) params, 4 );
+ __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetProgramEnvParameterfvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLfloat params[4];
+ CALL_GetProgramEnvParameterfvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, 4 );
+ __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetProgramLocalParameterdvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLdouble params[4];
+ CALL_GetProgramLocalParameterdvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ params
+ ) );
+ (void) bswap_64_array( (uint64_t *) params, 4 );
+ __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetProgramLocalParameterfvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLfloat params[4];
+ CALL_GetProgramLocalParameterfvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, 4 );
+ __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetProgramivARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetProgramivARB_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetProgramivARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetVertexAttribdvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetVertexAttribdvARB_size(pname);
+ GLdouble answerBuffer[200];
+ GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribdvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_64_array( (uint64_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetVertexAttribfvARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetVertexAttribfvARB_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribfvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetVertexAttribivARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetVertexAttribivARB_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribivARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 40);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ProgramEnvParameter4dvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 )
+ ) );
+}
+
+void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc)
+{
+ CALL_ProgramEnvParameter4fvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 )
+ ) );
+}
+
+void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 40);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ProgramLocalParameter4dvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 )
+ ) );
+}
+
+void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc)
+{
+ CALL_ProgramLocalParameter4fvARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 )
+ ) );
+}
+
+void __glXDispSwap_ProgramStringARB(GLbyte * pc)
+{
+ const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 8 );
+
+ CALL_ProgramStringARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ len,
+ (const GLvoid *)(pc + 12)
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 12);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib1dvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 1 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib1fvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc)
+{
+ CALL_VertexAttrib1svARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib2dvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 2 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib2fvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc)
+{
+ CALL_VertexAttrib2svARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 28);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib3dvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 3 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib3fvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc)
+{
+ CALL_VertexAttrib3svARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NbvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLbyte *)(pc + 4)
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NivARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NsvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NubvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLubyte *)(pc + 4)
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NuivARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4NusvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLushort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4bvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLbyte *)(pc + 4)
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib4dvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4fvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4ivARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4svARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4ubvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLubyte *)(pc + 4)
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4uivARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc)
+{
+ CALL_VertexAttrib4usvARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLushort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_BeginQueryARB(GLbyte * pc)
+{
+ CALL_BeginQueryARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 )
+ ) );
+}
+
+int __glXDispSwap_DeleteQueriesARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ CALL_DeleteQueriesARB( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_EndQueryARB(GLbyte * pc)
+{
+ CALL_EndQueryARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+int __glXDispSwap_GenQueriesARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ GLuint answerBuffer[200];
+ GLuint * ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenQueriesARB( GET_DISPATCH(), (
+ n,
+ ids
+ ) );
+ (void) bswap_32_array( (uint32_t *) ids, n );
+ __glXSendReplySwap(cl->client, ids, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetQueryObjectivARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetQueryObjectivARB_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetQueryObjectivARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetQueryObjectuivARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetQueryObjectuivARB_size(pname);
+ GLuint answerBuffer[200];
+ GLuint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetQueryObjectuivARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetQueryivARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetQueryivARB_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetQueryivARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_IsQueryARB(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsQueryARB( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_DrawBuffersARB(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ CALL_DrawBuffersARB( GET_DISPATCH(), (
+ n,
+ (const GLenum *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
+ ) );
+}
+
+void __glXDispSwap_ClampColorARB(GLbyte * pc)
+{
+ CALL_ClampColorARB( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_RenderbufferStorageMultisample(GLbyte * pc)
+{
+ CALL_RenderbufferStorageMultisample( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLsizei )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLsizei )bswap_CARD32 ( pc + 12 ),
+ (GLsizei )bswap_CARD32 ( pc + 16 )
+ ) );
+}
+
+void __glXDispSwap_SampleMaskSGIS(GLbyte * pc)
+{
+ CALL_SampleMaskSGIS( GET_DISPATCH(), (
+ (GLclampf)bswap_FLOAT32( pc + 0 ),
+ *(GLboolean *)(pc + 4)
+ ) );
+}
+
+void __glXDispSwap_SamplePatternSGIS(GLbyte * pc)
+{
+ CALL_SamplePatternSGIS( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+void __glXDispSwap_PointParameterfEXT(GLbyte * pc)
+{
+ CALL_PointParameterfEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLfloat )bswap_FLOAT32( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_PointParameterfvEXT(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
+ const GLfloat * params;
+
+ params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glPointParameterfvEXT_size(pname) );
+
+ CALL_PointParameterfvEXT( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3bvEXT( GET_DISPATCH(), (
+ (const GLbyte *)(pc + 0)
+ ) );
+}
+
+void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+
+ CALL_SecondaryColor3dvEXT( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3fvEXT( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3ivEXT( GET_DISPATCH(), (
+ (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3svEXT( GET_DISPATCH(), (
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3ubvEXT( GET_DISPATCH(), (
+ (const GLubyte *)(pc + 0)
+ ) );
+}
+
+void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3uivEXT( GET_DISPATCH(), (
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc)
+{
+ CALL_SecondaryColor3usvEXT( GET_DISPATCH(), (
+ (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 3 )
+ ) );
+}
+
+void __glXDispSwap_FogCoorddvEXT(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+
+ CALL_FogCoorddvEXT( GET_DISPATCH(), (
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_FogCoordfvEXT(GLbyte * pc)
+{
+ CALL_FogCoordfvEXT( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 )
+ ) );
+}
+
+void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc)
+{
+ CALL_BlendFuncSeparateEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLenum )bswap_ENUM ( pc + 12 )
+ ) );
+}
+
+void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc)
+{
+ CALL_WindowPos3fvMESA( GET_DISPATCH(), (
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 )
+ ) );
+}
+
+int __glXDispSwap_AreProgramsResidentNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ GLboolean retval;
+ GLboolean answerBuffer[200];
+ GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
+ retval = CALL_AreProgramsResidentNV( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ),
+ residences
+ ) );
+ __glXSendReplySwap(cl->client, residences, n, 1, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_BindProgramNV(GLbyte * pc)
+{
+ CALL_BindProgramNV( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 )
+ ) );
+}
+
+int __glXDispSwap_DeleteProgramsNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ CALL_DeleteProgramsNV( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
+ ) );
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_ExecuteProgramNV(GLbyte * pc)
+{
+ CALL_ExecuteProgramNV( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 )
+ ) );
+}
+
+int __glXDispSwap_GenProgramsNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ GLuint answerBuffer[200];
+ GLuint * programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenProgramsNV( GET_DISPATCH(), (
+ n,
+ programs
+ ) );
+ (void) bswap_32_array( (uint32_t *) programs, n );
+ __glXSendReplySwap(cl->client, programs, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetProgramParameterdvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLdouble params[4];
+ CALL_GetProgramParameterdvNV( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ params
+ ) );
+ (void) bswap_64_array( (uint64_t *) params, 4 );
+ __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetProgramParameterfvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLfloat params[4];
+ CALL_GetProgramParameterfvNV( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, 4 );
+ __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetProgramivNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetProgramivNV_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetProgramivNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetTrackMatrixivNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLint params[1];
+ CALL_GetTrackMatrixivNV( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, 1 );
+ __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetVertexAttribdvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetVertexAttribdvNV_size(pname);
+ GLdouble answerBuffer[200];
+ GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribdvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_64_array( (uint64_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetVertexAttribfvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetVertexAttribfvNV_size(pname);
+ GLfloat answerBuffer[200];
+ GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribfvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetVertexAttribivNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
+
+ const GLuint compsize = __glGetVertexAttribivNV_size(pname);
+ GLint answerBuffer[200];
+ GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
+
+ if (params == NULL) return BadAlloc;
+ __glXClearErrorOccured();
+
+ CALL_GetVertexAttribivNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ pname,
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, compsize );
+ __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_IsProgramNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsProgramNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_LoadProgramNV(GLbyte * pc)
+{
+ const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 8 );
+
+ CALL_LoadProgramNV( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ len,
+ (const GLubyte *)(pc + 12)
+ ) );
+}
+
+void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc)
+{
+ const GLsizei num = (GLsizei )bswap_CARD32 ( pc + 8 );
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ProgramParameters4dvNV( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ num,
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 12), 0 )
+ ) );
+}
+
+void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc)
+{
+ const GLsizei num = (GLsizei )bswap_CARD32 ( pc + 8 );
+
+ CALL_ProgramParameters4fvNV( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ num,
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 12), 0 )
+ ) );
+}
+
+void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ CALL_RequestResidentProgramsNV( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
+ ) );
+}
+
+void __glXDispSwap_TrackMatrixNV(GLbyte * pc)
+{
+ CALL_TrackMatrixNV( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLenum )bswap_ENUM ( pc + 12 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 12);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib1dvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 1 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc)
+{
+ CALL_VertexAttrib1fvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc)
+{
+ CALL_VertexAttrib1svNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib2dvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 2 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc)
+{
+ CALL_VertexAttrib2fvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc)
+{
+ CALL_VertexAttrib2svNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 28);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib3dvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 3 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc)
+{
+ CALL_VertexAttrib3fvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc)
+{
+ CALL_VertexAttrib3svNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc)
+{
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttrib4dvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc)
+{
+ CALL_VertexAttrib4fvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc)
+{
+ CALL_VertexAttrib4svNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc)
+{
+ CALL_VertexAttrib4ubvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ (const GLubyte *)(pc + 4)
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttribs1dvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_VertexAttribs1fvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_VertexAttribs1svNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttribs2dvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_VertexAttribs2fvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_VertexAttribs2svNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttribs3dvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_VertexAttribs3fvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_VertexAttribs3svNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_VertexAttribs4dvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_VertexAttribs4fvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_VertexAttribs4svNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 )
+ ) );
+}
+
+void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_VertexAttribs4ubvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ n,
+ (const GLubyte *)(pc + 8)
+ ) );
+}
+
+void __glXDispSwap_PointParameteriNV(GLbyte * pc)
+{
+ CALL_PointParameteriNV( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_PointParameterivNV(GLbyte * pc)
+{
+ const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 );
+ const GLint * params;
+
+ params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glPointParameterivNV_size(pname) );
+
+ CALL_PointParameterivNV( GET_DISPATCH(), (
+ pname,
+ params
+ ) );
+}
+
+void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc)
+{
+ CALL_ActiveStencilFaceEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+int __glXDispSwap_GetProgramNamedParameterdvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ GLdouble params[4];
+ CALL_GetProgramNamedParameterdvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ len,
+ (const GLubyte *)(pc + 8),
+ params
+ ) );
+ (void) bswap_64_array( (uint64_t *) params, 4 );
+ __glXSendReplySwap(cl->client, params, 4, 8, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetProgramNamedParameterfvNV(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ GLfloat params[4];
+ CALL_GetProgramNamedParameterfvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ len,
+ (const GLubyte *)(pc + 8),
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, 4 );
+ __glXSendReplySwap(cl->client, params, 4, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc)
+{
+ const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 36 );
+
+#ifdef __GLX_ALIGN64
+ const GLuint cmdlen = 44 + __GLX_PAD(len) - 4;
+ if ((unsigned long)(pc) & 7) {
+ (void) memmove(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ CALL_ProgramNamedParameter4dvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 32 ),
+ len,
+ (const GLubyte *)(pc + 40),
+ (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 )
+ ) );
+}
+
+void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc)
+{
+ const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 );
+
+ CALL_ProgramNamedParameter4fvNV( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 ),
+ len,
+ (const GLubyte *)(pc + 24),
+ (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 )
+ ) );
+}
+
+void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc)
+{
+ CALL_BlendEquationSeparateEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_BindFramebufferEXT(GLbyte * pc)
+{
+ CALL_BindFramebufferEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 )
+ ) );
+}
+
+void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc)
+{
+ CALL_BindRenderbufferEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLuint )bswap_CARD32 ( pc + 4 )
+ ) );
+}
+
+int __glXDispSwap_CheckFramebufferStatusEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLenum retval;
+ retval = CALL_CheckFramebufferStatusEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ CALL_DeleteFramebuffersEXT( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
+ ) );
+}
+
+void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc)
+{
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ CALL_DeleteRenderbuffersEXT( GET_DISPATCH(), (
+ n,
+ (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
+ ) );
+}
+
+void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc)
+{
+ CALL_FramebufferRenderbufferEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLuint )bswap_CARD32 ( pc + 12 )
+ ) );
+}
+
+void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc)
+{
+ CALL_FramebufferTexture1DEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLuint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 )
+ ) );
+}
+
+void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc)
+{
+ CALL_FramebufferTexture2DEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLuint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 )
+ ) );
+}
+
+void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc)
+{
+ CALL_FramebufferTexture3DEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ (GLuint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 ),
+ (GLint )bswap_CARD32 ( pc + 20 )
+ ) );
+}
+
+int __glXDispSwap_GenFramebuffersEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ GLuint answerBuffer[200];
+ GLuint * framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenFramebuffersEXT( GET_DISPATCH(), (
+ n,
+ framebuffers
+ ) );
+ (void) bswap_32_array( (uint32_t *) framebuffers, n );
+ __glXSendReplySwap(cl->client, framebuffers, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GenRenderbuffersEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
+
+ GLuint answerBuffer[200];
+ GLuint * renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
+ CALL_GenRenderbuffersEXT( GET_DISPATCH(), (
+ n,
+ renderbuffers
+ ) );
+ (void) bswap_32_array( (uint32_t *) renderbuffers, n );
+ __glXSendReplySwap(cl->client, renderbuffers, n, 4, GL_TRUE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc)
+{
+ CALL_GenerateMipmapEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 )
+ ) );
+}
+
+int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLint params[1];
+ CALL_GetFramebufferAttachmentParameterivEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLenum )bswap_ENUM ( pc + 8 ),
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, 1 );
+ __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_GetRenderbufferParameterivEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLint params[1];
+ CALL_GetRenderbufferParameterivEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ params
+ ) );
+ (void) bswap_32_array( (uint32_t *) params, 1 );
+ __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_IsFramebufferEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsFramebufferEXT( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+int __glXDispSwap_IsRenderbufferEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ int error;
+ __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ if ( cx != NULL ) {
+ GLboolean retval;
+ retval = CALL_IsRenderbufferEXT( GET_DISPATCH(), (
+ (GLuint )bswap_CARD32 ( pc + 0 )
+ ) );
+ __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+ error = Success;
+ }
+
+ return error;
+}
+
+void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc)
+{
+ CALL_RenderbufferStorageEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLsizei )bswap_CARD32 ( pc + 8 ),
+ (GLsizei )bswap_CARD32 ( pc + 12 )
+ ) );
+}
+
+void __glXDispSwap_BlitFramebufferEXT(GLbyte * pc)
+{
+ CALL_BlitFramebufferEXT( GET_DISPATCH(), (
+ (GLint )bswap_CARD32 ( pc + 0 ),
+ (GLint )bswap_CARD32 ( pc + 4 ),
+ (GLint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 ),
+ (GLint )bswap_CARD32 ( pc + 20 ),
+ (GLint )bswap_CARD32 ( pc + 24 ),
+ (GLint )bswap_CARD32 ( pc + 28 ),
+ (GLbitfield)bswap_CARD32 ( pc + 32 ),
+ (GLenum )bswap_ENUM ( pc + 36 )
+ ) );
+}
+
+void __glXDispSwap_FramebufferTextureLayerEXT(GLbyte * pc)
+{
+ CALL_FramebufferTextureLayerEXT( GET_DISPATCH(), (
+ (GLenum )bswap_ENUM ( pc + 0 ),
+ (GLenum )bswap_ENUM ( pc + 4 ),
+ (GLuint )bswap_CARD32 ( pc + 8 ),
+ (GLint )bswap_CARD32 ( pc + 12 ),
+ (GLint )bswap_CARD32 ( pc + 16 )
+ ) );
+}
+
diff --git a/xorg-server/glx/indirect_program.c b/xorg-server/glx/indirect_program.c
index 18b7a1526..629fb7d3f 100644
--- a/xorg-server/glx/indirect_program.c
+++ b/xorg-server/glx/indirect_program.c
@@ -49,9 +49,9 @@
#include "glthread.h"
#include "dispatch.h"
-static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc,
- unsigned get_programiv_offset, unsigned get_program_string_offset,
- Bool do_swap);
+static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
+ unsigned get_programiv_offset,
+ unsigned get_program_string_offset, Bool do_swap);
/**
* Handle both types of glGetProgramString calls.
@@ -62,91 +62,92 @@ static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc,
* caller. These can be the offsets of either the ARB versions or the NV
* versions.
*/
-int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc,
- unsigned get_programiv_offset,
- unsigned get_program_string_offset,
- Bool do_swap)
+int
+DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
+ unsigned get_programiv_offset,
+ unsigned get_program_string_offset, Bool do_swap)
{
- xGLXVendorPrivateWithReplyReq * const req =
- (xGLXVendorPrivateWithReplyReq *) pc;
+ xGLXVendorPrivateWithReplyReq *const req =
+ (xGLXVendorPrivateWithReplyReq *) pc;
int error;
- __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, & error);
+ __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
ClientPtr client = cl->client;
-
pc += __GLX_VENDPRIV_HDR_SIZE;
if (cx != NULL) {
- GLenum target;
- GLenum pname;
- GLint compsize = 0;
- char *answer = NULL, answerBuffer[200];
-
- if (do_swap) {
- target = (GLenum) bswap_32(*(int *)(pc + 0));
- pname = (GLenum) bswap_32(*(int *)(pc + 4));
- }
- else {
- target = *(GLenum *)(pc + 0);
- pname = *(GLuint *)(pc + 4);
- }
-
- /* The value of the GL_PROGRAM_LENGTH_ARB and GL_PROGRAM_LENGTH_NV
- * enumerants is the same.
- */
- CALL_by_offset(GET_DISPATCH(),
- (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)),
- get_programiv_offset,
- (target, GL_PROGRAM_LENGTH_ARB, &compsize));
-
- if (compsize != 0) {
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
-
- CALL_by_offset(GET_DISPATCH(),
- (void (GLAPIENTRYP)(GLuint, GLenum, GLubyte *)),
- get_program_string_offset,
- (target, pname, (GLubyte *)answer));
- }
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *)&__glXReply)->width = compsize;
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- error = Success;
+ GLenum target;
+ GLenum pname;
+ GLint compsize = 0;
+ char *answer = NULL, answerBuffer[200];
+
+ if (do_swap) {
+ target = (GLenum) bswap_32(*(int *) (pc + 0));
+ pname = (GLenum) bswap_32(*(int *) (pc + 4));
+ }
+ else {
+ target = *(GLenum *) (pc + 0);
+ pname = *(GLuint *) (pc + 4);
+ }
+
+ /* The value of the GL_PROGRAM_LENGTH_ARB and GL_PROGRAM_LENGTH_NV
+ * enumerants is the same.
+ */
+ CALL_by_offset(GET_DISPATCH(),
+ (void (GLAPIENTRYP) (GLuint, GLenum, GLint *)),
+ get_programiv_offset,
+ (target, GL_PROGRAM_LENGTH_ARB, &compsize));
+
+ if (compsize != 0) {
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+
+ CALL_by_offset(GET_DISPATCH(),
+ (void (GLAPIENTRYP) (GLuint, GLenum, GLubyte *)),
+ get_program_string_offset,
+ (target, pname, (GLubyte *) answer));
+ }
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ ((xGLXGetTexImageReply *) & __glXReply)->width = compsize;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ error = Success;
}
return error;
}
-int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte *pc)
+int
+__glXDisp_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc)
{
return DoGetProgramString(cl, pc, _gloffset_GetProgramivARB,
- _gloffset_GetProgramStringARB, False);
+ _gloffset_GetProgramStringARB, False);
}
-
-int __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte *pc)
+int
+__glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc)
{
return DoGetProgramString(cl, pc, _gloffset_GetProgramivARB,
- _gloffset_GetProgramStringARB, True);
+ _gloffset_GetProgramStringARB, True);
}
-
-int __glXDisp_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte *pc)
+int
+__glXDisp_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc)
{
return DoGetProgramString(cl, pc, _gloffset_GetProgramivNV,
- _gloffset_GetProgramStringNV, False);
+ _gloffset_GetProgramStringNV, False);
}
-
-int __glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte *pc)
+int
+__glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc)
{
return DoGetProgramString(cl, pc, _gloffset_GetProgramivNV,
- _gloffset_GetProgramStringNV, True);
+ _gloffset_GetProgramStringNV, True);
}
diff --git a/xorg-server/glx/indirect_reqsize.h b/xorg-server/glx/indirect_reqsize.h
index 0ee29e1d0..b6d5e52f7 100644
--- a/xorg-server/glx/indirect_reqsize.h
+++ b/xorg-server/glx/indirect_reqsize.h
@@ -1,116 +1,116 @@
-/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
-
-/*
- * (C) Copyright IBM Corporation 2005
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#if !defined( _INDIRECT_REQSIZE_H_ )
-#define _INDIRECT_REQSIZE_H_
-
-#include <X11/Xfuncproto.h>
-
-# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-# define PURE __attribute__((pure))
-# else
-# define PURE
-# endif
-
-extern PURE _X_HIDDEN int __glXCallListsReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXBitmapReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXFogfvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXFogivReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXLightfvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXLightivReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXLightModelfvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXLightModelivReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXMaterialfvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXMaterialivReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXPolygonStippleReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexParameterfvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexParameterivReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexImage1DReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexImage2DReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexEnvfvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexEnvivReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexGendvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexGenfvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexGenivReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXMap1dReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXMap1fReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXMap2dReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXMap2fReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXPixelMapfvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXPixelMapuivReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXPixelMapusvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXDrawPixelsReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXDrawArraysReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXColorTableReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXColorTableParameterivReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXColorSubTableReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXRequestResidentProgramsNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs1svNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs2fvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs2svNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap);
-extern PURE _X_HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap);
-
-# undef PURE
-
-#endif /* !defined( _INDIRECT_REQSIZE_H_ ) */
+/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
+
+/*
+ * (C) Copyright IBM Corporation 2005
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#if !defined( _INDIRECT_REQSIZE_H_ )
+# define _INDIRECT_REQSIZE_H_
+
+#include <X11/Xfuncproto.h>
+
+# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define PURE __attribute__((pure))
+# else
+# define PURE
+# endif
+
+extern PURE _X_HIDDEN int __glXCallListsReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXBitmapReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXFogfvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXFogivReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXLightfvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXLightivReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXLightModelfvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXLightModelivReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXMaterialfvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXMaterialivReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXPolygonStippleReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexParameterfvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexParameterivReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexImage1DReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexImage2DReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexEnvfvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexEnvivReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexGendvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexGenfvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexGenivReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXMap1dReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXMap1fReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXMap2dReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXMap2fReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXPixelMapfvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXPixelMapuivReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXPixelMapusvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXDrawPixelsReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXDrawArraysReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXColorTableReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXColorTableParameterivReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXColorSubTableReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXRequestResidentProgramsNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs1svNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs2fvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs2svNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap);
+extern PURE _X_HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap);
+
+# undef PURE
+
+#endif /* !defined( _INDIRECT_REQSIZE_H_ ) */
diff --git a/xorg-server/glx/indirect_size.h b/xorg-server/glx/indirect_size.h
index 238d8d495..a760d0580 100644
--- a/xorg-server/glx/indirect_size.h
+++ b/xorg-server/glx/indirect_size.h
@@ -54,4 +54,4 @@
# undef PURE
# undef FASTCALL
-#endif /* !defined( _INDIRECT_SIZE_H_ ) */
+#endif /* !defined( _INDIRECT_SIZE_H_ ) */
diff --git a/xorg-server/glx/indirect_size_get.h b/xorg-server/glx/indirect_size_get.h
index a6428d5fd..d07422b0c 100644
--- a/xorg-server/glx/indirect_size_get.h
+++ b/xorg-server/glx/indirect_size_get.h
@@ -118,4 +118,4 @@ extern _X_INTERNAL PURE FASTCALL GLint __glGetFramebufferAttachmentParameterivEX
# undef PURE
# undef FASTCALL
-#endif /* !defined( _INDIRECT_SIZE_GET_H_ ) */
+#endif /* !defined( _INDIRECT_SIZE_GET_H_ ) */
diff --git a/xorg-server/glx/indirect_table.c b/xorg-server/glx/indirect_table.c
index 6b2c6304c..746075655 100644
--- a/xorg-server/glx/indirect_table.c
+++ b/xorg-server/glx/indirect_table.c
@@ -1,1610 +1,1610 @@
-/* DO NOT EDIT - This file generated automatically by glX_server_table.py (from Mesa) script */
-
-/*
- * (C) Copyright IBM Corporation 2005, 2006
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef HAVE_DIX_CONFIG_H
-#include "glheader.h"
-#endif
-
-#include <inttypes.h>
-#include "glxserver.h"
-#include "glxext.h"
-#include "indirect_dispatch.h"
-#include "indirect_reqsize.h"
-#include "indirect_table.h"
-
-/*****************************************************************/
-/* tree depth = 3 */
-static const int_fast16_t Single_dispatch_tree[24] = {
- /* [0] -> opcode range [0, 256], node depth 1 */
- 2,
- 5,
- 13,
- 16,
- EMPTY_LEAF,
-
- /* [5] -> opcode range [0, 64], node depth 2 */
- 2,
- LEAF(0),
- LEAF(16),
- 10,
- EMPTY_LEAF,
-
- /* [10] -> opcode range [32, 48], node depth 3 */
- 1,
- LEAF(32),
- EMPTY_LEAF,
-
- /* [13] -> opcode range [64, 128], node depth 2 */
- 1,
- EMPTY_LEAF,
- LEAF(40),
-
- /* [16] -> opcode range [128, 192], node depth 2 */
- 2,
- LEAF(72),
- LEAF(88),
- 21,
- EMPTY_LEAF,
-
- /* [21] -> opcode range [160, 176], node depth 3 */
- 1,
- LEAF(104),
- EMPTY_LEAF,
-
-};
-
-static const void *Single_function_table[112][2] = {
- /* [ 0] = 0 */ {NULL, NULL},
- /* [ 1] = 1 */ {__glXDisp_Render, __glXDispSwap_Render},
- /* [ 2] = 2 */ {__glXDisp_RenderLarge, __glXDispSwap_RenderLarge},
- /* [ 3] = 3 */ {__glXDisp_CreateContext, __glXDispSwap_CreateContext},
- /* [ 4] = 4 */ {__glXDisp_DestroyContext, __glXDispSwap_DestroyContext},
- /* [ 5] = 5 */ {__glXDisp_MakeCurrent, __glXDispSwap_MakeCurrent},
- /* [ 6] = 6 */ {__glXDisp_IsDirect, __glXDispSwap_IsDirect},
- /* [ 7] = 7 */ {__glXDisp_QueryVersion, __glXDispSwap_QueryVersion},
- /* [ 8] = 8 */ {__glXDisp_WaitGL, __glXDispSwap_WaitGL},
- /* [ 9] = 9 */ {__glXDisp_WaitX, __glXDispSwap_WaitX},
- /* [ 10] = 10 */ {__glXDisp_CopyContext, __glXDispSwap_CopyContext},
- /* [ 11] = 11 */ {__glXDisp_SwapBuffers, __glXDispSwap_SwapBuffers},
- /* [ 12] = 12 */ {__glXDisp_UseXFont, __glXDispSwap_UseXFont},
- /* [ 13] = 13 */ {__glXDisp_CreateGLXPixmap, __glXDispSwap_CreateGLXPixmap},
- /* [ 14] = 14 */ {__glXDisp_GetVisualConfigs, __glXDispSwap_GetVisualConfigs},
- /* [ 15] = 15 */ {__glXDisp_DestroyGLXPixmap, __glXDispSwap_DestroyGLXPixmap},
- /* [ 16] = 16 */ {__glXDisp_VendorPrivate, __glXDispSwap_VendorPrivate},
- /* [ 17] = 17 */ {__glXDisp_VendorPrivateWithReply, __glXDispSwap_VendorPrivateWithReply},
- /* [ 18] = 18 */ {__glXDisp_QueryExtensionsString, __glXDispSwap_QueryExtensionsString},
- /* [ 19] = 19 */ {__glXDisp_QueryServerString, __glXDispSwap_QueryServerString},
- /* [ 20] = 20 */ {__glXDisp_ClientInfo, __glXDispSwap_ClientInfo},
- /* [ 21] = 21 */ {__glXDisp_GetFBConfigs, __glXDispSwap_GetFBConfigs},
- /* [ 22] = 22 */ {__glXDisp_CreatePixmap, __glXDispSwap_CreatePixmap},
- /* [ 23] = 23 */ {__glXDisp_DestroyPixmap, __glXDispSwap_DestroyPixmap},
- /* [ 24] = 24 */ {__glXDisp_CreateNewContext, __glXDispSwap_CreateNewContext},
- /* [ 25] = 25 */ {__glXDisp_QueryContext, __glXDispSwap_QueryContext},
- /* [ 26] = 26 */ {__glXDisp_MakeContextCurrent, __glXDispSwap_MakeContextCurrent},
- /* [ 27] = 27 */ {__glXDisp_CreatePbuffer, __glXDispSwap_CreatePbuffer},
- /* [ 28] = 28 */ {__glXDisp_DestroyPbuffer, __glXDispSwap_DestroyPbuffer},
- /* [ 29] = 29 */ {__glXDisp_GetDrawableAttributes, __glXDispSwap_GetDrawableAttributes},
- /* [ 30] = 30 */ {__glXDisp_ChangeDrawableAttributes, __glXDispSwap_ChangeDrawableAttributes},
- /* [ 31] = 31 */ {__glXDisp_CreateWindow, __glXDispSwap_CreateWindow},
- /* [ 32] = 32 */ {__glXDisp_DestroyWindow, __glXDispSwap_DestroyWindow},
- /* [ 33] = 33 */ {NULL, NULL},
- /* [ 34] = 34 */ {NULL, NULL},
- /* [ 35] = 35 */ {NULL, NULL},
- /* [ 36] = 36 */ {NULL, NULL},
- /* [ 37] = 37 */ {NULL, NULL},
- /* [ 38] = 38 */ {NULL, NULL},
- /* [ 39] = 39 */ {NULL, NULL},
- /* [ 40] = 96 */ {NULL, NULL},
- /* [ 41] = 97 */ {NULL, NULL},
- /* [ 42] = 98 */ {NULL, NULL},
- /* [ 43] = 99 */ {NULL, NULL},
- /* [ 44] = 100 */ {NULL, NULL},
- /* [ 45] = 101 */ {__glXDisp_NewList, __glXDispSwap_NewList},
- /* [ 46] = 102 */ {__glXDisp_EndList, __glXDispSwap_EndList},
- /* [ 47] = 103 */ {__glXDisp_DeleteLists, __glXDispSwap_DeleteLists},
- /* [ 48] = 104 */ {__glXDisp_GenLists, __glXDispSwap_GenLists},
- /* [ 49] = 105 */ {__glXDisp_FeedbackBuffer, __glXDispSwap_FeedbackBuffer},
- /* [ 50] = 106 */ {__glXDisp_SelectBuffer, __glXDispSwap_SelectBuffer},
- /* [ 51] = 107 */ {__glXDisp_RenderMode, __glXDispSwap_RenderMode},
- /* [ 52] = 108 */ {__glXDisp_Finish, __glXDispSwap_Finish},
- /* [ 53] = 109 */ {__glXDisp_PixelStoref, __glXDispSwap_PixelStoref},
- /* [ 54] = 110 */ {__glXDisp_PixelStorei, __glXDispSwap_PixelStorei},
- /* [ 55] = 111 */ {__glXDisp_ReadPixels, __glXDispSwap_ReadPixels},
- /* [ 56] = 112 */ {__glXDisp_GetBooleanv, __glXDispSwap_GetBooleanv},
- /* [ 57] = 113 */ {__glXDisp_GetClipPlane, __glXDispSwap_GetClipPlane},
- /* [ 58] = 114 */ {__glXDisp_GetDoublev, __glXDispSwap_GetDoublev},
- /* [ 59] = 115 */ {__glXDisp_GetError, __glXDispSwap_GetError},
- /* [ 60] = 116 */ {__glXDisp_GetFloatv, __glXDispSwap_GetFloatv},
- /* [ 61] = 117 */ {__glXDisp_GetIntegerv, __glXDispSwap_GetIntegerv},
- /* [ 62] = 118 */ {__glXDisp_GetLightfv, __glXDispSwap_GetLightfv},
- /* [ 63] = 119 */ {__glXDisp_GetLightiv, __glXDispSwap_GetLightiv},
- /* [ 64] = 120 */ {__glXDisp_GetMapdv, __glXDispSwap_GetMapdv},
- /* [ 65] = 121 */ {__glXDisp_GetMapfv, __glXDispSwap_GetMapfv},
- /* [ 66] = 122 */ {__glXDisp_GetMapiv, __glXDispSwap_GetMapiv},
- /* [ 67] = 123 */ {__glXDisp_GetMaterialfv, __glXDispSwap_GetMaterialfv},
- /* [ 68] = 124 */ {__glXDisp_GetMaterialiv, __glXDispSwap_GetMaterialiv},
- /* [ 69] = 125 */ {__glXDisp_GetPixelMapfv, __glXDispSwap_GetPixelMapfv},
- /* [ 70] = 126 */ {__glXDisp_GetPixelMapuiv, __glXDispSwap_GetPixelMapuiv},
- /* [ 71] = 127 */ {__glXDisp_GetPixelMapusv, __glXDispSwap_GetPixelMapusv},
- /* [ 72] = 128 */ {__glXDisp_GetPolygonStipple, __glXDispSwap_GetPolygonStipple},
- /* [ 73] = 129 */ {__glXDisp_GetString, __glXDispSwap_GetString},
- /* [ 74] = 130 */ {__glXDisp_GetTexEnvfv, __glXDispSwap_GetTexEnvfv},
- /* [ 75] = 131 */ {__glXDisp_GetTexEnviv, __glXDispSwap_GetTexEnviv},
- /* [ 76] = 132 */ {__glXDisp_GetTexGendv, __glXDispSwap_GetTexGendv},
- /* [ 77] = 133 */ {__glXDisp_GetTexGenfv, __glXDispSwap_GetTexGenfv},
- /* [ 78] = 134 */ {__glXDisp_GetTexGeniv, __glXDispSwap_GetTexGeniv},
- /* [ 79] = 135 */ {__glXDisp_GetTexImage, __glXDispSwap_GetTexImage},
- /* [ 80] = 136 */ {__glXDisp_GetTexParameterfv, __glXDispSwap_GetTexParameterfv},
- /* [ 81] = 137 */ {__glXDisp_GetTexParameteriv, __glXDispSwap_GetTexParameteriv},
- /* [ 82] = 138 */ {__glXDisp_GetTexLevelParameterfv, __glXDispSwap_GetTexLevelParameterfv},
- /* [ 83] = 139 */ {__glXDisp_GetTexLevelParameteriv, __glXDispSwap_GetTexLevelParameteriv},
- /* [ 84] = 140 */ {__glXDisp_IsEnabled, __glXDispSwap_IsEnabled},
- /* [ 85] = 141 */ {__glXDisp_IsList, __glXDispSwap_IsList},
- /* [ 86] = 142 */ {__glXDisp_Flush, __glXDispSwap_Flush},
- /* [ 87] = 143 */ {__glXDisp_AreTexturesResident, __glXDispSwap_AreTexturesResident},
- /* [ 88] = 144 */ {__glXDisp_DeleteTextures, __glXDispSwap_DeleteTextures},
- /* [ 89] = 145 */ {__glXDisp_GenTextures, __glXDispSwap_GenTextures},
- /* [ 90] = 146 */ {__glXDisp_IsTexture, __glXDispSwap_IsTexture},
- /* [ 91] = 147 */ {__glXDisp_GetColorTable, __glXDispSwap_GetColorTable},
- /* [ 92] = 148 */ {__glXDisp_GetColorTableParameterfv, __glXDispSwap_GetColorTableParameterfv},
- /* [ 93] = 149 */ {__glXDisp_GetColorTableParameteriv, __glXDispSwap_GetColorTableParameteriv},
- /* [ 94] = 150 */ {__glXDisp_GetConvolutionFilter, __glXDispSwap_GetConvolutionFilter},
- /* [ 95] = 151 */ {__glXDisp_GetConvolutionParameterfv, __glXDispSwap_GetConvolutionParameterfv},
- /* [ 96] = 152 */ {__glXDisp_GetConvolutionParameteriv, __glXDispSwap_GetConvolutionParameteriv},
- /* [ 97] = 153 */ {__glXDisp_GetSeparableFilter, __glXDispSwap_GetSeparableFilter},
- /* [ 98] = 154 */ {__glXDisp_GetHistogram, __glXDispSwap_GetHistogram},
- /* [ 99] = 155 */ {__glXDisp_GetHistogramParameterfv, __glXDispSwap_GetHistogramParameterfv},
- /* [ 100] = 156 */ {__glXDisp_GetHistogramParameteriv, __glXDispSwap_GetHistogramParameteriv},
- /* [ 101] = 157 */ {__glXDisp_GetMinmax, __glXDispSwap_GetMinmax},
- /* [ 102] = 158 */ {__glXDisp_GetMinmaxParameterfv, __glXDispSwap_GetMinmaxParameterfv},
- /* [ 103] = 159 */ {__glXDisp_GetMinmaxParameteriv, __glXDispSwap_GetMinmaxParameteriv},
- /* [ 104] = 160 */ {__glXDisp_GetCompressedTexImageARB, __glXDispSwap_GetCompressedTexImageARB},
- /* [ 105] = 161 */ {__glXDisp_DeleteQueriesARB, __glXDispSwap_DeleteQueriesARB},
- /* [ 106] = 162 */ {__glXDisp_GenQueriesARB, __glXDispSwap_GenQueriesARB},
- /* [ 107] = 163 */ {__glXDisp_IsQueryARB, __glXDispSwap_IsQueryARB},
- /* [ 108] = 164 */ {__glXDisp_GetQueryivARB, __glXDispSwap_GetQueryivARB},
- /* [ 109] = 165 */ {__glXDisp_GetQueryObjectivARB, __glXDispSwap_GetQueryObjectivARB},
- /* [ 110] = 166 */ {__glXDisp_GetQueryObjectuivARB, __glXDispSwap_GetQueryObjectuivARB},
- /* [ 111] = 167 */ {NULL, NULL},
-};
-
-const struct __glXDispatchInfo Single_dispatch_info = {
- 8,
- Single_dispatch_tree,
- Single_function_table,
- NULL,
- NULL
-};
-
-/*****************************************************************/
-/* tree depth = 8 */
-static const int_fast16_t Render_dispatch_tree[92] = {
- /* [0] -> opcode range [0, 8192], node depth 1 */
- 2,
- 5,
- 31,
- 54,
- EMPTY_LEAF,
-
- /* [5] -> opcode range [0, 2048], node depth 2 */
- 1,
- 8,
- EMPTY_LEAF,
-
- /* [8] -> opcode range [0, 1024], node depth 3 */
- 1,
- 11,
- EMPTY_LEAF,
-
- /* [11] -> opcode range [0, 512], node depth 4 */
- 1,
- 14,
- EMPTY_LEAF,
-
- /* [14] -> opcode range [0, 256], node depth 5 */
- 4,
- LEAF(0),
- LEAF(16),
- LEAF(32),
- LEAF(48),
- LEAF(64),
- LEAF(80),
- LEAF(96),
- LEAF(112),
- LEAF(128),
- LEAF(144),
- LEAF(160),
- LEAF(176),
- LEAF(192),
- LEAF(208),
- LEAF(224),
- EMPTY_LEAF,
-
- /* [31] -> opcode range [2048, 4096], node depth 2 */
- 1,
- 34,
- EMPTY_LEAF,
-
- /* [34] -> opcode range [2048, 3072], node depth 3 */
- 1,
- 37,
- EMPTY_LEAF,
-
- /* [37] -> opcode range [2048, 2560], node depth 4 */
- 1,
- 40,
- EMPTY_LEAF,
-
- /* [40] -> opcode range [2048, 2304], node depth 5 */
- 1,
- 43,
- EMPTY_LEAF,
-
- /* [43] -> opcode range [2048, 2176], node depth 6 */
- 1,
- 46,
- EMPTY_LEAF,
-
- /* [46] -> opcode range [2048, 2112], node depth 7 */
- 1,
- 49,
- EMPTY_LEAF,
-
- /* [49] -> opcode range [2048, 2080], node depth 8 */
- 2,
- LEAF(240),
- LEAF(248),
- LEAF(256),
- EMPTY_LEAF,
-
- /* [54] -> opcode range [4096, 6144], node depth 2 */
- 1,
- 57,
- EMPTY_LEAF,
-
- /* [57] -> opcode range [4096, 5120], node depth 3 */
- 1,
- 60,
- EMPTY_LEAF,
-
- /* [60] -> opcode range [4096, 4608], node depth 4 */
- 1,
- 63,
- EMPTY_LEAF,
-
- /* [63] -> opcode range [4096, 4352], node depth 5 */
- 4,
- LEAF(264),
- LEAF(280),
- 80,
- EMPTY_LEAF,
- EMPTY_LEAF,
- LEAF(296),
- LEAF(312),
- LEAF(328),
- LEAF(344),
- EMPTY_LEAF,
- 83,
- 86,
- EMPTY_LEAF,
- 89,
- LEAF(360),
- EMPTY_LEAF,
-
- /* [80] -> opcode range [4128, 4144], node depth 6 */
- 1,
- LEAF(376),
- EMPTY_LEAF,
-
- /* [83] -> opcode range [4256, 4272], node depth 6 */
- 1,
- EMPTY_LEAF,
- LEAF(384),
-
- /* [86] -> opcode range [4272, 4288], node depth 6 */
- 1,
- LEAF(392),
- EMPTY_LEAF,
-
- /* [89] -> opcode range [4304, 4320], node depth 6 */
- 1,
- EMPTY_LEAF,
- LEAF(400),
-
-};
-
-static const void *Render_function_table[408][2] = {
- /* [ 0] = 0 */ {NULL, NULL},
- /* [ 1] = 1 */ {__glXDisp_CallList, __glXDispSwap_CallList},
- /* [ 2] = 2 */ {__glXDisp_CallLists, __glXDispSwap_CallLists},
- /* [ 3] = 3 */ {__glXDisp_ListBase, __glXDispSwap_ListBase},
- /* [ 4] = 4 */ {__glXDisp_Begin, __glXDispSwap_Begin},
- /* [ 5] = 5 */ {__glXDisp_Bitmap, __glXDispSwap_Bitmap},
- /* [ 6] = 6 */ {__glXDisp_Color3bv, __glXDispSwap_Color3bv},
- /* [ 7] = 7 */ {__glXDisp_Color3dv, __glXDispSwap_Color3dv},
- /* [ 8] = 8 */ {__glXDisp_Color3fv, __glXDispSwap_Color3fv},
- /* [ 9] = 9 */ {__glXDisp_Color3iv, __glXDispSwap_Color3iv},
- /* [ 10] = 10 */ {__glXDisp_Color3sv, __glXDispSwap_Color3sv},
- /* [ 11] = 11 */ {__glXDisp_Color3ubv, __glXDispSwap_Color3ubv},
- /* [ 12] = 12 */ {__glXDisp_Color3uiv, __glXDispSwap_Color3uiv},
- /* [ 13] = 13 */ {__glXDisp_Color3usv, __glXDispSwap_Color3usv},
- /* [ 14] = 14 */ {__glXDisp_Color4bv, __glXDispSwap_Color4bv},
- /* [ 15] = 15 */ {__glXDisp_Color4dv, __glXDispSwap_Color4dv},
- /* [ 16] = 16 */ {__glXDisp_Color4fv, __glXDispSwap_Color4fv},
- /* [ 17] = 17 */ {__glXDisp_Color4iv, __glXDispSwap_Color4iv},
- /* [ 18] = 18 */ {__glXDisp_Color4sv, __glXDispSwap_Color4sv},
- /* [ 19] = 19 */ {__glXDisp_Color4ubv, __glXDispSwap_Color4ubv},
- /* [ 20] = 20 */ {__glXDisp_Color4uiv, __glXDispSwap_Color4uiv},
- /* [ 21] = 21 */ {__glXDisp_Color4usv, __glXDispSwap_Color4usv},
- /* [ 22] = 22 */ {__glXDisp_EdgeFlagv, __glXDispSwap_EdgeFlagv},
- /* [ 23] = 23 */ {__glXDisp_End, __glXDispSwap_End},
- /* [ 24] = 24 */ {__glXDisp_Indexdv, __glXDispSwap_Indexdv},
- /* [ 25] = 25 */ {__glXDisp_Indexfv, __glXDispSwap_Indexfv},
- /* [ 26] = 26 */ {__glXDisp_Indexiv, __glXDispSwap_Indexiv},
- /* [ 27] = 27 */ {__glXDisp_Indexsv, __glXDispSwap_Indexsv},
- /* [ 28] = 28 */ {__glXDisp_Normal3bv, __glXDispSwap_Normal3bv},
- /* [ 29] = 29 */ {__glXDisp_Normal3dv, __glXDispSwap_Normal3dv},
- /* [ 30] = 30 */ {__glXDisp_Normal3fv, __glXDispSwap_Normal3fv},
- /* [ 31] = 31 */ {__glXDisp_Normal3iv, __glXDispSwap_Normal3iv},
- /* [ 32] = 32 */ {__glXDisp_Normal3sv, __glXDispSwap_Normal3sv},
- /* [ 33] = 33 */ {__glXDisp_RasterPos2dv, __glXDispSwap_RasterPos2dv},
- /* [ 34] = 34 */ {__glXDisp_RasterPos2fv, __glXDispSwap_RasterPos2fv},
- /* [ 35] = 35 */ {__glXDisp_RasterPos2iv, __glXDispSwap_RasterPos2iv},
- /* [ 36] = 36 */ {__glXDisp_RasterPos2sv, __glXDispSwap_RasterPos2sv},
- /* [ 37] = 37 */ {__glXDisp_RasterPos3dv, __glXDispSwap_RasterPos3dv},
- /* [ 38] = 38 */ {__glXDisp_RasterPos3fv, __glXDispSwap_RasterPos3fv},
- /* [ 39] = 39 */ {__glXDisp_RasterPos3iv, __glXDispSwap_RasterPos3iv},
- /* [ 40] = 40 */ {__glXDisp_RasterPos3sv, __glXDispSwap_RasterPos3sv},
- /* [ 41] = 41 */ {__glXDisp_RasterPos4dv, __glXDispSwap_RasterPos4dv},
- /* [ 42] = 42 */ {__glXDisp_RasterPos4fv, __glXDispSwap_RasterPos4fv},
- /* [ 43] = 43 */ {__glXDisp_RasterPos4iv, __glXDispSwap_RasterPos4iv},
- /* [ 44] = 44 */ {__glXDisp_RasterPos4sv, __glXDispSwap_RasterPos4sv},
- /* [ 45] = 45 */ {__glXDisp_Rectdv, __glXDispSwap_Rectdv},
- /* [ 46] = 46 */ {__glXDisp_Rectfv, __glXDispSwap_Rectfv},
- /* [ 47] = 47 */ {__glXDisp_Rectiv, __glXDispSwap_Rectiv},
- /* [ 48] = 48 */ {__glXDisp_Rectsv, __glXDispSwap_Rectsv},
- /* [ 49] = 49 */ {__glXDisp_TexCoord1dv, __glXDispSwap_TexCoord1dv},
- /* [ 50] = 50 */ {__glXDisp_TexCoord1fv, __glXDispSwap_TexCoord1fv},
- /* [ 51] = 51 */ {__glXDisp_TexCoord1iv, __glXDispSwap_TexCoord1iv},
- /* [ 52] = 52 */ {__glXDisp_TexCoord1sv, __glXDispSwap_TexCoord1sv},
- /* [ 53] = 53 */ {__glXDisp_TexCoord2dv, __glXDispSwap_TexCoord2dv},
- /* [ 54] = 54 */ {__glXDisp_TexCoord2fv, __glXDispSwap_TexCoord2fv},
- /* [ 55] = 55 */ {__glXDisp_TexCoord2iv, __glXDispSwap_TexCoord2iv},
- /* [ 56] = 56 */ {__glXDisp_TexCoord2sv, __glXDispSwap_TexCoord2sv},
- /* [ 57] = 57 */ {__glXDisp_TexCoord3dv, __glXDispSwap_TexCoord3dv},
- /* [ 58] = 58 */ {__glXDisp_TexCoord3fv, __glXDispSwap_TexCoord3fv},
- /* [ 59] = 59 */ {__glXDisp_TexCoord3iv, __glXDispSwap_TexCoord3iv},
- /* [ 60] = 60 */ {__glXDisp_TexCoord3sv, __glXDispSwap_TexCoord3sv},
- /* [ 61] = 61 */ {__glXDisp_TexCoord4dv, __glXDispSwap_TexCoord4dv},
- /* [ 62] = 62 */ {__glXDisp_TexCoord4fv, __glXDispSwap_TexCoord4fv},
- /* [ 63] = 63 */ {__glXDisp_TexCoord4iv, __glXDispSwap_TexCoord4iv},
- /* [ 64] = 64 */ {__glXDisp_TexCoord4sv, __glXDispSwap_TexCoord4sv},
- /* [ 65] = 65 */ {__glXDisp_Vertex2dv, __glXDispSwap_Vertex2dv},
- /* [ 66] = 66 */ {__glXDisp_Vertex2fv, __glXDispSwap_Vertex2fv},
- /* [ 67] = 67 */ {__glXDisp_Vertex2iv, __glXDispSwap_Vertex2iv},
- /* [ 68] = 68 */ {__glXDisp_Vertex2sv, __glXDispSwap_Vertex2sv},
- /* [ 69] = 69 */ {__glXDisp_Vertex3dv, __glXDispSwap_Vertex3dv},
- /* [ 70] = 70 */ {__glXDisp_Vertex3fv, __glXDispSwap_Vertex3fv},
- /* [ 71] = 71 */ {__glXDisp_Vertex3iv, __glXDispSwap_Vertex3iv},
- /* [ 72] = 72 */ {__glXDisp_Vertex3sv, __glXDispSwap_Vertex3sv},
- /* [ 73] = 73 */ {__glXDisp_Vertex4dv, __glXDispSwap_Vertex4dv},
- /* [ 74] = 74 */ {__glXDisp_Vertex4fv, __glXDispSwap_Vertex4fv},
- /* [ 75] = 75 */ {__glXDisp_Vertex4iv, __glXDispSwap_Vertex4iv},
- /* [ 76] = 76 */ {__glXDisp_Vertex4sv, __glXDispSwap_Vertex4sv},
- /* [ 77] = 77 */ {__glXDisp_ClipPlane, __glXDispSwap_ClipPlane},
- /* [ 78] = 78 */ {__glXDisp_ColorMaterial, __glXDispSwap_ColorMaterial},
- /* [ 79] = 79 */ {__glXDisp_CullFace, __glXDispSwap_CullFace},
- /* [ 80] = 80 */ {__glXDisp_Fogf, __glXDispSwap_Fogf},
- /* [ 81] = 81 */ {__glXDisp_Fogfv, __glXDispSwap_Fogfv},
- /* [ 82] = 82 */ {__glXDisp_Fogi, __glXDispSwap_Fogi},
- /* [ 83] = 83 */ {__glXDisp_Fogiv, __glXDispSwap_Fogiv},
- /* [ 84] = 84 */ {__glXDisp_FrontFace, __glXDispSwap_FrontFace},
- /* [ 85] = 85 */ {__glXDisp_Hint, __glXDispSwap_Hint},
- /* [ 86] = 86 */ {__glXDisp_Lightf, __glXDispSwap_Lightf},
- /* [ 87] = 87 */ {__glXDisp_Lightfv, __glXDispSwap_Lightfv},
- /* [ 88] = 88 */ {__glXDisp_Lighti, __glXDispSwap_Lighti},
- /* [ 89] = 89 */ {__glXDisp_Lightiv, __glXDispSwap_Lightiv},
- /* [ 90] = 90 */ {__glXDisp_LightModelf, __glXDispSwap_LightModelf},
- /* [ 91] = 91 */ {__glXDisp_LightModelfv, __glXDispSwap_LightModelfv},
- /* [ 92] = 92 */ {__glXDisp_LightModeli, __glXDispSwap_LightModeli},
- /* [ 93] = 93 */ {__glXDisp_LightModeliv, __glXDispSwap_LightModeliv},
- /* [ 94] = 94 */ {__glXDisp_LineStipple, __glXDispSwap_LineStipple},
- /* [ 95] = 95 */ {__glXDisp_LineWidth, __glXDispSwap_LineWidth},
- /* [ 96] = 96 */ {__glXDisp_Materialf, __glXDispSwap_Materialf},
- /* [ 97] = 97 */ {__glXDisp_Materialfv, __glXDispSwap_Materialfv},
- /* [ 98] = 98 */ {__glXDisp_Materiali, __glXDispSwap_Materiali},
- /* [ 99] = 99 */ {__glXDisp_Materialiv, __glXDispSwap_Materialiv},
- /* [ 100] = 100 */ {__glXDisp_PointSize, __glXDispSwap_PointSize},
- /* [ 101] = 101 */ {__glXDisp_PolygonMode, __glXDispSwap_PolygonMode},
- /* [ 102] = 102 */ {__glXDisp_PolygonStipple, __glXDispSwap_PolygonStipple},
- /* [ 103] = 103 */ {__glXDisp_Scissor, __glXDispSwap_Scissor},
- /* [ 104] = 104 */ {__glXDisp_ShadeModel, __glXDispSwap_ShadeModel},
- /* [ 105] = 105 */ {__glXDisp_TexParameterf, __glXDispSwap_TexParameterf},
- /* [ 106] = 106 */ {__glXDisp_TexParameterfv, __glXDispSwap_TexParameterfv},
- /* [ 107] = 107 */ {__glXDisp_TexParameteri, __glXDispSwap_TexParameteri},
- /* [ 108] = 108 */ {__glXDisp_TexParameteriv, __glXDispSwap_TexParameteriv},
- /* [ 109] = 109 */ {__glXDisp_TexImage1D, __glXDispSwap_TexImage1D},
- /* [ 110] = 110 */ {__glXDisp_TexImage2D, __glXDispSwap_TexImage2D},
- /* [ 111] = 111 */ {__glXDisp_TexEnvf, __glXDispSwap_TexEnvf},
- /* [ 112] = 112 */ {__glXDisp_TexEnvfv, __glXDispSwap_TexEnvfv},
- /* [ 113] = 113 */ {__glXDisp_TexEnvi, __glXDispSwap_TexEnvi},
- /* [ 114] = 114 */ {__glXDisp_TexEnviv, __glXDispSwap_TexEnviv},
- /* [ 115] = 115 */ {__glXDisp_TexGend, __glXDispSwap_TexGend},
- /* [ 116] = 116 */ {__glXDisp_TexGendv, __glXDispSwap_TexGendv},
- /* [ 117] = 117 */ {__glXDisp_TexGenf, __glXDispSwap_TexGenf},
- /* [ 118] = 118 */ {__glXDisp_TexGenfv, __glXDispSwap_TexGenfv},
- /* [ 119] = 119 */ {__glXDisp_TexGeni, __glXDispSwap_TexGeni},
- /* [ 120] = 120 */ {__glXDisp_TexGeniv, __glXDispSwap_TexGeniv},
- /* [ 121] = 121 */ {__glXDisp_InitNames, __glXDispSwap_InitNames},
- /* [ 122] = 122 */ {__glXDisp_LoadName, __glXDispSwap_LoadName},
- /* [ 123] = 123 */ {__glXDisp_PassThrough, __glXDispSwap_PassThrough},
- /* [ 124] = 124 */ {__glXDisp_PopName, __glXDispSwap_PopName},
- /* [ 125] = 125 */ {__glXDisp_PushName, __glXDispSwap_PushName},
- /* [ 126] = 126 */ {__glXDisp_DrawBuffer, __glXDispSwap_DrawBuffer},
- /* [ 127] = 127 */ {__glXDisp_Clear, __glXDispSwap_Clear},
- /* [ 128] = 128 */ {__glXDisp_ClearAccum, __glXDispSwap_ClearAccum},
- /* [ 129] = 129 */ {__glXDisp_ClearIndex, __glXDispSwap_ClearIndex},
- /* [ 130] = 130 */ {__glXDisp_ClearColor, __glXDispSwap_ClearColor},
- /* [ 131] = 131 */ {__glXDisp_ClearStencil, __glXDispSwap_ClearStencil},
- /* [ 132] = 132 */ {__glXDisp_ClearDepth, __glXDispSwap_ClearDepth},
- /* [ 133] = 133 */ {__glXDisp_StencilMask, __glXDispSwap_StencilMask},
- /* [ 134] = 134 */ {__glXDisp_ColorMask, __glXDispSwap_ColorMask},
- /* [ 135] = 135 */ {__glXDisp_DepthMask, __glXDispSwap_DepthMask},
- /* [ 136] = 136 */ {__glXDisp_IndexMask, __glXDispSwap_IndexMask},
- /* [ 137] = 137 */ {__glXDisp_Accum, __glXDispSwap_Accum},
- /* [ 138] = 138 */ {__glXDisp_Disable, __glXDispSwap_Disable},
- /* [ 139] = 139 */ {__glXDisp_Enable, __glXDispSwap_Enable},
- /* [ 140] = 140 */ {NULL, NULL},
- /* [ 141] = 141 */ {__glXDisp_PopAttrib, __glXDispSwap_PopAttrib},
- /* [ 142] = 142 */ {__glXDisp_PushAttrib, __glXDispSwap_PushAttrib},
- /* [ 143] = 143 */ {__glXDisp_Map1d, __glXDispSwap_Map1d},
- /* [ 144] = 144 */ {__glXDisp_Map1f, __glXDispSwap_Map1f},
- /* [ 145] = 145 */ {__glXDisp_Map2d, __glXDispSwap_Map2d},
- /* [ 146] = 146 */ {__glXDisp_Map2f, __glXDispSwap_Map2f},
- /* [ 147] = 147 */ {__glXDisp_MapGrid1d, __glXDispSwap_MapGrid1d},
- /* [ 148] = 148 */ {__glXDisp_MapGrid1f, __glXDispSwap_MapGrid1f},
- /* [ 149] = 149 */ {__glXDisp_MapGrid2d, __glXDispSwap_MapGrid2d},
- /* [ 150] = 150 */ {__glXDisp_MapGrid2f, __glXDispSwap_MapGrid2f},
- /* [ 151] = 151 */ {__glXDisp_EvalCoord1dv, __glXDispSwap_EvalCoord1dv},
- /* [ 152] = 152 */ {__glXDisp_EvalCoord1fv, __glXDispSwap_EvalCoord1fv},
- /* [ 153] = 153 */ {__glXDisp_EvalCoord2dv, __glXDispSwap_EvalCoord2dv},
- /* [ 154] = 154 */ {__glXDisp_EvalCoord2fv, __glXDispSwap_EvalCoord2fv},
- /* [ 155] = 155 */ {__glXDisp_EvalMesh1, __glXDispSwap_EvalMesh1},
- /* [ 156] = 156 */ {__glXDisp_EvalPoint1, __glXDispSwap_EvalPoint1},
- /* [ 157] = 157 */ {__glXDisp_EvalMesh2, __glXDispSwap_EvalMesh2},
- /* [ 158] = 158 */ {__glXDisp_EvalPoint2, __glXDispSwap_EvalPoint2},
- /* [ 159] = 159 */ {__glXDisp_AlphaFunc, __glXDispSwap_AlphaFunc},
- /* [ 160] = 160 */ {__glXDisp_BlendFunc, __glXDispSwap_BlendFunc},
- /* [ 161] = 161 */ {__glXDisp_LogicOp, __glXDispSwap_LogicOp},
- /* [ 162] = 162 */ {__glXDisp_StencilFunc, __glXDispSwap_StencilFunc},
- /* [ 163] = 163 */ {__glXDisp_StencilOp, __glXDispSwap_StencilOp},
- /* [ 164] = 164 */ {__glXDisp_DepthFunc, __glXDispSwap_DepthFunc},
- /* [ 165] = 165 */ {__glXDisp_PixelZoom, __glXDispSwap_PixelZoom},
- /* [ 166] = 166 */ {__glXDisp_PixelTransferf, __glXDispSwap_PixelTransferf},
- /* [ 167] = 167 */ {__glXDisp_PixelTransferi, __glXDispSwap_PixelTransferi},
- /* [ 168] = 168 */ {__glXDisp_PixelMapfv, __glXDispSwap_PixelMapfv},
- /* [ 169] = 169 */ {__glXDisp_PixelMapuiv, __glXDispSwap_PixelMapuiv},
- /* [ 170] = 170 */ {__glXDisp_PixelMapusv, __glXDispSwap_PixelMapusv},
- /* [ 171] = 171 */ {__glXDisp_ReadBuffer, __glXDispSwap_ReadBuffer},
- /* [ 172] = 172 */ {__glXDisp_CopyPixels, __glXDispSwap_CopyPixels},
- /* [ 173] = 173 */ {__glXDisp_DrawPixels, __glXDispSwap_DrawPixels},
- /* [ 174] = 174 */ {__glXDisp_DepthRange, __glXDispSwap_DepthRange},
- /* [ 175] = 175 */ {__glXDisp_Frustum, __glXDispSwap_Frustum},
- /* [ 176] = 176 */ {__glXDisp_LoadIdentity, __glXDispSwap_LoadIdentity},
- /* [ 177] = 177 */ {__glXDisp_LoadMatrixf, __glXDispSwap_LoadMatrixf},
- /* [ 178] = 178 */ {__glXDisp_LoadMatrixd, __glXDispSwap_LoadMatrixd},
- /* [ 179] = 179 */ {__glXDisp_MatrixMode, __glXDispSwap_MatrixMode},
- /* [ 180] = 180 */ {__glXDisp_MultMatrixf, __glXDispSwap_MultMatrixf},
- /* [ 181] = 181 */ {__glXDisp_MultMatrixd, __glXDispSwap_MultMatrixd},
- /* [ 182] = 182 */ {__glXDisp_Ortho, __glXDispSwap_Ortho},
- /* [ 183] = 183 */ {__glXDisp_PopMatrix, __glXDispSwap_PopMatrix},
- /* [ 184] = 184 */ {__glXDisp_PushMatrix, __glXDispSwap_PushMatrix},
- /* [ 185] = 185 */ {__glXDisp_Rotated, __glXDispSwap_Rotated},
- /* [ 186] = 186 */ {__glXDisp_Rotatef, __glXDispSwap_Rotatef},
- /* [ 187] = 187 */ {__glXDisp_Scaled, __glXDispSwap_Scaled},
- /* [ 188] = 188 */ {__glXDisp_Scalef, __glXDispSwap_Scalef},
- /* [ 189] = 189 */ {__glXDisp_Translated, __glXDispSwap_Translated},
- /* [ 190] = 190 */ {__glXDisp_Translatef, __glXDispSwap_Translatef},
- /* [ 191] = 191 */ {__glXDisp_Viewport, __glXDispSwap_Viewport},
- /* [ 192] = 192 */ {__glXDisp_PolygonOffset, __glXDispSwap_PolygonOffset},
- /* [ 193] = 193 */ {__glXDisp_DrawArrays, __glXDispSwap_DrawArrays},
- /* [ 194] = 194 */ {__glXDisp_Indexubv, __glXDispSwap_Indexubv},
- /* [ 195] = 195 */ {__glXDisp_ColorSubTable, __glXDispSwap_ColorSubTable},
- /* [ 196] = 196 */ {__glXDisp_CopyColorSubTable, __glXDispSwap_CopyColorSubTable},
- /* [ 197] = 197 */ {__glXDisp_ActiveTextureARB, __glXDispSwap_ActiveTextureARB},
- /* [ 198] = 198 */ {__glXDisp_MultiTexCoord1dvARB, __glXDispSwap_MultiTexCoord1dvARB},
- /* [ 199] = 199 */ {__glXDisp_MultiTexCoord1fvARB, __glXDispSwap_MultiTexCoord1fvARB},
- /* [ 200] = 200 */ {__glXDisp_MultiTexCoord1ivARB, __glXDispSwap_MultiTexCoord1ivARB},
- /* [ 201] = 201 */ {__glXDisp_MultiTexCoord1svARB, __glXDispSwap_MultiTexCoord1svARB},
- /* [ 202] = 202 */ {__glXDisp_MultiTexCoord2dvARB, __glXDispSwap_MultiTexCoord2dvARB},
- /* [ 203] = 203 */ {__glXDisp_MultiTexCoord2fvARB, __glXDispSwap_MultiTexCoord2fvARB},
- /* [ 204] = 204 */ {__glXDisp_MultiTexCoord2ivARB, __glXDispSwap_MultiTexCoord2ivARB},
- /* [ 205] = 205 */ {__glXDisp_MultiTexCoord2svARB, __glXDispSwap_MultiTexCoord2svARB},
- /* [ 206] = 206 */ {__glXDisp_MultiTexCoord3dvARB, __glXDispSwap_MultiTexCoord3dvARB},
- /* [ 207] = 207 */ {__glXDisp_MultiTexCoord3fvARB, __glXDispSwap_MultiTexCoord3fvARB},
- /* [ 208] = 208 */ {__glXDisp_MultiTexCoord3ivARB, __glXDispSwap_MultiTexCoord3ivARB},
- /* [ 209] = 209 */ {__glXDisp_MultiTexCoord3svARB, __glXDispSwap_MultiTexCoord3svARB},
- /* [ 210] = 210 */ {__glXDisp_MultiTexCoord4dvARB, __glXDispSwap_MultiTexCoord4dvARB},
- /* [ 211] = 211 */ {__glXDisp_MultiTexCoord4fvARB, __glXDispSwap_MultiTexCoord4fvARB},
- /* [ 212] = 212 */ {__glXDisp_MultiTexCoord4ivARB, __glXDispSwap_MultiTexCoord4ivARB},
- /* [ 213] = 213 */ {__glXDisp_MultiTexCoord4svARB, __glXDispSwap_MultiTexCoord4svARB},
- /* [ 214] = 214 */ {__glXDisp_CompressedTexImage1DARB, __glXDispSwap_CompressedTexImage1DARB},
- /* [ 215] = 215 */ {__glXDisp_CompressedTexImage2DARB, __glXDispSwap_CompressedTexImage2DARB},
- /* [ 216] = 216 */ {__glXDisp_CompressedTexImage3DARB, __glXDispSwap_CompressedTexImage3DARB},
- /* [ 217] = 217 */ {__glXDisp_CompressedTexSubImage1DARB, __glXDispSwap_CompressedTexSubImage1DARB},
- /* [ 218] = 218 */ {__glXDisp_CompressedTexSubImage2DARB, __glXDispSwap_CompressedTexSubImage2DARB},
- /* [ 219] = 219 */ {__glXDisp_CompressedTexSubImage3DARB, __glXDispSwap_CompressedTexSubImage3DARB},
- /* [ 220] = 220 */ {NULL, NULL},
- /* [ 221] = 221 */ {NULL, NULL},
- /* [ 222] = 222 */ {NULL, NULL},
- /* [ 223] = 223 */ {NULL, NULL},
- /* [ 224] = 224 */ {NULL, NULL},
- /* [ 225] = 225 */ {NULL, NULL},
- /* [ 226] = 226 */ {NULL, NULL},
- /* [ 227] = 227 */ {NULL, NULL},
- /* [ 228] = 228 */ {NULL, NULL},
- /* [ 229] = 229 */ {__glXDisp_SampleCoverageARB, __glXDispSwap_SampleCoverageARB},
- /* [ 230] = 230 */ {__glXDisp_WindowPos3fvMESA, __glXDispSwap_WindowPos3fvMESA},
- /* [ 231] = 231 */ {__glXDisp_BeginQueryARB, __glXDispSwap_BeginQueryARB},
- /* [ 232] = 232 */ {__glXDisp_EndQueryARB, __glXDispSwap_EndQueryARB},
- /* [ 233] = 233 */ {__glXDisp_DrawBuffersARB, __glXDispSwap_DrawBuffersARB},
- /* [ 234] = 234 */ {__glXDisp_ClampColorARB, __glXDispSwap_ClampColorARB},
- /* [ 235] = 235 */ {NULL, NULL},
- /* [ 236] = 236 */ {NULL, NULL},
- /* [ 237] = 237 */ {__glXDisp_FramebufferTextureLayerEXT, __glXDispSwap_FramebufferTextureLayerEXT},
- /* [ 238] = 238 */ {NULL, NULL},
- /* [ 239] = 239 */ {NULL, NULL},
- /* [ 240] = 2048 */ {__glXDisp_SampleMaskSGIS, __glXDispSwap_SampleMaskSGIS},
- /* [ 241] = 2049 */ {__glXDisp_SamplePatternSGIS, __glXDispSwap_SamplePatternSGIS},
- /* [ 242] = 2050 */ {NULL, NULL},
- /* [ 243] = 2051 */ {NULL, NULL},
- /* [ 244] = 2052 */ {NULL, NULL},
- /* [ 245] = 2053 */ {__glXDisp_ColorTable, __glXDispSwap_ColorTable},
- /* [ 246] = 2054 */ {__glXDisp_ColorTableParameterfv, __glXDispSwap_ColorTableParameterfv},
- /* [ 247] = 2055 */ {__glXDisp_ColorTableParameteriv, __glXDispSwap_ColorTableParameteriv},
- /* [ 248] = 2056 */ {__glXDisp_CopyColorTable, __glXDispSwap_CopyColorTable},
- /* [ 249] = 2057 */ {NULL, NULL},
- /* [ 250] = 2058 */ {NULL, NULL},
- /* [ 251] = 2059 */ {NULL, NULL},
- /* [ 252] = 2060 */ {NULL, NULL},
- /* [ 253] = 2061 */ {NULL, NULL},
- /* [ 254] = 2062 */ {NULL, NULL},
- /* [ 255] = 2063 */ {NULL, NULL},
- /* [ 256] = 2064 */ {NULL, NULL},
- /* [ 257] = 2065 */ {__glXDisp_PointParameterfEXT, __glXDispSwap_PointParameterfEXT},
- /* [ 258] = 2066 */ {__glXDisp_PointParameterfvEXT, __glXDispSwap_PointParameterfvEXT},
- /* [ 259] = 2067 */ {NULL, NULL},
- /* [ 260] = 2068 */ {NULL, NULL},
- /* [ 261] = 2069 */ {NULL, NULL},
- /* [ 262] = 2070 */ {NULL, NULL},
- /* [ 263] = 2071 */ {NULL, NULL},
- /* [ 264] = 4096 */ {__glXDisp_BlendColor, __glXDispSwap_BlendColor},
- /* [ 265] = 4097 */ {__glXDisp_BlendEquation, __glXDispSwap_BlendEquation},
- /* [ 266] = 4098 */ {NULL, NULL},
- /* [ 267] = 4099 */ {__glXDisp_TexSubImage1D, __glXDispSwap_TexSubImage1D},
- /* [ 268] = 4100 */ {__glXDisp_TexSubImage2D, __glXDispSwap_TexSubImage2D},
- /* [ 269] = 4101 */ {__glXDisp_ConvolutionFilter1D, __glXDispSwap_ConvolutionFilter1D},
- /* [ 270] = 4102 */ {__glXDisp_ConvolutionFilter2D, __glXDispSwap_ConvolutionFilter2D},
- /* [ 271] = 4103 */ {__glXDisp_ConvolutionParameterf, __glXDispSwap_ConvolutionParameterf},
- /* [ 272] = 4104 */ {__glXDisp_ConvolutionParameterfv, __glXDispSwap_ConvolutionParameterfv},
- /* [ 273] = 4105 */ {__glXDisp_ConvolutionParameteri, __glXDispSwap_ConvolutionParameteri},
- /* [ 274] = 4106 */ {__glXDisp_ConvolutionParameteriv, __glXDispSwap_ConvolutionParameteriv},
- /* [ 275] = 4107 */ {__glXDisp_CopyConvolutionFilter1D, __glXDispSwap_CopyConvolutionFilter1D},
- /* [ 276] = 4108 */ {__glXDisp_CopyConvolutionFilter2D, __glXDispSwap_CopyConvolutionFilter2D},
- /* [ 277] = 4109 */ {__glXDisp_SeparableFilter2D, __glXDispSwap_SeparableFilter2D},
- /* [ 278] = 4110 */ {__glXDisp_Histogram, __glXDispSwap_Histogram},
- /* [ 279] = 4111 */ {__glXDisp_Minmax, __glXDispSwap_Minmax},
- /* [ 280] = 4112 */ {__glXDisp_ResetHistogram, __glXDispSwap_ResetHistogram},
- /* [ 281] = 4113 */ {__glXDisp_ResetMinmax, __glXDispSwap_ResetMinmax},
- /* [ 282] = 4114 */ {__glXDisp_TexImage3D, __glXDispSwap_TexImage3D},
- /* [ 283] = 4115 */ {__glXDisp_TexSubImage3D, __glXDispSwap_TexSubImage3D},
- /* [ 284] = 4116 */ {NULL, NULL},
- /* [ 285] = 4117 */ {__glXDisp_BindTexture, __glXDispSwap_BindTexture},
- /* [ 286] = 4118 */ {__glXDisp_PrioritizeTextures, __glXDispSwap_PrioritizeTextures},
- /* [ 287] = 4119 */ {__glXDisp_CopyTexImage1D, __glXDispSwap_CopyTexImage1D},
- /* [ 288] = 4120 */ {__glXDisp_CopyTexImage2D, __glXDispSwap_CopyTexImage2D},
- /* [ 289] = 4121 */ {__glXDisp_CopyTexSubImage1D, __glXDispSwap_CopyTexSubImage1D},
- /* [ 290] = 4122 */ {__glXDisp_CopyTexSubImage2D, __glXDispSwap_CopyTexSubImage2D},
- /* [ 291] = 4123 */ {__glXDisp_CopyTexSubImage3D, __glXDispSwap_CopyTexSubImage3D},
- /* [ 292] = 4124 */ {__glXDisp_FogCoordfvEXT, __glXDispSwap_FogCoordfvEXT},
- /* [ 293] = 4125 */ {__glXDisp_FogCoorddvEXT, __glXDispSwap_FogCoorddvEXT},
- /* [ 294] = 4126 */ {__glXDisp_SecondaryColor3bvEXT, __glXDispSwap_SecondaryColor3bvEXT},
- /* [ 295] = 4127 */ {__glXDisp_SecondaryColor3svEXT, __glXDispSwap_SecondaryColor3svEXT},
- /* [ 296] = 4176 */ {NULL, NULL},
- /* [ 297] = 4177 */ {NULL, NULL},
- /* [ 298] = 4178 */ {NULL, NULL},
- /* [ 299] = 4179 */ {NULL, NULL},
- /* [ 300] = 4180 */ {__glXDisp_BindProgramNV, __glXDispSwap_BindProgramNV},
- /* [ 301] = 4181 */ {__glXDisp_ExecuteProgramNV, __glXDispSwap_ExecuteProgramNV},
- /* [ 302] = 4182 */ {__glXDisp_RequestResidentProgramsNV, __glXDispSwap_RequestResidentProgramsNV},
- /* [ 303] = 4183 */ {__glXDisp_LoadProgramNV, __glXDispSwap_LoadProgramNV},
- /* [ 304] = 4184 */ {__glXDisp_ProgramEnvParameter4fvARB, __glXDispSwap_ProgramEnvParameter4fvARB},
- /* [ 305] = 4185 */ {__glXDisp_ProgramEnvParameter4dvARB, __glXDispSwap_ProgramEnvParameter4dvARB},
- /* [ 306] = 4186 */ {__glXDisp_ProgramParameters4fvNV, __glXDispSwap_ProgramParameters4fvNV},
- /* [ 307] = 4187 */ {__glXDisp_ProgramParameters4dvNV, __glXDispSwap_ProgramParameters4dvNV},
- /* [ 308] = 4188 */ {__glXDisp_TrackMatrixNV, __glXDispSwap_TrackMatrixNV},
- /* [ 309] = 4189 */ {__glXDisp_VertexAttrib1svARB, __glXDispSwap_VertexAttrib1svARB},
- /* [ 310] = 4190 */ {__glXDisp_VertexAttrib2svARB, __glXDispSwap_VertexAttrib2svARB},
- /* [ 311] = 4191 */ {__glXDisp_VertexAttrib3svARB, __glXDispSwap_VertexAttrib3svARB},
- /* [ 312] = 4192 */ {__glXDisp_VertexAttrib4svARB, __glXDispSwap_VertexAttrib4svARB},
- /* [ 313] = 4193 */ {__glXDisp_VertexAttrib1fvARB, __glXDispSwap_VertexAttrib1fvARB},
- /* [ 314] = 4194 */ {__glXDisp_VertexAttrib2fvARB, __glXDispSwap_VertexAttrib2fvARB},
- /* [ 315] = 4195 */ {__glXDisp_VertexAttrib3fvARB, __glXDispSwap_VertexAttrib3fvARB},
- /* [ 316] = 4196 */ {__glXDisp_VertexAttrib4fvARB, __glXDispSwap_VertexAttrib4fvARB},
- /* [ 317] = 4197 */ {__glXDisp_VertexAttrib1dvARB, __glXDispSwap_VertexAttrib1dvARB},
- /* [ 318] = 4198 */ {__glXDisp_VertexAttrib2dvARB, __glXDispSwap_VertexAttrib2dvARB},
- /* [ 319] = 4199 */ {__glXDisp_VertexAttrib3dvARB, __glXDispSwap_VertexAttrib3dvARB},
- /* [ 320] = 4200 */ {__glXDisp_VertexAttrib4dvARB, __glXDispSwap_VertexAttrib4dvARB},
- /* [ 321] = 4201 */ {__glXDisp_VertexAttrib4NubvARB, __glXDispSwap_VertexAttrib4NubvARB},
- /* [ 322] = 4202 */ {__glXDisp_VertexAttribs1svNV, __glXDispSwap_VertexAttribs1svNV},
- /* [ 323] = 4203 */ {__glXDisp_VertexAttribs2svNV, __glXDispSwap_VertexAttribs2svNV},
- /* [ 324] = 4204 */ {__glXDisp_VertexAttribs3svNV, __glXDispSwap_VertexAttribs3svNV},
- /* [ 325] = 4205 */ {__glXDisp_VertexAttribs4svNV, __glXDispSwap_VertexAttribs4svNV},
- /* [ 326] = 4206 */ {__glXDisp_VertexAttribs1fvNV, __glXDispSwap_VertexAttribs1fvNV},
- /* [ 327] = 4207 */ {__glXDisp_VertexAttribs2fvNV, __glXDispSwap_VertexAttribs2fvNV},
- /* [ 328] = 4208 */ {__glXDisp_VertexAttribs3fvNV, __glXDispSwap_VertexAttribs3fvNV},
- /* [ 329] = 4209 */ {__glXDisp_VertexAttribs4fvNV, __glXDispSwap_VertexAttribs4fvNV},
- /* [ 330] = 4210 */ {__glXDisp_VertexAttribs1dvNV, __glXDispSwap_VertexAttribs1dvNV},
- /* [ 331] = 4211 */ {__glXDisp_VertexAttribs2dvNV, __glXDispSwap_VertexAttribs2dvNV},
- /* [ 332] = 4212 */ {__glXDisp_VertexAttribs3dvNV, __glXDispSwap_VertexAttribs3dvNV},
- /* [ 333] = 4213 */ {__glXDisp_VertexAttribs4dvNV, __glXDispSwap_VertexAttribs4dvNV},
- /* [ 334] = 4214 */ {__glXDisp_VertexAttribs4ubvNV, __glXDispSwap_VertexAttribs4ubvNV},
- /* [ 335] = 4215 */ {__glXDisp_ProgramLocalParameter4fvARB, __glXDispSwap_ProgramLocalParameter4fvARB},
- /* [ 336] = 4216 */ {__glXDisp_ProgramLocalParameter4dvARB, __glXDispSwap_ProgramLocalParameter4dvARB},
- /* [ 337] = 4217 */ {__glXDisp_ProgramStringARB, __glXDispSwap_ProgramStringARB},
- /* [ 338] = 4218 */ {__glXDisp_ProgramNamedParameter4fvNV, __glXDispSwap_ProgramNamedParameter4fvNV},
- /* [ 339] = 4219 */ {__glXDisp_ProgramNamedParameter4dvNV, __glXDispSwap_ProgramNamedParameter4dvNV},
- /* [ 340] = 4220 */ {__glXDisp_ActiveStencilFaceEXT, __glXDispSwap_ActiveStencilFaceEXT},
- /* [ 341] = 4221 */ {__glXDisp_PointParameteriNV, __glXDispSwap_PointParameteriNV},
- /* [ 342] = 4222 */ {__glXDisp_PointParameterivNV, __glXDispSwap_PointParameterivNV},
- /* [ 343] = 4223 */ {NULL, NULL},
- /* [ 344] = 4224 */ {NULL, NULL},
- /* [ 345] = 4225 */ {NULL, NULL},
- /* [ 346] = 4226 */ {NULL, NULL},
- /* [ 347] = 4227 */ {NULL, NULL},
- /* [ 348] = 4228 */ {__glXDisp_BlendEquationSeparateEXT, __glXDispSwap_BlendEquationSeparateEXT},
- /* [ 349] = 4229 */ {NULL, NULL},
- /* [ 350] = 4230 */ {__glXDisp_VertexAttrib4bvARB, __glXDispSwap_VertexAttrib4bvARB},
- /* [ 351] = 4231 */ {__glXDisp_VertexAttrib4ivARB, __glXDispSwap_VertexAttrib4ivARB},
- /* [ 352] = 4232 */ {__glXDisp_VertexAttrib4ubvARB, __glXDispSwap_VertexAttrib4ubvARB},
- /* [ 353] = 4233 */ {__glXDisp_VertexAttrib4usvARB, __glXDispSwap_VertexAttrib4usvARB},
- /* [ 354] = 4234 */ {__glXDisp_VertexAttrib4uivARB, __glXDispSwap_VertexAttrib4uivARB},
- /* [ 355] = 4235 */ {__glXDisp_VertexAttrib4NbvARB, __glXDispSwap_VertexAttrib4NbvARB},
- /* [ 356] = 4236 */ {__glXDisp_VertexAttrib4NsvARB, __glXDispSwap_VertexAttrib4NsvARB},
- /* [ 357] = 4237 */ {__glXDisp_VertexAttrib4NivARB, __glXDispSwap_VertexAttrib4NivARB},
- /* [ 358] = 4238 */ {__glXDisp_VertexAttrib4NusvARB, __glXDispSwap_VertexAttrib4NusvARB},
- /* [ 359] = 4239 */ {__glXDisp_VertexAttrib4NuivARB, __glXDispSwap_VertexAttrib4NuivARB},
- /* [ 360] = 4320 */ {__glXDisp_DeleteFramebuffersEXT, __glXDispSwap_DeleteFramebuffersEXT},
- /* [ 361] = 4321 */ {__glXDisp_FramebufferTexture1DEXT, __glXDispSwap_FramebufferTexture1DEXT},
- /* [ 362] = 4322 */ {__glXDisp_FramebufferTexture2DEXT, __glXDispSwap_FramebufferTexture2DEXT},
- /* [ 363] = 4323 */ {__glXDisp_FramebufferTexture3DEXT, __glXDispSwap_FramebufferTexture3DEXT},
- /* [ 364] = 4324 */ {__glXDisp_FramebufferRenderbufferEXT, __glXDispSwap_FramebufferRenderbufferEXT},
- /* [ 365] = 4325 */ {__glXDisp_GenerateMipmapEXT, __glXDispSwap_GenerateMipmapEXT},
- /* [ 366] = 4326 */ {NULL, NULL},
- /* [ 367] = 4327 */ {NULL, NULL},
- /* [ 368] = 4328 */ {NULL, NULL},
- /* [ 369] = 4329 */ {NULL, NULL},
- /* [ 370] = 4330 */ {__glXDisp_BlitFramebufferEXT, __glXDispSwap_BlitFramebufferEXT},
- /* [ 371] = 4331 */ {__glXDisp_RenderbufferStorageMultisample, __glXDispSwap_RenderbufferStorageMultisample},
- /* [ 372] = 4332 */ {NULL, NULL},
- /* [ 373] = 4333 */ {NULL, NULL},
- /* [ 374] = 4334 */ {NULL, NULL},
- /* [ 375] = 4335 */ {NULL, NULL},
- /* [ 376] = 4128 */ {__glXDisp_SecondaryColor3ivEXT, __glXDispSwap_SecondaryColor3ivEXT},
- /* [ 377] = 4129 */ {__glXDisp_SecondaryColor3fvEXT, __glXDispSwap_SecondaryColor3fvEXT},
- /* [ 378] = 4130 */ {__glXDisp_SecondaryColor3dvEXT, __glXDispSwap_SecondaryColor3dvEXT},
- /* [ 379] = 4131 */ {__glXDisp_SecondaryColor3ubvEXT, __glXDispSwap_SecondaryColor3ubvEXT},
- /* [ 380] = 4132 */ {__glXDisp_SecondaryColor3usvEXT, __glXDispSwap_SecondaryColor3usvEXT},
- /* [ 381] = 4133 */ {__glXDisp_SecondaryColor3uivEXT, __glXDispSwap_SecondaryColor3uivEXT},
- /* [ 382] = 4134 */ {__glXDisp_BlendFuncSeparateEXT, __glXDispSwap_BlendFuncSeparateEXT},
- /* [ 383] = 4135 */ {NULL, NULL},
- /* [ 384] = 4264 */ {NULL, NULL},
- /* [ 385] = 4265 */ {__glXDisp_VertexAttrib1svNV, __glXDispSwap_VertexAttrib1svNV},
- /* [ 386] = 4266 */ {__glXDisp_VertexAttrib2svNV, __glXDispSwap_VertexAttrib2svNV},
- /* [ 387] = 4267 */ {__glXDisp_VertexAttrib3svNV, __glXDispSwap_VertexAttrib3svNV},
- /* [ 388] = 4268 */ {__glXDisp_VertexAttrib4svNV, __glXDispSwap_VertexAttrib4svNV},
- /* [ 389] = 4269 */ {__glXDisp_VertexAttrib1fvNV, __glXDispSwap_VertexAttrib1fvNV},
- /* [ 390] = 4270 */ {__glXDisp_VertexAttrib2fvNV, __glXDispSwap_VertexAttrib2fvNV},
- /* [ 391] = 4271 */ {__glXDisp_VertexAttrib3fvNV, __glXDispSwap_VertexAttrib3fvNV},
- /* [ 392] = 4272 */ {__glXDisp_VertexAttrib4fvNV, __glXDispSwap_VertexAttrib4fvNV},
- /* [ 393] = 4273 */ {__glXDisp_VertexAttrib1dvNV, __glXDispSwap_VertexAttrib1dvNV},
- /* [ 394] = 4274 */ {__glXDisp_VertexAttrib2dvNV, __glXDispSwap_VertexAttrib2dvNV},
- /* [ 395] = 4275 */ {__glXDisp_VertexAttrib3dvNV, __glXDispSwap_VertexAttrib3dvNV},
- /* [ 396] = 4276 */ {__glXDisp_VertexAttrib4dvNV, __glXDispSwap_VertexAttrib4dvNV},
- /* [ 397] = 4277 */ {__glXDisp_VertexAttrib4ubvNV, __glXDispSwap_VertexAttrib4ubvNV},
- /* [ 398] = 4278 */ {NULL, NULL},
- /* [ 399] = 4279 */ {NULL, NULL},
- /* [ 400] = 4312 */ {NULL, NULL},
- /* [ 401] = 4313 */ {NULL, NULL},
- /* [ 402] = 4314 */ {NULL, NULL},
- /* [ 403] = 4315 */ {NULL, NULL},
- /* [ 404] = 4316 */ {__glXDisp_BindRenderbufferEXT, __glXDispSwap_BindRenderbufferEXT},
- /* [ 405] = 4317 */ {__glXDisp_DeleteRenderbuffersEXT, __glXDispSwap_DeleteRenderbuffersEXT},
- /* [ 406] = 4318 */ {__glXDisp_RenderbufferStorageEXT, __glXDispSwap_RenderbufferStorageEXT},
- /* [ 407] = 4319 */ {__glXDisp_BindFramebufferEXT, __glXDispSwap_BindFramebufferEXT},
-};
-
-static const int_fast16_t Render_size_table[408][2] = {
- /* [ 0] = 0 */ { 0, ~0},
- /* [ 1] = 1 */ { 8, ~0},
- /* [ 2] = 2 */ { 12, 0},
- /* [ 3] = 3 */ { 8, ~0},
- /* [ 4] = 4 */ { 8, ~0},
- /* [ 5] = 5 */ { 48, 1},
- /* [ 6] = 6 */ { 8, ~0},
- /* [ 7] = 7 */ { 28, ~0},
- /* [ 8] = 8 */ { 16, ~0},
- /* [ 9] = 9 */ { 16, ~0},
- /* [ 10] = 10 */ { 12, ~0},
- /* [ 11] = 11 */ { 8, ~0},
- /* [ 12] = 12 */ { 16, ~0},
- /* [ 13] = 13 */ { 12, ~0},
- /* [ 14] = 14 */ { 8, ~0},
- /* [ 15] = 15 */ { 36, ~0},
- /* [ 16] = 16 */ { 20, ~0},
- /* [ 17] = 17 */ { 20, ~0},
- /* [ 18] = 18 */ { 12, ~0},
- /* [ 19] = 19 */ { 8, ~0},
- /* [ 20] = 20 */ { 20, ~0},
- /* [ 21] = 21 */ { 12, ~0},
- /* [ 22] = 22 */ { 8, ~0},
- /* [ 23] = 23 */ { 4, ~0},
- /* [ 24] = 24 */ { 12, ~0},
- /* [ 25] = 25 */ { 8, ~0},
- /* [ 26] = 26 */ { 8, ~0},
- /* [ 27] = 27 */ { 8, ~0},
- /* [ 28] = 28 */ { 8, ~0},
- /* [ 29] = 29 */ { 28, ~0},
- /* [ 30] = 30 */ { 16, ~0},
- /* [ 31] = 31 */ { 16, ~0},
- /* [ 32] = 32 */ { 12, ~0},
- /* [ 33] = 33 */ { 20, ~0},
- /* [ 34] = 34 */ { 12, ~0},
- /* [ 35] = 35 */ { 12, ~0},
- /* [ 36] = 36 */ { 8, ~0},
- /* [ 37] = 37 */ { 28, ~0},
- /* [ 38] = 38 */ { 16, ~0},
- /* [ 39] = 39 */ { 16, ~0},
- /* [ 40] = 40 */ { 12, ~0},
- /* [ 41] = 41 */ { 36, ~0},
- /* [ 42] = 42 */ { 20, ~0},
- /* [ 43] = 43 */ { 20, ~0},
- /* [ 44] = 44 */ { 12, ~0},
- /* [ 45] = 45 */ { 36, ~0},
- /* [ 46] = 46 */ { 20, ~0},
- /* [ 47] = 47 */ { 20, ~0},
- /* [ 48] = 48 */ { 12, ~0},
- /* [ 49] = 49 */ { 12, ~0},
- /* [ 50] = 50 */ { 8, ~0},
- /* [ 51] = 51 */ { 8, ~0},
- /* [ 52] = 52 */ { 8, ~0},
- /* [ 53] = 53 */ { 20, ~0},
- /* [ 54] = 54 */ { 12, ~0},
- /* [ 55] = 55 */ { 12, ~0},
- /* [ 56] = 56 */ { 8, ~0},
- /* [ 57] = 57 */ { 28, ~0},
- /* [ 58] = 58 */ { 16, ~0},
- /* [ 59] = 59 */ { 16, ~0},
- /* [ 60] = 60 */ { 12, ~0},
- /* [ 61] = 61 */ { 36, ~0},
- /* [ 62] = 62 */ { 20, ~0},
- /* [ 63] = 63 */ { 20, ~0},
- /* [ 64] = 64 */ { 12, ~0},
- /* [ 65] = 65 */ { 20, ~0},
- /* [ 66] = 66 */ { 12, ~0},
- /* [ 67] = 67 */ { 12, ~0},
- /* [ 68] = 68 */ { 8, ~0},
- /* [ 69] = 69 */ { 28, ~0},
- /* [ 70] = 70 */ { 16, ~0},
- /* [ 71] = 71 */ { 16, ~0},
- /* [ 72] = 72 */ { 12, ~0},
- /* [ 73] = 73 */ { 36, ~0},
- /* [ 74] = 74 */ { 20, ~0},
- /* [ 75] = 75 */ { 20, ~0},
- /* [ 76] = 76 */ { 12, ~0},
- /* [ 77] = 77 */ { 40, ~0},
- /* [ 78] = 78 */ { 12, ~0},
- /* [ 79] = 79 */ { 8, ~0},
- /* [ 80] = 80 */ { 12, ~0},
- /* [ 81] = 81 */ { 8, 2},
- /* [ 82] = 82 */ { 12, ~0},
- /* [ 83] = 83 */ { 8, 3},
- /* [ 84] = 84 */ { 8, ~0},
- /* [ 85] = 85 */ { 12, ~0},
- /* [ 86] = 86 */ { 16, ~0},
- /* [ 87] = 87 */ { 12, 4},
- /* [ 88] = 88 */ { 16, ~0},
- /* [ 89] = 89 */ { 12, 5},
- /* [ 90] = 90 */ { 12, ~0},
- /* [ 91] = 91 */ { 8, 6},
- /* [ 92] = 92 */ { 12, ~0},
- /* [ 93] = 93 */ { 8, 7},
- /* [ 94] = 94 */ { 12, ~0},
- /* [ 95] = 95 */ { 8, ~0},
- /* [ 96] = 96 */ { 16, ~0},
- /* [ 97] = 97 */ { 12, 8},
- /* [ 98] = 98 */ { 16, ~0},
- /* [ 99] = 99 */ { 12, 9},
- /* [100] = 100 */ { 8, ~0},
- /* [101] = 101 */ { 12, ~0},
- /* [102] = 102 */ { 24, 10},
- /* [103] = 103 */ { 20, ~0},
- /* [104] = 104 */ { 8, ~0},
- /* [105] = 105 */ { 16, ~0},
- /* [106] = 106 */ { 12, 11},
- /* [107] = 107 */ { 16, ~0},
- /* [108] = 108 */ { 12, 12},
- /* [109] = 109 */ { 56, 13},
- /* [110] = 110 */ { 56, 14},
- /* [111] = 111 */ { 16, ~0},
- /* [112] = 112 */ { 12, 15},
- /* [113] = 113 */ { 16, ~0},
- /* [114] = 114 */ { 12, 16},
- /* [115] = 115 */ { 20, ~0},
- /* [116] = 116 */ { 12, 17},
- /* [117] = 117 */ { 16, ~0},
- /* [118] = 118 */ { 12, 18},
- /* [119] = 119 */ { 16, ~0},
- /* [120] = 120 */ { 12, 19},
- /* [121] = 121 */ { 4, ~0},
- /* [122] = 122 */ { 8, ~0},
- /* [123] = 123 */ { 8, ~0},
- /* [124] = 124 */ { 4, ~0},
- /* [125] = 125 */ { 8, ~0},
- /* [126] = 126 */ { 8, ~0},
- /* [127] = 127 */ { 8, ~0},
- /* [128] = 128 */ { 20, ~0},
- /* [129] = 129 */ { 8, ~0},
- /* [130] = 130 */ { 20, ~0},
- /* [131] = 131 */ { 8, ~0},
- /* [132] = 132 */ { 12, ~0},
- /* [133] = 133 */ { 8, ~0},
- /* [134] = 134 */ { 8, ~0},
- /* [135] = 135 */ { 8, ~0},
- /* [136] = 136 */ { 8, ~0},
- /* [137] = 137 */ { 12, ~0},
- /* [138] = 138 */ { 8, ~0},
- /* [139] = 139 */ { 8, ~0},
- /* [140] = 140 */ { 0, ~0},
- /* [141] = 141 */ { 4, ~0},
- /* [142] = 142 */ { 8, ~0},
- /* [143] = 143 */ { 28, 20},
- /* [144] = 144 */ { 20, 21},
- /* [145] = 145 */ { 48, 22},
- /* [146] = 146 */ { 32, 23},
- /* [147] = 147 */ { 24, ~0},
- /* [148] = 148 */ { 16, ~0},
- /* [149] = 149 */ { 44, ~0},
- /* [150] = 150 */ { 28, ~0},
- /* [151] = 151 */ { 12, ~0},
- /* [152] = 152 */ { 8, ~0},
- /* [153] = 153 */ { 20, ~0},
- /* [154] = 154 */ { 12, ~0},
- /* [155] = 155 */ { 16, ~0},
- /* [156] = 156 */ { 8, ~0},
- /* [157] = 157 */ { 24, ~0},
- /* [158] = 158 */ { 12, ~0},
- /* [159] = 159 */ { 12, ~0},
- /* [160] = 160 */ { 12, ~0},
- /* [161] = 161 */ { 8, ~0},
- /* [162] = 162 */ { 16, ~0},
- /* [163] = 163 */ { 16, ~0},
- /* [164] = 164 */ { 8, ~0},
- /* [165] = 165 */ { 12, ~0},
- /* [166] = 166 */ { 12, ~0},
- /* [167] = 167 */ { 12, ~0},
- /* [168] = 168 */ { 12, 24},
- /* [169] = 169 */ { 12, 25},
- /* [170] = 170 */ { 12, 26},
- /* [171] = 171 */ { 8, ~0},
- /* [172] = 172 */ { 24, ~0},
- /* [173] = 173 */ { 40, 27},
- /* [174] = 174 */ { 20, ~0},
- /* [175] = 175 */ { 52, ~0},
- /* [176] = 176 */ { 4, ~0},
- /* [177] = 177 */ { 68, ~0},
- /* [178] = 178 */ {132, ~0},
- /* [179] = 179 */ { 8, ~0},
- /* [180] = 180 */ { 68, ~0},
- /* [181] = 181 */ {132, ~0},
- /* [182] = 182 */ { 52, ~0},
- /* [183] = 183 */ { 4, ~0},
- /* [184] = 184 */ { 4, ~0},
- /* [185] = 185 */ { 36, ~0},
- /* [186] = 186 */ { 20, ~0},
- /* [187] = 187 */ { 28, ~0},
- /* [188] = 188 */ { 16, ~0},
- /* [189] = 189 */ { 28, ~0},
- /* [190] = 190 */ { 16, ~0},
- /* [191] = 191 */ { 20, ~0},
- /* [192] = 192 */ { 12, ~0},
- /* [193] = 193 */ { 16, 28},
- /* [194] = 194 */ { 8, ~0},
- /* [195] = 195 */ { 44, 29},
- /* [196] = 196 */ { 24, ~0},
- /* [197] = 197 */ { 8, ~0},
- /* [198] = 198 */ { 16, ~0},
- /* [199] = 199 */ { 12, ~0},
- /* [200] = 200 */ { 12, ~0},
- /* [201] = 201 */ { 12, ~0},
- /* [202] = 202 */ { 24, ~0},
- /* [203] = 203 */ { 16, ~0},
- /* [204] = 204 */ { 16, ~0},
- /* [205] = 205 */ { 12, ~0},
- /* [206] = 206 */ { 32, ~0},
- /* [207] = 207 */ { 20, ~0},
- /* [208] = 208 */ { 20, ~0},
- /* [209] = 209 */ { 16, ~0},
- /* [210] = 210 */ { 40, ~0},
- /* [211] = 211 */ { 24, ~0},
- /* [212] = 212 */ { 24, ~0},
- /* [213] = 213 */ { 16, ~0},
- /* [214] = 214 */ { 28, 30},
- /* [215] = 215 */ { 32, 31},
- /* [216] = 216 */ { 36, 32},
- /* [217] = 217 */ { 28, 33},
- /* [218] = 218 */ { 36, 34},
- /* [219] = 219 */ { 44, 35},
- /* [220] = 220 */ { 0, ~0},
- /* [221] = 221 */ { 0, ~0},
- /* [222] = 222 */ { 0, ~0},
- /* [223] = 223 */ { 0, ~0},
- /* [224] = 224 */ { 0, ~0},
- /* [225] = 225 */ { 0, ~0},
- /* [226] = 226 */ { 0, ~0},
- /* [227] = 227 */ { 0, ~0},
- /* [228] = 228 */ { 0, ~0},
- /* [229] = 229 */ { 12, ~0},
- /* [230] = 230 */ { 16, ~0},
- /* [231] = 231 */ { 12, ~0},
- /* [232] = 232 */ { 8, ~0},
- /* [233] = 233 */ { 8, 36},
- /* [234] = 234 */ { 12, ~0},
- /* [235] = 235 */ { 0, ~0},
- /* [236] = 236 */ { 0, ~0},
- /* [237] = 237 */ { 24, ~0},
- /* [238] = 238 */ { 0, ~0},
- /* [239] = 239 */ { 0, ~0},
- /* [240] = 2048 */ { 12, ~0},
- /* [241] = 2049 */ { 8, ~0},
- /* [242] = 2050 */ { 0, ~0},
- /* [243] = 2051 */ { 0, ~0},
- /* [244] = 2052 */ { 0, ~0},
- /* [245] = 2053 */ { 44, 37},
- /* [246] = 2054 */ { 12, 38},
- /* [247] = 2055 */ { 12, 39},
- /* [248] = 2056 */ { 24, ~0},
- /* [249] = 2057 */ { 0, ~0},
- /* [250] = 2058 */ { 0, ~0},
- /* [251] = 2059 */ { 0, ~0},
- /* [252] = 2060 */ { 0, ~0},
- /* [253] = 2061 */ { 0, ~0},
- /* [254] = 2062 */ { 0, ~0},
- /* [255] = 2063 */ { 0, ~0},
- /* [256] = 2064 */ { 0, ~0},
- /* [257] = 2065 */ { 12, ~0},
- /* [258] = 2066 */ { 8, 40},
- /* [259] = 2067 */ { 0, ~0},
- /* [260] = 2068 */ { 0, ~0},
- /* [261] = 2069 */ { 0, ~0},
- /* [262] = 2070 */ { 0, ~0},
- /* [263] = 2071 */ { 0, ~0},
- /* [264] = 4096 */ { 20, ~0},
- /* [265] = 4097 */ { 8, ~0},
- /* [266] = 4098 */ { 0, ~0},
- /* [267] = 4099 */ { 60, 41},
- /* [268] = 4100 */ { 60, 42},
- /* [269] = 4101 */ { 48, 43},
- /* [270] = 4102 */ { 48, 44},
- /* [271] = 4103 */ { 16, ~0},
- /* [272] = 4104 */ { 12, 45},
- /* [273] = 4105 */ { 16, ~0},
- /* [274] = 4106 */ { 12, 46},
- /* [275] = 4107 */ { 24, ~0},
- /* [276] = 4108 */ { 28, ~0},
- /* [277] = 4109 */ { 32, 47},
- /* [278] = 4110 */ { 20, ~0},
- /* [279] = 4111 */ { 16, ~0},
- /* [280] = 4112 */ { 8, ~0},
- /* [281] = 4113 */ { 8, ~0},
- /* [282] = 4114 */ { 84, 48},
- /* [283] = 4115 */ { 92, 49},
- /* [284] = 4116 */ { 0, ~0},
- /* [285] = 4117 */ { 12, ~0},
- /* [286] = 4118 */ { 8, 50},
- /* [287] = 4119 */ { 32, ~0},
- /* [288] = 4120 */ { 36, ~0},
- /* [289] = 4121 */ { 28, ~0},
- /* [290] = 4122 */ { 36, ~0},
- /* [291] = 4123 */ { 40, ~0},
- /* [292] = 4124 */ { 8, ~0},
- /* [293] = 4125 */ { 12, ~0},
- /* [294] = 4126 */ { 8, ~0},
- /* [295] = 4127 */ { 12, ~0},
- /* [296] = 4176 */ { 0, ~0},
- /* [297] = 4177 */ { 0, ~0},
- /* [298] = 4178 */ { 0, ~0},
- /* [299] = 4179 */ { 0, ~0},
- /* [300] = 4180 */ { 12, ~0},
- /* [301] = 4181 */ { 28, ~0},
- /* [302] = 4182 */ { 8, 51},
- /* [303] = 4183 */ { 16, 52},
- /* [304] = 4184 */ { 28, ~0},
- /* [305] = 4185 */ { 44, ~0},
- /* [306] = 4186 */ { 16, 53},
- /* [307] = 4187 */ { 16, 54},
- /* [308] = 4188 */ { 20, ~0},
- /* [309] = 4189 */ { 12, ~0},
- /* [310] = 4190 */ { 12, ~0},
- /* [311] = 4191 */ { 16, ~0},
- /* [312] = 4192 */ { 16, ~0},
- /* [313] = 4193 */ { 12, ~0},
- /* [314] = 4194 */ { 16, ~0},
- /* [315] = 4195 */ { 20, ~0},
- /* [316] = 4196 */ { 24, ~0},
- /* [317] = 4197 */ { 16, ~0},
- /* [318] = 4198 */ { 24, ~0},
- /* [319] = 4199 */ { 32, ~0},
- /* [320] = 4200 */ { 40, ~0},
- /* [321] = 4201 */ { 12, ~0},
- /* [322] = 4202 */ { 12, 55},
- /* [323] = 4203 */ { 12, 56},
- /* [324] = 4204 */ { 12, 57},
- /* [325] = 4205 */ { 12, 58},
- /* [326] = 4206 */ { 12, 59},
- /* [327] = 4207 */ { 12, 60},
- /* [328] = 4208 */ { 12, 61},
- /* [329] = 4209 */ { 12, 62},
- /* [330] = 4210 */ { 12, 63},
- /* [331] = 4211 */ { 12, 64},
- /* [332] = 4212 */ { 12, 65},
- /* [333] = 4213 */ { 12, 66},
- /* [334] = 4214 */ { 12, 67},
- /* [335] = 4215 */ { 28, ~0},
- /* [336] = 4216 */ { 44, ~0},
- /* [337] = 4217 */ { 16, 68},
- /* [338] = 4218 */ { 28, 69},
- /* [339] = 4219 */ { 44, 70},
- /* [340] = 4220 */ { 8, ~0},
- /* [341] = 4221 */ { 12, ~0},
- /* [342] = 4222 */ { 8, 71},
- /* [343] = 4223 */ { 0, ~0},
- /* [344] = 4224 */ { 0, ~0},
- /* [345] = 4225 */ { 0, ~0},
- /* [346] = 4226 */ { 0, ~0},
- /* [347] = 4227 */ { 0, ~0},
- /* [348] = 4228 */ { 12, ~0},
- /* [349] = 4229 */ { 0, ~0},
- /* [350] = 4230 */ { 12, ~0},
- /* [351] = 4231 */ { 24, ~0},
- /* [352] = 4232 */ { 12, ~0},
- /* [353] = 4233 */ { 16, ~0},
- /* [354] = 4234 */ { 24, ~0},
- /* [355] = 4235 */ { 12, ~0},
- /* [356] = 4236 */ { 16, ~0},
- /* [357] = 4237 */ { 24, ~0},
- /* [358] = 4238 */ { 16, ~0},
- /* [359] = 4239 */ { 24, ~0},
- /* [360] = 4320 */ { 8, 72},
- /* [361] = 4321 */ { 24, ~0},
- /* [362] = 4322 */ { 24, ~0},
- /* [363] = 4323 */ { 28, ~0},
- /* [364] = 4324 */ { 20, ~0},
- /* [365] = 4325 */ { 8, ~0},
- /* [366] = 4326 */ { 0, ~0},
- /* [367] = 4327 */ { 0, ~0},
- /* [368] = 4328 */ { 0, ~0},
- /* [369] = 4329 */ { 0, ~0},
- /* [370] = 4330 */ { 44, ~0},
- /* [371] = 4331 */ { 24, ~0},
- /* [372] = 4332 */ { 0, ~0},
- /* [373] = 4333 */ { 0, ~0},
- /* [374] = 4334 */ { 0, ~0},
- /* [375] = 4335 */ { 0, ~0},
- /* [376] = 4128 */ { 16, ~0},
- /* [377] = 4129 */ { 16, ~0},
- /* [378] = 4130 */ { 28, ~0},
- /* [379] = 4131 */ { 8, ~0},
- /* [380] = 4132 */ { 12, ~0},
- /* [381] = 4133 */ { 16, ~0},
- /* [382] = 4134 */ { 20, ~0},
- /* [383] = 4135 */ { 0, ~0},
- /* [384] = 4264 */ { 0, ~0},
- /* [385] = 4265 */ { 12, ~0},
- /* [386] = 4266 */ { 12, ~0},
- /* [387] = 4267 */ { 16, ~0},
- /* [388] = 4268 */ { 16, ~0},
- /* [389] = 4269 */ { 12, ~0},
- /* [390] = 4270 */ { 16, ~0},
- /* [391] = 4271 */ { 20, ~0},
- /* [392] = 4272 */ { 24, ~0},
- /* [393] = 4273 */ { 16, ~0},
- /* [394] = 4274 */ { 24, ~0},
- /* [395] = 4275 */ { 32, ~0},
- /* [396] = 4276 */ { 40, ~0},
- /* [397] = 4277 */ { 12, ~0},
- /* [398] = 4278 */ { 0, ~0},
- /* [399] = 4279 */ { 0, ~0},
- /* [400] = 4312 */ { 0, ~0},
- /* [401] = 4313 */ { 0, ~0},
- /* [402] = 4314 */ { 0, ~0},
- /* [403] = 4315 */ { 0, ~0},
- /* [404] = 4316 */ { 12, ~0},
- /* [405] = 4317 */ { 8, 73},
- /* [406] = 4318 */ { 20, ~0},
- /* [407] = 4319 */ { 12, ~0},
-};
-
-static const gl_proto_size_func Render_size_func_table[74] = {
- __glXCallListsReqSize,
- __glXBitmapReqSize,
- __glXFogfvReqSize,
- __glXFogivReqSize,
- __glXLightfvReqSize,
- __glXLightivReqSize,
- __glXLightModelfvReqSize,
- __glXLightModelivReqSize,
- __glXMaterialfvReqSize,
- __glXMaterialivReqSize,
- __glXPolygonStippleReqSize,
- __glXTexParameterfvReqSize,
- __glXTexParameterivReqSize,
- __glXTexImage1DReqSize,
- __glXTexImage2DReqSize,
- __glXTexEnvfvReqSize,
- __glXTexEnvivReqSize,
- __glXTexGendvReqSize,
- __glXTexGenfvReqSize,
- __glXTexGenivReqSize,
- __glXMap1dReqSize,
- __glXMap1fReqSize,
- __glXMap2dReqSize,
- __glXMap2fReqSize,
- __glXPixelMapfvReqSize,
- __glXPixelMapuivReqSize,
- __glXPixelMapusvReqSize,
- __glXDrawPixelsReqSize,
- __glXDrawArraysReqSize,
- __glXColorSubTableReqSize,
- __glXCompressedTexImage1DARBReqSize,
- __glXCompressedTexImage2DARBReqSize,
- __glXCompressedTexImage3DARBReqSize,
- __glXCompressedTexSubImage1DARBReqSize,
- __glXCompressedTexSubImage2DARBReqSize,
- __glXCompressedTexSubImage3DARBReqSize,
- __glXDrawBuffersARBReqSize,
- __glXColorTableReqSize,
- __glXColorTableParameterfvReqSize,
- __glXColorTableParameterivReqSize,
- __glXPointParameterfvEXTReqSize,
- __glXTexSubImage1DReqSize,
- __glXTexSubImage2DReqSize,
- __glXConvolutionFilter1DReqSize,
- __glXConvolutionFilter2DReqSize,
- __glXConvolutionParameterfvReqSize,
- __glXConvolutionParameterivReqSize,
- __glXSeparableFilter2DReqSize,
- __glXTexImage3DReqSize,
- __glXTexSubImage3DReqSize,
- __glXPrioritizeTexturesReqSize,
- __glXRequestResidentProgramsNVReqSize,
- __glXLoadProgramNVReqSize,
- __glXProgramParameters4fvNVReqSize,
- __glXProgramParameters4dvNVReqSize,
- __glXVertexAttribs1svNVReqSize,
- __glXVertexAttribs2svNVReqSize,
- __glXVertexAttribs3svNVReqSize,
- __glXVertexAttribs4svNVReqSize,
- __glXVertexAttribs1fvNVReqSize,
- __glXVertexAttribs2fvNVReqSize,
- __glXVertexAttribs3fvNVReqSize,
- __glXVertexAttribs4fvNVReqSize,
- __glXVertexAttribs1dvNVReqSize,
- __glXVertexAttribs2dvNVReqSize,
- __glXVertexAttribs3dvNVReqSize,
- __glXVertexAttribs4dvNVReqSize,
- __glXVertexAttribs4ubvNVReqSize,
- __glXProgramStringARBReqSize,
- __glXProgramNamedParameter4fvNVReqSize,
- __glXProgramNamedParameter4dvNVReqSize,
- __glXPointParameterivNVReqSize,
- __glXDeleteFramebuffersEXTReqSize,
- __glXDeleteRenderbuffersEXTReqSize,
-};
-
-const struct __glXDispatchInfo Render_dispatch_info = {
- 13,
- Render_dispatch_tree,
- Render_function_table,
- Render_size_table,
- Render_size_func_table
-};
-
-/*****************************************************************/
-/* tree depth = 12 */
-static const int_fast16_t VendorPriv_dispatch_tree[152] = {
- /* [0] -> opcode range [0, 131072], node depth 1 */
- 2,
- 5,
- EMPTY_LEAF,
- 119,
- EMPTY_LEAF,
-
- /* [5] -> opcode range [0, 32768], node depth 2 */
- 1,
- 8,
- EMPTY_LEAF,
-
- /* [8] -> opcode range [0, 16384], node depth 3 */
- 1,
- 11,
- EMPTY_LEAF,
-
- /* [11] -> opcode range [0, 8192], node depth 4 */
- 2,
- 16,
- EMPTY_LEAF,
- 78,
- EMPTY_LEAF,
-
- /* [16] -> opcode range [0, 2048], node depth 5 */
- 2,
- 21,
- EMPTY_LEAF,
- 36,
- EMPTY_LEAF,
-
- /* [21] -> opcode range [0, 512], node depth 6 */
- 1,
- 24,
- EMPTY_LEAF,
-
- /* [24] -> opcode range [0, 256], node depth 7 */
- 1,
- 27,
- EMPTY_LEAF,
-
- /* [27] -> opcode range [0, 128], node depth 8 */
- 1,
- 30,
- EMPTY_LEAF,
-
- /* [30] -> opcode range [0, 64], node depth 9 */
- 1,
- 33,
- EMPTY_LEAF,
-
- /* [33] -> opcode range [0, 32], node depth 10 */
- 1,
- LEAF(0),
- EMPTY_LEAF,
-
- /* [36] -> opcode range [1024, 1536], node depth 6 */
- 2,
- 41,
- EMPTY_LEAF,
- 53,
- 67,
-
- /* [41] -> opcode range [1024, 1152], node depth 7 */
- 1,
- 44,
- EMPTY_LEAF,
-
- /* [44] -> opcode range [1024, 1088], node depth 8 */
- 1,
- 47,
- EMPTY_LEAF,
-
- /* [47] -> opcode range [1024, 1056], node depth 9 */
- 1,
- 50,
- EMPTY_LEAF,
-
- /* [50] -> opcode range [1024, 1040], node depth 10 */
- 1,
- LEAF(16),
- EMPTY_LEAF,
-
- /* [53] -> opcode range [1280, 1408], node depth 7 */
- 1,
- 56,
- EMPTY_LEAF,
-
- /* [56] -> opcode range [1280, 1344], node depth 8 */
- 2,
- 61,
- LEAF(24),
- EMPTY_LEAF,
- 64,
-
- /* [61] -> opcode range [1280, 1296], node depth 9 */
- 1,
- EMPTY_LEAF,
- LEAF(40),
-
- /* [64] -> opcode range [1328, 1344], node depth 9 */
- 1,
- LEAF(48),
- EMPTY_LEAF,
-
- /* [67] -> opcode range [1408, 1536], node depth 7 */
- 1,
- 70,
- EMPTY_LEAF,
-
- /* [70] -> opcode range [1408, 1472], node depth 8 */
- 1,
- 73,
- EMPTY_LEAF,
-
- /* [73] -> opcode range [1408, 1440], node depth 9 */
- 2,
- EMPTY_LEAF,
- LEAF(56),
- LEAF(64),
- EMPTY_LEAF,
-
- /* [78] -> opcode range [4096, 6144], node depth 5 */
- 2,
- 83,
- EMPTY_LEAF,
- 101,
- EMPTY_LEAF,
-
- /* [83] -> opcode range [4096, 4608], node depth 6 */
- 1,
- 86,
- EMPTY_LEAF,
-
- /* [86] -> opcode range [4096, 4352], node depth 7 */
- 1,
- 89,
- EMPTY_LEAF,
-
- /* [89] -> opcode range [4096, 4224], node depth 8 */
- 1,
- 92,
- EMPTY_LEAF,
-
- /* [92] -> opcode range [4096, 4160], node depth 9 */
- 1,
- 95,
- EMPTY_LEAF,
-
- /* [95] -> opcode range [4096, 4128], node depth 10 */
- 1,
- 98,
- EMPTY_LEAF,
-
- /* [98] -> opcode range [4096, 4112], node depth 11 */
- 1,
- LEAF(72),
- EMPTY_LEAF,
-
- /* [101] -> opcode range [5120, 5632], node depth 6 */
- 1,
- 104,
- EMPTY_LEAF,
-
- /* [104] -> opcode range [5120, 5376], node depth 7 */
- 1,
- 107,
- EMPTY_LEAF,
-
- /* [107] -> opcode range [5120, 5248], node depth 8 */
- 1,
- 110,
- EMPTY_LEAF,
-
- /* [110] -> opcode range [5120, 5184], node depth 9 */
- 1,
- EMPTY_LEAF,
- 113,
-
- /* [113] -> opcode range [5152, 5184], node depth 10 */
- 1,
- 116,
- EMPTY_LEAF,
-
- /* [116] -> opcode range [5152, 5168], node depth 11 */
- 1,
- LEAF(80),
- EMPTY_LEAF,
-
- /* [119] -> opcode range [65536, 98304], node depth 2 */
- 1,
- 122,
- EMPTY_LEAF,
-
- /* [122] -> opcode range [65536, 81920], node depth 3 */
- 1,
- 125,
- EMPTY_LEAF,
-
- /* [125] -> opcode range [65536, 73728], node depth 4 */
- 1,
- 128,
- EMPTY_LEAF,
-
- /* [128] -> opcode range [65536, 69632], node depth 5 */
- 1,
- 131,
- EMPTY_LEAF,
-
- /* [131] -> opcode range [65536, 67584], node depth 6 */
- 1,
- 134,
- EMPTY_LEAF,
-
- /* [134] -> opcode range [65536, 66560], node depth 7 */
- 1,
- 137,
- EMPTY_LEAF,
-
- /* [137] -> opcode range [65536, 66048], node depth 8 */
- 1,
- 140,
- EMPTY_LEAF,
-
- /* [140] -> opcode range [65536, 65792], node depth 9 */
- 1,
- 143,
- EMPTY_LEAF,
-
- /* [143] -> opcode range [65536, 65664], node depth 10 */
- 1,
- 146,
- EMPTY_LEAF,
-
- /* [146] -> opcode range [65536, 65600], node depth 11 */
- 1,
- 149,
- EMPTY_LEAF,
-
- /* [149] -> opcode range [65536, 65568], node depth 12 */
- 1,
- LEAF(88),
- EMPTY_LEAF,
-
-};
-
-static const void *VendorPriv_function_table[104][2] = {
- /* [ 0] = 0 */ {NULL, NULL},
- /* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT},
- /* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT},
- /* [ 3] = 3 */ {__glXDisp_GetConvolutionParameterivEXT, __glXDispSwap_GetConvolutionParameterivEXT},
- /* [ 4] = 4 */ {__glXDisp_GetSeparableFilterEXT, __glXDispSwap_GetSeparableFilterEXT},
- /* [ 5] = 5 */ {__glXDisp_GetHistogramEXT, __glXDispSwap_GetHistogramEXT},
- /* [ 6] = 6 */ {__glXDisp_GetHistogramParameterfvEXT, __glXDispSwap_GetHistogramParameterfvEXT},
- /* [ 7] = 7 */ {__glXDisp_GetHistogramParameterivEXT, __glXDispSwap_GetHistogramParameterivEXT},
- /* [ 8] = 8 */ {__glXDisp_GetMinmaxEXT, __glXDispSwap_GetMinmaxEXT},
- /* [ 9] = 9 */ {__glXDisp_GetMinmaxParameterfvEXT, __glXDispSwap_GetMinmaxParameterfvEXT},
- /* [ 10] = 10 */ {__glXDisp_GetMinmaxParameterivEXT, __glXDispSwap_GetMinmaxParameterivEXT},
- /* [ 11] = 11 */ {__glXDisp_AreTexturesResidentEXT, __glXDispSwap_AreTexturesResidentEXT},
- /* [ 12] = 12 */ {__glXDisp_DeleteTexturesEXT, __glXDispSwap_DeleteTexturesEXT},
- /* [ 13] = 13 */ {__glXDisp_GenTexturesEXT, __glXDispSwap_GenTexturesEXT},
- /* [ 14] = 14 */ {__glXDisp_IsTextureEXT, __glXDispSwap_IsTextureEXT},
- /* [ 15] = 15 */ {NULL, NULL},
- /* [ 16] = 1024 */ {__glXDisp_QueryContextInfoEXT, __glXDispSwap_QueryContextInfoEXT},
- /* [ 17] = 1025 */ {NULL, NULL},
- /* [ 18] = 1026 */ {NULL, NULL},
- /* [ 19] = 1027 */ {NULL, NULL},
- /* [ 20] = 1028 */ {NULL, NULL},
- /* [ 21] = 1029 */ {NULL, NULL},
- /* [ 22] = 1030 */ {NULL, NULL},
- /* [ 23] = 1031 */ {NULL, NULL},
- /* [ 24] = 1296 */ {__glXDisp_GetProgramEnvParameterfvARB, __glXDispSwap_GetProgramEnvParameterfvARB},
- /* [ 25] = 1297 */ {__glXDisp_GetProgramEnvParameterdvARB, __glXDispSwap_GetProgramEnvParameterdvARB},
- /* [ 26] = 1298 */ {__glXDisp_GetProgramivNV, __glXDispSwap_GetProgramivNV},
- /* [ 27] = 1299 */ {__glXDisp_GetProgramStringNV, __glXDispSwap_GetProgramStringNV},
- /* [ 28] = 1300 */ {__glXDisp_GetTrackMatrixivNV, __glXDispSwap_GetTrackMatrixivNV},
- /* [ 29] = 1301 */ {__glXDisp_GetVertexAttribdvARB, __glXDispSwap_GetVertexAttribdvARB},
- /* [ 30] = 1302 */ {__glXDisp_GetVertexAttribfvARB, __glXDispSwap_GetVertexAttribfvARB},
- /* [ 31] = 1303 */ {__glXDisp_GetVertexAttribivNV, __glXDispSwap_GetVertexAttribivNV},
- /* [ 32] = 1304 */ {__glXDisp_IsProgramNV, __glXDispSwap_IsProgramNV},
- /* [ 33] = 1305 */ {__glXDisp_GetProgramLocalParameterfvARB, __glXDispSwap_GetProgramLocalParameterfvARB},
- /* [ 34] = 1306 */ {__glXDisp_GetProgramLocalParameterdvARB, __glXDispSwap_GetProgramLocalParameterdvARB},
- /* [ 35] = 1307 */ {__glXDisp_GetProgramivARB, __glXDispSwap_GetProgramivARB},
- /* [ 36] = 1308 */ {__glXDisp_GetProgramStringARB, __glXDispSwap_GetProgramStringARB},
- /* [ 37] = 1309 */ {NULL, NULL},
- /* [ 38] = 1310 */ {__glXDisp_GetProgramNamedParameterfvNV, __glXDispSwap_GetProgramNamedParameterfvNV},
- /* [ 39] = 1311 */ {__glXDisp_GetProgramNamedParameterdvNV, __glXDispSwap_GetProgramNamedParameterdvNV},
- /* [ 40] = 1288 */ {NULL, NULL},
- /* [ 41] = 1289 */ {NULL, NULL},
- /* [ 42] = 1290 */ {NULL, NULL},
- /* [ 43] = 1291 */ {NULL, NULL},
- /* [ 44] = 1292 */ {NULL, NULL},
- /* [ 45] = 1293 */ {__glXDisp_AreProgramsResidentNV, __glXDispSwap_AreProgramsResidentNV},
- /* [ 46] = 1294 */ {__glXDisp_DeleteProgramsNV, __glXDispSwap_DeleteProgramsNV},
- /* [ 47] = 1295 */ {__glXDisp_GenProgramsNV, __glXDispSwap_GenProgramsNV},
- /* [ 48] = 1328 */ {NULL, NULL},
- /* [ 49] = 1329 */ {NULL, NULL},
- /* [ 50] = 1330 */ {__glXDisp_BindTexImageEXT, __glXDispSwap_BindTexImageEXT},
- /* [ 51] = 1331 */ {__glXDisp_ReleaseTexImageEXT, __glXDispSwap_ReleaseTexImageEXT},
- /* [ 52] = 1332 */ {NULL, NULL},
- /* [ 53] = 1333 */ {NULL, NULL},
- /* [ 54] = 1334 */ {NULL, NULL},
- /* [ 55] = 1335 */ {NULL, NULL},
- /* [ 56] = 1416 */ {NULL, NULL},
- /* [ 57] = 1417 */ {NULL, NULL},
- /* [ 58] = 1418 */ {NULL, NULL},
- /* [ 59] = 1419 */ {NULL, NULL},
- /* [ 60] = 1420 */ {NULL, NULL},
- /* [ 61] = 1421 */ {NULL, NULL},
- /* [ 62] = 1422 */ {__glXDisp_IsRenderbufferEXT, __glXDispSwap_IsRenderbufferEXT},
- /* [ 63] = 1423 */ {__glXDisp_GenRenderbuffersEXT, __glXDispSwap_GenRenderbuffersEXT},
- /* [ 64] = 1424 */ {__glXDisp_GetRenderbufferParameterivEXT, __glXDispSwap_GetRenderbufferParameterivEXT},
- /* [ 65] = 1425 */ {__glXDisp_IsFramebufferEXT, __glXDispSwap_IsFramebufferEXT},
- /* [ 66] = 1426 */ {__glXDisp_GenFramebuffersEXT, __glXDispSwap_GenFramebuffersEXT},
- /* [ 67] = 1427 */ {__glXDisp_CheckFramebufferStatusEXT, __glXDispSwap_CheckFramebufferStatusEXT},
- /* [ 68] = 1428 */ {__glXDisp_GetFramebufferAttachmentParameterivEXT, __glXDispSwap_GetFramebufferAttachmentParameterivEXT},
- /* [ 69] = 1429 */ {NULL, NULL},
- /* [ 70] = 1430 */ {NULL, NULL},
- /* [ 71] = 1431 */ {NULL, NULL},
- /* [ 72] = 4096 */ {NULL, NULL},
- /* [ 73] = 4097 */ {NULL, NULL},
- /* [ 74] = 4098 */ {__glXDisp_GetColorTableSGI, __glXDispSwap_GetColorTableSGI},
- /* [ 75] = 4099 */ {__glXDisp_GetColorTableParameterfvSGI, __glXDispSwap_GetColorTableParameterfvSGI},
- /* [ 76] = 4100 */ {__glXDisp_GetColorTableParameterivSGI, __glXDispSwap_GetColorTableParameterivSGI},
- /* [ 77] = 4101 */ {NULL, NULL},
- /* [ 78] = 4102 */ {NULL, NULL},
- /* [ 79] = 4103 */ {NULL, NULL},
- /* [ 80] = 5152 */ {NULL, NULL},
- /* [ 81] = 5153 */ {NULL, NULL},
- /* [ 82] = 5154 */ {__glXDisp_CopySubBufferMESA, __glXDispSwap_CopySubBufferMESA},
- /* [ 83] = 5155 */ {NULL, NULL},
- /* [ 84] = 5156 */ {NULL, NULL},
- /* [ 85] = 5157 */ {NULL, NULL},
- /* [ 86] = 5158 */ {NULL, NULL},
- /* [ 87] = 5159 */ {NULL, NULL},
- /* [ 88] = 65536 */ {__glXDisp_SwapIntervalSGI, __glXDispSwap_SwapIntervalSGI},
- /* [ 89] = 65537 */ {__glXDisp_MakeCurrentReadSGI, __glXDispSwap_MakeCurrentReadSGI},
- /* [ 90] = 65538 */ {NULL, NULL},
- /* [ 91] = 65539 */ {NULL, NULL},
- /* [ 92] = 65540 */ {__glXDisp_GetFBConfigsSGIX, __glXDispSwap_GetFBConfigsSGIX},
- /* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX},
- /* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX},
- /* [ 95] = 65543 */ {__glXDisp_CreateGLXPbufferSGIX, __glXDispSwap_CreateGLXPbufferSGIX},
- /* [ 96] = 65544 */ {__glXDisp_DestroyGLXPbufferSGIX, __glXDispSwap_DestroyGLXPbufferSGIX},
- /* [ 97] = 65545 */ {__glXDisp_ChangeDrawableAttributesSGIX, __glXDispSwap_ChangeDrawableAttributesSGIX},
- /* [ 98] = 65546 */ {__glXDisp_GetDrawableAttributesSGIX, __glXDispSwap_GetDrawableAttributesSGIX},
- /* [ 99] = 65547 */ {NULL, NULL},
- /* [ 100] = 65548 */ {NULL, NULL},
- /* [ 101] = 65549 */ {NULL, NULL},
- /* [ 102] = 65550 */ {NULL, NULL},
- /* [ 103] = 65551 */ {NULL, NULL},
-};
-
-const struct __glXDispatchInfo VendorPriv_dispatch_info = {
- 17,
- VendorPriv_dispatch_tree,
- VendorPriv_function_table,
- NULL,
- NULL
-};
-
+/* DO NOT EDIT - This file generated automatically by glX_server_table.py (from Mesa) script */
+
+/*
+ * (C) Copyright IBM Corporation 2005, 2006
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef HAVE_DIX_CONFIG_H
+#include "glheader.h"
+#endif
+
+#include <inttypes.h>
+#include "glxserver.h"
+#include "glxext.h"
+#include "indirect_dispatch.h"
+#include "indirect_reqsize.h"
+#include "indirect_table.h"
+
+/*****************************************************************/
+/* tree depth = 3 */
+static const int_fast16_t Single_dispatch_tree[24] = {
+ /* [0] -> opcode range [0, 256], node depth 1 */
+ 2,
+ 5,
+ 13,
+ 16,
+ EMPTY_LEAF,
+
+ /* [5] -> opcode range [0, 64], node depth 2 */
+ 2,
+ LEAF(0),
+ LEAF(16),
+ 10,
+ EMPTY_LEAF,
+
+ /* [10] -> opcode range [32, 48], node depth 3 */
+ 1,
+ LEAF(32),
+ EMPTY_LEAF,
+
+ /* [13] -> opcode range [64, 128], node depth 2 */
+ 1,
+ EMPTY_LEAF,
+ LEAF(40),
+
+ /* [16] -> opcode range [128, 192], node depth 2 */
+ 2,
+ LEAF(72),
+ LEAF(88),
+ 21,
+ EMPTY_LEAF,
+
+ /* [21] -> opcode range [160, 176], node depth 3 */
+ 1,
+ LEAF(104),
+ EMPTY_LEAF,
+
+};
+
+static const void *Single_function_table[112][2] = {
+ /* [ 0] = 0 */ {NULL, NULL},
+ /* [ 1] = 1 */ {__glXDisp_Render, __glXDispSwap_Render},
+ /* [ 2] = 2 */ {__glXDisp_RenderLarge, __glXDispSwap_RenderLarge},
+ /* [ 3] = 3 */ {__glXDisp_CreateContext, __glXDispSwap_CreateContext},
+ /* [ 4] = 4 */ {__glXDisp_DestroyContext, __glXDispSwap_DestroyContext},
+ /* [ 5] = 5 */ {__glXDisp_MakeCurrent, __glXDispSwap_MakeCurrent},
+ /* [ 6] = 6 */ {__glXDisp_IsDirect, __glXDispSwap_IsDirect},
+ /* [ 7] = 7 */ {__glXDisp_QueryVersion, __glXDispSwap_QueryVersion},
+ /* [ 8] = 8 */ {__glXDisp_WaitGL, __glXDispSwap_WaitGL},
+ /* [ 9] = 9 */ {__glXDisp_WaitX, __glXDispSwap_WaitX},
+ /* [ 10] = 10 */ {__glXDisp_CopyContext, __glXDispSwap_CopyContext},
+ /* [ 11] = 11 */ {__glXDisp_SwapBuffers, __glXDispSwap_SwapBuffers},
+ /* [ 12] = 12 */ {__glXDisp_UseXFont, __glXDispSwap_UseXFont},
+ /* [ 13] = 13 */ {__glXDisp_CreateGLXPixmap, __glXDispSwap_CreateGLXPixmap},
+ /* [ 14] = 14 */ {__glXDisp_GetVisualConfigs, __glXDispSwap_GetVisualConfigs},
+ /* [ 15] = 15 */ {__glXDisp_DestroyGLXPixmap, __glXDispSwap_DestroyGLXPixmap},
+ /* [ 16] = 16 */ {__glXDisp_VendorPrivate, __glXDispSwap_VendorPrivate},
+ /* [ 17] = 17 */ {__glXDisp_VendorPrivateWithReply, __glXDispSwap_VendorPrivateWithReply},
+ /* [ 18] = 18 */ {__glXDisp_QueryExtensionsString, __glXDispSwap_QueryExtensionsString},
+ /* [ 19] = 19 */ {__glXDisp_QueryServerString, __glXDispSwap_QueryServerString},
+ /* [ 20] = 20 */ {__glXDisp_ClientInfo, __glXDispSwap_ClientInfo},
+ /* [ 21] = 21 */ {__glXDisp_GetFBConfigs, __glXDispSwap_GetFBConfigs},
+ /* [ 22] = 22 */ {__glXDisp_CreatePixmap, __glXDispSwap_CreatePixmap},
+ /* [ 23] = 23 */ {__glXDisp_DestroyPixmap, __glXDispSwap_DestroyPixmap},
+ /* [ 24] = 24 */ {__glXDisp_CreateNewContext, __glXDispSwap_CreateNewContext},
+ /* [ 25] = 25 */ {__glXDisp_QueryContext, __glXDispSwap_QueryContext},
+ /* [ 26] = 26 */ {__glXDisp_MakeContextCurrent, __glXDispSwap_MakeContextCurrent},
+ /* [ 27] = 27 */ {__glXDisp_CreatePbuffer, __glXDispSwap_CreatePbuffer},
+ /* [ 28] = 28 */ {__glXDisp_DestroyPbuffer, __glXDispSwap_DestroyPbuffer},
+ /* [ 29] = 29 */ {__glXDisp_GetDrawableAttributes, __glXDispSwap_GetDrawableAttributes},
+ /* [ 30] = 30 */ {__glXDisp_ChangeDrawableAttributes, __glXDispSwap_ChangeDrawableAttributes},
+ /* [ 31] = 31 */ {__glXDisp_CreateWindow, __glXDispSwap_CreateWindow},
+ /* [ 32] = 32 */ {__glXDisp_DestroyWindow, __glXDispSwap_DestroyWindow},
+ /* [ 33] = 33 */ {NULL, NULL},
+ /* [ 34] = 34 */ {NULL, NULL},
+ /* [ 35] = 35 */ {NULL, NULL},
+ /* [ 36] = 36 */ {NULL, NULL},
+ /* [ 37] = 37 */ {NULL, NULL},
+ /* [ 38] = 38 */ {NULL, NULL},
+ /* [ 39] = 39 */ {NULL, NULL},
+ /* [ 40] = 96 */ {NULL, NULL},
+ /* [ 41] = 97 */ {NULL, NULL},
+ /* [ 42] = 98 */ {NULL, NULL},
+ /* [ 43] = 99 */ {NULL, NULL},
+ /* [ 44] = 100 */ {NULL, NULL},
+ /* [ 45] = 101 */ {__glXDisp_NewList, __glXDispSwap_NewList},
+ /* [ 46] = 102 */ {__glXDisp_EndList, __glXDispSwap_EndList},
+ /* [ 47] = 103 */ {__glXDisp_DeleteLists, __glXDispSwap_DeleteLists},
+ /* [ 48] = 104 */ {__glXDisp_GenLists, __glXDispSwap_GenLists},
+ /* [ 49] = 105 */ {__glXDisp_FeedbackBuffer, __glXDispSwap_FeedbackBuffer},
+ /* [ 50] = 106 */ {__glXDisp_SelectBuffer, __glXDispSwap_SelectBuffer},
+ /* [ 51] = 107 */ {__glXDisp_RenderMode, __glXDispSwap_RenderMode},
+ /* [ 52] = 108 */ {__glXDisp_Finish, __glXDispSwap_Finish},
+ /* [ 53] = 109 */ {__glXDisp_PixelStoref, __glXDispSwap_PixelStoref},
+ /* [ 54] = 110 */ {__glXDisp_PixelStorei, __glXDispSwap_PixelStorei},
+ /* [ 55] = 111 */ {__glXDisp_ReadPixels, __glXDispSwap_ReadPixels},
+ /* [ 56] = 112 */ {__glXDisp_GetBooleanv, __glXDispSwap_GetBooleanv},
+ /* [ 57] = 113 */ {__glXDisp_GetClipPlane, __glXDispSwap_GetClipPlane},
+ /* [ 58] = 114 */ {__glXDisp_GetDoublev, __glXDispSwap_GetDoublev},
+ /* [ 59] = 115 */ {__glXDisp_GetError, __glXDispSwap_GetError},
+ /* [ 60] = 116 */ {__glXDisp_GetFloatv, __glXDispSwap_GetFloatv},
+ /* [ 61] = 117 */ {__glXDisp_GetIntegerv, __glXDispSwap_GetIntegerv},
+ /* [ 62] = 118 */ {__glXDisp_GetLightfv, __glXDispSwap_GetLightfv},
+ /* [ 63] = 119 */ {__glXDisp_GetLightiv, __glXDispSwap_GetLightiv},
+ /* [ 64] = 120 */ {__glXDisp_GetMapdv, __glXDispSwap_GetMapdv},
+ /* [ 65] = 121 */ {__glXDisp_GetMapfv, __glXDispSwap_GetMapfv},
+ /* [ 66] = 122 */ {__glXDisp_GetMapiv, __glXDispSwap_GetMapiv},
+ /* [ 67] = 123 */ {__glXDisp_GetMaterialfv, __glXDispSwap_GetMaterialfv},
+ /* [ 68] = 124 */ {__glXDisp_GetMaterialiv, __glXDispSwap_GetMaterialiv},
+ /* [ 69] = 125 */ {__glXDisp_GetPixelMapfv, __glXDispSwap_GetPixelMapfv},
+ /* [ 70] = 126 */ {__glXDisp_GetPixelMapuiv, __glXDispSwap_GetPixelMapuiv},
+ /* [ 71] = 127 */ {__glXDisp_GetPixelMapusv, __glXDispSwap_GetPixelMapusv},
+ /* [ 72] = 128 */ {__glXDisp_GetPolygonStipple, __glXDispSwap_GetPolygonStipple},
+ /* [ 73] = 129 */ {__glXDisp_GetString, __glXDispSwap_GetString},
+ /* [ 74] = 130 */ {__glXDisp_GetTexEnvfv, __glXDispSwap_GetTexEnvfv},
+ /* [ 75] = 131 */ {__glXDisp_GetTexEnviv, __glXDispSwap_GetTexEnviv},
+ /* [ 76] = 132 */ {__glXDisp_GetTexGendv, __glXDispSwap_GetTexGendv},
+ /* [ 77] = 133 */ {__glXDisp_GetTexGenfv, __glXDispSwap_GetTexGenfv},
+ /* [ 78] = 134 */ {__glXDisp_GetTexGeniv, __glXDispSwap_GetTexGeniv},
+ /* [ 79] = 135 */ {__glXDisp_GetTexImage, __glXDispSwap_GetTexImage},
+ /* [ 80] = 136 */ {__glXDisp_GetTexParameterfv, __glXDispSwap_GetTexParameterfv},
+ /* [ 81] = 137 */ {__glXDisp_GetTexParameteriv, __glXDispSwap_GetTexParameteriv},
+ /* [ 82] = 138 */ {__glXDisp_GetTexLevelParameterfv, __glXDispSwap_GetTexLevelParameterfv},
+ /* [ 83] = 139 */ {__glXDisp_GetTexLevelParameteriv, __glXDispSwap_GetTexLevelParameteriv},
+ /* [ 84] = 140 */ {__glXDisp_IsEnabled, __glXDispSwap_IsEnabled},
+ /* [ 85] = 141 */ {__glXDisp_IsList, __glXDispSwap_IsList},
+ /* [ 86] = 142 */ {__glXDisp_Flush, __glXDispSwap_Flush},
+ /* [ 87] = 143 */ {__glXDisp_AreTexturesResident, __glXDispSwap_AreTexturesResident},
+ /* [ 88] = 144 */ {__glXDisp_DeleteTextures, __glXDispSwap_DeleteTextures},
+ /* [ 89] = 145 */ {__glXDisp_GenTextures, __glXDispSwap_GenTextures},
+ /* [ 90] = 146 */ {__glXDisp_IsTexture, __glXDispSwap_IsTexture},
+ /* [ 91] = 147 */ {__glXDisp_GetColorTable, __glXDispSwap_GetColorTable},
+ /* [ 92] = 148 */ {__glXDisp_GetColorTableParameterfv, __glXDispSwap_GetColorTableParameterfv},
+ /* [ 93] = 149 */ {__glXDisp_GetColorTableParameteriv, __glXDispSwap_GetColorTableParameteriv},
+ /* [ 94] = 150 */ {__glXDisp_GetConvolutionFilter, __glXDispSwap_GetConvolutionFilter},
+ /* [ 95] = 151 */ {__glXDisp_GetConvolutionParameterfv, __glXDispSwap_GetConvolutionParameterfv},
+ /* [ 96] = 152 */ {__glXDisp_GetConvolutionParameteriv, __glXDispSwap_GetConvolutionParameteriv},
+ /* [ 97] = 153 */ {__glXDisp_GetSeparableFilter, __glXDispSwap_GetSeparableFilter},
+ /* [ 98] = 154 */ {__glXDisp_GetHistogram, __glXDispSwap_GetHistogram},
+ /* [ 99] = 155 */ {__glXDisp_GetHistogramParameterfv, __glXDispSwap_GetHistogramParameterfv},
+ /* [ 100] = 156 */ {__glXDisp_GetHistogramParameteriv, __glXDispSwap_GetHistogramParameteriv},
+ /* [ 101] = 157 */ {__glXDisp_GetMinmax, __glXDispSwap_GetMinmax},
+ /* [ 102] = 158 */ {__glXDisp_GetMinmaxParameterfv, __glXDispSwap_GetMinmaxParameterfv},
+ /* [ 103] = 159 */ {__glXDisp_GetMinmaxParameteriv, __glXDispSwap_GetMinmaxParameteriv},
+ /* [ 104] = 160 */ {__glXDisp_GetCompressedTexImageARB, __glXDispSwap_GetCompressedTexImageARB},
+ /* [ 105] = 161 */ {__glXDisp_DeleteQueriesARB, __glXDispSwap_DeleteQueriesARB},
+ /* [ 106] = 162 */ {__glXDisp_GenQueriesARB, __glXDispSwap_GenQueriesARB},
+ /* [ 107] = 163 */ {__glXDisp_IsQueryARB, __glXDispSwap_IsQueryARB},
+ /* [ 108] = 164 */ {__glXDisp_GetQueryivARB, __glXDispSwap_GetQueryivARB},
+ /* [ 109] = 165 */ {__glXDisp_GetQueryObjectivARB, __glXDispSwap_GetQueryObjectivARB},
+ /* [ 110] = 166 */ {__glXDisp_GetQueryObjectuivARB, __glXDispSwap_GetQueryObjectuivARB},
+ /* [ 111] = 167 */ {NULL, NULL},
+};
+
+const struct __glXDispatchInfo Single_dispatch_info = {
+ 8,
+ Single_dispatch_tree,
+ Single_function_table,
+ NULL,
+ NULL
+};
+
+/*****************************************************************/
+/* tree depth = 8 */
+static const int_fast16_t Render_dispatch_tree[92] = {
+ /* [0] -> opcode range [0, 8192], node depth 1 */
+ 2,
+ 5,
+ 31,
+ 54,
+ EMPTY_LEAF,
+
+ /* [5] -> opcode range [0, 2048], node depth 2 */
+ 1,
+ 8,
+ EMPTY_LEAF,
+
+ /* [8] -> opcode range [0, 1024], node depth 3 */
+ 1,
+ 11,
+ EMPTY_LEAF,
+
+ /* [11] -> opcode range [0, 512], node depth 4 */
+ 1,
+ 14,
+ EMPTY_LEAF,
+
+ /* [14] -> opcode range [0, 256], node depth 5 */
+ 4,
+ LEAF(0),
+ LEAF(16),
+ LEAF(32),
+ LEAF(48),
+ LEAF(64),
+ LEAF(80),
+ LEAF(96),
+ LEAF(112),
+ LEAF(128),
+ LEAF(144),
+ LEAF(160),
+ LEAF(176),
+ LEAF(192),
+ LEAF(208),
+ LEAF(224),
+ EMPTY_LEAF,
+
+ /* [31] -> opcode range [2048, 4096], node depth 2 */
+ 1,
+ 34,
+ EMPTY_LEAF,
+
+ /* [34] -> opcode range [2048, 3072], node depth 3 */
+ 1,
+ 37,
+ EMPTY_LEAF,
+
+ /* [37] -> opcode range [2048, 2560], node depth 4 */
+ 1,
+ 40,
+ EMPTY_LEAF,
+
+ /* [40] -> opcode range [2048, 2304], node depth 5 */
+ 1,
+ 43,
+ EMPTY_LEAF,
+
+ /* [43] -> opcode range [2048, 2176], node depth 6 */
+ 1,
+ 46,
+ EMPTY_LEAF,
+
+ /* [46] -> opcode range [2048, 2112], node depth 7 */
+ 1,
+ 49,
+ EMPTY_LEAF,
+
+ /* [49] -> opcode range [2048, 2080], node depth 8 */
+ 2,
+ LEAF(240),
+ LEAF(248),
+ LEAF(256),
+ EMPTY_LEAF,
+
+ /* [54] -> opcode range [4096, 6144], node depth 2 */
+ 1,
+ 57,
+ EMPTY_LEAF,
+
+ /* [57] -> opcode range [4096, 5120], node depth 3 */
+ 1,
+ 60,
+ EMPTY_LEAF,
+
+ /* [60] -> opcode range [4096, 4608], node depth 4 */
+ 1,
+ 63,
+ EMPTY_LEAF,
+
+ /* [63] -> opcode range [4096, 4352], node depth 5 */
+ 4,
+ LEAF(264),
+ LEAF(280),
+ 80,
+ EMPTY_LEAF,
+ EMPTY_LEAF,
+ LEAF(296),
+ LEAF(312),
+ LEAF(328),
+ LEAF(344),
+ EMPTY_LEAF,
+ 83,
+ 86,
+ EMPTY_LEAF,
+ 89,
+ LEAF(360),
+ EMPTY_LEAF,
+
+ /* [80] -> opcode range [4128, 4144], node depth 6 */
+ 1,
+ LEAF(376),
+ EMPTY_LEAF,
+
+ /* [83] -> opcode range [4256, 4272], node depth 6 */
+ 1,
+ EMPTY_LEAF,
+ LEAF(384),
+
+ /* [86] -> opcode range [4272, 4288], node depth 6 */
+ 1,
+ LEAF(392),
+ EMPTY_LEAF,
+
+ /* [89] -> opcode range [4304, 4320], node depth 6 */
+ 1,
+ EMPTY_LEAF,
+ LEAF(400),
+
+};
+
+static const void *Render_function_table[408][2] = {
+ /* [ 0] = 0 */ {NULL, NULL},
+ /* [ 1] = 1 */ {__glXDisp_CallList, __glXDispSwap_CallList},
+ /* [ 2] = 2 */ {__glXDisp_CallLists, __glXDispSwap_CallLists},
+ /* [ 3] = 3 */ {__glXDisp_ListBase, __glXDispSwap_ListBase},
+ /* [ 4] = 4 */ {__glXDisp_Begin, __glXDispSwap_Begin},
+ /* [ 5] = 5 */ {__glXDisp_Bitmap, __glXDispSwap_Bitmap},
+ /* [ 6] = 6 */ {__glXDisp_Color3bv, __glXDispSwap_Color3bv},
+ /* [ 7] = 7 */ {__glXDisp_Color3dv, __glXDispSwap_Color3dv},
+ /* [ 8] = 8 */ {__glXDisp_Color3fv, __glXDispSwap_Color3fv},
+ /* [ 9] = 9 */ {__glXDisp_Color3iv, __glXDispSwap_Color3iv},
+ /* [ 10] = 10 */ {__glXDisp_Color3sv, __glXDispSwap_Color3sv},
+ /* [ 11] = 11 */ {__glXDisp_Color3ubv, __glXDispSwap_Color3ubv},
+ /* [ 12] = 12 */ {__glXDisp_Color3uiv, __glXDispSwap_Color3uiv},
+ /* [ 13] = 13 */ {__glXDisp_Color3usv, __glXDispSwap_Color3usv},
+ /* [ 14] = 14 */ {__glXDisp_Color4bv, __glXDispSwap_Color4bv},
+ /* [ 15] = 15 */ {__glXDisp_Color4dv, __glXDispSwap_Color4dv},
+ /* [ 16] = 16 */ {__glXDisp_Color4fv, __glXDispSwap_Color4fv},
+ /* [ 17] = 17 */ {__glXDisp_Color4iv, __glXDispSwap_Color4iv},
+ /* [ 18] = 18 */ {__glXDisp_Color4sv, __glXDispSwap_Color4sv},
+ /* [ 19] = 19 */ {__glXDisp_Color4ubv, __glXDispSwap_Color4ubv},
+ /* [ 20] = 20 */ {__glXDisp_Color4uiv, __glXDispSwap_Color4uiv},
+ /* [ 21] = 21 */ {__glXDisp_Color4usv, __glXDispSwap_Color4usv},
+ /* [ 22] = 22 */ {__glXDisp_EdgeFlagv, __glXDispSwap_EdgeFlagv},
+ /* [ 23] = 23 */ {__glXDisp_End, __glXDispSwap_End},
+ /* [ 24] = 24 */ {__glXDisp_Indexdv, __glXDispSwap_Indexdv},
+ /* [ 25] = 25 */ {__glXDisp_Indexfv, __glXDispSwap_Indexfv},
+ /* [ 26] = 26 */ {__glXDisp_Indexiv, __glXDispSwap_Indexiv},
+ /* [ 27] = 27 */ {__glXDisp_Indexsv, __glXDispSwap_Indexsv},
+ /* [ 28] = 28 */ {__glXDisp_Normal3bv, __glXDispSwap_Normal3bv},
+ /* [ 29] = 29 */ {__glXDisp_Normal3dv, __glXDispSwap_Normal3dv},
+ /* [ 30] = 30 */ {__glXDisp_Normal3fv, __glXDispSwap_Normal3fv},
+ /* [ 31] = 31 */ {__glXDisp_Normal3iv, __glXDispSwap_Normal3iv},
+ /* [ 32] = 32 */ {__glXDisp_Normal3sv, __glXDispSwap_Normal3sv},
+ /* [ 33] = 33 */ {__glXDisp_RasterPos2dv, __glXDispSwap_RasterPos2dv},
+ /* [ 34] = 34 */ {__glXDisp_RasterPos2fv, __glXDispSwap_RasterPos2fv},
+ /* [ 35] = 35 */ {__glXDisp_RasterPos2iv, __glXDispSwap_RasterPos2iv},
+ /* [ 36] = 36 */ {__glXDisp_RasterPos2sv, __glXDispSwap_RasterPos2sv},
+ /* [ 37] = 37 */ {__glXDisp_RasterPos3dv, __glXDispSwap_RasterPos3dv},
+ /* [ 38] = 38 */ {__glXDisp_RasterPos3fv, __glXDispSwap_RasterPos3fv},
+ /* [ 39] = 39 */ {__glXDisp_RasterPos3iv, __glXDispSwap_RasterPos3iv},
+ /* [ 40] = 40 */ {__glXDisp_RasterPos3sv, __glXDispSwap_RasterPos3sv},
+ /* [ 41] = 41 */ {__glXDisp_RasterPos4dv, __glXDispSwap_RasterPos4dv},
+ /* [ 42] = 42 */ {__glXDisp_RasterPos4fv, __glXDispSwap_RasterPos4fv},
+ /* [ 43] = 43 */ {__glXDisp_RasterPos4iv, __glXDispSwap_RasterPos4iv},
+ /* [ 44] = 44 */ {__glXDisp_RasterPos4sv, __glXDispSwap_RasterPos4sv},
+ /* [ 45] = 45 */ {__glXDisp_Rectdv, __glXDispSwap_Rectdv},
+ /* [ 46] = 46 */ {__glXDisp_Rectfv, __glXDispSwap_Rectfv},
+ /* [ 47] = 47 */ {__glXDisp_Rectiv, __glXDispSwap_Rectiv},
+ /* [ 48] = 48 */ {__glXDisp_Rectsv, __glXDispSwap_Rectsv},
+ /* [ 49] = 49 */ {__glXDisp_TexCoord1dv, __glXDispSwap_TexCoord1dv},
+ /* [ 50] = 50 */ {__glXDisp_TexCoord1fv, __glXDispSwap_TexCoord1fv},
+ /* [ 51] = 51 */ {__glXDisp_TexCoord1iv, __glXDispSwap_TexCoord1iv},
+ /* [ 52] = 52 */ {__glXDisp_TexCoord1sv, __glXDispSwap_TexCoord1sv},
+ /* [ 53] = 53 */ {__glXDisp_TexCoord2dv, __glXDispSwap_TexCoord2dv},
+ /* [ 54] = 54 */ {__glXDisp_TexCoord2fv, __glXDispSwap_TexCoord2fv},
+ /* [ 55] = 55 */ {__glXDisp_TexCoord2iv, __glXDispSwap_TexCoord2iv},
+ /* [ 56] = 56 */ {__glXDisp_TexCoord2sv, __glXDispSwap_TexCoord2sv},
+ /* [ 57] = 57 */ {__glXDisp_TexCoord3dv, __glXDispSwap_TexCoord3dv},
+ /* [ 58] = 58 */ {__glXDisp_TexCoord3fv, __glXDispSwap_TexCoord3fv},
+ /* [ 59] = 59 */ {__glXDisp_TexCoord3iv, __glXDispSwap_TexCoord3iv},
+ /* [ 60] = 60 */ {__glXDisp_TexCoord3sv, __glXDispSwap_TexCoord3sv},
+ /* [ 61] = 61 */ {__glXDisp_TexCoord4dv, __glXDispSwap_TexCoord4dv},
+ /* [ 62] = 62 */ {__glXDisp_TexCoord4fv, __glXDispSwap_TexCoord4fv},
+ /* [ 63] = 63 */ {__glXDisp_TexCoord4iv, __glXDispSwap_TexCoord4iv},
+ /* [ 64] = 64 */ {__glXDisp_TexCoord4sv, __glXDispSwap_TexCoord4sv},
+ /* [ 65] = 65 */ {__glXDisp_Vertex2dv, __glXDispSwap_Vertex2dv},
+ /* [ 66] = 66 */ {__glXDisp_Vertex2fv, __glXDispSwap_Vertex2fv},
+ /* [ 67] = 67 */ {__glXDisp_Vertex2iv, __glXDispSwap_Vertex2iv},
+ /* [ 68] = 68 */ {__glXDisp_Vertex2sv, __glXDispSwap_Vertex2sv},
+ /* [ 69] = 69 */ {__glXDisp_Vertex3dv, __glXDispSwap_Vertex3dv},
+ /* [ 70] = 70 */ {__glXDisp_Vertex3fv, __glXDispSwap_Vertex3fv},
+ /* [ 71] = 71 */ {__glXDisp_Vertex3iv, __glXDispSwap_Vertex3iv},
+ /* [ 72] = 72 */ {__glXDisp_Vertex3sv, __glXDispSwap_Vertex3sv},
+ /* [ 73] = 73 */ {__glXDisp_Vertex4dv, __glXDispSwap_Vertex4dv},
+ /* [ 74] = 74 */ {__glXDisp_Vertex4fv, __glXDispSwap_Vertex4fv},
+ /* [ 75] = 75 */ {__glXDisp_Vertex4iv, __glXDispSwap_Vertex4iv},
+ /* [ 76] = 76 */ {__glXDisp_Vertex4sv, __glXDispSwap_Vertex4sv},
+ /* [ 77] = 77 */ {__glXDisp_ClipPlane, __glXDispSwap_ClipPlane},
+ /* [ 78] = 78 */ {__glXDisp_ColorMaterial, __glXDispSwap_ColorMaterial},
+ /* [ 79] = 79 */ {__glXDisp_CullFace, __glXDispSwap_CullFace},
+ /* [ 80] = 80 */ {__glXDisp_Fogf, __glXDispSwap_Fogf},
+ /* [ 81] = 81 */ {__glXDisp_Fogfv, __glXDispSwap_Fogfv},
+ /* [ 82] = 82 */ {__glXDisp_Fogi, __glXDispSwap_Fogi},
+ /* [ 83] = 83 */ {__glXDisp_Fogiv, __glXDispSwap_Fogiv},
+ /* [ 84] = 84 */ {__glXDisp_FrontFace, __glXDispSwap_FrontFace},
+ /* [ 85] = 85 */ {__glXDisp_Hint, __glXDispSwap_Hint},
+ /* [ 86] = 86 */ {__glXDisp_Lightf, __glXDispSwap_Lightf},
+ /* [ 87] = 87 */ {__glXDisp_Lightfv, __glXDispSwap_Lightfv},
+ /* [ 88] = 88 */ {__glXDisp_Lighti, __glXDispSwap_Lighti},
+ /* [ 89] = 89 */ {__glXDisp_Lightiv, __glXDispSwap_Lightiv},
+ /* [ 90] = 90 */ {__glXDisp_LightModelf, __glXDispSwap_LightModelf},
+ /* [ 91] = 91 */ {__glXDisp_LightModelfv, __glXDispSwap_LightModelfv},
+ /* [ 92] = 92 */ {__glXDisp_LightModeli, __glXDispSwap_LightModeli},
+ /* [ 93] = 93 */ {__glXDisp_LightModeliv, __glXDispSwap_LightModeliv},
+ /* [ 94] = 94 */ {__glXDisp_LineStipple, __glXDispSwap_LineStipple},
+ /* [ 95] = 95 */ {__glXDisp_LineWidth, __glXDispSwap_LineWidth},
+ /* [ 96] = 96 */ {__glXDisp_Materialf, __glXDispSwap_Materialf},
+ /* [ 97] = 97 */ {__glXDisp_Materialfv, __glXDispSwap_Materialfv},
+ /* [ 98] = 98 */ {__glXDisp_Materiali, __glXDispSwap_Materiali},
+ /* [ 99] = 99 */ {__glXDisp_Materialiv, __glXDispSwap_Materialiv},
+ /* [ 100] = 100 */ {__glXDisp_PointSize, __glXDispSwap_PointSize},
+ /* [ 101] = 101 */ {__glXDisp_PolygonMode, __glXDispSwap_PolygonMode},
+ /* [ 102] = 102 */ {__glXDisp_PolygonStipple, __glXDispSwap_PolygonStipple},
+ /* [ 103] = 103 */ {__glXDisp_Scissor, __glXDispSwap_Scissor},
+ /* [ 104] = 104 */ {__glXDisp_ShadeModel, __glXDispSwap_ShadeModel},
+ /* [ 105] = 105 */ {__glXDisp_TexParameterf, __glXDispSwap_TexParameterf},
+ /* [ 106] = 106 */ {__glXDisp_TexParameterfv, __glXDispSwap_TexParameterfv},
+ /* [ 107] = 107 */ {__glXDisp_TexParameteri, __glXDispSwap_TexParameteri},
+ /* [ 108] = 108 */ {__glXDisp_TexParameteriv, __glXDispSwap_TexParameteriv},
+ /* [ 109] = 109 */ {__glXDisp_TexImage1D, __glXDispSwap_TexImage1D},
+ /* [ 110] = 110 */ {__glXDisp_TexImage2D, __glXDispSwap_TexImage2D},
+ /* [ 111] = 111 */ {__glXDisp_TexEnvf, __glXDispSwap_TexEnvf},
+ /* [ 112] = 112 */ {__glXDisp_TexEnvfv, __glXDispSwap_TexEnvfv},
+ /* [ 113] = 113 */ {__glXDisp_TexEnvi, __glXDispSwap_TexEnvi},
+ /* [ 114] = 114 */ {__glXDisp_TexEnviv, __glXDispSwap_TexEnviv},
+ /* [ 115] = 115 */ {__glXDisp_TexGend, __glXDispSwap_TexGend},
+ /* [ 116] = 116 */ {__glXDisp_TexGendv, __glXDispSwap_TexGendv},
+ /* [ 117] = 117 */ {__glXDisp_TexGenf, __glXDispSwap_TexGenf},
+ /* [ 118] = 118 */ {__glXDisp_TexGenfv, __glXDispSwap_TexGenfv},
+ /* [ 119] = 119 */ {__glXDisp_TexGeni, __glXDispSwap_TexGeni},
+ /* [ 120] = 120 */ {__glXDisp_TexGeniv, __glXDispSwap_TexGeniv},
+ /* [ 121] = 121 */ {__glXDisp_InitNames, __glXDispSwap_InitNames},
+ /* [ 122] = 122 */ {__glXDisp_LoadName, __glXDispSwap_LoadName},
+ /* [ 123] = 123 */ {__glXDisp_PassThrough, __glXDispSwap_PassThrough},
+ /* [ 124] = 124 */ {__glXDisp_PopName, __glXDispSwap_PopName},
+ /* [ 125] = 125 */ {__glXDisp_PushName, __glXDispSwap_PushName},
+ /* [ 126] = 126 */ {__glXDisp_DrawBuffer, __glXDispSwap_DrawBuffer},
+ /* [ 127] = 127 */ {__glXDisp_Clear, __glXDispSwap_Clear},
+ /* [ 128] = 128 */ {__glXDisp_ClearAccum, __glXDispSwap_ClearAccum},
+ /* [ 129] = 129 */ {__glXDisp_ClearIndex, __glXDispSwap_ClearIndex},
+ /* [ 130] = 130 */ {__glXDisp_ClearColor, __glXDispSwap_ClearColor},
+ /* [ 131] = 131 */ {__glXDisp_ClearStencil, __glXDispSwap_ClearStencil},
+ /* [ 132] = 132 */ {__glXDisp_ClearDepth, __glXDispSwap_ClearDepth},
+ /* [ 133] = 133 */ {__glXDisp_StencilMask, __glXDispSwap_StencilMask},
+ /* [ 134] = 134 */ {__glXDisp_ColorMask, __glXDispSwap_ColorMask},
+ /* [ 135] = 135 */ {__glXDisp_DepthMask, __glXDispSwap_DepthMask},
+ /* [ 136] = 136 */ {__glXDisp_IndexMask, __glXDispSwap_IndexMask},
+ /* [ 137] = 137 */ {__glXDisp_Accum, __glXDispSwap_Accum},
+ /* [ 138] = 138 */ {__glXDisp_Disable, __glXDispSwap_Disable},
+ /* [ 139] = 139 */ {__glXDisp_Enable, __glXDispSwap_Enable},
+ /* [ 140] = 140 */ {NULL, NULL},
+ /* [ 141] = 141 */ {__glXDisp_PopAttrib, __glXDispSwap_PopAttrib},
+ /* [ 142] = 142 */ {__glXDisp_PushAttrib, __glXDispSwap_PushAttrib},
+ /* [ 143] = 143 */ {__glXDisp_Map1d, __glXDispSwap_Map1d},
+ /* [ 144] = 144 */ {__glXDisp_Map1f, __glXDispSwap_Map1f},
+ /* [ 145] = 145 */ {__glXDisp_Map2d, __glXDispSwap_Map2d},
+ /* [ 146] = 146 */ {__glXDisp_Map2f, __glXDispSwap_Map2f},
+ /* [ 147] = 147 */ {__glXDisp_MapGrid1d, __glXDispSwap_MapGrid1d},
+ /* [ 148] = 148 */ {__glXDisp_MapGrid1f, __glXDispSwap_MapGrid1f},
+ /* [ 149] = 149 */ {__glXDisp_MapGrid2d, __glXDispSwap_MapGrid2d},
+ /* [ 150] = 150 */ {__glXDisp_MapGrid2f, __glXDispSwap_MapGrid2f},
+ /* [ 151] = 151 */ {__glXDisp_EvalCoord1dv, __glXDispSwap_EvalCoord1dv},
+ /* [ 152] = 152 */ {__glXDisp_EvalCoord1fv, __glXDispSwap_EvalCoord1fv},
+ /* [ 153] = 153 */ {__glXDisp_EvalCoord2dv, __glXDispSwap_EvalCoord2dv},
+ /* [ 154] = 154 */ {__glXDisp_EvalCoord2fv, __glXDispSwap_EvalCoord2fv},
+ /* [ 155] = 155 */ {__glXDisp_EvalMesh1, __glXDispSwap_EvalMesh1},
+ /* [ 156] = 156 */ {__glXDisp_EvalPoint1, __glXDispSwap_EvalPoint1},
+ /* [ 157] = 157 */ {__glXDisp_EvalMesh2, __glXDispSwap_EvalMesh2},
+ /* [ 158] = 158 */ {__glXDisp_EvalPoint2, __glXDispSwap_EvalPoint2},
+ /* [ 159] = 159 */ {__glXDisp_AlphaFunc, __glXDispSwap_AlphaFunc},
+ /* [ 160] = 160 */ {__glXDisp_BlendFunc, __glXDispSwap_BlendFunc},
+ /* [ 161] = 161 */ {__glXDisp_LogicOp, __glXDispSwap_LogicOp},
+ /* [ 162] = 162 */ {__glXDisp_StencilFunc, __glXDispSwap_StencilFunc},
+ /* [ 163] = 163 */ {__glXDisp_StencilOp, __glXDispSwap_StencilOp},
+ /* [ 164] = 164 */ {__glXDisp_DepthFunc, __glXDispSwap_DepthFunc},
+ /* [ 165] = 165 */ {__glXDisp_PixelZoom, __glXDispSwap_PixelZoom},
+ /* [ 166] = 166 */ {__glXDisp_PixelTransferf, __glXDispSwap_PixelTransferf},
+ /* [ 167] = 167 */ {__glXDisp_PixelTransferi, __glXDispSwap_PixelTransferi},
+ /* [ 168] = 168 */ {__glXDisp_PixelMapfv, __glXDispSwap_PixelMapfv},
+ /* [ 169] = 169 */ {__glXDisp_PixelMapuiv, __glXDispSwap_PixelMapuiv},
+ /* [ 170] = 170 */ {__glXDisp_PixelMapusv, __glXDispSwap_PixelMapusv},
+ /* [ 171] = 171 */ {__glXDisp_ReadBuffer, __glXDispSwap_ReadBuffer},
+ /* [ 172] = 172 */ {__glXDisp_CopyPixels, __glXDispSwap_CopyPixels},
+ /* [ 173] = 173 */ {__glXDisp_DrawPixels, __glXDispSwap_DrawPixels},
+ /* [ 174] = 174 */ {__glXDisp_DepthRange, __glXDispSwap_DepthRange},
+ /* [ 175] = 175 */ {__glXDisp_Frustum, __glXDispSwap_Frustum},
+ /* [ 176] = 176 */ {__glXDisp_LoadIdentity, __glXDispSwap_LoadIdentity},
+ /* [ 177] = 177 */ {__glXDisp_LoadMatrixf, __glXDispSwap_LoadMatrixf},
+ /* [ 178] = 178 */ {__glXDisp_LoadMatrixd, __glXDispSwap_LoadMatrixd},
+ /* [ 179] = 179 */ {__glXDisp_MatrixMode, __glXDispSwap_MatrixMode},
+ /* [ 180] = 180 */ {__glXDisp_MultMatrixf, __glXDispSwap_MultMatrixf},
+ /* [ 181] = 181 */ {__glXDisp_MultMatrixd, __glXDispSwap_MultMatrixd},
+ /* [ 182] = 182 */ {__glXDisp_Ortho, __glXDispSwap_Ortho},
+ /* [ 183] = 183 */ {__glXDisp_PopMatrix, __glXDispSwap_PopMatrix},
+ /* [ 184] = 184 */ {__glXDisp_PushMatrix, __glXDispSwap_PushMatrix},
+ /* [ 185] = 185 */ {__glXDisp_Rotated, __glXDispSwap_Rotated},
+ /* [ 186] = 186 */ {__glXDisp_Rotatef, __glXDispSwap_Rotatef},
+ /* [ 187] = 187 */ {__glXDisp_Scaled, __glXDispSwap_Scaled},
+ /* [ 188] = 188 */ {__glXDisp_Scalef, __glXDispSwap_Scalef},
+ /* [ 189] = 189 */ {__glXDisp_Translated, __glXDispSwap_Translated},
+ /* [ 190] = 190 */ {__glXDisp_Translatef, __glXDispSwap_Translatef},
+ /* [ 191] = 191 */ {__glXDisp_Viewport, __glXDispSwap_Viewport},
+ /* [ 192] = 192 */ {__glXDisp_PolygonOffset, __glXDispSwap_PolygonOffset},
+ /* [ 193] = 193 */ {__glXDisp_DrawArrays, __glXDispSwap_DrawArrays},
+ /* [ 194] = 194 */ {__glXDisp_Indexubv, __glXDispSwap_Indexubv},
+ /* [ 195] = 195 */ {__glXDisp_ColorSubTable, __glXDispSwap_ColorSubTable},
+ /* [ 196] = 196 */ {__glXDisp_CopyColorSubTable, __glXDispSwap_CopyColorSubTable},
+ /* [ 197] = 197 */ {__glXDisp_ActiveTextureARB, __glXDispSwap_ActiveTextureARB},
+ /* [ 198] = 198 */ {__glXDisp_MultiTexCoord1dvARB, __glXDispSwap_MultiTexCoord1dvARB},
+ /* [ 199] = 199 */ {__glXDisp_MultiTexCoord1fvARB, __glXDispSwap_MultiTexCoord1fvARB},
+ /* [ 200] = 200 */ {__glXDisp_MultiTexCoord1ivARB, __glXDispSwap_MultiTexCoord1ivARB},
+ /* [ 201] = 201 */ {__glXDisp_MultiTexCoord1svARB, __glXDispSwap_MultiTexCoord1svARB},
+ /* [ 202] = 202 */ {__glXDisp_MultiTexCoord2dvARB, __glXDispSwap_MultiTexCoord2dvARB},
+ /* [ 203] = 203 */ {__glXDisp_MultiTexCoord2fvARB, __glXDispSwap_MultiTexCoord2fvARB},
+ /* [ 204] = 204 */ {__glXDisp_MultiTexCoord2ivARB, __glXDispSwap_MultiTexCoord2ivARB},
+ /* [ 205] = 205 */ {__glXDisp_MultiTexCoord2svARB, __glXDispSwap_MultiTexCoord2svARB},
+ /* [ 206] = 206 */ {__glXDisp_MultiTexCoord3dvARB, __glXDispSwap_MultiTexCoord3dvARB},
+ /* [ 207] = 207 */ {__glXDisp_MultiTexCoord3fvARB, __glXDispSwap_MultiTexCoord3fvARB},
+ /* [ 208] = 208 */ {__glXDisp_MultiTexCoord3ivARB, __glXDispSwap_MultiTexCoord3ivARB},
+ /* [ 209] = 209 */ {__glXDisp_MultiTexCoord3svARB, __glXDispSwap_MultiTexCoord3svARB},
+ /* [ 210] = 210 */ {__glXDisp_MultiTexCoord4dvARB, __glXDispSwap_MultiTexCoord4dvARB},
+ /* [ 211] = 211 */ {__glXDisp_MultiTexCoord4fvARB, __glXDispSwap_MultiTexCoord4fvARB},
+ /* [ 212] = 212 */ {__glXDisp_MultiTexCoord4ivARB, __glXDispSwap_MultiTexCoord4ivARB},
+ /* [ 213] = 213 */ {__glXDisp_MultiTexCoord4svARB, __glXDispSwap_MultiTexCoord4svARB},
+ /* [ 214] = 214 */ {__glXDisp_CompressedTexImage1DARB, __glXDispSwap_CompressedTexImage1DARB},
+ /* [ 215] = 215 */ {__glXDisp_CompressedTexImage2DARB, __glXDispSwap_CompressedTexImage2DARB},
+ /* [ 216] = 216 */ {__glXDisp_CompressedTexImage3DARB, __glXDispSwap_CompressedTexImage3DARB},
+ /* [ 217] = 217 */ {__glXDisp_CompressedTexSubImage1DARB, __glXDispSwap_CompressedTexSubImage1DARB},
+ /* [ 218] = 218 */ {__glXDisp_CompressedTexSubImage2DARB, __glXDispSwap_CompressedTexSubImage2DARB},
+ /* [ 219] = 219 */ {__glXDisp_CompressedTexSubImage3DARB, __glXDispSwap_CompressedTexSubImage3DARB},
+ /* [ 220] = 220 */ {NULL, NULL},
+ /* [ 221] = 221 */ {NULL, NULL},
+ /* [ 222] = 222 */ {NULL, NULL},
+ /* [ 223] = 223 */ {NULL, NULL},
+ /* [ 224] = 224 */ {NULL, NULL},
+ /* [ 225] = 225 */ {NULL, NULL},
+ /* [ 226] = 226 */ {NULL, NULL},
+ /* [ 227] = 227 */ {NULL, NULL},
+ /* [ 228] = 228 */ {NULL, NULL},
+ /* [ 229] = 229 */ {__glXDisp_SampleCoverageARB, __glXDispSwap_SampleCoverageARB},
+ /* [ 230] = 230 */ {__glXDisp_WindowPos3fvMESA, __glXDispSwap_WindowPos3fvMESA},
+ /* [ 231] = 231 */ {__glXDisp_BeginQueryARB, __glXDispSwap_BeginQueryARB},
+ /* [ 232] = 232 */ {__glXDisp_EndQueryARB, __glXDispSwap_EndQueryARB},
+ /* [ 233] = 233 */ {__glXDisp_DrawBuffersARB, __glXDispSwap_DrawBuffersARB},
+ /* [ 234] = 234 */ {__glXDisp_ClampColorARB, __glXDispSwap_ClampColorARB},
+ /* [ 235] = 235 */ {NULL, NULL},
+ /* [ 236] = 236 */ {NULL, NULL},
+ /* [ 237] = 237 */ {__glXDisp_FramebufferTextureLayerEXT, __glXDispSwap_FramebufferTextureLayerEXT},
+ /* [ 238] = 238 */ {NULL, NULL},
+ /* [ 239] = 239 */ {NULL, NULL},
+ /* [ 240] = 2048 */ {__glXDisp_SampleMaskSGIS, __glXDispSwap_SampleMaskSGIS},
+ /* [ 241] = 2049 */ {__glXDisp_SamplePatternSGIS, __glXDispSwap_SamplePatternSGIS},
+ /* [ 242] = 2050 */ {NULL, NULL},
+ /* [ 243] = 2051 */ {NULL, NULL},
+ /* [ 244] = 2052 */ {NULL, NULL},
+ /* [ 245] = 2053 */ {__glXDisp_ColorTable, __glXDispSwap_ColorTable},
+ /* [ 246] = 2054 */ {__glXDisp_ColorTableParameterfv, __glXDispSwap_ColorTableParameterfv},
+ /* [ 247] = 2055 */ {__glXDisp_ColorTableParameteriv, __glXDispSwap_ColorTableParameteriv},
+ /* [ 248] = 2056 */ {__glXDisp_CopyColorTable, __glXDispSwap_CopyColorTable},
+ /* [ 249] = 2057 */ {NULL, NULL},
+ /* [ 250] = 2058 */ {NULL, NULL},
+ /* [ 251] = 2059 */ {NULL, NULL},
+ /* [ 252] = 2060 */ {NULL, NULL},
+ /* [ 253] = 2061 */ {NULL, NULL},
+ /* [ 254] = 2062 */ {NULL, NULL},
+ /* [ 255] = 2063 */ {NULL, NULL},
+ /* [ 256] = 2064 */ {NULL, NULL},
+ /* [ 257] = 2065 */ {__glXDisp_PointParameterfEXT, __glXDispSwap_PointParameterfEXT},
+ /* [ 258] = 2066 */ {__glXDisp_PointParameterfvEXT, __glXDispSwap_PointParameterfvEXT},
+ /* [ 259] = 2067 */ {NULL, NULL},
+ /* [ 260] = 2068 */ {NULL, NULL},
+ /* [ 261] = 2069 */ {NULL, NULL},
+ /* [ 262] = 2070 */ {NULL, NULL},
+ /* [ 263] = 2071 */ {NULL, NULL},
+ /* [ 264] = 4096 */ {__glXDisp_BlendColor, __glXDispSwap_BlendColor},
+ /* [ 265] = 4097 */ {__glXDisp_BlendEquation, __glXDispSwap_BlendEquation},
+ /* [ 266] = 4098 */ {NULL, NULL},
+ /* [ 267] = 4099 */ {__glXDisp_TexSubImage1D, __glXDispSwap_TexSubImage1D},
+ /* [ 268] = 4100 */ {__glXDisp_TexSubImage2D, __glXDispSwap_TexSubImage2D},
+ /* [ 269] = 4101 */ {__glXDisp_ConvolutionFilter1D, __glXDispSwap_ConvolutionFilter1D},
+ /* [ 270] = 4102 */ {__glXDisp_ConvolutionFilter2D, __glXDispSwap_ConvolutionFilter2D},
+ /* [ 271] = 4103 */ {__glXDisp_ConvolutionParameterf, __glXDispSwap_ConvolutionParameterf},
+ /* [ 272] = 4104 */ {__glXDisp_ConvolutionParameterfv, __glXDispSwap_ConvolutionParameterfv},
+ /* [ 273] = 4105 */ {__glXDisp_ConvolutionParameteri, __glXDispSwap_ConvolutionParameteri},
+ /* [ 274] = 4106 */ {__glXDisp_ConvolutionParameteriv, __glXDispSwap_ConvolutionParameteriv},
+ /* [ 275] = 4107 */ {__glXDisp_CopyConvolutionFilter1D, __glXDispSwap_CopyConvolutionFilter1D},
+ /* [ 276] = 4108 */ {__glXDisp_CopyConvolutionFilter2D, __glXDispSwap_CopyConvolutionFilter2D},
+ /* [ 277] = 4109 */ {__glXDisp_SeparableFilter2D, __glXDispSwap_SeparableFilter2D},
+ /* [ 278] = 4110 */ {__glXDisp_Histogram, __glXDispSwap_Histogram},
+ /* [ 279] = 4111 */ {__glXDisp_Minmax, __glXDispSwap_Minmax},
+ /* [ 280] = 4112 */ {__glXDisp_ResetHistogram, __glXDispSwap_ResetHistogram},
+ /* [ 281] = 4113 */ {__glXDisp_ResetMinmax, __glXDispSwap_ResetMinmax},
+ /* [ 282] = 4114 */ {__glXDisp_TexImage3D, __glXDispSwap_TexImage3D},
+ /* [ 283] = 4115 */ {__glXDisp_TexSubImage3D, __glXDispSwap_TexSubImage3D},
+ /* [ 284] = 4116 */ {NULL, NULL},
+ /* [ 285] = 4117 */ {__glXDisp_BindTexture, __glXDispSwap_BindTexture},
+ /* [ 286] = 4118 */ {__glXDisp_PrioritizeTextures, __glXDispSwap_PrioritizeTextures},
+ /* [ 287] = 4119 */ {__glXDisp_CopyTexImage1D, __glXDispSwap_CopyTexImage1D},
+ /* [ 288] = 4120 */ {__glXDisp_CopyTexImage2D, __glXDispSwap_CopyTexImage2D},
+ /* [ 289] = 4121 */ {__glXDisp_CopyTexSubImage1D, __glXDispSwap_CopyTexSubImage1D},
+ /* [ 290] = 4122 */ {__glXDisp_CopyTexSubImage2D, __glXDispSwap_CopyTexSubImage2D},
+ /* [ 291] = 4123 */ {__glXDisp_CopyTexSubImage3D, __glXDispSwap_CopyTexSubImage3D},
+ /* [ 292] = 4124 */ {__glXDisp_FogCoordfvEXT, __glXDispSwap_FogCoordfvEXT},
+ /* [ 293] = 4125 */ {__glXDisp_FogCoorddvEXT, __glXDispSwap_FogCoorddvEXT},
+ /* [ 294] = 4126 */ {__glXDisp_SecondaryColor3bvEXT, __glXDispSwap_SecondaryColor3bvEXT},
+ /* [ 295] = 4127 */ {__glXDisp_SecondaryColor3svEXT, __glXDispSwap_SecondaryColor3svEXT},
+ /* [ 296] = 4176 */ {NULL, NULL},
+ /* [ 297] = 4177 */ {NULL, NULL},
+ /* [ 298] = 4178 */ {NULL, NULL},
+ /* [ 299] = 4179 */ {NULL, NULL},
+ /* [ 300] = 4180 */ {__glXDisp_BindProgramNV, __glXDispSwap_BindProgramNV},
+ /* [ 301] = 4181 */ {__glXDisp_ExecuteProgramNV, __glXDispSwap_ExecuteProgramNV},
+ /* [ 302] = 4182 */ {__glXDisp_RequestResidentProgramsNV, __glXDispSwap_RequestResidentProgramsNV},
+ /* [ 303] = 4183 */ {__glXDisp_LoadProgramNV, __glXDispSwap_LoadProgramNV},
+ /* [ 304] = 4184 */ {__glXDisp_ProgramEnvParameter4fvARB, __glXDispSwap_ProgramEnvParameter4fvARB},
+ /* [ 305] = 4185 */ {__glXDisp_ProgramEnvParameter4dvARB, __glXDispSwap_ProgramEnvParameter4dvARB},
+ /* [ 306] = 4186 */ {__glXDisp_ProgramParameters4fvNV, __glXDispSwap_ProgramParameters4fvNV},
+ /* [ 307] = 4187 */ {__glXDisp_ProgramParameters4dvNV, __glXDispSwap_ProgramParameters4dvNV},
+ /* [ 308] = 4188 */ {__glXDisp_TrackMatrixNV, __glXDispSwap_TrackMatrixNV},
+ /* [ 309] = 4189 */ {__glXDisp_VertexAttrib1svARB, __glXDispSwap_VertexAttrib1svARB},
+ /* [ 310] = 4190 */ {__glXDisp_VertexAttrib2svARB, __glXDispSwap_VertexAttrib2svARB},
+ /* [ 311] = 4191 */ {__glXDisp_VertexAttrib3svARB, __glXDispSwap_VertexAttrib3svARB},
+ /* [ 312] = 4192 */ {__glXDisp_VertexAttrib4svARB, __glXDispSwap_VertexAttrib4svARB},
+ /* [ 313] = 4193 */ {__glXDisp_VertexAttrib1fvARB, __glXDispSwap_VertexAttrib1fvARB},
+ /* [ 314] = 4194 */ {__glXDisp_VertexAttrib2fvARB, __glXDispSwap_VertexAttrib2fvARB},
+ /* [ 315] = 4195 */ {__glXDisp_VertexAttrib3fvARB, __glXDispSwap_VertexAttrib3fvARB},
+ /* [ 316] = 4196 */ {__glXDisp_VertexAttrib4fvARB, __glXDispSwap_VertexAttrib4fvARB},
+ /* [ 317] = 4197 */ {__glXDisp_VertexAttrib1dvARB, __glXDispSwap_VertexAttrib1dvARB},
+ /* [ 318] = 4198 */ {__glXDisp_VertexAttrib2dvARB, __glXDispSwap_VertexAttrib2dvARB},
+ /* [ 319] = 4199 */ {__glXDisp_VertexAttrib3dvARB, __glXDispSwap_VertexAttrib3dvARB},
+ /* [ 320] = 4200 */ {__glXDisp_VertexAttrib4dvARB, __glXDispSwap_VertexAttrib4dvARB},
+ /* [ 321] = 4201 */ {__glXDisp_VertexAttrib4NubvARB, __glXDispSwap_VertexAttrib4NubvARB},
+ /* [ 322] = 4202 */ {__glXDisp_VertexAttribs1svNV, __glXDispSwap_VertexAttribs1svNV},
+ /* [ 323] = 4203 */ {__glXDisp_VertexAttribs2svNV, __glXDispSwap_VertexAttribs2svNV},
+ /* [ 324] = 4204 */ {__glXDisp_VertexAttribs3svNV, __glXDispSwap_VertexAttribs3svNV},
+ /* [ 325] = 4205 */ {__glXDisp_VertexAttribs4svNV, __glXDispSwap_VertexAttribs4svNV},
+ /* [ 326] = 4206 */ {__glXDisp_VertexAttribs1fvNV, __glXDispSwap_VertexAttribs1fvNV},
+ /* [ 327] = 4207 */ {__glXDisp_VertexAttribs2fvNV, __glXDispSwap_VertexAttribs2fvNV},
+ /* [ 328] = 4208 */ {__glXDisp_VertexAttribs3fvNV, __glXDispSwap_VertexAttribs3fvNV},
+ /* [ 329] = 4209 */ {__glXDisp_VertexAttribs4fvNV, __glXDispSwap_VertexAttribs4fvNV},
+ /* [ 330] = 4210 */ {__glXDisp_VertexAttribs1dvNV, __glXDispSwap_VertexAttribs1dvNV},
+ /* [ 331] = 4211 */ {__glXDisp_VertexAttribs2dvNV, __glXDispSwap_VertexAttribs2dvNV},
+ /* [ 332] = 4212 */ {__glXDisp_VertexAttribs3dvNV, __glXDispSwap_VertexAttribs3dvNV},
+ /* [ 333] = 4213 */ {__glXDisp_VertexAttribs4dvNV, __glXDispSwap_VertexAttribs4dvNV},
+ /* [ 334] = 4214 */ {__glXDisp_VertexAttribs4ubvNV, __glXDispSwap_VertexAttribs4ubvNV},
+ /* [ 335] = 4215 */ {__glXDisp_ProgramLocalParameter4fvARB, __glXDispSwap_ProgramLocalParameter4fvARB},
+ /* [ 336] = 4216 */ {__glXDisp_ProgramLocalParameter4dvARB, __glXDispSwap_ProgramLocalParameter4dvARB},
+ /* [ 337] = 4217 */ {__glXDisp_ProgramStringARB, __glXDispSwap_ProgramStringARB},
+ /* [ 338] = 4218 */ {__glXDisp_ProgramNamedParameter4fvNV, __glXDispSwap_ProgramNamedParameter4fvNV},
+ /* [ 339] = 4219 */ {__glXDisp_ProgramNamedParameter4dvNV, __glXDispSwap_ProgramNamedParameter4dvNV},
+ /* [ 340] = 4220 */ {__glXDisp_ActiveStencilFaceEXT, __glXDispSwap_ActiveStencilFaceEXT},
+ /* [ 341] = 4221 */ {__glXDisp_PointParameteriNV, __glXDispSwap_PointParameteriNV},
+ /* [ 342] = 4222 */ {__glXDisp_PointParameterivNV, __glXDispSwap_PointParameterivNV},
+ /* [ 343] = 4223 */ {NULL, NULL},
+ /* [ 344] = 4224 */ {NULL, NULL},
+ /* [ 345] = 4225 */ {NULL, NULL},
+ /* [ 346] = 4226 */ {NULL, NULL},
+ /* [ 347] = 4227 */ {NULL, NULL},
+ /* [ 348] = 4228 */ {__glXDisp_BlendEquationSeparateEXT, __glXDispSwap_BlendEquationSeparateEXT},
+ /* [ 349] = 4229 */ {NULL, NULL},
+ /* [ 350] = 4230 */ {__glXDisp_VertexAttrib4bvARB, __glXDispSwap_VertexAttrib4bvARB},
+ /* [ 351] = 4231 */ {__glXDisp_VertexAttrib4ivARB, __glXDispSwap_VertexAttrib4ivARB},
+ /* [ 352] = 4232 */ {__glXDisp_VertexAttrib4ubvARB, __glXDispSwap_VertexAttrib4ubvARB},
+ /* [ 353] = 4233 */ {__glXDisp_VertexAttrib4usvARB, __glXDispSwap_VertexAttrib4usvARB},
+ /* [ 354] = 4234 */ {__glXDisp_VertexAttrib4uivARB, __glXDispSwap_VertexAttrib4uivARB},
+ /* [ 355] = 4235 */ {__glXDisp_VertexAttrib4NbvARB, __glXDispSwap_VertexAttrib4NbvARB},
+ /* [ 356] = 4236 */ {__glXDisp_VertexAttrib4NsvARB, __glXDispSwap_VertexAttrib4NsvARB},
+ /* [ 357] = 4237 */ {__glXDisp_VertexAttrib4NivARB, __glXDispSwap_VertexAttrib4NivARB},
+ /* [ 358] = 4238 */ {__glXDisp_VertexAttrib4NusvARB, __glXDispSwap_VertexAttrib4NusvARB},
+ /* [ 359] = 4239 */ {__glXDisp_VertexAttrib4NuivARB, __glXDispSwap_VertexAttrib4NuivARB},
+ /* [ 360] = 4320 */ {__glXDisp_DeleteFramebuffersEXT, __glXDispSwap_DeleteFramebuffersEXT},
+ /* [ 361] = 4321 */ {__glXDisp_FramebufferTexture1DEXT, __glXDispSwap_FramebufferTexture1DEXT},
+ /* [ 362] = 4322 */ {__glXDisp_FramebufferTexture2DEXT, __glXDispSwap_FramebufferTexture2DEXT},
+ /* [ 363] = 4323 */ {__glXDisp_FramebufferTexture3DEXT, __glXDispSwap_FramebufferTexture3DEXT},
+ /* [ 364] = 4324 */ {__glXDisp_FramebufferRenderbufferEXT, __glXDispSwap_FramebufferRenderbufferEXT},
+ /* [ 365] = 4325 */ {__glXDisp_GenerateMipmapEXT, __glXDispSwap_GenerateMipmapEXT},
+ /* [ 366] = 4326 */ {NULL, NULL},
+ /* [ 367] = 4327 */ {NULL, NULL},
+ /* [ 368] = 4328 */ {NULL, NULL},
+ /* [ 369] = 4329 */ {NULL, NULL},
+ /* [ 370] = 4330 */ {__glXDisp_BlitFramebufferEXT, __glXDispSwap_BlitFramebufferEXT},
+ /* [ 371] = 4331 */ {__glXDisp_RenderbufferStorageMultisample, __glXDispSwap_RenderbufferStorageMultisample},
+ /* [ 372] = 4332 */ {NULL, NULL},
+ /* [ 373] = 4333 */ {NULL, NULL},
+ /* [ 374] = 4334 */ {NULL, NULL},
+ /* [ 375] = 4335 */ {NULL, NULL},
+ /* [ 376] = 4128 */ {__glXDisp_SecondaryColor3ivEXT, __glXDispSwap_SecondaryColor3ivEXT},
+ /* [ 377] = 4129 */ {__glXDisp_SecondaryColor3fvEXT, __glXDispSwap_SecondaryColor3fvEXT},
+ /* [ 378] = 4130 */ {__glXDisp_SecondaryColor3dvEXT, __glXDispSwap_SecondaryColor3dvEXT},
+ /* [ 379] = 4131 */ {__glXDisp_SecondaryColor3ubvEXT, __glXDispSwap_SecondaryColor3ubvEXT},
+ /* [ 380] = 4132 */ {__glXDisp_SecondaryColor3usvEXT, __glXDispSwap_SecondaryColor3usvEXT},
+ /* [ 381] = 4133 */ {__glXDisp_SecondaryColor3uivEXT, __glXDispSwap_SecondaryColor3uivEXT},
+ /* [ 382] = 4134 */ {__glXDisp_BlendFuncSeparateEXT, __glXDispSwap_BlendFuncSeparateEXT},
+ /* [ 383] = 4135 */ {NULL, NULL},
+ /* [ 384] = 4264 */ {NULL, NULL},
+ /* [ 385] = 4265 */ {__glXDisp_VertexAttrib1svNV, __glXDispSwap_VertexAttrib1svNV},
+ /* [ 386] = 4266 */ {__glXDisp_VertexAttrib2svNV, __glXDispSwap_VertexAttrib2svNV},
+ /* [ 387] = 4267 */ {__glXDisp_VertexAttrib3svNV, __glXDispSwap_VertexAttrib3svNV},
+ /* [ 388] = 4268 */ {__glXDisp_VertexAttrib4svNV, __glXDispSwap_VertexAttrib4svNV},
+ /* [ 389] = 4269 */ {__glXDisp_VertexAttrib1fvNV, __glXDispSwap_VertexAttrib1fvNV},
+ /* [ 390] = 4270 */ {__glXDisp_VertexAttrib2fvNV, __glXDispSwap_VertexAttrib2fvNV},
+ /* [ 391] = 4271 */ {__glXDisp_VertexAttrib3fvNV, __glXDispSwap_VertexAttrib3fvNV},
+ /* [ 392] = 4272 */ {__glXDisp_VertexAttrib4fvNV, __glXDispSwap_VertexAttrib4fvNV},
+ /* [ 393] = 4273 */ {__glXDisp_VertexAttrib1dvNV, __glXDispSwap_VertexAttrib1dvNV},
+ /* [ 394] = 4274 */ {__glXDisp_VertexAttrib2dvNV, __glXDispSwap_VertexAttrib2dvNV},
+ /* [ 395] = 4275 */ {__glXDisp_VertexAttrib3dvNV, __glXDispSwap_VertexAttrib3dvNV},
+ /* [ 396] = 4276 */ {__glXDisp_VertexAttrib4dvNV, __glXDispSwap_VertexAttrib4dvNV},
+ /* [ 397] = 4277 */ {__glXDisp_VertexAttrib4ubvNV, __glXDispSwap_VertexAttrib4ubvNV},
+ /* [ 398] = 4278 */ {NULL, NULL},
+ /* [ 399] = 4279 */ {NULL, NULL},
+ /* [ 400] = 4312 */ {NULL, NULL},
+ /* [ 401] = 4313 */ {NULL, NULL},
+ /* [ 402] = 4314 */ {NULL, NULL},
+ /* [ 403] = 4315 */ {NULL, NULL},
+ /* [ 404] = 4316 */ {__glXDisp_BindRenderbufferEXT, __glXDispSwap_BindRenderbufferEXT},
+ /* [ 405] = 4317 */ {__glXDisp_DeleteRenderbuffersEXT, __glXDispSwap_DeleteRenderbuffersEXT},
+ /* [ 406] = 4318 */ {__glXDisp_RenderbufferStorageEXT, __glXDispSwap_RenderbufferStorageEXT},
+ /* [ 407] = 4319 */ {__glXDisp_BindFramebufferEXT, __glXDispSwap_BindFramebufferEXT},
+};
+
+static const int_fast16_t Render_size_table[408][2] = {
+ /* [ 0] = 0 */ { 0, ~0},
+ /* [ 1] = 1 */ { 8, ~0},
+ /* [ 2] = 2 */ { 12, 0},
+ /* [ 3] = 3 */ { 8, ~0},
+ /* [ 4] = 4 */ { 8, ~0},
+ /* [ 5] = 5 */ { 48, 1},
+ /* [ 6] = 6 */ { 8, ~0},
+ /* [ 7] = 7 */ { 28, ~0},
+ /* [ 8] = 8 */ { 16, ~0},
+ /* [ 9] = 9 */ { 16, ~0},
+ /* [ 10] = 10 */ { 12, ~0},
+ /* [ 11] = 11 */ { 8, ~0},
+ /* [ 12] = 12 */ { 16, ~0},
+ /* [ 13] = 13 */ { 12, ~0},
+ /* [ 14] = 14 */ { 8, ~0},
+ /* [ 15] = 15 */ { 36, ~0},
+ /* [ 16] = 16 */ { 20, ~0},
+ /* [ 17] = 17 */ { 20, ~0},
+ /* [ 18] = 18 */ { 12, ~0},
+ /* [ 19] = 19 */ { 8, ~0},
+ /* [ 20] = 20 */ { 20, ~0},
+ /* [ 21] = 21 */ { 12, ~0},
+ /* [ 22] = 22 */ { 8, ~0},
+ /* [ 23] = 23 */ { 4, ~0},
+ /* [ 24] = 24 */ { 12, ~0},
+ /* [ 25] = 25 */ { 8, ~0},
+ /* [ 26] = 26 */ { 8, ~0},
+ /* [ 27] = 27 */ { 8, ~0},
+ /* [ 28] = 28 */ { 8, ~0},
+ /* [ 29] = 29 */ { 28, ~0},
+ /* [ 30] = 30 */ { 16, ~0},
+ /* [ 31] = 31 */ { 16, ~0},
+ /* [ 32] = 32 */ { 12, ~0},
+ /* [ 33] = 33 */ { 20, ~0},
+ /* [ 34] = 34 */ { 12, ~0},
+ /* [ 35] = 35 */ { 12, ~0},
+ /* [ 36] = 36 */ { 8, ~0},
+ /* [ 37] = 37 */ { 28, ~0},
+ /* [ 38] = 38 */ { 16, ~0},
+ /* [ 39] = 39 */ { 16, ~0},
+ /* [ 40] = 40 */ { 12, ~0},
+ /* [ 41] = 41 */ { 36, ~0},
+ /* [ 42] = 42 */ { 20, ~0},
+ /* [ 43] = 43 */ { 20, ~0},
+ /* [ 44] = 44 */ { 12, ~0},
+ /* [ 45] = 45 */ { 36, ~0},
+ /* [ 46] = 46 */ { 20, ~0},
+ /* [ 47] = 47 */ { 20, ~0},
+ /* [ 48] = 48 */ { 12, ~0},
+ /* [ 49] = 49 */ { 12, ~0},
+ /* [ 50] = 50 */ { 8, ~0},
+ /* [ 51] = 51 */ { 8, ~0},
+ /* [ 52] = 52 */ { 8, ~0},
+ /* [ 53] = 53 */ { 20, ~0},
+ /* [ 54] = 54 */ { 12, ~0},
+ /* [ 55] = 55 */ { 12, ~0},
+ /* [ 56] = 56 */ { 8, ~0},
+ /* [ 57] = 57 */ { 28, ~0},
+ /* [ 58] = 58 */ { 16, ~0},
+ /* [ 59] = 59 */ { 16, ~0},
+ /* [ 60] = 60 */ { 12, ~0},
+ /* [ 61] = 61 */ { 36, ~0},
+ /* [ 62] = 62 */ { 20, ~0},
+ /* [ 63] = 63 */ { 20, ~0},
+ /* [ 64] = 64 */ { 12, ~0},
+ /* [ 65] = 65 */ { 20, ~0},
+ /* [ 66] = 66 */ { 12, ~0},
+ /* [ 67] = 67 */ { 12, ~0},
+ /* [ 68] = 68 */ { 8, ~0},
+ /* [ 69] = 69 */ { 28, ~0},
+ /* [ 70] = 70 */ { 16, ~0},
+ /* [ 71] = 71 */ { 16, ~0},
+ /* [ 72] = 72 */ { 12, ~0},
+ /* [ 73] = 73 */ { 36, ~0},
+ /* [ 74] = 74 */ { 20, ~0},
+ /* [ 75] = 75 */ { 20, ~0},
+ /* [ 76] = 76 */ { 12, ~0},
+ /* [ 77] = 77 */ { 40, ~0},
+ /* [ 78] = 78 */ { 12, ~0},
+ /* [ 79] = 79 */ { 8, ~0},
+ /* [ 80] = 80 */ { 12, ~0},
+ /* [ 81] = 81 */ { 8, 2},
+ /* [ 82] = 82 */ { 12, ~0},
+ /* [ 83] = 83 */ { 8, 3},
+ /* [ 84] = 84 */ { 8, ~0},
+ /* [ 85] = 85 */ { 12, ~0},
+ /* [ 86] = 86 */ { 16, ~0},
+ /* [ 87] = 87 */ { 12, 4},
+ /* [ 88] = 88 */ { 16, ~0},
+ /* [ 89] = 89 */ { 12, 5},
+ /* [ 90] = 90 */ { 12, ~0},
+ /* [ 91] = 91 */ { 8, 6},
+ /* [ 92] = 92 */ { 12, ~0},
+ /* [ 93] = 93 */ { 8, 7},
+ /* [ 94] = 94 */ { 12, ~0},
+ /* [ 95] = 95 */ { 8, ~0},
+ /* [ 96] = 96 */ { 16, ~0},
+ /* [ 97] = 97 */ { 12, 8},
+ /* [ 98] = 98 */ { 16, ~0},
+ /* [ 99] = 99 */ { 12, 9},
+ /* [100] = 100 */ { 8, ~0},
+ /* [101] = 101 */ { 12, ~0},
+ /* [102] = 102 */ { 24, 10},
+ /* [103] = 103 */ { 20, ~0},
+ /* [104] = 104 */ { 8, ~0},
+ /* [105] = 105 */ { 16, ~0},
+ /* [106] = 106 */ { 12, 11},
+ /* [107] = 107 */ { 16, ~0},
+ /* [108] = 108 */ { 12, 12},
+ /* [109] = 109 */ { 56, 13},
+ /* [110] = 110 */ { 56, 14},
+ /* [111] = 111 */ { 16, ~0},
+ /* [112] = 112 */ { 12, 15},
+ /* [113] = 113 */ { 16, ~0},
+ /* [114] = 114 */ { 12, 16},
+ /* [115] = 115 */ { 20, ~0},
+ /* [116] = 116 */ { 12, 17},
+ /* [117] = 117 */ { 16, ~0},
+ /* [118] = 118 */ { 12, 18},
+ /* [119] = 119 */ { 16, ~0},
+ /* [120] = 120 */ { 12, 19},
+ /* [121] = 121 */ { 4, ~0},
+ /* [122] = 122 */ { 8, ~0},
+ /* [123] = 123 */ { 8, ~0},
+ /* [124] = 124 */ { 4, ~0},
+ /* [125] = 125 */ { 8, ~0},
+ /* [126] = 126 */ { 8, ~0},
+ /* [127] = 127 */ { 8, ~0},
+ /* [128] = 128 */ { 20, ~0},
+ /* [129] = 129 */ { 8, ~0},
+ /* [130] = 130 */ { 20, ~0},
+ /* [131] = 131 */ { 8, ~0},
+ /* [132] = 132 */ { 12, ~0},
+ /* [133] = 133 */ { 8, ~0},
+ /* [134] = 134 */ { 8, ~0},
+ /* [135] = 135 */ { 8, ~0},
+ /* [136] = 136 */ { 8, ~0},
+ /* [137] = 137 */ { 12, ~0},
+ /* [138] = 138 */ { 8, ~0},
+ /* [139] = 139 */ { 8, ~0},
+ /* [140] = 140 */ { 0, ~0},
+ /* [141] = 141 */ { 4, ~0},
+ /* [142] = 142 */ { 8, ~0},
+ /* [143] = 143 */ { 28, 20},
+ /* [144] = 144 */ { 20, 21},
+ /* [145] = 145 */ { 48, 22},
+ /* [146] = 146 */ { 32, 23},
+ /* [147] = 147 */ { 24, ~0},
+ /* [148] = 148 */ { 16, ~0},
+ /* [149] = 149 */ { 44, ~0},
+ /* [150] = 150 */ { 28, ~0},
+ /* [151] = 151 */ { 12, ~0},
+ /* [152] = 152 */ { 8, ~0},
+ /* [153] = 153 */ { 20, ~0},
+ /* [154] = 154 */ { 12, ~0},
+ /* [155] = 155 */ { 16, ~0},
+ /* [156] = 156 */ { 8, ~0},
+ /* [157] = 157 */ { 24, ~0},
+ /* [158] = 158 */ { 12, ~0},
+ /* [159] = 159 */ { 12, ~0},
+ /* [160] = 160 */ { 12, ~0},
+ /* [161] = 161 */ { 8, ~0},
+ /* [162] = 162 */ { 16, ~0},
+ /* [163] = 163 */ { 16, ~0},
+ /* [164] = 164 */ { 8, ~0},
+ /* [165] = 165 */ { 12, ~0},
+ /* [166] = 166 */ { 12, ~0},
+ /* [167] = 167 */ { 12, ~0},
+ /* [168] = 168 */ { 12, 24},
+ /* [169] = 169 */ { 12, 25},
+ /* [170] = 170 */ { 12, 26},
+ /* [171] = 171 */ { 8, ~0},
+ /* [172] = 172 */ { 24, ~0},
+ /* [173] = 173 */ { 40, 27},
+ /* [174] = 174 */ { 20, ~0},
+ /* [175] = 175 */ { 52, ~0},
+ /* [176] = 176 */ { 4, ~0},
+ /* [177] = 177 */ { 68, ~0},
+ /* [178] = 178 */ {132, ~0},
+ /* [179] = 179 */ { 8, ~0},
+ /* [180] = 180 */ { 68, ~0},
+ /* [181] = 181 */ {132, ~0},
+ /* [182] = 182 */ { 52, ~0},
+ /* [183] = 183 */ { 4, ~0},
+ /* [184] = 184 */ { 4, ~0},
+ /* [185] = 185 */ { 36, ~0},
+ /* [186] = 186 */ { 20, ~0},
+ /* [187] = 187 */ { 28, ~0},
+ /* [188] = 188 */ { 16, ~0},
+ /* [189] = 189 */ { 28, ~0},
+ /* [190] = 190 */ { 16, ~0},
+ /* [191] = 191 */ { 20, ~0},
+ /* [192] = 192 */ { 12, ~0},
+ /* [193] = 193 */ { 16, 28},
+ /* [194] = 194 */ { 8, ~0},
+ /* [195] = 195 */ { 44, 29},
+ /* [196] = 196 */ { 24, ~0},
+ /* [197] = 197 */ { 8, ~0},
+ /* [198] = 198 */ { 16, ~0},
+ /* [199] = 199 */ { 12, ~0},
+ /* [200] = 200 */ { 12, ~0},
+ /* [201] = 201 */ { 12, ~0},
+ /* [202] = 202 */ { 24, ~0},
+ /* [203] = 203 */ { 16, ~0},
+ /* [204] = 204 */ { 16, ~0},
+ /* [205] = 205 */ { 12, ~0},
+ /* [206] = 206 */ { 32, ~0},
+ /* [207] = 207 */ { 20, ~0},
+ /* [208] = 208 */ { 20, ~0},
+ /* [209] = 209 */ { 16, ~0},
+ /* [210] = 210 */ { 40, ~0},
+ /* [211] = 211 */ { 24, ~0},
+ /* [212] = 212 */ { 24, ~0},
+ /* [213] = 213 */ { 16, ~0},
+ /* [214] = 214 */ { 28, 30},
+ /* [215] = 215 */ { 32, 31},
+ /* [216] = 216 */ { 36, 32},
+ /* [217] = 217 */ { 28, 33},
+ /* [218] = 218 */ { 36, 34},
+ /* [219] = 219 */ { 44, 35},
+ /* [220] = 220 */ { 0, ~0},
+ /* [221] = 221 */ { 0, ~0},
+ /* [222] = 222 */ { 0, ~0},
+ /* [223] = 223 */ { 0, ~0},
+ /* [224] = 224 */ { 0, ~0},
+ /* [225] = 225 */ { 0, ~0},
+ /* [226] = 226 */ { 0, ~0},
+ /* [227] = 227 */ { 0, ~0},
+ /* [228] = 228 */ { 0, ~0},
+ /* [229] = 229 */ { 12, ~0},
+ /* [230] = 230 */ { 16, ~0},
+ /* [231] = 231 */ { 12, ~0},
+ /* [232] = 232 */ { 8, ~0},
+ /* [233] = 233 */ { 8, 36},
+ /* [234] = 234 */ { 12, ~0},
+ /* [235] = 235 */ { 0, ~0},
+ /* [236] = 236 */ { 0, ~0},
+ /* [237] = 237 */ { 24, ~0},
+ /* [238] = 238 */ { 0, ~0},
+ /* [239] = 239 */ { 0, ~0},
+ /* [240] = 2048 */ { 12, ~0},
+ /* [241] = 2049 */ { 8, ~0},
+ /* [242] = 2050 */ { 0, ~0},
+ /* [243] = 2051 */ { 0, ~0},
+ /* [244] = 2052 */ { 0, ~0},
+ /* [245] = 2053 */ { 44, 37},
+ /* [246] = 2054 */ { 12, 38},
+ /* [247] = 2055 */ { 12, 39},
+ /* [248] = 2056 */ { 24, ~0},
+ /* [249] = 2057 */ { 0, ~0},
+ /* [250] = 2058 */ { 0, ~0},
+ /* [251] = 2059 */ { 0, ~0},
+ /* [252] = 2060 */ { 0, ~0},
+ /* [253] = 2061 */ { 0, ~0},
+ /* [254] = 2062 */ { 0, ~0},
+ /* [255] = 2063 */ { 0, ~0},
+ /* [256] = 2064 */ { 0, ~0},
+ /* [257] = 2065 */ { 12, ~0},
+ /* [258] = 2066 */ { 8, 40},
+ /* [259] = 2067 */ { 0, ~0},
+ /* [260] = 2068 */ { 0, ~0},
+ /* [261] = 2069 */ { 0, ~0},
+ /* [262] = 2070 */ { 0, ~0},
+ /* [263] = 2071 */ { 0, ~0},
+ /* [264] = 4096 */ { 20, ~0},
+ /* [265] = 4097 */ { 8, ~0},
+ /* [266] = 4098 */ { 0, ~0},
+ /* [267] = 4099 */ { 60, 41},
+ /* [268] = 4100 */ { 60, 42},
+ /* [269] = 4101 */ { 48, 43},
+ /* [270] = 4102 */ { 48, 44},
+ /* [271] = 4103 */ { 16, ~0},
+ /* [272] = 4104 */ { 12, 45},
+ /* [273] = 4105 */ { 16, ~0},
+ /* [274] = 4106 */ { 12, 46},
+ /* [275] = 4107 */ { 24, ~0},
+ /* [276] = 4108 */ { 28, ~0},
+ /* [277] = 4109 */ { 32, 47},
+ /* [278] = 4110 */ { 20, ~0},
+ /* [279] = 4111 */ { 16, ~0},
+ /* [280] = 4112 */ { 8, ~0},
+ /* [281] = 4113 */ { 8, ~0},
+ /* [282] = 4114 */ { 84, 48},
+ /* [283] = 4115 */ { 92, 49},
+ /* [284] = 4116 */ { 0, ~0},
+ /* [285] = 4117 */ { 12, ~0},
+ /* [286] = 4118 */ { 8, 50},
+ /* [287] = 4119 */ { 32, ~0},
+ /* [288] = 4120 */ { 36, ~0},
+ /* [289] = 4121 */ { 28, ~0},
+ /* [290] = 4122 */ { 36, ~0},
+ /* [291] = 4123 */ { 40, ~0},
+ /* [292] = 4124 */ { 8, ~0},
+ /* [293] = 4125 */ { 12, ~0},
+ /* [294] = 4126 */ { 8, ~0},
+ /* [295] = 4127 */ { 12, ~0},
+ /* [296] = 4176 */ { 0, ~0},
+ /* [297] = 4177 */ { 0, ~0},
+ /* [298] = 4178 */ { 0, ~0},
+ /* [299] = 4179 */ { 0, ~0},
+ /* [300] = 4180 */ { 12, ~0},
+ /* [301] = 4181 */ { 28, ~0},
+ /* [302] = 4182 */ { 8, 51},
+ /* [303] = 4183 */ { 16, 52},
+ /* [304] = 4184 */ { 28, ~0},
+ /* [305] = 4185 */ { 44, ~0},
+ /* [306] = 4186 */ { 16, 53},
+ /* [307] = 4187 */ { 16, 54},
+ /* [308] = 4188 */ { 20, ~0},
+ /* [309] = 4189 */ { 12, ~0},
+ /* [310] = 4190 */ { 12, ~0},
+ /* [311] = 4191 */ { 16, ~0},
+ /* [312] = 4192 */ { 16, ~0},
+ /* [313] = 4193 */ { 12, ~0},
+ /* [314] = 4194 */ { 16, ~0},
+ /* [315] = 4195 */ { 20, ~0},
+ /* [316] = 4196 */ { 24, ~0},
+ /* [317] = 4197 */ { 16, ~0},
+ /* [318] = 4198 */ { 24, ~0},
+ /* [319] = 4199 */ { 32, ~0},
+ /* [320] = 4200 */ { 40, ~0},
+ /* [321] = 4201 */ { 12, ~0},
+ /* [322] = 4202 */ { 12, 55},
+ /* [323] = 4203 */ { 12, 56},
+ /* [324] = 4204 */ { 12, 57},
+ /* [325] = 4205 */ { 12, 58},
+ /* [326] = 4206 */ { 12, 59},
+ /* [327] = 4207 */ { 12, 60},
+ /* [328] = 4208 */ { 12, 61},
+ /* [329] = 4209 */ { 12, 62},
+ /* [330] = 4210 */ { 12, 63},
+ /* [331] = 4211 */ { 12, 64},
+ /* [332] = 4212 */ { 12, 65},
+ /* [333] = 4213 */ { 12, 66},
+ /* [334] = 4214 */ { 12, 67},
+ /* [335] = 4215 */ { 28, ~0},
+ /* [336] = 4216 */ { 44, ~0},
+ /* [337] = 4217 */ { 16, 68},
+ /* [338] = 4218 */ { 28, 69},
+ /* [339] = 4219 */ { 44, 70},
+ /* [340] = 4220 */ { 8, ~0},
+ /* [341] = 4221 */ { 12, ~0},
+ /* [342] = 4222 */ { 8, 71},
+ /* [343] = 4223 */ { 0, ~0},
+ /* [344] = 4224 */ { 0, ~0},
+ /* [345] = 4225 */ { 0, ~0},
+ /* [346] = 4226 */ { 0, ~0},
+ /* [347] = 4227 */ { 0, ~0},
+ /* [348] = 4228 */ { 12, ~0},
+ /* [349] = 4229 */ { 0, ~0},
+ /* [350] = 4230 */ { 12, ~0},
+ /* [351] = 4231 */ { 24, ~0},
+ /* [352] = 4232 */ { 12, ~0},
+ /* [353] = 4233 */ { 16, ~0},
+ /* [354] = 4234 */ { 24, ~0},
+ /* [355] = 4235 */ { 12, ~0},
+ /* [356] = 4236 */ { 16, ~0},
+ /* [357] = 4237 */ { 24, ~0},
+ /* [358] = 4238 */ { 16, ~0},
+ /* [359] = 4239 */ { 24, ~0},
+ /* [360] = 4320 */ { 8, 72},
+ /* [361] = 4321 */ { 24, ~0},
+ /* [362] = 4322 */ { 24, ~0},
+ /* [363] = 4323 */ { 28, ~0},
+ /* [364] = 4324 */ { 20, ~0},
+ /* [365] = 4325 */ { 8, ~0},
+ /* [366] = 4326 */ { 0, ~0},
+ /* [367] = 4327 */ { 0, ~0},
+ /* [368] = 4328 */ { 0, ~0},
+ /* [369] = 4329 */ { 0, ~0},
+ /* [370] = 4330 */ { 44, ~0},
+ /* [371] = 4331 */ { 24, ~0},
+ /* [372] = 4332 */ { 0, ~0},
+ /* [373] = 4333 */ { 0, ~0},
+ /* [374] = 4334 */ { 0, ~0},
+ /* [375] = 4335 */ { 0, ~0},
+ /* [376] = 4128 */ { 16, ~0},
+ /* [377] = 4129 */ { 16, ~0},
+ /* [378] = 4130 */ { 28, ~0},
+ /* [379] = 4131 */ { 8, ~0},
+ /* [380] = 4132 */ { 12, ~0},
+ /* [381] = 4133 */ { 16, ~0},
+ /* [382] = 4134 */ { 20, ~0},
+ /* [383] = 4135 */ { 0, ~0},
+ /* [384] = 4264 */ { 0, ~0},
+ /* [385] = 4265 */ { 12, ~0},
+ /* [386] = 4266 */ { 12, ~0},
+ /* [387] = 4267 */ { 16, ~0},
+ /* [388] = 4268 */ { 16, ~0},
+ /* [389] = 4269 */ { 12, ~0},
+ /* [390] = 4270 */ { 16, ~0},
+ /* [391] = 4271 */ { 20, ~0},
+ /* [392] = 4272 */ { 24, ~0},
+ /* [393] = 4273 */ { 16, ~0},
+ /* [394] = 4274 */ { 24, ~0},
+ /* [395] = 4275 */ { 32, ~0},
+ /* [396] = 4276 */ { 40, ~0},
+ /* [397] = 4277 */ { 12, ~0},
+ /* [398] = 4278 */ { 0, ~0},
+ /* [399] = 4279 */ { 0, ~0},
+ /* [400] = 4312 */ { 0, ~0},
+ /* [401] = 4313 */ { 0, ~0},
+ /* [402] = 4314 */ { 0, ~0},
+ /* [403] = 4315 */ { 0, ~0},
+ /* [404] = 4316 */ { 12, ~0},
+ /* [405] = 4317 */ { 8, 73},
+ /* [406] = 4318 */ { 20, ~0},
+ /* [407] = 4319 */ { 12, ~0},
+};
+
+static const gl_proto_size_func Render_size_func_table[74] = {
+ __glXCallListsReqSize,
+ __glXBitmapReqSize,
+ __glXFogfvReqSize,
+ __glXFogivReqSize,
+ __glXLightfvReqSize,
+ __glXLightivReqSize,
+ __glXLightModelfvReqSize,
+ __glXLightModelivReqSize,
+ __glXMaterialfvReqSize,
+ __glXMaterialivReqSize,
+ __glXPolygonStippleReqSize,
+ __glXTexParameterfvReqSize,
+ __glXTexParameterivReqSize,
+ __glXTexImage1DReqSize,
+ __glXTexImage2DReqSize,
+ __glXTexEnvfvReqSize,
+ __glXTexEnvivReqSize,
+ __glXTexGendvReqSize,
+ __glXTexGenfvReqSize,
+ __glXTexGenivReqSize,
+ __glXMap1dReqSize,
+ __glXMap1fReqSize,
+ __glXMap2dReqSize,
+ __glXMap2fReqSize,
+ __glXPixelMapfvReqSize,
+ __glXPixelMapuivReqSize,
+ __glXPixelMapusvReqSize,
+ __glXDrawPixelsReqSize,
+ __glXDrawArraysReqSize,
+ __glXColorSubTableReqSize,
+ __glXCompressedTexImage1DARBReqSize,
+ __glXCompressedTexImage2DARBReqSize,
+ __glXCompressedTexImage3DARBReqSize,
+ __glXCompressedTexSubImage1DARBReqSize,
+ __glXCompressedTexSubImage2DARBReqSize,
+ __glXCompressedTexSubImage3DARBReqSize,
+ __glXDrawBuffersARBReqSize,
+ __glXColorTableReqSize,
+ __glXColorTableParameterfvReqSize,
+ __glXColorTableParameterivReqSize,
+ __glXPointParameterfvEXTReqSize,
+ __glXTexSubImage1DReqSize,
+ __glXTexSubImage2DReqSize,
+ __glXConvolutionFilter1DReqSize,
+ __glXConvolutionFilter2DReqSize,
+ __glXConvolutionParameterfvReqSize,
+ __glXConvolutionParameterivReqSize,
+ __glXSeparableFilter2DReqSize,
+ __glXTexImage3DReqSize,
+ __glXTexSubImage3DReqSize,
+ __glXPrioritizeTexturesReqSize,
+ __glXRequestResidentProgramsNVReqSize,
+ __glXLoadProgramNVReqSize,
+ __glXProgramParameters4fvNVReqSize,
+ __glXProgramParameters4dvNVReqSize,
+ __glXVertexAttribs1svNVReqSize,
+ __glXVertexAttribs2svNVReqSize,
+ __glXVertexAttribs3svNVReqSize,
+ __glXVertexAttribs4svNVReqSize,
+ __glXVertexAttribs1fvNVReqSize,
+ __glXVertexAttribs2fvNVReqSize,
+ __glXVertexAttribs3fvNVReqSize,
+ __glXVertexAttribs4fvNVReqSize,
+ __glXVertexAttribs1dvNVReqSize,
+ __glXVertexAttribs2dvNVReqSize,
+ __glXVertexAttribs3dvNVReqSize,
+ __glXVertexAttribs4dvNVReqSize,
+ __glXVertexAttribs4ubvNVReqSize,
+ __glXProgramStringARBReqSize,
+ __glXProgramNamedParameter4fvNVReqSize,
+ __glXProgramNamedParameter4dvNVReqSize,
+ __glXPointParameterivNVReqSize,
+ __glXDeleteFramebuffersEXTReqSize,
+ __glXDeleteRenderbuffersEXTReqSize,
+};
+
+const struct __glXDispatchInfo Render_dispatch_info = {
+ 13,
+ Render_dispatch_tree,
+ Render_function_table,
+ Render_size_table,
+ Render_size_func_table
+};
+
+/*****************************************************************/
+/* tree depth = 12 */
+static const int_fast16_t VendorPriv_dispatch_tree[152] = {
+ /* [0] -> opcode range [0, 131072], node depth 1 */
+ 2,
+ 5,
+ EMPTY_LEAF,
+ 119,
+ EMPTY_LEAF,
+
+ /* [5] -> opcode range [0, 32768], node depth 2 */
+ 1,
+ 8,
+ EMPTY_LEAF,
+
+ /* [8] -> opcode range [0, 16384], node depth 3 */
+ 1,
+ 11,
+ EMPTY_LEAF,
+
+ /* [11] -> opcode range [0, 8192], node depth 4 */
+ 2,
+ 16,
+ EMPTY_LEAF,
+ 78,
+ EMPTY_LEAF,
+
+ /* [16] -> opcode range [0, 2048], node depth 5 */
+ 2,
+ 21,
+ EMPTY_LEAF,
+ 36,
+ EMPTY_LEAF,
+
+ /* [21] -> opcode range [0, 512], node depth 6 */
+ 1,
+ 24,
+ EMPTY_LEAF,
+
+ /* [24] -> opcode range [0, 256], node depth 7 */
+ 1,
+ 27,
+ EMPTY_LEAF,
+
+ /* [27] -> opcode range [0, 128], node depth 8 */
+ 1,
+ 30,
+ EMPTY_LEAF,
+
+ /* [30] -> opcode range [0, 64], node depth 9 */
+ 1,
+ 33,
+ EMPTY_LEAF,
+
+ /* [33] -> opcode range [0, 32], node depth 10 */
+ 1,
+ LEAF(0),
+ EMPTY_LEAF,
+
+ /* [36] -> opcode range [1024, 1536], node depth 6 */
+ 2,
+ 41,
+ EMPTY_LEAF,
+ 53,
+ 67,
+
+ /* [41] -> opcode range [1024, 1152], node depth 7 */
+ 1,
+ 44,
+ EMPTY_LEAF,
+
+ /* [44] -> opcode range [1024, 1088], node depth 8 */
+ 1,
+ 47,
+ EMPTY_LEAF,
+
+ /* [47] -> opcode range [1024, 1056], node depth 9 */
+ 1,
+ 50,
+ EMPTY_LEAF,
+
+ /* [50] -> opcode range [1024, 1040], node depth 10 */
+ 1,
+ LEAF(16),
+ EMPTY_LEAF,
+
+ /* [53] -> opcode range [1280, 1408], node depth 7 */
+ 1,
+ 56,
+ EMPTY_LEAF,
+
+ /* [56] -> opcode range [1280, 1344], node depth 8 */
+ 2,
+ 61,
+ LEAF(24),
+ EMPTY_LEAF,
+ 64,
+
+ /* [61] -> opcode range [1280, 1296], node depth 9 */
+ 1,
+ EMPTY_LEAF,
+ LEAF(40),
+
+ /* [64] -> opcode range [1328, 1344], node depth 9 */
+ 1,
+ LEAF(48),
+ EMPTY_LEAF,
+
+ /* [67] -> opcode range [1408, 1536], node depth 7 */
+ 1,
+ 70,
+ EMPTY_LEAF,
+
+ /* [70] -> opcode range [1408, 1472], node depth 8 */
+ 1,
+ 73,
+ EMPTY_LEAF,
+
+ /* [73] -> opcode range [1408, 1440], node depth 9 */
+ 2,
+ EMPTY_LEAF,
+ LEAF(56),
+ LEAF(64),
+ EMPTY_LEAF,
+
+ /* [78] -> opcode range [4096, 6144], node depth 5 */
+ 2,
+ 83,
+ EMPTY_LEAF,
+ 101,
+ EMPTY_LEAF,
+
+ /* [83] -> opcode range [4096, 4608], node depth 6 */
+ 1,
+ 86,
+ EMPTY_LEAF,
+
+ /* [86] -> opcode range [4096, 4352], node depth 7 */
+ 1,
+ 89,
+ EMPTY_LEAF,
+
+ /* [89] -> opcode range [4096, 4224], node depth 8 */
+ 1,
+ 92,
+ EMPTY_LEAF,
+
+ /* [92] -> opcode range [4096, 4160], node depth 9 */
+ 1,
+ 95,
+ EMPTY_LEAF,
+
+ /* [95] -> opcode range [4096, 4128], node depth 10 */
+ 1,
+ 98,
+ EMPTY_LEAF,
+
+ /* [98] -> opcode range [4096, 4112], node depth 11 */
+ 1,
+ LEAF(72),
+ EMPTY_LEAF,
+
+ /* [101] -> opcode range [5120, 5632], node depth 6 */
+ 1,
+ 104,
+ EMPTY_LEAF,
+
+ /* [104] -> opcode range [5120, 5376], node depth 7 */
+ 1,
+ 107,
+ EMPTY_LEAF,
+
+ /* [107] -> opcode range [5120, 5248], node depth 8 */
+ 1,
+ 110,
+ EMPTY_LEAF,
+
+ /* [110] -> opcode range [5120, 5184], node depth 9 */
+ 1,
+ EMPTY_LEAF,
+ 113,
+
+ /* [113] -> opcode range [5152, 5184], node depth 10 */
+ 1,
+ 116,
+ EMPTY_LEAF,
+
+ /* [116] -> opcode range [5152, 5168], node depth 11 */
+ 1,
+ LEAF(80),
+ EMPTY_LEAF,
+
+ /* [119] -> opcode range [65536, 98304], node depth 2 */
+ 1,
+ 122,
+ EMPTY_LEAF,
+
+ /* [122] -> opcode range [65536, 81920], node depth 3 */
+ 1,
+ 125,
+ EMPTY_LEAF,
+
+ /* [125] -> opcode range [65536, 73728], node depth 4 */
+ 1,
+ 128,
+ EMPTY_LEAF,
+
+ /* [128] -> opcode range [65536, 69632], node depth 5 */
+ 1,
+ 131,
+ EMPTY_LEAF,
+
+ /* [131] -> opcode range [65536, 67584], node depth 6 */
+ 1,
+ 134,
+ EMPTY_LEAF,
+
+ /* [134] -> opcode range [65536, 66560], node depth 7 */
+ 1,
+ 137,
+ EMPTY_LEAF,
+
+ /* [137] -> opcode range [65536, 66048], node depth 8 */
+ 1,
+ 140,
+ EMPTY_LEAF,
+
+ /* [140] -> opcode range [65536, 65792], node depth 9 */
+ 1,
+ 143,
+ EMPTY_LEAF,
+
+ /* [143] -> opcode range [65536, 65664], node depth 10 */
+ 1,
+ 146,
+ EMPTY_LEAF,
+
+ /* [146] -> opcode range [65536, 65600], node depth 11 */
+ 1,
+ 149,
+ EMPTY_LEAF,
+
+ /* [149] -> opcode range [65536, 65568], node depth 12 */
+ 1,
+ LEAF(88),
+ EMPTY_LEAF,
+
+};
+
+static const void *VendorPriv_function_table[104][2] = {
+ /* [ 0] = 0 */ {NULL, NULL},
+ /* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT},
+ /* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT},
+ /* [ 3] = 3 */ {__glXDisp_GetConvolutionParameterivEXT, __glXDispSwap_GetConvolutionParameterivEXT},
+ /* [ 4] = 4 */ {__glXDisp_GetSeparableFilterEXT, __glXDispSwap_GetSeparableFilterEXT},
+ /* [ 5] = 5 */ {__glXDisp_GetHistogramEXT, __glXDispSwap_GetHistogramEXT},
+ /* [ 6] = 6 */ {__glXDisp_GetHistogramParameterfvEXT, __glXDispSwap_GetHistogramParameterfvEXT},
+ /* [ 7] = 7 */ {__glXDisp_GetHistogramParameterivEXT, __glXDispSwap_GetHistogramParameterivEXT},
+ /* [ 8] = 8 */ {__glXDisp_GetMinmaxEXT, __glXDispSwap_GetMinmaxEXT},
+ /* [ 9] = 9 */ {__glXDisp_GetMinmaxParameterfvEXT, __glXDispSwap_GetMinmaxParameterfvEXT},
+ /* [ 10] = 10 */ {__glXDisp_GetMinmaxParameterivEXT, __glXDispSwap_GetMinmaxParameterivEXT},
+ /* [ 11] = 11 */ {__glXDisp_AreTexturesResidentEXT, __glXDispSwap_AreTexturesResidentEXT},
+ /* [ 12] = 12 */ {__glXDisp_DeleteTexturesEXT, __glXDispSwap_DeleteTexturesEXT},
+ /* [ 13] = 13 */ {__glXDisp_GenTexturesEXT, __glXDispSwap_GenTexturesEXT},
+ /* [ 14] = 14 */ {__glXDisp_IsTextureEXT, __glXDispSwap_IsTextureEXT},
+ /* [ 15] = 15 */ {NULL, NULL},
+ /* [ 16] = 1024 */ {__glXDisp_QueryContextInfoEXT, __glXDispSwap_QueryContextInfoEXT},
+ /* [ 17] = 1025 */ {NULL, NULL},
+ /* [ 18] = 1026 */ {NULL, NULL},
+ /* [ 19] = 1027 */ {NULL, NULL},
+ /* [ 20] = 1028 */ {NULL, NULL},
+ /* [ 21] = 1029 */ {NULL, NULL},
+ /* [ 22] = 1030 */ {NULL, NULL},
+ /* [ 23] = 1031 */ {NULL, NULL},
+ /* [ 24] = 1296 */ {__glXDisp_GetProgramEnvParameterfvARB, __glXDispSwap_GetProgramEnvParameterfvARB},
+ /* [ 25] = 1297 */ {__glXDisp_GetProgramEnvParameterdvARB, __glXDispSwap_GetProgramEnvParameterdvARB},
+ /* [ 26] = 1298 */ {__glXDisp_GetProgramivNV, __glXDispSwap_GetProgramivNV},
+ /* [ 27] = 1299 */ {__glXDisp_GetProgramStringNV, __glXDispSwap_GetProgramStringNV},
+ /* [ 28] = 1300 */ {__glXDisp_GetTrackMatrixivNV, __glXDispSwap_GetTrackMatrixivNV},
+ /* [ 29] = 1301 */ {__glXDisp_GetVertexAttribdvARB, __glXDispSwap_GetVertexAttribdvARB},
+ /* [ 30] = 1302 */ {__glXDisp_GetVertexAttribfvARB, __glXDispSwap_GetVertexAttribfvARB},
+ /* [ 31] = 1303 */ {__glXDisp_GetVertexAttribivNV, __glXDispSwap_GetVertexAttribivNV},
+ /* [ 32] = 1304 */ {__glXDisp_IsProgramNV, __glXDispSwap_IsProgramNV},
+ /* [ 33] = 1305 */ {__glXDisp_GetProgramLocalParameterfvARB, __glXDispSwap_GetProgramLocalParameterfvARB},
+ /* [ 34] = 1306 */ {__glXDisp_GetProgramLocalParameterdvARB, __glXDispSwap_GetProgramLocalParameterdvARB},
+ /* [ 35] = 1307 */ {__glXDisp_GetProgramivARB, __glXDispSwap_GetProgramivARB},
+ /* [ 36] = 1308 */ {__glXDisp_GetProgramStringARB, __glXDispSwap_GetProgramStringARB},
+ /* [ 37] = 1309 */ {NULL, NULL},
+ /* [ 38] = 1310 */ {__glXDisp_GetProgramNamedParameterfvNV, __glXDispSwap_GetProgramNamedParameterfvNV},
+ /* [ 39] = 1311 */ {__glXDisp_GetProgramNamedParameterdvNV, __glXDispSwap_GetProgramNamedParameterdvNV},
+ /* [ 40] = 1288 */ {NULL, NULL},
+ /* [ 41] = 1289 */ {NULL, NULL},
+ /* [ 42] = 1290 */ {NULL, NULL},
+ /* [ 43] = 1291 */ {NULL, NULL},
+ /* [ 44] = 1292 */ {NULL, NULL},
+ /* [ 45] = 1293 */ {__glXDisp_AreProgramsResidentNV, __glXDispSwap_AreProgramsResidentNV},
+ /* [ 46] = 1294 */ {__glXDisp_DeleteProgramsNV, __glXDispSwap_DeleteProgramsNV},
+ /* [ 47] = 1295 */ {__glXDisp_GenProgramsNV, __glXDispSwap_GenProgramsNV},
+ /* [ 48] = 1328 */ {NULL, NULL},
+ /* [ 49] = 1329 */ {NULL, NULL},
+ /* [ 50] = 1330 */ {__glXDisp_BindTexImageEXT, __glXDispSwap_BindTexImageEXT},
+ /* [ 51] = 1331 */ {__glXDisp_ReleaseTexImageEXT, __glXDispSwap_ReleaseTexImageEXT},
+ /* [ 52] = 1332 */ {NULL, NULL},
+ /* [ 53] = 1333 */ {NULL, NULL},
+ /* [ 54] = 1334 */ {NULL, NULL},
+ /* [ 55] = 1335 */ {NULL, NULL},
+ /* [ 56] = 1416 */ {NULL, NULL},
+ /* [ 57] = 1417 */ {NULL, NULL},
+ /* [ 58] = 1418 */ {NULL, NULL},
+ /* [ 59] = 1419 */ {NULL, NULL},
+ /* [ 60] = 1420 */ {NULL, NULL},
+ /* [ 61] = 1421 */ {NULL, NULL},
+ /* [ 62] = 1422 */ {__glXDisp_IsRenderbufferEXT, __glXDispSwap_IsRenderbufferEXT},
+ /* [ 63] = 1423 */ {__glXDisp_GenRenderbuffersEXT, __glXDispSwap_GenRenderbuffersEXT},
+ /* [ 64] = 1424 */ {__glXDisp_GetRenderbufferParameterivEXT, __glXDispSwap_GetRenderbufferParameterivEXT},
+ /* [ 65] = 1425 */ {__glXDisp_IsFramebufferEXT, __glXDispSwap_IsFramebufferEXT},
+ /* [ 66] = 1426 */ {__glXDisp_GenFramebuffersEXT, __glXDispSwap_GenFramebuffersEXT},
+ /* [ 67] = 1427 */ {__glXDisp_CheckFramebufferStatusEXT, __glXDispSwap_CheckFramebufferStatusEXT},
+ /* [ 68] = 1428 */ {__glXDisp_GetFramebufferAttachmentParameterivEXT, __glXDispSwap_GetFramebufferAttachmentParameterivEXT},
+ /* [ 69] = 1429 */ {NULL, NULL},
+ /* [ 70] = 1430 */ {NULL, NULL},
+ /* [ 71] = 1431 */ {NULL, NULL},
+ /* [ 72] = 4096 */ {NULL, NULL},
+ /* [ 73] = 4097 */ {NULL, NULL},
+ /* [ 74] = 4098 */ {__glXDisp_GetColorTableSGI, __glXDispSwap_GetColorTableSGI},
+ /* [ 75] = 4099 */ {__glXDisp_GetColorTableParameterfvSGI, __glXDispSwap_GetColorTableParameterfvSGI},
+ /* [ 76] = 4100 */ {__glXDisp_GetColorTableParameterivSGI, __glXDispSwap_GetColorTableParameterivSGI},
+ /* [ 77] = 4101 */ {NULL, NULL},
+ /* [ 78] = 4102 */ {NULL, NULL},
+ /* [ 79] = 4103 */ {NULL, NULL},
+ /* [ 80] = 5152 */ {NULL, NULL},
+ /* [ 81] = 5153 */ {NULL, NULL},
+ /* [ 82] = 5154 */ {__glXDisp_CopySubBufferMESA, __glXDispSwap_CopySubBufferMESA},
+ /* [ 83] = 5155 */ {NULL, NULL},
+ /* [ 84] = 5156 */ {NULL, NULL},
+ /* [ 85] = 5157 */ {NULL, NULL},
+ /* [ 86] = 5158 */ {NULL, NULL},
+ /* [ 87] = 5159 */ {NULL, NULL},
+ /* [ 88] = 65536 */ {__glXDisp_SwapIntervalSGI, __glXDispSwap_SwapIntervalSGI},
+ /* [ 89] = 65537 */ {__glXDisp_MakeCurrentReadSGI, __glXDispSwap_MakeCurrentReadSGI},
+ /* [ 90] = 65538 */ {NULL, NULL},
+ /* [ 91] = 65539 */ {NULL, NULL},
+ /* [ 92] = 65540 */ {__glXDisp_GetFBConfigsSGIX, __glXDispSwap_GetFBConfigsSGIX},
+ /* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX},
+ /* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX},
+ /* [ 95] = 65543 */ {__glXDisp_CreateGLXPbufferSGIX, __glXDispSwap_CreateGLXPbufferSGIX},
+ /* [ 96] = 65544 */ {__glXDisp_DestroyGLXPbufferSGIX, __glXDispSwap_DestroyGLXPbufferSGIX},
+ /* [ 97] = 65545 */ {__glXDisp_ChangeDrawableAttributesSGIX, __glXDispSwap_ChangeDrawableAttributesSGIX},
+ /* [ 98] = 65546 */ {__glXDisp_GetDrawableAttributesSGIX, __glXDispSwap_GetDrawableAttributesSGIX},
+ /* [ 99] = 65547 */ {NULL, NULL},
+ /* [ 100] = 65548 */ {NULL, NULL},
+ /* [ 101] = 65549 */ {NULL, NULL},
+ /* [ 102] = 65550 */ {NULL, NULL},
+ /* [ 103] = 65551 */ {NULL, NULL},
+};
+
+const struct __glXDispatchInfo VendorPriv_dispatch_info = {
+ 17,
+ VendorPriv_dispatch_tree,
+ VendorPriv_function_table,
+ NULL,
+ NULL
+};
+
diff --git a/xorg-server/glx/indirect_texture_compression.c b/xorg-server/glx/indirect_texture_compression.c
index 6187415f5..e1e666317 100644
--- a/xorg-server/glx/indirect_texture_compression.c
+++ b/xorg-server/glx/indirect_texture_compression.c
@@ -44,80 +44,91 @@
#include "glthread.h"
#include "dispatch.h"
-int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *pc)
+int
+__glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte * pc)
{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ xGLXSingleReq *const req = (xGLXSingleReq *) pc;
int error;
- __GLXcontext * const cx = __glXForceCurrent( cl, req->contextTag, & error );
+ __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
ClientPtr client = cl->client;
-
pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum target = *(GLenum *)(pc + 0);
- const GLint level = *(GLint *)(pc + 4);
- GLint compsize = 0;
- char *answer = NULL, answerBuffer[200];
-
- CALL_GetTexLevelParameteriv(GET_DISPATCH(), (target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize));
-
- if ( compsize != 0 ) {
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetCompressedTexImageARB(GET_DISPATCH(), (target, level, answer));
- }
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *)&__glXReply)->width = compsize;
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- error = Success;
+ if (cx != NULL) {
+ const GLenum target = *(GLenum *) (pc + 0);
+ const GLint level = *(GLint *) (pc + 4);
+ GLint compsize = 0;
+ char *answer = NULL, answerBuffer[200];
+
+ CALL_GetTexLevelParameteriv(GET_DISPATCH(),
+ (target, level,
+ GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
+ &compsize));
+
+ if (compsize != 0) {
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetCompressedTexImageARB(GET_DISPATCH(),
+ (target, level, answer));
+ }
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ ((xGLXGetTexImageReply *) & __glXReply)->width = compsize;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ error = Success;
}
return error;
}
-
-int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *pc)
+int
+__glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *cl,
+ GLbyte * pc)
{
- xGLXSingleReq * const req = (xGLXSingleReq *) pc;
+ xGLXSingleReq *const req = (xGLXSingleReq *) pc;
int error;
- __GLXcontext * const cx = __glXForceCurrent( cl, bswap_32( req->contextTag ), & error );
+ __GLXcontext *const cx =
+ __glXForceCurrent(cl, bswap_32(req->contextTag), &error);
ClientPtr client = cl->client;
-
pc += __GLX_SINGLE_HDR_SIZE;
- if ( cx != NULL ) {
- const GLenum target = (GLenum) bswap_32( *(int *)(pc + 0) );
- const GLint level = (GLint ) bswap_32( *(int *)(pc + 4) );
- GLint compsize = 0;
- char *answer = NULL, answerBuffer[200];
-
- CALL_GetTexLevelParameteriv(GET_DISPATCH(), (target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize));
-
- if ( compsize != 0 ) {
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetCompressedTexImageARB(GET_DISPATCH(), (target, level, answer));
- }
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *)&__glXReply)->width = compsize;
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- error = Success;
+ if (cx != NULL) {
+ const GLenum target = (GLenum) bswap_32(*(int *) (pc + 0));
+ const GLint level = (GLint) bswap_32(*(int *) (pc + 4));
+ GLint compsize = 0;
+ char *answer = NULL, answerBuffer[200];
+
+ CALL_GetTexLevelParameteriv(GET_DISPATCH(),
+ (target, level,
+ GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
+ &compsize));
+
+ if (compsize != 0) {
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetCompressedTexImageARB(GET_DISPATCH(),
+ (target, level, answer));
+ }
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ ((xGLXGetTexImageReply *) & __glXReply)->width = compsize;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ error = Success;
}
return error;
diff --git a/xorg-server/glx/indirect_util.c b/xorg-server/glx/indirect_util.c
index f71fe6dd2..66604617e 100644
--- a/xorg-server/glx/indirect_util.c
+++ b/xorg-server/glx/indirect_util.c
@@ -1,314 +1,297 @@
-/*
- * (C) Copyright IBM Corporation 2005
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#else
-
-#include "glheader.h"
-
-#endif
-
-#include <string.h>
-
-#include <X11/Xmd.h>
-#include <GL/gl.h>
-#include <GL/glxproto.h>
-#include <inttypes.h>
-#include "indirect_size.h"
-#include "indirect_size_get.h"
-#include "indirect_dispatch.h"
-#include "glxserver.h"
-#include "glxbyteorder.h"
-#include "singlesize.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
-#include "glxext.h"
-#include "indirect_table.h"
-#include "indirect_util.h"
-
-
-#define __GLX_PAD(a) (((a)+3)&~3)
-
-extern xGLXSingleReply __glXReply;
-
-
-GLint
-__glGetBooleanv_variable_size( GLenum e )
-{
- if ( e == GL_COMPRESSED_TEXTURE_FORMATS ) {
- GLint temp;
-
- CALL_GetIntegerv( GET_DISPATCH(),
- (GL_NUM_COMPRESSED_TEXTURE_FORMATS, & temp) );
- return temp;
- }
- else {
- return 0;
- }
-}
-
-
-/**
- * Get a properly aligned buffer to hold reply data.
- *
- * \warning
- * This function assumes that \c local_buffer is already properly aligned.
- * It also assumes that \c alignment is a power of two.
- */
-void *
-__glXGetAnswerBuffer( __GLXclientState * cl, size_t required_size,
- void * local_buffer, size_t local_size, unsigned alignment )
-{
- void * buffer = local_buffer;
- const unsigned mask = alignment - 1;
-
- if ( local_size < required_size ) {
- const size_t worst_case_size = required_size + alignment;
- intptr_t temp_buf;
-
- if ( cl->returnBufSize < worst_case_size ) {
- void * temp = realloc( cl->returnBuf, worst_case_size );
-
- if ( temp == NULL ) {
- return NULL;
- }
-
- cl->returnBuf = temp;
- cl->returnBufSize = worst_case_size;
- }
-
- temp_buf = (intptr_t) cl->returnBuf;
- temp_buf = (temp_buf + mask) & ~mask;
- buffer = (void *) temp_buf;
- }
-
- return buffer;
-}
-
-
-/**
- * Send a GLX reply to the client.
- *
- * Technically speaking, there are several different ways to encode a GLX
- * reply. The primary difference is whether or not certain fields (e.g.,
- * retval, size, and "pad3") are set. This function gets around that by
- * always setting all of the fields to "reasonable" values. This does no
- * harm to clients, but it does make the server-side code much more compact.
- */
-void
-__glXSendReply( ClientPtr client, const void * data, size_t elements,
- size_t element_size, GLboolean always_array, CARD32 retval )
-{
- size_t reply_ints = 0;
-
- if ( __glXErrorOccured() ) {
- elements = 0;
- }
- else if ( (elements > 1) || always_array ) {
- reply_ints = bytes_to_int32(elements * element_size);
- }
-
- __glXReply.length = reply_ints;
- __glXReply.type = X_Reply;
- __glXReply.sequenceNumber = client->sequence;
- __glXReply.size = elements;
- __glXReply.retval = retval;
-
-
- /* It is faster on almost always every architecture to just copy the 8
- * bytes, even when not necessary, than check to see of the value of
- * elements requires it. Copying the data when not needed will do no
- * harm.
- */
-
- (void) memcpy( & __glXReply.pad3, data, 8 );
- WriteToClient( client, sz_xGLXSingleReply, (char *) & __glXReply );
-
- if ( reply_ints != 0 ) {
- WriteToClient( client, reply_ints * 4, (char *) data );
- }
-}
-
-
-/**
- * Send a GLX reply to the client.
- *
- * Technically speaking, there are several different ways to encode a GLX
- * reply. The primary difference is whether or not certain fields (e.g.,
- * retval, size, and "pad3") are set. This function gets around that by
- * always setting all of the fields to "reasonable" values. This does no
- * harm to clients, but it does make the server-side code much more compact.
- *
- * \warning
- * This function assumes that values stored in \c data will be byte-swapped
- * by the caller if necessary.
- */
-void
-__glXSendReplySwap( ClientPtr client, const void * data, size_t elements,
- size_t element_size, GLboolean always_array, CARD32 retval )
-{
- size_t reply_ints = 0;
-
- if ( __glXErrorOccured() ) {
- elements = 0;
- }
- else if ( (elements > 1) || always_array ) {
- reply_ints = bytes_to_int32(elements * element_size);
- }
-
- __glXReply.length = bswap_32( reply_ints );
- __glXReply.type = X_Reply;
- __glXReply.sequenceNumber = bswap_16( client->sequence );
- __glXReply.size = bswap_32( elements );
- __glXReply.retval = bswap_32( retval );
-
-
- /* It is faster on almost always every architecture to just copy the 8
- * bytes, even when not necessary, than check to see of the value of
- * elements requires it. Copying the data when not needed will do no
- * harm.
- */
-
- (void) memcpy( & __glXReply.pad3, data, 8 );
- WriteToClient( client, sz_xGLXSingleReply, (char *) & __glXReply );
-
- if ( reply_ints != 0 ) {
- WriteToClient( client, reply_ints * 4, (char *) data );
- }
-}
-
-
-static int
-get_decode_index(const struct __glXDispatchInfo *dispatch_info,
- unsigned opcode)
-{
- int remaining_bits;
- int next_remain;
- const int_fast16_t * const tree = dispatch_info->dispatch_tree;
- int_fast16_t index;
-
-
- remaining_bits = dispatch_info->bits;
- if (opcode >= (1U << remaining_bits)) {
- return -1;
- }
-
- index = 0;
- for (/* empty */; remaining_bits > 0; remaining_bits = next_remain) {
- unsigned mask;
- unsigned child_index;
-
-
- /* Calculate the slice of bits used by this node.
- *
- * If remaining_bits = 8 and tree[index] = 3, the mask of just the
- * remaining bits is 0x00ff and the mask for the remaining bits after
- * this node is 0x001f. By taking 0x00ff & ~0x001f, we get 0x00e0.
- * This masks the 3 bits that we would want for this node.
- */
-
- next_remain = remaining_bits - tree[index];
- mask = ((1 << remaining_bits) - 1) &
- ~((1 << next_remain) - 1);
-
-
- /* Using the mask, calculate the index of the opcode in the node.
- * With that index, fetch the index of the next node.
- */
-
- child_index = (opcode & mask) >> next_remain;
- index = tree[index + 1 + child_index];
-
-
- /* If the next node is an empty leaf, the opcode is for a non-existant
- * function. We're done.
- *
- * If the next node is a non-empty leaf, look up the function pointer
- * and return it.
- */
-
- if (index == EMPTY_LEAF) {
- return -1;
- }
- else if (IS_LEAF_INDEX(index)) {
- unsigned func_index;
-
-
- /* The value stored in the tree for a leaf node is the base of
- * the function pointers for that leaf node. The offset for the
- * function for a particular opcode is the remaining bits in the
- * opcode.
- */
-
- func_index = -index;
- func_index += opcode & ((1 << next_remain) - 1);
- return func_index;
- }
- }
-
- /* We should *never* get here!!!
- */
- return -1;
-}
-
-
-void *
-__glXGetProtocolDecodeFunction(const struct __glXDispatchInfo *dispatch_info,
- int opcode, int swapped_version)
-{
- const int func_index = get_decode_index(dispatch_info, opcode);
-
- return (func_index < 0)
- ? NULL
- : (void *) dispatch_info->dispatch_functions[func_index][swapped_version];
-}
-
-
-int
-__glXGetProtocolSizeData(const struct __glXDispatchInfo *dispatch_info,
- int opcode, __GLXrenderSizeData *data)
-{
- if (dispatch_info->size_table != NULL) {
- const int func_index = get_decode_index(dispatch_info, opcode);
-
- if ((func_index >= 0)
- && (dispatch_info->size_table[func_index][0] != 0)) {
- const int var_offset =
- dispatch_info->size_table[func_index][1];
-
- data->bytes = dispatch_info->size_table[func_index][0];
- data->varsize = (var_offset != ~0)
- ? dispatch_info->size_func_table[var_offset]
- : NULL;
-
- return 0;
- }
- }
-
- return -1;
-}
+/*
+ * (C) Copyright IBM Corporation 2005
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * IBM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
+#endif
+
+#include <string.h>
+
+#include <X11/Xmd.h>
+#include <GL/gl.h>
+#include <GL/glxproto.h>
+#include <inttypes.h>
+#include "indirect_size.h"
+#include "indirect_size_get.h"
+#include "indirect_dispatch.h"
+#include "glxserver.h"
+#include "glxbyteorder.h"
+#include "singlesize.h"
+#include "glapitable.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+#include "glxext.h"
+#include "indirect_table.h"
+#include "indirect_util.h"
+
+#define __GLX_PAD(a) (((a)+3)&~3)
+
+extern xGLXSingleReply __glXReply;
+
+GLint
+__glGetBooleanv_variable_size(GLenum e)
+{
+ if (e == GL_COMPRESSED_TEXTURE_FORMATS) {
+ GLint temp;
+
+ CALL_GetIntegerv(GET_DISPATCH(),
+ (GL_NUM_COMPRESSED_TEXTURE_FORMATS, &temp));
+ return temp;
+ }
+ else {
+ return 0;
+ }
+}
+
+/**
+ * Get a properly aligned buffer to hold reply data.
+ *
+ * \warning
+ * This function assumes that \c local_buffer is already properly aligned.
+ * It also assumes that \c alignment is a power of two.
+ */
+void *
+__glXGetAnswerBuffer(__GLXclientState * cl, size_t required_size,
+ void *local_buffer, size_t local_size, unsigned alignment)
+{
+ void *buffer = local_buffer;
+ const unsigned mask = alignment - 1;
+
+ if (local_size < required_size) {
+ const size_t worst_case_size = required_size + alignment;
+ intptr_t temp_buf;
+
+ if (cl->returnBufSize < worst_case_size) {
+ void *temp = realloc(cl->returnBuf, worst_case_size);
+
+ if (temp == NULL) {
+ return NULL;
+ }
+
+ cl->returnBuf = temp;
+ cl->returnBufSize = worst_case_size;
+ }
+
+ temp_buf = (intptr_t) cl->returnBuf;
+ temp_buf = (temp_buf + mask) & ~mask;
+ buffer = (void *) temp_buf;
+ }
+
+ return buffer;
+}
+
+/**
+ * Send a GLX reply to the client.
+ *
+ * Technically speaking, there are several different ways to encode a GLX
+ * reply. The primary difference is whether or not certain fields (e.g.,
+ * retval, size, and "pad3") are set. This function gets around that by
+ * always setting all of the fields to "reasonable" values. This does no
+ * harm to clients, but it does make the server-side code much more compact.
+ */
+void
+__glXSendReply(ClientPtr client, const void *data, size_t elements,
+ size_t element_size, GLboolean always_array, CARD32 retval)
+{
+ size_t reply_ints = 0;
+
+ if (__glXErrorOccured()) {
+ elements = 0;
+ }
+ else if ((elements > 1) || always_array) {
+ reply_ints = bytes_to_int32(elements * element_size);
+ }
+
+ __glXReply.length = reply_ints;
+ __glXReply.type = X_Reply;
+ __glXReply.sequenceNumber = client->sequence;
+ __glXReply.size = elements;
+ __glXReply.retval = retval;
+
+ /* It is faster on almost always every architecture to just copy the 8
+ * bytes, even when not necessary, than check to see of the value of
+ * elements requires it. Copying the data when not needed will do no
+ * harm.
+ */
+
+ (void) memcpy(&__glXReply.pad3, data, 8);
+ WriteToClient(client, sz_xGLXSingleReply, (char *) &__glXReply);
+
+ if (reply_ints != 0) {
+ WriteToClient(client, reply_ints * 4, (char *) data);
+ }
+}
+
+/**
+ * Send a GLX reply to the client.
+ *
+ * Technically speaking, there are several different ways to encode a GLX
+ * reply. The primary difference is whether or not certain fields (e.g.,
+ * retval, size, and "pad3") are set. This function gets around that by
+ * always setting all of the fields to "reasonable" values. This does no
+ * harm to clients, but it does make the server-side code much more compact.
+ *
+ * \warning
+ * This function assumes that values stored in \c data will be byte-swapped
+ * by the caller if necessary.
+ */
+void
+__glXSendReplySwap(ClientPtr client, const void *data, size_t elements,
+ size_t element_size, GLboolean always_array, CARD32 retval)
+{
+ size_t reply_ints = 0;
+
+ if (__glXErrorOccured()) {
+ elements = 0;
+ }
+ else if ((elements > 1) || always_array) {
+ reply_ints = bytes_to_int32(elements * element_size);
+ }
+
+ __glXReply.length = bswap_32(reply_ints);
+ __glXReply.type = X_Reply;
+ __glXReply.sequenceNumber = bswap_16(client->sequence);
+ __glXReply.size = bswap_32(elements);
+ __glXReply.retval = bswap_32(retval);
+
+ /* It is faster on almost always every architecture to just copy the 8
+ * bytes, even when not necessary, than check to see of the value of
+ * elements requires it. Copying the data when not needed will do no
+ * harm.
+ */
+
+ (void) memcpy(&__glXReply.pad3, data, 8);
+ WriteToClient(client, sz_xGLXSingleReply, (char *) &__glXReply);
+
+ if (reply_ints != 0) {
+ WriteToClient(client, reply_ints * 4, (char *) data);
+ }
+}
+
+static int
+get_decode_index(const struct __glXDispatchInfo *dispatch_info, unsigned opcode)
+{
+ int remaining_bits;
+ int next_remain;
+ const int_fast16_t *const tree = dispatch_info->dispatch_tree;
+ int_fast16_t index;
+
+ remaining_bits = dispatch_info->bits;
+ if (opcode >= (1U << remaining_bits)) {
+ return -1;
+ }
+
+ index = 0;
+ for ( /* empty */ ; remaining_bits > 0; remaining_bits = next_remain) {
+ unsigned mask;
+ unsigned child_index;
+
+ /* Calculate the slice of bits used by this node.
+ *
+ * If remaining_bits = 8 and tree[index] = 3, the mask of just the
+ * remaining bits is 0x00ff and the mask for the remaining bits after
+ * this node is 0x001f. By taking 0x00ff & ~0x001f, we get 0x00e0.
+ * This masks the 3 bits that we would want for this node.
+ */
+
+ next_remain = remaining_bits - tree[index];
+ mask = ((1 << remaining_bits) - 1) & ~((1 << next_remain) - 1);
+
+ /* Using the mask, calculate the index of the opcode in the node.
+ * With that index, fetch the index of the next node.
+ */
+
+ child_index = (opcode & mask) >> next_remain;
+ index = tree[index + 1 + child_index];
+
+ /* If the next node is an empty leaf, the opcode is for a non-existant
+ * function. We're done.
+ *
+ * If the next node is a non-empty leaf, look up the function pointer
+ * and return it.
+ */
+
+ if (index == EMPTY_LEAF) {
+ return -1;
+ }
+ else if (IS_LEAF_INDEX(index)) {
+ unsigned func_index;
+
+ /* The value stored in the tree for a leaf node is the base of
+ * the function pointers for that leaf node. The offset for the
+ * function for a particular opcode is the remaining bits in the
+ * opcode.
+ */
+
+ func_index = -index;
+ func_index += opcode & ((1 << next_remain) - 1);
+ return func_index;
+ }
+ }
+
+ /* We should *never* get here!!!
+ */
+ return -1;
+}
+
+void *
+__glXGetProtocolDecodeFunction(const struct __glXDispatchInfo *dispatch_info,
+ int opcode, int swapped_version)
+{
+ const int func_index = get_decode_index(dispatch_info, opcode);
+
+ return (func_index < 0)
+ ? NULL
+ : (void *) dispatch_info->
+ dispatch_functions[func_index][swapped_version];
+}
+
+int
+__glXGetProtocolSizeData(const struct __glXDispatchInfo *dispatch_info,
+ int opcode, __GLXrenderSizeData * data)
+{
+ if (dispatch_info->size_table != NULL) {
+ const int func_index = get_decode_index(dispatch_info, opcode);
+
+ if ((func_index >= 0)
+ && (dispatch_info->size_table[func_index][0] != 0)) {
+ const int var_offset = dispatch_info->size_table[func_index][1];
+
+ data->bytes = dispatch_info->size_table[func_index][0];
+ data->varsize = (var_offset != ~0)
+ ? dispatch_info->size_func_table[var_offset]
+ : NULL;
+
+ return 0;
+ }
+ }
+
+ return -1;
+}
diff --git a/xorg-server/glx/indirect_util.h b/xorg-server/glx/indirect_util.h
index b00727a4d..0e65075bf 100644
--- a/xorg-server/glx/indirect_util.h
+++ b/xorg-server/glx/indirect_util.h
@@ -26,28 +26,28 @@
#ifndef __GLX_INDIRECT_UTIL_H__
#define __GLX_INDIRECT_UTIL_H__
-extern GLint __glGetBooleanv_variable_size( GLenum e );
+extern GLint __glGetBooleanv_variable_size(GLenum e);
-extern void * __glXGetAnswerBuffer( __GLXclientState * cl,
- size_t required_size, void * local_buffer, size_t local_size,
- unsigned alignment );
+extern void *__glXGetAnswerBuffer(__GLXclientState * cl,
+ size_t required_size, void *local_buffer,
+ size_t local_size, unsigned alignment);
-extern void __glXSendReply( ClientPtr client, const void * data,
- size_t elements, size_t element_size, GLboolean always_array,
- CARD32 retval );
+extern void __glXSendReply(ClientPtr client, const void *data,
+ size_t elements, size_t element_size,
+ GLboolean always_array, CARD32 retval);
-extern void __glXSendReplySwap( ClientPtr client, const void * data,
- size_t elements, size_t element_size, GLboolean always_array,
- CARD32 retval );
+extern void __glXSendReplySwap(ClientPtr client, const void *data,
+ size_t elements, size_t element_size,
+ GLboolean always_array, CARD32 retval);
struct __glXDispatchInfo;
-extern void *__glXGetProtocolDecodeFunction(
- const struct __glXDispatchInfo *dispatch_info, int opcode,
- int swapped_version);
+extern void *__glXGetProtocolDecodeFunction(const struct __glXDispatchInfo
+ *dispatch_info, int opcode,
+ int swapped_version);
-extern int __glXGetProtocolSizeData(
- const struct __glXDispatchInfo *dispatch_info, int opcode,
- __GLXrenderSizeData *data);
+extern int __glXGetProtocolSizeData(const struct __glXDispatchInfo
+ *dispatch_info, int opcode,
+ __GLXrenderSizeData * data);
-#endif /* __GLX_INDIRECT_UTIL_H__ */
+#endif /* __GLX_INDIRECT_UTIL_H__ */
diff --git a/xorg-server/glx/render2.c b/xorg-server/glx/render2.c
index 32cee4160..9901943e5 100644
--- a/xorg-server/glx/render2.c
+++ b/xorg-server/glx/render2.c
@@ -45,138 +45,152 @@
#include "glthread.h"
#include "dispatch.h"
-
-void __glXDisp_Map1f(GLbyte *pc)
+void
+__glXDisp_Map1f(GLbyte * pc)
{
GLint order, k;
GLfloat u1, u2, *points;
GLenum target;
- target = *(GLenum *)(pc + 0);
- order = *(GLint *)(pc + 12);
- u1 = *(GLfloat *)(pc + 4);
- u2 = *(GLfloat *)(pc + 8);
- points = (GLfloat *)(pc + 16);
+ target = *(GLenum *) (pc + 0);
+ order = *(GLint *) (pc + 12);
+ u1 = *(GLfloat *) (pc + 4);
+ u2 = *(GLfloat *) (pc + 8);
+ points = (GLfloat *) (pc + 16);
k = __glMap1f_size(target);
- CALL_Map1f( GET_DISPATCH(), (target, u1, u2, k, order, points) );
+ CALL_Map1f(GET_DISPATCH(), (target, u1, u2, k, order, points));
}
-void __glXDisp_Map2f(GLbyte *pc)
+void
+__glXDisp_Map2f(GLbyte * pc)
{
GLint uorder, vorder, ustride, vstride, k;
GLfloat u1, u2, v1, v2, *points;
GLenum target;
- target = *(GLenum *)(pc + 0);
- uorder = *(GLint *)(pc + 12);
- vorder = *(GLint *)(pc + 24);
- u1 = *(GLfloat *)(pc + 4);
- u2 = *(GLfloat *)(pc + 8);
- v1 = *(GLfloat *)(pc + 16);
- v2 = *(GLfloat *)(pc + 20);
- points = (GLfloat *)(pc + 28);
+ target = *(GLenum *) (pc + 0);
+ uorder = *(GLint *) (pc + 12);
+ vorder = *(GLint *) (pc + 24);
+ u1 = *(GLfloat *) (pc + 4);
+ u2 = *(GLfloat *) (pc + 8);
+ v1 = *(GLfloat *) (pc + 16);
+ v2 = *(GLfloat *) (pc + 20);
+ points = (GLfloat *) (pc + 28);
k = __glMap2f_size(target);
ustride = vorder * k;
vstride = k;
- CALL_Map2f( GET_DISPATCH(), (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points) );
+ CALL_Map2f(GET_DISPATCH(),
+ (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
+ points));
}
-void __glXDisp_Map1d(GLbyte *pc)
+void
+__glXDisp_Map1d(GLbyte * pc)
{
GLint order, k;
+
#ifdef __GLX_ALIGN64
GLint compsize;
#endif
GLenum target;
GLdouble u1, u2, *points;
- target = *(GLenum*) (pc + 16);
- order = *(GLint*) (pc + 20);
+ target = *(GLenum *) (pc + 16);
+ order = *(GLint *) (pc + 20);
k = __glMap1d_size(target);
#ifdef __GLX_ALIGN64
if (order < 0 || k < 0) {
- compsize = 0;
- } else {
- compsize = order * k;
+ compsize = 0;
+ }
+ else {
+ compsize = order * k;
}
#endif
- __GLX_GET_DOUBLE(u1,pc);
- __GLX_GET_DOUBLE(u2,pc+8);
+ __GLX_GET_DOUBLE(u1, pc);
+ __GLX_GET_DOUBLE(u2, pc + 8);
pc += 24;
#ifdef __GLX_ALIGN64
- if (((unsigned long)pc) & 7) {
- /*
- ** Copy the doubles up 4 bytes, trashing the command but aligning
- ** the data in the process
- */
- __GLX_MEM_COPY(pc-4, pc, compsize*8);
- points = (GLdouble*) (pc - 4);
- } else {
- points = (GLdouble*) pc;
+ if (((unsigned long) pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc - 4, pc, compsize * 8);
+ points = (GLdouble *) (pc - 4);
+ }
+ else {
+ points = (GLdouble *) pc;
}
#else
- points = (GLdouble*) pc;
+ points = (GLdouble *) pc;
#endif
- CALL_Map1d( GET_DISPATCH(), (target, u1, u2, k, order, points) );
+ CALL_Map1d(GET_DISPATCH(), (target, u1, u2, k, order, points));
}
-void __glXDisp_Map2d(GLbyte *pc)
+void
+__glXDisp_Map2d(GLbyte * pc)
{
GLdouble u1, u2, v1, v2, *points;
GLint uorder, vorder, ustride, vstride, k;
+
#ifdef __GLX_ALIGN64
GLint compsize;
#endif
GLenum target;
- target = *(GLenum *)(pc + 32);
- uorder = *(GLint *)(pc + 36);
- vorder = *(GLint *)(pc + 40);
+ target = *(GLenum *) (pc + 32);
+ uorder = *(GLint *) (pc + 36);
+ vorder = *(GLint *) (pc + 40);
k = __glMap2d_size(target);
#ifdef __GLX_ALIGN64
if (vorder < 0 || uorder < 0 || k < 0) {
- compsize = 0;
- } else {
- compsize = uorder * vorder * k;
+ compsize = 0;
+ }
+ else {
+ compsize = uorder * vorder * k;
}
#endif
- __GLX_GET_DOUBLE(u1,pc);
- __GLX_GET_DOUBLE(u2,pc+8);
- __GLX_GET_DOUBLE(v1,pc+16);
- __GLX_GET_DOUBLE(v2,pc+24);
+ __GLX_GET_DOUBLE(u1, pc);
+ __GLX_GET_DOUBLE(u2, pc + 8);
+ __GLX_GET_DOUBLE(v1, pc + 16);
+ __GLX_GET_DOUBLE(v2, pc + 24);
pc += 44;
ustride = vorder * k;
vstride = k;
#ifdef __GLX_ALIGN64
- if (((unsigned long)pc) & 7) {
- /*
- ** Copy the doubles up 4 bytes, trashing the command but aligning
- ** the data in the process
- */
- __GLX_MEM_COPY(pc-4, pc, compsize*8);
- points = (GLdouble*) (pc - 4);
- } else {
- points = (GLdouble*) pc;
+ if (((unsigned long) pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc - 4, pc, compsize * 8);
+ points = (GLdouble *) (pc - 4);
+ }
+ else {
+ points = (GLdouble *) pc;
}
#else
- points = (GLdouble*) pc;
+ points = (GLdouble *) pc;
#endif
- CALL_Map2d( GET_DISPATCH(), (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points) );
+ CALL_Map2d(GET_DISPATCH(),
+ (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
+ points));
}
-void __glXDisp_DrawArrays(GLbyte *pc)
+void
+__glXDisp_DrawArrays(GLbyte * pc)
{
- __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc;
+ __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc;
__GLXdispatchDrawArraysComponentHeader *compHeader;
GLint numVertexes = hdr->numVertexes;
GLint numComponents = hdr->numComponents;
@@ -185,73 +199,76 @@ void __glXDisp_DrawArrays(GLbyte *pc)
int i;
pc += sizeof(__GLXdispatchDrawArraysHeader);
- compHeader = (__GLXdispatchDrawArraysComponentHeader *)pc;
+ compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
/* compute stride (same for all component arrays) */
for (i = 0; i < numComponents; i++) {
- GLenum datatype = compHeader[i].datatype;
- GLint numVals = compHeader[i].numVals;
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
- stride += __GLX_PAD(numVals * __glXTypeSize(datatype));
+ stride += __GLX_PAD(numVals * __glXTypeSize(datatype));
}
pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader);
/* set up component arrays */
for (i = 0; i < numComponents; i++) {
- GLenum datatype = compHeader[i].datatype;
- GLint numVals = compHeader[i].numVals;
- GLenum component = compHeader[i].component;
-
- switch (component) {
- case GL_VERTEX_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_VERTEX_ARRAY) );
- CALL_VertexPointer( GET_DISPATCH(), (numVals, datatype, stride, pc) );
- break;
- case GL_NORMAL_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_NORMAL_ARRAY) );
- CALL_NormalPointer( GET_DISPATCH(), (datatype, stride, pc) );
- break;
- case GL_COLOR_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_COLOR_ARRAY) );
- CALL_ColorPointer( GET_DISPATCH(), (numVals, datatype, stride, pc) );
- break;
- case GL_INDEX_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_INDEX_ARRAY) );
- CALL_IndexPointer( GET_DISPATCH(), (datatype, stride, pc) );
- break;
- case GL_TEXTURE_COORD_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY) );
- CALL_TexCoordPointer( GET_DISPATCH(), (numVals, datatype, stride, pc) );
- break;
- case GL_EDGE_FLAG_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY) );
- CALL_EdgeFlagPointer( GET_DISPATCH(), (stride, (const GLboolean *)pc) );
- break;
- case GL_SECONDARY_COLOR_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY) );
- CALL_SecondaryColorPointerEXT( GET_DISPATCH(), (numVals, datatype, stride, pc) );
- break;
- case GL_FOG_COORD_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_FOG_COORD_ARRAY) );
- CALL_FogCoordPointerEXT( GET_DISPATCH(), (datatype, stride, pc) );
- break;
- default:
- break;
- }
-
- pc += __GLX_PAD(numVals * __glXTypeSize(datatype));
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
+ GLenum component = compHeader[i].component;
+
+ switch (component) {
+ case GL_VERTEX_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_VERTEX_ARRAY));
+ CALL_VertexPointer(GET_DISPATCH(), (numVals, datatype, stride, pc));
+ break;
+ case GL_NORMAL_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_NORMAL_ARRAY));
+ CALL_NormalPointer(GET_DISPATCH(), (datatype, stride, pc));
+ break;
+ case GL_COLOR_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_COLOR_ARRAY));
+ CALL_ColorPointer(GET_DISPATCH(), (numVals, datatype, stride, pc));
+ break;
+ case GL_INDEX_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_INDEX_ARRAY));
+ CALL_IndexPointer(GET_DISPATCH(), (datatype, stride, pc));
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY));
+ CALL_TexCoordPointer(GET_DISPATCH(),
+ (numVals, datatype, stride, pc));
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY));
+ CALL_EdgeFlagPointer(GET_DISPATCH(),
+ (stride, (const GLboolean *) pc));
+ break;
+ case GL_SECONDARY_COLOR_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY));
+ CALL_SecondaryColorPointerEXT(GET_DISPATCH(),
+ (numVals, datatype, stride, pc));
+ break;
+ case GL_FOG_COORD_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_FOG_COORD_ARRAY));
+ CALL_FogCoordPointerEXT(GET_DISPATCH(), (datatype, stride, pc));
+ break;
+ default:
+ break;
+ }
+
+ pc += __GLX_PAD(numVals * __glXTypeSize(datatype));
}
- CALL_DrawArrays( GET_DISPATCH(), (primType, 0, numVertexes) );
+ CALL_DrawArrays(GET_DISPATCH(), (primType, 0, numVertexes));
/* turn off anything we might have turned on */
- CALL_DisableClientState( GET_DISPATCH(), (GL_VERTEX_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_NORMAL_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_COLOR_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_INDEX_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_FOG_COORD_ARRAY) );
+ CALL_DisableClientState(GET_DISPATCH(), (GL_VERTEX_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_NORMAL_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_COLOR_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_INDEX_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_FOG_COORD_ARRAY));
}
diff --git a/xorg-server/glx/render2swap.c b/xorg-server/glx/render2swap.c
index 59cb93a6a..dc5981376 100644
--- a/xorg-server/glx/render2swap.c
+++ b/xorg-server/glx/render2swap.c
@@ -45,13 +45,14 @@
#include "glthread.h"
#include "dispatch.h"
-
-void __glXDispSwap_Map1f(GLbyte *pc)
+void
+__glXDispSwap_Map1f(GLbyte * pc)
{
GLint order, k;
GLfloat u1, u2, *points;
GLenum target;
GLint compsize;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -59,31 +60,34 @@ void __glXDispSwap_Map1f(GLbyte *pc)
__GLX_SWAP_INT(pc + 12);
__GLX_SWAP_FLOAT(pc + 4);
__GLX_SWAP_FLOAT(pc + 8);
-
- target = *(GLenum *)(pc + 0);
- order = *(GLint *)(pc + 12);
- u1 = *(GLfloat *)(pc + 4);
- u2 = *(GLfloat *)(pc + 8);
- points = (GLfloat *)(pc + 16);
+
+ target = *(GLenum *) (pc + 0);
+ order = *(GLint *) (pc + 12);
+ u1 = *(GLfloat *) (pc + 4);
+ u2 = *(GLfloat *) (pc + 8);
+ points = (GLfloat *) (pc + 16);
k = __glMap1f_size(target);
if (order <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = order * k;
+ /* Erroneous command. */
+ compsize = 0;
+ }
+ else {
+ compsize = order * k;
}
__GLX_SWAP_FLOAT_ARRAY(points, compsize);
- CALL_Map1f( GET_DISPATCH(), (target, u1, u2, k, order, points) );
+ CALL_Map1f(GET_DISPATCH(), (target, u1, u2, k, order, points));
}
-void __glXDispSwap_Map2f(GLbyte *pc)
+void
+__glXDispSwap_Map2f(GLbyte * pc)
{
GLint uorder, vorder, ustride, vstride, k;
GLfloat u1, u2, v1, v2, *points;
GLenum target;
GLint compsize;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -94,36 +98,41 @@ void __glXDispSwap_Map2f(GLbyte *pc)
__GLX_SWAP_FLOAT(pc + 8);
__GLX_SWAP_FLOAT(pc + 16);
__GLX_SWAP_FLOAT(pc + 20);
-
- target = *(GLenum *)(pc + 0);
- uorder = *(GLint *)(pc + 12);
- vorder = *(GLint *)(pc + 24);
- u1 = *(GLfloat *)(pc + 4);
- u2 = *(GLfloat *)(pc + 8);
- v1 = *(GLfloat *)(pc + 16);
- v2 = *(GLfloat *)(pc + 20);
- points = (GLfloat *)(pc + 28);
+
+ target = *(GLenum *) (pc + 0);
+ uorder = *(GLint *) (pc + 12);
+ vorder = *(GLint *) (pc + 24);
+ u1 = *(GLfloat *) (pc + 4);
+ u2 = *(GLfloat *) (pc + 8);
+ v1 = *(GLfloat *) (pc + 16);
+ v2 = *(GLfloat *) (pc + 20);
+ points = (GLfloat *) (pc + 28);
k = __glMap2f_size(target);
ustride = vorder * k;
vstride = k;
if (vorder <= 0 || uorder <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = uorder * vorder * k;
+ /* Erroneous command. */
+ compsize = 0;
+ }
+ else {
+ compsize = uorder * vorder * k;
}
__GLX_SWAP_FLOAT_ARRAY(points, compsize);
- CALL_Map2f( GET_DISPATCH(), (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points) );
+ CALL_Map2f(GET_DISPATCH(),
+ (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
+ points));
}
-void __glXDispSwap_Map1d(GLbyte *pc)
+void
+__glXDispSwap_Map1d(GLbyte * pc)
{
GLint order, k, compsize;
GLenum target;
GLdouble u1, u2, *points;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -132,42 +141,46 @@ void __glXDispSwap_Map1d(GLbyte *pc)
__GLX_SWAP_INT(pc + 16);
__GLX_SWAP_INT(pc + 20);
- target = *(GLenum*) (pc + 16);
- order = *(GLint*) (pc + 20);
+ target = *(GLenum *) (pc + 16);
+ order = *(GLint *) (pc + 20);
k = __glMap1d_size(target);
if (order <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = order * k;
+ /* Erroneous command. */
+ compsize = 0;
}
- __GLX_GET_DOUBLE(u1,pc);
- __GLX_GET_DOUBLE(u2,pc+8);
- __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize);
+ else {
+ compsize = order * k;
+ }
+ __GLX_GET_DOUBLE(u1, pc);
+ __GLX_GET_DOUBLE(u2, pc + 8);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 24, compsize);
pc += 24;
#ifdef __GLX_ALIGN64
- if (((unsigned long)pc) & 7) {
- /*
- ** Copy the doubles up 4 bytes, trashing the command but aligning
- ** the data in the process
- */
- __GLX_MEM_COPY(pc-4, pc, compsize*8);
- points = (GLdouble*) (pc - 4);
- } else {
- points = (GLdouble*) pc;
+ if (((unsigned long) pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc - 4, pc, compsize * 8);
+ points = (GLdouble *) (pc - 4);
+ }
+ else {
+ points = (GLdouble *) pc;
}
#else
- points = (GLdouble*) pc;
+ points = (GLdouble *) pc;
#endif
- CALL_Map1d( GET_DISPATCH(), (target, u1, u2, k, order, points) );
+ CALL_Map1d(GET_DISPATCH(), (target, u1, u2, k, order, points));
}
-void __glXDispSwap_Map2d(GLbyte *pc)
+void
+__glXDispSwap_Map2d(GLbyte * pc)
{
GLdouble u1, u2, v1, v2, *points;
GLint uorder, vorder, ustride, vstride, k, compsize;
GLenum target;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -179,105 +192,117 @@ void __glXDispSwap_Map2d(GLbyte *pc)
__GLX_SWAP_INT(pc + 36);
__GLX_SWAP_INT(pc + 40);
- target = *(GLenum *)(pc + 32);
- uorder = *(GLint *)(pc + 36);
- vorder = *(GLint *)(pc + 40);
+ target = *(GLenum *) (pc + 32);
+ uorder = *(GLint *) (pc + 36);
+ vorder = *(GLint *) (pc + 40);
k = __glMap2d_size(target);
if (vorder <= 0 || uorder <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = uorder * vorder * k;
+ /* Erroneous command. */
+ compsize = 0;
+ }
+ else {
+ compsize = uorder * vorder * k;
}
- __GLX_GET_DOUBLE(u1,pc);
- __GLX_GET_DOUBLE(u2,pc+8);
- __GLX_GET_DOUBLE(v1,pc+16);
- __GLX_GET_DOUBLE(v2,pc+24);
- __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize);
+ __GLX_GET_DOUBLE(u1, pc);
+ __GLX_GET_DOUBLE(u2, pc + 8);
+ __GLX_GET_DOUBLE(v1, pc + 16);
+ __GLX_GET_DOUBLE(v2, pc + 24);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 44, compsize);
pc += 44;
ustride = vorder * k;
vstride = k;
#ifdef __GLX_ALIGN64
- if (((unsigned long)pc) & 7) {
- /*
- ** Copy the doubles up 4 bytes, trashing the command but aligning
- ** the data in the process
- */
- __GLX_MEM_COPY(pc-4, pc, compsize*8);
- points = (GLdouble*) (pc - 4);
- } else {
- points = (GLdouble*) pc;
+ if (((unsigned long) pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc - 4, pc, compsize * 8);
+ points = (GLdouble *) (pc - 4);
+ }
+ else {
+ points = (GLdouble *) pc;
}
#else
- points = (GLdouble*) pc;
+ points = (GLdouble *) pc;
#endif
- CALL_Map2d( GET_DISPATCH(), (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points) );
+ CALL_Map2d(GET_DISPATCH(),
+ (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
+ points));
}
-static void swapArray(GLint numVals, GLenum datatype,
- GLint stride, GLint numVertexes, GLbyte *pc)
+static void
+swapArray(GLint numVals, GLenum datatype,
+ GLint stride, GLint numVertexes, GLbyte * pc)
{
- int i,j;
+ int i, j;
+
__GLX_DECLARE_SWAP_VARIABLES;
switch (datatype) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- /* don't need to swap */
- return;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- for (i=0; i<numVertexes; i++) {
- GLshort *pVal = (GLshort *) pc;
- for (j=0; j<numVals; j++) {
- __GLX_SWAP_SHORT(&pVal[j]);
- }
- pc += stride;
- }
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- for (i=0; i<numVertexes; i++) {
- GLint *pVal = (GLint *) pc;
- for (j=0; j<numVals; j++) {
- __GLX_SWAP_INT(&pVal[j]);
- }
- pc += stride;
- }
- break;
- case GL_FLOAT:
- for (i=0; i<numVertexes; i++) {
- GLfloat *pVal = (GLfloat *) pc;
- for (j=0; j<numVals; j++) {
- __GLX_SWAP_FLOAT(&pVal[j]);
- }
- pc += stride;
- }
- break;
- case GL_DOUBLE:
- for (i=0; i<numVertexes; i++) {
- GLdouble *pVal = (GLdouble *) pc;
- for (j=0; j<numVals; j++) {
- __GLX_SWAP_DOUBLE(&pVal[j]);
- }
- pc += stride;
- }
- break;
- default:
- return;
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ /* don't need to swap */
+ return;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ for (i = 0; i < numVertexes; i++) {
+ GLshort *pVal = (GLshort *) pc;
+
+ for (j = 0; j < numVals; j++) {
+ __GLX_SWAP_SHORT(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ for (i = 0; i < numVertexes; i++) {
+ GLint *pVal = (GLint *) pc;
+
+ for (j = 0; j < numVals; j++) {
+ __GLX_SWAP_INT(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ case GL_FLOAT:
+ for (i = 0; i < numVertexes; i++) {
+ GLfloat *pVal = (GLfloat *) pc;
+
+ for (j = 0; j < numVals; j++) {
+ __GLX_SWAP_FLOAT(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ case GL_DOUBLE:
+ for (i = 0; i < numVertexes; i++) {
+ GLdouble *pVal = (GLdouble *) pc;
+
+ for (j = 0; j < numVals; j++) {
+ __GLX_SWAP_DOUBLE(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ default:
+ return;
}
}
-void __glXDispSwap_DrawArrays(GLbyte *pc)
+void
+__glXDispSwap_DrawArrays(GLbyte * pc)
{
- __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc;
+ __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc;
__GLXdispatchDrawArraysComponentHeader *compHeader;
GLint numVertexes = hdr->numVertexes;
GLint numComponents = hdr->numComponents;
GLenum primType = hdr->primType;
GLint stride = 0;
int i;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_INT(&numVertexes);
@@ -288,14 +313,14 @@ void __glXDispSwap_DrawArrays(GLbyte *pc)
compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
/* compute stride (same for all component arrays) */
- for (i=0; i<numComponents; i++) {
- GLenum datatype = compHeader[i].datatype;
- GLint numVals = compHeader[i].numVals;
- GLenum component = compHeader[i].component;
+ for (i = 0; i < numComponents; i++) {
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
+ GLenum component = compHeader[i].component;
- __GLX_SWAP_INT(&datatype);
- __GLX_SWAP_INT(&numVals);
- __GLX_SWAP_INT(&component);
+ __GLX_SWAP_INT(&datatype);
+ __GLX_SWAP_INT(&numVals);
+ __GLX_SWAP_INT(&component);
stride += __GLX_PAD(numVals * __glXTypeSize(datatype));
}
@@ -303,66 +328,69 @@ void __glXDispSwap_DrawArrays(GLbyte *pc)
pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader);
/* set up component arrays */
- for (i=0; i<numComponents; i++) {
- GLenum datatype = compHeader[i].datatype;
- GLint numVals = compHeader[i].numVals;
- GLenum component = compHeader[i].component;
+ for (i = 0; i < numComponents; i++) {
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
+ GLenum component = compHeader[i].component;
- __GLX_SWAP_INT(&datatype);
- __GLX_SWAP_INT(&numVals);
- __GLX_SWAP_INT(&component);
+ __GLX_SWAP_INT(&datatype);
+ __GLX_SWAP_INT(&numVals);
+ __GLX_SWAP_INT(&component);
- swapArray(numVals, datatype, stride, numVertexes, pc);
+ swapArray(numVals, datatype, stride, numVertexes, pc);
switch (component) {
- case GL_VERTEX_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_VERTEX_ARRAY) );
- CALL_VertexPointer( GET_DISPATCH(), (numVals, datatype, stride, pc) );
+ case GL_VERTEX_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_VERTEX_ARRAY));
+ CALL_VertexPointer(GET_DISPATCH(), (numVals, datatype, stride, pc));
break;
- case GL_NORMAL_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_NORMAL_ARRAY) );
- CALL_NormalPointer( GET_DISPATCH(), (datatype, stride, pc) );
+ case GL_NORMAL_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_NORMAL_ARRAY));
+ CALL_NormalPointer(GET_DISPATCH(), (datatype, stride, pc));
break;
- case GL_COLOR_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_COLOR_ARRAY) );
- CALL_ColorPointer( GET_DISPATCH(), (numVals, datatype, stride, pc) );
+ case GL_COLOR_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_COLOR_ARRAY));
+ CALL_ColorPointer(GET_DISPATCH(), (numVals, datatype, stride, pc));
break;
- case GL_INDEX_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_INDEX_ARRAY) );
- CALL_IndexPointer( GET_DISPATCH(), (datatype, stride, pc) );
+ case GL_INDEX_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_INDEX_ARRAY));
+ CALL_IndexPointer(GET_DISPATCH(), (datatype, stride, pc));
break;
- case GL_TEXTURE_COORD_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY) );
- CALL_TexCoordPointer( GET_DISPATCH(), (numVals, datatype, stride, pc) );
+ case GL_TEXTURE_COORD_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY));
+ CALL_TexCoordPointer(GET_DISPATCH(),
+ (numVals, datatype, stride, pc));
break;
- case GL_EDGE_FLAG_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY) );
- CALL_EdgeFlagPointer( GET_DISPATCH(), (stride, (const GLboolean *)pc) );
+ case GL_EDGE_FLAG_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY));
+ CALL_EdgeFlagPointer(GET_DISPATCH(),
+ (stride, (const GLboolean *) pc));
break;
- case GL_SECONDARY_COLOR_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY) );
- CALL_SecondaryColorPointerEXT( GET_DISPATCH(), (numVals, datatype, stride, pc) );
+ case GL_SECONDARY_COLOR_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY));
+ CALL_SecondaryColorPointerEXT(GET_DISPATCH(),
+ (numVals, datatype, stride, pc));
break;
- case GL_FOG_COORD_ARRAY:
- CALL_EnableClientState( GET_DISPATCH(), (GL_FOG_COORD_ARRAY) );
- CALL_FogCoordPointerEXT( GET_DISPATCH(), (datatype, stride, pc) );
+ case GL_FOG_COORD_ARRAY:
+ CALL_EnableClientState(GET_DISPATCH(), (GL_FOG_COORD_ARRAY));
+ CALL_FogCoordPointerEXT(GET_DISPATCH(), (datatype, stride, pc));
break;
- default:
+ default:
break;
- }
+ }
pc += __GLX_PAD(numVals * __glXTypeSize(datatype));
}
- CALL_DrawArrays( GET_DISPATCH(), (primType, 0, numVertexes) );
+ CALL_DrawArrays(GET_DISPATCH(), (primType, 0, numVertexes));
/* turn off anything we might have turned on */
- CALL_DisableClientState( GET_DISPATCH(), (GL_VERTEX_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_NORMAL_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_COLOR_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_INDEX_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY) );
- CALL_DisableClientState( GET_DISPATCH(), (GL_FOG_COORD_ARRAY) );
+ CALL_DisableClientState(GET_DISPATCH(), (GL_VERTEX_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_NORMAL_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_COLOR_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_INDEX_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY));
+ CALL_DisableClientState(GET_DISPATCH(), (GL_FOG_COORD_ARRAY));
}
diff --git a/xorg-server/glx/renderpix.c b/xorg-server/glx/renderpix.c
index 3e5612036..10864326e 100644
--- a/xorg-server/glx/renderpix.c
+++ b/xorg-server/glx/renderpix.c
@@ -44,30 +44,34 @@
#include "glthread.h"
#include "dispatch.h"
-void __glXDisp_SeparableFilter2D(GLbyte *pc)
+void
+__glXDisp_SeparableFilter2D(GLbyte * pc)
{
- __GLXdispatchConvolutionFilterHeader *hdr =
- (__GLXdispatchConvolutionFilterHeader *) pc;
+ __GLXdispatchConvolutionFilterHeader *hdr =
+ (__GLXdispatchConvolutionFilterHeader *) pc;
GLint hdrlen, image1len;
hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE);
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, hdr->alignment) );
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, hdr->rowLength));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, hdr->skipRows));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, hdr->skipPixels));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, hdr->alignment));
/* XXX check this usage - internal code called
- ** a version without the packing parameters
- */
+ ** a version without the packing parameters
+ */
image1len = __glXImageSize(hdr->format, hdr->type, 0, hdr->width, 1, 1,
- 0, hdr->rowLength, 0, hdr->skipRows,
- hdr->alignment);
+ 0, hdr->rowLength, 0, hdr->skipRows,
+ hdr->alignment);
image1len = __GLX_PAD(image1len);
- CALL_SeparableFilter2D( GET_DISPATCH(), (hdr->target, hdr->internalformat,
- hdr->width, hdr->height, hdr->format, hdr->type,
- ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)) );
+ CALL_SeparableFilter2D(GET_DISPATCH(), (hdr->target, hdr->internalformat,
+ hdr->width, hdr->height,
+ hdr->format, hdr->type,
+ ((GLubyte *) hdr + hdrlen),
+ ((GLubyte *) hdr + hdrlen +
+ image1len)));
}
diff --git a/xorg-server/glx/renderpixswap.c b/xorg-server/glx/renderpixswap.c
index a73ed1e3c..637385a65 100644
--- a/xorg-server/glx/renderpixswap.c
+++ b/xorg-server/glx/renderpixswap.c
@@ -44,48 +44,52 @@
#include "glthread.h"
#include "dispatch.h"
-void __glXDispSwap_SeparableFilter2D(GLbyte *pc)
+void
+__glXDispSwap_SeparableFilter2D(GLbyte * pc)
{
__GLXdispatchConvolutionFilterHeader *hdr =
- (__GLXdispatchConvolutionFilterHeader *) pc;
+ (__GLXdispatchConvolutionFilterHeader *) pc;
GLint hdrlen, image1len;
+
__GLX_DECLARE_SWAP_VARIABLES;
hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
/*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, !hdr->swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, hdr->rowLength) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, hdr->skipRows) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, hdr->skipPixels) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, hdr->alignment) );
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, !hdr->swapBytes));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, hdr->rowLength));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, hdr->skipRows));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, hdr->skipPixels));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, hdr->alignment));
/* XXX check this usage - internal code called
- ** a version without the packing parameters
- */
+ ** a version without the packing parameters
+ */
image1len = __glXImageSize(hdr->format, hdr->type, 0, hdr->width, 1, 1,
- 0, hdr->rowLength, 0, hdr->skipRows,
- hdr->alignment);
+ 0, hdr->rowLength, 0, hdr->skipRows,
+ hdr->alignment);
image1len = __GLX_PAD(image1len);
-
- CALL_SeparableFilter2D( GET_DISPATCH(), (hdr->target, hdr->internalformat,
- hdr->width, hdr->height, hdr->format, hdr->type,
- ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)) );
+ CALL_SeparableFilter2D(GET_DISPATCH(), (hdr->target, hdr->internalformat,
+ hdr->width, hdr->height,
+ hdr->format, hdr->type,
+ ((GLubyte *) hdr + hdrlen),
+ ((GLubyte *) hdr + hdrlen +
+ image1len)));
}
diff --git a/xorg-server/glx/rensize.c b/xorg-server/glx/rensize.c
index 8ee9dd9dc..38a7bf0ec 100644
--- a/xorg-server/glx/rensize.c
+++ b/xorg-server/glx/rensize.c
@@ -47,80 +47,88 @@
(((a & 0xff000000U)>>24) | ((a & 0xff0000U)>>8) | \
((a & 0xff00U)<<8) | ((a & 0xffU)<<24))
-static int Map1Size( GLint k, GLint order)
+static int
+Map1Size(GLint k, GLint order)
{
- if (order <= 0 || k < 0) return -1;
+ if (order <= 0 || k < 0)
+ return -1;
return k * order;
}
-int __glXMap1dReqSize( const GLbyte *pc, Bool swap )
+int
+__glXMap1dReqSize(const GLbyte * pc, Bool swap)
{
GLenum target;
GLint order, k;
- target = *(GLenum*) (pc + 16);
- order = *(GLint*) (pc + 20);
+ target = *(GLenum *) (pc + 16);
+ order = *(GLint *) (pc + 20);
if (swap) {
- target = SWAPL( target );
- order = SWAPL( order );
+ target = SWAPL(target);
+ order = SWAPL(order);
}
- k = __glMap1d_size( target );
- return 8 * Map1Size( k, order );
+ k = __glMap1d_size(target);
+ return 8 * Map1Size(k, order);
}
-int __glXMap1fReqSize( const GLbyte *pc, Bool swap )
+int
+__glXMap1fReqSize(const GLbyte * pc, Bool swap)
{
GLenum target;
GLint order, k;
- target = *(GLenum *)(pc + 0);
- order = *(GLint *)(pc + 12);
+ target = *(GLenum *) (pc + 0);
+ order = *(GLint *) (pc + 12);
if (swap) {
- target = SWAPL( target );
- order = SWAPL( order );
+ target = SWAPL(target);
+ order = SWAPL(order);
}
k = __glMap1f_size(target);
return 4 * Map1Size(k, order);
}
-static int Map2Size(int k, int majorOrder, int minorOrder)
+static int
+Map2Size(int k, int majorOrder, int minorOrder)
{
- if (majorOrder <= 0 || minorOrder <= 0 || k < 0) return -1;
+ if (majorOrder <= 0 || minorOrder <= 0 || k < 0)
+ return -1;
return k * majorOrder * minorOrder;
}
-int __glXMap2dReqSize( const GLbyte *pc, Bool swap )
+int
+__glXMap2dReqSize(const GLbyte * pc, Bool swap)
{
GLenum target;
GLint uorder, vorder, k;
- target = *(GLenum *)(pc + 32);
- uorder = *(GLint *)(pc + 36);
- vorder = *(GLint *)(pc + 40);
+ target = *(GLenum *) (pc + 32);
+ uorder = *(GLint *) (pc + 36);
+ vorder = *(GLint *) (pc + 40);
if (swap) {
- target = SWAPL( target );
- uorder = SWAPL( uorder );
- vorder = SWAPL( vorder );
+ target = SWAPL(target);
+ uorder = SWAPL(uorder);
+ vorder = SWAPL(vorder);
}
- k = __glMap2d_size( target );
- return 8 * Map2Size( k, uorder, vorder );
+ k = __glMap2d_size(target);
+ return 8 * Map2Size(k, uorder, vorder);
}
-int __glXMap2fReqSize( const GLbyte *pc, Bool swap )
+int
+__glXMap2fReqSize(const GLbyte * pc, Bool swap)
{
GLenum target;
GLint uorder, vorder, k;
- target = *(GLenum *)(pc + 0);
- uorder = *(GLint *)(pc + 12);
- vorder = *(GLint *)(pc + 24);
+ target = *(GLenum *) (pc + 0);
+ uorder = *(GLint *) (pc + 12);
+ vorder = *(GLint *) (pc + 24);
if (swap) {
- target = SWAPL( target );
- uorder = SWAPL( uorder );
- vorder = SWAPL( vorder );
+ target = SWAPL(target);
+ uorder = SWAPL(uorder);
+ vorder = SWAPL(vorder);
}
- k = __glMap2f_size( target );
- return 4 * Map2Size( k, uorder, vorder );
+ k = __glMap2f_size(target);
+ return 4 * Map2Size(k, uorder, vorder);
}
/**
@@ -162,22 +170,24 @@ int __glXMap2fReqSize( const GLbyte *pc, Bool swap )
* are invalid, -1 is returned. If \c target is one of \c GL_PROXY_*, zero
* is returned.
*/
-int __glXImageSize( GLenum format, GLenum type, GLenum target,
- GLsizei w, GLsizei h, GLsizei d,
- GLint imageHeight, GLint rowLength,
- GLint skipImages, GLint skipRows, GLint alignment )
+int
+__glXImageSize(GLenum format, GLenum type, GLenum target,
+ GLsizei w, GLsizei h, GLsizei d,
+ GLint imageHeight, GLint rowLength,
+ GLint skipImages, GLint skipRows, GLint alignment)
{
GLint bytesPerElement, elementsPerGroup, groupsPerRow;
GLint groupSize, rowSize, padding, imageSize;
if (w < 0 || h < 0 || d < 0 ||
- (type == GL_BITMAP &&
- (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) {
- return -1;
+ (type == GL_BITMAP &&
+ (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) {
+ return -1;
}
- if (w==0 || h==0 || d == 0) return 0;
+ if (w == 0 || h == 0 || d == 0)
+ return 0;
- switch( target ) {
+ switch (target) {
case GL_PROXY_TEXTURE_1D:
case GL_PROXY_TEXTURE_2D:
case GL_PROXY_TEXTURE_3D:
@@ -190,141 +200,155 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target,
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP:
- return 0;
+ return 0;
}
if (type == GL_BITMAP) {
- if (rowLength > 0) {
- groupsPerRow = rowLength;
- } else {
- groupsPerRow = w;
- }
- rowSize = bits_to_bytes(groupsPerRow);
- padding = (rowSize % alignment);
- if (padding) {
- rowSize += alignment - padding;
- }
- return ((h + skipRows) * rowSize);
- } else {
- switch(format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_INTENSITY:
- elementsPerGroup = 1;
- break;
- case GL_RG:
- case GL_422_EXT:
- case GL_422_REV_EXT:
- case GL_422_AVERAGE_EXT:
- case GL_422_REV_AVERAGE_EXT:
- case GL_DEPTH_STENCIL_NV:
- case GL_DEPTH_STENCIL_MESA:
- case GL_YCBCR_422_APPLE:
- case GL_YCBCR_MESA:
- case GL_LUMINANCE_ALPHA:
- elementsPerGroup = 2;
- break;
- case GL_RGB:
- case GL_BGR:
- elementsPerGroup = 3;
- break;
- case GL_RGBA:
- case GL_BGRA:
- case GL_ABGR_EXT:
- elementsPerGroup = 4;
- break;
- default:
- return -1;
- }
- switch(type) {
- case GL_UNSIGNED_BYTE:
- case GL_BYTE:
- bytesPerElement = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- bytesPerElement = 1;
- elementsPerGroup = 1;
- break;
- case GL_UNSIGNED_SHORT:
- case GL_SHORT:
- bytesPerElement = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- case GL_UNSIGNED_SHORT_8_8_APPLE:
- case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
- case GL_UNSIGNED_SHORT_15_1_MESA:
- case GL_UNSIGNED_SHORT_1_15_REV_MESA:
- bytesPerElement = 2;
- elementsPerGroup = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- bytesPerElement = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_24_8_NV:
- case GL_UNSIGNED_INT_24_8_MESA:
- case GL_UNSIGNED_INT_8_24_REV_MESA:
- bytesPerElement = 4;
- elementsPerGroup = 1;
- break;
- default:
- return -1;
- }
- groupSize = bytesPerElement * elementsPerGroup;
- if (rowLength > 0) {
- groupsPerRow = rowLength;
- } else {
- groupsPerRow = w;
- }
- rowSize = groupsPerRow * groupSize;
- padding = (rowSize % alignment);
- if (padding) {
- rowSize += alignment - padding;
- }
- if (imageHeight > 0) {
- imageSize = (imageHeight + skipRows) * rowSize;
- } else {
- imageSize = (h + skipRows) * rowSize;
- }
- return ((d + skipImages) * imageSize);
+ if (rowLength > 0) {
+ groupsPerRow = rowLength;
+ }
+ else {
+ groupsPerRow = w;
+ }
+ rowSize = bits_to_bytes(groupsPerRow);
+ padding = (rowSize % alignment);
+ if (padding) {
+ rowSize += alignment - padding;
+ }
+ return ((h + skipRows) * rowSize);
+ }
+ else {
+ switch (format) {
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_INTENSITY:
+ elementsPerGroup = 1;
+ break;
+ case GL_RG:
+ case GL_422_EXT:
+ case GL_422_REV_EXT:
+ case GL_422_AVERAGE_EXT:
+ case GL_422_REV_AVERAGE_EXT:
+ case GL_DEPTH_STENCIL_NV:
+ case GL_DEPTH_STENCIL_MESA:
+ case GL_YCBCR_422_APPLE:
+ case GL_YCBCR_MESA:
+ case GL_LUMINANCE_ALPHA:
+ elementsPerGroup = 2;
+ break;
+ case GL_RGB:
+ case GL_BGR:
+ elementsPerGroup = 3;
+ break;
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ elementsPerGroup = 4;
+ break;
+ default:
+ return -1;
+ }
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ case GL_BYTE:
+ bytesPerElement = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ bytesPerElement = 1;
+ elementsPerGroup = 1;
+ break;
+ case GL_UNSIGNED_SHORT:
+ case GL_SHORT:
+ bytesPerElement = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL_UNSIGNED_SHORT_8_8_APPLE:
+ case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+ case GL_UNSIGNED_SHORT_15_1_MESA:
+ case GL_UNSIGNED_SHORT_1_15_REV_MESA:
+ bytesPerElement = 2;
+ elementsPerGroup = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ bytesPerElement = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_24_8_NV:
+ case GL_UNSIGNED_INT_24_8_MESA:
+ case GL_UNSIGNED_INT_8_24_REV_MESA:
+ bytesPerElement = 4;
+ elementsPerGroup = 1;
+ break;
+ default:
+ return -1;
+ }
+ groupSize = bytesPerElement * elementsPerGroup;
+ if (rowLength > 0) {
+ groupsPerRow = rowLength;
+ }
+ else {
+ groupsPerRow = w;
+ }
+ rowSize = groupsPerRow * groupSize;
+ padding = (rowSize % alignment);
+ if (padding) {
+ rowSize += alignment - padding;
+ }
+ if (imageHeight > 0) {
+ imageSize = (imageHeight + skipRows) * rowSize;
+ }
+ else {
+ imageSize = (h + skipRows) * rowSize;
+ }
+ return ((d + skipImages) * imageSize);
}
}
-
/* XXX this is used elsewhere - should it be exported from glxserver.h? */
-int __glXTypeSize(GLenum enm)
+int
+__glXTypeSize(GLenum enm)
{
- switch(enm) {
- case GL_BYTE: return sizeof(GLbyte);
- case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
- case GL_SHORT: return sizeof(GLshort);
- case GL_UNSIGNED_SHORT: return sizeof(GLushort);
- case GL_INT: return sizeof(GLint);
- case GL_UNSIGNED_INT: return sizeof(GLint);
- case GL_FLOAT: return sizeof(GLfloat);
- case GL_DOUBLE: return sizeof(GLdouble);
- default: return -1;
- }
+ switch (enm) {
+ case GL_BYTE:
+ return sizeof(GLbyte);
+ case GL_UNSIGNED_BYTE:
+ return sizeof(GLubyte);
+ case GL_SHORT:
+ return sizeof(GLshort);
+ case GL_UNSIGNED_SHORT:
+ return sizeof(GLushort);
+ case GL_INT:
+ return sizeof(GLint);
+ case GL_UNSIGNED_INT:
+ return sizeof(GLint);
+ case GL_FLOAT:
+ return sizeof(GLfloat);
+ case GL_DOUBLE:
+ return sizeof(GLdouble);
+ default:
+ return -1;
+ }
}
-int __glXDrawArraysReqSize( const GLbyte *pc, Bool swap )
+int
+__glXDrawArraysReqSize(const GLbyte * pc, Bool swap)
{
__GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc;
__GLXdispatchDrawArraysComponentHeader *compHeader;
@@ -334,67 +358,68 @@ int __glXDrawArraysReqSize( const GLbyte *pc, Bool swap )
int i;
if (swap) {
- numVertexes = SWAPL( numVertexes );
- numComponents = SWAPL( numComponents );
+ numVertexes = SWAPL(numVertexes);
+ numComponents = SWAPL(numComponents);
}
pc += sizeof(__GLXdispatchDrawArraysHeader);
compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
- for (i=0; i<numComponents; i++) {
- GLenum datatype = compHeader[i].datatype;
- GLint numVals = compHeader[i].numVals;
- GLint component = compHeader[i].component;
-
- if (swap) {
- datatype = SWAPL( datatype );
- numVals = SWAPL( numVals );
- component = SWAPL( component );
- }
-
- switch (component) {
- case GL_VERTEX_ARRAY:
- case GL_COLOR_ARRAY:
- case GL_TEXTURE_COORD_ARRAY:
- break;
- case GL_SECONDARY_COLOR_ARRAY:
- case GL_NORMAL_ARRAY:
- if (numVals != 3) {
- /* bad size */
- return -1;
- }
- break;
- case GL_FOG_COORD_ARRAY:
- case GL_INDEX_ARRAY:
- if (numVals != 1) {
- /* bad size */
- return -1;
- }
- break;
- case GL_EDGE_FLAG_ARRAY:
- if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) {
- /* bad size or bad type */
- return -1;
- }
- break;
- default:
- /* unknown component type */
- return -1;
- }
-
- arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype));
-
- pc += sizeof(__GLXdispatchDrawArraysComponentHeader);
+ for (i = 0; i < numComponents; i++) {
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
+ GLint component = compHeader[i].component;
+
+ if (swap) {
+ datatype = SWAPL(datatype);
+ numVals = SWAPL(numVals);
+ component = SWAPL(component);
+ }
+
+ switch (component) {
+ case GL_VERTEX_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ break;
+ case GL_SECONDARY_COLOR_ARRAY:
+ case GL_NORMAL_ARRAY:
+ if (numVals != 3) {
+ /* bad size */
+ return -1;
+ }
+ break;
+ case GL_FOG_COORD_ARRAY:
+ case GL_INDEX_ARRAY:
+ if (numVals != 1) {
+ /* bad size */
+ return -1;
+ }
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) {
+ /* bad size or bad type */
+ return -1;
+ }
+ break;
+ default:
+ /* unknown component type */
+ return -1;
+ }
+
+ arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype));
+
+ pc += sizeof(__GLXdispatchDrawArraysComponentHeader);
}
return ((numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader)) +
- (numVertexes * arrayElementSize));
+ (numVertexes * arrayElementSize));
}
-int __glXSeparableFilter2DReqSize( const GLbyte *pc, Bool swap )
+int
+__glXSeparableFilter2DReqSize(const GLbyte * pc, Bool swap)
{
__GLXdispatchConvolutionFilterHeader *hdr =
- (__GLXdispatchConvolutionFilterHeader *) pc;
+ (__GLXdispatchConvolutionFilterHeader *) pc;
GLint image1size, image2size;
GLenum format = hdr->format;
@@ -405,20 +430,20 @@ int __glXSeparableFilter2DReqSize( const GLbyte *pc, Bool swap )
GLint alignment = hdr->alignment;
if (swap) {
- format = SWAPL( format );
- type = SWAPL( type );
- w = SWAPL( w );
- h = SWAPL( h );
- rowLength = SWAPL( rowLength );
- alignment = SWAPL( alignment );
+ format = SWAPL(format);
+ type = SWAPL(type);
+ w = SWAPL(w);
+ h = SWAPL(h);
+ rowLength = SWAPL(rowLength);
+ alignment = SWAPL(alignment);
}
/* XXX Should rowLength be used for either or both image? */
- image1size = __glXImageSize( format, type, 0, w, 1, 1,
- 0, rowLength, 0, 0, alignment );
+ image1size = __glXImageSize(format, type, 0, w, 1, 1,
+ 0, rowLength, 0, 0, alignment);
image1size = __GLX_PAD(image1size);
- image2size = __glXImageSize( format, type, 0, h, 1, 1,
- 0, rowLength, 0, 0, alignment );
+ image2size = __glXImageSize(format, type, 0, h, 1, 1,
+ 0, rowLength, 0, 0, alignment);
return image1size + image2size;
}
diff --git a/xorg-server/glx/single2.c b/xorg-server/glx/single2.c
index 37d964501..df3151323 100644
--- a/xorg-server/glx/single2.c
+++ b/xorg-server/glx/single2.c
@@ -50,7 +50,8 @@
#include "glthread.h"
#include "dispatch.h"
-int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc)
{
GLsizei size;
GLenum type;
@@ -59,28 +60,29 @@ int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
if (!cx) {
- return error;
+ return error;
}
pc += __GLX_SINGLE_HDR_SIZE;
- size = *(GLsizei *)(pc+0);
- type = *(GLenum *)(pc+4);
+ size = *(GLsizei *) (pc + 0);
+ type = *(GLenum *) (pc + 4);
if (cx->feedbackBufSize < size) {
- cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
- (size_t)size
- * __GLX_SIZE_FLOAT32);
- if (!cx->feedbackBuf) {
- cl->client->errorValue = size;
- return BadAlloc;
- }
- cx->feedbackBufSize = size;
+ cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
+ (size_t) size
+ * __GLX_SIZE_FLOAT32);
+ if (!cx->feedbackBuf) {
+ cl->client->errorValue = size;
+ return BadAlloc;
+ }
+ cx->feedbackBufSize = size;
}
- CALL_FeedbackBuffer( GET_DISPATCH(), (size, type, cx->feedbackBuf) );
+ CALL_FeedbackBuffer(GET_DISPATCH(), (size, type, cx->feedbackBuf));
cx->hasUnflushedCommands = GL_TRUE;
return Success;
}
-int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_SelectBuffer(__GLXclientState * cl, GLbyte * pc)
{
__GLXcontext *cx;
GLsizei size;
@@ -88,110 +90,112 @@ int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
if (!cx) {
- return error;
+ return error;
}
pc += __GLX_SINGLE_HDR_SIZE;
- size = *(GLsizei *)(pc+0);
+ size = *(GLsizei *) (pc + 0);
if (cx->selectBufSize < size) {
- cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
- (size_t) size
- * __GLX_SIZE_CARD32);
- if (!cx->selectBuf) {
- cl->client->errorValue = size;
- return BadAlloc;
- }
- cx->selectBufSize = size;
+ cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
+ (size_t) size * __GLX_SIZE_CARD32);
+ if (!cx->selectBuf) {
+ cl->client->errorValue = size;
+ return BadAlloc;
+ }
+ cx->selectBufSize = size;
}
- CALL_SelectBuffer( GET_DISPATCH(), (size, cx->selectBuf) );
+ CALL_SelectBuffer(GET_DISPATCH(), (size, cx->selectBuf));
cx->hasUnflushedCommands = GL_TRUE;
return Success;
}
-int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client;
xGLXRenderModeReply reply;
__GLXcontext *cx;
- GLint nitems=0, retBytes=0, retval, newModeCheck;
+ GLint nitems = 0, retBytes = 0, retval, newModeCheck;
GLubyte *retBuffer = NULL;
GLenum newMode;
int error;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
if (!cx) {
- return error;
+ return error;
}
pc += __GLX_SINGLE_HDR_SIZE;
- newMode = *(GLenum*) pc;
- retval = CALL_RenderMode( GET_DISPATCH(), (newMode) );
+ newMode = *(GLenum *) pc;
+ retval = CALL_RenderMode(GET_DISPATCH(), (newMode));
/* Check that render mode worked */
- CALL_GetIntegerv( GET_DISPATCH(), (GL_RENDER_MODE, &newModeCheck) );
+ CALL_GetIntegerv(GET_DISPATCH(), (GL_RENDER_MODE, &newModeCheck));
if (newModeCheck != newMode) {
- /* Render mode change failed. Bail */
- newMode = newModeCheck;
- goto noChangeAllowed;
+ /* Render mode change failed. Bail */
+ newMode = newModeCheck;
+ goto noChangeAllowed;
}
/*
- ** Render mode might have still failed if we get here. But in this
- ** case we can't really tell, nor does it matter. If it did fail, it
- ** will return 0, and thus we won't send any data across the wire.
- */
+ ** Render mode might have still failed if we get here. But in this
+ ** case we can't really tell, nor does it matter. If it did fail, it
+ ** will return 0, and thus we won't send any data across the wire.
+ */
switch (cx->renderMode) {
- case GL_RENDER:
- cx->renderMode = newMode;
- break;
- case GL_FEEDBACK:
- if (retval < 0) {
- /* Overflow happened. Copy the entire buffer */
- nitems = cx->feedbackBufSize;
- } else {
- nitems = retval;
- }
- retBytes = nitems * __GLX_SIZE_FLOAT32;
- retBuffer = (GLubyte*) cx->feedbackBuf;
- cx->renderMode = newMode;
- break;
- case GL_SELECT:
- if (retval < 0) {
- /* Overflow happened. Copy the entire buffer */
- nitems = cx->selectBufSize;
- } else {
- GLuint *bp = cx->selectBuf;
- GLint i;
-
- /*
- ** Figure out how many bytes of data need to be sent. Parse
- ** the selection buffer to determine this fact as the
- ** return value is the number of hits, not the number of
- ** items in the buffer.
- */
- nitems = 0;
- i = retval;
- while (--i >= 0) {
- GLuint n;
-
- /* Parse select data for this hit */
- n = *bp;
- bp += 3 + n;
- }
- nitems = bp - cx->selectBuf;
- }
- retBytes = nitems * __GLX_SIZE_CARD32;
- retBuffer = (GLubyte*) cx->selectBuf;
- cx->renderMode = newMode;
- break;
+ case GL_RENDER:
+ cx->renderMode = newMode;
+ break;
+ case GL_FEEDBACK:
+ if (retval < 0) {
+ /* Overflow happened. Copy the entire buffer */
+ nitems = cx->feedbackBufSize;
+ }
+ else {
+ nitems = retval;
+ }
+ retBytes = nitems * __GLX_SIZE_FLOAT32;
+ retBuffer = (GLubyte *) cx->feedbackBuf;
+ cx->renderMode = newMode;
+ break;
+ case GL_SELECT:
+ if (retval < 0) {
+ /* Overflow happened. Copy the entire buffer */
+ nitems = cx->selectBufSize;
+ }
+ else {
+ GLuint *bp = cx->selectBuf;
+ GLint i;
+
+ /*
+ ** Figure out how many bytes of data need to be sent. Parse
+ ** the selection buffer to determine this fact as the
+ ** return value is the number of hits, not the number of
+ ** items in the buffer.
+ */
+ nitems = 0;
+ i = retval;
+ while (--i >= 0) {
+ GLuint n;
+
+ /* Parse select data for this hit */
+ n = *bp;
+ bp += 3 + n;
+ }
+ nitems = bp - cx->selectBuf;
+ }
+ retBytes = nitems * __GLX_SIZE_CARD32;
+ retBuffer = (GLubyte *) cx->selectBuf;
+ cx->renderMode = newMode;
+ break;
}
/*
- ** First reply is the number of elements returned in the feedback or
- ** selection array, as per the API for glRenderMode itself.
- */
- noChangeAllowed:;
+ ** First reply is the number of elements returned in the feedback or
+ ** selection array, as per the API for glRenderMode itself.
+ */
+ noChangeAllowed:;
client = cl->client;
reply.length = nitems;
reply.type = X_Reply;
@@ -199,29 +203,31 @@ int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc)
reply.retval = retval;
reply.size = nitems;
reply.newMode = newMode;
- WriteToClient(client, sz_xGLXRenderModeReply, (char *)&reply);
+ WriteToClient(client, sz_xGLXRenderModeReply, (char *) &reply);
if (retBytes) {
- WriteToClient(client, retBytes, (char *)retBuffer);
+ WriteToClient(client, retBytes, (char *) retBuffer);
}
return Success;
}
-int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_Flush(__GLXclientState * cl, GLbyte * pc)
{
- __GLXcontext *cx;
- int error;
+ __GLXcontext *cx;
+ int error;
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
- CALL_Flush( GET_DISPATCH(), () );
- cx->hasUnflushedCommands = GL_FALSE;
- return Success;
+ CALL_Flush(GET_DISPATCH(), ());
+ cx->hasUnflushedCommands = GL_FALSE;
+ return Success;
}
-int __glXDisp_Finish(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_Finish(__GLXclientState * cl, GLbyte * pc)
{
__GLXcontext *cx;
ClientPtr client;
@@ -229,11 +235,11 @@ int __glXDisp_Finish(__GLXclientState *cl, GLbyte *pc)
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
if (!cx) {
- return error;
+ return error;
}
/* Do a local glFinish */
- CALL_Finish( GET_DISPATCH(), () );
+ CALL_Finish(GET_DISPATCH(), ());
cx->hasUnflushedCommands = GL_FALSE;
/* Send empty reply packet to indicate finish is finished */
@@ -245,75 +251,83 @@ int __glXDisp_Finish(__GLXclientState *cl, GLbyte *pc)
#define SEPARATOR " "
-char *__glXcombine_strings(const char *cext_string, const char *sext_string)
+char *
+__glXcombine_strings(const char *cext_string, const char *sext_string)
{
- size_t clen, slen;
- char *combo_string, *token, *s1;
- const char *s2, *end;
-
- /* safeguard to prevent potentially fatal errors in the string functions */
- if (!cext_string)
- cext_string = "";
- if (!sext_string)
- sext_string = "";
-
- /*
- ** String can't be longer than min(cstring, sstring)
- ** pull tokens out of shortest string
- ** include space in combo_string for final separator and null terminator
- */
- clen = strlen(cext_string);
- slen = strlen(sext_string);
- if (clen > slen) {
- combo_string = (char *) malloc(slen + 2);
- s1 = (char *) malloc(slen + 2);
- if (s1) strcpy(s1, sext_string);
- s2 = cext_string;
- } else {
- combo_string = (char *) malloc(clen + 2);
- s1 = (char *) malloc(clen + 2);
- if (s1) strcpy(s1, cext_string);
- s2 = sext_string;
- }
- if (!combo_string || !s1) {
- free(combo_string);
- free(s1);
- return NULL;
- }
- combo_string[0] = '\0';
-
- /* Get first extension token */
- token = strtok( s1, SEPARATOR);
- while ( token != NULL ) {
-
- /*
- ** if token in second string then save it
- ** beware of extension names which are prefixes of other extension names
- */
- const char *p = s2;
- end = p + strlen(p);
- while (p < end) {
- size_t n = strcspn(p, SEPARATOR);
- if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) {
- combo_string = strcat(combo_string, token);
- combo_string = strcat(combo_string, SEPARATOR);
- }
- p += (n + 1);
- }
-
- /* Get next extension token */
- token = strtok( NULL, SEPARATOR);
- }
- free(s1);
- return combo_string;
+ size_t clen, slen;
+ char *combo_string, *token, *s1;
+ const char *s2, *end;
+
+ /* safeguard to prevent potentially fatal errors in the string functions */
+ if (!cext_string)
+ cext_string = "";
+ if (!sext_string)
+ sext_string = "";
+
+ /*
+ ** String can't be longer than min(cstring, sstring)
+ ** pull tokens out of shortest string
+ ** include space in combo_string for final separator and null terminator
+ */
+ clen = strlen(cext_string);
+ slen = strlen(sext_string);
+ if (clen > slen) {
+ combo_string = (char *) malloc(slen + 2);
+ s1 = (char *) malloc(slen + 2);
+ if (s1)
+ strcpy(s1, sext_string);
+ s2 = cext_string;
+ }
+ else {
+ combo_string = (char *) malloc(clen + 2);
+ s1 = (char *) malloc(clen + 2);
+ if (s1)
+ strcpy(s1, cext_string);
+ s2 = sext_string;
+ }
+ if (!combo_string || !s1) {
+ free(combo_string);
+ free(s1);
+ return NULL;
+ }
+ combo_string[0] = '\0';
+
+ /* Get first extension token */
+ token = strtok(s1, SEPARATOR);
+ while (token != NULL) {
+
+ /*
+ ** if token in second string then save it
+ ** beware of extension names which are prefixes of other extension names
+ */
+ const char *p = s2;
+
+ end = p + strlen(p);
+ while (p < end) {
+ size_t n = strcspn(p, SEPARATOR);
+
+ if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) {
+ combo_string = strcat(combo_string, token);
+ combo_string = strcat(combo_string, SEPARATOR);
+ }
+ p += (n + 1);
+ }
+
+ /* Get next extension token */
+ token = strtok(NULL, SEPARATOR);
+ }
+ free(s1);
+ return combo_string;
}
-int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
+int
+DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap)
{
ClientPtr client;
__GLXcontext *cx;
GLenum name;
const char *string;
+
__GLX_DECLARE_SWAP_VARIABLES;
int error;
char *buf = NULL, *buf1 = NULL;
@@ -322,67 +336,66 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
/* If the client has the opposite byte order, swap the contextTag and
* the name.
*/
- if ( need_swap ) {
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + __GLX_SINGLE_HDR_SIZE);
+ if (need_swap) {
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + __GLX_SINGLE_HDR_SIZE);
}
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
if (!cx) {
- return error;
+ return error;
}
pc += __GLX_SINGLE_HDR_SIZE;
- name = *(GLenum *)(pc + 0);
- string = (const char *) CALL_GetString( GET_DISPATCH(), (name) );
+ name = *(GLenum *) (pc + 0);
+ string = (const char *) CALL_GetString(GET_DISPATCH(), (name));
client = cl->client;
if (string == NULL)
- string = "";
+ string = "";
/*
- ** Restrict extensions to those that are supported by both the
- ** implementation and the connection. That is, return the
- ** intersection of client, server, and core extension strings.
- */
+ ** Restrict extensions to those that are supported by both the
+ ** implementation and the connection. That is, return the
+ ** intersection of client, server, and core extension strings.
+ */
if (name == GL_EXTENSIONS) {
- buf1 = __glXcombine_strings(string,
- cl->GLClientextensions);
- buf = __glXcombine_strings(buf1,
- cx->pGlxScreen->GLextensions);
- free(buf1);
- string = buf;
+ buf1 = __glXcombine_strings(string, cl->GLClientextensions);
+ buf = __glXcombine_strings(buf1, cx->pGlxScreen->GLextensions);
+ free(buf1);
+ string = buf;
}
- else if ( name == GL_VERSION ) {
- if ( atof( string ) > atof( GLServerVersion ) ) {
- if ( asprintf( &buf, "%s (%s)", GLServerVersion, string ) == -1) {
- string = GLServerVersion;
- }
- else {
- string = buf;
- }
- }
+ else if (name == GL_VERSION) {
+ if (atof(string) > atof(GLServerVersion)) {
+ if (asprintf(&buf, "%s (%s)", GLServerVersion, string) == -1) {
+ string = GLServerVersion;
+ }
+ else {
+ string = buf;
+ }
+ }
}
if (string) {
- length = strlen((const char *) string) + 1;
+ length = strlen((const char *) string) + 1;
}
__GLX_BEGIN_REPLY(length);
__GLX_PUT_SIZE(length);
- if ( need_swap ) {
- __GLX_SWAP_REPLY_SIZE();
- __GLX_SWAP_REPLY_HEADER();
+ if (need_swap) {
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SWAP_REPLY_HEADER();
}
__GLX_SEND_HEADER();
- WriteToClient(client, length, (char *) string);
+ WriteToClient(client, length, (char *) string);
free(buf);
return Success;
}
-int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_GetString(__GLXclientState * cl, GLbyte * pc)
{
return DoGetString(cl, pc, GL_FALSE);
}
diff --git a/xorg-server/glx/single2swap.c b/xorg-server/glx/single2swap.c
index b98392c29..1e6ba75b5 100644
--- a/xorg-server/glx/single2swap.c
+++ b/xorg-server/glx/single2swap.c
@@ -1,270 +1,282 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#else
-
-#include "glheader.h"
-
-#endif
-
-#include "glxserver.h"
-#include "glxutil.h"
-#include "glxext.h"
-#include "indirect_dispatch.h"
-#include "unpack.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
-
-int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
-{
- GLsizei size;
- GLenum type;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLXcontext *cx;
- int error;
-
- __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
-
- pc += __GLX_SINGLE_HDR_SIZE;
- __GLX_SWAP_INT(pc+0);
- __GLX_SWAP_INT(pc+4);
- size = *(GLsizei *)(pc+0);
- type = *(GLenum *)(pc+4);
- if (cx->feedbackBufSize < size) {
- cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
- (size_t) size
- * __GLX_SIZE_FLOAT32);
- if (!cx->feedbackBuf) {
- cl->client->errorValue = size;
- return BadAlloc;
- }
- cx->feedbackBufSize = size;
- }
- CALL_FeedbackBuffer( GET_DISPATCH(), (size, type, cx->feedbackBuf) );
- cx->hasUnflushedCommands = GL_TRUE;
- return Success;
-}
-
-int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
-{
- __GLXcontext *cx;
- GLsizei size;
- __GLX_DECLARE_SWAP_VARIABLES;
- int error;
-
- __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
-
- pc += __GLX_SINGLE_HDR_SIZE;
- __GLX_SWAP_INT(pc+0);
- size = *(GLsizei *)(pc+0);
- if (cx->selectBufSize < size) {
- cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
- (size_t) size
- * __GLX_SIZE_CARD32);
- if (!cx->selectBuf) {
- cl->client->errorValue = size;
- return BadAlloc;
- }
- cx->selectBufSize = size;
- }
- CALL_SelectBuffer( GET_DISPATCH(), (size, cx->selectBuf) );
- cx->hasUnflushedCommands = GL_TRUE;
- return Success;
-}
-
-int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client;
- __GLXcontext *cx;
- xGLXRenderModeReply reply;
- GLint nitems=0, retBytes=0, retval, newModeCheck;
- GLubyte *retBuffer = NULL;
- GLenum newMode;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- int error;
-
- __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
-
- pc += __GLX_SINGLE_HDR_SIZE;
- __GLX_SWAP_INT(pc);
- newMode = *(GLenum*) pc;
- retval = CALL_RenderMode( GET_DISPATCH(), (newMode) );
-
- /* Check that render mode worked */
- CALL_GetIntegerv( GET_DISPATCH(), (GL_RENDER_MODE, &newModeCheck) );
- if (newModeCheck != newMode) {
- /* Render mode change failed. Bail */
- newMode = newModeCheck;
- goto noChangeAllowed;
- }
-
- /*
- ** Render mode might have still failed if we get here. But in this
- ** case we can't really tell, nor does it matter. If it did fail, it
- ** will return 0, and thus we won't send any data across the wire.
- */
-
- switch (cx->renderMode) {
- case GL_RENDER:
- cx->renderMode = newMode;
- break;
- case GL_FEEDBACK:
- if (retval < 0) {
- /* Overflow happened. Copy the entire buffer */
- nitems = cx->feedbackBufSize;
- } else {
- nitems = retval;
- }
- retBytes = nitems * __GLX_SIZE_FLOAT32;
- retBuffer = (GLubyte*) cx->feedbackBuf;
- __GLX_SWAP_FLOAT_ARRAY((GLbyte *)retBuffer, nitems);
- cx->renderMode = newMode;
- break;
- case GL_SELECT:
- if (retval < 0) {
- /* Overflow happened. Copy the entire buffer */
- nitems = cx->selectBufSize;
- } else {
- GLuint *bp = cx->selectBuf;
- GLint i;
-
- /*
- ** Figure out how many bytes of data need to be sent. Parse
- ** the selection buffer to determine this fact as the
- ** return value is the number of hits, not the number of
- ** items in the buffer.
- */
- nitems = 0;
- i = retval;
- while (--i >= 0) {
- GLuint n;
-
- /* Parse select data for this hit */
- n = *bp;
- bp += 3 + n;
- }
- nitems = bp - cx->selectBuf;
- }
- retBytes = nitems * __GLX_SIZE_CARD32;
- retBuffer = (GLubyte*) cx->selectBuf;
- __GLX_SWAP_INT_ARRAY((GLbyte *)retBuffer, nitems);
- cx->renderMode = newMode;
- break;
- }
-
- /*
- ** First reply is the number of elements returned in the feedback or
- ** selection array, as per the API for glRenderMode itself.
- */
- noChangeAllowed:;
- client = cl->client;
- reply.length = nitems;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.retval = retval;
- reply.size = nitems;
- reply.newMode = newMode;
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.retval);
- __GLX_SWAP_INT(&reply.size);
- __GLX_SWAP_INT(&reply.newMode);
- WriteToClient(client, sz_xGLXRenderModeReply, (char *)&reply);
- if (retBytes) {
- WriteToClient(client, retBytes, (char *)retBuffer);
- }
- return Success;
-}
-
-int __glXDispSwap_Flush(__GLXclientState *cl, GLbyte *pc)
-{
- __GLXcontext *cx;
- int error;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
-
- CALL_Flush( GET_DISPATCH(), () );
- cx->hasUnflushedCommands = GL_FALSE;
- return Success;
-}
-
-int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc)
-{
- __GLXcontext *cx;
- ClientPtr client;
- int error;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
-
- /* Do a local glFinish */
- CALL_Finish( GET_DISPATCH(), () );
- cx->hasUnflushedCommands = GL_FALSE;
-
- /* Send empty reply packet to indicate finish is finished */
- client = cl->client;
- __GLX_BEGIN_REPLY(0);
- __GLX_PUT_RETVAL(0);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SEND_HEADER();
-
- return Success;
-}
-
-int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc)
-{
- return DoGetString(cl, pc, GL_TRUE);
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
+#endif
+
+#include "glxserver.h"
+#include "glxutil.h"
+#include "glxext.h"
+#include "indirect_dispatch.h"
+#include "unpack.h"
+#include "glapitable.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+
+int
+__glXDispSwap_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc)
+{
+ GLsizei size;
+ GLenum type;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLXcontext *cx;
+ int error;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ size = *(GLsizei *) (pc + 0);
+ type = *(GLenum *) (pc + 4);
+ if (cx->feedbackBufSize < size) {
+ cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
+ (size_t) size
+ * __GLX_SIZE_FLOAT32);
+ if (!cx->feedbackBuf) {
+ cl->client->errorValue = size;
+ return BadAlloc;
+ }
+ cx->feedbackBufSize = size;
+ }
+ CALL_FeedbackBuffer(GET_DISPATCH(), (size, type, cx->feedbackBuf));
+ cx->hasUnflushedCommands = GL_TRUE;
+ return Success;
+}
+
+int
+__glXDispSwap_SelectBuffer(__GLXclientState * cl, GLbyte * pc)
+{
+ __GLXcontext *cx;
+ GLsizei size;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ int error;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ size = *(GLsizei *) (pc + 0);
+ if (cx->selectBufSize < size) {
+ cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
+ (size_t) size * __GLX_SIZE_CARD32);
+ if (!cx->selectBuf) {
+ cl->client->errorValue = size;
+ return BadAlloc;
+ }
+ cx->selectBufSize = size;
+ }
+ CALL_SelectBuffer(GET_DISPATCH(), (size, cx->selectBuf));
+ cx->hasUnflushedCommands = GL_TRUE;
+ return Success;
+}
+
+int
+__glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc)
+{
+ ClientPtr client;
+ __GLXcontext *cx;
+ xGLXRenderModeReply reply;
+ GLint nitems = 0, retBytes = 0, retval, newModeCheck;
+ GLubyte *retBuffer = NULL;
+ GLenum newMode;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ int error;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc);
+ newMode = *(GLenum *) pc;
+ retval = CALL_RenderMode(GET_DISPATCH(), (newMode));
+
+ /* Check that render mode worked */
+ CALL_GetIntegerv(GET_DISPATCH(), (GL_RENDER_MODE, &newModeCheck));
+ if (newModeCheck != newMode) {
+ /* Render mode change failed. Bail */
+ newMode = newModeCheck;
+ goto noChangeAllowed;
+ }
+
+ /*
+ ** Render mode might have still failed if we get here. But in this
+ ** case we can't really tell, nor does it matter. If it did fail, it
+ ** will return 0, and thus we won't send any data across the wire.
+ */
+
+ switch (cx->renderMode) {
+ case GL_RENDER:
+ cx->renderMode = newMode;
+ break;
+ case GL_FEEDBACK:
+ if (retval < 0) {
+ /* Overflow happened. Copy the entire buffer */
+ nitems = cx->feedbackBufSize;
+ }
+ else {
+ nitems = retval;
+ }
+ retBytes = nitems * __GLX_SIZE_FLOAT32;
+ retBuffer = (GLubyte *) cx->feedbackBuf;
+ __GLX_SWAP_FLOAT_ARRAY((GLbyte *) retBuffer, nitems);
+ cx->renderMode = newMode;
+ break;
+ case GL_SELECT:
+ if (retval < 0) {
+ /* Overflow happened. Copy the entire buffer */
+ nitems = cx->selectBufSize;
+ }
+ else {
+ GLuint *bp = cx->selectBuf;
+ GLint i;
+
+ /*
+ ** Figure out how many bytes of data need to be sent. Parse
+ ** the selection buffer to determine this fact as the
+ ** return value is the number of hits, not the number of
+ ** items in the buffer.
+ */
+ nitems = 0;
+ i = retval;
+ while (--i >= 0) {
+ GLuint n;
+
+ /* Parse select data for this hit */
+ n = *bp;
+ bp += 3 + n;
+ }
+ nitems = bp - cx->selectBuf;
+ }
+ retBytes = nitems * __GLX_SIZE_CARD32;
+ retBuffer = (GLubyte *) cx->selectBuf;
+ __GLX_SWAP_INT_ARRAY((GLbyte *) retBuffer, nitems);
+ cx->renderMode = newMode;
+ break;
+ }
+
+ /*
+ ** First reply is the number of elements returned in the feedback or
+ ** selection array, as per the API for glRenderMode itself.
+ */
+ noChangeAllowed:;
+ client = cl->client;
+ reply.length = nitems;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.retval = retval;
+ reply.size = nitems;
+ reply.newMode = newMode;
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.retval);
+ __GLX_SWAP_INT(&reply.size);
+ __GLX_SWAP_INT(&reply.newMode);
+ WriteToClient(client, sz_xGLXRenderModeReply, (char *) &reply);
+ if (retBytes) {
+ WriteToClient(client, retBytes, (char *) retBuffer);
+ }
+ return Success;
+}
+
+int
+__glXDispSwap_Flush(__GLXclientState * cl, GLbyte * pc)
+{
+ __GLXcontext *cx;
+ int error;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ CALL_Flush(GET_DISPATCH(), ());
+ cx->hasUnflushedCommands = GL_FALSE;
+ return Success;
+}
+
+int
+__glXDispSwap_Finish(__GLXclientState * cl, GLbyte * pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client;
+ int error;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ /* Do a local glFinish */
+ CALL_Finish(GET_DISPATCH(), ());
+ cx->hasUnflushedCommands = GL_FALSE;
+
+ /* Send empty reply packet to indicate finish is finished */
+ client = cl->client;
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_RETVAL(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+
+ return Success;
+}
+
+int
+__glXDispSwap_GetString(__GLXclientState * cl, GLbyte * pc)
+{
+ return DoGetString(cl, pc, GL_TRUE);
+}
diff --git a/xorg-server/glx/singlepix.c b/xorg-server/glx/singlepix.c
index cbc32c378..876c97cbb 100644
--- a/xorg-server/glx/singlepix.c
+++ b/xorg-server/glx/singlepix.c
@@ -1,532 +1,557 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#else
-
-#include "glheader.h"
-
-#endif
-
-#include "glxserver.h"
-#include "glxext.h"
-#include "singlesize.h"
-#include "unpack.h"
-#include "indirect_size_get.h"
-#include "indirect_dispatch.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
-
-int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
-{
- GLsizei width, height;
- GLenum format, type;
- GLboolean swapBytes, lsbFirst;
- GLint compsize;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- char *answer, answerBuffer[200];
-
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
-
- pc += __GLX_SINGLE_HDR_SIZE;
- width = *(GLsizei *)(pc + 8);
- height = *(GLsizei *)(pc + 12);
- format = *(GLenum *)(pc + 16);
- type = *(GLenum *)(pc + 20);
- swapBytes = *(GLboolean *)(pc + 24);
- lsbFirst = *(GLboolean *)(pc + 25);
- compsize = __glReadPixels_size(format,type,width,height);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_ReadPixels( GET_DISPATCH(), (
- *(GLint *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLsizei *)(pc + 8),
- *(GLsizei *)(pc + 12),
- *(GLenum *)(pc + 16),
- *(GLenum *)(pc + 20),
- answer
- ) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
- cx->hasUnflushedCommands = GL_FALSE;
- return Success;
-}
-
-int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc)
-{
- GLint level, compsize;
- GLenum format, type, target;
- GLboolean swapBytes;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- char *answer, answerBuffer[200];
- GLint width=0, height=0, depth=1;
-
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
-
- pc += __GLX_SINGLE_HDR_SIZE;
- level = *(GLint *)(pc + 4);
- format = *(GLenum *)(pc + 8);
- type = *(GLenum *)(pc + 12);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 16);
-
- CALL_GetTexLevelParameteriv( GET_DISPATCH(), (target, level, GL_TEXTURE_WIDTH, &width) );
- CALL_GetTexLevelParameteriv( GET_DISPATCH(), (target, level, GL_TEXTURE_HEIGHT, &height) );
- if ( target == GL_TEXTURE_3D) {
- CALL_GetTexLevelParameteriv( GET_DISPATCH(), (target, level, GL_TEXTURE_DEPTH, &depth) );
- }
- /*
- * The three queries above might fail if we're in a state where queries
- * are illegal, but then width, height, and depth would still be zero anyway.
- */
- compsize = __glGetTexImage_size(target,level,format,type,width,height,depth);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetTexImage( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLenum *)(pc + 12),
- answer
- ) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- ((xGLXGetTexImageReply *)&__glXReply)->width = width;
- ((xGLXGetTexImageReply *)&__glXReply)->height = height;
- ((xGLXGetTexImageReply *)&__glXReply)->depth = depth;
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
- return Success;
-}
-
-int __glXDisp_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc)
-{
- GLboolean lsbFirst;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- GLubyte answerBuffer[200];
- char *answer;
-
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
-
- pc += __GLX_SINGLE_HDR_SIZE;
- lsbFirst = *(GLboolean *)(pc + 0);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,128,1);
-
- __glXClearErrorOccured();
- CALL_GetPolygonStipple( GET_DISPATCH(), ((GLubyte *) answer) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(128);
- __GLX_SEND_HEADER();
- __GLX_SEND_BYTE_ARRAY(128);
- }
- return Success;
-}
-
-static int GetSeparableFilter(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
-{
- GLint compsize, compsize2;
- GLenum format, type, target;
- GLboolean swapBytes;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- char *answer, answerBuffer[200];
- GLint width=0, height=0;
-
- cx = __glXForceCurrent(cl, tag, &error);
- if (!cx) {
- return error;
- }
-
- format = *(GLenum *)(pc + 4);
- type = *(GLenum *)(pc + 8);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 12);
-
- /* target must be SEPARABLE_2D, however I guess we can let the GL
- barf on this one.... */
-
- CALL_GetConvolutionParameteriv(GET_DISPATCH(), (target, GL_CONVOLUTION_WIDTH, &width));
- CALL_GetConvolutionParameteriv(GET_DISPATCH(), (target, GL_CONVOLUTION_HEIGHT, &height));
- /*
- * The two queries above might fail if we're in a state where queries
- * are illegal, but then width and height would still be zero anyway.
- */
- compsize = __glGetTexImage_size(target,1,format,type,width,1,1);
- compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1);
-
- if (compsize < 0) compsize = 0;
- if (compsize2 < 0) compsize2 = 0;
- compsize = __GLX_PAD(compsize);
- compsize2 = __GLX_PAD(compsize2);
-
- CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1);
- __glXClearErrorOccured();
- CALL_GetSeparableFilter( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- answer,
- answer + compsize,
- NULL
- ) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize + compsize2);
- ((xGLXGetSeparableFilterReply *)&__glXReply)->width = width;
- ((xGLXGetSeparableFilterReply *)&__glXReply)->height = height;
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize + compsize2);
- }
-
- return Success;
-}
-
-int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
-
- return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
-}
-
-int __glXDisp_GetSeparableFilterEXT(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
-
- return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
-}
-
-static int GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc,
- GLXContextTag tag)
-{
- GLint compsize;
- GLenum format, type, target;
- GLboolean swapBytes;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- char *answer, answerBuffer[200];
- GLint width=0, height=0;
-
- cx = __glXForceCurrent(cl, tag, &error);
- if (!cx) {
- return error;
- }
-
- format = *(GLenum *)(pc + 4);
- type = *(GLenum *)(pc + 8);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 12);
-
- CALL_GetConvolutionParameteriv(GET_DISPATCH(),
- (target, GL_CONVOLUTION_WIDTH, &width));
- if (target == GL_CONVOLUTION_1D) {
- height = 1;
- } else {
- CALL_GetConvolutionParameteriv(GET_DISPATCH(),
- (target, GL_CONVOLUTION_HEIGHT, &height));
- }
- /*
- * The two queries above might fail if we're in a state where queries
- * are illegal, but then width and height would still be zero anyway.
- */
- compsize = __glGetTexImage_size(target,1,format,type,width,height,1);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetConvolutionFilter( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- answer
- ) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- ((xGLXGetConvolutionFilterReply *)&__glXReply)->width = width;
- ((xGLXGetConvolutionFilterReply *)&__glXReply)->height = height;
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- return Success;
-}
-
-int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
-
- return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
-}
-
-int __glXDisp_GetConvolutionFilterEXT(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
-
- return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
-}
-
-static int GetHistogram(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
-{
- GLint compsize;
- GLenum format, type, target;
- GLboolean swapBytes, reset;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- char *answer, answerBuffer[200];
- GLint width=0;
-
- cx = __glXForceCurrent(cl, tag, &error);
- if (!cx) {
- return error;
- }
-
- format = *(GLenum *)(pc + 4);
- type = *(GLenum *)(pc + 8);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 12);
- reset = *(GLboolean *)(pc + 13);
-
- CALL_GetHistogramParameteriv(GET_DISPATCH(),
- (target, GL_HISTOGRAM_WIDTH, &width));
- /*
- * The one query above might fail if we're in a state where queries
- * are illegal, but then width would still be zero anyway.
- */
- compsize = __glGetTexImage_size(target,1,format,type,width,1,1);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, answer));
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- ((xGLXGetHistogramReply *)&__glXReply)->width = width;
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- return Success;
-}
-
-int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
-
- return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
-}
-
-int __glXDisp_GetHistogramEXT(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
-
- return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
-}
-
-static int GetMinmax(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
-{
- GLint compsize;
- GLenum format, type, target;
- GLboolean swapBytes, reset;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- char *answer, answerBuffer[200];
-
- cx = __glXForceCurrent(cl, tag, &error);
- if (!cx) {
- return error;
- }
-
- format = *(GLenum *)(pc + 4);
- type = *(GLenum *)(pc + 8);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 12);
- reset = *(GLboolean *)(pc + 13);
-
- compsize = __glGetTexImage_size(target,1,format,type,2,1,1);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, answer));
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- return Success;
-}
-
-int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
-
- return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
-}
-
-int __glXDisp_GetMinmaxEXT(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
-
- return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
-}
-
-static int GetColorTable(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
-{
- GLint compsize;
- GLenum format, type, target;
- GLboolean swapBytes;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- char *answer, answerBuffer[200];
- GLint width=0;
-
- cx = __glXForceCurrent(cl, tag, &error);
- if (!cx) {
- return error;
- }
-
- target = *(GLenum *)(pc + 0);
- format = *(GLenum *)(pc + 4);
- type = *(GLenum *)(pc + 8);
- swapBytes = *(GLboolean *)(pc + 12);
-
- CALL_GetColorTableParameteriv(GET_DISPATCH(),
- (target, GL_COLOR_TABLE_WIDTH, &width));
- /*
- * The one query above might fail if we're in a state where queries
- * are illegal, but then width would still be zero anyway.
- */
- compsize = __glGetTexImage_size(target,1,format,type,width,1,1);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetColorTable( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- answer
- ) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- ((xGLXGetColorTableReply *)&__glXReply)->width = width;
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- return Success;
-}
-
-int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
-
- return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
-}
-
-int __glXDisp_GetColorTableSGI(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
-
- return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
+#endif
+
+#include "glxserver.h"
+#include "glxext.h"
+#include "singlesize.h"
+#include "unpack.h"
+#include "indirect_size_get.h"
+#include "indirect_dispatch.h"
+#include "glapitable.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+
+int
+__glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
+{
+ GLsizei width, height;
+ GLenum format, type;
+ GLboolean swapBytes, lsbFirst;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ width = *(GLsizei *) (pc + 8);
+ height = *(GLsizei *) (pc + 12);
+ format = *(GLenum *) (pc + 16);
+ type = *(GLenum *) (pc + 20);
+ swapBytes = *(GLboolean *) (pc + 24);
+ lsbFirst = *(GLboolean *) (pc + 25);
+ compsize = __glReadPixels_size(format, type, width, height);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_ReadPixels(GET_DISPATCH(), (*(GLint *) (pc + 0),
+ *(GLint *) (pc + 4),
+ *(GLsizei *) (pc + 8),
+ *(GLsizei *) (pc + 12),
+ *(GLenum *) (pc + 16),
+ *(GLenum *) (pc + 20), answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+ cx->hasUnflushedCommands = GL_FALSE;
+ return Success;
+}
+
+int
+__glXDisp_GetTexImage(__GLXclientState * cl, GLbyte * pc)
+{
+ GLint level, compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+ GLint width = 0, height = 0, depth = 1;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ level = *(GLint *) (pc + 4);
+ format = *(GLenum *) (pc + 8);
+ type = *(GLenum *) (pc + 12);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 16);
+
+ CALL_GetTexLevelParameteriv(GET_DISPATCH(),
+ (target, level, GL_TEXTURE_WIDTH, &width));
+ CALL_GetTexLevelParameteriv(GET_DISPATCH(),
+ (target, level, GL_TEXTURE_HEIGHT, &height));
+ if (target == GL_TEXTURE_3D) {
+ CALL_GetTexLevelParameteriv(GET_DISPATCH(),
+ (target, level, GL_TEXTURE_DEPTH, &depth));
+ }
+ /*
+ * The three queries above might fail if we're in a state where queries
+ * are illegal, but then width, height, and depth would still be zero anyway.
+ */
+ compsize =
+ __glGetTexImage_size(target, level, format, type, width, height, depth);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetTexImage(GET_DISPATCH(), (*(GLenum *) (pc + 0),
+ *(GLint *) (pc + 4),
+ *(GLenum *) (pc + 8),
+ *(GLenum *) (pc + 12), answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ ((xGLXGetTexImageReply *) & __glXReply)->width = width;
+ ((xGLXGetTexImageReply *) & __glXReply)->height = height;
+ ((xGLXGetTexImageReply *) & __glXReply)->depth = depth;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int
+__glXDisp_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc)
+{
+ GLboolean lsbFirst;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLubyte answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ lsbFirst = *(GLboolean *) (pc + 0);
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, 128, 1);
+
+ __glXClearErrorOccured();
+ CALL_GetPolygonStipple(GET_DISPATCH(), ((GLubyte *) answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(128);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_BYTE_ARRAY(128);
+ }
+ return Success;
+}
+
+static int
+GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
+{
+ GLint compsize, compsize2;
+ GLenum format, type, target;
+ GLboolean swapBytes;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+ GLint width = 0, height = 0;
+
+ cx = __glXForceCurrent(cl, tag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ format = *(GLenum *) (pc + 4);
+ type = *(GLenum *) (pc + 8);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 12);
+
+ /* target must be SEPARABLE_2D, however I guess we can let the GL
+ barf on this one.... */
+
+ CALL_GetConvolutionParameteriv(GET_DISPATCH(),
+ (target, GL_CONVOLUTION_WIDTH, &width));
+ CALL_GetConvolutionParameteriv(GET_DISPATCH(),
+ (target, GL_CONVOLUTION_HEIGHT, &height));
+ /*
+ * The two queries above might fail if we're in a state where queries
+ * are illegal, but then width and height would still be zero anyway.
+ */
+ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
+ compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1);
+
+ if (compsize < 0)
+ compsize = 0;
+ if (compsize2 < 0)
+ compsize2 = 0;
+ compsize = __GLX_PAD(compsize);
+ compsize2 = __GLX_PAD(compsize2);
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize + compsize2, 1);
+ __glXClearErrorOccured();
+ CALL_GetSeparableFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0),
+ *(GLenum *) (pc + 4),
+ *(GLenum *) (pc + 8),
+ answer, answer + compsize, NULL));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize + compsize2);
+ ((xGLXGetSeparableFilterReply *) & __glXReply)->width = width;
+ ((xGLXGetSeparableFilterReply *) & __glXReply)->height = height;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize + compsize2);
+ }
+
+ return Success;
+}
+
+int
+__glXDisp_GetSeparableFilter(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
+
+ return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
+}
+
+int
+__glXDisp_GetSeparableFilterEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
+
+ return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
+}
+
+static int
+GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
+{
+ GLint compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+ GLint width = 0, height = 0;
+
+ cx = __glXForceCurrent(cl, tag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ format = *(GLenum *) (pc + 4);
+ type = *(GLenum *) (pc + 8);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 12);
+
+ CALL_GetConvolutionParameteriv(GET_DISPATCH(),
+ (target, GL_CONVOLUTION_WIDTH, &width));
+ if (target == GL_CONVOLUTION_1D) {
+ height = 1;
+ }
+ else {
+ CALL_GetConvolutionParameteriv(GET_DISPATCH(),
+ (target, GL_CONVOLUTION_HEIGHT,
+ &height));
+ }
+ /*
+ * The two queries above might fail if we're in a state where queries
+ * are illegal, but then width and height would still be zero anyway.
+ */
+ compsize = __glGetTexImage_size(target, 1, format, type, width, height, 1);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetConvolutionFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0),
+ *(GLenum *) (pc + 4),
+ *(GLenum *) (pc + 8), answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ ((xGLXGetConvolutionFilterReply *) & __glXReply)->width = width;
+ ((xGLXGetConvolutionFilterReply *) & __glXReply)->height = height;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ return Success;
+}
+
+int
+__glXDisp_GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
+
+ return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
+}
+
+int
+__glXDisp_GetConvolutionFilterEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
+
+ return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
+}
+
+static int
+GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
+{
+ GLint compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes, reset;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+ GLint width = 0;
+
+ cx = __glXForceCurrent(cl, tag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ format = *(GLenum *) (pc + 4);
+ type = *(GLenum *) (pc + 8);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 12);
+ reset = *(GLboolean *) (pc + 13);
+
+ CALL_GetHistogramParameteriv(GET_DISPATCH(),
+ (target, GL_HISTOGRAM_WIDTH, &width));
+ /*
+ * The one query above might fail if we're in a state where queries
+ * are illegal, but then width would still be zero anyway.
+ */
+ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ ((xGLXGetHistogramReply *) & __glXReply)->width = width;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ return Success;
+}
+
+int
+__glXDisp_GetHistogram(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
+
+ return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
+}
+
+int
+__glXDisp_GetHistogramEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
+
+ return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
+}
+
+static int
+GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
+{
+ GLint compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes, reset;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+
+ cx = __glXForceCurrent(cl, tag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ format = *(GLenum *) (pc + 4);
+ type = *(GLenum *) (pc + 8);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 12);
+ reset = *(GLboolean *) (pc + 13);
+
+ compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ return Success;
+}
+
+int
+__glXDisp_GetMinmax(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
+
+ return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
+}
+
+int
+__glXDisp_GetMinmaxEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
+
+ return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
+}
+
+static int
+GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
+{
+ GLint compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+ GLint width = 0;
+
+ cx = __glXForceCurrent(cl, tag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ target = *(GLenum *) (pc + 0);
+ format = *(GLenum *) (pc + 4);
+ type = *(GLenum *) (pc + 8);
+ swapBytes = *(GLboolean *) (pc + 12);
+
+ CALL_GetColorTableParameteriv(GET_DISPATCH(),
+ (target, GL_COLOR_TABLE_WIDTH, &width));
+ /*
+ * The one query above might fail if we're in a state where queries
+ * are illegal, but then width would still be zero anyway.
+ */
+ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetColorTable(GET_DISPATCH(), (*(GLenum *) (pc + 0),
+ *(GLenum *) (pc + 4),
+ *(GLenum *) (pc + 8), answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ ((xGLXGetColorTableReply *) & __glXReply)->width = width;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ return Success;
+}
+
+int
+__glXDisp_GetColorTable(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
+
+ return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
+}
+
+int
+__glXDisp_GetColorTableSGI(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
+
+ return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
+}
diff --git a/xorg-server/glx/singlepixswap.c b/xorg-server/glx/singlepixswap.c
index 0aa0a566c..50913cf5a 100644
--- a/xorg-server/glx/singlepixswap.c
+++ b/xorg-server/glx/singlepixswap.c
@@ -1,583 +1,622 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#else
-
-#include "glheader.h"
-
-#endif
-
-#include "glxserver.h"
-#include "glxext.h"
-#include "singlesize.h"
-#include "unpack.h"
-#include "indirect_dispatch.h"
-#include "indirect_size_get.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
-
-int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc)
-{
- GLsizei width, height;
- GLenum format, type;
- GLboolean swapBytes, lsbFirst;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- char *answer, answerBuffer[200];
-
- __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
-
- pc += __GLX_SINGLE_HDR_SIZE;
- __GLX_SWAP_INT(pc+0);
- __GLX_SWAP_INT(pc+4);
- __GLX_SWAP_INT(pc+8);
- __GLX_SWAP_INT(pc+12);
- __GLX_SWAP_INT(pc+16);
- __GLX_SWAP_INT(pc+20);
-
- width = *(GLsizei *)(pc + 8);
- height = *(GLsizei *)(pc + 12);
- format = *(GLenum *)(pc + 16);
- type = *(GLenum *)(pc + 20);
- swapBytes = *(GLboolean *)(pc + 24);
- lsbFirst = *(GLboolean *)(pc + 25);
- compsize = __glReadPixels_size(format,type,width,height);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_ReadPixels( GET_DISPATCH(),
- (*(GLint *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLsizei *)(pc + 8),
- *(GLsizei *)(pc + 12),
- *(GLenum *)(pc + 16),
- *(GLenum *)(pc + 20),
- answer)
- );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
- cx->hasUnflushedCommands = GL_FALSE;
- return Success;
-}
-
-int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc)
-{
- GLint level, compsize;
- GLenum format, type, target;
- GLboolean swapBytes;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- char *answer, answerBuffer[200];
- GLint width=0, height=0, depth=1;
-
- __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
-
- pc += __GLX_SINGLE_HDR_SIZE;
- __GLX_SWAP_INT(pc+0);
- __GLX_SWAP_INT(pc+4);
- __GLX_SWAP_INT(pc+8);
- __GLX_SWAP_INT(pc+12);
-
- level = *(GLint *)(pc + 4);
- format = *(GLenum *)(pc + 8);
- type = *(GLenum *)(pc + 12);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 16);
-
- CALL_GetTexLevelParameteriv( GET_DISPATCH(), (target, level, GL_TEXTURE_WIDTH, &width) );
- CALL_GetTexLevelParameteriv( GET_DISPATCH(), (target, level, GL_TEXTURE_HEIGHT, &height) );
- if ( target == GL_TEXTURE_3D) {
- CALL_GetTexLevelParameteriv( GET_DISPATCH(), (target, level, GL_TEXTURE_DEPTH, &depth) );
- }
- /*
- * The three queries above might fail if we're in a state where queries
- * are illegal, but then width, height, and depth would still be zero anyway.
- */
- compsize = __glGetTexImage_size(target,level,format,type,width,height,depth);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetTexImage( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLint *)(pc + 4),
- *(GLenum *)(pc + 8),
- *(GLenum *)(pc + 12),
- answer
- ) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SWAP_INT(&width);
- __GLX_SWAP_INT(&height);
- __GLX_SWAP_INT(&depth);
- ((xGLXGetTexImageReply *)&__glXReply)->width = width;
- ((xGLXGetTexImageReply *)&__glXReply)->height = height;
- ((xGLXGetTexImageReply *)&__glXReply)->depth = depth;
- __GLX_SEND_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
- return Success;
-}
-
-int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc)
-{
- GLboolean lsbFirst;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- GLubyte answerBuffer[200];
- char *answer;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
- cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
- if (!cx) {
- return error;
- }
- pc += __GLX_SINGLE_HDR_SIZE;
- lsbFirst = *(GLboolean *)(pc + 0);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,128,1);
-
- __glXClearErrorOccured();
- CALL_GetPolygonStipple( GET_DISPATCH(), ((GLubyte *) answer) );
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SEND_HEADER();
- } else {
- __GLX_BEGIN_REPLY(128);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SEND_HEADER();
- __GLX_SEND_BYTE_ARRAY(128);
- }
- return Success;
-}
-
-static int GetSeparableFilter(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
-{
- GLint compsize, compsize2;
- GLenum format, type, target;
- GLboolean swapBytes;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- __GLX_DECLARE_SWAP_VARIABLES;
- char *answer, answerBuffer[200];
- GLint width=0, height=0;
-
- cx = __glXForceCurrent(cl, tag, &error);
- if (!cx) {
- return error;
- }
-
- __GLX_SWAP_INT(pc+0);
- __GLX_SWAP_INT(pc+4);
- __GLX_SWAP_INT(pc+8);
-
- format = *(GLenum *)(pc + 4);
- type = *(GLenum *)(pc + 8);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 12);
-
- /* target must be SEPARABLE_2D, however I guess we can let the GL
- barf on this one.... */
-
- CALL_GetConvolutionParameteriv( GET_DISPATCH(), (target, GL_CONVOLUTION_WIDTH, &width) );
- CALL_GetConvolutionParameteriv( GET_DISPATCH(), (target, GL_CONVOLUTION_HEIGHT, &height) );
- /*
- * The two queries above might fail if we're in a state where queries
- * are illegal, but then width and height would still be zero anyway.
- */
- compsize = __glGetTexImage_size(target,1,format,type,width,1,1);
- compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1);
-
- if (compsize < 0) compsize = 0;
- if (compsize2 < 0) compsize2 = 0;
- compsize = __GLX_PAD(compsize);
- compsize2 = __GLX_PAD(compsize2);
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1);
- __glXClearErrorOccured();
- CALL_GetSeparableFilter( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- answer,
- answer + compsize,
- NULL
- ) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SWAP_REPLY_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize + compsize2);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SWAP_INT(&width);
- __GLX_SWAP_INT(&height);
- ((xGLXGetSeparableFilterReply *)&__glXReply)->width = width;
- ((xGLXGetSeparableFilterReply *)&__glXReply)->height = height;
- __GLX_SEND_VOID_ARRAY(compsize + compsize2);
- }
-
- return Success;
-}
-
-int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
-
- return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
-}
-
-int __glXDispSwap_GetSeparableFilterEXT(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
-
- return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
-}
-
-static int GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
-{
- GLint compsize;
- GLenum format, type, target;
- GLboolean swapBytes;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- __GLX_DECLARE_SWAP_VARIABLES;
- char *answer, answerBuffer[200];
- GLint width=0, height=0;
-
- cx = __glXForceCurrent(cl, tag, &error);
- if (!cx) {
- return error;
- }
-
- __GLX_SWAP_INT(pc+0);
- __GLX_SWAP_INT(pc+4);
- __GLX_SWAP_INT(pc+8);
-
- format = *(GLenum *)(pc + 4);
- type = *(GLenum *)(pc + 8);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 12);
-
- CALL_GetConvolutionParameteriv( GET_DISPATCH(), (target, GL_CONVOLUTION_WIDTH, &width) );
- if (target == GL_CONVOLUTION_2D) {
- height = 1;
- } else {
- CALL_GetConvolutionParameteriv( GET_DISPATCH(), (target, GL_CONVOLUTION_HEIGHT, &height) );
- }
- /*
- * The two queries above might fail if we're in a state where queries
- * are illegal, but then width and height would still be zero anyway.
- */
- compsize = __glGetTexImage_size(target,1,format,type,width,height,1);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetConvolutionFilter( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- answer
- ) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SWAP_REPLY_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SWAP_INT(&width);
- __GLX_SWAP_INT(&height);
- ((xGLXGetConvolutionFilterReply *)&__glXReply)->width = width;
- ((xGLXGetConvolutionFilterReply *)&__glXReply)->height = height;
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- return Success;
-}
-
-int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
-
- return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
-}
-
-int __glXDispSwap_GetConvolutionFilterEXT(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
-
- return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
-}
-
-static int GetHistogram(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
-{
- GLint compsize;
- GLenum format, type, target;
- GLboolean swapBytes, reset;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- __GLX_DECLARE_SWAP_VARIABLES;
- char *answer, answerBuffer[200];
- GLint width=0;
-
- cx = __glXForceCurrent(cl, tag, &error);
- if (!cx) {
- return error;
- }
-
- __GLX_SWAP_INT(pc+0);
- __GLX_SWAP_INT(pc+4);
- __GLX_SWAP_INT(pc+8);
-
- format = *(GLenum *)(pc + 4);
- type = *(GLenum *)(pc + 8);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 12);
- reset = *(GLboolean *)(pc + 13);
-
- CALL_GetHistogramParameteriv( GET_DISPATCH(), (target, GL_HISTOGRAM_WIDTH, &width) );
- /*
- * The one query above might fail if we're in a state where queries
- * are illegal, but then width would still be zero anyway.
- */
- compsize = __glGetTexImage_size(target,1,format,type,width,1,1);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetHistogram( GET_DISPATCH(), (target, reset, format, type, answer) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SWAP_REPLY_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SWAP_INT(&width);
- ((xGLXGetHistogramReply *)&__glXReply)->width = width;
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- return Success;
-}
-
-int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
-
- return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
-}
-
-int __glXDispSwap_GetHistogramEXT(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
-
- return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
-}
-
-static int GetMinmax(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
-{
- GLint compsize;
- GLenum format, type, target;
- GLboolean swapBytes, reset;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- __GLX_DECLARE_SWAP_VARIABLES;
- char *answer, answerBuffer[200];
-
- cx = __glXForceCurrent(cl, tag, &error);
- if (!cx) {
- return error;
- }
-
- __GLX_SWAP_INT(pc+0);
- __GLX_SWAP_INT(pc+4);
- __GLX_SWAP_INT(pc+8);
-
- format = *(GLenum *)(pc + 4);
- type = *(GLenum *)(pc + 8);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 12);
- reset = *(GLboolean *)(pc + 13);
-
- compsize = __glGetTexImage_size(target,1,format,type,2,1,1);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetMinmax( GET_DISPATCH(), (target, reset, format, type, answer) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SWAP_REPLY_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- return Success;
-}
-
-int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
-
- return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
-}
-
-int __glXDispSwap_GetMinmaxEXT(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
-
- return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
-}
-
-static int GetColorTable(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
-{
- GLint compsize;
- GLenum format, type, target;
- GLboolean swapBytes;
- __GLXcontext *cx;
- ClientPtr client = cl->client;
- int error;
- __GLX_DECLARE_SWAP_VARIABLES;
- char *answer, answerBuffer[200];
- GLint width=0;
-
- cx = __glXForceCurrent(cl, tag, &error);
- if (!cx) {
- return error;
- }
-
- __GLX_SWAP_INT(pc+0);
- __GLX_SWAP_INT(pc+4);
- __GLX_SWAP_INT(pc+8);
-
- format = *(GLenum *)(pc + 4);
- type = *(GLenum *)(pc + 8);
- target = *(GLenum *)(pc + 0);
- swapBytes = *(GLboolean *)(pc + 12);
-
- CALL_GetColorTableParameteriv( GET_DISPATCH(), (target, GL_COLOR_TABLE_WIDTH, &width) );
- /*
- * The one query above might fail if we're in a state where queries
- * are illegal, but then width would still be zero anyway.
- */
- compsize = __glGetTexImage_size(target,1,format,type,width,1,1);
- if (compsize < 0) compsize = 0;
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes) );
- __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
- __glXClearErrorOccured();
- CALL_GetColorTable( GET_DISPATCH(), (
- *(GLenum *)(pc + 0),
- *(GLenum *)(pc + 4),
- *(GLenum *)(pc + 8),
- answer
- ) );
-
- if (__glXErrorOccured()) {
- __GLX_BEGIN_REPLY(0);
- __GLX_SWAP_REPLY_HEADER();
- } else {
- __GLX_BEGIN_REPLY(compsize);
- __GLX_SWAP_REPLY_HEADER();
- __GLX_SWAP_INT(&width);
- ((xGLXGetColorTableReply *)&__glXReply)->width = width;
- __GLX_SEND_VOID_ARRAY(compsize);
- }
-
- return Success;
-}
-
-int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
-
- return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
-}
-
-int __glXDispSwap_GetColorTableSGI(__GLXclientState *cl, GLbyte *pc)
-{
- const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
-
- return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
+#endif
+
+#include "glxserver.h"
+#include "glxext.h"
+#include "singlesize.h"
+#include "unpack.h"
+#include "indirect_dispatch.h"
+#include "indirect_size_get.h"
+#include "glapitable.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+
+int
+__glXDispSwap_ReadPixels(__GLXclientState * cl, GLbyte * pc)
+{
+ GLsizei width, height;
+ GLenum format, type;
+ GLboolean swapBytes, lsbFirst;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+
+ width = *(GLsizei *) (pc + 8);
+ height = *(GLsizei *) (pc + 12);
+ format = *(GLenum *) (pc + 16);
+ type = *(GLenum *) (pc + 20);
+ swapBytes = *(GLboolean *) (pc + 24);
+ lsbFirst = *(GLboolean *) (pc + 25);
+ compsize = __glReadPixels_size(format, type, width, height);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_ReadPixels(GET_DISPATCH(),
+ (*(GLint *) (pc + 0),
+ *(GLint *) (pc + 4),
+ *(GLsizei *) (pc + 8),
+ *(GLsizei *) (pc + 12),
+ *(GLenum *) (pc + 16), *(GLenum *) (pc + 20), answer)
+ );
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+ cx->hasUnflushedCommands = GL_FALSE;
+ return Success;
+}
+
+int
+__glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc)
+{
+ GLint level, compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+ GLint width = 0, height = 0, depth = 1;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+
+ level = *(GLint *) (pc + 4);
+ format = *(GLenum *) (pc + 8);
+ type = *(GLenum *) (pc + 12);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 16);
+
+ CALL_GetTexLevelParameteriv(GET_DISPATCH(),
+ (target, level, GL_TEXTURE_WIDTH, &width));
+ CALL_GetTexLevelParameteriv(GET_DISPATCH(),
+ (target, level, GL_TEXTURE_HEIGHT, &height));
+ if (target == GL_TEXTURE_3D) {
+ CALL_GetTexLevelParameteriv(GET_DISPATCH(),
+ (target, level, GL_TEXTURE_DEPTH, &depth));
+ }
+ /*
+ * The three queries above might fail if we're in a state where queries
+ * are illegal, but then width, height, and depth would still be zero anyway.
+ */
+ compsize =
+ __glGetTexImage_size(target, level, format, type, width, height, depth);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetTexImage(GET_DISPATCH(), (*(GLenum *) (pc + 0),
+ *(GLint *) (pc + 4),
+ *(GLenum *) (pc + 8),
+ *(GLenum *) (pc + 12), answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SWAP_INT(&width);
+ __GLX_SWAP_INT(&height);
+ __GLX_SWAP_INT(&depth);
+ ((xGLXGetTexImageReply *) & __glXReply)->width = width;
+ ((xGLXGetTexImageReply *) & __glXReply)->height = height;
+ ((xGLXGetTexImageReply *) & __glXReply)->depth = depth;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int
+__glXDispSwap_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc)
+{
+ GLboolean lsbFirst;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLubyte answerBuffer[200];
+ char *answer;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ lsbFirst = *(GLboolean *) (pc + 0);
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, 128, 1);
+
+ __glXClearErrorOccured();
+ CALL_GetPolygonStipple(GET_DISPATCH(), ((GLubyte *) answer));
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(128);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_BYTE_ARRAY(128);
+ }
+ return Success;
+}
+
+static int
+GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
+{
+ GLint compsize, compsize2;
+ GLenum format, type, target;
+ GLboolean swapBytes;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ char *answer, answerBuffer[200];
+ GLint width = 0, height = 0;
+
+ cx = __glXForceCurrent(cl, tag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ format = *(GLenum *) (pc + 4);
+ type = *(GLenum *) (pc + 8);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 12);
+
+ /* target must be SEPARABLE_2D, however I guess we can let the GL
+ barf on this one.... */
+
+ CALL_GetConvolutionParameteriv(GET_DISPATCH(),
+ (target, GL_CONVOLUTION_WIDTH, &width));
+ CALL_GetConvolutionParameteriv(GET_DISPATCH(),
+ (target, GL_CONVOLUTION_HEIGHT, &height));
+ /*
+ * The two queries above might fail if we're in a state where queries
+ * are illegal, but then width and height would still be zero anyway.
+ */
+ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
+ compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1);
+
+ if (compsize < 0)
+ compsize = 0;
+ if (compsize2 < 0)
+ compsize2 = 0;
+ compsize = __GLX_PAD(compsize);
+ compsize2 = __GLX_PAD(compsize2);
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize + compsize2, 1);
+ __glXClearErrorOccured();
+ CALL_GetSeparableFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0),
+ *(GLenum *) (pc + 4),
+ *(GLenum *) (pc + 8),
+ answer, answer + compsize, NULL));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize + compsize2);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SWAP_INT(&width);
+ __GLX_SWAP_INT(&height);
+ ((xGLXGetSeparableFilterReply *) & __glXReply)->width = width;
+ ((xGLXGetSeparableFilterReply *) & __glXReply)->height = height;
+ __GLX_SEND_VOID_ARRAY(compsize + compsize2);
+ }
+
+ return Success;
+}
+
+int
+__glXDispSwap_GetSeparableFilter(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
+
+ return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
+}
+
+int
+__glXDispSwap_GetSeparableFilterEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
+
+ return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
+}
+
+static int
+GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
+{
+ GLint compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ char *answer, answerBuffer[200];
+ GLint width = 0, height = 0;
+
+ cx = __glXForceCurrent(cl, tag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ format = *(GLenum *) (pc + 4);
+ type = *(GLenum *) (pc + 8);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 12);
+
+ CALL_GetConvolutionParameteriv(GET_DISPATCH(),
+ (target, GL_CONVOLUTION_WIDTH, &width));
+ if (target == GL_CONVOLUTION_2D) {
+ height = 1;
+ }
+ else {
+ CALL_GetConvolutionParameteriv(GET_DISPATCH(),
+ (target, GL_CONVOLUTION_HEIGHT,
+ &height));
+ }
+ /*
+ * The two queries above might fail if we're in a state where queries
+ * are illegal, but then width and height would still be zero anyway.
+ */
+ compsize = __glGetTexImage_size(target, 1, format, type, width, height, 1);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetConvolutionFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0),
+ *(GLenum *) (pc + 4),
+ *(GLenum *) (pc + 8), answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SWAP_INT(&width);
+ __GLX_SWAP_INT(&height);
+ ((xGLXGetConvolutionFilterReply *) & __glXReply)->width = width;
+ ((xGLXGetConvolutionFilterReply *) & __glXReply)->height = height;
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ return Success;
+}
+
+int
+__glXDispSwap_GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
+
+ return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
+}
+
+int
+__glXDispSwap_GetConvolutionFilterEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
+
+ return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
+}
+
+static int
+GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
+{
+ GLint compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes, reset;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ char *answer, answerBuffer[200];
+ GLint width = 0;
+
+ cx = __glXForceCurrent(cl, tag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ format = *(GLenum *) (pc + 4);
+ type = *(GLenum *) (pc + 8);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 12);
+ reset = *(GLboolean *) (pc + 13);
+
+ CALL_GetHistogramParameteriv(GET_DISPATCH(),
+ (target, GL_HISTOGRAM_WIDTH, &width));
+ /*
+ * The one query above might fail if we're in a state where queries
+ * are illegal, but then width would still be zero anyway.
+ */
+ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SWAP_INT(&width);
+ ((xGLXGetHistogramReply *) & __glXReply)->width = width;
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ return Success;
+}
+
+int
+__glXDispSwap_GetHistogram(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
+
+ return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
+}
+
+int
+__glXDispSwap_GetHistogramEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
+
+ return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
+}
+
+static int
+GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
+{
+ GLint compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes, reset;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ char *answer, answerBuffer[200];
+
+ cx = __glXForceCurrent(cl, tag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ format = *(GLenum *) (pc + 4);
+ type = *(GLenum *) (pc + 8);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 12);
+ reset = *(GLboolean *) (pc + 13);
+
+ compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ return Success;
+}
+
+int
+__glXDispSwap_GetMinmax(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
+
+ return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
+}
+
+int
+__glXDispSwap_GetMinmaxEXT(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
+
+ return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
+}
+
+static int
+GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
+{
+ GLint compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ char *answer, answerBuffer[200];
+ GLint width = 0;
+
+ cx = __glXForceCurrent(cl, tag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ format = *(GLenum *) (pc + 4);
+ type = *(GLenum *) (pc + 8);
+ target = *(GLenum *) (pc + 0);
+ swapBytes = *(GLboolean *) (pc + 12);
+
+ CALL_GetColorTableParameteriv(GET_DISPATCH(),
+ (target, GL_COLOR_TABLE_WIDTH, &width));
+ /*
+ * The one query above might fail if we're in a state where queries
+ * are illegal, but then width would still be zero anyway.
+ */
+ compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
+ if (compsize < 0)
+ compsize = 0;
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+ __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
+ __glXClearErrorOccured();
+ CALL_GetColorTable(GET_DISPATCH(), (*(GLenum *) (pc + 0),
+ *(GLenum *) (pc + 4),
+ *(GLenum *) (pc + 8), answer));
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ }
+ else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SWAP_INT(&width);
+ ((xGLXGetColorTableReply *) & __glXReply)->width = width;
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+
+ return Success;
+}
+
+int
+__glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
+
+ return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
+}
+
+int
+__glXDispSwap_GetColorTableSGI(__GLXclientState * cl, GLbyte * pc)
+{
+ const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
+
+ return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
+}
diff --git a/xorg-server/glx/singlesize.c b/xorg-server/glx/singlesize.c
index 85fa9871c..4f564404a 100644
--- a/xorg-server/glx/singlesize.c
+++ b/xorg-server/glx/singlesize.c
@@ -1,197 +1,207 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#else
-
-#include "glheader.h"
-
-#endif
-
-#include <GL/gl.h>
-#include "glxserver.h"
-#include "singlesize.h"
-#include "indirect_size_get.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
-
-/*
-** These routines compute the size of variable-size returned parameters.
-** Unlike the similar routines that do the same thing for variable-size
-** incoming parameters, the samplegl library itself doesn't use these routines.
-** Hence, they are located here, in the GLX extension library.
-*/
-
-GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h)
-{
- return __glXImageSize( format, type, 0, w, h, 1, 0, 0, 0, 0, 4 );
-}
-
-GLint __glGetMap_size(GLenum target, GLenum query)
-{
- GLint k, order=0, majorMinor[2];
-
- /*
- ** Assume target and query are both valid.
- */
- switch (target) {
- case GL_MAP1_COLOR_4:
- case GL_MAP1_NORMAL:
- case GL_MAP1_INDEX:
- case GL_MAP1_TEXTURE_COORD_1:
- case GL_MAP1_TEXTURE_COORD_2:
- case GL_MAP1_TEXTURE_COORD_3:
- case GL_MAP1_TEXTURE_COORD_4:
- case GL_MAP1_VERTEX_3:
- case GL_MAP1_VERTEX_4:
- switch (query) {
- case GL_COEFF:
- k = __glMap1d_size(target);
- CALL_GetMapiv( GET_DISPATCH(), (target, GL_ORDER, &order) );
- /*
- ** The query above might fail, but then order will be zero anyway.
- */
- return order * k;
- case GL_DOMAIN:
- return 2;
- case GL_ORDER:
- return 1;
- }
- break;
- case GL_MAP2_COLOR_4:
- case GL_MAP2_NORMAL:
- case GL_MAP2_INDEX:
- case GL_MAP2_TEXTURE_COORD_1:
- case GL_MAP2_TEXTURE_COORD_2:
- case GL_MAP2_TEXTURE_COORD_3:
- case GL_MAP2_TEXTURE_COORD_4:
- case GL_MAP2_VERTEX_3:
- case GL_MAP2_VERTEX_4:
- switch (query) {
- case GL_COEFF:
- k = __glMap2d_size(target);
- majorMinor[0] = majorMinor[1] = 0;
- CALL_GetMapiv( GET_DISPATCH(), (target, GL_ORDER, majorMinor) );
- /*
- ** The query above might fail, but then majorMinor will be zeroes
- */
- return majorMinor[0] * majorMinor[1] * k;
- case GL_DOMAIN:
- return 4;
- case GL_ORDER:
- return 2;
- }
- break;
- }
- return -1;
-}
-
-GLint __glGetMapdv_size(GLenum target, GLenum query)
-{
- return __glGetMap_size(target, query);
-}
-
-GLint __glGetMapfv_size(GLenum target, GLenum query)
-{
- return __glGetMap_size(target, query);
-}
-
-GLint __glGetMapiv_size(GLenum target, GLenum query)
-{
- return __glGetMap_size(target, query);
-}
-
-GLint __glGetPixelMap_size(GLenum map)
-{
- GLint size;
- GLenum query;
-
- switch (map) {
- case GL_PIXEL_MAP_I_TO_I:
- query = GL_PIXEL_MAP_I_TO_I_SIZE;
- break;
- case GL_PIXEL_MAP_S_TO_S:
- query = GL_PIXEL_MAP_S_TO_S_SIZE;
- break;
- case GL_PIXEL_MAP_I_TO_R:
- query = GL_PIXEL_MAP_I_TO_R_SIZE;
- break;
- case GL_PIXEL_MAP_I_TO_G:
- query = GL_PIXEL_MAP_I_TO_G_SIZE;
- break;
- case GL_PIXEL_MAP_I_TO_B:
- query = GL_PIXEL_MAP_I_TO_B_SIZE;
- break;
- case GL_PIXEL_MAP_I_TO_A:
- query = GL_PIXEL_MAP_I_TO_A_SIZE;
- break;
- case GL_PIXEL_MAP_R_TO_R:
- query = GL_PIXEL_MAP_R_TO_R_SIZE;
- break;
- case GL_PIXEL_MAP_G_TO_G:
- query = GL_PIXEL_MAP_G_TO_G_SIZE;
- break;
- case GL_PIXEL_MAP_B_TO_B:
- query = GL_PIXEL_MAP_B_TO_B_SIZE;
- break;
- case GL_PIXEL_MAP_A_TO_A:
- query = GL_PIXEL_MAP_A_TO_A_SIZE;
- break;
- default:
- return -1;
- }
- CALL_GetIntegerv( GET_DISPATCH(), (query, &size) );
- return size;
-}
-
-GLint __glGetPixelMapfv_size(GLenum map)
-{
- return __glGetPixelMap_size(map);
-}
-
-GLint __glGetPixelMapuiv_size(GLenum map)
-{
- return __glGetPixelMap_size(map);
-}
-
-GLint __glGetPixelMapusv_size(GLenum map)
-{
- return __glGetPixelMap_size(map);
-}
-
-GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format,
- GLenum type, GLint width, GLint height, GLint depth)
-{
- return __glXImageSize( format, type, target, width, height, depth,
- 0, 0, 0, 0, 4 );
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
+#endif
+
+#include <GL/gl.h>
+#include "glxserver.h"
+#include "singlesize.h"
+#include "indirect_size_get.h"
+#include "glapitable.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+
+/*
+** These routines compute the size of variable-size returned parameters.
+** Unlike the similar routines that do the same thing for variable-size
+** incoming parameters, the samplegl library itself doesn't use these routines.
+** Hence, they are located here, in the GLX extension library.
+*/
+
+GLint
+__glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h)
+{
+ return __glXImageSize(format, type, 0, w, h, 1, 0, 0, 0, 0, 4);
+}
+
+GLint
+__glGetMap_size(GLenum target, GLenum query)
+{
+ GLint k, order = 0, majorMinor[2];
+
+ /*
+ ** Assume target and query are both valid.
+ */
+ switch (target) {
+ case GL_MAP1_COLOR_4:
+ case GL_MAP1_NORMAL:
+ case GL_MAP1_INDEX:
+ case GL_MAP1_TEXTURE_COORD_1:
+ case GL_MAP1_TEXTURE_COORD_2:
+ case GL_MAP1_TEXTURE_COORD_3:
+ case GL_MAP1_TEXTURE_COORD_4:
+ case GL_MAP1_VERTEX_3:
+ case GL_MAP1_VERTEX_4:
+ switch (query) {
+ case GL_COEFF:
+ k = __glMap1d_size(target);
+ CALL_GetMapiv(GET_DISPATCH(), (target, GL_ORDER, &order));
+ /*
+ ** The query above might fail, but then order will be zero anyway.
+ */
+ return order * k;
+ case GL_DOMAIN:
+ return 2;
+ case GL_ORDER:
+ return 1;
+ }
+ break;
+ case GL_MAP2_COLOR_4:
+ case GL_MAP2_NORMAL:
+ case GL_MAP2_INDEX:
+ case GL_MAP2_TEXTURE_COORD_1:
+ case GL_MAP2_TEXTURE_COORD_2:
+ case GL_MAP2_TEXTURE_COORD_3:
+ case GL_MAP2_TEXTURE_COORD_4:
+ case GL_MAP2_VERTEX_3:
+ case GL_MAP2_VERTEX_4:
+ switch (query) {
+ case GL_COEFF:
+ k = __glMap2d_size(target);
+ majorMinor[0] = majorMinor[1] = 0;
+ CALL_GetMapiv(GET_DISPATCH(), (target, GL_ORDER, majorMinor));
+ /*
+ ** The query above might fail, but then majorMinor will be zeroes
+ */
+ return majorMinor[0] * majorMinor[1] * k;
+ case GL_DOMAIN:
+ return 4;
+ case GL_ORDER:
+ return 2;
+ }
+ break;
+ }
+ return -1;
+}
+
+GLint
+__glGetMapdv_size(GLenum target, GLenum query)
+{
+ return __glGetMap_size(target, query);
+}
+
+GLint
+__glGetMapfv_size(GLenum target, GLenum query)
+{
+ return __glGetMap_size(target, query);
+}
+
+GLint
+__glGetMapiv_size(GLenum target, GLenum query)
+{
+ return __glGetMap_size(target, query);
+}
+
+GLint
+__glGetPixelMap_size(GLenum map)
+{
+ GLint size;
+ GLenum query;
+
+ switch (map) {
+ case GL_PIXEL_MAP_I_TO_I:
+ query = GL_PIXEL_MAP_I_TO_I_SIZE;
+ break;
+ case GL_PIXEL_MAP_S_TO_S:
+ query = GL_PIXEL_MAP_S_TO_S_SIZE;
+ break;
+ case GL_PIXEL_MAP_I_TO_R:
+ query = GL_PIXEL_MAP_I_TO_R_SIZE;
+ break;
+ case GL_PIXEL_MAP_I_TO_G:
+ query = GL_PIXEL_MAP_I_TO_G_SIZE;
+ break;
+ case GL_PIXEL_MAP_I_TO_B:
+ query = GL_PIXEL_MAP_I_TO_B_SIZE;
+ break;
+ case GL_PIXEL_MAP_I_TO_A:
+ query = GL_PIXEL_MAP_I_TO_A_SIZE;
+ break;
+ case GL_PIXEL_MAP_R_TO_R:
+ query = GL_PIXEL_MAP_R_TO_R_SIZE;
+ break;
+ case GL_PIXEL_MAP_G_TO_G:
+ query = GL_PIXEL_MAP_G_TO_G_SIZE;
+ break;
+ case GL_PIXEL_MAP_B_TO_B:
+ query = GL_PIXEL_MAP_B_TO_B_SIZE;
+ break;
+ case GL_PIXEL_MAP_A_TO_A:
+ query = GL_PIXEL_MAP_A_TO_A_SIZE;
+ break;
+ default:
+ return -1;
+ }
+ CALL_GetIntegerv(GET_DISPATCH(), (query, &size));
+ return size;
+}
+
+GLint
+__glGetPixelMapfv_size(GLenum map)
+{
+ return __glGetPixelMap_size(map);
+}
+
+GLint
+__glGetPixelMapuiv_size(GLenum map)
+{
+ return __glGetPixelMap_size(map);
+}
+
+GLint
+__glGetPixelMapusv_size(GLenum map)
+{
+ return __glGetPixelMap_size(map);
+}
+
+GLint
+__glGetTexImage_size(GLenum target, GLint level, GLenum format,
+ GLenum type, GLint width, GLint height, GLint depth)
+{
+ return __glXImageSize(format, type, target, width, height, depth,
+ 0, 0, 0, 0, 4);
+}
diff --git a/xorg-server/glx/swap_interval.c b/xorg-server/glx/swap_interval.c
index 85da607e4..9879a6cc8 100644
--- a/xorg-server/glx/swap_interval.c
+++ b/xorg-server/glx/swap_interval.c
@@ -43,53 +43,55 @@
#include "dispatch.h"
#include "glxbyteorder.h"
-static int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap);
+static int DoSwapInterval(__GLXclientState * cl, GLbyte * pc, int do_swap);
-int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap)
+int
+DoSwapInterval(__GLXclientState * cl, GLbyte * pc, int do_swap)
{
- xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
+ xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
ClientPtr client = cl->client;
const GLXContextTag tag = req->contextTag;
__GLXcontext *cx;
GLint interval;
-
cx = __glXLookupContextByTag(cl, tag);
if ((cx == NULL) || (cx->pGlxScreen == NULL)) {
- client->errorValue = tag;
- return __glXError(GLXBadContext);
+ client->errorValue = tag;
+ return __glXError(GLXBadContext);
}
-
+
if (cx->pGlxScreen->swapInterval == NULL) {
- LogMessage(X_ERROR, "AIGLX: cx->pGlxScreen->swapInterval == NULL\n");
- client->errorValue = tag;
- return __glXError(GLXUnsupportedPrivateRequest);
+ LogMessage(X_ERROR, "AIGLX: cx->pGlxScreen->swapInterval == NULL\n");
+ client->errorValue = tag;
+ return __glXError(GLXUnsupportedPrivateRequest);
}
if (cx->drawPriv == NULL) {
- client->errorValue = tag;
- return BadValue;
+ client->errorValue = tag;
+ return BadValue;
}
-
+
pc += __GLX_VENDPRIV_HDR_SIZE;
interval = (do_swap)
- ? bswap_32(*(int *)(pc + 0))
- : *(int *)(pc + 0);
+ ? bswap_32(*(int *) (pc + 0))
+ : *(int *) (pc + 0);
if (interval <= 0)
- return BadValue;
+ return BadValue;
- (void) (*cx->pGlxScreen->swapInterval)(cx->drawPriv, interval);
+ (void) (*cx->pGlxScreen->swapInterval) (cx->drawPriv, interval);
return Success;
}
-int __glXDisp_SwapIntervalSGI(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_SwapIntervalSGI(__GLXclientState * cl, GLbyte * pc)
{
return DoSwapInterval(cl, pc, 0);
}
-int __glXDispSwap_SwapIntervalSGI(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDispSwap_SwapIntervalSGI(__GLXclientState * cl, GLbyte * pc)
{
return DoSwapInterval(cl, pc, 1);
}
diff --git a/xorg-server/glx/xfont.c b/xorg-server/glx/xfont.c
index dde0d14b5..47ddf8f7c 100644
--- a/xorg-server/glx/xfont.c
+++ b/xorg-server/glx/xfont.c
@@ -52,16 +52,18 @@
/*
** Make a single GL bitmap from a single X glyph
*/
-static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
+static int
+__glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
{
int i, j;
- int widthPadded; /* width of glyph in bytes, as padded by X */
- int allocBytes; /* bytes to allocate to store bitmap */
- int w; /* width of glyph in bits */
- int h; /* height of glyph */
+ int widthPadded; /* width of glyph in bytes, as padded by X */
+ int allocBytes; /* bytes to allocate to store bitmap */
+ int w; /* width of glyph in bits */
+ int h; /* height of glyph */
register unsigned char *pglyph;
register unsigned char *p;
unsigned char *allocbuf;
+
#define __GL_CHAR_BUF_SIZE 2048
unsigned char buf[__GL_CHAR_BUF_SIZE];
@@ -70,35 +72,36 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
widthPadded = GLYPHWIDTHBYTESPADDED(pci);
/*
- ** Use the local buf if possible, otherwise malloc.
- */
+ ** Use the local buf if possible, otherwise malloc.
+ */
allocBytes = widthPadded * h;
if (allocBytes <= __GL_CHAR_BUF_SIZE) {
- p = buf;
- allocbuf = 0;
- } else {
- p = (unsigned char *) malloc(allocBytes);
- if (!p)
- return BadAlloc;
- allocbuf = p;
+ p = buf;
+ allocbuf = 0;
+ }
+ else {
+ p = (unsigned char *) malloc(allocBytes);
+ if (!p)
+ return BadAlloc;
+ allocbuf = p;
}
/*
- ** We have to reverse the picture, top to bottom
- */
-
- pglyph = FONTGLYPHBITS(FONTGLYPHS(font), pci) + (h-1)*widthPadded;
- for (j=0; j < h; j++) {
- for (i=0; i < widthPadded; i++) {
- p[i] = pglyph[i];
- }
- pglyph -= widthPadded;
- p += widthPadded;
+ ** We have to reverse the picture, top to bottom
+ */
+
+ pglyph = FONTGLYPHBITS(FONTGLYPHS(font), pci) + (h - 1) * widthPadded;
+ for (j = 0; j < h; j++) {
+ for (i = 0; i < widthPadded; i++) {
+ p[i] = pglyph[i];
+ }
+ pglyph -= widthPadded;
+ p += widthPadded;
}
- CALL_Bitmap( GET_DISPATCH(), (w, h, -pci->metrics.leftSideBearing,
- pci->metrics.descent,
- pci->metrics.characterWidth, 0,
- allocbuf ? allocbuf : buf) );
+ CALL_Bitmap(GET_DISPATCH(), (w, h, -pci->metrics.leftSideBearing,
+ pci->metrics.descent,
+ pci->metrics.characterWidth, 0,
+ allocbuf ? allocbuf : buf));
free(allocbuf);
return Success;
@@ -110,46 +113,48 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
** in a display list.
*/
-static int
+static int
MakeBitmapsFromFont(FontPtr pFont, int first, int count, int list_base)
{
- unsigned long i, nglyphs;
- CARD8 chs[2]; /* the font index we are going after */
- CharInfoPtr pci;
- int rv; /* return value */
+ unsigned long i, nglyphs;
+ CARD8 chs[2]; /* the font index we are going after */
+ CharInfoPtr pci;
+ int rv; /* return value */
int encoding = (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit;
-
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, FALSE) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, BITMAP_BIT_ORDER == LSBFirst) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, 0) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) );
- CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, GLYPHPADBYTES) );
- for (i=0; i < count; i++) {
- chs[0] = (first + i) >> 8; /* high byte is first byte */
- chs[1] = first + i;
-
- (*pFont->get_glyphs)(pFont, 1, chs, (FontEncoding)encoding,
- &nglyphs, &pci);
-
- /*
- ** Define a display list containing just a glBitmap() call.
- */
- CALL_NewList( GET_DISPATCH(), (list_base + i, GL_COMPILE) );
- if (nglyphs ) {
- rv = __glXMakeBitmapFromGlyph(pFont, pci);
- if (rv) {
- return rv;
- }
- }
- CALL_EndList( GET_DISPATCH(), () );
+
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, FALSE));
+ CALL_PixelStorei(GET_DISPATCH(),
+ (GL_UNPACK_LSB_FIRST, BITMAP_BIT_ORDER == LSBFirst));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, 0));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, GLYPHPADBYTES));
+ for (i = 0; i < count; i++) {
+ chs[0] = (first + i) >> 8; /* high byte is first byte */
+ chs[1] = first + i;
+
+ (*pFont->get_glyphs) (pFont, 1, chs, (FontEncoding) encoding,
+ &nglyphs, &pci);
+
+ /*
+ ** Define a display list containing just a glBitmap() call.
+ */
+ CALL_NewList(GET_DISPATCH(), (list_base + i, GL_COMPILE));
+ if (nglyphs) {
+ rv = __glXMakeBitmapFromGlyph(pFont, pci);
+ if (rv) {
+ return rv;
+ }
+ }
+ CALL_EndList(GET_DISPATCH(), ());
}
return Success;
}
/************************************************************************/
-int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_UseXFont(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXUseXFontReq *req;
@@ -163,28 +168,28 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
req = (xGLXUseXFontReq *) pc;
cx = __glXForceCurrent(cl, req->contextTag, &error);
if (!cx) {
- return error;
+ return error;
}
- CALL_GetIntegerv( GET_DISPATCH(), (GL_LIST_INDEX, (GLint*) &currentListIndex) );
+ CALL_GetIntegerv(GET_DISPATCH(),
+ (GL_LIST_INDEX, (GLint *) & currentListIndex));
if (currentListIndex != 0) {
- /*
- ** A display list is currently being made. It is an error
- ** to try to make a font during another lists construction.
- */
- client->errorValue = cx->id;
- return __glXError(GLXBadContextState);
+ /*
+ ** A display list is currently being made. It is an error
+ ** to try to make a font during another lists construction.
+ */
+ client->errorValue = cx->id;
+ return __glXError(GLXBadContextState);
}
/*
- ** Font can actually be either the ID of a font or the ID of a GC
- ** containing a font.
- */
+ ** Font can actually be either the ID of a font or the ID of a GC
+ ** containing a font.
+ */
error = dixLookupFontable(&pFont, req->font, client, DixReadAccess);
if (error != Success)
- return error;
+ return error;
- return MakeBitmapsFromFont(pFont, req->first, req->count,
- req->listBase);
+ return MakeBitmapsFromFont(pFont, req->first, req->count, req->listBase);
}
diff --git a/xorg-server/hw/dmx/config/Canvas.c b/xorg-server/hw/dmx/config/Canvas.c
index c2eba876a..34a47a2bf 100644
--- a/xorg-server/hw/dmx/config/Canvas.c
+++ b/xorg-server/hw/dmx/config/Canvas.c
@@ -60,100 +60,106 @@
#include <X11/StringDefs.h>
#include "CanvasP.h"
-static void CanvasInitialize(Widget request, Widget w,
- ArgList args, Cardinal *num_args)
+static void
+CanvasInitialize(Widget request, Widget w, ArgList args, Cardinal * num_args)
{
}
-static void CanvasExpose(Widget w, XEvent *event, Region region)
+static void
+CanvasExpose(Widget w, XEvent * event, Region region)
{
CanvasExposeDataRec data;
- data.w = w;
- data.event = event;
+ data.w = w;
+ data.event = event;
data.region = region;
-
- if (!XtIsRealized(w)) return;
- XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer)&data);
+
+ if (!XtIsRealized(w))
+ return;
+ XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer) & data);
}
-static void CanvasResize(Widget w)
+static void
+CanvasResize(Widget w)
{
- if (!XtIsRealized(w)) return;
- XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer)w);
+ if (!XtIsRealized(w))
+ return;
+ XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer) w);
}
-static void CanvasAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
+static void
+CanvasAction(Widget w, XEvent * event, String * params, Cardinal * num_params)
{
- XtCallCallbacks(w, XtNcallback, (XtPointer)event);
+ XtCallCallbacks(w, XtNcallback, (XtPointer) event);
}
#define offset(field) XtOffsetOf(CanvasRec, canvas.field)
static XtResource resources[] = {
- { XtNcallback, XtCCallback, XtRCallback,
- sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL },
- { XtNcanvasExposeCallback, XtCcanvasExposeCallback, XtRCallback,
- sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL },
- { XtNcanvasResizeCallback, XtCcanvasResizeCallback, XtRCallback,
- sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL },
+ {XtNcallback, XtCCallback, XtRCallback,
+ sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL}
+ ,
+ {XtNcanvasExposeCallback, XtCcanvasExposeCallback, XtRCallback,
+ sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL}
+ ,
+ {XtNcanvasResizeCallback, XtCcanvasResizeCallback, XtRCallback,
+ sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL}
+ ,
};
+
#undef offset
-static XtActionsRec actions[] =
-{
- {"canvas", CanvasAction},
+static XtActionsRec actions[] = {
+ {"canvas", CanvasAction},
};
-static char translations[] =
-"<Key>: canvas()\n\
+static char translations[] = "<Key>: canvas()\n\
<Motion>: canvas()\n\
<BtnDown>: canvas()\n\
<BtnUp>: canvas()\n\
-"
-;
+";
#define Superclass (&widgetClassRec)
CanvasClassRec canvasClassRec = {
/* core */
{
- (WidgetClass)Superclass, /* superclass */
- "Canvas", /* class_name */
- sizeof(CanvasRec), /* widget_size */
- NULL, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- CanvasInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- actions, /* actions */
- XtNumber(actions), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- CanvasResize, /* resize */
- CanvasExpose, /* expose */
- NULL, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- translations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
+ (WidgetClass) Superclass, /* superclass */
+ "Canvas", /* class_name */
+ sizeof(CanvasRec), /* widget_size */
+ NULL, /* class_initialize */
+ NULL, /* class_part_initialize */
+ False, /* class_inited */
+ CanvasInitialize, /* initialize */
+ NULL, /* initialize_hook */
+ XtInheritRealize, /* realize */
+ actions, /* actions */
+ XtNumber(actions), /* num_actions */
+ resources, /* resources */
+ XtNumber(resources), /* num_resources */
+ NULLQUARK, /* xrm_class */
+ True, /* compress_motion */
+ True, /* compress_exposure */
+ True, /* compress_enterleave */
+ False, /* visible_interest */
+ NULL, /* destroy */
+ CanvasResize, /* resize */
+ CanvasExpose, /* expose */
+ NULL, /* set_values */
+ NULL, /* set_values_hook */
+ XtInheritSetValuesAlmost, /* set_values_almost */
+ NULL, /* get_values_hook */
+ NULL, /* accept_focus */
+ XtVersion, /* version */
+ NULL, /* callback_private */
+ translations, /* tm_table */
+ XtInheritQueryGeometry, /* query_geometry */
+ XtInheritDisplayAccelerator, /* display_accelerator */
+ NULL, /* extension */
+ }
+ ,
/* canvas */
{
- NULL, /* extension */
- }
+ NULL, /* extension */
+ }
};
-WidgetClass canvasWidgetClass = (WidgetClass)&canvasClassRec;
+WidgetClass canvasWidgetClass = (WidgetClass) & canvasClassRec;
diff --git a/xorg-server/hw/dmx/config/dmxcompat.c b/xorg-server/hw/dmx/config/dmxcompat.c
index 1c72084fa..bd9f12738 100644
--- a/xorg-server/hw/dmx/config/dmxcompat.c
+++ b/xorg-server/hw/dmx/config/dmxcompat.c
@@ -52,80 +52,84 @@
#include <string.h>
#include <ctype.h>
-static int dmxVDLReadLine(FILE *str, char *buf, int len)
+static int
+dmxVDLReadLine(FILE * str, char *buf, int len)
{
- if (fgets(buf, len, str)) return strlen(buf);
+ if (fgets(buf, len, str))
+ return strlen(buf);
return 0;
}
-static int dmxVDLCount(const char *buf)
+static int
+dmxVDLCount(const char *buf)
{
return strtol(buf, NULL, 10);
}
-static void dmxVDLVirtualEntry(const char *buf,
- char *name, int *len,
- int *x, int *y)
+static void
+dmxVDLVirtualEntry(const char *buf, char *name, int *len, int *x, int *y)
{
- char *end;
+ char *end;
const char *s;
- char *d;
- int start;
-
+ char *d;
+ int start;
+
*x = strtol(buf, &end, 10);
*y = strtol(end, &end, 10);
for (s = end, d = name, start = 1; *s && *s != '['; ++s) {
- if (start && isspace(*s)) continue;
- *d++ = *s;
+ if (start && isspace(*s))
+ continue;
+ *d++ = *s;
start = 0;
}
*d = '\0';
- while (d > name && isspace(d[-1])) *--d = '\0'; /* remove trailing space */
+ while (d > name && isspace(d[-1]))
+ *--d = '\0'; /* remove trailing space */
*len = strlen(name);
}
-static void dmxVDLDisplayEntry(const char *buf,
- char *name, int *len,
- int *x, int *y,
- int *xoff, int *yoff,
- int *xorig, int *yorig)
+static void
+dmxVDLDisplayEntry(const char *buf,
+ char *name, int *len,
+ int *x, int *y, int *xoff, int *yoff, int *xorig, int *yorig)
{
const char *pt;
- char *end;
-
- pt = strchr(buf, ' ');
- strlcpy(name, buf, 1+pt-buf);
- *len = strlen(name);
-
- *x = strtol(pt, &end, 10);
- *y = strtol(end, &end, 10);
+ char *end;
+
+ pt = strchr(buf, ' ');
+ strlcpy(name, buf, 1 + pt - buf);
+ *len = strlen(name);
+
+ *x = strtol(pt, &end, 10);
+ *y = strtol(end, &end, 10);
*xorig = strtol(end, &end, 10);
*yorig = strtol(end, &end, 10);
- *xoff = strtol(end, &end, 10);
- *yoff = strtol(end, NULL, 10);
+ *xoff = strtol(end, &end, 10);
+ *yoff = strtol(end, NULL, 10);
}
/** Read from the VDL format \a filename and return a newly allocated \a
* DMXConfigEntryPtr */
-DMXConfigEntryPtr dmxVDLRead(const char *filename)
+DMXConfigEntryPtr
+dmxVDLRead(const char *filename)
{
- FILE *str;
- char buf[2048]; /* RATS: Use ok */
- char *pt;
- int lineno = 0;
- DMXConfigEntryPtr entry = NULL;
+ FILE *str;
+ char buf[2048]; /* RATS: Use ok */
+ char *pt;
+ int lineno = 0;
+ DMXConfigEntryPtr entry = NULL;
DMXConfigVirtualPtr virtual = NULL;
- DMXConfigSubPtr sub = NULL;
+ DMXConfigSubPtr sub = NULL;
DMXConfigDisplayPtr display = NULL;
- DMXConfigFullDimPtr fdim = NULL;
- int vcount = 0;
- int dcount = 0;
- int icount = 0;
- int x, y, xoff, yoff, xorig, yorig;
- char name[2048]; /* RATS: Use ok */
- const char *tmp;
- int len;
+ DMXConfigFullDimPtr fdim = NULL;
+ int vcount = 0;
+ int dcount = 0;
+ int icount = 0;
+ int x, y, xoff, yoff, xorig, yorig;
+ char name[2048]; /* RATS: Use ok */
+ const char *tmp;
+ int len;
enum {
simulateFlag,
virtualCount,
@@ -134,15 +138,18 @@ DMXConfigEntryPtr dmxVDLRead(const char *filename)
displayEntry,
ignoreCount,
ignoreEntry
- } state = simulateFlag;
+ } state = simulateFlag;
- if (!filename) str = stdin;
- else str = fopen(filename, "r");
- if (!str) return NULL;
+ if (!filename)
+ str = stdin;
+ else
+ str = fopen(filename, "r");
+ if (!str)
+ return NULL;
while (dmxVDLReadLine(str, buf, sizeof(buf))) {
DMXConfigCommentPtr comment = NULL;
-
+
++lineno;
for (pt = buf; *pt; pt++)
if (*pt == '\r' || *pt == '\n') {
@@ -166,7 +173,7 @@ DMXConfigEntryPtr dmxVDLRead(const char *filename)
case virtualEntry:
len = sizeof(name);
dmxVDLVirtualEntry(buf, name, &len, &x, &y);
- tmp = dmxConfigCopyString(name, len);
+ tmp = dmxConfigCopyString(name, len);
virtual = dmxConfigCreateVirtual(NULL,
dmxConfigCreateString(T_STRING,
lineno,
@@ -186,41 +193,29 @@ DMXConfigEntryPtr dmxVDLRead(const char *filename)
case displayEntry:
dmxVDLDisplayEntry(buf, name, &len, &x, &y, &xoff, &yoff,
&xorig, &yorig);
- tmp = dmxConfigCopyString(name, len);
- fdim = dmxConfigCreateFullDim(
- dmxConfigCreatePartDim(
- dmxConfigCreatePair(T_DIMENSION,
- lineno,
- NULL,
- x, y, 0, 0),
- dmxConfigCreatePair(T_OFFSET,
- lineno,
- NULL,
- xoff, yoff,
- xoff, yoff)),
- NULL);
- display = dmxConfigCreateDisplay(NULL,
- dmxConfigCreateString(T_STRING,
- lineno,
- NULL,
- tmp),
- fdim,
- dmxConfigCreatePair(T_ORIGIN,
- lineno,
- NULL,
- xorig, yorig,
- 0, 0),
- NULL);
+ tmp = dmxConfigCopyString(name, len);
+ fdim =
+ dmxConfigCreateFullDim(dmxConfigCreatePartDim
+ (dmxConfigCreatePair
+ (T_DIMENSION, lineno, NULL, x, y, 0, 0),
+ dmxConfigCreatePair(T_OFFSET, lineno,
+ NULL, xoff, yoff,
+ xoff, yoff)), NULL);
+ display =
+ dmxConfigCreateDisplay(NULL,
+ dmxConfigCreateString(T_STRING, lineno,
+ NULL, tmp), fdim,
+ dmxConfigCreatePair(T_ORIGIN, lineno,
+ NULL, xorig, yorig,
+ 0, 0), NULL);
sub = dmxConfigAddSub(sub, dmxConfigSubDisplay(display));
if (!--dcount) {
- state = ignoreCount;
+ state = ignoreCount;
virtual->subentry = sub;
- entry = dmxConfigAddEntry(entry,
- dmxConfigVirtual,
- NULL,
- virtual);
- virtual = NULL;
- sub = NULL;
+ entry = dmxConfigAddEntry(entry,
+ dmxConfigVirtual, NULL, virtual);
+ virtual = NULL;
+ sub = NULL;
}
break;
case ignoreCount:
@@ -228,7 +223,8 @@ DMXConfigEntryPtr dmxVDLRead(const char *filename)
state = ignoreEntry;
break;
case ignoreEntry:
- if (!--icount) state = virtualEntry;
+ if (!--icount)
+ state = virtualEntry;
break;
}
}
diff --git a/xorg-server/hw/dmx/config/dmxconfig.c b/xorg-server/hw/dmx/config/dmxconfig.c
index a31e5f7f7..2cc9ab396 100644
--- a/xorg-server/hw/dmx/config/dmxconfig.c
+++ b/xorg-server/hw/dmx/config/dmxconfig.c
@@ -34,7 +34,6 @@
/** \file
* Provides interface for reading DMX configuration files and for
* combining that information with command-line configuration parameters. */
-
#ifdef HAVE_DMX_CONFIG_H
#include <dmx-config.h>
@@ -49,7 +48,7 @@
#include "dmxstat.h"
#include "parser.h"
-extern int yyparse(void);
+extern int yyparse(void);
extern FILE *yyin;
static char *dmxXkbRules;
@@ -60,35 +59,39 @@ static char *dmxXkbOptions;
/** Stores lists of configuration information. */
typedef struct DMXConfigListStruct {
- const char *name;
+ const char *name;
struct DMXConfigListStruct *next;
} DMXConfigList, *DMXConfigListPtr;
/** This stucture stores the parsed configuration information. */
typedef struct DMXConfigCmdStruct {
- const char *filename;
- const char *config;
+ const char *filename;
+ const char *config;
DMXConfigList *displays;
DMXConfigList *inputs;
DMXConfigList *xinputs;
} DMXConfigCmd, *DMXConfigCmdPtr;
-DMXConfigEntryPtr dmxConfigEntry;
-static DMXConfigCmd dmxConfigCmd;
+DMXConfigEntryPtr dmxConfigEntry;
+static DMXConfigCmd dmxConfigCmd;
static int dmxDisplaysFromCommandLine;
/** Make a note that \a display is the name of an X11 display that
* should be initialized as a backend (output) display. Called from
* #ddxProcessArgument. */
-void dmxConfigStoreDisplay(const char *display)
+void
+dmxConfigStoreDisplay(const char *display)
{
DMXConfigListPtr entry = malloc(sizeof(*entry));
+
entry->name = strdup(display);
entry->next = NULL;
- if (!dmxConfigCmd.displays) dmxConfigCmd.displays = entry;
+ if (!dmxConfigCmd.displays)
+ dmxConfigCmd.displays = entry;
else {
DMXConfigList *pt;
+
for (pt = dmxConfigCmd.displays; pt->next; pt = pt->next);
if (!pt)
dmxLog(dmxFatal, "dmxConfigStoreDisplay: end of list non-NULL\n");
@@ -99,14 +102,18 @@ void dmxConfigStoreDisplay(const char *display)
/** Make a note that \a input is the name of an X11 display that should
* be used for input (either a backend or a console input device). */
-void dmxConfigStoreInput(const char *input)
+void
+dmxConfigStoreInput(const char *input)
{
DMXConfigListPtr entry = malloc(sizeof(*entry));
+
entry->name = strdup(input);
entry->next = NULL;
- if (!dmxConfigCmd.inputs) dmxConfigCmd.inputs = entry;
+ if (!dmxConfigCmd.inputs)
+ dmxConfigCmd.inputs = entry;
else {
DMXConfigList *pt;
+
for (pt = dmxConfigCmd.inputs; pt->next; pt = pt->next);
if (!pt)
dmxLog(dmxFatal, "dmxConfigStoreInput: end of list non-NULL\n");
@@ -116,14 +123,18 @@ void dmxConfigStoreInput(const char *input)
/** Make a note that \a input is the name of an X11 display that should
* be used for input from XInput extension devices. */
-void dmxConfigStoreXInput(const char *input)
+void
+dmxConfigStoreXInput(const char *input)
{
DMXConfigListPtr entry = malloc(sizeof(*entry));
+
entry->name = strdup(input);
entry->next = NULL;
- if (!dmxConfigCmd.xinputs) dmxConfigCmd.xinputs = entry;
+ if (!dmxConfigCmd.xinputs)
+ dmxConfigCmd.xinputs = entry;
else {
DMXConfigList *pt;
+
for (pt = dmxConfigCmd.xinputs; pt->next; pt = pt->next);
if (!pt)
dmxLog(dmxFatal, "dmxConfigStoreXInput: end of list non-NULL\n");
@@ -132,7 +143,8 @@ void dmxConfigStoreXInput(const char *input)
}
/** Make a note that \a file is the configuration file. */
-void dmxConfigStoreFile(const char *file)
+void
+dmxConfigStoreFile(const char *file)
{
if (dmxConfigCmd.filename)
dmxLog(dmxFatal, "Only one -configfile allowed\n");
@@ -141,79 +153,89 @@ void dmxConfigStoreFile(const char *file)
/** Make a note that \a config should be used as the configuration for
* current instantiation of the DMX server. */
-void dmxConfigStoreConfig(const char *config)
+void
+dmxConfigStoreConfig(const char *config)
{
- if (dmxConfigCmd.config) dmxLog(dmxFatal, "Only one -config allowed\n");
+ if (dmxConfigCmd.config)
+ dmxLog(dmxFatal, "Only one -config allowed\n");
dmxConfigCmd.config = strdup(config);
}
-static int dmxConfigReadFile(const char *filename, int debug)
+static int
+dmxConfigReadFile(const char *filename, int debug)
{
FILE *str;
- if (!(str = fopen(filename, "r"))) return -1;
+ if (!(str = fopen(filename, "r")))
+ return -1;
dmxLog(dmxInfo, "Reading configuration file \"%s\"\n", filename);
- yyin = str;
+ yyin = str;
yydebug = debug;
yyparse();
fclose(str);
return 0;
}
-static const char *dmxConfigMatch(const char *target, DMXConfigEntryPtr entry)
+static const char *
+dmxConfigMatch(const char *target, DMXConfigEntryPtr entry)
{
- DMXConfigVirtualPtr v = entry->virtual;
- const char *name = NULL;
-
- if (v && v->name) name = v->name;
-
- if (v && !dmxConfigCmd.config) return v->name ? v->name : "<noname>";
- if (!name) return NULL;
- if (!strcmp(name, target)) return name;
+ DMXConfigVirtualPtr v = entry->virtual;
+ const char *name = NULL;
+
+ if (v && v->name)
+ name = v->name;
+
+ if (v && !dmxConfigCmd.config)
+ return v->name ? v->name : "<noname>";
+ if (!name)
+ return NULL;
+ if (!strcmp(name, target))
+ return name;
return NULL;
}
-static DMXScreenInfo *dmxConfigAddDisplay(const char *name,
- int scrnWidth, int scrnHeight,
- int scrnX, int scrnY,
- int scrnXSign, int scrnYSign,
- int rootWidth, int rootHeight,
- int rootX, int rootY,
- int rootXSign, int rootYSign)
+static DMXScreenInfo *
+dmxConfigAddDisplay(const char *name,
+ int scrnWidth, int scrnHeight,
+ int scrnX, int scrnY,
+ int scrnXSign, int scrnYSign,
+ int rootWidth, int rootHeight,
+ int rootX, int rootY, int rootXSign, int rootYSign)
{
DMXScreenInfo *dmxScreen;
-
+
if (!(dmxScreens = realloc(dmxScreens,
- (dmxNumScreens+1) * sizeof(*dmxScreens))))
+ (dmxNumScreens + 1) * sizeof(*dmxScreens))))
dmxLog(dmxFatal,
"dmxConfigAddDisplay: realloc failed for screen %d (%s)\n",
dmxNumScreens, name);
-
+
dmxScreen = &dmxScreens[dmxNumScreens];
memset(dmxScreen, 0, sizeof(*dmxScreen));
- dmxScreen->name = name;
- dmxScreen->index = dmxNumScreens;
- dmxScreen->scrnWidth = scrnWidth;
+ dmxScreen->name = name;
+ dmxScreen->index = dmxNumScreens;
+ dmxScreen->scrnWidth = scrnWidth;
dmxScreen->scrnHeight = scrnHeight;
- dmxScreen->scrnX = scrnX;
- dmxScreen->scrnY = scrnY;
- dmxScreen->scrnXSign = scrnXSign;
- dmxScreen->scrnYSign = scrnYSign;
- dmxScreen->rootWidth = rootWidth;
+ dmxScreen->scrnX = scrnX;
+ dmxScreen->scrnY = scrnY;
+ dmxScreen->scrnXSign = scrnXSign;
+ dmxScreen->scrnYSign = scrnYSign;
+ dmxScreen->rootWidth = rootWidth;
dmxScreen->rootHeight = rootHeight;
- dmxScreen->rootX = rootX;
- dmxScreen->rootY = rootY;
- dmxScreen->stat = dmxStatAlloc();
+ dmxScreen->rootX = rootX;
+ dmxScreen->rootY = rootY;
+ dmxScreen->stat = dmxStatAlloc();
++dmxNumScreens;
return dmxScreen;
}
-DMXInputInfo *dmxConfigAddInput(const char *name, int core)
+DMXInputInfo *
+dmxConfigAddInput(const char *name, int core)
{
DMXInputInfo *dmxInput;
if (!(dmxInputs = realloc(dmxInputs,
- (dmxNumInputs+1) * sizeof(*dmxInputs))))
+ (dmxNumInputs + 1) * sizeof(*dmxInputs))))
dmxLog(dmxFatal,
"dmxConfigAddInput: realloc failed for input %d (%s)\n",
dmxNumInputs, name);
@@ -221,71 +243,79 @@ DMXInputInfo *dmxConfigAddInput(const char *name, int core)
dmxInput = &dmxInputs[dmxNumInputs];
memset(dmxInput, 0, sizeof(*dmxInput));
- dmxInput->name = name;
+ dmxInput->name = name;
dmxInput->inputIdx = dmxNumInputs;
- dmxInput->scrnIdx = -1;
- dmxInput->core = core;
+ dmxInput->scrnIdx = -1;
+ dmxInput->core = core;
++dmxNumInputs;
return dmxInput;
}
-static void dmxConfigCopyFromDisplay(DMXConfigDisplayPtr d)
+static void
+dmxConfigCopyFromDisplay(DMXConfigDisplayPtr d)
{
DMXScreenInfo *dmxScreen;
- dmxScreen = dmxConfigAddDisplay(d->name,
- d->scrnWidth, d->scrnHeight,
- d->scrnX, d->scrnY,
- d->scrnXSign, d->scrnYSign,
- d->rootWidth, d->rootHeight,
- d->rootX, d->rootY,
- d->rootXSign, d->rootXSign);
- dmxScreen->where = PosAbsolute;
+ dmxScreen = dmxConfigAddDisplay(d->name,
+ d->scrnWidth, d->scrnHeight,
+ d->scrnX, d->scrnY,
+ d->scrnXSign, d->scrnYSign,
+ d->rootWidth, d->rootHeight,
+ d->rootX, d->rootY,
+ d->rootXSign, d->rootXSign);
+ dmxScreen->where = PosAbsolute;
dmxScreen->whereX = d->rootXOrigin;
dmxScreen->whereY = d->rootYOrigin;
}
-static void dmxConfigCopyFromWall(DMXConfigWallPtr w)
+static void
+dmxConfigCopyFromWall(DMXConfigWallPtr w)
{
DMXConfigStringPtr pt;
- DMXScreenInfo *dmxScreen;
- int edge = dmxNumScreens;
- int last = dmxNumScreens;
+ DMXScreenInfo *dmxScreen;
+ int edge = dmxNumScreens;
+ int last = dmxNumScreens;
- if (!w->xwall && !w->ywall) { /* Try to make it square */
+ if (!w->xwall && !w->ywall) { /* Try to make it square */
int count;
- for (pt = w->nameList, count = 0; pt; pt = pt->next) ++count;
+
+ for (pt = w->nameList, count = 0; pt; pt = pt->next)
+ ++count;
w->xwall = sqrt(count) + .5;
}
for (pt = w->nameList; pt; pt = pt->next) {
dmxScreen = dmxConfigAddDisplay(pt->string, w->width, w->height,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
- if (pt == w->nameList) { /* Upper left */
- dmxScreen->where = PosAbsolute;
+ if (pt == w->nameList) { /* Upper left */
+ dmxScreen->where = PosAbsolute;
dmxScreen->whereX = 0;
dmxScreen->whereY = 0;
- } else if (w->xwall) { /* Tile left to right, then top to bottom */
- if (!((dmxNumScreens-1) % w->xwall)) {
- dmxScreen->where = PosBelow;
+ }
+ else if (w->xwall) { /* Tile left to right, then top to bottom */
+ if (!((dmxNumScreens - 1) % w->xwall)) {
+ dmxScreen->where = PosBelow;
dmxScreen->whereRefScreen = edge;
- edge = dmxNumScreens-1;
- } else {
- dmxScreen->where = PosRightOf;
+ edge = dmxNumScreens - 1;
+ }
+ else {
+ dmxScreen->where = PosRightOf;
dmxScreen->whereRefScreen = last;
}
- } else { /* Tile top to bottom, then left to right */
- if (!((dmxNumScreens-1) % w->ywall)) {
- dmxScreen->where = PosRightOf;
+ }
+ else { /* Tile top to bottom, then left to right */
+ if (!((dmxNumScreens - 1) % w->ywall)) {
+ dmxScreen->where = PosRightOf;
dmxScreen->whereRefScreen = edge;
- edge = dmxNumScreens-1;
- } else {
- dmxScreen->where = PosBelow;
+ edge = dmxNumScreens - 1;
+ }
+ else {
+ dmxScreen->where = PosBelow;
dmxScreen->whereRefScreen = last;
}
}
- last = dmxNumScreens-1;
+ last = dmxNumScreens - 1;
if (dmxScreen->where == PosAbsolute)
dmxLog(dmxInfo, "Added %s at %d %d\n",
pt->string, dmxScreen->whereX, dmxScreen->whereY);
@@ -297,60 +327,79 @@ static void dmxConfigCopyFromWall(DMXConfigWallPtr w)
}
}
-static void dmxConfigCopyFromOption(DMXConfigOptionPtr o)
+static void
+dmxConfigCopyFromOption(DMXConfigOptionPtr o)
{
DMXConfigStringPtr pt;
- int argc = 0;
- char **argv = NULL;
+ int argc = 0;
+ char **argv = NULL;
- if (serverGeneration != 1) return; /* FIXME: only do once, for now */
- if (!o || !o->string) return;
+ if (serverGeneration != 1)
+ return; /* FIXME: only do once, for now */
+ if (!o || !o->string)
+ return;
for (pt = o->option; pt; pt = pt->next) {
if (pt->string) {
++argc;
- argv = realloc(argv, (argc+1) * sizeof(*argv));
- argv[argc] = (char *)pt->string;
+ argv = realloc(argv, (argc + 1) * sizeof(*argv));
+ argv[argc] = (char *) pt->string;
}
}
argv[0] = NULL;
- ProcessCommandLine(argc+1, argv);
+ ProcessCommandLine(argc + 1, argv);
free(argv);
}
-static void dmxConfigCopyFromParam(DMXConfigParamPtr p)
+static void
+dmxConfigCopyFromParam(DMXConfigParamPtr p)
{
const char **argv;
- int argc;
-
+ int argc;
+
if ((argv = dmxConfigLookupParam(p, "xkbrules", &argc)) && argc == 2) {
dmxConfigSetXkbRules(argv[1]);
- } else if ((argv = dmxConfigLookupParam(p, "xkbmodel", &argc))
- && argc == 2) {
+ }
+ else if ((argv = dmxConfigLookupParam(p, "xkbmodel", &argc))
+ && argc == 2) {
dmxConfigSetXkbModel(argv[1]);
- } else if ((argv = dmxConfigLookupParam(p, "xkblayout", &argc))
- && argc == 2) {
+ }
+ else if ((argv = dmxConfigLookupParam(p, "xkblayout", &argc))
+ && argc == 2) {
dmxConfigSetXkbLayout(argv[1]);
- } else if ((argv = dmxConfigLookupParam(p, "xkbvariant", &argc))
- && argc == 2) {
+ }
+ else if ((argv = dmxConfigLookupParam(p, "xkbvariant", &argc))
+ && argc == 2) {
dmxConfigSetXkbVariant(argv[1]);
- } else if ((argv = dmxConfigLookupParam(p, "xkboptions", &argc))
- && argc == 2) {
+ }
+ else if ((argv = dmxConfigLookupParam(p, "xkboptions", &argc))
+ && argc == 2) {
dmxConfigSetXkbOptions(argv[1]);
}
}
-static void dmxConfigCopyData(DMXConfigVirtualPtr v)
+static void
+dmxConfigCopyData(DMXConfigVirtualPtr v)
{
DMXConfigSubPtr sub;
-
- if (v->dim) dmxSetWidthHeight(v->dim->x, v->dim->y);
- else dmxSetWidthHeight(0, 0);
+
+ if (v->dim)
+ dmxSetWidthHeight(v->dim->x, v->dim->y);
+ else
+ dmxSetWidthHeight(0, 0);
for (sub = v->subentry; sub; sub = sub->next) {
switch (sub->type) {
- case dmxConfigDisplay: dmxConfigCopyFromDisplay(sub->display); break;
- case dmxConfigWall: dmxConfigCopyFromWall(sub->wall); break;
- case dmxConfigOption: dmxConfigCopyFromOption(sub->option); break;
- case dmxConfigParam: dmxConfigCopyFromParam(sub->param); break;
+ case dmxConfigDisplay:
+ dmxConfigCopyFromDisplay(sub->display);
+ break;
+ case dmxConfigWall:
+ dmxConfigCopyFromWall(sub->wall);
+ break;
+ case dmxConfigOption:
+ dmxConfigCopyFromOption(sub->option);
+ break;
+ case dmxConfigParam:
+ dmxConfigCopyFromParam(sub->param);
+ break;
default:
dmxLog(dmxFatal,
"dmxConfigCopyData: not a display, wall, or value\n");
@@ -358,25 +407,29 @@ static void dmxConfigCopyData(DMXConfigVirtualPtr v)
}
}
-static void dmxConfigFromCommandLine(void)
+static void
+dmxConfigFromCommandLine(void)
{
DMXConfigListPtr pt;
-
+
dmxLog(dmxInfo, "Using configuration from command line\n");
for (pt = dmxConfigCmd.displays; pt; pt = pt->next) {
DMXScreenInfo *dmxScreen = dmxConfigAddDisplay(pt->name,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0);
+
if (dmxNumScreens == 1) {
- dmxScreen->where = PosAbsolute;
+ dmxScreen->where = PosAbsolute;
dmxScreen->whereX = 0;
dmxScreen->whereY = 0;
dmxLog(dmxInfo, "Added %s at %d %d\n",
dmxScreen->name, dmxScreen->whereX, dmxScreen->whereY);
- } else {
- dmxScreen->where = PosRightOf;
+ }
+ else {
+ dmxScreen->where = PosRightOf;
dmxScreen->whereRefScreen = dmxNumScreens - 2;
- if (dmxScreen->whereRefScreen < 0) dmxScreen->whereRefScreen = 0;
+ if (dmxScreen->whereRefScreen < 0)
+ dmxScreen->whereRefScreen = 0;
dmxLog(dmxInfo, "Added %s %s %s\n",
dmxScreen->name,
dmxScreen->where == PosBelow ? "below" : "right of",
@@ -385,14 +438,16 @@ static void dmxConfigFromCommandLine(void)
}
}
-static void dmxConfigFromConfigFile(void)
+static void
+dmxConfigFromConfigFile(void)
{
DMXConfigEntryPtr pt;
- const char *name;
+ const char *name;
for (pt = dmxConfigEntry; pt; pt = pt->next) {
- /* FIXME -- if an input is specified, use it */
- if (pt->type != dmxConfigVirtual) continue;
+ /* FIXME -- if an input is specified, use it */
+ if (pt->type != dmxConfigVirtual)
+ continue;
if ((name = dmxConfigMatch(dmxConfigCmd.config, pt))) {
dmxLog(dmxInfo, "Using configuration \"%s\"\n", name);
dmxConfigCopyData(pt->virtual);
@@ -403,22 +458,26 @@ static void dmxConfigFromConfigFile(void)
dmxConfigCmd.config, dmxConfigCmd.filename);
}
-static void dmxConfigConfigInputs(void)
+static void
+dmxConfigConfigInputs(void)
{
DMXConfigListPtr pt;
- if (dmxNumInputs) return;
-
- if (dmxConfigCmd.inputs) { /* Use command line */
+ if (dmxNumInputs)
+ return;
+
+ if (dmxConfigCmd.inputs) { /* Use command line */
for (pt = dmxConfigCmd.inputs; pt; pt = pt->next)
dmxConfigAddInput(pt->name, TRUE);
- } else if (dmxNumScreens) { /* Use first display */
+ }
+ else if (dmxNumScreens) { /* Use first display */
dmxConfigAddInput(dmxScreens[0].name, TRUE);
- } else { /* Use dummy */
+ }
+ else { /* Use dummy */
dmxConfigAddInput("dummy", TRUE);
}
- if (dmxConfigCmd.xinputs) { /* Non-core devices from command line */
+ if (dmxConfigCmd.xinputs) { /* Non-core devices from command line */
for (pt = dmxConfigCmd.xinputs; pt; pt = pt->next)
dmxConfigAddInput(pt->name, FALSE);
}
@@ -427,7 +486,8 @@ static void dmxConfigConfigInputs(void)
/** Set up the appropriate global variables so that the DMX server will
* be initialized using the configuration specified in the config file
* and on the command line. */
-void dmxConfigConfigure(void)
+void
+dmxConfigConfigure(void)
{
if (dmxConfigEntry) {
dmxConfigFreeEntry(dmxConfigEntry);
@@ -440,7 +500,8 @@ void dmxConfigConfigure(void)
dmxConfigCmd.filename);
dmxConfigReadFile(dmxConfigCmd.filename, 0);
dmxConfigFromConfigFile();
- } else {
+ }
+ else {
if (dmxConfigCmd.config)
dmxLog(dmxWarning,
"Configuration name (%s) without configuration file\n",
@@ -454,11 +515,13 @@ void dmxConfigConfigure(void)
* sets MAXSCREENS to that value. This is difficult since the number
* depends on the command line (which is easy to count) or on the config
* file, which has to be parsed. */
-void dmxConfigSetMaxScreens(void)
+void
+dmxConfigSetMaxScreens(void)
{
static int processing = 0;
- if (processing) return; /* Prevent reentry via ProcessCommandLine */
+ if (processing)
+ return; /* Prevent reentry via ProcessCommandLine */
processing = 1;
if (dmxConfigCmd.filename) {
if (!dmxNumScreens)
@@ -466,7 +529,8 @@ void dmxConfigSetMaxScreens(void)
#ifndef MAXSCREENS
SetMaxScreens(dmxNumScreens);
#endif
- } else
+ }
+ else
#ifndef MAXSCREENS
SetMaxScreens(dmxDisplaysFromCommandLine);
#endif
@@ -490,8 +554,8 @@ void dmxConfigSetMaxScreens(void)
return (char *)(dmx##glob ? dmx##glob : def); \
}
-GEN(rules, XkbRules, XKB_DFLT_RULES)
-GEN(model, XkbModel, XKB_DFLT_MODEL)
-GEN(layout, XkbLayout, XKB_DFLT_LAYOUT)
-GEN(variant, XkbVariant, XKB_DFLT_VARIANT)
-GEN(options, XkbOptions, XKB_DFLT_OPTIONS)
+GEN(rules, XkbRules, XKB_DFLT_RULES)
+ GEN(model, XkbModel, XKB_DFLT_MODEL)
+ GEN(layout, XkbLayout, XKB_DFLT_LAYOUT)
+ GEN(variant, XkbVariant, XKB_DFLT_VARIANT)
+ GEN(options, XkbOptions, XKB_DFLT_OPTIONS)
diff --git a/xorg-server/hw/dmx/config/dmxparse.c b/xorg-server/hw/dmx/config/dmxparse.c
index f75151eac..cf510844d 100644
--- a/xorg-server/hw/dmx/config/dmxparse.c
+++ b/xorg-server/hw/dmx/config/dmxparse.c
@@ -1,607 +1,688 @@
-/*
- * Copyright 2002 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This file provides support routines and helper functions to be used
- * by the DMX configuration file parser.
- *
- * Because the DMX configuration file parsing should be capable of being
- * used in a stand-alone fashion (i.e., independent from the DMX server
- * source tree), no dependencies on other DMX routines are made. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include "dmxparse.h"
-
-/** A general error logging routine that does not depend on the dmxLog
- * functions. */
-void dmxConfigLog(const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
- vprintf(format, args); /* RATS: All calls to dmxConfigLog from
- * dmxparse.c and dmxprint.c use a
- * trusted format. */
- va_end(args);
-}
-
-void *dmxConfigAlloc(unsigned long bytes)
-{
- void *area = calloc(1, bytes);
- if (!area) {
- dmxConfigLog("dmxConfigAlloc: out of memory\n");
- return NULL;
- }
- return area;
-}
-
-void *dmxConfigRealloc(void *orig, unsigned long orig_bytes,
- unsigned long bytes)
-{
- unsigned char *area = realloc(orig, bytes);
- if (!area) {
- dmxConfigLog("dmxConfigRealloc: out of memory\n");
- return NULL;
- }
- memset(area + orig_bytes, 0, bytes - orig_bytes);
- return area;
-}
-
-const char *dmxConfigCopyString(const char *string, int length)
-{
- char *copy;
-
- if (!length) length = strlen(string);
- copy = dmxConfigAlloc(length + 1);
- if (length) strncpy(copy, string, length);
- copy[length] = '\0';
- return copy;
-}
-
-void dmxConfigFree(void *area)
-{
- free(area);
-}
-
-DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
- const char *comment)
-{
- DMXConfigTokenPtr pToken = dmxConfigAlloc(sizeof(*pToken));
- pToken->token = token;
- pToken->line = line;
- pToken->comment = comment;
- return pToken;
-}
-
-void dmxConfigFreeToken(DMXConfigTokenPtr p)
-{
- if (!p) return;
- dmxConfigFree((void *)p->comment);
- dmxConfigFree(p);
-}
-
-DMXConfigStringPtr dmxConfigCreateString(int token, int line,
- const char *comment,
- const char *string)
-{
- DMXConfigStringPtr pString = dmxConfigAlloc(sizeof(*pString));
-
- pString->token = token;
- pString->line = line;
- pString->comment = comment;
- pString->string = string;
- return pString;
-}
-
-void dmxConfigFreeString(DMXConfigStringPtr p)
-{
- DMXConfigStringPtr next;
-
- if (!p) return;
- do {
- next = p->next;
- dmxConfigFree((void *)p->comment);
- dmxConfigFree((void *)p->string);
- dmxConfigFree(p);
- } while ((p = next));
-}
-
-DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line,
- const char *comment,
- int number)
-{
- DMXConfigNumberPtr pNumber = dmxConfigAlloc(sizeof(*pNumber));
-
- pNumber->token = token;
- pNumber->line = line;
- pNumber->comment = comment;
- pNumber->number = number;
- return pNumber;
-}
-
-void dmxConfigFreeNumber(DMXConfigNumberPtr p)
-{
- if (!p) return;
- dmxConfigFree((void *)p->comment);
- dmxConfigFree(p);
-}
-
-DMXConfigPairPtr dmxConfigCreatePair(int token, int line,
- const char *comment,
- int x, int y,
- int xsign, int ysign)
-{
- DMXConfigPairPtr pPair = dmxConfigAlloc(sizeof(*pPair));
-
- pPair->token = token;
- pPair->line = line;
- pPair->comment = comment;
- pPair->x = x;
- pPair->y = y;
- pPair->xsign = (xsign < 0) ? -1 : 1;
- pPair->ysign = (ysign < 0) ? -1 : 1;
- return pPair;
-}
-
-void dmxConfigFreePair(DMXConfigPairPtr p)
-{
- if (!p) return;
- dmxConfigFree((void *)p->comment);
- dmxConfigFree(p);
-}
-
-DMXConfigCommentPtr dmxConfigCreateComment(int token, int line,
- const char *comment)
-{
- DMXConfigCommentPtr pComment = dmxConfigAlloc(sizeof(*pComment));
-
- pComment->token = token;
- pComment->line = line;
- pComment->comment = comment;
- return pComment;
-}
-
-void dmxConfigFreeComment(DMXConfigCommentPtr p)
-{
- if (!p) return;
- dmxConfigFree((void *)p->comment);
- dmxConfigFree(p);
-}
-
-DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim,
- DMXConfigPairPtr pOffset)
-{
- DMXConfigPartDimPtr pPart = dmxConfigAlloc(sizeof(*pPart));
- pPart->dim = pDim;
- pPart->offset = pOffset;
- return pPart;
-}
-
-void dmxConfigFreePartDim(DMXConfigPartDimPtr p)
-{
- if (!p) return;
- dmxConfigFreePair(p->dim);
- dmxConfigFreePair(p->offset);
- dmxConfigFree(p);
-}
-
-DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn,
- DMXConfigPartDimPtr pRoot)
-{
- DMXConfigFullDimPtr pFull = dmxConfigAlloc(sizeof(*pFull));
- pFull->scrn = pScrn;
- pFull->root = pRoot;
- return pFull;
-}
-
-void dmxConfigFreeFullDim(DMXConfigFullDimPtr p)
-{
- if (!p) return;
- dmxConfigFreePartDim(p->scrn);
- dmxConfigFreePartDim(p->root);
- dmxConfigFree(p);
-}
-
-DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
- DMXConfigStringPtr pName,
- DMXConfigFullDimPtr pDim,
- DMXConfigPairPtr pOrigin,
- DMXConfigTokenPtr pEnd)
-{
- DMXConfigDisplayPtr pDisplay = dmxConfigAlloc(sizeof(*pDisplay));
-
- pDisplay->start = pStart;
- pDisplay->dname = pName;
- pDisplay->dim = pDim;
- pDisplay->origin = pOrigin;
- pDisplay->end = pEnd;
-
- pDisplay->name = pName ? pName->string : NULL;
- pDisplay->rootXOrigin = pOrigin ? pOrigin->x : 0;
- pDisplay->rootYOrigin = pOrigin ? pOrigin->y : 0;
-
- if (pDim && pDim->scrn && pDim->scrn->dim) {
- pDisplay->scrnWidth = pDim->scrn->dim->x;
- pDisplay->scrnHeight = pDim->scrn->dim->y;
- }
- if (pDim && pDim->scrn && pDim->scrn->offset) {
- pDisplay->scrnX = pDim->scrn->offset->x;
- pDisplay->scrnY = pDim->scrn->offset->y;
- pDisplay->scrnXSign = pDim->scrn->offset->xsign;
- pDisplay->scrnYSign = pDim->scrn->offset->ysign;
- }
-
- if (pDim && pDim->root) {
- if (pDim->root->dim) {
- pDisplay->rootWidth = pDim->root->dim->x;
- pDisplay->rootHeight = pDim->root->dim->y;
- }
- if (pDim->root->offset) {
- pDisplay->rootX = pDim->root->offset->x;
- pDisplay->rootY = pDim->root->offset->y;
- pDisplay->rootXSign = pDim->root->offset->xsign;
- pDisplay->rootYSign = pDim->root->offset->ysign;
- }
- } else { /* If no root specification, copy width
- * and height from scrn -- leave offset
- * as zero, since it is relative to
- * scrn. */
- pDisplay->rootWidth = pDisplay->scrnWidth;
- pDisplay->rootHeight = pDisplay->scrnHeight;
- }
-
-
- return pDisplay;
-}
-
-void dmxConfigFreeDisplay(DMXConfigDisplayPtr p)
-{
- if (!p) return;
- dmxConfigFreeToken(p->start);
- dmxConfigFreeString(p->dname);
- dmxConfigFreeFullDim(p->dim);
- dmxConfigFreeToken(p->end);
- dmxConfigFree(p);
-}
-
-DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart,
- DMXConfigPairPtr pWallDim,
- DMXConfigPairPtr pDisplayDim,
- DMXConfigStringPtr pNameList,
- DMXConfigTokenPtr pEnd)
-{
- DMXConfigWallPtr pWall = dmxConfigAlloc(sizeof(*pWall));
-
- pWall->start = pStart;
- pWall->wallDim = pWallDim;
- pWall->displayDim = pDisplayDim;
- pWall->nameList = pNameList;
- pWall->end = pEnd;
-
- pWall->width = pDisplayDim ? pDisplayDim->x : 0;
- pWall->height = pDisplayDim ? pDisplayDim->y : 0;
- pWall->xwall = pWallDim ? pWallDim->x : 0;
- pWall->ywall = pWallDim ? pWallDim->y : 0;
-
- return pWall;
-}
-
-void dmxConfigFreeWall(DMXConfigWallPtr p)
-{
- if (!p) return;
- dmxConfigFreeToken(p->start);
- dmxConfigFreePair(p->wallDim);
- dmxConfigFreePair(p->displayDim);
- dmxConfigFreeString(p->nameList);
- dmxConfigFreeToken(p->end);
- dmxConfigFree(p);
-}
-
-DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
- DMXConfigStringPtr pOption,
- DMXConfigTokenPtr pEnd)
-{
- int length = 0;
- int offset = 0;
- DMXConfigStringPtr p;
- DMXConfigOptionPtr option = dmxConfigAlloc(sizeof(*option));
-
- for (p = pOption; p; p = p->next) {
- if (p->string) length += strlen(p->string) + 1;
- }
-
- option->string = dmxConfigAlloc(length + 1);
-
- for (p = pOption; p; p = p->next) {
- if (p->string) {
- int len = strlen(p->string);
- strncpy(option->string + offset, p->string, len);
- offset += len;
- if (p->next) option->string[offset++] = ' ';
- }
- }
- option->string[offset] = '\0';
-
- option->start = pStart;
- option->option = pOption;
- option->end = pEnd;
-
- return option;
-}
-
-void dmxConfigFreeOption(DMXConfigOptionPtr p)
-{
- if (!p) return;
- free(p->string);
- dmxConfigFreeToken(p->start);
- dmxConfigFreeString(p->option);
- dmxConfigFreeToken(p->end);
- dmxConfigFree(p);
-}
-
-const char **dmxConfigLookupParam(DMXConfigParamPtr p, const char *key,
- int *argc)
-{
- DMXConfigParamPtr pt;
-
- for (pt = p; pt; pt = pt->next) {
- if (pt->argv && !strcasecmp(pt->argv[0], key)) {
- *argc = pt->argc;
- return pt->argv;
- }
- }
- *argc = 0;
- return NULL;
-}
-
-DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart,
- DMXConfigTokenPtr pOpen,
- DMXConfigStringPtr pParam,
- DMXConfigTokenPtr pClose,
- DMXConfigTokenPtr pEnd)
-{
- DMXConfigParamPtr param = dmxConfigAlloc(sizeof(*param));
- DMXConfigStringPtr pt;
-
- param->argc = 0;
- param->argv = NULL;
- for (pt = pParam; pt; pt = pt->next) {
- if (pt->string) {
- param->argv = realloc(param->argv,
- (param->argc+2) * sizeof(*param->argv));
- param->argv[param->argc] = pt->string;
- ++param->argc;
- }
- }
- if (param->argv) param->argv[param->argc] = NULL;
-
- param->start = pStart;
- param->open = pOpen;
- param->param = pParam;
- param->close = pClose;
- param->end = pEnd;
-
- return param;
-}
-
-void dmxConfigFreeParam(DMXConfigParamPtr p)
-{
- DMXConfigParamPtr next;
-
- if (!p) return;
- do {
- next = p->next;
- dmxConfigFreeToken(p->start);
- dmxConfigFreeToken(p->open);
- dmxConfigFreeString(p->param);
- dmxConfigFreeToken(p->close);
- dmxConfigFreeToken(p->end);
- dmxConfigFree(p->argv);
- dmxConfigFree(p);
- } while ((p = next));
-}
-
-DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigDisplayPtr display,
- DMXConfigWallPtr wall,
- DMXConfigOptionPtr option,
- DMXConfigParamPtr param)
-{
- DMXConfigSubPtr pSub = dmxConfigAlloc(sizeof(*pSub));
- pSub->type = type;
- switch (type) {
- case dmxConfigComment: pSub->comment = comment; break;
- case dmxConfigDisplay: pSub->display = display; break;
- case dmxConfigWall: pSub->wall = wall; break;
- case dmxConfigOption: pSub->option = option; break;
- case dmxConfigParam: pSub->param = param; break;
- default: dmxConfigLog("Type %d not supported in subentry\n", type); break;
- }
- return pSub;
-}
-
-void dmxConfigFreeSub(DMXConfigSubPtr sub)
-{
- DMXConfigSubPtr pt;
-
- for (pt = sub; pt; pt = pt->next) {
- switch (pt->type) {
- case dmxConfigComment: dmxConfigFreeComment(pt->comment); break;
- case dmxConfigDisplay: dmxConfigFreeDisplay(pt->display); break;
- case dmxConfigWall: dmxConfigFreeWall(pt->wall); break;
- case dmxConfigOption: dmxConfigFreeOption(pt->option); break;
- case dmxConfigParam: dmxConfigFreeParam(pt->param); break;
- default:
- dmxConfigLog("Type %d not supported in subentry\n", pt->type);
- break;
- }
- }
- dmxConfigFree(sub);
-}
-
-DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment)
-{
- return dmxConfigCreateSub(dmxConfigComment, comment, NULL, NULL, NULL,
- NULL);
-}
-
-DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display)
-{
- return dmxConfigCreateSub(dmxConfigDisplay, NULL, display, NULL, NULL,
- NULL);
-}
-
-DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall)
-{
- return dmxConfigCreateSub(dmxConfigWall, NULL, NULL, wall, NULL, NULL);
-}
-
-DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option)
-{
- return dmxConfigCreateSub(dmxConfigOption, NULL, NULL, NULL, option, NULL);
-}
-
-DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param)
-{
- return dmxConfigCreateSub(dmxConfigParam, NULL, NULL, NULL, NULL, param);
-}
-
-extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head,
- DMXConfigSubPtr sub)
-{
- DMXConfigSubPtr pt;
-
- if (!head) return sub;
- for (pt = head; pt->next; pt = pt->next);
- pt->next = sub;
- return head;
-}
-
-DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
- DMXConfigStringPtr pName,
- DMXConfigPairPtr pDim,
- DMXConfigTokenPtr pOpen,
- DMXConfigSubPtr pSubentry,
- DMXConfigTokenPtr pClose)
-{
- DMXConfigVirtualPtr pVirtual = dmxConfigAlloc(sizeof(*pVirtual));
-
- pVirtual->start = pStart;
- pVirtual->vname = pName;
- pVirtual->dim = pDim;
- pVirtual->open = pOpen;
- pVirtual->subentry = pSubentry;
- pVirtual->close = pClose;
-
- pVirtual->name = pName ? pName->string : NULL;
- pVirtual->width = pDim ? pDim->x : 0;
- pVirtual->height = pDim ? pDim->y : 0;
-
- return pVirtual;
-}
-
-void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual)
-{
- dmxConfigFreeToken(virtual->start);
- dmxConfigFreeString(virtual->vname);
- dmxConfigFreePair(virtual->dim);
- dmxConfigFreeToken(virtual->open);
- dmxConfigFreeSub(virtual->subentry);
- dmxConfigFreeToken(virtual->close);
- dmxConfigFree(virtual);
-}
-
-DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigVirtualPtr virtual)
-{
- DMXConfigEntryPtr pEntry = dmxConfigAlloc(sizeof(*pEntry));
- pEntry->type = type;
- switch (type) {
- case dmxConfigComment: pEntry->comment = comment; break;
- case dmxConfigVirtual: pEntry->virtual = virtual; break;
- default: dmxConfigLog("Type %d not supported in entry\n", type); break;
- }
- return pEntry;
-}
-
-void dmxConfigFreeEntry(DMXConfigEntryPtr entry)
-{
- DMXConfigEntryPtr pt;
-
- for (pt = entry; pt; pt = pt->next) {
- switch (pt->type) {
- case dmxConfigComment: dmxConfigFreeComment(pt->comment); break;
- case dmxConfigVirtual: dmxConfigFreeVirtual(pt->virtual); break;
- default:
- dmxConfigLog("Type %d not supported in entry\n", pt->type);
- break;
- }
- }
- dmxConfigFree(entry);
-}
-
-DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head,
- DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigVirtualPtr virtual)
-{
- DMXConfigEntryPtr child = dmxConfigCreateEntry(type, comment, virtual);
- DMXConfigEntryPtr pt;
-
- if (!head) return child;
-
- for (pt = head; pt->next; pt = pt->next);
- pt->next = child;
-
- return head;
-}
-
-DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment)
-{
- return dmxConfigCreateEntry(dmxConfigComment, comment, NULL);
-}
-
-DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual)
-{
- return dmxConfigCreateEntry(dmxConfigVirtual, NULL, virtual);
-}
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This file provides support routines and helper functions to be used
+ * by the DMX configuration file parser.
+ *
+ * Because the DMX configuration file parsing should be capable of being
+ * used in a stand-alone fashion (i.e., independent from the DMX server
+ * source tree), no dependencies on other DMX routines are made. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include "dmxparse.h"
+
+/** A general error logging routine that does not depend on the dmxLog
+ * functions. */
+void
+dmxConfigLog(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vprintf(format, args); /* RATS: All calls to dmxConfigLog from
+ * dmxparse.c and dmxprint.c use a
+ * trusted format. */
+ va_end(args);
+}
+
+void *
+dmxConfigAlloc(unsigned long bytes)
+{
+ void *area = calloc(1, bytes);
+
+ if (!area) {
+ dmxConfigLog("dmxConfigAlloc: out of memory\n");
+ return NULL;
+ }
+ return area;
+}
+
+void *
+dmxConfigRealloc(void *orig, unsigned long orig_bytes, unsigned long bytes)
+{
+ unsigned char *area = realloc(orig, bytes);
+
+ if (!area) {
+ dmxConfigLog("dmxConfigRealloc: out of memory\n");
+ return NULL;
+ }
+ memset(area + orig_bytes, 0, bytes - orig_bytes);
+ return area;
+}
+
+const char *
+dmxConfigCopyString(const char *string, int length)
+{
+ char *copy;
+
+ if (!length)
+ length = strlen(string);
+ copy = dmxConfigAlloc(length + 1);
+ if (length)
+ strncpy(copy, string, length);
+ copy[length] = '\0';
+ return copy;
+}
+
+void
+dmxConfigFree(void *area)
+{
+ free(area);
+}
+
+DMXConfigTokenPtr
+dmxConfigCreateToken(int token, int line, const char *comment)
+{
+ DMXConfigTokenPtr pToken = dmxConfigAlloc(sizeof(*pToken));
+
+ pToken->token = token;
+ pToken->line = line;
+ pToken->comment = comment;
+ return pToken;
+}
+
+void
+dmxConfigFreeToken(DMXConfigTokenPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFree((void *) p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigStringPtr
+dmxConfigCreateString(int token, int line,
+ const char *comment, const char *string)
+{
+ DMXConfigStringPtr pString = dmxConfigAlloc(sizeof(*pString));
+
+ pString->token = token;
+ pString->line = line;
+ pString->comment = comment;
+ pString->string = string;
+ return pString;
+}
+
+void
+dmxConfigFreeString(DMXConfigStringPtr p)
+{
+ DMXConfigStringPtr next;
+
+ if (!p)
+ return;
+ do {
+ next = p->next;
+ dmxConfigFree((void *) p->comment);
+ dmxConfigFree((void *) p->string);
+ dmxConfigFree(p);
+ } while ((p = next));
+}
+
+DMXConfigNumberPtr
+dmxConfigCreateNumber(int token, int line, const char *comment, int number)
+{
+ DMXConfigNumberPtr pNumber = dmxConfigAlloc(sizeof(*pNumber));
+
+ pNumber->token = token;
+ pNumber->line = line;
+ pNumber->comment = comment;
+ pNumber->number = number;
+ return pNumber;
+}
+
+void
+dmxConfigFreeNumber(DMXConfigNumberPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFree((void *) p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigPairPtr
+dmxConfigCreatePair(int token, int line,
+ const char *comment, int x, int y, int xsign, int ysign)
+{
+ DMXConfigPairPtr pPair = dmxConfigAlloc(sizeof(*pPair));
+
+ pPair->token = token;
+ pPair->line = line;
+ pPair->comment = comment;
+ pPair->x = x;
+ pPair->y = y;
+ pPair->xsign = (xsign < 0) ? -1 : 1;
+ pPair->ysign = (ysign < 0) ? -1 : 1;
+ return pPair;
+}
+
+void
+dmxConfigFreePair(DMXConfigPairPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFree((void *) p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigCommentPtr
+dmxConfigCreateComment(int token, int line, const char *comment)
+{
+ DMXConfigCommentPtr pComment = dmxConfigAlloc(sizeof(*pComment));
+
+ pComment->token = token;
+ pComment->line = line;
+ pComment->comment = comment;
+ return pComment;
+}
+
+void
+dmxConfigFreeComment(DMXConfigCommentPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFree((void *) p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigPartDimPtr
+dmxConfigCreatePartDim(DMXConfigPairPtr pDim, DMXConfigPairPtr pOffset)
+{
+ DMXConfigPartDimPtr pPart = dmxConfigAlloc(sizeof(*pPart));
+
+ pPart->dim = pDim;
+ pPart->offset = pOffset;
+ return pPart;
+}
+
+void
+dmxConfigFreePartDim(DMXConfigPartDimPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFreePair(p->dim);
+ dmxConfigFreePair(p->offset);
+ dmxConfigFree(p);
+}
+
+DMXConfigFullDimPtr
+dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn, DMXConfigPartDimPtr pRoot)
+{
+ DMXConfigFullDimPtr pFull = dmxConfigAlloc(sizeof(*pFull));
+
+ pFull->scrn = pScrn;
+ pFull->root = pRoot;
+ return pFull;
+}
+
+void
+dmxConfigFreeFullDim(DMXConfigFullDimPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFreePartDim(p->scrn);
+ dmxConfigFreePartDim(p->root);
+ dmxConfigFree(p);
+}
+
+DMXConfigDisplayPtr
+dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pName,
+ DMXConfigFullDimPtr pDim,
+ DMXConfigPairPtr pOrigin, DMXConfigTokenPtr pEnd)
+{
+ DMXConfigDisplayPtr pDisplay = dmxConfigAlloc(sizeof(*pDisplay));
+
+ pDisplay->start = pStart;
+ pDisplay->dname = pName;
+ pDisplay->dim = pDim;
+ pDisplay->origin = pOrigin;
+ pDisplay->end = pEnd;
+
+ pDisplay->name = pName ? pName->string : NULL;
+ pDisplay->rootXOrigin = pOrigin ? pOrigin->x : 0;
+ pDisplay->rootYOrigin = pOrigin ? pOrigin->y : 0;
+
+ if (pDim && pDim->scrn && pDim->scrn->dim) {
+ pDisplay->scrnWidth = pDim->scrn->dim->x;
+ pDisplay->scrnHeight = pDim->scrn->dim->y;
+ }
+ if (pDim && pDim->scrn && pDim->scrn->offset) {
+ pDisplay->scrnX = pDim->scrn->offset->x;
+ pDisplay->scrnY = pDim->scrn->offset->y;
+ pDisplay->scrnXSign = pDim->scrn->offset->xsign;
+ pDisplay->scrnYSign = pDim->scrn->offset->ysign;
+ }
+
+ if (pDim && pDim->root) {
+ if (pDim->root->dim) {
+ pDisplay->rootWidth = pDim->root->dim->x;
+ pDisplay->rootHeight = pDim->root->dim->y;
+ }
+ if (pDim->root->offset) {
+ pDisplay->rootX = pDim->root->offset->x;
+ pDisplay->rootY = pDim->root->offset->y;
+ pDisplay->rootXSign = pDim->root->offset->xsign;
+ pDisplay->rootYSign = pDim->root->offset->ysign;
+ }
+ }
+ else { /* If no root specification, copy width
+ * and height from scrn -- leave offset
+ * as zero, since it is relative to
+ * scrn. */
+ pDisplay->rootWidth = pDisplay->scrnWidth;
+ pDisplay->rootHeight = pDisplay->scrnHeight;
+ }
+
+ return pDisplay;
+}
+
+void
+dmxConfigFreeDisplay(DMXConfigDisplayPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreeString(p->dname);
+ dmxConfigFreeFullDim(p->dim);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p);
+}
+
+DMXConfigWallPtr
+dmxConfigCreateWall(DMXConfigTokenPtr pStart,
+ DMXConfigPairPtr pWallDim,
+ DMXConfigPairPtr pDisplayDim,
+ DMXConfigStringPtr pNameList, DMXConfigTokenPtr pEnd)
+{
+ DMXConfigWallPtr pWall = dmxConfigAlloc(sizeof(*pWall));
+
+ pWall->start = pStart;
+ pWall->wallDim = pWallDim;
+ pWall->displayDim = pDisplayDim;
+ pWall->nameList = pNameList;
+ pWall->end = pEnd;
+
+ pWall->width = pDisplayDim ? pDisplayDim->x : 0;
+ pWall->height = pDisplayDim ? pDisplayDim->y : 0;
+ pWall->xwall = pWallDim ? pWallDim->x : 0;
+ pWall->ywall = pWallDim ? pWallDim->y : 0;
+
+ return pWall;
+}
+
+void
+dmxConfigFreeWall(DMXConfigWallPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreePair(p->wallDim);
+ dmxConfigFreePair(p->displayDim);
+ dmxConfigFreeString(p->nameList);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p);
+}
+
+DMXConfigOptionPtr
+dmxConfigCreateOption(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pOption, DMXConfigTokenPtr pEnd)
+{
+ int length = 0;
+ int offset = 0;
+ DMXConfigStringPtr p;
+ DMXConfigOptionPtr option = dmxConfigAlloc(sizeof(*option));
+
+ for (p = pOption; p; p = p->next) {
+ if (p->string)
+ length += strlen(p->string) + 1;
+ }
+
+ option->string = dmxConfigAlloc(length + 1);
+
+ for (p = pOption; p; p = p->next) {
+ if (p->string) {
+ int len = strlen(p->string);
+
+ strncpy(option->string + offset, p->string, len);
+ offset += len;
+ if (p->next)
+ option->string[offset++] = ' ';
+ }
+ }
+ option->string[offset] = '\0';
+
+ option->start = pStart;
+ option->option = pOption;
+ option->end = pEnd;
+
+ return option;
+}
+
+void
+dmxConfigFreeOption(DMXConfigOptionPtr p)
+{
+ if (!p)
+ return;
+ free(p->string);
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreeString(p->option);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p);
+}
+
+const char **
+dmxConfigLookupParam(DMXConfigParamPtr p, const char *key, int *argc)
+{
+ DMXConfigParamPtr pt;
+
+ for (pt = p; pt; pt = pt->next) {
+ if (pt->argv && !strcasecmp(pt->argv[0], key)) {
+ *argc = pt->argc;
+ return pt->argv;
+ }
+ }
+ *argc = 0;
+ return NULL;
+}
+
+DMXConfigParamPtr
+dmxConfigCreateParam(DMXConfigTokenPtr pStart,
+ DMXConfigTokenPtr pOpen,
+ DMXConfigStringPtr pParam,
+ DMXConfigTokenPtr pClose, DMXConfigTokenPtr pEnd)
+{
+ DMXConfigParamPtr param = dmxConfigAlloc(sizeof(*param));
+ DMXConfigStringPtr pt;
+
+ param->argc = 0;
+ param->argv = NULL;
+ for (pt = pParam; pt; pt = pt->next) {
+ if (pt->string) {
+ param->argv = realloc(param->argv,
+ (param->argc + 2) * sizeof(*param->argv));
+ param->argv[param->argc] = pt->string;
+ ++param->argc;
+ }
+ }
+ if (param->argv)
+ param->argv[param->argc] = NULL;
+
+ param->start = pStart;
+ param->open = pOpen;
+ param->param = pParam;
+ param->close = pClose;
+ param->end = pEnd;
+
+ return param;
+}
+
+void
+dmxConfigFreeParam(DMXConfigParamPtr p)
+{
+ DMXConfigParamPtr next;
+
+ if (!p)
+ return;
+ do {
+ next = p->next;
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreeToken(p->open);
+ dmxConfigFreeString(p->param);
+ dmxConfigFreeToken(p->close);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p->argv);
+ dmxConfigFree(p);
+ } while ((p = next));
+}
+
+DMXConfigSubPtr
+dmxConfigCreateSub(DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigDisplayPtr display,
+ DMXConfigWallPtr wall,
+ DMXConfigOptionPtr option, DMXConfigParamPtr param)
+{
+ DMXConfigSubPtr pSub = dmxConfigAlloc(sizeof(*pSub));
+
+ pSub->type = type;
+ switch (type) {
+ case dmxConfigComment:
+ pSub->comment = comment;
+ break;
+ case dmxConfigDisplay:
+ pSub->display = display;
+ break;
+ case dmxConfigWall:
+ pSub->wall = wall;
+ break;
+ case dmxConfigOption:
+ pSub->option = option;
+ break;
+ case dmxConfigParam:
+ pSub->param = param;
+ break;
+ default:
+ dmxConfigLog("Type %d not supported in subentry\n", type);
+ break;
+ }
+ return pSub;
+}
+
+void
+dmxConfigFreeSub(DMXConfigSubPtr sub)
+{
+ DMXConfigSubPtr pt;
+
+ for (pt = sub; pt; pt = pt->next) {
+ switch (pt->type) {
+ case dmxConfigComment:
+ dmxConfigFreeComment(pt->comment);
+ break;
+ case dmxConfigDisplay:
+ dmxConfigFreeDisplay(pt->display);
+ break;
+ case dmxConfigWall:
+ dmxConfigFreeWall(pt->wall);
+ break;
+ case dmxConfigOption:
+ dmxConfigFreeOption(pt->option);
+ break;
+ case dmxConfigParam:
+ dmxConfigFreeParam(pt->param);
+ break;
+ default:
+ dmxConfigLog("Type %d not supported in subentry\n", pt->type);
+ break;
+ }
+ }
+ dmxConfigFree(sub);
+}
+
+DMXConfigSubPtr
+dmxConfigSubComment(DMXConfigCommentPtr comment)
+{
+ return dmxConfigCreateSub(dmxConfigComment, comment, NULL, NULL, NULL,
+ NULL);
+}
+
+DMXConfigSubPtr
+dmxConfigSubDisplay(DMXConfigDisplayPtr display)
+{
+ return dmxConfigCreateSub(dmxConfigDisplay, NULL, display, NULL, NULL,
+ NULL);
+}
+
+DMXConfigSubPtr
+dmxConfigSubWall(DMXConfigWallPtr wall)
+{
+ return dmxConfigCreateSub(dmxConfigWall, NULL, NULL, wall, NULL, NULL);
+}
+
+DMXConfigSubPtr
+dmxConfigSubOption(DMXConfigOptionPtr option)
+{
+ return dmxConfigCreateSub(dmxConfigOption, NULL, NULL, NULL, option, NULL);
+}
+
+DMXConfigSubPtr
+dmxConfigSubParam(DMXConfigParamPtr param)
+{
+ return dmxConfigCreateSub(dmxConfigParam, NULL, NULL, NULL, NULL, param);
+}
+
+extern DMXConfigSubPtr
+dmxConfigAddSub(DMXConfigSubPtr head, DMXConfigSubPtr sub)
+{
+ DMXConfigSubPtr pt;
+
+ if (!head)
+ return sub;
+ for (pt = head; pt->next; pt = pt->next);
+ pt->next = sub;
+ return head;
+}
+
+DMXConfigVirtualPtr
+dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pName,
+ DMXConfigPairPtr pDim,
+ DMXConfigTokenPtr pOpen,
+ DMXConfigSubPtr pSubentry, DMXConfigTokenPtr pClose)
+{
+ DMXConfigVirtualPtr pVirtual = dmxConfigAlloc(sizeof(*pVirtual));
+
+ pVirtual->start = pStart;
+ pVirtual->vname = pName;
+ pVirtual->dim = pDim;
+ pVirtual->open = pOpen;
+ pVirtual->subentry = pSubentry;
+ pVirtual->close = pClose;
+
+ pVirtual->name = pName ? pName->string : NULL;
+ pVirtual->width = pDim ? pDim->x : 0;
+ pVirtual->height = pDim ? pDim->y : 0;
+
+ return pVirtual;
+}
+
+void
+dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual)
+{
+ dmxConfigFreeToken(virtual->start);
+ dmxConfigFreeString(virtual->vname);
+ dmxConfigFreePair(virtual->dim);
+ dmxConfigFreeToken(virtual->open);
+ dmxConfigFreeSub(virtual->subentry);
+ dmxConfigFreeToken(virtual->close);
+ dmxConfigFree(virtual);
+}
+
+DMXConfigEntryPtr
+dmxConfigCreateEntry(DMXConfigType type,
+ DMXConfigCommentPtr comment, DMXConfigVirtualPtr virtual)
+{
+ DMXConfigEntryPtr pEntry = dmxConfigAlloc(sizeof(*pEntry));
+
+ pEntry->type = type;
+ switch (type) {
+ case dmxConfigComment:
+ pEntry->comment = comment;
+ break;
+ case dmxConfigVirtual:
+ pEntry->virtual = virtual;
+ break;
+ default:
+ dmxConfigLog("Type %d not supported in entry\n", type);
+ break;
+ }
+ return pEntry;
+}
+
+void
+dmxConfigFreeEntry(DMXConfigEntryPtr entry)
+{
+ DMXConfigEntryPtr pt;
+
+ for (pt = entry; pt; pt = pt->next) {
+ switch (pt->type) {
+ case dmxConfigComment:
+ dmxConfigFreeComment(pt->comment);
+ break;
+ case dmxConfigVirtual:
+ dmxConfigFreeVirtual(pt->virtual);
+ break;
+ default:
+ dmxConfigLog("Type %d not supported in entry\n", pt->type);
+ break;
+ }
+ }
+ dmxConfigFree(entry);
+}
+
+DMXConfigEntryPtr
+dmxConfigAddEntry(DMXConfigEntryPtr head,
+ DMXConfigType type,
+ DMXConfigCommentPtr comment, DMXConfigVirtualPtr virtual)
+{
+ DMXConfigEntryPtr child = dmxConfigCreateEntry(type, comment, virtual);
+ DMXConfigEntryPtr pt;
+
+ if (!head)
+ return child;
+
+ for (pt = head; pt->next; pt = pt->next);
+ pt->next = child;
+
+ return head;
+}
+
+DMXConfigEntryPtr
+dmxConfigEntryComment(DMXConfigCommentPtr comment)
+{
+ return dmxConfigCreateEntry(dmxConfigComment, comment, NULL);
+}
+
+DMXConfigEntryPtr
+dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual)
+{
+ return dmxConfigCreateEntry(dmxConfigVirtual, NULL, virtual);
+}
diff --git a/xorg-server/hw/dmx/config/dmxparse.h b/xorg-server/hw/dmx/config/dmxparse.h
index de81d23b7..7d31b6309 100644
--- a/xorg-server/hw/dmx/config/dmxparse.h
+++ b/xorg-server/hw/dmx/config/dmxparse.h
@@ -41,44 +41,44 @@
/** Stores tokens not stored in other structures (e.g., keywords and ;) */
typedef struct _DMXConfigToken {
- int token;
- int line;
- const char *comment;
+ int token;
+ int line;
+ const char *comment;
} DMXConfigToken, *DMXConfigTokenPtr;
/** Stores parsed strings. */
typedef struct _DMXConfigString {
- int token;
- int line;
- const char *comment;
- const char *string;
- struct _DMXConfigString *next;
+ int token;
+ int line;
+ const char *comment;
+ const char *string;
+ struct _DMXConfigString *next;
} DMXConfigString, *DMXConfigStringPtr;
/** Stores parsed numbers. */
typedef struct _DMXConfigNumber {
- int token;
- int line;
- const char *comment;
- int number;
+ int token;
+ int line;
+ const char *comment;
+ int number;
} DMXConfigNumber, *DMXConfigNumberPtr;
/** Stores parsed pairs (e.g., x y) */
typedef struct _DMXConfigPair {
- int token;
- int line;
- const char *comment;
- int x;
- int y;
- int xsign;
- int ysign;
+ int token;
+ int line;
+ const char *comment;
+ int x;
+ int y;
+ int xsign;
+ int ysign;
} DMXConfigPair, *DMXConfigPairPtr;
/** Stores parsed comments not stored with a token. */
typedef struct _DMXConfigComment {
- int token;
- int line;
- const char *comment;
+ int token;
+ int line;
+ const char *comment;
} DMXConfigComment, *DMXConfigCommentPtr;
typedef enum {
@@ -92,206 +92,201 @@ typedef enum {
/** Stores a geometry specification. */
typedef struct _DMXConfigPartDim {
- DMXConfigPairPtr dim;
- DMXConfigPairPtr offset;
+ DMXConfigPairPtr dim;
+ DMXConfigPairPtr offset;
} DMXConfigPartDim, *DMXConfigPartDimPtr;
/** Stores a pair of geometry specifications. */
typedef struct _DMXConfigFullDim {
- DMXConfigPartDimPtr scrn;
- DMXConfigPartDimPtr root;
+ DMXConfigPartDimPtr scrn;
+ DMXConfigPartDimPtr root;
} DMXConfigFullDim, *DMXConfigFullDimPtr;
/** Stores parsed display information. */
typedef struct _DMXConfigDisplay {
- /* Summary information */
- const char *name;
- /* Screen Window Geometry */
- int scrnWidth, scrnHeight;
- int scrnX, scrnY;
- int scrnXSign, scrnYSign;
- /* Root Window Geometry */
- int rootWidth, rootHeight;
- int rootX, rootY;
- int rootXSign, rootYSign;
- /* Origin in global space */
- int rootXOrigin, rootYOrigin;
-
- /* Raw configuration information */
- DMXConfigTokenPtr start;
- DMXConfigStringPtr dname;
- DMXConfigFullDimPtr dim;
- DMXConfigPairPtr origin;
- DMXConfigTokenPtr end;
+ /* Summary information */
+ const char *name;
+ /* Screen Window Geometry */
+ int scrnWidth, scrnHeight;
+ int scrnX, scrnY;
+ int scrnXSign, scrnYSign;
+ /* Root Window Geometry */
+ int rootWidth, rootHeight;
+ int rootX, rootY;
+ int rootXSign, rootYSign;
+ /* Origin in global space */
+ int rootXOrigin, rootYOrigin;
+
+ /* Raw configuration information */
+ DMXConfigTokenPtr start;
+ DMXConfigStringPtr dname;
+ DMXConfigFullDimPtr dim;
+ DMXConfigPairPtr origin;
+ DMXConfigTokenPtr end;
} DMXConfigDisplay, *DMXConfigDisplayPtr;
/** Stores parsed wall information. */
typedef struct _DMXConfigWall {
- /* Summary information */
- int width, height; /* dimensions of displays */
- int xwall, ywall; /* dimensions of wall, in tiles */
+ /* Summary information */
+ int width, height; /* dimensions of displays */
+ int xwall, ywall; /* dimensions of wall, in tiles */
-
- /* Raw configuration informaiton */
- DMXConfigTokenPtr start;
- DMXConfigPairPtr wallDim;
- DMXConfigPairPtr displayDim;
- DMXConfigStringPtr nameList;
- DMXConfigTokenPtr end;
+ /* Raw configuration informaiton */
+ DMXConfigTokenPtr start;
+ DMXConfigPairPtr wallDim;
+ DMXConfigPairPtr displayDim;
+ DMXConfigStringPtr nameList;
+ DMXConfigTokenPtr end;
} DMXConfigWall, *DMXConfigWallPtr;
/** Stores parsed option information. */
typedef struct _DMXConfigOption {
- /* Summary information */
- char *string;
-
- /* Raw configuration informaiton */
- DMXConfigTokenPtr start;
- DMXConfigStringPtr option;
- DMXConfigTokenPtr end;
+ /* Summary information */
+ char *string;
+
+ /* Raw configuration informaiton */
+ DMXConfigTokenPtr start;
+ DMXConfigStringPtr option;
+ DMXConfigTokenPtr end;
} DMXConfigOption, *DMXConfigOptionPtr;
/** Stores parsed param information. */
typedef struct _DMXConfigParam {
- int argc;
- const char **argv;
-
- DMXConfigTokenPtr start;
- DMXConfigTokenPtr open;
- DMXConfigStringPtr param;
- DMXConfigTokenPtr close;
- DMXConfigTokenPtr end; /* Either open/close OR end */
- struct _DMXConfigParam *next;
+ int argc;
+ const char **argv;
+
+ DMXConfigTokenPtr start;
+ DMXConfigTokenPtr open;
+ DMXConfigStringPtr param;
+ DMXConfigTokenPtr close;
+ DMXConfigTokenPtr end; /* Either open/close OR end */
+ struct _DMXConfigParam *next;
} DMXConfigParam, *DMXConfigParamPtr;
/** Stores options under an entry (subentry). */
typedef struct _DMXConfigSub {
- DMXConfigType type;
- DMXConfigCommentPtr comment;
- DMXConfigDisplayPtr display;
- DMXConfigWallPtr wall;
- DMXConfigOptionPtr option;
- DMXConfigParamPtr param;
- struct _DMXConfigSub *next;
+ DMXConfigType type;
+ DMXConfigCommentPtr comment;
+ DMXConfigDisplayPtr display;
+ DMXConfigWallPtr wall;
+ DMXConfigOptionPtr option;
+ DMXConfigParamPtr param;
+ struct _DMXConfigSub *next;
} DMXConfigSub, *DMXConfigSubPtr;
/** Stores parsed virtual information. */
typedef struct _DMXConfigVirtual {
- /* Summary information */
- const char *name;
- int width, height;
+ /* Summary information */
+ const char *name;
+ int width, height;
- /* Raw configuration information */
- DMXConfigTokenPtr start;
- DMXConfigStringPtr vname;
- DMXConfigPairPtr dim;
- DMXConfigTokenPtr open;
- DMXConfigSubPtr subentry;
- DMXConfigTokenPtr close;
+ /* Raw configuration information */
+ DMXConfigTokenPtr start;
+ DMXConfigStringPtr vname;
+ DMXConfigPairPtr dim;
+ DMXConfigTokenPtr open;
+ DMXConfigSubPtr subentry;
+ DMXConfigTokenPtr close;
} DMXConfigVirtual, *DMXConfigVirtualPtr;
/** Heads entry storage. */
typedef struct _DMXConfigEntry {
- DMXConfigType type;
- DMXConfigCommentPtr comment;
- DMXConfigVirtualPtr virtual;
- struct _DMXConfigEntry *next;
+ DMXConfigType type;
+ DMXConfigCommentPtr comment;
+ DMXConfigVirtualPtr virtual;
+ struct _DMXConfigEntry *next;
} DMXConfigEntry, *DMXConfigEntryPtr;
-extern DMXConfigEntryPtr dmxConfigEntry;
+extern DMXConfigEntryPtr dmxConfigEntry;
-extern int yylex(void);
-extern int yydebug;
-extern void yyerror(const char *message);
+extern int yylex(void);
+extern int yydebug;
+extern void yyerror(const char *message);
-extern void dmxConfigLog(const char *format, ...);
-extern void *dmxConfigAlloc(unsigned long bytes);
-extern void *dmxConfigRealloc(void *orig,
- unsigned long orig_bytes,
- unsigned long bytes);
-extern const char *dmxConfigCopyString(const char *string,
- int length);
-extern void dmxConfigFree(void *area);
-extern DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
- const char *comment);
-extern void dmxConfigFreeToken(DMXConfigTokenPtr p);
-extern DMXConfigStringPtr dmxConfigCreateString(int token, int line,
- const char *comment,
- const char *string);
-extern void dmxConfigFreeString(DMXConfigStringPtr p);
-extern DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line,
- const char *comment,
- int number);
-extern void dmxConfigFreeNumber(DMXConfigNumberPtr p);
-extern DMXConfigPairPtr dmxConfigCreatePair(int token, int line,
- const char *comment,
- int x, int y,
- int xsign, int ysign);
-extern void dmxConfigFreePair(DMXConfigPairPtr p);
+extern void dmxConfigLog(const char *format, ...);
+extern void *dmxConfigAlloc(unsigned long bytes);
+extern void *dmxConfigRealloc(void *orig,
+ unsigned long orig_bytes, unsigned long bytes);
+extern const char *dmxConfigCopyString(const char *string, int length);
+extern void dmxConfigFree(void *area);
+extern DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
+ const char *comment);
+extern void dmxConfigFreeToken(DMXConfigTokenPtr p);
+extern DMXConfigStringPtr dmxConfigCreateString(int token, int line,
+ const char *comment,
+ const char *string);
+extern void dmxConfigFreeString(DMXConfigStringPtr p);
+extern DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line,
+ const char *comment,
+ int number);
+extern void dmxConfigFreeNumber(DMXConfigNumberPtr p);
+extern DMXConfigPairPtr dmxConfigCreatePair(int token, int line,
+ const char *comment,
+ int x, int y, int xsign, int ysign);
+extern void dmxConfigFreePair(DMXConfigPairPtr p);
extern DMXConfigCommentPtr dmxConfigCreateComment(int token, int line,
const char *comment);
-extern void dmxConfigFreeComment(DMXConfigCommentPtr p);
+extern void dmxConfigFreeComment(DMXConfigCommentPtr p);
extern DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim,
DMXConfigPairPtr pOffset);
-extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p);
+extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p);
extern DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn,
DMXConfigPartDimPtr pRoot);
-extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p);
+extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p);
extern DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
DMXConfigStringPtr pName,
DMXConfigFullDimPtr pDim,
DMXConfigPairPtr pOrigin,
DMXConfigTokenPtr pEnd);
-extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p);
-extern DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart,
- DMXConfigPairPtr pWallDim,
- DMXConfigPairPtr pDisplayDim,
- DMXConfigStringPtr pNameList,
- DMXConfigTokenPtr pEnd);
-extern void dmxConfigFreeWall(DMXConfigWallPtr p);
-extern DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
- DMXConfigStringPtr pOption,
- DMXConfigTokenPtr pEnd);
-extern void dmxConfigFreeOption(DMXConfigOptionPtr p);
-extern DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart,
- DMXConfigTokenPtr pOpen,
- DMXConfigStringPtr pParam,
- DMXConfigTokenPtr pClose,
+extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p);
+extern DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart,
+ DMXConfigPairPtr pWallDim,
+ DMXConfigPairPtr pDisplayDim,
+ DMXConfigStringPtr pNameList,
+ DMXConfigTokenPtr pEnd);
+extern void dmxConfigFreeWall(DMXConfigWallPtr p);
+extern DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pOption,
DMXConfigTokenPtr pEnd);
-extern void dmxConfigFreeParam(DMXConfigParamPtr p);
-extern const char **dmxConfigLookupParam(DMXConfigParamPtr p,
- const char *key,
- int *argc);
-extern DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigDisplayPtr display,
- DMXConfigWallPtr wall,
- DMXConfigOptionPtr option,
- DMXConfigParamPtr param);
-extern void dmxConfigFreeSub(DMXConfigSubPtr sub);
-extern DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment);
-extern DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display);
-extern DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall);
-extern DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option);
-extern DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param);
-extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head,
- DMXConfigSubPtr sub);
+extern void dmxConfigFreeOption(DMXConfigOptionPtr p);
+extern DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart,
+ DMXConfigTokenPtr pOpen,
+ DMXConfigStringPtr pParam,
+ DMXConfigTokenPtr pClose,
+ DMXConfigTokenPtr pEnd);
+extern void dmxConfigFreeParam(DMXConfigParamPtr p);
+extern const char **dmxConfigLookupParam(DMXConfigParamPtr p,
+ const char *key, int *argc);
+extern DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigDisplayPtr display,
+ DMXConfigWallPtr wall,
+ DMXConfigOptionPtr option,
+ DMXConfigParamPtr param);
+extern void dmxConfigFreeSub(DMXConfigSubPtr sub);
+extern DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment);
+extern DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display);
+extern DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall);
+extern DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option);
+extern DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param);
+extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head,
+ DMXConfigSubPtr sub);
extern DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
DMXConfigStringPtr pName,
DMXConfigPairPtr pDim,
DMXConfigTokenPtr pOpen,
DMXConfigSubPtr pSubentry,
DMXConfigTokenPtr pClose);
-extern void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual);
-extern DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigVirtualPtr virtual);
-extern void dmxConfigFreeEntry(DMXConfigEntryPtr entry);
-extern DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head,
- DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigVirtualPtr virtual);
-extern DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment);
-extern DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual);
+extern void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual);
+extern DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigVirtualPtr virtual);
+extern void dmxConfigFreeEntry(DMXConfigEntryPtr entry);
+extern DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head,
+ DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigVirtualPtr virtual);
+extern DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment);
+extern DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual);
#endif
diff --git a/xorg-server/hw/dmx/config/dmxprint.c b/xorg-server/hw/dmx/config/dmxprint.c
index 599ebf5df..3145fb56a 100644
--- a/xorg-server/hw/dmx/config/dmxprint.c
+++ b/xorg-server/hw/dmx/config/dmxprint.c
@@ -52,100 +52,126 @@
#include <stdarg.h>
#include <ctype.h>
-static FILE *str = NULL;
-static int indent = 0;
-static int pos = 0;
+static FILE *str = NULL;
+static int indent = 0;
+static int pos = 0;
/** Stack of indentation information used for pretty-printing
* configuration information. */
static struct stack {
- int base;
- int comment;
- int step;
+ int base;
+ int comment;
+ int step;
struct stack *next;
-} *stack, initialStack = { 0, 0, 4, NULL };
+} *stack, initialStack = {
+0, 0, 4, NULL};
-static void dmxConfigIndent(void)
+static void
+dmxConfigIndent(void)
{
int i;
- if (indent < 0) indent = 0;
- if (indent > 40) indent = 40;
- for (i = 0; i < indent; i++) fprintf(str, " ");
+
+ if (indent < 0)
+ indent = 0;
+ if (indent > 40)
+ indent = 40;
+ for (i = 0; i < indent; i++)
+ fprintf(str, " ");
}
-static void dmxConfigNewline(void)
+static void
+dmxConfigNewline(void)
{
- if (pos) fprintf(str, "\n");
+ if (pos)
+ fprintf(str, "\n");
pos = 0;
}
-static void dmxConfigPushState(int base, int comment, int step)
+static void
+dmxConfigPushState(int base, int comment, int step)
{
struct stack *new = dmxConfigAlloc(sizeof(*new));
- new->base = base;
+
+ new->base = base;
new->comment = comment;
- new->step = step;
- new->next = stack;
- stack = new;
- indent = base;
+ new->step = step;
+ new->next = stack;
+ stack = new;
+ indent = base;
dmxConfigNewline();
}
-static void dmxConfigPushComment(void)
+static void
+dmxConfigPushComment(void)
{
- if (stack) indent = stack->comment;
+ if (stack)
+ indent = stack->comment;
}
-static void dmxConfigPushStep(void)
+static void
+dmxConfigPushStep(void)
{
- if (stack) indent = stack->step;
+ if (stack)
+ indent = stack->step;
}
-static void dmxConfigPopState(void)
+static void
+dmxConfigPopState(void)
{
struct stack *old = stack;
- if (!stack) return;
+ if (!stack)
+ return;
indent = old->base;
- stack = old->next;
- if (!stack) dmxConfigLog("Stack underflow\n");
+ stack = old->next;
+ if (!stack)
+ dmxConfigLog("Stack underflow\n");
dmxConfigFree(old);
dmxConfigNewline();
}
-static void dmxConfigOutput(int addSpace, int doNewline, const char *comment,
- const char *format, ...)
+static void
+dmxConfigOutput(int addSpace, int doNewline, const char *comment,
+ const char *format, ...)
{
va_list args;
- if (!pos) dmxConfigIndent();
- else if (addSpace) fprintf(str, " ");
+ if (!pos)
+ dmxConfigIndent();
+ else if (addSpace)
+ fprintf(str, " ");
if (format) {
va_start(args, format);
- /* RATS: This hasn't been audited -- it
- * could probably result in a buffer
- * overflow. */
- pos += vfprintf(str, format, args); /* assumes no newlines! */
+ /* RATS: This hasn't been audited -- it
+ * could probably result in a buffer
+ * overflow. */
+ pos += vfprintf(str, format, args); /* assumes no newlines! */
va_end(args);
}
if (comment) {
- if (pos) fprintf(str, " ");
+ if (pos)
+ fprintf(str, " ");
pos += fprintf(str, "#%s", comment);
dmxConfigNewline();
dmxConfigPushComment();
- } else if (doNewline) dmxConfigNewline();
+ }
+ else if (doNewline)
+ dmxConfigNewline();
}
-static void dmxConfigPrintComment(DMXConfigCommentPtr p)
+static void
+dmxConfigPrintComment(DMXConfigCommentPtr p)
{
dmxConfigOutput(1, 1, p->comment, NULL);
}
-static void dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag)
+static void
+dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag)
{
- if (!p) return;
+ if (!p)
+ return;
switch (p->token) {
case T_VIRTUAL:
dmxConfigPushState(0, 4, 4);
@@ -169,14 +195,16 @@ static void dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag)
break;
case ';':
dmxConfigOutput(0, 1, p->comment, ";");
- if (flag) dmxConfigPopState();
+ if (flag)
+ dmxConfigPopState();
break;
case '{':
dmxConfigOutput(1, 1, p->comment, "{");
dmxConfigPushStep();
break;
case '}':
- if (flag) dmxConfigPopState();
+ if (flag)
+ dmxConfigPopState();
dmxConfigOutput(0, 1, p->comment, "}");
break;
case '/':
@@ -187,49 +215,66 @@ static void dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag)
}
}
-static void dmxConfigPrintToken(DMXConfigTokenPtr p)
+static void
+dmxConfigPrintToken(DMXConfigTokenPtr p)
{
dmxConfigPrintTokenFlag(p, 1);
}
-static void dmxConfigPrintTokenNopop(DMXConfigTokenPtr p)
+static void
+dmxConfigPrintTokenNopop(DMXConfigTokenPtr p)
{
dmxConfigPrintTokenFlag(p, 0);
}
-static int dmxConfigPrintQuotedString(const char *s)
+static int
+dmxConfigPrintQuotedString(const char *s)
{
const char *pt;
- if (!s || !s[0]) return 1; /* Quote empty string */
- for (pt = s; *pt; ++pt) if (isspace(*pt)) return 1;
+ if (!s || !s[0])
+ return 1; /* Quote empty string */
+ for (pt = s; *pt; ++pt)
+ if (isspace(*pt))
+ return 1;
return 0;
}
-static void dmxConfigPrintString(DMXConfigStringPtr p, int quote)
+static void
+dmxConfigPrintString(DMXConfigStringPtr p, int quote)
{
DMXConfigStringPtr pt;
-
- if (!p) return;
+
+ if (!p)
+ return;
for (pt = p; pt; pt = pt->next) {
if (quote && dmxConfigPrintQuotedString(pt->string)) {
dmxConfigOutput(1, 0, pt->comment, "\"%s\"",
pt->string ? pt->string : "");
- } else
+ }
+ else
dmxConfigOutput(1, 0, pt->comment, "%s",
pt->string ? pt->string : "");
}
}
-static int dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace)
+static int
+dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace)
{
const char *format = NULL;
-
- if (!p) return 0;
+
+ if (!p)
+ return 0;
switch (p->token) {
- case T_ORIGIN: format = "@%dx%d"; break;
- case T_DIMENSION: format = "%dx%d"; break;
- case T_OFFSET: format = "%c%d%c%d"; break;
+ case T_ORIGIN:
+ format = "@%dx%d";
+ break;
+ case T_DIMENSION:
+ format = "%dx%d";
+ break;
+ case T_OFFSET:
+ format = "%c%d%c%d";
+ break;
}
if (p->token == T_OFFSET) {
if (!p->comment && !p->x && !p->y && p->xsign >= 0 && p->ysign >= 0)
@@ -237,69 +282,79 @@ static int dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace)
dmxConfigOutput(addSpace, 0, p->comment, format,
p->xsign < 0 ? '-' : '+', p->x,
p->ysign < 0 ? '-' : '+', p->y);
- } else {
- if (!p->comment && !p->x && !p->y) return 0;
+ }
+ else {
+ if (!p->comment && !p->x && !p->y)
+ return 0;
dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y);
}
return 1;
}
-static void dmxConfigPrintDisplay(DMXConfigDisplayPtr p)
+static void
+dmxConfigPrintDisplay(DMXConfigDisplayPtr p)
{
- DMXConfigToken dummyStart = { T_DISPLAY, 0, NULL };
- DMXConfigToken dummyEnd = { ';', 0, NULL };
- DMXConfigToken dummySep = { '/', 0, NULL };
- DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL };
- DMXConfigPair dummySDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 };
- DMXConfigPair dummySOffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 };
- DMXConfigPair dummyRDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 };
- DMXConfigPair dummyROffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 };
- DMXConfigPair dummyOrigin = { T_ORIGIN, 0, NULL, 0, 0, 0, 0 };
- int output;
-
- if (p->dname) p->dname->string = p->name;
- else dummyName.string = p->name;
-
+ DMXConfigToken dummyStart = { T_DISPLAY, 0, NULL };
+ DMXConfigToken dummyEnd = { ';', 0, NULL };
+ DMXConfigToken dummySep = { '/', 0, NULL };
+ DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL };
+ DMXConfigPair dummySDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummySOffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummyRDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummyROffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummyOrigin = { T_ORIGIN, 0, NULL, 0, 0, 0, 0 };
+ int output;
+
+ if (p->dname)
+ p->dname->string = p->name;
+ else
+ dummyName.string = p->name;
+
if (p->dim && p->dim->scrn && p->dim->scrn->dim) {
- p->dim->scrn->dim->x = p->scrnWidth;
- p->dim->scrn->dim->y = p->scrnHeight;
- } else {
- dummySDim.x = p->scrnWidth;
- dummySDim.y = p->scrnHeight;
+ p->dim->scrn->dim->x = p->scrnWidth;
+ p->dim->scrn->dim->y = p->scrnHeight;
+ }
+ else {
+ dummySDim.x = p->scrnWidth;
+ dummySDim.y = p->scrnHeight;
}
if (p->dim && p->dim->scrn && p->dim->scrn->offset) {
p->dim->scrn->offset->x = p->scrnX;
p->dim->scrn->offset->y = p->scrnY;
- } else {
- dummySOffset.x = p->scrnX;
- dummySOffset.y = p->scrnY;
}
-
+ else {
+ dummySOffset.x = p->scrnX;
+ dummySOffset.y = p->scrnY;
+ }
+
if (p->dim && p->dim->root && p->dim->root->dim) {
- p->dim->root->dim->x = p->rootWidth;
- p->dim->root->dim->y = p->rootHeight;
- } else {
- dummyRDim.x = p->rootWidth;
- dummyRDim.y = p->rootHeight;
+ p->dim->root->dim->x = p->rootWidth;
+ p->dim->root->dim->y = p->rootHeight;
+ }
+ else {
+ dummyRDim.x = p->rootWidth;
+ dummyRDim.y = p->rootHeight;
}
if (p->dim && p->dim->root && p->dim->root->offset) {
p->dim->root->offset->x = p->rootX;
p->dim->root->offset->y = p->rootY;
- } else {
- dummyROffset.x = p->rootX;
- dummyROffset.y = p->rootY;
+ }
+ else {
+ dummyROffset.x = p->rootX;
+ dummyROffset.y = p->rootY;
}
if (p->origin) {
- p->origin->x = p->rootXOrigin, p->origin->y = p->rootYOrigin;
- p->origin->xsign = p->rootXSign, p->origin->ysign = p->rootYSign;
- } else {
- dummyOrigin.x = p->rootXOrigin, dummyOrigin.y = p->rootYOrigin;
- dummyOrigin.xsign = p->rootXSign, dummyOrigin.ysign = p->rootYSign;
+ p->origin->x = p->rootXOrigin, p->origin->y = p->rootYOrigin;
+ p->origin->xsign = p->rootXSign, p->origin->ysign = p->rootYSign;
+ }
+ else {
+ dummyOrigin.x = p->rootXOrigin, dummyOrigin.y = p->rootYOrigin;
+ dummyOrigin.xsign = p->rootXSign, dummyOrigin.ysign = p->rootYSign;
}
-
+
dmxConfigPrintToken(p->start ? p->start : &dummyStart);
dmxConfigPrintString(p->dname ? p->dname : &dummyName, 1);
@@ -313,9 +368,7 @@ static void dmxConfigPrintDisplay(DMXConfigDisplayPtr p)
dmxConfigPrintPair(&dummySOffset, !output);
if (p->scrnWidth != p->rootWidth
- || p->scrnHeight != p->rootHeight
- || p->rootX
- || p->rootY) {
+ || p->scrnHeight != p->rootHeight || p->rootX || p->rootY) {
dmxConfigPrintToken(&dummySep);
if (p->dim && p->dim->root && p->dim->root->dim)
output = dmxConfigPrintPair(p->dim->root->dim, 1);
@@ -331,7 +384,8 @@ static void dmxConfigPrintDisplay(DMXConfigDisplayPtr p)
dmxConfigPrintToken(p->end ? p->end : &dummyEnd);
}
-static void dmxConfigPrintWall(DMXConfigWallPtr p)
+static void
+dmxConfigPrintWall(DMXConfigWallPtr p)
{
dmxConfigPrintToken(p->start);
dmxConfigPrintPair(p->wallDim, 1);
@@ -340,11 +394,12 @@ static void dmxConfigPrintWall(DMXConfigWallPtr p)
dmxConfigPrintToken(p->end);
}
-static void dmxConfigPrintOption(DMXConfigOptionPtr p)
+static void
+dmxConfigPrintOption(DMXConfigOptionPtr p)
{
- DMXConfigToken dummyStart = { T_OPTION, 0, NULL };
+ DMXConfigToken dummyStart = { T_OPTION, 0, NULL };
DMXConfigString dummyOption = { T_STRING, 0, NULL, NULL, NULL };
- DMXConfigToken dummyEnd = { ';', 0, NULL };
+ DMXConfigToken dummyEnd = { ';', 0, NULL };
dummyOption.string = p->string;
@@ -353,41 +408,59 @@ static void dmxConfigPrintOption(DMXConfigOptionPtr p)
dmxConfigPrintToken(p->end ? p->end : &dummyEnd);
}
-static void dmxConfigPrintParam(DMXConfigParamPtr p)
+static void
+dmxConfigPrintParam(DMXConfigParamPtr p)
{
- if (!p) return;
+ if (!p)
+ return;
if (p->start) {
if (p->open && p->close) {
dmxConfigPrintToken(p->start);
dmxConfigPrintToken(p->open);
dmxConfigPrintParam(p->next);
dmxConfigPrintToken(p->close);
- } else if (p->end && p->param) {
+ }
+ else if (p->end && p->param) {
dmxConfigPrintToken(p->start);
dmxConfigPrintString(p->param, 1);
dmxConfigPrintToken(p->end);
- } else
+ }
+ else
dmxConfigLog("dmxConfigPrintParam: cannot handle format (a)\n");
- } else if (p->end && p->param) {
+ }
+ else if (p->end && p->param) {
dmxConfigPrintString(p->param, 1);
dmxConfigPrintTokenNopop(p->end);
dmxConfigPrintParam(p->next);
- } else
+ }
+ else
dmxConfigLog("dmxConfigPrintParam: cannot handle format (b)\n");
}
-static void dmxConfigPrintSub(DMXConfigSubPtr p)
+static void
+dmxConfigPrintSub(DMXConfigSubPtr p)
{
DMXConfigSubPtr pt;
- if (!p) return;
+ if (!p)
+ return;
for (pt = p; pt; pt = pt->next) {
switch (pt->type) {
- case dmxConfigComment: dmxConfigPrintComment(pt->comment); break;
- case dmxConfigDisplay: dmxConfigPrintDisplay(pt->display); break;
- case dmxConfigWall: dmxConfigPrintWall(pt->wall); break;
- case dmxConfigOption: dmxConfigPrintOption(pt->option); break;
- case dmxConfigParam: dmxConfigPrintParam(pt->param); break;
+ case dmxConfigComment:
+ dmxConfigPrintComment(pt->comment);
+ break;
+ case dmxConfigDisplay:
+ dmxConfigPrintDisplay(pt->display);
+ break;
+ case dmxConfigWall:
+ dmxConfigPrintWall(pt->wall);
+ break;
+ case dmxConfigOption:
+ dmxConfigPrintOption(pt->option);
+ break;
+ case dmxConfigParam:
+ dmxConfigPrintParam(pt->param);
+ break;
default:
dmxConfigLog("dmxConfigPrintSub:"
" cannot handle type %d in subentry\n", pt->type);
@@ -395,20 +468,24 @@ static void dmxConfigPrintSub(DMXConfigSubPtr p)
}
}
-static void dmxConfigPrintVirtual(DMXConfigVirtualPtr p)
+static void
+dmxConfigPrintVirtual(DMXConfigVirtualPtr p)
{
- DMXConfigToken dummyStart = { T_VIRTUAL, 0, NULL };
- DMXConfigToken dummyOpen = { '{', 0, NULL };
- DMXConfigToken dummyClose = { '}', 0, NULL };
- DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL };
- DMXConfigPair dummyDim = { T_DIMENSION, 0, NULL, 0, 0 };
-
- if (p->vname) p->vname->string = p->name;
- else dummyName.string = p->name;
+ DMXConfigToken dummyStart = { T_VIRTUAL, 0, NULL };
+ DMXConfigToken dummyOpen = { '{', 0, NULL };
+ DMXConfigToken dummyClose = { '}', 0, NULL };
+ DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL };
+ DMXConfigPair dummyDim = { T_DIMENSION, 0, NULL, 0, 0 };
+
+ if (p->vname)
+ p->vname->string = p->name;
+ else
+ dummyName.string = p->name;
- if (p->dim) p->dim->x = p->width, p->dim->y = p->height;
- else dummyDim.x = p->width, dummyDim.y = p->height;
-
+ if (p->dim)
+ p->dim->x = p->width, p->dim->y = p->height;
+ else
+ dummyDim.x = p->width, dummyDim.y = p->height;
dmxConfigPrintToken(p->start ? p->start : &dummyStart);
dmxConfigPrintString(p->vname ? p->vname : &dummyName, 1);
@@ -420,36 +497,48 @@ static void dmxConfigPrintVirtual(DMXConfigVirtualPtr p)
/** The configuration information in \a entry will be pretty-printed to
* the \a stream. If \a stream is NULL, then stdout will be used. */
-void dmxConfigPrint(FILE *stream, DMXConfigEntryPtr entry)
+void
+dmxConfigPrint(FILE * stream, DMXConfigEntryPtr entry)
{
DMXConfigEntryPtr pt;
- if (!stream) str = stdout;
- else str = stream;
-
+ if (!stream)
+ str = stdout;
+ else
+ str = stream;
+
stack = &initialStack;
-
+
for (pt = entry; pt; pt = pt->next) {
switch (pt->type) {
- case dmxConfigComment: dmxConfigPrintComment(pt->comment); break;
- case dmxConfigVirtual: dmxConfigPrintVirtual(pt->virtual); break;
+ case dmxConfigComment:
+ dmxConfigPrintComment(pt->comment);
+ break;
+ case dmxConfigVirtual:
+ dmxConfigPrintVirtual(pt->virtual);
+ break;
default:
dmxConfigLog("dmxConfigPrint: cannot handle type %d in entry\n",
pt->type);
}
}
- if (pos) dmxConfigNewline();
+ if (pos)
+ dmxConfigNewline();
}
/** The configuration information in \a p will be pretty-printed to the
* \a stream. If \a stream is NULL, then stdout will be used. */
-void dmxConfigVirtualPrint(FILE *stream, DMXConfigVirtualPtr p)
+void
+dmxConfigVirtualPrint(FILE * stream, DMXConfigVirtualPtr p)
{
- if (!stream) str = stdout;
- else str = stream;
+ if (!stream)
+ str = stdout;
+ else
+ str = stream;
stack = &initialStack;
-
+
dmxConfigPrintVirtual(p);
- if (pos) dmxConfigNewline();
+ if (pos)
+ dmxConfigNewline();
}
diff --git a/xorg-server/hw/dmx/config/dmxtodmx.c b/xorg-server/hw/dmx/config/dmxtodmx.c
index 0d4ee4c09..66342091e 100644
--- a/xorg-server/hw/dmx/config/dmxtodmx.c
+++ b/xorg-server/hw/dmx/config/dmxtodmx.c
@@ -37,10 +37,11 @@
#include "dmxprint.h"
#include "dmxcompat.h"
-extern int yyparse(void);
-extern FILE *yyin;
+extern int yyparse(void);
+extern FILE *yyin;
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
yydebug = 0;
yyparse();
diff --git a/xorg-server/hw/dmx/config/vdltodmx.c b/xorg-server/hw/dmx/config/vdltodmx.c
index 69563f16c..007416b33 100644
--- a/xorg-server/hw/dmx/config/vdltodmx.c
+++ b/xorg-server/hw/dmx/config/vdltodmx.c
@@ -36,18 +36,20 @@
#include "dmxprint.h"
#include "dmxcompat.h"
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
DMXConfigEntryPtr entry;
- FILE *str;
+ FILE *str;
- if (argc != 2 && argc !=3) {
+ if (argc != 2 && argc != 3) {
fprintf(stderr, "Usage: vdltodmx inFile [outFile]\n");
return 1;
}
if (argc == 2) {
str = stdout;
- } else if (!(str = fopen(argv[2], "w"))) {
+ }
+ else if (!(str = fopen(argv[2], "w"))) {
fprintf(stderr, "Cannot open %s for write\n", argv[2]);
return 2;
}
diff --git a/xorg-server/hw/dmx/config/xdmxconfig.c b/xorg-server/hw/dmx/config/xdmxconfig.c
index 3165ba000..f30841244 100644
--- a/xorg-server/hw/dmx/config/xdmxconfig.c
+++ b/xorg-server/hw/dmx/config/xdmxconfig.c
@@ -34,7 +34,7 @@
#ifdef HAVE_DMX_CONFIG_H
#include <dmx-config.h>
#endif
-
+
#include <stdio.h>
#include <stdlib.h>
#include <X11/Intrinsic.h>
@@ -55,8 +55,8 @@
#include "dmxprint.h"
#include "dmxlog.h"
-extern int yyparse(void);
-extern FILE *yyin;
+extern int yyparse(void);
+extern FILE *yyin;
#define DMX_INFO "xdmxconfig v0.9\nCopyright 2002 Red Hat Inc.\n"
@@ -67,329 +67,379 @@ extern FILE *yyin;
#define DMX_CANVAS_WIDTH 400
#define DMX_CANVAS_HEIGHT 500
-DMXConfigEntryPtr dmxConfigEntry;
+DMXConfigEntryPtr dmxConfigEntry;
static DMXConfigVirtualPtr dmxConfigCurrent, dmxConfigNewVirtual;
static DMXConfigDisplayPtr dmxConfigCurrentDisplay, dmxConfigNewDisplay;
-static int dmxConfigGrabbed, dmxConfigGrabbedFine;
-static int dmxConfigGrabbedX, dmxConfigGrabbedY;
-static char *dmxConfigFilename;
-static GC dmxConfigGC, dmxConfigGCRev, dmxConfigGCHL;
-static int dmxConfigGCInit = 0;
-static Dimension dmxConfigWidgetWidth, dmxConfigWidgetHeight;
-static Dimension dmxConfigWallWidth, dmxConfigWallHeight;
-static double dmxConfigScaleX, dmxConfigScaleY;
-static int dmxConfigNotSaved;
+static int dmxConfigGrabbed, dmxConfigGrabbedFine;
+static int dmxConfigGrabbedX, dmxConfigGrabbedY;
+static char *dmxConfigFilename;
+static GC dmxConfigGC, dmxConfigGCRev, dmxConfigGCHL;
+static int dmxConfigGCInit = 0;
+static Dimension dmxConfigWidgetWidth, dmxConfigWidgetHeight;
+static Dimension dmxConfigWallWidth, dmxConfigWallHeight;
+static double dmxConfigScaleX, dmxConfigScaleY;
+static int dmxConfigNotSaved;
static enum {
dmxConfigStateOpen,
dmxConfigStateSave
-} dmxConfigState;
+} dmxConfigState;
/* Global widgets */
-static Widget canvas;
-static Widget cnamebox, cdimbox;
-static Widget openpopup, opendialog;
-static Widget namebox, dimbox, rtbox, origbox;
-static Widget okbutton, buttonpopup;
-static Widget ecbutton, dcbutton;
-static Widget ndbutton0, ndbutton1, edbutton, ddbutton;
-static Widget ecpopup, ecdialog0, ecdialog1;
-static Widget edpopup, eddialog0, eddialog1, eddialog2;
-static Widget aboutpopup, quitpopup;
-
-static void dmxConfigCanvasGCs(void)
+static Widget canvas;
+static Widget cnamebox, cdimbox;
+static Widget openpopup, opendialog;
+static Widget namebox, dimbox, rtbox, origbox;
+static Widget okbutton, buttonpopup;
+static Widget ecbutton, dcbutton;
+static Widget ndbutton0, ndbutton1, edbutton, ddbutton;
+static Widget ecpopup, ecdialog0, ecdialog1;
+static Widget edpopup, eddialog0, eddialog1, eddialog2;
+static Widget aboutpopup, quitpopup;
+
+static void
+dmxConfigCanvasGCs(void)
{
- Display *dpy = XtDisplay(canvas);
- Window win = XtWindow(canvas);
- XGCValues gcvals;
+ Display *dpy = XtDisplay(canvas);
+ Window win = XtWindow(canvas);
+ XGCValues gcvals;
unsigned long mask;
- Colormap colormap;
- XColor fg, bg, hl, tmp;
-
- if (dmxConfigGCInit++) return;
+ Colormap colormap;
+ XColor fg, bg, hl, tmp;
+
+ if (dmxConfigGCInit++)
+ return;
XtVaGetValues(canvas, XtNcolormap, &colormap, NULL);
XAllocNamedColor(XtDisplay(canvas), colormap, "black", &bg, &tmp);
XAllocNamedColor(XtDisplay(canvas), colormap, "white", &fg, &tmp);
- XAllocNamedColor(XtDisplay(canvas), colormap, "red", &hl, &tmp);
+ XAllocNamedColor(XtDisplay(canvas), colormap, "red", &hl, &tmp);
mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground |
GCBackground | GCLineWidth | GCLineStyle | GCCapStyle |
GCFillStyle);
- /* FIXME: copy this from widget */
- gcvals.function = GXcopy;
+ /* FIXME: copy this from widget */
+ gcvals.function = GXcopy;
gcvals.plane_mask = AllPlanes;
- gcvals.clip_mask = None;
+ gcvals.clip_mask = None;
gcvals.foreground = fg.pixel;
gcvals.background = bg.pixel;
gcvals.line_width = 0;
gcvals.line_style = LineSolid;
- gcvals.cap_style = CapNotLast;
+ gcvals.cap_style = CapNotLast;
gcvals.fill_style = FillSolid;
-
- dmxConfigGC = XCreateGC(dpy, win, mask, &gcvals);
+
+ dmxConfigGC = XCreateGC(dpy, win, mask, &gcvals);
gcvals.foreground = hl.pixel;
- dmxConfigGCHL = XCreateGC(dpy, win, mask, &gcvals);
+ dmxConfigGCHL = XCreateGC(dpy, win, mask, &gcvals);
gcvals.foreground = bg.pixel;
gcvals.background = fg.pixel;
- dmxConfigGCRev = XCreateGC(dpy, win, mask, &gcvals);
+ dmxConfigGCRev = XCreateGC(dpy, win, mask, &gcvals);
}
-static void dmxConfigGetDims(int *maxWidth, int *maxHeight)
+static void
+dmxConfigGetDims(int *maxWidth, int *maxHeight)
{
- DMXConfigSubPtr pt;
+ DMXConfigSubPtr pt;
DMXConfigEntryPtr e;
-
- *maxWidth = dmxConfigWallWidth = 0;
+
+ *maxWidth = dmxConfigWallWidth = 0;
*maxHeight = dmxConfigWallHeight = 0;
- if (!dmxConfigCurrent) return;
-
- dmxConfigWallWidth = dmxConfigCurrent->width;
+ if (!dmxConfigCurrent)
+ return;
+
+ dmxConfigWallWidth = dmxConfigCurrent->width;
dmxConfigWallHeight = dmxConfigCurrent->height;
if (!dmxConfigWallWidth || !dmxConfigWallHeight) {
for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
if (pt->type == dmxConfigDisplay) {
- int x = pt->display->scrnWidth + pt->display->rootXOrigin;
+ int x = pt->display->scrnWidth + pt->display->rootXOrigin;
int y = pt->display->scrnHeight + pt->display->rootYOrigin;
- if (x > dmxConfigWallWidth) dmxConfigWallWidth = x;
- if (y > dmxConfigWallHeight) dmxConfigWallHeight = y;
+
+ if (x > dmxConfigWallWidth)
+ dmxConfigWallWidth = x;
+ if (y > dmxConfigWallHeight)
+ dmxConfigWallHeight = y;
}
}
}
- /* Compute maximums */
+ /* Compute maximums */
*maxWidth = *maxHeight = 0;
for (e = dmxConfigEntry; e; e = e->next) {
- if (e->type != dmxConfigVirtual) continue;
+ if (e->type != dmxConfigVirtual)
+ continue;
for (pt = e->virtual->subentry; pt; pt = pt->next) {
if (pt->type == dmxConfigDisplay) {
- int x = pt->display->scrnWidth + pt->display->rootXOrigin;
+ int x = pt->display->scrnWidth + pt->display->rootXOrigin;
int y = pt->display->scrnHeight + pt->display->rootYOrigin;
- if (x > *maxWidth) *maxWidth = x;
- if (y > *maxHeight) *maxHeight = y;
+
+ if (x > *maxWidth)
+ *maxWidth = x;
+ if (y > *maxHeight)
+ *maxHeight = y;
}
}
}
- if (dmxConfigWallWidth > *maxWidth) *maxWidth = dmxConfigWallWidth;
- if (dmxConfigWallHeight > *maxHeight) *maxHeight = dmxConfigWallHeight;
+ if (dmxConfigWallWidth > *maxWidth)
+ *maxWidth = dmxConfigWallWidth;
+ if (dmxConfigWallHeight > *maxHeight)
+ *maxHeight = dmxConfigWallHeight;
+}
+
+static int
+scalex(int x)
+{
+ return (int) ((x * dmxConfigScaleX) + .5);
+}
+
+static int
+scaley(int y)
+{
+ return (int) ((y * dmxConfigScaleY) + .5);
+}
+
+static int
+unscalex(int x)
+{
+ return (int) ((x / dmxConfigScaleX) + .5);
}
-static int scalex(int x) { return (int)((x * dmxConfigScaleX) + .5); }
-static int scaley(int y) { return (int)((y * dmxConfigScaleY) + .5); }
-static int unscalex(int x) { return (int)((x / dmxConfigScaleX) + .5); }
-static int unscaley(int y) { return (int)((y / dmxConfigScaleY) + .5); }
+static int
+unscaley(int y)
+{
+ return (int) ((y / dmxConfigScaleY) + .5);
+}
-static void dmxConfigDataUpdate(void)
+static void
+dmxConfigDataUpdate(void)
{
- /* FIXME: could result in buffer overflows */
- char cnambuf[512];
- char cdimbuf[128];
- char nambuf[512];
- char dimbuf[128];
- char rtbuf[128];
- char offbuf[128];
+ /* FIXME: could result in buffer overflows */
+ char cnambuf[512];
+ char cdimbuf[128];
+ char nambuf[512];
+ char dimbuf[128];
+ char rtbuf[128];
+ char offbuf[128];
const char *name;
if (!dmxConfigCurrent) {
- XtVaSetValues(cnamebox, XtNlabel, "", XtNsensitive, False, NULL);
- XtVaSetValues(cdimbox, XtNlabel, "", XtNsensitive, False, NULL);
- XtVaSetValues(ecbutton, XtNsensitive, False, NULL);
- XtVaSetValues(dcbutton, XtNsensitive, False, NULL);
- XtVaSetValues(ndbutton0, XtNsensitive, False, NULL);
- XtVaSetValues(ndbutton1, XtNsensitive, False, NULL);
- } else {
+ XtVaSetValues(cnamebox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(cdimbox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(ecbutton, XtNsensitive, False, NULL);
+ XtVaSetValues(dcbutton, XtNsensitive, False, NULL);
+ XtVaSetValues(ndbutton0, XtNsensitive, False, NULL);
+ XtVaSetValues(ndbutton1, XtNsensitive, False, NULL);
+ }
+ else {
name = dmxConfigCurrent->name;
snprintf(cnambuf, sizeof(cnambuf), "%s", name ? name : "");
snprintf(cdimbuf, sizeof(cdimbuf), "%dx%d",
- dmxConfigWallWidth, dmxConfigWallHeight);
- XtVaSetValues(cnamebox, XtNlabel, cnambuf, XtNsensitive, True, NULL);
- XtVaSetValues(cdimbox, XtNlabel, cdimbuf, XtNsensitive, True, NULL);
- XtVaSetValues(ecbutton, XtNsensitive, True, NULL);
- XtVaSetValues(dcbutton, XtNsensitive, True, NULL);
- XtVaSetValues(ndbutton0, XtNsensitive, True, NULL);
- XtVaSetValues(ndbutton1, XtNsensitive, True, NULL);
+ dmxConfigWallWidth, dmxConfigWallHeight);
+ XtVaSetValues(cnamebox, XtNlabel, cnambuf, XtNsensitive, True, NULL);
+ XtVaSetValues(cdimbox, XtNlabel, cdimbuf, XtNsensitive, True, NULL);
+ XtVaSetValues(ecbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(dcbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(ndbutton0, XtNsensitive, True, NULL);
+ XtVaSetValues(ndbutton1, XtNsensitive, True, NULL);
}
-
+
if (!dmxConfigCurrentDisplay) {
XtVaSetValues(namebox, XtNlabel, "", XtNsensitive, False, NULL);
- XtVaSetValues(dimbox, XtNlabel, "", XtNsensitive, False, NULL);
- XtVaSetValues(rtbox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(dimbox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(rtbox, XtNlabel, "", XtNsensitive, False, NULL);
XtVaSetValues(origbox, XtNlabel, "", XtNsensitive, False, NULL);
- XtVaSetValues(edbutton, XtNsensitive, False, NULL);
- XtVaSetValues(ddbutton, XtNsensitive, False, NULL);
- } else {
+ XtVaSetValues(edbutton, XtNsensitive, False, NULL);
+ XtVaSetValues(ddbutton, XtNsensitive, False, NULL);
+ }
+ else {
name = dmxConfigCurrentDisplay->name;
snprintf(nambuf, sizeof(nambuf), "%s", name ? name : "");
snprintf(dimbuf, sizeof(dimbuf), "%dx%d%c%d%c%d",
- dmxConfigCurrentDisplay->scrnWidth,
- dmxConfigCurrentDisplay->scrnHeight,
- dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->scrnX,
- dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->scrnY);
+ dmxConfigCurrentDisplay->scrnWidth,
+ dmxConfigCurrentDisplay->scrnHeight,
+ dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnX,
+ dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnY);
snprintf(rtbuf, sizeof(dimbuf), "%dx%d%c%d%c%d",
- dmxConfigCurrentDisplay->rootWidth,
- dmxConfigCurrentDisplay->rootHeight,
- dmxConfigCurrentDisplay->rootXSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->rootX,
- dmxConfigCurrentDisplay->rootYSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->rootY);
+ dmxConfigCurrentDisplay->rootWidth,
+ dmxConfigCurrentDisplay->rootHeight,
+ dmxConfigCurrentDisplay->rootXSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->rootX,
+ dmxConfigCurrentDisplay->rootYSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->rootY);
snprintf(offbuf, sizeof(offbuf), "@%dx%d",
- dmxConfigCurrentDisplay->rootXOrigin,
- dmxConfigCurrentDisplay->rootYOrigin);
+ dmxConfigCurrentDisplay->rootXOrigin,
+ dmxConfigCurrentDisplay->rootYOrigin);
XtVaSetValues(namebox, XtNlabel, nambuf, XtNsensitive, True, NULL);
- XtVaSetValues(dimbox, XtNlabel, dimbuf, XtNsensitive, True, NULL);
- XtVaSetValues(rtbox, XtNlabel, rtbuf, XtNsensitive, True, NULL);
+ XtVaSetValues(dimbox, XtNlabel, dimbuf, XtNsensitive, True, NULL);
+ XtVaSetValues(rtbox, XtNlabel, rtbuf, XtNsensitive, True, NULL);
XtVaSetValues(origbox, XtNlabel, offbuf, XtNsensitive, True, NULL);
- XtVaSetValues(edbutton, XtNsensitive, True, NULL);
- XtVaSetValues(ddbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(edbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(ddbutton, XtNsensitive, True, NULL);
}
}
-static void dmxConfigCanvasUpdate(void)
+static void
+dmxConfigCanvasUpdate(void)
{
DMXConfigSubPtr pt;
- Display *dpy = XtDisplay(canvas);
- Window win = XtWindow(canvas);
- GContext gcontext = XGContextFromGC(dmxConfigGC);
- XFontStruct *fs;
- int w, h;
+ Display *dpy = XtDisplay(canvas);
+ Window win = XtWindow(canvas);
+ GContext gcontext = XGContextFromGC(dmxConfigGC);
+ XFontStruct *fs;
+ int w, h;
XFillRectangle(dpy, win, dmxConfigGCRev,
0, 0, dmxConfigWidgetWidth, dmxConfigWidgetHeight);
dmxConfigDataUpdate();
- if (!dmxConfigCurrent) return;
+ if (!dmxConfigCurrent)
+ return;
w = scalex(dmxConfigWallWidth);
h = scaley(dmxConfigWallHeight);
- if (w > dmxConfigWidgetWidth - 1) w = dmxConfigWidgetWidth - 1;
- if (h > dmxConfigWidgetHeight - 1) h = dmxConfigWidgetHeight - 1;
+ if (w > dmxConfigWidgetWidth - 1)
+ w = dmxConfigWidgetWidth - 1;
+ if (h > dmxConfigWidgetHeight - 1)
+ h = dmxConfigWidgetHeight - 1;
XDrawRectangle(dpy, win, dmxConfigGC, 0, 0, w, h);
fs = XQueryFont(dpy, gcontext);
for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
int x, y, len;
int xo = 3, yo = fs->ascent + fs->descent + 2;
- GC gc;
-
- if (pt->type != dmxConfigDisplay) continue;
- gc = (pt->display == dmxConfigCurrentDisplay
- ? dmxConfigGCHL
- : dmxConfigGC);
- x = scalex(pt->display->rootXOrigin);
- y = scaley(pt->display->rootYOrigin);
- w = scalex(pt->display->scrnWidth);
- h = scaley(pt->display->scrnHeight);
+ GC gc;
+
+ if (pt->type != dmxConfigDisplay)
+ continue;
+ gc = (pt->display == dmxConfigCurrentDisplay
+ ? dmxConfigGCHL : dmxConfigGC);
+ x = scalex(pt->display->rootXOrigin);
+ y = scaley(pt->display->rootYOrigin);
+ w = scalex(pt->display->scrnWidth);
+ h = scaley(pt->display->scrnHeight);
len = pt->display->name ? strlen(pt->display->name) : 0;
- if (x > dmxConfigWidgetWidth - 1) x = dmxConfigWidgetWidth - 1;
- if (y > dmxConfigWidgetHeight - 1) y = dmxConfigWidgetHeight - 1;
+ if (x > dmxConfigWidgetWidth - 1)
+ x = dmxConfigWidgetWidth - 1;
+ if (y > dmxConfigWidgetHeight - 1)
+ y = dmxConfigWidgetHeight - 1;
XDrawRectangle(dpy, win, gc, x, y, w, h);
if (fs && len) {
while (len && XTextWidth(fs, pt->display->name, len) >= w - 2 * xo)
--len;
if (len)
- XDrawString(dpy, win, gc, x+xo, y+yo, pt->display->name, len);
+ XDrawString(dpy, win, gc, x + xo, y + yo, pt->display->name,
+ len);
}
}
- if (fs) XFreeFontInfo(NULL, fs, 0);
+ if (fs)
+ XFreeFontInfo(NULL, fs, 0);
}
-static void dmxConfigCanvasDraw(Region region)
+static void
+dmxConfigCanvasDraw(Region region)
{
Display *dpy = XtDisplay(canvas);
- int maxWidth, maxHeight;
-
+ int maxWidth, maxHeight;
+
dmxConfigCanvasGCs();
if (region) {
- XSetRegion(dpy, dmxConfigGC, region);
+ XSetRegion(dpy, dmxConfigGC, region);
XSetRegion(dpy, dmxConfigGCRev, region);
- XSetRegion(dpy, dmxConfigGCHL, region);
+ XSetRegion(dpy, dmxConfigGCHL, region);
}
XtVaGetValues(canvas,
XtNwidth, &dmxConfigWidgetWidth,
- XtNheight, &dmxConfigWidgetHeight,
- NULL);
+ XtNheight, &dmxConfigWidgetHeight, NULL);
dmxConfigGetDims(&maxWidth, &maxHeight);
- dmxConfigScaleX = (double)dmxConfigWidgetWidth / maxWidth;
- dmxConfigScaleY = (double)dmxConfigWidgetHeight / maxHeight;
- if (dmxConfigScaleX > dmxConfigScaleY) dmxConfigScaleX = dmxConfigScaleY;
- if (dmxConfigScaleY > dmxConfigScaleX) dmxConfigScaleY = dmxConfigScaleX;
+ dmxConfigScaleX = (double) dmxConfigWidgetWidth / maxWidth;
+ dmxConfigScaleY = (double) dmxConfigWidgetHeight / maxHeight;
+ if (dmxConfigScaleX > dmxConfigScaleY)
+ dmxConfigScaleX = dmxConfigScaleY;
+ if (dmxConfigScaleY > dmxConfigScaleX)
+ dmxConfigScaleY = dmxConfigScaleX;
dmxConfigCanvasUpdate();
if (region) {
- XSetClipMask(dpy, dmxConfigGC, None);
+ XSetClipMask(dpy, dmxConfigGC, None);
XSetClipMask(dpy, dmxConfigGCRev, None);
- XSetClipMask(dpy, dmxConfigGCHL, None);
+ XSetClipMask(dpy, dmxConfigGCHL, None);
}
}
-static void dmxConfigSelectCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigSelectCallback(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigCurrent = closure;
dmxConfigVirtualPrint(stdout, dmxConfigCurrent);
dmxConfigCanvasDraw(NULL);
}
-static void dmxConfigCopystrings(void)
+static void
+dmxConfigCopystrings(void)
{
DMXConfigEntryPtr pt;
- DMXConfigSubPtr sub;
+ DMXConfigSubPtr sub;
- if (!dmxConfigCurrent) return;
+ if (!dmxConfigCurrent)
+ return;
- /* FIXME: this is all a per-config file
- * memory leak */
+ /* FIXME: this is all a per-config file
+ * memory leak */
for (pt = dmxConfigEntry; pt; pt = pt->next) {
if (pt->type == dmxConfigVirtual) {
pt->virtual->name = XtNewString(pt->virtual->name
- ? pt->virtual->name
- : "");
+ ? pt->virtual->name : "");
for (sub = pt->virtual->subentry; sub; sub = sub->next) {
- if (sub->type != dmxConfigDisplay) continue;
+ if (sub->type != dmxConfigDisplay)
+ continue;
sub->display->name = XtNewString(sub->display->name
- ? sub->display->name
- : "");
+ ? sub->display->name : "");
}
}
}
}
-static void dmxConfigGetValueString(char **d, Widget w)
+static void
+dmxConfigGetValueString(char **d, Widget w)
{
const char *tmp = XawDialogGetValueString(w);
- if (*d) XtFree(*d);
+
+ if (*d)
+ XtFree(*d);
*d = XtNewString(tmp);
}
-static void dmxConfigSetupCnamemenu(void)
+static void
+dmxConfigSetupCnamemenu(void)
{
- static Widget cnamemenu = NULL;
- Widget w;
+ static Widget cnamemenu = NULL;
+ Widget w;
DMXConfigEntryPtr pt;
- if (cnamemenu) XtDestroyWidget(cnamemenu);
+ if (cnamemenu)
+ XtDestroyWidget(cnamemenu);
cnamemenu = NULL;
- if (!dmxConfigCurrent) return;
+ if (!dmxConfigCurrent)
+ return;
cnamemenu = XtVaCreatePopupShell("cnamemenu", simpleMenuWidgetClass,
- cnamebox,
- NULL);
-
+ cnamebox, NULL);
+
for (pt = dmxConfigEntry; pt; pt = pt->next) {
if (pt->type == dmxConfigVirtual) {
w = XtVaCreateManagedWidget(pt->virtual->name
? pt->virtual->name
: "",
- smeBSBObjectClass, cnamemenu,
- NULL);
- XtAddCallback(w, XtNcallback,
- dmxConfigSelectCallback, pt->virtual);
+ smeBSBObjectClass, cnamemenu, NULL);
+ XtAddCallback(w, XtNcallback, dmxConfigSelectCallback, pt->virtual);
}
}
}
-static void dmxConfigReadFile(void)
+static void
+dmxConfigReadFile(void)
{
- FILE *str;
+ FILE *str;
DMXConfigEntryPtr pt;
if (!(str = fopen(dmxConfigFilename, "r"))) {
@@ -397,7 +447,7 @@ static void dmxConfigReadFile(void)
dmxConfigFilename);
return;
}
- yyin = str;
+ yyin = str;
yydebug = 0;
yyparse();
fclose(str);
@@ -410,8 +460,6 @@ static void dmxConfigReadFile(void)
}
}
-
-
if (XtIsRealized(canvas)) {
dmxConfigCopystrings();
dmxConfigSetupCnamemenu();
@@ -420,9 +468,10 @@ static void dmxConfigReadFile(void)
dmxConfigVirtualPrint(stdout, dmxConfigCurrent);
}
-static void dmxConfigWriteFile(void)
+static void
+dmxConfigWriteFile(void)
{
- FILE *str;
+ FILE *str;
if (!(str = fopen(dmxConfigFilename, "w"))) {
dmxLog(dmxWarning, "Unable to write configuration file %s\n",
@@ -433,31 +482,36 @@ static void dmxConfigWriteFile(void)
fclose(str);
}
-static DMXConfigDisplayPtr dmxConfigFindDisplay(int x, int y)
+static DMXConfigDisplayPtr
+dmxConfigFindDisplay(int x, int y)
{
DMXConfigSubPtr pt;
- if (!dmxConfigCurrent) return NULL;
+ if (!dmxConfigCurrent)
+ return NULL;
for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
DMXConfigDisplayPtr d = pt->display;
- if (pt->type != dmxConfigDisplay) continue;
+
+ if (pt->type != dmxConfigDisplay)
+ continue;
if (x >= scalex(d->rootXOrigin)
&& x <= scalex(d->rootXOrigin + d->scrnWidth)
&& y >= scaley(d->rootYOrigin)
- && y <= scaley(d->rootYOrigin + d->scrnHeight)) return d;
+ && y <= scaley(d->rootYOrigin + d->scrnHeight))
+ return d;
}
return NULL;
}
-static void dmxConfigSetPopupPosition(Widget popup)
+static void
+dmxConfigSetPopupPosition(Widget popup)
{
- Position x, y;
- Window t1, t2;
- int root_x, root_y;
- int temp_x, temp_y;
+ Position x, y;
+ Window t1, t2;
+ int root_x, root_y;
+ int temp_x, temp_y;
unsigned int temp;
-
XtRealizeWidget(popup);
if (!XQueryPointer(XtDisplay(popup), XtWindow(popup), &t1, &t2,
&root_x, &root_y, &temp_x, &temp_y, &temp))
@@ -468,13 +522,15 @@ static void dmxConfigSetPopupPosition(Widget popup)
XtVaSetValues(popup, XtNx, x, XtNy, y, NULL);
}
-static void dmxConfigPlaceMenu(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
+static void
+dmxConfigPlaceMenu(Widget w, XEvent * event,
+ String * params, Cardinal * num_params)
{
dmxConfigSetPopupPosition(buttonpopup);
}
-static void dmxConfigMove(int deltaX, int deltaY)
+static void
+dmxConfigMove(int deltaX, int deltaY)
{
dmxConfigCurrentDisplay->rootXOrigin += deltaX;
dmxConfigCurrentDisplay->rootYOrigin += deltaY;
@@ -492,40 +548,44 @@ static void dmxConfigMove(int deltaX, int deltaY)
dmxConfigNotSaved = 1;
}
-static void dmxConfigCanvasInput(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigCanvasInput(Widget w, XtPointer closure, XtPointer callData)
{
- XEvent *e = (XEvent *)callData;
+ XEvent *e = (XEvent *) callData;
DMXConfigDisplayPtr display = NULL;
switch (e->type) {
case ButtonPress:
if (e->xbutton.button == Button1) {
- dmxConfigGrabbed = 1;
+ dmxConfigGrabbed = 1;
dmxConfigGrabbedFine = 0;
- dmxConfigGrabbedX = e->xbutton.x;
- dmxConfigGrabbedY = e->xbutton.y;
+ dmxConfigGrabbedX = e->xbutton.x;
+ dmxConfigGrabbedY = e->xbutton.y;
}
if (e->xbutton.button == Button2) {
- dmxConfigGrabbed = 1;
+ dmxConfigGrabbed = 1;
dmxConfigGrabbedFine = 1;
- dmxConfigGrabbedX = e->xbutton.x;
- dmxConfigGrabbedY = e->xbutton.y;
+ dmxConfigGrabbedX = e->xbutton.x;
+ dmxConfigGrabbedY = e->xbutton.y;
}
break;
case ButtonRelease:
- if (e->xbutton.button == Button1) dmxConfigGrabbed = 0;
- if (e->xbutton.button == Button2) dmxConfigGrabbed = 0;
+ if (e->xbutton.button == Button1)
+ dmxConfigGrabbed = 0;
+ if (e->xbutton.button == Button2)
+ dmxConfigGrabbed = 0;
break;
case MotionNotify:
if (dmxConfigGrabbed && dmxConfigCurrentDisplay) {
int deltaX = e->xmotion.x - dmxConfigGrabbedX;
int deltaY = e->xmotion.y - dmxConfigGrabbedY;
+
dmxConfigMove(dmxConfigGrabbedFine ? deltaX : unscalex(deltaX),
dmxConfigGrabbedFine ? deltaY : unscaley(deltaY));
dmxConfigGrabbedX = e->xmotion.x;
dmxConfigGrabbedY = e->xmotion.y;
- } else {
+ }
+ else {
display = dmxConfigFindDisplay(e->xmotion.x, e->xmotion.y);
if (display != dmxConfigCurrentDisplay) {
dmxConfigCurrentDisplay = display;
@@ -535,31 +595,39 @@ static void dmxConfigCanvasInput(Widget w, XtPointer closure,
break;
case KeyPress:
switch (XLookupKeysym(&e->xkey, 0)) {
- case XK_Right: dmxConfigMove(1,0); break;
- case XK_Left: dmxConfigMove(-1,0); break;
- case XK_Down: dmxConfigMove(0,1); break;
- case XK_Up: dmxConfigMove(0,-1); break;
+ case XK_Right:
+ dmxConfigMove(1, 0);
+ break;
+ case XK_Left:
+ dmxConfigMove(-1, 0);
+ break;
+ case XK_Down:
+ dmxConfigMove(0, 1);
+ break;
+ case XK_Up:
+ dmxConfigMove(0, -1);
+ break;
}
break;
}
}
-static void dmxConfigCanvasResize(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigCanvasResize(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigCanvasDraw(NULL);
}
-static void dmxConfigCanvasExpose(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigCanvasExpose(Widget w, XtPointer closure, XtPointer callData)
{
- CanvasExposeDataPtr data = (CanvasExposeDataPtr)callData;
+ CanvasExposeDataPtr data = (CanvasExposeDataPtr) callData;
dmxConfigCanvasDraw(data->region);
}
-static void dmxConfigOpenCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigOpenCallback(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigState = dmxConfigStateOpen;
XtVaSetValues(okbutton, XtNlabel, "Open", NULL);
@@ -567,8 +635,8 @@ static void dmxConfigOpenCallback(Widget w, XtPointer closure,
XtPopup(openpopup, XtGrabExclusive);
}
-static void dmxConfigSaveCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigSaveCallback(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigState = dmxConfigStateSave;
XtVaSetValues(okbutton, XtNlabel, "Save", NULL);
@@ -576,69 +644,73 @@ static void dmxConfigSaveCallback(Widget w, XtPointer closure,
XtPopup(openpopup, XtGrabExclusive);
}
-static void dmxConfigOkCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigOkCallback(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigGetValueString(&dmxConfigFilename, opendialog);
XtPopdown(openpopup);
- if (dmxConfigState == dmxConfigStateOpen) dmxConfigReadFile();
- else dmxConfigWriteFile();
+ if (dmxConfigState == dmxConfigStateOpen)
+ dmxConfigReadFile();
+ else
+ dmxConfigWriteFile();
dmxConfigNotSaved = 0;
}
-static void dmxConfigCanCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigCanCallback(Widget w, XtPointer closure, XtPointer callData)
{
XtPopdown(openpopup);
}
-static void dmxConfigECCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigECCallback(Widget w, XtPointer closure, XtPointer callData)
{
char buf[256]; /* RATS: Only used in snprintf */
-
- if (!dmxConfigCurrent) return;
+
+ if (!dmxConfigCurrent)
+ return;
dmxConfigSetPopupPosition(ecpopup);
XtVaSetValues(ecdialog0, XtNvalue,
- dmxConfigCurrent->name ? dmxConfigCurrent->name : "",
- NULL);
+ dmxConfigCurrent->name ? dmxConfigCurrent->name : "", NULL);
snprintf(buf, sizeof(buf), "%dx%d",
- dmxConfigCurrent->width, dmxConfigCurrent->height);
+ dmxConfigCurrent->width, dmxConfigCurrent->height);
XtVaSetValues(ecdialog1, XtNvalue, buf, NULL);
XtPopup(ecpopup, XtGrabExclusive);
}
-static void dmxConfigNCCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigNCCallback(Widget w, XtPointer closure, XtPointer callData)
{
- int width = 1280*2, height = 1024*2;
+ int width = 1280 * 2, height = 1024 * 2;
if (dmxConfigCurrent) {
- width = dmxConfigCurrent->width;
+ width = dmxConfigCurrent->width;
height = dmxConfigCurrent->height;
}
- dmxConfigCurrent = dmxConfigCreateVirtual(NULL, NULL, NULL,
- NULL, NULL, NULL);
- dmxConfigNewVirtual = dmxConfigCurrent;
- dmxConfigCurrent->width = width;
+ dmxConfigCurrent = dmxConfigCreateVirtual(NULL, NULL, NULL,
+ NULL, NULL, NULL);
+ dmxConfigNewVirtual = dmxConfigCurrent;
+ dmxConfigCurrent->width = width;
dmxConfigCurrent->height = height;
dmxConfigEntry = dmxConfigAddEntry(dmxConfigEntry, dmxConfigVirtual, NULL,
dmxConfigCurrent);
dmxConfigECCallback(w, closure, callData);
}
-static void dmxConfigDCCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigDCCallback(Widget w, XtPointer closure, XtPointer callData)
{
DMXConfigEntryPtr pt;
- if (!dmxConfigEntry) return;
+ if (!dmxConfigEntry)
+ return;
if (dmxConfigEntry
&& dmxConfigEntry->type == dmxConfigVirtual
&& dmxConfigEntry->virtual == dmxConfigCurrent) {
dmxConfigEntry = dmxConfigEntry->next;
- } else {
+ }
+ else {
for (pt = dmxConfigEntry; pt && pt->next; pt = pt->next)
if (pt->next->type == dmxConfigVirtual
&& pt->next->virtual == dmxConfigCurrent) {
@@ -647,10 +719,10 @@ static void dmxConfigDCCallback(Widget w, XtPointer closure,
}
}
dmxConfigFreeVirtual(dmxConfigCurrent);
- dmxConfigCurrent = NULL;
+ dmxConfigCurrent = NULL;
dmxConfigCurrentDisplay = NULL;
- /* Make the first entry current */
+ /* Make the first entry current */
for (pt = dmxConfigEntry; pt; pt = pt->next) {
if (pt->type == dmxConfigVirtual) {
dmxConfigCurrent = pt->virtual;
@@ -662,93 +734,96 @@ static void dmxConfigDCCallback(Widget w, XtPointer closure,
dmxConfigCanvasDraw(NULL);
}
-static void dmxConfigECOkCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigECOkCallback(Widget w, XtPointer closure, XtPointer callData)
{
const char *value;
- char *endpt;
+ char *endpt;
- dmxConfigGetValueString((char **)&dmxConfigCurrent->name, ecdialog0);
- value = XawDialogGetValueString(ecdialog1);
- dmxConfigCurrent->width = strtol(value, &endpt, 10);
- dmxConfigCurrent->height = strtol(endpt+1, NULL, 10);
+ dmxConfigGetValueString((char **) &dmxConfigCurrent->name, ecdialog0);
+ value = XawDialogGetValueString(ecdialog1);
+ dmxConfigCurrent->width = strtol(value, &endpt, 10);
+ dmxConfigCurrent->height = strtol(endpt + 1, NULL, 10);
XtPopdown(ecpopup);
dmxConfigCurrentDisplay = NULL;
- dmxConfigNewVirtual = NULL;
+ dmxConfigNewVirtual = NULL;
dmxConfigSetupCnamemenu();
dmxConfigCanvasDraw(NULL);
dmxConfigNotSaved = 1;
}
-static void dmxConfigECCanCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigECCanCallback(Widget w, XtPointer closure, XtPointer callData)
{
- if (dmxConfigNewVirtual) dmxConfigDCCallback(w, closure, callData);
- dmxConfigNewVirtual = NULL;
+ if (dmxConfigNewVirtual)
+ dmxConfigDCCallback(w, closure, callData);
+ dmxConfigNewVirtual = NULL;
XtPopdown(ecpopup);
}
-static void dmxConfigEDCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigEDCallback(Widget w, XtPointer closure, XtPointer callData)
{
char buf[256]; /* RATS: Only used in snprintf */
-
- if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) return;
+
+ if (!dmxConfigCurrent || !dmxConfigCurrentDisplay)
+ return;
dmxConfigSetPopupPosition(edpopup);
XtVaSetValues(eddialog0, XtNvalue,
dmxConfigCurrentDisplay->name
- ? dmxConfigCurrentDisplay->name
- : "",
- NULL);
+ ? dmxConfigCurrentDisplay->name : "", NULL);
snprintf(buf, sizeof(buf), "%dx%d%c%d%c%d",
- dmxConfigCurrentDisplay->scrnWidth,
- dmxConfigCurrentDisplay->scrnHeight,
- dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->scrnY,
- dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->scrnY);
+ dmxConfigCurrentDisplay->scrnWidth,
+ dmxConfigCurrentDisplay->scrnHeight,
+ dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnY,
+ dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnY);
XtVaSetValues(eddialog1, XtNvalue, buf, NULL);
snprintf(buf, sizeof(buf), "@%dx%d",
- dmxConfigCurrentDisplay->rootXOrigin,
- dmxConfigCurrentDisplay->rootYOrigin);
+ dmxConfigCurrentDisplay->rootXOrigin,
+ dmxConfigCurrentDisplay->rootYOrigin);
XtVaSetValues(eddialog2, XtNvalue, buf, NULL);
XtPopup(edpopup, XtGrabExclusive);
}
-static void dmxConfigNDCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigNDCallback(Widget w, XtPointer closure, XtPointer callData)
{
int width = 1280, height = 1024;
- if (!dmxConfigCurrent) return;
+ if (!dmxConfigCurrent)
+ return;
if (dmxConfigCurrentDisplay) {
- width = dmxConfigCurrentDisplay->scrnWidth;
+ width = dmxConfigCurrentDisplay->scrnWidth;
height = dmxConfigCurrentDisplay->scrnHeight;
}
dmxConfigCurrentDisplay = dmxConfigCreateDisplay(NULL, NULL, NULL,
NULL, NULL);
- dmxConfigNewDisplay = dmxConfigCurrentDisplay;
- dmxConfigCurrentDisplay->scrnWidth = width;
+ dmxConfigNewDisplay = dmxConfigCurrentDisplay;
+ dmxConfigCurrentDisplay->scrnWidth = width;
dmxConfigCurrentDisplay->scrnHeight = height;
-
+
dmxConfigCurrent->subentry
= dmxConfigAddSub(dmxConfigCurrent->subentry,
dmxConfigSubDisplay(dmxConfigCurrentDisplay));
dmxConfigEDCallback(w, closure, callData);
}
-static void dmxConfigDDCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigDDCallback(Widget w, XtPointer closure, XtPointer callData)
{
DMXConfigSubPtr pt;
- if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) return;
- /* First */
+ if (!dmxConfigCurrent || !dmxConfigCurrentDisplay)
+ return;
+ /* First */
if (dmxConfigCurrent->subentry
&& dmxConfigCurrent->subentry->type == dmxConfigDisplay
&& dmxConfigCurrent->subentry->display == dmxConfigCurrentDisplay) {
dmxConfigCurrent->subentry = dmxConfigCurrent->subentry->next;
- } else {
+ }
+ else {
for (pt = dmxConfigCurrent->subentry; pt && pt->next; pt = pt->next)
if (pt->next->type == dmxConfigDisplay
&& pt->next->display == dmxConfigCurrentDisplay) {
@@ -762,21 +837,21 @@ static void dmxConfigDDCallback(Widget w, XtPointer closure,
dmxConfigCanvasDraw(NULL);
}
-static void dmxConfigAboutCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigAboutCallback(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigSetPopupPosition(aboutpopup);
XtPopup(aboutpopup, XtGrabExclusive);
}
-static void dmxConfigAboutOkCallback(Widget w, XtPointer closure,
- XtPointer CallData)
+static void
+dmxConfigAboutOkCallback(Widget w, XtPointer closure, XtPointer CallData)
{
XtPopdown(aboutpopup);
}
-static void dmxConfigQuitCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigQuitCallback(Widget w, XtPointer closure, XtPointer callData)
{
if (dmxConfigNotSaved) {
dmxConfigSetPopupPosition(quitpopup);
@@ -786,77 +861,82 @@ static void dmxConfigQuitCallback(Widget w, XtPointer closure,
exit(0);
}
-static void dmxConfigQuitOkCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigQuitOkCallback(Widget w, XtPointer closure, XtPointer callData)
{
XtPopdown(quitpopup);
exit(0);
}
-static void dmxConfigQuitCanCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigQuitCanCallback(Widget w, XtPointer closure, XtPointer callData)
{
XtPopdown(quitpopup);
}
-static void dmxConfigEDOkCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigEDOkCallback(Widget w, XtPointer closure, XtPointer callData)
{
char *value;
char *endpt;
-
+
dmxConfigNewDisplay = NULL;
- dmxConfigGetValueString((char **)&dmxConfigCurrentDisplay->name,
+ dmxConfigGetValueString((char **) &dmxConfigCurrentDisplay->name,
eddialog0);
- value = XawDialogGetValueString(eddialog1);
+ value = XawDialogGetValueString(eddialog1);
if (*value == '-' || *value == '+') {
- dmxConfigCurrentDisplay->scrnWidth = 0;
+ dmxConfigCurrentDisplay->scrnWidth = 0;
dmxConfigCurrentDisplay->scrnHeight = 0;
- endpt = value;
- } else {
- dmxConfigCurrentDisplay->scrnWidth = strtol(value, &endpt, 10);
- dmxConfigCurrentDisplay->scrnHeight = strtol(endpt+1, &endpt, 10);
+ endpt = value;
+ }
+ else {
+ dmxConfigCurrentDisplay->scrnWidth = strtol(value, &endpt, 10);
+ dmxConfigCurrentDisplay->scrnHeight = strtol(endpt + 1, &endpt, 10);
}
if (*endpt) {
- dmxConfigCurrentDisplay->scrnXSign = (*endpt == '-') ? -1 : 1;
- dmxConfigCurrentDisplay->scrnX = strtol(endpt+1, &endpt, 10);
- dmxConfigCurrentDisplay->scrnYSign = (*endpt == '-') ? -1 : 1;
- dmxConfigCurrentDisplay->scrnY = strtol(endpt+1, NULL, 10);
+ dmxConfigCurrentDisplay->scrnXSign = (*endpt == '-') ? -1 : 1;
+ dmxConfigCurrentDisplay->scrnX = strtol(endpt + 1, &endpt, 10);
+ dmxConfigCurrentDisplay->scrnYSign = (*endpt == '-') ? -1 : 1;
+ dmxConfigCurrentDisplay->scrnY = strtol(endpt + 1, NULL, 10);
}
if (dmxConfigCurrentDisplay->scrnX < 0)
dmxConfigCurrentDisplay->scrnX = -dmxConfigCurrentDisplay->scrnX;
if (dmxConfigCurrentDisplay->scrnY < 0)
dmxConfigCurrentDisplay->scrnY = -dmxConfigCurrentDisplay->scrnY;
- value = XawDialogGetValueString(eddialog2);
- dmxConfigCurrentDisplay->rootXOrigin = strtol(value+1, &endpt, 10);
- dmxConfigCurrentDisplay->rootYOrigin = strtol(endpt+1, NULL, 10);
+ value = XawDialogGetValueString(eddialog2);
+ dmxConfigCurrentDisplay->rootXOrigin = strtol(value + 1, &endpt, 10);
+ dmxConfigCurrentDisplay->rootYOrigin = strtol(endpt + 1, NULL, 10);
XtPopdown(edpopup);
dmxConfigSetupCnamemenu();
dmxConfigCanvasDraw(NULL);
dmxConfigNotSaved = 1;
}
-static void dmxConfigEDCanCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigEDCanCallback(Widget w, XtPointer closure, XtPointer callData)
{
- if (dmxConfigNewDisplay) dmxConfigDDCallback(w, closure, callData);
+ if (dmxConfigNewDisplay)
+ dmxConfigDDCallback(w, closure, callData);
dmxConfigNewDisplay = NULL;
XtPopdown(edpopup);
}
-static void dmxConfigOkAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
+static void
+dmxConfigOkAction(Widget w, XEvent * event,
+ String * params, Cardinal * num_params)
{
Widget p = XtParent(w);
Widget t;
- if (p == opendialog) dmxConfigOkCallback(w, NULL, NULL);
+ if (p == opendialog)
+ dmxConfigOkCallback(w, NULL, NULL);
if (p == ecdialog0) {
t = XtNameToWidget(ecdialog1, "value");
XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10);
}
- if (p == ecdialog1) dmxConfigECOkCallback(w, NULL, NULL);
+ if (p == ecdialog1)
+ dmxConfigECOkCallback(w, NULL, NULL);
if (p == eddialog0) {
t = XtNameToWidget(eddialog1, "value");
@@ -866,322 +946,285 @@ static void dmxConfigOkAction(Widget w, XEvent *event,
t = XtNameToWidget(eddialog2, "value");
XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10);
}
- if (p == eddialog2) dmxConfigEDOkCallback(w, NULL, NULL);
+ if (p == eddialog2)
+ dmxConfigEDOkCallback(w, NULL, NULL);
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- XtAppContext appContext;
- Widget toplevel;
- Widget parent, menubox, bottombox, databox, canvasbox;
- Widget filebutton, helpbutton;
- Widget filemenu, openbutton, savebutton, quitbutton;
- Widget helpmenu, aboutbutton, aboutbox, aboutok;
- Widget quitbox, quitok, quitcan;
- Widget ncbutton;
- Widget canbutton;
- Widget ecbox, ecokbutton, eccanbutton;
- Widget edbox, edokbutton;
- Widget edcanbutton;
- /* FIXME: add meta-i, ctrl,meta-z,v? */
- const char *opentrans = "<Key>Return: openOk()\n\
+ XtAppContext appContext;
+ Widget toplevel;
+ Widget parent, menubox, bottombox, databox, canvasbox;
+ Widget filebutton, helpbutton;
+ Widget filemenu, openbutton, savebutton, quitbutton;
+ Widget helpmenu, aboutbutton, aboutbox, aboutok;
+ Widget quitbox, quitok, quitcan;
+ Widget ncbutton;
+ Widget canbutton;
+ Widget ecbox, ecokbutton, eccanbutton;
+ Widget edbox, edokbutton;
+ Widget edcanbutton;
+
+ /* FIXME: add meta-i, ctrl,meta-z,v? */
+ const char *opentrans = "<Key>Return: openOk()\n\
<Key>Linefeed: openOk()\n\
Ctrl<Key>M: openOk()\n\
Ctrl<Key>J: openOk()\n\
Ctrl<Key>O: noop()\n\
Ctrl<Key>N: noop()\n\
Ctrl<Key>P: noop()";
- const char *canvastrans =
+ const char *canvastrans =
"<Btn3Down>: placeMenu() XtMenuPopup(buttonpopup)";
- XtActionsRec actiontable[] = {
- { "openOk", dmxConfigOkAction },
- { "placeMenu", dmxConfigPlaceMenu },
- { "noop", NULL }
+ XtActionsRec actiontable[] = {
+ {"openOk", dmxConfigOkAction},
+ {"placeMenu", dmxConfigPlaceMenu},
+ {"noop", NULL}
};
dmxConfigFilename = XtNewString((argc >= 2) ? argv[1] : "");
- toplevel = XtVaAppInitialize(&appContext, "XDmxconfig",
- NULL, 0,
- &argc, argv,
- NULL,
- NULL);
-
- /* Main boxes */
- parent = XtVaCreateManagedWidget("parent", formWidgetClass, toplevel,
- XtNorientation, XtorientVertical,
- XtNwidth, DMX_MAIN_WIDTH,
- XtNheight, DMX_MAIN_HEIGHT,
- NULL);
- menubox = XtVaCreateManagedWidget("menubox", boxWidgetClass, parent,
- XtNborderWidth, 0,
- XtNorientation, XtorientHorizontal,
- XtNtop, XtChainTop,
- NULL);
- bottombox = XtVaCreateManagedWidget("bottombox", formWidgetClass, parent,
- XtNborderWidth, 0,
- XtNfromVert, menubox,
- XtNorientation, XtorientHorizontal,
- NULL);
- databox = XtVaCreateManagedWidget("databox", formWidgetClass,
- bottombox,
- XtNborderWidth, 0,
- XtNhorizDistance, 0,
- XtNwidth, DMX_DATA_WIDTH,
- XtNheight, DMX_DATA_HEIGHT,
- XtNleft, XtChainLeft,
- XtNorientation, XtorientVertical,
- NULL);
-
- /* Data */
- cnamebox = XtVaCreateManagedWidget("cnamebox", menuButtonWidgetClass,
- databox,
- XtNtop, XtChainTop,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- XtNmenuName, "cnamemenu",
- NULL);
- cdimbox = XtVaCreateManagedWidget("cdimbox", labelWidgetClass,
- databox,
- XtNfromVert, cnamebox,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- NULL);
- namebox = XtVaCreateManagedWidget("namebox", labelWidgetClass, databox,
- XtNfromVert, cdimbox,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- NULL);
- dimbox = XtVaCreateManagedWidget("dimbox", labelWidgetClass,
- databox,
- XtNfromVert, namebox,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- NULL);
- rtbox = XtVaCreateManagedWidget("rtbox", labelWidgetClass,
- databox,
- XtNfromVert, dimbox,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- NULL);
- origbox = XtVaCreateManagedWidget("origbox", labelWidgetClass,
- databox,
- XtNfromVert, rtbox,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- NULL);
-
- /* Canvas */
- canvasbox = XtVaCreateManagedWidget("canvasbox", boxWidgetClass,
- bottombox,
- XtNborderWidth, 0,
- XtNwidth, DMX_CANVAS_WIDTH,
- XtNheight, DMX_CANVAS_HEIGHT,
- XtNfromHoriz, databox,
- NULL);
-
- canvas = XtVaCreateManagedWidget("canvas", canvasWidgetClass,
- canvasbox,
- XtNwidth, DMX_CANVAS_WIDTH,
- XtNheight, DMX_CANVAS_HEIGHT,
- NULL);
-
-
- /* Main menu buttons */
- filebutton = XtVaCreateManagedWidget("File", menuButtonWidgetClass,
- menubox,
- XtNmenuName, "filemenu",
- NULL);
- helpbutton = XtVaCreateManagedWidget("Help", menuButtonWidgetClass,
- menubox,
- XtNmenuName, "helpmenu",
- NULL);
-
-
- /* File submenu buttons */
- filemenu = XtVaCreatePopupShell("filemenu", simpleMenuWidgetClass,
- filebutton, NULL);
- openbutton = XtVaCreateManagedWidget("Open File", smeBSBObjectClass,
- filemenu, NULL);
- savebutton = XtVaCreateManagedWidget("Save File", smeBSBObjectClass,
- filemenu,
- NULL);
- ncbutton = XtVaCreateManagedWidget("New Global", smeBSBObjectClass,
- filemenu, NULL);
- ecbutton = XtVaCreateManagedWidget("Edit Global", smeBSBObjectClass,
- filemenu,
- NULL);
- dcbutton = XtVaCreateManagedWidget("Delete Global", smeBSBObjectClass,
- filemenu,
- NULL);
- ndbutton0 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass,
- filemenu,
- NULL);
- quitbutton = XtVaCreateManagedWidget("Quit", smeBSBObjectClass,
- filemenu, NULL);
-
- /* Help submenu button */
- helpmenu = XtVaCreatePopupShell("helpmenu", simpleMenuWidgetClass,
- helpbutton, NULL);
- aboutbutton = XtVaCreateManagedWidget("About", smeBSBObjectClass,
- helpmenu, NULL);
-
- /* Open popup */
- openpopup = XtVaCreatePopupShell("openpopup", transientShellWidgetClass,
- toplevel, NULL);
- opendialog = XtVaCreateManagedWidget("opendialog", dialogWidgetClass,
- openpopup,
- XtNlabel, "Filename: ",
- XtNvalue, dmxConfigFilename,
- NULL);
- okbutton = XtVaCreateManagedWidget("Open", commandWidgetClass,
- opendialog, NULL);
- canbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
- opendialog, NULL);
-
- /* EC popup */
- ecpopup = XtVaCreatePopupShell("ecpopup", transientShellWidgetClass,
- toplevel, NULL);
- ecbox = XtVaCreateManagedWidget("ecbox", boxWidgetClass,
- ecpopup, NULL);
- ecdialog0 = XtVaCreateManagedWidget("ecdialog0", dialogWidgetClass,
- ecbox,
- XtNlabel, "Name: ",
- XtNvalue, "",
- NULL);
- ecdialog1 = XtVaCreateManagedWidget("ecdialog1", dialogWidgetClass,
- ecbox,
- XtNlabel, "Dimension: ",
- XtNvalue, "",
- NULL);
- ecokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass,
- ecbox, NULL);
- eccanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
- ecbox, NULL);
-
- /* ED popup */
- edpopup = XtVaCreatePopupShell("edpopup", transientShellWidgetClass,
- toplevel, NULL);
- edbox = XtVaCreateManagedWidget("edbox", boxWidgetClass,
- edpopup, NULL);
- eddialog0 = XtVaCreateManagedWidget("eddialog0", dialogWidgetClass,
- edbox,
- XtNlabel, "Display Name: ",
- XtNvalue, "",
- NULL);
- eddialog1 = XtVaCreateManagedWidget("eddialog1", dialogWidgetClass,
- edbox,
- XtNlabel, "Geometry: ",
- XtNvalue, "",
- NULL);
- eddialog2 = XtVaCreateManagedWidget("eddialog2", dialogWidgetClass,
- edbox,
- XtNlabel, "Offset: ",
- XtNvalue, "",
- NULL);
- edokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass,
- edbox, NULL);
- edcanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
- edbox, NULL);
-
- /* About popup */
- aboutpopup = XtVaCreatePopupShell("aboutpopup",transientShellWidgetClass,
- toplevel, NULL);
- aboutbox = XtVaCreateManagedWidget("aboutbox", boxWidgetClass,
- aboutpopup, NULL);
- XtVaCreateManagedWidget("abouttext", labelWidgetClass,
- aboutbox,
- XtNlabel, DMX_INFO,
- NULL);
- aboutok = XtVaCreateManagedWidget("OK", commandWidgetClass,
- aboutbox, NULL);
-
- /* Quit popup */
- quitpopup = XtVaCreatePopupShell("quitpopup",transientShellWidgetClass,
- toplevel, NULL);
- quitbox = XtVaCreateManagedWidget("quitbox", boxWidgetClass,
- quitpopup, NULL);
- XtVaCreateManagedWidget("quittext", labelWidgetClass,
- quitbox,
- XtNlabel,
- "Changes to the configuration\n"
- "been made that have not yet\n"
- "been saved. Do you want to\n"
- "quit without saving?",
- NULL);
- quitok = XtVaCreateManagedWidget("Quit WITHOUT Saving",
- commandWidgetClass,
- quitbox, NULL);
- quitcan = XtVaCreateManagedWidget("Continue Editing",
- commandWidgetClass,
- quitbox, NULL);
-
- /* Button popup */
- buttonpopup = XtVaCreatePopupShell("buttonpopup", simpleMenuWidgetClass,
- toplevel, NULL);
- ndbutton1 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass,
- buttonpopup,
- NULL);
- edbutton = XtVaCreateManagedWidget("Edit Display", smeBSBObjectClass,
- buttonpopup,
- NULL);
- ddbutton = XtVaCreateManagedWidget("Delete Display", smeBSBObjectClass,
- buttonpopup,
- NULL);
-
- /* Callbacks */
- XtAddCallback(openbutton, XtNcallback, dmxConfigOpenCallback, NULL);
- XtAddCallback(savebutton, XtNcallback, dmxConfigSaveCallback, NULL);
- XtAddCallback(okbutton, XtNcallback, dmxConfigOkCallback, NULL);
- XtAddCallback(canbutton, XtNcallback, dmxConfigCanCallback, NULL);
-
+ toplevel = XtVaAppInitialize(&appContext, "XDmxconfig",
+ NULL, 0, &argc, argv, NULL, NULL);
+
+ /* Main boxes */
+ parent = XtVaCreateManagedWidget("parent", formWidgetClass, toplevel,
+ XtNorientation, XtorientVertical,
+ XtNwidth, DMX_MAIN_WIDTH,
+ XtNheight, DMX_MAIN_HEIGHT, NULL);
+ menubox = XtVaCreateManagedWidget("menubox", boxWidgetClass, parent,
+ XtNborderWidth, 0,
+ XtNorientation, XtorientHorizontal,
+ XtNtop, XtChainTop, NULL);
+ bottombox = XtVaCreateManagedWidget("bottombox", formWidgetClass, parent,
+ XtNborderWidth, 0,
+ XtNfromVert, menubox,
+ XtNorientation, XtorientHorizontal,
+ NULL);
+ databox = XtVaCreateManagedWidget("databox", formWidgetClass,
+ bottombox,
+ XtNborderWidth, 0,
+ XtNhorizDistance, 0,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNheight, DMX_DATA_HEIGHT,
+ XtNleft, XtChainLeft,
+ XtNorientation, XtorientVertical, NULL);
+
+ /* Data */
+ cnamebox = XtVaCreateManagedWidget("cnamebox", menuButtonWidgetClass,
+ databox,
+ XtNtop, XtChainTop,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "",
+ XtNmenuName, "cnamemenu", NULL);
+ cdimbox = XtVaCreateManagedWidget("cdimbox", labelWidgetClass,
+ databox,
+ XtNfromVert, cnamebox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "", NULL);
+ namebox = XtVaCreateManagedWidget("namebox", labelWidgetClass, databox,
+ XtNfromVert, cdimbox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "", NULL);
+ dimbox = XtVaCreateManagedWidget("dimbox", labelWidgetClass,
+ databox,
+ XtNfromVert, namebox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "", NULL);
+ rtbox = XtVaCreateManagedWidget("rtbox", labelWidgetClass,
+ databox,
+ XtNfromVert, dimbox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "", NULL);
+ origbox = XtVaCreateManagedWidget("origbox", labelWidgetClass,
+ databox,
+ XtNfromVert, rtbox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "", NULL);
+
+ /* Canvas */
+ canvasbox = XtVaCreateManagedWidget("canvasbox", boxWidgetClass,
+ bottombox,
+ XtNborderWidth, 0,
+ XtNwidth, DMX_CANVAS_WIDTH,
+ XtNheight, DMX_CANVAS_HEIGHT,
+ XtNfromHoriz, databox, NULL);
+
+ canvas = XtVaCreateManagedWidget("canvas", canvasWidgetClass,
+ canvasbox,
+ XtNwidth, DMX_CANVAS_WIDTH,
+ XtNheight, DMX_CANVAS_HEIGHT, NULL);
+
+ /* Main menu buttons */
+ filebutton = XtVaCreateManagedWidget("File", menuButtonWidgetClass,
+ menubox,
+ XtNmenuName, "filemenu", NULL);
+ helpbutton = XtVaCreateManagedWidget("Help", menuButtonWidgetClass,
+ menubox,
+ XtNmenuName, "helpmenu", NULL);
+
+ /* File submenu buttons */
+ filemenu = XtVaCreatePopupShell("filemenu", simpleMenuWidgetClass,
+ filebutton, NULL);
+ openbutton = XtVaCreateManagedWidget("Open File", smeBSBObjectClass,
+ filemenu, NULL);
+ savebutton = XtVaCreateManagedWidget("Save File", smeBSBObjectClass,
+ filemenu, NULL);
+ ncbutton = XtVaCreateManagedWidget("New Global", smeBSBObjectClass,
+ filemenu, NULL);
+ ecbutton = XtVaCreateManagedWidget("Edit Global", smeBSBObjectClass,
+ filemenu, NULL);
+ dcbutton = XtVaCreateManagedWidget("Delete Global", smeBSBObjectClass,
+ filemenu, NULL);
+ ndbutton0 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass,
+ filemenu, NULL);
+ quitbutton = XtVaCreateManagedWidget("Quit", smeBSBObjectClass,
+ filemenu, NULL);
+
+ /* Help submenu button */
+ helpmenu = XtVaCreatePopupShell("helpmenu", simpleMenuWidgetClass,
+ helpbutton, NULL);
+ aboutbutton = XtVaCreateManagedWidget("About", smeBSBObjectClass,
+ helpmenu, NULL);
+
+ /* Open popup */
+ openpopup = XtVaCreatePopupShell("openpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ opendialog = XtVaCreateManagedWidget("opendialog", dialogWidgetClass,
+ openpopup,
+ XtNlabel, "Filename: ",
+ XtNvalue, dmxConfigFilename, NULL);
+ okbutton = XtVaCreateManagedWidget("Open", commandWidgetClass,
+ opendialog, NULL);
+ canbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
+ opendialog, NULL);
+
+ /* EC popup */
+ ecpopup = XtVaCreatePopupShell("ecpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ ecbox = XtVaCreateManagedWidget("ecbox", boxWidgetClass, ecpopup, NULL);
+ ecdialog0 = XtVaCreateManagedWidget("ecdialog0", dialogWidgetClass,
+ ecbox,
+ XtNlabel, "Name: ",
+ XtNvalue, "", NULL);
+ ecdialog1 = XtVaCreateManagedWidget("ecdialog1", dialogWidgetClass,
+ ecbox,
+ XtNlabel, "Dimension: ",
+ XtNvalue, "", NULL);
+ ecokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass, ecbox, NULL);
+ eccanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
+ ecbox, NULL);
+
+ /* ED popup */
+ edpopup = XtVaCreatePopupShell("edpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ edbox = XtVaCreateManagedWidget("edbox", boxWidgetClass, edpopup, NULL);
+ eddialog0 = XtVaCreateManagedWidget("eddialog0", dialogWidgetClass,
+ edbox,
+ XtNlabel, "Display Name: ",
+ XtNvalue, "", NULL);
+ eddialog1 = XtVaCreateManagedWidget("eddialog1", dialogWidgetClass,
+ edbox,
+ XtNlabel, "Geometry: ",
+ XtNvalue, "", NULL);
+ eddialog2 = XtVaCreateManagedWidget("eddialog2", dialogWidgetClass,
+ edbox,
+ XtNlabel, "Offset: ",
+ XtNvalue, "", NULL);
+ edokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass, edbox, NULL);
+ edcanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
+ edbox, NULL);
+
+ /* About popup */
+ aboutpopup = XtVaCreatePopupShell("aboutpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ aboutbox = XtVaCreateManagedWidget("aboutbox", boxWidgetClass,
+ aboutpopup, NULL);
+ XtVaCreateManagedWidget("abouttext", labelWidgetClass,
+ aboutbox, XtNlabel, DMX_INFO, NULL);
+ aboutok = XtVaCreateManagedWidget("OK", commandWidgetClass, aboutbox, NULL);
+
+ /* Quit popup */
+ quitpopup = XtVaCreatePopupShell("quitpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ quitbox = XtVaCreateManagedWidget("quitbox", boxWidgetClass,
+ quitpopup, NULL);
+ XtVaCreateManagedWidget("quittext", labelWidgetClass,
+ quitbox,
+ XtNlabel,
+ "Changes to the configuration\n"
+ "been made that have not yet\n"
+ "been saved. Do you want to\n"
+ "quit without saving?", NULL);
+ quitok = XtVaCreateManagedWidget("Quit WITHOUT Saving",
+ commandWidgetClass, quitbox, NULL);
+ quitcan = XtVaCreateManagedWidget("Continue Editing",
+ commandWidgetClass, quitbox, NULL);
+
+ /* Button popup */
+ buttonpopup = XtVaCreatePopupShell("buttonpopup", simpleMenuWidgetClass,
+ toplevel, NULL);
+ ndbutton1 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass,
+ buttonpopup, NULL);
+ edbutton = XtVaCreateManagedWidget("Edit Display", smeBSBObjectClass,
+ buttonpopup, NULL);
+ ddbutton = XtVaCreateManagedWidget("Delete Display", smeBSBObjectClass,
+ buttonpopup, NULL);
+
+ /* Callbacks */
+ XtAddCallback(openbutton, XtNcallback, dmxConfigOpenCallback, NULL);
+ XtAddCallback(savebutton, XtNcallback, dmxConfigSaveCallback, NULL);
+ XtAddCallback(okbutton, XtNcallback, dmxConfigOkCallback, NULL);
+ XtAddCallback(canbutton, XtNcallback, dmxConfigCanCallback, NULL);
+
XtAppAddActions(appContext, actiontable, XtNumber(actiontable));
XtOverrideTranslations(canvas, XtParseTranslationTable(canvastrans));
XtOverrideTranslations(XtNameToWidget(opendialog, "value"),
- XtParseTranslationTable(opentrans));
+ XtParseTranslationTable(opentrans));
XtOverrideTranslations(XtNameToWidget(ecdialog0, "value"),
- XtParseTranslationTable(opentrans));
+ XtParseTranslationTable(opentrans));
XtOverrideTranslations(XtNameToWidget(ecdialog1, "value"),
- XtParseTranslationTable(opentrans));
+ XtParseTranslationTable(opentrans));
XtOverrideTranslations(XtNameToWidget(eddialog0, "value"),
- XtParseTranslationTable(opentrans));
+ XtParseTranslationTable(opentrans));
XtOverrideTranslations(XtNameToWidget(eddialog1, "value"),
- XtParseTranslationTable(opentrans));
+ XtParseTranslationTable(opentrans));
XtOverrideTranslations(XtNameToWidget(eddialog2, "value"),
- XtParseTranslationTable(opentrans));
-
- XtAddCallback(ncbutton, XtNcallback, dmxConfigNCCallback, NULL);
- XtAddCallback(ecbutton, XtNcallback, dmxConfigECCallback, NULL);
- XtAddCallback(ecokbutton, XtNcallback, dmxConfigECOkCallback, NULL);
- XtAddCallback(eccanbutton, XtNcallback, dmxConfigECCanCallback, NULL);
- XtAddCallback(dcbutton, XtNcallback, dmxConfigDCCallback, NULL);
-
- XtAddCallback(ndbutton0, XtNcallback, dmxConfigNDCallback, NULL);
- XtAddCallback(ndbutton1, XtNcallback, dmxConfigNDCallback, NULL);
- XtAddCallback(edbutton, XtNcallback, dmxConfigEDCallback, NULL);
- XtAddCallback(ddbutton, XtNcallback, dmxConfigDDCallback, NULL);
- XtAddCallback(edokbutton, XtNcallback, dmxConfigEDOkCallback, NULL);
- XtAddCallback(edcanbutton, XtNcallback, dmxConfigEDCanCallback, NULL);
-
- XtAddCallback(aboutbutton, XtNcallback, dmxConfigAboutCallback, NULL);
- XtAddCallback(aboutok, XtNcallback, dmxConfigAboutOkCallback, NULL);
- XtAddCallback(quitok, XtNcallback, dmxConfigQuitOkCallback, NULL);
- XtAddCallback(quitcan, XtNcallback, dmxConfigQuitCanCallback, NULL);
-
- XtAddCallback(quitbutton, XtNcallback, dmxConfigQuitCallback, NULL);
-
- XtAddCallback(canvas, XtNcallback, dmxConfigCanvasInput, NULL);
- XtAddCallback(canvas, XtNcanvasExposeCallback, dmxConfigCanvasExpose,NULL);
- XtAddCallback(canvas, XtNcanvasResizeCallback, dmxConfigCanvasResize,NULL);
-
- if (dmxConfigFilename) dmxConfigReadFile();
-
+ XtParseTranslationTable(opentrans));
+
+ XtAddCallback(ncbutton, XtNcallback, dmxConfigNCCallback, NULL);
+ XtAddCallback(ecbutton, XtNcallback, dmxConfigECCallback, NULL);
+ XtAddCallback(ecokbutton, XtNcallback, dmxConfigECOkCallback, NULL);
+ XtAddCallback(eccanbutton, XtNcallback, dmxConfigECCanCallback, NULL);
+ XtAddCallback(dcbutton, XtNcallback, dmxConfigDCCallback, NULL);
+
+ XtAddCallback(ndbutton0, XtNcallback, dmxConfigNDCallback, NULL);
+ XtAddCallback(ndbutton1, XtNcallback, dmxConfigNDCallback, NULL);
+ XtAddCallback(edbutton, XtNcallback, dmxConfigEDCallback, NULL);
+ XtAddCallback(ddbutton, XtNcallback, dmxConfigDDCallback, NULL);
+ XtAddCallback(edokbutton, XtNcallback, dmxConfigEDOkCallback, NULL);
+ XtAddCallback(edcanbutton, XtNcallback, dmxConfigEDCanCallback, NULL);
+
+ XtAddCallback(aboutbutton, XtNcallback, dmxConfigAboutCallback, NULL);
+ XtAddCallback(aboutok, XtNcallback, dmxConfigAboutOkCallback, NULL);
+ XtAddCallback(quitok, XtNcallback, dmxConfigQuitOkCallback, NULL);
+ XtAddCallback(quitcan, XtNcallback, dmxConfigQuitCanCallback, NULL);
+
+ XtAddCallback(quitbutton, XtNcallback, dmxConfigQuitCallback, NULL);
+
+ XtAddCallback(canvas, XtNcallback, dmxConfigCanvasInput, NULL);
+ XtAddCallback(canvas, XtNcanvasExposeCallback, dmxConfigCanvasExpose, NULL);
+ XtAddCallback(canvas, XtNcanvasResizeCallback, dmxConfigCanvasResize, NULL);
+
+ if (dmxConfigFilename)
+ dmxConfigReadFile();
+
XtRealizeWidget(toplevel);
dmxConfigCopystrings();
dmxConfigSetupCnamemenu();
diff --git a/xorg-server/hw/dmx/dmx.c b/xorg-server/hw/dmx/dmx.c
index 01a744849..add0e5390 100644
--- a/xorg-server/hw/dmx/dmx.c
+++ b/xorg-server/hw/dmx/dmx.c
@@ -62,16 +62,15 @@
#ifdef PANORAMIX
#include "panoramiX.h"
extern unsigned long XRT_WINDOW;
-extern int PanoramiXNumScreens;
+extern int PanoramiXNumScreens;
#endif
extern void DMXExtensionInit(void);
static unsigned char DMXCode;
-
-
-static int _DMXXineramaActive(void)
+static int
+_DMXXineramaActive(void)
{
#ifdef PANORAMIX
return !noPanoramiXExtension;
@@ -79,31 +78,51 @@ static int _DMXXineramaActive(void)
return 0;
}
-static void dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr,
- CARD32 value)
+static void
+dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr, CARD32 value)
{
switch (1 << bit) {
- case DMXScreenWindowWidth: attr->screenWindowWidth = value; break;
- case DMXScreenWindowHeight: attr->screenWindowHeight = value; break;
- case DMXScreenWindowXoffset: attr->screenWindowXoffset = value; break;
- case DMXScreenWindowYoffset: attr->screenWindowYoffset = value; break;
- case DMXRootWindowWidth: attr->rootWindowWidth = value; break;
- case DMXRootWindowHeight: attr->rootWindowHeight = value; break;
- case DMXRootWindowXoffset: attr->rootWindowXoffset = value; break;
- case DMXRootWindowYoffset: attr->rootWindowYoffset = value; break;
- case DMXRootWindowXorigin: attr->rootWindowXorigin = value; break;
- case DMXRootWindowYorigin: attr->rootWindowYorigin = value; break;
+ case DMXScreenWindowWidth:
+ attr->screenWindowWidth = value;
+ break;
+ case DMXScreenWindowHeight:
+ attr->screenWindowHeight = value;
+ break;
+ case DMXScreenWindowXoffset:
+ attr->screenWindowXoffset = value;
+ break;
+ case DMXScreenWindowYoffset:
+ attr->screenWindowYoffset = value;
+ break;
+ case DMXRootWindowWidth:
+ attr->rootWindowWidth = value;
+ break;
+ case DMXRootWindowHeight:
+ attr->rootWindowHeight = value;
+ break;
+ case DMXRootWindowXoffset:
+ attr->rootWindowXoffset = value;
+ break;
+ case DMXRootWindowYoffset:
+ attr->rootWindowYoffset = value;
+ break;
+ case DMXRootWindowXorigin:
+ attr->rootWindowXorigin = value;
+ break;
+ case DMXRootWindowYorigin:
+ attr->rootWindowYorigin = value;
+ break;
}
}
-static int dmxFetchScreenAttributes(unsigned int mask,
- DMXScreenAttributesPtr attr,
- CARD32 *value_list)
+static int
+dmxFetchScreenAttributes(unsigned int mask,
+ DMXScreenAttributesPtr attr, CARD32 *value_list)
{
- int i;
+ int i;
CARD32 *value = value_list;
- int count = 0;
-
+ int count = 0;
+
for (i = 0; i < 32; i++) {
if (mask & (1 << i)) {
dmxSetScreenAttribute(i, attr, *value);
@@ -114,52 +133,66 @@ static int dmxFetchScreenAttributes(unsigned int mask,
return count;
}
-static void dmxSetDesktopAttribute(int bit, DMXDesktopAttributesPtr attr,
- CARD32 value)
+static void
+dmxSetDesktopAttribute(int bit, DMXDesktopAttributesPtr attr, CARD32 value)
{
switch (1 << bit) {
- case DMXDesktopWidth: attr->width = value; break;
- case DMXDesktopHeight: attr->height = value; break;
- case DMXDesktopShiftX: attr->shiftX = value; break;
- case DMXDesktopShiftY: attr->shiftY = value; break;
+ case DMXDesktopWidth:
+ attr->width = value;
+ break;
+ case DMXDesktopHeight:
+ attr->height = value;
+ break;
+ case DMXDesktopShiftX:
+ attr->shiftX = value;
+ break;
+ case DMXDesktopShiftY:
+ attr->shiftY = value;
+ break;
}
}
-static int dmxFetchDesktopAttributes(unsigned int mask,
- DMXDesktopAttributesPtr attr,
- CARD32 *value_list)
+static int
+dmxFetchDesktopAttributes(unsigned int mask,
+ DMXDesktopAttributesPtr attr, CARD32 *value_list)
{
- int i;
+ int i;
CARD32 *value = value_list;
- int count = 0;
-
+ int count = 0;
+
for (i = 0; i < 32; i++) {
if (mask & (1 << i)) {
dmxSetDesktopAttribute(i, attr, *value);
- ++value;
+ ++value;
++count;
}
}
return count;
}
-static void dmxSetInputAttribute(int bit, DMXInputAttributesPtr attr,
- CARD32 value)
+static void
+dmxSetInputAttribute(int bit, DMXInputAttributesPtr attr, CARD32 value)
{
switch (1 << bit) {
- case DMXInputType: attr->inputType = value; break;
- case DMXInputPhysicalScreen: attr->physicalScreen = value; break;
- case DMXInputSendsCore: attr->sendsCore = !!value; break;
+ case DMXInputType:
+ attr->inputType = value;
+ break;
+ case DMXInputPhysicalScreen:
+ attr->physicalScreen = value;
+ break;
+ case DMXInputSendsCore:
+ attr->sendsCore = ! !value;
+ break;
}
}
-static int dmxFetchInputAttributes(unsigned int mask,
- DMXInputAttributesPtr attr,
- CARD32 *value_list)
+static int
+dmxFetchInputAttributes(unsigned int mask,
+ DMXInputAttributesPtr attr, CARD32 *value_list)
{
- int i;
+ int i;
CARD32 *value = value_list;
- int count = 0;
+ int count = 0;
for (i = 0; i < 32; i++) {
if (mask & (1 << i)) {
@@ -171,30 +204,32 @@ static int dmxFetchInputAttributes(unsigned int mask,
return count;
}
-static int ProcDMXQueryVersion(ClientPtr client)
+static int
+ProcDMXQueryVersion(ClientPtr client)
{
xDMXQueryVersionReply rep;
REQUEST_SIZE_MATCH(xDMXQueryVersionReq);
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = SERVER_DMX_MAJOR_VERSION;
- rep.minorVersion = SERVER_DMX_MINOR_VERSION;
- rep.patchVersion = SERVER_DMX_PATCH_VERSION;
+ rep.length = 0;
+ rep.majorVersion = SERVER_DMX_MAJOR_VERSION;
+ rep.minorVersion = SERVER_DMX_MINOR_VERSION;
+ rep.patchVersion = SERVER_DMX_PATCH_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
- swapl(&rep.patchVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
+ swapl(&rep.patchVersion);
}
- WriteToClient(client, sizeof(xDMXQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXQueryVersionReply), (char *) &rep);
return Success;
}
-static int ProcDMXSync(ClientPtr client)
+static int
+ProcDMXSync(ClientPtr client)
{
xDMXSyncReply rep;
@@ -202,41 +237,43 @@ static int ProcDMXSync(ClientPtr client)
dmxFlushPendingSyncs();
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = 0;
+ rep.length = 0;
+ rep.status = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
}
- WriteToClient(client, sizeof(xDMXSyncReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXSyncReply), (char *) &rep);
return Success;
}
-static int ProcDMXForceWindowCreation(ClientPtr client)
+static int
+ProcDMXForceWindowCreation(ClientPtr client)
{
xDMXForceWindowCreationReply rep;
+
REQUEST(xDMXForceWindowCreationReq);
- WindowPtr pWin;
+ WindowPtr pWin;
REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
PanoramiXRes *win;
- int i;
+ int i;
- if (Success != dixLookupResourceByType((pointer*) &win,
- stuff->window, XRT_WINDOW,
- client, DixReadAccess))
- return -1; /* BadWindow */
+ if (Success != dixLookupResourceByType((pointer *) &win,
+ stuff->window, XRT_WINDOW,
+ client, DixReadAccess))
+ return -1; /* BadWindow */
FOR_NSCREENS(i) {
if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
- DixReadAccess))
- return -1; /* BadWindow */
+ DixReadAccess))
+ return -1; /* BadWindow */
dmxForceWindowCreation(pWin);
}
@@ -244,80 +281,84 @@ static int ProcDMXForceWindowCreation(ClientPtr client)
}
#endif
- if (Success != dixLookupWindow(&pWin, stuff->window, client,
- DixReadAccess))
- return -1; /* BadWindow */
+ if (Success != dixLookupWindow(&pWin, stuff->window, client, DixReadAccess))
+ return -1; /* BadWindow */
dmxForceWindowCreation(pWin);
- doreply:
+ doreply:
dmxFlushPendingSyncs();
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = 0;
+ rep.length = 0;
+ rep.status = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
}
- WriteToClient(client, sizeof(xDMXForceWindowCreationReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXForceWindowCreationReply), (char *) &rep);
return Success;
}
-static int ProcDMXGetScreenCount(ClientPtr client)
+static int
+ProcDMXGetScreenCount(ClientPtr client)
{
xDMXGetScreenCountReply rep;
REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.screenCount = dmxGetNumScreens();
+ rep.length = 0;
+ rep.screenCount = dmxGetNumScreens();
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.screenCount);
}
- WriteToClient(client, sizeof(xDMXGetScreenCountReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXGetScreenCountReply), (char *) &rep);
return Success;
}
-static int ProcDMXGetScreenAttributes(ClientPtr client)
+static int
+ProcDMXGetScreenAttributes(ClientPtr client)
{
REQUEST(xDMXGetScreenAttributesReq);
xDMXGetScreenAttributesReply rep;
- int length;
- int paddedLength;
- DMXScreenAttributesRec attr;
+ int length;
+ int paddedLength;
+ DMXScreenAttributesRec attr;
REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);
if (stuff->physicalScreen < 0
- || stuff->physicalScreen >= dmxGetNumScreens()) return BadValue;
+ || stuff->physicalScreen >= dmxGetNumScreens())
+ return BadValue;
if (!dmxGetScreenAttributes(stuff->physicalScreen, &attr))
return BadValue;
- rep.logicalScreen = attr.logicalScreen;
- rep.screenWindowWidth = attr.screenWindowWidth;
- rep.screenWindowHeight = attr.screenWindowHeight;
+ rep.logicalScreen = attr.logicalScreen;
+ rep.screenWindowWidth = attr.screenWindowWidth;
+ rep.screenWindowHeight = attr.screenWindowHeight;
rep.screenWindowXoffset = attr.screenWindowXoffset;
rep.screenWindowYoffset = attr.screenWindowYoffset;
- rep.rootWindowWidth = attr.rootWindowWidth;
- rep.rootWindowHeight = attr.rootWindowHeight;
- rep.rootWindowXoffset = attr.rootWindowXoffset;
- rep.rootWindowYoffset = attr.rootWindowYoffset;
- rep.rootWindowXorigin = attr.rootWindowXorigin;
- rep.rootWindowYorigin = attr.rootWindowYorigin;
-
- length = attr.displayName ? strlen(attr.displayName) : 0;
- paddedLength = pad_to_int32(length);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = bytes_to_int32((sizeof(xDMXGetScreenAttributesReply) - sizeof(xGenericReply))
- + paddedLength);
- rep.displayNameLength = length;
+ rep.rootWindowWidth = attr.rootWindowWidth;
+ rep.rootWindowHeight = attr.rootWindowHeight;
+ rep.rootWindowXoffset = attr.rootWindowXoffset;
+ rep.rootWindowYoffset = attr.rootWindowYoffset;
+ rep.rootWindowXorigin = attr.rootWindowXorigin;
+ rep.rootWindowYorigin = attr.rootWindowYorigin;
+
+ length = attr.displayName ? strlen(attr.displayName) : 0;
+ paddedLength = pad_to_int32(length);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length =
+ bytes_to_int32((sizeof(xDMXGetScreenAttributesReply) -
+ sizeof(xGenericReply))
+ + paddedLength);
+ rep.displayNameLength = length;
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -335,49 +376,55 @@ static int ProcDMXGetScreenAttributes(ClientPtr client)
swaps(&rep.rootWindowXorigin);
swaps(&rep.rootWindowYorigin);
}
- WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), (char *)&rep);
- if (length) WriteToClient(client, length, (char *)attr.displayName);
+ WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), (char *) &rep);
+ if (length)
+ WriteToClient(client, length, (char *) attr.displayName);
return Success;
}
-static int ProcDMXChangeScreensAttributes(ClientPtr client)
+static int
+ProcDMXChangeScreensAttributes(ClientPtr client)
{
REQUEST(xDMXChangeScreensAttributesReq);
xDMXChangeScreensAttributesReply rep;
- int status = DMX_BAD_XINERAMA;
- unsigned int mask = 0;
- unsigned int i;
- CARD32 *screen_list;
- CARD32 *mask_list;
- CARD32 *value_list;
- DMXScreenAttributesPtr attribs;
- int errorScreen = 0;
- unsigned int len;
- int ones = 0;
-
+ int status = DMX_BAD_XINERAMA;
+ unsigned int mask = 0;
+ unsigned int i;
+ CARD32 *screen_list;
+ CARD32 *mask_list;
+ CARD32 *value_list;
+ DMXScreenAttributesPtr attribs;
+ int errorScreen = 0;
+ unsigned int len;
+ int ones = 0;
REQUEST_AT_LEAST_SIZE(xDMXChangeScreensAttributesReq);
- len = client->req_len - bytes_to_int32(sizeof(xDMXChangeScreensAttributesReq));
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xDMXChangeScreensAttributesReq));
if (len < stuff->screenCount + stuff->maskCount)
return BadLength;
- screen_list = (CARD32 *)(stuff + 1);
- mask_list = &screen_list[stuff->screenCount];
- value_list = &mask_list[stuff->maskCount];
+ screen_list = (CARD32 *) (stuff + 1);
+ mask_list = &screen_list[stuff->screenCount];
+ value_list = &mask_list[stuff->maskCount];
- for (i = 0; i < stuff->maskCount; i++) ones += Ones(mask_list[i]);
+ for (i = 0; i < stuff->maskCount; i++)
+ ones += Ones(mask_list[i]);
if (len != stuff->screenCount + stuff->maskCount + ones)
return BadLength;
-
- if (!_DMXXineramaActive()) goto noxinerama;
+
+ if (!_DMXXineramaActive())
+ goto noxinerama;
if (!(attribs = malloc(stuff->screenCount * sizeof(*attribs))))
return BadAlloc;
for (i = 0; i < stuff->screenCount; i++) {
int count;
-
- if (i < stuff->maskCount) mask = mask_list[i];
+
+ if (i < stuff->maskCount)
+ mask = mask_list[i];
dmxGetScreenAttributes(screen_list[i], &attribs[i]);
count = dmxFetchScreenAttributes(mask, &attribs[i], value_list);
value_list += count;
@@ -385,21 +432,20 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
#if PANORAMIX
status = dmxConfigureScreenWindows(stuff->screenCount,
- screen_list,
- attribs,
- &errorScreen);
+ screen_list, attribs, &errorScreen);
#endif
free(attribs);
- if (status == BadValue) return status;
+ if (status == BadValue)
+ return status;
- noxinerama:
- rep.type = X_Reply;
+ noxinerama:
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- rep.errorScreen = errorScreen;
+ rep.length = 0;
+ rep.status = status;
+ rep.errorScreen = errorScreen;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -407,34 +453,34 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
swapl(&rep.errorScreen);
}
WriteToClient(client,
- sizeof(xDMXChangeScreensAttributesReply),
- (char *)&rep);
+ sizeof(xDMXChangeScreensAttributesReply), (char *) &rep);
return Success;
}
-static int ProcDMXAddScreen(ClientPtr client)
+static int
+ProcDMXAddScreen(ClientPtr client)
{
REQUEST(xDMXAddScreenReq);
- xDMXAddScreenReply rep;
- int status = 0;
- CARD32 *value_list;
+ xDMXAddScreenReply rep;
+ int status = 0;
+ CARD32 *value_list;
DMXScreenAttributesRec attr;
- int count;
- char *name;
- int len;
- int paddedLength;
+ int count;
+ char *name;
+ int len;
+ int paddedLength;
REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
paddedLength = pad_to_int32(stuff->displayNameLength);
- len = client->req_len - bytes_to_int32(sizeof(xDMXAddScreenReq));
- if (len != Ones(stuff->valueMask) + paddedLength/4)
+ len = client->req_len - bytes_to_int32(sizeof(xDMXAddScreenReq));
+ if (len != Ones(stuff->valueMask) + paddedLength / 4)
return BadLength;
memset(&attr, 0, sizeof(attr));
dmxGetScreenAttributes(stuff->physicalScreen, &attr);
- value_list = (CARD32 *)(stuff + 1);
- count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
-
+ value_list = (CARD32 *) (stuff + 1);
+ count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
+
if (!(name = malloc(stuff->displayNameLength + 1 + 4)))
return BadAlloc;
memcpy(name, &value_list[count], stuff->displayNameLength);
@@ -445,10 +491,10 @@ static int ProcDMXAddScreen(ClientPtr client)
free(name);
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
+ rep.length = 0;
+ rep.status = status;
rep.physicalScreen = stuff->physicalScreen;
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -456,63 +502,60 @@ static int ProcDMXAddScreen(ClientPtr client)
swapl(&rep.status);
swapl(&rep.physicalScreen);
}
- WriteToClient(client,
- sizeof(xDMXAddScreenReply),
- (char *)&rep);
+ WriteToClient(client, sizeof(xDMXAddScreenReply), (char *) &rep);
return Success;
}
-static int ProcDMXRemoveScreen(ClientPtr client)
+static int
+ProcDMXRemoveScreen(ClientPtr client)
{
REQUEST(xDMXRemoveScreenReq);
xDMXRemoveScreenReply rep;
- int status = 0;
+ int status = 0;
REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);
status = dmxDetachScreen(stuff->physicalScreen);
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
+ rep.length = 0;
+ rep.status = status;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
}
- WriteToClient(client,
- sizeof(xDMXRemoveScreenReply),
- (char *)&rep);
+ WriteToClient(client, sizeof(xDMXRemoveScreenReply), (char *) &rep);
return Success;
}
-
#ifdef PANORAMIX
-static int dmxPopulatePanoramiX(ClientPtr client, Window window,
- CARD32 *screens, CARD32 *windows,
- xRectangle *pos, xRectangle *vis)
+static int
+dmxPopulatePanoramiX(ClientPtr client, Window window,
+ CARD32 *screens, CARD32 *windows,
+ xRectangle *pos, xRectangle *vis)
{
- WindowPtr pWin;
- PanoramiXRes *win;
- int i;
- int count = 0;
+ WindowPtr pWin;
+ PanoramiXRes *win;
+ int i;
+ int count = 0;
DMXWindowAttributesRec attr;
-
- if (Success != dixLookupResourceByType((pointer*) &win,
- window, XRT_WINDOW,
- client, DixReadAccess))
- return -1; /* BadWindow */
-
+
+ if (Success != dixLookupResourceByType((pointer *) &win,
+ window, XRT_WINDOW,
+ client, DixReadAccess))
+ return -1; /* BadWindow */
+
FOR_NSCREENS(i) {
if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
- DixReadAccess))
+ DixReadAccess))
return -1; /* BadWindow */
if (dmxGetWindowAttributes(pWin, &attr)) {
screens[count] = attr.screen;
windows[count] = attr.window;
- pos[count] = attr.pos;
- vis[count] = attr.vis;
+ pos[count] = attr.pos;
+ vis[count] = attr.vis;
++count; /* Only count existing windows */
}
}
@@ -520,46 +563,49 @@ static int dmxPopulatePanoramiX(ClientPtr client, Window window,
}
#endif
-static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens,
- CARD32 *windows, xRectangle *pos, xRectangle *vis)
+static int
+dmxPopulate(ClientPtr client, Window window, CARD32 *screens,
+ CARD32 *windows, xRectangle *pos, xRectangle *vis)
{
- WindowPtr pWin;
+ WindowPtr pWin;
DMXWindowAttributesRec attr;
#ifdef PANORAMIX
if (!noPanoramiXExtension)
- return dmxPopulatePanoramiX(client, window, screens, windows,
- pos, vis);
+ return dmxPopulatePanoramiX(client, window, screens, windows, pos, vis);
#endif
-
+
if (Success != dixLookupWindow(&pWin, window, client, DixReadAccess))
- return -1; /* BadWindow */
+ return -1; /* BadWindow */
dmxGetWindowAttributes(pWin, &attr);
*screens = attr.screen;
*windows = attr.window;
- *pos = attr.pos;
- *vis = attr.vis;
+ *pos = attr.pos;
+ *vis = attr.vis;
return 1;
}
-static int dmxMaxNumScreens(void)
+static int
+dmxMaxNumScreens(void)
{
#ifdef PANORAMIX
- if (!noPanoramiXExtension) return PanoramiXNumScreens;
+ if (!noPanoramiXExtension)
+ return PanoramiXNumScreens;
#endif
return 1;
}
-static int ProcDMXGetWindowAttributes(ClientPtr client)
+static int
+ProcDMXGetWindowAttributes(ClientPtr client)
{
REQUEST(xDMXGetWindowAttributesReq);
xDMXGetWindowAttributesReply rep;
- int i;
- CARD32 *screens;
- CARD32 *windows;
- xRectangle *pos, *vis;
- int count = dmxMaxNumScreens();
+ int i;
+ CARD32 *screens;
+ CARD32 *windows;
+ xRectangle *pos, *vis;
+ int count = dmxMaxNumScreens();
REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
@@ -590,10 +636,10 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
return BadWindow;
}
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = count * 6;
- rep.screenCount = count;
+ rep.length = count * 6;
+ rep.screenCount = count;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -601,12 +647,12 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
for (i = 0; i < count; i++) {
swapl(&screens[i]);
swapl(&windows[i]);
-
+
swaps(&pos[i].x);
swaps(&pos[i].y);
swaps(&pos[i].width);
swaps(&pos[i].height);
-
+
swaps(&vis[i].x);
swaps(&vis[i].y);
swaps(&vis[i].width);
@@ -616,12 +662,12 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
dmxFlushPendingSyncs();
- WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), (char *) &rep);
if (count) {
- WriteToClient(client, count * sizeof(*screens), (char *)screens);
- WriteToClient(client, count * sizeof(*windows), (char *)windows);
- WriteToClient(client, count * sizeof(*pos), (char *)pos);
- WriteToClient(client, count * sizeof(*vis), (char *)vis);
+ WriteToClient(client, count * sizeof(*screens), (char *) screens);
+ WriteToClient(client, count * sizeof(*windows), (char *) windows);
+ WriteToClient(client, count * sizeof(*pos), (char *) pos);
+ WriteToClient(client, count * sizeof(*vis), (char *) vis);
}
free(vis);
@@ -632,23 +678,24 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
return Success;
}
-static int ProcDMXGetDesktopAttributes(ClientPtr client)
+static int
+ProcDMXGetDesktopAttributes(ClientPtr client)
{
xDMXGetDesktopAttributesReply rep;
- DMXDesktopAttributesRec attr;
+ DMXDesktopAttributesRec attr;
REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);
dmxGetDesktopAttributes(&attr);
- rep.width = attr.width;
- rep.height = attr.height;
- rep.shiftX = attr.shiftX;
- rep.shiftY = attr.shiftY;
+ rep.width = attr.width;
+ rep.height = attr.height;
+ rep.shiftX = attr.shiftX;
+ rep.shiftY = attr.shiftY;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -658,95 +705,100 @@ static int ProcDMXGetDesktopAttributes(ClientPtr client)
swaps(&rep.shiftX);
swaps(&rep.shiftY);
}
- WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *) &rep);
return Success;
}
-static int ProcDMXChangeDesktopAttributes(ClientPtr client)
+static int
+ProcDMXChangeDesktopAttributes(ClientPtr client)
{
REQUEST(xDMXChangeDesktopAttributesReq);
xDMXChangeDesktopAttributesReply rep;
- int status = DMX_BAD_XINERAMA;
- CARD32 *value_list;
- DMXDesktopAttributesRec attr;
- int len;
+ int status = DMX_BAD_XINERAMA;
+ CARD32 *value_list;
+ DMXDesktopAttributesRec attr;
+ int len;
REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq);
len = client->req_len - (sizeof(xDMXChangeDesktopAttributesReq) >> 2);
if (len != Ones(stuff->valueMask))
return BadLength;
- if (!_DMXXineramaActive()) goto noxinerama;
+ if (!_DMXXineramaActive())
+ goto noxinerama;
+
+ value_list = (CARD32 *) (stuff + 1);
- value_list = (CARD32 *)(stuff + 1);
-
dmxGetDesktopAttributes(&attr);
dmxFetchDesktopAttributes(stuff->valueMask, &attr, value_list);
#if PANORAMIX
status = dmxConfigureDesktop(&attr);
#endif
- if (status == BadValue) return status;
+ if (status == BadValue)
+ return status;
- noxinerama:
- rep.type = X_Reply;
+ noxinerama:
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
+ rep.length = 0;
+ rep.status = status;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
}
WriteToClient(client,
- sizeof(xDMXChangeDesktopAttributesReply),
- (char *)&rep);
+ sizeof(xDMXChangeDesktopAttributesReply), (char *) &rep);
return Success;
}
-static int ProcDMXGetInputCount(ClientPtr client)
+static int
+ProcDMXGetInputCount(ClientPtr client)
{
xDMXGetInputCountReply rep;
REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.inputCount = dmxGetInputCount();
+ rep.length = 0;
+ rep.inputCount = dmxGetInputCount();
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.inputCount);
}
- WriteToClient(client, sizeof(xDMXGetInputCountReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXGetInputCountReply), (char *) &rep);
return Success;
}
-static int ProcDMXGetInputAttributes(ClientPtr client)
+static int
+ProcDMXGetInputAttributes(ClientPtr client)
{
REQUEST(xDMXGetInputAttributesReq);
xDMXGetInputAttributesReply rep;
- int length;
- int paddedLength;
- DMXInputAttributesRec attr;
+ int length;
+ int paddedLength;
+ DMXInputAttributesRec attr;
REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);
- if (dmxGetInputAttributes(stuff->deviceId, &attr)) return BadValue;
- rep.inputType = attr.inputType;
+ if (dmxGetInputAttributes(stuff->deviceId, &attr))
+ return BadValue;
+ rep.inputType = attr.inputType;
rep.physicalScreen = attr.physicalScreen;
- rep.physicalId = attr.physicalId;
- rep.isCore = attr.isCore;
- rep.sendsCore = attr.sendsCore;
- rep.detached = attr.detached;
-
- length = attr.name ? strlen(attr.name) : 0;
- paddedLength = pad_to_int32(length);
- rep.type = X_Reply;
+ rep.physicalId = attr.physicalId;
+ rep.isCore = attr.isCore;
+ rep.sendsCore = attr.sendsCore;
+ rep.detached = attr.detached;
+
+ length = attr.name ? strlen(attr.name) : 0;
+ paddedLength = pad_to_int32(length);
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = bytes_to_int32(paddedLength);
- rep.nameLength = length;
+ rep.length = bytes_to_int32(paddedLength);
+ rep.nameLength = length;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -755,34 +807,36 @@ static int ProcDMXGetInputAttributes(ClientPtr client)
swapl(&rep.physicalId);
swapl(&rep.nameLength);
}
- WriteToClient(client, sizeof(xDMXGetInputAttributesReply), (char *)&rep);
- if (length) WriteToClient(client, length, (char *)attr.name);
+ WriteToClient(client, sizeof(xDMXGetInputAttributesReply), (char *) &rep);
+ if (length)
+ WriteToClient(client, length, (char *) attr.name);
return Success;
}
-static int ProcDMXAddInput(ClientPtr client)
+static int
+ProcDMXAddInput(ClientPtr client)
{
REQUEST(xDMXAddInputReq);
- xDMXAddInputReply rep;
- int status = 0;
- CARD32 *value_list;
- DMXInputAttributesRec attr;
- int count;
- char *name;
- int len;
- int paddedLength;
- int id = -1;
+ xDMXAddInputReply rep;
+ int status = 0;
+ CARD32 *value_list;
+ DMXInputAttributesRec attr;
+ int count;
+ char *name;
+ int len;
+ int paddedLength;
+ int id = -1;
REQUEST_AT_LEAST_SIZE(xDMXAddInputReq);
paddedLength = pad_to_int32(stuff->displayNameLength);
- len = client->req_len - (sizeof(xDMXAddInputReq) >> 2);
- if (len != Ones(stuff->valueMask) + paddedLength/4)
+ len = client->req_len - (sizeof(xDMXAddInputReq) >> 2);
+ if (len != Ones(stuff->valueMask) + paddedLength / 4)
return BadLength;
memset(&attr, 0, sizeof(attr));
- value_list = (CARD32 *)(stuff + 1);
- count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
-
+ value_list = (CARD32 *) (stuff + 1);
+ count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
+
if (!(name = malloc(stuff->displayNameLength + 1 + 4)))
return BadAlloc;
memcpy(name, &value_list[count], stuff->displayNameLength);
@@ -793,81 +847,100 @@ static int ProcDMXAddInput(ClientPtr client)
free(name);
- if (status) return status;
+ if (status)
+ return status;
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- rep.physicalId = id;
+ rep.length = 0;
+ rep.status = status;
+ rep.physicalId = id;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
swapl(&rep.physicalId);
}
- WriteToClient(client, sizeof(xDMXAddInputReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXAddInputReply), (char *) &rep);
return Success;
}
-static int ProcDMXRemoveInput(ClientPtr client)
+static int
+ProcDMXRemoveInput(ClientPtr client)
{
REQUEST(xDMXRemoveInputReq);
- xDMXRemoveInputReply rep;
- int status = 0;
+ xDMXRemoveInputReply rep;
+ int status = 0;
REQUEST_SIZE_MATCH(xDMXRemoveInputReq);
status = dmxRemoveInput(stuff->physicalId);
- if (status) return status;
+ if (status)
+ return status;
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
+ rep.length = 0;
+ rep.status = status;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
}
- WriteToClient(client, sizeof(xDMXRemoveInputReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXRemoveInputReply), (char *) &rep);
return Success;
}
-static int ProcDMXDispatch(ClientPtr client)
+static int
+ProcDMXDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
- case X_DMXQueryVersion: return ProcDMXQueryVersion(client);
- case X_DMXSync: return ProcDMXSync(client);
- case X_DMXForceWindowCreation: return ProcDMXForceWindowCreation(client);
- case X_DMXGetScreenCount: return ProcDMXGetScreenCount(client);
- case X_DMXGetScreenAttributes: return ProcDMXGetScreenAttributes(client);
+ case X_DMXQueryVersion:
+ return ProcDMXQueryVersion(client);
+ case X_DMXSync:
+ return ProcDMXSync(client);
+ case X_DMXForceWindowCreation:
+ return ProcDMXForceWindowCreation(client);
+ case X_DMXGetScreenCount:
+ return ProcDMXGetScreenCount(client);
+ case X_DMXGetScreenAttributes:
+ return ProcDMXGetScreenAttributes(client);
case X_DMXChangeScreensAttributes:
return ProcDMXChangeScreensAttributes(client);
- case X_DMXAddScreen: return ProcDMXAddScreen(client);
- case X_DMXRemoveScreen: return ProcDMXRemoveScreen(client);
- case X_DMXGetWindowAttributes: return ProcDMXGetWindowAttributes(client);
- case X_DMXGetDesktopAttributes: return ProcDMXGetDesktopAttributes(client);
+ case X_DMXAddScreen:
+ return ProcDMXAddScreen(client);
+ case X_DMXRemoveScreen:
+ return ProcDMXRemoveScreen(client);
+ case X_DMXGetWindowAttributes:
+ return ProcDMXGetWindowAttributes(client);
+ case X_DMXGetDesktopAttributes:
+ return ProcDMXGetDesktopAttributes(client);
case X_DMXChangeDesktopAttributes:
return ProcDMXChangeDesktopAttributes(client);
- case X_DMXGetInputCount: return ProcDMXGetInputCount(client);
- case X_DMXGetInputAttributes: return ProcDMXGetInputAttributes(client);
- case X_DMXAddInput: return ProcDMXAddInput(client);
- case X_DMXRemoveInput: return ProcDMXRemoveInput(client);
-
+ case X_DMXGetInputCount:
+ return ProcDMXGetInputCount(client);
+ case X_DMXGetInputAttributes:
+ return ProcDMXGetInputAttributes(client);
+ case X_DMXAddInput:
+ return ProcDMXAddInput(client);
+ case X_DMXRemoveInput:
+ return ProcDMXRemoveInput(client);
+
case X_DMXGetScreenInformationDEPRECATED:
case X_DMXForceWindowCreationDEPRECATED:
case X_DMXReconfigureScreenDEPRECATED:
return BadImplementation;
- default: return BadRequest;
+ default:
+ return BadRequest;
}
}
-static int SProcDMXQueryVersion(ClientPtr client)
+static int
+SProcDMXQueryVersion(ClientPtr client)
{
REQUEST(xDMXQueryVersionReq);
@@ -876,7 +949,8 @@ static int SProcDMXQueryVersion(ClientPtr client)
return ProcDMXQueryVersion(client);
}
-static int SProcDMXSync(ClientPtr client)
+static int
+SProcDMXSync(ClientPtr client)
{
REQUEST(xDMXSyncReq);
@@ -885,7 +959,8 @@ static int SProcDMXSync(ClientPtr client)
return ProcDMXSync(client);
}
-static int SProcDMXForceWindowCreation(ClientPtr client)
+static int
+SProcDMXForceWindowCreation(ClientPtr client)
{
REQUEST(xDMXForceWindowCreationReq);
@@ -895,7 +970,8 @@ static int SProcDMXForceWindowCreation(ClientPtr client)
return ProcDMXForceWindowCreation(client);
}
-static int SProcDMXGetScreenCount(ClientPtr client)
+static int
+SProcDMXGetScreenCount(ClientPtr client)
{
REQUEST(xDMXGetScreenCountReq);
@@ -904,7 +980,8 @@ static int SProcDMXGetScreenCount(ClientPtr client)
return ProcDMXGetScreenCount(client);
}
-static int SProcDMXGetScreenAttributes(ClientPtr client)
+static int
+SProcDMXGetScreenAttributes(ClientPtr client)
{
REQUEST(xDMXGetScreenAttributesReq);
@@ -914,7 +991,8 @@ static int SProcDMXGetScreenAttributes(ClientPtr client)
return ProcDMXGetScreenAttributes(client);
}
-static int SProcDMXChangeScreensAttributes(ClientPtr client)
+static int
+SProcDMXChangeScreensAttributes(ClientPtr client)
{
REQUEST(xDMXChangeScreensAttributesReq);
@@ -926,9 +1004,11 @@ static int SProcDMXChangeScreensAttributes(ClientPtr client)
return ProcDMXGetScreenAttributes(client);
}
-static int SProcDMXAddScreen(ClientPtr client)
+static int
+SProcDMXAddScreen(ClientPtr client)
{
int paddedLength;
+
REQUEST(xDMXAddScreenReq);
swaps(&stuff->length);
@@ -936,11 +1016,12 @@ static int SProcDMXAddScreen(ClientPtr client)
swapl(&stuff->displayNameLength);
swapl(&stuff->valueMask);
paddedLength = pad_to_int32(stuff->displayNameLength);
- SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
+ SwapLongs((CARD32 *) (stuff + 1), LengthRestL(stuff) - paddedLength / 4);
return ProcDMXAddScreen(client);
}
-static int SProcDMXRemoveScreen(ClientPtr client)
+static int
+SProcDMXRemoveScreen(ClientPtr client)
{
REQUEST(xDMXRemoveScreenReq);
@@ -950,7 +1031,8 @@ static int SProcDMXRemoveScreen(ClientPtr client)
return ProcDMXRemoveScreen(client);
}
-static int SProcDMXGetWindowAttributes(ClientPtr client)
+static int
+SProcDMXGetWindowAttributes(ClientPtr client)
{
REQUEST(xDMXGetWindowAttributesReq);
@@ -960,7 +1042,8 @@ static int SProcDMXGetWindowAttributes(ClientPtr client)
return ProcDMXGetWindowAttributes(client);
}
-static int SProcDMXGetDesktopAttributes(ClientPtr client)
+static int
+SProcDMXGetDesktopAttributes(ClientPtr client)
{
REQUEST(xDMXGetDesktopAttributesReq);
@@ -969,7 +1052,8 @@ static int SProcDMXGetDesktopAttributes(ClientPtr client)
return ProcDMXGetDesktopAttributes(client);
}
-static int SProcDMXChangeDesktopAttributes(ClientPtr client)
+static int
+SProcDMXChangeDesktopAttributes(ClientPtr client)
{
REQUEST(xDMXChangeDesktopAttributesReq);
@@ -980,7 +1064,8 @@ static int SProcDMXChangeDesktopAttributes(ClientPtr client)
return ProcDMXChangeDesktopAttributes(client);
}
-static int SProcDMXGetInputCount(ClientPtr client)
+static int
+SProcDMXGetInputCount(ClientPtr client)
{
REQUEST(xDMXGetInputCountReq);
@@ -989,7 +1074,8 @@ static int SProcDMXGetInputCount(ClientPtr client)
return ProcDMXGetInputCount(client);
}
-static int SProcDMXGetInputAttributes(ClientPtr client)
+static int
+SProcDMXGetInputAttributes(ClientPtr client)
{
REQUEST(xDMXGetInputAttributesReq);
@@ -999,9 +1085,11 @@ static int SProcDMXGetInputAttributes(ClientPtr client)
return ProcDMXGetInputAttributes(client);
}
-static int SProcDMXAddInput(ClientPtr client)
+static int
+SProcDMXAddInput(ClientPtr client)
{
int paddedLength;
+
REQUEST(xDMXAddInputReq);
swaps(&stuff->length);
@@ -1009,11 +1097,12 @@ static int SProcDMXAddInput(ClientPtr client)
swapl(&stuff->displayNameLength);
swapl(&stuff->valueMask);
paddedLength = pad_to_int32(stuff->displayNameLength);
- SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
+ SwapLongs((CARD32 *) (stuff + 1), LengthRestL(stuff) - paddedLength / 4);
return ProcDMXAddInput(client);
}
-static int SProcDMXRemoveInput(ClientPtr client)
+static int
+SProcDMXRemoveInput(ClientPtr client)
{
REQUEST(xDMXRemoveInputReq);
@@ -1023,46 +1112,61 @@ static int SProcDMXRemoveInput(ClientPtr client)
return ProcDMXRemoveInput(client);
}
-static int SProcDMXDispatch (ClientPtr client)
+static int
+SProcDMXDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
- case X_DMXQueryVersion: return SProcDMXQueryVersion(client);
- case X_DMXSync: return SProcDMXSync(client);
- case X_DMXForceWindowCreation: return SProcDMXForceWindowCreation(client);
- case X_DMXGetScreenCount: return SProcDMXGetScreenCount(client);
- case X_DMXGetScreenAttributes: return SProcDMXGetScreenAttributes(client);
+ case X_DMXQueryVersion:
+ return SProcDMXQueryVersion(client);
+ case X_DMXSync:
+ return SProcDMXSync(client);
+ case X_DMXForceWindowCreation:
+ return SProcDMXForceWindowCreation(client);
+ case X_DMXGetScreenCount:
+ return SProcDMXGetScreenCount(client);
+ case X_DMXGetScreenAttributes:
+ return SProcDMXGetScreenAttributes(client);
case X_DMXChangeScreensAttributes:
return SProcDMXChangeScreensAttributes(client);
- case X_DMXAddScreen: return SProcDMXAddScreen(client);
- case X_DMXRemoveScreen: return SProcDMXRemoveScreen(client);
- case X_DMXGetWindowAttributes: return SProcDMXGetWindowAttributes(client);
+ case X_DMXAddScreen:
+ return SProcDMXAddScreen(client);
+ case X_DMXRemoveScreen:
+ return SProcDMXRemoveScreen(client);
+ case X_DMXGetWindowAttributes:
+ return SProcDMXGetWindowAttributes(client);
case X_DMXGetDesktopAttributes:
return SProcDMXGetDesktopAttributes(client);
case X_DMXChangeDesktopAttributes:
return SProcDMXChangeDesktopAttributes(client);
- case X_DMXGetInputCount: return SProcDMXGetInputCount(client);
- case X_DMXGetInputAttributes: return SProcDMXGetInputAttributes(client);
- case X_DMXAddInput: return SProcDMXAddInput(client);
- case X_DMXRemoveInput: return SProcDMXRemoveInput(client);
-
+ case X_DMXGetInputCount:
+ return SProcDMXGetInputCount(client);
+ case X_DMXGetInputAttributes:
+ return SProcDMXGetInputAttributes(client);
+ case X_DMXAddInput:
+ return SProcDMXAddInput(client);
+ case X_DMXRemoveInput:
+ return SProcDMXRemoveInput(client);
+
case X_DMXGetScreenInformationDEPRECATED:
case X_DMXForceWindowCreationDEPRECATED:
case X_DMXReconfigureScreenDEPRECATED:
return BadImplementation;
- default: return BadRequest;
+ default:
+ return BadRequest;
}
}
/** Initialize the extension. */
-void DMXExtensionInit(void)
+void
+DMXExtensionInit(void)
{
ExtensionEntry *extEntry;
-
+
if ((extEntry = AddExtension(DMX_EXTENSION_NAME, 0, 0,
ProcDMXDispatch, SProcDMXDispatch,
NULL, StandardMinorOpcode)))
- DMXCode = extEntry->base;
+ DMXCode = extEntry->base;
}
diff --git a/xorg-server/hw/dmx/dmx_glxvisuals.c b/xorg-server/hw/dmx/dmx_glxvisuals.c
index dd77bd23a..9fcc0e58d 100644
--- a/xorg-server/hw/dmx/dmx_glxvisuals.c
+++ b/xorg-server/hw/dmx/dmx_glxvisuals.c
@@ -1,601 +1,601 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include <GL/glx.h>
-#include <GL/glxproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-
-#include "dmx_glxvisuals.h"
-
-__GLXvisualConfig *GetGLXVisualConfigs(Display *dpy, int screen, int *nconfigs)
-{
- xGLXGetVisualConfigsReq *req;
- xGLXGetVisualConfigsReply reply;
- __GLXvisualConfig *config, *configs;
- GLint i, j, nvisuals, nprops;
- INT32 *props, *p;
- int majorOpcode, dummy;
- int num_good_visuals;
-
- if (!XQueryExtension(dpy, "GLX", &majorOpcode, &dummy, &dummy)) {
- return NULL;
- }
-
- /* Send the glXGetVisualConfigs request */
- LockDisplay(dpy);
- GetReq(GLXGetVisualConfigs,req);
- req->reqType = majorOpcode;
- req->glxCode = X_GLXGetVisualConfigs;
- req->screen = screen;
- if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
- /* Something is busted. Punt. */
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- nvisuals = (int)reply.numVisuals;
- if (!nvisuals) {
- /* This screen does not support GL rendering */
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- /* Check number of properties per visual */
- nprops = (int)reply.numProps;
- if (nprops < __GLX_MIN_CONFIG_PROPS) {
- /* Huh? Not in protocol defined limits. Punt */
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
- props = (INT32*) Xmalloc(nprops * __GLX_SIZE_CARD32);
- if (!props) {
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- /* Allocate memory for our config structure */
- config = (__GLXvisualConfig*)
- Xmalloc(nvisuals * sizeof(__GLXvisualConfig));
- if (!config) {
- free(props);
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
- memset(config, 0, nvisuals * sizeof(__GLXvisualConfig));
- configs = config;
- num_good_visuals = 0;
-
- /* Convert config structure into our format */
- for (i=0; i<nvisuals; i++) {
-
- /* Read config structure */
- _XRead(dpy, (char *)props, (nprops * __GLX_SIZE_CARD32));
-
- /* fill in default values */
- config->visualRating = GLX_NONE_EXT;
- config->transparentPixel = GLX_NONE_EXT;
-
- /* Copy in the first set of properties */
- config->vid = props[0];
- config->class = props[1];
-
- config->rgba = (Bool) props[2];
-
- config->redSize = props[3];
- config->greenSize = props[4];
- config->blueSize = props[5];
- config->alphaSize = props[6];
-
- config->accumRedSize = props[7];
- config->accumGreenSize = props[8];
- config->accumBlueSize = props[9];
- config->accumAlphaSize = props[10];
-
- config->doubleBuffer = (Bool) props[11];
- config->stereo = (Bool) props[12];
-
- config->bufferSize = props[13];
- config->depthSize = props[14];
- config->stencilSize = props[15];
-
- config->auxBuffers = props[16];
- config->level = props[17];
-
- /* Process remaining properties */
- p = &props[18];
- for (j=__GLX_MIN_CONFIG_PROPS; j<nprops; j+=2) {
- int property = *p++;
- int value = *p++;
-
- switch (property) {
- case GLX_SAMPLES_SGIS:
- config->multiSampleSize = value;
- break;
- case GLX_SAMPLE_BUFFERS_SGIS:
- config->nMultiSampleBuffers = value;
- break;
-
- case GLX_TRANSPARENT_TYPE_EXT:
- config->transparentPixel = value;
- break;
- case GLX_TRANSPARENT_INDEX_VALUE_EXT:
- config->transparentIndex = value;
- break;
- case GLX_TRANSPARENT_RED_VALUE_EXT:
- config->transparentRed = value;
- break;
- case GLX_TRANSPARENT_GREEN_VALUE_EXT:
- config->transparentGreen = value;
- break;
- case GLX_TRANSPARENT_BLUE_VALUE_EXT:
- config->transparentBlue = value;
- break;
- case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
- config->transparentAlpha = value;
- break;
-
- case GLX_VISUAL_CAVEAT_EXT:
- config->visualRating = value;
- break;
-
- /* visualSelectGroup is an internal used property */
- case GLX_VISUAL_SELECT_GROUP_SGIX:
- config->visualSelectGroup = value;
- break;
-
- default :
- /* Ignore properties we don't recognize */
- break;
- }
- } /* for j */
-
- /*
- // filter out overlay visuals (dmx does not support overlays)
- */
- if (config->level == 0) {
- config++;
- num_good_visuals++;
- }
-
- } /* for i */
-
- UnlockDisplay(dpy);
-
- nvisuals = num_good_visuals;
-
- config = configs;
- for (i=0; i<nvisuals; i++) {
- /* XXX hack to fill-in mask info (need a better way to do this) */
- {
- XVisualInfo *vis, template;
- int n;
-
- template.screen = screen;
- template.visualid = config->vid;
- vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask,
- &template, &n);
-
- if (vis != NULL) {
- config->redMask = vis->red_mask;
- config->greenMask = vis->green_mask;
- config->blueMask = vis->blue_mask;
- config->alphaMask = 0; /* XXX */
- free(vis);
- }
- }
- config++;
- } /* for i */
-
- XFree(props);
- SyncHandle();
-
- *nconfigs = nvisuals;
- return configs;
-}
-
-
-__GLXFBConfig *GetGLXFBConfigs(Display *dpy, int glxMajorOpcode, int *nconfigs)
-{
- xGLXGetFBConfigsReq *req;
- xGLXGetFBConfigsReply reply;
- __GLXFBConfig *config, *fbconfigs;
- GLint i, j, numFBConfigs, numAttribs;
- INT32 *attrs, *p;
- int screen = DefaultScreen( dpy );
- int numValidConfigs = 0;
-
- /* Send the glXGetFBConfigs request */
- LockDisplay(dpy);
- GetReq(GLXGetFBConfigs, req);
- req->reqType = glxMajorOpcode;
- req->glxCode = X_GLXGetFBConfigs;
- req->screen = screen;
-
- *nconfigs = 0;
-
- if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
- /* Something is busted. Punt. */
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- numFBConfigs = (int)reply.numFBConfigs;
- if (!numFBConfigs) {
- /* This screen does not support GL rendering */
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- numAttribs = (int)reply.numAttribs;
- if (!numAttribs) {
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- attrs = (INT32*) Xmalloc(2*numAttribs * __GLX_SIZE_CARD32);
- if (!attrs) {
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- /* Allocate memory for our config structure */
- config = (__GLXFBConfig*)
- Xmalloc(numFBConfigs * sizeof(__GLXFBConfig));
- if (!config) {
- free(attrs);
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
- memset(config, 0, numFBConfigs * sizeof(__GLXFBConfig));
- fbconfigs = config;
-
- /* Convert attribute list into our format */
- for (i=0; i<numFBConfigs; i++) {
-
- /* Fill in default properties */
- config->transparentType = GLX_NONE_EXT;
- config->visualCaveat = GLX_NONE_EXT;
- config->minRed = 0.;
- config->maxRed = 1.;
- config->minGreen = 0.;
- config->maxGreen = 1.;
- config->minBlue = 0.;
- config->maxBlue = 1.;
- config->minAlpha = 0.;
- config->maxAlpha = 1.;
-
- /* Read attribute list */
- _XRead(dpy, (char *)attrs, (2*numAttribs * __GLX_SIZE_CARD32));
-
- p = attrs;
- for (j=0; j<numAttribs; j++) {
- int attribute = *p++;
- int value = *p++;
-
- switch (attribute) {
- /* core attributes */
- case GLX_FBCONFIG_ID:
- config->id = value;
- break;
- case GLX_BUFFER_SIZE:
- config->indexBits = value;
- break;
- case GLX_LEVEL:
- config->level = value;
- break;
- case GLX_DOUBLEBUFFER:
- config->doubleBufferMode = value;
- break;
- case GLX_STEREO:
- config->stereoMode = value;
- break;
- case GLX_AUX_BUFFERS:
- config->maxAuxBuffers = value;
- break;
- case GLX_RED_SIZE:
- config->redBits = value;
- break;
- case GLX_GREEN_SIZE:
- config->greenBits = value;
- break;
- case GLX_BLUE_SIZE:
- config->blueBits = value;
- break;
- case GLX_ALPHA_SIZE:
- config->alphaBits = value;
- break;
- case GLX_DEPTH_SIZE:
- config->depthBits = value;
- break;
- case GLX_STENCIL_SIZE:
- config->stencilBits = value;
- break;
- case GLX_ACCUM_RED_SIZE:
- config->accumRedBits = value;
- break;
- case GLX_ACCUM_GREEN_SIZE:
- config->accumGreenBits = value;
- break;
- case GLX_ACCUM_BLUE_SIZE:
- config->accumBlueBits = value;
- break;
- case GLX_ACCUM_ALPHA_SIZE:
- config->accumAlphaBits = value;
- break;
- case GLX_RENDER_TYPE:
- config->renderType = value;
- break;
- case GLX_DRAWABLE_TYPE:
- config->drawableType = value;
- break;
- case GLX_X_VISUAL_TYPE:
- config->visualType = value;
- break;
- case GLX_CONFIG_CAVEAT:
- config->visualCaveat = value;
- break;
- case GLX_TRANSPARENT_TYPE:
- config->transparentType = value;
- break;
- case GLX_TRANSPARENT_INDEX_VALUE:
- config->transparentIndex = value;
- break;
- case GLX_TRANSPARENT_RED_VALUE:
- config->transparentRed = value;
- break;
- case GLX_TRANSPARENT_GREEN_VALUE:
- config->transparentGreen = value;
- break;
- case GLX_TRANSPARENT_BLUE_VALUE:
- config->transparentBlue = value;
- break;
- case GLX_TRANSPARENT_ALPHA_VALUE:
- config->transparentAlpha = value;
- break;
- case GLX_MAX_PBUFFER_WIDTH:
- config->maxPbufferWidth = value;
- break;
- case GLX_MAX_PBUFFER_HEIGHT:
- config->maxPbufferHeight = value;
- break;
- case GLX_MAX_PBUFFER_PIXELS:
- config->maxPbufferPixels = value;
- break;
- case GLX_VISUAL_ID:
- config->associatedVisualId = value;
- break;
-
- /* visualSelectGroup is an internal used property */
- case GLX_VISUAL_SELECT_GROUP_SGIX:
- config->visualSelectGroup = value;
- break;
-
- /* SGIS_multisample attributes */
- case GLX_SAMPLES_SGIS:
- config->multiSampleSize = value;
- break;
- case GLX_SAMPLE_BUFFERS_SGIS:
- config->nMultiSampleBuffers = value;
- break;
-
- /* SGIX_pbuffer specific attributes */
- case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
- config->optimalPbufferWidth = value;
- break;
- case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
- config->optimalPbufferHeight = value;
- break;
-
- default:
- /* Ignore attributes we don't recognize */
- break;
- }
- } /* for j */
-
- /* Fill in derived values */
- config->screen = screen;
-
- config->rgbMode = config->renderType & GLX_RGBA_BIT;
- config->colorIndexMode = !config->rgbMode;
-
- config->haveAccumBuffer =
- config->accumRedBits > 0 ||
- config->accumGreenBits > 0 ||
- config->accumBlueBits > 0;
- /* Can't have alpha without color */
-
- config->haveDepthBuffer = config->depthBits > 0;
- config->haveStencilBuffer = config->stencilBits > 0;
-
- /* overlay visuals are not valid for now */
- if (!config->level) {
- config++;
- numValidConfigs++;
- }
-
- } /* for i */
- UnlockDisplay(dpy);
-
- config = fbconfigs;
- for (i=0; i<numValidConfigs; i++) {
-
- /* XXX hack to fill-in mask info (need a better way to do this) */
- if (config->associatedVisualId != 0) {
- XVisualInfo *vis, template;
- int n;
-
- template.screen = screen;
- template.visualid = config->associatedVisualId;
- vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask,
- &template, &n);
-
- if (vis != NULL) {
- config->redMask = (GLuint)vis->red_mask;
- config->greenMask = (GLuint)vis->green_mask;
- config->blueMask = (GLuint)vis->blue_mask;
- config->alphaMask = 0; /* XXX */
- free(vis);
- }
- }
-
- config++;
- } /* for i */
-
- XFree(attrs);
- SyncHandle();
-
- *nconfigs = numValidConfigs;
- return fbconfigs;
-}
-
-__GLXvisualConfig *
-GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig *fbconfigs, int nfbconfigs,
- XVisualInfo *visuals, int nvisuals,
- __GLXvisualConfig *glxConfigs, int nGlxConfigs,
- int *nconfigs)
-{
- __GLXvisualConfig *configs = NULL;
- int i;
-
- if (!fbconfigs || !nfbconfigs || !nconfigs) return NULL;
- *nconfigs = 0;
-
- /* Allocate memory for our config structure */
- configs = (__GLXvisualConfig*)
- Xmalloc(nfbconfigs * sizeof(__GLXvisualConfig));
- if (!configs) {
- return NULL;
- }
- memset(configs, 0, nfbconfigs * sizeof(__GLXvisualConfig));
-
- for (i=0; i<nfbconfigs; i++) {
- __GLXFBConfig *fbcfg = &fbconfigs[i];
-
- if (fbcfg->associatedVisualId > 0) {
- __GLXvisualConfig *cfg = configs + (*nconfigs);
- int j;
- XVisualInfo *vinfo = NULL;
-
- for (j=0; j<nvisuals; j++) {
- if (visuals[j].visualid == fbcfg->associatedVisualId) {
- vinfo = &visuals[j];
- break;
- }
- }
- if (!vinfo) continue;
-
- /* skip 16 bit colormap visuals */
- if (vinfo->depth == 16 &&
- vinfo->class != TrueColor &&
- vinfo->class != DirectColor ) {
- continue;
- }
-
- (*nconfigs)++;
-
- /*
- * if the same visualid exists in the glx configs,
- * copy the glx attributes from the glx config
- */
- for (j=0; j<nGlxConfigs; j++) {
- if (glxConfigs[j].vid == vinfo->visualid)
- break;
- }
- if (j < nGlxConfigs) {
- memcpy(cfg, &glxConfigs[j], sizeof(__GLXvisualConfig) );
- continue;
- }
-
- /*
- * make glx attributes from the FB config attributes
- */
- cfg->vid = fbcfg->associatedVisualId;
- cfg->class = vinfo->class;
- cfg->rgba = !(fbcfg->renderType & GLX_COLOR_INDEX_BIT_SGIX);
- cfg->redSize = fbcfg->redBits;
- cfg->greenSize = fbcfg->greenBits;
- cfg->blueSize = fbcfg->blueBits;
- cfg->alphaSize = fbcfg->alphaBits;
- cfg->redMask = fbcfg->redMask;
- cfg->greenMask = fbcfg->greenMask;
- cfg->blueMask = fbcfg->blueMask;
- cfg->alphaMask = fbcfg->alphaMask;
- cfg->accumRedSize = fbcfg->accumRedBits;
- cfg->accumGreenSize = fbcfg->accumGreenBits;
- cfg->accumBlueSize = fbcfg->accumBlueBits;
- cfg->accumAlphaSize = fbcfg->accumAlphaBits;
- cfg->doubleBuffer = fbcfg->doubleBufferMode;
- cfg->stereo = fbcfg->stereoMode;
- if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
- cfg->bufferSize = (fbcfg->rgbMode ? (fbcfg->redBits +
- fbcfg->greenBits +
- fbcfg->blueBits +
- fbcfg->alphaBits)
- : fbcfg->indexBits );
- }
- else {
- cfg->bufferSize = vinfo->depth;
- }
- cfg->depthSize = fbcfg->depthBits;
- cfg->stencilSize = fbcfg->stencilBits;
- cfg->auxBuffers = fbcfg->maxAuxBuffers;
- cfg->level = fbcfg->level;
- cfg->visualRating = fbcfg->visualCaveat;
- cfg->transparentPixel = fbcfg->transparentType;
- cfg->transparentRed = fbcfg->transparentRed;
- cfg->transparentGreen = fbcfg->transparentGreen;
- cfg->transparentBlue = fbcfg->transparentBlue;
- cfg->transparentAlpha = fbcfg->transparentAlpha;
- cfg->transparentIndex = fbcfg->transparentIndex;
- cfg->multiSampleSize = fbcfg->multiSampleSize;
- cfg->nMultiSampleBuffers = fbcfg->nMultiSampleBuffers;
- cfg->visualSelectGroup = fbcfg->visualSelectGroup;
- }
- }
-
- return configs;
-}
-
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include <GL/glx.h>
+#include <GL/glxproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+#include "dmx_glxvisuals.h"
+
+__GLXvisualConfig *
+GetGLXVisualConfigs(Display * dpy, int screen, int *nconfigs)
+{
+ xGLXGetVisualConfigsReq *req;
+ xGLXGetVisualConfigsReply reply;
+ __GLXvisualConfig *config, *configs;
+ GLint i, j, nvisuals, nprops;
+ INT32 *props, *p;
+ int majorOpcode, dummy;
+ int num_good_visuals;
+
+ if (!XQueryExtension(dpy, "GLX", &majorOpcode, &dummy, &dummy)) {
+ return NULL;
+ }
+
+ /* Send the glXGetVisualConfigs request */
+ LockDisplay(dpy);
+ GetReq(GLXGetVisualConfigs, req);
+ req->reqType = majorOpcode;
+ req->glxCode = X_GLXGetVisualConfigs;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ /* Something is busted. Punt. */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ nvisuals = (int) reply.numVisuals;
+ if (!nvisuals) {
+ /* This screen does not support GL rendering */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ /* Check number of properties per visual */
+ nprops = (int) reply.numProps;
+ if (nprops < __GLX_MIN_CONFIG_PROPS) {
+ /* Huh? Not in protocol defined limits. Punt */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ props = (INT32 *) Xmalloc(nprops * __GLX_SIZE_CARD32);
+ if (!props) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ /* Allocate memory for our config structure */
+ config = (__GLXvisualConfig *)
+ Xmalloc(nvisuals * sizeof(__GLXvisualConfig));
+ if (!config) {
+ free(props);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ memset(config, 0, nvisuals * sizeof(__GLXvisualConfig));
+ configs = config;
+ num_good_visuals = 0;
+
+ /* Convert config structure into our format */
+ for (i = 0; i < nvisuals; i++) {
+
+ /* Read config structure */
+ _XRead(dpy, (char *) props, (nprops * __GLX_SIZE_CARD32));
+
+ /* fill in default values */
+ config->visualRating = GLX_NONE_EXT;
+ config->transparentPixel = GLX_NONE_EXT;
+
+ /* Copy in the first set of properties */
+ config->vid = props[0];
+ config->class = props[1];
+
+ config->rgba = (Bool) props[2];
+
+ config->redSize = props[3];
+ config->greenSize = props[4];
+ config->blueSize = props[5];
+ config->alphaSize = props[6];
+
+ config->accumRedSize = props[7];
+ config->accumGreenSize = props[8];
+ config->accumBlueSize = props[9];
+ config->accumAlphaSize = props[10];
+
+ config->doubleBuffer = (Bool) props[11];
+ config->stereo = (Bool) props[12];
+
+ config->bufferSize = props[13];
+ config->depthSize = props[14];
+ config->stencilSize = props[15];
+
+ config->auxBuffers = props[16];
+ config->level = props[17];
+
+ /* Process remaining properties */
+ p = &props[18];
+ for (j = __GLX_MIN_CONFIG_PROPS; j < nprops; j += 2) {
+ int property = *p++;
+ int value = *p++;
+
+ switch (property) {
+ case GLX_SAMPLES_SGIS:
+ config->multiSampleSize = value;
+ break;
+ case GLX_SAMPLE_BUFFERS_SGIS:
+ config->nMultiSampleBuffers = value;
+ break;
+
+ case GLX_TRANSPARENT_TYPE_EXT:
+ config->transparentPixel = value;
+ break;
+ case GLX_TRANSPARENT_INDEX_VALUE_EXT:
+ config->transparentIndex = value;
+ break;
+ case GLX_TRANSPARENT_RED_VALUE_EXT:
+ config->transparentRed = value;
+ break;
+ case GLX_TRANSPARENT_GREEN_VALUE_EXT:
+ config->transparentGreen = value;
+ break;
+ case GLX_TRANSPARENT_BLUE_VALUE_EXT:
+ config->transparentBlue = value;
+ break;
+ case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
+ config->transparentAlpha = value;
+ break;
+
+ case GLX_VISUAL_CAVEAT_EXT:
+ config->visualRating = value;
+ break;
+
+ /* visualSelectGroup is an internal used property */
+ case GLX_VISUAL_SELECT_GROUP_SGIX:
+ config->visualSelectGroup = value;
+ break;
+
+ default:
+ /* Ignore properties we don't recognize */
+ break;
+ }
+ } /* for j */
+
+ /*
+ // filter out overlay visuals (dmx does not support overlays)
+ */
+ if (config->level == 0) {
+ config++;
+ num_good_visuals++;
+ }
+
+ } /* for i */
+
+ UnlockDisplay(dpy);
+
+ nvisuals = num_good_visuals;
+
+ config = configs;
+ for (i = 0; i < nvisuals; i++) {
+ /* XXX hack to fill-in mask info (need a better way to do this) */
+ {
+ XVisualInfo *vis, template;
+ int n;
+
+ template.screen = screen;
+ template.visualid = config->vid;
+ vis = XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask,
+ &template, &n);
+
+ if (vis != NULL) {
+ config->redMask = vis->red_mask;
+ config->greenMask = vis->green_mask;
+ config->blueMask = vis->blue_mask;
+ config->alphaMask = 0; /* XXX */
+ free(vis);
+ }
+ }
+ config++;
+ } /* for i */
+
+ XFree(props);
+ SyncHandle();
+
+ *nconfigs = nvisuals;
+ return configs;
+}
+
+__GLXFBConfig *
+GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs)
+{
+ xGLXGetFBConfigsReq *req;
+ xGLXGetFBConfigsReply reply;
+ __GLXFBConfig *config, *fbconfigs;
+ GLint i, j, numFBConfigs, numAttribs;
+ INT32 *attrs, *p;
+ int screen = DefaultScreen(dpy);
+ int numValidConfigs = 0;
+
+ /* Send the glXGetFBConfigs request */
+ LockDisplay(dpy);
+ GetReq(GLXGetFBConfigs, req);
+ req->reqType = glxMajorOpcode;
+ req->glxCode = X_GLXGetFBConfigs;
+ req->screen = screen;
+
+ *nconfigs = 0;
+
+ if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ /* Something is busted. Punt. */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ numFBConfigs = (int) reply.numFBConfigs;
+ if (!numFBConfigs) {
+ /* This screen does not support GL rendering */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ numAttribs = (int) reply.numAttribs;
+ if (!numAttribs) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ attrs = (INT32 *) Xmalloc(2 * numAttribs * __GLX_SIZE_CARD32);
+ if (!attrs) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ /* Allocate memory for our config structure */
+ config = (__GLXFBConfig *)
+ Xmalloc(numFBConfigs * sizeof(__GLXFBConfig));
+ if (!config) {
+ free(attrs);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ memset(config, 0, numFBConfigs * sizeof(__GLXFBConfig));
+ fbconfigs = config;
+
+ /* Convert attribute list into our format */
+ for (i = 0; i < numFBConfigs; i++) {
+
+ /* Fill in default properties */
+ config->transparentType = GLX_NONE_EXT;
+ config->visualCaveat = GLX_NONE_EXT;
+ config->minRed = 0.;
+ config->maxRed = 1.;
+ config->minGreen = 0.;
+ config->maxGreen = 1.;
+ config->minBlue = 0.;
+ config->maxBlue = 1.;
+ config->minAlpha = 0.;
+ config->maxAlpha = 1.;
+
+ /* Read attribute list */
+ _XRead(dpy, (char *) attrs, (2 * numAttribs * __GLX_SIZE_CARD32));
+
+ p = attrs;
+ for (j = 0; j < numAttribs; j++) {
+ int attribute = *p++;
+ int value = *p++;
+
+ switch (attribute) {
+ /* core attributes */
+ case GLX_FBCONFIG_ID:
+ config->id = value;
+ break;
+ case GLX_BUFFER_SIZE:
+ config->indexBits = value;
+ break;
+ case GLX_LEVEL:
+ config->level = value;
+ break;
+ case GLX_DOUBLEBUFFER:
+ config->doubleBufferMode = value;
+ break;
+ case GLX_STEREO:
+ config->stereoMode = value;
+ break;
+ case GLX_AUX_BUFFERS:
+ config->maxAuxBuffers = value;
+ break;
+ case GLX_RED_SIZE:
+ config->redBits = value;
+ break;
+ case GLX_GREEN_SIZE:
+ config->greenBits = value;
+ break;
+ case GLX_BLUE_SIZE:
+ config->blueBits = value;
+ break;
+ case GLX_ALPHA_SIZE:
+ config->alphaBits = value;
+ break;
+ case GLX_DEPTH_SIZE:
+ config->depthBits = value;
+ break;
+ case GLX_STENCIL_SIZE:
+ config->stencilBits = value;
+ break;
+ case GLX_ACCUM_RED_SIZE:
+ config->accumRedBits = value;
+ break;
+ case GLX_ACCUM_GREEN_SIZE:
+ config->accumGreenBits = value;
+ break;
+ case GLX_ACCUM_BLUE_SIZE:
+ config->accumBlueBits = value;
+ break;
+ case GLX_ACCUM_ALPHA_SIZE:
+ config->accumAlphaBits = value;
+ break;
+ case GLX_RENDER_TYPE:
+ config->renderType = value;
+ break;
+ case GLX_DRAWABLE_TYPE:
+ config->drawableType = value;
+ break;
+ case GLX_X_VISUAL_TYPE:
+ config->visualType = value;
+ break;
+ case GLX_CONFIG_CAVEAT:
+ config->visualCaveat = value;
+ break;
+ case GLX_TRANSPARENT_TYPE:
+ config->transparentType = value;
+ break;
+ case GLX_TRANSPARENT_INDEX_VALUE:
+ config->transparentIndex = value;
+ break;
+ case GLX_TRANSPARENT_RED_VALUE:
+ config->transparentRed = value;
+ break;
+ case GLX_TRANSPARENT_GREEN_VALUE:
+ config->transparentGreen = value;
+ break;
+ case GLX_TRANSPARENT_BLUE_VALUE:
+ config->transparentBlue = value;
+ break;
+ case GLX_TRANSPARENT_ALPHA_VALUE:
+ config->transparentAlpha = value;
+ break;
+ case GLX_MAX_PBUFFER_WIDTH:
+ config->maxPbufferWidth = value;
+ break;
+ case GLX_MAX_PBUFFER_HEIGHT:
+ config->maxPbufferHeight = value;
+ break;
+ case GLX_MAX_PBUFFER_PIXELS:
+ config->maxPbufferPixels = value;
+ break;
+ case GLX_VISUAL_ID:
+ config->associatedVisualId = value;
+ break;
+
+ /* visualSelectGroup is an internal used property */
+ case GLX_VISUAL_SELECT_GROUP_SGIX:
+ config->visualSelectGroup = value;
+ break;
+
+ /* SGIS_multisample attributes */
+ case GLX_SAMPLES_SGIS:
+ config->multiSampleSize = value;
+ break;
+ case GLX_SAMPLE_BUFFERS_SGIS:
+ config->nMultiSampleBuffers = value;
+ break;
+
+ /* SGIX_pbuffer specific attributes */
+ case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
+ config->optimalPbufferWidth = value;
+ break;
+ case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
+ config->optimalPbufferHeight = value;
+ break;
+
+ default:
+ /* Ignore attributes we don't recognize */
+ break;
+ }
+ } /* for j */
+
+ /* Fill in derived values */
+ config->screen = screen;
+
+ config->rgbMode = config->renderType & GLX_RGBA_BIT;
+ config->colorIndexMode = !config->rgbMode;
+
+ config->haveAccumBuffer =
+ config->accumRedBits > 0 ||
+ config->accumGreenBits > 0 || config->accumBlueBits > 0;
+ /* Can't have alpha without color */
+
+ config->haveDepthBuffer = config->depthBits > 0;
+ config->haveStencilBuffer = config->stencilBits > 0;
+
+ /* overlay visuals are not valid for now */
+ if (!config->level) {
+ config++;
+ numValidConfigs++;
+ }
+
+ } /* for i */
+ UnlockDisplay(dpy);
+
+ config = fbconfigs;
+ for (i = 0; i < numValidConfigs; i++) {
+
+ /* XXX hack to fill-in mask info (need a better way to do this) */
+ if (config->associatedVisualId != 0) {
+ XVisualInfo *vis, template;
+ int n;
+
+ template.screen = screen;
+ template.visualid = config->associatedVisualId;
+ vis = XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask,
+ &template, &n);
+
+ if (vis != NULL) {
+ config->redMask = (GLuint) vis->red_mask;
+ config->greenMask = (GLuint) vis->green_mask;
+ config->blueMask = (GLuint) vis->blue_mask;
+ config->alphaMask = 0; /* XXX */
+ free(vis);
+ }
+ }
+
+ config++;
+ } /* for i */
+
+ XFree(attrs);
+ SyncHandle();
+
+ *nconfigs = numValidConfigs;
+ return fbconfigs;
+}
+
+__GLXvisualConfig *
+GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig * fbconfigs, int nfbconfigs,
+ XVisualInfo * visuals, int nvisuals,
+ __GLXvisualConfig * glxConfigs,
+ int nGlxConfigs, int *nconfigs)
+{
+ __GLXvisualConfig *configs = NULL;
+ int i;
+
+ if (!fbconfigs || !nfbconfigs || !nconfigs)
+ return NULL;
+ *nconfigs = 0;
+
+ /* Allocate memory for our config structure */
+ configs = (__GLXvisualConfig *)
+ Xmalloc(nfbconfigs * sizeof(__GLXvisualConfig));
+ if (!configs) {
+ return NULL;
+ }
+ memset(configs, 0, nfbconfigs * sizeof(__GLXvisualConfig));
+
+ for (i = 0; i < nfbconfigs; i++) {
+ __GLXFBConfig *fbcfg = &fbconfigs[i];
+
+ if (fbcfg->associatedVisualId > 0) {
+ __GLXvisualConfig *cfg = configs + (*nconfigs);
+ int j;
+ XVisualInfo *vinfo = NULL;
+
+ for (j = 0; j < nvisuals; j++) {
+ if (visuals[j].visualid == fbcfg->associatedVisualId) {
+ vinfo = &visuals[j];
+ break;
+ }
+ }
+ if (!vinfo)
+ continue;
+
+ /* skip 16 bit colormap visuals */
+ if (vinfo->depth == 16 &&
+ vinfo->class != TrueColor && vinfo->class != DirectColor) {
+ continue;
+ }
+
+ (*nconfigs)++;
+
+ /*
+ * if the same visualid exists in the glx configs,
+ * copy the glx attributes from the glx config
+ */
+ for (j = 0; j < nGlxConfigs; j++) {
+ if (glxConfigs[j].vid == vinfo->visualid)
+ break;
+ }
+ if (j < nGlxConfigs) {
+ memcpy(cfg, &glxConfigs[j], sizeof(__GLXvisualConfig));
+ continue;
+ }
+
+ /*
+ * make glx attributes from the FB config attributes
+ */
+ cfg->vid = fbcfg->associatedVisualId;
+ cfg->class = vinfo->class;
+ cfg->rgba = !(fbcfg->renderType & GLX_COLOR_INDEX_BIT_SGIX);
+ cfg->redSize = fbcfg->redBits;
+ cfg->greenSize = fbcfg->greenBits;
+ cfg->blueSize = fbcfg->blueBits;
+ cfg->alphaSize = fbcfg->alphaBits;
+ cfg->redMask = fbcfg->redMask;
+ cfg->greenMask = fbcfg->greenMask;
+ cfg->blueMask = fbcfg->blueMask;
+ cfg->alphaMask = fbcfg->alphaMask;
+ cfg->accumRedSize = fbcfg->accumRedBits;
+ cfg->accumGreenSize = fbcfg->accumGreenBits;
+ cfg->accumBlueSize = fbcfg->accumBlueBits;
+ cfg->accumAlphaSize = fbcfg->accumAlphaBits;
+ cfg->doubleBuffer = fbcfg->doubleBufferMode;
+ cfg->stereo = fbcfg->stereoMode;
+ if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
+ cfg->bufferSize = (fbcfg->rgbMode ? (fbcfg->redBits +
+ fbcfg->greenBits +
+ fbcfg->blueBits +
+ fbcfg->alphaBits)
+ : fbcfg->indexBits);
+ }
+ else {
+ cfg->bufferSize = vinfo->depth;
+ }
+ cfg->depthSize = fbcfg->depthBits;
+ cfg->stencilSize = fbcfg->stencilBits;
+ cfg->auxBuffers = fbcfg->maxAuxBuffers;
+ cfg->level = fbcfg->level;
+ cfg->visualRating = fbcfg->visualCaveat;
+ cfg->transparentPixel = fbcfg->transparentType;
+ cfg->transparentRed = fbcfg->transparentRed;
+ cfg->transparentGreen = fbcfg->transparentGreen;
+ cfg->transparentBlue = fbcfg->transparentBlue;
+ cfg->transparentAlpha = fbcfg->transparentAlpha;
+ cfg->transparentIndex = fbcfg->transparentIndex;
+ cfg->multiSampleSize = fbcfg->multiSampleSize;
+ cfg->nMultiSampleBuffers = fbcfg->nMultiSampleBuffers;
+ cfg->visualSelectGroup = fbcfg->visualSelectGroup;
+ }
+ }
+
+ return configs;
+}
diff --git a/xorg-server/hw/dmx/dmx_glxvisuals.h b/xorg-server/hw/dmx/dmx_glxvisuals.h
index 477e92391..54c3b44ca 100644
--- a/xorg-server/hw/dmx/dmx_glxvisuals.h
+++ b/xorg-server/hw/dmx/dmx_glxvisuals.h
@@ -39,21 +39,19 @@ typedef struct {
int x_visual_class;
} dmxGlxVisualPrivate;
-__GLXvisualConfig *GetGLXVisualConfigs(Display *dpy,
- int screen,
- int *nconfigs);
+__GLXvisualConfig *GetGLXVisualConfigs(Display * dpy,
+ int screen, int *nconfigs);
-__GLXFBConfig *GetGLXFBConfigs(Display *dpy,
- int glxMajorOpcode,
- int *nconfigs);
+__GLXFBConfig *GetGLXFBConfigs(Display * dpy,
+ int glxMajorOpcode, int *nconfigs);
-__GLXvisualConfig *GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig *fbconfigs,
- int nfbconfigs,
- XVisualInfo *visuals,
- int nvisuals,
- __GLXvisualConfig
- *glxConfigs,
- int nGlxConfigs,
- int *nconfigs);
+__GLXvisualConfig *GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig * fbconfigs,
+ int nfbconfigs,
+ XVisualInfo * visuals,
+ int nvisuals,
+ __GLXvisualConfig
+ * glxConfigs,
+ int nGlxConfigs,
+ int *nconfigs);
#endif
diff --git a/xorg-server/hw/dmx/dmxcb.c b/xorg-server/hw/dmx/dmxcb.c
index d0eb35117..86015f395 100644
--- a/xorg-server/hw/dmx/dmxcb.c
+++ b/xorg-server/hw/dmx/dmxcb.c
@@ -43,40 +43,42 @@
#include "dmxinput.h"
#include "dmxlog.h"
-extern int connBlockScreenStart;
+extern int connBlockScreenStart;
#ifdef PANORAMIX
#include "panoramiXsrv.h"
-extern int PanoramiXPixWidth;
-extern int PanoramiXPixHeight;
-extern int PanoramiXNumScreens;
+extern int PanoramiXPixWidth;
+extern int PanoramiXPixHeight;
+extern int PanoramiXNumScreens;
#endif
- int dmxGlobalWidth, dmxGlobalHeight;
+int dmxGlobalWidth, dmxGlobalHeight;
/** We may want the wall dimensions to be different from the bounding
* box dimensions that Xinerama computes, so save those and update them
* here.
*/
-void dmxSetWidthHeight(int width, int height)
+void
+dmxSetWidthHeight(int width, int height)
{
- dmxGlobalWidth = width;
+ dmxGlobalWidth = width;
dmxGlobalHeight = height;
}
/** Computes the global bounding box for DMX. This may be larger than
* the one computed by Xinerama because of the DMX configuration
* file. */
-void dmxComputeWidthHeight(DMXRecomputeFlag flag)
+void
+dmxComputeWidthHeight(DMXRecomputeFlag flag)
{
- int i;
+ int i;
DMXScreenInfo *dmxScreen;
- int w = 0;
- int h = 0;
-
+ int w = 0;
+ int h = 0;
+
for (i = 0; i < dmxNumScreens; i++) {
- /* Don't use root* here because this is
- * the global bounding box. */
+ /* Don't use root* here because this is
+ * the global bounding box. */
dmxScreen = &dmxScreens[i];
if (w < dmxScreen->scrnWidth + dmxScreen->rootXOrigin)
w = dmxScreen->scrnWidth + dmxScreen->rootXOrigin;
@@ -85,7 +87,8 @@ void dmxComputeWidthHeight(DMXRecomputeFlag flag)
}
if (!dmxGlobalWidth && !dmxGlobalHeight) {
dmxLog(dmxInfo, "Using %dx%d as global bounding box\n", w, h);
- } else {
+ }
+ else {
switch (flag) {
case DMX_NO_RECOMPUTE_BOUNDING_BOX:
dmxLog(dmxInfo,
@@ -101,20 +104,21 @@ void dmxComputeWidthHeight(DMXRecomputeFlag flag)
break;
}
}
-
- dmxGlobalWidth = w;
+
+ dmxGlobalWidth = w;
dmxGlobalHeight = h;
}
/** A callback routine that hooks into Xinerama and provides a
* convenient place to print summary log information during server
* startup. This routine does not modify any values. */
-void dmxConnectionBlockCallback(void)
+void
+dmxConnectionBlockCallback(void)
{
- xWindowRoot *root = (xWindowRoot *)(ConnectionInfo+connBlockScreenStart);
- int offset = connBlockScreenStart + sizeof(xWindowRoot);
- int i;
- Bool *found = NULL;
+ xWindowRoot *root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart);
+ int offset = connBlockScreenStart + sizeof(xWindowRoot);
+ int i;
+ Bool *found = NULL;
MAXSCREENSALLOC(found);
if (!found)
@@ -130,22 +134,24 @@ void dmxConnectionBlockCallback(void)
"Changing Xinerama dimensions from %d %d to %d %d\n",
PanoramiXPixWidth, PanoramiXPixHeight,
dmxGlobalWidth, dmxGlobalHeight);
- PanoramiXPixWidth = root->pixWidth = dmxGlobalWidth;
+ PanoramiXPixWidth = root->pixWidth = dmxGlobalWidth;
PanoramiXPixHeight = root->pixHeight = dmxGlobalHeight;
- } else {
- dmxGlobalWidth = PanoramiXPixWidth;
+ }
+ else {
+ dmxGlobalWidth = PanoramiXPixWidth;
dmxGlobalHeight = PanoramiXPixHeight;
}
dmxLog(dmxInfo, "%d screens configured with Xinerama (%d %d)\n",
PanoramiXNumScreens, PanoramiXPixWidth, PanoramiXPixHeight);
- FOR_NSCREENS(i) found[i] = FALSE;
- } else {
+ FOR_NSCREENS(i) found[i] = FALSE;
+ }
+ else {
#endif
- /* This never happens because we're
- * either called from a Xinerama
- * callback or during reconfiguration
- * (which only works with Xinerama on).
- * In any case, be reasonable. */
+ /* This never happens because we're
+ * either called from a Xinerama
+ * callback or during reconfiguration
+ * (which only works with Xinerama on).
+ * In any case, be reasonable. */
dmxLog(dmxInfo, "%d screens configured (%d %d)\n",
screenInfo.numScreens, root->pixWidth, root->pixHeight);
#ifdef PANORAMIX
@@ -153,46 +159,48 @@ void dmxConnectionBlockCallback(void)
#endif
for (i = 0; i < root->nDepths; i++) {
- xDepth *depth = (xDepth *)(ConnectionInfo + offset);
- int voffset = offset + sizeof(xDepth);
- xVisualType *visual = (xVisualType *)(ConnectionInfo + voffset);
- int j;
-
+ xDepth *depth = (xDepth *) (ConnectionInfo + offset);
+ int voffset = offset + sizeof(xDepth);
+ xVisualType *visual = (xVisualType *) (ConnectionInfo + voffset);
+ int j;
+
dmxLog(dmxInfo, "%d visuals at depth %d:\n",
depth->nVisuals, depth->depth);
for (j = 0; j < depth->nVisuals; j++, visual++) {
XVisualInfo vi;
-
- vi.visual = NULL;
- vi.visualid = visual->visualID;
- vi.screen = 0;
- vi.depth = depth->depth;
- vi.class = visual->class;
- vi.red_mask = visual->redMask;
- vi.green_mask = visual->greenMask;
- vi.blue_mask = visual->blueMask;
+
+ vi.visual = NULL;
+ vi.visualid = visual->visualID;
+ vi.screen = 0;
+ vi.depth = depth->depth;
+ vi.class = visual->class;
+ vi.red_mask = visual->redMask;
+ vi.green_mask = visual->greenMask;
+ vi.blue_mask = visual->blueMask;
vi.colormap_size = visual->colormapEntries;
- vi.bits_per_rgb = visual->bitsPerRGB;
+ vi.bits_per_rgb = visual->bitsPerRGB;
dmxLogVisual(NULL, &vi, 0);
#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- int k;
- FOR_NSCREENS(k) {
- DMXScreenInfo *dmxScreen = &dmxScreens[k];
-
- if (dmxScreen->beDisplay) {
- XVisualInfo *pvi =
- &dmxScreen->beVisuals[dmxScreen->beDefVisualIndex];
- if (pvi->depth == depth->depth &&
- pvi->class == visual->class)
- found[k] = TRUE;
- } else {
- /* Screen #k is detatched, so it always succeeds */
- found[k] = TRUE;
- }
- }
- }
+ if (!noPanoramiXExtension) {
+ int k;
+
+ FOR_NSCREENS(k) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[k];
+
+ if (dmxScreen->beDisplay) {
+ XVisualInfo *pvi =
+ &dmxScreen->beVisuals[dmxScreen->beDefVisualIndex];
+ if (pvi->depth == depth->depth &&
+ pvi->class == visual->class)
+ found[k] = TRUE;
+ }
+ else {
+ /* Screen #k is detatched, so it always succeeds */
+ found[k] = TRUE;
+ }
+ }
+ }
#endif
}
offset = voffset + depth->nVisuals * sizeof(xVisualType);
@@ -203,18 +211,19 @@ void dmxConnectionBlockCallback(void)
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- Bool fatal = FALSE;
- FOR_NSCREENS(i) {
- fatal |= !found[i];
- if (!found[i]) {
- dmxLog(dmxError,
- "The default visual for screen #%d does not match "
- "any of the\n", i);
- dmxLog(dmxError,
- "consolidated visuals from Xinerama (listed above)\n");
- }
- }
- if (fatal)
+ Bool fatal = FALSE;
+
+ FOR_NSCREENS(i) {
+ fatal |= !found[i];
+ if (!found[i]) {
+ dmxLog(dmxError,
+ "The default visual for screen #%d does not match "
+ "any of the\n", i);
+ dmxLog(dmxError,
+ "consolidated visuals from Xinerama (listed above)\n");
+ }
+ }
+ if (fatal)
dmxLog(dmxFatal,
"dmxConnectionBlockCallback: invalid screen(s) found");
}
diff --git a/xorg-server/hw/dmx/dmxcmap.c b/xorg-server/hw/dmx/dmxcmap.c
index 1cdc481f0..450627b40 100644
--- a/xorg-server/hw/dmx/dmxcmap.c
+++ b/xorg-server/hw/dmx/dmxcmap.c
@@ -1,212 +1,222 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * Colormap support. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxlog.h"
-#include "dmxsync.h"
-#include "dmxcmap.h"
-#include "dmxvisual.h"
-
-#include "micmap.h"
-
-static Bool dmxAllocateColormapPrivates(ColormapPtr pColormap)
-{
- dmxColormapPrivPtr pCmapPriv;
-
- pCmapPriv = (dmxColormapPrivPtr)malloc(sizeof(*pCmapPriv));
- if (!pCmapPriv)
- return FALSE;
- pCmapPriv->cmap = (Colormap)0;
-
- DMX_SET_COLORMAP_PRIV(pColormap, pCmapPriv);
-
- return TRUE;
-}
-
-/** Create \a pColormap on the back-end server. */
-Bool dmxBECreateColormap(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
- VisualPtr pVisual = pColormap->pVisual;
- Visual *visual = dmxLookupVisual(pScreen, pVisual);
-
- if (visual) {
- pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
- dmxScreen->scrnWin,
- visual,
- (pVisual->class & DynamicClass ?
- AllocAll : AllocNone));
- return pCmapPriv->cmap != 0;
- }
- else {
- dmxLog(dmxWarning, "dmxBECreateColormap: No visual found\n");
- return 0;
- }
-}
-
-/** Create colormap on back-end server associated with \a pColormap's
- * screen. */
-Bool dmxCreateColormap(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
-
- if (!dmxAllocateColormapPrivates(pColormap))
- return FALSE;
-
- if (dmxScreen->beDisplay) {
- if (!dmxBECreateColormap(pColormap))
- return FALSE;
- }
-
- DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
- if (pScreen->CreateColormap)
- ret = pScreen->CreateColormap(pColormap);
- DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
-
- return ret;
-}
-
-/** Destroy \a pColormap on the back-end server. */
-Bool dmxBEFreeColormap(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
-
- if (pCmapPriv->cmap) {
- XFreeColormap(dmxScreen->beDisplay, pCmapPriv->cmap);
- pCmapPriv->cmap = (Colormap)0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/** Destroy colormap on back-end server associated with \a pColormap's
- * screen. */
-void dmxDestroyColormap(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
-
- if (dmxScreen->beDisplay)
- dmxBEFreeColormap(pColormap);
- free(pCmapPriv);
- DMX_SET_COLORMAP_PRIV(pColormap, NULL);
-
- DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
- if (pScreen->DestroyColormap)
- pScreen->DestroyColormap(pColormap);
- DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
-}
-
-/** Install colormap on back-end server associated with \a pColormap's
- * screen. */
-void dmxInstallColormap(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
-
- DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
- if (pScreen->InstallColormap)
- pScreen->InstallColormap(pColormap);
- DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
-
- if (dmxScreen->beDisplay) {
- XInstallColormap(dmxScreen->beDisplay, pCmapPriv->cmap);
- dmxSync(dmxScreen, FALSE);
- }
-}
-
-/** Store colors in \a pColormap on back-end server associated with \a
- * pColormap's screen. */
-void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem *pdef)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
-
- if (dmxScreen->beDisplay && (pColormap->pVisual->class & DynamicClass)) {
- XColor *color = malloc(sizeof(*color) * ndef);
- int i;
-
- if (color) {
- for (i = 0; i < ndef; i++) {
- color[i].pixel = pdef[i].pixel;
- color[i].red = pdef[i].red;
- color[i].blue = pdef[i].blue;
- color[i].green = pdef[i].green;
- color[i].flags = pdef[i].flags;
- color[i].pad = pdef[i].pad;
- }
- XStoreColors(dmxScreen->beDisplay, pCmapPriv->cmap, color, ndef);
- free(color);
- } else { /* xalloc failed, so fallback */
- XColor c;
- for (i = 0; i < ndef; i++) {
- c.pixel = pdef[i].pixel;
- c.red = pdef[i].red;
- c.blue = pdef[i].blue;
- c.green = pdef[i].green;
- c.flags = pdef[i].flags;
- c.pad = pdef[i].pad;
- XStoreColor(dmxScreen->beDisplay, pCmapPriv->cmap, &c);
- }
- }
- dmxSync(dmxScreen, FALSE);
- }
-
- DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
- if (pScreen->StoreColors)
- pScreen->StoreColors(pColormap, ndef, pdef);
- DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
-}
-
-/** Create the DMX server's default colormap. */
-Bool dmxCreateDefColormap(ScreenPtr pScreen)
-{
- return miCreateDefColormap(pScreen);
-}
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Colormap support. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxlog.h"
+#include "dmxsync.h"
+#include "dmxcmap.h"
+#include "dmxvisual.h"
+
+#include "micmap.h"
+
+static Bool
+dmxAllocateColormapPrivates(ColormapPtr pColormap)
+{
+ dmxColormapPrivPtr pCmapPriv;
+
+ pCmapPriv = (dmxColormapPrivPtr) malloc(sizeof(*pCmapPriv));
+ if (!pCmapPriv)
+ return FALSE;
+ pCmapPriv->cmap = (Colormap) 0;
+
+ DMX_SET_COLORMAP_PRIV(pColormap, pCmapPriv);
+
+ return TRUE;
+}
+
+/** Create \a pColormap on the back-end server. */
+Bool
+dmxBECreateColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+ VisualPtr pVisual = pColormap->pVisual;
+ Visual *visual = dmxLookupVisual(pScreen, pVisual);
+
+ if (visual) {
+ pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ visual,
+ (pVisual->class & DynamicClass ?
+ AllocAll : AllocNone));
+ return pCmapPriv->cmap != 0;
+ }
+ else {
+ dmxLog(dmxWarning, "dmxBECreateColormap: No visual found\n");
+ return 0;
+ }
+}
+
+/** Create colormap on back-end server associated with \a pColormap's
+ * screen. */
+Bool
+dmxCreateColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+
+ if (!dmxAllocateColormapPrivates(pColormap))
+ return FALSE;
+
+ if (dmxScreen->beDisplay) {
+ if (!dmxBECreateColormap(pColormap))
+ return FALSE;
+ }
+
+ DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
+ if (pScreen->CreateColormap)
+ ret = pScreen->CreateColormap(pColormap);
+ DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
+
+ return ret;
+}
+
+/** Destroy \a pColormap on the back-end server. */
+Bool
+dmxBEFreeColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ if (pCmapPriv->cmap) {
+ XFreeColormap(dmxScreen->beDisplay, pCmapPriv->cmap);
+ pCmapPriv->cmap = (Colormap) 0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy colormap on back-end server associated with \a pColormap's
+ * screen. */
+void
+dmxDestroyColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ if (dmxScreen->beDisplay)
+ dmxBEFreeColormap(pColormap);
+ free(pCmapPriv);
+ DMX_SET_COLORMAP_PRIV(pColormap, NULL);
+
+ DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
+ if (pScreen->DestroyColormap)
+ pScreen->DestroyColormap(pColormap);
+ DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
+}
+
+/** Install colormap on back-end server associated with \a pColormap's
+ * screen. */
+void
+dmxInstallColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
+ if (pScreen->InstallColormap)
+ pScreen->InstallColormap(pColormap);
+ DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
+
+ if (dmxScreen->beDisplay) {
+ XInstallColormap(dmxScreen->beDisplay, pCmapPriv->cmap);
+ dmxSync(dmxScreen, FALSE);
+ }
+}
+
+/** Store colors in \a pColormap on back-end server associated with \a
+ * pColormap's screen. */
+void
+dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem * pdef)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ if (dmxScreen->beDisplay && (pColormap->pVisual->class & DynamicClass)) {
+ XColor *color = malloc(sizeof(*color) * ndef);
+ int i;
+
+ if (color) {
+ for (i = 0; i < ndef; i++) {
+ color[i].pixel = pdef[i].pixel;
+ color[i].red = pdef[i].red;
+ color[i].blue = pdef[i].blue;
+ color[i].green = pdef[i].green;
+ color[i].flags = pdef[i].flags;
+ color[i].pad = pdef[i].pad;
+ }
+ XStoreColors(dmxScreen->beDisplay, pCmapPriv->cmap, color, ndef);
+ free(color);
+ }
+ else { /* xalloc failed, so fallback */
+ XColor c;
+
+ for (i = 0; i < ndef; i++) {
+ c.pixel = pdef[i].pixel;
+ c.red = pdef[i].red;
+ c.blue = pdef[i].blue;
+ c.green = pdef[i].green;
+ c.flags = pdef[i].flags;
+ c.pad = pdef[i].pad;
+ XStoreColor(dmxScreen->beDisplay, pCmapPriv->cmap, &c);
+ }
+ }
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
+ if (pScreen->StoreColors)
+ pScreen->StoreColors(pColormap, ndef, pdef);
+ DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
+}
+
+/** Create the DMX server's default colormap. */
+Bool
+dmxCreateDefColormap(ScreenPtr pScreen)
+{
+ return miCreateDefColormap(pScreen);
+}
diff --git a/xorg-server/hw/dmx/dmxcursor.c b/xorg-server/hw/dmx/dmxcursor.c
index 19f5a4139..1a77c7d78 100644
--- a/xorg-server/hw/dmx/dmxcursor.c
+++ b/xorg-server/hw/dmx/dmxcursor.c
@@ -1,989 +1,1023 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * David H. Dawes <dawes@xfree86.org>
- * Kevin E. Martin <kem@redhat.com>
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- * This file contains code than supports cursor movement, including the
- * code that initializes and reinitializes the screen positions and
- * computes screen overlap.
- *
- * "This code is based very closely on the XFree86 equivalent
- * (xfree86/common/xf86Cursor.c)." --David Dawes.
- *
- * "This code was then extensively re-written, as explained here."
- * --Rik Faith
- *
- * The code in xf86Cursor.c used edge lists to implement the
- * CursorOffScreen function. The edge list computation was complex
- * (especially in the face of arbitrarily overlapping screens) compared
- * with the speed savings in the CursorOffScreen function. The new
- * implementation has erred on the side of correctness, readability, and
- * maintainability over efficiency. For the common (non-edge) case, the
- * dmxCursorOffScreen function does avoid a loop over all the screens.
- * When the cursor has left the screen, all the screens are searched,
- * and the first screen (in dmxScreens order) containing the cursor will
- * be returned. If run-time profiling shows that this routing is a
- * performance bottle-neck, then an edge list may have to be
- * reimplemented. An edge list algorithm is O(edges) whereas the new
- * algorithm is O(dmxNumScreens). Since edges is usually 1-3 and
- * dmxNumScreens may be 30-60 for large backend walls, this trade off
- * may be compelling.
- *
- * The xf86InitOrigins routine uses bit masks during the computation and
- * is therefore limited to the length of a word (e.g., 32 or 64 bits)
- * screens. Because Xdmx is expected to be used with a large number of
- * backend displays, this limitation was removed. The new
- * implementation has erred on the side of readability over efficiency,
- * using the dmxSL* routines to manage a screen list instead of a
- * bitmap, and a function call to decrease the length of the main
- * routine. Both algorithms are of the same order, and both are called
- * only at server generation time, so trading clarity and long-term
- * maintainability for efficiency does not seem justified in this case.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_CURSOR_DEBUG 0
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxcursor.h"
-#include "dmxlog.h"
-#include "dmxprop.h"
-#include "dmxinput.h"
-
-#include "mipointer.h"
-#include "windowstr.h"
-#include "globals.h"
-#include "cursorstr.h"
-#include "dixevents.h" /* For GetSpriteCursor() */
-#include "inputstr.h" /* for inputInfo.pointer */
-
-#if DMX_CURSOR_DEBUG
-#define DMXDBG0(f) dmxLog(dmxDebug,f)
-#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
-#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
-#else
-#define DMXDBG0(f)
-#define DMXDBG1(f,a)
-#define DMXDBG2(f,a,b)
-#define DMXDBG3(f,a,b,c)
-#define DMXDBG4(f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h)
-#endif
-
-static int dmxCursorDoMultiCursors = 1;
-
-/** Turn off support for displaying multiple cursors on overlapped
- back-end displays. See #dmxCursorDoMultiCursors. */
-void dmxCursorNoMulti(void)
-{
- dmxCursorDoMultiCursors = 0;
-}
-
-static Bool dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
-{
- DMXScreenInfo *dmxScreen;
- int i;
- int localX = *x;
- int localY = *y;
- int globalX;
- int globalY;
-
- if (screenInfo.numScreens == 1)
- return FALSE;
-
- /* On current screen? */
- dmxScreen = &dmxScreens[(*ppScreen)->myNum];
- if (localX >= 0
- && localX < dmxScreen->rootWidth
- && localY >= 0
- && localY < dmxScreen->rootHeight)
- return FALSE;
-
- /* Convert to global coordinate space */
- globalX = dmxScreen->rootXOrigin + localX;
- globalY = dmxScreen->rootYOrigin + localY;
-
- /* Is cursor on the current screen?
- * This efficiently exits this routine
- * for the most common case. */
- if (ppScreen && *ppScreen) {
- dmxScreen = &dmxScreens[(*ppScreen)->myNum];
- if (globalX >= dmxScreen->rootXOrigin
- && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
- && globalY >= dmxScreen->rootYOrigin
- && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight)
- return FALSE;
- }
-
- /* Find first screen cursor is on */
- for (i = 0; i < dmxNumScreens; i++) {
- dmxScreen = &dmxScreens[i];
- if (globalX >= dmxScreen->rootXOrigin
- && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
- && globalY >= dmxScreen->rootYOrigin
- && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) {
- if (dmxScreen->index == (*ppScreen)->myNum)
- return FALSE;
- *ppScreen = screenInfo.screens[dmxScreen->index];
- *x = globalX - dmxScreen->rootXOrigin;
- *y = globalY - dmxScreen->rootYOrigin;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static void dmxCrossScreen(ScreenPtr pScreen, Bool entering)
-{
-}
-
-static void dmxWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
- DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
-#if 11 /*BP*/
- /* This call is depracated. Replace with???? */
- miPointerWarpCursor(pDev, pScreen, x, y);
-#else
- pScreen->SetCursorPosition(pDev, pScreen, x, y, FALSE);
-#endif
-}
-
-miPointerScreenFuncRec dmxPointerCursorFuncs =
-{
- dmxCursorOffScreen,
- dmxCrossScreen,
- dmxWarpCursor,
- NULL,
- NULL,
-};
-
-
-/** Create a list of screens that we'll manipulate. */
-static int *dmxSLCreate(void)
-{
- int *list = malloc(dmxNumScreens * sizeof(*list));
- int i;
-
- for (i = 0; i < dmxNumScreens; i++)
- list[i] = 1;
- return list;
-}
-
-/** Free list. */
-static void dmxSLFree(int *list)
-{
- free(list);
-}
-
-/** Find next uninitialized entry in list. */
-static int dmxSLFindNext(int *list)
-{
- int i;
- for (i = 0; i < dmxNumScreens; i++)
- if (list[i])
- return i;
- return -1;
-}
-
-/** Make one pass over all the screens and return the number updated. */
-static int dmxTryComputeScreenOrigins(int *screensLeft)
-{
- ScreenPtr pScreen, refScreen;
- DMXScreenInfo *screen;
- int i, ref;
- int changed = 0;
-
- for (i = 0; i < dmxNumScreens; i++) {
- if (!screensLeft[i])
- continue;
- screen = &dmxScreens[i];
- pScreen = screenInfo.screens[i];
- switch (screen->where) {
- case PosAbsolute:
- pScreen->x = screen->whereX;
- pScreen->y = screen->whereY;
- ++changed, screensLeft[i] = 0;
- break;
- case PosRelative:
- ref = screen->whereRefScreen;
- if (screensLeft[ref])
- break;
- refScreen = screenInfo.screens[ref];
- pScreen->x = refScreen->x + screen->whereX;
- pScreen->y = refScreen->y + screen->whereY;
- ++changed, screensLeft[i] = 0;
- break;
- case PosRightOf:
- ref = screen->whereRefScreen;
- if (screensLeft[ref])
- break;
- refScreen = screenInfo.screens[ref];
- pScreen->x = refScreen->x + refScreen->width;
- pScreen->y = refScreen->y;
- ++changed, screensLeft[i] = 0;
- break;
- case PosLeftOf:
- ref = screen->whereRefScreen;
- if (screensLeft[ref])
- break;
- refScreen = screenInfo.screens[ref];
- pScreen->x = refScreen->x - pScreen->width;
- pScreen->y = refScreen->y;
- ++changed, screensLeft[i] = 0;
- break;
- case PosBelow:
- ref = screen->whereRefScreen;
- if (screensLeft[ref])
- break;
- refScreen = screenInfo.screens[ref];
- pScreen->x = refScreen->x;
- pScreen->y = refScreen->y + refScreen->height;
- ++changed, screensLeft[i] = 0;
- break;
- case PosAbove:
- ref = screen->whereRefScreen;
- if (screensLeft[ref])
- break;
- refScreen = screenInfo.screens[ref];
- pScreen->x = refScreen->x;
- pScreen->y = refScreen->y - pScreen->height;
- ++changed, screensLeft[i] = 0;
- break;
- case PosNone:
- dmxLog(dmxFatal, "No position information for screen %d\n", i);
- }
- }
- return changed;
-}
-
-static void dmxComputeScreenOrigins(void)
-{
- ScreenPtr pScreen;
- int *screensLeft;
- int i, ref;
- int minX, minY;
-
- /* Compute origins based on
- * configuration information. */
- screensLeft = dmxSLCreate();
- while ((i = dmxSLFindNext(screensLeft)) >= 0) {
- while (dmxTryComputeScreenOrigins(screensLeft));
- if ((i = dmxSLFindNext(screensLeft)) >= 0) {
- /* All of the remaining screens are referencing each other.
- * Assign a value to one of them and go through again. This
- * guarantees that we will eventually terminate.
- */
- ref = dmxScreens[i].whereRefScreen;
- pScreen = screenInfo.screens[ref];
- pScreen->x = pScreen->y = 0;
- screensLeft[ref] = 0;
- }
- }
- dmxSLFree(screensLeft);
-
-
- /* Justify the topmost and leftmost to
- * (0,0). */
- minX = screenInfo.screens[0]->x;
- minY = screenInfo.screens[0]->y;
- for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */
- if (screenInfo.screens[i]->x < minX)
- minX = screenInfo.screens[i]->x;
- if (screenInfo.screens[i]->y < minY)
- minY = screenInfo.screens[i]->y;
- }
- if (minX || minY) {
- for (i = 0; i < dmxNumScreens; i++) {
- screenInfo.screens[i]->x -= minX;
- screenInfo.screens[i]->y -= minY;
- }
- }
-}
-
-/** Recompute origin information in the #dmxScreens list. This is
- * called from #dmxInitOrigins. */
-void dmxReInitOrigins(void)
-{
- int i;
-
- if (dmxNumScreens > MAXSCREENS)
- dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
- dmxNumScreens, MAXSCREENS);
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- dmxLogOutput(dmxScreen,
- "s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d"
- " (be=%dx%d depth=%d bpp=%d)\n",
- dmxScreen->scrnWidth, dmxScreen->scrnHeight,
- dmxScreen->scrnX, dmxScreen->scrnY,
-
- dmxScreen->rootWidth, dmxScreen->rootHeight,
- dmxScreen->rootX, dmxScreen->rootY,
-
- dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
- dmxScreen->beWidth, dmxScreen->beHeight,
- dmxScreen->beDepth, dmxScreen->beBPP);
- }
-}
-
-/** Initialize screen origins (and relative position). This is called
- * for each server generation. For dynamic reconfiguration, use
- * #dmxReInitOrigins() instead. */
-void dmxInitOrigins(void)
-{
- int i;
-
- if (dmxNumScreens > MAXSCREENS)
- dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
- dmxNumScreens, MAXSCREENS);
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- dmxLogOutput(dmxScreen,
- "(request) s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d (%d)"
- " (be=%dx%d depth=%d bpp=%d)\n",
- dmxScreen->scrnWidth, dmxScreen->scrnHeight,
- dmxScreen->scrnX, dmxScreen->scrnY,
-
- dmxScreen->rootWidth, dmxScreen->rootHeight,
- dmxScreen->rootX, dmxScreen->rootY,
-
- dmxScreen->whereX, dmxScreen->whereY,
- dmxScreen->where,
-
- dmxScreen->beWidth, dmxScreen->beHeight,
- dmxScreen->beDepth, dmxScreen->beBPP);
- }
-
- dmxComputeScreenOrigins();
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- dmxScreen->rootXOrigin = screenInfo.screens[i]->x;
- dmxScreen->rootYOrigin = screenInfo.screens[i]->y;
- }
-
- dmxReInitOrigins();
-}
-
-/** Returns non-zero if the global \a x, \a y coordinate is on the
- * screen window of the \a dmxScreen. */
-int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen)
-{
-#if DMX_CURSOR_DEBUG > 1
- dmxLog(dmxDebug,
- "dmxOnScreen %d %d,%d (r=%dx%d%+d%+d@%d,%d s=%dx%d%+d%+d)\n",
- dmxScreen->index, x, y,
- dmxScreen->rootWidth, dmxScreen->rootHeight,
- dmxScreen->rootX, dmxScreen->rootY,
- dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
- dmxScreen->scrnWidth, dmxScreen->scrnHeight,
- dmxScreen->scrnX, dmxScreen->scrnY);
-#endif
- if (x >= dmxScreen->rootXOrigin
- && x < dmxScreen->rootXOrigin + dmxScreen->rootWidth
- && y >= dmxScreen->rootYOrigin
- && y < dmxScreen->rootYOrigin + dmxScreen->rootHeight) return 1;
- return 0;
-}
-
-/** Returns non-zero if \a a overlaps \a b. */
-static int dmxDoesOverlap(DMXScreenInfo *a, DMXScreenInfo *b)
-{
- if (dmxOnScreen(a->rootXOrigin,
- a->rootYOrigin, b))
- return 1;
-
- if (dmxOnScreen(a->rootXOrigin,
- a->rootYOrigin + a->scrnWidth, b))
- return 1;
-
- if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
- a->rootYOrigin, b))
- return 1;
-
- if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
- a->rootYOrigin + a->scrnWidth, b))
- return 1;
-
- if (dmxOnScreen(b->rootXOrigin,
- b->rootYOrigin, a))
- return 1;
-
- if (dmxOnScreen(b->rootXOrigin,
- b->rootYOrigin + b->scrnWidth, a))
- return 1;
-
- if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
- b->rootYOrigin, a))
- return 1;
-
- if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
- b->rootYOrigin + b->scrnWidth, a))
- return 1;
-
- return 0;
-}
-
-/** Used with \a dmxInterateOverlap to print out a list of screens which
- * overlap each other. */
-static void *dmxPrintOverlap(DMXScreenInfo *dmxScreen, void *closure)
-{
- DMXScreenInfo *a = closure;
- if (dmxScreen != a) {
- if (dmxScreen->cursorNotShared)
- dmxLogOutputCont(a, " [%d/%s]", dmxScreen->index, dmxScreen->name);
- else
- dmxLogOutputCont(a, " %d/%s", dmxScreen->index, dmxScreen->name);
- }
- return NULL;
-}
-
-/** Iterate over the screens which overlap with the \a start screen,
- * calling \a f with the \a closure for each argument. Often used with
- * #dmxPrintOverlap. */
-static void *dmxIterateOverlap(DMXScreenInfo *start,
- void *(*f)(DMXScreenInfo *dmxScreen, void *),
- void *closure)
-{
- DMXScreenInfo *pt;
-
- if (!start->over) return f(start, closure);
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- void *retval;
- if ((retval = f(pt, closure))) return retval;
- if (pt == start) break;
- }
- return NULL;
-}
-
-/** Used with #dmxPropertyIterate to determine if screen \a a is the
- * same as the screen \a closure. */
-static void *dmxTestSameDisplay(DMXScreenInfo *a, void *closure)
-{
- DMXScreenInfo *b = closure;
-
- if (a == b)
- return a;
- return NULL;
-}
-
-/** Detects overlapping dmxScreens and creates circular lists. This
- * uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is < 100 and
- * the computation only needs to be performed for every server
- * generation or dynamic reconfiguration . */
-void dmxInitOverlap(void)
-{
- int i, j;
- DMXScreenInfo *a, *b, *pt;
-
- for (i = 0; i < dmxNumScreens; i++)
- dmxScreens[i].over = NULL;
-
- for (i = 0; i < dmxNumScreens; i++) {
- a = &dmxScreens[i];
-
- for (j = i+1; j < dmxNumScreens; j++) {
- b = &dmxScreens[j];
- if (b->over)
- continue;
-
- if (dmxDoesOverlap(a, b)) {
- DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n",
- a->index, b->index, a, a->over, b, b->over);
- b->over = (a->over ? a->over : a);
- a->over = b;
- }
- }
- }
-
- for (i = 0; i < dmxNumScreens; i++) {
- a = &dmxScreens[i];
-
- if (!a->over)
- continue;
-
- /* Flag all pairs that are on same display */
- for (pt = a->over; pt != a; pt = pt->over) {
- if (dmxPropertyIterate(a, dmxTestSameDisplay, pt)) {
- /* The ->over sets contain the transitive set of screens
- * that overlap. For screens that are on the same
- * backend display, we only want to exclude pairs of
- * screens that mutually overlap on the backend display,
- * so we call dmxDoesOverlap, which is stricter than the
- * ->over set. */
- if (!dmxDoesOverlap(a, pt))
- continue;
- a->cursorNotShared = 1;
- pt->cursorNotShared = 1;
- dmxLog(dmxInfo,
- "Screen %d and %d overlap on %s\n",
- a->index, pt->index, a->name);
- }
- }
- }
-
- for (i = 0; i < dmxNumScreens; i++) {
- a = &dmxScreens[i];
-
- if (a->over) {
- dmxLogOutput(a, "Overlaps");
- dmxIterateOverlap(a, dmxPrintOverlap, a);
- dmxLogOutputCont(a, "\n");
- }
- }
-}
-
-/** Create \a pCursor on the back-end associated with \a pScreen. */
-void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
- CursorBitsPtr pBits = pCursor->bits;
- Pixmap src, msk;
- XColor fg, bg;
- XImage *img;
- XlibGC gc = NULL;
- XGCValues v;
- unsigned long m;
- int i;
-
- if (!pCursorPriv)
- return;
-
- m = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCClipMask;
- v.function = GXcopy;
- v.plane_mask = AllPlanes;
- v.foreground = 1L;
- v.background = 0L;
- v.clip_mask = None;
-
- for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- if (dmxScreen->bePixmapFormats[i].depth == 1) {
- /* Create GC in the back-end servers */
- gc = XCreateGC(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i],
- m, &v);
- break;
- }
- }
- if (!gc)
- dmxLog(dmxFatal, "dmxRealizeCursor: gc not initialized\n");
-
- src = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
- pBits->width, pBits->height, 1);
- msk = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
- pBits->width, pBits->height, 1);
-
- img = XCreateImage(dmxScreen->beDisplay,
- dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
- 1, XYBitmap, 0, (char *)pBits->source,
- pBits->width, pBits->height,
- BitmapPad(dmxScreen->beDisplay), 0);
-
- XPutImage(dmxScreen->beDisplay, src, gc, img, 0, 0, 0, 0,
- pBits->width, pBits->height);
-
- XFree(img);
-
- img = XCreateImage(dmxScreen->beDisplay,
- dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
- 1, XYBitmap, 0, (char *)pBits->mask,
- pBits->width, pBits->height,
- BitmapPad(dmxScreen->beDisplay), 0);
-
- XPutImage(dmxScreen->beDisplay, msk, gc, img, 0, 0, 0, 0,
- pBits->width, pBits->height);
-
- XFree(img);
-
- fg.red = pCursor->foreRed;
- fg.green = pCursor->foreGreen;
- fg.blue = pCursor->foreBlue;
-
- bg.red = pCursor->backRed;
- bg.green = pCursor->backGreen;
- bg.blue = pCursor->backBlue;
-
- pCursorPriv->cursor = XCreatePixmapCursor(dmxScreen->beDisplay,
- src, msk,
- &fg, &bg,
- pBits->xhot, pBits->yhot);
-
- XFreePixmap(dmxScreen->beDisplay, src);
- XFreePixmap(dmxScreen->beDisplay, msk);
- XFreeGC(dmxScreen->beDisplay, gc);
-
- dmxSync(dmxScreen, FALSE);
-}
-
-static Bool _dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxCursorPrivPtr pCursorPriv;
-
- DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
-
- DMX_SET_CURSOR_PRIV(pCursor, pScreen, malloc(sizeof(*pCursorPriv)));
- if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen))
- return FALSE;
-
- pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
- pCursorPriv->cursor = (Cursor)0;
-
- if (!dmxScreen->beDisplay)
- return TRUE;
-
- dmxBECreateCursor(pScreen, pCursor);
- return TRUE;
-}
-
-/** Free \a pCursor on the back-end associated with \a pScreen. */
-Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
-
- if (pCursorPriv) {
- XFreeCursor(dmxScreen->beDisplay, pCursorPriv->cursor);
- pCursorPriv->cursor = (Cursor)0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-static Bool _dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
- DMXDBG2("_dmxUnrealizeCursor(%d,%p)\n",
- pScreen->myNum, pCursor);
-
- if (dmxScreen->beDisplay) {
- if (dmxBEFreeCursor(pScreen, pCursor))
- free(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
- }
- DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL);
-
- return TRUE;
-}
-
-static void _dmxMoveCursor(ScreenPtr pScreen, int x, int y)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- int newX = x + dmxScreen->rootX;
- int newY = y + dmxScreen->rootY;
-
- if (newX < 0) newX = 0;
- if (newY < 0) newY = 0;
-
- DMXDBG5("_dmxMoveCursor(%d,%d,%d) -> %d,%d\n",
- pScreen->myNum, x, y, newX, newY);
- if (dmxScreen->beDisplay) {
- XWarpPointer(dmxScreen->beDisplay, None, dmxScreen->scrnWin,
- 0, 0, 0, 0, newX, newY);
- dmxSync(dmxScreen, TRUE);
- }
-}
-
-static void _dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
- DMXDBG4("_dmxSetCursor(%d,%p,%d,%d)\n", pScreen->myNum, pCursor, x, y);
-
- if (pCursor) {
- dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
- if (pCursorPriv && dmxScreen->curCursor != pCursorPriv->cursor) {
- if (dmxScreen->beDisplay)
- XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
- pCursorPriv->cursor);
- dmxScreen->cursor = pCursor;
- dmxScreen->curCursor = pCursorPriv->cursor;
- dmxScreen->cursorVisible = 1;
- }
- _dmxMoveCursor(pScreen, x, y);
- } else {
- if (dmxScreen->beDisplay)
- XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
- dmxScreen->noCursor);
- dmxScreen->cursor = NULL;
- dmxScreen->curCursor = (Cursor)0;
- dmxScreen->cursorVisible = 0;
- }
- if (dmxScreen->beDisplay) dmxSync(dmxScreen, TRUE);
-}
-
-static Bool dmxRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
- DMXScreenInfo *pt;
-
- if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
- return _dmxRealizeCursor(pScreen, pCursor);
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->cursorNotShared)
- continue;
- _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor);
- if (pt == start)
- break;
- }
- return TRUE;
-}
-
-static Bool dmxUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
- DMXScreenInfo *pt;
-
- if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
- return _dmxUnrealizeCursor(pScreen, pCursor);
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->cursorNotShared)
- continue;
- _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor);
- if (pt == start)
- break;
- }
- return TRUE;
-}
-
-static CursorPtr dmxFindCursor(DMXScreenInfo *start)
-{
- DMXScreenInfo *pt;
-
- if (!start || !start->over)
- return GetSpriteCursor(inputInfo.pointer);
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->cursor)
- return pt->cursor;
- if (pt == start)
- break;
- }
- return GetSpriteCursor(inputInfo.pointer);
-}
-
-/** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This
- * function is usually called via #dmxPointerSpriteFuncs, except during
- * reconfiguration when the cursor is repositioned to force an update on
- * newley overlapping screens and on screens that no longer overlap.
- *
- * The coords (x,y) are in global coord space. We'll loop over the
- * back-end screens and see if they contain the global coord. If so, call
- * _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen.
- */
-void dmxMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
- DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
- DMXScreenInfo *pt;
-
- DMXDBG3("dmxMoveCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
-
- if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
- _dmxMoveCursor(pScreen, x, y);
- return;
- }
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->cursorNotShared)
- continue;
- if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
- if (/* pt != start && */ !pt->cursorVisible) {
- if (!pt->cursor) {
- /* This only happens during
- * reconfiguration when a new overlap
- * occurs. */
- CursorPtr pCursor;
-
- if ((pCursor = dmxFindCursor(start)))
- _dmxRealizeCursor(screenInfo.screens[pt->index],
- pt->cursor = pCursor);
-
- }
- _dmxSetCursor(screenInfo.screens[pt->index],
- pt->cursor,
- x + start->rootXOrigin - pt->rootXOrigin,
- y + start->rootYOrigin - pt->rootYOrigin);
- }
- _dmxMoveCursor(screenInfo.screens[pt->index],
- x + start->rootXOrigin - pt->rootXOrigin,
- y + start->rootYOrigin - pt->rootYOrigin);
- } else if (/* pt != start && */ pt->cursorVisible) {
- _dmxSetCursor(screenInfo.screens[pt->index],
- NULL,
- x + start->rootXOrigin - pt->rootXOrigin,
- y + start->rootYOrigin - pt->rootYOrigin);
- }
- if (pt == start)
- break;
- }
-}
-
-static void dmxSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
- DMXScreenInfo *pt;
- int GX, GY, gx, gy;
-
- DMXDBG5("dmxSetCursor(%d %p, %p,%d,%d)\n",
- pScreen->myNum, start, pCursor, x, y);
-
- /* We do this check here because of two cases:
- *
- * 1) if a client calls XWarpPointer()
- * and Xinerama is not running, we can
- * have mi's notion of the pointer
- * position out of phase with DMX's
- * notion.
- *
- * 2) if a down button is held while the
- * cursor moves outside the root window,
- * mi's notion of the pointer position
- * is out of phase with DMX's notion and
- * the cursor can remain visible when it
- * shouldn't be. */
-
- dmxGetGlobalPosition(&GX, &GY);
- gx = start->rootXOrigin + x;
- gy = start->rootYOrigin + y;
- if (x && y && (GX != gx || GY != gy))
- dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK);
-
- if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
- _dmxSetCursor(pScreen, pCursor, x, y);
- return;
- }
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->cursorNotShared)
- continue;
- if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
- _dmxSetCursor(screenInfo.screens[pt->index], pCursor,
- x + start->rootXOrigin - pt->rootXOrigin,
- y + start->rootYOrigin - pt->rootYOrigin);
- } else {
- _dmxSetCursor(screenInfo.screens[pt->index], NULL,
- x + start->rootXOrigin - pt->rootXOrigin,
- y + start->rootYOrigin - pt->rootYOrigin);
- }
- if (pt == start)
- break;
- }
-}
-
-
-/** This routine is used by the backend input routines to hide the
- * cursor on a screen that is being used for relative input. \see
- * dmxbackend.c */
-void dmxHideCursor(DMXScreenInfo *dmxScreen)
-{
- int x, y;
- ScreenPtr pScreen = screenInfo.screens[dmxScreen->index];
-
- dmxGetGlobalPosition(&x, &y);
- _dmxSetCursor(pScreen, NULL, x, y);
-}
-
-/** This routine is called during reconfiguration to make sure the
- * cursor is visible. */
-void dmxCheckCursor(void)
-{
- int i;
- int x, y;
- ScreenPtr pScreen;
- DMXScreenInfo *firstScreen;
-
- dmxGetGlobalPosition(&x, &y);
- firstScreen = dmxFindFirstScreen(x, y);
-
- DMXDBG2("dmxCheckCursor %d %d\n", x, y);
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- pScreen = screenInfo.screens[dmxScreen->index];
-
- if (!dmxOnScreen(x, y, dmxScreen)) {
- if (firstScreen && i == miPointerGetScreen(inputInfo.pointer)->myNum)
- miPointerSetScreen(inputInfo.pointer, firstScreen->index, x, y);
- _dmxSetCursor(pScreen, NULL,
- x - dmxScreen->rootXOrigin,
- y - dmxScreen->rootYOrigin);
- } else {
- if (!dmxScreen->cursor) {
- CursorPtr pCursor;
-
- if ((pCursor = dmxFindCursor(dmxScreen))) {
- _dmxRealizeCursor(pScreen, dmxScreen->cursor = pCursor);
- }
- }
- _dmxSetCursor(pScreen, dmxScreen->cursor,
- x - dmxScreen->rootXOrigin,
- y - dmxScreen->rootYOrigin);
- }
- }
- DMXDBG2(" leave dmxCheckCursor %d %d\n", x, y);
-}
-
-static Bool dmxDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
-{
- return TRUE;
-}
-
-static void dmxDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
-{
-}
-
-miPointerSpriteFuncRec dmxPointerSpriteFuncs =
-{
- dmxRealizeCursor,
- dmxUnrealizeCursor,
- dmxSetCursor,
- dmxMoveCursor,
- dmxDeviceCursorInitialize,
- dmxDeviceCursorCleanup
-};
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file contains code than supports cursor movement, including the
+ * code that initializes and reinitializes the screen positions and
+ * computes screen overlap.
+ *
+ * "This code is based very closely on the XFree86 equivalent
+ * (xfree86/common/xf86Cursor.c)." --David Dawes.
+ *
+ * "This code was then extensively re-written, as explained here."
+ * --Rik Faith
+ *
+ * The code in xf86Cursor.c used edge lists to implement the
+ * CursorOffScreen function. The edge list computation was complex
+ * (especially in the face of arbitrarily overlapping screens) compared
+ * with the speed savings in the CursorOffScreen function. The new
+ * implementation has erred on the side of correctness, readability, and
+ * maintainability over efficiency. For the common (non-edge) case, the
+ * dmxCursorOffScreen function does avoid a loop over all the screens.
+ * When the cursor has left the screen, all the screens are searched,
+ * and the first screen (in dmxScreens order) containing the cursor will
+ * be returned. If run-time profiling shows that this routing is a
+ * performance bottle-neck, then an edge list may have to be
+ * reimplemented. An edge list algorithm is O(edges) whereas the new
+ * algorithm is O(dmxNumScreens). Since edges is usually 1-3 and
+ * dmxNumScreens may be 30-60 for large backend walls, this trade off
+ * may be compelling.
+ *
+ * The xf86InitOrigins routine uses bit masks during the computation and
+ * is therefore limited to the length of a word (e.g., 32 or 64 bits)
+ * screens. Because Xdmx is expected to be used with a large number of
+ * backend displays, this limitation was removed. The new
+ * implementation has erred on the side of readability over efficiency,
+ * using the dmxSL* routines to manage a screen list instead of a
+ * bitmap, and a function call to decrease the length of the main
+ * routine. Both algorithms are of the same order, and both are called
+ * only at server generation time, so trading clarity and long-term
+ * maintainability for efficiency does not seem justified in this case.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_CURSOR_DEBUG 0
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxcursor.h"
+#include "dmxlog.h"
+#include "dmxprop.h"
+#include "dmxinput.h"
+
+#include "mipointer.h"
+#include "windowstr.h"
+#include "globals.h"
+#include "cursorstr.h"
+#include "dixevents.h" /* For GetSpriteCursor() */
+#include "inputstr.h" /* for inputInfo.pointer */
+
+#if DMX_CURSOR_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#endif
+
+static int dmxCursorDoMultiCursors = 1;
+
+/** Turn off support for displaying multiple cursors on overlapped
+ back-end displays. See #dmxCursorDoMultiCursors. */
+void
+dmxCursorNoMulti(void)
+{
+ dmxCursorDoMultiCursors = 0;
+}
+
+static Bool
+dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ DMXScreenInfo *dmxScreen;
+ int i;
+ int localX = *x;
+ int localY = *y;
+ int globalX;
+ int globalY;
+
+ if (screenInfo.numScreens == 1)
+ return FALSE;
+
+ /* On current screen? */
+ dmxScreen = &dmxScreens[(*ppScreen)->myNum];
+ if (localX >= 0
+ && localX < dmxScreen->rootWidth
+ && localY >= 0 && localY < dmxScreen->rootHeight)
+ return FALSE;
+
+ /* Convert to global coordinate space */
+ globalX = dmxScreen->rootXOrigin + localX;
+ globalY = dmxScreen->rootYOrigin + localY;
+
+ /* Is cursor on the current screen?
+ * This efficiently exits this routine
+ * for the most common case. */
+ if (ppScreen && *ppScreen) {
+ dmxScreen = &dmxScreens[(*ppScreen)->myNum];
+ if (globalX >= dmxScreen->rootXOrigin
+ && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
+ && globalY >= dmxScreen->rootYOrigin
+ && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight)
+ return FALSE;
+ }
+
+ /* Find first screen cursor is on */
+ for (i = 0; i < dmxNumScreens; i++) {
+ dmxScreen = &dmxScreens[i];
+ if (globalX >= dmxScreen->rootXOrigin
+ && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
+ && globalY >= dmxScreen->rootYOrigin
+ && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) {
+ if (dmxScreen->index == (*ppScreen)->myNum)
+ return FALSE;
+ *ppScreen = screenInfo.screens[dmxScreen->index];
+ *x = globalX - dmxScreen->rootXOrigin;
+ *y = globalY - dmxScreen->rootYOrigin;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static void
+dmxCrossScreen(ScreenPtr pScreen, Bool entering)
+{
+}
+
+static void
+dmxWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+ DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
+#if 11 /*BP*/
+ /* This call is depracated. Replace with???? */
+ miPointerWarpCursor(pDev, pScreen, x, y);
+#else
+ pScreen->SetCursorPosition(pDev, pScreen, x, y, FALSE);
+#endif
+}
+
+miPointerScreenFuncRec dmxPointerCursorFuncs = {
+ dmxCursorOffScreen,
+ dmxCrossScreen,
+ dmxWarpCursor,
+ NULL,
+ NULL,
+};
+
+/** Create a list of screens that we'll manipulate. */
+static int *
+dmxSLCreate(void)
+{
+ int *list = malloc(dmxNumScreens * sizeof(*list));
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++)
+ list[i] = 1;
+ return list;
+}
+
+/** Free list. */
+static void
+dmxSLFree(int *list)
+{
+ free(list);
+}
+
+/** Find next uninitialized entry in list. */
+static int
+dmxSLFindNext(int *list)
+{
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++)
+ if (list[i])
+ return i;
+ return -1;
+}
+
+/** Make one pass over all the screens and return the number updated. */
+static int
+dmxTryComputeScreenOrigins(int *screensLeft)
+{
+ ScreenPtr pScreen, refScreen;
+ DMXScreenInfo *screen;
+ int i, ref;
+ int changed = 0;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ if (!screensLeft[i])
+ continue;
+ screen = &dmxScreens[i];
+ pScreen = screenInfo.screens[i];
+ switch (screen->where) {
+ case PosAbsolute:
+ pScreen->x = screen->whereX;
+ pScreen->y = screen->whereY;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosRelative:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ refScreen = screenInfo.screens[ref];
+ pScreen->x = refScreen->x + screen->whereX;
+ pScreen->y = refScreen->y + screen->whereY;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosRightOf:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ refScreen = screenInfo.screens[ref];
+ pScreen->x = refScreen->x + refScreen->width;
+ pScreen->y = refScreen->y;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosLeftOf:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ refScreen = screenInfo.screens[ref];
+ pScreen->x = refScreen->x - pScreen->width;
+ pScreen->y = refScreen->y;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosBelow:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ refScreen = screenInfo.screens[ref];
+ pScreen->x = refScreen->x;
+ pScreen->y = refScreen->y + refScreen->height;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosAbove:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ refScreen = screenInfo.screens[ref];
+ pScreen->x = refScreen->x;
+ pScreen->y = refScreen->y - pScreen->height;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosNone:
+ dmxLog(dmxFatal, "No position information for screen %d\n", i);
+ }
+ }
+ return changed;
+}
+
+static void
+dmxComputeScreenOrigins(void)
+{
+ ScreenPtr pScreen;
+ int *screensLeft;
+ int i, ref;
+ int minX, minY;
+
+ /* Compute origins based on
+ * configuration information. */
+ screensLeft = dmxSLCreate();
+ while ((i = dmxSLFindNext(screensLeft)) >= 0) {
+ while (dmxTryComputeScreenOrigins(screensLeft));
+ if ((i = dmxSLFindNext(screensLeft)) >= 0) {
+ /* All of the remaining screens are referencing each other.
+ * Assign a value to one of them and go through again. This
+ * guarantees that we will eventually terminate.
+ */
+ ref = dmxScreens[i].whereRefScreen;
+ pScreen = screenInfo.screens[ref];
+ pScreen->x = pScreen->y = 0;
+ screensLeft[ref] = 0;
+ }
+ }
+ dmxSLFree(screensLeft);
+
+ /* Justify the topmost and leftmost to
+ * (0,0). */
+ minX = screenInfo.screens[0]->x;
+ minY = screenInfo.screens[0]->y;
+ for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */
+ if (screenInfo.screens[i]->x < minX)
+ minX = screenInfo.screens[i]->x;
+ if (screenInfo.screens[i]->y < minY)
+ minY = screenInfo.screens[i]->y;
+ }
+ if (minX || minY) {
+ for (i = 0; i < dmxNumScreens; i++) {
+ screenInfo.screens[i]->x -= minX;
+ screenInfo.screens[i]->y -= minY;
+ }
+ }
+}
+
+/** Recompute origin information in the #dmxScreens list. This is
+ * called from #dmxInitOrigins. */
+void
+dmxReInitOrigins(void)
+{
+ int i;
+
+ if (dmxNumScreens > MAXSCREENS)
+ dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
+ dmxNumScreens, MAXSCREENS);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ dmxLogOutput(dmxScreen,
+ "s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d"
+ " (be=%dx%d depth=%d bpp=%d)\n",
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+ dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
+ dmxScreen->beWidth, dmxScreen->beHeight,
+ dmxScreen->beDepth, dmxScreen->beBPP);
+ }
+}
+
+/** Initialize screen origins (and relative position). This is called
+ * for each server generation. For dynamic reconfiguration, use
+ * #dmxReInitOrigins() instead. */
+void
+dmxInitOrigins(void)
+{
+ int i;
+
+ if (dmxNumScreens > MAXSCREENS)
+ dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
+ dmxNumScreens, MAXSCREENS);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ dmxLogOutput(dmxScreen,
+ "(request) s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d (%d)"
+ " (be=%dx%d depth=%d bpp=%d)\n",
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+ dmxScreen->whereX, dmxScreen->whereY,
+ dmxScreen->where,
+ dmxScreen->beWidth, dmxScreen->beHeight,
+ dmxScreen->beDepth, dmxScreen->beBPP);
+ }
+
+ dmxComputeScreenOrigins();
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ dmxScreen->rootXOrigin = screenInfo.screens[i]->x;
+ dmxScreen->rootYOrigin = screenInfo.screens[i]->y;
+ }
+
+ dmxReInitOrigins();
+}
+
+/** Returns non-zero if the global \a x, \a y coordinate is on the
+ * screen window of the \a dmxScreen. */
+int
+dmxOnScreen(int x, int y, DMXScreenInfo * dmxScreen)
+{
+#if DMX_CURSOR_DEBUG > 1
+ dmxLog(dmxDebug,
+ "dmxOnScreen %d %d,%d (r=%dx%d%+d%+d@%d,%d s=%dx%d%+d%+d)\n",
+ dmxScreen->index, x, y,
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+ dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY);
+#endif
+ if (x >= dmxScreen->rootXOrigin
+ && x < dmxScreen->rootXOrigin + dmxScreen->rootWidth
+ && y >= dmxScreen->rootYOrigin
+ && y < dmxScreen->rootYOrigin + dmxScreen->rootHeight)
+ return 1;
+ return 0;
+}
+
+/** Returns non-zero if \a a overlaps \a b. */
+static int
+dmxDoesOverlap(DMXScreenInfo * a, DMXScreenInfo * b)
+{
+ if (dmxOnScreen(a->rootXOrigin, a->rootYOrigin, b))
+ return 1;
+
+ if (dmxOnScreen(a->rootXOrigin, a->rootYOrigin + a->scrnWidth, b))
+ return 1;
+
+ if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, a->rootYOrigin, b))
+ return 1;
+
+ if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
+ a->rootYOrigin + a->scrnWidth, b))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin, b->rootYOrigin, a))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin, b->rootYOrigin + b->scrnWidth, a))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, b->rootYOrigin, a))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
+ b->rootYOrigin + b->scrnWidth, a))
+ return 1;
+
+ return 0;
+}
+
+/** Used with \a dmxInterateOverlap to print out a list of screens which
+ * overlap each other. */
+static void *
+dmxPrintOverlap(DMXScreenInfo * dmxScreen, void *closure)
+{
+ DMXScreenInfo *a = closure;
+
+ if (dmxScreen != a) {
+ if (dmxScreen->cursorNotShared)
+ dmxLogOutputCont(a, " [%d/%s]", dmxScreen->index, dmxScreen->name);
+ else
+ dmxLogOutputCont(a, " %d/%s", dmxScreen->index, dmxScreen->name);
+ }
+ return NULL;
+}
+
+/** Iterate over the screens which overlap with the \a start screen,
+ * calling \a f with the \a closure for each argument. Often used with
+ * #dmxPrintOverlap. */
+static void *
+dmxIterateOverlap(DMXScreenInfo * start,
+ void *(*f) (DMXScreenInfo * dmxScreen, void *), void *closure)
+{
+ DMXScreenInfo *pt;
+
+ if (!start->over)
+ return f(start, closure);
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ void *retval;
+
+ if ((retval = f(pt, closure)))
+ return retval;
+ if (pt == start)
+ break;
+ }
+ return NULL;
+}
+
+/** Used with #dmxPropertyIterate to determine if screen \a a is the
+ * same as the screen \a closure. */
+static void *
+dmxTestSameDisplay(DMXScreenInfo * a, void *closure)
+{
+ DMXScreenInfo *b = closure;
+
+ if (a == b)
+ return a;
+ return NULL;
+}
+
+/** Detects overlapping dmxScreens and creates circular lists. This
+ * uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is < 100 and
+ * the computation only needs to be performed for every server
+ * generation or dynamic reconfiguration . */
+void
+dmxInitOverlap(void)
+{
+ int i, j;
+ DMXScreenInfo *a, *b, *pt;
+
+ for (i = 0; i < dmxNumScreens; i++)
+ dmxScreens[i].over = NULL;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ a = &dmxScreens[i];
+
+ for (j = i + 1; j < dmxNumScreens; j++) {
+ b = &dmxScreens[j];
+ if (b->over)
+ continue;
+
+ if (dmxDoesOverlap(a, b)) {
+ DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n",
+ a->index, b->index, a, a->over, b, b->over);
+ b->over = (a->over ? a->over : a);
+ a->over = b;
+ }
+ }
+ }
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ a = &dmxScreens[i];
+
+ if (!a->over)
+ continue;
+
+ /* Flag all pairs that are on same display */
+ for (pt = a->over; pt != a; pt = pt->over) {
+ if (dmxPropertyIterate(a, dmxTestSameDisplay, pt)) {
+ /* The ->over sets contain the transitive set of screens
+ * that overlap. For screens that are on the same
+ * backend display, we only want to exclude pairs of
+ * screens that mutually overlap on the backend display,
+ * so we call dmxDoesOverlap, which is stricter than the
+ * ->over set. */
+ if (!dmxDoesOverlap(a, pt))
+ continue;
+ a->cursorNotShared = 1;
+ pt->cursorNotShared = 1;
+ dmxLog(dmxInfo,
+ "Screen %d and %d overlap on %s\n",
+ a->index, pt->index, a->name);
+ }
+ }
+ }
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ a = &dmxScreens[i];
+
+ if (a->over) {
+ dmxLogOutput(a, "Overlaps");
+ dmxIterateOverlap(a, dmxPrintOverlap, a);
+ dmxLogOutputCont(a, "\n");
+ }
+ }
+}
+
+/** Create \a pCursor on the back-end associated with \a pScreen. */
+void
+dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+ CursorBitsPtr pBits = pCursor->bits;
+ Pixmap src, msk;
+ XColor fg, bg;
+ XImage *img;
+ XlibGC gc = NULL;
+ XGCValues v;
+ unsigned long m;
+ int i;
+
+ if (!pCursorPriv)
+ return;
+
+ m = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCClipMask;
+ v.function = GXcopy;
+ v.plane_mask = AllPlanes;
+ v.foreground = 1L;
+ v.background = 0L;
+ v.clip_mask = None;
+
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ if (dmxScreen->bePixmapFormats[i].depth == 1) {
+ /* Create GC in the back-end servers */
+ gc = XCreateGC(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i],
+ m, &v);
+ break;
+ }
+ }
+ if (!gc)
+ dmxLog(dmxFatal, "dmxRealizeCursor: gc not initialized\n");
+
+ src = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ pBits->width, pBits->height, 1);
+ msk = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ pBits->width, pBits->height, 1);
+
+ img = XCreateImage(dmxScreen->beDisplay,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ 1, XYBitmap, 0, (char *) pBits->source,
+ pBits->width, pBits->height,
+ BitmapPad(dmxScreen->beDisplay), 0);
+
+ XPutImage(dmxScreen->beDisplay, src, gc, img, 0, 0, 0, 0,
+ pBits->width, pBits->height);
+
+ XFree(img);
+
+ img = XCreateImage(dmxScreen->beDisplay,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ 1, XYBitmap, 0, (char *) pBits->mask,
+ pBits->width, pBits->height,
+ BitmapPad(dmxScreen->beDisplay), 0);
+
+ XPutImage(dmxScreen->beDisplay, msk, gc, img, 0, 0, 0, 0,
+ pBits->width, pBits->height);
+
+ XFree(img);
+
+ fg.red = pCursor->foreRed;
+ fg.green = pCursor->foreGreen;
+ fg.blue = pCursor->foreBlue;
+
+ bg.red = pCursor->backRed;
+ bg.green = pCursor->backGreen;
+ bg.blue = pCursor->backBlue;
+
+ pCursorPriv->cursor = XCreatePixmapCursor(dmxScreen->beDisplay,
+ src, msk,
+ &fg, &bg,
+ pBits->xhot, pBits->yhot);
+
+ XFreePixmap(dmxScreen->beDisplay, src);
+ XFreePixmap(dmxScreen->beDisplay, msk);
+ XFreeGC(dmxScreen->beDisplay, gc);
+
+ dmxSync(dmxScreen, FALSE);
+}
+
+static Bool
+_dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxCursorPrivPtr pCursorPriv;
+
+ DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
+
+ DMX_SET_CURSOR_PRIV(pCursor, pScreen, malloc(sizeof(*pCursorPriv)));
+ if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen))
+ return FALSE;
+
+ pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+ pCursorPriv->cursor = (Cursor) 0;
+
+ if (!dmxScreen->beDisplay)
+ return TRUE;
+
+ dmxBECreateCursor(pScreen, pCursor);
+ return TRUE;
+}
+
+/** Free \a pCursor on the back-end associated with \a pScreen. */
+Bool
+dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+
+ if (pCursorPriv) {
+ XFreeCursor(dmxScreen->beDisplay, pCursorPriv->cursor);
+ pCursorPriv->cursor = (Cursor) 0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static Bool
+_dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ DMXDBG2("_dmxUnrealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
+
+ if (dmxScreen->beDisplay) {
+ if (dmxBEFreeCursor(pScreen, pCursor))
+ free(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
+ }
+ DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL);
+
+ return TRUE;
+}
+
+static void
+_dmxMoveCursor(ScreenPtr pScreen, int x, int y)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ int newX = x + dmxScreen->rootX;
+ int newY = y + dmxScreen->rootY;
+
+ if (newX < 0)
+ newX = 0;
+ if (newY < 0)
+ newY = 0;
+
+ DMXDBG5("_dmxMoveCursor(%d,%d,%d) -> %d,%d\n",
+ pScreen->myNum, x, y, newX, newY);
+ if (dmxScreen->beDisplay) {
+ XWarpPointer(dmxScreen->beDisplay, None, dmxScreen->scrnWin,
+ 0, 0, 0, 0, newX, newY);
+ dmxSync(dmxScreen, TRUE);
+ }
+}
+
+static void
+_dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ DMXDBG4("_dmxSetCursor(%d,%p,%d,%d)\n", pScreen->myNum, pCursor, x, y);
+
+ if (pCursor) {
+ dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+
+ if (pCursorPriv && dmxScreen->curCursor != pCursorPriv->cursor) {
+ if (dmxScreen->beDisplay)
+ XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ pCursorPriv->cursor);
+ dmxScreen->cursor = pCursor;
+ dmxScreen->curCursor = pCursorPriv->cursor;
+ dmxScreen->cursorVisible = 1;
+ }
+ _dmxMoveCursor(pScreen, x, y);
+ }
+ else {
+ if (dmxScreen->beDisplay)
+ XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ dmxScreen->noCursor);
+ dmxScreen->cursor = NULL;
+ dmxScreen->curCursor = (Cursor) 0;
+ dmxScreen->cursorVisible = 0;
+ }
+ if (dmxScreen->beDisplay)
+ dmxSync(dmxScreen, TRUE);
+}
+
+static Bool
+dmxRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
+ return _dmxRealizeCursor(pScreen, pCursor);
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor);
+ if (pt == start)
+ break;
+ }
+ return TRUE;
+}
+
+static Bool
+dmxUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
+ return _dmxUnrealizeCursor(pScreen, pCursor);
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor);
+ if (pt == start)
+ break;
+ }
+ return TRUE;
+}
+
+static CursorPtr
+dmxFindCursor(DMXScreenInfo * start)
+{
+ DMXScreenInfo *pt;
+
+ if (!start || !start->over)
+ return GetSpriteCursor(inputInfo.pointer);
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->cursor)
+ return pt->cursor;
+ if (pt == start)
+ break;
+ }
+ return GetSpriteCursor(inputInfo.pointer);
+}
+
+/** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This
+ * function is usually called via #dmxPointerSpriteFuncs, except during
+ * reconfiguration when the cursor is repositioned to force an update on
+ * newley overlapping screens and on screens that no longer overlap.
+ *
+ * The coords (x,y) are in global coord space. We'll loop over the
+ * back-end screens and see if they contain the global coord. If so, call
+ * _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen.
+ */
+void
+dmxMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+
+ DMXDBG3("dmxMoveCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
+ _dmxMoveCursor(pScreen, x, y);
+ return;
+ }
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
+ if ( /* pt != start && */ !pt->cursorVisible) {
+ if (!pt->cursor) {
+ /* This only happens during
+ * reconfiguration when a new overlap
+ * occurs. */
+ CursorPtr pCursor;
+
+ if ((pCursor = dmxFindCursor(start)))
+ _dmxRealizeCursor(screenInfo.screens[pt->index],
+ pt->cursor = pCursor);
+
+ }
+ _dmxSetCursor(screenInfo.screens[pt->index],
+ pt->cursor,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ _dmxMoveCursor(screenInfo.screens[pt->index],
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ else if ( /* pt != start && */ pt->cursorVisible) {
+ _dmxSetCursor(screenInfo.screens[pt->index],
+ NULL,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ if (pt == start)
+ break;
+ }
+}
+
+static void
+dmxSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
+ int y)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+ int GX, GY, gx, gy;
+
+ DMXDBG5("dmxSetCursor(%d %p, %p,%d,%d)\n",
+ pScreen->myNum, start, pCursor, x, y);
+
+ /* We do this check here because of two cases:
+ *
+ * 1) if a client calls XWarpPointer()
+ * and Xinerama is not running, we can
+ * have mi's notion of the pointer
+ * position out of phase with DMX's
+ * notion.
+ *
+ * 2) if a down button is held while the
+ * cursor moves outside the root window,
+ * mi's notion of the pointer position
+ * is out of phase with DMX's notion and
+ * the cursor can remain visible when it
+ * shouldn't be. */
+
+ dmxGetGlobalPosition(&GX, &GY);
+ gx = start->rootXOrigin + x;
+ gy = start->rootYOrigin + y;
+ if (x && y && (GX != gx || GY != gy))
+ dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK);
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
+ _dmxSetCursor(pScreen, pCursor, x, y);
+ return;
+ }
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
+ _dmxSetCursor(screenInfo.screens[pt->index], pCursor,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ else {
+ _dmxSetCursor(screenInfo.screens[pt->index], NULL,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ if (pt == start)
+ break;
+ }
+}
+
+/** This routine is used by the backend input routines to hide the
+ * cursor on a screen that is being used for relative input. \see
+ * dmxbackend.c */
+void
+dmxHideCursor(DMXScreenInfo * dmxScreen)
+{
+ int x, y;
+ ScreenPtr pScreen = screenInfo.screens[dmxScreen->index];
+
+ dmxGetGlobalPosition(&x, &y);
+ _dmxSetCursor(pScreen, NULL, x, y);
+}
+
+/** This routine is called during reconfiguration to make sure the
+ * cursor is visible. */
+void
+dmxCheckCursor(void)
+{
+ int i;
+ int x, y;
+ ScreenPtr pScreen;
+ DMXScreenInfo *firstScreen;
+
+ dmxGetGlobalPosition(&x, &y);
+ firstScreen = dmxFindFirstScreen(x, y);
+
+ DMXDBG2("dmxCheckCursor %d %d\n", x, y);
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ pScreen = screenInfo.screens[dmxScreen->index];
+
+ if (!dmxOnScreen(x, y, dmxScreen)) {
+ if (firstScreen &&
+ i == miPointerGetScreen(inputInfo.pointer)->myNum)
+ miPointerSetScreen(inputInfo.pointer, firstScreen->index, x,
+ y);
+ _dmxSetCursor(pScreen, NULL, x - dmxScreen->rootXOrigin,
+ y - dmxScreen->rootYOrigin);
+ }
+ else {
+ if (!dmxScreen->cursor) {
+ CursorPtr pCursor;
+
+ if ((pCursor = dmxFindCursor(dmxScreen))) {
+ _dmxRealizeCursor(pScreen, dmxScreen->cursor = pCursor);
+ }
+ }
+ _dmxSetCursor(pScreen, dmxScreen->cursor,
+ x - dmxScreen->rootXOrigin,
+ y - dmxScreen->rootYOrigin);
+ }
+ }
+ DMXDBG2(" leave dmxCheckCursor %d %d\n", x, y);
+}
+
+static Bool
+dmxDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+ return TRUE;
+}
+
+static void
+dmxDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+}
+
+miPointerSpriteFuncRec dmxPointerSpriteFuncs = {
+ dmxRealizeCursor,
+ dmxUnrealizeCursor,
+ dmxSetCursor,
+ dmxMoveCursor,
+ dmxDeviceCursorInitialize,
+ dmxDeviceCursorCleanup
+};
diff --git a/xorg-server/hw/dmx/dmxdpms.c b/xorg-server/hw/dmx/dmxdpms.c
index 2af160556..d53a3d998 100644
--- a/xorg-server/hw/dmx/dmxdpms.c
+++ b/xorg-server/hw/dmx/dmxdpms.c
@@ -54,36 +54,37 @@
#include <X11/extensions/dpms.h>
static unsigned long dpmsGeneration = 0;
-static Bool dpmsSupported = TRUE;
+static Bool dpmsSupported = TRUE;
-static void _dmxDPMSInit(DMXScreenInfo *dmxScreen)
+static void
+_dmxDPMSInit(DMXScreenInfo * dmxScreen)
{
- int event_base, error_base;
- int major, minor;
- CARD16 level, standby, suspend, off;
- BOOL state;
+ int event_base, error_base;
+ int major, minor;
+ CARD16 level, standby, suspend, off;
+ BOOL state;
const char *monitor;
if (dpmsGeneration != serverGeneration) {
- dpmsSupported = TRUE; /* On unless a backend doesn't support it */
+ dpmsSupported = TRUE; /* On unless a backend doesn't support it */
dpmsGeneration = serverGeneration;
}
#ifdef DPMSExtension
- if (DPMSDisabledSwitch) dpmsSupported = FALSE; /* -dpms turns off */
+ if (DPMSDisabledSwitch)
+ dpmsSupported = FALSE; /* -dpms turns off */
#endif
dmxScreen->dpmsCapable = 0;
-
+
if (!dmxScreen->beDisplay) {
dmxLogOutput(dmxScreen,
- "Cannot determine if DPMS supported (detached screen)\n");
+ "Cannot determine if DPMS supported (detached screen)\n");
dpmsSupported = FALSE;
return;
}
- if (!DPMSQueryExtension(dmxScreen->beDisplay,
- &event_base, &error_base)) {
+ if (!DPMSQueryExtension(dmxScreen->beDisplay, &event_base, &error_base)) {
dmxLogOutput(dmxScreen, "DPMS not supported\n");
dpmsSupported = FALSE;
return;
@@ -106,19 +107,29 @@ static void _dmxDPMSInit(DMXScreenInfo *dmxScreen)
DPMSEnable(dmxScreen->beDisplay);
DPMSForceLevel(dmxScreen->beDisplay, DPMSModeOn);
dmxScreen->dpmsCapable = 1;
- dmxScreen->dpmsEnabled = !!state;
+ dmxScreen->dpmsEnabled = ! !state;
dmxScreen->dpmsStandby = standby;
dmxScreen->dpmsSuspend = suspend;
- dmxScreen->dpmsOff = off;
+ dmxScreen->dpmsOff = off;
switch (level) {
- case DPMSModeOn: monitor = "on"; break;
- case DPMSModeStandby: monitor = "standby"; break;
- case DPMSModeSuspend: monitor = "suspend"; break;
- case DPMSModeOff: monitor = "off"; break;
- default: monitor = "unknown"; break;
+ case DPMSModeOn:
+ monitor = "on";
+ break;
+ case DPMSModeStandby:
+ monitor = "standby";
+ break;
+ case DPMSModeSuspend:
+ monitor = "suspend";
+ break;
+ case DPMSModeOff:
+ monitor = "off";
+ break;
+ default:
+ monitor = "unknown";
+ break;
}
-
+
dmxLogOutput(dmxScreen,
"DPMS %d.%d (%s, %s, %d %d %d)\n",
major, minor, monitor, state ? "enabled" : "disabled",
@@ -127,86 +138,98 @@ static void _dmxDPMSInit(DMXScreenInfo *dmxScreen)
/** Initialize DPMS support. We save the current settings and turn off
* DPMS. The settings are restored in #dmxDPMSTerm. */
-void dmxDPMSInit(DMXScreenInfo *dmxScreen)
+void
+dmxDPMSInit(DMXScreenInfo * dmxScreen)
{
- int interval, preferBlanking, allowExposures;
+ int interval, preferBlanking, allowExposures;
- /* Turn off DPMS */
+ /* Turn off DPMS */
_dmxDPMSInit(dmxScreen);
if (!dmxScreen->beDisplay)
- return;
+ return;
- /* Turn off screen saver */
+ /* Turn off screen saver */
XGetScreenSaver(dmxScreen->beDisplay, &dmxScreen->savedTimeout, &interval,
- &preferBlanking, &allowExposures);
+ &preferBlanking, &allowExposures);
XSetScreenSaver(dmxScreen->beDisplay, 0, interval,
- preferBlanking, allowExposures);
+ preferBlanking, allowExposures);
XResetScreenSaver(dmxScreen->beDisplay);
dmxSync(dmxScreen, FALSE);
}
/** Terminate DPMS support on \a dmxScreen. We restore the settings
* saved in #dmxDPMSInit. */
-void dmxDPMSTerm(DMXScreenInfo *dmxScreen)
+void
+dmxDPMSTerm(DMXScreenInfo * dmxScreen)
{
- int timeout, interval, preferBlanking, allowExposures;
+ int timeout, interval, preferBlanking, allowExposures;
if (!dmxScreen->beDisplay)
- return;
+ return;
XGetScreenSaver(dmxScreen->beDisplay, &timeout, &interval,
- &preferBlanking, &allowExposures);
+ &preferBlanking, &allowExposures);
XSetScreenSaver(dmxScreen->beDisplay, dmxScreen->savedTimeout, interval,
- preferBlanking, allowExposures);
+ preferBlanking, allowExposures);
if (dmxScreen->dpmsCapable) {
- /* Restore saved state */
+ /* Restore saved state */
DPMSForceLevel(dmxScreen->beDisplay, DPMSModeOn);
DPMSSetTimeouts(dmxScreen->beDisplay, dmxScreen->dpmsStandby,
dmxScreen->dpmsSuspend, dmxScreen->dpmsOff);
- if (dmxScreen->dpmsEnabled) DPMSEnable(dmxScreen->beDisplay);
- else DPMSDisable(dmxScreen->beDisplay);
+ if (dmxScreen->dpmsEnabled)
+ DPMSEnable(dmxScreen->beDisplay);
+ else
+ DPMSDisable(dmxScreen->beDisplay);
}
dmxSync(dmxScreen, FALSE);
}
/** Called when activity is detected so that DPMS power-saving mode can
* be deactivated. */
-void dmxDPMSWakeup(void)
+void
+dmxDPMSWakeup(void)
{
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
#ifdef DPMSExtension
- if (DPMSPowerLevel) DPMSSet(serverClient, 0);
+ if (DPMSPowerLevel)
+ DPMSSet(serverClient, 0);
#endif
}
#ifdef DPMSExtension
/** This is called on each server generation. It should determine if
* DPMS is supported on all of the backends and, if so, return TRUE. */
-Bool DPMSSupported(void)
+Bool
+DPMSSupported(void)
{
return dpmsSupported;
}
/** This is used by clients (e.g., xset) to set the DPMS level. */
-int DPMSSet(ClientPtr client, int level)
+int
+DPMSSet(ClientPtr client, int level)
{
int i;
- if (!dpmsSupported) return Success;
+ if (!dpmsSupported)
+ return Success;
+
+ if (level < 0)
+ level = DPMSModeOn;
+ if (level > 3)
+ level = DPMSModeOff;
- if (level < 0) level = DPMSModeOn;
- if (level > 3) level = DPMSModeOff;
-
DPMSPowerLevel = level;
for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i];
- if (dmxScreen->beDisplay) {
- DPMSForceLevel(dmxScreen->beDisplay, level);
- dmxSync(dmxScreen, FALSE);
- }
+
+ if (dmxScreen->beDisplay) {
+ DPMSForceLevel(dmxScreen->beDisplay, level);
+ dmxSync(dmxScreen, FALSE);
+ }
}
return Success;
}
diff --git a/xorg-server/hw/dmx/dmxextension.c b/xorg-server/hw/dmx/dmxextension.c
index 80d11ee89..faa28a590 100644
--- a/xorg-server/hw/dmx/dmxextension.c
+++ b/xorg-server/hw/dmx/dmxextension.c
@@ -60,86 +60,89 @@
#include "input/dmxinputinit.h"
#include "windowstr.h"
-#include "inputstr.h" /* For DeviceIntRec */
-#include <X11/extensions/dmxproto.h> /* For DMX_BAD_* */
+#include "inputstr.h" /* For DeviceIntRec */
+#include <X11/extensions/dmxproto.h> /* For DMX_BAD_* */
#include "cursorstr.h"
/* The default font is declared in dix/globals.c, but is not included in
* _any_ header files. */
-extern FontPtr defaultFont;
-
+extern FontPtr defaultFont;
+
/** This routine provides information to the DMX protocol extension
* about a particular screen. */
-Bool dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr)
+Bool
+dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr)
{
DMXScreenInfo *dmxScreen;
- if (physical < 0 || physical >= dmxNumScreens) return FALSE;
+ if (physical < 0 || physical >= dmxNumScreens)
+ return FALSE;
dmxScreen = &dmxScreens[physical];
- attr->displayName = dmxScreen->name;
+ attr->displayName = dmxScreen->name;
#ifdef PANORAMIX
- attr->logicalScreen = noPanoramiXExtension ? dmxScreen->index : 0;
+ attr->logicalScreen = noPanoramiXExtension ? dmxScreen->index : 0;
#else
- attr->logicalScreen = dmxScreen->index;
+ attr->logicalScreen = dmxScreen->index;
#endif
- attr->screenWindowWidth = dmxScreen->scrnWidth;
- attr->screenWindowHeight = dmxScreen->scrnHeight;
+ attr->screenWindowWidth = dmxScreen->scrnWidth;
+ attr->screenWindowHeight = dmxScreen->scrnHeight;
attr->screenWindowXoffset = dmxScreen->scrnX;
attr->screenWindowYoffset = dmxScreen->scrnY;
- attr->rootWindowWidth = dmxScreen->rootWidth;
- attr->rootWindowHeight = dmxScreen->rootHeight;
- attr->rootWindowXoffset = dmxScreen->rootX;
- attr->rootWindowYoffset = dmxScreen->rootY;
+ attr->rootWindowWidth = dmxScreen->rootWidth;
+ attr->rootWindowHeight = dmxScreen->rootHeight;
+ attr->rootWindowXoffset = dmxScreen->rootX;
+ attr->rootWindowYoffset = dmxScreen->rootY;
- attr->rootWindowXorigin = dmxScreen->rootXOrigin;
- attr->rootWindowYorigin = dmxScreen->rootYOrigin;
+ attr->rootWindowXorigin = dmxScreen->rootXOrigin;
+ attr->rootWindowYorigin = dmxScreen->rootYOrigin;
return TRUE;
}
/** This routine provides information to the DMX protocol extension
* about a particular window. */
-Bool dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr)
+Bool
+dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr)
{
dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- attr->screen = pWindow->drawable.pScreen->myNum;
- attr->window = pWinPriv->window;
+ attr->screen = pWindow->drawable.pScreen->myNum;
+ attr->window = pWinPriv->window;
- attr->pos.x = pWindow->drawable.x;
- attr->pos.y = pWindow->drawable.y;
- attr->pos.width = pWindow->drawable.width;
- attr->pos.height = pWindow->drawable.height;
+ attr->pos.x = pWindow->drawable.x;
+ attr->pos.y = pWindow->drawable.y;
+ attr->pos.width = pWindow->drawable.width;
+ attr->pos.height = pWindow->drawable.height;
if (!pWinPriv->window || pWinPriv->offscreen) {
- attr->vis.x = 0;
- attr->vis.y = 0;
+ attr->vis.x = 0;
+ attr->vis.y = 0;
attr->vis.height = 0;
- attr->vis.width = 0;
+ attr->vis.width = 0;
return pWinPriv->window ? TRUE : FALSE;
}
- /* Compute display-relative coordinates */
- attr->vis.x = pWindow->drawable.x;
- attr->vis.y = pWindow->drawable.y;
- attr->vis.width = pWindow->drawable.width;
- attr->vis.height = pWindow->drawable.height;
+ /* Compute display-relative coordinates */
+ attr->vis.x = pWindow->drawable.x;
+ attr->vis.y = pWindow->drawable.y;
+ attr->vis.width = pWindow->drawable.width;
+ attr->vis.height = pWindow->drawable.height;
if (attr->pos.x < 0) {
- attr->vis.x -= attr->pos.x;
- attr->vis.width = attr->pos.x + attr->pos.width - attr->vis.x;
+ attr->vis.x -= attr->pos.x;
+ attr->vis.width = attr->pos.x + attr->pos.width - attr->vis.x;
}
if (attr->pos.x + attr->pos.width > pWindow->drawable.pScreen->width) {
if (attr->pos.x < 0)
- attr->vis.width = pWindow->drawable.pScreen->width;
+ attr->vis.width = pWindow->drawable.pScreen->width;
else
- attr->vis.width = pWindow->drawable.pScreen->width - attr->pos.x;
+ attr->vis.width = pWindow->drawable.pScreen->width - attr->pos.x;
}
if (attr->pos.y < 0) {
- attr->vis.y -= attr->pos.y;
+ attr->vis.y -= attr->pos.y;
attr->vis.height = attr->pos.y + attr->pos.height - attr->vis.y;
}
if (attr->pos.y + attr->pos.height > pWindow->drawable.pScreen->height) {
@@ -149,29 +152,32 @@ Bool dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr)
attr->vis.height = pWindow->drawable.pScreen->height - attr->pos.y;
}
- /* Convert to window-relative coordinates */
+ /* Convert to window-relative coordinates */
attr->vis.x -= attr->pos.x;
attr->vis.y -= attr->pos.y;
return TRUE;
}
-void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr)
+void
+dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr)
{
- attr->width = dmxGlobalWidth;
+ attr->width = dmxGlobalWidth;
attr->height = dmxGlobalHeight;
- attr->shiftX = 0; /* NOTE: The upper left hand corner of */
- attr->shiftY = 0; /* the desktop is always <0,0>. */
+ attr->shiftX = 0; /* NOTE: The upper left hand corner of */
+ attr->shiftY = 0; /* the desktop is always <0,0>. */
}
/** Return the total number of devices, not just #dmxNumInputs. The
* number returned should be the same as that returned by
* XListInputDevices. */
-int dmxGetInputCount(void)
+int
+dmxGetInputCount(void)
{
int i, total;
-
- for (total = i = 0; i < dmxNumInputs; i++) total += dmxInputs[i].numDevs;
+
+ for (total = i = 0; i < dmxNumInputs; i++)
+ total += dmxInputs[i].numDevs;
return total;
}
@@ -179,38 +185,42 @@ int dmxGetInputCount(void)
* information is primarily for the #ProcDMXGetInputAttributes()
* function, which does not have access to the appropriate data
* structure. */
-int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr)
+int
+dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr)
{
- int i, j;
+ int i, j;
DMXInputInfo *dmxInput;
- if (deviceId < 0) return -1;
+ if (deviceId < 0)
+ return -1;
for (i = 0; i < dmxNumInputs; i++) {
dmxInput = &dmxInputs[i];
for (j = 0; j < dmxInput->numDevs; j++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
- if (deviceId != dmxLocal->pDevice->id) continue;
- attr->isCore = !!dmxLocal->isCore;
- attr->sendsCore = !!dmxLocal->sendsCore;
- attr->detached = !!dmxInput->detached;
- attr->physicalScreen = -1;
- attr->physicalId = -1;
- attr->name = NULL;
+
+ if (deviceId != dmxLocal->pDevice->id)
+ continue;
+ attr->isCore = ! !dmxLocal->isCore;
+ attr->sendsCore = ! !dmxLocal->sendsCore;
+ attr->detached = ! !dmxInput->detached;
+ attr->physicalScreen = -1;
+ attr->physicalId = -1;
+ attr->name = NULL;
switch (dmxLocal->extType) {
case DMX_LOCAL_TYPE_LOCAL:
- attr->inputType = 0;
+ attr->inputType = 0;
break;
case DMX_LOCAL_TYPE_CONSOLE:
- attr->inputType = 1;
- attr->name = dmxInput->name;
- attr->physicalId = dmxLocal->deviceId;
+ attr->inputType = 1;
+ attr->name = dmxInput->name;
+ attr->physicalId = dmxLocal->deviceId;
break;
case DMX_LOCAL_TYPE_BACKEND:
case DMX_LOCAL_TYPE_COMMON:
- attr->inputType = 2;
+ attr->inputType = 2;
attr->physicalScreen = dmxInput->scrnIdx;
- attr->name = dmxInput->name;
- attr->physicalId = dmxLocal->deviceId;
+ attr->name = dmxInput->name;
+ attr->physicalId = dmxLocal->deviceId;
break;
}
return 0; /* Success */
@@ -220,9 +230,10 @@ int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr)
}
/** Reinitialized the cursor boundaries. */
-static void dmxAdjustCursorBoundaries(void)
+static void
+dmxAdjustCursorBoundaries(void)
{
- int i;
+ int i;
dmxReInitOrigins();
dmxInitOverlap();
@@ -230,28 +241,33 @@ static void dmxAdjustCursorBoundaries(void)
dmxConnectionBlockCallback();
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (!dmxInput->detached) dmxInputReInit(dmxInput);
+
+ if (!dmxInput->detached)
+ dmxInputReInit(dmxInput);
}
dmxCheckCursor();
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (!dmxInput->detached) dmxInputLateReInit(dmxInput);
+
+ if (!dmxInput->detached)
+ dmxInputLateReInit(dmxInput);
}
}
/** Add an input with the specified attributes. If the input is added,
* the physical id is returned in \a deviceId. */
-int dmxAddInput(DMXInputAttributesPtr attr, int *id)
+int
+dmxAddInput(DMXInputAttributesPtr attr, int *id)
{
int retcode = BadValue;
if (attr->inputType == 1) /* console */
retcode = dmxInputAttachConsole(attr->name, attr->sendsCore, id);
- else if (attr->inputType == 2) /* backend */
+ else if (attr->inputType == 2) /* backend */
retcode = dmxInputAttachBackend(attr->physicalScreen,
- attr->sendsCore,id);
+ attr->sendsCore, id);
if (retcode == Success) {
/* Adjust the cursor boundaries */
@@ -265,7 +281,8 @@ int dmxAddInput(DMXInputAttributesPtr attr, int *id)
}
/** Remove the input with physical id \a id. */
-int dmxRemoveInput(int id)
+int
+dmxRemoveInput(int id)
{
return dmxInputDetachId(id);
}
@@ -273,46 +290,52 @@ int dmxRemoveInput(int id)
/** Return the value of #dmxNumScreens -- the total number of backend
* screens in use (these are logical screens and may be larger than the
* number of backend displays). */
-unsigned long dmxGetNumScreens(void)
+unsigned long
+dmxGetNumScreens(void)
{
return dmxNumScreens;
}
/** Make sure that #dmxCreateAndRealizeWindow has been called for \a
* pWindow. */
-void dmxForceWindowCreation(WindowPtr pWindow)
+void
+dmxForceWindowCreation(WindowPtr pWindow)
{
dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- if (!pWinPriv->window) dmxCreateAndRealizeWindow(pWindow, TRUE);
+
+ if (!pWinPriv->window)
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
}
/** Flush pending syncs for all screens. */
-void dmxFlushPendingSyncs(void)
+void
+dmxFlushPendingSyncs(void)
{
dmxSync(NULL, TRUE);
}
/** Update DMX's screen resources to match those of the newly moved
* and/or resized "root" window. */
-void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
+void
+dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- WindowPtr pRoot = pScreen->root;
- WindowPtr pChild;
- Bool anyMarked = FALSE;
+ WindowPtr pRoot = pScreen->root;
+ WindowPtr pChild;
+ Bool anyMarked = FALSE;
/* Handle special case where width and/or height are zero */
if (w == 0 || h == 0) {
- w = 1;
- h = 1;
+ w = 1;
+ h = 1;
}
/* Change screen size */
- pScreen->width = w;
+ pScreen->width = w;
pScreen->height = h;
/* Reset the root window's drawable's size */
- pRoot->drawable.width = w;
+ pRoot->drawable.width = w;
pRoot->drawable.height = h;
/* Set the root window's new winSize and borderSize */
@@ -328,15 +351,15 @@ void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
/* Recompute this screen's mmWidth & mmHeight */
pScreen->mmWidth =
- (w * 254 + dmxScreen->beXDPI * 5) / (dmxScreen->beXDPI * 10);
+ (w * 254 + dmxScreen->beXDPI * 5) / (dmxScreen->beXDPI * 10);
pScreen->mmHeight =
- (h * 254 + dmxScreen->beYDPI * 5) / (dmxScreen->beYDPI * 10);
+ (h * 254 + dmxScreen->beYDPI * 5) / (dmxScreen->beYDPI * 10);
/* Recompute this screen's window's clip rects as follows: */
/* 1. Mark all of root's children's windows */
for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib)
- anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild,
- (WindowPtr *)NULL);
+ anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild,
+ (WindowPtr *) NULL);
/* 2. Set the root window's borderClip */
pRoot->borderClip.extents.x1 = 0;
@@ -346,27 +369,28 @@ void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
/* 3. Set the root window's clipList */
if (anyMarked) {
- /* If any windows have been marked, set the root window's
- * clipList to be broken since it will be recalculated in
- * ValidateTree()
- */
- RegionBreak(&pRoot->clipList);
- } else {
- /* Otherwise, we just set it directly since there are no
- * windows visible on this screen
- */
- pRoot->clipList.extents.x1 = 0;
- pRoot->clipList.extents.y1 = 0;
- pRoot->clipList.extents.x2 = w;
- pRoot->clipList.extents.y2 = h;
+ /* If any windows have been marked, set the root window's
+ * clipList to be broken since it will be recalculated in
+ * ValidateTree()
+ */
+ RegionBreak(&pRoot->clipList);
+ }
+ else {
+ /* Otherwise, we just set it directly since there are no
+ * windows visible on this screen
+ */
+ pRoot->clipList.extents.x1 = 0;
+ pRoot->clipList.extents.y1 = 0;
+ pRoot->clipList.extents.x2 = w;
+ pRoot->clipList.extents.y2 = h;
}
/* 4. Revalidate all clip rects and generate expose events */
if (anyMarked) {
- pScreen->ValidateTree(pRoot, NULL, VTBroken);
- pScreen->HandleExposures(pRoot);
- if (pScreen->PostValidateTree)
- pScreen->PostValidateTree(pRoot, NULL, VTBroken);
+ pScreen->ValidateTree(pRoot, NULL, VTBroken);
+ pScreen->HandleExposures(pRoot);
+ if (pScreen->PostValidateTree)
+ pScreen->PostValidateTree(pRoot, NULL, VTBroken);
}
}
@@ -375,72 +399,71 @@ void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
/** Change the "screen" window attributes by resizing the actual window
* on the back-end display (if necessary). */
-static void dmxConfigureScreenWindow(int idx,
- int x, int y, int w, int h)
+static void
+dmxConfigureScreenWindow(int idx, int x, int y, int w, int h)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- ScreenPtr pScreen = screenInfo.screens[idx];
+ ScreenPtr pScreen = screenInfo.screens[idx];
/* Resize "screen" window */
- if (dmxScreen->scrnX != x ||
- dmxScreen->scrnY != y ||
- dmxScreen->scrnWidth != w ||
- dmxScreen->scrnHeight != h) {
- dmxResizeScreenWindow(pScreen, x, y, w, h);
+ if (dmxScreen->scrnX != x ||
+ dmxScreen->scrnY != y ||
+ dmxScreen->scrnWidth != w || dmxScreen->scrnHeight != h) {
+ dmxResizeScreenWindow(pScreen, x, y, w, h);
}
/* Change "screen" window values */
- dmxScreen->scrnX = x;
- dmxScreen->scrnY = y;
- dmxScreen->scrnWidth = w;
+ dmxScreen->scrnX = x;
+ dmxScreen->scrnY = y;
+ dmxScreen->scrnWidth = w;
dmxScreen->scrnHeight = h;
}
-
+
/** Change the "root" window position and size by resizing the actual
* window on the back-end display (if necessary) and updating all of
* DMX's resources by calling #dmxUpdateScreenResources. */
-static void dmxConfigureRootWindow(int idx, int x, int y, int w, int h)
+static void
+dmxConfigureRootWindow(int idx, int x, int y, int w, int h)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- WindowPtr pRoot = screenInfo.screens[idx]->root;
+ WindowPtr pRoot = screenInfo.screens[idx]->root;
/* NOTE: Either this function or the ones that it calls must handle
* the case where w == 0 || h == 0. Currently, the functions that
* this one calls handle that case. */
/* 1. Resize "root" window */
- if (dmxScreen->rootX != x ||
- dmxScreen->rootY != y ||
- dmxScreen->rootWidth != w ||
- dmxScreen->rootHeight != h) {
- dmxResizeRootWindow(pRoot, x, y, w, h);
+ if (dmxScreen->rootX != x ||
+ dmxScreen->rootY != y ||
+ dmxScreen->rootWidth != w || dmxScreen->rootHeight != h) {
+ dmxResizeRootWindow(pRoot, x, y, w, h);
}
/* 2. Update all of the screen's resources associated with this root
* window */
- if (dmxScreen->rootWidth != w ||
- dmxScreen->rootHeight != h) {
- dmxUpdateScreenResources(screenInfo.screens[idx], x, y, w, h);
+ if (dmxScreen->rootWidth != w || dmxScreen->rootHeight != h) {
+ dmxUpdateScreenResources(screenInfo.screens[idx], x, y, w, h);
}
/* Change "root" window values */
- dmxScreen->rootX = x;
- dmxScreen->rootY = y;
- dmxScreen->rootWidth = w;
+ dmxScreen->rootX = x;
+ dmxScreen->rootY = y;
+ dmxScreen->rootWidth = w;
dmxScreen->rootHeight = h;
}
/** Change the "root" window's origin by updating DMX's internal data
* structures (dix and Xinerama) to use the new origin and adjust the
* positions of windows that overlap this "root" window. */
-static void dmxSetRootWindowOrigin(int idx, int x, int y)
+static void
+dmxSetRootWindowOrigin(int idx, int x, int y)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- ScreenPtr pScreen = screenInfo.screens[idx];
- WindowPtr pRoot = pScreen->root;
- WindowPtr pChild;
- int xoff;
- int yoff;
+ ScreenPtr pScreen = screenInfo.screens[idx];
+ WindowPtr pRoot = pScreen->root;
+ WindowPtr pChild;
+ int xoff;
+ int yoff;
/* Change "root" window's origin */
dmxScreen->rootXOrigin = x;
@@ -458,129 +481,131 @@ static void dmxSetRootWindowOrigin(int idx, int x, int y)
XineramaReinitData();
/* Adjust each of the root window's children */
- if (!idx) ReinitializeRootWindow(screenInfo.screens[0]->root, xoff, yoff);
+ if (!idx)
+ ReinitializeRootWindow(screenInfo.screens[0]->root, xoff, yoff);
pChild = pRoot->firstChild;
while (pChild) {
- /* Adjust child window's position */
- pScreen->MoveWindow(pChild,
- pChild->origin.x - wBorderWidth(pChild) - xoff,
- pChild->origin.y - wBorderWidth(pChild) - yoff,
- pChild->nextSib,
- VTMove);
-
- /* Note that the call to MoveWindow will eventually call
- * dmxPositionWindow which will automatically create a
- * window if it is now exposed on screen (for lazy window
- * creation optimization) and it will properly set the
- * offscreen flag.
- */
-
- pChild = pChild->nextSib;
+ /* Adjust child window's position */
+ pScreen->MoveWindow(pChild,
+ pChild->origin.x - wBorderWidth(pChild) - xoff,
+ pChild->origin.y - wBorderWidth(pChild) - yoff,
+ pChild->nextSib, VTMove);
+
+ /* Note that the call to MoveWindow will eventually call
+ * dmxPositionWindow which will automatically create a
+ * window if it is now exposed on screen (for lazy window
+ * creation optimization) and it will properly set the
+ * offscreen flag.
+ */
+
+ pChild = pChild->nextSib;
}
}
/** Configure the attributes of each "screen" and "root" window. */
-int dmxConfigureScreenWindows(int nscreens,
- CARD32 *screens,
- DMXScreenAttributesPtr attribs,
- int *errorScreen)
+int
+dmxConfigureScreenWindows(int nscreens,
+ CARD32 *screens,
+ DMXScreenAttributesPtr attribs, int *errorScreen)
{
- int i;
+ int i;
for (i = 0; i < nscreens; i++) {
- DMXScreenAttributesPtr attr = &attribs[i];
- int idx = screens[i];
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
-
- if (errorScreen) *errorScreen = i;
-
- if (!dmxScreen->beDisplay) return DMX_BAD_VALUE;
-
- /* Check for illegal values */
- if (idx < 0 || idx >= dmxNumScreens) return BadValue;
-
- /* The "screen" and "root" windows must have valid sizes */
- if (attr->screenWindowWidth <= 0 || attr->screenWindowHeight <= 0 ||
- attr->rootWindowWidth < 0 || attr->rootWindowHeight < 0)
- return DMX_BAD_VALUE;
-
- /* The "screen" window must fit entirely within the BE display */
- if (attr->screenWindowXoffset < 0 ||
- attr->screenWindowYoffset < 0 ||
- attr->screenWindowXoffset
- + attr->screenWindowWidth > (unsigned)dmxScreen->beWidth ||
- attr->screenWindowYoffset
- + attr->screenWindowHeight > (unsigned)dmxScreen->beHeight)
- return DMX_BAD_VALUE;
-
- /* The "root" window must fit entirely within the "screen" window */
- if (attr->rootWindowXoffset < 0 ||
- attr->rootWindowYoffset < 0 ||
- attr->rootWindowXoffset
- + attr->rootWindowWidth > attr->screenWindowWidth ||
- attr->rootWindowYoffset
- + attr->rootWindowHeight > attr->screenWindowHeight)
- return DMX_BAD_VALUE;
-
- /* The "root" window must not expose unaddressable coordinates */
- if (attr->rootWindowXorigin < 0 ||
- attr->rootWindowYorigin < 0 ||
- attr->rootWindowXorigin + attr->rootWindowWidth > 32767 ||
- attr->rootWindowYorigin + attr->rootWindowHeight > 32767)
- return DMX_BAD_VALUE;
-
- /* The "root" window must fit within the global bounding box */
- if (attr->rootWindowXorigin
- + attr->rootWindowWidth > (unsigned)dmxGlobalWidth ||
- attr->rootWindowYorigin
- + attr->rootWindowHeight > (unsigned)dmxGlobalHeight)
- return DMX_BAD_VALUE;
-
- /* FIXME: Handle the rest of the illegal value checking */
+ DMXScreenAttributesPtr attr = &attribs[i];
+ int idx = screens[i];
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ if (errorScreen)
+ *errorScreen = i;
+
+ if (!dmxScreen->beDisplay)
+ return DMX_BAD_VALUE;
+
+ /* Check for illegal values */
+ if (idx < 0 || idx >= dmxNumScreens)
+ return BadValue;
+
+ /* The "screen" and "root" windows must have valid sizes */
+ if (attr->screenWindowWidth <= 0 || attr->screenWindowHeight <= 0 ||
+ attr->rootWindowWidth < 0 || attr->rootWindowHeight < 0)
+ return DMX_BAD_VALUE;
+
+ /* The "screen" window must fit entirely within the BE display */
+ if (attr->screenWindowXoffset < 0 ||
+ attr->screenWindowYoffset < 0 ||
+ attr->screenWindowXoffset
+ + attr->screenWindowWidth > (unsigned) dmxScreen->beWidth ||
+ attr->screenWindowYoffset
+ + attr->screenWindowHeight > (unsigned) dmxScreen->beHeight)
+ return DMX_BAD_VALUE;
+
+ /* The "root" window must fit entirely within the "screen" window */
+ if (attr->rootWindowXoffset < 0 ||
+ attr->rootWindowYoffset < 0 ||
+ attr->rootWindowXoffset
+ + attr->rootWindowWidth > attr->screenWindowWidth ||
+ attr->rootWindowYoffset
+ + attr->rootWindowHeight > attr->screenWindowHeight)
+ return DMX_BAD_VALUE;
+
+ /* The "root" window must not expose unaddressable coordinates */
+ if (attr->rootWindowXorigin < 0 ||
+ attr->rootWindowYorigin < 0 ||
+ attr->rootWindowXorigin + attr->rootWindowWidth > 32767 ||
+ attr->rootWindowYorigin + attr->rootWindowHeight > 32767)
+ return DMX_BAD_VALUE;
+
+ /* The "root" window must fit within the global bounding box */
+ if (attr->rootWindowXorigin
+ + attr->rootWindowWidth > (unsigned) dmxGlobalWidth ||
+ attr->rootWindowYorigin
+ + attr->rootWindowHeight > (unsigned) dmxGlobalHeight)
+ return DMX_BAD_VALUE;
+
+ /* FIXME: Handle the rest of the illegal value checking */
}
/* No illegal values found */
- if (errorScreen) *errorScreen = 0;
+ if (errorScreen)
+ *errorScreen = 0;
for (i = 0; i < nscreens; i++) {
- DMXScreenAttributesPtr attr = &attribs[i];
- int idx = screens[i];
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
-
- dmxLog(dmxInfo, "Changing screen #%d attributes "
- "from %dx%d+%d+%d %dx%d+%d+%d +%d+%d "
- "to %dx%d+%d+%d %dx%d+%d+%d +%d+%d\n",
- idx,
- dmxScreen->scrnWidth, dmxScreen->scrnHeight,
- dmxScreen->scrnX, dmxScreen->scrnY,
- dmxScreen->rootWidth, dmxScreen->rootHeight,
- dmxScreen->rootX, dmxScreen->rootY,
- dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
- attr->screenWindowWidth, attr->screenWindowHeight,
- attr->screenWindowXoffset, attr->screenWindowYoffset,
- attr->rootWindowWidth, attr->rootWindowHeight,
- attr->rootWindowXoffset, attr->rootWindowYoffset,
- attr->rootWindowXorigin, attr->rootWindowYorigin);
-
- /* Configure "screen" window */
- dmxConfigureScreenWindow(idx,
- attr->screenWindowXoffset,
- attr->screenWindowYoffset,
- attr->screenWindowWidth,
- attr->screenWindowHeight);
-
- /* Configure "root" window */
- dmxConfigureRootWindow(idx,
- attr->rootWindowXoffset,
- attr->rootWindowYoffset,
- attr->rootWindowWidth,
- attr->rootWindowHeight);
-
-
- /* Set "root" window's origin */
- dmxSetRootWindowOrigin(idx,
- attr->rootWindowXorigin,
- attr->rootWindowYorigin);
+ DMXScreenAttributesPtr attr = &attribs[i];
+ int idx = screens[i];
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ dmxLog(dmxInfo, "Changing screen #%d attributes "
+ "from %dx%d+%d+%d %dx%d+%d+%d +%d+%d "
+ "to %dx%d+%d+%d %dx%d+%d+%d +%d+%d\n",
+ idx,
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+ dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
+ attr->screenWindowWidth, attr->screenWindowHeight,
+ attr->screenWindowXoffset, attr->screenWindowYoffset,
+ attr->rootWindowWidth, attr->rootWindowHeight,
+ attr->rootWindowXoffset, attr->rootWindowYoffset,
+ attr->rootWindowXorigin, attr->rootWindowYorigin);
+
+ /* Configure "screen" window */
+ dmxConfigureScreenWindow(idx,
+ attr->screenWindowXoffset,
+ attr->screenWindowYoffset,
+ attr->screenWindowWidth,
+ attr->screenWindowHeight);
+
+ /* Configure "root" window */
+ dmxConfigureRootWindow(idx,
+ attr->rootWindowXoffset,
+ attr->rootWindowYoffset,
+ attr->rootWindowWidth, attr->rootWindowHeight);
+
+ /* Set "root" window's origin */
+ dmxSetRootWindowOrigin(idx,
+ attr->rootWindowXorigin,
+ attr->rootWindowYorigin);
}
/* Adjust the cursor boundaries */
@@ -593,37 +618,46 @@ int dmxConfigureScreenWindows(int nscreens,
}
/** Configure the attributes of the global desktop. */
-int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs)
+int
+dmxConfigureDesktop(DMXDesktopAttributesPtr attribs)
{
- if (attribs->width <= 0 || attribs->width >= 32767 ||
- attribs->height <= 0 || attribs->height >= 32767)
- return DMX_BAD_VALUE;
+ if (attribs->width <= 0 || attribs->width >= 32767 ||
+ attribs->height <= 0 || attribs->height >= 32767)
+ return DMX_BAD_VALUE;
/* If the desktop is shrinking, adjust the "root" windows on each
* "screen" window to only show the visible desktop. Also, handle
* the special case where the desktop shrinks such that the it no
* longer overlaps an portion of a "screen" window. */
if (attribs->width < dmxGlobalWidth || attribs->height < dmxGlobalHeight) {
- int i;
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- if (dmxScreen->rootXOrigin
- + dmxScreen->rootWidth > attribs->width ||
- dmxScreen->rootYOrigin
- + dmxScreen->rootHeight > attribs->height) {
- int w, h;
- if ((w = attribs->width - dmxScreen->rootXOrigin) < 0) w = 0;
- if ((h = attribs->height - dmxScreen->rootYOrigin) < 0) h = 0;
- if (w > dmxScreen->scrnWidth) w = dmxScreen->scrnWidth;
- if (h > dmxScreen->scrnHeight) h = dmxScreen->scrnHeight;
- if (w > dmxScreen->rootWidth) w = dmxScreen->rootWidth;
- if (h > dmxScreen->rootHeight) h = dmxScreen->rootHeight;
- dmxConfigureRootWindow(i,
- dmxScreen->rootX,
- dmxScreen->rootY,
- w, h);
- }
- }
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->rootXOrigin
+ + dmxScreen->rootWidth > attribs->width ||
+ dmxScreen->rootYOrigin
+ + dmxScreen->rootHeight > attribs->height) {
+ int w, h;
+
+ if ((w = attribs->width - dmxScreen->rootXOrigin) < 0)
+ w = 0;
+ if ((h = attribs->height - dmxScreen->rootYOrigin) < 0)
+ h = 0;
+ if (w > dmxScreen->scrnWidth)
+ w = dmxScreen->scrnWidth;
+ if (h > dmxScreen->scrnHeight)
+ h = dmxScreen->scrnHeight;
+ if (w > dmxScreen->rootWidth)
+ w = dmxScreen->rootWidth;
+ if (h > dmxScreen->rootHeight)
+ h = dmxScreen->rootHeight;
+ dmxConfigureRootWindow(i,
+ dmxScreen->rootX,
+ dmxScreen->rootY, w, h);
+ }
+ }
}
/* Set the global width/height */
@@ -631,30 +665,30 @@ int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs)
/* Handle shift[XY] changes */
if (attribs->shiftX || attribs->shiftY) {
- int i;
- for (i = 0; i < dmxNumScreens; i++) {
- ScreenPtr pScreen = screenInfo.screens[i];
- WindowPtr pChild = pScreen->root->firstChild;
- while (pChild) {
- /* Adjust child window's position */
- pScreen->MoveWindow(pChild,
- pChild->origin.x - wBorderWidth(pChild)
- - attribs->shiftX,
- pChild->origin.y - wBorderWidth(pChild)
- - attribs->shiftY,
- pChild->nextSib,
- VTMove);
-
- /* Note that the call to MoveWindow will eventually call
- * dmxPositionWindow which will automatically create a
- * window if it is now exposed on screen (for lazy
- * window creation optimization) and it will properly
- * set the offscreen flag.
- */
-
- pChild = pChild->nextSib;
- }
- }
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ WindowPtr pChild = pScreen->root->firstChild;
+
+ while (pChild) {
+ /* Adjust child window's position */
+ pScreen->MoveWindow(pChild,
+ pChild->origin.x - wBorderWidth(pChild)
+ - attribs->shiftX,
+ pChild->origin.y - wBorderWidth(pChild)
+ - attribs->shiftY, pChild->nextSib, VTMove);
+
+ /* Note that the call to MoveWindow will eventually call
+ * dmxPositionWindow which will automatically create a
+ * window if it is now exposed on screen (for lazy
+ * window creation optimization) and it will properly
+ * set the offscreen flag.
+ */
+
+ pChild = pChild->nextSib;
+ }
+ }
}
/* Update connection block, Xinerama, etc. -- these appears to
@@ -672,14 +706,15 @@ int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs)
#endif
/** Create the scratch GCs per depth. */
-static void dmxBECreateScratchGCs(int scrnNum)
+static void
+dmxBECreateScratchGCs(int scrnNum)
{
- ScreenPtr pScreen = screenInfo.screens[scrnNum];
- GCPtr *ppGC = pScreen->GCperDepth;
- int i;
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
+ GCPtr *ppGC = pScreen->GCperDepth;
+ int i;
for (i = 0; i <= pScreen->numDepths; i++)
- dmxBECreateGC(pScreen, ppGC[i]);
+ dmxBECreateGC(pScreen, ppGC[i]);
}
#ifdef PANORAMIX
@@ -689,89 +724,92 @@ static Bool FoundPixImage;
* to have its image restored. When it is found, see if there is
* another screen with the same image. If so, copy the pixmap image
* from the existing screen to the newly created pixmap. */
-static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type,
- pointer p)
+static void
+dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, pointer p)
{
if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) {
- PixmapPtr pDst = (PixmapPtr)p;
- int idx = pDst->drawable.pScreen->myNum;
- PanoramiXRes *pXinPix = (PanoramiXRes *)value;
- PixmapPtr pPix;
- int i;
-
- dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id,
- RT_PIXMAP, NullClient, DixUnknownAccess);
- if (pPix != pDst) return; /* Not a match.... Next! */
-
- FOR_NSCREENS(i) {
- PixmapPtr pSrc;
- dmxPixPrivPtr pSrcPriv = NULL;
-
- if (i == idx) continue; /* Self replication is bad */
-
- dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
- RT_PIXMAP, NullClient, DixUnknownAccess);
- pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
- if (pSrcPriv->pixmap) {
- DMXScreenInfo *dmxSrcScreen = &dmxScreens[i];
- DMXScreenInfo *dmxDstScreen = &dmxScreens[idx];
- dmxPixPrivPtr pDstPriv = DMX_GET_PIXMAP_PRIV(pDst);
- XImage *img;
- int j;
- XlibGC gc = NULL;
-
- /* This should never happen, but just in case.... */
- if (pSrc->drawable.width != pDst->drawable.width ||
- pSrc->drawable.height != pDst->drawable.height)
- return;
-
- /* Copy from src pixmap to dst pixmap */
- img = XGetImage(dmxSrcScreen->beDisplay,
- pSrcPriv->pixmap,
- 0, 0,
- pSrc->drawable.width, pSrc->drawable.height,
- -1,
- ZPixmap);
-
- for (j = 0; j < dmxDstScreen->beNumPixmapFormats; j++) {
- if (dmxDstScreen->bePixmapFormats[j].depth == img->depth) {
- unsigned long m;
- XGCValues v;
-
- m = GCFunction | GCPlaneMask | GCClipMask;
- v.function = GXcopy;
- v.plane_mask = AllPlanes;
- v.clip_mask = None;
-
- gc = XCreateGC(dmxDstScreen->beDisplay,
- dmxDstScreen->scrnDefDrawables[j],
- m, &v);
- break;
- }
- }
-
- if (gc) {
- XPutImage(dmxDstScreen->beDisplay,
- pDstPriv->pixmap,
- gc, img, 0, 0, 0, 0,
- pDst->drawable.width, pDst->drawable.height);
- XFreeGC(dmxDstScreen->beDisplay, gc);
- FoundPixImage = True;
- } else {
- dmxLog(dmxWarning, "Could not create GC\n");
- }
-
- XDestroyImage(img);
- return;
- }
- }
+ PixmapPtr pDst = (PixmapPtr) p;
+ int idx = pDst->drawable.pScreen->myNum;
+ PanoramiXRes *pXinPix = (PanoramiXRes *) value;
+ PixmapPtr pPix;
+ int i;
+
+ dixLookupResourceByType((pointer *) &pPix, pXinPix->info[idx].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
+ if (pPix != pDst)
+ return; /* Not a match.... Next! */
+
+ FOR_NSCREENS(i) {
+ PixmapPtr pSrc;
+ dmxPixPrivPtr pSrcPriv = NULL;
+
+ if (i == idx)
+ continue; /* Self replication is bad */
+
+ dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
+ pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
+ if (pSrcPriv->pixmap) {
+ DMXScreenInfo *dmxSrcScreen = &dmxScreens[i];
+ DMXScreenInfo *dmxDstScreen = &dmxScreens[idx];
+ dmxPixPrivPtr pDstPriv = DMX_GET_PIXMAP_PRIV(pDst);
+ XImage *img;
+ int j;
+ XlibGC gc = NULL;
+
+ /* This should never happen, but just in case.... */
+ if (pSrc->drawable.width != pDst->drawable.width ||
+ pSrc->drawable.height != pDst->drawable.height)
+ return;
+
+ /* Copy from src pixmap to dst pixmap */
+ img = XGetImage(dmxSrcScreen->beDisplay,
+ pSrcPriv->pixmap,
+ 0, 0,
+ pSrc->drawable.width, pSrc->drawable.height,
+ -1, ZPixmap);
+
+ for (j = 0; j < dmxDstScreen->beNumPixmapFormats; j++) {
+ if (dmxDstScreen->bePixmapFormats[j].depth == img->depth) {
+ unsigned long m;
+ XGCValues v;
+
+ m = GCFunction | GCPlaneMask | GCClipMask;
+ v.function = GXcopy;
+ v.plane_mask = AllPlanes;
+ v.clip_mask = None;
+
+ gc = XCreateGC(dmxDstScreen->beDisplay,
+ dmxDstScreen->scrnDefDrawables[j],
+ m, &v);
+ break;
+ }
+ }
+
+ if (gc) {
+ XPutImage(dmxDstScreen->beDisplay,
+ pDstPriv->pixmap,
+ gc, img, 0, 0, 0, 0,
+ pDst->drawable.width, pDst->drawable.height);
+ XFreeGC(dmxDstScreen->beDisplay, gc);
+ FoundPixImage = True;
+ }
+ else {
+ dmxLog(dmxWarning, "Could not create GC\n");
+ }
+
+ XDestroyImage(img);
+ return;
+ }
+ }
}
}
#endif
/** Restore the pixmap image either from another screen or from an image
* that was saved when the screen was previously detached. */
-static void dmxBERestorePixmap(PixmapPtr pPixmap)
+static void
+dmxBERestorePixmap(PixmapPtr pPixmap)
{
#ifdef PANORAMIX
int i;
@@ -779,62 +817,63 @@ static void dmxBERestorePixmap(PixmapPtr pPixmap)
/* If Xinerama is not active, there's nothing we can do (see comment
* in #else below for more info). */
if (noPanoramiXExtension) {
- dmxLog(dmxWarning, "Cannot restore pixmap image\n");
- return;
+ dmxLog(dmxWarning, "Cannot restore pixmap image\n");
+ return;
}
FoundPixImage = False;
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindAllClientResources(clients[i], dmxBERestorePixmapImage,
- (pointer)pPixmap);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBERestorePixmapImage,
+ (pointer) pPixmap);
/* No corresponding pixmap image was found on other screens, so we
* need to copy it from the saved image when the screen was detached
* (if available). */
if (!FoundPixImage) {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
-
- if (pPixPriv->detachedImage) {
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- XlibGC gc = NULL;
-
- for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- if (dmxScreen->bePixmapFormats[i].depth ==
- pPixPriv->detachedImage->depth) {
- unsigned long m;
- XGCValues v;
-
- m = GCFunction | GCPlaneMask | GCClipMask;
- v.function = GXcopy;
- v.plane_mask = AllPlanes;
- v.clip_mask = None;
-
- gc = XCreateGC(dmxScreen->beDisplay,
- dmxScreen->scrnDefDrawables[i],
- m, &v);
- break;
- }
- }
-
- if (gc) {
- XPutImage(dmxScreen->beDisplay,
- pPixPriv->pixmap,
- gc,
- pPixPriv->detachedImage,
- 0, 0, 0, 0,
- pPixmap->drawable.width, pPixmap->drawable.height);
- XFreeGC(dmxScreen->beDisplay, gc);
- } else {
- dmxLog(dmxWarning, "Cannot restore pixmap image\n");
- }
-
- XDestroyImage(pPixPriv->detachedImage);
- pPixPriv->detachedImage = NULL;
- } else {
- dmxLog(dmxWarning, "Cannot restore pixmap image\n");
- }
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (pPixPriv->detachedImage) {
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ XlibGC gc = NULL;
+
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ if (dmxScreen->bePixmapFormats[i].depth ==
+ pPixPriv->detachedImage->depth) {
+ unsigned long m;
+ XGCValues v;
+
+ m = GCFunction | GCPlaneMask | GCClipMask;
+ v.function = GXcopy;
+ v.plane_mask = AllPlanes;
+ v.clip_mask = None;
+
+ gc = XCreateGC(dmxScreen->beDisplay,
+ dmxScreen->scrnDefDrawables[i], m, &v);
+ break;
+ }
+ }
+
+ if (gc) {
+ XPutImage(dmxScreen->beDisplay,
+ pPixPriv->pixmap,
+ gc,
+ pPixPriv->detachedImage,
+ 0, 0, 0, 0,
+ pPixmap->drawable.width, pPixmap->drawable.height);
+ XFreeGC(dmxScreen->beDisplay, gc);
+ }
+ else {
+ dmxLog(dmxWarning, "Cannot restore pixmap image\n");
+ }
+
+ XDestroyImage(pPixPriv->detachedImage);
+ pPixPriv->detachedImage = NULL;
+ }
+ else {
+ dmxLog(dmxWarning, "Cannot restore pixmap image\n");
+ }
}
#else
/* If Xinerama is not enabled, then there is no other copy of the
@@ -852,57 +891,68 @@ static void dmxBERestorePixmap(PixmapPtr pPixmap)
* function. It walks all resources, compares them to the screen
* number passed in as \a n and calls the appropriate DMX function to
* create the associated resource on the back-end server. */
-static void dmxBECreateResources(pointer value, XID id, RESTYPE type,
- pointer n)
+static void
+dmxBECreateResources(pointer value, XID id, RESTYPE type, pointer n)
{
- int scrnNum = (uintptr_t)n;
- ScreenPtr pScreen = screenInfo.screens[scrnNum];
+ int scrnNum = (uintptr_t) n;
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
if ((type & TypeMask) == (RT_WINDOW & TypeMask)) {
- /* Window resources are created below in dmxBECreateWindowTree */
- } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) {
- PixmapPtr pPix = value;
- if (pPix->drawable.pScreen->myNum == scrnNum) {
- dmxBECreatePixmap(pPix);
- dmxBERestorePixmap(pPix);
- }
- } else if ((type & TypeMask) == (RT_GC & TypeMask)) {
- GCPtr pGC = value;
- if (pGC->pScreen->myNum == scrnNum) {
- /* Create the GC on the back-end server */
- dmxBECreateGC(pScreen, pGC);
- /* Create any pixmaps associated with this GC */
- if (!pGC->tileIsPixel) {
- dmxBECreatePixmap(pGC->tile.pixmap);
- dmxBERestorePixmap(pGC->tile.pixmap);
- }
- if (pGC->stipple != pScreen->PixmapPerDepth[0]) {
- dmxBECreatePixmap(pGC->stipple);
- dmxBERestorePixmap(pGC->stipple);
- }
- if (pGC->font != defaultFont) {
- (void)dmxBELoadFont(pScreen, pGC->font);
- }
- /* Update the GC on the back-end server */
- dmxChangeGC(pGC, -1L);
- }
- } else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
- (void)dmxBELoadFont(pScreen, (FontPtr)value);
- } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
- dmxBECreateCursor(pScreen, (CursorPtr)value);
- } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
- ColormapPtr pCmap = value;
- if (pCmap->pScreen->myNum == scrnNum)
- (void)dmxBECreateColormap((ColormapPtr)value);
+ /* Window resources are created below in dmxBECreateWindowTree */
+ }
+ else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) {
+ PixmapPtr pPix = value;
+
+ if (pPix->drawable.pScreen->myNum == scrnNum) {
+ dmxBECreatePixmap(pPix);
+ dmxBERestorePixmap(pPix);
+ }
+ }
+ else if ((type & TypeMask) == (RT_GC & TypeMask)) {
+ GCPtr pGC = value;
+
+ if (pGC->pScreen->myNum == scrnNum) {
+ /* Create the GC on the back-end server */
+ dmxBECreateGC(pScreen, pGC);
+ /* Create any pixmaps associated with this GC */
+ if (!pGC->tileIsPixel) {
+ dmxBECreatePixmap(pGC->tile.pixmap);
+ dmxBERestorePixmap(pGC->tile.pixmap);
+ }
+ if (pGC->stipple != pScreen->PixmapPerDepth[0]) {
+ dmxBECreatePixmap(pGC->stipple);
+ dmxBERestorePixmap(pGC->stipple);
+ }
+ if (pGC->font != defaultFont) {
+ (void) dmxBELoadFont(pScreen, pGC->font);
+ }
+ /* Update the GC on the back-end server */
+ dmxChangeGC(pGC, -1L);
+ }
+ }
+ else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
+ (void) dmxBELoadFont(pScreen, (FontPtr) value);
+ }
+ else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
+ dmxBECreateCursor(pScreen, (CursorPtr) value);
+ }
+ else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
+ ColormapPtr pCmap = value;
+
+ if (pCmap->pScreen->myNum == scrnNum)
+ (void) dmxBECreateColormap((ColormapPtr) value);
#if 0
- /* TODO: Recreate Picture and GlyphSet resources */
- } else if ((type & TypeMask) == (PictureType & TypeMask)) {
- /* Picture resources are created when windows are created */
- } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
- dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
+ /* TODO: Recreate Picture and GlyphSet resources */
+ }
+ else if ((type & TypeMask) == (PictureType & TypeMask)) {
+ /* Picture resources are created when windows are created */
+ }
+ else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
+ dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr) value);
#endif
- } else {
- /* Other resource types??? */
+ }
+ else {
+ /* Other resource types??? */
}
}
@@ -912,21 +962,22 @@ static void dmxBECreateResources(pointer value, XID id, RESTYPE type,
* itself to create each window's parents. This is required so that we
* have the opportunity to create each window's border and background
* pixmaps (where appropriate) before the window is created. */
-static void dmxBECreateWindowTree(int idx)
+static void
+dmxBECreateWindowTree(int idx)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- WindowPtr pRoot = screenInfo.screens[idx]->root;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot);
- WindowPtr pWin;
+ WindowPtr pRoot = screenInfo.screens[idx]->root;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot);
+ WindowPtr pWin;
/* Create the pixmaps associated with the root window */
if (!pRoot->borderIsPixel) {
- dmxBECreatePixmap(pRoot->border.pixmap);
- dmxBERestorePixmap(pRoot->border.pixmap);
+ dmxBECreatePixmap(pRoot->border.pixmap);
+ dmxBERestorePixmap(pRoot->border.pixmap);
}
if (pRoot->backgroundState == BackgroundPixmap) {
- dmxBECreatePixmap(pRoot->background.pixmap);
- dmxBERestorePixmap(pRoot->background.pixmap);
+ dmxBECreatePixmap(pRoot->background.pixmap);
+ dmxBERestorePixmap(pRoot->background.pixmap);
}
/* Create root window first */
@@ -935,175 +986,188 @@ static void dmxBECreateWindowTree(int idx)
pWin = pRoot->lastChild;
while (pWin) {
- pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
-
- /* Create the pixmaps regardless of whether or not the
- * window is created or not due to lazy window creation.
- */
- if (!pWin->borderIsPixel) {
- dmxBECreatePixmap(pWin->border.pixmap);
- dmxBERestorePixmap(pWin->border.pixmap);
- }
- if (pWin->backgroundState == BackgroundPixmap) {
- dmxBECreatePixmap(pWin->background.pixmap);
- dmxBERestorePixmap(pWin->background.pixmap);
- }
-
- /* Reset the window attributes */
- dmxGetDefaultWindowAttributes(pWin,
- &pWinPriv->cmap,
- &pWinPriv->visual);
-
- /* Create the window */
- if (pWinPriv->mapped && !pWinPriv->offscreen)
- dmxCreateAndRealizeWindow(pWin, TRUE);
-
- /* Next, create the bottom-most child */
- if (pWin->lastChild) {
- pWin = pWin->lastChild;
- continue;
- }
-
- /* If the window has no children, move on to the next higher window */
- while (!pWin->prevSib && (pWin != pRoot))
- pWin = pWin->parent;
-
- if (pWin->prevSib) {
- pWin = pWin->prevSib;
- continue;
- }
-
- /* When we reach the root window, we are finished */
- if (pWin == pRoot)
- break;
+ pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+
+ /* Create the pixmaps regardless of whether or not the
+ * window is created or not due to lazy window creation.
+ */
+ if (!pWin->borderIsPixel) {
+ dmxBECreatePixmap(pWin->border.pixmap);
+ dmxBERestorePixmap(pWin->border.pixmap);
+ }
+ if (pWin->backgroundState == BackgroundPixmap) {
+ dmxBECreatePixmap(pWin->background.pixmap);
+ dmxBERestorePixmap(pWin->background.pixmap);
+ }
+
+ /* Reset the window attributes */
+ dmxGetDefaultWindowAttributes(pWin, &pWinPriv->cmap, &pWinPriv->visual);
+
+ /* Create the window */
+ if (pWinPriv->mapped && !pWinPriv->offscreen)
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+
+ /* Next, create the bottom-most child */
+ if (pWin->lastChild) {
+ pWin = pWin->lastChild;
+ continue;
+ }
+
+ /* If the window has no children, move on to the next higher window */
+ while (!pWin->prevSib && (pWin != pRoot))
+ pWin = pWin->parent;
+
+ if (pWin->prevSib) {
+ pWin = pWin->prevSib;
+ continue;
+ }
+
+ /* When we reach the root window, we are finished */
+ if (pWin == pRoot)
+ break;
}
}
/* Refresh screen by generating exposure events for all windows */
-static void dmxForceExposures(int idx)
+static void
+dmxForceExposures(int idx)
{
- ScreenPtr pScreen = screenInfo.screens[idx];
- WindowPtr pRoot = pScreen->root;
- Bool anyMarked = FALSE;
- WindowPtr pChild;
+ ScreenPtr pScreen = screenInfo.screens[idx];
+ WindowPtr pRoot = pScreen->root;
+ Bool anyMarked = FALSE;
+ WindowPtr pChild;
for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib)
- anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild,
- (WindowPtr *)NULL);
+ anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild,
+ (WindowPtr *) NULL);
if (anyMarked) {
- /* If any windows have been marked, set the root window's
- * clipList to be broken since it will be recalculated in
- * ValidateTree()
- */
- RegionBreak(&pRoot->clipList);
- pScreen->ValidateTree(pRoot, NULL, VTBroken);
- pScreen->HandleExposures(pRoot);
- if (pScreen->PostValidateTree)
- pScreen->PostValidateTree(pRoot, NULL, VTBroken);
+ /* If any windows have been marked, set the root window's
+ * clipList to be broken since it will be recalculated in
+ * ValidateTree()
+ */
+ RegionBreak(&pRoot->clipList);
+ pScreen->ValidateTree(pRoot, NULL, VTBroken);
+ pScreen->HandleExposures(pRoot);
+ if (pScreen->PostValidateTree)
+ pScreen->PostValidateTree(pRoot, NULL, VTBroken);
}
}
/** Compare the new and old screens to see if they are compatible. */
-static Bool dmxCompareScreens(DMXScreenInfo *new, DMXScreenInfo *old)
+static Bool
+dmxCompareScreens(DMXScreenInfo * new, DMXScreenInfo * old)
{
int i;
- if (new->beWidth != old->beWidth) return FALSE;
- if (new->beHeight != old->beHeight) return FALSE;
- if (new->beDepth != old->beDepth) return FALSE;
- if (new->beBPP != old->beBPP) return FALSE;
-
- if (new->beNumDepths != old->beNumDepths) return FALSE;
+ if (new->beWidth != old->beWidth)
+ return FALSE;
+ if (new->beHeight != old->beHeight)
+ return FALSE;
+ if (new->beDepth != old->beDepth)
+ return FALSE;
+ if (new->beBPP != old->beBPP)
+ return FALSE;
+
+ if (new->beNumDepths != old->beNumDepths)
+ return FALSE;
for (i = 0; i < old->beNumDepths; i++)
- if (new->beDepths[i] != old->beDepths[i]) return FALSE;
+ if (new->beDepths[i] != old->beDepths[i])
+ return FALSE;
- if (new->beNumPixmapFormats != old->beNumPixmapFormats) return FALSE;
+ if (new->beNumPixmapFormats != old->beNumPixmapFormats)
+ return FALSE;
for (i = 0; i < old->beNumPixmapFormats; i++) {
- if (new->bePixmapFormats[i].depth !=
- old->bePixmapFormats[i].depth) return FALSE;
- if (new->bePixmapFormats[i].bits_per_pixel !=
- old->bePixmapFormats[i].bits_per_pixel) return FALSE;
- if (new->bePixmapFormats[i].scanline_pad !=
- old->bePixmapFormats[i].scanline_pad) return FALSE;
+ if (new->bePixmapFormats[i].depth != old->bePixmapFormats[i].depth)
+ return FALSE;
+ if (new->bePixmapFormats[i].bits_per_pixel !=
+ old->bePixmapFormats[i].bits_per_pixel)
+ return FALSE;
+ if (new->bePixmapFormats[i].scanline_pad !=
+ old->bePixmapFormats[i].scanline_pad)
+ return FALSE;
}
- if (new->beNumVisuals != old->beNumVisuals) return FALSE;
+ if (new->beNumVisuals != old->beNumVisuals)
+ return FALSE;
for (i = 0; i < old->beNumVisuals; i++) {
- if (new->beVisuals[i].visualid !=
- old->beVisuals[i].visualid) return FALSE;
- if (new->beVisuals[i].screen !=
- old->beVisuals[i].screen) return FALSE;
- if (new->beVisuals[i].depth !=
- old->beVisuals[i].depth) return FALSE;
- if (new->beVisuals[i].class !=
- old->beVisuals[i].class) return FALSE;
- if (new->beVisuals[i].red_mask !=
- old->beVisuals[i].red_mask) return FALSE;
- if (new->beVisuals[i].green_mask !=
- old->beVisuals[i].green_mask) return FALSE;
- if (new->beVisuals[i].blue_mask !=
- old->beVisuals[i].blue_mask) return FALSE;
- if (new->beVisuals[i].colormap_size !=
- old->beVisuals[i].colormap_size) return FALSE;
- if (new->beVisuals[i].bits_per_rgb !=
- old->beVisuals[i].bits_per_rgb) return FALSE;
- }
-
- if (new->beDefVisualIndex != old->beDefVisualIndex) return FALSE;
+ if (new->beVisuals[i].visualid != old->beVisuals[i].visualid)
+ return FALSE;
+ if (new->beVisuals[i].screen != old->beVisuals[i].screen)
+ return FALSE;
+ if (new->beVisuals[i].depth != old->beVisuals[i].depth)
+ return FALSE;
+ if (new->beVisuals[i].class != old->beVisuals[i].class)
+ return FALSE;
+ if (new->beVisuals[i].red_mask != old->beVisuals[i].red_mask)
+ return FALSE;
+ if (new->beVisuals[i].green_mask != old->beVisuals[i].green_mask)
+ return FALSE;
+ if (new->beVisuals[i].blue_mask != old->beVisuals[i].blue_mask)
+ return FALSE;
+ if (new->beVisuals[i].colormap_size != old->beVisuals[i].colormap_size)
+ return FALSE;
+ if (new->beVisuals[i].bits_per_rgb != old->beVisuals[i].bits_per_rgb)
+ return FALSE;
+ }
+
+ if (new->beDefVisualIndex != old->beDefVisualIndex)
+ return FALSE;
return TRUE;
}
/** Restore Render's picture */
-static void dmxBERestoreRenderPict(pointer value, XID id, pointer n)
+static void
+dmxBERestoreRenderPict(pointer value, XID id, pointer n)
{
- PicturePtr pPicture = value; /* The picture */
- DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */
- int scrnNum = (uintptr_t)n;
+ PicturePtr pPicture = value; /* The picture */
+ DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */
+ int scrnNum = (uintptr_t) n;
if (pDraw->pScreen->myNum != scrnNum) {
- /* Picture not on the screen we are restoring*/
- return;
+ /* Picture not on the screen we are restoring */
+ return;
}
if (pDraw->type == DRAWABLE_PIXMAP) {
- PixmapPtr pPixmap = (PixmapPtr)pDraw;
-
- /* Create and restore the pixmap drawable */
- dmxBECreatePixmap(pPixmap);
- dmxBERestorePixmap(pPixmap);
+ PixmapPtr pPixmap = (PixmapPtr) pDraw;
+
+ /* Create and restore the pixmap drawable */
+ dmxBECreatePixmap(pPixmap);
+ dmxBERestorePixmap(pPixmap);
}
dmxBECreatePicture(pPicture);
}
/** Restore Render's glyphs */
-static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
+static void
+dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
{
- GlyphSetPtr glyphSet = value;
- int scrnNum = (uintptr_t)n;
- dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum];
- GlyphRefPtr table;
- char *images;
- Glyph *gids;
- XGlyphInfo *glyphs;
- char *pos;
- int beret;
- int len_images = 0;
- int i;
- int ctr;
+ GlyphSetPtr glyphSet = value;
+ int scrnNum = (uintptr_t) n;
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum];
+ GlyphRefPtr table;
+ char *images;
+ Glyph *gids;
+ XGlyphInfo *glyphs;
+ char *pos;
+ int beret;
+ int len_images = 0;
+ int i;
+ int ctr;
if (glyphPriv->glyphSets[scrnNum]) {
- /* Only restore glyphs on the screen we are attaching */
- return;
+ /* Only restore glyphs on the screen we are attaching */
+ return;
}
/* First we must create the glyph set on the backend. */
if ((beret = dmxBECreateGlyphSet(scrnNum, glyphSet)) != Success) {
- dmxLog(dmxWarning,
- "\tdmxBERestoreRenderGlyph failed to create glyphset!\n");
- return;
+ dmxLog(dmxWarning,
+ "\tdmxBERestoreRenderGlyph failed to create glyphset!\n");
+ return;
}
/* Now for the complex part, restore the glyph data */
@@ -1111,89 +1175,92 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
/* We need to know how much memory to allocate for this part */
for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
- GlyphRefPtr gr = &table[i];
- GlyphPtr gl = gr->glyph;
+ GlyphRefPtr gr = &table[i];
+ GlyphPtr gl = gr->glyph;
- if (!gl || gl == DeletedGlyph) continue;
- len_images += gl->size - sizeof(gl->info);
+ if (!gl || gl == DeletedGlyph)
+ continue;
+ len_images += gl->size - sizeof(gl->info);
}
/* Now allocate the memory we need */
images = calloc(len_images, sizeof(char));
- gids = malloc(glyphSet->hash.tableEntries*sizeof(Glyph));
- glyphs = malloc(glyphSet->hash.tableEntries*sizeof(XGlyphInfo));
+ gids = malloc(glyphSet->hash.tableEntries * sizeof(Glyph));
+ glyphs = malloc(glyphSet->hash.tableEntries * sizeof(XGlyphInfo));
pos = images;
ctr = 0;
-
+
/* Fill the allocated memory with the proper data */
for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
- GlyphRefPtr gr = &table[i];
- GlyphPtr gl = gr->glyph;
-
- if (!gl || gl == DeletedGlyph) continue;
-
- /* First lets put the data into gids */
- gids[ctr] = gr->signature;
-
- /* Next do the glyphs data structures */
- glyphs[ctr].width = gl->info.width;
- glyphs[ctr].height = gl->info.height;
- glyphs[ctr].x = gl->info.x;
- glyphs[ctr].y = gl->info.y;
- glyphs[ctr].xOff = gl->info.xOff;
- glyphs[ctr].yOff = gl->info.yOff;
-
- /* Copy the images from the DIX's data into the buffer */
- memcpy(pos, gl+1, gl->size - sizeof(gl->info));
- pos += gl->size - sizeof(gl->info);
- ctr++;
+ GlyphRefPtr gr = &table[i];
+ GlyphPtr gl = gr->glyph;
+
+ if (!gl || gl == DeletedGlyph)
+ continue;
+
+ /* First lets put the data into gids */
+ gids[ctr] = gr->signature;
+
+ /* Next do the glyphs data structures */
+ glyphs[ctr].width = gl->info.width;
+ glyphs[ctr].height = gl->info.height;
+ glyphs[ctr].x = gl->info.x;
+ glyphs[ctr].y = gl->info.y;
+ glyphs[ctr].xOff = gl->info.xOff;
+ glyphs[ctr].yOff = gl->info.yOff;
+
+ /* Copy the images from the DIX's data into the buffer */
+ memcpy(pos, gl + 1, gl->size - sizeof(gl->info));
+ pos += gl->size - sizeof(gl->info);
+ ctr++;
}
-
+
/* Now restore the glyph data */
XRenderAddGlyphs(dmxScreen->beDisplay, glyphPriv->glyphSets[scrnNum],
- gids,glyphs, glyphSet->hash.tableEntries, images,
- len_images);
+ gids, glyphs, glyphSet->hash.tableEntries, images,
+ len_images);
/* Clean up */
free(images);
free(gids);
- free(glyphs);
+ free(glyphs);
}
/** Reattach previously detached back-end screen. */
-int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
+int
+dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
{
- ScreenPtr pScreen;
+ ScreenPtr pScreen;
DMXScreenInfo *dmxScreen;
- CARD32 scrnNum = idx;
- DMXScreenInfo oldDMXScreen;
- int i;
+ CARD32 scrnNum = idx;
+ DMXScreenInfo oldDMXScreen;
+ int i;
/* Return failure if dynamic addition/removal of screens is disabled */
if (!dmxAddRemoveScreens) {
- dmxLog(dmxWarning,
- "Attempting to add a screen, but the AddRemoveScreen\n");
- dmxLog(dmxWarning,
- "extension has not been enabled. To enable this extension\n");
- dmxLog(dmxWarning,
- "add the \"-addremovescreens\" option either to the command\n");
- dmxLog(dmxWarning,
- "line or in the configuration file.\n");
- return 1;
+ dmxLog(dmxWarning,
+ "Attempting to add a screen, but the AddRemoveScreen\n");
+ dmxLog(dmxWarning,
+ "extension has not been enabled. To enable this extension\n");
+ dmxLog(dmxWarning,
+ "add the \"-addremovescreens\" option either to the command\n");
+ dmxLog(dmxWarning, "line or in the configuration file.\n");
+ return 1;
}
/* Cannot add a screen that does not exist */
- if (idx < 0 || idx >= dmxNumScreens) return 1;
+ if (idx < 0 || idx >= dmxNumScreens)
+ return 1;
pScreen = screenInfo.screens[idx];
dmxScreen = &dmxScreens[idx];
/* Cannot attach to a screen that is already opened */
if (dmxScreen->beDisplay) {
- dmxLog(dmxWarning,
- "Attempting to add screen #%d but a screen already exists\n",
- idx);
- return 1;
+ dmxLog(dmxWarning,
+ "Attempting to add screen #%d but a screen already exists\n",
+ idx);
+ return 1;
}
dmxLogOutput(dmxScreen, "Attaching screen #%d\n", idx);
@@ -1206,13 +1273,12 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
/* Open display and get all of the screen info */
if (!dmxOpenDisplay(dmxScreen)) {
- dmxLog(dmxWarning,
- "dmxOpenDisplay: Unable to open display %s\n",
- dmxScreen->name);
+ dmxLog(dmxWarning,
+ "dmxOpenDisplay: Unable to open display %s\n", dmxScreen->name);
- /* Restore the old screen */
- *dmxScreen = oldDMXScreen;
- return 1;
+ /* Restore the old screen */
+ *dmxScreen = oldDMXScreen;
+ return 1;
}
dmxSetErrorHandler(dmxScreen);
@@ -1220,13 +1286,13 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
dmxGetScreenAttribs(dmxScreen);
if (!dmxGetVisualInfo(dmxScreen)) {
- dmxLog(dmxWarning, "dmxGetVisualInfo: No matching visuals found\n");
- XFree(dmxScreen->beVisuals);
- XCloseDisplay(dmxScreen->beDisplay);
+ dmxLog(dmxWarning, "dmxGetVisualInfo: No matching visuals found\n");
+ XFree(dmxScreen->beVisuals);
+ XCloseDisplay(dmxScreen->beDisplay);
- /* Restore the old screen */
- *dmxScreen = oldDMXScreen;
- return 1;
+ /* Restore the old screen */
+ *dmxScreen = oldDMXScreen;
+ return 1;
}
dmxGetColormaps(dmxScreen);
@@ -1235,23 +1301,20 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
/* Verify that the screen to be added has the same info as the
* previously added screen. */
if (!dmxCompareScreens(dmxScreen, &oldDMXScreen)) {
- dmxLog(dmxWarning,
- "New screen data (%s) does not match previously\n",
- dmxScreen->name);
- dmxLog(dmxWarning,
- "attached screen data (%s)\n",
- oldDMXScreen.name);
- dmxLog(dmxWarning,
- "All data must match in order to attach to screen #%d\n",
- idx);
- XFree(dmxScreen->beVisuals);
- XFree(dmxScreen->beDepths);
- XFree(dmxScreen->bePixmapFormats);
- XCloseDisplay(dmxScreen->beDisplay);
-
- /* Restore the old screen */
- *dmxScreen = oldDMXScreen;
- return 1;
+ dmxLog(dmxWarning,
+ "New screen data (%s) does not match previously\n",
+ dmxScreen->name);
+ dmxLog(dmxWarning, "attached screen data (%s)\n", oldDMXScreen.name);
+ dmxLog(dmxWarning,
+ "All data must match in order to attach to screen #%d\n", idx);
+ XFree(dmxScreen->beVisuals);
+ XFree(dmxScreen->beDepths);
+ XFree(dmxScreen->bePixmapFormats);
+ XCloseDisplay(dmxScreen->beDisplay);
+
+ /* Restore the old screen */
+ *dmxScreen = oldDMXScreen;
+ return 1;
}
/* Initialize the BE screen resources */
@@ -1268,30 +1331,30 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
dmxBECreateScratchGCs(idx);
/* Create the default font */
- (void)dmxBELoadFont(pScreen, defaultFont);
+ (void) dmxBELoadFont(pScreen, defaultFont);
/* Create all resources that don't depend on windows */
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindAllClientResources(clients[i], dmxBECreateResources,
- (pointer)(uintptr_t)idx);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBECreateResources,
+ (pointer) (uintptr_t) idx);
/* Create window hierarchy (top down) */
dmxBECreateWindowTree(idx);
/* Restore the picture state for RENDER */
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindClientResourcesByType(clients[i],PictureType,
- dmxBERestoreRenderPict,
- (pointer)(uintptr_t)idx);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindClientResourcesByType(clients[i], PictureType,
+ dmxBERestoreRenderPict,
+ (pointer) (uintptr_t) idx);
/* Restore the glyph state for RENDER */
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindClientResourcesByType(clients[i],GlyphSetType,
- dmxBERestoreRenderGlyph,
- (pointer)(uintptr_t)idx);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindClientResourcesByType(clients[i], GlyphSetType,
+ dmxBERestoreRenderGlyph,
+ (pointer) (uintptr_t) idx);
/* Refresh screen by generating exposure events for all windows */
dmxForceExposures(idx);
@@ -1308,10 +1371,10 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
#ifdef PANORAMIX
if (!noPanoramiXExtension)
- return dmxConfigureScreenWindows(1, &scrnNum, attr, NULL);
+ return dmxConfigureScreenWindows(1, &scrnNum, attr, NULL);
else
#endif
- return 0; /* Success */
+ return 0; /* Success */
}
/*
@@ -1358,34 +1421,36 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
#ifdef PANORAMIX
/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs
* to have its image saved. */
-static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type,
- pointer p)
+static void
+dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, pointer p)
{
if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) {
- PixmapPtr pDst = (PixmapPtr)p;
- int idx = pDst->drawable.pScreen->myNum;
- PanoramiXRes *pXinPix = (PanoramiXRes *)value;
- PixmapPtr pPix;
- int i;
-
- dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id,
- RT_PIXMAP, NullClient, DixUnknownAccess);
- if (pPix != pDst) return; /* Not a match.... Next! */
-
- FOR_NSCREENS(i) {
- PixmapPtr pSrc;
- dmxPixPrivPtr pSrcPriv = NULL;
-
- if (i == idx) continue; /* Self replication is bad */
-
- dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
- RT_PIXMAP, NullClient, DixUnknownAccess);
- pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
- if (pSrcPriv->pixmap) {
- FoundPixImage = True;
- return;
- }
- }
+ PixmapPtr pDst = (PixmapPtr) p;
+ int idx = pDst->drawable.pScreen->myNum;
+ PanoramiXRes *pXinPix = (PanoramiXRes *) value;
+ PixmapPtr pPix;
+ int i;
+
+ dixLookupResourceByType((pointer *) &pPix, pXinPix->info[idx].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
+ if (pPix != pDst)
+ return; /* Not a match.... Next! */
+
+ FOR_NSCREENS(i) {
+ PixmapPtr pSrc;
+ dmxPixPrivPtr pSrcPriv = NULL;
+
+ if (i == idx)
+ continue; /* Self replication is bad */
+
+ dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
+ pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
+ if (pSrcPriv->pixmap) {
+ FoundPixImage = True;
+ return;
+ }
+ }
}
}
#endif
@@ -1399,40 +1464,41 @@ static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type,
* However, if we do not find one, then we need to save the image data.
* The common case for these are for the default stipple and root
* tile. */
-static void dmxBESavePixmap(PixmapPtr pPixmap)
+static void
+dmxBESavePixmap(PixmapPtr pPixmap)
{
#ifdef PANORAMIX
int i;
/* If Xinerama is not active, there's nothing we can do (see comment
* in #else below for more info). */
- if (noPanoramiXExtension) return;
+ if (noPanoramiXExtension)
+ return;
FoundPixImage = False;
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindAllClientResources(clients[i], dmxBEFindPixmapImage,
- (pointer)pPixmap);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBEFindPixmapImage,
+ (pointer) pPixmap);
/* Save the image only if there is no other screens that have a
* pixmap that corresponds to the one we are trying to save. */
if (!FoundPixImage) {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
-
- if (!pPixPriv->detachedImage) {
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
- pPixPriv->detachedImage = XGetImage(dmxScreen->beDisplay,
- pPixPriv->pixmap,
- 0, 0,
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- -1,
- ZPixmap);
- if (!pPixPriv->detachedImage)
- dmxLog(dmxWarning, "Cannot save pixmap image\n");
- }
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (!pPixPriv->detachedImage) {
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ pPixPriv->detachedImage = XGetImage(dmxScreen->beDisplay,
+ pPixPriv->pixmap,
+ 0, 0,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height,
+ -1, ZPixmap);
+ if (!pPixPriv->detachedImage)
+ dmxLog(dmxWarning, "Cannot save pixmap image\n");
+ }
}
#else
/* NOTE: The only time there is a pixmap on another screen that
@@ -1452,59 +1518,73 @@ static void dmxBESavePixmap(PixmapPtr pPixmap)
* function. It walks all resources, compares them to the screen
* number passed in as \a n and calls the appropriate DMX function to
* free the associated resource on the back-end server. */
-static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type,
- pointer n)
+static void
+dmxBEDestroyResources(pointer value, XID id, RESTYPE type, pointer n)
{
- int scrnNum = (uintptr_t)n;
- ScreenPtr pScreen = screenInfo.screens[scrnNum];
+ int scrnNum = (uintptr_t) n;
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
if ((type & TypeMask) == (RT_WINDOW & TypeMask)) {
- /* Window resources are destroyed below in dmxBEDestroyWindowTree */
- } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) {
- PixmapPtr pPix = value;
- if (pPix->drawable.pScreen->myNum == scrnNum) {
- dmxBESavePixmap(pPix);
- dmxBEFreePixmap(pPix);
- }
- } else if ((type & TypeMask) == (RT_GC & TypeMask)) {
- GCPtr pGC = value;
- if (pGC->pScreen->myNum == scrnNum)
- dmxBEFreeGC(pGC);
- } else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
- dmxBEFreeFont(pScreen, (FontPtr)value);
- } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
- dmxBEFreeCursor(pScreen, (CursorPtr)value);
- } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
- ColormapPtr pCmap = value;
- if (pCmap->pScreen->myNum == scrnNum)
- dmxBEFreeColormap((ColormapPtr)value);
- } else if ((type & TypeMask) == (PictureType & TypeMask)) {
- PicturePtr pPict = value;
- if (pPict->pDrawable->pScreen->myNum == scrnNum) {
- /* Free the pixmaps on the backend if needed */
- if (pPict->pDrawable->type == DRAWABLE_PIXMAP) {
- PixmapPtr pPixmap = (PixmapPtr)(pPict->pDrawable);
- dmxBESavePixmap(pPixmap);
- dmxBEFreePixmap(pPixmap);
- }
- dmxBEFreePicture((PicturePtr)value);
- }
- } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
- dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
- } else {
- /* Other resource types??? */
+ /* Window resources are destroyed below in dmxBEDestroyWindowTree */
+ }
+ else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) {
+ PixmapPtr pPix = value;
+
+ if (pPix->drawable.pScreen->myNum == scrnNum) {
+ dmxBESavePixmap(pPix);
+ dmxBEFreePixmap(pPix);
+ }
+ }
+ else if ((type & TypeMask) == (RT_GC & TypeMask)) {
+ GCPtr pGC = value;
+
+ if (pGC->pScreen->myNum == scrnNum)
+ dmxBEFreeGC(pGC);
+ }
+ else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
+ dmxBEFreeFont(pScreen, (FontPtr) value);
+ }
+ else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
+ dmxBEFreeCursor(pScreen, (CursorPtr) value);
+ }
+ else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
+ ColormapPtr pCmap = value;
+
+ if (pCmap->pScreen->myNum == scrnNum)
+ dmxBEFreeColormap((ColormapPtr) value);
+ }
+ else if ((type & TypeMask) == (PictureType & TypeMask)) {
+ PicturePtr pPict = value;
+
+ if (pPict->pDrawable->pScreen->myNum == scrnNum) {
+ /* Free the pixmaps on the backend if needed */
+ if (pPict->pDrawable->type == DRAWABLE_PIXMAP) {
+ PixmapPtr pPixmap = (PixmapPtr) (pPict->pDrawable);
+
+ dmxBESavePixmap(pPixmap);
+ dmxBEFreePixmap(pPixmap);
+ }
+ dmxBEFreePicture((PicturePtr) value);
+ }
+ }
+ else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
+ dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr) value);
+ }
+ else {
+ /* Other resource types??? */
}
}
/** Destroy the scratch GCs that are created per depth. */
-static void dmxBEDestroyScratchGCs(int scrnNum)
+static void
+dmxBEDestroyScratchGCs(int scrnNum)
{
- ScreenPtr pScreen = screenInfo.screens[scrnNum];
- GCPtr *ppGC = pScreen->GCperDepth;
- int i;
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
+ GCPtr *ppGC = pScreen->GCperDepth;
+ int i;
for (i = 0; i <= pScreen->numDepths; i++)
- dmxBEFreeGC(ppGC[i]);
+ dmxBEFreeGC(ppGC[i]);
}
/** Destroy window hierachy on back-end server. To ensure that all
@@ -1512,79 +1592,81 @@ static void dmxBEDestroyScratchGCs(int scrnNum)
* up order so that windows are not destroyed before their children.
* XDestroyWindow(), which is called from #dmxBEDestroyWindow(), will
* destroy a window as well as all of it's children. */
-static void dmxBEDestroyWindowTree(int idx)
+static void
+dmxBEDestroyWindowTree(int idx)
{
- WindowPtr pWin = screenInfo.screens[idx]->root;
- WindowPtr pChild = pWin;
+ WindowPtr pWin = screenInfo.screens[idx]->root;
+ WindowPtr pChild = pWin;
while (1) {
- if (pChild->firstChild) {
- pChild = pChild->firstChild;
- continue;
- }
-
- /* Destroy the window */
- dmxBEDestroyWindow(pChild);
-
- /* Make sure we destroy the window's border and background
- * pixmaps if they exist */
- if (!pChild->borderIsPixel) {
- dmxBESavePixmap(pChild->border.pixmap);
- dmxBEFreePixmap(pChild->border.pixmap);
- }
- if (pChild->backgroundState == BackgroundPixmap) {
- dmxBESavePixmap(pChild->background.pixmap);
- dmxBEFreePixmap(pChild->background.pixmap);
- }
-
- while (!pChild->nextSib && (pChild != pWin)) {
- pChild = pChild->parent;
- dmxBEDestroyWindow(pChild);
- if (!pChild->borderIsPixel) {
- dmxBESavePixmap(pChild->border.pixmap);
- dmxBEFreePixmap(pChild->border.pixmap);
- }
- if (pChild->backgroundState == BackgroundPixmap) {
- dmxBESavePixmap(pChild->background.pixmap);
- dmxBEFreePixmap(pChild->background.pixmap);
- }
- }
-
- if (pChild == pWin)
- break;
-
- pChild = pChild->nextSib;
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+
+ /* Destroy the window */
+ dmxBEDestroyWindow(pChild);
+
+ /* Make sure we destroy the window's border and background
+ * pixmaps if they exist */
+ if (!pChild->borderIsPixel) {
+ dmxBESavePixmap(pChild->border.pixmap);
+ dmxBEFreePixmap(pChild->border.pixmap);
+ }
+ if (pChild->backgroundState == BackgroundPixmap) {
+ dmxBESavePixmap(pChild->background.pixmap);
+ dmxBEFreePixmap(pChild->background.pixmap);
+ }
+
+ while (!pChild->nextSib && (pChild != pWin)) {
+ pChild = pChild->parent;
+ dmxBEDestroyWindow(pChild);
+ if (!pChild->borderIsPixel) {
+ dmxBESavePixmap(pChild->border.pixmap);
+ dmxBEFreePixmap(pChild->border.pixmap);
+ }
+ if (pChild->backgroundState == BackgroundPixmap) {
+ dmxBESavePixmap(pChild->background.pixmap);
+ dmxBEFreePixmap(pChild->background.pixmap);
+ }
+ }
+
+ if (pChild == pWin)
+ break;
+
+ pChild = pChild->nextSib;
}
}
/** Detach back-end screen. */
-int dmxDetachScreen(int idx)
+int
+dmxDetachScreen(int idx)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- int i;
+ int i;
/* Return failure if dynamic addition/removal of screens is disabled */
if (!dmxAddRemoveScreens) {
- dmxLog(dmxWarning,
- "Attempting to remove a screen, but the AddRemoveScreen\n");
- dmxLog(dmxWarning,
- "extension has not been enabled. To enable this extension\n");
- dmxLog(dmxWarning,
- "add the \"-addremovescreens\" option either to the command\n");
- dmxLog(dmxWarning,
- "line or in the configuration file.\n");
- return 1;
+ dmxLog(dmxWarning,
+ "Attempting to remove a screen, but the AddRemoveScreen\n");
+ dmxLog(dmxWarning,
+ "extension has not been enabled. To enable this extension\n");
+ dmxLog(dmxWarning,
+ "add the \"-addremovescreens\" option either to the command\n");
+ dmxLog(dmxWarning, "line or in the configuration file.\n");
+ return 1;
}
/* Cannot remove a screen that does not exist */
- if (idx < 0 || idx >= dmxNumScreens) return 1;
+ if (idx < 0 || idx >= dmxNumScreens)
+ return 1;
/* Cannot detach from a screen that is not opened */
if (!dmxScreen->beDisplay) {
- dmxLog(dmxWarning,
- "Attempting to remove screen #%d but it has not been opened\n",
- idx);
- return 1;
+ dmxLog(dmxWarning,
+ "Attempting to remove screen #%d but it has not been opened\n",
+ idx);
+ return 1;
}
dmxLogOutput(dmxScreen, "Detaching screen #%d\n", idx);
@@ -1595,10 +1677,10 @@ int dmxDetachScreen(int idx)
/* Save all relevant state (TODO) */
/* Free all non-window resources related to this screen */
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindAllClientResources(clients[i], dmxBEDestroyResources,
- (pointer)(uintptr_t)idx);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBEDestroyResources,
+ (pointer) (uintptr_t) idx);
/* Free scratch GCs */
dmxBEDestroyScratchGCs(idx);
@@ -1616,5 +1698,5 @@ int dmxDetachScreen(int idx)
/* Adjust the cursor boundaries (paints detached console window) */
dmxAdjustCursorBoundaries();
- return 0; /* Success */
+ return 0; /* Success */
}
diff --git a/xorg-server/hw/dmx/dmxextension.h b/xorg-server/hw/dmx/dmxextension.h
index 5a6fd0e9f..036417b8d 100644
--- a/xorg-server/hw/dmx/dmxextension.h
+++ b/xorg-server/hw/dmx/dmxextension.h
@@ -42,77 +42,74 @@
/** Screen attributes. Used by #ProcDMXGetScreenAttributes and
* \a ProcDMXChangeScreensAttributes. */
typedef struct {
- const char *displayName;
- int logicalScreen;
+ const char *displayName;
+ int logicalScreen;
- unsigned int screenWindowWidth; /* displayName's coordinate system */
- unsigned int screenWindowHeight; /* displayName's coordinate system */
- int screenWindowXoffset; /* displayName's coordinate system */
- int screenWindowYoffset; /* displayName's coordinate system */
+ unsigned int screenWindowWidth; /* displayName's coordinate system */
+ unsigned int screenWindowHeight; /* displayName's coordinate system */
+ int screenWindowXoffset; /* displayName's coordinate system */
+ int screenWindowYoffset; /* displayName's coordinate system */
- unsigned int rootWindowWidth; /* screenWindow's coordinate system */
- unsigned int rootWindowHeight; /* screenWindow's coordinate system */
- int rootWindowXoffset; /* screenWindow's coordinate system */
- int rootWindowYoffset; /* screenWindow's coordinate system */
+ unsigned int rootWindowWidth; /* screenWindow's coordinate system */
+ unsigned int rootWindowHeight; /* screenWindow's coordinate system */
+ int rootWindowXoffset; /* screenWindow's coordinate system */
+ int rootWindowYoffset; /* screenWindow's coordinate system */
- int rootWindowXorigin; /* global coordinate system */
- int rootWindowYorigin; /* global coordinate system */
+ int rootWindowXorigin; /* global coordinate system */
+ int rootWindowYorigin; /* global coordinate system */
} DMXScreenAttributesRec, *DMXScreenAttributesPtr;
/** Window attributes. Used by #ProcDMXGetWindowAttributes. */
typedef struct {
- int screen;
- Window window;
- xRectangle pos;
- xRectangle vis;
+ int screen;
+ Window window;
+ xRectangle pos;
+ xRectangle vis;
} DMXWindowAttributesRec, *DMXWindowAttributesPtr;
/** Desktop attributes. Used by #ProcDMXGetDesktopAttributes and
* #ProcDMXChangeDesktopAttributes. */
typedef struct {
- int width;
- int height;
- int shiftX;
- int shiftY;
+ int width;
+ int height;
+ int shiftX;
+ int shiftY;
} DMXDesktopAttributesRec, *DMXDesktopAttributesPtr;
/** Input attributes. Used by #ProcDMXGetInputAttributes. */
typedef struct {
- const char *name;
- int inputType;
- int physicalScreen;
- int physicalId;
- int isCore;
- int sendsCore;
- int detached;
+ const char *name;
+ int inputType;
+ int physicalScreen;
+ int physicalId;
+ int isCore;
+ int sendsCore;
+ int detached;
} DMXInputAttributesRec, *DMXInputAttributesPtr;
-
extern unsigned long dmxGetNumScreens(void);
-extern void dmxForceWindowCreation(WindowPtr pWindow);
-extern void dmxFlushPendingSyncs(void);
-extern Bool dmxGetScreenAttributes(int physical,
- DMXScreenAttributesPtr attr);
-extern Bool dmxGetWindowAttributes(WindowPtr pWindow,
- DMXWindowAttributesPtr attr);
-extern void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr);
-extern int dmxGetInputCount(void);
-extern int dmxGetInputAttributes(int deviceId,
- DMXInputAttributesPtr attr);
-extern int dmxAddInput(DMXInputAttributesPtr attr, int *deviceId);
-extern int dmxRemoveInput(int deviceId);
-
-extern int dmxConfigureScreenWindows(int nscreens,
- CARD32 *screens,
- DMXScreenAttributesPtr attribs,
- int *errorScreen);
-
-extern int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs);
+extern void dmxForceWindowCreation(WindowPtr pWindow);
+extern void dmxFlushPendingSyncs(void);
+extern Bool dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr);
+extern Bool dmxGetWindowAttributes(WindowPtr pWindow,
+ DMXWindowAttributesPtr attr);
+extern void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr);
+extern int dmxGetInputCount(void);
+extern int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr);
+extern int dmxAddInput(DMXInputAttributesPtr attr, int *deviceId);
+extern int dmxRemoveInput(int deviceId);
+
+extern int dmxConfigureScreenWindows(int nscreens,
+ CARD32 *screens,
+ DMXScreenAttributesPtr attribs,
+ int *errorScreen);
+
+extern int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs);
/* dmxUpdateScreenResources exposed for dmxCreateWindow in dmxwindow.c */
-extern void dmxUpdateScreenResources(ScreenPtr pScreen,
- int x, int y, int w, int h);
+extern void dmxUpdateScreenResources(ScreenPtr pScreen,
+ int x, int y, int w, int h);
-extern int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr);
-extern int dmxDetachScreen(int idx);
+extern int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr);
+extern int dmxDetachScreen(int idx);
#endif
diff --git a/xorg-server/hw/dmx/dmxfont.c b/xorg-server/hw/dmx/dmxfont.c
index 8b57b6f3b..7ef7ad971 100644
--- a/xorg-server/hw/dmx/dmxfont.c
+++ b/xorg-server/hw/dmx/dmxfont.c
@@ -1,551 +1,572 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * This file provides support for fonts. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_FONTPATH_DEBUG 0
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxfont.h"
-#include "dmxlog.h"
-
-#include <X11/fonts/fontstruct.h>
-#include "dixfont.h"
-#include "dixstruct.h"
-
-static int (*dmxSaveProcVector[256])(ClientPtr);
-static int dmxFontLastError;
-
-static int dmxFontErrorHandler(Display *dpy, XErrorEvent *ev)
-{
- dmxFontLastError = ev->error_code;
-
- return 0;
-}
-
-static char **dmxGetFontPath(int *npaths)
-{
- char **fp;
- unsigned char *c, *paths;
- char *newfp;
- int len, l, i;
-
- GetFontPath(serverClient, npaths, &len, &paths);
-
- newfp = malloc(*npaths + len);
- c = (unsigned char *)newfp;
- fp = malloc(*npaths * sizeof(*fp));
-
- memmove(newfp, paths+1, *npaths + len - 1);
- l = *paths;
- for (i = 0; i < *npaths; i++) {
- fp[i] = (char *)c;
- c += l;
- l = *c;
- *c++ = '\0';
- }
-
-#if DMX_FONTPATH_DEBUG
- for (i = 0; i < *npaths; i++)
- dmxLog(dmxDebug, "FontPath[%d] = %s\n", i, fp[i]);
-#endif
-
- return fp;
-}
-
-static void dmxFreeFontPath(char **fp)
-{
- free(fp[0]);
- free(fp);
-}
-
-static Bool dmxCheckFontPathElement(DMXScreenInfo *dmxScreen, char *fp)
-{
- int (*oldErrorHandler)(Display *, XErrorEvent *);
-
- if (!dmxScreen->beDisplay)
- return TRUE;
-
- dmxFontLastError = 0;
- oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler);
- XSetFontPath(dmxScreen->beDisplay, &fp, 1);
- dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */
- XSetErrorHandler(oldErrorHandler);
-
- return dmxFontLastError == 0;
-}
-
-static int dmxSetFontPath(DMXScreenInfo *dmxScreen)
-{
- int (*oldErrorHandler)(Display *, XErrorEvent *);
- char **fp;
- int result = Success;
- int npaths;
-
- if (!dmxScreen->beDisplay)
- return result;
-
- fp = dmxGetFontPath(&npaths);
- if (!fp) return BadAlloc;
-
- dmxFontLastError = 0;
- oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler);
- XSetFontPath(dmxScreen->beDisplay, fp, npaths);
- dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */
- XSetErrorHandler(oldErrorHandler);
-
- if (dmxFontLastError) {
- result = dmxFontLastError;
- /* We could set *error here to the offending path, but it is
- * ignored, so we don't bother figuring out which path is bad.
- * If we do add this support in the future, we'll need to add
- * error to the function's argument list.
- */
- }
-
- dmxFreeFontPath(fp);
-
- return result;
-}
-
-static int dmxCheckFontPath(DMXScreenInfo *dmxScreen, int *error)
-{
- char **oldFontPath;
- int nOldPaths;
- int result = Success;
-
- if (!dmxScreen->beDisplay)
- return result;
-
- /* Save old font path */
- oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths);
-
- result = dmxSetFontPath(dmxScreen);
-
- /* Restore old font path */
- XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths);
- XFreeFontPath(oldFontPath);
- dmxSync(dmxScreen, FALSE);
-
- return result;
-}
-
-static int dmxProcSetFontPath(ClientPtr client)
-{
- unsigned char *ptr;
- unsigned long nbytes, total, n;
- long nfonts;
- int i, result;
- unsigned char *oldFontPath, *tmpFontPath;
- int nOldPaths;
- int lenOldPaths;
- REQUEST(xSetFontPathReq);
-
- REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
-
- nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
- total = nbytes;
- ptr = (unsigned char *)&stuff[1];
- nfonts = stuff->nFonts;
-
- while (--nfonts >= 0) {
- if ((total == 0) || (total < (n = (*ptr + 1))))
- return BadLength;
- total -= n;
- ptr += n;
- }
- if (total >= 4)
- return BadLength;
-
- GetFontPath(serverClient, &nOldPaths, &lenOldPaths, &tmpFontPath);
- oldFontPath = malloc(nOldPaths + lenOldPaths);
- memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
-
- result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
- if (!result) {
- int error = 0;
- for (i = 0; i < dmxNumScreens; i++)
- if ((result = dmxCheckFontPath(&dmxScreens[i], &error)))
- break;
-
- if (result) {
- /* Restore old fontpath in the DMX server */
- SetFontPath(client, nOldPaths, oldFontPath);
- client->errorValue = error;
- }
- }
-
- free(oldFontPath);
- return result;
-}
-
-/** Initialize font support. In addition to the screen function call
- * pointers, DMX also hooks in at the ProcVector[] level. Here the old
- * ProcVector function pointers are saved and the new ProcVector
- * function pointers are initialized. */
-void dmxInitFonts(void)
-{
- int i;
-
- for (i = 0; i < 256; i++)
- dmxSaveProcVector[i] = ProcVector[i];
-
- ProcVector[X_SetFontPath] = dmxProcSetFontPath;
-}
-
-/** Reset font support by restoring the original ProcVector function
- * pointers. */
-void dmxResetFonts(void)
-{
- int i;
-
- for (i = 0; i < 256; i++)
- ProcVector[i] = dmxSaveProcVector[i];
-}
-
-/** Load the font, \a pFont, on the back-end server associated with \a
- * pScreen. When a font is loaded, the font path on back-end server is
- * first initialized to that specified on the command line with the
- * -fontpath options, and then the font is loaded. */
-Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
- const char *name;
- char **oldFontPath = NULL;
- int nOldPaths;
- Atom name_atom, value_atom;
- int i;
-
- /* Make sure we have a font private struct to work with */
- if (!pFontPriv)
- return FALSE;
-
- /* Don't load a font over top of itself */
- if (pFontPriv->font[pScreen->myNum]) {
- return TRUE; /* Already loaded font */
- }
-
- /* Save old font path */
- oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths);
-
- /* Set the font path for the font about to be loaded on the back-end */
- if (dmxSetFontPath(dmxScreen)) {
- char **fp;
- int npaths;
- Bool *goodfps;
-
- /* This could fail only when first starting the X server and
- * loading the default font. If it fails here, then the default
- * font path is invalid, no default font path will be set, the
- * DMX server will fail to load the default font, and it will
- * exit with an error unless we remove the offending font paths
- * with the -ignorebadfontpaths command line option.
- */
-
- fp = dmxGetFontPath(&npaths);
- if (!fp) {
- dmxLog(dmxError,
- "No default font path set.\n");
- dmxLog(dmxError,
- "Please see the Xdmx man page for information on how to\n");
- dmxLog(dmxError,
- "initialize the DMX server's default font path.\n");
- XFreeFontPath(oldFontPath);
- return FALSE;
- }
-
- if (!dmxFontPath)
- dmxLog(dmxWarning, "No default font path is set.\n");
-
- goodfps = malloc(npaths * sizeof(*goodfps));
-
- dmxLog(dmxError,
- "The DMX server failed to set the following font paths on "
- "screen #%d:\n", pScreen->myNum);
-
- for (i = 0; i < npaths; i++)
- if (!(goodfps[i] = dmxCheckFontPathElement(dmxScreen, fp[i])))
- dmxLog(dmxError, " %s\n", fp[i]);
-
- if (dmxIgnoreBadFontPaths) {
- char *newfp;
- int newnpaths = 0;
- int len = 0;
- int j = 0;
-
- dmxLog(dmxError,
- "These font paths will not be used because the "
- "\"-ignorebadfontpaths\"\n");
- dmxLog(dmxError,
- "option is set.\n");
-
- for (i = 0; i < npaths; i++)
- if (goodfps[i]) {
- len += strlen(fp[i]) + 1;
- newnpaths++;
- }
-
- if (!newnpaths) {
- /* No valid font paths were found */
- dmxLog(dmxError,
- "After removing the font paths above, no valid font "
- "paths were\n");
- dmxLog(dmxError,
- "available. Please check that the font paths set on "
- "the command\n");
- dmxLog(dmxError,
- "line or in the configuration file via the "
- "\"-fontpath\" option\n");
- dmxLog(dmxError,
- "are valid on all back-end servers. See the Xdmx man "
- "page for\n");
- dmxLog(dmxError,
- "more information on font paths.\n");
- dmxFreeFontPath(fp);
- XFreeFontPath(oldFontPath);
- free(goodfps);
- return FALSE;
- }
-
- newfp = malloc(len * sizeof(*newfp));
- for (i = 0; i < npaths; i++) {
- if (goodfps[i]) {
- int n = strlen(fp[i]);
- newfp[j++] = n;
- strncpy(&newfp[j], fp[i], n);
- j += n;
- }
- }
-
- if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp)) {
- /* Note that this should never happen since all of the
- * FPEs were previously valid. */
- dmxLog(dmxError, "Cannot reset the default font path.\n");
- }
- } else if (dmxFontPath) {
- dmxLog(dmxError,
- "Please remove these font paths from the command line "
- "or\n");
- dmxLog(dmxError,
- "configuration file, or set the \"-ignorebadfontpaths\" "
- "option to\n");
- dmxLog(dmxError,
- "ignore them. For more information on these options, see "
- "the\n");
- dmxLog(dmxError,
- "Xdmx man page.\n");
- } else {
- dmxLog(dmxError,
- "Please specify the font paths that are available on all "
- "back-end\n");
- dmxLog(dmxError,
- "servers with the \"-fontpath\" option, or use the "
- "\"-ignorebadfontpaths\"\n");
- dmxLog(dmxError,
- "to ignore bad defaults. For more information on "
- "these and other\n");
- dmxLog(dmxError,
- "font-path-related options, see the Xdmx man page.\n");
- }
-
- if (!dmxIgnoreBadFontPaths ||
- (dmxIgnoreBadFontPaths && dmxSetFontPath(dmxScreen))) {
- /* We still have errors so return with error */
- dmxFreeFontPath(fp);
- XFreeFontPath(oldFontPath);
- free(goodfps);
- return FALSE;
- }
- }
-
- /* Find requested font on back-end server */
- name_atom = MakeAtom("FONT", 4, TRUE);
- value_atom = 0L;
-
- for (i = 0; i < pFont->info.nprops; i++) {
- if ((Atom)pFont->info.props[i].name == name_atom) {
- value_atom = pFont->info.props[i].value;
- break;
- }
- }
- if (!value_atom) return FALSE;
-
- name = NameForAtom(value_atom);
- if (!name) return FALSE;
-
- pFontPriv->font[pScreen->myNum] =
- XLoadQueryFont(dmxScreen->beDisplay, name);
-
- /* Restore old font path */
- XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths);
- XFreeFontPath(oldFontPath);
- dmxSync(dmxScreen, FALSE);
-
- if (!pFontPriv->font[pScreen->myNum]) return FALSE;
-
- return TRUE;
-}
-
-/** Realize the font, \a pFont, on the back-end server associated with
- * \a pScreen. */
-Bool dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxFontPrivPtr pFontPriv;
-
- if (!(pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
- FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
- pFontPriv = malloc(sizeof(dmxFontPrivRec));
- if (!pFontPriv) return FALSE;
- pFontPriv->font = NULL;
- MAXSCREENSALLOC(pFontPriv->font);
- if (!pFontPriv->font) {
- free(pFontPriv);
- return FALSE;
- }
- pFontPriv->refcnt = 0;
- }
-
- FontSetPrivate(pFont, dmxFontPrivateIndex, (pointer)pFontPriv);
-
- if (dmxScreen->beDisplay) {
- if (!dmxBELoadFont(pScreen, pFont))
- return FALSE;
-
- pFontPriv->refcnt++;
- } else {
- pFontPriv->font[pScreen->myNum] = NULL;
- }
-
- return TRUE;
-}
-
-/** Free \a pFont on the back-end associated with \a pScreen. */
-Bool dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
-
- if (pFontPriv && pFontPriv->font[pScreen->myNum]) {
- XFreeFont(dmxScreen->beDisplay, pFontPriv->font[pScreen->myNum]);
- pFontPriv->font[pScreen->myNum] = NULL;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/** Unrealize the font, \a pFont, on the back-end server associated with
- * \a pScreen. */
-Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxFontPrivPtr pFontPriv;
-
- if ((pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
- /* In case the font failed to load properly */
- if (!pFontPriv->refcnt) {
- MAXSCREENSFREE(pFontPriv->font);
- free(pFontPriv);
- FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
- } else if (pFontPriv->font[pScreen->myNum]) {
- if (dmxScreen->beDisplay)
- dmxBEFreeFont(pScreen, pFont);
-
- /* The code below is non-obvious, so here's an explanation...
- *
- * When creating the default GC, the server opens up the
- * default font once for each screen, which in turn calls
- * the RealizeFont function pointer once for each screen.
- * During this process both dix's font refcnt and DMX's font
- * refcnt are incremented once for each screen.
- *
- * Later, when shutting down the X server, dix shuts down
- * each screen in reverse order. During this shutdown
- * procedure, each screen's default GC is freed and then
- * that screen is closed by calling the CloseScreen function
- * pointer. screenInfo.numScreens is then decremented after
- * closing each screen. This procedure means that the dix's
- * font refcnt for the font used by the default GC's is
- * decremented once for each screen # greater than 0.
- * However, since dix's refcnt for the default font is not
- * yet 0 for each screen greater than 0, no call to the
- * UnrealizeFont function pointer is made for those screens.
- * Then, when screen 0 is being closed, dix's font refcnt
- * for the default GC's font is finally 0 and the font is
- * unrealized. However, since screenInfo.numScreens has
- * been decremented already down to 1, only one call to
- * UnrealizeFont is made (for screen 0). Thus, even though
- * RealizeFont was called once for each screen,
- * UnrealizeFont is only called for screen 0.
- *
- * This is a bug in dix.
- *
- * To avoid the memory leak of pFontPriv for each server
- * generation, we can also free pFontPriv if the refcnt is
- * not yet 0 but the # of screens is 1 -- i.e., the case
- * described in the dix bug above. This is only a temporary
- * workaround until the bug in dix is solved.
- *
- * The other problem is that the font structure allocated by
- * XLoadQueryFont() above is not freed for screens > 0.
- * This problem cannot be worked around here since the back-
- * end displays for screens > 0 have already been closed by
- * the time this code is called from dix.
- *
- * When the bug in dix described above is fixed, then we can
- * remove the "|| screenInfo.numScreens == 1" code below and
- * the memory leaks will be eliminated.
- */
- if (--pFontPriv->refcnt == 0
-#if 1
- /* Remove this code when the dix bug is fixed */
- || screenInfo.numScreens == 1
-#endif
- ) {
- MAXSCREENSFREE(pFontPriv->font);
- free(pFontPriv);
- FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
- }
- }
- }
-
- return TRUE;
-}
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides support for fonts. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_FONTPATH_DEBUG 0
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxfont.h"
+#include "dmxlog.h"
+
+#include <X11/fonts/fontstruct.h>
+#include "dixfont.h"
+#include "dixstruct.h"
+
+static int (*dmxSaveProcVector[256]) (ClientPtr);
+static int dmxFontLastError;
+
+static int
+dmxFontErrorHandler(Display * dpy, XErrorEvent * ev)
+{
+ dmxFontLastError = ev->error_code;
+
+ return 0;
+}
+
+static char **
+dmxGetFontPath(int *npaths)
+{
+ char **fp;
+ unsigned char *c, *paths;
+ char *newfp;
+ int len, l, i;
+
+ GetFontPath(serverClient, npaths, &len, &paths);
+
+ newfp = malloc(*npaths + len);
+ c = (unsigned char *) newfp;
+ fp = malloc(*npaths * sizeof(*fp));
+
+ memmove(newfp, paths + 1, *npaths + len - 1);
+ l = *paths;
+ for (i = 0; i < *npaths; i++) {
+ fp[i] = (char *) c;
+ c += l;
+ l = *c;
+ *c++ = '\0';
+ }
+
+#if DMX_FONTPATH_DEBUG
+ for (i = 0; i < *npaths; i++)
+ dmxLog(dmxDebug, "FontPath[%d] = %s\n", i, fp[i]);
+#endif
+
+ return fp;
+}
+
+static void
+dmxFreeFontPath(char **fp)
+{
+ free(fp[0]);
+ free(fp);
+}
+
+static Bool
+dmxCheckFontPathElement(DMXScreenInfo * dmxScreen, char *fp)
+{
+ int (*oldErrorHandler) (Display *, XErrorEvent *);
+
+ if (!dmxScreen->beDisplay)
+ return TRUE;
+
+ dmxFontLastError = 0;
+ oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler);
+ XSetFontPath(dmxScreen->beDisplay, &fp, 1);
+ dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */
+ XSetErrorHandler(oldErrorHandler);
+
+ return dmxFontLastError == 0;
+}
+
+static int
+dmxSetFontPath(DMXScreenInfo * dmxScreen)
+{
+ int (*oldErrorHandler) (Display *, XErrorEvent *);
+ char **fp;
+ int result = Success;
+ int npaths;
+
+ if (!dmxScreen->beDisplay)
+ return result;
+
+ fp = dmxGetFontPath(&npaths);
+ if (!fp)
+ return BadAlloc;
+
+ dmxFontLastError = 0;
+ oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler);
+ XSetFontPath(dmxScreen->beDisplay, fp, npaths);
+ dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */
+ XSetErrorHandler(oldErrorHandler);
+
+ if (dmxFontLastError) {
+ result = dmxFontLastError;
+ /* We could set *error here to the offending path, but it is
+ * ignored, so we don't bother figuring out which path is bad.
+ * If we do add this support in the future, we'll need to add
+ * error to the function's argument list.
+ */
+ }
+
+ dmxFreeFontPath(fp);
+
+ return result;
+}
+
+static int
+dmxCheckFontPath(DMXScreenInfo * dmxScreen, int *error)
+{
+ char **oldFontPath;
+ int nOldPaths;
+ int result = Success;
+
+ if (!dmxScreen->beDisplay)
+ return result;
+
+ /* Save old font path */
+ oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths);
+
+ result = dmxSetFontPath(dmxScreen);
+
+ /* Restore old font path */
+ XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths);
+ XFreeFontPath(oldFontPath);
+ dmxSync(dmxScreen, FALSE);
+
+ return result;
+}
+
+static int
+dmxProcSetFontPath(ClientPtr client)
+{
+ unsigned char *ptr;
+ unsigned long nbytes, total, n;
+ long nfonts;
+ int i, result;
+ unsigned char *oldFontPath, *tmpFontPath;
+ int nOldPaths;
+ int lenOldPaths;
+
+ REQUEST(xSetFontPathReq);
+
+ REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
+
+ nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
+ total = nbytes;
+ ptr = (unsigned char *) &stuff[1];
+ nfonts = stuff->nFonts;
+
+ while (--nfonts >= 0) {
+ if ((total == 0) || (total < (n = (*ptr + 1))))
+ return BadLength;
+ total -= n;
+ ptr += n;
+ }
+ if (total >= 4)
+ return BadLength;
+
+ GetFontPath(serverClient, &nOldPaths, &lenOldPaths, &tmpFontPath);
+ oldFontPath = malloc(nOldPaths + lenOldPaths);
+ memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
+
+ result = SetFontPath(client, stuff->nFonts, (unsigned char *) &stuff[1]);
+ if (!result) {
+ int error = 0;
+
+ for (i = 0; i < dmxNumScreens; i++)
+ if ((result = dmxCheckFontPath(&dmxScreens[i], &error)))
+ break;
+
+ if (result) {
+ /* Restore old fontpath in the DMX server */
+ SetFontPath(client, nOldPaths, oldFontPath);
+ client->errorValue = error;
+ }
+ }
+
+ free(oldFontPath);
+ return result;
+}
+
+/** Initialize font support. In addition to the screen function call
+ * pointers, DMX also hooks in at the ProcVector[] level. Here the old
+ * ProcVector function pointers are saved and the new ProcVector
+ * function pointers are initialized. */
+void
+dmxInitFonts(void)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ dmxSaveProcVector[i] = ProcVector[i];
+
+ ProcVector[X_SetFontPath] = dmxProcSetFontPath;
+}
+
+/** Reset font support by restoring the original ProcVector function
+ * pointers. */
+void
+dmxResetFonts(void)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ ProcVector[i] = dmxSaveProcVector[i];
+}
+
+/** Load the font, \a pFont, on the back-end server associated with \a
+ * pScreen. When a font is loaded, the font path on back-end server is
+ * first initialized to that specified on the command line with the
+ * -fontpath options, and then the font is loaded. */
+Bool
+dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
+ const char *name;
+ char **oldFontPath = NULL;
+ int nOldPaths;
+ Atom name_atom, value_atom;
+ int i;
+
+ /* Make sure we have a font private struct to work with */
+ if (!pFontPriv)
+ return FALSE;
+
+ /* Don't load a font over top of itself */
+ if (pFontPriv->font[pScreen->myNum]) {
+ return TRUE; /* Already loaded font */
+ }
+
+ /* Save old font path */
+ oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths);
+
+ /* Set the font path for the font about to be loaded on the back-end */
+ if (dmxSetFontPath(dmxScreen)) {
+ char **fp;
+ int npaths;
+ Bool *goodfps;
+
+ /* This could fail only when first starting the X server and
+ * loading the default font. If it fails here, then the default
+ * font path is invalid, no default font path will be set, the
+ * DMX server will fail to load the default font, and it will
+ * exit with an error unless we remove the offending font paths
+ * with the -ignorebadfontpaths command line option.
+ */
+
+ fp = dmxGetFontPath(&npaths);
+ if (!fp) {
+ dmxLog(dmxError, "No default font path set.\n");
+ dmxLog(dmxError,
+ "Please see the Xdmx man page for information on how to\n");
+ dmxLog(dmxError,
+ "initialize the DMX server's default font path.\n");
+ XFreeFontPath(oldFontPath);
+ return FALSE;
+ }
+
+ if (!dmxFontPath)
+ dmxLog(dmxWarning, "No default font path is set.\n");
+
+ goodfps = malloc(npaths * sizeof(*goodfps));
+
+ dmxLog(dmxError,
+ "The DMX server failed to set the following font paths on "
+ "screen #%d:\n", pScreen->myNum);
+
+ for (i = 0; i < npaths; i++)
+ if (!(goodfps[i] = dmxCheckFontPathElement(dmxScreen, fp[i])))
+ dmxLog(dmxError, " %s\n", fp[i]);
+
+ if (dmxIgnoreBadFontPaths) {
+ char *newfp;
+ int newnpaths = 0;
+ int len = 0;
+ int j = 0;
+
+ dmxLog(dmxError,
+ "These font paths will not be used because the "
+ "\"-ignorebadfontpaths\"\n");
+ dmxLog(dmxError, "option is set.\n");
+
+ for (i = 0; i < npaths; i++)
+ if (goodfps[i]) {
+ len += strlen(fp[i]) + 1;
+ newnpaths++;
+ }
+
+ if (!newnpaths) {
+ /* No valid font paths were found */
+ dmxLog(dmxError,
+ "After removing the font paths above, no valid font "
+ "paths were\n");
+ dmxLog(dmxError,
+ "available. Please check that the font paths set on "
+ "the command\n");
+ dmxLog(dmxError,
+ "line or in the configuration file via the "
+ "\"-fontpath\" option\n");
+ dmxLog(dmxError,
+ "are valid on all back-end servers. See the Xdmx man "
+ "page for\n");
+ dmxLog(dmxError, "more information on font paths.\n");
+ dmxFreeFontPath(fp);
+ XFreeFontPath(oldFontPath);
+ free(goodfps);
+ return FALSE;
+ }
+
+ newfp = malloc(len * sizeof(*newfp));
+ for (i = 0; i < npaths; i++) {
+ if (goodfps[i]) {
+ int n = strlen(fp[i]);
+
+ newfp[j++] = n;
+ strncpy(&newfp[j], fp[i], n);
+ j += n;
+ }
+ }
+
+ if (SetFontPath(serverClient, newnpaths, (unsigned char *) newfp)) {
+ /* Note that this should never happen since all of the
+ * FPEs were previously valid. */
+ dmxLog(dmxError, "Cannot reset the default font path.\n");
+ }
+ }
+ else if (dmxFontPath) {
+ dmxLog(dmxError,
+ "Please remove these font paths from the command line "
+ "or\n");
+ dmxLog(dmxError,
+ "configuration file, or set the \"-ignorebadfontpaths\" "
+ "option to\n");
+ dmxLog(dmxError,
+ "ignore them. For more information on these options, see "
+ "the\n");
+ dmxLog(dmxError, "Xdmx man page.\n");
+ }
+ else {
+ dmxLog(dmxError,
+ "Please specify the font paths that are available on all "
+ "back-end\n");
+ dmxLog(dmxError,
+ "servers with the \"-fontpath\" option, or use the "
+ "\"-ignorebadfontpaths\"\n");
+ dmxLog(dmxError,
+ "to ignore bad defaults. For more information on "
+ "these and other\n");
+ dmxLog(dmxError,
+ "font-path-related options, see the Xdmx man page.\n");
+ }
+
+ if (!dmxIgnoreBadFontPaths ||
+ (dmxIgnoreBadFontPaths && dmxSetFontPath(dmxScreen))) {
+ /* We still have errors so return with error */
+ dmxFreeFontPath(fp);
+ XFreeFontPath(oldFontPath);
+ free(goodfps);
+ return FALSE;
+ }
+ }
+
+ /* Find requested font on back-end server */
+ name_atom = MakeAtom("FONT", 4, TRUE);
+ value_atom = 0L;
+
+ for (i = 0; i < pFont->info.nprops; i++) {
+ if ((Atom) pFont->info.props[i].name == name_atom) {
+ value_atom = pFont->info.props[i].value;
+ break;
+ }
+ }
+ if (!value_atom)
+ return FALSE;
+
+ name = NameForAtom(value_atom);
+ if (!name)
+ return FALSE;
+
+ pFontPriv->font[pScreen->myNum] =
+ XLoadQueryFont(dmxScreen->beDisplay, name);
+
+ /* Restore old font path */
+ XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths);
+ XFreeFontPath(oldFontPath);
+ dmxSync(dmxScreen, FALSE);
+
+ if (!pFontPriv->font[pScreen->myNum])
+ return FALSE;
+
+ return TRUE;
+}
+
+/** Realize the font, \a pFont, on the back-end server associated with
+ * \a pScreen. */
+Bool
+dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv;
+
+ if (!(pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
+ FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
+ pFontPriv = malloc(sizeof(dmxFontPrivRec));
+ if (!pFontPriv)
+ return FALSE;
+ pFontPriv->font = NULL;
+ MAXSCREENSALLOC(pFontPriv->font);
+ if (!pFontPriv->font) {
+ free(pFontPriv);
+ return FALSE;
+ }
+ pFontPriv->refcnt = 0;
+ }
+
+ FontSetPrivate(pFont, dmxFontPrivateIndex, (pointer) pFontPriv);
+
+ if (dmxScreen->beDisplay) {
+ if (!dmxBELoadFont(pScreen, pFont))
+ return FALSE;
+
+ pFontPriv->refcnt++;
+ }
+ else {
+ pFontPriv->font[pScreen->myNum] = NULL;
+ }
+
+ return TRUE;
+}
+
+/** Free \a pFont on the back-end associated with \a pScreen. */
+Bool
+dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
+
+ if (pFontPriv && pFontPriv->font[pScreen->myNum]) {
+ XFreeFont(dmxScreen->beDisplay, pFontPriv->font[pScreen->myNum]);
+ pFontPriv->font[pScreen->myNum] = NULL;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Unrealize the font, \a pFont, on the back-end server associated with
+ * \a pScreen. */
+Bool
+dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv;
+
+ if ((pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
+ /* In case the font failed to load properly */
+ if (!pFontPriv->refcnt) {
+ MAXSCREENSFREE(pFontPriv->font);
+ free(pFontPriv);
+ FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
+ }
+ else if (pFontPriv->font[pScreen->myNum]) {
+ if (dmxScreen->beDisplay)
+ dmxBEFreeFont(pScreen, pFont);
+
+ /* The code below is non-obvious, so here's an explanation...
+ *
+ * When creating the default GC, the server opens up the
+ * default font once for each screen, which in turn calls
+ * the RealizeFont function pointer once for each screen.
+ * During this process both dix's font refcnt and DMX's font
+ * refcnt are incremented once for each screen.
+ *
+ * Later, when shutting down the X server, dix shuts down
+ * each screen in reverse order. During this shutdown
+ * procedure, each screen's default GC is freed and then
+ * that screen is closed by calling the CloseScreen function
+ * pointer. screenInfo.numScreens is then decremented after
+ * closing each screen. This procedure means that the dix's
+ * font refcnt for the font used by the default GC's is
+ * decremented once for each screen # greater than 0.
+ * However, since dix's refcnt for the default font is not
+ * yet 0 for each screen greater than 0, no call to the
+ * UnrealizeFont function pointer is made for those screens.
+ * Then, when screen 0 is being closed, dix's font refcnt
+ * for the default GC's font is finally 0 and the font is
+ * unrealized. However, since screenInfo.numScreens has
+ * been decremented already down to 1, only one call to
+ * UnrealizeFont is made (for screen 0). Thus, even though
+ * RealizeFont was called once for each screen,
+ * UnrealizeFont is only called for screen 0.
+ *
+ * This is a bug in dix.
+ *
+ * To avoid the memory leak of pFontPriv for each server
+ * generation, we can also free pFontPriv if the refcnt is
+ * not yet 0 but the # of screens is 1 -- i.e., the case
+ * described in the dix bug above. This is only a temporary
+ * workaround until the bug in dix is solved.
+ *
+ * The other problem is that the font structure allocated by
+ * XLoadQueryFont() above is not freed for screens > 0.
+ * This problem cannot be worked around here since the back-
+ * end displays for screens > 0 have already been closed by
+ * the time this code is called from dix.
+ *
+ * When the bug in dix described above is fixed, then we can
+ * remove the "|| screenInfo.numScreens == 1" code below and
+ * the memory leaks will be eliminated.
+ */
+ if (--pFontPriv->refcnt == 0
+#if 1
+ /* Remove this code when the dix bug is fixed */
+ || screenInfo.numScreens == 1
+#endif
+ ) {
+ MAXSCREENSFREE(pFontPriv->font);
+ free(pFontPriv);
+ FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
+ }
+ }
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/dmx/dmxgc.c b/xorg-server/hw/dmx/dmxgc.c
index f10f9a074..703aeb336 100644
--- a/xorg-server/hw/dmx/dmxgc.c
+++ b/xorg-server/hw/dmx/dmxgc.c
@@ -83,65 +83,70 @@ static GCOps dmxGCOps = {
};
/** Initialize the GC on \a pScreen */
-Bool dmxInitGC(ScreenPtr pScreen)
+Bool
+dmxInitGC(ScreenPtr pScreen)
{
- if (!dixRegisterPrivateKey(&dmxGCPrivateKeyRec, PRIVATE_GC, sizeof(dmxGCPrivRec)))
- return FALSE;
+ if (!dixRegisterPrivateKey
+ (&dmxGCPrivateKeyRec, PRIVATE_GC, sizeof(dmxGCPrivRec)))
+ return FALSE;
return TRUE;
}
/** Create the GC on the back-end server. */
-void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC)
+void
+dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- int i;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ int i;
for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- if (pGC->depth == dmxScreen->bePixmapFormats[i].depth) {
- unsigned long mask;
- XGCValues gcvals;
-
- mask = GCGraphicsExposures;
- gcvals.graphics_exposures = FALSE;
-
- /* Create GC in the back-end servers */
- pGCPriv->gc = XCreateGC(dmxScreen->beDisplay,
- dmxScreen->scrnDefDrawables[i],
- mask, &gcvals);
- break;
- }
+ if (pGC->depth == dmxScreen->bePixmapFormats[i].depth) {
+ unsigned long mask;
+ XGCValues gcvals;
+
+ mask = GCGraphicsExposures;
+ gcvals.graphics_exposures = FALSE;
+
+ /* Create GC in the back-end servers */
+ pGCPriv->gc = XCreateGC(dmxScreen->beDisplay,
+ dmxScreen->scrnDefDrawables[i],
+ mask, &gcvals);
+ break;
+ }
}
}
/** Create a graphics context on the back-end server associated /a pGC's
* screen. */
-Bool dmxCreateGC(GCPtr pGC)
+Bool
+dmxCreateGC(GCPtr pGC)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Bool ret;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Bool ret;
DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
if ((ret = pScreen->CreateGC(pGC))) {
- /* Save the old funcs */
- pGCPriv->funcs = pGC->funcs;
- pGCPriv->ops = NULL;
-
- pGC->funcs = &dmxGCFuncs;
-
- if (dmxScreen->beDisplay) {
- dmxBECreateGC(pScreen, pGC);
- } else {
- pGCPriv->gc = NULL;
- }
-
- /* Check for "magic special case"
- * 1. see CreateGC in dix/gc.c for more info
- * 2. see dmxChangeGC for more info
- */
- pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap);
+ /* Save the old funcs */
+ pGCPriv->funcs = pGC->funcs;
+ pGCPriv->ops = NULL;
+
+ pGC->funcs = &dmxGCFuncs;
+
+ if (dmxScreen->beDisplay) {
+ dmxBECreateGC(pScreen, pGC);
+ }
+ else {
+ pGCPriv->gc = NULL;
+ }
+
+ /* Check for "magic special case"
+ * 1. see CreateGC in dix/gc.c for more info
+ * 2. see dmxChangeGC for more info
+ */
+ pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap);
}
DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
@@ -150,7 +155,8 @@ Bool dmxCreateGC(GCPtr pGC)
/** Validate a graphics context, \a pGC, locally in the DMX server and
* recompute the composite clip, if necessary. */
-void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
+void
+dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
@@ -160,13 +166,14 @@ void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
#endif
if (pDrawable->type == DRAWABLE_WINDOW ||
- pDrawable->type == DRAWABLE_PIXMAP) {
- /* Save the old ops, since we're about to change the ops in the
- * epilogue.
- */
- pGCPriv->ops = pGC->ops;
- } else {
- pGCPriv->ops = NULL;
+ pDrawable->type == DRAWABLE_PIXMAP) {
+ /* Save the old ops, since we're about to change the ops in the
+ * epilogue.
+ */
+ pGCPriv->ops = pGC->ops;
+ }
+ else {
+ pGCPriv->ops = NULL;
}
/* If the client clip is different or moved OR the subwindowMode has
@@ -174,12 +181,12 @@ void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
* validation, then we need to recompute the composite clip.
*/
if ((changes & (GCClipXOrigin |
- GCClipYOrigin |
- GCClipMask |
- GCSubwindowMode)) ||
- (pDrawable->serialNumber !=
- (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) {
- miComputeCompositeClip(pGC, pDrawable);
+ GCClipYOrigin |
+ GCClipMask |
+ GCSubwindowMode)) ||
+ (pDrawable->serialNumber !=
+ (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) {
+ miComputeCompositeClip(pGC, pDrawable);
}
DMX_GC_FUNC_EPILOGUE(pGC);
@@ -187,12 +194,13 @@ void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
/** Set the values in the graphics context on the back-end server
* associated with \a pGC's screen. */
-void dmxChangeGC(GCPtr pGC, unsigned long mask)
+void
+dmxChangeGC(GCPtr pGC, unsigned long mask)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- XGCValues v;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ XGCValues v;
DMX_GC_FUNC_PROLOGUE(pGC);
#if 0
@@ -201,89 +209,113 @@ void dmxChangeGC(GCPtr pGC, unsigned long mask)
/* Handle "magic special case" from CreateGC */
if (pGCPriv->msc) {
- /* The "magic special case" is used to handle the case where a
- * foreground pixel is set when the GC is created so that a
- * "pseudo default-tile" can be created and used in case the
- * fillstyle was set to FillTiled. This specific case is tested
- * in xtest (XCreateGC test #3). What has happened in dix by
- * the time it reaches here is (1) the pGC->tile.pixel has been
- * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a
- * tile has also been set, then pGC->tileIsPixel is unset and
- * pGC->tile.pixmap is initialized; else, the default tile is
- * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is
- * initialized to the "pseudo default-tile". In either case,
- * pGC->tile.pixmap is set; however, in the "magic special case"
- * the mask is not updated to allow us to detect that we should
- * initialize the GCTile in the back-end server. Thus, we catch
- * this case in dmxCreateGC and add GCTile to the mask here.
- * Are there any cases that I've missed?
- */
-
- /* Make sure that the tile.pixmap is set, just in case the user
+ /* The "magic special case" is used to handle the case where a
+ * foreground pixel is set when the GC is created so that a
+ * "pseudo default-tile" can be created and used in case the
+ * fillstyle was set to FillTiled. This specific case is tested
+ * in xtest (XCreateGC test #3). What has happened in dix by
+ * the time it reaches here is (1) the pGC->tile.pixel has been
+ * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a
+ * tile has also been set, then pGC->tileIsPixel is unset and
+ * pGC->tile.pixmap is initialized; else, the default tile is
+ * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is
+ * initialized to the "pseudo default-tile". In either case,
+ * pGC->tile.pixmap is set; however, in the "magic special case"
+ * the mask is not updated to allow us to detect that we should
+ * initialize the GCTile in the back-end server. Thus, we catch
+ * this case in dmxCreateGC and add GCTile to the mask here.
+ * Are there any cases that I've missed?
+ */
+
+ /* Make sure that the tile.pixmap is set, just in case the user
* set GCTile in the mask but forgot to set vals.pixmap
- */
- if (pGC->tile.pixmap) mask |= GCTile;
+ */
+ if (pGC->tile.pixmap)
+ mask |= GCTile;
- /* This only happens once when the GC is created */
- pGCPriv->msc = FALSE;
+ /* This only happens once when the GC is created */
+ pGCPriv->msc = FALSE;
}
/* Update back-end server's gc */
- if (mask & GCFunction) v.function = pGC->alu;
- if (mask & GCPlaneMask) v.plane_mask = pGC->planemask;
- if (mask & GCForeground) v.foreground = pGC->fgPixel;
- if (mask & GCBackground) v.background = pGC->bgPixel;
- if (mask & GCLineWidth) v.line_width = pGC->lineWidth;
- if (mask & GCLineStyle) v.line_style = pGC->lineStyle;
- if (mask & GCCapStyle) v.cap_style = pGC->capStyle;
- if (mask & GCJoinStyle) v.join_style = pGC->joinStyle;
- if (mask & GCFillStyle) v.fill_style = pGC->fillStyle;
- if (mask & GCFillRule) v.fill_rule = pGC->fillRule;
+ if (mask & GCFunction)
+ v.function = pGC->alu;
+ if (mask & GCPlaneMask)
+ v.plane_mask = pGC->planemask;
+ if (mask & GCForeground)
+ v.foreground = pGC->fgPixel;
+ if (mask & GCBackground)
+ v.background = pGC->bgPixel;
+ if (mask & GCLineWidth)
+ v.line_width = pGC->lineWidth;
+ if (mask & GCLineStyle)
+ v.line_style = pGC->lineStyle;
+ if (mask & GCCapStyle)
+ v.cap_style = pGC->capStyle;
+ if (mask & GCJoinStyle)
+ v.join_style = pGC->joinStyle;
+ if (mask & GCFillStyle)
+ v.fill_style = pGC->fillStyle;
+ if (mask & GCFillRule)
+ v.fill_rule = pGC->fillRule;
if (mask & GCTile) {
- if (pGC->tileIsPixel) {
- mask &= ~GCTile;
- } else {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap);
- v.tile = (Drawable)pPixPriv->pixmap;
- }
+ if (pGC->tileIsPixel) {
+ mask &= ~GCTile;
+ }
+ else {
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap);
+
+ v.tile = (Drawable) pPixPriv->pixmap;
+ }
}
if (mask & GCStipple) {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple);
- v.stipple = (Drawable)pPixPriv->pixmap;
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple);
+
+ v.stipple = (Drawable) pPixPriv->pixmap;
}
- if (mask & GCTileStipXOrigin) v.ts_x_origin = pGC->patOrg.x;
- if (mask & GCTileStipYOrigin) v.ts_y_origin = pGC->patOrg.y;
+ if (mask & GCTileStipXOrigin)
+ v.ts_x_origin = pGC->patOrg.x;
+ if (mask & GCTileStipYOrigin)
+ v.ts_y_origin = pGC->patOrg.y;
if (mask & GCFont) {
- if (dmxScreen->beDisplay) {
- dmxFontPrivPtr pFontPriv;
- pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex);
- v.font = pFontPriv->font[pScreen->myNum]->fid;
- } else {
- mask &= ~GCFont;
- }
+ if (dmxScreen->beDisplay) {
+ dmxFontPrivPtr pFontPriv;
+
+ pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex);
+ v.font = pFontPriv->font[pScreen->myNum]->fid;
+ }
+ else {
+ mask &= ~GCFont;
+ }
}
- if (mask & GCSubwindowMode) v.subwindow_mode = pGC->subWindowMode;
+ if (mask & GCSubwindowMode)
+ v.subwindow_mode = pGC->subWindowMode;
/* Graphics exposures are not needed on the back-ends since they can
be generated on the front-end thereby saving bandwidth. */
- if (mask & GCGraphicsExposures) mask &= ~GCGraphicsExposures;
-
- if (mask & GCClipXOrigin) v.clip_x_origin = pGC->clipOrg.x;
- if (mask & GCClipYOrigin) v.clip_y_origin = pGC->clipOrg.y;
- if (mask & GCClipMask) mask &= ~GCClipMask; /* See ChangeClip */
- if (mask & GCDashOffset) v.dash_offset = pGC->dashOffset;
+ if (mask & GCGraphicsExposures)
+ mask &= ~GCGraphicsExposures;
+
+ if (mask & GCClipXOrigin)
+ v.clip_x_origin = pGC->clipOrg.x;
+ if (mask & GCClipYOrigin)
+ v.clip_y_origin = pGC->clipOrg.y;
+ if (mask & GCClipMask)
+ mask &= ~GCClipMask; /* See ChangeClip */
+ if (mask & GCDashOffset)
+ v.dash_offset = pGC->dashOffset;
if (mask & GCDashList) {
- mask &= ~GCDashList;
- if (dmxScreen->beDisplay)
- XSetDashes(dmxScreen->beDisplay, pGCPriv->gc,
- pGC->dashOffset, (char *)pGC->dash,
- pGC->numInDashList);
+ mask &= ~GCDashList;
+ if (dmxScreen->beDisplay)
+ XSetDashes(dmxScreen->beDisplay, pGCPriv->gc,
+ pGC->dashOffset, (char *) pGC->dash, pGC->numInDashList);
}
- if (mask & GCArcMode) v.arc_mode = pGC->arcMode;
+ if (mask & GCArcMode)
+ v.arc_mode = pGC->arcMode;
if (mask && dmxScreen->beDisplay) {
- XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v);
- dmxSync(dmxScreen, FALSE);
+ XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v);
+ dmxSync(dmxScreen, FALSE);
}
DMX_GC_FUNC_EPILOGUE(pGC);
@@ -291,34 +323,36 @@ void dmxChangeGC(GCPtr pGC, unsigned long mask)
/** Copy \a pGCSrc to \a pGCDst on the back-end server associated with
* \a pGCSrc's screen. */
-void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)
+void
+dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)
{
- ScreenPtr pScreen = pGCSrc->pScreen;
+ ScreenPtr pScreen = pGCSrc->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCSrcPriv = DMX_GET_GC_PRIV(pGCSrc);
- dmxGCPrivPtr pGCDstPriv = DMX_GET_GC_PRIV(pGCDst);
+ dmxGCPrivPtr pGCSrcPriv = DMX_GET_GC_PRIV(pGCSrc);
+ dmxGCPrivPtr pGCDstPriv = DMX_GET_GC_PRIV(pGCDst);
DMX_GC_FUNC_PROLOGUE(pGCDst);
pGCDst->funcs->CopyGC(pGCSrc, changes, pGCDst);
/* Copy the GC on the back-end server */
if (dmxScreen->beDisplay)
- XCopyGC(dmxScreen->beDisplay, pGCSrcPriv->gc, changes, pGCDstPriv->gc);
+ XCopyGC(dmxScreen->beDisplay, pGCSrcPriv->gc, changes, pGCDstPriv->gc);
DMX_GC_FUNC_EPILOGUE(pGCDst);
}
/** Free the \a pGC on the back-end server. */
-Bool dmxBEFreeGC(GCPtr pGC)
+Bool
+dmxBEFreeGC(GCPtr pGC)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
if (pGCPriv->gc) {
- XFreeGC(dmxScreen->beDisplay, pGCPriv->gc);
- pGCPriv->gc = NULL;
- return TRUE;
+ XFreeGC(dmxScreen->beDisplay, pGCPriv->gc);
+ pGCPriv->gc = NULL;
+ return TRUE;
}
return FALSE;
@@ -326,30 +360,32 @@ Bool dmxBEFreeGC(GCPtr pGC)
/** Destroy the graphics context, \a pGC and free the corresponding GC
* on the back-end server. */
-void dmxDestroyGC(GCPtr pGC)
+void
+dmxDestroyGC(GCPtr pGC)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
DMX_GC_FUNC_PROLOGUE(pGC);
/* Free the GC on the back-end server */
if (dmxScreen->beDisplay)
- dmxBEFreeGC(pGC);
+ dmxBEFreeGC(pGC);
pGC->funcs->DestroyGC(pGC);
DMX_GC_FUNC_EPILOGUE(pGC);
}
/** Change the clip rects for a GC. */
-void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+void
+dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- XRectangle *pRects;
- BoxPtr pBox;
- int i, nRects;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ XRectangle *pRects;
+ BoxPtr pBox;
+ int i, nRects;
DMX_GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ChangeClip(pGC, type, pvalue, nrects);
@@ -357,58 +393,60 @@ void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
/* Set the client clip on the back-end server */
switch (pGC->clientClipType) {
case CT_NONE:
- if (dmxScreen->beDisplay)
- XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
- break;
+ if (dmxScreen->beDisplay)
+ XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
+ break;
case CT_REGION:
- if (dmxScreen->beDisplay) {
- nRects = RegionNumRects((RegionPtr)pGC->clientClip);
- pRects = malloc(nRects * sizeof(*pRects));
- pBox = RegionRects((RegionPtr)pGC->clientClip);
-
- for (i = 0; i < nRects; i++) {
- pRects[i].x = pBox[i].x1;
- pRects[i].y = pBox[i].y1;
- pRects[i].width = pBox[i].x2 - pBox[i].x1;
- pRects[i].height = pBox[i].y2 - pBox[i].y1;
- }
-
- XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc,
- pGC->clipOrg.x, pGC->clipOrg.y,
- pRects, nRects, Unsorted);
-
- free(pRects);
- }
- break;
+ if (dmxScreen->beDisplay) {
+ nRects = RegionNumRects((RegionPtr) pGC->clientClip);
+ pRects = malloc(nRects * sizeof(*pRects));
+ pBox = RegionRects((RegionPtr) pGC->clientClip);
+
+ for (i = 0; i < nRects; i++) {
+ pRects[i].x = pBox[i].x1;
+ pRects[i].y = pBox[i].y1;
+ pRects[i].width = pBox[i].x2 - pBox[i].x1;
+ pRects[i].height = pBox[i].y2 - pBox[i].y1;
+ }
+
+ XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc,
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ pRects, nRects, Unsorted);
+
+ free(pRects);
+ }
+ break;
case CT_PIXMAP:
- /* Condensed down to REGION in the mi code */
- break;
+ /* Condensed down to REGION in the mi code */
+ break;
}
DMX_GC_FUNC_EPILOGUE(pGC);
}
/** Destroy a GC's clip rects. */
-void dmxDestroyClip(GCPtr pGC)
+void
+dmxDestroyClip(GCPtr pGC)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
DMX_GC_FUNC_PROLOGUE(pGC);
pGC->funcs->DestroyClip(pGC);
/* Set the client clip on the back-end server to None */
if (dmxScreen->beDisplay)
- XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
+ XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
DMX_GC_FUNC_EPILOGUE(pGC);
}
/** Copy a GC's clip rects. */
-void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
+void
+dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
{
DMX_GC_FUNC_PROLOGUE(pGCDst);
pGCDst->funcs->CopyClip(pGCDst, pGCSrc);
diff --git a/xorg-server/hw/dmx/dmxgcops.c b/xorg-server/hw/dmx/dmxgcops.c
index 500e2cdf1..19330668a 100644
--- a/xorg-server/hw/dmx/dmxgcops.c
+++ b/xorg-server/hw/dmx/dmxgcops.c
@@ -75,17 +75,17 @@ do { \
!DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw))->window)))
/** Fill spans -- this function should never be called. */
-void dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC,
- int nInit, DDXPointPtr pptInit, int *pwidthInit,
- int fSorted)
+void
+dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC,
+ int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)
{
/* Error -- this should never happen! */
}
/** Set spans -- this function should never be called. */
-void dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC,
- char *psrc, DDXPointPtr ppt, int *pwidth, int nspans,
- int fSorted)
+void
+dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC,
+ char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
/* Error -- this should never happen! */
}
@@ -94,73 +94,74 @@ void dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC,
* pDrawable's screen. If primitive subdivision optimization is
* enabled, then only transfer the sections of \a pBits that are
* visible (i.e., not-clipped) to the back-end server. */
-void dmxPutImage(DrawablePtr pDrawable, GCPtr pGC,
- int depth, int x, int y, int w, int h,
- int leftPad, int format, char *pBits)
+void
+dmxPutImage(DrawablePtr pDrawable, GCPtr pGC,
+ int depth, int x, int y, int w, int h,
+ int leftPad, int format, char *pBits)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- XImage *img;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ XImage *img;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
img = XCreateImage(dmxScreen->beDisplay,
- dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
- depth, format, leftPad, pBits, w, h,
- BitmapPad(dmxScreen->beDisplay),
- (format == ZPixmap) ?
- PixmapBytePad(w, depth) : BitmapBytePad(w+leftPad));
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ depth, format, leftPad, pBits, w, h,
+ BitmapPad(dmxScreen->beDisplay),
+ (format == ZPixmap) ?
+ PixmapBytePad(w, depth) : BitmapBytePad(w + leftPad));
if (img) {
- Drawable draw;
-
- DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
-
- if (dmxSubdividePrimitives && pGC->pCompositeClip) {
- RegionPtr pSubImages;
- RegionPtr pClip;
- BoxRec box;
- BoxPtr pBox;
- int nBox;
-
- box.x1 = x;
- box.y1 = y;
- box.x2 = x + w;
- box.y2 = y + h;
- pSubImages = RegionCreate(&box, 1);
-
- pClip = RegionCreate(NullBox, 1);
- RegionCopy(pClip, pGC->pCompositeClip);
- RegionTranslate(pClip,
- -pDrawable->x, -pDrawable->y);
- RegionIntersect(pSubImages, pSubImages, pClip);
-
- nBox = RegionNumRects(pSubImages);
- pBox = RegionRects(pSubImages);
-
- while (nBox--) {
- XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc, img,
- pBox->x1 - box.x1,
- pBox->y1 - box.y1,
- pBox->x1,
- pBox->y1,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1);
- pBox++;
- }
+ Drawable draw;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ if (dmxSubdividePrimitives && pGC->pCompositeClip) {
+ RegionPtr pSubImages;
+ RegionPtr pClip;
+ BoxRec box;
+ BoxPtr pBox;
+ int nBox;
+
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = x + w;
+ box.y2 = y + h;
+ pSubImages = RegionCreate(&box, 1);
+
+ pClip = RegionCreate(NullBox, 1);
+ RegionCopy(pClip, pGC->pCompositeClip);
+ RegionTranslate(pClip, -pDrawable->x, -pDrawable->y);
+ RegionIntersect(pSubImages, pSubImages, pClip);
+
+ nBox = RegionNumRects(pSubImages);
+ pBox = RegionRects(pSubImages);
+
+ while (nBox--) {
+ XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc, img,
+ pBox->x1 - box.x1,
+ pBox->y1 - box.y1,
+ pBox->x1,
+ pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
+ pBox++;
+ }
RegionDestroy(pClip);
RegionDestroy(pSubImages);
- } else {
- XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc,
- img, 0, 0, x, y, w, h);
- }
- XFree(img); /* Use XFree instead of XDestroyImage
+ }
+ else {
+ XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ img, 0, 0, x, y, w, h);
+ }
+ XFree(img); /* Use XFree instead of XDestroyImage
* because pBits is passed in from the
* caller. */
- dmxSync(dmxScreen, FALSE);
- } else {
- /* Error -- this should not happen! */
+ dmxSync(dmxScreen, FALSE);
+ }
+ else {
+ /* Error -- this should not happen! */
}
}
@@ -168,72 +169,75 @@ void dmxPutImage(DrawablePtr pDrawable, GCPtr pGC,
* server associated with \a pSrc drawable's screen. If the offscreen
* optimization is enabled, only copy when both \a pSrc and \a pDst are
* at least partially visible. */
-RegionPtr dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty)
+RegionPtr
+dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable srcDraw, dstDraw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable srcDraw, dstDraw;
if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst))
- return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h,
- dstx, dsty, 0L);
+ return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h,
+ dstx, dsty, 0L);
DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw);
DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw);
XCopyArea(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc,
- srcx, srcy, w, h, dstx, dsty);
+ srcx, srcy, w, h, dstx, dsty);
dmxSync(dmxScreen, FALSE);
- return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h,
- dstx, dsty, 0L);
+ return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, 0L);
}
/** Copy plane number \a bitPlane from \a pSrc drawable to \a pDst
* drawable on the back-end server associated with \a pSrc drawable's
* screen. If the offscreen optimization is enabled, only copy when
* both \a pSrc and \a pDst are at least partially visible. */
-RegionPtr dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long bitPlane)
+RegionPtr
+dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable srcDraw, dstDraw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable srcDraw, dstDraw;
if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst))
- return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height,
- dstx, dsty, bitPlane);
+ return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height,
+ dstx, dsty, bitPlane);
DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw);
DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw);
XCopyPlane(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc,
- srcx, srcy, width, height, dstx, dsty, bitPlane);
+ srcx, srcy, width, height, dstx, dsty, bitPlane);
dmxSync(dmxScreen, FALSE);
return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height,
- dstx, dsty, bitPlane);
+ dstx, dsty, bitPlane);
}
/** Render list of points, \a pptInit in \a pDrawable on the back-end
* server associated with \a pDrawable's screen. If the offscreen
* optimization is enabled, only draw when \a pDrawable is at least
* partially visible. */
-void dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr pptInit)
+void
+dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawPoints(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XPoint *)pptInit, npt, mode);
+ (XPoint *) pptInit, npt, mode);
dmxSync(dmxScreen, FALSE);
}
@@ -241,19 +245,21 @@ void dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC,
* back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-void dmxPolylines(DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr pptInit)
+void
+dmxPolylines(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawLines(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XPoint *)pptInit, npt, mode);
+ (XPoint *) pptInit, npt, mode);
dmxSync(dmxScreen, FALSE);
}
@@ -261,19 +267,20 @@ void dmxPolylines(DrawablePtr pDrawable, GCPtr pGC,
* back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-void dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC,
- int nseg, xSegment *pSegs)
+void
+dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawSegments(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XSegment *)pSegs, nseg);
+ (XSegment *) pSegs, nseg);
dmxSync(dmxScreen, FALSE);
}
@@ -281,19 +288,21 @@ void dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC,
* back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-void dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
- int nrects, xRectangle *pRects)
+void
+dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
+ int nrects, xRectangle *pRects)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XRectangle *)pRects, nrects);
+ (XRectangle *) pRects, nrects);
dmxSync(dmxScreen, FALSE);
}
@@ -302,19 +311,19 @@ void dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
* back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-void dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *parcs)
+void
+dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
- XDrawArcs(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XArc *)parcs, narcs);
+ XDrawArcs(dmxScreen->beDisplay, draw, pGCPriv->gc, (XArc *) parcs, narcs);
dmxSync(dmxScreen, FALSE);
}
@@ -322,19 +331,21 @@ void dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC,
* associated with \a pDrawable's screen. If the offscreen
* optimization is enabled, only draw when \a pDrawable is at least
* partially visible. */
-void dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
- int shape, int mode, int count, DDXPointPtr pPts)
+void
+dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr pPts)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XFillPolygon(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XPoint *)pPts, count, shape, mode);
+ (XPoint *) pPts, count, shape, mode);
dmxSync(dmxScreen, FALSE);
}
@@ -342,19 +353,21 @@ void dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
* the back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-void dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
- int nrectFill, xRectangle *prectInit)
+void
+dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XFillRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XRectangle *)prectInit, nrectFill);
+ (XRectangle *) prectInit, nrectFill);
dmxSync(dmxScreen, FALSE);
}
@@ -362,19 +375,19 @@ void dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
* server associated with \a pDrawable's screen. If the offscreen
* optimization is enabled, only draw when \a pDrawable is at least
* partially visible. */
-void dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *parcs)
+void
+dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
- XFillArcs(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XArc *)parcs, narcs);
+ XFillArcs(dmxScreen->beDisplay, draw, pGCPriv->gc, (XArc *) parcs, narcs);
dmxSync(dmxScreen, FALSE);
}
@@ -382,84 +395,90 @@ void dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
* the back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-int dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, char *chars)
+int
+dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- unsigned long n, i;
- int w;
- CharInfoPtr charinfo[255];
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255];
+ Drawable draw;
- GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
- Linear8Bit, &n, charinfo);
+ GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars,
+ Linear8Bit, &n, charinfo);
/* Calculate text width */
w = 0;
- for (i = 0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
+ for (i = 0; i < n; i++)
+ w += charinfo[i]->metrics.characterWidth;
if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) {
- DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
- XDrawString(dmxScreen->beDisplay, draw, pGCPriv->gc,
- x, y, chars, count);
- dmxSync(dmxScreen, FALSE);
+ XDrawString(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ x, y, chars, count);
+ dmxSync(dmxScreen, FALSE);
}
- return x+w;
+ return x + w;
}
/** Render string of 16-bit \a chars (foreground only) in \a pDrawable
* on the back-end server associated with \a pDrawable's screen. If
* the offscreen optimization is enabled, only draw when \a pDrawable
* is at least partially visible. */
-int dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, unsigned short *chars)
+int
+dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- unsigned long n, i;
- int w;
- CharInfoPtr charinfo[255];
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255];
+ Drawable draw;
- GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, charinfo);
+ GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
/* Calculate text width */
w = 0;
- for (i = 0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
+ for (i = 0; i < n; i++)
+ w += charinfo[i]->metrics.characterWidth;
if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) {
- DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
- XDrawString16(dmxScreen->beDisplay, draw, pGCPriv->gc,
- x, y, (XChar2b *)chars, count);
- dmxSync(dmxScreen, FALSE);
+ XDrawString16(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ x, y, (XChar2b *) chars, count);
+ dmxSync(dmxScreen, FALSE);
}
- return x+w;
+ return x + w;
}
/** Render string of 8-bit \a chars (both foreground and background) in
* \a pDrawable on the back-end server associated with \a pDrawable's
* screen. If the offscreen optimization is enabled, only draw when \a
* pDrawable is at least partially visible. */
-void dmxImageText8(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, char *chars)
+void
+dmxImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawImageString(dmxScreen->beDisplay, draw, pGCPriv->gc,
- x, y, chars, count);
+ x, y, chars, count);
dmxSync(dmxScreen, FALSE);
}
@@ -467,41 +486,46 @@ void dmxImageText8(DrawablePtr pDrawable, GCPtr pGC,
* \a pDrawable on the back-end server associated with \a pDrawable's
* screen. If the offscreen optimization is enabled, only draw when \a
* pDrawable is at least partially visible. */
-void dmxImageText16(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, unsigned short *chars)
+void
+dmxImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawImageString16(dmxScreen->beDisplay, draw, pGCPriv->gc,
- x, y, (XChar2b *)chars, count);
+ x, y, (XChar2b *) chars, count);
dmxSync(dmxScreen, FALSE);
}
/** Image Glyph Blt -- this function should never be called. */
-void dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
+void
+dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
{
/* Error -- this should never happen! */
}
/** Poly Glyph Blt -- this function should never be called. */
-void dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
+void
+dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
{
/* Error -- this should never happen! */
}
/** Push Pixels -- this function should never be called. */
-void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
- int w, int h, int x, int y)
+void
+dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+ int w, int h, int x, int y)
{
/* Error -- this should never happen! */
}
@@ -514,29 +538,32 @@ void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
* screen 0. When screen 0 is detached, the pixmaps must be obtained
* from any other screen that is not detached. Usually, this is screen
* 1. */
-static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
+static DMXScreenInfo *
+dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
{
#ifdef PANORAMIX
- PanoramiXRes *pXinPix;
- int i;
+ PanoramiXRes *pXinPix;
+ int i;
DMXScreenInfo *dmxScreen;
-
- if (noPanoramiXExtension) return NULL;
- if (pDrawable->type != DRAWABLE_PIXMAP) return NULL;
- if (Success != dixLookupResourceByType((pointer*) &pXinPix,
- pDrawable->id, XRT_PIXMAP,
- NullClient, DixUnknownAccess))
+ if (noPanoramiXExtension)
+ return NULL;
+ if (pDrawable->type != DRAWABLE_PIXMAP)
+ return NULL;
+
+ if (Success != dixLookupResourceByType((pointer *) &pXinPix,
+ pDrawable->id, XRT_PIXMAP,
+ NullClient, DixUnknownAccess))
return NULL;
FOR_NSCREENS_FORWARD_SKIP(i) {
dmxScreen = &dmxScreens[i];
if (dmxScreen->beDisplay) {
- PixmapPtr pSrc;
+ PixmapPtr pSrc;
dmxPixPrivPtr pSrcPriv;
-
- dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
- RT_PIXMAP, NullClient, DixUnknownAccess);
+
+ dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
if (pSrcPriv->pixmap) {
*draw = pSrcPriv->pixmap;
@@ -553,53 +580,58 @@ static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
* image from it. If it is not viewable, then get the image from the
* first ancestor of \a pDrawable that is viewable. If no viewable
* ancestor is found, then simply return without getting an image. */
-void dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
- unsigned int format, unsigned long planeMask, char *pdstLine)
+void
+dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planeMask, char *pdstLine)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- XImage *img;
- Drawable draw;
+ XImage *img;
+ Drawable draw;
/* Cannot get image from unviewable window */
if (pDrawable->type == DRAWABLE_WINDOW) {
- WindowPtr pWindow = (WindowPtr)pDrawable;
- if (!pWindow->viewable) {
- while (!pWindow->viewable && pWindow->parent) {
- sx += pWindow->origin.x - wBorderWidth(pWindow);
- sx += pWindow->origin.y - wBorderWidth(pWindow);
- pWindow = pWindow->parent;
- }
- if (!pWindow->viewable) {
- return;
- }
- }
- DMX_GCOPS_SET_DRAWABLE(&pWindow->drawable, draw);
- if (DMX_GCOPS_OFFSCREEN(&pWindow->drawable))
- return;
- } else {
- DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) {
+ WindowPtr pWindow = (WindowPtr) pDrawable;
+
+ if (!pWindow->viewable) {
+ while (!pWindow->viewable && pWindow->parent) {
+ sx += pWindow->origin.x - wBorderWidth(pWindow);
+ sx += pWindow->origin.y - wBorderWidth(pWindow);
+ pWindow = pWindow->parent;
+ }
+ if (!pWindow->viewable) {
+ return;
+ }
+ }
+ DMX_GCOPS_SET_DRAWABLE(&pWindow->drawable, draw);
+ if (DMX_GCOPS_OFFSCREEN(&pWindow->drawable))
+ return;
+ }
+ else {
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) {
/* Try to find the pixmap on a non-detached Xinerama screen */
dmxScreen = dmxFindAlternatePixmap(pDrawable, &draw);
- if (!dmxScreen) return;
+ if (!dmxScreen)
+ return;
}
}
img = XGetImage(dmxScreen->beDisplay, draw,
- sx, sy, w, h, planeMask, format);
+ sx, sy, w, h, planeMask, format);
if (img) {
- int len = img->bytes_per_line * img->height;
- memmove(pdstLine, img->data, len);
- XDestroyImage(img);
+ int len = img->bytes_per_line * img->height;
+
+ memmove(pdstLine, img->data, len);
+ XDestroyImage(img);
}
dmxSync(dmxScreen, FALSE);
}
/** Get Spans -- this function should never be called. */
-void dmxGetSpans(DrawablePtr pDrawable, int wMax,
- DDXPointPtr ppt, int *pwidth, int nspans,
- char *pdstStart)
+void
+dmxGetSpans(DrawablePtr pDrawable, int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)
{
/* Error -- this should never happen! */
}
diff --git a/xorg-server/hw/dmx/dmxinit.c b/xorg-server/hw/dmx/dmxinit.c
index 99223caa8..23a1385c6 100644
--- a/xorg-server/hw/dmx/dmxinit.c
+++ b/xorg-server/hw/dmx/dmxinit.c
@@ -55,8 +55,8 @@
#include "dmxstat.h"
#include "dmxpict.h"
-#include <X11/Xos.h> /* For gettimeofday */
-#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
+#include <X11/Xos.h> /* For gettimeofday */
+#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
#include "dixstruct.h"
#ifdef PANORAMIX
#include "panoramiXsrv.h"
@@ -70,91 +70,94 @@
#include "dmx_glxvisuals.h"
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
-#endif /* GLXEXT */
+#endif /* GLXEXT */
/* Global variables available to all Xserver/hw/dmx routines. */
-int dmxNumScreens;
-DMXScreenInfo *dmxScreens;
+int dmxNumScreens;
+DMXScreenInfo *dmxScreens;
-int dmxNumInputs;
-DMXInputInfo *dmxInputs;
+int dmxNumInputs;
+DMXInputInfo *dmxInputs;
-int dmxShadowFB = FALSE;
+int dmxShadowFB = FALSE;
-XErrorEvent dmxLastErrorEvent;
-Bool dmxErrorOccurred = FALSE;
+XErrorEvent dmxLastErrorEvent;
+Bool dmxErrorOccurred = FALSE;
-char *dmxFontPath = NULL;
+char *dmxFontPath = NULL;
-Bool dmxOffScreenOpt = TRUE;
+Bool dmxOffScreenOpt = TRUE;
-Bool dmxSubdividePrimitives = TRUE;
+Bool dmxSubdividePrimitives = TRUE;
-Bool dmxLazyWindowCreation = TRUE;
+Bool dmxLazyWindowCreation = TRUE;
-Bool dmxUseXKB = TRUE;
+Bool dmxUseXKB = TRUE;
-int dmxDepth = 0;
+int dmxDepth = 0;
#ifndef GLXEXT
-static Bool dmxGLXProxy = FALSE;
+static Bool dmxGLXProxy = FALSE;
#else
-Bool dmxGLXProxy = TRUE;
+Bool dmxGLXProxy = TRUE;
-Bool dmxGLXSwapGroupSupport = TRUE;
+Bool dmxGLXSwapGroupSupport = TRUE;
-Bool dmxGLXSyncSwap = FALSE;
+Bool dmxGLXSyncSwap = FALSE;
-Bool dmxGLXFinishSwap = FALSE;
+Bool dmxGLXFinishSwap = FALSE;
#endif
-Bool dmxIgnoreBadFontPaths = FALSE;
+Bool dmxIgnoreBadFontPaths = FALSE;
-Bool dmxAddRemoveScreens = FALSE;
+Bool dmxAddRemoveScreens = FALSE;
/* dmxErrorHandler catches errors that occur when calling one of the
* back-end servers. Some of this code is based on _XPrintDefaultError
* in xc/lib/X11/XlibInt.c */
-static int dmxErrorHandler(Display *dpy, XErrorEvent *ev)
+static int
+dmxErrorHandler(Display * dpy, XErrorEvent * ev)
{
#define DMX_ERROR_BUF_SIZE 256
- /* RATS: these buffers are only used in
- * length-limited calls. */
- char buf[DMX_ERROR_BUF_SIZE];
- char request[DMX_ERROR_BUF_SIZE];
+ /* RATS: these buffers are only used in
+ * length-limited calls. */
+ char buf[DMX_ERROR_BUF_SIZE];
+ char request[DMX_ERROR_BUF_SIZE];
_XExtension *ext = NULL;
- dmxErrorOccurred = TRUE;
+ dmxErrorOccurred = TRUE;
dmxLastErrorEvent = *ev;
XGetErrorText(dpy, ev->error_code, buf, sizeof(buf));
dmxLog(dmxWarning, "dmxErrorHandler: %s\n", buf);
- /* Find major opcode name */
+ /* Find major opcode name */
if (ev->request_code < 128) {
snprintf(request, sizeof(request), "%d", ev->request_code);
XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
- } else {
+ }
+ else {
for (ext = dpy->ext_procs;
ext && ext->codes.major_opcode != ev->request_code;
ext = ext->next);
- if (ext) strlcpy(buf, ext->name, sizeof(buf));
- else buf[0] = '\0';
+ if (ext)
+ strlcpy(buf, ext->name, sizeof(buf));
+ else
+ buf[0] = '\0';
}
dmxLog(dmxWarning, " Major opcode: %d (%s)\n",
ev->request_code, buf);
- /* Find minor opcode name */
+ /* Find minor opcode name */
if (ev->request_code >= 128 && ext) {
snprintf(request, sizeof(request), "%d", ev->request_code);
- snprintf(request, sizeof(request), "%s.%d",
- ext->name, ev->minor_code);
+ snprintf(request, sizeof(request), "%s.%d", ext->name, ev->minor_code);
XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
dmxLog(dmxWarning, " Minor opcode: %d (%s)\n",
ev->minor_code, buf);
}
- /* Provide value information */
+ /* Provide value information */
switch (ev->error_code) {
case BadValue:
dmxLog(dmxWarning, " Value: 0x%x\n",
@@ -170,7 +173,7 @@ static int dmxErrorHandler(Display *dpy, XErrorEvent *ev)
break;
}
- /* Provide serial number information */
+ /* Provide serial number information */
dmxLog(dmxWarning, " Failed serial number: %d\n",
ev->serial);
dmxLog(dmxWarning, " Current serial number: %d\n",
@@ -179,47 +182,53 @@ static int dmxErrorHandler(Display *dpy, XErrorEvent *ev)
}
#ifdef GLXEXT
-static int dmxNOPErrorHandler(Display *dpy, XErrorEvent *ev)
+static int
+dmxNOPErrorHandler(Display * dpy, XErrorEvent * ev)
{
return 0;
}
#endif
-Bool dmxOpenDisplay(DMXScreenInfo *dmxScreen)
+Bool
+dmxOpenDisplay(DMXScreenInfo * dmxScreen)
{
if (!(dmxScreen->beDisplay = XOpenDisplay(dmxScreen->name)))
- return FALSE;
+ return FALSE;
dmxPropertyDisplay(dmxScreen);
return TRUE;
}
-void dmxSetErrorHandler(DMXScreenInfo *dmxScreen)
+void
+dmxSetErrorHandler(DMXScreenInfo * dmxScreen)
{
XSetErrorHandler(dmxErrorHandler);
}
-static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen)
+static void
+dmxPrintScreenInfo(DMXScreenInfo * dmxScreen)
{
XWindowAttributes attribs;
- int ndepths = 0, *depths = NULL;
- int i;
- Display *dpy = dmxScreen->beDisplay;
- Screen *s = DefaultScreenOfDisplay(dpy);
- int scr = DefaultScreen(dpy);
+ int ndepths = 0, *depths = NULL;
+ int i;
+ Display *dpy = dmxScreen->beDisplay;
+ Screen *s = DefaultScreenOfDisplay(dpy);
+ int scr = DefaultScreen(dpy);
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
- if (!(depths = XListDepths(dpy, scr, &ndepths))) ndepths = 0;
-
+ if (!(depths = XListDepths(dpy, scr, &ndepths)))
+ ndepths = 0;
+
dmxLogOutput(dmxScreen, "Name of display: %s\n", DisplayString(dpy));
dmxLogOutput(dmxScreen, "Version number: %d.%d\n",
ProtocolVersion(dpy), ProtocolRevision(dpy));
dmxLogOutput(dmxScreen, "Vendor string: %s\n", ServerVendor(dpy));
if (!strstr(ServerVendor(dpy), "XFree86")) {
dmxLogOutput(dmxScreen, "Vendor release: %d\n", VendorRelease(dpy));
- } else {
- /* This code based on xdpyinfo.c */
- int v = VendorRelease(dpy);
+ }
+ else {
+ /* This code based on xdpyinfo.c */
+ int v = VendorRelease(dpy);
int major = -1, minor = -1, patch = -1, subpatch = -1;
if (v < 336)
@@ -229,27 +238,33 @@ static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen)
minor = (v / 100) % 10;
if (((v / 10) % 10) || (v % 10)) {
patch = (v / 10) % 10;
- if (v % 10) subpatch = v % 10;
+ if (v % 10)
+ subpatch = v % 10;
}
- } else if (v < 40000000) {
+ }
+ else if (v < 40000000) {
major = v / 1000;
minor = (v / 10) % 10;
- if (v % 10) patch = v % 10;
- } else {
+ if (v % 10)
+ patch = v % 10;
+ }
+ else {
major = v / 10000000;
minor = (v / 100000) % 100;
patch = (v / 1000) % 100;
- if (v % 1000) subpatch = v % 1000;
- }
+ if (v % 1000)
+ subpatch = v % 1000;
+ }
dmxLogOutput(dmxScreen, "Vendor release: %d (XFree86 version: %d.%d",
v, major, minor);
- if (patch > 0) dmxLogOutputCont(dmxScreen, ".%d", patch);
- if (subpatch > 0) dmxLogOutputCont(dmxScreen, ".%d", subpatch);
+ if (patch > 0)
+ dmxLogOutputCont(dmxScreen, ".%d", patch);
+ if (subpatch > 0)
+ dmxLogOutputCont(dmxScreen, ".%d", subpatch);
dmxLogOutputCont(dmxScreen, ")\n");
}
-
- dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n",
+ dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n",
attribs.width, attribs.height);
dmxLogOutput(dmxScreen, "%d depths on screen %d: ", ndepths, scr);
for (i = 0; i < ndepths; i++)
@@ -261,59 +276,65 @@ static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen)
dmxLogOutput(dmxScreen, "Number of colormaps: %d min, %d max\n",
MinCmapsOfScreen(s), MaxCmapsOfScreen(s));
dmxLogOutput(dmxScreen, "Options: backing-store %s, save-unders %s\n",
- (DoesBackingStore (s) == NotUseful) ? "no" :
- ((DoesBackingStore (s) == Always) ? "yes" : "when mapped"),
- DoesSaveUnders (s) ? "yes" : "no");
+ (DoesBackingStore(s) == NotUseful) ? "no" :
+ ((DoesBackingStore(s) == Always) ? "yes" : "when mapped"),
+ DoesSaveUnders(s) ? "yes" : "no");
dmxLogOutput(dmxScreen, "Window Manager running: %s\n",
- (dmxScreen->WMRunningOnBE) ? "yes" : "no");
+ (dmxScreen->WMRunningOnBE) ? "yes" : "no");
if (dmxScreen->WMRunningOnBE) {
- dmxLogOutputWarning(dmxScreen,
- "Window manager running "
- "-- colormaps not supported\n");
+ dmxLogOutputWarning(dmxScreen,
+ "Window manager running "
+ "-- colormaps not supported\n");
}
XFree(depths);
}
-void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
+void
+dmxGetScreenAttribs(DMXScreenInfo * dmxScreen)
{
XWindowAttributes attribs;
- Display *dpy = dmxScreen->beDisplay;
+ Display *dpy = dmxScreen->beDisplay;
+
#ifdef GLXEXT
- int dummy;
+ int dummy;
#endif
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
- dmxScreen->beWidth = attribs.width;
+ dmxScreen->beWidth = attribs.width;
dmxScreen->beHeight = attribs.height;
-
- /* Fill in missing geometry information */
+
+ /* Fill in missing geometry information */
if (dmxScreen->scrnXSign < 0) {
if (dmxScreen->scrnWidth) {
- dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth
- - dmxScreen->scrnX);
- } else {
- dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
- dmxScreen->scrnX = 0;
+ dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth
+ - dmxScreen->scrnX);
+ }
+ else {
+ dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
+ dmxScreen->scrnX = 0;
}
}
if (dmxScreen->scrnYSign < 0) {
if (dmxScreen->scrnHeight) {
- dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight
- - dmxScreen->scrnY);
- } else {
+ dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight
+ - dmxScreen->scrnY);
+ }
+ else {
dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
- dmxScreen->scrnY = 0;
+ dmxScreen->scrnY = 0;
}
}
if (!dmxScreen->scrnWidth)
- dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
+ dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
if (!dmxScreen->scrnHeight)
dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
- if (!dmxScreen->rootWidth) dmxScreen->rootWidth = dmxScreen->scrnWidth;
- if (!dmxScreen->rootHeight) dmxScreen->rootHeight = dmxScreen->scrnHeight;
+ if (!dmxScreen->rootWidth)
+ dmxScreen->rootWidth = dmxScreen->scrnWidth;
+ if (!dmxScreen->rootHeight)
+ dmxScreen->rootHeight = dmxScreen->scrnHeight;
if (dmxScreen->rootWidth + dmxScreen->rootX > dmxScreen->scrnWidth)
dmxScreen->rootWidth = dmxScreen->scrnWidth - dmxScreen->rootX;
if (dmxScreen->rootHeight + dmxScreen->rootY > dmxScreen->scrnHeight)
@@ -323,22 +344,25 @@ void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
dmxScreen->beXDPI = 75;
dmxScreen->beYDPI = 75;
- dmxScreen->beDepth = attribs.depth; /* FIXME: verify that this
- * works always. In
- * particular, this will work
- * well for depth=16, will fail
- * because of colormap issues
- * at depth 8. More work needs
- * to be done here. */
-
- if (dmxScreen->beDepth <= 8) dmxScreen->beBPP = 8;
- else if (dmxScreen->beDepth <= 16) dmxScreen->beBPP = 16;
- else dmxScreen->beBPP = 32;
+ dmxScreen->beDepth = attribs.depth; /* FIXME: verify that this
+ * works always. In
+ * particular, this will work
+ * well for depth=16, will fail
+ * because of colormap issues
+ * at depth 8. More work needs
+ * to be done here. */
+
+ if (dmxScreen->beDepth <= 8)
+ dmxScreen->beBPP = 8;
+ else if (dmxScreen->beDepth <= 16)
+ dmxScreen->beBPP = 16;
+ else
+ dmxScreen->beBPP = 32;
#ifdef GLXEXT
/* get the majorOpcode for the back-end GLX extension */
XQueryExtension(dpy, "GLX", &dmxScreen->glxMajorOpcode,
- &dummy, &dmxScreen->glxErrorBase);
+ &dummy, &dmxScreen->glxErrorBase);
#endif
dmxPrintScreenInfo(dmxScreen);
@@ -352,47 +376,50 @@ void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
"Support for depth == 8 is not complete\n");
}
-Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen)
+Bool
+dmxGetVisualInfo(DMXScreenInfo * dmxScreen)
{
int i;
XVisualInfo visinfo;
visinfo.screen = DefaultScreen(dmxScreen->beDisplay);
dmxScreen->beVisuals = XGetVisualInfo(dmxScreen->beDisplay,
- VisualScreenMask,
- &visinfo,
- &dmxScreen->beNumVisuals);
+ VisualScreenMask,
+ &visinfo, &dmxScreen->beNumVisuals);
dmxScreen->beDefVisualIndex = -1;
if (defaultColorVisualClass >= 0 || dmxDepth > 0) {
- for (i = 0; i < dmxScreen->beNumVisuals; i++)
- if (defaultColorVisualClass >= 0) {
- if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) {
- if (dmxDepth > 0) {
- if (dmxScreen->beVisuals[i].depth == dmxDepth) {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
- } else {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
- }
- } else if (dmxScreen->beVisuals[i].depth == dmxDepth) {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
- } else {
- visinfo.visualid =
- XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay,
- visinfo.screen));
-
- for (i = 0; i < dmxScreen->beNumVisuals; i++)
- if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ if (defaultColorVisualClass >= 0) {
+ if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) {
+ if (dmxDepth > 0) {
+ if (dmxScreen->beVisuals[i].depth == dmxDepth) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
+ else {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
+ }
+ else if (dmxScreen->beVisuals[i].depth == dmxDepth) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
+ else {
+ visinfo.visualid =
+ XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay,
+ visinfo.screen));
+
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
}
for (i = 0; i < dmxScreen->beNumVisuals; i++)
@@ -402,44 +429,45 @@ Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen)
return dmxScreen->beDefVisualIndex >= 0;
}
-void dmxGetColormaps(DMXScreenInfo *dmxScreen)
+void
+dmxGetColormaps(DMXScreenInfo * dmxScreen)
{
int i;
dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals;
dmxScreen->beDefColormaps = malloc(dmxScreen->beNumDefColormaps *
- sizeof(*dmxScreen->beDefColormaps));
+ sizeof(*dmxScreen->beDefColormaps));
for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
- dmxScreen->beDefColormaps[i] =
- XCreateColormap(dmxScreen->beDisplay,
- DefaultRootWindow(dmxScreen->beDisplay),
- dmxScreen->beVisuals[i].visual,
- AllocNone);
+ dmxScreen->beDefColormaps[i] =
+ XCreateColormap(dmxScreen->beDisplay,
+ DefaultRootWindow(dmxScreen->beDisplay),
+ dmxScreen->beVisuals[i].visual, AllocNone);
dmxScreen->beBlackPixel = BlackPixel(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay));
+ DefaultScreen(dmxScreen->beDisplay));
dmxScreen->beWhitePixel = WhitePixel(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay));
+ DefaultScreen(dmxScreen->beDisplay));
}
-void dmxGetPixmapFormats(DMXScreenInfo *dmxScreen)
+void
+dmxGetPixmapFormats(DMXScreenInfo * dmxScreen)
{
dmxScreen->beDepths =
- XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay),
- &dmxScreen->beNumDepths);
+ XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay),
+ &dmxScreen->beNumDepths);
dmxScreen->bePixmapFormats =
- XListPixmapFormats(dmxScreen->beDisplay,
- &dmxScreen->beNumPixmapFormats);
+ XListPixmapFormats(dmxScreen->beDisplay,
+ &dmxScreen->beNumPixmapFormats);
}
-static Bool dmxSetPixmapFormats(ScreenInfo *pScreenInfo,
- DMXScreenInfo *dmxScreen)
+static Bool
+dmxSetPixmapFormats(ScreenInfo * pScreenInfo, DMXScreenInfo * dmxScreen)
{
XPixmapFormatValues *bePixmapFormat;
- PixmapFormatRec *format;
- int i, j;
+ PixmapFormatRec *format;
+ int i, j;
pScreenInfo->imageByteOrder = ImageByteOrder(dmxScreen->beDisplay);
pScreenInfo->bitmapScanlineUnit = BitmapUnit(dmxScreen->beDisplay);
@@ -448,53 +476,54 @@ static Bool dmxSetPixmapFormats(ScreenInfo *pScreenInfo,
pScreenInfo->numPixmapFormats = 0;
for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- bePixmapFormat = &dmxScreen->bePixmapFormats[i];
- for (j = 0; j < dmxScreen->beNumDepths; j++)
- if ((bePixmapFormat->depth == 1) ||
- (bePixmapFormat->depth == dmxScreen->beDepths[j])) {
- format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats];
-
- format->depth = bePixmapFormat->depth;
- format->bitsPerPixel = bePixmapFormat->bits_per_pixel;
- format->scanlinePad = bePixmapFormat->scanline_pad;
-
- pScreenInfo->numPixmapFormats++;
- break;
- }
+ bePixmapFormat = &dmxScreen->bePixmapFormats[i];
+ for (j = 0; j < dmxScreen->beNumDepths; j++)
+ if ((bePixmapFormat->depth == 1) ||
+ (bePixmapFormat->depth == dmxScreen->beDepths[j])) {
+ format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats];
+
+ format->depth = bePixmapFormat->depth;
+ format->bitsPerPixel = bePixmapFormat->bits_per_pixel;
+ format->scanlinePad = bePixmapFormat->scanline_pad;
+
+ pScreenInfo->numPixmapFormats++;
+ break;
+ }
}
return TRUE;
}
-void dmxCheckForWM(DMXScreenInfo *dmxScreen)
+void
+dmxCheckForWM(DMXScreenInfo * dmxScreen)
{
Status status;
XWindowAttributes xwa;
status = XGetWindowAttributes(dmxScreen->beDisplay,
- DefaultRootWindow(dmxScreen->beDisplay),
- &xwa);
+ DefaultRootWindow(dmxScreen->beDisplay),
+ &xwa);
dmxScreen->WMRunningOnBE =
- (status &&
- ((xwa.all_event_masks & SubstructureRedirectMask) ||
- (xwa.all_event_masks & SubstructureNotifyMask)));
+ (status &&
+ ((xwa.all_event_masks & SubstructureRedirectMask) ||
+ (xwa.all_event_masks & SubstructureNotifyMask)));
}
/** Initialize the display and collect relevant information about the
* display properties */
-static void dmxDisplayInit(DMXScreenInfo *dmxScreen)
+static void
+dmxDisplayInit(DMXScreenInfo * dmxScreen)
{
if (!dmxOpenDisplay(dmxScreen))
- dmxLog(dmxFatal,
- "dmxOpenDisplay: Unable to open display %s\n",
- dmxScreen->name);
+ dmxLog(dmxFatal,
+ "dmxOpenDisplay: Unable to open display %s\n", dmxScreen->name);
dmxSetErrorHandler(dmxScreen);
dmxCheckForWM(dmxScreen);
dmxGetScreenAttribs(dmxScreen);
if (!dmxGetVisualInfo(dmxScreen))
- dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n");
+ dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n");
dmxGetColormaps(dmxScreen);
dmxGetPixmapFormats(dmxScreen);
@@ -503,45 +532,52 @@ static void dmxDisplayInit(DMXScreenInfo *dmxScreen)
/* If this doesn't compile, just add || defined(yoursystem) to the line
* below. This information is to help with bug reports and is not
* critical. */
-#if !defined(_POSIX_SOURCE)
-static const char *dmxExecOS(void) { return ""; }
+#if !defined(_POSIX_SOURCE)
+static const char *
+dmxExecOS(void)
+{
+ return "";
+}
#else
#include <sys/utsname.h>
-static const char *dmxExecOS(void)
+static const char *
+dmxExecOS(void)
{
static char buffer[128];
- static int initialized = 0;
+ static int initialized = 0;
struct utsname u;
if (!initialized++) {
memset(buffer, 0, sizeof(buffer));
uname(&u);
- snprintf(buffer, sizeof(buffer)-1, "%s %s %s",
- u.sysname, u.release, u.version);
+ snprintf(buffer, sizeof(buffer) - 1, "%s %s %s",
+ u.sysname, u.release, u.version);
}
return buffer;
}
#endif
-static const char *dmxBuildCompiler(void)
+static const char *
+dmxBuildCompiler(void)
{
static char buffer[128];
- static int initialized = 0;
+ static int initialized = 0;
if (!initialized++) {
memset(buffer, 0, sizeof(buffer));
#if defined(__GNUC__) && defined(__GNUC_MINOR__) &&defined(__GNUC_PATCHLEVEL__)
- snprintf(buffer, sizeof(buffer)-1, "gcc %d.%d.%d",
- __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
+ snprintf(buffer, sizeof(buffer) - 1, "gcc %d.%d.%d",
+ __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#endif
}
return buffer;
}
-static const char *dmxExecHost(void)
+static const char *
+dmxExecHost(void)
{
static char buffer[128];
- static int initialized = 0;
+ static int initialized = 0;
if (!initialized++) {
memset(buffer, 0, sizeof(buffer));
@@ -551,32 +587,35 @@ static const char *dmxExecHost(void)
}
/** This routine is called in Xserver/dix/main.c from \a main(). */
-void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
+void
+InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
{
- int i;
+ int i;
static unsigned long dmxGeneration = 0;
+
#ifdef GLXEXT
- Bool glxSupported = TRUE;
+ Bool glxSupported = TRUE;
#endif
if (dmxGeneration != serverGeneration) {
- int vendrel = VENDOR_RELEASE;
+ int vendrel = VENDOR_RELEASE;
int major, minor, year, month, day;
-
+
dmxGeneration = serverGeneration;
- major = vendrel / 100000000;
- vendrel -= major * 100000000;
- minor = vendrel / 1000000;
- vendrel -= minor * 1000000;
- year = vendrel / 10000;
- vendrel -= year * 10000;
- month = vendrel / 100;
- vendrel -= month * 100;
- day = vendrel;
+ major = vendrel / 100000000;
+ vendrel -= major * 100000000;
+ minor = vendrel / 1000000;
+ vendrel -= minor * 1000000;
+ year = vendrel / 10000;
+ vendrel -= year * 10000;
+ month = vendrel / 100;
+ vendrel -= month * 100;
+ day = vendrel;
- /* Add other epoch tests here */
- if (major > 0 && minor > 0) year += 2000;
+ /* Add other epoch tests here */
+ if (major > 0 && minor > 0)
+ year += 2000;
dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
dmxLog(dmxInfo, "DMX version: %d.%d.%02d%02d%02d (%s)\n",
@@ -600,32 +639,33 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
dmxStatFree(dmxScreens[i].stat);
dmxScreens[i].stat = NULL;
}
- for (i = 0; i < dmxNumInputs; i++) dmxInputFree(&dmxInputs[i]);
+ for (i = 0; i < dmxNumInputs; i++)
+ dmxInputFree(&dmxInputs[i]);
free(dmxScreens);
free(dmxInputs);
- dmxScreens = NULL;
- dmxInputs = NULL;
+ dmxScreens = NULL;
+ dmxInputs = NULL;
dmxNumScreens = 0;
- dmxNumInputs = 0;
+ dmxNumInputs = 0;
}
/* Make sure that the command-line arguments are sane. */
if (dmxAddRemoveScreens && dmxGLXProxy) {
- /* Currently it is not possible to support GLX and Render
- * extensions with dynamic screen addition/removal due to the
- * state that each extension keeps, which cannot be restored. */
+ /* Currently it is not possible to support GLX and Render
+ * extensions with dynamic screen addition/removal due to the
+ * state that each extension keeps, which cannot be restored. */
dmxLog(dmxWarning,
- "GLX Proxy and Render extensions do not yet support dynamic\n");
+ "GLX Proxy and Render extensions do not yet support dynamic\n");
dmxLog(dmxWarning,
- "screen addition and removal. Please specify -noglxproxy\n");
+ "screen addition and removal. Please specify -noglxproxy\n");
dmxLog(dmxWarning,
- "and -norender on the command line or in the configuration\n");
+ "and -norender on the command line or in the configuration\n");
dmxLog(dmxWarning,
- "file to disable these two extensions if you wish to use\n");
+ "file to disable these two extensions if you wish to use\n");
dmxLog(dmxWarning,
- "the dynamic addition and removal of screens support.\n");
+ "the dynamic addition and removal of screens support.\n");
dmxLog(dmxFatal,
- "Dynamic screen addition/removal error (see above).\n");
+ "Dynamic screen addition/removal error (see above).\n");
}
/* ddxProcessArgument has been called at this point, but any data
@@ -636,17 +676,16 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
dmxLog(dmxFatal, "InitOutput: no back-end displays found\n");
if (!dmxNumInputs)
dmxLog(dmxInfo, "InitOutput: no inputs found\n");
-
+
/* Disable lazy window creation optimization if offscreen
* optimization is disabled */
if (!dmxOffScreenOpt && dmxLazyWindowCreation) {
dmxLog(dmxInfo,
- "InitOutput: Disabling lazy window creation optimization\n");
+ "InitOutput: Disabling lazy window creation optimization\n");
dmxLog(dmxInfo,
- " since it requires the offscreen optimization\n");
- dmxLog(dmxInfo,
- " to function properly.\n");
- dmxLazyWindowCreation = FALSE;
+ " since it requires the offscreen optimization\n");
+ dmxLog(dmxInfo, " to function properly.\n");
+ dmxLazyWindowCreation = FALSE;
}
/* Open each display and gather information about it. */
@@ -662,8 +701,9 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
#endif
/* Since we only have a single screen thus far, we only need to set
- the pixmap formats to match that screen. FIXME: this isn't true.*/
- if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0])) return;
+ the pixmap formats to match that screen. FIXME: this isn't true. */
+ if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0]))
+ return;
/* Might want to install a signal handler to allow cleaning up after
* unexpected signals. The DIX/OS layer already handles SIGINT and
@@ -682,93 +722,95 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
#ifdef GLXEXT
/* Check if GLX extension exists on all back-end servers */
for (i = 0; i < dmxNumScreens; i++)
- glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
+ glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
#endif
/* Tell dix layer about the backend displays */
for (i = 0; i < dmxNumScreens; i++) {
#ifdef GLXEXT
- if (glxSupported) {
- /*
- * Builds GLX configurations from the list of visuals
- * supported by the back-end server, and give that
- * configuration list to the glx layer - so that he will
- * build the visuals accordingly.
- */
-
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- __GLXvisualConfig *configs = NULL;
- dmxGlxVisualPrivate **configprivs = NULL;
- int nconfigs = 0;
- int (*oldErrorHandler)(Display *, XErrorEvent *);
- int i;
-
- /* Catch errors if when using an older GLX w/o FBconfigs */
- oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
-
- /* Get FBConfigs of the back-end server */
- dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay,
- dmxScreen->glxMajorOpcode,
- &dmxScreen->numFBConfigs);
-
- XSetErrorHandler(oldErrorHandler);
-
- dmxScreen->glxVisuals =
- GetGLXVisualConfigs(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay),
- &dmxScreen->numGlxVisuals);
-
- if (dmxScreen->fbconfigs) {
- configs =
- GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs,
- dmxScreen->numFBConfigs,
- dmxScreen->beVisuals,
- dmxScreen->beNumVisuals,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals,
- &nconfigs);
- } else {
- configs = dmxScreen->glxVisuals;
- nconfigs = dmxScreen->numGlxVisuals;
- }
-
- configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate*));
-
- if (configs != NULL && configprivs != NULL) {
-
- /* Initialize our private info for each visual
- * (currently only x_visual_depth and x_visual_class)
- */
- for (i = 0; i < nconfigs; i++) {
-
- configprivs[i] = (dmxGlxVisualPrivate *)
- malloc(sizeof(dmxGlxVisualPrivate));
- configprivs[i]->x_visual_depth = 0;
- configprivs[i]->x_visual_class = 0;
-
- /* Find the visual depth */
- if (configs[i].vid > 0) {
- int j;
- for (j = 0; j < dmxScreen->beNumVisuals; j++) {
- if (dmxScreen->beVisuals[j].visualid ==
- configs[i].vid) {
- configprivs[i]->x_visual_depth =
- dmxScreen->beVisuals[j].depth;
- configprivs[i]->x_visual_class =
- dmxScreen->beVisuals[j].class;
- break;
- }
- }
- }
- }
+ if (glxSupported) {
+ /*
+ * Builds GLX configurations from the list of visuals
+ * supported by the back-end server, and give that
+ * configuration list to the glx layer - so that he will
+ * build the visuals accordingly.
+ */
+
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ __GLXvisualConfig *configs = NULL;
+ dmxGlxVisualPrivate **configprivs = NULL;
+ int nconfigs = 0;
+ int (*oldErrorHandler) (Display *, XErrorEvent *);
+ int i;
+
+ /* Catch errors if when using an older GLX w/o FBconfigs */
+ oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
+
+ /* Get FBConfigs of the back-end server */
+ dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay,
+ dmxScreen->glxMajorOpcode,
+ &dmxScreen->numFBConfigs);
+
+ XSetErrorHandler(oldErrorHandler);
+
+ dmxScreen->glxVisuals =
+ GetGLXVisualConfigs(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay),
+ &dmxScreen->numGlxVisuals);
+
+ if (dmxScreen->fbconfigs) {
+ configs =
+ GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs,
+ dmxScreen->numFBConfigs,
+ dmxScreen->beVisuals,
+ dmxScreen->beNumVisuals,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals,
+ &nconfigs);
+ }
+ else {
+ configs = dmxScreen->glxVisuals;
+ nconfigs = dmxScreen->numGlxVisuals;
+ }
+
+ configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate *));
+
+ if (configs != NULL && configprivs != NULL) {
+
+ /* Initialize our private info for each visual
+ * (currently only x_visual_depth and x_visual_class)
+ */
+ for (i = 0; i < nconfigs; i++) {
+
+ configprivs[i] = (dmxGlxVisualPrivate *)
+ malloc(sizeof(dmxGlxVisualPrivate));
+ configprivs[i]->x_visual_depth = 0;
+ configprivs[i]->x_visual_class = 0;
+
+ /* Find the visual depth */
+ if (configs[i].vid > 0) {
+ int j;
+
+ for (j = 0; j < dmxScreen->beNumVisuals; j++) {
+ if (dmxScreen->beVisuals[j].visualid ==
+ configs[i].vid) {
+ configprivs[i]->x_visual_depth =
+ dmxScreen->beVisuals[j].depth;
+ configprivs[i]->x_visual_class =
+ dmxScreen->beVisuals[j].class;
+ break;
+ }
+ }
+ }
+ }
XFlush(dmxScreen->beDisplay);
- }
- }
-#endif /* GLXEXT */
+ }
+ }
+#endif /* GLXEXT */
- AddScreen(dmxScreenInit, argc, argv);
+ AddScreen(dmxScreenInit, argc, argv);
}
/* Compute origin information. */
@@ -787,30 +829,32 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
/* Initialize the render extension */
if (!noRenderExtension)
- dmxInitRender();
+ dmxInitRender();
/* Initialized things that need timer hooks */
dmxStatInit();
dmxSyncInit(); /* Calls RegisterBlockAndWakeupHandlers */
dmxLog(dmxInfo, "Shadow framebuffer support %s\n",
- dmxShadowFB ? "enabled" : "disabled");
+ dmxShadowFB ? "enabled" : "disabled");
}
/* RATS: Assuming the fp string (which comes from the command-line argv
vector) is NULL-terminated, the buffer is large enough for the
- strcpy. */
-static void dmxSetDefaultFontPath(const char *fp)
+ strcpy. */
+static void
+dmxSetDefaultFontPath(const char *fp)
{
if (dmxFontPath) {
- int fplen = strlen(fp) + 1;
- int len = strlen(dmxFontPath);
-
- dmxFontPath = realloc(dmxFontPath, len+fplen+1);
- dmxFontPath[len] = ',';
- strncpy(&dmxFontPath[len+1], fp, fplen);
- } else {
- dmxFontPath = strdup(fp);
+ int fplen = strlen(fp) + 1;
+ int len = strlen(dmxFontPath);
+
+ dmxFontPath = realloc(dmxFontPath, len + fplen + 1);
+ dmxFontPath[len] = ',';
+ strncpy(&dmxFontPath[len + 1], fp, fplen);
+ }
+ else {
+ dmxFontPath = strdup(fp);
}
defaultFontPath = dmxFontPath;
@@ -819,21 +863,24 @@ static void dmxSetDefaultFontPath(const char *fp)
/** This function is called in Xserver/os/utils.c from \a AbortServer().
* We must ensure that backend and console state is restored in the
* event the server shutdown wasn't clean. */
-void AbortDDX(enum ExitCode error)
+void
+AbortDDX(enum ExitCode error)
{
int i;
- for (i=0; i < dmxNumScreens; i++) {
+ for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i];
-
- if (dmxScreen->beDisplay) XCloseDisplay(dmxScreen->beDisplay);
+
+ if (dmxScreen->beDisplay)
+ XCloseDisplay(dmxScreen->beDisplay);
dmxScreen->beDisplay = NULL;
}
}
#ifdef DDXBEFORERESET
/* This function is called in Xserver/dix/dispatch.c */
-void ddxBeforeReset(void)
+void
+ddxBeforeReset(void)
{
}
#endif
@@ -841,13 +888,15 @@ void ddxBeforeReset(void)
/** This function is called in Xserver/dix/main.c from \a main() when
* dispatchException & DE_TERMINATE (which is the only way to exit the
* main loop without an interruption. */
-void ddxGiveUp(enum ExitCode error)
+void
+ddxGiveUp(enum ExitCode error)
{
AbortDDX(error);
}
/** This function is called in Xserver/os/osinit.c from \a OsInit(). */
-void OsVendorInit(void)
+void
+OsVendorInit(void)
{
}
@@ -856,100 +905,134 @@ void OsVendorInit(void)
* OsVendorVErrorFProc will cause \a VErrorF() (which is called by the
* two routines mentioned here, as well as by others) to use the
* referenced routine instead of \a vfprintf().) */
-void OsVendorFatalError(void)
+void
+OsVendorFatalError(void)
{
}
/** Process our command line arguments. */
-int ddxProcessArgument(int argc, char *argv[], int i)
+int
+ddxProcessArgument(int argc, char *argv[], int i)
{
int retval = 0;
-
+
if (!strcmp(argv[i], "-display")) {
- if (++i < argc) dmxConfigStoreDisplay(argv[i]);
+ if (++i < argc)
+ dmxConfigStoreDisplay(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-inputfrom") || !strcmp(argv[i], "-input")) {
- if (++i < argc) dmxConfigStoreInput(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-inputfrom") || !strcmp(argv[i], "-input")) {
+ if (++i < argc)
+ dmxConfigStoreInput(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-xinputfrom") || !strcmp(argv[i],"-xinput")) {
- if (++i < argc) dmxConfigStoreXInput(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-xinputfrom") || !strcmp(argv[i], "-xinput")) {
+ if (++i < argc)
+ dmxConfigStoreXInput(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-noshadowfb")) {
+ }
+ else if (!strcmp(argv[i], "-noshadowfb")) {
dmxLog(dmxWarning,
"-noshadowfb has been deprecated "
- "since it is now the default\n");
- dmxShadowFB = FALSE;
- retval = 1;
- } else if (!strcmp(argv[i], "-nomulticursor")) {
+ "since it is now the default\n");
+ dmxShadowFB = FALSE;
+ retval = 1;
+ }
+ else if (!strcmp(argv[i], "-nomulticursor")) {
dmxCursorNoMulti();
- retval = 1;
- } else if (!strcmp(argv[i], "-shadowfb")) {
- dmxShadowFB = TRUE;
- retval = 1;
- } else if (!strcmp(argv[i], "-configfile")) {
- if (++i < argc) dmxConfigStoreFile(argv[i]);
+ retval = 1;
+ }
+ else if (!strcmp(argv[i], "-shadowfb")) {
+ dmxShadowFB = TRUE;
+ retval = 1;
+ }
+ else if (!strcmp(argv[i], "-configfile")) {
+ if (++i < argc)
+ dmxConfigStoreFile(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-config")) {
- if (++i < argc) dmxConfigStoreConfig(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-config")) {
+ if (++i < argc)
+ dmxConfigStoreConfig(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-fontpath")) {
- if (++i < argc) dmxSetDefaultFontPath(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-fontpath")) {
+ if (++i < argc)
+ dmxSetDefaultFontPath(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-stat")) {
- if ((i += 2) < argc) dmxStatActivate(argv[i-1], argv[i]);
+ }
+ else if (!strcmp(argv[i], "-stat")) {
+ if ((i += 2) < argc)
+ dmxStatActivate(argv[i - 1], argv[i]);
retval = 3;
- } else if (!strcmp(argv[i], "-syncbatch")) {
- if (++i < argc) dmxSyncActivate(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-syncbatch")) {
+ if (++i < argc)
+ dmxSyncActivate(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-nooffscreenopt")) {
- dmxOffScreenOpt = FALSE;
+ }
+ else if (!strcmp(argv[i], "-nooffscreenopt")) {
+ dmxOffScreenOpt = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-nosubdivprims")) {
- dmxSubdividePrimitives = FALSE;
+ }
+ else if (!strcmp(argv[i], "-nosubdivprims")) {
+ dmxSubdividePrimitives = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-nowindowopt")) {
- dmxLazyWindowCreation = FALSE;
+ }
+ else if (!strcmp(argv[i], "-nowindowopt")) {
+ dmxLazyWindowCreation = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-noxkb")) {
- dmxUseXKB = FALSE;
+ }
+ else if (!strcmp(argv[i], "-noxkb")) {
+ dmxUseXKB = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-depth")) {
- if (++i < argc) dmxDepth = atoi(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-depth")) {
+ if (++i < argc)
+ dmxDepth = atoi(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-norender")) {
- noRenderExtension = TRUE;
+ }
+ else if (!strcmp(argv[i], "-norender")) {
+ noRenderExtension = TRUE;
retval = 1;
#ifdef GLXEXT
- } else if (!strcmp(argv[i], "-noglxproxy")) {
- dmxGLXProxy = FALSE;
+ }
+ else if (!strcmp(argv[i], "-noglxproxy")) {
+ dmxGLXProxy = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-noglxswapgroup")) {
- dmxGLXSwapGroupSupport = FALSE;
+ }
+ else if (!strcmp(argv[i], "-noglxswapgroup")) {
+ dmxGLXSwapGroupSupport = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-glxsyncswap")) {
- dmxGLXSyncSwap = TRUE;
+ }
+ else if (!strcmp(argv[i], "-glxsyncswap")) {
+ dmxGLXSyncSwap = TRUE;
retval = 1;
- } else if (!strcmp(argv[i], "-glxfinishswap")) {
- dmxGLXFinishSwap = TRUE;
+ }
+ else if (!strcmp(argv[i], "-glxfinishswap")) {
+ dmxGLXFinishSwap = TRUE;
retval = 1;
#endif
- } else if (!strcmp(argv[i], "-ignorebadfontpaths")) {
- dmxIgnoreBadFontPaths = TRUE;
+ }
+ else if (!strcmp(argv[i], "-ignorebadfontpaths")) {
+ dmxIgnoreBadFontPaths = TRUE;
retval = 1;
- } else if (!strcmp(argv[i], "-addremovescreens")) {
- dmxAddRemoveScreens = TRUE;
+ }
+ else if (!strcmp(argv[i], "-addremovescreens")) {
+ dmxAddRemoveScreens = TRUE;
retval = 1;
- } else if (!strcmp(argv[i], "-param")) {
+ }
+ else if (!strcmp(argv[i], "-param")) {
if ((i += 2) < argc) {
- if (!strcasecmp(argv[i-1], "xkbrules"))
+ if (!strcasecmp(argv[i - 1], "xkbrules"))
dmxConfigSetXkbRules(argv[i]);
- else if (!strcasecmp(argv[i-1], "xkbmodel"))
+ else if (!strcasecmp(argv[i - 1], "xkbmodel"))
dmxConfigSetXkbModel(argv[i]);
- else if (!strcasecmp(argv[i-1], "xkblayout"))
+ else if (!strcasecmp(argv[i - 1], "xkblayout"))
dmxConfigSetXkbLayout(argv[i]);
- else if (!strcasecmp(argv[i-1], "xkbvariant"))
+ else if (!strcasecmp(argv[i - 1], "xkbvariant"))
dmxConfigSetXkbVariant(argv[i]);
- else if (!strcasecmp(argv[i-1], "xkboptions"))
+ else if (!strcasecmp(argv[i - 1], "xkboptions"))
dmxConfigSetXkbOptions(argv[i]);
else
dmxLog(dmxWarning,
@@ -958,12 +1041,14 @@ int ddxProcessArgument(int argc, char *argv[], int i)
}
retval = 3;
}
- if (!serverGeneration) dmxConfigSetMaxScreens();
+ if (!serverGeneration)
+ dmxConfigSetMaxScreens();
return retval;
}
/** Provide succinct usage information for the DMX server. */
-void ddxUseMsg(void)
+void
+ddxUseMsg(void)
{
ErrorF("\n\nDevice Dependent Usage:\n");
ErrorF("-display string Specify the back-end display(s)\n");
@@ -991,7 +1076,8 @@ void ddxUseMsg(void)
ErrorF("-glxsyncswap Force XSync after swap buffers\n");
ErrorF("-glxfinishswap Force glFinish after swap buffers\n");
#endif
- ErrorF("-ignorebadfontpaths Ignore bad font paths during initialization\n");
+ ErrorF
+ ("-ignorebadfontpaths Ignore bad font paths during initialization\n");
ErrorF("-addremovescreens Enable dynamic screen addition/removal\n");
ErrorF("-param ... Specify configuration parameters (e.g.,\n");
ErrorF(" XkbRules, XkbModel, XkbLayout, etc.)\n");
@@ -1003,13 +1089,13 @@ void ddxUseMsg(void)
" that display in addition to the backend input. This is\n"
" useful if the backend window does not cover the whole\n"
" physical display.\n\n");
-
+
ErrorF(" Otherwise, if the -input or -xinput string specifies another\n"
" X display, then a console window will be created on that\n"
" display. Placing \",windows\" or \",nowindows\" after the\n"
" display name will control the display of window outlines in\n"
" the console.\n\n");
-
+
ErrorF(" -input or -xinput dummy specifies no input.\n");
ErrorF(" -input or -xinput local specifies the use of a raw keyboard,\n"
" mouse, or other (extension) device:\n"
@@ -1018,7 +1104,7 @@ void ddxUseMsg(void)
" -input local,usb-kbd,usb-mou will use USB devices \n"
" -xinput local,usb-oth will use a non-mouse and\n"
" non-keyboard USB device with XInput\n\n");
-
+
ErrorF(" Special Keys:\n");
ErrorF(" Ctrl-Alt-g Server grab/ungrab (console only)\n");
ErrorF(" Ctrl-Alt-f Fine (1-pixel) mouse mode (console only)\n");
diff --git a/xorg-server/hw/dmx/dmxinput.c b/xorg-server/hw/dmx/dmxinput.c
index f006af4d2..4ccb43903 100644
--- a/xorg-server/hw/dmx/dmxinput.c
+++ b/xorg-server/hw/dmx/dmxinput.c
@@ -53,7 +53,8 @@
/** Returns TRUE if the key is a valid modifier. For PC-class
* keyboards, all keys can be used as modifiers, so return TRUE
* always. */
-Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
@@ -61,21 +62,23 @@ Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
/** Called from dix/main.c on each server generation to initialize
* inputs. All the work is done in dmxInputInit. \see
* dmxInputInit() */
-void InitInput(int argc, char **argv)
+void
+InitInput(int argc, char **argv)
{
- int i;
+ int i;
DMXInputInfo *dmxInput;
if (!dmxNumInputs)
dmxLog(dmxFatal, "InitInput: no inputs specified\n");
-
+
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
dmxInputInit(dmxInput);
mieqInit();
}
-void CloseInput(void)
+void
+CloseInput(void)
{
mieqFini();
}
@@ -83,9 +86,10 @@ void CloseInput(void)
/** Called from dix/dispatch.c in Dispatch() whenever input events
* require processing. All the work is done in the lower level
* routines. */
-void ProcessInputEvents(void)
+void
+ProcessInputEvents(void)
{
- int i;
+ int i;
DMXInputInfo *dmxInput;
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
@@ -97,9 +101,10 @@ void ProcessInputEvents(void)
* windows on the display might have changed. This information is used
* by input drivers (currently only the console driver) that provide
* information about window layout to the user. */
-void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow)
+void
+dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow)
{
- int i;
+ int i;
DMXInputInfo *dmxInput;
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
@@ -108,8 +113,8 @@ void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow)
}
int
-NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
- DeviceIntPtr *pdev)
+NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
+ DeviceIntPtr *pdev)
{
return BadRequest;
}
diff --git a/xorg-server/hw/dmx/dmxinput.h b/xorg-server/hw/dmx/dmxinput.h
index edfff9fa1..83c9c8b95 100644
--- a/xorg-server/hw/dmx/dmxinput.h
+++ b/xorg-server/hw/dmx/dmxinput.h
@@ -43,7 +43,7 @@
* hw/dmx/input -- the interface defined here should be the only
* interface exported to the hw/dmx layer. \see input/dmxinputinit.c.
*/
-
+
#ifndef DMXINPUT_H
#define DMXINPUT_H
@@ -62,9 +62,9 @@ typedef enum {
DMX_UPDATE_REPARENT /**< Window reparented */
} DMXUpdateType;
-typedef void (*ProcessInputEventsProc)(struct _DMXInputInfo *);
-typedef void (*UpdateWindowInfoProc)(struct _DMXInputInfo *,
- DMXUpdateType, WindowPtr);
+typedef void (*ProcessInputEventsProc) (struct _DMXInputInfo *);
+typedef void (*UpdateWindowInfoProc) (struct _DMXInputInfo *,
+ DMXUpdateType, WindowPtr);
/** An opaque structure that is only exposed in the dmx/input layer. */
typedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr;
@@ -82,79 +82,79 @@ typedef enum {
* access to the global pointers. However, the elements are only
* available to input-related routines. */
struct _DMXInputInfo {
- const char *name; /**< Name of input display or device
+ const char *name; /**< Name of input display or device
* (from command line or config
* file) */
- Bool freename; /**< If true, free name on destroy */
- Bool detached; /**< If true, input screen is detached */
- int inputIdx; /**< Index into #dmxInputs global */
- int scrnIdx; /**< Index into #dmxScreens global */
- Bool core; /**< If True, initialize these
+ Bool freename; /**< If true, free name on destroy */
+ Bool detached; /**< If true, input screen is detached */
+ int inputIdx; /**< Index into #dmxInputs global */
+ int scrnIdx; /**< Index into #dmxScreens global */
+ Bool core; /**< If True, initialize these
* devices as devices that send core
* events */
- Bool console; /**< True if console and backend
+ Bool console; /**< True if console and backend
* input share the same backend
* display */
- Bool windows; /**< True if window outlines are
+ Bool windows; /**< True if window outlines are
* draw in console */
- ProcessInputEventsProc processInputEvents;
- UpdateWindowInfoProc updateWindowInfo;
+ ProcessInputEventsProc processInputEvents;
+ UpdateWindowInfoProc updateWindowInfo;
- /* Local input information */
- dmxSigioState sigioState; /**< Current stat */
- int sigioFdCount; /**< Number of fds in use */
- int sigioFd[DMX_MAX_SIGIO_FDS]; /**< List of fds */
- Bool sigioAdded[DMX_MAX_SIGIO_FDS]; /**< Active fds */
+ /* Local input information */
+ dmxSigioState sigioState; /**< Current stat */
+ int sigioFdCount; /**< Number of fds in use */
+ int sigioFd[DMX_MAX_SIGIO_FDS]; /**< List of fds */
+ Bool sigioAdded[DMX_MAX_SIGIO_FDS]; /**< Active fds */
-
/** True if a VT switch is pending, but has not yet happened. */
- int vt_switch_pending;
+ int vt_switch_pending;
/** True if a VT switch has happened. */
- int vt_switched;
+ int vt_switched;
/** Number of devices handled in this _DMXInputInfo structure. */
- int numDevs;
+ int numDevs;
/** List of actual input devices. Each _DMXInputInfo structure can
* refer to more than one device. For example, the keyboard and the
* pointer of a backend display; or all of the XInput extension
* devices on a backend display. */
- DMXLocalInputInfoPtr *devs;
+ DMXLocalInputInfoPtr *devs;
- char *keycodes; /**< XKB keycodes from command line */
- char *symbols; /**< XKB symbols from command line */
- char *geometry; /**< XKB geometry from command line */
+ char *keycodes; /**< XKB keycodes from command line */
+ char *symbols; /**< XKB symbols from command line */
+ char *geometry; /**< XKB geometry from command line */
};
-extern int dmxNumInputs; /**< Number of #dmxInputs */
-extern DMXInputInfo *dmxInputs; /**< List of inputs */
+extern int dmxNumInputs; /**< Number of #dmxInputs */
+extern DMXInputInfo *dmxInputs; /**< List of inputs */
-extern void dmxInputInit(DMXInputInfo *dmxInput);
-extern void dmxInputReInit(DMXInputInfo *dmxInput);
-extern void dmxInputLateReInit(DMXInputInfo *dmxInput);
-extern void dmxInputFree(DMXInputInfo *dmxInput);
+extern void dmxInputInit(DMXInputInfo * dmxInput);
+extern void dmxInputReInit(DMXInputInfo * dmxInput);
+extern void dmxInputLateReInit(DMXInputInfo * dmxInput);
+extern void dmxInputFree(DMXInputInfo * dmxInput);
extern void dmxInputLogDevices(void);
extern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow);
/* These functions are defined in input/dmxeq.c */
-extern void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool fromDIX);
+extern void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen,
+ Bool fromDIX);
/* This type is used in input/dmxevents.c. Also, these functions are
* defined in input/dmxevents.c */
typedef enum {
DMX_NO_BLOCK = 0,
- DMX_BLOCK = 1
+ DMX_BLOCK = 1
} DMXBlockType;
-extern void dmxGetGlobalPosition(int *x, int *y);
+extern void dmxGetGlobalPosition(int *x, int *y);
extern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
-extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta,
- DMXBlockType block);
+extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta,
+ DMXBlockType block);
/* Support for dynamic addition of inputs. This functions is defined in
* config/dmxconfig.c */
extern DMXInputInfo *dmxConfigAddInput(const char *name, int core);
-#endif /* DMXINPUT_H */
+#endif /* DMXINPUT_H */
diff --git a/xorg-server/hw/dmx/dmxlog.c b/xorg-server/hw/dmx/dmxlog.c
index 94b803528..b56bb93ed 100644
--- a/xorg-server/hw/dmx/dmxlog.c
+++ b/xorg-server/hw/dmx/dmxlog.c
@@ -49,16 +49,20 @@ static dmxLogLevel dmxCurrentLogLevel = dmxDebug;
/** Set the default level for logging to #dmxLogLevel. Returns the
* previous log level. */
-dmxLogLevel dmxSetLogLevel(dmxLogLevel newLevel)
+dmxLogLevel
+dmxSetLogLevel(dmxLogLevel newLevel)
{
dmxLogLevel oldLevel = dmxCurrentLogLevel;
- if (newLevel > dmxFatal) newLevel = dmxFatal;
+
+ if (newLevel > dmxFatal)
+ newLevel = dmxFatal;
dmxCurrentLogLevel = newLevel;
return oldLevel;
}
/** Returns the log level set by #dmxLogLevel. */
-dmxLogLevel dmxGetLogLevel(void)
+dmxLogLevel
+dmxGetLogLevel(void)
{
return dmxCurrentLogLevel;
}
@@ -68,37 +72,41 @@ dmxLogLevel dmxGetLogLevel(void)
* program, then the ultimate output routines have to be defined. */
/** Provide an ErrorF function when used stand-alone. */
-void ErrorF(const char *format, ...)
+void
+ErrorF(const char *format, ...)
{
va_list args;
va_start(args, format);
- vfprintf(stderr, format, args); /* RATS: We assume the format string
- * is trusted, since it is always
- * from a log message in our code. */
+ vfprintf(stderr, format, args); /* RATS: We assume the format string
+ * is trusted, since it is always
+ * from a log message in our code. */
va_end(args);
}
/** Provide an VFatalError function when used stand-alone. */
-static void VFatalError(const char *format, va_list args)
+static void
+VFatalError(const char *format, va_list args)
{
- vfprintf(stderr, format, args); /* RATS: We assume the format string
- * is trusted, since it is always
- * from a log message in our code. */
+ vfprintf(stderr, format, args); /* RATS: We assume the format string
+ * is trusted, since it is always
+ * from a log message in our code. */
exit(1);
}
/** Provide an VErrorF function when used stand-alone. */
-void VErrorF(const char *format, va_list args)
+void
+VErrorF(const char *format, va_list args)
{
- vfprintf(stderr, format, args); /* RATS: We assume the format string
- * is trusted, since it is always
- * from a log message in our code. */
+ vfprintf(stderr, format, args); /* RATS: We assume the format string
+ * is trusted, since it is always
+ * from a log message in our code. */
}
#else
/** This function was removed between XFree86 4.3.0 and XFree86 4.4.0. */
extern void AbortServer(void);
-static void VFatalError(const char *format, va_list args)
+static void
+VFatalError(const char *format, va_list args)
{
VErrorF(format, args);
ErrorF("\n");
@@ -106,60 +114,75 @@ static void VFatalError(const char *format, va_list args)
OsVendorFatalError();
#endif
AbortServer();
- /*NOTREACHED*/
-}
+ /*NOTREACHED*/}
#endif
/* Prints a consistent header for each line. */
-static void dmxHeader(dmxLogLevel logLevel, DMXInputInfo *dmxInput,
- DMXScreenInfo *dmxScreen)
+static void
+dmxHeader(dmxLogLevel logLevel, DMXInputInfo * dmxInput,
+ DMXScreenInfo * dmxScreen)
{
const char *type = "??";
switch (logLevel) {
- case dmxDebug: type = ".."; break;
- case dmxInfo: type = "II"; break;
- case dmxWarning: type = "**"; break;
- case dmxError: type = "!!"; break;
- case dmxFatal: type = "Fatal Error"; break;
+ case dmxDebug:
+ type = "..";
+ break;
+ case dmxInfo:
+ type = "II";
+ break;
+ case dmxWarning:
+ type = "**";
+ break;
+ case dmxError:
+ type = "!!";
+ break;
+ case dmxFatal:
+ type = "Fatal Error";
+ break;
}
if (dmxInput && dmxScreen) {
ErrorF("(%s) dmx[i%d/%s;o%d/%s]: ", type,
dmxInput->inputIdx, dmxInput->name,
dmxScreen->index, dmxScreen->name);
- } else if (dmxScreen) {
- ErrorF("(%s) dmx[o%d/%s]: ", type,
- dmxScreen->index, dmxScreen->name);
- } else if (dmxInput) {
+ }
+ else if (dmxScreen) {
+ ErrorF("(%s) dmx[o%d/%s]: ", type, dmxScreen->index, dmxScreen->name);
+ }
+ else if (dmxInput) {
const char *pt = strchr(dmxInput->name, ',');
- int len = (pt
- ? (size_t)(pt-dmxInput->name)
- : strlen(dmxInput->name));
+ int len = (pt ? (size_t) (pt - dmxInput->name)
+ : strlen(dmxInput->name));
ErrorF("(%s) dmx[i%d/%*.*s]: ", type,
dmxInput->inputIdx, len, len, dmxInput->name);
- } else {
+ }
+ else {
ErrorF("(%s) dmx: ", type);
}
}
/* Prints the error message with the appropriate low-level X output
* routine. */
-static void dmxMessage(dmxLogLevel logLevel, const char *format, va_list args)
+static void
+dmxMessage(dmxLogLevel logLevel, const char *format, va_list args)
{
if (logLevel == dmxFatal || logLevel >= dmxCurrentLogLevel) {
- if (logLevel == dmxFatal) VFatalError(format, args);
- else VErrorF(format, args);
+ if (logLevel == dmxFatal)
+ VFatalError(format, args);
+ else
+ VErrorF(format, args);
}
}
/** Log the specified message at the specified \a logLevel. \a format
* can be a printf-like format expression. */
-void dmxLog(dmxLogLevel logLevel, const char *format, ...)
+void
+dmxLog(dmxLogLevel logLevel, const char *format, ...)
{
va_list args;
-
+
dmxHeader(logLevel, NULL, NULL);
va_start(args, format);
dmxMessage(logLevel, format, args);
@@ -167,7 +190,8 @@ void dmxLog(dmxLogLevel logLevel, const char *format, ...)
}
/** Continue a log message without printing the message prefix. */
-void dmxLogCont(dmxLogLevel logLevel, const char *format, ...)
+void
+dmxLogCont(dmxLogLevel logLevel, const char *format, ...)
{
va_list args;
@@ -180,7 +204,8 @@ void dmxLogCont(dmxLogLevel logLevel, const char *format, ...)
/** Log an informational message (at level #dmxInfo) related to ouput.
* The message prefix will contain backend information from \a
* dmxScreen. */
-void dmxLogOutput(DMXScreenInfo *dmxScreen, const char *format, ...)
+void
+dmxLogOutput(DMXScreenInfo * dmxScreen, const char *format, ...)
{
va_list args;
@@ -192,7 +217,8 @@ void dmxLogOutput(DMXScreenInfo *dmxScreen, const char *format, ...)
/** Continue a message related to output without printing the message
* prefix. */
-void dmxLogOutputCont(DMXScreenInfo *dmxScreen, const char *format, ...)
+void
+dmxLogOutputCont(DMXScreenInfo * dmxScreen, const char *format, ...)
{
va_list args;
@@ -204,7 +230,8 @@ void dmxLogOutputCont(DMXScreenInfo *dmxScreen, const char *format, ...)
/** Log a warning message (at level #dmxWarning) related to output.
* The message prefix will contain backend information from \a
* dmxScreen. */
-void dmxLogOutputWarning(DMXScreenInfo *dmxScreen, const char *format, ...)
+void
+dmxLogOutputWarning(DMXScreenInfo * dmxScreen, const char *format, ...)
{
va_list args;
@@ -216,7 +243,8 @@ void dmxLogOutputWarning(DMXScreenInfo *dmxScreen, const char *format, ...)
/** Log an informational message (at level #dmxInfo) related to input.
* The message prefix will contain information from \a dmxInput. */
-void dmxLogInput(DMXInputInfo *dmxInput, const char *format, ...)
+void
+dmxLogInput(DMXInputInfo * dmxInput, const char *format, ...)
{
va_list args;
@@ -228,7 +256,8 @@ void dmxLogInput(DMXInputInfo *dmxInput, const char *format, ...)
/** Continue a message related to input without printing the message
* prefix. */
-void dmxLogInputCont(DMXInputInfo *dmxInput, const char *format, ...)
+void
+dmxLogInputCont(DMXInputInfo * dmxInput, const char *format, ...)
{
va_list args;
@@ -239,25 +268,40 @@ void dmxLogInputCont(DMXInputInfo *dmxInput, const char *format, ...)
/** Print \a argc messages, each describing an element in \a argv. This
* is maingly for debugging purposes. */
-void dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv)
+void
+dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv)
{
int i;
+
for (i = 0; i < argc; i++)
dmxLog(logLevel, " Arg[%d] = \"%s\"\n", i, argv[i]);
}
/** Print messages at level #dmxInfo describing the visuals in \a vi. */
-void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi, int defaultVisual)
+void
+dmxLogVisual(DMXScreenInfo * dmxScreen, XVisualInfo * vi, int defaultVisual)
{
- const char *class = "Unknown";
+ const char *class = "Unknown";
switch (vi->class) {
- case StaticGray: class = "StaticGray "; break;
- case GrayScale: class = "GrayScale "; break;
- case StaticColor: class = "StaticColor"; break;
- case PseudoColor: class = "PseudoColor"; break;
- case TrueColor: class = "TrueColor "; break;
- case DirectColor: class = "DirectColor"; break;
+ case StaticGray:
+ class = "StaticGray ";
+ break;
+ case GrayScale:
+ class = "GrayScale ";
+ break;
+ case StaticColor:
+ class = "StaticColor";
+ break;
+ case PseudoColor:
+ class = "PseudoColor";
+ break;
+ case TrueColor:
+ class = "TrueColor ";
+ break;
+ case DirectColor:
+ class = "DirectColor";
+ break;
}
if (dmxScreen) {
@@ -267,7 +311,8 @@ void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi, int defaultVisual)
vi->colormap_size,
vi->red_mask, vi->green_mask, vi->blue_mask,
defaultVisual ? " *" : "");
- } else {
+ }
+ else {
dmxLog(dmxInfo,
" 0x%02x %s %2db %db/rgb %3d 0x%04x 0x%04x 0x%04x%s\n",
vi->visualid, class, vi->depth, vi->bits_per_rgb,
@@ -279,68 +324,119 @@ void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi, int defaultVisual)
/** Translate a (normalized) XInput event \a type into a human-readable
* string. */
-const char *dmxXInputEventName(int type)
+const char *
+dmxXInputEventName(int type)
{
switch (type) {
- case XI_DeviceValuator: return "XI_DeviceValuator";
- case XI_DeviceKeyPress: return "XI_DeviceKeyPress";
- case XI_DeviceKeyRelease: return "XI_DeviceKeyRelease";
- case XI_DeviceButtonPress: return "XI_DeviceButtonPress";
- case XI_DeviceButtonRelease: return "XI_DeviceButtonRelease";
- case XI_DeviceMotionNotify: return "XI_DeviceMotionNotify";
- case XI_DeviceFocusIn: return "XI_DeviceFocusIn";
- case XI_DeviceFocusOut: return "XI_DeviceFocusOut";
- case XI_ProximityIn: return "XI_ProximityIn";
- case XI_ProximityOut: return "XI_ProximityOut";
- case XI_DeviceStateNotify: return "XI_DeviceStateNotify";
- case XI_DeviceMappingNotify: return "XI_DeviceMappingNotify";
- case XI_ChangeDeviceNotify: return "XI_ChangeDeviceNotify";
- case XI_DeviceKeystateNotify: return "XI_DeviceKeystateNotify";
- case XI_DeviceButtonstateNotify: return "XI_DeviceButtonstateNotify";
- default: return "unknown";
+ case XI_DeviceValuator:
+ return "XI_DeviceValuator";
+ case XI_DeviceKeyPress:
+ return "XI_DeviceKeyPress";
+ case XI_DeviceKeyRelease:
+ return "XI_DeviceKeyRelease";
+ case XI_DeviceButtonPress:
+ return "XI_DeviceButtonPress";
+ case XI_DeviceButtonRelease:
+ return "XI_DeviceButtonRelease";
+ case XI_DeviceMotionNotify:
+ return "XI_DeviceMotionNotify";
+ case XI_DeviceFocusIn:
+ return "XI_DeviceFocusIn";
+ case XI_DeviceFocusOut:
+ return "XI_DeviceFocusOut";
+ case XI_ProximityIn:
+ return "XI_ProximityIn";
+ case XI_ProximityOut:
+ return "XI_ProximityOut";
+ case XI_DeviceStateNotify:
+ return "XI_DeviceStateNotify";
+ case XI_DeviceMappingNotify:
+ return "XI_DeviceMappingNotify";
+ case XI_ChangeDeviceNotify:
+ return "XI_ChangeDeviceNotify";
+ case XI_DeviceKeystateNotify:
+ return "XI_DeviceKeystateNotify";
+ case XI_DeviceButtonstateNotify:
+ return "XI_DeviceButtonstateNotify";
+ default:
+ return "unknown";
}
}
#endif
/** Translate an event \a type into a human-readable string. */
-const char *dmxEventName(int type)
+const char *
+dmxEventName(int type)
{
switch (type) {
- case KeyPress: return "KeyPress";
- case KeyRelease: return "KeyRelease";
- case ButtonPress: return "ButtonPress";
- case ButtonRelease: return "ButtonRelease";
- case MotionNotify: return "MotionNotify";
- case EnterNotify: return "EnterNotify";
- case LeaveNotify: return "LeaveNotify";
- case FocusIn: return "FocusIn";
- case FocusOut: return "FocusOut";
- case KeymapNotify: return "KeymapNotify";
- case Expose: return "Expose";
- case GraphicsExpose: return "GraphicsExpose";
- case NoExpose: return "NoExpose";
- case VisibilityNotify: return "VisibilityNotify";
- case CreateNotify: return "CreateNotify";
- case DestroyNotify: return "DestroyNotify";
- case UnmapNotify: return "UnmapNotify";
- case MapNotify: return "MapNotify";
- case MapRequest: return "MapRequest";
- case ReparentNotify: return "ReparentNotify";
- case ConfigureNotify: return "ConfigureNotify";
- case ConfigureRequest: return "ConfigureRequest";
- case GravityNotify: return "GravityNotify";
- case ResizeRequest: return "ResizeRequest";
- case CirculateNotify: return "CirculateNotify";
- case CirculateRequest: return "CirculateRequest";
- case PropertyNotify: return "PropertyNotify";
- case SelectionClear: return "SelectionClear";
- case SelectionRequest: return "SelectionRequest";
- case SelectionNotify: return "SelectionNotify";
- case ColormapNotify: return "ColormapNotify";
- case ClientMessage: return "ClientMessage";
- case MappingNotify: return "MappingNotify";
- default: return "<unknown>";
+ case KeyPress:
+ return "KeyPress";
+ case KeyRelease:
+ return "KeyRelease";
+ case ButtonPress:
+ return "ButtonPress";
+ case ButtonRelease:
+ return "ButtonRelease";
+ case MotionNotify:
+ return "MotionNotify";
+ case EnterNotify:
+ return "EnterNotify";
+ case LeaveNotify:
+ return "LeaveNotify";
+ case FocusIn:
+ return "FocusIn";
+ case FocusOut:
+ return "FocusOut";
+ case KeymapNotify:
+ return "KeymapNotify";
+ case Expose:
+ return "Expose";
+ case GraphicsExpose:
+ return "GraphicsExpose";
+ case NoExpose:
+ return "NoExpose";
+ case VisibilityNotify:
+ return "VisibilityNotify";
+ case CreateNotify:
+ return "CreateNotify";
+ case DestroyNotify:
+ return "DestroyNotify";
+ case UnmapNotify:
+ return "UnmapNotify";
+ case MapNotify:
+ return "MapNotify";
+ case MapRequest:
+ return "MapRequest";
+ case ReparentNotify:
+ return "ReparentNotify";
+ case ConfigureNotify:
+ return "ConfigureNotify";
+ case ConfigureRequest:
+ return "ConfigureRequest";
+ case GravityNotify:
+ return "GravityNotify";
+ case ResizeRequest:
+ return "ResizeRequest";
+ case CirculateNotify:
+ return "CirculateNotify";
+ case CirculateRequest:
+ return "CirculateRequest";
+ case PropertyNotify:
+ return "PropertyNotify";
+ case SelectionClear:
+ return "SelectionClear";
+ case SelectionRequest:
+ return "SelectionRequest";
+ case SelectionNotify:
+ return "SelectionNotify";
+ case ColormapNotify:
+ return "ColormapNotify";
+ case ClientMessage:
+ return "ClientMessage";
+ case MappingNotify:
+ return "MappingNotify";
+ default:
+ return "<unknown>";
}
}
-
diff --git a/xorg-server/hw/dmx/dmxpict.c b/xorg-server/hw/dmx/dmxpict.c
index 1ea6543e0..b1177cf41 100644
--- a/xorg-server/hw/dmx/dmxpict.c
+++ b/xorg-server/hw/dmx/dmxpict.c
@@ -1,1237 +1,1280 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * Provide support for the RENDER extension (version 0.8).
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxpict.h"
-#include "dmxwindow.h"
-#include "dmxpixmap.h"
-
-#include "fb.h"
-#include "pixmapstr.h"
-#include "dixstruct.h"
-
-#include <X11/extensions/render.h>
-#include <X11/extensions/renderproto.h>
-#include <X11/extensions/Xfixes.h>
-#include "picture.h"
-#include "picturestr.h"
-#include "mipict.h"
-#include "fbpict.h"
-
-
-extern int RenderErrBase;
-extern int (*ProcRenderVector[RenderNumberRequests])(ClientPtr);
-
-static int (*dmxSaveRenderVector[RenderNumberRequests])(ClientPtr);
-
-
-static int dmxProcRenderCreateGlyphSet(ClientPtr client);
-static int dmxProcRenderFreeGlyphSet(ClientPtr client);
-static int dmxProcRenderAddGlyphs(ClientPtr client);
-static int dmxProcRenderFreeGlyphs(ClientPtr client);
-static int dmxProcRenderCompositeGlyphs(ClientPtr client);
-static int dmxProcRenderSetPictureTransform(ClientPtr client);
-static int dmxProcRenderSetPictureFilter(ClientPtr client);
-#if 0
-/* FIXME: Not (yet) supported */
-static int dmxProcRenderCreateCursor(ClientPtr client);
-static int dmxProcRenderCreateAnimCursor(ClientPtr client);
-#endif
-
-/** Catch errors that might occur when allocating Glyph Sets. Errors
- * are saved in dmxGlyphLastError for later handling. */
-static int dmxGlyphLastError;
-static int dmxGlyphErrorHandler(Display *dpy, XErrorEvent *ev)
-{
- dmxGlyphLastError = ev->error_code;
- return 0;
-}
-
-
-/** Initialize the Proc Vector for the RENDER extension. The functions
- * here cannot be handled by the mi layer RENDER hooks either because
- * the required information is no longer available when it reaches the
- * mi layer or no mi layer hooks exist. This function is called from
- * InitOutput() since it should be initialized only once per server
- * generation. */
-void dmxInitRender(void)
-{
- int i;
-
- for (i = 0; i < RenderNumberRequests; i++)
- dmxSaveRenderVector[i] = ProcRenderVector[i];
-
- ProcRenderVector[X_RenderCreateGlyphSet]
- = dmxProcRenderCreateGlyphSet;
- ProcRenderVector[X_RenderFreeGlyphSet]
- = dmxProcRenderFreeGlyphSet;
- ProcRenderVector[X_RenderAddGlyphs]
- = dmxProcRenderAddGlyphs;
- ProcRenderVector[X_RenderFreeGlyphs]
- = dmxProcRenderFreeGlyphs;
- ProcRenderVector[X_RenderCompositeGlyphs8]
- = dmxProcRenderCompositeGlyphs;
- ProcRenderVector[X_RenderCompositeGlyphs16]
- = dmxProcRenderCompositeGlyphs;
- ProcRenderVector[X_RenderCompositeGlyphs32]
- = dmxProcRenderCompositeGlyphs;
- ProcRenderVector[X_RenderSetPictureTransform]
- = dmxProcRenderSetPictureTransform;
- ProcRenderVector[X_RenderSetPictureFilter]
- = dmxProcRenderSetPictureFilter;
-}
-
-/** Reset the Proc Vector for the RENDER extension back to the original
- * functions. This function is called from dmxCloseScreen() during the
- * server reset (only for screen #0). */
-void dmxResetRender(void)
-{
- int i;
-
- for (i = 0; i < RenderNumberRequests; i++)
- ProcRenderVector[i] = dmxSaveRenderVector[i];
-}
-
-/** Initialize the RENDER extension, allocate the picture privates and
- * wrap mi function hooks. If the shadow frame buffer is used, then
- * call the appropriate fb initialization function. */
-Bool dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps;
-
- /* The shadow framebuffer only relies on FB to be initialized */
- if (dmxShadowFB) return fbPictureInit(pScreen, formats, nformats);
-
- if (!miPictureInit(pScreen, formats, nformats))
- return FALSE;
-
- if (!dixRegisterPrivateKey(&dmxPictPrivateKeyRec, PRIVATE_PICTURE, sizeof(dmxPictPrivRec)))
- return FALSE;
-
- ps = GetPictureScreen(pScreen);
-
- DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
- DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
-
- DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
- DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
-
- DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
- DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
-
- DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
- DMX_WRAP(Glyphs, dmxGlyphs, dmxScreen, ps);
- DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
-
- DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
- DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
-
- return TRUE;
-}
-
-
-/** Find the appropriate format on the requested screen given the
- * internal format requested. The list of formats is searched
- * sequentially as the XRenderFindFormat() function does not always
- * find the appropriate format when a specific format is requested. */
-static XRenderPictFormat *dmxFindFormat(DMXScreenInfo *dmxScreen,
- PictFormatPtr pFmt)
-{
- XRenderPictFormat *pFormat = NULL;
- int i = 0;
-
- if (!pFmt || !dmxScreen->beDisplay) return pFormat;
-
- while (1) {
- pFormat = XRenderFindFormat(dmxScreen->beDisplay, 0, 0, i++);
- if (!pFormat) break;
-
- if (pFormat->type != pFmt->type) continue;
- if (pFormat->depth != pFmt->depth) continue;
- if (pFormat->direct.red != pFmt->direct.red) continue;
- if (pFormat->direct.redMask != pFmt->direct.redMask) continue;
- if (pFormat->direct.green != pFmt->direct.green) continue;
- if (pFormat->direct.greenMask != pFmt->direct.greenMask) continue;
- if (pFormat->direct.blue != pFmt->direct.blue) continue;
- if (pFormat->direct.blueMask != pFmt->direct.blueMask) continue;
- if (pFormat->direct.alpha != pFmt->direct.alpha) continue;
- if (pFormat->direct.alphaMask != pFmt->direct.alphaMask) continue;
-
- /* We have a match! */
- break;
- }
-
- return pFormat;
-}
-
-/** Free \a glyphSet on back-end screen number \a idx. */
-Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet)
-{
- dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- int idx = pScreen->myNum;
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
-
- if (glyphPriv->glyphSets[idx]) {
- XRenderFreeGlyphSet(dmxScreen->beDisplay, glyphPriv->glyphSets[idx]);
- glyphPriv->glyphSets[idx] = (GlyphSet)0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/** Create \a glyphSet on the backend screen number \a idx. */
-int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet)
-{
- XRenderPictFormat *pFormat;
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- PictFormatPtr pFmt = glyphSet->format;
- int (*oldErrorHandler)(Display *, XErrorEvent *);
-
- pFormat = dmxFindFormat(dmxScreen, pFmt);
- if (!pFormat) {
- return BadMatch;
- }
-
- dmxGlyphLastError = 0;
- oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
-
- /* Catch when this fails */
- glyphPriv->glyphSets[idx]
- = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat);
-
- XSetErrorHandler(oldErrorHandler);
-
- if (dmxGlyphLastError) {
- return dmxGlyphLastError;
- }
-
- return Success;
-}
-
-/** Create a Glyph Set on each screen. Save the glyphset ID from each
- * screen in the Glyph Set's private structure. Fail if the format
- * requested is not available or if the Glyph Set cannot be created on
- * the screen. */
-static int dmxProcRenderCreateGlyphSet(ClientPtr client)
-{
- int ret;
- REQUEST(xRenderCreateGlyphSetReq);
-
- ret = dmxSaveRenderVector[stuff->renderReqType](client);
-
- if (ret == Success) {
- GlyphSetPtr glyphSet;
- dmxGlyphPrivPtr glyphPriv;
- int i;
-
- /* Look up glyphSet that was just created ???? */
- /* Store glyphsets from backends in glyphSet->devPrivate ????? */
- /* Make sure we handle all errors here!! */
-
- dixLookupResourceByType((pointer*) &glyphSet,
- stuff->gsid, GlyphSetType,
- client, DixDestroyAccess);
-
- glyphPriv = malloc(sizeof(dmxGlyphPrivRec));
- if (!glyphPriv) return BadAlloc;
- glyphPriv->glyphSets = NULL;
- MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
- DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv);
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- int beret;
-
- if (!dmxScreen->beDisplay) {
- glyphPriv->glyphSets[i] = 0;
- continue;
- }
-
- if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) {
- int j;
-
- /* Free the glyph sets we've allocated thus far */
- for (j = 0; j < i; j++)
- dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet);
-
- /* Free the resource created by render */
- FreeResource(stuff->gsid, RT_NONE);
-
- return beret;
- }
- }
- }
-
- return ret;
-}
-
-/** Free the previously allocated Glyph Sets for each screen. */
-static int dmxProcRenderFreeGlyphSet(ClientPtr client)
-{
- GlyphSetPtr glyphSet;
- REQUEST(xRenderFreeGlyphSetReq);
-
- REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
- dixLookupResourceByType((pointer*) &glyphSet,
- stuff->glyphset, GlyphSetType,
- client, DixDestroyAccess);
-
- if (glyphSet && glyphSet->refcnt == 1) {
- dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- int i;
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
-
- if (dmxScreen->beDisplay) {
- if (dmxBEFreeGlyphSet(screenInfo.screens[i], glyphSet))
- dmxSync(dmxScreen, FALSE);
- }
- }
-
- MAXSCREENSFREE(glyphPriv->glyphSets);
- free(glyphPriv);
- DMX_SET_GLYPH_PRIV(glyphSet, NULL);
- }
-
- return dmxSaveRenderVector[stuff->renderReqType](client);
-}
-
-/** Add glyphs to the Glyph Set on each screen. */
-static int dmxProcRenderAddGlyphs(ClientPtr client)
-{
- int ret;
- REQUEST(xRenderAddGlyphsReq);
-
- ret = dmxSaveRenderVector[stuff->renderReqType](client);
-
- if (ret == Success) {
- GlyphSetPtr glyphSet;
- dmxGlyphPrivPtr glyphPriv;
- int i;
- int nglyphs;
- CARD32 *gids;
- Glyph *gidsCopy;
- xGlyphInfo *gi;
- CARD8 *bits;
- int nbytes;
-
- dixLookupResourceByType((pointer*) &glyphSet,
- stuff->glyphset, GlyphSetType,
- client, DixReadAccess);
- glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
-
- nglyphs = stuff->nglyphs;
- gids = (CARD32 *)(stuff + 1);
- gi = (xGlyphInfo *)(gids + nglyphs);
- bits = (CARD8 *)(gi + nglyphs);
- nbytes = ((stuff->length << 2) -
- sizeof(xRenderAddGlyphsReq) -
- (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs);
-
- gidsCopy = malloc(sizeof(*gidsCopy) * nglyphs);
- for (i = 0; i < nglyphs; i++) gidsCopy[i] = gids[i];
-
- /* FIXME: Will this ever fail? */
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
-
- if (dmxScreen->beDisplay) {
- XRenderAddGlyphs(dmxScreen->beDisplay,
- glyphPriv->glyphSets[i],
- gidsCopy,
- (XGlyphInfo *)gi,
- nglyphs,
- (char *)bits,
- nbytes);
- dmxSync(dmxScreen, FALSE);
- }
- }
- free(gidsCopy);
- }
-
- return ret;
-}
-
-/** Free glyphs from the Glyph Set for each screen. */
-static int dmxProcRenderFreeGlyphs(ClientPtr client)
-{
- GlyphSetPtr glyphSet;
- REQUEST(xRenderFreeGlyphsReq);
-
- REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
- dixLookupResourceByType((pointer*) &glyphSet,
- stuff->glyphset, GlyphSetType,
- client, DixWriteAccess);
-
- if (glyphSet) {
- dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- int i;
- int nglyphs;
- Glyph *gids;
-
- nglyphs = ((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq)) >> 2;
- if (nglyphs) {
- gids = malloc(sizeof(*gids) * nglyphs);
- for (i = 0; i < nglyphs; i++)
- gids[i] = ((CARD32 *)(stuff + 1))[i];
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
-
- if (dmxScreen->beDisplay) {
- XRenderFreeGlyphs(dmxScreen->beDisplay,
- glyphPriv->glyphSets[i], gids, nglyphs);
- dmxSync(dmxScreen, FALSE);
- }
- }
- free(gids);
- }
- }
-
- return dmxSaveRenderVector[stuff->renderReqType](client);
-}
-
-/** Composite glyphs on each screen into the requested picture. If
- * either the src or dest picture has not been allocated due to lazy
- * window creation, this request will gracefully return. */
-static int dmxProcRenderCompositeGlyphs(ClientPtr client)
-{
- int ret;
- REQUEST(xRenderCompositeGlyphsReq);
-
- ret = dmxSaveRenderVector[stuff->renderReqType](client);
-
- /* For the following to work with PanoramiX, it assumes that Render
- * wraps the ProcRenderVector after dmxRenderInit has been called.
- */
- if (ret == Success) {
- PicturePtr pSrc;
- dmxPictPrivPtr pSrcPriv;
- PicturePtr pDst;
- dmxPictPrivPtr pDstPriv;
- PictFormatPtr pFmt;
- XRenderPictFormat *pFormat;
- int size;
-
- int scrnNum;
- DMXScreenInfo *dmxScreen;
-
- CARD8 *buffer;
- CARD8 *end;
- int space;
-
- int nglyph;
- char *glyphs;
- char *curGlyph;
-
- xGlyphElt *elt;
- int nelt;
- XGlyphElt8 *elts;
- XGlyphElt8 *curElt;
-
- GlyphSetPtr glyphSet;
- dmxGlyphPrivPtr glyphPriv;
-
- dixLookupResourceByType((pointer*) &pSrc,
- stuff->src, PictureType,
- client, DixReadAccess);
-
- pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
- if (!pSrcPriv->pict)
- return ret;
-
- dixLookupResourceByType((pointer*) &pDst,
- stuff->dst, PictureType,
- client, DixWriteAccess);
-
- pDstPriv = DMX_GET_PICT_PRIV(pDst);
- if (!pDstPriv->pict)
- return ret;
-
- scrnNum = pDst->pDrawable->pScreen->myNum;
- dmxScreen = &dmxScreens[scrnNum];
-
- /* Note: If the back-end display has been detached, then it
- * should not be possible to reach here since the pSrcPriv->pict
- * and pDstPriv->pict will have already been set to 0.
- */
- if (!dmxScreen->beDisplay)
- return ret;
-
- if (stuff->maskFormat)
- dixLookupResourceByType((pointer*) &pFmt,
- stuff->maskFormat, PictFormatType,
- client, DixReadAccess);
- else
- pFmt = NULL;
-
- pFormat = dmxFindFormat(dmxScreen, pFmt);
-
- switch (stuff->renderReqType) {
- case X_RenderCompositeGlyphs8: size = sizeof(CARD8); break;
- case X_RenderCompositeGlyphs16: size = sizeof(CARD16); break;
- case X_RenderCompositeGlyphs32: size = sizeof(CARD32); break;
- default: return BadPictOp; /* Can't happen */
- }
-
- buffer = (CARD8 *)(stuff + 1);
- end = (CARD8 *)stuff + (stuff->length << 2);
- nelt = 0;
- nglyph = 0;
- while (buffer + sizeof(xGlyphElt) < end) {
- elt = (xGlyphElt *)buffer;
- buffer += sizeof(xGlyphElt);
-
- if (elt->len == 0xff) {
- buffer += 4;
- } else {
- nelt++;
- nglyph += elt->len;
- space = size * elt->len;
- if (space & 3) space += 4 - (space & 3);
- buffer += space;
- }
- }
-
- /* The following only works for Render version > 0.2 */
-
- /* All of the XGlyphElt* structure sizes are identical */
- elts = malloc(nelt * sizeof(XGlyphElt8));
- if (!elts)
- return BadAlloc;
-
- glyphs = malloc(nglyph * size);
- if (!glyphs) {
- free(elts);
- return BadAlloc;
- }
-
- buffer = (CARD8 *)(stuff + 1);
- end = (CARD8 *)stuff + (stuff->length << 2);
- curGlyph = glyphs;
- curElt = elts;
-
- dixLookupResourceByType((pointer*) &glyphSet,
- stuff->glyphset, GlyphSetType,
- client, DixReadAccess);
- glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
-
- while (buffer + sizeof(xGlyphElt) < end) {
- elt = (xGlyphElt *)buffer;
- buffer += sizeof(xGlyphElt);
-
- if (elt->len == 0xff) {
- dixLookupResourceByType((pointer*) &glyphSet,
- *((CARD32 *)buffer),
- GlyphSetType,
- client,
- DixReadAccess);
- glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- buffer += 4;
- } else {
- curElt->glyphset = glyphPriv->glyphSets[scrnNum];
- curElt->xOff = elt->deltax;
- curElt->yOff = elt->deltay;
- curElt->nchars = elt->len;
- curElt->chars = curGlyph;
-
- memcpy(curGlyph, buffer, size*elt->len);
- curGlyph += size * elt->len;
-
- curElt++;
-
- space = size * elt->len;
- if (space & 3) space += 4 - (space & 3);
- buffer += space;
- }
- }
-
- switch (stuff->renderReqType) {
- case X_RenderCompositeGlyphs8:
- XRenderCompositeText8(dmxScreen->beDisplay, stuff->op,
- pSrcPriv->pict, pDstPriv->pict,
- pFormat,
- stuff->xSrc, stuff->ySrc,
- 0, 0, elts, nelt);
- break;
- case X_RenderCompositeGlyphs16:
- XRenderCompositeText16(dmxScreen->beDisplay, stuff->op,
- pSrcPriv->pict, pDstPriv->pict,
- pFormat,
- stuff->xSrc, stuff->ySrc,
- 0, 0, (XGlyphElt16 *)elts, nelt);
- break;
- case X_RenderCompositeGlyphs32:
- XRenderCompositeText32(dmxScreen->beDisplay, stuff->op,
- pSrcPriv->pict, pDstPriv->pict,
- pFormat,
- stuff->xSrc, stuff->ySrc,
- 0, 0, (XGlyphElt32 *)elts, nelt);
- break;
- }
-
- dmxSync(dmxScreen, FALSE);
-
- free(elts);
- free(glyphs);
- }
-
- return ret;
-}
-
-/** Set the picture transform on each screen. */
-static int dmxProcRenderSetPictureTransform(ClientPtr client)
-{
- DMXScreenInfo *dmxScreen;
- PicturePtr pPicture;
- dmxPictPrivPtr pPictPriv;
- XTransform xform;
- REQUEST(xRenderSetPictureTransformReq);
-
- REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
- VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
-
- /* For the following to work with PanoramiX, it assumes that Render
- * wraps the ProcRenderVector after dmxRenderInit has been called.
- */
- dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
- pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- if (pPictPriv->pict) {
- xform.matrix[0][0] = stuff->transform.matrix11;
- xform.matrix[0][1] = stuff->transform.matrix12;
- xform.matrix[0][2] = stuff->transform.matrix13;
- xform.matrix[1][0] = stuff->transform.matrix21;
- xform.matrix[1][1] = stuff->transform.matrix22;
- xform.matrix[1][2] = stuff->transform.matrix23;
- xform.matrix[2][0] = stuff->transform.matrix31;
- xform.matrix[2][1] = stuff->transform.matrix32;
- xform.matrix[2][2] = stuff->transform.matrix33;
-
- XRenderSetPictureTransform(dmxScreen->beDisplay,
- pPictPriv->pict,
- &xform);
- dmxSync(dmxScreen, FALSE);
- }
-
- return dmxSaveRenderVector[stuff->renderReqType](client);
-}
-
-/** Set the picture filter on each screen. */
-static int dmxProcRenderSetPictureFilter(ClientPtr client)
-{
- DMXScreenInfo *dmxScreen;
- PicturePtr pPicture;
- dmxPictPrivPtr pPictPriv;
- char *filter;
- XFixed *params;
- int nparams;
- REQUEST(xRenderSetPictureFilterReq);
-
- REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
- VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
-
- /* For the following to work with PanoramiX, it assumes that Render
- * wraps the ProcRenderVector after dmxRenderInit has been called.
- */
- dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
- pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- if (pPictPriv->pict) {
- filter = (char *)(stuff + 1);
- params = (XFixed *)(filter + ((stuff->nbytes + 3) & ~3));
- nparams = ((XFixed *)stuff + client->req_len) - params;
-
- XRenderSetPictureFilter(dmxScreen->beDisplay,
- pPictPriv->pict,
- filter,
- params,
- nparams);
- dmxSync(dmxScreen, FALSE);
- }
-
- return dmxSaveRenderVector[stuff->renderReqType](client);
-}
-
-
-/** Create a picture on the appropriate screen. This is the actual
- * function that creates the picture. However, if the associated
- * window has not yet been created due to lazy window creation, then
- * delay the picture creation until the window is mapped. */
-static Picture dmxDoCreatePicture(PicturePtr pPicture)
-{
- DrawablePtr pDraw = pPicture->pDrawable;
- ScreenPtr pScreen = pDraw->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- XRenderPictFormat *pFormat;
- Drawable draw;
-
- if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr)(pDraw));
-
- if (!(draw = pWinPriv->window)) {
- /* Window has not been created yet due to the window
- * optimization. Delay picture creation until window is
- * mapped.
- */
- pWinPriv->hasPict = TRUE;
- return 0;
- }
- } else {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr)(pDraw));
-
- if (!(draw = pPixPriv->pixmap)) {
- /* FIXME: Zero width/height pixmap?? */
- return 0;
- }
- }
-
- /* This should not be reached if the back-end display has been
- * detached because the pWinPriv->window or the pPixPriv->pixmap
- * will be NULL; however, we add it here for completeness
- */
- if (!dmxScreen->beDisplay)
- return 0;
-
- pFormat = dmxFindFormat(dmxScreen, pPicture->pFormat);
-
- return XRenderCreatePicture(dmxScreen->beDisplay, draw, pFormat, 0, 0);
-}
-
-/** Create a list of pictures. This function is called by
- * dmxCreateAndRealizeWindow() during the lazy window creation
- * realization process. It creates the entire list of pictures that
- * are associated with the given window. */
-void dmxCreatePictureList(WindowPtr pWindow)
-{
- PicturePtr pPicture = GetPictureWindow(pWindow);
-
- while (pPicture) {
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- /* Create the picture for this window */
- pPictPriv->pict = dmxDoCreatePicture(pPicture);
-
- /* ValidatePicture takes care of the state changes */
-
- pPicture = pPicture->pNext;
- }
-}
-
-/** Create \a pPicture on the backend. */
-int dmxBECreatePicture(PicturePtr pPicture)
-{
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- /* Create picutre on BE */
- pPictPriv->pict = dmxDoCreatePicture(pPicture);
-
- /* Flush changes to the backend server */
- dmxValidatePicture(pPicture, (1 << (CPLastBit+1)) - 1);
-
- return Success;
-}
-
-/** Create a picture. This function handles the CreatePicture
- * unwrapping/wrapping and calls dmxDoCreatePicture to actually create
- * the picture on the appropriate screen. */
-int dmxCreatePicture(PicturePtr pPicture)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
- int ret = Success;
-
- DMX_UNWRAP(CreatePicture, dmxScreen, ps);
-#if 1
- if (ps->CreatePicture)
- ret = ps->CreatePicture(pPicture);
-#endif
-
- /* Create picture on back-end server */
- pPictPriv->pict = dmxDoCreatePicture(pPicture);
- pPictPriv->savedMask = 0;
-
- DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
-
- return ret;
-}
-
-/** Destroy \a pPicture on the back-end server. */
-Bool dmxBEFreePicture(PicturePtr pPicture)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- if (pPictPriv->pict) {
- XRenderFreePicture(dmxScreen->beDisplay, pPictPriv->pict);
- pPictPriv->pict = (Picture)0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/** Destroy a list of pictures that are associated with the window that
- * is being destroyed. This function is called by #dmxDestroyWindow().
- * */
-Bool dmxDestroyPictureList(WindowPtr pWindow)
-{
- PicturePtr pPicture = GetPictureWindow(pWindow);
- Bool ret = FALSE;
-
- while (pPicture) {
- ret |= dmxBEFreePicture(pPicture);
- pPicture = pPicture->pNext;
- }
-
- return ret;
-}
-
-/** Destroy a picture. This function calls the wrapped function that
- * frees the resources in the DMX server associated with this
- * picture. */
-void dmxDestroyPicture(PicturePtr pPicture)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
- DMX_UNWRAP(DestroyPicture, dmxScreen, ps);
-
- /* Destroy picture on back-end server */
- if (dmxBEFreePicture(pPicture))
- dmxSync(dmxScreen, FALSE);
-
-#if 1
- if (ps->DestroyPicture)
- ps->DestroyPicture(pPicture);
-#endif
- DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
-}
-
-/** Change the picture's list of clip rectangles. */
-int dmxChangePictureClip(PicturePtr pPicture, int clipType,
- pointer value, int n)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- DMX_UNWRAP(ChangePictureClip, dmxScreen, ps);
-#if 1
- if (ps->ChangePictureClip)
- ps->ChangePictureClip(pPicture, clipType, value, n);
-#endif
-
- /* Change picture clip rects on back-end server */
- if (pPictPriv->pict) {
- /* The clip has already been changed into a region by the mi
- * routine called above.
- */
- if (clipType == CT_NONE) {
- /* Disable clipping, show all */
- XFixesSetPictureClipRegion(dmxScreen->beDisplay,
- pPictPriv->pict, 0, 0, None);
- } else if (pPicture->clientClip) {
- RegionPtr pClip = pPicture->clientClip;
- BoxPtr pBox = RegionRects(pClip);
- int nBox = RegionNumRects(pClip);
- XRectangle *pRects;
- XRectangle *pRect;
- int nRects;
-
- nRects = nBox;
- pRects = pRect = malloc(nRects * sizeof(*pRect));
-
- while (nBox--) {
- pRect->x = pBox->x1;
- pRect->y = pBox->y1;
- pRect->width = pBox->x2 - pBox->x1;
- pRect->height = pBox->y2 - pBox->y1;
- pBox++;
- pRect++;
- }
-
- XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
- pPictPriv->pict,
- 0, 0,
- pRects,
- nRects);
- free(pRects);
- } else {
- XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
- pPictPriv->pict,
- 0, 0, NULL, 0);
- }
- dmxSync(dmxScreen, FALSE);
- } else {
- /* FIXME: Handle saving clip region when offscreen */
- }
-
- DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
-
- return Success;
-}
-
-/** Destroy the picture's list of clip rectangles. */
-void dmxDestroyPictureClip(PicturePtr pPicture)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- DMX_UNWRAP(DestroyPictureClip, dmxScreen, ps);
-#if 1
- if (ps->DestroyPictureClip)
- ps->DestroyPictureClip(pPicture);
-#endif
-
- /* Destroy picture clip rects on back-end server */
- if (pPictPriv->pict) {
- XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
- pPictPriv->pict,
- 0, 0, NULL, 0);
- dmxSync(dmxScreen, FALSE);
- } else {
- /* FIXME: Handle destroying clip region when offscreen */
- }
-
- DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
-}
-
-/** Change the attributes of the pictures. If the picture has not yet
- * been created due to lazy window creation, save the mask so that it
- * can be used to appropriately initialize the picture's attributes
- * when it is created later. */
-void dmxChangePicture(PicturePtr pPicture, Mask mask)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- DMX_UNWRAP(ChangePicture, dmxScreen, ps);
-#if 1
- if (ps->ChangePicture)
- ps->ChangePicture(pPicture, mask);
-#endif
-
- /* Picture attribute changes are handled in ValidatePicture */
- pPictPriv->savedMask |= mask;
-
- DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
-}
-
-/** Validate the picture's attributes before rendering to it. Update
- * any picture attributes that have been changed by one of the higher
- * layers. */
-void dmxValidatePicture(PicturePtr pPicture, Mask mask)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- DMX_UNWRAP(ValidatePicture, dmxScreen, ps);
-
- /* Change picture attributes on back-end server */
- if (pPictPriv->pict) {
- XRenderPictureAttributes attribs;
-
- if (mask & CPRepeat) {
- attribs.repeat = pPicture->repeatType;
- }
- if (mask & CPAlphaMap) {
- if (pPicture->alphaMap) {
- dmxPictPrivPtr pAlphaPriv;
- pAlphaPriv = DMX_GET_PICT_PRIV(pPicture->alphaMap);
- if (pAlphaPriv->pict) {
- attribs.alpha_map = pAlphaPriv->pict;
- } else {
- /* FIXME: alpha picture drawable has not been created?? */
- return; /* or should this be: attribs.alpha_map = None; */
- }
- } else {
- attribs.alpha_map = None;
- }
- }
- if (mask & CPAlphaXOrigin)
- attribs.alpha_x_origin = pPicture->alphaOrigin.x;
- if (mask & CPAlphaYOrigin)
- attribs.alpha_y_origin = pPicture->alphaOrigin.y;
- if (mask & CPClipXOrigin)
- attribs.clip_x_origin = pPicture->clipOrigin.x;
- if (mask & CPClipYOrigin)
- attribs.clip_y_origin = pPicture->clipOrigin.y;
- if (mask & CPClipMask)
- mask &= ~CPClipMask; /* Handled in ChangePictureClip */
- if (mask & CPGraphicsExposure)
- attribs.graphics_exposures = pPicture->graphicsExposures;
- if (mask & CPSubwindowMode)
- attribs.subwindow_mode = pPicture->subWindowMode;
- if (mask & CPPolyEdge)
- attribs.poly_edge = pPicture->polyEdge;
- if (mask & CPPolyMode)
- attribs.poly_mode = pPicture->polyMode;
- if (mask & CPComponentAlpha)
- attribs.component_alpha = pPicture->componentAlpha;
-
- XRenderChangePicture(dmxScreen->beDisplay, pPictPriv->pict,
- mask, &attribs);
- dmxSync(dmxScreen, FALSE);
- } else {
- pPictPriv->savedMask |= mask;
- }
-
-#if 1
- if (ps->ValidatePicture)
- ps->ValidatePicture(pPicture, mask);
-#endif
-
- DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
-}
-
-/** Composite a picture on the appropriate screen by combining the
- * specified rectangle of the transformed src and mask operands with
- * the specified rectangle of the dst using op as the compositing
- * operator. For a complete description see the protocol document of
- * the RENDER library. */
-void dmxComposite(CARD8 op,
- PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc,
- INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst,
- CARD16 width, CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
- dmxPictPrivPtr pMaskPriv = NULL;
- dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
-
- if (pMask) pMaskPriv = DMX_GET_PICT_PRIV(pMask);
-
- DMX_UNWRAP(Composite, dmxScreen, ps);
-#if 0
- if (ps->Composite)
- ps->Composite(op, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height);
-#endif
-
- /* Composite on back-end server */
- if (pSrcPriv->pict && pDstPriv->pict &&
- ((pMaskPriv && pMaskPriv->pict) || !pMaskPriv)) {
- XRenderComposite(dmxScreen->beDisplay,
- op,
- pSrcPriv->pict,
- pMaskPriv ? pMaskPriv->pict : None,
- pDstPriv->pict,
- xSrc, ySrc,
- xMask, yMask,
- xDst, yDst,
- width, height);
- dmxSync(dmxScreen, FALSE);
- }
-
-
- DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
-}
-
-/** Null function to catch when/if RENDER calls lower level mi hooks.
- * Compositing glyphs is handled by dmxProcRenderCompositeGlyphs().
- * This function should never be called. */
-void dmxGlyphs(CARD8 op,
- PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int nlists, GlyphListPtr lists, GlyphPtr *glyphs)
-{
- /* This won't work, so we need to wrap ProcRenderCompositeGlyphs */
-}
-
-/** Fill a rectangle on the appropriate screen by combining the color
- * with the dest picture in the area specified by the list of
- * rectangles. For a complete description see the protocol document of
- * the RENDER library. */
-void dmxCompositeRects(CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect, xRectangle *rects)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pDst);
-
- DMX_UNWRAP(CompositeRects, dmxScreen, ps);
-#if 0
- if (ps->CompositeRects)
- ps->CompositeRects(op, pDst, color, nRect, rects);
-#endif
-
- /* CompositeRects on back-end server */
- if (pPictPriv->pict) {
- XRenderFillRectangles(dmxScreen->beDisplay,
- op,
- pPictPriv->pict,
- (XRenderColor *)color,
- (XRectangle *)rects,
- nRect);
- dmxSync(dmxScreen, FALSE);
- }
-
- DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
-}
-
-/** Indexed color visuals are not yet supported. */
-Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
-{
- return TRUE;
-}
-
-/** Indexed color visuals are not yet supported. */
-void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
-{
-}
-
-/** Indexed color visuals are not yet supported. */
-void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
- int ndef, xColorItem *pdef)
-{
-}
-
-/** Composite a list of trapezoids on the appropriate screen. For a
- * complete description see the protocol document of the RENDER
- * library. */
-void dmxTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int ntrap, xTrapezoid *traps)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
- dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
-
- DMX_UNWRAP(Trapezoids, dmxScreen, ps);
-#if 0
- if (ps->Trapezoids)
- ps->Trapezoids(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, *traps);
-#endif
-
- /* Draw trapezoids on back-end server */
- if (pDstPriv->pict) {
- XRenderPictFormat *pFormat;
-
- pFormat = dmxFindFormat(dmxScreen, maskFormat);
- if (!pFormat) {
- /* FIXME: Error! */
- }
-
- XRenderCompositeTrapezoids(dmxScreen->beDisplay,
- op,
- pSrcPriv->pict,
- pDstPriv->pict,
- pFormat,
- xSrc, ySrc,
- (XTrapezoid *)traps,
- ntrap);
- dmxSync(dmxScreen, FALSE);
- }
-
- DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
-}
-
-/** Composite a list of triangles on the appropriate screen. For a
- * complete description see the protocol document of the RENDER
- * library. */
-void dmxTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int ntri, xTriangle *tris)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
- dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
-
- DMX_UNWRAP(Triangles, dmxScreen, ps);
-#if 0
- if (ps->Triangles)
- ps->Triangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, *tris);
-#endif
-
- /* Draw trapezoids on back-end server */
- if (pDstPriv->pict) {
- XRenderPictFormat *pFormat;
-
- pFormat = dmxFindFormat(dmxScreen, maskFormat);
- if (!pFormat) {
- /* FIXME: Error! */
- }
-
- XRenderCompositeTriangles(dmxScreen->beDisplay,
- op,
- pSrcPriv->pict,
- pDstPriv->pict,
- pFormat,
- xSrc, ySrc,
- (XTriangle *)tris,
- ntri);
- dmxSync(dmxScreen, FALSE);
- }
-
- DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
-}
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide support for the RENDER extension (version 0.8).
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxpict.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+
+#include "fb.h"
+#include "pixmapstr.h"
+#include "dixstruct.h"
+
+#include <X11/extensions/render.h>
+#include <X11/extensions/renderproto.h>
+#include <X11/extensions/Xfixes.h>
+#include "picture.h"
+#include "picturestr.h"
+#include "mipict.h"
+#include "fbpict.h"
+
+extern int RenderErrBase;
+extern int (*ProcRenderVector[RenderNumberRequests]) (ClientPtr);
+
+static int (*dmxSaveRenderVector[RenderNumberRequests]) (ClientPtr);
+
+static int dmxProcRenderCreateGlyphSet(ClientPtr client);
+static int dmxProcRenderFreeGlyphSet(ClientPtr client);
+static int dmxProcRenderAddGlyphs(ClientPtr client);
+static int dmxProcRenderFreeGlyphs(ClientPtr client);
+static int dmxProcRenderCompositeGlyphs(ClientPtr client);
+static int dmxProcRenderSetPictureTransform(ClientPtr client);
+static int dmxProcRenderSetPictureFilter(ClientPtr client);
+
+#if 0
+/* FIXME: Not (yet) supported */
+static int dmxProcRenderCreateCursor(ClientPtr client);
+static int dmxProcRenderCreateAnimCursor(ClientPtr client);
+#endif
+
+/** Catch errors that might occur when allocating Glyph Sets. Errors
+ * are saved in dmxGlyphLastError for later handling. */
+static int dmxGlyphLastError;
+static int
+dmxGlyphErrorHandler(Display * dpy, XErrorEvent * ev)
+{
+ dmxGlyphLastError = ev->error_code;
+ return 0;
+}
+
+/** Initialize the Proc Vector for the RENDER extension. The functions
+ * here cannot be handled by the mi layer RENDER hooks either because
+ * the required information is no longer available when it reaches the
+ * mi layer or no mi layer hooks exist. This function is called from
+ * InitOutput() since it should be initialized only once per server
+ * generation. */
+void
+dmxInitRender(void)
+{
+ int i;
+
+ for (i = 0; i < RenderNumberRequests; i++)
+ dmxSaveRenderVector[i] = ProcRenderVector[i];
+
+ ProcRenderVector[X_RenderCreateGlyphSet]
+ = dmxProcRenderCreateGlyphSet;
+ ProcRenderVector[X_RenderFreeGlyphSet]
+ = dmxProcRenderFreeGlyphSet;
+ ProcRenderVector[X_RenderAddGlyphs]
+ = dmxProcRenderAddGlyphs;
+ ProcRenderVector[X_RenderFreeGlyphs]
+ = dmxProcRenderFreeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs8]
+ = dmxProcRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs16]
+ = dmxProcRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs32]
+ = dmxProcRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderSetPictureTransform]
+ = dmxProcRenderSetPictureTransform;
+ ProcRenderVector[X_RenderSetPictureFilter]
+ = dmxProcRenderSetPictureFilter;
+}
+
+/** Reset the Proc Vector for the RENDER extension back to the original
+ * functions. This function is called from dmxCloseScreen() during the
+ * server reset (only for screen #0). */
+void
+dmxResetRender(void)
+{
+ int i;
+
+ for (i = 0; i < RenderNumberRequests; i++)
+ ProcRenderVector[i] = dmxSaveRenderVector[i];
+}
+
+/** Initialize the RENDER extension, allocate the picture privates and
+ * wrap mi function hooks. If the shadow frame buffer is used, then
+ * call the appropriate fb initialization function. */
+Bool
+dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps;
+
+ /* The shadow framebuffer only relies on FB to be initialized */
+ if (dmxShadowFB)
+ return fbPictureInit(pScreen, formats, nformats);
+
+ if (!miPictureInit(pScreen, formats, nformats))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey
+ (&dmxPictPrivateKeyRec, PRIVATE_PICTURE, sizeof(dmxPictPrivRec)))
+ return FALSE;
+
+ ps = GetPictureScreen(pScreen);
+
+ DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
+ DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
+
+ DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
+ DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
+
+ DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
+ DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
+
+ DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
+ DMX_WRAP(Glyphs, dmxGlyphs, dmxScreen, ps);
+ DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
+
+ DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
+ DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
+
+ return TRUE;
+}
+
+/** Find the appropriate format on the requested screen given the
+ * internal format requested. The list of formats is searched
+ * sequentially as the XRenderFindFormat() function does not always
+ * find the appropriate format when a specific format is requested. */
+static XRenderPictFormat *
+dmxFindFormat(DMXScreenInfo * dmxScreen, PictFormatPtr pFmt)
+{
+ XRenderPictFormat *pFormat = NULL;
+ int i = 0;
+
+ if (!pFmt || !dmxScreen->beDisplay)
+ return pFormat;
+
+ while (1) {
+ pFormat = XRenderFindFormat(dmxScreen->beDisplay, 0, 0, i++);
+ if (!pFormat)
+ break;
+
+ if (pFormat->type != pFmt->type)
+ continue;
+ if (pFormat->depth != pFmt->depth)
+ continue;
+ if (pFormat->direct.red != pFmt->direct.red)
+ continue;
+ if (pFormat->direct.redMask != pFmt->direct.redMask)
+ continue;
+ if (pFormat->direct.green != pFmt->direct.green)
+ continue;
+ if (pFormat->direct.greenMask != pFmt->direct.greenMask)
+ continue;
+ if (pFormat->direct.blue != pFmt->direct.blue)
+ continue;
+ if (pFormat->direct.blueMask != pFmt->direct.blueMask)
+ continue;
+ if (pFormat->direct.alpha != pFmt->direct.alpha)
+ continue;
+ if (pFormat->direct.alphaMask != pFmt->direct.alphaMask)
+ continue;
+
+ /* We have a match! */
+ break;
+ }
+
+ return pFormat;
+}
+
+/** Free \a glyphSet on back-end screen number \a idx. */
+Bool
+dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet)
+{
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ int idx = pScreen->myNum;
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ if (glyphPriv->glyphSets[idx]) {
+ XRenderFreeGlyphSet(dmxScreen->beDisplay, glyphPriv->glyphSets[idx]);
+ glyphPriv->glyphSets[idx] = (GlyphSet) 0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Create \a glyphSet on the backend screen number \a idx. */
+int
+dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet)
+{
+ XRenderPictFormat *pFormat;
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ PictFormatPtr pFmt = glyphSet->format;
+ int (*oldErrorHandler) (Display *, XErrorEvent *);
+
+ pFormat = dmxFindFormat(dmxScreen, pFmt);
+ if (!pFormat) {
+ return BadMatch;
+ }
+
+ dmxGlyphLastError = 0;
+ oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
+
+ /* Catch when this fails */
+ glyphPriv->glyphSets[idx]
+ = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat);
+
+ XSetErrorHandler(oldErrorHandler);
+
+ if (dmxGlyphLastError) {
+ return dmxGlyphLastError;
+ }
+
+ return Success;
+}
+
+/** Create a Glyph Set on each screen. Save the glyphset ID from each
+ * screen in the Glyph Set's private structure. Fail if the format
+ * requested is not available or if the Glyph Set cannot be created on
+ * the screen. */
+static int
+dmxProcRenderCreateGlyphSet(ClientPtr client)
+{
+ int ret;
+
+ REQUEST(xRenderCreateGlyphSetReq);
+
+ ret = dmxSaveRenderVector[stuff->renderReqType] (client);
+
+ if (ret == Success) {
+ GlyphSetPtr glyphSet;
+ dmxGlyphPrivPtr glyphPriv;
+ int i;
+
+ /* Look up glyphSet that was just created ???? */
+ /* Store glyphsets from backends in glyphSet->devPrivate ????? */
+ /* Make sure we handle all errors here!! */
+
+ dixLookupResourceByType((pointer *) &glyphSet,
+ stuff->gsid, GlyphSetType,
+ client, DixDestroyAccess);
+
+ glyphPriv = malloc(sizeof(dmxGlyphPrivRec));
+ if (!glyphPriv)
+ return BadAlloc;
+ glyphPriv->glyphSets = NULL;
+ MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
+ DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ int beret;
+
+ if (!dmxScreen->beDisplay) {
+ glyphPriv->glyphSets[i] = 0;
+ continue;
+ }
+
+ if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) {
+ int j;
+
+ /* Free the glyph sets we've allocated thus far */
+ for (j = 0; j < i; j++)
+ dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet);
+
+ /* Free the resource created by render */
+ FreeResource(stuff->gsid, RT_NONE);
+
+ return beret;
+ }
+ }
+ }
+
+ return ret;
+}
+
+/** Free the previously allocated Glyph Sets for each screen. */
+static int
+dmxProcRenderFreeGlyphSet(ClientPtr client)
+{
+ GlyphSetPtr glyphSet;
+
+ REQUEST(xRenderFreeGlyphSetReq);
+
+ REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
+ dixLookupResourceByType((pointer *) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixDestroyAccess);
+
+ if (glyphSet && glyphSet->refcnt == 1) {
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) {
+ if (dmxBEFreeGlyphSet(screenInfo.screens[i], glyphSet))
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+
+ MAXSCREENSFREE(glyphPriv->glyphSets);
+ free(glyphPriv);
+ DMX_SET_GLYPH_PRIV(glyphSet, NULL);
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType] (client);
+}
+
+/** Add glyphs to the Glyph Set on each screen. */
+static int
+dmxProcRenderAddGlyphs(ClientPtr client)
+{
+ int ret;
+
+ REQUEST(xRenderAddGlyphsReq);
+
+ ret = dmxSaveRenderVector[stuff->renderReqType] (client);
+
+ if (ret == Success) {
+ GlyphSetPtr glyphSet;
+ dmxGlyphPrivPtr glyphPriv;
+ int i;
+ int nglyphs;
+ CARD32 *gids;
+ Glyph *gidsCopy;
+ xGlyphInfo *gi;
+ CARD8 *bits;
+ int nbytes;
+
+ dixLookupResourceByType((pointer *) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixReadAccess);
+ glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+
+ nglyphs = stuff->nglyphs;
+ gids = (CARD32 *) (stuff + 1);
+ gi = (xGlyphInfo *) (gids + nglyphs);
+ bits = (CARD8 *) (gi + nglyphs);
+ nbytes = ((stuff->length << 2) -
+ sizeof(xRenderAddGlyphsReq) -
+ (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs);
+
+ gidsCopy = malloc(sizeof(*gidsCopy) * nglyphs);
+ for (i = 0; i < nglyphs; i++)
+ gidsCopy[i] = gids[i];
+
+ /* FIXME: Will this ever fail? */
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) {
+ XRenderAddGlyphs(dmxScreen->beDisplay,
+ glyphPriv->glyphSets[i],
+ gidsCopy,
+ (XGlyphInfo *) gi,
+ nglyphs, (char *) bits, nbytes);
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+ free(gidsCopy);
+ }
+
+ return ret;
+}
+
+/** Free glyphs from the Glyph Set for each screen. */
+static int
+dmxProcRenderFreeGlyphs(ClientPtr client)
+{
+ GlyphSetPtr glyphSet;
+
+ REQUEST(xRenderFreeGlyphsReq);
+
+ REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
+ dixLookupResourceByType((pointer *) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixWriteAccess);
+
+ if (glyphSet) {
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ int i;
+ int nglyphs;
+ Glyph *gids;
+
+ nglyphs = ((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq)) >> 2;
+ if (nglyphs) {
+ gids = malloc(sizeof(*gids) * nglyphs);
+ for (i = 0; i < nglyphs; i++)
+ gids[i] = ((CARD32 *) (stuff + 1))[i];
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) {
+ XRenderFreeGlyphs(dmxScreen->beDisplay,
+ glyphPriv->glyphSets[i], gids, nglyphs);
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+ free(gids);
+ }
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType] (client);
+}
+
+/** Composite glyphs on each screen into the requested picture. If
+ * either the src or dest picture has not been allocated due to lazy
+ * window creation, this request will gracefully return. */
+static int
+dmxProcRenderCompositeGlyphs(ClientPtr client)
+{
+ int ret;
+
+ REQUEST(xRenderCompositeGlyphsReq);
+
+ ret = dmxSaveRenderVector[stuff->renderReqType] (client);
+
+ /* For the following to work with PanoramiX, it assumes that Render
+ * wraps the ProcRenderVector after dmxRenderInit has been called.
+ */
+ if (ret == Success) {
+ PicturePtr pSrc;
+ dmxPictPrivPtr pSrcPriv;
+ PicturePtr pDst;
+ dmxPictPrivPtr pDstPriv;
+ PictFormatPtr pFmt;
+ XRenderPictFormat *pFormat;
+ int size;
+
+ int scrnNum;
+ DMXScreenInfo *dmxScreen;
+
+ CARD8 *buffer;
+ CARD8 *end;
+ int space;
+
+ int nglyph;
+ char *glyphs;
+ char *curGlyph;
+
+ xGlyphElt *elt;
+ int nelt;
+ XGlyphElt8 *elts;
+ XGlyphElt8 *curElt;
+
+ GlyphSetPtr glyphSet;
+ dmxGlyphPrivPtr glyphPriv;
+
+ dixLookupResourceByType((pointer *) &pSrc,
+ stuff->src, PictureType, client, DixReadAccess);
+
+ pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ if (!pSrcPriv->pict)
+ return ret;
+
+ dixLookupResourceByType((pointer *) &pDst,
+ stuff->dst, PictureType,
+ client, DixWriteAccess);
+
+ pDstPriv = DMX_GET_PICT_PRIV(pDst);
+ if (!pDstPriv->pict)
+ return ret;
+
+ scrnNum = pDst->pDrawable->pScreen->myNum;
+ dmxScreen = &dmxScreens[scrnNum];
+
+ /* Note: If the back-end display has been detached, then it
+ * should not be possible to reach here since the pSrcPriv->pict
+ * and pDstPriv->pict will have already been set to 0.
+ */
+ if (!dmxScreen->beDisplay)
+ return ret;
+
+ if (stuff->maskFormat)
+ dixLookupResourceByType((pointer *) &pFmt,
+ stuff->maskFormat, PictFormatType,
+ client, DixReadAccess);
+ else
+ pFmt = NULL;
+
+ pFormat = dmxFindFormat(dmxScreen, pFmt);
+
+ switch (stuff->renderReqType) {
+ case X_RenderCompositeGlyphs8:
+ size = sizeof(CARD8);
+ break;
+ case X_RenderCompositeGlyphs16:
+ size = sizeof(CARD16);
+ break;
+ case X_RenderCompositeGlyphs32:
+ size = sizeof(CARD32);
+ break;
+ default:
+ return BadPictOp; /* Can't happen */
+ }
+
+ buffer = (CARD8 *) (stuff + 1);
+ end = (CARD8 *) stuff + (stuff->length << 2);
+ nelt = 0;
+ nglyph = 0;
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *) buffer;
+ buffer += sizeof(xGlyphElt);
+
+ if (elt->len == 0xff) {
+ buffer += 4;
+ }
+ else {
+ nelt++;
+ nglyph += elt->len;
+ space = size * elt->len;
+ if (space & 3)
+ space += 4 - (space & 3);
+ buffer += space;
+ }
+ }
+
+ /* The following only works for Render version > 0.2 */
+
+ /* All of the XGlyphElt* structure sizes are identical */
+ elts = malloc(nelt * sizeof(XGlyphElt8));
+ if (!elts)
+ return BadAlloc;
+
+ glyphs = malloc(nglyph * size);
+ if (!glyphs) {
+ free(elts);
+ return BadAlloc;
+ }
+
+ buffer = (CARD8 *) (stuff + 1);
+ end = (CARD8 *) stuff + (stuff->length << 2);
+ curGlyph = glyphs;
+ curElt = elts;
+
+ dixLookupResourceByType((pointer *) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixReadAccess);
+ glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *) buffer;
+ buffer += sizeof(xGlyphElt);
+
+ if (elt->len == 0xff) {
+ dixLookupResourceByType((pointer *) &glyphSet,
+ *((CARD32 *) buffer),
+ GlyphSetType, client, DixReadAccess);
+ glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ buffer += 4;
+ }
+ else {
+ curElt->glyphset = glyphPriv->glyphSets[scrnNum];
+ curElt->xOff = elt->deltax;
+ curElt->yOff = elt->deltay;
+ curElt->nchars = elt->len;
+ curElt->chars = curGlyph;
+
+ memcpy(curGlyph, buffer, size * elt->len);
+ curGlyph += size * elt->len;
+
+ curElt++;
+
+ space = size * elt->len;
+ if (space & 3)
+ space += 4 - (space & 3);
+ buffer += space;
+ }
+ }
+
+ switch (stuff->renderReqType) {
+ case X_RenderCompositeGlyphs8:
+ XRenderCompositeText8(dmxScreen->beDisplay, stuff->op,
+ pSrcPriv->pict, pDstPriv->pict,
+ pFormat,
+ stuff->xSrc, stuff->ySrc, 0, 0, elts, nelt);
+ break;
+ case X_RenderCompositeGlyphs16:
+ XRenderCompositeText16(dmxScreen->beDisplay, stuff->op,
+ pSrcPriv->pict, pDstPriv->pict,
+ pFormat,
+ stuff->xSrc, stuff->ySrc,
+ 0, 0, (XGlyphElt16 *) elts, nelt);
+ break;
+ case X_RenderCompositeGlyphs32:
+ XRenderCompositeText32(dmxScreen->beDisplay, stuff->op,
+ pSrcPriv->pict, pDstPriv->pict,
+ pFormat,
+ stuff->xSrc, stuff->ySrc,
+ 0, 0, (XGlyphElt32 *) elts, nelt);
+ break;
+ }
+
+ dmxSync(dmxScreen, FALSE);
+
+ free(elts);
+ free(glyphs);
+ }
+
+ return ret;
+}
+
+/** Set the picture transform on each screen. */
+static int
+dmxProcRenderSetPictureTransform(ClientPtr client)
+{
+ DMXScreenInfo *dmxScreen;
+ PicturePtr pPicture;
+ dmxPictPrivPtr pPictPriv;
+ XTransform xform;
+
+ REQUEST(xRenderSetPictureTransformReq);
+
+ REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
+
+ /* For the following to work with PanoramiX, it assumes that Render
+ * wraps the ProcRenderVector after dmxRenderInit has been called.
+ */
+ dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
+ pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ if (pPictPriv->pict) {
+ xform.matrix[0][0] = stuff->transform.matrix11;
+ xform.matrix[0][1] = stuff->transform.matrix12;
+ xform.matrix[0][2] = stuff->transform.matrix13;
+ xform.matrix[1][0] = stuff->transform.matrix21;
+ xform.matrix[1][1] = stuff->transform.matrix22;
+ xform.matrix[1][2] = stuff->transform.matrix23;
+ xform.matrix[2][0] = stuff->transform.matrix31;
+ xform.matrix[2][1] = stuff->transform.matrix32;
+ xform.matrix[2][2] = stuff->transform.matrix33;
+
+ XRenderSetPictureTransform(dmxScreen->beDisplay,
+ pPictPriv->pict, &xform);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType] (client);
+}
+
+/** Set the picture filter on each screen. */
+static int
+dmxProcRenderSetPictureFilter(ClientPtr client)
+{
+ DMXScreenInfo *dmxScreen;
+ PicturePtr pPicture;
+ dmxPictPrivPtr pPictPriv;
+ char *filter;
+ XFixed *params;
+ int nparams;
+
+ REQUEST(xRenderSetPictureFilterReq);
+
+ REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
+
+ /* For the following to work with PanoramiX, it assumes that Render
+ * wraps the ProcRenderVector after dmxRenderInit has been called.
+ */
+ dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
+ pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ if (pPictPriv->pict) {
+ filter = (char *) (stuff + 1);
+ params = (XFixed *) (filter + ((stuff->nbytes + 3) & ~3));
+ nparams = ((XFixed *) stuff + client->req_len) - params;
+
+ XRenderSetPictureFilter(dmxScreen->beDisplay,
+ pPictPriv->pict, filter, params, nparams);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType] (client);
+}
+
+/** Create a picture on the appropriate screen. This is the actual
+ * function that creates the picture. However, if the associated
+ * window has not yet been created due to lazy window creation, then
+ * delay the picture creation until the window is mapped. */
+static Picture
+dmxDoCreatePicture(PicturePtr pPicture)
+{
+ DrawablePtr pDraw = pPicture->pDrawable;
+ ScreenPtr pScreen = pDraw->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ XRenderPictFormat *pFormat;
+ Drawable draw;
+
+ if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr) (pDraw));
+
+ if (!(draw = pWinPriv->window)) {
+ /* Window has not been created yet due to the window
+ * optimization. Delay picture creation until window is
+ * mapped.
+ */
+ pWinPriv->hasPict = TRUE;
+ return 0;
+ }
+ }
+ else {
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr) (pDraw));
+
+ if (!(draw = pPixPriv->pixmap)) {
+ /* FIXME: Zero width/height pixmap?? */
+ return 0;
+ }
+ }
+
+ /* This should not be reached if the back-end display has been
+ * detached because the pWinPriv->window or the pPixPriv->pixmap
+ * will be NULL; however, we add it here for completeness
+ */
+ if (!dmxScreen->beDisplay)
+ return 0;
+
+ pFormat = dmxFindFormat(dmxScreen, pPicture->pFormat);
+
+ return XRenderCreatePicture(dmxScreen->beDisplay, draw, pFormat, 0, 0);
+}
+
+/** Create a list of pictures. This function is called by
+ * dmxCreateAndRealizeWindow() during the lazy window creation
+ * realization process. It creates the entire list of pictures that
+ * are associated with the given window. */
+void
+dmxCreatePictureList(WindowPtr pWindow)
+{
+ PicturePtr pPicture = GetPictureWindow(pWindow);
+
+ while (pPicture) {
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ /* Create the picture for this window */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+
+ /* ValidatePicture takes care of the state changes */
+
+ pPicture = pPicture->pNext;
+ }
+}
+
+/** Create \a pPicture on the backend. */
+int
+dmxBECreatePicture(PicturePtr pPicture)
+{
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ /* Create picutre on BE */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+
+ /* Flush changes to the backend server */
+ dmxValidatePicture(pPicture, (1 << (CPLastBit + 1)) - 1);
+
+ return Success;
+}
+
+/** Create a picture. This function handles the CreatePicture
+ * unwrapping/wrapping and calls dmxDoCreatePicture to actually create
+ * the picture on the appropriate screen. */
+int
+dmxCreatePicture(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+ int ret = Success;
+
+ DMX_UNWRAP(CreatePicture, dmxScreen, ps);
+#if 1
+ if (ps->CreatePicture)
+ ret = ps->CreatePicture(pPicture);
+#endif
+
+ /* Create picture on back-end server */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+ pPictPriv->savedMask = 0;
+
+ DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
+
+ return ret;
+}
+
+/** Destroy \a pPicture on the back-end server. */
+Bool
+dmxBEFreePicture(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ if (pPictPriv->pict) {
+ XRenderFreePicture(dmxScreen->beDisplay, pPictPriv->pict);
+ pPictPriv->pict = (Picture) 0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy a list of pictures that are associated with the window that
+ * is being destroyed. This function is called by #dmxDestroyWindow().
+ * */
+Bool
+dmxDestroyPictureList(WindowPtr pWindow)
+{
+ PicturePtr pPicture = GetPictureWindow(pWindow);
+ Bool ret = FALSE;
+
+ while (pPicture) {
+ ret |= dmxBEFreePicture(pPicture);
+ pPicture = pPicture->pNext;
+ }
+
+ return ret;
+}
+
+/** Destroy a picture. This function calls the wrapped function that
+ * frees the resources in the DMX server associated with this
+ * picture. */
+void
+dmxDestroyPicture(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ DMX_UNWRAP(DestroyPicture, dmxScreen, ps);
+
+ /* Destroy picture on back-end server */
+ if (dmxBEFreePicture(pPicture))
+ dmxSync(dmxScreen, FALSE);
+
+#if 1
+ if (ps->DestroyPicture)
+ ps->DestroyPicture(pPicture);
+#endif
+ DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
+}
+
+/** Change the picture's list of clip rectangles. */
+int
+dmxChangePictureClip(PicturePtr pPicture, int clipType, pointer value, int n)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(ChangePictureClip, dmxScreen, ps);
+#if 1
+ if (ps->ChangePictureClip)
+ ps->ChangePictureClip(pPicture, clipType, value, n);
+#endif
+
+ /* Change picture clip rects on back-end server */
+ if (pPictPriv->pict) {
+ /* The clip has already been changed into a region by the mi
+ * routine called above.
+ */
+ if (clipType == CT_NONE) {
+ /* Disable clipping, show all */
+ XFixesSetPictureClipRegion(dmxScreen->beDisplay,
+ pPictPriv->pict, 0, 0, None);
+ }
+ else if (pPicture->clientClip) {
+ RegionPtr pClip = pPicture->clientClip;
+ BoxPtr pBox = RegionRects(pClip);
+ int nBox = RegionNumRects(pClip);
+ XRectangle *pRects;
+ XRectangle *pRect;
+ int nRects;
+
+ nRects = nBox;
+ pRects = pRect = malloc(nRects * sizeof(*pRect));
+
+ while (nBox--) {
+ pRect->x = pBox->x1;
+ pRect->y = pBox->y1;
+ pRect->width = pBox->x2 - pBox->x1;
+ pRect->height = pBox->y2 - pBox->y1;
+ pBox++;
+ pRect++;
+ }
+
+ XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
+ pPictPriv->pict,
+ 0, 0, pRects, nRects);
+ free(pRects);
+ }
+ else {
+ XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
+ pPictPriv->pict, 0, 0, NULL, 0);
+ }
+ dmxSync(dmxScreen, FALSE);
+ }
+ else {
+ /* FIXME: Handle saving clip region when offscreen */
+ }
+
+ DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
+
+ return Success;
+}
+
+/** Destroy the picture's list of clip rectangles. */
+void
+dmxDestroyPictureClip(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(DestroyPictureClip, dmxScreen, ps);
+#if 1
+ if (ps->DestroyPictureClip)
+ ps->DestroyPictureClip(pPicture);
+#endif
+
+ /* Destroy picture clip rects on back-end server */
+ if (pPictPriv->pict) {
+ XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
+ pPictPriv->pict, 0, 0, NULL, 0);
+ dmxSync(dmxScreen, FALSE);
+ }
+ else {
+ /* FIXME: Handle destroying clip region when offscreen */
+ }
+
+ DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
+}
+
+/** Change the attributes of the pictures. If the picture has not yet
+ * been created due to lazy window creation, save the mask so that it
+ * can be used to appropriately initialize the picture's attributes
+ * when it is created later. */
+void
+dmxChangePicture(PicturePtr pPicture, Mask mask)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(ChangePicture, dmxScreen, ps);
+#if 1
+ if (ps->ChangePicture)
+ ps->ChangePicture(pPicture, mask);
+#endif
+
+ /* Picture attribute changes are handled in ValidatePicture */
+ pPictPriv->savedMask |= mask;
+
+ DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
+}
+
+/** Validate the picture's attributes before rendering to it. Update
+ * any picture attributes that have been changed by one of the higher
+ * layers. */
+void
+dmxValidatePicture(PicturePtr pPicture, Mask mask)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(ValidatePicture, dmxScreen, ps);
+
+ /* Change picture attributes on back-end server */
+ if (pPictPriv->pict) {
+ XRenderPictureAttributes attribs;
+
+ if (mask & CPRepeat) {
+ attribs.repeat = pPicture->repeatType;
+ }
+ if (mask & CPAlphaMap) {
+ if (pPicture->alphaMap) {
+ dmxPictPrivPtr pAlphaPriv;
+
+ pAlphaPriv = DMX_GET_PICT_PRIV(pPicture->alphaMap);
+ if (pAlphaPriv->pict) {
+ attribs.alpha_map = pAlphaPriv->pict;
+ }
+ else {
+ /* FIXME: alpha picture drawable has not been created?? */
+ return; /* or should this be: attribs.alpha_map = None; */
+ }
+ }
+ else {
+ attribs.alpha_map = None;
+ }
+ }
+ if (mask & CPAlphaXOrigin)
+ attribs.alpha_x_origin = pPicture->alphaOrigin.x;
+ if (mask & CPAlphaYOrigin)
+ attribs.alpha_y_origin = pPicture->alphaOrigin.y;
+ if (mask & CPClipXOrigin)
+ attribs.clip_x_origin = pPicture->clipOrigin.x;
+ if (mask & CPClipYOrigin)
+ attribs.clip_y_origin = pPicture->clipOrigin.y;
+ if (mask & CPClipMask)
+ mask &= ~CPClipMask; /* Handled in ChangePictureClip */
+ if (mask & CPGraphicsExposure)
+ attribs.graphics_exposures = pPicture->graphicsExposures;
+ if (mask & CPSubwindowMode)
+ attribs.subwindow_mode = pPicture->subWindowMode;
+ if (mask & CPPolyEdge)
+ attribs.poly_edge = pPicture->polyEdge;
+ if (mask & CPPolyMode)
+ attribs.poly_mode = pPicture->polyMode;
+ if (mask & CPComponentAlpha)
+ attribs.component_alpha = pPicture->componentAlpha;
+
+ XRenderChangePicture(dmxScreen->beDisplay, pPictPriv->pict,
+ mask, &attribs);
+ dmxSync(dmxScreen, FALSE);
+ }
+ else {
+ pPictPriv->savedMask |= mask;
+ }
+
+#if 1
+ if (ps->ValidatePicture)
+ ps->ValidatePicture(pPicture, mask);
+#endif
+
+ DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
+}
+
+/** Composite a picture on the appropriate screen by combining the
+ * specified rectangle of the transformed src and mask operands with
+ * the specified rectangle of the dst using op as the compositing
+ * operator. For a complete description see the protocol document of
+ * the RENDER library. */
+void
+dmxComposite(CARD8 op,
+ PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc,
+ INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pMaskPriv = NULL;
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ if (pMask)
+ pMaskPriv = DMX_GET_PICT_PRIV(pMask);
+
+ DMX_UNWRAP(Composite, dmxScreen, ps);
+#if 0
+ if (ps->Composite)
+ ps->Composite(op, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
+#endif
+
+ /* Composite on back-end server */
+ if (pSrcPriv->pict && pDstPriv->pict &&
+ ((pMaskPriv && pMaskPriv->pict) || !pMaskPriv)) {
+ XRenderComposite(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pMaskPriv ? pMaskPriv->pict : None,
+ pDstPriv->pict,
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
+}
+
+/** Null function to catch when/if RENDER calls lower level mi hooks.
+ * Compositing glyphs is handled by dmxProcRenderCompositeGlyphs().
+ * This function should never be called. */
+void
+dmxGlyphs(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int nlists, GlyphListPtr lists, GlyphPtr * glyphs)
+{
+ /* This won't work, so we need to wrap ProcRenderCompositeGlyphs */
+}
+
+/** Fill a rectangle on the appropriate screen by combining the color
+ * with the dest picture in the area specified by the list of
+ * rectangles. For a complete description see the protocol document of
+ * the RENDER library. */
+void
+dmxCompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color, int nRect, xRectangle *rects)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(CompositeRects, dmxScreen, ps);
+#if 0
+ if (ps->CompositeRects)
+ ps->CompositeRects(op, pDst, color, nRect, rects);
+#endif
+
+ /* CompositeRects on back-end server */
+ if (pPictPriv->pict) {
+ XRenderFillRectangles(dmxScreen->beDisplay,
+ op,
+ pPictPriv->pict,
+ (XRenderColor *) color,
+ (XRectangle *) rects, nRect);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
+}
+
+/** Indexed color visuals are not yet supported. */
+Bool
+dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
+{
+ return TRUE;
+}
+
+/** Indexed color visuals are not yet supported. */
+void
+dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
+{
+}
+
+/** Indexed color visuals are not yet supported. */
+void
+dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
+ int ndef, xColorItem * pdef)
+{
+}
+
+/** Composite a list of trapezoids on the appropriate screen. For a
+ * complete description see the protocol document of the RENDER
+ * library. */
+void
+dmxTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(Trapezoids, dmxScreen, ps);
+#if 0
+ if (ps->Trapezoids)
+ ps->Trapezoids(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, *traps);
+#endif
+
+ /* Draw trapezoids on back-end server */
+ if (pDstPriv->pict) {
+ XRenderPictFormat *pFormat;
+
+ pFormat = dmxFindFormat(dmxScreen, maskFormat);
+ if (!pFormat) {
+ /* FIXME: Error! */
+ }
+
+ XRenderCompositeTrapezoids(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pDstPriv->pict,
+ pFormat,
+ xSrc, ySrc, (XTrapezoid *) traps, ntrap);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
+}
+
+/** Composite a list of triangles on the appropriate screen. For a
+ * complete description see the protocol document of the RENDER
+ * library. */
+void
+dmxTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntri, xTriangle * tris)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(Triangles, dmxScreen, ps);
+#if 0
+ if (ps->Triangles)
+ ps->Triangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, *tris);
+#endif
+
+ /* Draw trapezoids on back-end server */
+ if (pDstPriv->pict) {
+ XRenderPictFormat *pFormat;
+
+ pFormat = dmxFindFormat(dmxScreen, maskFormat);
+ if (!pFormat) {
+ /* FIXME: Error! */
+ }
+
+ XRenderCompositeTriangles(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pDstPriv->pict,
+ pFormat,
+ xSrc, ySrc, (XTriangle *) tris, ntri);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
+}
diff --git a/xorg-server/hw/dmx/dmxpict.h b/xorg-server/hw/dmx/dmxpict.h
index f1d8c1f52..6c37be924 100644
--- a/xorg-server/hw/dmx/dmxpict.h
+++ b/xorg-server/hw/dmx/dmxpict.h
@@ -1,120 +1,116 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * This file provides access to the externally visible RENDER support
- * functions, global variables and macros for DMX.
- *
- * FIXME: Move function definitions for non-externally visible function
- * to .c file. */
-
-#ifndef DMXPICT_H
-#define DMXPICT_H
-
-/** Picture private structure */
-typedef struct _dmxPictPriv {
- Picture pict; /**< Picture ID from back-end server */
- Mask savedMask; /**< Mask of picture attributes saved for
- * lazy window creation. */
-} dmxPictPrivRec, *dmxPictPrivPtr;
-
-
-/** Glyph Set private structure */
-typedef struct _dmxGlyphPriv {
- GlyphSet *glyphSets; /**< Glyph Set IDs from back-end server */
-} dmxGlyphPrivRec, *dmxGlyphPrivPtr;
-
-
-extern void dmxInitRender(void);
-extern void dmxResetRender(void);
-
-extern Bool dmxPictureInit(ScreenPtr pScreen,
- PictFormatPtr formats, int nformats);
-
-extern void dmxCreatePictureList(WindowPtr pWindow);
-extern Bool dmxDestroyPictureList(WindowPtr pWindow);
-
-extern int dmxCreatePicture(PicturePtr pPicture);
-extern void dmxDestroyPicture(PicturePtr pPicture);
-extern int dmxChangePictureClip(PicturePtr pPicture, int clipType,
- pointer value, int n);
-extern void dmxDestroyPictureClip(PicturePtr pPicture);
-extern void dmxChangePicture(PicturePtr pPicture, Mask mask);
-extern void dmxValidatePicture(PicturePtr pPicture, Mask mask);
-extern void dmxComposite(CARD8 op,
- PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc,
- INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst,
- CARD16 width, CARD16 height);
-extern void dmxGlyphs(CARD8 op,
- PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int nlists, GlyphListPtr lists, GlyphPtr *glyphs);
-extern void dmxCompositeRects(CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect, xRectangle *rects);
-extern Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
-extern void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
-extern void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
- int ndef, xColorItem *pdef);
-extern void dmxTrapezoids(CARD8 op,
- PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int ntrap, xTrapezoid *traps);
-extern void dmxTriangles(CARD8 op,
- PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int ntri, xTriangle *tris);
-
-extern int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet);
-extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet);
-extern int dmxBECreatePicture(PicturePtr pPicture);
-extern Bool dmxBEFreePicture(PicturePtr pPicture);
-
-/** Get the picture private data given a picture pointer */
-#define DMX_GET_PICT_PRIV(_pPict) \
- (dmxPictPrivPtr)dixLookupPrivate(&(_pPict)->devPrivates, dmxPictPrivateKey)
-
-/** Set the glyphset private data given a glyphset pointer */
-#define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \
- GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateKey, (_pPriv))
-/** Get the glyphset private data given a glyphset pointer */
-#define DMX_GET_GLYPH_PRIV(_pGlyph) \
- (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateKey)
-
-#endif /* DMXPICT_H */
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides access to the externally visible RENDER support
+ * functions, global variables and macros for DMX.
+ *
+ * FIXME: Move function definitions for non-externally visible function
+ * to .c file. */
+
+#ifndef DMXPICT_H
+#define DMXPICT_H
+
+/** Picture private structure */
+typedef struct _dmxPictPriv {
+ Picture pict; /**< Picture ID from back-end server */
+ Mask savedMask; /**< Mask of picture attributes saved for
+ * lazy window creation. */
+} dmxPictPrivRec, *dmxPictPrivPtr;
+
+/** Glyph Set private structure */
+typedef struct _dmxGlyphPriv {
+ GlyphSet *glyphSets; /**< Glyph Set IDs from back-end server */
+} dmxGlyphPrivRec, *dmxGlyphPrivPtr;
+
+extern void dmxInitRender(void);
+extern void dmxResetRender(void);
+
+extern Bool dmxPictureInit(ScreenPtr pScreen,
+ PictFormatPtr formats, int nformats);
+
+extern void dmxCreatePictureList(WindowPtr pWindow);
+extern Bool dmxDestroyPictureList(WindowPtr pWindow);
+
+extern int dmxCreatePicture(PicturePtr pPicture);
+extern void dmxDestroyPicture(PicturePtr pPicture);
+extern int dmxChangePictureClip(PicturePtr pPicture, int clipType,
+ pointer value, int n);
+extern void dmxDestroyPictureClip(PicturePtr pPicture);
+extern void dmxChangePicture(PicturePtr pPicture, Mask mask);
+extern void dmxValidatePicture(PicturePtr pPicture, Mask mask);
+extern void dmxComposite(CARD8 op,
+ PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc,
+ INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
+extern void dmxGlyphs(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int nlists, GlyphListPtr lists, GlyphPtr * glyphs);
+extern void dmxCompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color,
+ int nRect, xRectangle *rects);
+extern Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
+extern void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
+extern void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
+ int ndef, xColorItem * pdef);
+extern void dmxTrapezoids(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int ntrap, xTrapezoid * traps);
+extern void dmxTriangles(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntri, xTriangle * tris);
+
+extern int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet);
+extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet);
+extern int dmxBECreatePicture(PicturePtr pPicture);
+extern Bool dmxBEFreePicture(PicturePtr pPicture);
+
+/** Get the picture private data given a picture pointer */
+#define DMX_GET_PICT_PRIV(_pPict) \
+ (dmxPictPrivPtr)dixLookupPrivate(&(_pPict)->devPrivates, dmxPictPrivateKey)
+
+/** Set the glyphset private data given a glyphset pointer */
+#define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \
+ GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateKey, (_pPriv))
+/** Get the glyphset private data given a glyphset pointer */
+#define DMX_GET_GLYPH_PRIV(_pGlyph) \
+ (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateKey)
+
+#endif /* DMXPICT_H */
diff --git a/xorg-server/hw/dmx/dmxpixmap.c b/xorg-server/hw/dmx/dmxpixmap.c
index 119dd1134..17aca9224 100644
--- a/xorg-server/hw/dmx/dmxpixmap.c
+++ b/xorg-server/hw/dmx/dmxpixmap.c
@@ -1,251 +1,262 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * Provides pixmap support. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxpixmap.h"
-
-#include "pixmapstr.h"
-#include "servermd.h"
-#include "privates.h"
-
-/** Initialize a private area in \a pScreen for pixmap information. */
-Bool dmxInitPixmap(ScreenPtr pScreen)
-{
- if (!dixRegisterPrivateKey(&dmxPixPrivateKeyRec, PRIVATE_PIXMAP, sizeof(dmxPixPrivRec)))
- return FALSE;
-
- return TRUE;
-}
-
-/** Create a pixmap on the back-end server. */
-void dmxBECreatePixmap(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
-
- /* Make sure we haven't already created this pixmap. This can
- * happen when the pixmap is used elsewhere (e.g., as a background
- * or border for a window) and the refcnt > 1.
- */
- if (pPixPriv->pixmap)
- return;
-
- if (pPixmap->drawable.width && pPixmap->drawable.height) {
- pPixPriv->pixmap = XCreatePixmap(dmxScreen->beDisplay,
- dmxScreen->scrnWin,
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- pPixmap->drawable.depth);
- dmxSync(dmxScreen, FALSE);
- }
-}
-
-/** Create a pixmap for \a pScreen with the specified \a width, \a
- * height, and \a depth. */
-PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PixmapPtr pPixmap;
- int bpp;
- dmxPixPrivPtr pPixPriv;
-
-#if 0
- DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
- if (pScreen->CreatePixmap)
- ret = pScreen->CreatePixmap(pPixmap);
-#endif
-
- /* Create pixmap on back-end server */
- if (depth == 24) bpp = 32;
- else bpp = depth;
-
- pPixmap = AllocatePixmap(pScreen, 0);
- if (!pPixmap)
- return NullPixmap;
-
- pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
- pPixmap->drawable.pScreen = pScreen;
- pPixmap->drawable.depth = depth;
- pPixmap->drawable.bitsPerPixel = bpp;
- pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = width;
- pPixmap->drawable.height = height;
- pPixmap->devKind = PixmapBytePad(width, bpp);
- pPixmap->refcnt = 1;
- pPixmap->usage_hint = usage_hint;
-
- pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
- pPixPriv->pixmap = (Pixmap)0;
- pPixPriv->detachedImage = NULL;
-
- /* Create the pixmap on the back-end server */
- if (dmxScreen->beDisplay) {
- dmxBECreatePixmap(pPixmap);
- }
-
-#if 0
- DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
-#endif
-
- return pPixmap;
-}
-
-/** Destroy the pixmap on the back-end server. */
-Bool dmxBEFreePixmap(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
-
- if (pPixPriv->pixmap) {
- XFreePixmap(dmxScreen->beDisplay, pPixPriv->pixmap);
- pPixPriv->pixmap = (Pixmap)0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/** Destroy the pixmap pointed to by \a pPixmap. */
-Bool dmxDestroyPixmap(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
-
-#if 0
- DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
-#endif
-
- if (--pPixmap->refcnt)
- return TRUE;
-
- /* Destroy pixmap on back-end server */
- if (dmxScreen->beDisplay) {
- if (dmxBEFreePixmap(pPixmap)) {
- /* Also make sure that we destroy any detached image */
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
- if (pPixPriv->detachedImage)
- XDestroyImage(pPixPriv->detachedImage);
- dmxSync(dmxScreen, FALSE);
- }
- }
- FreePixmap(pPixmap);
-
-#if 0
- if (pScreen->DestroyPixmap)
- ret = pScreen->DestroyPixmap(pPixmap);
- DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
-#endif
-
- return ret;
-}
-
-/** Create and return a region based on the pixmap pointed to by \a
- * pPixmap. */
-RegionPtr dmxBitmapToRegion(PixmapPtr pPixmap)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pPixmap->drawable.pScreen->myNum];
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
- XImage *ximage;
- RegionPtr pReg, pTmpReg;
- int x, y;
- unsigned long previousPixel, currentPixel;
- BoxRec Box;
- Bool overlap;
-
- if (!dmxScreen->beDisplay) {
- pReg = RegionCreate(NullBox, 1);
- return pReg;
- }
-
- ximage = XGetImage(dmxScreen->beDisplay, pPixPriv->pixmap, 0, 0,
- pPixmap->drawable.width, pPixmap->drawable.height,
- 1, XYPixmap);
-
- pReg = RegionCreate(NullBox, 1);
- pTmpReg = RegionCreate(NullBox, 1);
- if(!pReg || !pTmpReg) {
- XDestroyImage(ximage);
- return NullRegion;
- }
-
- for (y = 0; y < pPixmap->drawable.height; y++) {
- Box.y1 = y;
- Box.y2 = y + 1;
- previousPixel = 0L;
- for (x = 0; x < pPixmap->drawable.width; x++) {
- currentPixel = XGetPixel(ximage, x, y);
- if (previousPixel != currentPixel) {
- if (previousPixel == 0L) {
- /* left edge */
- Box.x1 = x;
- } else if (currentPixel == 0L) {
- /* right edge */
- Box.x2 = x;
- RegionReset(pTmpReg, &Box);
- RegionAppend(pReg, pTmpReg);
- }
- previousPixel = currentPixel;
- }
- }
- if (previousPixel != 0L) {
- /* right edge because of the end of pixmap */
- Box.x2 = pPixmap->drawable.width;
- RegionReset(pTmpReg, &Box);
- RegionAppend(pReg, pTmpReg);
- }
- }
-
- RegionDestroy(pTmpReg);
- XDestroyImage(ximage);
-
- RegionValidate(pReg, &overlap);
-
- dmxSync(dmxScreen, FALSE);
- return pReg;
-}
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Provides pixmap support. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxpixmap.h"
+
+#include "pixmapstr.h"
+#include "servermd.h"
+#include "privates.h"
+
+/** Initialize a private area in \a pScreen for pixmap information. */
+Bool
+dmxInitPixmap(ScreenPtr pScreen)
+{
+ if (!dixRegisterPrivateKey
+ (&dmxPixPrivateKeyRec, PRIVATE_PIXMAP, sizeof(dmxPixPrivRec)))
+ return FALSE;
+
+ return TRUE;
+}
+
+/** Create a pixmap on the back-end server. */
+void
+dmxBECreatePixmap(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ /* Make sure we haven't already created this pixmap. This can
+ * happen when the pixmap is used elsewhere (e.g., as a background
+ * or border for a window) and the refcnt > 1.
+ */
+ if (pPixPriv->pixmap)
+ return;
+
+ if (pPixmap->drawable.width && pPixmap->drawable.height) {
+ pPixPriv->pixmap = XCreatePixmap(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height,
+ pPixmap->drawable.depth);
+ dmxSync(dmxScreen, FALSE);
+ }
+}
+
+/** Create a pixmap for \a pScreen with the specified \a width, \a
+ * height, and \a depth. */
+PixmapPtr
+dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PixmapPtr pPixmap;
+ int bpp;
+ dmxPixPrivPtr pPixPriv;
+
+#if 0
+ DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
+ if (pScreen->CreatePixmap)
+ ret = pScreen->CreatePixmap(pPixmap);
+#endif
+
+ /* Create pixmap on back-end server */
+ if (depth == 24)
+ bpp = 32;
+ else
+ bpp = depth;
+
+ pPixmap = AllocatePixmap(pScreen, 0);
+ if (!pPixmap)
+ return NullPixmap;
+
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = bpp;
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->devKind = PixmapBytePad(width, bpp);
+ pPixmap->refcnt = 1;
+ pPixmap->usage_hint = usage_hint;
+
+ pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+ pPixPriv->pixmap = (Pixmap) 0;
+ pPixPriv->detachedImage = NULL;
+
+ /* Create the pixmap on the back-end server */
+ if (dmxScreen->beDisplay) {
+ dmxBECreatePixmap(pPixmap);
+ }
+
+#if 0
+ DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
+#endif
+
+ return pPixmap;
+}
+
+/** Destroy the pixmap on the back-end server. */
+Bool
+dmxBEFreePixmap(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (pPixPriv->pixmap) {
+ XFreePixmap(dmxScreen->beDisplay, pPixPriv->pixmap);
+ pPixPriv->pixmap = (Pixmap) 0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy the pixmap pointed to by \a pPixmap. */
+Bool
+dmxDestroyPixmap(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+
+#if 0
+ DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
+#endif
+
+ if (--pPixmap->refcnt)
+ return TRUE;
+
+ /* Destroy pixmap on back-end server */
+ if (dmxScreen->beDisplay) {
+ if (dmxBEFreePixmap(pPixmap)) {
+ /* Also make sure that we destroy any detached image */
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (pPixPriv->detachedImage)
+ XDestroyImage(pPixPriv->detachedImage);
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+ FreePixmap(pPixmap);
+
+#if 0
+ if (pScreen->DestroyPixmap)
+ ret = pScreen->DestroyPixmap(pPixmap);
+ DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
+#endif
+
+ return ret;
+}
+
+/** Create and return a region based on the pixmap pointed to by \a
+ * pPixmap. */
+RegionPtr
+dmxBitmapToRegion(PixmapPtr pPixmap)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pPixmap->drawable.pScreen->myNum];
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+ XImage *ximage;
+ RegionPtr pReg, pTmpReg;
+ int x, y;
+ unsigned long previousPixel, currentPixel;
+ BoxRec Box;
+ Bool overlap;
+
+ if (!dmxScreen->beDisplay) {
+ pReg = RegionCreate(NullBox, 1);
+ return pReg;
+ }
+
+ ximage = XGetImage(dmxScreen->beDisplay, pPixPriv->pixmap, 0, 0,
+ pPixmap->drawable.width, pPixmap->drawable.height,
+ 1, XYPixmap);
+
+ pReg = RegionCreate(NullBox, 1);
+ pTmpReg = RegionCreate(NullBox, 1);
+ if (!pReg || !pTmpReg) {
+ XDestroyImage(ximage);
+ return NullRegion;
+ }
+
+ for (y = 0; y < pPixmap->drawable.height; y++) {
+ Box.y1 = y;
+ Box.y2 = y + 1;
+ previousPixel = 0L;
+ for (x = 0; x < pPixmap->drawable.width; x++) {
+ currentPixel = XGetPixel(ximage, x, y);
+ if (previousPixel != currentPixel) {
+ if (previousPixel == 0L) {
+ /* left edge */
+ Box.x1 = x;
+ }
+ else if (currentPixel == 0L) {
+ /* right edge */
+ Box.x2 = x;
+ RegionReset(pTmpReg, &Box);
+ RegionAppend(pReg, pTmpReg);
+ }
+ previousPixel = currentPixel;
+ }
+ }
+ if (previousPixel != 0L) {
+ /* right edge because of the end of pixmap */
+ Box.x2 = pPixmap->drawable.width;
+ RegionReset(pTmpReg, &Box);
+ RegionAppend(pReg, pTmpReg);
+ }
+ }
+
+ RegionDestroy(pTmpReg);
+ XDestroyImage(ximage);
+
+ RegionValidate(pReg, &overlap);
+
+ dmxSync(dmxScreen, FALSE);
+ return pReg;
+}
diff --git a/xorg-server/hw/dmx/dmxprop.c b/xorg-server/hw/dmx/dmxprop.c
index b4695dd5d..4be2dbd4c 100644
--- a/xorg-server/hw/dmx/dmxprop.c
+++ b/xorg-server/hw/dmx/dmxprop.c
@@ -62,7 +62,7 @@
#include "dmx.h"
#include "dmxprop.h"
#include "dmxlog.h"
-#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
+#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
/** Holds the window id of all DMX windows on the backend X server. */
#define DMX_ATOMNAME "DMX_NAME"
@@ -72,95 +72,108 @@
extern char *display;
-static int dmxPropertyErrorHandler(Display *dpy, XErrorEvent *ev)
+static int
+dmxPropertyErrorHandler(Display * dpy, XErrorEvent * ev)
{
return 0;
}
-static const unsigned char *dmxPropertyIdentifier(void)
+static const unsigned char *
+dmxPropertyIdentifier(void)
{
- /* RATS: These buffers are only used in
- * length-limited calls. */
- char hostname[256];
- static char buf[128];
- static int initialized = 0;
-
- if (initialized++) return (unsigned char *)buf;
-
+ /* RATS: These buffers are only used in
+ * length-limited calls. */
+ char hostname[256];
+ static char buf[128];
+ static int initialized = 0;
+
+ if (initialized++)
+ return (unsigned char *) buf;
+
XmuGetHostname(hostname, sizeof(hostname));
snprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display);
- return (unsigned char *)buf;
+ return (unsigned char *) buf;
}
/** Starting with the \a start screen, iterate over all of the screens
* on the same physical X server as \a start, calling \a f with the
* screen and the \a closure. (The common case is that \a start is the
* only DMX window on the backend X server.) */
-void *dmxPropertyIterate(DMXScreenInfo *start,
- void *(*f)(DMXScreenInfo *dmxScreen, void *),
- void *closure)
+void *
+dmxPropertyIterate(DMXScreenInfo * start,
+ void *(*f) (DMXScreenInfo * dmxScreen, void *),
+ void *closure)
{
DMXScreenInfo *pt;
if (!start->next) {
- if (!start->beDisplay) return NULL;
+ if (!start->beDisplay)
+ return NULL;
return f(start, closure);
}
- for (pt = start->next; /* condition at end of loop */; pt = pt->next) {
+ for (pt = start->next; /* condition at end of loop */ ; pt = pt->next) {
void *retval;
+
/* beDisplay ban be NULL if a screen was detached */
dmxLog(dmxDebug, "pt = %p\n", pt);
dmxLog(dmxDebug, "pt->beDisplay = %p\n", pt->beDisplay);
- if (pt->beDisplay && (retval = f(pt, closure))) return retval;
- if (pt == start) break;
+ if (pt->beDisplay && (retval = f(pt, closure)))
+ return retval;
+ if (pt == start)
+ break;
}
return NULL;
}
/** Returns 0 if this is the only Xdmx session on the display; 1
* otherwise. */
-static int dmxPropertyCheckOtherServers(DMXScreenInfo *dmxScreen, Atom atom)
+static int
+dmxPropertyCheckOtherServers(DMXScreenInfo * dmxScreen, Atom atom)
{
- Display *dpy = dmxScreen->beDisplay;
+ Display *dpy = dmxScreen->beDisplay;
XTextProperty tp;
XTextProperty tproot;
- const char *pt;
- int retcode = 0;
- char **list = NULL;
- int count = 0;
- int i;
- int (*dmxOldHandler)(Display *, XErrorEvent *);
+ const char *pt;
+ int retcode = 0;
+ char **list = NULL;
+ int count = 0;
+ int i;
+ int (*dmxOldHandler) (Display *, XErrorEvent *);
if (!dpy)
- return 0;
-
- if (!XGetTextProperty(dpy, RootWindow(dpy,0), &tproot, atom)
- || !tproot.nitems) return 0;
-
- /* Ignore BadWindow errors for this
- * routine because the window id stored
- * in the property might be old */
+ return 0;
+
+ if (!XGetTextProperty(dpy, RootWindow(dpy, 0), &tproot, atom)
+ || !tproot.nitems)
+ return 0;
+
+ /* Ignore BadWindow errors for this
+ * routine because the window id stored
+ * in the property might be old */
dmxOldHandler = XSetErrorHandler(dmxPropertyErrorHandler);
- for (pt = (const char *)tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) {
+ for (pt = (const char *) tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) {
if ((pt = strchr(pt, ','))) {
- Window win = strtol(pt+1, NULL, 10);
+ Window win = strtol(pt + 1, NULL, 10);
+
if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) {
- if (!strncmp((char *)tp.value, DMX_IDENT, strlen(DMX_IDENT))) {
+ if (!strncmp((char *) tp.value, DMX_IDENT, strlen(DMX_IDENT))) {
int flag = 0;
+
for (i = 0; i < count; i++)
- if (!strcmp(list[i], (char *)tp.value)) {
+ if (!strcmp(list[i], (char *) tp.value)) {
++flag;
break;
}
- if (flag) continue;
+ if (flag)
+ continue;
++retcode;
dmxLogOutputWarning(dmxScreen,
"%s also running on %s\n",
tp.value, dmxScreen->name);
list = realloc(list, ++count * sizeof(*list));
- list[count-1] = malloc(tp.nitems + 2);
- strncpy(list[count-1], (char *)tp.value, tp.nitems + 1);
+ list[count - 1] = malloc(tp.nitems + 2);
+ strncpy(list[count - 1], (char *) tp.value, tp.nitems + 1);
}
XFree(tp.value);
}
@@ -168,7 +181,8 @@ static int dmxPropertyCheckOtherServers(DMXScreenInfo *dmxScreen, Atom atom)
}
XSetErrorHandler(dmxOldHandler);
- for (i = 0; i < count; i++) free(list[i]);
+ for (i = 0; i < count; i++)
+ free(list[i]);
free(list);
XFree(tproot.value);
if (!retcode)
@@ -179,40 +193,45 @@ static int dmxPropertyCheckOtherServers(DMXScreenInfo *dmxScreen, Atom atom)
/** Returns NULL if this is the only Xdmx window on the display.
* Otherwise, returns a pointer to the dmxScreen of the other windows on
* the display. */
-static DMXScreenInfo *dmxPropertyCheckOtherWindows(DMXScreenInfo *dmxScreen,
- Atom atom)
+static DMXScreenInfo *
+dmxPropertyCheckOtherWindows(DMXScreenInfo * dmxScreen, Atom atom)
{
- Display *dpy = dmxScreen->beDisplay;
- const unsigned char *id = dmxPropertyIdentifier();
- XTextProperty tproot;
- XTextProperty tp;
- const char *pt;
- int (*dmxOldHandler)(Display *, XErrorEvent *);
+ Display *dpy = dmxScreen->beDisplay;
+ const unsigned char *id = dmxPropertyIdentifier();
+ XTextProperty tproot;
+ XTextProperty tp;
+ const char *pt;
+ int (*dmxOldHandler) (Display *, XErrorEvent *);
if (!dpy)
- return NULL;
+ return NULL;
- if (!XGetTextProperty(dpy, RootWindow(dpy,0), &tproot, atom)
- || !tproot.nitems) return 0;
+ if (!XGetTextProperty(dpy, RootWindow(dpy, 0), &tproot, atom)
+ || !tproot.nitems)
+ return 0;
- /* Ignore BadWindow errors for this
- * routine because the window id stored
- * in the property might be old */
+ /* Ignore BadWindow errors for this
+ * routine because the window id stored
+ * in the property might be old */
dmxOldHandler = XSetErrorHandler(dmxPropertyErrorHandler);
- for (pt = (const char *)tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) {
+ for (pt = (const char *) tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) {
if ((pt = strchr(pt, ','))) {
- Window win = strtol(pt+1, NULL, 10);
+ Window win = strtol(pt + 1, NULL, 10);
+
if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) {
- dmxLog(dmxDebug,"On %s/%lu: %s\n",
+ dmxLog(dmxDebug, "On %s/%lu: %s\n",
dmxScreen->name, win, tp.value);
- if (!strncmp((char *)tp.value, (char *)id,
- strlen((char *)id))) {
+ if (!strncmp((char *) tp.value, (char *) id,
+ strlen((char *) id))) {
int idx;
-
- if (!(pt = strchr((char *)tp.value, ','))) continue;
- idx = strtol(pt+1, NULL, 10);
- if (idx < 0 || idx >= dmxNumScreens) continue;
- if (dmxScreens[idx].scrnWin != win) continue;
+
+ if (!(pt = strchr((char *) tp.value, ',')))
+ continue;
+ idx = strtol(pt + 1, NULL, 10);
+ if (idx < 0 || idx >= dmxNumScreens)
+ continue;
+ if (dmxScreens[idx].scrnWin != win)
+ continue;
XSetErrorHandler(dmxOldHandler);
return &dmxScreens[idx];
}
@@ -227,22 +246,23 @@ static DMXScreenInfo *dmxPropertyCheckOtherWindows(DMXScreenInfo *dmxScreen,
/** Returns 0 if this is the only Xdmx session on the display; 1
* otherwise. */
-int dmxPropertyDisplay(DMXScreenInfo *dmxScreen)
+int
+dmxPropertyDisplay(DMXScreenInfo * dmxScreen)
{
- Atom atom;
- const unsigned char *id = dmxPropertyIdentifier();
- Display *dpy = dmxScreen->beDisplay;
+ Atom atom;
+ const unsigned char *id = dmxPropertyIdentifier();
+ Display *dpy = dmxScreen->beDisplay;
if (!dpy)
- return 0;
+ return 0;
atom = XInternAtom(dpy, DMX_ATOMNAME, False);
if (dmxPropertyCheckOtherServers(dmxScreen, atom)) {
dmxScreen->shared = 1;
return 1;
}
- XChangeProperty(dpy, RootWindow(dpy,0), atom, XA_STRING, 8,
- PropModeReplace, id, strlen((char *)id));
+ XChangeProperty(dpy, RootWindow(dpy, 0), atom, XA_STRING, 8,
+ PropModeReplace, id, strlen((char *) id));
return 0;
}
@@ -251,18 +271,19 @@ int dmxPropertyDisplay(DMXScreenInfo *dmxScreen)
* names because there can be multiple synonyms for the same display,
* some of which cannot be determined without accessing the display
* itself (e.g., domain aliases or machines with multiple NICs). */
-int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name)
+int
+dmxPropertySameDisplay(DMXScreenInfo * dmxScreen, const char *name)
{
- Display *dpy0 = dmxScreen->beDisplay;
- Atom atom0;
- XTextProperty tp0;
- Display *dpy1 = NULL;
- Atom atom1;
- XTextProperty tp1;
- int retval = 0;
+ Display *dpy0 = dmxScreen->beDisplay;
+ Atom atom0;
+ XTextProperty tp0;
+ Display *dpy1 = NULL;
+ Atom atom1;
+ XTextProperty tp1;
+ int retval = 0;
if (!dpy0)
- return 0;
+ return 0;
tp0.nitems = 0;
tp1.nitems = 0;
@@ -271,7 +292,7 @@ int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name)
dmxLog(dmxWarning, "No atom on %s\n", dmxScreen->name);
return 0;
}
- if (!XGetTextProperty(dpy0, RootWindow(dpy0,0), &tp0, atom0)
+ if (!XGetTextProperty(dpy0, RootWindow(dpy0, 0), &tp0, atom0)
|| !tp0.nitems) {
dmxLog(dmxWarning, "No text property on %s\n", dmxScreen->name);
return 0;
@@ -286,17 +307,21 @@ int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name)
dmxLog(dmxDebug, "No atom on %s\n", name);
goto cleanup;
}
- if (!XGetTextProperty(dpy1, RootWindow(dpy1,0), &tp1, atom1)
+ if (!XGetTextProperty(dpy1, RootWindow(dpy1, 0), &tp1, atom1)
|| !tp1.nitems) {
dmxLog(dmxDebug, "No text property on %s\n", name);
goto cleanup;
}
- if (!strcmp((char *)tp0.value, (char *)tp1.value)) retval = 1;
-
- cleanup:
- if (tp0.nitems) XFree(tp0.value);
- if (tp1.nitems) XFree(tp1.value);
- if (dpy1) XCloseDisplay(dpy1);
+ if (!strcmp((char *) tp0.value, (char *) tp1.value))
+ retval = 1;
+
+ cleanup:
+ if (tp0.nitems)
+ XFree(tp0.value);
+ if (tp1.nitems)
+ XFree(tp1.value);
+ if (dpy1)
+ XCloseDisplay(dpy1);
return retval;
}
@@ -313,36 +338,38 @@ int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name)
*
* "#DMX_IDENT:<hostname running DMX>:<display name of DMX>,<screen number>"
*/
-void dmxPropertyWindow(DMXScreenInfo *dmxScreen)
+void
+dmxPropertyWindow(DMXScreenInfo * dmxScreen)
{
- Atom atom;
- const unsigned char *id = dmxPropertyIdentifier();
- Display *dpy = dmxScreen->beDisplay;
- Window win = dmxScreen->scrnWin;
- DMXScreenInfo *other;
- char buf[128]; /* RATS: only used with snprintf */
+ Atom atom;
+ const unsigned char *id = dmxPropertyIdentifier();
+ Display *dpy = dmxScreen->beDisplay;
+ Window win = dmxScreen->scrnWin;
+ DMXScreenInfo *other;
+ char buf[128]; /* RATS: only used with snprintf */
if (!dpy)
- return; /* FIXME: What should be done here if Xdmx is started
- * with this screen initially detached?
- */
+ return; /* FIXME: What should be done here if Xdmx is started
+ * with this screen initially detached?
+ */
atom = XInternAtom(dpy, DMX_ATOMNAME, False);
if ((other = dmxPropertyCheckOtherWindows(dmxScreen, atom))) {
DMXScreenInfo *tmp = dmxScreen->next;
- dmxScreen->next = (other->next ? other->next : other);
- other->next = (tmp ? tmp : dmxScreen);
+
+ dmxScreen->next = (other->next ? other->next : other);
+ other->next = (tmp ? tmp : dmxScreen);
dmxLog(dmxDebug, "%d/%s/%lu and %d/%s/%lu are on the same backend\n",
dmxScreen->index, dmxScreen->name, dmxScreen->scrnWin,
other->index, other->name, other->scrnWin);
}
snprintf(buf, sizeof(buf), ".%d,%lu", dmxScreen->index,
- (long unsigned)win);
- XChangeProperty(dpy, RootWindow(dpy,0), atom, XA_STRING, 8,
- PropModeAppend, (unsigned char *)buf, strlen(buf));
+ (long unsigned) win);
+ XChangeProperty(dpy, RootWindow(dpy, 0), atom, XA_STRING, 8,
+ PropModeAppend, (unsigned char *) buf, strlen(buf));
snprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index);
XChangeProperty(dpy, win, atom, XA_STRING, 8,
- PropModeAppend, (unsigned char *)buf, strlen(buf));
+ PropModeAppend, (unsigned char *) buf, strlen(buf));
}
diff --git a/xorg-server/hw/dmx/dmxprop.h b/xorg-server/hw/dmx/dmxprop.h
index 50135cd64..a1170520f 100644
--- a/xorg-server/hw/dmx/dmxprop.h
+++ b/xorg-server/hw/dmx/dmxprop.h
@@ -36,11 +36,10 @@
#ifndef _DMXPROP_H_
#define _DMXPROP_H_
-extern int dmxPropertyDisplay(DMXScreenInfo *dmxScreen);
-extern void dmxPropertyWindow(DMXScreenInfo *dmxScreen);
-extern void *dmxPropertyIterate(DMXScreenInfo *start,
- void *(*f)(DMXScreenInfo *dmxScreen,
- void *closure),
- void *closure);
-extern int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name);
+extern int dmxPropertyDisplay(DMXScreenInfo * dmxScreen);
+extern void dmxPropertyWindow(DMXScreenInfo * dmxScreen);
+extern void *dmxPropertyIterate(DMXScreenInfo * start,
+ void *(*f) (DMXScreenInfo * dmxScreen,
+ void *closure), void *closure);
+extern int dmxPropertySameDisplay(DMXScreenInfo * dmxScreen, const char *name);
#endif
diff --git a/xorg-server/hw/dmx/dmxscrinit.c b/xorg-server/hw/dmx/dmxscrinit.c
index 8582d2ceb..37b3f3b5a 100644
--- a/xorg-server/hw/dmx/dmxscrinit.c
+++ b/xorg-server/hw/dmx/dmxscrinit.c
@@ -1,522 +1,525 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- * David H. Dawes <dawes@xfree86.org>
- *
- */
-
-/** \file
- * This file provides support for screen initialization. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxshadow.h"
-#include "dmxscrinit.h"
-#include "dmxcursor.h"
-#include "dmxgc.h"
-#include "dmxgcops.h"
-#include "dmxwindow.h"
-#include "dmxpixmap.h"
-#include "dmxfont.h"
-#include "dmxcmap.h"
-#include "dmxprop.h"
-#include "dmxdpms.h"
-
-#include "dmxpict.h"
-
-#include "fb.h"
-#include "mipointer.h"
-#include "micmap.h"
-
-extern Bool dmxCloseScreen(int idx, ScreenPtr pScreen);
-static Bool dmxSaveScreen(ScreenPtr pScreen, int what);
-
-static unsigned long dmxGeneration;
-static unsigned long *dmxCursorGeneration;
-
-DevPrivateKeyRec dmxGCPrivateKeyRec;
-DevPrivateKeyRec dmxWinPrivateKeyRec;
-DevPrivateKeyRec dmxPixPrivateKeyRec;
-int dmxFontPrivateIndex; /**< Private index for Fonts */
-DevPrivateKeyRec dmxScreenPrivateKeyRec;
-DevPrivateKeyRec dmxColormapPrivateKeyRec;
-DevPrivateKeyRec dmxPictPrivateKeyRec;
-DevPrivateKeyRec dmxGlyphSetPrivateKeyRec;
-
-/** Initialize the parts of screen \a idx that require access to the
- * back-end server. */
-void dmxBEScreenInit(int idx, ScreenPtr pScreen)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- XSetWindowAttributes attribs;
- XGCValues gcvals;
- unsigned long mask;
- int i, j;
-
- /* FIXME: The dmxScreenInit() code currently assumes that it will
- * not be called if the Xdmx server is started with this screen
- * detached -- i.e., it assumes that dmxScreen->beDisplay is always
- * valid. This is not necessarily a valid assumption when full
- * addition/removal of screens is implemented, but when this code is
- * broken out for screen reattachment, then we will reevaluate this
- * assumption.
- */
-
- pScreen->mmWidth = DisplayWidthMM(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay));
- pScreen->mmHeight = DisplayHeightMM(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay));
-
- pScreen->whitePixel = dmxScreen->beWhitePixel;
- pScreen->blackPixel = dmxScreen->beBlackPixel;
-
- /* Handle screen savers and DPMS on the backend */
- dmxDPMSInit(dmxScreen);
-
- /* Create root window for screen */
- mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
- attribs.background_pixel = dmxScreen->beBlackPixel;
- attribs.event_mask = (KeyPressMask
- | KeyReleaseMask
- | ButtonPressMask
- | ButtonReleaseMask
- | EnterWindowMask
- | LeaveWindowMask
- | PointerMotionMask
- | KeymapStateMask
- | FocusChangeMask);
- attribs.colormap = dmxScreen->beDefColormaps[dmxScreen->beDefVisualIndex];
- attribs.override_redirect = True;
-
- dmxScreen->scrnWin =
- XCreateWindow(dmxScreen->beDisplay,
- DefaultRootWindow(dmxScreen->beDisplay),
- dmxScreen->scrnX,
- dmxScreen->scrnY,
- dmxScreen->scrnWidth,
- dmxScreen->scrnHeight,
- 0,
- pScreen->rootDepth,
- InputOutput,
- dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
- mask,
- &attribs);
- dmxPropertyWindow(dmxScreen);
-
- /*
- * This turns off the cursor by defining a cursor with no visible
- * components.
- */
- {
- char noCursorData[] = {0, 0, 0, 0,
- 0, 0, 0, 0};
- Pixmap pixmap;
- XColor color, tmp;
-
- pixmap = XCreateBitmapFromData(dmxScreen->beDisplay, dmxScreen->scrnWin,
- noCursorData, 8, 8);
- XAllocNamedColor(dmxScreen->beDisplay, dmxScreen->beDefColormaps[0],
- "black", &color, &tmp);
- dmxScreen->noCursor = XCreatePixmapCursor(dmxScreen->beDisplay,
- pixmap, pixmap,
- &color, &color, 0, 0);
- XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
- dmxScreen->noCursor);
-
- XFreePixmap(dmxScreen->beDisplay, pixmap);
- }
-
- XMapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
-
- if (dmxShadowFB) {
- mask = (GCFunction
- | GCPlaneMask
- | GCClipMask);
- gcvals.function = GXcopy;
- gcvals.plane_mask = AllPlanes;
- gcvals.clip_mask = None;
-
- dmxScreen->shadowGC = XCreateGC(dmxScreen->beDisplay,
- dmxScreen->scrnWin,
- mask, &gcvals);
-
- dmxScreen->shadowFBImage =
- XCreateImage(dmxScreen->beDisplay,
- dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
- dmxScreen->beDepth,
- ZPixmap,
- 0,
- (char *)dmxScreen->shadow,
- dmxScreen->scrnWidth, dmxScreen->scrnHeight,
- dmxScreen->beBPP,
- PixmapBytePad(dmxScreen->scrnWidth,
- dmxScreen->beBPP));
- } else {
- /* Create default drawables (used during GC creation) */
- for (i = 0; i < dmxScreen->beNumPixmapFormats; i++)
- for (j = 0; j < dmxScreen->beNumDepths; j++)
- if ((dmxScreen->bePixmapFormats[i].depth == 1) ||
- (dmxScreen->bePixmapFormats[i].depth ==
- dmxScreen->beDepths[j])) {
- dmxScreen->scrnDefDrawables[i] = (Drawable)
- XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
- 1, 1, dmxScreen->bePixmapFormats[i].depth);
- break;
- }
- }
-}
-
-/** Initialize screen number \a idx. */
-Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- int i, j;
-
- if (!dixRegisterPrivateKey(&dmxScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
- if (!dixRegisterPrivateKey(&dmxColormapPrivateKeyRec, PRIVATE_COLORMAP, 0))
- return FALSE;
- if (!dixRegisterPrivateKey(&dmxGlyphSetPrivateKeyRec, PRIVATE_GLYPHSET, 0))
- return FALSE;
-
- if (dmxGeneration != serverGeneration) {
- /* Allocate font private index */
- dmxFontPrivateIndex = AllocateFontPrivateIndex();
- if (dmxFontPrivateIndex == -1)
- return FALSE;
-
- dmxGeneration = serverGeneration;
- }
-
- if (dmxShadowFB) {
- dmxScreen->shadow = shadowAlloc(dmxScreen->scrnWidth,
- dmxScreen->scrnHeight,
- dmxScreen->beBPP);
- } else {
- if (!dmxInitGC(pScreen)) return FALSE;
- if (!dmxInitWindow(pScreen)) return FALSE;
- if (!dmxInitPixmap(pScreen)) return FALSE;
- }
-
- /*
- * Initalise the visual types. miSetVisualTypesAndMasks() requires
- * that all of the types for each depth be collected together. It's
- * intended for slightly different usage to what we would like here.
- * Maybe a miAddVisualTypeAndMask() function will be added to make
- * things easier here.
- */
- for (i = 0; i < dmxScreen->beNumDepths; i++) {
- int depth;
- int visuals = 0;
- int bitsPerRgb = 0;
- int preferredClass = -1;
- Pixel redMask = 0;
- Pixel greenMask = 0;
- Pixel blueMask = 0;
-
- depth = dmxScreen->beDepths[i];
- for (j = 0; j < dmxScreen->beNumVisuals; j++) {
- XVisualInfo *vi;
-
- vi = &dmxScreen->beVisuals[j];
- if (vi->depth == depth) {
- /* Assume the masks are all the same. */
- visuals |= (1 << vi->class);
- bitsPerRgb = vi->bits_per_rgb;
- redMask = vi->red_mask;
- greenMask = vi->green_mask;
- blueMask = vi->blue_mask;
- if (j == dmxScreen->beDefVisualIndex) {
- preferredClass = vi->class;
- }
- }
- }
- miSetVisualTypesAndMasks(depth, visuals, bitsPerRgb, preferredClass,
- redMask, greenMask, blueMask);
- }
-
- fbScreenInit(pScreen,
- dmxShadowFB ? dmxScreen->shadow : NULL,
- dmxScreen->scrnWidth,
- dmxScreen->scrnHeight,
- dmxScreen->beXDPI,
- dmxScreen->beXDPI,
- dmxScreen->scrnWidth,
- dmxScreen->beBPP);
- (void)dmxPictureInit(pScreen, 0, 0);
-
- /* Not yet... */
- pScreen->GetWindowPixmap = NULL;
- pScreen->SetWindowPixmap = NULL;
-
- if (dmxShadowFB && !shadowInit(pScreen, dmxShadowUpdateProc, NULL))
- return FALSE;
-
- if (dmxShadowFB) {
- miDCInitialize(pScreen, &dmxPointerCursorFuncs);
- } else {
- MAXSCREENSALLOC(dmxCursorGeneration);
- if (dmxCursorGeneration[idx] != serverGeneration) {
- if (!(miPointerInitialize(pScreen,
- &dmxPointerSpriteFuncs,
- &dmxPointerCursorFuncs,
- FALSE)))
- return FALSE;
-
- dmxCursorGeneration[idx] = serverGeneration;
- }
- }
-
- DMX_WRAP(CloseScreen, dmxCloseScreen, dmxScreen, pScreen);
- DMX_WRAP(SaveScreen, dmxSaveScreen, dmxScreen, pScreen);
-
- dmxBEScreenInit(idx, pScreen);
-
- if (!dmxShadowFB) {
- /* Wrap GC functions */
- DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
-
- /* Wrap Window functions */
- DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
- DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen);
- DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen);
- DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen,
- pScreen);
- DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen);
- DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen);
- DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen);
- DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen);
- DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen);
-
- DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen);
- DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen);
-
- DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen);
-
- /* Wrap Image functions */
- DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen);
- DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen);
-
- /* Wrap Pixmap functions */
- DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
- DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
- DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen);
-
- /* Wrap Font functions */
- DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen);
- DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen);
-
- /* Wrap Colormap functions */
- DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
- DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
- DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
- DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
-
- /* Wrap Shape functions */
- DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
- }
-
- if (!dmxCreateDefColormap(pScreen))
- return FALSE;
-
- return TRUE;
-}
-
-/** Close the \a pScreen resources on the back-end server. */
-void dmxBECloseScreen(ScreenPtr pScreen)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- int i;
-
- /* Restore the back-end screen-saver and DPMS state. */
- dmxDPMSTerm(dmxScreen);
-
- /* Free the screen resources */
-
- XFreeCursor(dmxScreen->beDisplay, dmxScreen->noCursor);
- dmxScreen->noCursor = (Cursor)0;
-
- XUnmapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
- XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
- dmxScreen->scrnWin = (Window)0;
-
- if (dmxShadowFB) {
- /* Free the shadow GC and image assocated with the back-end server */
- XFreeGC(dmxScreen->beDisplay, dmxScreen->shadowGC);
- dmxScreen->shadowGC = NULL;
- XFree(dmxScreen->shadowFBImage);
- dmxScreen->shadowFBImage = NULL;
- } else {
- /* Free the default drawables */
- for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- if (dmxScreen->scrnDefDrawables[i]) {
- XFreePixmap(dmxScreen->beDisplay,
- dmxScreen->scrnDefDrawables[i]);
- dmxScreen->scrnDefDrawables[i] = (Drawable)0;
- }
- }
- }
-
- /* Free resources allocated during initialization (in dmxinit.c) */
- for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
- XFreeColormap(dmxScreen->beDisplay, dmxScreen->beDefColormaps[i]);
- free(dmxScreen->beDefColormaps);
- dmxScreen->beDefColormaps = NULL;
-
-#if 0
- /* Do not free visuals, depths and pixmap formats here. Free them
- * in dmxCloseScreen() instead -- see comment below. */
- XFree(dmxScreen->beVisuals);
- dmxScreen->beVisuals = NULL;
-
- XFree(dmxScreen->beDepths);
- dmxScreen->beDepths = NULL;
-
- XFree(dmxScreen->bePixmapFormats);
- dmxScreen->bePixmapFormats = NULL;
-#endif
-
-#ifdef GLXEXT
- if (dmxScreen->glxVisuals) {
- XFree(dmxScreen->glxVisuals);
- dmxScreen->glxVisuals = NULL;
- dmxScreen->numGlxVisuals = 0;
- }
-#endif
-
- /* Close display */
- XCloseDisplay(dmxScreen->beDisplay);
- dmxScreen->beDisplay = NULL;
-}
-
-/** Close screen number \a idx. */
-Bool dmxCloseScreen(int idx, ScreenPtr pScreen)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
-
- /* Reset the proc vectors */
- if (idx == 0) {
- dmxResetRender();
- dmxResetFonts();
- }
-
- if (dmxShadowFB) {
- /* Free the shadow framebuffer */
- free(dmxScreen->shadow);
- } else {
-
- /* Unwrap Shape functions */
- DMX_UNWRAP(SetShape, dmxScreen, pScreen);
-
- /* Unwrap the pScreen functions */
- DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
-
- DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
- DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
- DMX_UNWRAP(PositionWindow, dmxScreen, pScreen);
- DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen);
- DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen);
- DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen);
- DMX_UNWRAP(RestackWindow, dmxScreen, pScreen);
- DMX_UNWRAP(WindowExposures, dmxScreen, pScreen);
- DMX_UNWRAP(CopyWindow, dmxScreen, pScreen);
-
- DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
- DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen);
-
- DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen);
-
- DMX_UNWRAP(GetImage, dmxScreen, pScreen);
- DMX_UNWRAP(GetSpans, dmxScreen, pScreen);
-
- DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
- DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
- DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen);
-
- DMX_UNWRAP(RealizeFont, dmxScreen, pScreen);
- DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen);
-
- DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
- DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
- DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
- DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
- }
-
- DMX_UNWRAP(SaveScreen, dmxScreen, pScreen);
-
- if (dmxScreen->beDisplay) {
- dmxBECloseScreen(pScreen);
-
-#if 1
- /* Free visuals, depths and pixmap formats here so that they
- * won't be freed when a screen is detached, thereby allowing
- * the screen to be reattached to be compared to the one
- * previously removed.
- */
- XFree(dmxScreen->beVisuals);
- dmxScreen->beVisuals = NULL;
-
- XFree(dmxScreen->beDepths);
- dmxScreen->beDepths = NULL;
-
- XFree(dmxScreen->bePixmapFormats);
- dmxScreen->bePixmapFormats = NULL;
-#endif
- }
-
- DMX_UNWRAP(CloseScreen, dmxScreen, pScreen);
- return pScreen->CloseScreen(idx, pScreen);
-}
-
-static Bool dmxSaveScreen(ScreenPtr pScreen, int what)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
- if (dmxScreen->beDisplay) {
- switch (what) {
- case SCREEN_SAVER_OFF:
- case SCREEN_SAVER_FORCER:
- XResetScreenSaver(dmxScreen->beDisplay);
- dmxSync(dmxScreen, FALSE);
- break;
- case SCREEN_SAVER_ON:
- case SCREEN_SAVER_CYCLE:
- XActivateScreenSaver(dmxScreen->beDisplay);
- dmxSync(dmxScreen, FALSE);
- break;
- }
- }
-
- return TRUE;
-}
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ *
+ */
+
+/** \file
+ * This file provides support for screen initialization. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxshadow.h"
+#include "dmxscrinit.h"
+#include "dmxcursor.h"
+#include "dmxgc.h"
+#include "dmxgcops.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+#include "dmxfont.h"
+#include "dmxcmap.h"
+#include "dmxprop.h"
+#include "dmxdpms.h"
+
+#include "dmxpict.h"
+
+#include "fb.h"
+#include "mipointer.h"
+#include "micmap.h"
+
+extern Bool dmxCloseScreen(int idx, ScreenPtr pScreen);
+static Bool dmxSaveScreen(ScreenPtr pScreen, int what);
+
+static unsigned long dmxGeneration;
+static unsigned long *dmxCursorGeneration;
+
+DevPrivateKeyRec dmxGCPrivateKeyRec;
+DevPrivateKeyRec dmxWinPrivateKeyRec;
+DevPrivateKeyRec dmxPixPrivateKeyRec;
+int dmxFontPrivateIndex; /**< Private index for Fonts */
+DevPrivateKeyRec dmxScreenPrivateKeyRec;
+DevPrivateKeyRec dmxColormapPrivateKeyRec;
+DevPrivateKeyRec dmxPictPrivateKeyRec;
+DevPrivateKeyRec dmxGlyphSetPrivateKeyRec;
+
+/** Initialize the parts of screen \a idx that require access to the
+ * back-end server. */
+void
+dmxBEScreenInit(int idx, ScreenPtr pScreen)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ XSetWindowAttributes attribs;
+ XGCValues gcvals;
+ unsigned long mask;
+ int i, j;
+
+ /* FIXME: The dmxScreenInit() code currently assumes that it will
+ * not be called if the Xdmx server is started with this screen
+ * detached -- i.e., it assumes that dmxScreen->beDisplay is always
+ * valid. This is not necessarily a valid assumption when full
+ * addition/removal of screens is implemented, but when this code is
+ * broken out for screen reattachment, then we will reevaluate this
+ * assumption.
+ */
+
+ pScreen->mmWidth = DisplayWidthMM(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay));
+ pScreen->mmHeight = DisplayHeightMM(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay));
+
+ pScreen->whitePixel = dmxScreen->beWhitePixel;
+ pScreen->blackPixel = dmxScreen->beBlackPixel;
+
+ /* Handle screen savers and DPMS on the backend */
+ dmxDPMSInit(dmxScreen);
+
+ /* Create root window for screen */
+ mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
+ attribs.background_pixel = dmxScreen->beBlackPixel;
+ attribs.event_mask = (KeyPressMask
+ | KeyReleaseMask
+ | ButtonPressMask
+ | ButtonReleaseMask
+ | EnterWindowMask
+ | LeaveWindowMask
+ | PointerMotionMask
+ | KeymapStateMask | FocusChangeMask);
+ attribs.colormap = dmxScreen->beDefColormaps[dmxScreen->beDefVisualIndex];
+ attribs.override_redirect = True;
+
+ dmxScreen->scrnWin =
+ XCreateWindow(dmxScreen->beDisplay,
+ DefaultRootWindow(dmxScreen->beDisplay),
+ dmxScreen->scrnX,
+ dmxScreen->scrnY,
+ dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight,
+ 0,
+ pScreen->rootDepth,
+ InputOutput,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ mask, &attribs);
+ dmxPropertyWindow(dmxScreen);
+
+ /*
+ * This turns off the cursor by defining a cursor with no visible
+ * components.
+ */
+ {
+ char noCursorData[] = { 0, 0, 0, 0,
+ 0, 0, 0, 0
+ };
+ Pixmap pixmap;
+ XColor color, tmp;
+
+ pixmap = XCreateBitmapFromData(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ noCursorData, 8, 8);
+ XAllocNamedColor(dmxScreen->beDisplay, dmxScreen->beDefColormaps[0],
+ "black", &color, &tmp);
+ dmxScreen->noCursor = XCreatePixmapCursor(dmxScreen->beDisplay,
+ pixmap, pixmap,
+ &color, &color, 0, 0);
+ XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ dmxScreen->noCursor);
+
+ XFreePixmap(dmxScreen->beDisplay, pixmap);
+ }
+
+ XMapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+
+ if (dmxShadowFB) {
+ mask = (GCFunction | GCPlaneMask | GCClipMask);
+ gcvals.function = GXcopy;
+ gcvals.plane_mask = AllPlanes;
+ gcvals.clip_mask = None;
+
+ dmxScreen->shadowGC = XCreateGC(dmxScreen->beDisplay,
+ dmxScreen->scrnWin, mask, &gcvals);
+
+ dmxScreen->shadowFBImage =
+ XCreateImage(dmxScreen->beDisplay,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].
+ visual, dmxScreen->beDepth, ZPixmap, 0,
+ (char *) dmxScreen->shadow, dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight, dmxScreen->beBPP,
+ PixmapBytePad(dmxScreen->scrnWidth, dmxScreen->beBPP));
+ }
+ else {
+ /* Create default drawables (used during GC creation) */
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++)
+ for (j = 0; j < dmxScreen->beNumDepths; j++)
+ if ((dmxScreen->bePixmapFormats[i].depth == 1) ||
+ (dmxScreen->bePixmapFormats[i].depth ==
+ dmxScreen->beDepths[j])) {
+ dmxScreen->scrnDefDrawables[i] = (Drawable)
+ XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ 1, 1,
+ dmxScreen->bePixmapFormats[i].depth);
+ break;
+ }
+ }
+}
+
+/** Initialize screen number \a idx. */
+Bool
+dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ int i, j;
+
+ if (!dixRegisterPrivateKey(&dmxScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&dmxColormapPrivateKeyRec, PRIVATE_COLORMAP, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&dmxGlyphSetPrivateKeyRec, PRIVATE_GLYPHSET, 0))
+ return FALSE;
+
+ if (dmxGeneration != serverGeneration) {
+ /* Allocate font private index */
+ dmxFontPrivateIndex = AllocateFontPrivateIndex();
+ if (dmxFontPrivateIndex == -1)
+ return FALSE;
+
+ dmxGeneration = serverGeneration;
+ }
+
+ if (dmxShadowFB) {
+ dmxScreen->shadow = shadowAlloc(dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight,
+ dmxScreen->beBPP);
+ }
+ else {
+ if (!dmxInitGC(pScreen))
+ return FALSE;
+ if (!dmxInitWindow(pScreen))
+ return FALSE;
+ if (!dmxInitPixmap(pScreen))
+ return FALSE;
+ }
+
+ /*
+ * Initalise the visual types. miSetVisualTypesAndMasks() requires
+ * that all of the types for each depth be collected together. It's
+ * intended for slightly different usage to what we would like here.
+ * Maybe a miAddVisualTypeAndMask() function will be added to make
+ * things easier here.
+ */
+ for (i = 0; i < dmxScreen->beNumDepths; i++) {
+ int depth;
+ int visuals = 0;
+ int bitsPerRgb = 0;
+ int preferredClass = -1;
+ Pixel redMask = 0;
+ Pixel greenMask = 0;
+ Pixel blueMask = 0;
+
+ depth = dmxScreen->beDepths[i];
+ for (j = 0; j < dmxScreen->beNumVisuals; j++) {
+ XVisualInfo *vi;
+
+ vi = &dmxScreen->beVisuals[j];
+ if (vi->depth == depth) {
+ /* Assume the masks are all the same. */
+ visuals |= (1 << vi->class);
+ bitsPerRgb = vi->bits_per_rgb;
+ redMask = vi->red_mask;
+ greenMask = vi->green_mask;
+ blueMask = vi->blue_mask;
+ if (j == dmxScreen->beDefVisualIndex) {
+ preferredClass = vi->class;
+ }
+ }
+ }
+ miSetVisualTypesAndMasks(depth, visuals, bitsPerRgb, preferredClass,
+ redMask, greenMask, blueMask);
+ }
+
+ fbScreenInit(pScreen,
+ dmxShadowFB ? dmxScreen->shadow : NULL,
+ dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight,
+ dmxScreen->beXDPI,
+ dmxScreen->beXDPI, dmxScreen->scrnWidth, dmxScreen->beBPP);
+ (void) dmxPictureInit(pScreen, 0, 0);
+
+ /* Not yet... */
+ pScreen->GetWindowPixmap = NULL;
+ pScreen->SetWindowPixmap = NULL;
+
+ if (dmxShadowFB && !shadowInit(pScreen, dmxShadowUpdateProc, NULL))
+ return FALSE;
+
+ if (dmxShadowFB) {
+ miDCInitialize(pScreen, &dmxPointerCursorFuncs);
+ }
+ else {
+ MAXSCREENSALLOC(dmxCursorGeneration);
+ if (dmxCursorGeneration[idx] != serverGeneration) {
+ if (!(miPointerInitialize(pScreen,
+ &dmxPointerSpriteFuncs,
+ &dmxPointerCursorFuncs, FALSE)))
+ return FALSE;
+
+ dmxCursorGeneration[idx] = serverGeneration;
+ }
+ }
+
+ DMX_WRAP(CloseScreen, dmxCloseScreen, dmxScreen, pScreen);
+ DMX_WRAP(SaveScreen, dmxSaveScreen, dmxScreen, pScreen);
+
+ dmxBEScreenInit(idx, pScreen);
+
+ if (!dmxShadowFB) {
+ /* Wrap GC functions */
+ DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
+
+ /* Wrap Window functions */
+ DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
+ DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen);
+ DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen);
+ DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen,
+ pScreen);
+ DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen);
+ DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen);
+ DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen);
+ DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen);
+ DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen);
+
+ DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen);
+ DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen);
+
+ DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen);
+
+ /* Wrap Image functions */
+ DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen);
+ DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen);
+
+ /* Wrap Pixmap functions */
+ DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
+ DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
+ DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen);
+
+ /* Wrap Font functions */
+ DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen);
+ DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen);
+
+ /* Wrap Colormap functions */
+ DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
+ DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
+ DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
+ DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
+
+ /* Wrap Shape functions */
+ DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
+ }
+
+ if (!dmxCreateDefColormap(pScreen))
+ return FALSE;
+
+ return TRUE;
+}
+
+/** Close the \a pScreen resources on the back-end server. */
+void
+dmxBECloseScreen(ScreenPtr pScreen)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ int i;
+
+ /* Restore the back-end screen-saver and DPMS state. */
+ dmxDPMSTerm(dmxScreen);
+
+ /* Free the screen resources */
+
+ XFreeCursor(dmxScreen->beDisplay, dmxScreen->noCursor);
+ dmxScreen->noCursor = (Cursor) 0;
+
+ XUnmapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+ XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+ dmxScreen->scrnWin = (Window) 0;
+
+ if (dmxShadowFB) {
+ /* Free the shadow GC and image assocated with the back-end server */
+ XFreeGC(dmxScreen->beDisplay, dmxScreen->shadowGC);
+ dmxScreen->shadowGC = NULL;
+ XFree(dmxScreen->shadowFBImage);
+ dmxScreen->shadowFBImage = NULL;
+ }
+ else {
+ /* Free the default drawables */
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ if (dmxScreen->scrnDefDrawables[i]) {
+ XFreePixmap(dmxScreen->beDisplay,
+ dmxScreen->scrnDefDrawables[i]);
+ dmxScreen->scrnDefDrawables[i] = (Drawable) 0;
+ }
+ }
+ }
+
+ /* Free resources allocated during initialization (in dmxinit.c) */
+ for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
+ XFreeColormap(dmxScreen->beDisplay, dmxScreen->beDefColormaps[i]);
+ free(dmxScreen->beDefColormaps);
+ dmxScreen->beDefColormaps = NULL;
+
+#if 0
+ /* Do not free visuals, depths and pixmap formats here. Free them
+ * in dmxCloseScreen() instead -- see comment below. */
+ XFree(dmxScreen->beVisuals);
+ dmxScreen->beVisuals = NULL;
+
+ XFree(dmxScreen->beDepths);
+ dmxScreen->beDepths = NULL;
+
+ XFree(dmxScreen->bePixmapFormats);
+ dmxScreen->bePixmapFormats = NULL;
+#endif
+
+#ifdef GLXEXT
+ if (dmxScreen->glxVisuals) {
+ XFree(dmxScreen->glxVisuals);
+ dmxScreen->glxVisuals = NULL;
+ dmxScreen->numGlxVisuals = 0;
+ }
+#endif
+
+ /* Close display */
+ XCloseDisplay(dmxScreen->beDisplay);
+ dmxScreen->beDisplay = NULL;
+}
+
+/** Close screen number \a idx. */
+Bool
+dmxCloseScreen(int idx, ScreenPtr pScreen)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ /* Reset the proc vectors */
+ if (idx == 0) {
+ dmxResetRender();
+ dmxResetFonts();
+ }
+
+ if (dmxShadowFB) {
+ /* Free the shadow framebuffer */
+ free(dmxScreen->shadow);
+ }
+ else {
+
+ /* Unwrap Shape functions */
+ DMX_UNWRAP(SetShape, dmxScreen, pScreen);
+
+ /* Unwrap the pScreen functions */
+ DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
+
+ DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(PositionWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen);
+ DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(RestackWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(WindowExposures, dmxScreen, pScreen);
+ DMX_UNWRAP(CopyWindow, dmxScreen, pScreen);
+
+ DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen);
+
+ DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen);
+
+ DMX_UNWRAP(GetImage, dmxScreen, pScreen);
+ DMX_UNWRAP(GetSpans, dmxScreen, pScreen);
+
+ DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
+ DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
+ DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen);
+
+ DMX_UNWRAP(RealizeFont, dmxScreen, pScreen);
+ DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen);
+
+ DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
+ DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
+ DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
+ DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
+ }
+
+ DMX_UNWRAP(SaveScreen, dmxScreen, pScreen);
+
+ if (dmxScreen->beDisplay) {
+ dmxBECloseScreen(pScreen);
+
+#if 1
+ /* Free visuals, depths and pixmap formats here so that they
+ * won't be freed when a screen is detached, thereby allowing
+ * the screen to be reattached to be compared to the one
+ * previously removed.
+ */
+ XFree(dmxScreen->beVisuals);
+ dmxScreen->beVisuals = NULL;
+
+ XFree(dmxScreen->beDepths);
+ dmxScreen->beDepths = NULL;
+
+ XFree(dmxScreen->bePixmapFormats);
+ dmxScreen->bePixmapFormats = NULL;
+#endif
+ }
+
+ DMX_UNWRAP(CloseScreen, dmxScreen, pScreen);
+ return pScreen->CloseScreen(idx, pScreen);
+}
+
+static Bool
+dmxSaveScreen(ScreenPtr pScreen, int what)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ if (dmxScreen->beDisplay) {
+ switch (what) {
+ case SCREEN_SAVER_OFF:
+ case SCREEN_SAVER_FORCER:
+ XResetScreenSaver(dmxScreen->beDisplay);
+ dmxSync(dmxScreen, FALSE);
+ break;
+ case SCREEN_SAVER_ON:
+ case SCREEN_SAVER_CYCLE:
+ XActivateScreenSaver(dmxScreen->beDisplay);
+ dmxSync(dmxScreen, FALSE);
+ break;
+ }
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/dmx/dmxshadow.c b/xorg-server/hw/dmx/dmxshadow.c
index e075dec2a..9b4bafc34 100644
--- a/xorg-server/hw/dmx/dmxshadow.c
+++ b/xorg-server/hw/dmx/dmxshadow.c
@@ -1,71 +1,70 @@
-/*
- * Copyright 2001 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- * David H. Dawes <dawes@xfree86.org>
- *
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxshadow.h"
-
-/** \file
- * This file provides support for the shadow frame buffer. */
-
-/** Update the screen from the shadow frame buffer. */
-void dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf)
-{
- RegionPtr damage = &pBuf->damage;
- int nbox = RegionNumRects(damage);
- BoxPtr pbox = RegionRects(damage);
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
- if (!dmxScreen->beDisplay)
- return;
-
- while (nbox--) {
- XPutImage(dmxScreen->beDisplay,
- dmxScreen->scrnWin,
- dmxScreen->shadowGC,
- dmxScreen->shadowFBImage,
- pbox->x1, pbox->y1,
- pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
-
- pbox++;
- }
-
- dmxSync(dmxScreen, FALSE);
-}
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ *
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxshadow.h"
+
+/** \file
+ * This file provides support for the shadow frame buffer. */
+
+/** Update the screen from the shadow frame buffer. */
+void
+dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ RegionPtr damage = &pBuf->damage;
+ int nbox = RegionNumRects(damage);
+ BoxPtr pbox = RegionRects(damage);
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ if (!dmxScreen->beDisplay)
+ return;
+
+ while (nbox--) {
+ XPutImage(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ dmxScreen->shadowGC,
+ dmxScreen->shadowFBImage,
+ pbox->x1, pbox->y1,
+ pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+
+ pbox++;
+ }
+
+ dmxSync(dmxScreen, FALSE);
+}
diff --git a/xorg-server/hw/dmx/dmxstat.c b/xorg-server/hw/dmx/dmxstat.c
index c08c6f4cd..0d8c22a9e 100644
--- a/xorg-server/hw/dmx/dmxstat.c
+++ b/xorg-server/hw/dmx/dmxstat.c
@@ -1,221 +1,238 @@
-/*
- * Copyright 2002, 2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * The DMX server code is written to call #dmxSync() whenever an XSync()
- * might be necessary. However, since XSync() requires a two way
- * communication with the other X server, eliminating unnecessary
- * XSync() calls is a key performance optimization. Support for this
- * optimization is provided in \a dmxsync.c. This file provides routines
- * that evaluate this optimization by counting the number of XSync()
- * calls and monitoring their latency. This functionality can be turned
- * on using the -stat command-line parameter. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxstat.h"
-#include "dmxlog.h"
-#include <X11/Xos.h> /* For sys/time.h */
-
-/** Used to compute a running average of value. */
-typedef struct _DMXStatAvg {
- int pos;
- int count;
- unsigned long value[DMX_STAT_LENGTH];
-} DMXStatAvg;
-
-/** Statistical information about XSync calls. */
-struct _DMXStatInfo {
- unsigned long syncCount;
- unsigned long oldSyncCount;
-
- DMXStatAvg usec;
- DMXStatAvg pending;
-
- unsigned long bins[DMX_STAT_BINS];
-};
-
-/* Interval in mS between statistic message log entries. */
- int dmxStatInterval;
-static int dmxStatDisplays;
-static OsTimerPtr dmxStatTimer;
-
-/** Return the number of microseconds as an unsigned long.
- * Unfortunately, this is only useful for intervals < about 4 sec. */
-static unsigned long usec(struct timeval *stop, struct timeval *start)
-{
- return (stop->tv_sec - start->tv_sec) * 1000000
- + stop->tv_usec - start->tv_usec;
-}
-
-static unsigned long avg(DMXStatAvg *data, unsigned long *max)
-{
- unsigned long sum;
- int i;
-
- *max = 0;
- if (!data->count) return 0;
-
- for (i = 0, sum = 0; i < data->count; i++) {
- if (data->value[i] > *max) *max = data->value[i];
- sum += data->value[i];
- }
- return sum / data->count;
-}
-
-/** Turn on XSync statistic gathering and printing. Print every \a
- * interval seconds, with lines for the first \a displays. If \a
- * interval is NULL, 1 will be used. If \a displays is NULL, 0 will be
- * used (meaning a line for every display will be printed). Note that
- * this function takes string arguments because it will usually be
- * called from #ddxProcessArgument in \a dmxinit.c. */
-void dmxStatActivate(const char *interval, const char *displays)
-{
- dmxStatInterval = (interval ? atoi(interval) : 1) * 1000;
- dmxStatDisplays = (displays ? atoi(displays) : 0);
-
- if (dmxStatInterval < 1000) dmxStatInterval = 1000;
- if (dmxStatDisplays < 0) dmxStatDisplays = 0;
-}
-
-/** Allocate a \a DMXStatInfo structure. */
-DMXStatInfo *dmxStatAlloc(void)
-{
- DMXStatInfo *pt = calloc(1, sizeof(*pt));
- return pt;
-}
-
-/** Free the memory used by a \a DMXStatInfo structure. */
-void dmxStatFree(DMXStatInfo *pt)
-{
- free(pt);
-}
-
-static void dmxStatValue(DMXStatAvg *data, unsigned long value)
-{
- if (data->count != DMX_STAT_LENGTH) ++data->count;
- if (data->pos >= DMX_STAT_LENGTH-1) data->pos = 0;
- data->value[data->pos++] = value;
-}
-
-/** Note that a XSync() was just done on \a dmxScreen with the \a start
- * and \a stop times (from gettimeofday()) and the number of
- * pending-but-not-yet-processed XSync requests. This routine is called
- * from #dmxDoSync in \a dmxsync.c */
-void dmxStatSync(DMXScreenInfo *dmxScreen,
- struct timeval *stop, struct timeval *start,
- unsigned long pending)
-{
- DMXStatInfo *s = dmxScreen->stat;
- unsigned long elapsed = usec(stop, start);
- unsigned long thresh;
- int i;
-
- ++s->syncCount;
- dmxStatValue(&s->usec, elapsed);
- dmxStatValue(&s->pending, pending);
-
- for (i = 0, thresh = DMX_STAT_BIN0; i < DMX_STAT_BINS-1; i++) {
- if (elapsed < thresh) {
- ++s->bins[i];
- break;
- }
- thresh *= DMX_STAT_BINMULT;
- }
- if (i == DMX_STAT_BINS-1) ++s->bins[i];
-}
-
-/* Actually do the work of printing out the human-readable message. */
-static CARD32 dmxStatCallback(OsTimerPtr timer, CARD32 t, pointer arg)
-{
- int i, j;
- static int header = 0;
- int limit = dmxNumScreens;
-
- if (!dmxNumScreens) {
- header = 0;
- return DMX_STAT_INTERVAL;
- }
-
- if (!header++ || !(header % 10)) {
- dmxLog(dmxDebug,
- " S SyncCount Sync/s avSync mxSync avPend mxPend | "
- "<10ms <1s >1s\n");
- }
-
- if (dmxStatDisplays && dmxStatDisplays < limit) limit = dmxStatDisplays;
- for (i = 0; i < limit; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- DMXStatInfo *s = dmxScreen->stat;
- unsigned long aSync, mSync;
- unsigned long aPend, mPend;
-
- if (!s) continue;
-
- aSync = avg(&s->usec, &mSync);
- aPend = avg(&s->pending, &mPend);
- dmxLog(dmxDebug, "%2d %9lu %7lu %6lu %6lu %6lu %6lu |",
- i, /* S */
- s->syncCount, /* SyncCount */
- (s->syncCount
- - s->oldSyncCount) * 1000 / dmxStatInterval, /* Sync/s */
- aSync, /* us/Sync */
- mSync, /* max/Sync */
- aPend, /* avgPend */
- mPend); /* maxPend */
- for (j = 0; j < DMX_STAT_BINS; j++)
- dmxLogCont(dmxDebug, " %5lu", s->bins[j]);
- dmxLogCont(dmxDebug, "\n");
-
- /* Reset/clear */
- s->oldSyncCount = s->syncCount;
- for (j = 0; j < DMX_STAT_BINS; j++) s->bins[j] = 0;
- }
- return DMX_STAT_INTERVAL; /* Place on queue again */
-}
-
-/** Try to initialize the statistic gathering and printing routines.
- * Initialization only takes place if #dmxStatActivate has already been
- * called. We don't need the same generation protection that we used in
- * dmxSyncInit because our timer is always on a queue -- hence, server
- * generation will always free it. */
-void dmxStatInit(void)
-{
- if (dmxStatInterval)
- dmxStatTimer = TimerSet(NULL, 0,
- dmxStatInterval, dmxStatCallback, NULL);
-}
+/*
+ * Copyright 2002, 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * The DMX server code is written to call #dmxSync() whenever an XSync()
+ * might be necessary. However, since XSync() requires a two way
+ * communication with the other X server, eliminating unnecessary
+ * XSync() calls is a key performance optimization. Support for this
+ * optimization is provided in \a dmxsync.c. This file provides routines
+ * that evaluate this optimization by counting the number of XSync()
+ * calls and monitoring their latency. This functionality can be turned
+ * on using the -stat command-line parameter. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxstat.h"
+#include "dmxlog.h"
+#include <X11/Xos.h> /* For sys/time.h */
+
+/** Used to compute a running average of value. */
+typedef struct _DMXStatAvg {
+ int pos;
+ int count;
+ unsigned long value[DMX_STAT_LENGTH];
+} DMXStatAvg;
+
+/** Statistical information about XSync calls. */
+struct _DMXStatInfo {
+ unsigned long syncCount;
+ unsigned long oldSyncCount;
+
+ DMXStatAvg usec;
+ DMXStatAvg pending;
+
+ unsigned long bins[DMX_STAT_BINS];
+};
+
+/* Interval in mS between statistic message log entries. */
+int dmxStatInterval;
+static int dmxStatDisplays;
+static OsTimerPtr dmxStatTimer;
+
+/** Return the number of microseconds as an unsigned long.
+ * Unfortunately, this is only useful for intervals < about 4 sec. */
+static unsigned long
+usec(struct timeval *stop, struct timeval *start)
+{
+ return (stop->tv_sec - start->tv_sec) * 1000000
+ + stop->tv_usec - start->tv_usec;
+}
+
+static unsigned long
+avg(DMXStatAvg * data, unsigned long *max)
+{
+ unsigned long sum;
+ int i;
+
+ *max = 0;
+ if (!data->count)
+ return 0;
+
+ for (i = 0, sum = 0; i < data->count; i++) {
+ if (data->value[i] > *max)
+ *max = data->value[i];
+ sum += data->value[i];
+ }
+ return sum / data->count;
+}
+
+/** Turn on XSync statistic gathering and printing. Print every \a
+ * interval seconds, with lines for the first \a displays. If \a
+ * interval is NULL, 1 will be used. If \a displays is NULL, 0 will be
+ * used (meaning a line for every display will be printed). Note that
+ * this function takes string arguments because it will usually be
+ * called from #ddxProcessArgument in \a dmxinit.c. */
+void
+dmxStatActivate(const char *interval, const char *displays)
+{
+ dmxStatInterval = (interval ? atoi(interval) : 1) * 1000;
+ dmxStatDisplays = (displays ? atoi(displays) : 0);
+
+ if (dmxStatInterval < 1000)
+ dmxStatInterval = 1000;
+ if (dmxStatDisplays < 0)
+ dmxStatDisplays = 0;
+}
+
+/** Allocate a \a DMXStatInfo structure. */
+DMXStatInfo *
+dmxStatAlloc(void)
+{
+ DMXStatInfo *pt = calloc(1, sizeof(*pt));
+
+ return pt;
+}
+
+/** Free the memory used by a \a DMXStatInfo structure. */
+void
+dmxStatFree(DMXStatInfo * pt)
+{
+ free(pt);
+}
+
+static void
+dmxStatValue(DMXStatAvg * data, unsigned long value)
+{
+ if (data->count != DMX_STAT_LENGTH)
+ ++data->count;
+ if (data->pos >= DMX_STAT_LENGTH - 1)
+ data->pos = 0;
+ data->value[data->pos++] = value;
+}
+
+/** Note that a XSync() was just done on \a dmxScreen with the \a start
+ * and \a stop times (from gettimeofday()) and the number of
+ * pending-but-not-yet-processed XSync requests. This routine is called
+ * from #dmxDoSync in \a dmxsync.c */
+void
+dmxStatSync(DMXScreenInfo * dmxScreen,
+ struct timeval *stop, struct timeval *start, unsigned long pending)
+{
+ DMXStatInfo *s = dmxScreen->stat;
+ unsigned long elapsed = usec(stop, start);
+ unsigned long thresh;
+ int i;
+
+ ++s->syncCount;
+ dmxStatValue(&s->usec, elapsed);
+ dmxStatValue(&s->pending, pending);
+
+ for (i = 0, thresh = DMX_STAT_BIN0; i < DMX_STAT_BINS - 1; i++) {
+ if (elapsed < thresh) {
+ ++s->bins[i];
+ break;
+ }
+ thresh *= DMX_STAT_BINMULT;
+ }
+ if (i == DMX_STAT_BINS - 1)
+ ++s->bins[i];
+}
+
+/* Actually do the work of printing out the human-readable message. */
+static CARD32
+dmxStatCallback(OsTimerPtr timer, CARD32 t, pointer arg)
+{
+ int i, j;
+ static int header = 0;
+ int limit = dmxNumScreens;
+
+ if (!dmxNumScreens) {
+ header = 0;
+ return DMX_STAT_INTERVAL;
+ }
+
+ if (!header++ || !(header % 10)) {
+ dmxLog(dmxDebug,
+ " S SyncCount Sync/s avSync mxSync avPend mxPend | "
+ "<10ms <1s >1s\n");
+ }
+
+ if (dmxStatDisplays && dmxStatDisplays < limit)
+ limit = dmxStatDisplays;
+ for (i = 0; i < limit; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ DMXStatInfo *s = dmxScreen->stat;
+ unsigned long aSync, mSync;
+ unsigned long aPend, mPend;
+
+ if (!s)
+ continue;
+
+ aSync = avg(&s->usec, &mSync);
+ aPend = avg(&s->pending, &mPend);
+ dmxLog(dmxDebug, "%2d %9lu %7lu %6lu %6lu %6lu %6lu |", i, /* S */
+ s->syncCount, /* SyncCount */
+ (s->syncCount - s->oldSyncCount) * 1000 / dmxStatInterval, /* Sync/s */
+ aSync, /* us/Sync */
+ mSync, /* max/Sync */
+ aPend, /* avgPend */
+ mPend); /* maxPend */
+ for (j = 0; j < DMX_STAT_BINS; j++)
+ dmxLogCont(dmxDebug, " %5lu", s->bins[j]);
+ dmxLogCont(dmxDebug, "\n");
+
+ /* Reset/clear */
+ s->oldSyncCount = s->syncCount;
+ for (j = 0; j < DMX_STAT_BINS; j++)
+ s->bins[j] = 0;
+ }
+ return DMX_STAT_INTERVAL; /* Place on queue again */
+}
+
+/** Try to initialize the statistic gathering and printing routines.
+ * Initialization only takes place if #dmxStatActivate has already been
+ * called. We don't need the same generation protection that we used in
+ * dmxSyncInit because our timer is always on a queue -- hence, server
+ * generation will always free it. */
+void
+dmxStatInit(void)
+{
+ if (dmxStatInterval)
+ dmxStatTimer = TimerSet(NULL, 0,
+ dmxStatInterval, dmxStatCallback, NULL);
+}
diff --git a/xorg-server/hw/dmx/dmxsync.c b/xorg-server/hw/dmx/dmxsync.c
index 8ace59470..bf28584b4 100644
--- a/xorg-server/hw/dmx/dmxsync.c
+++ b/xorg-server/hw/dmx/dmxsync.c
@@ -1,193 +1,207 @@
-/*
- * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * The DMX server code is written to call #dmxSync() whenever an XSync()
- * might be necessary. However, since XSync() requires a two way
- * communication with the other X server, eliminating unnecessary
- * XSync() calls is a key performance optimization. Support for this
- * optimization is provided here. Statistics about XSync() calls and
- * latency are gathered in \a dmxstat.c.
- *
- * During the initial conversion from calling XSync() immediately to the
- * XSync() batching method implemented in this file, it was noted that,
- * out of more than 300 \a x11perf tests, 8 tests became more than 100
- * times faster, with 68 more than 50X faster, 114 more than 10X faster,
- * and 181 more than 2X faster. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxstat.h"
-#include "dmxlog.h"
-#include <sys/time.h>
-
-static int dmxSyncInterval = 100; /* Default interval in milliseconds */
-static OsTimerPtr dmxSyncTimer;
-static int dmxSyncPending;
-
-static void dmxDoSync(DMXScreenInfo *dmxScreen)
-{
- dmxScreen->needsSync = FALSE;
-
- if (!dmxScreen->beDisplay)
- return; /* FIXME: Is this correct behavior for sync stats? */
-
- if (!dmxStatInterval) {
- XSync(dmxScreen->beDisplay, False);
- } else {
- struct timeval start, stop;
-
- gettimeofday(&start, 0);
- XSync(dmxScreen->beDisplay, False);
- gettimeofday(&stop, 0);
- dmxStatSync(dmxScreen, &stop, &start, dmxSyncPending);
- }
-}
-
-static CARD32 dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg)
-{
- int i;
-
- if (dmxSyncPending) {
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- if (dmxScreen->needsSync) dmxDoSync(dmxScreen);
- }
- }
- dmxSyncPending = 0;
- return 0; /* Do not place on queue again */
-}
-
-static void dmxSyncBlockHandler(pointer blockData, OSTimePtr pTimeout,
- pointer pReadMask)
-{
- TimerForce(dmxSyncTimer);
-}
-
-static void dmxSyncWakeupHandler(pointer blockData, int result,
- pointer pReadMask)
-{
-}
-
-/** Request the XSync() batching optimization with the specified \a
- * interval (in mS). If the \a interval is 0, 100mS is used. If the \a
- * interval is less than 0, then the XSync() batching optimization is
- * not requested (e.g., so the -syncbatch -1 command line option can
- * turn off the default 100mS XSync() batching).
- *
- * Note that the parameter to this routine is a string, since it will
- * usually be called from #ddxProcessArgument in \a dmxinit.c */
-void dmxSyncActivate(const char *interval)
-{
- dmxSyncInterval = (interval ? atoi(interval) : 100);
-
- if (dmxSyncInterval < 0) dmxSyncInterval = 0;
-}
-
-/** Initialize the XSync() batching optimization, but only if
- * #dmxSyncActivate was last called with a non-negative value. */
-void dmxSyncInit(void)
-{
- if (dmxSyncInterval) {
- RegisterBlockAndWakeupHandlers(dmxSyncBlockHandler,
- dmxSyncWakeupHandler,
- NULL);
- dmxLog(dmxInfo, "XSync batching with %d ms interval\n",
- dmxSyncInterval);
- } else {
- dmxLog(dmxInfo, "XSync batching disabled\n");
- }
-}
-
-/** Request an XSync() to the display used by \a dmxScreen. If \a now
- * is TRUE, call XSync() immediately instead of waiting for the next
- * XSync() batching point. Note that if XSync() batching was deselected
- * with #dmxSyncActivate() before #dmxSyncInit() was called, then no
- * XSync() batching is performed and this function always calles XSync()
- * immediately.
- *
- * (Note that this function uses TimerSet but works correctly in the
- * face of a server generation. See the source for details.)
- *
- * If \a dmxScreen is \a NULL, then all pending syncs will be flushed
- * immediately.
- */
-void dmxSync(DMXScreenInfo *dmxScreen, Bool now)
-{
- static unsigned long dmxGeneration = 0;
-
- if (dmxSyncInterval) {
- if (dmxGeneration != serverGeneration) {
- /* Server generation does a TimerInit, which frees all
- * timers. So, at this point dmxSyncTimer is either:
- * 1) NULL, iff dmxGeneration == 0,
- * 2) freed, if it was on a queue (dmxSyncPending != 0), or
- * 3) allocated, if it wasn't on a queue (dmxSyncPending == 0)
- */
- if (dmxSyncTimer && !dmxSyncPending) free(dmxSyncTimer);
- dmxSyncTimer = NULL;
- now = TRUE;
- dmxGeneration = serverGeneration;
- }
- /* Queue sync */
- if (dmxScreen) {
- dmxScreen->needsSync = TRUE;
- ++dmxSyncPending;
- }
-
- /* Do sync or set time for later */
- if (now || !dmxScreen) {
- if (!TimerForce(dmxSyncTimer)) dmxSyncCallback(NULL, 0, NULL);
- /* At this point, dmxSyncPending == 0 because
- * dmxSyncCallback must have been called. */
- if (dmxSyncPending)
- dmxLog(dmxFatal, "dmxSync(%s,%d): dmxSyncPending = %d\n",
- dmxScreen ? dmxScreen->name : "", now, dmxSyncPending);
- } else {
- dmxScreen->needsSync = TRUE;
- if (dmxSyncPending == 1)
- dmxSyncTimer = TimerSet(dmxSyncTimer, 0, dmxSyncInterval,
- dmxSyncCallback, NULL);
- }
- } else {
- /* If dmxSyncInterval is not being used,
- * then all the backends are already
- * up-to-date. */
- if (dmxScreen) dmxDoSync(dmxScreen);
- }
-}
+/*
+ * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * The DMX server code is written to call #dmxSync() whenever an XSync()
+ * might be necessary. However, since XSync() requires a two way
+ * communication with the other X server, eliminating unnecessary
+ * XSync() calls is a key performance optimization. Support for this
+ * optimization is provided here. Statistics about XSync() calls and
+ * latency are gathered in \a dmxstat.c.
+ *
+ * During the initial conversion from calling XSync() immediately to the
+ * XSync() batching method implemented in this file, it was noted that,
+ * out of more than 300 \a x11perf tests, 8 tests became more than 100
+ * times faster, with 68 more than 50X faster, 114 more than 10X faster,
+ * and 181 more than 2X faster. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxstat.h"
+#include "dmxlog.h"
+#include <sys/time.h>
+
+static int dmxSyncInterval = 100; /* Default interval in milliseconds */
+static OsTimerPtr dmxSyncTimer;
+static int dmxSyncPending;
+
+static void
+dmxDoSync(DMXScreenInfo * dmxScreen)
+{
+ dmxScreen->needsSync = FALSE;
+
+ if (!dmxScreen->beDisplay)
+ return; /* FIXME: Is this correct behavior for sync stats? */
+
+ if (!dmxStatInterval) {
+ XSync(dmxScreen->beDisplay, False);
+ }
+ else {
+ struct timeval start, stop;
+
+ gettimeofday(&start, 0);
+ XSync(dmxScreen->beDisplay, False);
+ gettimeofday(&stop, 0);
+ dmxStatSync(dmxScreen, &stop, &start, dmxSyncPending);
+ }
+}
+
+static CARD32
+dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg)
+{
+ int i;
+
+ if (dmxSyncPending) {
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->needsSync)
+ dmxDoSync(dmxScreen);
+ }
+ }
+ dmxSyncPending = 0;
+ return 0; /* Do not place on queue again */
+}
+
+static void
+dmxSyncBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
+{
+ TimerForce(dmxSyncTimer);
+}
+
+static void
+dmxSyncWakeupHandler(pointer blockData, int result, pointer pReadMask)
+{
+}
+
+/** Request the XSync() batching optimization with the specified \a
+ * interval (in mS). If the \a interval is 0, 100mS is used. If the \a
+ * interval is less than 0, then the XSync() batching optimization is
+ * not requested (e.g., so the -syncbatch -1 command line option can
+ * turn off the default 100mS XSync() batching).
+ *
+ * Note that the parameter to this routine is a string, since it will
+ * usually be called from #ddxProcessArgument in \a dmxinit.c */
+void
+dmxSyncActivate(const char *interval)
+{
+ dmxSyncInterval = (interval ? atoi(interval) : 100);
+
+ if (dmxSyncInterval < 0)
+ dmxSyncInterval = 0;
+}
+
+/** Initialize the XSync() batching optimization, but only if
+ * #dmxSyncActivate was last called with a non-negative value. */
+void
+dmxSyncInit(void)
+{
+ if (dmxSyncInterval) {
+ RegisterBlockAndWakeupHandlers(dmxSyncBlockHandler,
+ dmxSyncWakeupHandler, NULL);
+ dmxLog(dmxInfo, "XSync batching with %d ms interval\n",
+ dmxSyncInterval);
+ }
+ else {
+ dmxLog(dmxInfo, "XSync batching disabled\n");
+ }
+}
+
+/** Request an XSync() to the display used by \a dmxScreen. If \a now
+ * is TRUE, call XSync() immediately instead of waiting for the next
+ * XSync() batching point. Note that if XSync() batching was deselected
+ * with #dmxSyncActivate() before #dmxSyncInit() was called, then no
+ * XSync() batching is performed and this function always calles XSync()
+ * immediately.
+ *
+ * (Note that this function uses TimerSet but works correctly in the
+ * face of a server generation. See the source for details.)
+ *
+ * If \a dmxScreen is \a NULL, then all pending syncs will be flushed
+ * immediately.
+ */
+void
+dmxSync(DMXScreenInfo * dmxScreen, Bool now)
+{
+ static unsigned long dmxGeneration = 0;
+
+ if (dmxSyncInterval) {
+ if (dmxGeneration != serverGeneration) {
+ /* Server generation does a TimerInit, which frees all
+ * timers. So, at this point dmxSyncTimer is either:
+ * 1) NULL, iff dmxGeneration == 0,
+ * 2) freed, if it was on a queue (dmxSyncPending != 0), or
+ * 3) allocated, if it wasn't on a queue (dmxSyncPending == 0)
+ */
+ if (dmxSyncTimer && !dmxSyncPending)
+ free(dmxSyncTimer);
+ dmxSyncTimer = NULL;
+ now = TRUE;
+ dmxGeneration = serverGeneration;
+ }
+ /* Queue sync */
+ if (dmxScreen) {
+ dmxScreen->needsSync = TRUE;
+ ++dmxSyncPending;
+ }
+
+ /* Do sync or set time for later */
+ if (now || !dmxScreen) {
+ if (!TimerForce(dmxSyncTimer))
+ dmxSyncCallback(NULL, 0, NULL);
+ /* At this point, dmxSyncPending == 0 because
+ * dmxSyncCallback must have been called. */
+ if (dmxSyncPending)
+ dmxLog(dmxFatal, "dmxSync(%s,%d): dmxSyncPending = %d\n",
+ dmxScreen ? dmxScreen->name : "", now, dmxSyncPending);
+ }
+ else {
+ dmxScreen->needsSync = TRUE;
+ if (dmxSyncPending == 1)
+ dmxSyncTimer = TimerSet(dmxSyncTimer, 0, dmxSyncInterval,
+ dmxSyncCallback, NULL);
+ }
+ }
+ else {
+ /* If dmxSyncInterval is not being used,
+ * then all the backends are already
+ * up-to-date. */
+ if (dmxScreen)
+ dmxDoSync(dmxScreen);
+ }
+}
diff --git a/xorg-server/hw/dmx/dmxvisual.c b/xorg-server/hw/dmx/dmxvisual.c
index 7b8771f9e..23b9bddea 100644
--- a/xorg-server/hw/dmx/dmxvisual.c
+++ b/xorg-server/hw/dmx/dmxvisual.c
@@ -48,24 +48,25 @@
#include <GL/glxint.h>
extern VisualID glxMatchVisualInConfigList(ScreenPtr pScreen,
- VisualPtr pVisual,
- __GLXvisualConfig *configs,
- int nconfigs);
+ VisualPtr pVisual,
+ __GLXvisualConfig * configs,
+ int nconfigs);
-static Visual *dmxLookupGLXVisual(ScreenPtr pScreen, VisualPtr pVisual)
+static Visual *
+dmxLookupGLXVisual(ScreenPtr pScreen, VisualPtr pVisual)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- int j;
- VisualID vid;
+ int j;
+ VisualID vid;
vid = glxMatchVisualInConfigList(pScreen, pVisual,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals);
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals);
if (vid) {
- /* Find the X visual of the matching GLX visual */
- for (j = 0; j < dmxScreen->beNumVisuals; j++)
- if (vid == dmxScreen->beVisuals[j].visualid)
- return dmxScreen->beVisuals[j].visual;
+ /* Find the X visual of the matching GLX visual */
+ for (j = 0; j < dmxScreen->beNumVisuals; j++)
+ if (vid == dmxScreen->beVisuals[j].visualid)
+ return dmxScreen->beVisuals[j].visual;
}
/* No matching visual found */
@@ -74,66 +75,71 @@ static Visual *dmxLookupGLXVisual(ScreenPtr pScreen, VisualPtr pVisual)
#endif
/** Return the visual that matched \a pVisual. */
-Visual *dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual)
+Visual *
+dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- int i;
+ int i;
+
#ifdef GLXEXT
- Visual *retval;
+ Visual *retval;
#endif
if (!dmxScreen->beDisplay)
- return NULL;
+ return NULL;
#ifdef GLXEXT
if ((retval = dmxLookupGLXVisual(pScreen, pVisual)))
- return retval;
+ return retval;
#endif
for (i = 0; i < dmxScreen->beNumVisuals; i++) {
- if (pVisual->class == dmxScreen->beVisuals[i].class &&
- pVisual->bitsPerRGBValue == dmxScreen->beVisuals[i].bits_per_rgb &&
- pVisual->ColormapEntries == dmxScreen->beVisuals[i].colormap_size &&
- pVisual->nplanes == dmxScreen->beVisuals[i].depth &&
- pVisual->redMask == dmxScreen->beVisuals[i].red_mask &&
- pVisual->greenMask == dmxScreen->beVisuals[i].green_mask &&
- pVisual->blueMask == dmxScreen->beVisuals[i].blue_mask) {
- return dmxScreen->beVisuals[i].visual;
- }
+ if (pVisual->class == dmxScreen->beVisuals[i].class &&
+ pVisual->bitsPerRGBValue == dmxScreen->beVisuals[i].bits_per_rgb &&
+ pVisual->ColormapEntries == dmxScreen->beVisuals[i].colormap_size &&
+ pVisual->nplanes == dmxScreen->beVisuals[i].depth &&
+ pVisual->redMask == dmxScreen->beVisuals[i].red_mask &&
+ pVisual->greenMask == dmxScreen->beVisuals[i].green_mask &&
+ pVisual->blueMask == dmxScreen->beVisuals[i].blue_mask) {
+ return dmxScreen->beVisuals[i].visual;
+ }
}
return NULL;
}
/** Return the visual that matched the \a vid. */
-Visual *dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid)
+Visual *
+dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid)
{
Visual *visual;
- int i;
+ int i;
if (!dmxScreens[pScreen->myNum].beDisplay)
- return NULL;
+ return NULL;
for (i = 0; i < pScreen->numVisuals; i++) {
- if (pScreen->visuals[i].vid == vid) {
- visual = dmxLookupVisual(pScreen, &pScreen->visuals[i]);
- if (visual) return visual;
- }
+ if (pScreen->visuals[i].vid == vid) {
+ visual = dmxLookupVisual(pScreen, &pScreen->visuals[i]);
+ if (visual)
+ return visual;
+ }
}
return NULL;
}
/** Return the colormap for the \a visual. */
-Colormap dmxColormapFromDefaultVisual(ScreenPtr pScreen, Visual *visual)
+Colormap
+dmxColormapFromDefaultVisual(ScreenPtr pScreen, Visual * visual)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- int i;
+ int i;
if (dmxScreen->beDisplay) {
- for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
- if (visual == dmxScreen->beVisuals[i].visual)
- return dmxScreen->beDefColormaps[i];
+ for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
+ if (visual == dmxScreen->beVisuals[i].visual)
+ return dmxScreen->beDefColormaps[i];
}
return None;
diff --git a/xorg-server/hw/dmx/dmxwindow.c b/xorg-server/hw/dmx/dmxwindow.c
index 704fcff54..855e56b9d 100644
--- a/xorg-server/hw/dmx/dmxwindow.c
+++ b/xorg-server/hw/dmx/dmxwindow.c
@@ -52,79 +52,78 @@
static void dmxDoRestackWindow(WindowPtr pWindow);
static void dmxDoChangeWindowAttributes(WindowPtr pWindow,
- unsigned long *mask,
- XSetWindowAttributes *attribs);
+ unsigned long *mask,
+ XSetWindowAttributes * attribs);
static void dmxDoSetShape(WindowPtr pWindow);
/** Initialize the private area for the window functions. */
-Bool dmxInitWindow(ScreenPtr pScreen)
+Bool
+dmxInitWindow(ScreenPtr pScreen)
{
- if (!dixRegisterPrivateKey(&dmxWinPrivateKeyRec, PRIVATE_WINDOW, sizeof(dmxWinPrivRec)))
- return FALSE;
+ if (!dixRegisterPrivateKey
+ (&dmxWinPrivateKeyRec, PRIVATE_WINDOW, sizeof(dmxWinPrivRec)))
+ return FALSE;
return TRUE;
}
-
-Window dmxCreateRootWindow(WindowPtr pWindow)
+Window
+dmxCreateRootWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- Window parent;
- Visual *visual;
- unsigned long mask;
- XSetWindowAttributes attribs;
- ColormapPtr pCmap;
- dmxColormapPrivPtr pCmapPriv;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Window parent;
+ Visual *visual;
+ unsigned long mask;
+ XSetWindowAttributes attribs;
+ ColormapPtr pCmap;
+ dmxColormapPrivPtr pCmapPriv;
/* Create root window */
- parent = dmxScreen->scrnWin; /* This is our "Screen" window */
+ parent = dmxScreen->scrnWin; /* This is our "Screen" window */
visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual;
- dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
- RT_COLORMAP, NullClient, DixUnknownAccess);
+ dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
mask = CWEventMask | CWBackingStore | CWColormap | CWBorderPixel;
- attribs.event_mask = ExposureMask;
+ attribs.event_mask = ExposureMask;
attribs.backing_store = NotUseful;
- attribs.colormap = pCmapPriv->cmap;
- attribs.border_pixel = 0;
+ attribs.colormap = pCmapPriv->cmap;
+ attribs.border_pixel = 0;
/* Incorporate new attributes, if needed */
if (pWinPriv->attribMask) {
- dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
- mask |= pWinPriv->attribMask;
+ dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
+ mask |= pWinPriv->attribMask;
}
return XCreateWindow(dmxScreen->beDisplay,
- parent,
- pWindow->origin.x - wBorderWidth(pWindow),
- pWindow->origin.y - wBorderWidth(pWindow),
- pWindow->drawable.width,
- pWindow->drawable.height,
- pWindow->borderWidth,
- pWindow->drawable.depth,
- pWindow->drawable.class,
- visual,
- mask,
- &attribs);
+ parent,
+ pWindow->origin.x - wBorderWidth(pWindow),
+ pWindow->origin.y - wBorderWidth(pWindow),
+ pWindow->drawable.width,
+ pWindow->drawable.height,
+ pWindow->borderWidth,
+ pWindow->drawable.depth,
+ pWindow->drawable.class, visual, mask, &attribs);
}
/** Change the location and size of the "screen" window. Called from
* dmxextension.c dmxConfigureScreenWindow(). */
-void dmxResizeScreenWindow(ScreenPtr pScreen,
- int x, int y, int w, int h)
+void
+dmxResizeScreenWindow(ScreenPtr pScreen, int x, int y, int w, int h)
{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- unsigned int m;
- XWindowChanges c;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ unsigned int m;
+ XWindowChanges c;
if (!dmxScreen->beDisplay)
- return;
+ return;
/* Handle resizing on back-end server */
m = CWX | CWY | CWWidth | CWHeight;
@@ -139,81 +138,85 @@ void dmxResizeScreenWindow(ScreenPtr pScreen,
/** Change the location and size of the "root" window. Called from
* #dmxCreateWindow. */
-void dmxResizeRootWindow(WindowPtr pRoot,
- int x, int y, int w, int h)
+void
+dmxResizeRootWindow(WindowPtr pRoot, int x, int y, int w, int h)
{
- DMXScreenInfo *dmxScreen = &dmxScreens[pRoot->drawable.pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot);
- unsigned int m;
- XWindowChanges c;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pRoot->drawable.pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot);
+ unsigned int m;
+ XWindowChanges c;
/* Handle resizing on back-end server */
if (dmxScreen->beDisplay) {
- m = CWX | CWY | CWWidth | CWHeight;
- c.x = x;
- c.y = y;
- c.width = (w > 0) ? w : 1;
- c.height = (h > 0) ? h : 1;
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = x;
+ c.y = y;
+ c.width = (w > 0) ? w : 1;
+ c.height = (h > 0) ? h : 1;
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
}
if (w == 0 || h == 0) {
- if (pWinPriv->mapped) {
- if (dmxScreen->beDisplay)
- XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window);
- pWinPriv->mapped = FALSE;
- }
- } else if (!pWinPriv->mapped) {
- if (dmxScreen->beDisplay)
- XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
- pWinPriv->mapped = TRUE;
+ if (pWinPriv->mapped) {
+ if (dmxScreen->beDisplay)
+ XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ pWinPriv->mapped = FALSE;
+ }
+ }
+ else if (!pWinPriv->mapped) {
+ if (dmxScreen->beDisplay)
+ XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ pWinPriv->mapped = TRUE;
}
if (dmxScreen->beDisplay)
- dmxSync(dmxScreen, False);
+ dmxSync(dmxScreen, False);
}
-void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
- Colormap *cmap,
- Visual **visual)
+void
+dmxGetDefaultWindowAttributes(WindowPtr pWindow,
+ Colormap * cmap, Visual ** visual)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
if (pWindow->drawable.class != InputOnly &&
- pWindow->optional &&
- pWindow->optional->visual != wVisual(pWindow->parent)) {
-
- /* Find the matching visual */
- *visual = dmxLookupVisualFromID(pScreen, wVisual(pWindow));
-
- /* Handle optional colormaps */
- if (pWindow->optional->colormap) {
- ColormapPtr pCmap;
- dmxColormapPrivPtr pCmapPriv;
-
- dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
- RT_COLORMAP, NullClient, DixUnknownAccess);
- pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
- *cmap = pCmapPriv->cmap;
- } else {
- *cmap = dmxColormapFromDefaultVisual(pScreen, *visual);
- }
- } else {
- *visual = CopyFromParent;
- *cmap = (Colormap)0;
+ pWindow->optional &&
+ pWindow->optional->visual != wVisual(pWindow->parent)) {
+
+ /* Find the matching visual */
+ *visual = dmxLookupVisualFromID(pScreen, wVisual(pWindow));
+
+ /* Handle optional colormaps */
+ if (pWindow->optional->colormap) {
+ ColormapPtr pCmap;
+ dmxColormapPrivPtr pCmapPriv;
+
+ dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
+ pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
+ *cmap = pCmapPriv->cmap;
+ }
+ else {
+ *cmap = dmxColormapFromDefaultVisual(pScreen, *visual);
+ }
+ }
+ else {
+ *visual = CopyFromParent;
+ *cmap = (Colormap) 0;
}
}
-static Window dmxCreateNonRootWindow(WindowPtr pWindow)
+static Window
+dmxCreateNonRootWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- Window parent;
- unsigned long mask = 0L;
- XSetWindowAttributes attribs;
- dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent);
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Window parent;
+ unsigned long mask = 0L;
+ XSetWindowAttributes attribs;
+ dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent);
/* Create window on back-end server */
@@ -223,29 +226,29 @@ static Window dmxCreateNonRootWindow(WindowPtr pWindow)
from ReparentWindow and the grandparent window has not yet been
created */
if (!parent) {
- dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
- parent = pParentPriv->window;
+ dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
+ parent = pParentPriv->window;
}
/* Incorporate new attributes, if needed */
if (pWinPriv->attribMask) {
- dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
- mask |= pWinPriv->attribMask;
+ dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
+ mask |= pWinPriv->attribMask;
}
/* Add in default attributes */
if (pWindow->drawable.class != InputOnly) {
- mask |= CWBackingStore;
- attribs.backing_store = NotUseful;
-
- if (!(mask & CWColormap) && pWinPriv->cmap) {
- mask |= CWColormap;
- attribs.colormap = pWinPriv->cmap;
- if (!(mask & CWBorderPixel)) {
- mask |= CWBorderPixel;
- attribs.border_pixel = 0;
- }
- }
+ mask |= CWBackingStore;
+ attribs.backing_store = NotUseful;
+
+ if (!(mask & CWColormap) && pWinPriv->cmap) {
+ mask |= CWColormap;
+ attribs.colormap = pWinPriv->cmap;
+ if (!(mask & CWBorderPixel)) {
+ mask |= CWBorderPixel;
+ attribs.border_pixel = 0;
+ }
+ }
}
/* Handle case where subwindows are being mapped, but created out of
@@ -254,17 +257,15 @@ static Window dmxCreateNonRootWindow(WindowPtr pWindow)
pWinPriv->restacked = (pWindow->prevSib != NullWindow);
return XCreateWindow(dmxScreen->beDisplay,
- parent,
- pWindow->origin.x - wBorderWidth(pWindow),
- pWindow->origin.y - wBorderWidth(pWindow),
- pWindow->drawable.width,
- pWindow->drawable.height,
- pWindow->borderWidth,
- pWindow->drawable.depth,
- pWindow->drawable.class,
- pWinPriv->visual,
- mask,
- &attribs);
+ parent,
+ pWindow->origin.x - wBorderWidth(pWindow),
+ pWindow->origin.y - wBorderWidth(pWindow),
+ pWindow->drawable.width,
+ pWindow->drawable.height,
+ pWindow->borderWidth,
+ pWindow->drawable.depth,
+ pWindow->drawable.class,
+ pWinPriv->visual, mask, &attribs);
}
/** This function handles lazy window creation and realization. Window
@@ -276,93 +277,101 @@ static Window dmxCreateNonRootWindow(WindowPtr pWindow)
* associated with it, those pictures are created on the back-end
* server by calling #dmxCreatePictureList(). If \a doSync is TRUE,
* then #dmxSync() is called. */
-void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync)
+void
+dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- if (!dmxScreen->beDisplay) return;
+ if (!dmxScreen->beDisplay)
+ return;
pWinPriv->window = dmxCreateNonRootWindow(pWindow);
- if (pWinPriv->restacked) dmxDoRestackWindow(pWindow);
- if (pWinPriv->isShaped) dmxDoSetShape(pWindow);
- if (pWinPriv->hasPict) dmxCreatePictureList(pWindow);
- if (pWinPriv->mapped) XMapWindow(dmxScreen->beDisplay,
- pWinPriv->window);
- if (doSync) dmxSync(dmxScreen, False);
+ if (pWinPriv->restacked)
+ dmxDoRestackWindow(pWindow);
+ if (pWinPriv->isShaped)
+ dmxDoSetShape(pWindow);
+ if (pWinPriv->hasPict)
+ dmxCreatePictureList(pWindow);
+ if (pWinPriv->mapped)
+ XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ if (doSync)
+ dmxSync(dmxScreen, False);
}
/** Create \a pWindow on the back-end server. If the lazy window
* creation optimization is enabled, then the actual creation and
* realization of the window is handled by
* #dmxCreateAndRealizeWindow(). */
-Bool dmxCreateWindow(WindowPtr pWindow)
+Bool
+dmxCreateWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Bool ret = TRUE;
DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
#if 0
if (pScreen->CreateWindow)
- ret = pScreen->CreateWindow(pWindow);
+ ret = pScreen->CreateWindow(pWindow);
#endif
/* Set up the defaults */
- pWinPriv->window = (Window)0;
- pWinPriv->offscreen = TRUE;
- pWinPriv->mapped = FALSE;
- pWinPriv->restacked = FALSE;
+ pWinPriv->window = (Window) 0;
+ pWinPriv->offscreen = TRUE;
+ pWinPriv->mapped = FALSE;
+ pWinPriv->restacked = FALSE;
pWinPriv->attribMask = 0;
- pWinPriv->isShaped = FALSE;
- pWinPriv->hasPict = FALSE;
+ pWinPriv->isShaped = FALSE;
+ pWinPriv->hasPict = FALSE;
#ifdef GLXEXT
- pWinPriv->swapGroup = NULL;
- pWinPriv->barrier = 0;
+ pWinPriv->swapGroup = NULL;
+ pWinPriv->barrier = 0;
#endif
if (dmxScreen->beDisplay) {
- /* Only create the root window at this stage -- non-root windows are
- created when they are mapped and are on-screen */
- if (!pWindow->parent) {
- dmxScreen->rootWin = pWinPriv->window
- = dmxCreateRootWindow(pWindow);
- if (dmxScreen->scrnX != dmxScreen->rootX
- || dmxScreen->scrnY != dmxScreen->rootY
- || dmxScreen->scrnWidth != dmxScreen->rootWidth
- || dmxScreen->scrnHeight != dmxScreen->rootHeight) {
- dmxResizeRootWindow(pWindow,
- dmxScreen->rootX,
- dmxScreen->rootY,
- dmxScreen->rootWidth,
- dmxScreen->rootHeight);
- dmxUpdateScreenResources(screenInfo.screens[dmxScreen->index],
- dmxScreen->rootX,
- dmxScreen->rootY,
- dmxScreen->rootWidth,
- dmxScreen->rootHeight);
- pWindow->origin.x = dmxScreen->rootX;
- pWindow->origin.y = dmxScreen->rootY;
- }
- } else {
- dmxGetDefaultWindowAttributes(pWindow,
- &pWinPriv->cmap,
- &pWinPriv->visual);
-
- if (dmxLazyWindowCreation) {
- /* Save parent's visual for use later */
- if (pWinPriv->visual == CopyFromParent)
- pWinPriv->visual =
- dmxLookupVisualFromID(pScreen,
- wVisual(pWindow->parent));
- } else {
- pWinPriv->window = dmxCreateNonRootWindow(pWindow);
- }
- }
-
- dmxSync(dmxScreen, False);
+ /* Only create the root window at this stage -- non-root windows are
+ created when they are mapped and are on-screen */
+ if (!pWindow->parent) {
+ dmxScreen->rootWin = pWinPriv->window
+ = dmxCreateRootWindow(pWindow);
+ if (dmxScreen->scrnX != dmxScreen->rootX
+ || dmxScreen->scrnY != dmxScreen->rootY
+ || dmxScreen->scrnWidth != dmxScreen->rootWidth
+ || dmxScreen->scrnHeight != dmxScreen->rootHeight) {
+ dmxResizeRootWindow(pWindow,
+ dmxScreen->rootX,
+ dmxScreen->rootY,
+ dmxScreen->rootWidth,
+ dmxScreen->rootHeight);
+ dmxUpdateScreenResources(screenInfo.screens[dmxScreen->index],
+ dmxScreen->rootX,
+ dmxScreen->rootY,
+ dmxScreen->rootWidth,
+ dmxScreen->rootHeight);
+ pWindow->origin.x = dmxScreen->rootX;
+ pWindow->origin.y = dmxScreen->rootY;
+ }
+ }
+ else {
+ dmxGetDefaultWindowAttributes(pWindow,
+ &pWinPriv->cmap, &pWinPriv->visual);
+
+ if (dmxLazyWindowCreation) {
+ /* Save parent's visual for use later */
+ if (pWinPriv->visual == CopyFromParent)
+ pWinPriv->visual =
+ dmxLookupVisualFromID(pScreen,
+ wVisual(pWindow->parent));
+ }
+ else {
+ pWinPriv->window = dmxCreateNonRootWindow(pWindow);
+ }
+ }
+
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
@@ -371,16 +380,17 @@ Bool dmxCreateWindow(WindowPtr pWindow)
}
/** Destroy \a pWindow on the back-end server. */
-Bool dmxBEDestroyWindow(WindowPtr pWindow)
+Bool
+dmxBEDestroyWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
if (pWinPriv->window) {
- XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window);
- pWinPriv->window = (Window)0;
- return TRUE;
+ XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window);
+ pWinPriv->window = (Window) 0;
+ return TRUE;
}
return FALSE;
@@ -388,14 +398,16 @@ Bool dmxBEDestroyWindow(WindowPtr pWindow)
/** Destroy \a pWindow on the back-end server. If any RENDER pictures
were created, destroy them as well. */
-Bool dmxDestroyWindow(WindowPtr pWindow)
+Bool
+dmxDestroyWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
- Bool needSync = FALSE;
+ Bool ret = TRUE;
+ Bool needSync = FALSE;
+
#ifdef GLXEXT
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
#endif
DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
@@ -405,15 +417,16 @@ Bool dmxDestroyWindow(WindowPtr pWindow)
/* Destroy window on back-end server */
needSync |= dmxBEDestroyWindow(pWindow);
- if (needSync) dmxSync(dmxScreen, FALSE);
+ if (needSync)
+ dmxSync(dmxScreen, FALSE);
#ifdef GLXEXT
if (pWinPriv->swapGroup && pWinPriv->windowDestroyed)
- pWinPriv->windowDestroyed(pWindow);
+ pWinPriv->windowDestroyed(pWindow);
#endif
if (pScreen->DestroyWindow)
- ret = pScreen->DestroyWindow(pWindow);
+ ret = pScreen->DestroyWindow(pWindow);
DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen);
@@ -421,19 +434,20 @@ Bool dmxDestroyWindow(WindowPtr pWindow)
}
/** Change the position of \a pWindow to be \a x, \a y. */
-Bool dmxPositionWindow(WindowPtr pWindow, int x, int y)
+Bool
+dmxPositionWindow(WindowPtr pWindow, int x, int y)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- unsigned int m;
- XWindowChanges c;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ unsigned int m;
+ XWindowChanges c;
DMX_UNWRAP(PositionWindow, dmxScreen, pScreen);
#if 0
if (pScreen->PositionWindow)
- ret = pScreen->PositionWindow(pWindow, x, y);
+ ret = pScreen->PositionWindow(pWindow, x, y);
#endif
/* Determine if the window is completely off the visible portion of
@@ -443,21 +457,22 @@ Bool dmxPositionWindow(WindowPtr pWindow, int x, int y)
/* If the window is now on-screen and it is mapped and it has not
been created yet, create it and map it */
if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
- dmxCreateAndRealizeWindow(pWindow, TRUE);
- } else if (pWinPriv->window) {
- /* Position window on back-end server */
- m = CWX | CWY | CWWidth | CWHeight;
- c.x = pWindow->origin.x - wBorderWidth(pWindow);
- c.y = pWindow->origin.y - wBorderWidth(pWindow);
- c.width = pWindow->drawable.width;
- c.height = pWindow->drawable.height;
- if (pWindow->drawable.class != InputOnly) {
- m |= CWBorderWidth;
- c.border_width = pWindow->borderWidth;
- }
-
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- dmxSync(dmxScreen, False);
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
+ }
+ else if (pWinPriv->window) {
+ /* Position window on back-end server */
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = pWindow->origin.x - wBorderWidth(pWindow);
+ c.y = pWindow->origin.y - wBorderWidth(pWindow);
+ c.width = pWindow->drawable.width;
+ c.height = pWindow->drawable.height;
+ if (pWindow->drawable.class != InputOnly) {
+ m |= CWBorderWidth;
+ c.border_width = pWindow->borderWidth;
+ }
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen);
@@ -465,110 +480,111 @@ Bool dmxPositionWindow(WindowPtr pWindow, int x, int y)
return ret;
}
-static void dmxDoChangeWindowAttributes(WindowPtr pWindow,
- unsigned long *mask,
- XSetWindowAttributes *attribs)
+static void
+dmxDoChangeWindowAttributes(WindowPtr pWindow,
+ unsigned long *mask, XSetWindowAttributes * attribs)
{
- dmxPixPrivPtr pPixPriv;
+ dmxPixPrivPtr pPixPriv;
if (*mask & CWBackPixmap) {
- switch (pWindow->backgroundState) {
- case None:
- attribs->background_pixmap = None;
- break;
-
- case ParentRelative:
- attribs->background_pixmap = ParentRelative;
- break;
-
- case BackgroundPixmap:
- pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->background.pixmap);
- attribs->background_pixmap = pPixPriv->pixmap;
- break;
-
- case BackgroundPixel:
- *mask &= ~CWBackPixmap;
- break;
- }
+ switch (pWindow->backgroundState) {
+ case None:
+ attribs->background_pixmap = None;
+ break;
+
+ case ParentRelative:
+ attribs->background_pixmap = ParentRelative;
+ break;
+
+ case BackgroundPixmap:
+ pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->background.pixmap);
+ attribs->background_pixmap = pPixPriv->pixmap;
+ break;
+
+ case BackgroundPixel:
+ *mask &= ~CWBackPixmap;
+ break;
+ }
}
if (*mask & CWBackPixel) {
- if (pWindow->backgroundState == BackgroundPixel)
- attribs->background_pixel = pWindow->background.pixel;
- else
- *mask &= ~CWBackPixel;
+ if (pWindow->backgroundState == BackgroundPixel)
+ attribs->background_pixel = pWindow->background.pixel;
+ else
+ *mask &= ~CWBackPixel;
}
if (*mask & CWBorderPixmap) {
- if (pWindow->borderIsPixel)
- *mask &= ~CWBorderPixmap;
- else {
- pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->border.pixmap);
- attribs->border_pixmap = pPixPriv->pixmap;
- }
+ if (pWindow->borderIsPixel)
+ *mask &= ~CWBorderPixmap;
+ else {
+ pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->border.pixmap);
+ attribs->border_pixmap = pPixPriv->pixmap;
+ }
}
if (*mask & CWBorderPixel) {
- if (pWindow->borderIsPixel)
- attribs->border_pixel = pWindow->border.pixel;
- else
- *mask &= ~CWBorderPixel;
+ if (pWindow->borderIsPixel)
+ attribs->border_pixel = pWindow->border.pixel;
+ else
+ *mask &= ~CWBorderPixel;
}
if (*mask & CWBitGravity)
- attribs->bit_gravity = pWindow->bitGravity;
+ attribs->bit_gravity = pWindow->bitGravity;
if (*mask & CWWinGravity)
- *mask &= ~CWWinGravity; /* Handled by dix */
+ *mask &= ~CWWinGravity; /* Handled by dix */
if (*mask & CWBackingStore)
- *mask &= ~CWBackingStore; /* Backing store not supported */
+ *mask &= ~CWBackingStore; /* Backing store not supported */
if (*mask & CWBackingPlanes)
- *mask &= ~CWBackingPlanes; /* Backing store not supported */
+ *mask &= ~CWBackingPlanes; /* Backing store not supported */
if (*mask & CWBackingPixel)
- *mask &= ~CWBackingPixel; /* Backing store not supported */
+ *mask &= ~CWBackingPixel; /* Backing store not supported */
if (*mask & CWOverrideRedirect)
- attribs->override_redirect = pWindow->overrideRedirect;
+ attribs->override_redirect = pWindow->overrideRedirect;
if (*mask & CWSaveUnder)
- *mask &= ~CWSaveUnder; /* Save unders not supported */
+ *mask &= ~CWSaveUnder; /* Save unders not supported */
if (*mask & CWEventMask)
- *mask &= ~CWEventMask; /* Events are handled by dix */
+ *mask &= ~CWEventMask; /* Events are handled by dix */
if (*mask & CWDontPropagate)
- *mask &= ~CWDontPropagate; /* Events are handled by dix */
+ *mask &= ~CWDontPropagate; /* Events are handled by dix */
if (*mask & CWColormap) {
- ColormapPtr pCmap;
- dmxColormapPrivPtr pCmapPriv;
+ ColormapPtr pCmap;
+ dmxColormapPrivPtr pCmapPriv;
- dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
- RT_COLORMAP, NullClient, DixUnknownAccess);
- pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
- attribs->colormap = pCmapPriv->cmap;
+ dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
+ pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
+ attribs->colormap = pCmapPriv->cmap;
}
if (*mask & CWCursor)
- *mask &= ~CWCursor; /* Handled by the cursor code */
+ *mask &= ~CWCursor; /* Handled by the cursor code */
}
/** Change the window attributes of \a pWindow. */
-Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask)
+Bool
+dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- XSetWindowAttributes attribs;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ XSetWindowAttributes attribs;
DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen);
#if 0
if (pScreen->ChangeWindowAttributes)
- ret = pScreen->ChangeWindowAttributes(pWindow, mask);
+ ret = pScreen->ChangeWindowAttributes(pWindow, mask);
#endif
/* Change window attribs on back-end server */
@@ -578,13 +594,13 @@ Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask)
pWinPriv->attribMask |= mask;
if (mask && pWinPriv->window) {
- XChangeWindowAttributes(dmxScreen->beDisplay, pWinPriv->window,
- mask, &attribs);
- dmxSync(dmxScreen, False);
+ XChangeWindowAttributes(dmxScreen->beDisplay, pWinPriv->window,
+ mask, &attribs);
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen,
- pScreen);
+ pScreen);
return ret;
}
@@ -592,17 +608,18 @@ Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask)
/** Realize \a pWindow on the back-end server. If the lazy window
* creation optimization is enabled, the window is only realized when
* it at least partially overlaps the screen. */
-Bool dmxRealizeWindow(WindowPtr pWindow)
+Bool
+dmxRealizeWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen);
#if 0
if (pScreen->RealizeWindow)
- ret = pScreen->RealizeWindow(pWindow);
+ ret = pScreen->RealizeWindow(pWindow);
#endif
/* Determine if the window is completely off the visible portion of
@@ -612,13 +629,13 @@ Bool dmxRealizeWindow(WindowPtr pWindow)
/* If the window hasn't been created and it's not offscreen, then
create it */
if (!pWinPriv->window && !pWinPriv->offscreen) {
- dmxCreateAndRealizeWindow(pWindow, FALSE);
+ dmxCreateAndRealizeWindow(pWindow, FALSE);
}
if (pWinPriv->window) {
- /* Realize window on back-end server */
- XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
- dmxSync(dmxScreen, False);
+ /* Realize window on back-end server */
+ XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ dmxSync(dmxScreen, False);
}
/* Let the other functions know that the window is now mapped */
@@ -631,23 +648,24 @@ Bool dmxRealizeWindow(WindowPtr pWindow)
}
/** Unrealize \a pWindow on the back-end server. */
-Bool dmxUnrealizeWindow(WindowPtr pWindow)
+Bool
+dmxUnrealizeWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen);
#if 0
if (pScreen->UnrealizeWindow)
- ret = pScreen->UnrealizeWindow(pWindow);
+ ret = pScreen->UnrealizeWindow(pWindow);
#endif
if (pWinPriv->window) {
- /* Unrealize window on back-end server */
- XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window);
- dmxSync(dmxScreen, False);
+ /* Unrealize window on back-end server */
+ XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ dmxSync(dmxScreen, False);
}
/* When unrealized (i.e., unmapped), the window is always considered
@@ -657,7 +675,7 @@ Bool dmxUnrealizeWindow(WindowPtr pWindow)
#ifdef GLXEXT
if (pWinPriv->swapGroup && pWinPriv->windowUnmapped)
- pWinPriv->windowUnmapped(pWindow);
+ pWinPriv->windowUnmapped(pWindow);
#endif
DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen);
@@ -666,118 +684,122 @@ Bool dmxUnrealizeWindow(WindowPtr pWindow)
return ret;
}
-static void dmxDoRestackWindow(WindowPtr pWindow)
+static void
+dmxDoRestackWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- WindowPtr pNextSib = pWindow->nextSib;
- unsigned int m;
- XWindowChanges c;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ WindowPtr pNextSib = pWindow->nextSib;
+ unsigned int m;
+ XWindowChanges c;
if (pNextSib == NullWindow) {
- /* Window is at the bottom of the stack */
- m = CWStackMode;
- c.sibling = (Window)0;
- c.stack_mode = Below;
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- } else {
- /* Window is not at the bottom of the stack */
- dmxWinPrivPtr pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib);
-
- /* Handle case where siblings have not yet been created due to
+ /* Window is at the bottom of the stack */
+ m = CWStackMode;
+ c.sibling = (Window) 0;
+ c.stack_mode = Below;
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ }
+ else {
+ /* Window is not at the bottom of the stack */
+ dmxWinPrivPtr pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib);
+
+ /* Handle case where siblings have not yet been created due to
lazy window creation optimization by first finding the next
sibling in the sibling list that has been created (if any)
and then putting the current window just above that sibling,
and if no next siblings have been created yet, then put it at
the bottom of the stack (since it might have a previous
sibling that should be above it). */
- while (!pNextSibPriv->window) {
- pNextSib = pNextSib->nextSib;
- if (pNextSib == NullWindow) {
- /* Window is at the bottom of the stack */
- m = CWStackMode;
- c.sibling = (Window)0;
- c.stack_mode = Below;
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- return;
- }
- pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib);
- }
-
- m = CWStackMode | CWSibling;
- c.sibling = pNextSibPriv->window;
- c.stack_mode = Above;
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ while (!pNextSibPriv->window) {
+ pNextSib = pNextSib->nextSib;
+ if (pNextSib == NullWindow) {
+ /* Window is at the bottom of the stack */
+ m = CWStackMode;
+ c.sibling = (Window) 0;
+ c.stack_mode = Below;
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ return;
+ }
+ pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib);
+ }
+
+ m = CWStackMode | CWSibling;
+ c.sibling = pNextSibPriv->window;
+ c.stack_mode = Above;
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
}
}
/** Handle window restacking. The actual restacking occurs in
* #dmxDoRestackWindow(). */
-void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib)
+void
+dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
DMX_UNWRAP(RestackWindow, dmxScreen, pScreen);
#if 0
if (pScreen->RestackWindow)
- pScreen->RestackWindow(pWindow, pOldNextSib);
+ pScreen->RestackWindow(pWindow, pOldNextSib);
#endif
if (pOldNextSib != pWindow->nextSib) {
- /* Track restacking for lazy window creation optimization */
- pWinPriv->restacked = TRUE;
-
- /* Restack window on back-end server */
- if (pWinPriv->window) {
- dmxDoRestackWindow(pWindow);
- dmxSync(dmxScreen, False);
- }
+ /* Track restacking for lazy window creation optimization */
+ pWinPriv->restacked = TRUE;
+
+ /* Restack window on back-end server */
+ if (pWinPriv->window) {
+ dmxDoRestackWindow(pWindow);
+ dmxSync(dmxScreen, False);
+ }
}
DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen);
dmxUpdateWindowInfo(DMX_UPDATE_RESTACK, pWindow);
}
-static Bool dmxWindowExposurePredicate(Display *dpy, XEvent *ev, XPointer ptr)
+static Bool
+dmxWindowExposurePredicate(Display * dpy, XEvent * ev, XPointer ptr)
{
- return (ev->type == Expose && ev->xexpose.window == *(Window *)ptr);
+ return (ev->type == Expose && ev->xexpose.window == *(Window *) ptr);
}
/** Handle exposures on \a pWindow. Since window exposures are handled
* in DMX, the events that are generated by the back-end server are
* redundant, so we eat them here. */
-void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
- RegionPtr other_exposed)
+void
+dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn, RegionPtr other_exposed)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- XEvent ev;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ XEvent ev;
DMX_UNWRAP(WindowExposures, dmxScreen, pScreen);
dmxSync(dmxScreen, False);
if (pWinPriv->window) {
- while (XCheckIfEvent(dmxScreen->beDisplay, &ev,
- dmxWindowExposurePredicate,
- (XPointer)&pWinPriv->window)) {
- /* Handle expose events -- this should not be necessary
- since the base window in which the root window was
- created is guaranteed to be on top (override_redirect),
- so we should just swallow these events. If for some
- reason the window is not on top, then we'd need to
- collect these events and send them to the client later
- (e.g., during the block handler as Xnest does). */
- }
+ while (XCheckIfEvent(dmxScreen->beDisplay, &ev,
+ dmxWindowExposurePredicate,
+ (XPointer) & pWinPriv->window)) {
+ /* Handle expose events -- this should not be necessary
+ since the base window in which the root window was
+ created is guaranteed to be on top (override_redirect),
+ so we should just swallow these events. If for some
+ reason the window is not on top, then we'd need to
+ collect these events and send them to the client later
+ (e.g., during the block handler as Xnest does). */
+ }
}
#if 1
if (pScreen->WindowExposures)
- pScreen->WindowExposures(pWindow, prgn, other_exposed);
+ pScreen->WindowExposures(pWindow, prgn, other_exposed);
#endif
DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen);
}
@@ -785,18 +807,19 @@ void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
/** Move \a pWindow on the back-end server. Determine whether or not it
* is on or offscreen, and realize it if it is newly on screen and the
* lazy window creation optimization is enabled. */
-void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+void
+dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- unsigned int m;
- XWindowChanges c;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ unsigned int m;
+ XWindowChanges c;
DMX_UNWRAP(CopyWindow, dmxScreen, pScreen);
#if 0
if (pScreen->CopyWindow)
- pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc);
+ pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc);
#endif
/* Determine if the window is completely off the visible portion of
@@ -806,17 +829,18 @@ void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
/* If the window is now on-screen and it is mapped and it has not
been created yet, create it and map it */
if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
- dmxCreateAndRealizeWindow(pWindow, TRUE);
- } else if (pWinPriv->window) {
- /* Move window on back-end server */
- m = CWX | CWY | CWWidth | CWHeight;
- c.x = pWindow->origin.x - wBorderWidth(pWindow);
- c.y = pWindow->origin.y - wBorderWidth(pWindow);
- c.width = pWindow->drawable.width;
- c.height = pWindow->drawable.height;
-
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- dmxSync(dmxScreen, False);
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
+ }
+ else if (pWinPriv->window) {
+ /* Move window on back-end server */
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = pWindow->origin.x - wBorderWidth(pWindow);
+ c.y = pWindow->origin.y - wBorderWidth(pWindow);
+ c.width = pWindow->drawable.width;
+ c.height = pWindow->drawable.height;
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen);
@@ -826,23 +850,24 @@ void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
/** Resize \a pWindow on the back-end server. Determine whether or not
* it is on or offscreen, and realize it if it is newly on screen and
* the lazy window creation optimization is enabled. */
-void dmxResizeWindow(WindowPtr pWindow, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib)
+void
+dmxResizeWindow(WindowPtr pWindow, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- dmxWinPrivPtr pSibPriv;
- unsigned int m;
- XWindowChanges c;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pSibPriv;
+ unsigned int m;
+ XWindowChanges c;
if (pSib)
- pSibPriv = DMX_GET_WINDOW_PRIV(pSib);
+ pSibPriv = DMX_GET_WINDOW_PRIV(pSib);
DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
#if 1
if (pScreen->ResizeWindow)
- pScreen->ResizeWindow(pWindow, x, y, w, h, pSib);
+ pScreen->ResizeWindow(pWindow, x, y, w, h, pSib);
#endif
/* Determine if the window is completely off the visible portion of
@@ -852,17 +877,18 @@ void dmxResizeWindow(WindowPtr pWindow, int x, int y,
/* If the window is now on-screen and it is mapped and it has not
been created yet, create it and map it */
if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
- dmxCreateAndRealizeWindow(pWindow, TRUE);
- } else if (pWinPriv->window) {
- /* Handle resizing on back-end server */
- m = CWX | CWY | CWWidth | CWHeight;
- c.x = pWindow->origin.x - wBorderWidth(pWindow);
- c.y = pWindow->origin.y - wBorderWidth(pWindow);
- c.width = pWindow->drawable.width;
- c.height = pWindow->drawable.height;
-
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- dmxSync(dmxScreen, False);
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
+ }
+ else if (pWinPriv->window) {
+ /* Handle resizing on back-end server */
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = pWindow->origin.x - wBorderWidth(pWindow);
+ c.y = pWindow->origin.y - wBorderWidth(pWindow);
+ c.width = pWindow->drawable.width;
+ c.height = pWindow->drawable.height;
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen);
@@ -870,30 +896,31 @@ void dmxResizeWindow(WindowPtr pWindow, int x, int y,
}
/** Reparent \a pWindow on the back-end server. */
-void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent)
+void
+dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent);
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent);
DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen);
#if 0
if (pScreen->ReparentWindow)
- pScreen->ReparentWindow(pWindow, pPriorParent);
+ pScreen->ReparentWindow(pWindow, pPriorParent);
#endif
if (pWinPriv->window) {
- if (!pParentPriv->window) {
- dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
- }
-
- /* Handle reparenting on back-end server */
- XReparentWindow(dmxScreen->beDisplay, pWinPriv->window,
- pParentPriv->window,
- pWindow->origin.x - wBorderWidth(pWindow),
- pWindow->origin.x - wBorderWidth(pWindow));
- dmxSync(dmxScreen, False);
+ if (!pParentPriv->window) {
+ dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
+ }
+
+ /* Handle reparenting on back-end server */
+ XReparentWindow(dmxScreen->beDisplay, pWinPriv->window,
+ pParentPriv->window,
+ pWindow->origin.x - wBorderWidth(pWindow),
+ pWindow->origin.x - wBorderWidth(pWindow));
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen);
@@ -901,116 +928,120 @@ void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent)
}
/** Change border width for \a pWindow to \a width pixels. */
-void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width)
+void
+dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- unsigned int m;
- XWindowChanges c;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ unsigned int m;
+ XWindowChanges c;
DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen);
#if 1
if (pScreen->ChangeBorderWidth)
- pScreen->ChangeBorderWidth(pWindow, width);
+ pScreen->ChangeBorderWidth(pWindow, width);
#endif
/* NOTE: Do we need to check for on/off screen here? */
if (pWinPriv->window) {
- /* Handle border width change on back-end server */
- m = CWBorderWidth;
- c.border_width = width;
+ /* Handle border width change on back-end server */
+ m = CWBorderWidth;
+ c.border_width = width;
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- dmxSync(dmxScreen, False);
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen);
}
-static void dmxDoSetShape(WindowPtr pWindow)
+static void
+dmxDoSetShape(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- int nBox;
- BoxPtr pBox;
- int nRect;
- XRectangle *pRect;
- XRectangle *pRectFirst;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ int nBox;
+ BoxPtr pBox;
+ int nRect;
+ XRectangle *pRect;
+ XRectangle *pRectFirst;
/* First, set the bounding shape */
if (wBoundingShape(pWindow)) {
- pBox = RegionRects(wBoundingShape(pWindow));
- nRect = nBox = RegionNumRects(wBoundingShape(pWindow));
- pRectFirst = pRect = malloc(nRect * sizeof(*pRect));
- while (nBox--) {
- pRect->x = pBox->x1;
- pRect->y = pBox->y1;
- pRect->width = pBox->x2 - pBox->x1;
- pRect->height = pBox->y2 - pBox->y1;
- pBox++;
- pRect++;
- }
- XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
- ShapeBounding, 0, 0,
- pRectFirst, nRect,
- ShapeSet, YXBanded);
- free(pRectFirst);
- } else {
- XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
- ShapeBounding, 0, 0, None, ShapeSet);
+ pBox = RegionRects(wBoundingShape(pWindow));
+ nRect = nBox = RegionNumRects(wBoundingShape(pWindow));
+ pRectFirst = pRect = malloc(nRect * sizeof(*pRect));
+ while (nBox--) {
+ pRect->x = pBox->x1;
+ pRect->y = pBox->y1;
+ pRect->width = pBox->x2 - pBox->x1;
+ pRect->height = pBox->y2 - pBox->y1;
+ pBox++;
+ pRect++;
+ }
+ XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeBounding, 0, 0,
+ pRectFirst, nRect, ShapeSet, YXBanded);
+ free(pRectFirst);
+ }
+ else {
+ XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeBounding, 0, 0, None, ShapeSet);
}
/* Next, set the clip shape */
if (wClipShape(pWindow)) {
- pBox = RegionRects(wClipShape(pWindow));
- nRect = nBox = RegionNumRects(wClipShape(pWindow));
- pRectFirst = pRect = malloc(nRect * sizeof(*pRect));
- while (nBox--) {
- pRect->x = pBox->x1;
- pRect->y = pBox->y1;
- pRect->width = pBox->x2 - pBox->x1;
- pRect->height = pBox->y2 - pBox->y1;
- pBox++;
- pRect++;
- }
- XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
- ShapeClip, 0, 0,
- pRectFirst, nRect,
- ShapeSet, YXBanded);
- free(pRectFirst);
- } else {
- XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
- ShapeClip, 0, 0, None, ShapeSet);
+ pBox = RegionRects(wClipShape(pWindow));
+ nRect = nBox = RegionNumRects(wClipShape(pWindow));
+ pRectFirst = pRect = malloc(nRect * sizeof(*pRect));
+ while (nBox--) {
+ pRect->x = pBox->x1;
+ pRect->y = pBox->y1;
+ pRect->width = pBox->x2 - pBox->x1;
+ pRect->height = pBox->y2 - pBox->y1;
+ pBox++;
+ pRect++;
+ }
+ XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeClip, 0, 0,
+ pRectFirst, nRect, ShapeSet, YXBanded);
+ free(pRectFirst);
+ }
+ else {
+ XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeClip, 0, 0, None, ShapeSet);
}
if (XShapeInputSelected(dmxScreen->beDisplay, pWinPriv->window)) {
- ErrorF("Input selected for window %x on Screen %d\n",
- (unsigned int)pWinPriv->window, pScreen->myNum);
+ ErrorF("Input selected for window %x on Screen %d\n",
+ (unsigned int) pWinPriv->window, pScreen->myNum);
}
}
/** Set shape of \a pWindow on the back-end server. */
-void dmxSetShape(WindowPtr pWindow, int kind)
+void
+dmxSetShape(WindowPtr pWindow, int kind)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
DMX_UNWRAP(SetShape, dmxScreen, pScreen);
#if 1
if (pScreen->SetShape)
- pScreen->SetShape(pWindow, kind);
+ pScreen->SetShape(pWindow, kind);
#endif
if (pWinPriv->window) {
- /* Handle setting the current shape on the back-end server */
- dmxDoSetShape(pWindow);
- dmxSync(dmxScreen, False);
- } else {
- pWinPriv->isShaped = TRUE;
+ /* Handle setting the current shape on the back-end server */
+ dmxDoSetShape(pWindow);
+ dmxSync(dmxScreen, False);
+ }
+ else {
+ pWinPriv->isShaped = TRUE;
}
DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
diff --git a/xorg-server/hw/dmx/dmxwindow.h b/xorg-server/hw/dmx/dmxwindow.h
index 43316d35b..c6b2efee6 100644
--- a/xorg-server/hw/dmx/dmxwindow.h
+++ b/xorg-server/hw/dmx/dmxwindow.h
@@ -1,135 +1,132 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * Interface for window support. \see dmxwindow.c */
-
-#ifndef DMXWINDOW_H
-#define DMXWINDOW_H
-
-#include "windowstr.h"
-
-/** Window private area. */
-typedef struct _dmxWinPriv {
- Window window;
- Bool offscreen;
- Bool mapped;
- Bool restacked;
- unsigned long attribMask;
- Colormap cmap;
- Visual *visual;
- Bool isShaped;
- Bool hasPict;
-#ifdef GLXEXT
- void *swapGroup;
- int barrier;
- void (*windowDestroyed)(WindowPtr);
- void (*windowUnmapped)(WindowPtr);
-#endif
-} dmxWinPrivRec, *dmxWinPrivPtr;
-
-
-extern Bool dmxInitWindow(ScreenPtr pScreen);
-
-extern Window dmxCreateRootWindow(WindowPtr pWindow);
-
-extern void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
- Colormap *cmap,
- Visual **visual);
-extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync);
-
-extern Bool dmxCreateWindow(WindowPtr pWindow);
-extern Bool dmxDestroyWindow(WindowPtr pWindow);
-extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y);
-extern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask);
-extern Bool dmxRealizeWindow(WindowPtr pWindow);
-extern Bool dmxUnrealizeWindow(WindowPtr pWindow);
-extern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib);
-extern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
- RegionPtr other_exposed);
-extern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-
-extern void dmxResizeWindow(WindowPtr pWindow, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib);
-extern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent);
-
-extern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width);
-
-extern void dmxResizeScreenWindow(ScreenPtr pScreen,
- int x, int y, int w, int h);
-extern void dmxResizeRootWindow(WindowPtr pRoot,
- int x, int y, int w, int h);
-
-extern Bool dmxBEDestroyWindow(WindowPtr pWindow);
-
-/* Support for shape extension */
-extern void dmxSetShape(WindowPtr pWindow, int kind);
-
-/** Get window private pointer. */
-#define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \
- dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey))
-
-/* All of these macros are only used in dmxwindow.c */
-#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \
-do { \
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
- DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \
- if (pGCPriv->ops) \
- DMX_UNWRAP(ops, pGCPriv, (_pGC)); \
-} while (0)
-
-#define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \
-do { \
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
- DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC)); \
- if (pGCPriv->ops) \
- DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC)); \
-} while (0)
-
-#define DMX_WINDOW_X1(_pWin) \
- ((_pWin)->drawable.x - wBorderWidth(_pWin))
-#define DMX_WINDOW_Y1(_pWin) \
- ((_pWin)->drawable.y - wBorderWidth(_pWin))
-#define DMX_WINDOW_X2(_pWin) \
- ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width)
-#define DMX_WINDOW_Y2(_pWin) \
- ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height)
-
-#define DMX_WINDOW_OFFSCREEN(_pWin) \
- (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width || \
- DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height || \
- DMX_WINDOW_X2(_pWin) <= 0 || \
- DMX_WINDOW_Y2(_pWin) <= 0)
-
-#endif /* DMXWINDOW_H */
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for window support. \see dmxwindow.c */
+
+#ifndef DMXWINDOW_H
+#define DMXWINDOW_H
+
+#include "windowstr.h"
+
+/** Window private area. */
+typedef struct _dmxWinPriv {
+ Window window;
+ Bool offscreen;
+ Bool mapped;
+ Bool restacked;
+ unsigned long attribMask;
+ Colormap cmap;
+ Visual *visual;
+ Bool isShaped;
+ Bool hasPict;
+#ifdef GLXEXT
+ void *swapGroup;
+ int barrier;
+ void (*windowDestroyed) (WindowPtr);
+ void (*windowUnmapped) (WindowPtr);
+#endif
+} dmxWinPrivRec, *dmxWinPrivPtr;
+
+extern Bool dmxInitWindow(ScreenPtr pScreen);
+
+extern Window dmxCreateRootWindow(WindowPtr pWindow);
+
+extern void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
+ Colormap * cmap, Visual ** visual);
+extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync);
+
+extern Bool dmxCreateWindow(WindowPtr pWindow);
+extern Bool dmxDestroyWindow(WindowPtr pWindow);
+extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y);
+extern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask);
+extern Bool dmxRealizeWindow(WindowPtr pWindow);
+extern Bool dmxUnrealizeWindow(WindowPtr pWindow);
+extern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib);
+extern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
+ RegionPtr other_exposed);
+extern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+extern void dmxResizeWindow(WindowPtr pWindow, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib);
+extern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent);
+
+extern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width);
+
+extern void dmxResizeScreenWindow(ScreenPtr pScreen,
+ int x, int y, int w, int h);
+extern void dmxResizeRootWindow(WindowPtr pRoot, int x, int y, int w, int h);
+
+extern Bool dmxBEDestroyWindow(WindowPtr pWindow);
+
+/* Support for shape extension */
+extern void dmxSetShape(WindowPtr pWindow, int kind);
+
+/** Get window private pointer. */
+#define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \
+ dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey))
+
+/* All of these macros are only used in dmxwindow.c */
+#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \
+do { \
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
+ DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \
+ if (pGCPriv->ops) \
+ DMX_UNWRAP(ops, pGCPriv, (_pGC)); \
+} while (0)
+
+#define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \
+do { \
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
+ DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC)); \
+ if (pGCPriv->ops) \
+ DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC)); \
+} while (0)
+
+#define DMX_WINDOW_X1(_pWin) \
+ ((_pWin)->drawable.x - wBorderWidth(_pWin))
+#define DMX_WINDOW_Y1(_pWin) \
+ ((_pWin)->drawable.y - wBorderWidth(_pWin))
+#define DMX_WINDOW_X2(_pWin) \
+ ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width)
+#define DMX_WINDOW_Y2(_pWin) \
+ ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height)
+
+#define DMX_WINDOW_OFFSCREEN(_pWin) \
+ (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width || \
+ DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height || \
+ DMX_WINDOW_X2(_pWin) <= 0 || \
+ DMX_WINDOW_Y2(_pWin) <= 0)
+
+#endif /* DMXWINDOW_H */
diff --git a/xorg-server/hw/dmx/examples/dmxaddinput.c b/xorg-server/hw/dmx/examples/dmxaddinput.c
index dcfd4f5cc..fdd09b99b 100644
--- a/xorg-server/hw/dmx/examples/dmxaddinput.c
+++ b/xorg-server/hw/dmx/examples/dmxaddinput.c
@@ -36,14 +36,15 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int id = -1;
- int status;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int id = -1;
+ int status;
if (argc != 5) {
printf("Usage: %s display c|b name|screen isCore\n", argv[0]);
@@ -72,8 +73,9 @@ int main(int argc, char **argv)
if (argv[2][0] == 'c') {
status = DMXAddConsoleInput(display, argv[3], atoi(argv[4]), &id);
- } else {
- status = DMXAddBackendInput(display, atoi(argv[3]), atoi(argv[4]),&id);
+ }
+ else {
+ status = DMXAddBackendInput(display, atoi(argv[3]), atoi(argv[4]), &id);
}
printf("status = %d, id = %d\n", status, id);
diff --git a/xorg-server/hw/dmx/examples/dmxaddscreen.c b/xorg-server/hw/dmx/examples/dmxaddscreen.c
index 8e60872df..58129faa5 100644
--- a/xorg-server/hw/dmx/examples/dmxaddscreen.c
+++ b/xorg-server/hw/dmx/examples/dmxaddscreen.c
@@ -37,18 +37,21 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int screenNum;
- DMXScreenAttributes attr;
- unsigned int mask = 0;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int screenNum;
+ DMXScreenAttributes attr;
+ unsigned int mask = 0;
if (argc != 4 && argc != 14) {
- printf("Usage: %s display screenNum displayName [scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy]\n", argv[0]);
+ printf
+ ("Usage: %s display screenNum displayName [scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy]\n",
+ argv[0]);
return -1;
}
@@ -59,27 +62,25 @@ int main(int argc, char **argv)
screenNum = strtol(argv[2], NULL, 0);
if (argc == 14) {
- mask |= (DMXScreenWindowXoffset |
- DMXScreenWindowYoffset |
- DMXScreenWindowWidth |
- DMXScreenWindowHeight);
- attr.screenWindowXoffset = strtol(argv[4], NULL, 0);
- attr.screenWindowYoffset = strtol(argv[5], NULL, 0);
- attr.screenWindowWidth = strtol(argv[6], NULL, 0);
- attr.screenWindowHeight = strtol(argv[7], NULL, 0);
+ mask |= (DMXScreenWindowXoffset |
+ DMXScreenWindowYoffset |
+ DMXScreenWindowWidth | DMXScreenWindowHeight);
+ attr.screenWindowXoffset = strtol(argv[4], NULL, 0);
+ attr.screenWindowYoffset = strtol(argv[5], NULL, 0);
+ attr.screenWindowWidth = strtol(argv[6], NULL, 0);
+ attr.screenWindowHeight = strtol(argv[7], NULL, 0);
- mask |= (DMXRootWindowXoffset |
- DMXRootWindowYoffset |
- DMXRootWindowWidth |
- DMXRootWindowHeight);
- attr.rootWindowXoffset = strtol(argv[8], NULL, 0);
- attr.rootWindowYoffset = strtol(argv[9], NULL, 0);
- attr.rootWindowWidth = strtol(argv[10], NULL, 0);
- attr.rootWindowHeight = strtol(argv[11], NULL, 0);
+ mask |= (DMXRootWindowXoffset |
+ DMXRootWindowYoffset |
+ DMXRootWindowWidth | DMXRootWindowHeight);
+ attr.rootWindowXoffset = strtol(argv[8], NULL, 0);
+ attr.rootWindowYoffset = strtol(argv[9], NULL, 0);
+ attr.rootWindowWidth = strtol(argv[10], NULL, 0);
+ attr.rootWindowHeight = strtol(argv[11], NULL, 0);
- mask |= DMXRootWindowXorigin | DMXRootWindowYorigin;
- attr.rootWindowXorigin = strtol(argv[12], NULL, 0);
- attr.rootWindowYorigin = strtol(argv[13], NULL, 0);
+ mask |= DMXRootWindowXorigin | DMXRootWindowYorigin;
+ attr.rootWindowXorigin = strtol(argv[12], NULL, 0);
+ attr.rootWindowYorigin = strtol(argv[13], NULL, 0);
}
if (!DMXQueryExtension(display, &event_base, &error_base)) {
@@ -98,8 +99,8 @@ int main(int argc, char **argv)
major_version, minor_version, patch_version);
if (!DMXAddScreen(display, argv[3], mask, &attr, &screenNum))
- printf("Failed to add %s as screen #%d\n", argv[2], screenNum);
-
+ printf("Failed to add %s as screen #%d\n", argv[2], screenNum);
+
XCloseDisplay(display);
return 0;
}
diff --git a/xorg-server/hw/dmx/examples/dmxinfo.c b/xorg-server/hw/dmx/examples/dmxinfo.c
index dedce6e8d..fea94e203 100644
--- a/xorg-server/hw/dmx/examples/dmxinfo.c
+++ b/xorg-server/hw/dmx/examples/dmxinfo.c
@@ -36,45 +36,52 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-static void indent(int level)
+static void
+indent(int level)
{
int i;
- for (i = 0; i < level; i++) printf(" ");
+
+ for (i = 0; i < level; i++)
+ printf(" ");
}
-static void print_window_id(const char *displayName, Display *display,
- Window window, int level, int child)
+static void
+print_window_id(const char *displayName, Display * display,
+ Window window, int level, int child)
{
- char *name;
-
- if (!XFetchName(display, window, &name)) name = NULL;
+ char *name;
+
+ if (!XFetchName(display, window, &name))
+ name = NULL;
indent(level);
- if (child) printf("(%d) ", child);
+ if (child)
+ printf("(%d) ", child);
printf("%s window 0x%08lx: %s%s\n",
displayName,
- (long unsigned)window,
- name ? name : "",
- (window == DefaultRootWindow(display))
+ (long unsigned) window,
+ name ? name : "", (window == DefaultRootWindow(display))
? " (DMX root window)" : "");
- if (name) XFree(name);
+ if (name)
+ XFree(name);
}
-static void print_info(Display *display, Window window, int level, int child)
+static void
+print_info(Display * display, Window window, int level, int child)
{
DMXWindowAttributes winfo[128];
- int count;
- int i;
-
+ int count;
+ int i;
+
if (!DMXGetWindowAttributes(display, window, &count, 128, winfo)) {
printf("Could not get window information for 0x%08lx\n",
- (long unsigned)window);
+ (long unsigned) window);
exit(-2);
}
printf("\n");
print_window_id("DMX", display, window, level, child);
for (i = 0; i < count; i++) {
- DMXScreenAttributes sinfo;
- Display *backend;
+ DMXScreenAttributes sinfo;
+ Display *backend;
/* This could also be cached -- the information doesn't change. */
if (!DMXGetScreenAttributes(display, winfo[i].screen, &sinfo)) {
@@ -86,78 +93,86 @@ static void print_info(Display *display, Window window, int level, int child)
exit(-2);
}
XCloseDisplay(backend);
-
- indent(level+1);
+
+ indent(level + 1);
printf("%s window 0x%08lx: %dx%d%+d%+d",
sinfo.displayName,
- (long unsigned)winfo[i].window,
+ (long unsigned) winfo[i].window,
winfo[i].pos.width, winfo[i].pos.height,
winfo[i].pos.x, winfo[i].pos.y);
if (!winfo[i].vis.width
- && !winfo[i].vis.height
- && !winfo[i].vis.x
- && !winfo[i].vis.y) printf(" not visible\n");
+ && !winfo[i].vis.height && !winfo[i].vis.x && !winfo[i].vis.y)
+ printf(" not visible\n");
else if (winfo[i].vis.width == winfo[i].pos.width
&& winfo[i].vis.height == winfo[i].pos.height) {
- printf( " %+d%+d\n", winfo[i].vis.x, winfo[i].vis.y);
- } else {
- printf( " %dx%d%+d%+d\n",
- winfo[i].vis.width, winfo[i].vis.height,
- winfo[i].vis.x, winfo[i].vis.y);
+ printf(" %+d%+d\n", winfo[i].vis.x, winfo[i].vis.y);
+ }
+ else {
+ printf(" %dx%d%+d%+d\n",
+ winfo[i].vis.width, winfo[i].vis.height,
+ winfo[i].vis.x, winfo[i].vis.y);
}
}
}
-static void print_tree(Display *display, Window window, int level, int child)
+static void
+print_tree(Display * display, Window window, int level, int child)
{
- Window root, parent;
- Window *list;
+ Window root, parent;
+ Window *list;
unsigned int count;
unsigned int i;
print_info(display, window, level, child);
-
+
if (!XQueryTree(display, window, &root, &parent, &list, &count)) {
printf("Cannot query window tree for 0x%08lx\n",
- (long unsigned)window);
+ (long unsigned) window);
exit(-3);
}
if (count) {
- indent(level+1);
+ indent(level + 1);
printf("%d child%s:\n", count, count > 1 ? "ren" : "");
for (i = 0; i < count; i++) {
- print_tree(display, list[i], level+1, i+1);
+ print_tree(display, list[i], level + 1, i + 1);
}
}
}
-static const char *core(DMXInputAttributes *iinfo)
+static const char *
+core(DMXInputAttributes * iinfo)
{
- if (iinfo->isCore) return "core";
- else if (iinfo->sendsCore) return "extension (sends core)";
- else return "extension";
+ if (iinfo->isCore)
+ return "core";
+ else if (iinfo->sendsCore)
+ return "extension (sends core)";
+ else
+ return "extension";
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- Window window = 0;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- DMXScreenAttributes sinfo;
- DMXInputAttributes iinfo;
- int count;
- int i;
+ Display *display = NULL;
+ Window window = 0;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ DMXScreenAttributes sinfo;
+ DMXInputAttributes iinfo;
+ int count;
+ int i;
if (argc == 2 || argc == 3) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- if (argc == 3) window = strtol(argv[2], NULL, 0);
- } else {
+ if (argc == 3)
+ window = strtol(argv[2], NULL, 0);
+ }
+ else {
printf("Usage: %s display [windowid]\n", argv[0]);
return -1;
}
@@ -231,9 +246,11 @@ int main(int argc, char **argv)
}
}
- if (window) print_info(display, window, 0, 0);
- else print_tree(display, DefaultRootWindow(display), 0, 0);
-
+ if (window)
+ print_info(display, window, 0, 0);
+ else
+ print_tree(display, DefaultRootWindow(display), 0, 0);
+
XCloseDisplay(display);
return 0;
}
diff --git a/xorg-server/hw/dmx/examples/dmxreconfig.c b/xorg-server/hw/dmx/examples/dmxreconfig.c
index 042f8a112..9587682db 100644
--- a/xorg-server/hw/dmx/examples/dmxreconfig.c
+++ b/xorg-server/hw/dmx/examples/dmxreconfig.c
@@ -36,47 +36,47 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int screen;
- DMXScreenAttributes attr;
- unsigned int mask = 0;
- int status;
- int errorScreen;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int screen;
+ DMXScreenAttributes attr;
+ unsigned int mask = 0;
+ int status;
+ int errorScreen;
if (argc != 13) {
- fprintf(stderr, "Usage: %s display screen scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy\n", argv[0]);
- return -1;
+ fprintf(stderr,
+ "Usage: %s display screen scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy\n",
+ argv[0]);
+ return -1;
}
if (!(display = XOpenDisplay(argv[1]))) {
- fprintf(stderr, "Cannot open display %s\n", argv[1]);
- return -1;
+ fprintf(stderr, "Cannot open display %s\n", argv[1]);
+ return -1;
}
- screen = strtol(argv[2], NULL, 0);
+ screen = strtol(argv[2], NULL, 0);
mask |= (DMXScreenWindowXoffset |
- DMXScreenWindowYoffset |
- DMXScreenWindowWidth |
- DMXScreenWindowHeight);
- attr.screenWindowXoffset = strtol(argv[3], NULL, 0);
- attr.screenWindowYoffset = strtol(argv[4], NULL, 0);
- attr.screenWindowWidth = strtol(argv[5], NULL, 0);
- attr.screenWindowHeight = strtol(argv[6], NULL, 0);
+ DMXScreenWindowYoffset |
+ DMXScreenWindowWidth | DMXScreenWindowHeight);
+ attr.screenWindowXoffset = strtol(argv[3], NULL, 0);
+ attr.screenWindowYoffset = strtol(argv[4], NULL, 0);
+ attr.screenWindowWidth = strtol(argv[5], NULL, 0);
+ attr.screenWindowHeight = strtol(argv[6], NULL, 0);
mask |= (DMXRootWindowXoffset |
- DMXRootWindowYoffset |
- DMXRootWindowWidth |
- DMXRootWindowHeight);
- attr.rootWindowXoffset = strtol(argv[7], NULL, 0);
- attr.rootWindowYoffset = strtol(argv[8], NULL, 0);
- attr.rootWindowWidth = strtol(argv[9], NULL, 0);
- attr.rootWindowHeight = strtol(argv[10], NULL, 0);
+ DMXRootWindowYoffset | DMXRootWindowWidth | DMXRootWindowHeight);
+ attr.rootWindowXoffset = strtol(argv[7], NULL, 0);
+ attr.rootWindowYoffset = strtol(argv[8], NULL, 0);
+ attr.rootWindowWidth = strtol(argv[9], NULL, 0);
+ attr.rootWindowHeight = strtol(argv[10], NULL, 0);
mask |= DMXRootWindowXorigin | DMXRootWindowYorigin;
attr.rootWindowXorigin = strtol(argv[11], NULL, 0);
@@ -99,62 +99,61 @@ int main(int argc, char **argv)
if (major_version == 1 && minor_version < 3) {
fprintf(stderr,
- "ReconfigureScreen not supported in this extension version\n");
+ "ReconfigureScreen not supported in this extension version\n");
return -1;
}
if (major_version < 2) {
fprintf(stderr,
- "ChangeScreensAttributes not supported in this extension "
- "version\n");
+ "ChangeScreensAttributes not supported in this extension "
+ "version\n");
return -1;
}
if (!(status = DMXChangeScreensAttributes(display, 1, &screen, 1, &mask,
&attr, &errorScreen))) {
printf("Reconfigured screen #%d to "
- "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n",
- screen,
- attr.screenWindowWidth,
- attr.screenWindowHeight,
- (attr.screenWindowXoffset < 0 ? "" : "+"),
- attr.screenWindowXoffset,
- (attr.screenWindowYoffset < 0 ? "" : "+"),
- attr.screenWindowYoffset,
- attr.rootWindowWidth,
- attr.rootWindowHeight,
- (attr.rootWindowXoffset < 0 ? "" : "+"),
- attr.rootWindowXoffset,
- (attr.rootWindowYoffset < 0 ? "" : "+"),
- attr.rootWindowYoffset,
- (attr.rootWindowXorigin < 0 ? "" : "+"),
- attr.rootWindowXorigin,
- (attr.rootWindowYorigin < 0 ? "" : "+"),
- attr.rootWindowYorigin);
- } else {
+ "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n",
+ screen,
+ attr.screenWindowWidth,
+ attr.screenWindowHeight,
+ (attr.screenWindowXoffset < 0 ? "" : "+"),
+ attr.screenWindowXoffset,
+ (attr.screenWindowYoffset < 0 ? "" : "+"),
+ attr.screenWindowYoffset,
+ attr.rootWindowWidth,
+ attr.rootWindowHeight,
+ (attr.rootWindowXoffset < 0 ? "" : "+"),
+ attr.rootWindowXoffset,
+ (attr.rootWindowYoffset < 0 ? "" : "+"),
+ attr.rootWindowYoffset,
+ (attr.rootWindowXorigin < 0 ? "" : "+"),
+ attr.rootWindowXorigin,
+ (attr.rootWindowYorigin < 0 ? "" : "+"), attr.rootWindowYorigin);
+ }
+ else {
fprintf(stderr,
"Could not set screen #%d to "
- "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n"
+ "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n"
"[status = %d, errorScreen=%d]\n",
screen,
- attr.screenWindowWidth,
- attr.screenWindowHeight,
- (attr.screenWindowXoffset < 0 ? "" : "+"),
- attr.screenWindowXoffset,
- (attr.screenWindowYoffset < 0 ? "" : "+"),
- attr.screenWindowYoffset,
- attr.rootWindowWidth,
- attr.rootWindowHeight,
- (attr.rootWindowXoffset < 0 ? "" : "+"),
- attr.rootWindowXoffset,
- (attr.rootWindowYoffset < 0 ? "" : "+"),
- attr.rootWindowYoffset,
- (attr.rootWindowXorigin < 0 ? "" : "+"),
- attr.rootWindowXorigin,
- (attr.rootWindowYorigin < 0 ? "" : "+"),
- attr.rootWindowYorigin,
- status, errorScreen);
- return -1;
+ attr.screenWindowWidth,
+ attr.screenWindowHeight,
+ (attr.screenWindowXoffset < 0 ? "" : "+"),
+ attr.screenWindowXoffset,
+ (attr.screenWindowYoffset < 0 ? "" : "+"),
+ attr.screenWindowYoffset,
+ attr.rootWindowWidth,
+ attr.rootWindowHeight,
+ (attr.rootWindowXoffset < 0 ? "" : "+"),
+ attr.rootWindowXoffset,
+ (attr.rootWindowYoffset < 0 ? "" : "+"),
+ attr.rootWindowYoffset,
+ (attr.rootWindowXorigin < 0 ? "" : "+"),
+ attr.rootWindowXorigin,
+ (attr.rootWindowYorigin < 0 ? "" : "+"),
+ attr.rootWindowYorigin, status, errorScreen);
+ return -1;
}
XCloseDisplay(display);
diff --git a/xorg-server/hw/dmx/examples/dmxresize.c b/xorg-server/hw/dmx/examples/dmxresize.c
index caed91d8d..fed3bd08a 100644
--- a/xorg-server/hw/dmx/examples/dmxresize.c
+++ b/xorg-server/hw/dmx/examples/dmxresize.c
@@ -36,15 +36,16 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int width, height, shiftX, shiftY, status;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int width, height, shiftX, shiftY, status;
DMXDesktopAttributes attr;
- unsigned int mask;
+ unsigned int mask;
if (argc != 6) {
printf("Usage: %s display width height shiftX shiftY\n", argv[0]);
@@ -56,7 +57,7 @@ int main(int argc, char **argv)
return -1;
}
- width = strtol(argv[2], NULL, 0);
+ width = strtol(argv[2], NULL, 0);
height = strtol(argv[3], NULL, 0);
shiftX = strtol(argv[4], NULL, 0);
shiftY = strtol(argv[5], NULL, 0);
@@ -76,11 +77,9 @@ int main(int argc, char **argv)
printf("Extension version: %d.%d patch %d\n",
major_version, minor_version, patch_version);
- mask = (DMXDesktopWidth |
- DMXDesktopHeight |
- DMXDesktopShiftX |
- DMXDesktopShiftY);
- attr.width = width;
+ mask = (DMXDesktopWidth |
+ DMXDesktopHeight | DMXDesktopShiftX | DMXDesktopShiftY);
+ attr.width = width;
attr.height = height;
attr.shiftX = shiftX;
attr.shiftY = shiftY;
@@ -98,7 +97,7 @@ int main(int argc, char **argv)
printf("status = %d (UNKNOWN ERROR *****)\n", status);
break;
}
-
+
XCloseDisplay(display);
return 0;
}
diff --git a/xorg-server/hw/dmx/examples/dmxrminput.c b/xorg-server/hw/dmx/examples/dmxrminput.c
index ef62cab8b..0113a7f5c 100644
--- a/xorg-server/hw/dmx/examples/dmxrminput.c
+++ b/xorg-server/hw/dmx/examples/dmxrminput.c
@@ -36,13 +36,14 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int status;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int status;
if (argc != 3) {
printf("Usage: %s display id\n", argv[0]);
diff --git a/xorg-server/hw/dmx/examples/dmxrmscreen.c b/xorg-server/hw/dmx/examples/dmxrmscreen.c
index fecf0f6c1..627875bda 100644
--- a/xorg-server/hw/dmx/examples/dmxrmscreen.c
+++ b/xorg-server/hw/dmx/examples/dmxrmscreen.c
@@ -37,13 +37,14 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int screenNum;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int screenNum;
if (argc != 3) {
printf("Usage: %s display screenNum\n", argv[0]);
@@ -74,7 +75,7 @@ int main(int argc, char **argv)
if (!DMXRemoveScreen(display, screenNum))
printf("Failed to remove screen #%d\n", screenNum);
-
+
XCloseDisplay(display);
return 0;
}
diff --git a/xorg-server/hw/dmx/examples/dmxwininfo.c b/xorg-server/hw/dmx/examples/dmxwininfo.c
index 3d027d530..9b1ce76b6 100644
--- a/xorg-server/hw/dmx/examples/dmxwininfo.c
+++ b/xorg-server/hw/dmx/examples/dmxwininfo.c
@@ -43,183 +43,180 @@
static const char *FontName = "fixed";
-
static void
-EventLoop(Display *dpy, Window win, GC gc)
+EventLoop(Display * dpy, Window win, GC gc)
{
- XEvent ev;
- while (1) {
- XNextEvent( dpy, &ev );
- switch (ev.type) {
- case ReparentNotify:
- break;
- case MapNotify:
- break;
- case ConfigureNotify:
- case Expose:
- {
+ XEvent ev;
+
+ while (1) {
+ XNextEvent(dpy, &ev);
+ switch (ev.type) {
+ case ReparentNotify:
+ break;
+ case MapNotify:
+ break;
+ case ConfigureNotify:
+ case Expose:
+ {
int numScreens, count, i;
DMXWindowAttributes *winInfo;
int x, y;
const char *msg = "DMX window info:";
DMXGetScreenCount(dpy, &numScreens);
- winInfo
- = (DMXWindowAttributes *)
+ winInfo = (DMXWindowAttributes *)
malloc(numScreens * sizeof(DMXWindowAttributes));
assert(winInfo);
- if (!DMXGetWindowAttributes(dpy, win, &count,
- numScreens, winInfo)) {
- printf("Could not get window information for 0x%08lx\n",
- (long unsigned)win);
+ if (!DMXGetWindowAttributes(dpy, win, &count, numScreens, winInfo)) {
+ printf("Could not get window information for 0x%08lx\n",
+ (long unsigned) win);
}
x = y = 50;
XClearWindow(dpy, win);
XDrawString(dpy, win, gc, x, y, msg, strlen(msg));
y += 20;
for (i = 0; i < count; i++) {
- char str[500];
- snprintf(str, sizeof(str),
- "screen %d: pos: %dx%d+%d+%d visible: %dx%d+%d+%d",
- winInfo[i].screen,
- winInfo[i].pos.width, winInfo[i].pos.height,
- winInfo[i].pos.x, winInfo[i].pos.y,
- winInfo[i].vis.width, winInfo[i].vis.height,
- winInfo[i].vis.x, winInfo[i].vis.y);
- XDrawString(dpy, win, gc, x, y, str, strlen(str));
- y += 20;
+ char str[500];
+
+ snprintf(str, sizeof(str),
+ "screen %d: pos: %dx%d+%d+%d visible: %dx%d+%d+%d",
+ winInfo[i].screen,
+ winInfo[i].pos.width, winInfo[i].pos.height,
+ winInfo[i].pos.x, winInfo[i].pos.y,
+ winInfo[i].vis.width, winInfo[i].vis.height,
+ winInfo[i].vis.x, winInfo[i].vis.y);
+ XDrawString(dpy, win, gc, x, y, str, strlen(str));
+ y += 20;
}
free(winInfo);
- }
- break;
- default:
- printf("Event type 0x%x\n", ev.type);
- }
- }
+ }
+ break;
+ default:
+ printf("Event type 0x%x\n", ev.type);
+ }
+ }
}
int
main(int argc, char *argv[])
{
- const char *displayName = NULL;
- Display *dpy;
- int event_base, error_base;
- int scr, n;
- long vinfoMask, attrMask;
- XVisualInfo vinfoTemp, *visInfo;
- Visual *vis;
- Window win, root;
- XSetWindowAttributes attr;
- XFontStruct *fontInfo;
- GC gc;
-
- if (argc > 1) {
- displayName = argv[1];
- }
-
- dpy = XOpenDisplay(displayName);
- if (!dpy) {
- fprintf(stderr, "Unable to open display %s\n", displayName);
- return -1;
- }
-
- if (!DMXQueryExtension(dpy, &event_base, &error_base)) {
- fprintf(stderr, "DMX extension not available on this display.\n");
- return -1;
- }
-
- scr = DefaultScreen(dpy);
- root = RootWindow(dpy, scr);
- vis = DefaultVisual(dpy, scr);
-
- vinfoMask = VisualIDMask;
- vinfoTemp.visualid = vis->visualid;
- visInfo = XGetVisualInfo(dpy, vinfoMask, &vinfoTemp, &n);
- if (!visInfo || n != 1) {
- fprintf(stderr, "Unable to get visual!\n");
- XCloseDisplay(dpy);
- return -1;
- }
-
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(dpy, root, visInfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask;
- attrMask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow(dpy, root,
- 500, 500, 600, 400, /* x, y, w, h */
- 0, /* border_width */
- visInfo->depth, InputOutput,
- visInfo->visual, attrMask, &attr);
-
-
- if (!win) {
- fprintf(stderr, "Unable to create window!\n");
- XCloseDisplay(dpy);
- return -1;
- }
-
- fontInfo = XLoadQueryFont(dpy, FontName);
- if (!fontInfo) {
- fprintf(stderr, "Error: font %s not found\n", FontName);
- exit(0);
- }
-
- gc = XCreateGC(dpy, win, 0, NULL);
- XSetBackground(dpy, gc, BlackPixel(dpy, scr));
- XSetForeground(dpy, gc, WhitePixel(dpy, scr));
- XSetFont(dpy, gc, fontInfo->fid);
-
- XMapWindow(dpy, win);
-
- EventLoop(dpy, win, gc);
-
- XDestroyWindow(dpy, win);
- XCloseDisplay(dpy);
- return 0;
+ const char *displayName = NULL;
+ Display *dpy;
+ int event_base, error_base;
+ int scr, n;
+ long vinfoMask, attrMask;
+ XVisualInfo vinfoTemp, *visInfo;
+ Visual *vis;
+ Window win, root;
+ XSetWindowAttributes attr;
+ XFontStruct *fontInfo;
+ GC gc;
+
+ if (argc > 1) {
+ displayName = argv[1];
+ }
+
+ dpy = XOpenDisplay(displayName);
+ if (!dpy) {
+ fprintf(stderr, "Unable to open display %s\n", displayName);
+ return -1;
+ }
+
+ if (!DMXQueryExtension(dpy, &event_base, &error_base)) {
+ fprintf(stderr, "DMX extension not available on this display.\n");
+ return -1;
+ }
+
+ scr = DefaultScreen(dpy);
+ root = RootWindow(dpy, scr);
+ vis = DefaultVisual(dpy, scr);
+
+ vinfoMask = VisualIDMask;
+ vinfoTemp.visualid = vis->visualid;
+ visInfo = XGetVisualInfo(dpy, vinfoMask, &vinfoTemp, &n);
+ if (!visInfo || n != 1) {
+ fprintf(stderr, "Unable to get visual!\n");
+ XCloseDisplay(dpy);
+ return -1;
+ }
+
+ attr.background_pixel = 0;
+ attr.border_pixel = 0;
+ attr.colormap = XCreateColormap(dpy, root, visInfo->visual, AllocNone);
+ attr.event_mask = StructureNotifyMask | ExposureMask;
+ attrMask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ win = XCreateWindow(dpy, root, 500, 500, 600, 400, /* x, y, w, h */
+ 0, /* border_width */
+ visInfo->depth, InputOutput,
+ visInfo->visual, attrMask, &attr);
+
+ if (!win) {
+ fprintf(stderr, "Unable to create window!\n");
+ XCloseDisplay(dpy);
+ return -1;
+ }
+
+ fontInfo = XLoadQueryFont(dpy, FontName);
+ if (!fontInfo) {
+ fprintf(stderr, "Error: font %s not found\n", FontName);
+ exit(0);
+ }
+
+ gc = XCreateGC(dpy, win, 0, NULL);
+ XSetBackground(dpy, gc, BlackPixel(dpy, scr));
+ XSetForeground(dpy, gc, WhitePixel(dpy, scr));
+ XSetFont(dpy, gc, fontInfo->fid);
+
+ XMapWindow(dpy, win);
+
+ EventLoop(dpy, win, gc);
+
+ XDestroyWindow(dpy, win);
+ XCloseDisplay(dpy);
+ return 0;
}
#if 00
-static void make_window( char *title, int color_flag )
+static void
+make_window(char *title, int color_flag)
{
- int x = 10, y = 10, width = 400, height = 300;
- Display *dpy;
- int scr;
- Window root, win;
- Colormap cmap;
- XColor xcolor;
- int attr_flags;
- XVisualInfo *visinfo;
- XSetWindowAttributes attr;
- XTextProperty tp;
- XSizeHints sh;
- XEvent e;
- XMesaContext context;
- XMesaVisual visual;
- XMesaBuffer buffer;
-
-
- /*
- * Do the usual X things to make a window.
- */
-
- dpy = XOpenDisplay(NULL);
- if (!dpy) {
- printf("Couldn't open default display!\n");
- exit(1);
- }
-
- scr = DefaultScreen(dpy);
- root = RootWindow(dpy, scr);
-
- /* alloc visinfo struct */
- visinfo = (XVisualInfo *) malloc( sizeof(XVisualInfo) );
-
- /* Get a visual and colormap */
- if (color_flag) {
- /* Open TrueColor window */
+ int x = 10, y = 10, width = 400, height = 300;
+ Display *dpy;
+ int scr;
+ Window root, win;
+ Colormap cmap;
+ XColor xcolor;
+ int attr_flags;
+ XVisualInfo *visinfo;
+ XSetWindowAttributes attr;
+ XTextProperty tp;
+ XSizeHints sh;
+ XEvent e;
+ XMesaContext context;
+ XMesaVisual visual;
+ XMesaBuffer buffer;
+
+ /*
+ * Do the usual X things to make a window.
+ */
+
+ dpy = XOpenDisplay(NULL);
+ if (!dpy) {
+ printf("Couldn't open default display!\n");
+ exit(1);
+ }
+
+ scr = DefaultScreen(dpy);
+ root = RootWindow(dpy, scr);
+
+ /* alloc visinfo struct */
+ visinfo = (XVisualInfo *) malloc(sizeof(XVisualInfo));
+
+ /* Get a visual and colormap */
+ if (color_flag) {
+ /* Open TrueColor window */
/*
if (!XMatchVisualInfo( dpy, scr, 24, TrueColor, visinfo )) {
@@ -227,269 +224,254 @@ static void make_window( char *title, int color_flag )
exit(1);
}
*/
- if (!XMatchVisualInfo( dpy, scr, 8, PseudoColor, visinfo )) {
- printf("Couldn't get 8-bit PseudoColor visual!\n");
- exit(1);
- }
+ if (!XMatchVisualInfo(dpy, scr, 8, PseudoColor, visinfo)) {
+ printf("Couldn't get 8-bit PseudoColor visual!\n");
+ exit(1);
+ }
- cmap = XCreateColormap( dpy, root, visinfo->visual, AllocNone );
- Black = Red = Green = Blue = 0;
- }
- else {
- /* Open color index window */
+ cmap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
+ Black = Red = Green = Blue = 0;
+ }
+ else {
+ /* Open color index window */
- if (!XMatchVisualInfo( dpy, scr, 8, PseudoColor, visinfo )) {
- printf("Couldn't get 8-bit PseudoColor visual\n");
- exit(1);
- }
+ if (!XMatchVisualInfo(dpy, scr, 8, PseudoColor, visinfo)) {
+ printf("Couldn't get 8-bit PseudoColor visual\n");
+ exit(1);
+ }
- cmap = XCreateColormap( dpy, root, visinfo->visual, AllocNone );
+ cmap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
- /* Allocate colors */
- xcolor.red = 0x0;
- xcolor.green = 0x0;
- xcolor.blue = 0x0;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate black!\n");
- exit(1);
- }
- Black = xcolor.pixel;
-
- xcolor.red = 0xffff;
- xcolor.green = 0x0;
- xcolor.blue = 0x0;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate red!\n");
- exit(1);
- }
- Red = xcolor.pixel;
-
- xcolor.red = 0x0;
- xcolor.green = 0xffff;
- xcolor.blue = 0x0;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate green!\n");
- exit(1);
- }
- Green = xcolor.pixel;
-
- xcolor.red = 0x0;
- xcolor.green = 0x0;
- xcolor.blue = 0xffff;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate blue!\n");
- exit(1);
- }
- Blue = xcolor.pixel;
- }
-
- /* set window attributes */
- attr.colormap = cmap;
- attr.event_mask = ExposureMask | StructureNotifyMask;
- attr.border_pixel = BlackPixel( dpy, scr );
- attr.background_pixel = BlackPixel( dpy, scr );
- attr_flags = CWColormap | CWEventMask | CWBorderPixel | CWBackPixel;
-
- /* Create the window */
- win = XCreateWindow( dpy, root, x,y, width, height, 0,
- visinfo->depth, InputOutput,
- visinfo->visual,
- attr_flags, &attr);
- if (!win) {
- printf("Couldn't open window!\n");
- exit(1);
- }
-
- XStringListToTextProperty(&title, 1, &tp);
- sh.flags = USPosition | USSize;
- XSetWMProperties(dpy, win, &tp, &tp, 0, 0, &sh, 0, 0);
- XMapWindow(dpy, win);
- while (1) {
- XNextEvent( dpy, &e );
- if (e.type == MapNotify && e.xmap.window == win) {
- break;
- }
- }
-
-
- /*
- * Now do the special Mesa/Xlib stuff!
- */
-
- visual = XMesaCreateVisual( dpy, visinfo,
- (GLboolean) color_flag,
- GL_FALSE, /* alpha_flag */
- GL_FALSE, /* db_flag */
- GL_FALSE, /* stereo flag */
- GL_FALSE, /* ximage_flag */
- 0, /* depth size */
- 0, /* stencil size */
- 0,0,0,0, /* accum_size */
- 0, /* num samples */
- 0, /* level */
- 0 /* caveat */
- );
- if (!visual) {
- printf("Couldn't create Mesa/X visual!\n");
- exit(1);
- }
-
- /* Create a Mesa rendering context */
- context = XMesaCreateContext( visual,
- NULL /* share_list */
- );
- if (!context) {
- printf("Couldn't create Mesa/X context!\n");
- exit(1);
- }
-
- buffer = XMesaCreateWindowBuffer( visual, win );
- if (!buffer) {
- printf("Couldn't create Mesa/X buffer!\n");
- exit(1);
- }
-
-
- XMesaMakeCurrent( context, buffer );
-
- /* Ready to render! */
+ /* Allocate colors */
+ xcolor.red = 0x0;
+ xcolor.green = 0x0;
+ xcolor.blue = 0x0;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor(dpy, cmap, &xcolor)) {
+ printf("Couldn't allocate black!\n");
+ exit(1);
+ }
+ Black = xcolor.pixel;
+
+ xcolor.red = 0xffff;
+ xcolor.green = 0x0;
+ xcolor.blue = 0x0;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor(dpy, cmap, &xcolor)) {
+ printf("Couldn't allocate red!\n");
+ exit(1);
+ }
+ Red = xcolor.pixel;
+
+ xcolor.red = 0x0;
+ xcolor.green = 0xffff;
+ xcolor.blue = 0x0;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor(dpy, cmap, &xcolor)) {
+ printf("Couldn't allocate green!\n");
+ exit(1);
+ }
+ Green = xcolor.pixel;
+
+ xcolor.red = 0x0;
+ xcolor.green = 0x0;
+ xcolor.blue = 0xffff;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor(dpy, cmap, &xcolor)) {
+ printf("Couldn't allocate blue!\n");
+ exit(1);
+ }
+ Blue = xcolor.pixel;
+ }
+
+ /* set window attributes */
+ attr.colormap = cmap;
+ attr.event_mask = ExposureMask | StructureNotifyMask;
+ attr.border_pixel = BlackPixel(dpy, scr);
+ attr.background_pixel = BlackPixel(dpy, scr);
+ attr_flags = CWColormap | CWEventMask | CWBorderPixel | CWBackPixel;
+
+ /* Create the window */
+ win = XCreateWindow(dpy, root, x, y, width, height, 0,
+ visinfo->depth, InputOutput,
+ visinfo->visual, attr_flags, &attr);
+ if (!win) {
+ printf("Couldn't open window!\n");
+ exit(1);
+ }
+
+ XStringListToTextProperty(&title, 1, &tp);
+ sh.flags = USPosition | USSize;
+ XSetWMProperties(dpy, win, &tp, &tp, 0, 0, &sh, 0, 0);
+ XMapWindow(dpy, win);
+ while (1) {
+ XNextEvent(dpy, &e);
+ if (e.type == MapNotify && e.xmap.window == win) {
+ break;
+ }
+ }
+
+ /*
+ * Now do the special Mesa/Xlib stuff!
+ */
+
+ visual = XMesaCreateVisual(dpy, visinfo, (GLboolean) color_flag, GL_FALSE, /* alpha_flag */
+ GL_FALSE, /* db_flag */
+ GL_FALSE, /* stereo flag */
+ GL_FALSE, /* ximage_flag */
+ 0, /* depth size */
+ 0, /* stencil size */
+ 0, 0, 0, 0, /* accum_size */
+ 0, /* num samples */
+ 0, /* level */
+ 0 /* caveat */
+ );
+ if (!visual) {
+ printf("Couldn't create Mesa/X visual!\n");
+ exit(1);
+ }
+
+ /* Create a Mesa rendering context */
+ context = XMesaCreateContext(visual, NULL /* share_list */
+ );
+ if (!context) {
+ printf("Couldn't create Mesa/X context!\n");
+ exit(1);
+ }
+
+ buffer = XMesaCreateWindowBuffer(visual, win);
+ if (!buffer) {
+ printf("Couldn't create Mesa/X buffer!\n");
+ exit(1);
+ }
+
+ XMesaMakeCurrent(context, buffer);
+
+ /* Ready to render! */
}
-
-
-static void draw_cube( void )
+static void
+draw_cube(void)
{
- /* X faces */
- glIndexi( Red );
- glColor3f( 1.0, 0.0, 0.0 );
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, 1.0 );
- glVertex3f( 1.0, -1.0, 1.0 );
- glVertex3f( 1.0, -1.0, -1.0 );
- glVertex3f( 1.0, 1.0, -1.0 );
- glEnd();
-
- glBegin( GL_POLYGON );
- glVertex3f( -1.0, 1.0, 1.0 );
- glVertex3f( -1.0, 1.0, -1.0 );
- glVertex3f( -1.0, -1.0, -1.0 );
- glVertex3f( -1.0, -1.0, 1.0 );
- glEnd();
-
- /* Y faces */
- glIndexi( Green );
- glColor3f( 0.0, 1.0, 0.0 );
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, 1.0 );
- glVertex3f( 1.0, 1.0, -1.0 );
- glVertex3f( -1.0, 1.0, -1.0 );
- glVertex3f( -1.0, 1.0, 1.0 );
- glEnd();
-
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, -1.0, 1.0 );
- glVertex3f( -1.0, -1.0, 1.0 );
- glVertex3f( -1.0, -1.0, -1.0 );
- glVertex3f( 1.0, -1.0, -1.0 );
- glEnd();
-
- /* Z faces */
- glIndexi( Blue );
- glColor3f( 0.0, 0.0, 1.0 );
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, 1.0 );
- glVertex3f( -1.0, 1.0, 1.0 );
- glVertex3f( -1.0, -1.0, 1.0 );
- glVertex3f( 1.0, -1.0, 1.0 );
- glEnd();
-
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, -1.0 );
- glVertex3f( 1.0,-1.0, -1.0 );
- glVertex3f( -1.0,-1.0, -1.0 );
- glVertex3f( -1.0, 1.0, -1.0 );
- glEnd();
+ /* X faces */
+ glIndexi(Red);
+ glColor3f(1.0, 0.0, 0.0);
+ glBegin(GL_POLYGON);
+ glVertex3f(1.0, 1.0, 1.0);
+ glVertex3f(1.0, -1.0, 1.0);
+ glVertex3f(1.0, -1.0, -1.0);
+ glVertex3f(1.0, 1.0, -1.0);
+ glEnd();
+
+ glBegin(GL_POLYGON);
+ glVertex3f(-1.0, 1.0, 1.0);
+ glVertex3f(-1.0, 1.0, -1.0);
+ glVertex3f(-1.0, -1.0, -1.0);
+ glVertex3f(-1.0, -1.0, 1.0);
+ glEnd();
+
+ /* Y faces */
+ glIndexi(Green);
+ glColor3f(0.0, 1.0, 0.0);
+ glBegin(GL_POLYGON);
+ glVertex3f(1.0, 1.0, 1.0);
+ glVertex3f(1.0, 1.0, -1.0);
+ glVertex3f(-1.0, 1.0, -1.0);
+ glVertex3f(-1.0, 1.0, 1.0);
+ glEnd();
+
+ glBegin(GL_POLYGON);
+ glVertex3f(1.0, -1.0, 1.0);
+ glVertex3f(-1.0, -1.0, 1.0);
+ glVertex3f(-1.0, -1.0, -1.0);
+ glVertex3f(1.0, -1.0, -1.0);
+ glEnd();
+
+ /* Z faces */
+ glIndexi(Blue);
+ glColor3f(0.0, 0.0, 1.0);
+ glBegin(GL_POLYGON);
+ glVertex3f(1.0, 1.0, 1.0);
+ glVertex3f(-1.0, 1.0, 1.0);
+ glVertex3f(-1.0, -1.0, 1.0);
+ glVertex3f(1.0, -1.0, 1.0);
+ glEnd();
+
+ glBegin(GL_POLYGON);
+ glVertex3f(1.0, 1.0, -1.0);
+ glVertex3f(1.0, -1.0, -1.0);
+ glVertex3f(-1.0, -1.0, -1.0);
+ glVertex3f(-1.0, 1.0, -1.0);
+ glEnd();
}
-
-
-
-static void display_loop( void )
+static void
+display_loop(void)
{
- GLfloat xrot, yrot, zrot;
+ GLfloat xrot, yrot, zrot;
- xrot = yrot = zrot = 0.0;
+ xrot = yrot = zrot = 0.0;
- glClearColor( 0.0, 0.0, 0.0, 0.0 );
- glClearIndex( Black );
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClearIndex(Black);
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 1.0, 10.0 );
- glTranslatef( 0.0, 0.0, -5.0 );
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 10.0);
+ glTranslatef(0.0, 0.0, -5.0);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
- glCullFace( GL_BACK );
- glEnable( GL_CULL_FACE );
+ glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
- glShadeModel( GL_FLAT );
+ glShadeModel(GL_FLAT);
- while (1) {
- glClear( GL_COLOR_BUFFER_BIT );
- glPushMatrix();
- glRotatef( xrot, 1.0, 0.0, 0.0 );
- glRotatef( yrot, 0.0, 1.0, 0.0 );
- glRotatef( zrot, 0.0, 0.0, 1.0 );
+ while (1) {
+ glClear(GL_COLOR_BUFFER_BIT);
+ glPushMatrix();
+ glRotatef(xrot, 1.0, 0.0, 0.0);
+ glRotatef(yrot, 0.0, 1.0, 0.0);
+ glRotatef(zrot, 0.0, 0.0, 1.0);
- draw_cube();
+ draw_cube();
- glPopMatrix();
- glFinish();
+ glPopMatrix();
+ glFinish();
- xrot += 10.0;
- yrot += 7.0;
- zrot -= 3.0;
- }
+ xrot += 10.0;
+ yrot += 7.0;
+ zrot -= 3.0;
+ }
}
-
-
-
-int main( int argc, char *argv[] )
+int
+main(int argc, char *argv[])
{
- int mode = 0;
-
- if (argc >= 2)
- {
- if (strcmp(argv[1],"-ci")==0)
- mode = 0;
- else if (strcmp(argv[1],"-rgb")==0)
- mode = 1;
- else
- {
- printf("Bad flag: %s\n", argv[1]);
- printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n");
- exit(1);
+ int mode = 0;
+
+ if (argc >= 2) {
+ if (strcmp(argv[1], "-ci") == 0)
+ mode = 0;
+ else if (strcmp(argv[1], "-rgb") == 0)
+ mode = 1;
+ else {
+ printf("Bad flag: %s\n", argv[1]);
+ printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n");
+ exit(1);
}
- }
- else
- {
+ }
+ else {
printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n");
printf("Defaulting to 8-bit color index\n");
- }
+ }
- make_window( argv[0], mode );
+ make_window(argv[0], mode);
- display_loop();
- return 0;
+ display_loop();
+ return 0;
}
-
#endif
diff --git a/xorg-server/hw/dmx/examples/ev.c b/xorg-server/hw/dmx/examples/ev.c
index ed23b8aa9..b70016a45 100644
--- a/xorg-server/hw/dmx/examples/ev.c
+++ b/xorg-server/hw/dmx/examples/ev.c
@@ -46,16 +46,17 @@
struct input_event event;
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- char name[64]; /* RATS: Use ok, but could be better */
- char buf[256] = { 0, }; /* RATS: Use ok */
- unsigned char mask[EV_MAX/8 + 1]; /* RATS: Use ok */
- int version;
- int fd = 0;
- int rc;
- int i, j;
- char *tmp;
+ char name[64]; /* RATS: Use ok, but could be better */
+ char buf[256] = { 0, }; /* RATS: Use ok */
+ unsigned char mask[EV_MAX / 8 + 1]; /* RATS: Use ok */
+ int version;
+ int fd = 0;
+ int rc;
+ int i, j;
+ char *tmp;
#define test_bit(bit) (mask[(bit)/8] & (1 << ((bit)%8)))
@@ -73,15 +74,32 @@ int main(int argc, char **argv)
for (j = 0; j < EV_MAX; j++) {
if (test_bit(j)) {
const char *type = "unknown";
- switch(j) {
- case EV_KEY: type = "keys/buttons"; break;
- case EV_REL: type = "relative"; break;
- case EV_ABS: type = "absolute"; break;
- case EV_MSC: type = "reserved"; break;
- case EV_LED: type = "leds"; break;
- case EV_SND: type = "sound"; break;
- case EV_REP: type = "repeat"; break;
- case EV_FF: type = "feedback"; break;
+
+ switch (j) {
+ case EV_KEY:
+ type = "keys/buttons";
+ break;
+ case EV_REL:
+ type = "relative";
+ break;
+ case EV_ABS:
+ type = "absolute";
+ break;
+ case EV_MSC:
+ type = "reserved";
+ break;
+ case EV_LED:
+ type = "leds";
+ break;
+ case EV_SND:
+ type = "sound";
+ break;
+ case EV_REP:
+ type = "repeat";
+ break;
+ case EV_FF:
+ type = "feedback";
+ break;
}
printf(" %s", type);
}
@@ -96,27 +114,27 @@ int main(int argc, char **argv)
if ((fd = open(name, O_RDWR, 0)) >= 0) {
printf("%s: open, fd = %d\n", name, fd);
for (i = 0; i < LED_MAX; i++) {
- event.time.tv_sec = time(0);
+ event.time.tv_sec = time(0);
event.time.tv_usec = 0;
- event.type = EV_LED;
- event.code = i;
- event.value = 0;
+ event.type = EV_LED;
+ event.code = i;
+ event.value = 0;
write(fd, &event, sizeof(event));
}
-
+
while ((rc = read(fd, &event, sizeof(event))) > 0) {
printf("%-24.24s.%06lu type 0x%04x; code 0x%04x;"
" value 0x%08x; ",
ctime(&event.time.tv_sec),
- event.time.tv_usec,
- event.type, event.code, event.value);
+ event.time.tv_usec, event.type, event.code, event.value);
switch (event.type) {
case EV_KEY:
if (event.code > BTN_MISC) {
printf("Button %d %s",
event.code & 0xff,
event.value ? "press" : "release");
- } else {
+ }
+ else {
printf("Key %d (0x%x) %s",
event.code & 0xff,
event.code & 0xff,
@@ -125,51 +143,125 @@ int main(int argc, char **argv)
break;
case EV_REL:
switch (event.code) {
- case REL_X: tmp = "X"; break;
- case REL_Y: tmp = "Y"; break;
- case REL_HWHEEL: tmp = "HWHEEL"; break;
- case REL_DIAL: tmp = "DIAL"; break;
- case REL_WHEEL: tmp = "WHEEL"; break;
- case REL_MISC: tmp = "MISC"; break;
- default: tmp = "UNKNOWN"; break;
+ case REL_X:
+ tmp = "X";
+ break;
+ case REL_Y:
+ tmp = "Y";
+ break;
+ case REL_HWHEEL:
+ tmp = "HWHEEL";
+ break;
+ case REL_DIAL:
+ tmp = "DIAL";
+ break;
+ case REL_WHEEL:
+ tmp = "WHEEL";
+ break;
+ case REL_MISC:
+ tmp = "MISC";
+ break;
+ default:
+ tmp = "UNKNOWN";
+ break;
}
printf("Relative %s %d", tmp, event.value);
break;
case EV_ABS:
switch (event.code) {
- case ABS_X: tmp = "X"; break;
- case ABS_Y: tmp = "Y"; break;
- case ABS_Z: tmp = "Z"; break;
- case ABS_RX: tmp = "RX"; break;
- case ABS_RY: tmp = "RY"; break;
- case ABS_RZ: tmp = "RZ"; break;
- case ABS_THROTTLE: tmp = "THROTTLE"; break;
- case ABS_RUDDER: tmp = "RUDDER"; break;
- case ABS_WHEEL: tmp = "WHEEL"; break;
- case ABS_GAS: tmp = "GAS"; break;
- case ABS_BRAKE: tmp = "BRAKE"; break;
- case ABS_HAT0X: tmp = "HAT0X"; break;
- case ABS_HAT0Y: tmp = "HAT0Y"; break;
- case ABS_HAT1X: tmp = "HAT1X"; break;
- case ABS_HAT1Y: tmp = "HAT1Y"; break;
- case ABS_HAT2X: tmp = "HAT2X"; break;
- case ABS_HAT2Y: tmp = "HAT2Y"; break;
- case ABS_HAT3X: tmp = "HAT3X"; break;
- case ABS_HAT3Y: tmp = "HAT3Y"; break;
- case ABS_PRESSURE: tmp = "PRESSURE"; break;
- case ABS_DISTANCE: tmp = "DISTANCE"; break;
- case ABS_TILT_X: tmp = "TILT_X"; break;
- case ABS_TILT_Y: tmp = "TILT_Y"; break;
- case ABS_MISC: tmp = "MISC"; break;
- default: tmp = "UNKNOWN"; break;
+ case ABS_X:
+ tmp = "X";
+ break;
+ case ABS_Y:
+ tmp = "Y";
+ break;
+ case ABS_Z:
+ tmp = "Z";
+ break;
+ case ABS_RX:
+ tmp = "RX";
+ break;
+ case ABS_RY:
+ tmp = "RY";
+ break;
+ case ABS_RZ:
+ tmp = "RZ";
+ break;
+ case ABS_THROTTLE:
+ tmp = "THROTTLE";
+ break;
+ case ABS_RUDDER:
+ tmp = "RUDDER";
+ break;
+ case ABS_WHEEL:
+ tmp = "WHEEL";
+ break;
+ case ABS_GAS:
+ tmp = "GAS";
+ break;
+ case ABS_BRAKE:
+ tmp = "BRAKE";
+ break;
+ case ABS_HAT0X:
+ tmp = "HAT0X";
+ break;
+ case ABS_HAT0Y:
+ tmp = "HAT0Y";
+ break;
+ case ABS_HAT1X:
+ tmp = "HAT1X";
+ break;
+ case ABS_HAT1Y:
+ tmp = "HAT1Y";
+ break;
+ case ABS_HAT2X:
+ tmp = "HAT2X";
+ break;
+ case ABS_HAT2Y:
+ tmp = "HAT2Y";
+ break;
+ case ABS_HAT3X:
+ tmp = "HAT3X";
+ break;
+ case ABS_HAT3Y:
+ tmp = "HAT3Y";
+ break;
+ case ABS_PRESSURE:
+ tmp = "PRESSURE";
+ break;
+ case ABS_DISTANCE:
+ tmp = "DISTANCE";
+ break;
+ case ABS_TILT_X:
+ tmp = "TILT_X";
+ break;
+ case ABS_TILT_Y:
+ tmp = "TILT_Y";
+ break;
+ case ABS_MISC:
+ tmp = "MISC";
+ break;
+ default:
+ tmp = "UNKNOWN";
+ break;
}
printf("Absolute %s %d", tmp, event.value);
break;
- case EV_MSC: printf("Misc"); break;
- case EV_LED: printf("Led"); break;
- case EV_SND: printf("Snd"); break;
- case EV_REP: printf("Rep"); break;
- case EV_FF: printf("FF"); break;
+ case EV_MSC:
+ printf("Misc");
+ break;
+ case EV_LED:
+ printf("Led");
+ break;
+ case EV_SND:
+ printf("Snd");
+ break;
+ case EV_REP:
+ printf("Rep");
+ break;
+ case EV_FF:
+ printf("FF");
+ break;
break;
}
printf("\n");
diff --git a/xorg-server/hw/dmx/examples/evi.c b/xorg-server/hw/dmx/examples/evi.c
index 644ea8f51..64dfb7eaa 100644
--- a/xorg-server/hw/dmx/examples/evi.c
+++ b/xorg-server/hw/dmx/examples/evi.c
@@ -36,20 +36,22 @@
#include <X11/Xlib.h>
#include <X11/extensions/XEVI.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int major_version, minor_version;
- ExtendedVisualInfo *evi;
- int count;
- int i;
+ Display *display = NULL;
+ int major_version, minor_version;
+ ExtendedVisualInfo *evi;
+ int count;
+ int i;
if (argc == 2) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- } else {
+ }
+ else {
printf("Usage: %s display\n", argv[0]);
return -1;
}
@@ -71,14 +73,13 @@ int main(int argc, char **argv)
printf("%02d vid=0x%02lx screen=%d level=%d type=%u value=%u"
" min=%u max=%u conflicts=%u\n",
i,
- (long unsigned)evi[i].core_visual_id,
+ (long unsigned) evi[i].core_visual_id,
evi[i].screen,
evi[i].level,
evi[i].transparency_type,
evi[i].transparency_value,
evi[i].min_hw_colormaps,
- evi[i].max_hw_colormaps,
- evi[i].num_colormap_conflicts);
+ evi[i].max_hw_colormaps, evi[i].num_colormap_conflicts);
}
XCloseDisplay(display);
diff --git a/xorg-server/hw/dmx/examples/res.c b/xorg-server/hw/dmx/examples/res.c
index 901a1958b..138216e4c 100644
--- a/xorg-server/hw/dmx/examples/res.c
+++ b/xorg-server/hw/dmx/examples/res.c
@@ -36,21 +36,23 @@
#include <X11/Xlib.h>
#include <X11/extensions/XRes.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int major_version, minor_version;
- int event, error;
- int count;
- int i;
- XResClient *clients;
+ Display *display = NULL;
+ int major_version, minor_version;
+ int event, error;
+ int count;
+ int i;
+ XResClient *clients;
if (argc == 2) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- } else {
+ }
+ else {
printf("Usage: %s display\n", argv[0]);
return -1;
}
@@ -65,7 +67,7 @@ int main(int argc, char **argv)
return -1;
}
printf("X-Resource extension present: event=%d error=%d\n", event, error);
-
+
if (!XResQueryVersion(display, &major_version, &minor_version)) {
printf("XResQueryVersion call failed\n");
return -1;
@@ -77,16 +79,16 @@ int main(int argc, char **argv)
printf("%d clients:\n", count);
for (i = 0; i < count; i++) {
- int c, j;
+ int c, j;
XResType *types;
-
- XResQueryClientResources(display, clients[i].resource_base,
- &c, &types);
+
+ XResQueryClientResources(display, clients[i].resource_base, &c, &types);
printf(" %3d: base = 0x%lx, mask = 0x%lx, %d resource types:\n",
- i, (long unsigned)clients[i].resource_base,
- (long unsigned)clients[i].resource_mask, c);
+ i, (long unsigned) clients[i].resource_base,
+ (long unsigned) clients[i].resource_mask, c);
for (j = 0; j < c; j++) {
char *name = XGetAtomName(display, types[j].resource_type);
+
printf(" %2d: %s %d\n", j, name, types[j].count);
XFree(name);
}
diff --git a/xorg-server/hw/dmx/examples/xbell.c b/xorg-server/hw/dmx/examples/xbell.c
index 79419d324..543db24bf 100644
--- a/xorg-server/hw/dmx/examples/xbell.c
+++ b/xorg-server/hw/dmx/examples/xbell.c
@@ -35,27 +35,29 @@
#include <stdlib.h>
#include <X11/Xlib.h>
-static void pkc(XKeyboardControl *kc, unsigned long vm)
+static void
+pkc(XKeyboardControl * kc, unsigned long vm)
{
- if (vm&KBKeyClickPercent)
+ if (vm & KBKeyClickPercent)
printf(" key_click_percent = %d\n", kc->key_click_percent);
- if (vm&KBBellPercent)
+ if (vm & KBBellPercent)
printf(" bell_percent = %d\n", kc->bell_percent);
- if (vm&KBBellPitch)
+ if (vm & KBBellPitch)
printf(" bell_pitch = %d\n", kc->bell_pitch);
- if (vm&KBBellDuration)
+ if (vm & KBBellDuration)
printf(" bell_duration = %d\n", kc->bell_duration);
- if (vm&KBLed)
+ if (vm & KBLed)
printf(" led = 0x%x\n", kc->led);
- if (vm&KBLedMode)
+ if (vm & KBLedMode)
printf(" led_mode = %d\n", kc->led_mode);
- if (vm&KBKey)
+ if (vm & KBKey)
printf(" key = %d\n", kc->key);
- if (vm&KBAutoRepeatMode)
+ if (vm & KBAutoRepeatMode)
printf(" auto_repeat_mode = %d\n", kc->auto_repeat_mode);
}
-static void pks(XKeyboardState *ks)
+static void
+pks(XKeyboardState * ks)
{
printf(" key_click_percent = %d\n", ks->key_click_percent);
printf(" bell_percent = %d\n", ks->bell_percent);
@@ -65,24 +67,23 @@ static void pks(XKeyboardState *ks)
printf(" global_auto_repeat = %d\n", ks->global_auto_repeat);
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = XOpenDisplay(NULL);
+ Display *display = XOpenDisplay(NULL);
XKeyboardControl kc;
- XKeyboardState ks;
- unsigned long vm;
+ XKeyboardState ks;
+ unsigned long vm;
if (argc != 5) {
printf("Usage: xbell percent baseVolume pitch duration\n");
return 1;
}
-
- vm = (KBBellPercent
- | KBBellPitch
- | KBBellDuration);
+
+ vm = (KBBellPercent | KBBellPitch | KBBellDuration);
kc.key_click_percent = atoi(argv[1]);
- kc.bell_percent = atoi(argv[2]);
- kc.bell_pitch = atoi(argv[3]);
+ kc.bell_percent = atoi(argv[2]);
+ kc.bell_pitch = atoi(argv[3]);
kc.bell_duration = atoi(argv[4]);
printf("Setting:\n");
@@ -92,9 +93,9 @@ int main(int argc, char **argv)
printf("Have:\n");
XGetKeyboardControl(display, &ks);
pks(&ks);
-
+
XBell(display, 100);
-
+
XCloseDisplay(display);
return 0;
}
diff --git a/xorg-server/hw/dmx/examples/xinput.c b/xorg-server/hw/dmx/examples/xinput.c
index b12daf201..db6601030 100644
--- a/xorg-server/hw/dmx/examples/xinput.c
+++ b/xorg-server/hw/dmx/examples/xinput.c
@@ -42,31 +42,42 @@
#include <X11/extensions/dmxext.h>
#include <sys/time.h>
-static const char *core(DMXInputAttributes *iinf)
+static const char *
+core(DMXInputAttributes * iinf)
{
- if (iinf->isCore) return "core";
- else if (iinf->sendsCore) return "extension (sends core events)";
- else return "extension";
+ if (iinf->isCore)
+ return "core";
+ else if (iinf->sendsCore)
+ return "extension (sends core events)";
+ else
+ return "extension";
}
-static void printdmxinfo(Display *display, int id)
+static void
+printdmxinfo(Display * display, int id)
{
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- DMXInputAttributes iinf;
- Display *backend;
- char *backendname = NULL;
-
- if (!DMXQueryExtension(display, &event_base, &error_base)) return;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ DMXInputAttributes iinf;
+ Display *backend;
+ char *backendname = NULL;
+
+ if (!DMXQueryExtension(display, &event_base, &error_base))
+ return;
if (!DMXQueryVersion(display, &major_version, &minor_version,
- &patch_version)) return;
- if (major_version == 1 && minor_version == 0) return; /* too old */
- if (!DMXGetInputAttributes(display, id, &iinf)) return;
+ &patch_version))
+ return;
+ if (major_version == 1 && minor_version == 0)
+ return; /* too old */
+ if (!DMXGetInputAttributes(display, id, &iinf))
+ return;
printf(" DMX Information: ");
- if (iinf.detached) printf("detached ");
- else printf("active ");
+ if (iinf.detached)
+ printf("detached ");
+ else
+ printf("active ");
switch (iinf.inputType) {
case DMXLocalInputType:
printf("local, %s", core(&iinf));
@@ -78,12 +89,14 @@ static void printdmxinfo(Display *display, int id)
if (iinf.physicalId >= 0) {
if ((backend = XOpenDisplay(iinf.name))) {
XExtensionVersion *ext = XGetExtensionVersion(backend, INAME);
- if (ext && ext != (XExtensionVersion *)NoSuchExtension) {
+
+ if (ext && ext != (XExtensionVersion *) NoSuchExtension) {
int count, i;
XDeviceInfo *devInfo = XListInputDevices(backend, &count);
+
if (devInfo) {
for (i = 0; i < count; i++) {
- if ((unsigned)iinf.physicalId == devInfo[i].id
+ if ((unsigned) iinf.physicalId == devInfo[i].id
&& devInfo[i].name) {
backendname = strdup(devInfo[i].name);
break;
@@ -95,8 +108,9 @@ static void printdmxinfo(Display *display, int id)
XCloseDisplay(backend);
}
}
- printf("backend o%d/%s",iinf.physicalScreen, iinf.name);
- if (iinf.physicalId >= 0) printf("/id%d", iinf.physicalId);
+ printf("backend o%d/%s", iinf.physicalScreen, iinf.name);
+ if (iinf.physicalId >= 0)
+ printf("/id%d", iinf.physicalId);
if (backendname) {
printf("=%s", backendname);
free(backendname);
@@ -107,26 +121,31 @@ static void printdmxinfo(Display *display, int id)
printf("\n");
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int device = -1;
- int newmouse = -1;
- int newkbd = -1;
- int count;
- int i, j;
- XDeviceInfo *devInfo;
- XExtensionVersion *ext;
+ Display *display = NULL;
+ int device = -1;
+ int newmouse = -1;
+ int newkbd = -1;
+ int count;
+ int i, j;
+ XDeviceInfo *devInfo;
+ XExtensionVersion *ext;
if (argc == 2 || argc == 3 || argc == 4 || argc == 5) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- if (argc >= 3) device = strtol(argv[2], NULL, 0);
- if (argc >= 4) newmouse = strtol(argv[3], NULL, 0);
- if (argc >= 5) newkbd = strtol(argv[4], NULL, 0);
- } else {
+ if (argc >= 3)
+ device = strtol(argv[2], NULL, 0);
+ if (argc >= 4)
+ newmouse = strtol(argv[3], NULL, 0);
+ if (argc >= 5)
+ newkbd = strtol(argv[4], NULL, 0);
+ }
+ else {
printf("Usage: %s display [device] [newmouse] [newkbd]\n", argv[0]);
return -1;
}
@@ -137,12 +156,11 @@ int main(int argc, char **argv)
}
ext = XGetExtensionVersion(display, INAME);
- if (!ext || ext == (XExtensionVersion *)NoSuchExtension) {
+ if (!ext || ext == (XExtensionVersion *) NoSuchExtension) {
printf("No XInputExtension\n");
return -1;
}
- printf("%s version %d.%d\n",
- INAME, ext->major_version, ext->minor_version);
+ printf("%s version %d.%d\n", INAME, ext->major_version, ext->minor_version);
if (!(devInfo = XListInputDevices(display, &count)) || !count) {
printf("Cannot list devices\n");
@@ -151,30 +169,52 @@ int main(int argc, char **argv)
for (i = 0; i < count; i++) {
XAnyClassPtr any;
- const char *kind = "Unknown";
- int has_key = 0;
-
+ const char *kind = "Unknown";
+ int has_key = 0;
+
switch (devInfo[i].use) {
- case IsXPointer: kind = "XPointer"; break;
- case IsXKeyboard: kind = "XKeyboard"; break;
- case IsXExtensionDevice: kind = "XExtensionDevice"; break;
+ case IsXPointer:
+ kind = "XPointer";
+ break;
+ case IsXKeyboard:
+ kind = "XKeyboard";
+ break;
+ case IsXExtensionDevice:
+ kind = "XExtensionDevice";
+ break;
}
printf("%2lu %-20.20s %-16.16s",
- (long unsigned)devInfo[i].id,
+ (long unsigned) devInfo[i].id,
devInfo[i].name ? devInfo[i].name : "", kind);
for (j = 0, any = devInfo[i].inputclassinfo;
j < devInfo[i].num_classes;
- any = (XAnyClassPtr)((char *)any + any->length), j++) {
- const char *class = "unk";
+ any = (XAnyClassPtr) ((char *) any + any->length), j++) {
+ const char *class = "unk";
+
switch (any->class) {
- case KeyClass: class = "key"; ++has_key; break;
- case ButtonClass: class = "btn"; break;
- case ValuatorClass: class = "val"; break;
- case FeedbackClass: class = "fdb"; break;
- case ProximityClass: class = "prx"; break;
- case FocusClass: class = "foc"; break;
- case OtherClass: class = "oth"; break;
+ case KeyClass:
+ class = "key";
+ ++has_key;
+ break;
+ case ButtonClass:
+ class = "btn";
+ break;
+ case ValuatorClass:
+ class = "val";
+ break;
+ case FeedbackClass:
+ class = "fdb";
+ break;
+ case ProximityClass:
+ class = "prx";
+ break;
+ case FocusClass:
+ class = "foc";
+ break;
+ case OtherClass:
+ class = "oth";
+ break;
}
printf(" %s", class);
}
@@ -182,10 +222,10 @@ int main(int argc, char **argv)
printdmxinfo(display, i);
if (has_key) {
- XkbDescPtr xkb;
+ XkbDescPtr xkb;
+
if ((xkb = XkbGetKeyboard(display,
- XkbAllComponentsMask,
- devInfo[i].id))) {
+ XkbAllComponentsMask, devInfo[i].id))) {
printf(" Xkb Information:\n");
printf(" Device id = %d\n", xkb->device_spec);
printf(" Min keycode = 0x%02x\n", xkb->min_key_code);
@@ -203,41 +243,37 @@ int main(int argc, char **argv)
}
if (newmouse >= 0) {
- XDevice *dev;
+ XDevice *dev;
printf("Trying to make device %d core mouse\n", newmouse);
dev = XOpenDevice(display, devInfo[newmouse].id);
- printf("Status = %d\n",
- XChangePointerDevice(display, dev, 0, 1));
+ printf("Status = %d\n", XChangePointerDevice(display, dev, 0, 1));
return 0;
}
if (newkbd >= 0) {
- XDevice *dev;
+ XDevice *dev;
printf("Trying to make device %d core keyboard\n", newkbd);
dev = XOpenDevice(display, devInfo[newkbd].id);
- printf("Status = %d\n",
- XChangeKeyboardDevice(display, dev));
+ printf("Status = %d\n", XChangeKeyboardDevice(display, dev));
return 0;
}
-
- if (device >=0){
+ if (device >= 0) {
#define MAX_EVENTS 100
- int cnt = 0;
- XDevice *dev;
+ int cnt = 0;
+ XDevice *dev;
XEventClass event_list[MAX_EVENTS];
- int event_type[MAX_EVENTS];
- const char *names[MAX_EVENTS];
- int total = 0;
+ int event_type[MAX_EVENTS];
+ const char *names[MAX_EVENTS];
+ int total = 0;
#define ADD(type) \
if (cnt >= MAX_EVENTS) abort(); \
names[cnt] = #type; \
type(dev, event_type[cnt], event_list[cnt]); \
if (event_type[cnt]) ++cnt
-
dev = XOpenDevice(display, devInfo[device].id);
ADD(DeviceKeyPress);
@@ -252,54 +288,55 @@ int main(int argc, char **argv)
ADD(DeviceStateNotify);
ADD(DeviceMappingNotify);
ADD(ChangeDeviceNotify);
-
+
for (i = 0; i < cnt; i++) {
printf("Waiting for %s events of type %d (%lu) on 0x%08lx\n",
names[i],
- event_type[i], (unsigned long)event_list[i],
- (long unsigned)DefaultRootWindow(display));
+ event_type[i], (unsigned long) event_list[i],
+ (long unsigned) DefaultRootWindow(display));
}
XSelectExtensionEvent(display, DefaultRootWindow(display),
event_list, cnt);
-
+
for (;;) {
XEvent event;
+
XNextEvent(display, &event);
for (i = 0; i < cnt; i++) {
- XDeviceMotionEvent *e = (XDeviceMotionEvent *)&event;
- XDeviceButtonEvent *b = (XDeviceButtonEvent *)&event;
+ XDeviceMotionEvent *e = (XDeviceMotionEvent *) & event;
+ XDeviceButtonEvent *b = (XDeviceButtonEvent *) & event;
+
if (event.type == event_type[i]) {
printf("%s id=%lu (%d @ %d,%d; s=0x%04x, d=%d, t=%lu)"
" axes_count=%d first=%d %d %d %d %d %d %d\n",
names[i],
- (long unsigned)e->deviceid,
+ (long unsigned) e->deviceid,
e->type,
e->x, e->y,
e->device_state,
b->button,
- (long unsigned)b->time,
+ (long unsigned) b->time,
e->axes_count,
e->first_axis,
e->axis_data[0],
e->axis_data[1],
e->axis_data[2],
- e->axis_data[3],
- e->axis_data[4],
- e->axis_data[5]);
+ e->axis_data[3], e->axis_data[4], e->axis_data[5]);
}
}
++total;
#if 0
- /* Used to check motion history for
- * extension devices. */
+ /* Used to check motion history for
+ * extension devices. */
if (!(total % 10)) {
XDeviceTimeCoord *tc;
- int n, m, a;
- struct timeval tv;
- unsigned long ms;
+ int n, m, a;
+ struct timeval tv;
+ unsigned long ms;
+
gettimeofday(&tv, NULL);
ms = tv.tv_sec * 1000 + tv.tv_usec / 1000;
- tc = XGetDeviceMotionEvents(display, dev, ms-1000, ms,
+ tc = XGetDeviceMotionEvents(display, dev, ms - 1000, ms,
&n, &m, &a);
printf("Got %d events of mode %s with %d axes\n",
n, m == Absolute ? "Absolute" : "Relative", a);
@@ -309,7 +346,7 @@ int main(int argc, char **argv)
}
XFreeDeviceMotionEvents(tc);
}
-#endif
+#endif
}
}
diff --git a/xorg-server/hw/dmx/examples/xled.c b/xorg-server/hw/dmx/examples/xled.c
index 270f80511..32e8e3770 100644
--- a/xorg-server/hw/dmx/examples/xled.c
+++ b/xorg-server/hw/dmx/examples/xled.c
@@ -40,23 +40,26 @@
#include <X11/extensions/XKBstr.h>
#include <sys/time.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int mask = 0;
- unsigned i;
- XKeyboardState ks;
- XKeyboardControl kc;
- XkbDescPtr xkb;
- int old[32];
+ Display *display = NULL;
+ int mask = 0;
+ unsigned i;
+ XKeyboardState ks;
+ XKeyboardControl kc;
+ XkbDescPtr xkb;
+ int old[32];
if (argc == 2 || argc == 3) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- if (argc >= 3) mask = strtol(argv[2], NULL, 0);
- } else {
+ if (argc >= 3)
+ mask = strtol(argv[2], NULL, 0);
+ }
+ else {
printf("Usage: %s display [mask]\n", argv[0]);
return -1;
}
@@ -81,14 +84,13 @@ int main(int argc, char **argv)
for (i = 0; i < XkbNumIndicators; i++) {
if (xkb->indicators->phys_indicators & (1 << i)) {
printf("led %d = %d\n", i, xkb->indicators->maps[i].flags);
- old[i] = xkb->indicators->maps[i].flags;
+ old[i] = xkb->indicators->maps[i].flags;
xkb->indicators->maps[i].flags = XkbIM_NoAutomatic;
}
}
printf("XkbSetIndicatorMap = %d\n", XkbSetIndicatorMap(display, ~0, xkb));
XkbFreeKeyboard(xkb, 0, True);
-
if (!(xkb = XkbAllocKeyboard())) {
printf("Cannot allocate\n");
return -1;
@@ -105,7 +107,7 @@ int main(int argc, char **argv)
printf("XGetKeyboardControl = %d\n", XGetKeyboardControl(display, &ks));
printf("old mask = 0x%08lx\n", ks.led_mask);
for (i = 0; i < 5; i++) {
- kc.led = i + 1;
+ kc.led = i + 1;
kc.led_mode = (mask & (1 << i)) ? LedModeOn : LedModeOff;
printf("XChangeKeyboardControl = %d\n",
XChangeKeyboardControl(display, KBLed | KBLedMode, &kc));
diff --git a/xorg-server/hw/dmx/examples/xtest.c b/xorg-server/hw/dmx/examples/xtest.c
index 1e2d1cfff..9ce896a29 100644
--- a/xorg-server/hw/dmx/examples/xtest.c
+++ b/xorg-server/hw/dmx/examples/xtest.c
@@ -36,19 +36,21 @@
#include <X11/Xlib.h>
#include <X11/extensions/XTest.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version;
if (argc == 2) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- } else {
+ }
+ else {
printf("Usage: %s display\n", argv[0]);
return -1;
}
diff --git a/xorg-server/hw/dmx/glxProxy/compsize.c b/xorg-server/hw/dmx/glxProxy/compsize.c
index 5a5d5d0f1..c204d3ded 100644
--- a/xorg-server/hw/dmx/glxProxy/compsize.c
+++ b/xorg-server/hw/dmx/glxProxy/compsize.c
@@ -31,529 +31,611 @@
#include <GL/gl.h>
#include "compsize.h"
-GLint __glFogiv_size(GLenum pname)
+GLint
+__glFogiv_size(GLenum pname)
{
switch (pname) {
- case GL_FOG_COLOR: return 4;
- case GL_FOG_DENSITY: return 1;
- case GL_FOG_END: return 1;
- case GL_FOG_MODE: return 1;
- case GL_FOG_INDEX: return 1;
- case GL_FOG_START: return 1;
- default:
- return 0;
+ case GL_FOG_COLOR:
+ return 4;
+ case GL_FOG_DENSITY:
+ return 1;
+ case GL_FOG_END:
+ return 1;
+ case GL_FOG_MODE:
+ return 1;
+ case GL_FOG_INDEX:
+ return 1;
+ case GL_FOG_START:
+ return 1;
+ default:
+ return 0;
}
}
-GLint __glFogfv_size(GLenum pname)
+GLint
+__glFogfv_size(GLenum pname)
{
return __glFogiv_size(pname);
}
-GLint __glCallLists_size(GLsizei n, GLenum type)
+GLint
+__glCallLists_size(GLsizei n, GLenum type)
{
GLint size;
- if (n < 0) return 0;
+ if (n < 0)
+ return 0;
switch (type) {
- case GL_BYTE: size = 1; break;
- case GL_UNSIGNED_BYTE: size = 1; break;
- case GL_SHORT: size = 2; break;
- case GL_UNSIGNED_SHORT: size = 2; break;
- case GL_INT: size = 4; break;
- case GL_UNSIGNED_INT: size = 4; break;
- case GL_FLOAT: size = 4; break;
- case GL_2_BYTES: size = 2; break;
- case GL_3_BYTES: size = 3; break;
- case GL_4_BYTES: size = 4; break;
- default:
- return 0;
+ case GL_BYTE:
+ size = 1;
+ break;
+ case GL_UNSIGNED_BYTE:
+ size = 1;
+ break;
+ case GL_SHORT:
+ size = 2;
+ break;
+ case GL_UNSIGNED_SHORT:
+ size = 2;
+ break;
+ case GL_INT:
+ size = 4;
+ break;
+ case GL_UNSIGNED_INT:
+ size = 4;
+ break;
+ case GL_FLOAT:
+ size = 4;
+ break;
+ case GL_2_BYTES:
+ size = 2;
+ break;
+ case GL_3_BYTES:
+ size = 3;
+ break;
+ case GL_4_BYTES:
+ size = 4;
+ break;
+ default:
+ return 0;
}
return n * size;
}
-GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
+GLint
+__glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
{
GLint elements, esize;
-
+
switch (format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return 0;
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
}
switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
- return (h * ((w+7)/8));
- } else {
- return 0;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return 0;
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+ return (h * ((w + 7) / 8));
+ }
+ else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
}
return elements * esize * w * h;
}
-GLint __glBitmap_size(GLsizei w, GLsizei h)
+GLint
+__glBitmap_size(GLsizei w, GLsizei h)
{
return __glDrawPixels_size(GL_COLOR_INDEX, GL_BITMAP, w, h);
}
-GLint __glTexGendv_size(GLenum e)
+GLint
+__glTexGendv_size(GLenum e)
{
switch (e) {
- case GL_TEXTURE_GEN_MODE:
- return 1;
- case GL_OBJECT_PLANE:
- case GL_EYE_PLANE:
- return 4;
- default:
- return 0;
+ case GL_TEXTURE_GEN_MODE:
+ return 1;
+ case GL_OBJECT_PLANE:
+ case GL_EYE_PLANE:
+ return 4;
+ default:
+ return 0;
}
}
-GLint __glTexGenfv_size(GLenum e)
+GLint
+__glTexGenfv_size(GLenum e)
{
return __glTexGendv_size(e);
}
-GLint __glTexGeniv_size(GLenum e)
+GLint
+__glTexGeniv_size(GLenum e)
{
return __glTexGendv_size(e);
}
-GLint __glTexParameterfv_size(GLenum e)
+GLint
+__glTexParameterfv_size(GLenum e)
{
switch (e) {
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- return 1;
- case GL_TEXTURE_BORDER_COLOR:
- return 4;
- case GL_TEXTURE_PRIORITY:
- return 1;
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- return 1;
- default:
- return 0;
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_MAG_FILTER:
+ return 1;
+ case GL_TEXTURE_BORDER_COLOR:
+ return 4;
+ case GL_TEXTURE_PRIORITY:
+ return 1;
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ return 1;
+ default:
+ return 0;
}
}
-GLint __glTexParameteriv_size(GLenum e)
+GLint
+__glTexParameteriv_size(GLenum e)
{
return __glTexParameterfv_size(e);
}
-GLint __glTexEnvfv_size(GLenum e)
+GLint
+__glTexEnvfv_size(GLenum e)
{
switch (e) {
- case GL_TEXTURE_ENV_MODE:
- return 1;
- case GL_TEXTURE_ENV_COLOR:
- return 4;
- default:
- return 0;
+ case GL_TEXTURE_ENV_MODE:
+ return 1;
+ case GL_TEXTURE_ENV_COLOR:
+ return 4;
+ default:
+ return 0;
}
}
-GLint __glTexEnviv_size(GLenum e)
+GLint
+__glTexEnviv_size(GLenum e)
{
return __glTexEnvfv_size(e);
}
-GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w)
+GLint
+__glTexImage1D_size(GLenum format, GLenum type, GLsizei w)
{
GLint elements, esize;
- if (w < 0) return 0;
+ if (w < 0)
+ return 0;
switch (format) {
- case GL_COLOR_INDEX:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return 0;
+ case GL_COLOR_INDEX:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
}
switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX) {
- return (w+7)/8;
- } else {
- return 0;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return 0;
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX) {
+ return (w + 7) / 8;
+ }
+ else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
}
return elements * esize * w;
}
-GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
+GLint
+__glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
{
GLint elements, esize;
- if (w < 0) return 0;
- if (h < 0) return 0;
+ if (w < 0)
+ return 0;
+ if (h < 0)
+ return 0;
switch (format) {
- case GL_COLOR_INDEX:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return 0;
+ case GL_COLOR_INDEX:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
}
switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX) {
- return (h * ((w+7)/8));
- } else {
- return 0;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return 0;
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX) {
+ return (h * ((w + 7) / 8));
+ }
+ else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
}
return elements * esize * w * h;
}
-GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h,
- GLsizei d)
+GLint
+__glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, GLsizei d)
{
GLint elements, esize;
- if (w < 0) return 0;
- if (h < 0) return 0;
- if (d < 0) return 0;
+ if (w < 0)
+ return 0;
+ if (h < 0)
+ return 0;
+ if (d < 0)
+ return 0;
switch (format) {
- case GL_COLOR_INDEX:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return 0;
+ case GL_COLOR_INDEX:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
}
switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX) {
- return (d * (h * ((w+7)/8)));
- } else {
- return 0;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return 0;
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX) {
+ return (d * (h * ((w + 7) / 8)));
+ }
+ else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
}
return elements * esize * w * h * d;
}
-GLint __glLightfv_size(GLenum pname)
+GLint
+__glLightfv_size(GLenum pname)
{
switch (pname) {
- case GL_SPOT_EXPONENT: return 1;
- case GL_SPOT_CUTOFF: return 1;
- case GL_AMBIENT: return 4;
- case GL_DIFFUSE: return 4;
- case GL_SPECULAR: return 4;
- case GL_POSITION: return 4;
- case GL_SPOT_DIRECTION: return 3;
- case GL_CONSTANT_ATTENUATION: return 1;
- case GL_LINEAR_ATTENUATION: return 1;
- case GL_QUADRATIC_ATTENUATION: return 1;
- default:
- return 0;
+ case GL_SPOT_EXPONENT:
+ return 1;
+ case GL_SPOT_CUTOFF:
+ return 1;
+ case GL_AMBIENT:
+ return 4;
+ case GL_DIFFUSE:
+ return 4;
+ case GL_SPECULAR:
+ return 4;
+ case GL_POSITION:
+ return 4;
+ case GL_SPOT_DIRECTION:
+ return 3;
+ case GL_CONSTANT_ATTENUATION:
+ return 1;
+ case GL_LINEAR_ATTENUATION:
+ return 1;
+ case GL_QUADRATIC_ATTENUATION:
+ return 1;
+ default:
+ return 0;
}
}
-GLint __glLightiv_size(GLenum pname)
+GLint
+__glLightiv_size(GLenum pname)
{
return __glLightfv_size(pname);
}
-GLint __glLightModelfv_size(GLenum pname)
+GLint
+__glLightModelfv_size(GLenum pname)
{
switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT: return 4;
- case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1;
- case GL_LIGHT_MODEL_TWO_SIDE: return 1;
- case GL_LIGHT_MODEL_COLOR_CONTROL: return 1;
- default:
- return 0;
+ case GL_LIGHT_MODEL_AMBIENT:
+ return 4;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ return 1;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ return 1;
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+ return 1;
+ default:
+ return 0;
}
}
-GLint __glLightModeliv_size(GLenum pname)
+GLint
+__glLightModeliv_size(GLenum pname)
{
return __glLightModelfv_size(pname);
}
-GLint __glMaterialfv_size(GLenum pname)
+GLint
+__glMaterialfv_size(GLenum pname)
{
switch (pname) {
- case GL_SHININESS: return 1;
- case GL_EMISSION: return 4;
- case GL_AMBIENT: return 4;
- case GL_DIFFUSE: return 4;
- case GL_SPECULAR: return 4;
- case GL_AMBIENT_AND_DIFFUSE: return 4;
- case GL_COLOR_INDEXES: return 3;
- default:
- return 0;
+ case GL_SHININESS:
+ return 1;
+ case GL_EMISSION:
+ return 4;
+ case GL_AMBIENT:
+ return 4;
+ case GL_DIFFUSE:
+ return 4;
+ case GL_SPECULAR:
+ return 4;
+ case GL_AMBIENT_AND_DIFFUSE:
+ return 4;
+ case GL_COLOR_INDEXES:
+ return 3;
+ default:
+ return 0;
}
}
-GLint __glMaterialiv_size(GLenum pname)
+GLint
+__glMaterialiv_size(GLenum pname)
{
return __glMaterialfv_size(pname);
}
-GLint __glColorTableParameterfv_size(GLenum pname)
+GLint
+__glColorTableParameterfv_size(GLenum pname)
{
switch (pname) {
- case GL_COLOR_TABLE_FORMAT:
- case GL_COLOR_TABLE_WIDTH:
- case GL_COLOR_TABLE_RED_SIZE:
- case GL_COLOR_TABLE_GREEN_SIZE:
- case GL_COLOR_TABLE_BLUE_SIZE:
- case GL_COLOR_TABLE_ALPHA_SIZE:
- case GL_COLOR_TABLE_LUMINANCE_SIZE:
- case GL_COLOR_TABLE_INTENSITY_SIZE:
- return 1;
- case GL_COLOR_TABLE_SCALE:
- case GL_COLOR_TABLE_BIAS:
- return 4;
- default:
- return -1;
+ case GL_COLOR_TABLE_FORMAT:
+ case GL_COLOR_TABLE_WIDTH:
+ case GL_COLOR_TABLE_RED_SIZE:
+ case GL_COLOR_TABLE_GREEN_SIZE:
+ case GL_COLOR_TABLE_BLUE_SIZE:
+ case GL_COLOR_TABLE_ALPHA_SIZE:
+ case GL_COLOR_TABLE_LUMINANCE_SIZE:
+ case GL_COLOR_TABLE_INTENSITY_SIZE:
+ return 1;
+ case GL_COLOR_TABLE_SCALE:
+ case GL_COLOR_TABLE_BIAS:
+ return 4;
+ default:
+ return -1;
}
}
-GLint __glColorTableParameteriv_size(GLenum pname)
+GLint
+__glColorTableParameteriv_size(GLenum pname)
{
return __glColorTableParameterfv_size(pname);
}
-GLint __glConvolutionParameterfv_size(GLenum pname)
+GLint
+__glConvolutionParameterfv_size(GLenum pname)
{
- switch(pname) {
- case GL_CONVOLUTION_BORDER_MODE:
- return 1;
- case GL_CONVOLUTION_BORDER_COLOR:
- case GL_CONVOLUTION_FILTER_SCALE:
- case GL_CONVOLUTION_FILTER_BIAS:
- return 4;
- default: /* error: bad enum value */
- return -1;
+ switch (pname) {
+ case GL_CONVOLUTION_BORDER_MODE:
+ return 1;
+ case GL_CONVOLUTION_BORDER_COLOR:
+ case GL_CONVOLUTION_FILTER_SCALE:
+ case GL_CONVOLUTION_FILTER_BIAS:
+ return 4;
+ default: /* error: bad enum value */
+ return -1;
}
}
-GLint __glConvolutionParameteriv_size(GLenum pname)
+GLint
+__glConvolutionParameteriv_size(GLenum pname)
{
return __glConvolutionParameterfv_size(pname);
}
diff --git a/xorg-server/hw/dmx/glxProxy/g_disptab.c b/xorg-server/hw/dmx/glxProxy/g_disptab.c
index 3f0a6e77e..46177c4cc 100644
--- a/xorg-server/hw/dmx/glxProxy/g_disptab.c
+++ b/xorg-server/hw/dmx/glxProxy/g_disptab.c
@@ -35,578 +35,576 @@
#include "glxsingle.h"
__GLXdispatchSingleProcPtr __glXSingleTable[] = {
- __glXNoSuchSingleOpcode,
- __glXRender,
- __glXRenderLarge,
- __glXCreateContext,
- __glXDestroyContext,
- __glXMakeCurrent,
- __glXIsDirect,
- __glXQueryVersion,
- __glXWaitGL,
- __glXWaitX,
- __glXCopyContext,
- __glXSwapBuffers,
- __glXUseXFont,
- __glXCreateGLXPixmap,
- __glXGetVisualConfigs,
- __glXDestroyGLXPixmap,
- __glXVendorPrivate,
- __glXVendorPrivateWithReply,
- __glXQueryExtensionsString,
- __glXQueryServerString,
- __glXClientInfo,
- __glXGetFBConfigs, /* __glXGetFBConfigs */
- __glXCreatePixmap, /* __glXCreatePixmap,*/
- __glXDestroyGLXPixmap, /* __glXDestroyPixmap,*/
- __glXCreateNewContext, /* __glXCreateNewContext,*/
- __glXQueryContext, /* __glXQueryContext,*/
- __glXMakeContextCurrent, /* __glXMakeContextCurrent,*/
- __glXCreatePbuffer, /* __glXCreatePbuffer,*/
- __glXDestroyPbuffer, /* __glXDestroyPbuffer,*/
- __glXGetDrawableAttributes, /* __glXGetDrawableAttributes,*/
- __glXChangeDrawableAttributes, /* __glXChangeDrawableAttributes,*/
- __glXCreateWindow, /* __glXCreateWindow,*/
- __glXDestroyWindow, /* __glXDestroyWindow,*/
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXForwardSingleReq, /* __glXDisp_NewList, */
- __glXForwardSingleReq, /* __glXDisp_EndList, */
- __glXForwardSingleReq, /* __glXDisp_DeleteLists, */
- __glXForwardPipe0WithReply, /* __glXDisp_GenLists, */
- __glXForwardSingleReq, /* __glXDisp_FeedbackBuffer, */
- __glXForwardSingleReq, /* __glXDisp_SelectBuffer, */
- __glXForwardAllWithReply, /* __glXDisp_RenderMode, */
- __glXForwardAllWithReply, /* __glXDisp_Finish, */
- __glXForwardSingleReq, /* __glXDisp_PixelStoref, */
- __glXForwardSingleReq, /* __glXDisp_PixelStorei, */
- __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetBooleanv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetClipPlane, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetDoublev, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetError, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetFloatv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetIntegerv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetLightfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetLightiv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMapdv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMapfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMapiv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialiv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapuiv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapusv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetPolygonStipple, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetString, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnvfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnviv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexGendv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexGenfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexGeniv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexImage, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameteriv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameteriv, */
- __glXForwardPipe0WithReply, /* __glXDisp_IsEnabled, */
- __glXForwardPipe0WithReply, /* __glXDisp_IsList, */
- __glXForwardSingleReq, /* __glXDisp_Flush, */
- __glXForwardPipe0WithReply, /* __glXDisp_AreTexturesResident, */
- __glXForwardSingleReq, /* __glXDisp_DeleteTextures, */
- __glXForwardAllWithReply, /* __glXDisp_GenTextures, */
- __glXForwardPipe0WithReply, /* __glXDisp_IsTexture, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetColorTable, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameteriv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionFilter, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameteriv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetSeparableFilter, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetHistogram, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameteriv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMinmax, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameteriv, */
+ __glXNoSuchSingleOpcode,
+ __glXRender,
+ __glXRenderLarge,
+ __glXCreateContext,
+ __glXDestroyContext,
+ __glXMakeCurrent,
+ __glXIsDirect,
+ __glXQueryVersion,
+ __glXWaitGL,
+ __glXWaitX,
+ __glXCopyContext,
+ __glXSwapBuffers,
+ __glXUseXFont,
+ __glXCreateGLXPixmap,
+ __glXGetVisualConfigs,
+ __glXDestroyGLXPixmap,
+ __glXVendorPrivate,
+ __glXVendorPrivateWithReply,
+ __glXQueryExtensionsString,
+ __glXQueryServerString,
+ __glXClientInfo,
+ __glXGetFBConfigs, /* __glXGetFBConfigs */
+ __glXCreatePixmap, /* __glXCreatePixmap, */
+ __glXDestroyGLXPixmap, /* __glXDestroyPixmap, */
+ __glXCreateNewContext, /* __glXCreateNewContext, */
+ __glXQueryContext, /* __glXQueryContext, */
+ __glXMakeContextCurrent, /* __glXMakeContextCurrent, */
+ __glXCreatePbuffer, /* __glXCreatePbuffer, */
+ __glXDestroyPbuffer, /* __glXDestroyPbuffer, */
+ __glXGetDrawableAttributes, /* __glXGetDrawableAttributes, */
+ __glXChangeDrawableAttributes, /* __glXChangeDrawableAttributes, */
+ __glXCreateWindow, /* __glXCreateWindow, */
+ __glXDestroyWindow, /* __glXDestroyWindow, */
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXForwardSingleReq, /* __glXDisp_NewList, */
+ __glXForwardSingleReq, /* __glXDisp_EndList, */
+ __glXForwardSingleReq, /* __glXDisp_DeleteLists, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GenLists, */
+ __glXForwardSingleReq, /* __glXDisp_FeedbackBuffer, */
+ __glXForwardSingleReq, /* __glXDisp_SelectBuffer, */
+ __glXForwardAllWithReply, /* __glXDisp_RenderMode, */
+ __glXForwardAllWithReply, /* __glXDisp_Finish, */
+ __glXForwardSingleReq, /* __glXDisp_PixelStoref, */
+ __glXForwardSingleReq, /* __glXDisp_PixelStorei, */
+ __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetBooleanv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetClipPlane, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetDoublev, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetError, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetFloatv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetIntegerv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetLightfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetLightiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMapdv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMapfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMapiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapuiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapusv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPolygonStipple, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetString, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnvfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnviv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexGendv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexGenfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexGeniv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexImage, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_IsEnabled, */
+ __glXForwardPipe0WithReply, /* __glXDisp_IsList, */
+ __glXForwardSingleReq, /* __glXDisp_Flush, */
+ __glXForwardPipe0WithReply, /* __glXDisp_AreTexturesResident, */
+ __glXForwardSingleReq, /* __glXDisp_DeleteTextures, */
+ __glXForwardAllWithReply, /* __glXDisp_GenTextures, */
+ __glXForwardPipe0WithReply, /* __glXDisp_IsTexture, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetColorTable, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionFilter, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetSeparableFilter, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetHistogram, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMinmax, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameteriv, */
};
__GLXdispatchSingleProcPtr __glXSwapSingleTable[] = {
- __glXNoSuchSingleOpcode,
- __glXSwapRender,
- __glXSwapRenderLarge,
- __glXSwapCreateContext,
- __glXSwapDestroyContext,
- __glXSwapMakeCurrent,
- __glXSwapIsDirect,
- __glXSwapQueryVersion,
- __glXSwapWaitGL,
- __glXSwapWaitX,
- __glXSwapCopyContext,
- __glXSwapSwapBuffers,
- __glXSwapUseXFont,
- __glXSwapCreateGLXPixmap,
- __glXSwapGetVisualConfigs,
- __glXSwapDestroyGLXPixmap,
- __glXSwapVendorPrivate,
- __glXSwapVendorPrivateWithReply,
- __glXSwapQueryExtensionsString,
- __glXSwapQueryServerString,
- __glXSwapClientInfo,
- __glXSwapGetFBConfigs,
- __glXSwapCreatePixmap,
- __glXSwapDestroyGLXPixmap,
- __glXSwapCreateNewContext,
- __glXSwapQueryContext,
- __glXSwapMakeContextCurrent,
- __glXSwapCreatePbuffer,
- __glXSwapDestroyPbuffer,
- __glXSwapGetDrawableAttributes,
- __glXSwapChangeDrawableAttributes,
- __glXSwapCreateWindow,
- __glXSwapDestroyWindow,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXForwardSingleReqSwap, /* __glXDisp_NewList, */
- __glXForwardSingleReqSwap, /* __glXDisp_EndList, */
- __glXForwardSingleReqSwap, /* __glXDisp_DeleteLists, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_GenLists, */
- __glXForwardSingleReqSwap, /* __glXDisp_FeedbackBuffer, */
- __glXForwardSingleReqSwap, /* __glXDisp_SelectBuffer, */
- __glXForwardAllWithReplySwapiv, /* __glXDisp_RenderMode, */
- __glXForwardAllWithReplySwap, /* __glXDisp_Finish, */
- __glXForwardSingleReqSwap, /* __glXDisp_PixelStoref, */
- __glXForwardSingleReqSwap, /* __glXDisp_PixelStorei, */
- __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_GetBooleanv, */
- __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetClipPlane, */
- __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetDoublev, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_GetError, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetFloatv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetIntegerv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightiv, */
- __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetMapdv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapiv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialiv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapuiv, */
- __glXForwardPipe0WithReplySwapsv, /* __glXDisp_GetPixelMapusv, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_GetPolygonStipple, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_GetString, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnvfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnviv, */
- __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetTexGendv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGenfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGeniv, */
- __glXDispSwap_GetTexImage, /* __glXDisp_GetTexImage, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameteriv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameteriv, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_IsEnabled, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_IsList, */
- __glXForwardSingleReqSwap, /* __glXDisp_Flush, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_AreTexturesResident, */
- __glXForwardSingleReqSwap, /* __glXDisp_DeleteTextures, */
- __glXForwardAllWithReplySwapiv, /* __glXDisp_GenTextures, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_IsTexture, */
- __glXDispSwap_GetColorTable, /* __glXDisp_GetColorTable, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameteriv, */
- __glXDispSwap_GetColorTable, /* __glXDisp_GetConvolutionFilter, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameteriv, */
- __glXDispSwap_GetColorTable, /* __glXDisp_GetSeparableFilter, */
- __glXDispSwap_GetColorTable, /* __glXDisp_GetHistogram, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameteriv, */
- __glXDispSwap_GetColorTable, /* __glXDisp_GetMinmax, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameteriv, */
+ __glXNoSuchSingleOpcode,
+ __glXSwapRender,
+ __glXSwapRenderLarge,
+ __glXSwapCreateContext,
+ __glXSwapDestroyContext,
+ __glXSwapMakeCurrent,
+ __glXSwapIsDirect,
+ __glXSwapQueryVersion,
+ __glXSwapWaitGL,
+ __glXSwapWaitX,
+ __glXSwapCopyContext,
+ __glXSwapSwapBuffers,
+ __glXSwapUseXFont,
+ __glXSwapCreateGLXPixmap,
+ __glXSwapGetVisualConfigs,
+ __glXSwapDestroyGLXPixmap,
+ __glXSwapVendorPrivate,
+ __glXSwapVendorPrivateWithReply,
+ __glXSwapQueryExtensionsString,
+ __glXSwapQueryServerString,
+ __glXSwapClientInfo,
+ __glXSwapGetFBConfigs,
+ __glXSwapCreatePixmap,
+ __glXSwapDestroyGLXPixmap,
+ __glXSwapCreateNewContext,
+ __glXSwapQueryContext,
+ __glXSwapMakeContextCurrent,
+ __glXSwapCreatePbuffer,
+ __glXSwapDestroyPbuffer,
+ __glXSwapGetDrawableAttributes,
+ __glXSwapChangeDrawableAttributes,
+ __glXSwapCreateWindow,
+ __glXSwapDestroyWindow,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXForwardSingleReqSwap, /* __glXDisp_NewList, */
+ __glXForwardSingleReqSwap, /* __glXDisp_EndList, */
+ __glXForwardSingleReqSwap, /* __glXDisp_DeleteLists, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GenLists, */
+ __glXForwardSingleReqSwap, /* __glXDisp_FeedbackBuffer, */
+ __glXForwardSingleReqSwap, /* __glXDisp_SelectBuffer, */
+ __glXForwardAllWithReplySwapiv, /* __glXDisp_RenderMode, */
+ __glXForwardAllWithReplySwap, /* __glXDisp_Finish, */
+ __glXForwardSingleReqSwap, /* __glXDisp_PixelStoref, */
+ __glXForwardSingleReqSwap, /* __glXDisp_PixelStorei, */
+ __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetBooleanv, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetClipPlane, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetDoublev, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetError, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetFloatv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetIntegerv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightiv, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetMapdv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapiv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialiv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapuiv, */
+ __glXForwardPipe0WithReplySwapsv, /* __glXDisp_GetPixelMapusv, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetPolygonStipple, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetString, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnvfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnviv, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetTexGendv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGenfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGeniv, */
+ __glXDispSwap_GetTexImage, /* __glXDisp_GetTexImage, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameteriv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameteriv, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_IsEnabled, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_IsList, */
+ __glXForwardSingleReqSwap, /* __glXDisp_Flush, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_AreTexturesResident, */
+ __glXForwardSingleReqSwap, /* __glXDisp_DeleteTextures, */
+ __glXForwardAllWithReplySwapiv, /* __glXDisp_GenTextures, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_IsTexture, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetColorTable, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameteriv, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetConvolutionFilter, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameteriv, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetSeparableFilter, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetHistogram, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameteriv, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetMinmax, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameteriv, */
};
__GLXdispatchRenderProcPtr __glXSwapRenderTable[] = {
- __glXNoSuchRenderOpcode,
- __glXDispSwap_CallList,
- __glXDispSwap_CallLists,
- __glXDispSwap_ListBase,
- __glXDispSwap_Begin,
- __glXDispSwap_Bitmap,
- __glXDispSwap_Color3bv,
- __glXDispSwap_Color3dv,
- __glXDispSwap_Color3fv,
- __glXDispSwap_Color3iv,
- __glXDispSwap_Color3sv,
- __glXDispSwap_Color3ubv,
- __glXDispSwap_Color3uiv,
- __glXDispSwap_Color3usv,
- __glXDispSwap_Color4bv,
- __glXDispSwap_Color4dv,
- __glXDispSwap_Color4fv,
- __glXDispSwap_Color4iv,
- __glXDispSwap_Color4sv,
- __glXDispSwap_Color4ubv,
- __glXDispSwap_Color4uiv,
- __glXDispSwap_Color4usv,
- __glXDispSwap_EdgeFlagv,
- __glXDispSwap_End,
- __glXDispSwap_Indexdv,
- __glXDispSwap_Indexfv,
- __glXDispSwap_Indexiv,
- __glXDispSwap_Indexsv,
- __glXDispSwap_Normal3bv,
- __glXDispSwap_Normal3dv,
- __glXDispSwap_Normal3fv,
- __glXDispSwap_Normal3iv,
- __glXDispSwap_Normal3sv,
- __glXDispSwap_RasterPos2dv,
- __glXDispSwap_RasterPos2fv,
- __glXDispSwap_RasterPos2iv,
- __glXDispSwap_RasterPos2sv,
- __glXDispSwap_RasterPos3dv,
- __glXDispSwap_RasterPos3fv,
- __glXDispSwap_RasterPos3iv,
- __glXDispSwap_RasterPos3sv,
- __glXDispSwap_RasterPos4dv,
- __glXDispSwap_RasterPos4fv,
- __glXDispSwap_RasterPos4iv,
- __glXDispSwap_RasterPos4sv,
- __glXDispSwap_Rectdv,
- __glXDispSwap_Rectfv,
- __glXDispSwap_Rectiv,
- __glXDispSwap_Rectsv,
- __glXDispSwap_TexCoord1dv,
- __glXDispSwap_TexCoord1fv,
- __glXDispSwap_TexCoord1iv,
- __glXDispSwap_TexCoord1sv,
- __glXDispSwap_TexCoord2dv,
- __glXDispSwap_TexCoord2fv,
- __glXDispSwap_TexCoord2iv,
- __glXDispSwap_TexCoord2sv,
- __glXDispSwap_TexCoord3dv,
- __glXDispSwap_TexCoord3fv,
- __glXDispSwap_TexCoord3iv,
- __glXDispSwap_TexCoord3sv,
- __glXDispSwap_TexCoord4dv,
- __glXDispSwap_TexCoord4fv,
- __glXDispSwap_TexCoord4iv,
- __glXDispSwap_TexCoord4sv,
- __glXDispSwap_Vertex2dv,
- __glXDispSwap_Vertex2fv,
- __glXDispSwap_Vertex2iv,
- __glXDispSwap_Vertex2sv,
- __glXDispSwap_Vertex3dv,
- __glXDispSwap_Vertex3fv,
- __glXDispSwap_Vertex3iv,
- __glXDispSwap_Vertex3sv,
- __glXDispSwap_Vertex4dv,
- __glXDispSwap_Vertex4fv,
- __glXDispSwap_Vertex4iv,
- __glXDispSwap_Vertex4sv,
- __glXDispSwap_ClipPlane,
- __glXDispSwap_ColorMaterial,
- __glXDispSwap_CullFace,
- __glXDispSwap_Fogf,
- __glXDispSwap_Fogfv,
- __glXDispSwap_Fogi,
- __glXDispSwap_Fogiv,
- __glXDispSwap_FrontFace,
- __glXDispSwap_Hint,
- __glXDispSwap_Lightf,
- __glXDispSwap_Lightfv,
- __glXDispSwap_Lighti,
- __glXDispSwap_Lightiv,
- __glXDispSwap_LightModelf,
- __glXDispSwap_LightModelfv,
- __glXDispSwap_LightModeli,
- __glXDispSwap_LightModeliv,
- __glXDispSwap_LineStipple,
- __glXDispSwap_LineWidth,
- __glXDispSwap_Materialf,
- __glXDispSwap_Materialfv,
- __glXDispSwap_Materiali,
- __glXDispSwap_Materialiv,
- __glXDispSwap_PointSize,
- __glXDispSwap_PolygonMode,
- __glXDispSwap_PolygonStipple,
- __glXDispSwap_Scissor,
- __glXDispSwap_ShadeModel,
- __glXDispSwap_TexParameterf,
- __glXDispSwap_TexParameterfv,
- __glXDispSwap_TexParameteri,
- __glXDispSwap_TexParameteriv,
- __glXDispSwap_TexImage1D,
- __glXDispSwap_TexImage2D,
- __glXDispSwap_TexEnvf,
- __glXDispSwap_TexEnvfv,
- __glXDispSwap_TexEnvi,
- __glXDispSwap_TexEnviv,
- __glXDispSwap_TexGend,
- __glXDispSwap_TexGendv,
- __glXDispSwap_TexGenf,
- __glXDispSwap_TexGenfv,
- __glXDispSwap_TexGeni,
- __glXDispSwap_TexGeniv,
- __glXDispSwap_InitNames,
- __glXDispSwap_LoadName,
- __glXDispSwap_PassThrough,
- __glXDispSwap_PopName,
- __glXDispSwap_PushName,
- __glXDispSwap_DrawBuffer,
- __glXDispSwap_Clear,
- __glXDispSwap_ClearAccum,
- __glXDispSwap_ClearIndex,
- __glXDispSwap_ClearColor,
- __glXDispSwap_ClearStencil,
- __glXDispSwap_ClearDepth,
- __glXDispSwap_StencilMask,
- __glXDispSwap_ColorMask,
- __glXDispSwap_DepthMask,
- __glXDispSwap_IndexMask,
- __glXDispSwap_Accum,
- __glXDispSwap_Disable,
- __glXDispSwap_Enable,
- __glXNoSuchRenderOpcode,
- __glXDispSwap_PopAttrib,
- __glXDispSwap_PushAttrib,
- __glXDispSwap_Map1d,
- __glXDispSwap_Map1f,
- __glXDispSwap_Map2d,
- __glXDispSwap_Map2f,
- __glXDispSwap_MapGrid1d,
- __glXDispSwap_MapGrid1f,
- __glXDispSwap_MapGrid2d,
- __glXDispSwap_MapGrid2f,
- __glXDispSwap_EvalCoord1dv,
- __glXDispSwap_EvalCoord1fv,
- __glXDispSwap_EvalCoord2dv,
- __glXDispSwap_EvalCoord2fv,
- __glXDispSwap_EvalMesh1,
- __glXDispSwap_EvalPoint1,
- __glXDispSwap_EvalMesh2,
- __glXDispSwap_EvalPoint2,
- __glXDispSwap_AlphaFunc,
- __glXDispSwap_BlendFunc,
- __glXDispSwap_LogicOp,
- __glXDispSwap_StencilFunc,
- __glXDispSwap_StencilOp,
- __glXDispSwap_DepthFunc,
- __glXDispSwap_PixelZoom,
- __glXDispSwap_PixelTransferf,
- __glXDispSwap_PixelTransferi,
- __glXDispSwap_PixelMapfv,
- __glXDispSwap_PixelMapuiv,
- __glXDispSwap_PixelMapusv,
- __glXDispSwap_ReadBuffer,
- __glXDispSwap_CopyPixels,
- __glXDispSwap_DrawPixels,
- __glXDispSwap_DepthRange,
- __glXDispSwap_Frustum,
- __glXDispSwap_LoadIdentity,
- __glXDispSwap_LoadMatrixf,
- __glXDispSwap_LoadMatrixd,
- __glXDispSwap_MatrixMode,
- __glXDispSwap_MultMatrixf,
- __glXDispSwap_MultMatrixd,
- __glXDispSwap_Ortho,
- __glXDispSwap_PopMatrix,
- __glXDispSwap_PushMatrix,
- __glXDispSwap_Rotated,
- __glXDispSwap_Rotatef,
- __glXDispSwap_Scaled,
- __glXDispSwap_Scalef,
- __glXDispSwap_Translated,
- __glXDispSwap_Translatef,
- __glXDispSwap_Viewport,
- __glXDispSwap_PolygonOffset,
- __glXDispSwap_DrawArrays,
- __glXDispSwap_Indexubv,
- __glXDispSwap_ColorSubTable,
- __glXDispSwap_CopyColorSubTable,
- __glXDispSwap_ActiveTextureARB,
- __glXDispSwap_MultiTexCoord1dvARB,
- __glXDispSwap_MultiTexCoord1fvARB,
- __glXDispSwap_MultiTexCoord1ivARB,
- __glXDispSwap_MultiTexCoord1svARB,
- __glXDispSwap_MultiTexCoord2dvARB,
- __glXDispSwap_MultiTexCoord2fvARB,
- __glXDispSwap_MultiTexCoord2ivARB,
- __glXDispSwap_MultiTexCoord2svARB,
- __glXDispSwap_MultiTexCoord3dvARB,
- __glXDispSwap_MultiTexCoord3fvARB,
- __glXDispSwap_MultiTexCoord3ivARB,
- __glXDispSwap_MultiTexCoord3svARB,
- __glXDispSwap_MultiTexCoord4dvARB,
- __glXDispSwap_MultiTexCoord4fvARB,
- __glXDispSwap_MultiTexCoord4ivARB,
- __glXDispSwap_MultiTexCoord4svARB,
+ __glXNoSuchRenderOpcode,
+ __glXDispSwap_CallList,
+ __glXDispSwap_CallLists,
+ __glXDispSwap_ListBase,
+ __glXDispSwap_Begin,
+ __glXDispSwap_Bitmap,
+ __glXDispSwap_Color3bv,
+ __glXDispSwap_Color3dv,
+ __glXDispSwap_Color3fv,
+ __glXDispSwap_Color3iv,
+ __glXDispSwap_Color3sv,
+ __glXDispSwap_Color3ubv,
+ __glXDispSwap_Color3uiv,
+ __glXDispSwap_Color3usv,
+ __glXDispSwap_Color4bv,
+ __glXDispSwap_Color4dv,
+ __glXDispSwap_Color4fv,
+ __glXDispSwap_Color4iv,
+ __glXDispSwap_Color4sv,
+ __glXDispSwap_Color4ubv,
+ __glXDispSwap_Color4uiv,
+ __glXDispSwap_Color4usv,
+ __glXDispSwap_EdgeFlagv,
+ __glXDispSwap_End,
+ __glXDispSwap_Indexdv,
+ __glXDispSwap_Indexfv,
+ __glXDispSwap_Indexiv,
+ __glXDispSwap_Indexsv,
+ __glXDispSwap_Normal3bv,
+ __glXDispSwap_Normal3dv,
+ __glXDispSwap_Normal3fv,
+ __glXDispSwap_Normal3iv,
+ __glXDispSwap_Normal3sv,
+ __glXDispSwap_RasterPos2dv,
+ __glXDispSwap_RasterPos2fv,
+ __glXDispSwap_RasterPos2iv,
+ __glXDispSwap_RasterPos2sv,
+ __glXDispSwap_RasterPos3dv,
+ __glXDispSwap_RasterPos3fv,
+ __glXDispSwap_RasterPos3iv,
+ __glXDispSwap_RasterPos3sv,
+ __glXDispSwap_RasterPos4dv,
+ __glXDispSwap_RasterPos4fv,
+ __glXDispSwap_RasterPos4iv,
+ __glXDispSwap_RasterPos4sv,
+ __glXDispSwap_Rectdv,
+ __glXDispSwap_Rectfv,
+ __glXDispSwap_Rectiv,
+ __glXDispSwap_Rectsv,
+ __glXDispSwap_TexCoord1dv,
+ __glXDispSwap_TexCoord1fv,
+ __glXDispSwap_TexCoord1iv,
+ __glXDispSwap_TexCoord1sv,
+ __glXDispSwap_TexCoord2dv,
+ __glXDispSwap_TexCoord2fv,
+ __glXDispSwap_TexCoord2iv,
+ __glXDispSwap_TexCoord2sv,
+ __glXDispSwap_TexCoord3dv,
+ __glXDispSwap_TexCoord3fv,
+ __glXDispSwap_TexCoord3iv,
+ __glXDispSwap_TexCoord3sv,
+ __glXDispSwap_TexCoord4dv,
+ __glXDispSwap_TexCoord4fv,
+ __glXDispSwap_TexCoord4iv,
+ __glXDispSwap_TexCoord4sv,
+ __glXDispSwap_Vertex2dv,
+ __glXDispSwap_Vertex2fv,
+ __glXDispSwap_Vertex2iv,
+ __glXDispSwap_Vertex2sv,
+ __glXDispSwap_Vertex3dv,
+ __glXDispSwap_Vertex3fv,
+ __glXDispSwap_Vertex3iv,
+ __glXDispSwap_Vertex3sv,
+ __glXDispSwap_Vertex4dv,
+ __glXDispSwap_Vertex4fv,
+ __glXDispSwap_Vertex4iv,
+ __glXDispSwap_Vertex4sv,
+ __glXDispSwap_ClipPlane,
+ __glXDispSwap_ColorMaterial,
+ __glXDispSwap_CullFace,
+ __glXDispSwap_Fogf,
+ __glXDispSwap_Fogfv,
+ __glXDispSwap_Fogi,
+ __glXDispSwap_Fogiv,
+ __glXDispSwap_FrontFace,
+ __glXDispSwap_Hint,
+ __glXDispSwap_Lightf,
+ __glXDispSwap_Lightfv,
+ __glXDispSwap_Lighti,
+ __glXDispSwap_Lightiv,
+ __glXDispSwap_LightModelf,
+ __glXDispSwap_LightModelfv,
+ __glXDispSwap_LightModeli,
+ __glXDispSwap_LightModeliv,
+ __glXDispSwap_LineStipple,
+ __glXDispSwap_LineWidth,
+ __glXDispSwap_Materialf,
+ __glXDispSwap_Materialfv,
+ __glXDispSwap_Materiali,
+ __glXDispSwap_Materialiv,
+ __glXDispSwap_PointSize,
+ __glXDispSwap_PolygonMode,
+ __glXDispSwap_PolygonStipple,
+ __glXDispSwap_Scissor,
+ __glXDispSwap_ShadeModel,
+ __glXDispSwap_TexParameterf,
+ __glXDispSwap_TexParameterfv,
+ __glXDispSwap_TexParameteri,
+ __glXDispSwap_TexParameteriv,
+ __glXDispSwap_TexImage1D,
+ __glXDispSwap_TexImage2D,
+ __glXDispSwap_TexEnvf,
+ __glXDispSwap_TexEnvfv,
+ __glXDispSwap_TexEnvi,
+ __glXDispSwap_TexEnviv,
+ __glXDispSwap_TexGend,
+ __glXDispSwap_TexGendv,
+ __glXDispSwap_TexGenf,
+ __glXDispSwap_TexGenfv,
+ __glXDispSwap_TexGeni,
+ __glXDispSwap_TexGeniv,
+ __glXDispSwap_InitNames,
+ __glXDispSwap_LoadName,
+ __glXDispSwap_PassThrough,
+ __glXDispSwap_PopName,
+ __glXDispSwap_PushName,
+ __glXDispSwap_DrawBuffer,
+ __glXDispSwap_Clear,
+ __glXDispSwap_ClearAccum,
+ __glXDispSwap_ClearIndex,
+ __glXDispSwap_ClearColor,
+ __glXDispSwap_ClearStencil,
+ __glXDispSwap_ClearDepth,
+ __glXDispSwap_StencilMask,
+ __glXDispSwap_ColorMask,
+ __glXDispSwap_DepthMask,
+ __glXDispSwap_IndexMask,
+ __glXDispSwap_Accum,
+ __glXDispSwap_Disable,
+ __glXDispSwap_Enable,
+ __glXNoSuchRenderOpcode,
+ __glXDispSwap_PopAttrib,
+ __glXDispSwap_PushAttrib,
+ __glXDispSwap_Map1d,
+ __glXDispSwap_Map1f,
+ __glXDispSwap_Map2d,
+ __glXDispSwap_Map2f,
+ __glXDispSwap_MapGrid1d,
+ __glXDispSwap_MapGrid1f,
+ __glXDispSwap_MapGrid2d,
+ __glXDispSwap_MapGrid2f,
+ __glXDispSwap_EvalCoord1dv,
+ __glXDispSwap_EvalCoord1fv,
+ __glXDispSwap_EvalCoord2dv,
+ __glXDispSwap_EvalCoord2fv,
+ __glXDispSwap_EvalMesh1,
+ __glXDispSwap_EvalPoint1,
+ __glXDispSwap_EvalMesh2,
+ __glXDispSwap_EvalPoint2,
+ __glXDispSwap_AlphaFunc,
+ __glXDispSwap_BlendFunc,
+ __glXDispSwap_LogicOp,
+ __glXDispSwap_StencilFunc,
+ __glXDispSwap_StencilOp,
+ __glXDispSwap_DepthFunc,
+ __glXDispSwap_PixelZoom,
+ __glXDispSwap_PixelTransferf,
+ __glXDispSwap_PixelTransferi,
+ __glXDispSwap_PixelMapfv,
+ __glXDispSwap_PixelMapuiv,
+ __glXDispSwap_PixelMapusv,
+ __glXDispSwap_ReadBuffer,
+ __glXDispSwap_CopyPixels,
+ __glXDispSwap_DrawPixels,
+ __glXDispSwap_DepthRange,
+ __glXDispSwap_Frustum,
+ __glXDispSwap_LoadIdentity,
+ __glXDispSwap_LoadMatrixf,
+ __glXDispSwap_LoadMatrixd,
+ __glXDispSwap_MatrixMode,
+ __glXDispSwap_MultMatrixf,
+ __glXDispSwap_MultMatrixd,
+ __glXDispSwap_Ortho,
+ __glXDispSwap_PopMatrix,
+ __glXDispSwap_PushMatrix,
+ __glXDispSwap_Rotated,
+ __glXDispSwap_Rotatef,
+ __glXDispSwap_Scaled,
+ __glXDispSwap_Scalef,
+ __glXDispSwap_Translated,
+ __glXDispSwap_Translatef,
+ __glXDispSwap_Viewport,
+ __glXDispSwap_PolygonOffset,
+ __glXDispSwap_DrawArrays,
+ __glXDispSwap_Indexubv,
+ __glXDispSwap_ColorSubTable,
+ __glXDispSwap_CopyColorSubTable,
+ __glXDispSwap_ActiveTextureARB,
+ __glXDispSwap_MultiTexCoord1dvARB,
+ __glXDispSwap_MultiTexCoord1fvARB,
+ __glXDispSwap_MultiTexCoord1ivARB,
+ __glXDispSwap_MultiTexCoord1svARB,
+ __glXDispSwap_MultiTexCoord2dvARB,
+ __glXDispSwap_MultiTexCoord2fvARB,
+ __glXDispSwap_MultiTexCoord2ivARB,
+ __glXDispSwap_MultiTexCoord2svARB,
+ __glXDispSwap_MultiTexCoord3dvARB,
+ __glXDispSwap_MultiTexCoord3fvARB,
+ __glXDispSwap_MultiTexCoord3ivARB,
+ __glXDispSwap_MultiTexCoord3svARB,
+ __glXDispSwap_MultiTexCoord4dvARB,
+ __glXDispSwap_MultiTexCoord4fvARB,
+ __glXDispSwap_MultiTexCoord4ivARB,
+ __glXDispSwap_MultiTexCoord4svARB,
};
-__GLXRenderSwapInfo __glXSwapRenderTable_EXT[] =
-{
- {4, 4, NULL}, /* X_GLrop_BlendColorEXT */
- {4, 1, NULL}, /* X_GLrop_BlendEquationEXT */
- {4, 2, NULL}, /* X_GLrop_PolygonOffsetEXT */
- {4, 0, __glXDispSwap_TexSubImage1D}, /* X_GLrop_TexSubImage1DEXT */
- {4, 0, __glXDispSwap_TexSubImage2D}, /* X_GLrop_TexSubImage2DEXT */
- {4, 0, __glXDispSwap_ConvolutionFilter1D}, /* X_GLrop_ConvolutionFilter1DEXT */
- {4, 0, __glXDispSwap_ConvolutionFilter2D}, /* X_GLrop_ConvolutionFilter2DEXT */
- {4, 3, NULL}, /* X_GLrop_ConvolutionParameterfEXT */
- {4, 0, __glXDispSwap_ConvolutionParameterfv}, /* X_GLrop_ConvolutionParameterfvEXT */
- {4, 3, NULL}, /* X_GLrop_ConvolutionParameteriEXT */
- {4, 0, __glXDispSwap_ConvolutionParameteriv}, /* X_GLrop_ConvolutionParameterivEXT */
- {4, 0, __glXDispSwap_CopyConvolutionFilter1D}, /* X_GLrop_CopyConvolutionFilter1DEXT */
- {4, 0, __glXDispSwap_CopyConvolutionFilter2D}, /* X_GLrop_CopyConvolutionFilter2DEXT */
- {4, 0, __glXDispSwap_SeparableFilter2D}, /* X_GLrop_SeparableFilter2DEXT */
- {4, 3, NULL}, /* X_GLrop_HistogramEXT */
- {4, 2, NULL}, /* X_GLrop_MinmaxEXT */
- {4, 1, NULL}, /* X_GLrop_ResetHistogramEXT */
- {4, 1, NULL}, /* X_GLrop_ResetMinmaxEXT */
- {4, 0, __glXDispSwap_TexImage3D}, /* X_GLrop_TexImage3DEXT */
- {4, 0, __glXDispSwap_TexSubImage3D}, /* X_GLrop_TexSubImage3DEXT */
- {4, 0, __glXDispSwap_DrawArrays}, /* X_GLrop_DrawArraysEXT */
- {4, 2, NULL}, /* X_GLrop_BindTextureEXT */
- {4, 0, __glXDispSwap_PrioritizeTextures}, /* X_GLrop_PrioritizeTexturesEXT */
- {4, 0, __glXDispSwap_CopyTexImage1D}, /* X_GLrop_CopyTexImage1DEXT */
- {4, 0, __glXDispSwap_CopyTexImage2D}, /* X_GLrop_CopyTexImage2DEXT */
- {4, 0, __glXDispSwap_CopyTexSubImage1D}, /* X_GLrop_CopyTexSubImage1DEXT */
- {4, 0, __glXDispSwap_CopyTexSubImage2D}, /* X_GLrop_CopyTexSubImage2DEXT */
- {4, 0, __glXDispSwap_CopyTexSubImage3D}, /* X_GLrop_CopyTexSubImage3DEXT */
+__GLXRenderSwapInfo __glXSwapRenderTable_EXT[] = {
+ {4, 4, NULL}, /* X_GLrop_BlendColorEXT */
+ {4, 1, NULL}, /* X_GLrop_BlendEquationEXT */
+ {4, 2, NULL}, /* X_GLrop_PolygonOffsetEXT */
+ {4, 0, __glXDispSwap_TexSubImage1D}, /* X_GLrop_TexSubImage1DEXT */
+ {4, 0, __glXDispSwap_TexSubImage2D}, /* X_GLrop_TexSubImage2DEXT */
+ {4, 0, __glXDispSwap_ConvolutionFilter1D}, /* X_GLrop_ConvolutionFilter1DEXT */
+ {4, 0, __glXDispSwap_ConvolutionFilter2D}, /* X_GLrop_ConvolutionFilter2DEXT */
+ {4, 3, NULL}, /* X_GLrop_ConvolutionParameterfEXT */
+ {4, 0, __glXDispSwap_ConvolutionParameterfv}, /* X_GLrop_ConvolutionParameterfvEXT */
+ {4, 3, NULL}, /* X_GLrop_ConvolutionParameteriEXT */
+ {4, 0, __glXDispSwap_ConvolutionParameteriv}, /* X_GLrop_ConvolutionParameterivEXT */
+ {4, 0, __glXDispSwap_CopyConvolutionFilter1D}, /* X_GLrop_CopyConvolutionFilter1DEXT */
+ {4, 0, __glXDispSwap_CopyConvolutionFilter2D}, /* X_GLrop_CopyConvolutionFilter2DEXT */
+ {4, 0, __glXDispSwap_SeparableFilter2D}, /* X_GLrop_SeparableFilter2DEXT */
+ {4, 3, NULL}, /* X_GLrop_HistogramEXT */
+ {4, 2, NULL}, /* X_GLrop_MinmaxEXT */
+ {4, 1, NULL}, /* X_GLrop_ResetHistogramEXT */
+ {4, 1, NULL}, /* X_GLrop_ResetMinmaxEXT */
+ {4, 0, __glXDispSwap_TexImage3D}, /* X_GLrop_TexImage3DEXT */
+ {4, 0, __glXDispSwap_TexSubImage3D}, /* X_GLrop_TexSubImage3DEXT */
+ {4, 0, __glXDispSwap_DrawArrays}, /* X_GLrop_DrawArraysEXT */
+ {4, 2, NULL}, /* X_GLrop_BindTextureEXT */
+ {4, 0, __glXDispSwap_PrioritizeTextures}, /* X_GLrop_PrioritizeTexturesEXT */
+ {4, 0, __glXDispSwap_CopyTexImage1D}, /* X_GLrop_CopyTexImage1DEXT */
+ {4, 0, __glXDispSwap_CopyTexImage2D}, /* X_GLrop_CopyTexImage2DEXT */
+ {4, 0, __glXDispSwap_CopyTexSubImage1D}, /* X_GLrop_CopyTexSubImage1DEXT */
+ {4, 0, __glXDispSwap_CopyTexSubImage2D}, /* X_GLrop_CopyTexSubImage2DEXT */
+ {4, 0, __glXDispSwap_CopyTexSubImage3D}, /* X_GLrop_CopyTexSubImage3DEXT */
};
-
diff --git a/xorg-server/hw/dmx/glxProxy/g_disptab.h b/xorg-server/hw/dmx/glxProxy/g_disptab.h
index c497c88e5..530338798 100644
--- a/xorg-server/hw/dmx/glxProxy/g_disptab.h
+++ b/xorg-server/hw/dmx/glxProxy/g_disptab.h
@@ -31,633 +31,637 @@
* Silicon Graphics, Inc.
*/
-extern int __glXRender(__GLXclientState*, GLbyte*);
-extern int __glXRenderLarge(__GLXclientState*, GLbyte*);
-extern int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag);
-extern int __glXCreateContext(__GLXclientState*, GLbyte*);
-extern int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDestroyContext(__GLXclientState*, GLbyte*);
-extern int __glXMakeCurrent(__GLXclientState*, GLbyte*);
-extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*);
-extern int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc);
-extern int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
-extern int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
-extern int __glXIsDirect(__GLXclientState*, GLbyte*);
-extern int __glXQueryVersion(__GLXclientState*, GLbyte*);
-extern int __glXWaitGL(__GLXclientState*, GLbyte*);
-extern int __glXWaitX(__GLXclientState*, GLbyte*);
-extern int __glXCopyContext(__GLXclientState*, GLbyte*);
-extern int __glXSwapBuffers(__GLXclientState*, GLbyte*);
-extern int __glXUseXFont(__GLXclientState*, GLbyte*);
-extern int __glXCreateGLXPixmap(__GLXclientState*, GLbyte*);
-extern int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc);
-extern int __glXGetVisualConfigs(__GLXclientState*, GLbyte*);
-extern int __glXDestroyGLXPixmap(__GLXclientState*, GLbyte*);
-extern int __glXVendorPrivate(__GLXclientState*, GLbyte*);
-extern int __glXVendorPrivateWithReply(__GLXclientState*, GLbyte*);
-extern int __glXQueryExtensionsString(__GLXclientState*, GLbyte*);
-extern int __glXQueryServerString(__GLXclientState*, GLbyte*);
-extern int __glXClientInfo(__GLXclientState*, GLbyte*);
-extern int __glXGetFBConfigs(__GLXclientState*, GLbyte*);
-extern int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc);
-extern int __glXQueryContext(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDisp_NewList(__GLXclientState*, GLbyte*);
-extern int __glXDisp_EndList(__GLXclientState*, GLbyte*);
-extern int __glXDisp_DeleteLists(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GenLists(__GLXclientState*, GLbyte*);
-extern int __glXDisp_FeedbackBuffer(__GLXclientState*, GLbyte*);
-extern int __glXDisp_SelectBuffer(__GLXclientState*, GLbyte*);
-extern int __glXDisp_RenderMode(__GLXclientState*, GLbyte*);
-extern int __glXDisp_Finish(__GLXclientState*, GLbyte*);
-extern int __glXDisp_PixelStoref(__GLXclientState*, GLbyte*);
-extern int __glXDisp_PixelStorei(__GLXclientState*, GLbyte*);
-extern int __glXDisp_ReadPixels(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetBooleanv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetClipPlane(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetDoublev(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetError(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetFloatv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetIntegerv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetLightfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetLightiv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMapdv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMapfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMapiv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMaterialfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMaterialiv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetPixelMapfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetPixelMapuiv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetPixelMapusv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetPolygonStipple(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetString(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexEnvfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexEnviv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexGendv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexGenfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexGeniv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexImage(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexLevelParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_IsEnabled(__GLXclientState*, GLbyte*);
-extern int __glXDisp_IsList(__GLXclientState*, GLbyte*);
-extern int __glXDisp_Flush(__GLXclientState*, GLbyte*);
-extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*);
-extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*);
-extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetColorTable(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetColorTableParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetColorTableParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetConvolutionFilter(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetSeparableFilter(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetHistogram(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetHistogramParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetHistogramParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMinmax(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXRender(__GLXclientState *, GLbyte *);
+extern int __glXRenderLarge(__GLXclientState *, GLbyte *);
+extern int __glXSendLargeCommand(__GLXclientState * cl,
+ GLXContextTag contextTag);
+extern int __glXCreateContext(__GLXclientState *, GLbyte *);
+extern int __glXCreateNewContext(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDestroyContext(__GLXclientState *, GLbyte *);
+extern int __glXMakeCurrent(__GLXclientState *, GLbyte *);
+extern int __glXMakeContextCurrent(__GLXclientState *, GLbyte *);
+extern int __glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDestroyPbuffer(__GLXclientState * cl, GLbyte * pc);
+extern int __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc);
+extern int __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc);
+extern int __glXIsDirect(__GLXclientState *, GLbyte *);
+extern int __glXQueryVersion(__GLXclientState *, GLbyte *);
+extern int __glXWaitGL(__GLXclientState *, GLbyte *);
+extern int __glXWaitX(__GLXclientState *, GLbyte *);
+extern int __glXCopyContext(__GLXclientState *, GLbyte *);
+extern int __glXSwapBuffers(__GLXclientState *, GLbyte *);
+extern int __glXUseXFont(__GLXclientState *, GLbyte *);
+extern int __glXCreateGLXPixmap(__GLXclientState *, GLbyte *);
+extern int __glXCreatePixmap(__GLXclientState * cl, GLbyte * pc);
+extern int __glXGetVisualConfigs(__GLXclientState *, GLbyte *);
+extern int __glXDestroyGLXPixmap(__GLXclientState *, GLbyte *);
+extern int __glXVendorPrivate(__GLXclientState *, GLbyte *);
+extern int __glXVendorPrivateWithReply(__GLXclientState *, GLbyte *);
+extern int __glXQueryExtensionsString(__GLXclientState *, GLbyte *);
+extern int __glXQueryServerString(__GLXclientState *, GLbyte *);
+extern int __glXClientInfo(__GLXclientState *, GLbyte *);
+extern int __glXGetFBConfigs(__GLXclientState *, GLbyte *);
+extern int __glXCreateWindow(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDestroyWindow(__GLXclientState * cl, GLbyte * pc);
+extern int __glXQueryContext(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDisp_NewList(__GLXclientState *, GLbyte *);
+extern int __glXDisp_EndList(__GLXclientState *, GLbyte *);
+extern int __glXDisp_DeleteLists(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GenLists(__GLXclientState *, GLbyte *);
+extern int __glXDisp_FeedbackBuffer(__GLXclientState *, GLbyte *);
+extern int __glXDisp_SelectBuffer(__GLXclientState *, GLbyte *);
+extern int __glXDisp_RenderMode(__GLXclientState *, GLbyte *);
+extern int __glXDisp_Finish(__GLXclientState *, GLbyte *);
+extern int __glXDisp_PixelStoref(__GLXclientState *, GLbyte *);
+extern int __glXDisp_PixelStorei(__GLXclientState *, GLbyte *);
+extern int __glXDisp_ReadPixels(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetBooleanv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetClipPlane(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetDoublev(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetError(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetFloatv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetIntegerv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetLightfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetLightiv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMapdv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMapfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMapiv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMaterialfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMaterialiv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetPixelMapfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetPixelMapuiv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetPixelMapusv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetPolygonStipple(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetString(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexEnvfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexEnviv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexGendv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexGenfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexGeniv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexImage(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexLevelParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_IsEnabled(__GLXclientState *, GLbyte *);
+extern int __glXDisp_IsList(__GLXclientState *, GLbyte *);
+extern int __glXDisp_Flush(__GLXclientState *, GLbyte *);
+extern int __glXDisp_AreTexturesResident(__GLXclientState *, GLbyte *);
+extern int __glXDisp_DeleteTextures(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GenTextures(__GLXclientState *, GLbyte *);
+extern int __glXDisp_IsTexture(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetColorTable(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetColorTableParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetColorTableParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetConvolutionFilter(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetSeparableFilter(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetHistogram(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetHistogramParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetHistogramParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMinmax(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState *, GLbyte *);
-extern void __glXDisp_CallList(GLbyte*);
-extern void __glXDisp_CallLists(GLbyte*);
-extern void __glXDisp_ListBase(GLbyte*);
-extern void __glXDisp_Begin(GLbyte*);
-extern void __glXDisp_Bitmap(GLbyte*);
-extern void __glXDisp_Color3bv(GLbyte*);
-extern void __glXDisp_Color3dv(GLbyte*);
-extern void __glXDisp_Color3fv(GLbyte*);
-extern void __glXDisp_Color3iv(GLbyte*);
-extern void __glXDisp_Color3sv(GLbyte*);
-extern void __glXDisp_Color3ubv(GLbyte*);
-extern void __glXDisp_Color3uiv(GLbyte*);
-extern void __glXDisp_Color3usv(GLbyte*);
-extern void __glXDisp_Color4bv(GLbyte*);
-extern void __glXDisp_Color4dv(GLbyte*);
-extern void __glXDisp_Color4fv(GLbyte*);
-extern void __glXDisp_Color4iv(GLbyte*);
-extern void __glXDisp_Color4sv(GLbyte*);
-extern void __glXDisp_Color4ubv(GLbyte*);
-extern void __glXDisp_Color4uiv(GLbyte*);
-extern void __glXDisp_Color4usv(GLbyte*);
-extern void __glXDisp_EdgeFlagv(GLbyte*);
-extern void __glXDisp_End(GLbyte*);
-extern void __glXDisp_Indexdv(GLbyte*);
-extern void __glXDisp_Indexfv(GLbyte*);
-extern void __glXDisp_Indexiv(GLbyte*);
-extern void __glXDisp_Indexsv(GLbyte*);
-extern void __glXDisp_Normal3bv(GLbyte*);
-extern void __glXDisp_Normal3dv(GLbyte*);
-extern void __glXDisp_Normal3fv(GLbyte*);
-extern void __glXDisp_Normal3iv(GLbyte*);
-extern void __glXDisp_Normal3sv(GLbyte*);
-extern void __glXDisp_RasterPos2dv(GLbyte*);
-extern void __glXDisp_RasterPos2fv(GLbyte*);
-extern void __glXDisp_RasterPos2iv(GLbyte*);
-extern void __glXDisp_RasterPos2sv(GLbyte*);
-extern void __glXDisp_RasterPos3dv(GLbyte*);
-extern void __glXDisp_RasterPos3fv(GLbyte*);
-extern void __glXDisp_RasterPos3iv(GLbyte*);
-extern void __glXDisp_RasterPos3sv(GLbyte*);
-extern void __glXDisp_RasterPos4dv(GLbyte*);
-extern void __glXDisp_RasterPos4fv(GLbyte*);
-extern void __glXDisp_RasterPos4iv(GLbyte*);
-extern void __glXDisp_RasterPos4sv(GLbyte*);
-extern void __glXDisp_Rectdv(GLbyte*);
-extern void __glXDisp_Rectfv(GLbyte*);
-extern void __glXDisp_Rectiv(GLbyte*);
-extern void __glXDisp_Rectsv(GLbyte*);
-extern void __glXDisp_TexCoord1dv(GLbyte*);
-extern void __glXDisp_TexCoord1fv(GLbyte*);
-extern void __glXDisp_TexCoord1iv(GLbyte*);
-extern void __glXDisp_TexCoord1sv(GLbyte*);
-extern void __glXDisp_TexCoord2dv(GLbyte*);
-extern void __glXDisp_TexCoord2fv(GLbyte*);
-extern void __glXDisp_TexCoord2iv(GLbyte*);
-extern void __glXDisp_TexCoord2sv(GLbyte*);
-extern void __glXDisp_TexCoord3dv(GLbyte*);
-extern void __glXDisp_TexCoord3fv(GLbyte*);
-extern void __glXDisp_TexCoord3iv(GLbyte*);
-extern void __glXDisp_TexCoord3sv(GLbyte*);
-extern void __glXDisp_TexCoord4dv(GLbyte*);
-extern void __glXDisp_TexCoord4fv(GLbyte*);
-extern void __glXDisp_TexCoord4iv(GLbyte*);
-extern void __glXDisp_TexCoord4sv(GLbyte*);
-extern void __glXDisp_Vertex2dv(GLbyte*);
-extern void __glXDisp_Vertex2fv(GLbyte*);
-extern void __glXDisp_Vertex2iv(GLbyte*);
-extern void __glXDisp_Vertex2sv(GLbyte*);
-extern void __glXDisp_Vertex3dv(GLbyte*);
-extern void __glXDisp_Vertex3fv(GLbyte*);
-extern void __glXDisp_Vertex3iv(GLbyte*);
-extern void __glXDisp_Vertex3sv(GLbyte*);
-extern void __glXDisp_Vertex4dv(GLbyte*);
-extern void __glXDisp_Vertex4fv(GLbyte*);
-extern void __glXDisp_Vertex4iv(GLbyte*);
-extern void __glXDisp_Vertex4sv(GLbyte*);
-extern void __glXDisp_ClipPlane(GLbyte*);
-extern void __glXDisp_ColorMaterial(GLbyte*);
-extern void __glXDisp_CullFace(GLbyte*);
-extern void __glXDisp_Fogf(GLbyte*);
-extern void __glXDisp_Fogfv(GLbyte*);
-extern void __glXDisp_Fogi(GLbyte*);
-extern void __glXDisp_Fogiv(GLbyte*);
-extern void __glXDisp_FrontFace(GLbyte*);
-extern void __glXDisp_Hint(GLbyte*);
-extern void __glXDisp_Lightf(GLbyte*);
-extern void __glXDisp_Lightfv(GLbyte*);
-extern void __glXDisp_Lighti(GLbyte*);
-extern void __glXDisp_Lightiv(GLbyte*);
-extern void __glXDisp_LightModelf(GLbyte*);
-extern void __glXDisp_LightModelfv(GLbyte*);
-extern void __glXDisp_LightModeli(GLbyte*);
-extern void __glXDisp_LightModeliv(GLbyte*);
-extern void __glXDisp_LineStipple(GLbyte*);
-extern void __glXDisp_LineWidth(GLbyte*);
-extern void __glXDisp_Materialf(GLbyte*);
-extern void __glXDisp_Materialfv(GLbyte*);
-extern void __glXDisp_Materiali(GLbyte*);
-extern void __glXDisp_Materialiv(GLbyte*);
-extern void __glXDisp_PointSize(GLbyte*);
-extern void __glXDisp_PolygonMode(GLbyte*);
-extern void __glXDisp_PolygonStipple(GLbyte*);
-extern void __glXDisp_Scissor(GLbyte*);
-extern void __glXDisp_ShadeModel(GLbyte*);
-extern void __glXDisp_TexParameterf(GLbyte*);
-extern void __glXDisp_TexParameterfv(GLbyte*);
-extern void __glXDisp_TexParameteri(GLbyte*);
-extern void __glXDisp_TexParameteriv(GLbyte*);
-extern void __glXDisp_TexImage1D(GLbyte*);
-extern void __glXDisp_TexImage2D(GLbyte*);
-extern void __glXDisp_TexEnvf(GLbyte*);
-extern void __glXDisp_TexEnvfv(GLbyte*);
-extern void __glXDisp_TexEnvi(GLbyte*);
-extern void __glXDisp_TexEnviv(GLbyte*);
-extern void __glXDisp_TexGend(GLbyte*);
-extern void __glXDisp_TexGendv(GLbyte*);
-extern void __glXDisp_TexGenf(GLbyte*);
-extern void __glXDisp_TexGenfv(GLbyte*);
-extern void __glXDisp_TexGeni(GLbyte*);
-extern void __glXDisp_TexGeniv(GLbyte*);
-extern void __glXDisp_InitNames(GLbyte*);
-extern void __glXDisp_LoadName(GLbyte*);
-extern void __glXDisp_PassThrough(GLbyte*);
-extern void __glXDisp_PopName(GLbyte*);
-extern void __glXDisp_PushName(GLbyte*);
-extern void __glXDisp_DrawBuffer(GLbyte*);
-extern void __glXDisp_Clear(GLbyte*);
-extern void __glXDisp_ClearAccum(GLbyte*);
-extern void __glXDisp_ClearIndex(GLbyte*);
-extern void __glXDisp_ClearColor(GLbyte*);
-extern void __glXDisp_ClearStencil(GLbyte*);
-extern void __glXDisp_ClearDepth(GLbyte*);
-extern void __glXDisp_StencilMask(GLbyte*);
-extern void __glXDisp_ColorMask(GLbyte*);
-extern void __glXDisp_DepthMask(GLbyte*);
-extern void __glXDisp_IndexMask(GLbyte*);
-extern void __glXDisp_Accum(GLbyte*);
-extern void __glXDisp_Disable(GLbyte*);
-extern void __glXDisp_Enable(GLbyte*);
-extern void __glXDisp_PopAttrib(GLbyte*);
-extern void __glXDisp_PushAttrib(GLbyte*);
-extern void __glXDisp_Map1d(GLbyte*);
-extern void __glXDisp_Map1f(GLbyte*);
-extern void __glXDisp_Map2d(GLbyte*);
-extern void __glXDisp_Map2f(GLbyte*);
-extern void __glXDisp_MapGrid1d(GLbyte*);
-extern void __glXDisp_MapGrid1f(GLbyte*);
-extern void __glXDisp_MapGrid2d(GLbyte*);
-extern void __glXDisp_MapGrid2f(GLbyte*);
-extern void __glXDisp_EvalCoord1dv(GLbyte*);
-extern void __glXDisp_EvalCoord1fv(GLbyte*);
-extern void __glXDisp_EvalCoord2dv(GLbyte*);
-extern void __glXDisp_EvalCoord2fv(GLbyte*);
-extern void __glXDisp_EvalMesh1(GLbyte*);
-extern void __glXDisp_EvalPoint1(GLbyte*);
-extern void __glXDisp_EvalMesh2(GLbyte*);
-extern void __glXDisp_EvalPoint2(GLbyte*);
-extern void __glXDisp_AlphaFunc(GLbyte*);
-extern void __glXDisp_BlendFunc(GLbyte*);
-extern void __glXDisp_LogicOp(GLbyte*);
-extern void __glXDisp_StencilFunc(GLbyte*);
-extern void __glXDisp_StencilOp(GLbyte*);
-extern void __glXDisp_DepthFunc(GLbyte*);
-extern void __glXDisp_PixelZoom(GLbyte*);
-extern void __glXDisp_PixelTransferf(GLbyte*);
-extern void __glXDisp_PixelTransferi(GLbyte*);
-extern void __glXDisp_PixelMapfv(GLbyte*);
-extern void __glXDisp_PixelMapuiv(GLbyte*);
-extern void __glXDisp_PixelMapusv(GLbyte*);
-extern void __glXDisp_ReadBuffer(GLbyte*);
-extern void __glXDisp_CopyPixels(GLbyte*);
-extern void __glXDisp_DrawPixels(GLbyte*);
-extern void __glXDisp_DepthRange(GLbyte*);
-extern void __glXDisp_Frustum(GLbyte*);
-extern void __glXDisp_LoadIdentity(GLbyte*);
-extern void __glXDisp_LoadMatrixf(GLbyte*);
-extern void __glXDisp_LoadMatrixd(GLbyte*);
-extern void __glXDisp_MatrixMode(GLbyte*);
-extern void __glXDisp_MultMatrixf(GLbyte*);
-extern void __glXDisp_MultMatrixd(GLbyte*);
-extern void __glXDisp_Ortho(GLbyte*);
-extern void __glXDisp_PopMatrix(GLbyte*);
-extern void __glXDisp_PushMatrix(GLbyte*);
-extern void __glXDisp_Rotated(GLbyte*);
-extern void __glXDisp_Rotatef(GLbyte*);
-extern void __glXDisp_Scaled(GLbyte*);
-extern void __glXDisp_Scalef(GLbyte*);
-extern void __glXDisp_Translated(GLbyte*);
-extern void __glXDisp_Translatef(GLbyte*);
-extern void __glXDisp_Viewport(GLbyte*);
-extern void __glXDisp_PolygonOffset(GLbyte*);
-extern void __glXDisp_DrawArrays(GLbyte*);
-extern void __glXDisp_Indexubv(GLbyte*);
-extern void __glXDisp_ColorSubTable(GLbyte*);
-extern void __glXDisp_CopyColorSubTable(GLbyte*);
-extern void __glXDisp_ActiveTextureARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord1dvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord1fvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord1ivARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord1svARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord2dvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord2fvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord2ivARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord2svARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord3dvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord3fvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord3ivARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord3svARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord4dvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord4fvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord4ivARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord4svARB(GLbyte*);
+extern void __glXDisp_CallList(GLbyte *);
+extern void __glXDisp_CallLists(GLbyte *);
+extern void __glXDisp_ListBase(GLbyte *);
+extern void __glXDisp_Begin(GLbyte *);
+extern void __glXDisp_Bitmap(GLbyte *);
+extern void __glXDisp_Color3bv(GLbyte *);
+extern void __glXDisp_Color3dv(GLbyte *);
+extern void __glXDisp_Color3fv(GLbyte *);
+extern void __glXDisp_Color3iv(GLbyte *);
+extern void __glXDisp_Color3sv(GLbyte *);
+extern void __glXDisp_Color3ubv(GLbyte *);
+extern void __glXDisp_Color3uiv(GLbyte *);
+extern void __glXDisp_Color3usv(GLbyte *);
+extern void __glXDisp_Color4bv(GLbyte *);
+extern void __glXDisp_Color4dv(GLbyte *);
+extern void __glXDisp_Color4fv(GLbyte *);
+extern void __glXDisp_Color4iv(GLbyte *);
+extern void __glXDisp_Color4sv(GLbyte *);
+extern void __glXDisp_Color4ubv(GLbyte *);
+extern void __glXDisp_Color4uiv(GLbyte *);
+extern void __glXDisp_Color4usv(GLbyte *);
+extern void __glXDisp_EdgeFlagv(GLbyte *);
+extern void __glXDisp_End(GLbyte *);
+extern void __glXDisp_Indexdv(GLbyte *);
+extern void __glXDisp_Indexfv(GLbyte *);
+extern void __glXDisp_Indexiv(GLbyte *);
+extern void __glXDisp_Indexsv(GLbyte *);
+extern void __glXDisp_Normal3bv(GLbyte *);
+extern void __glXDisp_Normal3dv(GLbyte *);
+extern void __glXDisp_Normal3fv(GLbyte *);
+extern void __glXDisp_Normal3iv(GLbyte *);
+extern void __glXDisp_Normal3sv(GLbyte *);
+extern void __glXDisp_RasterPos2dv(GLbyte *);
+extern void __glXDisp_RasterPos2fv(GLbyte *);
+extern void __glXDisp_RasterPos2iv(GLbyte *);
+extern void __glXDisp_RasterPos2sv(GLbyte *);
+extern void __glXDisp_RasterPos3dv(GLbyte *);
+extern void __glXDisp_RasterPos3fv(GLbyte *);
+extern void __glXDisp_RasterPos3iv(GLbyte *);
+extern void __glXDisp_RasterPos3sv(GLbyte *);
+extern void __glXDisp_RasterPos4dv(GLbyte *);
+extern void __glXDisp_RasterPos4fv(GLbyte *);
+extern void __glXDisp_RasterPos4iv(GLbyte *);
+extern void __glXDisp_RasterPos4sv(GLbyte *);
+extern void __glXDisp_Rectdv(GLbyte *);
+extern void __glXDisp_Rectfv(GLbyte *);
+extern void __glXDisp_Rectiv(GLbyte *);
+extern void __glXDisp_Rectsv(GLbyte *);
+extern void __glXDisp_TexCoord1dv(GLbyte *);
+extern void __glXDisp_TexCoord1fv(GLbyte *);
+extern void __glXDisp_TexCoord1iv(GLbyte *);
+extern void __glXDisp_TexCoord1sv(GLbyte *);
+extern void __glXDisp_TexCoord2dv(GLbyte *);
+extern void __glXDisp_TexCoord2fv(GLbyte *);
+extern void __glXDisp_TexCoord2iv(GLbyte *);
+extern void __glXDisp_TexCoord2sv(GLbyte *);
+extern void __glXDisp_TexCoord3dv(GLbyte *);
+extern void __glXDisp_TexCoord3fv(GLbyte *);
+extern void __glXDisp_TexCoord3iv(GLbyte *);
+extern void __glXDisp_TexCoord3sv(GLbyte *);
+extern void __glXDisp_TexCoord4dv(GLbyte *);
+extern void __glXDisp_TexCoord4fv(GLbyte *);
+extern void __glXDisp_TexCoord4iv(GLbyte *);
+extern void __glXDisp_TexCoord4sv(GLbyte *);
+extern void __glXDisp_Vertex2dv(GLbyte *);
+extern void __glXDisp_Vertex2fv(GLbyte *);
+extern void __glXDisp_Vertex2iv(GLbyte *);
+extern void __glXDisp_Vertex2sv(GLbyte *);
+extern void __glXDisp_Vertex3dv(GLbyte *);
+extern void __glXDisp_Vertex3fv(GLbyte *);
+extern void __glXDisp_Vertex3iv(GLbyte *);
+extern void __glXDisp_Vertex3sv(GLbyte *);
+extern void __glXDisp_Vertex4dv(GLbyte *);
+extern void __glXDisp_Vertex4fv(GLbyte *);
+extern void __glXDisp_Vertex4iv(GLbyte *);
+extern void __glXDisp_Vertex4sv(GLbyte *);
+extern void __glXDisp_ClipPlane(GLbyte *);
+extern void __glXDisp_ColorMaterial(GLbyte *);
+extern void __glXDisp_CullFace(GLbyte *);
+extern void __glXDisp_Fogf(GLbyte *);
+extern void __glXDisp_Fogfv(GLbyte *);
+extern void __glXDisp_Fogi(GLbyte *);
+extern void __glXDisp_Fogiv(GLbyte *);
+extern void __glXDisp_FrontFace(GLbyte *);
+extern void __glXDisp_Hint(GLbyte *);
+extern void __glXDisp_Lightf(GLbyte *);
+extern void __glXDisp_Lightfv(GLbyte *);
+extern void __glXDisp_Lighti(GLbyte *);
+extern void __glXDisp_Lightiv(GLbyte *);
+extern void __glXDisp_LightModelf(GLbyte *);
+extern void __glXDisp_LightModelfv(GLbyte *);
+extern void __glXDisp_LightModeli(GLbyte *);
+extern void __glXDisp_LightModeliv(GLbyte *);
+extern void __glXDisp_LineStipple(GLbyte *);
+extern void __glXDisp_LineWidth(GLbyte *);
+extern void __glXDisp_Materialf(GLbyte *);
+extern void __glXDisp_Materialfv(GLbyte *);
+extern void __glXDisp_Materiali(GLbyte *);
+extern void __glXDisp_Materialiv(GLbyte *);
+extern void __glXDisp_PointSize(GLbyte *);
+extern void __glXDisp_PolygonMode(GLbyte *);
+extern void __glXDisp_PolygonStipple(GLbyte *);
+extern void __glXDisp_Scissor(GLbyte *);
+extern void __glXDisp_ShadeModel(GLbyte *);
+extern void __glXDisp_TexParameterf(GLbyte *);
+extern void __glXDisp_TexParameterfv(GLbyte *);
+extern void __glXDisp_TexParameteri(GLbyte *);
+extern void __glXDisp_TexParameteriv(GLbyte *);
+extern void __glXDisp_TexImage1D(GLbyte *);
+extern void __glXDisp_TexImage2D(GLbyte *);
+extern void __glXDisp_TexEnvf(GLbyte *);
+extern void __glXDisp_TexEnvfv(GLbyte *);
+extern void __glXDisp_TexEnvi(GLbyte *);
+extern void __glXDisp_TexEnviv(GLbyte *);
+extern void __glXDisp_TexGend(GLbyte *);
+extern void __glXDisp_TexGendv(GLbyte *);
+extern void __glXDisp_TexGenf(GLbyte *);
+extern void __glXDisp_TexGenfv(GLbyte *);
+extern void __glXDisp_TexGeni(GLbyte *);
+extern void __glXDisp_TexGeniv(GLbyte *);
+extern void __glXDisp_InitNames(GLbyte *);
+extern void __glXDisp_LoadName(GLbyte *);
+extern void __glXDisp_PassThrough(GLbyte *);
+extern void __glXDisp_PopName(GLbyte *);
+extern void __glXDisp_PushName(GLbyte *);
+extern void __glXDisp_DrawBuffer(GLbyte *);
+extern void __glXDisp_Clear(GLbyte *);
+extern void __glXDisp_ClearAccum(GLbyte *);
+extern void __glXDisp_ClearIndex(GLbyte *);
+extern void __glXDisp_ClearColor(GLbyte *);
+extern void __glXDisp_ClearStencil(GLbyte *);
+extern void __glXDisp_ClearDepth(GLbyte *);
+extern void __glXDisp_StencilMask(GLbyte *);
+extern void __glXDisp_ColorMask(GLbyte *);
+extern void __glXDisp_DepthMask(GLbyte *);
+extern void __glXDisp_IndexMask(GLbyte *);
+extern void __glXDisp_Accum(GLbyte *);
+extern void __glXDisp_Disable(GLbyte *);
+extern void __glXDisp_Enable(GLbyte *);
+extern void __glXDisp_PopAttrib(GLbyte *);
+extern void __glXDisp_PushAttrib(GLbyte *);
+extern void __glXDisp_Map1d(GLbyte *);
+extern void __glXDisp_Map1f(GLbyte *);
+extern void __glXDisp_Map2d(GLbyte *);
+extern void __glXDisp_Map2f(GLbyte *);
+extern void __glXDisp_MapGrid1d(GLbyte *);
+extern void __glXDisp_MapGrid1f(GLbyte *);
+extern void __glXDisp_MapGrid2d(GLbyte *);
+extern void __glXDisp_MapGrid2f(GLbyte *);
+extern void __glXDisp_EvalCoord1dv(GLbyte *);
+extern void __glXDisp_EvalCoord1fv(GLbyte *);
+extern void __glXDisp_EvalCoord2dv(GLbyte *);
+extern void __glXDisp_EvalCoord2fv(GLbyte *);
+extern void __glXDisp_EvalMesh1(GLbyte *);
+extern void __glXDisp_EvalPoint1(GLbyte *);
+extern void __glXDisp_EvalMesh2(GLbyte *);
+extern void __glXDisp_EvalPoint2(GLbyte *);
+extern void __glXDisp_AlphaFunc(GLbyte *);
+extern void __glXDisp_BlendFunc(GLbyte *);
+extern void __glXDisp_LogicOp(GLbyte *);
+extern void __glXDisp_StencilFunc(GLbyte *);
+extern void __glXDisp_StencilOp(GLbyte *);
+extern void __glXDisp_DepthFunc(GLbyte *);
+extern void __glXDisp_PixelZoom(GLbyte *);
+extern void __glXDisp_PixelTransferf(GLbyte *);
+extern void __glXDisp_PixelTransferi(GLbyte *);
+extern void __glXDisp_PixelMapfv(GLbyte *);
+extern void __glXDisp_PixelMapuiv(GLbyte *);
+extern void __glXDisp_PixelMapusv(GLbyte *);
+extern void __glXDisp_ReadBuffer(GLbyte *);
+extern void __glXDisp_CopyPixels(GLbyte *);
+extern void __glXDisp_DrawPixels(GLbyte *);
+extern void __glXDisp_DepthRange(GLbyte *);
+extern void __glXDisp_Frustum(GLbyte *);
+extern void __glXDisp_LoadIdentity(GLbyte *);
+extern void __glXDisp_LoadMatrixf(GLbyte *);
+extern void __glXDisp_LoadMatrixd(GLbyte *);
+extern void __glXDisp_MatrixMode(GLbyte *);
+extern void __glXDisp_MultMatrixf(GLbyte *);
+extern void __glXDisp_MultMatrixd(GLbyte *);
+extern void __glXDisp_Ortho(GLbyte *);
+extern void __glXDisp_PopMatrix(GLbyte *);
+extern void __glXDisp_PushMatrix(GLbyte *);
+extern void __glXDisp_Rotated(GLbyte *);
+extern void __glXDisp_Rotatef(GLbyte *);
+extern void __glXDisp_Scaled(GLbyte *);
+extern void __glXDisp_Scalef(GLbyte *);
+extern void __glXDisp_Translated(GLbyte *);
+extern void __glXDisp_Translatef(GLbyte *);
+extern void __glXDisp_Viewport(GLbyte *);
+extern void __glXDisp_PolygonOffset(GLbyte *);
+extern void __glXDisp_DrawArrays(GLbyte *);
+extern void __glXDisp_Indexubv(GLbyte *);
+extern void __glXDisp_ColorSubTable(GLbyte *);
+extern void __glXDisp_CopyColorSubTable(GLbyte *);
+extern void __glXDisp_ActiveTextureARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord1dvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord1fvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord1ivARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord1svARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord2dvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord2fvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord2ivARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord2svARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord3dvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord3fvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord3ivARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord3svARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord4dvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord4fvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord4ivARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord4svARB(GLbyte *);
-extern int __glXSwapRender(__GLXclientState*, GLbyte*);
-extern int __glXSwapRenderLarge(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreateContext(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapDestroyContext(__GLXclientState*, GLbyte*);
-extern int __glXSwapMakeCurrent(__GLXclientState*, GLbyte*);
-extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapDestroyPbuffer(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapIsDirect(__GLXclientState*, GLbyte*);
-extern int __glXSwapQueryVersion(__GLXclientState*, GLbyte*);
-extern int __glXSwapWaitGL(__GLXclientState*, GLbyte*);
-extern int __glXSwapWaitX(__GLXclientState*, GLbyte*);
-extern int __glXSwapCopyContext(__GLXclientState*, GLbyte*);
-extern int __glXSwapSwapBuffers(__GLXclientState*, GLbyte*);
-extern int __glXSwapUseXFont(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreateGLXPixmap(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapGetVisualConfigs(__GLXclientState*, GLbyte*);
-extern int __glXSwapDestroyGLXPixmap(__GLXclientState*, GLbyte*);
-extern int __glXSwapVendorPrivate(__GLXclientState*, GLbyte*);
-extern int __glXSwapVendorPrivateWithReply(__GLXclientState*, GLbyte*);
-extern int __glXSwapQueryExtensionsString(__GLXclientState*, GLbyte*);
-extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*);
-extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*);
-extern int __glXSwapGetFBConfigs(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapDestroyWindow(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDispSwap_NewList(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_EndList(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_DeleteLists(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GenLists(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_FeedbackBuffer(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_SelectBuffer(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_RenderMode(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_Finish(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_PixelStoref(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_PixelStorei(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_ReadPixels(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetBooleanv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetClipPlane(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetDoublev(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetError(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetFloatv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetIntegerv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetLightfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetLightiv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMapdv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMapfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMapiv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMaterialfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMaterialiv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetPixelMapfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetPixelMapuiv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetPixelMapusv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetPolygonStipple(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetString(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexEnvfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexEnviv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexGendv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexGenfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexGeniv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexImage(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_IsEnabled(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_IsList(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_Flush(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetColorTable(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetSeparableFilter(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetHistogram(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMinmax(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXSwapRender(__GLXclientState *, GLbyte *);
+extern int __glXSwapRenderLarge(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreateContext(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreateNewContext(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapDestroyContext(__GLXclientState *, GLbyte *);
+extern int __glXSwapMakeCurrent(__GLXclientState *, GLbyte *);
+extern int __glXSwapMakeContextCurrent(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreatePbuffer(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapDestroyPbuffer(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapChangeDrawableAttributes(__GLXclientState * cl,
+ GLbyte * pc);
+extern int __glXSwapIsDirect(__GLXclientState *, GLbyte *);
+extern int __glXSwapQueryVersion(__GLXclientState *, GLbyte *);
+extern int __glXSwapWaitGL(__GLXclientState *, GLbyte *);
+extern int __glXSwapWaitX(__GLXclientState *, GLbyte *);
+extern int __glXSwapCopyContext(__GLXclientState *, GLbyte *);
+extern int __glXSwapSwapBuffers(__GLXclientState *, GLbyte *);
+extern int __glXSwapUseXFont(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreateGLXPixmap(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreatePixmap(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapGetVisualConfigs(__GLXclientState *, GLbyte *);
+extern int __glXSwapDestroyGLXPixmap(__GLXclientState *, GLbyte *);
+extern int __glXSwapVendorPrivate(__GLXclientState *, GLbyte *);
+extern int __glXSwapVendorPrivateWithReply(__GLXclientState *, GLbyte *);
+extern int __glXSwapQueryExtensionsString(__GLXclientState *, GLbyte *);
+extern int __glXSwapQueryServerString(__GLXclientState *, GLbyte *);
+extern int __glXSwapClientInfo(__GLXclientState *, GLbyte *);
+extern int __glXSwapGetFBConfigs(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreateWindow(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapDestroyWindow(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapQueryContext(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDispSwap_NewList(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_EndList(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_DeleteLists(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GenLists(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_FeedbackBuffer(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_SelectBuffer(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_RenderMode(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_Finish(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_PixelStoref(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_PixelStorei(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_ReadPixels(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetBooleanv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetClipPlane(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetDoublev(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetError(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetFloatv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetIntegerv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetLightfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetLightiv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMapdv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMapfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMapiv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMaterialfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMaterialiv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetPixelMapfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetPixelMapuiv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetPixelMapusv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetPolygonStipple(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetString(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexEnvfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexEnviv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexGendv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexGenfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexGeniv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexImage(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_IsEnabled(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_IsList(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_Flush(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_AreTexturesResident(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_DeleteTextures(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GenTextures(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_IsTexture(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetColorTable(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *,
+ GLbyte *);
+extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *,
+ GLbyte *);
+extern int __glXDispSwap_GetSeparableFilter(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetHistogram(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMinmax(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *, GLbyte *);
-extern void __glXDispSwap_CallList(GLbyte*);
-extern void __glXDispSwap_CallLists(GLbyte*);
-extern void __glXDispSwap_ListBase(GLbyte*);
-extern void __glXDispSwap_Begin(GLbyte*);
-extern void __glXDispSwap_Bitmap(GLbyte*);
-extern void __glXDispSwap_Color3bv(GLbyte*);
-extern void __glXDispSwap_Color3dv(GLbyte*);
-extern void __glXDispSwap_Color3fv(GLbyte*);
-extern void __glXDispSwap_Color3iv(GLbyte*);
-extern void __glXDispSwap_Color3sv(GLbyte*);
-extern void __glXDispSwap_Color3ubv(GLbyte*);
-extern void __glXDispSwap_Color3uiv(GLbyte*);
-extern void __glXDispSwap_Color3usv(GLbyte*);
-extern void __glXDispSwap_Color4bv(GLbyte*);
-extern void __glXDispSwap_Color4dv(GLbyte*);
-extern void __glXDispSwap_Color4fv(GLbyte*);
-extern void __glXDispSwap_Color4iv(GLbyte*);
-extern void __glXDispSwap_Color4sv(GLbyte*);
-extern void __glXDispSwap_Color4ubv(GLbyte*);
-extern void __glXDispSwap_Color4uiv(GLbyte*);
-extern void __glXDispSwap_Color4usv(GLbyte*);
-extern void __glXDispSwap_EdgeFlagv(GLbyte*);
-extern void __glXDispSwap_End(GLbyte*);
-extern void __glXDispSwap_Indexdv(GLbyte*);
-extern void __glXDispSwap_Indexfv(GLbyte*);
-extern void __glXDispSwap_Indexiv(GLbyte*);
-extern void __glXDispSwap_Indexsv(GLbyte*);
-extern void __glXDispSwap_Normal3bv(GLbyte*);
-extern void __glXDispSwap_Normal3dv(GLbyte*);
-extern void __glXDispSwap_Normal3fv(GLbyte*);
-extern void __glXDispSwap_Normal3iv(GLbyte*);
-extern void __glXDispSwap_Normal3sv(GLbyte*);
-extern void __glXDispSwap_RasterPos2dv(GLbyte*);
-extern void __glXDispSwap_RasterPos2fv(GLbyte*);
-extern void __glXDispSwap_RasterPos2iv(GLbyte*);
-extern void __glXDispSwap_RasterPos2sv(GLbyte*);
-extern void __glXDispSwap_RasterPos3dv(GLbyte*);
-extern void __glXDispSwap_RasterPos3fv(GLbyte*);
-extern void __glXDispSwap_RasterPos3iv(GLbyte*);
-extern void __glXDispSwap_RasterPos3sv(GLbyte*);
-extern void __glXDispSwap_RasterPos4dv(GLbyte*);
-extern void __glXDispSwap_RasterPos4fv(GLbyte*);
-extern void __glXDispSwap_RasterPos4iv(GLbyte*);
-extern void __glXDispSwap_RasterPos4sv(GLbyte*);
-extern void __glXDispSwap_Rectdv(GLbyte*);
-extern void __glXDispSwap_Rectfv(GLbyte*);
-extern void __glXDispSwap_Rectiv(GLbyte*);
-extern void __glXDispSwap_Rectsv(GLbyte*);
-extern void __glXDispSwap_TexCoord1dv(GLbyte*);
-extern void __glXDispSwap_TexCoord1fv(GLbyte*);
-extern void __glXDispSwap_TexCoord1iv(GLbyte*);
-extern void __glXDispSwap_TexCoord1sv(GLbyte*);
-extern void __glXDispSwap_TexCoord2dv(GLbyte*);
-extern void __glXDispSwap_TexCoord2fv(GLbyte*);
-extern void __glXDispSwap_TexCoord2iv(GLbyte*);
-extern void __glXDispSwap_TexCoord2sv(GLbyte*);
-extern void __glXDispSwap_TexCoord3dv(GLbyte*);
-extern void __glXDispSwap_TexCoord3fv(GLbyte*);
-extern void __glXDispSwap_TexCoord3iv(GLbyte*);
-extern void __glXDispSwap_TexCoord3sv(GLbyte*);
-extern void __glXDispSwap_TexCoord4dv(GLbyte*);
-extern void __glXDispSwap_TexCoord4fv(GLbyte*);
-extern void __glXDispSwap_TexCoord4iv(GLbyte*);
-extern void __glXDispSwap_TexCoord4sv(GLbyte*);
-extern void __glXDispSwap_Vertex2dv(GLbyte*);
-extern void __glXDispSwap_Vertex2fv(GLbyte*);
-extern void __glXDispSwap_Vertex2iv(GLbyte*);
-extern void __glXDispSwap_Vertex2sv(GLbyte*);
-extern void __glXDispSwap_Vertex3dv(GLbyte*);
-extern void __glXDispSwap_Vertex3fv(GLbyte*);
-extern void __glXDispSwap_Vertex3iv(GLbyte*);
-extern void __glXDispSwap_Vertex3sv(GLbyte*);
-extern void __glXDispSwap_Vertex4dv(GLbyte*);
-extern void __glXDispSwap_Vertex4fv(GLbyte*);
-extern void __glXDispSwap_Vertex4iv(GLbyte*);
-extern void __glXDispSwap_Vertex4sv(GLbyte*);
-extern void __glXDispSwap_ClipPlane(GLbyte*);
-extern void __glXDispSwap_ColorMaterial(GLbyte*);
-extern void __glXDispSwap_CullFace(GLbyte*);
-extern void __glXDispSwap_Fogf(GLbyte*);
-extern void __glXDispSwap_Fogfv(GLbyte*);
-extern void __glXDispSwap_Fogi(GLbyte*);
-extern void __glXDispSwap_Fogiv(GLbyte*);
-extern void __glXDispSwap_FrontFace(GLbyte*);
-extern void __glXDispSwap_Hint(GLbyte*);
-extern void __glXDispSwap_Lightf(GLbyte*);
-extern void __glXDispSwap_Lightfv(GLbyte*);
-extern void __glXDispSwap_Lighti(GLbyte*);
-extern void __glXDispSwap_Lightiv(GLbyte*);
-extern void __glXDispSwap_LightModelf(GLbyte*);
-extern void __glXDispSwap_LightModelfv(GLbyte*);
-extern void __glXDispSwap_LightModeli(GLbyte*);
-extern void __glXDispSwap_LightModeliv(GLbyte*);
-extern void __glXDispSwap_LineStipple(GLbyte*);
-extern void __glXDispSwap_LineWidth(GLbyte*);
-extern void __glXDispSwap_Materialf(GLbyte*);
-extern void __glXDispSwap_Materialfv(GLbyte*);
-extern void __glXDispSwap_Materiali(GLbyte*);
-extern void __glXDispSwap_Materialiv(GLbyte*);
-extern void __glXDispSwap_PointSize(GLbyte*);
-extern void __glXDispSwap_PolygonMode(GLbyte*);
-extern void __glXDispSwap_PolygonStipple(GLbyte*);
-extern void __glXDispSwap_Scissor(GLbyte*);
-extern void __glXDispSwap_ShadeModel(GLbyte*);
-extern void __glXDispSwap_TexParameterf(GLbyte*);
-extern void __glXDispSwap_TexParameterfv(GLbyte*);
-extern void __glXDispSwap_TexParameteri(GLbyte*);
-extern void __glXDispSwap_TexParameteriv(GLbyte*);
-extern void __glXDispSwap_TexImage1D(GLbyte*);
-extern void __glXDispSwap_TexImage2D(GLbyte*);
-extern void __glXDispSwap_TexEnvf(GLbyte*);
-extern void __glXDispSwap_TexEnvfv(GLbyte*);
-extern void __glXDispSwap_TexEnvi(GLbyte*);
-extern void __glXDispSwap_TexEnviv(GLbyte*);
-extern void __glXDispSwap_TexGend(GLbyte*);
-extern void __glXDispSwap_TexGendv(GLbyte*);
-extern void __glXDispSwap_TexGenf(GLbyte*);
-extern void __glXDispSwap_TexGenfv(GLbyte*);
-extern void __glXDispSwap_TexGeni(GLbyte*);
-extern void __glXDispSwap_TexGeniv(GLbyte*);
-extern void __glXDispSwap_InitNames(GLbyte*);
-extern void __glXDispSwap_LoadName(GLbyte*);
-extern void __glXDispSwap_PassThrough(GLbyte*);
-extern void __glXDispSwap_PopName(GLbyte*);
-extern void __glXDispSwap_PushName(GLbyte*);
-extern void __glXDispSwap_DrawBuffer(GLbyte*);
-extern void __glXDispSwap_Clear(GLbyte*);
-extern void __glXDispSwap_ClearAccum(GLbyte*);
-extern void __glXDispSwap_ClearIndex(GLbyte*);
-extern void __glXDispSwap_ClearColor(GLbyte*);
-extern void __glXDispSwap_ClearStencil(GLbyte*);
-extern void __glXDispSwap_ClearDepth(GLbyte*);
-extern void __glXDispSwap_StencilMask(GLbyte*);
-extern void __glXDispSwap_ColorMask(GLbyte*);
-extern void __glXDispSwap_DepthMask(GLbyte*);
-extern void __glXDispSwap_IndexMask(GLbyte*);
-extern void __glXDispSwap_Accum(GLbyte*);
-extern void __glXDispSwap_Disable(GLbyte*);
-extern void __glXDispSwap_Enable(GLbyte*);
-extern void __glXDispSwap_PopAttrib(GLbyte*);
-extern void __glXDispSwap_PushAttrib(GLbyte*);
-extern void __glXDispSwap_Map1d(GLbyte*);
-extern void __glXDispSwap_Map1f(GLbyte*);
-extern void __glXDispSwap_Map2d(GLbyte*);
-extern void __glXDispSwap_Map2f(GLbyte*);
-extern void __glXDispSwap_MapGrid1d(GLbyte*);
-extern void __glXDispSwap_MapGrid1f(GLbyte*);
-extern void __glXDispSwap_MapGrid2d(GLbyte*);
-extern void __glXDispSwap_MapGrid2f(GLbyte*);
-extern void __glXDispSwap_EvalCoord1dv(GLbyte*);
-extern void __glXDispSwap_EvalCoord1fv(GLbyte*);
-extern void __glXDispSwap_EvalCoord2dv(GLbyte*);
-extern void __glXDispSwap_EvalCoord2fv(GLbyte*);
-extern void __glXDispSwap_EvalMesh1(GLbyte*);
-extern void __glXDispSwap_EvalPoint1(GLbyte*);
-extern void __glXDispSwap_EvalMesh2(GLbyte*);
-extern void __glXDispSwap_EvalPoint2(GLbyte*);
-extern void __glXDispSwap_AlphaFunc(GLbyte*);
-extern void __glXDispSwap_BlendFunc(GLbyte*);
-extern void __glXDispSwap_LogicOp(GLbyte*);
-extern void __glXDispSwap_StencilFunc(GLbyte*);
-extern void __glXDispSwap_StencilOp(GLbyte*);
-extern void __glXDispSwap_DepthFunc(GLbyte*);
-extern void __glXDispSwap_PixelZoom(GLbyte*);
-extern void __glXDispSwap_PixelTransferf(GLbyte*);
-extern void __glXDispSwap_PixelTransferi(GLbyte*);
-extern void __glXDispSwap_PixelMapfv(GLbyte*);
-extern void __glXDispSwap_PixelMapuiv(GLbyte*);
-extern void __glXDispSwap_PixelMapusv(GLbyte*);
-extern void __glXDispSwap_ReadBuffer(GLbyte*);
-extern void __glXDispSwap_CopyPixels(GLbyte*);
-extern void __glXDispSwap_DrawPixels(GLbyte*);
-extern void __glXDispSwap_DepthRange(GLbyte*);
-extern void __glXDispSwap_Frustum(GLbyte*);
-extern void __glXDispSwap_LoadIdentity(GLbyte*);
-extern void __glXDispSwap_LoadMatrixf(GLbyte*);
-extern void __glXDispSwap_LoadMatrixd(GLbyte*);
-extern void __glXDispSwap_MatrixMode(GLbyte*);
-extern void __glXDispSwap_MultMatrixf(GLbyte*);
-extern void __glXDispSwap_MultMatrixd(GLbyte*);
-extern void __glXDispSwap_Ortho(GLbyte*);
-extern void __glXDispSwap_PopMatrix(GLbyte*);
-extern void __glXDispSwap_PushMatrix(GLbyte*);
-extern void __glXDispSwap_Rotated(GLbyte*);
-extern void __glXDispSwap_Rotatef(GLbyte*);
-extern void __glXDispSwap_Scaled(GLbyte*);
-extern void __glXDispSwap_Scalef(GLbyte*);
-extern void __glXDispSwap_Translated(GLbyte*);
-extern void __glXDispSwap_Translatef(GLbyte*);
-extern void __glXDispSwap_Viewport(GLbyte*);
-extern void __glXDispSwap_PolygonOffset(GLbyte*);
-extern void __glXDispSwap_DrawArrays(GLbyte*);
-extern void __glXDispSwap_Indexubv(GLbyte*);
-extern void __glXDispSwap_ColorSubTable(GLbyte*);
-extern void __glXDispSwap_CopyColorSubTable(GLbyte*);
-extern void __glXDispSwap_ActiveTextureARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte*);
+extern void __glXDispSwap_CallList(GLbyte *);
+extern void __glXDispSwap_CallLists(GLbyte *);
+extern void __glXDispSwap_ListBase(GLbyte *);
+extern void __glXDispSwap_Begin(GLbyte *);
+extern void __glXDispSwap_Bitmap(GLbyte *);
+extern void __glXDispSwap_Color3bv(GLbyte *);
+extern void __glXDispSwap_Color3dv(GLbyte *);
+extern void __glXDispSwap_Color3fv(GLbyte *);
+extern void __glXDispSwap_Color3iv(GLbyte *);
+extern void __glXDispSwap_Color3sv(GLbyte *);
+extern void __glXDispSwap_Color3ubv(GLbyte *);
+extern void __glXDispSwap_Color3uiv(GLbyte *);
+extern void __glXDispSwap_Color3usv(GLbyte *);
+extern void __glXDispSwap_Color4bv(GLbyte *);
+extern void __glXDispSwap_Color4dv(GLbyte *);
+extern void __glXDispSwap_Color4fv(GLbyte *);
+extern void __glXDispSwap_Color4iv(GLbyte *);
+extern void __glXDispSwap_Color4sv(GLbyte *);
+extern void __glXDispSwap_Color4ubv(GLbyte *);
+extern void __glXDispSwap_Color4uiv(GLbyte *);
+extern void __glXDispSwap_Color4usv(GLbyte *);
+extern void __glXDispSwap_EdgeFlagv(GLbyte *);
+extern void __glXDispSwap_End(GLbyte *);
+extern void __glXDispSwap_Indexdv(GLbyte *);
+extern void __glXDispSwap_Indexfv(GLbyte *);
+extern void __glXDispSwap_Indexiv(GLbyte *);
+extern void __glXDispSwap_Indexsv(GLbyte *);
+extern void __glXDispSwap_Normal3bv(GLbyte *);
+extern void __glXDispSwap_Normal3dv(GLbyte *);
+extern void __glXDispSwap_Normal3fv(GLbyte *);
+extern void __glXDispSwap_Normal3iv(GLbyte *);
+extern void __glXDispSwap_Normal3sv(GLbyte *);
+extern void __glXDispSwap_RasterPos2dv(GLbyte *);
+extern void __glXDispSwap_RasterPos2fv(GLbyte *);
+extern void __glXDispSwap_RasterPos2iv(GLbyte *);
+extern void __glXDispSwap_RasterPos2sv(GLbyte *);
+extern void __glXDispSwap_RasterPos3dv(GLbyte *);
+extern void __glXDispSwap_RasterPos3fv(GLbyte *);
+extern void __glXDispSwap_RasterPos3iv(GLbyte *);
+extern void __glXDispSwap_RasterPos3sv(GLbyte *);
+extern void __glXDispSwap_RasterPos4dv(GLbyte *);
+extern void __glXDispSwap_RasterPos4fv(GLbyte *);
+extern void __glXDispSwap_RasterPos4iv(GLbyte *);
+extern void __glXDispSwap_RasterPos4sv(GLbyte *);
+extern void __glXDispSwap_Rectdv(GLbyte *);
+extern void __glXDispSwap_Rectfv(GLbyte *);
+extern void __glXDispSwap_Rectiv(GLbyte *);
+extern void __glXDispSwap_Rectsv(GLbyte *);
+extern void __glXDispSwap_TexCoord1dv(GLbyte *);
+extern void __glXDispSwap_TexCoord1fv(GLbyte *);
+extern void __glXDispSwap_TexCoord1iv(GLbyte *);
+extern void __glXDispSwap_TexCoord1sv(GLbyte *);
+extern void __glXDispSwap_TexCoord2dv(GLbyte *);
+extern void __glXDispSwap_TexCoord2fv(GLbyte *);
+extern void __glXDispSwap_TexCoord2iv(GLbyte *);
+extern void __glXDispSwap_TexCoord2sv(GLbyte *);
+extern void __glXDispSwap_TexCoord3dv(GLbyte *);
+extern void __glXDispSwap_TexCoord3fv(GLbyte *);
+extern void __glXDispSwap_TexCoord3iv(GLbyte *);
+extern void __glXDispSwap_TexCoord3sv(GLbyte *);
+extern void __glXDispSwap_TexCoord4dv(GLbyte *);
+extern void __glXDispSwap_TexCoord4fv(GLbyte *);
+extern void __glXDispSwap_TexCoord4iv(GLbyte *);
+extern void __glXDispSwap_TexCoord4sv(GLbyte *);
+extern void __glXDispSwap_Vertex2dv(GLbyte *);
+extern void __glXDispSwap_Vertex2fv(GLbyte *);
+extern void __glXDispSwap_Vertex2iv(GLbyte *);
+extern void __glXDispSwap_Vertex2sv(GLbyte *);
+extern void __glXDispSwap_Vertex3dv(GLbyte *);
+extern void __glXDispSwap_Vertex3fv(GLbyte *);
+extern void __glXDispSwap_Vertex3iv(GLbyte *);
+extern void __glXDispSwap_Vertex3sv(GLbyte *);
+extern void __glXDispSwap_Vertex4dv(GLbyte *);
+extern void __glXDispSwap_Vertex4fv(GLbyte *);
+extern void __glXDispSwap_Vertex4iv(GLbyte *);
+extern void __glXDispSwap_Vertex4sv(GLbyte *);
+extern void __glXDispSwap_ClipPlane(GLbyte *);
+extern void __glXDispSwap_ColorMaterial(GLbyte *);
+extern void __glXDispSwap_CullFace(GLbyte *);
+extern void __glXDispSwap_Fogf(GLbyte *);
+extern void __glXDispSwap_Fogfv(GLbyte *);
+extern void __glXDispSwap_Fogi(GLbyte *);
+extern void __glXDispSwap_Fogiv(GLbyte *);
+extern void __glXDispSwap_FrontFace(GLbyte *);
+extern void __glXDispSwap_Hint(GLbyte *);
+extern void __glXDispSwap_Lightf(GLbyte *);
+extern void __glXDispSwap_Lightfv(GLbyte *);
+extern void __glXDispSwap_Lighti(GLbyte *);
+extern void __glXDispSwap_Lightiv(GLbyte *);
+extern void __glXDispSwap_LightModelf(GLbyte *);
+extern void __glXDispSwap_LightModelfv(GLbyte *);
+extern void __glXDispSwap_LightModeli(GLbyte *);
+extern void __glXDispSwap_LightModeliv(GLbyte *);
+extern void __glXDispSwap_LineStipple(GLbyte *);
+extern void __glXDispSwap_LineWidth(GLbyte *);
+extern void __glXDispSwap_Materialf(GLbyte *);
+extern void __glXDispSwap_Materialfv(GLbyte *);
+extern void __glXDispSwap_Materiali(GLbyte *);
+extern void __glXDispSwap_Materialiv(GLbyte *);
+extern void __glXDispSwap_PointSize(GLbyte *);
+extern void __glXDispSwap_PolygonMode(GLbyte *);
+extern void __glXDispSwap_PolygonStipple(GLbyte *);
+extern void __glXDispSwap_Scissor(GLbyte *);
+extern void __glXDispSwap_ShadeModel(GLbyte *);
+extern void __glXDispSwap_TexParameterf(GLbyte *);
+extern void __glXDispSwap_TexParameterfv(GLbyte *);
+extern void __glXDispSwap_TexParameteri(GLbyte *);
+extern void __glXDispSwap_TexParameteriv(GLbyte *);
+extern void __glXDispSwap_TexImage1D(GLbyte *);
+extern void __glXDispSwap_TexImage2D(GLbyte *);
+extern void __glXDispSwap_TexEnvf(GLbyte *);
+extern void __glXDispSwap_TexEnvfv(GLbyte *);
+extern void __glXDispSwap_TexEnvi(GLbyte *);
+extern void __glXDispSwap_TexEnviv(GLbyte *);
+extern void __glXDispSwap_TexGend(GLbyte *);
+extern void __glXDispSwap_TexGendv(GLbyte *);
+extern void __glXDispSwap_TexGenf(GLbyte *);
+extern void __glXDispSwap_TexGenfv(GLbyte *);
+extern void __glXDispSwap_TexGeni(GLbyte *);
+extern void __glXDispSwap_TexGeniv(GLbyte *);
+extern void __glXDispSwap_InitNames(GLbyte *);
+extern void __glXDispSwap_LoadName(GLbyte *);
+extern void __glXDispSwap_PassThrough(GLbyte *);
+extern void __glXDispSwap_PopName(GLbyte *);
+extern void __glXDispSwap_PushName(GLbyte *);
+extern void __glXDispSwap_DrawBuffer(GLbyte *);
+extern void __glXDispSwap_Clear(GLbyte *);
+extern void __glXDispSwap_ClearAccum(GLbyte *);
+extern void __glXDispSwap_ClearIndex(GLbyte *);
+extern void __glXDispSwap_ClearColor(GLbyte *);
+extern void __glXDispSwap_ClearStencil(GLbyte *);
+extern void __glXDispSwap_ClearDepth(GLbyte *);
+extern void __glXDispSwap_StencilMask(GLbyte *);
+extern void __glXDispSwap_ColorMask(GLbyte *);
+extern void __glXDispSwap_DepthMask(GLbyte *);
+extern void __glXDispSwap_IndexMask(GLbyte *);
+extern void __glXDispSwap_Accum(GLbyte *);
+extern void __glXDispSwap_Disable(GLbyte *);
+extern void __glXDispSwap_Enable(GLbyte *);
+extern void __glXDispSwap_PopAttrib(GLbyte *);
+extern void __glXDispSwap_PushAttrib(GLbyte *);
+extern void __glXDispSwap_Map1d(GLbyte *);
+extern void __glXDispSwap_Map1f(GLbyte *);
+extern void __glXDispSwap_Map2d(GLbyte *);
+extern void __glXDispSwap_Map2f(GLbyte *);
+extern void __glXDispSwap_MapGrid1d(GLbyte *);
+extern void __glXDispSwap_MapGrid1f(GLbyte *);
+extern void __glXDispSwap_MapGrid2d(GLbyte *);
+extern void __glXDispSwap_MapGrid2f(GLbyte *);
+extern void __glXDispSwap_EvalCoord1dv(GLbyte *);
+extern void __glXDispSwap_EvalCoord1fv(GLbyte *);
+extern void __glXDispSwap_EvalCoord2dv(GLbyte *);
+extern void __glXDispSwap_EvalCoord2fv(GLbyte *);
+extern void __glXDispSwap_EvalMesh1(GLbyte *);
+extern void __glXDispSwap_EvalPoint1(GLbyte *);
+extern void __glXDispSwap_EvalMesh2(GLbyte *);
+extern void __glXDispSwap_EvalPoint2(GLbyte *);
+extern void __glXDispSwap_AlphaFunc(GLbyte *);
+extern void __glXDispSwap_BlendFunc(GLbyte *);
+extern void __glXDispSwap_LogicOp(GLbyte *);
+extern void __glXDispSwap_StencilFunc(GLbyte *);
+extern void __glXDispSwap_StencilOp(GLbyte *);
+extern void __glXDispSwap_DepthFunc(GLbyte *);
+extern void __glXDispSwap_PixelZoom(GLbyte *);
+extern void __glXDispSwap_PixelTransferf(GLbyte *);
+extern void __glXDispSwap_PixelTransferi(GLbyte *);
+extern void __glXDispSwap_PixelMapfv(GLbyte *);
+extern void __glXDispSwap_PixelMapuiv(GLbyte *);
+extern void __glXDispSwap_PixelMapusv(GLbyte *);
+extern void __glXDispSwap_ReadBuffer(GLbyte *);
+extern void __glXDispSwap_CopyPixels(GLbyte *);
+extern void __glXDispSwap_DrawPixels(GLbyte *);
+extern void __glXDispSwap_DepthRange(GLbyte *);
+extern void __glXDispSwap_Frustum(GLbyte *);
+extern void __glXDispSwap_LoadIdentity(GLbyte *);
+extern void __glXDispSwap_LoadMatrixf(GLbyte *);
+extern void __glXDispSwap_LoadMatrixd(GLbyte *);
+extern void __glXDispSwap_MatrixMode(GLbyte *);
+extern void __glXDispSwap_MultMatrixf(GLbyte *);
+extern void __glXDispSwap_MultMatrixd(GLbyte *);
+extern void __glXDispSwap_Ortho(GLbyte *);
+extern void __glXDispSwap_PopMatrix(GLbyte *);
+extern void __glXDispSwap_PushMatrix(GLbyte *);
+extern void __glXDispSwap_Rotated(GLbyte *);
+extern void __glXDispSwap_Rotatef(GLbyte *);
+extern void __glXDispSwap_Scaled(GLbyte *);
+extern void __glXDispSwap_Scalef(GLbyte *);
+extern void __glXDispSwap_Translated(GLbyte *);
+extern void __glXDispSwap_Translatef(GLbyte *);
+extern void __glXDispSwap_Viewport(GLbyte *);
+extern void __glXDispSwap_PolygonOffset(GLbyte *);
+extern void __glXDispSwap_DrawArrays(GLbyte *);
+extern void __glXDispSwap_Indexubv(GLbyte *);
+extern void __glXDispSwap_ColorSubTable(GLbyte *);
+extern void __glXDispSwap_CopyColorSubTable(GLbyte *);
+extern void __glXDispSwap_ActiveTextureARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte *);
-extern void __glXDispSwap_TexSubImage1D(GLbyte*);
-extern void __glXDispSwap_TexSubImage2D(GLbyte*);
-extern void __glXDispSwap_ConvolutionFilter1D(GLbyte*);
-extern void __glXDispSwap_ConvolutionFilter2D(GLbyte*);
-extern void __glXDispSwap_ConvolutionParameterfv(GLbyte*);
-extern void __glXDispSwap_ConvolutionParameteriv(GLbyte*);
-extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte*);
-extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte*);
-extern void __glXDispSwap_SeparableFilter2D(GLbyte*);
-extern void __glXDispSwap_TexImage3D(GLbyte*);
-extern void __glXDispSwap_TexSubImage3D(GLbyte*);
-extern void __glXDispSwap_DrawArrays(GLbyte*);
-extern void __glXDispSwap_PrioritizeTextures(GLbyte*);
-extern void __glXDispSwap_CopyTexImage1D(GLbyte*);
-extern void __glXDispSwap_CopyTexImage2D(GLbyte*);
-extern void __glXDispSwap_CopyTexSubImage1D(GLbyte*);
-extern void __glXDispSwap_CopyTexSubImage2D(GLbyte*);
-extern void __glXDispSwap_CopyTexSubImage3D(GLbyte*);
+extern void __glXDispSwap_TexSubImage1D(GLbyte *);
+extern void __glXDispSwap_TexSubImage2D(GLbyte *);
+extern void __glXDispSwap_ConvolutionFilter1D(GLbyte *);
+extern void __glXDispSwap_ConvolutionFilter2D(GLbyte *);
+extern void __glXDispSwap_ConvolutionParameterfv(GLbyte *);
+extern void __glXDispSwap_ConvolutionParameteriv(GLbyte *);
+extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *);
+extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *);
+extern void __glXDispSwap_SeparableFilter2D(GLbyte *);
+extern void __glXDispSwap_TexImage3D(GLbyte *);
+extern void __glXDispSwap_TexSubImage3D(GLbyte *);
+extern void __glXDispSwap_DrawArrays(GLbyte *);
+extern void __glXDispSwap_PrioritizeTextures(GLbyte *);
+extern void __glXDispSwap_CopyTexImage1D(GLbyte *);
+extern void __glXDispSwap_CopyTexImage2D(GLbyte *);
+extern void __glXDispSwap_CopyTexSubImage1D(GLbyte *);
+extern void __glXDispSwap_CopyTexSubImage2D(GLbyte *);
+extern void __glXDispSwap_CopyTexSubImage3D(GLbyte *);
#define __GLX_MIN_GLXCMD_OPCODE 1
#define __GLX_MAX_GLXCMD_OPCODE 20
@@ -673,4 +677,4 @@ extern void __glXDispSwap_CopyTexSubImage3D(GLbyte*);
extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE];
extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE];
-#endif /* _GLX_g_disptab_h_ */
+#endif /* _GLX_g_disptab_h_ */
diff --git a/xorg-server/hw/dmx/glxProxy/g_renderswap.c b/xorg-server/hw/dmx/glxProxy/g_renderswap.c
index e434a71b6..ce1c609bd 100644
--- a/xorg-server/hw/dmx/glxProxy/g_renderswap.c
+++ b/xorg-server/hw/dmx/glxProxy/g_renderswap.c
@@ -34,2401 +34,2630 @@
#include "unpack.h"
#include "compsize.h"
-void __glXDispSwap_CallList(GLbyte *pc)
+void
+__glXDispSwap_CallList(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ListBase(GLbyte *pc)
+void
+__glXDispSwap_ListBase(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Begin(GLbyte *pc)
+void
+__glXDispSwap_Begin(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Color3bv(GLbyte *pc)
+void
+__glXDispSwap_Color3bv(GLbyte * pc)
{
}
-void __glXDispSwap_Color3dv(GLbyte *pc)
+void
+__glXDispSwap_Color3dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color3fv(GLbyte *pc)
+void
+__glXDispSwap_Color3fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color3iv(GLbyte *pc)
+void
+__glXDispSwap_Color3iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color3sv(GLbyte *pc)
+void
+__glXDispSwap_Color3sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color3ubv(GLbyte *pc)
+void
+__glXDispSwap_Color3ubv(GLbyte * pc)
{
}
-void __glXDispSwap_Color3uiv(GLbyte *pc)
+void
+__glXDispSwap_Color3uiv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color3usv(GLbyte *pc)
+void
+__glXDispSwap_Color3usv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color4bv(GLbyte *pc)
+void
+__glXDispSwap_Color4bv(GLbyte * pc)
{
}
-void __glXDispSwap_Color4dv(GLbyte *pc)
+void
+__glXDispSwap_Color4dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Color4fv(GLbyte *pc)
+void
+__glXDispSwap_Color4fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Color4iv(GLbyte *pc)
+void
+__glXDispSwap_Color4iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Color4sv(GLbyte *pc)
+void
+__glXDispSwap_Color4sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Color4ubv(GLbyte *pc)
+void
+__glXDispSwap_Color4ubv(GLbyte * pc)
{
}
-void __glXDispSwap_Color4uiv(GLbyte *pc)
+void
+__glXDispSwap_Color4uiv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Color4usv(GLbyte *pc)
+void
+__glXDispSwap_Color4usv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_EdgeFlagv(GLbyte *pc)
+void
+__glXDispSwap_EdgeFlagv(GLbyte * pc)
{
}
-void __glXDispSwap_End(GLbyte *pc)
+void
+__glXDispSwap_End(GLbyte * pc)
{
}
-void __glXDispSwap_Indexdv(GLbyte *pc)
+void
+__glXDispSwap_Indexdv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 8);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 8);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_Indexfv(GLbyte *pc)
+void
+__glXDispSwap_Indexfv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_Indexiv(GLbyte *pc)
+void
+__glXDispSwap_Indexiv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_Indexsv(GLbyte *pc)
+void
+__glXDispSwap_Indexsv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_Normal3bv(GLbyte *pc)
+void
+__glXDispSwap_Normal3bv(GLbyte * pc)
{
}
-void __glXDispSwap_Normal3dv(GLbyte *pc)
+void
+__glXDispSwap_Normal3dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Normal3fv(GLbyte *pc)
+void
+__glXDispSwap_Normal3fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Normal3iv(GLbyte *pc)
+void
+__glXDispSwap_Normal3iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Normal3sv(GLbyte *pc)
+void
+__glXDispSwap_Normal3sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_RasterPos2dv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos2dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_RasterPos2fv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos2fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_RasterPos2iv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos2iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_RasterPos2sv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos2sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_RasterPos3dv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos3dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_RasterPos3fv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos3fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_RasterPos3iv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos3iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_RasterPos3sv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos3sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_RasterPos4dv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos4dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_RasterPos4fv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos4fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_RasterPos4iv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos4iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_RasterPos4sv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos4sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Rectdv(GLbyte *pc)
+void
+__glXDispSwap_Rectdv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 16, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 16, 2);
}
-void __glXDispSwap_Rectfv(GLbyte *pc)
+void
+__glXDispSwap_Rectfv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, 2);
}
-void __glXDispSwap_Rectiv(GLbyte *pc)
+void
+__glXDispSwap_Rectiv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 2);
- __GLX_SWAP_INT_ARRAY(pc + 8, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 8, 2);
}
-void __glXDispSwap_Rectsv(GLbyte *pc)
+void
+__glXDispSwap_Rectsv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
- __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
}
-void __glXDispSwap_TexCoord1dv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord1dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 8);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 8);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_TexCoord1fv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord1fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_TexCoord1iv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord1iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_TexCoord1sv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord1sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_TexCoord2dv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord2dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_TexCoord2fv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord2fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_TexCoord2iv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord2iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_TexCoord2sv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord2sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_TexCoord3dv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord3dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_TexCoord3fv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord3fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_TexCoord3iv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord3iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_TexCoord3sv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord3sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_TexCoord4dv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord4dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_TexCoord4fv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord4fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_TexCoord4iv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord4iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_TexCoord4sv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord4sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Vertex2dv(GLbyte *pc)
+void
+__glXDispSwap_Vertex2dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_Vertex2fv(GLbyte *pc)
+void
+__glXDispSwap_Vertex2fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_Vertex2iv(GLbyte *pc)
+void
+__glXDispSwap_Vertex2iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_Vertex2sv(GLbyte *pc)
+void
+__glXDispSwap_Vertex2sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_Vertex3dv(GLbyte *pc)
+void
+__glXDispSwap_Vertex3dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Vertex3fv(GLbyte *pc)
+void
+__glXDispSwap_Vertex3fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Vertex3iv(GLbyte *pc)
+void
+__glXDispSwap_Vertex3iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Vertex3sv(GLbyte *pc)
+void
+__glXDispSwap_Vertex3sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Vertex4dv(GLbyte *pc)
+void
+__glXDispSwap_Vertex4dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Vertex4fv(GLbyte *pc)
+void
+__glXDispSwap_Vertex4fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Vertex4iv(GLbyte *pc)
+void
+__glXDispSwap_Vertex4iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Vertex4sv(GLbyte *pc)
+void
+__glXDispSwap_Vertex4sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_ClipPlane(GLbyte *pc)
+void
+__glXDispSwap_ClipPlane(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 36);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 36);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 32);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_ColorMaterial(GLbyte *pc)
+void
+__glXDispSwap_ColorMaterial(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_CullFace(GLbyte *pc)
+void
+__glXDispSwap_CullFace(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Fogf(GLbyte *pc)
+void
+__glXDispSwap_Fogf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_Fogfv(GLbyte *pc)
+void
+__glXDispSwap_Fogfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- pname = *(GLenum *)(pc + 0);
- compsize = __glFogfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *) (pc + 0);
+ compsize = __glFogfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
}
-void __glXDispSwap_Fogi(GLbyte *pc)
+void
+__glXDispSwap_Fogi(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_Fogiv(GLbyte *pc)
+void
+__glXDispSwap_Fogiv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 0);
- pname = *(GLenum *)(pc + 0);
- compsize = __glFogiv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *) (pc + 0);
+ compsize = __glFogiv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
}
-void __glXDispSwap_FrontFace(GLbyte *pc)
+void
+__glXDispSwap_FrontFace(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Hint(GLbyte *pc)
+void
+__glXDispSwap_Hint(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_Lightf(GLbyte *pc)
+void
+__glXDispSwap_Lightf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_Lightfv(GLbyte *pc)
+void
+__glXDispSwap_Lightfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glLightfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glLightfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_Lighti(GLbyte *pc)
+void
+__glXDispSwap_Lighti(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_Lightiv(GLbyte *pc)
+void
+__glXDispSwap_Lightiv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glLightiv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glLightiv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_LightModelf(GLbyte *pc)
+void
+__glXDispSwap_LightModelf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_LightModelfv(GLbyte *pc)
+void
+__glXDispSwap_LightModelfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- pname = *(GLenum *)(pc + 0);
- compsize = __glLightModelfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *) (pc + 0);
+ compsize = __glLightModelfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
}
-void __glXDispSwap_LightModeli(GLbyte *pc)
+void
+__glXDispSwap_LightModeli(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_LightModeliv(GLbyte *pc)
+void
+__glXDispSwap_LightModeliv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- pname = *(GLenum *)(pc + 0);
- compsize = __glLightModeliv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *) (pc + 0);
+ compsize = __glLightModeliv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
}
-void __glXDispSwap_LineStipple(GLbyte *pc)
+void
+__glXDispSwap_LineStipple(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT(pc + 4);
}
-void __glXDispSwap_LineWidth(GLbyte *pc)
+void
+__glXDispSwap_LineWidth(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 0);
}
-void __glXDispSwap_Materialf(GLbyte *pc)
+void
+__glXDispSwap_Materialf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_Materialfv(GLbyte *pc)
+void
+__glXDispSwap_Materialfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glMaterialfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glMaterialfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_Materiali(GLbyte *pc)
+void
+__glXDispSwap_Materiali(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_Materialiv(GLbyte *pc)
+void
+__glXDispSwap_Materialiv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glMaterialiv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glMaterialiv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_PointSize(GLbyte *pc)
+void
+__glXDispSwap_PointSize(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 0);
}
-void __glXDispSwap_PolygonMode(GLbyte *pc)
+void
+__glXDispSwap_PolygonMode(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_Scissor(GLbyte *pc)
+void
+__glXDispSwap_Scissor(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
}
-void __glXDispSwap_ShadeModel(GLbyte *pc)
+void
+__glXDispSwap_ShadeModel(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_TexParameterf(GLbyte *pc)
+void
+__glXDispSwap_TexParameterf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_TexParameterfv(GLbyte *pc)
+void
+__glXDispSwap_TexParameterfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexParameterfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexParameterfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexParameteri(GLbyte *pc)
+void
+__glXDispSwap_TexParameteri(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_TexParameteriv(GLbyte *pc)
+void
+__glXDispSwap_TexParameteriv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexParameteriv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexParameteriv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexEnvf(GLbyte *pc)
+void
+__glXDispSwap_TexEnvf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_TexEnvfv(GLbyte *pc)
+void
+__glXDispSwap_TexEnvfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexEnvfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexEnvfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexEnvi(GLbyte *pc)
+void
+__glXDispSwap_TexEnvi(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_TexEnviv(GLbyte *pc)
+void
+__glXDispSwap_TexEnviv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexEnviv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexEnviv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexGend(GLbyte *pc)
+void
+__glXDispSwap_TexGend(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_DOUBLE(pc + 0);
}
-void __glXDispSwap_TexGendv(GLbyte *pc)
+void
+__glXDispSwap_TexGendv(GLbyte * pc)
{
- GLenum pname;
- GLint cmdlen;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint cmdlen;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexGendv_size(pname);
- if (compsize < 0) compsize = 0;
- cmdlen = __GLX_PAD(8+compsize*8);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexGendv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ cmdlen = __GLX_PAD(8 + compsize * 8);
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, cmdlen);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, cmdlen);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexGenf(GLbyte *pc)
+void
+__glXDispSwap_TexGenf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_TexGenfv(GLbyte *pc)
+void
+__glXDispSwap_TexGenfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexGenfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexGenfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexGeni(GLbyte *pc)
+void
+__glXDispSwap_TexGeni(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_TexGeniv(GLbyte *pc)
+void
+__glXDispSwap_TexGeniv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexGeniv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexGeniv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_InitNames(GLbyte *pc)
+void
+__glXDispSwap_InitNames(GLbyte * pc)
{
}
-void __glXDispSwap_LoadName(GLbyte *pc)
+void
+__glXDispSwap_LoadName(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_PassThrough(GLbyte *pc)
+void
+__glXDispSwap_PassThrough(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 0);
}
-void __glXDispSwap_PopName(GLbyte *pc)
+void
+__glXDispSwap_PopName(GLbyte * pc)
{
}
-void __glXDispSwap_PushName(GLbyte *pc)
+void
+__glXDispSwap_PushName(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_DrawBuffer(GLbyte *pc)
+void
+__glXDispSwap_DrawBuffer(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Clear(GLbyte *pc)
+void
+__glXDispSwap_Clear(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ClearAccum(GLbyte *pc)
+void
+__glXDispSwap_ClearAccum(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_FLOAT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
}
-void __glXDispSwap_ClearIndex(GLbyte *pc)
+void
+__glXDispSwap_ClearIndex(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 0);
}
-void __glXDispSwap_ClearColor(GLbyte *pc)
+void
+__glXDispSwap_ClearColor(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_FLOAT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
}
-void __glXDispSwap_ClearStencil(GLbyte *pc)
+void
+__glXDispSwap_ClearStencil(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ClearDepth(GLbyte *pc)
+void
+__glXDispSwap_ClearDepth(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 8);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 8);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 0);
}
-void __glXDispSwap_StencilMask(GLbyte *pc)
+void
+__glXDispSwap_StencilMask(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ColorMask(GLbyte *pc)
+void
+__glXDispSwap_ColorMask(GLbyte * pc)
{
}
-void __glXDispSwap_DepthMask(GLbyte *pc)
+void
+__glXDispSwap_DepthMask(GLbyte * pc)
{
}
-void __glXDispSwap_IndexMask(GLbyte *pc)
+void
+__glXDispSwap_IndexMask(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Accum(GLbyte *pc)
+void
+__glXDispSwap_Accum(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_Disable(GLbyte *pc)
+void
+__glXDispSwap_Disable(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Enable(GLbyte *pc)
+void
+__glXDispSwap_Enable(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_PopAttrib(GLbyte *pc)
+void
+__glXDispSwap_PopAttrib(GLbyte * pc)
{
}
-void __glXDispSwap_PushAttrib(GLbyte *pc)
+void
+__glXDispSwap_PushAttrib(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_MapGrid1d(GLbyte *pc)
+void
+__glXDispSwap_MapGrid1d(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 20);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 20);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
}
-void __glXDispSwap_MapGrid1f(GLbyte *pc)
+void
+__glXDispSwap_MapGrid1f(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_MapGrid2d(GLbyte *pc)
+void
+__glXDispSwap_MapGrid2d(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 40);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 40);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 32);
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_INT(pc + 36);
- __GLX_SWAP_DOUBLE(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_INT(pc + 36);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
}
-void __glXDispSwap_MapGrid2f(GLbyte *pc)
+void
+__glXDispSwap_MapGrid2f(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_FLOAT(pc + 16);
- __GLX_SWAP_FLOAT(pc + 20);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 16);
+ __GLX_SWAP_FLOAT(pc + 20);
}
-void __glXDispSwap_EvalCoord1dv(GLbyte *pc)
+void
+__glXDispSwap_EvalCoord1dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 8);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 8);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_EvalCoord1fv(GLbyte *pc)
+void
+__glXDispSwap_EvalCoord1fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_EvalCoord2dv(GLbyte *pc)
+void
+__glXDispSwap_EvalCoord2dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_EvalCoord2fv(GLbyte *pc)
+void
+__glXDispSwap_EvalCoord2fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_EvalMesh1(GLbyte *pc)
+void
+__glXDispSwap_EvalMesh1(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_EvalPoint1(GLbyte *pc)
+void
+__glXDispSwap_EvalPoint1(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_EvalMesh2(GLbyte *pc)
+void
+__glXDispSwap_EvalMesh2(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
}
-void __glXDispSwap_EvalPoint2(GLbyte *pc)
+void
+__glXDispSwap_EvalPoint2(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_AlphaFunc(GLbyte *pc)
+void
+__glXDispSwap_AlphaFunc(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_BlendFunc(GLbyte *pc)
+void
+__glXDispSwap_BlendFunc(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_LogicOp(GLbyte *pc)
+void
+__glXDispSwap_LogicOp(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_StencilFunc(GLbyte *pc)
+void
+__glXDispSwap_StencilFunc(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_StencilOp(GLbyte *pc)
+void
+__glXDispSwap_StencilOp(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_DepthFunc(GLbyte *pc)
+void
+__glXDispSwap_DepthFunc(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_PixelZoom(GLbyte *pc)
+void
+__glXDispSwap_PixelZoom(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_PixelTransferf(GLbyte *pc)
+void
+__glXDispSwap_PixelTransferf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_PixelTransferi(GLbyte *pc)
+void
+__glXDispSwap_PixelTransferi(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_PixelMapfv(GLbyte *pc)
+void
+__glXDispSwap_PixelMapfv(GLbyte * pc)
{
- GLint mapsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLint mapsize;
- __GLX_SWAP_INT(pc + 4);
- mapsize = *(GLint *)(pc + 4);
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, mapsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *) (pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, mapsize);
}
-void __glXDispSwap_PixelMapuiv(GLbyte *pc)
+void
+__glXDispSwap_PixelMapuiv(GLbyte * pc)
{
- GLint mapsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLint mapsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- mapsize = *(GLint *)(pc + 4);
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, mapsize);
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *) (pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, mapsize);
}
-void __glXDispSwap_PixelMapusv(GLbyte *pc)
+void
+__glXDispSwap_PixelMapusv(GLbyte * pc)
{
- GLint mapsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLint mapsize;
- __GLX_SWAP_INT(pc + 4);
- mapsize = *(GLint *)(pc + 4);
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT_ARRAY(pc + 8, mapsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *) (pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 8, mapsize);
}
-void __glXDispSwap_ReadBuffer(GLbyte *pc)
+void
+__glXDispSwap_ReadBuffer(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_CopyPixels(GLbyte *pc)
+void
+__glXDispSwap_CopyPixels(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
}
-void __glXDispSwap_DepthRange(GLbyte *pc)
+void
+__glXDispSwap_DepthRange(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
}
-void __glXDispSwap_Frustum(GLbyte *pc)
+void
+__glXDispSwap_Frustum(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 48);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 48);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 24);
- __GLX_SWAP_DOUBLE(pc + 32);
- __GLX_SWAP_DOUBLE(pc + 40);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_DOUBLE(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 40);
}
-void __glXDispSwap_LoadIdentity(GLbyte *pc)
+void
+__glXDispSwap_LoadIdentity(GLbyte * pc)
{
}
-void __glXDispSwap_LoadMatrixf(GLbyte *pc)
+void
+__glXDispSwap_LoadMatrixf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
}
-void __glXDispSwap_LoadMatrixd(GLbyte *pc)
+void
+__glXDispSwap_LoadMatrixd(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 128);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 128);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
}
-void __glXDispSwap_MatrixMode(GLbyte *pc)
+void
+__glXDispSwap_MatrixMode(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_MultMatrixf(GLbyte *pc)
+void
+__glXDispSwap_MultMatrixf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
}
-void __glXDispSwap_MultMatrixd(GLbyte *pc)
+void
+__glXDispSwap_MultMatrixd(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 128);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 128);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
}
-void __glXDispSwap_Ortho(GLbyte *pc)
+void
+__glXDispSwap_Ortho(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 48);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 48);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 24);
- __GLX_SWAP_DOUBLE(pc + 32);
- __GLX_SWAP_DOUBLE(pc + 40);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_DOUBLE(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 40);
}
-void __glXDispSwap_PopMatrix(GLbyte *pc)
+void
+__glXDispSwap_PopMatrix(GLbyte * pc)
{
}
-void __glXDispSwap_PushMatrix(GLbyte *pc)
+void
+__glXDispSwap_PushMatrix(GLbyte * pc)
{
}
-void __glXDispSwap_Rotated(GLbyte *pc)
+void
+__glXDispSwap_Rotated(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
}
-void __glXDispSwap_Rotatef(GLbyte *pc)
+void
+__glXDispSwap_Rotatef(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_FLOAT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
}
-void __glXDispSwap_Scaled(GLbyte *pc)
+void
+__glXDispSwap_Scaled(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
}
-void __glXDispSwap_Scalef(GLbyte *pc)
+void
+__glXDispSwap_Scalef(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_Translated(GLbyte *pc)
+void
+__glXDispSwap_Translated(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
}
-void __glXDispSwap_Translatef(GLbyte *pc)
+void
+__glXDispSwap_Translatef(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_Viewport(GLbyte *pc)
+void
+__glXDispSwap_Viewport(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
}
-void __glXDispSwap_PolygonOffset(GLbyte *pc)
+void
+__glXDispSwap_PolygonOffset(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_CopyTexImage1D(GLbyte *pc)
+void
+__glXDispSwap_CopyTexImage1D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
- __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
}
-void __glXDispSwap_CopyTexImage2D(GLbyte *pc)
+void
+__glXDispSwap_CopyTexImage2D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
- __GLX_SWAP_INT(pc + 24);
- __GLX_SWAP_INT(pc + 28);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
}
-void __glXDispSwap_CopyTexSubImage1D(GLbyte *pc)
+void
+__glXDispSwap_CopyTexSubImage1D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
}
-void __glXDispSwap_CopyTexSubImage2D(GLbyte *pc)
+void
+__glXDispSwap_CopyTexSubImage2D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
- __GLX_SWAP_INT(pc + 24);
- __GLX_SWAP_INT(pc + 28);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
}
-void __glXDispSwap_BindTexture(GLbyte *pc)
+void
+__glXDispSwap_BindTexture(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_PrioritizeTextures(GLbyte *pc)
+void
+__glXDispSwap_PrioritizeTextures(GLbyte * pc)
{
- GLsizei n;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLsizei n;
- __GLX_SWAP_INT(pc + 0);
- n = *(GLsizei *)(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 4, n);
- __GLX_SWAP_FLOAT_ARRAY(pc + 4+n*4, n);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ n = *(GLsizei *) (pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, n);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4 + n * 4, n);
}
-void __glXDispSwap_Indexubv(GLbyte *pc)
+void
+__glXDispSwap_Indexubv(GLbyte * pc)
{
}
-void __glXDispSwap_BlendColor(GLbyte *pc)
+void
+__glXDispSwap_BlendColor(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_FLOAT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
}
-void __glXDispSwap_BlendEquation(GLbyte *pc)
+void
+__glXDispSwap_BlendEquation(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ColorTableParameterfv(GLbyte *pc)
+void
+__glXDispSwap_ColorTableParameterfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glColorTableParameterfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glColorTableParameterfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_ColorTableParameteriv(GLbyte *pc)
+void
+__glXDispSwap_ColorTableParameteriv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glColorTableParameteriv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glColorTableParameteriv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_CopyColorTable(GLbyte *pc)
+void
+__glXDispSwap_CopyColorTable(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
}
-void __glXDispSwap_CopyColorSubTable(GLbyte *pc)
+void
+__glXDispSwap_CopyColorSubTable(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
}
-void __glXDispSwap_ConvolutionParameterf(GLbyte *pc)
+void
+__glXDispSwap_ConvolutionParameterf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_ConvolutionParameterfv(GLbyte *pc)
+void
+__glXDispSwap_ConvolutionParameterfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glConvolutionParameterfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glConvolutionParameterfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_ConvolutionParameteri(GLbyte *pc)
+void
+__glXDispSwap_ConvolutionParameteri(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_ConvolutionParameteriv(GLbyte *pc)
+void
+__glXDispSwap_ConvolutionParameteriv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glConvolutionParameteriv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glConvolutionParameteriv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *pc)
+void
+__glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
}
-void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *pc)
+void
+__glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
}
-void __glXDispSwap_Histogram(GLbyte *pc)
+void
+__glXDispSwap_Histogram(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_Minmax(GLbyte *pc)
+void
+__glXDispSwap_Minmax(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_ResetHistogram(GLbyte *pc)
+void
+__glXDispSwap_ResetHistogram(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ResetMinmax(GLbyte *pc)
+void
+__glXDispSwap_ResetMinmax(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_CopyTexSubImage3D(GLbyte *pc)
+void
+__glXDispSwap_CopyTexSubImage3D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
- __GLX_SWAP_INT(pc + 24);
- __GLX_SWAP_INT(pc + 28);
- __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
+ __GLX_SWAP_INT(pc + 32);
}
-void __glXDispSwap_ActiveTextureARB(GLbyte *pc)
+void
+__glXDispSwap_ActiveTextureARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 12);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 12);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1);
}
-void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 4, 1);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 1);
}
-void __glXDispSwap_MultiTexCoord1svARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord1svARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT_ARRAY(pc + 4, 1);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 1);
}
-void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 20);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 20);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2);
}
-void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 4, 2);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 2);
}
-void __glXDispSwap_MultiTexCoord2svARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord2svARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
}
-void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 28);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 28);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 24);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3);
}
-void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 4, 3);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 3);
}
-void __glXDispSwap_MultiTexCoord3svARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord3svARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT_ARRAY(pc + 4, 3);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 3);
}
-void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 36);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 36);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 32);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4);
}
-void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 4, 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 4);
}
-void __glXDispSwap_MultiTexCoord4svARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord4svARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT_ARRAY(pc + 4, 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 4);
}
-
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c
index fb4bce850..49c6ef1ed 100644
--- a/xorg-server/hw/dmx/glxProxy/glxcmds.c
+++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c
@@ -59,71 +59,78 @@
#endif
extern __GLXFBConfig **__glXFBConfigs;
-extern int __glXNumFBConfigs;
+extern int __glXNumFBConfigs;
-extern int glxIsExtensionSupported( char *ext );
-extern int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
+extern int glxIsExtensionSupported(char *ext);
+extern int __glXGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc);
#define BE_TO_CLIENT_ERROR(x) \
( (x) >= __glXerrorBase ? \
(x) - dmxScreen->glxErrorBase + __glXerrorBase \
: (x) )
-static __GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id )
+static __GLXFBConfig *
+glxLookupFBConfig(GLXFBConfigID id)
{
- int i,j;
+ int i, j;
- for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) {
- if ( __glXFBConfigs[j]->id == id)
- return __glXFBConfigs[j];
- }
+ for (i = 0, j = 0; i < __glXNumFBConfigs;
+ i++, j += (__glXNumActiveScreens + 1)) {
+ if (__glXFBConfigs[j]->id == id)
+ return __glXFBConfigs[j];
+ }
- return NULL;
+ return NULL;
}
-static __GLXFBConfig *glxLookupFBConfigByVID( VisualID vid )
+static __GLXFBConfig *
+glxLookupFBConfigByVID(VisualID vid)
{
- int i,j;
+ int i, j;
- for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) {
- if ( __glXFBConfigs[j]->associatedVisualId == vid)
- return __glXFBConfigs[j];
- }
+ for (i = 0, j = 0; i < __glXNumFBConfigs;
+ i++, j += (__glXNumActiveScreens + 1)) {
+ if (__glXFBConfigs[j]->associatedVisualId == vid)
+ return __glXFBConfigs[j];
+ }
- return NULL;
+ return NULL;
}
-static __GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen )
+static __GLXFBConfig *
+glxLookupBackEndFBConfig(GLXFBConfigID id, int screen)
{
- int i;
- int j;
+ int i;
+ int j;
- for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) {
- if ( __glXFBConfigs[j]->id == id)
- return __glXFBConfigs[j+screen+1];
- }
+ for (i = 0, j = 0; i < __glXNumFBConfigs;
+ i++, j += (__glXNumActiveScreens + 1)) {
+ if (__glXFBConfigs[j]->id == id)
+ return __glXFBConfigs[j + screen + 1];
+ }
- return NULL;
+ return NULL;
}
-Display *GetBackEndDisplay( __GLXclientState *cl, int s )
+Display *
+GetBackEndDisplay(__GLXclientState * cl, int s)
{
- if (! cl->be_displays[s] ) {
- cl->be_displays[s] = XOpenDisplay( DisplayString(dmxScreens[s].beDisplay) );
- }
- return cl->be_displays[s];
+ if (!cl->be_displays[s]) {
+ cl->be_displays[s] =
+ XOpenDisplay(DisplayString(dmxScreens[s].beDisplay));
+ }
+ return cl->be_displays[s];
}
/*
** Create a GL context with the given properties.
*/
-static int CreateContext(__GLXclientState *cl,
- GLXContextID gcId,
- VisualID vid, GLXFBConfigID fbconfigId,
- int screen,
- GLXContextID shareList,
- int isDirect )
+static int
+CreateContext(__GLXclientState * cl,
+ GLXContextID gcId,
+ VisualID vid, GLXFBConfigID fbconfigId,
+ int screen, GLXContextID shareList, int isDirect)
{
ClientPtr client = cl->client;
xGLXCreateContextReq *be_req;
@@ -142,20 +149,19 @@ static int CreateContext(__GLXclientState *cl,
GLXFBConfigID be_fbconfigId = 0;
int num_be_screens;
Display *dpy;
-
+
/*
- ** Check if screen exists.
- */
+ ** Check if screen exists.
+ */
if (screen >= screenInfo.numScreens) {
- client->errorValue = screen;
- return BadValue;
+ client->errorValue = screen;
+ return BadValue;
}
-
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -164,87 +170,88 @@ static int CreateContext(__GLXclientState *cl,
**
*/
if (shareList == None) {
- shareglxc = NULL;
- } else {
- dixLookupResourceByType((pointer*) &shareglxc, shareList,
- __glXContextRes, NullClient, DixUnknownAccess);
- if (!shareglxc) {
- client->errorValue = shareList;
- return __glXBadContext;
- }
+ shareglxc = NULL;
+ }
+ else {
+ dixLookupResourceByType((pointer *) &shareglxc, shareList,
+ __glXContextRes, NullClient, DixUnknownAccess);
+ if (!shareglxc) {
+ client->errorValue = shareList;
+ return __glXBadContext;
+ }
}
/*
- ** Allocate memory for the new context
- */
+ ** Allocate memory for the new context
+ */
glxc = calloc(1, sizeof(__GLXcontext));
if (!glxc) {
- return BadAlloc;
+ return BadAlloc;
}
pScreen = screenInfo.screens[screen];
pGlxScreen = &__glXActiveScreens[screen];
if (fbconfigId != None) {
- glxc->pFBConfig = glxLookupFBConfig( fbconfigId );
- if (!glxc->pFBConfig) {
- client->errorValue = fbconfigId;
- free( glxc );
- return BadValue;
- }
- visual = glxc->pFBConfig->associatedVisualId;
+ glxc->pFBConfig = glxLookupFBConfig(fbconfigId);
+ if (!glxc->pFBConfig) {
+ client->errorValue = fbconfigId;
+ free(glxc);
+ return BadValue;
+ }
+ visual = glxc->pFBConfig->associatedVisualId;
}
else {
- glxc->pFBConfig = NULL;
+ glxc->pFBConfig = NULL;
}
if (visual != None) {
- /*
- ** Check if the visual ID is valid for this screen.
- */
- pVisual = pScreen->visuals;
- for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
- if (pVisual->vid == visual) {
- break;
- }
- }
- if (i == pScreen->numVisuals) {
- client->errorValue = visual;
- free( glxc );
- return BadValue;
- }
-
- pGlxVisual = pGlxScreen->pGlxVisual;
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == visual) {
- break;
- }
- }
- if (i == pGlxScreen->numVisuals) {
- /*
- ** Visual not support on this screen by this OpenGL implementation.
- */
- client->errorValue = visual;
- free( glxc );
- return BadValue;
- }
-
- if ( glxc->pFBConfig == NULL ) {
- glxc->pFBConfig = glxLookupFBConfigByVID( visual );
-
- if ( glxc->pFBConfig == NULL ) {
- /*
- * visual does not have an FBConfig ???
- client->errorValue = visual;
- free( glxc );
- return BadValue;
- */
- }
- }
+ /*
+ ** Check if the visual ID is valid for this screen.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visual;
+ free(glxc);
+ return BadValue;
+ }
+
+ pGlxVisual = pGlxScreen->pGlxVisual;
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ ** Visual not support on this screen by this OpenGL implementation.
+ */
+ client->errorValue = visual;
+ free(glxc);
+ return BadValue;
+ }
+
+ if (glxc->pFBConfig == NULL) {
+ glxc->pFBConfig = glxLookupFBConfigByVID(visual);
+
+ if (glxc->pFBConfig == NULL) {
+ /*
+ * visual does not have an FBConfig ???
+ client->errorValue = visual;
+ free( glxc );
+ return BadValue;
+ */
+ }
+ }
}
else {
- pVisual = NULL;
- pGlxVisual = NULL;
+ pVisual = NULL;
+ pGlxVisual = NULL;
}
glxc->pScreen = pScreen;
@@ -256,140 +263,152 @@ static int CreateContext(__GLXclientState *cl,
* allocate memory for back-end servers info
*/
num_be_screens = to_screen - from_screen + 1;
- glxc->real_ids = (XID *)malloc(sizeof(XID) * num_be_screens);
+ glxc->real_ids = (XID *) malloc(sizeof(XID) * num_be_screens);
if (!glxc->real_ids) {
- return BadAlloc;
+ return BadAlloc;
}
- glxc->real_vids = (XID *)malloc(sizeof(XID) * num_be_screens);
+ glxc->real_vids = (XID *) malloc(sizeof(XID) * num_be_screens);
if (!glxc->real_vids) {
- return BadAlloc;
+ return BadAlloc;
}
for (screen = from_screen; screen <= to_screen; screen++) {
- int sent = 0;
- pScreen = screenInfo.screens[screen];
- pGlxScreen = &__glXActiveScreens[screen];
- dmxScreen = &dmxScreens[screen];
-
- if (glxc->pFBConfig) {
- __GLXFBConfig *beFBConfig = glxLookupBackEndFBConfig( glxc->pFBConfig->id,
- screen );
- be_fbconfigId = beFBConfig->id;
- }
-
- if (pGlxVisual) {
-
- be_vid = glxMatchGLXVisualInConfigList( pGlxVisual,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals );
-
- if (!be_vid) {
- /* visual is not supported on the back-end server */
- free( glxc->real_ids );
- free( glxc->real_vids );
- free( glxc );
- return BadValue;
- }
- }
-
- glxc->real_ids[screen-from_screen] = XAllocID(GetBackEndDisplay(cl,screen));
-
- /* send the create context request to the back-end server */
- dpy = GetBackEndDisplay(cl,screen);
- if (glxc->pFBConfig) {
- /*Since for a certain visual both RGB and COLOR INDEX
- *can be on then the only parmeter to choose the renderType
- * should be the class of the colormap since all 4 first
- * classes does not support RGB mode only COLOR INDEX ,
- * and so TrueColor and DirectColor does not support COLOR INDEX*/
- int renderType = glxc->pFBConfig->renderType;
- if ( pVisual ) {
- switch ( pVisual->class ){
- case PseudoColor:
- case StaticColor:
- case GrayScale:
- case StaticGray:
- renderType = GLX_COLOR_INDEX_TYPE;
- break;
- case TrueColor:
- case DirectColor:
- default:
- renderType = GLX_RGBA_TYPE;
- break;
- }
- }
- if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- LockDisplay(dpy);
- GetReq(GLXCreateNewContext,be_new_req);
- be_new_req->reqType = dmxScreen->glxMajorOpcode;
- be_new_req->glxCode = X_GLXCreateNewContext;
- be_new_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
- be_new_req->fbconfig = (unsigned int)be_fbconfigId;
- be_new_req->screen = DefaultScreen(dpy);
- be_new_req->renderType = renderType;
-
- be_new_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
- be_new_req->isDirect = 0;
- UnlockDisplay(dpy);
- glxc->real_vids[screen-from_screen] = be_fbconfigId;
- sent = 1;
- }
- else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
-
- xGLXCreateContextWithConfigSGIXReq *ext_req;
- xGLXVendorPrivateReq *vpreq;
- LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivate,
- sz_xGLXCreateContextWithConfigSGIXReq - sz_xGLXVendorPrivateReq,
- vpreq);
- ext_req = (xGLXCreateContextWithConfigSGIXReq *)vpreq;
- ext_req->reqType = dmxScreen->glxMajorOpcode;
- ext_req->glxCode = X_GLXVendorPrivate;
- ext_req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX;
- ext_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
- ext_req->fbconfig = (unsigned int)be_fbconfigId;
- ext_req->screen = DefaultScreen(dpy);
- ext_req->renderType = renderType;
- ext_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
- ext_req->isDirect = 0;
- UnlockDisplay(dpy);
- glxc->real_vids[screen-from_screen] = be_fbconfigId;
- sent = 1;
- }
- }
-
- if (!sent) {
- LockDisplay(dpy);
- GetReq(GLXCreateContext,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCreateContext;
- be_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
- be_req->visual = (unsigned int)be_vid;
- be_req->screen = DefaultScreen(dpy);
- be_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
- be_req->isDirect = 0;
- UnlockDisplay(dpy);
- glxc->real_vids[screen-from_screen] = be_vid;
- }
- SyncHandle();
+ int sent = 0;
+
+ pScreen = screenInfo.screens[screen];
+ pGlxScreen = &__glXActiveScreens[screen];
+ dmxScreen = &dmxScreens[screen];
+
+ if (glxc->pFBConfig) {
+ __GLXFBConfig *beFBConfig =
+ glxLookupBackEndFBConfig(glxc->pFBConfig->id,
+ screen);
+
+ be_fbconfigId = beFBConfig->id;
+ }
+
+ if (pGlxVisual) {
+
+ be_vid = glxMatchGLXVisualInConfigList(pGlxVisual,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals);
+
+ if (!be_vid) {
+ /* visual is not supported on the back-end server */
+ free(glxc->real_ids);
+ free(glxc->real_vids);
+ free(glxc);
+ return BadValue;
+ }
+ }
+
+ glxc->real_ids[screen - from_screen] =
+ XAllocID(GetBackEndDisplay(cl, screen));
+
+ /* send the create context request to the back-end server */
+ dpy = GetBackEndDisplay(cl, screen);
+ if (glxc->pFBConfig) {
+ /*Since for a certain visual both RGB and COLOR INDEX
+ *can be on then the only parmeter to choose the renderType
+ * should be the class of the colormap since all 4 first
+ * classes does not support RGB mode only COLOR INDEX ,
+ * and so TrueColor and DirectColor does not support COLOR INDEX*/
+ int renderType = glxc->pFBConfig->renderType;
+
+ if (pVisual) {
+ switch (pVisual->class) {
+ case PseudoColor:
+ case StaticColor:
+ case GrayScale:
+ case StaticGray:
+ renderType = GLX_COLOR_INDEX_TYPE;
+ break;
+ case TrueColor:
+ case DirectColor:
+ default:
+ renderType = GLX_RGBA_TYPE;
+ break;
+ }
+ }
+ if (__GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ LockDisplay(dpy);
+ GetReq(GLXCreateNewContext, be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXCreateNewContext;
+ be_new_req->context =
+ (unsigned int) glxc->real_ids[screen - from_screen];
+ be_new_req->fbconfig = (unsigned int) be_fbconfigId;
+ be_new_req->screen = DefaultScreen(dpy);
+ be_new_req->renderType = renderType;
+
+ be_new_req->shareList =
+ (shareglxc ? shareglxc->real_ids[screen - from_screen] : 0);
+ be_new_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen - from_screen] = be_fbconfigId;
+ sent = 1;
+ }
+ else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
+
+ xGLXCreateContextWithConfigSGIXReq *ext_req;
+ xGLXVendorPrivateReq *vpreq;
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXVendorPrivate,
+ sz_xGLXCreateContextWithConfigSGIXReq -
+ sz_xGLXVendorPrivateReq, vpreq);
+ ext_req = (xGLXCreateContextWithConfigSGIXReq *) vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivate;
+ ext_req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX;
+ ext_req->context =
+ (unsigned int) glxc->real_ids[screen - from_screen];
+ ext_req->fbconfig = (unsigned int) be_fbconfigId;
+ ext_req->screen = DefaultScreen(dpy);
+ ext_req->renderType = renderType;
+ ext_req->shareList =
+ (shareglxc ? shareglxc->real_ids[screen - from_screen] : 0);
+ ext_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen - from_screen] = be_fbconfigId;
+ sent = 1;
+ }
+ }
+
+ if (!sent) {
+ LockDisplay(dpy);
+ GetReq(GLXCreateContext, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreateContext;
+ be_req->context =
+ (unsigned int) glxc->real_ids[screen - from_screen];
+ be_req->visual = (unsigned int) be_vid;
+ be_req->screen = DefaultScreen(dpy);
+ be_req->shareList =
+ (shareglxc ? shareglxc->real_ids[screen - from_screen] : 0);
+ be_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen - from_screen] = be_vid;
+ }
+ SyncHandle();
}
/*
- ** Register this context as a resource.
- */
- if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
- free( glxc->real_ids );
- free( glxc->real_vids );
- free( glxc );
- client->errorValue = gcId;
- return BadAlloc;
- }
-
+ ** Register this context as a resource.
+ */
+ if (!AddResource(gcId, __glXContextRes, (pointer) glxc)) {
+ free(glxc->real_ids);
+ free(glxc->real_vids);
+ free(glxc);
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
+
/*
- ** Finally, now that everything is working, setup the rest of the
- ** context.
- */
+ ** Finally, now that everything is working, setup the rest of the
+ ** context.
+ */
glxc->id = gcId;
glxc->share_id = shareList;
glxc->idExists = GL_TRUE;
@@ -398,38 +417,43 @@ static int CreateContext(__GLXclientState *cl,
return Success;
}
-int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreateContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
- return( CreateContext(cl, req->context,req->visual, None,
- req->screen, req->shareList, req->isDirect) );
+ return (CreateContext(cl, req->context, req->visual, None,
+ req->screen, req->shareList, req->isDirect));
}
-int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreateNewContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
- return( CreateContext(cl, req->context,None, req->fbconfig,
- req->screen, req->shareList, req->isDirect) );
+ return (CreateContext(cl, req->context, None, req->fbconfig,
+ req->screen, req->shareList, req->isDirect));
}
-int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc;
+ xGLXCreateContextWithConfigSGIXReq *req =
+ (xGLXCreateContextWithConfigSGIXReq *) pc;
- return( CreateContext(cl, req->context, None, req->fbconfig,
- req->screen, req->shareList, req->isDirect) );
+ return (CreateContext(cl, req->context, None, req->fbconfig,
+ req->screen, req->shareList, req->isDirect));
}
-int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryMaxSwapBarriersSGIXReq *req =
- (xGLXQueryMaxSwapBarriersSGIXReq *)pc;
+ (xGLXQueryMaxSwapBarriersSGIXReq *) pc;
xGLXQueryMaxSwapBarriersSGIXReply reply;
reply.type = X_Reply;
@@ -438,19 +462,21 @@ int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
reply.max = QueryMaxSwapBarriersSGIX(req->screen);
if (client->swapped) {
- __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply,
- (char *)&reply);
+ __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply,
+ (char *) &reply);
}
return Success;
}
-int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc;
+ xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc;
DrawablePtr pDraw;
__GLXpixmap *pGlxPixmap = NULL;
__glXWindow *pGlxWindow = NULL;
@@ -458,29 +484,32 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
if (rc != Success) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
+ dixLookupResourceByType((pointer *) &pGlxPixmap, req->drawable,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap)
+ pDraw = pGlxPixmap->pDraw;
}
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) pDraw = pGlxWindow->pDraw;
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, req->drawable,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow)
+ pDraw = pGlxWindow->pDraw;
}
if (!pDraw) {
- client->errorValue = req->drawable;
- return __glXBadDrawable;
+ client->errorValue = req->drawable;
+ return __glXBadDrawable;
}
return BindSwapBarrierSGIX(pDraw, req->barrier);
}
-int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc;
+ xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *) pc;
DrawablePtr pDraw, pMember = NULL;
__GLXpixmap *pGlxPixmap = NULL;
__glXWindow *pGlxWindow = NULL;
@@ -488,53 +517,57 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
if (rc != Success) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
+ dixLookupResourceByType((pointer *) &pGlxPixmap, req->drawable,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap)
+ pDraw = pGlxPixmap->pDraw;
}
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) pDraw = pGlxWindow->pDraw;
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, req->drawable,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow)
+ pDraw = pGlxWindow->pDraw;
}
if (!pDraw) {
- client->errorValue = req->drawable;
- return __glXBadDrawable;
+ client->errorValue = req->drawable;
+ return __glXBadDrawable;
}
if (req->member != None) {
- rc = dixLookupDrawable(&pMember, req->member, client, 0,
- DixGetAttrAccess);
- if (rc != Success) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, req->member,
+ rc = dixLookupDrawable(&pMember, req->member, client, 0,
+ DixGetAttrAccess);
+ if (rc != Success) {
+ dixLookupResourceByType((pointer *) &pGlxPixmap, req->member,
__glXPixmapRes, NullClient,
DixUnknownAccess);
- if (pGlxPixmap) pMember = pGlxPixmap->pDraw;
- }
+ if (pGlxPixmap)
+ pMember = pGlxPixmap->pDraw;
+ }
- if (!pMember && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, req->member,
+ if (!pMember && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, req->member,
__glXWindowRes, NullClient,
DixUnknownAccess);
- if (pGlxWindow) pMember = pGlxWindow->pDraw;
- }
+ if (pGlxWindow)
+ pMember = pGlxWindow->pDraw;
+ }
- if (!pMember) {
- client->errorValue = req->member;
- return __glXBadDrawable;
- }
+ if (!pMember) {
+ client->errorValue = req->member;
+ return __glXBadDrawable;
+ }
}
return JoinSwapGroupSGIX(pDraw, pMember);
}
-
/*
** Destroy a GL context as an X resource.
*/
-int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDestroyContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
@@ -544,46 +577,47 @@ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
int from_screen = 0;
int to_screen = 0;
int s;
-
- dixLookupResourceByType((pointer*) &glxc, gcId, __glXContextRes,
- NullClient, DixUnknownAccess);
+
+ dixLookupResourceByType((pointer *) &glxc, gcId, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (glxc) {
- /*
- ** Just free the resource; don't actually destroy the context,
- ** because it might be in use. The
- ** destroy method will be called by the resource destruction routine
- ** if necessary.
- */
- FreeResourceByType(gcId, __glXContextRes, FALSE);
+ /*
+ ** Just free the resource; don't actually destroy the context,
+ ** because it might be in use. The
+ ** destroy method will be called by the resource destruction routine
+ ** if necessary.
+ */
+ FreeResourceByType(gcId, __glXContextRes, FALSE);
- from_screen = to_screen = glxc->pScreen->myNum;
+ from_screen = to_screen = glxc->pScreen->myNum;
- } else {
- client->errorValue = gcId;
- return __glXBadContext;
+ }
+ else {
+ client->errorValue = gcId;
+ return __glXBadContext;
}
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
/*
* send DestroyContext request to all back-end servers
*/
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- LockDisplay(dpy);
- GetReq(GLXDestroyContext,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXDestroyContext;
- be_req->context = glxc->real_ids[s-from_screen];
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXDestroyContext, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXDestroyContext;
+ be_req->context = glxc->real_ids[s - from_screen];
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
@@ -600,83 +634,97 @@ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
/*
** Add a current context, and return the tag that will be used to refer to it.
*/
-static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, DrawablePtr pDraw)
+static int
+AddCurrentContext(__GLXclientState * cl, __GLXcontext * glxc, DrawablePtr pDraw)
{
int i;
int num = cl->numCurrentContexts;
__GLXcontext **table = cl->currentContexts;
- if (!glxc) return -1;
-
+ if (!glxc)
+ return -1;
+
/*
- ** Try to find an empty slot and use it.
- */
- for (i=0; i < num; i++) {
- if (!table[i]) {
- table[i] = glxc;
- return i+1;
- }
+ ** Try to find an empty slot and use it.
+ */
+ for (i = 0; i < num; i++) {
+ if (!table[i]) {
+ table[i] = glxc;
+ return i + 1;
+ }
}
/*
- ** Didn't find a free slot, so we'll have to grow the table.
- */
+ ** Didn't find a free slot, so we'll have to grow the table.
+ */
if (!num) {
- table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
- cl->currentDrawables = (DrawablePtr *) malloc(sizeof(DrawablePtr));
- cl->be_currentCTag = (GLXContextTag *) malloc(screenInfo.numScreens *sizeof(GLXContextTag));
- } else {
- table = (__GLXcontext **) realloc(table,
- (num+1)*sizeof(__GLXcontext *));
- cl->currentDrawables = (DrawablePtr *) realloc(
- cl->currentDrawables ,
- (num+1)*sizeof(DrawablePtr));
- cl->be_currentCTag = (GLXContextTag *) realloc(cl->be_currentCTag,
- (num+1)*screenInfo.numScreens*sizeof(GLXContextTag));
+ table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
+ cl->currentDrawables = (DrawablePtr *) malloc(sizeof(DrawablePtr));
+ cl->be_currentCTag =
+ (GLXContextTag *) malloc(screenInfo.numScreens *
+ sizeof(GLXContextTag));
+ }
+ else {
+ table = (__GLXcontext **) realloc(table,
+ (num + 1) * sizeof(__GLXcontext *));
+ cl->currentDrawables = (DrawablePtr *) realloc(cl->currentDrawables,
+ (num +
+ 1) *
+ sizeof(DrawablePtr));
+ cl->be_currentCTag =
+ (GLXContextTag *) realloc(cl->be_currentCTag,
+ (num +
+ 1) * screenInfo.numScreens *
+ sizeof(GLXContextTag));
}
table[num] = glxc;
cl->currentDrawables[num] = pDraw;
cl->currentContexts = table;
cl->numCurrentContexts++;
- memset(cl->be_currentCTag + num*screenInfo.numScreens, 0,
- screenInfo.numScreens * sizeof(GLXContextTag));
+ memset(cl->be_currentCTag + num * screenInfo.numScreens, 0,
+ screenInfo.numScreens * sizeof(GLXContextTag));
- return num+1;
+ return num + 1;
}
/*
** Given a tag, change the current context for the corresponding entry.
*/
-static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
- GLXContextTag tag)
+static void
+ChangeCurrentContext(__GLXclientState * cl, __GLXcontext * glxc,
+ GLXContextTag tag)
{
__GLXcontext **table = cl->currentContexts;
- table[tag-1] = glxc;
+
+ table[tag - 1] = glxc;
}
/*
** Given a tag, and back-end screen number, retrives the current back-end
** tag.
*/
-int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s)
+int
+GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag, int s)
{
- if (tag >0) {
- return( cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] );
- }
- else {
- return 0;
- }
+ if (tag > 0) {
+ return (cl->be_currentCTag[(tag - 1) * screenInfo.numScreens + s]);
+ }
+ else {
+ return 0;
+ }
}
/*
** Given a tag, and back-end screen number, sets the current back-end
** tag.
*/
-static void SetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s, GLXContextTag be_tag)
+static void
+SetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag, int s,
+ GLXContextTag be_tag)
{
- if (tag >0) {
- cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] = be_tag;
- }
+ if (tag > 0) {
+ cl->be_currentCTag[(tag - 1) * screenInfo.numScreens + s] = be_tag;
+ }
}
/*
@@ -684,45 +732,51 @@ static void SetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s,
** context's entry in the table as the context tag. A tag must be greater
** than 0.
*/
-__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
+__GLXcontext *
+__glXLookupContextByTag(__GLXclientState * cl, GLXContextTag tag)
{
int num = cl->numCurrentContexts;
if (tag < 1 || tag > num) {
- return 0;
- } else {
- return cl->currentContexts[tag-1];
+ return 0;
+ }
+ else {
+ return cl->currentContexts[tag - 1];
}
}
-DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag)
+DrawablePtr
+__glXLookupDrawableByTag(__GLXclientState * cl, GLXContextTag tag)
{
int num = cl->numCurrentContexts;
if (tag < 1 || tag > num) {
- return 0;
- } else {
- return cl->currentDrawables[tag-1];
+ return 0;
+ }
+ else {
+ return cl->currentDrawables[tag - 1];
}
}
/*****************************************************************************/
-static void StopUsingContext(__GLXcontext *glxc)
+static void
+StopUsingContext(__GLXcontext * glxc)
{
if (glxc) {
- if (glxc == __glXLastContext) {
- /* Tell server GL library */
- __glXLastContext = 0;
- }
- glxc->isCurrent = GL_FALSE;
- if (!glxc->idExists) {
- __glXFreeContext(glxc);
- }
+ if (glxc == __glXLastContext) {
+ /* Tell server GL library */
+ __glXLastContext = 0;
+ }
+ glxc->isCurrent = GL_FALSE;
+ if (!glxc->idExists) {
+ __glXFreeContext(glxc);
+ }
}
}
-static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
+static void
+StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc)
{
glxc->isCurrent = GL_TRUE;
}
@@ -731,11 +785,11 @@ static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
/*
** Make an OpenGL context and drawable current.
*/
-static int MakeCurrent(__GLXclientState *cl,
- GLXDrawable drawable,
- GLXDrawable readdrawable,
- GLXContextID context,
- GLXContextTag oldContextTag)
+static int
+MakeCurrent(__GLXclientState * cl,
+ GLXDrawable drawable,
+ GLXDrawable readdrawable,
+ GLXContextID context, GLXContextTag oldContextTag)
{
ClientPtr client = cl->client;
DrawablePtr pDraw = NULL;
@@ -758,6 +812,7 @@ static int MakeCurrent(__GLXclientState *cl,
__glXWindow *pGlxReadWindow = NULL;
__glXPbuffer *pGlxPbuffer = NULL;
__glXPbuffer *pGlxReadPbuffer = NULL;
+
#ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL;
PanoramiXRes *pXinReadDraw = NULL;
@@ -767,117 +822,122 @@ static int MakeCurrent(__GLXclientState *cl,
int s, rc;
/*
- ** If one is None and the other isn't, it's a bad match.
- */
+ ** If one is None and the other isn't, it's a bad match.
+ */
if ((drawId == None && contextId != None) ||
- (drawId != None && contextId == None)) {
- return BadMatch;
+ (drawId != None && contextId == None)) {
+ return BadMatch;
}
-
+
/*
- ** Lookup old context. If we have one, it must be in a usable state.
- */
+ ** Lookup old context. If we have one, it must be in a usable state.
+ */
if (tag != 0) {
- prevglxc = __glXLookupContextByTag(cl, tag);
- if (!prevglxc) {
- /*
- ** Tag for previous context is invalid.
- */
- return __glXBadContextTag;
- }
- } else {
- prevglxc = 0;
+ prevglxc = __glXLookupContextByTag(cl, tag);
+ if (!prevglxc) {
+ /*
+ ** Tag for previous context is invalid.
+ */
+ return __glXBadContextTag;
+ }
+ }
+ else {
+ prevglxc = 0;
}
/*
- ** Lookup new context. It must not be current for someone else.
- */
+ ** Lookup new context. It must not be current for someone else.
+ */
if (contextId != None) {
- dixLookupResourceByType((pointer*) &glxc, contextId, __glXContextRes,
- NullClient, DixUnknownAccess);
- if (!glxc) {
- client->errorValue = contextId;
- return __glXBadContext;
- }
- if ((glxc != prevglxc) && glxc->isCurrent) {
- /* Context is current to somebody else */
- return BadAccess;
- }
- } else {
- /* Switching to no context. Ignore new drawable. */
- glxc = 0;
+ dixLookupResourceByType((pointer *) &glxc, contextId, __glXContextRes,
+ NullClient, DixUnknownAccess);
+ if (!glxc) {
+ client->errorValue = contextId;
+ return __glXBadContext;
+ }
+ if ((glxc != prevglxc) && glxc->isCurrent) {
+ /* Context is current to somebody else */
+ return BadAccess;
+ }
+ }
+ else {
+ /* Switching to no context. Ignore new drawable. */
+ glxc = 0;
}
if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
- if (rc == Success) {
- if (pDraw->type == DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X Window.
- */
- VisualID vid;
- pWin = (WindowPtr)pDraw;
- vid = wVisual(pWin);
-
- new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
- new_reply.writeType = GLX_WINDOW_TYPE;
-
- /*
- ** Check if window and context are similar.
- */
- if ((vid != glxc->pVisual->vid) ||
- (pWin->drawable.pScreen != glxc->pScreen)) {
- client->errorValue = drawId;
- return BadMatch;
- }
-
- from_screen = to_screen = pWin->drawable.pScreen->myNum;
-
- } else {
- /*
- ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
- ** is, but it must first be created with glxCreateGLXPixmap).
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ if (rc == Success) {
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X Window.
+ */
+ VisualID vid;
+
+ pWin = (WindowPtr) pDraw;
+ vid = wVisual(pWin);
+
+ new_reply.writeVid =
+ (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
+ new_reply.writeType = GLX_WINDOW_TYPE;
+
+ /*
+ ** Check if window and context are similar.
+ */
+ if ((vid != glxc->pVisual->vid) ||
+ (pWin->drawable.pScreen != glxc->pScreen)) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ from_screen = to_screen = pWin->drawable.pScreen->myNum;
+
+ }
+ else {
+ /*
+ ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
+ ** is, but it must first be created with glxCreateGLXPixmap).
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
if (!pDraw) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
- __glXPixmapRes, NullClient,
- DixUnknownAccess);
- if (pGlxPixmap) {
- /*
- ** Check if pixmap and context are similar.
- */
- if (pGlxPixmap->pScreen != glxc->pScreen ||
- pGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
- client->errorValue = drawId;
- return BadMatch;
- }
- pDraw = pGlxPixmap->pDraw;
-
- new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
- pGlxPixmap->pGlxVisual->vid);
-
- new_reply.writeType = GLX_PIXMAP_TYPE;
-
- from_screen = to_screen = pGlxPixmap->pScreen->myNum;
-
- }
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
- __glXWindowRes, NullClient,
- DixUnknownAccess);
+ dixLookupResourceByType((pointer *) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxPixmap) {
+ /*
+ ** Check if pixmap and context are similar.
+ */
+ if (pGlxPixmap->pScreen != glxc->pScreen ||
+ pGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+ pDraw = pGlxPixmap->pDraw;
+
+ new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
+ pGlxPixmap->pGlxVisual->vid);
+
+ new_reply.writeType = GLX_PIXMAP_TYPE;
+
+ from_screen = to_screen = pGlxPixmap->pScreen->myNum;
+
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
if (pGlxWindow) {
/*
- ** Drawable is a GLXWindow.
- **
- ** Check if GLX window and context are similar.
- */
+ ** Drawable is a GLXWindow.
+ **
+ ** Check if GLX window and context are similar.
+ */
if (pGlxWindow->pScreen != glxc->pScreen ||
pGlxWindow->pGlxFBConfig != glxc->pFBConfig) {
client->errorValue = drawId;
@@ -889,103 +949,107 @@ static int MakeCurrent(__GLXclientState *cl,
new_reply.writeType = GLX_GLXWINDOW_TYPE;
}
- }
+ }
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxPbuffer, drawId,
- __glXPbufferRes, NullClient,
- DixUnknownAccess);
- if (pGlxPbuffer) {
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxPbuffer, drawId,
+ __glXPbufferRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxPbuffer) {
if (pGlxPbuffer->pScreen != glxc->pScreen ||
pGlxPbuffer->pFBConfig != glxc->pFBConfig) {
client->errorValue = drawId;
return BadMatch;
}
- pDraw = (DrawablePtr)pGlxPbuffer;
+ pDraw = (DrawablePtr) pGlxPbuffer;
new_reply.writeVid = pGlxPbuffer->pFBConfig->id;
new_reply.writeType = GLX_PBUFFER_TYPE;
- }
- }
-
- if (!pDraw) {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- } else {
- pDraw = 0;
- }
-
- if (readId != None && readId != drawId ) {
- rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess);
- if (rc == Success) {
- if (pReadDraw->type == DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X Window.
- */
- VisualID vid;
- pReadWin = (WindowPtr)pDraw;
- vid = wVisual(pReadWin);
-
- new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
- new_reply.readType = GLX_WINDOW_TYPE;
-
- /*
- ** Check if window and context are similar.
- */
- if ((vid != glxc->pVisual->vid) ||
- (pReadWin->drawable.pScreen != glxc->pScreen)) {
- client->errorValue = readId;
- return BadMatch;
- }
-
- } else {
-
- /*
- ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
- ** is, but it must first be created with glxCreateGLXPixmap).
- */
- client->errorValue = readId;
- return __glXBadDrawable;
- }
- }
-
- if (!pReadDraw) {
- dixLookupResourceByType((pointer*) &pReadGlxPixmap, readId,
- __glXPixmapRes, NullClient,
- DixUnknownAccess);
- if (pReadGlxPixmap) {
- /*
- ** Check if pixmap and context are similar.
- */
- if (pReadGlxPixmap->pScreen != glxc->pScreen ||
- pReadGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
- client->errorValue = readId;
- return BadMatch;
- }
- pReadDraw = pReadGlxPixmap->pDraw;
-
- new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
- pReadGlxPixmap->pGlxVisual->vid );
- new_reply.readType = GLX_PIXMAP_TYPE;
-
- }
- }
-
- if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxReadWindow, readId,
- __glXWindowRes, NullClient,
- DixUnknownAccess);
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ }
+ else {
+ pDraw = 0;
+ }
+
+ if (readId != None && readId != drawId) {
+ rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess);
+ if (rc == Success) {
+ if (pReadDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X Window.
+ */
+ VisualID vid;
+
+ pReadWin = (WindowPtr) pDraw;
+ vid = wVisual(pReadWin);
+
+ new_reply.readVid =
+ (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
+ new_reply.readType = GLX_WINDOW_TYPE;
+
+ /*
+ ** Check if window and context are similar.
+ */
+ if ((vid != glxc->pVisual->vid) ||
+ (pReadWin->drawable.pScreen != glxc->pScreen)) {
+ client->errorValue = readId;
+ return BadMatch;
+ }
+
+ }
+ else {
+
+ /*
+ ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
+ ** is, but it must first be created with glxCreateGLXPixmap).
+ */
+ client->errorValue = readId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pReadDraw) {
+ dixLookupResourceByType((pointer *) &pReadGlxPixmap, readId,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
+ if (pReadGlxPixmap) {
+ /*
+ ** Check if pixmap and context are similar.
+ */
+ if (pReadGlxPixmap->pScreen != glxc->pScreen ||
+ pReadGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
+ client->errorValue = readId;
+ return BadMatch;
+ }
+ pReadDraw = pReadGlxPixmap->pDraw;
+
+ new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
+ pReadGlxPixmap->pGlxVisual->vid);
+ new_reply.readType = GLX_PIXMAP_TYPE;
+
+ }
+ }
+
+ if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxReadWindow, readId,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
if (pGlxReadWindow) {
/*
- ** Drawable is a GLXWindow.
- **
- ** Check if GLX window and context are similar.
- */
+ ** Drawable is a GLXWindow.
+ **
+ ** Check if GLX window and context are similar.
+ */
if (pGlxReadWindow->pScreen != glxc->pScreen ||
pGlxReadWindow->pGlxFBConfig != glxc->pFBConfig) {
client->errorValue = readId;
@@ -996,140 +1060,143 @@ static int MakeCurrent(__GLXclientState *cl,
new_reply.readVid = pGlxReadWindow->pGlxFBConfig->id;
new_reply.readType = GLX_GLXWINDOW_TYPE;
}
- }
+ }
- if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxReadPbuffer, readId,
- __glXPbufferRes, NullClient,
- DixUnknownAccess);
- if (pGlxReadPbuffer) {
+ if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxReadPbuffer, readId,
+ __glXPbufferRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxReadPbuffer) {
if (pGlxReadPbuffer->pScreen != glxc->pScreen ||
pGlxReadPbuffer->pFBConfig != glxc->pFBConfig) {
client->errorValue = drawId;
return BadMatch;
}
- pReadDraw = (DrawablePtr)pGlxReadPbuffer;
+ pReadDraw = (DrawablePtr) pGlxReadPbuffer;
new_reply.readVid = pGlxReadPbuffer->pFBConfig->id;
new_reply.readType = GLX_PBUFFER_TYPE;
- }
- }
+ }
+ }
- if (!pReadDraw) {
- /*
- ** Drawable is neither a Window nor a GLXPixmap.
- */
- client->errorValue = readId;
- return __glXBadDrawable;
- }
+ if (!pReadDraw) {
+ /*
+ ** Drawable is neither a Window nor a GLXPixmap.
+ */
+ client->errorValue = readId;
+ return __glXBadDrawable;
+ }
- } else {
- pReadDraw = pDraw;
- pReadGlxPixmap = pGlxPixmap;
- pReadWin = pWin;
- new_reply.readVid = new_reply.writeVid;
- new_reply.readType = new_reply.writeType;
+ }
+ else {
+ pReadDraw = pDraw;
+ pReadGlxPixmap = pGlxPixmap;
+ pReadWin = pWin;
+ new_reply.readVid = new_reply.writeVid;
+ new_reply.readType = new_reply.writeType;
}
if (prevglxc) {
- if (prevglxc->pGlxPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- prevglxc->pGlxPixmap->refcnt--;
- __glXFreeGLXPixmap( prevglxc->pGlxPixmap );
- prevglxc->pGlxPixmap = 0;
- }
-
- if (prevglxc->pGlxReadPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- prevglxc->pGlxReadPixmap->refcnt--;
- __glXFreeGLXPixmap( prevglxc->pGlxReadPixmap );
- prevglxc->pGlxReadPixmap = 0;
- }
-
- if (prevglxc->pGlxWindow) {
- /*
- ** The previous drawable was a glx window, release it.
- */
- prevglxc->pGlxWindow->refcnt--;
- __glXFreeGLXWindow( prevglxc->pGlxWindow );
- prevglxc->pGlxWindow = 0;
- }
-
- if (prevglxc->pGlxReadWindow) {
- /*
- ** The previous drawable was a glx window, release it.
- */
- prevglxc->pGlxReadWindow->refcnt--;
- __glXFreeGLXWindow( prevglxc->pGlxReadWindow );
- prevglxc->pGlxReadWindow = 0;
- }
-
- if (prevglxc->pGlxPbuffer) {
- /*
- ** The previous drawable was a glx Pbuffer, release it.
- */
- prevglxc->pGlxPbuffer->refcnt--;
- __glXFreeGLXPbuffer( prevglxc->pGlxPbuffer );
- prevglxc->pGlxPbuffer = 0;
- }
-
- if (prevglxc->pGlxReadPbuffer) {
- /*
- ** The previous drawable was a glx Pbuffer, release it.
- */
- prevglxc->pGlxReadPbuffer->refcnt--;
- __glXFreeGLXPbuffer( prevglxc->pGlxReadPbuffer );
- prevglxc->pGlxReadPbuffer = 0;
- }
-
- ChangeCurrentContext(cl, glxc, tag);
- ChangeCurrentContext(cl, glxc, tag);
- StopUsingContext(prevglxc);
- } else {
- tag = AddCurrentContext(cl, glxc, pDraw);
+ if (prevglxc->pGlxPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ prevglxc->pGlxPixmap->refcnt--;
+ __glXFreeGLXPixmap(prevglxc->pGlxPixmap);
+ prevglxc->pGlxPixmap = 0;
+ }
+
+ if (prevglxc->pGlxReadPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ prevglxc->pGlxReadPixmap->refcnt--;
+ __glXFreeGLXPixmap(prevglxc->pGlxReadPixmap);
+ prevglxc->pGlxReadPixmap = 0;
+ }
+
+ if (prevglxc->pGlxWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ prevglxc->pGlxWindow->refcnt--;
+ __glXFreeGLXWindow(prevglxc->pGlxWindow);
+ prevglxc->pGlxWindow = 0;
+ }
+
+ if (prevglxc->pGlxReadWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ prevglxc->pGlxReadWindow->refcnt--;
+ __glXFreeGLXWindow(prevglxc->pGlxReadWindow);
+ prevglxc->pGlxReadWindow = 0;
+ }
+
+ if (prevglxc->pGlxPbuffer) {
+ /*
+ ** The previous drawable was a glx Pbuffer, release it.
+ */
+ prevglxc->pGlxPbuffer->refcnt--;
+ __glXFreeGLXPbuffer(prevglxc->pGlxPbuffer);
+ prevglxc->pGlxPbuffer = 0;
+ }
+
+ if (prevglxc->pGlxReadPbuffer) {
+ /*
+ ** The previous drawable was a glx Pbuffer, release it.
+ */
+ prevglxc->pGlxReadPbuffer->refcnt--;
+ __glXFreeGLXPbuffer(prevglxc->pGlxReadPbuffer);
+ prevglxc->pGlxReadPbuffer = 0;
+ }
+
+ ChangeCurrentContext(cl, glxc, tag);
+ ChangeCurrentContext(cl, glxc, tag);
+ StopUsingContext(prevglxc);
+ }
+ else {
+ tag = AddCurrentContext(cl, glxc, pDraw);
}
if (glxc) {
- glxc->pGlxPixmap = pGlxPixmap;
- glxc->pGlxReadPixmap = pReadGlxPixmap;
- glxc->pGlxWindow = pGlxWindow;
- glxc->pGlxReadWindow = pGlxReadWindow;
- glxc->pGlxPbuffer = pGlxPbuffer;
- glxc->pGlxReadPbuffer = pGlxReadPbuffer;
+ glxc->pGlxPixmap = pGlxPixmap;
+ glxc->pGlxReadPixmap = pReadGlxPixmap;
+ glxc->pGlxWindow = pGlxWindow;
+ glxc->pGlxReadWindow = pGlxReadWindow;
+ glxc->pGlxPbuffer = pGlxPbuffer;
+ glxc->pGlxReadPbuffer = pGlxReadPbuffer;
- if (pGlxPixmap) {
- pGlxPixmap->refcnt++;
- }
+ if (pGlxPixmap) {
+ pGlxPixmap->refcnt++;
+ }
- if (pReadGlxPixmap) {
- pReadGlxPixmap->refcnt++;
- }
+ if (pReadGlxPixmap) {
+ pReadGlxPixmap->refcnt++;
+ }
- if (pGlxWindow) {
- pGlxWindow->refcnt++;
- }
+ if (pGlxWindow) {
+ pGlxWindow->refcnt++;
+ }
- if (pGlxReadWindow) {
- pGlxReadWindow->refcnt++;
- }
+ if (pGlxReadWindow) {
+ pGlxReadWindow->refcnt++;
+ }
- if (pGlxPbuffer) {
- pGlxPbuffer->refcnt++;
- }
+ if (pGlxPbuffer) {
+ pGlxPbuffer->refcnt++;
+ }
- if (pGlxReadPbuffer) {
- pGlxReadPbuffer->refcnt++;
- }
+ if (pGlxReadPbuffer) {
+ pGlxReadPbuffer->refcnt++;
+ }
- StartUsingContext(cl, glxc);
- new_reply.contextTag = tag;
- } else {
- new_reply.contextTag = 0;
+ StartUsingContext(cl, glxc);
+ new_reply.contextTag = tag;
+ }
+ else {
+ new_reply.contextTag = 0;
}
new_reply.length = 0;
new_reply.type = X_Reply;
@@ -1137,216 +1204,226 @@ static int MakeCurrent(__GLXclientState *cl,
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
-
- if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
- dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
- }
-
- if (pReadDraw && pReadDraw != pDraw &&
- new_reply.readType != GLX_PBUFFER_TYPE) {
- dixLookupResourceByClass((pointer*) &pXinReadDraw,
- pReadDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
- }
- else {
- pXinReadDraw = pXinDraw;
- }
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+
+ if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
+ dixLookupResourceByClass((pointer *) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
+ }
+
+ if (pReadDraw && pReadDraw != pDraw &&
+ new_reply.readType != GLX_PBUFFER_TYPE) {
+ dixLookupResourceByClass((pointer *) &pXinReadDraw,
+ pReadDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
+ }
+ else {
+ pXinReadDraw = pXinDraw;
+ }
}
#endif
-
/* send the MakeCurrent request to all required
* back-end servers.
*/
- for (s = from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- unsigned int be_draw = None;
- unsigned int be_read_draw = None;
-
- if (pGlxPixmap) {
- be_draw = pGlxPixmap->be_xids[s];
- }
- else if (pGlxPbuffer) {
- be_draw = pGlxPbuffer->be_xids[s];
- }
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+ unsigned int be_draw = None;
+ unsigned int be_read_draw = None;
+
+ if (pGlxPixmap) {
+ be_draw = pGlxPixmap->be_xids[s];
+ }
+ else if (pGlxPbuffer) {
+ be_draw = pGlxPbuffer->be_xids[s];
+ }
#ifdef PANORAMIX
- else if (pXinDraw) {
- dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
- }
+ else if (pXinDraw) {
+ dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
+ }
#endif
- else if (pGlxWindow) {
- pWin = (WindowPtr)pGlxWindow->pDraw;
- }
-
- if (pWin && be_draw == None) {
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_draw) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
-
- /*
- * Before sending the MakeCurrent request - sync the
- * X11 connection to the back-end servers to make sure
- * that drawable is already created
- */
- dmxSync( dmxScreen, 1 );
-
- if (drawId == readId) {
- LockDisplay(dpy);
- GetReq(GLXMakeCurrent, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXMakeCurrent;
- be_req->drawable = be_draw;
- be_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
- be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) &be_reply, 0, False)) {
-
- /* The make current failed */
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- SetCurrentBackEndTag( cl, tag, s, be_reply.contextTag );
- }
- else {
-
- if (pReadGlxPixmap) {
- be_read_draw = pReadGlxPixmap->be_xids[s];
- }
- else if (pGlxReadPbuffer) {
- be_read_draw = pGlxReadPbuffer->be_xids[s];
- }
+ else if (pGlxWindow) {
+ pWin = (WindowPtr) pGlxWindow->pDraw;
+ }
+
+ if (pWin && be_draw == None) {
+ be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+ be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+
+ /*
+ * Before sending the MakeCurrent request - sync the
+ * X11 connection to the back-end servers to make sure
+ * that drawable is already created
+ */
+ dmxSync(dmxScreen, 1);
+
+ if (drawId == readId) {
+ LockDisplay(dpy);
+ GetReq(GLXMakeCurrent, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXMakeCurrent;
+ be_req->drawable = be_draw;
+ be_req->context =
+ (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
+ be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) & be_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code));
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag(cl, tag, s, be_reply.contextTag);
+ }
+ else {
+
+ if (pReadGlxPixmap) {
+ be_read_draw = pReadGlxPixmap->be_xids[s];
+ }
+ else if (pGlxReadPbuffer) {
+ be_read_draw = pGlxReadPbuffer->be_xids[s];
+ }
#ifdef PANORAMIX
- else if (pXinReadDraw) {
- dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client,
- DixReadAccess);
- }
+ else if (pXinReadDraw) {
+ dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client,
+ DixReadAccess);
+ }
#endif
- else if (pGlxReadWindow) {
- pReadWin = (WindowPtr)pGlxReadWindow->pDraw;
- }
-
- if (pReadWin && be_read_draw == None) {
- be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window;
- if (!be_read_draw) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pReadWin, TRUE );
- be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window;
- dmxSync( dmxScreen, 1 );
- }
- }
-
- if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- LockDisplay(dpy);
- GetReq(GLXMakeContextCurrent, be_new_req);
- be_new_req->reqType = dmxScreen->glxMajorOpcode;
- be_new_req->glxCode = X_GLXMakeContextCurrent;
- be_new_req->drawable = be_draw;
- be_new_req->readdrawable = be_read_draw;
- be_new_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
- be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) &be_new_reply, 0, False)) {
-
- /* The make current failed */
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- SetCurrentBackEndTag( cl, tag, s, be_new_reply.contextTag );
- }
- else if (glxIsExtensionSupported("GLX_SGI_make_current_read")) {
- xGLXMakeCurrentReadSGIReq *ext_req;
- xGLXVendorPrivateWithReplyReq *vpreq;
- xGLXMakeCurrentReadSGIReply ext_reply;
-
- LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivateWithReply,
- sz_xGLXMakeCurrentReadSGIReq - sz_xGLXVendorPrivateWithReplyReq,
- vpreq);
- ext_req = (xGLXMakeCurrentReadSGIReq *)vpreq;
- ext_req->reqType = dmxScreen->glxMajorOpcode;
- ext_req->glxCode = X_GLXVendorPrivateWithReply;
- ext_req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
- ext_req->drawable = be_draw;
- ext_req->readable = be_read_draw;
- ext_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
- ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) &ext_reply, 0, False)) {
-
- /* The make current failed */
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- SetCurrentBackEndTag( cl, tag, s, ext_reply.contextTag );
-
- }
- else {
- return BadMatch;
- }
- }
-
- XFlush( dpy );
+ else if (pGlxReadWindow) {
+ pReadWin = (WindowPtr) pGlxReadWindow->pDraw;
+ }
+
+ if (pReadWin && be_read_draw == None) {
+ be_read_draw =
+ (unsigned int) (DMX_GET_WINDOW_PRIV(pReadWin))->window;
+ if (!be_read_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow(pReadWin, TRUE);
+ be_read_draw =
+ (unsigned int) (DMX_GET_WINDOW_PRIV(pReadWin))->window;
+ dmxSync(dmxScreen, 1);
+ }
+ }
+
+ if (__GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ LockDisplay(dpy);
+ GetReq(GLXMakeContextCurrent, be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXMakeContextCurrent;
+ be_new_req->drawable = be_draw;
+ be_new_req->readdrawable = be_read_draw;
+ be_new_req->context =
+ (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
+ be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) & be_new_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code));
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag(cl, tag, s, be_new_reply.contextTag);
+ }
+ else if (glxIsExtensionSupported("GLX_SGI_make_current_read")) {
+ xGLXMakeCurrentReadSGIReq *ext_req;
+ xGLXVendorPrivateWithReplyReq *vpreq;
+ xGLXMakeCurrentReadSGIReply ext_reply;
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXVendorPrivateWithReply,
+ sz_xGLXMakeCurrentReadSGIReq -
+ sz_xGLXVendorPrivateWithReplyReq, vpreq);
+ ext_req = (xGLXMakeCurrentReadSGIReq *) vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivateWithReply;
+ ext_req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
+ ext_req->drawable = be_draw;
+ ext_req->readable = be_read_draw;
+ ext_req->context =
+ (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
+ ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) & ext_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code));
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag(cl, tag, s, ext_reply.contextTag);
+
+ }
+ else {
+ return BadMatch;
+ }
+ }
+
+ XFlush(dpy);
}
if (client->swapped) {
- __glXSwapMakeCurrentReply(client, &new_reply);
- } else {
- WriteToClient(client, sz_xGLXMakeContextCurrentReply, (char *)&new_reply);
+ __glXSwapMakeCurrentReply(client, &new_reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXMakeContextCurrentReply,
+ (char *) &new_reply);
}
return Success;
}
-int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc)
+int
+__glXMakeCurrent(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
- return( MakeCurrent(cl, req->drawable, req->drawable,
- req->context, req->oldContextTag ) );
+ return (MakeCurrent(cl, req->drawable, req->drawable,
+ req->context, req->oldContextTag));
}
-int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
+int
+__glXMakeContextCurrent(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
- return( MakeCurrent(cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag ) );
+ return (MakeCurrent(cl, req->drawable, req->readdrawable,
+ req->context, req->oldContextTag));
}
-int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
+int
+__glXMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
- return( MakeCurrent(cl, req->drawable, req->readable,
- req->context, req->oldContextTag ) );
+ return (MakeCurrent(cl, req->drawable, req->readable,
+ req->context, req->oldContextTag));
}
-int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
+int
+__glXIsDirect(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
@@ -1354,13 +1431,13 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
__GLXcontext *glxc;
/*
- ** Find the GL context.
- */
- dixLookupResourceByType((pointer*) &glxc, req->context, __glXContextRes,
+ ** Find the GL context.
+ */
+ dixLookupResourceByType((pointer *) &glxc, req->context, __glXContextRes,
NullClient, DixUnknownAccess);
if (!glxc) {
- client->errorValue = req->context;
- return __glXBadContext;
+ client->errorValue = req->context;
+ return __glXBadContext;
}
reply.isDirect = 0;
@@ -1369,25 +1446,28 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __glXSwapIsDirectReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
+ __glXSwapIsDirectReply(client, &reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply);
}
return Success;
}
-int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryVersion(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
+
/* xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; */
xGLXQueryVersionReply reply;
/*
- ** Server should take into consideration the version numbers sent by the
- ** client if it wants to work with older clients; however, in this
- ** implementation the server just returns its version number.
- */
+ ** Server should take into consideration the version numbers sent by the
+ ** client if it wants to work with older clients; however, in this
+ ** implementation the server just returns its version number.
+ */
reply.majorVersion = __glXVersionMajor;
reply.minorVersion = __glXVersionMinor;
reply.length = 0;
@@ -1395,98 +1475,104 @@ int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __glXSwapQueryVersionReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
+ __glXSwapQueryVersionReply(client, &reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply);
}
return Success;
}
-int __glXWaitGL(__GLXclientState *cl, GLbyte *pc)
+int
+__glXWaitGL(__GLXclientState * cl, GLbyte * pc)
{
- xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
- xGLXWaitGLReq *be_req = (xGLXWaitGLReq *)pc;
+ xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
+ xGLXWaitGLReq *be_req = (xGLXWaitGLReq *) pc;
int from_screen = 0;
int to_screen = 0;
int s;
__GLXcontext *glxc = NULL;
-
+
if (req->contextTag != 0) {
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (glxc) {
- from_screen = to_screen = glxc->pScreen->myNum;
- }
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
}
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- LockDisplay(dpy);
- GetReq(GLXWaitGL,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXWaitGL;
- be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXWaitGL, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXWaitGL;
+ be_req->contextTag =
+ (glxc ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
- XSync(dpy, False);
+ XSync(dpy, False);
}
-
+
return Success;
}
-int __glXWaitX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXWaitX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
+ xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
xGLXWaitXReq *be_req;
int from_screen = 0;
int to_screen = 0;
int s;
__GLXcontext *glxc = NULL;
-
+
if (req->contextTag != 0) {
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (glxc) {
- from_screen = to_screen = glxc->pScreen->myNum;
- }
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
}
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- dmxSync( dmxScreen, 1 );
+ dmxSync(dmxScreen, 1);
- LockDisplay(dpy);
- GetReq(GLXWaitX,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXWaitX;
- be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXWaitX, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXWaitX;
+ be_req->contextTag =
+ (glxc ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
- XFlush( dpy );
+ XFlush(dpy);
}
return Success;
}
-int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCopyContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXCopyContextReq *be_req;
@@ -1501,81 +1587,83 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
int to_screen = 0;
/*
- ** Check that each context exists.
- */
- dixLookupResourceByType((pointer*) &src, source, __glXContextRes,
+ ** Check that each context exists.
+ */
+ dixLookupResourceByType((pointer *) &src, source, __glXContextRes,
NullClient, DixUnknownAccess);
if (!src) {
- client->errorValue = source;
- return __glXBadContext;
+ client->errorValue = source;
+ return __glXBadContext;
}
- dixLookupResourceByType((pointer*) &dst, dest, __glXContextRes,
+ dixLookupResourceByType((pointer *) &dst, dest, __glXContextRes,
NullClient, DixUnknownAccess);
if (!dst) {
- client->errorValue = dest;
- return __glXBadContext;
+ client->errorValue = dest;
+ return __glXBadContext;
}
/*
- ** They must be in the same address space, and same screen.
- */
+ ** They must be in the same address space, and same screen.
+ */
if (src->pGlxScreen != dst->pGlxScreen) {
- client->errorValue = source;
- return BadMatch;
+ client->errorValue = source;
+ return BadMatch;
}
/*
- ** The destination context must not be current for any client.
- */
+ ** The destination context must not be current for any client.
+ */
if (dst->isCurrent) {
- client->errorValue = dest;
- return BadAccess;
+ client->errorValue = dest;
+ return BadAccess;
}
if (tag) {
- __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
-
- if (!tagcx) {
- return __glXBadContextTag;
- }
- if (tagcx != src) {
- /*
- ** This would be caused by a faulty implementation of the client
- ** library.
- */
- return BadMatch;
- }
+ __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
+
+ if (!tagcx) {
+ return __glXBadContextTag;
+ }
+ if (tagcx != src) {
+ /*
+ ** This would be caused by a faulty implementation of the client
+ ** library.
+ */
+ return BadMatch;
+ }
}
from_screen = to_screen = src->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- LockDisplay(dpy);
- GetReq(GLXCopyContext,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCopyContext;
- be_req->source = (unsigned int)src->real_ids[s-from_screen];
- be_req->dest = (unsigned int)dst->real_ids[s-from_screen];
- be_req->mask = mask;
- be_req->contextTag = (tag ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXCopyContext, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCopyContext;
+ be_req->source = (unsigned int) src->real_ids[s - from_screen];
+ be_req->dest = (unsigned int) dst->real_ids[s - from_screen];
+ be_req->mask = mask;
+ be_req->contextTag =
+ (tag ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
}
-int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+int
+__glXGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
@@ -1588,75 +1676,75 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
screen = req->screen;
if (screen >= screenInfo.numScreens) {
- /* The client library must send a valid screen number. */
- client->errorValue = screen;
- return BadValue;
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
}
pGlxScreen = &__glXActiveScreens[screen];
reply.numVisuals = pGlxScreen->numGLXVisuals;
reply.numProps = __GLX_TOTAL_CONFIG;
reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
- __GLX_TOTAL_CONFIG) >> 2;
+ __GLX_TOTAL_CONFIG) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
-
- for (i=0; i < pGlxScreen->numVisuals; i++) {
- pGlxVisual = &pGlxScreen->pGlxVisual[i];
- if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
- /* not a usable visual */
- continue;
- }
- p = 0;
- buf[p++] = pGlxVisual->vid;
- buf[p++] = pGlxVisual->class;
- buf[p++] = pGlxVisual->rgba;
-
- buf[p++] = pGlxVisual->redSize;
- buf[p++] = pGlxVisual->greenSize;
- buf[p++] = pGlxVisual->blueSize;
- buf[p++] = pGlxVisual->alphaSize;
- buf[p++] = pGlxVisual->accumRedSize;
- buf[p++] = pGlxVisual->accumGreenSize;
- buf[p++] = pGlxVisual->accumBlueSize;
- buf[p++] = pGlxVisual->accumAlphaSize;
-
- buf[p++] = pGlxVisual->doubleBuffer;
- buf[p++] = pGlxVisual->stereo;
-
- buf[p++] = pGlxVisual->bufferSize;
- buf[p++] = pGlxVisual->depthSize;
- buf[p++] = pGlxVisual->stencilSize;
- buf[p++] = pGlxVisual->auxBuffers;
- buf[p++] = pGlxVisual->level;
- /*
- ** Add token/value pairs for extensions.
- */
- buf[p++] = GLX_VISUAL_CAVEAT_EXT;
- buf[p++] = pGlxVisual->visualRating;
- buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
- buf[p++] = pGlxVisual->transparentPixel;
- buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentRed;
- buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentGreen;
- buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentBlue;
- buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentAlpha;
- buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentIndex;
- buf[p++] = GLX_SAMPLES_SGIS;
- buf[p++] = pGlxVisual->multiSampleSize;
- buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
- buf[p++] = pGlxVisual->nMultiSampleBuffers;
- buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
- buf[p++] = pGlxVisual->visualSelectGroup;
-
- WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
- (char *)buf);
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+
+ for (i = 0; i < pGlxScreen->numVisuals; i++) {
+ pGlxVisual = &pGlxScreen->pGlxVisual[i];
+ if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
+ /* not a usable visual */
+ continue;
+ }
+ p = 0;
+ buf[p++] = pGlxVisual->vid;
+ buf[p++] = pGlxVisual->class;
+ buf[p++] = pGlxVisual->rgba;
+
+ buf[p++] = pGlxVisual->redSize;
+ buf[p++] = pGlxVisual->greenSize;
+ buf[p++] = pGlxVisual->blueSize;
+ buf[p++] = pGlxVisual->alphaSize;
+ buf[p++] = pGlxVisual->accumRedSize;
+ buf[p++] = pGlxVisual->accumGreenSize;
+ buf[p++] = pGlxVisual->accumBlueSize;
+ buf[p++] = pGlxVisual->accumAlphaSize;
+
+ buf[p++] = pGlxVisual->doubleBuffer;
+ buf[p++] = pGlxVisual->stereo;
+
+ buf[p++] = pGlxVisual->bufferSize;
+ buf[p++] = pGlxVisual->depthSize;
+ buf[p++] = pGlxVisual->stencilSize;
+ buf[p++] = pGlxVisual->auxBuffers;
+ buf[p++] = pGlxVisual->level;
+ /*
+ ** Add token/value pairs for extensions.
+ */
+ buf[p++] = GLX_VISUAL_CAVEAT_EXT;
+ buf[p++] = pGlxVisual->visualRating;
+ buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
+ buf[p++] = pGlxVisual->transparentPixel;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentIndex;
+ buf[p++] = GLX_SAMPLES_SGIS;
+ buf[p++] = pGlxVisual->multiSampleSize;
+ buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+ buf[p++] = pGlxVisual->nMultiSampleBuffers;
+ buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
+ buf[p++] = pGlxVisual->visualSelectGroup;
+
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
+ (char *) buf);
}
return Success;
}
@@ -1664,9 +1752,10 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
/*
** Create a GLX Pixmap from an X Pixmap.
*/
-static int CreateGLXPixmap(__GLXclientState *cl,
- VisualID visual, GLXFBConfigID fbconfigId,
- int screenNum, XID pixmapId, XID glxpixmapId )
+static int
+CreateGLXPixmap(__GLXclientState * cl,
+ VisualID visual, GLXFBConfigID fbconfigId,
+ int screenNum, XID pixmapId, XID glxpixmapId)
{
ClientPtr client = cl->client;
xGLXCreateGLXPixmapReq *be_req;
@@ -1680,107 +1769,107 @@ static int CreateGLXPixmap(__GLXclientState *cl,
__GLXFBConfig *pFBConfig;
int i, s, rc;
int from_screen, to_screen;
+
#ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL;
#endif
rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
- DixAddAccess);
+ DixAddAccess);
if (rc != Success)
- return rc;
+ return rc;
/*
- ** Check if screen of visual matches screen of pixmap.
- */
+ ** Check if screen of visual matches screen of pixmap.
+ */
pScreen = pDraw->pScreen;
if (screenNum != pScreen->myNum) {
- return BadMatch;
+ return BadMatch;
}
if (fbconfigId == 0 && visual == 0) {
- return BadValue;
+ return BadValue;
}
if (fbconfigId != None) {
- pFBConfig = glxLookupFBConfig( fbconfigId );
- if (!pFBConfig) {
- client->errorValue = fbconfigId;
- return BadValue;
- }
- visual = pFBConfig->associatedVisualId;
+ pFBConfig = glxLookupFBConfig(fbconfigId);
+ if (!pFBConfig) {
+ client->errorValue = fbconfigId;
+ return BadValue;
+ }
+ visual = pFBConfig->associatedVisualId;
}
else {
- pFBConfig = NULL;
+ pFBConfig = NULL;
}
if (visual != None) {
- /*
- ** Find the VisualRec for this visual.
- */
- pVisual = pScreen->visuals;
- for (i=0; i < pScreen->numVisuals; i++, pVisual++) {
- if (pVisual->vid == visual) {
- break;
- }
- }
- if (i == pScreen->numVisuals) {
- client->errorValue = visual;
- return BadValue;
- }
- /*
- ** Check if depth of visual matches depth of pixmap.
- */
- if (pVisual->nplanes != pDraw->depth) {
- client->errorValue = visual;
- return BadMatch;
- }
-
- /*
- ** Get configuration of the visual.
- */
- pGlxScreen = &__glXActiveScreens[screenNum];
- pGlxVisual = pGlxScreen->pGlxVisual;
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == visual) {
- break;
- }
- }
- if (i == pGlxScreen->numVisuals) {
- /*
- ** Visual not support on this screen by this OpenGL implementation.
- */
- client->errorValue = visual;
- return BadValue;
- }
-
-
- /* find the FBConfig for that visual (if any) */
- if ( pFBConfig == NULL ) {
- pFBConfig = glxLookupFBConfigByVID( visual );
-
- if ( pFBConfig == NULL ) {
- /*
- * visual does not have an FBConfig ???
- client->errorValue = visual;
- return BadValue;
- */
- }
- }
+ /*
+ ** Find the VisualRec for this visual.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visual;
+ return BadValue;
+ }
+ /*
+ ** Check if depth of visual matches depth of pixmap.
+ */
+ if (pVisual->nplanes != pDraw->depth) {
+ client->errorValue = visual;
+ return BadMatch;
+ }
+
+ /*
+ ** Get configuration of the visual.
+ */
+ pGlxScreen = &__glXActiveScreens[screenNum];
+ pGlxVisual = pGlxScreen->pGlxVisual;
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ ** Visual not support on this screen by this OpenGL implementation.
+ */
+ client->errorValue = visual;
+ return BadValue;
+ }
+
+ /* find the FBConfig for that visual (if any) */
+ if (pFBConfig == NULL) {
+ pFBConfig = glxLookupFBConfigByVID(visual);
+
+ if (pFBConfig == NULL) {
+ /*
+ * visual does not have an FBConfig ???
+ client->errorValue = visual;
+ return BadValue;
+ */
+ }
+ }
}
else {
- pVisual = NULL;
- pGlxVisual = NULL;
- pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum];
+ pVisual = NULL;
+ pGlxVisual = NULL;
+ pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum];
}
pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap));
if (!pGlxPixmap) {
- return BadAlloc;
+ return BadAlloc;
}
pGlxPixmap->be_xids = (XID *) malloc(sizeof(XID) * screenInfo.numScreens);
if (!pGlxPixmap->be_xids) {
- free( pGlxPixmap );
- return BadAlloc;
+ free(pGlxPixmap);
+ return BadAlloc;
}
pGlxPixmap->pDraw = pDraw;
@@ -1792,8 +1881,8 @@ static int CreateGLXPixmap(__GLXclientState *cl,
pGlxPixmap->refcnt = 0;
/*
- ** Bump the ref count on the X pixmap so it won't disappear.
- */
+ ** Bump the ref count on the X pixmap so it won't disappear.
+ */
((PixmapPtr) pDraw)->refcnt++;
/*
@@ -1802,121 +1891,128 @@ static int CreateGLXPixmap(__GLXclientState *cl,
from_screen = to_screen = screenNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
- dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
+ dixLookupResourceByClass((pointer *) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
+ for (s = from_screen; s <= to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- Pixmap be_pixmap;
- DrawablePtr pRealDraw = pDraw;
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+ Pixmap be_pixmap;
+ DrawablePtr pRealDraw = pDraw;
#ifdef PANORAMIX
- if (pXinDraw) {
- dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
- DixAddAccess);
- }
+ if (pXinDraw) {
+ dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
+ DixAddAccess);
+ }
#endif
- be_pixmap = (DMX_GET_PIXMAP_PRIV((PixmapPtr)pRealDraw))->pixmap;
-
- /* make sure pixmap already created on back-end */
- dmxSync( dmxScreen, 1 );
-
- if ( pFBConfig && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s );
-
- LockDisplay(dpy);
- pGlxPixmap->be_xids[s] = XAllocID(dpy);
- GetReq(GLXCreatePixmap,be_new_req);
- be_new_req->reqType = dmxScreen->glxMajorOpcode;
- be_new_req->glxCode = X_GLXCreatePixmap;
- be_new_req->screen = DefaultScreen(dpy);
- be_new_req->fbconfig = be_FBConfig->id;
- be_new_req->pixmap = (unsigned int)be_pixmap;
- be_new_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- be_new_req->numAttribs = 0;
- UnlockDisplay(dpy);
- SyncHandle();
- }
- else if (pFBConfig && glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
- __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s );
- xGLXCreateGLXPixmapWithConfigSGIXReq *ext_req;
- xGLXVendorPrivateReq *vpreq;
-
- LockDisplay(dpy);
- pGlxPixmap->be_xids[s] = XAllocID(dpy);
- GetReqExtra(GLXVendorPrivate,
- sz_xGLXCreateGLXPixmapWithConfigSGIXReq-sz_xGLXVendorPrivateReq,
- vpreq);
- ext_req = (xGLXCreateGLXPixmapWithConfigSGIXReq *)vpreq;
- ext_req->reqType = dmxScreen->glxMajorOpcode;
- ext_req->glxCode = X_GLXVendorPrivate;
- ext_req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX;
- ext_req->screen = DefaultScreen(dpy);
- ext_req->fbconfig = be_FBConfig->id;
- ext_req->pixmap = (unsigned int)be_pixmap;
- ext_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
- }
- else if (pGlxVisual) {
- LockDisplay(dpy);
- pGlxPixmap->be_xids[s] = XAllocID(dpy);
- GetReq(GLXCreateGLXPixmap,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCreateGLXPixmap;
- be_req->screen = DefaultScreen(dpy);
- be_req->visual = (unsigned int)glxMatchGLXVisualInConfigList(
- pGlxVisual,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals );
- be_req->pixmap = (unsigned int)be_pixmap;
- be_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
- }
- else {
- client->errorValue = ( visual ? visual : fbconfigId );
- free( pGlxPixmap );
- return BadValue;
- }
-
- XFlush( dpy );
+ be_pixmap = (DMX_GET_PIXMAP_PRIV((PixmapPtr) pRealDraw))->pixmap;
+
+ /* make sure pixmap already created on back-end */
+ dmxSync(dmxScreen, 1);
+
+ if (pFBConfig && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ __GLXFBConfig *be_FBConfig =
+ glxLookupBackEndFBConfig(pFBConfig->id, s);
+
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReq(GLXCreatePixmap, be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXCreatePixmap;
+ be_new_req->screen = DefaultScreen(dpy);
+ be_new_req->fbconfig = be_FBConfig->id;
+ be_new_req->pixmap = (unsigned int) be_pixmap;
+ be_new_req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s];
+ be_new_req->numAttribs = 0;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else if (pFBConfig && glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
+ __GLXFBConfig *be_FBConfig =
+ glxLookupBackEndFBConfig(pFBConfig->id, s);
+ xGLXCreateGLXPixmapWithConfigSGIXReq *ext_req;
+ xGLXVendorPrivateReq *vpreq;
+
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReqExtra(GLXVendorPrivate,
+ sz_xGLXCreateGLXPixmapWithConfigSGIXReq -
+ sz_xGLXVendorPrivateReq, vpreq);
+ ext_req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivate;
+ ext_req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX;
+ ext_req->screen = DefaultScreen(dpy);
+ ext_req->fbconfig = be_FBConfig->id;
+ ext_req->pixmap = (unsigned int) be_pixmap;
+ ext_req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else if (pGlxVisual) {
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReq(GLXCreateGLXPixmap, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreateGLXPixmap;
+ be_req->screen = DefaultScreen(dpy);
+ be_req->visual =
+ (unsigned int) glxMatchGLXVisualInConfigList(pGlxVisual,
+ dmxScreen->
+ glxVisuals,
+ dmxScreen->
+ numGlxVisuals);
+ be_req->pixmap = (unsigned int) be_pixmap;
+ be_req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else {
+ client->errorValue = (visual ? visual : fbconfigId);
+ free(pGlxPixmap);
+ return BadValue;
+ }
+
+ XFlush(dpy);
}
if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) {
- free( pGlxPixmap );
- return BadAlloc;
+ free(pGlxPixmap);
+ return BadAlloc;
}
return Success;
}
-int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreateGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
- return( CreateGLXPixmap(cl, req->visual, None,
- req->screen, req->pixmap, req->glxpixmap) );
+ return (CreateGLXPixmap(cl, req->visual, None,
+ req->screen, req->pixmap, req->glxpixmap));
}
-int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreatePixmap(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
- return( CreateGLXPixmap(cl, None, req->fbconfig,
- req->screen, req->pixmap, req->glxpixmap) );
+ return (CreateGLXPixmap(cl, None, req->fbconfig,
+ req->screen, req->pixmap, req->glxpixmap));
}
-int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
@@ -1926,13 +2022,13 @@ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
int from_screen, to_screen;
/*
- ** Check if it's a valid GLX pixmap.
- */
- dixLookupResourceByType((pointer*) &pGlxPixmap, glxpixmap,
+ ** Check if it's a valid GLX pixmap.
+ */
+ dixLookupResourceByType((pointer *) &pGlxPixmap, glxpixmap,
__glXPixmapRes, NullClient, DixUnknownAccess);
if (!pGlxPixmap) {
- client->errorValue = glxpixmap;
- return __glXBadPixmap;
+ client->errorValue = glxpixmap;
+ return __glXBadPixmap;
}
FreeResource(glxpixmap, FALSE);
@@ -1942,28 +2038,27 @@ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
from_screen = to_screen = pGlxPixmap->pDraw->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- /* make sure pixmap exist in back-end */
- dmxSync( dmxScreen, 1 );
+ /* make sure pixmap exist in back-end */
+ dmxSync(dmxScreen, 1);
- LockDisplay(dpy);
- GetReq(GLXDestroyGLXPixmap,req);
- req->reqType = dmxScreen->glxMajorOpcode;
- req->glxCode = X_GLXDestroyGLXPixmap;
- req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXDestroyGLXPixmap, req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXDestroyGLXPixmap;
+ req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
}
-
return Success;
}
@@ -1974,7 +2069,8 @@ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
** this time that is of value. Consequently, this code must be
** implemented by somebody other than SGI.
*/
-int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
+int
+__glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag)
{
ClientPtr client = cl->client;
DrawablePtr pDraw;
@@ -1982,6 +2078,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
WindowPtr pWin = NULL;
__GLXpixmap *pGlxPixmap = NULL;
__GLXcontext *glxc = NULL;
+
#ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL;
#endif
@@ -1989,152 +2086,154 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
int from_screen = 0;
int to_screen = 0;
int s, rc;
-
+
/*
- ** Check that the GLX drawable is valid.
- */
+ ** Check that the GLX drawable is valid.
+ */
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
if (rc == Success) {
from_screen = to_screen = pDraw->pScreen->myNum;
- if (pDraw->type == DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X window.
- */
- pWin = (WindowPtr)pDraw;
- } else {
- /*
- ** Drawable is an X pixmap, which is not allowed.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X window.
+ */
+ pWin = (WindowPtr) pDraw;
+ }
+ else {
+ /*
+ ** Drawable is an X pixmap, which is not allowed.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
if (!pDraw) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- /*
- ** Drawable is a GLX pixmap.
- */
- pDraw = pGlxPixmap->pDraw;
- from_screen = to_screen = pGlxPixmap->pScreen->myNum;
- }
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- /*
- ** Drawable is a GLXWindow.
- */
- pDraw = pGlxWindow->pDraw;
- from_screen = to_screen = pGlxWindow->pScreen->myNum;
- }
+ dixLookupResourceByType((pointer *) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ /*
+ ** Drawable is a GLX pixmap.
+ */
+ pDraw = pGlxPixmap->pDraw;
+ from_screen = to_screen = pGlxPixmap->pScreen->myNum;
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ */
+ pDraw = pGlxWindow->pDraw;
+ from_screen = to_screen = pGlxWindow->pScreen->myNum;
+ }
}
if (!pDraw) {
- /*
- ** Drawable is neither a X window nor a GLX pixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
+ /*
+ ** Drawable is neither a X window nor a GLX pixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
}
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc) {
- return __glXBadContextTag;
- }
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXBadContextTag;
+ }
}
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ dixLookupResourceByClass((pointer *) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
}
#endif
/* If requested, send a glFinish to all back-end servers before swapping. */
if (dmxGLXFinishSwap) {
- for (s=from_screen; s<=to_screen; s++) {
- Display *dpy = GetBackEndDisplay(cl,s);
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- xGLXSingleReq *finishReq;
- xGLXSingleReply reply;
-
-#define X_GLXSingle 0 /* needed by GetReq below */
-
- LockDisplay(dpy);
- GetReq(GLXSingle,finishReq);
- finishReq->reqType = dmxScreen->glxMajorOpcode;
- finishReq->glxCode = X_GLsop_Finish;
- finishReq->contextTag = (tag ? GetCurrentBackEndTag(cl,tag,s) : 0);
- (void) _XReply(dpy, (xReply*) &reply, 0, False);
- UnlockDisplay(dpy);
- SyncHandle();
- }
+ for (s = from_screen; s <= to_screen; s++) {
+ Display *dpy = GetBackEndDisplay(cl, s);
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ xGLXSingleReq *finishReq;
+ xGLXSingleReply reply;
+
+#define X_GLXSingle 0 /* needed by GetReq below */
+
+ LockDisplay(dpy);
+ GetReq(GLXSingle, finishReq);
+ finishReq->reqType = dmxScreen->glxMajorOpcode;
+ finishReq->glxCode = X_GLsop_Finish;
+ finishReq->contextTag =
+ (tag ? GetCurrentBackEndTag(cl, tag, s) : 0);
+ (void) _XReply(dpy, (xReply *) & reply, 0, False);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
}
/* If requested, send an XSync to all back-end servers before swapping. */
if (dmxGLXSyncSwap) {
- for (s=from_screen; s<=to_screen; s++)
- XSync(GetBackEndDisplay(cl,s), False);
+ for (s = from_screen; s <= to_screen; s++)
+ XSync(GetBackEndDisplay(cl, s), False);
}
-
/* send the SwapBuffers request to all back-end servers */
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- unsigned int be_draw = 0;
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+ unsigned int be_draw = 0;
- if (pGlxPixmap) {
- be_draw = (unsigned int)pGlxPixmap->be_xids[s];
- }
+ if (pGlxPixmap) {
+ be_draw = (unsigned int) pGlxPixmap->be_xids[s];
+ }
#ifdef PANORAMIX
- else if (pXinDraw) {
- dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
- }
+ else if (pXinDraw) {
+ dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
+ }
#endif
- else if (pGlxWindow) {
- pWin = (WindowPtr)pGlxWindow->pDraw;
- }
-
- if (pWin && !be_draw) {
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_draw) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
-
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReq(GLXSwapBuffers,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXSwapBuffers;
- be_req->drawable = be_draw;
- be_req->contextTag = ( tag ? GetCurrentBackEndTag(cl,tag,s) : 0 );
- UnlockDisplay(dpy);
- SyncHandle();
- XFlush(dpy);
+ else if (pGlxWindow) {
+ pWin = (WindowPtr) pGlxWindow->pDraw;
+ }
+
+ if (pWin && !be_draw) {
+ be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+ be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+
+ dmxSync(dmxScreen, 1);
+
+ LockDisplay(dpy);
+ GetReq(GLXSwapBuffers, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXSwapBuffers;
+ be_req->drawable = be_draw;
+ be_req->contextTag = (tag ? GetCurrentBackEndTag(cl, tag, s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ XFlush(dpy);
}
return Success;
}
-int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapBuffers(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
DrawablePtr pDraw;
@@ -2145,68 +2244,67 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
__GLXcontext *glxc = NULL;
__glXWindow *pGlxWindow = NULL;
int rc;
-
+
/*
- ** Check that the GLX drawable is valid.
- */
+ ** Check that the GLX drawable is valid.
+ */
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
if (rc == Success) {
- if (pDraw->type != DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X pixmap, which is not allowed.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X pixmap, which is not allowed.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
if (!pDraw) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- /*
- ** Drawable is a GLX pixmap.
- */
- pDraw = pGlxPixmap->pDraw;
- }
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- /*
- ** Drawable is a GLXWindow.
- */
- pDraw = pGlxWindow->pDraw;
- }
+ dixLookupResourceByType((pointer *) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ /*
+ ** Drawable is a GLX pixmap.
+ */
+ pDraw = pGlxPixmap->pDraw;
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ */
+ pDraw = pGlxWindow->pDraw;
+ }
}
if (!pDraw) {
- /*
- ** Drawable is neither a X window nor a GLX pixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
+ /*
+ ** Drawable is neither a X window nor a GLX pixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
}
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc) {
- return __glXBadContextTag;
- }
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXBadContextTag;
+ }
}
if (pDraw &&
- pDraw->type == DRAWABLE_WINDOW &&
- DMX_GET_WINDOW_PRIV((WindowPtr)pDraw)->swapGroup) {
- return SGSwapBuffers(cl, drawId, tag, pDraw);
+ pDraw->type == DRAWABLE_WINDOW &&
+ DMX_GET_WINDOW_PRIV((WindowPtr) pDraw)->swapGroup) {
+ return SGSwapBuffers(cl, drawId, tag, pDraw);
}
return __glXDoSwapBuffers(cl, drawId, tag);
}
-
/************************************************************************/
/*
@@ -2217,7 +2315,8 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
/*
** Execute all the drawing commands in a request.
*/
-int __glXRender(__GLXclientState *cl, GLbyte *pc)
+int
+__glXRender(__GLXclientState * cl, GLbyte * pc)
{
xGLXRenderReq *req;
xGLXRenderReq *be_req;
@@ -2228,23 +2327,23 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc)
int s;
/*
- ** NOTE: much of this code also appears in the byteswapping version of this
- ** routine, __glXSwapRender(). Any changes made here should also be
- ** duplicated there.
- */
-
+ ** NOTE: much of this code also appears in the byteswapping version of this
+ ** routine, __glXSwapRender(). Any changes made here should also be
+ ** duplicated there.
+ */
+
req = (xGLXRenderReq *) pc;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -2254,19 +2353,19 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc)
/*
* just forward the request to back-end server(s)
*/
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- LockDisplay(dpy);
- GetReq(GLXRender,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXRender;
- be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- _XSend(dpy, (const char *)pc, size);
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXRender, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXRender;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ _XSend(dpy, (const char *) pc, size);
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
@@ -2275,7 +2374,8 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc)
/*
** Execute a large rendering request (one that spans multiple X requests).
*/
-int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
+int
+__glXRenderLarge(__GLXclientState * cl, GLbyte * pc)
{
xGLXRenderLargeReq *req;
xGLXRenderLargeReq *be_req;
@@ -2285,22 +2385,22 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
int s;
/*
- ** NOTE: much of this code also appears in the byteswapping version of this
- ** routine, __glXSwapRenderLarge(). Any changes made here should also be
- ** duplicated there.
- */
-
+ ** NOTE: much of this code also appears in the byteswapping version of this
+ ** routine, __glXSwapRenderLarge(). Any changes made here should also be
+ ** duplicated there.
+ */
+
req = (xGLXRenderLargeReq *) pc;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -2309,82 +2409,82 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
/*
* just forward the request to back-end server(s)
*/
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- GetReq(GLXRenderLarge,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXRenderLarge;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- be_req->length = req->length;
- be_req->requestNumber = req->requestNumber;
- be_req->requestTotal = req->requestTotal;
- be_req->dataBytes = req->dataBytes;
- Data(dpy, (const char *)pc, req->dataBytes);
- UnlockDisplay(dpy);
- SyncHandle();
+ GetReq(GLXRenderLarge, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXRenderLarge;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ be_req->length = req->length;
+ be_req->requestNumber = req->requestNumber;
+ be_req->requestTotal = req->requestTotal;
+ be_req->dataBytes = req->dataBytes;
+ Data(dpy, (const char *) pc, req->dataBytes);
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
}
-
/************************************************************************/
-int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
+int
+__glXVendorPrivate(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateReq *req;
req = (xGLXVendorPrivateReq *) pc;
- switch( req->vendorCode ) {
-
- case X_GLvop_DeleteTexturesEXT:
- return __glXVForwardSingleReq( cl, pc );
- break;
-
- case X_GLXvop_SwapIntervalSGI:
- if (glxIsExtensionSupported("SGI_swap_control")) {
- return __glXVForwardSingleReq( cl, pc );
- }
- else {
- return Success;
- }
- break;
-
-#if 0 /* glx 1.3 */
- case X_GLXvop_CreateGLXVideoSourceSGIX:
- break;
- case X_GLXvop_DestroyGLXVideoSourceSGIX:
- break;
- case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
- break;
- case X_GLXvop_DestroyGLXPbufferSGIX:
- break;
- case X_GLXvop_ChangeDrawableAttributesSGIX:
- break;
+ switch (req->vendorCode) {
+
+ case X_GLvop_DeleteTexturesEXT:
+ return __glXVForwardSingleReq(cl, pc);
+ break;
+
+ case X_GLXvop_SwapIntervalSGI:
+ if (glxIsExtensionSupported("SGI_swap_control")) {
+ return __glXVForwardSingleReq(cl, pc);
+ }
+ else {
+ return Success;
+ }
+ break;
+
+#if 0 /* glx 1.3 */
+ case X_GLXvop_CreateGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_DestroyGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
+ break;
+ case X_GLXvop_DestroyGLXPbufferSGIX:
+ break;
+ case X_GLXvop_ChangeDrawableAttributesSGIX:
+ break;
#endif
- case X_GLXvop_BindSwapBarrierSGIX:
- return __glXBindSwapBarrierSGIX( cl, pc );
- break;
+ case X_GLXvop_BindSwapBarrierSGIX:
+ return __glXBindSwapBarrierSGIX(cl, pc);
+ break;
- case X_GLXvop_JoinSwapGroupSGIX:
- return __glXJoinSwapGroupSGIX( cl, pc );
- break;
+ case X_GLXvop_JoinSwapGroupSGIX:
+ return __glXJoinSwapGroupSGIX(cl, pc);
+ break;
- case X_GLXvop_CreateContextWithConfigSGIX:
- return __glXCreateContextWithConfigSGIX( cl, pc );
- break;
+ case X_GLXvop_CreateContextWithConfigSGIX:
+ return __glXCreateContextWithConfigSGIX(cl, pc);
+ break;
- default:
- /*
- ** unsupported private request
- */
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
}
cl->client->errorValue = req->vendorCode;
@@ -2392,78 +2492,79 @@ int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
}
-int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+int
+__glXVendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateWithReplyReq *req;
req = (xGLXVendorPrivateWithReplyReq *) pc;
- switch( req->vendorCode ) {
-
- case X_GLvop_GetConvolutionFilterEXT:
- case X_GLvop_GetConvolutionParameterfvEXT:
- case X_GLvop_GetConvolutionParameterivEXT:
- case X_GLvop_GetSeparableFilterEXT:
- case X_GLvop_GetHistogramEXT:
- case X_GLvop_GetHistogramParameterivEXT:
- case X_GLvop_GetMinmaxEXT:
- case X_GLvop_GetMinmaxParameterfvEXT:
- case X_GLvop_GetMinmaxParameterivEXT:
- case X_GLvop_AreTexturesResidentEXT:
- case X_GLvop_IsTextureEXT:
- return( __glXVForwardPipe0WithReply(cl, pc) );
- break;
-
- case X_GLvop_GenTexturesEXT:
- return( __glXVForwardAllWithReply(cl, pc) );
- break;
-
-
-#if 0 /* glx1.3 */
- case X_GLvop_GetDetailTexFuncSGIS:
- case X_GLvop_GetSharpenTexFuncSGIS:
- case X_GLvop_GetColorTableSGI:
- case X_GLvop_GetColorTableParameterfvSGI:
- case X_GLvop_GetColorTableParameterivSGI:
- case X_GLvop_GetTexFilterFuncSGIS:
- case X_GLvop_GetInstrumentsSGIX:
- case X_GLvop_InstrumentsBufferSGIX:
- case X_GLvop_PollInstrumentsSGIX:
- case X_GLvop_FlushRasterSGIX:
- case X_GLXvop_CreateGLXPbufferSGIX:
- case X_GLXvop_GetDrawableAttributesSGIX:
- case X_GLXvop_QueryHyperpipeNetworkSGIX:
- case X_GLXvop_QueryHyperpipeConfigSGIX:
- case X_GLXvop_HyperpipeConfigSGIX:
- case X_GLXvop_DestroyHyperpipeConfigSGIX:
+ switch (req->vendorCode) {
+
+ case X_GLvop_GetConvolutionFilterEXT:
+ case X_GLvop_GetConvolutionParameterfvEXT:
+ case X_GLvop_GetConvolutionParameterivEXT:
+ case X_GLvop_GetSeparableFilterEXT:
+ case X_GLvop_GetHistogramEXT:
+ case X_GLvop_GetHistogramParameterivEXT:
+ case X_GLvop_GetMinmaxEXT:
+ case X_GLvop_GetMinmaxParameterfvEXT:
+ case X_GLvop_GetMinmaxParameterivEXT:
+ case X_GLvop_AreTexturesResidentEXT:
+ case X_GLvop_IsTextureEXT:
+ return (__glXVForwardPipe0WithReply(cl, pc));
+ break;
+
+ case X_GLvop_GenTexturesEXT:
+ return (__glXVForwardAllWithReply(cl, pc));
+ break;
+
+#if 0 /* glx1.3 */
+ case X_GLvop_GetDetailTexFuncSGIS:
+ case X_GLvop_GetSharpenTexFuncSGIS:
+ case X_GLvop_GetColorTableSGI:
+ case X_GLvop_GetColorTableParameterfvSGI:
+ case X_GLvop_GetColorTableParameterivSGI:
+ case X_GLvop_GetTexFilterFuncSGIS:
+ case X_GLvop_GetInstrumentsSGIX:
+ case X_GLvop_InstrumentsBufferSGIX:
+ case X_GLvop_PollInstrumentsSGIX:
+ case X_GLvop_FlushRasterSGIX:
+ case X_GLXvop_CreateGLXPbufferSGIX:
+ case X_GLXvop_GetDrawableAttributesSGIX:
+ case X_GLXvop_QueryHyperpipeNetworkSGIX:
+ case X_GLXvop_QueryHyperpipeConfigSGIX:
+ case X_GLXvop_HyperpipeConfigSGIX:
+ case X_GLXvop_DestroyHyperpipeConfigSGIX:
#endif
- case X_GLXvop_QueryMaxSwapBarriersSGIX:
- return( __glXQueryMaxSwapBarriersSGIX(cl, pc) );
- break;
+ case X_GLXvop_QueryMaxSwapBarriersSGIX:
+ return (__glXQueryMaxSwapBarriersSGIX(cl, pc));
+ break;
- case X_GLXvop_GetFBConfigsSGIX:
- return( __glXGetFBConfigsSGIX(cl, pc) );
- break;
+ case X_GLXvop_GetFBConfigsSGIX:
+ return (__glXGetFBConfigsSGIX(cl, pc));
+ break;
- case X_GLXvop_MakeCurrentReadSGI:
- return( __glXMakeCurrentReadSGI(cl, pc) );
- break;
+ case X_GLXvop_MakeCurrentReadSGI:
+ return (__glXMakeCurrentReadSGI(cl, pc));
+ break;
- case X_GLXvop_QueryContextInfoEXT:
- return( __glXQueryContextInfoEXT(cl,pc) );
- break;
+ case X_GLXvop_QueryContextInfoEXT:
+ return (__glXQueryContextInfoEXT(cl, pc));
+ break;
- default:
- /*
- ** unsupported private request
- */
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
}
}
-int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
@@ -2484,34 +2585,36 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
screen = req->screen;
/*
- ** Check if screen exists.
- */
+ ** Check if screen exists.
+ */
if ((screen < 0) || (screen >= screenInfo.numScreens)) {
- client->errorValue = screen;
- return BadValue;
+ client->errorValue = screen;
+ return BadValue;
}
#ifdef FWD_QUERY_REQ
dmxScreen = &dmxScreens[screen];
/* Send the glXQueryServerString request */
- dpy = GetBackEndDisplay(cl,screen);
+ dpy = GetBackEndDisplay(cl, screen);
LockDisplay(dpy);
- GetReq(GLXQueryExtensionsString,be_req);
+ GetReq(GLXQueryExtensionsString, be_req);
be_req->reqType = dmxScreen->glxMajorOpcode;
be_req->glxCode = X_GLXQueryServerString;
be_req->screen = DefaultScreen(dpy);
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- len = (int)be_reply.length;
- numbytes = (int)be_reply.n;
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
+ len = (int) be_reply.length;
+ numbytes = (int) be_reply.n;
slop = numbytes * __GLX_SIZE_INT8 & 3;
- be_buf = (char *)malloc(numbytes);
+ be_buf = (char *) malloc(numbytes);
if (!be_buf) {
/* Throw data on the floor */
_XEatData(dpy, len);
- } else {
- _XRead(dpy, (char *)be_buf, numbytes);
- if (slop) _XEatData(dpy,4-slop);
+ }
+ else {
+ _XRead(dpy, (char *) be_buf, numbytes);
+ if (slop)
+ _XEatData(dpy, 4 - slop);
}
UnlockDisplay(dpy);
SyncHandle();
@@ -2532,15 +2635,18 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
if (client->swapped) {
glxSwapQueryExtensionsStringReply(client, &reply, be_buf);
- } else {
- WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
- WriteToClient(client, (int)(length << 2), (char *)be_buf);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply,
+ (char *) &reply);
+ WriteToClient(client, (int) (length << 2), (char *) be_buf);
}
return Success;
}
-int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
@@ -2550,46 +2656,49 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
size_t length;
int len, numbytes;
char *be_buf;
+
#ifdef FWD_QUERY_REQ
xGLXQueryServerStringReq *be_req;
xGLXQueryServerStringReply be_reply;
DMXScreenInfo *dmxScreen;
Display *dpy;
- int slop;
+ int slop;
#endif
name = req->name;
screen = req->screen;
/*
- ** Check if screen exists.
- */
+ ** Check if screen exists.
+ */
if ((screen < 0) || (screen >= screenInfo.numScreens)) {
- client->errorValue = screen;
- return BadValue;
+ client->errorValue = screen;
+ return BadValue;
}
#ifdef FWD_QUERY_REQ
dmxScreen = &dmxScreens[screen];
/* Send the glXQueryServerString request */
- dpy = GetBackEndDisplay(cl,screen);
+ dpy = GetBackEndDisplay(cl, screen);
LockDisplay(dpy);
- GetReq(GLXQueryServerString,be_req);
+ GetReq(GLXQueryServerString, be_req);
be_req->reqType = dmxScreen->glxMajorOpcode;
be_req->glxCode = X_GLXQueryServerString;
be_req->screen = DefaultScreen(dpy);
be_req->name = name;
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- len = (int)be_reply.length;
- numbytes = (int)be_reply.n;
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
+ len = (int) be_reply.length;
+ numbytes = (int) be_reply.n;
slop = numbytes * __GLX_SIZE_INT8 & 3;
- be_buf = (char *)malloc(numbytes);
+ be_buf = (char *) malloc(numbytes);
if (!be_buf) {
/* Throw data on the floor */
_XEatData(dpy, len);
- } else {
- _XRead(dpy, (char *)be_buf, numbytes);
- if (slop) _XEatData(dpy,4-slop);
+ }
+ else {
+ _XRead(dpy, (char *) be_buf, numbytes);
+ if (slop)
+ _XEatData(dpy, 4 - slop);
}
UnlockDisplay(dpy);
SyncHandle();
@@ -2608,15 +2717,17 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
if (client->swapped) {
glxSwapQueryServerStringReply(client, &reply, be_buf);
- } else {
- WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
- WriteToClient(client, (int)(length << 2), be_buf);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) &reply);
+ WriteToClient(client, (int) (length << 2), be_buf);
}
return Success;
}
-int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
+int
+__glXClientInfo(__GLXclientState * cl, GLbyte * pc)
{
xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
xGLXClientInfoReq *be_req;
@@ -2624,38 +2735,38 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
int from_screen = 0;
int to_screen = 0;
int s;
-
+
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
free(cl->GLClientextensions);
- buf = (const char *)(req+1);
+ buf = (const char *) (req + 1);
cl->GLClientextensions = strdup(buf);
to_screen = screenInfo.numScreens - 1;
- for (s=from_screen; s<=to_screen; s++)
- {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- LockDisplay(dpy);
- GetReq(GLXClientInfo,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXClientInfo;
- be_req->major = req->major;
- be_req->minor = req->minor;
- be_req->length = req->length;
- be_req->numbytes = req->numbytes;
- Data(dpy, buf, req->numbytes);
+ LockDisplay(dpy);
+ GetReq(GLXClientInfo, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXClientInfo;
+ be_req->major = req->major;
+ be_req->minor = req->minor;
+ be_req->length = req->length;
+ be_req->numbytes = req->numbytes;
+ Data(dpy, buf, req->numbytes);
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
}
-int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
+int
+__glXUseXFont(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXUseXFontReq *req;
@@ -2665,66 +2776,66 @@ int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
int from_screen = 0;
int to_screen = 0;
int s;
- dmxFontPrivPtr pFontPriv;
+ dmxFontPrivPtr pFontPriv;
DMXScreenInfo *dmxScreen;
Display *dpy;
req = (xGLXUseXFontReq *) pc;
if (req->contextTag != 0) {
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (glxc) {
- from_screen = to_screen = glxc->pScreen->myNum;
- }
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
}
/*
- ** Font can actually be either the ID of a font or the ID of a GC
- ** containing a font.
- */
- dixLookupResourceByType((pointer*) &pFont, req->font, RT_FONT,
+ ** Font can actually be either the ID of a font or the ID of a GC
+ ** containing a font.
+ */
+ dixLookupResourceByType((pointer *) &pFont, req->font, RT_FONT,
NullClient, DixUnknownAccess);
if (!pFont) {
GC *pGC;
- dixLookupResourceByType((pointer*) &pGC, req->font,
- RT_GC, NullClient,
- DixUnknownAccess);
+
+ dixLookupResourceByType((pointer *) &pGC, req->font,
+ RT_GC, NullClient, DixUnknownAccess);
if (!pGC) {
- client->errorValue = req->font;
+ client->errorValue = req->font;
return BadFont;
- }
- pFont = pGC->font;
+ }
+ pFont = pGC->font;
}
pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
+ for (s = from_screen; s <= to_screen; s++) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl, s);
- for (s=from_screen; s<=to_screen; s++) {
- dmxScreen = &dmxScreens[s];
- dpy = GetBackEndDisplay(cl,s);
-
- dmxSync( dmxScreen, 1 );
+ dmxSync(dmxScreen, 1);
- LockDisplay(dpy);
- GetReq(GLXUseXFont,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXUseXFont;
- be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- be_req->font = pFontPriv->font[s]->fid;
- be_req->first = req->first;
- be_req->count = req->count;
- be_req->listBase = req->listBase;
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXUseXFont, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXUseXFont;
+ be_req->contextTag =
+ (glxc ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0);
+ be_req->font = pFontPriv->font[s]->fid;
+ be_req->first = req->first;
+ be_req->count = req->count;
+ be_req->listBase = req->listBase;
+ UnlockDisplay(dpy);
+ SyncHandle();
- XSync( dpy, False );
+ XSync(dpy, False);
}
return Success;
@@ -2734,7 +2845,8 @@ int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
* start GLX 1.3 here
*/
-int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+int
+__glXGetFBConfigs(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
@@ -2747,9 +2859,9 @@ int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
__GLXscreenInfo *pGlxScreen;
if (screen >= screenInfo.numScreens) {
- /* The client library must send a valid screen number. */
- client->errorValue = screen;
- return BadValue;
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
}
pGlxScreen = &__glXActiveScreens[screen];
@@ -2762,169 +2874,174 @@ int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numFBConfigs);
- __GLX_SWAP_INT(&reply.numAttribs);
- }
- WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
-
- for (i=0; i < numFBConfigs; i++) {
- int associatedVisualId = 0;
- int drawableTypeIndex;
- pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1) ];
-
- p = 0;
- /* core attributes */
- buf[p++] = GLX_FBCONFIG_ID;
- buf[p++] = pFBConfig->id;
- buf[p++] = GLX_BUFFER_SIZE;
- buf[p++] = pFBConfig->indexBits;
- buf[p++] = GLX_LEVEL;
- buf[p++] = pFBConfig->level;
- buf[p++] = GLX_DOUBLEBUFFER;
- buf[p++] = pFBConfig->doubleBufferMode;
- buf[p++] = GLX_STEREO;
- buf[p++] = pFBConfig->stereoMode;
- buf[p++] = GLX_AUX_BUFFERS;
- buf[p++] = pFBConfig->maxAuxBuffers;
- buf[p++] = GLX_RED_SIZE;
- buf[p++] = pFBConfig->redBits;
- buf[p++] = GLX_GREEN_SIZE;
- buf[p++] = pFBConfig->greenBits;
- buf[p++] = GLX_BLUE_SIZE;
- buf[p++] = pFBConfig->blueBits;
- buf[p++] = GLX_ALPHA_SIZE;
- buf[p++] = pFBConfig->alphaBits;
- buf[p++] = GLX_DEPTH_SIZE;
- buf[p++] = pFBConfig->depthBits;
- buf[p++] = GLX_STENCIL_SIZE;
- buf[p++] = pFBConfig->stencilBits;
- buf[p++] = GLX_ACCUM_RED_SIZE;
- buf[p++] = pFBConfig->accumRedBits;
- buf[p++] = GLX_ACCUM_GREEN_SIZE;
- buf[p++] = pFBConfig->accumGreenBits;
- buf[p++] = GLX_ACCUM_BLUE_SIZE;
- buf[p++] = pFBConfig->accumBlueBits;
- buf[p++] = GLX_ACCUM_ALPHA_SIZE;
- buf[p++] = pFBConfig->accumAlphaBits;
- buf[p++] = GLX_RENDER_TYPE;
- buf[p++] = pFBConfig->renderType;
- buf[p++] = GLX_DRAWABLE_TYPE;
- drawableTypeIndex = p;
- buf[p++] = pFBConfig->drawableType;
- buf[p++] = GLX_X_VISUAL_TYPE;
- buf[p++] = pFBConfig->visualType;
- buf[p++] = GLX_CONFIG_CAVEAT;
- buf[p++] = pFBConfig->visualCaveat;
- buf[p++] = GLX_TRANSPARENT_TYPE;
- buf[p++] = pFBConfig->transparentType;
- buf[p++] = GLX_TRANSPARENT_RED_VALUE;
- buf[p++] = pFBConfig->transparentRed;
- buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
- buf[p++] = pFBConfig->transparentGreen;
- buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
- buf[p++] = pFBConfig->transparentBlue;
- buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
- buf[p++] = pFBConfig->transparentAlpha;
- buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
- buf[p++] = pFBConfig->transparentIndex;
- buf[p++] = GLX_MAX_PBUFFER_WIDTH;
- buf[p++] = pFBConfig->maxPbufferWidth;
- buf[p++] = GLX_MAX_PBUFFER_HEIGHT;
- buf[p++] = pFBConfig->maxPbufferHeight;
- buf[p++] = GLX_MAX_PBUFFER_PIXELS;
- buf[p++] = pFBConfig->maxPbufferPixels;
-
- /*
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numFBConfigs);
+ __GLX_SWAP_INT(&reply.numAttribs);
+ }
+ WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *) &reply);
+
+ for (i = 0; i < numFBConfigs; i++) {
+ int associatedVisualId = 0;
+ int drawableTypeIndex;
+
+ pFBConfig = __glXFBConfigs[i * (screenInfo.numScreens + 1)];
+
+ p = 0;
+ /* core attributes */
+ buf[p++] = GLX_FBCONFIG_ID;
+ buf[p++] = pFBConfig->id;
+ buf[p++] = GLX_BUFFER_SIZE;
+ buf[p++] = pFBConfig->indexBits;
+ buf[p++] = GLX_LEVEL;
+ buf[p++] = pFBConfig->level;
+ buf[p++] = GLX_DOUBLEBUFFER;
+ buf[p++] = pFBConfig->doubleBufferMode;
+ buf[p++] = GLX_STEREO;
+ buf[p++] = pFBConfig->stereoMode;
+ buf[p++] = GLX_AUX_BUFFERS;
+ buf[p++] = pFBConfig->maxAuxBuffers;
+ buf[p++] = GLX_RED_SIZE;
+ buf[p++] = pFBConfig->redBits;
+ buf[p++] = GLX_GREEN_SIZE;
+ buf[p++] = pFBConfig->greenBits;
+ buf[p++] = GLX_BLUE_SIZE;
+ buf[p++] = pFBConfig->blueBits;
+ buf[p++] = GLX_ALPHA_SIZE;
+ buf[p++] = pFBConfig->alphaBits;
+ buf[p++] = GLX_DEPTH_SIZE;
+ buf[p++] = pFBConfig->depthBits;
+ buf[p++] = GLX_STENCIL_SIZE;
+ buf[p++] = pFBConfig->stencilBits;
+ buf[p++] = GLX_ACCUM_RED_SIZE;
+ buf[p++] = pFBConfig->accumRedBits;
+ buf[p++] = GLX_ACCUM_GREEN_SIZE;
+ buf[p++] = pFBConfig->accumGreenBits;
+ buf[p++] = GLX_ACCUM_BLUE_SIZE;
+ buf[p++] = pFBConfig->accumBlueBits;
+ buf[p++] = GLX_ACCUM_ALPHA_SIZE;
+ buf[p++] = pFBConfig->accumAlphaBits;
+ buf[p++] = GLX_RENDER_TYPE;
+ buf[p++] = pFBConfig->renderType;
+ buf[p++] = GLX_DRAWABLE_TYPE;
+ drawableTypeIndex = p;
+ buf[p++] = pFBConfig->drawableType;
+ buf[p++] = GLX_X_VISUAL_TYPE;
+ buf[p++] = pFBConfig->visualType;
+ buf[p++] = GLX_CONFIG_CAVEAT;
+ buf[p++] = pFBConfig->visualCaveat;
+ buf[p++] = GLX_TRANSPARENT_TYPE;
+ buf[p++] = pFBConfig->transparentType;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE;
+ buf[p++] = pFBConfig->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
+ buf[p++] = pFBConfig->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
+ buf[p++] = pFBConfig->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
+ buf[p++] = pFBConfig->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
+ buf[p++] = pFBConfig->transparentIndex;
+ buf[p++] = GLX_MAX_PBUFFER_WIDTH;
+ buf[p++] = pFBConfig->maxPbufferWidth;
+ buf[p++] = GLX_MAX_PBUFFER_HEIGHT;
+ buf[p++] = pFBConfig->maxPbufferHeight;
+ buf[p++] = GLX_MAX_PBUFFER_PIXELS;
+ buf[p++] = pFBConfig->maxPbufferPixels;
+
+ /*
* find the visual of the back-end server and match a visual
- * on the proxy.
- * do only once - if a visual is not yet associated.
- */
- if (pFBConfig->associatedVisualId == (unsigned int)-1) {
- DMXScreenInfo *dmxScreen = &dmxScreens[screen];
- __GLXFBConfig *be_pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1)+screen+1 ];
- __GLXvisualConfig *pGlxVisual = NULL;
- int v;
- int found = 0;
- for (v=0; v<dmxScreen->numGlxVisuals; v++) {
- if (dmxScreen->glxVisuals[v].vid == be_pFBConfig->associatedVisualId) {
- pGlxVisual = &dmxScreen->glxVisuals[v];
- break;
- }
- }
-
- if (pGlxVisual) {
- for (v=0; v<pGlxScreen->numVisuals; v++) {
- if (glxVisualsMatch(&pGlxScreen->pGlxVisual[v], pGlxVisual)) {
- associatedVisualId = pGlxScreen->pGlxVisual[v].vid;
- found = 1;
- break;
- }
- }
- }
-
- if (!found) {
- associatedVisualId = 0;
- pFBConfig->drawableType &= ~(GLX_WINDOW_BIT);
- buf[drawableTypeIndex] = pFBConfig->drawableType;
- }
+ * on the proxy.
+ * do only once - if a visual is not yet associated.
+ */
+ if (pFBConfig->associatedVisualId == (unsigned int) -1) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[screen];
+ __GLXFBConfig *be_pFBConfig =
+ __glXFBConfigs[i * (screenInfo.numScreens + 1) + screen + 1];
+ __GLXvisualConfig *pGlxVisual = NULL;
+ int v;
+ int found = 0;
+
+ for (v = 0; v < dmxScreen->numGlxVisuals; v++) {
+ if (dmxScreen->glxVisuals[v].vid ==
+ be_pFBConfig->associatedVisualId) {
+ pGlxVisual = &dmxScreen->glxVisuals[v];
+ break;
+ }
+ }
+
+ if (pGlxVisual) {
+ for (v = 0; v < pGlxScreen->numVisuals; v++) {
+ if (glxVisualsMatch(&pGlxScreen->pGlxVisual[v], pGlxVisual)) {
+ associatedVisualId = pGlxScreen->pGlxVisual[v].vid;
+ found = 1;
+ break;
+ }
+ }
+ }
+
+ if (!found) {
+ associatedVisualId = 0;
+ pFBConfig->drawableType &= ~(GLX_WINDOW_BIT);
+ buf[drawableTypeIndex] = pFBConfig->drawableType;
+ }
#ifdef PANORAMIX
- else if (!noPanoramiXExtension) {
- /* convert the associated visualId to the panoramix one */
- pFBConfig->associatedVisualId =
- PanoramiXTranslateVisualID(screen, v);
- }
+ else if (!noPanoramiXExtension) {
+ /* convert the associated visualId to the panoramix one */
+ pFBConfig->associatedVisualId =
+ PanoramiXTranslateVisualID(screen, v);
+ }
#endif
- }
- else {
- associatedVisualId = pFBConfig->associatedVisualId;
- }
-
- buf[p++] = GLX_VISUAL_ID;
- buf[p++] = associatedVisualId;
-
- /* SGIS_multisample attributes */
- buf[p++] = GLX_SAMPLES_SGIS;
- buf[p++] = pFBConfig->multiSampleSize;
- buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
- buf[p++] = pFBConfig->nMultiSampleBuffers;
-
- /* SGIX_pbuffer specific attributes */
- buf[p++] = GLX_OPTIMAL_PBUFFER_WIDTH_SGIX;
- buf[p++] = pFBConfig->optimalPbufferWidth;
- buf[p++] = GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX;
- buf[p++] = pFBConfig->optimalPbufferHeight;
-
- buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
- buf[p++] = pFBConfig->visualSelectGroup;
-
- if (client->swapped) {
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY((int *)buf, 2*numAttribs);
- }
- WriteToClient(client, 2*numAttribs * __GLX_SIZE_CARD32, (char *)buf);
+ }
+ else {
+ associatedVisualId = pFBConfig->associatedVisualId;
+ }
+
+ buf[p++] = GLX_VISUAL_ID;
+ buf[p++] = associatedVisualId;
+
+ /* SGIS_multisample attributes */
+ buf[p++] = GLX_SAMPLES_SGIS;
+ buf[p++] = pFBConfig->multiSampleSize;
+ buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+ buf[p++] = pFBConfig->nMultiSampleBuffers;
+
+ /* SGIX_pbuffer specific attributes */
+ buf[p++] = GLX_OPTIMAL_PBUFFER_WIDTH_SGIX;
+ buf[p++] = pFBConfig->optimalPbufferWidth;
+ buf[p++] = GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX;
+ buf[p++] = pFBConfig->optimalPbufferHeight;
+
+ buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
+ buf[p++] = pFBConfig->visualSelectGroup;
+
+ if (client->swapped) {
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_SWAP_INT_ARRAY((int *) buf, 2 * numAttribs);
+ }
+ WriteToClient(client, 2 * numAttribs * __GLX_SIZE_CARD32, (char *) buf);
}
return Success;
}
-int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc;
- xGLXGetFBConfigsReq new_req;
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
+ xGLXGetFBConfigsReq new_req;
- new_req.reqType = req->reqType;
- new_req.glxCode = req->glxCode;
- new_req.length = req->length;
- new_req.screen = req->screen;
+ new_req.reqType = req->reqType;
+ new_req.glxCode = req->glxCode;
+ new_req.length = req->length;
+ new_req.screen = req->screen;
- return( __glXGetFBConfigs( cl, (GLbyte *)&new_req ) );
+ return (__glXGetFBConfigs(cl, (GLbyte *) & new_req));
}
-
-int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreateWindow(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
@@ -2942,86 +3059,87 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
pointer val;
/*
- ** Check if windowId is valid
- */
+ ** Check if windowId is valid
+ */
rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
- DixAddAccess);
+ DixAddAccess);
if (rc != Success)
- return rc;
+ return rc;
/*
- ** Check if screen of window matches screen of fbconfig.
- */
+ ** Check if screen of window matches screen of fbconfig.
+ */
pScreen = pDraw->pScreen;
if (screen != pScreen->myNum) {
- return BadMatch;
+ return BadMatch;
}
/*
- ** Find the FBConfigRec for this fbconfigid.
- */
+ ** Find the FBConfigRec for this fbconfigid.
+ */
if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) {
- client->errorValue = fbconfigId;
- return __glXBadFBConfig;
+ client->errorValue = fbconfigId;
+ return __glXBadFBConfig;
}
visId = pGlxFBConfig->associatedVisualId;
/*
- ** Check if the fbconfig supports rendering to windows
- */
- if( !(pGlxFBConfig->drawableType & GLX_WINDOW_BIT) ) {
- return BadMatch;
+ ** Check if the fbconfig supports rendering to windows
+ */
+ if (!(pGlxFBConfig->drawableType & GLX_WINDOW_BIT)) {
+ return BadMatch;
}
if (visId != None) {
- /*
- ** Check if the visual ID is valid for this screen.
- */
- pVisual = pScreen->visuals;
- for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
- if (pVisual->vid == visId) {
- break;
- }
- }
- if (i == pScreen->numVisuals) {
- client->errorValue = visId;
- return BadValue;
- }
-
/*
- ** Check if color buffer depth of fbconfig matches depth
- ** of window.
- */
+ ** Check if the visual ID is valid for this screen.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visId) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visId;
+ return BadValue;
+ }
+
+ /*
+ ** Check if color buffer depth of fbconfig matches depth
+ ** of window.
+ */
if (pVisual->nplanes != pDraw->depth) {
- return BadMatch;
- }
- } else
- /*
- ** The window was created with no visual that corresponds
- ** to fbconfig
- */
- return BadMatch;
+ return BadMatch;
+ }
+ }
+ else
+ /*
+ ** The window was created with no visual that corresponds
+ ** to fbconfig
+ */
+ return BadMatch;
/*
- ** Check if there is already a fbconfig associated with this window
- */
+ ** Check if there is already a fbconfig associated with this window
+ */
if (Success == dixLookupResourceByType(&val,
- glxwindowId, __glXWindowRes,
- NullClient, DixUnknownAccess)) {
- client->errorValue = glxwindowId;
- return BadAlloc;
+ glxwindowId, __glXWindowRes,
+ NullClient, DixUnknownAccess)) {
+ client->errorValue = glxwindowId;
+ return BadAlloc;
}
pGlxWindow = (__glXWindow *) malloc(sizeof(__glXWindow));
if (!pGlxWindow) {
- return BadAlloc;
+ return BadAlloc;
}
/*
- ** Register this GLX window as a resource
- */
+ ** Register this GLX window as a resource
+ */
if (!(AddResource(glxwindowId, __glXWindowRes, pGlxWindow))) {
- return BadAlloc;
+ return BadAlloc;
}
pGlxWindow->pDraw = pDraw;
@@ -3034,7 +3152,8 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
return Success;
}
-int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDestroyWindow(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
@@ -3042,24 +3161,25 @@ int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc)
pointer val;
/*
- ** Check if it's a valid GLX window.
- */
+ ** Check if it's a valid GLX window.
+ */
if (Success != dixLookupResourceByType(&val,
- glxwindow, __glXWindowRes,
- NullClient, DixUnknownAccess)) {
- client->errorValue = glxwindow;
- return __glXBadDrawable;
+ glxwindow, __glXWindowRes,
+ NullClient, DixUnknownAccess)) {
+ client->errorValue = glxwindow;
+ return __glXBadDrawable;
}
/*
- ** The glx window destructor will check whether it's current before
- ** freeing anything.
- */
- FreeResource(glxwindow, RT_NONE);
+ ** The glx window destructor will check whether it's current before
+ ** freeing anything.
+ */
+ FreeResource(glxwindow, RT_NONE);
return Success;
}
-int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
@@ -3069,8 +3189,8 @@ int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
int *sendBuf, *pSendBuf;
int nReplyBytes;
- req = (xGLXQueryContextReq *)pc;
- dixLookupResourceByType((pointer*) &ctx, req->context, __glXContextRes,
+ req = (xGLXQueryContextReq *) pc;
+ dixLookupResourceByType((pointer *) &ctx, req->context, __glXContextRes,
NullClient, DixUnknownAccess);
if (!ctx) {
client->errorValue = req->context;
@@ -3085,27 +3205,29 @@ int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
reply.n = nProps;
nReplyBytes = reply.length << 2;
- sendBuf = (int *)malloc(nReplyBytes);
+ sendBuf = (int *) malloc(nReplyBytes);
pSendBuf = sendBuf;
*pSendBuf++ = GLX_FBCONFIG_ID;
- *pSendBuf++ = (int)(ctx->pFBConfig->id);
+ *pSendBuf++ = (int) (ctx->pFBConfig->id);
*pSendBuf++ = GLX_RENDER_TYPE;
- *pSendBuf++ = (int)(ctx->pFBConfig->renderType);
+ *pSendBuf++ = (int) (ctx->pFBConfig->renderType);
*pSendBuf++ = GLX_SCREEN;
- *pSendBuf++ = (int)(ctx->pScreen->myNum);
+ *pSendBuf++ = (int) (ctx->pScreen->myNum);
if (client->swapped) {
__glXSwapQueryContextReply(client, &reply, sendBuf);
- } else {
- WriteToClient(client, sz_xGLXQueryContextReply, (char *)&reply);
- WriteToClient(client, nReplyBytes, (char *)sendBuf);
}
- free((char *)sendBuf);
+ else {
+ WriteToClient(client, sz_xGLXQueryContextReply, (char *) &reply);
+ WriteToClient(client, nReplyBytes, (char *) sendBuf);
+ }
+ free((char *) sendBuf);
return Success;
}
-int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
@@ -3115,10 +3237,10 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
int *sendBuf, *pSendBuf;
int nReplyBytes;
- req = (xGLXQueryContextInfoEXTReq *)pc;
- dixLookupResourceByType((pointer*) &ctx,
- req->context, __glXContextRes,
- client, DixReadAccess);
+ req = (xGLXQueryContextInfoEXTReq *) pc;
+ dixLookupResourceByType((pointer *) &ctx,
+ req->context, __glXContextRes,
+ client, DixReadAccess);
if (!ctx) {
client->errorValue = req->context;
@@ -3133,32 +3255,34 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
reply.n = nProps;
nReplyBytes = reply.length << 2;
- sendBuf = (int *)malloc(nReplyBytes);
+ sendBuf = (int *) malloc(nReplyBytes);
pSendBuf = sendBuf;
*pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
- *pSendBuf++ = (int)(ctx->share_id);
+ *pSendBuf++ = (int) (ctx->share_id);
*pSendBuf++ = GLX_VISUAL_ID_EXT;
- *pSendBuf++ = (int)(ctx->pVisual ? ctx->pVisual->vid : 0);
+ *pSendBuf++ = (int) (ctx->pVisual ? ctx->pVisual->vid : 0);
*pSendBuf++ = GLX_SCREEN_EXT;
- *pSendBuf++ = (int)(ctx->pScreen->myNum);
+ *pSendBuf++ = (int) (ctx->pScreen->myNum);
*pSendBuf++ = GLX_FBCONFIG_ID;
- *pSendBuf++ = (int)(ctx->pFBConfig ? ctx->pFBConfig->id : 0);
+ *pSendBuf++ = (int) (ctx->pFBConfig ? ctx->pFBConfig->id : 0);
if (client->swapped) {
__glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
- } else {
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
- WriteToClient(client, nReplyBytes, (char *)sendBuf);
}
- free((char *)sendBuf);
+ else {
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) &reply);
+ WriteToClient(client, nReplyBytes, (char *) sendBuf);
+ }
+ free((char *) sendBuf);
return Success;
}
-int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc;
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
xGLXCreatePbufferReq *be_req;
int screen = req->screen;
GLXFBConfigID fbconfigId = req->fbconfig;
@@ -3175,9 +3299,9 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
int s;
int from_screen, to_screen;
- /*
- ** Look up screen and FBConfig.
- */
+ /*
+ ** Look up screen and FBConfig.
+ */
if (screen >= screenInfo.numScreens) {
/* The client library must send a valid screen number. */
client->errorValue = screen;
@@ -3186,22 +3310,22 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
pScreen = screenInfo.screens[screen];
/*
- ** Find the FBConfigRec for this fbconfigid.
- */
+ ** Find the FBConfigRec for this fbconfigid.
+ */
if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) {
- client->errorValue = fbconfigId;
- return __glXBadFBConfig;
+ client->errorValue = fbconfigId;
+ return __glXBadFBConfig;
}
/*
- ** Create the GLX part of the Pbuffer.
- */
+ ** Create the GLX part of the Pbuffer.
+ */
pGlxPbuffer = (__glXPbuffer *) malloc(sizeof(__glXPbuffer));
if (!pGlxPbuffer) {
return BadAlloc;
}
- pGlxPbuffer->be_xids = (XID *) malloc( sizeof(XID) * screenInfo.numScreens );
+ pGlxPbuffer->be_xids = (XID *) malloc(sizeof(XID) * screenInfo.numScreens);
if (!pGlxPbuffer->be_xids) {
free(pGlxPbuffer);
return BadAlloc;
@@ -3213,53 +3337,53 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
from_screen = to_screen = screen;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- dpy = GetBackEndDisplay(cl,s);
- be_xid = XAllocID(dpy);
- dmxScreen = &dmxScreens[s];
- be_pGlxFBConfig = glxLookupBackEndFBConfig( pGlxFBConfig->id, s );
-
- attr = (int *)( req+1 );
-
- LockDisplay(dpy);
- GetReqExtra(GLXCreatePbuffer, 2 * numAttribs * __GLX_SIZE_CARD32, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCreatePbuffer;
- be_req->screen = be_pGlxFBConfig->screen;
- be_req->fbconfig = be_pGlxFBConfig->id;
- be_req->pbuffer = be_xid;
- be_req->numAttribs = numAttribs;
-
- /* Send attributes */
- if ( attr != NULL ) {
- CARD32 *pc = (CARD32 *)(be_req + 1);
-
- while (numAttribs-- > 0) {
- *pc++ = *attr++; /* token */
- *pc++ = *attr++; /* value */
- }
- }
+ for (s = from_screen; s <= to_screen; s++) {
+ dpy = GetBackEndDisplay(cl, s);
+ be_xid = XAllocID(dpy);
+ dmxScreen = &dmxScreens[s];
+ be_pGlxFBConfig = glxLookupBackEndFBConfig(pGlxFBConfig->id, s);
+
+ attr = (int *) (req + 1);
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXCreatePbuffer, 2 * numAttribs * __GLX_SIZE_CARD32,
+ be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreatePbuffer;
+ be_req->screen = be_pGlxFBConfig->screen;
+ be_req->fbconfig = be_pGlxFBConfig->id;
+ be_req->pbuffer = be_xid;
+ be_req->numAttribs = numAttribs;
+
+ /* Send attributes */
+ if (attr != NULL) {
+ CARD32 *pc = (CARD32 *) (be_req + 1);
+
+ while (numAttribs-- > 0) {
+ *pc++ = *attr++; /* token */
+ *pc++ = *attr++; /* value */
+ }
+ }
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
- pGlxPbuffer->be_xids[s] = be_xid;
+ pGlxPbuffer->be_xids[s] = be_xid;
}
-
pGlxPbuffer->idExists = True;
pGlxPbuffer->refcnt = 0;
pGlxPbuffer->pFBConfig = pGlxFBConfig;
pGlxPbuffer->pScreen = pScreen;
/*
- ** Register the resource.
- */
+ ** Register the resource.
+ */
if (!(AddResource(pbuffer, __glXPbufferRes, pGlxPbuffer))) {
return BadAlloc;
}
@@ -3268,7 +3392,8 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
}
-int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDestroyPbuffer(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
@@ -3282,13 +3407,13 @@ int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
int from_screen, to_screen;
/*
- ** Check if it's a valid Pbuffer
- */
- dixLookupResourceByType((pointer*) &pGlxPbuffer, pbuffer,
+ ** Check if it's a valid Pbuffer
+ */
+ dixLookupResourceByType((pointer *) &pGlxPbuffer, pbuffer,
__glXPbufferRes, NullClient, DixUnknownAccess);
if (!pGlxPbuffer) {
- client->errorValue = pbuffer;
- return __glXBadPbuffer;
+ client->errorValue = pbuffer;
+ return __glXBadPbuffer;
}
screen = pGlxPbuffer->pScreen->myNum;
@@ -3296,327 +3421,342 @@ int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
from_screen = to_screen = screen;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- dpy = GetBackEndDisplay(cl,s);
- dmxScreen = &dmxScreens[s];
+ for (s = from_screen; s <= to_screen; s++) {
+ dpy = GetBackEndDisplay(cl, s);
+ dmxScreen = &dmxScreens[s];
- /* send the destroy request to the back-end server */
- LockDisplay(dpy);
- GetReq(GLXDestroyPbuffer, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXDestroyPbuffer;
- be_req->pbuffer = pGlxPbuffer->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
+ /* send the destroy request to the back-end server */
+ LockDisplay(dpy);
+ GetReq(GLXDestroyPbuffer, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXDestroyPbuffer;
+ be_req->pbuffer = pGlxPbuffer->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
}
- FreeResource(pbuffer, RT_NONE);
+ FreeResource(pbuffer, RT_NONE);
return Success;
}
-int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int
+__glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
- xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
- xGLXGetDrawableAttributesReq *be_req;
- xGLXGetDrawableAttributesReply reply;
- ClientPtr client = cl->client;
- GLXDrawable drawId = req->drawable;
- GLXDrawable be_drawable = 0;
- DrawablePtr pDraw = NULL;
- Display *dpy;
- int screen, rc;
- DMXScreenInfo *dmxScreen;
- CARD32 *attribs = NULL;
- int attribs_size = 0;
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc;
+ xGLXGetDrawableAttributesReq *be_req;
+ xGLXGetDrawableAttributesReply reply;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId = req->drawable;
+ GLXDrawable be_drawable = 0;
+ DrawablePtr pDraw = NULL;
+ Display *dpy;
+ int screen, rc;
+ DMXScreenInfo *dmxScreen;
+ CARD32 *attribs = NULL;
+ int attribs_size = 0;
+
#ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL;
#endif
- if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
- if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDraw;
- be_drawable = 0;
- screen = pWin->drawable.pScreen->myNum;
- } else {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- if (!pDraw) {
- __GLXpixmap *pGlxPixmap;
- dixLookupResourceByType((pointer*) &pGlxPixmap,
- drawId, __glXPixmapRes,
- NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- pDraw = pGlxPixmap->pDraw;
- screen = pGlxPixmap->pScreen->myNum;
+ if (drawId != None) {
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
+ if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDraw;
+
+ be_drawable = 0;
+ screen = pWin->drawable.pScreen->myNum;
+ }
+ else {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ if (!pDraw) {
+ __GLXpixmap *pGlxPixmap;
+
+ dixLookupResourceByType((pointer *) &pGlxPixmap,
+ drawId, __glXPixmapRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ pDraw = pGlxPixmap->pDraw;
+ screen = pGlxPixmap->pScreen->myNum;
be_drawable = pGlxPixmap->be_xids[screen];
- }
- }
-
- if (!pDraw) {
- __glXWindow *pGlxWindow;
- dixLookupResourceByType((pointer*) &pGlxWindow,
- drawId, __glXWindowRes,
- NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- pDraw = pGlxWindow->pDraw;
- screen = pGlxWindow->pScreen->myNum;
- be_drawable = 0;
- }
- }
-
- if (!pDraw) {
- __glXPbuffer *pGlxPbuffer;
- dixLookupResourceByType((pointer*) &pGlxPbuffer,
- drawId, __glXPbufferRes,
- NullClient, DixUnknownAccess);
- if (pGlxPbuffer) {
- pDraw = (DrawablePtr)pGlxPbuffer;
- screen = pGlxPbuffer->pScreen->myNum;
- be_drawable = pGlxPbuffer->be_xids[screen];
- }
- }
+ }
+ }
+
+ if (!pDraw) {
+ __glXWindow *pGlxWindow;
+
+ dixLookupResourceByType((pointer *) &pGlxWindow,
+ drawId, __glXWindowRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ pDraw = pGlxWindow->pDraw;
+ screen = pGlxWindow->pScreen->myNum;
+ be_drawable = 0;
+ }
+ }
+
+ if (!pDraw) {
+ __glXPbuffer *pGlxPbuffer;
+
+ dixLookupResourceByType((pointer *) &pGlxPbuffer,
+ drawId, __glXPbufferRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPbuffer) {
+ pDraw = (DrawablePtr) pGlxPbuffer;
+ screen = pGlxPbuffer->pScreen->myNum;
+ be_drawable = pGlxPbuffer->be_xids[screen];
+ }
+ }
}
if (!pDraw) {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- /* if the drawable is a window or GLXWindow -
- * we need to find the base id on the back-end server
- */
- if (!be_drawable) {
- WindowPtr pWin = (WindowPtr)pDraw;
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ /* if the drawable is a window or GLXWindow -
+ * we need to find the base id on the back-end server
+ */
+ if (!be_drawable) {
+ WindowPtr pWin = (WindowPtr) pDraw;
#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess)) {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
- DixReadAccess);
- }
+ if (!noPanoramiXExtension) {
+ if (Success != dixLookupResourceByClass((pointer *) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess)) {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
+ DixReadAccess);
+ }
#endif
- if (pWin) {
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_drawable) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
- else {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
-
- /* send the request to the back-end server */
- dpy = GetBackEndDisplay(cl,screen);
- dmxScreen = &dmxScreens[screen];
-
- /* make sure drawable exists on back-end */
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReq(GLXGetDrawableAttributes, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXGetDrawableAttributes;
- be_req->drawable = be_drawable;
- be_req->length = req->length;
- if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- if (reply.numAttribs) {
- attribs_size = 2 * reply.numAttribs * __GLX_SIZE_CARD32;
- attribs = (CARD32 *) malloc(attribs_size);
- if (attribs == NULL) {
- UnlockDisplay(dpy);
- SyncHandle();
- return BadAlloc;
- }
-
- _XRead(dpy, (char *) attribs, attribs_size);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
-
- /* send the reply back to the client */
- reply.sequenceNumber = client->sequence;
- if (client->swapped) {
- __glXSwapGetDrawableAttributesReply(client, &reply, (int *)attribs);
- }
- else {
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)&reply);
- WriteToClient(client, attribs_size, (char *)attribs);
- }
-
- free(attribs);
-
- return Success;
+ if (pWin) {
+ be_drawable = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_drawable) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+ be_drawable =
+ (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+ else {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ /* send the request to the back-end server */
+ dpy = GetBackEndDisplay(cl, screen);
+ dmxScreen = &dmxScreens[screen];
+
+ /* make sure drawable exists on back-end */
+ dmxSync(dmxScreen, 1);
+
+ LockDisplay(dpy);
+ GetReq(GLXGetDrawableAttributes, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXGetDrawableAttributes;
+ be_req->drawable = be_drawable;
+ be_req->length = req->length;
+ if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code));
+ }
+
+ if (reply.numAttribs) {
+ attribs_size = 2 * reply.numAttribs * __GLX_SIZE_CARD32;
+ attribs = (CARD32 *) malloc(attribs_size);
+ if (attribs == NULL) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return BadAlloc;
+ }
+
+ _XRead(dpy, (char *) attribs, attribs_size);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ /* send the reply back to the client */
+ reply.sequenceNumber = client->sequence;
+ if (client->swapped) {
+ __glXSwapGetDrawableAttributesReply(client, &reply, (int *) attribs);
+ }
+ else {
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
+ (char *) &reply);
+ WriteToClient(client, attribs_size, (char *) attribs);
+ }
+
+ free(attribs);
+
+ return Success;
}
-int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int
+__glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
- xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc;
- xGLXChangeDrawableAttributesReq *be_req;
- ClientPtr client = cl->client;
- GLXDrawable drawId = req->drawable;
- GLXDrawable be_drawable = 0;
- DrawablePtr pDraw = NULL;
- Display *dpy;
- int screen, rc;
- DMXScreenInfo *dmxScreen;
-
- if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess);
- if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
- be_drawable = 0;
- screen = pDraw->pScreen->myNum;
- } else {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- if (!pDraw) {
- __GLXpixmap *pGlxPixmap;
- dixLookupResourceByType((pointer*) &pGlxPixmap,
- drawId, __glXPixmapRes,
- NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- pDraw = pGlxPixmap->pDraw;
- screen = pGlxPixmap->pScreen->myNum;
+ xGLXChangeDrawableAttributesReq *req =
+ (xGLXChangeDrawableAttributesReq *) pc;
+ xGLXChangeDrawableAttributesReq *be_req;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId = req->drawable;
+ GLXDrawable be_drawable = 0;
+ DrawablePtr pDraw = NULL;
+ Display *dpy;
+ int screen, rc;
+ DMXScreenInfo *dmxScreen;
+
+ if (drawId != None) {
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess);
+ if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
+ be_drawable = 0;
+ screen = pDraw->pScreen->myNum;
+ }
+ else {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ if (!pDraw) {
+ __GLXpixmap *pGlxPixmap;
+
+ dixLookupResourceByType((pointer *) &pGlxPixmap,
+ drawId, __glXPixmapRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ pDraw = pGlxPixmap->pDraw;
+ screen = pGlxPixmap->pScreen->myNum;
be_drawable = pGlxPixmap->be_xids[screen];
- }
- }
-
- if (!pDraw) {
- __glXWindow *pGlxWindow;
- dixLookupResourceByType((pointer*) &pGlxWindow,
- drawId, __glXWindowRes,
- NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- pDraw = pGlxWindow->pDraw;
- screen = pGlxWindow->pScreen->myNum;
- be_drawable = 0;
- }
- }
-
- if (!pDraw) {
- __glXPbuffer *pGlxPbuffer;
- dixLookupResourceByType((pointer*) &pGlxPbuffer,
- drawId, __glXPbufferRes,
- NullClient, DixUnknownAccess);
- if (pGlxPbuffer) {
- pDraw = (DrawablePtr)pGlxPbuffer;
- screen = pGlxPbuffer->pScreen->myNum;
- be_drawable = pGlxPbuffer->be_xids[screen];
- }
- }
- }
-
- if (!pDraw) {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- /* if the drawable is a window or GLXWindow -
- * we need to find the base id on the back-end server
- */
- if (!be_drawable) {
- WindowPtr pWin = (WindowPtr)pDraw;
+ }
+ }
+
+ if (!pDraw) {
+ __glXWindow *pGlxWindow;
+
+ dixLookupResourceByType((pointer *) &pGlxWindow,
+ drawId, __glXWindowRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ pDraw = pGlxWindow->pDraw;
+ screen = pGlxWindow->pScreen->myNum;
+ be_drawable = 0;
+ }
+ }
+
+ if (!pDraw) {
+ __glXPbuffer *pGlxPbuffer;
+
+ dixLookupResourceByType((pointer *) &pGlxPbuffer,
+ drawId, __glXPbufferRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPbuffer) {
+ pDraw = (DrawablePtr) pGlxPbuffer;
+ screen = pGlxPbuffer->pScreen->myNum;
+ be_drawable = pGlxPbuffer->be_xids[screen];
+ }
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ /* if the drawable is a window or GLXWindow -
+ * we need to find the base id on the back-end server
+ */
+ if (!be_drawable) {
+ WindowPtr pWin = (WindowPtr) pDraw;
#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- PanoramiXRes *pXinDraw;
- if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess)) {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
- DixReadAccess);
- }
+ if (!noPanoramiXExtension) {
+ PanoramiXRes *pXinDraw;
+
+ if (Success != dixLookupResourceByClass((pointer *) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess)) {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
+ DixReadAccess);
+ }
#endif
- if (pWin) {
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_drawable) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
- else {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
-
- /* send the request to the back-end server */
- dpy = GetBackEndDisplay(cl,screen);
- dmxScreen = &dmxScreens[screen];
-
- /* make sure drawable exists on back-end */
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReqExtra(GLXChangeDrawableAttributes,
- 2 * req->numAttribs * __GLX_SIZE_CARD32, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXChangeDrawableAttributes;
- be_req->drawable = be_drawable;
- be_req->numAttribs = req->numAttribs;
- be_req->length = req->length;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return Success;
+ if (pWin) {
+ be_drawable = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_drawable) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+ be_drawable =
+ (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+ else {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ /* send the request to the back-end server */
+ dpy = GetBackEndDisplay(cl, screen);
+ dmxScreen = &dmxScreens[screen];
+
+ /* make sure drawable exists on back-end */
+ dmxSync(dmxScreen, 1);
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXChangeDrawableAttributes,
+ 2 * req->numAttribs * __GLX_SIZE_CARD32, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXChangeDrawableAttributes;
+ be_req->drawable = be_drawable;
+ be_req->numAttribs = req->numAttribs;
+ be_req->length = req->length;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
}
-int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag)
+int
+__glXSendLargeCommand(__GLXclientState * cl, GLXContextTag contextTag)
{
- ClientPtr client = cl->client;
+ ClientPtr client = cl->client;
xGLXRenderLargeReq *req;
GLint maxSize, amount;
GLint totalRequests, requestNumber;
@@ -3626,56 +3766,57 @@ int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag)
int s;
int from_screen, to_screen;
- maxSize = cl->largeCmdMaxReqDataSize - (GLint)sizeof(xGLXRenderLargeReq);
+ maxSize = cl->largeCmdMaxReqDataSize - (GLint) sizeof(xGLXRenderLargeReq);
dataLen = cl->largeCmdBytesTotal;
totalRequests = (dataLen / maxSize);
- if (dataLen % maxSize) totalRequests++;
+ if (dataLen % maxSize)
+ totalRequests++;
glxc = __glXLookupContextByTag(cl, contextTag);
if (!glxc) {
- client->errorValue = contextTag;
- return __glXBadContext;
+ client->errorValue = contextTag;
+ return __glXBadContext;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
/*
- ** Send enough requests until the whole array is sent.
- */
+ ** Send enough requests until the whole array is sent.
+ */
requestNumber = 1;
data = cl->largeCmdBuf;
while (dataLen > 0) {
- amount = dataLen;
- if (amount > maxSize) {
- amount = maxSize;
- }
-
- for (s=from_screen; s<=to_screen; s++) {
-
- Display *dpy = GetBackEndDisplay(cl,s);
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
-
- LockDisplay(dpy);
- GetReq(GLXRenderLarge,req);
- req->reqType = dmxScreen->glxMajorOpcode;
- req->glxCode = X_GLXRenderLarge;
- req->contextTag = GetCurrentBackEndTag(cl,contextTag,s);
- req->length += (amount + 3) >> 2;
- req->requestNumber = requestNumber++;
- req->requestTotal = totalRequests;
- req->dataBytes = amount;
- Data(dpy, ((const char*)data), amount);
- dataLen -= amount;
- data = ((GLbyte *) data) + amount;
- UnlockDisplay(dpy);
- SyncHandle();
- }
+ amount = dataLen;
+ if (amount > maxSize) {
+ amount = maxSize;
+ }
+
+ for (s = from_screen; s <= to_screen; s++) {
+
+ Display *dpy = GetBackEndDisplay(cl, s);
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+
+ LockDisplay(dpy);
+ GetReq(GLXRenderLarge, req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXRenderLarge;
+ req->contextTag = GetCurrentBackEndTag(cl, contextTag, s);
+ req->length += (amount + 3) >> 2;
+ req->requestNumber = requestNumber++;
+ req->requestTotal = totalRequests;
+ req->dataBytes = amount;
+ Data(dpy, ((const char *) data), amount);
+ dataLen -= amount;
+ data = ((GLbyte *) data) + amount;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
}
return Success;
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
index f28a79df6..ec0e83d09 100644
--- a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
@@ -39,9 +39,9 @@
#include "glxext.h"
#include "glxvendor.h"
-extern int glxIsExtensionSupported( char *ext );
+extern int glxIsExtensionSupported(char *ext);
-int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
+int __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc);
/************************************************************************/
@@ -52,9 +52,11 @@ int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
** it is called at the end of the unswapped routine.
*/
-int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreateContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -66,9 +68,11 @@ int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc)
return __glXCreateContext(cl, pc);
}
-int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreateNewContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -80,9 +84,11 @@ int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc)
return __glXCreateNewContext(cl, pc);
}
-int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc;
+ xGLXCreateContextWithConfigSGIXReq *req =
+ (xGLXCreateContextWithConfigSGIXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -94,10 +100,11 @@ int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
return __glXCreateContextWithConfigSGIX(cl, pc);
}
-int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc)
{
xGLXQueryMaxSwapBarriersSGIXReq *req =
- (xGLXQueryMaxSwapBarriersSGIXReq *)pc;
+ (xGLXQueryMaxSwapBarriersSGIXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -106,9 +113,11 @@ int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
return __glXQueryMaxSwapBarriersSGIX(cl, pc);
}
-int __glXSwapBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc;
+ xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -118,9 +127,11 @@ int __glXSwapBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
return __glXBindSwapBarrierSGIX(cl, pc);
}
-int __glXSwapJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc;
+ xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -130,9 +141,11 @@ int __glXSwapJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
return __glXJoinSwapGroupSGIX(cl, pc);
}
-int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapDestroyContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -141,9 +154,11 @@ int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc)
return __glXDestroyContext(cl, pc);
}
-int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapMakeCurrent(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -154,9 +169,11 @@ int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc)
return __glXMakeCurrent(cl, pc);
}
-int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapMakeContextCurrent(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -168,9 +185,11 @@ int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
return __glXMakeContextCurrent(cl, pc);
}
-int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -182,9 +201,11 @@ int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
return __glXMakeCurrentReadSGI(cl, pc);
}
-int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapIsDirect(__GLXclientState * cl, GLbyte * pc)
{
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -193,9 +214,11 @@ int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc)
return __glXIsDirect(cl, pc);
}
-int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapQueryVersion(__GLXclientState * cl, GLbyte * pc)
{
xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -205,9 +228,11 @@ int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc)
return __glXQueryVersion(cl, pc);
}
-int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapWaitGL(__GLXclientState * cl, GLbyte * pc)
{
xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -216,9 +241,11 @@ int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc)
return __glXWaitGL(cl, pc);
}
-int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapWaitX(__GLXclientState * cl, GLbyte * pc)
{
xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -227,9 +254,11 @@ int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc)
return __glXWaitX(cl, pc);
}
-int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCopyContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -240,9 +269,10 @@ int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc)
return __glXCopyContext(cl, pc);
}
-int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
+ ClientPtr client = cl->client;
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
xGLXGetVisualConfigsReply reply;
__GLXscreenInfo *pGlxScreen;
@@ -250,62 +280,63 @@ int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
CARD32 buf[__GLX_TOTAL_CONFIG];
unsigned int screen;
int i, p;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_INT(&req->screen);
screen = req->screen;
if (screen >= screenInfo.numScreens) {
- /* The client library must send a valid screen number. */
- client->errorValue = screen;
- return BadValue;
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
}
pGlxScreen = &__glXActiveScreens[screen];
reply.numVisuals = pGlxScreen->numGLXVisuals;
reply.numProps = __GLX_TOTAL_CONFIG;
reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
- __GLX_TOTAL_CONFIG) >> 2;
+ __GLX_TOTAL_CONFIG) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
-
+
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.numVisuals);
__GLX_SWAP_INT(&reply.numProps);
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
-
- for (i=0; i < pGlxScreen->numVisuals; i++) {
- pGlxVisual = &pGlxScreen->pGlxVisual[i];
- if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
- /* not a usable visual */
- continue;
- }
- p = 0;
- buf[p++] = pGlxVisual->vid;
- buf[p++] = pGlxVisual->class;
- buf[p++] = pGlxVisual->rgba;
-
- buf[p++] = pGlxVisual->redSize;
- buf[p++] = pGlxVisual->greenSize;
- buf[p++] = pGlxVisual->blueSize;
- buf[p++] = pGlxVisual->alphaSize;
- buf[p++] = pGlxVisual->accumRedSize;
- buf[p++] = pGlxVisual->accumGreenSize;
- buf[p++] = pGlxVisual->accumBlueSize;
- buf[p++] = pGlxVisual->accumAlphaSize;
-
- buf[p++] = pGlxVisual->doubleBuffer;
- buf[p++] = pGlxVisual->stereo;
-
- buf[p++] = pGlxVisual->bufferSize;
- buf[p++] = pGlxVisual->depthSize;
- buf[p++] = pGlxVisual->stencilSize;
- buf[p++] = pGlxVisual->auxBuffers;
- buf[p++] = pGlxVisual->level;
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+
+ for (i = 0; i < pGlxScreen->numVisuals; i++) {
+ pGlxVisual = &pGlxScreen->pGlxVisual[i];
+ if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
+ /* not a usable visual */
+ continue;
+ }
+ p = 0;
+ buf[p++] = pGlxVisual->vid;
+ buf[p++] = pGlxVisual->class;
+ buf[p++] = pGlxVisual->rgba;
+
+ buf[p++] = pGlxVisual->redSize;
+ buf[p++] = pGlxVisual->greenSize;
+ buf[p++] = pGlxVisual->blueSize;
+ buf[p++] = pGlxVisual->alphaSize;
+ buf[p++] = pGlxVisual->accumRedSize;
+ buf[p++] = pGlxVisual->accumGreenSize;
+ buf[p++] = pGlxVisual->accumBlueSize;
+ buf[p++] = pGlxVisual->accumAlphaSize;
+
+ buf[p++] = pGlxVisual->doubleBuffer;
+ buf[p++] = pGlxVisual->stereo;
+
+ buf[p++] = pGlxVisual->bufferSize;
+ buf[p++] = pGlxVisual->depthSize;
+ buf[p++] = pGlxVisual->stencilSize;
+ buf[p++] = pGlxVisual->auxBuffers;
+ buf[p++] = pGlxVisual->level;
/*
- ** Add token/value pairs for extensions.
- */
+ ** Add token/value pairs for extensions.
+ */
buf[p++] = GLX_VISUAL_CAVEAT_EXT;
buf[p++] = pGlxVisual->visualRating;
buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
@@ -321,16 +352,18 @@ int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
buf[p++] = pGlxVisual->transparentIndex;
- __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
- WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
- (char *)buf);
+ __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
+ (char *) buf);
}
return Success;
}
-int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreateGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -342,9 +375,11 @@ int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
return __glXCreateGLXPixmap(cl, pc);
}
-int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreatePixmap(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -357,9 +392,11 @@ int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc)
return __glXCreatePixmap(cl, pc);
}
-int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -368,9 +405,11 @@ int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
return __glXDestroyGLXPixmap(cl, pc);
}
-int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapSwapBuffers(__GLXclientState * cl, GLbyte * pc)
{
xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -380,9 +419,11 @@ int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc)
return __glXSwapBuffers(cl, pc);
}
-int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapUseXFont(__GLXclientState * cl, GLbyte * pc)
{
xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -395,10 +436,11 @@ int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc)
return __glXUseXFont(cl, pc);
}
-
-int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
{
xGLXQueryExtensionsStringReq *req = NULL;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -407,9 +449,11 @@ int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
return __glXQueryExtensionsString(cl, pc);
}
-int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapQueryServerString(__GLXclientState * cl, GLbyte * pc)
{
- xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc;
+ xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -419,9 +463,11 @@ int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc)
return __glXQueryServerString(cl, pc);
}
-int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapClientInfo(__GLXclientState * cl, GLbyte * pc)
{
- xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc;
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -432,15 +478,17 @@ int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc)
return __glXClientInfo(cl, pc);
}
-int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc)
+int
+__glXSwapQueryContextInfoEXT(__GLXclientState * cl, char *pc)
{
xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->context);
- return __glXQueryContextInfoEXT(cl, (GLbyte *)pc);
+ return __glXQueryContextInfoEXT(cl, (GLbyte *) pc);
}
/************************************************************************/
@@ -449,7 +497,8 @@ int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc)
** Swap replies.
*/
-void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply *reply)
+void
+__glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply * reply)
{
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
@@ -459,103 +508,120 @@ void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply *r
__GLX_SWAP_INT(&reply->writeType);
__GLX_SWAP_INT(&reply->readVid);
__GLX_SWAP_INT(&reply->readType);
- WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *)reply);
+ WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *) reply);
}
-void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply)
+void
+__glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply)
{
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
- WriteToClient(client, sz_xGLXIsDirectReply, (char *)reply);
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *) reply);
}
-void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply)
+void
+__glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply)
{
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->majorVersion);
__GLX_SWAP_INT(&reply->minorVersion);
- WriteToClient(client, sz_xGLXQueryVersionReply, (char *)reply);
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *) reply);
}
-void glxSwapQueryExtensionsStringReply(ClientPtr client,
- xGLXQueryExtensionsStringReply *reply, char *buf)
+void
+glxSwapQueryExtensionsStringReply(ClientPtr client,
+ xGLXQueryExtensionsStringReply * reply,
+ char *buf)
{
int length = reply->length;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply);
- __GLX_SWAP_INT_ARRAY((int *)buf, length);
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *) reply);
+ __GLX_SWAP_INT_ARRAY((int *) buf, length);
WriteToClient(client, length << 2, buf);
}
-void glxSwapQueryServerStringReply(ClientPtr client,
- xGLXQueryServerStringReply *reply, char *buf)
+void
+glxSwapQueryServerStringReply(ClientPtr client,
+ xGLXQueryServerStringReply * reply, char *buf)
{
int length = reply->length;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)reply);
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) reply);
/** no swap is needed for an array of chars **/
/* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
WriteToClient(client, length << 2, buf);
}
-void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf)
+void
+__glXSwapQueryContextInfoEXTReply(ClientPtr client,
+ xGLXQueryContextInfoEXTReply * reply,
+ int *buf)
{
int length = reply->length;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply);
- __GLX_SWAP_INT_ARRAY((int *)buf, length);
- WriteToClient(client, length << 2, (char *)buf);
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) reply);
+ __GLX_SWAP_INT_ARRAY((int *) buf, length);
+ WriteToClient(client, length << 2, (char *) buf);
}
-
-void __glXSwapQueryContextReply(ClientPtr client,
- xGLXQueryContextReply *reply, int *buf)
+void
+__glXSwapQueryContextReply(ClientPtr client,
+ xGLXQueryContextReply * reply, int *buf)
{
int length = reply->length;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryContextReply, (char *)reply);
- __GLX_SWAP_INT_ARRAY((int *)buf, length);
- WriteToClient(client, length << 2, (char *)buf);
+ WriteToClient(client, sz_xGLXQueryContextReply, (char *) reply);
+ __GLX_SWAP_INT_ARRAY((int *) buf, length);
+ WriteToClient(client, length << 2, (char *) buf);
}
-void __glXSwapGetDrawableAttributesReply(ClientPtr client,
- xGLXGetDrawableAttributesReply *reply, int *buf)
+void
+__glXSwapGetDrawableAttributesReply(ClientPtr client,
+ xGLXGetDrawableAttributesReply * reply,
+ int *buf)
{
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->numAttribs);
- __GLX_SWAP_INT_ARRAY( buf, reply->length );
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)reply);
- WriteToClient(client, reply->length << 2, (char *)buf);
+ __GLX_SWAP_INT_ARRAY(buf, reply->length);
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *) reply);
+ WriteToClient(client, reply->length << 2, (char *) buf);
}
-void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, xGLXQueryMaxSwapBarriersSGIXReply *reply)
+void
+__glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
+ xGLXQueryMaxSwapBarriersSGIXReply *
+ reply)
{
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->max);
- WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, (char *)reply);
+ WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, (char *) reply);
}
/************************************************************************/
@@ -565,21 +631,23 @@ void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, xGLXQueryMaxSwapBa
** client library to send batches of GL rendering commands.
*/
-int __glXSwapRender(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapRender(__GLXclientState * cl, GLbyte * pc)
{
xGLXRenderReq *req;
int left;
__GLXrenderHeader *hdr;
ClientPtr client = cl->client;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
/*
- ** NOTE: much of this code also appears in the nonswapping version of this
- ** routine, __glXRender(). Any changes made here should also be
- ** duplicated there.
- */
-
+ ** NOTE: much of this code also appears in the nonswapping version of this
+ ** routine, __glXRender(). Any changes made here should also be
+ ** duplicated there.
+ */
+
req = (xGLXRenderReq *) pc;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
@@ -587,74 +655,81 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc)
pc += sz_xGLXRenderReq;
left = (req->length << 2) - sz_xGLXRenderReq;
while (left > 0) {
- void (* proc)(GLbyte *);
- CARD16 opcode;
-
- /*
- ** Verify that the header length and the overall length agree.
- ** Also, each command must be word aligned.
- */
- hdr = (__GLXrenderHeader *) pc;
- __GLX_SWAP_SHORT(&hdr->length);
- __GLX_SWAP_SHORT(&hdr->opcode);
-
- /*
+ void (*proc) (GLbyte *);
+ CARD16 opcode;
+
+ /*
+ ** Verify that the header length and the overall length agree.
+ ** Also, each command must be word aligned.
+ */
+ hdr = (__GLXrenderHeader *) pc;
+ __GLX_SWAP_SHORT(&hdr->length);
+ __GLX_SWAP_SHORT(&hdr->opcode);
+
+ /*
* call the command procedure to swap any arguments
- */
- opcode = hdr->opcode;
- if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
- (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
- proc = __glXSwapRenderTable[opcode];
+ */
+ opcode = hdr->opcode;
+ if ((opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE)) {
+ proc = __glXSwapRenderTable[opcode];
#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
- } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
- (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
- int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
- __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index];
- if (info->swapfunc) {
- proc = info->swapfunc;
- }
- else {
- proc = NULL;
- if (info->elem_size == 4 && info->nelems > 0) {
- __GLX_SWAP_INT_ARRAY( (int *)(pc + __GLX_RENDER_HDR_SIZE),
- info->nelems );
- }
- else if (info->elem_size == 2 && info->nelems > 0) {
- __GLX_SWAP_SHORT_ARRAY( (short *)(pc + __GLX_RENDER_HDR_SIZE),
- info->nelems );
- }
- else if (info->elem_size == 8 && info->nelems > 0) {
- __GLX_SWAP_DOUBLE_ARRAY( (double *)(pc + __GLX_RENDER_HDR_SIZE),
- info->nelems );
- }
- }
-#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
- } else {
- client->errorValue = 0;
- return __glXBadRenderRequest;
- }
-
- if (proc != NULL)
- (*proc)(pc + __GLX_RENDER_HDR_SIZE);
-
- /*
- * proceed to the next command
- */
- pc += hdr->length;
- left -= hdr->length;
+ }
+ else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) {
+ int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+ __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index];
+
+ if (info->swapfunc) {
+ proc = info->swapfunc;
+ }
+ else {
+ proc = NULL;
+ if (info->elem_size == 4 && info->nelems > 0) {
+ __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_HDR_SIZE),
+ info->nelems);
+ }
+ else if (info->elem_size == 2 && info->nelems > 0) {
+ __GLX_SWAP_SHORT_ARRAY((short *) (pc +
+ __GLX_RENDER_HDR_SIZE),
+ info->nelems);
+ }
+ else if (info->elem_size == 8 && info->nelems > 0) {
+ __GLX_SWAP_DOUBLE_ARRAY((double *) (pc +
+ __GLX_RENDER_HDR_SIZE),
+ info->nelems);
+ }
+ }
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ }
+ else {
+ client->errorValue = 0;
+ return __glXBadRenderRequest;
+ }
+
+ if (proc != NULL)
+ (*proc) (pc + __GLX_RENDER_HDR_SIZE);
+
+ /*
+ * proceed to the next command
+ */
+ pc += hdr->length;
+ left -= hdr->length;
}
- return __glXRender( cl, (GLbyte *)req );
+ return __glXRender(cl, (GLbyte *) req);
}
/*
** Execute a large rendering request (one that spans multiple X requests).
*/
-int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapRenderLarge(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
+ ClientPtr client = cl->client;
xGLXRenderLargeReq *req;
__GLXrenderLargeHeader *hdr;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -666,134 +741,139 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_SHORT(&req->requestTotal);
pc += sz_xGLXRenderLargeReq;
-
+
if (req->requestNumber == 1) {
- void (* proc)(GLbyte *) = NULL;
- __GLXRenderSwapInfo *info = NULL;
- CARD16 opcode;
+ void (*proc) (GLbyte *) = NULL;
+ __GLXRenderSwapInfo *info = NULL;
+ CARD16 opcode;
- hdr = (__GLXrenderLargeHeader *) pc;
- __GLX_SWAP_INT(&hdr->length);
- __GLX_SWAP_INT(&hdr->opcode);
+ hdr = (__GLXrenderLargeHeader *) pc;
+ __GLX_SWAP_INT(&hdr->length);
+ __GLX_SWAP_INT(&hdr->opcode);
- /*
+ /*
* call the command procedure to swap any arguments
- * Note that we are assuming that all arguments that needs to be
- * swaped are on the first req only !
- */
- opcode = hdr->opcode;
- if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
- (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
- proc = __glXSwapRenderTable[opcode];
+ * Note that we are assuming that all arguments that needs to be
+ * swaped are on the first req only !
+ */
+ opcode = hdr->opcode;
+ if ((opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE)) {
+ proc = __glXSwapRenderTable[opcode];
#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
- } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
- (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
- int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
- info = &__glXSwapRenderTable_EXT[index];
- if (info->swapfunc) {
- proc = info->swapfunc;
- }
-#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
- } else {
- client->errorValue = 0;
- cl->largeCmdRequestsTotal = 0;
- return __glXBadLargeRequest;
- }
-
- /*
- ** Make enough space in the buffer, then copy the entire request.
- */
- if (cl->largeCmdBufSize < hdr->length) {
- if (!cl->largeCmdBuf) {
- cl->largeCmdBuf = (GLbyte *) malloc(hdr->length);
- } else {
- cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, hdr->length);
- }
- if (!cl->largeCmdBuf) {
- cl->largeCmdRequestsTotal = 0;
- return BadAlloc;
- }
- cl->largeCmdBufSize = hdr->length;
- }
- memcpy(cl->largeCmdBuf, pc, req->dataBytes);
-
- cl->largeCmdBytesSoFar = req->dataBytes;
- cl->largeCmdBytesTotal = hdr->length;
- cl->largeCmdRequestsSoFar = 1;
- cl->largeCmdRequestsTotal = req->requestTotal;
- cl->largeCmdRequestsSwapProc = proc;
- cl->largeCmdMaxReqDataSize = req->dataBytes;
- cl->largeCmdRequestsSwap_info = info;
-
- return Success;
-
+ }
+ else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) {
+ int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+
+ info = &__glXSwapRenderTable_EXT[index];
+ if (info->swapfunc) {
+ proc = info->swapfunc;
+ }
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ }
+ else {
+ client->errorValue = 0;
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
+ }
+
+ /*
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (cl->largeCmdBufSize < hdr->length) {
+ if (!cl->largeCmdBuf) {
+ cl->largeCmdBuf = (GLbyte *) malloc(hdr->length);
+ }
+ else {
+ cl->largeCmdBuf =
+ (GLbyte *) realloc(cl->largeCmdBuf, hdr->length);
+ }
+ if (!cl->largeCmdBuf) {
+ cl->largeCmdRequestsTotal = 0;
+ return BadAlloc;
+ }
+ cl->largeCmdBufSize = hdr->length;
+ }
+ memcpy(cl->largeCmdBuf, pc, req->dataBytes);
+
+ cl->largeCmdBytesSoFar = req->dataBytes;
+ cl->largeCmdBytesTotal = hdr->length;
+ cl->largeCmdRequestsSoFar = 1;
+ cl->largeCmdRequestsTotal = req->requestTotal;
+ cl->largeCmdRequestsSwapProc = proc;
+ cl->largeCmdMaxReqDataSize = req->dataBytes;
+ cl->largeCmdRequestsSwap_info = info;
+
+ return Success;
}
else if (req->requestNumber < cl->largeCmdRequestsTotal) {
- /*
- * This is not the first nor last request - just copy the data
- */
- if ( cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
- cl->largeCmdRequestsTotal = 0;
- return __glXBadLargeRequest;
- }
+ /*
+ * This is not the first nor last request - just copy the data
+ */
+ if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
+ }
- memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar,
- pc, req->dataBytes);
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes);
- cl->largeCmdBytesSoFar += req->dataBytes;
+ cl->largeCmdBytesSoFar += req->dataBytes;
- if (req->dataBytes > cl->largeCmdMaxReqDataSize)
- cl->largeCmdMaxReqDataSize = req->dataBytes;
+ if (req->dataBytes > cl->largeCmdMaxReqDataSize)
+ cl->largeCmdMaxReqDataSize = req->dataBytes;
- return Success;
+ return Success;
}
else if (req->requestNumber == cl->largeCmdRequestsTotal) {
- /*
- * this is the last request
- * copy the remainder bytes, call the procedure to swap any
- * needed data, and then call to transfer the command to all
- * back-end servers
- */
- if ( cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
- cl->largeCmdRequestsTotal = 0;
- return __glXBadLargeRequest;
- }
-
- memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar,
- pc, req->dataBytes);
-
- cl->largeCmdBytesSoFar += req->dataBytes;
-
- if (req->dataBytes > cl->largeCmdMaxReqDataSize)
- cl->largeCmdMaxReqDataSize = req->dataBytes;
-
- if (cl->largeCmdRequestsSwapProc != NULL) {
- (*cl->largeCmdRequestsSwapProc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
- }
- else if (cl->largeCmdRequestsSwap_info &&
- cl->largeCmdRequestsSwap_info->nelems > 0) {
- if (cl->largeCmdRequestsSwap_info->elem_size == 4) {
- __GLX_SWAP_INT_ARRAY( (int *)(pc + __GLX_RENDER_LARGE_HDR_SIZE),
- cl->largeCmdRequestsSwap_info->nelems );
- }
- else if (cl->largeCmdRequestsSwap_info->elem_size == 2) {
- __GLX_SWAP_SHORT_ARRAY( (short *)(pc + __GLX_RENDER_LARGE_HDR_SIZE),
- cl->largeCmdRequestsSwap_info->nelems );
- }
- else if (cl->largeCmdRequestsSwap_info->elem_size == 8) {
- __GLX_SWAP_DOUBLE_ARRAY( (double *)(pc + __GLX_RENDER_LARGE_HDR_SIZE),
- cl->largeCmdRequestsSwap_info->nelems );
- }
- }
-
- cl->largeCmdRequestsTotal = 0;
- return( __glXSendLargeCommand(cl, req->contextTag) );
+ /*
+ * this is the last request
+ * copy the remainder bytes, call the procedure to swap any
+ * needed data, and then call to transfer the command to all
+ * back-end servers
+ */
+ if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
+ }
+
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes);
+
+ cl->largeCmdBytesSoFar += req->dataBytes;
+
+ if (req->dataBytes > cl->largeCmdMaxReqDataSize)
+ cl->largeCmdMaxReqDataSize = req->dataBytes;
+
+ if (cl->largeCmdRequestsSwapProc != NULL) {
+ (*cl->largeCmdRequestsSwapProc) (cl->largeCmdBuf +
+ __GLX_RENDER_LARGE_HDR_SIZE);
+ }
+ else if (cl->largeCmdRequestsSwap_info &&
+ cl->largeCmdRequestsSwap_info->nelems > 0) {
+ if (cl->largeCmdRequestsSwap_info->elem_size == 4) {
+ __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_LARGE_HDR_SIZE),
+ cl->largeCmdRequestsSwap_info->nelems);
+ }
+ else if (cl->largeCmdRequestsSwap_info->elem_size == 2) {
+ __GLX_SWAP_SHORT_ARRAY((short *) (pc +
+ __GLX_RENDER_LARGE_HDR_SIZE),
+ cl->largeCmdRequestsSwap_info->nelems);
+ }
+ else if (cl->largeCmdRequestsSwap_info->elem_size == 8) {
+ __GLX_SWAP_DOUBLE_ARRAY((double *) (pc +
+ __GLX_RENDER_LARGE_HDR_SIZE),
+ cl->largeCmdRequestsSwap_info->nelems);
+ }
+ }
+
+ cl->largeCmdRequestsTotal = 0;
+ return (__glXSendLargeCommand(cl, req->contextTag));
}
else {
- cl->largeCmdRequestsTotal = 0;
- return __glXBadLargeRequest;
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
}
}
@@ -805,7 +885,8 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
** allocating these entry points in the dispatch table.
*/
-int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapVendorPrivate(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateReq *req;
CARD32 vendorCode;
@@ -816,58 +897,58 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc)
vendorCode = req->vendorCode;
__GLX_SWAP_INT(&vendorCode);
-
- switch( vendorCode ) {
-
- case X_GLvop_DeleteTexturesEXT:
- return __glXVForwardSingleReqSwap( cl, pc );
- break;
-
- case X_GLXvop_SwapIntervalSGI:
- if (glxIsExtensionSupported("SGI_swap_control")) {
- return __glXVForwardSingleReqSwap( cl, pc );
- }
- else {
- return Success;
- }
- break;
-
-#if 0 /* glx 1.3 */
- case X_GLXvop_CreateGLXVideoSourceSGIX:
- break;
- case X_GLXvop_DestroyGLXVideoSourceSGIX:
- break;
- case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
- break;
- case X_GLXvop_DestroyGLXPbufferSGIX:
- break;
- case X_GLXvop_ChangeDrawableAttributesSGIX:
- break;
+ switch (vendorCode) {
+
+ case X_GLvop_DeleteTexturesEXT:
+ return __glXVForwardSingleReqSwap(cl, pc);
+ break;
+
+ case X_GLXvop_SwapIntervalSGI:
+ if (glxIsExtensionSupported("SGI_swap_control")) {
+ return __glXVForwardSingleReqSwap(cl, pc);
+ }
+ else {
+ return Success;
+ }
+ break;
+
+#if 0 /* glx 1.3 */
+ case X_GLXvop_CreateGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_DestroyGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
+ break;
+ case X_GLXvop_DestroyGLXPbufferSGIX:
+ break;
+ case X_GLXvop_ChangeDrawableAttributesSGIX:
+ break;
#endif
- case X_GLXvop_JoinSwapGroupSGIX:
- return __glXSwapJoinSwapGroupSGIX( cl, pc );
- break;
+ case X_GLXvop_JoinSwapGroupSGIX:
+ return __glXSwapJoinSwapGroupSGIX(cl, pc);
+ break;
- case X_GLXvop_BindSwapBarrierSGIX:
- return __glXSwapBindSwapBarrierSGIX( cl, pc );
- break;
+ case X_GLXvop_BindSwapBarrierSGIX:
+ return __glXSwapBindSwapBarrierSGIX(cl, pc);
+ break;
- case X_GLXvop_CreateContextWithConfigSGIX:
- return __glXSwapCreateContextWithConfigSGIX( cl, pc );
- break;
+ case X_GLXvop_CreateContextWithConfigSGIX:
+ return __glXSwapCreateContextWithConfigSGIX(cl, pc);
+ break;
- default:
- /*
- ** unsupported private request
- */
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
}
}
-int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapVendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateWithReplyReq *req;
CARD32 vendorCode;
@@ -878,76 +959,78 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
vendorCode = req->vendorCode;
__GLX_SWAP_INT(&vendorCode);
- switch( vendorCode ) {
-
- case X_GLvop_GetConvolutionFilterEXT:
- case X_GLvop_GetSeparableFilterEXT:
- case X_GLvop_GetHistogramEXT:
- case X_GLvop_GetMinmaxEXT:
- return( __glXNoSuchSingleOpcode(cl, pc) );
- break;
-
- case X_GLvop_GetConvolutionParameterfvEXT:
- case X_GLvop_GetConvolutionParameterivEXT:
- case X_GLvop_GetHistogramParameterivEXT:
- case X_GLvop_GetMinmaxParameterfvEXT:
- case X_GLvop_GetMinmaxParameterivEXT:
- case X_GLvop_GenTexturesEXT:
- return( __glXVForwardAllWithReplySwapiv(cl, pc) );
- break;
-
- case X_GLvop_AreTexturesResidentEXT:
- case X_GLvop_IsTextureEXT:
- return( __glXVForwardPipe0WithReplySwap(cl, pc) );
- break;
-
-#if 0 /* glx1.3 */
- case X_GLvop_GetDetailTexFuncSGIS:
- case X_GLvop_GetSharpenTexFuncSGIS:
- case X_GLvop_GetColorTableSGI:
- case X_GLvop_GetColorTableParameterfvSGI:
- case X_GLvop_GetColorTableParameterivSGI:
- case X_GLvop_GetTexFilterFuncSGIS:
- case X_GLvop_GetInstrumentsSGIX:
- case X_GLvop_InstrumentsBufferSGIX:
- case X_GLvop_PollInstrumentsSGIX:
- case X_GLvop_FlushRasterSGIX:
- case X_GLXvop_CreateGLXPbufferSGIX:
- case X_GLXvop_GetDrawableAttributesSGIX:
- case X_GLXvop_QueryHyperpipeNetworkSGIX:
- case X_GLXvop_QueryHyperpipeConfigSGIX:
- case X_GLXvop_HyperpipeConfigSGIX:
- case X_GLXvop_DestroyHyperpipeConfigSGIX:
+ switch (vendorCode) {
+
+ case X_GLvop_GetConvolutionFilterEXT:
+ case X_GLvop_GetSeparableFilterEXT:
+ case X_GLvop_GetHistogramEXT:
+ case X_GLvop_GetMinmaxEXT:
+ return (__glXNoSuchSingleOpcode(cl, pc));
+ break;
+
+ case X_GLvop_GetConvolutionParameterfvEXT:
+ case X_GLvop_GetConvolutionParameterivEXT:
+ case X_GLvop_GetHistogramParameterivEXT:
+ case X_GLvop_GetMinmaxParameterfvEXT:
+ case X_GLvop_GetMinmaxParameterivEXT:
+ case X_GLvop_GenTexturesEXT:
+ return (__glXVForwardAllWithReplySwapiv(cl, pc));
+ break;
+
+ case X_GLvop_AreTexturesResidentEXT:
+ case X_GLvop_IsTextureEXT:
+ return (__glXVForwardPipe0WithReplySwap(cl, pc));
+ break;
+
+#if 0 /* glx1.3 */
+ case X_GLvop_GetDetailTexFuncSGIS:
+ case X_GLvop_GetSharpenTexFuncSGIS:
+ case X_GLvop_GetColorTableSGI:
+ case X_GLvop_GetColorTableParameterfvSGI:
+ case X_GLvop_GetColorTableParameterivSGI:
+ case X_GLvop_GetTexFilterFuncSGIS:
+ case X_GLvop_GetInstrumentsSGIX:
+ case X_GLvop_InstrumentsBufferSGIX:
+ case X_GLvop_PollInstrumentsSGIX:
+ case X_GLvop_FlushRasterSGIX:
+ case X_GLXvop_CreateGLXPbufferSGIX:
+ case X_GLXvop_GetDrawableAttributesSGIX:
+ case X_GLXvop_QueryHyperpipeNetworkSGIX:
+ case X_GLXvop_QueryHyperpipeConfigSGIX:
+ case X_GLXvop_HyperpipeConfigSGIX:
+ case X_GLXvop_DestroyHyperpipeConfigSGIX:
#endif
- case X_GLXvop_QueryMaxSwapBarriersSGIX:
- return( __glXSwapQueryMaxSwapBarriersSGIX(cl, pc) );
- break;
-
- case X_GLXvop_GetFBConfigsSGIX:
- return( __glXSwapGetFBConfigsSGIX(cl, pc) );
- break;
-
- case X_GLXvop_MakeCurrentReadSGI:
- return( __glXSwapMakeCurrentReadSGI(cl, pc) );
- break;
-
- case X_GLXvop_QueryContextInfoEXT:
- return( __glXSwapQueryContextInfoEXT(cl,(char *)pc) );
- break;
-
- default:
- /*
- ** unsupported private request
- */
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
+ case X_GLXvop_QueryMaxSwapBarriersSGIX:
+ return (__glXSwapQueryMaxSwapBarriersSGIX(cl, pc));
+ break;
+
+ case X_GLXvop_GetFBConfigsSGIX:
+ return (__glXSwapGetFBConfigsSGIX(cl, pc));
+ break;
+
+ case X_GLXvop_MakeCurrentReadSGI:
+ return (__glXSwapMakeCurrentReadSGI(cl, pc));
+ break;
+
+ case X_GLXvop_QueryContextInfoEXT:
+ return (__glXSwapQueryContextInfoEXT(cl, (char *) pc));
+ break;
+
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
}
}
-int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapGetFBConfigs(__GLXclientState * cl, GLbyte * pc)
{
xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -956,22 +1039,25 @@ int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
return __glXGetFBConfigs(cl, pc);
}
-int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc;
- xGLXGetFBConfigsReq new_req;
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
+ xGLXGetFBConfigsReq new_req;
- new_req.reqType = req->reqType;
- new_req.glxCode = req->glxCode;
- new_req.length = req->length;
- new_req.screen = req->screen;
+ new_req.reqType = req->reqType;
+ new_req.glxCode = req->glxCode;
+ new_req.length = req->length;
+ new_req.screen = req->screen;
- return( __glXSwapGetFBConfigs( cl, (GLbyte *)&new_req ) );
+ return (__glXSwapGetFBConfigs(cl, (GLbyte *) & new_req));
}
-int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreateWindow(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -981,37 +1067,42 @@ int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->glxwindow);
__GLX_SWAP_INT(&req->numAttribs);
- return( __glXCreateWindow( cl, (GLbyte *)pc ) );
+ return (__glXCreateWindow(cl, (GLbyte *) pc));
}
-int __glXSwapDestroyWindow(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapDestroyWindow(__GLXclientState * cl, GLbyte * pc)
{
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->glxwindow);
- return( __glXDestroyWindow( cl, (GLbyte *)pc ) );
+ return (__glXDestroyWindow(cl, (GLbyte *) pc));
}
-int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapQueryContext(__GLXclientState * cl, GLbyte * pc)
{
- xGLXQueryContextReq *req = (xGLXQueryContextReq *)pc;
+ xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->context);
- return( __glXQueryContext(cl, (GLbyte *)pc) );
-
+ return (__glXQueryContext(cl, (GLbyte *) pc));
+
}
-int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreatePbuffer(__GLXclientState * cl, GLbyte * pc)
{
- xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc;
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
int nattr = req->numAttribs;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -1020,43 +1111,49 @@ int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->fbconfig);
__GLX_SWAP_INT(&req->pbuffer);
__GLX_SWAP_INT(&req->numAttribs);
- __GLX_SWAP_INT_ARRAY( (int *)(req+1), nattr*2 );
+ __GLX_SWAP_INT_ARRAY((int *) (req + 1), nattr * 2);
- return( __glXCreatePbuffer( cl, pc ) );
+ return (__glXCreatePbuffer(cl, pc));
}
-int __glXSwapDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapDestroyPbuffer(__GLXclientState * cl, GLbyte * pc)
{
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->pbuffer);
- return( __glXDestroyPbuffer( cl, (GLbyte *)pc ) );
+ return (__glXDestroyPbuffer(cl, (GLbyte *) pc));
}
-int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
- xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->drawable);
- return( __glXGetDrawableAttributes(cl, pc) );
+ return (__glXGetDrawableAttributes(cl, pc));
}
-int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
- xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc;
+ xGLXChangeDrawableAttributesReq *req =
+ (xGLXChangeDrawableAttributesReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->drawable);
__GLX_SWAP_INT(&req->numAttribs);
- __GLX_SWAP_INT_ARRAY( (int *)(req+1), req->numAttribs * 2 );
+ __GLX_SWAP_INT_ARRAY((int *) (req + 1), req->numAttribs * 2);
- return( __glXChangeDrawableAttributes(cl, pc) );
+ return (__glXChangeDrawableAttributes(cl, pc));
}
diff --git a/xorg-server/hw/dmx/glxProxy/glxext.c b/xorg-server/hw/dmx/glxProxy/glxext.c
index 4da16a77d..b0710ccc6 100644
--- a/xorg-server/hw/dmx/glxProxy/glxext.c
+++ b/xorg-server/hw/dmx/glxProxy/glxext.c
@@ -1,496 +1,517 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-
-#include "glxserver.h"
-#include <windowstr.h>
-#include <propertyst.h>
-#include <os.h>
-#include "g_disptab.h"
-#include "glxutil.h"
-#include "glxext.h"
-#include "glxvisuals.h"
-#include "micmap.h"
-#include "glxswap.h"
-
-/*
-** Stubs to satisfy miinitext.c references.
-*/
-typedef int __GLXprovider;
-__GLXprovider __glXDRISWRastProvider;
-void GlxPushProvider(__GLXprovider *provider) { }
-
-/*
-** Forward declarations.
-*/
-static int __glXSwapDispatch(ClientPtr);
-static int __glXDispatch(ClientPtr);
-
-/*
-** Called when the extension is reset.
-*/
-static void ResetExtension(ExtensionEntry* extEntry)
-{
- __glXFlushContextCache();
- __glXScreenReset();
- SwapBarrierReset();
-}
-
-/*
-** Initialize the per-client context storage.
-*/
-static void ResetClientState(int clientIndex)
-{
- __GLXclientState *cl = __glXClients[clientIndex];
- Display **keep_be_displays;
- int i;
-
- free(cl->returnBuf);
- free(cl->currentContexts);
- free(cl->currentDrawables);
- free(cl->largeCmdBuf);
-
- for (i=0; i< screenInfo.numScreens; i++) {
- if (cl->be_displays[i])
- XCloseDisplay( cl->be_displays[i] );
- }
-
- keep_be_displays = cl->be_displays;
- memset(cl, 0, sizeof(__GLXclientState));
- cl->be_displays = keep_be_displays;
-
- /*
- ** By default, assume that the client supports
- ** GLX major version 1 minor version 0 protocol.
- */
- cl->GLClientmajorVersion = 1;
- cl->GLClientminorVersion = 0;
- free(cl->GLClientextensions);
-
- memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
-}
-
-
-/*
-** This procedure is called when the client who created the context goes
-** away OR when glXDestroyContext is called. In either case, all we do is
-** flag that the ID is no longer valid, and (maybe) free the context.
-** use.
-*/
-static int ContextGone(__GLXcontext* cx, XID id)
-{
- cx->idExists = GL_FALSE;
- if (!cx->isCurrent) {
- __glXFreeContext(cx);
- }
-
- return True;
-}
-
-/*
-** Free a client's state.
-*/
-static int ClientGone(int clientIndex, XID id)
-{
- __GLXcontext *cx;
- __GLXclientState *cl = __glXClients[clientIndex];
- int i;
-
- if (cl) {
- /*
- ** Free all the contexts that are current for this client.
- */
- for (i=0; i < cl->numCurrentContexts; i++) {
- cx = cl->currentContexts[i];
- if (cx) {
- cx->isCurrent = GL_FALSE;
- if (!cx->idExists) {
- __glXFreeContext(cx);
- }
- }
- }
- /*
- ** Re-initialize the client state structure. Don't free it because
- ** we'll probably get another client with this index and use the struct
- ** again. There is a maximum of MAXCLIENTS of these structures.
- */
- ResetClientState(clientIndex);
- }
-
- return True;
-}
-
-/*
-** Free a GLX Pixmap.
-*/
-void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap )
-{
- if (!pGlxPixmap->idExists &&
- !pGlxPixmap->refcnt) {
-
- PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw;
-
- /*
- ** The DestroyPixmap routine should decrement the refcount and free
- ** only if it's zero.
- */
- (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
- free(pGlxPixmap->be_xids);
- free(pGlxPixmap);
- }
-
-}
-
-static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
-{
-
- pGlxPixmap->idExists = False;
- __glXFreeGLXPixmap( pGlxPixmap );
-
- return True;
-}
-
-void __glXFreeGLXWindow(__glXWindow *pGlxWindow)
-{
- if (!pGlxWindow->idExists && !pGlxWindow->refcnt) {
- WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw;
- WindowPtr ret;
-
- dixLookupResourceByType((pointer) &ret,
- pWindow->drawable.id, RT_WINDOW,
- NullClient, DixUnknownAccess);
- if (ret == pWindow) {
- (*pGlxWindow->pScreen->DestroyWindow)(pWindow);
- }
-
- free(pGlxWindow);
- }
-}
-
-static void WindowGone(__glXWindow *pGlxWindow, XID id)
-{
- pGlxWindow->idExists = False;
- __glXFreeGLXWindow(pGlxWindow);
-}
-
-void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer)
-{
- if (!pGlxPbuffer->idExists && !pGlxPbuffer->refcnt) {
- free(pGlxPbuffer->be_xids);
- free(pGlxPbuffer);
- }
-}
-
-static void PbufferGone(__glXPbuffer *pGlxPbuffer, XID id)
-{
- pGlxPbuffer->idExists = False;
- __glXFreeGLXPbuffer(pGlxPbuffer);
-}
-
-/*
-** Free a context.
-*/
-GLboolean __glXFreeContext(__GLXcontext *cx)
-{
- if (cx->idExists || cx->isCurrent) return GL_FALSE;
-
- free(cx->feedbackBuf);
- free(cx->selectBuf);
- free(cx->real_ids);
- free(cx->real_vids);
-
- if (cx->pGlxPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- cx->pGlxPixmap->refcnt--;
- __glXFreeGLXPixmap( cx->pGlxPixmap );
- cx->pGlxPixmap = 0;
- }
-
- if (cx->pGlxReadPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- cx->pGlxReadPixmap->refcnt--;
- __glXFreeGLXPixmap( cx->pGlxReadPixmap );
- cx->pGlxReadPixmap = 0;
- }
-
- if (cx->pGlxWindow) {
- /*
- ** The previous drawable was a glx window, release it.
- */
- cx->pGlxWindow->refcnt--;
- __glXFreeGLXWindow( cx->pGlxWindow );
- cx->pGlxWindow = 0;
- }
-
- if (cx->pGlxReadWindow) {
- /*
- ** The previous drawable was a glx window, release it.
- */
- cx->pGlxReadWindow->refcnt--;
- __glXFreeGLXWindow( cx->pGlxReadWindow );
- cx->pGlxReadWindow = 0;
- }
-
- free(cx);
-
- if (cx == __glXLastContext) {
- __glXFlushContextCache();
- }
-
- return GL_TRUE;
-}
-
-/*
-** Initialize the GLX extension.
-*/
-void GlxExtensionInit(void)
-{
- ExtensionEntry *extEntry;
- int i;
- int glxSupported = 1;
-
- /*
- // do not initialize GLX extension if GLX is not supported
- // by ALL back-end servers.
- */
- for (i=0; i<screenInfo.numScreens; i++) {
- glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
- }
-
- if (!glxSupported || !dmxGLXProxy) {
- return;
- }
-
- __glXContextRes = CreateNewResourceType((DeleteType)ContextGone,
- "GLXContext");
- __glXClientRes = CreateNewResourceType((DeleteType)ClientGone,
- "GLXClient");
- __glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone,
- "GLXPixmap");
- __glXWindowRes = CreateNewResourceType((DeleteType)WindowGone,
- "GLXWindow");
- __glXPbufferRes = CreateNewResourceType((DeleteType)PbufferGone,
- "GLXPbuffer");
-
- if (!__glXContextRes || !__glXClientRes || !__glXPixmapRes ||
- !__glXWindowRes || !__glXPbufferRes)
- return;
-
- /*
- ** Add extension to server extensions.
- */
- extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
- __GLX_NUMBER_ERRORS, __glXDispatch,
- __glXSwapDispatch, ResetExtension,
- StandardMinorOpcode);
- if (!extEntry) {
- FatalError("__glXExtensionInit: AddExtensions failed\n");
- return;
- }
- /*
- if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) {
- ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
- return;
- }
- */
-
- __glXerrorBase = extEntry->errorBase;
- __glXBadContext = extEntry->errorBase + GLXBadContext;
- __glXBadContextState = extEntry->errorBase + GLXBadContextState;
- __glXBadDrawable = extEntry->errorBase + GLXBadDrawable;
- __glXBadPixmap = extEntry->errorBase + GLXBadPixmap;
- __glXBadContextTag = extEntry->errorBase + GLXBadContextTag;
- __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow;
- __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest;
- __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest;
- __glXUnsupportedPrivateRequest = extEntry->errorBase +
- GLXUnsupportedPrivateRequest;
- __glXBadFBConfig = extEntry->errorBase + GLXBadFBConfig;
- __glXBadPbuffer = extEntry->errorBase + GLXBadPbuffer;
-
- /*
- ** Initialize table of client state. There is never a client 0.
- */
- for (i=1; i <= MAXCLIENTS; i++) {
- __glXClients[i] = 0;
- }
-
- /*
- ** Initialize screen specific data.
- */
- __glXScreenInit(screenInfo.numScreens);
-
- /*
- ** Initialize swap barrier support.
- */
- SwapBarrierInit();
-}
-
-/************************************************************************/
-
-Bool __glXCoreType(void)
-{
- return 0;
-}
-
-/************************************************************************/
-
-void __glXFlushContextCache(void)
-{
- __glXLastContext = 0;
-}
-
-/************************************************************************/
-
-/*
-** Top level dispatcher; all commands are executed from here down.
-*/
-static int __glXDispatch(ClientPtr client)
-{
- REQUEST(xGLXSingleReq);
- CARD8 opcode;
- int (*proc)(__GLXclientState *cl, GLbyte *pc);
- __GLXclientState *cl;
-
- opcode = stuff->glxCode;
- cl = __glXClients[client->index];
- if (!cl) {
- cl = calloc(1, sizeof(__GLXclientState));
- __glXClients[client->index] = cl;
- if (!cl) {
- return BadAlloc;
- }
-
- cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *));
- if (!cl->be_displays) {
- free( cl );
- return BadAlloc;
- }
- }
-
- if (!cl->inUse) {
- /*
- ** This is first request from this client. Associate a resource
- ** with the client so we will be notified when the client dies.
- */
- XID xid = FakeClientID(client->index);
- if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) {
- return BadAlloc;
- }
- ResetClientState(client->index);
- cl->largeCmdRequestsTotal = 0;
- cl->inUse = GL_TRUE;
- cl->client = client;
- }
-
- /*
- ** Check for valid opcode.
- */
- if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
- return BadRequest;
- }
-
- /*
- ** Use the opcode to index into the procedure table.
- */
- proc = __glXSingleTable[opcode];
- return (*proc)(cl, (GLbyte *) stuff);
-}
-
-static int __glXSwapDispatch(ClientPtr client)
-{
- REQUEST(xGLXSingleReq);
- CARD8 opcode;
- int (*proc)(__GLXclientState *cl, GLbyte *pc);
- __GLXclientState *cl;
-
- opcode = stuff->glxCode;
- cl = __glXClients[client->index];
- if (!cl) {
- cl = calloc(1, sizeof(__GLXclientState));
- __glXClients[client->index] = cl;
- if (!cl) {
- return BadAlloc;
- }
-
- cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *));
- if (!cl->be_displays) {
- free( cl );
- return BadAlloc;
- }
- }
-
- if (!cl->inUse) {
- /*
- ** This is first request from this client. Associate a resource
- ** with the client so we will be notified when the client dies.
- */
- XID xid = FakeClientID(client->index);
- if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) {
- return BadAlloc;
- }
- ResetClientState(client->index);
- cl->inUse = GL_TRUE;
- cl->client = client;
- }
-
- /*
- ** Check for valid opcode.
- */
- if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
- return BadRequest;
- }
-
- /*
- ** Use the opcode to index into the procedure table.
- */
- proc = __glXSwapSingleTable[opcode];
- return (*proc)(cl, (GLbyte *) stuff);
-}
-
-int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc)
-{
- return BadRequest;
-}
-
-void __glXNoSuchRenderOpcode(GLbyte *pc)
-{
- return;
-}
-
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+
+#include "glxserver.h"
+#include <windowstr.h>
+#include <propertyst.h>
+#include <os.h>
+#include "g_disptab.h"
+#include "glxutil.h"
+#include "glxext.h"
+#include "glxvisuals.h"
+#include "micmap.h"
+#include "glxswap.h"
+
+/*
+** Stubs to satisfy miinitext.c references.
+*/
+typedef int __GLXprovider;
+__GLXprovider __glXDRISWRastProvider;
+void
+GlxPushProvider(__GLXprovider * provider)
+{
+}
+
+/*
+** Forward declarations.
+*/
+static int __glXSwapDispatch(ClientPtr);
+static int __glXDispatch(ClientPtr);
+
+/*
+** Called when the extension is reset.
+*/
+static void
+ResetExtension(ExtensionEntry * extEntry)
+{
+ __glXFlushContextCache();
+ __glXScreenReset();
+ SwapBarrierReset();
+}
+
+/*
+** Initialize the per-client context storage.
+*/
+static void
+ResetClientState(int clientIndex)
+{
+ __GLXclientState *cl = __glXClients[clientIndex];
+ Display **keep_be_displays;
+ int i;
+
+ free(cl->returnBuf);
+ free(cl->currentContexts);
+ free(cl->currentDrawables);
+ free(cl->largeCmdBuf);
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ if (cl->be_displays[i])
+ XCloseDisplay(cl->be_displays[i]);
+ }
+
+ keep_be_displays = cl->be_displays;
+ memset(cl, 0, sizeof(__GLXclientState));
+ cl->be_displays = keep_be_displays;
+
+ /*
+ ** By default, assume that the client supports
+ ** GLX major version 1 minor version 0 protocol.
+ */
+ cl->GLClientmajorVersion = 1;
+ cl->GLClientminorVersion = 0;
+ free(cl->GLClientextensions);
+
+ memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
+}
+
+/*
+** This procedure is called when the client who created the context goes
+** away OR when glXDestroyContext is called. In either case, all we do is
+** flag that the ID is no longer valid, and (maybe) free the context.
+** use.
+*/
+static int
+ContextGone(__GLXcontext * cx, XID id)
+{
+ cx->idExists = GL_FALSE;
+ if (!cx->isCurrent) {
+ __glXFreeContext(cx);
+ }
+
+ return True;
+}
+
+/*
+** Free a client's state.
+*/
+static int
+ClientGone(int clientIndex, XID id)
+{
+ __GLXcontext *cx;
+ __GLXclientState *cl = __glXClients[clientIndex];
+ int i;
+
+ if (cl) {
+ /*
+ ** Free all the contexts that are current for this client.
+ */
+ for (i = 0; i < cl->numCurrentContexts; i++) {
+ cx = cl->currentContexts[i];
+ if (cx) {
+ cx->isCurrent = GL_FALSE;
+ if (!cx->idExists) {
+ __glXFreeContext(cx);
+ }
+ }
+ }
+ /*
+ ** Re-initialize the client state structure. Don't free it because
+ ** we'll probably get another client with this index and use the struct
+ ** again. There is a maximum of MAXCLIENTS of these structures.
+ */
+ ResetClientState(clientIndex);
+ }
+
+ return True;
+}
+
+/*
+** Free a GLX Pixmap.
+*/
+void
+__glXFreeGLXPixmap(__GLXpixmap * pGlxPixmap)
+{
+ if (!pGlxPixmap->idExists && !pGlxPixmap->refcnt) {
+
+ PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw;
+
+ /*
+ ** The DestroyPixmap routine should decrement the refcount and free
+ ** only if it's zero.
+ */
+ (*pGlxPixmap->pScreen->DestroyPixmap) (pPixmap);
+ free(pGlxPixmap->be_xids);
+ free(pGlxPixmap);
+ }
+
+}
+
+static int
+PixmapGone(__GLXpixmap * pGlxPixmap, XID id)
+{
+
+ pGlxPixmap->idExists = False;
+ __glXFreeGLXPixmap(pGlxPixmap);
+
+ return True;
+}
+
+void
+__glXFreeGLXWindow(__glXWindow * pGlxWindow)
+{
+ if (!pGlxWindow->idExists && !pGlxWindow->refcnt) {
+ WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw;
+ WindowPtr ret;
+
+ dixLookupResourceByType((pointer) &ret,
+ pWindow->drawable.id, RT_WINDOW,
+ NullClient, DixUnknownAccess);
+ if (ret == pWindow) {
+ (*pGlxWindow->pScreen->DestroyWindow) (pWindow);
+ }
+
+ free(pGlxWindow);
+ }
+}
+
+static void
+WindowGone(__glXWindow * pGlxWindow, XID id)
+{
+ pGlxWindow->idExists = False;
+ __glXFreeGLXWindow(pGlxWindow);
+}
+
+void
+__glXFreeGLXPbuffer(__glXPbuffer * pGlxPbuffer)
+{
+ if (!pGlxPbuffer->idExists && !pGlxPbuffer->refcnt) {
+ free(pGlxPbuffer->be_xids);
+ free(pGlxPbuffer);
+ }
+}
+
+static void
+PbufferGone(__glXPbuffer * pGlxPbuffer, XID id)
+{
+ pGlxPbuffer->idExists = False;
+ __glXFreeGLXPbuffer(pGlxPbuffer);
+}
+
+/*
+** Free a context.
+*/
+GLboolean
+__glXFreeContext(__GLXcontext * cx)
+{
+ if (cx->idExists || cx->isCurrent)
+ return GL_FALSE;
+
+ free(cx->feedbackBuf);
+ free(cx->selectBuf);
+ free(cx->real_ids);
+ free(cx->real_vids);
+
+ if (cx->pGlxPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ cx->pGlxPixmap->refcnt--;
+ __glXFreeGLXPixmap(cx->pGlxPixmap);
+ cx->pGlxPixmap = 0;
+ }
+
+ if (cx->pGlxReadPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ cx->pGlxReadPixmap->refcnt--;
+ __glXFreeGLXPixmap(cx->pGlxReadPixmap);
+ cx->pGlxReadPixmap = 0;
+ }
+
+ if (cx->pGlxWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ cx->pGlxWindow->refcnt--;
+ __glXFreeGLXWindow(cx->pGlxWindow);
+ cx->pGlxWindow = 0;
+ }
+
+ if (cx->pGlxReadWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ cx->pGlxReadWindow->refcnt--;
+ __glXFreeGLXWindow(cx->pGlxReadWindow);
+ cx->pGlxReadWindow = 0;
+ }
+
+ free(cx);
+
+ if (cx == __glXLastContext) {
+ __glXFlushContextCache();
+ }
+
+ return GL_TRUE;
+}
+
+/*
+** Initialize the GLX extension.
+*/
+void
+GlxExtensionInit(void)
+{
+ ExtensionEntry *extEntry;
+ int i;
+ int glxSupported = 1;
+
+ /*
+ // do not initialize GLX extension if GLX is not supported
+ // by ALL back-end servers.
+ */
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
+ }
+
+ if (!glxSupported || !dmxGLXProxy) {
+ return;
+ }
+
+ __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
+ "GLXContext");
+ __glXClientRes = CreateNewResourceType((DeleteType) ClientGone,
+ "GLXClient");
+ __glXPixmapRes = CreateNewResourceType((DeleteType) PixmapGone,
+ "GLXPixmap");
+ __glXWindowRes = CreateNewResourceType((DeleteType) WindowGone,
+ "GLXWindow");
+ __glXPbufferRes = CreateNewResourceType((DeleteType) PbufferGone,
+ "GLXPbuffer");
+
+ if (!__glXContextRes || !__glXClientRes || !__glXPixmapRes ||
+ !__glXWindowRes || !__glXPbufferRes)
+ return;
+
+ /*
+ ** Add extension to server extensions.
+ */
+ extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
+ __GLX_NUMBER_ERRORS, __glXDispatch,
+ __glXSwapDispatch, ResetExtension,
+ StandardMinorOpcode);
+ if (!extEntry) {
+ FatalError("__glXExtensionInit: AddExtensions failed\n");
+ return;
+ }
+ /*
+ if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) {
+ ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
+ return;
+ }
+ */
+
+ __glXerrorBase = extEntry->errorBase;
+ __glXBadContext = extEntry->errorBase + GLXBadContext;
+ __glXBadContextState = extEntry->errorBase + GLXBadContextState;
+ __glXBadDrawable = extEntry->errorBase + GLXBadDrawable;
+ __glXBadPixmap = extEntry->errorBase + GLXBadPixmap;
+ __glXBadContextTag = extEntry->errorBase + GLXBadContextTag;
+ __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow;
+ __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest;
+ __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest;
+ __glXUnsupportedPrivateRequest = extEntry->errorBase +
+ GLXUnsupportedPrivateRequest;
+ __glXBadFBConfig = extEntry->errorBase + GLXBadFBConfig;
+ __glXBadPbuffer = extEntry->errorBase + GLXBadPbuffer;
+
+ /*
+ ** Initialize table of client state. There is never a client 0.
+ */
+ for (i = 1; i <= MAXCLIENTS; i++) {
+ __glXClients[i] = 0;
+ }
+
+ /*
+ ** Initialize screen specific data.
+ */
+ __glXScreenInit(screenInfo.numScreens);
+
+ /*
+ ** Initialize swap barrier support.
+ */
+ SwapBarrierInit();
+}
+
+/************************************************************************/
+
+Bool
+__glXCoreType(void)
+{
+ return 0;
+}
+
+/************************************************************************/
+
+void
+__glXFlushContextCache(void)
+{
+ __glXLastContext = 0;
+}
+
+/************************************************************************/
+
+/*
+** Top level dispatcher; all commands are executed from here down.
+*/
+static int
+__glXDispatch(ClientPtr client)
+{
+ REQUEST(xGLXSingleReq);
+ CARD8 opcode;
+ int (*proc) (__GLXclientState * cl, GLbyte * pc);
+ __GLXclientState *cl;
+
+ opcode = stuff->glxCode;
+ cl = __glXClients[client->index];
+ if (!cl) {
+ cl = calloc(1, sizeof(__GLXclientState));
+ __glXClients[client->index] = cl;
+ if (!cl) {
+ return BadAlloc;
+ }
+
+ cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *));
+ if (!cl->be_displays) {
+ free(cl);
+ return BadAlloc;
+ }
+ }
+
+ if (!cl->inUse) {
+ /*
+ ** This is first request from this client. Associate a resource
+ ** with the client so we will be notified when the client dies.
+ */
+ XID xid = FakeClientID(client->index);
+
+ if (!AddResource(xid, __glXClientRes, (pointer) (long) client->index)) {
+ return BadAlloc;
+ }
+ ResetClientState(client->index);
+ cl->largeCmdRequestsTotal = 0;
+ cl->inUse = GL_TRUE;
+ cl->client = client;
+ }
+
+ /*
+ ** Check for valid opcode.
+ */
+ if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
+ return BadRequest;
+ }
+
+ /*
+ ** Use the opcode to index into the procedure table.
+ */
+ proc = __glXSingleTable[opcode];
+ return (*proc) (cl, (GLbyte *) stuff);
+}
+
+static int
+__glXSwapDispatch(ClientPtr client)
+{
+ REQUEST(xGLXSingleReq);
+ CARD8 opcode;
+ int (*proc) (__GLXclientState * cl, GLbyte * pc);
+ __GLXclientState *cl;
+
+ opcode = stuff->glxCode;
+ cl = __glXClients[client->index];
+ if (!cl) {
+ cl = calloc(1, sizeof(__GLXclientState));
+ __glXClients[client->index] = cl;
+ if (!cl) {
+ return BadAlloc;
+ }
+
+ cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *));
+ if (!cl->be_displays) {
+ free(cl);
+ return BadAlloc;
+ }
+ }
+
+ if (!cl->inUse) {
+ /*
+ ** This is first request from this client. Associate a resource
+ ** with the client so we will be notified when the client dies.
+ */
+ XID xid = FakeClientID(client->index);
+
+ if (!AddResource(xid, __glXClientRes, (pointer) (long) client->index)) {
+ return BadAlloc;
+ }
+ ResetClientState(client->index);
+ cl->inUse = GL_TRUE;
+ cl->client = client;
+ }
+
+ /*
+ ** Check for valid opcode.
+ */
+ if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
+ return BadRequest;
+ }
+
+ /*
+ ** Use the opcode to index into the procedure table.
+ */
+ proc = __glXSwapSingleTable[opcode];
+ return (*proc) (cl, (GLbyte *) stuff);
+}
+
+int
+__glXNoSuchSingleOpcode(__GLXclientState * cl, GLbyte * pc)
+{
+ return BadRequest;
+}
+
+void
+__glXNoSuchRenderOpcode(GLbyte * pc)
+{
+ return;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxext.h b/xorg-server/hw/dmx/glxProxy/glxext.h
index 3e3e5b7f3..881152d1c 100644
--- a/xorg-server/hw/dmx/glxProxy/glxext.h
+++ b/xorg-server/hw/dmx/glxProxy/glxext.h
@@ -1,78 +1,71 @@
-#ifndef _glxext_h_
-#define _glxext_h_
-
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-/*
- * Added by VA Linux for XFree86 4.0.x
- */
-typedef struct {
- int type;
- void (*resetExtension)(void);
- Bool (*initVisuals)(
- VisualPtr * visualp,
- DepthPtr * depthp,
- int * nvisualp,
- int * ndepthp,
- int * rootDepthp,
- VisualID * defaultVisp,
- unsigned long sizes,
- int bitsPerRGB
- );
- void (*setVisualConfigs)(
- int nconfigs,
- __GLXvisualConfig *configs,
- void **privates
- );
-} __GLXextensionInfo;
-
-extern GLboolean __glXFreeContext(__GLXcontext *glxc);
-extern void __glXFlushContextCache(void);
-
-extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow);
-extern void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap );
-
-extern void __glXNoSuchRenderOpcode(GLbyte*);
-extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*);
-extern void __glXErrorCallBack(GLenum code);
-extern void __glXClearErrorOccured(void);
-extern GLboolean __glXErrorOccured(void);
-extern void __glXResetLargeCommandStatus(__GLXclientState*);
-
-extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc);
-
-extern void GlxExtensionInit(void);
-
-extern Bool __glXCoreType(void);
-
-#endif /* _glxext_h_ */
-
+#ifndef _glxext_h_
+#define _glxext_h_
+
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+/*
+ * Added by VA Linux for XFree86 4.0.x
+ */
+typedef struct {
+ int type;
+ void (*resetExtension) (void);
+ Bool (*initVisuals) (VisualPtr * visualp,
+ DepthPtr * depthp,
+ int *nvisualp,
+ int *ndepthp,
+ int *rootDepthp,
+ VisualID * defaultVisp,
+ unsigned long sizes, int bitsPerRGB);
+ void (*setVisualConfigs) (int nconfigs,
+ __GLXvisualConfig * configs, void **privates);
+} __GLXextensionInfo;
+
+extern GLboolean __glXFreeContext(__GLXcontext * glxc);
+extern void __glXFlushContextCache(void);
+
+extern void __glXFreeGLXWindow(__glXWindow * pGlxWindow);
+extern void __glXFreeGLXPixmap(__GLXpixmap * pGlxPixmap);
+
+extern void __glXNoSuchRenderOpcode(GLbyte *);
+extern int __glXNoSuchSingleOpcode(__GLXclientState *, GLbyte *);
+extern void __glXErrorCallBack(GLenum code);
+extern void __glXClearErrorOccured(void);
+extern GLboolean __glXErrorOccured(void);
+extern void __glXResetLargeCommandStatus(__GLXclientState *);
+
+extern int __glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapQueryContextInfoEXT(__GLXclientState * cl, char *pc);
+
+extern void GlxExtensionInit(void);
+
+extern Bool __glXCoreType(void);
+
+#endif /* _glxext_h_ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxfbconfig.c b/xorg-server/hw/dmx/glxProxy/glxfbconfig.c
index 3611cf61e..2f46bd07a 100644
--- a/xorg-server/hw/dmx/glxProxy/glxfbconfig.c
+++ b/xorg-server/hw/dmx/glxProxy/glxfbconfig.c
@@ -1,106 +1,106 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#include "glxfbconfig.h"
-
-int AreFBConfigsMatch( __GLXFBConfig *c1, __GLXFBConfig *c2 )
-{
- int match;
-
- match = (
- (c1->visualType == c2->visualType) &&
- (c1->transparentType == c2->transparentType) &&
- (c1->transparentRed == c2->transparentRed) &&
- (c1->transparentGreen == c2->transparentGreen) &&
- (c1->transparentBlue == c2->transparentBlue) &&
- (c1->transparentAlpha == c2->transparentAlpha) &&
- (c1->transparentIndex == c2->transparentIndex) &&
- (c1->visualCaveat == c2->visualCaveat) &&
- (c1->drawableType == c2->drawableType) &&
- (c1->renderType == c2->renderType) &&
-#if 0
- (c1->maxPbufferWidth == c2->maxPbufferWidth) &&
- (c1->maxPbufferHeight == c2->maxPbufferHeight) &&
- (c1->maxPbufferPixels == c2->maxPbufferPixels) &&
- (c1->optimalPbufferWidth == c2->optimalPbufferWidth) &&
- (c1->optimalPbufferHeight == c2->optimalPbufferHeight) &&
-#endif
- (c1->visualSelectGroup == c2->visualSelectGroup) &&
- (c1->rgbMode == c2->rgbMode) &&
- (c1->colorIndexMode == c2->colorIndexMode) &&
- (c1->doubleBufferMode == c2->doubleBufferMode) &&
- (c1->stereoMode == c2->stereoMode) &&
- (c1->haveAccumBuffer == c2->haveAccumBuffer) &&
- (c1->haveDepthBuffer == c2->haveDepthBuffer) &&
- (c1->haveStencilBuffer == c2->haveStencilBuffer) &&
- (c1->accumRedBits == c2->accumRedBits) &&
- (c1->accumGreenBits == c2->accumGreenBits) &&
- (c1->accumBlueBits == c2->accumBlueBits) &&
- (c1->accumAlphaBits == c2->accumAlphaBits) &&
- (c1->depthBits == c2->depthBits) &&
- (c1->stencilBits == c2->stencilBits) &&
- (c1->indexBits == c2->indexBits) &&
- (c1->redBits == c2->redBits) &&
- (c1->greenBits == c2->greenBits) &&
- (c1->blueBits == c2->blueBits) &&
- (c1->alphaBits == c2->alphaBits) &&
- (c1->redMask == c2->redMask) &&
- (c1->greenMask == c2->greenMask) &&
- (c1->blueMask == c2->blueMask) &&
- (c1->alphaMask == c2->alphaMask) &&
- (c1->multiSampleSize == c2->multiSampleSize) &&
- (c1->nMultiSampleBuffers == c2->nMultiSampleBuffers) &&
- (c1->maxAuxBuffers == c2->maxAuxBuffers) &&
- (c1->level == c2->level) &&
- (c1->extendedRange == c2->extendedRange) &&
- (c1->minRed == c2->minRed) &&
- (c1->maxRed == c2->maxRed) &&
- (c1->minGreen == c2->minGreen) &&
- (c1->maxGreen == c2->maxGreen) &&
- (c1->minBlue == c2->minBlue) &&
- (c1->maxBlue == c2->maxBlue) &&
- (c1->minAlpha == c2->minAlpha) &&
- (c1->maxAlpha == c2->maxAlpha)
- );
-
- return match;
-}
-
-__GLXFBConfig *FindMatchingFBConfig( __GLXFBConfig *c, __GLXFBConfig *configs, int nconfigs )
-{
- int i;
-
- for (i=0; i<nconfigs; i++) {
- if ( AreFBConfigsMatch( c, configs + i ) )
- return configs + i;
- }
-
- return 0;
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#include "glxfbconfig.h"
+
+int
+AreFBConfigsMatch(__GLXFBConfig * c1, __GLXFBConfig * c2)
+{
+ int match;
+
+ match = ((c1->visualType == c2->visualType) &&
+ (c1->transparentType == c2->transparentType) &&
+ (c1->transparentRed == c2->transparentRed) &&
+ (c1->transparentGreen == c2->transparentGreen) &&
+ (c1->transparentBlue == c2->transparentBlue) &&
+ (c1->transparentAlpha == c2->transparentAlpha) &&
+ (c1->transparentIndex == c2->transparentIndex) &&
+ (c1->visualCaveat == c2->visualCaveat) &&
+ (c1->drawableType == c2->drawableType) &&
+ (c1->renderType == c2->renderType) &&
+#if 0
+ (c1->maxPbufferWidth == c2->maxPbufferWidth) &&
+ (c1->maxPbufferHeight == c2->maxPbufferHeight) &&
+ (c1->maxPbufferPixels == c2->maxPbufferPixels) &&
+ (c1->optimalPbufferWidth == c2->optimalPbufferWidth) &&
+ (c1->optimalPbufferHeight == c2->optimalPbufferHeight) &&
+#endif
+ (c1->visualSelectGroup == c2->visualSelectGroup) &&
+ (c1->rgbMode == c2->rgbMode) &&
+ (c1->colorIndexMode == c2->colorIndexMode) &&
+ (c1->doubleBufferMode == c2->doubleBufferMode) &&
+ (c1->stereoMode == c2->stereoMode) &&
+ (c1->haveAccumBuffer == c2->haveAccumBuffer) &&
+ (c1->haveDepthBuffer == c2->haveDepthBuffer) &&
+ (c1->haveStencilBuffer == c2->haveStencilBuffer) &&
+ (c1->accumRedBits == c2->accumRedBits) &&
+ (c1->accumGreenBits == c2->accumGreenBits) &&
+ (c1->accumBlueBits == c2->accumBlueBits) &&
+ (c1->accumAlphaBits == c2->accumAlphaBits) &&
+ (c1->depthBits == c2->depthBits) &&
+ (c1->stencilBits == c2->stencilBits) &&
+ (c1->indexBits == c2->indexBits) &&
+ (c1->redBits == c2->redBits) &&
+ (c1->greenBits == c2->greenBits) &&
+ (c1->blueBits == c2->blueBits) &&
+ (c1->alphaBits == c2->alphaBits) &&
+ (c1->redMask == c2->redMask) &&
+ (c1->greenMask == c2->greenMask) &&
+ (c1->blueMask == c2->blueMask) &&
+ (c1->alphaMask == c2->alphaMask) &&
+ (c1->multiSampleSize == c2->multiSampleSize) &&
+ (c1->nMultiSampleBuffers == c2->nMultiSampleBuffers) &&
+ (c1->maxAuxBuffers == c2->maxAuxBuffers) &&
+ (c1->level == c2->level) &&
+ (c1->extendedRange == c2->extendedRange) &&
+ (c1->minRed == c2->minRed) &&
+ (c1->maxRed == c2->maxRed) &&
+ (c1->minGreen == c2->minGreen) &&
+ (c1->maxGreen == c2->maxGreen) &&
+ (c1->minBlue == c2->minBlue) &&
+ (c1->maxBlue == c2->maxBlue) &&
+ (c1->minAlpha == c2->minAlpha) && (c1->maxAlpha == c2->maxAlpha)
+ );
+
+ return match;
+}
+
+__GLXFBConfig *
+FindMatchingFBConfig(__GLXFBConfig * c, __GLXFBConfig * configs, int nconfigs)
+{
+ int i;
+
+ for (i = 0; i < nconfigs; i++) {
+ if (AreFBConfigsMatch(c, configs + i))
+ return configs + i;
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxfbconfig.h b/xorg-server/hw/dmx/glxProxy/glxfbconfig.h
index c5e94043b..6626410d9 100644
--- a/xorg-server/hw/dmx/glxProxy/glxfbconfig.h
+++ b/xorg-server/hw/dmx/glxProxy/glxfbconfig.h
@@ -32,7 +32,8 @@
#include <GL/glxint.h>
-int AreFBConfigsMatch( __GLXFBConfig *c1, __GLXFBConfig *c2 );
-__GLXFBConfig *FindMatchingFBConfig( __GLXFBConfig *c, __GLXFBConfig *configs, int nconfigs );
+int AreFBConfigsMatch(__GLXFBConfig * c1, __GLXFBConfig * c2);
+__GLXFBConfig *FindMatchingFBConfig(__GLXFBConfig * c, __GLXFBConfig * configs,
+ int nconfigs);
#endif
diff --git a/xorg-server/hw/dmx/glxProxy/glxscreens.c b/xorg-server/hw/dmx/glxProxy/glxscreens.c
index baa4a65a7..f725bd138 100644
--- a/xorg-server/hw/dmx/glxProxy/glxscreens.c
+++ b/xorg-server/hw/dmx/glxProxy/glxscreens.c
@@ -49,285 +49,296 @@ __GLXscreenInfo *__glXActiveScreens;
GLint __glXNumActiveScreens;
__GLXFBConfig **__glXFBConfigs;
-int __glXNumFBConfigs;
+int __glXNumFBConfigs;
static char GLXServerVendorName[] = "SGI DMX/glxProxy";
static char GLXServerVersion[64];
static char GLXServerExtensions[] =
- "GLX_EXT_visual_info "
- "GLX_EXT_visual_rating "
- "GLX_EXT_import_context "
- "GLX_SGIX_fbconfig "
- "GLX_SGI_make_current_read "
- "GLX_SGI_swap_control "
- ;
+ "GLX_EXT_visual_info "
+ "GLX_EXT_visual_rating "
+ "GLX_EXT_import_context "
+ "GLX_SGIX_fbconfig " "GLX_SGI_make_current_read " "GLX_SGI_swap_control ";
static char ExtensionsString[1024];
-static void CalcServerVersionAndExtensions( void )
+static void
+CalcServerVersionAndExtensions(void)
{
- int s;
- xGLXQueryVersionReq *req;
- xGLXQueryVersionReply reply;
- char **be_extensions;
- char *ext;
- char *denied_extensions;
-
- /*
- * set the server glx version to be the minimum version
- * supported by all back-end servers
- */
- __glXVersionMajor = 0;
- __glXVersionMinor = 0;
- for (s=0; s<__glXNumActiveScreens; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = dmxScreen->beDisplay;
-
- /* Send the glXQueryVersion request */
- LockDisplay(dpy);
- GetReq(GLXQueryVersion,req);
- req->reqType = dmxScreen->glxMajorOpcode;
- req->glxCode = X_GLXQueryVersion;
- req->majorVersion = GLX_SERVER_MAJOR_VERSION;
- req->minorVersion = GLX_SERVER_MINOR_VERSION;
- _XReply(dpy, (xReply*) &reply, 0, False);
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (s == 0) {
- __glXVersionMajor = reply.majorVersion;
- __glXVersionMinor = reply.minorVersion;
- }
- else {
- if (reply.majorVersion < __glXVersionMajor) {
- __glXVersionMajor = reply.majorVersion;
- __glXVersionMinor = reply.minorVersion;
- }
- else if ( (reply.majorVersion == __glXVersionMajor) &&
- (reply.minorVersion < __glXVersionMinor) ) {
- __glXVersionMinor = reply.minorVersion;
- }
- }
-
- }
-
- if (GLX_SERVER_MAJOR_VERSION < __glXVersionMajor) {
- __glXVersionMajor = GLX_SERVER_MAJOR_VERSION;
- __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
- }
- else if ( (GLX_SERVER_MAJOR_VERSION == __glXVersionMajor) &&
- (GLX_SERVER_MINOR_VERSION < __glXVersionMinor) ) {
- __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
- }
-
- snprintf(GLXServerVersion, sizeof(GLXServerVersion),
+ int s;
+ xGLXQueryVersionReq *req;
+ xGLXQueryVersionReply reply;
+ char **be_extensions;
+ char *ext;
+ char *denied_extensions;
+
+ /*
+ * set the server glx version to be the minimum version
+ * supported by all back-end servers
+ */
+ __glXVersionMajor = 0;
+ __glXVersionMinor = 0;
+ for (s = 0; s < __glXNumActiveScreens; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = dmxScreen->beDisplay;
+
+ /* Send the glXQueryVersion request */
+ LockDisplay(dpy);
+ GetReq(GLXQueryVersion, req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXQueryVersion;
+ req->majorVersion = GLX_SERVER_MAJOR_VERSION;
+ req->minorVersion = GLX_SERVER_MINOR_VERSION;
+ _XReply(dpy, (xReply *) & reply, 0, False);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s == 0) {
+ __glXVersionMajor = reply.majorVersion;
+ __glXVersionMinor = reply.minorVersion;
+ }
+ else {
+ if (reply.majorVersion < __glXVersionMajor) {
+ __glXVersionMajor = reply.majorVersion;
+ __glXVersionMinor = reply.minorVersion;
+ }
+ else if ((reply.majorVersion == __glXVersionMajor) &&
+ (reply.minorVersion < __glXVersionMinor)) {
+ __glXVersionMinor = reply.minorVersion;
+ }
+ }
+
+ }
+
+ if (GLX_SERVER_MAJOR_VERSION < __glXVersionMajor) {
+ __glXVersionMajor = GLX_SERVER_MAJOR_VERSION;
+ __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
+ }
+ else if ((GLX_SERVER_MAJOR_VERSION == __glXVersionMajor) &&
+ (GLX_SERVER_MINOR_VERSION < __glXVersionMinor)) {
+ __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
+ }
+
+ snprintf(GLXServerVersion, sizeof(GLXServerVersion),
"%d.%d DMX %d back-end server(s)",
- __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens );
- /*
- * set the ExtensionsString to the minimum extensions string
- */
- ExtensionsString[0] = '\0';
-
- /*
- * read extensions strings of all back-end servers
- */
- be_extensions = (char **)malloc( __glXNumActiveScreens * sizeof(char *) );
- if (!be_extensions)
- return;
-
- for (s=0; s<__glXNumActiveScreens; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = dmxScreen->beDisplay;
- xGLXQueryServerStringReq *req;
- xGLXQueryServerStringReply reply;
- int length, numbytes, slop;
-
- /* Send the glXQueryServerString request */
- LockDisplay(dpy);
- GetReq(GLXQueryServerString,req);
- req->reqType = dmxScreen->glxMajorOpcode;
- req->glxCode = X_GLXQueryServerString;
- req->screen = DefaultScreen(dpy);
- req->name = GLX_EXTENSIONS;
- _XReply(dpy, (xReply*) &reply, 0, False);
-
- length = (int)reply.length;
- numbytes = (int)reply.n;
- slop = numbytes * __GLX_SIZE_INT8 & 3;
- be_extensions[s] = (char *)malloc(numbytes);
- if (!be_extensions[s]) {
- /* Throw data on the floor */
- _XEatData(dpy, length);
- } else {
- _XRead(dpy, (char *)be_extensions[s], numbytes);
- if (slop) _XEatData(dpy,4-slop);
- }
- UnlockDisplay(dpy);
- SyncHandle();
- }
-
- /*
- * extensions string will include only extensions that our
- * server supports as well as all back-end servers supports.
- * extensions that are in the DMX_DENY_EXTENSIONS string will
- * not be supported.
- */
- denied_extensions = getenv("DMX_DENY_GLX_EXTENSIONS");
- ext = strtok(GLXServerExtensions, " ");
- while( ext ) {
- int supported = 1;
-
- if (denied_extensions && strstr(denied_extensions, ext)) {
- supported = 0;
- }
- else {
- for (s=0; s<__glXNumActiveScreens && supported; s++) {
- if ( !strstr(be_extensions[s], ext) ) {
- supported = 0;
- }
- }
- }
-
- if (supported) {
- strcat(ExtensionsString, ext);
- strcat(ExtensionsString, " ");
- }
-
- ext = strtok(NULL, " ");
- }
-
- /*
- * release temporary storage
- */
- for (s=0; s<__glXNumActiveScreens; s++) {
- free(be_extensions[s]);
- }
- free( be_extensions );
-
- if (dmxGLXSwapGroupSupport) {
- if (!denied_extensions ||
- !strstr(denied_extensions, "GLX_SGIX_swap_group")) {
- strcat(ExtensionsString, "GLX_SGIX_swap_group");
- if (!denied_extensions ||
- !strstr(denied_extensions, "GLX_SGIX_swap_barrier")) {
- strcat(ExtensionsString, " GLX_SGIX_swap_barrier");
- }
- }
- }
+ __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens);
+ /*
+ * set the ExtensionsString to the minimum extensions string
+ */
+ ExtensionsString[0] = '\0';
+
+ /*
+ * read extensions strings of all back-end servers
+ */
+ be_extensions = (char **) malloc(__glXNumActiveScreens * sizeof(char *));
+ if (!be_extensions)
+ return;
+
+ for (s = 0; s < __glXNumActiveScreens; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = dmxScreen->beDisplay;
+ xGLXQueryServerStringReq *req;
+ xGLXQueryServerStringReply reply;
+ int length, numbytes, slop;
+
+ /* Send the glXQueryServerString request */
+ LockDisplay(dpy);
+ GetReq(GLXQueryServerString, req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXQueryServerString;
+ req->screen = DefaultScreen(dpy);
+ req->name = GLX_EXTENSIONS;
+ _XReply(dpy, (xReply *) & reply, 0, False);
+
+ length = (int) reply.length;
+ numbytes = (int) reply.n;
+ slop = numbytes * __GLX_SIZE_INT8 & 3;
+ be_extensions[s] = (char *) malloc(numbytes);
+ if (!be_extensions[s]) {
+ /* Throw data on the floor */
+ _XEatData(dpy, length);
+ }
+ else {
+ _XRead(dpy, (char *) be_extensions[s], numbytes);
+ if (slop)
+ _XEatData(dpy, 4 - slop);
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ /*
+ * extensions string will include only extensions that our
+ * server supports as well as all back-end servers supports.
+ * extensions that are in the DMX_DENY_EXTENSIONS string will
+ * not be supported.
+ */
+ denied_extensions = getenv("DMX_DENY_GLX_EXTENSIONS");
+ ext = strtok(GLXServerExtensions, " ");
+ while (ext) {
+ int supported = 1;
+
+ if (denied_extensions && strstr(denied_extensions, ext)) {
+ supported = 0;
+ }
+ else {
+ for (s = 0; s < __glXNumActiveScreens && supported; s++) {
+ if (!strstr(be_extensions[s], ext)) {
+ supported = 0;
+ }
+ }
+ }
+
+ if (supported) {
+ strcat(ExtensionsString, ext);
+ strcat(ExtensionsString, " ");
+ }
+
+ ext = strtok(NULL, " ");
+ }
+
+ /*
+ * release temporary storage
+ */
+ for (s = 0; s < __glXNumActiveScreens; s++) {
+ free(be_extensions[s]);
+ }
+ free(be_extensions);
+
+ if (dmxGLXSwapGroupSupport) {
+ if (!denied_extensions ||
+ !strstr(denied_extensions, "GLX_SGIX_swap_group")) {
+ strcat(ExtensionsString, "GLX_SGIX_swap_group");
+ if (!denied_extensions ||
+ !strstr(denied_extensions, "GLX_SGIX_swap_barrier")) {
+ strcat(ExtensionsString, " GLX_SGIX_swap_barrier");
+ }
+ }
+ }
}
-void __glXScreenInit(GLint numscreens)
+void
+__glXScreenInit(GLint numscreens)
{
- int s;
- int c;
- DMXScreenInfo *dmxScreen0 = &dmxScreens[0];
- __glXNumActiveScreens = numscreens;
-
+ int s;
+ int c;
+ DMXScreenInfo *dmxScreen0 = &dmxScreens[0];
- CalcServerVersionAndExtensions();
+ __glXNumActiveScreens = numscreens;
+ CalcServerVersionAndExtensions();
- __glXFBConfigs = NULL;
- __glXNumFBConfigs = 0;
+ __glXFBConfigs = NULL;
+ __glXNumFBConfigs = 0;
- if ( (__glXVersionMajor == 1 && __glXVersionMinor >= 3) ||
+ if ((__glXVersionMajor == 1 && __glXVersionMinor >= 3) ||
(__glXVersionMajor > 1) ||
- ( strstr(ExtensionsString, "GLX_SGIX_fbconfig") ) ) {
-
- /*
- // Initialize FBConfig info.
- // find the set of FBConfigs that are present on all back-end
- // servers - only those configs will be supported
- */
- __glXFBConfigs = (__GLXFBConfig **)malloc( dmxScreen0->numFBConfigs *
- (numscreens+1) * sizeof(__GLXFBConfig *) );
- __glXNumFBConfigs = 0;
-
- for (c=0; c<dmxScreen0->numFBConfigs; c++) {
- __GLXFBConfig *cfg = NULL;
-
- if (numscreens > 1) {
- for (s=1; s<numscreens; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
-
- cfg = FindMatchingFBConfig( &dmxScreen0->fbconfigs[c],
- dmxScreen->fbconfigs,
- dmxScreen->numFBConfigs );
- __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + s + 1 ] = cfg;
- if (!cfg) {
- dmxLog(dmxInfo,"screen0 FBConfig 0x%x is missing on screen#%d\n", dmxScreen0->fbconfigs[c].id, s);
- break;
- }
- else {
- dmxLog(dmxInfo,"screen0 FBConfig 0x%x matched to 0x%x on screen#%d\n", dmxScreen0->fbconfigs[c].id, cfg->id, s);
- }
- }
- }
- else {
- cfg = &dmxScreen0->fbconfigs[c];
- }
-
- if (cfg) {
-
- /* filter out overlay visuals */
- if (cfg->level == 0) {
- __GLXFBConfig *proxy_cfg;
-
- __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + 1 ] =
- &dmxScreen0->fbconfigs[c];
-
- proxy_cfg = malloc( sizeof(__GLXFBConfig) );
- memcpy( proxy_cfg, cfg, sizeof(__GLXFBConfig) );
- proxy_cfg->id = FakeClientID(0);
- /* visual will be associated later in __glXGetFBConfigs */
- proxy_cfg->associatedVisualId = (unsigned int)-1;
-
- __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + 0 ] = proxy_cfg;
-
- __glXNumFBConfigs++;
- }
-
- }
-
- }
+ (strstr(ExtensionsString, "GLX_SGIX_fbconfig"))) {
+
+ /*
+ // Initialize FBConfig info.
+ // find the set of FBConfigs that are present on all back-end
+ // servers - only those configs will be supported
+ */
+ __glXFBConfigs = (__GLXFBConfig **) malloc(dmxScreen0->numFBConfigs *
+ (numscreens +
+ 1) *
+ sizeof(__GLXFBConfig *));
+ __glXNumFBConfigs = 0;
+
+ for (c = 0; c < dmxScreen0->numFBConfigs; c++) {
+ __GLXFBConfig *cfg = NULL;
+
+ if (numscreens > 1) {
+ for (s = 1; s < numscreens; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+
+ cfg = FindMatchingFBConfig(&dmxScreen0->fbconfigs[c],
+ dmxScreen->fbconfigs,
+ dmxScreen->numFBConfigs);
+ __glXFBConfigs[__glXNumFBConfigs * (numscreens + 1) + s +
+ 1] = cfg;
+ if (!cfg) {
+ dmxLog(dmxInfo,
+ "screen0 FBConfig 0x%x is missing on screen#%d\n",
+ dmxScreen0->fbconfigs[c].id, s);
+ break;
+ }
+ else {
+ dmxLog(dmxInfo,
+ "screen0 FBConfig 0x%x matched to 0x%x on screen#%d\n",
+ dmxScreen0->fbconfigs[c].id, cfg->id, s);
+ }
+ }
+ }
+ else {
+ cfg = &dmxScreen0->fbconfigs[c];
+ }
+
+ if (cfg) {
+
+ /* filter out overlay visuals */
+ if (cfg->level == 0) {
+ __GLXFBConfig *proxy_cfg;
+
+ __glXFBConfigs[__glXNumFBConfigs * (numscreens + 1) + 1] =
+ &dmxScreen0->fbconfigs[c];
+
+ proxy_cfg = malloc(sizeof(__GLXFBConfig));
+ memcpy(proxy_cfg, cfg, sizeof(__GLXFBConfig));
+ proxy_cfg->id = FakeClientID(0);
+ /* visual will be associated later in __glXGetFBConfigs */
+ proxy_cfg->associatedVisualId = (unsigned int) -1;
+
+ __glXFBConfigs[__glXNumFBConfigs * (numscreens + 1) + 0] =
+ proxy_cfg;
+
+ __glXNumFBConfigs++;
+ }
+
+ }
+
+ }
}
}
-void __glXScreenReset(void)
+void
+__glXScreenReset(void)
{
- __glXNumActiveScreens = 0;
+ __glXNumActiveScreens = 0;
}
-char *__glXGetServerString( unsigned int name )
+char *
+__glXGetServerString(unsigned int name)
{
- char *ret = NULL;
+ char *ret = NULL;
- switch( name) {
+ switch (name) {
- case GLX_VENDOR:
- ret = GLXServerVendorName;
- break;
+ case GLX_VENDOR:
+ ret = GLXServerVendorName;
+ break;
- case GLX_VERSION:
- ret = GLXServerVersion;
- break;
+ case GLX_VERSION:
+ ret = GLXServerVersion;
+ break;
- case GLX_EXTENSIONS:
- ret = ExtensionsString;
- break;
+ case GLX_EXTENSIONS:
+ ret = ExtensionsString;
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
- return ret;
+ return ret;
}
-int glxIsExtensionSupported( char *ext )
+int
+glxIsExtensionSupported(char *ext)
{
- return( strstr(ExtensionsString, ext) != NULL );
+ return (strstr(ExtensionsString, ext) != NULL);
}
diff --git a/xorg-server/hw/dmx/glxProxy/glxserver.h b/xorg-server/hw/dmx/glxProxy/glxserver.h
index 03e95b865..ad9496619 100644
--- a/xorg-server/hw/dmx/glxProxy/glxserver.h
+++ b/xorg-server/hw/dmx/glxProxy/glxserver.h
@@ -41,8 +41,7 @@
#include <resource.h>
#include <scrnintstr.h>
-
-#define GL_GLEXT_PROTOTYPES /* we want prototypes */
+#define GL_GLEXT_PROTOTYPES /* we want prototypes */
#include <GL/gl.h>
#include <GL/glxproto.h>
#include <GL/glxint.h>
@@ -52,7 +51,6 @@
#include "glxcontext.h"
#include "glxerror.h"
-
#define GLX_SERVER_MAJOR_VERSION 1
#define GLX_SERVER_MINOR_VERSION 3
@@ -84,14 +82,15 @@ extern GLint __glXNumActiveScreens;
** The last context used (from the server's persective) is cached.
*/
extern __GLXcontext *__glXLastContext;
-extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
+extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
+ int *);
/************************************************************************/
typedef struct {
- int elem_size; /* element size in bytes */
- int nelems; /* number of elements to swap */
- void (*swapfunc)(GLbyte *pc);
+ int elem_size; /* element size in bytes */
+ int nelems; /* number of elements to swap */
+ void (*swapfunc) (GLbyte * pc);
} __GLXRenderSwapInfo;
/*
@@ -99,20 +98,20 @@ typedef struct {
*/
struct __GLXclientStateRec {
/*
- ** Whether this structure is currently being used to support a client.
- */
+ ** Whether this structure is currently being used to support a client.
+ */
Bool inUse;
/*
- ** Buffer for returned data.
- */
+ ** Buffer for returned data.
+ */
GLbyte *returnBuf;
GLint returnBufSize;
/*
- ** Keep a list of all the contexts that are current for this client's
- ** threads.
- */
+ ** Keep a list of all the contexts that are current for this client's
+ ** threads.
+ */
__GLXcontext **currentContexts;
DrawablePtr *currentDrawables;
GLint numCurrentContexts;
@@ -124,18 +123,18 @@ struct __GLXclientStateRec {
int GLClientminorVersion;
char *GLClientextensions;
- GLXContextTag *be_currentCTag;
+ GLXContextTag *be_currentCTag;
Display **be_displays;
/*
- ** Keep track of large rendering commands, which span multiple requests.
- */
- GLint largeCmdBytesSoFar; /* bytes received so far */
- GLint largeCmdBytesTotal; /* total bytes expected */
- GLint largeCmdRequestsSoFar; /* requests received so far */
- GLint largeCmdRequestsTotal; /* total requests expected */
- void (*largeCmdRequestsSwapProc)(GLbyte *);
- __GLXRenderSwapInfo *largeCmdRequestsSwap_info;
+ ** Keep track of large rendering commands, which span multiple requests.
+ */
+ GLint largeCmdBytesSoFar; /* bytes received so far */
+ GLint largeCmdBytesTotal; /* total bytes expected */
+ GLint largeCmdRequestsSoFar; /* requests received so far */
+ GLint largeCmdRequestsTotal; /* total requests expected */
+ void (*largeCmdRequestsSwapProc) (GLbyte *);
+ __GLXRenderSwapInfo *largeCmdRequestsSwap_info;
GLbyte *largeCmdBuf;
GLint largeCmdBufSize;
GLint largeCmdMaxReqDataSize;
@@ -149,9 +148,9 @@ extern __GLXclientState *__glXClients[];
/*
** Dispatch tables.
*/
-typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *);
-typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *);
-typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *);
+typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *);
+typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *);
+typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *);
extern __GLXdispatchSingleProcPtr __glXSingleTable[];
extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[];
extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[];
@@ -163,7 +162,7 @@ extern __GLXRenderSwapInfo __glXSwapRenderTable_EXT[];
/*
* Dispatch for GLX commands.
*/
-typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc);
+typedef int (*__GLXprocPtr) (__GLXclientState *, char *pc);
extern __GLXprocPtr __glXProcTable[];
/*
@@ -171,7 +170,7 @@ extern __GLXprocPtr __glXProcTable[];
*/
typedef struct {
int bytes;
- int (*varsize)(GLbyte *pc, Bool swap);
+ int (*varsize) (GLbyte * pc, Bool swap);
} __GLXrenderSizeData;
extern __GLXrenderSizeData __glXRenderSizeTable[];
extern __GLXrenderSizeData __glXRenderSizeTable_EXT[];
@@ -194,37 +193,38 @@ extern RESTYPE __glXPbufferRes;
** Prototypes.
*/
-
extern char *__glXcombine_strings(const char *, const char *);
-extern void __glXDisp_DrawArrays(GLbyte*);
-extern void __glXDispSwap_DrawArrays(GLbyte*);
-
+extern void __glXDisp_DrawArrays(GLbyte *);
+extern void __glXDispSwap_DrawArrays(GLbyte *);
/*
** Routines for sending swapped replies.
*/
-extern void __glXSwapMakeCurrentReply(ClientPtr client,
- xGLXMakeCurrentReadSGIReply *reply);
+extern void __glXSwapMakeCurrentReply(ClientPtr client,
+ xGLXMakeCurrentReadSGIReply * reply);
-extern void __glXSwapIsDirectReply(ClientPtr client,
- xGLXIsDirectReply *reply);
+extern void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply);
extern void __glXSwapQueryVersionReply(ClientPtr client,
- xGLXQueryVersionReply *reply);
+ xGLXQueryVersionReply * reply);
extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
- xGLXQueryContextInfoEXTReply *reply,
- int *buf);
+ xGLXQueryContextInfoEXTReply *
+ reply, int *buf);
extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
- xGLXQueryExtensionsStringReply *reply, char *buf);
+ xGLXQueryExtensionsStringReply *
+ reply, char *buf);
extern void glxSwapQueryServerStringReply(ClientPtr client,
- xGLXQueryServerStringReply *reply, char *buf);
+ xGLXQueryServerStringReply * reply,
+ char *buf);
extern void __glXSwapQueryContextReply(ClientPtr client,
- xGLXQueryContextReply *reply, int *buf);
+ xGLXQueryContextReply * reply, int *buf);
extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
- xGLXGetDrawableAttributesReply *reply, int *buf);
+ xGLXGetDrawableAttributesReply *
+ reply, int *buf);
extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
- xGLXQueryMaxSwapBarriersSGIXReply *reply);
+ xGLXQueryMaxSwapBarriersSGIXReply
+ * reply);
/*
* Routines for computing the size of variably-sized rendering commands.
@@ -232,55 +232,54 @@ extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
extern int __glXTypeSize(GLenum enm);
extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h,
- GLint rowLength, GLint skipRows, GLint alignment);
+ GLint rowLength, GLint skipRows, GLint alignment);
extern int __glXImage3DSize(GLenum format, GLenum type,
- GLsizei w, GLsizei h, GLsizei d,
- GLint imageHeight, GLint rowLength,
- GLint skipImages, GLint skipRows,
- GLint alignment);
-
-extern int __glXCallListsReqSize(GLbyte *pc, Bool swap);
-extern int __glXBitmapReqSize(GLbyte *pc, Bool swap);
-extern int __glXFogfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXFogivReqSize(GLbyte *pc, Bool swap);
-extern int __glXLightfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXLightivReqSize(GLbyte *pc, Bool swap);
-extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap);
-extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap);
-extern int __glXMap1dReqSize(GLbyte *pc, Bool swap);
-extern int __glXMap1fReqSize(GLbyte *pc, Bool swap);
-extern int __glXMap2dReqSize(GLbyte *pc, Bool swap);
-extern int __glXMap2fReqSize(GLbyte *pc, Bool swap);
-extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap);
-extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap);
-extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap);
-extern int __glXDrawArraysSize(GLbyte *pc, Bool swap);
-extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap );
-extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap);
-extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap);
-extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap);
-extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap);
-extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap);
-extern int __glXColorTableReqSize(GLbyte *pc, Bool swap);
-extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap);
-extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap);
+ GLsizei w, GLsizei h, GLsizei d,
+ GLint imageHeight, GLint rowLength,
+ GLint skipImages, GLint skipRows, GLint alignment);
+
+extern int __glXCallListsReqSize(GLbyte * pc, Bool swap);
+extern int __glXBitmapReqSize(GLbyte * pc, Bool swap);
+extern int __glXFogfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXFogivReqSize(GLbyte * pc, Bool swap);
+extern int __glXLightfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXLightivReqSize(GLbyte * pc, Bool swap);
+extern int __glXLightModelfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXLightModelivReqSize(GLbyte * pc, Bool swap);
+extern int __glXMaterialfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXMaterialivReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexParameterfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexParameterivReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexImage1DReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexImage2DReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexEnvfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexEnvivReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexGendvReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexGenfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexGenivReqSize(GLbyte * pc, Bool swap);
+extern int __glXMap1dReqSize(GLbyte * pc, Bool swap);
+extern int __glXMap1fReqSize(GLbyte * pc, Bool swap);
+extern int __glXMap2dReqSize(GLbyte * pc, Bool swap);
+extern int __glXMap2fReqSize(GLbyte * pc, Bool swap);
+extern int __glXPixelMapfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXPixelMapuivReqSize(GLbyte * pc, Bool swap);
+extern int __glXPixelMapusvReqSize(GLbyte * pc, Bool swap);
+extern int __glXDrawPixelsReqSize(GLbyte * pc, Bool swap);
+extern int __glXDrawArraysSize(GLbyte * pc, Bool swap);
+extern int __glXPrioritizeTexturesReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexSubImage1DReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexSubImage2DReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexImage3DReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexSubImage3DReqSize(GLbyte * pc, Bool swap);
+extern int __glXConvolutionFilter1DReqSize(GLbyte * pc, Bool swap);
+extern int __glXConvolutionFilter2DReqSize(GLbyte * pc, Bool swap);
+extern int __glXConvolutionParameterivReqSize(GLbyte * pc, Bool swap);
+extern int __glXConvolutionParameterfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXSeparableFilter2DReqSize(GLbyte * pc, Bool swap);
+extern int __glXColorTableReqSize(GLbyte * pc, Bool swap);
+extern int __glXColorSubTableReqSize(GLbyte * pc, Bool swap);
+extern int __glXColorTableParameterfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXColorTableParameterivReqSize(GLbyte * pc, Bool swap);
/*
* Routines for computing the size of returned data.
@@ -290,8 +289,8 @@ extern int __glXConvolutionParameterfvSize(GLenum pname);
extern int __glXColorTableParameterfvSize(GLenum pname);
extern int __glXColorTableParameterivSize(GLenum pname);
-extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow);
-extern void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer);
+extern void __glXFreeGLXWindow(__glXWindow * pGlxWindow);
+extern void __glXFreeGLXPbuffer(__glXPbuffer * pGlxPbuffer);
extern int __glXVersionMajor;
extern int __glXVersionMinor;
@@ -300,4 +299,4 @@ extern int __glXVersionMinor;
( (__glXVersionMajor > (major)) || \
((__glXVersionMajor == (major)) && (__glXVersionMinor >= (minor))) )
-#endif /* !__GLX_server_h__ */
+#endif /* !__GLX_server_h__ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.c b/xorg-server/hw/dmx/glxProxy/glxsingle.c
index 33cc612a7..63786cf79 100644
--- a/xorg-server/hw/dmx/glxProxy/glxsingle.c
+++ b/xorg-server/hw/dmx/glxProxy/glxsingle.c
@@ -68,7 +68,7 @@
dpy->bufptr += SIZEOF(x##name##Req);\
dpy->request++
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
+#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
#define GetReqSingle(name, req) \
WORD64ALIGN\
if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
@@ -79,100 +79,101 @@
dpy->request++
#endif
-#define X_GLXSingle 0 /* needed by GetReqExtra */
+#define X_GLXSingle 0 /* needed by GetReqExtra */
-extern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
-extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
+extern Display *GetBackEndDisplay(__GLXclientState * cl, int s);
+extern int GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag,
+ int s);
static int swap_vec_element_size = 0;
-static void SendSwappedReply( ClientPtr client,
- xGLXSingleReply *reply,
- char *buf,
- int buf_size )
+static void
+SendSwappedReply(ClientPtr client,
+ xGLXSingleReply * reply, char *buf, int buf_size)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->retval);
- __GLX_SWAP_INT(&reply->size);
-
- if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has single component - need to swap pad3
- */
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(&reply->pad3);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4); /* some requests use also pad4
- * i.e GetConvolutionFilter
- */
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(&reply->pad3);
- }
- }
- else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has vector of elements which needs to be swapped
- */
- int vsize = buf_size / swap_vec_element_size;
- char *p = buf;
- int i;
-
- for (i=0; i<vsize; i++) {
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(p);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(p);
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(p);
- }
-
- p += swap_vec_element_size;
- }
-
- /*
- * swap pad words as well - for case that some single reply uses
- * them as well
- */
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4);
- __GLX_SWAP_INT(&reply->pad5);
- __GLX_SWAP_INT(&reply->pad6);
-
- }
-
- WriteToClient(client, sizeof(xGLXSingleReply),(char *)reply);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->retval);
+ __GLX_SWAP_INT(&reply->size);
+
+ if ((buf_size == 0) && (swap_vec_element_size > 0)) {
+ /*
+ * the reply has single component - need to swap pad3
+ */
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(&reply->pad3);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4); /* some requests use also pad4
+ * i.e GetConvolutionFilter
+ */
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(&reply->pad3);
+ }
+ }
+ else if ((buf_size > 0) && (swap_vec_element_size > 0)) {
+ /*
+ * the reply has vector of elements which needs to be swapped
+ */
+ int vsize = buf_size / swap_vec_element_size;
+ char *p = buf;
+ int i;
+
+ for (i = 0; i < vsize; i++) {
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(p);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(p);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(p);
+ }
+
+ p += swap_vec_element_size;
+ }
+
+ /*
+ * swap pad words as well - for case that some single reply uses
+ * them as well
+ */
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ __GLX_SWAP_INT(&reply->pad5);
+ __GLX_SWAP_INT(&reply->pad6);
+
+ }
+
+ WriteToClient(client, sizeof(xGLXSingleReply), (char *) reply);
if (buf_size > 0)
- WriteToClient(client, buf_size, (char *)buf);
+ WriteToClient(client, buf_size, (char *) buf);
}
-int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardSingleReq(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- xGLXSingleReq *be_req;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+ xGLXSingleReq *be_req;
__GLXcontext *glxc;
- int from_screen = 0;
- int to_screen = 0;
- int buf_size;
- int s;
+ int from_screen = 0;
+ int to_screen = 0;
+ int buf_size;
+ int s;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -182,47 +183,48 @@ int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
/*
* just forward the request to back-end server(s)
*/
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqSingle(GLXSingle,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (req->glxCode == X_GLsop_Flush) {
- XFlush(dpy);
- }
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+
+ LockDisplay(dpy);
+ GetReqSingle(GLXSingle, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (req->glxCode == X_GLsop_Flush) {
+ XFlush(dpy);
+ }
}
return Success;
}
-int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- xGLXSingleReq *be_req;
- xGLXSingleReply reply;
- xGLXSingleReply be_reply;
+ ClientPtr client = cl->client;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+ xGLXSingleReq *be_req;
+ xGLXSingleReply reply;
+ xGLXSingleReply be_reply;
__GLXcontext *glxc;
- int buf_size;
- char *be_buf = NULL;
- int be_buf_size;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return __glXBadContext;
+ return __glXBadContext;
}
pc += sz_xGLXSingleReq;
@@ -235,29 +237,30 @@ int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
* send the request to the first back-end server
*/
LockDisplay(dpy);
- GetReqSingle(GLXSingle,be_req);
+ GetReqSingle(GLXSingle, be_req);
be_req->reqType = dmxScreen->glxMajorOpcode;
be_req->glxCode = req->glxCode;
be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,glxc->pScreen->myNum);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
+ be_req->contextTag =
+ GetCurrentBackEndTag(cl, req->contextTag, glxc->pScreen->myNum);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
/*
* get the reply from the back-end server
*/
- _XReply(dpy, (xReply*) &be_reply, 0, False);
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
be_buf_size = be_reply.length << 2;
if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
+ be_buf = (char *) malloc(be_buf_size);
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
}
UnlockDisplay(dpy);
@@ -275,47 +278,49 @@ int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
reply.pad4 = be_reply.pad4;
if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ SendSwappedReply(client, &reply, be_buf, be_buf_size);
}
else {
- WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
+ WriteToClient(client, sizeof(xGLXSingleReply), (char *) &reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *) be_buf);
}
- if (be_buf_size > 0) free(be_buf);
+ if (be_buf_size > 0)
+ free(be_buf);
return Success;
}
-int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- xGLXSingleReq *be_req;
- xGLXSingleReply reply;
- xGLXSingleReply be_reply;
+ ClientPtr client = cl->client;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+ xGLXSingleReq *be_req;
+ xGLXSingleReply reply;
+ xGLXSingleReply be_reply;
__GLXcontext *glxc;
- int buf_size;
- char *be_buf = NULL;
- int be_buf_size = 0;
- int from_screen = 0;
- int to_screen = 0;
- int s;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size = 0;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -325,42 +330,42 @@ int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
/*
* send the request to the first back-end server(s)
*/
- for (s=to_screen; s>=from_screen; s--) {
- dmxScreen = &dmxScreens[s];
- dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqSingle(GLXSingle,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
-
- /*
- * get the reply from the back-end server
- */
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- be_buf_size = be_reply.length << 2;
- if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (s > from_screen && be_buf_size > 0) {
- free(be_buf);
- }
+ for (s = to_screen; s >= from_screen; s--) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl, s);
+
+ LockDisplay(dpy);
+ GetReqSingle(GLXSingle, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *) malloc(be_buf_size);
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s > from_screen && be_buf_size > 0) {
+ free(be_buf);
+ }
}
/*
@@ -375,380 +380,409 @@ int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
reply.pad4 = be_reply.pad4;
if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ SendSwappedReply(client, &reply, be_buf, be_buf_size);
}
else {
- WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
+ WriteToClient(client, sizeof(xGLXSingleReply), (char *) &reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *) be_buf);
}
- if (be_buf_size > 0) free(be_buf);
+ if (be_buf_size > 0)
+ free(be_buf);
return Success;
}
-int __glXForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXForwardSingleReq( cl, pc ) );
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXForwardSingleReq(cl, pc));
}
-int __glXForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXForwardPipe0WithReply( cl, pc ) );
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXForwardPipe0WithReply(cl, pc));
}
-int __glXForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardPipe0WithReplySwapsv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- swap_vec_element_size = 2;
+ swap_vec_element_size = 2;
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
- return( __glXForwardPipe0WithReply( cl, pc ) );
+ return (__glXForwardPipe0WithReply(cl, pc));
}
-int __glXForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardPipe0WithReplySwapiv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- swap_vec_element_size = 4;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ swap_vec_element_size = 4;
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
- return( __glXForwardPipe0WithReply( cl, pc ) );
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXForwardPipe0WithReply(cl, pc));
}
-int __glXForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardPipe0WithReplySwapdv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- swap_vec_element_size = 8;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ swap_vec_element_size = 8;
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
- return( __glXForwardPipe0WithReply( cl, pc ) );
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXForwardPipe0WithReply(cl, pc));
}
-int __glXForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- swap_vec_element_size = 0;
+ swap_vec_element_size = 0;
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
- return( __glXForwardAllWithReply( cl, pc ) );
+ return (__glXForwardAllWithReply(cl, pc));
}
-int __glXForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- swap_vec_element_size = 2;
+ swap_vec_element_size = 2;
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
- return( __glXForwardAllWithReply( cl, pc ) );
+ return (__glXForwardAllWithReply(cl, pc));
}
-int __glXForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- swap_vec_element_size = 4;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ swap_vec_element_size = 4;
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
- return( __glXForwardAllWithReply( cl, pc ) );
+ return (__glXForwardAllWithReply(cl, pc));
}
-int __glXForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- swap_vec_element_size = 8;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ swap_vec_element_size = 8;
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
- return( __glXForwardAllWithReply( cl, pc ) );
+ return (__glXForwardAllWithReply(cl, pc));
}
-static GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h,
- int *elementbits_return, int *rowbytes_return )
+static GLint
+__glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h,
+ int *elementbits_return, int *rowbytes_return)
{
GLint elements, esize;
GLint rowsize, padding;
if (w < 0 || h < 0) {
- return -1;
+ return -1;
}
switch (format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- case GL_BGR:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_BGRA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return -1;
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ case GL_BGR:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return -1;
}
/*
- ** According to the GLX protocol, each row must be padded to a multiple of
- ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel
- ** store modes of the GL.
- */
+ ** According to the GLX protocol, each row must be padded to a multiple of
+ ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel
+ ** store modes of the GL.
+ */
switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
- rowsize = ((w * elements)+7)/8;
- padding = rowsize % 4;
- if (padding) {
- rowsize += 4 - padding;
- }
- if (elementbits_return) *elementbits_return = elements;
- if (rowbytes_return) *rowbytes_return = rowsize;
- return rowsize * h;
- } else {
- return -1;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return -1;
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+ rowsize = ((w * elements) + 7) / 8;
+ padding = rowsize % 4;
+ if (padding) {
+ rowsize += 4 - padding;
+ }
+ if (elementbits_return)
+ *elementbits_return = elements;
+ if (rowbytes_return)
+ *rowbytes_return = rowsize;
+ return rowsize * h;
+ }
+ else {
+ return -1;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return -1;
}
rowsize = w * elements * esize;
padding = rowsize % 4;
if (padding) {
- rowsize += 4 - padding;
+ rowsize += 4 - padding;
}
- if (elementbits_return) *elementbits_return = esize*elements*8;
- if (rowbytes_return) *rowbytes_return = rowsize;
+ if (elementbits_return)
+ *elementbits_return = esize * elements * 8;
+ if (rowbytes_return)
+ *rowbytes_return = rowsize;
return rowsize * h;
}
-static int intersectRect( int x1, int x2, int y1, int y2,
- int X1, int X2, int Y1, int Y2,
- int *ix1, int *ix2, int *iy1, int *iy2 )
+static int
+intersectRect(int x1, int x2, int y1, int y2,
+ int X1, int X2, int Y1, int Y2,
+ int *ix1, int *ix2, int *iy1, int *iy2)
{
- int right = (x2 < X2 ? x2 : X2);
- int bottom = (y2 < Y2 ? y2 : Y2);
- int left = (x1 > X1 ? x1 : X1);
- int top = (y1 > Y1 ? y1 : Y1);
- int width = right - left + 1;
- int height = bottom - top + 1;
-
- if ( (width <= 0) || (height <= 0) ) {
- *ix1 = *ix2 = *iy1 = *iy2 = 0;
- return 0;
- }
- else {
- *ix1 = left;
- *ix2 = right;
- *iy1 = top;
- *iy2 = bottom;
- return width * height;
- }
+ int right = (x2 < X2 ? x2 : X2);
+ int bottom = (y2 < Y2 ? y2 : Y2);
+ int left = (x1 > X1 ? x1 : X1);
+ int top = (y1 > Y1 ? y1 : Y1);
+ int width = right - left + 1;
+ int height = bottom - top + 1;
+
+ if ((width <= 0) || (height <= 0)) {
+ *ix1 = *ix2 = *iy1 = *iy2 = 0;
+ return 0;
+ }
+ else {
+ *ix1 = left;
+ *ix2 = right;
+ *iy1 = top;
+ *iy2 = bottom;
+ return width * height;
+ }
}
-int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
xGLXSingleReq *be_req;
xGLXReadPixelsReply reply;
xGLXReadPixelsReply be_reply;
GLbyte *be_pc;
- GLint x,y;
+ GLint x, y;
GLsizei width, height;
GLenum format, type;
GLboolean swapBytes, lsbFirst;
@@ -763,254 +797,262 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
int win_x1, win_x2;
int win_y1, win_y2;
int ebits, rowsize;
+
__GLX_DECLARE_SWAP_VARIABLES;
if (client->swapped) {
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->contextTag);
}
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
pc += sz_xGLXSingleReq;
- x = *(GLint *)(pc + 0);
- y = *(GLint *)(pc + 4);
- width = *(GLsizei *)(pc + 8);
- height = *(GLsizei *)(pc + 12);
- format = *(GLenum *)(pc + 16);
- type = *(GLenum *)(pc + 20);
- swapBytes = *(GLboolean *)(pc + 24);
- lsbFirst = *(GLboolean *)(pc + 25);
+ x = *(GLint *) (pc + 0);
+ y = *(GLint *) (pc + 4);
+ width = *(GLsizei *) (pc + 8);
+ height = *(GLsizei *) (pc + 12);
+ format = *(GLenum *) (pc + 16);
+ type = *(GLenum *) (pc + 20);
+ swapBytes = *(GLboolean *) (pc + 24);
+ lsbFirst = *(GLboolean *) (pc + 25);
if (client->swapped) {
- __GLX_SWAP_INT(&x);
- __GLX_SWAP_INT(&y);
- __GLX_SWAP_INT(&width);
- __GLX_SWAP_INT(&height);
- __GLX_SWAP_INT(&format);
- __GLX_SWAP_INT(&type);
- swapBytes = !swapBytes;
+ __GLX_SWAP_INT(&x);
+ __GLX_SWAP_INT(&y);
+ __GLX_SWAP_INT(&width);
+ __GLX_SWAP_INT(&height);
+ __GLX_SWAP_INT(&format);
+ __GLX_SWAP_INT(&type);
+ swapBytes = !swapBytes;
}
- buf_size = __glReadPixels_size(format,type,width,height, &ebits, &rowsize);
+ buf_size =
+ __glReadPixels_size(format, type, width, height, &ebits, &rowsize);
if (buf_size > 0) {
- buf = (char *) malloc( buf_size );
- if ( !buf ) {
- return BadAlloc;
- }
+ buf = (char *) malloc(buf_size);
+ if (!buf) {
+ return BadAlloc;
+ }
}
else {
- buf_size = 0;
- buf = NULL;
+ buf_size = 0;
+ buf = NULL;
}
if (buf_size > 0) {
- /*
- * Get the current drawable this context is bound to
- */
- pDraw = __glXLookupDrawableByTag( cl, req->contextTag );
- win_x1 = pDraw->x + x;
- win_x2 = win_x1 + width - 1;
- win_y1 = (dmxGlobalHeight - pDraw->y - pDraw->height) + y;
- win_y2 = win_y1 + height - 1;
- if (pDraw->type != DRAWABLE_WINDOW) {
- from_screen = to_screen = 0;
- }
-
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- int scr_x1 = dmxScreen->rootXOrigin;
- int scr_x2 = dmxScreen->rootXOrigin + dmxScreen->scrnWidth - 1;
- int scr_y1 = dmxScreen->rootYOrigin;
- int scr_y2 = dmxScreen->rootYOrigin + dmxScreen->scrnHeight - 1;
- int wx1, wx2, wy1, wy2;
- int sx, sy, sw, sh;
- int npixels;
-
- /*
- * find the window portion that is on the current screen
- */
- if (pDraw->type == DRAWABLE_WINDOW) {
- npixels = intersectRect( scr_x1, scr_x2, scr_y1, scr_y2,
- win_x1, win_x2, win_y1, win_y2,
- &wx1, &wx2, &wy1, &wy2 );
- }
- else {
- wx1 = win_x1;
- wx2 = win_x2;
- wy1 = win_y1;
- wy2 = win_y2;
- npixels = (wx2-wx1+1) * (wy2-wy1+1);
- }
-
- if (npixels > 0) {
-
- /* send the request to the back-end server */
- LockDisplay(dpy);
- GetReqExtra(GLXSingle,__GLX_PAD(26),be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLsop_ReadPixels;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- be_pc = ((GLbyte *)(be_req) + sz_xGLXSingleReq);
-
- sx = wx1 - pDraw->x;
- sy = wy1 - (dmxGlobalHeight - pDraw->y - pDraw->height);
- sw = (wx2-wx1+1);
- sh = (wy2-wy1+1);
-
- *(GLint *)(be_pc + 0) = sx; /* x */
- *(GLint *)(be_pc + 4) = sy; /* y */
- *(GLsizei *)(be_pc + 8) = sw; /* width */
- *(GLsizei *)(be_pc + 12) = sh; /* height */
- *(GLenum *)(be_pc + 16) = format;
- *(GLenum *)(be_pc + 20) = type;
- *(GLboolean *)(be_pc + 24) = swapBytes;
- *(GLboolean *)(be_pc + 25) = lsbFirst;
-
- _XReply(dpy, (xReply*) &be_reply, 0, False);
-
- if (be_reply.length > 0) {
- char *be_buf;
- int be_buf_size = be_reply.length << 2;
-
- be_buf = (char *) malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
-
- /* copy pixels data to the right location of the */
- /* reply buffer */
- if ( type != GL_BITMAP ) {
- int pbytes = ebits / 8;
- char *dst = buf + (sy-y)*rowsize + (sx-x)*pbytes;
- char *src = be_buf;
- int pad = (pbytes * sw) % 4;
- int r;
-
- for (r=0; r<sh; r++) {
- memcpy( dst, src, pbytes*sw );
- dst += rowsize;
- src += (pbytes*sw + (pad ? 4-pad : 0) );
- }
- }
- else {
- /* this is a GL_BITMAP pixel type, should copy bits */
- int r;
- int src_rowsize = bits_to_bytes(sw * ebits);
- int src_pad = src_rowsize % 4;
- if ( src_pad ) {
- src_rowsize += (4 - src_pad);
- }
-
- for (r=0; r<sh; r++) {
- unsigned char dst_mask = 0x80 >> (sx % 8);
- unsigned char src_mask = 0x80;
- char *dst = buf + (sy-y+r)*rowsize + (sx-x)/8;
- char *src = be_buf + r*src_rowsize;
- int b;
-
- for (b=0; b<sw*ebits; b++) {
- if ( *src & src_mask ) {
- *dst |= dst_mask;
- }
- else {
- *dst &= ~dst_mask;
- }
-
- if (dst_mask > 1) dst_mask >>= 1;
- else {
- dst_mask = 0x80;
- dst++;
- }
-
- if (src_mask > 1) src_mask >>= 1;
- else {
- src_mask = 0x80;
- src++;
- }
- }
- }
-
- }
-
- free( be_buf );
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- free( buf );
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- } /* of npixels > 0 */
-
- } /* of for loop */
-
- } /* of if buf_size > 0 */
+ /*
+ * Get the current drawable this context is bound to
+ */
+ pDraw = __glXLookupDrawableByTag(cl, req->contextTag);
+ win_x1 = pDraw->x + x;
+ win_x2 = win_x1 + width - 1;
+ win_y1 = (dmxGlobalHeight - pDraw->y - pDraw->height) + y;
+ win_y2 = win_y1 + height - 1;
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ from_screen = to_screen = 0;
+ }
+
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+ int scr_x1 = dmxScreen->rootXOrigin;
+ int scr_x2 = dmxScreen->rootXOrigin + dmxScreen->scrnWidth - 1;
+ int scr_y1 = dmxScreen->rootYOrigin;
+ int scr_y2 = dmxScreen->rootYOrigin + dmxScreen->scrnHeight - 1;
+ int wx1, wx2, wy1, wy2;
+ int sx, sy, sw, sh;
+ int npixels;
+
+ /*
+ * find the window portion that is on the current screen
+ */
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ npixels = intersectRect(scr_x1, scr_x2, scr_y1, scr_y2,
+ win_x1, win_x2, win_y1, win_y2,
+ &wx1, &wx2, &wy1, &wy2);
+ }
+ else {
+ wx1 = win_x1;
+ wx2 = win_x2;
+ wy1 = win_y1;
+ wy2 = win_y2;
+ npixels = (wx2 - wx1 + 1) * (wy2 - wy1 + 1);
+ }
+
+ if (npixels > 0) {
+
+ /* send the request to the back-end server */
+ LockDisplay(dpy);
+ GetReqExtra(GLXSingle, __GLX_PAD(26), be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLsop_ReadPixels;
+ be_req->contextTag =
+ GetCurrentBackEndTag(cl, req->contextTag, s);
+ be_pc = ((GLbyte *) (be_req) + sz_xGLXSingleReq);
+
+ sx = wx1 - pDraw->x;
+ sy = wy1 - (dmxGlobalHeight - pDraw->y - pDraw->height);
+ sw = (wx2 - wx1 + 1);
+ sh = (wy2 - wy1 + 1);
+
+ *(GLint *) (be_pc + 0) = sx; /* x */
+ *(GLint *) (be_pc + 4) = sy; /* y */
+ *(GLsizei *) (be_pc + 8) = sw; /* width */
+ *(GLsizei *) (be_pc + 12) = sh; /* height */
+ *(GLenum *) (be_pc + 16) = format;
+ *(GLenum *) (be_pc + 20) = type;
+ *(GLboolean *) (be_pc + 24) = swapBytes;
+ *(GLboolean *) (be_pc + 25) = lsbFirst;
+
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
+
+ if (be_reply.length > 0) {
+ char *be_buf;
+ int be_buf_size = be_reply.length << 2;
+
+ be_buf = (char *) malloc(be_buf_size);
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+
+ /* copy pixels data to the right location of the */
+ /* reply buffer */
+ if (type != GL_BITMAP) {
+ int pbytes = ebits / 8;
+ char *dst =
+ buf + (sy - y) * rowsize + (sx - x) * pbytes;
+ char *src = be_buf;
+ int pad = (pbytes * sw) % 4;
+ int r;
+
+ for (r = 0; r < sh; r++) {
+ memcpy(dst, src, pbytes * sw);
+ dst += rowsize;
+ src += (pbytes * sw + (pad ? 4 - pad : 0));
+ }
+ }
+ else {
+ /* this is a GL_BITMAP pixel type, should copy bits */
+ int r;
+ int src_rowsize = bits_to_bytes(sw * ebits);
+ int src_pad = src_rowsize % 4;
+
+ if (src_pad) {
+ src_rowsize += (4 - src_pad);
+ }
+
+ for (r = 0; r < sh; r++) {
+ unsigned char dst_mask = 0x80 >> (sx % 8);
+ unsigned char src_mask = 0x80;
+ char *dst =
+ buf + (sy - y + r) * rowsize + (sx - x) / 8;
+ char *src = be_buf + r * src_rowsize;
+ int b;
+
+ for (b = 0; b < sw * ebits; b++) {
+ if (*src & src_mask) {
+ *dst |= dst_mask;
+ }
+ else {
+ *dst &= ~dst_mask;
+ }
+
+ if (dst_mask > 1)
+ dst_mask >>= 1;
+ else {
+ dst_mask = 0x80;
+ dst++;
+ }
+
+ if (src_mask > 1)
+ src_mask >>= 1;
+ else {
+ src_mask = 0x80;
+ src++;
+ }
+ }
+ }
+
+ }
+
+ free(be_buf);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ free(buf);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ } /* of npixels > 0 */
+
+ } /* of for loop */
+
+ } /* of if buf_size > 0 */
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = buf_size >> 2;
if (client->swapped) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
}
- WriteToClient(client, sizeof(xGLXReadPixelsReply),(char *)&reply);
+ WriteToClient(client, sizeof(xGLXReadPixelsReply), (char *) &reply);
if (buf_size > 0) {
- WriteToClient(client, buf_size, (char *)buf);
- free( buf );
+ WriteToClient(client, buf_size, (char *) buf);
+ free(buf);
}
return Success;
}
-int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc)
{
__GLX_DECLARE_SWAP_VARIABLES;
GLbyte *lpc = pc;
lpc += sz_xGLXSingleReq;
- __GLX_SWAP_INT(lpc+0);
- __GLX_SWAP_INT(lpc+4);
- __GLX_SWAP_INT(lpc+8);
- __GLX_SWAP_INT(lpc+12);
+ __GLX_SWAP_INT(lpc + 0);
+ __GLX_SWAP_INT(lpc + 4);
+ __GLX_SWAP_INT(lpc + 8);
+ __GLX_SWAP_INT(lpc + 12);
/* reverse swapBytes */
- *(GLboolean *)(lpc + 16) = ! *(GLboolean *)(lpc + 16);
+ *(GLboolean *) (lpc + 16) = !*(GLboolean *) (lpc + 16);
- return( __glXForwardPipe0WithReplySwap( cl, pc ) );
+ return (__glXForwardPipe0WithReplySwap(cl, pc));
}
-int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc)
{
__GLX_DECLARE_SWAP_VARIABLES;
GLbyte *lpc = pc;
lpc += sz_xGLXSingleReq;
- __GLX_SWAP_INT(lpc+0);
- __GLX_SWAP_INT(lpc+4);
- __GLX_SWAP_INT(lpc+8);
+ __GLX_SWAP_INT(lpc + 0);
+ __GLX_SWAP_INT(lpc + 4);
+ __GLX_SWAP_INT(lpc + 8);
/* reverse swapBytes */
- *(GLboolean *)(lpc + 12) = ! *(GLboolean *)(lpc + 12);
+ *(GLboolean *) (lpc + 12) = !*(GLboolean *) (lpc + 12);
- return( __glXForwardPipe0WithReplySwap( cl, pc ) );
+ return (__glXForwardPipe0WithReplySwap(cl, pc));
}
-
-
diff --git a/xorg-server/hw/dmx/glxProxy/glxswap.c b/xorg-server/hw/dmx/glxProxy/glxswap.c
index 1471d8b5f..87a748621 100644
--- a/xorg-server/hw/dmx/glxProxy/glxswap.c
+++ b/xorg-server/hw/dmx/glxProxy/glxswap.c
@@ -1,538 +1,562 @@
-/*
- * Copyright 2003 Red Hat Inc., Raleigh, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxwindow.h"
-#include "glxserver.h"
-#include "glxswap.h"
-
-extern int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId,
- GLXContextTag tag);
-
-typedef struct _SwapGroup *SwapGroupPtr;
-
-static Bool SwapBarrierIsReadyToSwap(GLuint barrier);
-static void SwapSwapBarrier(GLuint barrier);
-static void UpdateSwapBarrierList(GLuint barrier,
- SwapGroupPtr pOldSwap,
- SwapGroupPtr pNewSwap);
-
-
-/************************************************************************
- *
- * Swap Groups
- *
- ************************************************************************/
-
-typedef struct _SwapGroup {
- WindowPtr pWin;
- SwapGroupPtr pNext;
-
- Bool swapping;
- Bool sleeping;
- GLuint barrier;
-
- XID drawable;
- GLXContextTag tag;
- __GLXclientState *clState;
-} SwapGroupRec;
-
-
-static void SwapSwapGroup(SwapGroupPtr pSwap)
-{
- SwapGroupPtr pCur;
-
- /* All drawables in swap group are ready to swap, so just swap all
- * drawables buffers and then wake up those clients that were
- * previously sleeping */
-
- for (pCur = pSwap; pCur; pCur = pCur->pNext) {
- if (pCur->swapping) {
- /* Swap pCur's buffers */
- __glXDoSwapBuffers(pCur->clState, pCur->drawable, pCur->tag);
- pCur->swapping = FALSE;
- }
-
- /* Wakeup client */
- if (pCur->sleeping) {
- ClientWakeup(pCur->clState->client);
- pCur->sleeping = FALSE;
- }
- }
-}
-
-static Bool SwapGroupIsReadyToSwap(SwapGroupPtr pSwap)
-{
- Bool isReady = TRUE;
-
- /* The swap group is ready to swap when all drawables are ready to
- * swap. NOTE: A drawable is also ready to swap if it is not
- * currently mapped */
- for (; pSwap; pSwap = pSwap->pNext) {
- isReady &= (pSwap->swapping || !pSwap->pWin->mapped);
- /* FIXME: Should we use pSwap->pWin->mapped or ...->realized ??? */
- }
-
- return isReady;
-}
-
-static Bool SGSwapCleanup(ClientPtr client, pointer closure)
-{
- /* SwapGroupPtr pSwap = (SwapGroupPtr)closure; */
-
- /* This should not be called unless the client has died in which
- * case we should remove the buffer from the swap list */
-
- return TRUE;
-}
-
-int SGSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag,
- DrawablePtr pDraw)
-{
- WindowPtr pWin = (WindowPtr)pDraw;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
- SwapGroupPtr pSwap = pWinPriv->swapGroup;
- SwapGroupPtr pCur;
-
- for (pCur = pSwap; pCur && pCur->pWin != pWin; pCur = pCur->pNext);
- if (!pCur)
- return BadDrawable;
-
- pCur->clState = cl;
- pCur->drawable = drawId;
- pCur->tag = tag;
-
- /* We are now in the process of swapping */
- pCur->swapping = TRUE;
-
- if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) {
- /* The swap group is bound to a barrier and the barrier is ready
- * to swap, so swap all the swap groups that are bound to this
- * group's swap barrier */
- SwapSwapBarrier(pSwap->barrier);
- } else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) {
- /* Do the swap if the entire swap group is ready to swap and the
- * group is not bound to a swap barrier */
- SwapSwapGroup(pSwap);
- } else {
- /* The swap group/barrier is not yet ready to swap, so put
- * client to sleep until the rest are ready to swap */
- ClientSleep(cl->client, SGSwapCleanup, (pointer)pWin);
- pCur->sleeping = TRUE;
- }
-
- return Success;
-}
-
-static void SGWindowUnmapped(WindowPtr pWin)
-{
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
- SwapGroupPtr pSwap = pWinPriv->swapGroup;
-
- /* Now that one of the windows in the swap group has been unmapped,
- * see if the entire swap group/barrier is ready to swap */
-
- if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) {
- SwapSwapBarrier(pSwap->barrier);
- } else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) {
- SwapSwapGroup(pSwap);
- }
-}
-
-static void SGWindowDestroyed(WindowPtr pWin)
-{
- JoinSwapGroupSGIX((DrawablePtr)pWin, NULL);
-}
-
-static SwapGroupPtr CreateSwapEntry(WindowPtr pWin)
-{
- SwapGroupPtr pEntry;
-
- /* Allocate new swap group */
- pEntry = malloc(sizeof(*pEntry));
- if (!pEntry) return NULL;
-
- /* Initialize swap group */
- pEntry->pWin = pWin;
- pEntry->pNext = NULL;
- pEntry->swapping = FALSE;
- pEntry->sleeping = FALSE;
- pEntry->barrier = 0;
- /* The following are not initialized until SwapBuffers is called:
- * pEntry->drawable
- * pEntry->tag
- * pEntry->clState
- */
-
- return pEntry;
-}
-
-static void FreeSwapEntry(SwapGroupPtr pEntry)
-{
- /* Since we have removed the drawable from its previous swap group
- * and it won't be added to another swap group, the only thing that
- * we need to do is to make sure that the drawable's client is not
- * sleeping. This could happen if one thread is sleeping, while
- * another thread called glxJoinSwapGroup(). Note that all sleeping
- * threads should also be swapping, but there is a small window in
- * the SGSwapBuffer() logic, above, where swapping can be set but
- * sleeping is not. We check both independently here just to be
- * pedantic. */
-
- /* Handle swap buffer request */
- if (pEntry->swapping)
- __glXDoSwapBuffers(pEntry->clState, pEntry->drawable, pEntry->tag);
-
- /* Wake up client */
- if (pEntry->sleeping)
- ClientWakeup(pEntry->clState->client);
-
- /* We can free the pEntry entry since it has already been removed
- * from the swap group list and it won't be needed any longer */
- free(pEntry);
-}
-
-int JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember)
-{
- if (pDraw->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDraw;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
- SwapGroupPtr pOldSwap = NULL;
- SwapGroupPtr pEntry;
-
- /* If pDraw and pMember are already members of the same swap
- * group, just return Success since there is nothing to do */
- for (pEntry = pWinPriv->swapGroup; pEntry; pEntry = pEntry->pNext)
- if (pEntry->pWin == (WindowPtr)pMember)
- return Success;
-
- /* Remove pDraw from its current swap group */
- if (pWinPriv->swapGroup) {
- SwapGroupPtr pSwapGroup = pWinPriv->swapGroup;
- SwapGroupPtr pPrev;
-
- /* Find old swap entry in swap group and save in pOldSwap
- * for later use */
- for (pOldSwap = pWinPriv->swapGroup, pPrev = NULL;
- pOldSwap && pOldSwap->pWin != pWin;
- pPrev = pOldSwap, pOldSwap = pOldSwap->pNext);
- if (!pOldSwap)
- return BadDrawable;
-
- /* Remove pDraw's swap group entry from swap group list */
- if (pPrev) {
- pPrev->pNext = pOldSwap->pNext;
- } else {
- /* pWin is at the head of the swap group list, so we
- * need to update all other members of this swap
- * group */
- for (pEntry = pOldSwap->pNext; pEntry; pEntry = pEntry->pNext)
- DMX_GET_WINDOW_PRIV(pEntry->pWin)->swapGroup
- = pOldSwap->pNext;
-
- /* Update the barrier list as well */
- if (pOldSwap->barrier)
- UpdateSwapBarrierList(pOldSwap->barrier,
- pOldSwap, pOldSwap->pNext);
-
- /* Set pSwapGroup to point to the swap group without
- * pOldSwap */
- pSwapGroup = pOldSwap->pNext;
- }
-
- /* Check to see if current swap group can now swap since we
- * know at this point that pDraw and pMember are guaranteed
- * to previously be in different swap groups */
- if (pSwapGroup && SwapGroupIsReadyToSwap(pSwapGroup)) {
- SwapSwapGroup(pSwapGroup);
- }
-
- /* Make the old swap entry a standalone group */
- pOldSwap->pNext = NULL;
- pOldSwap->barrier = 0;
-
- /* Reset pWin's swap group */
- pWinPriv->swapGroup = NULL;
- pWinPriv->windowDestroyed = NULL;
- pWinPriv->windowUnmapped = NULL;
- }
-
- if (!pMember || pMember->type != DRAWABLE_WINDOW) {
- /* Free old swap group since it is no longer needed */
- if (pOldSwap) FreeSwapEntry(pOldSwap);
- } else if (pDraw == pMember && pOldSwap) {
- /* Special case where pDraw was previously created and we
- * are now just putting it to its own swap group */
- pWinPriv->swapGroup = pOldSwap;
- pWinPriv->windowDestroyed = SGWindowDestroyed;
- pWinPriv->windowUnmapped = SGWindowUnmapped;
-
- /* Check to see if pDraw is ready to swap */
- if (SwapGroupIsReadyToSwap(pOldSwap))
- SwapSwapGroup(pOldSwap);
- } else if (pMember->type == DRAWABLE_WINDOW) {
- WindowPtr pMemberWin = (WindowPtr)pMember;
- dmxWinPrivPtr pMemberPriv = DMX_GET_WINDOW_PRIV(pMemberWin);
- SwapGroupPtr pMemberSwapGroup = pMemberPriv->swapGroup;
-
- /* Finally, how we can add pDraw to pMember's swap group */
-
- /* If pMember is not currently in a swap group, then create
- * one for it since we are just about to add pDraw to it. */
- if (!pMemberSwapGroup) {
- /* Create new swap group */
- pMemberSwapGroup = CreateSwapEntry(pMemberWin);
- if (!pMemberSwapGroup) {
- if (pOldSwap) FreeSwapEntry(pOldSwap);
- return BadAlloc;
- }
-
- /* Set pMember's swap group */
- pMemberPriv->swapGroup = pMemberSwapGroup;
- pMemberPriv->windowDestroyed = SGWindowDestroyed;
- pMemberPriv->windowUnmapped = SGWindowUnmapped;
- }
-
- /* If pDraw == pMember, that means pDraw was not a member of
- * a group previously (or it would have been handled by the
- * special case above), so no additional work is required
- * since we just created a new swap group for pMember (i.e.,
- * pDraw). */
-
- if (pDraw != pMember) {
- /* If pDraw was not previously in a swap group, then create
- * an entry for it */
- if (!pOldSwap) {
- /* Create new swap group */
- pOldSwap = CreateSwapEntry(pWin);
- if (!pOldSwap) {
- /* If we just created a swap group for pMember, we
- * need to free it here */
- if (pMemberSwapGroup->pNext == NULL) {
- FreeSwapEntry(pMemberSwapGroup);
- pMemberPriv->swapGroup = NULL;
- }
- return BadAlloc;
- }
- }
-
- /* Find last entry in pMember's swap group */
- for (pEntry = pMemberSwapGroup;
- pEntry->pNext;
- pEntry = pEntry->pNext);
-
- /* Add pDraw's swap group entry to pMember's swap group list */
- pEntry->pNext = pOldSwap;
-
- /* Add pDraw to pMember's swap barrier */
- pOldSwap->barrier = pEntry->barrier;
-
- /* Set pDraw's swap group */
- pWinPriv->swapGroup = pMemberSwapGroup;
- pWinPriv->windowDestroyed = SGWindowDestroyed;
- pWinPriv->windowUnmapped = SGWindowUnmapped;
- }
- }
- }
-
- return Success;
-}
-
-
-/************************************************************************
- *
- * Swap Barriers
- *
- ************************************************************************/
-
-#define GLX_MAX_SWAP_BARRIERS 10
-
-typedef struct _SwapBarrier *SwapBarrierPtr;
-typedef struct _SwapBarrier {
- SwapGroupPtr pSwap;
- SwapBarrierPtr pNext;
-} SwapBarrierRec;
-
-static SwapBarrierPtr SwapBarrierList[GLX_MAX_SWAP_BARRIERS+1];
-
-void SwapBarrierInit(void)
-{
- int i;
-
- for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++)
- SwapBarrierList[i] = NULL;
-}
-
-void SwapBarrierReset(void)
-{
- int i;
-
- for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++) {
- SwapBarrierPtr pBarrier, pNextBarrier;
- for (pBarrier = SwapBarrierList[i];
- pBarrier;
- pBarrier = pNextBarrier) {
- pNextBarrier = pBarrier->pNext;
- free(pBarrier);
- }
- SwapBarrierList[i] = NULL;
- }
-}
-
-int QueryMaxSwapBarriersSGIX(int screen)
-{
- return GLX_MAX_SWAP_BARRIERS;
-}
-
-static Bool BindSwapGroupToBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
-{
- SwapBarrierPtr pBarrier;
-
- pBarrier = malloc(sizeof(*pBarrier));
- if (!pBarrier) return FALSE;
-
- /* Add the swap group to barrier's list */
- pBarrier->pSwap = pSwapGroup;
- pBarrier->pNext = SwapBarrierList[barrier];
- SwapBarrierList[barrier] = pBarrier;
-
- return TRUE;
-}
-
-static Bool UnbindSwapGroupFromBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
-{
- SwapBarrierPtr pBarrier, pPrevBarrier;
-
- /* Find the swap group in barrier's list */
- for (pBarrier = SwapBarrierList[barrier], pPrevBarrier = NULL;
- pBarrier && pBarrier->pSwap != pSwapGroup;
- pPrevBarrier = pBarrier, pBarrier = pBarrier->pNext);
- if (!pBarrier) return FALSE;
-
- /* Remove the swap group from barrier's list */
- if (pPrevBarrier) pPrevBarrier->pNext = pBarrier->pNext;
- else SwapBarrierList[barrier] = pBarrier->pNext;
-
- /* Free memory */
- free(pBarrier);
-
- return TRUE;
-}
-
-static void UpdateSwapBarrierList(GLuint barrier,
- SwapGroupPtr pOldSwap,
- SwapGroupPtr pNewSwap)
-{
- SwapBarrierPtr pBarrier;
-
- /* If the old swap group is being destroyed, then we need to remove
- * the swap group from the list entirely */
- if (!pNewSwap) {
- UnbindSwapGroupFromBarrier(barrier, pOldSwap);
- return;
- }
-
- /* Otherwise, find the old swap group in the barrier list and change
- * it to the new swap group */
- for (pBarrier = SwapBarrierList[barrier];
- pBarrier;
- pBarrier = pBarrier->pNext) {
- if (pBarrier->pSwap == pOldSwap) {
- pBarrier->pSwap = pNewSwap;
- return;
- }
- }
-}
-
-static Bool SwapBarrierIsReadyToSwap(GLuint barrier)
-{
- SwapBarrierPtr pBarrier;
- Bool isReady = TRUE;
-
- /* The swap barier is ready to swap when swap groups that are bound
- * to barrier are ready to swap */
- for (pBarrier = SwapBarrierList[barrier];
- pBarrier;
- pBarrier = pBarrier->pNext)
- isReady &= SwapGroupIsReadyToSwap(pBarrier->pSwap);
-
- return isReady;
-}
-
-static void SwapSwapBarrier(GLuint barrier)
-{
- SwapBarrierPtr pBarrier;
-
- /* Swap each group that is a member of this barrier */
- for (pBarrier = SwapBarrierList[barrier];
- pBarrier;
- pBarrier = pBarrier->pNext)
- SwapSwapGroup(pBarrier->pSwap);
-}
-
-int BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier)
-{
- /* FIXME: Check for errors when pDraw->type != DRAWABLE_WINDOW */
-
- if (barrier < 0 || barrier > GLX_MAX_SWAP_BARRIERS)
- return BadValue;
-
- if (pDraw->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDraw;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
- SwapGroupPtr pSwapGroup = pWinPriv->swapGroup;
- SwapGroupPtr pCur;
-
- if (!pSwapGroup) return BadDrawable;
- if (barrier && pSwapGroup->barrier) return BadValue;
-
- /* Update the swap barrier list */
- if (barrier) {
- if (!BindSwapGroupToBarrier(barrier, pSwapGroup))
- return BadAlloc;
- } else {
- if (!UnbindSwapGroupFromBarrier(pSwapGroup->barrier, pSwapGroup))
- return BadDrawable;
- }
-
- /* Set the barrier for each member of this swap group */
- for (pCur = pSwapGroup; pCur; pCur = pCur->pNext)
- pCur->barrier = barrier;
- }
-
- return Success;
-}
+/*
+ * Copyright 2003 Red Hat Inc., Raleigh, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxwindow.h"
+#include "glxserver.h"
+#include "glxswap.h"
+
+extern int __glXDoSwapBuffers(__GLXclientState * cl, XID drawId,
+ GLXContextTag tag);
+
+typedef struct _SwapGroup *SwapGroupPtr;
+
+static Bool SwapBarrierIsReadyToSwap(GLuint barrier);
+static void SwapSwapBarrier(GLuint barrier);
+static void UpdateSwapBarrierList(GLuint barrier,
+ SwapGroupPtr pOldSwap, SwapGroupPtr pNewSwap);
+
+/************************************************************************
+ *
+ * Swap Groups
+ *
+ ************************************************************************/
+
+typedef struct _SwapGroup {
+ WindowPtr pWin;
+ SwapGroupPtr pNext;
+
+ Bool swapping;
+ Bool sleeping;
+ GLuint barrier;
+
+ XID drawable;
+ GLXContextTag tag;
+ __GLXclientState *clState;
+} SwapGroupRec;
+
+static void
+SwapSwapGroup(SwapGroupPtr pSwap)
+{
+ SwapGroupPtr pCur;
+
+ /* All drawables in swap group are ready to swap, so just swap all
+ * drawables buffers and then wake up those clients that were
+ * previously sleeping */
+
+ for (pCur = pSwap; pCur; pCur = pCur->pNext) {
+ if (pCur->swapping) {
+ /* Swap pCur's buffers */
+ __glXDoSwapBuffers(pCur->clState, pCur->drawable, pCur->tag);
+ pCur->swapping = FALSE;
+ }
+
+ /* Wakeup client */
+ if (pCur->sleeping) {
+ ClientWakeup(pCur->clState->client);
+ pCur->sleeping = FALSE;
+ }
+ }
+}
+
+static Bool
+SwapGroupIsReadyToSwap(SwapGroupPtr pSwap)
+{
+ Bool isReady = TRUE;
+
+ /* The swap group is ready to swap when all drawables are ready to
+ * swap. NOTE: A drawable is also ready to swap if it is not
+ * currently mapped */
+ for (; pSwap; pSwap = pSwap->pNext) {
+ isReady &= (pSwap->swapping || !pSwap->pWin->mapped);
+ /* FIXME: Should we use pSwap->pWin->mapped or ...->realized ??? */
+ }
+
+ return isReady;
+}
+
+static Bool
+SGSwapCleanup(ClientPtr client, pointer closure)
+{
+ /* SwapGroupPtr pSwap = (SwapGroupPtr)closure; */
+
+ /* This should not be called unless the client has died in which
+ * case we should remove the buffer from the swap list */
+
+ return TRUE;
+}
+
+int
+SGSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag,
+ DrawablePtr pDraw)
+{
+ WindowPtr pWin = (WindowPtr) pDraw;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pSwap = pWinPriv->swapGroup;
+ SwapGroupPtr pCur;
+
+ for (pCur = pSwap; pCur && pCur->pWin != pWin; pCur = pCur->pNext);
+ if (!pCur)
+ return BadDrawable;
+
+ pCur->clState = cl;
+ pCur->drawable = drawId;
+ pCur->tag = tag;
+
+ /* We are now in the process of swapping */
+ pCur->swapping = TRUE;
+
+ if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) {
+ /* The swap group is bound to a barrier and the barrier is ready
+ * to swap, so swap all the swap groups that are bound to this
+ * group's swap barrier */
+ SwapSwapBarrier(pSwap->barrier);
+ }
+ else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) {
+ /* Do the swap if the entire swap group is ready to swap and the
+ * group is not bound to a swap barrier */
+ SwapSwapGroup(pSwap);
+ }
+ else {
+ /* The swap group/barrier is not yet ready to swap, so put
+ * client to sleep until the rest are ready to swap */
+ ClientSleep(cl->client, SGSwapCleanup, (pointer) pWin);
+ pCur->sleeping = TRUE;
+ }
+
+ return Success;
+}
+
+static void
+SGWindowUnmapped(WindowPtr pWin)
+{
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pSwap = pWinPriv->swapGroup;
+
+ /* Now that one of the windows in the swap group has been unmapped,
+ * see if the entire swap group/barrier is ready to swap */
+
+ if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) {
+ SwapSwapBarrier(pSwap->barrier);
+ }
+ else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) {
+ SwapSwapGroup(pSwap);
+ }
+}
+
+static void
+SGWindowDestroyed(WindowPtr pWin)
+{
+ JoinSwapGroupSGIX((DrawablePtr) pWin, NULL);
+}
+
+static SwapGroupPtr
+CreateSwapEntry(WindowPtr pWin)
+{
+ SwapGroupPtr pEntry;
+
+ /* Allocate new swap group */
+ pEntry = malloc(sizeof(*pEntry));
+ if (!pEntry)
+ return NULL;
+
+ /* Initialize swap group */
+ pEntry->pWin = pWin;
+ pEntry->pNext = NULL;
+ pEntry->swapping = FALSE;
+ pEntry->sleeping = FALSE;
+ pEntry->barrier = 0;
+ /* The following are not initialized until SwapBuffers is called:
+ * pEntry->drawable
+ * pEntry->tag
+ * pEntry->clState
+ */
+
+ return pEntry;
+}
+
+static void
+FreeSwapEntry(SwapGroupPtr pEntry)
+{
+ /* Since we have removed the drawable from its previous swap group
+ * and it won't be added to another swap group, the only thing that
+ * we need to do is to make sure that the drawable's client is not
+ * sleeping. This could happen if one thread is sleeping, while
+ * another thread called glxJoinSwapGroup(). Note that all sleeping
+ * threads should also be swapping, but there is a small window in
+ * the SGSwapBuffer() logic, above, where swapping can be set but
+ * sleeping is not. We check both independently here just to be
+ * pedantic. */
+
+ /* Handle swap buffer request */
+ if (pEntry->swapping)
+ __glXDoSwapBuffers(pEntry->clState, pEntry->drawable, pEntry->tag);
+
+ /* Wake up client */
+ if (pEntry->sleeping)
+ ClientWakeup(pEntry->clState->client);
+
+ /* We can free the pEntry entry since it has already been removed
+ * from the swap group list and it won't be needed any longer */
+ free(pEntry);
+}
+
+int
+JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember)
+{
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDraw;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pOldSwap = NULL;
+ SwapGroupPtr pEntry;
+
+ /* If pDraw and pMember are already members of the same swap
+ * group, just return Success since there is nothing to do */
+ for (pEntry = pWinPriv->swapGroup; pEntry; pEntry = pEntry->pNext)
+ if (pEntry->pWin == (WindowPtr) pMember)
+ return Success;
+
+ /* Remove pDraw from its current swap group */
+ if (pWinPriv->swapGroup) {
+ SwapGroupPtr pSwapGroup = pWinPriv->swapGroup;
+ SwapGroupPtr pPrev;
+
+ /* Find old swap entry in swap group and save in pOldSwap
+ * for later use */
+ for (pOldSwap = pWinPriv->swapGroup, pPrev = NULL;
+ pOldSwap && pOldSwap->pWin != pWin;
+ pPrev = pOldSwap, pOldSwap = pOldSwap->pNext);
+ if (!pOldSwap)
+ return BadDrawable;
+
+ /* Remove pDraw's swap group entry from swap group list */
+ if (pPrev) {
+ pPrev->pNext = pOldSwap->pNext;
+ }
+ else {
+ /* pWin is at the head of the swap group list, so we
+ * need to update all other members of this swap
+ * group */
+ for (pEntry = pOldSwap->pNext; pEntry; pEntry = pEntry->pNext)
+ DMX_GET_WINDOW_PRIV(pEntry->pWin)->swapGroup
+ = pOldSwap->pNext;
+
+ /* Update the barrier list as well */
+ if (pOldSwap->barrier)
+ UpdateSwapBarrierList(pOldSwap->barrier,
+ pOldSwap, pOldSwap->pNext);
+
+ /* Set pSwapGroup to point to the swap group without
+ * pOldSwap */
+ pSwapGroup = pOldSwap->pNext;
+ }
+
+ /* Check to see if current swap group can now swap since we
+ * know at this point that pDraw and pMember are guaranteed
+ * to previously be in different swap groups */
+ if (pSwapGroup && SwapGroupIsReadyToSwap(pSwapGroup)) {
+ SwapSwapGroup(pSwapGroup);
+ }
+
+ /* Make the old swap entry a standalone group */
+ pOldSwap->pNext = NULL;
+ pOldSwap->barrier = 0;
+
+ /* Reset pWin's swap group */
+ pWinPriv->swapGroup = NULL;
+ pWinPriv->windowDestroyed = NULL;
+ pWinPriv->windowUnmapped = NULL;
+ }
+
+ if (!pMember || pMember->type != DRAWABLE_WINDOW) {
+ /* Free old swap group since it is no longer needed */
+ if (pOldSwap)
+ FreeSwapEntry(pOldSwap);
+ }
+ else if (pDraw == pMember && pOldSwap) {
+ /* Special case where pDraw was previously created and we
+ * are now just putting it to its own swap group */
+ pWinPriv->swapGroup = pOldSwap;
+ pWinPriv->windowDestroyed = SGWindowDestroyed;
+ pWinPriv->windowUnmapped = SGWindowUnmapped;
+
+ /* Check to see if pDraw is ready to swap */
+ if (SwapGroupIsReadyToSwap(pOldSwap))
+ SwapSwapGroup(pOldSwap);
+ }
+ else if (pMember->type == DRAWABLE_WINDOW) {
+ WindowPtr pMemberWin = (WindowPtr) pMember;
+ dmxWinPrivPtr pMemberPriv = DMX_GET_WINDOW_PRIV(pMemberWin);
+ SwapGroupPtr pMemberSwapGroup = pMemberPriv->swapGroup;
+
+ /* Finally, how we can add pDraw to pMember's swap group */
+
+ /* If pMember is not currently in a swap group, then create
+ * one for it since we are just about to add pDraw to it. */
+ if (!pMemberSwapGroup) {
+ /* Create new swap group */
+ pMemberSwapGroup = CreateSwapEntry(pMemberWin);
+ if (!pMemberSwapGroup) {
+ if (pOldSwap)
+ FreeSwapEntry(pOldSwap);
+ return BadAlloc;
+ }
+
+ /* Set pMember's swap group */
+ pMemberPriv->swapGroup = pMemberSwapGroup;
+ pMemberPriv->windowDestroyed = SGWindowDestroyed;
+ pMemberPriv->windowUnmapped = SGWindowUnmapped;
+ }
+
+ /* If pDraw == pMember, that means pDraw was not a member of
+ * a group previously (or it would have been handled by the
+ * special case above), so no additional work is required
+ * since we just created a new swap group for pMember (i.e.,
+ * pDraw). */
+
+ if (pDraw != pMember) {
+ /* If pDraw was not previously in a swap group, then create
+ * an entry for it */
+ if (!pOldSwap) {
+ /* Create new swap group */
+ pOldSwap = CreateSwapEntry(pWin);
+ if (!pOldSwap) {
+ /* If we just created a swap group for pMember, we
+ * need to free it here */
+ if (pMemberSwapGroup->pNext == NULL) {
+ FreeSwapEntry(pMemberSwapGroup);
+ pMemberPriv->swapGroup = NULL;
+ }
+ return BadAlloc;
+ }
+ }
+
+ /* Find last entry in pMember's swap group */
+ for (pEntry = pMemberSwapGroup;
+ pEntry->pNext; pEntry = pEntry->pNext);
+
+ /* Add pDraw's swap group entry to pMember's swap group list */
+ pEntry->pNext = pOldSwap;
+
+ /* Add pDraw to pMember's swap barrier */
+ pOldSwap->barrier = pEntry->barrier;
+
+ /* Set pDraw's swap group */
+ pWinPriv->swapGroup = pMemberSwapGroup;
+ pWinPriv->windowDestroyed = SGWindowDestroyed;
+ pWinPriv->windowUnmapped = SGWindowUnmapped;
+ }
+ }
+ }
+
+ return Success;
+}
+
+/************************************************************************
+ *
+ * Swap Barriers
+ *
+ ************************************************************************/
+
+#define GLX_MAX_SWAP_BARRIERS 10
+
+typedef struct _SwapBarrier *SwapBarrierPtr;
+typedef struct _SwapBarrier {
+ SwapGroupPtr pSwap;
+ SwapBarrierPtr pNext;
+} SwapBarrierRec;
+
+static SwapBarrierPtr SwapBarrierList[GLX_MAX_SWAP_BARRIERS + 1];
+
+void
+SwapBarrierInit(void)
+{
+ int i;
+
+ for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++)
+ SwapBarrierList[i] = NULL;
+}
+
+void
+SwapBarrierReset(void)
+{
+ int i;
+
+ for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++) {
+ SwapBarrierPtr pBarrier, pNextBarrier;
+
+ for (pBarrier = SwapBarrierList[i]; pBarrier; pBarrier = pNextBarrier) {
+ pNextBarrier = pBarrier->pNext;
+ free(pBarrier);
+ }
+ SwapBarrierList[i] = NULL;
+ }
+}
+
+int
+QueryMaxSwapBarriersSGIX(int screen)
+{
+ return GLX_MAX_SWAP_BARRIERS;
+}
+
+static Bool
+BindSwapGroupToBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
+{
+ SwapBarrierPtr pBarrier;
+
+ pBarrier = malloc(sizeof(*pBarrier));
+ if (!pBarrier)
+ return FALSE;
+
+ /* Add the swap group to barrier's list */
+ pBarrier->pSwap = pSwapGroup;
+ pBarrier->pNext = SwapBarrierList[barrier];
+ SwapBarrierList[barrier] = pBarrier;
+
+ return TRUE;
+}
+
+static Bool
+UnbindSwapGroupFromBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
+{
+ SwapBarrierPtr pBarrier, pPrevBarrier;
+
+ /* Find the swap group in barrier's list */
+ for (pBarrier = SwapBarrierList[barrier], pPrevBarrier = NULL;
+ pBarrier && pBarrier->pSwap != pSwapGroup;
+ pPrevBarrier = pBarrier, pBarrier = pBarrier->pNext);
+ if (!pBarrier)
+ return FALSE;
+
+ /* Remove the swap group from barrier's list */
+ if (pPrevBarrier)
+ pPrevBarrier->pNext = pBarrier->pNext;
+ else
+ SwapBarrierList[barrier] = pBarrier->pNext;
+
+ /* Free memory */
+ free(pBarrier);
+
+ return TRUE;
+}
+
+static void
+UpdateSwapBarrierList(GLuint barrier,
+ SwapGroupPtr pOldSwap, SwapGroupPtr pNewSwap)
+{
+ SwapBarrierPtr pBarrier;
+
+ /* If the old swap group is being destroyed, then we need to remove
+ * the swap group from the list entirely */
+ if (!pNewSwap) {
+ UnbindSwapGroupFromBarrier(barrier, pOldSwap);
+ return;
+ }
+
+ /* Otherwise, find the old swap group in the barrier list and change
+ * it to the new swap group */
+ for (pBarrier = SwapBarrierList[barrier];
+ pBarrier; pBarrier = pBarrier->pNext) {
+ if (pBarrier->pSwap == pOldSwap) {
+ pBarrier->pSwap = pNewSwap;
+ return;
+ }
+ }
+}
+
+static Bool
+SwapBarrierIsReadyToSwap(GLuint barrier)
+{
+ SwapBarrierPtr pBarrier;
+ Bool isReady = TRUE;
+
+ /* The swap barier is ready to swap when swap groups that are bound
+ * to barrier are ready to swap */
+ for (pBarrier = SwapBarrierList[barrier];
+ pBarrier; pBarrier = pBarrier->pNext)
+ isReady &= SwapGroupIsReadyToSwap(pBarrier->pSwap);
+
+ return isReady;
+}
+
+static void
+SwapSwapBarrier(GLuint barrier)
+{
+ SwapBarrierPtr pBarrier;
+
+ /* Swap each group that is a member of this barrier */
+ for (pBarrier = SwapBarrierList[barrier];
+ pBarrier; pBarrier = pBarrier->pNext)
+ SwapSwapGroup(pBarrier->pSwap);
+}
+
+int
+BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier)
+{
+ /* FIXME: Check for errors when pDraw->type != DRAWABLE_WINDOW */
+
+ if (barrier < 0 || barrier > GLX_MAX_SWAP_BARRIERS)
+ return BadValue;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDraw;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pSwapGroup = pWinPriv->swapGroup;
+ SwapGroupPtr pCur;
+
+ if (!pSwapGroup)
+ return BadDrawable;
+ if (barrier && pSwapGroup->barrier)
+ return BadValue;
+
+ /* Update the swap barrier list */
+ if (barrier) {
+ if (!BindSwapGroupToBarrier(barrier, pSwapGroup))
+ return BadAlloc;
+ }
+ else {
+ if (!UnbindSwapGroupFromBarrier(pSwapGroup->barrier, pSwapGroup))
+ return BadDrawable;
+ }
+
+ /* Set the barrier for each member of this swap group */
+ for (pCur = pSwapGroup; pCur; pCur = pCur->pNext)
+ pCur->barrier = barrier;
+ }
+
+ return Success;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.c b/xorg-server/hw/dmx/glxProxy/glxutil.c
index 1b9ad6962..f90dbf141 100644
--- a/xorg-server/hw/dmx/glxProxy/glxutil.c
+++ b/xorg-server/hw/dmx/glxProxy/glxutil.c
@@ -1,34 +1,37 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#include "glxserver.h"
-#include "glxutil.h"
-
-void __glXNop(void) {}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#include "glxserver.h"
+#include "glxutil.h"
+
+void
+__glXNop(void)
+{
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.h b/xorg-server/hw/dmx/glxProxy/glxutil.h
index 15237b258..d3c72862d 100644
--- a/xorg-server/hw/dmx/glxProxy/glxutil.h
+++ b/xorg-server/hw/dmx/glxProxy/glxutil.h
@@ -1,42 +1,41 @@
-#ifndef _glxcmds_h_
-#define _glxcmds_h_
-
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-extern void __glXNop(void);
-
-/* context helper routines */
-extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);
-extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag);
-
-
-#endif /* _glxcmds_h_ */
-
+#ifndef _glxcmds_h_
+#define _glxcmds_h_
+
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+extern void __glXNop(void);
+
+/* context helper routines */
+extern __GLXcontext *__glXLookupContextByTag(__GLXclientState *, GLXContextTag);
+extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState * cl,
+ GLXContextTag tag);
+
+#endif /* _glxcmds_h_ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.c b/xorg-server/hw/dmx/glxProxy/glxvendor.c
index 0b6ba4134..963c92e87 100644
--- a/xorg-server/hw/dmx/glxProxy/glxvendor.c
+++ b/xorg-server/hw/dmx/glxProxy/glxvendor.c
@@ -67,7 +67,7 @@
dpy->bufptr += SIZEOF(x##name##Req);\
dpy->request++
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
+#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
#define GetReqVendorPrivate(name, req) \
WORD64ALIGN\
if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
@@ -78,92 +78,93 @@
dpy->request++
#endif
-extern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
-extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
+extern Display *GetBackEndDisplay(__GLXclientState * cl, int s);
+extern int GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag,
+ int s);
static int swap_vec_element_size = 0;
-static void SendSwappedReply( ClientPtr client,
- xGLXVendorPrivReply *reply,
- char *buf,
- int buf_size )
+static void
+SendSwappedReply(ClientPtr client,
+ xGLXVendorPrivReply * reply, char *buf, int buf_size)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->retval);
- __GLX_SWAP_INT(&reply->size);
-
- if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has single component - need to swap pad3
- */
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(&reply->pad3);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4);
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(&reply->pad3);
- }
- }
- else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has vector of elements which needs to be swapped
- */
- int vsize = buf_size / swap_vec_element_size;
- char *p = buf;
- int i;
-
- for (i=0; i<vsize; i++) {
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(p);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(p);
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(p);
- }
-
- p += swap_vec_element_size;
- }
-
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4);
- __GLX_SWAP_INT(&reply->pad5);
- __GLX_SWAP_INT(&reply->pad6);
-
- }
-
- WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)reply);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->retval);
+ __GLX_SWAP_INT(&reply->size);
+
+ if ((buf_size == 0) && (swap_vec_element_size > 0)) {
+ /*
+ * the reply has single component - need to swap pad3
+ */
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(&reply->pad3);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(&reply->pad3);
+ }
+ }
+ else if ((buf_size > 0) && (swap_vec_element_size > 0)) {
+ /*
+ * the reply has vector of elements which needs to be swapped
+ */
+ int vsize = buf_size / swap_vec_element_size;
+ char *p = buf;
+ int i;
+
+ for (i = 0; i < vsize; i++) {
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(p);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(p);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(p);
+ }
+
+ p += swap_vec_element_size;
+ }
+
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ __GLX_SWAP_INT(&reply->pad5);
+ __GLX_SWAP_INT(&reply->pad6);
+
+ }
+
+ WriteToClient(client, sizeof(xGLXVendorPrivReply), (char *) reply);
if (buf_size > 0)
- WriteToClient(client, buf_size, (char *)buf);
+ WriteToClient(client, buf_size, (char *) buf);
}
-int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardSingleReq(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- xGLXVendorPrivateReq *be_req;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ xGLXVendorPrivateReq *be_req;
__GLXcontext *glxc;
- int from_screen = 0;
- int to_screen = 0;
- int buf_size;
- int s;
+ int from_screen = 0;
+ int to_screen = 0;
+ int buf_size;
+ int s;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -173,43 +174,44 @@ int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
/*
* just forward the request to back-end server(s)
*/
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqVendorPrivate(GLXVendorPrivate,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->vendorCode = req->vendorCode;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
- UnlockDisplay(dpy);
- SyncHandle();
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+
+ LockDisplay(dpy);
+ GetReqVendorPrivate(GLXVendorPrivate, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->vendorCode = req->vendorCode;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
}
-int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- xGLXVendorPrivateReq *be_req;
- xGLXVendorPrivReply reply;
- xGLXVendorPrivReply be_reply;
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ xGLXVendorPrivateReq *be_req;
+ xGLXVendorPrivReply reply;
+ xGLXVendorPrivReply be_reply;
__GLXcontext *glxc;
- int buf_size;
- char *be_buf = NULL;
- int be_buf_size;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return __glXBadContext;
+ return __glXBadContext;
}
pc += sz_xGLXVendorPrivateReq;
@@ -222,30 +224,31 @@ int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
* send the request to the first back-end server
*/
LockDisplay(dpy);
- GetReqVendorPrivate(GLXVendorPrivate,be_req);
+ GetReqVendorPrivate(GLXVendorPrivate, be_req);
be_req->reqType = dmxScreen->glxMajorOpcode;
be_req->glxCode = req->glxCode;
be_req->length = req->length;
be_req->vendorCode = req->vendorCode;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag, glxc->pScreen->myNum);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
+ be_req->contextTag =
+ GetCurrentBackEndTag(cl, req->contextTag, glxc->pScreen->myNum);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
/*
* get the reply from the back-end server
*/
- _XReply(dpy, (xReply*) &be_reply, 0, False);
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
be_buf_size = be_reply.length << 2;
if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
+ be_buf = (char *) malloc(be_buf_size);
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
}
UnlockDisplay(dpy);
@@ -254,52 +257,54 @@ int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
/*
* send the reply to the client
*/
- memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
+ memcpy(&reply, &be_reply, sz_xGLXVendorPrivReply);
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ SendSwappedReply(client, &reply, be_buf, be_buf_size);
}
else {
- WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
+ WriteToClient(client, sizeof(xGLXVendorPrivReply), (char *) &reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *) be_buf);
}
- if (be_buf_size > 0) free(be_buf);
+ if (be_buf_size > 0)
+ free(be_buf);
return Success;
}
-int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- xGLXVendorPrivateReq *be_req;
- xGLXVendorPrivReply reply;
- xGLXVendorPrivReply be_reply;
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ xGLXVendorPrivateReq *be_req;
+ xGLXVendorPrivReply reply;
+ xGLXVendorPrivReply be_reply;
__GLXcontext *glxc;
- int buf_size;
- char *be_buf = NULL;
- int be_buf_size = 0;
- int from_screen = 0;
- int to_screen = 0;
- int s;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size = 0;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -309,277 +314,303 @@ int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
/*
* send the request to the first back-end server(s)
*/
- for (s=to_screen; s>=from_screen; s--) {
- dmxScreen = &dmxScreens[s];
- dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqVendorPrivate(GLXVendorPrivate,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->vendorCode = req->vendorCode;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
-
- /*
- * get the reply from the back-end server
- */
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- be_buf_size = be_reply.length << 2;
- if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (s > from_screen && be_buf_size > 0) {
- free(be_buf);
- }
+ for (s = to_screen; s >= from_screen; s--) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl, s);
+
+ LockDisplay(dpy);
+ GetReqVendorPrivate(GLXVendorPrivate, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->vendorCode = req->vendorCode;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *) malloc(be_buf_size);
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s > from_screen && be_buf_size > 0) {
+ free(be_buf);
+ }
}
/*
* send the reply to the client
*/
- memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
+ memcpy(&reply, &be_reply, sz_xGLXVendorPrivReply);
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ SendSwappedReply(client, &reply, be_buf, be_buf_size);
}
else {
- WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
+ WriteToClient(client, sizeof(xGLXVendorPrivReply), (char *) &reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *) be_buf);
}
- if (be_buf_size > 0) free(be_buf);
+ if (be_buf_size > 0)
+ free(be_buf);
return Success;
}
-int __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
- swap_vec_element_size = 0;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
- return( __glXVForwardSingleReq( cl, pc ) );
+ swap_vec_element_size = 0;
+
+ return (__glXVForwardSingleReq(cl, pc));
}
-int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardPipe0WithReply(cl, pc));
}
-int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardPipe0WithReplySwapsv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 2;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardPipe0WithReply(cl, pc));
}
-int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardPipe0WithReplySwapiv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 4;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardPipe0WithReply(cl, pc));
}
-int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardPipe0WithReplySwapdv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 8;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardPipe0WithReply(cl, pc));
}
-int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardAllWithReply(cl, pc));
}
-int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 2;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardAllWithReply(cl, pc));
}
-int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 4;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardAllWithReply(cl, pc));
}
-int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 8;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
-}
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardAllWithReply(cl, pc));
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.h b/xorg-server/hw/dmx/glxProxy/glxvendor.h
index fbc901cef..0d160ab9f 100644
--- a/xorg-server/hw/dmx/glxProxy/glxvendor.h
+++ b/xorg-server/hw/dmx/glxProxy/glxvendor.h
@@ -31,20 +31,23 @@
#ifndef __GLXVENDOR_H
#define __GLXVENDOR_H
-extern int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardSingleReq(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardAllWithReply(__GLXclientState * cl, GLbyte * pc);
-extern int __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc);
-extern int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardPipe0WithReplySwapsv(__GLXclientState * cl,
+ GLbyte * pc);
+extern int __glXVForwardPipe0WithReplySwapiv(__GLXclientState * cl,
+ GLbyte * pc);
+extern int __glXVForwardPipe0WithReplySwapdv(__GLXclientState * cl,
+ GLbyte * pc);
-extern int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc);
#endif
diff --git a/xorg-server/hw/dmx/glxProxy/glxvisuals.c b/xorg-server/hw/dmx/glxProxy/glxvisuals.c
index ae5e86772..3fca04f0d 100644
--- a/xorg-server/hw/dmx/glxProxy/glxvisuals.c
+++ b/xorg-server/hw/dmx/glxProxy/glxvisuals.c
@@ -1,152 +1,158 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "glxserver.h"
-#include "glxvisuals.h"
-
-int glxVisualsMatch( __GLXvisualConfig *v1, __GLXvisualConfig *v2 )
-{
- if ( (v1->class == v2->class) &&
- (v1->rgba == v2->rgba) &&
- (v1->redSize == v2->redSize) &&
- (v1->greenSize == v2->greenSize) &&
- (v1->blueSize == v2->blueSize) &&
- (v1->alphaSize == v2->alphaSize) &&
- (v1->redMask == v2->redMask) &&
- (v1->greenMask == v2->greenMask) &&
- (v1->blueMask == v2->blueMask) &&
- (v1->alphaMask == v2->alphaMask) &&
- (v1->accumRedSize == v2->accumRedSize) &&
- (v1->accumGreenSize == v2->accumGreenSize) &&
- (v1->accumBlueSize == v2->accumBlueSize) &&
- (v1->accumAlphaSize == v2->accumAlphaSize) &&
- (v1->doubleBuffer == v2->doubleBuffer) &&
- (v1->stereo == v2->stereo) &&
- (v1->bufferSize == v2->bufferSize) &&
- (v1->depthSize == v2->depthSize) &&
- (v1->stencilSize == v2->stencilSize) &&
- (v1->auxBuffers == v2->auxBuffers) &&
- (v1->level == v2->level) &&
- (v1->visualRating == v2->visualRating) &&
- (v1->transparentPixel == v2->transparentPixel) &&
- (v1->transparentRed == v2->transparentRed) &&
- (v1->transparentGreen == v2->transparentGreen) &&
- (v1->transparentBlue == v2->transparentBlue) &&
- (v1->transparentAlpha == v2->transparentAlpha) &&
- (v1->transparentIndex == v2->transparentIndex) &&
- (v1->multiSampleSize == v2->multiSampleSize) &&
- (v1->nMultiSampleBuffers == v2->nMultiSampleBuffers) &&
- (v1->visualSelectGroup == v2->visualSelectGroup) ) {
-
- return 1;
-
- }
-
- return 0;
-
-}
-
-VisualID glxMatchGLXVisualInConfigList( __GLXvisualConfig *pGlxVisual, __GLXvisualConfig *configs, int nconfigs )
-{
- int i;
-
- for (i=0; i<nconfigs; i++) {
-
- if (glxVisualsMatch( pGlxVisual, &configs[i] )) {
-
- return configs[i].vid;
-
- }
- }
-
- return 0;
-}
-
-VisualID glxMatchVisualInConfigList( ScreenPtr pScreen, VisualPtr pVisual, __GLXvisualConfig *configs, int nconfigs )
-{
- __GLXscreenInfo *pGlxScreen;
- __GLXvisualConfig *pGlxVisual;
- int i;
-
- /* check that the glx extension has been initialized */
- if ( !__glXActiveScreens )
- return 0;
-
- pGlxScreen = &__glXActiveScreens[pScreen->myNum];
- pGlxVisual = pGlxScreen->pGlxVisual;
-
- /* find the glx visual info for pVisual */
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == pVisual->vid) {
- break;
- }
- }
- if (i == pGlxScreen->numVisuals) {
- /*
- * the visual is not supported by glx
- */
- return 0;
- }
-
- return( glxMatchGLXVisualInConfigList(pGlxVisual, configs, nconfigs) );
-}
-
-VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen )
-{
- __GLXscreenInfo *pGlxScreen2;
- int j;
- VisualID vid;
-
- /* check that the glx extension has been initialized */
- if ( !__glXActiveScreens )
- return NULL;
-
- pGlxScreen2 = &__glXActiveScreens[pMatchScreen->myNum];
-
- vid = glxMatchVisualInConfigList( pScreen, pVisual,
- pGlxScreen2->pGlxVisual,
- pGlxScreen2->numVisuals );
- if (vid) {
- /*
- * find the X visual of the matching glx visual
- */
- for (j=0; j<pMatchScreen->numVisuals; j++) {
- if (vid == pMatchScreen->visuals[j].vid) {
- return &pMatchScreen->visuals[j];
- }
- }
- }
-
- return 0;
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "glxserver.h"
+#include "glxvisuals.h"
+
+int
+glxVisualsMatch(__GLXvisualConfig * v1, __GLXvisualConfig * v2)
+{
+ if ((v1->class == v2->class) &&
+ (v1->rgba == v2->rgba) &&
+ (v1->redSize == v2->redSize) &&
+ (v1->greenSize == v2->greenSize) &&
+ (v1->blueSize == v2->blueSize) &&
+ (v1->alphaSize == v2->alphaSize) &&
+ (v1->redMask == v2->redMask) &&
+ (v1->greenMask == v2->greenMask) &&
+ (v1->blueMask == v2->blueMask) &&
+ (v1->alphaMask == v2->alphaMask) &&
+ (v1->accumRedSize == v2->accumRedSize) &&
+ (v1->accumGreenSize == v2->accumGreenSize) &&
+ (v1->accumBlueSize == v2->accumBlueSize) &&
+ (v1->accumAlphaSize == v2->accumAlphaSize) &&
+ (v1->doubleBuffer == v2->doubleBuffer) &&
+ (v1->stereo == v2->stereo) &&
+ (v1->bufferSize == v2->bufferSize) &&
+ (v1->depthSize == v2->depthSize) &&
+ (v1->stencilSize == v2->stencilSize) &&
+ (v1->auxBuffers == v2->auxBuffers) &&
+ (v1->level == v2->level) &&
+ (v1->visualRating == v2->visualRating) &&
+ (v1->transparentPixel == v2->transparentPixel) &&
+ (v1->transparentRed == v2->transparentRed) &&
+ (v1->transparentGreen == v2->transparentGreen) &&
+ (v1->transparentBlue == v2->transparentBlue) &&
+ (v1->transparentAlpha == v2->transparentAlpha) &&
+ (v1->transparentIndex == v2->transparentIndex) &&
+ (v1->multiSampleSize == v2->multiSampleSize) &&
+ (v1->nMultiSampleBuffers == v2->nMultiSampleBuffers) &&
+ (v1->visualSelectGroup == v2->visualSelectGroup)) {
+
+ return 1;
+
+ }
+
+ return 0;
+
+}
+
+VisualID
+glxMatchGLXVisualInConfigList(__GLXvisualConfig * pGlxVisual,
+ __GLXvisualConfig * configs, int nconfigs)
+{
+ int i;
+
+ for (i = 0; i < nconfigs; i++) {
+
+ if (glxVisualsMatch(pGlxVisual, &configs[i])) {
+
+ return configs[i].vid;
+
+ }
+ }
+
+ return 0;
+}
+
+VisualID
+glxMatchVisualInConfigList(ScreenPtr pScreen, VisualPtr pVisual,
+ __GLXvisualConfig * configs, int nconfigs)
+{
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ int i;
+
+ /* check that the glx extension has been initialized */
+ if (!__glXActiveScreens)
+ return 0;
+
+ pGlxScreen = &__glXActiveScreens[pScreen->myNum];
+ pGlxVisual = pGlxScreen->pGlxVisual;
+
+ /* find the glx visual info for pVisual */
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == pVisual->vid) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ * the visual is not supported by glx
+ */
+ return 0;
+ }
+
+ return (glxMatchGLXVisualInConfigList(pGlxVisual, configs, nconfigs));
+}
+
+VisualPtr
+glxMatchVisual(ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen)
+{
+ __GLXscreenInfo *pGlxScreen2;
+ int j;
+ VisualID vid;
+
+ /* check that the glx extension has been initialized */
+ if (!__glXActiveScreens)
+ return NULL;
+
+ pGlxScreen2 = &__glXActiveScreens[pMatchScreen->myNum];
+
+ vid = glxMatchVisualInConfigList(pScreen, pVisual,
+ pGlxScreen2->pGlxVisual,
+ pGlxScreen2->numVisuals);
+ if (vid) {
+ /*
+ * find the X visual of the matching glx visual
+ */
+ for (j = 0; j < pMatchScreen->numVisuals; j++) {
+ if (vid == pMatchScreen->visuals[j].vid) {
+ return &pMatchScreen->visuals[j];
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxvisuals.h b/xorg-server/hw/dmx/glxProxy/glxvisuals.h
index 4245313ba..e1e023878 100644
--- a/xorg-server/hw/dmx/glxProxy/glxvisuals.h
+++ b/xorg-server/hw/dmx/glxProxy/glxvisuals.h
@@ -1,42 +1,46 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifndef _GLX_VISUALS_H
-#define _GLX_VISUALS_H
-
-int glxVisualsMatch( __GLXvisualConfig *v1, __GLXvisualConfig *v2 );
-
-VisualID glxMatchGLXVisualInConfigList( __GLXvisualConfig *pGlxVisual, __GLXvisualConfig *configs, int nconfigs );
-
-VisualID glxMatchVisualInConfigList( ScreenPtr pScreen, VisualPtr pVisual, __GLXvisualConfig *configs, int nconfigs );
-
-VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen );
-
-#endif
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifndef _GLX_VISUALS_H
+#define _GLX_VISUALS_H
+
+int glxVisualsMatch(__GLXvisualConfig * v1, __GLXvisualConfig * v2);
+
+VisualID glxMatchGLXVisualInConfigList(__GLXvisualConfig * pGlxVisual,
+ __GLXvisualConfig * configs,
+ int nconfigs);
+
+VisualID glxMatchVisualInConfigList(ScreenPtr pScreen, VisualPtr pVisual,
+ __GLXvisualConfig * configs, int nconfigs);
+
+VisualPtr glxMatchVisual(ScreenPtr pScreen, VisualPtr pVisual,
+ ScreenPtr pMatchScreen);
+
+#endif
diff --git a/xorg-server/hw/dmx/glxProxy/render2swap.c b/xorg-server/hw/dmx/glxProxy/render2swap.c
index da9b565de..166ec8882 100644
--- a/xorg-server/hw/dmx/glxProxy/render2swap.c
+++ b/xorg-server/hw/dmx/glxProxy/render2swap.c
@@ -32,7 +32,8 @@
#include "unpack.h"
#include "g_disptab.h"
-static GLint __glEvalComputeK(GLenum target)
+static GLint
+__glEvalComputeK(GLenum target)
{
switch (target) {
case GL_MAP1_VERTEX_4:
@@ -41,33 +42,35 @@ static GLint __glEvalComputeK(GLenum target)
case GL_MAP2_VERTEX_4:
case GL_MAP2_COLOR_4:
case GL_MAP2_TEXTURE_COORD_4:
- return 4;
+ return 4;
case GL_MAP1_VERTEX_3:
case GL_MAP1_TEXTURE_COORD_3:
case GL_MAP1_NORMAL:
case GL_MAP2_VERTEX_3:
case GL_MAP2_TEXTURE_COORD_3:
case GL_MAP2_NORMAL:
- return 3;
+ return 3;
case GL_MAP1_TEXTURE_COORD_2:
case GL_MAP2_TEXTURE_COORD_2:
- return 2;
+ return 2;
case GL_MAP1_TEXTURE_COORD_1:
case GL_MAP2_TEXTURE_COORD_1:
case GL_MAP1_INDEX:
case GL_MAP2_INDEX:
- return 1;
+ return 1;
default:
- return 0;
+ return 0;
}
}
-void __glXDispSwap_Map1f(GLbyte *pc)
+void
+__glXDispSwap_Map1f(GLbyte * pc)
{
GLint order, k;
GLfloat u1, u2, *points;
GLenum target;
GLint compsize;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -75,30 +78,33 @@ void __glXDispSwap_Map1f(GLbyte *pc)
__GLX_SWAP_INT(pc + 12);
__GLX_SWAP_FLOAT(pc + 4);
__GLX_SWAP_FLOAT(pc + 8);
-
- target = *(GLenum *)(pc + 0);
- order = *(GLint *)(pc + 12);
- u1 = *(GLfloat *)(pc + 4);
- u2 = *(GLfloat *)(pc + 8);
- points = (GLfloat *)(pc + 16);
+
+ target = *(GLenum *) (pc + 0);
+ order = *(GLint *) (pc + 12);
+ u1 = *(GLfloat *) (pc + 4);
+ u2 = *(GLfloat *) (pc + 8);
+ points = (GLfloat *) (pc + 16);
k = __glEvalComputeK(target);
if (order <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = order * k;
+ /* Erroneous command. */
+ compsize = 0;
+ }
+ else {
+ compsize = order * k;
}
__GLX_SWAP_FLOAT_ARRAY(points, compsize);
}
-void __glXDispSwap_Map2f(GLbyte *pc)
+void
+__glXDispSwap_Map2f(GLbyte * pc)
{
GLint uorder, vorder, ustride, vstride, k;
GLfloat u1, u2, v1, v2, *points;
GLenum target;
GLint compsize;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -109,35 +115,38 @@ void __glXDispSwap_Map2f(GLbyte *pc)
__GLX_SWAP_FLOAT(pc + 8);
__GLX_SWAP_FLOAT(pc + 16);
__GLX_SWAP_FLOAT(pc + 20);
-
- target = *(GLenum *)(pc + 0);
- uorder = *(GLint *)(pc + 12);
- vorder = *(GLint *)(pc + 24);
- u1 = *(GLfloat *)(pc + 4);
- u2 = *(GLfloat *)(pc + 8);
- v1 = *(GLfloat *)(pc + 16);
- v2 = *(GLfloat *)(pc + 20);
- points = (GLfloat *)(pc + 28);
+
+ target = *(GLenum *) (pc + 0);
+ uorder = *(GLint *) (pc + 12);
+ vorder = *(GLint *) (pc + 24);
+ u1 = *(GLfloat *) (pc + 4);
+ u2 = *(GLfloat *) (pc + 8);
+ v1 = *(GLfloat *) (pc + 16);
+ v2 = *(GLfloat *) (pc + 20);
+ points = (GLfloat *) (pc + 28);
k = __glEvalComputeK(target);
ustride = vorder * k;
vstride = k;
if (vorder <= 0 || uorder <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = uorder * vorder * k;
+ /* Erroneous command. */
+ compsize = 0;
+ }
+ else {
+ compsize = uorder * vorder * k;
}
__GLX_SWAP_FLOAT_ARRAY(points, compsize);
}
-void __glXDispSwap_Map1d(GLbyte *pc)
+void
+__glXDispSwap_Map1d(GLbyte * pc)
{
GLint order, k, compsize;
GLenum target;
GLdouble u1, u2, *points;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -146,41 +155,45 @@ void __glXDispSwap_Map1d(GLbyte *pc)
__GLX_SWAP_INT(pc + 16);
__GLX_SWAP_INT(pc + 20);
- target = *(GLenum*) (pc + 16);
- order = *(GLint*) (pc + 20);
+ target = *(GLenum *) (pc + 16);
+ order = *(GLint *) (pc + 20);
k = __glEvalComputeK(target);
if (order <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = order * k;
+ /* Erroneous command. */
+ compsize = 0;
}
- __GLX_GET_DOUBLE(u1,pc);
- __GLX_GET_DOUBLE(u2,pc+8);
- __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize);
+ else {
+ compsize = order * k;
+ }
+ __GLX_GET_DOUBLE(u1, pc);
+ __GLX_GET_DOUBLE(u2, pc + 8);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 24, compsize);
pc += 24;
#ifdef __GLX_ALIGN64
- if (((unsigned long)pc) & 7) {
- /*
- ** Copy the doubles up 4 bytes, trashing the command but aligning
- ** the data in the process
- */
- __GLX_MEM_COPY(pc-4, pc, compsize*8);
- points = (GLdouble*) (pc - 4);
- } else {
- points = (GLdouble*) pc;
+ if (((unsigned long) pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc - 4, pc, compsize * 8);
+ points = (GLdouble *) (pc - 4);
+ }
+ else {
+ points = (GLdouble *) pc;
}
#else
- points = (GLdouble*) pc;
+ points = (GLdouble *) pc;
#endif
}
-void __glXDispSwap_Map2d(GLbyte *pc)
+void
+__glXDispSwap_Map2d(GLbyte * pc)
{
GLdouble u1, u2, v1, v2, *points;
GLint uorder, vorder, ustride, vstride, k, compsize;
GLenum target;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -192,80 +205,86 @@ void __glXDispSwap_Map2d(GLbyte *pc)
__GLX_SWAP_INT(pc + 36);
__GLX_SWAP_INT(pc + 40);
- target = *(GLenum *)(pc + 32);
- uorder = *(GLint *)(pc + 36);
- vorder = *(GLint *)(pc + 40);
+ target = *(GLenum *) (pc + 32);
+ uorder = *(GLint *) (pc + 36);
+ vorder = *(GLint *) (pc + 40);
k = __glEvalComputeK(target);
if (vorder <= 0 || uorder <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = uorder * vorder * k;
+ /* Erroneous command. */
+ compsize = 0;
+ }
+ else {
+ compsize = uorder * vorder * k;
}
- __GLX_GET_DOUBLE(u1,pc);
- __GLX_GET_DOUBLE(u2,pc+8);
- __GLX_GET_DOUBLE(v1,pc+16);
- __GLX_GET_DOUBLE(v2,pc+24);
- __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize);
+ __GLX_GET_DOUBLE(u1, pc);
+ __GLX_GET_DOUBLE(u2, pc + 8);
+ __GLX_GET_DOUBLE(v1, pc + 16);
+ __GLX_GET_DOUBLE(v2, pc + 24);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 44, compsize);
pc += 44;
ustride = vorder * k;
vstride = k;
#ifdef __GLX_ALIGN64
- if (((unsigned long)pc) & 7) {
- /*
- ** Copy the doubles up 4 bytes, trashing the command but aligning
- ** the data in the process
- */
- __GLX_MEM_COPY(pc-4, pc, compsize*8);
- points = (GLdouble*) (pc - 4);
- } else {
- points = (GLdouble*) pc;
+ if (((unsigned long) pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc - 4, pc, compsize * 8);
+ points = (GLdouble *) (pc - 4);
+ }
+ else {
+ points = (GLdouble *) pc;
}
#else
- points = (GLdouble*) pc;
+ points = (GLdouble *) pc;
#endif
}
-void __glXDispSwap_CallLists(GLbyte *pc)
+void
+__glXDispSwap_CallLists(GLbyte * pc)
{
GLenum type;
GLsizei n;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_INT(pc + 4);
__GLX_SWAP_INT(pc + 0);
- type = *(GLenum *)(pc + 4);
- n = *(GLsizei *)(pc + 0);
+ type = *(GLenum *) (pc + 4);
+ n = *(GLsizei *) (pc + 0);
switch (type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_2_BYTES:
- case GL_3_BYTES:
- case GL_4_BYTES:
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- __GLX_SWAP_SHORT_ARRAY(pc+8, n);
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- __GLX_SWAP_INT_ARRAY(pc+8, n);
- break;
- case GL_FLOAT:
- __GLX_SWAP_FLOAT_ARRAY(pc+8, n);
- break;
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_2_BYTES:
+ case GL_3_BYTES:
+ case GL_4_BYTES:
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ __GLX_SWAP_SHORT_ARRAY(pc + 8, n);
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ __GLX_SWAP_INT_ARRAY(pc + 8, n);
+ break;
+ case GL_FLOAT:
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, n);
+ break;
}
}
-void __glXDispSwap_DrawArrays(GLbyte *pc)
+void
+__glXDispSwap_DrawArrays(GLbyte * pc)
{
- __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc;
+ __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc;
__GLXdispatchDrawArraysComponentHeader *compHeader;
int i;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_INT(&hdr->numVertexes);
@@ -276,10 +295,10 @@ void __glXDispSwap_DrawArrays(GLbyte *pc)
compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
/* compute stride (same for all component arrays) */
- for (i=0; i<hdr->numComponents; i++) {
- __GLX_SWAP_INT(&compHeader[i].datatype);
- __GLX_SWAP_INT(&compHeader[i].numVals);
- __GLX_SWAP_INT(&compHeader[i].component);
+ for (i = 0; i < hdr->numComponents; i++) {
+ __GLX_SWAP_INT(&compHeader[i].datatype);
+ __GLX_SWAP_INT(&compHeader[i].numVals);
+ __GLX_SWAP_INT(&compHeader[i].component);
}
diff --git a/xorg-server/hw/dmx/glxProxy/renderpixswap.c b/xorg-server/hw/dmx/glxProxy/renderpixswap.c
index e0ed7e77d..3458e611c 100644
--- a/xorg-server/hw/dmx/glxProxy/renderpixswap.c
+++ b/xorg-server/hw/dmx/glxProxy/renderpixswap.c
@@ -1,383 +1,406 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#include "glxserver.h"
-#include "unpack.h"
-#include "g_disptab.h"
-
-void __glXDispSwap_PolygonStipple(GLbyte *pc)
-{
- __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_Bitmap(GLbyte *pc)
-{
- __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig);
- __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig);
- __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove);
- __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove);
-
- hdr->swapBytes = !hdr->swapBytes;
-
-}
-
-void __glXDispSwap_TexImage1D(GLbyte *pc)
-{
- __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->components);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->border);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_TexImage2D(GLbyte *pc)
-{
- __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->components);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->border);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_TexImage3D(GLbyte *pc)
-{
- __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
- __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->depth);
- __GLX_SWAP_INT((GLbyte *)&hdr->size4d);
- __GLX_SWAP_INT((GLbyte *)&hdr->border);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_DrawPixels(GLbyte *pc)
-{
- __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_TexSubImage1D(GLbyte *pc)
-{
- __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_TexSubImage2D(GLbyte *pc)
-{
- __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_TexSubImage3D(GLbyte *pc)
-{
- __GLXdispatchTexSubImage3DHeader *hdr =
- (__GLXdispatchTexSubImage3DHeader *) pc;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
- __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->zoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->depth);
- __GLX_SWAP_INT((GLbyte *)&hdr->size4d);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_ColorTable(GLbyte *pc)
-{
- __GLXdispatchColorTableHeader *hdr =
- (__GLXdispatchColorTableHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_ColorSubTable(GLbyte *pc)
-{
- __GLXdispatchColorSubTableHeader *hdr =
- (__GLXdispatchColorSubTableHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->start);
- __GLX_SWAP_INT((GLbyte *)&hdr->count);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc)
-{
- __GLXdispatchConvolutionFilterHeader *hdr =
- (__GLXdispatchConvolutionFilterHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc)
-{
- __GLXdispatchConvolutionFilterHeader *hdr =
- (__GLXdispatchConvolutionFilterHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_SeparableFilter2D(GLbyte *pc)
-{
- __GLXdispatchConvolutionFilterHeader *hdr =
- (__GLXdispatchConvolutionFilterHeader *) pc;
- GLint hdrlen;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#include "glxserver.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+void
+__glXDispSwap_PolygonStipple(GLbyte * pc)
+{
+ __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_Bitmap(GLbyte * pc)
+{
+ __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_FLOAT((GLbyte *) & hdr->xorig);
+ __GLX_SWAP_FLOAT((GLbyte *) & hdr->yorig);
+ __GLX_SWAP_FLOAT((GLbyte *) & hdr->xmove);
+ __GLX_SWAP_FLOAT((GLbyte *) & hdr->ymove);
+
+ hdr->swapBytes = !hdr->swapBytes;
+
+}
+
+void
+__glXDispSwap_TexImage1D(GLbyte * pc)
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->components);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->border);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_TexImage2D(GLbyte * pc)
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->components);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->border);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_TexImage3D(GLbyte * pc)
+{
+ __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->imageHeight);
+ __GLX_SWAP_INT((GLbyte *) & hdr->imageDepth);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipImages);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipVolumes);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->depth);
+ __GLX_SWAP_INT((GLbyte *) & hdr->size4d);
+ __GLX_SWAP_INT((GLbyte *) & hdr->border);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_DrawPixels(GLbyte * pc)
+{
+ __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_TexSubImage1D(GLbyte * pc)
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_TexSubImage2D(GLbyte * pc)
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->yoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_TexSubImage3D(GLbyte * pc)
+{
+ __GLXdispatchTexSubImage3DHeader *hdr =
+ (__GLXdispatchTexSubImage3DHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->imageHeight);
+ __GLX_SWAP_INT((GLbyte *) & hdr->imageDepth);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipImages);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipVolumes);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->yoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->zoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->depth);
+ __GLX_SWAP_INT((GLbyte *) & hdr->size4d);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_ColorTable(GLbyte * pc)
+{
+ __GLXdispatchColorTableHeader *hdr = (__GLXdispatchColorTableHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_ColorSubTable(GLbyte * pc)
+{
+ __GLXdispatchColorSubTableHeader *hdr =
+ (__GLXdispatchColorSubTableHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->start);
+ __GLX_SWAP_INT((GLbyte *) & hdr->count);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_ConvolutionFilter1D(GLbyte * pc)
+{
+ __GLXdispatchConvolutionFilterHeader *hdr =
+ (__GLXdispatchConvolutionFilterHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_ConvolutionFilter2D(GLbyte * pc)
+{
+ __GLXdispatchConvolutionFilterHeader *hdr =
+ (__GLXdispatchConvolutionFilterHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_SeparableFilter2D(GLbyte * pc)
+{
+ __GLXdispatchConvolutionFilterHeader *hdr =
+ (__GLXdispatchConvolutionFilterHeader *) pc;
+ GLint hdrlen;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
diff --git a/xorg-server/hw/dmx/input/ChkNotMaskEv.c b/xorg-server/hw/dmx/input/ChkNotMaskEv.c
index 635332e63..bde04ae23 100644
--- a/xorg-server/hw/dmx/input/ChkNotMaskEv.c
+++ b/xorg-server/hw/dmx/input/ChkNotMaskEv.c
@@ -67,40 +67,40 @@ extern long const _Xevent_to_mask[];
* If not, flush buffer and see if any more events are readable. If one
* matches, return. If all else fails, tell the user no events found.
*/
-Bool XCheckNotMaskEvent (Display *dpy, long mask, XEvent *event)
+Bool
+XCheckNotMaskEvent(Display * dpy, long mask, XEvent * event)
{
- register _XQEvent *prev, *qelt;
- unsigned long qe_serial = 0;
- int n; /* time through count */
+ register _XQEvent *prev, *qelt;
+ unsigned long qe_serial = 0;
+ int n; /* time through count */
- LockDisplay(dpy);
- prev = NULL;
- for (n = 3; --n >= 0;) {
- for (qelt = prev ? prev->next : dpy->head;
- qelt;
- prev = qelt, qelt = qelt->next) {
- if (qelt->event.type >= LASTEvent
- || !(_Xevent_to_mask[qelt->event.type] & mask)) {
- *event = qelt->event;
- _XDeq(dpy, prev, qelt);
- UnlockDisplay(dpy);
- return True;
- }
- }
- if (prev)
- qe_serial = prev->qserial_num;
- switch (n) {
- case 2:
- _XEventsQueued(dpy, QueuedAfterReading);
- break;
- case 1:
- _XFlush(dpy);
- break;
- }
- if (prev && prev->qserial_num != qe_serial)
- /* another thread has snatched this event */
- prev = NULL;
- }
- UnlockDisplay(dpy);
- return False;
+ LockDisplay(dpy);
+ prev = NULL;
+ for (n = 3; --n >= 0;) {
+ for (qelt = prev ? prev->next : dpy->head;
+ qelt; prev = qelt, qelt = qelt->next) {
+ if (qelt->event.type >= LASTEvent
+ || !(_Xevent_to_mask[qelt->event.type] & mask)) {
+ *event = qelt->event;
+ _XDeq(dpy, prev, qelt);
+ UnlockDisplay(dpy);
+ return True;
+ }
+ }
+ if (prev)
+ qe_serial = prev->qserial_num;
+ switch (n) {
+ case 2:
+ _XEventsQueued(dpy, QueuedAfterReading);
+ break;
+ case 1:
+ _XFlush(dpy);
+ break;
+ }
+ if (prev && prev->qserial_num != qe_serial)
+ /* another thread has snatched this event */
+ prev = NULL;
+ }
+ UnlockDisplay(dpy);
+ return False;
}
diff --git a/xorg-server/hw/dmx/input/dmxarg.c b/xorg-server/hw/dmx/input/dmxarg.c
index 49a1da9af..4a74b4c9e 100644
--- a/xorg-server/hw/dmx/input/dmxarg.c
+++ b/xorg-server/hw/dmx/input/dmxarg.c
@@ -51,86 +51,99 @@
/** Stores the parsed argument list. */
struct _dmxArg {
- int argc; /**< Number of arguments in argv */
- int argm; /**< Maximum number of arguments store-able in argv */
+ int argc; /**< Number of arguments in argv */
+ int argm; /**< Maximum number of arguments store-able in argv */
const char **argv; /**< Arguments */
};
/** Create an (externally opaque) \a dmxArg object. */
-dmxArg dmxArgCreate(void)
+dmxArg
+dmxArgCreate(void)
{
- dmxArg a = malloc(sizeof(*a));
- a->argc = 0;
- a->argm = 2;
- a->argv = malloc(a->argm * sizeof(*a->argv));
+ dmxArg a = malloc(sizeof(*a));
+
+ a->argc = 0;
+ a->argm = 2;
+ a->argv = malloc(a->argm * sizeof(*a->argv));
a->argv[0] = NULL;
return a;
}
/** Free the specified \a dmxArg object. */
-void dmxArgFree(dmxArg a)
+void
+dmxArgFree(dmxArg a)
{
int i;
- for (i = 0; i < a->argc; i++) free((char *)a->argv[i]);
+ for (i = 0; i < a->argc; i++)
+ free((char *) a->argv[i]);
free(a->argv);
free(a);
}
/** Add the \a string as the next argument in the \a dmxArg object. */
-void dmxArgAdd(dmxArg a, const char *string)
+void
+dmxArgAdd(dmxArg a, const char *string)
{
if (a->argm <= a->argc + 2)
a->argv = realloc(a->argv, sizeof(*a->argv) * (a->argm *= 2));
a->argv[a->argc++] = strdup(string);
- a->argv[a->argc] = NULL;
+ a->argv[a->argc] = NULL;
}
/** Return the argument number \a item in the \a dmxArg object.
* Arguments are 0 based. NULL will be returned for values less than 0
* or equal to or greater than the number of arguments in the object. */
-const char *dmxArgV(dmxArg a, int item)
+const char *
+dmxArgV(dmxArg a, int item)
{
- if (item < 0 || item >= a->argc) return NULL;
+ if (item < 0 || item >= a->argc)
+ return NULL;
return a->argv[item];
}
/** Return the number of arguments in the \a dmxArg object. */
-int dmxArgC(dmxArg a)
+int
+dmxArgC(dmxArg a)
{
return a->argc;
}
/** Parse a string into arguments delimited by commas. Return a new \a
* dmxArg object containing the arguments. */
-dmxArg dmxArgParse(const char *string)
+dmxArg
+dmxArgParse(const char *string)
{
- char *tmp;
- char *start, *pt;
+ char *tmp;
+ char *start, *pt;
dmxArg a = dmxArgCreate();
- int done;
- int len;
+ int done;
+ int len;
- if (!string) return a;
+ if (!string)
+ return a;
len = strlen(string) + 2;
tmp = malloc(len);
strncpy(tmp, string, len);
for (start = pt = tmp, done = 0; !done && *pt; start = ++pt) {
- for (;*pt && *pt != ','; pt++);
- if (!*pt) done = 1;
+ for (; *pt && *pt != ','; pt++);
+ if (!*pt)
+ done = 1;
*pt = '\0';
dmxArgAdd(a, start);
}
- if (!done) dmxArgAdd(a, ""); /* Final comma */
-
+ if (!done)
+ dmxArgAdd(a, ""); /* Final comma */
+
free(tmp);
return a;
}
#if DMX_ARG_TEST
-static void dmxArgPrint(dmxArg a)
+static void
+dmxArgPrint(dmxArg a)
{
int i;
@@ -139,7 +152,8 @@ static void dmxArgPrint(dmxArg a)
printf(" argv[%d] = \"%s\"\n", i, dmxArgV(a, i));
}
-static void dmxArgTest(const char *string)
+static void
+dmxArgTest(const char *string)
{
dmxArg a;
@@ -155,7 +169,8 @@ static void dmxArgTest(const char *string)
dmxArgFree(a);
}
-int main(void)
+int
+main(void)
{
dmxArgTest(NULL);
dmxArgTest("");
diff --git a/xorg-server/hw/dmx/input/dmxbackend.c b/xorg-server/hw/dmx/input/dmxbackend.c
index 35e9e9616..9463c87d3 100644
--- a/xorg-server/hw/dmx/input/dmxbackend.c
+++ b/xorg-server/hw/dmx/input/dmxbackend.c
@@ -1,616 +1,665 @@
-/*
- * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * David H. Dawes <dawes@xfree86.org>
- * Kevin E. Martin <kem@redhat.com>
- * Rickard E. (Rik) Faith <faith@redhat.com>
- */
-
-/** \file
- * These routines support taking input from devices on the backend
- * (output) displays. \see dmxcommon.c. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_BACKEND_DEBUG 0
-
-#include "dmxinputinit.h"
-#include "dmxbackend.h"
-#include "dmxcommon.h"
-#include "dmxconsole.h"
-#include "dmxcursor.h"
-#include "dmxprop.h"
-#include "dmxsync.h"
-#include "dmxcb.h" /* For dmxGlobalWidth and dmxGlobalHeight */
-#include "dmxevents.h" /* For dmxGetGlobalPosition */
-#include "ChkNotMaskEv.h"
-
-#include "inputstr.h"
-#include "input.h"
-#include <X11/keysym.h>
-#include "mipointer.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-
-/* Private area for backend devices. */
-typedef struct _myPrivate {
- DMX_COMMON_PRIVATE;
- int myScreen;
- DMXScreenInfo *grabbedScreen;
-
- int lastX, lastY;
- int centerX, centerY;
- int relative;
- int newscreen;
- int initialized;
- DevicePtr mou, kbd;
- int entered;
- int offX, offY;
-} myPrivate;
-
-#if DMX_BACKEND_DEBUG
-#define DMXDBG0(f) dmxLog(dmxDebug,f)
-#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
-#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
-#define DMXDBG8(f,a,b,c,d,e,g,h,i) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i)
-#define DMXDBG9(f,a,b,c,d,e,g,h,i,j) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i,j)
-#else
-#define DMXDBG0(f)
-#define DMXDBG1(f,a)
-#define DMXDBG2(f,a,b)
-#define DMXDBG3(f,a,b,c)
-#define DMXDBG4(f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h)
-#define DMXDBG8(f,a,b,c,d,e,g,h,i)
-#define DMXDBG9(f,a,b,c,d,e,g,h,i,j)
-#endif
-
-/** Create and return a private data structure. */
-pointer dmxBackendCreatePrivate(DeviceIntPtr pDevice)
-{
- GETDMXLOCALFROMPDEVICE;
- myPrivate *priv = calloc(1, sizeof(*priv));
- priv->dmxLocal = dmxLocal;
- return priv;
-}
-
-/** Destroy the private data structure. No checking is performed to
- * verify that the structure was actually created by
- * #dmxBackendCreatePrivate. */
-void dmxBackendDestroyPrivate(pointer private)
-{
- free(private);
-}
-
-static void *dmxBackendTestScreen(DMXScreenInfo *dmxScreen, void *closure)
-{
- long target = (long)closure;
-
- if (dmxScreen->index == target) return dmxScreen;
- return NULL;
-}
-
-/* Return non-zero if screen and priv->myScreen are on the same physical
- * backend display (1 if they are the same screen, 2 if they are
- * different screens). Since this is a common operation, the results
- * are cached. The cache is invalidated if \a priv is NULL (this should
- * be done with each server generation and reconfiguration). */
-static int dmxBackendSameDisplay(myPrivate *priv, long screen)
-{
- static myPrivate *oldpriv = NULL;
- static int oldscreen = -1;
- static int retcode = 0;
-
- if (priv == oldpriv && screen == oldscreen) return retcode;
- if (!priv) { /* Invalidate cache */
- oldpriv = NULL;
- oldscreen = -1;
- retcode = 0;
- return 0;
- }
-
- if (screen == priv->myScreen) retcode = 1;
- else if (screen < 0 || screen >= dmxNumScreens) retcode = 0;
- else if (dmxPropertyIterate(priv->be,
- dmxBackendTestScreen,
- (void *)screen)) retcode = 2;
- else retcode = 0;
-
- oldpriv = priv;
- oldscreen = screen;
- return retcode;
-}
-
-static void *dmxBackendTestEvents(DMXScreenInfo *dmxScreen, void *closure)
-{
- XEvent *X = (XEvent *)closure;
-
- if (XCheckNotMaskEvent(dmxScreen->beDisplay, ExposureMask, X))
- return dmxScreen;
- return NULL;
-}
-
-static void *dmxBackendTestMotionEvent(DMXScreenInfo *dmxScreen, void *closure)
-{
- XEvent *X = (XEvent *)closure;
-
- if (XCheckTypedEvent(dmxScreen->beDisplay, MotionNotify, X))
- return dmxScreen;
- return NULL;
-}
-
-static DMXScreenInfo *dmxBackendGetEvent(myPrivate *priv, XEvent *X)
-{
- DMXScreenInfo *dmxScreen;
-
- if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestEvents, X)))
- return dmxScreen;
- return NULL;
-}
-
-static DMXScreenInfo *dmxBackendPendingMotionEvent(myPrivate *priv, int save)
-{
- DMXScreenInfo *dmxScreen;
- XEvent N;
-
- if ((dmxScreen = dmxPropertyIterate(priv->be,
- dmxBackendTestMotionEvent, &N))) {
- if (save) XPutBackEvent(dmxScreen->beDisplay, &N);
- return dmxScreen;
- }
- return NULL;
-}
-
-static void *dmxBackendTestWindow(DMXScreenInfo *dmxScreen, void *closure)
-{
- Window win = (Window)(long)closure;
- if (dmxScreen->scrnWin == win) return dmxScreen;
- return NULL;
-}
-
-static DMXScreenInfo *dmxBackendFindWindow(myPrivate *priv, Window win)
-{
- return dmxPropertyIterate(priv->be, dmxBackendTestWindow,
- (void *)(long)win);
-}
-
-/* If the cursor is over a set of overlapping screens and one of those
- * screens takes backend input, then we want that particular screen to
- * be current, not one of the other ones. */
-static int dmxBackendFindOverlapping(myPrivate *priv, int screen, int x, int y)
-{
- DMXScreenInfo *start = &dmxScreens[screen];
- DMXScreenInfo *pt;
-
- if (!start->over) return screen;
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->index == priv->myScreen
- && dmxOnScreen(x, y, &dmxScreens[pt->index])) return pt->index;
- if (pt == start) break;
- }
- return screen;
-}
-
-/* Return non-zero if \a x and \a y are off \a screen. */
-static int dmxBackendOffscreen(int screen, int x, int y)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[screen];
-
- return (!dmxOnScreen(x, y, dmxScreen));
-}
-
-/** This routine is called from #dmxCoreMotion for each motion
- * event. \a x and \a y are global coordinants. */
-void dmxBackendUpdatePosition(pointer private, int x, int y)
-{
- GETPRIVFROMPRIVATE;
- int screen = miPointerGetScreen(inputInfo.pointer)->myNum;
- DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen];
- int oldRelative = priv->relative;
- int topscreen = dmxBackendFindOverlapping(priv, screen, x, y);
- int same = dmxBackendSameDisplay(priv, topscreen);
- int offscreen = dmxBackendOffscreen(priv->myScreen, x, y);
- int offthis = dmxBackendOffscreen(screen, x, y);
-
- DMXDBG9("dmxBackendUpdatePosition(%d,%d) my=%d mi=%d rel=%d"
- " topscreen=%d same=%d offscreen=%d offthis=%d\n",
- x, y, priv->myScreen, screen, priv->relative,
- topscreen, same, offscreen, offthis);
-
- if (offscreen) {
- /* If the cursor is off the input screen, it should be moving
- * relative unless it is visible on a screen of the same display
- * (i.e., one that shares the mouse). */
- if (same == 2 && !offthis) {
- if (priv->relative) {
- DMXDBG0(" Off screen, but not absolute\n");
- priv->relative = 0;
- }
- } else {
- if (!priv->relative) {
- DMXDBG0(" Off screen, but not relative\n");
- priv->relative = 1;
- }
- }
- } else {
- if (topscreen != screen) {
- DMXDBG2(" Using screen %d instead of %d (from mi)\n",
- topscreen, screen);
- }
- if (same) {
- if (priv->relative) {
- DMXDBG0(" On screen, but not absolute\n");
- priv->relative = 0;
- }
- } else {
- if (!priv->relative) {
- DMXDBG0(" Not on screen, but not relative\n");
- priv->relative = 1;
- }
- }
- }
-
- if (oldRelative != priv->relative) {
- DMXDBG2(" Do switch, relative=%d same=%d\n",
- priv->relative, same);
- /* Discard all pre-switch events */
- dmxSync(dmxScreen, TRUE);
- while (dmxBackendPendingMotionEvent(priv, FALSE));
-
- if (dmxInput->console && offscreen) {
- /* Our special case is a console window and a backend window
- * share a display. In this case, the cursor is either on
- * the backend window (taking absolute input), or not (in
- * which case the cursor needs to be in the console
- * window). */
- if (priv->grabbedScreen) {
- DMXDBG2(" *** force ungrab on %s, display=%p\n",
- priv->grabbedScreen->name,
- priv->grabbedScreen->beDisplay);
- XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
- dmxSync(priv->grabbedScreen, TRUE);
- priv->grabbedScreen = NULL;
- }
- DMXDBG0(" Capturing console\n");
- dmxConsoleCapture(dmxInput);
- } else {
- priv->newscreen = 1;
- if (priv->relative && !dmxInput->console) {
- DMXDBG5(" Hide cursor; warp from %d,%d to %d,%d on %d\n",
- priv->lastX, priv->lastY, priv->centerX, priv->centerY,
- priv->myScreen);
- dmxConsoleUncapture(dmxInput);
- dmxHideCursor(dmxScreen);
- priv->lastX = priv->centerX;
- priv->lastY = priv->centerY;
- XWarpPointer(priv->display, None, priv->window,
- 0, 0, 0, 0, priv->lastX, priv->lastY);
- dmxSync(dmxScreen, TRUE);
- } else {
- DMXDBG0(" Check cursor\n");
- dmxCheckCursor();
- }
- }
- }
-}
-
-/** Get events from the X queue on the backend servers and put the
- * events into the DMX event queue. */
-void dmxBackendCollectEvents(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- dmxCheckSpecialProcPtr checkspecial,
- DMXBlockType block)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
- XEvent X;
- DMXScreenInfo *dmxScreen;
- int left = 0;
- int entered = priv->entered;
- int ignoreLeave = 0;
- int v[2];
- int retcode;
-
- while ((dmxScreen = dmxBackendGetEvent(priv, &X))) {
- switch (X.type) {
- case EnterNotify:
- dmxCommonSaveState(priv);
- if (entered++)
- continue;
- priv->entered = 1;
- ignoreLeave = 1;
- DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n",
- X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
- dmxScreen->name, dmxScreen->beDisplay);
- XRaiseWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
- priv->grabbedScreen = dmxScreen;
- if ((retcode = XGrabPointer(dmxScreen->beDisplay,
- dmxScreen->scrnWin,
- True, 0, GrabModeAsync,
- GrabModeAsync, None, None,
- CurrentTime))) {
- dmxLog(dmxError,
- "XGrabPointer failed during backend enter (%d)\n",
- retcode);
- }
- break;
- case LeaveNotify:
- if (ignoreLeave) {
- ignoreLeave = 0;
- continue;
- }
- dmxCommonRestoreState(priv);
- if (left++)
- continue;
- DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n",
- X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
- X.xcrossing.detail, X.xcrossing.focus,
- priv->grabbedScreen ? "UNGRAB" : "",
- dmxScreen->name);
- if (priv->grabbedScreen) {
- XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
- dmxSync(priv->grabbedScreen, TRUE);
- priv->grabbedScreen = NULL;
- }
- break;
- case MotionNotify:
- DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
- " newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
- dmxScreen->index, priv->myScreen,
- miPointerCurrentScreen()->myNum,
- priv->newscreen,
- X.xmotion.x, X.xmotion.y,
- entered, priv->lastX, priv->lastY);
- if (dmxBackendPendingMotionEvent(priv, TRUE))
- continue;
- if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window)))
- dmxLog(dmxFatal,
- " Event on non-existant window %lu\n",
- X.xmotion.window);
- if (!priv->relative || dmxInput->console) {
- int newX = X.xmotion.x - dmxScreen->rootX;
- int newY = X.xmotion.y - dmxScreen->rootY;
-
- if (!priv->newscreen) {
- int width = dmxScreen->rootWidth;
- int height = dmxScreen->rootHeight;
- if (!newX) newX = -1;
- if (newX == width - 1) newX = width;
- if (!newY) newY = -1;
- if (newY == height - 1) newY = height;
- }
- priv->newscreen = 0;
- v[0] = dmxScreen->rootXOrigin + newX;
- v[1] = dmxScreen->rootYOrigin + newY;
- DMXDBG8(" Absolute move: %d,%d (r=%dx%d+%d+%d s=%dx%d)\n",
- v[0], v[1],
- priv->be->rootWidth, priv->be->rootHeight,
- priv->be->rootX, priv->be->rootY,
- priv->be->scrnWidth, priv->be->scrnHeight);
- motion(priv->mou, v, 0, 2, DMX_ABSOLUTE, block);
- priv->entered = 0;
- } else {
- int newX = priv->lastX - X.xmotion.x;
- int newY = priv->lastY - X.xmotion.y;
- priv->lastX = X.xmotion.x;
- priv->lastY = X.xmotion.y;
- v[0] = newX;
- v[1] = newY;
- DMXDBG2(" Relative move: %d, %d\n", v[0], v[1]);
- motion(priv->mou, v, 0, 2, DMX_RELATIVE, block);
- }
- if (entered && priv->relative) {
- DMXDBG4(" **** Relative %d %d instead of absolute %d %d\n",
- v[0], v[1],
- (dmxScreen->rootXOrigin + X.xmotion.x
- - dmxScreen->rootX),
- (dmxScreen->rootYOrigin + X.xmotion.y
- - dmxScreen->rootY));
- }
- break;
-
- case KeyPress:
- case KeyRelease:
- enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
- break;
- case ButtonPress:
- case ButtonRelease:
- /* fall-through */
- default:
- /* Pass the whole event here, because
- * this may be an extension event. */
- enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
- break;
- }
- }
-}
-
-/** Called after input events are processed from the DMX queue. No
- * event processing actually takes place here, but this is a convenient
- * place to update the pointer. */
-void dmxBackendProcessInput(pointer private)
-{
- GETPRIVFROMPRIVATE;
-
- DMXDBG6("dmxBackendProcessInput: myScreen=%d relative=%d"
- " last=%d,%d center=%d,%d\n",
- priv->myScreen, priv->relative,
- priv->lastX, priv->lastY,
- priv->centerX, priv->centerY);
-
- if (priv->relative
- && !dmxInput->console
- && (priv->lastX != priv->centerX || priv->lastY != priv->centerY)) {
- DMXDBG4(" warping pointer from last=%d,%d to center=%d,%d\n",
- priv->lastX, priv->lastY, priv->centerX, priv->centerY);
- priv->lastX = priv->centerX;
- priv->lastY = priv->centerY;
- XWarpPointer(priv->display, None, priv->window,
- 0, 0, 0, 0, priv->lastX, priv->lastY);
- dmxSync(&dmxScreens[priv->myScreen], TRUE);
- }
-}
-
-static void dmxBackendComputeCenter(myPrivate *priv)
-{
- int centerX;
- int centerY;
-
- centerX = priv->be->rootWidth / 2 + priv->be->rootX;
- centerY = priv->be->rootHeight / 2 + priv->be->rootY;
-
- if (centerX > priv->be->rootWidth) centerX = priv->be->rootWidth - 1;
- if (centerY > priv->be->rootHeight) centerY = priv->be->rootHeight - 1;
- if (centerX < 1) centerX = 1;
- if (centerY < 1) centerY = 1;
-
- priv->centerX = centerX;
- priv->centerY = centerY;
-}
-
-static DMXScreenInfo *dmxBackendInitPrivate(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
- DMXScreenInfo *dmxScreen;
- int i;
-
- /* Fill in myPrivate */
- for (i = 0,dmxScreen = &dmxScreens[0]; i<dmxNumScreens; i++,dmxScreen++) {
- if (dmxPropertySameDisplay(dmxScreen, dmxInput->name)) {
- priv->display = dmxScreen->beDisplay;
- priv->window = dmxScreen->scrnWin;
- priv->be = dmxScreen;
- break;
- }
- }
-
- if (i >= dmxNumScreens)
- dmxLog(dmxFatal,
- "%s is not an existing backend display - cannot initialize\n",
- dmxInput->name);
-
- return dmxScreen;
-}
-
-/** Re-initialized the backend device described by \a pDev (after a
- * reconfig). */
-void dmxBackendLateReInit(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- int x, y;
-
- DMXDBG1("dmxBackendLateReInit miPointerCurrentScreen() = %p\n",
- miPointerCurrentScreen());
-
- dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
- dmxBackendInitPrivate(pDev);
- dmxBackendComputeCenter(priv);
- dmxGetGlobalPosition(&x, &y);
- dmxInvalidateGlobalPosition(); /* To force event processing */
- dmxBackendUpdatePosition(priv, x, y);
-}
-
-/** Initialized the backend device described by \a pDev. */
-void dmxBackendInit(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- DMXScreenInfo *dmxScreen;
-
- dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
-
- if (dmxLocal->type == DMX_LOCAL_MOUSE) priv->mou = pDev;
- if (dmxLocal->type == DMX_LOCAL_KEYBOARD) priv->kbd = pDev;
- if (priv->initialized++) return; /* Only do once for mouse/keyboard pair */
-
- dmxScreen = dmxBackendInitPrivate(pDev);
-
- /* Finish initialization using computed values or constants. */
- dmxBackendComputeCenter(priv);
- priv->eventMask = (EnterWindowMask|LeaveWindowMask);
- priv->myScreen = dmxScreen->index;
- priv->lastX = priv->centerX;
- priv->lastY = priv->centerY;
- priv->relative = 0;
- priv->newscreen = 0;
-}
-
-/** Get information about the backend pointer (for initialization). */
-void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev);
-
- info->buttonClass = 1;
- dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->minval[1] = 0;
- info->maxval[0] = dmxScreen->beWidth;
- info->maxval[1] = dmxScreen->beHeight;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
- info->ptrFeedbackClass = 1;
-}
-
-/** Get information about the backend keyboard (for initialization). */
-void dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- dmxCommonKbdGetInfo(pDev, info);
- info->keyboard = 1;
- info->keyClass = 1;
- dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap);
- info->freemap = 1;
- info->focusClass = 1;
- info->kbdFeedbackClass = 1;
-}
-
-/** Process #DMXFunctionType functions. The only function handled here
- * is to acknowledge a pending server shutdown. */
-int dmxBackendFunctions(pointer private, DMXFunctionType function)
-{
- switch (function) {
- case DMX_FUNCTION_TERMINATE:
- return 1;
- default:
- return 0;
- }
-}
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ */
+
+/** \file
+ * These routines support taking input from devices on the backend
+ * (output) displays. \see dmxcommon.c. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_BACKEND_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxbackend.h"
+#include "dmxcommon.h"
+#include "dmxconsole.h"
+#include "dmxcursor.h"
+#include "dmxprop.h"
+#include "dmxsync.h"
+#include "dmxcb.h" /* For dmxGlobalWidth and dmxGlobalHeight */
+#include "dmxevents.h" /* For dmxGetGlobalPosition */
+#include "ChkNotMaskEv.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include <X11/keysym.h>
+#include "mipointer.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+/* Private area for backend devices. */
+typedef struct _myPrivate {
+ DMX_COMMON_PRIVATE;
+ int myScreen;
+ DMXScreenInfo *grabbedScreen;
+
+ int lastX, lastY;
+ int centerX, centerY;
+ int relative;
+ int newscreen;
+ int initialized;
+ DevicePtr mou, kbd;
+ int entered;
+ int offX, offY;
+} myPrivate;
+
+#if DMX_BACKEND_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#define DMXDBG8(f,a,b,c,d,e,g,h,i) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i)
+#define DMXDBG9(f,a,b,c,d,e,g,h,i,j) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i,j)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#define DMXDBG8(f,a,b,c,d,e,g,h,i)
+#define DMXDBG9(f,a,b,c,d,e,g,h,i,j)
+#endif
+
+/** Create and return a private data structure. */
+pointer
+dmxBackendCreatePrivate(DeviceIntPtr pDevice)
+{
+ GETDMXLOCALFROMPDEVICE;
+ myPrivate *priv = calloc(1, sizeof(*priv));
+
+ priv->dmxLocal = dmxLocal;
+ return priv;
+}
+
+/** Destroy the private data structure. No checking is performed to
+ * verify that the structure was actually created by
+ * #dmxBackendCreatePrivate. */
+void
+dmxBackendDestroyPrivate(pointer private)
+{
+ free(private);
+}
+
+static void *
+dmxBackendTestScreen(DMXScreenInfo * dmxScreen, void *closure)
+{
+ long target = (long) closure;
+
+ if (dmxScreen->index == target)
+ return dmxScreen;
+ return NULL;
+}
+
+/* Return non-zero if screen and priv->myScreen are on the same physical
+ * backend display (1 if they are the same screen, 2 if they are
+ * different screens). Since this is a common operation, the results
+ * are cached. The cache is invalidated if \a priv is NULL (this should
+ * be done with each server generation and reconfiguration). */
+static int
+dmxBackendSameDisplay(myPrivate * priv, long screen)
+{
+ static myPrivate *oldpriv = NULL;
+ static int oldscreen = -1;
+ static int retcode = 0;
+
+ if (priv == oldpriv && screen == oldscreen)
+ return retcode;
+ if (!priv) { /* Invalidate cache */
+ oldpriv = NULL;
+ oldscreen = -1;
+ retcode = 0;
+ return 0;
+ }
+
+ if (screen == priv->myScreen)
+ retcode = 1;
+ else if (screen < 0 || screen >= dmxNumScreens)
+ retcode = 0;
+ else if (dmxPropertyIterate(priv->be,
+ dmxBackendTestScreen, (void *) screen))
+ retcode = 2;
+ else
+ retcode = 0;
+
+ oldpriv = priv;
+ oldscreen = screen;
+ return retcode;
+}
+
+static void *
+dmxBackendTestEvents(DMXScreenInfo * dmxScreen, void *closure)
+{
+ XEvent *X = (XEvent *) closure;
+
+ if (XCheckNotMaskEvent(dmxScreen->beDisplay, ExposureMask, X))
+ return dmxScreen;
+ return NULL;
+}
+
+static void *
+dmxBackendTestMotionEvent(DMXScreenInfo * dmxScreen, void *closure)
+{
+ XEvent *X = (XEvent *) closure;
+
+ if (XCheckTypedEvent(dmxScreen->beDisplay, MotionNotify, X))
+ return dmxScreen;
+ return NULL;
+}
+
+static DMXScreenInfo *
+dmxBackendGetEvent(myPrivate * priv, XEvent * X)
+{
+ DMXScreenInfo *dmxScreen;
+
+ if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestEvents, X)))
+ return dmxScreen;
+ return NULL;
+}
+
+static DMXScreenInfo *
+dmxBackendPendingMotionEvent(myPrivate * priv, int save)
+{
+ DMXScreenInfo *dmxScreen;
+ XEvent N;
+
+ if ((dmxScreen = dmxPropertyIterate(priv->be,
+ dmxBackendTestMotionEvent, &N))) {
+ if (save)
+ XPutBackEvent(dmxScreen->beDisplay, &N);
+ return dmxScreen;
+ }
+ return NULL;
+}
+
+static void *
+dmxBackendTestWindow(DMXScreenInfo * dmxScreen, void *closure)
+{
+ Window win = (Window) (long) closure;
+
+ if (dmxScreen->scrnWin == win)
+ return dmxScreen;
+ return NULL;
+}
+
+static DMXScreenInfo *
+dmxBackendFindWindow(myPrivate * priv, Window win)
+{
+ return dmxPropertyIterate(priv->be, dmxBackendTestWindow,
+ (void *) (long) win);
+}
+
+/* If the cursor is over a set of overlapping screens and one of those
+ * screens takes backend input, then we want that particular screen to
+ * be current, not one of the other ones. */
+static int
+dmxBackendFindOverlapping(myPrivate * priv, int screen, int x, int y)
+{
+ DMXScreenInfo *start = &dmxScreens[screen];
+ DMXScreenInfo *pt;
+
+ if (!start->over)
+ return screen;
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->index == priv->myScreen
+ && dmxOnScreen(x, y, &dmxScreens[pt->index]))
+ return pt->index;
+ if (pt == start)
+ break;
+ }
+ return screen;
+}
+
+/* Return non-zero if \a x and \a y are off \a screen. */
+static int
+dmxBackendOffscreen(int screen, int x, int y)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[screen];
+
+ return (!dmxOnScreen(x, y, dmxScreen));
+}
+
+/** This routine is called from #dmxCoreMotion for each motion
+ * event. \a x and \a y are global coordinants. */
+void
+dmxBackendUpdatePosition(pointer private, int x, int y)
+{
+ GETPRIVFROMPRIVATE;
+ int screen = miPointerGetScreen(inputInfo.pointer)->myNum;
+ DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen];
+ int oldRelative = priv->relative;
+ int topscreen = dmxBackendFindOverlapping(priv, screen, x, y);
+ int same = dmxBackendSameDisplay(priv, topscreen);
+ int offscreen = dmxBackendOffscreen(priv->myScreen, x, y);
+ int offthis = dmxBackendOffscreen(screen, x, y);
+
+ DMXDBG9("dmxBackendUpdatePosition(%d,%d) my=%d mi=%d rel=%d"
+ " topscreen=%d same=%d offscreen=%d offthis=%d\n",
+ x, y, priv->myScreen, screen, priv->relative,
+ topscreen, same, offscreen, offthis);
+
+ if (offscreen) {
+ /* If the cursor is off the input screen, it should be moving
+ * relative unless it is visible on a screen of the same display
+ * (i.e., one that shares the mouse). */
+ if (same == 2 && !offthis) {
+ if (priv->relative) {
+ DMXDBG0(" Off screen, but not absolute\n");
+ priv->relative = 0;
+ }
+ }
+ else {
+ if (!priv->relative) {
+ DMXDBG0(" Off screen, but not relative\n");
+ priv->relative = 1;
+ }
+ }
+ }
+ else {
+ if (topscreen != screen) {
+ DMXDBG2(" Using screen %d instead of %d (from mi)\n",
+ topscreen, screen);
+ }
+ if (same) {
+ if (priv->relative) {
+ DMXDBG0(" On screen, but not absolute\n");
+ priv->relative = 0;
+ }
+ }
+ else {
+ if (!priv->relative) {
+ DMXDBG0(" Not on screen, but not relative\n");
+ priv->relative = 1;
+ }
+ }
+ }
+
+ if (oldRelative != priv->relative) {
+ DMXDBG2(" Do switch, relative=%d same=%d\n", priv->relative, same);
+ /* Discard all pre-switch events */
+ dmxSync(dmxScreen, TRUE);
+ while (dmxBackendPendingMotionEvent(priv, FALSE));
+
+ if (dmxInput->console && offscreen) {
+ /* Our special case is a console window and a backend window
+ * share a display. In this case, the cursor is either on
+ * the backend window (taking absolute input), or not (in
+ * which case the cursor needs to be in the console
+ * window). */
+ if (priv->grabbedScreen) {
+ DMXDBG2(" *** force ungrab on %s, display=%p\n",
+ priv->grabbedScreen->name,
+ priv->grabbedScreen->beDisplay);
+ XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
+ dmxSync(priv->grabbedScreen, TRUE);
+ priv->grabbedScreen = NULL;
+ }
+ DMXDBG0(" Capturing console\n");
+ dmxConsoleCapture(dmxInput);
+ }
+ else {
+ priv->newscreen = 1;
+ if (priv->relative && !dmxInput->console) {
+ DMXDBG5(" Hide cursor; warp from %d,%d to %d,%d on %d\n",
+ priv->lastX, priv->lastY, priv->centerX, priv->centerY,
+ priv->myScreen);
+ dmxConsoleUncapture(dmxInput);
+ dmxHideCursor(dmxScreen);
+ priv->lastX = priv->centerX;
+ priv->lastY = priv->centerY;
+ XWarpPointer(priv->display, None, priv->window,
+ 0, 0, 0, 0, priv->lastX, priv->lastY);
+ dmxSync(dmxScreen, TRUE);
+ }
+ else {
+ DMXDBG0(" Check cursor\n");
+ dmxCheckCursor();
+ }
+ }
+ }
+}
+
+/** Get events from the X queue on the backend servers and put the
+ * events into the DMX event queue. */
+void
+dmxBackendCollectEvents(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial, DMXBlockType block)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ XEvent X;
+ DMXScreenInfo *dmxScreen;
+ int left = 0;
+ int entered = priv->entered;
+ int ignoreLeave = 0;
+ int v[2];
+ int retcode;
+
+ while ((dmxScreen = dmxBackendGetEvent(priv, &X))) {
+ switch (X.type) {
+ case EnterNotify:
+ dmxCommonSaveState(priv);
+ if (entered++)
+ continue;
+ priv->entered = 1;
+ ignoreLeave = 1;
+ DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n",
+ X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
+ dmxScreen->name, dmxScreen->beDisplay);
+ XRaiseWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+ priv->grabbedScreen = dmxScreen;
+ if ((retcode = XGrabPointer(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ True, 0, GrabModeAsync,
+ GrabModeAsync, None, None,
+ CurrentTime))) {
+ dmxLog(dmxError,
+ "XGrabPointer failed during backend enter (%d)\n",
+ retcode);
+ }
+ break;
+ case LeaveNotify:
+ if (ignoreLeave) {
+ ignoreLeave = 0;
+ continue;
+ }
+ dmxCommonRestoreState(priv);
+ if (left++)
+ continue;
+ DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n",
+ X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
+ X.xcrossing.detail, X.xcrossing.focus,
+ priv->grabbedScreen ? "UNGRAB" : "", dmxScreen->name);
+ if (priv->grabbedScreen) {
+ XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
+ dmxSync(priv->grabbedScreen, TRUE);
+ priv->grabbedScreen = NULL;
+ }
+ break;
+ case MotionNotify:
+ DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
+ " newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
+ dmxScreen->index, priv->myScreen,
+ miPointerCurrentScreen()->myNum,
+ priv->newscreen,
+ X.xmotion.x, X.xmotion.y,
+ entered, priv->lastX, priv->lastY);
+ if (dmxBackendPendingMotionEvent(priv, TRUE))
+ continue;
+ if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window)))
+ dmxLog(dmxFatal,
+ " Event on non-existant window %lu\n",
+ X.xmotion.window);
+ if (!priv->relative || dmxInput->console) {
+ int newX = X.xmotion.x - dmxScreen->rootX;
+ int newY = X.xmotion.y - dmxScreen->rootY;
+
+ if (!priv->newscreen) {
+ int width = dmxScreen->rootWidth;
+ int height = dmxScreen->rootHeight;
+
+ if (!newX)
+ newX = -1;
+ if (newX == width - 1)
+ newX = width;
+ if (!newY)
+ newY = -1;
+ if (newY == height - 1)
+ newY = height;
+ }
+ priv->newscreen = 0;
+ v[0] = dmxScreen->rootXOrigin + newX;
+ v[1] = dmxScreen->rootYOrigin + newY;
+ DMXDBG8(" Absolute move: %d,%d (r=%dx%d+%d+%d s=%dx%d)\n",
+ v[0], v[1],
+ priv->be->rootWidth, priv->be->rootHeight,
+ priv->be->rootX, priv->be->rootY,
+ priv->be->scrnWidth, priv->be->scrnHeight);
+ motion(priv->mou, v, 0, 2, DMX_ABSOLUTE, block);
+ priv->entered = 0;
+ }
+ else {
+ int newX = priv->lastX - X.xmotion.x;
+ int newY = priv->lastY - X.xmotion.y;
+
+ priv->lastX = X.xmotion.x;
+ priv->lastY = X.xmotion.y;
+ v[0] = newX;
+ v[1] = newY;
+ DMXDBG2(" Relative move: %d, %d\n", v[0], v[1]);
+ motion(priv->mou, v, 0, 2, DMX_RELATIVE, block);
+ }
+ if (entered && priv->relative) {
+ DMXDBG4(" **** Relative %d %d instead of absolute %d %d\n",
+ v[0], v[1],
+ (dmxScreen->rootXOrigin + X.xmotion.x
+ - dmxScreen->rootX),
+ (dmxScreen->rootYOrigin + X.xmotion.y
+ - dmxScreen->rootY));
+ }
+ break;
+
+ case KeyPress:
+ case KeyRelease:
+ enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ /* fall-through */
+ default:
+ /* Pass the whole event here, because
+ * this may be an extension event. */
+ enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
+ break;
+ }
+ }
+}
+
+/** Called after input events are processed from the DMX queue. No
+ * event processing actually takes place here, but this is a convenient
+ * place to update the pointer. */
+void
+dmxBackendProcessInput(pointer private)
+{
+ GETPRIVFROMPRIVATE;
+
+ DMXDBG6("dmxBackendProcessInput: myScreen=%d relative=%d"
+ " last=%d,%d center=%d,%d\n",
+ priv->myScreen, priv->relative,
+ priv->lastX, priv->lastY, priv->centerX, priv->centerY);
+
+ if (priv->relative
+ && !dmxInput->console
+ && (priv->lastX != priv->centerX || priv->lastY != priv->centerY)) {
+ DMXDBG4(" warping pointer from last=%d,%d to center=%d,%d\n",
+ priv->lastX, priv->lastY, priv->centerX, priv->centerY);
+ priv->lastX = priv->centerX;
+ priv->lastY = priv->centerY;
+ XWarpPointer(priv->display, None, priv->window,
+ 0, 0, 0, 0, priv->lastX, priv->lastY);
+ dmxSync(&dmxScreens[priv->myScreen], TRUE);
+ }
+}
+
+static void
+dmxBackendComputeCenter(myPrivate * priv)
+{
+ int centerX;
+ int centerY;
+
+ centerX = priv->be->rootWidth / 2 + priv->be->rootX;
+ centerY = priv->be->rootHeight / 2 + priv->be->rootY;
+
+ if (centerX > priv->be->rootWidth)
+ centerX = priv->be->rootWidth - 1;
+ if (centerY > priv->be->rootHeight)
+ centerY = priv->be->rootHeight - 1;
+ if (centerX < 1)
+ centerX = 1;
+ if (centerY < 1)
+ centerY = 1;
+
+ priv->centerX = centerX;
+ priv->centerY = centerY;
+}
+
+static DMXScreenInfo *
+dmxBackendInitPrivate(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ DMXScreenInfo *dmxScreen;
+ int i;
+
+ /* Fill in myPrivate */
+ for (i = 0, dmxScreen = &dmxScreens[0]; i < dmxNumScreens; i++, dmxScreen++) {
+ if (dmxPropertySameDisplay(dmxScreen, dmxInput->name)) {
+ priv->display = dmxScreen->beDisplay;
+ priv->window = dmxScreen->scrnWin;
+ priv->be = dmxScreen;
+ break;
+ }
+ }
+
+ if (i >= dmxNumScreens)
+ dmxLog(dmxFatal,
+ "%s is not an existing backend display - cannot initialize\n",
+ dmxInput->name);
+
+ return dmxScreen;
+}
+
+/** Re-initialized the backend device described by \a pDev (after a
+ * reconfig). */
+void
+dmxBackendLateReInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ int x, y;
+
+ DMXDBG1("dmxBackendLateReInit miPointerCurrentScreen() = %p\n",
+ miPointerCurrentScreen());
+
+ dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
+ dmxBackendInitPrivate(pDev);
+ dmxBackendComputeCenter(priv);
+ dmxGetGlobalPosition(&x, &y);
+ dmxInvalidateGlobalPosition(); /* To force event processing */
+ dmxBackendUpdatePosition(priv, x, y);
+}
+
+/** Initialized the backend device described by \a pDev. */
+void
+dmxBackendInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ DMXScreenInfo *dmxScreen;
+
+ dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
+
+ if (dmxLocal->type == DMX_LOCAL_MOUSE)
+ priv->mou = pDev;
+ if (dmxLocal->type == DMX_LOCAL_KEYBOARD)
+ priv->kbd = pDev;
+ if (priv->initialized++)
+ return; /* Only do once for mouse/keyboard pair */
+
+ dmxScreen = dmxBackendInitPrivate(pDev);
+
+ /* Finish initialization using computed values or constants. */
+ dmxBackendComputeCenter(priv);
+ priv->eventMask = (EnterWindowMask | LeaveWindowMask);
+ priv->myScreen = dmxScreen->index;
+ priv->lastX = priv->centerX;
+ priv->lastY = priv->centerY;
+ priv->relative = 0;
+ priv->newscreen = 0;
+}
+
+/** Get information about the backend pointer (for initialization). */
+void
+dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev);
+
+ info->buttonClass = 1;
+ dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->minval[1] = 0;
+ info->maxval[0] = dmxScreen->beWidth;
+ info->maxval[1] = dmxScreen->beHeight;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
+
+/** Get information about the backend keyboard (for initialization). */
+void
+dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ dmxCommonKbdGetInfo(pDev, info);
+ info->keyboard = 1;
+ info->keyClass = 1;
+ dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap);
+ info->freemap = 1;
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+}
+
+/** Process #DMXFunctionType functions. The only function handled here
+ * is to acknowledge a pending server shutdown. */
+int
+dmxBackendFunctions(pointer private, DMXFunctionType function)
+{
+ switch (function) {
+ case DMX_FUNCTION_TERMINATE:
+ return 1;
+ default:
+ return 0;
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxcommon.c b/xorg-server/hw/dmx/input/dmxcommon.c
index 29c1958ad..5f25e8832 100644
--- a/xorg-server/hw/dmx/input/dmxcommon.c
+++ b/xorg-server/hw/dmx/input/dmxcommon.c
@@ -1,669 +1,698 @@
-/*
- * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * David H. Dawes <dawes@xfree86.org>
- * Kevin E. Martin <kem@redhat.com>
- * Rickard E. (Rik) Faith <faith@redhat.com>
- */
-
-/** \file
- *
- * This file implements common routines used by the backend and console
- * input devices.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_STATE_DEBUG 0
-
-#include "dmxinputinit.h"
-#include "dmxcommon.h"
-#include "dmxconsole.h"
-#include "dmxprop.h"
-#include "dmxsync.h"
-#include "dmxmap.h"
-
-#include "inputstr.h"
-#include "input.h"
-#include <X11/keysym.h>
-#include "mipointer.h"
-#include "scrnintstr.h"
-
-#include <unistd.h> /* For usleep() */
-
-#if DMX_STATE_DEBUG
-#define DMXDBG0(f) dmxLog(dmxDebug,f)
-#else
-#define DMXDBG0(f)
-#endif
-
-/** Each device has a private area that is visible only from inside the
- * driver code. */
-typedef struct _myPrivate {
- DMX_COMMON_PRIVATE;
-} myPrivate;
-
-static void dmxCommonKbdSetAR(Display *display,
- unsigned char *old, unsigned char *new)
-{
- XKeyboardControl kc;
- XKeyboardState ks;
- unsigned long mask = KBKey | KBAutoRepeatMode;
- int i, j;
- int minKeycode, maxKeycode;
-
- if (!old) {
- XGetKeyboardControl(display, &ks);
- old = (unsigned char *)ks.auto_repeats;
- }
-
- XDisplayKeycodes(display, &minKeycode, &maxKeycode);
- for (i = 1; i < 32; i++) {
- if (!old || old[i] != new[i]) {
- for (j = 0; j < 8; j++) {
- if ((new[i] & (1 << j)) != (old[i] & (1 << j))) {
- kc.key = i * 8 + j;
- kc.auto_repeat_mode = ((new[i] & (1 << j))
- ? AutoRepeatModeOn
- : AutoRepeatModeOff);
- if (kc.key >= minKeycode && kc.key <= maxKeycode)
- XChangeKeyboardControl(display, mask, &kc);
- }
- }
- }
- }
-}
-
-static void dmxCommonKbdSetLeds(Display *display, unsigned long new)
-{
- int i;
- XKeyboardControl kc;
-
- for (i = 0; i < 32; i++) {
- kc.led = i + 1;
- kc.led_mode = (new & (1 << i)) ? LedModeOn : LedModeOff;
- XChangeKeyboardControl(display, KBLed | KBLedMode, &kc);
- }
-}
-
-static void dmxCommonKbdSetCtrl(Display *display,
- KeybdCtrl *old, KeybdCtrl *new)
-{
- XKeyboardControl kc;
- unsigned long mask = KBKeyClickPercent | KBAutoRepeatMode;
-
- if (!old
- || old->click != new->click
- || old->autoRepeat != new->autoRepeat) {
-
- kc.key_click_percent = new->click;
- kc.auto_repeat_mode = new->autoRepeat;
-
- XChangeKeyboardControl(display, mask, &kc);
- }
-
- dmxCommonKbdSetLeds(display, new->leds);
- dmxCommonKbdSetAR(display, old ? old->autoRepeats : NULL,
- new->autoRepeats);
-}
-
-static void dmxCommonMouSetCtrl(Display *display, PtrCtrl *old, PtrCtrl *new)
-{
- Bool do_accel, do_threshold;
-
- if (!old
- || old->num != new->num
- || old->den != new->den
- || old->threshold != new->threshold) {
- do_accel = (new->num > 0 && new->den > 0);
- do_threshold = (new->threshold > 0);
- if (do_accel || do_threshold) {
- XChangePointerControl(display, do_accel, do_threshold,
- new->num, new->den, new->threshold);
- }
- }
-}
-
-/** Update the keyboard control. */
-void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl *ctrl)
-{
- GETPRIVFROMPDEV;
-
- if (!priv->stateSaved && priv->be) dmxCommonSaveState(priv);
- if (!priv->display || !priv->stateSaved) return;
- dmxCommonKbdSetCtrl(priv->display,
- priv->kctrlset ? &priv->kctrl : NULL,
- ctrl);
- priv->kctrl = *ctrl;
- priv->kctrlset = 1;
-}
-
-/** Update the mouse control. */
-void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl *ctrl)
-{
- GETPRIVFROMPDEV;
-
- /* Don't set the acceleration for the
- * console, because that should be
- * controlled by the X server that the
- * console is running on. Otherwise,
- * the acceleration for the console
- * window would be unexpected for the
- * scale of the window. */
- if (priv->be) {
- dmxCommonMouSetCtrl(priv->display,
- priv->mctrlset ? &priv->mctrl : NULL,
- ctrl);
- priv->mctrl = *ctrl;
- priv->mctrlset = 1;
- }
-}
-
-/** Sound they keyboard bell. */
-void dmxCommonKbdBell(DevicePtr pDev, int percent,
- int volume, int pitch, int duration)
-{
- GETPRIVFROMPDEV;
- XKeyboardControl kc;
- XKeyboardState ks;
- unsigned long mask = KBBellPercent | KBBellPitch | KBBellDuration;
-
- if (!priv->be) XGetKeyboardControl(priv->display, &ks);
- kc.bell_percent = volume;
- kc.bell_pitch = pitch;
- kc.bell_duration = duration;
- XChangeKeyboardControl(priv->display, mask, &kc);
- XBell(priv->display, percent);
- if (!priv->be) {
- kc.bell_percent = ks.bell_percent;
- kc.bell_pitch = ks.bell_pitch;
- kc.bell_duration = ks.bell_duration;
- XChangeKeyboardControl(priv->display, mask, &kc);
- }
-}
-
-/** Get the keyboard mapping. */
-void dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- GETPRIVFROMPDEV;
- int min_keycode;
- int max_keycode;
- int map_width;
- KeySym *keyboard_mapping;
- XModifierKeymap *modifier_mapping;
- int i, j;
-
- /* Compute pKeySyms. Cast
- * XGetKeyboardMapping because of
- * compiler warning on 64-bit machines.
- * We assume pointers to 32-bit and
- * 64-bit ints are the same. */
- XDisplayKeycodes(priv->display, &min_keycode, &max_keycode);
- keyboard_mapping = (KeySym *)XGetKeyboardMapping(priv->display,
- min_keycode,
- max_keycode
- - min_keycode + 1,
- &map_width);
- pKeySyms->minKeyCode = min_keycode;
- pKeySyms->maxKeyCode = max_keycode;
- pKeySyms->mapWidth = map_width;
- pKeySyms->map = keyboard_mapping;
-
-
- /* Compute pModMap */
- modifier_mapping = XGetModifierMapping(priv->display);
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = 0;
- for (j = 0; j < 8; j++) {
- int max_keypermod = modifier_mapping->max_keypermod;
-
- for (i = 0; i < max_keypermod; i++) {
- CARD8 keycode = modifier_mapping->modifiermap[j*max_keypermod + i];
- if (keycode)
- pModMap[keycode] |= 1 << j;
- }
- }
- XFreeModifiermap(modifier_mapping);
-}
-
-/** Fill in the XKEYBOARD parts of the \a info structure for the
- * specified \a pDev. */
-void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
- char *pt;
-
- dmxCommonSaveState(priv);
- if (priv->xkb) {
-#define NAME(x) \
- priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL
- info->names.keycodes = NAME(keycodes);
- info->names.types = NAME(types);
- info->names.compat = NAME(compat);
- info->names.symbols = NAME(symbols);
- info->names.geometry = NAME(geometry);
- info->freenames = 1;
-#undef NAME
- dmxLogInput(dmxInput,
- "XKEYBOARD: keycodes = %s\n", info->names.keycodes);
- dmxLogInput(dmxInput,
- "XKEYBOARD: symbols = %s\n", info->names.symbols);
- dmxLogInput(dmxInput,
- "XKEYBOARD: geometry = %s\n", info->names.geometry);
- if ((pt = strchr(info->names.keycodes, '+'))) *pt = '\0';
- }
- dmxCommonRestoreState(priv);
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int dmxCommonKbdOn(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- if (priv->be) dmxCommonSaveState(priv);
- priv->eventMask |= DMX_KEYBOARD_EVENT_MASK;
- XSelectInput(priv->display, priv->window, priv->eventMask);
- if (priv->be)
- XSetInputFocus(priv->display, priv->window, RevertToPointerRoot,
- CurrentTime);
- return -1;
-}
-
-/** Turn \a pDev off. */
-void dmxCommonKbdOff(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- priv->eventMask &= ~DMX_KEYBOARD_EVENT_MASK;
- XSelectInput(priv->display, priv->window, priv->eventMask);
- dmxCommonRestoreState(priv);
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int dmxCommonOthOn(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
- XEventClass event_list[DMX_MAX_XINPUT_EVENT_TYPES];
- int event_type[DMX_MAX_XINPUT_EVENT_TYPES];
- int count = 0;
-
-#define ADD(type) \
- if (count < DMX_MAX_XINPUT_EVENT_TYPES) { \
- type(priv->xi, event_type[count], event_list[count]); \
- if (event_type[count]) { \
- dmxMapInsert(dmxLocal, event_type[count], XI_##type); \
- ++count; \
- } \
- } else { \
- dmxLog(dmxWarning, "More than %d event types for %s\n", \
- DMX_MAX_XINPUT_EVENT_TYPES, dmxInput->name); \
- }
-
- if (!(priv->xi = XOpenDevice(priv->display, dmxLocal->deviceId))) {
- dmxLog(dmxWarning, "Cannot open %s device (id=%d) on %s\n",
- dmxLocal->deviceName ? dmxLocal->deviceName : "(unknown)",
- dmxLocal->deviceId, dmxInput->name);
- return -1;
- }
- ADD(DeviceKeyPress);
- ADD(DeviceKeyRelease);
- ADD(DeviceButtonPress);
- ADD(DeviceButtonRelease);
- ADD(DeviceMotionNotify);
- ADD(DeviceFocusIn);
- ADD(DeviceFocusOut);
- ADD(ProximityIn);
- ADD(ProximityOut);
- ADD(DeviceStateNotify);
- ADD(DeviceMappingNotify);
- ADD(ChangeDeviceNotify);
- XSelectExtensionEvent(priv->display, priv->window, event_list, count);
-
- return -1;
-}
-
-/** Turn \a pDev off. */
-void dmxCommonOthOff(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
-
- if (priv->xi) XCloseDevice(priv->display, priv->xi);
- priv->xi = NULL;
-}
-
-/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
- XExtensionVersion *ext;
- XDeviceInfo *devices;
- Display *display = priv->display;
- int num;
- int i, j, k;
- XextErrorHandler handler;
-
- if (!display && !(display = XOpenDisplay(dmxInput->name)))
- return;
-
- /* Print out information about the XInput Extension. */
- handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
- ext = XGetExtensionVersion(display, INAME);
- XSetExtensionErrorHandler(handler);
-
- if (ext && ext != (XExtensionVersion *)NoSuchExtension) {
- XFree(ext);
- devices = XListInputDevices(display, &num);
- for (i = 0; i < num; i++) {
- if (devices[i].id == (XID)dmxLocal->deviceId) {
- XAnyClassPtr any;
- XKeyInfoPtr ki;
- XButtonInfoPtr bi;
- XValuatorInfoPtr vi;
- for (j = 0, any = devices[i].inputclassinfo;
- j < devices[i].num_classes;
- any = (XAnyClassPtr)((char *)any + any->length), j++) {
- switch (any->class) {
- case KeyClass:
- ki = (XKeyInfoPtr)any;
- info->keyboard = 1;
- info->keyClass = 1;
- info->keySyms.minKeyCode = ki->min_keycode;
- info->keySyms.maxKeyCode = ki->max_keycode;
- info->kbdFeedbackClass = 1;
- break;
- case ButtonClass:
- bi = (XButtonInfoPtr)any;
- info->buttonClass = 1;
- info->numButtons = bi->num_buttons;
- info->ptrFeedbackClass = 1;
- break;
- case ValuatorClass:
- /* This assume all axes are either
- * Absolute or Relative. */
- vi = (XValuatorInfoPtr)any;
- info->valuatorClass = 1;
- if (vi->mode == Absolute)
- info->numAbsAxes = vi->num_axes;
- else
- info->numRelAxes = vi->num_axes;
- for (k = 0; k < vi->num_axes; k++) {
- info->res[k] = vi->axes[k].resolution;
- info->minres[k] = vi->axes[k].resolution;
- info->maxres[k] = vi->axes[k].resolution;
- info->minval[k] = vi->axes[k].min_value;
- info->maxval[k] = vi->axes[k].max_value;
- }
- break;
- case FeedbackClass:
- /* Only keyboard and pointer feedback
- * are handled at this time. */
- break;
- case ProximityClass:
- info->proximityClass = 1;
- break;
- case FocusClass:
- info->focusClass = 1;
- break;
- case OtherClass:
- break;
- }
- }
- }
- }
- XFreeDeviceList(devices);
- }
- if (display != priv->display) XCloseDisplay(display);
-}
-
-/** Obtain the mouse button mapping. */
-void dmxCommonMouGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
-{
- GETPRIVFROMPDEV;
- int i;
-
- *nButtons = XGetPointerMapping(priv->display, map, DMX_MAX_BUTTONS);
- for (i = 0; i <= *nButtons; i++) map[i] = i;
-}
-
-static void *dmxCommonXSelect(DMXScreenInfo *dmxScreen, void *closure)
-{
- myPrivate *priv = closure;
- XSelectInput(dmxScreen->beDisplay, dmxScreen->scrnWin, priv->eventMask);
- return NULL;
-}
-
-static void *dmxCommonAddEnabledDevice(DMXScreenInfo *dmxScreen, void *closure)
-{
- AddEnabledDevice(XConnectionNumber(dmxScreen->beDisplay));
- return NULL;
-}
-
-static void *dmxCommonRemoveEnabledDevice(DMXScreenInfo *dmxScreen,
- void *closure)
-{
- RemoveEnabledDevice(XConnectionNumber(dmxScreen->beDisplay));
- return NULL;
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int dmxCommonMouOn(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
-
- priv->eventMask |= DMX_POINTER_EVENT_MASK;
- if (dmxShadowFB) {
- XWarpPointer(priv->display, priv->window, priv->window,
- 0, 0, 0, 0,
- priv->initPointerX,
- priv->initPointerY);
- dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
- }
- if (!priv->be) {
- XSelectInput(priv->display, priv->window, priv->eventMask);
- AddEnabledDevice(XConnectionNumber(priv->display));
- } else {
- dmxPropertyIterate(priv->be, dmxCommonXSelect, priv);
- dmxPropertyIterate(priv->be, dmxCommonAddEnabledDevice, dmxInput);
- }
-
- return -1;
-}
-
-/** Turn \a pDev off. */
-void dmxCommonMouOff(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
-
- priv->eventMask &= ~DMX_POINTER_EVENT_MASK;
- if (!priv->be) {
- RemoveEnabledDevice(XConnectionNumber(priv->display));
- XSelectInput(priv->display, priv->window, priv->eventMask);
- } else {
- dmxPropertyIterate(priv->be, dmxCommonRemoveEnabledDevice, dmxInput);
- dmxPropertyIterate(priv->be, dmxCommonXSelect, priv);
- }
-}
-
-/** Given the global coordinates \a x and \a y, determine the screen
- * with the lowest number on which those coordinates lie. If they are
- * not on any screen, return -1. The number returned is an index into
- * \a dmxScreenInfo and is between -1 and \a dmxNumScreens - 1,
- * inclusive. */
-int dmxFindPointerScreen(int x, int y)
-{
- int i;
-
- for (i = 0; i < dmxNumScreens; i++) {
- ScreenPtr pScreen = screenInfo.screens[i];
- if (x >= pScreen->x && x < pScreen->x + pScreen->width &&
- y >= pScreen->y && y < pScreen->y + pScreen->height)
- return i;
- }
- return -1;
-}
-
-/** Returns a pointer to the private area for the device that comes just
- * prior to \a pDevice in the current \a dmxInput device list. This is
- * used as the private area for the current device in some situations
- * (e.g., when a keyboard and mouse form a pair that should share the
- * same private area). If the requested private area cannot be located,
- * then NULL is returned. */
-pointer dmxCommonCopyPrivate(DeviceIntPtr pDevice)
-{
- GETDMXLOCALFROMPDEVICE;
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
- int i;
-
- for (i = 0; i < dmxInput->numDevs; i++)
- if (dmxInput->devs[i] == dmxLocal && i)
- return dmxInput->devs[i-1]->private;
- return NULL;
-}
-
-/** This routine saves and resets some important state for the backend
- * and console device drivers:
- * - the modifier map is saved and set to 0 (so DMX controls the LEDs)
- * - the key click, bell, led, and repeat masks are saved and set to the
- * values that DMX claims to be using
- *
- * This routine and #dmxCommonRestoreState are used when the pointer
- * enters and leaves the console window, or when the backend window is
- * active or not active (for a full-screen window, this only happens at
- * server startup and server shutdown).
- */
-void dmxCommonSaveState(pointer private)
-{
- GETPRIVFROMPRIVATE;
- XKeyboardState ks;
- unsigned long i;
- XModifierKeymap *modmap;
-
- if (dmxInput->console) priv = dmxInput->devs[0]->private;
- if (!priv->display || priv->stateSaved) return;
- DMXDBG0("dmxCommonSaveState\n");
- if (dmxUseXKB && (priv->xkb = XkbAllocKeyboard())) {
- if (XkbGetIndicatorMap(priv->display, XkbAllIndicatorsMask, priv->xkb)
- || XkbGetNames(priv->display, XkbAllNamesMask, priv->xkb)) {
- dmxLogInput(dmxInput, "Could not get XKB information\n");
- XkbFreeKeyboard(priv->xkb, 0, True);
- priv->xkb = NULL;
- } else {
- if (priv->xkb->indicators) {
- priv->savedIndicators = *priv->xkb->indicators;
- for (i = 0; i < XkbNumIndicators; i++)
- if (priv->xkb->indicators->phys_indicators & (1 << i)) {
- priv->xkb->indicators->maps[i].flags
- = XkbIM_NoAutomatic;
- }
- XkbSetIndicatorMap(priv->display, ~0, priv->xkb);
- }
- }
- }
-
- XGetKeyboardControl(priv->display, &ks);
- priv->savedKctrl.click = ks.key_click_percent;
- priv->savedKctrl.bell = ks.bell_percent;
- priv->savedKctrl.bell_pitch = ks.bell_pitch;
- priv->savedKctrl.bell_duration = ks.bell_duration;
- priv->savedKctrl.leds = ks.led_mask;
- priv->savedKctrl.autoRepeat = ks.global_auto_repeat;
- for (i = 0; i < 32; i++)
- priv->savedKctrl.autoRepeats[i] = ks.auto_repeats[i];
-
- dmxCommonKbdSetCtrl(priv->display, &priv->savedKctrl,
- &priv->dmxLocal->kctrl);
-
- priv->savedModMap = XGetModifierMapping(priv->display);
-
- modmap = XNewModifiermap(0);
- XSetModifierMapping(priv->display, modmap);
- if (dmxInput->scrnIdx != -1)
- dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
- XFreeModifiermap(modmap);
-
- priv->stateSaved = 1;
-}
-
-/** This routine restores all the information saved by #dmxCommonSaveState. */
-void dmxCommonRestoreState(pointer private)
-{
- GETPRIVFROMPRIVATE;
- int retcode = -1;
- CARD32 start;
-
- if (dmxInput->console)
- priv = dmxInput->devs[0]->private;
- if (!priv->stateSaved)
- return;
- priv->stateSaved = 0;
-
- DMXDBG0("dmxCommonRestoreState\n");
- if (priv->xkb) {
- *priv->xkb->indicators = priv->savedIndicators;
- XkbSetIndicatorMap(priv->display, ~0, priv->xkb);
- XkbFreeKeyboard(priv->xkb, 0, True);
- priv->xkb = 0;
- }
-
- for (start = GetTimeInMillis(); GetTimeInMillis() - start < 5000;) {
- CARD32 tmp;
-
- retcode = XSetModifierMapping(priv->display, priv->savedModMap);
- if (retcode == MappingSuccess)
- break;
- if (retcode == MappingBusy)
- dmxLogInput(dmxInput, "Keyboard busy, waiting\n");
- else
- dmxLogInput(dmxInput, "Keyboard error, waiting\n");
-
- /* Don't generate X11 protocol for a bit */
- for (tmp = GetTimeInMillis(); GetTimeInMillis() - tmp < 250;) {
- usleep(250); /* This ends up sleeping only until
- * the next key press generates an
- * interruption. We make the delay
- * relatively short in case the user
- * pressed they keys quickly. */
- }
-
- }
- if (retcode != MappingSuccess)
- dmxLog(dmxWarning, "Unable to restore keyboard modifier state!\n");
-
- XFreeModifiermap(priv->savedModMap);
- priv->savedModMap = NULL;
-
- dmxCommonKbdSetCtrl(priv->display, NULL, &priv->savedKctrl);
- priv->kctrlset = 0; /* Invalidate copy */
-}
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ */
+
+/** \file
+ *
+ * This file implements common routines used by the backend and console
+ * input devices.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_STATE_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxcommon.h"
+#include "dmxconsole.h"
+#include "dmxprop.h"
+#include "dmxsync.h"
+#include "dmxmap.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include <X11/keysym.h>
+#include "mipointer.h"
+#include "scrnintstr.h"
+
+#include <unistd.h> /* For usleep() */
+
+#if DMX_STATE_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#else
+#define DMXDBG0(f)
+#endif
+
+/** Each device has a private area that is visible only from inside the
+ * driver code. */
+typedef struct _myPrivate {
+ DMX_COMMON_PRIVATE;
+} myPrivate;
+
+static void
+dmxCommonKbdSetAR(Display * display, unsigned char *old, unsigned char *new)
+{
+ XKeyboardControl kc;
+ XKeyboardState ks;
+ unsigned long mask = KBKey | KBAutoRepeatMode;
+ int i, j;
+ int minKeycode, maxKeycode;
+
+ if (!old) {
+ XGetKeyboardControl(display, &ks);
+ old = (unsigned char *) ks.auto_repeats;
+ }
+
+ XDisplayKeycodes(display, &minKeycode, &maxKeycode);
+ for (i = 1; i < 32; i++) {
+ if (!old || old[i] != new[i]) {
+ for (j = 0; j < 8; j++) {
+ if ((new[i] & (1 << j)) != (old[i] & (1 << j))) {
+ kc.key = i * 8 + j;
+ kc.auto_repeat_mode = ((new[i] & (1 << j))
+ ? AutoRepeatModeOn
+ : AutoRepeatModeOff);
+ if (kc.key >= minKeycode && kc.key <= maxKeycode)
+ XChangeKeyboardControl(display, mask, &kc);
+ }
+ }
+ }
+ }
+}
+
+static void
+dmxCommonKbdSetLeds(Display * display, unsigned long new)
+{
+ int i;
+ XKeyboardControl kc;
+
+ for (i = 0; i < 32; i++) {
+ kc.led = i + 1;
+ kc.led_mode = (new & (1 << i)) ? LedModeOn : LedModeOff;
+ XChangeKeyboardControl(display, KBLed | KBLedMode, &kc);
+ }
+}
+
+static void
+dmxCommonKbdSetCtrl(Display * display, KeybdCtrl * old, KeybdCtrl * new)
+{
+ XKeyboardControl kc;
+ unsigned long mask = KBKeyClickPercent | KBAutoRepeatMode;
+
+ if (!old || old->click != new->click || old->autoRepeat != new->autoRepeat) {
+
+ kc.key_click_percent = new->click;
+ kc.auto_repeat_mode = new->autoRepeat;
+
+ XChangeKeyboardControl(display, mask, &kc);
+ }
+
+ dmxCommonKbdSetLeds(display, new->leds);
+ dmxCommonKbdSetAR(display, old ? old->autoRepeats : NULL, new->autoRepeats);
+}
+
+static void
+dmxCommonMouSetCtrl(Display * display, PtrCtrl * old, PtrCtrl * new)
+{
+ Bool do_accel, do_threshold;
+
+ if (!old
+ || old->num != new->num
+ || old->den != new->den || old->threshold != new->threshold) {
+ do_accel = (new->num > 0 && new->den > 0);
+ do_threshold = (new->threshold > 0);
+ if (do_accel || do_threshold) {
+ XChangePointerControl(display, do_accel, do_threshold,
+ new->num, new->den, new->threshold);
+ }
+ }
+}
+
+/** Update the keyboard control. */
+void
+dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl * ctrl)
+{
+ GETPRIVFROMPDEV;
+
+ if (!priv->stateSaved && priv->be)
+ dmxCommonSaveState(priv);
+ if (!priv->display || !priv->stateSaved)
+ return;
+ dmxCommonKbdSetCtrl(priv->display,
+ priv->kctrlset ? &priv->kctrl : NULL, ctrl);
+ priv->kctrl = *ctrl;
+ priv->kctrlset = 1;
+}
+
+/** Update the mouse control. */
+void
+dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl * ctrl)
+{
+ GETPRIVFROMPDEV;
+
+ /* Don't set the acceleration for the
+ * console, because that should be
+ * controlled by the X server that the
+ * console is running on. Otherwise,
+ * the acceleration for the console
+ * window would be unexpected for the
+ * scale of the window. */
+ if (priv->be) {
+ dmxCommonMouSetCtrl(priv->display,
+ priv->mctrlset ? &priv->mctrl : NULL, ctrl);
+ priv->mctrl = *ctrl;
+ priv->mctrlset = 1;
+ }
+}
+
+/** Sound they keyboard bell. */
+void
+dmxCommonKbdBell(DevicePtr pDev, int percent,
+ int volume, int pitch, int duration)
+{
+ GETPRIVFROMPDEV;
+ XKeyboardControl kc;
+ XKeyboardState ks;
+ unsigned long mask = KBBellPercent | KBBellPitch | KBBellDuration;
+
+ if (!priv->be)
+ XGetKeyboardControl(priv->display, &ks);
+ kc.bell_percent = volume;
+ kc.bell_pitch = pitch;
+ kc.bell_duration = duration;
+ XChangeKeyboardControl(priv->display, mask, &kc);
+ XBell(priv->display, percent);
+ if (!priv->be) {
+ kc.bell_percent = ks.bell_percent;
+ kc.bell_pitch = ks.bell_pitch;
+ kc.bell_duration = ks.bell_duration;
+ XChangeKeyboardControl(priv->display, mask, &kc);
+ }
+}
+
+/** Get the keyboard mapping. */
+void
+dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ GETPRIVFROMPDEV;
+ int min_keycode;
+ int max_keycode;
+ int map_width;
+ KeySym *keyboard_mapping;
+ XModifierKeymap *modifier_mapping;
+ int i, j;
+
+ /* Compute pKeySyms. Cast
+ * XGetKeyboardMapping because of
+ * compiler warning on 64-bit machines.
+ * We assume pointers to 32-bit and
+ * 64-bit ints are the same. */
+ XDisplayKeycodes(priv->display, &min_keycode, &max_keycode);
+ keyboard_mapping = (KeySym *) XGetKeyboardMapping(priv->display,
+ min_keycode,
+ max_keycode
+ - min_keycode + 1,
+ &map_width);
+ pKeySyms->minKeyCode = min_keycode;
+ pKeySyms->maxKeyCode = max_keycode;
+ pKeySyms->mapWidth = map_width;
+ pKeySyms->map = keyboard_mapping;
+
+ /* Compute pModMap */
+ modifier_mapping = XGetModifierMapping(priv->display);
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = 0;
+ for (j = 0; j < 8; j++) {
+ int max_keypermod = modifier_mapping->max_keypermod;
+
+ for (i = 0; i < max_keypermod; i++) {
+ CARD8 keycode =
+ modifier_mapping->modifiermap[j * max_keypermod + i];
+ if (keycode)
+ pModMap[keycode] |= 1 << j;
+ }
+ }
+ XFreeModifiermap(modifier_mapping);
+}
+
+/** Fill in the XKEYBOARD parts of the \a info structure for the
+ * specified \a pDev. */
+void
+dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ char *pt;
+
+ dmxCommonSaveState(priv);
+ if (priv->xkb) {
+#define NAME(x) \
+ priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL
+ info->names.keycodes = NAME(keycodes);
+ info->names.types = NAME(types);
+ info->names.compat = NAME(compat);
+ info->names.symbols = NAME(symbols);
+ info->names.geometry = NAME(geometry);
+ info->freenames = 1;
+#undef NAME
+ dmxLogInput(dmxInput,
+ "XKEYBOARD: keycodes = %s\n", info->names.keycodes);
+ dmxLogInput(dmxInput,
+ "XKEYBOARD: symbols = %s\n", info->names.symbols);
+ dmxLogInput(dmxInput,
+ "XKEYBOARD: geometry = %s\n", info->names.geometry);
+ if ((pt = strchr(info->names.keycodes, '+')))
+ *pt = '\0';
+ }
+ dmxCommonRestoreState(priv);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+dmxCommonKbdOn(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ if (priv->be)
+ dmxCommonSaveState(priv);
+ priv->eventMask |= DMX_KEYBOARD_EVENT_MASK;
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ if (priv->be)
+ XSetInputFocus(priv->display, priv->window, RevertToPointerRoot,
+ CurrentTime);
+ return -1;
+}
+
+/** Turn \a pDev off. */
+void
+dmxCommonKbdOff(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ priv->eventMask &= ~DMX_KEYBOARD_EVENT_MASK;
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ dmxCommonRestoreState(priv);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+dmxCommonOthOn(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ XEventClass event_list[DMX_MAX_XINPUT_EVENT_TYPES];
+ int event_type[DMX_MAX_XINPUT_EVENT_TYPES];
+ int count = 0;
+
+#define ADD(type) \
+ if (count < DMX_MAX_XINPUT_EVENT_TYPES) { \
+ type(priv->xi, event_type[count], event_list[count]); \
+ if (event_type[count]) { \
+ dmxMapInsert(dmxLocal, event_type[count], XI_##type); \
+ ++count; \
+ } \
+ } else { \
+ dmxLog(dmxWarning, "More than %d event types for %s\n", \
+ DMX_MAX_XINPUT_EVENT_TYPES, dmxInput->name); \
+ }
+
+ if (!(priv->xi = XOpenDevice(priv->display, dmxLocal->deviceId))) {
+ dmxLog(dmxWarning, "Cannot open %s device (id=%d) on %s\n",
+ dmxLocal->deviceName ? dmxLocal->deviceName : "(unknown)",
+ dmxLocal->deviceId, dmxInput->name);
+ return -1;
+ }
+ ADD(DeviceKeyPress);
+ ADD(DeviceKeyRelease);
+ ADD(DeviceButtonPress);
+ ADD(DeviceButtonRelease);
+ ADD(DeviceMotionNotify);
+ ADD(DeviceFocusIn);
+ ADD(DeviceFocusOut);
+ ADD(ProximityIn);
+ ADD(ProximityOut);
+ ADD(DeviceStateNotify);
+ ADD(DeviceMappingNotify);
+ ADD(ChangeDeviceNotify);
+ XSelectExtensionEvent(priv->display, priv->window, event_list, count);
+
+ return -1;
+}
+
+/** Turn \a pDev off. */
+void
+dmxCommonOthOff(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+
+ if (priv->xi)
+ XCloseDevice(priv->display, priv->xi);
+ priv->xi = NULL;
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void
+dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ XExtensionVersion *ext;
+ XDeviceInfo *devices;
+ Display *display = priv->display;
+ int num;
+ int i, j, k;
+ XextErrorHandler handler;
+
+ if (!display && !(display = XOpenDisplay(dmxInput->name)))
+ return;
+
+ /* Print out information about the XInput Extension. */
+ handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
+ ext = XGetExtensionVersion(display, INAME);
+ XSetExtensionErrorHandler(handler);
+
+ if (ext && ext != (XExtensionVersion *) NoSuchExtension) {
+ XFree(ext);
+ devices = XListInputDevices(display, &num);
+ for (i = 0; i < num; i++) {
+ if (devices[i].id == (XID) dmxLocal->deviceId) {
+ XAnyClassPtr any;
+ XKeyInfoPtr ki;
+ XButtonInfoPtr bi;
+ XValuatorInfoPtr vi;
+
+ for (j = 0, any = devices[i].inputclassinfo;
+ j < devices[i].num_classes;
+ any = (XAnyClassPtr) ((char *) any + any->length), j++) {
+ switch (any->class) {
+ case KeyClass:
+ ki = (XKeyInfoPtr) any;
+ info->keyboard = 1;
+ info->keyClass = 1;
+ info->keySyms.minKeyCode = ki->min_keycode;
+ info->keySyms.maxKeyCode = ki->max_keycode;
+ info->kbdFeedbackClass = 1;
+ break;
+ case ButtonClass:
+ bi = (XButtonInfoPtr) any;
+ info->buttonClass = 1;
+ info->numButtons = bi->num_buttons;
+ info->ptrFeedbackClass = 1;
+ break;
+ case ValuatorClass:
+ /* This assume all axes are either
+ * Absolute or Relative. */
+ vi = (XValuatorInfoPtr) any;
+ info->valuatorClass = 1;
+ if (vi->mode == Absolute)
+ info->numAbsAxes = vi->num_axes;
+ else
+ info->numRelAxes = vi->num_axes;
+ for (k = 0; k < vi->num_axes; k++) {
+ info->res[k] = vi->axes[k].resolution;
+ info->minres[k] = vi->axes[k].resolution;
+ info->maxres[k] = vi->axes[k].resolution;
+ info->minval[k] = vi->axes[k].min_value;
+ info->maxval[k] = vi->axes[k].max_value;
+ }
+ break;
+ case FeedbackClass:
+ /* Only keyboard and pointer feedback
+ * are handled at this time. */
+ break;
+ case ProximityClass:
+ info->proximityClass = 1;
+ break;
+ case FocusClass:
+ info->focusClass = 1;
+ break;
+ case OtherClass:
+ break;
+ }
+ }
+ }
+ }
+ XFreeDeviceList(devices);
+ }
+ if (display != priv->display)
+ XCloseDisplay(display);
+}
+
+/** Obtain the mouse button mapping. */
+void
+dmxCommonMouGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+{
+ GETPRIVFROMPDEV;
+ int i;
+
+ *nButtons = XGetPointerMapping(priv->display, map, DMX_MAX_BUTTONS);
+ for (i = 0; i <= *nButtons; i++)
+ map[i] = i;
+}
+
+static void *
+dmxCommonXSelect(DMXScreenInfo * dmxScreen, void *closure)
+{
+ myPrivate *priv = closure;
+
+ XSelectInput(dmxScreen->beDisplay, dmxScreen->scrnWin, priv->eventMask);
+ return NULL;
+}
+
+static void *
+dmxCommonAddEnabledDevice(DMXScreenInfo * dmxScreen, void *closure)
+{
+ AddEnabledDevice(XConnectionNumber(dmxScreen->beDisplay));
+ return NULL;
+}
+
+static void *
+dmxCommonRemoveEnabledDevice(DMXScreenInfo * dmxScreen, void *closure)
+{
+ RemoveEnabledDevice(XConnectionNumber(dmxScreen->beDisplay));
+ return NULL;
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+dmxCommonMouOn(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+
+ priv->eventMask |= DMX_POINTER_EVENT_MASK;
+ if (dmxShadowFB) {
+ XWarpPointer(priv->display, priv->window, priv->window,
+ 0, 0, 0, 0, priv->initPointerX, priv->initPointerY);
+ dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
+ }
+ if (!priv->be) {
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ AddEnabledDevice(XConnectionNumber(priv->display));
+ }
+ else {
+ dmxPropertyIterate(priv->be, dmxCommonXSelect, priv);
+ dmxPropertyIterate(priv->be, dmxCommonAddEnabledDevice, dmxInput);
+ }
+
+ return -1;
+}
+
+/** Turn \a pDev off. */
+void
+dmxCommonMouOff(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+
+ priv->eventMask &= ~DMX_POINTER_EVENT_MASK;
+ if (!priv->be) {
+ RemoveEnabledDevice(XConnectionNumber(priv->display));
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ }
+ else {
+ dmxPropertyIterate(priv->be, dmxCommonRemoveEnabledDevice, dmxInput);
+ dmxPropertyIterate(priv->be, dmxCommonXSelect, priv);
+ }
+}
+
+/** Given the global coordinates \a x and \a y, determine the screen
+ * with the lowest number on which those coordinates lie. If they are
+ * not on any screen, return -1. The number returned is an index into
+ * \a dmxScreenInfo and is between -1 and \a dmxNumScreens - 1,
+ * inclusive. */
+int
+dmxFindPointerScreen(int x, int y)
+{
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ if (x >= pScreen->x && x < pScreen->x + pScreen->width &&
+ y >= pScreen->y && y < pScreen->y + pScreen->height)
+ return i;
+ }
+ return -1;
+}
+
+/** Returns a pointer to the private area for the device that comes just
+ * prior to \a pDevice in the current \a dmxInput device list. This is
+ * used as the private area for the current device in some situations
+ * (e.g., when a keyboard and mouse form a pair that should share the
+ * same private area). If the requested private area cannot be located,
+ * then NULL is returned. */
+pointer
+dmxCommonCopyPrivate(DeviceIntPtr pDevice)
+{
+ GETDMXLOCALFROMPDEVICE;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ int i;
+
+ for (i = 0; i < dmxInput->numDevs; i++)
+ if (dmxInput->devs[i] == dmxLocal && i)
+ return dmxInput->devs[i - 1]->private;
+ return NULL;
+}
+
+/** This routine saves and resets some important state for the backend
+ * and console device drivers:
+ * - the modifier map is saved and set to 0 (so DMX controls the LEDs)
+ * - the key click, bell, led, and repeat masks are saved and set to the
+ * values that DMX claims to be using
+ *
+ * This routine and #dmxCommonRestoreState are used when the pointer
+ * enters and leaves the console window, or when the backend window is
+ * active or not active (for a full-screen window, this only happens at
+ * server startup and server shutdown).
+ */
+void
+dmxCommonSaveState(pointer private)
+{
+ GETPRIVFROMPRIVATE;
+ XKeyboardState ks;
+ unsigned long i;
+ XModifierKeymap *modmap;
+
+ if (dmxInput->console)
+ priv = dmxInput->devs[0]->private;
+ if (!priv->display || priv->stateSaved)
+ return;
+ DMXDBG0("dmxCommonSaveState\n");
+ if (dmxUseXKB && (priv->xkb = XkbAllocKeyboard())) {
+ if (XkbGetIndicatorMap(priv->display, XkbAllIndicatorsMask, priv->xkb)
+ || XkbGetNames(priv->display, XkbAllNamesMask, priv->xkb)) {
+ dmxLogInput(dmxInput, "Could not get XKB information\n");
+ XkbFreeKeyboard(priv->xkb, 0, True);
+ priv->xkb = NULL;
+ }
+ else {
+ if (priv->xkb->indicators) {
+ priv->savedIndicators = *priv->xkb->indicators;
+ for (i = 0; i < XkbNumIndicators; i++)
+ if (priv->xkb->indicators->phys_indicators & (1 << i)) {
+ priv->xkb->indicators->maps[i].flags
+ = XkbIM_NoAutomatic;
+ }
+ XkbSetIndicatorMap(priv->display, ~0, priv->xkb);
+ }
+ }
+ }
+
+ XGetKeyboardControl(priv->display, &ks);
+ priv->savedKctrl.click = ks.key_click_percent;
+ priv->savedKctrl.bell = ks.bell_percent;
+ priv->savedKctrl.bell_pitch = ks.bell_pitch;
+ priv->savedKctrl.bell_duration = ks.bell_duration;
+ priv->savedKctrl.leds = ks.led_mask;
+ priv->savedKctrl.autoRepeat = ks.global_auto_repeat;
+ for (i = 0; i < 32; i++)
+ priv->savedKctrl.autoRepeats[i] = ks.auto_repeats[i];
+
+ dmxCommonKbdSetCtrl(priv->display, &priv->savedKctrl,
+ &priv->dmxLocal->kctrl);
+
+ priv->savedModMap = XGetModifierMapping(priv->display);
+
+ modmap = XNewModifiermap(0);
+ XSetModifierMapping(priv->display, modmap);
+ if (dmxInput->scrnIdx != -1)
+ dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
+ XFreeModifiermap(modmap);
+
+ priv->stateSaved = 1;
+}
+
+/** This routine restores all the information saved by #dmxCommonSaveState. */
+void
+dmxCommonRestoreState(pointer private)
+{
+ GETPRIVFROMPRIVATE;
+ int retcode = -1;
+ CARD32 start;
+
+ if (dmxInput->console)
+ priv = dmxInput->devs[0]->private;
+ if (!priv->stateSaved)
+ return;
+ priv->stateSaved = 0;
+
+ DMXDBG0("dmxCommonRestoreState\n");
+ if (priv->xkb) {
+ *priv->xkb->indicators = priv->savedIndicators;
+ XkbSetIndicatorMap(priv->display, ~0, priv->xkb);
+ XkbFreeKeyboard(priv->xkb, 0, True);
+ priv->xkb = 0;
+ }
+
+ for (start = GetTimeInMillis(); GetTimeInMillis() - start < 5000;) {
+ CARD32 tmp;
+
+ retcode = XSetModifierMapping(priv->display, priv->savedModMap);
+ if (retcode == MappingSuccess)
+ break;
+ if (retcode == MappingBusy)
+ dmxLogInput(dmxInput, "Keyboard busy, waiting\n");
+ else
+ dmxLogInput(dmxInput, "Keyboard error, waiting\n");
+
+ /* Don't generate X11 protocol for a bit */
+ for (tmp = GetTimeInMillis(); GetTimeInMillis() - tmp < 250;) {
+ usleep(250); /* This ends up sleeping only until
+ * the next key press generates an
+ * interruption. We make the delay
+ * relatively short in case the user
+ * pressed they keys quickly. */
+ }
+
+ }
+ if (retcode != MappingSuccess)
+ dmxLog(dmxWarning, "Unable to restore keyboard modifier state!\n");
+
+ XFreeModifiermap(priv->savedModMap);
+ priv->savedModMap = NULL;
+
+ dmxCommonKbdSetCtrl(priv->display, NULL, &priv->savedKctrl);
+ priv->kctrlset = 0; /* Invalidate copy */
+}
diff --git a/xorg-server/hw/dmx/input/dmxconsole.c b/xorg-server/hw/dmx/input/dmxconsole.c
index d4d73f2e8..f63772b17 100644
--- a/xorg-server/hw/dmx/input/dmxconsole.c
+++ b/xorg-server/hw/dmx/input/dmxconsole.c
@@ -1,1029 +1,1090 @@
-/*
- * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * David H. Dawes <dawes@xfree86.org>
- * Kevin E. Martin <kem@redhat.com>
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This file implements the console input devices.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_CONSOLE_DEBUG 0
-#define DMX_WINDOW_DEBUG 0
-
-#include "dmxinputinit.h"
-#include "dmxevents.h"
-#include "dmxconsole.h"
-#include "dmxcommon.h"
-#include "dmxscrinit.h"
-#include "dmxcb.h"
-#include "dmxsync.h"
-
-#include "inputstr.h"
-#include "input.h"
-#include "mipointer.h"
-#include "windowstr.h"
-
-#define CONSOLE_NUM 3
-#define CONSOLE_DEN 4
-#define DMX_CONSOLE_NAME "DMX Console"
-#define DMX_RES_NAME "Xdmx"
-#define DMX_RES_CLASS "XDmx"
-#define CONSOLE_BG_COLOR "gray75"
-#define CONSOLE_FG_COLOR "black"
-#define CONSOLE_SCREEN_BG_COLOR "white"
-#define CONSOLE_SCREEN_FG_COLOR "black"
-#define CONSOLE_SCREEN_DET_COLOR "gray75"
-#define CONSOLE_SCREEN_CUR_COLOR "red"
-
-#if DMX_CONSOLE_DEBUG
-#define DMXDBG0(f) dmxLog(dmxDebug,f)
-#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
-#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
-#else
-#define DMXDBG0(f)
-#define DMXDBG1(f,a)
-#define DMXDBG2(f,a,b)
-#define DMXDBG3(f,a,b,c)
-#define DMXDBG4(f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h)
-#endif
-
-/* Private area for consoles. */
-typedef struct _myPrivate {
- DMX_COMMON_PRIVATE;
- int lastX;
- int lastY;
- int globalX;
- int globalY;
- int curX;
- int curY;
- int width;
- int height;
- int consWidth;
- int consHeight;
- double xScale;
- double yScale;
- XlibGC gc, gcDet, gcRev, gcCur;
- int grabbed, fine, captured;
- Cursor cursorNormal, cursorGrabbed, cursorEmpty;
- Pixmap pixmap;
-
- CloseScreenProcPtr CloseScreen;
- struct _myPrivate *next; /* for closing multiple consoles */
- int initialized;
- DevicePtr mou, kbd;
-} myPrivate;
-
-static int scalex(myPrivate *priv, int x)
-{
- return (int)((x * priv->xScale) + .5);
-}
-
-static int scaley(myPrivate *priv, int y)
-{
- return (int)((y * priv->yScale) + .5);
-}
-
-static int unscalex(myPrivate *priv, int x)
-{
- return (int)((x / priv->xScale) + .5);
-}
-
-static int unscaley(myPrivate *priv, int y)
-{
- return (int)((y / priv->yScale) + .5);
-}
-
-/** Create the private area for \a pDevice. */
-pointer dmxConsoleCreatePrivate(DeviceIntPtr pDevice)
-{
- GETDMXLOCALFROMPDEVICE;
- myPrivate *priv = calloc(1, sizeof(*priv));
- priv->dmxLocal = dmxLocal;
- return priv;
-}
-
-/** If \a private is non-NULL, free its associated memory. */
-void dmxConsoleDestroyPrivate(pointer private)
-{
- free(private);
-}
-
-static void dmxConsoleDrawFineCursor(myPrivate *priv, XRectangle *rect)
-{
- int size = 6;
- int x, y;
-
- XDrawLine(priv->display, priv->pixmap, priv->gcCur,
- x = scalex(priv, priv->globalX) - size,
- scaley(priv, priv->globalY),
- scalex(priv, priv->globalX) + size,
- scaley(priv, priv->globalY));
- XDrawLine(priv->display, priv->pixmap, priv->gcCur,
- scalex(priv, priv->globalX),
- y = scaley(priv, priv->globalY) - size,
- scalex(priv, priv->globalX),
- scaley(priv, priv->globalY) + size);
- if (priv->grabbed) {
- XDrawLine(priv->display, priv->pixmap, priv->gcCur,
- scalex(priv, priv->globalX) - (int)(size / 1.4),
- scaley(priv, priv->globalY) - (int)(size / 1.4),
- scalex(priv, priv->globalX) + (int)(size / 1.4),
- scaley(priv, priv->globalY) + (int)(size / 1.4));
- XDrawLine(priv->display, priv->pixmap, priv->gcCur,
- scalex(priv, priv->globalX) - (int)(size / 1.4),
- scaley(priv, priv->globalY) + (int)(size / 1.4),
- scalex(priv, priv->globalX) + (int)(size / 1.4),
- scaley(priv, priv->globalY) - (int)(size / 1.4));
- }
- if (rect) {
- rect->x = x;
- rect->y = y;
- rect->width = 2 * size;
- rect->height = 2 * size;
- }
-}
-
-static void dmxConsoleDrawWindows(pointer private)
-{
- GETONLYPRIVFROMPRIVATE;
- Display *dpy = priv->display;
- int i;
- Region whole, used, avail;
- XRectangle rect;
-
- whole = XCreateRegion();
- used = XCreateRegion();
- avail = XCreateRegion();
- rect.x = 0;
- rect.y = 0;
- rect.width = priv->consWidth;
- rect.height = priv->consHeight;
- XUnionRectWithRegion(&rect, whole, whole);
-
- for (i = 0; i < dmxNumScreens; i++) {
- ScreenPtr pScreen = screenInfo.screens[i];
- WindowPtr pRoot = pScreen->root;
- WindowPtr pChild;
-
-#if DMX_WINDOW_DEBUG
- dmxLog(dmxDebug, "%lu %p %p %p 2\n",
- pRoot->drawable.id,
- pRoot->parent, pRoot->firstChild, pRoot->lastChild);
-#endif
-
- for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) {
- if (pChild->mapped
- && pChild->realized) {
-#if DMX_WINDOW_DEBUG
- dmxLog(dmxDebug, " %p %d,%d %dx%d %d %d %d RECTS\n",
- pChild,
- pChild->drawable.x,
- pChild->drawable.y,
- pChild->drawable.width,
- pChild->drawable.height,
- pChild->visibility,
- pChild->overrideRedirect,
- RegionNumRects(&pChild->clipList));
-#endif
- rect.x = scalex(priv, pChild->drawable.x + pScreen->x);
- rect.y = scaley(priv, pChild->drawable.y + pScreen->y);
- rect.width = scalex(priv, pChild->drawable.width);
- rect.height = scaley(priv, pChild->drawable.height);
- XDrawRectangle(dpy, priv->pixmap, priv->gc,
- rect.x, rect.y, rect.width, rect.height);
- XUnionRectWithRegion(&rect, used, used);
- XSubtractRegion(whole, used, avail);
- XSetRegion(dpy, priv->gc, avail);
- }
- }
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) break; /* Screen 0 valid with Xinerama */
-#endif
- }
- XDestroyRegion(avail);
- XDestroyRegion(used);
- XDestroyRegion(whole);
- XSetClipMask(dpy, priv->gc, None);
-}
-
-static void dmxConsoleDraw(myPrivate *priv, int updateCursor, int update)
-{
- GETDMXINPUTFROMPRIV;
- Display *dpy = priv->display;
- int i;
-
- XFillRectangle(dpy, priv->pixmap, priv->gc, 0, 0,
- priv->consWidth, priv->consHeight);
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- XFillRectangle(dpy, priv->pixmap,
- dmxScreen->beDisplay ? priv->gcRev : priv->gcDet,
- scalex(priv, screenInfo.screens[i]->x),
- scaley(priv, screenInfo.screens[i]->y),
- scalex(priv, screenInfo.screens[i]->width),
- scaley(priv, screenInfo.screens[i]->height));
- }
- for (i = 0; i < dmxNumScreens; i++) {
- XDrawRectangle(dpy, priv->pixmap, priv->gc,
- scalex(priv, screenInfo.screens[i]->x),
- scaley(priv, screenInfo.screens[i]->y),
- scalex(priv, screenInfo.screens[i]->width),
- scaley(priv, screenInfo.screens[i]->height));
- }
- if (dmxInput->windows) dmxConsoleDrawWindows(priv);
- if (priv->fine && updateCursor) dmxConsoleDrawFineCursor(priv, 0);
- if (update) {
- XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc,
- 0, 0, priv->consWidth, priv->consHeight, 0, 0);
- XSync(priv->display, False); /* Not a backend display */
- }
-}
-
-static void dmxConsoleClearCursor(myPrivate *priv, int x, int y,
- XRectangle *rect)
-{
- int cw = 14, ch = 14; /* Clear width and height */
-
- rect->x = scalex(priv, x) - cw/2;
- rect->y = scaley(priv, y) - ch/2;
- rect->width = cw;
- rect->height = ch;
- XSetClipRectangles(priv->display, priv->gc, 0, 0, rect, 1, Unsorted);
- XSetClipRectangles(priv->display, priv->gcDet, 0, 0, rect, 1, Unsorted);
- XSetClipRectangles(priv->display, priv->gcRev, 0, 0, rect, 1, Unsorted);
- dmxConsoleDraw(priv, 0, 0);
- XSetClipMask(priv->display, priv->gc, None);
- XSetClipMask(priv->display, priv->gcDet, None);
- XSetClipMask(priv->display, priv->gcRev, None);
-}
-
-
-static void dmxConsoleUpdateFineCursor(myPrivate *priv)
-{
- int leave = 0;
- XRectangle rects[2];
-
- dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rects[0]);
- if (priv->dmxLocal->sendsCore) {
- dmxGetGlobalPosition(&priv->globalX, &priv->globalY);
- } else {
- priv->globalX = priv->dmxLocal->lastX;
- priv->globalY = priv->dmxLocal->lastY;
- }
-
- priv->lastX = scalex(priv, priv->width / 2);
- priv->lastY = scaley(priv, priv->height / 2);
-
- /* Compute new warp position, which may be
- outside the window */
- if (priv->globalX < 1 || priv->globalX >= priv->width) {
- if (priv->globalX < 1) priv->lastX = 0;
- else priv->lastX = scalex(priv, priv->width);
- priv->lastY = scaley(priv, priv->globalY);
- ++leave;
- }
- if (priv->globalY < 1 || priv->globalY >= priv->height) {
- if (priv->globalY < 1) priv->lastY = 0;
- else priv->lastY = scaley(priv, priv->height);
- priv->lastX = scalex(priv, priv->globalX);
- ++leave;
- }
-
- /* Draw pseudo cursor in window */
- dmxConsoleDrawFineCursor(priv, &rects[1]);
-
- XSetClipRectangles(priv->display, priv->gc, 0, 0, rects, 2, Unsorted);
- XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc,
- 0, 0, priv->consWidth, priv->consHeight, 0, 0);
- XSetClipMask(priv->display, priv->gc, None);
-
- DMXDBG2("dmxConsoleUpdateFineCursor: WARP %d %d\n",
- priv->lastX, priv->lastY);
- XWarpPointer(priv->display, priv->window, priv->window,
- 0, 0, 0, 0, priv->lastX, priv->lastY);
- XSync(priv->display, False); /* Not a backend display */
-
- if (leave) {
- XEvent X;
- while (XCheckMaskEvent(priv->display, PointerMotionMask, &X)) {
- if (X.type == MotionNotify) {
- if (X.xmotion.x != priv->lastX || X.xmotion.y != priv->lastY) {
- DMXDBG4("Ignoring motion to %d %d after leave frm %d %d\n",
- X.xmotion.x, X.xmotion.y,
- priv->lastX, priv->lastY);
- }
- } else {
- dmxLog(dmxInfo, "Ignoring event (%d): %s ****************\n",
- X.type, dmxEventName(X.type));
- }
- }
- }
- DMXDBG6("dmxConsoleUpdateFineCursor: Warp %d %d on %d %d [%d %d]\n",
- priv->lastX, priv->lastY,
- scalex(priv, priv->width),
- scaley(priv, priv->height),
- priv->globalX, priv->globalY);
-}
-
-/** Whenever the window layout (size, position, stacking order) might be
- * changed, this routine is called with the \a pWindow that changed and
- * the \a type of change. This routine is called in a conservative
- * fashion: the actual layout of the windows of the screen might not
- * have had any human-visible changes. */
-void dmxConsoleUpdateInfo(pointer private, DMXUpdateType type,
- WindowPtr pWindow)
-{
- GETONLYPRIVFROMPRIVATE;
- dmxConsoleDraw(priv, 1, 1);
-}
-
-static void dmxConsoleMoveAbsolute(myPrivate *priv, int x, int y,
- DevicePtr pDev, dmxMotionProcPtr motion,
- DMXBlockType block)
-{
- int tmpX, tmpY, v[2];
-
- tmpX = unscalex(priv, x);
- tmpY = unscalex(priv, y);
- DMXDBG6("dmxConsoleMoveAbsolute(,%d,%d) %d %d =? %d %d\n",
- x, y, tmpX, tmpY, priv->curX, priv->curY);
- if (tmpX == priv->curX && tmpY == priv->curY) return;
- v[0] = unscalex(priv, x);
- v[1] = unscaley(priv, y);
- motion(pDev, v, 0, 2, DMX_ABSOLUTE_CONFINED, block);
- /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */
-}
-
-static void dmxConsoleMoveRelative(myPrivate *priv, int x, int y,
- DevicePtr pDev, dmxMotionProcPtr motion,
- DMXBlockType block)
-{
- int v[2];
- /* Ignore the event generated from * warping back to middle */
- if (x == priv->lastX && y == priv->lastY) return;
- v[0] = priv->lastX - x;
- v[1] = priv->lastY - y;
- motion(pDev, v, 0, 2, DMX_RELATIVE, block);
- /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */
-}
-
-/** This routine gets called from #dmxCoreMotion for each motion. This
- * allows the console's notion of the cursor postion to change when
- * another input device actually caused the change. */
-void dmxConsoleUpdatePosition(pointer private, int x, int y)
-{
- GETONLYPRIVFROMPRIVATE;
- int tmpX, tmpY;
- Display *dpy = priv->display;
- static unsigned long dmxGeneration = 0;
-
-
- tmpX = scalex(priv, x);
- tmpY = scaley(priv, y);
- DMXDBG6("dmxConsoleUpdatePosition(,%d,%d) new=%d,%d dims=%d,%d\n",
- x, y, tmpX, tmpY, priv->consWidth, priv->consHeight);
-
- if (priv->fine) dmxConsoleUpdateFineCursor(priv);
- if (tmpX != priv->curX || tmpY != priv->curY) {
- if (tmpX < 0) tmpX = 0;
- if (tmpY < 0) tmpY = 0;
- if (tmpX >= priv->consWidth) tmpX = priv->consWidth - 1;
- if (tmpY >= priv->consHeight) tmpY = priv->consHeight - 1;
- priv->curX = tmpX;
- priv->curY = tmpY;
- if (!priv->fine) {
- DMXDBG2(" WARP B %d %d\n", priv->curX, priv->curY);
- XWarpPointer(dpy, priv->window,
- priv->window, 0, 0, 0, 0, tmpX, tmpY);
- XSync(dpy, False); /* Not a backend display */
- }
- }
-
- if (dmxGeneration != serverGeneration) {
- dmxGeneration = serverGeneration;
- dmxConsoleDraw(priv, 1, 1);
- }
-}
-
-/** Collect all pending events from the console's display. Plase these
- * events on the server event queue using the \a motion and \a enqueue
- * routines. The \a checkspecial routine is used to check for special
- * keys that need handling. \a block tells if signals should be blocked
- * when updating the event queue. */
-void dmxConsoleCollectEvents(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- dmxCheckSpecialProcPtr checkspecial,
- DMXBlockType block)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
- Display *dpy = priv->display;
- Window win = priv->window;
- int width = priv->width;
- int height = priv->height;
- XEvent X, N;
- XSetWindowAttributes attribs;
- static int rInitialized = 0;
- static Region r;
- XRectangle rect;
- static int raising = 0, raiseX, raiseY; /* FIXME */
-
- while (XPending(dpy)) {
- XNextEvent(dpy, &X);
- switch(X.type) {
- case VisibilityNotify:
- break;
- case Expose:
- DMXDBG5("dmxConsoleCollectEvents: Expose #%d %d %d %d %d\n",
- X.xexpose.count,
- X.xexpose.x, X.xexpose.y,
- X.xexpose.width, X.xexpose.height);
- if (!rInitialized++) r = XCreateRegion();
- rect.x = X.xexpose.x;
- rect.y = X.xexpose.y;
- rect.width = X.xexpose.width;
- rect.height = X.xexpose.height;
- XUnionRectWithRegion(&rect, r, r);
- if (X.xexpose.count == 0) {
- XSetRegion(dpy, priv->gc, r);
- XSetRegion(dpy, priv->gcDet, r);
- XSetRegion(dpy, priv->gcRev, r);
- dmxConsoleDraw(priv, 1, 1);
- XSetClipMask(dpy, priv->gc, None);
- XSetClipMask(dpy, priv->gcDet, None);
- XSetClipMask(dpy, priv->gcRev, None);
- XDestroyRegion(r);
- rInitialized = 0;
- }
- break;
- case ResizeRequest:
- DMXDBG2("dmxConsoleCollectEvents: Resize %d %d\n",
- X.xresizerequest.width, X.xresizerequest.height);
- priv->consWidth = X.xresizerequest.width;
- priv->consHeight = X.xresizerequest.height;
- priv->xScale = (double)priv->consWidth / width;
- priv->yScale = (double)priv->consHeight / height;
- attribs.override_redirect = True;
- XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs);
- XResizeWindow(dpy, win, priv->consWidth, priv->consHeight);
- XFreePixmap(dpy, priv->pixmap);
- priv->pixmap = XCreatePixmap(dpy,
- RootWindow(dpy, DefaultScreen(dpy)),
- priv->consWidth,
- priv->consHeight,
- DefaultDepth(dpy,DefaultScreen(dpy)));
- dmxConsoleDraw(priv, 1, 1);
- attribs.override_redirect = False;
- XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs);
- break;
- case LeaveNotify:
- DMXDBG4("dmxConsoleCollectEvents: Leave @ %d,%d; r=%d f=%d\n",
- X.xcrossing.x, X.xcrossing.y, raising, priv->fine);
- if (!priv->captured) dmxCommonRestoreState(priv);
- else {
- dmxConsoleUncapture(dmxInput);
- dmxCommonRestoreState(priv);
- }
- break;
- case EnterNotify:
- DMXDBG6("dmxConsoleCollectEvents: Enter %d,%d r=%d f=%d (%d,%d)\n",
- X.xcrossing.x, X.xcrossing.y, raising, priv->fine,
- priv->curX, priv->curY);
- dmxCommonSaveState(priv);
- if (raising) {
- raising = 0;
- dmxConsoleMoveAbsolute(priv, raiseX, raiseY,
- priv->mou, motion, block);
- } else {
- if (priv->fine) {
- /* The raise will generate an event near the center,
- * which is not where the cursor should be. So we
- * save the real position, do the raise, and move
- * the cursor here again after the raise generates
- * the event. */
- raising = 1;
- raiseX = X.xcrossing.x;
- raiseY = X.xcrossing.y;
- XRaiseWindow(dpy, priv->window);
- }
- XSync(dpy, False); /* Not a backend display */
- if (!X.xcrossing.x && !X.xcrossing.y)
- dmxConsoleMoveAbsolute(priv, priv->curX, priv->curY,
- priv->mou, motion, block);
- }
- break;
- case MotionNotify:
- if (priv->curX == X.xmotion.x && priv->curY == X.xmotion.y)
- continue;
- if (XPending(dpy)) { /* do motion compression */
- XPeekEvent(dpy, &N);
- if (N.type == MotionNotify) continue;
- }
- DMXDBG2("dmxConsoleCollectEvents: Motion %d %d\n",
- X.xmotion.x, X.xmotion.y);
- if (raising) {
- raising = 0;
- dmxConsoleMoveAbsolute(priv, raiseX, raiseY,
- priv->mou, motion, block);
- } else {
- if (priv->fine)
- dmxConsoleMoveRelative(priv, X.xmotion.x, X.xmotion.y,
- priv->mou, motion, block);
- else
- dmxConsoleMoveAbsolute(priv, X.xmotion.x, X.xmotion.y,
- priv->mou, motion, block);
- }
- break;
- case KeyPress:
- case KeyRelease:
- enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
- break;
- default:
- /* Pass the whole event here, because
- * this may be an extension event. */
- enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
- break;
- }
- }
-}
-
-static void dmxCloseConsole(myPrivate *priv)
-{
- GETDMXINPUTFROMPRIV;
- dmxCommonRestoreState(priv);
- if (priv->display) {
- XFreeGC(priv->display, priv->gc);
- XFreeGC(priv->display, priv->gcDet);
- XFreeGC(priv->display, priv->gcRev);
- XFreeGC(priv->display, priv->gcCur);
- if (!dmxInput->console) XCloseDisplay(priv->display);
- }
- priv->display = NULL;
-}
-
-static Bool dmxCloseConsoleScreen(int idx, ScreenPtr pScreen)
-{
- myPrivate *priv, *last;
-
- for (last = priv = (myPrivate *)dixLookupPrivate(&pScreen->devPrivates,
- dmxScreenPrivateKey);
- priv;
- priv = priv->next) dmxCloseConsole(last = priv);
-
- DMX_UNWRAP(CloseScreen, last, pScreen);
- return pScreen->CloseScreen(idx, pScreen);
-}
-
-static Cursor dmxConsoleCreateEmptyCursor(myPrivate *priv)
-{
- char noCursorData[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- Pixmap pixmap;
- Cursor cursor;
- XColor color, tmpColor;
- Display *dpy = priv->display;
-
- /* Create empty cursor for window */
- pixmap = XCreateBitmapFromData(priv->display, priv->window,
- noCursorData, 8, 8);
- if (!XAllocNamedColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
- "black",
- &color,
- &tmpColor))
- dmxLog(dmxFatal, "Cannot allocate color for cursor\n");
- cursor = XCreatePixmapCursor(dpy, pixmap, pixmap, &color, &color, 0, 0);
- XFreePixmap(dpy, pixmap);
- return cursor;
-}
-
-static void dmxConsoleComputeWidthHeight(myPrivate *priv,
- int *width, int *height,
- double *xScale, double *yScale,
- int *consWidth, int *consHeight)
-{
- int screen;
- Display *dpy = priv->display;
-
- *width = 0;
- *height = 0;
- *xScale = 1.0;
- *yScale = 1.0;
-
- screen = DefaultScreen(dpy);
- *consWidth = DisplayWidth(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN;
- *consHeight = DisplayHeight(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN;
-
- if (*consWidth < 1) *consWidth = 1;
- if (*consHeight < 1) *consHeight = 1;
-
-#if 1
- /* Always keep the console size similar
- * to the global bounding box. */
- *width = dmxGlobalWidth;
- *height = dmxGlobalHeight;
-#else
- /* Make the console window as big as
- * possible by computing the visible
- * bounding box. */
- for (i = 0; i < dmxNumScreens; i++) {
- if (screenInfo.screens[i]->x+screenInfo.screens[i]->width > *width)
- *width = screenInfo.screens[i]->x+screenInfo.screens[i]->width;
-
- if (screenInfo.screens[i]->y+screenInfo.screens[i]->height > *height)
- *height = screenInfo.screens[i]->y+screenInfo.screens[i]->height;
- }
-#endif
-
- if ((double)*consWidth / *width < (double)*consHeight / *height)
- *xScale = *yScale = (double)*consWidth / *width;
- else
- *xScale = *yScale = (double)*consHeight / *height;
-
- *consWidth = scalex(priv, *width);
- *consHeight = scaley(priv, *height);
- if (*consWidth < 1) *consWidth = 1;
- if (*consHeight < 1) *consHeight = 1;
-}
-
-/** Re-initialized the console device described by \a pDev (after a
- * reconfig). */
-void dmxConsoleReInit(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- Display *dpy;
-
- if (!priv || !priv->initialized) return;
- dpy = priv->display;
-
- dmxConsoleComputeWidthHeight(priv,
- &priv->width, &priv->height,
- &priv->xScale, &priv->yScale,
- &priv->consWidth, &priv->consHeight);
- XResizeWindow(dpy, priv->window, priv->consWidth, priv->consHeight);
- XFreePixmap(dpy, priv->pixmap);
- priv->pixmap = XCreatePixmap(dpy,
- RootWindow(dpy, DefaultScreen(dpy)),
- priv->consWidth,
- priv->consHeight,
- DefaultDepth(dpy,DefaultScreen(dpy)));
- dmxConsoleDraw(priv, 1, 1);
-}
-
-/** Initialized the console device described by \a pDev. */
-void dmxConsoleInit(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
- int screen;
- unsigned long mask;
- XSetWindowAttributes attribs;
- Display *dpy;
- Window win;
- XGCValues gcvals;
- XColor color;
- XClassHint class_hints;
- unsigned long tmp;
-
- if (dmxLocal->type == DMX_LOCAL_MOUSE) priv->mou = pDev;
- if (dmxLocal->type == DMX_LOCAL_KEYBOARD) priv->kbd = pDev;
- if (priv->initialized++) return; /* Only do once for mouse/keyboard pair */
-
- if (!(dpy = priv->display = XOpenDisplay(dmxInput->name)))
- dmxLog(dmxFatal,
- "dmxOpenConsole: cannot open console display %s\n",
- dmxInput->name);
-
- /* Set up defaults */
- dmxConsoleComputeWidthHeight(priv,
- &priv->width, &priv->height,
- &priv->xScale, &priv->yScale,
- &priv->consWidth, &priv->consHeight);
-
- /* Private initialization using computed values or constants. */
- screen = DefaultScreen(dpy);
- priv->initPointerX = scalex(priv, priv->width / 2);
- priv->initPointerY = scaley(priv, priv->height / 2);
- priv->eventMask = (ButtonPressMask
- | ButtonReleaseMask
- | PointerMotionMask
- | EnterWindowMask
- | LeaveWindowMask
- | KeyPressMask
- | KeyReleaseMask
- | ExposureMask
- | ResizeRedirectMask);
-
- mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
- attribs.colormap = DefaultColormap(dpy, screen);
- if (XParseColor(dpy, attribs.colormap, CONSOLE_BG_COLOR, &color)
- && XAllocColor(dpy, attribs.colormap, &color)) {
- attribs.background_pixel = color.pixel;
- } else
- attribs.background_pixel = WhitePixel(dpy, screen);
-
- attribs.event_mask = priv->eventMask;
- attribs.override_redirect = False;
-
- win = priv->window = XCreateWindow(dpy,
- RootWindow(dpy, screen),
- 0, 0, priv->consWidth, priv->consHeight,
- 0,
- DefaultDepth(dpy, screen),
- InputOutput,
- DefaultVisual(dpy, screen),
- mask, &attribs);
- priv->pixmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
- priv->consWidth, priv->consHeight,
- DefaultDepth(dpy, screen));
-
- /* Set up properties */
- XStoreName(dpy, win, DMX_CONSOLE_NAME);
- class_hints.res_name = DMX_RES_NAME;
- class_hints.res_class = DMX_RES_CLASS;
- XSetClassHint(dpy, win, &class_hints);
-
-
- /* Map the window */
- XMapWindow(dpy, win);
-
- /* Create cursors */
- priv->cursorNormal = XCreateFontCursor(dpy, XC_circle);
- priv->cursorGrabbed = XCreateFontCursor(dpy, XC_spider);
- priv->cursorEmpty = dmxConsoleCreateEmptyCursor(priv);
- XDefineCursor(dpy, priv->window, priv->cursorNormal);
-
- /* Create GC */
- mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground |
- GCBackground | GCLineWidth | GCLineStyle | GCCapStyle |
- GCFillStyle | GCGraphicsExposures);
- gcvals.function = GXcopy;
- gcvals.plane_mask = AllPlanes;
- gcvals.clip_mask = None;
- if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_FG_COLOR, &color)
- && XAllocColor(dpy, attribs.colormap, &color)) {
- gcvals.foreground = color.pixel;
- } else
- gcvals.foreground = BlackPixel(dpy, screen);
- if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_BG_COLOR, &color)
- && XAllocColor(dpy, attribs.colormap, &color)) {
- gcvals.background = color.pixel;
- } else
- gcvals.background = WhitePixel(dpy, screen);
- gcvals.line_width = 0;
- gcvals.line_style = LineSolid;
- gcvals.cap_style = CapNotLast;
- gcvals.fill_style = FillSolid;
- gcvals.graphics_exposures = False;
-
- priv->gc = XCreateGC(dpy, win, mask, &gcvals);
-
- tmp = gcvals.foreground;
- if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_DET_COLOR, &color)
- && XAllocColor(dpy, attribs.colormap, &color)) {
- gcvals.foreground = color.pixel;
- } else
- gcvals.foreground = BlackPixel(dpy, screen);
- priv->gcDet = XCreateGC(dpy, win, mask, &gcvals);
- gcvals.foreground = tmp;
-
- tmp = gcvals.background;
- gcvals.background = gcvals.foreground;
- gcvals.foreground = tmp;
- priv->gcRev = XCreateGC(dpy, win, mask, &gcvals);
-
- gcvals.background = gcvals.foreground;
- if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_CUR_COLOR, &color)
- && XAllocColor(dpy, attribs.colormap, &color)) {
- gcvals.foreground = color.pixel;
- } else
- gcvals.foreground = BlackPixel(dpy, screen);
- priv->gcCur = XCreateGC(dpy, win, mask, &gcvals);
-
- dmxConsoleDraw(priv, 1, 1);
-
- if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
- dmxScreenPrivateKey))
- priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
- dmxScreenPrivateKey);
- else
- DMX_WRAP(CloseScreen, dmxCloseConsoleScreen,
- priv, screenInfo.screens[0]);
- dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey,
- priv);
-}
-
-/** Fill in the \a info structure for the specified \a pDev. Only used
- * for pointers. */
-void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- GETPRIVFROMPDEV;
-
- info->buttonClass = 1;
- dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->minval[1] = 0;
- /* max possible console window size: */
- info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display));
- info->maxval[1] = DisplayHeight(priv->display, DefaultScreen(priv->display));
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
- info->ptrFeedbackClass = 1;
-}
-
-/** Fill in the \a info structure for the specified \a pDev. Only used
- * for keyboard. */
-void dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- dmxCommonKbdGetInfo(pDev, info);
- info->keyboard = 1;
- info->keyClass = 1;
- dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap);
- info->freemap = 1;
- info->focusClass = 1;
- info->kbdFeedbackClass = 1;
-}
-
-/** Handle special console-only keys. */
-int dmxConsoleFunctions(pointer private, DMXFunctionType function)
-{
- GETONLYPRIVFROMPRIVATE;
- XRectangle rect;
- Display *dpy = priv->display;
-
- switch (function) {
- case DMX_FUNCTION_FINE:
- if (priv->fine) {
- priv->fine = 0;
- dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rect);
- XSetClipRectangles(dpy, priv->gc, 0, 0, &rect, 1, Unsorted);
- XCopyArea(dpy, priv->pixmap, priv->window, priv->gc,
- 0, 0, priv->consWidth, priv->consHeight, 0, 0);
- XSetClipMask(dpy, priv->gc, None);
-
- XDefineCursor(dpy, priv->window,
- priv->grabbed
- ? priv->cursorGrabbed
- : priv->cursorNormal);
- XWarpPointer(dpy, priv->window, priv->window,
- 0, 0, 0, 0,
- scalex(priv, priv->globalX),
- scaley(priv, priv->globalY));
- XSync(dpy, False); /* Not a backend display */
- } else {
- priv->fine = 1;
- XRaiseWindow(dpy, priv->window);
- XDefineCursor(dpy, priv->window, priv->cursorEmpty);
- dmxConsoleUpdateFineCursor(priv);
- }
- return 1;
- case DMX_FUNCTION_GRAB:
- if (priv->grabbed) {
- XUngrabKeyboard(dpy, CurrentTime);
- XUngrabPointer(dpy, CurrentTime);
- XDefineCursor(dpy, priv->window,
- priv->fine
- ? priv->cursorEmpty
- : priv->cursorNormal);
- } else {
- if (XGrabPointer(dpy, priv->window, True,
- 0, GrabModeAsync, GrabModeAsync, priv->window,
- None, CurrentTime)) {
- dmxLog(dmxError, "XGrabPointer failed\n");
- return 0;
- }
- if (XGrabKeyboard(dpy, priv->window, True,
- GrabModeAsync, GrabModeAsync, CurrentTime)) {
- dmxLog(dmxError, "XGrabKeyboard failed\n");
- XUngrabPointer(dpy, CurrentTime);
- return 0;
- }
- XDefineCursor(dpy, priv->window,
- priv->fine
- ? priv->cursorEmpty
- : priv->cursorGrabbed);
- }
- priv->grabbed = !priv->grabbed;
- if (priv->fine) dmxConsoleUpdateFineCursor(priv);
- return 1;
- case DMX_FUNCTION_TERMINATE:
- return 1;
- default:
- return 0;
- }
-}
-
-static void dmxDump(void)
-{
- int i, j;
- DMXInputInfo *dmxInput;
- XEvent X;
-
- for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
- for (j = 0; j < dmxInput->numDevs; j++) {
- DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
- myPrivate *priv = dmxLocal->private;
- while (priv
- && priv->display
- && XCheckTypedEvent(priv->display, MotionNotify, &X)) {
- DMXDBG4("dmxDump: %s/%d threw event away %d %s\n",
- dmxInput->name, j, X.type, dmxEventName(X.type));
- }
- }
- }
-}
-
-/** This routine is used to warp the pointer into the console window
- * from anywhere on the screen. It is used when backend and console
- * input are both being taken from the same X display. */
-void dmxConsoleCapture(DMXInputInfo *dmxInput)
-{
- int i;
- XEvent X;
-
- DMXDBG0("dmxConsoleCapture\n");
- dmxSync(NULL, TRUE);
- for (i = 0; i < dmxInput->numDevs; i++) {
- DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
- myPrivate *priv = dmxLocal->private;
- if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) continue;
- if (dmxLocal->type != DMX_LOCAL_MOUSE) continue;
- if (priv->captured) continue;
- priv->captured = 2; /* Ungrab only after proximal events. */
- XRaiseWindow(priv->display, priv->window);
- XSync(priv->display, False); /* Not a backend display */
- while (XCheckTypedEvent(priv->display, MotionNotify, &X)) {
- DMXDBG3(" Ignoring motion to %d %d after capture on %s\n",
- X.xmotion.x, X.xmotion.y, dmxInput->name);
- }
- XWarpPointer(priv->display, None,
- priv->window, 0, 0, 0, 0, priv->curX, priv->curY);
- XSync(priv->display, False); /* Not a backend display */
- dmxDump();
- if (priv->fine) dmxConsoleUpdateFineCursor(priv);
- }
-}
-
-/** Undo the capture that was done by #dmxConsoleCapture. */
-void dmxConsoleUncapture(DMXInputInfo *dmxInput)
-{
- int i;
-
- DMXDBG0("dmxConsoleUncapture\n");
- dmxSync(NULL, TRUE);
- for (i = 0; i < dmxInput->numDevs; i++) {
- DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
- myPrivate *priv = dmxLocal->private;
- if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) continue;
- if (dmxLocal->type != DMX_LOCAL_MOUSE) continue;
- if (!priv->captured) continue;
- priv->captured = 0;
- XSync(priv->display, False); /* Not a backend display */
- }
-}
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This file implements the console input devices.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_CONSOLE_DEBUG 0
+#define DMX_WINDOW_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxevents.h"
+#include "dmxconsole.h"
+#include "dmxcommon.h"
+#include "dmxscrinit.h"
+#include "dmxcb.h"
+#include "dmxsync.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include "mipointer.h"
+#include "windowstr.h"
+
+#define CONSOLE_NUM 3
+#define CONSOLE_DEN 4
+#define DMX_CONSOLE_NAME "DMX Console"
+#define DMX_RES_NAME "Xdmx"
+#define DMX_RES_CLASS "XDmx"
+#define CONSOLE_BG_COLOR "gray75"
+#define CONSOLE_FG_COLOR "black"
+#define CONSOLE_SCREEN_BG_COLOR "white"
+#define CONSOLE_SCREEN_FG_COLOR "black"
+#define CONSOLE_SCREEN_DET_COLOR "gray75"
+#define CONSOLE_SCREEN_CUR_COLOR "red"
+
+#if DMX_CONSOLE_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#endif
+
+/* Private area for consoles. */
+typedef struct _myPrivate {
+ DMX_COMMON_PRIVATE;
+ int lastX;
+ int lastY;
+ int globalX;
+ int globalY;
+ int curX;
+ int curY;
+ int width;
+ int height;
+ int consWidth;
+ int consHeight;
+ double xScale;
+ double yScale;
+ XlibGC gc, gcDet, gcRev, gcCur;
+ int grabbed, fine, captured;
+ Cursor cursorNormal, cursorGrabbed, cursorEmpty;
+ Pixmap pixmap;
+
+ CloseScreenProcPtr CloseScreen;
+ struct _myPrivate *next; /* for closing multiple consoles */
+ int initialized;
+ DevicePtr mou, kbd;
+} myPrivate;
+
+static int
+scalex(myPrivate * priv, int x)
+{
+ return (int) ((x * priv->xScale) + .5);
+}
+
+static int
+scaley(myPrivate * priv, int y)
+{
+ return (int) ((y * priv->yScale) + .5);
+}
+
+static int
+unscalex(myPrivate * priv, int x)
+{
+ return (int) ((x / priv->xScale) + .5);
+}
+
+static int
+unscaley(myPrivate * priv, int y)
+{
+ return (int) ((y / priv->yScale) + .5);
+}
+
+/** Create the private area for \a pDevice. */
+pointer
+dmxConsoleCreatePrivate(DeviceIntPtr pDevice)
+{
+ GETDMXLOCALFROMPDEVICE;
+ myPrivate *priv = calloc(1, sizeof(*priv));
+
+ priv->dmxLocal = dmxLocal;
+ return priv;
+}
+
+/** If \a private is non-NULL, free its associated memory. */
+void
+dmxConsoleDestroyPrivate(pointer private)
+{
+ free(private);
+}
+
+static void
+dmxConsoleDrawFineCursor(myPrivate * priv, XRectangle * rect)
+{
+ int size = 6;
+ int x, y;
+
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ x = scalex(priv, priv->globalX) - size,
+ scaley(priv, priv->globalY),
+ scalex(priv, priv->globalX) + size, scaley(priv, priv->globalY));
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ scalex(priv, priv->globalX),
+ y = scaley(priv, priv->globalY) - size,
+ scalex(priv, priv->globalX), scaley(priv, priv->globalY) + size);
+ if (priv->grabbed) {
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ scalex(priv, priv->globalX) - (int) (size / 1.4),
+ scaley(priv, priv->globalY) - (int) (size / 1.4),
+ scalex(priv, priv->globalX) + (int) (size / 1.4),
+ scaley(priv, priv->globalY) + (int) (size / 1.4));
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ scalex(priv, priv->globalX) - (int) (size / 1.4),
+ scaley(priv, priv->globalY) + (int) (size / 1.4),
+ scalex(priv, priv->globalX) + (int) (size / 1.4),
+ scaley(priv, priv->globalY) - (int) (size / 1.4));
+ }
+ if (rect) {
+ rect->x = x;
+ rect->y = y;
+ rect->width = 2 * size;
+ rect->height = 2 * size;
+ }
+}
+
+static void
+dmxConsoleDrawWindows(pointer private)
+{
+ GETONLYPRIVFROMPRIVATE;
+ Display *dpy = priv->display;
+ int i;
+ Region whole, used, avail;
+ XRectangle rect;
+
+ whole = XCreateRegion();
+ used = XCreateRegion();
+ avail = XCreateRegion();
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = priv->consWidth;
+ rect.height = priv->consHeight;
+ XUnionRectWithRegion(&rect, whole, whole);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ WindowPtr pRoot = pScreen->root;
+ WindowPtr pChild;
+
+#if DMX_WINDOW_DEBUG
+ dmxLog(dmxDebug, "%lu %p %p %p 2\n",
+ pRoot->drawable.id,
+ pRoot->parent, pRoot->firstChild, pRoot->lastChild);
+#endif
+
+ for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) {
+ if (pChild->mapped && pChild->realized) {
+#if DMX_WINDOW_DEBUG
+ dmxLog(dmxDebug, " %p %d,%d %dx%d %d %d %d RECTS\n",
+ pChild,
+ pChild->drawable.x,
+ pChild->drawable.y,
+ pChild->drawable.width,
+ pChild->drawable.height,
+ pChild->visibility,
+ pChild->overrideRedirect,
+ RegionNumRects(&pChild->clipList));
+#endif
+ rect.x = scalex(priv, pChild->drawable.x + pScreen->x);
+ rect.y = scaley(priv, pChild->drawable.y + pScreen->y);
+ rect.width = scalex(priv, pChild->drawable.width);
+ rect.height = scaley(priv, pChild->drawable.height);
+ XDrawRectangle(dpy, priv->pixmap, priv->gc,
+ rect.x, rect.y, rect.width, rect.height);
+ XUnionRectWithRegion(&rect, used, used);
+ XSubtractRegion(whole, used, avail);
+ XSetRegion(dpy, priv->gc, avail);
+ }
+ }
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension)
+ break; /* Screen 0 valid with Xinerama */
+#endif
+ }
+ XDestroyRegion(avail);
+ XDestroyRegion(used);
+ XDestroyRegion(whole);
+ XSetClipMask(dpy, priv->gc, None);
+}
+
+static void
+dmxConsoleDraw(myPrivate * priv, int updateCursor, int update)
+{
+ GETDMXINPUTFROMPRIV;
+ Display *dpy = priv->display;
+ int i;
+
+ XFillRectangle(dpy, priv->pixmap, priv->gc, 0, 0,
+ priv->consWidth, priv->consHeight);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ XFillRectangle(dpy, priv->pixmap,
+ dmxScreen->beDisplay ? priv->gcRev : priv->gcDet,
+ scalex(priv, screenInfo.screens[i]->x),
+ scaley(priv, screenInfo.screens[i]->y),
+ scalex(priv, screenInfo.screens[i]->width),
+ scaley(priv, screenInfo.screens[i]->height));
+ }
+ for (i = 0; i < dmxNumScreens; i++) {
+ XDrawRectangle(dpy, priv->pixmap, priv->gc,
+ scalex(priv, screenInfo.screens[i]->x),
+ scaley(priv, screenInfo.screens[i]->y),
+ scalex(priv, screenInfo.screens[i]->width),
+ scaley(priv, screenInfo.screens[i]->height));
+ }
+ if (dmxInput->windows)
+ dmxConsoleDrawWindows(priv);
+ if (priv->fine && updateCursor)
+ dmxConsoleDrawFineCursor(priv, 0);
+ if (update) {
+ XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc,
+ 0, 0, priv->consWidth, priv->consHeight, 0, 0);
+ XSync(priv->display, False); /* Not a backend display */
+ }
+}
+
+static void
+dmxConsoleClearCursor(myPrivate * priv, int x, int y, XRectangle * rect)
+{
+ int cw = 14, ch = 14; /* Clear width and height */
+
+ rect->x = scalex(priv, x) - cw / 2;
+ rect->y = scaley(priv, y) - ch / 2;
+ rect->width = cw;
+ rect->height = ch;
+ XSetClipRectangles(priv->display, priv->gc, 0, 0, rect, 1, Unsorted);
+ XSetClipRectangles(priv->display, priv->gcDet, 0, 0, rect, 1, Unsorted);
+ XSetClipRectangles(priv->display, priv->gcRev, 0, 0, rect, 1, Unsorted);
+ dmxConsoleDraw(priv, 0, 0);
+ XSetClipMask(priv->display, priv->gc, None);
+ XSetClipMask(priv->display, priv->gcDet, None);
+ XSetClipMask(priv->display, priv->gcRev, None);
+}
+
+static void
+dmxConsoleUpdateFineCursor(myPrivate * priv)
+{
+ int leave = 0;
+ XRectangle rects[2];
+
+ dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rects[0]);
+ if (priv->dmxLocal->sendsCore) {
+ dmxGetGlobalPosition(&priv->globalX, &priv->globalY);
+ }
+ else {
+ priv->globalX = priv->dmxLocal->lastX;
+ priv->globalY = priv->dmxLocal->lastY;
+ }
+
+ priv->lastX = scalex(priv, priv->width / 2);
+ priv->lastY = scaley(priv, priv->height / 2);
+
+ /* Compute new warp position, which may be
+ outside the window */
+ if (priv->globalX < 1 || priv->globalX >= priv->width) {
+ if (priv->globalX < 1)
+ priv->lastX = 0;
+ else
+ priv->lastX = scalex(priv, priv->width);
+ priv->lastY = scaley(priv, priv->globalY);
+ ++leave;
+ }
+ if (priv->globalY < 1 || priv->globalY >= priv->height) {
+ if (priv->globalY < 1)
+ priv->lastY = 0;
+ else
+ priv->lastY = scaley(priv, priv->height);
+ priv->lastX = scalex(priv, priv->globalX);
+ ++leave;
+ }
+
+ /* Draw pseudo cursor in window */
+ dmxConsoleDrawFineCursor(priv, &rects[1]);
+
+ XSetClipRectangles(priv->display, priv->gc, 0, 0, rects, 2, Unsorted);
+ XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc,
+ 0, 0, priv->consWidth, priv->consHeight, 0, 0);
+ XSetClipMask(priv->display, priv->gc, None);
+
+ DMXDBG2("dmxConsoleUpdateFineCursor: WARP %d %d\n",
+ priv->lastX, priv->lastY);
+ XWarpPointer(priv->display, priv->window, priv->window,
+ 0, 0, 0, 0, priv->lastX, priv->lastY);
+ XSync(priv->display, False); /* Not a backend display */
+
+ if (leave) {
+ XEvent X;
+
+ while (XCheckMaskEvent(priv->display, PointerMotionMask, &X)) {
+ if (X.type == MotionNotify) {
+ if (X.xmotion.x != priv->lastX || X.xmotion.y != priv->lastY) {
+ DMXDBG4("Ignoring motion to %d %d after leave frm %d %d\n",
+ X.xmotion.x, X.xmotion.y, priv->lastX, priv->lastY);
+ }
+ }
+ else {
+ dmxLog(dmxInfo, "Ignoring event (%d): %s ****************\n",
+ X.type, dmxEventName(X.type));
+ }
+ }
+ }
+ DMXDBG6("dmxConsoleUpdateFineCursor: Warp %d %d on %d %d [%d %d]\n",
+ priv->lastX, priv->lastY,
+ scalex(priv, priv->width),
+ scaley(priv, priv->height), priv->globalX, priv->globalY);
+}
+
+/** Whenever the window layout (size, position, stacking order) might be
+ * changed, this routine is called with the \a pWindow that changed and
+ * the \a type of change. This routine is called in a conservative
+ * fashion: the actual layout of the windows of the screen might not
+ * have had any human-visible changes. */
+void
+dmxConsoleUpdateInfo(pointer private, DMXUpdateType type, WindowPtr pWindow)
+{
+ GETONLYPRIVFROMPRIVATE;
+ dmxConsoleDraw(priv, 1, 1);
+}
+
+static void
+dmxConsoleMoveAbsolute(myPrivate * priv, int x, int y,
+ DevicePtr pDev, dmxMotionProcPtr motion,
+ DMXBlockType block)
+{
+ int tmpX, tmpY, v[2];
+
+ tmpX = unscalex(priv, x);
+ tmpY = unscalex(priv, y);
+ DMXDBG6("dmxConsoleMoveAbsolute(,%d,%d) %d %d =? %d %d\n",
+ x, y, tmpX, tmpY, priv->curX, priv->curY);
+ if (tmpX == priv->curX && tmpY == priv->curY)
+ return;
+ v[0] = unscalex(priv, x);
+ v[1] = unscaley(priv, y);
+ motion(pDev, v, 0, 2, DMX_ABSOLUTE_CONFINED, block);
+ /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */
+}
+
+static void
+dmxConsoleMoveRelative(myPrivate * priv, int x, int y,
+ DevicePtr pDev, dmxMotionProcPtr motion,
+ DMXBlockType block)
+{
+ int v[2];
+
+ /* Ignore the event generated from * warping back to middle */
+ if (x == priv->lastX && y == priv->lastY)
+ return;
+ v[0] = priv->lastX - x;
+ v[1] = priv->lastY - y;
+ motion(pDev, v, 0, 2, DMX_RELATIVE, block);
+ /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */
+}
+
+/** This routine gets called from #dmxCoreMotion for each motion. This
+ * allows the console's notion of the cursor postion to change when
+ * another input device actually caused the change. */
+void
+dmxConsoleUpdatePosition(pointer private, int x, int y)
+{
+ GETONLYPRIVFROMPRIVATE;
+ int tmpX, tmpY;
+ Display *dpy = priv->display;
+ static unsigned long dmxGeneration = 0;
+
+ tmpX = scalex(priv, x);
+ tmpY = scaley(priv, y);
+ DMXDBG6("dmxConsoleUpdatePosition(,%d,%d) new=%d,%d dims=%d,%d\n",
+ x, y, tmpX, tmpY, priv->consWidth, priv->consHeight);
+
+ if (priv->fine)
+ dmxConsoleUpdateFineCursor(priv);
+ if (tmpX != priv->curX || tmpY != priv->curY) {
+ if (tmpX < 0)
+ tmpX = 0;
+ if (tmpY < 0)
+ tmpY = 0;
+ if (tmpX >= priv->consWidth)
+ tmpX = priv->consWidth - 1;
+ if (tmpY >= priv->consHeight)
+ tmpY = priv->consHeight - 1;
+ priv->curX = tmpX;
+ priv->curY = tmpY;
+ if (!priv->fine) {
+ DMXDBG2(" WARP B %d %d\n", priv->curX, priv->curY);
+ XWarpPointer(dpy, priv->window,
+ priv->window, 0, 0, 0, 0, tmpX, tmpY);
+ XSync(dpy, False); /* Not a backend display */
+ }
+ }
+
+ if (dmxGeneration != serverGeneration) {
+ dmxGeneration = serverGeneration;
+ dmxConsoleDraw(priv, 1, 1);
+ }
+}
+
+/** Collect all pending events from the console's display. Plase these
+ * events on the server event queue using the \a motion and \a enqueue
+ * routines. The \a checkspecial routine is used to check for special
+ * keys that need handling. \a block tells if signals should be blocked
+ * when updating the event queue. */
+void
+dmxConsoleCollectEvents(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial, DMXBlockType block)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ Display *dpy = priv->display;
+ Window win = priv->window;
+ int width = priv->width;
+ int height = priv->height;
+ XEvent X, N;
+ XSetWindowAttributes attribs;
+ static int rInitialized = 0;
+ static Region r;
+ XRectangle rect;
+ static int raising = 0, raiseX, raiseY; /* FIXME */
+
+ while (XPending(dpy)) {
+ XNextEvent(dpy, &X);
+ switch (X.type) {
+ case VisibilityNotify:
+ break;
+ case Expose:
+ DMXDBG5("dmxConsoleCollectEvents: Expose #%d %d %d %d %d\n",
+ X.xexpose.count,
+ X.xexpose.x, X.xexpose.y,
+ X.xexpose.width, X.xexpose.height);
+ if (!rInitialized++)
+ r = XCreateRegion();
+ rect.x = X.xexpose.x;
+ rect.y = X.xexpose.y;
+ rect.width = X.xexpose.width;
+ rect.height = X.xexpose.height;
+ XUnionRectWithRegion(&rect, r, r);
+ if (X.xexpose.count == 0) {
+ XSetRegion(dpy, priv->gc, r);
+ XSetRegion(dpy, priv->gcDet, r);
+ XSetRegion(dpy, priv->gcRev, r);
+ dmxConsoleDraw(priv, 1, 1);
+ XSetClipMask(dpy, priv->gc, None);
+ XSetClipMask(dpy, priv->gcDet, None);
+ XSetClipMask(dpy, priv->gcRev, None);
+ XDestroyRegion(r);
+ rInitialized = 0;
+ }
+ break;
+ case ResizeRequest:
+ DMXDBG2("dmxConsoleCollectEvents: Resize %d %d\n",
+ X.xresizerequest.width, X.xresizerequest.height);
+ priv->consWidth = X.xresizerequest.width;
+ priv->consHeight = X.xresizerequest.height;
+ priv->xScale = (double) priv->consWidth / width;
+ priv->yScale = (double) priv->consHeight / height;
+ attribs.override_redirect = True;
+ XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs);
+ XResizeWindow(dpy, win, priv->consWidth, priv->consHeight);
+ XFreePixmap(dpy, priv->pixmap);
+ priv->pixmap = XCreatePixmap(dpy,
+ RootWindow(dpy, DefaultScreen(dpy)),
+ priv->consWidth,
+ priv->consHeight,
+ DefaultDepth(dpy, DefaultScreen(dpy)));
+ dmxConsoleDraw(priv, 1, 1);
+ attribs.override_redirect = False;
+ XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs);
+ break;
+ case LeaveNotify:
+ DMXDBG4("dmxConsoleCollectEvents: Leave @ %d,%d; r=%d f=%d\n",
+ X.xcrossing.x, X.xcrossing.y, raising, priv->fine);
+ if (!priv->captured)
+ dmxCommonRestoreState(priv);
+ else {
+ dmxConsoleUncapture(dmxInput);
+ dmxCommonRestoreState(priv);
+ }
+ break;
+ case EnterNotify:
+ DMXDBG6("dmxConsoleCollectEvents: Enter %d,%d r=%d f=%d (%d,%d)\n",
+ X.xcrossing.x, X.xcrossing.y, raising, priv->fine,
+ priv->curX, priv->curY);
+ dmxCommonSaveState(priv);
+ if (raising) {
+ raising = 0;
+ dmxConsoleMoveAbsolute(priv, raiseX, raiseY,
+ priv->mou, motion, block);
+ }
+ else {
+ if (priv->fine) {
+ /* The raise will generate an event near the center,
+ * which is not where the cursor should be. So we
+ * save the real position, do the raise, and move
+ * the cursor here again after the raise generates
+ * the event. */
+ raising = 1;
+ raiseX = X.xcrossing.x;
+ raiseY = X.xcrossing.y;
+ XRaiseWindow(dpy, priv->window);
+ }
+ XSync(dpy, False); /* Not a backend display */
+ if (!X.xcrossing.x && !X.xcrossing.y)
+ dmxConsoleMoveAbsolute(priv, priv->curX, priv->curY,
+ priv->mou, motion, block);
+ }
+ break;
+ case MotionNotify:
+ if (priv->curX == X.xmotion.x && priv->curY == X.xmotion.y)
+ continue;
+ if (XPending(dpy)) { /* do motion compression */
+ XPeekEvent(dpy, &N);
+ if (N.type == MotionNotify)
+ continue;
+ }
+ DMXDBG2("dmxConsoleCollectEvents: Motion %d %d\n",
+ X.xmotion.x, X.xmotion.y);
+ if (raising) {
+ raising = 0;
+ dmxConsoleMoveAbsolute(priv, raiseX, raiseY,
+ priv->mou, motion, block);
+ }
+ else {
+ if (priv->fine)
+ dmxConsoleMoveRelative(priv, X.xmotion.x, X.xmotion.y,
+ priv->mou, motion, block);
+ else
+ dmxConsoleMoveAbsolute(priv, X.xmotion.x, X.xmotion.y,
+ priv->mou, motion, block);
+ }
+ break;
+ case KeyPress:
+ case KeyRelease:
+ enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
+ break;
+ default:
+ /* Pass the whole event here, because
+ * this may be an extension event. */
+ enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
+ break;
+ }
+ }
+}
+
+static void
+dmxCloseConsole(myPrivate * priv)
+{
+ GETDMXINPUTFROMPRIV;
+ dmxCommonRestoreState(priv);
+ if (priv->display) {
+ XFreeGC(priv->display, priv->gc);
+ XFreeGC(priv->display, priv->gcDet);
+ XFreeGC(priv->display, priv->gcRev);
+ XFreeGC(priv->display, priv->gcCur);
+ if (!dmxInput->console)
+ XCloseDisplay(priv->display);
+ }
+ priv->display = NULL;
+}
+
+static Bool
+dmxCloseConsoleScreen(int idx, ScreenPtr pScreen)
+{
+ myPrivate *priv, *last;
+
+ for (last = priv = (myPrivate *) dixLookupPrivate(&pScreen->devPrivates,
+ dmxScreenPrivateKey);
+ priv; priv = priv->next)
+ dmxCloseConsole(last = priv);
+
+ DMX_UNWRAP(CloseScreen, last, pScreen);
+ return pScreen->CloseScreen(idx, pScreen);
+}
+
+static Cursor
+dmxConsoleCreateEmptyCursor(myPrivate * priv)
+{
+ char noCursorData[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ Pixmap pixmap;
+ Cursor cursor;
+ XColor color, tmpColor;
+ Display *dpy = priv->display;
+
+ /* Create empty cursor for window */
+ pixmap = XCreateBitmapFromData(priv->display, priv->window,
+ noCursorData, 8, 8);
+ if (!XAllocNamedColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
+ "black", &color, &tmpColor))
+ dmxLog(dmxFatal, "Cannot allocate color for cursor\n");
+ cursor = XCreatePixmapCursor(dpy, pixmap, pixmap, &color, &color, 0, 0);
+ XFreePixmap(dpy, pixmap);
+ return cursor;
+}
+
+static void
+dmxConsoleComputeWidthHeight(myPrivate * priv,
+ int *width, int *height,
+ double *xScale, double *yScale,
+ int *consWidth, int *consHeight)
+{
+ int screen;
+ Display *dpy = priv->display;
+
+ *width = 0;
+ *height = 0;
+ *xScale = 1.0;
+ *yScale = 1.0;
+
+ screen = DefaultScreen(dpy);
+ *consWidth = DisplayWidth(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN;
+ *consHeight = DisplayHeight(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN;
+
+ if (*consWidth < 1)
+ *consWidth = 1;
+ if (*consHeight < 1)
+ *consHeight = 1;
+
+#if 1
+ /* Always keep the console size similar
+ * to the global bounding box. */
+ *width = dmxGlobalWidth;
+ *height = dmxGlobalHeight;
+#else
+ /* Make the console window as big as
+ * possible by computing the visible
+ * bounding box. */
+ for (i = 0; i < dmxNumScreens; i++) {
+ if (screenInfo.screens[i]->x + screenInfo.screens[i]->width > *width)
+ *width = screenInfo.screens[i]->x + screenInfo.screens[i]->width;
+
+ if (screenInfo.screens[i]->y + screenInfo.screens[i]->height > *height)
+ *height = screenInfo.screens[i]->y + screenInfo.screens[i]->height;
+ }
+#endif
+
+ if ((double) *consWidth / *width < (double) *consHeight / *height)
+ *xScale = *yScale = (double) *consWidth / *width;
+ else
+ *xScale = *yScale = (double) *consHeight / *height;
+
+ *consWidth = scalex(priv, *width);
+ *consHeight = scaley(priv, *height);
+ if (*consWidth < 1)
+ *consWidth = 1;
+ if (*consHeight < 1)
+ *consHeight = 1;
+}
+
+/** Re-initialized the console device described by \a pDev (after a
+ * reconfig). */
+void
+dmxConsoleReInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ Display *dpy;
+
+ if (!priv || !priv->initialized)
+ return;
+ dpy = priv->display;
+
+ dmxConsoleComputeWidthHeight(priv,
+ &priv->width, &priv->height,
+ &priv->xScale, &priv->yScale,
+ &priv->consWidth, &priv->consHeight);
+ XResizeWindow(dpy, priv->window, priv->consWidth, priv->consHeight);
+ XFreePixmap(dpy, priv->pixmap);
+ priv->pixmap = XCreatePixmap(dpy,
+ RootWindow(dpy, DefaultScreen(dpy)),
+ priv->consWidth,
+ priv->consHeight,
+ DefaultDepth(dpy, DefaultScreen(dpy)));
+ dmxConsoleDraw(priv, 1, 1);
+}
+
+/** Initialized the console device described by \a pDev. */
+void
+dmxConsoleInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ int screen;
+ unsigned long mask;
+ XSetWindowAttributes attribs;
+ Display *dpy;
+ Window win;
+ XGCValues gcvals;
+ XColor color;
+ XClassHint class_hints;
+ unsigned long tmp;
+
+ if (dmxLocal->type == DMX_LOCAL_MOUSE)
+ priv->mou = pDev;
+ if (dmxLocal->type == DMX_LOCAL_KEYBOARD)
+ priv->kbd = pDev;
+ if (priv->initialized++)
+ return; /* Only do once for mouse/keyboard pair */
+
+ if (!(dpy = priv->display = XOpenDisplay(dmxInput->name)))
+ dmxLog(dmxFatal,
+ "dmxOpenConsole: cannot open console display %s\n",
+ dmxInput->name);
+
+ /* Set up defaults */
+ dmxConsoleComputeWidthHeight(priv,
+ &priv->width, &priv->height,
+ &priv->xScale, &priv->yScale,
+ &priv->consWidth, &priv->consHeight);
+
+ /* Private initialization using computed values or constants. */
+ screen = DefaultScreen(dpy);
+ priv->initPointerX = scalex(priv, priv->width / 2);
+ priv->initPointerY = scaley(priv, priv->height / 2);
+ priv->eventMask = (ButtonPressMask
+ | ButtonReleaseMask
+ | PointerMotionMask
+ | EnterWindowMask
+ | LeaveWindowMask
+ | KeyPressMask
+ | KeyReleaseMask | ExposureMask | ResizeRedirectMask);
+
+ mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
+ attribs.colormap = DefaultColormap(dpy, screen);
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_BG_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ attribs.background_pixel = color.pixel;
+ }
+ else
+ attribs.background_pixel = WhitePixel(dpy, screen);
+
+ attribs.event_mask = priv->eventMask;
+ attribs.override_redirect = False;
+
+ win = priv->window = XCreateWindow(dpy,
+ RootWindow(dpy, screen),
+ 0, 0, priv->consWidth, priv->consHeight,
+ 0,
+ DefaultDepth(dpy, screen),
+ InputOutput,
+ DefaultVisual(dpy, screen),
+ mask, &attribs);
+ priv->pixmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
+ priv->consWidth, priv->consHeight,
+ DefaultDepth(dpy, screen));
+
+ /* Set up properties */
+ XStoreName(dpy, win, DMX_CONSOLE_NAME);
+ class_hints.res_name = DMX_RES_NAME;
+ class_hints.res_class = DMX_RES_CLASS;
+ XSetClassHint(dpy, win, &class_hints);
+
+ /* Map the window */
+ XMapWindow(dpy, win);
+
+ /* Create cursors */
+ priv->cursorNormal = XCreateFontCursor(dpy, XC_circle);
+ priv->cursorGrabbed = XCreateFontCursor(dpy, XC_spider);
+ priv->cursorEmpty = dmxConsoleCreateEmptyCursor(priv);
+ XDefineCursor(dpy, priv->window, priv->cursorNormal);
+
+ /* Create GC */
+ mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground |
+ GCBackground | GCLineWidth | GCLineStyle | GCCapStyle |
+ GCFillStyle | GCGraphicsExposures);
+ gcvals.function = GXcopy;
+ gcvals.plane_mask = AllPlanes;
+ gcvals.clip_mask = None;
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_FG_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.foreground = color.pixel;
+ }
+ else
+ gcvals.foreground = BlackPixel(dpy, screen);
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_BG_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.background = color.pixel;
+ }
+ else
+ gcvals.background = WhitePixel(dpy, screen);
+ gcvals.line_width = 0;
+ gcvals.line_style = LineSolid;
+ gcvals.cap_style = CapNotLast;
+ gcvals.fill_style = FillSolid;
+ gcvals.graphics_exposures = False;
+
+ priv->gc = XCreateGC(dpy, win, mask, &gcvals);
+
+ tmp = gcvals.foreground;
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_DET_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.foreground = color.pixel;
+ }
+ else
+ gcvals.foreground = BlackPixel(dpy, screen);
+ priv->gcDet = XCreateGC(dpy, win, mask, &gcvals);
+ gcvals.foreground = tmp;
+
+ tmp = gcvals.background;
+ gcvals.background = gcvals.foreground;
+ gcvals.foreground = tmp;
+ priv->gcRev = XCreateGC(dpy, win, mask, &gcvals);
+
+ gcvals.background = gcvals.foreground;
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_CUR_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.foreground = color.pixel;
+ }
+ else
+ gcvals.foreground = BlackPixel(dpy, screen);
+ priv->gcCur = XCreateGC(dpy, win, mask, &gcvals);
+
+ dmxConsoleDraw(priv, 1, 1);
+
+ if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
+ dmxScreenPrivateKey))
+ priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
+ dmxScreenPrivateKey);
+ else
+ DMX_WRAP(CloseScreen, dmxCloseConsoleScreen,
+ priv, screenInfo.screens[0]);
+ dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey,
+ priv);
+}
+
+/** Fill in the \a info structure for the specified \a pDev. Only used
+ * for pointers. */
+void
+dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ GETPRIVFROMPDEV;
+
+ info->buttonClass = 1;
+ dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->minval[1] = 0;
+ /* max possible console window size: */
+ info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display));
+ info->maxval[1] =
+ DisplayHeight(priv->display, DefaultScreen(priv->display));
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
+
+/** Fill in the \a info structure for the specified \a pDev. Only used
+ * for keyboard. */
+void
+dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ dmxCommonKbdGetInfo(pDev, info);
+ info->keyboard = 1;
+ info->keyClass = 1;
+ dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap);
+ info->freemap = 1;
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+}
+
+/** Handle special console-only keys. */
+int
+dmxConsoleFunctions(pointer private, DMXFunctionType function)
+{
+ GETONLYPRIVFROMPRIVATE;
+ XRectangle rect;
+ Display *dpy = priv->display;
+
+ switch (function) {
+ case DMX_FUNCTION_FINE:
+ if (priv->fine) {
+ priv->fine = 0;
+ dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rect);
+ XSetClipRectangles(dpy, priv->gc, 0, 0, &rect, 1, Unsorted);
+ XCopyArea(dpy, priv->pixmap, priv->window, priv->gc,
+ 0, 0, priv->consWidth, priv->consHeight, 0, 0);
+ XSetClipMask(dpy, priv->gc, None);
+
+ XDefineCursor(dpy, priv->window,
+ priv->grabbed
+ ? priv->cursorGrabbed : priv->cursorNormal);
+ XWarpPointer(dpy, priv->window, priv->window,
+ 0, 0, 0, 0,
+ scalex(priv, priv->globalX),
+ scaley(priv, priv->globalY));
+ XSync(dpy, False); /* Not a backend display */
+ }
+ else {
+ priv->fine = 1;
+ XRaiseWindow(dpy, priv->window);
+ XDefineCursor(dpy, priv->window, priv->cursorEmpty);
+ dmxConsoleUpdateFineCursor(priv);
+ }
+ return 1;
+ case DMX_FUNCTION_GRAB:
+ if (priv->grabbed) {
+ XUngrabKeyboard(dpy, CurrentTime);
+ XUngrabPointer(dpy, CurrentTime);
+ XDefineCursor(dpy, priv->window,
+ priv->fine ? priv->cursorEmpty : priv->cursorNormal);
+ }
+ else {
+ if (XGrabPointer(dpy, priv->window, True,
+ 0, GrabModeAsync, GrabModeAsync, priv->window,
+ None, CurrentTime)) {
+ dmxLog(dmxError, "XGrabPointer failed\n");
+ return 0;
+ }
+ if (XGrabKeyboard(dpy, priv->window, True,
+ GrabModeAsync, GrabModeAsync, CurrentTime)) {
+ dmxLog(dmxError, "XGrabKeyboard failed\n");
+ XUngrabPointer(dpy, CurrentTime);
+ return 0;
+ }
+ XDefineCursor(dpy, priv->window,
+ priv->fine ? priv->cursorEmpty : priv->cursorGrabbed);
+ }
+ priv->grabbed = !priv->grabbed;
+ if (priv->fine)
+ dmxConsoleUpdateFineCursor(priv);
+ return 1;
+ case DMX_FUNCTION_TERMINATE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static void
+dmxDump(void)
+{
+ int i, j;
+ DMXInputInfo *dmxInput;
+ XEvent X;
+
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
+ for (j = 0; j < dmxInput->numDevs; j++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
+ myPrivate *priv = dmxLocal->private;
+
+ while (priv
+ && priv->display
+ && XCheckTypedEvent(priv->display, MotionNotify, &X)) {
+ DMXDBG4("dmxDump: %s/%d threw event away %d %s\n",
+ dmxInput->name, j, X.type, dmxEventName(X.type));
+ }
+ }
+ }
+}
+
+/** This routine is used to warp the pointer into the console window
+ * from anywhere on the screen. It is used when backend and console
+ * input are both being taken from the same X display. */
+void
+dmxConsoleCapture(DMXInputInfo * dmxInput)
+{
+ int i;
+ XEvent X;
+
+ DMXDBG0("dmxConsoleCapture\n");
+ dmxSync(NULL, TRUE);
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+ myPrivate *priv = dmxLocal->private;
+
+ if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE)
+ continue;
+ if (dmxLocal->type != DMX_LOCAL_MOUSE)
+ continue;
+ if (priv->captured)
+ continue;
+ priv->captured = 2; /* Ungrab only after proximal events. */
+ XRaiseWindow(priv->display, priv->window);
+ XSync(priv->display, False); /* Not a backend display */
+ while (XCheckTypedEvent(priv->display, MotionNotify, &X)) {
+ DMXDBG3(" Ignoring motion to %d %d after capture on %s\n",
+ X.xmotion.x, X.xmotion.y, dmxInput->name);
+ }
+ XWarpPointer(priv->display, None,
+ priv->window, 0, 0, 0, 0, priv->curX, priv->curY);
+ XSync(priv->display, False); /* Not a backend display */
+ dmxDump();
+ if (priv->fine)
+ dmxConsoleUpdateFineCursor(priv);
+ }
+}
+
+/** Undo the capture that was done by #dmxConsoleCapture. */
+void
+dmxConsoleUncapture(DMXInputInfo * dmxInput)
+{
+ int i;
+
+ DMXDBG0("dmxConsoleUncapture\n");
+ dmxSync(NULL, TRUE);
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+ myPrivate *priv = dmxLocal->private;
+
+ if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE)
+ continue;
+ if (dmxLocal->type != DMX_LOCAL_MOUSE)
+ continue;
+ if (!priv->captured)
+ continue;
+ priv->captured = 0;
+ XSync(priv->display, False); /* Not a backend display */
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxdetach.c b/xorg-server/hw/dmx/input/dmxdetach.c
index cc2250683..469f9c8d0 100644
--- a/xorg-server/hw/dmx/input/dmxdetach.c
+++ b/xorg-server/hw/dmx/input/dmxdetach.c
@@ -42,12 +42,14 @@
#include "dmxextension.h" /* For dmxInputCount */
/** Search for input associated with \a dmxScreen, and detach. */
-void dmxInputDetach(DMXScreenInfo *dmxScreen, Bool reserveId)
+void
+dmxInputDetach(DMXScreenInfo * dmxScreen, Bool reserveId)
{
int i;
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
+
if (dmxInput->scrnIdx == dmxScreen->index) {
dmxLogInput(dmxInput, "Detaching (%sreserved)\n",
reserveId ? "" : "not ");
diff --git a/xorg-server/hw/dmx/input/dmxdummy.c b/xorg-server/hw/dmx/input/dmxdummy.c
index 971892b9f..0690177f8 100644
--- a/xorg-server/hw/dmx/input/dmxdummy.c
+++ b/xorg-server/hw/dmx/input/dmxdummy.c
@@ -47,40 +47,42 @@
/** Return information about the dummy keyboard device specified in \a pDev
* into the structure pointed to by \a info. The keyboard is set up to
* have 1 valid key code that is \a NoSymbol */
-void dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+void
+dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{
static KeySym keyboard_mapping = NoSymbol;
- info->keyboard = 1;
- info->keyClass = 1;
+ info->keyboard = 1;
+ info->keyClass = 1;
info->keySyms.minKeyCode = 8;
info->keySyms.maxKeyCode = 8;
- info->keySyms.mapWidth = 1;
- info->keySyms.map = &keyboard_mapping;
- info->freemap = 0;
- info->focusClass = 1;
- info->kbdFeedbackClass = 1;
- info->force = 1;
+ info->keySyms.mapWidth = 1;
+ info->keySyms.map = &keyboard_mapping;
+ info->freemap = 0;
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+ info->force = 1;
}
/** Return information about the dummy mouse device specified in \a pDev
* into the structure pointed to by \a info. They mouse has 3 buttons
* and two axes. */
-void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+void
+dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{
- info->buttonClass = 1;
- info->numButtons = 3;
- info->map[0] = 1;
- info->map[1] = 2;
- info->map[2] = 3;
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->minval[1] = 0;
- info->maxval[0] = 0;
- info->maxval[1] = 0;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
+ info->buttonClass = 1;
+ info->numButtons = 3;
+ info->map[0] = 1;
+ info->map[1] = 2;
+ info->map[2] = 3;
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->minval[1] = 0;
+ info->maxval[0] = 0;
+ info->maxval[1] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
info->ptrFeedbackClass = 1;
}
diff --git a/xorg-server/hw/dmx/input/dmxevents.c b/xorg-server/hw/dmx/input/dmxevents.c
index 41bc4bf2d..f73480824 100644
--- a/xorg-server/hw/dmx/input/dmxevents.c
+++ b/xorg-server/hw/dmx/input/dmxevents.c
@@ -61,9 +61,9 @@
#include "xkbsrv.h"
#include "XIstubs.h"
-static int dmxGlobalX, dmxGlobalY; /* Global cursor position */
-static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
- * should move the mouse anyway. */
+static int dmxGlobalX, dmxGlobalY; /* Global cursor position */
+static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
+ * should move the mouse anyway. */
#if DMX_EVENTS_DEBUG
#define DMXDBG0(f) dmxLog(dmxDebug,f)
@@ -85,25 +85,26 @@ static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
#define DMXDBG7(f,a,b,c,d,e,g,h)
#endif
-static int dmxApplyFunctions(DMXInputInfo *dmxInput, DMXFunctionType f)
+static int
+dmxApplyFunctions(DMXInputInfo * dmxInput, DMXFunctionType f)
{
int i;
int rc = 0;
- for (i = 0; i < dmxInput->numDevs; i+= dmxInput->devs[i]->binding)
+ for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
if (dmxInput->devs[i]->functions)
rc += dmxInput->devs[i]->functions(dmxInput->devs[i]->private, f);
return rc;
}
-static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
- int type,
- KeySym keySym)
+static int
+dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal, int type, KeySym keySym)
{
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
-#if 1 /* hack to detect ctrl-alt-q, etc */
+#if 1 /* hack to detect ctrl-alt-q, etc */
static int ctrl = 0, alt = 0;
+
/* keep track of ctrl/alt key status */
if (type == KeyPress && keySym == 0xffe3) {
ctrl = 1;
@@ -126,11 +127,11 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
state = dmxLocalCoreKeyboard->pDevice->key->state;
else if (dmxLocal->pDevice->key)
state = dmxLocal->pDevice->key->state;
-
+
DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
keySym, type == KeyPress ? "press" : "release", state);
- if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
+ if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask))
return 0;
#endif
@@ -151,34 +152,36 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
}
return 1;
}
-
+
return 0;
}
-
-DMXScreenInfo *dmxFindFirstScreen(int x, int y)
+DMXScreenInfo *
+dmxFindFirstScreen(int x, int y)
{
int i;
for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
if (dmxOnScreen(x, y, dmxScreen))
return dmxScreen;
}
return NULL;
}
-
/**
* Enqueue a motion event.
*/
-static void enqueueMotion(DevicePtr pDev, int x, int y)
+static void
+enqueueMotion(DevicePtr pDev, int x, int y)
{
GETDMXLOCALFROMPDEV;
DeviceIntPtr p = dmxLocal->pDevice;
int valuators[3];
- int detail = 0; /* XXX should this be mask of pressed buttons? */
+ int detail = 0; /* XXX should this be mask of pressed buttons? */
ValuatorMask mask;
+
valuators[0] = x;
valuators[1] = y;
@@ -188,50 +191,50 @@ static void enqueueMotion(DevicePtr pDev, int x, int y)
return;
}
-
void
dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
{
DMXScreenInfo *dmxScreen;
- DMXInputInfo *dmxInput;
- ScreenPtr pScreen;
- int localX;
- int localY;
- int i;
+ DMXInputInfo *dmxInput;
+ ScreenPtr pScreen;
+ int localX;
+ int localY;
+ int i;
if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y)
return;
-
+
DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
x, y, delta, dmxGlobalX, dmxGlobalY);
dmxGlobalInvalid = 0;
- dmxGlobalX = x;
- dmxGlobalY = y;
+ dmxGlobalX = x;
+ dmxGlobalY = y;
if (dmxGlobalX < 0)
dmxGlobalX = 0;
if (dmxGlobalY < 0)
dmxGlobalY = 0;
if (dmxGlobalX >= dmxGlobalWidth)
- dmxGlobalX = dmxGlobalWidth + delta -1;
+ dmxGlobalX = dmxGlobalWidth + delta - 1;
if (dmxGlobalY >= dmxGlobalHeight)
- dmxGlobalY = dmxGlobalHeight + delta -1;
-
+ dmxGlobalY = dmxGlobalHeight + delta - 1;
+
if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
localX = dmxGlobalX - dmxScreen->rootXOrigin;
localY = dmxGlobalY - dmxScreen->rootYOrigin;
if ((pScreen = miPointerGetScreen(inputInfo.pointer))
&& pScreen->myNum == dmxScreen->index) {
- /* Screen is old screen */
+ /* Screen is old screen */
if (block)
dmxSigioBlock();
if (pDev)
- enqueueMotion(pDev, localX, localY);
+ enqueueMotion(pDev, localX, localY);
if (block)
dmxSigioUnblock();
- } else {
- /* Screen is new */
+ }
+ else {
+ /* Screen is new */
DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n",
pScreen->myNum, dmxScreen->index, localX, localY);
if (block)
@@ -240,7 +243,7 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
localX, localY);
if (pDev)
- enqueueMotion(pDev, localX, localY);
+ enqueueMotion(pDev, localX, localY);
if (block)
dmxSigioUnblock();
}
@@ -260,10 +263,11 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
}
#endif
}
- /* Send updates down to all core input
- * drivers */
+ /* Send updates down to all core input
+ * drivers */
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
int j;
+
for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding)
if (!dmxInput->detached
&& dmxInput->devs[j]->sendsCore
@@ -271,34 +275,35 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
dmxInput->devs[j]->update_position(dmxInput->devs[j]->private,
dmxGlobalX, dmxGlobalY);
}
- if (!dmxScreen) ProcessInputEvents();
+ if (!dmxScreen)
+ ProcessInputEvents();
}
-
-
#define DMX_MAX_AXES 32 /* Max axes reported by this routine */
-static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
- int *v, int firstAxis, int axesCount,
- DMXMotionType type, DMXBlockType block)
+static void
+dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
+ int *v, int firstAxis, int axesCount,
+ DMXMotionType type, DMXBlockType block)
{
- DeviceIntPtr pDevice = dmxLocal->pDevice;
- xEvent xE[2 * DMX_MAX_AXES/6];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *)xE;
- deviceValuator *xv = (deviceValuator *)xev+1;
- int thisX = 0;
- int thisY = 0;
- int count;
- ValuatorMask mask;
+ DeviceIntPtr pDevice = dmxLocal->pDevice;
+ xEvent xE[2 * DMX_MAX_AXES / 6];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *) xE;
+ deviceValuator *xv = (deviceValuator *) xev + 1;
+ int thisX = 0;
+ int thisY = 0;
+ int count;
+ ValuatorMask mask;
memset(xE, 0, sizeof(xE));
- if (axesCount > DMX_MAX_AXES) axesCount = DMX_MAX_AXES;
+ if (axesCount > DMX_MAX_AXES)
+ axesCount = DMX_MAX_AXES;
- if ((valuator_get_mode(pDevice,0) == Relative) && axesCount == 2) {
- /* The dmx console is a relative mode
- * device that sometimes reports
- * absolute motion. It only has two
- * axes. */
+ if ((valuator_get_mode(pDevice, 0) == Relative) && axesCount == 2) {
+ /* The dmx console is a relative mode
+ * device that sometimes reports
+ * absolute motion. It only has two
+ * axes. */
if (type == DMX_RELATIVE) {
thisX = -v[0];
thisY = -v[1];
@@ -307,7 +312,8 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
if (dmxLocal->update_position)
dmxLocal->update_position(dmxLocal->private,
dmxLocal->lastX, dmxLocal->lastY);
- } else { /* Convert to relative */
+ }
+ else { /* Convert to relative */
if (dmxLocal->lastX || dmxLocal->lastY) {
thisX = v[0] - dmxLocal->lastX;
thisY = v[1] - dmxLocal->lastY;
@@ -320,110 +326,155 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
}
if (axesCount <= 6) {
- /* Optimize for the common case when
- * only 1 or 2 axes change. */
- xev->time = GetTimeInMillis();
- xev->type = DeviceMotionNotify;
- xev->detail = 0;
- xev->deviceid = pDevice->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = pDevice->id;
- xv->num_valuators = axesCount;
- xv->first_valuator = firstAxis;
- switch (xv->num_valuators) {
- case 6: xv->valuator5 = v[5];
- case 5: xv->valuator4 = v[4];
- case 4: xv->valuator3 = v[3];
- case 3: xv->valuator2 = v[2];
- case 2: xv->valuator1 = v[1];
- case 1: xv->valuator0 = v[0];
- }
- count = 2;
- } else {
+ /* Optimize for the common case when
+ * only 1 or 2 axes change. */
+ xev->time = GetTimeInMillis();
+ xev->type = DeviceMotionNotify;
+ xev->detail = 0;
+ xev->deviceid = pDevice->id | MORE_EVENTS;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = pDevice->id;
+ xv->num_valuators = axesCount;
+ xv->first_valuator = firstAxis;
+ switch (xv->num_valuators) {
+ case 6:
+ xv->valuator5 = v[5];
+ case 5:
+ xv->valuator4 = v[4];
+ case 4:
+ xv->valuator3 = v[3];
+ case 3:
+ xv->valuator2 = v[2];
+ case 2:
+ xv->valuator1 = v[1];
+ case 1:
+ xv->valuator0 = v[0];
+ }
+ count = 2;
+ }
+ else {
int i;
+
for (i = 0, count = 0; i < axesCount; i += 6) {
- xev->time = GetTimeInMillis();
- xev->type = DeviceMotionNotify;
- xev->detail = 0;
- xev->deviceid = pDevice->id | MORE_EVENTS;
- xev += 2;
-
- xv->type = DeviceValuator;
- xv->deviceid = pDevice->id;
- xv->num_valuators = (i+6 >= axesCount ? axesCount - i : 6);
+ xev->time = GetTimeInMillis();
+ xev->type = DeviceMotionNotify;
+ xev->detail = 0;
+ xev->deviceid = pDevice->id | MORE_EVENTS;
+ xev += 2;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = pDevice->id;
+ xv->num_valuators = (i + 6 >= axesCount ? axesCount - i : 6);
xv->first_valuator = firstAxis + i;
switch (xv->num_valuators) {
- case 6: xv->valuator5 = v[i+5];
- case 5: xv->valuator4 = v[i+4];
- case 4: xv->valuator3 = v[i+3];
- case 3: xv->valuator2 = v[i+2];
- case 2: xv->valuator1 = v[i+1];
- case 1: xv->valuator0 = v[i+0];
+ case 6:
+ xv->valuator5 = v[i + 5];
+ case 5:
+ xv->valuator4 = v[i + 4];
+ case 4:
+ xv->valuator3 = v[i + 3];
+ case 3:
+ xv->valuator2 = v[i + 2];
+ case 2:
+ xv->valuator1 = v[i + 1];
+ case 1:
+ xv->valuator0 = v[i + 0];
}
- xv += 2;
- count += 2;
+ xv += 2;
+ count += 2;
}
}
if (block)
dmxSigioBlock();
valuator_mask_set_range(&mask, firstAxis, axesCount, v);
- QueuePointerEvents(pDevice, MotionNotify, 0,
- POINTER_ABSOLUTE, &mask);
+ QueuePointerEvents(pDevice, MotionNotify, 0, POINTER_ABSOLUTE, &mask);
if (block)
dmxSigioUnblock();
}
-static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
- XEvent *e, DMXBlockType block)
+static int
+dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
+ XEvent * e, DMXBlockType block)
{
- int type;
- int event = -1;
- XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e;
- XDeviceMotionEvent *me = (XDeviceMotionEvent *)e;
- DeviceIntPtr pDevice = dmxLocal->pDevice;
- int valuators[MAX_VALUATORS];
- ValuatorMask mask;
+ int type;
+ int event = -1;
+ XDeviceKeyEvent *ke = (XDeviceKeyEvent *) e;
+ XDeviceMotionEvent *me = (XDeviceMotionEvent *) e;
+ DeviceIntPtr pDevice = dmxLocal->pDevice;
+ int valuators[MAX_VALUATORS];
+ ValuatorMask mask;
if (!e)
- return -1; /* No extended event passed, cannot handle */
+ return -1; /* No extended event passed, cannot handle */
- if ((XID)dmxLocal->deviceId != ke->deviceid) {
- /* Search for the correct dmxLocal,
- * since backend and console events are
- * picked up for the first device on
- * that X server. */
+ if ((XID) dmxLocal->deviceId != ke->deviceid) {
+ /* Search for the correct dmxLocal,
+ * since backend and console events are
+ * picked up for the first device on
+ * that X server. */
int i;
DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+
for (i = 0; i < dmxInput->numDevs; i++) {
dmxLocal = dmxInput->devs[i];
- if ((XID)dmxLocal->deviceId == ke->deviceid)
+ if ((XID) dmxLocal->deviceId == ke->deviceid)
break;
}
}
- if ((XID)dmxLocal->deviceId != ke->deviceid
+ if ((XID) dmxLocal->deviceId != ke->deviceid
|| (type = dmxMapLookup(dmxLocal, e->type)) < 0)
- return -1; /* No mapping, so this event is unhandled */
+ return -1; /* No mapping, so this event is unhandled */
switch (type) {
- case XI_DeviceValuator: event = DeviceValuator; break;
- case XI_DeviceKeyPress: event = KeyPress; break;
- case XI_DeviceKeyRelease: event = KeyRelease; break;
- case XI_DeviceButtonPress: event = ButtonPress; break;
- case XI_DeviceButtonRelease: event = ButtonRelease; break;
- case XI_DeviceMotionNotify: event = MotionNotify; break;
- case XI_DeviceFocusIn: event = DeviceFocusIn; break;
- case XI_DeviceFocusOut: event = DeviceFocusOut; break;
- case XI_ProximityIn: event = ProximityIn; break;
- case XI_ProximityOut: event = ProximityOut; break;
- case XI_DeviceStateNotify: event = DeviceStateNotify; break;
- case XI_DeviceMappingNotify: event = DeviceMappingNotify; break;
- case XI_ChangeDeviceNotify: event = ChangeDeviceNotify; break;
- case XI_DeviceKeystateNotify: event = DeviceStateNotify; break;
- case XI_DeviceButtonstateNotify: event = DeviceStateNotify; break;
+ case XI_DeviceValuator:
+ event = DeviceValuator;
+ break;
+ case XI_DeviceKeyPress:
+ event = KeyPress;
+ break;
+ case XI_DeviceKeyRelease:
+ event = KeyRelease;
+ break;
+ case XI_DeviceButtonPress:
+ event = ButtonPress;
+ break;
+ case XI_DeviceButtonRelease:
+ event = ButtonRelease;
+ break;
+ case XI_DeviceMotionNotify:
+ event = MotionNotify;
+ break;
+ case XI_DeviceFocusIn:
+ event = DeviceFocusIn;
+ break;
+ case XI_DeviceFocusOut:
+ event = DeviceFocusOut;
+ break;
+ case XI_ProximityIn:
+ event = ProximityIn;
+ break;
+ case XI_ProximityOut:
+ event = ProximityOut;
+ break;
+ case XI_DeviceStateNotify:
+ event = DeviceStateNotify;
+ break;
+ case XI_DeviceMappingNotify:
+ event = DeviceMappingNotify;
+ break;
+ case XI_ChangeDeviceNotify:
+ event = ChangeDeviceNotify;
+ break;
+ case XI_DeviceKeystateNotify:
+ event = DeviceStateNotify;
+ break;
+ case XI_DeviceButtonstateNotify:
+ event = DeviceStateNotify;
+ break;
}
#define EXTRACT_VALUATORS(ke, valuators) \
@@ -438,7 +489,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_DeviceKeyPress:
case XI_DeviceKeyRelease:
EXTRACT_VALUATORS(ke, valuators);
- valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count,
+ valuators);
if (block)
dmxSigioBlock();
QueueKeyboardEvents(pDevice, event, ke->keycode, &mask);
@@ -448,7 +500,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_DeviceButtonPress:
case XI_DeviceButtonRelease:
EXTRACT_VALUATORS(ke, valuators);
- valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count,
+ valuators);
if (block)
dmxSigioBlock();
QueuePointerEvents(pDevice, event, ke->keycode,
@@ -459,7 +512,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_ProximityIn:
case XI_ProximityOut:
EXTRACT_VALUATORS(ke, valuators);
- valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count,
+ valuators);
if (block)
dmxSigioBlock();
QueueProximityEvents(pDevice, event, &mask);
@@ -480,13 +534,13 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_ChangeDeviceNotify:
case XI_DeviceKeystateNotify:
case XI_DeviceButtonstateNotify:
- /* These are ignored, since DMX will
- * generate its own events of these
- * types, as necessary.
+ /* These are ignored, since DMX will
+ * generate its own events of these
+ * types, as necessary.
- * Perhaps ChangeDeviceNotify should
- * generate an error, because it is
- * unexpected? */
+ * Perhaps ChangeDeviceNotify should
+ * generate an error, because it is
+ * unexpected? */
break;
case XI_DeviceValuator:
default:
@@ -498,11 +552,12 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
return 0;
}
-static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
+static int
+dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
{
ButtonClassPtr b = dmxLocal->pDevice->button;
- if (button > b->numButtons) { /* This shouldn't happen. */
+ if (button > b->numButtons) { /* This shouldn't happen. */
dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n",
button, b->numButtons);
return button;
@@ -512,14 +567,16 @@ static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
/** Return DMX's notion of the pointer position in the global coordinate
* space. */
-void dmxGetGlobalPosition(int *x, int *y)
+void
+dmxGetGlobalPosition(int *x, int *y)
{
*x = dmxGlobalX;
*y = dmxGlobalY;
}
/** Invalidate the global position for #dmxCoreMotion. */
-void dmxInvalidateGlobalPosition(void)
+void
+dmxInvalidateGlobalPosition(void)
{
dmxGlobalInvalid = 1;
}
@@ -534,8 +591,9 @@ void dmxInvalidateGlobalPosition(void)
*
* If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
* blocked around calls to \a enqueueMotion(). */
-void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
- DMXMotionType type, DMXBlockType block)
+void
+dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
+ DMXMotionType type, DMXBlockType block)
{
GETDMXLOCALFROMPDEV;
@@ -558,8 +616,8 @@ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
}
}
-static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
- KeyCode keyCode)
+static KeySym
+dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal, KeyCode keyCode)
{
KeySym keysym = NoSymbol;
int effectiveGroup;
@@ -578,21 +636,21 @@ static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
keyCode, keysym);
-out:
+ out:
return keysym;
}
-static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
- int tryFirst)
+static KeyCode
+dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym, int tryFirst)
{
/* FIXME: this is quite ineffective, converting to a core map first and
* then extracting the info from there. It'd be better to run the actual
* xkb map */
XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo;
KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice);
- int i;
+ int i;
- /* Optimize for similar maps */
+ /* Optimize for similar maps */
if (XkbKeycodeInRange(xkbi->desc, tryFirst)
&& pKeySyms->map[(tryFirst - xkbi->desc->min_key_code)
* pKeySyms->mapWidth] == keySym)
@@ -603,18 +661,19 @@ static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
* pKeySyms->mapWidth] == keySym) {
DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to"
" keyCode=%d (reverses to core keySym=0x%04x)\n",
- keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard,i));
+ keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard, i));
return i;
}
}
return 0;
}
-static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
+static int
+dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
{
GETDMXLOCALFROMPDEV;
int keyCode;
-
+
if (!dmxLocal->pDevice->key) {
dmxLog(dmxWarning, "dmxFixup: not a keyboard device (%s)\n",
dmxLocal->pDevice->name);
@@ -636,9 +695,10 @@ static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
* FIXME: make the code do what the comment says, or remove this comment.
* If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
* blocked around calls to dmxeqEnqueue(). */
-
-void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
- XEvent *e, DMXBlockType block)
+
+void
+dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
+ XEvent * e, DMXBlockType block)
{
GETDMXINPUTFROMPDEV;
xEvent xE;
@@ -658,7 +718,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
xE.u.u.detail = dmxFixup(pDev, detail, keySym);
- /*ErrorF("KEY %d sym %d\n", detail, (int) keySym);*/
+ /*ErrorF("KEY %d sym %d\n", detail, (int) keySym); */
QueueKeyboardEvents(p, type, detail, NULL);
return;
@@ -673,7 +733,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
case MotionNotify:
valuators[0] = e->xmotion.x;
valuators[1] = e->xmotion.y;
- valuators[2] = e->xmotion.state; /* FIXME: WTF?? */
+ valuators[2] = e->xmotion.state; /* FIXME: WTF?? */
valuator_mask_set_range(&mask, 0, 3, valuators);
QueuePointerEvents(p, type, detail,
POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
@@ -682,7 +742,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
case EnterNotify:
case LeaveNotify:
case KeymapNotify:
- case MappingNotify: /* This is sent because we change the
+ case MappingNotify: /* This is sent because we change the
* modifier map on the backend/console
* input device so that we have complete
* control of the input device LEDs. */
@@ -690,13 +750,14 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
default:
if (type == ProximityIn || type == ProximityOut) {
if (dmxLocal->sendsCore)
- return; /* Not a core event */
+ return; /* Not a core event */
break;
}
if (type >= LASTEvent) {
if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block))
dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type);
- } else {
+ }
+ else {
dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n",
type, dmxEventName(type));
}
@@ -711,23 +772,28 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
* requested termination of the DMX server, -1 is returned. If the user
* has requested a switch to a VT, then the (1-based) number of that VT
* is returned. */
-int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
+int
+dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
{
GETDMXINPUTFROMPDEV;
- int vt = 0;
+ int vt = 0;
unsigned short state = 0;
if (dmxLocal->sendsCore)
- state = XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo->state);
+ state =
+ XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo->
+ state);
else if (dmxLocal->pDevice->key)
state = XkbStateFieldFromRec(&dmxLocal->pDevice->key->xkbInfo->state);
- if (!dmxLocal->sendsCore) return 0; /* Only for core devices */
+ if (!dmxLocal->sendsCore)
+ return 0; /* Only for core devices */
+
+ DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym, state);
+
+ if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask))
+ return 0;
- DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym,state);
-
- if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0;
-
switch (keySym) {
case XK_F1:
case XK_F2:
@@ -747,7 +813,7 @@ int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
vt = keySym - XK_F11 + 11;
break;
- case XK_q: /* To avoid confusion */
+ case XK_q: /* To avoid confusion */
case XK_BackSpace:
case XK_Delete:
case XK_KP_Delete:
diff --git a/xorg-server/hw/dmx/input/dmxinputinit.c b/xorg-server/hw/dmx/input/dmxinputinit.c
index 16ecae38d..b22a41f56 100644
--- a/xorg-server/hw/dmx/input/dmxinputinit.c
+++ b/xorg-server/hw/dmx/input/dmxinputinit.c
@@ -102,7 +102,7 @@ static DMXLocalInputInfoRec DMXBackendMou = {
static DMXLocalInputInfoRec DMXBackendKbd = {
"backend-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_BACKEND,
- 1, /* With backend-mou or console-mou */
+ 1, /* With backend-mou or console-mou */
dmxCommonCopyPrivate, NULL,
dmxBackendInit, NULL, NULL, dmxBackendKbdGetInfo,
dmxCommonKbdOn, dmxCommonKbdOff, NULL,
@@ -123,7 +123,7 @@ static DMXLocalInputInfoRec DMXConsoleMou = {
static DMXLocalInputInfoRec DMXConsoleKbd = {
"console-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_CONSOLE,
- 1, /* With backend-mou or console-mou */
+ 1, /* With backend-mou or console-mou */
dmxCommonCopyPrivate, NULL,
dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleKbdGetInfo,
dmxCommonKbdOn, dmxCommonKbdOff, NULL,
@@ -133,87 +133,78 @@ static DMXLocalInputInfoRec DMXConsoleKbd = {
};
static DMXLocalInputInfoRec DMXLocalDevices[] = {
- /* Dummy drivers that can compile on any OS */
+ /* Dummy drivers that can compile on any OS */
#ifdef __linux__
- /* Linux-specific drivers */
+ /* Linux-specific drivers */
{
- "kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
- kbdLinuxCreatePrivate, kbdLinuxDestroyPrivate,
- kbdLinuxInit, NULL, NULL, kbdLinuxGetInfo,
- kbdLinuxOn, kbdLinuxOff, NULL,
- kbdLinuxVTPreSwitch, kbdLinuxVTPostSwitch, kbdLinuxVTSwitch,
- kbdLinuxRead, NULL, NULL, NULL,
- NULL, kbdLinuxCtrl, kbdLinuxBell
- },
+ "kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
+ kbdLinuxCreatePrivate, kbdLinuxDestroyPrivate,
+ kbdLinuxInit, NULL, NULL, kbdLinuxGetInfo,
+ kbdLinuxOn, kbdLinuxOff, NULL,
+ kbdLinuxVTPreSwitch, kbdLinuxVTPostSwitch, kbdLinuxVTSwitch,
+ kbdLinuxRead, NULL, NULL, NULL,
+ NULL, kbdLinuxCtrl, kbdLinuxBell},
{
- "ms", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
- msLinuxCreatePrivate, msLinuxDestroyPrivate,
- msLinuxInit, NULL, NULL, msLinuxGetInfo,
- msLinuxOn, msLinuxOff, NULL,
- msLinuxVTPreSwitch, msLinuxVTPostSwitch, NULL,
- msLinuxRead
- },
+ "ms", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ msLinuxCreatePrivate, msLinuxDestroyPrivate,
+ msLinuxInit, NULL, NULL, msLinuxGetInfo,
+ msLinuxOn, msLinuxOff, NULL,
+ msLinuxVTPreSwitch, msLinuxVTPostSwitch, NULL,
+ msLinuxRead},
{
- "ps2", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
- ps2LinuxCreatePrivate, ps2LinuxDestroyPrivate,
- ps2LinuxInit, NULL, NULL, ps2LinuxGetInfo,
- ps2LinuxOn, ps2LinuxOff, NULL,
- ps2LinuxVTPreSwitch, ps2LinuxVTPostSwitch, NULL,
- ps2LinuxRead
- },
+ "ps2", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ ps2LinuxCreatePrivate, ps2LinuxDestroyPrivate,
+ ps2LinuxInit, NULL, NULL, ps2LinuxGetInfo,
+ ps2LinuxOn, ps2LinuxOff, NULL,
+ ps2LinuxVTPreSwitch, ps2LinuxVTPostSwitch, NULL,
+ ps2LinuxRead},
#endif
#ifdef __linux__
- /* USB drivers, currently only for
- Linux, but relatively easy to port to
- other OSs */
+ /* USB drivers, currently only for
+ Linux, but relatively easy to port to
+ other OSs */
{
- "usb-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
- usbCreatePrivate, usbDestroyPrivate,
- kbdUSBInit, NULL, NULL, kbdUSBGetInfo,
- kbdUSBOn, usbOff, NULL,
- NULL, NULL, NULL,
- kbdUSBRead, NULL, NULL, NULL,
- NULL, kbdUSBCtrl
- },
+ "usb-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
+ usbCreatePrivate, usbDestroyPrivate,
+ kbdUSBInit, NULL, NULL, kbdUSBGetInfo,
+ kbdUSBOn, usbOff, NULL,
+ NULL, NULL, NULL,
+ kbdUSBRead, NULL, NULL, NULL,
+ NULL, kbdUSBCtrl},
{
- "usb-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
- usbCreatePrivate, usbDestroyPrivate,
- mouUSBInit, NULL, NULL, mouUSBGetInfo,
- mouUSBOn, usbOff, NULL,
- NULL, NULL, NULL,
- mouUSBRead
- },
+ "usb-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ usbCreatePrivate, usbDestroyPrivate,
+ mouUSBInit, NULL, NULL, mouUSBGetInfo,
+ mouUSBOn, usbOff, NULL,
+ NULL, NULL, NULL,
+ mouUSBRead},
{
- "usb-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_LOCAL, 1,
- usbCreatePrivate, usbDestroyPrivate,
- othUSBInit, NULL, NULL, othUSBGetInfo,
- othUSBOn, usbOff, NULL,
- NULL, NULL, NULL,
- othUSBRead
- },
+ "usb-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_LOCAL, 1,
+ usbCreatePrivate, usbDestroyPrivate,
+ othUSBInit, NULL, NULL, othUSBGetInfo,
+ othUSBOn, usbOff, NULL,
+ NULL, NULL, NULL,
+ othUSBRead},
#endif
{
- "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
- NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo
- },
+ "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo},
{
- "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
- NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo
- },
- { NULL } /* Must be last */
+ "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
+ NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo},
+ {NULL} /* Must be last */
};
-
#if 11 /*BP*/
-void
+ void
DDXRingBell(int volume, int pitch, int duration)
{
- /* NO-OP */
+ /* NO-OP */
}
/* taken from kdrive/src/kinput.c: */
static void
-dmxKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+dmxKbdCtrl(DeviceIntPtr pDevice, KeybdCtrl * ctrl)
{
#if 0
KdKeyboardInfo *ki;
@@ -228,7 +219,7 @@ dmxKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
KdSetLeds(ki, ctrl->leds);
ki->bellPitch = ctrl->bell_pitch;
- ki->bellDuration = ctrl->bell_duration;
+ ki->bellDuration = ctrl->bell_duration;
#endif
}
@@ -239,7 +230,7 @@ dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
#if 0
KeybdCtrl *ctrl = arg;
KdKeyboardInfo *ki = NULL;
-
+
for (ki = kdKeyboards; ki; ki = ki->next) {
if (ki->dixdev && ki->dixdev->id == pDev->id)
break;
@@ -247,50 +238,56 @@ dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver)
return;
-
+
KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration);
#endif
}
#endif /*BP*/
-
-static void _dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal,
- PtrCtrl *ctrl)
+ static void
+_dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal, PtrCtrl * ctrl)
{
- if (!dmxLocal) return;
+ if (!dmxLocal)
+ return;
dmxLocal->mctrl = *ctrl;
- if (dmxLocal->mCtrl) dmxLocal->mCtrl(&dmxLocal->pDevice->public, ctrl);
+ if (dmxLocal->mCtrl)
+ dmxLocal->mCtrl(&dmxLocal->pDevice->public, ctrl);
}
/** Change the pointer control information for the \a pDevice. If the
* device sends core events, then also change the control information
* for all of the pointer devices that send core events. */
-void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl)
+void
+dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl)
{
GETDMXLOCALFROMPDEVICE;
int i, j;
- if (dmxLocal->sendsCore) { /* Do for all core devices */
+ if (dmxLocal->sendsCore) { /* Do for all core devices */
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (dmxInput->detached) continue;
+
+ if (dmxInput->detached)
+ continue;
for (j = 0; j < dmxInput->numDevs; j++)
if (dmxInput->devs[j]->sendsCore)
_dmxChangePointerControl(dmxInput->devs[j], ctrl);
}
- } else { /* Do for this device only */
+ }
+ else { /* Do for this device only */
_dmxChangePointerControl(dmxLocal, ctrl);
}
}
-static void _dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal,
- KeybdCtrl *ctrl)
+static void
+_dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal, KeybdCtrl * ctrl)
{
dmxLocal->kctrl = *ctrl;
if (dmxLocal->kCtrl) {
dmxLocal->kCtrl(&dmxLocal->pDevice->public, ctrl);
if (dmxLocal->pDevice->kbdfeed) {
XkbEventCauseRec cause;
+
XkbSetCauseUnknown(&cause);
/* Generate XKB events, as necessary */
XkbUpdateIndicators(dmxLocal->pDevice, XkbAllIndicatorsMask, False,
@@ -299,69 +296,84 @@ static void _dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal,
}
}
-
/** Change the keyboard control information for the \a pDevice. If the
* device sends core events, then also change the control information
* for all of the keyboard devices that send core events. */
-void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+void
+dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl)
{
GETDMXLOCALFROMPDEVICE;
int i, j;
- if (dmxLocal->sendsCore) { /* Do for all core devices */
+ if (dmxLocal->sendsCore) { /* Do for all core devices */
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (dmxInput->detached) continue;
+
+ if (dmxInput->detached)
+ continue;
for (j = 0; j < dmxInput->numDevs; j++)
if (dmxInput->devs[j]->sendsCore)
_dmxKeyboardKbdCtrlProc(dmxInput->devs[j], ctrl);
}
- } else { /* Do for this device only */
+ }
+ else { /* Do for this device only */
_dmxKeyboardKbdCtrlProc(dmxLocal, ctrl);
}
}
-static void _dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent)
+static void
+_dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent)
{
- if (dmxLocal->kBell) dmxLocal->kBell(&dmxLocal->pDevice->public,
- percent,
- dmxLocal->kctrl.bell,
- dmxLocal->kctrl.bell_pitch,
- dmxLocal->kctrl.bell_duration);
+ if (dmxLocal->kBell)
+ dmxLocal->kBell(&dmxLocal->pDevice->public,
+ percent,
+ dmxLocal->kctrl.bell,
+ dmxLocal->kctrl.bell_pitch,
+ dmxLocal->kctrl.bell_duration);
}
/** Sound the bell on the device. If the device send core events, then
* sound the bell on all of the devices that send core events. */
-void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
- pointer ctrl, int unknown)
+void
+dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
+ pointer ctrl, int unknown)
{
GETDMXLOCALFROMPDEVICE;
int i, j;
- if (dmxLocal->sendsCore) { /* Do for all core devices */
+ if (dmxLocal->sendsCore) { /* Do for all core devices */
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (dmxInput->detached) continue;
+
+ if (dmxInput->detached)
+ continue;
for (j = 0; j < dmxInput->numDevs; j++)
if (dmxInput->devs[j]->sendsCore)
_dmxKeyboardBellProc(dmxInput->devs[j], percent);
}
- } else { /* Do for this device only */
+ }
+ else { /* Do for this device only */
_dmxKeyboardBellProc(dmxLocal, percent);
}
}
-static void dmxKeyboardFreeNames(XkbComponentNamesPtr names)
+static void
+dmxKeyboardFreeNames(XkbComponentNamesPtr names)
{
- if (names->keycodes) XFree(names->keycodes);
- if (names->types) XFree(names->types);
- if (names->compat) XFree(names->compat);
- if (names->symbols) XFree(names->symbols);
- if (names->geometry) XFree(names->geometry);
+ if (names->keycodes)
+ XFree(names->keycodes);
+ if (names->types)
+ XFree(names->types);
+ if (names->compat)
+ XFree(names->compat);
+ if (names->symbols)
+ XFree(names->symbols);
+ if (names->geometry)
+ XFree(names->geometry);
}
-
-static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info)
+static int
+dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo * info)
{
GETDMXINPUTFROMPDEVICE;
XkbRMLVOSet rmlvo;
@@ -374,14 +386,14 @@ static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info)
XkbSetRulesDflts(&rmlvo);
if (!info->force && (dmxInput->keycodes
- || dmxInput->symbols
- || dmxInput->geometry)) {
- if (info->freenames) dmxKeyboardFreeNames(&info->names);
- info->freenames = 0;
+ || dmxInput->symbols || dmxInput->geometry)) {
+ if (info->freenames)
+ dmxKeyboardFreeNames(&info->names);
+ info->freenames = 0;
info->names.keycodes = dmxInput->keycodes;
- info->names.types = NULL;
- info->names.compat = NULL;
- info->names.symbols = dmxInput->symbols;
+ info->names.types = NULL;
+ info->names.compat = NULL;
+ info->names.symbols = dmxInput->symbols;
info->names.geometry = dmxInput->geometry;
dmxLogInput(dmxInput, "XKEYBOARD: From command line: %s",
@@ -391,7 +403,8 @@ static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info)
if (info->names.geometry && *info->names.geometry)
dmxLogInputCont(dmxInput, " %s", info->names.geometry);
dmxLogInputCont(dmxInput, "\n");
- } else if (info->names.keycodes) {
+ }
+ else if (info->names.keycodes) {
dmxLogInput(dmxInput, "XKEYBOARD: From device: %s",
info->names.keycodes);
if (info->names.symbols && *info->names.symbols)
@@ -399,36 +412,36 @@ static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info)
if (info->names.geometry && *info->names.geometry)
dmxLogInputCont(dmxInput, " %s", info->names.geometry);
dmxLogInputCont(dmxInput, "\n");
- } else {
+ }
+ else {
dmxLogInput(dmxInput, "XKEYBOARD: Defaults: %s %s %s %s %s\n",
dmxConfigGetXkbRules(),
dmxConfigGetXkbLayout(),
- dmxConfigGetXkbModel(),
- dmxConfigGetXkbVariant()
- ? dmxConfigGetXkbVariant() : "",
- dmxConfigGetXkbOptions()
+ dmxConfigGetXkbModel(), dmxConfigGetXkbVariant()
+ ? dmxConfigGetXkbVariant() : "", dmxConfigGetXkbOptions()
? dmxConfigGetXkbOptions() : "");
}
InitKeyboardDeviceStruct(pDevice, &rmlvo,
- dmxKeyboardBellProc,
- dmxKeyboardKbdCtrlProc);
+ dmxKeyboardBellProc, dmxKeyboardKbdCtrlProc);
- if (info->freenames) dmxKeyboardFreeNames(&info->names);
+ if (info->freenames)
+ dmxKeyboardFreeNames(&info->names);
return Success;
}
-
-static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
+static int
+dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
{
GETDMXINPUTFROMPDEVICE;
- int fd;
+ int fd;
DMXLocalInitInfo info;
- int i;
- Atom btn_labels[MAX_BUTTONS] = {0}; /* FIXME */
- Atom axis_labels[MAX_VALUATORS] = {0}; /* FIXME */
+ int i;
+ Atom btn_labels[MAX_BUTTONS] = { 0 }; /* FIXME */
+ Atom axis_labels[MAX_VALUATORS] = { 0 }; /* FIXME */
- if (dmxInput->detached) return Success;
+ if (dmxInput->detached)
+ return Success;
memset(&info, 0, sizeof(info));
switch (what) {
@@ -450,9 +463,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
rmlvo.variant = dmxConfigGetXkbVariant();
rmlvo.options = dmxConfigGetXkbOptions();
- InitKeyboardDeviceStruct(pDevice,
- &rmlvo,
- dmxBell, dmxKbdCtrl);
+ InitKeyboardDeviceStruct(pDevice, &rmlvo, dmxBell, dmxKbdCtrl);
}
if (info.buttonClass) {
InitButtonClassDeviceStruct(pDevice, info.numButtons,
@@ -462,15 +473,15 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
if (info.numRelAxes && dmxLocal->sendsCore) {
InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
axis_labels,
- GetMaximumEventsNum(),
- Relative);
+ GetMaximumEventsNum(), Relative);
for (i = 0; i < info.numRelAxes; i++)
InitValuatorAxisStruct(pDevice, i, axis_labels[i],
info.minval[i], info.maxval[i],
info.res[i],
info.minres[i], info.maxres[i],
Relative);
- } else if (info.numRelAxes) {
+ }
+ else if (info.numRelAxes) {
InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
axis_labels,
dmxPointerGetMotionBufferSize(),
@@ -481,7 +492,8 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
info.maxval[i], info.res[i],
info.minres[i], info.maxres[i],
Relative);
- } else if (info.numAbsAxes) {
+ }
+ else if (info.numAbsAxes) {
InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes,
axis_labels,
dmxPointerGetMotionBufferSize(),
@@ -494,8 +506,10 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
info.maxres[i], Absolute);
}
}
- if (info.focusClass) InitFocusClassDeviceStruct(pDevice);
- if (info.proximityClass) InitProximityClassDeviceStruct(pDevice);
+ if (info.focusClass)
+ InitFocusClassDeviceStruct(pDevice);
+ if (info.proximityClass)
+ InitProximityClassDeviceStruct(pDevice);
if (info.ptrFeedbackClass)
InitPtrFeedbackClassDeviceStruct(pDevice, dmxChangePointerControl);
if (info.intFeedbackClass || info.strFeedbackClass)
@@ -516,12 +530,13 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
break;
case DEVICE_OFF:
case DEVICE_CLOSE:
- /* This can get called twice consecutively: once for a
- * detached screen (DEVICE_OFF), and then again at server
- * generation time (DEVICE_CLOSE). */
+ /* This can get called twice consecutively: once for a
+ * detached screen (DEVICE_OFF), and then again at server
+ * generation time (DEVICE_CLOSE). */
if (pDev->on) {
dmxSigioUnregister(dmxInput);
- if (dmxLocal->off) dmxLocal->off(pDev);
+ if (dmxLocal->off)
+ dmxLocal->off(pDev);
pDev->on = FALSE;
}
break;
@@ -530,17 +545,19 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
XFree(info.keySyms.map);
info.keySyms.map = NULL;
}
- if (info.xkb) XkbFreeKeyboard(info.xkb, 0, True);
+ if (info.xkb)
+ XkbFreeKeyboard(info.xkb, 0, True);
return Success;
}
-static void dmxProcessInputEvents(DMXInputInfo *dmxInput)
+static void
+dmxProcessInputEvents(DMXInputInfo * dmxInput)
{
int i;
mieqProcessInputEvents();
#if 00 /*BP*/
- miPointerUpdate();
+ miPointerUpdate();
#endif
if (dmxInput->detached)
return;
@@ -550,30 +567,44 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput)
}
#if 11 /*BP*/
- mieqProcessInputEvents();
+ mieqProcessInputEvents();
#endif
}
-static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput,
- DMXUpdateType type,
- WindowPtr pWindow)
+static void
+dmxUpdateWindowInformation(DMXInputInfo * dmxInput,
+ DMXUpdateType type, WindowPtr pWindow)
{
int i;
#ifdef PANORAMIX
- if (!noPanoramiXExtension && pWindow && pWindow->parent != screenInfo.screens[0]->root)
+ if (!noPanoramiXExtension && pWindow &&
+ pWindow->parent != screenInfo.screens[0]->root)
return;
#endif
#if DMX_WINDOW_DEBUG
{
const char *name = "Unknown";
+
switch (type) {
- case DMX_UPDATE_REALIZE: name = "Realize"; break;
- case DMX_UPDATE_UNREALIZE: name = "Unrealize"; break;
- case DMX_UPDATE_RESTACK: name = "Restack"; break;
- case DMX_UPDATE_COPY: name = "Copy"; break;
- case DMX_UPDATE_RESIZE: name = "Resize"; break;
- case DMX_UPDATE_REPARENT: name = "Repaint"; break;
+ case DMX_UPDATE_REALIZE:
+ name = "Realize";
+ break;
+ case DMX_UPDATE_UNREALIZE:
+ name = "Unrealize";
+ break;
+ case DMX_UPDATE_RESTACK:
+ name = "Restack";
+ break;
+ case DMX_UPDATE_COPY:
+ name = "Copy";
+ break;
+ case DMX_UPDATE_RESIZE:
+ name = "Resize";
+ break;
+ case DMX_UPDATE_REPARENT:
+ name = "Repaint";
+ break;
}
dmxLog(dmxDebug, "Window %p changed: %s\n", pWindow, name);
}
@@ -587,7 +618,8 @@ static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput,
type, pWindow);
}
-static void dmxCollectAll(DMXInputInfo *dmxInput)
+static void
+dmxCollectAll(DMXInputInfo * dmxInput)
{
int i;
@@ -595,29 +627,29 @@ static void dmxCollectAll(DMXInputInfo *dmxInput)
return;
for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
if (dmxInput->devs[i]->collect_events)
- dmxInput->devs[i]->collect_events(&dmxInput->devs[i]->pDevice->public,
- dmxMotion,
- dmxEnqueue,
+ dmxInput->devs[i]->collect_events(&dmxInput->devs[i]->pDevice->
+ public, dmxMotion, dmxEnqueue,
dmxCheckSpecialKeys, DMX_BLOCK);
}
-static void dmxBlockHandler(pointer blockData, OSTimePtr pTimeout,
- pointer pReadMask)
+static void
+dmxBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
{
- DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData];
+ DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData];
static unsigned long generation = 0;
-
+
if (generation != serverGeneration) {
generation = serverGeneration;
dmxCollectAll(dmxInput);
}
}
-static void dmxSwitchReturn(pointer p)
+static void
+dmxSwitchReturn(pointer p)
{
DMXInputInfo *dmxInput = p;
- int i;
-
+ int i;
+
dmxLog(dmxInfo, "Returning from VT %d\n", dmxInput->vt_switched);
if (!dmxInput->vt_switched)
@@ -629,25 +661,25 @@ static void dmxSwitchReturn(pointer p)
dmxInput->vt_switched = 0;
}
-static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask)
+static void
+dmxWakeupHandler(pointer blockData, int result, pointer pReadMask)
{
- DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData];
- int i;
+ DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData];
+ int i;
if (dmxInput->vt_switch_pending) {
dmxLog(dmxInfo, "Switching to VT %d\n", dmxInput->vt_switch_pending);
for (i = 0; i < dmxInput->numDevs; i++)
if (dmxInput->devs[i]->vt_pre_switch)
dmxInput->devs[i]->vt_pre_switch(dmxInput->devs[i]->private);
- dmxInput->vt_switched = dmxInput->vt_switch_pending;
+ dmxInput->vt_switched = dmxInput->vt_switch_pending;
dmxInput->vt_switch_pending = 0;
for (i = 0; i < dmxInput->numDevs; i++) {
if (dmxInput->devs[i]->vt_switch) {
dmxSigioDisableInput();
if (!dmxInput->devs[i]->vt_switch(dmxInput->devs[i]->private,
dmxInput->vt_switched,
- dmxSwitchReturn,
- dmxInput))
+ dmxSwitchReturn, dmxInput))
dmxSwitchReturn(dmxInput);
break; /* Only call one vt_switch routine */
}
@@ -656,35 +688,44 @@ static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask)
dmxCollectAll(dmxInput);
}
-static char *dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal)
+static char *
+dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal)
{
- static int k = 0;
- static int m = 0;
- static int o = 0;
+ static int k = 0;
+ static int m = 0;
+ static int o = 0;
static unsigned long dmxGeneration = 0;
+
#define LEN 32
- char * buf = malloc(LEN);
+ char *buf = malloc(LEN);
if (dmxGeneration != serverGeneration) {
- k = m = o = 0;
+ k = m = o = 0;
dmxGeneration = serverGeneration;
}
switch (dmxLocal->type) {
- case DMX_LOCAL_KEYBOARD: snprintf(buf, LEN, "Keyboard%d", k++); break;
- case DMX_LOCAL_MOUSE: snprintf(buf, LEN, "Mouse%d", m++); break;
- default: snprintf(buf, LEN, "Other%d", o++); break;
+ case DMX_LOCAL_KEYBOARD:
+ snprintf(buf, LEN, "Keyboard%d", k++);
+ break;
+ case DMX_LOCAL_MOUSE:
+ snprintf(buf, LEN, "Mouse%d", m++);
+ break;
+ default:
+ snprintf(buf, LEN, "Other%d", o++);
+ break;
}
return buf;
}
-static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
+static DeviceIntPtr
+dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
{
DeviceIntPtr pDevice;
- Atom atom;
- const char *name = NULL;
- char *devname;
+ Atom atom;
+ const char *name = NULL;
+ char *devname;
DMXInputInfo *dmxInput;
if (!dmxLocal)
@@ -693,41 +734,41 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
if (dmxLocal->sendsCore) {
if (dmxLocal->type == DMX_LOCAL_KEYBOARD && !dmxLocalCoreKeyboard) {
- dmxLocal->isCore = 1;
+ dmxLocal->isCore = 1;
dmxLocalCoreKeyboard = dmxLocal;
- name = "keyboard";
+ name = "keyboard";
}
if (dmxLocal->type == DMX_LOCAL_MOUSE && !dmxLocalCorePointer) {
- dmxLocal->isCore = 1;
- dmxLocalCorePointer = dmxLocal;
- name = "pointer";
+ dmxLocal->isCore = 1;
+ dmxLocalCorePointer = dmxLocal;
+ name = "pointer";
}
}
if (!name) {
- name = "extension";
+ name = "extension";
}
if (!name)
dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name);
- pDevice = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE);
+ pDevice = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE);
if (!pDevice) {
dmxLog(dmxError, "Too many devices -- cannot add device %s\n",
dmxLocal->name);
return NULL;
}
pDevice->public.devicePrivate = dmxLocal;
- dmxLocal->pDevice = pDevice;
+ dmxLocal->pDevice = pDevice;
- devname = dmxMakeUniqueDeviceName(dmxLocal);
- atom = MakeAtom((char *)devname, strlen(devname), TRUE);
+ devname = dmxMakeUniqueDeviceName(dmxLocal);
+ atom = MakeAtom((char *) devname, strlen(devname), TRUE);
pDevice->type = atom;
pDevice->name = devname;
if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) {
-#if 00 /*BP*/
- miRegisterPointerDevice(screenInfo.screens[0], pDevice);
+#if 00 /*BP*/
+ miRegisterPointerDevice(screenInfo.screens[0], pDevice);
#else
/* Nothing? dmxDeviceOnOff() should get called to init, right? */
#endif
@@ -740,60 +781,62 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
dmxLocal->name, name, devname,
dmxLocal->isCore
? " [core]"
- : (dmxLocal->sendsCore
- ? " [sends core events]"
- : ""));
+ : (dmxLocal->sendsCore ? " [sends core events]" : ""));
return pDevice;
}
-static DMXLocalInputInfoPtr dmxLookupLocal(const char *name)
+static DMXLocalInputInfoPtr
+dmxLookupLocal(const char *name)
{
DMXLocalInputInfoPtr pt;
-
+
for (pt = &DMXLocalDevices[0]; pt->name; ++pt)
- if (!strcmp(pt->name, name)) return pt; /* search for device name */
+ if (!strcmp(pt->name, name))
+ return pt; /* search for device name */
return NULL;
}
/** Copy the local input information from \a s into a new \a devs slot
* in \a dmxInput. */
-DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
- DMXLocalInputInfoPtr s)
+DMXLocalInputInfoPtr
+dmxInputCopyLocal(DMXInputInfo * dmxInput, DMXLocalInputInfoPtr s)
{
DMXLocalInputInfoPtr dmxLocal = malloc(sizeof(*dmxLocal));
-
+
if (!dmxLocal)
dmxLog(dmxFatal, "DMXLocalInputInfoPtr: out of memory\n");
memcpy(dmxLocal, s, sizeof(*dmxLocal));
- dmxLocal->inputIdx = dmxInput->inputIdx;
- dmxLocal->sendsCore = dmxInput->core;
+ dmxLocal->inputIdx = dmxInput->inputIdx;
+ dmxLocal->sendsCore = dmxInput->core;
dmxLocal->savedSendsCore = dmxInput->core;
- dmxLocal->deviceId = -1;
+ dmxLocal->deviceId = -1;
++dmxInput->numDevs;
dmxInput->devs = realloc(dmxInput->devs,
- dmxInput->numDevs * sizeof(*dmxInput->devs));
- dmxInput->devs[dmxInput->numDevs-1] = dmxLocal;
-
+ dmxInput->numDevs * sizeof(*dmxInput->devs));
+ dmxInput->devs[dmxInput->numDevs - 1] = dmxLocal;
+
return dmxLocal;
}
-static void dmxPopulateLocal(DMXInputInfo *dmxInput, dmxArg a)
+static void
+dmxPopulateLocal(DMXInputInfo * dmxInput, dmxArg a)
{
- int i;
- int help = 0;
+ int i;
+ int help = 0;
DMXLocalInputInfoRec *pt;
for (i = 1; i < dmxArgC(a); i++) {
const char *name = dmxArgV(a, i);
+
if ((pt = dmxLookupLocal(name))) {
dmxInputCopyLocal(dmxInput, pt);
- } else {
+ }
+ else {
if (strlen(name))
- dmxLog(dmxWarning,
- "Could not find a driver called %s\n", name);
+ dmxLog(dmxWarning, "Could not find a driver called %s\n", name);
++help;
}
}
@@ -801,10 +844,17 @@ static void dmxPopulateLocal(DMXInputInfo *dmxInput, dmxArg a)
dmxLog(dmxInfo, "Available local device drivers:\n");
for (pt = &DMXLocalDevices[0]; pt->name; ++pt) {
const char *type;
+
switch (pt->type) {
- case DMX_LOCAL_KEYBOARD: type = "keyboard"; break;
- case DMX_LOCAL_MOUSE: type = "pointer"; break;
- default: type = "unknown"; break;
+ case DMX_LOCAL_KEYBOARD:
+ type = "keyboard";
+ break;
+ case DMX_LOCAL_MOUSE:
+ type = "pointer";
+ break;
+ default:
+ type = "unknown";
+ break;
}
dmxLog(dmxInfo, " %s (%s)\n", pt->name, type);
}
@@ -812,30 +862,35 @@ static void dmxPopulateLocal(DMXInputInfo *dmxInput, dmxArg a)
}
}
-int dmxInputExtensionErrorHandler(Display *dsp, _Xconst char *name, _Xconst char *reason)
+int
+dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name,
+ _Xconst char *reason)
{
return 0;
}
-static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
+static void
+dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI)
{
- XExtensionVersion *ext;
- XDeviceInfo *devices;
- Display *display;
- int num;
- int i, j;
- XextErrorHandler handler;
-
- if (!(display = XOpenDisplay(dmxInput->name))) return;
-
+ XExtensionVersion *ext;
+ XDeviceInfo *devices;
+ Display *display;
+ int num;
+ int i, j;
+ XextErrorHandler handler;
+
+ if (!(display = XOpenDisplay(dmxInput->name)))
+ return;
+
/* Print out information about the XInput Extension. */
handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
- ext = XGetExtensionVersion(display, INAME);
+ ext = XGetExtensionVersion(display, INAME);
XSetExtensionErrorHandler(handler);
-
- if (!ext || ext == (XExtensionVersion *)NoSuchExtension) {
+
+ if (!ext || ext == (XExtensionVersion *) NoSuchExtension) {
dmxLogInput(dmxInput, "%s is not available\n", INAME);
- } else {
+ }
+ else {
dmxLogInput(dmxInput, "Locating devices on %s (%s version %d.%d)\n",
dmxInput->name, INAME,
ext->major_version, ext->minor_version);
@@ -844,31 +899,41 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
XFree(ext);
ext = NULL;
- /* Print a list of all devices */
+ /* Print a list of all devices */
for (i = 0; i < num; i++) {
const char *use = "Unknown";
+
switch (devices[i].use) {
- case IsXPointer: use = "XPointer"; break;
- case IsXKeyboard: use = "XKeyboard"; break;
- case IsXExtensionDevice: use = "XExtensionDevice"; break;
- case IsXExtensionPointer: use = "XExtensionPointer"; break;
- case IsXExtensionKeyboard: use = "XExtensionKeyboard"; break;
+ case IsXPointer:
+ use = "XPointer";
+ break;
+ case IsXKeyboard:
+ use = "XKeyboard";
+ break;
+ case IsXExtensionDevice:
+ use = "XExtensionDevice";
+ break;
+ case IsXExtensionPointer:
+ use = "XExtensionPointer";
+ break;
+ case IsXExtensionKeyboard:
+ use = "XExtensionKeyboard";
+ break;
}
dmxLogInput(dmxInput, " %2d %-10.10s %-16.16s\n",
devices[i].id,
- devices[i].name ? devices[i].name : "",
- use);
+ devices[i].name ? devices[i].name : "", use);
}
- /* Search for extensions */
+ /* Search for extensions */
for (i = 0; i < num; i++) {
switch (devices[i].use) {
case IsXKeyboard:
for (j = 0; j < dmxInput->numDevs; j++) {
DMXLocalInputInfoPtr dmxL = dmxInput->devs[j];
- if (dmxL->type == DMX_LOCAL_KEYBOARD
- && dmxL->deviceId < 0) {
- dmxL->deviceId = devices[i].id;
+
+ if (dmxL->type == DMX_LOCAL_KEYBOARD && dmxL->deviceId < 0) {
+ dmxL->deviceId = devices[i].id;
dmxL->deviceName = (devices[i].name
? strdup(devices[i].name)
: NULL);
@@ -878,8 +943,9 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
case IsXPointer:
for (j = 0; j < dmxInput->numDevs; j++) {
DMXLocalInputInfoPtr dmxL = dmxInput->devs[j];
+
if (dmxL->type == DMX_LOCAL_MOUSE && dmxL->deviceId < 0) {
- dmxL->deviceId = devices[i].id;
+ dmxL->deviceId = devices[i].id;
dmxL->deviceName = (devices[i].name
? xstrdup(devices[i].name)
: NULL);
@@ -895,12 +961,14 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
/** Re-initialize all the devices described in \a dmxInput. Called from
#dmxAdjustCursorBoundaries before the cursor is redisplayed. */
-void dmxInputReInit(DMXInputInfo *dmxInput)
+void
+dmxInputReInit(DMXInputInfo * dmxInput)
{
int i;
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+
if (dmxLocal->reinit)
dmxLocal->reinit(&dmxLocal->pDevice->public);
}
@@ -908,28 +976,31 @@ void dmxInputReInit(DMXInputInfo *dmxInput)
/** Re-initialize all the devices described in \a dmxInput. Called from
#dmxAdjustCursorBoundaries after the cursor is redisplayed. */
-void dmxInputLateReInit(DMXInputInfo *dmxInput)
+void
+dmxInputLateReInit(DMXInputInfo * dmxInput)
{
int i;
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+
if (dmxLocal->latereinit)
dmxLocal->latereinit(&dmxLocal->pDevice->public);
}
}
/** Initialize all of the devices described in \a dmxInput. */
-void dmxInputInit(DMXInputInfo *dmxInput)
+void
+dmxInputInit(DMXInputInfo * dmxInput)
{
- DeviceIntPtr pPointer = NULL, pKeyboard = NULL;
- dmxArg a;
- const char *name;
- int i;
- int doXI = 1; /* Include by default */
- int forceConsole = 0;
- int doWindows = 1; /* On by default */
- int hasXkb = 0;
+ DeviceIntPtr pPointer = NULL, pKeyboard = NULL;
+ dmxArg a;
+ const char *name;
+ int i;
+ int doXI = 1; /* Include by default */
+ int forceConsole = 0;
+ int doWindows = 1; /* On by default */
+ int hasXkb = 0;
a = dmxArgParse(dmxInput->name);
@@ -940,7 +1011,7 @@ void dmxInputInit(DMXInputInfo *dmxInput)
++hasXkb;
break;
case 2:
- dmxInput->symbols = xstrdup(dmxArgV(a, i));
+ dmxInput->symbols = xstrdup(dmxArgV(a, i));
++hasXkb;
break;
case 3:
@@ -948,16 +1019,22 @@ void dmxInputInit(DMXInputInfo *dmxInput)
hasXkb = 0;
break;
case 0:
- if (!strcmp(dmxArgV(a, i), "noxi")) doXI = 0;
- else if (!strcmp(dmxArgV(a, i), "xi")) doXI = 1;
- else if (!strcmp(dmxArgV(a, i), "console")) forceConsole = 1;
- else if (!strcmp(dmxArgV(a, i), "noconsole")) forceConsole = 0;
- else if (!strcmp(dmxArgV(a, i), "windows")) doWindows = 1;
- else if (!strcmp(dmxArgV(a, i), "nowindows")) doWindows = 0;
- else if (!strcmp(dmxArgV(a, i), "xkb")) hasXkb = 1;
+ if (!strcmp(dmxArgV(a, i), "noxi"))
+ doXI = 0;
+ else if (!strcmp(dmxArgV(a, i), "xi"))
+ doXI = 1;
+ else if (!strcmp(dmxArgV(a, i), "console"))
+ forceConsole = 1;
+ else if (!strcmp(dmxArgV(a, i), "noconsole"))
+ forceConsole = 0;
+ else if (!strcmp(dmxArgV(a, i), "windows"))
+ doWindows = 1;
+ else if (!strcmp(dmxArgV(a, i), "nowindows"))
+ doWindows = 0;
+ else if (!strcmp(dmxArgV(a, i), "xkb"))
+ hasXkb = 1;
else {
- dmxLog(dmxFatal,
- "Unknown input argument: %s\n", dmxArgV(a, i));
+ dmxLog(dmxFatal, "Unknown input argument: %s\n", dmxArgV(a, i));
}
}
}
@@ -966,11 +1043,13 @@ void dmxInputInit(DMXInputInfo *dmxInput)
if (!strcmp(name, "local")) {
dmxPopulateLocal(dmxInput, a);
- } else if (!strcmp(name, "dummy")) {
+ }
+ else if (!strcmp(name, "dummy")) {
dmxInputCopyLocal(dmxInput, &DMXDummyMou);
dmxInputCopyLocal(dmxInput, &DMXDummyKbd);
dmxLogInput(dmxInput, "Using dummy input\n");
- } else {
+ }
+ else {
int found;
for (found = 0, i = 0; i < dmxNumScreens; i++) {
@@ -983,10 +1062,13 @@ void dmxInputInit(DMXInputInfo *dmxInput)
dmxLog(dmxWarning,
"Cannot use core devices on a backend (%s)"
" as XInput devices\n", name);
- } else {
+ }
+ else {
char *pt;
- for (pt = (char *)dmxInput->name; pt && *pt; pt++)
- if (*pt == ',') *pt = '\0';
+
+ for (pt = (char *) dmxInput->name; pt && *pt; pt++)
+ if (*pt == ',')
+ *pt = '\0';
dmxInputCopyLocal(dmxInput, &DMXBackendMou);
dmxInputCopyLocal(dmxInput, &DMXBackendKbd);
dmxInput->scrnIdx = i;
@@ -999,13 +1081,16 @@ void dmxInputInit(DMXInputInfo *dmxInput)
}
if (!found || forceConsole) {
char *pt;
- if (found) dmxInput->console = TRUE;
- for (pt = (char *)dmxInput->name; pt && *pt; pt++)
- if (*pt == ',') *pt = '\0';
+
+ if (found)
+ dmxInput->console = TRUE;
+ for (pt = (char *) dmxInput->name; pt && *pt; pt++)
+ if (*pt == ',')
+ *pt = '\0';
dmxInputCopyLocal(dmxInput, &DMXConsoleMou);
dmxInputCopyLocal(dmxInput, &DMXConsoleKbd);
if (doWindows) {
- dmxInput->windows = TRUE;
+ dmxInput->windows = TRUE;
dmxInput->updateWindowInfo = dmxUpdateWindowInformation;
}
dmxLogInput(dmxInput,
@@ -1016,50 +1101,56 @@ void dmxInputInit(DMXInputInfo *dmxInput)
dmxArgFree(a);
- /* Locate extensions we may be interested in */
+ /* Locate extensions we may be interested in */
dmxInputScanForExtensions(dmxInput, doXI);
-
+
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+
dmxLocal->pDevice = dmxAddDevice(dmxLocal);
if (dmxLocal->isCore) {
if (dmxLocal->type == DMX_LOCAL_MOUSE)
- pPointer = dmxLocal->pDevice;
+ pPointer = dmxLocal->pDevice;
if (dmxLocal->type == DMX_LOCAL_KEYBOARD)
pKeyboard = dmxLocal->pDevice;
}
}
-
- dmxInput->processInputEvents = dmxProcessInputEvents;
- dmxInput->detached = False;
-
+
+ dmxInput->processInputEvents = dmxProcessInputEvents;
+ dmxInput->detached = False;
+
RegisterBlockAndWakeupHandlers(dmxBlockHandler, dmxWakeupHandler,
- (void *)(uintptr_t)dmxInput->inputIdx);
+ (void *) (uintptr_t) dmxInput->inputIdx);
}
-static void dmxInputFreeLocal(DMXLocalInputInfoRec *local)
+static void
+dmxInputFreeLocal(DMXLocalInputInfoRec * local)
{
- if (!local) return;
+ if (!local)
+ return;
if (local->isCore && local->type == DMX_LOCAL_MOUSE)
- dmxLocalCorePointer = NULL;
+ dmxLocalCorePointer = NULL;
if (local->isCore && local->type == DMX_LOCAL_KEYBOARD)
dmxLocalCoreKeyboard = NULL;
- if (local->destroy_private) local->destroy_private(local->private);
+ if (local->destroy_private)
+ local->destroy_private(local->private);
free(local->history);
free(local->valuators);
free(local->deviceName);
- local->private = NULL;
- local->history = NULL;
+ local->private = NULL;
+ local->history = NULL;
local->deviceName = NULL;
free(local);
}
/** Free all of the memory associated with \a dmxInput */
-void dmxInputFree(DMXInputInfo *dmxInput)
+void
+dmxInputFree(DMXInputInfo * dmxInput)
{
int i;
-
- if (!dmxInput) return;
+
+ if (!dmxInput)
+ return;
free(dmxInput->keycodes);
free(dmxInput->symbols);
@@ -1070,14 +1161,16 @@ void dmxInputFree(DMXInputInfo *dmxInput)
dmxInput->devs[i] = NULL;
}
free(dmxInput->devs);
- dmxInput->devs = NULL;
+ dmxInput->devs = NULL;
dmxInput->numDevs = 0;
- if (dmxInput->freename) free(dmxInput->name);
- dmxInput->name = NULL;
+ if (dmxInput->freename)
+ free(dmxInput->name);
+ dmxInput->name = NULL;
}
/** Log information about all of the known devices using #dmxLog(). */
-void dmxInputLogDevices(void)
+void
+dmxInputLogDevices(void)
{
int i, j;
@@ -1085,34 +1178,43 @@ void dmxInputLogDevices(void)
dmxLog(dmxInfo, " Id Name Classes\n");
for (j = 0; j < dmxNumInputs; j++) {
DMXInputInfo *dmxInput = &dmxInputs[j];
- const char *pt = strchr(dmxInput->name, ',');
- int len = (pt
- ? (size_t)(pt-dmxInput->name)
- : strlen(dmxInput->name));
+ const char *pt = strchr(dmxInput->name, ',');
+ int len = (pt ? (size_t) (pt - dmxInput->name)
+ : strlen(dmxInput->name));
for (i = 0; i < dmxInput->numDevs; i++) {
DeviceIntPtr pDevice = dmxInput->devs[i]->pDevice;
+
if (pDevice) {
dmxLog(dmxInfo, " %2d%c %-20.20s",
pDevice->id,
- dmxInput->detached ? 'D' : ' ',
- pDevice->name);
- if (pDevice->key) dmxLogCont(dmxInfo, " key");
- if (pDevice->valuator) dmxLogCont(dmxInfo, " val");
- if (pDevice->button) dmxLogCont(dmxInfo, " btn");
- if (pDevice->focus) dmxLogCont(dmxInfo, " foc");
- if (pDevice->kbdfeed) dmxLogCont(dmxInfo, " fb/kbd");
- if (pDevice->ptrfeed) dmxLogCont(dmxInfo, " fb/ptr");
- if (pDevice->intfeed) dmxLogCont(dmxInfo, " fb/int");
- if (pDevice->stringfeed) dmxLogCont(dmxInfo, " fb/str");
- if (pDevice->bell) dmxLogCont(dmxInfo, " fb/bel");
- if (pDevice->leds) dmxLogCont(dmxInfo, " fb/led");
+ dmxInput->detached ? 'D' : ' ', pDevice->name);
+ if (pDevice->key)
+ dmxLogCont(dmxInfo, " key");
+ if (pDevice->valuator)
+ dmxLogCont(dmxInfo, " val");
+ if (pDevice->button)
+ dmxLogCont(dmxInfo, " btn");
+ if (pDevice->focus)
+ dmxLogCont(dmxInfo, " foc");
+ if (pDevice->kbdfeed)
+ dmxLogCont(dmxInfo, " fb/kbd");
+ if (pDevice->ptrfeed)
+ dmxLogCont(dmxInfo, " fb/ptr");
+ if (pDevice->intfeed)
+ dmxLogCont(dmxInfo, " fb/int");
+ if (pDevice->stringfeed)
+ dmxLogCont(dmxInfo, " fb/str");
+ if (pDevice->bell)
+ dmxLogCont(dmxInfo, " fb/bel");
+ if (pDevice->leds)
+ dmxLogCont(dmxInfo, " fb/led");
if (!pDevice->key && !pDevice->valuator && !pDevice->button
&& !pDevice->focus && !pDevice->kbdfeed
&& !pDevice->ptrfeed && !pDevice->intfeed
- && !pDevice->stringfeed && !pDevice->bell
- && !pDevice->leds) dmxLogCont(dmxInfo, " (none)");
-
+ && !pDevice->stringfeed && !pDevice->bell && !pDevice->leds)
+ dmxLogCont(dmxInfo, " (none)");
+
dmxLogCont(dmxInfo, "\t[i%d/%*.*s",
dmxInput->inputIdx, len, len, dmxInput->name);
if (dmxInput->devs[i]->deviceId >= 0)
@@ -1123,30 +1225,30 @@ void dmxInputLogDevices(void)
dmxInput->devs[i]->isCore
? "core"
: (dmxInput->devs[i]->sendsCore
- ? "extension (sends core events)"
- : "extension"));
+ ? "extension (sends core events)" : "extension"));
}
}
}
}
/** Detach an input */
-int dmxInputDetach(DMXInputInfo *dmxInput)
+int
+dmxInputDetach(DMXInputInfo * dmxInput)
{
int i;
- if (dmxInput->detached) return BadAccess;
-
+ if (dmxInput->detached)
+ return BadAccess;
+
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+
dmxLogInput(dmxInput, "Detaching device id %d: %s%s\n",
dmxLocal->pDevice->id,
dmxLocal->pDevice->name,
dmxLocal->isCore
? " [core]"
- : (dmxLocal->sendsCore
- ? " [sends core events]"
- : ""));
+ : (dmxLocal->sendsCore ? " [sends core events]" : ""));
DisableDevice(dmxLocal->pDevice, TRUE);
}
dmxInput->detached = True;
@@ -1155,116 +1257,133 @@ int dmxInputDetach(DMXInputInfo *dmxInput)
}
/** Search for input associated with \a dmxScreen, and detach. */
-void dmxInputDetachAll(DMXScreenInfo *dmxScreen)
+void
+dmxInputDetachAll(DMXScreenInfo * dmxScreen)
{
int i;
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (dmxInput->scrnIdx == dmxScreen->index) dmxInputDetach(dmxInput);
+
+ if (dmxInput->scrnIdx == dmxScreen->index)
+ dmxInputDetach(dmxInput);
}
}
/** Search for input associated with \a deviceId, and detach. */
-int dmxInputDetachId(int id)
+int
+dmxInputDetachId(int id)
{
DMXInputInfo *dmxInput = dmxInputLocateId(id);
- if (!dmxInput) return BadValue;
-
+ if (!dmxInput)
+ return BadValue;
+
return dmxInputDetach(dmxInput);
}
-DMXInputInfo *dmxInputLocateId(int id)
+DMXInputInfo *
+dmxInputLocateId(int id)
{
int i, j;
-
+
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
+
for (j = 0; j < dmxInput->numDevs; j++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
- if (dmxLocal->pDevice->id == id) return dmxInput;
+
+ if (dmxLocal->pDevice->id == id)
+ return dmxInput;
}
}
return NULL;
}
-static int dmxInputAttachNew(DMXInputInfo *dmxInput, int *id)
+static int
+dmxInputAttachNew(DMXInputInfo * dmxInput, int *id)
{
dmxInputInit(dmxInput);
InitAndStartDevices();
- if (id && dmxInput->devs) *id = dmxInput->devs[0]->pDevice->id;
+ if (id && dmxInput->devs)
+ *id = dmxInput->devs[0]->pDevice->id;
dmxInputLogDevices();
return 0;
}
-static int dmxInputAttachOld(DMXInputInfo *dmxInput, int *id)
+static int
+dmxInputAttachOld(DMXInputInfo * dmxInput, int *id)
{
int i;
-
+
dmxInput->detached = False;
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
- if (id) *id = dmxLocal->pDevice->id;
+
+ if (id)
+ *id = dmxLocal->pDevice->id;
dmxLogInput(dmxInput,
"Attaching device id %d: %s%s\n",
dmxLocal->pDevice->id,
dmxLocal->pDevice->name,
dmxLocal->isCore
? " [core]"
- : (dmxLocal->sendsCore
- ? " [sends core events]"
- : ""));
+ : (dmxLocal->sendsCore ? " [sends core events]" : ""));
EnableDevice(dmxLocal->pDevice, TRUE);
}
dmxInputLogDevices();
return 0;
}
-int dmxInputAttachConsole(const char *name, int isCore, int *id)
+int
+dmxInputAttachConsole(const char *name, int isCore, int *id)
{
- DMXInputInfo *dmxInput;
- int i;
+ DMXInputInfo *dmxInput;
+ int i;
for (i = 0; i < dmxNumInputs; i++) {
dmxInput = &dmxInputs[i];
if (dmxInput->scrnIdx == -1
- && dmxInput->detached
- && !strcmp(dmxInput->name, name)) {
- /* Found match */
+ && dmxInput->detached && !strcmp(dmxInput->name, name)) {
+ /* Found match */
dmxLogInput(dmxInput, "Reattaching detached console input\n");
return dmxInputAttachOld(dmxInput, id);
}
}
- /* No match found */
+ /* No match found */
dmxInput = dmxConfigAddInput(xstrdup(name), isCore);
dmxInput->freename = TRUE;
dmxLogInput(dmxInput, "Attaching new console input\n");
return dmxInputAttachNew(dmxInput, id);
}
-int dmxInputAttachBackend(int physicalScreen, int isCore, int *id)
+int
+dmxInputAttachBackend(int physicalScreen, int isCore, int *id)
{
- DMXInputInfo *dmxInput;
+ DMXInputInfo *dmxInput;
DMXScreenInfo *dmxScreen;
- int i;
-
- if (physicalScreen < 0 || physicalScreen >= dmxNumScreens) return BadValue;
+ int i;
+
+ if (physicalScreen < 0 || physicalScreen >= dmxNumScreens)
+ return BadValue;
for (i = 0; i < dmxNumInputs; i++) {
dmxInput = &dmxInputs[i];
if (dmxInput->scrnIdx != -1 && dmxInput->scrnIdx == physicalScreen) {
- /* Found match */
- if (!dmxInput->detached) return BadAccess; /* Already attached */
+ /* Found match */
+ if (!dmxInput->detached)
+ return BadAccess; /* Already attached */
dmxScreen = &dmxScreens[physicalScreen];
- if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */
+ if (!dmxScreen->beDisplay)
+ return BadAccess; /* Screen detached */
dmxLogInput(dmxInput, "Reattaching detached backend input\n");
return dmxInputAttachOld(dmxInput, id);
}
}
- /* No match found */
+ /* No match found */
dmxScreen = &dmxScreens[physicalScreen];
- if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */
+ if (!dmxScreen->beDisplay)
+ return BadAccess; /* Screen detached */
dmxInput = dmxConfigAddInput(dmxScreen->name, isCore);
dmxLogInput(dmxInput, "Attaching new backend input\n");
return dmxInputAttachNew(dmxInput, id);
diff --git a/xorg-server/hw/dmx/input/dmxinputinit.h b/xorg-server/hw/dmx/input/dmxinputinit.h
index d23ad7a38..94ec1019b 100644
--- a/xorg-server/hw/dmx/input/dmxinputinit.h
+++ b/xorg-server/hw/dmx/input/dmxinputinit.h
@@ -1,291 +1,284 @@
-/*
- * Copyright 2002 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- * Interface for low-level input support. \see dmxinputinit.c */
-
-#ifndef _DMXINPUTINIT_H_
-#define _DMXINPUTINIT_H_
-
-#include "dmx.h"
-#include "dmxinput.h"
-#include "dmxlog.h"
-
-
-#define DMX_LOCAL_DEFAULT_KEYBOARD "kbd"
-#define DMX_LOCAL_DEFAULT_POINTER "ps2"
-#define DMX_MAX_BUTTONS 256
-#define DMX_MOTION_SIZE 256
-#define DMX_MAX_VALUATORS 32
-#define DMX_MAX_AXES 32
-#define DMX_MAX_XINPUT_EVENT_TYPES 100
-#define DMX_MAP_ENTRIES 16 /* Must be a power of 2 */
-#define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1)
-
-typedef enum {
- DMX_FUNCTION_GRAB,
- DMX_FUNCTION_TERMINATE,
- DMX_FUNCTION_FINE
-} DMXFunctionType;
-
-typedef enum {
- DMX_LOCAL_HIGHLEVEL,
- DMX_LOCAL_KEYBOARD,
- DMX_LOCAL_MOUSE,
- DMX_LOCAL_OTHER
-} DMXLocalInputType;
-
-typedef enum {
- DMX_LOCAL_TYPE_LOCAL,
- DMX_LOCAL_TYPE_CONSOLE,
- DMX_LOCAL_TYPE_BACKEND,
- DMX_LOCAL_TYPE_COMMON
-} DMXLocalInputExtType;
-
-typedef enum {
- DMX_RELATIVE,
- DMX_ABSOLUTE,
- DMX_ABSOLUTE_CONFINED
-} DMXMotionType;
-
-/** Stores information from low-level device that is used to initialize
- * the device at the dix level. */
-typedef struct _DMXLocalInitInfo {
- int keyboard; /**< Non-zero if the device is a keyboard */
-
- int keyClass; /**< Non-zero if keys are present */
- KeySymsRec keySyms; /**< Key symbols */
- int freemap; /**< If non-zero, free keySyms.map */
- CARD8 modMap[MAP_LENGTH]; /**< Modifier map */
- XkbDescPtr xkb; /**< XKB description */
- XkbComponentNamesRec names; /**< XKB component names */
- int freenames; /**< Non-zero if names should be free'd */
- int force; /**< Do not allow command line override */
-
- int buttonClass; /**< Non-zero if buttons are present */
- int numButtons; /**< Number of buttons */
- unsigned char map[DMX_MAX_BUTTONS]; /**< Button map */
-
- int valuatorClass; /**< Non-zero if valuators are
- * present */
- int numRelAxes; /**< Number of relative axes */
- int numAbsAxes; /**< Number of absolute axes */
- int minval[DMX_MAX_AXES]; /**< Minimum values */
- int maxval[DMX_MAX_AXES]; /**< Maximum values */
- int res[DMX_MAX_AXES]; /**< Resolution */
- int minres[DMX_MAX_AXES]; /**< Minimum resolutions */
- int maxres[DMX_MAX_AXES]; /**< Maximum resolutions */
-
- int focusClass; /**< Non-zero if device can
- * cause focus */
- int proximityClass; /**< Non-zero if device
- * causes proximity events */
- int kbdFeedbackClass; /**< Non-zero if device has
- * keyboard feedback */
- int ptrFeedbackClass; /**< Non-zero if device has
- * pointer feedback */
- int ledFeedbackClass; /**< Non-zero if device has
- * LED indicators */
- int belFeedbackClass; /**< Non-zero if device has a
- * bell */
- int intFeedbackClass; /**< Non-zero if device has
- * integer feedback */
- int strFeedbackClass; /**< Non-zero if device has
- * string feedback */
-
- int maxSymbols; /**< Maximum symbols */
- int maxSymbolsSupported; /**< Maximum symbols supported */
- KeySym *symbols; /**< Key symbols */
-} DMXLocalInitInfo, *DMXLocalInitInfoPtr;
-
-typedef pointer (*dmxCreatePrivateProcPtr)(DeviceIntPtr);
-typedef void (*dmxDestroyPrivateProcPtr)(pointer);
-
-typedef void (*dmxInitProcPtr)(DevicePtr);
-typedef void (*dmxReInitProcPtr)(DevicePtr);
-typedef void (*dmxLateReInitProcPtr)(DevicePtr);
-typedef void (*dmxGetInfoProcPtr)(DevicePtr, DMXLocalInitInfoPtr);
-typedef int (*dmxOnProcPtr)(DevicePtr);
-typedef void (*dmxOffProcPtr)(DevicePtr);
-typedef void (*dmxUpdatePositionProcPtr)(pointer, int x, int y);
-
-typedef void (*dmxVTPreSwitchProcPtr)(pointer); /* Turn I/O Off */
-typedef void (*dmxVTPostSwitchProcPtr)(pointer); /* Turn I/O On */
-typedef void (*dmxVTSwitchReturnProcPtr)(pointer);
-typedef int (*dmxVTSwitchProcPtr)(pointer, int vt,
- dmxVTSwitchReturnProcPtr, pointer);
-
-typedef void (*dmxMotionProcPtr)(DevicePtr,
- int *valuators,
- int firstAxis,
- int axesCount,
- DMXMotionType type,
- DMXBlockType block);
-typedef void (*dmxEnqueueProcPtr)(DevicePtr, int type, int detail,
- KeySym keySym, XEvent *e,
- DMXBlockType block);
-typedef int (*dmxCheckSpecialProcPtr)(DevicePtr, KeySym keySym);
-typedef void (*dmxCollectEventsProcPtr)(DevicePtr,
- dmxMotionProcPtr,
- dmxEnqueueProcPtr,
- dmxCheckSpecialProcPtr,
- DMXBlockType);
-typedef void (*dmxProcessInputProcPtr)(pointer);
-typedef void (*dmxUpdateInfoProcPtr)(pointer, DMXUpdateType, WindowPtr);
-typedef int (*dmxFunctionsProcPtr)(pointer, DMXFunctionType);
-
-typedef void (*dmxKBCtrlProcPtr)(DevicePtr, KeybdCtrl *ctrl);
-typedef void (*dmxMCtrlProcPtr)(DevicePtr, PtrCtrl *ctrl);
-typedef void (*dmxKBBellProcPtr)(DevicePtr, int percent,
- int volume, int pitch, int duration);
-
-/** Stores a mapping between the device id on the remote X server and
- * the id on the DMX server */
-typedef struct _DMXEventMap {
- int remote; /**< Event number on remote X server */
- int server; /**< Event number (unbiased) on DMX server */
-} DMXEventMap;
-
-/** This is the device-independent structure used by the low-level input
- * routines. The contents are not exposed to top-level .c files (except
- * dmxextensions.c). \see dmxinput.h \see dmxextensions.c */
-typedef struct _DMXLocalInputInfo {
- const char *name; /**< Device name */
- DMXLocalInputType type; /**< Device type */
- DMXLocalInputExtType extType; /**< Extended device type */
- int binding; /**< Count of how many consecutive
- * structs are bound to the same
- * device */
-
- /* Low-level (e.g., keyboard/mouse drivers) */
-
- dmxCreatePrivateProcPtr create_private; /**< Create
- * device-dependent
- * private */
- dmxDestroyPrivateProcPtr destroy_private; /**< Destroy
- * device-dependent
- * private */
- dmxInitProcPtr init; /**< Initialize device */
- dmxReInitProcPtr reinit; /**< Reinitialize device
- * (during a
- * reconfiguration) */
- dmxLateReInitProcPtr latereinit; /**< Reinitialize a device
- * (called very late
- * during a
- * reconfiguration) */
- dmxGetInfoProcPtr get_info; /**< Get device information */
- dmxOnProcPtr on; /**< Turn device on */
- dmxOffProcPtr off; /**< Turn device off */
- dmxUpdatePositionProcPtr update_position; /**< Called when another
- * device updates the
- * cursor position */
- dmxVTPreSwitchProcPtr vt_pre_switch; /**< Called before a VT switch */
- dmxVTPostSwitchProcPtr vt_post_switch; /**< Called after a VT switch */
- dmxVTSwitchProcPtr vt_switch; /**< Causes a VT switch */
-
- dmxCollectEventsProcPtr collect_events; /**< Collect and enqueue
- * events from the
- * device*/
- dmxProcessInputProcPtr process_input; /**< Process event (from
- * queue) */
- dmxFunctionsProcPtr functions;
- dmxUpdateInfoProcPtr update_info; /**< Update window layout
- * information */
-
- dmxMCtrlProcPtr mCtrl; /**< Pointer control */
- dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */
- dmxKBBellProcPtr kBell; /**< Bell control */
-
- pointer private; /**< Device-dependent private */
- int isCore; /**< Is a DMX core device */
- int sendsCore; /**< Sends DMX core events */
- KeybdCtrl kctrl; /**< Keyboard control */
- PtrCtrl mctrl; /**< Pointer control */
-
- DeviceIntPtr pDevice; /**< X-level device */
- int inputIdx; /**< High-level index */
- int lastX, lastY; /**< Last known position;
- * for XInput in
- * dmxevents.c */
-
- int head; /**< XInput motion history
- * head */
- int tail; /**< XInput motion history
- * tail */
- unsigned long *history; /**< XInput motion history */
- int *valuators; /**< Cache of previous values */
-
- /* for XInput ChangePointerDevice */
- int (*savedMotionProc)(DeviceIntPtr,
- xTimecoord *,
- unsigned long,
- unsigned long,
- ScreenPtr);
- int savedMotionEvents; /**< Saved motion events */
- int savedSendsCore; /**< Saved sends-core flag */
-
- DMXEventMap map[DMX_MAP_ENTRIES]; /**< XInput device id map */
- int mapOptimize; /**< XInput device id
- * map
- * optimization */
-
- long deviceId; /**< device id on remote side,
- * if any */
- const char *deviceName; /**< devive name on remote
- * side, if any */
-} DMXLocalInputInfoRec;
-
-extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard;
-
-extern void dmxLocalInitInput(DMXInputInfo *dmxInput);
-extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
- DMXLocalInputInfoPtr s);
-
-extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl);
-extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl);
-extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
- pointer ctrl, int unknown);
-
-extern int dmxInputExtensionErrorHandler(Display *dsp, _Xconst char *name,
- _Xconst char *reason);
-
-extern int dmxInputDetach(DMXInputInfo *dmxInput);
-extern void dmxInputDetachAll(DMXScreenInfo *dmxScreen);
-extern int dmxInputDetachId(int id);
-extern DMXInputInfo *dmxInputLocateId(int id);
-extern int dmxInputAttachConsole(const char *name, int isCore,
- int *id);
-extern int dmxInputAttachBackend(int physicalScreen, int isCore,
- int *id);
-
-#endif
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for low-level input support. \see dmxinputinit.c */
+
+#ifndef _DMXINPUTINIT_H_
+#define _DMXINPUTINIT_H_
+
+#include "dmx.h"
+#include "dmxinput.h"
+#include "dmxlog.h"
+
+#define DMX_LOCAL_DEFAULT_KEYBOARD "kbd"
+#define DMX_LOCAL_DEFAULT_POINTER "ps2"
+#define DMX_MAX_BUTTONS 256
+#define DMX_MOTION_SIZE 256
+#define DMX_MAX_VALUATORS 32
+#define DMX_MAX_AXES 32
+#define DMX_MAX_XINPUT_EVENT_TYPES 100
+#define DMX_MAP_ENTRIES 16 /* Must be a power of 2 */
+#define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1)
+
+typedef enum {
+ DMX_FUNCTION_GRAB,
+ DMX_FUNCTION_TERMINATE,
+ DMX_FUNCTION_FINE
+} DMXFunctionType;
+
+typedef enum {
+ DMX_LOCAL_HIGHLEVEL,
+ DMX_LOCAL_KEYBOARD,
+ DMX_LOCAL_MOUSE,
+ DMX_LOCAL_OTHER
+} DMXLocalInputType;
+
+typedef enum {
+ DMX_LOCAL_TYPE_LOCAL,
+ DMX_LOCAL_TYPE_CONSOLE,
+ DMX_LOCAL_TYPE_BACKEND,
+ DMX_LOCAL_TYPE_COMMON
+} DMXLocalInputExtType;
+
+typedef enum {
+ DMX_RELATIVE,
+ DMX_ABSOLUTE,
+ DMX_ABSOLUTE_CONFINED
+} DMXMotionType;
+
+/** Stores information from low-level device that is used to initialize
+ * the device at the dix level. */
+typedef struct _DMXLocalInitInfo {
+ int keyboard; /**< Non-zero if the device is a keyboard */
+
+ int keyClass; /**< Non-zero if keys are present */
+ KeySymsRec keySyms; /**< Key symbols */
+ int freemap; /**< If non-zero, free keySyms.map */
+ CARD8 modMap[MAP_LENGTH]; /**< Modifier map */
+ XkbDescPtr xkb; /**< XKB description */
+ XkbComponentNamesRec names; /**< XKB component names */
+ int freenames; /**< Non-zero if names should be free'd */
+ int force; /**< Do not allow command line override */
+
+ int buttonClass; /**< Non-zero if buttons are present */
+ int numButtons; /**< Number of buttons */
+ unsigned char map[DMX_MAX_BUTTONS]; /**< Button map */
+
+ int valuatorClass; /**< Non-zero if valuators are
+ * present */
+ int numRelAxes; /**< Number of relative axes */
+ int numAbsAxes; /**< Number of absolute axes */
+ int minval[DMX_MAX_AXES]; /**< Minimum values */
+ int maxval[DMX_MAX_AXES]; /**< Maximum values */
+ int res[DMX_MAX_AXES]; /**< Resolution */
+ int minres[DMX_MAX_AXES]; /**< Minimum resolutions */
+ int maxres[DMX_MAX_AXES]; /**< Maximum resolutions */
+
+ int focusClass; /**< Non-zero if device can
+ * cause focus */
+ int proximityClass; /**< Non-zero if device
+ * causes proximity events */
+ int kbdFeedbackClass; /**< Non-zero if device has
+ * keyboard feedback */
+ int ptrFeedbackClass; /**< Non-zero if device has
+ * pointer feedback */
+ int ledFeedbackClass; /**< Non-zero if device has
+ * LED indicators */
+ int belFeedbackClass; /**< Non-zero if device has a
+ * bell */
+ int intFeedbackClass; /**< Non-zero if device has
+ * integer feedback */
+ int strFeedbackClass; /**< Non-zero if device has
+ * string feedback */
+
+ int maxSymbols; /**< Maximum symbols */
+ int maxSymbolsSupported; /**< Maximum symbols supported */
+ KeySym *symbols; /**< Key symbols */
+} DMXLocalInitInfo, *DMXLocalInitInfoPtr;
+
+typedef pointer (*dmxCreatePrivateProcPtr) (DeviceIntPtr);
+typedef void (*dmxDestroyPrivateProcPtr) (pointer);
+
+typedef void (*dmxInitProcPtr) (DevicePtr);
+typedef void (*dmxReInitProcPtr) (DevicePtr);
+typedef void (*dmxLateReInitProcPtr) (DevicePtr);
+typedef void (*dmxGetInfoProcPtr) (DevicePtr, DMXLocalInitInfoPtr);
+typedef int (*dmxOnProcPtr) (DevicePtr);
+typedef void (*dmxOffProcPtr) (DevicePtr);
+typedef void (*dmxUpdatePositionProcPtr) (pointer, int x, int y);
+
+typedef void (*dmxVTPreSwitchProcPtr) (pointer); /* Turn I/O Off */
+typedef void (*dmxVTPostSwitchProcPtr) (pointer); /* Turn I/O On */
+typedef void (*dmxVTSwitchReturnProcPtr) (pointer);
+typedef int (*dmxVTSwitchProcPtr) (pointer, int vt,
+ dmxVTSwitchReturnProcPtr, pointer);
+
+typedef void (*dmxMotionProcPtr) (DevicePtr,
+ int *valuators,
+ int firstAxis,
+ int axesCount,
+ DMXMotionType type, DMXBlockType block);
+typedef void (*dmxEnqueueProcPtr) (DevicePtr, int type, int detail,
+ KeySym keySym, XEvent * e,
+ DMXBlockType block);
+typedef int (*dmxCheckSpecialProcPtr) (DevicePtr, KeySym keySym);
+typedef void (*dmxCollectEventsProcPtr) (DevicePtr,
+ dmxMotionProcPtr,
+ dmxEnqueueProcPtr,
+ dmxCheckSpecialProcPtr, DMXBlockType);
+typedef void (*dmxProcessInputProcPtr) (pointer);
+typedef void (*dmxUpdateInfoProcPtr) (pointer, DMXUpdateType, WindowPtr);
+typedef int (*dmxFunctionsProcPtr) (pointer, DMXFunctionType);
+
+typedef void (*dmxKBCtrlProcPtr) (DevicePtr, KeybdCtrl * ctrl);
+typedef void (*dmxMCtrlProcPtr) (DevicePtr, PtrCtrl * ctrl);
+typedef void (*dmxKBBellProcPtr) (DevicePtr, int percent,
+ int volume, int pitch, int duration);
+
+/** Stores a mapping between the device id on the remote X server and
+ * the id on the DMX server */
+typedef struct _DMXEventMap {
+ int remote; /**< Event number on remote X server */
+ int server; /**< Event number (unbiased) on DMX server */
+} DMXEventMap;
+
+/** This is the device-independent structure used by the low-level input
+ * routines. The contents are not exposed to top-level .c files (except
+ * dmxextensions.c). \see dmxinput.h \see dmxextensions.c */
+typedef struct _DMXLocalInputInfo {
+ const char *name; /**< Device name */
+ DMXLocalInputType type; /**< Device type */
+ DMXLocalInputExtType extType; /**< Extended device type */
+ int binding; /**< Count of how many consecutive
+ * structs are bound to the same
+ * device */
+
+ /* Low-level (e.g., keyboard/mouse drivers) */
+
+ dmxCreatePrivateProcPtr create_private; /**< Create
+ * device-dependent
+ * private */
+ dmxDestroyPrivateProcPtr destroy_private; /**< Destroy
+ * device-dependent
+ * private */
+ dmxInitProcPtr init; /**< Initialize device */
+ dmxReInitProcPtr reinit; /**< Reinitialize device
+ * (during a
+ * reconfiguration) */
+ dmxLateReInitProcPtr latereinit; /**< Reinitialize a device
+ * (called very late
+ * during a
+ * reconfiguration) */
+ dmxGetInfoProcPtr get_info; /**< Get device information */
+ dmxOnProcPtr on; /**< Turn device on */
+ dmxOffProcPtr off; /**< Turn device off */
+ dmxUpdatePositionProcPtr update_position; /**< Called when another
+ * device updates the
+ * cursor position */
+ dmxVTPreSwitchProcPtr vt_pre_switch; /**< Called before a VT switch */
+ dmxVTPostSwitchProcPtr vt_post_switch; /**< Called after a VT switch */
+ dmxVTSwitchProcPtr vt_switch; /**< Causes a VT switch */
+
+ dmxCollectEventsProcPtr collect_events; /**< Collect and enqueue
+ * events from the
+ * device*/
+ dmxProcessInputProcPtr process_input; /**< Process event (from
+ * queue) */
+ dmxFunctionsProcPtr functions;
+ dmxUpdateInfoProcPtr update_info; /**< Update window layout
+ * information */
+
+ dmxMCtrlProcPtr mCtrl; /**< Pointer control */
+ dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */
+ dmxKBBellProcPtr kBell; /**< Bell control */
+
+ pointer private; /**< Device-dependent private */
+ int isCore; /**< Is a DMX core device */
+ int sendsCore; /**< Sends DMX core events */
+ KeybdCtrl kctrl; /**< Keyboard control */
+ PtrCtrl mctrl; /**< Pointer control */
+
+ DeviceIntPtr pDevice; /**< X-level device */
+ int inputIdx; /**< High-level index */
+ int lastX, lastY; /**< Last known position;
+ * for XInput in
+ * dmxevents.c */
+
+ int head; /**< XInput motion history
+ * head */
+ int tail; /**< XInput motion history
+ * tail */
+ unsigned long *history; /**< XInput motion history */
+ int *valuators; /**< Cache of previous values */
+
+ /* for XInput ChangePointerDevice */
+ int (*savedMotionProc) (DeviceIntPtr,
+ xTimecoord *,
+ unsigned long, unsigned long, ScreenPtr);
+ int savedMotionEvents; /**< Saved motion events */
+ int savedSendsCore; /**< Saved sends-core flag */
+
+ DMXEventMap map[DMX_MAP_ENTRIES]; /**< XInput device id map */
+ int mapOptimize; /**< XInput device id
+ * map
+ * optimization */
+
+ long deviceId; /**< device id on remote side,
+ * if any */
+ const char *deviceName; /**< devive name on remote
+ * side, if any */
+} DMXLocalInputInfoRec;
+
+extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard;
+
+extern void dmxLocalInitInput(DMXInputInfo * dmxInput);
+extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo * dmxInput,
+ DMXLocalInputInfoPtr s);
+
+extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl);
+extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl);
+extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
+ pointer ctrl, int unknown);
+
+extern int dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name,
+ _Xconst char *reason);
+
+extern int dmxInputDetach(DMXInputInfo * dmxInput);
+extern void dmxInputDetachAll(DMXScreenInfo * dmxScreen);
+extern int dmxInputDetachId(int id);
+extern DMXInputInfo *dmxInputLocateId(int id);
+extern int dmxInputAttachConsole(const char *name, int isCore, int *id);
+extern int dmxInputAttachBackend(int physicalScreen, int isCore, int *id);
+
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxmap.c b/xorg-server/hw/dmx/input/dmxmap.c
index 1eccd3d28..1a8d4c937 100644
--- a/xorg-server/hw/dmx/input/dmxmap.c
+++ b/xorg-server/hw/dmx/input/dmxmap.c
@@ -59,15 +59,16 @@
* remoteEvent is the type returned from the remote server. The \a
* serverEvent is from the XI_* list of events in
* include/extensions/XIproto.h. */
-void dmxMapInsert(DMXLocalInputInfoPtr dmxLocal,
- int remoteEvent, int serverEvent)
+void
+dmxMapInsert(DMXLocalInputInfoPtr dmxLocal, int remoteEvent, int serverEvent)
{
int hash = remoteEvent & DMX_MAP_MASK;
int i;
- /* Return if this has already been mapped */
+ /* Return if this has already been mapped */
if (dmxLocal->map[hash].remote == remoteEvent
- && dmxLocal->map[hash].server == serverEvent) return;
+ && dmxLocal->map[hash].server == serverEvent)
+ return;
if (dmxLocal->map[hash].remote) {
dmxLocal->mapOptimize = 0;
@@ -81,18 +82,21 @@ void dmxMapInsert(DMXLocalInputInfoPtr dmxLocal,
dmxLog(dmxWarning,
"Out of map entries, cannot map remove event type %d\n",
remoteEvent);
- } else {
+ }
+ else {
dmxLocal->map[hash].remote = remoteEvent;
dmxLocal->map[hash].server = serverEvent;
}
}
/** Remove all mappings there were inserted with #dmxMapInsert. */
-void dmxMapClear(DMXLocalInputInfoPtr dmxLocal)
+void
+dmxMapClear(DMXLocalInputInfoPtr dmxLocal)
{
int i;
- for (i = 0; i < DMX_MAP_ENTRIES; i++) dmxLocal->map[i].remote = 0;
+ for (i = 0; i < DMX_MAP_ENTRIES; i++)
+ dmxLocal->map[i].remote = 0;
dmxLocal->mapOptimize = 1;
}
@@ -100,16 +104,18 @@ void dmxMapClear(DMXLocalInputInfoPtr dmxLocal)
* returned from the remote server. The return value is that which was
* passed into #dmxMapInsert (i.e., a value from the XI_* list in
* include/extensions/XIproto.h). If a mapping is not available, -1 is
- * returned. */
-int dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent)
+ * returned. */
+int
+dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent)
{
- int hash = remoteEvent & DMX_MAP_MASK;
+ int hash = remoteEvent & DMX_MAP_MASK;
int serverEvent = -1;
int i;
if (dmxLocal->mapOptimize && dmxLocal->map[hash].remote == remoteEvent) {
serverEvent = dmxLocal->map[hash].server;
- } else {
+ }
+ else {
for (i = 0; i < DMX_MAP_ENTRIES; i++)
if (dmxLocal->map[i].remote == remoteEvent) {
serverEvent = dmxLocal->map[hash].server;
diff --git a/xorg-server/hw/dmx/input/dmxmotion.c b/xorg-server/hw/dmx/input/dmxmotion.c
index 7a4b8a0dc..1642894a2 100644
--- a/xorg-server/hw/dmx/input/dmxmotion.c
+++ b/xorg-server/hw/dmx/input/dmxmotion.c
@@ -1,141 +1,149 @@
-/*
- * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- * This file provides functions similar to miPointerGetMotionEvents and
- * miPointerPutMotionEvents, with the exception that devices with more
- * than two axes are fully supported. These routines may be used only
- * for motion buffers for extension devices, and are \a not compatible
- * replacements for the mi routines. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "inputstr.h"
-#include "dmxinputinit.h"
-#include "dmxcommon.h"
-#include "dmxmotion.h"
-
-#define OFFSET(offset,element) ((offset) * (numAxes + 1) + (element))
-
-/** Return size of motion buffer. \see DMX_MOTION_SIZE */
-int dmxPointerGetMotionBufferSize(void)
-{
- return DMX_MOTION_SIZE;
-}
-
-/** This routine performs the same function as \a miPointerGetMotionEvents:
- * the events in the motion history that are between the start and stop
- * times (in mS) are placed in the coords vector, and the count of the
- * number of items so placed is returned. This routine is called from
- * dix/devices.c so that coords can hold valuator->numMotionEvents
- * events. This routine is called from \a Xi/gtmotion.c with coords large
- * enough to hold the same number of events in a variable-length
- * extended \a xTimecoord structure. This provides sufficient data for the
- * \a XGetDeviceMotionEvents library call, and would be identical to
- * \a miPointerGetMotionEvents for devices with only 2 axes (i.e., core
- * pointers) if \a xTimecoord used 32bit integers.
- *
- * Because DMX uses the mi* routines for all core devices, this routine
- * only has to support extension devices using the polymorphic coords.
- * Because compatibility with miPointerGetMotionEvents is not possible,
- * it is not provided. */
-int dmxPointerGetMotionEvents(DeviceIntPtr pDevice,
- xTimecoord *coords,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen)
-{
- GETDMXLOCALFROMPDEVICE;
- int numAxes = pDevice->valuator->numAxes;
- unsigned long *c = (unsigned long *)coords;
- int count = 0;
- int i, j;
-
- if (!dmxLocal->history) return 0;
- for (i = dmxLocal->head; i != dmxLocal->tail;) {
- if (dmxLocal->history[OFFSET(i,0)] >= stop) break;
- if (dmxLocal->history[OFFSET(i,0)] >= start) {
- for (j = 0; j < numAxes + 1; j++)
- c[OFFSET(count,j)] = dmxLocal->history[OFFSET(i,j)];
- ++count;
- }
- if (++i >= DMX_MOTION_SIZE) i = 0;
- }
- return count;
-}
-
-/** This routine adds an event to the motion history. A similar
- * function is performed by miPointerMove for the mi versions of these
- * routines. */
-void dmxPointerPutMotionEvent(DeviceIntPtr pDevice,
- int firstAxis, int axesCount, int *v,
- unsigned long time)
-{
- GETDMXLOCALFROMPDEVICE;
- int numAxes = pDevice->valuator->numAxes;
- int i;
-
- if (!dmxLocal->history) {
- dmxLocal->history = malloc(sizeof(*dmxLocal->history)
- * (numAxes + 1)
- * DMX_MOTION_SIZE);
- dmxLocal->head = 0;
- dmxLocal->tail = 0;
- dmxLocal->valuators = calloc(sizeof(*dmxLocal->valuators), numAxes);
- } else {
- if (++dmxLocal->tail >= DMX_MOTION_SIZE) dmxLocal->tail = 0;
- if (dmxLocal->head == dmxLocal->tail)
- if (++dmxLocal->head >= DMX_MOTION_SIZE) dmxLocal->head = 0;
- }
-
- dmxLocal->history[OFFSET(dmxLocal->tail,0)] = time;
-
- /* Initialize the data from the known
- * values (if Absolute) or to zero (if
- * Relative) */
- for (i = 0; i < numAxes; i++) {
- if (pDevice->valuator->axes[i].mode == Absolute)
- dmxLocal->history[OFFSET(dmxLocal->tail,i+1)]
- = dmxLocal->valuators[i];
- else
- dmxLocal->history[OFFSET(dmxLocal->tail,i+1)] = 0;
- }
-
- for (i = firstAxis; i < axesCount; i++) {
- dmxLocal->history[OFFSET(dmxLocal->tail,i+i)]
- = (unsigned long)v[i-firstAxis];
- dmxLocal->valuators[i] = v[i-firstAxis];
- }
-}
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides functions similar to miPointerGetMotionEvents and
+ * miPointerPutMotionEvents, with the exception that devices with more
+ * than two axes are fully supported. These routines may be used only
+ * for motion buffers for extension devices, and are \a not compatible
+ * replacements for the mi routines. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "inputstr.h"
+#include "dmxinputinit.h"
+#include "dmxcommon.h"
+#include "dmxmotion.h"
+
+#define OFFSET(offset,element) ((offset) * (numAxes + 1) + (element))
+
+/** Return size of motion buffer. \see DMX_MOTION_SIZE */
+int
+dmxPointerGetMotionBufferSize(void)
+{
+ return DMX_MOTION_SIZE;
+}
+
+/** This routine performs the same function as \a miPointerGetMotionEvents:
+ * the events in the motion history that are between the start and stop
+ * times (in mS) are placed in the coords vector, and the count of the
+ * number of items so placed is returned. This routine is called from
+ * dix/devices.c so that coords can hold valuator->numMotionEvents
+ * events. This routine is called from \a Xi/gtmotion.c with coords large
+ * enough to hold the same number of events in a variable-length
+ * extended \a xTimecoord structure. This provides sufficient data for the
+ * \a XGetDeviceMotionEvents library call, and would be identical to
+ * \a miPointerGetMotionEvents for devices with only 2 axes (i.e., core
+ * pointers) if \a xTimecoord used 32bit integers.
+ *
+ * Because DMX uses the mi* routines for all core devices, this routine
+ * only has to support extension devices using the polymorphic coords.
+ * Because compatibility with miPointerGetMotionEvents is not possible,
+ * it is not provided. */
+int
+dmxPointerGetMotionEvents(DeviceIntPtr pDevice,
+ xTimecoord * coords,
+ unsigned long start,
+ unsigned long stop, ScreenPtr pScreen)
+{
+ GETDMXLOCALFROMPDEVICE;
+ int numAxes = pDevice->valuator->numAxes;
+ unsigned long *c = (unsigned long *) coords;
+ int count = 0;
+ int i, j;
+
+ if (!dmxLocal->history)
+ return 0;
+ for (i = dmxLocal->head; i != dmxLocal->tail;) {
+ if (dmxLocal->history[OFFSET(i, 0)] >= stop)
+ break;
+ if (dmxLocal->history[OFFSET(i, 0)] >= start) {
+ for (j = 0; j < numAxes + 1; j++)
+ c[OFFSET(count, j)] = dmxLocal->history[OFFSET(i, j)];
+ ++count;
+ }
+ if (++i >= DMX_MOTION_SIZE)
+ i = 0;
+ }
+ return count;
+}
+
+/** This routine adds an event to the motion history. A similar
+ * function is performed by miPointerMove for the mi versions of these
+ * routines. */
+void
+dmxPointerPutMotionEvent(DeviceIntPtr pDevice,
+ int firstAxis, int axesCount, int *v,
+ unsigned long time)
+{
+ GETDMXLOCALFROMPDEVICE;
+ int numAxes = pDevice->valuator->numAxes;
+ int i;
+
+ if (!dmxLocal->history) {
+ dmxLocal->history = malloc(sizeof(*dmxLocal->history)
+ * (numAxes + 1)
+ * DMX_MOTION_SIZE);
+ dmxLocal->head = 0;
+ dmxLocal->tail = 0;
+ dmxLocal->valuators = calloc(sizeof(*dmxLocal->valuators), numAxes);
+ }
+ else {
+ if (++dmxLocal->tail >= DMX_MOTION_SIZE)
+ dmxLocal->tail = 0;
+ if (dmxLocal->head == dmxLocal->tail)
+ if (++dmxLocal->head >= DMX_MOTION_SIZE)
+ dmxLocal->head = 0;
+ }
+
+ dmxLocal->history[OFFSET(dmxLocal->tail, 0)] = time;
+
+ /* Initialize the data from the known
+ * values (if Absolute) or to zero (if
+ * Relative) */
+ for (i = 0; i < numAxes; i++) {
+ if (pDevice->valuator->axes[i].mode == Absolute)
+ dmxLocal->history[OFFSET(dmxLocal->tail, i + 1)]
+ = dmxLocal->valuators[i];
+ else
+ dmxLocal->history[OFFSET(dmxLocal->tail, i + 1)] = 0;
+ }
+
+ for (i = firstAxis; i < axesCount; i++) {
+ dmxLocal->history[OFFSET(dmxLocal->tail, i + i)]
+ = (unsigned long) v[i - firstAxis];
+ dmxLocal->valuators[i] = v[i - firstAxis];
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxmotion.h b/xorg-server/hw/dmx/input/dmxmotion.h
index 88aeb3d09..5ccdbe4ad 100644
--- a/xorg-server/hw/dmx/input/dmxmotion.h
+++ b/xorg-server/hw/dmx/input/dmxmotion.h
@@ -37,12 +37,11 @@
#ifndef _DMXMOTION_H_
#define _DMXMOTION_H_
-extern int dmxPointerGetMotionBufferSize(void);
-extern int dmxPointerGetMotionEvents(DeviceIntPtr pDevice,
- xTimecoord *coords,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen);
+extern int dmxPointerGetMotionBufferSize(void);
+extern int dmxPointerGetMotionEvents(DeviceIntPtr pDevice,
+ xTimecoord * coords,
+ unsigned long start,
+ unsigned long stop, ScreenPtr pScreen);
extern void dmxPointerPutMotionEvent(DeviceIntPtr pDevice,
int firstAxis, int axesCount, int *v,
unsigned long time);
diff --git a/xorg-server/hw/dmx/input/dmxsigio.c b/xorg-server/hw/dmx/input/dmxsigio.c
index 03c3070d7..9b1b493b8 100644
--- a/xorg-server/hw/dmx/input/dmxsigio.c
+++ b/xorg-server/hw/dmx/input/dmxsigio.c
@@ -47,36 +47,37 @@
#include <unistd.h>
#include <fcntl.h>
-static int dmxFdCount = 0;
+static int dmxFdCount = 0;
static Bool dmxInputEnabled = TRUE;
/* Define equivalents for non-POSIX systems (e.g., SGI IRIX, Solaris) */
#ifndef O_ASYNC
-# ifdef FASYNC
-# define O_ASYNC FASYNC
-# else
-# define O_ASYNC 0
-# endif
+#ifdef FASYNC
+#define O_ASYNC FASYNC
+#else
+#define O_ASYNC 0
+#endif
#endif
#ifndef O_NONBLOCK
#define O_NONBLOCK FNONBLK
#endif
-static void dmxSigioHandler(int sig)
+static void
+dmxSigioHandler(int sig)
{
- int i, j;
+ int i, j;
DMXInputInfo *dmxInput;
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
if (dmxInput->sigioState == DMX_ACTIVESIGIO) {
for (j = 0; j < dmxInput->numDevs; j++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
+
if (dmxLocal->collect_events) {
dmxLocal->collect_events(&dmxLocal->pDevice->public,
dmxMotion,
dmxEnqueue,
- dmxCheckSpecialKeys,
- DMX_NO_BLOCK);
+ dmxCheckSpecialKeys, DMX_NO_BLOCK);
}
}
}
@@ -84,7 +85,8 @@ static void dmxSigioHandler(int sig)
}
/** Block SIGIO handling. */
-void dmxSigioBlock(void)
+void
+dmxSigioBlock(void)
{
sigset_t s;
@@ -94,7 +96,8 @@ void dmxSigioBlock(void)
}
/** Unblock SIGIO handling. */
-void dmxSigioUnblock(void)
+void
+dmxSigioUnblock(void)
{
sigset_t s;
@@ -103,10 +106,11 @@ void dmxSigioUnblock(void)
sigprocmask(SIG_UNBLOCK, &s, 0);
}
-static void dmxSigioHook(void)
+static void
+dmxSigioHook(void)
{
struct sigaction a;
- sigset_t s;
+ sigset_t s;
memset(&a, 0, sizeof(a));
a.sa_handler = dmxSigioHandler;
@@ -115,81 +119,95 @@ static void dmxSigioHook(void)
sigaddset(&a.sa_mask, SIGALRM);
sigaddset(&a.sa_mask, SIGVTALRM);
sigaction(SIGIO, &a, 0);
-
+
sigemptyset(&s);
sigprocmask(SIG_SETMASK, &s, 0);
}
-static void dmxSigioUnhook(void)
+static void
+dmxSigioUnhook(void)
{
struct sigaction a;
- memset (&a, 0, sizeof(a));
+ memset(&a, 0, sizeof(a));
a.sa_handler = SIG_IGN;
sigemptyset(&a.sa_mask);
sigaction(SIGIO, &a, 0);
}
-static void dmxSigioAdd(DMXInputInfo *dmxInput)
+static void
+dmxSigioAdd(DMXInputInfo * dmxInput)
{
int flags;
int i;
switch (dmxInput->sigioState) {
- case DMX_NOSIGIO: return;
- case DMX_USESIGIO: dmxInput->sigioState = DMX_ACTIVESIGIO; break;
- case DMX_ACTIVESIGIO: return;
+ case DMX_NOSIGIO:
+ return;
+ case DMX_USESIGIO:
+ dmxInput->sigioState = DMX_ACTIVESIGIO;
+ break;
+ case DMX_ACTIVESIGIO:
+ return;
}
for (i = 0; i < dmxInput->sigioFdCount; i++) {
if (!dmxInput->sigioAdded[i]) {
int fd = dmxInput->sigioFd[i];
-
+
fcntl(fd, F_SETOWN, getpid());
flags = fcntl(fd, F_GETFL);
- flags |= O_ASYNC|O_NONBLOCK;
+ flags |= O_ASYNC | O_NONBLOCK;
fcntl(fd, F_SETFL, flags);
-
+
AddEnabledDevice(fd);
dmxInput->sigioAdded[i] = TRUE;
- if (++dmxFdCount == 1) dmxSigioHook();
+ if (++dmxFdCount == 1)
+ dmxSigioHook();
}
}
}
-static void dmxSigioRemove(DMXInputInfo *dmxInput)
+static void
+dmxSigioRemove(DMXInputInfo * dmxInput)
{
int flags;
int i;
-
+
switch (dmxInput->sigioState) {
- case DMX_NOSIGIO: return;
- case DMX_USESIGIO: return;
- case DMX_ACTIVESIGIO: dmxInput->sigioState = DMX_USESIGIO; break;
+ case DMX_NOSIGIO:
+ return;
+ case DMX_USESIGIO:
+ return;
+ case DMX_ACTIVESIGIO:
+ dmxInput->sigioState = DMX_USESIGIO;
+ break;
}
for (i = 0; i < dmxInput->sigioFdCount; i++) {
if (dmxInput->sigioAdded[i]) {
int fd = dmxInput->sigioFd[i];
-
+
dmxInput->sigioAdded[i] = FALSE;
RemoveEnabledDevice(fd);
-
+
flags = fcntl(fd, F_GETFL);
- flags &= ~(O_ASYNC|O_NONBLOCK);
+ flags &= ~(O_ASYNC | O_NONBLOCK);
fcntl(fd, F_SETFL, flags);
- if (!--dmxFdCount) dmxSigioUnhook();
+ if (!--dmxFdCount)
+ dmxSigioUnhook();
}
}
}
/** Enable SIGIO handling. This instantiates the handler with the OS. */
-void dmxSigioEnableInput(void)
+void
+dmxSigioEnableInput(void)
{
- int i;
- DMXInputInfo *dmxInput;
+ int i;
+ DMXInputInfo *dmxInput;
dmxInputEnabled = TRUE;
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
@@ -197,10 +215,11 @@ void dmxSigioEnableInput(void)
}
/** Disable SIGIO handling. This removes the hanlder from the OS. */
-void dmxSigioDisableInput(void)
+void
+dmxSigioDisableInput(void)
{
- int i;
- DMXInputInfo *dmxInput;
+ int i;
+ DMXInputInfo *dmxInput;
dmxInputEnabled = FALSE;
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
@@ -211,23 +230,27 @@ void dmxSigioDisableInput(void)
* using the file descriptor \a fd for SIGIO signals. Calls
* AddEnabledDevice ifi SIGIO handling has been enabled with
* #dmxSigioEnableInput(). */
-void dmxSigioRegister(DMXInputInfo *dmxInput, int fd)
+void
+dmxSigioRegister(DMXInputInfo * dmxInput, int fd)
{
dmxInput->sigioState = DMX_USESIGIO;
if (dmxInput->sigioFdCount >= DMX_MAX_SIGIO_FDS)
dmxLog(dmxFatal, "Too many SIGIO file descriptors (%d >= %d)\n",
dmxInput->sigioFdCount, DMX_MAX_SIGIO_FDS);
-
+
dmxInput->sigioFd[dmxInput->sigioFdCount++] = fd;
- if (dmxInputEnabled) dmxSigioAdd(dmxInput);
+ if (dmxInputEnabled)
+ dmxSigioAdd(dmxInput);
}
/** Remove the notes that \a dmxInput is using any file descriptors for
* SIGIO signals. Calls RemoveEnabledDevice. */
-void dmxSigioUnregister(DMXInputInfo *dmxInput)
+void
+dmxSigioUnregister(DMXInputInfo * dmxInput)
{
- if (dmxInput->sigioState == DMX_NOSIGIO) return;
+ if (dmxInput->sigioState == DMX_NOSIGIO)
+ return;
dmxSigioRemove(dmxInput);
- dmxInput->sigioState = DMX_NOSIGIO;
+ dmxInput->sigioState = DMX_NOSIGIO;
dmxInput->sigioFdCount = 0;
}
diff --git a/xorg-server/hw/dmx/input/dmxxinput.c b/xorg-server/hw/dmx/input/dmxxinput.c
index b28a80d4d..fccab5ff1 100644
--- a/xorg-server/hw/dmx/input/dmxxinput.c
+++ b/xorg-server/hw/dmx/input/dmxxinput.c
@@ -1,76 +1,75 @@
-/*
- * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This file implements support required by the XINPUT extension.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "inputstr.h"
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "XIstubs.h"
-
-#include "mipointer.h"
-#include "dmxinputinit.h"
-#include "exevents.h"
-
-/** Set device mode to \a mode. This is not implemented. */
-int SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
-{
- return BadMatch;
-}
-
-/** Set device valuators. This is not implemented. */
-int SetDeviceValuators (ClientPtr client,
- DeviceIntPtr dev,
- int *valuators,
- int first_valuator,
- int num_valuators)
-{
- return BadMatch;
-}
-
-/** Change device control. This is not implemented. */
-int ChangeDeviceControl(ClientPtr client,
- DeviceIntPtr dev,
- xDeviceCtl *control)
-{
- return BadMatch;
-}
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This file implements support required by the XINPUT extension.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "inputstr.h"
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+
+#include "mipointer.h"
+#include "dmxinputinit.h"
+#include "exevents.h"
+
+/** Set device mode to \a mode. This is not implemented. */
+int
+SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
+{
+ return BadMatch;
+}
+
+/** Set device valuators. This is not implemented. */
+int
+SetDeviceValuators(ClientPtr client,
+ DeviceIntPtr dev,
+ int *valuators, int first_valuator, int num_valuators)
+{
+ return BadMatch;
+}
+
+/** Change device control. This is not implemented. */
+int
+ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control)
+{
+ return BadMatch;
+}
diff --git a/xorg-server/hw/dmx/input/lnx-keyboard.c b/xorg-server/hw/dmx/input/lnx-keyboard.c
index 06e9ec722..ecf4f591c 100644
--- a/xorg-server/hw/dmx/input/lnx-keyboard.c
+++ b/xorg-server/hw/dmx/input/lnx-keyboard.c
@@ -172,26 +172,25 @@
#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
#define NUM_STATE_ENTRIES (256/32)
-
/* Private area for Linux-style keyboards. */
typedef struct _myPrivate {
- int fd;
- int vtno;
- int vtcurrent;
- int kbdtrans;
+ int fd;
+ int vtno;
+ int vtcurrent;
+ int kbdtrans;
struct termios kbdtty;
- int kbdType;
- CARD32 kbdState[NUM_STATE_ENTRIES];
- DeviceIntPtr pKeyboard;
- unsigned char prefix;
-
- int switched;
- SWITCHRETPROC switch_return;
- void *switch_return_data;
-
- /* For bell */
- int pitch;
- unsigned long duration;
+ int kbdType;
+ CARD32 kbdState[NUM_STATE_ENTRIES];
+ DeviceIntPtr pKeyboard;
+ unsigned char prefix;
+
+ int switched;
+ SWITCHRETPROC switch_return;
+ void *switch_return_data;
+
+ /* For bell */
+ int pitch;
+ unsigned long duration;
} myPrivate;
static myPrivate *PRIV = NULL;
@@ -199,174 +198,182 @@ static myPrivate *PRIV = NULL;
#undef SYSCALL
#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
-static int kbdLinuxKeyDown(myPrivate *priv, int keyCode)
+static int
+kbdLinuxKeyDown(myPrivate * priv, int keyCode)
{
- CARD8 byte = keyCode >> 5;
- CARD32 bit = 1 << (keyCode & 0x1f);
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
- if (byte > NUM_STATE_ENTRIES) return 0;
+ if (byte > NUM_STATE_ENTRIES)
+ return 0;
return priv->kbdState[byte] & bit;
}
-static void kbdLinuxKeyState(myPrivate *priv, int type, int keyCode)
+static void
+kbdLinuxKeyState(myPrivate * priv, int type, int keyCode)
{
- CARD8 byte = keyCode >> 5;
- CARD32 bit = 1 << (keyCode & 0x1f);
-
- if (byte > NUM_STATE_ENTRIES) return;
- if (type == KeyPress) priv->kbdState[byte] |= bit;
- else priv->kbdState[byte] &= ~bit;
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
+
+ if (byte > NUM_STATE_ENTRIES)
+ return;
+ if (type == KeyPress)
+ priv->kbdState[byte] |= bit;
+ else
+ priv->kbdState[byte] &= ~bit;
}
static KeySym linux_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright, XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_nobreakspace, XK_exclamdown, XK_cent, XK_sterling,
+ XK_currency, XK_yen, XK_brokenbar, XK_section,
+ XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
+ XK_notsign, XK_hyphen, XK_registered, XK_macron,
+ XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
+ XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
+ XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
+ XK_onequarter, XK_onehalf, XK_threequarters, XK_questiondown,
+ XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
+ XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
+ XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
+ XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
+ XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
+ XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
+ XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
+ XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
+ XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
+ XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
+ XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
+ XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
+ XK_eth, XK_ntilde, XK_ograve, XK_oacute,
+ XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
+ XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
+ XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
};
/*
* Maps the AT keycodes to Linux keycodes
*/
-static unsigned char at2lnx[NUM_KEYCODES] =
-{
- 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
- 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
- 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
- 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
- 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
- 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
- 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
- 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
- 0x11, /* KEY_W */ 0x12, /* KEY_E */
- 0x13, /* KEY_R */ 0x14, /* KEY_T */
- 0x15, /* KEY_Y */ 0x16, /* KEY_U */
- 0x17, /* KEY_I */ 0x18, /* KEY_O */
- 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
- 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
- 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
- 0x1f, /* KEY_S */ 0x20, /* KEY_D */
- 0x21, /* KEY_F */ 0x22, /* KEY_G */
- 0x23, /* KEY_H */ 0x24, /* KEY_J */
- 0x25, /* KEY_K */ 0x26, /* KEY_L */
- 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
- 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
- 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
- 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
- 0x2f, /* KEY_V */ 0x30, /* KEY_B */
- 0x31, /* KEY_N */ 0x32, /* KEY_M */
- 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
- 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
- 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
- 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
- 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
- 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
- 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
- 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
- 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
- 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
- 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
- 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
- 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
- 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
- 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
- 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
- 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
- 0x00, /* 0x55 */ 0x56, /* KEY_Less */
- 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
- 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
- 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
- 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
- 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
- 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
- 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
- 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
- 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
- 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
- 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
- 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
- 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
- 0x00, /* 0x71 */ 0x00, /* 0x72 */
- 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
- 0x00, /* 0x75 */ 0x00, /* 0x76 */
- 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
- 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
- 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
- 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
- 0x00, /* 0x7f */
+static unsigned char at2lnx[NUM_KEYCODES] = {
+ 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
+ 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
+ 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
+ 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
+ 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
+ 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
+ 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
+ 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
+ 0x11, /* KEY_W */ 0x12, /* KEY_E */
+ 0x13, /* KEY_R */ 0x14, /* KEY_T */
+ 0x15, /* KEY_Y */ 0x16, /* KEY_U */
+ 0x17, /* KEY_I */ 0x18, /* KEY_O */
+ 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
+ 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
+ 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
+ 0x1f, /* KEY_S */ 0x20, /* KEY_D */
+ 0x21, /* KEY_F */ 0x22, /* KEY_G */
+ 0x23, /* KEY_H */ 0x24, /* KEY_J */
+ 0x25, /* KEY_K */ 0x26, /* KEY_L */
+ 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
+ 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
+ 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
+ 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
+ 0x2f, /* KEY_V */ 0x30, /* KEY_B */
+ 0x31, /* KEY_N */ 0x32, /* KEY_M */
+ 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
+ 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
+ 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
+ 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
+ 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
+ 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
+ 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
+ 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
+ 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
+ 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
+ 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
+ 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
+ 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
+ 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
+ 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
+ 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
+ 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
+ 0x00, /* 0x55 */ 0x56, /* KEY_Less */
+ 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
+ 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
+ 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
+ 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
+ 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
+ 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
+ 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
+ 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
+ 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
+ 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
+ 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
+ 0x7A, /* KEY_Menu/FOCUS_PF11 */ 0x00, /* 0x6e */
+ 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
+ 0x00, /* 0x71 */ 0x00, /* 0x72 */
+ 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
+ 0x00, /* 0x75 */ 0x00, /* 0x76 */
+ 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
+ 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
+ 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
+ 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
+ 0x00, /* 0x7f */
};
/** Create a private structure for use within this file. */
-pointer kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard)
+pointer
+kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard)
{
myPrivate *priv = calloc(1, sizeof(*priv));
- priv->fd = -1;
+
+ priv->fd = -1;
priv->pKeyboard = pKeyboard;
return priv;
}
/** Destroy a private structure. */
-void kbdLinuxDestroyPrivate(pointer priv)
+void
+kbdLinuxDestroyPrivate(pointer priv)
{
free(priv);
}
@@ -387,36 +394,37 @@ void kbdLinuxDestroyPrivate(pointer priv)
* if we ignore the volume and set the duration correctly, then we'll
* get one parameter "wrong" -- but if we use the volume to scale the
* duration, then we'll get both parameters "wrong"). */
-void kbdLinuxBell(DevicePtr pDev, int percent,
- int volume, int pitch, int duration)
+void
+kbdLinuxBell(DevicePtr pDev, int percent, int volume, int pitch, int duration)
{
GETPRIV;
if (duration && pitch) {
- ioctl(priv->fd,
- KDMKTONE,
- ((1193190 / pitch) & 0xffff) /* Low bits specify cycle time */
- | (duration << 16)); /* High bits are duration in msec */
+ ioctl(priv->fd, KDMKTONE, ((1193190 / pitch) & 0xffff) /* Low bits specify cycle time */
+ |(duration << 16)); /* High bits are duration in msec */
}
}
/** Set the LEDs. */
-void kbdLinuxCtrl(DevicePtr pDev, KeybdCtrl *ctrl)
+void
+kbdLinuxCtrl(DevicePtr pDev, KeybdCtrl * ctrl)
{
GETPRIV;
ioctl(priv->fd, KDSETLED, ctrl->leds & 0x07);
}
-static int kbdLinuxGetFreeVTNumber(void)
+static int
+kbdLinuxGetFreeVTNumber(void)
{
- int fd = -1;
- int vtno;
- int i;
+ int fd = -1;
+ int vtno;
+ int i;
const char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
-
+
for (i = 0; tty0[i]; i++)
- if ((fd = open(tty0[i], O_WRONLY, 0)) >= 0) break;
+ if ((fd = open(tty0[i], O_WRONLY, 0)) >= 0)
+ break;
if (fd < 0)
FATAL1("kbdLinuxGetFreeVTNumber: Cannot open tty0 (%s)\n",
strerror(errno));
@@ -425,16 +433,18 @@ static int kbdLinuxGetFreeVTNumber(void)
return vtno;
}
-static int kbdLinuxOpenVT(int vtno)
+static int
+kbdLinuxOpenVT(int vtno)
{
- int fd = -1;
- int i;
+ int fd = -1;
+ int i;
const char *vcs[] = { "/dev/vc/", "/dev/tty", NULL };
- char name[64]; /* RATS: Only used in snprintf */
+ char name[64]; /* RATS: Only used in snprintf */
for (i = 0; vcs[i]; i++) {
snprintf(name, sizeof(name), "%s%d", vcs[i], vtno);
- if ((fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0) break;
+ if ((fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0)
+ break;
}
if (fd < 0)
FATAL2("kbdLinuxOpenVT: Cannot open VT %d (%s)\n",
@@ -442,23 +452,27 @@ static int kbdLinuxOpenVT(int vtno)
return fd;
}
-static int kbdLinuxGetCurrentVTNumber(int fd)
+static int
+kbdLinuxGetCurrentVTNumber(int fd)
{
struct vt_stat vts;
-
- if (!ioctl(fd, VT_GETSTATE, &vts)) return vts.v_active;
+
+ if (!ioctl(fd, VT_GETSTATE, &vts))
+ return vts.v_active;
return -1;
}
static int kbdLinuxActivate(int fd, int vtno, int setSig);
/** Currently unused hook called prior to an VT switch. */
-void kbdLinuxVTPreSwitch(pointer p)
+void
+kbdLinuxVTPreSwitch(pointer p)
{
}
/** Currently unused hook called after returning from a VT switch. */
-void kbdLinuxVTPostSwitch(pointer p)
+void
+kbdLinuxVTPostSwitch(pointer p)
{
}
@@ -466,28 +480,31 @@ void kbdLinuxVTPostSwitch(pointer p)
* function is called with the \a switch_return_data when the VT is
* switched back to the pre-switch VT (i.e., the user returns to the DMX
* session). */
-int kbdLinuxVTSwitch(pointer p, int vt,
- void (*switch_return)(pointer),
- pointer switch_return_data)
+int
+kbdLinuxVTSwitch(pointer p, int vt,
+ void (*switch_return) (pointer), pointer switch_return_data)
{
myPrivate *priv = p;
- if (priv->switched) FATAL0("kbdLinuxVTSwitch: already switched...\n");
- if (priv->vtno == vt) return 0;
+ if (priv->switched)
+ FATAL0("kbdLinuxVTSwitch: already switched...\n");
+ if (priv->vtno == vt)
+ return 0;
- PRIV = priv;
- priv->switched = 0; /* Will switch to 1 in handler */
- priv->switch_return = switch_return;
+ PRIV = priv;
+ priv->switched = 0; /* Will switch to 1 in handler */
+ priv->switch_return = switch_return;
priv->switch_return_data = switch_return_data;
kbdLinuxActivate(priv->fd, vt, 0);
return 1;
}
/* RATS: This function is only ever used to handle SIGUSR1. */
-static void kbdLinuxVTSignalHandler(int sig)
+static void
+kbdLinuxVTSignalHandler(int sig)
{
myPrivate *priv = PRIV;
-
+
signal(sig, kbdLinuxVTSignalHandler);
if (priv) {
ioctl(priv->fd, VT_RELDISP, VT_ACKACQ);
@@ -499,19 +516,23 @@ static void kbdLinuxVTSignalHandler(int sig)
}
}
-static int kbdLinuxActivate(int fd, int vtno, int setSig)
+static int
+kbdLinuxActivate(int fd, int vtno, int setSig)
{
- int result;
+ int result;
struct vt_mode VT;
SYSCALL(result = ioctl(fd, VT_ACTIVATE, vtno));
- if (result) FATAL0("kbdLinuxActivate: VT_ACTIVATE failed\n");
+ if (result)
+ FATAL0("kbdLinuxActivate: VT_ACTIVATE failed\n");
SYSCALL(result = ioctl(fd, VT_WAITACTIVE, vtno));
- if (result) FATAL0("kbdLinuxActivate: VT_WAITACTIVE failed\n");
+ if (result)
+ FATAL0("kbdLinuxActivate: VT_WAITACTIVE failed\n");
if (setSig) {
SYSCALL(result = ioctl(fd, VT_GETMODE, &VT));
- if (result < 0) FATAL0("kbdLinuxActivate: VT_GETMODE failed\n");
- VT.mode = VT_PROCESS;
+ if (result < 0)
+ FATAL0("kbdLinuxActivate: VT_GETMODE failed\n");
+ VT.mode = VT_PROCESS;
VT.relsig = SIGUSR1;
VT.acqsig = SIGUSR1;
if (ioctl(fd, VT_SETMODE, &VT))
@@ -521,86 +542,148 @@ static int kbdLinuxActivate(int fd, int vtno, int setSig)
return Success;
}
-static void kbdLinuxOpenConsole(DevicePtr pDev)
+static void
+kbdLinuxOpenConsole(DevicePtr pDev)
{
GETPRIV;
const char *msg = MESSAGE;
- if (priv->fd >= 0) return;
- priv->vtno = kbdLinuxGetFreeVTNumber();
- priv->fd = kbdLinuxOpenVT(priv->vtno);
+ if (priv->fd >= 0)
+ return;
+ priv->vtno = kbdLinuxGetFreeVTNumber();
+ priv->fd = kbdLinuxOpenVT(priv->vtno);
priv->vtcurrent = kbdLinuxGetCurrentVTNumber(priv->fd);
LOG2("kbdLinuxOpenConsole: current VT %d; using free VT %d\n",
priv->vtcurrent, priv->vtno);
kbdLinuxActivate(priv->fd, priv->vtno, 1);
- ioctl(priv->fd, KDSETMODE, KD_GRAPHICS); /* To turn off gpm */
- if (msg) write(priv->fd, msg, strlen(msg));
+ ioctl(priv->fd, KDSETMODE, KD_GRAPHICS); /* To turn off gpm */
+ if (msg)
+ write(priv->fd, msg, strlen(msg));
}
-static void kbdLinuxCloseConsole(DevicePtr pDev)
+static void
+kbdLinuxCloseConsole(DevicePtr pDev)
{
GETPRIV;
struct vt_mode VT;
- const char *msg = FINALMESSAGE;
+ const char *msg = FINALMESSAGE;
- if (priv->fd < 0) return;
+ if (priv->fd < 0)
+ return;
ioctl(priv->fd, KDSETMODE, KD_TEXT);
- if (msg) write(priv->fd, msg, strlen(msg));
+ if (msg)
+ write(priv->fd, msg, strlen(msg));
if (ioctl(priv->fd, VT_GETMODE, &VT) != -1) {
VT.mode = VT_AUTO;
ioctl(priv->fd, VT_SETMODE, &VT);
}
LOG1("kbdLinuxCloseConsole: switching to VT %d\n", priv->vtcurrent);
- if (priv->vtcurrent >= 0) kbdLinuxActivate(priv->fd, priv->vtcurrent, 0);
-
+ if (priv->vtcurrent >= 0)
+ kbdLinuxActivate(priv->fd, priv->vtcurrent, 0);
+
close(priv->fd);
priv->fd = -1;
}
/** Initialize the \a pDev as a Linux keyboard. */
-void kbdLinuxInit(DevicePtr pDev)
+void
+kbdLinuxInit(DevicePtr pDev)
{
GETPRIV;
- if (priv->fd <= 0) kbdLinuxOpenConsole(pDev);
-
+ if (priv->fd <= 0)
+ kbdLinuxOpenConsole(pDev);
+
ioctl(priv->fd, KDGKBMODE, &priv->kbdtrans);
if (tcgetattr(priv->fd, &priv->kbdtty) < 0)
FATAL1("kbdLinuxInit: tcgetattr failed (%s)\n", strerror(errno));
}
-static int kbdLinuxPrefix0Mapping(unsigned char *scanCode)
+static int
+kbdLinuxPrefix0Mapping(unsigned char *scanCode)
{
- /* Table from xfree86/common/xf86Events.c */
+ /* Table from xfree86/common/xf86Events.c */
switch (*scanCode) {
- case KEY_KP_7: *scanCode = KEY_Home; break; /* curs home */
- case KEY_KP_8: *scanCode = KEY_Up; break; /* curs up */
- case KEY_KP_9: *scanCode = KEY_PgUp; break; /* curs pgup */
- case KEY_KP_4: *scanCode = KEY_Left; break; /* curs left */
- case KEY_KP_5: *scanCode = KEY_Begin; break; /* curs begin */
- case KEY_KP_6: *scanCode = KEY_Right; break; /* curs right */
- case KEY_KP_1: *scanCode = KEY_End; break; /* curs end */
- case KEY_KP_2: *scanCode = KEY_Down; break; /* curs down */
- case KEY_KP_3: *scanCode = KEY_PgDown; break; /* curs pgdown */
- case KEY_KP_0: *scanCode = KEY_Insert; break; /* curs insert */
- case KEY_KP_Decimal: *scanCode = KEY_Delete; break; /* curs delete */
- case KEY_Enter: *scanCode = KEY_KP_Enter; break; /* keypad enter */
- case KEY_LCtrl: *scanCode = KEY_RCtrl; break; /* right ctrl */
- case KEY_KP_Multiply: *scanCode = KEY_Print; break; /* print */
- case KEY_Slash: *scanCode = KEY_KP_Divide; break; /* keyp divide */
- case KEY_Alt: *scanCode = KEY_AltLang; break; /* right alt */
- case KEY_ScrollLock: *scanCode = KEY_Break; break; /* curs break */
- case 0x5b: *scanCode = KEY_LMeta; break;
- case 0x5c: *scanCode = KEY_RMeta; break;
- case 0x5d: *scanCode = KEY_Menu; break;
- case KEY_F3: *scanCode = KEY_F13; break;
- case KEY_F4: *scanCode = KEY_F14; break;
- case KEY_F5: *scanCode = KEY_F15; break;
- case KEY_F6: *scanCode = KEY_F16; break;
- case KEY_F7: *scanCode = KEY_F17; break;
- case KEY_KP_Plus: *scanCode = KEY_KP_DEC; break;
+ case KEY_KP_7:
+ *scanCode = KEY_Home;
+ break; /* curs home */
+ case KEY_KP_8:
+ *scanCode = KEY_Up;
+ break; /* curs up */
+ case KEY_KP_9:
+ *scanCode = KEY_PgUp;
+ break; /* curs pgup */
+ case KEY_KP_4:
+ *scanCode = KEY_Left;
+ break; /* curs left */
+ case KEY_KP_5:
+ *scanCode = KEY_Begin;
+ break; /* curs begin */
+ case KEY_KP_6:
+ *scanCode = KEY_Right;
+ break; /* curs right */
+ case KEY_KP_1:
+ *scanCode = KEY_End;
+ break; /* curs end */
+ case KEY_KP_2:
+ *scanCode = KEY_Down;
+ break; /* curs down */
+ case KEY_KP_3:
+ *scanCode = KEY_PgDown;
+ break; /* curs pgdown */
+ case KEY_KP_0:
+ *scanCode = KEY_Insert;
+ break; /* curs insert */
+ case KEY_KP_Decimal:
+ *scanCode = KEY_Delete;
+ break; /* curs delete */
+ case KEY_Enter:
+ *scanCode = KEY_KP_Enter;
+ break; /* keypad enter */
+ case KEY_LCtrl:
+ *scanCode = KEY_RCtrl;
+ break; /* right ctrl */
+ case KEY_KP_Multiply:
+ *scanCode = KEY_Print;
+ break; /* print */
+ case KEY_Slash:
+ *scanCode = KEY_KP_Divide;
+ break; /* keyp divide */
+ case KEY_Alt:
+ *scanCode = KEY_AltLang;
+ break; /* right alt */
+ case KEY_ScrollLock:
+ *scanCode = KEY_Break;
+ break; /* curs break */
+ case 0x5b:
+ *scanCode = KEY_LMeta;
+ break;
+ case 0x5c:
+ *scanCode = KEY_RMeta;
+ break;
+ case 0x5d:
+ *scanCode = KEY_Menu;
+ break;
+ case KEY_F3:
+ *scanCode = KEY_F13;
+ break;
+ case KEY_F4:
+ *scanCode = KEY_F14;
+ break;
+ case KEY_F5:
+ *scanCode = KEY_F15;
+ break;
+ case KEY_F6:
+ *scanCode = KEY_F16;
+ break;
+ case KEY_F7:
+ *scanCode = KEY_F17;
+ break;
+ case KEY_KP_Plus:
+ *scanCode = KEY_KP_DEC;
+ break;
/*
* Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6)
*/
@@ -618,12 +701,13 @@ static int kbdLinuxPrefix0Mapping(unsigned char *scanCode)
return 0;
}
-static int kbdLinuxPrefixMapping(myPrivate *priv, unsigned char *scanCode)
+static int
+kbdLinuxPrefixMapping(myPrivate * priv, unsigned char *scanCode)
{
- int pressed = *scanCode & 0x80;
- unsigned char code = *scanCode & 0x7f;
+ int pressed = *scanCode & 0x80;
+ unsigned char code = *scanCode & 0x7f;
- /* If we don't have a prefix, check for one */
+ /* If we don't have a prefix, check for one */
if (!priv->prefix) {
switch (code) {
case KEY_Prefix0:
@@ -634,43 +718,45 @@ static int kbdLinuxPrefixMapping(myPrivate *priv, unsigned char *scanCode)
return 0; /* No change */
}
- /* We have a prefix from the last scanCode */
+ /* We have a prefix from the last scanCode */
switch (priv->prefix) {
case KEY_Prefix0:
priv->prefix = 0;
- if (kbdLinuxPrefix0Mapping(&code)) return 1; /* Skip sequence */
+ if (kbdLinuxPrefix0Mapping(&code))
+ return 1; /* Skip sequence */
break;
case KEY_Prefix1:
priv->prefix = (code = KEY_LCtrl) ? KEY_LCtrl : 0;
- return 1; /* Use new prefix */
+ return 1; /* Use new prefix */
case KEY_LCtrl:
priv->prefix = 0;
- if (code != KEY_NumLock) return 1; /* Skip sequence*/
+ if (code != KEY_NumLock)
+ return 1; /* Skip sequence */
code = KEY_Pause;
break;
}
*scanCode = code | (pressed ? 0x80 : 0x00);
- return 0; /* Use old scanCode */
+ return 0; /* Use old scanCode */
}
-static void kbdLinuxConvert(DevicePtr pDev,
- unsigned char scanCode,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
+static void
+kbdLinuxConvert(DevicePtr pDev,
+ unsigned char scanCode,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
{
GETPRIV;
- XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo;
- int type;
- KeySym keySym = NoSymbol;
- int keyCode;
- int switching;
+ XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo;
+ int type;
+ KeySym keySym = NoSymbol;
+ int keyCode;
+ int switching;
/* Do special PC/AT prefix mapping -- may change scanCode! */
- if (kbdLinuxPrefixMapping(priv, &scanCode)) return;
+ if (kbdLinuxPrefixMapping(priv, &scanCode))
+ return;
- type = (scanCode & 0x80) ? KeyRelease : KeyPress;
+ type = (scanCode & 0x80) ? KeyRelease : KeyPress;
keyCode = (scanCode & 0x7f) + MIN_KEYCODE;
/* Handle repeats */
@@ -681,6 +767,7 @@ static void kbdLinuxConvert(DevicePtr pDev,
int effectiveGroup = XkbGetEffectiveGroup(xkbi,
&xkbi->state,
scanCode);
+
keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup);
#if 0
switch (keySym) {
@@ -689,9 +776,12 @@ static void kbdLinuxConvert(DevicePtr pDev,
case XK_Shift_Lock:
case XK_Caps_Lock:
/* Ignore releases and all but first press */
- if (kbdLinuxModIgnore(priv, &xE, keySym)) return;
- if (kbdLinuxKeyDown(priv, &xE)) xE.u.u.type = KeyRelease;
- else xE.u.u.type = KeyPress;
+ if (kbdLinuxModIgnore(priv, &xE, keySym))
+ return;
+ if (kbdLinuxKeyDown(priv, &xE))
+ xE.u.u.type = KeyRelease;
+ else
+ xE.u.u.type = KeyPress;
break;
}
#endif
@@ -703,17 +793,18 @@ static void kbdLinuxConvert(DevicePtr pDev,
/* No auto-repeat? */
if ((feed && !feed->ctrl.autoRepeat)
|| priv->pKeyboard->key->xkbInfo->desc->map->modmap[keyCode]
- || (feed
- && !(feed->ctrl.autoRepeats[keyCode >> 3]
- & (1 << (keyCode & 7))))) return; /* Ignore */
-
+ || (feed && !(feed->ctrl.autoRepeats[keyCode >> 3]
+ & (1 << (keyCode & 7)))))
+ return; /* Ignore */
+
/* Do auto-repeat */
enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block);
type = KeyPress;
}
-
+
/* If key is already up, ignore */
- if (type == KeyRelease && !kbdLinuxKeyDown(priv, keyCode)) return;
+ if (type == KeyRelease && !kbdLinuxKeyDown(priv, keyCode))
+ return;
}
switching = 0;
@@ -722,7 +813,7 @@ static void kbdLinuxConvert(DevicePtr pDev,
if (!switching) {
if (enqueue)
enqueue(pDev, type, keyCode, keySym, NULL, block);
- kbdLinuxKeyState(priv, type, keyCode); /* Update our state bitmap */
+ kbdLinuxKeyState(priv, type, keyCode); /* Update our state bitmap */
}
}
@@ -732,16 +823,15 @@ static void kbdLinuxConvert(DevicePtr pDev,
* with the \a enqueue function. The \a block type is passed to the
* functions so that they may block SIGIO handling as appropriate to the
* caller of this function. */
-void kbdLinuxRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
+void
+kbdLinuxRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
{
GETPRIV;
unsigned char buf[256]; /* RATS: Only used in length-limited call */
unsigned char *pt;
- int n;
+ int n;
while ((n = read(priv->fd, buf, sizeof(buf))) > 0)
for (pt = buf; n; --n, ++pt)
@@ -749,20 +839,21 @@ void kbdLinuxRead(DevicePtr pDev,
}
/** Turn \a pDev on (i.e., take input from \a pDev). */
-int kbdLinuxOn(DevicePtr pDev)
+int
+kbdLinuxOn(DevicePtr pDev)
{
GETPRIV;
struct termios nTty;
ioctl(priv->fd, KDSKBMODE, K_RAW);
- nTty = priv->kbdtty;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
+ nTty = priv->kbdtty;
+ nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ nTty.c_oflag = 0;
+ nTty.c_cflag = CREAD | CS8;
+ nTty.c_lflag = 0;
nTty.c_cc[VTIME] = 0;
- nTty.c_cc[VMIN] = 1;
+ nTty.c_cc[VMIN] = 1;
cfsetispeed(&nTty, B9600);
cfsetospeed(&nTty, B9600);
if (tcsetattr(priv->fd, TCSANOW, &nTty) < 0)
@@ -771,7 +862,8 @@ int kbdLinuxOn(DevicePtr pDev)
}
/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
-void kbdLinuxOff(DevicePtr pDev)
+void
+kbdLinuxOff(DevicePtr pDev)
{
GETPRIV;
@@ -780,165 +872,261 @@ void kbdLinuxOff(DevicePtr pDev)
kbdLinuxCloseConsole(pDev);
}
-
-static void kbdLinuxReadKernelMapping(int fd, KeySymsPtr pKeySyms)
+static void
+kbdLinuxReadKernelMapping(int fd, KeySymsPtr pKeySyms)
{
- KeySym *k;
- int i;
- int maxkey;
- static unsigned char tbl[GLYPHS_PER_KEY] = { /* RATS: Use ok */
- 0, /* unshifted */
- 1, /* shifted */
- 0, /* modeswitch unshifted */
- 0 /* modeswitch shifted */
+ KeySym *k;
+ int i;
+ int maxkey;
+
+ static unsigned char tbl[GLYPHS_PER_KEY] = { /* RATS: Use ok */
+ 0, /* unshifted */
+ 1, /* shifted */
+ 0, /* modeswitch unshifted */
+ 0 /* modeswitch shifted */
};
- /*
- * Read the mapping from the kernel.
- * Since we're still using the XFree86 scancode->AT keycode mapping
- * routines, we need to convert the AT keycodes to Linux keycodes,
- * then translate the Linux keysyms into X keysyms.
- *
- * First, figure out which tables to use for the modeswitch columns
- * above, from the XF86Config fields.
- */
- tbl[2] = 8; /* alt */
- tbl[3] = tbl[2] | 1;
-
-#if 00/*BP*/
- k = map+GLYPHS_PER_KEY;
+ /*
+ * Read the mapping from the kernel.
+ * Since we're still using the XFree86 scancode->AT keycode mapping
+ * routines, we need to convert the AT keycodes to Linux keycodes,
+ * then translate the Linux keysyms into X keysyms.
+ *
+ * First, figure out which tables to use for the modeswitch columns
+ * above, from the XF86Config fields.
+ */
+ tbl[2] = 8; /* alt */
+ tbl[3] = tbl[2] | 1;
+
+#if 00 /*BP*/
+ k = map + GLYPHS_PER_KEY;
#else
- ErrorF("kbdLinuxReadKernelMapping() is broken/no-op'd\n");
- return;
+ ErrorF("kbdLinuxReadKernelMapping() is broken/no-op'd\n");
+ return;
#endif
- maxkey = NUM_AT2LNX;
-
- for (i = 0; i < maxkey; ++i) {
- struct kbentry kbe;
- int j;
-
- kbe.kb_index = at2lnx[i];
-
- for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) {
- unsigned short kval;
-
- *k = NoSymbol;
-
- kbe.kb_table = tbl[j];
- if (kbe.kb_index == 0 || ioctl(fd, KDGKBENT, &kbe)) continue;
-
- kval = KVAL(kbe.kb_value);
- switch (KTYP(kbe.kb_value)) {
- case KT_LATIN:
- case KT_LETTER: *k = linux_to_x[kval]; break;
- case KT_FN:
- if (kval <= 19) *k = XK_F1 + kval;
- else switch (kbe.kb_value) {
- case K_FIND: *k = XK_Home; /* or XK_Find */ break;
- case K_INSERT: *k = XK_Insert; break;
- case K_REMOVE: *k = XK_Delete; break;
- case K_SELECT: *k = XK_End; /* or XK_Select */ break;
- case K_PGUP: *k = XK_Prior; break;
- case K_PGDN: *k = XK_Next; break;
- case K_HELP: *k = XK_Help; break;
- case K_DO: *k = XK_Execute; break;
- case K_PAUSE: *k = XK_Pause; break;
- case K_MACRO: *k = XK_Menu; break;
- default: break;
- }
- break;
- case KT_SPEC:
- switch (kbe.kb_value) {
- case K_ENTER: *k = XK_Return; break;
- case K_BREAK: *k = XK_Break; break;
- case K_CAPS: *k = XK_Caps_Lock; break;
- case K_NUM: *k = XK_Num_Lock; break;
- case K_HOLD: *k = XK_Scroll_Lock; break;
- case K_COMPOSE: *k = XK_Multi_key; break;
- default: break;
- }
- break;
- case KT_PAD:
- switch (kbe.kb_value) {
- case K_PPLUS: *k = XK_KP_Add; break;
- case K_PMINUS: *k = XK_KP_Subtract; break;
- case K_PSTAR: *k = XK_KP_Multiply; break;
- case K_PSLASH: *k = XK_KP_Divide; break;
- case K_PENTER: *k = XK_KP_Enter; break;
- case K_PCOMMA: *k = XK_KP_Separator; break;
- case K_PDOT: *k = XK_KP_Decimal; break;
- case K_PPLUSMINUS: *k = XK_KP_Subtract; break;
- default: if (kval <= 9) *k = XK_KP_0 + kval; break;
- }
- break;
- case KT_DEAD:
- /* KT_DEAD keys are for accelerated diacritical creation. */
- switch (kbe.kb_value) {
- case K_DGRAVE: *k = XK_dead_grave; break;
- case K_DACUTE: *k = XK_dead_acute; break;
- case K_DCIRCM: *k = XK_dead_circumflex; break;
- case K_DTILDE: *k = XK_dead_tilde; break;
- case K_DDIERE: *k = XK_dead_diaeresis; break;
- }
- break;
- case KT_CUR:
- switch (kbe.kb_value) {
- case K_DOWN: *k = XK_Down; break;
- case K_LEFT: *k = XK_Left; break;
- case K_RIGHT: *k = XK_Right; break;
- case K_UP: *k = XK_Up; break;
- }
- break;
- case KT_SHIFT:
- switch (kbe.kb_value) {
- case K_ALTGR: *k = XK_Alt_R; break;
- case K_ALT:
- *k = (kbe.kb_index == 0x64 ? XK_Alt_R : XK_Alt_L);
- break;
- case K_CTRL:
- *k = (kbe.kb_index == 0x61 ? XK_Control_R : XK_Control_L);
- break;
- case K_CTRLL: *k = XK_Control_L; break;
- case K_CTRLR: *k = XK_Control_R; break;
- case K_SHIFT:
- *k = (kbe.kb_index == 0x36 ? XK_Shift_R : XK_Shift_L);
- break;
- case K_SHIFTL: *k = XK_Shift_L; break;
- case K_SHIFTR: *k = XK_Shift_R; break;
- default: break;
- }
- break;
- case KT_ASCII:
- /* KT_ASCII keys accumulate a 3 digit decimal number that
- * gets emitted when the shift state changes. We can't
- * emulate that.
- */
- break;
- case KT_LOCK:
- if (kbe.kb_value == K_SHIFTLOCK) *k = XK_Shift_Lock;
- break;
- default: break;
- }
- }
-
- if (k[-1] == k[-2]) k[-1] = NoSymbol;
- if (k[-2] == k[-3]) k[-2] = NoSymbol;
- if (k[-3] == k[-4]) k[-3] = NoSymbol;
- if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol;
- if (k[-1] == k[-4] && k[-2] == k[-3]
- && k[-2] == NoSymbol) k[-1] = NoSymbol;
- }
+ maxkey = NUM_AT2LNX;
+
+ for (i = 0; i < maxkey; ++i) {
+ struct kbentry kbe;
+ int j;
+
+ kbe.kb_index = at2lnx[i];
+
+ for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) {
+ unsigned short kval;
+
+ *k = NoSymbol;
+
+ kbe.kb_table = tbl[j];
+ if (kbe.kb_index == 0 || ioctl(fd, KDGKBENT, &kbe))
+ continue;
+
+ kval = KVAL(kbe.kb_value);
+ switch (KTYP(kbe.kb_value)) {
+ case KT_LATIN:
+ case KT_LETTER:
+ *k = linux_to_x[kval];
+ break;
+ case KT_FN:
+ if (kval <= 19)
+ *k = XK_F1 + kval;
+ else
+ switch (kbe.kb_value) {
+ case K_FIND:
+ *k = XK_Home; /* or XK_Find */
+ break;
+ case K_INSERT:
+ *k = XK_Insert;
+ break;
+ case K_REMOVE:
+ *k = XK_Delete;
+ break;
+ case K_SELECT:
+ *k = XK_End; /* or XK_Select */
+ break;
+ case K_PGUP:
+ *k = XK_Prior;
+ break;
+ case K_PGDN:
+ *k = XK_Next;
+ break;
+ case K_HELP:
+ *k = XK_Help;
+ break;
+ case K_DO:
+ *k = XK_Execute;
+ break;
+ case K_PAUSE:
+ *k = XK_Pause;
+ break;
+ case K_MACRO:
+ *k = XK_Menu;
+ break;
+ default:
+ break;
+ }
+ break;
+ case KT_SPEC:
+ switch (kbe.kb_value) {
+ case K_ENTER:
+ *k = XK_Return;
+ break;
+ case K_BREAK:
+ *k = XK_Break;
+ break;
+ case K_CAPS:
+ *k = XK_Caps_Lock;
+ break;
+ case K_NUM:
+ *k = XK_Num_Lock;
+ break;
+ case K_HOLD:
+ *k = XK_Scroll_Lock;
+ break;
+ case K_COMPOSE:
+ *k = XK_Multi_key;
+ break;
+ default:
+ break;
+ }
+ break;
+ case KT_PAD:
+ switch (kbe.kb_value) {
+ case K_PPLUS:
+ *k = XK_KP_Add;
+ break;
+ case K_PMINUS:
+ *k = XK_KP_Subtract;
+ break;
+ case K_PSTAR:
+ *k = XK_KP_Multiply;
+ break;
+ case K_PSLASH:
+ *k = XK_KP_Divide;
+ break;
+ case K_PENTER:
+ *k = XK_KP_Enter;
+ break;
+ case K_PCOMMA:
+ *k = XK_KP_Separator;
+ break;
+ case K_PDOT:
+ *k = XK_KP_Decimal;
+ break;
+ case K_PPLUSMINUS:
+ *k = XK_KP_Subtract;
+ break;
+ default:
+ if (kval <= 9)
+ *k = XK_KP_0 + kval;
+ break;
+ }
+ break;
+ case KT_DEAD:
+ /* KT_DEAD keys are for accelerated diacritical creation. */
+ switch (kbe.kb_value) {
+ case K_DGRAVE:
+ *k = XK_dead_grave;
+ break;
+ case K_DACUTE:
+ *k = XK_dead_acute;
+ break;
+ case K_DCIRCM:
+ *k = XK_dead_circumflex;
+ break;
+ case K_DTILDE:
+ *k = XK_dead_tilde;
+ break;
+ case K_DDIERE:
+ *k = XK_dead_diaeresis;
+ break;
+ }
+ break;
+ case KT_CUR:
+ switch (kbe.kb_value) {
+ case K_DOWN:
+ *k = XK_Down;
+ break;
+ case K_LEFT:
+ *k = XK_Left;
+ break;
+ case K_RIGHT:
+ *k = XK_Right;
+ break;
+ case K_UP:
+ *k = XK_Up;
+ break;
+ }
+ break;
+ case KT_SHIFT:
+ switch (kbe.kb_value) {
+ case K_ALTGR:
+ *k = XK_Alt_R;
+ break;
+ case K_ALT:
+ *k = (kbe.kb_index == 0x64 ? XK_Alt_R : XK_Alt_L);
+ break;
+ case K_CTRL:
+ *k = (kbe.kb_index == 0x61 ? XK_Control_R : XK_Control_L);
+ break;
+ case K_CTRLL:
+ *k = XK_Control_L;
+ break;
+ case K_CTRLR:
+ *k = XK_Control_R;
+ break;
+ case K_SHIFT:
+ *k = (kbe.kb_index == 0x36 ? XK_Shift_R : XK_Shift_L);
+ break;
+ case K_SHIFTL:
+ *k = XK_Shift_L;
+ break;
+ case K_SHIFTR:
+ *k = XK_Shift_R;
+ break;
+ default:
+ break;
+ }
+ break;
+ case KT_ASCII:
+ /* KT_ASCII keys accumulate a 3 digit decimal number that
+ * gets emitted when the shift state changes. We can't
+ * emulate that.
+ */
+ break;
+ case KT_LOCK:
+ if (kbe.kb_value == K_SHIFTLOCK)
+ *k = XK_Shift_Lock;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (k[-1] == k[-2])
+ k[-1] = NoSymbol;
+ if (k[-2] == k[-3])
+ k[-2] = NoSymbol;
+ if (k[-3] == k[-4])
+ k[-3] = NoSymbol;
+ if (k[-4] == k[-2] && k[-3] == k[-1])
+ k[-2] = k[-1] = NoSymbol;
+ if (k[-1] == k[-4] && k[-2] == k[-3]
+ && k[-2] == NoSymbol)
+ k[-1] = NoSymbol;
+ }
}
-static void kbdLinuxGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
+static void
+kbdLinuxGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
{
GETPRIV;
- KeySym *k, *mapCopy;
- char type;
- int i;
+ KeySym *k, *mapCopy;
+ char type;
+ int i;
-#if 00/*BP*/
- mapCopy = malloc(sizeof(map));
+#if 00 /*BP*/
+ mapCopy = malloc(sizeof(map));
memcpy(mapCopy, map, sizeof(map));
#else
ErrorF("kbdLinuxGetMap() is broken/no-op'd\n");
@@ -950,41 +1138,57 @@ static void kbdLinuxGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
/* compute the modifier map */
for (i = 0; i < MAP_LENGTH; i++)
pModMap[i] = NoSymbol; /* make sure it is restored */
-
+
for (k = mapCopy, i = MIN_KEYCODE;
- i < NUM_KEYCODES + MIN_KEYCODE;
- i++, k += 4) {
- switch(*k) {
+ i < NUM_KEYCODES + MIN_KEYCODE; i++, k += 4) {
+ switch (*k) {
case XK_Shift_L:
- case XK_Shift_R: pModMap[i] = ShiftMask; break;
+ case XK_Shift_R:
+ pModMap[i] = ShiftMask;
+ break;
case XK_Control_L:
- case XK_Control_R: pModMap[i] = ControlMask; break;
- case XK_Caps_Lock: pModMap[i] = LockMask; break;
+ case XK_Control_R:
+ pModMap[i] = ControlMask;
+ break;
+ case XK_Caps_Lock:
+ pModMap[i] = LockMask;
+ break;
case XK_Alt_L:
- case XK_Alt_R: pModMap[i] = AltMask; break;
- case XK_Num_Lock: pModMap[i] = NumLockMask; break;
- case XK_Scroll_Lock: pModMap[i] = ScrollLockMask; break;
+ case XK_Alt_R:
+ pModMap[i] = AltMask;
+ break;
+ case XK_Num_Lock:
+ pModMap[i] = NumLockMask;
+ break;
+ case XK_Scroll_Lock:
+ pModMap[i] = ScrollLockMask;
+ break;
case XK_Kana_Lock:
- case XK_Kana_Shift: pModMap[i] = KanaMask; break;
- case XK_Mode_switch: pModMap[i] = AltLangMask; break;
+ case XK_Kana_Shift:
+ pModMap[i] = KanaMask;
+ break;
+ case XK_Mode_switch:
+ pModMap[i] = AltLangMask;
+ break;
}
}
priv->kbdType = (ioctl(priv->fd, KDGKBTYPE, &type) < 0) ? KB_101 : type;
- pKeySyms->map = mapCopy; /* Must be XFree'able */
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->map = mapCopy; /* Must be XFree'able */
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
pKeySyms->minKeyCode = MIN_KEYCODE;
pKeySyms->maxKeyCode = MAX_KEYCODE;
}
/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void kbdLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+ * pDev. */
+void
+kbdLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{
- info->keyboard = 1;
- info->keyClass = 1;
+ info->keyboard = 1;
+ info->keyClass = 1;
kbdLinuxGetMap(pDev, &info->keySyms, info->modMap);
- info->focusClass = 1;
+ info->focusClass = 1;
info->kbdFeedbackClass = 1;
}
diff --git a/xorg-server/hw/dmx/input/lnx-ms.c b/xorg-server/hw/dmx/input/lnx-ms.c
index e6d203c4b..7e1acf450 100644
--- a/xorg-server/hw/dmx/input/lnx-ms.c
+++ b/xorg-server/hw/dmx/input/lnx-ms.c
@@ -1,321 +1,348 @@
-/* Portions of this file were derived from the following files:
- *
- **********************************************************************
- *
- * Xserver/hw/kdrive/linux/ms.c
- *
- * Copyright (c) 2001 by Juliusz Chroboczek
- * Copyright (c) 1999 by Keith Packard
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-/*
- * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This code implements a low-level device driver for a serial MS mouse.
- * The code is derived from code by Juliusz Chroboczek and Keith Packard
- * (see the source code for complete references). */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "inputstr.h"
-#include <X11/Xos.h>
-#include <errno.h>
-#include <termios.h>
-
-/*****************************************************************************/
-/* Define some macros to make it easier to move this file to another
- * part of the Xserver tree. All calls to the dmx* layer are #defined
- * here for the .c file. The .h file will also have to be edited. */
-#include "dmxinputinit.h"
-#include "lnx-ms.h"
-
-#define GETPRIV myPrivate *priv \
- = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
-
-#define LOG0(f) dmxLog(dmxDebug,f)
-#define LOG1(f,a) dmxLog(dmxDebug,f,a)
-#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define FATAL0(f) dmxLog(dmxFatal,f)
-#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
-#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
-#define MOTIONPROC dmxMotionProcPtr
-#define ENQUEUEPROC dmxEnqueueProcPtr
-#define CHECKPROC dmxCheckSpecialProcPtr
-#define BLOCK DMXBlockType
-
-/* End of interface definitions. */
-/*****************************************************************************/
-
-/* Private area for MS mouse devices. */
-typedef struct _myPrivate {
- DeviceIntPtr pMouse;
- int fd;
- struct termios tty;
- enum {
- button1 = 0x0001,
- button2 = 0x0002,
- button3 = 0x0004,
- button4 = 0x0008,
- button5 = 0x0010
- } buttons;
-} myPrivate;
-
-static int msLinuxReadBytes(int fd, unsigned char *buf, int len, int min)
-{
- int n, tot;
- fd_set set;
- struct timeval tv;
-
- tot = 0;
- while (len) {
- n = read(fd, buf, len);
- if (n > 0) {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0) break;
- FD_ZERO(&set);
- FD_SET(fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select(fd + 1, &set, 0, 0, &tv);
- if (n <= 0) break;
- }
- return tot;
-}
-
-static void msLinuxButton(DevicePtr pDev, ENQUEUEPROC enqueue, int buttons,
- BLOCK block)
-{
- GETPRIV;
-
-#define PRESS(b) \
- do { \
- enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
- } while (0)
-
-#define RELEASE(b) \
- do { \
- enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
- } while (0)
-
- if ((buttons & button1) && !(priv->buttons & button1)) PRESS(1);
- if (!(buttons & button1) && (priv->buttons & button1)) RELEASE(1);
-
- if ((buttons & button2) && !(priv->buttons & button2)) PRESS(2);
- if (!(buttons & button2) && (priv->buttons & button2)) RELEASE(2);
-
- if ((buttons & button3) && !(priv->buttons & button3)) PRESS(3);
- if (!(buttons & button3) && (priv->buttons & button3)) RELEASE(3);
-
- if ((buttons & button4) && !(priv->buttons & button4)) PRESS(4);
- if (!(buttons & button4) && (priv->buttons & button4)) RELEASE(4);
-
- if ((buttons & button5) && !(priv->buttons & button5)) PRESS(5);
- if (!(buttons & button5) && (priv->buttons & button5)) RELEASE(5);
-
- priv->buttons = buttons;
-}
-
-/** Read an event from the \a pDev device. If the event is a motion
- * event, enqueue it with the \a motion function. Otherwise, check for
- * special keys with the \a checkspecial function and enqueue the event
- * with the \a enqueue function. The \a block type is passed to the
- * functions so that they may block SIGIO handling as appropriate to the
- * caller of this function. */
-void msLinuxRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
-{
- GETPRIV;
- unsigned char buf[3 * 200]; /* RATS: Use ok */
- unsigned char *b;
- int n;
- int dx, dy, v[2];
-
- while ((n = msLinuxReadBytes(priv->fd, buf, sizeof(buf), 3)) > 0) {
- b = buf;
- while (n >= 3) {
- dx = (char)(((b[0] & 0x03) << 6) | (b[1] & 0x3f));
- dy = (char)(((b[0] & 0x0c) << 4) | (b[2] & 0x3f));
- v[0] = -dx;
- v[1] = -dy;
-
- motion(pDev, v, 0, 2, 1, block);
- msLinuxButton(pDev, enqueue, (((b[0] & 0x10) ? button3 : 0)
- | ((b[0] & 0x20) ? button1 : 0)),
- block);
- n -= 3;
- b += 3;
- }
- }
-}
-
-/** Initialize \a pDev. */
-void msLinuxInit(DevicePtr pDev)
-{
- GETPRIV;
- const char *names[] = { "/dev/serialmouse", "/dev/mouse", NULL };
- int i;
-
- if (priv->fd >=0) return;
-
- for (i = 0; names[i]; i++) {
- if ((priv->fd = open(names[i], O_RDWR | O_NONBLOCK, 0)) >= 0) break;
- }
- if (priv->fd < 0)
- FATAL1("msLinuxInit: Cannot open mouse port (%s)\n",
- strerror(errno));
-
- if (!isatty(priv->fd))
- FATAL1("msLinuxInit: Mouse port %s is not a tty\n", names[i]);
-
- if (tcgetattr(priv->fd, &priv->tty) < 0)
- FATAL1("msLinuxInit: tcgetattr failed (%s)\n", strerror(errno));
-
- write(priv->fd, "*n", 2); /* 1200 baud */
- usleep(100000);
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int msLinuxOn(DevicePtr pDev)
-{
- GETPRIV;
- struct termios nTty;
-
- if (priv->fd < 0) msLinuxInit(pDev);
-
- nTty = priv->tty;
- nTty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR
- | IGNCR | ICRNL | IXON | IXOFF);
- nTty.c_oflag &= ~OPOST;
- nTty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
- nTty.c_cflag &= ~(CSIZE | PARENB);
- nTty.c_cflag |= CS8 | CLOCAL | CSTOPB;
- nTty.c_cc[VTIME] = 0;
- nTty.c_cc[VMIN] = 1;
- cfsetispeed (&nTty, B1200);
- cfsetospeed (&nTty, B1200);
- if (tcsetattr(priv->fd, TCSANOW, &nTty) < 0)
- FATAL1("msLinuxInit: tcsetattr failed (%s)\n", strerror(errno));
- write(priv->fd, "*V", 2); /* 2 button 3 byte protocol */
- return priv->fd;
-}
-
-/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
-void msLinuxOff(DevicePtr pDev)
-{
- GETPRIV;
-
- tcsetattr(priv->fd, TCSANOW, &priv->tty);
- close(priv->fd);
- priv->fd = -1;
-}
-
-static void msLinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
-{
- int i;
-
- if (nButtons) *nButtons = 3;
- if (map) for (i = 0; i <= *nButtons; i++) map[i] = i;
-}
-
-/** Currently unused hook called prior to an VT switch. */
-void msLinuxVTPreSwitch(pointer p)
-{
-}
-
-/** Currently unused hook called after returning from a VT switch. */
-void msLinuxVTPostSwitch(pointer p)
-{
-}
-
-/** Create a private structure for use within this file. */
-pointer msLinuxCreatePrivate(DeviceIntPtr pMouse)
-{
- myPrivate *priv = calloc(1, sizeof(*priv));
- priv->fd = -1;
- priv->pMouse = pMouse;
- return priv;
-}
-
-/** Destroy a private structure. */
-void msLinuxDestroyPrivate(pointer priv)
-{
- free(priv);
-}
-
-/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void msLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- info->buttonClass = 1;
- msLinuxGetMap(pDev, info->map, &info->numButtons);
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->maxval[0] = 0;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
- info->ptrFeedbackClass = 1;
-}
+/* Portions of this file were derived from the following files:
+ *
+ **********************************************************************
+ *
+ * Xserver/hw/kdrive/linux/ms.c
+ *
+ * Copyright (c) 2001 by Juliusz Chroboczek
+ * Copyright (c) 1999 by Keith Packard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a serial MS mouse.
+ * The code is derived from code by Juliusz Chroboczek and Keith Packard
+ * (see the source code for complete references). */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "inputstr.h"
+#include <X11/Xos.h>
+#include <errno.h>
+#include <termios.h>
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "dmxinputinit.h"
+#include "lnx-ms.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+/* Private area for MS mouse devices. */
+typedef struct _myPrivate {
+ DeviceIntPtr pMouse;
+ int fd;
+ struct termios tty;
+ enum {
+ button1 = 0x0001,
+ button2 = 0x0002,
+ button3 = 0x0004,
+ button4 = 0x0008,
+ button5 = 0x0010
+ } buttons;
+} myPrivate;
+
+static int
+msLinuxReadBytes(int fd, unsigned char *buf, int len, int min)
+{
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
+
+ tot = 0;
+ while (len) {
+ n = read(fd, buf, len);
+ if (n > 0) {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0)
+ break;
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select(fd + 1, &set, 0, 0, &tv);
+ if (n <= 0)
+ break;
+ }
+ return tot;
+}
+
+static void
+msLinuxButton(DevicePtr pDev, ENQUEUEPROC enqueue, int buttons, BLOCK block)
+{
+ GETPRIV;
+
+#define PRESS(b) \
+ do { \
+ enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
+ } while (0)
+
+#define RELEASE(b) \
+ do { \
+ enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
+ } while (0)
+
+ if ((buttons & button1) && !(priv->buttons & button1))
+ PRESS(1);
+ if (!(buttons & button1) && (priv->buttons & button1))
+ RELEASE(1);
+
+ if ((buttons & button2) && !(priv->buttons & button2))
+ PRESS(2);
+ if (!(buttons & button2) && (priv->buttons & button2))
+ RELEASE(2);
+
+ if ((buttons & button3) && !(priv->buttons & button3))
+ PRESS(3);
+ if (!(buttons & button3) && (priv->buttons & button3))
+ RELEASE(3);
+
+ if ((buttons & button4) && !(priv->buttons & button4))
+ PRESS(4);
+ if (!(buttons & button4) && (priv->buttons & button4))
+ RELEASE(4);
+
+ if ((buttons & button5) && !(priv->buttons & button5))
+ PRESS(5);
+ if (!(buttons & button5) && (priv->buttons & button5))
+ RELEASE(5);
+
+ priv->buttons = buttons;
+}
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, check for
+ * special keys with the \a checkspecial function and enqueue the event
+ * with the \a enqueue function. The \a block type is passed to the
+ * functions so that they may block SIGIO handling as appropriate to the
+ * caller of this function. */
+void
+msLinuxRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
+{
+ GETPRIV;
+ unsigned char buf[3 * 200]; /* RATS: Use ok */
+ unsigned char *b;
+ int n;
+ int dx, dy, v[2];
+
+ while ((n = msLinuxReadBytes(priv->fd, buf, sizeof(buf), 3)) > 0) {
+ b = buf;
+ while (n >= 3) {
+ dx = (char) (((b[0] & 0x03) << 6) | (b[1] & 0x3f));
+ dy = (char) (((b[0] & 0x0c) << 4) | (b[2] & 0x3f));
+ v[0] = -dx;
+ v[1] = -dy;
+
+ motion(pDev, v, 0, 2, 1, block);
+ msLinuxButton(pDev, enqueue, (((b[0] & 0x10) ? button3 : 0)
+ | ((b[0] & 0x20) ? button1 : 0)),
+ block);
+ n -= 3;
+ b += 3;
+ }
+ }
+}
+
+/** Initialize \a pDev. */
+void
+msLinuxInit(DevicePtr pDev)
+{
+ GETPRIV;
+ const char *names[] = { "/dev/serialmouse", "/dev/mouse", NULL };
+ int i;
+
+ if (priv->fd >= 0)
+ return;
+
+ for (i = 0; names[i]; i++) {
+ if ((priv->fd = open(names[i], O_RDWR | O_NONBLOCK, 0)) >= 0)
+ break;
+ }
+ if (priv->fd < 0)
+ FATAL1("msLinuxInit: Cannot open mouse port (%s)\n", strerror(errno));
+
+ if (!isatty(priv->fd))
+ FATAL1("msLinuxInit: Mouse port %s is not a tty\n", names[i]);
+
+ if (tcgetattr(priv->fd, &priv->tty) < 0)
+ FATAL1("msLinuxInit: tcgetattr failed (%s)\n", strerror(errno));
+
+ write(priv->fd, "*n", 2); /* 1200 baud */
+ usleep(100000);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+msLinuxOn(DevicePtr pDev)
+{
+ GETPRIV;
+ struct termios nTty;
+
+ if (priv->fd < 0)
+ msLinuxInit(pDev);
+
+ nTty = priv->tty;
+ nTty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR
+ | IGNCR | ICRNL | IXON | IXOFF);
+ nTty.c_oflag &= ~OPOST;
+ nTty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
+ nTty.c_cflag &= ~(CSIZE | PARENB);
+ nTty.c_cflag |= CS8 | CLOCAL | CSTOPB;
+ nTty.c_cc[VTIME] = 0;
+ nTty.c_cc[VMIN] = 1;
+ cfsetispeed(&nTty, B1200);
+ cfsetospeed(&nTty, B1200);
+ if (tcsetattr(priv->fd, TCSANOW, &nTty) < 0)
+ FATAL1("msLinuxInit: tcsetattr failed (%s)\n", strerror(errno));
+ write(priv->fd, "*V", 2); /* 2 button 3 byte protocol */
+ return priv->fd;
+}
+
+/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
+void
+msLinuxOff(DevicePtr pDev)
+{
+ GETPRIV;
+
+ tcsetattr(priv->fd, TCSANOW, &priv->tty);
+ close(priv->fd);
+ priv->fd = -1;
+}
+
+static void
+msLinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+{
+ int i;
+
+ if (nButtons)
+ *nButtons = 3;
+ if (map)
+ for (i = 0; i <= *nButtons; i++)
+ map[i] = i;
+}
+
+/** Currently unused hook called prior to an VT switch. */
+void
+msLinuxVTPreSwitch(pointer p)
+{
+}
+
+/** Currently unused hook called after returning from a VT switch. */
+void
+msLinuxVTPostSwitch(pointer p)
+{
+}
+
+/** Create a private structure for use within this file. */
+pointer
+msLinuxCreatePrivate(DeviceIntPtr pMouse)
+{
+ myPrivate *priv = calloc(1, sizeof(*priv));
+
+ priv->fd = -1;
+ priv->pMouse = pMouse;
+ return priv;
+}
+
+/** Destroy a private structure. */
+void
+msLinuxDestroyPrivate(pointer priv)
+{
+ free(priv);
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void
+msLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->buttonClass = 1;
+ msLinuxGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
diff --git a/xorg-server/hw/dmx/input/lnx-ps2.c b/xorg-server/hw/dmx/input/lnx-ps2.c
index f40441fe7..67c73a0c5 100644
--- a/xorg-server/hw/dmx/input/lnx-ps2.c
+++ b/xorg-server/hw/dmx/input/lnx-ps2.c
@@ -1,289 +1,318 @@
-/* Portions of this file were derived from the following files:
- *
- **********************************************************************
- *
- * Xserver/hw/kdrive/linux/ps2.c
- *
- * Copyright (c) 1999 by Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-/*
- * Copyright 2001,2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This code implements a low-level device driver for a serial MS mouse.
- * The code is derived from code by Keith Packard (see the source code
- * for complete references). */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "inputstr.h"
-#include <X11/Xos.h>
-#include <errno.h>
-#include <termios.h>
-
-/*****************************************************************************/
-/* Define some macros to make it easier to move this file to another
- * part of the Xserver tree. All calls to the dmx* layer are #defined
- * here for the .c file. The .h file will also have to be edited. */
-#include "dmxinputinit.h"
-#include "lnx-ps2.h"
-
-#define GETPRIV myPrivate *priv \
- = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
-
-#define LOG0(f) dmxLog(dmxDebug,f)
-#define LOG1(f,a) dmxLog(dmxDebug,f,a)
-#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define FATAL0(f) dmxLog(dmxFatal,f)
-#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
-#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
-#define MOTIONPROC dmxMotionProcPtr
-#define ENQUEUEPROC dmxEnqueueProcPtr
-#define CHECKPROC dmxCheckSpecialProcPtr
-#define BLOCK DMXBlockType
-
-/* End of interface definitions. */
-/*****************************************************************************/
-
-/* Private area for PS/2 devices. */
-typedef struct _myPrivate {
- DeviceIntPtr pMouse;
- int fd;
- enum {
- button1 = 0x0001,
- button2 = 0x0002,
- button3 = 0x0004,
- button4 = 0x0008,
- button5 = 0x0010
- } buttons;
-} myPrivate;
-
-static int ps2LinuxReadBytes(int fd, unsigned char *buf, int len, int min)
-{
- int n, tot;
- fd_set set;
- struct timeval tv;
-
- tot = 0;
- while (len) {
- n = read(fd, buf, len);
- if (n > 0) {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0) break;
- FD_ZERO(&set);
- FD_SET(fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select(fd + 1, &set, 0, 0, &tv);
- if (n <= 0) break;
- }
- return tot;
-}
-
-static void ps2LinuxButton(DevicePtr pDev, ENQUEUEPROC enqueue,
- int buttons, BLOCK block)
-{
- GETPRIV;
-
-#define PRESS(b) \
- do { \
- enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
- } while (0)
-
-#define RELEASE(b) \
- do { \
- enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
- } while (0)
-
- if ((buttons & button1) && !(priv->buttons & button1)) PRESS(1);
- if (!(buttons & button1) && (priv->buttons & button1)) RELEASE(1);
-
- if ((buttons & button2) && !(priv->buttons & button2)) PRESS(2);
- if (!(buttons & button2) && (priv->buttons & button2)) RELEASE(2);
-
- if ((buttons & button3) && !(priv->buttons & button3)) PRESS(3);
- if (!(buttons & button3) && (priv->buttons & button3)) RELEASE(3);
-
- if ((buttons & button4) && !(priv->buttons & button4)) PRESS(4);
- if (!(buttons & button4) && (priv->buttons & button4)) RELEASE(4);
-
- if ((buttons & button5) && !(priv->buttons & button5)) PRESS(5);
- if (!(buttons & button5) && (priv->buttons & button5)) RELEASE(5);
-
- priv->buttons = buttons;
-}
-
-/** Read an event from the \a pDev device. If the event is a motion
- * event, enqueue it with the \a motion function. Otherwise, check for
- * special keys with the \a checkspecial function and enqueue the event
- * with the \a enqueue function. The \a block type is passed to the
- * functions so that they may block SIGIO handling as appropriate to the
- * caller of this function. */
-void ps2LinuxRead(DevicePtr pDev, MOTIONPROC motion,
- ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
-{
- GETPRIV;
- unsigned char buf[3 * 200]; /* RATS: Use ok */
- unsigned char *b;
- int n;
- int dx, dy, v[2];
-
- while ((n = ps2LinuxReadBytes(priv->fd, buf, sizeof(buf), 3)) > 0) {
- b = buf;
- while (n >= 3) {
- dx = b[1] - ((b[0] & 0x10) ? 256 : 0);
- dy = -b[2] + ((b[0] & 0x20) ? 256 : 0);
- v[0] = -dx;
- v[1] = -dy;
-
- motion(pDev, v, 0, 2, 1, block);
- ps2LinuxButton(pDev, enqueue, (((b[0] & 4) ? button2 : 0)
- | ((b[0] & 2) ? button3 : 0)
- | ((b[0] & 1) ? button1 : 0)),
- block);
- n -= 3;
- b += 3;
- }
- }
-}
-
-/** Initialize \a pDev. */
-void ps2LinuxInit(DevicePtr pDev)
-{
- GETPRIV;
- const char *names[] = { "/dev/mouse", "/dev/psaux", NULL };
- int i;
-
- if (priv->fd >=0) return;
-
- for (i = 0; names[i]; i++) {
- if ((priv->fd = open(names[i], O_RDWR | O_NONBLOCK, 0)) >= 0) break;
- }
- if (priv->fd < 0)
- FATAL1("ps2LinuxInit: Cannot open mouse port (%s)\n",
- strerror(errno));
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int ps2LinuxOn(DevicePtr pDev)
-{
- GETPRIV;
-
- if (priv->fd < 0) ps2LinuxInit(pDev);
- return priv->fd;
-}
-
-/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
-void ps2LinuxOff(DevicePtr pDev)
-{
- GETPRIV;
-
- close(priv->fd);
- priv->fd = -1;
-}
-
-static void ps2LinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
-{
- int i;
-
- if (nButtons) *nButtons = 3;
- if (map) for (i = 0; i <= *nButtons; i++) map[i] = i;
-}
-
-/** Currently unused hook called prior to an VT switch. */
-void ps2LinuxVTPreSwitch(pointer p)
-{
-}
-
-/** Currently unused hook called after returning from a VT switch. */
-void ps2LinuxVTPostSwitch(pointer p)
-{
-}
-
-/** Create a private structure for use within this file. */
-pointer ps2LinuxCreatePrivate(DeviceIntPtr pMouse)
-{
- myPrivate *priv = calloc(1, sizeof(*priv));
- priv->fd = -1;
- priv->pMouse = pMouse;
- return priv;
-}
-
-/** Destroy a private structure. */
-void ps2LinuxDestroyPrivate(pointer priv)
-{
- free(priv);
-}
-
-/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void ps2LinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- info->buttonClass = 1;
- ps2LinuxGetMap(pDev, info->map, &info->numButtons);
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->maxval[0] = 0;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
- info->ptrFeedbackClass = 1;
-}
+/* Portions of this file were derived from the following files:
+ *
+ **********************************************************************
+ *
+ * Xserver/hw/kdrive/linux/ps2.c
+ *
+ * Copyright (c) 1999 by Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright 2001,2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a serial MS mouse.
+ * The code is derived from code by Keith Packard (see the source code
+ * for complete references). */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "inputstr.h"
+#include <X11/Xos.h>
+#include <errno.h>
+#include <termios.h>
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "dmxinputinit.h"
+#include "lnx-ps2.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+/* Private area for PS/2 devices. */
+typedef struct _myPrivate {
+ DeviceIntPtr pMouse;
+ int fd;
+ enum {
+ button1 = 0x0001,
+ button2 = 0x0002,
+ button3 = 0x0004,
+ button4 = 0x0008,
+ button5 = 0x0010
+ } buttons;
+} myPrivate;
+
+static int
+ps2LinuxReadBytes(int fd, unsigned char *buf, int len, int min)
+{
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
+
+ tot = 0;
+ while (len) {
+ n = read(fd, buf, len);
+ if (n > 0) {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0)
+ break;
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select(fd + 1, &set, 0, 0, &tv);
+ if (n <= 0)
+ break;
+ }
+ return tot;
+}
+
+static void
+ps2LinuxButton(DevicePtr pDev, ENQUEUEPROC enqueue, int buttons, BLOCK block)
+{
+ GETPRIV;
+
+#define PRESS(b) \
+ do { \
+ enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
+ } while (0)
+
+#define RELEASE(b) \
+ do { \
+ enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
+ } while (0)
+
+ if ((buttons & button1) && !(priv->buttons & button1))
+ PRESS(1);
+ if (!(buttons & button1) && (priv->buttons & button1))
+ RELEASE(1);
+
+ if ((buttons & button2) && !(priv->buttons & button2))
+ PRESS(2);
+ if (!(buttons & button2) && (priv->buttons & button2))
+ RELEASE(2);
+
+ if ((buttons & button3) && !(priv->buttons & button3))
+ PRESS(3);
+ if (!(buttons & button3) && (priv->buttons & button3))
+ RELEASE(3);
+
+ if ((buttons & button4) && !(priv->buttons & button4))
+ PRESS(4);
+ if (!(buttons & button4) && (priv->buttons & button4))
+ RELEASE(4);
+
+ if ((buttons & button5) && !(priv->buttons & button5))
+ PRESS(5);
+ if (!(buttons & button5) && (priv->buttons & button5))
+ RELEASE(5);
+
+ priv->buttons = buttons;
+}
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, check for
+ * special keys with the \a checkspecial function and enqueue the event
+ * with the \a enqueue function. The \a block type is passed to the
+ * functions so that they may block SIGIO handling as appropriate to the
+ * caller of this function. */
+void
+ps2LinuxRead(DevicePtr pDev, MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
+{
+ GETPRIV;
+ unsigned char buf[3 * 200]; /* RATS: Use ok */
+ unsigned char *b;
+ int n;
+ int dx, dy, v[2];
+
+ while ((n = ps2LinuxReadBytes(priv->fd, buf, sizeof(buf), 3)) > 0) {
+ b = buf;
+ while (n >= 3) {
+ dx = b[1] - ((b[0] & 0x10) ? 256 : 0);
+ dy = -b[2] + ((b[0] & 0x20) ? 256 : 0);
+ v[0] = -dx;
+ v[1] = -dy;
+
+ motion(pDev, v, 0, 2, 1, block);
+ ps2LinuxButton(pDev, enqueue, (((b[0] & 4) ? button2 : 0)
+ | ((b[0] & 2) ? button3 : 0)
+ | ((b[0] & 1) ? button1 : 0)),
+ block);
+ n -= 3;
+ b += 3;
+ }
+ }
+}
+
+/** Initialize \a pDev. */
+void
+ps2LinuxInit(DevicePtr pDev)
+{
+ GETPRIV;
+ const char *names[] = { "/dev/mouse", "/dev/psaux", NULL };
+ int i;
+
+ if (priv->fd >= 0)
+ return;
+
+ for (i = 0; names[i]; i++) {
+ if ((priv->fd = open(names[i], O_RDWR | O_NONBLOCK, 0)) >= 0)
+ break;
+ }
+ if (priv->fd < 0)
+ FATAL1("ps2LinuxInit: Cannot open mouse port (%s)\n", strerror(errno));
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+ps2LinuxOn(DevicePtr pDev)
+{
+ GETPRIV;
+
+ if (priv->fd < 0)
+ ps2LinuxInit(pDev);
+ return priv->fd;
+}
+
+/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
+void
+ps2LinuxOff(DevicePtr pDev)
+{
+ GETPRIV;
+
+ close(priv->fd);
+ priv->fd = -1;
+}
+
+static void
+ps2LinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+{
+ int i;
+
+ if (nButtons)
+ *nButtons = 3;
+ if (map)
+ for (i = 0; i <= *nButtons; i++)
+ map[i] = i;
+}
+
+/** Currently unused hook called prior to an VT switch. */
+void
+ps2LinuxVTPreSwitch(pointer p)
+{
+}
+
+/** Currently unused hook called after returning from a VT switch. */
+void
+ps2LinuxVTPostSwitch(pointer p)
+{
+}
+
+/** Create a private structure for use within this file. */
+pointer
+ps2LinuxCreatePrivate(DeviceIntPtr pMouse)
+{
+ myPrivate *priv = calloc(1, sizeof(*priv));
+
+ priv->fd = -1;
+ priv->pMouse = pMouse;
+ return priv;
+}
+
+/** Destroy a private structure. */
+void
+ps2LinuxDestroyPrivate(pointer priv)
+{
+ free(priv);
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void
+ps2LinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->buttonClass = 1;
+ ps2LinuxGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
diff --git a/xorg-server/hw/dmx/input/usb-common.c b/xorg-server/hw/dmx/input/usb-common.c
index 944033eba..c7c166cce 100644
--- a/xorg-server/hw/dmx/input/usb-common.c
+++ b/xorg-server/hw/dmx/input/usb-common.c
@@ -74,7 +74,6 @@
/* End of interface definitions. */
/*****************************************************************************/
-
/** Read an event from the \a pDev device. If the event is a motion
* event, enqueue it with the \a motion function. Otherwise, enqueue
* the event with the \a enqueue function. The \a block type is passed
@@ -84,16 +83,14 @@
* Since USB devices return EV_KEY events for buttons and keys, \a
* minButton is used to decide if a Button or Key event should be
* queued.*/
-void usbRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- int minButton,
- BLOCK block)
+void
+usbRead(DevicePtr pDev,
+ MOTIONPROC motion, ENQUEUEPROC enqueue, int minButton, BLOCK block)
{
GETPRIV;
struct input_event raw;
- int v[DMX_MAX_AXES];
- int axis;
+ int v[DMX_MAX_AXES];
+ int axis;
#define PRESS(b) \
do { \
@@ -112,11 +109,14 @@ void usbRead(DevicePtr pDev,
#endif
switch (raw.type) {
case EV_KEY:
- /* raw.value = 1 for first, 2 for repeat */
+ /* raw.value = 1 for first, 2 for repeat */
if (raw.code > minButton) {
- if (raw.value) PRESS((raw.code & 0x0f) + 1);
- else RELEASE((raw.code & 0x0f) + 1);
- } else {
+ if (raw.value)
+ PRESS((raw.code & 0x0f) + 1);
+ else
+ RELEASE((raw.code & 0x0f) + 1);
+ }
+ else {
enqueue(pDev, raw.value ? KeyPress : KeyRelease,
0, 0, NULL, block);
}
@@ -134,10 +134,11 @@ void usbRead(DevicePtr pDev,
motion(pDev, v, 0, 2, DMX_RELATIVE, block);
break;
case REL_WHEEL:
- if ((int)raw.value > 0) {
+ if ((int) raw.value > 0) {
PRESS(4);
RELEASE(4);
- } else if ((int)raw.value < 0) {
+ }
+ else if ((int) raw.value < 0) {
PRESS(5);
RELEASE(5);
}
@@ -162,126 +163,228 @@ void usbRead(DevicePtr pDev,
#define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8)))
#define test_bits(bit) (bits[(bit)/8] & (1 << ((bit)%8)))
-static void usbPrint(myPrivate *priv,
- const char *filename, const char *devname, int fd)
+static void
+usbPrint(myPrivate * priv, const char *filename, const char *devname, int fd)
{
- int j, k;
- DeviceIntPtr pDevice = priv->pDevice;
- unsigned char bits[KEY_MAX/8 + 1]; /* RATS: Use ok assuming that
- * KEY_MAX is greater than
- * REL_MAX, ABS_MAX, SND_MAX, and
- * LED_MAX. */
+ int j, k;
+ DeviceIntPtr pDevice = priv->pDevice;
+ unsigned char bits[KEY_MAX / 8 + 1]; /* RATS: Use ok assuming that
+ * KEY_MAX is greater than
+ * REL_MAX, ABS_MAX, SND_MAX, and
+ * LED_MAX. */
LOG3INPUT(priv, "%s (%s) using %s\n", pDevice->name, GETNAME, filename);
LOG1INPUT(priv, " %s\n", devname);
for (j = 0; j < EV_MAX; j++) {
if (test_bit(j)) {
- const char *type = "unknown";
- char extra[256]; /* FIXME: may cause buffer overflow */
+ const char *type = "unknown";
+ char extra[256]; /* FIXME: may cause buffer overflow */
+
extra[0] = '\0';
- switch(j) {
- case EV_KEY: type = "keys/buttons"; break;
- case EV_REL: type = "relative";
+ switch (j) {
+ case EV_KEY:
+ type = "keys/buttons";
+ break;
+ case EV_REL:
+ type = "relative";
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits);
for (k = 0; k < REL_MAX; k++) {
- if (test_bits(k)) switch (k) {
- case REL_X: strcat(extra, " X"); break;
- case REL_Y: strcat(extra, " Y"); break;
- case REL_Z: strcat(extra, " Z"); break;
- case REL_HWHEEL: strcat(extra, " HWheel"); break;
- case REL_DIAL: strcat(extra, " Dial"); break;
- case REL_WHEEL: strcat(extra, " Wheel"); break;
- case REL_MISC: strcat(extra, " Misc"); break;
- }
+ if (test_bits(k))
+ switch (k) {
+ case REL_X:
+ strcat(extra, " X");
+ break;
+ case REL_Y:
+ strcat(extra, " Y");
+ break;
+ case REL_Z:
+ strcat(extra, " Z");
+ break;
+ case REL_HWHEEL:
+ strcat(extra, " HWheel");
+ break;
+ case REL_DIAL:
+ strcat(extra, " Dial");
+ break;
+ case REL_WHEEL:
+ strcat(extra, " Wheel");
+ break;
+ case REL_MISC:
+ strcat(extra, " Misc");
+ break;
+ }
}
break;
- case EV_ABS: type = "absolute";
+ case EV_ABS:
+ type = "absolute";
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits);
for (k = 0; k < ABS_MAX; k++) {
- if (test_bits(k)) switch (k) {
- case ABS_X: strcat(extra," X"); break;
- case ABS_Y: strcat(extra," Y"); break;
- case ABS_Z: strcat(extra," Z"); break;
- case ABS_RX: strcat(extra," RX"); break;
- case ABS_RY: strcat(extra," RY"); break;
- case ABS_RZ: strcat(extra," RZ"); break;
- case ABS_THROTTLE: strcat(extra," Throttle");break;
- case ABS_RUDDER: strcat(extra," Rudder"); break;
- case ABS_WHEEL: strcat(extra," Wheel"); break;
- case ABS_GAS: strcat(extra," Gas"); break;
- case ABS_BRAKE: strcat(extra," Break"); break;
- case ABS_HAT0X: strcat(extra," Hat0X"); break;
- case ABS_HAT0Y: strcat(extra," Hat0Y"); break;
- case ABS_HAT1X: strcat(extra," Hat1X"); break;
- case ABS_HAT1Y: strcat(extra," Hat1Y"); break;
- case ABS_HAT2X: strcat(extra," Hat2X"); break;
- case ABS_HAT2Y: strcat(extra," Hat2Y"); break;
- case ABS_HAT3X: strcat(extra," Hat3X"); break;
- case ABS_HAT3Y: strcat(extra," Hat3Y"); break;
- case ABS_PRESSURE: strcat(extra," Pressure");break;
- case ABS_DISTANCE: strcat(extra," Distance");break;
- case ABS_TILT_X: strcat(extra," TiltX"); break;
- case ABS_TILT_Y: strcat(extra," TiltY"); break;
- case ABS_MISC: strcat(extra," Misc"); break;
- }
+ if (test_bits(k))
+ switch (k) {
+ case ABS_X:
+ strcat(extra, " X");
+ break;
+ case ABS_Y:
+ strcat(extra, " Y");
+ break;
+ case ABS_Z:
+ strcat(extra, " Z");
+ break;
+ case ABS_RX:
+ strcat(extra, " RX");
+ break;
+ case ABS_RY:
+ strcat(extra, " RY");
+ break;
+ case ABS_RZ:
+ strcat(extra, " RZ");
+ break;
+ case ABS_THROTTLE:
+ strcat(extra, " Throttle");
+ break;
+ case ABS_RUDDER:
+ strcat(extra, " Rudder");
+ break;
+ case ABS_WHEEL:
+ strcat(extra, " Wheel");
+ break;
+ case ABS_GAS:
+ strcat(extra, " Gas");
+ break;
+ case ABS_BRAKE:
+ strcat(extra, " Break");
+ break;
+ case ABS_HAT0X:
+ strcat(extra, " Hat0X");
+ break;
+ case ABS_HAT0Y:
+ strcat(extra, " Hat0Y");
+ break;
+ case ABS_HAT1X:
+ strcat(extra, " Hat1X");
+ break;
+ case ABS_HAT1Y:
+ strcat(extra, " Hat1Y");
+ break;
+ case ABS_HAT2X:
+ strcat(extra, " Hat2X");
+ break;
+ case ABS_HAT2Y:
+ strcat(extra, " Hat2Y");
+ break;
+ case ABS_HAT3X:
+ strcat(extra, " Hat3X");
+ break;
+ case ABS_HAT3Y:
+ strcat(extra, " Hat3Y");
+ break;
+ case ABS_PRESSURE:
+ strcat(extra, " Pressure");
+ break;
+ case ABS_DISTANCE:
+ strcat(extra, " Distance");
+ break;
+ case ABS_TILT_X:
+ strcat(extra, " TiltX");
+ break;
+ case ABS_TILT_Y:
+ strcat(extra, " TiltY");
+ break;
+ case ABS_MISC:
+ strcat(extra, " Misc");
+ break;
+ }
}
break;
- case EV_MSC: type = "reserved"; break;
- case EV_LED: type = "leds";
+ case EV_MSC:
+ type = "reserved";
+ break;
+ case EV_LED:
+ type = "leds";
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits);
for (k = 0; k < LED_MAX; k++) {
- if (test_bits(k)) switch (k) {
- case LED_NUML: strcat(extra," NumLock"); break;
- case LED_CAPSL: strcat(extra," CapsLock"); break;
- case LED_SCROLLL: strcat(extra," ScrlLock"); break;
- case LED_COMPOSE: strcat(extra," Compose"); break;
- case LED_KANA: strcat(extra," Kana"); break;
- case LED_SLEEP: strcat(extra," Sleep"); break;
- case LED_SUSPEND: strcat(extra," Suspend"); break;
- case LED_MUTE: strcat(extra," Mute"); break;
- case LED_MISC: strcat(extra," Misc"); break;
- }
+ if (test_bits(k))
+ switch (k) {
+ case LED_NUML:
+ strcat(extra, " NumLock");
+ break;
+ case LED_CAPSL:
+ strcat(extra, " CapsLock");
+ break;
+ case LED_SCROLLL:
+ strcat(extra, " ScrlLock");
+ break;
+ case LED_COMPOSE:
+ strcat(extra, " Compose");
+ break;
+ case LED_KANA:
+ strcat(extra, " Kana");
+ break;
+ case LED_SLEEP:
+ strcat(extra, " Sleep");
+ break;
+ case LED_SUSPEND:
+ strcat(extra, " Suspend");
+ break;
+ case LED_MUTE:
+ strcat(extra, " Mute");
+ break;
+ case LED_MISC:
+ strcat(extra, " Misc");
+ break;
+ }
}
break;
- case EV_SND: type = "sound";
+ case EV_SND:
+ type = "sound";
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_SND, sizeof(bits)), bits);
for (k = 0; k < SND_MAX; k++) {
- if (test_bits(k)) switch (k) {
- case SND_CLICK: strcat(extra," Click"); break;
- case SND_BELL: strcat(extra," Bell"); break;
- }
+ if (test_bits(k))
+ switch (k) {
+ case SND_CLICK:
+ strcat(extra, " Click");
+ break;
+ case SND_BELL:
+ strcat(extra, " Bell");
+ break;
+ }
}
break;
- case EV_REP: type = "repeat"; break;
- case EV_FF: type = "feedback"; break;
+ case EV_REP:
+ type = "repeat";
+ break;
+ case EV_FF:
+ type = "feedback";
+ break;
}
LOG5INPUT(priv, " Feature 0x%02x = %s%s%s%s\n", j, type,
extra[0] ? " [" : "",
- extra[0] ? extra+1 : "",
- extra[0] ? "]" : "");
+ extra[0] ? extra + 1 : "", extra[0] ? "]" : "");
}
}
}
/** Initialized \a pDev as a \a usbMouse, \a usbKeyboard, or \a usbOther
-device. */
-void usbInit(DevicePtr pDev, usbType type)
+device. */
+void
+usbInit(DevicePtr pDev, usbType type)
{
GETPRIV;
- char name[64]; /* RATS: Only used in snprintf */
- int i, j, k;
- char buf[256] = { 0, }; /* RATS: Use ok */
- int version;
- unsigned char bits[KEY_MAX/8 + 1]; /* RATS: Use ok assuming that
- * KEY_MAX is greater than
- * REL_MAX, ABS_MAX, SND_MAX, and
- * LED_MAX. */
+ char name[64]; /* RATS: Only used in snprintf */
+ int i, j, k;
+ char buf[256] = { 0, }; /* RATS: Use ok */
+ int version;
+ unsigned char bits[KEY_MAX / 8 + 1]; /* RATS: Use ok assuming that
+ * KEY_MAX is greater than
+ * REL_MAX, ABS_MAX, SND_MAX, and
+ * LED_MAX. */
- if (priv->fd >=0) return;
+ if (priv->fd >= 0)
+ return;
for (i = 0; i < 32; i++) {
snprintf(name, sizeof(name), "/dev/input/event%d", i);
@@ -293,15 +396,18 @@ void usbInit(DevicePtr pDev, usbType type)
for (j = 0; j < EV_MAX; j++) {
if (test_bit(j)) {
- switch(j) {
+ switch (j) {
case EV_REL:
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits);
for (k = 0; k < REL_MAX; k++) {
if (test_bits(k)) {
- if (k == REL_X) priv->relmap[k] = 0;
- else if (k == REL_Y) priv->relmap[k] = 1;
- else priv->relmap[k] = 2 + priv->numAbs;
+ if (k == REL_X)
+ priv->relmap[k] = 0;
+ else if (k == REL_Y)
+ priv->relmap[k] = 1;
+ else
+ priv->relmap[k] = 2 + priv->numAbs;
++priv->numRel;
}
}
@@ -320,7 +426,8 @@ void usbInit(DevicePtr pDev, usbType type)
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits);
for (k = 0; k < LED_MAX; k++) {
- if (test_bits(k)) ++priv->numLeds;
+ if (test_bits(k))
+ ++priv->numLeds;
}
break;
}
@@ -350,32 +457,36 @@ void usbInit(DevicePtr pDev, usbType type)
FATAL1("usbInit: Cannot open /dev/input/event* port (%s)\n"
" If you have not done so, you may need to:\n"
" rmmod mousedev; rmmod keybdev\n"
- " modprobe evdev\n",
- strerror(errno));
- found:
+ " modprobe evdev\n", strerror(errno));
+ found:
usbPrint(priv, name, buf, priv->fd);
}
/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
-void usbOff(DevicePtr pDev)
+void
+usbOff(DevicePtr pDev)
{
GETPRIV;
- if (priv->fd >= 0) close(priv->fd);
+ if (priv->fd >= 0)
+ close(priv->fd);
priv->fd = -1;
}
/** Create a private structure for use within this file. */
-pointer usbCreatePrivate(DeviceIntPtr pDevice)
+pointer
+usbCreatePrivate(DeviceIntPtr pDevice)
{
myPrivate *priv = calloc(1, sizeof(*priv));
- priv->fd = -1;
- priv->pDevice = pDevice;
+
+ priv->fd = -1;
+ priv->pDevice = pDevice;
return priv;
}
/** Destroy a private structure. */
-void usbDestroyPrivate(pointer priv)
+void
+usbDestroyPrivate(pointer priv)
{
free(priv);
}
diff --git a/xorg-server/hw/dmx/input/usb-common.h b/xorg-server/hw/dmx/input/usb-common.h
index 5ebfd1e78..eea98afbe 100644
--- a/xorg-server/hw/dmx/input/usb-common.h
+++ b/xorg-server/hw/dmx/input/usb-common.h
@@ -44,12 +44,11 @@ typedef enum {
} usbType;
extern pointer usbCreatePrivate(DeviceIntPtr pDevice);
-extern void usbDestroyPrivate(pointer priv);
-extern void usbRead(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- int minButton,
- DMXBlockType block);
-extern void usbInit(DevicePtr pDev, usbType type);
-extern void usbOff(DevicePtr pDev);
+extern void usbDestroyPrivate(pointer priv);
+extern void usbRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ int minButton, DMXBlockType block);
+extern void usbInit(DevicePtr pDev, usbType type);
+extern void usbOff(DevicePtr pDev);
#endif
diff --git a/xorg-server/hw/dmx/input/usb-keyboard.c b/xorg-server/hw/dmx/input/usb-keyboard.c
index c2b49039f..65bfcd00d 100644
--- a/xorg-server/hw/dmx/input/usb-keyboard.c
+++ b/xorg-server/hw/dmx/input/usb-keyboard.c
@@ -1,444 +1,477 @@
-/* Portions of this file were derived from the following files:
- *
- **********************************************************************
- *
- * xfree86/common/xf86KbdLnx.c
- *
- * Linux version of keymapping setup. The kernel (since 0.99.14) has support
- * for fully remapping the keyboard, but there are some differences between
- * the Linux map and the SVR4 map (esp. in the extended keycodes). We also
- * remove the restriction on what keycodes can be remapped.
- * Orest Zborowski.
- *
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-/*
- * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This code implements a low-level device driver for a USB keyboard
- * under Linux. The keymap description is derived from code by Thomas
- * Roell, Orest Zborowski. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "atKeynames.h"
-#include "usb-private.h"
-
-#define USB_KEYBOARD_DEBUG 0
-
-/*****************************************************************************/
-/* Define some macros to make it easier to move this file to another
- * part of the Xserver tree. All calls to the dmx* layer are #defined
- * here for the .c file. The .h file will also have to be edited. */
-#include "usb-keyboard.h"
-#include <xkbsrv.h>
-
-#define GETPRIV myPrivate *priv \
- = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
-
-#define LOG0(f) dmxLog(dmxDebug,f)
-#define LOG1(f,a) dmxLog(dmxDebug,f,a)
-#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define FATAL0(f) dmxLog(dmxFatal,f)
-#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
-#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
-#define MOTIONPROC dmxMotionProcPtr
-#define ENQUEUEPROC dmxEnqueueProcPtr
-#define CHECKPROC dmxCheckSpecialProcPtr
-#define BLOCK DMXBlockType
-
-/* End of interface definitions. */
-/*****************************************************************************/
-
-#define GLYPHS_PER_KEY 4
-#define NUM_KEYCODES 248
-#define MIN_KEYCODE 8
-#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
-
-static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
-/* Table modified from xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h */
- /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
- /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
- /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol,
- /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol,
- /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol,
- /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol,
- /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol,
- /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol,
- /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol,
- /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol,
- /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol,
- /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
- /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
- /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
- /* 0x0f */ XK_Tab, XK_ISO_Left_Tab,NoSymbol, NoSymbol,
- /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
- /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
- /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
- /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol,
- /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol,
- /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol,
- /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol,
- /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol,
- /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol,
- /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol,
- /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol,
- /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol,
- /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
- /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
- /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol,
- /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol,
- /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol,
- /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol,
- /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol,
- /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol,
- /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol,
- /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol,
- /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol,
- /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol,
- /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol,
- /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol,
- /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
- /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
- /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol,
- /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol,
- /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol,
- /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol,
- /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol,
- /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol,
- /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol,
- /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol,
- /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol,
- /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol,
- /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol,
- /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
- /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
- /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
- /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
- /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
- /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
- /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
- /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
- /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol,
- /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol,
- /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol,
- /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol,
- /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
- /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
- /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
- /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol,
- /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
- /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
- /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
- /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol,
- /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol,
- /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol,
- /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol,
- /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol,
- /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
- /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
- /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
- /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x60 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol,
- /* 0x61 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol,
- /* 0x62 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
- /* 0x63 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
- /* 0x64 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
- /* 0x65 */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
- /* 0x66 */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
- /* 0x67 */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
- /* 0x68 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
- /* 0x69 */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6a */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6b */ XK_End, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6c */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6d */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6e */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6f */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
- /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x77 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol,
- /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7a */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7d */ XK_Super_L, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7e */ XK_Super_R, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7f */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
-};
-
-static int kbdUSBKeyDown(myPrivate *priv, int keyCode)
-{
- CARD8 byte = keyCode >> 5;
- CARD32 bit = 1 << (keyCode & 0x1f);
-
- if (byte > NUM_STATE_ENTRIES) return 0;
- return priv->kbdState[byte] & bit;
-}
-
-static void kbdUSBKeyState(myPrivate *priv, int type, int keyCode)
-{
- CARD8 byte = keyCode >> 5;
- CARD32 bit = 1 << (keyCode & 0x1f);
-
- if (byte > NUM_STATE_ENTRIES) return;
- if (type == KeyPress) priv->kbdState[byte] |= bit;
- else priv->kbdState[byte] &= ~bit;
-}
-
-/** Set the LEDs. */
-void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl *ctrl)
-{
- GETPRIV;
- struct timeval tv;
- struct input_event event;
- int i, led;
-
- gettimeofday(&tv, NULL);
- for (i = 0; i < 5; i++) {
- event.time.tv_sec = tv.tv_sec;
- event.time.tv_usec = tv.tv_usec;
- event.type = EV_LED;
- if (i == 0) led = 1; /* LED_CAPSL == 0x01 */
- else if (i == 1) led = 0; /* LED_NUML == 0x00 */
- else led = i;
- event.code = led;
- event.value = !!(ctrl->leds & (1 << led));
- write(priv->fd, &event, sizeof(event));
- }
-}
-
-/** Initialize \a pDev using #usbInit. */
-void kbdUSBInit(DevicePtr pDev)
-{
- usbInit(pDev, usbKeyboard);
-}
-
-static void kbdUSBConvert(DevicePtr pDev,
- unsigned int scanCode,
- int value,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
-{
- GETPRIV;
- XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo;
- int type;
- int keyCode;
- KeySym keySym = NoSymbol;
- int switching;
-
- /* Set up xEvent information */
- type = value ? KeyPress : KeyRelease;
- keyCode = (scanCode & 0xff) + MIN_KEYCODE;
-
- /* Handle repeats */
-
- if (keyCode >= xkbi->desc->min_key_code &&
- keyCode <= xkbi->desc->max_key_code) {
-
- int effectiveGroup = XkbGetEffectiveGroup(xkbi,
- &xkbi->state,
- scanCode);
- keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup);
-#if 0
- switch (keySym) {
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Shift_Lock:
- case XK_Caps_Lock:
- /* Ignore releases and all but first press */
- if (kbdLinuxModIgnore(priv, &xE, keySym)) return;
- if (kbdLinuxKeyDown(priv, &xE)) xE.u.u.type = KeyRelease;
- else xE.u.u.type = KeyPress;
- break;
- }
-#endif
-
- /* If key is already down, ignore or autorepeat */
- if (type == KeyPress && kbdUSBKeyDown(priv, keyCode)) {
- KbdFeedbackClassRec *feed = priv->pDevice->kbdfeed;
-
- /* No auto-repeat? */
- if ((feed && !feed->ctrl.autoRepeat)
- || priv->pDevice->key->xkbInfo->desc->map->modmap[keyCode]
- || (feed
- && !(feed->ctrl.autoRepeats[keyCode >> 3]
- & (1 << (keyCode & 7))))) return; /* Ignore */
-
- /* Do auto-repeat */
- enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block);
- type = KeyPress;
- }
-
- /* If key is already up, ignore */
- if (type == KeyRelease && !kbdUSBKeyDown(priv, keyCode)) return;
- }
-
- switching = 0;
- if (checkspecial && type == KeyPress)
- switching = checkspecial(pDev, keySym);
- if (!switching) {
- if (enqueue)
- enqueue(pDev, type, keyCode, keySym, NULL, block);
- kbdUSBKeyState(priv, type, keyCode); /* Update our state bitmap */
- }
-}
-
-/** Read an event from the \a pDev device. If the event is a motion
- * event, enqueue it with the \a motion function. Otherwise, check for
- * special keys with the \a checkspecial function and enqueue the event
- * with the \a enqueue function. The \a block type is passed to the
- * functions so that they may block SIGIO handling as appropriate to the
- * caller of this function. */
-void kbdUSBRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
-{
- GETPRIV;
- struct input_event raw;
-
- while (read(priv->fd, &raw, sizeof(raw)) > 0) {
-#if USB_KEYBOARD_DEBUG
- LOG3("KBD: type = %d, code = 0x%02x, value = %d\n",
- raw.type, raw.code, raw.value);
-#endif
- kbdUSBConvert(pDev, raw.code, raw.value, enqueue, checkspecial, block);
- }
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int kbdUSBOn(DevicePtr pDev)
-{
- GETPRIV;
-
- if (priv->fd < 0) kbdUSBInit(pDev);
- return priv->fd;
-}
-
-static void kbdUSBGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KeySym *k, *mapCopy;
- int i;
-
- mapCopy = malloc(sizeof(map));
- memcpy(mapCopy, map, sizeof(map));
-
- /* compute the modifier map */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = mapCopy, i = MIN_KEYCODE;
- i < NUM_KEYCODES + MIN_KEYCODE;
- i++, k += 4) {
- switch(*k) {
- case XK_Shift_L:
- case XK_Shift_R: pModMap[i] = ShiftMask; break;
- case XK_Control_L:
- case XK_Control_R: pModMap[i] = ControlMask; break;
- case XK_Caps_Lock: pModMap[i] = LockMask; break;
- case XK_Alt_L:
- case XK_Alt_R: pModMap[i] = AltMask; break;
- case XK_Num_Lock: pModMap[i] = NumLockMask; break;
- case XK_Scroll_Lock: pModMap[i] = ScrollLockMask; break;
- case XK_Kana_Lock:
- case XK_Kana_Shift: pModMap[i] = KanaMask; break;
- case XK_Mode_switch: pModMap[i] = AltLangMask; break;
- }
- }
-
- pKeySyms->map = mapCopy; /* Must be XFree'able */
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
-
-/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- info->keyboard = 1;
- info->keyClass = 1;
- kbdUSBGetMap(pDev, &info->keySyms, info->modMap);
- info->focusClass = 1;
- info->kbdFeedbackClass = 1;
- info->names.keycodes = strdup("powerpcps2");
- info->force = 1;
-}
+/* Portions of this file were derived from the following files:
+ *
+ **********************************************************************
+ *
+ * xfree86/common/xf86KbdLnx.c
+ *
+ * Linux version of keymapping setup. The kernel (since 0.99.14) has support
+ * for fully remapping the keyboard, but there are some differences between
+ * the Linux map and the SVR4 map (esp. in the extended keycodes). We also
+ * remove the restriction on what keycodes can be remapped.
+ * Orest Zborowski.
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a USB keyboard
+ * under Linux. The keymap description is derived from code by Thomas
+ * Roell, Orest Zborowski. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "atKeynames.h"
+#include "usb-private.h"
+
+#define USB_KEYBOARD_DEBUG 0
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "usb-keyboard.h"
+#include <xkbsrv.h>
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+#define GLYPHS_PER_KEY 4
+#define NUM_KEYCODES 248
+#define MIN_KEYCODE 8
+#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
+
+static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
+/* Table modified from xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h */
+ /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
+ /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol,
+ /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol,
+ /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol,
+ /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol,
+ /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol,
+ /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol,
+ /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol,
+ /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol,
+ /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol,
+ /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
+ /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
+ /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x0f */ XK_Tab, XK_ISO_Left_Tab, NoSymbol, NoSymbol,
+ /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol,
+ /* 0x1b */ XK_bracketright, XK_braceright, NoSymbol, NoSymbol,
+ /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol,
+ /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol,
+ /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol,
+ /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
+ /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol,
+ /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol,
+ /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol,
+ /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
+ /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol,
+ /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol,
+ /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
+ /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
+ /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol,
+ /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
+ /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
+ /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol,
+ /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol,
+ /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol,
+ /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol,
+ /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
+ /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x60 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x61 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x62 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x63 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x64 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
+ /* 0x65 */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x66 */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x67 */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x68 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x69 */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6a */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6b */ XK_End, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6c */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6d */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6e */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6f */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x77 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7a */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7d */ XK_Super_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7e */ XK_Super_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7f */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
+};
+
+static int
+kbdUSBKeyDown(myPrivate * priv, int keyCode)
+{
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
+
+ if (byte > NUM_STATE_ENTRIES)
+ return 0;
+ return priv->kbdState[byte] & bit;
+}
+
+static void
+kbdUSBKeyState(myPrivate * priv, int type, int keyCode)
+{
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
+
+ if (byte > NUM_STATE_ENTRIES)
+ return;
+ if (type == KeyPress)
+ priv->kbdState[byte] |= bit;
+ else
+ priv->kbdState[byte] &= ~bit;
+}
+
+/** Set the LEDs. */
+void
+kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl)
+{
+ GETPRIV;
+ struct timeval tv;
+ struct input_event event;
+ int i, led;
+
+ gettimeofday(&tv, NULL);
+ for (i = 0; i < 5; i++) {
+ event.time.tv_sec = tv.tv_sec;
+ event.time.tv_usec = tv.tv_usec;
+ event.type = EV_LED;
+ if (i == 0)
+ led = 1; /* LED_CAPSL == 0x01 */
+ else if (i == 1)
+ led = 0; /* LED_NUML == 0x00 */
+ else
+ led = i;
+ event.code = led;
+ event.value = ! !(ctrl->leds & (1 << led));
+ write(priv->fd, &event, sizeof(event));
+ }
+}
+
+/** Initialize \a pDev using #usbInit. */
+void
+kbdUSBInit(DevicePtr pDev)
+{
+ usbInit(pDev, usbKeyboard);
+}
+
+static void
+kbdUSBConvert(DevicePtr pDev,
+ unsigned int scanCode,
+ int value,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
+{
+ GETPRIV;
+ XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo;
+ int type;
+ int keyCode;
+ KeySym keySym = NoSymbol;
+ int switching;
+
+ /* Set up xEvent information */
+ type = value ? KeyPress : KeyRelease;
+ keyCode = (scanCode & 0xff) + MIN_KEYCODE;
+
+ /* Handle repeats */
+
+ if (keyCode >= xkbi->desc->min_key_code &&
+ keyCode <= xkbi->desc->max_key_code) {
+
+ int effectiveGroup = XkbGetEffectiveGroup(xkbi,
+ &xkbi->state,
+ scanCode);
+
+ keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup);
+#if 0
+ switch (keySym) {
+ case XK_Num_Lock:
+ case XK_Scroll_Lock:
+ case XK_Shift_Lock:
+ case XK_Caps_Lock:
+ /* Ignore releases and all but first press */
+ if (kbdLinuxModIgnore(priv, &xE, keySym))
+ return;
+ if (kbdLinuxKeyDown(priv, &xE))
+ xE.u.u.type = KeyRelease;
+ else
+ xE.u.u.type = KeyPress;
+ break;
+ }
+#endif
+
+ /* If key is already down, ignore or autorepeat */
+ if (type == KeyPress && kbdUSBKeyDown(priv, keyCode)) {
+ KbdFeedbackClassRec *feed = priv->pDevice->kbdfeed;
+
+ /* No auto-repeat? */
+ if ((feed && !feed->ctrl.autoRepeat)
+ || priv->pDevice->key->xkbInfo->desc->map->modmap[keyCode]
+ || (feed && !(feed->ctrl.autoRepeats[keyCode >> 3]
+ & (1 << (keyCode & 7)))))
+ return; /* Ignore */
+
+ /* Do auto-repeat */
+ enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block);
+ type = KeyPress;
+ }
+
+ /* If key is already up, ignore */
+ if (type == KeyRelease && !kbdUSBKeyDown(priv, keyCode))
+ return;
+ }
+
+ switching = 0;
+ if (checkspecial && type == KeyPress)
+ switching = checkspecial(pDev, keySym);
+ if (!switching) {
+ if (enqueue)
+ enqueue(pDev, type, keyCode, keySym, NULL, block);
+ kbdUSBKeyState(priv, type, keyCode); /* Update our state bitmap */
+ }
+}
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, check for
+ * special keys with the \a checkspecial function and enqueue the event
+ * with the \a enqueue function. The \a block type is passed to the
+ * functions so that they may block SIGIO handling as appropriate to the
+ * caller of this function. */
+void
+kbdUSBRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
+{
+ GETPRIV;
+ struct input_event raw;
+
+ while (read(priv->fd, &raw, sizeof(raw)) > 0) {
+#if USB_KEYBOARD_DEBUG
+ LOG3("KBD: type = %d, code = 0x%02x, value = %d\n",
+ raw.type, raw.code, raw.value);
+#endif
+ kbdUSBConvert(pDev, raw.code, raw.value, enqueue, checkspecial, block);
+ }
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+kbdUSBOn(DevicePtr pDev)
+{
+ GETPRIV;
+
+ if (priv->fd < 0)
+ kbdUSBInit(pDev);
+ return priv->fd;
+}
+
+static void
+kbdUSBGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ KeySym *k, *mapCopy;
+ int i;
+
+ mapCopy = malloc(sizeof(map));
+ memcpy(mapCopy, map, sizeof(map));
+
+ /* compute the modifier map */
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+
+ for (k = mapCopy, i = MIN_KEYCODE;
+ i < NUM_KEYCODES + MIN_KEYCODE; i++, k += 4) {
+ switch (*k) {
+ case XK_Shift_L:
+ case XK_Shift_R:
+ pModMap[i] = ShiftMask;
+ break;
+ case XK_Control_L:
+ case XK_Control_R:
+ pModMap[i] = ControlMask;
+ break;
+ case XK_Caps_Lock:
+ pModMap[i] = LockMask;
+ break;
+ case XK_Alt_L:
+ case XK_Alt_R:
+ pModMap[i] = AltMask;
+ break;
+ case XK_Num_Lock:
+ pModMap[i] = NumLockMask;
+ break;
+ case XK_Scroll_Lock:
+ pModMap[i] = ScrollLockMask;
+ break;
+ case XK_Kana_Lock:
+ case XK_Kana_Shift:
+ pModMap[i] = KanaMask;
+ break;
+ case XK_Mode_switch:
+ pModMap[i] = AltLangMask;
+ break;
+ }
+ }
+
+ pKeySyms->map = mapCopy; /* Must be XFree'able */
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->minKeyCode = MIN_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void
+kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->keyboard = 1;
+ info->keyClass = 1;
+ kbdUSBGetMap(pDev, &info->keySyms, info->modMap);
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+ info->names.keycodes = strdup("powerpcps2");
+ info->force = 1;
+}
diff --git a/xorg-server/hw/dmx/input/usb-keyboard.h b/xorg-server/hw/dmx/input/usb-keyboard.h
index 1f9614eef..e14cca1c2 100644
--- a/xorg-server/hw/dmx/input/usb-keyboard.h
+++ b/xorg-server/hw/dmx/input/usb-keyboard.h
@@ -36,13 +36,12 @@
#ifndef _USB_KEYBOARD_H_
#define _USB_KEYBOARD_H_
-extern void kbdUSBInit(DevicePtr pDev);
-extern void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
-extern int kbdUSBOn(DevicePtr pDev);
-extern void kbdUSBRead(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- dmxCheckSpecialProcPtr checkspecial,
- DMXBlockType block);
-extern void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl *ctrl);
+extern void kbdUSBInit(DevicePtr pDev);
+extern void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int kbdUSBOn(DevicePtr pDev);
+extern void kbdUSBRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial, DMXBlockType block);
+extern void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl);
#endif
diff --git a/xorg-server/hw/dmx/input/usb-mouse.c b/xorg-server/hw/dmx/input/usb-mouse.c
index efa9d00ec..644342ee3 100644
--- a/xorg-server/hw/dmx/input/usb-mouse.c
+++ b/xorg-server/hw/dmx/input/usb-mouse.c
@@ -66,61 +66,68 @@
/*****************************************************************************/
/** Read the USB device using #usbRead. */
-void mouUSBRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
+void
+mouUSBRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
{
usbRead(pDev, motion, enqueue, BTN_MISC, block);
}
/** Initialize \a pDev using #usbInit. */
-void mouUSBInit(DevicePtr pDev)
+void
+mouUSBInit(DevicePtr pDev)
{
usbInit(pDev, usbMouse);
}
/** Turn \a pDev on (i.e., take input from \a pDev). */
-int mouUSBOn(DevicePtr pDev)
+int
+mouUSBOn(DevicePtr pDev)
{
GETPRIV;
- if (priv->fd < 0) mouUSBInit(pDev);
+ if (priv->fd < 0)
+ mouUSBInit(pDev);
return priv->fd;
}
-static void mouUSBGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+static void
+mouUSBGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
{
int i;
-
- if (nButtons) *nButtons = 5;
- if (map) for (i = 0; i <= *nButtons; i++) map[i] = i;
+
+ if (nButtons)
+ *nButtons = 5;
+ if (map)
+ for (i = 0; i <= *nButtons; i++)
+ map[i] = i;
}
/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+ * pDev. */
+void
+mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{
static KeySym keyboard_mapping = NoSymbol;
- info->buttonClass = 1;
+ info->buttonClass = 1;
mouUSBGetMap(pDev, info->map, &info->numButtons);
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->maxval[0] = 0;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
- info->ptrFeedbackClass = 1;
-
- /* Some USB mice devices return key
- * events from their pair'd
- * keyboard... */
- info->keyClass = 1;
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+
+ /* Some USB mice devices return key
+ * events from their pair'd
+ * keyboard... */
+ info->keyClass = 1;
info->keySyms.minKeyCode = 8;
info->keySyms.maxKeyCode = 8;
- info->keySyms.mapWidth = 1;
- info->keySyms.map = &keyboard_mapping;
+ info->keySyms.mapWidth = 1;
+ info->keySyms.map = &keyboard_mapping;
}
diff --git a/xorg-server/hw/dmx/input/usb-mouse.h b/xorg-server/hw/dmx/input/usb-mouse.h
index 918bf6481..91f6fcf86 100644
--- a/xorg-server/hw/dmx/input/usb-mouse.h
+++ b/xorg-server/hw/dmx/input/usb-mouse.h
@@ -36,13 +36,12 @@
#ifndef _USB_MOU_H_
#define _USB_MOU_H_
-extern void mouUSBRead(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- dmxCheckSpecialProcPtr checkspecial,
- DMXBlockType block);
-extern void mouUSBInit(DevicePtr pDev);
-extern void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
-extern int mouUSBOn(DevicePtr pDev);
-extern void mouUSBCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+extern void mouUSBRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial, DMXBlockType block);
+extern void mouUSBInit(DevicePtr pDev);
+extern void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int mouUSBOn(DevicePtr pDev);
+extern void mouUSBCtrl(DevicePtr pDev, PtrCtrl * ctrl);
#endif
diff --git a/xorg-server/hw/dmx/input/usb-other.c b/xorg-server/hw/dmx/input/usb-other.c
index d1074b8e1..f24f259c1 100644
--- a/xorg-server/hw/dmx/input/usb-other.c
+++ b/xorg-server/hw/dmx/input/usb-other.c
@@ -68,92 +68,97 @@
/*****************************************************************************/
/** Read the USB device using #usbRead. */
-void othUSBRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
+void
+othUSBRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
{
usbRead(pDev, motion, enqueue, 0xffff, block);
}
/** Initialize \a pDev using #usbInit. */
-void othUSBInit(DevicePtr pDev)
+void
+othUSBInit(DevicePtr pDev)
{
usbInit(pDev, usbOther);
}
/** Turn \a pDev on (i.e., take input from \a pDev). */
-int othUSBOn(DevicePtr pDev)
+int
+othUSBOn(DevicePtr pDev)
{
GETPRIV;
- if (priv->fd < 0) othUSBInit(pDev);
+ if (priv->fd < 0)
+ othUSBInit(pDev);
return priv->fd;
}
/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+ * pDev. */
+void
+othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{
GETPRIV;
- int i, j;
+ int i, j;
static KeySym keyboard_mapping = NoSymbol;
- int absolute[5];
-
+ int absolute[5];
+
#define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8)))
- /* Some USB mice devices return key
- * events from their pair'd
- * keyboard... */
- info->keyClass = 1;
+ /* Some USB mice devices return key
+ * events from their pair'd
+ * keyboard... */
+ info->keyClass = 1;
info->keySyms.minKeyCode = 8;
info->keySyms.maxKeyCode = 8;
- info->keySyms.mapWidth = 1;
- info->keySyms.map = &keyboard_mapping;
+ info->keySyms.mapWidth = 1;
+ info->keySyms.map = &keyboard_mapping;
for (i = 0; i < EV_MAX; i++) {
if (test_bit(i)) {
switch (i) {
case EV_KEY:
- /* See above */
+ /* See above */
break;
case EV_REL:
- info->valuatorClass = 1;
+ info->valuatorClass = 1;
if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) {
- info->numRelAxes = DMX_MAX_AXES - info->numAbsAxes - 1;
+ info->numRelAxes = DMX_MAX_AXES - info->numAbsAxes - 1;
dmxLog(dmxWarning, "Can only use %d relative axes\n",
info->numRelAxes);
- } else
- info->numRelAxes = priv->numRel;
- info->minval[0] = 0;
- info->maxval[0] = 0;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
+ }
+ else
+ info->numRelAxes = priv->numRel;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
break;
case EV_ABS:
- info->valuatorClass = 1;
+ info->valuatorClass = 1;
if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) {
- info->numAbsAxes = DMX_MAX_AXES - info->numRelAxes - 1;
+ info->numAbsAxes = DMX_MAX_AXES - info->numRelAxes - 1;
dmxLog(dmxWarning, "Can only use %d absolute axes\n",
info->numAbsAxes);
- } else
- info->numAbsAxes = priv->numAbs;
+ }
+ else
+ info->numAbsAxes = priv->numAbs;
for (j = 0; j < info->numAbsAxes; j++) {
ioctl(priv->fd, EVIOCGABS(j), absolute);
- info->minval[1+j] = absolute[1];
- info->maxval[1+j] = absolute[2];
- info->res[1+j] = absolute[3];
- info->minres[1+j] = absolute[3];
- info->maxres[1+j] = absolute[3];
+ info->minval[1 + j] = absolute[1];
+ info->maxval[1 + j] = absolute[2];
+ info->res[1 + j] = absolute[3];
+ info->minres[1 + j] = absolute[3];
+ info->maxres[1 + j] = absolute[3];
}
break;
case EV_LED:
- info->ledFeedbackClass = 0; /* Not supported at this time */
+ info->ledFeedbackClass = 0; /* Not supported at this time */
break;
case EV_SND:
- info->belFeedbackClass = 0; /* Not supported at this time */
+ info->belFeedbackClass = 0; /* Not supported at this time */
break;
}
}
diff --git a/xorg-server/hw/dmx/input/usb-other.h b/xorg-server/hw/dmx/input/usb-other.h
index b69e65933..89939a0a2 100644
--- a/xorg-server/hw/dmx/input/usb-other.h
+++ b/xorg-server/hw/dmx/input/usb-other.h
@@ -36,13 +36,12 @@
#ifndef _USB_OTHER_H_
#define _USB_OTHER_H_
-extern void othUSBRead(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- dmxCheckSpecialProcPtr checkspecial,
- DMXBlockType block);
-extern void othUSBInit(DevicePtr pDev);
-extern void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
-extern int othUSBOn(DevicePtr pDev);
-extern void othUSBCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+extern void othUSBRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial, DMXBlockType block);
+extern void othUSBInit(DevicePtr pDev);
+extern void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int othUSBOn(DevicePtr pDev);
+extern void othUSBCtrl(DevicePtr pDev, PtrCtrl * ctrl);
#endif
diff --git a/xorg-server/hw/kdrive/ephyr/XF86dri.c b/xorg-server/hw/kdrive/ephyr/XF86dri.c
index 247580e0a..74bf67678 100644
--- a/xorg-server/hw/kdrive/ephyr/XF86dri.c
+++ b/xorg-server/hw/kdrive/ephyr/XF86dri.c
@@ -1,628 +1,647 @@
-/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Jens Owen <jens@tungstengraphics.com>
- * Rickard E. (Rik) Faith <faith@valinux.com>
- *
- */
-
-/*
- * This file has been copied from the mesa source tree and a little bit
- * modified by:
- *
- * Dodji Seketeli <dodji@openedhand.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-/*
- * including some server headers (like kdrive-config.h)
- * might define the macro _XSERVER64
- * on 64 bits machines. That macro must _NOT_ be defined for Xlib
- * client code, otherwise bad things happen.
- * So let's undef that macro if necessary.
- */
-#ifdef _XSERVER64
-#undef _XSERVER64
-#endif
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <GL/glx.h>
-#include "xf86dri.h"
-#include <X11/dri/xf86driproto.h>
-
-static XExtensionInfo _xf86dri_info_data;
-static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
-static char xf86dri_extension_name[] = XF86DRINAME;
-
-#define XF86DRICheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xf86dri_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display *dpy, XExtCodes *extCodes);
-static /* const */ XExtensionHooks xf86dri_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86dri_info,
- xf86dri_extension_name,
- &xf86dri_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86dri_info)
-
-
-/*****************************************************************************
- * *
- * public XFree86-DRI Extension routines *
- * *
- *****************************************************************************/
-
-#if 0
-#include <stdio.h>
-#define TRACE(msg) fprintf(stderr,"XF86DRI%s\n", msg);
-#else
-#define TRACE(msg)
-#endif
-
-Bool XF86DRIOpenFullScreen(Display *dpy, int screen, Drawable drawable);
-Bool XF86DRICloseFullScreen(Display *dpy, int screen, Drawable drawable);
-
-Bool XF86DRIQueryExtension (Display *dpy, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- TRACE("QueryExtension...");
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- TRACE("QueryExtension... return True");
- return True;
- } else {
- TRACE("QueryExtension... return False");
- return False;
- }
-}
-
-Bool XF86DRIQueryVersion(Display *dpy, int *majorVersion, int *minorVersion,
- int *patchVersion)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIQueryVersionReply rep;
- xXF86DRIQueryVersionReq *req;
-
- TRACE("QueryVersion...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryVersion... return False");
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- *patchVersion = rep.patchVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryVersion... return True");
- return True;
-}
-
-Bool
-XF86DRIQueryDirectRenderingCapable (Display *dpy, int screen, Bool *isCapable)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIQueryDirectRenderingCapableReply rep;
- xXF86DRIQueryDirectRenderingCapableReq *req;
-
- TRACE("QueryDirectRenderingCapable...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIQueryDirectRenderingCapable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryDirectRenderingCapable... return False");
- return False;
- }
- *isCapable = rep.isCapable;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryDirectRenderingCapable... return True");
- return True;
-}
-
-Bool
-XF86DRIOpenConnection (Display *dpy, int screen,
- drm_handle_t *hSAREA,
- char **busIdString)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIOpenConnectionReply rep;
- xXF86DRIOpenConnectionReq *req;
-
- TRACE("OpenConnection...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIOpenConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIOpenConnection;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return False");
- return False;
- }
-
- *hSAREA = rep.hSAREALow;
- if (sizeof(drm_handle_t) == 8) {
- int shift = 32; /* var to prevent warning on next line */
- *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
- }
-
- if (rep.length) {
- if (!(*busIdString = (char *)calloc(rep.busIdStringLength + 1, 1))) {
- _XEatData(dpy, ((rep.busIdStringLength+3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return False");
- return False;
- }
- _XReadPad(dpy, *busIdString, rep.busIdStringLength);
- } else {
- *busIdString = NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return True");
- return True;
-}
-
-Bool XF86DRIAuthConnection(Display *dpy, int screen, drm_magic_t magic)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIAuthConnectionReq *req;
- xXF86DRIAuthConnectionReply rep;
-
- TRACE("AuthConnection...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIAuthConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIAuthConnection;
- req->screen = screen;
- req->magic = magic;
- rep.authenticated = 0;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.authenticated) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("AuthConnection... return False");
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("AuthConnection... return True");
- return True;
-}
-
-Bool XF86DRICloseConnection(Display *dpy, int screen)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRICloseConnectionReq *req;
-
- TRACE("CloseConnection...");
-
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICloseConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICloseConnection;
- req->screen = screen;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CloseConnection... return True");
- return True;
-}
-
-Bool XF86DRIGetClientDriverName(Display *dpy, int screen,
- int *ddxDriverMajorVersion,
- int *ddxDriverMinorVersion,
- int *ddxDriverPatchVersion,
- char **clientDriverName)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIGetClientDriverNameReply rep;
- xXF86DRIGetClientDriverNameReq *req;
-
- TRACE("GetClientDriverName...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetClientDriverName, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetClientDriverName;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return False");
- return False;
- }
-
- *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
- *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
- *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
-
- if (rep.length) {
- if (!(*clientDriverName = (char *)calloc(rep.clientDriverNameLength + 1, 1))) {
- _XEatData(dpy, ((rep.clientDriverNameLength+3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return False");
- return False;
- }
- _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
- } else {
- *clientDriverName = NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return True");
- return True;
-}
-
-Bool XF86DRICreateContextWithConfig(Display *dpy, int screen, int configID,
- XID *context, drm_context_t *hHWContext)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRICreateContextReply rep;
- xXF86DRICreateContextReq *req;
-
- TRACE("CreateContext...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICreateContext, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICreateContext;
- req->visual = configID;
- req->screen = screen;
- *context = XAllocID(dpy);
- req->context = *context;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateContext... return False");
- return False;
- }
- *hHWContext = rep.hHWContext;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateContext... return True");
- return True;
-}
-
-Bool XF86DRICreateContext(Display *dpy, int screen, Visual *visual,
- XID *context, drm_context_t *hHWContext)
-{
- return XF86DRICreateContextWithConfig( dpy, screen, visual->visualid,
- context, hHWContext );
-}
-
-GLboolean XF86DRIDestroyContext( Display *dpy, int screen, XID context)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIDestroyContextReq *req;
-
- TRACE("DestroyContext...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIDestroyContext, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIDestroyContext;
- req->screen = screen;
- req->context = context;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("DestroyContext... return True");
- return True;
-}
-
-GLboolean
-XF86DRICreateDrawable (Display *dpy, int screen,
- XID drawable, drm_drawable_t * hHWDrawable)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRICreateDrawableReply rep;
- xXF86DRICreateDrawableReq *req;
-
- TRACE("CreateDrawable...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICreateDrawable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICreateDrawable;
- req->screen = screen;
- req->drawable = drawable;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateDrawable... return False");
- return False;
- }
- *hHWDrawable = rep.hHWDrawable;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateDrawable... return True");
- return True;
-}
-
-static int noopErrorHandler(Display *dpy, XErrorEvent *xerr)
-{
- return 0;
-}
-
-GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
- XID drawable )
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIDestroyDrawableReq *req;
- int (*oldXErrorHandler)(Display *, XErrorEvent *);
-
- TRACE("DestroyDrawable...");
- XF86DRICheckExtension (dpy, info, False);
-
- /* This is called from the DRI driver, which used call it like this
- *
- * if (windowExists(drawable))
- * destroyDrawable(drawable);
- *
- * which is a textbook race condition - the window may disappear
- * from the server between checking for its existance and
- * destroying it. Instead we change the semantics of
- * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
- * the windows is gone, by wrapping the destroy call in an error
- * handler. */
-
- XSync(dpy, GL_FALSE);
- oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
-
- LockDisplay(dpy);
- GetReq(XF86DRIDestroyDrawable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIDestroyDrawable;
- req->screen = screen;
- req->drawable = drawable;
- UnlockDisplay(dpy);
- SyncHandle();
-
- XSetErrorHandler(oldXErrorHandler);
-
- TRACE("DestroyDrawable... return True");
- return True;
-}
-
-Bool XF86DRIGetDrawableInfo(Display* dpy, int screen, Drawable drawable,
- unsigned int* index, unsigned int* stamp,
- int* X, int* Y, int* W, int* H,
- int* numClipRects, drm_clip_rect_t ** pClipRects,
- int* backX, int* backY,
- int* numBackClipRects, drm_clip_rect_t ** pBackClipRects )
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIGetDrawableInfoReply rep;
- xXF86DRIGetDrawableInfoReq *req=NULL;
- int total_rects;
-
- TRACE("GetDrawableInfo...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetDrawableInfo, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetDrawableInfo;
- req->screen = screen;
- req->drawable = drawable;
-
- if (!_XReply(dpy, (xReply *)&rep, 1, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return False");
- return False;
- }
- *index = rep.drawableTableIndex;
- *stamp = rep.drawableTableStamp;
- *X = (int)rep.drawableX;
- *Y = (int)rep.drawableY;
- *W = (int)rep.drawableWidth;
- *H = (int)rep.drawableHeight;
- *numClipRects = rep.numClipRects;
- total_rects = *numClipRects;
-
- *backX = rep.backX;
- *backY = rep.backY;
- *numBackClipRects = rep.numBackClipRects;
- total_rects += *numBackClipRects;
-
-#if 0
- /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
- * backwards compatibility (Because of the >> 2 shift) but the fix
- * enables multi-threaded apps to work.
- */
- if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
- SIZEOF(xGenericReply) +
- total_rects * sizeof(drm_clip_rect_t)) + 3) & ~3) >> 2)) {
- _XEatData(dpy, rep.length);
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return False");
- return False;
- }
-#endif
-
- if (*numClipRects) {
- int len = sizeof(drm_clip_rect_t) * (*numClipRects);
-
- *pClipRects = (drm_clip_rect_t *)calloc(len, 1);
- if (*pClipRects)
- _XRead(dpy, (char*)*pClipRects, len);
- } else {
- *pClipRects = NULL;
- }
-
- if (*numBackClipRects) {
- int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
-
- *pBackClipRects = (drm_clip_rect_t *)calloc(len, 1);
- if (*pBackClipRects)
- _XRead(dpy, (char*)*pBackClipRects, len);
- } else {
- *pBackClipRects = NULL;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return True");
- return True;
-}
-
-Bool
-XF86DRIGetDeviceInfo (Display *dpy, int screen, drm_handle_t *hFrameBuffer,
- int *fbOrigin, int *fbSize, int *fbStride,
- int *devPrivateSize, void **pDevPrivate)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIGetDeviceInfoReply rep;
- xXF86DRIGetDeviceInfoReq *req;
-
- TRACE("GetDeviceInfo...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetDeviceInfo, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetDeviceInfo;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return False");
- return False;
- }
-
- *hFrameBuffer = rep.hFrameBufferLow;
- if (sizeof(drm_handle_t) == 8) {
- int shift = 32; /* var to prevent warning on next line */
- *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
- }
-
- *fbOrigin = rep.framebufferOrigin;
- *fbSize = rep.framebufferSize;
- *fbStride = rep.framebufferStride;
- *devPrivateSize = rep.devPrivateSize;
-
- if (rep.length) {
- if (!(*pDevPrivate = (void *)calloc(rep.devPrivateSize, 1))) {
- _XEatData(dpy, ((rep.devPrivateSize+3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return False");
- return False;
- }
- _XRead(dpy, (char*)*pDevPrivate, rep.devPrivateSize);
- } else {
- *pDevPrivate = NULL;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return True");
- return True;
-}
-
-Bool
-XF86DRIOpenFullScreen(Display *dpy, int screen, Drawable drawable)
-{
- /* This function and the underlying X protocol are deprecated.
- */
- (void) dpy;
- (void) screen;
- (void) drawable;
- return False;
-}
-
-Bool
-XF86DRICloseFullScreen(Display *dpy, int screen, Drawable drawable)
-{
- /* This function and the underlying X protocol are deprecated.
- */
- (void) dpy;
- (void) screen;
- (void) drawable;
- return True;
-}
+/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@tungstengraphics.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+/*
+ * This file has been copied from the mesa source tree and a little bit
+ * modified by:
+ *
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+/*
+ * including some server headers (like kdrive-config.h)
+ * might define the macro _XSERVER64
+ * on 64 bits machines. That macro must _NOT_ be defined for Xlib
+ * client code, otherwise bad things happen.
+ * So let's undef that macro if necessary.
+ */
+#ifdef _XSERVER64
+#undef _XSERVER64
+#endif
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <GL/glx.h>
+#include "xf86dri.h"
+#include <X11/dri/xf86driproto.h>
+
+static XExtensionInfo _xf86dri_info_data;
+static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
+static char xf86dri_extension_name[] = XF86DRINAME;
+
+#define XF86DRICheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, xf86dri_extension_name, val)
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+static int close_display(Display * dpy, XExtCodes * extCodes);
+
+static /* const */ XExtensionHooks xf86dri_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL, /* error_string */
+};
+
+static
+XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info,
+ xf86dri_extension_name,
+ &xf86dri_extension_hooks, 0, NULL)
+
+static
+XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info)
+
+/*****************************************************************************
+ * *
+ * public XFree86-DRI Extension routines *
+ * *
+ *****************************************************************************/
+#if 0
+#include <stdio.h>
+#define TRACE(msg) fprintf(stderr,"XF86DRI%s\n", msg);
+#else
+#define TRACE(msg)
+#endif
+Bool
+XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable);
+Bool
+XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable);
+
+Bool
+XF86DRIQueryExtension(Display * dpy, int *event_basep, int *error_basep)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+
+ TRACE("QueryExtension...");
+ if (XextHasExtension(info)) {
+ *event_basep = info->codes->first_event;
+ *error_basep = info->codes->first_error;
+ TRACE("QueryExtension... return True");
+ return True;
+ }
+ else {
+ TRACE("QueryExtension... return False");
+ return False;
+ }
+}
+
+Bool
+XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
+ int *patchVersion)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIQueryVersionReply rep;
+ xXF86DRIQueryVersionReq *req;
+
+ TRACE("QueryVersion...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIQueryVersion;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryVersion... return False");
+ return False;
+ }
+ *majorVersion = rep.majorVersion;
+ *minorVersion = rep.minorVersion;
+ *patchVersion = rep.patchVersion;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryVersion... return True");
+ return True;
+}
+
+Bool
+XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen, Bool *isCapable)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIQueryDirectRenderingCapableReply rep;
+ xXF86DRIQueryDirectRenderingCapableReq *req;
+
+ TRACE("QueryDirectRenderingCapable...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIQueryDirectRenderingCapable, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryDirectRenderingCapable... return False");
+ return False;
+ }
+ *isCapable = rep.isCapable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryDirectRenderingCapable... return True");
+ return True;
+}
+
+Bool
+XF86DRIOpenConnection(Display * dpy, int screen,
+ drm_handle_t * hSAREA, char **busIdString)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIOpenConnectionReply rep;
+ xXF86DRIOpenConnectionReq *req;
+
+ TRACE("OpenConnection...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIOpenConnection, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIOpenConnection;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("OpenConnection... return False");
+ return False;
+ }
+
+ *hSAREA = rep.hSAREALow;
+ if (sizeof(drm_handle_t) == 8) {
+ int shift = 32; /* var to prevent warning on next line */
+
+ *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
+ }
+
+ if (rep.length) {
+ if (!(*busIdString = (char *) calloc(rep.busIdStringLength + 1, 1))) {
+ _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("OpenConnection... return False");
+ return False;
+ }
+ _XReadPad(dpy, *busIdString, rep.busIdStringLength);
+ }
+ else {
+ *busIdString = NULL;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("OpenConnection... return True");
+ return True;
+}
+
+Bool
+XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIAuthConnectionReq *req;
+ xXF86DRIAuthConnectionReply rep;
+
+ TRACE("AuthConnection...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIAuthConnection, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIAuthConnection;
+ req->screen = screen;
+ req->magic = magic;
+ rep.authenticated = 0;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("AuthConnection... return False");
+ return False;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("AuthConnection... return True");
+ return True;
+}
+
+Bool
+XF86DRICloseConnection(Display * dpy, int screen)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRICloseConnectionReq *req;
+
+ TRACE("CloseConnection...");
+
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRICloseConnection, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRICloseConnection;
+ req->screen = screen;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CloseConnection... return True");
+ return True;
+}
+
+Bool
+XF86DRIGetClientDriverName(Display * dpy, int screen,
+ int *ddxDriverMajorVersion,
+ int *ddxDriverMinorVersion,
+ int *ddxDriverPatchVersion, char **clientDriverName)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIGetClientDriverNameReply rep;
+ xXF86DRIGetClientDriverNameReq *req;
+
+ TRACE("GetClientDriverName...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIGetClientDriverName, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIGetClientDriverName;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetClientDriverName... return False");
+ return False;
+ }
+
+ *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
+ *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
+ *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
+
+ if (rep.length) {
+ if (!
+ (*clientDriverName =
+ (char *) calloc(rep.clientDriverNameLength + 1, 1))) {
+ _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetClientDriverName... return False");
+ return False;
+ }
+ _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
+ }
+ else {
+ *clientDriverName = NULL;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetClientDriverName... return True");
+ return True;
+}
+
+Bool
+XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
+ XID *context, drm_context_t * hHWContext)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRICreateContextReply rep;
+ xXF86DRICreateContextReq *req;
+
+ TRACE("CreateContext...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRICreateContext, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRICreateContext;
+ req->visual = configID;
+ req->screen = screen;
+ *context = XAllocID(dpy);
+ req->context = *context;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateContext... return False");
+ return False;
+ }
+ *hHWContext = rep.hHWContext;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateContext... return True");
+ return True;
+}
+
+Bool
+XF86DRICreateContext(Display * dpy, int screen, Visual * visual,
+ XID *context, drm_context_t * hHWContext)
+{
+ return XF86DRICreateContextWithConfig(dpy, screen, visual->visualid,
+ context, hHWContext);
+}
+
+GLboolean
+XF86DRIDestroyContext(Display * dpy, int screen, XID context)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIDestroyContextReq *req;
+
+ TRACE("DestroyContext...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIDestroyContext, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIDestroyContext;
+ req->screen = screen;
+ req->context = context;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("DestroyContext... return True");
+ return True;
+}
+
+GLboolean
+XF86DRICreateDrawable(Display * dpy, int screen,
+ XID drawable, drm_drawable_t * hHWDrawable)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRICreateDrawableReply rep;
+ xXF86DRICreateDrawableReq *req;
+
+ TRACE("CreateDrawable...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRICreateDrawable, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRICreateDrawable;
+ req->screen = screen;
+ req->drawable = drawable;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateDrawable... return False");
+ return False;
+ }
+ *hHWDrawable = rep.hHWDrawable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateDrawable... return True");
+ return True;
+}
+
+static int
+noopErrorHandler(Display * dpy, XErrorEvent * xerr)
+{
+ return 0;
+}
+
+GLboolean
+XF86DRIDestroyDrawable(Display * dpy, int screen, XID drawable)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIDestroyDrawableReq *req;
+ int (*oldXErrorHandler) (Display *, XErrorEvent *);
+
+ TRACE("DestroyDrawable...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ /* This is called from the DRI driver, which used call it like this
+ *
+ * if (windowExists(drawable))
+ * destroyDrawable(drawable);
+ *
+ * which is a textbook race condition - the window may disappear
+ * from the server between checking for its existance and
+ * destroying it. Instead we change the semantics of
+ * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
+ * the windows is gone, by wrapping the destroy call in an error
+ * handler. */
+
+ XSync(dpy, GL_FALSE);
+ oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIDestroyDrawable, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIDestroyDrawable;
+ req->screen = screen;
+ req->drawable = drawable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ XSetErrorHandler(oldXErrorHandler);
+
+ TRACE("DestroyDrawable... return True");
+ return True;
+}
+
+Bool
+XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
+ unsigned int *index, unsigned int *stamp,
+ int *X, int *Y, int *W, int *H,
+ int *numClipRects, drm_clip_rect_t ** pClipRects,
+ int *backX, int *backY,
+ int *numBackClipRects, drm_clip_rect_t ** pBackClipRects)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIGetDrawableInfoReply rep;
+ xXF86DRIGetDrawableInfoReq *req = NULL;
+ int total_rects;
+
+ TRACE("GetDrawableInfo...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIGetDrawableInfo, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIGetDrawableInfo;
+ req->screen = screen;
+ req->drawable = drawable;
+
+ if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDrawableInfo... return False");
+ return False;
+ }
+ *index = rep.drawableTableIndex;
+ *stamp = rep.drawableTableStamp;
+ *X = (int) rep.drawableX;
+ *Y = (int) rep.drawableY;
+ *W = (int) rep.drawableWidth;
+ *H = (int) rep.drawableHeight;
+ *numClipRects = rep.numClipRects;
+ total_rects = *numClipRects;
+
+ *backX = rep.backX;
+ *backY = rep.backY;
+ *numBackClipRects = rep.numBackClipRects;
+ total_rects += *numBackClipRects;
+
+#if 0
+ /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
+ * backwards compatibility (Because of the >> 2 shift) but the fix
+ * enables multi-threaded apps to work.
+ */
+ if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
+ SIZEOF(xGenericReply) +
+ total_rects * sizeof(drm_clip_rect_t)) +
+ 3) & ~3) >> 2)) {
+ _XEatData(dpy, rep.length);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDrawableInfo... return False");
+ return False;
+ }
+#endif
+
+ if (*numClipRects) {
+ int len = sizeof(drm_clip_rect_t) * (*numClipRects);
+
+ *pClipRects = (drm_clip_rect_t *) calloc(len, 1);
+ if (*pClipRects)
+ _XRead(dpy, (char *) *pClipRects, len);
+ }
+ else {
+ *pClipRects = NULL;
+ }
+
+ if (*numBackClipRects) {
+ int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
+
+ *pBackClipRects = (drm_clip_rect_t *) calloc(len, 1);
+ if (*pBackClipRects)
+ _XRead(dpy, (char *) *pBackClipRects, len);
+ }
+ else {
+ *pBackClipRects = NULL;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDrawableInfo... return True");
+ return True;
+}
+
+Bool
+XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer,
+ int *fbOrigin, int *fbSize, int *fbStride,
+ int *devPrivateSize, void **pDevPrivate)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIGetDeviceInfoReply rep;
+ xXF86DRIGetDeviceInfoReq *req;
+
+ TRACE("GetDeviceInfo...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIGetDeviceInfo, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIGetDeviceInfo;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDeviceInfo... return False");
+ return False;
+ }
+
+ *hFrameBuffer = rep.hFrameBufferLow;
+ if (sizeof(drm_handle_t) == 8) {
+ int shift = 32; /* var to prevent warning on next line */
+
+ *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
+ }
+
+ *fbOrigin = rep.framebufferOrigin;
+ *fbSize = rep.framebufferSize;
+ *fbStride = rep.framebufferStride;
+ *devPrivateSize = rep.devPrivateSize;
+
+ if (rep.length) {
+ if (!(*pDevPrivate = (void *) calloc(rep.devPrivateSize, 1))) {
+ _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDeviceInfo... return False");
+ return False;
+ }
+ _XRead(dpy, (char *) *pDevPrivate, rep.devPrivateSize);
+ }
+ else {
+ *pDevPrivate = NULL;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDeviceInfo... return True");
+ return True;
+}
+
+Bool
+XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable)
+{
+ /* This function and the underlying X protocol are deprecated.
+ */
+ (void) dpy;
+ (void) screen;
+ (void) drawable;
+ return False;
+}
+
+Bool
+XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable)
+{
+ /* This function and the underlying X protocol are deprecated.
+ */
+ (void) dpy;
+ (void) screen;
+ (void) drawable;
+ return True;
+}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c
index 9cbb4b0ef..cfb1be811 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.c
@@ -36,11 +36,12 @@
#include "ephyrdri.h"
#include "ephyrdriext.h"
#include "ephyrglxext.h"
-#endif /* XF86DRI */
+#endif /* XF86DRI */
#include "xkbsrv.h"
extern int KdTsPhyScreen;
+
#ifdef GLXEXT
extern Bool noGlxVisualInit;
#endif
@@ -48,182 +49,165 @@ extern Bool noGlxVisualInit;
KdKeyboardInfo *ephyrKbd;
KdPointerInfo *ephyrMouse;
EphyrKeySyms ephyrKeySyms;
-Bool ephyrNoDRI=FALSE ;
-Bool ephyrNoXV=FALSE ;
+Bool ephyrNoDRI = FALSE;
+Bool ephyrNoXV = FALSE;
static int mouseState = 0;
static Rotation ephyrRandr = RR_Rotate_0;
typedef struct _EphyrInputPrivate {
- Bool enabled;
+ Bool enabled;
} EphyrKbdPrivate, EphyrPointerPrivate;
-Bool EphyrWantGrayScale = 0;
-
+Bool EphyrWantGrayScale = 0;
Bool
-ephyrInitialize (KdCardInfo *card, EphyrPriv *priv)
+ephyrInitialize(KdCardInfo * card, EphyrPriv * priv)
{
#ifdef _MSC_VER
__asm int 3;
#else
- OsSignal(SIGUSR1, hostx_handle_signal);
+ OsSignal(SIGUSR1, hostx_handle_signal);
#endif
- priv->base = 0;
- priv->bytes_per_line = 0;
- return TRUE;
+ priv->base = 0;
+ priv->bytes_per_line = 0;
+ return TRUE;
}
Bool
-ephyrCardInit (KdCardInfo *card)
+ephyrCardInit(KdCardInfo * card)
{
- EphyrPriv *priv;
-
- priv = (EphyrPriv *) malloc(sizeof (EphyrPriv));
- if (!priv)
- return FALSE;
-
- if (!ephyrInitialize (card, priv))
- {
- free(priv);
- return FALSE;
+ EphyrPriv *priv;
+
+ priv = (EphyrPriv *) malloc(sizeof(EphyrPriv));
+ if (!priv)
+ return FALSE;
+
+ if (!ephyrInitialize(card, priv)) {
+ free(priv);
+ return FALSE;
}
- card->driver = priv;
-
- return TRUE;
+ card->driver = priv;
+
+ return TRUE;
}
Bool
-ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
+ephyrScreenInitialize(KdScreenInfo * screen, EphyrScrPriv * scrpriv)
{
- int width = 640, height = 480;
- CARD32 redMask, greenMask, blueMask;
-
- if (hostx_want_screen_size(screen, &width, &height)
- || !screen->width || !screen->height)
- {
- screen->width = width;
- screen->height = height;
+ int width = 640, height = 480;
+ CARD32 redMask, greenMask, blueMask;
+
+ if (hostx_want_screen_size(screen, &width, &height)
+ || !screen->width || !screen->height) {
+ screen->width = width;
+ screen->height = height;
}
- if (EphyrWantGrayScale)
- screen->fb.depth = 8;
-
- if (screen->fb.depth && screen->fb.depth != hostx_get_depth())
- {
- if (screen->fb.depth < hostx_get_depth()
- && (screen->fb.depth == 24 || screen->fb.depth == 16
- || screen->fb.depth == 8))
- {
- hostx_set_server_depth(screen, screen->fb.depth);
- }
- else
- ErrorF("\nXephyr: requested screen depth not supported, setting to match hosts.\n");
+ if (EphyrWantGrayScale)
+ screen->fb.depth = 8;
+
+ if (screen->fb.depth && screen->fb.depth != hostx_get_depth()) {
+ if (screen->fb.depth < hostx_get_depth()
+ && (screen->fb.depth == 24 || screen->fb.depth == 16
+ || screen->fb.depth == 8)) {
+ hostx_set_server_depth(screen, screen->fb.depth);
+ }
+ else
+ ErrorF
+ ("\nXephyr: requested screen depth not supported, setting to match hosts.\n");
}
-
- screen->fb.depth = hostx_get_server_depth(screen);
- screen->rate = 72;
-
- if (screen->fb.depth <= 8)
- {
- if (EphyrWantGrayScale)
- screen->fb.visuals = ((1 << StaticGray) | (1 << GrayScale));
- else
- screen->fb.visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
-
- screen->fb.redMask = 0x00;
- screen->fb.greenMask = 0x00;
- screen->fb.blueMask = 0x00;
- screen->fb.depth = 8;
- screen->fb.bitsPerPixel = 8;
+
+ screen->fb.depth = hostx_get_server_depth(screen);
+ screen->rate = 72;
+
+ if (screen->fb.depth <= 8) {
+ if (EphyrWantGrayScale)
+ screen->fb.visuals = ((1 << StaticGray) | (1 << GrayScale));
+ else
+ screen->fb.visuals = ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) | (1 << DirectColor));
+
+ screen->fb.redMask = 0x00;
+ screen->fb.greenMask = 0x00;
+ screen->fb.blueMask = 0x00;
+ screen->fb.depth = 8;
+ screen->fb.bitsPerPixel = 8;
}
- else
- {
- screen->fb.visuals = (1 << TrueColor);
-
- if (screen->fb.depth <= 15)
- {
- screen->fb.depth = 15;
- screen->fb.bitsPerPixel = 16;
- }
- else if (screen->fb.depth <= 16)
- {
- screen->fb.depth = 16;
- screen->fb.bitsPerPixel = 16;
- }
- else if (screen->fb.depth <= 24)
- {
- screen->fb.depth = 24;
- screen->fb.bitsPerPixel = 32;
- }
- else if (screen->fb.depth <= 30)
- {
- screen->fb.depth = 30;
- screen->fb.bitsPerPixel = 32;
- }
- else
- {
- ErrorF("\nXephyr: Unsupported screen depth %d\n",
- screen->fb.depth);
- return FALSE;
- }
-
- hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask);
-
- screen->fb.redMask = (Pixel) redMask;
- screen->fb.greenMask = (Pixel) greenMask;
- screen->fb.blueMask = (Pixel) blueMask;
+ else {
+ screen->fb.visuals = (1 << TrueColor);
+
+ if (screen->fb.depth <= 15) {
+ screen->fb.depth = 15;
+ screen->fb.bitsPerPixel = 16;
+ }
+ else if (screen->fb.depth <= 16) {
+ screen->fb.depth = 16;
+ screen->fb.bitsPerPixel = 16;
+ }
+ else if (screen->fb.depth <= 24) {
+ screen->fb.depth = 24;
+ screen->fb.bitsPerPixel = 32;
+ }
+ else if (screen->fb.depth <= 30) {
+ screen->fb.depth = 30;
+ screen->fb.bitsPerPixel = 32;
+ }
+ else {
+ ErrorF("\nXephyr: Unsupported screen depth %d\n", screen->fb.depth);
+ return FALSE;
+ }
+
+ hostx_get_visual_masks(screen, &redMask, &greenMask, &blueMask);
+
+ screen->fb.redMask = (Pixel) redMask;
+ screen->fb.greenMask = (Pixel) greenMask;
+ screen->fb.blueMask = (Pixel) blueMask;
}
-
- scrpriv->randr = screen->randr;
- return ephyrMapFramebuffer (screen);
+ scrpriv->randr = screen->randr;
+
+ return ephyrMapFramebuffer(screen);
}
Bool
-ephyrScreenInit (KdScreenInfo *screen)
+ephyrScreenInit(KdScreenInfo * screen)
{
- EphyrScrPriv *scrpriv;
-
- scrpriv = calloc(1, sizeof (EphyrScrPriv));
+ EphyrScrPriv *scrpriv;
- if (!scrpriv)
- return FALSE;
+ scrpriv = calloc(1, sizeof(EphyrScrPriv));
+
+ if (!scrpriv)
+ return FALSE;
- screen->driver = scrpriv;
+ screen->driver = scrpriv;
- if (!ephyrScreenInitialize (screen, scrpriv))
- {
- screen->driver = 0;
- free(scrpriv);
- return FALSE;
+ if (!ephyrScreenInitialize(screen, scrpriv)) {
+ screen->driver = 0;
+ free(scrpriv);
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
-
-void*
-ephyrWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure)
+
+void *
+ephyrWindowLinear(ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset, int mode, CARD32 *size, void *closure)
{
- KdScreenPriv(pScreen);
- EphyrPriv *priv = pScreenPriv->card->driver;
-
- if (!pScreenPriv->enabled)
- return 0;
-
- *size = priv->bytes_per_line;
- return priv->base + row * priv->bytes_per_line + offset;
+ KdScreenPriv(pScreen);
+ EphyrPriv *priv = pScreenPriv->card->driver;
+
+ if (!pScreenPriv->enabled)
+ return 0;
+
+ *size = priv->bytes_per_line;
+ return priv->base + row * priv->bytes_per_line + offset;
}
/**
@@ -231,529 +215,509 @@ ephyrWindowLinear (ScreenPtr pScreen,
* buffer so that fakexa has space to put offscreen pixmaps.
*/
int
-ephyrBufferHeight(KdScreenInfo *screen)
+ephyrBufferHeight(KdScreenInfo * screen)
{
int buffer_height;
+
if (ephyrFuncs.initAccel == NULL)
- buffer_height = screen->height;
+ buffer_height = screen->height;
else
- buffer_height = 3 * screen->height;
+ buffer_height = 3 * screen->height;
return buffer_height;
}
-
Bool
-ephyrMapFramebuffer (KdScreenInfo *screen)
+ephyrMapFramebuffer(KdScreenInfo * screen)
{
- EphyrScrPriv *scrpriv = screen->driver;
- EphyrPriv *priv = screen->card->driver;
- KdPointerMatrix m;
- int buffer_height;
-
- EPHYR_LOG("screen->width: %d, screen->height: %d index=%d",
- screen->width, screen->height, screen->mynum);
-
- /*
- * Use the rotation last applied to ourselves (in the Xephyr case the fb
- * coordinate system moves independently of the pointer coordiante system).
- */
- KdComputePointerMatrix (&m, ephyrRandr, screen->width, screen->height);
- KdSetPointerMatrix (&m);
-
- priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
-
- buffer_height = ephyrBufferHeight(screen);
-
- priv->base = hostx_screen_init (screen, screen->width, screen->height, buffer_height);
-
- if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All))
- {
- scrpriv->shadow = FALSE;
-
- screen->fb.byteStride = priv->bytes_per_line;
- screen->fb.pixelStride = screen->width;
- screen->fb.frameBuffer = (CARD8 *) (priv->base);
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrPriv *priv = screen->card->driver;
+ KdPointerMatrix m;
+ int buffer_height;
+
+ EPHYR_LOG("screen->width: %d, screen->height: %d index=%d",
+ screen->width, screen->height, screen->mynum);
+
+ /*
+ * Use the rotation last applied to ourselves (in the Xephyr case the fb
+ * coordinate system moves independently of the pointer coordiante system).
+ */
+ KdComputePointerMatrix(&m, ephyrRandr, screen->width, screen->height);
+ KdSetPointerMatrix(&m);
+
+ priv->bytes_per_line =
+ ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
+
+ buffer_height = ephyrBufferHeight(screen);
+
+ priv->base =
+ hostx_screen_init(screen, screen->width, screen->height, buffer_height);
+
+ if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All)) {
+ scrpriv->shadow = FALSE;
+
+ screen->fb.byteStride = priv->bytes_per_line;
+ screen->fb.pixelStride = screen->width;
+ screen->fb.frameBuffer = (CARD8 *) (priv->base);
}
- else
- {
- /* Rotated/Reflected so we need to use shadow fb */
- scrpriv->shadow = TRUE;
-
- EPHYR_LOG("allocing shadow");
-
- KdShadowFbAlloc (screen,
- scrpriv->randr & (RR_Rotate_90|RR_Rotate_270));
+ else {
+ /* Rotated/Reflected so we need to use shadow fb */
+ scrpriv->shadow = TRUE;
+
+ EPHYR_LOG("allocing shadow");
+
+ KdShadowFbAlloc(screen,
+ scrpriv->randr & (RR_Rotate_90 | RR_Rotate_270));
}
-
- return TRUE;
+
+ return TRUE;
}
void
-ephyrSetScreenSizes (ScreenPtr pScreen)
+ephyrSetScreenSizes(ScreenPtr pScreen)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- EphyrScrPriv *scrpriv = screen->driver;
-
- if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- pScreen->width = screen->width;
- pScreen->height = screen->height;
- pScreen->mmWidth = screen->width_mm;
- pScreen->mmHeight = screen->height_mm;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+
+ if (scrpriv->randr & (RR_Rotate_0 | RR_Rotate_180)) {
+ pScreen->width = screen->width;
+ pScreen->height = screen->height;
+ pScreen->mmWidth = screen->width_mm;
+ pScreen->mmHeight = screen->height_mm;
}
- else
- {
- pScreen->width = screen->height;
- pScreen->height = screen->width;
- pScreen->mmWidth = screen->height_mm;
- pScreen->mmHeight = screen->width_mm;
+ else {
+ pScreen->width = screen->height;
+ pScreen->height = screen->width;
+ pScreen->mmWidth = screen->height_mm;
+ pScreen->mmHeight = screen->width_mm;
}
}
Bool
-ephyrUnmapFramebuffer (KdScreenInfo *screen)
+ephyrUnmapFramebuffer(KdScreenInfo * screen)
{
- EphyrScrPriv *scrpriv = screen->driver;
-
- if (scrpriv->shadow)
- KdShadowFbFree (screen);
-
- /* Note, priv->base will get freed when XImage recreated */
-
- return TRUE;
+ EphyrScrPriv *scrpriv = screen->driver;
+
+ if (scrpriv->shadow)
+ KdShadowFbFree(screen);
+
+ /* Note, priv->base will get freed when XImage recreated */
+
+ return TRUE;
}
-void
-ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
+void
+ephyrShadowUpdate(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
-
- EPHYR_LOG("slow paint");
-
- /* FIXME: Slow Rotated/Reflected updates could be much
- * much faster efficiently updating via tranforming
- * pBuf->pDamage regions
- */
- shadowUpdateRotatePacked(pScreen, pBuf);
- hostx_paint_rect(screen, 0,0,0,0, screen->width, screen->height);
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+
+ EPHYR_LOG("slow paint");
+
+ /* FIXME: Slow Rotated/Reflected updates could be much
+ * much faster efficiently updating via tranforming
+ * pBuf->pDamage regions
+ */
+ shadowUpdateRotatePacked(pScreen, pBuf);
+ hostx_paint_rect(screen, 0, 0, 0, 0, screen->width, screen->height);
}
static void
-ephyrInternalDamageRedisplay (ScreenPtr pScreen)
+ephyrInternalDamageRedisplay(ScreenPtr pScreen)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- EphyrScrPriv *scrpriv = screen->driver;
- RegionPtr pRegion;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ RegionPtr pRegion;
- if (!scrpriv || !scrpriv->pDamage)
- return;
+ if (!scrpriv || !scrpriv->pDamage)
+ return;
- pRegion = DamageRegion (scrpriv->pDamage);
+ pRegion = DamageRegion(scrpriv->pDamage);
- if (RegionNotEmpty(pRegion))
- {
- int nbox;
- BoxPtr pbox;
+ if (RegionNotEmpty(pRegion)) {
+ int nbox;
+ BoxPtr pbox;
- nbox = RegionNumRects (pRegion);
- pbox = RegionRects (pRegion);
+ nbox = RegionNumRects(pRegion);
+ pbox = RegionRects(pRegion);
- while (nbox--)
- {
- hostx_paint_rect(screen,
- pbox->x1, pbox->y1,
- pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- pbox++;
+ while (nbox--) {
+ hostx_paint_rect(screen,
+ pbox->x1, pbox->y1,
+ pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ pbox++;
}
- DamageEmpty (scrpriv->pDamage);
+ DamageEmpty(scrpriv->pDamage);
}
}
static void
-ephyrInternalDamageBlockHandler (pointer data,
- OSTimePtr pTimeout,
- pointer pRead)
+ephyrInternalDamageBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead)
{
- ScreenPtr pScreen = (ScreenPtr) data;
-
- ephyrInternalDamageRedisplay (pScreen);
+ ScreenPtr pScreen = (ScreenPtr) data;
+
+ ephyrInternalDamageRedisplay(pScreen);
}
static void
-ephyrInternalDamageWakeupHandler (pointer data, int i, pointer LastSelectMask)
+ephyrInternalDamageWakeupHandler(pointer data, int i, pointer LastSelectMask)
{
- /* FIXME: Not needed ? */
+ /* FIXME: Not needed ? */
}
Bool
-ephyrSetInternalDamage (ScreenPtr pScreen)
+ephyrSetInternalDamage(ScreenPtr pScreen)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- EphyrScrPriv *scrpriv = screen->driver;
- PixmapPtr pPixmap = NULL;
-
- scrpriv->pDamage = DamageCreate ((DamageReportFunc) 0,
- (DamageDestroyFunc) 0,
- DamageReportNone,
- TRUE,
- pScreen,
- pScreen);
-
- if (!RegisterBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler,
- ephyrInternalDamageWakeupHandler,
- (pointer) pScreen))
- return FALSE;
-
- pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
-
- DamageRegister (&pPixmap->drawable, scrpriv->pDamage);
-
- return TRUE;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ PixmapPtr pPixmap = NULL;
+
+ scrpriv->pDamage = DamageCreate((DamageReportFunc) 0,
+ (DamageDestroyFunc) 0,
+ DamageReportNone, TRUE, pScreen, pScreen);
+
+ if (!RegisterBlockAndWakeupHandlers(ephyrInternalDamageBlockHandler,
+ ephyrInternalDamageWakeupHandler,
+ (pointer) pScreen))
+ return FALSE;
+
+ pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+
+ DamageRegister(&pPixmap->drawable, scrpriv->pDamage);
+
+ return TRUE;
}
void
-ephyrUnsetInternalDamage (ScreenPtr pScreen)
+ephyrUnsetInternalDamage(ScreenPtr pScreen)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- EphyrScrPriv *scrpriv = screen->driver;
- PixmapPtr pPixmap = NULL;
-
- pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
- DamageUnregister (&pPixmap->drawable, scrpriv->pDamage);
- DamageDestroy (scrpriv->pDamage);
-
- RemoveBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler,
- ephyrInternalDamageWakeupHandler,
- (pointer) pScreen);
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ PixmapPtr pPixmap = NULL;
+
+ pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+ DamageUnregister(&pPixmap->drawable, scrpriv->pDamage);
+ DamageDestroy(scrpriv->pDamage);
+
+ RemoveBlockAndWakeupHandlers(ephyrInternalDamageBlockHandler,
+ ephyrInternalDamageWakeupHandler,
+ (pointer) pScreen);
}
#ifdef RANDR
Bool
-ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
+ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- EphyrScrPriv *scrpriv = screen->driver;
- RRScreenSizePtr pSize;
- Rotation randr;
- int n = 0;
-
- struct { int width, height; } sizes[] =
- {
- { 1600, 1200 },
- { 1400, 1050 },
- { 1280, 960 },
- { 1280, 1024 },
- { 1152, 864 },
- { 1024, 768 },
- { 832, 624 },
- { 800, 600 },
- { 720, 400 },
- { 480, 640 },
- { 640, 480 },
- { 640, 400 },
- { 320, 240 },
- { 240, 320 },
- { 160, 160 },
- { 0, 0 }
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ RRScreenSizePtr pSize;
+ Rotation randr;
+ int n = 0;
+
+ struct {
+ int width, height;
+ } sizes[] = {
+ {
+ 1600, 1200}, {
+ 1400, 1050}, {
+ 1280, 960}, {
+ 1280, 1024}, {
+ 1152, 864}, {
+ 1024, 768}, {
+ 832, 624}, {
+ 800, 600}, {
+ 720, 400}, {
+ 480, 640}, {
+ 640, 480}, {
+ 640, 400}, {
+ 320, 240}, {
+ 240, 320}, {
+ 160, 160}, {
+ 0, 0}
};
- EPHYR_LOG("mark");
-
- *rotations = RR_Rotate_All|RR_Reflect_All;
-
- if (!hostx_want_preexisting_window (screen)
- && !hostx_want_fullscreen ()) /* only if no -parent switch */
- {
- while (sizes[n].width != 0 && sizes[n].height != 0)
- {
- RRRegisterSize (pScreen,
- sizes[n].width,
- sizes[n].height,
- (sizes[n].width * screen->width_mm)/screen->width,
- (sizes[n].height *screen->height_mm)/screen->height
- );
- n++;
- }
+ EPHYR_LOG("mark");
+
+ *rotations = RR_Rotate_All | RR_Reflect_All;
+
+ if (!hostx_want_preexisting_window(screen)
+ && !hostx_want_fullscreen()) { /* only if no -parent switch */
+ while (sizes[n].width != 0 && sizes[n].height != 0) {
+ RRRegisterSize(pScreen,
+ sizes[n].width,
+ sizes[n].height,
+ (sizes[n].width * screen->width_mm) / screen->width,
+ (sizes[n].height * screen->height_mm) /
+ screen->height);
+ n++;
+ }
}
-
- pSize = RRRegisterSize (pScreen,
- screen->width,
- screen->height,
- screen->width_mm,
- screen->height_mm);
-
- randr = KdSubRotation (scrpriv->randr, screen->randr);
-
- RRSetCurrentConfig (pScreen, randr, 0, pSize);
-
- return TRUE;
+
+ pSize = RRRegisterSize(pScreen,
+ screen->width,
+ screen->height, screen->width_mm, screen->height_mm);
+
+ randr = KdSubRotation(scrpriv->randr, screen->randr);
+
+ RRSetCurrentConfig(pScreen, randr, 0, pSize);
+
+ return TRUE;
}
Bool
-ephyrRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize)
+ephyrRandRSetConfig(ScreenPtr pScreen,
+ Rotation randr, int rate, RRScreenSizePtr pSize)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- EphyrScrPriv *scrpriv = screen->driver;
- Bool wasEnabled = pScreenPriv->enabled;
- EphyrScrPriv oldscr;
- int oldwidth, oldheight, oldmmwidth, oldmmheight;
- Bool oldshadow;
- int newwidth, newheight;
-
- if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- newwidth = pSize->width;
- newheight = pSize->height;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ Bool wasEnabled = pScreenPriv->enabled;
+ EphyrScrPriv oldscr;
+ int oldwidth, oldheight, oldmmwidth, oldmmheight;
+ Bool oldshadow;
+ int newwidth, newheight;
+
+ if (screen->randr & (RR_Rotate_0 | RR_Rotate_180)) {
+ newwidth = pSize->width;
+ newheight = pSize->height;
}
- else
- {
- newwidth = pSize->height;
- newheight = pSize->width;
+ else {
+ newwidth = pSize->height;
+ newheight = pSize->width;
}
-
- if (wasEnabled)
- KdDisableScreen (pScreen);
-
- oldscr = *scrpriv;
-
- oldwidth = screen->width;
- oldheight = screen->height;
- oldmmwidth = pScreen->mmWidth;
- oldmmheight = pScreen->mmHeight;
- oldshadow = scrpriv->shadow;
-
- /*
- * Set new configuration
- */
-
- /*
- * We need to store the rotation value for pointer coords transformation;
- * though initially the pointer and fb rotation are identical, when we map
- * the fb, the screen will be reinitialized and return into an unrotated
- * state (presumably the HW is taking care of the rotation of the fb), but the
- * pointer still needs to be transformed.
- */
- ephyrRandr = KdAddRotation (screen->randr, randr);
- scrpriv->randr = ephyrRandr;
-
- ephyrUnmapFramebuffer (screen);
-
- screen->width = newwidth;
- screen->height = newheight;
-
- if (!ephyrMapFramebuffer (screen))
- goto bail4;
-
- /* FIXME below should go in own call */
-
- if (oldshadow)
- KdShadowUnset (screen->pScreen);
- else
- ephyrUnsetInternalDamage(screen->pScreen);
-
- if (scrpriv->shadow)
- {
- if (!KdShadowSet (screen->pScreen,
- scrpriv->randr,
- ephyrShadowUpdate,
- ephyrWindowLinear))
- goto bail4;
+
+ if (wasEnabled)
+ KdDisableScreen(pScreen);
+
+ oldscr = *scrpriv;
+
+ oldwidth = screen->width;
+ oldheight = screen->height;
+ oldmmwidth = pScreen->mmWidth;
+ oldmmheight = pScreen->mmHeight;
+ oldshadow = scrpriv->shadow;
+
+ /*
+ * Set new configuration
+ */
+
+ /*
+ * We need to store the rotation value for pointer coords transformation;
+ * though initially the pointer and fb rotation are identical, when we map
+ * the fb, the screen will be reinitialized and return into an unrotated
+ * state (presumably the HW is taking care of the rotation of the fb), but the
+ * pointer still needs to be transformed.
+ */
+ ephyrRandr = KdAddRotation(screen->randr, randr);
+ scrpriv->randr = ephyrRandr;
+
+ ephyrUnmapFramebuffer(screen);
+
+ screen->width = newwidth;
+ screen->height = newheight;
+
+ if (!ephyrMapFramebuffer(screen))
+ goto bail4;
+
+ /* FIXME below should go in own call */
+
+ if (oldshadow)
+ KdShadowUnset(screen->pScreen);
+ else
+ ephyrUnsetInternalDamage(screen->pScreen);
+
+ if (scrpriv->shadow) {
+ if (!KdShadowSet(screen->pScreen,
+ scrpriv->randr, ephyrShadowUpdate, ephyrWindowLinear))
+ goto bail4;
}
- else
- {
- /* Without shadow fb ( non rotated ) we need
- * to use damage to efficiently update display
- * via signal regions what to copy from 'fb'.
- */
- if (!ephyrSetInternalDamage(screen->pScreen))
- goto bail4;
+ else {
+ /* Without shadow fb ( non rotated ) we need
+ * to use damage to efficiently update display
+ * via signal regions what to copy from 'fb'.
+ */
+ if (!ephyrSetInternalDamage(screen->pScreen))
+ goto bail4;
}
-
- ephyrSetScreenSizes (screen->pScreen);
-
- /*
- * Set frame buffer mapping
- */
- (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
- pScreen->width,
- pScreen->height,
- screen->fb.depth,
- screen->fb.bitsPerPixel,
- screen->fb.byteStride,
- screen->fb.frameBuffer);
-
- /* set the subpixel order */
-
- KdSetSubpixelOrder (pScreen, scrpriv->randr);
-
- if (wasEnabled)
- KdEnableScreen (pScreen);
-
- return TRUE;
-
+
+ ephyrSetScreenSizes(screen->pScreen);
+
+ /*
+ * Set frame buffer mapping
+ */
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap(pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb.depth,
+ screen->fb.bitsPerPixel,
+ screen->fb.byteStride,
+ screen->fb.frameBuffer);
+
+ /* set the subpixel order */
+
+ KdSetSubpixelOrder(pScreen, scrpriv->randr);
+
+ if (wasEnabled)
+ KdEnableScreen(pScreen);
+
+ return TRUE;
+
bail4:
- EPHYR_LOG("bailed");
-
- ephyrUnmapFramebuffer (screen);
- *scrpriv = oldscr;
- (void) ephyrMapFramebuffer (screen);
-
- pScreen->width = oldwidth;
- pScreen->height = oldheight;
- pScreen->mmWidth = oldmmwidth;
- pScreen->mmHeight = oldmmheight;
-
- if (wasEnabled)
- KdEnableScreen (pScreen);
- return FALSE;
+ EPHYR_LOG("bailed");
+
+ ephyrUnmapFramebuffer(screen);
+ *scrpriv = oldscr;
+ (void) ephyrMapFramebuffer(screen);
+
+ pScreen->width = oldwidth;
+ pScreen->height = oldheight;
+ pScreen->mmWidth = oldmmwidth;
+ pScreen->mmHeight = oldmmheight;
+
+ if (wasEnabled)
+ KdEnableScreen(pScreen);
+ return FALSE;
}
Bool
-ephyrRandRInit (ScreenPtr pScreen)
+ephyrRandRInit(ScreenPtr pScreen)
{
- rrScrPrivPtr pScrPriv;
-
- if (!RRScreenInit (pScreen))
- return FALSE;
-
- pScrPriv = rrGetScrPriv(pScreen);
- pScrPriv->rrGetInfo = ephyrRandRGetInfo;
- pScrPriv->rrSetConfig = ephyrRandRSetConfig;
- return TRUE;
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit(pScreen))
+ return FALSE;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = ephyrRandRGetInfo;
+ pScrPriv->rrSetConfig = ephyrRandRSetConfig;
+ return TRUE;
}
#endif
Bool
-ephyrCreateColormap (ColormapPtr pmap)
+ephyrCreateColormap(ColormapPtr pmap)
{
- return fbInitializeColormap (pmap);
+ return fbInitializeColormap(pmap);
}
Bool
-ephyrInitScreen (ScreenPtr pScreen)
+ephyrInitScreen(ScreenPtr pScreen)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
- EPHYR_LOG ("pScreen->myNum:%d\n", pScreen->myNum) ;
- hostx_set_screen_number (screen, pScreen->myNum);
- hostx_set_win_title (screen, "(ctrl+shift grabs mouse and keyboard)") ;
- pScreen->CreateColormap = ephyrCreateColormap;
+ EPHYR_LOG("pScreen->myNum:%d\n", pScreen->myNum);
+ hostx_set_screen_number(screen, pScreen->myNum);
+ hostx_set_win_title(screen, "(ctrl+shift grabs mouse and keyboard)");
+ pScreen->CreateColormap = ephyrCreateColormap;
#ifdef XV
- if (!ephyrNoXV) {
- if (!ephyrInitVideo (pScreen)) {
- EPHYR_LOG_ERROR ("failed to initialize xvideo\n") ;
- } else {
- EPHYR_LOG ("initialized xvideo okay\n") ;
- }
- }
+ if (!ephyrNoXV) {
+ if (!ephyrInitVideo(pScreen)) {
+ EPHYR_LOG_ERROR("failed to initialize xvideo\n");
+ }
+ else {
+ EPHYR_LOG("initialized xvideo okay\n");
+ }
+ }
#endif /*XV*/
-
#ifdef XF86DRI
- if (!ephyrNoDRI && !hostx_has_dri ()) {
- EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ;
- ephyrNoDRI = TRUE ;
+ if (!ephyrNoDRI && !hostx_has_dri()) {
+ EPHYR_LOG("host x does not support DRI. Disabling DRI forwarding\n");
+ ephyrNoDRI = TRUE;
#ifdef GLXEXT
- noGlxVisualInit = FALSE ;
+ noGlxVisualInit = FALSE;
#endif
- }
- if (!ephyrNoDRI) {
- ephyrDRIExtensionInit (pScreen) ;
- ephyrHijackGLXExtension () ;
- }
+ }
+ if (!ephyrNoDRI) {
+ ephyrDRIExtensionInit(pScreen);
+ ephyrHijackGLXExtension();
+ }
#endif
#ifdef GLXEXT
- if (ephyrNoDRI) {
- noGlxVisualInit = FALSE ;
- }
+ if (ephyrNoDRI) {
+ noGlxVisualInit = FALSE;
+ }
#endif
- return TRUE;
+ return TRUE;
}
Bool
-ephyrFinishInitScreen (ScreenPtr pScreen)
+ephyrFinishInitScreen(ScreenPtr pScreen)
{
- /* FIXME: Calling this even if not using shadow.
- * Seems harmless enough. But may be safer elsewhere.
- */
- if (!shadowSetup (pScreen))
- return FALSE;
+ /* FIXME: Calling this even if not using shadow.
+ * Seems harmless enough. But may be safer elsewhere.
+ */
+ if (!shadowSetup(pScreen))
+ return FALSE;
#ifdef RANDR
- if (!ephyrRandRInit (pScreen))
- return FALSE;
+ if (!ephyrRandRInit(pScreen))
+ return FALSE;
#endif
- return TRUE;
+ return TRUE;
}
Bool
-ephyrCreateResources (ScreenPtr pScreen)
+ephyrCreateResources(ScreenPtr pScreen)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- EphyrScrPriv *scrpriv = screen->driver;
-
- EPHYR_LOG("mark pScreen=%p mynum=%d shadow=%d",
- pScreen, pScreen->myNum, scrpriv->shadow);
-
- if (scrpriv->shadow)
- return KdShadowSet (pScreen,
- scrpriv->randr,
- ephyrShadowUpdate,
- ephyrWindowLinear);
- else
- return ephyrSetInternalDamage(pScreen);
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+
+ EPHYR_LOG("mark pScreen=%p mynum=%d shadow=%d",
+ pScreen, pScreen->myNum, scrpriv->shadow);
+
+ if (scrpriv->shadow)
+ return KdShadowSet(pScreen,
+ scrpriv->randr,
+ ephyrShadowUpdate, ephyrWindowLinear);
+ else
+ return ephyrSetInternalDamage(pScreen);
}
void
-ephyrPreserve (KdCardInfo *card)
+ephyrPreserve(KdCardInfo * card)
{
}
Bool
-ephyrEnable (ScreenPtr pScreen)
+ephyrEnable(ScreenPtr pScreen)
{
- return TRUE;
+ return TRUE;
}
Bool
-ephyrDPMS (ScreenPtr pScreen, int mode)
+ephyrDPMS(ScreenPtr pScreen, int mode)
{
- return TRUE;
+ return TRUE;
}
void
-ephyrDisable (ScreenPtr pScreen)
+ephyrDisable(ScreenPtr pScreen)
{
}
void
-ephyrRestore (KdCardInfo *card)
+ephyrRestore(KdCardInfo * card)
{
}
void
-ephyrScreenFini (KdScreenInfo *screen)
+ephyrScreenFini(KdScreenInfo * screen)
{
- EphyrScrPriv *scrpriv = screen->driver;
+ EphyrScrPriv *scrpriv = screen->driver;
+
if (scrpriv->shadow) {
- KdShadowFbFree (screen);
+ KdShadowFbFree(screen);
}
free(screen->driver);
screen->driver = NULL;
@@ -767,107 +731,107 @@ void
ephyrUpdateModifierState(unsigned int state)
{
- DeviceIntPtr pDev = inputInfo.keyboard;
- KeyClassPtr keyc = pDev->key;
- int i;
- CARD8 mask;
- int xkb_state;
-
- if (!pDev)
- return;
+ DeviceIntPtr pDev = inputInfo.keyboard;
+ KeyClassPtr keyc = pDev->key;
+ int i;
+ CARD8 mask;
+ int xkb_state;
- xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state);
- state = state & 0xff;
+ if (!pDev)
+ return;
- if (xkb_state == state)
- return;
-
- for (i = 0, mask = 1; i < 8; i++, mask <<= 1) {
- int key;
+ xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state);
+ state = state & 0xff;
- /* Modifier is down, but shouldn't be
- */
- if ((xkb_state & mask) && !(state & mask)) {
- int count = keyc->modifierKeyCount[i];
+ if (xkb_state == state)
+ return;
- for (key = 0; key < MAP_LENGTH; key++)
- if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
- if (key_is_down(pDev, key, KEY_PROCESSED))
- KdEnqueueKeyboardEvent (ephyrKbd, key, TRUE);
+ for (i = 0, mask = 1; i < 8; i++, mask <<= 1) {
+ int key;
- if (--count == 0)
- break;
- }
- }
+ /* Modifier is down, but shouldn't be
+ */
+ if ((xkb_state & mask) && !(state & mask)) {
+ int count = keyc->modifierKeyCount[i];
- /* Modifier shoud be down, but isn't
- */
- if (!(xkb_state & mask) && (state & mask))
- for (key = 0; key < MAP_LENGTH; key++)
- if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
- KdEnqueueKeyboardEvent (ephyrKbd, key, FALSE);
- break;
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
+ if (key_is_down(pDev, key, KEY_PROCESSED))
+ KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE);
+
+ if (--count == 0)
+ break;
+ }
}
- }
+
+ /* Modifier shoud be down, but isn't
+ */
+ if (!(xkb_state & mask) && (state & mask))
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
+ KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE);
+ break;
+ }
+ }
}
static void
-ephyrBlockSigio (void)
+ephyrBlockSigio(void)
{
#ifdef _MSC_VER
__asm int 3;
#else
sigset_t set;
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_BLOCK, &set, 0);
+ sigemptyset(&set);
+ sigaddset(&set, SIGIO);
+ sigprocmask(SIG_BLOCK, &set, 0);
#endif
}
static void
-ephyrUnblockSigio (void)
+ephyrUnblockSigio(void)
{
#ifdef _MSC_VER
__asm int 3;
#else
sigset_t set;
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_UNBLOCK, &set, 0);
+ sigemptyset(&set);
+ sigaddset(&set, SIGIO);
+ sigprocmask(SIG_UNBLOCK, &set, 0);
#endif
}
static Bool
ephyrCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
{
- return FALSE;
+ return FALSE;
}
static void
-ephyrCrossScreen (ScreenPtr pScreen, Bool entering)
+ephyrCrossScreen(ScreenPtr pScreen, Bool entering)
{
}
-int ephyrCurScreen; /*current event screen*/
+int ephyrCurScreen; /*current event screen */
static void
-ephyrWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+ephyrWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
- ephyrBlockSigio ();
+ ephyrBlockSigio();
ephyrCurScreen = pScreen->myNum;
- miPointerWarpCursor (inputInfo.pointer, pScreen, x, y);
- ephyrUnblockSigio ();
+ miPointerWarpCursor(inputInfo.pointer, pScreen, x, y);
+
+ ephyrUnblockSigio();
}
-miPointerScreenFuncRec ephyrPointerScreenFuncs =
-{
- ephyrCursorOffScreen,
- ephyrCrossScreen,
- ephyrWarpCursor,
- NULL,
- NULL
+miPointerScreenFuncRec ephyrPointerScreenFuncs = {
+ ephyrCursorOffScreen,
+ ephyrCrossScreen,
+ ephyrWarpCursor,
+ NULL,
+ NULL
};
#ifdef XF86DRI
@@ -886,198 +850,192 @@ miPointerScreenFuncRec ephyrPointerScreenFuncs =
* expose events and send those events to clients.
*/
static void
-ephyrExposePairedWindow (int a_remote)
+ephyrExposePairedWindow(int a_remote)
{
EphyrWindowPair *pair = NULL;
RegionRec reg;
ScreenPtr screen;
- if (!findWindowPairFromRemote (a_remote, &pair)) {
- EPHYR_LOG ("did not find a pair for this window\n");
- return;
+ if (!findWindowPairFromRemote(a_remote, &pair)) {
+ EPHYR_LOG("did not find a pair for this window\n");
+ return;
}
screen = pair->local->drawable.pScreen;
RegionNull(&reg);
RegionCopy(&reg, &pair->local->clipList);
- screen->WindowExposures (pair->local, &reg, NullRegion);
+ screen->WindowExposures(pair->local, &reg, NullRegion);
RegionUninit(&reg);
}
-#endif /* XF86DRI */
+#endif /* XF86DRI */
void
ephyrPoll(void)
{
- EphyrHostXEvent ev;
+ EphyrHostXEvent ev;
- while (hostx_get_event(&ev))
- {
- switch (ev.type)
- {
+ while (hostx_get_event(&ev)) {
+ switch (ev.type) {
case EPHYR_EV_MOUSE_MOTION:
- if (!ephyrMouse ||
- !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) {
- EPHYR_LOG ("skipping mouse motion:%d\n", ephyrCurScreen) ;
- continue;
- }
- {
- if (ev.data.mouse_motion.screen >=0
- && (ephyrCurScreen != ev.data.mouse_motion.screen))
- {
- EPHYR_LOG ("warping mouse cursor. "
- "cur_screen%d, motion_screen:%d\n",
- ephyrCurScreen, ev.data.mouse_motion.screen) ;
- if (ev.data.mouse_motion.screen >= 0)
- {
- ephyrWarpCursor
- (inputInfo.pointer, screenInfo.screens[ev.data.mouse_motion.screen],
- ev.data.mouse_motion.x,
- ev.data.mouse_motion.y );
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) {
+ EPHYR_LOG("skipping mouse motion:%d\n", ephyrCurScreen);
+ continue;
+ }
+ {
+ if (ev.data.mouse_motion.screen >= 0
+ && (ephyrCurScreen != ev.data.mouse_motion.screen)) {
+ EPHYR_LOG("warping mouse cursor. "
+ "cur_screen%d, motion_screen:%d\n",
+ ephyrCurScreen, ev.data.mouse_motion.screen);
+ if (ev.data.mouse_motion.screen >= 0) {
+ ephyrWarpCursor
+ (inputInfo.pointer,
+ screenInfo.screens[ev.data.mouse_motion.screen],
+ ev.data.mouse_motion.x, ev.data.mouse_motion.y);
}
- }
- else
- {
- int x=0, y=0;
+ }
+ else {
+ int x = 0, y = 0;
+
#ifdef XF86DRI
- EphyrWindowPair *pair = NULL;
+ EphyrWindowPair *pair = NULL;
#endif
- EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
- x = ev.data.mouse_motion.x;
- y = ev.data.mouse_motion.y;
- EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ;
+ EPHYR_LOG("enqueuing mouse motion:%d\n", ephyrCurScreen);
+ x = ev.data.mouse_motion.x;
+ y = ev.data.mouse_motion.y;
+ EPHYR_LOG("initial (x,y):(%d,%d)\n", x, y);
#ifdef XF86DRI
- EPHYR_LOG ("is this window peered by a gl drawable ?\n") ;
- if (findWindowPairFromRemote (ev.data.mouse_motion.window,
- &pair))
- {
- EPHYR_LOG ("yes, it is peered\n") ;
+ EPHYR_LOG("is this window peered by a gl drawable ?\n");
+ if (findWindowPairFromRemote(ev.data.mouse_motion.window,
+ &pair)) {
+ EPHYR_LOG("yes, it is peered\n");
x += pair->local->drawable.x;
y += pair->local->drawable.y;
}
- else
- {
- EPHYR_LOG ("no, it is not peered\n") ;
+ else {
+ EPHYR_LOG("no, it is not peered\n");
}
- EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ;
+ EPHYR_LOG("final (x,y):(%d,%d)\n", x, y);
#endif
- KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0);
- }
- }
- break;
+ KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0);
+ }
+ }
+ break;
case EPHYR_EV_MOUSE_PRESS:
- if (!ephyrMouse ||
- !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) {
- EPHYR_LOG ("skipping mouse press:%d\n", ephyrCurScreen) ;
- continue;
- }
- EPHYR_LOG ("enqueuing mouse press:%d\n", ephyrCurScreen) ;
- ephyrUpdateModifierState(ev.key_state);
- mouseState |= ev.data.mouse_down.button_num;
- KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
- break;
-
- case EPHYR_EV_MOUSE_RELEASE:
- if (!ephyrMouse ||
- !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
- continue;
- ephyrUpdateModifierState(ev.key_state);
- mouseState &= ~ev.data.mouse_up.button_num;
- EPHYR_LOG ("enqueuing mouse release:%d\n", ephyrCurScreen) ;
- KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
- break;
-
- case EPHYR_EV_KEY_PRESS:
- if (!ephyrKbd ||
- !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
- continue;
- ephyrUpdateModifierState(ev.key_state);
- KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_down.scancode, FALSE);
- break;
-
- case EPHYR_EV_KEY_RELEASE:
- if (!ephyrKbd ||
- !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
- continue;
- ephyrUpdateModifierState(ev.key_state);
- KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
- break;
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) {
+ EPHYR_LOG("skipping mouse press:%d\n", ephyrCurScreen);
+ continue;
+ }
+ EPHYR_LOG("enqueuing mouse press:%d\n", ephyrCurScreen);
+ ephyrUpdateModifierState(ev.key_state);
+ mouseState |= ev.data.mouse_down.button_num;
+ KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0,
+ 0);
+ break;
+
+ case EPHYR_EV_MOUSE_RELEASE:
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled)
+ continue;
+ ephyrUpdateModifierState(ev.key_state);
+ mouseState &= ~ev.data.mouse_up.button_num;
+ EPHYR_LOG("enqueuing mouse release:%d\n", ephyrCurScreen);
+ KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0,
+ 0);
+ break;
+
+ case EPHYR_EV_KEY_PRESS:
+ if (!ephyrKbd ||
+ !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled)
+ continue;
+ ephyrUpdateModifierState(ev.key_state);
+ KdEnqueueKeyboardEvent(ephyrKbd, ev.data.key_down.scancode, FALSE);
+ break;
+
+ case EPHYR_EV_KEY_RELEASE:
+ if (!ephyrKbd ||
+ !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled)
+ continue;
+ ephyrUpdateModifierState(ev.key_state);
+ KdEnqueueKeyboardEvent(ephyrKbd, ev.data.key_up.scancode, TRUE);
+ break;
#ifdef XF86DRI
- case EPHYR_EV_EXPOSE:
- /*
- * We only receive expose events when the expose event have
- * be generated for a drawable that is a host X window managed
- * by Xephyr. Host X windows managed by Xephyr exists for instance
- * when Xephyr is asked to create a GL drawable in a DRI environment.
- */
- ephyrExposePairedWindow (ev.data.expose.window);
- break;
-#endif /* XF86DRI */
-
- default:
- break;
- }
+ case EPHYR_EV_EXPOSE:
+ /*
+ * We only receive expose events when the expose event have
+ * be generated for a drawable that is a host X window managed
+ * by Xephyr. Host X windows managed by Xephyr exists for instance
+ * when Xephyr is asked to create a GL drawable in a DRI environment.
+ */
+ ephyrExposePairedWindow(ev.data.expose.window);
+ break;
+#endif /* XF86DRI */
+
+ default:
+ break;
+ }
}
}
void
-ephyrCardFini (KdCardInfo *card)
+ephyrCardFini(KdCardInfo * card)
{
- EphyrPriv *priv = card->driver;
- free(priv);
+ EphyrPriv *priv = card->driver;
+
+ free(priv);
}
void
-ephyrGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
+ephyrGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
{
- /* XXX Not sure if this is right */
-
- EPHYR_LOG("mark");
-
- while (n--)
- {
- pdefs->red = 0;
- pdefs->green = 0;
- pdefs->blue = 0;
- pdefs++;
+ /* XXX Not sure if this is right */
+
+ EPHYR_LOG("mark");
+
+ while (n--) {
+ pdefs->red = 0;
+ pdefs->green = 0;
+ pdefs->blue = 0;
+ pdefs++;
}
}
void
-ephyrPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
+ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
{
- int min, max, p;
-
- /* XXX Not sure if this is right */
-
- min = 256;
- max = 0;
-
- while (n--)
- {
- p = pdefs->pixel;
- if (p < min)
- min = p;
- if (p > max)
- max = p;
-
- hostx_set_cmap_entry(p,
- pdefs->red >> 8,
- pdefs->green >> 8,
- pdefs->blue >> 8);
- pdefs++;
+ int min, max, p;
+
+ /* XXX Not sure if this is right */
+
+ min = 256;
+ max = 0;
+
+ while (n--) {
+ p = pdefs->pixel;
+ if (p < min)
+ min = p;
+ if (p > max)
+ max = p;
+
+ hostx_set_cmap_entry(p,
+ pdefs->red >> 8,
+ pdefs->green >> 8, pdefs->blue >> 8);
+ pdefs++;
}
}
/* Mouse calls */
static Status
-MouseInit (KdPointerInfo *pi)
+MouseInit(KdPointerInfo * pi)
{
pi->driverPrivate = (EphyrPointerPrivate *)
- calloc(sizeof(EphyrPointerPrivate), 1);
- ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
+ calloc(sizeof(EphyrPointerPrivate), 1);
+ ((EphyrPointerPrivate *) pi->driverPrivate)->enabled = FALSE;
pi->nAxes = 3;
pi->nButtons = 32;
free(pi->name);
@@ -1095,23 +1053,23 @@ MouseInit (KdPointerInfo *pi)
}
static Status
-MouseEnable (KdPointerInfo *pi)
+MouseEnable(KdPointerInfo * pi)
{
- ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE;
+ ((EphyrPointerPrivate *) pi->driverPrivate)->enabled = TRUE;
return Success;
}
static void
-MouseDisable (KdPointerInfo *pi)
+MouseDisable(KdPointerInfo * pi)
{
- ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
+ ((EphyrPointerPrivate *) pi->driverPrivate)->enabled = FALSE;
return;
}
static void
-MouseFini (KdPointerInfo *pi)
+MouseFini(KdPointerInfo * pi)
{
- ephyrMouse = NULL;
+ ephyrMouse = NULL;
return;
}
@@ -1127,55 +1085,54 @@ KdPointerDriver EphyrMouseDriver = {
/* Keyboard */
static Status
-EphyrKeyboardInit (KdKeyboardInfo *ki)
+EphyrKeyboardInit(KdKeyboardInfo * ki)
{
- ki->driverPrivate = (EphyrKbdPrivate *)
- calloc(sizeof(EphyrKbdPrivate), 1);
- hostx_load_keymap();
- if (!ephyrKeySyms.map) {
- ErrorF("Couldn't load keymap from host\n");
- return BadAlloc;
- }
- ki->minScanCode = ephyrKeySyms.minKeyCode;
- ki->maxScanCode = ephyrKeySyms.maxKeyCode;
- free(ki->name);
- ki->name = strdup("Xephyr virtual keyboard");
- ephyrKbd = ki;
- return Success;
+ ki->driverPrivate = (EphyrKbdPrivate *)
+ calloc(sizeof(EphyrKbdPrivate), 1);
+ hostx_load_keymap();
+ if (!ephyrKeySyms.map) {
+ ErrorF("Couldn't load keymap from host\n");
+ return BadAlloc;
+ }
+ ki->minScanCode = ephyrKeySyms.minKeyCode;
+ ki->maxScanCode = ephyrKeySyms.maxKeyCode;
+ free(ki->name);
+ ki->name = strdup("Xephyr virtual keyboard");
+ ephyrKbd = ki;
+ return Success;
}
static Status
-EphyrKeyboardEnable (KdKeyboardInfo *ki)
+EphyrKeyboardEnable(KdKeyboardInfo * ki)
{
- ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = TRUE;
+ ((EphyrKbdPrivate *) ki->driverPrivate)->enabled = TRUE;
return Success;
}
static void
-EphyrKeyboardDisable (KdKeyboardInfo *ki)
+EphyrKeyboardDisable(KdKeyboardInfo * ki)
{
- ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = FALSE;
+ ((EphyrKbdPrivate *) ki->driverPrivate)->enabled = FALSE;
}
static void
-EphyrKeyboardFini (KdKeyboardInfo *ki)
+EphyrKeyboardFini(KdKeyboardInfo * ki)
{
ephyrKbd = NULL;
return;
}
static void
-EphyrKeyboardLeds (KdKeyboardInfo *ki, int leds)
+EphyrKeyboardLeds(KdKeyboardInfo * ki, int leds)
{
}
static void
-EphyrKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
+EphyrKeyboardBell(KdKeyboardInfo * ki, int volume, int frequency, int duration)
{
}
-
KdKeyboardDriver EphyrKeyboardDriver = {
"ephyr",
EphyrKeyboardInit,
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.h b/xorg-server/hw/kdrive/ephyr/ephyr.h
index 73ebcfa5b..1e9b930c7 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.h
@@ -32,7 +32,7 @@
#endif
#include <signal.h>
-#include "os.h" /* for OsSignal() */
+#include "os.h" /* for OsSignal() */
#include "kdrive.h"
#include "hostx.h"
#include "exa.h"
@@ -44,8 +44,8 @@
#include "damage.h"
typedef struct _ephyrPriv {
- CARD8 *base;
- int bytes_per_line;
+ CARD8 *base;
+ int bytes_per_line;
} EphyrPriv;
typedef struct _ephyrFakexaPriv {
@@ -63,9 +63,9 @@ typedef struct _ephyrFakexaPriv {
} EphyrFakexaPriv;
typedef struct _ephyrScrPriv {
- Rotation randr;
- Bool shadow;
- DamagePtr pDamage;
+ Rotation randr;
+ Bool shadow;
+ DamagePtr pDamage;
EphyrFakexaPriv *fakexa;
} EphyrScrPriv;
@@ -76,132 +76,127 @@ extern KdPointerInfo *ephyrMouse;
extern miPointerScreenFuncRec ephyrPointerScreenFuncs;
Bool
-ephyrInitialize (KdCardInfo *card, EphyrPriv *priv);
+ ephyrInitialize(KdCardInfo * card, EphyrPriv * priv);
Bool
-ephyrCardInit (KdCardInfo *card);
+ ephyrCardInit(KdCardInfo * card);
Bool
-ephyrScreenInit (KdScreenInfo *screen);
+ ephyrScreenInit(KdScreenInfo * screen);
Bool
-ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv);
-
+ ephyrScreenInitialize(KdScreenInfo * screen, EphyrScrPriv * scrpriv);
+
Bool
-ephyrInitScreen (ScreenPtr pScreen);
+ ephyrInitScreen(ScreenPtr pScreen);
Bool
-ephyrFinishInitScreen (ScreenPtr pScreen);
+ ephyrFinishInitScreen(ScreenPtr pScreen);
Bool
-ephyrCreateResources (ScreenPtr pScreen);
+ ephyrCreateResources(ScreenPtr pScreen);
void
-ephyrPreserve (KdCardInfo *card);
+ ephyrPreserve(KdCardInfo * card);
Bool
-ephyrEnable (ScreenPtr pScreen);
+ ephyrEnable(ScreenPtr pScreen);
Bool
-ephyrDPMS (ScreenPtr pScreen, int mode);
+ ephyrDPMS(ScreenPtr pScreen, int mode);
void
-ephyrDisable (ScreenPtr pScreen);
+ ephyrDisable(ScreenPtr pScreen);
void
-ephyrRestore (KdCardInfo *card);
+ ephyrRestore(KdCardInfo * card);
void
-ephyrScreenFini (KdScreenInfo *screen);
+ ephyrScreenFini(KdScreenInfo * screen);
void
-ephyrCardFini (KdCardInfo *card);
+ ephyrCardFini(KdCardInfo * card);
void
-ephyrGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
+ ephyrGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs);
void
-ephyrPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
+ ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs);
Bool
-ephyrMapFramebuffer (KdScreenInfo *screen);
+ ephyrMapFramebuffer(KdScreenInfo * screen);
-void *
-ephyrWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure);
+void *ephyrWindowLinear(ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset, int mode, CARD32 *size, void *closure);
void
-ephyrSetScreenSizes (ScreenPtr pScreen);
+ ephyrSetScreenSizes(ScreenPtr pScreen);
Bool
-ephyrUnmapFramebuffer (KdScreenInfo *screen);
+ ephyrUnmapFramebuffer(KdScreenInfo * screen);
void
-ephyrUnsetInternalDamage (ScreenPtr pScreen);
+ ephyrUnsetInternalDamage(ScreenPtr pScreen);
Bool
-ephyrSetInternalDamage (ScreenPtr pScreen);
+ ephyrSetInternalDamage(ScreenPtr pScreen);
Bool
-ephyrCreateColormap (ColormapPtr pmap);
+ ephyrCreateColormap(ColormapPtr pmap);
void
-ephyrPoll(void);
-
+ ephyrPoll(void);
+
#ifdef RANDR
Bool
-ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
+ ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations);
Bool
-ephyrRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize);
+
+ephyrRandRSetConfig(ScreenPtr pScreen,
+ Rotation randr, int rate, RRScreenSizePtr pSize);
Bool
-ephyrRandRInit (ScreenPtr pScreen);
+ ephyrRandRInit(ScreenPtr pScreen);
-void
-ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
+void
+ ephyrShadowUpdate(ScreenPtr pScreen, shadowBufPtr pBuf);
#endif
void
-ephyrUpdateModifierState(unsigned int state);
+ ephyrUpdateModifierState(unsigned int state);
extern KdPointerDriver EphyrMouseDriver;
-extern KdKeyboardDriver EphyrKeyboardDriver;
+extern KdKeyboardDriver EphyrKeyboardDriver;
-extern KdOsFuncs EphyrOsFuncs;
+extern KdOsFuncs EphyrOsFuncs;
extern Bool ephyrCursorInit(ScreenPtr pScreen);
extern void ephyrCursorEnable(ScreenPtr pScreen);
-extern int ephyrBufferHeight(KdScreenInfo *screen);
+extern int ephyrBufferHeight(KdScreenInfo * screen);
extern int ephyrBufferHeight(KdScreenInfo *screen);
/* ephyr_draw.c */
Bool
-ephyrDrawInit(ScreenPtr pScreen);
+ ephyrDrawInit(ScreenPtr pScreen);
void
-ephyrDrawEnable(ScreenPtr pScreen);
+ ephyrDrawEnable(ScreenPtr pScreen);
void
-ephyrDrawDisable(ScreenPtr pScreen);
+ ephyrDrawDisable(ScreenPtr pScreen);
void
-ephyrDrawFini(ScreenPtr pScreen);
+ ephyrDrawFini(ScreenPtr pScreen);
/*ephyvideo.c*/
-Bool ephyrInitVideo(ScreenPtr pScreen) ;
+Bool ephyrInitVideo(ScreenPtr pScreen);
#endif
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr_draw.c b/xorg-server/hw/kdrive/ephyr/ephyr_draw.c
index cf5f55394..5b8a1d504 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr_draw.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr_draw.c
@@ -64,7 +64,7 @@ ephyrPreparePipelinedAccess(PixmapPtr pPix, int index)
fakexa->saved_ptrs[index] = pPix->devPrivate.ptr;
if (pPix->devPrivate.ptr != NULL)
- return;
+ return;
pPix->devPrivate.ptr = fakexa->exa->memoryBase + exaGetPixmapOffset(pPix);
}
@@ -93,6 +93,7 @@ static Bool
ephyrPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
+
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
@@ -107,7 +108,8 @@ ephyrPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
tmpval[0].val = alu;
tmpval[1].val = pm;
tmpval[2].val = fg;
- ChangeGC(NullClient, fakexa->pGC, GCFunction | GCPlaneMask | GCForeground, tmpval);
+ ChangeGC(NullClient, fakexa->pGC, GCFunction | GCPlaneMask | GCForeground,
+ tmpval);
ValidateGC(&pPix->drawable, fakexa->pGC);
@@ -123,6 +125,7 @@ static void
ephyrSolid(PixmapPtr pPix, int x1, int y1, int x2, int y2)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
+
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
@@ -138,6 +141,7 @@ static void
ephyrDoneSolid(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
+
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
@@ -154,9 +158,10 @@ ephyrDoneSolid(PixmapPtr pPix)
*/
static Bool
ephyrPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu,
- Pixel pm)
+ Pixel pm)
{
ScreenPtr pScreen = pDst->drawable.pScreen;
+
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
@@ -172,7 +177,7 @@ ephyrPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu,
tmpval[0].val = alu;
tmpval[1].val = pm;
- ChangeGC (NullClient, fakexa->pGC, GCFunction | GCPlaneMask, tmpval);
+ ChangeGC(NullClient, fakexa->pGC, GCFunction | GCPlaneMask, tmpval);
ValidateGC(&pDst->drawable, fakexa->pGC);
@@ -188,13 +193,14 @@ static void
ephyrCopy(PixmapPtr pDst, int srcX, int srcY, int dstX, int dstY, int w, int h)
{
ScreenPtr pScreen = pDst->drawable.pScreen;
+
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
fbCopyArea(&fakexa->pSrc->drawable, &fakexa->pDst->drawable, fakexa->pGC,
- srcX, srcY, w, h, dstX, dstY);
+ srcX, srcY, w, h, dstX, dstY);
}
/**
@@ -204,12 +210,13 @@ static void
ephyrDoneCopy(PixmapPtr pDst)
{
ScreenPtr pScreen = pDst->drawable.pScreen;
+
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
- FreeScratchGC (fakexa->pGC);
+ FreeScratchGC(fakexa->pGC);
ephyrFinishPipelinedAccess(fakexa->pSrc, EXA_PREPARE_SRC);
ephyrFinishPipelinedAccess(fakexa->pDst, EXA_PREPARE_DEST);
@@ -222,13 +229,13 @@ ephyrDoneCopy(PixmapPtr pDst)
*/
static Bool
ephyrCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
- PicturePtr pDstPicture)
+ PicturePtr pDstPicture)
{
/* Exercise the component alpha helper, so fail on this case like a normal
* driver
*/
if (pMaskPicture && pMaskPicture->componentAlpha && op == PictOpOver)
- return FALSE;
+ return FALSE;
return TRUE;
}
@@ -238,8 +245,8 @@ ephyrCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
*/
static Bool
ephyrPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
- PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask,
- PixmapPtr pDst)
+ PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask,
+ PixmapPtr pDst)
{
KdScreenPriv(pDst->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
@@ -249,7 +256,7 @@ ephyrPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST);
ephyrPreparePipelinedAccess(pSrc, EXA_PREPARE_SRC);
if (pMask != NULL)
- ephyrPreparePipelinedAccess(pMask, EXA_PREPARE_MASK);
+ ephyrPreparePipelinedAccess(pMask, EXA_PREPARE_MASK);
fakexa->op = op;
fakexa->pSrcPicture = pSrcPicture;
@@ -269,7 +276,7 @@ ephyrPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
*/
static void
ephyrComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
- int dstX, int dstY, int w, int h)
+ int dstX, int dstY, int w, int h)
{
KdScreenPriv(pDst->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
@@ -277,8 +284,8 @@ ephyrComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
fbComposite(fakexa->op, fakexa->pSrcPicture, fakexa->pMaskPicture,
- fakexa->pDstPicture, srcX, srcY, maskX, maskY, dstX, dstY,
- w, h);
+ fakexa->pDstPicture, srcX, srcY, maskX, maskY, dstX, dstY,
+ w, h);
}
static void
@@ -290,7 +297,7 @@ ephyrDoneComposite(PixmapPtr pDst)
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
if (fakexa->pMask != NULL)
- ephyrFinishPipelinedAccess(fakexa->pMask, EXA_PREPARE_MASK);
+ ephyrFinishPipelinedAccess(fakexa->pMask, EXA_PREPARE_MASK);
ephyrFinishPipelinedAccess(fakexa->pSrc, EXA_PREPARE_SRC);
ephyrFinishPipelinedAccess(fakexa->pDst, EXA_PREPARE_DEST);
}
@@ -300,7 +307,7 @@ ephyrDoneComposite(PixmapPtr pDst)
*/
static Bool
ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
- int dst_pitch)
+ int dst_pitch)
{
KdScreenPriv(pSrc->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
@@ -310,7 +317,7 @@ ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
int src_pitch, cpp;
if (pSrc->drawable.bitsPerPixel < 8)
- return FALSE;
+ return FALSE;
ephyrPreparePipelinedAccess(pSrc, EXA_PREPARE_SRC);
@@ -320,9 +327,9 @@ ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
src += y * src_pitch + x * cpp;
for (; h > 0; h--) {
- memcpy(dst, src, w * cpp);
- dst += dst_pitch;
- src += src_pitch;
+ memcpy(dst, src, w * cpp);
+ dst += dst_pitch;
+ src += src_pitch;
}
exaMarkSync(pSrc->drawable.pScreen);
@@ -337,7 +344,7 @@ ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
*/
static Bool
ephyrUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
- int src_pitch)
+ int src_pitch)
{
KdScreenPriv(pDst->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
@@ -347,7 +354,7 @@ ephyrUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
int dst_pitch, cpp;
if (pDst->drawable.bitsPerPixel < 8)
- return FALSE;
+ return FALSE;
ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST);
@@ -357,9 +364,9 @@ ephyrUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
dst += y * dst_pitch + x * cpp;
for (; h > 0; h--) {
- memcpy(dst, src, w * cpp);
- dst += dst_pitch;
- src += src_pitch;
+ memcpy(dst, src, w * cpp);
+ dst += dst_pitch;
+ src += src_pitch;
}
exaMarkSync(pDst->drawable.pScreen);
@@ -433,12 +440,12 @@ ephyrDrawInit(ScreenPtr pScreen)
fakexa = calloc(1, sizeof(*fakexa));
if (fakexa == NULL)
- return FALSE;
+ return FALSE;
fakexa->exa = exaDriverAlloc();
if (fakexa->exa == NULL) {
- free(fakexa);
- return FALSE;
+ free(fakexa);
+ return FALSE;
}
fakexa->exa->memoryBase = (CARD8 *) (priv->base);
@@ -482,12 +489,13 @@ ephyrDrawInit(ScreenPtr pScreen)
success = exaDriverInit(pScreen, fakexa->exa);
if (success) {
- ErrorF("Initialized fake EXA acceleration\n");
- scrpriv->fakexa = fakexa;
- } else {
- ErrorF("Failed to initialize EXA\n");
- free(fakexa->exa);
- free(fakexa);
+ ErrorF("Initialized fake EXA acceleration\n");
+ scrpriv->fakexa = fakexa;
+ }
+ else {
+ ErrorF("Failed to initialize EXA\n");
+ free(fakexa->exa);
+ free(fakexa);
}
return success;
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdri.c b/xorg-server/hw/kdrive/ephyr/ephyrdri.c
index 932e46886..50554364c 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrdri.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdri.c
@@ -43,244 +43,228 @@
#ifndef TRUE
#define TRUE 1
#endif /*TRUE*/
-
#ifndef FALSE
#define FALSE 0
#endif /*FALSE*/
-
-Bool
-ephyrDRIQueryDirectRenderingCapable (int a_screen, Bool *a_is_capable)
+ Bool
+ephyrDRIQueryDirectRenderingCapable(int a_screen, Bool *a_is_capable)
{
- Display *dpy=hostx_get_display () ;
- Bool is_ok=FALSE ;
+ Display *dpy = hostx_get_display();
+ Bool is_ok = FALSE;
- EPHYR_RETURN_VAL_IF_FAIL (a_is_capable, FALSE) ;
- EPHYR_LOG ("enter\n") ;
- is_ok = XF86DRIQueryDirectRenderingCapable (dpy, DefaultScreen (dpy),
- a_is_capable) ;
- EPHYR_LOG ("leave. is_capable:%d, is_ok=%d\n", *a_is_capable, is_ok) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_is_capable, FALSE);
+ EPHYR_LOG("enter\n");
+ is_ok = XF86DRIQueryDirectRenderingCapable(dpy, DefaultScreen(dpy),
+ a_is_capable);
+ EPHYR_LOG("leave. is_capable:%d, is_ok=%d\n", *a_is_capable, is_ok);
- return is_ok ;
+ return is_ok;
}
Bool
-ephyrDRIOpenConnection (int a_screen,
- drm_handle_t *a_sarea,
- char **a_bus_id_string)
+ephyrDRIOpenConnection(int a_screen,
+ drm_handle_t * a_sarea, char **a_bus_id_string)
{
- Display *dpy = hostx_get_display () ;
- Bool is_ok=FALSE ;
+ Display *dpy = hostx_get_display();
+ Bool is_ok = FALSE;
- EPHYR_RETURN_VAL_IF_FAIL (a_bus_id_string, FALSE) ;
- EPHYR_LOG ("enter. screen:%d\n", a_screen) ;
- is_ok = XF86DRIOpenConnection (dpy, DefaultScreen (dpy),
- a_sarea,
- a_bus_id_string) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_bus_id_string, FALSE);
+ EPHYR_LOG("enter. screen:%d\n", a_screen);
+ is_ok = XF86DRIOpenConnection(dpy, DefaultScreen(dpy),
+ a_sarea, a_bus_id_string);
if (*a_bus_id_string) {
- EPHYR_LOG ("leave. bus_id_string:%s, is_ok:%d\n",
- *a_bus_id_string, is_ok) ;
- } else {
- EPHYR_LOG ("leave. bus_id_string:null, is_ok:%d\n",
- is_ok) ;
+ EPHYR_LOG("leave. bus_id_string:%s, is_ok:%d\n",
+ *a_bus_id_string, is_ok);
+ }
+ else {
+ EPHYR_LOG("leave. bus_id_string:null, is_ok:%d\n", is_ok);
}
- return is_ok ;
+ return is_ok;
}
Bool
-ephyrDRIAuthConnection (int a_screen, drm_magic_t a_magic)
+ephyrDRIAuthConnection(int a_screen, drm_magic_t a_magic)
{
- Display *dpy = hostx_get_display () ;
- Bool is_ok=FALSE ;
+ Display *dpy = hostx_get_display();
+ Bool is_ok = FALSE;
- EPHYR_LOG ("enter\n") ;
- is_ok = XF86DRIAuthConnection (dpy, DefaultScreen (dpy), a_magic) ;
- EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
- return is_ok ;
+ EPHYR_LOG("enter\n");
+ is_ok = XF86DRIAuthConnection(dpy, DefaultScreen(dpy), a_magic);
+ EPHYR_LOG("leave. is_ok:%d\n", is_ok);
+ return is_ok;
}
Bool
-ephyrDRICloseConnection (int a_screen)
+ephyrDRICloseConnection(int a_screen)
{
- Display *dpy = hostx_get_display () ;
- Bool is_ok=FALSE ;
+ Display *dpy = hostx_get_display();
+ Bool is_ok = FALSE;
- EPHYR_LOG ("enter\n") ;
- is_ok = XF86DRICloseConnection (dpy, DefaultScreen (dpy)) ;
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ EPHYR_LOG("enter\n");
+ is_ok = XF86DRICloseConnection(dpy, DefaultScreen(dpy));
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
Bool
-ephyrDRIGetClientDriverName (int a_screen,
- int *a_ddx_driver_major_version,
- int *a_ddx_driver_minor_version,
- int *a_ddx_driver_patch_version,
- char ** a_client_driver_name)
+ephyrDRIGetClientDriverName(int a_screen,
+ int *a_ddx_driver_major_version,
+ int *a_ddx_driver_minor_version,
+ int *a_ddx_driver_patch_version,
+ char **a_client_driver_name)
{
- Display *dpy = hostx_get_display () ;
- Bool is_ok=FALSE ;
+ Display *dpy = hostx_get_display();
+ Bool is_ok = FALSE;
- EPHYR_RETURN_VAL_IF_FAIL (a_ddx_driver_major_version
- && a_ddx_driver_minor_version
- && a_ddx_driver_patch_version
- && a_client_driver_name,
- FALSE);
- EPHYR_LOG ("enter\n") ;
- is_ok = XF86DRIGetClientDriverName (dpy, DefaultScreen (dpy),
- a_ddx_driver_major_version,
- a_ddx_driver_minor_version,
- a_ddx_driver_patch_version,
- a_client_driver_name) ;
- EPHYR_LOG ("major:%d, minor:%d, patch:%d, name:%s\n",
- *a_ddx_driver_major_version,
- *a_ddx_driver_minor_version,
- *a_ddx_driver_patch_version,
- *a_client_driver_name) ;
- EPHYR_LOG ("leave:%d\n", is_ok) ;
- return is_ok ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_ddx_driver_major_version
+ && a_ddx_driver_minor_version
+ && a_ddx_driver_patch_version
+ && a_client_driver_name, FALSE);
+ EPHYR_LOG("enter\n");
+ is_ok = XF86DRIGetClientDriverName(dpy, DefaultScreen(dpy),
+ a_ddx_driver_major_version,
+ a_ddx_driver_minor_version,
+ a_ddx_driver_patch_version,
+ a_client_driver_name);
+ EPHYR_LOG("major:%d, minor:%d, patch:%d, name:%s\n",
+ *a_ddx_driver_major_version,
+ *a_ddx_driver_minor_version,
+ *a_ddx_driver_patch_version, *a_client_driver_name);
+ EPHYR_LOG("leave:%d\n", is_ok);
+ return is_ok;
}
Bool
-ephyrDRICreateContext (int a_screen,
- int a_visual_id,
- XID *a_returned_ctxt_id,
- drm_context_t *a_hw_ctxt)
+ephyrDRICreateContext(int a_screen,
+ int a_visual_id,
+ XID *a_returned_ctxt_id, drm_context_t * a_hw_ctxt)
{
- Display *dpy = hostx_get_display () ;
- Bool is_ok=FALSE ;
+ Display *dpy = hostx_get_display();
+ Bool is_ok = FALSE;
Visual v;
- EPHYR_LOG ("enter. screen:%d, visual:%d\n", a_screen, a_visual_id) ;
- memset (&v, 0, sizeof (v)) ;
- v.visualid = a_visual_id ;
- is_ok = XF86DRICreateContext (dpy,
- DefaultScreen (dpy),
- &v,
- a_returned_ctxt_id,
- a_hw_ctxt) ;
- EPHYR_LOG ("leave:%d\n", is_ok) ;
- return is_ok ;
+ EPHYR_LOG("enter. screen:%d, visual:%d\n", a_screen, a_visual_id);
+ memset(&v, 0, sizeof(v));
+ v.visualid = a_visual_id;
+ is_ok = XF86DRICreateContext(dpy,
+ DefaultScreen(dpy),
+ &v, a_returned_ctxt_id, a_hw_ctxt);
+ EPHYR_LOG("leave:%d\n", is_ok);
+ return is_ok;
}
Bool
-ephyrDRIDestroyContext (int a_screen,
- int a_context_id)
+ephyrDRIDestroyContext(int a_screen, int a_context_id)
{
- Display *dpy = hostx_get_display () ;
- Bool is_ok=FALSE ;
+ Display *dpy = hostx_get_display();
+ Bool is_ok = FALSE;
- EPHYR_LOG ("enter\n") ;
- is_ok = XF86DRIDestroyContext (dpy, DefaultScreen (dpy), a_context_id) ;
- EPHYR_LOG ("leave:%d\n", is_ok) ;
- return is_ok ;
+ EPHYR_LOG("enter\n");
+ is_ok = XF86DRIDestroyContext(dpy, DefaultScreen(dpy), a_context_id);
+ EPHYR_LOG("leave:%d\n", is_ok);
+ return is_ok;
}
Bool
-ephyrDRICreateDrawable (int a_screen,
- int a_drawable,
- drm_drawable_t *a_hw_drawable)
+ephyrDRICreateDrawable(int a_screen,
+ int a_drawable, drm_drawable_t * a_hw_drawable)
{
- Bool is_ok=FALSE;
- Display *dpy=hostx_get_display () ;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
- EPHYR_LOG ("enter\n") ;
- is_ok = XF86DRICreateDrawable (dpy, DefaultScreen (dpy),
- a_drawable, a_hw_drawable) ;
- EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
- return is_ok ;
+ EPHYR_LOG("enter\n");
+ is_ok = XF86DRICreateDrawable(dpy, DefaultScreen(dpy),
+ a_drawable, a_hw_drawable);
+ EPHYR_LOG("leave. is_ok:%d\n", is_ok);
+ return is_ok;
}
Bool
-ephyrDRIDestroyDrawable (int a_screen, int a_drawable)
+ephyrDRIDestroyDrawable(int a_screen, int a_drawable)
{
- EPHYR_LOG ("enter\n") ;
- EPHYR_LOG_ERROR ("not implemented yet\n") ;
- EPHYR_LOG ("leave\n") ;
- return FALSE ;
+ EPHYR_LOG("enter\n");
+ EPHYR_LOG_ERROR("not implemented yet\n");
+ EPHYR_LOG("leave\n");
+ return FALSE;
}
Bool
-ephyrDRIGetDrawableInfo (int a_screen,
- int a_drawable,
- unsigned int *a_index,
- unsigned int *a_stamp,
- int *a_x,
- int *a_y,
- int *a_w,
- int *a_h,
- int *a_num_clip_rects,
- drm_clip_rect_t **a_clip_rects,
- int *a_back_x,
- int *a_back_y,
- int *a_num_back_clip_rects,
- drm_clip_rect_t **a_back_clip_rects)
+ephyrDRIGetDrawableInfo(int a_screen,
+ int a_drawable,
+ unsigned int *a_index,
+ unsigned int *a_stamp,
+ int *a_x,
+ int *a_y,
+ int *a_w,
+ int *a_h,
+ int *a_num_clip_rects,
+ drm_clip_rect_t ** a_clip_rects,
+ int *a_back_x,
+ int *a_back_y,
+ int *a_num_back_clip_rects,
+ drm_clip_rect_t ** a_back_clip_rects)
{
- Bool is_ok=FALSE;
- Display *dpy=hostx_get_display () ;
- EphyrHostWindowAttributes attrs ;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ EphyrHostWindowAttributes attrs;
- EPHYR_RETURN_VAL_IF_FAIL (a_x && a_y && a_w && a_h
- && a_num_clip_rects,
- FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_x && a_y && a_w && a_h
+ && a_num_clip_rects, FALSE);
- EPHYR_LOG ("enter\n") ;
- memset (&attrs, 0, sizeof (attrs)) ;
- if (!hostx_get_window_attributes (a_drawable, &attrs)) {
- EPHYR_LOG_ERROR ("failed to query host window attributes\n") ;
+ EPHYR_LOG("enter\n");
+ memset(&attrs, 0, sizeof(attrs));
+ if (!hostx_get_window_attributes(a_drawable, &attrs)) {
+ EPHYR_LOG_ERROR("failed to query host window attributes\n");
goto out;
}
- if (!XF86DRIGetDrawableInfo (dpy, DefaultScreen (dpy), a_drawable,
- a_index, a_stamp,
- a_x, a_y,
- a_w, a_h,
- a_num_clip_rects, a_clip_rects,
- a_back_x, a_back_y,
- a_num_back_clip_rects,
- a_back_clip_rects)) {
- EPHYR_LOG_ERROR ("XF86DRIGetDrawableInfo ()\n") ;
- goto out ;
+ if (!XF86DRIGetDrawableInfo(dpy, DefaultScreen(dpy), a_drawable,
+ a_index, a_stamp,
+ a_x, a_y,
+ a_w, a_h,
+ a_num_clip_rects, a_clip_rects,
+ a_back_x, a_back_y,
+ a_num_back_clip_rects, a_back_clip_rects)) {
+ EPHYR_LOG_ERROR("XF86DRIGetDrawableInfo ()\n");
+ goto out;
}
- EPHYR_LOG ("host x,y,w,h: (%d,%d,%d,%d)\n", *a_x, *a_y, *a_w, *a_h) ;
+ EPHYR_LOG("host x,y,w,h: (%d,%d,%d,%d)\n", *a_x, *a_y, *a_w, *a_h);
if (*a_num_clip_rects) {
- free (*a_back_clip_rects) ;
- *a_back_clip_rects = calloc (*a_num_clip_rects,
- sizeof (drm_clip_rect_t)) ;
- memmove (*a_back_clip_rects,
- *a_clip_rects,
- *a_num_clip_rects * sizeof (drm_clip_rect_t)) ;
+ free(*a_back_clip_rects);
+ *a_back_clip_rects = calloc(*a_num_clip_rects, sizeof(drm_clip_rect_t));
+ memmove(*a_back_clip_rects,
+ *a_clip_rects, *a_num_clip_rects * sizeof(drm_clip_rect_t));
*a_num_back_clip_rects = *a_num_clip_rects;
}
- EPHYR_LOG ("num back clip rects:%d, num clip rects:%d\n",
- *a_num_clip_rects, *a_num_back_clip_rects) ;
- *a_back_x = *a_x ;
- *a_back_y = *a_y ;
+ EPHYR_LOG("num back clip rects:%d, num clip rects:%d\n",
+ *a_num_clip_rects, *a_num_back_clip_rects);
+ *a_back_x = *a_x;
+ *a_back_y = *a_y;
*a_w = attrs.width;
*a_h = attrs.height;
- is_ok = TRUE ;
-out:
- EPHYR_LOG ("leave. index:%d, stamp:%d, x,y:(%d,%d), w,y:(%d,%d)\n",
- *a_index, *a_stamp, *a_x, *a_y, *a_w, *a_h) ;
- return is_ok ;
+ is_ok = TRUE;
+ out:
+ EPHYR_LOG("leave. index:%d, stamp:%d, x,y:(%d,%d), w,y:(%d,%d)\n",
+ *a_index, *a_stamp, *a_x, *a_y, *a_w, *a_h);
+ return is_ok;
}
Bool
-ephyrDRIGetDeviceInfo (int a_screen,
- drm_handle_t *a_frame_buffer,
- int *a_fb_origin,
- int *a_fb_size,
- int *a_fb_stride,
- int *a_dev_private_size,
- void **a_dev_private)
+ephyrDRIGetDeviceInfo(int a_screen,
+ drm_handle_t * a_frame_buffer,
+ int *a_fb_origin,
+ int *a_fb_size,
+ int *a_fb_stride,
+ int *a_dev_private_size, void **a_dev_private)
{
- Bool is_ok = FALSE ;
- Display *dpy = hostx_get_display () ;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
- EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
- EPHYR_LOG ("enter\n") ;
- is_ok = XF86DRIGetDeviceInfo (dpy, DefaultScreen (dpy), a_frame_buffer,
- a_fb_origin, a_fb_size, a_fb_stride,
- a_dev_private_size, a_dev_private) ;
- EPHYR_LOG ("leave:%d\n", is_ok) ;
- return is_ok ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
+ EPHYR_LOG("enter\n");
+ is_ok = XF86DRIGetDeviceInfo(dpy, DefaultScreen(dpy), a_frame_buffer,
+ a_fb_origin, a_fb_size, a_fb_stride,
+ a_dev_private_size, a_dev_private);
+ EPHYR_LOG("leave:%d\n", is_ok);
+ return is_ok;
}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdri.h b/xorg-server/hw/kdrive/ephyr/ephyrdri.h
index 28ae8eae0..d28910f29 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrdri.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdri.h
@@ -31,45 +31,40 @@
#include <xf86drm.h>
-Bool ephyrDRIQueryDirectRenderingCapable (int a_screen, Bool *a_is_capable) ;
-Bool ephyrDRIOpenConnection (int screen, drm_handle_t *a_sarea, char **a_bus_id_string) ;
-Bool ephyrDRIAuthConnection (int a_screen, drm_magic_t a_magic) ;
-Bool ephyrDRICloseConnection (int a_screen) ;
-Bool ephyrDRIGetClientDriverName (int a_screen,
- int *a_ddx_driver_major_version,
- int *a_ddx_driver_minor_version,
- int *a_ddx_driver_patch_version,
- char ** a_client_driver_name) ;
-Bool ephyrDRICreateContext (int a_screen,
- int a_visual_id,
- XID *a_returned_ctx_id,
- drm_context_t *a_hw_ctx) ;
-Bool ephyrDRIDestroyContext (int a_screen,
- int a_context_id) ;
-Bool ephyrDRICreateDrawable (int a_screen,
- int a_drawable,
- drm_drawable_t *a_hw_drawable) ;
-Bool ephyrDRIDestroyDrawable (int a_screen, int a_drawable) ;
-Bool ephyrDRIGetDrawableInfo (int a_screen,
- int /*Drawable*/a_drawable,
- unsigned int *a_index,
- unsigned int *a_stamp,
- int *a_x,
- int *a_y,
- int *a_w,
- int *a_h,
- int *a_num_clip_rects,
- drm_clip_rect_t **a_clip_rects,
- int *a_back_x,
- int *a_back_y,
- int *num_back_clip_rects,
- drm_clip_rect_t **a_back_clip_rects) ;
-Bool ephyrDRIGetDeviceInfo (int a_screen,
- drm_handle_t *a_frame_buffer,
- int *a_fb_origin,
- int *a_fb_size,
- int *a_fb_stride,
- int *a_dev_private_size,
- void **a_dev_private) ;
+Bool ephyrDRIQueryDirectRenderingCapable(int a_screen, Bool *a_is_capable);
+Bool ephyrDRIOpenConnection(int screen, drm_handle_t * a_sarea,
+ char **a_bus_id_string);
+Bool ephyrDRIAuthConnection(int a_screen, drm_magic_t a_magic);
+Bool ephyrDRICloseConnection(int a_screen);
+Bool ephyrDRIGetClientDriverName(int a_screen,
+ int *a_ddx_driver_major_version,
+ int *a_ddx_driver_minor_version,
+ int *a_ddx_driver_patch_version,
+ char **a_client_driver_name);
+Bool ephyrDRICreateContext(int a_screen,
+ int a_visual_id,
+ XID *a_returned_ctx_id, drm_context_t * a_hw_ctx);
+Bool ephyrDRIDestroyContext(int a_screen, int a_context_id);
+Bool ephyrDRICreateDrawable(int a_screen,
+ int a_drawable, drm_drawable_t * a_hw_drawable);
+Bool ephyrDRIDestroyDrawable(int a_screen, int a_drawable);
+Bool ephyrDRIGetDrawableInfo(int a_screen, int /*Drawable */ a_drawable,
+ unsigned int *a_index,
+ unsigned int *a_stamp,
+ int *a_x,
+ int *a_y,
+ int *a_w,
+ int *a_h,
+ int *a_num_clip_rects,
+ drm_clip_rect_t ** a_clip_rects,
+ int *a_back_x,
+ int *a_back_y,
+ int *num_back_clip_rects,
+ drm_clip_rect_t ** a_back_clip_rects);
+Bool ephyrDRIGetDeviceInfo(int a_screen,
+ drm_handle_t * a_frame_buffer,
+ int *a_fb_origin,
+ int *a_fb_size,
+ int *a_fb_stride,
+ int *a_dev_private_size, void **a_dev_private);
#endif /*__EPHYRDRI_H__*/
-
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
index 0741a7294..28486f516 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
@@ -59,43 +59,40 @@
typedef struct {
int foo;
} EphyrDRIWindowPrivRec;
-typedef EphyrDRIWindowPrivRec* EphyrDRIWindowPrivPtr;
+typedef EphyrDRIWindowPrivRec *EphyrDRIWindowPrivPtr;
typedef struct {
- CreateWindowProcPtr CreateWindow ;
- DestroyWindowProcPtr DestroyWindow ;
- MoveWindowProcPtr MoveWindow ;
- PositionWindowProcPtr PositionWindow ;
- ClipNotifyProcPtr ClipNotify ;
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ MoveWindowProcPtr MoveWindow;
+ PositionWindowProcPtr PositionWindow;
+ ClipNotifyProcPtr ClipNotify;
} EphyrDRIScreenPrivRec;
-typedef EphyrDRIScreenPrivRec* EphyrDRIScreenPrivPtr;
+typedef EphyrDRIScreenPrivRec *EphyrDRIScreenPrivPtr;
static int DRIErrorBase;
+static Bool ephyrDRIScreenInit(ScreenPtr a_screen);
+static Bool ephyrDRICreateWindow(WindowPtr a_win);
+static Bool ephyrDRIDestroyWindow(WindowPtr a_win);
+static void ephyrDRIMoveWindow(WindowPtr a_win,
+ int a_x, int a_y,
+ WindowPtr a_siblings, VTKind a_kind);
+static Bool ephyrDRIPositionWindow(WindowPtr a_win, int x, int y);
+static void ephyrDRIClipNotify(WindowPtr a_win, int a_x, int a_y);
-
-static Bool ephyrDRIScreenInit (ScreenPtr a_screen) ;
-static Bool ephyrDRICreateWindow (WindowPtr a_win) ;
-static Bool ephyrDRIDestroyWindow (WindowPtr a_win) ;
-static void ephyrDRIMoveWindow (WindowPtr a_win,
- int a_x, int a_y,
- WindowPtr a_siblings,
- VTKind a_kind);
-static Bool ephyrDRIPositionWindow (WindowPtr a_win,
- int x, int y) ;
-static void ephyrDRIClipNotify (WindowPtr a_win,
- int a_x, int a_y) ;
-
-static Bool EphyrMirrorHostVisuals (ScreenPtr a_screen) ;
-static Bool destroyHostPeerWindow (const WindowPtr a_win) ;
-static Bool findWindowPairFromLocal (WindowPtr a_local,
- EphyrWindowPair **a_pair);
+static Bool EphyrMirrorHostVisuals(ScreenPtr a_screen);
+static Bool destroyHostPeerWindow(const WindowPtr a_win);
+static Bool findWindowPairFromLocal(WindowPtr a_local,
+ EphyrWindowPair ** a_pair);
static unsigned char DRIReqCode = 0;
static DevPrivateKeyRec ephyrDRIWindowKeyRec;
+
#define ephyrDRIWindowKey (&ephyrDRIWindowKeyRec)
static DevPrivateKeyRec ephyrDRIScreenKeyRec;
+
#define ephyrDRIScreenKey (&ephyrDRIScreenKeyRec)
#define GET_EPHYR_DRI_WINDOW_PRIV(win) ((EphyrDRIWindowPrivPtr) \
@@ -104,251 +101,239 @@ static DevPrivateKeyRec ephyrDRIScreenKeyRec;
dixLookupPrivate(&(screen)->devPrivates, ephyrDRIScreenKey))
static Bool
-ephyrDRIScreenInit (ScreenPtr a_screen)
+ephyrDRIScreenInit(ScreenPtr a_screen)
{
- Bool is_ok=FALSE ;
- EphyrDRIScreenPrivPtr screen_priv=NULL ;
+ Bool is_ok = FALSE;
+ EphyrDRIScreenPrivPtr screen_priv = NULL;
- EPHYR_RETURN_VAL_IF_FAIL (a_screen, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_screen, FALSE);
- screen_priv=GET_EPHYR_DRI_SCREEN_PRIV (a_screen) ;
- EPHYR_RETURN_VAL_IF_FAIL (screen_priv, FALSE) ;
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(a_screen);
+ EPHYR_RETURN_VAL_IF_FAIL(screen_priv, FALSE);
- screen_priv->CreateWindow = a_screen->CreateWindow ;
- screen_priv->DestroyWindow = a_screen->DestroyWindow ;
- screen_priv->MoveWindow = a_screen->MoveWindow ;
- screen_priv->PositionWindow = a_screen->PositionWindow ;
- screen_priv->ClipNotify = a_screen->ClipNotify ;
+ screen_priv->CreateWindow = a_screen->CreateWindow;
+ screen_priv->DestroyWindow = a_screen->DestroyWindow;
+ screen_priv->MoveWindow = a_screen->MoveWindow;
+ screen_priv->PositionWindow = a_screen->PositionWindow;
+ screen_priv->ClipNotify = a_screen->ClipNotify;
- a_screen->CreateWindow = ephyrDRICreateWindow ;
- a_screen->DestroyWindow = ephyrDRIDestroyWindow ;
- a_screen->MoveWindow = ephyrDRIMoveWindow ;
- a_screen->PositionWindow = ephyrDRIPositionWindow ;
- a_screen->ClipNotify = ephyrDRIClipNotify ;
+ a_screen->CreateWindow = ephyrDRICreateWindow;
+ a_screen->DestroyWindow = ephyrDRIDestroyWindow;
+ a_screen->MoveWindow = ephyrDRIMoveWindow;
+ a_screen->PositionWindow = ephyrDRIPositionWindow;
+ a_screen->ClipNotify = ephyrDRIClipNotify;
- is_ok = TRUE ;
+ is_ok = TRUE;
- return is_ok ;
+ return is_ok;
}
static Bool
-ephyrDRICreateWindow (WindowPtr a_win)
+ephyrDRICreateWindow(WindowPtr a_win)
{
- Bool is_ok=FALSE ;
- ScreenPtr screen=NULL ;
- EphyrDRIScreenPrivPtr screen_priv =NULL;
+ Bool is_ok = FALSE;
+ ScreenPtr screen = NULL;
+ EphyrDRIScreenPrivPtr screen_priv = NULL;
- EPHYR_RETURN_VAL_IF_FAIL (a_win, FALSE) ;
- screen = a_win->drawable.pScreen ;
- EPHYR_RETURN_VAL_IF_FAIL (screen, FALSE) ;
- screen_priv = GET_EPHYR_DRI_SCREEN_PRIV (screen) ;
- EPHYR_RETURN_VAL_IF_FAIL (screen_priv
- && screen_priv->CreateWindow,
- FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_win, FALSE);
+ screen = a_win->drawable.pScreen;
+ EPHYR_RETURN_VAL_IF_FAIL(screen, FALSE);
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(screen);
+ EPHYR_RETURN_VAL_IF_FAIL(screen_priv && screen_priv->CreateWindow, FALSE);
- EPHYR_LOG ("enter. win:%p\n", a_win) ;
+ EPHYR_LOG("enter. win:%p\n", a_win);
- screen->CreateWindow = screen_priv->CreateWindow ;
- is_ok = (*screen->CreateWindow) (a_win) ;
- screen->CreateWindow = ephyrDRICreateWindow ;
+ screen->CreateWindow = screen_priv->CreateWindow;
+ is_ok = (*screen->CreateWindow) (a_win);
+ screen->CreateWindow = ephyrDRICreateWindow;
if (is_ok) {
- dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
+ dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
}
- return is_ok ;
+ return is_ok;
}
static Bool
-ephyrDRIDestroyWindow (WindowPtr a_win)
+ephyrDRIDestroyWindow(WindowPtr a_win)
{
- Bool is_ok=FALSE ;
- ScreenPtr screen=NULL ;
- EphyrDRIScreenPrivPtr screen_priv =NULL;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_win, FALSE) ;
- screen = a_win->drawable.pScreen ;
- EPHYR_RETURN_VAL_IF_FAIL (screen, FALSE) ;
- screen_priv = GET_EPHYR_DRI_SCREEN_PRIV (screen) ;
- EPHYR_RETURN_VAL_IF_FAIL (screen_priv
- && screen_priv->DestroyWindow,
- FALSE) ;
-
- screen->DestroyWindow = screen_priv->DestroyWindow ;
+ Bool is_ok = FALSE;
+ ScreenPtr screen = NULL;
+ EphyrDRIScreenPrivPtr screen_priv = NULL;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_win, FALSE);
+ screen = a_win->drawable.pScreen;
+ EPHYR_RETURN_VAL_IF_FAIL(screen, FALSE);
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(screen);
+ EPHYR_RETURN_VAL_IF_FAIL(screen_priv && screen_priv->DestroyWindow, FALSE);
+
+ screen->DestroyWindow = screen_priv->DestroyWindow;
if (screen->DestroyWindow) {
- is_ok = (*screen->DestroyWindow) (a_win) ;
+ is_ok = (*screen->DestroyWindow) (a_win);
}
- screen->DestroyWindow = ephyrDRIDestroyWindow ;
+ screen->DestroyWindow = ephyrDRIDestroyWindow;
if (is_ok) {
- EphyrDRIWindowPrivPtr win_priv=GET_EPHYR_DRI_WINDOW_PRIV (a_win) ;
+ EphyrDRIWindowPrivPtr win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
+
if (win_priv) {
- destroyHostPeerWindow (a_win) ;
- free(win_priv) ;
- dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
- EPHYR_LOG ("destroyed the remote peer window\n") ;
+ destroyHostPeerWindow(a_win);
+ free(win_priv);
+ dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
+ EPHYR_LOG("destroyed the remote peer window\n");
}
}
- return is_ok ;
+ return is_ok;
}
static void
-ephyrDRIMoveWindow (WindowPtr a_win,
- int a_x, int a_y,
- WindowPtr a_siblings,
- VTKind a_kind)
+ephyrDRIMoveWindow(WindowPtr a_win,
+ int a_x, int a_y, WindowPtr a_siblings, VTKind a_kind)
{
- Bool is_ok=FALSE ;
- ScreenPtr screen=NULL ;
- EphyrDRIScreenPrivPtr screen_priv =NULL;
- EphyrDRIWindowPrivPtr win_priv=NULL ;
- EphyrWindowPair *pair=NULL ;
+ Bool is_ok = FALSE;
+ ScreenPtr screen = NULL;
+ EphyrDRIScreenPrivPtr screen_priv = NULL;
+ EphyrDRIWindowPrivPtr win_priv = NULL;
+ EphyrWindowPair *pair = NULL;
EphyrBox geo;
- int x=0,y=0;/*coords relative to parent window*/
+ int x = 0, y = 0; /*coords relative to parent window */
- EPHYR_RETURN_IF_FAIL (a_win) ;
+ EPHYR_RETURN_IF_FAIL(a_win);
- EPHYR_LOG ("enter\n") ;
- screen = a_win->drawable.pScreen ;
- EPHYR_RETURN_IF_FAIL (screen) ;
- screen_priv = GET_EPHYR_DRI_SCREEN_PRIV (screen) ;
- EPHYR_RETURN_IF_FAIL (screen_priv
- && screen_priv->MoveWindow) ;
+ EPHYR_LOG("enter\n");
+ screen = a_win->drawable.pScreen;
+ EPHYR_RETURN_IF_FAIL(screen);
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(screen);
+ EPHYR_RETURN_IF_FAIL(screen_priv && screen_priv->MoveWindow);
- screen->MoveWindow = screen_priv->MoveWindow ;
+ screen->MoveWindow = screen_priv->MoveWindow;
if (screen->MoveWindow) {
- (*screen->MoveWindow) (a_win, a_x, a_y, a_siblings, a_kind) ;
+ (*screen->MoveWindow) (a_win, a_x, a_y, a_siblings, a_kind);
}
- screen->MoveWindow = ephyrDRIMoveWindow ;
+ screen->MoveWindow = ephyrDRIMoveWindow;
- EPHYR_LOG ("window: %p\n", a_win) ;
+ EPHYR_LOG("window: %p\n", a_win);
if (!a_win->parent) {
- EPHYR_LOG ("cannot move root window\n") ;
- is_ok = TRUE ;
- goto out ;
+ EPHYR_LOG("cannot move root window\n");
+ is_ok = TRUE;
+ goto out;
}
- win_priv = GET_EPHYR_DRI_WINDOW_PRIV (a_win) ;
+ win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
if (!win_priv) {
- EPHYR_LOG ("not a DRI peered window\n") ;
- is_ok = TRUE ;
- goto out ;
- }
- if (!findWindowPairFromLocal (a_win, &pair) || !pair) {
- EPHYR_LOG_ERROR ("failed to get window pair\n") ;
- goto out ;
- }
- /*compute position relative to parent window*/
- x = a_win->drawable.x - a_win->parent->drawable.x ;
- y = a_win->drawable.y - a_win->parent->drawable.y ;
- /*set the geometry to pass to hostx_set_window_geometry*/
- memset (&geo, 0, sizeof (geo)) ;
- geo.x = x ;
- geo.y = y ;
- geo.width = a_win->drawable.width ;
- geo.height = a_win->drawable.height ;
- hostx_set_window_geometry (pair->remote, &geo) ;
- is_ok = TRUE ;
-
-out:
- EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
- /*do cleanup here*/
+ EPHYR_LOG("not a DRI peered window\n");
+ is_ok = TRUE;
+ goto out;
+ }
+ if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
+ EPHYR_LOG_ERROR("failed to get window pair\n");
+ goto out;
+ }
+ /*compute position relative to parent window */
+ x = a_win->drawable.x - a_win->parent->drawable.x;
+ y = a_win->drawable.y - a_win->parent->drawable.y;
+ /*set the geometry to pass to hostx_set_window_geometry */
+ memset(&geo, 0, sizeof(geo));
+ geo.x = x;
+ geo.y = y;
+ geo.width = a_win->drawable.width;
+ geo.height = a_win->drawable.height;
+ hostx_set_window_geometry(pair->remote, &geo);
+ is_ok = TRUE;
+
+ out:
+ EPHYR_LOG("leave. is_ok:%d\n", is_ok);
+ /*do cleanup here */
}
static Bool
-ephyrDRIPositionWindow (WindowPtr a_win,
- int a_x, int a_y)
+ephyrDRIPositionWindow(WindowPtr a_win, int a_x, int a_y)
{
- Bool is_ok=FALSE ;
- ScreenPtr screen=NULL ;
- EphyrDRIScreenPrivPtr screen_priv =NULL;
- EphyrDRIWindowPrivPtr win_priv=NULL ;
- EphyrWindowPair *pair=NULL ;
+ Bool is_ok = FALSE;
+ ScreenPtr screen = NULL;
+ EphyrDRIScreenPrivPtr screen_priv = NULL;
+ EphyrDRIWindowPrivPtr win_priv = NULL;
+ EphyrWindowPair *pair = NULL;
EphyrBox geo;
- EPHYR_RETURN_VAL_IF_FAIL (a_win, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_win, FALSE);
- EPHYR_LOG ("enter\n") ;
- screen = a_win->drawable.pScreen ;
- EPHYR_RETURN_VAL_IF_FAIL (screen, FALSE) ;
- screen_priv = GET_EPHYR_DRI_SCREEN_PRIV (screen) ;
- EPHYR_RETURN_VAL_IF_FAIL (screen_priv
- && screen_priv->PositionWindow,
- FALSE) ;
+ EPHYR_LOG("enter\n");
+ screen = a_win->drawable.pScreen;
+ EPHYR_RETURN_VAL_IF_FAIL(screen, FALSE);
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(screen);
+ EPHYR_RETURN_VAL_IF_FAIL(screen_priv && screen_priv->PositionWindow, FALSE);
- screen->PositionWindow = screen_priv->PositionWindow ;
+ screen->PositionWindow = screen_priv->PositionWindow;
if (screen->PositionWindow) {
- (*screen->PositionWindow) (a_win, a_x, a_y) ;
+ (*screen->PositionWindow) (a_win, a_x, a_y);
}
- screen->PositionWindow = ephyrDRIPositionWindow ;
+ screen->PositionWindow = ephyrDRIPositionWindow;
- EPHYR_LOG ("window: %p\n", a_win) ;
- win_priv = GET_EPHYR_DRI_WINDOW_PRIV (a_win) ;
+ EPHYR_LOG("window: %p\n", a_win);
+ win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
if (!win_priv) {
- EPHYR_LOG ("not a DRI peered window\n") ;
- is_ok = TRUE ;
- goto out ;
- }
- if (!findWindowPairFromLocal (a_win, &pair) || !pair) {
- EPHYR_LOG_ERROR ("failed to get window pair\n") ;
- goto out ;
- }
- /*set the geometry to pass to hostx_set_window_geometry*/
- memset (&geo, 0, sizeof (geo)) ;
- geo.x = a_x ;
- geo.y = a_y ;
- geo.width = a_win->drawable.width ;
- geo.height = a_win->drawable.height ;
- hostx_set_window_geometry (pair->remote, &geo) ;
- is_ok = TRUE ;
-
-out:
- EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
- /*do cleanup here*/
- return is_ok ;
+ EPHYR_LOG("not a DRI peered window\n");
+ is_ok = TRUE;
+ goto out;
+ }
+ if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
+ EPHYR_LOG_ERROR("failed to get window pair\n");
+ goto out;
+ }
+ /*set the geometry to pass to hostx_set_window_geometry */
+ memset(&geo, 0, sizeof(geo));
+ geo.x = a_x;
+ geo.y = a_y;
+ geo.width = a_win->drawable.width;
+ geo.height = a_win->drawable.height;
+ hostx_set_window_geometry(pair->remote, &geo);
+ is_ok = TRUE;
+
+ out:
+ EPHYR_LOG("leave. is_ok:%d\n", is_ok);
+ /*do cleanup here */
+ return is_ok;
}
static void
-ephyrDRIClipNotify (WindowPtr a_win,
- int a_x, int a_y)
+ephyrDRIClipNotify(WindowPtr a_win, int a_x, int a_y)
{
- Bool is_ok=FALSE ;
- ScreenPtr screen=NULL ;
- EphyrDRIScreenPrivPtr screen_priv =NULL;
- EphyrDRIWindowPrivPtr win_priv=NULL ;
- EphyrWindowPair *pair=NULL ;
- EphyrRect *rects=NULL;
- int i=0 ;
-
- EPHYR_RETURN_IF_FAIL (a_win) ;
-
- EPHYR_LOG ("enter\n") ;
- screen = a_win->drawable.pScreen ;
- EPHYR_RETURN_IF_FAIL (screen) ;
- screen_priv = GET_EPHYR_DRI_SCREEN_PRIV (screen) ;
- EPHYR_RETURN_IF_FAIL (screen_priv && screen_priv->ClipNotify) ;
-
- screen->ClipNotify = screen_priv->ClipNotify ;
+ Bool is_ok = FALSE;
+ ScreenPtr screen = NULL;
+ EphyrDRIScreenPrivPtr screen_priv = NULL;
+ EphyrDRIWindowPrivPtr win_priv = NULL;
+ EphyrWindowPair *pair = NULL;
+ EphyrRect *rects = NULL;
+ int i = 0;
+
+ EPHYR_RETURN_IF_FAIL(a_win);
+
+ EPHYR_LOG("enter\n");
+ screen = a_win->drawable.pScreen;
+ EPHYR_RETURN_IF_FAIL(screen);
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(screen);
+ EPHYR_RETURN_IF_FAIL(screen_priv && screen_priv->ClipNotify);
+
+ screen->ClipNotify = screen_priv->ClipNotify;
if (screen->ClipNotify) {
- (*screen->ClipNotify) (a_win, a_x, a_y) ;
+ (*screen->ClipNotify) (a_win, a_x, a_y);
}
- screen->ClipNotify = ephyrDRIClipNotify ;
+ screen->ClipNotify = ephyrDRIClipNotify;
- EPHYR_LOG ("window: %p\n", a_win) ;
- win_priv = GET_EPHYR_DRI_WINDOW_PRIV (a_win) ;
+ EPHYR_LOG("window: %p\n", a_win);
+ win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
if (!win_priv) {
- EPHYR_LOG ("not a DRI peered window\n") ;
- is_ok = TRUE ;
- goto out ;
- }
- if (!findWindowPairFromLocal (a_win, &pair) || !pair) {
- EPHYR_LOG_ERROR ("failed to get window pair\n") ;
- goto out ;
- }
- rects = calloc(RegionNumRects (&a_win->clipList),
- sizeof (EphyrRect)) ;
- for (i=0; i < RegionNumRects (&a_win->clipList); i++) {
- memmove (&rects[i],
- &RegionRects (&a_win->clipList)[i],
- sizeof (EphyrRect)) ;
+ EPHYR_LOG("not a DRI peered window\n");
+ is_ok = TRUE;
+ goto out;
+ }
+ if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
+ EPHYR_LOG_ERROR("failed to get window pair\n");
+ goto out;
+ }
+ rects = calloc(RegionNumRects(&a_win->clipList), sizeof(EphyrRect));
+ for (i = 0; i < RegionNumRects(&a_win->clipList); i++) {
+ memmove(&rects[i],
+ &RegionRects(&a_win->clipList)[i], sizeof(EphyrRect));
rects[i].x1 -= a_win->drawable.x;
rects[i].x2 -= a_win->drawable.x;
rects[i].y1 -= a_win->drawable.y;
@@ -359,17 +344,15 @@ ephyrDRIClipNotify (WindowPtr a_win,
* to the peer window in the host
*/
is_ok = hostx_set_window_bounding_rectangles
- (pair->remote,
- rects,
- RegionNumRects (&a_win->clipList)) ;
- is_ok = TRUE ;
+ (pair->remote, rects, RegionNumRects(&a_win->clipList));
+ is_ok = TRUE;
-out:
- free(rects) ;
- rects = NULL ;
+ out:
+ free(rects);
+ rects = NULL;
- EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
- /*do cleanup here*/
+ EPHYR_LOG("leave. is_ok:%d\n", is_ok);
+ /*do cleanup here */
}
/**
@@ -382,119 +365,115 @@ out:
* of the screen.
*/
static Bool
-EphyrDuplicateVisual (unsigned int a_screen,
- short a_depth,
- short a_class,
- short a_bits_per_rgb_values,
- short a_colormap_entries,
- unsigned int a_red_mask,
- unsigned int a_green_mask,
- unsigned int a_blue_mask,
- unsigned int a_new_id)
+EphyrDuplicateVisual(unsigned int a_screen,
+ short a_depth,
+ short a_class,
+ short a_bits_per_rgb_values,
+ short a_colormap_entries,
+ unsigned int a_red_mask,
+ unsigned int a_green_mask,
+ unsigned int a_blue_mask, unsigned int a_new_id)
{
- Bool is_ok = FALSE, found_visual=FALSE, found_depth=FALSE ;
- ScreenPtr screen=NULL ;
- VisualRec new_visual, *new_visuals=NULL ;
- int i=0 ;
+ Bool is_ok = FALSE, found_visual = FALSE, found_depth = FALSE;
+ ScreenPtr screen = NULL;
+ VisualRec new_visual, *new_visuals = NULL;
+ int i = 0;
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (a_screen >= screenInfo.numScreens) {
- EPHYR_LOG_ERROR ("bad screen number\n") ;
+ EPHYR_LOG_ERROR("bad screen number\n");
goto out;
}
- memset (&new_visual, 0, sizeof (VisualRec)) ;
+ memset(&new_visual, 0, sizeof(VisualRec));
- /*get the screen pointed to by a_screen*/
- screen = screenInfo.screens[a_screen] ;
- EPHYR_RETURN_VAL_IF_FAIL (screen, FALSE) ;
+ /*get the screen pointed to by a_screen */
+ screen = screenInfo.screens[a_screen];
+ EPHYR_RETURN_VAL_IF_FAIL(screen, FALSE);
/*
* In that screen, first look for an existing visual that has the
* same characteristics as those passed in parameter
* to this function and copy it.
*/
- for (i=0; i < screen->numVisuals; i++) {
+ for (i = 0; i < screen->numVisuals; i++) {
if (screen->visuals[i].bitsPerRGBValue == a_bits_per_rgb_values &&
- screen->visuals[i].ColormapEntries == a_colormap_entries ) {
- /*copy the visual found*/
- memcpy (&new_visual, &screen->visuals[i], sizeof (new_visual)) ;
- new_visual.vid = a_new_id ;
- new_visual.class = a_class ;
- new_visual.redMask = a_red_mask ;
- new_visual.greenMask = a_green_mask ;
- new_visual.blueMask = a_blue_mask ;
- found_visual = TRUE ;
- EPHYR_LOG ("found a visual that matches visual id: %d\n",
- a_new_id) ;
+ screen->visuals[i].ColormapEntries == a_colormap_entries) {
+ /*copy the visual found */
+ memcpy(&new_visual, &screen->visuals[i], sizeof(new_visual));
+ new_visual.vid = a_new_id;
+ new_visual.class = a_class;
+ new_visual.redMask = a_red_mask;
+ new_visual.greenMask = a_green_mask;
+ new_visual.blueMask = a_blue_mask;
+ found_visual = TRUE;
+ EPHYR_LOG("found a visual that matches visual id: %d\n", a_new_id);
break;
}
}
if (!found_visual) {
- EPHYR_LOG ("did not find any visual matching %d\n", a_new_id) ;
- goto out ;
+ EPHYR_LOG("did not find any visual matching %d\n", a_new_id);
+ goto out;
}
/*
* be prepare to extend screen->visuals to add new_visual to it
*/
- new_visuals = calloc(screen->numVisuals+1, sizeof (VisualRec)) ;
- memmove (new_visuals,
- screen->visuals,
- screen->numVisuals*sizeof (VisualRec)) ;
- memmove (&new_visuals[screen->numVisuals],
- &new_visual,
- sizeof (VisualRec)) ;
+ new_visuals = calloc(screen->numVisuals + 1, sizeof(VisualRec));
+ memmove(new_visuals,
+ screen->visuals, screen->numVisuals * sizeof(VisualRec));
+ memmove(&new_visuals[screen->numVisuals], &new_visual, sizeof(VisualRec));
/*
* Now, in that same screen, update the screen->allowedDepths member.
* In that array, each element represents the visuals applicable to
* a given depth. So we need to add an entry matching the new visual
* that we are going to add to screen->visuals
*/
- for (i=0; i<screen->numDepths; i++) {
- VisualID *vids=NULL;
- DepthPtr cur_depth=NULL ;
- /*find the entry matching a_depth*/
+ for (i = 0; i < screen->numDepths; i++) {
+ VisualID *vids = NULL;
+ DepthPtr cur_depth = NULL;
+
+ /*find the entry matching a_depth */
if (screen->allowedDepths[i].depth != a_depth)
- continue ;
+ continue;
cur_depth = &screen->allowedDepths[i];
/*
* extend the list of visual IDs in that entry,
* so to add a_new_id in there.
*/
vids = realloc(cur_depth->vids,
- (cur_depth->numVids+1)*sizeof (VisualID));
+ (cur_depth->numVids + 1) * sizeof(VisualID));
if (!vids) {
- EPHYR_LOG_ERROR ("failed to realloc numids\n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to realloc numids\n");
+ goto out;
}
- vids[cur_depth->numVids] = a_new_id ;
+ vids[cur_depth->numVids] = a_new_id;
/*
* Okay now commit our change.
* Do really update screen->allowedDepths[i]
*/
- cur_depth->numVids++ ;
- cur_depth->vids = vids ;
- found_depth=TRUE;
+ cur_depth->numVids++;
+ cur_depth->vids = vids;
+ found_depth = TRUE;
}
if (!found_depth) {
- EPHYR_LOG_ERROR ("failed to update screen[%d]->allowedDepth\n",
- a_screen) ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to update screen[%d]->allowedDepth\n",
+ a_screen);
+ goto out;
}
/*
* Commit our change to screen->visuals
*/
- free(screen->visuals) ;
- screen->visuals = new_visuals ;
- screen->numVisuals++ ;
- new_visuals = NULL ;
-
- is_ok = TRUE ;
-out:
- free(new_visuals) ;
- new_visuals = NULL ;
-
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ free(screen->visuals);
+ screen->visuals = new_visuals;
+ screen->numVisuals++;
+ new_visuals = NULL;
+
+ is_ok = TRUE;
+ out:
+ free(new_visuals);
+ new_visuals = NULL;
+
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
/**
@@ -504,46 +483,45 @@ out:
* GLX.
*/
static Bool
-EphyrMirrorHostVisuals (ScreenPtr a_screen)
+EphyrMirrorHostVisuals(ScreenPtr a_screen)
{
- Bool is_ok=FALSE;
- EphyrHostVisualInfo *visuals=NULL;
- int nb_visuals=0, i=0;
-
- EPHYR_LOG ("enter\n") ;
- if (!hostx_get_visuals_info (&visuals, &nb_visuals)) {
- EPHYR_LOG_ERROR ("failed to get host visuals\n") ;
- goto out ;
- }
- for (i=0; i<nb_visuals; i++) {
- if (!EphyrDuplicateVisual (a_screen->myNum,
- visuals[i].depth,
- visuals[i].class,
- visuals[i].bits_per_rgb,
- visuals[i].colormap_size,
- visuals[i].red_mask,
- visuals[i].green_mask,
- visuals[i].blue_mask,
- visuals[i].visualid)) {
- EPHYR_LOG_ERROR ("failed to duplicate host visual %d\n",
- (int)visuals[i].visualid) ;
+ Bool is_ok = FALSE;
+ EphyrHostVisualInfo *visuals = NULL;
+ int nb_visuals = 0, i = 0;
+
+ EPHYR_LOG("enter\n");
+ if (!hostx_get_visuals_info(&visuals, &nb_visuals)) {
+ EPHYR_LOG_ERROR("failed to get host visuals\n");
+ goto out;
+ }
+ for (i = 0; i < nb_visuals; i++) {
+ if (!EphyrDuplicateVisual(a_screen->myNum,
+ visuals[i].depth,
+ visuals[i].class,
+ visuals[i].bits_per_rgb,
+ visuals[i].colormap_size,
+ visuals[i].red_mask,
+ visuals[i].green_mask,
+ visuals[i].blue_mask, visuals[i].visualid)) {
+ EPHYR_LOG_ERROR("failed to duplicate host visual %d\n",
+ (int) visuals[i].visualid);
}
}
- is_ok = TRUE ;
-out:
- EPHYR_LOG ("leave\n") ;
+ is_ok = TRUE;
+ out:
+ EPHYR_LOG("leave\n");
return is_ok;
}
-
static int
-ProcXF86DRIQueryVersion (register ClientPtr client)
+ProcXF86DRIQueryVersion(register ClientPtr client)
{
xXF86DRIQueryVersionReply rep;
+
REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
rep.type = X_Reply;
rep.length = 0;
@@ -552,72 +530,73 @@ ProcXF86DRIQueryVersion (register ClientPtr client)
rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
- swapl(&rep.patchVersion);
- }
- WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *)&rep);
- EPHYR_LOG ("leave\n") ;
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
+ swapl(&rep.patchVersion);
+ }
+ WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *) &rep);
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRIQueryDirectRenderingCapable (register ClientPtr client)
+ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
{
- xXF86DRIQueryDirectRenderingCapableReply rep;
+ xXF86DRIQueryDirectRenderingCapableReply rep;
Bool isCapable;
+
REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if (!ephyrDRIQueryDirectRenderingCapable (stuff->screen, &isCapable)) {
+ if (!ephyrDRIQueryDirectRenderingCapable(stuff->screen, &isCapable)) {
return BadValue;
}
rep.isCapable = isCapable;
if (!LocalClient(client) || client->swapped)
- rep.isCapable = 0;
+ rep.isCapable = 0;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
- WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply), (char *)&rep);
- EPHYR_LOG ("leave\n") ;
+ WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply),
+ (char *) &rep);
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRIOpenConnection (register ClientPtr client)
+ProcXF86DRIOpenConnection(register ClientPtr client)
{
xXF86DRIOpenConnectionReply rep;
- drm_handle_t hSAREA;
- char* busIdString = NULL;
+ drm_handle_t hSAREA;
+ char *busIdString = NULL;
+
REQUEST(xXF86DRIOpenConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
- if (!ephyrDRIOpenConnection(stuff->screen,
- &hSAREA,
- &busIdString)) {
+ if (!ephyrDRIOpenConnection(stuff->screen, &hSAREA, &busIdString)) {
return BadValue;
}
@@ -625,36 +604,39 @@ ProcXF86DRIOpenConnection (register ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.busIdStringLength = 0;
if (busIdString)
- rep.busIdStringLength = strlen(busIdString);
- rep.length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) - SIZEOF(xGenericReply) +
- pad_to_int32(rep.busIdStringLength));
+ rep.busIdStringLength = strlen(busIdString);
+ rep.length =
+ bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
+ SIZEOF(xGenericReply) +
+ pad_to_int32(rep.busIdStringLength));
- rep.hSAREALow = (CARD32)(hSAREA & 0xffffffff);
+ rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
#if defined(LONG64) && !defined(__linux__)
- rep.hSAREAHigh = (CARD32)(hSAREA >> 32);
+ rep.hSAREAHigh = (CARD32) (hSAREA >> 32);
#else
rep.hSAREAHigh = 0;
#endif
- WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *) &rep);
if (rep.busIdStringLength)
WriteToClient(client, rep.busIdStringLength, busIdString);
free(busIdString);
- EPHYR_LOG ("leave\n") ;
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRIAuthConnection (register ClientPtr client)
+ProcXF86DRIAuthConnection(register ClientPtr client)
{
xXF86DRIAuthConnectionReply rep;
+
REQUEST(xXF86DRIAuthConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
rep.type = X_Reply;
@@ -662,88 +644,88 @@ ProcXF86DRIAuthConnection (register ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.authenticated = 1;
- if (!ephyrDRIAuthConnection (stuff->screen, stuff->magic)) {
- ErrorF("Failed to authenticate %lu\n", (unsigned long)stuff->magic);
+ if (!ephyrDRIAuthConnection(stuff->screen, stuff->magic)) {
+ ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
rep.authenticated = 0;
}
- WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *)&rep);
- EPHYR_LOG ("leave\n") ;
+ WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *) &rep);
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRICloseConnection (register ClientPtr client)
+ProcXF86DRICloseConnection(register ClientPtr client)
{
REQUEST(xXF86DRICloseConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRICloseConnectionReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (stuff->screen >= screenInfo.numScreens) {
client->errorValue = stuff->screen;
return BadValue;
}
/*
- DRICloseConnection( screenInfo.screens[stuff->screen]);
- */
+ DRICloseConnection( screenInfo.screens[stuff->screen]);
+ */
- EPHYR_LOG ("leave\n") ;
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRIGetClientDriverName (register ClientPtr client)
+ProcXF86DRIGetClientDriverName(register ClientPtr client)
{
- xXF86DRIGetClientDriverNameReply rep;
- char* clientDriverName;
+ xXF86DRIGetClientDriverNameReply rep;
+ char *clientDriverName;
+
REQUEST(xXF86DRIGetClientDriverNameReq);
REQUEST_SIZE_MATCH(xXF86DRIGetClientDriverNameReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
- ephyrDRIGetClientDriverName (stuff->screen,
- (int *)&rep.ddxDriverMajorVersion,
- (int *)&rep.ddxDriverMinorVersion,
- (int *)&rep.ddxDriverPatchVersion,
- &clientDriverName);
+ ephyrDRIGetClientDriverName(stuff->screen,
+ (int *) &rep.ddxDriverMajorVersion,
+ (int *) &rep.ddxDriverMinorVersion,
+ (int *) &rep.ddxDriverPatchVersion,
+ &clientDriverName);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.clientDriverNameLength = 0;
if (clientDriverName)
- rep.clientDriverNameLength = strlen(clientDriverName);
+ rep.clientDriverNameLength = strlen(clientDriverName);
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
- SIZEOF(xGenericReply) +
- pad_to_int32(rep.clientDriverNameLength));
+ SIZEOF(xGenericReply) +
+ pad_to_int32(rep.clientDriverNameLength));
- WriteToClient(client,
- sizeof(xXF86DRIGetClientDriverNameReply), (char *)&rep);
+ WriteToClient(client,
+ sizeof(xXF86DRIGetClientDriverNameReply), (char *) &rep);
if (rep.clientDriverNameLength)
- WriteToClient(client,
- rep.clientDriverNameLength,
- clientDriverName);
- EPHYR_LOG ("leave\n") ;
+ WriteToClient(client, rep.clientDriverNameLength, clientDriverName);
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRICreateContext (register ClientPtr client)
+ProcXF86DRICreateContext(register ClientPtr client)
{
- xXF86DRICreateContextReply rep;
+ xXF86DRICreateContextReply rep;
ScreenPtr pScreen;
VisualPtr visual;
- int i=0;
- unsigned long context_id=0;
+ int i = 0;
+ unsigned long context_id = 0;
+
REQUEST(xXF86DRICreateContextReq);
REQUEST_SIZE_MATCH(xXF86DRICreateContextReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
rep.type = X_Reply;
@@ -755,205 +737,196 @@ ProcXF86DRICreateContext (register ClientPtr client)
/* Find the requested X visual */
for (i = 0; i < pScreen->numVisuals; i++, visual++)
- if (visual->vid == stuff->visual)
- break;
+ if (visual->vid == stuff->visual)
+ break;
if (i == pScreen->numVisuals) {
- /* No visual found */
- return BadValue;
+ /* No visual found */
+ return BadValue;
}
- context_id = stuff->context ;
- if (!ephyrDRICreateContext (stuff->screen,
- stuff->visual,
- &context_id,
- (drm_context_t *)&rep.hHWContext)) {
+ context_id = stuff->context;
+ if (!ephyrDRICreateContext(stuff->screen,
+ stuff->visual,
+ &context_id,
+ (drm_context_t *) & rep.hHWContext)) {
return BadValue;
}
- WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *)&rep);
- EPHYR_LOG ("leave\n") ;
+ WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *) &rep);
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRIDestroyContext (register ClientPtr client)
+ProcXF86DRIDestroyContext(register ClientPtr client)
{
REQUEST(xXF86DRIDestroyContextReq);
REQUEST_SIZE_MATCH(xXF86DRIDestroyContextReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (stuff->screen >= screenInfo.numScreens) {
client->errorValue = stuff->screen;
return BadValue;
}
- if (!ephyrDRIDestroyContext (stuff->screen, stuff->context)) {
- return BadValue;
- }
+ if (!ephyrDRIDestroyContext(stuff->screen, stuff->context)) {
+ return BadValue;
+ }
- EPHYR_LOG ("leave\n") ;
+ EPHYR_LOG("leave\n");
return Success;
}
static Bool
-getWindowVisual (const WindowPtr a_win,
- VisualPtr *a_visual)
+getWindowVisual(const WindowPtr a_win, VisualPtr * a_visual)
{
- int i=0, visual_id=0 ;
- EPHYR_RETURN_VAL_IF_FAIL (a_win
- && a_win->drawable.pScreen
- && a_win->drawable.pScreen->visuals,
- FALSE) ;
-
- visual_id = wVisual (a_win) ;
- for (i=0; i < a_win->drawable.pScreen->numVisuals; i++) {
+ int i = 0, visual_id = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_win
+ && a_win->drawable.pScreen
+ && a_win->drawable.pScreen->visuals, FALSE);
+
+ visual_id = wVisual(a_win);
+ for (i = 0; i < a_win->drawable.pScreen->numVisuals; i++) {
if (a_win->drawable.pScreen->visuals[i].vid == visual_id) {
- *a_visual = &a_win->drawable.pScreen->visuals[i] ;
- return TRUE ;
+ *a_visual = &a_win->drawable.pScreen->visuals[i];
+ return TRUE;
}
}
- return FALSE ;
+ return FALSE;
}
-
#define NUM_WINDOW_PAIRS 256
-static EphyrWindowPair window_pairs[NUM_WINDOW_PAIRS] ;
+static EphyrWindowPair window_pairs[NUM_WINDOW_PAIRS];
static Bool
-appendWindowPairToList (WindowPtr a_local,
- int a_remote)
+appendWindowPairToList(WindowPtr a_local, int a_remote)
{
- int i=0 ;
+ int i = 0;
- EPHYR_RETURN_VAL_IF_FAIL (a_local, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_local, FALSE);
- EPHYR_LOG ("(local,remote):(%p, %d)\n", a_local, a_remote) ;
+ EPHYR_LOG("(local,remote):(%p, %d)\n", a_local, a_remote);
- for (i=0; i < NUM_WINDOW_PAIRS; i++) {
+ for (i = 0; i < NUM_WINDOW_PAIRS; i++) {
if (window_pairs[i].local == NULL) {
- window_pairs[i].local = a_local ;
- window_pairs[i].remote = a_remote ;
- return TRUE ;
+ window_pairs[i].local = a_local;
+ window_pairs[i].remote = a_remote;
+ return TRUE;
}
}
- return FALSE ;
+ return FALSE;
}
static Bool
-findWindowPairFromLocal (WindowPtr a_local,
- EphyrWindowPair **a_pair)
+findWindowPairFromLocal(WindowPtr a_local, EphyrWindowPair ** a_pair)
{
- int i=0 ;
+ int i = 0;
- EPHYR_RETURN_VAL_IF_FAIL (a_pair && a_local, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_pair && a_local, FALSE);
- for (i=0; i < NUM_WINDOW_PAIRS; i++) {
+ for (i = 0; i < NUM_WINDOW_PAIRS; i++) {
if (window_pairs[i].local == a_local) {
- *a_pair = &window_pairs[i] ;
- EPHYR_LOG ("found (%p, %d)\n",
- (*a_pair)->local,
- (*a_pair)->remote) ;
- return TRUE ;
+ *a_pair = &window_pairs[i];
+ EPHYR_LOG("found (%p, %d)\n", (*a_pair)->local, (*a_pair)->remote);
+ return TRUE;
}
}
- return FALSE ;
+ return FALSE;
}
Bool
-findWindowPairFromRemote (int a_remote,
- EphyrWindowPair **a_pair)
+findWindowPairFromRemote(int a_remote, EphyrWindowPair ** a_pair)
{
- int i=0 ;
+ int i = 0;
- EPHYR_RETURN_VAL_IF_FAIL (a_pair, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_pair, FALSE);
- for (i=0; i < NUM_WINDOW_PAIRS; i++) {
+ for (i = 0; i < NUM_WINDOW_PAIRS; i++) {
if (window_pairs[i].remote == a_remote) {
- *a_pair = &window_pairs[i] ;
- EPHYR_LOG ("found (%p, %d)\n",
- (*a_pair)->local,
- (*a_pair)->remote) ;
- return TRUE ;
+ *a_pair = &window_pairs[i];
+ EPHYR_LOG("found (%p, %d)\n", (*a_pair)->local, (*a_pair)->remote);
+ return TRUE;
}
}
- return FALSE ;
+ return FALSE;
}
static Bool
-createHostPeerWindow (const WindowPtr a_win,
- int *a_peer_win)
+createHostPeerWindow(const WindowPtr a_win, int *a_peer_win)
{
- Bool is_ok=FALSE ;
- VisualPtr visual=NULL;
- EphyrBox geo ;
+ Bool is_ok = FALSE;
+ VisualPtr visual = NULL;
+ EphyrBox geo;
- EPHYR_RETURN_VAL_IF_FAIL (a_win && a_peer_win, FALSE) ;
- EPHYR_RETURN_VAL_IF_FAIL (a_win->drawable.pScreen,
- FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_win && a_peer_win, FALSE);
+ EPHYR_RETURN_VAL_IF_FAIL(a_win->drawable.pScreen, FALSE);
- EPHYR_LOG ("enter. a_win '%p'\n", a_win) ;
- if (!getWindowVisual (a_win, &visual)) {
- EPHYR_LOG_ERROR ("failed to get window visual\n") ;
- goto out ;
+ EPHYR_LOG("enter. a_win '%p'\n", a_win);
+ if (!getWindowVisual(a_win, &visual)) {
+ EPHYR_LOG_ERROR("failed to get window visual\n");
+ goto out;
}
if (!visual) {
- EPHYR_LOG_ERROR ("failed to create visual\n") ;
- goto out ;
- }
- memset (&geo, 0, sizeof (geo)) ;
- geo.x = a_win->drawable.x ;
- geo.y = a_win->drawable.y ;
- geo.width = a_win->drawable.width ;
- geo.height = a_win->drawable.height ;
- if (!hostx_create_window (a_win->drawable.pScreen->myNum,
- &geo, visual->vid, a_peer_win)) {
- EPHYR_LOG_ERROR ("failed to create host peer window\n") ;
- goto out ;
- }
- if (!appendWindowPairToList (a_win, *a_peer_win)) {
- EPHYR_LOG_ERROR ("failed to append window to pair list\n") ;
- goto out ;
- }
- is_ok = TRUE ;
-out:
- EPHYR_LOG ("leave:remote win%d\n", *a_peer_win) ;
- return is_ok ;
+ EPHYR_LOG_ERROR("failed to create visual\n");
+ goto out;
+ }
+ memset(&geo, 0, sizeof(geo));
+ geo.x = a_win->drawable.x;
+ geo.y = a_win->drawable.y;
+ geo.width = a_win->drawable.width;
+ geo.height = a_win->drawable.height;
+ if (!hostx_create_window(a_win->drawable.pScreen->myNum,
+ &geo, visual->vid, a_peer_win)) {
+ EPHYR_LOG_ERROR("failed to create host peer window\n");
+ goto out;
+ }
+ if (!appendWindowPairToList(a_win, *a_peer_win)) {
+ EPHYR_LOG_ERROR("failed to append window to pair list\n");
+ goto out;
+ }
+ is_ok = TRUE;
+ out:
+ EPHYR_LOG("leave:remote win%d\n", *a_peer_win);
+ return is_ok;
}
static Bool
-destroyHostPeerWindow (const WindowPtr a_win)
+destroyHostPeerWindow(const WindowPtr a_win)
{
- Bool is_ok = FALSE ;
- EphyrWindowPair *pair=NULL ;
- EPHYR_RETURN_VAL_IF_FAIL (a_win, FALSE) ;
+ Bool is_ok = FALSE;
+ EphyrWindowPair *pair = NULL;
- EPHYR_LOG ("enter\n") ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_win, FALSE);
- if (!findWindowPairFromLocal (a_win, &pair) || !pair) {
- EPHYR_LOG_ERROR ("failed to find peer to local window\n") ;
+ EPHYR_LOG("enter\n");
+
+ if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
+ EPHYR_LOG_ERROR("failed to find peer to local window\n");
goto out;
}
- hostx_destroy_window (pair->remote) ;
- is_ok = TRUE ;
+ hostx_destroy_window(pair->remote);
+ is_ok = TRUE;
-out:
- EPHYR_LOG ("leave\n") ;
+ out:
+ EPHYR_LOG("leave\n");
return is_ok;
}
static int
-ProcXF86DRICreateDrawable (ClientPtr client)
+ProcXF86DRICreateDrawable(ClientPtr client)
{
- xXF86DRICreateDrawableReply rep;
- DrawablePtr drawable=NULL;
- WindowPtr window=NULL ;
- EphyrWindowPair *pair=NULL ;
- EphyrDRIWindowPrivPtr win_priv=NULL;
- int rc=0, remote_win=0;
+ xXF86DRICreateDrawableReply rep;
+ DrawablePtr drawable = NULL;
+ WindowPtr window = NULL;
+ EphyrWindowPair *pair = NULL;
+ EphyrDRIWindowPrivPtr win_priv = NULL;
+ int rc = 0, remote_win = 0;
+
REQUEST(xXF86DRICreateDrawableReq);
REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (stuff->screen >= screenInfo.numScreens) {
client->errorValue = stuff->screen;
return BadValue;
@@ -963,108 +936,107 @@ ProcXF86DRICreateDrawable (ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rc = dixLookupDrawable (&drawable, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
+ DixReadAccess);
if (rc != Success)
return rc;
if (drawable->type != DRAWABLE_WINDOW) {
- EPHYR_LOG_ERROR ("non drawable windows are not yet supported\n") ;
- return BadImplementation ;
- }
- EPHYR_LOG ("lookedup drawable %p\n", drawable) ;
- window = (WindowPtr)drawable;
- if (findWindowPairFromLocal (window, &pair) && pair) {
- remote_win = pair->remote ;
- EPHYR_LOG ("found window '%p' paire with remote '%d'\n",
- window, remote_win) ;
- } else if (!createHostPeerWindow (window, &remote_win)) {
- EPHYR_LOG_ERROR ("failed to create host peer window\n") ;
- return BadAlloc ;
- }
-
- if (!ephyrDRICreateDrawable (stuff->screen,
- remote_win,
- (drm_drawable_t *)&rep.hHWDrawable)) {
- EPHYR_LOG_ERROR ("failed to create dri drawable\n") ;
+ EPHYR_LOG_ERROR("non drawable windows are not yet supported\n");
+ return BadImplementation;
+ }
+ EPHYR_LOG("lookedup drawable %p\n", drawable);
+ window = (WindowPtr) drawable;
+ if (findWindowPairFromLocal(window, &pair) && pair) {
+ remote_win = pair->remote;
+ EPHYR_LOG("found window '%p' paire with remote '%d'\n",
+ window, remote_win);
+ }
+ else if (!createHostPeerWindow(window, &remote_win)) {
+ EPHYR_LOG_ERROR("failed to create host peer window\n");
+ return BadAlloc;
+ }
+
+ if (!ephyrDRICreateDrawable(stuff->screen,
+ remote_win,
+ (drm_drawable_t *) & rep.hHWDrawable)) {
+ EPHYR_LOG_ERROR("failed to create dri drawable\n");
return BadValue;
}
- win_priv = GET_EPHYR_DRI_WINDOW_PRIV (window) ;
+ win_priv = GET_EPHYR_DRI_WINDOW_PRIV(window);
if (!win_priv) {
- win_priv = calloc(1, sizeof (EphyrDRIWindowPrivRec)) ;
+ win_priv = calloc(1, sizeof(EphyrDRIWindowPrivRec));
if (!win_priv) {
- EPHYR_LOG_ERROR ("failed to allocate window private\n") ;
- return BadAlloc ;
+ EPHYR_LOG_ERROR("failed to allocate window private\n");
+ return BadAlloc;
}
- dixSetPrivate(&window->devPrivates, ephyrDRIWindowKey, win_priv);
- EPHYR_LOG ("paired window '%p' with remote '%d'\n",
- window, remote_win) ;
+ dixSetPrivate(&window->devPrivates, ephyrDRIWindowKey, win_priv);
+ EPHYR_LOG("paired window '%p' with remote '%d'\n", window, remote_win);
}
- WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *)&rep);
- EPHYR_LOG ("leave\n") ;
+ WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *) &rep);
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRIDestroyDrawable (register ClientPtr client)
+ProcXF86DRIDestroyDrawable(register ClientPtr client)
{
- DrawablePtr drawable=NULL;
- WindowPtr window=NULL;
- EphyrWindowPair *pair=NULL;
- int rc=0;
+ DrawablePtr drawable = NULL;
+ WindowPtr window = NULL;
+ EphyrWindowPair *pair = NULL;
+ int rc = 0;
+
REQUEST(xXF86DRIDestroyDrawableReq);
REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (stuff->screen >= screenInfo.numScreens) {
client->errorValue = stuff->screen;
return BadValue;
}
rc = dixLookupDrawable(&drawable,
- stuff->drawable,
- client,
- 0,
- DixReadAccess);
+ stuff->drawable, client, 0, DixReadAccess);
if (rc != Success)
return rc;
if (drawable->type != DRAWABLE_WINDOW) {
- EPHYR_LOG_ERROR ("non drawable windows are not yet supported\n") ;
- return BadImplementation ;
+ EPHYR_LOG_ERROR("non drawable windows are not yet supported\n");
+ return BadImplementation;
}
- window = (WindowPtr)drawable;
- if (!findWindowPairFromLocal (window, &pair) && pair) {
- EPHYR_LOG_ERROR ("failed to find pair window\n") ;
+ window = (WindowPtr) drawable;
+ if (!findWindowPairFromLocal(window, &pair) && pair) {
+ EPHYR_LOG_ERROR("failed to find pair window\n");
return BadImplementation;
}
if (!ephyrDRIDestroyDrawable(stuff->screen,
- pair->remote/*drawable in host x*/)) {
- EPHYR_LOG_ERROR ("failed to destroy dri drawable\n") ;
+ pair->remote /*drawable in host x */ )) {
+ EPHYR_LOG_ERROR("failed to destroy dri drawable\n");
return BadImplementation;
}
- pair->local=NULL ;
- pair->remote=0;
+ pair->local = NULL;
+ pair->remote = 0;
- EPHYR_LOG ("leave\n") ;
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRIGetDrawableInfo (register ClientPtr client)
+ProcXF86DRIGetDrawableInfo(register ClientPtr client)
{
xXF86DRIGetDrawableInfoReply rep;
DrawablePtr drawable;
- WindowPtr window=NULL;
- EphyrWindowPair *pair=NULL;
- int X=0, Y=0, W=0, H=0, backX=0, backY=0, rc=0, i=0;
- drm_clip_rect_t *clipRects=NULL;
- drm_clip_rect_t *backClipRects=NULL;
+ WindowPtr window = NULL;
+ EphyrWindowPair *pair = NULL;
+ int X = 0, Y = 0, W = 0, H = 0, backX = 0, backY = 0, rc = 0, i = 0;
+ drm_clip_rect_t *clipRects = NULL;
+ drm_clip_rect_t *backClipRects = NULL;
+
REQUEST(xXF86DRIGetDrawableInfoReq);
REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
- EPHYR_LOG ("enter\n") ;
- memset (&rep, 0, sizeof (rep)) ;
+ EPHYR_LOG("enter\n");
+ memset(&rep, 0, sizeof(rep));
if (stuff->screen >= screenInfo.numScreens) {
client->errorValue = stuff->screen;
return BadValue;
@@ -1077,123 +1049,125 @@ ProcXF86DRIGetDrawableInfo (register ClientPtr client)
rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success || !drawable) {
- EPHYR_LOG_ERROR ("could not get drawable\n") ;
+ EPHYR_LOG_ERROR("could not get drawable\n");
return rc;
}
if (drawable->type != DRAWABLE_WINDOW) {
- EPHYR_LOG_ERROR ("non windows type drawables are not yes supported\n") ;
- return BadImplementation ;
- }
- window = (WindowPtr)drawable ;
- memset (&pair, 0, sizeof (pair)) ;
- if (!findWindowPairFromLocal (window, &pair) || !pair) {
- EPHYR_LOG_ERROR ("failed to find remote peer drawable\n") ;
- return BadMatch ;
- }
- EPHYR_LOG ("clip list of xephyr gl drawable:\n") ;
- for (i=0; i < RegionNumRects (&window->clipList); i++) {
- EPHYR_LOG ("x1:%d, y1:%d, x2:%d, y2:%d\n",
- RegionRects (&window->clipList)[i].x1,
- RegionRects (&window->clipList)[i].y1,
- RegionRects (&window->clipList)[i].x2,
- RegionRects (&window->clipList)[i].y2) ;
- }
-
- if (!ephyrDRIGetDrawableInfo (stuff->screen,
- pair->remote/*the drawable in hostx*/,
- (unsigned int*)&rep.drawableTableIndex,
- (unsigned int*)&rep.drawableTableStamp,
- (int*)&X,
- (int*)&Y,
- (int*)&W,
- (int*)&H,
- (int*)&rep.numClipRects,
- &clipRects,
- &backX,
- &backY,
- (int*)&rep.numBackClipRects,
- &backClipRects)) {
+ EPHYR_LOG_ERROR("non windows type drawables are not yes supported\n");
+ return BadImplementation;
+ }
+ window = (WindowPtr) drawable;
+ memset(&pair, 0, sizeof(pair));
+ if (!findWindowPairFromLocal(window, &pair) || !pair) {
+ EPHYR_LOG_ERROR("failed to find remote peer drawable\n");
+ return BadMatch;
+ }
+ EPHYR_LOG("clip list of xephyr gl drawable:\n");
+ for (i = 0; i < RegionNumRects(&window->clipList); i++) {
+ EPHYR_LOG("x1:%d, y1:%d, x2:%d, y2:%d\n",
+ RegionRects(&window->clipList)[i].x1,
+ RegionRects(&window->clipList)[i].y1,
+ RegionRects(&window->clipList)[i].x2,
+ RegionRects(&window->clipList)[i].y2);
+ }
+
+ if (!ephyrDRIGetDrawableInfo(stuff->screen,
+ pair->remote /*the drawable in hostx */ ,
+ (unsigned int *) &rep.drawableTableIndex,
+ (unsigned int *) &rep.drawableTableStamp,
+ (int *) &X,
+ (int *) &Y,
+ (int *) &W,
+ (int *) &H,
+ (int *) &rep.numClipRects,
+ &clipRects,
+ &backX,
+ &backY,
+ (int *) &rep.numBackClipRects,
+ &backClipRects)) {
return BadValue;
}
- EPHYR_LOG ("num clip rects:%d, num back clip rects:%d\n",
- (int)rep.numClipRects, (int)rep.numBackClipRects) ;
+ EPHYR_LOG("num clip rects:%d, num back clip rects:%d\n",
+ (int) rep.numClipRects, (int) rep.numBackClipRects);
rep.drawableX = X;
rep.drawableY = Y;
rep.drawableWidth = W;
rep.drawableHeight = H;
- rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) -
- SIZEOF(xGenericReply));
+ rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - SIZEOF(xGenericReply));
rep.backX = backX;
rep.backY = backY;
-
if (rep.numClipRects) {
if (clipRects) {
ScreenPtr pScreen = screenInfo.screens[stuff->screen];
- int i=0;
- EPHYR_LOG ("clip list of host gl drawable:\n") ;
+ int i = 0;
+
+ EPHYR_LOG("clip list of host gl drawable:\n");
for (i = 0; i < rep.numClipRects; i++) {
- clipRects[i].x1 = max (clipRects[i].x1, 0);
- clipRects[i].y1 = max (clipRects[i].y1, 0);
- clipRects[i].x2 = min (clipRects[i].x2,
- pScreen->width + clipRects[i].x1) ;
- clipRects[i].y2 = min (clipRects[i].y2,
- pScreen->width + clipRects[i].y1) ;
-
- EPHYR_LOG ("x1:%d, y1:%d, x2:%d, y2:%d\n",
- clipRects[i].x1, clipRects[i].y1,
- clipRects[i].x2, clipRects[i].y2) ;
+ clipRects[i].x1 = max(clipRects[i].x1, 0);
+ clipRects[i].y1 = max(clipRects[i].y1, 0);
+ clipRects[i].x2 = min(clipRects[i].x2,
+ pScreen->width + clipRects[i].x1);
+ clipRects[i].y2 = min(clipRects[i].y2,
+ pScreen->width + clipRects[i].y1);
+
+ EPHYR_LOG("x1:%d, y1:%d, x2:%d, y2:%d\n",
+ clipRects[i].x1, clipRects[i].y1,
+ clipRects[i].x2, clipRects[i].y2);
}
- } else {
+ }
+ else {
rep.numClipRects = 0;
}
- } else {
- EPHYR_LOG ("got zero host gl drawable clipping rects\n") ;
+ }
+ else {
+ EPHYR_LOG("got zero host gl drawable clipping rects\n");
}
rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
- backClipRects = clipRects ;
- rep.numBackClipRects = rep.numClipRects ;
+ backClipRects = clipRects;
+ rep.numBackClipRects = rep.numClipRects;
if (rep.numBackClipRects)
rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;
- EPHYR_LOG ("num host clip rects:%d\n", (int)rep.numClipRects) ;
- EPHYR_LOG ("num host back clip rects:%d\n", (int)rep.numBackClipRects) ;
+ EPHYR_LOG("num host clip rects:%d\n", (int) rep.numClipRects);
+ EPHYR_LOG("num host back clip rects:%d\n", (int) rep.numBackClipRects);
rep.length = bytes_to_int32(rep.length);
- WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *) &rep);
if (rep.numClipRects) {
WriteToClient(client,
sizeof(drm_clip_rect_t) * rep.numClipRects,
- (char *)clipRects);
+ (char *) clipRects);
}
if (rep.numBackClipRects) {
WriteToClient(client,
sizeof(drm_clip_rect_t) * rep.numBackClipRects,
- (char *)backClipRects);
+ (char *) backClipRects);
}
free(clipRects);
- clipRects = NULL ;
+ clipRects = NULL;
- EPHYR_LOG ("leave\n") ;
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRIGetDeviceInfo (register ClientPtr client)
+ProcXF86DRIGetDeviceInfo(register ClientPtr client)
{
- xXF86DRIGetDeviceInfoReply rep;
+ xXF86DRIGetDeviceInfoReply rep;
drm_handle_t hFrameBuffer;
void *pDevPrivate;
+
REQUEST(xXF86DRIGetDeviceInfoReq);
REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (stuff->screen >= screenInfo.numScreens) {
client->errorValue = stuff->screen;
return BadValue;
@@ -1203,19 +1177,18 @@ ProcXF86DRIGetDeviceInfo (register ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if (!ephyrDRIGetDeviceInfo (stuff->screen,
- &hFrameBuffer,
- (int*)&rep.framebufferOrigin,
- (int*)&rep.framebufferSize,
- (int*)&rep.framebufferStride,
- (int*)&rep.devPrivateSize,
- &pDevPrivate)) {
+ if (!ephyrDRIGetDeviceInfo(stuff->screen,
+ &hFrameBuffer,
+ (int *) &rep.framebufferOrigin,
+ (int *) &rep.framebufferSize,
+ (int *) &rep.framebufferStride,
+ (int *) &rep.devPrivateSize, &pDevPrivate)) {
return BadValue;
}
- rep.hFrameBufferLow = (CARD32)(hFrameBuffer & 0xffffffff);
+ rep.hFrameBufferLow = (CARD32) (hFrameBuffer & 0xffffffff);
#if defined(LONG64) && !defined(__linux__)
- rep.hFrameBufferHigh = (CARD32)(hFrameBuffer >> 32);
+ rep.hFrameBufferHigh = (CARD32) (hFrameBuffer >> 32);
#else
rep.hFrameBufferHigh = 0;
#endif
@@ -1223,91 +1196,89 @@ ProcXF86DRIGetDeviceInfo (register ClientPtr client)
rep.length = 0;
if (rep.devPrivateSize) {
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
- SIZEOF(xGenericReply) +
- pad_to_int32(rep.devPrivateSize));
+ SIZEOF(xGenericReply) +
+ pad_to_int32(rep.devPrivateSize));
}
- WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *) &rep);
if (rep.length) {
- WriteToClient(client, rep.devPrivateSize, (char *)pDevPrivate);
+ WriteToClient(client, rep.devPrivateSize, (char *) pDevPrivate);
}
- EPHYR_LOG ("leave\n") ;
+ EPHYR_LOG("leave\n");
return Success;
}
static int
-ProcXF86DRIDispatch (register ClientPtr client)
+ProcXF86DRIDispatch(register ClientPtr client)
{
REQUEST(xReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
- switch (stuff->data)
- {
- case X_XF86DRIQueryVersion: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRIQueryVersion(client);
- }
- case X_XF86DRIQueryDirectRenderingCapable: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRIQueryDirectRenderingCapable(client);
- }
+ switch (stuff->data) {
+ case X_XF86DRIQueryVersion:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRIQueryVersion(client);
+ }
+ case X_XF86DRIQueryDirectRenderingCapable:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRIQueryDirectRenderingCapable(client);
+ }
}
if (!LocalClient(client))
return DRIErrorBase + XF86DRIClientNotLocal;
- switch (stuff->data)
- {
- case X_XF86DRIOpenConnection: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRIOpenConnection(client);
- }
- case X_XF86DRICloseConnection: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRICloseConnection(client);
- }
- case X_XF86DRIGetClientDriverName: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRIGetClientDriverName(client);
- }
- case X_XF86DRICreateContext: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRICreateContext(client);
- }
- case X_XF86DRIDestroyContext: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRIDestroyContext(client);
- }
- case X_XF86DRICreateDrawable: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRICreateDrawable(client);
- }
- case X_XF86DRIDestroyDrawable: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRIDestroyDrawable(client);
- }
- case X_XF86DRIGetDrawableInfo: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRIGetDrawableInfo(client);
- }
- case X_XF86DRIGetDeviceInfo: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRIGetDeviceInfo(client);
- }
- case X_XF86DRIAuthConnection: {
- EPHYR_LOG ("leave\n") ;
- return ProcXF86DRIAuthConnection(client);
- }
- /* {Open,Close}FullScreen are deprecated now */
- default: {
- EPHYR_LOG ("leave\n") ;
- return BadRequest;
- }
+ switch (stuff->data) {
+ case X_XF86DRIOpenConnection:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRIOpenConnection(client);
+ }
+ case X_XF86DRICloseConnection:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRICloseConnection(client);
+ }
+ case X_XF86DRIGetClientDriverName:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRIGetClientDriverName(client);
+ }
+ case X_XF86DRICreateContext:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRICreateContext(client);
+ }
+ case X_XF86DRIDestroyContext:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRIDestroyContext(client);
+ }
+ case X_XF86DRICreateDrawable:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRICreateDrawable(client);
+ }
+ case X_XF86DRIDestroyDrawable:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRIDestroyDrawable(client);
+ }
+ case X_XF86DRIGetDrawableInfo:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRIGetDrawableInfo(client);
+ }
+ case X_XF86DRIGetDeviceInfo:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRIGetDeviceInfo(client);
+ }
+ case X_XF86DRIAuthConnection:{
+ EPHYR_LOG("leave\n");
+ return ProcXF86DRIAuthConnection(client);
+ }
+ /* {Open,Close}FullScreen are deprecated now */
+ default:{
+ EPHYR_LOG("leave\n");
+ return BadRequest;
+ }
}
}
static int
-SProcXF86DRIQueryVersion (register ClientPtr client)
+SProcXF86DRIQueryVersion(register ClientPtr client)
{
REQUEST(xXF86DRIQueryVersionReq);
swaps(&stuff->length);
@@ -1315,7 +1286,7 @@ SProcXF86DRIQueryVersion (register ClientPtr client)
}
static int
-SProcXF86DRIQueryDirectRenderingCapable (register ClientPtr client)
+SProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
{
REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
swaps(&stuff->length);
@@ -1324,90 +1295,89 @@ SProcXF86DRIQueryDirectRenderingCapable (register ClientPtr client)
}
static int
-SProcXF86DRIDispatch (register ClientPtr client)
+SProcXF86DRIDispatch(register ClientPtr client)
{
REQUEST(xReq);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
/*
* Only local clients are allowed DRI access, but remote clients still need
* these requests to find out cleanly.
*/
- switch (stuff->data)
- {
- case X_XF86DRIQueryVersion: {
- EPHYR_LOG ("leave\n") ;
- return SProcXF86DRIQueryVersion(client);
- }
- case X_XF86DRIQueryDirectRenderingCapable: {
- EPHYR_LOG ("leave\n") ;
- return SProcXF86DRIQueryDirectRenderingCapable(client);
- }
- default: {
- EPHYR_LOG ("leave\n") ;
- return DRIErrorBase + XF86DRIClientNotLocal;
- }
+ switch (stuff->data) {
+ case X_XF86DRIQueryVersion:{
+ EPHYR_LOG("leave\n");
+ return SProcXF86DRIQueryVersion(client);
+ }
+ case X_XF86DRIQueryDirectRenderingCapable:{
+ EPHYR_LOG("leave\n");
+ return SProcXF86DRIQueryDirectRenderingCapable(client);
+ }
+ default:{
+ EPHYR_LOG("leave\n");
+ return DRIErrorBase + XF86DRIClientNotLocal;
+ }
}
}
Bool
-ephyrDRIExtensionInit (ScreenPtr a_screen)
+ephyrDRIExtensionInit(ScreenPtr a_screen)
{
- Bool is_ok=FALSE ;
- ExtensionEntry* extEntry=NULL;
- EphyrDRIScreenPrivPtr screen_priv=NULL ;
+ Bool is_ok = FALSE;
+ ExtensionEntry *extEntry = NULL;
+ EphyrDRIScreenPrivPtr screen_priv = NULL;
- EPHYR_LOG ("enter\n") ;
- if (!hostx_has_dri ()) {
- EPHYR_LOG ("host does not have DRI extension\n") ;
- goto out ;
+ EPHYR_LOG("enter\n");
+ if (!hostx_has_dri()) {
+ EPHYR_LOG("host does not have DRI extension\n");
+ goto out;
}
- EPHYR_LOG ("host X does have DRI extension\n") ;
- if (!hostx_has_xshape ()) {
- EPHYR_LOG ("host does not have XShape extension\n") ;
- goto out ;
+ EPHYR_LOG("host X does have DRI extension\n");
+ if (!hostx_has_xshape()) {
+ EPHYR_LOG("host does not have XShape extension\n");
+ goto out;
}
- EPHYR_LOG ("host X does have XShape extension\n") ;
+ EPHYR_LOG("host X does have XShape extension\n");
#ifdef XF86DRI_EVENTS
- EventType = CreateNewResourceType (XF86DRIFreeEvents, "DRIEvents");
+ EventType = CreateNewResourceType(XF86DRIFreeEvents, "DRIEvents");
if (!EventType) {
- EPHYR_LOG_ERROR ("failed to register DRI event resource type\n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to register DRI event resource type\n");
+ goto out;
}
#endif
if ((extEntry = AddExtension(XF86DRINAME,
- XF86DRINumberEvents,
- XF86DRINumberErrors,
- ProcXF86DRIDispatch,
- SProcXF86DRIDispatch,
- NULL,
- StandardMinorOpcode))) {
- DRIReqCode = (unsigned char)extEntry->base;
- DRIErrorBase = extEntry->errorBase;
- } else {
- EPHYR_LOG_ERROR ("failed to register DRI extension\n") ;
- goto out ;
+ XF86DRINumberEvents,
+ XF86DRINumberErrors,
+ ProcXF86DRIDispatch,
+ SProcXF86DRIDispatch,
+ NULL, StandardMinorOpcode))) {
+ DRIReqCode = (unsigned char) extEntry->base;
+ DRIErrorBase = extEntry->errorBase;
+ }
+ else {
+ EPHYR_LOG_ERROR("failed to register DRI extension\n");
+ goto out;
}
if (!dixRegisterPrivateKey(&ephyrDRIScreenKeyRec, PRIVATE_SCREEN, 0))
- goto out ;
+ goto out;
if (!dixRegisterPrivateKey(&ephyrDRIWindowKeyRec, PRIVATE_WINDOW, 0))
- goto out ;
- screen_priv = calloc(1, sizeof (EphyrDRIScreenPrivRec)) ;
+ goto out;
+ screen_priv = calloc(1, sizeof(EphyrDRIScreenPrivRec));
if (!screen_priv) {
- EPHYR_LOG_ERROR ("failed to allocate screen_priv\n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to allocate screen_priv\n");
+ goto out;
}
dixSetPrivate(&a_screen->devPrivates, ephyrDRIScreenKey, screen_priv);
- if (!ephyrDRIScreenInit (a_screen)) {
- EPHYR_LOG_ERROR ("ephyrDRIScreenInit() failed\n") ;
- goto out ;
+ if (!ephyrDRIScreenInit(a_screen)) {
+ EPHYR_LOG_ERROR("ephyrDRIScreenInit() failed\n");
+ goto out;
}
- EphyrMirrorHostVisuals (a_screen) ;
- is_ok=TRUE ;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ EphyrMirrorHostVisuals(a_screen);
+ is_ok = TRUE;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.h b/xorg-server/hw/kdrive/ephyr/ephyrdriext.h
index 01c9421fb..5808576fe 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.h
@@ -29,14 +29,12 @@
#define __EPHYRDRIEXT_H__
typedef struct {
- WindowPtr local ;
- int remote ;
+ WindowPtr local;
+ int remote;
} EphyrWindowPair;
-Bool ephyrDRIExtensionInit (ScreenPtr a_screen) ;
+Bool ephyrDRIExtensionInit(ScreenPtr a_screen);
-Bool findWindowPairFromRemote (int a_remote,
- EphyrWindowPair **a_pair);
+Bool findWindowPairFromRemote(int a_remote, EphyrWindowPair ** a_pair);
#endif /*__EPHYRDRIEXT_H__*/
-
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrglxext.c b/xorg-server/hw/kdrive/ephyr/ephyrglxext.c
index d6b8ca66d..dab028bf3 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrglxext.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrglxext.c
@@ -1,723 +1,711 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum@openedhand.com>
- *
- * Copyright © 2007 OpenedHand Ltd
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of OpenedHand Ltd not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OpenedHand Ltd makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors:
- * Dodji Seketeli <dodji@openedhand.com>
- */
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-
-#include "extnsionst.h"
-#include "ephyrglxext.h"
-#include "ephyrhostglx.h"
-#define _HAVE_XALLOC_DECLS
-#include "ephyrlog.h"
-#include <GL/glxproto.h>
-#include "glx/glxserver.h"
-#include "glx/indirect_table.h"
-#include "glx/indirect_util.h"
-#include "glx/unpack.h"
-#include "hostx.h"
-
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-
-int ephyrGLXQueryVersion (__GLXclientState *cl, GLbyte *pc) ;
-int ephyrGLXQueryVersionSwap (__GLXclientState *cl, GLbyte *pc) ;
-int ephyrGLXGetVisualConfigs (__GLXclientState *cl, GLbyte *pc) ;
-int ephyrGLXGetVisualConfigsSwap (__GLXclientState *cl, GLbyte *pc) ;
-int ephyrGLXClientInfo(__GLXclientState *cl, GLbyte *pc) ;
-int ephyrGLXClientInfoSwap(__GLXclientState *cl, GLbyte *pc) ;
-int ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXQueryServerStringSwap(__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXGetFBConfigsSGIX (__GLXclientState *a_cl, GLbyte *a_pc);
-int ephyrGLXGetFBConfigsSGIXSwap (__GLXclientState *a_cl, GLbyte *a_pc);
-int ephyrGLXCreateContext (__GLXclientState *a_cl, GLbyte *a_pc);
-int ephyrGLXCreateContextSwap (__GLXclientState *a_cl, GLbyte *a_pc);
-int ephyrGLXDestroyContext (__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXDestroyContextSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXMakeCurrent (__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXMakeCurrentSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXGetString (__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXGetStringSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXGetIntegerv (__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXGetIntegervSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXIsDirect (__GLXclientState *a_cl, GLbyte *a_pc) ;
-int ephyrGLXIsDirectSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
-
-Bool
-ephyrHijackGLXExtension (void)
-{
- const void *(*dispatch_functions)[2];
-
- if (!hostx_has_glx ()) {
- EPHYR_LOG ("host X does not have GLX\n") ;
- return FALSE ;
- }
- EPHYR_LOG ("host X does have GLX\n") ;
-
- if (!Single_dispatch_info.dispatch_functions) {
- EPHYR_LOG_ERROR ("could not get dispatch functions table\n") ;
- return FALSE ;
- }
- /*
- * hijack some single entry point dispatch functions
- */
- dispatch_functions = Single_dispatch_info.dispatch_functions ;
- EPHYR_RETURN_VAL_IF_FAIL (dispatch_functions, FALSE) ;
-
- dispatch_functions[X_GLXQueryVersion][0] = ephyrGLXQueryVersion ;
- dispatch_functions[X_GLXQueryVersion][1] = ephyrGLXQueryVersionSwap ;
-
- dispatch_functions[X_GLXGetVisualConfigs][0] = ephyrGLXGetVisualConfigs ;
- dispatch_functions[X_GLXGetVisualConfigs][1] = ephyrGLXGetVisualConfigsSwap ;
- dispatch_functions[X_GLXClientInfo][0] = ephyrGLXClientInfo ;
- dispatch_functions[X_GLXClientInfo][1] = ephyrGLXClientInfoSwap ;
-
- dispatch_functions[X_GLXQueryServerString][0] = ephyrGLXQueryServerString ;
- dispatch_functions[X_GLXQueryServerString][1] =
- ephyrGLXQueryServerStringSwap ;
-
- dispatch_functions[X_GLXCreateContext][0] = ephyrGLXCreateContext ;
- dispatch_functions[X_GLXCreateContext][1] = ephyrGLXCreateContextSwap ;
-
- dispatch_functions[X_GLXDestroyContext][0] = ephyrGLXDestroyContext ;
- dispatch_functions[X_GLXDestroyContext][1] = ephyrGLXDestroyContextSwap ;
-
- dispatch_functions[X_GLXMakeCurrent][0] = ephyrGLXMakeCurrent ;
- dispatch_functions[X_GLXMakeCurrent][1] = ephyrGLXMakeCurrentSwap ;
-
- dispatch_functions[X_GLXIsDirect][0] = ephyrGLXIsDirect ;
- dispatch_functions[X_GLXIsDirect][1] = ephyrGLXIsDirectSwap ;
-
- dispatch_functions[73][0] = ephyrGLXGetString ;
- dispatch_functions[73][1] = ephyrGLXGetStringSwap ;
-
- dispatch_functions[61][0] = ephyrGLXGetIntegerv ;
- dispatch_functions[61][1] = ephyrGLXGetIntegervSwap ;
-
- /*
- * hijack some vendor priv entry point dispatch functions
- */
- dispatch_functions = VendorPriv_dispatch_info.dispatch_functions ;
- dispatch_functions[92][0] = ephyrGLXGetFBConfigsSGIX;
- dispatch_functions[92][1] = ephyrGLXGetFBConfigsSGIXSwap;
- EPHYR_LOG ("hijacked glx entry points to forward requests to host X\n") ;
-
- return TRUE ;
-}
-
-/*********************
- * implementation of
- * hijacked GLX entry
- * points
- ********************/
-
-int
-ephyrGLXQueryVersion(__GLXclientState *a_cl, GLbyte *a_pc)
-{
- ClientPtr client = a_cl->client;
- xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) a_pc;
- xGLXQueryVersionReply reply;
- int major, minor;
- int res = BadImplementation ;
-
- EPHYR_LOG ("enter\n") ;
-
- major = req->majorVersion ;
- minor = req->minorVersion ;
-
- if (!ephyrHostGLXQueryVersion (&major, &minor)) {
- EPHYR_LOG_ERROR ("ephyrHostGLXQueryVersion() failed\n") ;
- goto out ;
- }
- EPHYR_LOG ("major:%d, minor:%d\n",
- major, minor);
- reply.majorVersion = major ;
- reply.minorVersion = minor ;
- reply.length = 0 ;
- reply.type = X_Reply ;
- reply.sequenceNumber = client->sequence ;
-
- if (client->swapped) {
- __glXSwapQueryVersionReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
- }
-
- res = Success ;
-out:
- EPHYR_LOG ("leave\n") ;
- return res;
-}
-
-int
-ephyrGLXQueryVersionSwap (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) a_pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_SHORT (&req->length);
- __GLX_SWAP_INT (&req->majorVersion);
- __GLX_SWAP_INT (&req->minorVersion);
- return ephyrGLXQueryVersion (a_cl, a_pc) ;
-}
-
-static int
-ephyrGLXGetVisualConfigsReal (__GLXclientState *a_cl,
- GLbyte *a_pc,
- Bool a_do_swap)
-{
- xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) a_pc;
- ClientPtr client = a_cl->client;
- xGLXGetVisualConfigsReply reply;
- int32_t *props_buf=NULL, num_visuals=0,
- num_props=0, res=BadImplementation, i=0,
- props_per_visual_size=0,
- props_buf_size=0;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- EPHYR_LOG ("enter\n") ;
-
- if (!ephyrHostGLXGetVisualConfigs (req->screen,
- &num_visuals,
- &num_props,
- &props_buf_size,
- &props_buf)) {
- EPHYR_LOG_ERROR ("ephyrHostGLXGetVisualConfigs() failed\n") ;
- goto out ;
- }
- EPHYR_LOG ("num_visuals:%d, num_props:%d\n", num_visuals, num_props) ;
-
- reply.numVisuals = num_visuals;
- reply.numProps = num_props;
- reply.length = (num_visuals *__GLX_SIZE_CARD32 * num_props) >> 2;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
-
- if (a_do_swap) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numVisuals);
- __GLX_SWAP_INT(&reply.numProps);
- __GLX_SWAP_INT_ARRAY (props_buf, num_props) ;
- }
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char*)&reply);
- props_per_visual_size = props_buf_size/num_visuals ;
- for (i=0; i < num_visuals; i++) {
- WriteToClient (client,
- props_per_visual_size,
- (char*)props_buf +i*props_per_visual_size);
- }
- res = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- free(props_buf) ;
- props_buf = NULL ;
-
- return res ;
-}
-
-static int
-ephyrGLXGetFBConfigsSGIXReal (__GLXclientState *a_cl,
- GLbyte *a_pc,
- Bool a_do_swap)
-{
- xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)a_pc;
- ClientPtr client = a_cl->client;
- xGLXGetVisualConfigsReply reply;
- int32_t *props_buf=NULL, num_visuals=0,
- num_props=0, res=BadImplementation, i=0,
- props_per_visual_size=0,
- props_buf_size=0;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- EPHYR_LOG ("enter\n") ;
-
- if (!ephyrHostGLXVendorPrivGetFBConfigsSGIX (req->screen,
- &num_visuals,
- &num_props,
- &props_buf_size,
- &props_buf)) {
- EPHYR_LOG_ERROR ("ephyrHostGLXGetVisualConfigs() failed\n") ;
- goto out ;
- }
- EPHYR_LOG ("num_visuals:%d, num_props:%d\n", num_visuals, num_props) ;
-
- reply.numVisuals = num_visuals;
- reply.numProps = num_props;
- reply.length = props_buf_size >> 2;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
-
- if (a_do_swap) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numVisuals);
- __GLX_SWAP_INT(&reply.numProps);
- __GLX_SWAP_INT_ARRAY (props_buf, num_props) ;
- }
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char*)&reply);
- props_per_visual_size = props_buf_size/num_visuals ;
- for (i=0; i < num_visuals; i++) {
- WriteToClient (client,
- props_per_visual_size,
- &((char*)props_buf)[i*props_per_visual_size]);
- }
- res = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- free(props_buf) ;
- props_buf = NULL ;
-
- return res ;
-}
-
-int
-ephyrGLXGetVisualConfigs (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXGetVisualConfigsReal (a_cl, a_pc, FALSE) ;
-}
-
-int
-ephyrGLXGetVisualConfigsSwap (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXGetVisualConfigsReal (a_cl, a_pc, TRUE) ;
-}
-
-
-int
-ephyrGLXClientInfo(__GLXclientState *a_cl, GLbyte *a_pc)
-{
- int res=BadImplementation ;
- xGLXClientInfoReq *req = (xGLXClientInfoReq *) a_pc;
-
- EPHYR_LOG ("enter\n") ;
- if (!ephyrHostGLXSendClientInfo (req->major, req->minor, (char*)req+1)) {
- EPHYR_LOG_ERROR ("failed to send client info to host\n") ;
- goto out ;
- }
- res = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return res ;
-}
-
-int
-ephyrGLXClientInfoSwap (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- xGLXClientInfoReq *req = (xGLXClientInfoReq *)a_pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_SHORT (&req->length);
- __GLX_SWAP_INT (&req->major);
- __GLX_SWAP_INT (&req->minor);
- __GLX_SWAP_INT (&req->numbytes);
-
- return ephyrGLXClientInfo (a_cl, a_pc) ;
-}
-
-int
-ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc)
-{
- int res = BadImplementation ;
- ClientPtr client = a_cl->client;
- xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) a_pc;
- xGLXQueryServerStringReply reply;
- char *server_string=NULL, *buf=NULL;
- int length=0 ;
-
- EPHYR_LOG ("enter\n") ;
- if (!ephyrHostGLXGetStringFromServer (req->screen,
- req->name,
- EPHYR_HOST_GLX_QueryServerString,
- &server_string)) {
- EPHYR_LOG_ERROR ("failed to query string from host\n") ;
- goto out ;
- }
- EPHYR_LOG ("string: %s\n", server_string) ;
- length= strlen (server_string) + 1;
- reply.type = X_Reply ;
- reply.sequenceNumber = client->sequence ;
- reply.length = __GLX_PAD (length) >> 2 ;
- reply.n = length ;
- buf = calloc(reply.length << 2, 1);
- if (!buf) {
- EPHYR_LOG_ERROR ("failed to allocate string\n;");
- return BadAlloc;
- }
- memcpy (buf, server_string, length);
-
- WriteToClient(client, sz_xGLXQueryServerStringReply, (char*)&reply);
- WriteToClient(client, (int)(reply.length << 2), server_string);
-
- res = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- free(server_string) ;
- server_string = NULL;
-
- free(buf);
- buf = NULL;
-
- return res ;
-}
-
-int
-ephyrGLXQueryServerStringSwap(__GLXclientState *a_cl, GLbyte *a_pc)
-{
- EPHYR_LOG_ERROR ("not yet implemented\n") ;
- return BadImplementation ;
-}
-
-
-int
-ephyrGLXGetFBConfigsSGIX (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXGetFBConfigsSGIXReal (a_cl, a_pc, FALSE) ;
-}
-
-int
-ephyrGLXGetFBConfigsSGIXSwap (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXGetFBConfigsSGIXReal (a_cl, a_pc, TRUE) ;
-}
-
-static int
-ephyrGLXCreateContextReal (xGLXCreateContextReq *a_req, Bool a_do_swap)
-{
- int res=BadImplementation;
- EphyrHostWindowAttributes host_w_attrs ;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_req, BadValue) ;
- EPHYR_LOG ("enter\n") ;
-
- if (a_do_swap) {
- __GLX_SWAP_SHORT(&a_req->length);
- __GLX_SWAP_INT(&a_req->context);
- __GLX_SWAP_INT(&a_req->visual);
- __GLX_SWAP_INT(&a_req->screen);
- __GLX_SWAP_INT(&a_req->shareList);
- }
-
- EPHYR_LOG ("context creation requested. localid:%d, "
- "screen:%d, visual:%d, direct:%d\n",
- (int)a_req->context, (int)a_req->screen,
- (int)a_req->visual, (int)a_req->isDirect) ;
-
- memset (&host_w_attrs, 0, sizeof (host_w_attrs)) ;
- if (!hostx_get_window_attributes (hostx_get_window (a_req->screen),
- &host_w_attrs)) {
- EPHYR_LOG_ERROR ("failed to get host window attrs\n") ;
- goto out ;
- }
-
- EPHYR_LOG ("host window visual id: %d\n", host_w_attrs.visualid) ;
-
- if (!ephyrHostGLXCreateContext (a_req->screen,
- host_w_attrs.visualid,
- a_req->context,
- a_req->shareList,
- a_req->isDirect)) {
- EPHYR_LOG_ERROR ("ephyrHostGLXCreateContext() failed\n") ;
- goto out ;
- }
- res = Success;
-out:
- EPHYR_LOG ("leave\n") ;
- return res ;
-}
-
-int
-ephyrGLXCreateContext (__GLXclientState *cl, GLbyte *pc)
-{
- xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
-
- return ephyrGLXCreateContextReal (req, FALSE) ;
-}
-
-int ephyrGLXCreateContextSwap (__GLXclientState *cl, GLbyte *pc)
-{
- xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
- return ephyrGLXCreateContextReal (req, TRUE) ;
-}
-
-static int
-ephyrGLXDestroyContextReal (__GLXclientState *a_cl,
- GLbyte *a_pc,
- Bool a_do_swap)
-{
- int res=BadImplementation;
- ClientPtr client = a_cl->client;
- xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) a_pc;
-
- EPHYR_LOG ("enter. id:%d\n", (int)req->context) ;
- if (!ephyrHostDestroyContext (req->context)) {
- EPHYR_LOG_ERROR ("ephyrHostDestroyContext() failed\n") ;
- client->errorValue = req->context ;
- goto out ;
- }
- res = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return res ;
-}
-
-int
-ephyrGLXDestroyContext (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXDestroyContextReal (a_cl, a_pc, FALSE) ;
-}
-
-int
-ephyrGLXDestroyContextSwap (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXDestroyContextReal (a_cl, a_pc, TRUE) ;
-}
-
-static int
-ephyrGLXMakeCurrentReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
-{
- int res=BadImplementation;
- xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
- xGLXMakeCurrentReply reply ;
- DrawablePtr drawable=NULL;
- int rc=0;
-
- EPHYR_LOG ("enter\n") ;
- rc = dixLookupDrawable (&drawable,
- req->drawable,
- a_cl->client,
- 0,
- DixReadAccess);
- EPHYR_RETURN_VAL_IF_FAIL (drawable, BadValue) ;
- EPHYR_RETURN_VAL_IF_FAIL (drawable->pScreen, BadValue) ;
- EPHYR_LOG ("screen nummber requested:%d\n",
- drawable->pScreen->myNum) ;
-
- memset (&reply, 0, sizeof (reply)) ;
- if (!ephyrHostGLXMakeCurrent (hostx_get_window (drawable->pScreen->myNum),
- req->context,
- req->oldContextTag,
- (int*)&reply.contextTag)) {
- EPHYR_LOG_ERROR ("ephyrHostGLXMakeCurrent() failed\n") ;
- goto out;
- }
- reply.length = 0;
- reply.type = X_Reply;
- reply.sequenceNumber = a_cl->client->sequence;
- if (a_do_swap) {
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.contextTag);
- }
- WriteToClient(a_cl->client, sz_xGLXMakeCurrentReply, (char *)&reply);
-
- res = Success ;
-out:
- EPHYR_LOG ("leave\n") ;
- return res ;
-}
-
-int
-ephyrGLXMakeCurrent (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXMakeCurrentReal (a_cl, a_pc, FALSE) ;
-}
-
-int
-ephyrGLXMakeCurrentSwap (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXMakeCurrentReal (a_cl, a_pc, TRUE) ;
-}
-
-static int
-ephyrGLXGetStringReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
-{
- ClientPtr client=NULL ;
- int context_tag=0, name=0, res=BadImplementation, length=0 ;
- char *string=NULL;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_cl && a_pc, BadValue) ;
-
- EPHYR_LOG ("enter\n") ;
-
- client = a_cl->client ;
-
- if (a_do_swap) {
- __GLX_SWAP_INT (a_pc + 4);
- __GLX_SWAP_INT (a_pc + __GLX_SINGLE_HDR_SIZE);
- }
- context_tag = __GLX_GET_SINGLE_CONTEXT_TAG (a_pc) ;
- a_pc += __GLX_SINGLE_HDR_SIZE;
- name = *(GLenum*)(a_pc + 0);
- EPHYR_LOG ("context_tag:%d, name:%d\n", context_tag, name) ;
- if (!ephyrHostGLXGetStringFromServer (context_tag,
- name,
- EPHYR_HOST_GLX_GetString,
- &string)) {
- EPHYR_LOG_ERROR ("failed to get string from server\n") ;
- goto out ;
- }
- if (string) {
- length = strlen (string) + 1;
- EPHYR_LOG ("got string:'%s', size:%d\n", string, length) ;
- } else {
- EPHYR_LOG ("got string: string (null)\n") ;
- }
- __GLX_BEGIN_REPLY (length);
- __GLX_PUT_SIZE (length);
- __GLX_SEND_HEADER ();
- if (a_do_swap) {
- __GLX_SWAP_REPLY_SIZE ();
- __GLX_SWAP_REPLY_HEADER ();
- }
- WriteToClient (client, length, (char *)string);
-
- res = Success ;
-out:
- EPHYR_LOG ("leave\n") ;
- return res ;
-}
-
-int
-ephyrGLXGetString (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXGetStringReal (a_cl, a_pc, FALSE) ;
-}
-
-int
-ephyrGLXGetStringSwap (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXGetStringReal (a_cl, a_pc, TRUE) ;
-}
-
-static int
-ephyrGLXGetIntegervReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
-{
- int res=BadImplementation;
- xGLXSingleReq * const req = (xGLXSingleReq *) a_pc;
- GLenum int_name ;
- int value=0 ;
- GLint answer_buf_room[200];
- GLint *buf=NULL ;
-
- EPHYR_LOG ("enter\n") ;
-
- a_pc += __GLX_SINGLE_HDR_SIZE;
-
- int_name = *(GLenum*) (a_pc+0) ;
- if (!ephyrHostGetIntegerValue (req->contextTag, int_name, &value)) {
- EPHYR_LOG_ERROR ("ephyrHostGetIntegerValue() failed\n") ;
- goto out ;
- }
- buf = __glXGetAnswerBuffer (a_cl, sizeof (value),
- answer_buf_room,
- sizeof (answer_buf_room),
- 4) ;
-
- if (!buf) {
- EPHYR_LOG_ERROR ("failed to allocate reply buffer\n") ;
- res = BadAlloc ;
- goto out ;
- }
- __glXSendReply (a_cl->client, buf, 1, sizeof (value), GL_FALSE, 0) ;
- res = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return res ;
-}
-
-int
-ephyrGLXGetIntegerv (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXGetIntegervReal (a_cl, a_pc, FALSE) ;
-}
-
-int
-ephyrGLXGetIntegervSwap (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXGetIntegervReal (a_cl, a_pc, TRUE) ;
-}
-
-static int
-ephyrGLXIsDirectReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
-{
- int res=BadImplementation;
- ClientPtr client = a_cl->client;
- xGLXIsDirectReq *req = (xGLXIsDirectReq *) a_pc;
- xGLXIsDirectReply reply;
- int is_direct=0 ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_cl && a_pc, FALSE) ;
-
- EPHYR_LOG ("enter\n") ;
-
- memset (&reply, 0, sizeof (reply)) ;
- if (!ephyrHostIsContextDirect (req->context, (int*)&is_direct)) {
- EPHYR_LOG_ERROR ("ephyrHostIsContextDirect() failed\n") ;
- goto out ;
- }
- reply.isDirect = is_direct ;
- reply.length = 0;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
- res = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return res ;
-}
-
-int
-ephyrGLXIsDirect (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXIsDirectReal (a_cl, a_pc, FALSE) ;
-}
-
-int
-ephyrGLXIsDirectSwap (__GLXclientState *a_cl, GLbyte *a_pc)
-{
- return ephyrGLXIsDirectReal (a_cl, a_pc, TRUE) ;
-}
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#include "extnsionst.h"
+#include "ephyrglxext.h"
+#include "ephyrhostglx.h"
+#define _HAVE_XALLOC_DECLS
+#include "ephyrlog.h"
+#include <GL/glxproto.h>
+#include "glx/glxserver.h"
+#include "glx/indirect_table.h"
+#include "glx/indirect_util.h"
+#include "glx/unpack.h"
+#include "hostx.h"
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+int ephyrGLXQueryVersion(__GLXclientState * cl, GLbyte * pc);
+int ephyrGLXQueryVersionSwap(__GLXclientState * cl, GLbyte * pc);
+int ephyrGLXGetVisualConfigs(__GLXclientState * cl, GLbyte * pc);
+int ephyrGLXGetVisualConfigsSwap(__GLXclientState * cl, GLbyte * pc);
+int ephyrGLXClientInfo(__GLXclientState * cl, GLbyte * pc);
+int ephyrGLXClientInfoSwap(__GLXclientState * cl, GLbyte * pc);
+int ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXQueryServerStringSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXGetFBConfigsSGIX(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXGetFBConfigsSGIXSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXCreateContext(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXCreateContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXDestroyContext(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXMakeCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXGetString(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXGetStringSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXGetIntegerv(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXGetIntegervSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXIsDirect(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXIsDirectSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+
+Bool
+ephyrHijackGLXExtension(void)
+{
+ const void *(*dispatch_functions)[2];
+
+ if (!hostx_has_glx()) {
+ EPHYR_LOG("host X does not have GLX\n");
+ return FALSE;
+ }
+ EPHYR_LOG("host X does have GLX\n");
+
+ if (!Single_dispatch_info.dispatch_functions) {
+ EPHYR_LOG_ERROR("could not get dispatch functions table\n");
+ return FALSE;
+ }
+ /*
+ * hijack some single entry point dispatch functions
+ */
+ dispatch_functions = Single_dispatch_info.dispatch_functions;
+ EPHYR_RETURN_VAL_IF_FAIL(dispatch_functions, FALSE);
+
+ dispatch_functions[X_GLXQueryVersion][0] = ephyrGLXQueryVersion;
+ dispatch_functions[X_GLXQueryVersion][1] = ephyrGLXQueryVersionSwap;
+
+ dispatch_functions[X_GLXGetVisualConfigs][0] = ephyrGLXGetVisualConfigs;
+ dispatch_functions[X_GLXGetVisualConfigs][1] = ephyrGLXGetVisualConfigsSwap;
+ dispatch_functions[X_GLXClientInfo][0] = ephyrGLXClientInfo;
+ dispatch_functions[X_GLXClientInfo][1] = ephyrGLXClientInfoSwap;
+
+ dispatch_functions[X_GLXQueryServerString][0] = ephyrGLXQueryServerString;
+ dispatch_functions[X_GLXQueryServerString][1] =
+ ephyrGLXQueryServerStringSwap;
+
+ dispatch_functions[X_GLXCreateContext][0] = ephyrGLXCreateContext;
+ dispatch_functions[X_GLXCreateContext][1] = ephyrGLXCreateContextSwap;
+
+ dispatch_functions[X_GLXDestroyContext][0] = ephyrGLXDestroyContext;
+ dispatch_functions[X_GLXDestroyContext][1] = ephyrGLXDestroyContextSwap;
+
+ dispatch_functions[X_GLXMakeCurrent][0] = ephyrGLXMakeCurrent;
+ dispatch_functions[X_GLXMakeCurrent][1] = ephyrGLXMakeCurrentSwap;
+
+ dispatch_functions[X_GLXIsDirect][0] = ephyrGLXIsDirect;
+ dispatch_functions[X_GLXIsDirect][1] = ephyrGLXIsDirectSwap;
+
+ dispatch_functions[73][0] = ephyrGLXGetString;
+ dispatch_functions[73][1] = ephyrGLXGetStringSwap;
+
+ dispatch_functions[61][0] = ephyrGLXGetIntegerv;
+ dispatch_functions[61][1] = ephyrGLXGetIntegervSwap;
+
+ /*
+ * hijack some vendor priv entry point dispatch functions
+ */
+ dispatch_functions = VendorPriv_dispatch_info.dispatch_functions;
+ dispatch_functions[92][0] = ephyrGLXGetFBConfigsSGIX;
+ dispatch_functions[92][1] = ephyrGLXGetFBConfigsSGIXSwap;
+ EPHYR_LOG("hijacked glx entry points to forward requests to host X\n");
+
+ return TRUE;
+}
+
+/*********************
+ * implementation of
+ * hijacked GLX entry
+ * points
+ ********************/
+
+int
+ephyrGLXQueryVersion(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ ClientPtr client = a_cl->client;
+ xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) a_pc;
+ xGLXQueryVersionReply reply;
+ int major, minor;
+ int res = BadImplementation;
+
+ EPHYR_LOG("enter\n");
+
+ major = req->majorVersion;
+ minor = req->minorVersion;
+
+ if (!ephyrHostGLXQueryVersion(&major, &minor)) {
+ EPHYR_LOG_ERROR("ephyrHostGLXQueryVersion() failed\n");
+ goto out;
+ }
+ EPHYR_LOG("major:%d, minor:%d\n", major, minor);
+ reply.majorVersion = major;
+ reply.minorVersion = minor;
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ __glXSwapQueryVersionReply(client, &reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply);
+ }
+
+ res = Success;
+ out:
+ EPHYR_LOG("leave\n");
+ return res;
+}
+
+int
+ephyrGLXQueryVersionSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) a_pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->majorVersion);
+ __GLX_SWAP_INT(&req->minorVersion);
+ return ephyrGLXQueryVersion(a_cl, a_pc);
+}
+
+static int
+ephyrGLXGetVisualConfigsReal(__GLXclientState * a_cl,
+ GLbyte * a_pc, Bool a_do_swap)
+{
+ xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) a_pc;
+ ClientPtr client = a_cl->client;
+ xGLXGetVisualConfigsReply reply;
+ int32_t *props_buf = NULL, num_visuals = 0,
+ num_props = 0, res = BadImplementation, i = 0,
+ props_per_visual_size = 0, props_buf_size = 0;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ EPHYR_LOG("enter\n");
+
+ if (!ephyrHostGLXGetVisualConfigs(req->screen,
+ &num_visuals,
+ &num_props,
+ &props_buf_size, &props_buf)) {
+ EPHYR_LOG_ERROR("ephyrHostGLXGetVisualConfigs() failed\n");
+ goto out;
+ }
+ EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);
+
+ reply.numVisuals = num_visuals;
+ reply.numProps = num_props;
+ reply.length = (num_visuals * __GLX_SIZE_CARD32 * num_props) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (a_do_swap) {
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numVisuals);
+ __GLX_SWAP_INT(&reply.numProps);
+ __GLX_SWAP_INT_ARRAY(props_buf, num_props);
+ }
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+ props_per_visual_size = props_buf_size / num_visuals;
+ for (i = 0; i < num_visuals; i++) {
+ WriteToClient(client,
+ props_per_visual_size,
+ (char *) props_buf + i * props_per_visual_size);
+ }
+ res = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ free(props_buf);
+ props_buf = NULL;
+
+ return res;
+}
+
+static int
+ephyrGLXGetFBConfigsSGIXReal(__GLXclientState * a_cl,
+ GLbyte * a_pc, Bool a_do_swap)
+{
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) a_pc;
+ ClientPtr client = a_cl->client;
+ xGLXGetVisualConfigsReply reply;
+ int32_t *props_buf = NULL, num_visuals = 0,
+ num_props = 0, res = BadImplementation, i = 0,
+ props_per_visual_size = 0, props_buf_size = 0;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ EPHYR_LOG("enter\n");
+
+ if (!ephyrHostGLXVendorPrivGetFBConfigsSGIX(req->screen,
+ &num_visuals,
+ &num_props,
+ &props_buf_size, &props_buf)) {
+ EPHYR_LOG_ERROR("ephyrHostGLXGetVisualConfigs() failed\n");
+ goto out;
+ }
+ EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);
+
+ reply.numVisuals = num_visuals;
+ reply.numProps = num_props;
+ reply.length = props_buf_size >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (a_do_swap) {
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numVisuals);
+ __GLX_SWAP_INT(&reply.numProps);
+ __GLX_SWAP_INT_ARRAY(props_buf, num_props);
+ }
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+ props_per_visual_size = props_buf_size / num_visuals;
+ for (i = 0; i < num_visuals; i++) {
+ WriteToClient(client,
+ props_per_visual_size,
+ &((char *) props_buf)[i * props_per_visual_size]);
+ }
+ res = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ free(props_buf);
+ props_buf = NULL;
+
+ return res;
+}
+
+int
+ephyrGLXGetVisualConfigs(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXGetVisualConfigsReal(a_cl, a_pc, FALSE);
+}
+
+int
+ephyrGLXGetVisualConfigsSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXGetVisualConfigsReal(a_cl, a_pc, TRUE);
+}
+
+int
+ephyrGLXClientInfo(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ int res = BadImplementation;
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *) a_pc;
+
+ EPHYR_LOG("enter\n");
+ if (!ephyrHostGLXSendClientInfo(req->major, req->minor, (char *) req + 1)) {
+ EPHYR_LOG_ERROR("failed to send client info to host\n");
+ goto out;
+ }
+ res = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return res;
+}
+
+int
+ephyrGLXClientInfoSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *) a_pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->major);
+ __GLX_SWAP_INT(&req->minor);
+ __GLX_SWAP_INT(&req->numbytes);
+
+ return ephyrGLXClientInfo(a_cl, a_pc);
+}
+
+int
+ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ int res = BadImplementation;
+ ClientPtr client = a_cl->client;
+ xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) a_pc;
+ xGLXQueryServerStringReply reply;
+ char *server_string = NULL, *buf = NULL;
+ int length = 0;
+
+ EPHYR_LOG("enter\n");
+ if (!ephyrHostGLXGetStringFromServer(req->screen,
+ req->name,
+ EPHYR_HOST_GLX_QueryServerString,
+ &server_string)) {
+ EPHYR_LOG_ERROR("failed to query string from host\n");
+ goto out;
+ }
+ EPHYR_LOG("string: %s\n", server_string);
+ length = strlen(server_string) + 1;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = __GLX_PAD(length) >> 2;
+ reply.n = length;
+ buf = calloc(reply.length << 2, 1);
+ if (!buf) {
+ EPHYR_LOG_ERROR("failed to allocate string\n;");
+ return BadAlloc;
+ }
+ memcpy(buf, server_string, length);
+
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) &reply);
+ WriteToClient(client, (int) (reply.length << 2), server_string);
+
+ res = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ free(server_string);
+ server_string = NULL;
+
+ free(buf);
+ buf = NULL;
+
+ return res;
+}
+
+int
+ephyrGLXQueryServerStringSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ EPHYR_LOG_ERROR("not yet implemented\n");
+ return BadImplementation;
+}
+
+int
+ephyrGLXGetFBConfigsSGIX(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXGetFBConfigsSGIXReal(a_cl, a_pc, FALSE);
+}
+
+int
+ephyrGLXGetFBConfigsSGIXSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXGetFBConfigsSGIXReal(a_cl, a_pc, TRUE);
+}
+
+static int
+ephyrGLXCreateContextReal(xGLXCreateContextReq * a_req, Bool a_do_swap)
+{
+ int res = BadImplementation;
+ EphyrHostWindowAttributes host_w_attrs;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_req, BadValue);
+ EPHYR_LOG("enter\n");
+
+ if (a_do_swap) {
+ __GLX_SWAP_SHORT(&a_req->length);
+ __GLX_SWAP_INT(&a_req->context);
+ __GLX_SWAP_INT(&a_req->visual);
+ __GLX_SWAP_INT(&a_req->screen);
+ __GLX_SWAP_INT(&a_req->shareList);
+ }
+
+ EPHYR_LOG("context creation requested. localid:%d, "
+ "screen:%d, visual:%d, direct:%d\n",
+ (int) a_req->context, (int) a_req->screen,
+ (int) a_req->visual, (int) a_req->isDirect);
+
+ memset(&host_w_attrs, 0, sizeof(host_w_attrs));
+ if (!hostx_get_window_attributes(hostx_get_window(a_req->screen),
+ &host_w_attrs)) {
+ EPHYR_LOG_ERROR("failed to get host window attrs\n");
+ goto out;
+ }
+
+ EPHYR_LOG("host window visual id: %d\n", host_w_attrs.visualid);
+
+ if (!ephyrHostGLXCreateContext(a_req->screen,
+ host_w_attrs.visualid,
+ a_req->context,
+ a_req->shareList, a_req->isDirect)) {
+ EPHYR_LOG_ERROR("ephyrHostGLXCreateContext() failed\n");
+ goto out;
+ }
+ res = Success;
+ out:
+ EPHYR_LOG("leave\n");
+ return res;
+}
+
+int
+ephyrGLXCreateContext(__GLXclientState * cl, GLbyte * pc)
+{
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+
+ return ephyrGLXCreateContextReal(req, FALSE);
+}
+
+int
+ephyrGLXCreateContextSwap(__GLXclientState * cl, GLbyte * pc)
+{
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+
+ return ephyrGLXCreateContextReal(req, TRUE);
+}
+
+static int
+ephyrGLXDestroyContextReal(__GLXclientState * a_cl,
+ GLbyte * a_pc, Bool a_do_swap)
+{
+ int res = BadImplementation;
+ ClientPtr client = a_cl->client;
+ xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) a_pc;
+
+ EPHYR_LOG("enter. id:%d\n", (int) req->context);
+ if (!ephyrHostDestroyContext(req->context)) {
+ EPHYR_LOG_ERROR("ephyrHostDestroyContext() failed\n");
+ client->errorValue = req->context;
+ goto out;
+ }
+ res = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return res;
+}
+
+int
+ephyrGLXDestroyContext(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXDestroyContextReal(a_cl, a_pc, FALSE);
+}
+
+int
+ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXDestroyContextReal(a_cl, a_pc, TRUE);
+}
+
+static int
+ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
+{
+ int res = BadImplementation;
+ xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
+ xGLXMakeCurrentReply reply;
+ DrawablePtr drawable = NULL;
+ int rc = 0;
+
+ EPHYR_LOG("enter\n");
+ rc = dixLookupDrawable(&drawable,
+ req->drawable, a_cl->client, 0, DixReadAccess);
+ EPHYR_RETURN_VAL_IF_FAIL(drawable, BadValue);
+ EPHYR_RETURN_VAL_IF_FAIL(drawable->pScreen, BadValue);
+ EPHYR_LOG("screen nummber requested:%d\n", drawable->pScreen->myNum);
+
+ memset(&reply, 0, sizeof(reply));
+ if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawable->pScreen->myNum),
+ req->context,
+ req->oldContextTag,
+ (int *) &reply.contextTag)) {
+ EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n");
+ goto out;
+ }
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = a_cl->client->sequence;
+ if (a_do_swap) {
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.contextTag);
+ }
+ WriteToClient(a_cl->client, sz_xGLXMakeCurrentReply, (char *) &reply);
+
+ res = Success;
+ out:
+ EPHYR_LOG("leave\n");
+ return res;
+}
+
+int
+ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXMakeCurrentReal(a_cl, a_pc, FALSE);
+}
+
+int
+ephyrGLXMakeCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXMakeCurrentReal(a_cl, a_pc, TRUE);
+}
+
+static int
+ephyrGLXGetStringReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
+{
+ ClientPtr client = NULL;
+ int context_tag = 0, name = 0, res = BadImplementation, length = 0;
+ char *string = NULL;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_cl && a_pc, BadValue);
+
+ EPHYR_LOG("enter\n");
+
+ client = a_cl->client;
+
+ if (a_do_swap) {
+ __GLX_SWAP_INT(a_pc + 4);
+ __GLX_SWAP_INT(a_pc + __GLX_SINGLE_HDR_SIZE);
+ }
+ context_tag = __GLX_GET_SINGLE_CONTEXT_TAG(a_pc);
+ a_pc += __GLX_SINGLE_HDR_SIZE;
+ name = *(GLenum *) (a_pc + 0);
+ EPHYR_LOG("context_tag:%d, name:%d\n", context_tag, name);
+ if (!ephyrHostGLXGetStringFromServer(context_tag,
+ name,
+ EPHYR_HOST_GLX_GetString, &string)) {
+ EPHYR_LOG_ERROR("failed to get string from server\n");
+ goto out;
+ }
+ if (string) {
+ length = strlen(string) + 1;
+ EPHYR_LOG("got string:'%s', size:%d\n", string, length);
+ }
+ else {
+ EPHYR_LOG("got string: string (null)\n");
+ }
+ __GLX_BEGIN_REPLY(length);
+ __GLX_PUT_SIZE(length);
+ __GLX_SEND_HEADER();
+ if (a_do_swap) {
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SWAP_REPLY_HEADER();
+ }
+ WriteToClient(client, length, (char *) string);
+
+ res = Success;
+ out:
+ EPHYR_LOG("leave\n");
+ return res;
+}
+
+int
+ephyrGLXGetString(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXGetStringReal(a_cl, a_pc, FALSE);
+}
+
+int
+ephyrGLXGetStringSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXGetStringReal(a_cl, a_pc, TRUE);
+}
+
+static int
+ephyrGLXGetIntegervReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
+{
+ int res = BadImplementation;
+ xGLXSingleReq *const req = (xGLXSingleReq *) a_pc;
+ GLenum int_name;
+ int value = 0;
+ GLint answer_buf_room[200];
+ GLint *buf = NULL;
+
+ EPHYR_LOG("enter\n");
+
+ a_pc += __GLX_SINGLE_HDR_SIZE;
+
+ int_name = *(GLenum *) (a_pc + 0);
+ if (!ephyrHostGetIntegerValue(req->contextTag, int_name, &value)) {
+ EPHYR_LOG_ERROR("ephyrHostGetIntegerValue() failed\n");
+ goto out;
+ }
+ buf = __glXGetAnswerBuffer(a_cl, sizeof(value),
+ answer_buf_room, sizeof(answer_buf_room), 4);
+
+ if (!buf) {
+ EPHYR_LOG_ERROR("failed to allocate reply buffer\n");
+ res = BadAlloc;
+ goto out;
+ }
+ __glXSendReply(a_cl->client, buf, 1, sizeof(value), GL_FALSE, 0);
+ res = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return res;
+}
+
+int
+ephyrGLXGetIntegerv(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXGetIntegervReal(a_cl, a_pc, FALSE);
+}
+
+int
+ephyrGLXGetIntegervSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXGetIntegervReal(a_cl, a_pc, TRUE);
+}
+
+static int
+ephyrGLXIsDirectReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
+{
+ int res = BadImplementation;
+ ClientPtr client = a_cl->client;
+ xGLXIsDirectReq *req = (xGLXIsDirectReq *) a_pc;
+ xGLXIsDirectReply reply;
+ int is_direct = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_cl && a_pc, FALSE);
+
+ EPHYR_LOG("enter\n");
+
+ memset(&reply, 0, sizeof(reply));
+ if (!ephyrHostIsContextDirect(req->context, (int *) &is_direct)) {
+ EPHYR_LOG_ERROR("ephyrHostIsContextDirect() failed\n");
+ goto out;
+ }
+ reply.isDirect = is_direct;
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply);
+ res = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return res;
+}
+
+int
+ephyrGLXIsDirect(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXIsDirectReal(a_cl, a_pc, FALSE);
+}
+
+int
+ephyrGLXIsDirectSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+ return ephyrGLXIsDirectReal(a_cl, a_pc, TRUE);
+}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c
index 728687b46..6b9da6fb1 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c
@@ -56,79 +56,76 @@ enum VisualConfRequestType {
EPHYR_GET_FB_CONFIG,
EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
EPHYR_GET_VISUAL_CONFIGS
-
};
static Bool ephyrHostGLXGetVisualConfigsInternal
- (enum VisualConfRequestType a_type,
- int32_t a_screen,
- int32_t *a_num_visuals,
- int32_t *a_num_props,
- int32_t *a_props_buf_size,
- int32_t **a_props_buf);
+ (enum VisualConfRequestType a_type,
+ int32_t a_screen,
+ int32_t * a_num_visuals,
+ int32_t * a_num_props, int32_t * a_props_buf_size, int32_t ** a_props_buf);
Bool
-ephyrHostGLXGetMajorOpcode (int *a_opcode)
+ephyrHostGLXGetMajorOpcode(int *a_opcode)
{
- Bool is_ok=FALSE ;
- Display *dpy=hostx_get_display () ;
- static int opcode ;
- int first_event_return=0, first_error_return=0;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ static int opcode;
+ int first_event_return = 0, first_error_return = 0;
- EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
- EPHYR_LOG ("enter\n") ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
+ EPHYR_LOG("enter\n");
if (!opcode) {
- if (!XQueryExtension (dpy, GLX_EXTENSION_NAME, &opcode,
- &first_event_return, &first_error_return)) {
- EPHYR_LOG_ERROR ("XQueryExtension() failed\n") ;
- goto out ;
+ if (!XQueryExtension(dpy, GLX_EXTENSION_NAME, &opcode,
+ &first_event_return, &first_error_return)) {
+ EPHYR_LOG_ERROR("XQueryExtension() failed\n");
+ goto out;
}
}
- *a_opcode = opcode ;
- is_ok = TRUE ;
-out:
- EPHYR_LOG ("release\n") ;
- return is_ok ;
+ *a_opcode = opcode;
+ is_ok = TRUE;
+ out:
+ EPHYR_LOG("release\n");
+ return is_ok;
}
Bool
-ephyrHostGLXQueryVersion (int *a_major, int *a_minor)
+ephyrHostGLXQueryVersion(int *a_major, int *a_minor)
{
- Bool is_ok = FALSE ;
- Display *dpy = hostx_get_display () ;
- int major_opcode=0;
- xGLXQueryVersionReq *req=NULL;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ int major_opcode = 0;
+ xGLXQueryVersionReq *req = NULL;
xGLXQueryVersionReply reply;
- EPHYR_RETURN_VAL_IF_FAIL (a_major && a_minor, FALSE) ;
- EPHYR_LOG ("enter\n") ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_major && a_minor, FALSE);
+ EPHYR_LOG("enter\n");
- if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
- EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
- goto out ;
+ if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
+ EPHYR_LOG_ERROR("failed to get major opcode\n");
+ goto out;
}
- EPHYR_LOG ("major opcode: %d\n", major_opcode) ;
+ EPHYR_LOG("major opcode: %d\n", major_opcode);
/* Send the glXQueryVersion request */
- memset (&reply, 0, sizeof (reply)) ;
- LockDisplay (dpy);
- GetReq (GLXQueryVersion, req);
+ memset(&reply, 0, sizeof(reply));
+ LockDisplay(dpy);
+ GetReq(GLXQueryVersion, req);
req->reqType = major_opcode;
req->glxCode = X_GLXQueryVersion;
req->majorVersion = 2;
req->minorVersion = 1;
- _XReply(dpy, (xReply*) &reply, 0, False);
- UnlockDisplay (dpy);
- SyncHandle ();
+ _XReply(dpy, (xReply *) & reply, 0, False);
+ UnlockDisplay(dpy);
+ SyncHandle();
- *a_major = reply.majorVersion ;
- *a_minor = reply.minorVersion ;
+ *a_major = reply.majorVersion;
+ *a_minor = reply.minorVersion;
- EPHYR_LOG ("major:%d, minor:%d\n", *a_major, *a_minor) ;
+ EPHYR_LOG("major:%d, minor:%d\n", *a_major, *a_minor);
- is_ok = TRUE ;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ is_ok = TRUE;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
/**
@@ -154,165 +151,161 @@ typedef struct GLXGenericGetString {
#define X_GLXGenericGetString 0
Bool
-ephyrHostGLXGetStringFromServer (int a_screen_number,
- int a_string_name,
- enum EphyrHostGLXGetStringOps a_op,
- char **a_string)
+ephyrHostGLXGetStringFromServer(int a_screen_number,
+ int a_string_name,
+ enum EphyrHostGLXGetStringOps a_op,
+ char **a_string)
{
- Bool is_ok=FALSE ;
- Display *dpy = hostx_get_display () ;
- int default_screen = DefaultScreen (dpy);
- xGLXGenericGetStringReq *req=NULL;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ int default_screen = DefaultScreen(dpy);
+ xGLXGenericGetStringReq *req = NULL;
xGLXSingleReply reply;
- int length=0, numbytes=0, major_opcode=0, get_string_op=0;
+ int length = 0, numbytes = 0, major_opcode = 0, get_string_op = 0;
- EPHYR_RETURN_VAL_IF_FAIL (dpy && a_string, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy && a_string, FALSE);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
switch (a_op) {
- case EPHYR_HOST_GLX_QueryServerString:
- get_string_op = X_GLXQueryServerString;
- break ;
- case EPHYR_HOST_GLX_GetString:
- get_string_op = X_GLsop_GetString;
- EPHYR_LOG ("Going to glXGetString. strname:%#x, ctxttag:%d\n",
- a_string_name, a_screen_number) ;
- break ;
- default:
- EPHYR_LOG_ERROR ("unknown EphyrHostGLXGetStringOp:%d\n", a_op) ;
- goto out ;
+ case EPHYR_HOST_GLX_QueryServerString:
+ get_string_op = X_GLXQueryServerString;
+ break;
+ case EPHYR_HOST_GLX_GetString:
+ get_string_op = X_GLsop_GetString;
+ EPHYR_LOG("Going to glXGetString. strname:%#x, ctxttag:%d\n",
+ a_string_name, a_screen_number);
+ break;
+ default:
+ EPHYR_LOG_ERROR("unknown EphyrHostGLXGetStringOp:%d\n", a_op);
+ goto out;
}
- if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
- EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
- goto out ;
+ if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
+ EPHYR_LOG_ERROR("failed to get major opcode\n");
+ goto out;
}
- EPHYR_LOG ("major opcode: %d\n", major_opcode) ;
+ EPHYR_LOG("major opcode: %d\n", major_opcode);
- LockDisplay (dpy);
+ LockDisplay(dpy);
/* All of the GLX protocol requests for getting a string from the server
* look the same. The exact meaning of the a_for_whom field is usually
* either the screen number (for glXQueryServerString) or the context tag
* (for GLXSingle).
*/
- GetReq (GLXGenericGetString, req);
+ GetReq(GLXGenericGetString, req);
req->reqType = major_opcode;
req->glxCode = get_string_op;
req->for_whom = default_screen;
req->name = a_string_name;
- _XReply (dpy, (xReply *)&reply, 0, False);
+ _XReply(dpy, (xReply *) & reply, 0, False);
length = reply.length * 4;
if (!length) {
numbytes = 0;
- } else {
+ }
+ else {
numbytes = reply.size;
}
- EPHYR_LOG ("going to get a string of size:%d\n", numbytes) ;
+ EPHYR_LOG("going to get a string of size:%d\n", numbytes);
- *a_string = (char *) Xmalloc (numbytes +1);
+ *a_string = (char *) Xmalloc(numbytes + 1);
if (!a_string) {
- EPHYR_LOG_ERROR ("allocation failed\n") ;
+ EPHYR_LOG_ERROR("allocation failed\n");
goto out;
}
- memset (*a_string, 0, numbytes+1) ;
- if (_XRead (dpy, *a_string, numbytes)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- EPHYR_LOG_ERROR ("read failed\n") ;
- goto out ;
+ memset(*a_string, 0, numbytes + 1);
+ if (_XRead(dpy, *a_string, numbytes)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ EPHYR_LOG_ERROR("read failed\n");
+ goto out;
}
length -= numbytes;
- _XEatData (dpy, length) ;
- UnlockDisplay (dpy);
- SyncHandle ();
- EPHYR_LOG ("strname:%#x, strvalue:'%s', strlen:%d\n",
- a_string_name, *a_string, numbytes) ;
-
- is_ok = TRUE ;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ _XEatData(dpy, length);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ EPHYR_LOG("strname:%#x, strvalue:'%s', strlen:%d\n",
+ a_string_name, *a_string, numbytes);
+
+ is_ok = TRUE;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
static Bool
-ephyrHostGLXGetVisualConfigsInternal (enum VisualConfRequestType a_type,
- int32_t a_screen,
- int32_t *a_num_visuals,
- int32_t *a_num_props,
- int32_t *a_props_buf_size,
- int32_t **a_props_buf)
+ephyrHostGLXGetVisualConfigsInternal(enum VisualConfRequestType a_type,
+ int32_t a_screen,
+ int32_t * a_num_visuals,
+ int32_t * a_num_props,
+ int32_t * a_props_buf_size,
+ int32_t ** a_props_buf)
{
- Bool is_ok = FALSE ;
- Display *dpy = hostx_get_display () ;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
xGLXGetVisualConfigsReq *req;
xGLXGetFBConfigsReq *fb_req;
xGLXVendorPrivateWithReplyReq *vpreq;
xGLXGetFBConfigsSGIXReq *sgi_req;
xGLXGetVisualConfigsReply reply;
- char *server_glx_version=NULL,
- *server_glx_extensions=NULL ;
- int j=0,
- screens=0,
- major_opcode=0,
- num_props=0,
- num_visuals=0,
- props_buf_size=0,
- props_per_visual_size=0;
- int32_t *props_buf=NULL;
-
- EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
-
- screens = ScreenCount (dpy);
- if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
- EPHYR_LOG_ERROR ("failed to get opcode\n") ;
- goto out ;
+ char *server_glx_version = NULL, *server_glx_extensions = NULL;
+ int j = 0,
+ screens = 0,
+ major_opcode = 0,
+ num_props = 0,
+ num_visuals = 0, props_buf_size = 0, props_per_visual_size = 0;
+ int32_t *props_buf = NULL;
+
+ EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
+
+ screens = ScreenCount(dpy);
+ if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
+ EPHYR_LOG_ERROR("failed to get opcode\n");
+ goto out;
}
LockDisplay(dpy);
switch (a_type) {
- case EPHYR_GET_FB_CONFIG:
- GetReq(GLXGetFBConfigs,fb_req);
+ case EPHYR_GET_FB_CONFIG:
+ GetReq(GLXGetFBConfigs, fb_req);
fb_req->reqType = major_opcode;
fb_req->glxCode = X_GLXGetFBConfigs;
- fb_req->screen = DefaultScreen (dpy);
+ fb_req->screen = DefaultScreen(dpy);
break;
- case EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX:
+ case EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX:
GetReqExtra(GLXVendorPrivateWithReply,
sz_xGLXGetFBConfigsSGIXReq
- -
- sz_xGLXVendorPrivateWithReplyReq,
- vpreq);
+ - sz_xGLXVendorPrivateWithReplyReq, vpreq);
sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
sgi_req->reqType = major_opcode;
sgi_req->glxCode = X_GLXVendorPrivateWithReply;
sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
- sgi_req->screen = DefaultScreen (dpy);
+ sgi_req->screen = DefaultScreen(dpy);
break;
- case EPHYR_GET_VISUAL_CONFIGS:
- GetReq(GLXGetVisualConfigs,req);
+ case EPHYR_GET_VISUAL_CONFIGS:
+ GetReq(GLXGetVisualConfigs, req);
req->reqType = major_opcode;
req->glxCode = X_GLXGetVisualConfigs;
- req->screen = DefaultScreen (dpy);
+ req->screen = DefaultScreen(dpy);
break;
}
- if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
- EPHYR_LOG_ERROR ("unknown error\n") ;
+ if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ EPHYR_LOG_ERROR("unknown error\n");
UnlockDisplay(dpy);
- goto out ;
+ goto out;
}
- if (!reply.numVisuals) {
- EPHYR_LOG_ERROR ("screen does not support GL rendering\n") ;
+ if (!reply.numVisuals) {
+ EPHYR_LOG_ERROR("screen does not support GL rendering\n");
UnlockDisplay(dpy);
- goto out ;
+ goto out;
}
- num_visuals = reply.numVisuals ;
+ num_visuals = reply.numVisuals;
/* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for
* FIXME: FBconfigs?
@@ -322,9 +315,9 @@ ephyrHostGLXGetVisualConfigsInternal (enum VisualConfRequestType a_type,
if ((num_props < __GLX_MIN_CONFIG_PROPS) ||
(num_props > __GLX_MAX_CONFIG_PROPS)) {
/* Huh? Not in protocol defined limits. Punt */
- EPHYR_LOG_ERROR ("got a bad reply to request\n") ;
+ EPHYR_LOG_ERROR("got a bad reply to request\n");
UnlockDisplay(dpy);
- goto out ;
+ goto out;
}
if (a_type != EPHYR_GET_VISUAL_CONFIGS) {
@@ -332,250 +325,242 @@ ephyrHostGLXGetVisualConfigsInternal (enum VisualConfRequestType a_type,
}
props_per_visual_size = num_props * __GLX_SIZE_INT32;
props_buf_size = props_per_visual_size * reply.numVisuals;
- props_buf = malloc (props_buf_size) ;
+ props_buf = malloc(props_buf_size);
for (j = 0; j < reply.numVisuals; j++) {
- if (_XRead (dpy,
- &((char*)props_buf)[j*props_per_visual_size],
- props_per_visual_size) != Success) {
- EPHYR_LOG_ERROR ("read failed\n") ;
+ if (_XRead(dpy,
+ &((char *) props_buf)[j * props_per_visual_size],
+ props_per_visual_size) != Success) {
+ EPHYR_LOG_ERROR("read failed\n");
}
}
UnlockDisplay(dpy);
- *a_num_visuals = num_visuals ;
- *a_num_props = reply.numProps ;
- *a_props_buf_size = props_buf_size ;
- *a_props_buf = props_buf ;
- is_ok = TRUE ;
+ *a_num_visuals = num_visuals;
+ *a_num_props = reply.numProps;
+ *a_props_buf_size = props_buf_size;
+ *a_props_buf = props_buf;
+ is_ok = TRUE;
-out:
+ out:
if (server_glx_version) {
- XFree (server_glx_version) ;
- server_glx_version = NULL ;
+ XFree(server_glx_version);
+ server_glx_version = NULL;
}
if (server_glx_extensions) {
- XFree (server_glx_extensions) ;
- server_glx_extensions = NULL ;
+ XFree(server_glx_extensions);
+ server_glx_extensions = NULL;
}
- SyncHandle () ;
+ SyncHandle();
return is_ok;
}
Bool
-ephyrHostGLXGetVisualConfigs (int32_t a_screen,
- int32_t *a_num_visuals,
- int32_t *a_num_props,
- int32_t *a_props_buf_size,
- int32_t **a_props_buf)
+ephyrHostGLXGetVisualConfigs(int32_t a_screen,
+ int32_t * a_num_visuals,
+ int32_t * a_num_props,
+ int32_t * a_props_buf_size, int32_t ** a_props_buf)
{
Bool is_ok = FALSE;
- EPHYR_LOG ("enter\n") ;
- is_ok = ephyrHostGLXGetVisualConfigsInternal (EPHYR_GET_VISUAL_CONFIGS,
- a_screen,
- a_num_visuals,
- a_num_props,
- a_props_buf_size,
- a_props_buf) ;
+ EPHYR_LOG("enter\n");
+ is_ok = ephyrHostGLXGetVisualConfigsInternal(EPHYR_GET_VISUAL_CONFIGS,
+ a_screen,
+ a_num_visuals,
+ a_num_props,
+ a_props_buf_size, a_props_buf);
- EPHYR_LOG ("leave:%d\n", is_ok) ;
+ EPHYR_LOG("leave:%d\n", is_ok);
return is_ok;
}
Bool
-ephyrHostGLXVendorPrivGetFBConfigsSGIX (int a_screen,
- int32_t *a_num_visuals,
- int32_t *a_num_props,
- int32_t *a_props_buf_size,
- int32_t **a_props_buf)
+ephyrHostGLXVendorPrivGetFBConfigsSGIX(int a_screen,
+ int32_t * a_num_visuals,
+ int32_t * a_num_props,
+ int32_t * a_props_buf_size,
+ int32_t ** a_props_buf)
{
- Bool is_ok=FALSE ;
- EPHYR_LOG ("enter\n") ;
+ Bool is_ok = FALSE;
+
+ EPHYR_LOG("enter\n");
is_ok = ephyrHostGLXGetVisualConfigsInternal
- (EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
- a_screen,
- a_num_visuals,
- a_num_props,
- a_props_buf_size,
- a_props_buf) ;
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ (EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
+ a_screen, a_num_visuals, a_num_props, a_props_buf_size, a_props_buf);
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
Bool
-ephyrHostGLXSendClientInfo (int32_t a_major, int32_t a_minor,
- const char* a_extension_list)
+ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor,
+ const char *a_extension_list)
{
- Bool is_ok = FALSE ;
- Display *dpy = hostx_get_display () ;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
xGLXClientInfoReq *req;
int size;
- int32_t major_opcode=0 ;
+ int32_t major_opcode = 0;
- EPHYR_RETURN_VAL_IF_FAIL (dpy && a_extension_list, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy && a_extension_list, FALSE);
- if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
- EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
- goto out ;
+ if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
+ EPHYR_LOG_ERROR("failed to get major opcode\n");
+ goto out;
}
- LockDisplay (dpy);
+ LockDisplay(dpy);
- GetReq (GLXClientInfo,req);
+ GetReq(GLXClientInfo, req);
req->reqType = major_opcode;
req->glxCode = X_GLXClientInfo;
req->major = a_major;
req->minor = a_minor;
- size = strlen (a_extension_list) + 1;
+ size = strlen(a_extension_list) + 1;
req->length += bytes_to_int32(size);
req->numbytes = size;
- Data (dpy, a_extension_list, size);
+ Data(dpy, a_extension_list, size);
UnlockDisplay(dpy);
SyncHandle();
- is_ok=TRUE ;
+ is_ok = TRUE;
-out:
- return is_ok ;
+ out:
+ return is_ok;
}
Bool
-ephyrHostGLXCreateContext (int a_screen,
- int a_visual_id,
- int a_context_id,
- int a_share_list_ctxt_id,
- Bool a_direct)
+ephyrHostGLXCreateContext(int a_screen,
+ int a_visual_id,
+ int a_context_id,
+ int a_share_list_ctxt_id, Bool a_direct)
{
Bool is_ok = FALSE;
- Display *dpy = hostx_get_display ();
- int major_opcode=0, remote_context_id=0;
+ Display *dpy = hostx_get_display();
+ int major_opcode = 0, remote_context_id = 0;
xGLXCreateContextReq *req;
- EPHYR_LOG ("enter. screen:%d, visual:%d, contextid:%d, direct:%d\n",
- a_screen, a_visual_id, a_context_id, a_direct) ;
+ EPHYR_LOG("enter. screen:%d, visual:%d, contextid:%d, direct:%d\n",
+ a_screen, a_visual_id, a_context_id, a_direct);
- if (!hostx_allocate_resource_id_peer (a_context_id, &remote_context_id)) {
- EPHYR_LOG_ERROR ("failed to peer the context id %d host X",
- remote_context_id) ;
- goto out ;
+ if (!hostx_allocate_resource_id_peer(a_context_id, &remote_context_id)) {
+ EPHYR_LOG_ERROR("failed to peer the context id %d host X",
+ remote_context_id);
+ goto out;
}
- if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
- EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
- goto out ;
+ if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
+ EPHYR_LOG_ERROR("failed to get major opcode\n");
+ goto out;
}
- LockDisplay (dpy) ;
+ LockDisplay(dpy);
/* Send the glXCreateContext request */
- GetReq(GLXCreateContext,req);
+ GetReq(GLXCreateContext, req);
req->reqType = major_opcode;
req->glxCode = X_GLXCreateContext;
req->context = remote_context_id;
req->visual = a_visual_id;
- req->screen = DefaultScreen (dpy);
+ req->screen = DefaultScreen(dpy);
req->shareList = a_share_list_ctxt_id;
req->isDirect = a_direct;
- UnlockDisplay (dpy);
- SyncHandle ();
+ UnlockDisplay(dpy);
+ SyncHandle();
- is_ok = TRUE ;
+ is_ok = TRUE;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
Bool
-ephyrHostDestroyContext (int a_ctxt_id)
+ephyrHostDestroyContext(int a_ctxt_id)
{
- Bool is_ok=FALSE;
- Display *dpy=hostx_get_display ();
- int major_opcode=0, remote_ctxt_id=0 ;
- xGLXDestroyContextReq *req=NULL;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ int major_opcode = 0, remote_ctxt_id = 0;
+ xGLXDestroyContextReq *req = NULL;
- EPHYR_LOG ("enter:%d\n", a_ctxt_id) ;
+ EPHYR_LOG("enter:%d\n", a_ctxt_id);
- if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
- EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
- goto out ;
+ if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
+ EPHYR_LOG_ERROR("failed to get major opcode\n");
+ goto out;
}
- if (!hostx_get_resource_id_peer (a_ctxt_id, &remote_ctxt_id)) {
- EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n") ;
- goto out ;
+ if (!hostx_get_resource_id_peer(a_ctxt_id, &remote_ctxt_id)) {
+ EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n");
+ goto out;
}
- EPHYR_LOG ("host context id:%d\n", remote_ctxt_id) ;
+ EPHYR_LOG("host context id:%d\n", remote_ctxt_id);
- LockDisplay (dpy);
- GetReq (GLXDestroyContext,req);
+ LockDisplay(dpy);
+ GetReq(GLXDestroyContext, req);
req->reqType = major_opcode;
req->glxCode = X_GLXDestroyContext;
req->context = remote_ctxt_id;
- UnlockDisplay (dpy);
- SyncHandle ();
+ UnlockDisplay(dpy);
+ SyncHandle();
- is_ok = TRUE ;
+ is_ok = TRUE;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
Bool
-ephyrHostGLXMakeCurrent (int a_drawable,
- int a_glx_ctxt_id,
- int a_old_ctxt_tag,
- int *a_ctxt_tag)
+ephyrHostGLXMakeCurrent(int a_drawable,
+ int a_glx_ctxt_id, int a_old_ctxt_tag, int *a_ctxt_tag)
{
- Bool is_ok=FALSE ;
- Display *dpy = hostx_get_display () ;
- int32_t major_opcode=0 ;
- int remote_glx_ctxt_id=0 ;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ int32_t major_opcode = 0;
+ int remote_glx_ctxt_id = 0;
xGLXMakeCurrentReq *req;
xGLXMakeCurrentReply reply;
- EPHYR_RETURN_VAL_IF_FAIL (a_ctxt_tag, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_ctxt_tag, FALSE);
- EPHYR_LOG ("enter. drawable:%d, context:%d, oldtag:%d\n",
- a_drawable, a_glx_ctxt_id, a_old_ctxt_tag) ;
+ EPHYR_LOG("enter. drawable:%d, context:%d, oldtag:%d\n",
+ a_drawable, a_glx_ctxt_id, a_old_ctxt_tag);
- if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
- EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
- goto out ;
+ if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
+ EPHYR_LOG_ERROR("failed to get major opcode\n");
+ goto out;
}
- if (!hostx_get_resource_id_peer (a_glx_ctxt_id, &remote_glx_ctxt_id)) {
- EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n") ;
- goto out ;
+ if (!hostx_get_resource_id_peer(a_glx_ctxt_id, &remote_glx_ctxt_id)) {
+ EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n");
+ goto out;
}
- LockDisplay (dpy);
+ LockDisplay(dpy);
- GetReq (GLXMakeCurrent,req);
+ GetReq(GLXMakeCurrent, req);
req->reqType = major_opcode;
req->glxCode = X_GLXMakeCurrent;
req->drawable = a_drawable;
req->context = remote_glx_ctxt_id;
req->oldContextTag = a_old_ctxt_tag;
- memset (&reply, 0, sizeof (reply)) ;
- if (!_XReply (dpy, (xReply*)&reply, 0, False)) {
- EPHYR_LOG_ERROR ("failed to get reply from host\n") ;
- UnlockDisplay (dpy);
- SyncHandle ();
- goto out ;
+ memset(&reply, 0, sizeof(reply));
+ if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ EPHYR_LOG_ERROR("failed to get reply from host\n");
+ UnlockDisplay(dpy);
+ SyncHandle();
+ goto out;
}
- UnlockDisplay (dpy);
- SyncHandle ();
- *a_ctxt_tag = reply.contextTag ;
- EPHYR_LOG ("context tag:%d\n", *a_ctxt_tag) ;
- is_ok = TRUE ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ *a_ctxt_tag = reply.contextTag;
+ EPHYR_LOG("context tag:%d\n", *a_ctxt_tag);
+ is_ok = TRUE;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
#define X_GLXSingle 0
@@ -614,86 +599,85 @@ out:
*p = *(GLfloat *)&reply.pad3;
Bool
-ephyrHostGetIntegerValue (int a_current_context_tag, int a_int, int *a_val)
+ephyrHostGetIntegerValue(int a_current_context_tag, int a_int, int *a_val)
{
- Bool is_ok=FALSE;
- Display *dpy = hostx_get_display () ;
- int major_opcode=0, size=0;
- xGLXSingleReq *req=NULL;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ int major_opcode = 0, size = 0;
+ xGLXSingleReq *req = NULL;
xGLXSingleReply reply;
- unsigned char* pc=NULL ;
+ unsigned char *pc = NULL;
- EPHYR_RETURN_VAL_IF_FAIL (a_val, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_val, FALSE);
- EPHYR_LOG ("enter\n") ;
- if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
- EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
- goto out ;
+ EPHYR_LOG("enter\n");
+ if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
+ EPHYR_LOG_ERROR("failed to get major opcode\n");
+ goto out;
}
- LockDisplay (dpy) ;
- GetReqExtra (GLXSingle, 4, req) ;
- req->reqType = major_opcode ;
- req->glxCode = X_GLsop_GetIntegerv ;
+ LockDisplay(dpy);
+ GetReqExtra(GLXSingle, 4, req);
+ req->reqType = major_opcode;
+ req->glxCode = X_GLsop_GetIntegerv;
req->contextTag = a_current_context_tag;
- pc = ((unsigned char *)(req) + sz_xGLXSingleReq) ;
- EPHYR_GLX_SINGLE_PUT_LONG (0, a_int) ;
- EPHYR_GLX_SINGLE_READ_XREPLY () ;
- EPHYR_GLX_SINGLE_GET_SIZE (size) ;
+ pc = ((unsigned char *) (req) + sz_xGLXSingleReq);
+ EPHYR_GLX_SINGLE_PUT_LONG(0, a_int);
+ EPHYR_GLX_SINGLE_READ_XREPLY();
+ EPHYR_GLX_SINGLE_GET_SIZE(size);
if (!size) {
- UnlockDisplay (dpy) ;
- SyncHandle () ;
- EPHYR_LOG_ERROR ("X_GLsop_GetIngerv failed\n") ;
- goto out ;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ EPHYR_LOG_ERROR("X_GLsop_GetIngerv failed\n");
+ goto out;
}
- EPHYR_GLX_SINGLE_GET_LONG (a_val) ;
- UnlockDisplay (dpy) ;
- SyncHandle () ;
- is_ok = TRUE ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ EPHYR_GLX_SINGLE_GET_LONG(a_val);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ is_ok = TRUE;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
Bool
-ephyrHostIsContextDirect (int a_ctxt_id,
- int *a_is_direct)
+ephyrHostIsContextDirect(int a_ctxt_id, int *a_is_direct)
{
- Bool is_ok=FALSE;
- Display *dpy = hostx_get_display () ;
- xGLXIsDirectReq *req=NULL;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ xGLXIsDirectReq *req = NULL;
xGLXIsDirectReply reply;
- int major_opcode=0, remote_glx_ctxt_id=0;
+ int major_opcode = 0, remote_glx_ctxt_id = 0;
- EPHYR_LOG ("enter\n") ;
- if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
- EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
- goto out ;
+ EPHYR_LOG("enter\n");
+ if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
+ EPHYR_LOG_ERROR("failed to get major opcode\n");
+ goto out;
}
- if (!hostx_get_resource_id_peer (a_ctxt_id, &remote_glx_ctxt_id)) {
- EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n") ;
- goto out ;
+ if (!hostx_get_resource_id_peer(a_ctxt_id, &remote_glx_ctxt_id)) {
+ EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n");
+ goto out;
}
- memset (&reply, 0, sizeof (reply)) ;
+ memset(&reply, 0, sizeof(reply));
/* Send the glXIsDirect request */
- LockDisplay (dpy);
- GetReq (GLXIsDirect,req);
+ LockDisplay(dpy);
+ GetReq(GLXIsDirect, req);
req->reqType = major_opcode;
req->glxCode = X_GLXIsDirect;
req->context = remote_glx_ctxt_id;
- if (!_XReply (dpy, (xReply*) &reply, 0, False)) {
- EPHYR_LOG_ERROR ("fail in reading reply from host\n") ;
- UnlockDisplay (dpy);
- SyncHandle ();
- goto out ;
+ if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ EPHYR_LOG_ERROR("fail in reading reply from host\n");
+ UnlockDisplay(dpy);
+ SyncHandle();
+ goto out;
}
- UnlockDisplay (dpy);
- SyncHandle ();
- *a_is_direct = reply.isDirect ;
- is_ok = TRUE ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ *a_is_direct = reply.isDirect;
+ is_ok = TRUE;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h
index 6db362f30..9c6012070 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h
@@ -34,43 +34,38 @@ enum EphyrHostGLXGetStringOps {
EPHYR_HOST_GLX_GetString,
};
-Bool ephyrHostGLXQueryVersion (int *a_maj, int *a_min) ;
-Bool ephyrHostGLXGetStringFromServer (int a_screen_number,
- int a_string_name,
- enum EphyrHostGLXGetStringOps a_op,
- char **a_string) ;
-Bool ephyrHostGLXGetVisualConfigs (int a_screen,
- int32_t *a_num_visuals,
- int32_t *a_num_props,
- int32_t *a_props_buf_size,
- int32_t **a_props_buf) ;
+Bool ephyrHostGLXQueryVersion(int *a_maj, int *a_min);
+Bool ephyrHostGLXGetStringFromServer(int a_screen_number,
+ int a_string_name,
+ enum EphyrHostGLXGetStringOps a_op,
+ char **a_string);
+Bool ephyrHostGLXGetVisualConfigs(int a_screen,
+ int32_t * a_num_visuals,
+ int32_t * a_num_props,
+ int32_t * a_props_buf_size,
+ int32_t ** a_props_buf);
Bool
-ephyrHostGLXVendorPrivGetFBConfigsSGIX (int a_screen,
- int32_t *a_num_visuals,
- int32_t *a_num_props,
- int32_t *a_props_buf_size,
- int32_t **a_props_buf);
-Bool ephyrHostGLXGetMajorOpcode (int32_t *a_opcode) ;
-Bool ephyrHostGLXSendClientInfo (int32_t a_major, int32_t a_minor,
- const char* a_extension_list) ;
-Bool ephyrHostGLXCreateContext (int a_screen,
- int a_visual_id,
- int a_context_id,
- int a_shared_list_ctx_id,
- Bool a_direct) ;
-Bool ephyrHostDestroyContext (int a_ctxt_id) ;
+ephyrHostGLXVendorPrivGetFBConfigsSGIX(int a_screen,
+ int32_t * a_num_visuals,
+ int32_t * a_num_props,
+ int32_t * a_props_buf_size,
+ int32_t ** a_props_buf);
+Bool ephyrHostGLXGetMajorOpcode(int32_t * a_opcode);
+Bool ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor,
+ const char *a_extension_list);
+Bool ephyrHostGLXCreateContext(int a_screen,
+ int a_visual_id,
+ int a_context_id,
+ int a_shared_list_ctx_id, Bool a_direct);
-Bool ephyrHostGLXMakeCurrent (int a_drawable, int a_glx_ctxt_id,
- int a_olg_ctxt_tag, int *a_ctxt_tag) ;
+Bool ephyrHostDestroyContext(int a_ctxt_id);
-Bool ephyrHostGetIntegerValue (int a_current_context_tag,
- int a_int,
- int *a_val) ;
+Bool ephyrHostGLXMakeCurrent(int a_drawable, int a_glx_ctxt_id,
+ int a_olg_ctxt_tag, int *a_ctxt_tag);
-Bool ephyrHostIsContextDirect (int a_ctxt_id,
- int *a_is_direct) ;
+Bool ephyrHostGetIntegerValue(int a_current_context_tag, int a_int, int *a_val);
+Bool ephyrHostIsContextDirect(int a_ctxt_id, int *a_is_direct);
#endif /*__EPHYRHOSTGLX_H__*/
-
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c
index 3137055ca..410e6b6e4 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c
@@ -50,45 +50,42 @@
dpy->bufptr += SIZEOF(xReq);\
dpy->request++
-
Bool
-ephyrHostProxyDoForward (pointer a_request_buffer,
- struct XReply *a_reply,
- Bool a_do_swap)
+ephyrHostProxyDoForward(pointer a_request_buffer,
+ struct XReply *a_reply, Bool a_do_swap)
{
- Bool is_ok = FALSE ;
- int n=0 ;
- Display *dpy=hostx_get_display () ;
- xReq *in_req = (xReq*) a_request_buffer ;
- xReq *forward_req=NULL ;
- struct XReply reply ;
+ Bool is_ok = FALSE;
+ int n = 0;
+ Display *dpy = hostx_get_display();
+ xReq *in_req = (xReq *) a_request_buffer;
+ xReq *forward_req = NULL;
+ struct XReply reply;
- EPHYR_RETURN_VAL_IF_FAIL (in_req && dpy, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(in_req && dpy, FALSE);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
if (a_do_swap) {
- swaps(&in_req->length) ;
+ swaps(&in_req->length);
}
- EPHYR_LOG ("Req {type:%d, data:%d, length:%d}\n",
- in_req->reqType, in_req->data, in_req->length) ;
- GetXReq (forward_req) ;
- memmove (forward_req, in_req, 4) ;
+ EPHYR_LOG("Req {type:%d, data:%d, length:%d}\n",
+ in_req->reqType, in_req->data, in_req->length);
+ GetXReq(forward_req);
+ memmove(forward_req, in_req, 4);
- if (!_XReply (dpy, (xReply*) &reply, 0, FALSE)) {
- EPHYR_LOG_ERROR ("failed to get reply\n") ;
+ if (!_XReply(dpy, (xReply *) & reply, 0, FALSE)) {
+ EPHYR_LOG_ERROR("failed to get reply\n");
goto out;
}
- EPHYR_LOG ("XReply{type:%d, foo:%d, seqnum:%d, length:%d}\n",
- reply.type, reply.foo, reply.sequence_number, reply.length) ;
+ EPHYR_LOG("XReply{type:%d, foo:%d, seqnum:%d, length:%d}\n",
+ reply.type, reply.foo, reply.sequence_number, reply.length);
if (a_reply) {
- memmove (a_reply, &reply, sizeof (reply)) ;
+ memmove(a_reply, &reply, sizeof(reply));
}
- is_ok = TRUE ;
+ is_ok = TRUE;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
-
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h
index 720c986ff..13721606a 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h
@@ -30,22 +30,22 @@
#define __EPHYRHOSTPROXY_H__
struct XReply {
- int8_t type ;/*X_Reply*/
+ int8_t type; /*X_Reply */
int8_t foo;
- int16_t sequence_number ;
- int32_t length ;
- /*following is some data up to 32 bytes lenght*/
- int32_t pad0 ;
- int32_t pad1 ;
- int32_t pad2 ;
- int32_t pad3 ;
- int32_t pad4 ;
- int32_t pad5 ;
+ int16_t sequence_number;
+ int32_t length;
+ /*following is some data up to 32 bytes lenght */
+ int32_t pad0;
+ int32_t pad1;
+ int32_t pad2;
+ int32_t pad3;
+ int32_t pad4;
+ int32_t pad5;
};
Bool
-ephyrHostProxyDoForward (pointer a_request_buffer,
- struct XReply *a_reply,
- Bool a_do_swap) ;
+
+ephyrHostProxyDoForward(pointer a_request_buffer,
+ struct XReply *a_reply, Bool a_do_swap);
#endif /*__EPHYRHOSTPROXY_H__*/
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
index 69ad8a517..05a821b39 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -53,42 +53,37 @@
#ifndef TRUE
#define TRUE 1
#endif /*TRUE*/
-
#ifndef FALSE
#define FALSE 0
#endif /*FALSE*/
-
static XExtensionInfo _xv_info_data;
static XExtensionInfo *xv_info = &_xv_info_data;
static char *xv_extension_name = XvName;
-static char *xv_error_string(Display *dpy, int code, XExtCodes *codes,
- char * buf, int n);
-static int xv_close_display(Display *dpy, XExtCodes *codes);
-static Bool xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire);
+static char *xv_error_string(Display * dpy, int code, XExtCodes * codes,
+ char *buf, int n);
+static int xv_close_display(Display * dpy, XExtCodes * codes);
+static Bool xv_wire_to_event(Display * dpy, XEvent * host, xEvent *wire);
static XExtensionHooks xv_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- xv_close_display, /* close_display */
- xv_wire_to_event, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- xv_error_string /* error_string */
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ xv_close_display, /* close_display */
+ xv_wire_to_event, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ xv_error_string /* error_string */
};
-
-static char *xv_error_list[] =
-{
- "BadPort", /* XvBadPort */
- "BadEncoding", /* XvBadEncoding */
- "BadControl" /* XvBadControl */
+static char *xv_error_list[] = {
+ "BadPort", /* XvBadPort */
+ "BadEncoding", /* XvBadEncoding */
+ "BadControl" /* XvBadControl */
};
-
#define XvCheckExtension(dpy, i, val) \
XextCheckExtension(dpy, i, xv_extension_name, val)
#define XvGetReq(name, req) \
@@ -102,51 +97,51 @@ static char *xv_error_list[] =
dpy->bufptr += SIZEOF(xv##name##Req);\
dpy->request++
-static XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info)
-
+static
+XEXT_GENERATE_CLOSE_DISPLAY(xv_close_display, xv_info)
-static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info,
- xv_extension_name,
- &xv_extension_hooks,
- XvNumEvents, NULL)
+static
+XEXT_GENERATE_FIND_DISPLAY(xv_find_display, xv_info,
+ xv_extension_name,
+ &xv_extension_hooks, XvNumEvents, NULL)
-static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name,
- XvNumErrors, xv_error_list)
+static
+XEXT_GENERATE_ERROR_STRING(xv_error_string, xv_extension_name,
+ XvNumErrors, xv_error_list)
struct _EphyrHostXVAdaptorArray {
- XvAdaptorInfo *adaptors ;
- unsigned int nb_adaptors ;
+ XvAdaptorInfo *adaptors;
+ unsigned int nb_adaptors;
};
/*heavily copied from libx11*/
#define BUFSIZE 2048
static void
-ephyrHostXVLogXErrorEvent (Display *a_display,
- XErrorEvent *a_err_event,
- FILE *a_fp)
+ephyrHostXVLogXErrorEvent(Display * a_display,
+ XErrorEvent * a_err_event, FILE * a_fp)
{
char buffer[BUFSIZ];
char mesg[BUFSIZ];
char number[32];
const char *mtype = "XlibMessage";
- register _XExtension *ext = (_XExtension *)NULL;
- _XExtension *bext = (_XExtension *)NULL;
- Display *dpy = a_display ;
+ register _XExtension *ext = (_XExtension *) NULL;
+ _XExtension *bext = (_XExtension *) NULL;
+ Display *dpy = a_display;
XGetErrorText(dpy, a_err_event->error_code, buffer, BUFSIZ);
XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
(void) fprintf(a_fp, "%s: %s\n ", mesg, buffer);
XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
- mesg, BUFSIZ);
+ mesg, BUFSIZ);
(void) fprintf(a_fp, mesg, a_err_event->request_code);
if (a_err_event->request_code < 128) {
snprintf(number, sizeof(number), "%d", a_err_event->request_code);
XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
- } else {
+ }
+ else {
for (ext = dpy->ext_procs;
- ext && (ext->codes.major_opcode != a_err_event->request_code);
- ext = ext->next)
- ;
+ ext && (ext->codes.major_opcode != a_err_event->request_code);
+ ext = ext->next);
if (ext)
strcpy(buffer, ext->name);
else
@@ -155,7 +150,7 @@ ephyrHostXVLogXErrorEvent (Display *a_display,
(void) fprintf(a_fp, " (%s)\n", buffer);
if (a_err_event->request_code >= 128) {
XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
- mesg, BUFSIZ);
+ mesg, BUFSIZ);
fputs(" ", a_fp);
(void) fprintf(a_fp, mesg, a_err_event->minor_code);
if (ext) {
@@ -166,20 +161,20 @@ ephyrHostXVLogXErrorEvent (Display *a_display,
}
fputs("\n", a_fp);
}
- if (a_err_event->error_code >= 128) {
+ if (a_err_event->error_code >= 128) {
/* kludge, try to find the extension that caused it */
buffer[0] = '\0';
for (ext = dpy->ext_procs; ext; ext = ext->next) {
if (ext->error_string)
- (*ext->error_string)(dpy, a_err_event->error_code, &ext->codes,
- buffer, BUFSIZ);
+ (*ext->error_string) (dpy, a_err_event->error_code, &ext->codes,
+ buffer, BUFSIZ);
if (buffer[0]) {
bext = ext;
break;
}
if (ext->codes.first_error &&
- ext->codes.first_error < (int)a_err_event->error_code &&
- (!bext || ext->codes.first_error > bext->codes.first_error))
+ ext->codes.first_error < (int) a_err_event->error_code &&
+ (!bext || ext->codes.first_error > bext->codes.first_error))
bext = ext;
}
if (bext)
@@ -196,505 +191,476 @@ ephyrHostXVLogXErrorEvent (Display *a_display,
/* let extensions try to print the values */
for (ext = dpy->ext_procs; ext; ext = ext->next) {
if (ext->error_values)
- (*ext->error_values)(dpy, a_err_event, a_fp);
+ (*ext->error_values) (dpy, a_err_event, a_fp);
}
- } else if ((a_err_event->error_code == BadWindow) ||
- (a_err_event->error_code == BadPixmap) ||
- (a_err_event->error_code == BadCursor) ||
- (a_err_event->error_code == BadFont) ||
- (a_err_event->error_code == BadDrawable) ||
- (a_err_event->error_code == BadColor) ||
- (a_err_event->error_code == BadGC) ||
- (a_err_event->error_code == BadIDChoice) ||
- (a_err_event->error_code == BadValue) ||
- (a_err_event->error_code == BadAtom)) {
+ }
+ else if ((a_err_event->error_code == BadWindow) ||
+ (a_err_event->error_code == BadPixmap) ||
+ (a_err_event->error_code == BadCursor) ||
+ (a_err_event->error_code == BadFont) ||
+ (a_err_event->error_code == BadDrawable) ||
+ (a_err_event->error_code == BadColor) ||
+ (a_err_event->error_code == BadGC) ||
+ (a_err_event->error_code == BadIDChoice) ||
+ (a_err_event->error_code == BadValue) ||
+ (a_err_event->error_code == BadAtom)) {
if (a_err_event->error_code == BadValue)
XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x",
- mesg, BUFSIZ);
+ mesg, BUFSIZ);
else if (a_err_event->error_code == BadAtom)
XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x",
- mesg, BUFSIZ);
+ mesg, BUFSIZ);
else
XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
- mesg, BUFSIZ);
+ mesg, BUFSIZ);
fputs(" ", a_fp);
(void) fprintf(a_fp, mesg, a_err_event->resourceid);
fputs("\n", a_fp);
}
XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
- mesg, BUFSIZ);
+ mesg, BUFSIZ);
fputs(" ", a_fp);
(void) fprintf(a_fp, mesg, a_err_event->serial);
XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
- mesg, BUFSIZ);
+ mesg, BUFSIZ);
fputs("\n ", a_fp);
(void) fprintf(a_fp, mesg, dpy->request);
fputs("\n", a_fp);
}
static int
-ephyrHostXVErrorHandler (Display *a_display,
- XErrorEvent *a_error_event)
+ephyrHostXVErrorHandler(Display * a_display, XErrorEvent * a_error_event)
{
- EPHYR_LOG_ERROR ("got an error from the host xserver:\n") ;
- ephyrHostXVLogXErrorEvent (a_display, a_error_event, stderr) ;
- return Success ;
+ EPHYR_LOG_ERROR("got an error from the host xserver:\n");
+ ephyrHostXVLogXErrorEvent(a_display, a_error_event, stderr);
+ return Success;
}
void
-ephyrHostXVInit (void)
+ephyrHostXVInit(void)
{
- static Bool s_initialized ;
+ static Bool s_initialized;
if (s_initialized)
- return ;
- XSetErrorHandler (ephyrHostXVErrorHandler) ;
- s_initialized = TRUE ;
+ return;
+ XSetErrorHandler(ephyrHostXVErrorHandler);
+ s_initialized = TRUE;
}
Bool
-ephyrHostXVQueryAdaptors (EphyrHostXVAdaptorArray **a_adaptors)
+ephyrHostXVQueryAdaptors(EphyrHostXVAdaptorArray ** a_adaptors)
{
- EphyrHostXVAdaptorArray *result=NULL ;
- int ret=0 ;
- Bool is_ok=FALSE ;
+ EphyrHostXVAdaptorArray *result = NULL;
+ int ret = 0;
+ Bool is_ok = FALSE;
- EPHYR_RETURN_VAL_IF_FAIL (a_adaptors, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_adaptors, FALSE);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
- result = calloc (1, sizeof (EphyrHostXVAdaptorArray)) ;
+ result = calloc(1, sizeof(EphyrHostXVAdaptorArray));
if (!result)
- goto out ;
+ goto out;
- ret = XvQueryAdaptors (hostx_get_display (),
- DefaultRootWindow (hostx_get_display ()),
- &result->nb_adaptors,
- &result->adaptors) ;
+ ret = XvQueryAdaptors(hostx_get_display(),
+ DefaultRootWindow(hostx_get_display()),
+ &result->nb_adaptors, &result->adaptors);
if (ret != Success) {
- EPHYR_LOG_ERROR ("failed to query host adaptors: %d\n", ret) ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to query host adaptors: %d\n", ret);
+ goto out;
}
- *a_adaptors = result ;
- is_ok = TRUE ;
+ *a_adaptors = result;
+ is_ok = TRUE;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
void
-ephyrHostXVAdaptorArrayDelete (EphyrHostXVAdaptorArray *a_adaptors)
+ephyrHostXVAdaptorArrayDelete(EphyrHostXVAdaptorArray * a_adaptors)
{
if (!a_adaptors)
- return ;
+ return;
if (a_adaptors->adaptors) {
- XvFreeAdaptorInfo (a_adaptors->adaptors) ;
- a_adaptors->adaptors = NULL ;
- a_adaptors->nb_adaptors = 0 ;
+ XvFreeAdaptorInfo(a_adaptors->adaptors);
+ a_adaptors->adaptors = NULL;
+ a_adaptors->nb_adaptors = 0;
}
- XFree (a_adaptors) ;
+ XFree(a_adaptors);
}
int
-ephyrHostXVAdaptorArrayGetSize (const EphyrHostXVAdaptorArray *a_this)
+ephyrHostXVAdaptorArrayGetSize(const EphyrHostXVAdaptorArray * a_this)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_this, -1) ;
- return a_this->nb_adaptors ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
+ return a_this->nb_adaptors;
}
-EphyrHostXVAdaptor*
-ephyrHostXVAdaptorArrayAt (const EphyrHostXVAdaptorArray *a_this,
- int a_index)
+EphyrHostXVAdaptor *
+ephyrHostXVAdaptorArrayAt(const EphyrHostXVAdaptorArray * a_this, int a_index)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_this, NULL) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this, NULL);
if (a_index >= a_this->nb_adaptors)
- return NULL ;
- return (EphyrHostXVAdaptor*)&a_this->adaptors[a_index] ;
+ return NULL;
+ return (EphyrHostXVAdaptor *) & a_this->adaptors[a_index];
}
char
-ephyrHostXVAdaptorGetType (const EphyrHostXVAdaptor *a_this)
+ephyrHostXVAdaptorGetType(const EphyrHostXVAdaptor * a_this)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_this, -1) ;
- return ((XvAdaptorInfo*)a_this)->type ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
+ return ((XvAdaptorInfo *) a_this)->type;
}
-const char*
-ephyrHostXVAdaptorGetName (const EphyrHostXVAdaptor *a_this)
+const char *
+ephyrHostXVAdaptorGetName(const EphyrHostXVAdaptor * a_this)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_this, NULL) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this, NULL);
- return ((XvAdaptorInfo*)a_this)->name ;
+ return ((XvAdaptorInfo *) a_this)->name;
}
-EphyrHostVideoFormat*
-ephyrHostXVAdaptorGetVideoFormats (const EphyrHostXVAdaptor *a_this,
- int *a_nb_formats)
+EphyrHostVideoFormat *
+ephyrHostXVAdaptorGetVideoFormats(const EphyrHostXVAdaptor * a_this,
+ int *a_nb_formats)
{
- EphyrHostVideoFormat *formats=NULL ;
- int nb_formats=0, i=0 ;
- XVisualInfo *visual_info, visual_info_template ;
- int nb_visual_info ;
+ EphyrHostVideoFormat *formats = NULL;
+ int nb_formats = 0, i = 0;
+ XVisualInfo *visual_info, visual_info_template;
+ int nb_visual_info;
- EPHYR_RETURN_VAL_IF_FAIL (a_this, NULL) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this, NULL);
- nb_formats = ((XvAdaptorInfo*)a_this)->num_formats ;
- formats = calloc (nb_formats, sizeof (EphyrHostVideoFormat)) ;
- for (i=0; i < nb_formats; i++) {
- memset (&visual_info_template, 0, sizeof (visual_info_template)) ;
+ nb_formats = ((XvAdaptorInfo *) a_this)->num_formats;
+ formats = calloc(nb_formats, sizeof(EphyrHostVideoFormat));
+ for (i = 0; i < nb_formats; i++) {
+ memset(&visual_info_template, 0, sizeof(visual_info_template));
visual_info_template.visualid =
- ((XvAdaptorInfo*)a_this)->formats[i].visual_id;
- visual_info = XGetVisualInfo (hostx_get_display (),
- VisualIDMask,
- &visual_info_template,
- &nb_visual_info) ;
- formats[i].depth = ((XvAdaptorInfo*)a_this)->formats[i].depth ;
- formats[i].visual_class = visual_info->class ;
- XFree (visual_info) ;
+ ((XvAdaptorInfo *) a_this)->formats[i].visual_id;
+ visual_info = XGetVisualInfo(hostx_get_display(),
+ VisualIDMask,
+ &visual_info_template, &nb_visual_info);
+ formats[i].depth = ((XvAdaptorInfo *) a_this)->formats[i].depth;
+ formats[i].visual_class = visual_info->class;
+ XFree(visual_info);
}
if (a_nb_formats)
- *a_nb_formats = nb_formats ;
- return formats ;
+ *a_nb_formats = nb_formats;
+ return formats;
}
int
-ephyrHostXVAdaptorGetNbPorts (const EphyrHostXVAdaptor *a_this)
+ephyrHostXVAdaptorGetNbPorts(const EphyrHostXVAdaptor * a_this)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_this, -1) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
- return ((XvAdaptorInfo*)a_this)->num_ports ;
+ return ((XvAdaptorInfo *) a_this)->num_ports;
}
int
-ephyrHostXVAdaptorGetFirstPortID (const EphyrHostXVAdaptor *a_this)
+ephyrHostXVAdaptorGetFirstPortID(const EphyrHostXVAdaptor * a_this)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_this, -1) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
- return ((XvAdaptorInfo*)a_this)->base_id ;
+ return ((XvAdaptorInfo *) a_this)->base_id;
}
Bool
-ephyrHostXVAdaptorHasPutVideo (const EphyrHostXVAdaptor *a_this,
- Bool *a_result)
+ephyrHostXVAdaptorHasPutVideo(const EphyrHostXVAdaptor * a_this, Bool *a_result)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE);
- if ((((XvAdaptorInfo*)a_this)->type & (XvVideoMask | XvInputMask)) ==
- (XvVideoMask | XvInputMask))
- *a_result = TRUE ;
+ if ((((XvAdaptorInfo *) a_this)->type & (XvVideoMask | XvInputMask)) ==
+ (XvVideoMask | XvInputMask))
+ *a_result = TRUE;
else
- *a_result = FALSE ;
- return TRUE ;
+ *a_result = FALSE;
+ return TRUE;
}
Bool
-ephyrHostXVAdaptorHasGetVideo (const EphyrHostXVAdaptor *a_this,
- Bool *a_result)
+ephyrHostXVAdaptorHasGetVideo(const EphyrHostXVAdaptor * a_this, Bool *a_result)
{
- if ((((XvAdaptorInfo*)a_this)->type & (XvVideoMask | XvOutputMask)) ==
- (XvVideoMask | XvOutputMask))
- *a_result = TRUE ;
+ if ((((XvAdaptorInfo *) a_this)->type & (XvVideoMask | XvOutputMask)) ==
+ (XvVideoMask | XvOutputMask))
+ *a_result = TRUE;
else
- *a_result = FALSE ;
- return TRUE ;
+ *a_result = FALSE;
+ return TRUE;
}
Bool
-ephyrHostXVAdaptorHasPutStill (const EphyrHostXVAdaptor *a_this,
- Bool *a_result)
+ephyrHostXVAdaptorHasPutStill(const EphyrHostXVAdaptor * a_this, Bool *a_result)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE);
- if ((((XvAdaptorInfo*)a_this)->type & (XvStillMask | XvInputMask)) ==
- (XvStillMask | XvInputMask))
- *a_result = TRUE ;
+ if ((((XvAdaptorInfo *) a_this)->type & (XvStillMask | XvInputMask)) ==
+ (XvStillMask | XvInputMask))
+ *a_result = TRUE;
else
- *a_result = FALSE ;
- return TRUE ;
+ *a_result = FALSE;
+ return TRUE;
}
Bool
-ephyrHostXVAdaptorHasGetStill (const EphyrHostXVAdaptor *a_this,
- Bool *a_result)
+ephyrHostXVAdaptorHasGetStill(const EphyrHostXVAdaptor * a_this, Bool *a_result)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE);
- if ((((XvAdaptorInfo*)a_this)->type & (XvStillMask | XvOutputMask)) ==
- (XvStillMask | XvOutputMask))
- *a_result = TRUE ;
+ if ((((XvAdaptorInfo *) a_this)->type & (XvStillMask | XvOutputMask)) ==
+ (XvStillMask | XvOutputMask))
+ *a_result = TRUE;
else
- *a_result = FALSE ;
- return TRUE ;
+ *a_result = FALSE;
+ return TRUE;
}
Bool
-ephyrHostXVAdaptorHasPutImage (const EphyrHostXVAdaptor *a_this,
- Bool *a_result)
+ephyrHostXVAdaptorHasPutImage(const EphyrHostXVAdaptor * a_this, Bool *a_result)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE);
- if ((((XvAdaptorInfo*)a_this)->type & (XvImageMask | XvInputMask)) ==
- (XvImageMask | XvInputMask))
- *a_result = TRUE ;
+ if ((((XvAdaptorInfo *) a_this)->type & (XvImageMask | XvInputMask)) ==
+ (XvImageMask | XvInputMask))
+ *a_result = TRUE;
else
- *a_result = FALSE ;
- return TRUE ;
+ *a_result = FALSE;
+ return TRUE;
}
Bool
-ephyrHostXVQueryEncodings (int a_port_id,
- EphyrHostEncoding **a_encodings,
- unsigned int *a_num_encodings)
+ephyrHostXVQueryEncodings(int a_port_id,
+ EphyrHostEncoding ** a_encodings,
+ unsigned int *a_num_encodings)
{
- EphyrHostEncoding *encodings=NULL ;
- XvEncodingInfo *encoding_info=NULL ;
- unsigned int num_encodings=0, i;
- int ret=0 ;
+ EphyrHostEncoding *encodings = NULL;
+ XvEncodingInfo *encoding_info = NULL;
+ unsigned int num_encodings = 0, i;
+ int ret = 0;
- EPHYR_RETURN_VAL_IF_FAIL (a_encodings && a_num_encodings, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_encodings && a_num_encodings, FALSE);
- ret = XvQueryEncodings (hostx_get_display (),
- a_port_id,
- &num_encodings,
- &encoding_info) ;
+ ret = XvQueryEncodings(hostx_get_display(),
+ a_port_id, &num_encodings, &encoding_info);
if (num_encodings && encoding_info) {
- encodings = calloc (num_encodings, sizeof (EphyrHostEncoding)) ;
- for (i=0; i<num_encodings; i++) {
- encodings[i].id = encoding_info[i].encoding_id ;
- encodings[i].name = strdup (encoding_info[i].name) ;
- encodings[i].width = encoding_info[i].width ;
- encodings[i].height = encoding_info[i].height ;
- encodings[i].rate.numerator = encoding_info[i].rate.numerator ;
- encodings[i].rate.denominator = encoding_info[i].rate.denominator ;
+ encodings = calloc(num_encodings, sizeof(EphyrHostEncoding));
+ for (i = 0; i < num_encodings; i++) {
+ encodings[i].id = encoding_info[i].encoding_id;
+ encodings[i].name = strdup(encoding_info[i].name);
+ encodings[i].width = encoding_info[i].width;
+ encodings[i].height = encoding_info[i].height;
+ encodings[i].rate.numerator = encoding_info[i].rate.numerator;
+ encodings[i].rate.denominator = encoding_info[i].rate.denominator;
}
}
if (encoding_info) {
- XvFreeEncodingInfo (encoding_info) ;
- encoding_info = NULL ;
+ XvFreeEncodingInfo(encoding_info);
+ encoding_info = NULL;
}
- *a_encodings = encodings ;
- *a_num_encodings = num_encodings ;
+ *a_encodings = encodings;
+ *a_num_encodings = num_encodings;
if (ret != Success)
- return FALSE ;
- return TRUE ;
+ return FALSE;
+ return TRUE;
}
void
-ephyrHostEncodingsDelete (EphyrHostEncoding *a_encodings,
- int a_num_encodings)
+ephyrHostEncodingsDelete(EphyrHostEncoding * a_encodings, int a_num_encodings)
{
- int i=0 ;
+ int i = 0;
if (!a_encodings)
- return ;
- for (i=0; i < a_num_encodings; i++) {
- free(a_encodings[i].name) ;
- a_encodings[i].name = NULL ;
+ return;
+ for (i = 0; i < a_num_encodings; i++) {
+ free(a_encodings[i].name);
+ a_encodings[i].name = NULL;
}
- free(a_encodings) ;
+ free(a_encodings);
}
void
-ephyrHostAttributesDelete (EphyrHostAttribute *a_attributes)
+ephyrHostAttributesDelete(EphyrHostAttribute * a_attributes)
{
if (!a_attributes)
- return ;
- XFree (a_attributes) ;
+ return;
+ XFree(a_attributes);
}
Bool
-ephyrHostXVQueryPortAttributes (int a_port_id,
- EphyrHostAttribute **a_attributes,
- int *a_num_attributes)
+ephyrHostXVQueryPortAttributes(int a_port_id,
+ EphyrHostAttribute ** a_attributes,
+ int *a_num_attributes)
{
- EPHYR_RETURN_VAL_IF_FAIL (a_attributes && a_num_attributes, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_attributes && a_num_attributes, FALSE);
*a_attributes =
- (EphyrHostAttribute*)XvQueryPortAttributes (hostx_get_display (),
- a_port_id,
- a_num_attributes);
+ (EphyrHostAttribute *) XvQueryPortAttributes(hostx_get_display(),
+ a_port_id,
+ a_num_attributes);
- return TRUE ;
+ return TRUE;
}
Bool
-ephyrHostXVQueryImageFormats (int a_port_id,
- EphyrHostImageFormat **a_formats,
- int *a_num_format)
+ephyrHostXVQueryImageFormats(int a_port_id,
+ EphyrHostImageFormat ** a_formats,
+ int *a_num_format)
{
- XvImageFormatValues *result=NULL ;
+ XvImageFormatValues *result = NULL;
- EPHYR_RETURN_VAL_IF_FAIL (a_formats && a_num_format, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_formats && a_num_format, FALSE);
- result = XvListImageFormats (hostx_get_display (),
- a_port_id,
- a_num_format) ;
- *a_formats = (EphyrHostImageFormat*) result ;
- return TRUE ;
+ result = XvListImageFormats(hostx_get_display(), a_port_id, a_num_format);
+ *a_formats = (EphyrHostImageFormat *) result;
+ return TRUE;
}
Bool
-ephyrHostXVSetPortAttribute (int a_port_id,
- int a_atom,
- int a_attr_value)
+ephyrHostXVSetPortAttribute(int a_port_id, int a_atom, int a_attr_value)
{
- int res=Success ;
+ int res = Success;
- EPHYR_LOG ("atom,name,value: (%d,%s,%d)\n",
- a_atom,
- XGetAtomName (hostx_get_display (), a_atom),
- a_attr_value) ;
+ EPHYR_LOG("atom,name,value: (%d,%s,%d)\n",
+ a_atom, XGetAtomName(hostx_get_display(), a_atom), a_attr_value);
- res = XvSetPortAttribute (hostx_get_display (),
- a_port_id,
- a_atom,
- a_attr_value) ;
+ res = XvSetPortAttribute(hostx_get_display(),
+ a_port_id, a_atom, a_attr_value);
if (res != Success) {
- EPHYR_LOG_ERROR ("XvSetPortAttribute() failed: %d\n", res) ;
- return FALSE ;
+ EPHYR_LOG_ERROR("XvSetPortAttribute() failed: %d\n", res);
+ return FALSE;
}
- XFlush (hostx_get_display ()) ;
- EPHYR_LOG ("leave\n") ;
+ XFlush(hostx_get_display());
+ EPHYR_LOG("leave\n");
- return TRUE ;
+ return TRUE;
}
Bool
-ephyrHostXVGetPortAttribute (int a_port_id,
- int a_atom,
- int *a_attr_value)
+ephyrHostXVGetPortAttribute(int a_port_id, int a_atom, int *a_attr_value)
{
- int res=Success ;
- Bool ret=FALSE ;
+ int res = Success;
+ Bool ret = FALSE;
- EPHYR_RETURN_VAL_IF_FAIL (a_attr_value, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_attr_value, FALSE);
- EPHYR_LOG ("enter, a_port_id: %d, a_atomid: %d, attr_name: %s\n",
- a_port_id, a_atom, XGetAtomName (hostx_get_display (), a_atom)) ;
+ EPHYR_LOG("enter, a_port_id: %d, a_atomid: %d, attr_name: %s\n",
+ a_port_id, a_atom, XGetAtomName(hostx_get_display(), a_atom));
- res = XvGetPortAttribute (hostx_get_display (),
- a_port_id,
- a_atom,
- a_attr_value) ;
+ res = XvGetPortAttribute(hostx_get_display(),
+ a_port_id, a_atom, a_attr_value);
if (res != Success) {
- EPHYR_LOG_ERROR ("XvGetPortAttribute() failed: %d \n", res) ;
- goto out ;
+ EPHYR_LOG_ERROR("XvGetPortAttribute() failed: %d \n", res);
+ goto out;
}
- EPHYR_LOG ("atom,value: (%d, %d)\n", a_atom, *a_attr_value) ;
+ EPHYR_LOG("atom,value: (%d, %d)\n", a_atom, *a_attr_value);
- ret = TRUE ;
+ ret = TRUE;
-out:
- EPHYR_LOG ("leave\n") ;
- return ret ;
+ out:
+ EPHYR_LOG("leave\n");
+ return ret;
}
Bool
-ephyrHostXVQueryBestSize (int a_port_id,
- Bool a_motion,
- unsigned int a_frame_w,
- unsigned int a_frame_h,
- unsigned int a_drw_w,
- unsigned int a_drw_h,
- unsigned int *a_actual_w,
- unsigned int *a_actual_h)
-{
- int res=0 ;
- Bool is_ok=FALSE ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_actual_w && a_actual_h, FALSE) ;
-
- EPHYR_LOG ("enter: frame (%dx%d), drw (%dx%d)\n",
- a_frame_w, a_frame_h,
- a_drw_w, a_drw_h) ;
-
- res = XvQueryBestSize (hostx_get_display (),
- a_port_id,
- a_motion,
- a_frame_w, a_frame_h,
- a_drw_w, a_drw_h,
- a_actual_w, a_actual_h) ;
+ephyrHostXVQueryBestSize(int a_port_id,
+ Bool a_motion,
+ unsigned int a_frame_w,
+ unsigned int a_frame_h,
+ unsigned int a_drw_w,
+ unsigned int a_drw_h,
+ unsigned int *a_actual_w, unsigned int *a_actual_h)
+{
+ int res = 0;
+ Bool is_ok = FALSE;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_actual_w && a_actual_h, FALSE);
+
+ EPHYR_LOG("enter: frame (%dx%d), drw (%dx%d)\n",
+ a_frame_w, a_frame_h, a_drw_w, a_drw_h);
+
+ res = XvQueryBestSize(hostx_get_display(),
+ a_port_id,
+ a_motion,
+ a_frame_w, a_frame_h,
+ a_drw_w, a_drw_h, a_actual_w, a_actual_h);
if (res != Success) {
- EPHYR_LOG_ERROR ("XvQueryBestSize() failed: %d\n", res) ;
- goto out ;
+ EPHYR_LOG_ERROR("XvQueryBestSize() failed: %d\n", res);
+ goto out;
}
- XSync (hostx_get_display (), FALSE) ;
+ XSync(hostx_get_display(), FALSE);
- EPHYR_LOG ("actual (%dx%d)\n", *a_actual_w, *a_actual_h) ;
- is_ok = TRUE ;
+ EPHYR_LOG("actual (%dx%d)\n", *a_actual_w, *a_actual_h);
+ is_ok = TRUE;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
static Bool
-xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire)
+xv_wire_to_event(Display * dpy, XEvent * host, xEvent *wire)
{
- XExtDisplayInfo *info = xv_find_display (dpy);
- XvEvent *re = (XvEvent *)host;
- xvEvent *event = (xvEvent *)wire;
+ XExtDisplayInfo *info = xv_find_display(dpy);
+ XvEvent *re = (XvEvent *) host;
+ xvEvent *event = (xvEvent *) wire;
XvCheckExtension(dpy, info, False);
switch ((event->u.u.type & 0x7F) - info->codes->first_event) {
- case XvVideoNotify:
- re->xvvideo.type = event->u.u.type & 0x7f;
- re->xvvideo.serial =
- _XSetLastRequestRead(dpy, (xGenericReply *)event);
- re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0);
- re->xvvideo.display = dpy;
- re->xvvideo.time = event->u.videoNotify.time;
- re->xvvideo.reason = event->u.videoNotify.reason;
- re->xvvideo.drawable = event->u.videoNotify.drawable;
- re->xvvideo.port_id = event->u.videoNotify.port;
- break;
- case XvPortNotify:
- re->xvport.type = event->u.u.type & 0x7f;
- re->xvport.serial =
- _XSetLastRequestRead(dpy, (xGenericReply *)event);
- re->xvport.send_event = ((event->u.u.type & 0x80) != 0);
- re->xvport.display = dpy;
- re->xvport.time = event->u.portNotify.time;
- re->xvport.port_id = event->u.portNotify.port;
- re->xvport.attribute = event->u.portNotify.attribute;
- re->xvport.value = event->u.portNotify.value;
- break;
- default:
- return False;
- }
-
- return True ;
+ case XvVideoNotify:
+ re->xvvideo.type = event->u.u.type & 0x7f;
+ re->xvvideo.serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
+ re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0);
+ re->xvvideo.display = dpy;
+ re->xvvideo.time = event->u.videoNotify.time;
+ re->xvvideo.reason = event->u.videoNotify.reason;
+ re->xvvideo.drawable = event->u.videoNotify.drawable;
+ re->xvvideo.port_id = event->u.videoNotify.port;
+ break;
+ case XvPortNotify:
+ re->xvport.type = event->u.u.type & 0x7f;
+ re->xvport.serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
+ re->xvport.send_event = ((event->u.u.type & 0x80) != 0);
+ re->xvport.display = dpy;
+ re->xvport.time = event->u.portNotify.time;
+ re->xvport.port_id = event->u.portNotify.port;
+ re->xvport.attribute = event->u.portNotify.attribute;
+ re->xvport.value = event->u.portNotify.value;
+ break;
+ default:
+ return False;
+ }
+
+ return True;
}
Bool
-ephyrHostXVQueryImageAttributes (int a_port_id,
- int a_image_id /*image fourcc code*/,
- unsigned short *a_width,
- unsigned short *a_height,
- int *a_image_size,
- int *a_pitches,
- int *a_offsets)
-{
- Display *dpy = hostx_get_display () ;
- Bool ret=FALSE ;
- XExtDisplayInfo *info = xv_find_display (dpy);
- xvQueryImageAttributesReq *req=NULL;
+ephyrHostXVQueryImageAttributes(int a_port_id,
+ int a_image_id /*image fourcc code */ ,
+ unsigned short *a_width,
+ unsigned short *a_height,
+ int *a_image_size,
+ int *a_pitches, int *a_offsets)
+{
+ Display *dpy = hostx_get_display();
+ Bool ret = FALSE;
+ XExtDisplayInfo *info = xv_find_display(dpy);
+ xvQueryImageAttributesReq *req = NULL;
xvQueryImageAttributesReply rep;
- EPHYR_RETURN_VAL_IF_FAIL (a_width, FALSE) ;
- EPHYR_RETURN_VAL_IF_FAIL (a_height, FALSE) ;
- EPHYR_RETURN_VAL_IF_FAIL (a_image_size, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_width, FALSE);
+ EPHYR_RETURN_VAL_IF_FAIL(a_height, FALSE);
+ EPHYR_RETURN_VAL_IF_FAIL(a_image_size, FALSE);
- XvCheckExtension (dpy, info, FALSE);
+ XvCheckExtension(dpy, info, FALSE);
- LockDisplay (dpy);
+ LockDisplay(dpy);
- XvGetReq (QueryImageAttributes, req);
+ XvGetReq(QueryImageAttributes, req);
req->id = a_image_id;
req->port = a_port_id;
req->width = *a_width;
@@ -702,315 +668,308 @@ ephyrHostXVQueryImageAttributes (int a_port_id,
/*
* read the reply
*/
- if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) {
- EPHYR_LOG_ERROR ("QeryImageAttribute req failed\n") ;
- goto out ;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ EPHYR_LOG_ERROR("QeryImageAttribute req failed\n");
+ goto out;
}
if (a_pitches && a_offsets) {
- _XRead (dpy,
- (char*)a_pitches,
- rep.num_planes << 2);
- _XRead (dpy,
- (char*)a_offsets,
- rep.num_planes << 2);
- } else {
+ _XRead(dpy, (char *) a_pitches, rep.num_planes << 2);
+ _XRead(dpy, (char *) a_offsets, rep.num_planes << 2);
+ }
+ else {
_XEatData(dpy, rep.length << 2);
}
- *a_width = rep.width ;
- *a_height = rep.height ;
- *a_image_size = rep.data_size ;
+ *a_width = rep.width;
+ *a_height = rep.height;
+ *a_image_size = rep.data_size;
- ret = TRUE ;
+ ret = TRUE;
-out:
- UnlockDisplay (dpy) ;
- SyncHandle ();
- return ret ;
+ out:
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return ret;
}
Bool
-ephyrHostGetAtom (const char* a_name,
- Bool a_create_if_not_exists,
- int *a_atom)
+ephyrHostGetAtom(const char *a_name, Bool a_create_if_not_exists, int *a_atom)
{
- int atom=None ;
+ int atom = None;
- EPHYR_RETURN_VAL_IF_FAIL (a_atom, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_atom, FALSE);
- atom = XInternAtom (hostx_get_display (), a_name, a_create_if_not_exists);
+ atom = XInternAtom(hostx_get_display(), a_name, a_create_if_not_exists);
if (atom == None) {
- return FALSE ;
+ return FALSE;
}
- *a_atom = atom ;
- return TRUE ;
+ *a_atom = atom;
+ return TRUE;
}
-char*
-ephyrHostGetAtomName (int a_atom)
+char *
+ephyrHostGetAtomName(int a_atom)
{
- return XGetAtomName (hostx_get_display (), a_atom) ;
+ return XGetAtomName(hostx_get_display(), a_atom);
}
void
-ephyrHostFree (void *a_pointer)
+ephyrHostFree(void *a_pointer)
{
if (a_pointer)
- XFree (a_pointer) ;
+ XFree(a_pointer);
}
Bool
-ephyrHostXVPutImage (int a_screen_num,
- int a_port_id,
- int a_image_id,
- int a_drw_x,
- int a_drw_y,
- int a_drw_w,
- int a_drw_h,
- int a_src_x,
- int a_src_y,
- int a_src_w,
- int a_src_h,
- int a_image_width,
- int a_image_height,
- unsigned char *a_buf,
- EphyrHostBox *a_clip_rects,
- int a_clip_rect_nums )
-{
- Bool is_ok=TRUE ;
- XvImage *xv_image=NULL ;
- GC gc=0 ;
+ephyrHostXVPutImage(int a_screen_num,
+ int a_port_id,
+ int a_image_id,
+ int a_drw_x,
+ int a_drw_y,
+ int a_drw_w,
+ int a_drw_h,
+ int a_src_x,
+ int a_src_y,
+ int a_src_w,
+ int a_src_h,
+ int a_image_width,
+ int a_image_height,
+ unsigned char *a_buf,
+ EphyrHostBox * a_clip_rects, int a_clip_rect_nums)
+{
+ Bool is_ok = TRUE;
+ XvImage *xv_image = NULL;
+ GC gc = 0;
XGCValues gc_values;
- Display *dpy = hostx_get_display () ;
- XRectangle *rects=NULL ;
- int res = 0 ;
+ Display *dpy = hostx_get_display();
+ XRectangle *rects = NULL;
+ int res = 0;
- EPHYR_RETURN_VAL_IF_FAIL (a_buf, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(a_buf, FALSE);
- EPHYR_LOG ("enter, num_clip_rects: %d\n", a_clip_rect_nums) ;
+ EPHYR_LOG("enter, num_clip_rects: %d\n", a_clip_rect_nums);
- memset (&gc_values, 0, sizeof (gc_values)) ;
- gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values);
+ memset(&gc_values, 0, sizeof(gc_values));
+ gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values);
if (!gc) {
- EPHYR_LOG_ERROR ("failed to create gc \n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to create gc \n");
+ goto out;
}
- xv_image = (XvImage*) XvCreateImage (hostx_get_display (),
+ xv_image = (XvImage *) XvCreateImage(hostx_get_display(),
a_port_id, a_image_id,
- NULL, a_image_width, a_image_height) ;
+ NULL, a_image_width, a_image_height);
if (!xv_image) {
- EPHYR_LOG_ERROR ("failed to create image\n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to create image\n");
+ goto out;
}
- xv_image->data = (char*)a_buf ;
+ xv_image->data = (char *) a_buf;
if (a_clip_rect_nums) {
- int i=0 ;
- rects = calloc (a_clip_rect_nums, sizeof (XRectangle)) ;
- for (i=0; i < a_clip_rect_nums; i++) {
- rects[i].x = a_clip_rects[i].x1 ;
- rects[i].y = a_clip_rects[i].y1 ;
+ int i = 0;
+
+ rects = calloc(a_clip_rect_nums, sizeof(XRectangle));
+ for (i = 0; i < a_clip_rect_nums; i++) {
+ rects[i].x = a_clip_rects[i].x1;
+ rects[i].y = a_clip_rects[i].y1;
rects[i].width = a_clip_rects[i].x2 - a_clip_rects[i].x1;
rects[i].height = a_clip_rects[i].y2 - a_clip_rects[i].y1;
- EPHYR_LOG ("(x,y,w,h): (%d,%d,%d,%d)\n",
- rects[i].x, rects[i].y,
- rects[i].width, rects[i].height) ;
+ EPHYR_LOG("(x,y,w,h): (%d,%d,%d,%d)\n",
+ rects[i].x, rects[i].y, rects[i].width, rects[i].height);
}
- XSetClipRectangles (dpy, gc, 0, 0, rects, a_clip_rect_nums, YXBanded) ;
- /*this always returns 1*/
- }
- res = XvPutImage (dpy, a_port_id,
- hostx_get_window (a_screen_num),
- gc, xv_image,
- a_src_x, a_src_y, a_src_w, a_src_h,
- a_drw_x, a_drw_y, a_drw_w, a_drw_h) ;
+ XSetClipRectangles(dpy, gc, 0, 0, rects, a_clip_rect_nums, YXBanded);
+ /*this always returns 1 */
+ }
+ res = XvPutImage(dpy, a_port_id,
+ hostx_get_window(a_screen_num),
+ gc, xv_image,
+ a_src_x, a_src_y, a_src_w, a_src_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h);
if (res != Success) {
- EPHYR_LOG_ERROR ("XvPutImage() failed: %d\n", res) ;
- goto out ;
+ EPHYR_LOG_ERROR("XvPutImage() failed: %d\n", res);
+ goto out;
}
- is_ok = TRUE ;
+ is_ok = TRUE;
-out:
+ out:
if (xv_image) {
- XFree (xv_image) ;
- xv_image = NULL ;
+ XFree(xv_image);
+ xv_image = NULL;
}
if (gc) {
- XFreeGC (dpy, gc) ;
- gc = NULL ;
+ XFreeGC(dpy, gc);
+ gc = NULL;
}
free(rects);
rects = NULL;
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
Bool
-ephyrHostXVPutVideo (int a_screen_num, int a_port_id,
- int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
- int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
+ephyrHostXVPutVideo(int a_screen_num, int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
{
- Bool is_ok=FALSE ;
- int res=FALSE ;
- GC gc=0 ;
+ Bool is_ok = FALSE;
+ int res = FALSE;
+ GC gc = 0;
XGCValues gc_values;
- Display *dpy=hostx_get_display () ;
+ Display *dpy = hostx_get_display();
- EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
- gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values);
+ gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values);
if (!gc) {
- EPHYR_LOG_ERROR ("failed to create gc \n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to create gc \n");
+ goto out;
}
- res = XvPutVideo (dpy, a_port_id, hostx_get_window (a_screen_num), gc,
- a_vid_x, a_vid_y, a_vid_w, a_vid_h,
- a_drw_x, a_drw_y, a_drw_w, a_drw_h) ;
+ res = XvPutVideo(dpy, a_port_id, hostx_get_window(a_screen_num), gc,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h);
if (res != Success) {
- EPHYR_LOG_ERROR ("XvPutVideo() failed: %d\n", res) ;
- goto out ;
+ EPHYR_LOG_ERROR("XvPutVideo() failed: %d\n", res);
+ goto out;
}
- is_ok = TRUE ;
+ is_ok = TRUE;
-out:
+ out:
if (gc) {
- XFreeGC (dpy, gc) ;
- gc = NULL ;
+ XFreeGC(dpy, gc);
+ gc = NULL;
}
- return is_ok ;
+ return is_ok;
}
Bool
-ephyrHostXVGetVideo (int a_screen_num, int a_port_id,
- int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
- int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
+ephyrHostXVGetVideo(int a_screen_num, int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
{
- Bool is_ok=FALSE ;
- int res=FALSE ;
- GC gc=0 ;
+ Bool is_ok = FALSE;
+ int res = FALSE;
+ GC gc = 0;
XGCValues gc_values;
- Display *dpy=hostx_get_display () ;
+ Display *dpy = hostx_get_display();
- EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
- gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values);
+ gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values);
if (!gc) {
- EPHYR_LOG_ERROR ("failed to create gc \n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to create gc \n");
+ goto out;
}
- res = XvGetVideo (dpy, a_port_id, hostx_get_window (a_screen_num), gc,
- a_vid_x, a_vid_y, a_vid_w, a_vid_h,
- a_drw_x, a_drw_y, a_drw_w, a_drw_h) ;
+ res = XvGetVideo(dpy, a_port_id, hostx_get_window(a_screen_num), gc,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h);
if (res != Success) {
- EPHYR_LOG_ERROR ("XvGetVideo() failed: %d\n", res) ;
- goto out ;
+ EPHYR_LOG_ERROR("XvGetVideo() failed: %d\n", res);
+ goto out;
}
- is_ok = TRUE ;
+ is_ok = TRUE;
-out:
+ out:
if (gc) {
- XFreeGC (dpy, gc) ;
- gc = NULL ;
+ XFreeGC(dpy, gc);
+ gc = NULL;
}
- return is_ok ;
+ return is_ok;
}
Bool
-ephyrHostXVPutStill (int a_screen_num, int a_port_id,
- int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
- int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
+ephyrHostXVPutStill(int a_screen_num, int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
{
- Bool is_ok=FALSE ;
- int res=FALSE ;
- GC gc=0 ;
+ Bool is_ok = FALSE;
+ int res = FALSE;
+ GC gc = 0;
XGCValues gc_values;
- Display *dpy=hostx_get_display () ;
+ Display *dpy = hostx_get_display();
- EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
- gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values);
+ gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values);
if (!gc) {
- EPHYR_LOG_ERROR ("failed to create gc \n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to create gc \n");
+ goto out;
}
- res = XvPutStill (dpy, a_port_id, hostx_get_window (a_screen_num), gc,
- a_vid_x, a_vid_y, a_vid_w, a_vid_h,
- a_drw_x, a_drw_y, a_drw_w, a_drw_h) ;
+ res = XvPutStill(dpy, a_port_id, hostx_get_window(a_screen_num), gc,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h);
if (res != Success) {
- EPHYR_LOG_ERROR ("XvPutStill() failed: %d\n", res) ;
- goto out ;
+ EPHYR_LOG_ERROR("XvPutStill() failed: %d\n", res);
+ goto out;
}
- is_ok = TRUE ;
+ is_ok = TRUE;
-out:
+ out:
if (gc) {
- XFreeGC (dpy, gc) ;
- gc = NULL ;
+ XFreeGC(dpy, gc);
+ gc = NULL;
}
- return is_ok ;
+ return is_ok;
}
Bool
-ephyrHostXVGetStill (int a_screen_num, int a_port_id,
- int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
- int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
+ephyrHostXVGetStill(int a_screen_num, int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
{
- Bool is_ok=FALSE ;
- int res=FALSE ;
- GC gc=0 ;
+ Bool is_ok = FALSE;
+ int res = FALSE;
+ GC gc = 0;
XGCValues gc_values;
- Display *dpy=hostx_get_display () ;
+ Display *dpy = hostx_get_display();
- EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
- gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values);
+ gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values);
if (!gc) {
- EPHYR_LOG_ERROR ("failed to create gc \n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to create gc \n");
+ goto out;
}
- res = XvGetStill (dpy, a_port_id, hostx_get_window (a_screen_num), gc,
- a_vid_x, a_vid_y, a_vid_w, a_vid_h,
- a_drw_x, a_drw_y, a_drw_w, a_drw_h) ;
+ res = XvGetStill(dpy, a_port_id, hostx_get_window(a_screen_num), gc,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h);
if (res != Success) {
- EPHYR_LOG_ERROR ("XvGetStill() failed: %d\n", res) ;
- goto out ;
+ EPHYR_LOG_ERROR("XvGetStill() failed: %d\n", res);
+ goto out;
}
- is_ok = TRUE ;
+ is_ok = TRUE;
-out:
+ out:
if (gc) {
- XFreeGC (dpy, gc) ;
- gc = NULL ;
+ XFreeGC(dpy, gc);
+ gc = NULL;
}
- return is_ok ;
+ return is_ok;
}
Bool
-ephyrHostXVStopVideo (int a_screen_num, int a_port_id)
+ephyrHostXVStopVideo(int a_screen_num, int a_port_id)
{
- int ret=0 ;
- Bool is_ok=FALSE ;
- Display *dpy = hostx_get_display () ;
+ int ret = 0;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
- EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
- ret = XvStopVideo (dpy, a_port_id, hostx_get_window (a_screen_num)) ;
+ ret = XvStopVideo(dpy, a_port_id, hostx_get_window(a_screen_num));
if (ret != Success) {
- EPHYR_LOG_ERROR ("XvStopVideo() failed: %d \n", ret) ;
- goto out ;
+ EPHYR_LOG_ERROR("XvStopVideo() failed: %d \n", ret);
+ goto out;
}
- is_ok = TRUE ;
+ is_ok = TRUE;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
-
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h
index 05ee38a03..0d3177277 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h
@@ -28,40 +28,40 @@
#ifndef __EPHYRHOSTVIDEO_H__
#define __EPHYRHOSTVIDEO_H__
-typedef void* EphyrHostXVAdaptor ;
-typedef struct _EphyrHostXVAdaptorArray EphyrHostXVAdaptorArray ;
+typedef void *EphyrHostXVAdaptor;
+typedef struct _EphyrHostXVAdaptorArray EphyrHostXVAdaptorArray;
typedef struct _EphyrHostVideoFormat {
- char depth ;
+ char depth;
short visual_class;
-} EphyrHostVideoFormat ;
+} EphyrHostVideoFormat;
typedef struct _EphyrHostRational {
- int numerator ;
- int denominator ;
+ int numerator;
+ int denominator;
} EphyrHostRational;
typedef struct _EphyrHostEncoding {
- int id ;
- char *name ;
- unsigned short width, height ;
- EphyrHostRational rate ;
-} EphyrHostEncoding ;
+ int id;
+ char *name;
+ unsigned short width, height;
+ EphyrHostRational rate;
+} EphyrHostEncoding;
typedef struct _EphyrHostAttribute {
int flags;
int min_value;
int max_value;
char *name;
-} EphyrHostAttribute ;
+} EphyrHostAttribute;
typedef struct _EphyrHostImageFormat {
- int id; /* Unique descriptor for the format */
- int type; /* XvRGB, XvYUV */
- int byte_order; /* LSBFirst, MSBFirst */
- char guid[16]; /* Globally Unique IDentifier */
+ int id; /* Unique descriptor for the format */
+ int type; /* XvRGB, XvYUV */
+ int byte_order; /* LSBFirst, MSBFirst */
+ char guid[16]; /* Globally Unique IDentifier */
int bits_per_pixel;
- int format; /* XvPacked, XvPlanar */
+ int format; /* XvPacked, XvPlanar */
int num_planes;
/* for RGB formats only */
@@ -80,159 +80,152 @@ typedef struct _EphyrHostImageFormat {
unsigned int vert_y_period;
unsigned int vert_u_period;
unsigned int vert_v_period;
- char component_order[32]; /* eg. UYVY */
- int scanline_order; /* XvTopToBottom, XvBottomToTop */
-} EphyrHostImageFormat ;
+ char component_order[32]; /* eg. UYVY */
+ int scanline_order; /* XvTopToBottom, XvBottomToTop */
+} EphyrHostImageFormat;
typedef struct {
- unsigned short x1, y1, x2, y2 ;
-} EphyrHostBox ;
+ unsigned short x1, y1, x2, y2;
+} EphyrHostBox;
-void ephyrHostXVInit (void) ;
+void ephyrHostXVInit(void);
-void ephyrHostFree (void *a_pointer) ;
+void ephyrHostFree(void *a_pointer);
/*
* host adaptor array
*/
-Bool ephyrHostXVQueryAdaptors (EphyrHostXVAdaptorArray **a_adaptors) ;
-void ephyrHostXVAdaptorArrayDelete (EphyrHostXVAdaptorArray *a_adaptors) ;
-int ephyrHostXVAdaptorArrayGetSize (const EphyrHostXVAdaptorArray *a_this) ;
-EphyrHostXVAdaptor* ephyrHostXVAdaptorArrayAt (const EphyrHostXVAdaptorArray *a_this,
- int a_index) ;
+Bool ephyrHostXVQueryAdaptors(EphyrHostXVAdaptorArray ** a_adaptors);
+void ephyrHostXVAdaptorArrayDelete(EphyrHostXVAdaptorArray * a_adaptors);
+int ephyrHostXVAdaptorArrayGetSize(const EphyrHostXVAdaptorArray * a_this);
+EphyrHostXVAdaptor *ephyrHostXVAdaptorArrayAt(const EphyrHostXVAdaptorArray *
+ a_this, int a_index);
/*
* host adaptor
*/
-char ephyrHostXVAdaptorGetType (const EphyrHostXVAdaptor *a_this) ;
-const char* ephyrHostXVAdaptorGetName (const EphyrHostXVAdaptor *a_this) ;
-EphyrHostVideoFormat* ephyrHostXVAdaptorGetVideoFormats
- (const EphyrHostXVAdaptor *a_this,
- int *a_nb_formats) ;
-int ephyrHostXVAdaptorGetNbPorts (const EphyrHostXVAdaptor *a_this) ;
-int ephyrHostXVAdaptorGetFirstPortID (const EphyrHostXVAdaptor *a_this) ;
-
-Bool ephyrHostXVAdaptorHasPutVideo (const EphyrHostXVAdaptor *a_this,
- Bool *a_result) ;
-Bool ephyrHostXVAdaptorHasGetVideo (const EphyrHostXVAdaptor *a_this,
- Bool *a_result) ;
-Bool ephyrHostXVAdaptorHasPutStill (const EphyrHostXVAdaptor *a_this,
- Bool *a_result) ;
-Bool ephyrHostXVAdaptorHasGetStill (const EphyrHostXVAdaptor *a_this,
- Bool *a_result) ;
-Bool ephyrHostXVAdaptorHasPutImage (const EphyrHostXVAdaptor *a_this,
- Bool *a_result) ;
+char ephyrHostXVAdaptorGetType(const EphyrHostXVAdaptor * a_this);
+const char *ephyrHostXVAdaptorGetName(const EphyrHostXVAdaptor * a_this);
+EphyrHostVideoFormat *ephyrHostXVAdaptorGetVideoFormats
+ (const EphyrHostXVAdaptor * a_this, int *a_nb_formats);
+int ephyrHostXVAdaptorGetNbPorts(const EphyrHostXVAdaptor * a_this);
+int ephyrHostXVAdaptorGetFirstPortID(const EphyrHostXVAdaptor * a_this);
+
+Bool ephyrHostXVAdaptorHasPutVideo(const EphyrHostXVAdaptor * a_this,
+ Bool *a_result);
+Bool ephyrHostXVAdaptorHasGetVideo(const EphyrHostXVAdaptor * a_this,
+ Bool *a_result);
+Bool ephyrHostXVAdaptorHasPutStill(const EphyrHostXVAdaptor * a_this,
+ Bool *a_result);
+Bool ephyrHostXVAdaptorHasGetStill(const EphyrHostXVAdaptor * a_this,
+ Bool *a_result);
+Bool ephyrHostXVAdaptorHasPutImage(const EphyrHostXVAdaptor * a_this,
+ Bool *a_result);
/*
* encoding
*/
-Bool ephyrHostXVQueryEncodings (int a_port_id,
- EphyrHostEncoding **a_encodings,
- unsigned int *a_num_encodings) ;
+Bool ephyrHostXVQueryEncodings(int a_port_id,
+ EphyrHostEncoding ** a_encodings,
+ unsigned int *a_num_encodings);
-void ephyrHostEncodingsDelete (EphyrHostEncoding *a_encodings,
- int a_num_encodings) ;
+void ephyrHostEncodingsDelete(EphyrHostEncoding * a_encodings,
+ int a_num_encodings);
/*
* attribute
*/
-Bool ephyrHostXVQueryPortAttributes (int a_port_id,
- EphyrHostAttribute **a_attributes,
- int *a_num_attributes) ;
+Bool ephyrHostXVQueryPortAttributes(int a_port_id,
+ EphyrHostAttribute ** a_attributes,
+ int *a_num_attributes);
+
+void ephyrHostAttributesDelete(EphyrHostAttribute * a_attributes);
-void ephyrHostAttributesDelete (EphyrHostAttribute *a_attributes) ;
/*
* image format
*/
-Bool ephyrHostXVQueryImageFormats (int a_port_id,
- EphyrHostImageFormat **a_formats,
- int *a_num_format) ;
+Bool ephyrHostXVQueryImageFormats(int a_port_id,
+ EphyrHostImageFormat ** a_formats,
+ int *a_num_format);
/*
* Port Attribute Get/Set
*/
-Bool ephyrHostXVSetPortAttribute (int a_port_id,
- int a_atom,
- int a_attr_value) ;
-Bool ephyrHostXVGetPortAttribute (int a_port_id,
- int a_atom,
- int *a_attr_value) ;
+Bool ephyrHostXVSetPortAttribute(int a_port_id, int a_atom, int a_attr_value);
+Bool ephyrHostXVGetPortAttribute(int a_port_id, int a_atom, int *a_attr_value);
+
/*
*size query
*/
-Bool ephyrHostXVQueryBestSize (int a_port_id,
- Bool a_motion,
- unsigned int a_frame_w,
- unsigned int a_frame_h,
- unsigned int a_drw_w,
- unsigned int a_drw_h,
- unsigned int *a_actual_w,
- unsigned int *a_actual_h) ;
-
-Bool ephyrHostXVQueryImageAttributes (int a_port_id,
- int a_image_id /*image fourcc code*/,
- unsigned short *a_width,
- unsigned short *a_height,
- int *a_image_size,
- int *a_pitches,
- int *a_offsets) ;
+Bool ephyrHostXVQueryBestSize(int a_port_id,
+ Bool a_motion,
+ unsigned int a_frame_w,
+ unsigned int a_frame_h,
+ unsigned int a_drw_w,
+ unsigned int a_drw_h,
+ unsigned int *a_actual_w,
+ unsigned int *a_actual_h);
+
+Bool ephyrHostXVQueryImageAttributes(int a_port_id,
+ int a_image_id /*image fourcc code */ ,
+ unsigned short *a_width,
+ unsigned short *a_height,
+ int *a_image_size,
+ int *a_pitches, int *a_offsets);
/*
* atom
*/
-Bool ephyrHostGetAtom (const char* a_name,
- Bool a_create_if_not_exists,
- int *a_atom) ;
-char* ephyrHostGetAtomName (int a_atom) ;
+Bool ephyrHostGetAtom(const char *a_name,
+ Bool a_create_if_not_exists, int *a_atom);
+char *ephyrHostGetAtomName(int a_atom);
/*
*PutImage
* (ignore clipping for now)
*/
-Bool ephyrHostXVPutImage (int a_screen_num,
- int a_port_id,
- int a_image_id,
- int a_drw_x,
- int a_drw_y,
- int a_drw_w,
- int a_drw_h,
- int a_src_x,
- int a_src_y,
- int a_src_w,
- int a_src_h,
- int a_image_width,
- int a_image_height,
- unsigned char *a_buf,
- EphyrHostBox *a_clip_rects,
- int a_clip_rect_nums) ;
+Bool ephyrHostXVPutImage(int a_screen_num,
+ int a_port_id,
+ int a_image_id,
+ int a_drw_x,
+ int a_drw_y,
+ int a_drw_w,
+ int a_drw_h,
+ int a_src_x,
+ int a_src_y,
+ int a_src_w,
+ int a_src_h,
+ int a_image_width,
+ int a_image_height,
+ unsigned char *a_buf,
+ EphyrHostBox * a_clip_rects, int a_clip_rect_nums);
/*
* Putvideo/PutStill/GetVideo
*/
-Bool ephyrHostXVPutVideo (int a_screen_num,
- int a_port_id,
- int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
- int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
-
-Bool ephyrHostXVGetVideo (int a_screen_num,
- int a_port_id,
- int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
- int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
-
-Bool ephyrHostXVPutStill (int a_screen_num,
- int a_port_id,
- int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
- int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
-
-Bool ephyrHostXVGetStill (int a_screen_num,
- int a_port_id,
- int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
- int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
+Bool ephyrHostXVPutVideo(int a_screen_num,
+ int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
+
+Bool ephyrHostXVGetVideo(int a_screen_num,
+ int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
+
+Bool ephyrHostXVPutStill(int a_screen_num,
+ int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
+
+Bool ephyrHostXVGetStill(int a_screen_num,
+ int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
/*
* StopVideo
*/
-Bool ephyrHostXVStopVideo (int a_screen_num, int a_port_id) ;
+Bool ephyrHostXVStopVideo(int a_screen_num, int a_port_id);
#endif /*__EPHYRHOSTVIDEO_H__*/
-
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
index 8160d8414..a01d5d0d0 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
@@ -30,304 +30,277 @@
#include "ephyrlog.h"
extern Window EphyrPreExistingHostWin;
-extern Bool EphyrWantGrayScale;
-extern Bool kdHasPointer;
-extern Bool kdHasKbd;
+extern Bool EphyrWantGrayScale;
+extern Bool kdHasPointer;
+extern Bool kdHasKbd;
#ifdef GLXEXT
-extern Bool ephyrNoDRI;
+extern Bool ephyrNoDRI;
extern Bool noGlxVisualInit;
#endif
-extern Bool ephyrNoXV;
+extern Bool ephyrNoXV;
#ifdef KDRIVE_EVDEV
-extern KdPointerDriver LinuxEvdevMouseDriver;
+extern KdPointerDriver LinuxEvdevMouseDriver;
extern KdKeyboardDriver LinuxEvdevKeyboardDriver;
#endif
-void processScreenArg (char *screen_size, char *parent_id) ;
+void processScreenArg(char *screen_size, char *parent_id);
void
-InitCard (char *name)
+InitCard(char *name)
{
EPHYR_DBG("mark");
- KdCardInfoAdd (&ephyrFuncs, 0);
+ KdCardInfoAdd(&ephyrFuncs, 0);
}
#ifndef _MSC_VER
void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
{
- KdInitOutput (pScreenInfo, argc, argv);
+ KdInitOutput(pScreenInfo, argc, argv);
}
void
-InitInput (int argc, char **argv)
+InitInput(int argc, char **argv)
{
- KdKeyboardInfo *ki;
- KdPointerInfo *pi;
+ KdKeyboardInfo *ki;
+ KdPointerInfo *pi;
- KdAddKeyboardDriver(&EphyrKeyboardDriver);
+ KdAddKeyboardDriver(&EphyrKeyboardDriver);
#ifdef KDRIVE_EVDEV
- KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
+ KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
#endif
- KdAddPointerDriver(&EphyrMouseDriver);
+ KdAddPointerDriver(&EphyrMouseDriver);
#ifdef KDRIVE_EVDEV
- KdAddPointerDriver(&LinuxEvdevMouseDriver);
+ KdAddPointerDriver(&LinuxEvdevMouseDriver);
#endif
- if (!kdHasKbd) {
- ki = KdNewKeyboard();
- if (!ki)
- FatalError("Couldn't create Xephyr keyboard\n");
- ki->driver = &EphyrKeyboardDriver;
- KdAddKeyboard(ki);
- }
-
- if (!kdHasPointer) {
- pi = KdNewPointer();
- if (!pi)
- FatalError("Couldn't create Xephyr pointer\n");
- pi->driver = &EphyrMouseDriver;
- KdAddPointer(pi);
- }
-
- KdInitInput();
+ if (!kdHasKbd) {
+ ki = KdNewKeyboard();
+ if (!ki)
+ FatalError("Couldn't create Xephyr keyboard\n");
+ ki->driver = &EphyrKeyboardDriver;
+ KdAddKeyboard(ki);
+ }
+
+ if (!kdHasPointer) {
+ pi = KdNewPointer();
+ if (!pi)
+ FatalError("Couldn't create Xephyr pointer\n");
+ pi->driver = &EphyrMouseDriver;
+ KdAddPointer(pi);
+ }
+
+ KdInitInput();
}
void
-CloseInput (void)
+CloseInput(void)
{
- KdCloseInput();
+ KdCloseInput();
}
#ifdef DDXBEFORERESET
void
-ddxBeforeReset (void)
+ddxBeforeReset(void)
{
}
#endif
void
-ddxUseMsg (void)
+ddxUseMsg(void)
{
- KdUseMsg();
-
- ErrorF("\nXephyr Option Usage:\n");
- ErrorF("-parent <XID> Use existing window as Xephyr root win\n");
- ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
- ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
- ErrorF("-grayscale Simulate 8bit grayscale\n");
- ErrorF("-fakexa Simulate acceleration using software rendering\n");
- ErrorF("-verbosity <level> Set log verbosity level\n");
+ KdUseMsg();
+
+ ErrorF("\nXephyr Option Usage:\n");
+ ErrorF("-parent <XID> Use existing window as Xephyr root win\n");
+ ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
+ ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
+ ErrorF("-grayscale Simulate 8bit grayscale\n");
+ ErrorF
+ ("-fakexa Simulate acceleration using software rendering\n");
+ ErrorF("-verbosity <level> Set log verbosity level\n");
#ifdef GLXEXT
- ErrorF("-nodri do not use DRI\n");
+ ErrorF("-nodri do not use DRI\n");
#endif
- ErrorF("-noxv do not use XV\n");
- ErrorF("-name [name] define the name in the WM_CLASS property\n");
- ErrorF("-title [title] set the window title in the WM_NAME property\n");
- ErrorF("\n");
+ ErrorF("-noxv do not use XV\n");
+ ErrorF("-name [name] define the name in the WM_CLASS property\n");
+ ErrorF
+ ("-title [title] set the window title in the WM_NAME property\n");
+ ErrorF("\n");
- exit(1);
+ exit(1);
}
#endif
void
-processScreenArg (char *screen_size, char *parent_id)
+processScreenArg(char *screen_size, char *parent_id)
{
- KdCardInfo *card;
+ KdCardInfo *card;
- InitCard (0); /*Put each screen on a separate card*/
- card = KdCardInfoLast ();
+ InitCard(0); /*Put each screen on a separate card */
+ card = KdCardInfoLast();
- if (card)
- {
- KdScreenInfo *screen;
- unsigned long p_id = 0;
+ if (card) {
+ KdScreenInfo *screen;
+ unsigned long p_id = 0;
- screen = KdScreenInfoAdd (card);
- KdParseScreen (screen, screen_size);
+ screen = KdScreenInfoAdd(card);
+ KdParseScreen(screen, screen_size);
- if (parent_id)
- {
- p_id = strtol (parent_id, NULL, 0);
+ if (parent_id) {
+ p_id = strtol(parent_id, NULL, 0);
}
- EPHYR_DBG ("screen number:%d\n", screen->mynum) ;
- hostx_add_screen (screen, p_id, screen->mynum);
+ EPHYR_DBG("screen number:%d\n", screen->mynum);
+ hostx_add_screen(screen, p_id, screen->mynum);
}
- else
- {
- ErrorF("No matching card found!\n");
+ else {
+ ErrorF("No matching card found!\n");
}
}
#ifndef _MSC_VER
int
-ddxProcessArgument (int argc, char **argv, int i)
+ddxProcessArgument(int argc, char **argv, int i)
{
- static char* parent = NULL;
- EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] );
+ static char *parent = NULL;
- if (i == 1)
- {
- hostx_use_resname(basename(argv[0]), 0);
+ EPHYR_DBG("mark argv[%d]='%s'", i, argv[i]);
+
+ if (i == 1) {
+ hostx_use_resname(basename(argv[0]), 0);
}
- if (!strcmp (argv[i], "-parent"))
- {
- if(i+1 < argc)
- {
- int j;
- /* If parent is specified and a screen argument follows, don't do
- * anything, let the -screen handling init the rest */
- for (j = i; j < argc; j++)
- {
- if (!strcmp(argv[j], "-screen"))
- {
- parent = argv[i + 1];
- return 2;
- }
- }
-
- processScreenArg ("100x100", argv[i+1]);
- return 2;
- }
-
- UseMsg();
- exit(1);
+ if (!strcmp(argv[i], "-parent")) {
+ if (i + 1 < argc) {
+ int j;
+
+ /* If parent is specified and a screen argument follows, don't do
+ * anything, let the -screen handling init the rest */
+ for (j = i; j < argc; j++) {
+ if (!strcmp(argv[j], "-screen")) {
+ parent = argv[i + 1];
+ return 2;
+ }
+ }
+
+ processScreenArg("100x100", argv[i + 1]);
+ return 2;
+ }
+
+ UseMsg();
+ exit(1);
}
- else if (!strcmp (argv[i], "-screen"))
- {
- if ((i+1) < argc)
- {
- processScreenArg (argv[i+1], parent);
- parent = NULL;
- return 2;
- }
-
- UseMsg();
- exit(1);
+ else if (!strcmp(argv[i], "-screen")) {
+ if ((i + 1) < argc) {
+ processScreenArg(argv[i + 1], parent);
+ parent = NULL;
+ return 2;
+ }
+
+ UseMsg();
+ exit(1);
}
- else if (!strcmp (argv[i], "-host-cursor"))
- {
- hostx_use_host_cursor();
- return 1;
+ else if (!strcmp(argv[i], "-host-cursor")) {
+ hostx_use_host_cursor();
+ return 1;
}
- else if (!strcmp (argv[i], "-fullscreen"))
- {
- hostx_use_fullscreen();
- return 1;
+ else if (!strcmp(argv[i], "-fullscreen")) {
+ hostx_use_fullscreen();
+ return 1;
}
- else if (!strcmp (argv[i], "-grayscale"))
- {
- EphyrWantGrayScale = 1;
- return 1;
+ else if (!strcmp(argv[i], "-grayscale")) {
+ EphyrWantGrayScale = 1;
+ return 1;
}
- else if (!strcmp (argv[i], "-fakexa"))
- {
- ephyrFuncs.initAccel = ephyrDrawInit;
- ephyrFuncs.enableAccel = ephyrDrawEnable;
- ephyrFuncs.disableAccel = ephyrDrawDisable;
- ephyrFuncs.finiAccel = ephyrDrawFini;
- return 1;
+ else if (!strcmp(argv[i], "-fakexa")) {
+ ephyrFuncs.initAccel = ephyrDrawInit;
+ ephyrFuncs.enableAccel = ephyrDrawEnable;
+ ephyrFuncs.disableAccel = ephyrDrawDisable;
+ ephyrFuncs.finiAccel = ephyrDrawFini;
+ return 1;
}
- else if (!strcmp (argv[i], "-verbosity"))
- {
- if(i+1 < argc && argv[i+1][0] != '-')
- {
- int verbosity=atoi (argv[i+1]) ;
- LogSetParameter (XLOG_VERBOSITY, verbosity) ;
- EPHYR_LOG ("set verbosiry to %d\n", verbosity) ;
- return 2 ;
- }
- else
- {
- UseMsg() ;
- exit(1) ;
- }
+ else if (!strcmp(argv[i], "-verbosity")) {
+ if (i + 1 < argc && argv[i + 1][0] != '-') {
+ int verbosity = atoi(argv[i + 1]);
+
+ LogSetParameter(XLOG_VERBOSITY, verbosity);
+ EPHYR_LOG("set verbosiry to %d\n", verbosity);
+ return 2;
+ }
+ else {
+ UseMsg();
+ exit(1);
+ }
}
#ifdef GLXEXT
- else if (!strcmp (argv[i], "-nodri"))
- {
- noGlxVisualInit = FALSE ;
- ephyrNoDRI = TRUE ;
- EPHYR_LOG ("no direct rendering enabled\n") ;
- return 1 ;
- }
+ else if (!strcmp(argv[i], "-nodri")) {
+ noGlxVisualInit = FALSE;
+ ephyrNoDRI = TRUE;
+ EPHYR_LOG("no direct rendering enabled\n");
+ return 1;
+ }
#endif
- else if (!strcmp (argv[i], "-noxv"))
- {
- ephyrNoXV = TRUE ;
- EPHYR_LOG ("no XVideo enabled\n") ;
- return 1 ;
- }
- else if (!strcmp (argv[i], "-name"))
- {
- if (i+1 < argc && argv[i+1][0] != '-')
- {
- hostx_use_resname(argv[i+1], 1);
- return 2;
- }
- else
- {
- UseMsg();
- return 0;
- }
- }
- else if (!strcmp (argv[i], "-title"))
- {
- if (i+1 < argc && argv[i+1][0] != '-')
- {
- hostx_set_title(argv[i+1]);
- return 2;
- }
- else
- {
- UseMsg();
- return 0;
- }
- }
- else if (argv[i][0] == ':')
- {
- hostx_set_display_name(argv[i]);
+ else if (!strcmp(argv[i], "-noxv")) {
+ ephyrNoXV = TRUE;
+ EPHYR_LOG("no XVideo enabled\n");
+ return 1;
}
- /* Xnest compatibility */
- else if (!strcmp(argv[i], "-display"))
- {
- hostx_set_display_name(argv[i+1]);
- return 2;
- }
- else if (!strcmp(argv[i], "-sync") ||
- !strcmp(argv[i], "-full") ||
- !strcmp(argv[i], "-sss") ||
- !strcmp(argv[i], "-install"))
- {
- return 1;
- }
- else if (!strcmp(argv[i], "-bw") ||
- !strcmp(argv[i], "-class") ||
- !strcmp(argv[i], "-geometry") ||
- !strcmp(argv[i], "-scrns"))
- {
- return 2;
- }
- /* end Xnest compat */
-
- return KdProcessArgument (argc, argv, i);
+ else if (!strcmp(argv[i], "-name")) {
+ if (i + 1 < argc && argv[i + 1][0] != '-') {
+ hostx_use_resname(argv[i + 1], 1);
+ return 2;
+ }
+ else {
+ UseMsg();
+ return 0;
+ }
+ }
+ else if (!strcmp(argv[i], "-title")) {
+ if (i + 1 < argc && argv[i + 1][0] != '-') {
+ hostx_set_title(argv[i + 1]);
+ return 2;
+ }
+ else {
+ UseMsg();
+ return 0;
+ }
+ }
+ else if (argv[i][0] == ':') {
+ hostx_set_display_name(argv[i]);
+ }
+ /* Xnest compatibility */
+ else if (!strcmp(argv[i], "-display")) {
+ hostx_set_display_name(argv[i + 1]);
+ return 2;
+ }
+ else if (!strcmp(argv[i], "-sync") ||
+ !strcmp(argv[i], "-full") ||
+ !strcmp(argv[i], "-sss") || !strcmp(argv[i], "-install")) {
+ return 1;
+ }
+ else if (!strcmp(argv[i], "-bw") ||
+ !strcmp(argv[i], "-class") ||
+ !strcmp(argv[i], "-geometry") || !strcmp(argv[i], "-scrns")) {
+ return 2;
+ }
+ /* end Xnest compat */
+
+ return KdProcessArgument(argc, argv, i);
}
void
-OsVendorInit (void)
+OsVendorInit(void)
{
- EPHYR_DBG("mark");
+ EPHYR_DBG("mark");
- if (hostx_want_host_cursor())
- {
- ephyrFuncs.initCursor = &ephyrCursorInit;
- ephyrFuncs.enableCursor = &ephyrCursorEnable;
+ if (hostx_want_host_cursor()) {
+ ephyrFuncs.initCursor = &ephyrCursorInit;
+ ephyrFuncs.enableCursor = &ephyrCursorEnable;
}
- KdOsInit (&EphyrOsFuncs);
+ KdOsInit(&EphyrOsFuncs);
}
#ifdef DDXOSFATALERROR
@@ -344,31 +317,32 @@ OsVendorFatalError(void)
static Bool
ephyrRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- return TRUE;
+ return TRUE;
}
static Bool
ephyrUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- return TRUE;
+ return TRUE;
}
static void
-ephyrSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+ephyrSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
+ int y)
{
- ;
+ ;
}
static void
ephyrMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
- ;
+ ;
}
static Bool
ephyrDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- return TRUE;
+ return TRUE;
}
static void
@@ -377,57 +351,55 @@ ephyrDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
}
miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
- ephyrRealizeCursor,
- ephyrUnrealizeCursor,
- ephyrSetCursor,
- ephyrMoveCursor,
- ephyrDeviceCursorInitialize,
- ephyrDeviceCursorCleanup
+ ephyrRealizeCursor,
+ ephyrUnrealizeCursor,
+ ephyrSetCursor,
+ ephyrMoveCursor,
+ ephyrDeviceCursorInitialize,
+ ephyrDeviceCursorCleanup
};
-
Bool
ephyrCursorInit(ScreenPtr pScreen)
{
- miPointerInitialize(pScreen,
- &EphyrPointerSpriteFuncs,
- &ephyrPointerScreenFuncs,
- FALSE);
+ miPointerInitialize(pScreen,
+ &EphyrPointerSpriteFuncs,
+ &ephyrPointerScreenFuncs, FALSE);
- return TRUE;
+ return TRUE;
}
void
ephyrCursorEnable(ScreenPtr pScreen)
{
- ;
+ ;
}
KdCardFuncs ephyrFuncs = {
- ephyrCardInit, /* cardinit */
- ephyrScreenInit, /* scrinit */
- ephyrInitScreen, /* initScreen */
- ephyrFinishInitScreen, /* finishInitScreen */
- ephyrCreateResources, /* createRes */
- ephyrPreserve, /* preserve */
- ephyrEnable, /* enable */
- ephyrDPMS, /* dpms */
- ephyrDisable, /* disable */
- ephyrRestore, /* restore */
- ephyrScreenFini, /* scrfini */
- ephyrCardFini, /* cardfini */
-
- 0, /* initCursor */
- 0, /* enableCursor */
- 0, /* disableCursor */
- 0, /* finiCursor */
- 0, /* recolorCursor */
-
- 0, /* initAccel */
- 0, /* enableAccel */
- 0, /* disableAccel */
- 0, /* finiAccel */
-
- ephyrGetColors,/* getColors */
- ephyrPutColors, /* putColors */
+ ephyrCardInit, /* cardinit */
+ ephyrScreenInit, /* scrinit */
+ ephyrInitScreen, /* initScreen */
+ ephyrFinishInitScreen, /* finishInitScreen */
+ ephyrCreateResources, /* createRes */
+ ephyrPreserve, /* preserve */
+ ephyrEnable, /* enable */
+ ephyrDPMS, /* dpms */
+ ephyrDisable, /* disable */
+ ephyrRestore, /* restore */
+ ephyrScreenFini, /* scrfini */
+ ephyrCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ 0, /* initAccel */
+ 0, /* enableAccel */
+ 0, /* disableAccel */
+ 0, /* finiAccel */
+
+ ephyrGetColors, /* getColors */
+ ephyrPutColors, /* putColors */
};
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c
index 0c070f4c7..3d86d2db1 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c
@@ -46,74 +46,70 @@
#include "ephyrhostproxy.h"
#include "hostx.h"
-static Bool ephyrProxyGetHostExtensionInfo (const char *a_ext_name,
- int *a_major_opcode,
- int *a_first_event,
- int *a_first_error) ;
+static Bool ephyrProxyGetHostExtensionInfo(const char *a_ext_name,
+ int *a_major_opcode,
+ int *a_first_event,
+ int *a_first_error);
-static int ephyrProxyProcDispatch (ClientPtr client) ;
+static int ephyrProxyProcDispatch(ClientPtr client);
static Bool
-ephyrProxyGetHostExtensionInfo (const char *a_ext_name,
- int *a_major_opcode,
- int *a_first_event,
- int *a_first_error)
+ephyrProxyGetHostExtensionInfo(const char *a_ext_name,
+ int *a_major_opcode,
+ int *a_first_event, int *a_first_error)
{
- return hostx_get_extension_info (a_ext_name, a_major_opcode,
- a_first_event, a_first_error) ;
+ return hostx_get_extension_info(a_ext_name, a_major_opcode,
+ a_first_event, a_first_error);
}
static int
-ephyrProxyProcDispatch (ClientPtr a_client)
+ephyrProxyProcDispatch(ClientPtr a_client)
{
- int res=BadImplementation ;
- struct XReply reply ;
+ int res = BadImplementation;
+ struct XReply reply;
- if (!ephyrHostProxyDoForward (a_client->requestBuffer, &reply, FALSE)) {
- EPHYR_LOG_ERROR ("forwarding failed\n") ;
- goto out ;
+ if (!ephyrHostProxyDoForward(a_client->requestBuffer, &reply, FALSE)) {
+ EPHYR_LOG_ERROR("forwarding failed\n");
+ goto out;
}
reply.sequence_number = a_client->sequence;
- res = Success ;
+ res = Success;
- WriteToClient(a_client, 32, (char *)&reply);
+ WriteToClient(a_client, 32, (char *) &reply);
-out:
- return res ;
+ out:
+ return res;
}
static void
-ephyrProxyProcReset (ExtensionEntry *a_entry)
+ephyrProxyProcReset(ExtensionEntry * a_entry)
{
}
Bool
-ephyrProxyExtensionInit (const char *a_extension_name)
+ephyrProxyExtensionInit(const char *a_extension_name)
{
- Bool is_ok = FALSE ;
- int major_opcode=0, first_event=0, first_error=0;
- ExtensionEntry *ext=NULL ;
+ Bool is_ok = FALSE;
+ int major_opcode = 0, first_event = 0, first_error = 0;
+ ExtensionEntry *ext = NULL;
- if (!ephyrProxyGetHostExtensionInfo (a_extension_name,
- &major_opcode,
- &first_event,
- &first_error)) {
- EPHYR_LOG ("failed to query extension %s from host\n", a_extension_name) ;
+ if (!ephyrProxyGetHostExtensionInfo(a_extension_name,
+ &major_opcode,
+ &first_event, &first_error)) {
+ EPHYR_LOG("failed to query extension %s from host\n", a_extension_name);
goto out;
}
- ext = AddExtension ((char*)a_extension_name, 0, 0,
- ephyrProxyProcDispatch,
- ephyrProxyProcDispatch,
- ephyrProxyProcReset,
- StandardMinorOpcode) ;
+ ext = AddExtension((char *) a_extension_name, 0, 0,
+ ephyrProxyProcDispatch,
+ ephyrProxyProcDispatch,
+ ephyrProxyProcReset, StandardMinorOpcode);
if (!ext) {
- EPHYR_LOG_ERROR ("failed to add the extension\n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to add the extension\n");
+ goto out;
}
- is_ok = TRUE ;
+ is_ok = TRUE;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
-
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
index 0fd1a63d4..67eadd121 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
@@ -1,1273 +1,1218 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum@openedhand.com>
- *
- * Copyright © 2007 OpenedHand Ltd
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of OpenedHand Ltd not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OpenedHand Ltd makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors:
- * Dodji Seketeli <dodji@openedhand.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-#include <string.h>
-#include <X11/extensions/Xv.h>
-#include "ephyrlog.h"
-#include "kdrive.h"
-#include "kxv.h"
-#include "ephyr.h"
-#include "hostx.h"
-#include "ephyrhostvideo.h"
-
-struct _EphyrXVPriv {
- EphyrHostXVAdaptorArray *host_adaptors ;
- KdVideoAdaptorPtr adaptors ;
- int num_adaptors ;
-};
-typedef struct _EphyrXVPriv EphyrXVPriv ;
-
-struct _EphyrPortPriv {
- int port_number ;
- KdVideoAdaptorPtr current_adaptor ;
- EphyrXVPriv *xv_priv;
- unsigned char *image_buf ;
- int image_buf_size ;
- int image_id ;
- int drw_x, drw_y, drw_w, drw_h ;
- int src_x, src_y, src_w, src_h ;
- int image_width, image_height ;
-};
-typedef struct _EphyrPortPriv EphyrPortPriv ;
-
-static Bool DoSimpleClip (BoxPtr a_dst_drw,
- BoxPtr a_clipper,
- BoxPtr a_result) ;
-
-static Bool ephyrLocalAtomToHost (int a_local_atom, int *a_host_atom) ;
-
-/*
-static Bool ephyrHostAtomToLocal (int a_host_atom, int *a_local_atom) ;
-*/
-
-static EphyrXVPriv* ephyrXVPrivNew (void) ;
-static void ephyrXVPrivDelete (EphyrXVPriv *a_this) ;
-static Bool ephyrXVPrivQueryHostAdaptors (EphyrXVPriv *a_this) ;
-static Bool ephyrXVPrivSetAdaptorsHooks (EphyrXVPriv *a_this) ;
-static Bool ephyrXVPrivRegisterAdaptors (EphyrXVPriv *a_this,
- ScreenPtr a_screen) ;
-
-static Bool ephyrXVPrivIsAttrValueValid (KdAttributePtr a_attrs,
- int a_attrs_len,
- const char *a_attr_name,
- int a_attr_value,
- Bool *a_is_valid) ;
-
-static Bool ephyrXVPrivGetImageBufSize (int a_port_id,
- int a_image_id,
- unsigned short a_width,
- unsigned short a_height,
- int *a_size) ;
-
-static Bool ephyrXVPrivSaveImageToPortPriv (EphyrPortPriv *a_port_priv,
- const unsigned char *a_image,
- int a_image_len) ;
-
-static void ephyrStopVideo (KdScreenInfo *a_info,
- pointer a_xv_priv,
- Bool a_exit);
-
-static int ephyrSetPortAttribute (KdScreenInfo *a_info,
- Atom a_attr_name,
- int a_attr_value,
- pointer a_port_priv);
-
-static int ephyrGetPortAttribute (KdScreenInfo *a_screen_info,
- Atom a_attr_name,
- int *a_attr_value,
- pointer a_port_priv);
-
-static void ephyrQueryBestSize (KdScreenInfo *a_info,
- Bool a_motion,
- short a_src_w,
- short a_src_h,
- short a_drw_w,
- short a_drw_h,
- unsigned int *a_prefered_w,
- unsigned int *a_prefered_h,
- pointer a_port_priv);
-
-static int ephyrPutImage (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_src_x,
- short a_src_y,
- short a_drw_x,
- short a_drw_y,
- short a_src_w,
- short a_src_h,
- short a_drw_w,
- short a_drw_h,
- int a_id,
- unsigned char *a_buf,
- short a_width,
- short a_height,
- Bool a_sync,
- RegionPtr a_clipping_region,
- pointer a_port_priv);
-
-static int ephyrReputImage (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_drw_x,
- short a_drw_y,
- RegionPtr a_clipping_region,
- pointer a_port_priv) ;
-
-static int ephyrPutVideo (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_vid_x, short a_vid_y,
- short a_drw_x, short a_drw_y,
- short a_vid_w, short a_vid_h,
- short a_drw_w, short a_drw_h,
- RegionPtr a_clip_region,
- pointer a_port_priv) ;
-
-static int ephyrGetVideo (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_vid_x, short a_vid_y,
- short a_drw_x, short a_drw_y,
- short a_vid_w, short a_vid_h,
- short a_drw_w, short a_drw_h,
- RegionPtr a_clip_region,
- pointer a_port_priv) ;
-
-static int ephyrPutStill (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_vid_x, short a_vid_y,
- short a_drw_x, short a_drw_y,
- short a_vid_w, short a_vid_h,
- short a_drw_w, short a_drw_h,
- RegionPtr a_clip_region,
- pointer a_port_priv) ;
-
-static int ephyrGetStill (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_vid_x, short a_vid_y,
- short a_drw_x, short a_drw_y,
- short a_vid_w, short a_vid_h,
- short a_drw_w, short a_drw_h,
- RegionPtr a_clip_region,
- pointer a_port_priv) ;
-
-static int ephyrQueryImageAttributes (KdScreenInfo *a_info,
- int a_id,
- unsigned short *a_w,
- unsigned short *a_h,
- int *a_pitches,
- int *a_offsets);
-static int s_base_port_id ;
-
-/**************
- * <helpers>
- * ************/
-
-static Bool
-DoSimpleClip (BoxPtr a_dst_box,
- BoxPtr a_clipper,
- BoxPtr a_result)
-{
- BoxRec dstClippedBox ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_dst_box && a_clipper && a_result, FALSE) ;
-
- /*
- * setup the clipbox inside the destination.
- */
- dstClippedBox.x1 = a_dst_box->x1 ;
- dstClippedBox.x2 = a_dst_box->x2 ;
- dstClippedBox.y1 = a_dst_box->y1 ;
- dstClippedBox.y2 = a_dst_box->y2 ;
-
- /*
- * if the cliper leftmost edge is inside
- * the destination area then the leftmost edge of the resulting
- * clipped box is the leftmost edge of the cliper.
- */
- if (a_clipper->x1 > dstClippedBox.x1)
- dstClippedBox.x1 = a_clipper->x1 ;
-
- /*
- * if the cliper top edge is inside the destination area
- * then the bottom horizontal edge of the resulting clipped box
- * is the bottom edge of the cliper
- */
- if (a_clipper->y1 > dstClippedBox.y1)
- dstClippedBox.y1 = a_clipper->y1 ;
-
- /*ditto for right edge*/
- if (a_clipper->x2 < dstClippedBox.x2)
- dstClippedBox.x2 = a_clipper->x2 ;
-
- /*ditto for bottom edge*/
- if (a_clipper->y2 < dstClippedBox.y2)
- dstClippedBox.y2 = a_clipper->y2 ;
-
- memcpy (a_result, &dstClippedBox, sizeof (dstClippedBox)) ;
- return TRUE ;
-}
-
-static Bool
-ephyrLocalAtomToHost (int a_local_atom, int *a_host_atom)
-{
- const char *atom_name=NULL;
- int host_atom=None ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_host_atom, FALSE) ;
-
- if (!ValidAtom (a_local_atom))
- return FALSE ;
-
- atom_name = NameForAtom (a_local_atom) ;
-
- if (!atom_name)
- return FALSE ;
-
- if (!ephyrHostGetAtom (atom_name, FALSE, &host_atom) || host_atom == None) {
- EPHYR_LOG_ERROR ("no atom for string %s defined in host X\n",
- atom_name) ;
- return FALSE ;
- }
- *a_host_atom = host_atom ;
- return TRUE ;
-}
-
-/*
- Not used yed.
-static Bool
-ephyrHostAtomToLocal (int a_host_atom, int *a_local_atom)
-{
- Bool is_ok=FALSE ;
- char *atom_name=NULL ;
- int atom=None ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_local_atom, FALSE) ;
-
- atom_name = ephyrHostGetAtomName (a_host_atom) ;
- if (!atom_name)
- goto out ;
-
- atom = MakeAtom (atom_name, strlen (atom_name), TRUE) ;
- if (atom == None)
- goto out ;
-
- *a_local_atom = atom ;
- is_ok = TRUE ;
-
-out:
- if (atom_name) {
- ephyrHostFree (atom_name) ;
- }
- return is_ok ;
-}
-*/
-
-/**************
- *</helpers>
- * ************/
-
-Bool
-ephyrInitVideo (ScreenPtr pScreen)
-{
- Bool is_ok = FALSE ;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- static EphyrXVPriv *xv_priv;
-
- EPHYR_LOG ("enter\n") ;
-
- if (screen->fb.bitsPerPixel == 8) {
- EPHYR_LOG_ERROR ("8 bits depth not supported\n") ;
- return FALSE ;
- }
-
- if (!xv_priv) {
- xv_priv = ephyrXVPrivNew () ;
- }
- if (!xv_priv) {
- EPHYR_LOG_ERROR ("failed to create xv_priv\n") ;
- goto out ;
- }
-
- if (!ephyrXVPrivRegisterAdaptors (xv_priv, pScreen)) {
- EPHYR_LOG_ERROR ("failed to register adaptors\n") ;
- goto out ;
- }
- is_ok = TRUE ;
-
-out:
- return is_ok ;
-}
-
-static EphyrXVPriv*
-ephyrXVPrivNew (void)
-{
- EphyrXVPriv *xv_priv=NULL ;
-
- EPHYR_LOG ("enter\n") ;
-
- xv_priv = calloc(1, sizeof (EphyrXVPriv)) ;
- if (!xv_priv) {
- EPHYR_LOG_ERROR ("failed to create EphyrXVPriv\n") ;
- goto error ;
- }
-
- ephyrHostXVInit () ;
-
- if (!ephyrXVPrivQueryHostAdaptors (xv_priv)) {
- EPHYR_LOG_ERROR ("failed to query the host x for xv properties\n") ;
- goto error ;
- }
- if (!ephyrXVPrivSetAdaptorsHooks (xv_priv)) {
- EPHYR_LOG_ERROR ("failed to set xv_priv hooks\n") ;
- goto error ;
- }
-
- EPHYR_LOG ("leave\n") ;
- return xv_priv ;
-
-error:
- if (xv_priv) {
- ephyrXVPrivDelete (xv_priv) ;
- xv_priv = NULL ;
- }
- return NULL ;
-}
-
-static void
-ephyrXVPrivDelete (EphyrXVPriv *a_this)
-{
- EPHYR_LOG ("enter\n") ;
-
- if (!a_this)
- return ;
- if (a_this->host_adaptors) {
- ephyrHostXVAdaptorArrayDelete (a_this->host_adaptors) ;
- a_this->host_adaptors = NULL ;
- }
- free(a_this->adaptors) ;
- a_this->adaptors = NULL ;
- free(a_this) ;
- EPHYR_LOG ("leave\n") ;
-}
-
-static KdVideoEncodingPtr
-videoEncodingDup (EphyrHostEncoding *a_encodings,
- int a_num_encodings)
-{
- KdVideoEncodingPtr result = NULL ;
- int i=0 ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_encodings && a_num_encodings, NULL) ;
-
- result = calloc(a_num_encodings, sizeof (KdVideoEncodingRec)) ;
- for (i=0 ; i < a_num_encodings; i++) {
- result[i].id = a_encodings[i].id ;
- result[i].name = strdup (a_encodings[i].name) ;
- result[i].width = a_encodings[i].width ;
- result[i].height = a_encodings[i].height ;
- result[i].rate.numerator = a_encodings[i].rate.numerator ;
- result[i].rate.denominator = a_encodings[i].rate.denominator ;
- }
- return result ;
-}
-
-static KdAttributePtr
-portAttributesDup (EphyrHostAttribute *a_encodings,
- int a_num_encodings)
-{
- int i=0 ;
- KdAttributePtr result=NULL ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_encodings && a_num_encodings, NULL) ;
-
- result = calloc(a_num_encodings, sizeof (KdAttributeRec)) ;
- if (!result) {
- EPHYR_LOG_ERROR ("failed to allocate attributes\n") ;
- return NULL ;
- }
- for (i=0; i < a_num_encodings; i++) {
- result[i].flags = a_encodings[i].flags ;
- result[i].min_value = a_encodings[i].min_value ;
- result[i].max_value = a_encodings[i].max_value ;
- result[i].name = strdup (a_encodings[i].name) ;
- }
- return result ;
-}
-
-static Bool
-ephyrXVPrivQueryHostAdaptors (EphyrXVPriv *a_this)
-{
- EphyrHostXVAdaptor *cur_host_adaptor=NULL ;
- EphyrHostVideoFormat *video_formats=NULL ;
- EphyrHostEncoding *encodings=NULL ;
- EphyrHostAttribute *attributes=NULL ;
- EphyrHostImageFormat *image_formats=NULL ;
- int num_video_formats=0, base_port_id=0,
- num_attributes=0, num_formats=0, i=0,
- port_priv_offset=0;
- unsigned num_encodings=0 ;
- Bool is_ok = FALSE ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_this, FALSE) ;
-
- EPHYR_LOG ("enter\n") ;
-
- if (!ephyrHostXVQueryAdaptors (&a_this->host_adaptors)) {
- EPHYR_LOG_ERROR ("failed to query host adaptors\n") ;
- goto out ;
- }
- if (a_this->host_adaptors)
- a_this->num_adaptors =
- ephyrHostXVAdaptorArrayGetSize (a_this->host_adaptors) ;
- if (a_this->num_adaptors < 0) {
- EPHYR_LOG_ERROR ("failed to get number of host adaptors\n") ;
- goto out ;
- }
- EPHYR_LOG ("host has %d adaptors\n", a_this->num_adaptors) ;
- /*
- * copy what we can from adaptors into a_this->adaptors
- */
- if (a_this->num_adaptors) {
- a_this->adaptors = calloc(a_this->num_adaptors,
- sizeof (KdVideoAdaptorRec)) ;
- if (!a_this->adaptors) {
- EPHYR_LOG_ERROR ("failed to create internal adaptors\n") ;
- goto out ;
- }
- }
- for (i=0; i < a_this->num_adaptors; i++) {
- int j=0 ;
- cur_host_adaptor =
- ephyrHostXVAdaptorArrayAt (a_this->host_adaptors, i) ;
- if (!cur_host_adaptor)
- continue ;
- a_this->adaptors[i].nPorts =
- ephyrHostXVAdaptorGetNbPorts (cur_host_adaptor) ;
- if (a_this->adaptors[i].nPorts <=0) {
- EPHYR_LOG_ERROR ("Could not find any port of adaptor %d\n", i) ;
- continue ;
- }
- a_this->adaptors[i].type =
- ephyrHostXVAdaptorGetType (cur_host_adaptor) ;
- a_this->adaptors[i].type |= XvWindowMask ;
- a_this->adaptors[i].flags =
- VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
- if (ephyrHostXVAdaptorGetName (cur_host_adaptor))
- a_this->adaptors[i].name =
- strdup (ephyrHostXVAdaptorGetName (cur_host_adaptor)) ;
- else
- a_this->adaptors[i].name = strdup ("Xephyr Video Overlay");
- base_port_id = ephyrHostXVAdaptorGetFirstPortID (cur_host_adaptor) ;
- if (base_port_id < 0) {
- EPHYR_LOG_ERROR ("failed to get port id for adaptor %d\n", i) ;
- continue ;
- }
- if (!s_base_port_id)
- s_base_port_id = base_port_id ;
-
- if (!ephyrHostXVQueryEncodings (base_port_id,
- &encodings,
- &num_encodings)) {
- EPHYR_LOG_ERROR ("failed to get encodings for port port id %d,"
- " adaptors %d\n",
- base_port_id, i) ;
- continue ;
- }
- a_this->adaptors[i].nEncodings = num_encodings ;
- a_this->adaptors[i].pEncodings =
- videoEncodingDup (encodings, num_encodings) ;
- video_formats = (EphyrHostVideoFormat*)
- ephyrHostXVAdaptorGetVideoFormats (cur_host_adaptor,
- &num_video_formats);
- a_this->adaptors[i].pFormats = (KdVideoFormatPtr) video_formats ;
- a_this->adaptors[i].nFormats = num_video_formats ;
- /* got a_this->adaptors[i].nPorts already
- a_this->adaptors[i].nPorts =
- ephyrHostXVAdaptorGetNbPorts (cur_host_adaptor) ;
- */
- a_this->adaptors[i].pPortPrivates =
- calloc(a_this->adaptors[i].nPorts,
- sizeof (DevUnion) + sizeof (EphyrPortPriv)) ;
- port_priv_offset = a_this->adaptors[i].nPorts;
- for (j=0; j < a_this->adaptors[i].nPorts; j++) {
- EphyrPortPriv *port_privs_base =
- (EphyrPortPriv*)&a_this->adaptors[i].pPortPrivates[port_priv_offset];
- EphyrPortPriv *port_priv = &port_privs_base[j] ;
- port_priv->port_number = base_port_id + j;
- port_priv->current_adaptor = &a_this->adaptors[i] ;
- port_priv->xv_priv = a_this ;
- a_this->adaptors[i].pPortPrivates[j].ptr = port_priv;
- }
- if (!ephyrHostXVQueryPortAttributes (base_port_id,
- &attributes,
- &num_attributes)) {
- EPHYR_LOG_ERROR ("failed to get port attribute "
- "for adaptor %d\n", i) ;
- continue ;
- }
- a_this->adaptors[i].pAttributes =
- portAttributesDup (attributes, num_attributes);
- a_this->adaptors[i].nAttributes = num_attributes ;
- /*make sure atoms of attrs names are created in xephyr*/
- for (j=0; j < a_this->adaptors[i].nAttributes; j++) {
- if (a_this->adaptors[i].pAttributes[j].name)
- MakeAtom (a_this->adaptors[i].pAttributes[j].name,
- strlen (a_this->adaptors[i].pAttributes[j].name),
- TRUE) ;
- }
- if (!ephyrHostXVQueryImageFormats (base_port_id,
- &image_formats,
- &num_formats)) {
- EPHYR_LOG_ERROR ("failed to get image formats "
- "for adaptor %d\n", i) ;
- continue ;
- }
- a_this->adaptors[i].pImages = (KdImagePtr) image_formats ;
- a_this->adaptors[i].nImages = num_formats ;
- }
- is_ok = TRUE ;
-
-out:
- if (encodings) {
- ephyrHostEncodingsDelete (encodings, num_encodings) ;
- encodings = NULL ;
- }
- if (attributes) {
- ephyrHostAttributesDelete (attributes) ;
- attributes = NULL ;
- }
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
-}
-
-static Bool
-ephyrXVPrivSetAdaptorsHooks (EphyrXVPriv *a_this)
-{
- int i=0 ;
- Bool has_it=FALSE ;
- EphyrHostXVAdaptor *cur_host_adaptor=NULL ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_this, FALSE) ;
-
- EPHYR_LOG ("enter\n") ;
-
- for (i=0; i < a_this->num_adaptors; i++) {
- a_this->adaptors[i].ReputImage = ephyrReputImage ;
- a_this->adaptors[i].StopVideo = ephyrStopVideo ;
- a_this->adaptors[i].SetPortAttribute = ephyrSetPortAttribute ;
- a_this->adaptors[i].GetPortAttribute = ephyrGetPortAttribute ;
- a_this->adaptors[i].QueryBestSize = ephyrQueryBestSize ;
- a_this->adaptors[i].QueryImageAttributes = ephyrQueryImageAttributes ;
-
- cur_host_adaptor =
- ephyrHostXVAdaptorArrayAt (a_this->host_adaptors, i) ;
- if (!cur_host_adaptor) {
- EPHYR_LOG_ERROR ("failed to get host adaptor at index %d\n", i) ;
- continue ;
- }
- has_it = FALSE ;
- if (!ephyrHostXVAdaptorHasPutImage (cur_host_adaptor, &has_it)) {
- EPHYR_LOG_ERROR ("error\n") ;
- }
- if (has_it) {
- a_this->adaptors[i].PutImage = ephyrPutImage;
- }
-
- has_it = FALSE ;
- if (!ephyrHostXVAdaptorHasPutVideo (cur_host_adaptor, &has_it)) {
- EPHYR_LOG_ERROR ("error\n") ;
- }
- if (has_it) {
- a_this->adaptors[i].PutVideo = ephyrPutVideo;
- }
-
- has_it = FALSE ;
- if (!ephyrHostXVAdaptorHasGetVideo (cur_host_adaptor, &has_it)) {
- EPHYR_LOG_ERROR ("error\n") ;
- }
- if (has_it) {
- a_this->adaptors[i].GetVideo = ephyrGetVideo;
- }
-
- has_it = FALSE ;
- if (!ephyrHostXVAdaptorHasPutStill (cur_host_adaptor, &has_it)) {
- EPHYR_LOG_ERROR ("error\n") ;
- }
- if (has_it) {
- a_this->adaptors[i].PutStill = ephyrPutStill;
- }
-
- has_it = FALSE ;
- if (!ephyrHostXVAdaptorHasGetStill (cur_host_adaptor, &has_it)) {
- EPHYR_LOG_ERROR ("error\n") ;
- }
- if (has_it) {
- a_this->adaptors[i].GetStill = ephyrGetStill;
- }
- }
- EPHYR_LOG ("leave\n") ;
- return TRUE ;
-}
-
-static Bool
-ephyrXVPrivRegisterAdaptors (EphyrXVPriv *a_this,
- ScreenPtr a_screen)
-{
- KdScreenPriv(a_screen);
- KdScreenInfo *screen = pScreenPriv->screen;
- Bool is_ok = FALSE ;
- KdVideoAdaptorPtr *adaptors=NULL, *registered_adaptors=NULL ;
- int num_registered_adaptors=0, i=0, num_adaptors=0 ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_this && a_screen, FALSE) ;
-
- EPHYR_LOG ("enter\n") ;
-
- if (!a_this->num_adaptors)
- goto out ;
- num_registered_adaptors =
- KdXVListGenericAdaptors (screen, &registered_adaptors);
-
- num_adaptors = num_registered_adaptors + a_this->num_adaptors ;
- adaptors = calloc(num_adaptors, sizeof (KdVideoAdaptorPtr)) ;
- if (!adaptors) {
- EPHYR_LOG_ERROR ("failed to allocate adaptors tab\n") ;
- goto out ;
- }
- memmove (adaptors, registered_adaptors, num_registered_adaptors) ;
- for (i=0 ; i < a_this->num_adaptors; i++) {
- *(adaptors + num_registered_adaptors + i) = &a_this->adaptors[i] ;
- }
- if (!KdXVScreenInit (a_screen, adaptors, num_adaptors)) {
- EPHYR_LOG_ERROR ("failed to register adaptors\n");
- goto out ;
- }
- EPHYR_LOG ("there are %d registered adaptors\n", num_adaptors) ;
- is_ok = TRUE ;
-
-out:
- free(registered_adaptors) ;
- registered_adaptors = NULL ;
- free(adaptors) ;
- adaptors = NULL ;
-
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
-}
-
-static Bool
-ephyrXVPrivIsAttrValueValid (KdAttributePtr a_attrs,
- int a_attrs_len,
- const char *a_attr_name,
- int a_attr_value,
- Bool *a_is_valid)
-{
- int i=0 ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_attrs && a_attr_name && a_is_valid,
- FALSE) ;
-
- for (i=0; i < a_attrs_len; i++) {
- if (a_attrs[i].name && strcmp (a_attrs[i].name, a_attr_name))
- continue ;
- if (a_attrs[i].min_value > a_attr_value ||
- a_attrs[i].max_value < a_attr_value) {
- *a_is_valid = FALSE ;
- EPHYR_LOG_ERROR ("attribute was not valid\n"
- "value:%d. min:%d. max:%d\n",
- a_attr_value,
- a_attrs[i].min_value,
- a_attrs[i].max_value) ;
- } else {
- *a_is_valid = TRUE ;
- }
- return TRUE ;
- }
- return FALSE ;
-}
-
-static Bool
-ephyrXVPrivGetImageBufSize (int a_port_id,
- int a_image_id,
- unsigned short a_width,
- unsigned short a_height,
- int *a_size)
-{
- Bool is_ok=FALSE ;
- unsigned short width=a_width, height=a_height ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_size, FALSE) ;
-
- EPHYR_LOG ("enter\n") ;
-
- if (!ephyrHostXVQueryImageAttributes (a_port_id, a_image_id,
- &width, &height, a_size, NULL, NULL)) {
- EPHYR_LOG_ERROR ("failed to get image attributes\n") ;
- goto out ;
- }
- is_ok = TRUE ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
-}
-
-static Bool
-ephyrXVPrivSaveImageToPortPriv (EphyrPortPriv *a_port_priv,
- const unsigned char *a_image_buf,
- int a_image_len)
-{
- Bool is_ok=FALSE ;
-
- EPHYR_LOG ("enter\n") ;
-
- if (a_port_priv->image_buf_size < a_image_len) {
- unsigned char *buf=NULL ;
- buf = realloc (a_port_priv->image_buf, a_image_len) ;
- if (!buf) {
- EPHYR_LOG_ERROR ("failed to realloc image buffer\n") ;
- goto out ;
- }
- a_port_priv->image_buf = buf ;
- a_port_priv->image_buf_size = a_image_len;
- }
- memmove (a_port_priv->image_buf, a_image_buf, a_image_len) ;
- is_ok = TRUE ;
-
-out:
- return is_ok ;
- EPHYR_LOG ("leave\n") ;
-}
-
-static void
-ephyrStopVideo (KdScreenInfo *a_info, pointer a_port_priv, Bool a_exit)
-{
- EphyrPortPriv *port_priv = a_port_priv ;
-
- EPHYR_RETURN_IF_FAIL (a_info && a_info->pScreen) ;
- EPHYR_RETURN_IF_FAIL (port_priv) ;
-
- EPHYR_LOG ("enter\n") ;
- if (!ephyrHostXVStopVideo (a_info->pScreen->myNum,
- port_priv->port_number)) {
- EPHYR_LOG_ERROR ("XvStopVideo() failed\n") ;
- }
- EPHYR_LOG ("leave\n") ;
-}
-
-static int
-ephyrSetPortAttribute (KdScreenInfo *a_info,
- Atom a_attr_name,
- int a_attr_value,
- pointer a_port_priv)
-{
- int res=Success, host_atom=0 ;
- EphyrPortPriv *port_priv = a_port_priv ;
- Bool is_attr_valid=FALSE ;
-
- EPHYR_RETURN_VAL_IF_FAIL (port_priv, BadMatch) ;
- EPHYR_RETURN_VAL_IF_FAIL (port_priv->current_adaptor, BadMatch) ;
- EPHYR_RETURN_VAL_IF_FAIL (port_priv->current_adaptor->pAttributes,
- BadMatch) ;
- EPHYR_RETURN_VAL_IF_FAIL (port_priv->current_adaptor->nAttributes,
- BadMatch) ;
- EPHYR_RETURN_VAL_IF_FAIL (ValidAtom (a_attr_name), BadMatch) ;
-
- EPHYR_LOG ("enter, portnum:%d, atomid:%d, attr_name:%s, attr_val:%d\n",
- port_priv->port_number,
- (int)a_attr_name,
- NameForAtom (a_attr_name),
- a_attr_value) ;
-
- if (!ephyrLocalAtomToHost (a_attr_name, &host_atom)) {
- EPHYR_LOG_ERROR ("failed to convert local atom to host atom\n") ;
- res = BadMatch ;
- goto out ;
- }
-
- if (!ephyrXVPrivIsAttrValueValid (port_priv->current_adaptor->pAttributes,
- port_priv->current_adaptor->nAttributes,
- NameForAtom (a_attr_name),
- a_attr_value,
- &is_attr_valid)) {
- EPHYR_LOG_ERROR ("failed to validate attribute %s\n",
- NameForAtom (a_attr_name)) ;
- /*
- res = BadMatch ;
- goto out ;
- */
- }
- if (!is_attr_valid) {
- EPHYR_LOG_ERROR ("attribute %s is not valid\n",
- NameForAtom (a_attr_name)) ;
- /*
- res = BadMatch ;
- goto out ;
- */
- }
-
- if (!ephyrHostXVSetPortAttribute (port_priv->port_number,
- host_atom,
- a_attr_value)) {
- EPHYR_LOG_ERROR ("failed to set port attribute\n") ;
- res = BadMatch ;
- goto out ;
- }
-
- res = Success ;
-out:
- EPHYR_LOG ("leave\n") ;
- return res ;
-}
-
-static int
-ephyrGetPortAttribute (KdScreenInfo *a_screen_info,
- Atom a_attr_name,
- int *a_attr_value,
- pointer a_port_priv)
-{
- int res=Success, host_atom=0 ;
- EphyrPortPriv *port_priv = a_port_priv ;
-
- EPHYR_RETURN_VAL_IF_FAIL (port_priv, BadMatch) ;
- EPHYR_RETURN_VAL_IF_FAIL (ValidAtom (a_attr_name), BadMatch) ;
-
- EPHYR_LOG ("enter, portnum:%d, atomid:%d, attr_name:%s\n",
- port_priv->port_number,
- (int)a_attr_name,
- NameForAtom (a_attr_name)) ;
-
- if (!ephyrLocalAtomToHost (a_attr_name, &host_atom)) {
- EPHYR_LOG_ERROR ("failed to convert local atom to host atom\n") ;
- res = BadMatch ;
- goto out ;
- }
-
- if (!ephyrHostXVGetPortAttribute (port_priv->port_number,
- host_atom,
- a_attr_value)) {
- EPHYR_LOG_ERROR ("failed to get port attribute\n") ;
- res = BadMatch ;
- goto out ;
- }
-
- res = Success ;
-out:
- EPHYR_LOG ("leave\n") ;
- return res ;
-}
-
-static void
-ephyrQueryBestSize (KdScreenInfo *a_info,
- Bool a_motion,
- short a_src_w,
- short a_src_h,
- short a_drw_w,
- short a_drw_h,
- unsigned int *a_prefered_w,
- unsigned int *a_prefered_h,
- pointer a_port_priv)
-{
- int res=0 ;
- EphyrPortPriv *port_priv = a_port_priv ;
-
- EPHYR_RETURN_IF_FAIL (port_priv) ;
-
- EPHYR_LOG ("enter\n") ;
- res = ephyrHostXVQueryBestSize (port_priv->port_number,
- a_motion,
- a_src_w, a_src_h,
- a_drw_w, a_drw_h,
- a_prefered_w, a_prefered_h) ;
- if (!res) {
- EPHYR_LOG_ERROR ("Failed to query best size\n") ;
- }
- EPHYR_LOG ("leave\n") ;
-}
-
-static int
-ephyrPutImage (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_src_x,
- short a_src_y,
- short a_drw_x,
- short a_drw_y,
- short a_src_w,
- short a_src_h,
- short a_drw_w,
- short a_drw_h,
- int a_id,
- unsigned char *a_buf,
- short a_width,
- short a_height,
- Bool a_sync,
- RegionPtr a_clipping_region,
- pointer a_port_priv)
-{
- EphyrPortPriv *port_priv = a_port_priv ;
- Bool is_ok=FALSE ;
- int result=BadImplementation, image_size=0 ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ;
- EPHYR_RETURN_VAL_IF_FAIL (a_drawable, BadValue) ;
-
- EPHYR_LOG ("enter\n") ;
-
- if (!ephyrHostXVPutImage (a_info->pScreen->myNum,
- port_priv->port_number,
- a_id,
- a_drw_x, a_drw_y, a_drw_w, a_drw_h,
- a_src_x, a_src_y, a_src_w, a_src_h,
- a_width, a_height, a_buf,
- (EphyrHostBox*)RegionRects (a_clipping_region),
- RegionNumRects (a_clipping_region))) {
- EPHYR_LOG_ERROR ("EphyrHostXVPutImage() failed\n") ;
- goto out ;
- }
-
- /*
- * Now save the image so that we can resend it to host it
- * later, in ReputImage.
- */
- if (!ephyrXVPrivGetImageBufSize (port_priv->port_number,
- a_id, a_width, a_height, &image_size)) {
- EPHYR_LOG_ERROR ("failed to get image size\n") ;
- /*this is a minor error so we won't get bail out abruptly*/
- is_ok = FALSE ;
- } else {
- is_ok = TRUE ;
- }
- if (is_ok) {
- if (!ephyrXVPrivSaveImageToPortPriv (port_priv, a_buf, image_size)) {
- is_ok=FALSE ;
- } else {
- port_priv->image_id = a_id;
- port_priv->drw_x = a_drw_x;
- port_priv->drw_y = a_drw_y;
- port_priv->drw_w = a_drw_w ;
- port_priv->drw_h = a_drw_h ;
- port_priv->src_x = a_src_x;
- port_priv->src_y = a_src_y ;
- port_priv->src_w = a_src_w ;
- port_priv->src_h = a_src_h ;
- port_priv->image_width = a_width ;
- port_priv->image_height = a_height ;
- }
- }
- if (!is_ok) {
- if (port_priv->image_buf) {
- free (port_priv->image_buf) ;
- port_priv->image_buf = NULL ;
- port_priv->image_buf_size = 0 ;
- }
- }
-
- result = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return result ;
-}
-
-static int
-ephyrReputImage (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_drw_x,
- short a_drw_y,
- RegionPtr a_clipping_region,
- pointer a_port_priv)
-{
- EphyrPortPriv *port_priv = a_port_priv ;
- int result=BadImplementation ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_info->pScreen, FALSE) ;
- EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ;
-
- EPHYR_LOG ("enter\n") ;
-
- if (!port_priv->image_buf_size || !port_priv->image_buf) {
- EPHYR_LOG_ERROR ("has null image buf in cache\n") ;
- goto out ;
- }
- if (!ephyrHostXVPutImage (a_info->pScreen->myNum,
- port_priv->port_number,
- port_priv->image_id,
- a_drw_x, a_drw_y,
- port_priv->drw_w, port_priv->drw_h,
- port_priv->src_x, port_priv->src_y,
- port_priv->src_w, port_priv->src_h,
- port_priv->image_width, port_priv->image_height,
- port_priv->image_buf,
- (EphyrHostBox*)RegionRects (a_clipping_region),
- RegionNumRects (a_clipping_region))) {
- EPHYR_LOG_ERROR ("ephyrHostXVPutImage() failed\n") ;
- goto out ;
- }
-
- result = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return result ;
-}
-
-static int
-ephyrPutVideo (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_vid_x, short a_vid_y,
- short a_drw_x, short a_drw_y,
- short a_vid_w, short a_vid_h,
- short a_drw_w, short a_drw_h,
- RegionPtr a_clipping_region,
- pointer a_port_priv)
-{
- EphyrPortPriv *port_priv = a_port_priv ;
- BoxRec clipped_area, dst_box ;
- int result=BadImplementation ;
- int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_info->pScreen, BadValue) ;
- EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ;
-
- EPHYR_LOG ("enter\n") ;
-
- dst_box.x1 = a_drw_x ;
- dst_box.x2 = a_drw_x + a_drw_w;
- dst_box.y1 = a_drw_y ;
- dst_box.y2 = a_drw_y + a_drw_h;
-
- if (!DoSimpleClip (&dst_box,
- RegionExtents(a_clipping_region),
- &clipped_area)) {
- EPHYR_LOG_ERROR ("failed to simple clip\n") ;
- goto out ;
- }
-
- drw_x = clipped_area.x1 ;
- drw_y = clipped_area.y1 ;
- drw_w = clipped_area.x2 - clipped_area.x1 ;
- drw_h = clipped_area.y2 - clipped_area.y1 ;
-
- if (!ephyrHostXVPutVideo (a_info->pScreen->myNum,
- port_priv->port_number,
- a_vid_x, a_vid_y, a_vid_w, a_vid_h,
- a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
- EPHYR_LOG_ERROR ("ephyrHostXVPutVideo() failed\n") ;
- goto out ;
- }
- result = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return result ;
-}
-
-static int
-ephyrGetVideo (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_vid_x, short a_vid_y,
- short a_drw_x, short a_drw_y,
- short a_vid_w, short a_vid_h,
- short a_drw_w, short a_drw_h,
- RegionPtr a_clipping_region,
- pointer a_port_priv)
-{
- EphyrPortPriv *port_priv = a_port_priv ;
- BoxRec clipped_area, dst_box ;
- int result=BadImplementation ;
- int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ;
- EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ;
-
- EPHYR_LOG ("enter\n") ;
-
- dst_box.x1 = a_drw_x ;
- dst_box.x2 = a_drw_x + a_drw_w;
- dst_box.y1 = a_drw_y ;
- dst_box.y2 = a_drw_y + a_drw_h;
-
- if (!DoSimpleClip (&dst_box,
- RegionExtents(a_clipping_region),
- &clipped_area)) {
- EPHYR_LOG_ERROR ("failed to simple clip\n") ;
- goto out ;
- }
-
- drw_x = clipped_area.x1 ;
- drw_y = clipped_area.y1 ;
- drw_w = clipped_area.x2 - clipped_area.x1 ;
- drw_h = clipped_area.y2 - clipped_area.y1 ;
-
- if (!ephyrHostXVGetVideo (a_info->pScreen->myNum,
- port_priv->port_number,
- a_vid_x, a_vid_y, a_vid_w, a_vid_h,
- a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
- EPHYR_LOG_ERROR ("ephyrHostXVGetVideo() failed\n") ;
- goto out ;
- }
- result = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return result ;
-}
-
-static int
-ephyrPutStill (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_vid_x, short a_vid_y,
- short a_drw_x, short a_drw_y,
- short a_vid_w, short a_vid_h,
- short a_drw_w, short a_drw_h,
- RegionPtr a_clipping_region,
- pointer a_port_priv)
-{
- EphyrPortPriv *port_priv = a_port_priv ;
- BoxRec clipped_area, dst_box ;
- int result=BadImplementation ;
- int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ;
- EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ;
-
- EPHYR_LOG ("enter\n") ;
-
- dst_box.x1 = a_drw_x ;
- dst_box.x2 = a_drw_x + a_drw_w;
- dst_box.y1 = a_drw_y ;
- dst_box.y2 = a_drw_y + a_drw_h;
-
- if (!DoSimpleClip (&dst_box,
- RegionExtents(a_clipping_region),
- &clipped_area)) {
- EPHYR_LOG_ERROR ("failed to simple clip\n") ;
- goto out ;
- }
-
- drw_x = clipped_area.x1 ;
- drw_y = clipped_area.y1 ;
- drw_w = clipped_area.x2 - clipped_area.x1 ;
- drw_h = clipped_area.y2 - clipped_area.y1 ;
-
- if (!ephyrHostXVPutStill (a_info->pScreen->myNum,
- port_priv->port_number,
- a_vid_x, a_vid_y, a_vid_w, a_vid_h,
- a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
- EPHYR_LOG_ERROR ("ephyrHostXVPutStill() failed\n") ;
- goto out ;
- }
- result = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return result ;
-}
-
-static int
-ephyrGetStill (KdScreenInfo *a_info,
- DrawablePtr a_drawable,
- short a_vid_x, short a_vid_y,
- short a_drw_x, short a_drw_y,
- short a_vid_w, short a_vid_h,
- short a_drw_w, short a_drw_h,
- RegionPtr a_clipping_region,
- pointer a_port_priv)
-{
- EphyrPortPriv *port_priv = a_port_priv ;
- BoxRec clipped_area, dst_box ;
- int result=BadImplementation ;
- int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ;
- EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ;
-
- EPHYR_LOG ("enter\n") ;
-
- dst_box.x1 = a_drw_x ;
- dst_box.x2 = a_drw_x + a_drw_w;
- dst_box.y1 = a_drw_y ;
- dst_box.y2 = a_drw_y + a_drw_h;
-
- if (!DoSimpleClip (&dst_box,
- RegionExtents(a_clipping_region),
- &clipped_area)) {
- EPHYR_LOG_ERROR ("failed to simple clip\n") ;
- goto out ;
- }
-
- drw_x = clipped_area.x1 ;
- drw_y = clipped_area.y1 ;
- drw_w = clipped_area.x2 - clipped_area.x1 ;
- drw_h = clipped_area.y2 - clipped_area.y1 ;
-
- if (!ephyrHostXVGetStill (a_info->pScreen->myNum,
- port_priv->port_number,
- a_vid_x, a_vid_y, a_vid_w, a_vid_h,
- a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
- EPHYR_LOG_ERROR ("ephyrHostXVGetStill() failed\n") ;
- goto out ;
- }
- result = Success ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return result ;
-}
-
-static int
-ephyrQueryImageAttributes (KdScreenInfo *a_info,
- int a_id,
- unsigned short *a_w,
- unsigned short *a_h,
- int *a_pitches,
- int *a_offsets)
-{
- int image_size=0 ;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_w && a_h, FALSE) ;
-
- EPHYR_LOG ("enter: dim (%dx%d), pitches: %p, offsets: %p\n",
- *a_w, *a_h, a_pitches, a_offsets) ;
-
- if (!ephyrHostXVQueryImageAttributes (s_base_port_id,
- a_id,
- a_w, a_h,
- &image_size,
- a_pitches, a_offsets)) {
- EPHYR_LOG_ERROR ("EphyrHostXVQueryImageAttributes() failed\n") ;
- goto out ;
- }
- EPHYR_LOG ("image size: %d, dim (%dx%d)\n", image_size, *a_w, *a_h) ;
-
-out:
- EPHYR_LOG ("leave\n") ;
- return image_size ;
-}
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include <string.h>
+#include <X11/extensions/Xv.h>
+#include "ephyrlog.h"
+#include "kdrive.h"
+#include "kxv.h"
+#include "ephyr.h"
+#include "hostx.h"
+#include "ephyrhostvideo.h"
+
+struct _EphyrXVPriv {
+ EphyrHostXVAdaptorArray *host_adaptors;
+ KdVideoAdaptorPtr adaptors;
+ int num_adaptors;
+};
+typedef struct _EphyrXVPriv EphyrXVPriv;
+
+struct _EphyrPortPriv {
+ int port_number;
+ KdVideoAdaptorPtr current_adaptor;
+ EphyrXVPriv *xv_priv;
+ unsigned char *image_buf;
+ int image_buf_size;
+ int image_id;
+ int drw_x, drw_y, drw_w, drw_h;
+ int src_x, src_y, src_w, src_h;
+ int image_width, image_height;
+};
+typedef struct _EphyrPortPriv EphyrPortPriv;
+
+static Bool DoSimpleClip(BoxPtr a_dst_drw, BoxPtr a_clipper, BoxPtr a_result);
+
+static Bool ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom);
+
+/*
+static Bool ephyrHostAtomToLocal (int a_host_atom, int *a_local_atom) ;
+*/
+
+static EphyrXVPriv *ephyrXVPrivNew(void);
+static void ephyrXVPrivDelete(EphyrXVPriv * a_this);
+static Bool ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this);
+static Bool ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this);
+static Bool ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this,
+ ScreenPtr a_screen);
+
+static Bool ephyrXVPrivIsAttrValueValid(KdAttributePtr a_attrs,
+ int a_attrs_len,
+ const char *a_attr_name,
+ int a_attr_value, Bool *a_is_valid);
+
+static Bool ephyrXVPrivGetImageBufSize(int a_port_id,
+ int a_image_id,
+ unsigned short a_width,
+ unsigned short a_height, int *a_size);
+
+static Bool ephyrXVPrivSaveImageToPortPriv(EphyrPortPriv * a_port_priv,
+ const unsigned char *a_image,
+ int a_image_len);
+
+static void ephyrStopVideo(KdScreenInfo * a_info,
+ pointer a_xv_priv, Bool a_exit);
+
+static int ephyrSetPortAttribute(KdScreenInfo * a_info,
+ Atom a_attr_name,
+ int a_attr_value, pointer a_port_priv);
+
+static int ephyrGetPortAttribute(KdScreenInfo * a_screen_info,
+ Atom a_attr_name,
+ int *a_attr_value, pointer a_port_priv);
+
+static void ephyrQueryBestSize(KdScreenInfo * a_info,
+ Bool a_motion,
+ short a_src_w,
+ short a_src_h,
+ short a_drw_w,
+ short a_drw_h,
+ unsigned int *a_prefered_w,
+ unsigned int *a_prefered_h, pointer a_port_priv);
+
+static int ephyrPutImage(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_src_x,
+ short a_src_y,
+ short a_drw_x,
+ short a_drw_y,
+ short a_src_w,
+ short a_src_h,
+ short a_drw_w,
+ short a_drw_h,
+ int a_id,
+ unsigned char *a_buf,
+ short a_width,
+ short a_height,
+ Bool a_sync,
+ RegionPtr a_clipping_region, pointer a_port_priv);
+
+static int ephyrReputImage(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_drw_x,
+ short a_drw_y,
+ RegionPtr a_clipping_region, pointer a_port_priv);
+
+static int ephyrPutVideo(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clip_region, pointer a_port_priv);
+
+static int ephyrGetVideo(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clip_region, pointer a_port_priv);
+
+static int ephyrPutStill(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clip_region, pointer a_port_priv);
+
+static int ephyrGetStill(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clip_region, pointer a_port_priv);
+
+static int ephyrQueryImageAttributes(KdScreenInfo * a_info,
+ int a_id,
+ unsigned short *a_w,
+ unsigned short *a_h,
+ int *a_pitches, int *a_offsets);
+static int s_base_port_id;
+
+/**************
+ * <helpers>
+ * ************/
+
+static Bool
+DoSimpleClip(BoxPtr a_dst_box, BoxPtr a_clipper, BoxPtr a_result)
+{
+ BoxRec dstClippedBox;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_dst_box && a_clipper && a_result, FALSE);
+
+ /*
+ * setup the clipbox inside the destination.
+ */
+ dstClippedBox.x1 = a_dst_box->x1;
+ dstClippedBox.x2 = a_dst_box->x2;
+ dstClippedBox.y1 = a_dst_box->y1;
+ dstClippedBox.y2 = a_dst_box->y2;
+
+ /*
+ * if the cliper leftmost edge is inside
+ * the destination area then the leftmost edge of the resulting
+ * clipped box is the leftmost edge of the cliper.
+ */
+ if (a_clipper->x1 > dstClippedBox.x1)
+ dstClippedBox.x1 = a_clipper->x1;
+
+ /*
+ * if the cliper top edge is inside the destination area
+ * then the bottom horizontal edge of the resulting clipped box
+ * is the bottom edge of the cliper
+ */
+ if (a_clipper->y1 > dstClippedBox.y1)
+ dstClippedBox.y1 = a_clipper->y1;
+
+ /*ditto for right edge */
+ if (a_clipper->x2 < dstClippedBox.x2)
+ dstClippedBox.x2 = a_clipper->x2;
+
+ /*ditto for bottom edge */
+ if (a_clipper->y2 < dstClippedBox.y2)
+ dstClippedBox.y2 = a_clipper->y2;
+
+ memcpy(a_result, &dstClippedBox, sizeof(dstClippedBox));
+ return TRUE;
+}
+
+static Bool
+ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom)
+{
+ const char *atom_name = NULL;
+ int host_atom = None;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_host_atom, FALSE);
+
+ if (!ValidAtom(a_local_atom))
+ return FALSE;
+
+ atom_name = NameForAtom(a_local_atom);
+
+ if (!atom_name)
+ return FALSE;
+
+ if (!ephyrHostGetAtom(atom_name, FALSE, &host_atom) || host_atom == None) {
+ EPHYR_LOG_ERROR("no atom for string %s defined in host X\n", atom_name);
+ return FALSE;
+ }
+ *a_host_atom = host_atom;
+ return TRUE;
+}
+
+/*
+ Not used yed.
+static Bool
+ephyrHostAtomToLocal (int a_host_atom, int *a_local_atom)
+{
+ Bool is_ok=FALSE ;
+ char *atom_name=NULL ;
+ int atom=None ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_local_atom, FALSE) ;
+
+ atom_name = ephyrHostGetAtomName (a_host_atom) ;
+ if (!atom_name)
+ goto out ;
+
+ atom = MakeAtom (atom_name, strlen (atom_name), TRUE) ;
+ if (atom == None)
+ goto out ;
+
+ *a_local_atom = atom ;
+ is_ok = TRUE ;
+
+out:
+ if (atom_name) {
+ ephyrHostFree (atom_name) ;
+ }
+ return is_ok ;
+}
+*/
+
+/**************
+ *</helpers>
+ * ************/
+
+Bool
+ephyrInitVideo(ScreenPtr pScreen)
+{
+ Bool is_ok = FALSE;
+
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ static EphyrXVPriv *xv_priv;
+
+ EPHYR_LOG("enter\n");
+
+ if (screen->fb.bitsPerPixel == 8) {
+ EPHYR_LOG_ERROR("8 bits depth not supported\n");
+ return FALSE;
+ }
+
+ if (!xv_priv) {
+ xv_priv = ephyrXVPrivNew();
+ }
+ if (!xv_priv) {
+ EPHYR_LOG_ERROR("failed to create xv_priv\n");
+ goto out;
+ }
+
+ if (!ephyrXVPrivRegisterAdaptors(xv_priv, pScreen)) {
+ EPHYR_LOG_ERROR("failed to register adaptors\n");
+ goto out;
+ }
+ is_ok = TRUE;
+
+ out:
+ return is_ok;
+}
+
+static EphyrXVPriv *
+ephyrXVPrivNew(void)
+{
+ EphyrXVPriv *xv_priv = NULL;
+
+ EPHYR_LOG("enter\n");
+
+ xv_priv = calloc(1, sizeof(EphyrXVPriv));
+ if (!xv_priv) {
+ EPHYR_LOG_ERROR("failed to create EphyrXVPriv\n");
+ goto error;
+ }
+
+ ephyrHostXVInit();
+
+ if (!ephyrXVPrivQueryHostAdaptors(xv_priv)) {
+ EPHYR_LOG_ERROR("failed to query the host x for xv properties\n");
+ goto error;
+ }
+ if (!ephyrXVPrivSetAdaptorsHooks(xv_priv)) {
+ EPHYR_LOG_ERROR("failed to set xv_priv hooks\n");
+ goto error;
+ }
+
+ EPHYR_LOG("leave\n");
+ return xv_priv;
+
+ error:
+ if (xv_priv) {
+ ephyrXVPrivDelete(xv_priv);
+ xv_priv = NULL;
+ }
+ return NULL;
+}
+
+static void
+ephyrXVPrivDelete(EphyrXVPriv * a_this)
+{
+ EPHYR_LOG("enter\n");
+
+ if (!a_this)
+ return;
+ if (a_this->host_adaptors) {
+ ephyrHostXVAdaptorArrayDelete(a_this->host_adaptors);
+ a_this->host_adaptors = NULL;
+ }
+ free(a_this->adaptors);
+ a_this->adaptors = NULL;
+ free(a_this);
+ EPHYR_LOG("leave\n");
+}
+
+static KdVideoEncodingPtr
+videoEncodingDup(EphyrHostEncoding * a_encodings, int a_num_encodings)
+{
+ KdVideoEncodingPtr result = NULL;
+ int i = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_encodings && a_num_encodings, NULL);
+
+ result = calloc(a_num_encodings, sizeof(KdVideoEncodingRec));
+ for (i = 0; i < a_num_encodings; i++) {
+ result[i].id = a_encodings[i].id;
+ result[i].name = strdup(a_encodings[i].name);
+ result[i].width = a_encodings[i].width;
+ result[i].height = a_encodings[i].height;
+ result[i].rate.numerator = a_encodings[i].rate.numerator;
+ result[i].rate.denominator = a_encodings[i].rate.denominator;
+ }
+ return result;
+}
+
+static KdAttributePtr
+portAttributesDup(EphyrHostAttribute * a_encodings, int a_num_encodings)
+{
+ int i = 0;
+ KdAttributePtr result = NULL;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_encodings && a_num_encodings, NULL);
+
+ result = calloc(a_num_encodings, sizeof(KdAttributeRec));
+ if (!result) {
+ EPHYR_LOG_ERROR("failed to allocate attributes\n");
+ return NULL;
+ }
+ for (i = 0; i < a_num_encodings; i++) {
+ result[i].flags = a_encodings[i].flags;
+ result[i].min_value = a_encodings[i].min_value;
+ result[i].max_value = a_encodings[i].max_value;
+ result[i].name = strdup(a_encodings[i].name);
+ }
+ return result;
+}
+
+static Bool
+ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
+{
+ EphyrHostXVAdaptor *cur_host_adaptor = NULL;
+ EphyrHostVideoFormat *video_formats = NULL;
+ EphyrHostEncoding *encodings = NULL;
+ EphyrHostAttribute *attributes = NULL;
+ EphyrHostImageFormat *image_formats = NULL;
+ int num_video_formats = 0, base_port_id = 0,
+ num_attributes = 0, num_formats = 0, i = 0, port_priv_offset = 0;
+ unsigned num_encodings = 0;
+ Bool is_ok = FALSE;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_this, FALSE);
+
+ EPHYR_LOG("enter\n");
+
+ if (!ephyrHostXVQueryAdaptors(&a_this->host_adaptors)) {
+ EPHYR_LOG_ERROR("failed to query host adaptors\n");
+ goto out;
+ }
+ if (a_this->host_adaptors)
+ a_this->num_adaptors =
+ ephyrHostXVAdaptorArrayGetSize(a_this->host_adaptors);
+ if (a_this->num_adaptors < 0) {
+ EPHYR_LOG_ERROR("failed to get number of host adaptors\n");
+ goto out;
+ }
+ EPHYR_LOG("host has %d adaptors\n", a_this->num_adaptors);
+ /*
+ * copy what we can from adaptors into a_this->adaptors
+ */
+ if (a_this->num_adaptors) {
+ a_this->adaptors = calloc(a_this->num_adaptors,
+ sizeof(KdVideoAdaptorRec));
+ if (!a_this->adaptors) {
+ EPHYR_LOG_ERROR("failed to create internal adaptors\n");
+ goto out;
+ }
+ }
+ for (i = 0; i < a_this->num_adaptors; i++) {
+ int j = 0;
+
+ cur_host_adaptor = ephyrHostXVAdaptorArrayAt(a_this->host_adaptors, i);
+ if (!cur_host_adaptor)
+ continue;
+ a_this->adaptors[i].nPorts =
+ ephyrHostXVAdaptorGetNbPorts(cur_host_adaptor);
+ if (a_this->adaptors[i].nPorts <= 0) {
+ EPHYR_LOG_ERROR("Could not find any port of adaptor %d\n", i);
+ continue;
+ }
+ a_this->adaptors[i].type = ephyrHostXVAdaptorGetType(cur_host_adaptor);
+ a_this->adaptors[i].type |= XvWindowMask;
+ a_this->adaptors[i].flags =
+ VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
+ if (ephyrHostXVAdaptorGetName(cur_host_adaptor))
+ a_this->adaptors[i].name =
+ strdup(ephyrHostXVAdaptorGetName(cur_host_adaptor));
+ else
+ a_this->adaptors[i].name = strdup("Xephyr Video Overlay");
+ base_port_id = ephyrHostXVAdaptorGetFirstPortID(cur_host_adaptor);
+ if (base_port_id < 0) {
+ EPHYR_LOG_ERROR("failed to get port id for adaptor %d\n", i);
+ continue;
+ }
+ if (!s_base_port_id)
+ s_base_port_id = base_port_id;
+
+ if (!ephyrHostXVQueryEncodings(base_port_id,
+ &encodings, &num_encodings)) {
+ EPHYR_LOG_ERROR("failed to get encodings for port port id %d,"
+ " adaptors %d\n", base_port_id, i);
+ continue;
+ }
+ a_this->adaptors[i].nEncodings = num_encodings;
+ a_this->adaptors[i].pEncodings =
+ videoEncodingDup(encodings, num_encodings);
+ video_formats = (EphyrHostVideoFormat *)
+ ephyrHostXVAdaptorGetVideoFormats(cur_host_adaptor,
+ &num_video_formats);
+ a_this->adaptors[i].pFormats = (KdVideoFormatPtr) video_formats;
+ a_this->adaptors[i].nFormats = num_video_formats;
+ /* got a_this->adaptors[i].nPorts already
+ a_this->adaptors[i].nPorts =
+ ephyrHostXVAdaptorGetNbPorts (cur_host_adaptor) ;
+ */
+ a_this->adaptors[i].pPortPrivates =
+ calloc(a_this->adaptors[i].nPorts,
+ sizeof(DevUnion) + sizeof(EphyrPortPriv));
+ port_priv_offset = a_this->adaptors[i].nPorts;
+ for (j = 0; j < a_this->adaptors[i].nPorts; j++) {
+ EphyrPortPriv *port_privs_base =
+ (EphyrPortPriv *) & a_this->adaptors[i].
+ pPortPrivates[port_priv_offset];
+ EphyrPortPriv *port_priv = &port_privs_base[j];
+
+ port_priv->port_number = base_port_id + j;
+ port_priv->current_adaptor = &a_this->adaptors[i];
+ port_priv->xv_priv = a_this;
+ a_this->adaptors[i].pPortPrivates[j].ptr = port_priv;
+ }
+ if (!ephyrHostXVQueryPortAttributes(base_port_id,
+ &attributes, &num_attributes)) {
+ EPHYR_LOG_ERROR("failed to get port attribute "
+ "for adaptor %d\n", i);
+ continue;
+ }
+ a_this->adaptors[i].pAttributes =
+ portAttributesDup(attributes, num_attributes);
+ a_this->adaptors[i].nAttributes = num_attributes;
+ /*make sure atoms of attrs names are created in xephyr */
+ for (j = 0; j < a_this->adaptors[i].nAttributes; j++) {
+ if (a_this->adaptors[i].pAttributes[j].name)
+ MakeAtom(a_this->adaptors[i].pAttributes[j].name,
+ strlen(a_this->adaptors[i].pAttributes[j].name), TRUE);
+ }
+ if (!ephyrHostXVQueryImageFormats(base_port_id,
+ &image_formats, &num_formats)) {
+ EPHYR_LOG_ERROR("failed to get image formats "
+ "for adaptor %d\n", i);
+ continue;
+ }
+ a_this->adaptors[i].pImages = (KdImagePtr) image_formats;
+ a_this->adaptors[i].nImages = num_formats;
+ }
+ is_ok = TRUE;
+
+ out:
+ if (encodings) {
+ ephyrHostEncodingsDelete(encodings, num_encodings);
+ encodings = NULL;
+ }
+ if (attributes) {
+ ephyrHostAttributesDelete(attributes);
+ attributes = NULL;
+ }
+ EPHYR_LOG("leave\n");
+ return is_ok;
+}
+
+static Bool
+ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this)
+{
+ int i = 0;
+ Bool has_it = FALSE;
+ EphyrHostXVAdaptor *cur_host_adaptor = NULL;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_this, FALSE);
+
+ EPHYR_LOG("enter\n");
+
+ for (i = 0; i < a_this->num_adaptors; i++) {
+ a_this->adaptors[i].ReputImage = ephyrReputImage;
+ a_this->adaptors[i].StopVideo = ephyrStopVideo;
+ a_this->adaptors[i].SetPortAttribute = ephyrSetPortAttribute;
+ a_this->adaptors[i].GetPortAttribute = ephyrGetPortAttribute;
+ a_this->adaptors[i].QueryBestSize = ephyrQueryBestSize;
+ a_this->adaptors[i].QueryImageAttributes = ephyrQueryImageAttributes;
+
+ cur_host_adaptor = ephyrHostXVAdaptorArrayAt(a_this->host_adaptors, i);
+ if (!cur_host_adaptor) {
+ EPHYR_LOG_ERROR("failed to get host adaptor at index %d\n", i);
+ continue;
+ }
+ has_it = FALSE;
+ if (!ephyrHostXVAdaptorHasPutImage(cur_host_adaptor, &has_it)) {
+ EPHYR_LOG_ERROR("error\n");
+ }
+ if (has_it) {
+ a_this->adaptors[i].PutImage = ephyrPutImage;
+ }
+
+ has_it = FALSE;
+ if (!ephyrHostXVAdaptorHasPutVideo(cur_host_adaptor, &has_it)) {
+ EPHYR_LOG_ERROR("error\n");
+ }
+ if (has_it) {
+ a_this->adaptors[i].PutVideo = ephyrPutVideo;
+ }
+
+ has_it = FALSE;
+ if (!ephyrHostXVAdaptorHasGetVideo(cur_host_adaptor, &has_it)) {
+ EPHYR_LOG_ERROR("error\n");
+ }
+ if (has_it) {
+ a_this->adaptors[i].GetVideo = ephyrGetVideo;
+ }
+
+ has_it = FALSE;
+ if (!ephyrHostXVAdaptorHasPutStill(cur_host_adaptor, &has_it)) {
+ EPHYR_LOG_ERROR("error\n");
+ }
+ if (has_it) {
+ a_this->adaptors[i].PutStill = ephyrPutStill;
+ }
+
+ has_it = FALSE;
+ if (!ephyrHostXVAdaptorHasGetStill(cur_host_adaptor, &has_it)) {
+ EPHYR_LOG_ERROR("error\n");
+ }
+ if (has_it) {
+ a_this->adaptors[i].GetStill = ephyrGetStill;
+ }
+ }
+ EPHYR_LOG("leave\n");
+ return TRUE;
+}
+
+static Bool
+ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this, ScreenPtr a_screen)
+{
+ KdScreenPriv(a_screen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ Bool is_ok = FALSE;
+ KdVideoAdaptorPtr *adaptors = NULL, *registered_adaptors = NULL;
+ int num_registered_adaptors = 0, i = 0, num_adaptors = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_this && a_screen, FALSE);
+
+ EPHYR_LOG("enter\n");
+
+ if (!a_this->num_adaptors)
+ goto out;
+ num_registered_adaptors =
+ KdXVListGenericAdaptors(screen, &registered_adaptors);
+
+ num_adaptors = num_registered_adaptors + a_this->num_adaptors;
+ adaptors = calloc(num_adaptors, sizeof(KdVideoAdaptorPtr));
+ if (!adaptors) {
+ EPHYR_LOG_ERROR("failed to allocate adaptors tab\n");
+ goto out;
+ }
+ memmove(adaptors, registered_adaptors, num_registered_adaptors);
+ for (i = 0; i < a_this->num_adaptors; i++) {
+ *(adaptors + num_registered_adaptors + i) = &a_this->adaptors[i];
+ }
+ if (!KdXVScreenInit(a_screen, adaptors, num_adaptors)) {
+ EPHYR_LOG_ERROR("failed to register adaptors\n");
+ goto out;
+ }
+ EPHYR_LOG("there are %d registered adaptors\n", num_adaptors);
+ is_ok = TRUE;
+
+ out:
+ free(registered_adaptors);
+ registered_adaptors = NULL;
+ free(adaptors);
+ adaptors = NULL;
+
+ EPHYR_LOG("leave\n");
+ return is_ok;
+}
+
+static Bool
+ephyrXVPrivIsAttrValueValid(KdAttributePtr a_attrs,
+ int a_attrs_len,
+ const char *a_attr_name,
+ int a_attr_value, Bool *a_is_valid)
+{
+ int i = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_attrs && a_attr_name && a_is_valid, FALSE);
+
+ for (i = 0; i < a_attrs_len; i++) {
+ if (a_attrs[i].name && strcmp(a_attrs[i].name, a_attr_name))
+ continue;
+ if (a_attrs[i].min_value > a_attr_value ||
+ a_attrs[i].max_value < a_attr_value) {
+ *a_is_valid = FALSE;
+ EPHYR_LOG_ERROR("attribute was not valid\n"
+ "value:%d. min:%d. max:%d\n",
+ a_attr_value,
+ a_attrs[i].min_value, a_attrs[i].max_value);
+ }
+ else {
+ *a_is_valid = TRUE;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static Bool
+ephyrXVPrivGetImageBufSize(int a_port_id,
+ int a_image_id,
+ unsigned short a_width,
+ unsigned short a_height, int *a_size)
+{
+ Bool is_ok = FALSE;
+ unsigned short width = a_width, height = a_height;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_size, FALSE);
+
+ EPHYR_LOG("enter\n");
+
+ if (!ephyrHostXVQueryImageAttributes(a_port_id, a_image_id,
+ &width, &height, a_size, NULL, NULL)) {
+ EPHYR_LOG_ERROR("failed to get image attributes\n");
+ goto out;
+ }
+ is_ok = TRUE;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
+}
+
+static Bool
+ephyrXVPrivSaveImageToPortPriv(EphyrPortPriv * a_port_priv,
+ const unsigned char *a_image_buf,
+ int a_image_len)
+{
+ Bool is_ok = FALSE;
+
+ EPHYR_LOG("enter\n");
+
+ if (a_port_priv->image_buf_size < a_image_len) {
+ unsigned char *buf = NULL;
+
+ buf = realloc(a_port_priv->image_buf, a_image_len);
+ if (!buf) {
+ EPHYR_LOG_ERROR("failed to realloc image buffer\n");
+ goto out;
+ }
+ a_port_priv->image_buf = buf;
+ a_port_priv->image_buf_size = a_image_len;
+ }
+ memmove(a_port_priv->image_buf, a_image_buf, a_image_len);
+ is_ok = TRUE;
+
+ out:
+ return is_ok;
+ EPHYR_LOG("leave\n");
+}
+
+static void
+ephyrStopVideo(KdScreenInfo * a_info, pointer a_port_priv, Bool a_exit)
+{
+ EphyrPortPriv *port_priv = a_port_priv;
+
+ EPHYR_RETURN_IF_FAIL(a_info && a_info->pScreen);
+ EPHYR_RETURN_IF_FAIL(port_priv);
+
+ EPHYR_LOG("enter\n");
+ if (!ephyrHostXVStopVideo(a_info->pScreen->myNum, port_priv->port_number)) {
+ EPHYR_LOG_ERROR("XvStopVideo() failed\n");
+ }
+ EPHYR_LOG("leave\n");
+}
+
+static int
+ephyrSetPortAttribute(KdScreenInfo * a_info,
+ Atom a_attr_name, int a_attr_value, pointer a_port_priv)
+{
+ int res = Success, host_atom = 0;
+ EphyrPortPriv *port_priv = a_port_priv;
+ Bool is_attr_valid = FALSE;
+
+ EPHYR_RETURN_VAL_IF_FAIL(port_priv, BadMatch);
+ EPHYR_RETURN_VAL_IF_FAIL(port_priv->current_adaptor, BadMatch);
+ EPHYR_RETURN_VAL_IF_FAIL(port_priv->current_adaptor->pAttributes, BadMatch);
+ EPHYR_RETURN_VAL_IF_FAIL(port_priv->current_adaptor->nAttributes, BadMatch);
+ EPHYR_RETURN_VAL_IF_FAIL(ValidAtom(a_attr_name), BadMatch);
+
+ EPHYR_LOG("enter, portnum:%d, atomid:%d, attr_name:%s, attr_val:%d\n",
+ port_priv->port_number,
+ (int) a_attr_name, NameForAtom(a_attr_name), a_attr_value);
+
+ if (!ephyrLocalAtomToHost(a_attr_name, &host_atom)) {
+ EPHYR_LOG_ERROR("failed to convert local atom to host atom\n");
+ res = BadMatch;
+ goto out;
+ }
+
+ if (!ephyrXVPrivIsAttrValueValid(port_priv->current_adaptor->pAttributes,
+ port_priv->current_adaptor->nAttributes,
+ NameForAtom(a_attr_name),
+ a_attr_value, &is_attr_valid)) {
+ EPHYR_LOG_ERROR("failed to validate attribute %s\n",
+ NameForAtom(a_attr_name));
+ /*
+ res = BadMatch ;
+ goto out ;
+ */
+ }
+ if (!is_attr_valid) {
+ EPHYR_LOG_ERROR("attribute %s is not valid\n",
+ NameForAtom(a_attr_name));
+ /*
+ res = BadMatch ;
+ goto out ;
+ */
+ }
+
+ if (!ephyrHostXVSetPortAttribute(port_priv->port_number,
+ host_atom, a_attr_value)) {
+ EPHYR_LOG_ERROR("failed to set port attribute\n");
+ res = BadMatch;
+ goto out;
+ }
+
+ res = Success;
+ out:
+ EPHYR_LOG("leave\n");
+ return res;
+}
+
+static int
+ephyrGetPortAttribute(KdScreenInfo * a_screen_info,
+ Atom a_attr_name, int *a_attr_value, pointer a_port_priv)
+{
+ int res = Success, host_atom = 0;
+ EphyrPortPriv *port_priv = a_port_priv;
+
+ EPHYR_RETURN_VAL_IF_FAIL(port_priv, BadMatch);
+ EPHYR_RETURN_VAL_IF_FAIL(ValidAtom(a_attr_name), BadMatch);
+
+ EPHYR_LOG("enter, portnum:%d, atomid:%d, attr_name:%s\n",
+ port_priv->port_number,
+ (int) a_attr_name, NameForAtom(a_attr_name));
+
+ if (!ephyrLocalAtomToHost(a_attr_name, &host_atom)) {
+ EPHYR_LOG_ERROR("failed to convert local atom to host atom\n");
+ res = BadMatch;
+ goto out;
+ }
+
+ if (!ephyrHostXVGetPortAttribute(port_priv->port_number,
+ host_atom, a_attr_value)) {
+ EPHYR_LOG_ERROR("failed to get port attribute\n");
+ res = BadMatch;
+ goto out;
+ }
+
+ res = Success;
+ out:
+ EPHYR_LOG("leave\n");
+ return res;
+}
+
+static void
+ephyrQueryBestSize(KdScreenInfo * a_info,
+ Bool a_motion,
+ short a_src_w,
+ short a_src_h,
+ short a_drw_w,
+ short a_drw_h,
+ unsigned int *a_prefered_w,
+ unsigned int *a_prefered_h, pointer a_port_priv)
+{
+ int res = 0;
+ EphyrPortPriv *port_priv = a_port_priv;
+
+ EPHYR_RETURN_IF_FAIL(port_priv);
+
+ EPHYR_LOG("enter\n");
+ res = ephyrHostXVQueryBestSize(port_priv->port_number,
+ a_motion,
+ a_src_w, a_src_h,
+ a_drw_w, a_drw_h,
+ a_prefered_w, a_prefered_h);
+ if (!res) {
+ EPHYR_LOG_ERROR("Failed to query best size\n");
+ }
+ EPHYR_LOG("leave\n");
+}
+
+static int
+ephyrPutImage(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_src_x,
+ short a_src_y,
+ short a_drw_x,
+ short a_drw_y,
+ short a_src_w,
+ short a_src_h,
+ short a_drw_w,
+ short a_drw_h,
+ int a_id,
+ unsigned char *a_buf,
+ short a_width,
+ short a_height,
+ Bool a_sync, RegionPtr a_clipping_region, pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv;
+ Bool is_ok = FALSE;
+ int result = BadImplementation, image_size = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue);
+ EPHYR_RETURN_VAL_IF_FAIL(a_drawable, BadValue);
+
+ EPHYR_LOG("enter\n");
+
+ if (!ephyrHostXVPutImage(a_info->pScreen->myNum,
+ port_priv->port_number,
+ a_id,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h,
+ a_src_x, a_src_y, a_src_w, a_src_h,
+ a_width, a_height, a_buf,
+ (EphyrHostBox *) RegionRects(a_clipping_region),
+ RegionNumRects(a_clipping_region))) {
+ EPHYR_LOG_ERROR("EphyrHostXVPutImage() failed\n");
+ goto out;
+ }
+
+ /*
+ * Now save the image so that we can resend it to host it
+ * later, in ReputImage.
+ */
+ if (!ephyrXVPrivGetImageBufSize(port_priv->port_number,
+ a_id, a_width, a_height, &image_size)) {
+ EPHYR_LOG_ERROR("failed to get image size\n");
+ /*this is a minor error so we won't get bail out abruptly */
+ is_ok = FALSE;
+ }
+ else {
+ is_ok = TRUE;
+ }
+ if (is_ok) {
+ if (!ephyrXVPrivSaveImageToPortPriv(port_priv, a_buf, image_size)) {
+ is_ok = FALSE;
+ }
+ else {
+ port_priv->image_id = a_id;
+ port_priv->drw_x = a_drw_x;
+ port_priv->drw_y = a_drw_y;
+ port_priv->drw_w = a_drw_w;
+ port_priv->drw_h = a_drw_h;
+ port_priv->src_x = a_src_x;
+ port_priv->src_y = a_src_y;
+ port_priv->src_w = a_src_w;
+ port_priv->src_h = a_src_h;
+ port_priv->image_width = a_width;
+ port_priv->image_height = a_height;
+ }
+ }
+ if (!is_ok) {
+ if (port_priv->image_buf) {
+ free(port_priv->image_buf);
+ port_priv->image_buf = NULL;
+ port_priv->image_buf_size = 0;
+ }
+ }
+
+ result = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return result;
+}
+
+static int
+ephyrReputImage(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_drw_x,
+ short a_drw_y, RegionPtr a_clipping_region, pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv;
+ int result = BadImplementation;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_info->pScreen, FALSE);
+ EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
+
+ EPHYR_LOG("enter\n");
+
+ if (!port_priv->image_buf_size || !port_priv->image_buf) {
+ EPHYR_LOG_ERROR("has null image buf in cache\n");
+ goto out;
+ }
+ if (!ephyrHostXVPutImage(a_info->pScreen->myNum,
+ port_priv->port_number,
+ port_priv->image_id,
+ a_drw_x, a_drw_y,
+ port_priv->drw_w, port_priv->drw_h,
+ port_priv->src_x, port_priv->src_y,
+ port_priv->src_w, port_priv->src_h,
+ port_priv->image_width, port_priv->image_height,
+ port_priv->image_buf,
+ (EphyrHostBox *) RegionRects(a_clipping_region),
+ RegionNumRects(a_clipping_region))) {
+ EPHYR_LOG_ERROR("ephyrHostXVPutImage() failed\n");
+ goto out;
+ }
+
+ result = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return result;
+}
+
+static int
+ephyrPutVideo(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clipping_region, pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv;
+ BoxRec clipped_area, dst_box;
+ int result = BadImplementation;
+ int drw_x = 0, drw_y = 0, drw_w = 0, drw_h = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_info->pScreen, BadValue);
+ EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
+
+ EPHYR_LOG("enter\n");
+
+ dst_box.x1 = a_drw_x;
+ dst_box.x2 = a_drw_x + a_drw_w;
+ dst_box.y1 = a_drw_y;
+ dst_box.y2 = a_drw_y + a_drw_h;
+
+ if (!DoSimpleClip(&dst_box,
+ RegionExtents(a_clipping_region), &clipped_area)) {
+ EPHYR_LOG_ERROR("failed to simple clip\n");
+ goto out;
+ }
+
+ drw_x = clipped_area.x1;
+ drw_y = clipped_area.y1;
+ drw_w = clipped_area.x2 - clipped_area.x1;
+ drw_h = clipped_area.y2 - clipped_area.y1;
+
+ if (!ephyrHostXVPutVideo(a_info->pScreen->myNum,
+ port_priv->port_number,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
+ EPHYR_LOG_ERROR("ephyrHostXVPutVideo() failed\n");
+ goto out;
+ }
+ result = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return result;
+}
+
+static int
+ephyrGetVideo(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clipping_region, pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv;
+ BoxRec clipped_area, dst_box;
+ int result = BadImplementation;
+ int drw_x = 0, drw_y = 0, drw_w = 0, drw_h = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue);
+ EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
+
+ EPHYR_LOG("enter\n");
+
+ dst_box.x1 = a_drw_x;
+ dst_box.x2 = a_drw_x + a_drw_w;
+ dst_box.y1 = a_drw_y;
+ dst_box.y2 = a_drw_y + a_drw_h;
+
+ if (!DoSimpleClip(&dst_box,
+ RegionExtents(a_clipping_region), &clipped_area)) {
+ EPHYR_LOG_ERROR("failed to simple clip\n");
+ goto out;
+ }
+
+ drw_x = clipped_area.x1;
+ drw_y = clipped_area.y1;
+ drw_w = clipped_area.x2 - clipped_area.x1;
+ drw_h = clipped_area.y2 - clipped_area.y1;
+
+ if (!ephyrHostXVGetVideo(a_info->pScreen->myNum,
+ port_priv->port_number,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
+ EPHYR_LOG_ERROR("ephyrHostXVGetVideo() failed\n");
+ goto out;
+ }
+ result = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return result;
+}
+
+static int
+ephyrPutStill(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clipping_region, pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv;
+ BoxRec clipped_area, dst_box;
+ int result = BadImplementation;
+ int drw_x = 0, drw_y = 0, drw_w = 0, drw_h = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue);
+ EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
+
+ EPHYR_LOG("enter\n");
+
+ dst_box.x1 = a_drw_x;
+ dst_box.x2 = a_drw_x + a_drw_w;
+ dst_box.y1 = a_drw_y;
+ dst_box.y2 = a_drw_y + a_drw_h;
+
+ if (!DoSimpleClip(&dst_box,
+ RegionExtents(a_clipping_region), &clipped_area)) {
+ EPHYR_LOG_ERROR("failed to simple clip\n");
+ goto out;
+ }
+
+ drw_x = clipped_area.x1;
+ drw_y = clipped_area.y1;
+ drw_w = clipped_area.x2 - clipped_area.x1;
+ drw_h = clipped_area.y2 - clipped_area.y1;
+
+ if (!ephyrHostXVPutStill(a_info->pScreen->myNum,
+ port_priv->port_number,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
+ EPHYR_LOG_ERROR("ephyrHostXVPutStill() failed\n");
+ goto out;
+ }
+ result = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return result;
+}
+
+static int
+ephyrGetStill(KdScreenInfo * a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clipping_region, pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv;
+ BoxRec clipped_area, dst_box;
+ int result = BadImplementation;
+ int drw_x = 0, drw_y = 0, drw_w = 0, drw_h = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue);
+ EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
+
+ EPHYR_LOG("enter\n");
+
+ dst_box.x1 = a_drw_x;
+ dst_box.x2 = a_drw_x + a_drw_w;
+ dst_box.y1 = a_drw_y;
+ dst_box.y2 = a_drw_y + a_drw_h;
+
+ if (!DoSimpleClip(&dst_box,
+ RegionExtents(a_clipping_region), &clipped_area)) {
+ EPHYR_LOG_ERROR("failed to simple clip\n");
+ goto out;
+ }
+
+ drw_x = clipped_area.x1;
+ drw_y = clipped_area.y1;
+ drw_w = clipped_area.x2 - clipped_area.x1;
+ drw_h = clipped_area.y2 - clipped_area.y1;
+
+ if (!ephyrHostXVGetStill(a_info->pScreen->myNum,
+ port_priv->port_number,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
+ EPHYR_LOG_ERROR("ephyrHostXVGetStill() failed\n");
+ goto out;
+ }
+ result = Success;
+
+ out:
+ EPHYR_LOG("leave\n");
+ return result;
+}
+
+static int
+ephyrQueryImageAttributes(KdScreenInfo * a_info,
+ int a_id,
+ unsigned short *a_w,
+ unsigned short *a_h, int *a_pitches, int *a_offsets)
+{
+ int image_size = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_w && a_h, FALSE);
+
+ EPHYR_LOG("enter: dim (%dx%d), pitches: %p, offsets: %p\n",
+ *a_w, *a_h, a_pitches, a_offsets);
+
+ if (!ephyrHostXVQueryImageAttributes(s_base_port_id,
+ a_id,
+ a_w, a_h,
+ &image_size, a_pitches, a_offsets)) {
+ EPHYR_LOG_ERROR("EphyrHostXVQueryImageAttributes() failed\n");
+ goto out;
+ }
+ EPHYR_LOG("image size: %d, dim (%dx%d)\n", image_size, *a_w, *a_h);
+
+ out:
+ EPHYR_LOG("leave\n");
+ return image_size;
+}
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c
index f91240746..f313afa5a 100644
--- a/xorg-server/hw/kdrive/ephyr/hostx.c
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
@@ -38,13 +38,12 @@
#undef _XSERVER64
#endif
-
#include "hostx.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
-#include <string.h> /* for memset */
+#include <string.h> /* for memset */
#include <errno.h>
#include <time.h>
@@ -62,13 +61,12 @@
#include <X11/extensions/shape.h>
#ifdef XF86DRI
#include <GL/glx.h>
-#endif /* XF86DRI */
+#endif /* XF86DRI */
#include "ephyrlog.h"
#ifdef XF86DRI
-extern Bool XF86DRIQueryExtension (Display *dpy,
- int *event_basep,
- int *error_basep);
+extern Bool XF86DRIQueryExtension(Display * dpy,
+ int *event_basep, int *error_basep);
#endif
/*
@@ -77,265 +75,252 @@ extern Bool XF86DRIQueryExtension (Display *dpy,
* to get clobbered.
*/
-struct EphyrHostScreen
-{
- Window win;
- Window win_pre_existing; /* Set via -parent option like xnest */
- Window peer_win; /* Used for GL; should be at most one */
- XImage *ximg;
- int win_width, win_height;
- int server_depth;
- unsigned char *fb_data; /* only used when host bpp != server bpp */
- XShmSegmentInfo shminfo;
-
- void *info; /* Pointer to the screen this is associated with */
- int mynum; /* Screen number */
+struct EphyrHostScreen {
+ Window win;
+ Window win_pre_existing; /* Set via -parent option like xnest */
+ Window peer_win; /* Used for GL; should be at most one */
+ XImage *ximg;
+ int win_width, win_height;
+ int server_depth;
+ unsigned char *fb_data; /* only used when host bpp != server bpp */
+ XShmSegmentInfo shminfo;
+
+ void *info; /* Pointer to the screen this is associated with */
+ int mynum; /* Screen number */
};
-struct EphyrHostXVars
-{
- char *server_dpy_name;
- Display *dpy;
- int screen;
- Visual *visual;
- Window winroot;
- GC gc;
- int depth;
- Bool use_host_cursor;
- Bool use_fullscreen;
- Bool have_shm;
-
- int n_screens;
- struct EphyrHostScreen *screens;
-
- long damage_debug_msec;
-
- unsigned long cmap[256];
+struct EphyrHostXVars {
+ char *server_dpy_name;
+ Display *dpy;
+ int screen;
+ Visual *visual;
+ Window winroot;
+ GC gc;
+ int depth;
+ Bool use_host_cursor;
+ Bool use_fullscreen;
+ Bool have_shm;
+
+ int n_screens;
+ struct EphyrHostScreen *screens;
+
+ long damage_debug_msec;
+
+ unsigned long cmap[256];
};
/* memset ( missing> ) instead of below */
/*static EphyrHostXVars HostX = { "?", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};*/
static EphyrHostXVars HostX;
-static int HostXWantDamageDebug = 0;
+static int HostXWantDamageDebug = 0;
-extern EphyrKeySyms ephyrKeySyms;
+extern EphyrKeySyms ephyrKeySyms;
-extern int monitorResolution;
+extern int monitorResolution;
-char *ephyrResName = NULL;
-int ephyrResNameFromCmd = 0;
-char *ephyrTitle = NULL;
+char *ephyrResName = NULL;
+int ephyrResNameFromCmd = 0;
+char *ephyrTitle = NULL;
static void
-hostx_set_fullscreen_hint(void);
+ hostx_set_fullscreen_hint(void);
/* X Error traps */
static int trapped_error_code = 0;
-static int (*old_error_handler) (Display *d, XErrorEvent *e);
+static int (*old_error_handler) (Display * d, XErrorEvent * e);
#define host_depth_matches_server(_vars) (HostX.depth == (_vars)->server_depth)
static struct EphyrHostScreen *
-host_screen_from_screen_info (EphyrScreenInfo *screen)
+host_screen_from_screen_info(EphyrScreenInfo * screen)
{
- int i;
+ int i;
- for (i = 0 ; i < HostX.n_screens ; i++)
- {
- if ( HostX.screens[i].info == screen)
- {
- return &HostX.screens[i];
+ for (i = 0; i < HostX.n_screens; i++) {
+ if (HostX.screens[i].info == screen) {
+ return &HostX.screens[i];
}
}
- return NULL;
+ return NULL;
}
static int
-error_handler(Display *display,
- XErrorEvent *error)
+error_handler(Display * display, XErrorEvent * error)
{
- trapped_error_code = error->error_code;
- return 0;
+ trapped_error_code = error->error_code;
+ return 0;
}
static void
hostx_errors_trap(void)
{
- trapped_error_code = 0;
- old_error_handler = XSetErrorHandler(error_handler);
+ trapped_error_code = 0;
+ old_error_handler = XSetErrorHandler(error_handler);
}
static int
hostx_errors_untrap(void)
{
- XSetErrorHandler(old_error_handler);
- return trapped_error_code;
+ XSetErrorHandler(old_error_handler);
+ return trapped_error_code;
}
int
-hostx_want_screen_size (EphyrScreenInfo screen, int *width, int *height )
+hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height)
{
- struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
-
- if (host_screen &&
- (host_screen->win_pre_existing != None ||
- HostX.use_fullscreen == True))
- {
- *width = host_screen->win_width;
- *height = host_screen->win_height;
- return 1;
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+
+ if (host_screen &&
+ (host_screen->win_pre_existing != None ||
+ HostX.use_fullscreen == True)) {
+ *width = host_screen->win_width;
+ *height = host_screen->win_height;
+ return 1;
}
- return 0;
+ return 0;
}
void
-hostx_add_screen (EphyrScreenInfo screen,
- unsigned long win_id,
- int screen_num)
+hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num)
{
- int index = HostX.n_screens;
+ int index = HostX.n_screens;
- HostX.n_screens += 1;
- HostX.screens = realloc (HostX.screens,
- HostX.n_screens * sizeof(struct EphyrHostScreen));
- memset (&HostX.screens[index], 0, sizeof (struct EphyrHostScreen));
+ HostX.n_screens += 1;
+ HostX.screens = realloc(HostX.screens,
+ HostX.n_screens * sizeof(struct EphyrHostScreen));
+ memset(&HostX.screens[index], 0, sizeof(struct EphyrHostScreen));
- HostX.screens[index].info = screen;
- HostX.screens[index].win_pre_existing = win_id;
+ HostX.screens[index].info = screen;
+ HostX.screens[index].win_pre_existing = win_id;
}
-
void
-hostx_set_display_name (char *name)
+hostx_set_display_name(char *name)
{
#ifdef _MSC_VER
__asm int 3;
#else
- HostX.server_dpy_name = strdup (name);
+ HostX.server_dpy_name = strdup(name);
#endif
}
void
hostx_set_screen_number(EphyrScreenInfo screen, int number)
{
- struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
- if (host_screen) {
- host_screen->mynum = number;
- hostx_set_win_title (host_screen->info, "") ;
- }}
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+
+ if (host_screen) {
+ host_screen->mynum = number;
+ hostx_set_win_title(host_screen->info, "");
+ }
+}
void
-hostx_set_win_title (EphyrScreenInfo screen, char *extra_text)
+hostx_set_win_title(EphyrScreenInfo screen, char *extra_text)
{
- struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
if (!host_screen)
- return;
+ return;
if (ephyrTitle) {
- XStoreName(HostX.dpy, host_screen->win, ephyrTitle);
- } else {
+ XStoreName(HostX.dpy, host_screen->win, ephyrTitle);
+ }
+ else {
#define BUF_LEN 256
- char buf[BUF_LEN+1];
+ char buf[BUF_LEN + 1];
- memset (buf, 0, BUF_LEN+1) ;
- snprintf (buf, BUF_LEN, "Xephyr on %s.%d %s",
- HostX.server_dpy_name,
- host_screen->mynum,
- (extra_text != NULL) ? extra_text : "");
+ memset(buf, 0, BUF_LEN + 1);
+ snprintf(buf, BUF_LEN, "Xephyr on %s.%d %s",
+ HostX.server_dpy_name,
+ host_screen->mynum, (extra_text != NULL) ? extra_text : "");
- XStoreName (HostX.dpy, host_screen->win, buf);
+ XStoreName(HostX.dpy, host_screen->win, buf);
}
}
int
-hostx_want_host_cursor (void)
+hostx_want_host_cursor(void)
{
- return HostX.use_host_cursor;
+ return HostX.use_host_cursor;
}
void
-hostx_use_host_cursor (void)
+hostx_use_host_cursor(void)
{
- HostX.use_host_cursor = True;
+ HostX.use_host_cursor = True;
}
int
-hostx_want_preexisting_window (EphyrScreenInfo screen)
+hostx_want_preexisting_window(EphyrScreenInfo screen)
{
- struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
- if (host_screen && host_screen->win_pre_existing)
- {
- return 1;
+ if (host_screen && host_screen->win_pre_existing) {
+ return 1;
}
- else
- {
- return 0;
+ else {
+ return 0;
}
}
void
-hostx_use_fullscreen (void)
+hostx_use_fullscreen(void)
{
- HostX.use_fullscreen = True;
+ HostX.use_fullscreen = True;
}
int
-hostx_want_fullscreen (void)
+hostx_want_fullscreen(void)
{
- return HostX.use_fullscreen;
+ return HostX.use_fullscreen;
}
static void
-hostx_set_fullscreen_hint (void)
+hostx_set_fullscreen_hint(void)
{
- Atom atom_WINDOW_STATE, atom_WINDOW_STATE_FULLSCREEN;
- int index;
-
- atom_WINDOW_STATE
- = XInternAtom(HostX.dpy, "_NET_WM_STATE", False);
- atom_WINDOW_STATE_FULLSCREEN
- = XInternAtom(HostX.dpy, "_NET_WM_STATE_FULLSCREEN",False);
-
- for (index = 0 ; index < HostX.n_screens ; index++)
- {
- XChangeProperty (HostX.dpy, HostX.screens[index].win,
- atom_WINDOW_STATE, XA_ATOM, 32,
- PropModeReplace,
- (unsigned char *)&atom_WINDOW_STATE_FULLSCREEN, 1);
+ Atom atom_WINDOW_STATE, atom_WINDOW_STATE_FULLSCREEN;
+ int index;
+
+ atom_WINDOW_STATE = XInternAtom(HostX.dpy, "_NET_WM_STATE", False);
+ atom_WINDOW_STATE_FULLSCREEN
+ = XInternAtom(HostX.dpy, "_NET_WM_STATE_FULLSCREEN", False);
+
+ for (index = 0; index < HostX.n_screens; index++) {
+ XChangeProperty(HostX.dpy, HostX.screens[index].win,
+ atom_WINDOW_STATE, XA_ATOM, 32,
+ PropModeReplace,
+ (unsigned char *) &atom_WINDOW_STATE_FULLSCREEN, 1);
}
}
-
static void
-hostx_toggle_damage_debug (void)
+hostx_toggle_damage_debug(void)
{
- HostXWantDamageDebug ^= 1;
+ HostXWantDamageDebug ^= 1;
}
void
-hostx_handle_signal (int signum)
+hostx_handle_signal(int signum)
{
- hostx_toggle_damage_debug();
- EPHYR_DBG ("Signal caught. Damage Debug:%i\n",
- HostXWantDamageDebug);
+ hostx_toggle_damage_debug();
+ EPHYR_DBG("Signal caught. Damage Debug:%i\n", HostXWantDamageDebug);
}
void
-hostx_use_resname (char *name, int fromcmd)
+hostx_use_resname(char *name, int fromcmd)
{
- ephyrResName = name;
- ephyrResNameFromCmd = fromcmd;
+ ephyrResName = name;
+ ephyrResNameFromCmd = fromcmd;
}
void
-hostx_set_title (char *title)
+hostx_set_title(char *title)
{
- ephyrTitle = title;
+ ephyrTitle = title;
}
#ifdef __SUNPRO_C
@@ -344,7 +329,8 @@ hostx_set_title (char *title)
#endif
static int _X_NORETURN
-x_io_error_handler (Display *dpy) {
+x_io_error_handler(Display * dpy)
+{
ErrorF("Lost connection to X server: %s\n", strerror(errno));
CloseWellKnownConnections();
OsCleanup(1);
@@ -352,301 +338,275 @@ x_io_error_handler (Display *dpy) {
}
int
-hostx_init (void)
+hostx_init(void)
{
- XSetWindowAttributes attr;
- Cursor empty_cursor;
- Pixmap cursor_pxm;
- XColor col;
- int index;
- char *tmpstr;
- XClassHint *class_hint;
-
- attr.event_mask =
- ButtonPressMask
- |ButtonReleaseMask
- |PointerMotionMask
- |KeyPressMask
- |KeyReleaseMask
- |ExposureMask;
-
- EPHYR_DBG("mark");
-
- if ((HostX.dpy = XOpenDisplay(getenv("DISPLAY"))) == NULL)
- {
- fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n");
- exit(1);
+ XSetWindowAttributes attr;
+ Cursor empty_cursor;
+ Pixmap cursor_pxm;
+ XColor col;
+ int index;
+ char *tmpstr;
+ XClassHint *class_hint;
+
+ attr.event_mask =
+ ButtonPressMask
+ | ButtonReleaseMask
+ | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask;
+
+ EPHYR_DBG("mark");
+
+ if ((HostX.dpy = XOpenDisplay(getenv("DISPLAY"))) == NULL) {
+ fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n");
+ exit(1);
}
- XSetIOErrorHandler(x_io_error_handler);
+ XSetIOErrorHandler(x_io_error_handler);
- HostX.screen = DefaultScreen(HostX.dpy);
- HostX.winroot = RootWindow(HostX.dpy, HostX.screen);
- HostX.gc = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL);
- HostX.depth = DefaultDepth(HostX.dpy, HostX.screen);
- HostX.visual = DefaultVisual(HostX.dpy, HostX.screen);
+ HostX.screen = DefaultScreen(HostX.dpy);
+ HostX.winroot = RootWindow(HostX.dpy, HostX.screen);
+ HostX.gc = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL);
+ HostX.depth = DefaultDepth(HostX.dpy, HostX.screen);
+ HostX.visual = DefaultVisual(HostX.dpy, HostX.screen);
- class_hint = XAllocClassHint();
+ class_hint = XAllocClassHint();
- for (index = 0 ; index < HostX.n_screens ; index++)
- {
- struct EphyrHostScreen *host_screen = &HostX.screens[index];
+ for (index = 0; index < HostX.n_screens; index++) {
+ struct EphyrHostScreen *host_screen = &HostX.screens[index];
- host_screen->server_depth = HostX.depth;
- if (host_screen->win_pre_existing != None)
- {
- Status result;
- XWindowAttributes prewin_attr;
-
- /* Get screen size from existing window */
-
- hostx_errors_trap();
-
- result = XGetWindowAttributes (HostX.dpy,
- host_screen->win_pre_existing,
- &prewin_attr);
-
-
- if (hostx_errors_untrap() || !result)
- {
- fprintf (stderr, "\nXephyr -parent window' does not exist!\n");
- exit (1);
- }
-
- host_screen->win_width = prewin_attr.width;
- host_screen->win_height = prewin_attr.height;
-
- host_screen->win = XCreateWindow (HostX.dpy,
- host_screen->win_pre_existing,
- 0,0,
- host_screen->win_width,
- host_screen->win_height,
- 0,
- CopyFromParent,
- CopyFromParent,
- CopyFromParent,
- CWEventMask,
- &attr);
- }
- else
- {
- host_screen->win = XCreateWindow (HostX.dpy,
- HostX.winroot,
- 0,0,100,100, /* will resize */
- 0,
- CopyFromParent,
- CopyFromParent,
- CopyFromParent,
- CWEventMask,
- &attr);
-
- hostx_set_win_title (host_screen->info,
- "(ctrl+shift grabs mouse and keyboard)");
-
- if (HostX.use_fullscreen)
- {
- host_screen->win_width = DisplayWidth(HostX.dpy, HostX.screen);
- host_screen->win_height = DisplayHeight(HostX.dpy, HostX.screen);
+ host_screen->server_depth = HostX.depth;
+ if (host_screen->win_pre_existing != None) {
+ Status result;
+ XWindowAttributes prewin_attr;
+
+ /* Get screen size from existing window */
- hostx_set_fullscreen_hint();
+ hostx_errors_trap();
+
+ result = XGetWindowAttributes(HostX.dpy,
+ host_screen->win_pre_existing,
+ &prewin_attr);
+
+ if (hostx_errors_untrap() || !result) {
+ fprintf(stderr, "\nXephyr -parent window' does not exist!\n");
+ exit(1);
}
- if (class_hint)
- {
- tmpstr = getenv("RESOURCE_NAME");
- if (tmpstr && (!ephyrResNameFromCmd))
- ephyrResName = tmpstr;
- class_hint->res_name = ephyrResName;
- class_hint->res_class = "Xephyr";
- XSetClassHint(hostx_get_display(), host_screen->win, class_hint);
+ host_screen->win_width = prewin_attr.width;
+ host_screen->win_height = prewin_attr.height;
+
+ host_screen->win = XCreateWindow(HostX.dpy,
+ host_screen->win_pre_existing,
+ 0, 0,
+ host_screen->win_width,
+ host_screen->win_height,
+ 0,
+ CopyFromParent,
+ CopyFromParent,
+ CopyFromParent,
+ CWEventMask, &attr);
+ }
+ else {
+ host_screen->win = XCreateWindow(HostX.dpy, HostX.winroot, 0, 0, 100, 100, /* will resize */
+ 0,
+ CopyFromParent,
+ CopyFromParent,
+ CopyFromParent,
+ CWEventMask, &attr);
+
+ hostx_set_win_title(host_screen->info,
+ "(ctrl+shift grabs mouse and keyboard)");
+
+ if (HostX.use_fullscreen) {
+ host_screen->win_width = DisplayWidth(HostX.dpy, HostX.screen);
+ host_screen->win_height =
+ DisplayHeight(HostX.dpy, HostX.screen);
+
+ hostx_set_fullscreen_hint();
+ }
+
+ if (class_hint) {
+ tmpstr = getenv("RESOURCE_NAME");
+ if (tmpstr && (!ephyrResNameFromCmd))
+ ephyrResName = tmpstr;
+ class_hint->res_name = ephyrResName;
+ class_hint->res_class = "Xephyr";
+ XSetClassHint(hostx_get_display(), host_screen->win,
+ class_hint);
}
}
}
- if (class_hint)
- XFree(class_hint);
-
- XParseColor (HostX.dpy, DefaultColormap (HostX.dpy,HostX.screen),
- "red", &col);
- XAllocColor (HostX.dpy, DefaultColormap (HostX.dpy, HostX.screen),
- &col);
- XSetForeground (HostX.dpy, HostX.gc, col.pixel);
-
- if (!hostx_want_host_cursor ())
- {
- /* Ditch the cursor, we provide our 'own' */
- cursor_pxm = XCreatePixmap (HostX.dpy, HostX.winroot, 1, 1, 1);
- memset (&col, 0, sizeof (col));
- empty_cursor = XCreatePixmapCursor (HostX.dpy,
- cursor_pxm, cursor_pxm,
- &col, &col, 1, 1);
- for ( index = 0 ; index < HostX.n_screens ; index++ )
- {
- XDefineCursor (HostX.dpy,
- HostX.screens[index].win,
- empty_cursor);
+ if (class_hint)
+ XFree(class_hint);
+
+ XParseColor(HostX.dpy, DefaultColormap(HostX.dpy, HostX.screen),
+ "red", &col);
+ XAllocColor(HostX.dpy, DefaultColormap(HostX.dpy, HostX.screen), &col);
+ XSetForeground(HostX.dpy, HostX.gc, col.pixel);
+
+ if (!hostx_want_host_cursor()) {
+ /* Ditch the cursor, we provide our 'own' */
+ cursor_pxm = XCreatePixmap(HostX.dpy, HostX.winroot, 1, 1, 1);
+ memset(&col, 0, sizeof(col));
+ empty_cursor = XCreatePixmapCursor(HostX.dpy,
+ cursor_pxm, cursor_pxm,
+ &col, &col, 1, 1);
+ for (index = 0; index < HostX.n_screens; index++) {
+ XDefineCursor(HostX.dpy, HostX.screens[index].win, empty_cursor);
}
- XFreePixmap (HostX.dpy, cursor_pxm);
+ XFreePixmap(HostX.dpy, cursor_pxm);
}
- for (index = 0 ; index < HostX.n_screens ; index++)
- {
- HostX.screens[index].ximg = NULL;
+ for (index = 0; index < HostX.n_screens; index++) {
+ HostX.screens[index].ximg = NULL;
}
- /* Try to get share memory ximages for a little bit more speed */
+ /* Try to get share memory ximages for a little bit more speed */
#ifdef _MSC_VER
__asm int 3;
#else
- if (!XShmQueryExtension(HostX.dpy) || getenv("XEPHYR_NO_SHM"))
- {
- fprintf(stderr, "\nXephyr unable to use SHM XImages\n");
- HostX.have_shm = False;
+ if (!XShmQueryExtension(HostX.dpy) || getenv("XEPHYR_NO_SHM")) {
+ fprintf(stderr, "\nXephyr unable to use SHM XImages\n");
+ HostX.have_shm = False;
}
- else
- {
- /* Really really check we have shm - better way ?*/
- XShmSegmentInfo shminfo;
+ else {
+ /* Really really check we have shm - better way ? */
+ XShmSegmentInfo shminfo;
HostX.have_shm = True;
- shminfo.shmid=shmget(IPC_PRIVATE, 1, IPC_CREAT|0777);
- shminfo.shmaddr=shmat(shminfo.shmid,0,0);
- shminfo.readOnly=True;
+ shminfo.shmid = shmget(IPC_PRIVATE, 1, IPC_CREAT | 0777);
+ shminfo.shmaddr = shmat(shminfo.shmid, 0, 0);
+ shminfo.readOnly = True;
hostx_errors_trap();
XShmAttach(HostX.dpy, &shminfo);
XSync(HostX.dpy, False);
- if (hostx_errors_untrap())
- {
+ if (hostx_errors_untrap()) {
fprintf(stderr, "\nXephyr unable to use SHM XImages\n");
HostX.have_shm = False;
- }
+ }
shmdt(shminfo.shmaddr);
shmctl(shminfo.shmid, IPC_RMID, 0);
-}
+ }
#endif
- XFlush(HostX.dpy);
+ XFlush(HostX.dpy);
- /* Setup the pause time between paints when debugging updates */
+ /* Setup the pause time between paints when debugging updates */
- HostX.damage_debug_msec = 20000; /* 1/50 th of a second */
+ HostX.damage_debug_msec = 20000; /* 1/50 th of a second */
- if (getenv ("XEPHYR_PAUSE"))
- {
- HostX.damage_debug_msec = strtol (getenv ("XEPHYR_PAUSE"), NULL, 0);
- EPHYR_DBG ("pause is %li\n", HostX.damage_debug_msec);
+ if (getenv("XEPHYR_PAUSE")) {
+ HostX.damage_debug_msec = strtol(getenv("XEPHYR_PAUSE"), NULL, 0);
+ EPHYR_DBG("pause is %li\n", HostX.damage_debug_msec);
}
- return 1;
+ return 1;
}
int
-hostx_get_depth (void)
+hostx_get_depth(void)
{
- return HostX.depth;
+ return HostX.depth;
}
int
-hostx_get_server_depth (EphyrScreenInfo screen)
+hostx_get_server_depth(EphyrScreenInfo screen)
{
- struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
- return host_screen ? host_screen->server_depth : 0;
+ return host_screen ? host_screen->server_depth : 0;
}
void
-hostx_set_server_depth (EphyrScreenInfo screen, int depth)
+hostx_set_server_depth(EphyrScreenInfo screen, int depth)
{
- struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
- if (host_screen)
- host_screen->server_depth = depth;
+ if (host_screen)
+ host_screen->server_depth = depth;
}
int
-hostx_get_bpp (EphyrScreenInfo screen)
+hostx_get_bpp(EphyrScreenInfo screen)
{
- struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
- if (!host_screen)
- return 0;
+ if (!host_screen)
+ return 0;
- if (host_depth_matches_server (host_screen))
- return HostX.visual->bits_per_rgb;
- else
- return host_screen->server_depth; /*XXX correct ?*/
+ if (host_depth_matches_server(host_screen))
+ return HostX.visual->bits_per_rgb;
+ else
+ return host_screen->server_depth; /*XXX correct ? */
}
void
-hostx_get_visual_masks (EphyrScreenInfo screen,
- CARD32 *rmsk,
- CARD32 *gmsk,
- CARD32 *bmsk)
+hostx_get_visual_masks(EphyrScreenInfo screen,
+ CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk)
{
- struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
- if (!host_screen)
- return;
+ if (!host_screen)
+ return;
- if (host_depth_matches_server(host_screen))
- {
- *rmsk = HostX.visual->red_mask;
- *gmsk = HostX.visual->green_mask;
- *bmsk = HostX.visual->blue_mask;
+ if (host_depth_matches_server(host_screen)) {
+ *rmsk = HostX.visual->red_mask;
+ *gmsk = HostX.visual->green_mask;
+ *bmsk = HostX.visual->blue_mask;
}
- else if (host_screen->server_depth == 16)
- {
- /* Assume 16bpp 565 */
- *rmsk = 0xf800;
- *gmsk = 0x07e0;
- *bmsk = 0x001f;
+ else if (host_screen->server_depth == 16) {
+ /* Assume 16bpp 565 */
+ *rmsk = 0xf800;
+ *gmsk = 0x07e0;
+ *bmsk = 0x001f;
}
- else
- {
- *rmsk = 0x0;
- *gmsk = 0x0;
- *bmsk = 0x0;
+ else {
+ *rmsk = 0x0;
+ *gmsk = 0x0;
+ *bmsk = 0x0;
}
}
-static int
+static int
hostx_calculate_color_shift(unsigned long mask)
{
int shift = 1;
+
/* count # of bits in mask */
- while ((mask = (mask >> 1))) shift++;
+ while ((mask = (mask >> 1)))
+ shift++;
/* cmap entry is an unsigned char so adjust it by size of that */
shift = shift - sizeof(unsigned char) * 8;
- if (shift < 0) shift = 0;
+ if (shift < 0)
+ shift = 0;
return shift;
}
void
hostx_set_cmap_entry(unsigned char idx,
- unsigned char r,
- unsigned char g,
- unsigned char b)
+ unsigned char r, unsigned char g, unsigned char b)
{
/* need to calculate the shifts for RGB because server could be BGR. */
/* XXX Not sure if this is correct for 8 on 16, but this works for 8 on 24.*/
static int rshift, bshift, gshift = 0;
static int first_time = 1;
+
if (first_time) {
- first_time = 0;
- rshift = hostx_calculate_color_shift(HostX.visual->red_mask);
- gshift = hostx_calculate_color_shift(HostX.visual->green_mask);
- bshift = hostx_calculate_color_shift(HostX.visual->blue_mask);
+ first_time = 0;
+ rshift = hostx_calculate_color_shift(HostX.visual->red_mask);
+ gshift = hostx_calculate_color_shift(HostX.visual->green_mask);
+ bshift = hostx_calculate_color_shift(HostX.visual->blue_mask);
}
HostX.cmap[idx] = ((r << rshift) & HostX.visual->red_mask) |
- ((g << gshift) & HostX.visual->green_mask) |
- ((b << bshift) & HostX.visual->blue_mask);
+ ((g << gshift) & HostX.visual->green_mask) |
+ ((b << bshift) & HostX.visual->blue_mask);
}
/**
@@ -661,735 +621,691 @@ hostx_set_cmap_entry(unsigned char idx,
* buffer_height can be used to create a larger offscreen buffer, which is used
* by fakexa for storing offscreen pixmap data.
*/
-void*
-hostx_screen_init (EphyrScreenInfo screen,
- int width, int height,
- int buffer_height)
+void *
+hostx_screen_init(EphyrScreenInfo screen,
+ int width, int height, int buffer_height)
{
- int bitmap_pad;
- Bool shm_success = False;
- XSizeHints *size_hints;
-
- struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
- if (!host_screen)
- {
- fprintf (stderr, "%s: Error in accessing hostx data\n", __FUNCTION__ );
- exit(1);
+ int bitmap_pad;
+ Bool shm_success = False;
+ XSizeHints *size_hints;
+
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+
+ if (!host_screen) {
+ fprintf(stderr, "%s: Error in accessing hostx data\n", __FUNCTION__);
+ exit(1);
}
- EPHYR_DBG ("host_screen=%p wxh=%dx%d, buffer_height=%d",
- host_screen, width, height, buffer_height);
+ EPHYR_DBG("host_screen=%p wxh=%dx%d, buffer_height=%d",
+ host_screen, width, height, buffer_height);
- if (host_screen->ximg != NULL)
- {
- /* Free up the image data if previously used
- * i.ie called by server reset
- */
+ if (host_screen->ximg != NULL) {
+ /* Free up the image data if previously used
+ * i.ie called by server reset
+ */
- if (HostX.have_shm)
- {
+ if (HostX.have_shm) {
#ifdef _MSC_VER
__asm int 3;
#else
- XShmDetach(HostX.dpy, &host_screen->shminfo);
- XDestroyImage (host_screen->ximg);
- shmdt(host_screen->shminfo.shmaddr);
- shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
+ XShmDetach(HostX.dpy, &host_screen->shminfo);
+ XDestroyImage(host_screen->ximg);
+ shmdt(host_screen->shminfo.shmaddr);
+ shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
#endif
- }
- else
- {
- free(host_screen->ximg->data);
- host_screen->ximg->data = NULL;
-
- XDestroyImage(host_screen->ximg);
- }
+ }
+ else {
+ free(host_screen->ximg->data);
+ host_screen->ximg->data = NULL;
+
+ XDestroyImage(host_screen->ximg);
+ }
}
- if (HostX.have_shm)
- {
+ if (HostX.have_shm) {
+ host_screen->ximg =
#ifdef _MSC_VER
__asm int 3;
#else
- host_screen->ximg = XShmCreateImage (HostX.dpy, HostX.visual, HostX.depth,
- ZPixmap, NULL, &host_screen->shminfo,
- width, buffer_height );
-
- host_screen->shminfo.shmid =
- shmget(IPC_PRIVATE,
- host_screen->ximg->bytes_per_line * buffer_height,
- IPC_CREAT|0777);
- host_screen->ximg->data = shmat(host_screen->shminfo.shmid, 0, 0);
- host_screen->shminfo.shmaddr = host_screen->ximg->data;
-
- if (host_screen->ximg->data == (char *)-1)
- {
- EPHYR_DBG("Can't attach SHM Segment, falling back to plain XImages");
- HostX.have_shm = False;
- XDestroyImage(host_screen->ximg);
- shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
- }
- else
- {
- EPHYR_DBG("SHM segment attached %p", host_screen->shminfo.shmaddr);
- host_screen->shminfo.readOnly = False;
- XShmAttach(HostX.dpy, &host_screen->shminfo);
- shm_success = True;
- }
+ host_screen->ximg =
+ XShmCreateImage(HostX.dpy, HostX.visual, HostX.depth, ZPixmap, NULL,
+ &host_screen->shminfo, width, buffer_height);
+
+ host_screen->shminfo.shmid =
+ shmget(IPC_PRIVATE,
+ host_screen->ximg->bytes_per_line * buffer_height,
+ IPC_CREAT | 0777);
+ host_screen->ximg->data = shmat(host_screen->shminfo.shmid, 0, 0);
+ host_screen->shminfo.shmaddr = host_screen->ximg->data;
+
+ if (host_screen->ximg->data == (char *) -1) {
+ EPHYR_DBG
+ ("Can't attach SHM Segment, falling back to plain XImages");
+ HostX.have_shm = False;
+ XDestroyImage(host_screen->ximg);
+ shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
+ }
+ else {
+ EPHYR_DBG("SHM segment attached %p", host_screen->shminfo.shmaddr);
+ host_screen->shminfo.readOnly = False;
+ XShmAttach(HostX.dpy, &host_screen->shminfo);
+ shm_success = True;
+ }
#endif
}
- if (!shm_success)
- {
- bitmap_pad = ( HostX.depth > 16 )? 32 : (( HostX.depth > 8 )? 16 : 8 );
-
- EPHYR_DBG("Creating image %dx%d for screen host_screen=%p\n",
- width, buffer_height, host_screen );
- host_screen->ximg = XCreateImage (HostX.dpy,
- HostX.visual,
- HostX.depth,
- ZPixmap, 0, 0,
- width,
- buffer_height,
- bitmap_pad,
- 0);
-
- host_screen->ximg->data =
- malloc (host_screen->ximg->bytes_per_line * buffer_height);
+ if (!shm_success) {
+ bitmap_pad = (HostX.depth > 16) ? 32 : ((HostX.depth > 8) ? 16 : 8);
+
+ EPHYR_DBG("Creating image %dx%d for screen host_screen=%p\n",
+ width, buffer_height, host_screen);
+ host_screen->ximg = XCreateImage(HostX.dpy,
+ HostX.visual,
+ HostX.depth,
+ ZPixmap, 0, 0,
+ width, buffer_height, bitmap_pad, 0);
+
+ host_screen->ximg->data =
+ malloc(host_screen->ximg->bytes_per_line * buffer_height);
}
- XResizeWindow (HostX.dpy, host_screen->win, width, height);
+ XResizeWindow(HostX.dpy, host_screen->win, width, height);
- /* Ask the WM to keep our size static */
- size_hints = XAllocSizeHints();
- size_hints->max_width = size_hints->min_width = width;
- size_hints->max_height = size_hints->min_height = height;
- size_hints->flags = PMinSize|PMaxSize;
- XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints);
- XFree(size_hints);
+ /* Ask the WM to keep our size static */
+ size_hints = XAllocSizeHints();
+ size_hints->max_width = size_hints->min_width = width;
+ size_hints->max_height = size_hints->min_height = height;
+ size_hints->flags = PMinSize | PMaxSize;
+ XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints);
+ XFree(size_hints);
- XMapWindow(HostX.dpy, host_screen->win);
+ XMapWindow(HostX.dpy, host_screen->win);
- XSync(HostX.dpy, False);
+ XSync(HostX.dpy, False);
- host_screen->win_width = width;
- host_screen->win_height = height;
+ host_screen->win_width = width;
+ host_screen->win_height = height;
- if (host_depth_matches_server(host_screen))
- {
- EPHYR_DBG("Host matches server");
- return host_screen->ximg->data;
+ if (host_depth_matches_server(host_screen)) {
+ EPHYR_DBG("Host matches server");
+ return host_screen->ximg->data;
}
- else
- {
- EPHYR_DBG("server bpp %i", host_screen->server_depth>>3);
- host_screen->fb_data = malloc(width*buffer_height*(host_screen->server_depth>>3));
- return host_screen->fb_data;
+ else {
+ EPHYR_DBG("server bpp %i", host_screen->server_depth >> 3);
+ host_screen->fb_data =
+ malloc(width * buffer_height * (host_screen->server_depth >> 3));
+ return host_screen->fb_data;
}
}
-static void hostx_paint_debug_rect (struct EphyrHostScreen *host_screen,
- int x, int y,
- int width, int height);
+static void hostx_paint_debug_rect(struct EphyrHostScreen *host_screen,
+ int x, int y, int width, int height);
void
-hostx_paint_rect (EphyrScreenInfo screen,
- int sx, int sy,
- int dx, int dy,
- int width, int height)
+hostx_paint_rect(EphyrScreenInfo screen,
+ int sx, int sy, int dx, int dy, int width, int height)
{
- struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
- EPHYR_DBG ("painting in screen %d\n", host_screen->mynum) ;
+ EPHYR_DBG("painting in screen %d\n", host_screen->mynum);
- /*
- * Copy the image data updated by the shadow layer
- * on to the window
- */
+ /*
+ * Copy the image data updated by the shadow layer
+ * on to the window
+ */
- if (HostXWantDamageDebug)
- {
- hostx_paint_debug_rect(host_screen, dx, dy, width, height);
+ if (HostXWantDamageDebug) {
+ hostx_paint_debug_rect(host_screen, dx, dy, width, height);
}
- /*
- * If the depth of the ephyr server is less than that of the host,
- * the kdrive fb does not point to the ximage data but to a buffer
- * ( fb_data ), we shift the various bits from this onto the XImage
- * so they match the host.
- *
- * Note, This code is pretty new ( and simple ) so may break on
- * endian issues, 32 bpp host etc.
- * Not sure if 8bpp case is right either.
- * ... and it will be slower than the matching depth case.
- */
-
- if (!host_depth_matches_server(host_screen))
- {
- int x,y,idx, bytes_per_pixel = (host_screen->server_depth>>3);
- unsigned char r,g,b;
- unsigned long host_pixel;
-
- EPHYR_DBG("Unmatched host depth host_screen=%p\n", host_screen);
- for (y=sy; y<sy+height; y++)
- for (x=sx; x<sx+width; x++)
- {
- idx = (host_screen->win_width*y*bytes_per_pixel)+(x*bytes_per_pixel);
-
- switch (host_screen->server_depth)
- {
- case 16:
- {
- unsigned short pixel = *(unsigned short*)(host_screen->fb_data+idx);
-
- r = ((pixel & 0xf800) >> 8);
- g = ((pixel & 0x07e0) >> 3);
- b = ((pixel & 0x001f) << 3);
-
- host_pixel = (r << 16) | (g << 8) | (b);
-
- XPutPixel(host_screen->ximg, x, y, host_pixel);
- break;
- }
- case 8:
- {
- unsigned char pixel = *(unsigned char*)(host_screen->fb_data+idx);
- XPutPixel(host_screen->ximg, x, y, HostX.cmap[pixel]);
- break;
- }
- default:
- break;
- }
- }
+ /*
+ * If the depth of the ephyr server is less than that of the host,
+ * the kdrive fb does not point to the ximage data but to a buffer
+ * ( fb_data ), we shift the various bits from this onto the XImage
+ * so they match the host.
+ *
+ * Note, This code is pretty new ( and simple ) so may break on
+ * endian issues, 32 bpp host etc.
+ * Not sure if 8bpp case is right either.
+ * ... and it will be slower than the matching depth case.
+ */
+
+ if (!host_depth_matches_server(host_screen)) {
+ int x, y, idx, bytes_per_pixel = (host_screen->server_depth >> 3);
+ unsigned char r, g, b;
+ unsigned long host_pixel;
+
+ EPHYR_DBG("Unmatched host depth host_screen=%p\n", host_screen);
+ for (y = sy; y < sy + height; y++)
+ for (x = sx; x < sx + width; x++) {
+ idx =
+ (host_screen->win_width * y * bytes_per_pixel) +
+ (x * bytes_per_pixel);
+
+ switch (host_screen->server_depth) {
+ case 16:
+ {
+ unsigned short pixel =
+ *(unsigned short *) (host_screen->fb_data + idx);
+
+ r = ((pixel & 0xf800) >> 8);
+ g = ((pixel & 0x07e0) >> 3);
+ b = ((pixel & 0x001f) << 3);
+
+ host_pixel = (r << 16) | (g << 8) | (b);
+
+ XPutPixel(host_screen->ximg, x, y, host_pixel);
+ break;
+ }
+ case 8:
+ {
+ unsigned char pixel =
+ *(unsigned char *) (host_screen->fb_data + idx);
+ XPutPixel(host_screen->ximg, x, y, HostX.cmap[pixel]);
+ break;
+ }
+ default:
+ break;
+ }
+ }
}
- if (HostX.have_shm)
- {
+ if (HostX.have_shm) {
#ifdef _MSC_VER
__asm int 3;
#else
- XShmPutImage (HostX.dpy, host_screen->win,
- HostX.gc, host_screen->ximg,
- sx, sy, dx, dy, width, height, False);
+ XShmPutImage(HostX.dpy, host_screen->win,
+ HostX.gc, host_screen->ximg,
+ sx, sy, dx, dy, width, height, False);
#endif
}
- else
- {
- XPutImage (HostX.dpy, host_screen->win, HostX.gc, host_screen->ximg,
- sx, sy, dx, dy, width, height);
+ else {
+ XPutImage(HostX.dpy, host_screen->win, HostX.gc, host_screen->ximg,
+ sx, sy, dx, dy, width, height);
}
- XSync (HostX.dpy, False);
+ XSync(HostX.dpy, False);
}
static void
-hostx_paint_debug_rect (struct EphyrHostScreen *host_screen,
- int x, int y,
- int width, int height)
+hostx_paint_debug_rect(struct EphyrHostScreen *host_screen,
+ int x, int y, int width, int height)
{
#ifdef _MSC_VER
__asm int 3;
#else
- struct timespec tspec;
+ struct timespec tspec;
- tspec.tv_sec = HostX.damage_debug_msec / (1000000);
- tspec.tv_nsec = (HostX.damage_debug_msec % 1000000) * 1000;
+ tspec.tv_sec = HostX.damage_debug_msec / (1000000);
+ tspec.tv_nsec = (HostX.damage_debug_msec % 1000000) * 1000;
- EPHYR_DBG("msec: %li tv_sec %li, tv_msec %li",
- HostX.damage_debug_msec, tspec.tv_sec, tspec.tv_nsec);
+ EPHYR_DBG("msec: %li tv_sec %li, tv_msec %li",
+ HostX.damage_debug_msec, tspec.tv_sec, tspec.tv_nsec);
- /* fprintf(stderr, "Xephyr updating: %i+%i %ix%i\n", x, y, width, height); */
+ /* fprintf(stderr, "Xephyr updating: %i+%i %ix%i\n", x, y, width, height); */
- XFillRectangle (HostX.dpy, host_screen->win, HostX.gc, x, y, width,height);
- XSync (HostX.dpy, False);
+ XFillRectangle(HostX.dpy, host_screen->win, HostX.gc, x, y, width, height);
+ XSync(HostX.dpy, False);
- /* nanosleep seems to work better than usleep for me... */
- nanosleep(&tspec, NULL);
+ /* nanosleep seems to work better than usleep for me... */
+ nanosleep(&tspec, NULL);
#endif
}
void
hostx_load_keymap(void)
{
- XID *keymap;
- int host_width, min_keycode, max_keycode, width;
- int i,j;
-
- XDisplayKeycodes (HostX.dpy, &min_keycode, &max_keycode);
-
- EPHYR_DBG ("min: %d, max: %d", min_keycode, max_keycode);
-
- keymap = XGetKeyboardMapping (HostX.dpy,
- min_keycode,
- max_keycode - min_keycode + 1,
- &host_width);
-
- /* Try and copy the hosts keymap into our keymap to avoid loads
- * of messing around.
- *
- * kdrive cannot can have more than 4 keysyms per keycode
- * so we only copy at most the first 4 ( xorg has 6 per keycode, XVNC 2 )
- */
- width = (host_width > 4) ? 4 : host_width;
-
- ephyrKeySyms.map = (CARD32 *)calloc(sizeof(CARD32),
- (max_keycode - min_keycode + 1) *
- width);
- if (!ephyrKeySyms.map)
+ XID *keymap;
+ int host_width, min_keycode, max_keycode, width;
+ int i, j;
+
+ XDisplayKeycodes(HostX.dpy, &min_keycode, &max_keycode);
+
+ EPHYR_DBG("min: %d, max: %d", min_keycode, max_keycode);
+
+ keymap = XGetKeyboardMapping(HostX.dpy,
+ min_keycode,
+ max_keycode - min_keycode + 1, &host_width);
+
+ /* Try and copy the hosts keymap into our keymap to avoid loads
+ * of messing around.
+ *
+ * kdrive cannot can have more than 4 keysyms per keycode
+ * so we only copy at most the first 4 ( xorg has 6 per keycode, XVNC 2 )
+ */
+ width = (host_width > 4) ? 4 : host_width;
+
+ ephyrKeySyms.map = (CARD32 *) calloc(sizeof(CARD32),
+ (max_keycode - min_keycode + 1) *
+ width);
+ if (!ephyrKeySyms.map)
return;
- for (i=0; i<(max_keycode - min_keycode+1); i++)
- for (j=0; j<width; j++)
- ephyrKeySyms.map[(i*width)+j] = (CARD32) keymap[(i*host_width) + j];
+ for (i = 0; i < (max_keycode - min_keycode + 1); i++)
+ for (j = 0; j < width; j++)
+ ephyrKeySyms.map[(i * width) + j] =
+ (CARD32) keymap[(i * host_width) + j];
- EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
+ EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
- ephyrKeySyms.minKeyCode = min_keycode;
- ephyrKeySyms.maxKeyCode = max_keycode;
- ephyrKeySyms.mapWidth = width;
+ ephyrKeySyms.minKeyCode = min_keycode;
+ ephyrKeySyms.maxKeyCode = max_keycode;
+ ephyrKeySyms.mapWidth = width;
- XFree(keymap);
+ XFree(keymap);
}
static struct EphyrHostScreen *
-host_screen_from_window (Window w)
+host_screen_from_window(Window w)
{
- int index = 0;
- struct EphyrHostScreen *result = NULL;
+ int index = 0;
+ struct EphyrHostScreen *result = NULL;
- for (index = 0 ; index < HostX.n_screens ; index++)
- {
- if (HostX.screens[index].win == w || HostX.screens[index].peer_win == w)
- {
- result = &HostX.screens[index];
- goto out;
+ for (index = 0; index < HostX.n_screens; index++) {
+ if (HostX.screens[index].win == w || HostX.screens[index].peer_win == w) {
+ result = &HostX.screens[index];
+ goto out;
}
}
-out:
- return result;
+ out:
+ return result;
}
int
-hostx_get_event(EphyrHostXEvent *ev)
+hostx_get_event(EphyrHostXEvent * ev)
{
- XEvent xev;
- static int grabbed_screen = -1;
-
- if (XPending(HostX.dpy))
- {
- XNextEvent(HostX.dpy, &xev);
-
- switch (xev.type)
- {
- case Expose:
- /* Not so great event compression, but works ok */
- while (XCheckTypedWindowEvent(HostX.dpy, xev.xexpose.window,
- Expose, &xev));
- {
- struct EphyrHostScreen *host_screen =
- host_screen_from_window (xev.xexpose.window);
- if (host_screen)
- {
- hostx_paint_rect (host_screen->info, 0, 0, 0, 0,
- host_screen->win_width,
- host_screen->win_height);
- }
- else
- {
- EPHYR_LOG_ERROR ("failed to get host screen\n");
- ev->type = EPHYR_EV_EXPOSE;
- ev->data.expose.window = xev.xexpose.window;
- return 1;
- }
- }
- return 0;
-
- case MotionNotify:
- {
- struct EphyrHostScreen *host_screen =
- host_screen_from_window (xev.xmotion.window);
-
- ev->type = EPHYR_EV_MOUSE_MOTION;
- ev->data.mouse_motion.x = xev.xmotion.x;
- ev->data.mouse_motion.y = xev.xmotion.y;
- ev->data.mouse_motion.window = xev.xmotion.window;
- ev->data.mouse_motion.screen = (host_screen ? host_screen->mynum : -1);
- }
- return 1;
-
- case ButtonPress:
- ev->type = EPHYR_EV_MOUSE_PRESS;
- ev->key_state = xev.xkey.state;
- /*
- * This is a bit hacky. will break for button 5 ( defined as 0x10 )
- * Check KD_BUTTON defines in kdrive.h
- */
- ev->data.mouse_down.button_num = 1<<(xev.xbutton.button-1);
- return 1;
-
- case ButtonRelease:
- ev->type = EPHYR_EV_MOUSE_RELEASE;
- ev->key_state = xev.xkey.state;
- ev->data.mouse_up.button_num = 1<<(xev.xbutton.button-1);
- return 1;
-
- case KeyPress:
- {
- ev->type = EPHYR_EV_KEY_PRESS;
- ev->key_state = xev.xkey.state;
- ev->data.key_down.scancode = xev.xkey.keycode;
- return 1;
- }
- case KeyRelease:
-
- if ((XKeycodeToKeysym(HostX.dpy,xev.xkey.keycode,0) == XK_Shift_L
- || XKeycodeToKeysym(HostX.dpy,xev.xkey.keycode,0) == XK_Shift_R)
- && (xev.xkey.state & ControlMask))
- {
- struct EphyrHostScreen *host_screen =
- host_screen_from_window (xev.xexpose.window);
-
- if (grabbed_screen != -1)
- {
- XUngrabKeyboard (HostX.dpy, CurrentTime);
- XUngrabPointer (HostX.dpy, CurrentTime);
- grabbed_screen = -1;
- hostx_set_win_title (host_screen->info,
- "(ctrl+shift grabs mouse and keyboard)");
- }
- else
- {
- /* Attempt grab */
- if (XGrabKeyboard (HostX.dpy, host_screen->win, True,
- GrabModeAsync,
- GrabModeAsync,
- CurrentTime) == 0)
- {
- if (XGrabPointer (HostX.dpy, host_screen->win, True,
- NoEventMask,
- GrabModeAsync,
- GrabModeAsync,
- host_screen->win, None, CurrentTime) == 0)
- {
- grabbed_screen = host_screen->mynum;
- hostx_set_win_title
- (host_screen->info,
- "(ctrl+shift releases mouse and keyboard)");
- }
- else /* Failed pointer grabm ungrab keyboard */
- XUngrabKeyboard (HostX.dpy, CurrentTime);
- }
- }
- }
-
- /* Still send the release event even if above has happened
- * server will get confused with just an up event.
- * Maybe it would be better to just block shift+ctrls getting to
- * kdrive all togeather.
- */
- ev->type = EPHYR_EV_KEY_RELEASE;
- ev->key_state = xev.xkey.state;
- ev->data.key_up.scancode = xev.xkey.keycode;
- return 1;
-
- default:
- break;
-
- }
+ XEvent xev;
+ static int grabbed_screen = -1;
+
+ if (XPending(HostX.dpy)) {
+ XNextEvent(HostX.dpy, &xev);
+
+ switch (xev.type) {
+ case Expose:
+ /* Not so great event compression, but works ok */
+ while (XCheckTypedWindowEvent(HostX.dpy, xev.xexpose.window,
+ Expose, &xev));
+ {
+ struct EphyrHostScreen *host_screen =
+ host_screen_from_window(xev.xexpose.window);
+ if (host_screen) {
+ hostx_paint_rect(host_screen->info, 0, 0, 0, 0,
+ host_screen->win_width,
+ host_screen->win_height);
+ }
+ else {
+ EPHYR_LOG_ERROR("failed to get host screen\n");
+ ev->type = EPHYR_EV_EXPOSE;
+ ev->data.expose.window = xev.xexpose.window;
+ return 1;
+ }
+ }
+ return 0;
+
+ case MotionNotify:
+ {
+ struct EphyrHostScreen *host_screen =
+ host_screen_from_window(xev.xmotion.window);
+
+ ev->type = EPHYR_EV_MOUSE_MOTION;
+ ev->data.mouse_motion.x = xev.xmotion.x;
+ ev->data.mouse_motion.y = xev.xmotion.y;
+ ev->data.mouse_motion.window = xev.xmotion.window;
+ ev->data.mouse_motion.screen =
+ (host_screen ? host_screen->mynum : -1);
+ }
+ return 1;
+
+ case ButtonPress:
+ ev->type = EPHYR_EV_MOUSE_PRESS;
+ ev->key_state = xev.xkey.state;
+ /*
+ * This is a bit hacky. will break for button 5 ( defined as 0x10 )
+ * Check KD_BUTTON defines in kdrive.h
+ */
+ ev->data.mouse_down.button_num = 1 << (xev.xbutton.button - 1);
+ return 1;
+
+ case ButtonRelease:
+ ev->type = EPHYR_EV_MOUSE_RELEASE;
+ ev->key_state = xev.xkey.state;
+ ev->data.mouse_up.button_num = 1 << (xev.xbutton.button - 1);
+ return 1;
+
+ case KeyPress:
+ {
+ ev->type = EPHYR_EV_KEY_PRESS;
+ ev->key_state = xev.xkey.state;
+ ev->data.key_down.scancode = xev.xkey.keycode;
+ return 1;
+ }
+ case KeyRelease:
+
+ if ((XKeycodeToKeysym(HostX.dpy, xev.xkey.keycode, 0) == XK_Shift_L
+ || XKeycodeToKeysym(HostX.dpy, xev.xkey.keycode,
+ 0) == XK_Shift_R)
+ && (xev.xkey.state & ControlMask)) {
+ struct EphyrHostScreen *host_screen =
+ host_screen_from_window(xev.xexpose.window);
+
+ if (grabbed_screen != -1) {
+ XUngrabKeyboard(HostX.dpy, CurrentTime);
+ XUngrabPointer(HostX.dpy, CurrentTime);
+ grabbed_screen = -1;
+ hostx_set_win_title(host_screen->info,
+ "(ctrl+shift grabs mouse and keyboard)");
+ }
+ else {
+ /* Attempt grab */
+ if (XGrabKeyboard(HostX.dpy, host_screen->win, True,
+ GrabModeAsync,
+ GrabModeAsync, CurrentTime) == 0) {
+ if (XGrabPointer(HostX.dpy, host_screen->win, True,
+ NoEventMask,
+ GrabModeAsync,
+ GrabModeAsync,
+ host_screen->win, None,
+ CurrentTime) == 0) {
+ grabbed_screen = host_screen->mynum;
+ hostx_set_win_title
+ (host_screen->info,
+ "(ctrl+shift releases mouse and keyboard)");
+ }
+ else /* Failed pointer grabm ungrab keyboard */
+ XUngrabKeyboard(HostX.dpy, CurrentTime);
+ }
+ }
+ }
+
+ /* Still send the release event even if above has happened
+ * server will get confused with just an up event.
+ * Maybe it would be better to just block shift+ctrls getting to
+ * kdrive all togeather.
+ */
+ ev->type = EPHYR_EV_KEY_RELEASE;
+ ev->key_state = xev.xkey.state;
+ ev->data.key_up.scancode = xev.xkey.keycode;
+ return 1;
+
+ default:
+ break;
+
+ }
}
- return 0;
+ return 0;
}
-void*
+void *
hostx_get_display(void)
{
- return HostX.dpy ;
+ return HostX.dpy;
}
int
-hostx_get_window (int a_screen_number)
+hostx_get_window(int a_screen_number)
{
if (a_screen_number < 0 || a_screen_number >= HostX.n_screens) {
- EPHYR_LOG_ERROR ("bad screen number:%d\n", a_screen_number) ;
+ EPHYR_LOG_ERROR("bad screen number:%d\n", a_screen_number);
return 0;
}
- return HostX.screens[a_screen_number].win ;
+ return HostX.screens[a_screen_number].win;
}
int
-hostx_get_window_attributes (int a_window, EphyrHostWindowAttributes *a_attrs)
+hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attrs)
{
- XWindowAttributes attrs ;
+ XWindowAttributes attrs;
- memset (&attrs, 0, sizeof (attrs)) ;
+ memset(&attrs, 0, sizeof(attrs));
- if (!XGetWindowAttributes (hostx_get_display (),
- a_window,
- &attrs)) {
- return FALSE ;
+ if (!XGetWindowAttributes(hostx_get_display(), a_window, &attrs)) {
+ return FALSE;
}
- a_attrs->x = attrs.x ;
- a_attrs->y = attrs.y ;
- a_attrs->width = attrs.width ;
- a_attrs->height = attrs.height ;
+ a_attrs->x = attrs.x;
+ a_attrs->y = attrs.y;
+ a_attrs->width = attrs.width;
+ a_attrs->height = attrs.height;
if (attrs.visual)
- a_attrs->visualid = attrs.visual->visualid ;
- return TRUE ;
+ a_attrs->visualid = attrs.visual->visualid;
+ return TRUE;
}
int
-hostx_get_extension_info (const char *a_ext_name,
- int *a_major_opcode,
- int *a_first_event,
- int *a_first_error)
+hostx_get_extension_info(const char *a_ext_name,
+ int *a_major_opcode,
+ int *a_first_event, int *a_first_error)
{
if (!a_ext_name || !a_major_opcode || !a_first_event || !a_first_error)
- return 0 ;
- if (!XQueryExtension (HostX.dpy,
+ return 0;
+ if (!XQueryExtension(HostX.dpy,
a_ext_name,
- a_major_opcode,
- a_first_event,
- a_first_error))
- {
- return 0 ;
- }
- return 1 ;
+ a_major_opcode, a_first_event, a_first_error)) {
+ return 0;
+ }
+ return 1;
}
int
-hostx_get_visuals_info (EphyrHostVisualInfo **a_visuals,
- int *a_num_entries)
+hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries)
{
- Display *dpy=hostx_get_display () ;
- Bool is_ok=False ;
- XVisualInfo templ, *visuals=NULL;
- EphyrHostVisualInfo *host_visuals=NULL ;
- int nb_items=0, i=0;
-
- EPHYR_RETURN_VAL_IF_FAIL (a_visuals && a_num_entries && dpy,
- False) ;
- EPHYR_LOG ("enter\n") ;
- memset (&templ, 0, sizeof (templ)) ;
- visuals = XGetVisualInfo (dpy, VisualNoMask, &templ, &nb_items) ;
+ Display *dpy = hostx_get_display();
+ Bool is_ok = False;
+ XVisualInfo templ, *visuals = NULL;
+ EphyrHostVisualInfo *host_visuals = NULL;
+ int nb_items = 0, i = 0;
+
+ EPHYR_RETURN_VAL_IF_FAIL(a_visuals && a_num_entries && dpy, False);
+ EPHYR_LOG("enter\n");
+ memset(&templ, 0, sizeof(templ));
+ visuals = XGetVisualInfo(dpy, VisualNoMask, &templ, &nb_items);
if (!visuals) {
- EPHYR_LOG_ERROR ("host does not advertise any visual\n") ;
- goto out ;
+ EPHYR_LOG_ERROR("host does not advertise any visual\n");
+ goto out;
}
- EPHYR_LOG ("host advertises %d visuals\n", nb_items) ;
- host_visuals = calloc (nb_items, sizeof (EphyrHostVisualInfo)) ;
- for (i=0; i<nb_items; i++) {
- host_visuals[i].visualid = visuals[i].visualid ;
- host_visuals[i].screen = visuals[i].screen ;
- host_visuals[i].depth = visuals[i].depth ;
- host_visuals[i].class = visuals[i].class ;
- host_visuals[i].red_mask = visuals[i].red_mask ;
- host_visuals[i].green_mask = visuals[i].green_mask ;
- host_visuals[i].blue_mask = visuals[i].blue_mask ;
- host_visuals[i].colormap_size = visuals[i].colormap_size ;
- host_visuals[i].bits_per_rgb = visuals[i].bits_per_rgb ;
+ EPHYR_LOG("host advertises %d visuals\n", nb_items);
+ host_visuals = calloc(nb_items, sizeof(EphyrHostVisualInfo));
+ for (i = 0; i < nb_items; i++) {
+ host_visuals[i].visualid = visuals[i].visualid;
+ host_visuals[i].screen = visuals[i].screen;
+ host_visuals[i].depth = visuals[i].depth;
+ host_visuals[i].class = visuals[i].class;
+ host_visuals[i].red_mask = visuals[i].red_mask;
+ host_visuals[i].green_mask = visuals[i].green_mask;
+ host_visuals[i].blue_mask = visuals[i].blue_mask;
+ host_visuals[i].colormap_size = visuals[i].colormap_size;
+ host_visuals[i].bits_per_rgb = visuals[i].bits_per_rgb;
}
- *a_visuals = host_visuals ;
+ *a_visuals = host_visuals;
*a_num_entries = nb_items;
- host_visuals=NULL;
+ host_visuals = NULL;
is_ok = TRUE;
-out:
+ out:
if (visuals) {
- XFree (visuals) ;
+ XFree(visuals);
visuals = NULL;
}
free(host_visuals);
host_visuals = NULL;
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
int
-hostx_create_window (int a_screen_number,
- EphyrBox *a_geometry,
- int a_visual_id,
- int *a_host_peer /*out parameter*/)
+hostx_create_window(int a_screen_number,
+ EphyrBox * a_geometry,
+ int a_visual_id, int *a_host_peer /*out parameter */ )
{
- Bool is_ok=FALSE ;
- Display *dpy=hostx_get_display () ;
- XVisualInfo *visual_info=NULL, visual_info_templ;
- int visual_mask=VisualIDMask ;
- Window win=None ;
- int nb_visuals=0, winmask=0;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ XVisualInfo *visual_info = NULL, visual_info_templ;
+ int visual_mask = VisualIDMask;
+ Window win = None;
+ int nb_visuals = 0, winmask = 0;
XSetWindowAttributes attrs;
- EPHYR_RETURN_VAL_IF_FAIL (dpy && a_geometry, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy && a_geometry, FALSE);
- EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG("enter\n");
- /*get visual*/
- memset (&visual_info, 0, sizeof (visual_info)) ;
- visual_info_templ.visualid = a_visual_id ;
- visual_info = XGetVisualInfo (dpy, visual_mask,
- &visual_info_templ,
- &nb_visuals) ;
+ /*get visual */
+ memset(&visual_info, 0, sizeof(visual_info));
+ visual_info_templ.visualid = a_visual_id;
+ visual_info = XGetVisualInfo(dpy, visual_mask,
+ &visual_info_templ, &nb_visuals);
if (!visual_info) {
- EPHYR_LOG_ERROR ("argh, could not find a remote visual with id:%d\n",
- a_visual_id) ;
- goto out ;
+ EPHYR_LOG_ERROR("argh, could not find a remote visual with id:%d\n",
+ a_visual_id);
+ goto out;
}
- memset (&attrs, 0, sizeof (attrs)) ;
- attrs.colormap = XCreateColormap (dpy,
- RootWindow (dpy,
- visual_info->screen),
- visual_info->visual,
- AllocNone) ;
+ memset(&attrs, 0, sizeof(attrs));
+ attrs.colormap = XCreateColormap(dpy,
+ RootWindow(dpy,
+ visual_info->screen),
+ visual_info->visual, AllocNone);
attrs.event_mask = ButtonPressMask
- |ButtonReleaseMask
- |PointerMotionMask
- |KeyPressMask
- |KeyReleaseMask
- |ExposureMask;
- winmask = CWColormap|CWEventMask;
-
- win = XCreateWindow (dpy, hostx_get_window (a_screen_number),
- a_geometry->x, a_geometry->y,
- a_geometry->width, a_geometry->height, 0,
- visual_info->depth, CopyFromParent,
- visual_info->visual, winmask, &attrs) ;
+ | ButtonReleaseMask
+ | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask;
+ winmask = CWColormap | CWEventMask;
+
+ win = XCreateWindow(dpy, hostx_get_window(a_screen_number),
+ a_geometry->x, a_geometry->y,
+ a_geometry->width, a_geometry->height, 0,
+ visual_info->depth, CopyFromParent,
+ visual_info->visual, winmask, &attrs);
if (win == None) {
- EPHYR_LOG_ERROR ("failed to create peer window\n") ;
- goto out ;
+ EPHYR_LOG_ERROR("failed to create peer window\n");
+ goto out;
}
if (HostX.screens[a_screen_number].peer_win == None) {
- HostX.screens[a_screen_number].peer_win = win;
- } else {
- EPHYR_LOG_ERROR ("multiple peer windows created for same screen\n") ;
+ HostX.screens[a_screen_number].peer_win = win;
+ }
+ else {
+ EPHYR_LOG_ERROR("multiple peer windows created for same screen\n");
}
- XFlush (dpy) ;
- XMapWindow (dpy, win) ;
- *a_host_peer = win ;
- is_ok = TRUE ;
-out:
- EPHYR_LOG ("leave\n") ;
- return is_ok ;
+ XFlush(dpy);
+ XMapWindow(dpy, win);
+ *a_host_peer = win;
+ is_ok = TRUE;
+ out:
+ EPHYR_LOG("leave\n");
+ return is_ok;
}
int
-hostx_destroy_window (int a_win)
+hostx_destroy_window(int a_win)
{
- Display *dpy=hostx_get_display () ;
+ Display *dpy = hostx_get_display();
- EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
- XDestroyWindow (dpy, a_win) ;
- XFlush (dpy) ;
- return TRUE ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
+ XDestroyWindow(dpy, a_win);
+ XFlush(dpy);
+ return TRUE;
}
int
-hostx_set_window_geometry (int a_win, EphyrBox *a_geo)
+hostx_set_window_geometry(int a_win, EphyrBox * a_geo)
{
- Display *dpy=hostx_get_display ();
+ Display *dpy = hostx_get_display();
- EPHYR_RETURN_VAL_IF_FAIL (dpy && a_geo, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL(dpy && a_geo, FALSE);
- EPHYR_LOG ("enter. x,y,w,h:(%d,%d,%d,%d)\n",
- a_geo->x, a_geo->y,
- a_geo->width, a_geo->height) ;
+ EPHYR_LOG("enter. x,y,w,h:(%d,%d,%d,%d)\n",
+ a_geo->x, a_geo->y, a_geo->width, a_geo->height);
- XMoveWindow (dpy, a_win, a_geo->x, a_geo->y) ;
- XResizeWindow (dpy, a_win, a_geo->width, a_geo->height) ;
- EPHYR_LOG ("leave\n") ;
+ XMoveWindow(dpy, a_win, a_geo->x, a_geo->y);
+ XResizeWindow(dpy, a_win, a_geo->width, a_geo->height);
+ EPHYR_LOG("leave\n");
return TRUE;
}
int
-hostx_set_window_bounding_rectangles (int a_window,
- EphyrRect *a_rects,
- int a_num_rects)
+hostx_set_window_bounding_rectangles(int a_window,
+ EphyrRect * a_rects, int a_num_rects)
{
- Bool is_ok=FALSE;
- Display *dpy=hostx_get_display () ;
- int i=0 ;
- XRectangle *rects=NULL ;
-
- EPHYR_RETURN_VAL_IF_FAIL (dpy && a_rects, FALSE) ;
-
- EPHYR_LOG ("enter. num rects:%d\n", a_num_rects) ;
-
- rects = calloc (a_num_rects, sizeof (XRectangle)) ;
- for (i=0; i<a_num_rects; i++) {
- rects[i].x = a_rects[i].x1 ;
- rects[i].y = a_rects[i].y1 ;
- rects[i].width = abs (a_rects[i].x2 - a_rects[i].x1);
- rects[i].height = abs (a_rects[i].y2 - a_rects[i].y1) ;
- EPHYR_LOG ("borders clipped to rect[x:%d,y:%d,w:%d,h:%d]\n",
- rects[i].x, rects[i].y,
- rects[i].width, rects[i].height) ;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ int i = 0;
+ XRectangle *rects = NULL;
+
+ EPHYR_RETURN_VAL_IF_FAIL(dpy && a_rects, FALSE);
+
+ EPHYR_LOG("enter. num rects:%d\n", a_num_rects);
+
+ rects = calloc(a_num_rects, sizeof(XRectangle));
+ for (i = 0; i < a_num_rects; i++) {
+ rects[i].x = a_rects[i].x1;
+ rects[i].y = a_rects[i].y1;
+ rects[i].width = abs(a_rects[i].x2 - a_rects[i].x1);
+ rects[i].height = abs(a_rects[i].y2 - a_rects[i].y1);
+ EPHYR_LOG("borders clipped to rect[x:%d,y:%d,w:%d,h:%d]\n",
+ rects[i].x, rects[i].y, rects[i].width, rects[i].height);
}
- /*this aways returns 1*/
+ /*this aways returns 1 */
#ifdef _MSC_VER
__asm int 3;
#else
- XShapeCombineRectangles (dpy, a_window, ShapeBounding, 0, 0,
- rects, a_num_rects, ShapeSet, YXBanded) ;
+ XShapeCombineRectangles(dpy, a_window, ShapeBounding, 0, 0,
+ rects, a_num_rects, ShapeSet, YXBanded);
#endif
- is_ok = TRUE ;
+ is_ok = TRUE;
free(rects);
rects = NULL;
- EPHYR_LOG ("leave\n") ;
+ EPHYR_LOG("leave\n");
return is_ok;
}
int
-hostx_set_window_clipping_rectangles (int a_window,
- EphyrRect *a_rects,
- int a_num_rects)
+hostx_set_window_clipping_rectangles(int a_window,
+ EphyrRect * a_rects, int a_num_rects)
{
- Bool is_ok=FALSE;
- Display *dpy=hostx_get_display () ;
- int i=0 ;
- XRectangle *rects=NULL ;
-
- EPHYR_RETURN_VAL_IF_FAIL (dpy && a_rects, FALSE) ;
-
- EPHYR_LOG ("enter. num rects:%d\n", a_num_rects) ;
-
- rects = calloc (a_num_rects, sizeof (XRectangle)) ;
- for (i=0; i<a_num_rects; i++) {
- rects[i].x = a_rects[i].x1 ;
- rects[i].y = a_rects[i].y1 ;
- rects[i].width = abs (a_rects[i].x2 - a_rects[i].x1);
- rects[i].height = abs (a_rects[i].y2 - a_rects[i].y1) ;
- EPHYR_LOG ("clipped to rect[x:%d,y:%d,w:%d,h:%d]\n",
- rects[i].x, rects[i].y,
- rects[i].width, rects[i].height) ;
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display();
+ int i = 0;
+ XRectangle *rects = NULL;
+
+ EPHYR_RETURN_VAL_IF_FAIL(dpy && a_rects, FALSE);
+
+ EPHYR_LOG("enter. num rects:%d\n", a_num_rects);
+
+ rects = calloc(a_num_rects, sizeof(XRectangle));
+ for (i = 0; i < a_num_rects; i++) {
+ rects[i].x = a_rects[i].x1;
+ rects[i].y = a_rects[i].y1;
+ rects[i].width = abs(a_rects[i].x2 - a_rects[i].x1);
+ rects[i].height = abs(a_rects[i].y2 - a_rects[i].y1);
+ EPHYR_LOG("clipped to rect[x:%d,y:%d,w:%d,h:%d]\n",
+ rects[i].x, rects[i].y, rects[i].width, rects[i].height);
}
- /*this aways returns 1*/
+ /*this aways returns 1 */
#ifdef _MSC_VER
__asm int 3;
#else
- XShapeCombineRectangles (dpy, a_window, ShapeClip, 0, 0,
- rects, a_num_rects, ShapeSet, YXBanded) ;
+ XShapeCombineRectangles(dpy, a_window, ShapeClip, 0, 0,
+ rects, a_num_rects, ShapeSet, YXBanded);
#endif
- is_ok = TRUE ;
+ is_ok = TRUE;
free(rects);
rects = NULL;
- EPHYR_LOG ("leave\n") ;
+ EPHYR_LOG("leave\n");
return is_ok;
}
int
-hostx_has_xshape (void)
+hostx_has_xshape(void)
{
- int event_base=0, error_base=0 ;
+ int event_base = 0, error_base = 0;
#ifdef _MSC_VER
__asm int 3;
#else
- Display *dpy=hostx_get_display () ;
- if (!XShapeQueryExtension (dpy,
- &event_base,
- &error_base)) {
- return FALSE ;
+ Display *dpy = hostx_get_display();
+
+ if (!XShapeQueryExtension(dpy, &event_base, &error_base)) {
+ return FALSE;
}
#endif
return TRUE;
@@ -1397,105 +1313,102 @@ hostx_has_xshape (void)
#ifdef XF86DRI
typedef struct {
- int is_valid ;
- int local_id ;
- int remote_id ;
-} ResourcePair ;
+ int is_valid;
+ int local_id;
+ int remote_id;
+} ResourcePair;
#define RESOURCE_PEERS_SIZE 1024*10
-static ResourcePair resource_peers[RESOURCE_PEERS_SIZE] ;
-
+static ResourcePair resource_peers[RESOURCE_PEERS_SIZE];
int
-hostx_allocate_resource_id_peer (int a_local_resource_id,
- int *a_remote_resource_id)
+hostx_allocate_resource_id_peer(int a_local_resource_id,
+ int *a_remote_resource_id)
{
- int i=0 ;
- ResourcePair *peer=NULL ;
- Display *dpy=hostx_get_display ();
+ int i = 0;
+ ResourcePair *peer = NULL;
+ Display *dpy = hostx_get_display();
/*
* first make sure a resource peer
* does not exist already for
* a_local_resource_id
*/
- for (i=0; i<RESOURCE_PEERS_SIZE; i++) {
+ for (i = 0; i < RESOURCE_PEERS_SIZE; i++) {
if (resource_peers[i].is_valid
&& resource_peers[i].local_id == a_local_resource_id) {
- peer = &resource_peers[i] ;
- break ;
+ peer = &resource_peers[i];
+ break;
}
}
/*
* find one free peer entry, an feed it with
*/
if (!peer) {
- for (i=0; i<RESOURCE_PEERS_SIZE; i++) {
+ for (i = 0; i < RESOURCE_PEERS_SIZE; i++) {
if (!resource_peers[i].is_valid) {
- peer = &resource_peers[i] ;
- break ;
+ peer = &resource_peers[i];
+ break;
}
}
if (peer) {
- peer->remote_id = XAllocID (dpy);
- peer->local_id = a_local_resource_id ;
- peer->is_valid = TRUE ;
+ peer->remote_id = XAllocID(dpy);
+ peer->local_id = a_local_resource_id;
+ peer->is_valid = TRUE;
}
}
if (peer) {
- *a_remote_resource_id = peer->remote_id ;
- return TRUE ;
+ *a_remote_resource_id = peer->remote_id;
+ return TRUE;
}
- return FALSE ;
+ return FALSE;
}
int
-hostx_get_resource_id_peer (int a_local_resource_id,
- int *a_remote_resource_id)
+hostx_get_resource_id_peer(int a_local_resource_id, int *a_remote_resource_id)
{
- int i=0 ;
- ResourcePair *peer=NULL ;
- for (i=0; i<RESOURCE_PEERS_SIZE; i++) {
+ int i = 0;
+ ResourcePair *peer = NULL;
+
+ for (i = 0; i < RESOURCE_PEERS_SIZE; i++) {
if (resource_peers[i].is_valid
&& resource_peers[i].local_id == a_local_resource_id) {
- peer = &resource_peers[i] ;
- break ;
+ peer = &resource_peers[i];
+ break;
}
}
if (peer) {
- *a_remote_resource_id = peer->remote_id ;
- return TRUE ;
+ *a_remote_resource_id = peer->remote_id;
+ return TRUE;
}
- return FALSE ;
+ return FALSE;
}
int
-hostx_has_dri (void)
+hostx_has_dri(void)
{
- int event_base=0, error_base=0 ;
- Display *dpy=hostx_get_display () ;
+ int event_base = 0, error_base = 0;
+ Display *dpy = hostx_get_display();
if (!dpy)
- return FALSE ;
+ return FALSE;
- if (!XF86DRIQueryExtension (dpy,
- &event_base,
- &error_base)) {
- return FALSE ;
+ if (!XF86DRIQueryExtension(dpy, &event_base, &error_base)) {
+ return FALSE;
}
- return TRUE ;
+ return TRUE;
}
int
-hostx_has_glx (void)
+hostx_has_glx(void)
{
- Display *dpy=hostx_get_display () ;
- int event_base=0, error_base=0 ;
+ Display *dpy = hostx_get_display();
+ int event_base = 0, error_base = 0;
- if (!glXQueryExtension (dpy, &event_base, &error_base)) {
- return FALSE ;
+ if (!glXQueryExtension(dpy, &event_base, &error_base)) {
+ return FALSE;
}
- return TRUE ;
+ return TRUE;
}
-#endif /* XF86DRI */
+#endif /* XF86DRI */
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.h b/xorg-server/hw/kdrive/ephyr/hostx.h
index 2887197df..c1e1133c0 100644
--- a/xorg-server/hw/kdrive/ephyr/hostx.h
+++ b/xorg-server/hw/kdrive/ephyr/hostx.h
@@ -38,231 +38,213 @@
#ifdef _MSC_VER
#define EPHYR_DBG()
#else
-#define EPHYR_DBG(x, a...) do {} while (0)
+#define EPHYR_DBG(x, a...) do {} while (0)
#endif
#endif
-typedef struct EphyrHostXVars EphyrHostXVars;
+typedef struct EphyrHostXVars EphyrHostXVars;
typedef struct EphyrHostXEvent EphyrHostXEvent;
-typedef void* EphyrScreenInfo ;
-typedef enum EphyrHostXEventType
-{
- EPHYR_EV_MOUSE_MOTION,
- EPHYR_EV_MOUSE_PRESS,
- EPHYR_EV_MOUSE_RELEASE,
- EPHYR_EV_KEY_PRESS,
- EPHYR_EV_KEY_RELEASE,
- EPHYR_EV_EXPOSE
-}
-EphyrHostXEventType;
+typedef void *EphyrScreenInfo;
+typedef enum EphyrHostXEventType {
+ EPHYR_EV_MOUSE_MOTION,
+ EPHYR_EV_MOUSE_PRESS,
+ EPHYR_EV_MOUSE_RELEASE,
+ EPHYR_EV_KEY_PRESS,
+ EPHYR_EV_KEY_RELEASE,
+ EPHYR_EV_EXPOSE
+} EphyrHostXEventType;
/* I can't believe it's not a KeySymsRec. */
typedef struct {
- int minKeyCode;
- int maxKeyCode;
- int mapWidth;
- CARD32 *map;
+ int minKeyCode;
+ int maxKeyCode;
+ int mapWidth;
+ CARD32 *map;
} EphyrKeySyms;
-struct EphyrHostXEvent
-{
- EphyrHostXEventType type;
+struct EphyrHostXEvent {
+ EphyrHostXEventType type;
- union
- {
- struct mouse_motion {
- int x;
- int y;
- int screen;
- int window;
- } mouse_motion;
+ union {
+ struct mouse_motion {
+ int x;
+ int y;
+ int screen;
+ int window;
+ } mouse_motion;
- struct mouse_down {
- int button_num;
- } mouse_down;
+ struct mouse_down {
+ int button_num;
+ } mouse_down;
- struct mouse_up {
- int button_num;
- } mouse_up;
+ struct mouse_up {
+ int button_num;
+ } mouse_up;
- struct key_up {
- int scancode;
- } key_up;
+ struct key_up {
+ int scancode;
+ } key_up;
- struct key_down {
- int scancode;
- } key_down;
+ struct key_down {
+ int scancode;
+ } key_down;
- struct expose {
- int window;
- } expose;
+ struct expose {
+ int window;
+ } expose;
- } data;
+ } data;
- int key_state;
+ int key_state;
};
typedef struct {
- VisualID visualid;
- int screen;
- int depth;
- int class;
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
- int colormap_size;
- int bits_per_rgb;
+ VisualID visualid;
+ int screen;
+ int depth;
+ int class;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ int colormap_size;
+ int bits_per_rgb;
} EphyrHostVisualInfo;
typedef struct {
int x, y;
- int width, height ;
- int visualid ;
+ int width, height;
+ int visualid;
} EphyrHostWindowAttributes;
typedef struct {
- int x,y,width,height;
+ int x, y, width, height;
} EphyrBox;
typedef struct {
- short x1,y1,x2,y2;
+ short x1, y1, x2, y2;
} EphyrRect;
int
-hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height);
+ hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height);
int
-hostx_want_host_cursor(void);
+ hostx_want_host_cursor(void);
void
-hostx_use_host_cursor(void);
+ hostx_use_host_cursor(void);
void
-hostx_use_fullscreen(void);
+ hostx_use_fullscreen(void);
int
-hostx_want_fullscreen(void);
+ hostx_want_fullscreen(void);
int
-hostx_want_preexisting_window(EphyrScreenInfo screen);
+ hostx_want_preexisting_window(EphyrScreenInfo screen);
void
-hostx_use_preexisting_window(unsigned long win_id);
+ hostx_use_preexisting_window(unsigned long win_id);
void
-hostx_use_resname (char *name, int fromcmd);
+ hostx_use_resname(char *name, int fromcmd);
void
-hostx_set_title(char *name);
+ hostx_set_title(char *name);
-void
-hostx_handle_signal(int signum);
+void
+ hostx_handle_signal(int signum);
int
-hostx_init(void);
+ hostx_init(void);
void
-hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num);
+ hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num);
void
-hostx_set_display_name(char *name);
+ hostx_set_display_name(char *name);
void
-hostx_set_screen_number(EphyrScreenInfo screen, int number);
+ hostx_set_screen_number(EphyrScreenInfo screen, int number);
void
-hostx_set_win_title(EphyrScreenInfo screen, char *extra_text);
+ hostx_set_win_title(EphyrScreenInfo screen, char *extra_text);
int
-hostx_get_depth (void);
+ hostx_get_depth(void);
int
-hostx_get_server_depth (EphyrScreenInfo screen);
+ hostx_get_server_depth(EphyrScreenInfo screen);
void
-hostx_set_server_depth(EphyrScreenInfo screen, int depth);
+ hostx_set_server_depth(EphyrScreenInfo screen, int depth);
int
-hostx_get_bpp(void *info);
+ hostx_get_bpp(void *info);
void
-hostx_get_visual_masks (void *info,
- CARD32 *rmsk,
- CARD32 *gmsk,
- CARD32 *bmsk);
+ hostx_get_visual_masks(void *info, CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk);
void
-hostx_set_cmap_entry(unsigned char idx,
- unsigned char r,
- unsigned char g,
- unsigned char b);
-void*
-hostx_screen_init (EphyrScreenInfo screen,
- int width, int height,
- int buffer_height);
+hostx_set_cmap_entry(unsigned char idx,
+ unsigned char r, unsigned char g, unsigned char b);
+
+void *hostx_screen_init(EphyrScreenInfo screen,
+ int width, int height, int buffer_height);
void
-hostx_paint_rect(EphyrScreenInfo screen,
- int sx, int sy,
- int dx, int dy,
- int width, int height);
+hostx_paint_rect(EphyrScreenInfo screen,
+ int sx, int sy, int dx, int dy, int width, int height);
void
-hostx_load_keymap (void);
+ hostx_load_keymap(void);
int
-hostx_get_event (EphyrHostXEvent *ev);
+ hostx_get_event(EphyrHostXEvent * ev);
-void*
-hostx_get_display (void) ;
+void *hostx_get_display(void);
int
-hostx_get_window (int a_screen_number) ;
+ hostx_get_window(int a_screen_number);
int
-hostx_get_window_attributes (int a_window, EphyrHostWindowAttributes *a_attr) ;
+ hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attr);
int
-hostx_get_extension_info (const char *a_ext_name,
- int *a_major_opcode,
- int *a_first_even,
- int *a_first_error) ;
-int
-hostx_get_visuals_info (EphyrHostVisualInfo **a_visuals,
- int *a_num_entries) ;
-int hostx_create_window (int a_screen_number,
- EphyrBox *a_geometry,
- int a_visual_id,
- int *a_host_win /*out parameter*/) ;
+hostx_get_extension_info(const char *a_ext_name,
+ int *a_major_opcode,
+ int *a_first_even, int *a_first_error);
+int
+ hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries);
-int hostx_destroy_window (int a_win) ;
+int hostx_create_window(int a_screen_number,
+ EphyrBox * a_geometry,
+ int a_visual_id, int *a_host_win /*out parameter */ );
-int hostx_set_window_geometry (int a_win, EphyrBox *a_geo) ;
+int hostx_destroy_window(int a_win);
+int hostx_set_window_geometry(int a_win, EphyrBox * a_geo);
-int hostx_set_window_bounding_rectangles (int a_window,
- EphyrRect *a_rects,
- int a_num_rects) ;
+int hostx_set_window_bounding_rectangles(int a_window,
+ EphyrRect * a_rects, int a_num_rects);
-int hostx_set_window_clipping_rectangles (int a_window,
- EphyrRect *a_rects,
- int a_num_rects) ;
-int hostx_has_xshape (void) ;
+int hostx_set_window_clipping_rectangles(int a_window,
+ EphyrRect * a_rects, int a_num_rects);
+int hostx_has_xshape(void);
#ifdef XF86DRI
-int hostx_lookup_peer_window (void *a_local_window,
- int *a_host_peer /*out parameter*/) ;
+int hostx_lookup_peer_window(void *a_local_window,
+ int *a_host_peer /*out parameter */ );
int
-hostx_allocate_resource_id_peer (int a_local_resource_id,
- int *a_remote_resource_id) ;
+
+hostx_allocate_resource_id_peer(int a_local_resource_id,
+ int *a_remote_resource_id);
int
-hostx_get_resource_id_peer (int a_local_resource_id,
- int *a_remote_resource_id) ;
-int hostx_has_dri (void) ;
+ hostx_get_resource_id_peer(int a_local_resource_id, int *a_remote_resource_id);
+int hostx_has_dri(void);
-int hostx_has_glx (void) ;
-#endif /* XF86DRI */
+int hostx_has_glx(void);
+#endif /* XF86DRI */
#endif /*_XLIBS_STUFF_H_*/
diff --git a/xorg-server/hw/kdrive/ephyr/os.c b/xorg-server/hw/kdrive/ephyr/os.c
index e4dc6787d..a2a705dd9 100644
--- a/xorg-server/hw/kdrive/ephyr/os.c
+++ b/xorg-server/hw/kdrive/ephyr/os.c
@@ -28,24 +28,22 @@
#endif
#include "ephyr.h"
-extern void processScreenArg (char *screen_size, char *parent_id) ;
+extern void processScreenArg(char *screen_size, char *parent_id);
static int
-EphyrInit (void)
+EphyrInit(void)
{
- /*
- * make sure at least one screen
- * has been added to the system.
- */
- if (!KdCardInfoLast ())
- {
- processScreenArg ("640x480", NULL) ;
+ /*
+ * make sure at least one screen
+ * has been added to the system.
+ */
+ if (!KdCardInfoLast()) {
+ processScreenArg("640x480", NULL);
}
- return hostx_init();
+ return hostx_init();
}
-KdOsFuncs EphyrOsFuncs = {
+KdOsFuncs EphyrOsFuncs = {
.Init = EphyrInit,
.pollEvents = ephyrPoll,
};
-
diff --git a/xorg-server/hw/kdrive/ephyr/xf86dri.h b/xorg-server/hw/kdrive/ephyr/xf86dri.h
index cd650b582..88d3f3bf1 100644
--- a/xorg-server/hw/kdrive/ephyr/xf86dri.h
+++ b/xorg-server/hw/kdrive/ephyr/xf86dri.h
@@ -54,8 +54,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define X_XF86DRIGetDrawableInfo 9
#define X_XF86DRIGetDeviceInfo 10
#define X_XF86DRIAuthConnection 11
-#define X_XF86DRIOpenFullScreen 12 /* Deprecated */
-#define X_XF86DRICloseFullScreen 13 /* Deprecated */
+#define X_XF86DRIOpenFullScreen 12 /* Deprecated */
+#define X_XF86DRICloseFullScreen 13 /* Deprecated */
#define XF86DRINumberEvents 0
@@ -67,54 +67,58 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
_XFUNCPROTOBEGIN
-Bool XF86DRIQueryExtension( Display *dpy, int *event_base, int *error_base );
+Bool XF86DRIQueryExtension(Display * dpy, int *event_base, int *error_base);
-Bool XF86DRIQueryVersion( Display *dpy, int *majorVersion, int *minorVersion,
- int *patchVersion );
+Bool XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
+ int *patchVersion);
-Bool XF86DRIQueryDirectRenderingCapable( Display *dpy, int screen,
- Bool *isCapable );
+Bool XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen,
+ Bool *isCapable);
-Bool XF86DRIOpenConnection( Display *dpy, int screen, drm_handle_t *hSAREA,
- char **busIDString );
+Bool XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
+ char **busIDString);
-Bool XF86DRIAuthConnection( Display *dpy, int screen, drm_magic_t magic );
+Bool XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic);
-Bool XF86DRICloseConnection( Display *dpy, int screen );
+Bool XF86DRICloseConnection(Display * dpy, int screen);
-Bool XF86DRIGetClientDriverName( Display *dpy, int screen,
- int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
- int *ddxDriverPatchVersion, char **clientDriverName );
+Bool XF86DRIGetClientDriverName(Display * dpy, int screen,
+ int *ddxDriverMajorVersion,
+ int *ddxDriverMinorVersion,
+ int *ddxDriverPatchVersion,
+ char **clientDriverName);
-Bool XF86DRICreateContext( Display *dpy, int screen, Visual *visual,
- XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
+Bool XF86DRICreateContext(Display * dpy, int screen, Visual * visual,
+ XID *ptr_to_returned_context_id,
+ drm_context_t * hHWContext);
-Bool XF86DRICreateContextWithConfig( Display *dpy, int screen, int configID,
- XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
+Bool XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
+ XID *ptr_to_returned_context_id,
+ drm_context_t * hHWContext);
-extern GLboolean XF86DRIDestroyContext( Display *dpy, int screen,
- XID context_id );
+extern GLboolean XF86DRIDestroyContext(Display * dpy, int screen,
+ XID context_id);
-extern GLboolean XF86DRICreateDrawable( Display *dpy, int screen,
- XID drawable, drm_drawable_t *hHWDrawable );
+extern GLboolean XF86DRICreateDrawable(Display * dpy, int screen,
+ XID drawable,
+ drm_drawable_t * hHWDrawable);
-extern GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
- XID drawable);
+extern GLboolean XF86DRIDestroyDrawable(Display * dpy, int screen,
+ XID drawable);
-Bool XF86DRIGetDrawableInfo( Display *dpy, int screen, Drawable drawable,
- unsigned int *index, unsigned int *stamp,
- int *X, int *Y, int *W, int *H,
- int *numClipRects, drm_clip_rect_t ** pClipRects,
- int *backX, int *backY,
- int *numBackClipRects, drm_clip_rect_t **pBackClipRects );
+Bool XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
+ unsigned int *index, unsigned int *stamp,
+ int *X, int *Y, int *W, int *H,
+ int *numClipRects, drm_clip_rect_t ** pClipRects,
+ int *backX, int *backY,
+ int *numBackClipRects,
+ drm_clip_rect_t ** pBackClipRects);
-Bool XF86DRIGetDeviceInfo( Display *dpy, int screen,
- drm_handle_t *hFrameBuffer, int *fbOrigin, int *fbSize,
- int *fbStride, int *devPrivateSize, void **pDevPrivate );
+Bool XF86DRIGetDeviceInfo(Display * dpy, int screen,
+ drm_handle_t * hFrameBuffer, int *fbOrigin,
+ int *fbSize, int *fbStride, int *devPrivateSize,
+ void **pDevPrivate);
_XFUNCPROTOEND
-
-#endif /* _XF86DRI_SERVER_ */
-
-#endif /* _XF86DRI_H_ */
-
+#endif /* _XF86DRI_SERVER_ */
+#endif /* _XF86DRI_H_ */
diff --git a/xorg-server/hw/kdrive/fake/fake.c b/xorg-server/hw/kdrive/fake/fake.c
index 21360b16d..90e3ec9a6 100644
--- a/xorg-server/hw/kdrive/fake/fake.c
+++ b/xorg-server/hw/kdrive/fake/fake.c
@@ -1,472 +1,450 @@
-/*
- * Copyright © 2004 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-#include "fake.h"
-
-extern int KdTsPhyScreen;
-
-Bool
-fakeInitialize (KdCardInfo *card, FakePriv *priv)
-{
- priv->base = 0;
- priv->bytes_per_line = 0;
- return TRUE;
-}
-
-Bool
-fakeCardInit (KdCardInfo *card)
-{
- FakePriv *priv;
-
- priv = (FakePriv *) malloc(sizeof (FakePriv));
- if (!priv)
- return FALSE;
-
- if (!fakeInitialize (card, priv))
- {
- free(priv);
- return FALSE;
- }
- card->driver = priv;
-
- return TRUE;
-}
-
-Bool
-fakeScreenInitialize (KdScreenInfo *screen, FakeScrPriv *scrpriv)
-{
- if (!screen->width || !screen->height)
- {
- screen->width = 1024;
- screen->height = 768;
- screen->rate = 72;
- }
-
- if (screen->width <= 0)
- screen->width = 1;
- if (screen->height <= 0)
- screen->height = 1;
-
- if (!screen->fb.depth)
- screen->fb.depth = 16;
-
- if (screen->fb.depth <= 8)
- {
- screen->fb.visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- }
- else
- {
- screen->fb.visuals = (1 << TrueColor);
-#define Mask(o,l) (((1 << l) - 1) << o)
- if (screen->fb.depth <= 15)
- {
- screen->fb.depth = 15;
- screen->fb.bitsPerPixel = 16;
- screen->fb.redMask = Mask (10, 5);
- screen->fb.greenMask = Mask (5, 5);
- screen->fb.blueMask = Mask (0, 5);
- }
- else if (screen->fb.depth <= 16)
- {
- screen->fb.depth = 16;
- screen->fb.bitsPerPixel = 16;
- screen->fb.redMask = Mask (11, 5);
- screen->fb.greenMask = Mask (5, 6);
- screen->fb.blueMask = Mask (0, 5);
- }
- else
- {
- screen->fb.depth = 24;
- screen->fb.bitsPerPixel = 32;
- screen->fb.redMask = Mask (16, 8);
- screen->fb.greenMask = Mask (8, 8);
- screen->fb.blueMask = Mask (0, 8);
- }
- }
-
- scrpriv->randr = screen->randr;
-
- return fakeMapFramebuffer (screen);
-}
-
-Bool
-fakeScreenInit (KdScreenInfo *screen)
-{
- FakeScrPriv *scrpriv;
-
- scrpriv = calloc(1, sizeof (FakeScrPriv));
- if (!scrpriv)
- return FALSE;
- screen->driver = scrpriv;
- if (!fakeScreenInitialize (screen, scrpriv))
- {
- screen->driver = 0;
- free(scrpriv);
- return FALSE;
- }
- return TRUE;
-}
-
-void *
-fakeWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure)
-{
- KdScreenPriv(pScreen);
- FakePriv *priv = pScreenPriv->card->driver;
-
- if (!pScreenPriv->enabled)
- return 0;
- *size = priv->bytes_per_line;
- return priv->base + row * priv->bytes_per_line;
-}
-
-Bool
-fakeMapFramebuffer (KdScreenInfo *screen)
-{
- FakeScrPriv *scrpriv = screen->driver;
- KdPointerMatrix m;
- FakePriv *priv = screen->card->driver;
-
- if (scrpriv->randr != RR_Rotate_0)
- scrpriv->shadow = TRUE;
- else
- scrpriv->shadow = FALSE;
-
- KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
-
- KdSetPointerMatrix (&m);
-
- priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
- free(priv->base);
- priv->base = malloc (priv->bytes_per_line * screen->height);
-
- if (scrpriv->shadow)
- {
- if (!KdShadowFbAlloc (screen, scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
- return FALSE;
- }
- else
- {
- screen->fb.byteStride = priv->bytes_per_line;
- screen->fb.pixelStride = (priv->bytes_per_line * 8/
- screen->fb.bitsPerPixel);
- screen->fb.frameBuffer = (CARD8 *) (priv->base);
- }
-
- return TRUE;
-}
-
-void
-fakeSetScreenSizes (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FakeScrPriv *scrpriv = screen->driver;
-
- if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- pScreen->width = screen->width;
- pScreen->height = screen->height;
- pScreen->mmWidth = screen->width_mm;
- pScreen->mmHeight = screen->height_mm;
- }
- else
- {
- pScreen->width = screen->width;
- pScreen->height = screen->height;
- pScreen->mmWidth = screen->height_mm;
- pScreen->mmHeight = screen->width_mm;
- }
-}
-
-Bool
-fakeUnmapFramebuffer (KdScreenInfo *screen)
-{
- FakePriv *priv = screen->card->driver;
- KdShadowFbFree (screen);
- free(priv->base);
- priv->base = NULL;
- return TRUE;
-}
-
-Bool
-fakeSetShadow (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FakeScrPriv *scrpriv = screen->driver;
- ShadowUpdateProc update;
- ShadowWindowProc window;
-
- window = fakeWindowLinear;
- update = 0;
- if (scrpriv->randr)
- update = shadowUpdateRotatePacked;
- else
- update = shadowUpdatePacked;
- return KdShadowSet (pScreen, scrpriv->randr, update, window);
-}
-
-
-#ifdef RANDR
-Bool
-fakeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FakeScrPriv *scrpriv = screen->driver;
- RRScreenSizePtr pSize;
- Rotation randr;
- int n;
-
- *rotations = RR_Rotate_All|RR_Reflect_All;
-
- for (n = 0; n < pScreen->numDepths; n++)
- if (pScreen->allowedDepths[n].numVids)
- break;
- if (n == pScreen->numDepths)
- return FALSE;
-
- pSize = RRRegisterSize (pScreen,
- screen->width,
- screen->height,
- screen->width_mm,
- screen->height_mm);
-
- randr = KdSubRotation (scrpriv->randr, screen->randr);
-
- RRSetCurrentConfig (pScreen, randr, 0, pSize);
-
- return TRUE;
-}
-
-Bool
-fakeRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize)
-{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FakeScrPriv *scrpriv = screen->driver;
- Bool wasEnabled = pScreenPriv->enabled;
- FakeScrPriv oldscr;
- int oldwidth;
- int oldheight;
- int oldmmwidth;
- int oldmmheight;
- int newwidth, newheight;
-
- if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- newwidth = pSize->width;
- newheight = pSize->height;
- }
- else
- {
- newwidth = pSize->height;
- newheight = pSize->width;
- }
-
- if (wasEnabled)
- KdDisableScreen (pScreen);
-
- oldscr = *scrpriv;
-
- oldwidth = screen->width;
- oldheight = screen->height;
- oldmmwidth = pScreen->mmWidth;
- oldmmheight = pScreen->mmHeight;
-
- /*
- * Set new configuration
- */
-
- scrpriv->randr = KdAddRotation (screen->randr, randr);
-
- fakeUnmapFramebuffer (screen);
-
- if (!fakeMapFramebuffer (screen))
- goto bail4;
-
- KdShadowUnset (screen->pScreen);
-
- if (!fakeSetShadow (screen->pScreen))
- goto bail4;
-
- fakeSetScreenSizes (screen->pScreen);
-
- /*
- * Set frame buffer mapping
- */
- (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
- pScreen->width,
- pScreen->height,
- screen->fb.depth,
- screen->fb.bitsPerPixel,
- screen->fb.byteStride,
- screen->fb.frameBuffer);
-
- /* set the subpixel order */
-
- KdSetSubpixelOrder (pScreen, scrpriv->randr);
- if (wasEnabled)
- KdEnableScreen (pScreen);
-
- return TRUE;
-
-bail4:
- fakeUnmapFramebuffer (screen);
- *scrpriv = oldscr;
- (void) fakeMapFramebuffer (screen);
- pScreen->width = oldwidth;
- pScreen->height = oldheight;
- pScreen->mmWidth = oldmmwidth;
- pScreen->mmHeight = oldmmheight;
-
- if (wasEnabled)
- KdEnableScreen (pScreen);
- return FALSE;
-}
-
-Bool
-fakeRandRInit (ScreenPtr pScreen)
-{
- rrScrPrivPtr pScrPriv;
-
- if (!RRScreenInit (pScreen))
- return FALSE;
-
- pScrPriv = rrGetScrPriv(pScreen);
- pScrPriv->rrGetInfo = fakeRandRGetInfo;
- pScrPriv->rrSetConfig = fakeRandRSetConfig;
- return TRUE;
-}
-#endif
-
-Bool
-fakeCreateColormap (ColormapPtr pmap)
-{
- return fbInitializeColormap (pmap);
-}
-
-Bool
-fakeInitScreen (ScreenPtr pScreen)
-{
-#ifdef TOUCHSCREEN
- KdTsPhyScreen = pScreen->myNum;
-#endif
-
- pScreen->CreateColormap = fakeCreateColormap;
- return TRUE;
-}
-
-Bool
-fakeFinishInitScreen (ScreenPtr pScreen)
-{
- if (!shadowSetup (pScreen))
- return FALSE;
-
-#ifdef RANDR
- if (!fakeRandRInit (pScreen))
- return FALSE;
-#endif
-
- return TRUE;
-}
-
-
-Bool
-fakeCreateResources (ScreenPtr pScreen)
-{
- return fakeSetShadow (pScreen);
-}
-
-void
-fakePreserve (KdCardInfo *card)
-{
-}
-
-Bool
-fakeEnable (ScreenPtr pScreen)
-{
- return TRUE;
-}
-
-Bool
-fakeDPMS (ScreenPtr pScreen, int mode)
-{
- return TRUE;
-}
-
-void
-fakeDisable (ScreenPtr pScreen)
-{
-}
-
-void
-fakeRestore (KdCardInfo *card)
-{
-}
-
-void
-fakeScreenFini (KdScreenInfo *screen)
-{
-}
-
-void
-fakeCardFini (KdCardInfo *card)
-{
- FakePriv *priv = card->driver;
-
- free (priv->base);
- free(priv);
-}
-
-void
-fakeGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
-{
- while (n--)
- {
- pdefs->red = 0;
- pdefs->green = 0;
- pdefs->blue = 0;
- pdefs++;
- }
-}
-
-void
-fakePutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
-{
-}
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "fake.h"
+
+extern int KdTsPhyScreen;
+
+Bool
+fakeInitialize(KdCardInfo * card, FakePriv * priv)
+{
+ priv->base = 0;
+ priv->bytes_per_line = 0;
+ return TRUE;
+}
+
+Bool
+fakeCardInit(KdCardInfo * card)
+{
+ FakePriv *priv;
+
+ priv = (FakePriv *) malloc(sizeof(FakePriv));
+ if (!priv)
+ return FALSE;
+
+ if (!fakeInitialize(card, priv)) {
+ free(priv);
+ return FALSE;
+ }
+ card->driver = priv;
+
+ return TRUE;
+}
+
+Bool
+fakeScreenInitialize(KdScreenInfo * screen, FakeScrPriv * scrpriv)
+{
+ if (!screen->width || !screen->height) {
+ screen->width = 1024;
+ screen->height = 768;
+ screen->rate = 72;
+ }
+
+ if (screen->width <= 0)
+ screen->width = 1;
+ if (screen->height <= 0)
+ screen->height = 1;
+
+ if (!screen->fb.depth)
+ screen->fb.depth = 16;
+
+ if (screen->fb.depth <= 8) {
+ screen->fb.visuals = ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) | (1 << DirectColor));
+ }
+ else {
+ screen->fb.visuals = (1 << TrueColor);
+#define Mask(o,l) (((1 << l) - 1) << o)
+ if (screen->fb.depth <= 15) {
+ screen->fb.depth = 15;
+ screen->fb.bitsPerPixel = 16;
+ screen->fb.redMask = Mask (10, 5);
+ screen->fb.greenMask = Mask (5, 5);
+ screen->fb.blueMask = Mask (0, 5);
+ }
+ else if (screen->fb.depth <= 16) {
+ screen->fb.depth = 16;
+ screen->fb.bitsPerPixel = 16;
+ screen->fb.redMask = Mask (11, 5);
+ screen->fb.greenMask = Mask (5, 6);
+ screen->fb.blueMask = Mask (0, 5);
+ }
+ else {
+ screen->fb.depth = 24;
+ screen->fb.bitsPerPixel = 32;
+ screen->fb.redMask = Mask (16, 8);
+ screen->fb.greenMask = Mask (8, 8);
+ screen->fb.blueMask = Mask (0, 8);
+ }
+ }
+
+ scrpriv->randr = screen->randr;
+
+ return fakeMapFramebuffer(screen);
+}
+
+Bool
+fakeScreenInit(KdScreenInfo * screen)
+{
+ FakeScrPriv *scrpriv;
+
+ scrpriv = calloc(1, sizeof(FakeScrPriv));
+ if (!scrpriv)
+ return FALSE;
+ screen->driver = scrpriv;
+ if (!fakeScreenInitialize(screen, scrpriv)) {
+ screen->driver = 0;
+ free(scrpriv);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void *
+fakeWindowLinear(ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset, int mode, CARD32 *size, void *closure)
+{
+ KdScreenPriv(pScreen);
+ FakePriv *priv = pScreenPriv->card->driver;
+
+ if (!pScreenPriv->enabled)
+ return 0;
+ *size = priv->bytes_per_line;
+ return priv->base + row * priv->bytes_per_line;
+}
+
+Bool
+fakeMapFramebuffer(KdScreenInfo * screen)
+{
+ FakeScrPriv *scrpriv = screen->driver;
+ KdPointerMatrix m;
+ FakePriv *priv = screen->card->driver;
+
+ if (scrpriv->randr != RR_Rotate_0)
+ scrpriv->shadow = TRUE;
+ else
+ scrpriv->shadow = FALSE;
+
+ KdComputePointerMatrix(&m, scrpriv->randr, screen->width, screen->height);
+
+ KdSetPointerMatrix(&m);
+
+ priv->bytes_per_line =
+ ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
+ free(priv->base);
+ priv->base = malloc(priv->bytes_per_line * screen->height);
+
+ if (scrpriv->shadow) {
+ if (!KdShadowFbAlloc
+ (screen, scrpriv->randr & (RR_Rotate_90 | RR_Rotate_270)))
+ return FALSE;
+ }
+ else {
+ screen->fb.byteStride = priv->bytes_per_line;
+ screen->fb.pixelStride = (priv->bytes_per_line * 8 /
+ screen->fb.bitsPerPixel);
+ screen->fb.frameBuffer = (CARD8 *) (priv->base);
+ }
+
+ return TRUE;
+}
+
+void
+fakeSetScreenSizes(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FakeScrPriv *scrpriv = screen->driver;
+
+ if (scrpriv->randr & (RR_Rotate_0 | RR_Rotate_180)) {
+ pScreen->width = screen->width;
+ pScreen->height = screen->height;
+ pScreen->mmWidth = screen->width_mm;
+ pScreen->mmHeight = screen->height_mm;
+ }
+ else {
+ pScreen->width = screen->width;
+ pScreen->height = screen->height;
+ pScreen->mmWidth = screen->height_mm;
+ pScreen->mmHeight = screen->width_mm;
+ }
+}
+
+Bool
+fakeUnmapFramebuffer(KdScreenInfo * screen)
+{
+ FakePriv *priv = screen->card->driver;
+
+ KdShadowFbFree(screen);
+ free(priv->base);
+ priv->base = NULL;
+ return TRUE;
+}
+
+Bool
+fakeSetShadow(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FakeScrPriv *scrpriv = screen->driver;
+ ShadowUpdateProc update;
+ ShadowWindowProc window;
+
+ window = fakeWindowLinear;
+ update = 0;
+ if (scrpriv->randr)
+ update = shadowUpdateRotatePacked;
+ else
+ update = shadowUpdatePacked;
+ return KdShadowSet(pScreen, scrpriv->randr, update, window);
+}
+
+#ifdef RANDR
+Bool
+fakeRandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FakeScrPriv *scrpriv = screen->driver;
+ RRScreenSizePtr pSize;
+ Rotation randr;
+ int n;
+
+ *rotations = RR_Rotate_All | RR_Reflect_All;
+
+ for (n = 0; n < pScreen->numDepths; n++)
+ if (pScreen->allowedDepths[n].numVids)
+ break;
+ if (n == pScreen->numDepths)
+ return FALSE;
+
+ pSize = RRRegisterSize(pScreen,
+ screen->width,
+ screen->height, screen->width_mm, screen->height_mm);
+
+ randr = KdSubRotation(scrpriv->randr, screen->randr);
+
+ RRSetCurrentConfig(pScreen, randr, 0, pSize);
+
+ return TRUE;
+}
+
+Bool
+fakeRandRSetConfig(ScreenPtr pScreen,
+ Rotation randr, int rate, RRScreenSizePtr pSize)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FakeScrPriv *scrpriv = screen->driver;
+ Bool wasEnabled = pScreenPriv->enabled;
+ FakeScrPriv oldscr;
+ int oldwidth;
+ int oldheight;
+ int oldmmwidth;
+ int oldmmheight;
+ int newwidth, newheight;
+
+ if (screen->randr & (RR_Rotate_0 | RR_Rotate_180)) {
+ newwidth = pSize->width;
+ newheight = pSize->height;
+ }
+ else {
+ newwidth = pSize->height;
+ newheight = pSize->width;
+ }
+
+ if (wasEnabled)
+ KdDisableScreen(pScreen);
+
+ oldscr = *scrpriv;
+
+ oldwidth = screen->width;
+ oldheight = screen->height;
+ oldmmwidth = pScreen->mmWidth;
+ oldmmheight = pScreen->mmHeight;
+
+ /*
+ * Set new configuration
+ */
+
+ scrpriv->randr = KdAddRotation(screen->randr, randr);
+
+ fakeUnmapFramebuffer(screen);
+
+ if (!fakeMapFramebuffer(screen))
+ goto bail4;
+
+ KdShadowUnset(screen->pScreen);
+
+ if (!fakeSetShadow(screen->pScreen))
+ goto bail4;
+
+ fakeSetScreenSizes(screen->pScreen);
+
+ /*
+ * Set frame buffer mapping
+ */
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap(pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb.depth,
+ screen->fb.bitsPerPixel,
+ screen->fb.byteStride,
+ screen->fb.frameBuffer);
+
+ /* set the subpixel order */
+
+ KdSetSubpixelOrder(pScreen, scrpriv->randr);
+ if (wasEnabled)
+ KdEnableScreen(pScreen);
+
+ return TRUE;
+
+ bail4:
+ fakeUnmapFramebuffer(screen);
+ *scrpriv = oldscr;
+ (void) fakeMapFramebuffer(screen);
+ pScreen->width = oldwidth;
+ pScreen->height = oldheight;
+ pScreen->mmWidth = oldmmwidth;
+ pScreen->mmHeight = oldmmheight;
+
+ if (wasEnabled)
+ KdEnableScreen(pScreen);
+ return FALSE;
+}
+
+Bool
+fakeRandRInit(ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit(pScreen))
+ return FALSE;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = fakeRandRGetInfo;
+ pScrPriv->rrSetConfig = fakeRandRSetConfig;
+ return TRUE;
+}
+#endif
+
+Bool
+fakeCreateColormap(ColormapPtr pmap)
+{
+ return fbInitializeColormap(pmap);
+}
+
+Bool
+fakeInitScreen(ScreenPtr pScreen)
+{
+#ifdef TOUCHSCREEN
+ KdTsPhyScreen = pScreen->myNum;
+#endif
+
+ pScreen->CreateColormap = fakeCreateColormap;
+ return TRUE;
+}
+
+Bool
+fakeFinishInitScreen(ScreenPtr pScreen)
+{
+ if (!shadowSetup(pScreen))
+ return FALSE;
+
+#ifdef RANDR
+ if (!fakeRandRInit(pScreen))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+Bool
+fakeCreateResources(ScreenPtr pScreen)
+{
+ return fakeSetShadow(pScreen);
+}
+
+void
+fakePreserve(KdCardInfo * card)
+{
+}
+
+Bool
+fakeEnable(ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+Bool
+fakeDPMS(ScreenPtr pScreen, int mode)
+{
+ return TRUE;
+}
+
+void
+fakeDisable(ScreenPtr pScreen)
+{
+}
+
+void
+fakeRestore(KdCardInfo * card)
+{
+}
+
+void
+fakeScreenFini(KdScreenInfo * screen)
+{
+}
+
+void
+fakeCardFini(KdCardInfo * card)
+{
+ FakePriv *priv = card->driver;
+
+ free(priv->base);
+ free(priv);
+}
+
+void
+fakeGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
+{
+ while (n--) {
+ pdefs->red = 0;
+ pdefs->green = 0;
+ pdefs->blue = 0;
+ pdefs++;
+ }
+}
+
+void
+fakePutColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
+{
+}
diff --git a/xorg-server/hw/kdrive/fake/fake.h b/xorg-server/hw/kdrive/fake/fake.h
index d5058606a..ae33fc6d0 100644
--- a/xorg-server/hw/kdrive/fake/fake.h
+++ b/xorg-server/hw/kdrive/fake/fake.h
@@ -31,106 +31,101 @@
#endif
typedef struct _fakePriv {
- CARD8 *base;
- int bytes_per_line;
+ CARD8 *base;
+ int bytes_per_line;
} FakePriv;
-
+
typedef struct _fakeScrPriv {
- Rotation randr;
- Bool shadow;
+ Rotation randr;
+ Bool shadow;
} FakeScrPriv;
-extern KdCardFuncs fakeFuncs;
+extern KdCardFuncs fakeFuncs;
Bool
-fakeInitialize (KdCardInfo *card, FakePriv *priv);
+ fakeInitialize(KdCardInfo * card, FakePriv * priv);
Bool
-fakeCardInit (KdCardInfo *card);
+ fakeCardInit(KdCardInfo * card);
Bool
-fakeScreenInit (KdScreenInfo *screen);
+ fakeScreenInit(KdScreenInfo * screen);
Bool
-fakeScreenInitialize (KdScreenInfo *screen, FakeScrPriv *scrpriv);
-
+ fakeScreenInitialize(KdScreenInfo * screen, FakeScrPriv * scrpriv);
+
Bool
-fakeInitScreen (ScreenPtr pScreen);
+ fakeInitScreen(ScreenPtr pScreen);
Bool
-fakeFinishInitScreen (ScreenPtr pScreen);
+ fakeFinishInitScreen(ScreenPtr pScreen);
Bool
-fakeCreateResources (ScreenPtr pScreen);
+ fakeCreateResources(ScreenPtr pScreen);
void
-fakePreserve (KdCardInfo *card);
+ fakePreserve(KdCardInfo * card);
Bool
-fakeEnable (ScreenPtr pScreen);
+ fakeEnable(ScreenPtr pScreen);
Bool
-fakeDPMS (ScreenPtr pScreen, int mode);
+ fakeDPMS(ScreenPtr pScreen, int mode);
void
-fakeDisable (ScreenPtr pScreen);
+ fakeDisable(ScreenPtr pScreen);
void
-fakeRestore (KdCardInfo *card);
+ fakeRestore(KdCardInfo * card);
void
-fakeScreenFini (KdScreenInfo *screen);
+ fakeScreenFini(KdScreenInfo * screen);
void
-fakeCardFini (KdCardInfo *card);
+ fakeCardFini(KdCardInfo * card);
void
-fakeGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
+ fakeGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs);
void
-fakePutColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
+ fakePutColors(ScreenPtr pScreen, int n, xColorItem * pdefs);
Bool
-fakeMapFramebuffer (KdScreenInfo *screen);
+ fakeMapFramebuffer(KdScreenInfo * screen);
-void *
-fakeWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure);
+void *fakeWindowLinear(ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset, int mode, CARD32 *size, void *closure);
void
-fakeSetScreenSizes (ScreenPtr pScreen);
+ fakeSetScreenSizes(ScreenPtr pScreen);
Bool
-fakeUnmapFramebuffer (KdScreenInfo *screen);
+ fakeUnmapFramebuffer(KdScreenInfo * screen);
Bool
-fakeSetShadow (ScreenPtr pScreen);
+ fakeSetShadow(ScreenPtr pScreen);
Bool
-fakeCreateColormap (ColormapPtr pmap);
-
+ fakeCreateColormap(ColormapPtr pmap);
+
#ifdef RANDR
Bool
-fakeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
+ fakeRandRGetInfo(ScreenPtr pScreen, Rotation * rotations);
Bool
-fakeRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize);
+
+fakeRandRSetConfig(ScreenPtr pScreen,
+ Rotation randr, int rate, RRScreenSizePtr pSize);
Bool
-fakeRandRInit (ScreenPtr pScreen);
+ fakeRandRInit(ScreenPtr pScreen);
#endif
extern KdPointerDriver FakePointerDriver;
-extern KdKeyboardDriver FakeKeyboardDriver;
+extern KdKeyboardDriver FakeKeyboardDriver;
-extern KdOsFuncs FakeOsFuncs;
+extern KdOsFuncs FakeOsFuncs;
-#endif /* _FBDEV_H_ */
+#endif /* _FBDEV_H_ */
diff --git a/xorg-server/hw/kdrive/fbdev/fbdev.c b/xorg-server/hw/kdrive/fbdev/fbdev.c
index 661e5b491..fd14afa92 100644
--- a/xorg-server/hw/kdrive/fbdev/fbdev.c
+++ b/xorg-server/hw/kdrive/fbdev/fbdev.c
@@ -33,46 +33,43 @@ extern int KdTsPhyScreen;
char *fbdevDevicePath = NULL;
static Bool
-fbdevInitialize (KdCardInfo *card, FbdevPriv *priv)
+fbdevInitialize(KdCardInfo * card, FbdevPriv * priv)
{
- unsigned long off;
+ unsigned long off;
if (fbdevDevicePath == NULL)
- fbdevDevicePath = "/dev/fb0";
+ fbdevDevicePath = "/dev/fb0";
- if ((priv->fd = open(fbdevDevicePath, O_RDWR)) < 0)
- {
- ErrorF("Error opening framebuffer %s: %s\n",
- fbdevDevicePath, strerror(errno));
+ if ((priv->fd = open(fbdevDevicePath, O_RDWR)) < 0) {
+ ErrorF("Error opening framebuffer %s: %s\n",
+ fbdevDevicePath, strerror(errno));
return FALSE;
- }
+ }
/* quiet valgrind */
- memset (&priv->fix, '\0', sizeof (priv->fix));
+ memset(&priv->fix, '\0', sizeof(priv->fix));
if (ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix) < 0) {
- perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO");
- close (priv->fd);
- return FALSE;
+ perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO");
+ close(priv->fd);
+ return FALSE;
}
/* quiet valgrind */
- memset (&priv->var, '\0', sizeof (priv->var));
+ memset(&priv->var, '\0', sizeof(priv->var));
if (ioctl(priv->fd, FBIOGET_VSCREENINFO, &priv->var) < 0) {
- perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO");
- close (priv->fd);
- return FALSE;
+ perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO");
+ close(priv->fd);
+ return FALSE;
}
- priv->fb_base = (char *) mmap ((caddr_t) NULL,
- priv->fix.smem_len,
- PROT_READ|PROT_WRITE,
- MAP_SHARED,
- priv->fd, 0);
+ priv->fb_base = (char *) mmap((caddr_t) NULL,
+ priv->fix.smem_len,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, priv->fd, 0);
- if (priv->fb_base == (char *)-1)
- {
+ if (priv->fb_base == (char *) -1) {
perror("ERROR: mmap framebuffer fails!");
- close (priv->fd);
- return FALSE;
+ close(priv->fd);
+ return FALSE;
}
off = (unsigned long) priv->fix.smem_start % (unsigned long) getpagesize();
priv->fb = priv->fb_base + off;
@@ -80,18 +77,17 @@ fbdevInitialize (KdCardInfo *card, FbdevPriv *priv)
}
Bool
-fbdevCardInit (KdCardInfo *card)
+fbdevCardInit(KdCardInfo * card)
{
- FbdevPriv *priv;
+ FbdevPriv *priv;
- priv = (FbdevPriv *) malloc(sizeof (FbdevPriv));
+ priv = (FbdevPriv *) malloc(sizeof(FbdevPriv));
if (!priv)
- return FALSE;
+ return FALSE;
- if (!fbdevInitialize (card, priv))
- {
- free(priv);
- return FALSE;
+ if (!fbdevInitialize(card, priv)) {
+ free(priv);
+ return FALSE;
}
card->driver = priv;
@@ -99,30 +95,29 @@ fbdevCardInit (KdCardInfo *card)
}
static Pixel
-fbdevMakeContig (Pixel orig, Pixel others)
+fbdevMakeContig(Pixel orig, Pixel others)
{
- Pixel low;
+ Pixel low;
- low = lowbit (orig) >> 1;
- while (low && (others & low) == 0)
- {
- orig |= low;
- low >>= 1;
+ low = lowbit(orig) >> 1;
+ while (low && (others & low) == 0) {
+ orig |= low;
+ low >>= 1;
}
return orig;
}
static Bool
-fbdevModeSupported (KdScreenInfo *screen,
- const KdMonitorTiming *t)
+fbdevModeSupported(KdScreenInfo * screen, const KdMonitorTiming * t)
{
return TRUE;
}
static void
-fbdevConvertMonitorTiming (const KdMonitorTiming *t, struct fb_var_screeninfo *var)
+fbdevConvertMonitorTiming(const KdMonitorTiming * t,
+ struct fb_var_screeninfo *var)
{
- memset (var, 0, sizeof (struct fb_var_screeninfo));
+ memset(var, 0, sizeof(struct fb_var_screeninfo));
var->xres = t->horizontal;
var->yres = t->vertical;
@@ -142,56 +137,51 @@ fbdevConvertMonitorTiming (const KdMonitorTiming *t, struct fb_var_screeninfo *v
var->vmode = 0;
if (t->hpol == KdSyncPositive)
- var->sync |= FB_SYNC_HOR_HIGH_ACT;
+ var->sync |= FB_SYNC_HOR_HIGH_ACT;
if (t->vpol == KdSyncPositive)
- var->sync |= FB_SYNC_VERT_HIGH_ACT;
+ var->sync |= FB_SYNC_VERT_HIGH_ACT;
}
static Bool
-fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
+fbdevScreenInitialize(KdScreenInfo * screen, FbdevScrPriv * scrpriv)
{
- FbdevPriv *priv = screen->card->driver;
- Pixel allbits;
- int depth;
- Bool gray;
+ FbdevPriv *priv = screen->card->driver;
+ Pixel allbits;
+ int depth;
+ Bool gray;
struct fb_var_screeninfo var;
const KdMonitorTiming *t;
int k;
- k = ioctl (priv->fd, FBIOGET_VSCREENINFO, &var);
-
- if (!screen->width || !screen->height)
- {
- if (k >= 0)
- {
- screen->width = var.xres;
- screen->height = var.yres;
- }
- else
- {
- screen->width = 1024;
- screen->height = 768;
- }
- screen->rate = 103; /* FIXME: should get proper value from fb driver */
+ k = ioctl(priv->fd, FBIOGET_VSCREENINFO, &var);
+
+ if (!screen->width || !screen->height) {
+ if (k >= 0) {
+ screen->width = var.xres;
+ screen->height = var.yres;
+ }
+ else {
+ screen->width = 1024;
+ screen->height = 768;
+ }
+ screen->rate = 103; /* FIXME: should get proper value from fb driver */
}
- if (!screen->fb.depth)
- {
- if (k >= 0)
- screen->fb.depth = var.bits_per_pixel;
- else
- screen->fb.depth = 16;
+ if (!screen->fb.depth) {
+ if (k >= 0)
+ screen->fb.depth = var.bits_per_pixel;
+ else
+ screen->fb.depth = 16;
}
- if ((screen->width != var.xres) || (screen->height != var.yres))
- {
- t = KdFindMode (screen, fbdevModeSupported);
- screen->rate = t->rate;
- screen->width = t->horizontal;
- screen->height = t->vertical;
+ if ((screen->width != var.xres) || (screen->height != var.yres)) {
+ t = KdFindMode(screen, fbdevModeSupported);
+ screen->rate = t->rate;
+ screen->width = t->horizontal;
+ screen->height = t->vertical;
- /* Now try setting the mode */
- if (k < 0 || (t->horizontal != var.xres || t->vertical != var.yres))
- fbdevConvertMonitorTiming (t, &var);
+ /* Now try setting the mode */
+ if (k < 0 || (t->horizontal != var.xres || t->vertical != var.yres))
+ fbdevConvertMonitorTiming(t, &var);
}
var.activate = FB_ACTIVATE_NOW;
@@ -199,163 +189,154 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
var.nonstd = 0;
var.grayscale = 0;
- k = ioctl (priv->fd, FBIOPUT_VSCREENINFO, &var);
+ k = ioctl(priv->fd, FBIOPUT_VSCREENINFO, &var);
- if (k < 0)
- {
- fprintf (stderr, "error: %s\n", strerror (errno));
- return FALSE;
+ if (k < 0) {
+ fprintf(stderr, "error: %s\n", strerror(errno));
+ return FALSE;
}
/* Re-get the "fixed" parameters since they might have changed */
- k = ioctl (priv->fd, FBIOGET_FSCREENINFO, &priv->fix);
+ k = ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix);
if (k < 0)
- perror ("FBIOGET_FSCREENINFO");
+ perror("FBIOGET_FSCREENINFO");
/* Now get the new screeninfo */
- ioctl (priv->fd, FBIOGET_VSCREENINFO, &priv->var);
+ ioctl(priv->fd, FBIOGET_VSCREENINFO, &priv->var);
depth = priv->var.bits_per_pixel;
gray = priv->var.grayscale;
switch (priv->fix.visual) {
case FB_VISUAL_PSEUDOCOLOR:
- if (gray)
- {
- screen->fb.visuals = (1 << StaticGray);
- /* could also support GrayScale, but what's the point? */
- }
- else
- {
- screen->fb.visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- }
- screen->fb.blueMask = 0x00;
- screen->fb.greenMask = 0x00;
- screen->fb.redMask = 0x00;
- break;
+ if (gray) {
+ screen->fb.visuals = (1 << StaticGray);
+ /* could also support GrayScale, but what's the point? */
+ }
+ else {
+ screen->fb.visuals = ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) | (1 << DirectColor));
+ }
+ screen->fb.blueMask = 0x00;
+ screen->fb.greenMask = 0x00;
+ screen->fb.redMask = 0x00;
+ break;
case FB_VISUAL_STATIC_PSEUDOCOLOR:
- if (gray)
- {
- screen->fb.visuals = (1 << StaticGray);
- }
- else
- {
- screen->fb.visuals = (1 << StaticColor);
- }
- screen->fb.blueMask = 0x00;
- screen->fb.greenMask = 0x00;
- screen->fb.redMask = 0x00;
- break;
+ if (gray) {
+ screen->fb.visuals = (1 << StaticGray);
+ }
+ else {
+ screen->fb.visuals = (1 << StaticColor);
+ }
+ screen->fb.blueMask = 0x00;
+ screen->fb.greenMask = 0x00;
+ screen->fb.redMask = 0x00;
+ break;
case FB_VISUAL_TRUECOLOR:
case FB_VISUAL_DIRECTCOLOR:
- screen->fb.visuals = (1 << TrueColor);
+ screen->fb.visuals = (1 << TrueColor);
#define Mask(o,l) (((1 << l) - 1) << o)
- screen->fb.redMask = Mask (priv->var.red.offset, priv->var.red.length);
- screen->fb.greenMask = Mask (priv->var.green.offset, priv->var.green.length);
- screen->fb.blueMask = Mask (priv->var.blue.offset, priv->var.blue.length);
-
- /*
- * This is a kludge so that Render will work -- fill in the gaps
- * in the pixel
- */
- screen->fb.redMask = fbdevMakeContig (screen->fb.redMask,
- screen->fb.greenMask|
- screen->fb.blueMask);
-
- screen->fb.greenMask = fbdevMakeContig (screen->fb.greenMask,
- screen->fb.redMask|
- screen->fb.blueMask);
-
- screen->fb.blueMask = fbdevMakeContig (screen->fb.blueMask,
- screen->fb.redMask|
- screen->fb.greenMask);
-
- allbits = screen->fb.redMask | screen->fb.greenMask | screen->fb.blueMask;
- depth = 32;
- while (depth && !(allbits & (1 << (depth - 1))))
- depth--;
- break;
+ screen->fb.redMask = Mask (priv->var.red.offset, priv->var.red.length);
+ screen->fb.greenMask =
+ Mask (priv->var.green.offset, priv->var.green.length);
+ screen->fb.blueMask =
+ Mask (priv->var.blue.offset, priv->var.blue.length);
+
+ /*
+ * This is a kludge so that Render will work -- fill in the gaps
+ * in the pixel
+ */
+ screen->fb.redMask = fbdevMakeContig(screen->fb.redMask,
+ screen->fb.greenMask |
+ screen->fb.blueMask);
+
+ screen->fb.greenMask = fbdevMakeContig(screen->fb.greenMask,
+ screen->fb.redMask |
+ screen->fb.blueMask);
+
+ screen->fb.blueMask = fbdevMakeContig(screen->fb.blueMask,
+ screen->fb.redMask |
+ screen->fb.greenMask);
+
+ allbits =
+ screen->fb.redMask | screen->fb.greenMask | screen->fb.blueMask;
+ depth = 32;
+ while (depth && !(allbits & (1 << (depth - 1))))
+ depth--;
+ break;
default:
- return FALSE;
- break;
+ return FALSE;
+ break;
}
screen->fb.depth = depth;
screen->fb.bitsPerPixel = priv->var.bits_per_pixel;
scrpriv->randr = screen->randr;
- return fbdevMapFramebuffer (screen);
+ return fbdevMapFramebuffer(screen);
}
Bool
-fbdevScreenInit (KdScreenInfo *screen)
+fbdevScreenInit(KdScreenInfo * screen)
{
FbdevScrPriv *scrpriv;
- scrpriv = calloc(1, sizeof (FbdevScrPriv));
+ scrpriv = calloc(1, sizeof(FbdevScrPriv));
if (!scrpriv)
- return FALSE;
+ return FALSE;
screen->driver = scrpriv;
- if (!fbdevScreenInitialize (screen, scrpriv))
- {
- screen->driver = 0;
- free(scrpriv);
- return FALSE;
+ if (!fbdevScreenInitialize(screen, scrpriv)) {
+ screen->driver = 0;
+ free(scrpriv);
+ return FALSE;
}
return TRUE;
}
static void *
-fbdevWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure)
+fbdevWindowLinear(ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset, int mode, CARD32 *size, void *closure)
{
KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
+ FbdevPriv *priv = pScreenPriv->card->driver;
if (!pScreenPriv->enabled)
- return 0;
+ return 0;
*size = priv->fix.line_length;
return (CARD8 *) priv->fb + row * priv->fix.line_length + offset;
}
Bool
-fbdevMapFramebuffer (KdScreenInfo *screen)
+fbdevMapFramebuffer(KdScreenInfo * screen)
{
- FbdevScrPriv *scrpriv = screen->driver;
- KdPointerMatrix m;
- FbdevPriv *priv = screen->card->driver;
+ FbdevScrPriv *scrpriv = screen->driver;
+ KdPointerMatrix m;
+ FbdevPriv *priv = screen->card->driver;
if (scrpriv->randr != RR_Rotate_0)
- scrpriv->shadow = TRUE;
+ scrpriv->shadow = TRUE;
else
- scrpriv->shadow = FALSE;
+ scrpriv->shadow = FALSE;
- KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
+ KdComputePointerMatrix(&m, scrpriv->randr, screen->width, screen->height);
- KdSetPointerMatrix (&m);
+ KdSetPointerMatrix(&m);
screen->width = priv->var.xres;
screen->height = priv->var.yres;
- if (scrpriv->shadow)
- {
- if (!KdShadowFbAlloc (screen,
- scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
- return FALSE;
+ if (scrpriv->shadow) {
+ if (!KdShadowFbAlloc(screen,
+ scrpriv->randr & (RR_Rotate_90 | RR_Rotate_270)))
+ return FALSE;
}
- else
- {
+ else {
screen->fb.byteStride = priv->fix.line_length;
screen->fb.pixelStride = (priv->fix.line_length * 8 /
- priv->var.bits_per_pixel);
+ priv->var.bits_per_pixel);
screen->fb.frameBuffer = (CARD8 *) (priv->fb);
}
@@ -363,46 +344,44 @@ fbdevMapFramebuffer (KdScreenInfo *screen)
}
static void
-fbdevSetScreenSizes (ScreenPtr pScreen)
+fbdevSetScreenSizes(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FbdevScrPriv *scrpriv = screen->driver;
- FbdevPriv *priv = screen->card->driver;
-
- if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- pScreen->width = priv->var.xres;
- pScreen->height = priv->var.yres;
- pScreen->mmWidth = screen->width_mm;
- pScreen->mmHeight = screen->height_mm;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FbdevScrPriv *scrpriv = screen->driver;
+ FbdevPriv *priv = screen->card->driver;
+
+ if (scrpriv->randr & (RR_Rotate_0 | RR_Rotate_180)) {
+ pScreen->width = priv->var.xres;
+ pScreen->height = priv->var.yres;
+ pScreen->mmWidth = screen->width_mm;
+ pScreen->mmHeight = screen->height_mm;
}
- else
- {
- pScreen->width = priv->var.yres;
- pScreen->height = priv->var.xres;
- pScreen->mmWidth = screen->height_mm;
- pScreen->mmHeight = screen->width_mm;
+ else {
+ pScreen->width = priv->var.yres;
+ pScreen->height = priv->var.xres;
+ pScreen->mmWidth = screen->height_mm;
+ pScreen->mmHeight = screen->width_mm;
}
}
static Bool
-fbdevUnmapFramebuffer (KdScreenInfo *screen)
+fbdevUnmapFramebuffer(KdScreenInfo * screen)
{
- KdShadowFbFree (screen);
+ KdShadowFbFree(screen);
return TRUE;
}
static Bool
-fbdevSetShadow (ScreenPtr pScreen)
+fbdevSetShadow(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FbdevScrPriv *scrpriv = screen->driver;
- FbdevPriv *priv = screen->card->driver;
- ShadowUpdateProc update;
- ShadowWindowProc window;
- int useYX = 0;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FbdevScrPriv *scrpriv = screen->driver;
+ FbdevPriv *priv = screen->card->driver;
+ ShadowUpdateProc update;
+ ShadowWindowProc window;
+ int useYX = 0;
#ifdef __arm__
/* Use variant copy routines that always read left to right in the
@@ -414,97 +393,91 @@ fbdevSetShadow (ScreenPtr pScreen)
window = fbdevWindowLinear;
update = 0;
if (scrpriv->randr)
- if (priv->var.bits_per_pixel == 16) {
- switch (scrpriv->randr) {
- case RR_Rotate_90:
- if (useYX)
- update = shadowUpdateRotate16_90YX;
- else
- update = shadowUpdateRotate16_90;
- break;
- case RR_Rotate_180:
- update = shadowUpdateRotate16_180;
- break;
- case RR_Rotate_270:
- if (useYX)
- update = shadowUpdateRotate16_270YX;
- else
- update = shadowUpdateRotate16_270;
- break;
- default:
- update = shadowUpdateRotate16;
- break;
- }
- } else
- update = shadowUpdateRotatePacked;
+ if (priv->var.bits_per_pixel == 16) {
+ switch (scrpriv->randr) {
+ case RR_Rotate_90:
+ if (useYX)
+ update = shadowUpdateRotate16_90YX;
+ else
+ update = shadowUpdateRotate16_90;
+ break;
+ case RR_Rotate_180:
+ update = shadowUpdateRotate16_180;
+ break;
+ case RR_Rotate_270:
+ if (useYX)
+ update = shadowUpdateRotate16_270YX;
+ else
+ update = shadowUpdateRotate16_270;
+ break;
+ default:
+ update = shadowUpdateRotate16;
+ break;
+ }
+ }
+ else
+ update = shadowUpdateRotatePacked;
else
- update = shadowUpdatePacked;
- return KdShadowSet (pScreen, scrpriv->randr, update, window);
+ update = shadowUpdatePacked;
+ return KdShadowSet(pScreen, scrpriv->randr, update, window);
}
-
#ifdef RANDR
static Bool
-fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
+fbdevRandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
{
KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FbdevScrPriv *scrpriv = screen->driver;
- RRScreenSizePtr pSize;
- Rotation randr;
- int n;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FbdevScrPriv *scrpriv = screen->driver;
+ RRScreenSizePtr pSize;
+ Rotation randr;
+ int n;
- *rotations = RR_Rotate_All|RR_Reflect_All;
+ *rotations = RR_Rotate_All | RR_Reflect_All;
for (n = 0; n < pScreen->numDepths; n++)
- if (pScreen->allowedDepths[n].numVids)
- break;
+ if (pScreen->allowedDepths[n].numVids)
+ break;
if (n == pScreen->numDepths)
- return FALSE;
+ return FALSE;
- pSize = RRRegisterSize (pScreen,
- screen->width,
- screen->height,
- screen->width_mm,
- screen->height_mm);
+ pSize = RRRegisterSize(pScreen,
+ screen->width,
+ screen->height, screen->width_mm, screen->height_mm);
- randr = KdSubRotation (scrpriv->randr, screen->randr);
+ randr = KdSubRotation(scrpriv->randr, screen->randr);
- RRSetCurrentConfig (pScreen, randr, 0, pSize);
+ RRSetCurrentConfig(pScreen, randr, 0, pSize);
return TRUE;
}
static Bool
-fbdevRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize)
+fbdevRandRSetConfig(ScreenPtr pScreen,
+ Rotation randr, int rate, RRScreenSizePtr pSize)
{
KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- FbdevScrPriv *scrpriv = screen->driver;
- Bool wasEnabled = pScreenPriv->enabled;
- FbdevScrPriv oldscr;
- int oldwidth;
- int oldheight;
- int oldmmwidth;
- int oldmmheight;
- int newwidth, newheight;
-
- if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
- {
- newwidth = pSize->width;
- newheight = pSize->height;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FbdevScrPriv *scrpriv = screen->driver;
+ Bool wasEnabled = pScreenPriv->enabled;
+ FbdevScrPriv oldscr;
+ int oldwidth;
+ int oldheight;
+ int oldmmwidth;
+ int oldmmheight;
+ int newwidth, newheight;
+
+ if (screen->randr & (RR_Rotate_0 | RR_Rotate_180)) {
+ newwidth = pSize->width;
+ newheight = pSize->height;
}
- else
- {
- newwidth = pSize->height;
- newheight = pSize->width;
+ else {
+ newwidth = pSize->height;
+ newheight = pSize->width;
}
if (wasEnabled)
- KdDisableScreen (pScreen);
+ KdDisableScreen(pScreen);
oldscr = *scrpriv;
@@ -517,60 +490,60 @@ fbdevRandRSetConfig (ScreenPtr pScreen,
* Set new configuration
*/
- scrpriv->randr = KdAddRotation (screen->randr, randr);
+ scrpriv->randr = KdAddRotation(screen->randr, randr);
- fbdevUnmapFramebuffer (screen);
+ fbdevUnmapFramebuffer(screen);
- if (!fbdevMapFramebuffer (screen))
- goto bail4;
+ if (!fbdevMapFramebuffer(screen))
+ goto bail4;
- KdShadowUnset (screen->pScreen);
+ KdShadowUnset(screen->pScreen);
- if (!fbdevSetShadow (screen->pScreen))
- goto bail4;
+ if (!fbdevSetShadow(screen->pScreen))
+ goto bail4;
- fbdevSetScreenSizes (screen->pScreen);
+ fbdevSetScreenSizes(screen->pScreen);
/*
* Set frame buffer mapping
*/
- (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
- pScreen->width,
- pScreen->height,
- screen->fb.depth,
- screen->fb.bitsPerPixel,
- screen->fb.byteStride,
- screen->fb.frameBuffer);
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap(pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb.depth,
+ screen->fb.bitsPerPixel,
+ screen->fb.byteStride,
+ screen->fb.frameBuffer);
/* set the subpixel order */
- KdSetSubpixelOrder (pScreen, scrpriv->randr);
+ KdSetSubpixelOrder(pScreen, scrpriv->randr);
if (wasEnabled)
- KdEnableScreen (pScreen);
+ KdEnableScreen(pScreen);
return TRUE;
-bail4:
- fbdevUnmapFramebuffer (screen);
+ bail4:
+ fbdevUnmapFramebuffer(screen);
*scrpriv = oldscr;
- (void) fbdevMapFramebuffer (screen);
+ (void) fbdevMapFramebuffer(screen);
pScreen->width = oldwidth;
pScreen->height = oldheight;
pScreen->mmWidth = oldmmwidth;
pScreen->mmHeight = oldmmheight;
if (wasEnabled)
- KdEnableScreen (pScreen);
+ KdEnableScreen(pScreen);
return FALSE;
}
static Bool
-fbdevRandRInit (ScreenPtr pScreen)
+fbdevRandRInit(ScreenPtr pScreen)
{
- rrScrPrivPtr pScrPriv;
+ rrScrPrivPtr pScrPriv;
- if (!RRScreenInit (pScreen))
- return FALSE;
+ if (!RRScreenInit(pScreen))
+ return FALSE;
pScrPriv = rrGetScrPriv(pScreen);
pScrPriv->rrGetInfo = fbdevRandRGetInfo;
@@ -580,41 +553,41 @@ fbdevRandRInit (ScreenPtr pScreen)
#endif
static Bool
-fbdevCreateColormap (ColormapPtr pmap)
+fbdevCreateColormap(ColormapPtr pmap)
{
- ScreenPtr pScreen = pmap->pScreen;
+ ScreenPtr pScreen = pmap->pScreen;
+
KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
- VisualPtr pVisual;
- int i;
- int nent;
- xColorItem *pdefs;
+ FbdevPriv *priv = pScreenPriv->card->driver;
+ VisualPtr pVisual;
+ int i;
+ int nent;
+ xColorItem *pdefs;
switch (priv->fix.visual) {
case FB_VISUAL_STATIC_PSEUDOCOLOR:
- pVisual = pmap->pVisual;
- nent = pVisual->ColormapEntries;
- pdefs = malloc(nent * sizeof (xColorItem));
- if (!pdefs)
- return FALSE;
- for (i = 0; i < nent; i++)
- pdefs[i].pixel = i;
- fbdevGetColors (pScreen, nent, pdefs);
- for (i = 0; i < nent; i++)
- {
- pmap->red[i].co.local.red = pdefs[i].red;
- pmap->red[i].co.local.green = pdefs[i].green;
- pmap->red[i].co.local.blue = pdefs[i].blue;
- }
- free(pdefs);
- return TRUE;
+ pVisual = pmap->pVisual;
+ nent = pVisual->ColormapEntries;
+ pdefs = malloc(nent * sizeof(xColorItem));
+ if (!pdefs)
+ return FALSE;
+ for (i = 0; i < nent; i++)
+ pdefs[i].pixel = i;
+ fbdevGetColors(pScreen, nent, pdefs);
+ for (i = 0; i < nent; i++) {
+ pmap->red[i].co.local.red = pdefs[i].red;
+ pmap->red[i].co.local.green = pdefs[i].green;
+ pmap->red[i].co.local.blue = pdefs[i].blue;
+ }
+ free(pdefs);
+ return TRUE;
default:
- return fbInitializeColormap (pmap);
+ return fbInitializeColormap(pmap);
}
}
Bool
-fbdevInitScreen (ScreenPtr pScreen)
+fbdevInitScreen(ScreenPtr pScreen)
{
#ifdef TOUCHSCREEN
KdTsPhyScreen = pScreen->myNum;
@@ -625,33 +598,32 @@ fbdevInitScreen (ScreenPtr pScreen)
}
Bool
-fbdevFinishInitScreen (ScreenPtr pScreen)
+fbdevFinishInitScreen(ScreenPtr pScreen)
{
- if (!shadowSetup (pScreen))
- return FALSE;
+ if (!shadowSetup(pScreen))
+ return FALSE;
#ifdef RANDR
- if (!fbdevRandRInit (pScreen))
- return FALSE;
+ if (!fbdevRandRInit(pScreen))
+ return FALSE;
#endif
return TRUE;
}
-
Bool
-fbdevCreateResources (ScreenPtr pScreen)
+fbdevCreateResources(ScreenPtr pScreen)
{
- return fbdevSetShadow (pScreen);
+ return fbdevSetShadow(pScreen);
}
void
-fbdevPreserve (KdCardInfo *card)
+fbdevPreserve(KdCardInfo * card)
{
}
static int
-fbdevUpdateFbColormap(FbdevPriv *priv, int minidx, int maxidx)
+fbdevUpdateFbColormap(FbdevPriv * priv, int minidx, int maxidx)
{
struct fb_cmap cmap;
@@ -666,89 +638,84 @@ fbdevUpdateFbColormap(FbdevPriv *priv, int minidx, int maxidx)
}
Bool
-fbdevEnable (ScreenPtr pScreen)
+fbdevEnable(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
- int k;
+ FbdevPriv *priv = pScreenPriv->card->driver;
+ int k;
- priv->var.activate = FB_ACTIVATE_NOW|FB_CHANGE_CMAP_VBL;
+ priv->var.activate = FB_ACTIVATE_NOW | FB_CHANGE_CMAP_VBL;
/* display it on the LCD */
- k = ioctl (priv->fd, FBIOPUT_VSCREENINFO, &priv->var);
- if (k < 0)
- {
- perror ("FBIOPUT_VSCREENINFO");
- return FALSE;
+ k = ioctl(priv->fd, FBIOPUT_VSCREENINFO, &priv->var);
+ if (k < 0) {
+ perror("FBIOPUT_VSCREENINFO");
+ return FALSE;
}
- if (priv->fix.visual == FB_VISUAL_DIRECTCOLOR)
- {
- int i;
-
- for (i = 0;
- i < (1 << priv->var.red.length) ||
- i < (1 << priv->var.green.length) ||
- i < (1 << priv->var.blue.length); i++)
- {
- priv->red[i] = i * 65535 / ((1 << priv->var.red.length) - 1);
- priv->green[i] = i * 65535 / ((1 << priv->var.green.length) - 1);
- priv->blue[i] = i * 65535 / ((1 << priv->var.blue.length) - 1);
- }
-
- fbdevUpdateFbColormap(priv, 0, i);
+ if (priv->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+ int i;
+
+ for (i = 0;
+ i < (1 << priv->var.red.length) ||
+ i < (1 << priv->var.green.length) ||
+ i < (1 << priv->var.blue.length); i++) {
+ priv->red[i] = i * 65535 / ((1 << priv->var.red.length) - 1);
+ priv->green[i] = i * 65535 / ((1 << priv->var.green.length) - 1);
+ priv->blue[i] = i * 65535 / ((1 << priv->var.blue.length) - 1);
+ }
+
+ fbdevUpdateFbColormap(priv, 0, i);
}
return TRUE;
}
Bool
-fbdevDPMS (ScreenPtr pScreen, int mode)
+fbdevDPMS(ScreenPtr pScreen, int mode)
{
KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
+ FbdevPriv *priv = pScreenPriv->card->driver;
static int oldmode = -1;
if (mode == oldmode)
- return TRUE;
+ return TRUE;
#ifdef FBIOPUT_POWERMODE
- if (ioctl (priv->fd, FBIOPUT_POWERMODE, &mode) >= 0)
- {
- oldmode = mode;
- return TRUE;
+ if (ioctl(priv->fd, FBIOPUT_POWERMODE, &mode) >= 0) {
+ oldmode = mode;
+ return TRUE;
}
#endif
#ifdef FBIOBLANK
- if (ioctl (priv->fd, FBIOBLANK, mode ? mode + 1 : 0) >= 0)
- {
- oldmode = mode;
- return TRUE;
+ if (ioctl(priv->fd, FBIOBLANK, mode ? mode + 1 : 0) >= 0) {
+ oldmode = mode;
+ return TRUE;
}
#endif
return FALSE;
}
void
-fbdevDisable (ScreenPtr pScreen)
+fbdevDisable(ScreenPtr pScreen)
{
}
void
-fbdevRestore (KdCardInfo *card)
+fbdevRestore(KdCardInfo * card)
{
}
void
-fbdevScreenFini (KdScreenInfo *screen)
+fbdevScreenFini(KdScreenInfo * screen)
{
}
void
-fbdevCardFini (KdCardInfo *card)
+fbdevCardFini(KdCardInfo * card)
{
- FbdevPriv *priv = card->driver;
+ FbdevPriv *priv = card->driver;
- munmap (priv->fb_base, priv->fix.smem_len);
- close (priv->fd);
+ munmap(priv->fb_base, priv->fix.smem_len);
+ close(priv->fd);
free(priv);
}
@@ -756,23 +723,22 @@ fbdevCardFini (KdCardInfo *card)
* Retrieve actual colormap and return selected n entries in pdefs.
*/
void
-fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
+fbdevGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
{
KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
- struct fb_cmap cmap;
- int p;
- int k;
- int min, max;
+ FbdevPriv *priv = pScreenPriv->card->driver;
+ struct fb_cmap cmap;
+ int p;
+ int k;
+ int min, max;
min = 256;
max = 0;
- for (k = 0; k < n; k++)
- {
- if (pdefs[k].pixel < min)
- min = pdefs[k].pixel;
- if (pdefs[k].pixel > max)
- max = pdefs[k].pixel;
+ for (k = 0; k < n; k++) {
+ if (pdefs[k].pixel < min)
+ min = pdefs[k].pixel;
+ if (pdefs[k].pixel > max)
+ max = pdefs[k].pixel;
}
cmap.start = min;
cmap.len = max - min + 1;
@@ -780,19 +746,17 @@ fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
cmap.green = &priv->green[min];
cmap.blue = &priv->blue[min];
cmap.transp = 0;
- k = ioctl (priv->fd, FBIOGETCMAP, &cmap);
- if (k < 0)
- {
- perror ("can't get colormap");
- return;
+ k = ioctl(priv->fd, FBIOGETCMAP, &cmap);
+ if (k < 0) {
+ perror("can't get colormap");
+ return;
}
- while (n--)
- {
- p = pdefs->pixel;
- pdefs->red = priv->red[p];
- pdefs->green = priv->green[p];
- pdefs->blue = priv->blue[p];
- pdefs++;
+ while (n--) {
+ p = pdefs->pixel;
+ pdefs->red = priv->red[p];
+ pdefs->green = priv->green[p];
+ pdefs->blue = priv->blue[p];
+ pdefs++;
}
}
@@ -800,26 +764,25 @@ fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
* Change colormap by updating n entries described in pdefs.
*/
void
-fbdevPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
+fbdevPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
{
KdScreenPriv(pScreen);
- FbdevPriv *priv = pScreenPriv->card->driver;
- int p;
- int min, max;
+ FbdevPriv *priv = pScreenPriv->card->driver;
+ int p;
+ int min, max;
min = 256;
max = 0;
- while (n--)
- {
- p = pdefs->pixel;
- priv->red[p] = pdefs->red;
- priv->green[p] = pdefs->green;
- priv->blue[p] = pdefs->blue;
- if (p < min)
- min = p;
- if (p > max)
- max = p;
- pdefs++;
+ while (n--) {
+ p = pdefs->pixel;
+ priv->red[p] = pdefs->red;
+ priv->green[p] = pdefs->green;
+ priv->blue[p] = pdefs->blue;
+ if (p < min)
+ min = p;
+ if (p > max)
+ max = p;
+ pdefs++;
}
fbdevUpdateFbColormap(priv, min, max);
diff --git a/xorg-server/hw/kdrive/fbdev/fbinit.c b/xorg-server/hw/kdrive/fbdev/fbinit.c
index 1d66fce32..d2a14019d 100644
--- a/xorg-server/hw/kdrive/fbdev/fbinit.c
+++ b/xorg-server/hw/kdrive/fbdev/fbinit.c
@@ -26,82 +26,80 @@
#include <fbdev.h>
void
-InitCard (char *name)
+InitCard(char *name)
{
- KdCardInfoAdd (&fbdevFuncs, 0);
+ KdCardInfoAdd(&fbdevFuncs, 0);
}
void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
{
- KdInitOutput (pScreenInfo, argc, argv);
+ KdInitOutput(pScreenInfo, argc, argv);
}
void
-InitInput (int argc, char **argv)
+InitInput(int argc, char **argv)
{
- KdOsAddInputDrivers ();
- KdInitInput ();
+ KdOsAddInputDrivers();
+ KdInitInput();
}
void
-CloseInput (void)
+CloseInput(void)
{
- KdCloseInput ();
+ KdCloseInput();
}
void
-ddxUseMsg (void)
+ddxUseMsg(void)
{
- KdUseMsg();
- ErrorF("\nXfbdev Device Usage:\n");
- ErrorF("-fb path Framebuffer device to use. Defaults to /dev/fb0\n");
- ErrorF("\n");
+ KdUseMsg();
+ ErrorF("\nXfbdev Device Usage:\n");
+ ErrorF
+ ("-fb path Framebuffer device to use. Defaults to /dev/fb0\n");
+ ErrorF("\n");
}
int
-ddxProcessArgument (int argc, char **argv, int i)
+ddxProcessArgument(int argc, char **argv, int i)
{
- if (!strcmp (argv[i], "-fb"))
- {
- if (i+1 < argc)
- {
- fbdevDevicePath = argv[i+1];
- return 2;
- }
- UseMsg();
- exit(1);
+ if (!strcmp(argv[i], "-fb")) {
+ if (i + 1 < argc) {
+ fbdevDevicePath = argv[i + 1];
+ return 2;
+ }
+ UseMsg();
+ exit(1);
}
- return KdProcessArgument (argc, argv, i);
+ return KdProcessArgument(argc, argv, i);
}
+KdCardFuncs fbdevFuncs = {
+ fbdevCardInit, /* cardinit */
+ fbdevScreenInit, /* scrinit */
+ fbdevInitScreen, /* initScreen */
+ fbdevFinishInitScreen, /* finishInitScreen */
+ fbdevCreateResources, /* createRes */
+ fbdevPreserve, /* preserve */
+ fbdevEnable, /* enable */
+ fbdevDPMS, /* dpms */
+ fbdevDisable, /* disable */
+ fbdevRestore, /* restore */
+ fbdevScreenFini, /* scrfini */
+ fbdevCardFini, /* cardfini */
-KdCardFuncs fbdevFuncs = {
- fbdevCardInit, /* cardinit */
- fbdevScreenInit, /* scrinit */
- fbdevInitScreen, /* initScreen */
- fbdevFinishInitScreen, /* finishInitScreen */
- fbdevCreateResources, /* createRes */
- fbdevPreserve, /* preserve */
- fbdevEnable, /* enable */
- fbdevDPMS, /* dpms */
- fbdevDisable, /* disable */
- fbdevRestore, /* restore */
- fbdevScreenFini, /* scrfini */
- fbdevCardFini, /* cardfini */
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
- 0, /* initCursor */
- 0, /* enableCursor */
- 0, /* disableCursor */
- 0, /* finiCursor */
- 0, /* recolorCursor */
+ 0, /* initAccel */
+ 0, /* enableAccel */
+ 0, /* disableAccel */
+ 0, /* finiAccel */
- 0, /* initAccel */
- 0, /* enableAccel */
- 0, /* disableAccel */
- 0, /* finiAccel */
-
- fbdevGetColors, /* getColors */
- fbdevPutColors, /* putColors */
+ fbdevGetColors, /* getColors */
+ fbdevPutColors, /* putColors */
};
diff --git a/xorg-server/hw/kdrive/linux/evdev.c b/xorg-server/hw/kdrive/linux/evdev.c
index 20df77b99..9982fad36 100644
--- a/xorg-server/hw/kdrive/linux/evdev.c
+++ b/xorg-server/hw/kdrive/linux/evdev.c
@@ -1,539 +1,519 @@
-/*
- * Copyright © 2004 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-#include <errno.h>
-#include <linux/input.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xpoll.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "kdrive.h"
-
-#define NUM_EVENTS 128
-#define ABS_UNSET -65535
-
-#define BITS_PER_LONG (sizeof(long) * 8)
-#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
-#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y))
-#define OFF(x) ((x)%BITS_PER_LONG)
-#define LONG(x) ((x)/BITS_PER_LONG)
-#define BIT(x) (1 << OFF(x))
-
-typedef struct _kevdev {
- /* current device state */
- int rel[REL_MAX + 1];
- int abs[ABS_MAX + 1];
- int prevabs[ABS_MAX + 1];
- long key[NBITS(KEY_MAX + 1)];
-
- /* supported device info */
- long relbits[NBITS(REL_MAX + 1)];
- long absbits[NBITS(ABS_MAX + 1)];
- long keybits[NBITS(KEY_MAX + 1)];
- struct input_absinfo absinfo[ABS_MAX + 1];
- int max_rel;
- int max_abs;
-
- int fd;
-} Kevdev;
-
-static void
-EvdevPtrBtn (KdPointerInfo *pi, struct input_event *ev)
-{
- int flags = KD_MOUSE_DELTA | pi->buttonState;
-
- if (ev->code >= BTN_MOUSE && ev->code < BTN_JOYSTICK) {
- switch (ev->code) {
- case BTN_LEFT:
- if (ev->value == 1)
- flags |= KD_BUTTON_1;
- else
- flags &= ~KD_BUTTON_1;
- break;
- case BTN_MIDDLE:
- if (ev->value == 1)
- flags |= KD_BUTTON_2;
- else
- flags &= ~KD_BUTTON_2;
- break;
- case BTN_RIGHT:
- if (ev->value == 1)
- flags |= KD_BUTTON_3;
- else
- flags &= ~KD_BUTTON_3;
- break;
- default:
- /* Unknow button */
- break;
- }
-
- KdEnqueuePointerEvent (pi, flags, 0, 0, 0);
- }
-}
-static void
-EvdevPtrMotion (KdPointerInfo *pi, struct input_event *ev)
-{
- Kevdev *ke = pi->driverPrivate;
- int i;
- int flags = KD_MOUSE_DELTA | pi->buttonState;
-
- for (i = 0; i <= ke->max_rel; i++)
- if (ke->rel[i])
- {
- int a;
- for (a = 0; a <= ke->max_rel; a++)
- {
- if (ISBITSET (ke->relbits, a))
- {
- if (a == 0)
- KdEnqueuePointerEvent(pi, flags, ke->rel[a], 0, 0);
- else if (a == 1)
- KdEnqueuePointerEvent(pi, flags, 0, ke->rel[a], 0);
- }
- ke->rel[a] = 0;
- }
- break;
- }
- for (i = 0; i < ke->max_abs; i++)
- if (ke->abs[i] != ke->prevabs[i])
- {
- int a;
- ErrorF ("abs");
- for (a = 0; a <= ke->max_abs; a++)
- {
- if (ISBITSET (ke->absbits, a))
- ErrorF (" %d=%d", a, ke->abs[a]);
- ke->prevabs[a] = ke->abs[a];
- }
- ErrorF ("\n");
- break;
- }
-
- if (ev->code == REL_WHEEL) {
- for (i = 0; i < abs (ev->value); i++)
- {
- if (ev->value > 0)
- flags |= KD_BUTTON_4;
- else
- flags |= KD_BUTTON_5;
-
- KdEnqueuePointerEvent (pi, flags, 0, 0, 0);
-
- if (ev->value > 0)
- flags &= ~KD_BUTTON_4;
- else
- flags &= ~KD_BUTTON_5;
-
- KdEnqueuePointerEvent (pi, flags, 0, 0, 0);
- }
- }
-
-}
-
-static void
-EvdevPtrRead (int evdevPort, void *closure)
-{
- KdPointerInfo *pi = closure;
- Kevdev *ke = pi->driverPrivate;
- int i;
- struct input_event events[NUM_EVENTS];
- int n;
-
- n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
- if (n <= 0) {
- if (errno == ENODEV)
- DeleteInputDeviceRequest(pi->dixdev);
- return;
- }
-
- n /= sizeof (struct input_event);
- for (i = 0; i < n; i++)
- {
- switch (events[i].type) {
- case EV_SYN:
- break;
- case EV_KEY:
- EvdevPtrBtn (pi, &events[i]);
- break;
- case EV_REL:
- ke->rel[events[i].code] += events[i].value;
- EvdevPtrMotion (pi, &events[i]);
- break;
- case EV_ABS:
- ke->abs[events[i].code] = events[i].value;
- EvdevPtrMotion (pi, &events[i]);
- break;
- }
- }
-}
-
-char *kdefaultEvdev[] = {
- "/dev/input/event0",
- "/dev/input/event1",
- "/dev/input/event2",
- "/dev/input/event3",
-};
-
-#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
-
-static Status
-EvdevPtrInit (KdPointerInfo *pi)
-{
- int i;
- int fd;
-
- if (!pi->path) {
- for (i = 0; i < NUM_DEFAULT_EVDEV; i++) {
- fd = open (kdefaultEvdev[i], 2);
- if (fd >= 0) {
- pi->path = strdup (kdefaultEvdev[i]);
- break;
- }
- }
- }
- else {
- fd = open (pi->path, O_RDWR);
- if (fd < 0) {
- ErrorF("Failed to open evdev device %s\n", pi->path);
- return BadMatch;
- }
- }
-
- close(fd);
-
- pi->name = strdup("Evdev mouse");
-
- return Success;
-}
-
-static Status
-EvdevPtrEnable (KdPointerInfo *pi)
-{
- int fd;
- unsigned long ev[NBITS(EV_MAX)];
- Kevdev *ke;
-
- if (!pi || !pi->path)
- return BadImplementation;
-
- fd = open(pi->path, 2);
- if (fd < 0)
- return BadMatch;
-
- if (ioctl (fd, EVIOCGRAB, 1) < 0)
- perror ("Grabbing evdev mouse device failed");
-
- if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
- {
- perror ("EVIOCGBIT 0");
- close (fd);
- return BadMatch;
- }
- ke = calloc(1, sizeof (Kevdev));
- if (!ke)
- {
- close (fd);
- return BadAlloc;
- }
- if (ISBITSET (ev, EV_KEY))
- {
- if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
- ke->keybits) < 0)
- {
- perror ("EVIOCGBIT EV_KEY");
- free(ke);
- close (fd);
- return BadMatch;
- }
- }
- if (ISBITSET (ev, EV_REL))
- {
- if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
- ke->relbits) < 0)
- {
- perror ("EVIOCGBIT EV_REL");
- free(ke);
- close (fd);
- return BadMatch;
- }
- for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
- if (ISBITSET(ke->relbits, ke->max_rel))
- break;
- }
- if (ISBITSET (ev, EV_ABS))
- {
- int i;
-
- if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
- ke->absbits) < 0)
- {
- perror ("EVIOCGBIT EV_ABS");
- free(ke);
- close (fd);
- return BadMatch;
- }
- for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
- if (ISBITSET(ke->absbits, ke->max_abs))
- break;
- for (i = 0; i <= ke->max_abs; i++)
- {
- if (ISBITSET (ke->absbits, i))
- if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
- {
- perror ("EVIOCGABS");
- break;
- }
- ke->prevabs[i] = ABS_UNSET;
- }
- if (i <= ke->max_abs)
- {
- free(ke);
- close (fd);
- return BadValue;
- }
- }
- if (!KdRegisterFd (fd, EvdevPtrRead, pi)) {
- free(ke);
- close (fd);
- return BadAlloc;
- }
- pi->driverPrivate = ke;
- ke->fd = fd;
-
- return Success;
-}
-
-static void
-EvdevPtrDisable (KdPointerInfo *pi)
-{
- Kevdev *ke;
-
- ke = pi->driverPrivate;
-
- if (!pi || !pi->driverPrivate)
- return;
-
- KdUnregisterFd (pi, ke->fd, TRUE);
-
- if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
- perror ("Ungrabbing evdev mouse device failed");
-
- free(ke);
- pi->driverPrivate = 0;
-}
-
-static void
-EvdevPtrFini (KdPointerInfo *pi)
-{
-}
-
-
-/*
- * Evdev keyboard functions
- */
-
-static void
-readMapping (KdKeyboardInfo *ki)
-{
- if (!ki)
- return;
-
- ki->minScanCode = 0;
- ki->maxScanCode = 247;
-}
-
-static void
-EvdevKbdRead (int evdevPort, void *closure)
-{
- KdKeyboardInfo *ki = closure;
- struct input_event events[NUM_EVENTS];
- int i, n;
-
- n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
- if (n <= 0) {
- if (errno == ENODEV)
- DeleteInputDeviceRequest(ki->dixdev);
- return;
- }
-
- n /= sizeof (struct input_event);
- for (i = 0; i < n; i++)
- {
- if (events[i].type == EV_KEY)
- KdEnqueueKeyboardEvent (ki, events[i].code, !events[i].value);
-/* FIXME: must implement other types of events
- else
- ErrorF("Event type (%d) not delivered\n", events[i].type);
-*/
- }
-}
-
-static Status
-EvdevKbdInit (KdKeyboardInfo *ki)
-{
- int fd;
-
- if (!ki->path) {
- ErrorF("Couldn't find evdev device path\n");
- return BadValue;
- }
- else {
- fd = open (ki->path, O_RDWR);
- if (fd < 0) {
- ErrorF("Failed to open evdev device %s\n", ki->path);
- return BadMatch;
- }
- }
-
- close (fd);
-
- ki->name = strdup("Evdev keyboard");
-
- readMapping(ki);
-
- return Success;
-}
-
-static Status
-EvdevKbdEnable (KdKeyboardInfo *ki)
-{
- unsigned long ev[NBITS(EV_MAX)];
- Kevdev *ke;
- int fd;
-
- if (!ki || !ki->path)
- return BadImplementation;
-
- fd = open(ki->path, O_RDWR);
- if (fd < 0)
- return BadMatch;
-
- if (ioctl (fd, EVIOCGRAB, 1) < 0)
- perror ("Grabbing evdev keyboard device failed");
-
- if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0) {
- perror ("EVIOCGBIT 0");
- close (fd);
- return BadMatch;
- }
-
- ke = calloc(1, sizeof (Kevdev));
- if (!ke) {
- close (fd);
- return BadAlloc;
- }
-
- if (!KdRegisterFd (fd, EvdevKbdRead, ki)) {
- free(ke);
- close (fd);
- return BadAlloc;
- }
- ki->driverPrivate = ke;
- ke->fd = fd;
-
- return Success;
-}
-
-static void
-EvdevKbdLeds (KdKeyboardInfo *ki, int leds)
-{
-/* struct input_event event;
- Kevdev *ke;
-
- ki->driverPrivate = ke;
-
- memset(&event, 0, sizeof(event));
-
- event.type = EV_LED;
- event.code = LED_CAPSL;
- event.value = leds & (1 << 0) ? 1 : 0;
- write(ke->fd, (char *) &event, sizeof(event));
-
- event.type = EV_LED;
- event.code = LED_NUML;
- event.value = leds & (1 << 1) ? 1 : 0;
- write(ke->fd, (char *) &event, sizeof(event));
-
- event.type = EV_LED;
- event.code = LED_SCROLLL;
- event.value = leds & (1 << 2) ? 1 : 0;
- write(ke->fd, (char *) &event, sizeof(event));
-
- event.type = EV_LED;
- event.code = LED_COMPOSE;
- event.value = leds & (1 << 3) ? 1 : 0;
- write(ke->fd, (char *) &event, sizeof(event));
-*/
-}
-
-static void
-EvdevKbdBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
-{
-}
-
-static void
-EvdevKbdDisable (KdKeyboardInfo *ki)
-{
- Kevdev *ke;
-
- ke = ki->driverPrivate;
-
- if (!ki || !ki->driverPrivate)
- return;
-
- KdUnregisterFd (ki, ke->fd, TRUE);
-
- if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
- perror ("Ungrabbing evdev keyboard device failed");
-
- free(ke);
- ki->driverPrivate = 0;
-}
-
-static void
-EvdevKbdFini (KdKeyboardInfo *ki)
-{
-}
-
-KdPointerDriver LinuxEvdevMouseDriver = {
- "evdev",
- EvdevPtrInit,
- EvdevPtrEnable,
- EvdevPtrDisable,
- EvdevPtrFini,
- NULL,
-};
-
-KdKeyboardDriver LinuxEvdevKeyboardDriver = {
- "evdev",
- EvdevKbdInit,
- EvdevKbdEnable,
- EvdevKbdLeds,
- EvdevKbdBell,
- EvdevKbdDisable,
- EvdevKbdFini,
- NULL,
-};
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include <errno.h>
+#include <linux/input.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xpoll.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "kdrive.h"
+
+#define NUM_EVENTS 128
+#define ABS_UNSET -65535
+
+#define BITS_PER_LONG (sizeof(long) * 8)
+#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
+#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y))
+#define OFF(x) ((x)%BITS_PER_LONG)
+#define LONG(x) ((x)/BITS_PER_LONG)
+#define BIT(x) (1 << OFF(x))
+
+typedef struct _kevdev {
+ /* current device state */
+ int rel[REL_MAX + 1];
+ int abs[ABS_MAX + 1];
+ int prevabs[ABS_MAX + 1];
+ long key[NBITS(KEY_MAX + 1)];
+
+ /* supported device info */
+ long relbits[NBITS(REL_MAX + 1)];
+ long absbits[NBITS(ABS_MAX + 1)];
+ long keybits[NBITS(KEY_MAX + 1)];
+ struct input_absinfo absinfo[ABS_MAX + 1];
+ int max_rel;
+ int max_abs;
+
+ int fd;
+} Kevdev;
+
+static void
+EvdevPtrBtn(KdPointerInfo * pi, struct input_event *ev)
+{
+ int flags = KD_MOUSE_DELTA | pi->buttonState;
+
+ if (ev->code >= BTN_MOUSE && ev->code < BTN_JOYSTICK) {
+ switch (ev->code) {
+ case BTN_LEFT:
+ if (ev->value == 1)
+ flags |= KD_BUTTON_1;
+ else
+ flags &= ~KD_BUTTON_1;
+ break;
+ case BTN_MIDDLE:
+ if (ev->value == 1)
+ flags |= KD_BUTTON_2;
+ else
+ flags &= ~KD_BUTTON_2;
+ break;
+ case BTN_RIGHT:
+ if (ev->value == 1)
+ flags |= KD_BUTTON_3;
+ else
+ flags &= ~KD_BUTTON_3;
+ break;
+ default:
+ /* Unknow button */
+ break;
+ }
+
+ KdEnqueuePointerEvent(pi, flags, 0, 0, 0);
+ }
+}
+
+static void
+EvdevPtrMotion(KdPointerInfo * pi, struct input_event *ev)
+{
+ Kevdev *ke = pi->driverPrivate;
+ int i;
+ int flags = KD_MOUSE_DELTA | pi->buttonState;
+
+ for (i = 0; i <= ke->max_rel; i++)
+ if (ke->rel[i]) {
+ int a;
+
+ for (a = 0; a <= ke->max_rel; a++) {
+ if (ISBITSET(ke->relbits, a)) {
+ if (a == 0)
+ KdEnqueuePointerEvent(pi, flags, ke->rel[a], 0, 0);
+ else if (a == 1)
+ KdEnqueuePointerEvent(pi, flags, 0, ke->rel[a], 0);
+ }
+ ke->rel[a] = 0;
+ }
+ break;
+ }
+ for (i = 0; i < ke->max_abs; i++)
+ if (ke->abs[i] != ke->prevabs[i]) {
+ int a;
+
+ ErrorF("abs");
+ for (a = 0; a <= ke->max_abs; a++) {
+ if (ISBITSET(ke->absbits, a))
+ ErrorF(" %d=%d", a, ke->abs[a]);
+ ke->prevabs[a] = ke->abs[a];
+ }
+ ErrorF("\n");
+ break;
+ }
+
+ if (ev->code == REL_WHEEL) {
+ for (i = 0; i < abs(ev->value); i++) {
+ if (ev->value > 0)
+ flags |= KD_BUTTON_4;
+ else
+ flags |= KD_BUTTON_5;
+
+ KdEnqueuePointerEvent(pi, flags, 0, 0, 0);
+
+ if (ev->value > 0)
+ flags &= ~KD_BUTTON_4;
+ else
+ flags &= ~KD_BUTTON_5;
+
+ KdEnqueuePointerEvent(pi, flags, 0, 0, 0);
+ }
+ }
+
+}
+
+static void
+EvdevPtrRead(int evdevPort, void *closure)
+{
+ KdPointerInfo *pi = closure;
+ Kevdev *ke = pi->driverPrivate;
+ int i;
+ struct input_event events[NUM_EVENTS];
+ int n;
+
+ n = read(evdevPort, &events, NUM_EVENTS * sizeof(struct input_event));
+ if (n <= 0) {
+ if (errno == ENODEV)
+ DeleteInputDeviceRequest(pi->dixdev);
+ return;
+ }
+
+ n /= sizeof(struct input_event);
+ for (i = 0; i < n; i++) {
+ switch (events[i].type) {
+ case EV_SYN:
+ break;
+ case EV_KEY:
+ EvdevPtrBtn(pi, &events[i]);
+ break;
+ case EV_REL:
+ ke->rel[events[i].code] += events[i].value;
+ EvdevPtrMotion(pi, &events[i]);
+ break;
+ case EV_ABS:
+ ke->abs[events[i].code] = events[i].value;
+ EvdevPtrMotion(pi, &events[i]);
+ break;
+ }
+ }
+}
+
+char *kdefaultEvdev[] = {
+ "/dev/input/event0",
+ "/dev/input/event1",
+ "/dev/input/event2",
+ "/dev/input/event3",
+};
+
+#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
+
+static Status
+EvdevPtrInit(KdPointerInfo * pi)
+{
+ int i;
+ int fd;
+
+ if (!pi->path) {
+ for (i = 0; i < NUM_DEFAULT_EVDEV; i++) {
+ fd = open(kdefaultEvdev[i], 2);
+ if (fd >= 0) {
+ pi->path = strdup(kdefaultEvdev[i]);
+ break;
+ }
+ }
+ }
+ else {
+ fd = open(pi->path, O_RDWR);
+ if (fd < 0) {
+ ErrorF("Failed to open evdev device %s\n", pi->path);
+ return BadMatch;
+ }
+ }
+
+ close(fd);
+
+ pi->name = strdup("Evdev mouse");
+
+ return Success;
+}
+
+static Status
+EvdevPtrEnable(KdPointerInfo * pi)
+{
+ int fd;
+ unsigned long ev[NBITS(EV_MAX)];
+ Kevdev *ke;
+
+ if (!pi || !pi->path)
+ return BadImplementation;
+
+ fd = open(pi->path, 2);
+ if (fd < 0)
+ return BadMatch;
+
+ if (ioctl(fd, EVIOCGRAB, 1) < 0)
+ perror("Grabbing evdev mouse device failed");
+
+ if (ioctl(fd, EVIOCGBIT(0 /*EV*/, sizeof(ev)), ev) < 0) {
+ perror("EVIOCGBIT 0");
+ close(fd);
+ return BadMatch;
+ }
+ ke = calloc(1, sizeof(Kevdev));
+ if (!ke) {
+ close(fd);
+ return BadAlloc;
+ }
+ if (ISBITSET(ev, EV_KEY)) {
+ if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(ke->keybits)), ke->keybits) < 0) {
+ perror("EVIOCGBIT EV_KEY");
+ free(ke);
+ close(fd);
+ return BadMatch;
+ }
+ }
+ if (ISBITSET(ev, EV_REL)) {
+ if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof(ke->relbits)), ke->relbits) < 0) {
+ perror("EVIOCGBIT EV_REL");
+ free(ke);
+ close(fd);
+ return BadMatch;
+ }
+ for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
+ if (ISBITSET(ke->relbits, ke->max_rel))
+ break;
+ }
+ if (ISBITSET(ev, EV_ABS)) {
+ int i;
+
+ if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(ke->absbits)), ke->absbits) < 0) {
+ perror("EVIOCGBIT EV_ABS");
+ free(ke);
+ close(fd);
+ return BadMatch;
+ }
+ for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
+ if (ISBITSET(ke->absbits, ke->max_abs))
+ break;
+ for (i = 0; i <= ke->max_abs; i++) {
+ if (ISBITSET(ke->absbits, i))
+ if (ioctl(fd, EVIOCGABS(i), &ke->absinfo[i]) < 0) {
+ perror("EVIOCGABS");
+ break;
+ }
+ ke->prevabs[i] = ABS_UNSET;
+ }
+ if (i <= ke->max_abs) {
+ free(ke);
+ close(fd);
+ return BadValue;
+ }
+ }
+ if (!KdRegisterFd(fd, EvdevPtrRead, pi)) {
+ free(ke);
+ close(fd);
+ return BadAlloc;
+ }
+ pi->driverPrivate = ke;
+ ke->fd = fd;
+
+ return Success;
+}
+
+static void
+EvdevPtrDisable(KdPointerInfo * pi)
+{
+ Kevdev *ke;
+
+ ke = pi->driverPrivate;
+
+ if (!pi || !pi->driverPrivate)
+ return;
+
+ KdUnregisterFd(pi, ke->fd, TRUE);
+
+ if (ioctl(ke->fd, EVIOCGRAB, 0) < 0)
+ perror("Ungrabbing evdev mouse device failed");
+
+ free(ke);
+ pi->driverPrivate = 0;
+}
+
+static void
+EvdevPtrFini(KdPointerInfo * pi)
+{
+}
+
+/*
+ * Evdev keyboard functions
+ */
+
+static void
+readMapping(KdKeyboardInfo * ki)
+{
+ if (!ki)
+ return;
+
+ ki->minScanCode = 0;
+ ki->maxScanCode = 247;
+}
+
+static void
+EvdevKbdRead(int evdevPort, void *closure)
+{
+ KdKeyboardInfo *ki = closure;
+ struct input_event events[NUM_EVENTS];
+ int i, n;
+
+ n = read(evdevPort, &events, NUM_EVENTS * sizeof(struct input_event));
+ if (n <= 0) {
+ if (errno == ENODEV)
+ DeleteInputDeviceRequest(ki->dixdev);
+ return;
+ }
+
+ n /= sizeof(struct input_event);
+ for (i = 0; i < n; i++) {
+ if (events[i].type == EV_KEY)
+ KdEnqueueKeyboardEvent(ki, events[i].code, !events[i].value);
+/* FIXME: must implement other types of events
+ else
+ ErrorF("Event type (%d) not delivered\n", events[i].type);
+*/
+ }
+}
+
+static Status
+EvdevKbdInit(KdKeyboardInfo * ki)
+{
+ int fd;
+
+ if (!ki->path) {
+ ErrorF("Couldn't find evdev device path\n");
+ return BadValue;
+ }
+ else {
+ fd = open(ki->path, O_RDWR);
+ if (fd < 0) {
+ ErrorF("Failed to open evdev device %s\n", ki->path);
+ return BadMatch;
+ }
+ }
+
+ close(fd);
+
+ ki->name = strdup("Evdev keyboard");
+
+ readMapping(ki);
+
+ return Success;
+}
+
+static Status
+EvdevKbdEnable(KdKeyboardInfo * ki)
+{
+ unsigned long ev[NBITS(EV_MAX)];
+ Kevdev *ke;
+ int fd;
+
+ if (!ki || !ki->path)
+ return BadImplementation;
+
+ fd = open(ki->path, O_RDWR);
+ if (fd < 0)
+ return BadMatch;
+
+ if (ioctl(fd, EVIOCGRAB, 1) < 0)
+ perror("Grabbing evdev keyboard device failed");
+
+ if (ioctl(fd, EVIOCGBIT(0 /*EV*/, sizeof(ev)), ev) < 0) {
+ perror("EVIOCGBIT 0");
+ close(fd);
+ return BadMatch;
+ }
+
+ ke = calloc(1, sizeof(Kevdev));
+ if (!ke) {
+ close(fd);
+ return BadAlloc;
+ }
+
+ if (!KdRegisterFd(fd, EvdevKbdRead, ki)) {
+ free(ke);
+ close(fd);
+ return BadAlloc;
+ }
+ ki->driverPrivate = ke;
+ ke->fd = fd;
+
+ return Success;
+}
+
+static void
+EvdevKbdLeds(KdKeyboardInfo * ki, int leds)
+{
+/* struct input_event event;
+ Kevdev *ke;
+
+ ki->driverPrivate = ke;
+
+ memset(&event, 0, sizeof(event));
+
+ event.type = EV_LED;
+ event.code = LED_CAPSL;
+ event.value = leds & (1 << 0) ? 1 : 0;
+ write(ke->fd, (char *) &event, sizeof(event));
+
+ event.type = EV_LED;
+ event.code = LED_NUML;
+ event.value = leds & (1 << 1) ? 1 : 0;
+ write(ke->fd, (char *) &event, sizeof(event));
+
+ event.type = EV_LED;
+ event.code = LED_SCROLLL;
+ event.value = leds & (1 << 2) ? 1 : 0;
+ write(ke->fd, (char *) &event, sizeof(event));
+
+ event.type = EV_LED;
+ event.code = LED_COMPOSE;
+ event.value = leds & (1 << 3) ? 1 : 0;
+ write(ke->fd, (char *) &event, sizeof(event));
+*/
+}
+
+static void
+EvdevKbdBell(KdKeyboardInfo * ki, int volume, int frequency, int duration)
+{
+}
+
+static void
+EvdevKbdDisable(KdKeyboardInfo * ki)
+{
+ Kevdev *ke;
+
+ ke = ki->driverPrivate;
+
+ if (!ki || !ki->driverPrivate)
+ return;
+
+ KdUnregisterFd(ki, ke->fd, TRUE);
+
+ if (ioctl(ke->fd, EVIOCGRAB, 0) < 0)
+ perror("Ungrabbing evdev keyboard device failed");
+
+ free(ke);
+ ki->driverPrivate = 0;
+}
+
+static void
+EvdevKbdFini(KdKeyboardInfo * ki)
+{
+}
+
+KdPointerDriver LinuxEvdevMouseDriver = {
+ "evdev",
+ EvdevPtrInit,
+ EvdevPtrEnable,
+ EvdevPtrDisable,
+ EvdevPtrFini,
+ NULL,
+};
+
+KdKeyboardDriver LinuxEvdevKeyboardDriver = {
+ "evdev",
+ EvdevKbdInit,
+ EvdevKbdEnable,
+ EvdevKbdLeds,
+ EvdevKbdBell,
+ EvdevKbdDisable,
+ EvdevKbdFini,
+ NULL,
+};
diff --git a/xorg-server/hw/kdrive/linux/keyboard.c b/xorg-server/hw/kdrive/linux/keyboard.c
index ba2637b58..9a6ee2d93 100644
--- a/xorg-server/hw/kdrive/linux/keyboard.c
+++ b/xorg-server/hw/kdrive/linux/keyboard.c
@@ -44,70 +44,70 @@
extern int LinuxConsoleFd;
static const KeySym linux_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright, XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_nobreakspace, XK_exclamdown, XK_cent, XK_sterling,
+ XK_currency, XK_yen, XK_brokenbar, XK_section,
+ XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
+ XK_notsign, XK_hyphen, XK_registered, XK_macron,
+ XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
+ XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
+ XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
+ XK_onequarter, XK_onehalf, XK_threequarters, XK_questiondown,
+ XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
+ XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
+ XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
+ XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
+ XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
+ XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
+ XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
+ XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
+ XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
+ XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
+ XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
+ XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
+ XK_eth, XK_ntilde, XK_ograve, XK_oacute,
+ XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
+ XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
+ XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
};
/*
@@ -135,80 +135,78 @@ static const KeySym linux_to_x[256] = {
corresponds to the Xkb keymap.
*/
#if 0
-static unsigned char at2lnx[] =
-{
- 0x0, /* no valid scancode */
- 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
- 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
- 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
- 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
- 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
- 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
- 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
- 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
- 0x11, /* KEY_W */ 0x12, /* KEY_E */
- 0x13, /* KEY_R */ 0x14, /* KEY_T */
- 0x15, /* KEY_Y */ 0x16, /* KEY_U */
- 0x17, /* KEY_I */ 0x18, /* KEY_O */
- 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
- 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
- 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
- 0x1f, /* KEY_S */ 0x20, /* KEY_D */
- 0x21, /* KEY_F */ 0x22, /* KEY_G */
- 0x23, /* KEY_H */ 0x24, /* KEY_J */
- 0x25, /* KEY_K */ 0x26, /* KEY_L */
- 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
- 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
- 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
- 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
- 0x2f, /* KEY_V */ 0x30, /* KEY_B */
- 0x31, /* KEY_N */ 0x32, /* KEY_M */
- 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
- 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
- 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
- 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
- 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
- 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
- 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
- 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
- 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
- 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
- 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
- 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
- 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
- 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
- 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
- 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
- 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
- 0x00, /* 0x55 */ 0x56, /* KEY_Less */
- 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
- 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
- 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
- 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
- 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
- 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
- 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
- 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
- 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
- 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
- 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
- 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
- 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
- 0x00, /* 0x71 */ 0x00, /* 0x72 */
- 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
- 0x00, /* 0x75 */ 0x00, /* 0x76 */
- 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
- 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
- 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
- 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
- 0x00, /* 0x7f */
+static unsigned char at2lnx[] = {
+ 0x0, /* no valid scancode */
+ 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
+ 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
+ 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
+ 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
+ 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
+ 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
+ 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
+ 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
+ 0x11, /* KEY_W */ 0x12, /* KEY_E */
+ 0x13, /* KEY_R */ 0x14, /* KEY_T */
+ 0x15, /* KEY_Y */ 0x16, /* KEY_U */
+ 0x17, /* KEY_I */ 0x18, /* KEY_O */
+ 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
+ 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
+ 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
+ 0x1f, /* KEY_S */ 0x20, /* KEY_D */
+ 0x21, /* KEY_F */ 0x22, /* KEY_G */
+ 0x23, /* KEY_H */ 0x24, /* KEY_J */
+ 0x25, /* KEY_K */ 0x26, /* KEY_L */
+ 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
+ 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
+ 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
+ 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
+ 0x2f, /* KEY_V */ 0x30, /* KEY_B */
+ 0x31, /* KEY_N */ 0x32, /* KEY_M */
+ 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
+ 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
+ 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
+ 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
+ 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
+ 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
+ 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
+ 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
+ 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
+ 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
+ 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
+ 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
+ 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
+ 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
+ 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
+ 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
+ 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
+ 0x00, /* 0x55 */ 0x56, /* KEY_Less */
+ 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
+ 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
+ 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
+ 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
+ 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
+ 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
+ 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
+ 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
+ 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
+ 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
+ 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
+ 0x7A, /* KEY_Menu/FOCUS_PF11 */ 0x00, /* 0x6e */
+ 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
+ 0x00, /* 0x71 */ 0x00, /* 0x72 */
+ 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
+ 0x00, /* 0x75 */ 0x00, /* 0x76 */
+ 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
+ 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
+ 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
+ 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
+ 0x00, /* 0x7f */
};
#define NUM_AT_KEYS (sizeof(at2lnx)/sizeof(at2lnx[0]))
#define LNX_KEY_INDEX(n) n < NUM_AT_KEYS ? at2lnx[n] : 0
-static unsigned char tbl[KD_MAX_WIDTH] =
-{
+static unsigned char tbl[KD_MAX_WIDTH] = {
0,
1 << KG_SHIFT,
(1 << KG_ALTGR),
@@ -217,15 +215,15 @@ static unsigned char tbl[KD_MAX_WIDTH] =
#endif
static void
-readKernelMapping(KdKeyboardInfo *ki)
+readKernelMapping(KdKeyboardInfo * ki)
{
#if 0
- KeySym *k;
- int i, j;
- struct kbentry kbe;
- int minKeyCode, maxKeyCode;
- int row;
- int fd;
+ KeySym *k;
+ int i, j;
+ struct kbentry kbe;
+ int minKeyCode, maxKeyCode;
+ int row;
+ int fd;
if (!ki)
return;
@@ -236,252 +234,248 @@ readKernelMapping(KdKeyboardInfo *ki)
maxKeyCode = 0;
row = 0;
ki->keySyms.mapWidth = KD_MAX_WIDTH;
- for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i)
- {
+ for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i) {
kbe.kb_index = LNX_KEY_INDEX(i);
k = ki->keySyms.map + row * ki->keySyms.mapWidth;
- for (j = 0; j < ki->keySyms.mapWidth; ++j)
- {
- unsigned short kval;
-
- k[j] = NoSymbol;
-
- kbe.kb_table = tbl[j];
- kbe.kb_value = 0;
- if (ioctl(fd, KDGKBENT, &kbe))
- continue;
-
- kval = KVAL(kbe.kb_value);
- switch (KTYP(kbe.kb_value))
- {
- case KT_LATIN:
- case KT_LETTER:
- k[j] = linux_to_x[kval];
- break;
-
- case KT_FN:
- if (kval <= 19)
- k[j] = XK_F1 + kval;
- else switch (kbe.kb_value)
- {
- case K_FIND:
- k[j] = XK_Home; /* or XK_Find */
- break;
- case K_INSERT:
- k[j] = XK_Insert;
- break;
- case K_REMOVE:
- k[j] = XK_Delete;
- break;
- case K_SELECT:
- k[j] = XK_End; /* or XK_Select */
- break;
- case K_PGUP:
- k[j] = XK_Prior;
- break;
- case K_PGDN:
- k[j] = XK_Next;
- break;
- case K_HELP:
- k[j] = XK_Help;
- break;
- case K_DO:
- k[j] = XK_Execute;
- break;
- case K_PAUSE:
- k[j] = XK_Pause;
- break;
- case K_MACRO:
- k[j] = XK_Menu;
- break;
- default:
- break;
- }
- break;
-
- case KT_SPEC:
- switch (kbe.kb_value)
- {
- case K_ENTER:
- k[j] = XK_Return;
- break;
- case K_BREAK:
- k[j] = XK_Break;
- break;
- case K_CAPS:
- k[j] = XK_Caps_Lock;
- break;
- case K_NUM:
- k[j] = XK_Num_Lock;
- break;
- case K_HOLD:
- k[j] = XK_Scroll_Lock;
- break;
- case K_COMPOSE:
- k[j] = XK_Multi_key;
- break;
- default:
- break;
- }
- break;
-
- case KT_PAD:
- switch (kbe.kb_value)
- {
- case K_PPLUS:
- k[j] = XK_KP_Add;
- break;
- case K_PMINUS:
- k[j] = XK_KP_Subtract;
- break;
- case K_PSTAR:
- k[j] = XK_KP_Multiply;
- break;
- case K_PSLASH:
- k[j] = XK_KP_Divide;
- break;
- case K_PENTER:
- k[j] = XK_KP_Enter;
- break;
- case K_PCOMMA:
- k[j] = XK_KP_Separator;
- break;
- case K_PDOT:
- k[j] = XK_KP_Decimal;
- break;
- case K_PPLUSMINUS:
- k[j] = XK_KP_Subtract;
- break;
- default:
- if (kval <= 9)
- k[j] = XK_KP_0 + kval;
- break;
- }
- break;
-
- /*
- * KT_DEAD keys are for accelerated diacritical creation.
- */
- case KT_DEAD:
- switch (kbe.kb_value)
- {
- case K_DGRAVE:
- k[j] = XK_dead_grave;
- break;
- case K_DACUTE:
- k[j] = XK_dead_acute;
- break;
- case K_DCIRCM:
- k[j] = XK_dead_circumflex;
- break;
- case K_DTILDE:
- k[j] = XK_dead_tilde;
- break;
- case K_DDIERE:
- k[j] = XK_dead_diaeresis;
- break;
- }
- break;
-
- case KT_CUR:
- switch (kbe.kb_value)
- {
- case K_DOWN:
- k[j] = XK_Down;
- break;
- case K_LEFT:
- k[j] = XK_Left;
- break;
- case K_RIGHT:
- k[j] = XK_Right;
- break;
- case K_UP:
- k[j] = XK_Up;
- break;
- }
- break;
-
- case KT_SHIFT:
- switch (kbe.kb_value)
- {
- case K_ALTGR:
- k[j] = XK_Mode_switch;
- break;
- case K_ALT:
- k[j] = (kbe.kb_index == 0x64 ?
- XK_Alt_R : XK_Alt_L);
- break;
- case K_CTRL:
- k[j] = (kbe.kb_index == 0x61 ?
- XK_Control_R : XK_Control_L);
- break;
- case K_CTRLL:
- k[j] = XK_Control_L;
- break;
- case K_CTRLR:
- k[j] = XK_Control_R;
- break;
- case K_SHIFT:
- k[j] = (kbe.kb_index == 0x36 ?
- XK_Shift_R : XK_Shift_L);
- break;
- case K_SHIFTL:
- k[j] = XK_Shift_L;
- break;
- case K_SHIFTR:
- k[j] = XK_Shift_R;
- break;
- default:
- break;
- }
- break;
-
- /*
- * KT_ASCII keys accumulate a 3 digit decimal number that gets
- * emitted when the shift state changes. We can't emulate that.
- */
- case KT_ASCII:
- break;
-
- case KT_LOCK:
- if (kbe.kb_value == K_SHIFTLOCK)
- k[j] = XK_Shift_Lock;
- break;
+ for (j = 0; j < ki->keySyms.mapWidth; ++j) {
+ unsigned short kval;
+
+ k[j] = NoSymbol;
+
+ kbe.kb_table = tbl[j];
+ kbe.kb_value = 0;
+ if (ioctl(fd, KDGKBENT, &kbe))
+ continue;
+
+ kval = KVAL(kbe.kb_value);
+ switch (KTYP(kbe.kb_value)) {
+ case KT_LATIN:
+ case KT_LETTER:
+ k[j] = linux_to_x[kval];
+ break;
+
+ case KT_FN:
+ if (kval <= 19)
+ k[j] = XK_F1 + kval;
+ else
+ switch (kbe.kb_value) {
+ case K_FIND:
+ k[j] = XK_Home; /* or XK_Find */
+ break;
+ case K_INSERT:
+ k[j] = XK_Insert;
+ break;
+ case K_REMOVE:
+ k[j] = XK_Delete;
+ break;
+ case K_SELECT:
+ k[j] = XK_End; /* or XK_Select */
+ break;
+ case K_PGUP:
+ k[j] = XK_Prior;
+ break;
+ case K_PGDN:
+ k[j] = XK_Next;
+ break;
+ case K_HELP:
+ k[j] = XK_Help;
+ break;
+ case K_DO:
+ k[j] = XK_Execute;
+ break;
+ case K_PAUSE:
+ k[j] = XK_Pause;
+ break;
+ case K_MACRO:
+ k[j] = XK_Menu;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case KT_SPEC:
+ switch (kbe.kb_value) {
+ case K_ENTER:
+ k[j] = XK_Return;
+ break;
+ case K_BREAK:
+ k[j] = XK_Break;
+ break;
+ case K_CAPS:
+ k[j] = XK_Caps_Lock;
+ break;
+ case K_NUM:
+ k[j] = XK_Num_Lock;
+ break;
+ case K_HOLD:
+ k[j] = XK_Scroll_Lock;
+ break;
+ case K_COMPOSE:
+ k[j] = XK_Multi_key;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case KT_PAD:
+ switch (kbe.kb_value) {
+ case K_PPLUS:
+ k[j] = XK_KP_Add;
+ break;
+ case K_PMINUS:
+ k[j] = XK_KP_Subtract;
+ break;
+ case K_PSTAR:
+ k[j] = XK_KP_Multiply;
+ break;
+ case K_PSLASH:
+ k[j] = XK_KP_Divide;
+ break;
+ case K_PENTER:
+ k[j] = XK_KP_Enter;
+ break;
+ case K_PCOMMA:
+ k[j] = XK_KP_Separator;
+ break;
+ case K_PDOT:
+ k[j] = XK_KP_Decimal;
+ break;
+ case K_PPLUSMINUS:
+ k[j] = XK_KP_Subtract;
+ break;
+ default:
+ if (kval <= 9)
+ k[j] = XK_KP_0 + kval;
+ break;
+ }
+ break;
+
+ /*
+ * KT_DEAD keys are for accelerated diacritical creation.
+ */
+ case KT_DEAD:
+ switch (kbe.kb_value) {
+ case K_DGRAVE:
+ k[j] = XK_dead_grave;
+ break;
+ case K_DACUTE:
+ k[j] = XK_dead_acute;
+ break;
+ case K_DCIRCM:
+ k[j] = XK_dead_circumflex;
+ break;
+ case K_DTILDE:
+ k[j] = XK_dead_tilde;
+ break;
+ case K_DDIERE:
+ k[j] = XK_dead_diaeresis;
+ break;
+ }
+ break;
+
+ case KT_CUR:
+ switch (kbe.kb_value) {
+ case K_DOWN:
+ k[j] = XK_Down;
+ break;
+ case K_LEFT:
+ k[j] = XK_Left;
+ break;
+ case K_RIGHT:
+ k[j] = XK_Right;
+ break;
+ case K_UP:
+ k[j] = XK_Up;
+ break;
+ }
+ break;
+
+ case KT_SHIFT:
+ switch (kbe.kb_value) {
+ case K_ALTGR:
+ k[j] = XK_Mode_switch;
+ break;
+ case K_ALT:
+ k[j] = (kbe.kb_index == 0x64 ? XK_Alt_R : XK_Alt_L);
+ break;
+ case K_CTRL:
+ k[j] = (kbe.kb_index == 0x61 ? XK_Control_R : XK_Control_L);
+ break;
+ case K_CTRLL:
+ k[j] = XK_Control_L;
+ break;
+ case K_CTRLR:
+ k[j] = XK_Control_R;
+ break;
+ case K_SHIFT:
+ k[j] = (kbe.kb_index == 0x36 ? XK_Shift_R : XK_Shift_L);
+ break;
+ case K_SHIFTL:
+ k[j] = XK_Shift_L;
+ break;
+ case K_SHIFTR:
+ k[j] = XK_Shift_R;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ /*
+ * KT_ASCII keys accumulate a 3 digit decimal number that gets
+ * emitted when the shift state changes. We can't emulate that.
+ */
+ case KT_ASCII:
+ break;
+
+ case KT_LOCK:
+ if (kbe.kb_value == K_SHIFTLOCK)
+ k[j] = XK_Shift_Lock;
+ break;
#ifdef KT_X
- case KT_X:
- /* depends on new keyboard symbols in file linux/keyboard.h */
- if(kbe.kb_value == K_XMENU) k[j] = XK_Menu;
- if(kbe.kb_value == K_XTELEPHONE) k[j] = XK_telephone;
- break;
+ case KT_X:
+ /* depends on new keyboard symbols in file linux/keyboard.h */
+ if (kbe.kb_value == K_XMENU)
+ k[j] = XK_Menu;
+ if (kbe.kb_value == K_XTELEPHONE)
+ k[j] = XK_telephone;
+ break;
#endif
#ifdef KT_XF
- case KT_XF:
- /* special linux keysyms which map directly to XF86 keysyms */
- k[j] = (kbe.kb_value & 0xFF) + 0x1008FF00;
- break;
+ case KT_XF:
+ /* special linux keysyms which map directly to XF86 keysyms */
+ k[j] = (kbe.kb_value & 0xFF) + 0x1008FF00;
+ break;
#endif
- default:
- break;
- }
- if (i < minKeyCode)
- minKeyCode = i;
- if (i > maxKeyCode)
- maxKeyCode = i;
- }
-
- if (minKeyCode == NR_KEYS)
- continue;
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] =NoSymbol;
- row++;
+ default:
+ break;
+ }
+ if (i < minKeyCode)
+ minKeyCode = i;
+ if (i > maxKeyCode)
+ maxKeyCode = i;
+ }
+
+ if (minKeyCode == NR_KEYS)
+ continue;
+
+ if (k[3] == k[2])
+ k[3] = NoSymbol;
+ if (k[2] == k[1])
+ k[2] = NoSymbol;
+ if (k[1] == k[0])
+ k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3])
+ k[2] = k[3] = NoSymbol;
+ if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol)
+ k[3] = NoSymbol;
+ row++;
}
ki->minScanCode = minKeyCode;
ki->maxScanCode = maxKeyCode;
@@ -551,142 +545,166 @@ readKernelMapping(KdKeyboardInfo *ki)
#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
static void
-LinuxKeyboardRead (int fd, void *closure)
+LinuxKeyboardRead(int fd, void *closure)
{
- unsigned char buf[256], *b;
- int n;
- unsigned char prefix = 0, scancode = 0;
+ unsigned char buf[256], *b;
+ int n;
+ unsigned char prefix = 0, scancode = 0;
- while ((n = read (fd, buf, sizeof (buf))) > 0) {
- b = buf;
- while (n--) {
+ while ((n = read(fd, buf, sizeof(buf))) > 0) {
+ b = buf;
+ while (n--) {
/*
* With xkb we use RAW mode for reading the console, which allows us
* process extended scancodes.
*
* See if this is a prefix extending the following keycode
*/
- if (!prefix && ((b[0] & 0x7f) == KEY_Prefix0))
- {
- prefix = KEY_Prefix0;
- /* swallow this up */
- b++;
- continue;
+ if (!prefix && ((b[0] & 0x7f) == KEY_Prefix0)) {
+ prefix = KEY_Prefix0;
+ /* swallow this up */
+ b++;
+ continue;
}
- else if (!prefix && ((b[0] & 0x7f) == KEY_Prefix1))
- {
- prefix = KEY_Prefix1;
- /* swallow this up */
- b++;
- continue;
+ else if (!prefix && ((b[0] & 0x7f) == KEY_Prefix1)) {
+ prefix = KEY_Prefix1;
+ /* swallow this up */
+ b++;
+ continue;
}
scancode = b[0] & 0x7f;
switch (prefix) {
- /* from xf86Events.c */
- case KEY_Prefix0:
- {
- switch (scancode) {
- case KEY_KP_7:
- scancode = KEY_Home; break; /* curs home */
- case KEY_KP_8:
- scancode = KEY_Up; break; /* curs up */
- case KEY_KP_9:
- scancode = KEY_PgUp; break; /* curs pgup */
- case KEY_KP_4:
- scancode = KEY_Left; break; /* curs left */
- case KEY_KP_5:
- scancode = KEY_Begin; break; /* curs begin */
- case KEY_KP_6:
- scancode = KEY_Right; break; /* curs right */
- case KEY_KP_1:
- scancode = KEY_End; break; /* curs end */
- case KEY_KP_2:
- scancode = KEY_Down; break; /* curs down */
- case KEY_KP_3:
- scancode = KEY_PgDown; break; /* curs pgdown */
- case KEY_KP_0:
- scancode = KEY_Insert; break; /* curs insert */
- case KEY_KP_Decimal:
- scancode = KEY_Delete; break; /* curs delete */
- case KEY_Enter:
- scancode = KEY_KP_Enter; break; /* keypad enter */
- case KEY_LCtrl:
- scancode = KEY_RCtrl; break; /* right ctrl */
- case KEY_KP_Multiply:
- scancode = KEY_Print; break; /* print */
- case KEY_Slash:
- scancode = KEY_KP_Divide; break; /* keyp divide */
- case KEY_Alt:
- scancode = KEY_AltLang; break; /* right alt */
- case KEY_ScrollLock:
- scancode = KEY_Break; break; /* curs break */
- case 0x5b:
- scancode = KEY_LMeta; break;
- case 0x5c:
- scancode = KEY_RMeta; break;
- case 0x5d:
- scancode = KEY_Menu; break;
- case KEY_F3:
- scancode = KEY_F13; break;
- case KEY_F4:
- scancode = KEY_F14; break;
- case KEY_F5:
- scancode = KEY_F15; break;
- case KEY_F6:
- scancode = KEY_F16; break;
- case KEY_F7:
- scancode = KEY_F17; break;
- case KEY_KP_Plus:
- scancode = KEY_KP_DEC; break;
- /* Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) */
- case 0x2A:
- case 0x36:
- b++;
- prefix = 0;
- continue;
- default:
- /*
- * "Internet" keyboards are generating lots of new
- * codes. Let them pass. There is little consistency
- * between them, so don't bother with symbolic names at
- * this level.
- */
- scancode += 0x78;
- }
- break;
- }
+ /* from xf86Events.c */
+ case KEY_Prefix0:
+ {
+ switch (scancode) {
+ case KEY_KP_7:
+ scancode = KEY_Home;
+ break; /* curs home */
+ case KEY_KP_8:
+ scancode = KEY_Up;
+ break; /* curs up */
+ case KEY_KP_9:
+ scancode = KEY_PgUp;
+ break; /* curs pgup */
+ case KEY_KP_4:
+ scancode = KEY_Left;
+ break; /* curs left */
+ case KEY_KP_5:
+ scancode = KEY_Begin;
+ break; /* curs begin */
+ case KEY_KP_6:
+ scancode = KEY_Right;
+ break; /* curs right */
+ case KEY_KP_1:
+ scancode = KEY_End;
+ break; /* curs end */
+ case KEY_KP_2:
+ scancode = KEY_Down;
+ break; /* curs down */
+ case KEY_KP_3:
+ scancode = KEY_PgDown;
+ break; /* curs pgdown */
+ case KEY_KP_0:
+ scancode = KEY_Insert;
+ break; /* curs insert */
+ case KEY_KP_Decimal:
+ scancode = KEY_Delete;
+ break; /* curs delete */
+ case KEY_Enter:
+ scancode = KEY_KP_Enter;
+ break; /* keypad enter */
+ case KEY_LCtrl:
+ scancode = KEY_RCtrl;
+ break; /* right ctrl */
+ case KEY_KP_Multiply:
+ scancode = KEY_Print;
+ break; /* print */
+ case KEY_Slash:
+ scancode = KEY_KP_Divide;
+ break; /* keyp divide */
+ case KEY_Alt:
+ scancode = KEY_AltLang;
+ break; /* right alt */
+ case KEY_ScrollLock:
+ scancode = KEY_Break;
+ break; /* curs break */
+ case 0x5b:
+ scancode = KEY_LMeta;
+ break;
+ case 0x5c:
+ scancode = KEY_RMeta;
+ break;
+ case 0x5d:
+ scancode = KEY_Menu;
+ break;
+ case KEY_F3:
+ scancode = KEY_F13;
+ break;
+ case KEY_F4:
+ scancode = KEY_F14;
+ break;
+ case KEY_F5:
+ scancode = KEY_F15;
+ break;
+ case KEY_F6:
+ scancode = KEY_F16;
+ break;
+ case KEY_F7:
+ scancode = KEY_F17;
+ break;
+ case KEY_KP_Plus:
+ scancode = KEY_KP_DEC;
+ break;
+ /* Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) */
+ case 0x2A:
+ case 0x36:
+ b++;
+ prefix = 0;
+ continue;
+ default:
+ /*
+ * "Internet" keyboards are generating lots of new
+ * codes. Let them pass. There is little consistency
+ * between them, so don't bother with symbolic names at
+ * this level.
+ */
+ scancode += 0x78;
+ }
+ break;
+ }
- case KEY_Prefix1:
- {
- /* we do no handle these */
- b++;
- prefix = 0;
- continue;
- }
+ case KEY_Prefix1:
+ {
+ /* we do no handle these */
+ b++;
+ prefix = 0;
+ continue;
+ }
- default: /* should not happen*/
- case 0: /* do nothing */
- ;
+ default: /* should not happen */
+ case 0: /* do nothing */
+ ;
}
prefix = 0;
- KdEnqueueKeyboardEvent (closure, scancode, b[0] & 0x80);
- b++;
- }
+ KdEnqueueKeyboardEvent(closure, scancode, b[0] & 0x80);
+ b++;
+ }
}
}
-static int LinuxKbdTrans;
-static struct termios LinuxTermios;
+static int LinuxKbdTrans;
+static struct termios LinuxTermios;
static Status
-LinuxKeyboardEnable (KdKeyboardInfo *ki)
+LinuxKeyboardEnable(KdKeyboardInfo * ki)
{
struct termios nTty;
- unsigned char buf[256];
- int n;
- int fd;
+ unsigned char buf[256];
+ int n;
+ int fd;
if (!ki)
return !Success;
@@ -694,30 +712,29 @@ LinuxKeyboardEnable (KdKeyboardInfo *ki)
fd = LinuxConsoleFd;
ki->driverPrivate = (void *) (intptr_t) fd;
- ioctl (fd, KDGKBMODE, &LinuxKbdTrans);
- tcgetattr (fd, &LinuxTermios);
+ ioctl(fd, KDGKBMODE, &LinuxKbdTrans);
+ tcgetattr(fd, &LinuxTermios);
ioctl(fd, KDSKBMODE, K_RAW);
nTty = LinuxTermios;
nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
nTty.c_oflag = 0;
nTty.c_cflag = CREAD | CS8;
nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
+ nTty.c_cc[VTIME] = 0;
+ nTty.c_cc[VMIN] = 1;
cfsetispeed(&nTty, 9600);
cfsetospeed(&nTty, 9600);
tcsetattr(fd, TCSANOW, &nTty);
/*
* Flush any pending keystrokes
*/
- while ((n = read (fd, buf, sizeof (buf))) > 0)
- ;
- KdRegisterFd (fd, LinuxKeyboardRead, ki);
+ while ((n = read(fd, buf, sizeof(buf))) > 0);
+ KdRegisterFd(fd, LinuxKeyboardRead, ki);
return Success;
}
static void
-LinuxKeyboardDisable (KdKeyboardInfo *ki)
+LinuxKeyboardDisable(KdKeyboardInfo * ki)
{
int fd;
@@ -732,7 +749,7 @@ LinuxKeyboardDisable (KdKeyboardInfo *ki)
}
static Status
-LinuxKeyboardInit (KdKeyboardInfo *ki)
+LinuxKeyboardInit(KdKeyboardInfo * ki)
{
if (!ki)
return !Success;
@@ -742,18 +759,18 @@ LinuxKeyboardInit (KdKeyboardInfo *ki)
free(ki->name);
ki->name = strdup("Linux console keyboard");
- readKernelMapping (ki);
+ readKernelMapping(ki);
return Success;
}
static void
-LinuxKeyboardLeds (KdKeyboardInfo *ki, int leds)
+LinuxKeyboardLeds(KdKeyboardInfo * ki, int leds)
{
if (!ki)
return;
- ioctl ((int)(intptr_t)ki->driverPrivate, KDSETLED, leds & 7);
+ ioctl((int) (intptr_t) ki->driverPrivate, KDSETLED, leds & 7);
}
KdKeyboardDriver LinuxKeyboardDriver = {
diff --git a/xorg-server/hw/kdrive/linux/linux.c b/xorg-server/hw/kdrive/linux/linux.c
index 194e7cd59..498c2398d 100644
--- a/xorg-server/hw/kdrive/linux/linux.c
+++ b/xorg-server/hw/kdrive/linux/linux.c
@@ -34,51 +34,51 @@
#include <linux/apm_bios.h>
#ifdef KDRIVE_MOUSE
-extern KdPointerDriver LinuxMouseDriver;
-extern KdPointerDriver Ps2MouseDriver;
-extern KdPointerDriver MsMouseDriver;
+extern KdPointerDriver LinuxMouseDriver;
+extern KdPointerDriver Ps2MouseDriver;
+extern KdPointerDriver MsMouseDriver;
#endif
#ifdef TSLIB
-extern KdPointerDriver TsDriver;
+extern KdPointerDriver TsDriver;
#endif
#ifdef KDRIVE_EVDEV
-extern KdPointerDriver LinuxEvdevMouseDriver;
+extern KdPointerDriver LinuxEvdevMouseDriver;
extern KdKeyboardDriver LinuxEvdevKeyboardDriver;
#endif
#ifdef KDRIVE_KBD
-extern KdKeyboardDriver LinuxKeyboardDriver;
+extern KdKeyboardDriver LinuxKeyboardDriver;
#endif
-static int vtno;
-int LinuxConsoleFd;
-int LinuxApmFd = -1;
-static int activeVT;
+static int vtno;
+int LinuxConsoleFd;
+int LinuxApmFd = -1;
+static int activeVT;
static Bool enabled;
static void
-LinuxVTRequest (int sig)
+LinuxVTRequest(int sig)
{
kdSwitchPending = TRUE;
}
/* Check before chowning -- this avoids touching the file system */
static void
-LinuxCheckChown (char *file)
+LinuxCheckChown(char *file)
{
- struct stat st;
- __uid_t u;
- __gid_t g;
-
- if (stat (file, &st) < 0)
- return;
- u = getuid ();
- g = getgid ();
+ struct stat st;
+ __uid_t u;
+ __gid_t g;
+
+ if (stat(file, &st) < 0)
+ return;
+ u = getuid();
+ g = getgid();
if (st.st_uid != u || st.st_gid != g)
- chown (file, u, g);
+ chown(file, u, g);
}
static int
-LinuxInit (void)
+LinuxInit(void)
{
int fd = -1;
char vtname[11];
@@ -86,39 +86,31 @@ LinuxInit (void)
LinuxConsoleFd = -1;
/* check if we're run with euid==0 */
- if (geteuid() != 0)
- {
- FatalError("LinuxInit: Server must be suid root\n");
+ if (geteuid() != 0) {
+ FatalError("LinuxInit: Server must be suid root\n");
}
if (kdVirtualTerminal >= 0)
- vtno = kdVirtualTerminal;
- else
- {
- if ((fd = open("/dev/tty0",O_WRONLY,0)) < 0)
- {
- FatalError(
- "LinuxInit: Cannot open /dev/tty0 (%s)\n",
- strerror(errno));
- }
- if ((ioctl(fd, VT_OPENQRY, &vtno) < 0) ||
- (vtno == -1))
- {
- FatalError("xf86OpenConsole: Cannot find a free VT\n");
- }
- close(fd);
+ vtno = kdVirtualTerminal;
+ else {
+ if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) {
+ FatalError("LinuxInit: Cannot open /dev/tty0 (%s)\n",
+ strerror(errno));
+ }
+ if ((ioctl(fd, VT_OPENQRY, &vtno) < 0) || (vtno == -1)) {
+ FatalError("xf86OpenConsole: Cannot find a free VT\n");
+ }
+ close(fd);
}
- snprintf(vtname,sizeof(vtname),"/dev/tty%d",vtno); /* /dev/tty1-64 */
+ snprintf(vtname, sizeof(vtname), "/dev/tty%d", vtno); /* /dev/tty1-64 */
- if ((LinuxConsoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) < 0)
- {
- FatalError("LinuxInit: Cannot open %s (%s)\n",
- vtname, strerror(errno));
+ if ((LinuxConsoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) < 0) {
+ FatalError("LinuxInit: Cannot open %s (%s)\n", vtname, strerror(errno));
}
/* change ownership of the vt */
- LinuxCheckChown (vtname);
+ LinuxCheckChown(vtname);
/*
* the current VT device we're running on is not "console", we want
@@ -126,109 +118,100 @@ LinuxInit (void)
*
* Why is this needed?
*/
- LinuxCheckChown ("/dev/tty0");
+ LinuxCheckChown("/dev/tty0");
/*
* Linux doesn't switch to an active vt after the last close of a vt,
* so we do this ourselves by remembering which is active now.
*/
- memset (&vts, '\0', sizeof (vts)); /* valgrind */
- if (ioctl(LinuxConsoleFd, VT_GETSTATE, &vts) == 0)
- {
- activeVT = vts.v_active;
+ memset(&vts, '\0', sizeof(vts)); /* valgrind */
+ if (ioctl(LinuxConsoleFd, VT_GETSTATE, &vts) == 0) {
+ activeVT = vts.v_active;
}
return 1;
}
static void
-LinuxSetSwitchMode (int mode)
+LinuxSetSwitchMode(int mode)
{
- struct sigaction act;
- struct vt_mode VT;
+ struct sigaction act;
+ struct vt_mode VT;
- if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) < 0)
- {
- FatalError ("LinuxInit: VT_GETMODE failed\n");
+ if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) < 0) {
+ FatalError("LinuxInit: VT_GETMODE failed\n");
}
- if (mode == VT_PROCESS)
- {
- act.sa_handler = LinuxVTRequest;
- sigemptyset (&act.sa_mask);
- act.sa_flags = 0;
- sigaction (SIGUSR1, &act, 0);
+ if (mode == VT_PROCESS) {
+ act.sa_handler = LinuxVTRequest;
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction(SIGUSR1, &act, 0);
- VT.mode = mode;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
+ VT.mode = mode;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
}
- else
- {
- act.sa_handler = SIG_IGN;
- sigemptyset (&act.sa_mask);
- act.sa_flags = 0;
- sigaction (SIGUSR1, &act, 0);
-
- VT.mode = mode;
- VT.relsig = 0;
- VT.acqsig = 0;
+ else {
+ act.sa_handler = SIG_IGN;
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction(SIGUSR1, &act, 0);
+
+ VT.mode = mode;
+ VT.relsig = 0;
+ VT.acqsig = 0;
}
- if (ioctl(LinuxConsoleFd, VT_SETMODE, &VT) < 0)
- {
- FatalError("LinuxInit: VT_SETMODE failed\n");
+ if (ioctl(LinuxConsoleFd, VT_SETMODE, &VT) < 0) {
+ FatalError("LinuxInit: VT_SETMODE failed\n");
}
}
static void
-LinuxApmBlock (pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+LinuxApmBlock(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
{
}
static Bool LinuxApmRunning;
static void
-LinuxApmWakeup (pointer blockData, int result, pointer pReadmask)
+LinuxApmWakeup(pointer blockData, int result, pointer pReadmask)
{
- fd_set *readmask = (fd_set *) pReadmask;
-
- if (result > 0 && LinuxApmFd >= 0 && FD_ISSET (LinuxApmFd, readmask))
- {
- apm_event_t event;
- Bool running = LinuxApmRunning;
- int cmd = APM_IOC_SUSPEND;
-
- while (read (LinuxApmFd, &event, sizeof (event)) == sizeof (event))
- {
- switch (event) {
- case APM_SYS_STANDBY:
- case APM_USER_STANDBY:
- running = FALSE;
- cmd = APM_IOC_STANDBY;
- break;
- case APM_SYS_SUSPEND:
- case APM_USER_SUSPEND:
- case APM_CRITICAL_SUSPEND:
- running = FALSE;
- cmd = APM_IOC_SUSPEND;
- break;
- case APM_NORMAL_RESUME:
- case APM_CRITICAL_RESUME:
- case APM_STANDBY_RESUME:
- running = TRUE;
- break;
- }
- }
- if (running && !LinuxApmRunning)
- {
- KdResume ();
- LinuxApmRunning = TRUE;
- }
- else if (!running && LinuxApmRunning)
- {
- KdSuspend ();
- LinuxApmRunning = FALSE;
- ioctl (LinuxApmFd, cmd, 0);
- }
+ fd_set *readmask = (fd_set *) pReadmask;
+
+ if (result > 0 && LinuxApmFd >= 0 && FD_ISSET(LinuxApmFd, readmask)) {
+ apm_event_t event;
+ Bool running = LinuxApmRunning;
+ int cmd = APM_IOC_SUSPEND;
+
+ while (read(LinuxApmFd, &event, sizeof(event)) == sizeof(event)) {
+ switch (event) {
+ case APM_SYS_STANDBY:
+ case APM_USER_STANDBY:
+ running = FALSE;
+ cmd = APM_IOC_STANDBY;
+ break;
+ case APM_SYS_SUSPEND:
+ case APM_USER_SUSPEND:
+ case APM_CRITICAL_SUSPEND:
+ running = FALSE;
+ cmd = APM_IOC_SUSPEND;
+ break;
+ case APM_NORMAL_RESUME:
+ case APM_CRITICAL_RESUME:
+ case APM_STANDBY_RESUME:
+ running = TRUE;
+ break;
+ }
+ }
+ if (running && !LinuxApmRunning) {
+ KdResume();
+ LinuxApmRunning = TRUE;
+ }
+ else if (!running && LinuxApmRunning) {
+ KdSuspend();
+ LinuxApmRunning = FALSE;
+ ioctl(LinuxApmFd, cmd, 0);
+ }
}
}
@@ -239,127 +222,115 @@ LinuxApmWakeup (pointer blockData, int result, pointer pReadmask)
#endif
static void
-LinuxEnable (void)
+LinuxEnable(void)
{
if (enabled)
- return;
- if (kdSwitchPending)
- {
- kdSwitchPending = FALSE;
- ioctl (LinuxConsoleFd, VT_RELDISP, VT_ACKACQ);
+ return;
+ if (kdSwitchPending) {
+ kdSwitchPending = FALSE;
+ ioctl(LinuxConsoleFd, VT_RELDISP, VT_ACKACQ);
}
/*
* Open the APM driver
*/
- LinuxApmFd = open ("/dev/apm_bios", 2);
+ LinuxApmFd = open("/dev/apm_bios", 2);
if (LinuxApmFd < 0 && errno == ENOENT)
- LinuxApmFd = open ("/dev/misc/apm_bios", 2);
- if (LinuxApmFd >= 0)
- {
- LinuxApmRunning = TRUE;
- fcntl (LinuxApmFd, F_SETFL, fcntl (LinuxApmFd, F_GETFL) | NOBLOCK);
- RegisterBlockAndWakeupHandlers (LinuxApmBlock, LinuxApmWakeup, 0);
- AddEnabledDevice (LinuxApmFd);
+ LinuxApmFd = open("/dev/misc/apm_bios", 2);
+ if (LinuxApmFd >= 0) {
+ LinuxApmRunning = TRUE;
+ fcntl(LinuxApmFd, F_SETFL, fcntl(LinuxApmFd, F_GETFL) | NOBLOCK);
+ RegisterBlockAndWakeupHandlers(LinuxApmBlock, LinuxApmWakeup, 0);
+ AddEnabledDevice(LinuxApmFd);
}
/*
* now get the VT
*/
- LinuxSetSwitchMode (VT_AUTO);
- if (ioctl(LinuxConsoleFd, VT_ACTIVATE, vtno) != 0)
- {
- FatalError("LinuxInit: VT_ACTIVATE failed\n");
+ LinuxSetSwitchMode(VT_AUTO);
+ if (ioctl(LinuxConsoleFd, VT_ACTIVATE, vtno) != 0) {
+ FatalError("LinuxInit: VT_ACTIVATE failed\n");
}
- if (ioctl(LinuxConsoleFd, VT_WAITACTIVE, vtno) != 0)
- {
- FatalError("LinuxInit: VT_WAITACTIVE failed\n");
+ if (ioctl(LinuxConsoleFd, VT_WAITACTIVE, vtno) != 0) {
+ FatalError("LinuxInit: VT_WAITACTIVE failed\n");
}
- LinuxSetSwitchMode (VT_PROCESS);
- if (ioctl(LinuxConsoleFd, KDSETMODE, KD_GRAPHICS) < 0)
- {
- FatalError("LinuxInit: KDSETMODE KD_GRAPHICS failed\n");
+ LinuxSetSwitchMode(VT_PROCESS);
+ if (ioctl(LinuxConsoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
+ FatalError("LinuxInit: KDSETMODE KD_GRAPHICS failed\n");
}
enabled = TRUE;
}
static void
-LinuxDisable (void)
+LinuxDisable(void)
{
ioctl(LinuxConsoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */
- if (kdSwitchPending)
- {
- kdSwitchPending = FALSE;
- ioctl (LinuxConsoleFd, VT_RELDISP, 1);
+ if (kdSwitchPending) {
+ kdSwitchPending = FALSE;
+ ioctl(LinuxConsoleFd, VT_RELDISP, 1);
}
enabled = FALSE;
- if (LinuxApmFd >= 0)
- {
- RemoveBlockAndWakeupHandlers (LinuxApmBlock, LinuxApmWakeup, 0);
- RemoveEnabledDevice (LinuxApmFd);
- close (LinuxApmFd);
- LinuxApmFd = -1;
+ if (LinuxApmFd >= 0) {
+ RemoveBlockAndWakeupHandlers(LinuxApmBlock, LinuxApmWakeup, 0);
+ RemoveEnabledDevice(LinuxApmFd);
+ close(LinuxApmFd);
+ LinuxApmFd = -1;
}
}
static void
-LinuxFini (void)
+LinuxFini(void)
{
- struct vt_mode VT;
- struct vt_stat vts;
- int fd;
+ struct vt_mode VT;
+ struct vt_stat vts;
+ int fd;
if (LinuxConsoleFd < 0)
- return;
+ return;
- if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) != -1)
- {
- VT.mode = VT_AUTO;
- ioctl(LinuxConsoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
+ if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) != -1) {
+ VT.mode = VT_AUTO;
+ ioctl(LinuxConsoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
}
- memset (&vts, '\0', sizeof (vts)); /* valgrind */
- ioctl (LinuxConsoleFd, VT_GETSTATE, &vts);
- if (vtno == vts.v_active)
- {
- /*
- * Find a legal VT to switch to, either the one we started from
- * or the lowest active one that isn't ours
- */
- if (activeVT < 0 ||
- activeVT == vts.v_active ||
- !(vts.v_state & (1 << activeVT)))
- {
- for (activeVT = 1; activeVT < 16; activeVT++)
- if (activeVT != vtno && (vts.v_state & (1 << activeVT)))
- break;
- if (activeVT == 16)
- activeVT = -1;
- }
- /*
- * Perform a switch back to the active VT when we were started
- */
- if (activeVT >= -1)
- {
- ioctl (LinuxConsoleFd, VT_ACTIVATE, activeVT);
- ioctl (LinuxConsoleFd, VT_WAITACTIVE, activeVT);
- activeVT = -1;
- }
+ memset(&vts, '\0', sizeof(vts)); /* valgrind */
+ ioctl(LinuxConsoleFd, VT_GETSTATE, &vts);
+ if (vtno == vts.v_active) {
+ /*
+ * Find a legal VT to switch to, either the one we started from
+ * or the lowest active one that isn't ours
+ */
+ if (activeVT < 0 ||
+ activeVT == vts.v_active || !(vts.v_state & (1 << activeVT))) {
+ for (activeVT = 1; activeVT < 16; activeVT++)
+ if (activeVT != vtno && (vts.v_state & (1 << activeVT)))
+ break;
+ if (activeVT == 16)
+ activeVT = -1;
+ }
+ /*
+ * Perform a switch back to the active VT when we were started
+ */
+ if (activeVT >= -1) {
+ ioctl(LinuxConsoleFd, VT_ACTIVATE, activeVT);
+ ioctl(LinuxConsoleFd, VT_WAITACTIVE, activeVT);
+ activeVT = -1;
+ }
}
- close(LinuxConsoleFd); /* make the vt-manager happy */
+ close(LinuxConsoleFd); /* make the vt-manager happy */
LinuxConsoleFd = -1;
- fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0);
- if (fd >= 0)
- {
- memset (&vts, '\0', sizeof (vts)); /* valgrind */
- ioctl (fd, VT_GETSTATE, &vts);
- if (ioctl (fd, VT_DISALLOCATE, vtno) < 0)
- fprintf (stderr, "Can't deallocate console %d %s\n", vtno, strerror(errno));
- close (fd);
+ fd = open("/dev/tty0", O_RDWR | O_NDELAY, 0);
+ if (fd >= 0) {
+ memset(&vts, '\0', sizeof(vts)); /* valgrind */
+ ioctl(fd, VT_GETSTATE, &vts);
+ if (ioctl(fd, VT_DISALLOCATE, vtno) < 0)
+ fprintf(stderr, "Can't deallocate console %d %s\n", vtno,
+ strerror(errno));
+ close(fd);
}
return;
}
void
-KdOsAddInputDrivers (void)
+KdOsAddInputDrivers(void)
{
#ifdef KDRIVE_MOUSE
KdAddPointerDriver(&LinuxMouseDriver);
@@ -383,10 +354,10 @@ LinuxBell(int volume, int pitch, int duration)
{
if (volume && pitch)
ioctl(LinuxConsoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration * volume / 50) << 16));
+ (((unsigned long) duration * volume / 50) << 16));
}
-KdOsFuncs LinuxFuncs = {
+KdOsFuncs LinuxFuncs = {
.Init = LinuxInit,
.Enable = LinuxEnable,
.Disable = LinuxDisable,
@@ -395,7 +366,7 @@ KdOsFuncs LinuxFuncs = {
};
void
-OsVendorInit (void)
+OsVendorInit(void)
{
- KdOsInit (&LinuxFuncs);
+ KdOsInit(&LinuxFuncs);
}
diff --git a/xorg-server/hw/kdrive/linux/mouse.c b/xorg-server/hw/kdrive/linux/mouse.c
index 93c207817..c87507790 100644
--- a/xorg-server/hw/kdrive/linux/mouse.c
+++ b/xorg-server/hw/kdrive/linux/mouse.c
@@ -38,185 +38,176 @@
#define MOUSE_TIMEOUT 100
typedef struct _kbufio {
- int fd;
- unsigned char buf[KBUFIO_SIZE];
- int avail;
- int used;
+ int fd;
+ unsigned char buf[KBUFIO_SIZE];
+ int avail;
+ int used;
} Kbufio;
static Bool
-MouseWaitForReadable (int fd, int timeout)
+MouseWaitForReadable(int fd, int timeout)
{
- fd_set set;
- struct timeval tv, *tp;
- int n;
- CARD32 done;
-
- done = GetTimeInMillis () + timeout;
- for (;;)
- {
- FD_ZERO (&set);
- FD_SET (fd, &set);
- if (timeout == -1)
- tp = 0;
- else
- {
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
- tp = &tv;
- }
- n = select (fd + 1, &set, 0, 0, tp);
- if (n > 0)
- return TRUE;
- if (n < 0 && (errno == EAGAIN || errno == EINTR))
- {
- timeout = (int) (done - GetTimeInMillis ());
- if (timeout > 0)
- continue;
- }
- break;
+ fd_set set;
+ struct timeval tv, *tp;
+ int n;
+ CARD32 done;
+
+ done = GetTimeInMillis() + timeout;
+ for (;;) {
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
+ if (timeout == -1)
+ tp = 0;
+ else {
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout % 1000) * 1000;
+ tp = &tv;
+ }
+ n = select(fd + 1, &set, 0, 0, tp);
+ if (n > 0)
+ return TRUE;
+ if (n < 0 && (errno == EAGAIN || errno == EINTR)) {
+ timeout = (int) (done - GetTimeInMillis());
+ if (timeout > 0)
+ continue;
+ }
+ break;
}
return FALSE;
}
static int
-MouseReadByte (Kbufio *b, int timeout)
+MouseReadByte(Kbufio * b, int timeout)
{
- int n;
- if (b->avail <= b->used)
- {
- if (timeout && !MouseWaitForReadable (b->fd, timeout))
- {
+ int n;
+
+ if (b->avail <= b->used) {
+ if (timeout && !MouseWaitForReadable(b->fd, timeout)) {
#ifdef DEBUG_BYTES
- ErrorF ("\tTimeout %d\n", timeout);
+ ErrorF("\tTimeout %d\n", timeout);
#endif
- return -1;
- }
- n = read (b->fd, b->buf, KBUFIO_SIZE);
- if (n <= 0)
- return -1;
+ return -1;
+ }
+ n = read(b->fd, b->buf, KBUFIO_SIZE);
+ if (n <= 0)
+ return -1;
b->avail = n;
b->used = 0;
}
#ifdef DEBUG_BYTES
- ErrorF ("\tget %02x\n", b->buf[b->used]);
+ ErrorF("\tget %02x\n", b->buf[b->used]);
#endif
return b->buf[b->used++];
}
#if NOTUSED
static int
-MouseFlush (Kbufio *b, char *buf, int size)
+MouseFlush(Kbufio * b, char *buf, int size)
{
- CARD32 now = GetTimeInMillis ();
- CARD32 done = now + 100;
- int c;
- int n = 0;
-
- while ((c = MouseReadByte (b, done - now)) != -1)
- {
- if (buf)
- {
- if (n == size)
- {
- memmove (buf, buf + 1, size - 1);
- n--;
- }
- buf[n++] = c;
- }
- now = GetTimeInMillis ();
- if ((INT32) (now - done) >= 0)
- break;
+ CARD32 now = GetTimeInMillis();
+ CARD32 done = now + 100;
+ int c;
+ int n = 0;
+
+ while ((c = MouseReadByte(b, done - now)) != -1) {
+ if (buf) {
+ if (n == size) {
+ memmove(buf, buf + 1, size - 1);
+ n--;
+ }
+ buf[n++] = c;
+ }
+ now = GetTimeInMillis();
+ if ((INT32) (now - done) >= 0)
+ break;
}
return n;
}
static int
-MousePeekByte (Kbufio *b, int timeout)
+MousePeekByte(Kbufio * b, int timeout)
{
- int c;
+ int c;
- c = MouseReadByte (b, timeout);
+ c = MouseReadByte(b, timeout);
if (c != -1)
- --b->used;
+ --b->used;
return c;
}
-#endif /* NOTUSED */
+#endif /* NOTUSED */
static Bool
-MouseWaitForWritable (int fd, int timeout)
+MouseWaitForWritable(int fd, int timeout)
{
- fd_set set;
- struct timeval tv, *tp;
- int n;
+ fd_set set;
+ struct timeval tv, *tp;
+ int n;
- FD_ZERO (&set);
- FD_SET (fd, &set);
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
if (timeout == -1)
- tp = 0;
- else
- {
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
- tp = &tv;
+ tp = 0;
+ else {
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout % 1000) * 1000;
+ tp = &tv;
}
- n = select (fd + 1, 0, &set, 0, tp);
+ n = select(fd + 1, 0, &set, 0, tp);
if (n > 0)
- return TRUE;
+ return TRUE;
return FALSE;
}
static Bool
-MouseWriteByte (int fd, unsigned char c, int timeout)
+MouseWriteByte(int fd, unsigned char c, int timeout)
{
- int ret;
+ int ret;
#ifdef DEBUG_BYTES
- ErrorF ("\tput %02x\n", c);
+ ErrorF("\tput %02x\n", c);
#endif
- for (;;)
- {
- ret = write (fd, &c, 1);
- if (ret == 1)
- return TRUE;
- if (ret == 0)
- return FALSE;
- if (errno != EWOULDBLOCK)
- return FALSE;
- if (!MouseWaitForWritable (fd, timeout))
- return FALSE;
+ for (;;) {
+ ret = write(fd, &c, 1);
+ if (ret == 1)
+ return TRUE;
+ if (ret == 0)
+ return FALSE;
+ if (errno != EWOULDBLOCK)
+ return FALSE;
+ if (!MouseWaitForWritable(fd, timeout))
+ return FALSE;
}
}
static Bool
-MouseWriteBytes (int fd, unsigned char *c, int n, int timeout)
+MouseWriteBytes(int fd, unsigned char *c, int n, int timeout)
{
while (n--)
- if (!MouseWriteByte (fd, *c++, timeout))
- return FALSE;
+ if (!MouseWriteByte(fd, *c++, timeout))
+ return FALSE;
return TRUE;
}
-#define MAX_MOUSE 10 /* maximum length of mouse protocol */
-#define MAX_SKIP 16 /* number of error bytes before switching */
-#define MAX_VALID 4 /* number of valid packets before accepting */
+#define MAX_MOUSE 10 /* maximum length of mouse protocol */
+#define MAX_SKIP 16 /* number of error bytes before switching */
+#define MAX_VALID 4 /* number of valid packets before accepting */
typedef struct _kmouseProt {
- char *name;
- Bool (*Complete) (KdPointerInfo *pi, unsigned char *ev, int ne);
- int (*Valid) (KdPointerInfo *pi, unsigned char *ev, int ne);
- Bool (*Parse) (KdPointerInfo *pi, unsigned char *ev, int ne);
- Bool (*Init) (KdPointerInfo *pi);
- unsigned char headerMask, headerValid;
- unsigned char dataMask, dataValid;
- Bool tty;
- unsigned int c_iflag;
- unsigned int c_oflag;
- unsigned int c_lflag;
- unsigned int c_cflag;
- unsigned int speed;
- unsigned char *init;
- unsigned long state;
+ char *name;
+ Bool (*Complete) (KdPointerInfo * pi, unsigned char *ev, int ne);
+ int (*Valid) (KdPointerInfo * pi, unsigned char *ev, int ne);
+ Bool (*Parse) (KdPointerInfo * pi, unsigned char *ev, int ne);
+ Bool (*Init) (KdPointerInfo * pi);
+ unsigned char headerMask, headerValid;
+ unsigned char dataMask, dataValid;
+ Bool tty;
+ unsigned int c_iflag;
+ unsigned int c_oflag;
+ unsigned int c_lflag;
+ unsigned int c_cflag;
+ unsigned int speed;
+ unsigned char *init;
+ unsigned long state;
} KmouseProt;
typedef enum _kmouseStage {
@@ -224,68 +215,71 @@ typedef enum _kmouseStage {
} KmouseStage;
typedef struct _kmouse {
- Kbufio iob;
- const KmouseProt *prot;
- int i_prot;
- KmouseStage stage; /* protocol verification stage */
- Bool tty; /* mouse device is a tty */
- int valid; /* sequential valid events */
- int tested; /* bytes scanned during Testing phase */
- int invalid;/* total invalid bytes for this protocol */
- unsigned long state; /* private per protocol, init to prot->state */
+ Kbufio iob;
+ const KmouseProt *prot;
+ int i_prot;
+ KmouseStage stage; /* protocol verification stage */
+ Bool tty; /* mouse device is a tty */
+ int valid; /* sequential valid events */
+ int tested; /* bytes scanned during Testing phase */
+ int invalid; /* total invalid bytes for this protocol */
+ unsigned long state; /* private per protocol, init to prot->state */
} Kmouse;
-static int mouseValid (KdPointerInfo *pi, unsigned char *ev, int ne)
+static int
+mouseValid(KdPointerInfo * pi, unsigned char *ev, int ne)
{
- Kmouse *km = pi->driverPrivate;
- const KmouseProt *prot = km->prot;
- int i;
+ Kmouse *km = pi->driverPrivate;
+ const KmouseProt *prot = km->prot;
+ int i;
for (i = 0; i < ne; i++)
- if ((ev[i] & prot->headerMask) == prot->headerValid)
- break;
+ if ((ev[i] & prot->headerMask) == prot->headerValid)
+ break;
if (i != 0)
- return i;
+ return i;
for (i = 1; i < ne; i++)
- if ((ev[i] & prot->dataMask) != prot->dataValid)
- return -1;
+ if ((ev[i] & prot->dataMask) != prot->dataValid)
+ return -1;
return 0;
}
-static Bool threeComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
+static Bool
+threeComplete(KdPointerInfo * pi, unsigned char *ev, int ne)
{
return ne == 3;
}
-static Bool fourComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
+static Bool
+fourComplete(KdPointerInfo * pi, unsigned char *ev, int ne)
{
return ne == 4;
}
-static Bool fiveComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
+static Bool
+fiveComplete(KdPointerInfo * pi, unsigned char *ev, int ne)
{
return ne == 5;
}
-static Bool MouseReasonable (KdPointerInfo *pi, unsigned long flags, int dx, int dy)
+static Bool
+MouseReasonable(KdPointerInfo * pi, unsigned long flags, int dx, int dy)
{
- Kmouse *km = pi->driverPrivate;
+ Kmouse *km = pi->driverPrivate;
if (km->stage == MouseWorking)
- return TRUE;
- if (dx < -50 || dx > 50)
- {
+ return TRUE;
+ if (dx < -50 || dx > 50) {
#ifdef DEBUG
- ErrorF ("Large X %d\n", dx);
+ ErrorF("Large X %d\n", dx);
#endif
- return FALSE;
+ return FALSE;
}
- if (dy < -50 || dy > 50)
- {
+ if (dy < -50 || dy > 50) {
#ifdef DEBUG
- ErrorF ("Large Y %d\n", dy);
+ ErrorF("Large Y %d\n", dy);
#endif
- return FALSE;
+ return FALSE;
}
return TRUE;
}
@@ -293,58 +287,54 @@ static Bool MouseReasonable (KdPointerInfo *pi, unsigned long flags, int dx, int
/*
* Standard PS/2 mouse protocol
*/
-static Bool ps2Parse (KdPointerInfo *pi, unsigned char *ev, int ne)
+static Bool
+ps2Parse(KdPointerInfo * pi, unsigned char *ev, int ne)
{
- Kmouse *km = pi->driverPrivate;
- int dx, dy, dz;
- unsigned long flags;
- unsigned long flagsrelease = 0;
+ Kmouse *km = pi->driverPrivate;
+ int dx, dy, dz;
+ unsigned long flags;
+ unsigned long flagsrelease = 0;
flags = KD_MOUSE_DELTA;
if (ev[0] & 4)
- flags |= KD_BUTTON_2;
+ flags |= KD_BUTTON_2;
if (ev[0] & 2)
- flags |= KD_BUTTON_3;
+ flags |= KD_BUTTON_3;
if (ev[0] & 1)
- flags |= KD_BUTTON_1;
-
- if (ne > 3)
- {
- dz = (int) (signed char) ev[3];
- if (dz < 0)
- {
- flags |= KD_BUTTON_4;
- flagsrelease = KD_BUTTON_4;
- }
- else if (dz > 0)
- {
- flags |= KD_BUTTON_5;
- flagsrelease = KD_BUTTON_5;
- }
+ flags |= KD_BUTTON_1;
+
+ if (ne > 3) {
+ dz = (int) (signed char) ev[3];
+ if (dz < 0) {
+ flags |= KD_BUTTON_4;
+ flagsrelease = KD_BUTTON_4;
+ }
+ else if (dz > 0) {
+ flags |= KD_BUTTON_5;
+ flagsrelease = KD_BUTTON_5;
+ }
}
dx = ev[1];
if (ev[0] & 0x10)
- dx -= 256;
+ dx -= 256;
dy = ev[2];
if (ev[0] & 0x20)
- dy -= 256;
+ dy -= 256;
dy = -dy;
- if (!MouseReasonable (pi, flags, dx, dy))
- return FALSE;
- if (km->stage == MouseWorking)
- {
- KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
- if (flagsrelease)
- {
- flags &= ~flagsrelease;
- KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
- }
+ if (!MouseReasonable(pi, flags, dx, dy))
+ return FALSE;
+ if (km->stage == MouseWorking) {
+ KdEnqueuePointerEvent(pi, flags, dx, dy, 0);
+ if (flagsrelease) {
+ flags &= ~flagsrelease;
+ KdEnqueuePointerEvent(pi, flags, dx, dy, 0);
+ }
}
return TRUE;
}
-static Bool ps2Init (KdPointerInfo *pi);
+static Bool ps2Init(KdPointerInfo * pi);
static const KmouseProt ps2Prot = {
"ps/2",
@@ -407,143 +397,143 @@ static const KmouseProt exps2Prot = {
#define PSM_4DMOUSE_ID 6
#define PSM_4DPLUS_ID 8
-static unsigned char ps2_init[] = {
+static unsigned char ps2_init[] = {
PSMC_ENABLE_DEV,
0,
};
#define NINIT_PS2 1
-static unsigned char wheel_3button_init[] = {
+static unsigned char wheel_3button_init[] = {
PSMC_SET_SAMPLING_RATE, 200,
PSMC_SET_SAMPLING_RATE, 100,
- PSMC_SET_SAMPLING_RATE, 80,
+ PSMC_SET_SAMPLING_RATE, 80,
PSMC_SEND_DEV_ID,
0,
};
#define NINIT_IMPS2 4
-static unsigned char wheel_5button_init[] = {
+static unsigned char wheel_5button_init[] = {
PSMC_SET_SAMPLING_RATE, 200,
PSMC_SET_SAMPLING_RATE, 100,
- PSMC_SET_SAMPLING_RATE, 80,
+ PSMC_SET_SAMPLING_RATE, 80,
PSMC_SET_SAMPLING_RATE, 200,
PSMC_SET_SAMPLING_RATE, 200,
- PSMC_SET_SAMPLING_RATE, 80,
+ PSMC_SET_SAMPLING_RATE, 80,
PSMC_SEND_DEV_ID,
0
};
#define NINIT_EXPS2 7
-static unsigned char intelli_init[] = {
+static unsigned char intelli_init[] = {
PSMC_SET_SAMPLING_RATE, 200,
PSMC_SET_SAMPLING_RATE, 100,
- PSMC_SET_SAMPLING_RATE, 80,
+ PSMC_SET_SAMPLING_RATE, 80,
0
};
#define NINIT_INTELLI 3
static int
-ps2SkipInit (KdPointerInfo *pi, int ninit, Bool ret_next)
+ps2SkipInit(KdPointerInfo * pi, int ninit, Bool ret_next)
{
- Kmouse *km = pi->driverPrivate;
- int c = -1;
- int skipping;
- Bool waiting;
+ Kmouse *km = pi->driverPrivate;
+ int c = -1;
+ int skipping;
+ Bool waiting;
skipping = 0;
waiting = FALSE;
- while (ninit || ret_next)
- {
- c = MouseReadByte (&km->iob, MOUSE_TIMEOUT);
- if (c == -1)
- break;
- /* look for ACK */
- if (c == 0xfa)
- {
- ninit--;
- if (ret_next)
- waiting = TRUE;
- }
- /* look for packet start -- not the response */
- else if ((c & 0x08) == 0x08)
- waiting = FALSE;
- else if (waiting)
- break;
+ while (ninit || ret_next) {
+ c = MouseReadByte(&km->iob, MOUSE_TIMEOUT);
+ if (c == -1)
+ break;
+ /* look for ACK */
+ if (c == 0xfa) {
+ ninit--;
+ if (ret_next)
+ waiting = TRUE;
+ }
+ /* look for packet start -- not the response */
+ else if ((c & 0x08) == 0x08)
+ waiting = FALSE;
+ else if (waiting)
+ break;
}
return c;
}
static Bool
-ps2Init (KdPointerInfo *pi)
+ps2Init(KdPointerInfo * pi)
{
- Kmouse *km = pi->driverPrivate;
- int skipping;
- Bool waiting;
- int id;
- unsigned char *init;
- int ninit;
+ Kmouse *km = pi->driverPrivate;
+ int skipping;
+ Bool waiting;
+ int id;
+ unsigned char *init;
+ int ninit;
/* Send Intellimouse initialization sequence */
- MouseWriteBytes (km->iob.fd, intelli_init, strlen ((char *) intelli_init), 100);
+ MouseWriteBytes(km->iob.fd, intelli_init, strlen((char *) intelli_init),
+ 100);
/*
* Send ID command
*/
- if (!MouseWriteByte (km->iob.fd, PSMC_SEND_DEV_ID, 100))
- return FALSE;
+ if (!MouseWriteByte(km->iob.fd, PSMC_SEND_DEV_ID, 100))
+ return FALSE;
skipping = 0;
waiting = FALSE;
- id = ps2SkipInit (pi, 0, TRUE);
+ id = ps2SkipInit(pi, 0, TRUE);
switch (id) {
case 3:
- init = wheel_3button_init;
- ninit = NINIT_IMPS2;
- km->prot = &imps2Prot;
- break;
+ init = wheel_3button_init;
+ ninit = NINIT_IMPS2;
+ km->prot = &imps2Prot;
+ break;
case 4:
- init = wheel_5button_init;
- ninit = NINIT_EXPS2;
- km->prot = &exps2Prot;
- break;
+ init = wheel_5button_init;
+ ninit = NINIT_EXPS2;
+ km->prot = &exps2Prot;
+ break;
default:
- init = ps2_init;
- ninit = NINIT_PS2;
- km->prot = &ps2Prot;
- break;
+ init = ps2_init;
+ ninit = NINIT_PS2;
+ km->prot = &ps2Prot;
+ break;
}
if (init)
- MouseWriteBytes (km->iob.fd, init, strlen ((char *) init), 100);
+ MouseWriteBytes(km->iob.fd, init, strlen((char *) init), 100);
/*
* Flush out the available data to eliminate responses to the
* initialization string. Make sure any partial event is
* skipped
*/
- (void) ps2SkipInit (pi, ninit, FALSE);
+ (void) ps2SkipInit(pi, ninit, FALSE);
return TRUE;
}
-static Bool busParse (KdPointerInfo *pi, unsigned char *ev, int ne)
+static Bool
+busParse(KdPointerInfo * pi, unsigned char *ev, int ne)
{
- Kmouse *km = pi->driverPrivate;
- int dx, dy;
- unsigned long flags;
+ Kmouse *km = pi->driverPrivate;
+ int dx, dy;
+ unsigned long flags;
flags = KD_MOUSE_DELTA;
dx = (signed char) ev[1];
dy = -(signed char) ev[2];
if ((ev[0] & 4) == 0)
- flags |= KD_BUTTON_1;
+ flags |= KD_BUTTON_1;
if ((ev[0] & 2) == 0)
- flags |= KD_BUTTON_2;
+ flags |= KD_BUTTON_2;
if ((ev[0] & 1) == 0)
- flags |= KD_BUTTON_3;
- if (!MouseReasonable (pi, flags, dx, dy))
- return FALSE;
+ flags |= KD_BUTTON_3;
+ if (!MouseReasonable(pi, flags, dx, dy))
+ return FALSE;
if (km->stage == MouseWorking)
- KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
+ KdEnqueuePointerEvent(pi, flags, dx, dy, 0);
return TRUE;
}
@@ -558,25 +548,26 @@ static const KmouseProt busProt = {
* Standard MS serial protocol, three bytes
*/
-static Bool msParse (KdPointerInfo *pi, unsigned char *ev, int ne)
+static Bool
+msParse(KdPointerInfo * pi, unsigned char *ev, int ne)
{
- Kmouse *km = pi->driverPrivate;
- int dx, dy;
- unsigned long flags;
+ Kmouse *km = pi->driverPrivate;
+ int dx, dy;
+ unsigned long flags;
flags = KD_MOUSE_DELTA;
if (ev[0] & 0x20)
- flags |= KD_BUTTON_1;
+ flags |= KD_BUTTON_1;
if (ev[0] & 0x10)
- flags |= KD_BUTTON_3;
+ flags |= KD_BUTTON_3;
- dx = (signed char)(((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
- dy = (signed char)(((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
- if (!MouseReasonable (pi, flags, dx, dy))
- return FALSE;
+ dx = (signed char) (((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
+ dy = (signed char) (((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
+ if (!MouseReasonable(pi, flags, dx, dy))
+ return FALSE;
if (km->stage == MouseWorking)
- KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
+ KdEnqueuePointerEvent(pi, flags, dx, dy, 0);
return TRUE;
}
@@ -597,70 +588,70 @@ static const KmouseProt msProt = {
* first byte of a synchronized protocol stream and see if it's got
* any bits turned on that can't occur in that fourth byte
*/
-static Bool logiComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
+static Bool
+logiComplete(KdPointerInfo * pi, unsigned char *ev, int ne)
{
- Kmouse *km = pi->driverPrivate;
+ Kmouse *km = pi->driverPrivate;
if ((ev[0] & 0x40) == 0x40)
- return ne == 3;
+ return ne == 3;
if (km->stage != MouseBroken && (ev[0] & ~0x23) == 0)
- return ne == 1;
+ return ne == 1;
return FALSE;
}
-static int logiValid (KdPointerInfo *pi, unsigned char *ev, int ne)
+static int
+logiValid(KdPointerInfo * pi, unsigned char *ev, int ne)
{
- Kmouse *km = pi->driverPrivate;
- const KmouseProt *prot = km->prot;
- int i;
-
- for (i = 0; i < ne; i++)
- {
- if ((ev[i] & 0x40) == 0x40)
- break;
- if (km->stage != MouseBroken && (ev[i] & ~0x23) == 0)
- break;
+ Kmouse *km = pi->driverPrivate;
+ const KmouseProt *prot = km->prot;
+ int i;
+
+ for (i = 0; i < ne; i++) {
+ if ((ev[i] & 0x40) == 0x40)
+ break;
+ if (km->stage != MouseBroken && (ev[i] & ~0x23) == 0)
+ break;
}
if (i != 0)
- return i;
+ return i;
for (i = 1; i < ne; i++)
- if ((ev[i] & prot->dataMask) != prot->dataValid)
- return -1;
+ if ((ev[i] & prot->dataMask) != prot->dataValid)
+ return -1;
return 0;
}
-static Bool logiParse (KdPointerInfo *pi, unsigned char *ev, int ne)
+static Bool
+logiParse(KdPointerInfo * pi, unsigned char *ev, int ne)
{
- Kmouse *km = pi->driverPrivate;
- int dx, dy;
- unsigned long flags;
+ Kmouse *km = pi->driverPrivate;
+ int dx, dy;
+ unsigned long flags;
flags = KD_MOUSE_DELTA;
- if (ne == 3)
- {
- if (ev[0] & 0x20)
- flags |= KD_BUTTON_1;
- if (ev[0] & 0x10)
- flags |= KD_BUTTON_3;
+ if (ne == 3) {
+ if (ev[0] & 0x20)
+ flags |= KD_BUTTON_1;
+ if (ev[0] & 0x10)
+ flags |= KD_BUTTON_3;
- dx = (signed char)(((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
- dy = (signed char)(((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
- flags |= km->state & KD_BUTTON_2;
+ dx = (signed char) (((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
+ dy = (signed char) (((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
+ flags |= km->state & KD_BUTTON_2;
}
- else
- {
- if (ev[0] & 0x20)
- flags |= KD_BUTTON_2;
- dx = 0;
- dy = 0;
- flags |= km->state & (KD_BUTTON_1|KD_BUTTON_3);
+ else {
+ if (ev[0] & 0x20)
+ flags |= KD_BUTTON_2;
+ dx = 0;
+ dy = 0;
+ flags |= km->state & (KD_BUTTON_1 | KD_BUTTON_3);
}
- if (!MouseReasonable (pi, flags, dx, dy))
- return FALSE;
+ if (!MouseReasonable(pi, flags, dx, dy))
+ return FALSE;
if (km->stage == MouseWorking)
- KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
+ KdEnqueuePointerEvent(pi, flags, dx, dy, 0);
return TRUE;
}
@@ -679,27 +670,28 @@ static const KmouseProt logiProt = {
/*
* Mouse systems protocol, 5 bytes
*/
-static Bool mscParse (KdPointerInfo *pi, unsigned char *ev, int ne)
+static Bool
+mscParse(KdPointerInfo * pi, unsigned char *ev, int ne)
{
- Kmouse *km = pi->driverPrivate;
- int dx, dy;
- unsigned long flags;
+ Kmouse *km = pi->driverPrivate;
+ int dx, dy;
+ unsigned long flags;
flags = KD_MOUSE_DELTA;
if (!(ev[0] & 0x4))
- flags |= KD_BUTTON_1;
+ flags |= KD_BUTTON_1;
if (!(ev[0] & 0x2))
- flags |= KD_BUTTON_2;
+ flags |= KD_BUTTON_2;
if (!(ev[0] & 0x1))
- flags |= KD_BUTTON_3;
- dx = (signed char)(ev[1]) + (signed char)(ev[3]);
- dy = - ((signed char)(ev[2]) + (signed char)(ev[4]));
+ flags |= KD_BUTTON_3;
+ dx = (signed char) (ev[1]) + (signed char) (ev[3]);
+ dy = -((signed char) (ev[2]) + (signed char) (ev[4]));
- if (!MouseReasonable (pi, flags, dx, dy))
- return FALSE;
+ if (!MouseReasonable(pi, flags, dx, dy))
+ return FALSE;
if (km->stage == MouseWorking)
- KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
+ KdEnqueuePointerEvent(pi, flags, dx, dy, 0);
return TRUE;
}
@@ -726,25 +718,23 @@ static const KmouseProt *kmouseProts[] = {
#define NUM_PROT (sizeof (kmouseProts) / sizeof (kmouseProts[0]))
static void
-MouseInitProtocol (Kmouse *km)
+MouseInitProtocol(Kmouse * km)
{
- int ret;
- struct termios t;
-
- if (km->prot->tty)
- {
- ret = tcgetattr (km->iob.fd, &t);
-
- if (ret >= 0)
- {
- t.c_iflag = km->prot->c_iflag;
- t.c_oflag = km->prot->c_oflag;
- t.c_lflag = km->prot->c_lflag;
- t.c_cflag = km->prot->c_cflag;
- cfsetispeed (&t, km->prot->speed);
- cfsetospeed (&t, km->prot->speed);
- ret = tcsetattr (km->iob.fd, TCSANOW, &t);
- }
+ int ret;
+ struct termios t;
+
+ if (km->prot->tty) {
+ ret = tcgetattr(km->iob.fd, &t);
+
+ if (ret >= 0) {
+ t.c_iflag = km->prot->c_iflag;
+ t.c_oflag = km->prot->c_oflag;
+ t.c_lflag = km->prot->c_lflag;
+ t.c_cflag = km->prot->c_cflag;
+ cfsetispeed(&t, km->prot->speed);
+ cfsetospeed(&t, km->prot->speed);
+ ret = tcsetattr(km->iob.fd, TCSANOW, &t);
+ }
}
km->stage = MouseBroken;
km->valid = 0;
@@ -754,172 +744,156 @@ MouseInitProtocol (Kmouse *km)
}
static void
-MouseFirstProtocol (Kmouse *km, char *prot)
+MouseFirstProtocol(Kmouse * km, char *prot)
{
- if (prot)
- {
- for (km->i_prot = 0; km->i_prot < NUM_PROT; km->i_prot++)
- if (!strcmp (prot, kmouseProts[km->i_prot]->name))
- break;
- if (km->i_prot == NUM_PROT)
- {
- int i;
- ErrorF ("Unknown mouse protocol \"%s\". Pick one of:", prot);
- for (i = 0; i < NUM_PROT; i++)
- ErrorF (" %s", kmouseProts[i]->name);
- ErrorF ("\n");
- }
- else
- {
- km->prot = kmouseProts[km->i_prot];
- if (km->tty && !km->prot->tty)
- ErrorF ("Mouse device is serial port, protocol %s is not serial protocol\n",
- prot);
- else if (!km->tty && km->prot->tty)
- ErrorF ("Mouse device is not serial port, protocol %s is serial protocol\n",
- prot);
- }
+ if (prot) {
+ for (km->i_prot = 0; km->i_prot < NUM_PROT; km->i_prot++)
+ if (!strcmp(prot, kmouseProts[km->i_prot]->name))
+ break;
+ if (km->i_prot == NUM_PROT) {
+ int i;
+
+ ErrorF("Unknown mouse protocol \"%s\". Pick one of:", prot);
+ for (i = 0; i < NUM_PROT; i++)
+ ErrorF(" %s", kmouseProts[i]->name);
+ ErrorF("\n");
+ }
+ else {
+ km->prot = kmouseProts[km->i_prot];
+ if (km->tty && !km->prot->tty)
+ ErrorF
+ ("Mouse device is serial port, protocol %s is not serial protocol\n",
+ prot);
+ else if (!km->tty && km->prot->tty)
+ ErrorF
+ ("Mouse device is not serial port, protocol %s is serial protocol\n",
+ prot);
+ }
}
- if (!km->prot)
- {
- for (km->i_prot = 0; kmouseProts[km->i_prot]->tty != km->tty; km->i_prot++)
- ;
- km->prot = kmouseProts[km->i_prot];
+ if (!km->prot) {
+ for (km->i_prot = 0; kmouseProts[km->i_prot]->tty != km->tty;
+ km->i_prot++);
+ km->prot = kmouseProts[km->i_prot];
}
- MouseInitProtocol (km);
+ MouseInitProtocol(km);
}
static void
-MouseNextProtocol (Kmouse *km)
+MouseNextProtocol(Kmouse * km)
{
- do
- {
- if (!km->prot)
- km->i_prot = 0;
- else
- if (++km->i_prot == NUM_PROT) km->i_prot = 0;
- km->prot = kmouseProts[km->i_prot];
+ do {
+ if (!km->prot)
+ km->i_prot = 0;
+ else if (++km->i_prot == NUM_PROT)
+ km->i_prot = 0;
+ km->prot = kmouseProts[km->i_prot];
} while (km->prot->tty != km->tty);
- MouseInitProtocol (km);
- ErrorF ("Switching to mouse protocol \"%s\"\n", km->prot->name);
+ MouseInitProtocol(km);
+ ErrorF("Switching to mouse protocol \"%s\"\n", km->prot->name);
}
static void
-MouseRead (int mousePort, void *closure)
+MouseRead(int mousePort, void *closure)
{
- KdPointerInfo *pi = closure;
- Kmouse *km = pi->driverPrivate;
- unsigned char event[MAX_MOUSE];
- int ne;
- int c;
- int i;
- int timeout;
+ KdPointerInfo *pi = closure;
+ Kmouse *km = pi->driverPrivate;
+ unsigned char event[MAX_MOUSE];
+ int ne;
+ int c;
+ int i;
+ int timeout;
timeout = 0;
ne = 0;
- for(;;)
- {
- c = MouseReadByte (&km->iob, timeout);
- if (c == -1)
- {
- if (ne)
- {
- km->invalid += ne + km->tested;
- km->valid = 0;
- km->tested = 0;
- km->stage = MouseBroken;
- }
- break;
- }
- event[ne++] = c;
- i = (*km->prot->Valid) (pi, event, ne);
- if (i != 0)
- {
+ for (;;) {
+ c = MouseReadByte(&km->iob, timeout);
+ if (c == -1) {
+ if (ne) {
+ km->invalid += ne + km->tested;
+ km->valid = 0;
+ km->tested = 0;
+ km->stage = MouseBroken;
+ }
+ break;
+ }
+ event[ne++] = c;
+ i = (*km->prot->Valid) (pi, event, ne);
+ if (i != 0) {
#ifdef DEBUG
- ErrorF ("Mouse protocol %s broken %d of %d bytes bad\n",
- km->prot->name, i > 0 ? i : ne, ne);
+ ErrorF("Mouse protocol %s broken %d of %d bytes bad\n",
+ km->prot->name, i > 0 ? i : ne, ne);
#endif
- if (i > 0 && i < ne)
- {
- ne -= i;
- memmove (event, event + i, ne);
- }
- else
- {
- i = ne;
- ne = 0;
- }
- km->invalid += i + km->tested;
- km->valid = 0;
- km->tested = 0;
- if (km->stage == MouseWorking)
- km->i_prot--;
- km->stage = MouseBroken;
- if (km->invalid > MAX_SKIP)
- {
- MouseNextProtocol (km);
- ne = 0;
- }
- timeout = 0;
- }
- else
- {
- if ((*km->prot->Complete) (pi, event, ne))
- {
- if ((*km->prot->Parse) (pi, event, ne))
- {
- switch (km->stage)
- {
- case MouseBroken:
+ if (i > 0 && i < ne) {
+ ne -= i;
+ memmove(event, event + i, ne);
+ }
+ else {
+ i = ne;
+ ne = 0;
+ }
+ km->invalid += i + km->tested;
+ km->valid = 0;
+ km->tested = 0;
+ if (km->stage == MouseWorking)
+ km->i_prot--;
+ km->stage = MouseBroken;
+ if (km->invalid > MAX_SKIP) {
+ MouseNextProtocol(km);
+ ne = 0;
+ }
+ timeout = 0;
+ }
+ else {
+ if ((*km->prot->Complete) (pi, event, ne)) {
+ if ((*km->prot->Parse) (pi, event, ne)) {
+ switch (km->stage) {
+ case MouseBroken:
#ifdef DEBUG
- ErrorF ("Mouse protocol %s seems OK\n",
- km->prot->name);
+ ErrorF("Mouse protocol %s seems OK\n", km->prot->name);
#endif
- /* do not zero invalid to accumulate invalid bytes */
- km->valid = 0;
- km->tested = 0;
- km->stage = MouseTesting;
- /* fall through ... */
- case MouseTesting:
- km->valid++;
- km->tested += ne;
- if (km->valid > MAX_VALID)
- {
+ /* do not zero invalid to accumulate invalid bytes */
+ km->valid = 0;
+ km->tested = 0;
+ km->stage = MouseTesting;
+ /* fall through ... */
+ case MouseTesting:
+ km->valid++;
+ km->tested += ne;
+ if (km->valid > MAX_VALID) {
#ifdef DEBUG
- ErrorF ("Mouse protocol %s working\n",
- km->prot->name);
+ ErrorF("Mouse protocol %s working\n",
+ km->prot->name);
#endif
- km->stage = MouseWorking;
- km->invalid = 0;
- km->tested = 0;
- km->valid = 0;
- if (km->prot->Init && !(*km->prot->Init) (pi))
- km->stage = MouseBroken;
- }
- break;
- case MouseWorking:
- break;
- }
- }
- else
- {
- km->invalid += ne + km->tested;
- km->valid = 0;
- km->tested = 0;
- km->stage = MouseBroken;
- }
- ne = 0;
- timeout = 0;
- }
- else
- timeout = MOUSE_TIMEOUT;
- }
+ km->stage = MouseWorking;
+ km->invalid = 0;
+ km->tested = 0;
+ km->valid = 0;
+ if (km->prot->Init && !(*km->prot->Init) (pi))
+ km->stage = MouseBroken;
+ }
+ break;
+ case MouseWorking:
+ break;
+ }
+ }
+ else {
+ km->invalid += ne + km->tested;
+ km->valid = 0;
+ km->tested = 0;
+ km->stage = MouseBroken;
+ }
+ ne = 0;
+ timeout = 0;
+ }
+ else
+ timeout = MOUSE_TIMEOUT;
+ }
}
}
int MouseInputType;
-char *kdefaultMouse[] = {
+char *kdefaultMouse[] = {
"/dev/input/mice",
"/dev/mouse",
"/dev/psaux",
@@ -931,26 +905,26 @@ char *kdefaultMouse[] = {
#define NUM_DEFAULT_MOUSE (sizeof (kdefaultMouse) / sizeof (kdefaultMouse[0]))
static Status
-MouseInit (KdPointerInfo *pi)
+MouseInit(KdPointerInfo * pi)
{
- int i;
- int fd;
- Kmouse *km;
+ int i;
+ int fd;
+ Kmouse *km;
if (!pi)
return BadImplementation;
if (!pi->path || strcmp(pi->path, "auto") == 0) {
for (i = 0; i < NUM_DEFAULT_MOUSE; i++) {
- fd = open (kdefaultMouse[i], 2);
+ fd = open(kdefaultMouse[i], 2);
if (fd >= 0) {
- pi->path = strdup (kdefaultMouse[i]);
+ pi->path = strdup(kdefaultMouse[i]);
break;
}
}
}
else {
- fd = open (pi->path, 2);
+ fd = open(pi->path, 2);
}
if (fd < 0)
@@ -958,21 +932,21 @@ MouseInit (KdPointerInfo *pi)
close(fd);
- km = (Kmouse *) malloc(sizeof (Kmouse));
+ km = (Kmouse *) malloc(sizeof(Kmouse));
if (km) {
km->iob.avail = km->iob.used = 0;
MouseFirstProtocol(km, pi->protocol ? pi->protocol : "exps/2");
/* MouseFirstProtocol sets state to MouseBroken for later protocol
* checks. Skip these checks if a protocol was supplied */
if (pi->protocol)
- km->state = MouseWorking;
+ km->state = MouseWorking;
km->i_prot = 0;
- km->tty = isatty (fd);
+ km->tty = isatty(fd);
km->iob.fd = -1;
pi->driverPrivate = km;
}
else {
- close (fd);
+ close(fd);
return BadAlloc;
}
@@ -980,7 +954,7 @@ MouseInit (KdPointerInfo *pi)
}
static Status
-MouseEnable (KdPointerInfo *pi)
+MouseEnable(KdPointerInfo * pi)
{
Kmouse *km;
@@ -993,8 +967,7 @@ MouseEnable (KdPointerInfo *pi)
if (km->iob.fd < 0)
return BadMatch;
- if (!KdRegisterFd (km->iob.fd, MouseRead, pi))
- {
+ if (!KdRegisterFd(km->iob.fd, MouseRead, pi)) {
close(km->iob.fd);
return BadAlloc;
}
@@ -1003,18 +976,19 @@ MouseEnable (KdPointerInfo *pi)
}
static void
-MouseDisable (KdPointerInfo *pi)
+MouseDisable(KdPointerInfo * pi)
{
Kmouse *km;
+
if (!pi || !pi->driverPrivate)
return;
km = pi->driverPrivate;
- KdUnregisterFd (pi, km->iob.fd, TRUE);
+ KdUnregisterFd(pi, km->iob.fd, TRUE);
}
static void
-MouseFini (KdPointerInfo *pi)
+MouseFini(KdPointerInfo * pi)
{
free(pi->driverPrivate);
pi->driverPrivate = NULL;
diff --git a/xorg-server/hw/kdrive/linux/ms.c b/xorg-server/hw/kdrive/linux/ms.c
index 176e12550..e82350ac5 100644
--- a/xorg-server/hw/kdrive/linux/ms.c
+++ b/xorg-server/hw/kdrive/linux/ms.c
@@ -34,67 +34,63 @@ THE SOFTWARE.
#include "kdrive.h"
static int
-MsReadBytes (int fd, char *buf, int len, int min)
+MsReadBytes(int fd, char *buf, int len, int min)
{
- int n, tot;
- fd_set set;
- struct timeval tv;
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
tot = 0;
- while (len)
- {
- n = read (fd, buf, len);
- if (n > 0)
- {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0)
- break;
- FD_ZERO (&set);
- FD_SET (fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select (fd + 1, &set, 0, 0, &tv);
- if (n <= 0)
- break;
+ while (len) {
+ n = read(fd, buf, len);
+ if (n > 0) {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0)
+ break;
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select(fd + 1, &set, 0, 0, &tv);
+ if (n <= 0)
+ break;
}
return tot;
}
static void
-MsRead (int port, void *closure)
+MsRead(int port, void *closure)
{
- unsigned char buf[3 * 200];
- unsigned char *b;
- int n;
- int dx, dy;
- unsigned long flags;
-
- while ((n = MsReadBytes (port, (char *) buf, sizeof (buf), 3)) > 0)
- {
- b = buf;
- while (n >= 3)
- {
- flags = KD_MOUSE_DELTA;
-
- if (b[0] & 0x20)
- flags |= KD_BUTTON_1;
- if (b[0] & 0x10)
- flags |= KD_BUTTON_3;
-
- dx = (char)(((b[0] & 0x03) << 6) | (b[1] & 0x3F));
- dy = (char)(((b[0] & 0x0C) << 4) | (b[2] & 0x3F));
+ unsigned char buf[3 * 200];
+ unsigned char *b;
+ int n;
+ int dx, dy;
+ unsigned long flags;
+
+ while ((n = MsReadBytes(port, (char *) buf, sizeof(buf), 3)) > 0) {
+ b = buf;
+ while (n >= 3) {
+ flags = KD_MOUSE_DELTA;
+
+ if (b[0] & 0x20)
+ flags |= KD_BUTTON_1;
+ if (b[0] & 0x10)
+ flags |= KD_BUTTON_3;
+
+ dx = (char) (((b[0] & 0x03) << 6) | (b[1] & 0x3F));
+ dy = (char) (((b[0] & 0x0C) << 4) | (b[2] & 0x3F));
n -= 3;
b += 3;
- KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
- }
+ KdEnqueuePointerEvent(closure, flags, dx, dy, 0);
+ }
}
}
static Status
-MsInit (KdPointerInfo *pi)
+MsInit(KdPointerInfo * pi)
{
if (!pi)
return BadImplementation;
@@ -108,51 +104,51 @@ MsInit (KdPointerInfo *pi)
}
static Status
-MsEnable (KdPointerInfo *pi)
+MsEnable(KdPointerInfo * pi)
{
int port;
struct termios t;
int ret;
- port = open (pi->path, O_RDWR | O_NONBLOCK);
- if(port < 0) {
- ErrorF("Couldn't open %s (%d)\n", pi->path, (int)errno);
+ port = open(pi->path, O_RDWR | O_NONBLOCK);
+ if (port < 0) {
+ ErrorF("Couldn't open %s (%d)\n", pi->path, (int) errno);
return 0;
- } else if (port == 0) {
- ErrorF("Opening %s returned 0! Please complain to Keith.\n",
- pi->path);
- goto bail;
+ }
+ else if (port == 0) {
+ ErrorF("Opening %s returned 0! Please complain to Keith.\n", pi->path);
+ goto bail;
}
- if(!isatty(port)) {
+ if (!isatty(port)) {
ErrorF("%s is not a tty\n", pi->path);
goto bail;
}
ret = tcgetattr(port, &t);
- if(ret < 0) {
+ if (ret < 0) {
ErrorF("Couldn't tcgetattr(%s): %d\n", pi->path, errno);
goto bail;
}
- t.c_iflag &= ~ (IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
+ t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
IGNCR | ICRNL | IXON | IXOFF);
- t.c_oflag &= ~ OPOST;
- t.c_lflag &= ~ (ECHO | ECHONL | ICANON | ISIG | IEXTEN);
- t.c_cflag &= ~ (CSIZE | PARENB);
+ t.c_oflag &= ~OPOST;
+ t.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
+ t.c_cflag &= ~(CSIZE | PARENB);
t.c_cflag |= CS8 | CLOCAL | CSTOPB;
- cfsetispeed (&t, B1200);
- cfsetospeed (&t, B1200);
+ cfsetispeed(&t, B1200);
+ cfsetospeed(&t, B1200);
t.c_cc[VMIN] = 1;
t.c_cc[VTIME] = 0;
ret = tcsetattr(port, TCSANOW, &t);
- if(ret < 0) {
+ if (ret < 0) {
ErrorF("Couldn't tcsetattr(%s): %d\n", pi->path, errno);
goto bail;
}
- if (KdRegisterFd (port, MsRead, pi))
- return TRUE;
- pi->driverPrivate = (void *)(intptr_t)port;
+ if (KdRegisterFd(port, MsRead, pi))
+ return TRUE;
+ pi->driverPrivate = (void *) (intptr_t) port;
return Success;
@@ -162,13 +158,13 @@ MsEnable (KdPointerInfo *pi)
}
static void
-MsDisable (KdPointerInfo *pi)
+MsDisable(KdPointerInfo * pi)
{
- KdUnregisterFd (pi, (int)(intptr_t)pi->driverPrivate, TRUE);
+ KdUnregisterFd(pi, (int) (intptr_t) pi->driverPrivate, TRUE);
}
static void
-MsFini (KdPointerInfo *pi)
+MsFini(KdPointerInfo * pi)
{
}
diff --git a/xorg-server/hw/kdrive/linux/ps2.c b/xorg-server/hw/kdrive/linux/ps2.c
index b62d769f2..d1522a2d0 100644
--- a/xorg-server/hw/kdrive/linux/ps2.c
+++ b/xorg-server/hw/kdrive/linux/ps2.c
@@ -31,36 +31,34 @@
#include "kdrive.h"
static int
-Ps2ReadBytes (int fd, char *buf, int len, int min)
+Ps2ReadBytes(int fd, char *buf, int len, int min)
{
- int n, tot;
- fd_set set;
- struct timeval tv;
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
tot = 0;
- while (len)
- {
- n = read (fd, buf, len);
- if (n > 0)
- {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0)
- break;
- FD_ZERO (&set);
- FD_SET (fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select (fd + 1, &set, 0, 0, &tv);
- if (n <= 0)
- break;
+ while (len) {
+ n = read(fd, buf, len);
+ if (n > 0) {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0)
+ break;
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select(fd + 1, &set, 0, 0, &tv);
+ if (n <= 0)
+ break;
}
return tot;
}
-char *Ps2Names[] = {
+char *Ps2Names[] = {
"/dev/psaux",
/* "/dev/mouse", */
"/dev/input/mice",
@@ -69,67 +67,64 @@ char *Ps2Names[] = {
#define NUM_PS2_NAMES (sizeof (Ps2Names) / sizeof (Ps2Names[0]))
static void
-Ps2Read (int ps2Port, void *closure)
+Ps2Read(int ps2Port, void *closure)
{
- unsigned char buf[3 * 200];
- unsigned char *b;
- int n;
- int dx, dy;
- unsigned long flags;
- unsigned long left_button = KD_BUTTON_1;
- unsigned long right_button = KD_BUTTON_3;
+ unsigned char buf[3 * 200];
+ unsigned char *b;
+ int n;
+ int dx, dy;
+ unsigned long flags;
+ unsigned long left_button = KD_BUTTON_1;
+ unsigned long right_button = KD_BUTTON_3;
#undef SWAP_USB
#ifdef SWAP_USB
- if (id == 2)
- {
- left_button = KD_BUTTON_3;
- right_button = KD_BUTTON_1;
+ if (id == 2) {
+ left_button = KD_BUTTON_3;
+ right_button = KD_BUTTON_1;
}
#endif
- while ((n = Ps2ReadBytes (ps2Port, (char *) buf, sizeof (buf), 3)) > 0)
- {
- b = buf;
- while (n >= 3)
- {
- flags = KD_MOUSE_DELTA;
- if (b[0] & 4)
- flags |= KD_BUTTON_2;
- if (b[0] & 2)
- flags |= right_button;
- if (b[0] & 1)
- flags |= left_button;
-
- dx = b[1];
- if (b[0] & 0x10)
- dx -= 256;
- dy = b[2];
- if (b[0] & 0x20)
- dy -= 256;
- dy = -dy;
- n -= 3;
- b += 3;
- KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
- }
+ while ((n = Ps2ReadBytes(ps2Port, (char *) buf, sizeof(buf), 3)) > 0) {
+ b = buf;
+ while (n >= 3) {
+ flags = KD_MOUSE_DELTA;
+ if (b[0] & 4)
+ flags |= KD_BUTTON_2;
+ if (b[0] & 2)
+ flags |= right_button;
+ if (b[0] & 1)
+ flags |= left_button;
+
+ dx = b[1];
+ if (b[0] & 0x10)
+ dx -= 256;
+ dy = b[2];
+ if (b[0] & 0x20)
+ dy -= 256;
+ dy = -dy;
+ n -= 3;
+ b += 3;
+ KdEnqueuePointerEvent(closure, flags, dx, dy, 0);
+ }
}
}
static Status
-Ps2Init (KdPointerInfo *pi)
+Ps2Init(KdPointerInfo * pi)
{
- int ps2Port, i;
+ int ps2Port, i;
if (!pi->path) {
for (i = 0; i < NUM_PS2_NAMES; i++) {
- ps2Port = open (Ps2Names[i], 0);
+ ps2Port = open(Ps2Names[i], 0);
if (ps2Port >= 0) {
- pi->path = strdup (Ps2Names[i]);
+ pi->path = strdup(Ps2Names[i]);
break;
}
- }
+ }
}
else {
- ps2Port = open (pi->path, 0);
+ ps2Port = open(pi->path, 0);
}
if (ps2Port < 0)
@@ -137,42 +132,41 @@ Ps2Init (KdPointerInfo *pi)
close(ps2Port);
if (!pi->name)
- pi->name = strdup ("PS/2 Mouse");
+ pi->name = strdup("PS/2 Mouse");
return Success;
}
static Status
-Ps2Enable (KdPointerInfo *pi)
+Ps2Enable(KdPointerInfo * pi)
{
int fd;
if (!pi)
return BadImplementation;
- fd = open (pi->path, 0);
+ fd = open(pi->path, 0);
if (fd < 0)
return BadMatch;
- if (!KdRegisterFd (fd, Ps2Read, pi)) {
+ if (!KdRegisterFd(fd, Ps2Read, pi)) {
close(fd);
return BadAlloc;
}
- pi->driverPrivate = (void *)(intptr_t)fd;
+ pi->driverPrivate = (void *) (intptr_t) fd;
return Success;
}
-
static void
-Ps2Disable (KdPointerInfo *pi)
+Ps2Disable(KdPointerInfo * pi)
{
- KdUnregisterFd (pi, (int)(intptr_t)pi->driverPrivate, TRUE);
+ KdUnregisterFd(pi, (int) (intptr_t) pi->driverPrivate, TRUE);
}
static void
-Ps2Fini (KdPointerInfo *pi)
+Ps2Fini(KdPointerInfo * pi)
{
}
diff --git a/xorg-server/hw/kdrive/linux/tslib.c b/xorg-server/hw/kdrive/linux/tslib.c
index 1f30ccae7..1403c7968 100644
--- a/xorg-server/hw/kdrive/linux/tslib.c
+++ b/xorg-server/hw/kdrive/linux/tslib.c
@@ -30,7 +30,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-
#ifdef HAVE_KDRIVE_CONFIG_H
#include <kdrive-config.h>
#endif
@@ -50,25 +49,24 @@ struct TslibPrivate {
int fd;
int lastx, lasty;
struct tsdev *tsDev;
- void (*raw_event_hook)(int x, int y, int pressure, void *closure);
+ void (*raw_event_hook) (int x, int y, int pressure, void *closure);
void *raw_event_closure;
int phys_screen;
};
-
static void
-TsRead (int fd, void *closure)
+TsRead(int fd, void *closure)
{
- KdPointerInfo *pi = closure;
+ KdPointerInfo *pi = closure;
struct TslibPrivate *private = pi->driverPrivate;
- struct ts_sample event;
- long x = 0, y = 0;
- unsigned long flags;
+ struct ts_sample event;
+ long x = 0, y = 0;
+ unsigned long flags;
if (private->raw_event_hook) {
while (ts_read_raw(private->tsDev, &event, 1) == 1)
- private->raw_event_hook (event.x, event.y, event.pressure,
- private->raw_event_closure);
+ private->raw_event_hook(event.x, event.y, event.pressure,
+ private->raw_event_closure);
return;
}
@@ -84,30 +82,33 @@ TsRead (int fd, void *closure)
if (KdCurScreen == private->phys_screen) {
x = event.x;
y = event.y;
- } else {
+ }
+ else {
flags |= KD_MOUSE_DELTA;
if ((private->lastx == 0) || (private->lasty == 0)) {
x = event.x;
y = event.y;
- } else {
+ }
+ else {
x = event.x - private->lastx;
y = event.y - private->lasty;
- }
+ }
}
private->lastx = event.x;
private->lasty = event.y;
- } else {
+ }
+ else {
flags = 0;
x = private->lastx;
y = private->lasty;
}
- KdEnqueuePointerEvent (pi, flags, x, y, event.pressure);
+ KdEnqueuePointerEvent(pi, flags, x, y, event.pressure);
}
}
static Status
-TslibEnable (KdPointerInfo *pi)
+TslibEnable(KdPointerInfo * pi)
{
struct TslibPrivate *private = pi->driverPrivate;
@@ -115,7 +116,8 @@ TslibEnable (KdPointerInfo *pi)
private->raw_event_closure = NULL;
if (!pi->path) {
pi->path = strdup("/dev/input/touchscreen0");
- ErrorF("[tslib/TslibEnable] no device path given, trying %s\n", pi->path);
+ ErrorF("[tslib/TslibEnable] no device path given, trying %s\n",
+ pi->path);
}
private->tsDev = ts_open(pi->path, 0);
@@ -138,9 +140,8 @@ TslibEnable (KdPointerInfo *pi)
return Success;
}
-
static void
-TslibDisable (KdPointerInfo *pi)
+TslibDisable(KdPointerInfo * pi)
{
struct TslibPrivate *private = pi->driverPrivate;
@@ -154,9 +155,8 @@ TslibDisable (KdPointerInfo *pi)
private->tsDev = NULL;
}
-
static Status
-TslibInit (KdPointerInfo *pi)
+TslibInit(KdPointerInfo * pi)
{
struct TslibPrivate *private = NULL;
@@ -164,7 +164,7 @@ TslibInit (KdPointerInfo *pi)
return !Success;
pi->driverPrivate = (struct TslibPrivate *)
- calloc(sizeof(struct TslibPrivate), 1);
+ calloc(sizeof(struct TslibPrivate), 1);
if (!pi->driverPrivate)
return !Success;
@@ -178,15 +178,13 @@ TslibInit (KdPointerInfo *pi)
return Success;
}
-
static void
-TslibFini (KdPointerInfo *pi)
+TslibFini(KdPointerInfo * pi)
{
free(pi->driverPrivate);
pi->driverPrivate = NULL;
}
-
KdPointerDriver TsDriver = {
"tslib",
TslibInit,
diff --git a/xorg-server/hw/kdrive/src/kcmap.c b/xorg-server/hw/kdrive/src/kcmap.c
index 6e0fc1417..c93c2f4d3 100644
--- a/xorg-server/hw/kdrive/src/kcmap.c
+++ b/xorg-server/hw/kdrive/src/kcmap.c
@@ -30,25 +30,25 @@
*/
void
-KdSetColormap (ScreenPtr pScreen)
+KdSetColormap(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- ColormapPtr pCmap = pScreenPriv->pInstalledmap;
- Pixel pixels[KD_MAX_PSEUDO_SIZE];
- xrgb colors[KD_MAX_PSEUDO_SIZE];
- xColorItem defs[KD_MAX_PSEUDO_SIZE];
- int i;
+ ColormapPtr pCmap = pScreenPriv->pInstalledmap;
+ Pixel pixels[KD_MAX_PSEUDO_SIZE];
+ xrgb colors[KD_MAX_PSEUDO_SIZE];
+ xColorItem defs[KD_MAX_PSEUDO_SIZE];
+ int i;
if (!pScreenPriv->card->cfuncs->putColors)
- return;
+ return;
if (pScreenPriv->screen->fb.depth > KD_MAX_PSEUDO_DEPTH)
- return;
+ return;
if (!pScreenPriv->enabled)
- return;
+ return;
if (!pCmap)
- return;
+ return;
/*
* Make DIX convert pixels into RGB values -- this handles
@@ -56,26 +56,26 @@ KdSetColormap (ScreenPtr pScreen)
*/
for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
- pixels[i] = i;
+ pixels[i] = i;
- QueryColors (pCmap, (1 << pScreenPriv->screen->fb.depth), pixels, colors, serverClient);
+ QueryColors(pCmap, (1 << pScreenPriv->screen->fb.depth), pixels, colors,
+ serverClient);
- for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
- {
- defs[i].pixel = i;
- defs[i].red = colors[i].red;
- defs[i].green = colors[i].green;
- defs[i].blue = colors[i].blue;
- defs[i].flags = DoRed|DoGreen|DoBlue;
+ for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++) {
+ defs[i].pixel = i;
+ defs[i].red = colors[i].red;
+ defs[i].green = colors[i].green;
+ defs[i].blue = colors[i].blue;
+ defs[i].flags = DoRed | DoGreen | DoBlue;
}
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen,
- (1 << pScreenPriv->screen->fb.depth),
- defs);
+ (1 << pScreenPriv->screen->fb.
+ depth), defs);
/* recolor hardware cursor */
if (pScreenPriv->card->cfuncs->recolorCursor)
- (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, 0, 0);
+ (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, 0, 0);
}
/*
@@ -83,38 +83,38 @@ KdSetColormap (ScreenPtr pScreen)
* the current colormap
*/
void
-KdEnableColormap (ScreenPtr pScreen)
+KdEnableColormap(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- int i;
+ int i;
if (!pScreenPriv->card->cfuncs->putColors)
- return;
-
- if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH)
- {
- for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
- pScreenPriv->systemPalette[i].pixel = i;
- (*pScreenPriv->card->cfuncs->getColors) (pScreen,
- (1 << pScreenPriv->screen->fb.depth),
- pScreenPriv->systemPalette);
+ return;
+
+ if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH) {
+ for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
+ pScreenPriv->systemPalette[i].pixel = i;
+ (*pScreenPriv->card->cfuncs->getColors) (pScreen,
+ (1 << pScreenPriv->screen->fb.
+ depth),
+ pScreenPriv->systemPalette);
}
- KdSetColormap (pScreen);
+ KdSetColormap(pScreen);
}
void
-KdDisableColormap (ScreenPtr pScreen)
+KdDisableColormap(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
if (!pScreenPriv->card->cfuncs->putColors)
- return;
+ return;
- if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH)
- {
- (*pScreenPriv->card->cfuncs->putColors) (pScreen,
- (1 << pScreenPriv->screen->fb.depth),
- pScreenPriv->systemPalette);
+ if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH) {
+ (*pScreenPriv->card->cfuncs->putColors) (pScreen,
+ (1 << pScreenPriv->screen->fb.
+ depth),
+ pScreenPriv->systemPalette);
}
}
@@ -128,22 +128,22 @@ KdDisableColormap (ScreenPtr pScreen)
* colormap and realize it into the Windows system palette.
*/
void
-KdInstallColormap (ColormapPtr pCmap)
+KdInstallColormap(ColormapPtr pCmap)
{
KdScreenPriv(pCmap->pScreen);
if (pCmap == pScreenPriv->pInstalledmap)
- return;
+ return;
/* Tell X clients that the installed colormap is going away. */
if (pScreenPriv->pInstalledmap)
- WalkTree(pScreenPriv->pInstalledmap->pScreen, TellLostMap,
- (pointer) &(pScreenPriv->pInstalledmap->mid));
+ WalkTree(pScreenPriv->pInstalledmap->pScreen, TellLostMap,
+ (pointer) &(pScreenPriv->pInstalledmap->mid));
/* Take note of the new installed colorscreen-> */
pScreenPriv->pInstalledmap = pCmap;
- KdSetColormap (pCmap->pScreen);
+ KdSetColormap(pCmap->pScreen);
/* Tell X clients of the new colormap */
WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
@@ -157,45 +157,42 @@ KdInstallColormap (ColormapPtr pCmap)
* The default X colormap itself cannot be uninstalled.
*/
void
-KdUninstallColormap (ColormapPtr pCmap)
+KdUninstallColormap(ColormapPtr pCmap)
{
KdScreenPriv(pCmap->pScreen);
- Colormap defMapID;
+ Colormap defMapID;
ColormapPtr defMap;
/* ignore if not installed */
if (pCmap != pScreenPriv->pInstalledmap)
- return;
+ return;
/* ignore attempts to uninstall default colormap */
defMapID = pCmap->pScreen->defColormap;
if ((Colormap) pCmap->mid == defMapID)
- return;
+ return;
/* install default */
- dixLookupResourceByType((pointer *)&defMap, defMapID, RT_COLORMAP,
- serverClient, DixInstallAccess);
+ dixLookupResourceByType((pointer *) &defMap, defMapID, RT_COLORMAP,
+ serverClient, DixInstallAccess);
if (defMap)
- (*pCmap->pScreen->InstallColormap)(defMap);
- else
- {
- /* uninstall and clear colormap pointer */
- WalkTree(pCmap->pScreen, TellLostMap,
- (pointer) &(pCmap->mid));
- pScreenPriv->pInstalledmap = 0;
+ (*pCmap->pScreen->InstallColormap) (defMap);
+ else {
+ /* uninstall and clear colormap pointer */
+ WalkTree(pCmap->pScreen, TellLostMap, (pointer) &(pCmap->mid));
+ pScreenPriv->pInstalledmap = 0;
}
}
int
-KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
+KdListInstalledColormaps(ScreenPtr pScreen, Colormap * pCmaps)
{
KdScreenPriv(pScreen);
- int n = 0;
+ int n = 0;
- if (pScreenPriv->pInstalledmap)
- {
- *pCmaps++ = pScreenPriv->pInstalledmap->mid;
- n++;
+ if (pScreenPriv->pInstalledmap) {
+ *pCmaps++ = pScreenPriv->pInstalledmap->mid;
+ n++;
}
return n;
}
@@ -208,39 +205,39 @@ KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
* colormap; it can be either the default colormap or a private colorscreen->
*/
void
-KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
+KdStoreColors(ColormapPtr pCmap, int ndef, xColorItem * pdefs)
{
KdScreenPriv(pCmap->pScreen);
- VisualPtr pVisual;
- xColorItem expanddefs[KD_MAX_PSEUDO_SIZE];
+ VisualPtr pVisual;
+ xColorItem expanddefs[KD_MAX_PSEUDO_SIZE];
if (pCmap != pScreenPriv->pInstalledmap)
- return;
+ return;
if (!pScreenPriv->card->cfuncs->putColors)
- return;
+ return;
if (pScreenPriv->screen->fb.depth > KD_MAX_PSEUDO_DEPTH)
- return;
+ return;
if (!pScreenPriv->enabled)
- return;
+ return;
/* Check for DirectColor or TrueColor being simulated on a PseudoColor device. */
pVisual = pCmap->pVisual;
- if ((pVisual->class | DynamicClass) == DirectColor)
- {
- /*
- * Expand DirectColor or TrueColor color values into a PseudoColor
- * format. Defer to the Color Framebuffer (CFB) code to do that.
- */
- ndef = fbExpandDirectColors(pCmap, ndef, pdefs, expanddefs);
- pdefs = expanddefs;
+ if ((pVisual->class | DynamicClass) == DirectColor) {
+ /*
+ * Expand DirectColor or TrueColor color values into a PseudoColor
+ * format. Defer to the Color Framebuffer (CFB) code to do that.
+ */
+ ndef = fbExpandDirectColors(pCmap, ndef, pdefs, expanddefs);
+ pdefs = expanddefs;
}
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, ndef, pdefs);
/* recolor hardware cursor */
if (pScreenPriv->card->cfuncs->recolorCursor)
- (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, ndef, pdefs);
+ (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, ndef,
+ pdefs);
}
diff --git a/xorg-server/hw/kdrive/src/kdrive.c b/xorg-server/hw/kdrive/src/kdrive.c
index 78b0017a6..79f888096 100644
--- a/xorg-server/hw/kdrive/src/kdrive.c
+++ b/xorg-server/hw/kdrive/src/kdrive.c
@@ -46,198 +46,192 @@
#include <signal.h>
typedef struct _kdDepths {
- CARD8 depth;
- CARD8 bpp;
+ CARD8 depth;
+ CARD8 bpp;
} KdDepths;
-KdDepths kdDepths[] = {
- { 1, 1 },
- { 4, 4 },
- { 8, 8 },
- { 15, 16 },
- { 16, 16 },
- { 24, 32 },
- { 32, 32 }
+KdDepths kdDepths[] = {
+ {1, 1},
+ {4, 4},
+ {8, 8},
+ {15, 16},
+ {16, 16},
+ {24, 32},
+ {32, 32}
};
#define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0]))
#define KD_DEFAULT_BUTTONS 5
-DevPrivateKeyRec kdScreenPrivateKeyRec;
-unsigned long kdGeneration;
-
-Bool kdVideoTest;
-unsigned long kdVideoTestTime;
-Bool kdEmulateMiddleButton;
-Bool kdRawPointerCoordinates;
-Bool kdDisableZaphod;
-Bool kdAllowZap;
-Bool kdEnabled;
-int kdSubpixelOrder;
-int kdVirtualTerminal = -1;
-Bool kdSwitchPending;
-char *kdSwitchCmd;
-DDXPointRec kdOrigin;
-Bool kdHasPointer = FALSE;
-Bool kdHasKbd = FALSE;
-
-static Bool kdCaughtSignal = FALSE;
+DevPrivateKeyRec kdScreenPrivateKeyRec;
+unsigned long kdGeneration;
+
+Bool kdVideoTest;
+unsigned long kdVideoTestTime;
+Bool kdEmulateMiddleButton;
+Bool kdRawPointerCoordinates;
+Bool kdDisableZaphod;
+Bool kdAllowZap;
+Bool kdEnabled;
+int kdSubpixelOrder;
+int kdVirtualTerminal = -1;
+Bool kdSwitchPending;
+char *kdSwitchCmd;
+DDXPointRec kdOrigin;
+Bool kdHasPointer = FALSE;
+Bool kdHasKbd = FALSE;
+
+static Bool kdCaughtSignal = FALSE;
/*
* Carry arguments from InitOutput through driver initialization
* to KdScreenInit
*/
-KdOsFuncs *kdOsFuncs;
+KdOsFuncs *kdOsFuncs;
void
-KdDisableScreen (ScreenPtr pScreen)
+KdDisableScreen(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
if (!pScreenPriv->enabled)
- return;
+ return;
if (!pScreenPriv->closed)
- SetRootClip (pScreen, FALSE);
- KdDisableColormap (pScreen);
+ SetRootClip(pScreen, FALSE);
+ KdDisableColormap(pScreen);
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel)
- (*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
- if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->disableCursor)
- (*pScreenPriv->card->cfuncs->disableCursor) (pScreen);
+ (*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
+ if (!pScreenPriv->screen->softCursor &&
+ pScreenPriv->card->cfuncs->disableCursor)
+ (*pScreenPriv->card->cfuncs->disableCursor) (pScreen);
if (pScreenPriv->card->cfuncs->dpms)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
+ (*pScreenPriv->card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
pScreenPriv->enabled = FALSE;
- if(pScreenPriv->card->cfuncs->disable)
+ if (pScreenPriv->card->cfuncs->disable)
(*pScreenPriv->card->cfuncs->disable) (pScreen);
}
static void
-KdDoSwitchCmd (const char *reason)
+KdDoSwitchCmd(const char *reason)
{
- if (kdSwitchCmd)
- {
- char *command;
-
- if (asprintf(&command, "%s %s", kdSwitchCmd, reason) == -1)
- return;
- system (command);
- free(command);
+ if (kdSwitchCmd) {
+ char *command;
+
+ if (asprintf(&command, "%s %s", kdSwitchCmd, reason) == -1)
+ return;
+ system(command);
+ free(command);
}
}
void
-KdSuspend (void)
+KdSuspend(void)
{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (kdEnabled)
- {
- for (card = kdCardInfo; card; card = card->next)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- if (screen->mynum == card->selected && screen->pScreen)
- KdDisableScreen (screen->pScreen);
- if (card->driver && card->cfuncs->restore)
- (*card->cfuncs->restore) (card);
- }
- KdDisableInput ();
- KdDoSwitchCmd ("suspend");
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (kdEnabled) {
+ for (card = kdCardInfo; card; card = card->next) {
+ for (screen = card->screenList; screen; screen = screen->next)
+ if (screen->mynum == card->selected && screen->pScreen)
+ KdDisableScreen(screen->pScreen);
+ if (card->driver && card->cfuncs->restore)
+ (*card->cfuncs->restore) (card);
+ }
+ KdDisableInput();
+ KdDoSwitchCmd("suspend");
}
}
void
-KdDisableScreens (void)
+KdDisableScreens(void)
{
- KdSuspend ();
- if (kdEnabled)
- {
+ KdSuspend();
+ if (kdEnabled) {
if (kdOsFuncs->Disable)
(*kdOsFuncs->Disable) ();
- kdEnabled = FALSE;
+ kdEnabled = FALSE;
}
}
Bool
-KdEnableScreen (ScreenPtr pScreen)
+KdEnableScreen(ScreenPtr pScreen)
{
- KdScreenPriv (pScreen);
+ KdScreenPriv(pScreen);
if (pScreenPriv->enabled)
- return TRUE;
- if(pScreenPriv->card->cfuncs->enable)
- if (!(*pScreenPriv->card->cfuncs->enable) (pScreen))
- return FALSE;
+ return TRUE;
+ if (pScreenPriv->card->cfuncs->enable)
+ if (!(*pScreenPriv->card->cfuncs->enable) (pScreen))
+ return FALSE;
pScreenPriv->enabled = TRUE;
pScreenPriv->dpmsState = KD_DPMS_NORMAL;
pScreenPriv->card->selected = pScreenPriv->screen->mynum;
- if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->enableCursor)
- (*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
+ if (!pScreenPriv->screen->softCursor &&
+ pScreenPriv->card->cfuncs->enableCursor)
+ (*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel)
- (*pScreenPriv->card->cfuncs->enableAccel) (pScreen);
- KdEnableColormap (pScreen);
- SetRootClip (pScreen, TRUE);
+ (*pScreenPriv->card->cfuncs->enableAccel) (pScreen);
+ KdEnableColormap(pScreen);
+ SetRootClip(pScreen, TRUE);
if (pScreenPriv->card->cfuncs->dpms)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
+ (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
return TRUE;
}
void
-KdResume (void)
+KdResume(void)
{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (kdEnabled)
- {
- KdDoSwitchCmd ("resume");
- for (card = kdCardInfo; card; card = card->next)
- {
- if(card->cfuncs->preserve)
- (*card->cfuncs->preserve) (card);
- for (screen = card->screenList; screen; screen = screen->next)
- if (screen->mynum == card->selected && screen->pScreen)
- KdEnableScreen (screen->pScreen);
- }
- KdEnableInput ();
- KdReleaseAllKeys ();
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (kdEnabled) {
+ KdDoSwitchCmd("resume");
+ for (card = kdCardInfo; card; card = card->next) {
+ if (card->cfuncs->preserve)
+ (*card->cfuncs->preserve) (card);
+ for (screen = card->screenList; screen; screen = screen->next)
+ if (screen->mynum == card->selected && screen->pScreen)
+ KdEnableScreen(screen->pScreen);
+ }
+ KdEnableInput();
+ KdReleaseAllKeys();
}
}
void
-KdEnableScreens (void)
+KdEnableScreens(void)
{
- if (!kdEnabled)
- {
- kdEnabled = TRUE;
+ if (!kdEnabled) {
+ kdEnabled = TRUE;
if (kdOsFuncs->Enable)
(*kdOsFuncs->Enable) ();
}
- KdResume ();
+ KdResume();
}
void
-KdProcessSwitch (void)
+KdProcessSwitch(void)
{
if (kdEnabled)
- KdDisableScreens ();
+ KdDisableScreens();
else
- KdEnableScreens ();
+ KdEnableScreens();
}
#ifndef _MSC_VER
void
AbortDDX(enum ExitCode error)
{
- KdDisableScreens ();
- if (kdOsFuncs)
- {
- if (kdEnabled && kdOsFuncs->Disable)
- (*kdOsFuncs->Disable) ();
+ KdDisableScreens();
+ if (kdOsFuncs) {
+ if (kdEnabled && kdOsFuncs->Disable)
+ (*kdOsFuncs->Disable) ();
if (kdOsFuncs->Fini)
(*kdOsFuncs->Fini) ();
- KdDoSwitchCmd ("stop");
+ KdDoSwitchCmd("stop");
}
if (kdCaughtSignal)
@@ -245,59 +239,57 @@ AbortDDX(enum ExitCode error)
}
void
-ddxGiveUp (enum ExitCode error)
+ddxGiveUp(enum ExitCode error)
{
- AbortDDX (error);
+ AbortDDX(error);
}
#endif
-Bool kdDumbDriver;
-Bool kdSoftCursor;
+Bool kdDumbDriver;
+Bool kdSoftCursor;
char *
-KdParseFindNext (char *cur, const char *delim, char *save, char *last)
+KdParseFindNext(char *cur, const char *delim, char *save, char *last)
{
- while (*cur && !strchr (delim, *cur))
- {
- *save++ = *cur++;
+ while (*cur && !strchr(delim, *cur)) {
+ *save++ = *cur++;
}
*save = 0;
*last = *cur;
if (*cur)
- cur++;
+ cur++;
return cur;
}
Rotation
-KdAddRotation (Rotation a, Rotation b)
+KdAddRotation(Rotation a, Rotation b)
{
- Rotation rotate = (a & RR_Rotate_All) * (b & RR_Rotate_All);
- Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
+ Rotation rotate = (a & RR_Rotate_All) * (b & RR_Rotate_All);
+ Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
if (rotate > RR_Rotate_270)
- rotate /= (RR_Rotate_270 * RR_Rotate_90);
+ rotate /= (RR_Rotate_270 * RR_Rotate_90);
return reflect | rotate;
}
Rotation
-KdSubRotation (Rotation a, Rotation b)
+KdSubRotation(Rotation a, Rotation b)
{
- Rotation rotate = (a & RR_Rotate_All) * 16 / (b & RR_Rotate_All);
- Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
+ Rotation rotate = (a & RR_Rotate_All) * 16 / (b & RR_Rotate_All);
+ Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
if (rotate > RR_Rotate_270)
- rotate /= (RR_Rotate_270 * RR_Rotate_90);
+ rotate /= (RR_Rotate_270 * RR_Rotate_90);
return reflect | rotate;
}
void
-KdParseScreen (KdScreenInfo *screen,
- char *arg)
+KdParseScreen(KdScreenInfo * screen, char *arg)
{
- char delim;
- char save[1024];
- int i;
- int pixels, mm;
+ char delim;
+ char save[1024];
+ int i;
+ int pixels, mm;
screen->dumb = kdDumbDriver;
screen->softCursor = kdSoftCursor;
@@ -311,39 +303,35 @@ KdParseScreen (KdScreenInfo *screen,
screen->rate = 0;
screen->fb.depth = 0;
if (!arg)
- return;
- if (strlen (arg) >= sizeof (save))
- return;
-
- for (i = 0; i < 2; i++)
- {
- arg = KdParseFindNext (arg, "x/@XY", save, &delim);
- if (!save[0])
- return;
-
- pixels = atoi(save);
- mm = 0;
-
- if (delim == '/')
- {
- arg = KdParseFindNext (arg, "x@XY", save, &delim);
- if (!save[0])
- return;
- mm = atoi(save);
- }
-
- if (i == 0)
- {
- screen->width = pixels;
- screen->width_mm = mm;
- }
- else
- {
- screen->height = pixels;
- screen->height_mm = mm;
- }
- if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y')
- return;
+ return;
+ if (strlen(arg) >= sizeof(save))
+ return;
+
+ for (i = 0; i < 2; i++) {
+ arg = KdParseFindNext(arg, "x/@XY", save, &delim);
+ if (!save[0])
+ return;
+
+ pixels = atoi(save);
+ mm = 0;
+
+ if (delim == '/') {
+ arg = KdParseFindNext(arg, "x@XY", save, &delim);
+ if (!save[0])
+ return;
+ mm = atoi(save);
+ }
+
+ if (i == 0) {
+ screen->width = pixels;
+ screen->width_mm = mm;
+ }
+ else {
+ screen->height = pixels;
+ screen->height_mm = mm;
+ }
+ if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y')
+ return;
}
kdOrigin.x += screen->width;
@@ -352,55 +340,49 @@ KdParseScreen (KdScreenInfo *screen,
kdSoftCursor = FALSE;
kdSubpixelOrder = SubPixelUnknown;
- if (delim == '@')
- {
- arg = KdParseFindNext (arg, "xXY", save, &delim);
- if (save[0])
- {
- int rotate = atoi (save);
- if (rotate < 45)
- screen->randr = RR_Rotate_0;
- else if (rotate < 135)
- screen->randr = RR_Rotate_90;
- else if (rotate < 225)
- screen->randr = RR_Rotate_180;
- else if (rotate < 315)
- screen->randr = RR_Rotate_270;
- else
- screen->randr = RR_Rotate_0;
- }
+ if (delim == '@') {
+ arg = KdParseFindNext(arg, "xXY", save, &delim);
+ if (save[0]) {
+ int rotate = atoi(save);
+
+ if (rotate < 45)
+ screen->randr = RR_Rotate_0;
+ else if (rotate < 135)
+ screen->randr = RR_Rotate_90;
+ else if (rotate < 225)
+ screen->randr = RR_Rotate_180;
+ else if (rotate < 315)
+ screen->randr = RR_Rotate_270;
+ else
+ screen->randr = RR_Rotate_0;
+ }
}
- if (delim == 'X')
- {
- arg = KdParseFindNext (arg, "xY", save, &delim);
- screen->randr |= RR_Reflect_X;
+ if (delim == 'X') {
+ arg = KdParseFindNext(arg, "xY", save, &delim);
+ screen->randr |= RR_Reflect_X;
}
- if (delim == 'Y')
- {
- arg = KdParseFindNext (arg, "xY", save, &delim);
- screen->randr |= RR_Reflect_Y;
+ if (delim == 'Y') {
+ arg = KdParseFindNext(arg, "xY", save, &delim);
+ screen->randr |= RR_Reflect_Y;
}
- arg = KdParseFindNext (arg, "x/,", save, &delim);
- if (save[0])
- {
- screen->fb.depth = atoi(save);
- if (delim == '/')
- {
- arg = KdParseFindNext (arg, "x,", save, &delim);
- if (save[0])
- screen->fb.bitsPerPixel = atoi (save);
- }
- else
- screen->fb.bitsPerPixel = 0;
+ arg = KdParseFindNext(arg, "x/,", save, &delim);
+ if (save[0]) {
+ screen->fb.depth = atoi(save);
+ if (delim == '/') {
+ arg = KdParseFindNext(arg, "x,", save, &delim);
+ if (save[0])
+ screen->fb.bitsPerPixel = atoi(save);
+ }
+ else
+ screen->fb.bitsPerPixel = 0;
}
- if (delim == 'x')
- {
- arg = KdParseFindNext (arg, "x", save, &delim);
- if (save[0])
- screen->rate = atoi(save);
+ if (delim == 'x') {
+ arg = KdParseFindNext(arg, "x", save, &delim);
+ if (save[0])
+ screen->rate = atoi(save);
}
}
@@ -416,162 +398,154 @@ KdParseScreen (KdScreenInfo *screen,
*/
void
-KdParseRgba (char *rgba)
+KdParseRgba(char *rgba)
{
- if (!strcmp (rgba, "rgb"))
- kdSubpixelOrder = SubPixelHorizontalRGB;
- else if (!strcmp (rgba, "bgr"))
- kdSubpixelOrder = SubPixelHorizontalBGR;
- else if (!strcmp (rgba, "vrgb"))
- kdSubpixelOrder = SubPixelVerticalRGB;
- else if (!strcmp (rgba, "vbgr"))
- kdSubpixelOrder = SubPixelVerticalBGR;
- else if (!strcmp (rgba, "none"))
- kdSubpixelOrder = SubPixelNone;
+ if (!strcmp(rgba, "rgb"))
+ kdSubpixelOrder = SubPixelHorizontalRGB;
+ else if (!strcmp(rgba, "bgr"))
+ kdSubpixelOrder = SubPixelHorizontalBGR;
+ else if (!strcmp(rgba, "vrgb"))
+ kdSubpixelOrder = SubPixelVerticalRGB;
+ else if (!strcmp(rgba, "vbgr"))
+ kdSubpixelOrder = SubPixelVerticalBGR;
+ else if (!strcmp(rgba, "none"))
+ kdSubpixelOrder = SubPixelNone;
else
- kdSubpixelOrder = SubPixelUnknown;
+ kdSubpixelOrder = SubPixelUnknown;
}
void
-KdUseMsg (void)
+KdUseMsg(void)
{
ErrorF("\nTinyX Device Dependent Usage:\n");
- ErrorF("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][@ROTATION][X][Y][xDEPTH/BPP[xFREQ]] Specify screen characteristics\n");
- ErrorF("-rgba rgb/bgr/vrgb/vbgr/none Specify subpixel ordering for LCD panels\n");
- ErrorF("-mouse driver [,n,,options] Specify the pointer driver and its options (n is the number of buttons)\n");
- ErrorF("-keybd driver [,,options] Specify the keyboard driver and its options\n");
+ ErrorF
+ ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][@ROTATION][X][Y][xDEPTH/BPP[xFREQ]] Specify screen characteristics\n");
+ ErrorF
+ ("-rgba rgb/bgr/vrgb/vbgr/none Specify subpixel ordering for LCD panels\n");
+ ErrorF
+ ("-mouse driver [,n,,options] Specify the pointer driver and its options (n is the number of buttons)\n");
+ ErrorF
+ ("-keybd driver [,,options] Specify the keyboard driver and its options\n");
ErrorF("-zaphod Disable cursor screen switching\n");
ErrorF("-2button Emulate 3 button mouse\n");
ErrorF("-3button Disable 3 button mouse emulation\n");
- ErrorF("-rawcoord Don't transform pointer coordinates on rotation\n");
+ ErrorF
+ ("-rawcoord Don't transform pointer coordinates on rotation\n");
ErrorF("-dumb Disable hardware acceleration\n");
ErrorF("-softCursor Force software cursor\n");
ErrorF("-videoTest Start the server, pause momentarily and exit\n");
- ErrorF("-origin X,Y Locates the next screen in the the virtual screen (Xinerama)\n");
+ ErrorF
+ ("-origin X,Y Locates the next screen in the the virtual screen (Xinerama)\n");
ErrorF("-switchCmd Command to execute on vt switch\n");
ErrorF("-zap Terminate server on Ctrl+Alt+Backspace\n");
- ErrorF("vtxx Use virtual terminal xx instead of the next available\n");
+ ErrorF
+ ("vtxx Use virtual terminal xx instead of the next available\n");
}
int
-KdProcessArgument (int argc, char **argv, int i)
+KdProcessArgument(int argc, char **argv, int i)
{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (!strcmp (argv[i], "-screen"))
- {
- if ((i+1) < argc)
- {
- card = KdCardInfoLast ();
- if (!card)
- {
- InitCard (0);
- card = KdCardInfoLast ();
- }
- if (card) {
- screen = KdScreenInfoAdd (card);
- KdParseScreen (screen, argv[i+1]);
- } else
- ErrorF("No matching card found!\n");
- }
- else
- UseMsg ();
- return 2;
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (!strcmp(argv[i], "-screen")) {
+ if ((i + 1) < argc) {
+ card = KdCardInfoLast();
+ if (!card) {
+ InitCard(0);
+ card = KdCardInfoLast();
+ }
+ if (card) {
+ screen = KdScreenInfoAdd(card);
+ KdParseScreen(screen, argv[i + 1]);
+ }
+ else
+ ErrorF("No matching card found!\n");
+ }
+ else
+ UseMsg();
+ return 2;
}
- if (!strcmp (argv[i], "-zaphod"))
- {
- kdDisableZaphod = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-zaphod")) {
+ kdDisableZaphod = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-zap"))
- {
- kdAllowZap = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-zap")) {
+ kdAllowZap = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-3button"))
- {
- kdEmulateMiddleButton = FALSE;
- return 1;
+ if (!strcmp(argv[i], "-3button")) {
+ kdEmulateMiddleButton = FALSE;
+ return 1;
}
- if (!strcmp (argv[i], "-2button"))
- {
- kdEmulateMiddleButton = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-2button")) {
+ kdEmulateMiddleButton = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-rawcoord"))
- {
- kdRawPointerCoordinates = 1;
- return 1;
+ if (!strcmp(argv[i], "-rawcoord")) {
+ kdRawPointerCoordinates = 1;
+ return 1;
}
- if (!strcmp (argv[i], "-dumb"))
- {
- kdDumbDriver = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-dumb")) {
+ kdDumbDriver = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-softCursor"))
- {
- kdSoftCursor = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-softCursor")) {
+ kdSoftCursor = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-videoTest"))
- {
- kdVideoTest = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-videoTest")) {
+ kdVideoTest = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-origin"))
- {
- if ((i+1) < argc)
- {
- char *x = argv[i+1];
- char *y = strchr (x, ',');
- if (x)
- kdOrigin.x = atoi (x);
- else
- kdOrigin.x = 0;
- if (y)
- kdOrigin.y = atoi(y+1);
- else
- kdOrigin.y = 0;
- }
- else
- UseMsg ();
- return 2;
+ if (!strcmp(argv[i], "-origin")) {
+ if ((i + 1) < argc) {
+ char *x = argv[i + 1];
+ char *y = strchr(x, ',');
+
+ if (x)
+ kdOrigin.x = atoi(x);
+ else
+ kdOrigin.x = 0;
+ if (y)
+ kdOrigin.y = atoi(y + 1);
+ else
+ kdOrigin.y = 0;
+ }
+ else
+ UseMsg();
+ return 2;
}
- if (!strcmp (argv[i], "-rgba"))
- {
- if ((i+1) < argc)
- KdParseRgba (argv[i+1]);
- else
- UseMsg ();
- return 2;
+ if (!strcmp(argv[i], "-rgba")) {
+ if ((i + 1) < argc)
+ KdParseRgba(argv[i + 1]);
+ else
+ UseMsg();
+ return 2;
}
- if (!strcmp (argv[i], "-switchCmd"))
- {
- if ((i+1) < argc)
- kdSwitchCmd = argv[i+1];
- else
- UseMsg ();
- return 2;
+ if (!strcmp(argv[i], "-switchCmd")) {
+ if ((i + 1) < argc)
+ kdSwitchCmd = argv[i + 1];
+ else
+ UseMsg();
+ return 2;
}
- if (!strncmp (argv[i], "vt", 2) &&
- sscanf (argv[i], "vt%2d", &kdVirtualTerminal) == 1)
- {
- return 1;
+ if (!strncmp(argv[i], "vt", 2) &&
+ sscanf(argv[i], "vt%2d", &kdVirtualTerminal) == 1) {
+ return 1;
}
- if (!strcmp (argv[i], "-mouse") ||
- !strcmp (argv[i], "-pointer")) {
+ if (!strcmp(argv[i], "-mouse") || !strcmp(argv[i], "-pointer")) {
if (i + 1 >= argc)
UseMsg();
KdAddConfigPointer(argv[i + 1]);
- kdHasPointer = TRUE;
+ kdHasPointer = TRUE;
return 2;
}
- if (!strcmp (argv[i], "-keybd")) {
+ if (!strcmp(argv[i], "-keybd")) {
if (i + 1 >= argc)
UseMsg();
KdAddConfigKeyboard(argv[i + 1]);
- kdHasKbd = TRUE;
+ kdHasKbd = TRUE;
return 2;
}
@@ -584,116 +558,110 @@ KdProcessArgument (int argc, char **argv, int i)
*/
void
-KdOsInit (KdOsFuncs *pOsFuncs)
+KdOsInit(KdOsFuncs * pOsFuncs)
{
kdOsFuncs = pOsFuncs;
- if (pOsFuncs)
- {
- if (serverGeneration == 1)
- {
- KdDoSwitchCmd ("start");
+ if (pOsFuncs) {
+ if (serverGeneration == 1) {
+ KdDoSwitchCmd("start");
if (pOsFuncs->Init)
(*pOsFuncs->Init) ();
- }
+ }
}
}
Bool
-KdAllocatePrivates (ScreenPtr pScreen)
+KdAllocatePrivates(ScreenPtr pScreen)
{
- KdPrivScreenPtr pScreenPriv;
+ KdPrivScreenPtr pScreenPriv;
if (kdGeneration != serverGeneration)
- kdGeneration = serverGeneration;
+ kdGeneration = serverGeneration;
if (!dixRegisterPrivateKey(&kdScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
- pScreenPriv = calloc(1, sizeof (*pScreenPriv));
+ pScreenPriv = calloc(1, sizeof(*pScreenPriv));
if (!pScreenPriv)
- return FALSE;
- KdSetScreenPriv (pScreen, pScreenPriv);
+ return FALSE;
+ KdSetScreenPriv(pScreen, pScreenPriv);
return TRUE;
}
Bool
-KdCreateScreenResources (ScreenPtr pScreen)
+KdCreateScreenResources(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
+ KdCardInfo *card = pScreenPriv->card;
Bool ret;
pScreen->CreateScreenResources = pScreenPriv->CreateScreenResources;
- if(pScreen->CreateScreenResources)
- ret = (*pScreen->CreateScreenResources) (pScreen);
+ if (pScreen->CreateScreenResources)
+ ret = (*pScreen->CreateScreenResources) (pScreen);
else
- ret= -1;
+ ret = -1;
pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = KdCreateScreenResources;
if (ret && card->cfuncs->createRes)
- ret = (*card->cfuncs->createRes) (pScreen);
+ ret = (*card->cfuncs->createRes) (pScreen);
return ret;
}
Bool
-KdCloseScreen (int index, ScreenPtr pScreen)
+KdCloseScreen(int index, ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = pScreenPriv->card;
- Bool ret;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdCardInfo *card = pScreenPriv->card;
+ Bool ret;
pScreenPriv->closed = TRUE;
pScreen->CloseScreen = pScreenPriv->CloseScreen;
- if(pScreen->CloseScreen)
+ if (pScreen->CloseScreen)
ret = (*pScreen->CloseScreen) (index, pScreen);
else
- ret = TRUE;
+ ret = TRUE;
if (pScreenPriv->dpmsState != KD_DPMS_NORMAL)
- (*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
+ (*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
if (screen->mynum == card->selected)
- KdDisableScreen (pScreen);
+ KdDisableScreen(pScreen);
/*
* Restore video hardware when last screen is closed
*/
- if (screen == card->screenList)
- {
- if (kdEnabled && card->cfuncs->restore)
- (*card->cfuncs->restore) (card);
+ if (screen == card->screenList) {
+ if (kdEnabled && card->cfuncs->restore)
+ (*card->cfuncs->restore) (card);
}
if (!pScreenPriv->screen->dumb && card->cfuncs->finiAccel)
- (*card->cfuncs->finiAccel) (pScreen);
+ (*card->cfuncs->finiAccel) (pScreen);
if (!pScreenPriv->screen->softCursor && card->cfuncs->finiCursor)
- (*card->cfuncs->finiCursor) (pScreen);
+ (*card->cfuncs->finiCursor) (pScreen);
- if(card->cfuncs->scrfini)
+ if (card->cfuncs->scrfini)
(*card->cfuncs->scrfini) (screen);
/*
* Clean up card when last screen is closed, DIX closes them in
* reverse order, thus we check for when the first in the list is closed
*/
- if (screen == card->screenList)
- {
- if(card->cfuncs->cardfini)
- (*card->cfuncs->cardfini) (card);
- /*
- * Clean up OS when last card is closed
- */
- if (card == kdCardInfo)
- {
- if (kdEnabled)
- {
- kdEnabled = FALSE;
- if(kdOsFuncs->Disable)
- (*kdOsFuncs->Disable) ();
- }
- }
+ if (screen == card->screenList) {
+ if (card->cfuncs->cardfini)
+ (*card->cfuncs->cardfini) (card);
+ /*
+ * Clean up OS when last card is closed
+ */
+ if (card == kdCardInfo) {
+ if (kdEnabled) {
+ kdEnabled = FALSE;
+ if (kdOsFuncs->Disable)
+ (*kdOsFuncs->Disable) ();
+ }
+ }
}
pScreenPriv->screen->pScreen = 0;
@@ -703,112 +671,107 @@ KdCloseScreen (int index, ScreenPtr pScreen)
}
Bool
-KdSaveScreen (ScreenPtr pScreen, int on)
+KdSaveScreen(ScreenPtr pScreen, int on)
{
KdScreenPriv(pScreen);
- int dpmsState;
+ int dpmsState;
if (!pScreenPriv->card->cfuncs->dpms)
- return FALSE;
+ return FALSE;
dpmsState = pScreenPriv->dpmsState;
switch (on) {
case SCREEN_SAVER_OFF:
- dpmsState = KD_DPMS_NORMAL;
- break;
+ dpmsState = KD_DPMS_NORMAL;
+ break;
case SCREEN_SAVER_ON:
- if (dpmsState == KD_DPMS_NORMAL)
- dpmsState = KD_DPMS_NORMAL+1;
- break;
+ if (dpmsState == KD_DPMS_NORMAL)
+ dpmsState = KD_DPMS_NORMAL + 1;
+ break;
case SCREEN_SAVER_CYCLE:
- if (dpmsState < KD_DPMS_MAX)
- dpmsState++;
- break;
+ if (dpmsState < KD_DPMS_MAX)
+ dpmsState++;
+ break;
case SCREEN_SAVER_FORCER:
- break;
+ break;
}
- if (dpmsState != pScreenPriv->dpmsState)
- {
- if (pScreenPriv->enabled)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, dpmsState);
- pScreenPriv->dpmsState = dpmsState;
+ if (dpmsState != pScreenPriv->dpmsState) {
+ if (pScreenPriv->enabled)
+ (*pScreenPriv->card->cfuncs->dpms) (pScreen, dpmsState);
+ pScreenPriv->dpmsState = dpmsState;
}
return TRUE;
}
static Bool
-KdCreateWindow (WindowPtr pWin)
+KdCreateWindow(WindowPtr pWin)
{
#ifndef PHOENIX
- if (!pWin->parent)
- {
- KdScreenPriv(pWin->drawable.pScreen);
-
- if (!pScreenPriv->enabled)
- {
- RegionEmpty(&pWin->borderClip);
- RegionBreak(&pWin->clipList);
- }
+ if (!pWin->parent) {
+ KdScreenPriv(pWin->drawable.pScreen);
+
+ if (!pScreenPriv->enabled) {
+ RegionEmpty(&pWin->borderClip);
+ RegionBreak(&pWin->clipList);
+ }
}
#endif
- return fbCreateWindow (pWin);
+ return fbCreateWindow(pWin);
}
void
-KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr)
+KdSetSubpixelOrder(ScreenPtr pScreen, Rotation randr)
{
KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int subpixel_order = screen->subpixel_order;
- Rotation subpixel_dir;
- int i;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int subpixel_order = screen->subpixel_order;
+ Rotation subpixel_dir;
+ int i;
static struct {
- int subpixel_order;
- Rotation direction;
+ int subpixel_order;
+ Rotation direction;
} orders[] = {
- { SubPixelHorizontalRGB, RR_Rotate_0 },
- { SubPixelHorizontalBGR, RR_Rotate_180 },
- { SubPixelVerticalRGB, RR_Rotate_270 },
- { SubPixelVerticalBGR, RR_Rotate_90 },
- };
+ {
+ SubPixelHorizontalRGB, RR_Rotate_0}, {
+ SubPixelHorizontalBGR, RR_Rotate_180}, {
+ SubPixelVerticalRGB, RR_Rotate_270}, {
+ SubPixelVerticalBGR, RR_Rotate_90},};
static struct {
- int bit;
- int normal;
- int reflect;
+ int bit;
+ int normal;
+ int reflect;
} reflects[] = {
- { RR_Reflect_X, SubPixelHorizontalRGB, SubPixelHorizontalBGR },
- { RR_Reflect_X, SubPixelHorizontalBGR, SubPixelHorizontalRGB },
- { RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalBGR },
- { RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalRGB },
- };
+ {
+ RR_Reflect_X, SubPixelHorizontalRGB, SubPixelHorizontalBGR}, {
+ RR_Reflect_X, SubPixelHorizontalBGR, SubPixelHorizontalRGB}, {
+ RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalBGR}, {
+ RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalRGB},};
/* map subpixel to direction */
for (i = 0; i < 4; i++)
- if (orders[i].subpixel_order == subpixel_order)
- break;
- if (i < 4)
- {
- subpixel_dir = KdAddRotation (randr & RR_Rotate_All, orders[i].direction);
-
- /* map back to subpixel order */
- for (i = 0; i < 4; i++)
- if (orders[i].direction & subpixel_dir)
- {
- subpixel_order = orders[i].subpixel_order;
- break;
- }
- /* reflect */
- for (i = 0; i < 4; i++)
- if ((randr & reflects[i].bit) &&
- reflects[i].normal == subpixel_order)
- {
- subpixel_order = reflects[i].reflect;
- break;
- }
+ if (orders[i].subpixel_order == subpixel_order)
+ break;
+ if (i < 4) {
+ subpixel_dir =
+ KdAddRotation(randr & RR_Rotate_All, orders[i].direction);
+
+ /* map back to subpixel order */
+ for (i = 0; i < 4; i++)
+ if (orders[i].direction & subpixel_dir) {
+ subpixel_order = orders[i].subpixel_order;
+ break;
+ }
+ /* reflect */
+ for (i = 0; i < 4; i++)
+ if ((randr & reflects[i].bit) &&
+ reflects[i].normal == subpixel_order) {
+ subpixel_order = reflects[i].reflect;
+ break;
+ }
}
- PictureSetSubpixelOrder (pScreen, subpixel_order);
+ PictureSetSubpixelOrder(pScreen, subpixel_order);
}
/* Pass through AddScreen, which doesn't take any closure */
@@ -817,34 +780,33 @@ static KdScreenInfo *kdCurrentScreen;
Bool
KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
{
- KdScreenInfo *screen = kdCurrentScreen;
- KdCardInfo *card = screen->card;
- KdPrivScreenPtr pScreenPriv;
+ KdScreenInfo *screen = kdCurrentScreen;
+ KdCardInfo *card = screen->card;
+ KdPrivScreenPtr pScreenPriv;
+
/*
* note that screen->fb is set up for the nominal orientation
* of the screen; that means if randr is rotated, the values
* there should reflect a rotated frame buffer (or shadow).
*/
- Bool rotated = (screen->randr & (RR_Rotate_90|RR_Rotate_270)) != 0;
- int width, height, *width_mmp, *height_mmp;
+ Bool rotated = (screen->randr & (RR_Rotate_90 | RR_Rotate_270)) != 0;
+ int width, height, *width_mmp, *height_mmp;
- KdAllocatePrivates (pScreen);
+ KdAllocatePrivates(pScreen);
pScreenPriv = KdGetScreenPriv(pScreen);
- if (!rotated)
- {
- width = screen->width;
- height = screen->height;
- width_mmp = &screen->width_mm;
- height_mmp = &screen->height_mm;
+ if (!rotated) {
+ width = screen->width;
+ height = screen->height;
+ width_mmp = &screen->width_mm;
+ height_mmp = &screen->height_mm;
}
- else
- {
- width = screen->height;
- height = screen->width;
- width_mmp = &screen->height_mm;
- height_mmp = &screen->width_mm;
+ else {
+ width = screen->height;
+ height = screen->width;
+ width_mmp = &screen->height_mm;
+ height_mmp = &screen->width_mm;
}
screen->pScreen = pScreen;
pScreenPriv->screen = screen;
@@ -855,41 +817,37 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
pScreen->y = screen->origin.y;
if (!monitorResolution)
- monitorResolution = 75;
+ monitorResolution = 75;
/*
* This is done in this order so that backing store wraps
* our GC functions; fbFinishScreenInit initializes MI
* backing store
*/
- if (!fbSetupScreen (pScreen,
- screen->fb.frameBuffer,
- width, height,
- monitorResolution, monitorResolution,
- screen->fb.pixelStride,
- screen->fb.bitsPerPixel))
- {
- return FALSE;
+ if (!fbSetupScreen(pScreen,
+ screen->fb.frameBuffer,
+ width, height,
+ monitorResolution, monitorResolution,
+ screen->fb.pixelStride, screen->fb.bitsPerPixel)) {
+ return FALSE;
}
/*
* Set colormap functions
*/
- pScreen->InstallColormap = KdInstallColormap;
- pScreen->UninstallColormap = KdUninstallColormap;
+ pScreen->InstallColormap = KdInstallColormap;
+ pScreen->UninstallColormap = KdUninstallColormap;
pScreen->ListInstalledColormaps = KdListInstalledColormaps;
- pScreen->StoreColors = KdStoreColors;
-
- pScreen->SaveScreen = KdSaveScreen;
- pScreen->CreateWindow = KdCreateWindow;
-
- if (!fbFinishScreenInit (pScreen,
- screen->fb.frameBuffer,
- width, height,
- monitorResolution, monitorResolution,
- screen->fb.pixelStride,
- screen->fb.bitsPerPixel))
- {
- return FALSE;
+ pScreen->StoreColors = KdStoreColors;
+
+ pScreen->SaveScreen = KdSaveScreen;
+ pScreen->CreateWindow = KdCreateWindow;
+
+ if (!fbFinishScreenInit(pScreen,
+ screen->fb.frameBuffer,
+ width, height,
+ monitorResolution, monitorResolution,
+ screen->fb.pixelStride, screen->fb.bitsPerPixel)) {
+ return FALSE;
}
/*
@@ -897,44 +855,44 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
* Rounding errors are annoying
*/
if (*width_mmp)
- pScreen->mmWidth = *width_mmp;
+ pScreen->mmWidth = *width_mmp;
else
- *width_mmp = pScreen->mmWidth;
+ *width_mmp = pScreen->mmWidth;
if (*height_mmp)
- pScreen->mmHeight = *height_mmp;
+ pScreen->mmHeight = *height_mmp;
else
- *height_mmp = pScreen->mmHeight;
+ *height_mmp = pScreen->mmHeight;
/*
* Plug in our own block/wakeup handlers.
* miScreenInit installs NoopDDA in both places
*/
- pScreen->BlockHandler = KdBlockHandler;
- pScreen->WakeupHandler = KdWakeupHandler;
+ pScreen->BlockHandler = KdBlockHandler;
+ pScreen->WakeupHandler = KdWakeupHandler;
- if (!fbPictureInit (pScreen, 0, 0))
- return FALSE;
+ if (!fbPictureInit(pScreen, 0, 0))
+ return FALSE;
if (card->cfuncs->initScreen)
- if (!(*card->cfuncs->initScreen) (pScreen))
- return FALSE;
+ if (!(*card->cfuncs->initScreen) (pScreen))
+ return FALSE;
if (!screen->dumb && card->cfuncs->initAccel)
- if (!(*card->cfuncs->initAccel) (pScreen))
- screen->dumb = TRUE;
+ if (!(*card->cfuncs->initAccel) (pScreen))
+ screen->dumb = TRUE;
if (card->cfuncs->finishInitScreen)
- if (!(*card->cfuncs->finishInitScreen) (pScreen))
- return FALSE;
+ if (!(*card->cfuncs->finishInitScreen) (pScreen))
+ return FALSE;
#if 0
- fbInitValidateTree (pScreen);
+ fbInitValidateTree(pScreen);
#endif
/*
* Wrap CloseScreen, the order now is:
- * KdCloseScreen
- * miBSCloseScreen
- * fbCloseScreen
+ * KdCloseScreen
+ * miBSCloseScreen
+ * fbCloseScreen
*/
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = KdCloseScreen;
@@ -943,78 +901,70 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
pScreen->CreateScreenResources = KdCreateScreenResources;
if (screen->softCursor ||
- !card->cfuncs->initCursor ||
- !(*card->cfuncs->initCursor) (pScreen))
- {
- /* Use MI for cursor display and event queueing. */
- screen->softCursor = TRUE;
- miDCInitialize(pScreen, &kdPointerScreenFuncs);
+ !card->cfuncs->initCursor || !(*card->cfuncs->initCursor) (pScreen)) {
+ /* Use MI for cursor display and event queueing. */
+ screen->softCursor = TRUE;
+ miDCInitialize(pScreen, &kdPointerScreenFuncs);
}
-
- if (!fbCreateDefColormap (pScreen))
- {
- return FALSE;
+ if (!fbCreateDefColormap(pScreen)) {
+ return FALSE;
}
- KdSetSubpixelOrder (pScreen, screen->randr);
+ KdSetSubpixelOrder(pScreen, screen->randr);
/*
* Enable the hardware
*/
- if (!kdEnabled)
- {
- kdEnabled = TRUE;
- if(kdOsFuncs->Enable)
- (*kdOsFuncs->Enable) ();
+ if (!kdEnabled) {
+ kdEnabled = TRUE;
+ if (kdOsFuncs->Enable)
+ (*kdOsFuncs->Enable) ();
}
- if (screen->mynum == card->selected)
- {
- if(card->cfuncs->preserve)
- (*card->cfuncs->preserve) (card);
- if(card->cfuncs->enable)
- if (!(*card->cfuncs->enable) (pScreen))
- return FALSE;
- pScreenPriv->enabled = TRUE;
- if (!screen->softCursor && card->cfuncs->enableCursor)
- (*card->cfuncs->enableCursor) (pScreen);
- KdEnableColormap (pScreen);
- if (!screen->dumb && card->cfuncs->enableAccel)
- (*card->cfuncs->enableAccel) (pScreen);
+ if (screen->mynum == card->selected) {
+ if (card->cfuncs->preserve)
+ (*card->cfuncs->preserve) (card);
+ if (card->cfuncs->enable)
+ if (!(*card->cfuncs->enable) (pScreen))
+ return FALSE;
+ pScreenPriv->enabled = TRUE;
+ if (!screen->softCursor && card->cfuncs->enableCursor)
+ (*card->cfuncs->enableCursor) (pScreen);
+ KdEnableColormap(pScreen);
+ if (!screen->dumb && card->cfuncs->enableAccel)
+ (*card->cfuncs->enableAccel) (pScreen);
}
return TRUE;
}
void
-KdInitScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv)
+KdInitScreen(ScreenInfo * pScreenInfo,
+ KdScreenInfo * screen, int argc, char **argv)
{
- KdCardInfo *card = screen->card;
+ KdCardInfo *card = screen->card;
(*card->cfuncs->scrinit) (screen);
if (!card->cfuncs->initAccel)
- screen->dumb = TRUE;
+ screen->dumb = TRUE;
if (!card->cfuncs->initCursor)
- screen->softCursor = TRUE;
+ screen->softCursor = TRUE;
}
static Bool
-KdSetPixmapFormats (ScreenInfo *pScreenInfo)
+KdSetPixmapFormats(ScreenInfo * pScreenInfo)
{
- CARD8 depthToBpp[33]; /* depth -> bpp map */
- KdCardInfo *card;
- KdScreenInfo *screen;
- int i;
- int bpp;
+ CARD8 depthToBpp[33]; /* depth -> bpp map */
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+ int i;
+ int bpp;
PixmapFormatRec *format;
for (i = 1; i <= 32; i++)
- depthToBpp[i] = 0;
+ depthToBpp[i] = 0;
/*
* Generate mappings between bitsPerPixel and depth,
@@ -1022,148 +972,135 @@ KdSetPixmapFormats (ScreenInfo *pScreenInfo)
* restrictions on equivalent formats for the same
* depth on different screens
*/
- for (card = kdCardInfo; card; card = card->next)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- {
- bpp = screen->fb.bitsPerPixel;
- if (bpp == 24)
- bpp = 32;
- if (!depthToBpp[screen->fb.depth])
- depthToBpp[screen->fb.depth] = bpp;
- else if (depthToBpp[screen->fb.depth] != bpp)
- return FALSE;
- }
+ for (card = kdCardInfo; card; card = card->next) {
+ for (screen = card->screenList; screen; screen = screen->next) {
+ bpp = screen->fb.bitsPerPixel;
+ if (bpp == 24)
+ bpp = 32;
+ if (!depthToBpp[screen->fb.depth])
+ depthToBpp[screen->fb.depth] = bpp;
+ else if (depthToBpp[screen->fb.depth] != bpp)
+ return FALSE;
+ }
}
/*
* Fill in additional formats
*/
for (i = 0; i < NUM_KD_DEPTHS; i++)
- if (!depthToBpp[kdDepths[i].depth])
- depthToBpp[kdDepths[i].depth] = kdDepths[i].bpp;
+ if (!depthToBpp[kdDepths[i].depth])
+ depthToBpp[kdDepths[i].depth] = kdDepths[i].bpp;
- pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
pScreenInfo->numPixmapFormats = 0;
- for (i = 1; i <= 32; i++)
- {
- if (depthToBpp[i])
- {
- format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
- format->depth = i;
- format->bitsPerPixel = depthToBpp[i];
- format->scanlinePad = BITMAP_SCANLINE_PAD;
- }
+ for (i = 1; i <= 32; i++) {
+ if (depthToBpp[i]) {
+ format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
+ format->depth = i;
+ format->bitsPerPixel = depthToBpp[i];
+ format->scanlinePad = BITMAP_SCANLINE_PAD;
+ }
}
return TRUE;
}
static void
-KdAddScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv)
+KdAddScreen(ScreenInfo * pScreenInfo,
+ KdScreenInfo * screen, int argc, char **argv)
{
- int i;
+ int i;
+
/*
* Fill in fb visual type masks for this screen
*/
- for (i = 0; i < pScreenInfo->numPixmapFormats; i++)
- {
- unsigned long visuals;
- Pixel rm, gm, bm;
-
- visuals = 0;
- rm = gm = bm = 0;
- if (pScreenInfo->formats[i].depth == screen->fb.depth)
- {
- visuals = screen->fb.visuals;
- rm = screen->fb.redMask;
- gm = screen->fb.greenMask;
- bm = screen->fb.blueMask;
- }
- fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
- visuals,
- 8,
- rm, gm, bm);
+ for (i = 0; i < pScreenInfo->numPixmapFormats; i++) {
+ unsigned long visuals;
+ Pixel rm, gm, bm;
+
+ visuals = 0;
+ rm = gm = bm = 0;
+ if (pScreenInfo->formats[i].depth == screen->fb.depth) {
+ visuals = screen->fb.visuals;
+ rm = screen->fb.redMask;
+ gm = screen->fb.greenMask;
+ bm = screen->fb.blueMask;
+ }
+ fbSetVisualTypesAndMasks(pScreenInfo->formats[i].depth,
+ visuals, 8, rm, gm, bm);
}
kdCurrentScreen = screen;
- AddScreen (KdScreenInit, argc, argv);
+ AddScreen(KdScreenInit, argc, argv);
}
-#if 0 /* This function is not used currently */
+#if 0 /* This function is not used currently */
int
-KdDepthToFb (ScreenPtr pScreen, int depth)
+KdDepthToFb(ScreenPtr pScreen, int depth)
{
KdScreenPriv(pScreen);
for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb.frameBuffer; fb++)
- if (pScreenPriv->screen->fb.depth == depth)
- return fb;
+ if (pScreenPriv->screen->fb.depth == depth)
+ return fb;
}
#endif
static int
-KdSignalWrapper (int signum)
+KdSignalWrapper(int signum)
{
kdCaughtSignal = TRUE;
- return 1; /* use generic OS layer cleanup & abort */
+ return 1; /* use generic OS layer cleanup & abort */
}
void
-KdInitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
+KdInitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (!kdCardInfo)
- {
- InitCard (0);
- if (!(card = KdCardInfoLast ()))
- FatalError("No matching cards found!\n");
- screen = KdScreenInfoAdd (card);
- KdParseScreen (screen, 0);
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (!kdCardInfo) {
+ InitCard(0);
+ if (!(card = KdCardInfoLast()))
+ FatalError("No matching cards found!\n");
+ screen = KdScreenInfoAdd(card);
+ KdParseScreen(screen, 0);
}
/*
* Initialize all of the screens for all of the cards
*/
- for (card = kdCardInfo; card; card = card->next)
- {
- int ret=1;
- if(card->cfuncs->cardinit)
- ret=(*card->cfuncs->cardinit) (card);
- if (ret)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- KdInitScreen (pScreenInfo, screen, argc, argv);
- }
+ for (card = kdCardInfo; card; card = card->next) {
+ int ret = 1;
+
+ if (card->cfuncs->cardinit)
+ ret = (*card->cfuncs->cardinit) (card);
+ if (ret) {
+ for (screen = card->screenList; screen; screen = screen->next)
+ KdInitScreen(pScreenInfo, screen, argc, argv);
+ }
}
/*
* Merge the various pixmap formats together, this can fail
* when two screens share depth but not bitsPerPixel
*/
- if (!KdSetPixmapFormats (pScreenInfo))
- return;
+ if (!KdSetPixmapFormats(pScreenInfo))
+ return;
/*
* Add all of the screens
*/
for (card = kdCardInfo; card; card = card->next)
- for (screen = card->screenList; screen; screen = screen->next)
- KdAddScreen (pScreenInfo, screen, argc, argv);
+ for (screen = card->screenList; screen; screen = screen->next)
+ KdAddScreen(pScreenInfo, screen, argc, argv);
OsRegisterSigWrapper(KdSignalWrapper);
}
@@ -1181,7 +1118,7 @@ DPMSSet(ClientPtr client, int level)
}
Bool
-DPMSSupported (void)
+DPMSSupported(void)
{
return FALSE;
}
diff --git a/xorg-server/hw/kdrive/src/kdrive.h b/xorg-server/hw/kdrive/src/kdrive.h
index 7289e30dd..4125307f3 100644
--- a/xorg-server/hw/kdrive/src/kdrive.h
+++ b/xorg-server/hw/kdrive/src/kdrive.h
@@ -56,80 +56,80 @@
typedef int Status;
typedef struct _KdCardInfo {
- struct _KdCardFuncs *cfuncs;
- void *closure;
- void *driver;
- struct _KdScreenInfo *screenList;
- int selected;
- struct _KdCardInfo *next;
+ struct _KdCardFuncs *cfuncs;
+ void *closure;
+ void *driver;
+ struct _KdScreenInfo *screenList;
+ int selected;
+ struct _KdCardInfo *next;
} KdCardInfo;
-extern KdCardInfo *kdCardInfo;
+extern KdCardInfo *kdCardInfo;
/*
* Configuration information per X screen
*/
typedef struct _KdFrameBuffer {
- CARD8 *frameBuffer;
- int depth;
- int bitsPerPixel;
- int pixelStride;
- int byteStride;
- Bool shadow;
- unsigned long visuals;
- Pixel redMask, greenMask, blueMask;
- void *closure;
+ CARD8 *frameBuffer;
+ int depth;
+ int bitsPerPixel;
+ int pixelStride;
+ int byteStride;
+ Bool shadow;
+ unsigned long visuals;
+ Pixel redMask, greenMask, blueMask;
+ void *closure;
} KdFrameBuffer;
#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
#define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y)
typedef struct _KdScreenInfo {
- struct _KdScreenInfo *next;
- KdCardInfo *card;
- ScreenPtr pScreen;
- void *driver;
- Rotation randr; /* rotation and reflection */
- int width;
- int height;
- int rate;
- int width_mm;
- int height_mm;
- int subpixel_order;
- Bool dumb;
- Bool softCursor;
- int mynum;
- DDXPointRec origin;
- KdFrameBuffer fb;
+ struct _KdScreenInfo *next;
+ KdCardInfo *card;
+ ScreenPtr pScreen;
+ void *driver;
+ Rotation randr; /* rotation and reflection */
+ int width;
+ int height;
+ int rate;
+ int width_mm;
+ int height_mm;
+ int subpixel_order;
+ Bool dumb;
+ Bool softCursor;
+ int mynum;
+ DDXPointRec origin;
+ KdFrameBuffer fb;
} KdScreenInfo;
typedef struct _KdCardFuncs {
- Bool (*cardinit) (KdCardInfo *); /* detect and map device */
- Bool (*scrinit) (KdScreenInfo *);/* initialize screen information */
- Bool (*initScreen) (ScreenPtr); /* initialize ScreenRec */
- Bool (*finishInitScreen) (ScreenPtr pScreen);
- Bool (*createRes) (ScreenPtr); /* create screen resources */
- void (*preserve) (KdCardInfo *); /* save graphics card state */
- Bool (*enable) (ScreenPtr); /* set up for rendering */
- Bool (*dpms) (ScreenPtr, int); /* set DPMS screen saver */
- void (*disable) (ScreenPtr); /* turn off rendering */
- void (*restore) (KdCardInfo *); /* restore graphics card state */
- void (*scrfini) (KdScreenInfo *);/* close down screen */
- void (*cardfini) (KdCardInfo *); /* close down */
-
- Bool (*initCursor) (ScreenPtr); /* detect and map cursor */
- void (*enableCursor) (ScreenPtr); /* enable cursor */
- void (*disableCursor) (ScreenPtr); /* disable cursor */
- void (*finiCursor) (ScreenPtr); /* close down */
- void (*recolorCursor) (ScreenPtr, int, xColorItem *);
-
- Bool (*initAccel) (ScreenPtr);
- void (*enableAccel) (ScreenPtr);
- void (*disableAccel) (ScreenPtr);
- void (*finiAccel) (ScreenPtr);
-
- void (*getColors) (ScreenPtr, int, xColorItem *);
- void (*putColors) (ScreenPtr, int, xColorItem *);
+ Bool (*cardinit) (KdCardInfo *); /* detect and map device */
+ Bool (*scrinit) (KdScreenInfo *); /* initialize screen information */
+ Bool (*initScreen) (ScreenPtr); /* initialize ScreenRec */
+ Bool (*finishInitScreen) (ScreenPtr pScreen);
+ Bool (*createRes) (ScreenPtr); /* create screen resources */
+ void (*preserve) (KdCardInfo *); /* save graphics card state */
+ Bool (*enable) (ScreenPtr); /* set up for rendering */
+ Bool (*dpms) (ScreenPtr, int); /* set DPMS screen saver */
+ void (*disable) (ScreenPtr); /* turn off rendering */
+ void (*restore) (KdCardInfo *); /* restore graphics card state */
+ void (*scrfini) (KdScreenInfo *); /* close down screen */
+ void (*cardfini) (KdCardInfo *); /* close down */
+
+ Bool (*initCursor) (ScreenPtr); /* detect and map cursor */
+ void (*enableCursor) (ScreenPtr); /* enable cursor */
+ void (*disableCursor) (ScreenPtr); /* disable cursor */
+ void (*finiCursor) (ScreenPtr); /* close down */
+ void (*recolorCursor) (ScreenPtr, int, xColorItem *);
+
+ Bool (*initAccel) (ScreenPtr);
+ void (*enableAccel) (ScreenPtr);
+ void (*disableAccel) (ScreenPtr);
+ void (*finiAccel) (ScreenPtr);
+
+ void (*getColors) (ScreenPtr, int, xColorItem *);
+ void (*putColors) (ScreenPtr, int, xColorItem *);
} KdCardFuncs;
@@ -137,20 +137,20 @@ typedef struct _KdCardFuncs {
#define KD_MAX_PSEUDO_SIZE (1 << KD_MAX_PSEUDO_DEPTH)
typedef struct {
- KdScreenInfo *screen;
- KdCardInfo *card;
+ KdScreenInfo *screen;
+ KdCardInfo *card;
- Bool enabled;
- Bool closed;
- int bytesPerPixel;
+ Bool enabled;
+ Bool closed;
+ int bytesPerPixel;
- int dpmsState;
+ int dpmsState;
- ColormapPtr pInstalledmap; /* current colormap */
- xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */
+ ColormapPtr pInstalledmap; /* current colormap */
+ xColorItem systemPalette[KD_MAX_PSEUDO_SIZE]; /* saved windows colors */
- CreateScreenResourcesProcPtr CreateScreenResources;
- CloseScreenProcPtr CloseScreen;
+ CreateScreenResourcesProcPtr CreateScreenResources;
+ CloseScreenProcPtr CloseScreen;
} KdPrivScreenRec, *KdPrivScreenPtr;
typedef enum _kdPointerState {
@@ -175,33 +175,33 @@ typedef enum _kdPointerState {
typedef struct _KdPointerInfo KdPointerInfo;
typedef struct _KdPointerDriver {
- char *name;
- Status (*Init) (KdPointerInfo *);
- Status (*Enable) (KdPointerInfo *);
- void (*Disable) (KdPointerInfo *);
- void (*Fini) (KdPointerInfo *);
+ char *name;
+ Status(*Init) (KdPointerInfo *);
+ Status(*Enable) (KdPointerInfo *);
+ void (*Disable) (KdPointerInfo *);
+ void (*Fini) (KdPointerInfo *);
struct _KdPointerDriver *next;
} KdPointerDriver;
struct _KdPointerInfo {
- DeviceIntPtr dixdev;
- char *name;
- char *path;
- char *protocol;
- InputOption *options;
- int inputClass;
-
- CARD8 map[KD_MAX_BUTTON + 1];
- int nButtons;
- int nAxes;
-
- Bool emulateMiddleButton;
- unsigned long emulationTimeout;
- int emulationDx, emulationDy;
-
- Bool timeoutPending;
- KdPointerState mouseState;
- Bool eventHeld;
+ DeviceIntPtr dixdev;
+ char *name;
+ char *path;
+ char *protocol;
+ InputOption *options;
+ int inputClass;
+
+ CARD8 map[KD_MAX_BUTTON + 1];
+ int nButtons;
+ int nAxes;
+
+ Bool emulateMiddleButton;
+ unsigned long emulationTimeout;
+ int emulationDx, emulationDy;
+
+ Bool timeoutPending;
+ KdPointerState mouseState;
+ Bool eventHeld;
struct {
int type;
int x;
@@ -210,26 +210,25 @@ struct _KdPointerInfo {
int flags;
int absrel;
} heldEvent;
- unsigned char buttonState;
- Bool transformCoordinates;
- int pressureThreshold;
+ unsigned char buttonState;
+ Bool transformCoordinates;
+ int pressureThreshold;
- KdPointerDriver *driver;
- void *driverPrivate;
+ KdPointerDriver *driver;
+ void *driverPrivate;
struct _KdPointerInfo *next;
};
extern int KdCurScreen;
-void KdAddPointerDriver (KdPointerDriver *driver);
-void KdRemovePointerDriver (KdPointerDriver *driver);
-KdPointerInfo *KdNewPointer (void);
-void KdFreePointer (KdPointerInfo *);
-int KdAddPointer (KdPointerInfo *ki);
-int KdAddConfigPointer (char *pointer);
-void KdRemovePointer (KdPointerInfo *ki);
-
+void KdAddPointerDriver(KdPointerDriver * driver);
+void KdRemovePointerDriver(KdPointerDriver * driver);
+KdPointerInfo *KdNewPointer(void);
+void KdFreePointer(KdPointerInfo *);
+int KdAddPointer(KdPointerInfo * ki);
+int KdAddConfigPointer(char *pointer);
+void KdRemovePointer(KdPointerInfo * ki);
#define KD_KEY_COUNT 248
#define KD_MIN_KEYCODE 8
@@ -239,64 +238,64 @@ void KdRemovePointer (KdPointerInfo *ki);
typedef struct {
KeySym modsym;
- int modbit;
+ int modbit;
} KdKeySymModsRec;
typedef struct _KdKeyboardInfo KdKeyboardInfo;
typedef struct _KdKeyboardDriver {
- char *name;
- Bool (*Init) (KdKeyboardInfo *);
- Bool (*Enable) (KdKeyboardInfo *);
- void (*Leds) (KdKeyboardInfo *, int);
- void (*Bell) (KdKeyboardInfo *, int, int, int);
- void (*Disable) (KdKeyboardInfo *);
- void (*Fini) (KdKeyboardInfo *);
+ char *name;
+ Bool (*Init) (KdKeyboardInfo *);
+ Bool (*Enable) (KdKeyboardInfo *);
+ void (*Leds) (KdKeyboardInfo *, int);
+ void (*Bell) (KdKeyboardInfo *, int, int, int);
+ void (*Disable) (KdKeyboardInfo *);
+ void (*Fini) (KdKeyboardInfo *);
struct _KdKeyboardDriver *next;
} KdKeyboardDriver;
struct _KdKeyboardInfo {
struct _KdKeyboardInfo *next;
- DeviceIntPtr dixdev;
- void *closure;
- char *name;
- char *path;
- int inputClass;
- char *xkbRules;
- char *xkbModel;
- char *xkbLayout;
- char *xkbVariant;
- char *xkbOptions;
- int LockLed;
-
- int minScanCode;
- int maxScanCode;
-
- int leds;
- int bellPitch;
- int bellDuration;
- InputOption *options;
-
- KdKeyboardDriver *driver;
- void *driverPrivate;
+ DeviceIntPtr dixdev;
+ void *closure;
+ char *name;
+ char *path;
+ int inputClass;
+ char *xkbRules;
+ char *xkbModel;
+ char *xkbLayout;
+ char *xkbVariant;
+ char *xkbOptions;
+ int LockLed;
+
+ int minScanCode;
+ int maxScanCode;
+
+ int leds;
+ int bellPitch;
+ int bellDuration;
+ InputOption *options;
+
+ KdKeyboardDriver *driver;
+ void *driverPrivate;
};
-void KdAddKeyboardDriver (KdKeyboardDriver *driver);
-void KdRemoveKeyboardDriver (KdKeyboardDriver *driver);
-KdKeyboardInfo *KdNewKeyboard (void);
-void KdFreeKeyboard (KdKeyboardInfo *ki);
-int KdAddConfigKeyboard (char *pointer);
-int KdAddKeyboard (KdKeyboardInfo *ki);
-void KdRemoveKeyboard (KdKeyboardInfo *ki);
+void KdAddKeyboardDriver(KdKeyboardDriver * driver);
+void KdRemoveKeyboardDriver(KdKeyboardDriver * driver);
+KdKeyboardInfo *KdNewKeyboard(void);
+void KdFreeKeyboard(KdKeyboardInfo * ki);
+int KdAddConfigKeyboard(char *pointer);
+int KdAddKeyboard(KdKeyboardInfo * ki);
+void KdRemoveKeyboard(KdKeyboardInfo * ki);
typedef struct _KdOsFuncs {
- int (*Init) (void);
- void (*Enable) (void);
- Bool (*SpecialKey) (KeySym);
- void (*Disable) (void);
- void (*Fini) (void);
- void (*pollEvents) (void);
- void (*Bell) (int, int, int);
+ int (*Init) (void);
+ void (*Enable) (void);
+ Bool (*SpecialKey) (KeySym);
+ void (*Disable) (void);
+ void (*Fini) (void);
+ void (*pollEvents) (void);
+ void (*Bell) (int, int, int);
} KdOsFuncs;
typedef enum _KdSyncPolarity {
@@ -305,28 +304,28 @@ typedef enum _KdSyncPolarity {
typedef struct _KdMonitorTiming {
/* label */
- int horizontal;
- int vertical;
- int rate;
+ int horizontal;
+ int vertical;
+ int rate;
/* pixel clock */
- int clock; /* in KHz */
+ int clock; /* in KHz */
/* horizontal timing */
- int hfp; /* front porch */
- int hbp; /* back porch */
- int hblank; /* blanking */
- KdSyncPolarity hpol; /* polarity */
+ int hfp; /* front porch */
+ int hbp; /* back porch */
+ int hblank; /* blanking */
+ KdSyncPolarity hpol; /* polarity */
/* vertical timing */
- int vfp; /* front porch */
- int vbp; /* back porch */
- int vblank; /* blanking */
- KdSyncPolarity vpol; /* polarity */
+ int vfp; /* front porch */
+ int vbp; /* back porch */
+ int vblank; /* blanking */
+ KdSyncPolarity vpol; /* polarity */
} KdMonitorTiming;
-extern const KdMonitorTiming kdMonitorTimings[];
-extern const int kdNumMonitorTimings;
+extern const KdMonitorTiming kdMonitorTimings[];
+extern const int kdNumMonitorTimings;
typedef struct _KdPointerMatrix {
- int matrix[2][3];
+ int matrix[2][3];
} KdPointerMatrix;
/*
@@ -342,18 +341,19 @@ typedef struct _KdPointerMatrix {
(PixmapWidthPaddingInfo[d].padRoundUp+1)))
#endif
-extern DevPrivateKeyRec kdScreenPrivateKeyRec;
+extern DevPrivateKeyRec kdScreenPrivateKeyRec;
+
#define kdScreenPrivateKey (&kdScreenPrivateKeyRec)
-extern unsigned long kdGeneration;
-extern Bool kdEnabled;
-extern Bool kdSwitchPending;
-extern Bool kdEmulateMiddleButton;
-extern Bool kdDisableZaphod;
-extern Bool kdAllowZap;
-extern int kdVirtualTerminal;
-extern char *kdSwitchCmd;
-extern KdOsFuncs *kdOsFuncs;
+extern unsigned long kdGeneration;
+extern Bool kdEnabled;
+extern Bool kdSwitchPending;
+extern Bool kdEmulateMiddleButton;
+extern Bool kdDisableZaphod;
+extern Bool kdAllowZap;
+extern int kdVirtualTerminal;
+extern char *kdSwitchCmd;
+extern KdOsFuncs *kdOsFuncs;
#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey))
@@ -363,158 +363,142 @@ extern KdOsFuncs *kdOsFuncs;
/* kcmap.c */
void
-KdSetColormap (ScreenPtr pScreen);
+ KdSetColormap(ScreenPtr pScreen);
void
-KdEnableColormap (ScreenPtr pScreen);
+ KdEnableColormap(ScreenPtr pScreen);
void
-KdDisableColormap (ScreenPtr pScreen);
+ KdDisableColormap(ScreenPtr pScreen);
void
-KdInstallColormap (ColormapPtr pCmap);
+ KdInstallColormap(ColormapPtr pCmap);
void
-KdUninstallColormap (ColormapPtr pCmap);
+ KdUninstallColormap(ColormapPtr pCmap);
int
-KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps);
+ KdListInstalledColormaps(ScreenPtr pScreen, Colormap * pCmaps);
void
-KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs);
+ KdStoreColors(ColormapPtr pCmap, int ndef, xColorItem * pdefs);
/* kdrive.c */
extern miPointerScreenFuncRec kdPointerScreenFuncs;
void
-KdDisableScreen (ScreenPtr pScreen);
+ KdDisableScreen(ScreenPtr pScreen);
void
-KdDisableScreens (void);
+ KdDisableScreens(void);
Bool
-KdEnableScreen (ScreenPtr pScreen);
+ KdEnableScreen(ScreenPtr pScreen);
void
-KdEnableScreens (void);
+ KdEnableScreens(void);
void
-KdSuspend (void);
+ KdSuspend(void);
void
-KdResume (void);
+ KdResume(void);
void
-KdProcessSwitch (void);
+ KdProcessSwitch(void);
-Rotation
-KdAddRotation (Rotation a, Rotation b);
+Rotation KdAddRotation(Rotation a, Rotation b);
-Rotation
-KdSubRotation (Rotation a, Rotation b);
+Rotation KdSubRotation(Rotation a, Rotation b);
void
-KdParseScreen (KdScreenInfo *screen,
- char *arg);
+ KdParseScreen(KdScreenInfo * screen, char *arg);
-KdPointerInfo *
-KdParsePointer (char *arg);
+KdPointerInfo *KdParsePointer(char *arg);
-KdKeyboardInfo *
-KdParseKeyboard (char *arg);
+KdKeyboardInfo *KdParseKeyboard(char *arg);
-char *
-KdParseFindNext (char *cur, const char *delim, char *save, char *last);
+char *KdParseFindNext(char *cur, const char *delim, char *save, char *last);
void
-KdParseRgba (char *rgba);
+ KdParseRgba(char *rgba);
void
-KdUseMsg (void);
+ KdUseMsg(void);
int
-KdProcessArgument (int argc, char **argv, int i);
+ KdProcessArgument(int argc, char **argv, int i);
void
-KdOsInit (KdOsFuncs *pOsFuncs);
+ KdOsInit(KdOsFuncs * pOsFuncs);
void
-KdOsAddInputDrivers (void);
+ KdOsAddInputDrivers(void);
Bool
-KdAllocatePrivates (ScreenPtr pScreen);
+ KdAllocatePrivates(ScreenPtr pScreen);
Bool
-KdCreateScreenResources (ScreenPtr pScreen);
+ KdCreateScreenResources(ScreenPtr pScreen);
Bool
-KdCloseScreen (int index, ScreenPtr pScreen);
+ KdCloseScreen(int index, ScreenPtr pScreen);
Bool
-KdSaveScreen (ScreenPtr pScreen, int on);
+ KdSaveScreen(ScreenPtr pScreen, int on);
Bool
-KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv);
+ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv);
void
-KdInitScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv);
+
+KdInitScreen(ScreenInfo * pScreenInfo,
+ KdScreenInfo * screen, int argc, char **argv);
void
-KdInitCard (ScreenInfo *pScreenInfo,
- KdCardInfo *card,
- int argc,
- char **argv);
+ KdInitCard(ScreenInfo * pScreenInfo, KdCardInfo * card, int argc, char **argv);
void
-KdInitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv);
+ KdInitOutput(ScreenInfo * pScreenInfo, int argc, char **argv);
void
-KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr);
+ KdSetSubpixelOrder(ScreenPtr pScreen, Rotation randr);
void
-KdBacktrace (int signum);
+ KdBacktrace(int signum);
/* kinfo.c */
-KdCardInfo *
-KdCardInfoAdd (KdCardFuncs *funcs,
- void *closure);
+KdCardInfo *KdCardInfoAdd(KdCardFuncs * funcs, void *closure);
-KdCardInfo *
-KdCardInfoLast (void);
+KdCardInfo *KdCardInfoLast(void);
void
-KdCardInfoDispose (KdCardInfo *ci);
+ KdCardInfoDispose(KdCardInfo * ci);
-KdScreenInfo *
-KdScreenInfoAdd (KdCardInfo *ci);
+KdScreenInfo *KdScreenInfoAdd(KdCardInfo * ci);
void
-KdScreenInfoDispose (KdScreenInfo *si);
-
+ KdScreenInfoDispose(KdScreenInfo * si);
/* kinput.c */
void
-KdInitInput(void);
+ KdInitInput(void);
void
-KdCloseInput(void);
+ KdCloseInput(void);
Bool
-KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure);
+ KdRegisterFd(int fd, void (*read) (int fd, void *closure), void *closure);
void
-KdUnregisterFds (void *closure, Bool do_close);
+ KdUnregisterFds(void *closure, Bool do_close);
void
-KdUnregisterFd (void *closure, int fd, Bool do_close);
+ KdUnregisterFd(void *closure, int fd, Bool do_close);
void
-KdEnqueueKeyboardEvent(KdKeyboardInfo *ki, unsigned char scan_code,
- unsigned char is_up);
+
+KdEnqueueKeyboardEvent(KdKeyboardInfo * ki, unsigned char scan_code,
+ unsigned char is_up);
#define KD_BUTTON_1 0x01
#define KD_BUTTON_2 0x02
@@ -525,97 +509,96 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki, unsigned char scan_code,
#define KD_MOUSE_DELTA 0x80000000
void
-KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
+
+KdEnqueuePointerEvent(KdPointerInfo * pi, unsigned long flags, int rx, int ry,
int rz);
void
-_KdEnqueuePointerEvent(KdPointerInfo *pi, int type, int x, int y, int z,
+
+_KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z,
int b, int absrel, Bool force);
void
-KdReleaseAllKeys (void);
+ KdReleaseAllKeys(void);
void
-KdSetLed (KdKeyboardInfo *ki, int led, Bool on);
+ KdSetLed(KdKeyboardInfo * ki, int led, Bool on);
void
-KdSetPointerMatrix (KdPointerMatrix *pointer);
+ KdSetPointerMatrix(KdPointerMatrix * pointer);
void
-KdComputePointerMatrix (KdPointerMatrix *pointer, Rotation randr, int width, int height);
+
+KdComputePointerMatrix(KdPointerMatrix * pointer, Rotation randr, int width,
+ int height);
void
-KdScreenToPointerCoords (int *x, int *y);
+ KdScreenToPointerCoords(int *x, int *y);
void
-KdBlockHandler (int screen,
- pointer blockData,
- pointer timeout,
- pointer readmask);
+
+KdBlockHandler(int screen,
+ pointer blockData, pointer timeout, pointer readmask);
void
-KdWakeupHandler (int screen,
- pointer data,
- unsigned long result,
- pointer readmask);
+
+KdWakeupHandler(int screen,
+ pointer data, unsigned long result, pointer readmask);
void
-KdDisableInput (void);
+ KdDisableInput(void);
void
-KdEnableInput (void);
+ KdEnableInput(void);
void
-ProcessInputEvents (void);
+ ProcessInputEvents(void);
void
-KdRingBell (KdKeyboardInfo *ki,
- int volume,
- int pitch,
- int duration);
+ KdRingBell(KdKeyboardInfo * ki, int volume, int pitch, int duration);
/* kmode.c */
-const KdMonitorTiming *
-KdFindMode (KdScreenInfo *screen,
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *));
+const KdMonitorTiming *KdFindMode(KdScreenInfo * screen,
+ Bool (*supported) (KdScreenInfo *,
+ const KdMonitorTiming *));
Bool
-KdTuneMode (KdScreenInfo *screen,
- Bool (*usable) (KdScreenInfo *),
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *));
+
+KdTuneMode(KdScreenInfo * screen,
+ Bool (*usable) (KdScreenInfo *),
+ Bool (*supported) (KdScreenInfo *, const KdMonitorTiming *));
#ifdef RANDR
Bool
-KdRandRGetInfo (ScreenPtr pScreen,
- int randr,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *));
-
-const KdMonitorTiming *
-KdRandRGetTiming (ScreenPtr pScreen,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *),
- int rate,
- RRScreenSizePtr pSize);
+
+KdRandRGetInfo(ScreenPtr pScreen,
+ int randr,
+ Bool (*supported) (ScreenPtr pScreen, const KdMonitorTiming *));
+
+const KdMonitorTiming *KdRandRGetTiming(ScreenPtr pScreen,
+ Bool (*supported) (ScreenPtr pScreen,
+ const KdMonitorTiming
+ *), int rate,
+ RRScreenSizePtr pSize);
#endif
/* kshadow.c */
Bool
-KdShadowFbAlloc (KdScreenInfo *screen, Bool rotate);
+ KdShadowFbAlloc(KdScreenInfo * screen, Bool rotate);
void
-KdShadowFbFree (KdScreenInfo *screen);
+ KdShadowFbFree(KdScreenInfo * screen);
Bool
-KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window);
+
+KdShadowSet(ScreenPtr pScreen, int randr, ShadowUpdateProc update,
+ ShadowWindowProc window);
void
-KdShadowUnset (ScreenPtr pScreen);
+ KdShadowUnset(ScreenPtr pScreen);
/* function prototypes to be implemented by the drivers */
void
-InitCard (char *name);
+ InitCard(char *name);
-#endif /* _KDRIVE_H_ */
+#endif /* _KDRIVE_H_ */
diff --git a/xorg-server/hw/kdrive/src/kinfo.c b/xorg-server/hw/kdrive/src/kinfo.c
index 0055b16db..01ae1e491 100644
--- a/xorg-server/hw/kdrive/src/kinfo.c
+++ b/xorg-server/hw/kdrive/src/kinfo.c
@@ -25,17 +25,16 @@
#endif
#include "kdrive.h"
-KdCardInfo *kdCardInfo;
+KdCardInfo *kdCardInfo;
KdCardInfo *
-KdCardInfoAdd (KdCardFuncs *funcs,
- void *closure)
+KdCardInfoAdd(KdCardFuncs * funcs, void *closure)
{
- KdCardInfo *ci, **prev;
+ KdCardInfo *ci, **prev;
- ci = calloc(1, sizeof (KdCardInfo));
+ ci = calloc(1, sizeof(KdCardInfo));
if (!ci)
- return 0;
+ return 0;
for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
*prev = ci;
ci->cfuncs = funcs;
@@ -47,39 +46,38 @@ KdCardInfoAdd (KdCardFuncs *funcs,
}
KdCardInfo *
-KdCardInfoLast (void)
+KdCardInfoLast(void)
{
- KdCardInfo *ci;
+ KdCardInfo *ci;
if (!kdCardInfo)
- return 0;
+ return 0;
for (ci = kdCardInfo; ci->next; ci = ci->next);
return ci;
}
void
-KdCardInfoDispose (KdCardInfo *ci)
+KdCardInfoDispose(KdCardInfo * ci)
{
- KdCardInfo **prev;
+ KdCardInfo **prev;
for (prev = &kdCardInfo; *prev; prev = &(*prev)->next)
- if (*prev == ci)
- {
- *prev = ci->next;
- free(ci);
- break;
- }
+ if (*prev == ci) {
+ *prev = ci->next;
+ free(ci);
+ break;
+ }
}
KdScreenInfo *
-KdScreenInfoAdd (KdCardInfo *ci)
+KdScreenInfoAdd(KdCardInfo * ci)
{
- KdScreenInfo *si, **prev;
- int n;
+ KdScreenInfo *si, **prev;
+ int n;
- si = calloc(1, sizeof (KdScreenInfo));
+ si = calloc(1, sizeof(KdScreenInfo));
if (!si)
- return 0;
+ return 0;
for (prev = &ci->screenList, n = 0; *prev; prev = &(*prev)->next, n++);
*prev = si;
si->next = 0;
@@ -89,30 +87,29 @@ KdScreenInfoAdd (KdCardInfo *ci)
}
void
-KdScreenInfoDispose (KdScreenInfo *si)
+KdScreenInfoDispose(KdScreenInfo * si)
{
- KdCardInfo *ci = si->card;
- KdScreenInfo **prev;
+ KdCardInfo *ci = si->card;
+ KdScreenInfo **prev;
for (prev = &ci->screenList; *prev; prev = &(*prev)->next) {
- if (*prev == si)
- {
- *prev = si->next;
- free(si);
- if (!ci->screenList)
- KdCardInfoDispose (ci);
- break;
- }
+ if (*prev == si) {
+ *prev = si->next;
+ free(si);
+ if (!ci->screenList)
+ KdCardInfoDispose(ci);
+ break;
+ }
}
}
KdPointerInfo *
-KdNewPointer (void)
+KdNewPointer(void)
{
KdPointerInfo *pi;
int i;
- pi = (KdPointerInfo *)calloc(1, sizeof(KdPointerInfo));
+ pi = (KdPointerInfo *) calloc(1, sizeof(KdPointerInfo));
if (!pi)
return NULL;
@@ -132,7 +129,7 @@ KdNewPointer (void)
}
void
-KdFreePointer(KdPointerInfo *pi)
+KdFreePointer(KdPointerInfo * pi)
{
free(pi->name);
free(pi->path);
@@ -141,7 +138,7 @@ KdFreePointer(KdPointerInfo *pi)
}
void
-KdFreeKeyboard(KdKeyboardInfo *ki)
+KdFreeKeyboard(KdKeyboardInfo * ki)
{
free(ki->name);
free(ki->path);
diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c
index ae0c0a455..0cb890ed2 100644
--- a/xorg-server/hw/kdrive/src/kinput.c
+++ b/xorg-server/hw/kdrive/src/kinput.c
@@ -35,14 +35,14 @@
#include <signal.h>
#include <stdio.h>
#ifdef sun
-#include <sys/file.h> /* needed for FNONBLOCK & FASYNC */
+#include <sys/file.h> /* needed for FNONBLOCK & FASYNC */
#endif
#include "xkbsrv.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-#include "XIstubs.h" /* even though we don't use stubs. cute, no? */
+#include "XIstubs.h" /* even though we don't use stubs. cute, no? */
#include "exevents.h"
#include "extinit.h"
#include "exglobals.h"
@@ -59,87 +59,88 @@ struct KdConfigDevice {
};
/* kdKeyboards and kdPointers hold all the real devices. */
-static KdKeyboardInfo *kdKeyboards = NULL;
-static KdPointerInfo *kdPointers = NULL;
-static struct KdConfigDevice *kdConfigKeyboards = NULL;
-static struct KdConfigDevice *kdConfigPointers = NULL;
+static KdKeyboardInfo *kdKeyboards = NULL;
+static KdPointerInfo *kdPointers = NULL;
+static struct KdConfigDevice *kdConfigKeyboards = NULL;
+static struct KdConfigDevice *kdConfigPointers = NULL;
static KdKeyboardDriver *kdKeyboardDrivers = NULL;
-static KdPointerDriver *kdPointerDrivers = NULL;
-
-static Bool kdInputEnabled;
-static Bool kdOffScreen;
-static unsigned long kdOffScreenTime;
-static KdPointerMatrix kdPointerMatrix = {
- { { 1, 0, 0 },
- { 0, 1, 0 } }
+static KdPointerDriver *kdPointerDrivers = NULL;
+
+static Bool kdInputEnabled;
+static Bool kdOffScreen;
+static unsigned long kdOffScreenTime;
+
+static KdPointerMatrix kdPointerMatrix = {
+ {{1, 0, 0},
+ {0, 1, 0}}
};
-void KdResetInputMachine (void);
+void KdResetInputMachine(void);
#define KD_MAX_INPUT_FDS 8
typedef struct _kdInputFd {
- int fd;
- void (*read) (int fd, void *closure);
- int (*enable) (int fd, void *closure);
- void (*disable) (int fd, void *closure);
- void *closure;
+ int fd;
+ void (*read) (int fd, void *closure);
+ int (*enable) (int fd, void *closure);
+ void (*disable) (int fd, void *closure);
+ void *closure;
} KdInputFd;
static KdInputFd kdInputFds[KD_MAX_INPUT_FDS];
-static int kdNumInputFds;
+static int kdNumInputFds;
-extern Bool kdRawPointerCoordinates;
+extern Bool kdRawPointerCoordinates;
static void
-KdSigio (int sig)
+KdSigio(int sig)
{
- int i;
+ int i;
for (i = 0; i < kdNumInputFds; i++)
- (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
+ (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
}
static void
-KdBlockSigio (void)
+KdBlockSigio(void)
{
#ifdef _MSC_VER
__asm int 3;
#else
- sigset_t set;
+ sigset_t set;
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_BLOCK, &set, 0);
+ sigemptyset(&set);
+ sigaddset(&set, SIGIO);
+ sigprocmask(SIG_BLOCK, &set, 0);
#endif
}
static void
-KdUnblockSigio (void)
+KdUnblockSigio(void)
{
#ifdef _MSC_VER
__asm int 3;
#else
- sigset_t set;
+ sigset_t set;
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_UNBLOCK, &set, 0);
+ sigemptyset(&set);
+ sigaddset(&set, SIGIO);
+ sigprocmask(SIG_UNBLOCK, &set, 0);
#endif
}
#ifdef DEBUG_SIGIO
void
-KdAssertSigioBlocked (char *where)
+KdAssertSigioBlocked(char *where)
{
- sigset_t set, old;
+ sigset_t set, old;
- sigemptyset (&set);
- sigprocmask (SIG_BLOCK, &set, &old);
- if (!sigismember (&old, SIGIO)) {
- ErrorF ("SIGIO not blocked at %s\n", where);
+ sigemptyset(&set);
+ sigprocmask(SIG_BLOCK, &set, &old);
+ if (!sigismember(&old, SIGIO)) {
+ ErrorF("SIGIO not blocked at %s\n", where);
KdBacktrace(0);
}
}
@@ -150,7 +151,7 @@ KdAssertSigioBlocked (char *where)
#endif
-static int kdnFds;
+static int kdnFds;
#ifdef FNONBLOCK
#define NOBLOCK FNONBLOCK
@@ -159,7 +160,7 @@ static int kdnFds;
#endif
void
-KdResetInputMachine (void)
+KdResetInputMachine(void)
{
KdPointerInfo *pi;
@@ -170,72 +171,72 @@ KdResetInputMachine (void)
}
static void
-KdNonBlockFd (int fd)
+KdNonBlockFd(int fd)
{
#ifdef _MSC_VER
__asm int 3;
#else
- int flags;
- flags = fcntl (fd, F_GETFL);
- flags |= FASYNC|NOBLOCK;
- fcntl (fd, F_SETFL, flags);
+ int flags;
+
+ flags = fcntl(fd, F_GETFL);
+ flags |= FASYNC | NOBLOCK;
+ fcntl(fd, F_SETFL, flags);
#endif
}
static void
-KdAddFd (int fd)
+KdAddFd(int fd)
{
#ifdef _MSC_VER
__asm int 3;
#else
- struct sigaction act;
- sigset_t set;
+ struct sigaction act;
+ sigset_t set;
kdnFds++;
- fcntl (fd, F_SETOWN, getpid());
- KdNonBlockFd (fd);
- AddEnabledDevice (fd);
- memset (&act, '\0', sizeof act);
+ fcntl(fd, F_SETOWN, getpid());
+ KdNonBlockFd(fd);
+ AddEnabledDevice(fd);
+ memset(&act, '\0', sizeof act);
act.sa_handler = KdSigio;
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGIO);
- sigaddset (&act.sa_mask, SIGALRM);
- sigaddset (&act.sa_mask, SIGVTALRM);
- sigaction (SIGIO, &act, 0);
- sigemptyset (&set);
- sigprocmask (SIG_SETMASK, &set, 0);
+ sigemptyset(&act.sa_mask);
+ sigaddset(&act.sa_mask, SIGIO);
+ sigaddset(&act.sa_mask, SIGALRM);
+ sigaddset(&act.sa_mask, SIGVTALRM);
+ sigaction(SIGIO, &act, 0);
+ sigemptyset(&set);
+ sigprocmask(SIG_SETMASK, &set, 0);
#endif
}
static void
-KdRemoveFd (int fd)
+KdRemoveFd(int fd)
{
#ifdef _MSC_VER
__asm int 3;
#else
- struct sigaction act;
- int flags;
+ struct sigaction act;
+ int flags;
kdnFds--;
- RemoveEnabledDevice (fd);
- flags = fcntl (fd, F_GETFL);
- flags &= ~(FASYNC|NOBLOCK);
- fcntl (fd, F_SETFL, flags);
- if (kdnFds == 0)
- {
- memset (&act, '\0', sizeof act);
- act.sa_handler = SIG_IGN;
- sigemptyset (&act.sa_mask);
- sigaction (SIGIO, &act, 0);
+ RemoveEnabledDevice(fd);
+ flags = fcntl(fd, F_GETFL);
+ flags &= ~(FASYNC | NOBLOCK);
+ fcntl(fd, F_SETFL, flags);
+ if (kdnFds == 0) {
+ memset(&act, '\0', sizeof act);
+ act.sa_handler = SIG_IGN;
+ sigemptyset(&act.sa_mask);
+ sigaction(SIGIO, &act, 0);
}
#endif
}
Bool
-KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure)
+KdRegisterFd(int fd, void (*read) (int fd, void *closure), void *closure)
{
if (kdNumInputFds == KD_MAX_INPUT_FDS)
- return FALSE;
+ return FALSE;
kdInputFds[kdNumInputFds].fd = fd;
kdInputFds[kdNumInputFds].read = read;
kdInputFds[kdNumInputFds].enable = 0;
@@ -243,38 +244,38 @@ KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure)
kdInputFds[kdNumInputFds].closure = closure;
kdNumInputFds++;
if (kdInputEnabled)
- KdAddFd (fd);
+ KdAddFd(fd);
return TRUE;
}
void
-KdUnregisterFd (void *closure, int fd, Bool do_close)
+KdUnregisterFd(void *closure, int fd, Bool do_close)
{
- int i, j;
+ int i, j;
for (i = 0; i < kdNumInputFds; i++) {
- if (kdInputFds[i].closure == closure &&
+ if (kdInputFds[i].closure == closure &&
(fd == -1 || kdInputFds[i].fd == fd)) {
- if (kdInputEnabled)
- KdRemoveFd (kdInputFds[i].fd);
- if (do_close)
- close (kdInputFds[i].fd);
- kdNumInputFds--;
- for (j = i; j < kdNumInputFds; j++)
- kdInputFds[j] = kdInputFds[j+1];
+ if (kdInputEnabled)
+ KdRemoveFd(kdInputFds[i].fd);
+ if (do_close)
+ close(kdInputFds[i].fd);
+ kdNumInputFds--;
+ for (j = i; j < kdNumInputFds; j++)
+ kdInputFds[j] = kdInputFds[j + 1];
break;
- }
+ }
}
}
void
-KdUnregisterFds (void *closure, Bool do_close)
+KdUnregisterFds(void *closure, Bool do_close)
{
KdUnregisterFd(closure, -1, do_close);
}
void
-KdDisableInput (void)
+KdDisableInput(void)
{
KdKeyboardInfo *ki;
KdPointerInfo *pi;
@@ -303,7 +304,7 @@ KdDisableInput (void)
ErrorF(" fd %d belongs to keybd driver %s\n",
kdInputFds[i].fd,
ki->driver && ki->driver->name ?
- ki->driver->name : "(unnamed!)");
+ ki->driver->name : "(unnamed!)");
found = 1;
break;
}
@@ -319,7 +320,7 @@ KdDisableInput (void)
ErrorF(" fd %d belongs to pointer driver %s\n",
kdInputFds[i].fd,
pi->driver && pi->driver->name ?
- pi->driver->name : "(unnamed!)");
+ pi->driver->name : "(unnamed!)");
break;
}
}
@@ -339,7 +340,7 @@ KdDisableInput (void)
}
void
-KdEnableInput (void)
+KdEnableInput(void)
{
InternalEvent ev;
KdKeyboardInfo *ki;
@@ -358,14 +359,15 @@ KdEnableInput (void)
}
/* reset screen saver */
- ev.any.time = GetTimeInMillis ();
- NoticeEventTime (&ev);
+ ev.any.time = GetTimeInMillis();
+ NoticeEventTime(&ev, pi->dixdev);
+ NoticeEventTime(&ev, ki->dixdev);
- KdUnblockSigio ();
+ KdUnblockSigio();
}
static KdKeyboardDriver *
-KdFindKeyboardDriver (const char *name)
+KdFindKeyboardDriver(const char *name)
{
KdKeyboardDriver *ret;
@@ -382,7 +384,7 @@ KdFindKeyboardDriver (const char *name)
}
static KdPointerDriver *
-KdFindPointerDriver (const char *name)
+KdFindPointerDriver(const char *name)
{
KdPointerDriver *ret;
@@ -401,14 +403,14 @@ KdFindPointerDriver (const char *name)
static int
KdPointerProc(DeviceIntPtr pDevice, int onoff)
{
- DevicePtr pDev = (DevicePtr)pDevice;
- KdPointerInfo *pi;
- Atom xiclass;
- Atom *btn_labels;
- Atom *axes_labels;
+ DevicePtr pDev = (DevicePtr) pDevice;
+ KdPointerInfo *pi;
+ Atom xiclass;
+ Atom *btn_labels;
+ Atom *axes_labels;
if (!pDev)
- return BadImplementation;
+ return BadImplementation;
for (pi = kdPointers; pi; pi = pi->next) {
if (pi->dixdev && pi->dixdev->id == pDevice->id)
@@ -421,8 +423,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
return BadImplementation;
}
- switch (onoff)
- {
+ switch (onoff) {
case DEVICE_INIT:
#ifdef DEBUG
ErrorF("initialising pointer %s ...\n", pi->name);
@@ -453,44 +454,43 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
return !Success;
}
- btn_labels = calloc(pi->nButtons, sizeof(Atom));
- if (!btn_labels)
- return BadAlloc;
- axes_labels = calloc(pi->nAxes, sizeof(Atom));
- if (!axes_labels) {
- free(btn_labels);
- return BadAlloc;
- }
-
- switch(pi->nAxes)
- {
- default:
- case 7:
- btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
- case 6:
- btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
- case 5:
- btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
- case 4:
- btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
- case 3:
- btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
- case 2:
- btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
- case 1:
- btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
- case 0:
- break;
- }
-
- if (pi->nAxes >= 2) {
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
- }
-
- InitPointerDeviceStruct(pDev, pi->map, pi->nButtons, btn_labels,
- (PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), pi->nAxes, axes_labels);
+ btn_labels = calloc(pi->nButtons, sizeof(Atom));
+ if (!btn_labels)
+ return BadAlloc;
+ axes_labels = calloc(pi->nAxes, sizeof(Atom));
+ if (!axes_labels) {
+ free(btn_labels);
+ return BadAlloc;
+ }
+
+ switch (pi->nAxes) {
+ default:
+ case 7:
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ case 6:
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ case 5:
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ case 4:
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ case 3:
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ case 2:
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ case 1:
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ case 0:
+ break;
+ }
+
+ if (pi->nAxes >= 2) {
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ }
+
+ InitPointerDeviceStruct(pDev, pi->map, pi->nButtons, btn_labels,
+ (PtrCtrlProcPtr) NoopDDA,
+ GetMotionHistorySize(), pi->nAxes, axes_labels);
free(btn_labels);
free(axes_labels);
@@ -505,7 +505,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
AssignTypeAndName(pi->dixdev, xiclass,
pi->name ? pi->name : "Generic KDrive Pointer");
- return Success;
+ return Success;
case DEVICE_ON:
if (pDev->on == TRUE)
@@ -524,7 +524,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
return BadImplementation;
}
- return Success;
+ return Success;
case DEVICE_OFF:
if (pDev->on == FALSE) {
@@ -543,7 +543,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
return Success;
case DEVICE_CLOSE:
- if (pDev->on) {
+ if (pDev->on) {
if (!pi->driver->Disable) {
return BadImplementation;
}
@@ -574,7 +574,7 @@ LegalModifier(unsigned int key, DeviceIntPtr pDev)
#endif
static void
-KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something)
+KdBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
{
KeybdCtrl *ctrl = arg;
KdKeyboardInfo *ki = NULL;
@@ -597,7 +597,7 @@ DDXRingBell(int volume, int pitch, int duration)
KdKeyboardInfo *ki = NULL;
if (kdOsFuncs->Bell) {
- (*kdOsFuncs->Bell)(volume, pitch, duration);
+ (*kdOsFuncs->Bell) (volume, pitch, duration);
}
else {
for (ki = kdKeyboards; ki; ki = ki->next) {
@@ -608,7 +608,7 @@ DDXRingBell(int volume, int pitch, int duration)
}
#endif
void
-KdRingBell(KdKeyboardInfo *ki, int volume, int pitch, int duration)
+KdRingBell(KdKeyboardInfo * ki, int volume, int pitch, int duration)
{
if (!ki || !ki->driver || !ki->driver->Bell)
return;
@@ -617,9 +617,8 @@ KdRingBell(KdKeyboardInfo *ki, int volume, int pitch, int duration)
(*ki->driver->Bell) (ki, volume, pitch, duration);
}
-
static void
-KdSetLeds (KdKeyboardInfo *ki, int leds)
+KdSetLeds(KdKeyboardInfo * ki, int leds)
{
if (!ki || !ki->driver)
return;
@@ -631,75 +630,85 @@ KdSetLeds (KdKeyboardInfo *ki, int leds)
}
void
-KdSetLed (KdKeyboardInfo *ki, int led, Bool on)
+KdSetLed(KdKeyboardInfo * ki, int led, Bool on)
{
if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed)
return;
- NoteLedState (ki->dixdev, led, on);
- KdSetLeds (ki, ki->dixdev->kbdfeed->ctrl.leds);
+ NoteLedState(ki->dixdev, led, on);
+ KdSetLeds(ki, ki->dixdev->kbdfeed->ctrl.leds);
}
void
-KdSetPointerMatrix (KdPointerMatrix *matrix)
+KdSetPointerMatrix(KdPointerMatrix * matrix)
{
kdPointerMatrix = *matrix;
}
void
-KdComputePointerMatrix (KdPointerMatrix *m, Rotation randr, int width,
- int height)
+KdComputePointerMatrix(KdPointerMatrix * m, Rotation randr, int width,
+ int height)
{
- int x_dir = 1, y_dir = 1;
- int i, j;
- int size[2];
+ int x_dir = 1, y_dir = 1;
+ int i, j;
+ int size[2];
- size[0] = width; size[1] = height;
+ size[0] = width;
+ size[1] = height;
if (randr & RR_Reflect_X)
- x_dir = -1;
+ x_dir = -1;
if (randr & RR_Reflect_Y)
- y_dir = -1;
+ y_dir = -1;
switch (randr & (RR_Rotate_All)) {
case RR_Rotate_0:
- m->matrix[0][0] = x_dir; m->matrix[0][1] = 0;
- m->matrix[1][0] = 0; m->matrix[1][1] = y_dir;
- break;
+ m->matrix[0][0] = x_dir;
+ m->matrix[0][1] = 0;
+ m->matrix[1][0] = 0;
+ m->matrix[1][1] = y_dir;
+ break;
case RR_Rotate_90:
- m->matrix[0][0] = 0; m->matrix[0][1] = -x_dir;
- m->matrix[1][0] = y_dir; m->matrix[1][1] = 0;
- break;
+ m->matrix[0][0] = 0;
+ m->matrix[0][1] = -x_dir;
+ m->matrix[1][0] = y_dir;
+ m->matrix[1][1] = 0;
+ break;
case RR_Rotate_180:
- m->matrix[0][0] = -x_dir; m->matrix[0][1] = 0;
- m->matrix[1][0] = 0; m->matrix[1][1] = -y_dir;
- break;
+ m->matrix[0][0] = -x_dir;
+ m->matrix[0][1] = 0;
+ m->matrix[1][0] = 0;
+ m->matrix[1][1] = -y_dir;
+ break;
case RR_Rotate_270:
- m->matrix[0][0] = 0; m->matrix[0][1] = x_dir;
- m->matrix[1][0] = -y_dir; m->matrix[1][1] = 0;
- break;
+ m->matrix[0][0] = 0;
+ m->matrix[0][1] = x_dir;
+ m->matrix[1][0] = -y_dir;
+ m->matrix[1][1] = 0;
+ break;
}
- for (i = 0; i < 2; i++)
- {
- m->matrix[i][2] = 0;
- for (j = 0 ; j < 2; j++)
- if (m->matrix[i][j] < 0)
- m->matrix[i][2] = size[j] - 1;
+ for (i = 0; i < 2; i++) {
+ m->matrix[i][2] = 0;
+ for (j = 0; j < 2; j++)
+ if (m->matrix[i][j] < 0)
+ m->matrix[i][2] = size[j] - 1;
}
}
void
-KdScreenToPointerCoords (int *x, int *y)
+KdScreenToPointerCoords(int *x, int *y)
{
- int (*m)[3] = kdPointerMatrix.matrix;
+ int (*m)[3] = kdPointerMatrix.matrix;
int div = m[0][1] * m[1][0] - m[1][1] * m[0][0];
int sx = *x;
int sy = *y;
- *x = (m[0][1] * sy - m[0][1] * m[1][2] + m[1][1] * m[0][2] - m[1][1] * sx) / div;
- *y = (m[1][0] * sx + m[0][0] * m[1][2] - m[1][0] * m[0][2] - m[0][0] * sy) / div;
+ *x = (m[0][1] * sy - m[0][1] * m[1][2] + m[1][1] * m[0][2] -
+ m[1][1] * sx) / div;
+ *y = (m[1][0] * sx + m[0][0] * m[1][2] - m[1][0] * m[0][2] -
+ m[0][0] * sy) / div;
}
static void
-KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+KdKbdCtrl(DeviceIntPtr pDevice, KeybdCtrl * ctrl)
{
KdKeyboardInfo *ki;
@@ -721,14 +730,14 @@ extern KeybdCtrl defaultKeyboardControl;
static int
KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
{
- Bool ret;
- DevicePtr pDev = (DevicePtr)pDevice;
+ Bool ret;
+ DevicePtr pDev = (DevicePtr) pDevice;
KdKeyboardInfo *ki;
Atom xiclass;
XkbRMLVOSet rmlvo;
if (!pDev)
- return BadImplementation;
+ return BadImplementation;
for (ki = kdKeyboards; ki; ki = ki->next) {
if (ki->dixdev && ki->dixdev->id == pDevice->id)
@@ -739,8 +748,7 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
return BadImplementation;
}
- switch (onoff)
- {
+ switch (onoff) {
case DEVICE_INIT:
#ifdef DEBUG
ErrorF("initialising keyboard %s\n", ki->name);
@@ -777,10 +785,10 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
rmlvo.layout = ki->xkbLayout;
rmlvo.variant = ki->xkbVariant;
rmlvo.options = ki->xkbOptions;
- ret = InitKeyboardDeviceStruct (pDevice, &rmlvo, KdBell, KdKbdCtrl);
- if (!ret) {
+ ret = InitKeyboardDeviceStruct(pDevice, &rmlvo, KdBell, KdKbdCtrl);
+ if (!ret) {
ErrorF("Couldn't initialise keyboard %s\n", ki->name);
- return BadImplementation;
+ return BadImplementation;
}
xiclass = AtomFromName(XI_KEYBOARD);
@@ -820,13 +828,13 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
break;
case DEVICE_CLOSE:
- if (pDev->on) {
+ if (pDev->on) {
if (!ki->driver->Disable)
return BadImplementation;
(*ki->driver->Disable) (ki);
pDev->on = FALSE;
- }
+ }
if (!ki->driver->Fini)
return BadImplementation;
@@ -843,7 +851,7 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
}
void
-KdAddPointerDriver (KdPointerDriver *driver)
+KdAddPointerDriver(KdPointerDriver * driver)
{
KdPointerDriver **prev;
@@ -858,7 +866,7 @@ KdAddPointerDriver (KdPointerDriver *driver)
}
void
-KdRemovePointerDriver (KdPointerDriver *driver)
+KdRemovePointerDriver(KdPointerDriver * driver)
{
KdPointerDriver *tmp;
@@ -875,7 +883,7 @@ KdRemovePointerDriver (KdPointerDriver *driver)
}
void
-KdAddKeyboardDriver (KdKeyboardDriver *driver)
+KdAddKeyboardDriver(KdKeyboardDriver * driver)
{
KdKeyboardDriver **prev;
@@ -890,7 +898,7 @@ KdAddKeyboardDriver (KdKeyboardDriver *driver)
}
void
-KdRemoveKeyboardDriver (KdKeyboardDriver *driver)
+KdRemoveKeyboardDriver(KdKeyboardDriver * driver)
{
KdKeyboardDriver *tmp;
@@ -907,9 +915,10 @@ KdRemoveKeyboardDriver (KdKeyboardDriver *driver)
}
KdKeyboardInfo *
-KdNewKeyboard (void)
+KdNewKeyboard(void)
{
KdKeyboardInfo *ki = calloc(sizeof(KdKeyboardInfo), 1);
+
if (!ki)
return NULL;
@@ -930,7 +939,7 @@ KdNewKeyboard (void)
}
int
-KdAddConfigKeyboard (char *keyboard)
+KdAddConfigKeyboard(char *keyboard)
{
struct KdConfigDevice **prev, *new;
@@ -951,7 +960,7 @@ KdAddConfigKeyboard (char *keyboard)
}
int
-KdAddKeyboard (KdKeyboardInfo *ki)
+KdAddKeyboard(KdKeyboardInfo * ki)
{
KdKeyboardInfo **prev;
@@ -976,7 +985,7 @@ KdAddKeyboard (KdKeyboardInfo *ki)
}
void
-KdRemoveKeyboard (KdKeyboardInfo *ki)
+KdRemoveKeyboard(KdKeyboardInfo * ki)
{
KdKeyboardInfo **prev;
@@ -994,7 +1003,7 @@ KdRemoveKeyboard (KdKeyboardInfo *ki)
}
int
-KdAddConfigPointer (char *pointer)
+KdAddConfigPointer(char *pointer)
{
struct KdConfigDevice **prev, *new;
@@ -1015,7 +1024,7 @@ KdAddConfigPointer (char *pointer)
}
int
-KdAddPointer (KdPointerInfo *pi)
+KdAddPointer(KdPointerInfo * pi)
{
KdPointerInfo **prev;
@@ -1039,7 +1048,7 @@ KdAddPointer (KdPointerInfo *pi)
}
void
-KdRemovePointer (KdPointerInfo *pi)
+KdRemovePointer(KdPointerInfo * pi)
{
KdPointerInfo **prev;
@@ -1062,15 +1071,13 @@ KdRemovePointer (KdPointerInfo *pi)
* evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br
*/
static Bool
-KdGetOptions (InputOption **options, char *string)
+KdGetOptions(InputOption **options, char *string)
{
- InputOption *newopt = NULL;
- char *key = NULL,
- *value = NULL;
- int tam_key = 0;
+ InputOption *newopt = NULL;
+ char *key = NULL, *value = NULL;
+ int tam_key = 0;
- if (strchr(string, '='))
- {
+ if (strchr(string, '=')) {
tam_key = (strchr(string, '=') - string);
key = strndup(string, tam_key);
if (!key)
@@ -1080,8 +1087,7 @@ KdGetOptions (InputOption **options, char *string)
if (!value)
goto out;
}
- else
- {
+ else {
key = strdup(string);
value = NULL;
}
@@ -1090,7 +1096,7 @@ KdGetOptions (InputOption **options, char *string)
if (newopt)
*options = newopt;
-out:
+ out:
free(key);
free(value);
@@ -1098,12 +1104,11 @@ out:
}
static void
-KdParseKbdOptions (KdKeyboardInfo *ki)
+KdParseKbdOptions(KdKeyboardInfo * ki)
{
InputOption *option = NULL;
- nt_list_for_each_entry(option, ki->options, list.next)
- {
+ nt_list_for_each_entry(option, ki->options, list.next) {
const char *key = input_option_get_key(option);
const char *value = input_option_get_value(option);
@@ -1117,21 +1122,21 @@ KdParseKbdOptions (KdKeyboardInfo *ki)
ki->xkbVariant = strdup(value);
else if (strcasecmp(key, "XkbOptions") == 0)
ki->xkbOptions = strdup(value);
- else if (!strcasecmp (key, "device"))
+ else if (!strcasecmp(key, "device"))
ki->path = strdup(value);
else
- ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
- key, value);
+ ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
+ key, value);
}
}
KdKeyboardInfo *
-KdParseKeyboard (char *arg)
+KdParseKeyboard(char *arg)
{
- char save[1024];
- char delim;
- InputOption *options = NULL;
- KdKeyboardInfo *ki = NULL;
+ char save[1024];
+ char delim;
+ InputOption *options = NULL;
+ KdKeyboardInfo *ki = NULL;
ki = KdNewKeyboard();
if (!ki)
@@ -1143,53 +1148,46 @@ KdParseKeyboard (char *arg)
ki->driverPrivate = NULL;
ki->next = NULL;
- if (!arg)
- {
+ if (!arg) {
ErrorF("keybd: no arg\n");
- KdFreeKeyboard (ki);
+ KdFreeKeyboard(ki);
return NULL;
}
- if (strlen (arg) >= sizeof (save))
- {
+ if (strlen(arg) >= sizeof(save)) {
ErrorF("keybd: arg too long\n");
- KdFreeKeyboard (ki);
+ KdFreeKeyboard(ki);
return NULL;
}
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (!save[0])
- {
+ arg = KdParseFindNext(arg, ",", save, &delim);
+ if (!save[0]) {
ErrorF("keybd: failed on save[0]\n");
- KdFreeKeyboard (ki);
+ KdFreeKeyboard(ki);
return NULL;
}
- if (strcmp (save, "auto") == 0)
+ if (strcmp(save, "auto") == 0)
ki->driverPrivate = NULL;
else
ki->driverPrivate = strdup(save);
- if (delim != ',')
- {
+ if (delim != ',') {
return ki;
}
- arg = KdParseFindNext (arg, ",", save, &delim);
+ arg = KdParseFindNext(arg, ",", save, &delim);
- while (delim == ',')
- {
- arg = KdParseFindNext (arg, ",", save, &delim);
+ while (delim == ',') {
+ arg = KdParseFindNext(arg, ",", save, &delim);
- if (!KdGetOptions(&options, save))
- {
- KdFreeKeyboard(ki);
- return NULL;
+ if (!KdGetOptions(&options, save)) {
+ KdFreeKeyboard(ki);
+ return NULL;
}
}
- if (options)
- {
+ if (options) {
ki->options = options;
KdParseKbdOptions(ki);
}
@@ -1198,41 +1196,40 @@ KdParseKeyboard (char *arg)
}
static void
-KdParsePointerOptions (KdPointerInfo *pi)
+KdParsePointerOptions(KdPointerInfo * pi)
{
InputOption *option = NULL;
- nt_list_for_each_entry(option, pi->options, list.next)
- {
+ nt_list_for_each_entry(option, pi->options, list.next) {
const char *key = input_option_get_key(option);
const char *value = input_option_get_value(option);
- if (!strcmp (key, "emulatemiddle"))
+ if (!strcmp(key, "emulatemiddle"))
pi->emulateMiddleButton = TRUE;
- else if (!strcmp (key, "noemulatemiddle"))
+ else if (!strcmp(key, "noemulatemiddle"))
pi->emulateMiddleButton = FALSE;
- else if (!strcmp (key, "transformcoord"))
+ else if (!strcmp(key, "transformcoord"))
pi->transformCoordinates = TRUE;
- else if (!strcmp (key, "rawcoord"))
+ else if (!strcmp(key, "rawcoord"))
pi->transformCoordinates = FALSE;
- else if (!strcasecmp (key, "device"))
+ else if (!strcasecmp(key, "device"))
pi->path = strdup(value);
- else if (!strcasecmp (key, "protocol"))
+ else if (!strcasecmp(key, "protocol"))
pi->protocol = strdup(value);
else
ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
- key, value);
+ key, value);
}
}
KdPointerInfo *
-KdParsePointer (char *arg)
+KdParsePointer(char *arg)
{
- char save[1024];
- char delim;
- KdPointerInfo *pi = NULL;
- InputOption *options = NULL;
- int i = 0;
+ char save[1024];
+ char delim;
+ KdPointerInfo *pi = NULL;
+ InputOption *options = NULL;
+ int i = 0;
pi = KdNewPointer();
if (!pi)
@@ -1240,27 +1237,24 @@ KdParsePointer (char *arg)
pi->emulateMiddleButton = kdEmulateMiddleButton;
pi->transformCoordinates = !kdRawPointerCoordinates;
pi->protocol = NULL;
- pi->nButtons = 5; /* XXX should not be hardcoded */
+ pi->nButtons = 5; /* XXX should not be hardcoded */
pi->inputClass = KD_MOUSE;
- if (!arg)
- {
+ if (!arg) {
ErrorF("mouse: no arg\n");
- KdFreePointer (pi);
+ KdFreePointer(pi);
return NULL;
}
- if (strlen (arg) >= sizeof (save))
- {
+ if (strlen(arg) >= sizeof(save)) {
ErrorF("mouse: arg too long\n");
- KdFreePointer (pi);
+ KdFreePointer(pi);
return NULL;
}
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (!save[0])
- {
+ arg = KdParseFindNext(arg, ",", save, &delim);
+ if (!save[0]) {
ErrorF("failed on save[0]\n");
- KdFreePointer (pi);
+ KdFreePointer(pi);
return NULL;
}
@@ -1269,41 +1263,35 @@ KdParsePointer (char *arg)
else
pi->driverPrivate = strdup(save);
- if (delim != ',')
- {
+ if (delim != ',') {
return pi;
}
- arg = KdParseFindNext (arg, ",", save, &delim);
+ arg = KdParseFindNext(arg, ",", save, &delim);
- while (delim == ',')
- {
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (save[0] == '{')
- {
+ while (delim == ',') {
+ arg = KdParseFindNext(arg, ",", save, &delim);
+ if (save[0] == '{') {
char *s = save + 1;
- i = 0;
- while (*s && *s != '}')
- {
+
+ i = 0;
+ while (*s && *s != '}') {
if ('1' <= *s && *s <= '0' + pi->nButtons)
pi->map[i] = *s - '0';
else
- UseMsg ();
+ UseMsg();
s++;
- }
+ }
}
- else
- {
- if (!KdGetOptions(&options, save))
- {
+ else {
+ if (!KdGetOptions(&options, save)) {
KdFreePointer(pi);
return NULL;
}
}
}
- if (options)
- {
+ if (options) {
pi->options = options;
KdParsePointerOptions(pi);
}
@@ -1311,9 +1299,8 @@ KdParsePointer (char *arg)
return pi;
}
-
void
-KdInitInput (void)
+KdInitInput(void)
{
KdPointerInfo *pi;
KdKeyboardInfo *ki;
@@ -1340,7 +1327,7 @@ KdInitInput (void)
}
void
-KdCloseInput (void)
+KdCloseInput(void)
{
mieqFini();
}
@@ -1503,195 +1490,203 @@ typedef enum _inputAction {
#define MAX_ACTIONS 2
typedef struct _inputTransition {
- KdInputAction actions[MAX_ACTIONS];
+ KdInputAction actions[MAX_ACTIONS];
KdPointerState nextState;
} KdInputTransition;
static const
-KdInputTransition kdInputMachine[num_input_states][num_input_class] = {
+KdInputTransition kdInputMachine[num_input_states][num_input_class] = {
/* start */
{
- { { hold, setto }, button_1_pend }, /* v1 */
- { { deliver, noop }, start }, /* ^1 */
- { { deliver, noop }, button_2_down }, /* v2 */
- { { deliver, noop }, start }, /* ^2 */
- { { hold, setto }, button_3_pend }, /* v3 */
- { { deliver, noop }, start }, /* ^3 */
- { { deliver, noop }, start }, /* vo */
- { { deliver, noop }, start }, /* ^o */
- { { deliver, noop }, start }, /* <> */
- { { deliver, noop }, start }, /* <-> */
- { { noop, noop }, start }, /* k */
- { { noop, noop }, start }, /* ... */
- },
+ {{hold, setto}, button_1_pend}, /* v1 */
+ {{deliver, noop}, start}, /* ^1 */
+ {{deliver, noop}, button_2_down}, /* v2 */
+ {{deliver, noop}, start}, /* ^2 */
+ {{hold, setto}, button_3_pend}, /* v3 */
+ {{deliver, noop}, start}, /* ^3 */
+ {{deliver, noop}, start}, /* vo */
+ {{deliver, noop}, start}, /* ^o */
+ {{deliver, noop}, start}, /* <> */
+ {{deliver, noop}, start}, /* <-> */
+ {{noop, noop}, start}, /* k */
+ {{noop, noop}, start}, /* ... */
+ },
/* button_1_pend */
{
- { { noop, noop }, button_1_pend }, /* v1 */
- { { release, deliver }, start }, /* ^1 */
- { { release, deliver }, button_1_down }, /* v2 */
- { { release, deliver }, button_1_down }, /* ^2 */
- { { clearto, gen_down_2 }, synth_2_down_13 }, /* v3 */
- { { release, deliver }, button_1_down }, /* ^3 */
- { { release, deliver }, button_1_down }, /* vo */
- { { release, deliver }, button_1_down }, /* ^o */
- { { deliver, noop }, button_1_pend }, /* <> */
- { { release, deliver }, button_1_down }, /* <-> */
- { { noop, noop }, button_1_down }, /* k */
- { { release, noop }, button_1_down }, /* ... */
- },
+ {{noop, noop}, button_1_pend}, /* v1 */
+ {{release, deliver}, start}, /* ^1 */
+ {{release, deliver}, button_1_down}, /* v2 */
+ {{release, deliver}, button_1_down}, /* ^2 */
+ {{clearto, gen_down_2}, synth_2_down_13}, /* v3 */
+ {{release, deliver}, button_1_down}, /* ^3 */
+ {{release, deliver}, button_1_down}, /* vo */
+ {{release, deliver}, button_1_down}, /* ^o */
+ {{deliver, noop}, button_1_pend}, /* <> */
+ {{release, deliver}, button_1_down}, /* <-> */
+ {{noop, noop}, button_1_down}, /* k */
+ {{release, noop}, button_1_down}, /* ... */
+ },
/* button_1_down */
{
- { { noop, noop }, button_1_down }, /* v1 */
- { { deliver, noop }, start }, /* ^1 */
- { { deliver, noop }, button_1_down }, /* v2 */
- { { deliver, noop }, button_1_down }, /* ^2 */
- { { deliver, noop }, button_1_down }, /* v3 */
- { { deliver, noop }, button_1_down }, /* ^3 */
- { { deliver, noop }, button_1_down }, /* vo */
- { { deliver, noop }, button_1_down }, /* ^o */
- { { deliver, noop }, button_1_down }, /* <> */
- { { deliver, noop }, button_1_down }, /* <-> */
- { { noop, noop }, button_1_down }, /* k */
- { { noop, noop }, button_1_down }, /* ... */
- },
+ {{noop, noop}, button_1_down}, /* v1 */
+ {{deliver, noop}, start}, /* ^1 */
+ {{deliver, noop}, button_1_down}, /* v2 */
+ {{deliver, noop}, button_1_down}, /* ^2 */
+ {{deliver, noop}, button_1_down}, /* v3 */
+ {{deliver, noop}, button_1_down}, /* ^3 */
+ {{deliver, noop}, button_1_down}, /* vo */
+ {{deliver, noop}, button_1_down}, /* ^o */
+ {{deliver, noop}, button_1_down}, /* <> */
+ {{deliver, noop}, button_1_down}, /* <-> */
+ {{noop, noop}, button_1_down}, /* k */
+ {{noop, noop}, button_1_down}, /* ... */
+ },
/* button_2_down */
{
- { { deliver, noop }, button_2_down }, /* v1 */
- { { deliver, noop }, button_2_down }, /* ^1 */
- { { noop, noop }, button_2_down }, /* v2 */
- { { deliver, noop }, start }, /* ^2 */
- { { deliver, noop }, button_2_down }, /* v3 */
- { { deliver, noop }, button_2_down }, /* ^3 */
- { { deliver, noop }, button_2_down }, /* vo */
- { { deliver, noop }, button_2_down }, /* ^o */
- { { deliver, noop }, button_2_down }, /* <> */
- { { deliver, noop }, button_2_down }, /* <-> */
- { { noop, noop }, button_2_down }, /* k */
- { { noop, noop }, button_2_down }, /* ... */
- },
+ {{deliver, noop}, button_2_down}, /* v1 */
+ {{deliver, noop}, button_2_down}, /* ^1 */
+ {{noop, noop}, button_2_down}, /* v2 */
+ {{deliver, noop}, start}, /* ^2 */
+ {{deliver, noop}, button_2_down}, /* v3 */
+ {{deliver, noop}, button_2_down}, /* ^3 */
+ {{deliver, noop}, button_2_down}, /* vo */
+ {{deliver, noop}, button_2_down}, /* ^o */
+ {{deliver, noop}, button_2_down}, /* <> */
+ {{deliver, noop}, button_2_down}, /* <-> */
+ {{noop, noop}, button_2_down}, /* k */
+ {{noop, noop}, button_2_down}, /* ... */
+ },
/* button_3_pend */
{
- { { clearto, gen_down_2 }, synth_2_down_13 }, /* v1 */
- { { release, deliver }, button_3_down }, /* ^1 */
- { { release, deliver }, button_3_down }, /* v2 */
- { { release, deliver }, button_3_down }, /* ^2 */
- { { release, deliver }, button_3_down }, /* v3 */
- { { release, deliver }, start }, /* ^3 */
- { { release, deliver }, button_3_down }, /* vo */
- { { release, deliver }, button_3_down }, /* ^o */
- { { deliver, noop }, button_3_pend }, /* <> */
- { { release, deliver }, button_3_down }, /* <-> */
- { { release, noop }, button_3_down }, /* k */
- { { release, noop }, button_3_down }, /* ... */
- },
+ {{clearto, gen_down_2}, synth_2_down_13}, /* v1 */
+ {{release, deliver}, button_3_down}, /* ^1 */
+ {{release, deliver}, button_3_down}, /* v2 */
+ {{release, deliver}, button_3_down}, /* ^2 */
+ {{release, deliver}, button_3_down}, /* v3 */
+ {{release, deliver}, start}, /* ^3 */
+ {{release, deliver}, button_3_down}, /* vo */
+ {{release, deliver}, button_3_down}, /* ^o */
+ {{deliver, noop}, button_3_pend}, /* <> */
+ {{release, deliver}, button_3_down}, /* <-> */
+ {{release, noop}, button_3_down}, /* k */
+ {{release, noop}, button_3_down}, /* ... */
+ },
/* button_3_down */
{
- { { deliver, noop }, button_3_down }, /* v1 */
- { { deliver, noop }, button_3_down }, /* ^1 */
- { { deliver, noop }, button_3_down }, /* v2 */
- { { deliver, noop }, button_3_down }, /* ^2 */
- { { noop, noop }, button_3_down }, /* v3 */
- { { deliver, noop }, start }, /* ^3 */
- { { deliver, noop }, button_3_down }, /* vo */
- { { deliver, noop }, button_3_down }, /* ^o */
- { { deliver, noop }, button_3_down }, /* <> */
- { { deliver, noop }, button_3_down }, /* <-> */
- { { noop, noop }, button_3_down }, /* k */
- { { noop, noop }, button_3_down }, /* ... */
- },
+ {{deliver, noop}, button_3_down}, /* v1 */
+ {{deliver, noop}, button_3_down}, /* ^1 */
+ {{deliver, noop}, button_3_down}, /* v2 */
+ {{deliver, noop}, button_3_down}, /* ^2 */
+ {{noop, noop}, button_3_down}, /* v3 */
+ {{deliver, noop}, start}, /* ^3 */
+ {{deliver, noop}, button_3_down}, /* vo */
+ {{deliver, noop}, button_3_down}, /* ^o */
+ {{deliver, noop}, button_3_down}, /* <> */
+ {{deliver, noop}, button_3_down}, /* <-> */
+ {{noop, noop}, button_3_down}, /* k */
+ {{noop, noop}, button_3_down}, /* ... */
+ },
/* synthetic_2_down_13 */
{
- { { noop, noop }, synth_2_down_13 }, /* v1 */
- { { gen_up_2, noop }, synth_2_down_3 }, /* ^1 */
- { { noop, noop }, synth_2_down_13 }, /* v2 */
- { { noop, noop }, synth_2_down_13 }, /* ^2 */
- { { noop, noop }, synth_2_down_13 }, /* v3 */
- { { gen_up_2, noop }, synth_2_down_1 }, /* ^3 */
- { { deliver, noop }, synth_2_down_13 }, /* vo */
- { { deliver, noop }, synth_2_down_13 }, /* ^o */
- { { deliver, noop }, synth_2_down_13 }, /* <> */
- { { deliver, noop }, synth_2_down_13 }, /* <-> */
- { { noop, noop }, synth_2_down_13 }, /* k */
- { { noop, noop }, synth_2_down_13 }, /* ... */
- },
+ {{noop, noop}, synth_2_down_13}, /* v1 */
+ {{gen_up_2, noop}, synth_2_down_3}, /* ^1 */
+ {{noop, noop}, synth_2_down_13}, /* v2 */
+ {{noop, noop}, synth_2_down_13}, /* ^2 */
+ {{noop, noop}, synth_2_down_13}, /* v3 */
+ {{gen_up_2, noop}, synth_2_down_1}, /* ^3 */
+ {{deliver, noop}, synth_2_down_13}, /* vo */
+ {{deliver, noop}, synth_2_down_13}, /* ^o */
+ {{deliver, noop}, synth_2_down_13}, /* <> */
+ {{deliver, noop}, synth_2_down_13}, /* <-> */
+ {{noop, noop}, synth_2_down_13}, /* k */
+ {{noop, noop}, synth_2_down_13}, /* ... */
+ },
/* synthetic_2_down_3 */
{
- { { deliver, noop }, synth_2_down_3 }, /* v1 */
- { { deliver, noop }, synth_2_down_3 }, /* ^1 */
- { { deliver, noop }, synth_2_down_3 }, /* v2 */
- { { deliver, noop }, synth_2_down_3 }, /* ^2 */
- { { noop, noop }, synth_2_down_3 }, /* v3 */
- { { noop, noop }, start }, /* ^3 */
- { { deliver, noop }, synth_2_down_3 }, /* vo */
- { { deliver, noop }, synth_2_down_3 }, /* ^o */
- { { deliver, noop }, synth_2_down_3 }, /* <> */
- { { deliver, noop }, synth_2_down_3 }, /* <-> */
- { { noop, noop }, synth_2_down_3 }, /* k */
- { { noop, noop }, synth_2_down_3 }, /* ... */
- },
+ {{deliver, noop}, synth_2_down_3}, /* v1 */
+ {{deliver, noop}, synth_2_down_3}, /* ^1 */
+ {{deliver, noop}, synth_2_down_3}, /* v2 */
+ {{deliver, noop}, synth_2_down_3}, /* ^2 */
+ {{noop, noop}, synth_2_down_3}, /* v3 */
+ {{noop, noop}, start}, /* ^3 */
+ {{deliver, noop}, synth_2_down_3}, /* vo */
+ {{deliver, noop}, synth_2_down_3}, /* ^o */
+ {{deliver, noop}, synth_2_down_3}, /* <> */
+ {{deliver, noop}, synth_2_down_3}, /* <-> */
+ {{noop, noop}, synth_2_down_3}, /* k */
+ {{noop, noop}, synth_2_down_3}, /* ... */
+ },
/* synthetic_2_down_1 */
{
- { { noop, noop }, synth_2_down_1 }, /* v1 */
- { { noop, noop }, start }, /* ^1 */
- { { deliver, noop }, synth_2_down_1 }, /* v2 */
- { { deliver, noop }, synth_2_down_1 }, /* ^2 */
- { { deliver, noop }, synth_2_down_1 }, /* v3 */
- { { deliver, noop }, synth_2_down_1 }, /* ^3 */
- { { deliver, noop }, synth_2_down_1 }, /* vo */
- { { deliver, noop }, synth_2_down_1 }, /* ^o */
- { { deliver, noop }, synth_2_down_1 }, /* <> */
- { { deliver, noop }, synth_2_down_1 }, /* <-> */
- { { noop, noop }, synth_2_down_1 }, /* k */
- { { noop, noop }, synth_2_down_1 }, /* ... */
- },
+ {{noop, noop}, synth_2_down_1}, /* v1 */
+ {{noop, noop}, start}, /* ^1 */
+ {{deliver, noop}, synth_2_down_1}, /* v2 */
+ {{deliver, noop}, synth_2_down_1}, /* ^2 */
+ {{deliver, noop}, synth_2_down_1}, /* v3 */
+ {{deliver, noop}, synth_2_down_1}, /* ^3 */
+ {{deliver, noop}, synth_2_down_1}, /* vo */
+ {{deliver, noop}, synth_2_down_1}, /* ^o */
+ {{deliver, noop}, synth_2_down_1}, /* <> */
+ {{deliver, noop}, synth_2_down_1}, /* <-> */
+ {{noop, noop}, synth_2_down_1}, /* k */
+ {{noop, noop}, synth_2_down_1}, /* ... */
+ },
};
#define EMULATION_WINDOW 10
#define EMULATION_TIMEOUT 100
static int
-KdInsideEmulationWindow (KdPointerInfo *pi, int x, int y, int z)
+KdInsideEmulationWindow(KdPointerInfo * pi, int x, int y, int z)
{
pi->emulationDx = pi->heldEvent.x - x;
pi->emulationDy = pi->heldEvent.y - y;
- return (abs (pi->emulationDx) < EMULATION_WINDOW &&
- abs (pi->emulationDy) < EMULATION_WINDOW);
+ return (abs(pi->emulationDx) < EMULATION_WINDOW &&
+ abs(pi->emulationDy) < EMULATION_WINDOW);
}
static KdInputClass
-KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b)
+KdClassifyInput(KdPointerInfo * pi, int type, int x, int y, int z, int b)
{
switch (type) {
case ButtonPress:
- switch (b) {
- case 1: return down_1;
- case 2: return down_2;
- case 3: return down_3;
- default: return down_o;
- }
- break;
+ switch (b) {
+ case 1:
+ return down_1;
+ case 2:
+ return down_2;
+ case 3:
+ return down_3;
+ default:
+ return down_o;
+ }
+ break;
case ButtonRelease:
- switch (b) {
- case 1: return up_1;
- case 2: return up_2;
- case 3: return up_3;
- default: return up_o;
- }
- break;
+ switch (b) {
+ case 1:
+ return up_1;
+ case 2:
+ return up_2;
+ case 3:
+ return up_3;
+ default:
+ return up_o;
+ }
+ break;
case MotionNotify:
- if (pi->eventHeld && !KdInsideEmulationWindow(pi, x, y, z))
- return outside_box;
- else
- return motion;
+ if (pi->eventHeld && !KdInsideEmulationWindow(pi, x, y, z))
+ return outside_box;
+ else
+ return motion;
default:
- return keyboard;
+ return keyboard;
}
return keyboard;
}
#ifdef DEBUG
-char *kdStateNames[] = {
+char *kdStateNames[] = {
"start",
"button_1_pend",
"button_1_down",
@@ -1704,7 +1699,7 @@ char *kdStateNames[] = {
"num_input_states"
};
-char *kdClassNames[] = {
+char *kdClassNames[] = {
"down_1", "up_1",
"down_2", "up_2",
"down_3", "up_3",
@@ -1723,95 +1718,92 @@ char *kdActionNames[] = {
"gen_down_2",
"gen_up_2",
};
-#endif /* DEBUG */
+#endif /* DEBUG */
static void
-KdQueueEvent (DeviceIntPtr pDev, InternalEvent *ev)
+KdQueueEvent(DeviceIntPtr pDev, InternalEvent *ev)
{
- KdAssertSigioBlocked ("KdQueueEvent");
- mieqEnqueue (pDev, ev);
+ KdAssertSigioBlocked("KdQueueEvent");
+ mieqEnqueue(pDev, ev);
}
/* We return true if we're stealing the event. */
static Bool
-KdRunMouseMachine (KdPointerInfo *pi, KdInputClass c, int type, int x, int y,
- int z, int b, int absrel)
+KdRunMouseMachine(KdPointerInfo * pi, KdInputClass c, int type, int x, int y,
+ int z, int b, int absrel)
{
const KdInputTransition *t;
- int a;
+ int a;
c = KdClassifyInput(pi, type, x, y, z, b);
t = &kdInputMachine[pi->mouseState][c];
- for (a = 0; a < MAX_ACTIONS; a++)
- {
- switch (t->actions[a]) {
- case noop:
- break;
- case hold:
- pi->eventHeld = TRUE;
- pi->emulationDx = 0;
- pi->emulationDy = 0;
- pi->heldEvent.type = type;
+ for (a = 0; a < MAX_ACTIONS; a++) {
+ switch (t->actions[a]) {
+ case noop:
+ break;
+ case hold:
+ pi->eventHeld = TRUE;
+ pi->emulationDx = 0;
+ pi->emulationDy = 0;
+ pi->heldEvent.type = type;
pi->heldEvent.x = x;
pi->heldEvent.y = y;
pi->heldEvent.z = z;
pi->heldEvent.flags = b;
pi->heldEvent.absrel = absrel;
return TRUE;
- break;
- case setto:
- pi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT;
- pi->timeoutPending = TRUE;
- break;
- case deliver:
- _KdEnqueuePointerEvent (pi, pi->heldEvent.type, pi->heldEvent.x,
- pi->heldEvent.y, pi->heldEvent.z,
- pi->heldEvent.flags, pi->heldEvent.absrel,
- TRUE);
- break;
- case release:
- pi->eventHeld = FALSE;
- pi->timeoutPending = FALSE;
- _KdEnqueuePointerEvent (pi, pi->heldEvent.type, pi->heldEvent.x,
- pi->heldEvent.y, pi->heldEvent.z,
- pi->heldEvent.flags, pi->heldEvent.absrel,
- TRUE);
+ break;
+ case setto:
+ pi->emulationTimeout = GetTimeInMillis() + EMULATION_TIMEOUT;
+ pi->timeoutPending = TRUE;
+ break;
+ case deliver:
+ _KdEnqueuePointerEvent(pi, pi->heldEvent.type, pi->heldEvent.x,
+ pi->heldEvent.y, pi->heldEvent.z,
+ pi->heldEvent.flags, pi->heldEvent.absrel,
+ TRUE);
+ break;
+ case release:
+ pi->eventHeld = FALSE;
+ pi->timeoutPending = FALSE;
+ _KdEnqueuePointerEvent(pi, pi->heldEvent.type, pi->heldEvent.x,
+ pi->heldEvent.y, pi->heldEvent.z,
+ pi->heldEvent.flags, pi->heldEvent.absrel,
+ TRUE);
return TRUE;
- break;
- case clearto:
- pi->timeoutPending = FALSE;
- break;
- case gen_down_2:
- _KdEnqueuePointerEvent (pi, ButtonPress, x, y, z, 2, absrel,
- TRUE);
- pi->eventHeld = FALSE;
+ break;
+ case clearto:
+ pi->timeoutPending = FALSE;
+ break;
+ case gen_down_2:
+ _KdEnqueuePointerEvent(pi, ButtonPress, x, y, z, 2, absrel, TRUE);
+ pi->eventHeld = FALSE;
return TRUE;
- break;
- case gen_up_2:
- _KdEnqueuePointerEvent (pi, ButtonRelease, x, y, z, 2, absrel,
- TRUE);
+ break;
+ case gen_up_2:
+ _KdEnqueuePointerEvent(pi, ButtonRelease, x, y, z, 2, absrel, TRUE);
return TRUE;
- break;
- }
+ break;
+ }
}
pi->mouseState = t->nextState;
return FALSE;
}
static int
-KdHandlePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z, int b,
- int absrel)
+KdHandlePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z, int b,
+ int absrel)
{
if (pi->emulateMiddleButton)
- return KdRunMouseMachine (pi, KdClassifyInput(pi, type, x, y, z, b),
- type, x, y, z, b, absrel);
+ return KdRunMouseMachine(pi, KdClassifyInput(pi, type, x, y, z, b),
+ type, x, y, z, b, absrel);
return FALSE;
}
static void
-KdReceiveTimeout (KdPointerInfo *pi)
+KdReceiveTimeout(KdPointerInfo * pi)
{
- KdRunMouseMachine (pi, timeout, 0, 0, 0, 0, 0, 0);
+ KdRunMouseMachine(pi, timeout, 0, 0, 0, 0, 0, 0);
}
/*
@@ -1828,17 +1820,16 @@ KdReceiveTimeout (KdPointerInfo *pi)
extern int nClients;
void
-KdReleaseAllKeys (void)
+KdReleaseAllKeys(void)
{
#if 0
- int key;
+ int key;
KdKeyboardInfo *ki;
- KdBlockSigio ();
+ KdBlockSigio();
for (ki = kdKeyboards; ki; ki = ki->next) {
- for (key = ki->keySyms.minKeyCode; key < ki->keySyms.maxKeyCode;
- key++) {
+ for (key = ki->keySyms.minKeyCode; key < ki->keySyms.maxKeyCode; key++) {
if (key_is_down(ki->dixdev, key, KEY_POSTED | KEY_PROCESSED)) {
KdHandleKeyboardEvent(ki, KeyRelease, key);
QueueGetKeyboardEvents(ki->dixdev, KeyRelease, key, NULL);
@@ -1846,56 +1837,55 @@ KdReleaseAllKeys (void)
}
}
- KdUnblockSigio ();
+ KdUnblockSigio();
#endif
}
static void
-KdCheckLock (void)
+KdCheckLock(void)
{
- KeyClassPtr keyc = NULL;
- Bool isSet = FALSE, shouldBeSet = FALSE;
- KdKeyboardInfo *tmp = NULL;
+ KeyClassPtr keyc = NULL;
+ Bool isSet = FALSE, shouldBeSet = FALSE;
+ KdKeyboardInfo *tmp = NULL;
for (tmp = kdKeyboards; tmp; tmp = tmp->next) {
if (tmp->LockLed && tmp->dixdev && tmp->dixdev->key) {
keyc = tmp->dixdev->key;
- isSet = (tmp->leds & (1 << (tmp->LockLed-1))) != 0;
+ isSet = (tmp->leds & (1 << (tmp->LockLed - 1))) != 0;
/* FIXME: Just use XKB indicators! */
- shouldBeSet = !!(XkbStateFieldFromRec(&keyc->xkbInfo->state) & LockMask);
+ shouldBeSet =
+ ! !(XkbStateFieldFromRec(&keyc->xkbInfo->state) & LockMask);
if (isSet != shouldBeSet)
- KdSetLed (tmp, tmp->LockLed, shouldBeSet);
+ KdSetLed(tmp, tmp->LockLed, shouldBeSet);
}
}
}
void
-KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
- unsigned char scan_code,
- unsigned char is_up)
+KdEnqueueKeyboardEvent(KdKeyboardInfo * ki,
+ unsigned char scan_code, unsigned char is_up)
{
unsigned char key_code;
- KeyClassPtr keyc = NULL;
+ KeyClassPtr keyc = NULL;
KeybdCtrl *ctrl = NULL;
int type;
if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed || !ki->dixdev->key)
- return;
+ return;
keyc = ki->dixdev->key;
ctrl = &ki->dixdev->kbdfeed->ctrl;
- if (scan_code >= ki->minScanCode && scan_code <= ki->maxScanCode)
- {
- key_code = scan_code + KD_MIN_KEYCODE - ki->minScanCode;
+ if (scan_code >= ki->minScanCode && scan_code <= ki->maxScanCode) {
+ key_code = scan_code + KD_MIN_KEYCODE - ki->minScanCode;
- /*
- * Set up this event -- the type may be modified below
- */
- if (is_up)
- type = KeyRelease;
- else
- type = KeyPress;
+ /*
+ * Set up this event -- the type may be modified below
+ */
+ if (is_up)
+ type = KeyRelease;
+ else
+ type = KeyPress;
QueueKeyboardEvents(ki->dixdev, type, key_code, NULL);
}
@@ -1916,74 +1906,72 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
/* FIXME do something a little more clever to deal with multiple axes here */
void
-KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
+KdEnqueuePointerEvent(KdPointerInfo * pi, unsigned long flags, int rx, int ry,
int rz)
{
- CARD32 ms;
+ CARD32 ms;
unsigned char buttons;
- int x, y, z;
- int (*matrix)[3] = kdPointerMatrix.matrix;
+ int x, y, z;
+ int (*matrix)[3] = kdPointerMatrix.matrix;
unsigned long button;
- int n;
- int dixflags = 0;
+ int n;
+ int dixflags = 0;
if (!pi)
- return;
+ return;
ms = GetTimeInMillis();
/* we don't need to transform z, so we don't. */
if (flags & KD_MOUSE_DELTA) {
- if (pi->transformCoordinates) {
- x = matrix[0][0] * rx + matrix[0][1] * ry;
- y = matrix[1][0] * rx + matrix[1][1] * ry;
- }
- else {
- x = rx;
- y = ry;
- }
+ if (pi->transformCoordinates) {
+ x = matrix[0][0] * rx + matrix[0][1] * ry;
+ y = matrix[1][0] * rx + matrix[1][1] * ry;
+ }
+ else {
+ x = rx;
+ y = ry;
+ }
}
else {
- if (pi->transformCoordinates) {
- x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2];
- y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2];
- }
- else {
- x = rx;
- y = ry;
- }
+ if (pi->transformCoordinates) {
+ x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2];
+ y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2];
+ }
+ else {
+ x = rx;
+ y = ry;
+ }
}
z = rz;
- if (flags & KD_MOUSE_DELTA)
- {
- if (x || y || z)
- {
+ if (flags & KD_MOUSE_DELTA) {
+ if (x || y || z) {
dixflags = POINTER_RELATIVE | POINTER_ACCELERATE;
- _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE);
+ _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags,
+ FALSE);
}
- } else
- {
+ }
+ else {
dixflags = POINTER_ABSOLUTE;
if (x != pi->dixdev->last.valuators[0] ||
y != pi->dixdev->last.valuators[1])
- _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE);
+ _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags,
+ FALSE);
}
buttons = flags;
- for (button = KD_BUTTON_1, n = 1; n <= pi->nButtons;
- button <<= 1, n++) {
+ for (button = KD_BUTTON_1, n = 1; n <= pi->nButtons; button <<= 1, n++) {
if (((pi->buttonState & button) ^ (buttons & button)) &&
- !(buttons & button)) {
+ !(buttons & button)) {
_KdEnqueuePointerEvent(pi, ButtonRelease, x, y, z, n,
dixflags, FALSE);
- }
+ }
}
- for (button = KD_BUTTON_1, n = 1; n <= pi->nButtons;
- button <<= 1, n++) {
- if (((pi->buttonState & button) ^ (buttons & button)) &&
- (buttons & button)) {
+ for (button = KD_BUTTON_1, n = 1; n <= pi->nButtons; button <<= 1, n++) {
+ if (((pi->buttonState & button) ^ (buttons & button)) &&
+ (buttons & button)) {
_KdEnqueuePointerEvent(pi, ButtonPress, x, y, z, n,
dixflags, FALSE);
}
@@ -1993,8 +1981,8 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
}
void
-_KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z,
- int b, int absrel, Bool force)
+_KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z,
+ int b, int absrel, Bool force)
{
int valuators[3] = { x, y, z };
ValuatorMask mask;
@@ -2009,73 +1997,60 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z,
}
void
-KdBlockHandler (int screen,
- pointer blockData,
- pointer timeout,
- pointer readmask)
+KdBlockHandler(int screen, pointer blockData, pointer timeout, pointer readmask)
{
- KdPointerInfo *pi;
- int myTimeout=0;
-
- for (pi = kdPointers; pi; pi = pi->next)
- {
- if (pi->timeoutPending)
- {
- int ms;
+ KdPointerInfo *pi;
+ int myTimeout = 0;
- ms = pi->emulationTimeout - GetTimeInMillis ();
- if (ms < 1)
- ms = 1;
- if(ms<myTimeout || myTimeout==0)
- myTimeout=ms;
- }
+ for (pi = kdPointers; pi; pi = pi->next) {
+ if (pi->timeoutPending) {
+ int ms;
+
+ ms = pi->emulationTimeout - GetTimeInMillis();
+ if (ms < 1)
+ ms = 1;
+ if (ms < myTimeout || myTimeout == 0)
+ myTimeout = ms;
+ }
}
/* if we need to poll for events, do that */
- if(kdOsFuncs->pollEvents)
- {
- (*kdOsFuncs->pollEvents)();
- myTimeout=20;
+ if (kdOsFuncs->pollEvents) {
+ (*kdOsFuncs->pollEvents) ();
+ myTimeout = 20;
}
- if(myTimeout>0)
- AdjustWaitForDelay (timeout, myTimeout);
+ if (myTimeout > 0)
+ AdjustWaitForDelay(timeout, myTimeout);
}
void
-KdWakeupHandler (int screen,
- pointer data,
- unsigned long lresult,
- pointer readmask)
+KdWakeupHandler(int screen,
+ pointer data, unsigned long lresult, pointer readmask)
{
- int result = (int) lresult;
- fd_set *pReadmask = (fd_set *) readmask;
- int i;
- KdPointerInfo *pi;
+ int result = (int) lresult;
+ fd_set *pReadmask = (fd_set *) readmask;
+ int i;
+ KdPointerInfo *pi;
- if (kdInputEnabled && result > 0)
- {
- for (i = 0; i < kdNumInputFds; i++)
- if (FD_ISSET (kdInputFds[i].fd, pReadmask))
- {
- KdBlockSigio ();
- (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
- KdUnblockSigio ();
- }
- }
- for (pi = kdPointers; pi; pi = pi->next)
- {
- if (pi->timeoutPending)
- {
- if ((long) (GetTimeInMillis () - pi->emulationTimeout) >= 0)
- {
- pi->timeoutPending = FALSE;
- KdBlockSigio ();
- KdReceiveTimeout (pi);
- KdUnblockSigio ();
- }
- }
+ if (kdInputEnabled && result > 0) {
+ for (i = 0; i < kdNumInputFds; i++)
+ if (FD_ISSET(kdInputFds[i].fd, pReadmask)) {
+ KdBlockSigio();
+ (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
+ KdUnblockSigio();
+ }
+ }
+ for (pi = kdPointers; pi; pi = pi->next) {
+ if (pi->timeoutPending) {
+ if ((long) (GetTimeInMillis() - pi->emulationTimeout) >= 0) {
+ pi->timeoutPending = FALSE;
+ KdBlockSigio();
+ KdReceiveTimeout(pi);
+ KdUnblockSigio();
+ }
+ }
}
if (kdSwitchPending)
- KdProcessSwitch ();
+ KdProcessSwitch();
}
#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv(pScreen)->screen->origin))
@@ -2083,84 +2058,75 @@ KdWakeupHandler (int screen,
static Bool
KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
{
- ScreenPtr pScreen = *ppScreen;
- ScreenPtr pNewScreen;
- int n;
- int dx, dy;
- int best_x, best_y;
- int n_best_x, n_best_y;
- CARD32 ms;
+ ScreenPtr pScreen = *ppScreen;
+ ScreenPtr pNewScreen;
+ int n;
+ int dx, dy;
+ int best_x, best_y;
+ int n_best_x, n_best_y;
+ CARD32 ms;
if (kdDisableZaphod || screenInfo.numScreens <= 1)
- return FALSE;
+ return FALSE;
if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height)
- return FALSE;
+ return FALSE;
- ms = GetTimeInMillis ();
+ ms = GetTimeInMillis();
if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
- return FALSE;
+ return FALSE;
kdOffScreen = TRUE;
kdOffScreenTime = ms;
n_best_x = -1;
best_x = 32767;
n_best_y = -1;
best_y = 32767;
- for (n = 0; n < screenInfo.numScreens; n++)
- {
- pNewScreen = screenInfo.screens[n];
- if (pNewScreen == pScreen)
- continue;
- dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
- dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
- if (*x < 0)
- {
- if (dx <= 0 && -dx < best_x)
- {
- best_x = -dx;
- n_best_x = n;
- }
- }
- else if (*x >= pScreen->width)
- {
- if (dx >= 0 && dx < best_x)
- {
- best_x = dx;
- n_best_x = n;
- }
- }
- if (*y < 0)
- {
- if (dy <= 0 && -dy < best_y)
- {
- best_y = -dy;
- n_best_y = n;
- }
- }
- else if (*y >= pScreen->height)
- {
- if (dy >= 0 && dy < best_y)
- {
- best_y = dy;
- n_best_y = n;
- }
- }
+ for (n = 0; n < screenInfo.numScreens; n++) {
+ pNewScreen = screenInfo.screens[n];
+ if (pNewScreen == pScreen)
+ continue;
+ dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
+ dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
+ if (*x < 0) {
+ if (dx <= 0 && -dx < best_x) {
+ best_x = -dx;
+ n_best_x = n;
+ }
+ }
+ else if (*x >= pScreen->width) {
+ if (dx >= 0 && dx < best_x) {
+ best_x = dx;
+ n_best_x = n;
+ }
+ }
+ if (*y < 0) {
+ if (dy <= 0 && -dy < best_y) {
+ best_y = -dy;
+ n_best_y = n;
+ }
+ }
+ else if (*y >= pScreen->height) {
+ if (dy >= 0 && dy < best_y) {
+ best_y = dy;
+ n_best_y = n;
+ }
+ }
}
if (best_y < best_x)
- n_best_x = n_best_y;
+ n_best_x = n_best_y;
if (n_best_x == -1)
- return FALSE;
+ return FALSE;
pNewScreen = screenInfo.screens[n_best_x];
if (*x < 0)
- *x += pNewScreen->width;
+ *x += pNewScreen->width;
if (*y < 0)
- *y += pNewScreen->height;
+ *y += pNewScreen->height;
if (*x >= pScreen->width)
- *x -= pScreen->width;
+ *x -= pScreen->width;
if (*y >= pScreen->height)
- *y -= pScreen->height;
+ *y -= pScreen->height;
*ppScreen = pNewScreen;
return TRUE;
@@ -2171,19 +2137,18 @@ KdCrossScreen(ScreenPtr pScreen, Bool entering)
{
}
-int KdCurScreen; /* current event screen */
+int KdCurScreen; /* current event screen */
static void
-KdWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+KdWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
- KdBlockSigio ();
+ KdBlockSigio();
KdCurScreen = pScreen->myNum;
miPointerWarpCursor(pDev, pScreen, x, y);
- KdUnblockSigio ();
+ KdUnblockSigio();
}
-miPointerScreenFuncRec kdPointerScreenFuncs =
-{
+miPointerScreenFuncRec kdPointerScreenFuncs = {
KdCursorOffScreen,
KdCrossScreen,
KdWarpCursor
@@ -2191,12 +2156,12 @@ miPointerScreenFuncRec kdPointerScreenFuncs =
#ifndef _MSC_VER
void
-ProcessInputEvents (void)
+ProcessInputEvents(void)
{
mieqProcessInputEvents();
if (kdSwitchPending)
- KdProcessSwitch ();
- KdCheckLock ();
+ KdProcessSwitch();
+ KdCheckLock();
}
#endif
@@ -2216,7 +2181,7 @@ SetDeviceValuators(register ClientPtr client, DeviceIntPtr pDev,
int
ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
- xDeviceCtl *control)
+ xDeviceCtl * control)
{
switch (control->control) {
case DEVICE_RESOLUTION:
@@ -2239,7 +2204,7 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
}
int
-NewInputDeviceRequest(InputOption *options, InputAttributes *attrs,
+NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
DeviceIntPtr *pdev)
{
InputOption *option = NULL;
@@ -2268,16 +2233,14 @@ NewInputDeviceRequest(InputOption *options, InputAttributes *attrs,
}
#ifdef CONFIG_HAL
else if (strcmp(key, "_source") == 0 &&
- strcmp(value, "server/hal") == 0)
- {
+ strcmp(value, "server/hal") == 0) {
ErrorF("Ignoring device from HAL.\n");
return BadValue;
}
#endif
#ifdef CONFIG_UDEV
else if (strcmp(key, "_source") == 0 &&
- strcmp(value, "server/udev") == 0)
- {
+ strcmp(value, "server/udev") == 0) {
ErrorF("Ignoring device from udev.\n");
return BadValue;
}
@@ -2342,7 +2305,8 @@ NewInputDeviceRequest(InputOption *options, InputAttributes *attrs,
if (pi) {
*pdev = pi->dixdev;
- } else if(ki) {
+ }
+ else if (ki) {
*pdev = ki->dixdev;
}
diff --git a/xorg-server/hw/kdrive/src/kmode.c b/xorg-server/hw/kdrive/src/kmode.c
index 38b7bc881..ef1b6b4fa 100644
--- a/xorg-server/hw/kdrive/src/kmode.c
+++ b/xorg-server/hw/kdrive/src/kmode.c
@@ -26,223 +26,222 @@
#endif
#include "kdrive.h"
-const KdMonitorTiming kdMonitorTimings[] = {
- /* H V Hz KHz */
- /* FP BP BLANK POLARITY */
+const KdMonitorTiming kdMonitorTimings[] = {
+ /* H V Hz KHz */
+ /* FP BP BLANK POLARITY */
/* IPAQ modeline:
*
* Modeline "320x240" 5.7222 320 337 340 352 240 241 244 254"
*/
- { 320, 240, 64, 16256,
- 17, 12, 32, KdSyncNegative,
- 1, 11, 14, KdSyncNegative,
- },
+ {320, 240, 64, 16256,
+ 17, 12, 32, KdSyncNegative,
+ 1, 11, 14, KdSyncNegative,
+ },
/* Other VESA modes */
- { 640, 350, 85, 31500, /* VESA */
- 32, 96, 192, KdSyncPositive, /* 26.413 */
- 32, 60, 95, KdSyncNegative, /* 59.354 */
- },
- { 640, 400, 60, 31500, /* VESA */
- 32, 96, 192, KdSyncNegative, /* 26.413 */
- 1, 41, 45, KdSyncPositive, /* 59.354 */
- },
- { 720, 400, 85, 35500, /* VESA */
- 36, 108, 216, KdSyncNegative, /* 37.927 */
- 1, 42, 46, KdSyncPositive, /* 85.039 */
- },
-
+ {640, 350, 85, 31500, /* VESA */
+ 32, 96, 192, KdSyncPositive, /* 26.413 */
+ 32, 60, 95, KdSyncNegative, /* 59.354 */
+ },
+ {640, 400, 60, 31500, /* VESA */
+ 32, 96, 192, KdSyncNegative, /* 26.413 */
+ 1, 41, 45, KdSyncPositive, /* 59.354 */
+ },
+ {720, 400, 85, 35500, /* VESA */
+ 36, 108, 216, KdSyncNegative, /* 37.927 */
+ 1, 42, 46, KdSyncPositive, /* 85.039 */
+ },
/* Modeline "720x576" 29.000 720 736 800 880 576 577 580 625 */
{
- 720, 576, 52, 32954, /* PAL Video */
- 16, 80, 160, KdSyncPositive, /* 32.954 */
- 1, 45, 49, KdSyncPositive, /* 52.727 */
- },
+ 720, 576, 52, 32954, /* PAL Video */
+ 16, 80, 160, KdSyncPositive, /* 32.954 */
+ 1, 45, 49, KdSyncPositive, /* 52.727 */
+ },
/* 640x480 modes */
- { 640, 480, 85, 36000, /* VESA */
- 56, 80, 192, KdSyncNegative, /* 43.269 */
- 1, 25, 29, KdSyncNegative, /* 85.008 */
- },
- { 640, 480, 75, 31500, /* VESA */
- 16, 120, 200, KdSyncNegative, /* 37.500 */
- 1, 16, 20, KdSyncNegative, /* 75.000 */
- },
- { 640, 480, 72, 31500, /* VESA */
- 16, 120, 176, KdSyncNegative, /* 37.861 */
- 1, 20, 24, KdSyncNegative, /* 72.809 */
- },
- { 640, 480, 60, 25175, /* VESA */
- 16, 48, 160, KdSyncNegative, /* 31.469 */
- 10, 33, 45, KdSyncNegative, /* 59.940 */
- },
+ {640, 480, 85, 36000, /* VESA */
+ 56, 80, 192, KdSyncNegative, /* 43.269 */
+ 1, 25, 29, KdSyncNegative, /* 85.008 */
+ },
+ {640, 480, 75, 31500, /* VESA */
+ 16, 120, 200, KdSyncNegative, /* 37.500 */
+ 1, 16, 20, KdSyncNegative, /* 75.000 */
+ },
+ {640, 480, 72, 31500, /* VESA */
+ 16, 120, 176, KdSyncNegative, /* 37.861 */
+ 1, 20, 24, KdSyncNegative, /* 72.809 */
+ },
+ {640, 480, 60, 25175, /* VESA */
+ 16, 48, 160, KdSyncNegative, /* 31.469 */
+ 10, 33, 45, KdSyncNegative, /* 59.940 */
+ },
/* 800x600 modes */
- { 800, 600, 85, 56250, /* VESA */
- 32, 152, 248, KdSyncPositive, /* 53.674 */
- 1, 27, 31, KdSyncPositive, /* 85.061 */
- },
- { 800, 600, 75, 49500, /* VESA */
- 16, 160, 256, KdSyncPositive, /* 46.875 */
- 1, 21, 25, KdSyncPositive, /* 75.000 */
- },
+ {800, 600, 85, 56250, /* VESA */
+ 32, 152, 248, KdSyncPositive, /* 53.674 */
+ 1, 27, 31, KdSyncPositive, /* 85.061 */
+ },
+ {800, 600, 75, 49500, /* VESA */
+ 16, 160, 256, KdSyncPositive, /* 46.875 */
+ 1, 21, 25, KdSyncPositive, /* 75.000 */
+ },
/* DEFAULT */
#define MONITOR_TIMING_DEFAULT 9
- { 800, 600, 72, 50000, /* VESA */
- 56, 64, 240, KdSyncPositive, /* 48.077 */
- 37, 23, 66, KdSyncPositive, /* 72.188 */
- },
- { 800, 600, 60, 40000, /* VESA */
- 40, 88, 256, KdSyncPositive, /* 37.879 */
- 1, 23, 28, KdSyncPositive, /* 60.317 */
- },
- { 800, 600, 56, 36000, /* VESA */
- 24, 128, 224, KdSyncPositive, /* 35.156 */
- 1, 22, 25, KdSyncPositive, /* 56.250 */
- },
+ {800, 600, 72, 50000, /* VESA */
+ 56, 64, 240, KdSyncPositive, /* 48.077 */
+ 37, 23, 66, KdSyncPositive, /* 72.188 */
+ },
+ {800, 600, 60, 40000, /* VESA */
+ 40, 88, 256, KdSyncPositive, /* 37.879 */
+ 1, 23, 28, KdSyncPositive, /* 60.317 */
+ },
+ {800, 600, 56, 36000, /* VESA */
+ 24, 128, 224, KdSyncPositive, /* 35.156 */
+ 1, 22, 25, KdSyncPositive, /* 56.250 */
+ },
/* 1024x768 modes */
- { 1024, 768, 85, 94500, /* VESA */
- 48, 208, 352, KdSyncPositive, /* 68.677 */
- 1, 36, 40, KdSyncPositive, /* 84.997 */
- },
- { 1024, 768, 75, 78750, /* VESA */
- 16, 176, 288, KdSyncPositive, /* 60.023 */
- 1, 28, 32, KdSyncPositive, /* 75.029 */
- },
- { 1024, 768, 70, 75000, /* VESA */
- 24, 144, 304, KdSyncNegative, /* 56.476 */
- 3, 29, 38, KdSyncNegative, /* 70.069 */
- },
- { 1024, 768, 60, 65000, /* VESA */
- 24, 160, 320, KdSyncNegative, /* 48.363 */
- 3, 29, 38, KdSyncNegative, /* 60.004 */
- },
+ {1024, 768, 85, 94500, /* VESA */
+ 48, 208, 352, KdSyncPositive, /* 68.677 */
+ 1, 36, 40, KdSyncPositive, /* 84.997 */
+ },
+ {1024, 768, 75, 78750, /* VESA */
+ 16, 176, 288, KdSyncPositive, /* 60.023 */
+ 1, 28, 32, KdSyncPositive, /* 75.029 */
+ },
+ {1024, 768, 70, 75000, /* VESA */
+ 24, 144, 304, KdSyncNegative, /* 56.476 */
+ 3, 29, 38, KdSyncNegative, /* 70.069 */
+ },
+ {1024, 768, 60, 65000, /* VESA */
+ 24, 160, 320, KdSyncNegative, /* 48.363 */
+ 3, 29, 38, KdSyncNegative, /* 60.004 */
+ },
/* 1152x864 mode */
- { 1152, 864, 75, 108000, /* VESA */
- 64, 256, 448, KdSyncPositive, /* 67.500 */
- 1, 32, 36, KdSyncPositive, /* 75.000 */
- },
+ {1152, 864, 75, 108000, /* VESA */
+ 64, 256, 448, KdSyncPositive, /* 67.500 */
+ 1, 32, 36, KdSyncPositive, /* 75.000 */
+ },
/* 1152x900 modes */
- { 1152, 900, 85, 122500, /* ADDED */
- 48, 208, 384, KdSyncPositive, /* 79.753 */
- 1, 32, 38, KdSyncPositive, /* 85.024 */
- },
- { 1152, 900, 75, 108250, /* ADDED */
- 32, 208, 384, KdSyncPositive, /* 70.475 */
- 1, 32, 38, KdSyncPositive, /* 75.133 */
- },
- { 1152, 900, 70, 100250, /* ADDED */
- 32, 208, 384, KdSyncPositive, /* 65.267 */
- 2, 32, 38, KdSyncPositive, /* 69.581 */
- },
- { 1152, 900, 66, 95000, /* ADDED */
- 32, 208, 384, KdSyncPositive, /* 61.849 */
- 1, 32, 38, KdSyncPositive, /* 65.937 */
- },
+ {1152, 900, 85, 122500, /* ADDED */
+ 48, 208, 384, KdSyncPositive, /* 79.753 */
+ 1, 32, 38, KdSyncPositive, /* 85.024 */
+ },
+ {1152, 900, 75, 108250, /* ADDED */
+ 32, 208, 384, KdSyncPositive, /* 70.475 */
+ 1, 32, 38, KdSyncPositive, /* 75.133 */
+ },
+ {1152, 900, 70, 100250, /* ADDED */
+ 32, 208, 384, KdSyncPositive, /* 65.267 */
+ 2, 32, 38, KdSyncPositive, /* 69.581 */
+ },
+ {1152, 900, 66, 95000, /* ADDED */
+ 32, 208, 384, KdSyncPositive, /* 61.849 */
+ 1, 32, 38, KdSyncPositive, /* 65.937 */
+ },
/* 1280x854 modes */
- { 1280, 854, 103, 12500, /* ADDED */
- 56, 16, 128, KdSyncPositive, /* 102.554 */
- 1, 216, 12, KdSyncPositive,
- },
+ {1280, 854, 103, 12500, /* ADDED */
+ 56, 16, 128, KdSyncPositive, /* 102.554 */
+ 1, 216, 12, KdSyncPositive,
+ },
/* 1280x960 modes */
- { 1280, 960, 85, 148500, /* VESA */
- 64, 224, 448, KdSyncPositive, /* 85.938 */
- 1, 47, 51, KdSyncPositive, /* 85.002 */
- },
- { 1280, 960, 60, 108000, /* VESA */
- 96, 312, 520, KdSyncPositive, /* 60.000 */
- 1, 36, 40, KdSyncPositive, /* 60.000 */
- },
+ {1280, 960, 85, 148500, /* VESA */
+ 64, 224, 448, KdSyncPositive, /* 85.938 */
+ 1, 47, 51, KdSyncPositive, /* 85.002 */
+ },
+ {1280, 960, 60, 108000, /* VESA */
+ 96, 312, 520, KdSyncPositive, /* 60.000 */
+ 1, 36, 40, KdSyncPositive, /* 60.000 */
+ },
/* 1280x1024 modes */
- { 1280, 1024, 85, 157500, /* VESA */
- 64, 224, 448, KdSyncPositive, /* 91.146 */
- 1, 44, 48, KdSyncPositive, /* 85.024 */
- },
- { 1280, 1024, 75, 135000, /* VESA */
- 16, 248, 408, KdSyncPositive, /* 79.976 */
- 1, 38, 42, KdSyncPositive, /* 75.025 */
- },
- { 1280, 1024, 60, 108000, /* VESA */
- 48, 248, 408, KdSyncPositive, /* 63.981 */
- 1, 38, 42, KdSyncPositive, /* 60.020 */
- },
+ {1280, 1024, 85, 157500, /* VESA */
+ 64, 224, 448, KdSyncPositive, /* 91.146 */
+ 1, 44, 48, KdSyncPositive, /* 85.024 */
+ },
+ {1280, 1024, 75, 135000, /* VESA */
+ 16, 248, 408, KdSyncPositive, /* 79.976 */
+ 1, 38, 42, KdSyncPositive, /* 75.025 */
+ },
+ {1280, 1024, 60, 108000, /* VESA */
+ 48, 248, 408, KdSyncPositive, /* 63.981 */
+ 1, 38, 42, KdSyncPositive, /* 60.020 */
+ },
/* 1600x1200 modes */
- { 1600, 1200, 85, 229500, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 106.250 */
- 1, 46, 50, KdSyncPositive, /* 85.000 */
- },
- { 1600, 1200, 75, 202500, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 93.750 */
- 1, 46, 50, KdSyncPositive, /* 75.000 */
- },
- { 1600, 1200, 70, 189000, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 87.500 */
- 1, 46, 50, KdSyncPositive, /* 70.000 */
- },
- { 1600, 1200, 65, 175500, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 81.250 */
- 1, 46, 50, KdSyncPositive, /* 65.000 */
- },
- { 1600, 1200, 60, 162000, /* VESA */
- 64, 304, 560, KdSyncPositive, /* 75.000 */
- 1, 46, 50, KdSyncPositive, /* 60.000 */
- },
+ {1600, 1200, 85, 229500, /* VESA */
+ 64, 304, 560, KdSyncPositive, /* 106.250 */
+ 1, 46, 50, KdSyncPositive, /* 85.000 */
+ },
+ {1600, 1200, 75, 202500, /* VESA */
+ 64, 304, 560, KdSyncPositive, /* 93.750 */
+ 1, 46, 50, KdSyncPositive, /* 75.000 */
+ },
+ {1600, 1200, 70, 189000, /* VESA */
+ 64, 304, 560, KdSyncPositive, /* 87.500 */
+ 1, 46, 50, KdSyncPositive, /* 70.000 */
+ },
+ {1600, 1200, 65, 175500, /* VESA */
+ 64, 304, 560, KdSyncPositive, /* 81.250 */
+ 1, 46, 50, KdSyncPositive, /* 65.000 */
+ },
+ {1600, 1200, 60, 162000, /* VESA */
+ 64, 304, 560, KdSyncPositive, /* 75.000 */
+ 1, 46, 50, KdSyncPositive, /* 60.000 */
+ },
/* 1792x1344 modes */
- { 1792, 1344, 85, 301500, /* ADDED */
- 96, 352, 672, KdSyncNegative, /* 122.362 */
- 1, 92, 96, KdSyncPositive, /* 84.974 */
- },
- { 1792, 1344, 75, 261000, /* VESA */
- 96, 352, 664, KdSyncNegative, /* 106.270 */
- 1, 69, 73, KdSyncPositive, /* 74.997 */
- },
- { 1792, 1344, 60, 204750, /* VESA */
- 128, 328, 656, KdSyncNegative, /* 83.640 */
- 1, 46, 50, KdSyncPositive, /* 60.000 */
- },
+ {1792, 1344, 85, 301500, /* ADDED */
+ 96, 352, 672, KdSyncNegative, /* 122.362 */
+ 1, 92, 96, KdSyncPositive, /* 84.974 */
+ },
+ {1792, 1344, 75, 261000, /* VESA */
+ 96, 352, 664, KdSyncNegative, /* 106.270 */
+ 1, 69, 73, KdSyncPositive, /* 74.997 */
+ },
+ {1792, 1344, 60, 204750, /* VESA */
+ 128, 328, 656, KdSyncNegative, /* 83.640 */
+ 1, 46, 50, KdSyncPositive, /* 60.000 */
+ },
#if 0
- { 1800, 1012, 75 },
- { 1906, 1072, 68 },
+ {1800, 1012, 75},
+ {1906, 1072, 68},
#endif
/* 1856x1392 modes */
- { 1856, 1392, 85, 330500, /* ADDED */
- 160, 352, 736, KdSyncNegative, /* 127.508 */
- 1, 104, 108, KdSyncPositive, /* 85.001 */
- },
- { 1856, 1392, 75, 288000, /* VESA */
- 128, 352, 704, KdSyncNegative, /* 112.500 */
- 1, 104, 108, KdSyncPositive, /* 75.000 */
- },
- { 1856, 1392, 60, 218250, /* VESA */
- 96, 352, 672, KdSyncNegative, /* 86.333 */
- 1, 43, 47, KdSyncPositive, /* 59.995 */
- },
+ {1856, 1392, 85, 330500, /* ADDED */
+ 160, 352, 736, KdSyncNegative, /* 127.508 */
+ 1, 104, 108, KdSyncPositive, /* 85.001 */
+ },
+ {1856, 1392, 75, 288000, /* VESA */
+ 128, 352, 704, KdSyncNegative, /* 112.500 */
+ 1, 104, 108, KdSyncPositive, /* 75.000 */
+ },
+ {1856, 1392, 60, 218250, /* VESA */
+ 96, 352, 672, KdSyncNegative, /* 86.333 */
+ 1, 43, 47, KdSyncPositive, /* 59.995 */
+ },
/* 1920x1440 modes */
- { 1920, 1440, 85, 341750, /* ADDED */
- 160, 352, 760, KdSyncNegative, /* 127.512 */
- 1, 56, 60, KdSyncPositive, /* 85.012 */
- },
- { 1920, 1440, 75, 297000, /* VESA */
- 144, 352, 720, KdSyncNegative, /* 112.500 */
- 1, 56, 60, KdSyncPositive, /* 75.000 */
- },
- { 1920, 1440, 60, 234000, /* VESA */
- 128, 244, 680, KdSyncNegative, /* 90.000 */
- 1, 56, 60, KdSyncPositive, /* 60.000 */
- },
+ {1920, 1440, 85, 341750, /* ADDED */
+ 160, 352, 760, KdSyncNegative, /* 127.512 */
+ 1, 56, 60, KdSyncPositive, /* 85.012 */
+ },
+ {1920, 1440, 75, 297000, /* VESA */
+ 144, 352, 720, KdSyncNegative, /* 112.500 */
+ 1, 56, 60, KdSyncPositive, /* 75.000 */
+ },
+ {1920, 1440, 60, 234000, /* VESA */
+ 128, 244, 680, KdSyncNegative, /* 90.000 */
+ 1, 56, 60, KdSyncPositive, /* 60.000 */
+ },
};
#define NUM_MONITOR_TIMINGS (sizeof kdMonitorTimings/sizeof kdMonitorTimings[0])
@@ -250,148 +249,129 @@ const KdMonitorTiming kdMonitorTimings[] = {
const int kdNumMonitorTimings = NUM_MONITOR_TIMINGS;
const KdMonitorTiming *
-KdFindMode (KdScreenInfo *screen,
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *))
+KdFindMode(KdScreenInfo * screen,
+ Bool (*supported) (KdScreenInfo *, const KdMonitorTiming *))
{
- int i;
- const KdMonitorTiming *t;
-
- for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
- {
- if ((*supported) (screen, t) &&
- t->horizontal == screen->width &&
- t->vertical == screen->height &&
- (!screen->rate || t->rate <= screen->rate))
- {
- return t;
- }
+ int i;
+ const KdMonitorTiming *t;
+
+ for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++) {
+ if ((*supported) (screen, t) &&
+ t->horizontal == screen->width &&
+ t->vertical == screen->height &&
+ (!screen->rate || t->rate <= screen->rate)) {
+ return t;
+ }
}
ErrorF("Warning: mode not found, using default\n");
return &kdMonitorTimings[MONITOR_TIMING_DEFAULT];
}
static const KdMonitorTiming *
-kdFindPrevSize (const KdMonitorTiming *old)
+kdFindPrevSize(const KdMonitorTiming * old)
{
- const KdMonitorTiming *new, *prev;
+ const KdMonitorTiming *new, *prev;
if (old == kdMonitorTimings)
- return 0;
+ return 0;
new = old;
/*
* Search for the previous size
*/
- while (new != kdMonitorTimings)
- {
- new--;
- if (new->horizontal != old->horizontal &&
- new->vertical != old->vertical)
- {
- break;
- }
+ while (new != kdMonitorTimings) {
+ new--;
+ if (new->horizontal != old->horizontal &&
+ new->vertical != old->vertical) {
+ break;
+ }
}
/*
* Match the refresh rate (<=)
*/
- while (new != kdMonitorTimings)
- {
- prev = new - 1;
- if (prev->horizontal == new->horizontal &&
- prev->vertical == new->vertical &&
- prev->rate > old->rate)
- {
- break;
- }
- new--;
+ while (new != kdMonitorTimings) {
+ prev = new - 1;
+ if (prev->horizontal == new->horizontal &&
+ prev->vertical == new->vertical && prev->rate > old->rate) {
+ break;
+ }
+ new--;
}
return new;
}
Bool
-KdTuneMode (KdScreenInfo *screen,
- Bool (*usable) (KdScreenInfo *),
- Bool (*supported) (KdScreenInfo *,
- const KdMonitorTiming *))
+KdTuneMode(KdScreenInfo * screen,
+ Bool (*usable) (KdScreenInfo *),
+ Bool (*supported) (KdScreenInfo *, const KdMonitorTiming *))
{
- const KdMonitorTiming *t;
-
- while (!(*usable) (screen))
- {
- /*
- * Fix requested depth and geometry until it works
- */
- if (screen->fb.depth > 16)
- screen->fb.depth = 16;
- else if (screen->fb.depth > 8)
- screen->fb.depth = 8;
- else
- {
- t = kdFindPrevSize (KdFindMode (screen, supported));
- if (!t)
- return FALSE;
- screen->width = t->horizontal;
- screen->height = t->vertical;
- screen->rate = t->rate;
- }
+ const KdMonitorTiming *t;
+
+ while (!(*usable) (screen)) {
+ /*
+ * Fix requested depth and geometry until it works
+ */
+ if (screen->fb.depth > 16)
+ screen->fb.depth = 16;
+ else if (screen->fb.depth > 8)
+ screen->fb.depth = 8;
+ else {
+ t = kdFindPrevSize(KdFindMode(screen, supported));
+ if (!t)
+ return FALSE;
+ screen->width = t->horizontal;
+ screen->height = t->vertical;
+ screen->rate = t->rate;
+ }
}
return TRUE;
}
#ifdef RANDR
Bool
-KdRandRGetInfo (ScreenPtr pScreen,
- int randr,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *))
+KdRandRGetInfo(ScreenPtr pScreen,
+ int randr,
+ Bool (*supported) (ScreenPtr pScreen, const KdMonitorTiming *))
{
KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int i;
- const KdMonitorTiming *t;
-
- for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
- {
- if ((*supported) (pScreen, t))
- {
- RRScreenSizePtr pSize;
-
- pSize = RRRegisterSize (pScreen,
- t->horizontal,
- t->vertical,
- screen->width_mm,
- screen->height_mm);
- if (!pSize)
- return FALSE;
- if (!RRRegisterRate (pScreen, pSize, t->rate))
- return FALSE;
- if (t->horizontal == screen->width &&
- t->vertical == screen->height &&
- t->rate == screen->rate)
- RRSetCurrentConfig (pScreen, randr, t->rate, pSize);
- }
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int i;
+ const KdMonitorTiming *t;
+
+ for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++) {
+ if ((*supported) (pScreen, t)) {
+ RRScreenSizePtr pSize;
+
+ pSize = RRRegisterSize(pScreen,
+ t->horizontal,
+ t->vertical,
+ screen->width_mm, screen->height_mm);
+ if (!pSize)
+ return FALSE;
+ if (!RRRegisterRate(pScreen, pSize, t->rate))
+ return FALSE;
+ if (t->horizontal == screen->width &&
+ t->vertical == screen->height && t->rate == screen->rate)
+ RRSetCurrentConfig(pScreen, randr, t->rate, pSize);
+ }
}
return TRUE;
}
const KdMonitorTiming *
-KdRandRGetTiming (ScreenPtr pScreen,
- Bool (*supported) (ScreenPtr pScreen,
- const KdMonitorTiming *),
- int rate,
- RRScreenSizePtr pSize)
+KdRandRGetTiming(ScreenPtr pScreen,
+ Bool (*supported) (ScreenPtr pScreen,
+ const KdMonitorTiming *),
+ int rate, RRScreenSizePtr pSize)
{
- int i;
- const KdMonitorTiming *t;
-
- for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
- {
- if (t->horizontal == pSize->width &&
- t->vertical == pSize->height &&
- t->rate == rate &&
- (*supported) (pScreen, t))
- return t;
+ int i;
+ const KdMonitorTiming *t;
+
+ for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++) {
+ if (t->horizontal == pSize->width &&
+ t->vertical == pSize->height &&
+ t->rate == rate && (*supported) (pScreen, t))
+ return t;
}
return 0;
}
diff --git a/xorg-server/hw/kdrive/src/kshadow.c b/xorg-server/hw/kdrive/src/kshadow.c
index 63bb87bc6..828ea19a6 100644
--- a/xorg-server/hw/kdrive/src/kshadow.c
+++ b/xorg-server/hw/kdrive/src/kshadow.c
@@ -26,21 +26,21 @@
#include "kdrive.h"
Bool
-KdShadowFbAlloc (KdScreenInfo *screen, Bool rotate)
+KdShadowFbAlloc(KdScreenInfo * screen, Bool rotate)
{
- int paddedWidth;
- void *buf;
- int width = rotate ? screen->height : screen->width;
- int height = rotate ? screen->width : screen->height;
- int bpp = screen->fb.bitsPerPixel;
+ int paddedWidth;
+ void *buf;
+ int width = rotate ? screen->height : screen->width;
+ int height = rotate ? screen->width : screen->height;
+ int bpp = screen->fb.bitsPerPixel;
/* use fb computation for width */
- paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
+ paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
buf = malloc(paddedWidth * height);
if (!buf)
- return FALSE;
+ return FALSE;
if (screen->fb.shadow)
- free(screen->fb.frameBuffer);
+ free(screen->fb.frameBuffer);
screen->fb.shadow = TRUE;
screen->fb.frameBuffer = buf;
screen->fb.byteStride = paddedWidth;
@@ -49,33 +49,32 @@ KdShadowFbAlloc (KdScreenInfo *screen, Bool rotate)
}
void
-KdShadowFbFree (KdScreenInfo *screen)
+KdShadowFbFree(KdScreenInfo * screen)
{
- if (screen->fb.shadow)
- {
- free(screen->fb.frameBuffer);
- screen->fb.frameBuffer = 0;
- screen->fb.shadow = FALSE;
+ if (screen->fb.shadow) {
+ free(screen->fb.frameBuffer);
+ screen->fb.frameBuffer = 0;
+ screen->fb.shadow = FALSE;
}
}
Bool
-KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window)
+KdShadowSet(ScreenPtr pScreen, int randr, ShadowUpdateProc update,
+ ShadowWindowProc window)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
- shadowRemove (pScreen, pScreen->GetScreenPixmap(pScreen));
- if(screen->fb.shadow)
- {
- return shadowAdd (pScreen, pScreen->GetScreenPixmap(pScreen),
- update, window, randr, 0);
+ shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
+ if (screen->fb.shadow) {
+ return shadowAdd(pScreen, pScreen->GetScreenPixmap(pScreen),
+ update, window, randr, 0);
}
return TRUE;
}
void
-KdShadowUnset (ScreenPtr pScreen)
+KdShadowUnset(ScreenPtr pScreen)
{
shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
}
diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c
index e76a2c419..7097aee5c 100644
--- a/xorg-server/hw/kdrive/src/kxv.c
+++ b/xorg-server/hw/kdrive/src/kxv.c
@@ -1,1906 +1,1891 @@
-/*
-
- XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
- Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
-
- Copyright (C) 2000, 2001 - Nokia Home Communications
- Copyright (C) 1998, 1999 - The XFree86 Project Inc.
-
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
-SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-#include "kdrive.h"
-
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "mivalidate.h"
-#include "validate.h"
-#include "resource.h"
-#include "gcstruct.h"
-#include "dixstruct.h"
-
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvproto.h>
-
-#include "kxv.h"
-#include "fourcc.h"
-
-
-/* XvScreenRec fields */
-
-static Bool KdXVCloseScreen(int, ScreenPtr);
-static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
-
-/* XvAdaptorRec fields */
-
-static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*);
-static int KdXVFreePort(XvPortPtr);
-static int KdXVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
-static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
-static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
-static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
- CARD16, CARD16,CARD16, CARD16,
- unsigned int*, unsigned int*);
-static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16,
- XvImagePtr, unsigned char*, Bool,
- CARD16, CARD16);
-static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
- CARD16*, CARD16*, int*, int*);
-
-
-/* ScreenRec fields */
-
-static Bool KdXVCreateWindow(WindowPtr pWin);
-static Bool KdXVDestroyWindow(WindowPtr pWin);
-static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
-static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
-
-/* misc */
-static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int);
-
-static DevPrivateKeyRec KdXVWindowKeyRec;
-#define KdXVWindowKey (&KdXVWindowKeyRec)
-static DevPrivateKey KdXvScreenKey;
-static unsigned long KdXVGeneration = 0;
-static unsigned long PortResource = 0;
-
-DevPrivateKey (*XvGetScreenKeyProc)(void) = XvGetScreenKey;
-unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort;
-int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit;
-
-#define GET_XV_SCREEN(pScreen) ((XvScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, KdXvScreenKey))
-
-#define GET_KDXV_SCREEN(pScreen) \
- ((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
-
-#define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \
- dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey))
-
-static KdXVInitGenericAdaptorPtr *GenDrivers = NULL;
-static int NumGenDrivers = 0;
-
-int
-KdXVRegisterGenericAdaptorDriver(
- KdXVInitGenericAdaptorPtr InitFunc
-){
- KdXVInitGenericAdaptorPtr *newdrivers;
-
-/* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */
-
- newdrivers = realloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
- (1 + NumGenDrivers));
- if (!newdrivers)
- return 0;
- GenDrivers = newdrivers;
-
- GenDrivers[NumGenDrivers++] = InitFunc;
-
- return 1;
-}
-
-int
-KdXVListGenericAdaptors(
- KdScreenInfo * screen,
- KdVideoAdaptorPtr **adaptors
-){
- int i,j,n,num;
- KdVideoAdaptorPtr *DrivAdap,*new;
-
- num = 0;
- *adaptors = NULL;
- for (i = 0; i < NumGenDrivers; i++) {
- n = GenDrivers[i](screen,&DrivAdap);
- if (0 == n)
- continue;
- new = realloc(*adaptors, sizeof(KdVideoAdaptorPtr) * (num+n));
- if (NULL == new)
- continue;
- *adaptors = new;
- for (j = 0; j < n; j++, num++)
- (*adaptors)[num] = DrivAdap[j];
- }
- return num;
-}
-
-KdVideoAdaptorPtr
-KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen)
-{
- return calloc(1, sizeof(KdVideoAdaptorRec));
-}
-
-void
-KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr)
-{
- free(ptr);
-}
-
-
-Bool
-KdXVScreenInit(
- ScreenPtr pScreen,
- KdVideoAdaptorPtr *adaptors,
- int num
-){
- KdXVScreenPtr ScreenPriv;
- XvScreenPtr pxvs;
-
-/* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */
-
- if (KdXVGeneration != serverGeneration)
- KdXVGeneration = serverGeneration;
-
- if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
- return FALSE;
-
- if (!dixRegisterPrivateKey(&KdXVWindowKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
-
- if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
-
- KdXvScreenKey = (*XvGetScreenKeyProc)();
- PortResource = (*XvGetRTPortProc)();
-
- pxvs = GET_XV_SCREEN(pScreen);
-
-
- /* Anyone initializing the Xv layer must provide these two.
- The Xv di layer calls them without even checking if they exist! */
-
- pxvs->ddCloseScreen = KdXVCloseScreen;
- pxvs->ddQueryAdaptors = KdXVQueryAdaptors;
-
- /* The Xv di layer provides us with a private hook so that we don't
- have to allocate our own screen private. They also provide
- a CloseScreen hook so that we don't have to wrap it. I'm not
- sure that I appreciate that. */
-
- ScreenPriv = malloc(sizeof(KdXVScreenRec));
- pxvs->devPriv.ptr = (pointer)ScreenPriv;
-
- if(!ScreenPriv) return FALSE;
-
-
- ScreenPriv->CreateWindow = pScreen->CreateWindow;
- ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
- ScreenPriv->WindowExposures = pScreen->WindowExposures;
- ScreenPriv->ClipNotify = pScreen->ClipNotify;
-
-/* fprintf(stderr,"XV: Wrapping screen funcs\n"); */
-
- pScreen->CreateWindow = KdXVCreateWindow;
- pScreen->DestroyWindow = KdXVDestroyWindow;
- pScreen->WindowExposures = KdXVWindowExposures;
- pScreen->ClipNotify = KdXVClipNotify;
-
- if(!KdXVInitAdaptors(pScreen, adaptors, num))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
-{
- int i;
-
- free(pAdaptor->name);
-
- if(pAdaptor->pEncodings) {
- XvEncodingPtr pEncode = pAdaptor->pEncodings;
-
- for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) {
- free(pEncode->name);
- }
- free(pAdaptor->pEncodings);
- }
-
- free(pAdaptor->pFormats);
-
- if(pAdaptor->pPorts) {
- XvPortPtr pPort = pAdaptor->pPorts;
- XvPortRecPrivatePtr pPriv;
-
- for(i = 0; i < pAdaptor->nPorts; i++, pPort++) {
- pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
- if(pPriv) {
- if(pPriv->clientClip)
- RegionDestroy(pPriv->clientClip);
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- RegionDestroy(pPriv->pCompositeClip);
- free(pPriv);
- }
- }
- free(pAdaptor->pPorts);
- }
-
- if(pAdaptor->nAttributes) {
- XvAttributePtr pAttribute = pAdaptor->pAttributes;
-
- for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) {
- free(pAttribute->name);
- }
-
- free(pAdaptor->pAttributes);
- }
-
- free(pAdaptor->pImages);
-
- free(pAdaptor->devPriv.ptr);
-}
-
-static Bool
-KdXVInitAdaptors(
- ScreenPtr pScreen,
- KdVideoAdaptorPtr *infoPtr,
- int number
-) {
- KdScreenPriv(pScreen);
- KdScreenInfo * screen = pScreenPriv->screen;
-
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
- KdVideoAdaptorPtr adaptorPtr;
- XvAdaptorPtr pAdaptor, pa;
- XvAdaptorRecPrivatePtr adaptorPriv;
- int na, numAdaptor;
- XvPortRecPrivatePtr portPriv;
- XvPortPtr pPort, pp;
- int numPort;
- KdAttributePtr attributePtr;
- XvAttributePtr pAttribute, pat;
- KdVideoFormatPtr formatPtr;
- XvFormatPtr pFormat, pf;
- int numFormat, totFormat;
- KdVideoEncodingPtr encodingPtr;
- XvEncodingPtr pEncode, pe;
- KdImagePtr imagePtr;
- XvImagePtr pImage, pi;
- int numVisuals;
- VisualPtr pVisual;
- int i;
-
- pxvs->nAdaptors = 0;
- pxvs->pAdaptors = NULL;
-
- if(!(pAdaptor = calloc(number, sizeof(XvAdaptorRec))))
- return FALSE;
-
- for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
- adaptorPtr = infoPtr[na];
-
- if(!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
- !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
- continue;
-
- /* client libs expect at least one encoding */
- if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
- continue;
-
- pa->type = adaptorPtr->type;
-
- if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
- pa->type &= ~XvVideoMask;
-
- if(!adaptorPtr->PutStill && !adaptorPtr->GetStill)
- pa->type &= ~XvStillMask;
-
- if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
- pa->type &= ~XvImageMask;
-
- if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
- !adaptorPtr->PutStill)
- pa->type &= ~XvInputMask;
-
- if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
- pa->type &= ~XvOutputMask;
-
- if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
- continue;
- if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
- continue;
-
- pa->pScreen = pScreen;
- pa->ddAllocatePort = KdXVAllocatePort;
- pa->ddFreePort = KdXVFreePort;
- pa->ddPutVideo = KdXVPutVideo;
- pa->ddPutStill = KdXVPutStill;
- pa->ddGetVideo = KdXVGetVideo;
- pa->ddGetStill = KdXVGetStill;
- pa->ddStopVideo = KdXVStopVideo;
- pa->ddPutImage = KdXVPutImage;
- pa->ddSetPortAttribute = KdXVSetPortAttribute;
- pa->ddGetPortAttribute = KdXVGetPortAttribute;
- pa->ddQueryBestSize = KdXVQueryBestSize;
- pa->ddQueryImageAttributes = KdXVQueryImageAttributes;
- pa->name = strdup(adaptorPtr->name);
-
- if(adaptorPtr->nEncodings &&
- (pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
-
- for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
- i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
- {
- pe->id = encodingPtr->id;
- pe->pScreen = pScreen;
- pe->name = strdup(encodingPtr->name);
- pe->width = encodingPtr->width;
- pe->height = encodingPtr->height;
- pe->rate.numerator = encodingPtr->rate.numerator;
- pe->rate.denominator = encodingPtr->rate.denominator;
- }
- pa->nEncodings = adaptorPtr->nEncodings;
- pa->pEncodings = pEncode;
- }
-
- if(adaptorPtr->nImages &&
- (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
-
- for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
- i < adaptorPtr->nImages; i++, pi++, imagePtr++)
- {
- pi->id = imagePtr->id;
- pi->type = imagePtr->type;
- pi->byte_order = imagePtr->byte_order;
- memcpy(pi->guid, imagePtr->guid, 16);
- pi->bits_per_pixel = imagePtr->bits_per_pixel;
- pi->format = imagePtr->format;
- pi->num_planes = imagePtr->num_planes;
- pi->depth = imagePtr->depth;
- pi->red_mask = imagePtr->red_mask;
- pi->green_mask = imagePtr->green_mask;
- pi->blue_mask = imagePtr->blue_mask;
- pi->y_sample_bits = imagePtr->y_sample_bits;
- pi->u_sample_bits = imagePtr->u_sample_bits;
- pi->v_sample_bits = imagePtr->v_sample_bits;
- pi->horz_y_period = imagePtr->horz_y_period;
- pi->horz_u_period = imagePtr->horz_u_period;
- pi->horz_v_period = imagePtr->horz_v_period;
- pi->vert_y_period = imagePtr->vert_y_period;
- pi->vert_u_period = imagePtr->vert_u_period;
- pi->vert_v_period = imagePtr->vert_v_period;
- memcpy(pi->component_order, imagePtr->component_order, 32);
- pi->scanline_order = imagePtr->scanline_order;
- }
- pa->nImages = adaptorPtr->nImages;
- pa->pImages = pImage;
- }
-
- if(adaptorPtr->nAttributes &&
- (pAttribute = calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
- {
- for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
- i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
- {
- pat->flags = attributePtr->flags;
- pat->min_value = attributePtr->min_value;
- pat->max_value = attributePtr->max_value;
- pat->name = strdup(attributePtr->name);
- }
- pa->nAttributes = adaptorPtr->nAttributes;
- pa->pAttributes = pAttribute;
- }
-
-
- totFormat = adaptorPtr->nFormats;
-
- if(!(pFormat = calloc(totFormat, sizeof(XvFormatRec)))) {
- KdXVFreeAdaptor(pa);
- continue;
- }
- for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats;
- i < adaptorPtr->nFormats; i++, formatPtr++)
- {
- numVisuals = pScreen->numVisuals;
- pVisual = pScreen->visuals;
-
- while(numVisuals--) {
- if((pVisual->class == formatPtr->class) &&
- (pVisual->nplanes == formatPtr->depth)) {
-
- if(numFormat >= totFormat) {
- void *moreSpace;
- totFormat *= 2;
- moreSpace = realloc(pFormat,
- totFormat * sizeof(XvFormatRec));
- if(!moreSpace) break;
- pFormat = moreSpace;
- pf = pFormat + numFormat;
- }
-
- pf->visual = pVisual->vid;
- pf->depth = formatPtr->depth;
-
- pf++;
- numFormat++;
- }
- pVisual++;
- }
- }
- pa->nFormats = numFormat;
- pa->pFormats = pFormat;
- if(!numFormat) {
- KdXVFreeAdaptor(pa);
- continue;
- }
-
- if(!(adaptorPriv = calloc(1, sizeof(XvAdaptorRecPrivate)))) {
- KdXVFreeAdaptor(pa);
- continue;
- }
-
- adaptorPriv->flags = adaptorPtr->flags;
- adaptorPriv->PutVideo = adaptorPtr->PutVideo;
- adaptorPriv->PutStill = adaptorPtr->PutStill;
- adaptorPriv->GetVideo = adaptorPtr->GetVideo;
- adaptorPriv->GetStill = adaptorPtr->GetStill;
- adaptorPriv->StopVideo = adaptorPtr->StopVideo;
- adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute;
- adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute;
- adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
- adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
- adaptorPriv->PutImage = adaptorPtr->PutImage;
- adaptorPriv->ReputImage = adaptorPtr->ReputImage;
-
- pa->devPriv.ptr = (pointer)adaptorPriv;
-
- if(!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
- KdXVFreeAdaptor(pa);
- continue;
- }
- for(pp = pPort, i = 0, numPort = 0;
- i < adaptorPtr->nPorts; i++) {
-
- if(!(pp->id = FakeClientID(0)))
- continue;
-
- if(!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
- continue;
-
- if(!AddResource(pp->id, PortResource, pp)) {
- free(portPriv);
- continue;
- }
-
- pp->pAdaptor = pa;
- pp->pNotify = (XvPortNotifyPtr)NULL;
- pp->pDraw = (DrawablePtr)NULL;
- pp->client = (ClientPtr)NULL;
- pp->grab.client = (ClientPtr)NULL;
- pp->time = currentTime;
- pp->devPriv.ptr = portPriv;
-
- portPriv->screen = screen;
- portPriv->AdaptorRec = adaptorPriv;
- portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
-
- pp++;
- numPort++;
- }
- pa->nPorts = numPort;
- pa->pPorts = pPort;
- if(!numPort) {
- KdXVFreeAdaptor(pa);
- continue;
- }
-
- pa->base_id = pPort->id;
-
- pa++;
- numAdaptor++;
- }
-
- if(numAdaptor) {
- pxvs->nAdaptors = numAdaptor;
- pxvs->pAdaptors = pAdaptor;
- } else {
- free(pAdaptor);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Video should be clipped to the intersection of the window cliplist
- and the client cliplist specified in the GC for which the video was
- initialized. When we need to reclip a window, the GC that started
- the video may not even be around anymore. That's why we save the
- client clip from the GC when the video is initialized. We then
- use KdXVUpdateCompositeClip to calculate the new composite clip
- when we need it. This is different from what DEC did. They saved
- the GC and used it's clip list when they needed to reclip the window,
- even if the client clip was different from the one the video was
- initialized with. If the original GC was destroyed, they had to stop
- the video. I like the new method better (MArk).
-
- This function only works for windows. Will need to rewrite when
- (if) we support pixmap rendering.
-*/
-
-static void
-KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
-{
- RegionPtr pregWin, pCompositeClip;
- WindowPtr pWin;
- Bool freeCompClip = FALSE;
-
- if(portPriv->pCompositeClip)
- return;
-
- pWin = (WindowPtr)portPriv->pDraw;
-
- /* get window clip list */
- if(portPriv->subWindowMode == IncludeInferiors) {
- pregWin = NotClippedByChildren(pWin);
- freeCompClip = TRUE;
- } else
- pregWin = &pWin->clipList;
-
- if(!portPriv->clientClip) {
- portPriv->pCompositeClip = pregWin;
- portPriv->FreeCompositeClip = freeCompClip;
- return;
- }
-
- pCompositeClip = RegionCreate(NullBox, 1);
- RegionCopy(pCompositeClip, portPriv->clientClip);
- RegionTranslate(pCompositeClip,
- portPriv->pDraw->x + portPriv->clipOrg.x,
- portPriv->pDraw->y + portPriv->clipOrg.y);
- RegionIntersect(pCompositeClip, pregWin, pCompositeClip);
-
- portPriv->pCompositeClip = pCompositeClip;
- portPriv->FreeCompositeClip = TRUE;
-
- if(freeCompClip) {
- RegionDestroy(pregWin);
- }
-}
-
-/* Save the current clientClip and update the CompositeClip whenever
- we have a fresh GC */
-
-static void
-KdXVCopyClip(
- XvPortRecPrivatePtr portPriv,
- GCPtr pGC
-){
- /* copy the new clip if it exists */
- if((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
- if(!portPriv->clientClip)
- portPriv->clientClip = RegionCreate(NullBox, 1);
- /* Note: this is in window coordinates */
- RegionCopy(portPriv->clientClip, pGC->clientClip);
- } else if(portPriv->clientClip) { /* free the old clientClip */
- RegionDestroy(portPriv->clientClip);
- portPriv->clientClip = NULL;
- }
-
- /* get rid of the old clip list */
- if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
- RegionDestroy(portPriv->pCompositeClip);
- }
-
- portPriv->clipOrg = pGC->clipOrg;
- portPriv->pCompositeClip = pGC->pCompositeClip;
- portPriv->FreeCompositeClip = FALSE;
- portPriv->subWindowMode = pGC->subWindowMode;
-}
-
-static int
-KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
-{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- KdXVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- RegionInit(&WinRegion, &WinBox, 1);
- RegionInit(&ClipRegion, NullBox, 1);
- RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* that's all if it's totally obscured */
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen, portPriv->pDraw,
- portPriv->vid_x, portPriv->vid_y,
- WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- if(ret == Success)
- portPriv->isOn = XV_ON;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
-}
-
-
-static int
-KdXVReputVideo(XvPortRecPrivatePtr portPriv)
-{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- ScreenPtr pScreen = portPriv->pDraw->pScreen;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- KdXVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- RegionInit(&WinRegion, &WinBox, 1);
- RegionInit(&ClipRegion, NullBox, 1);
- RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* clip and translate to the viewport */
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = screen->width;
- VPBox.y2 = screen->height;
-
- RegionInit(&VPReg, &VPBox, 1);
- RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
- RegionUninit(&VPReg);
- }
-
- /* that's all if it's totally obscured */
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- /* bailout if we have to clip but the hardware doesn't support it */
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = RegionRects(&ClipRegion);
- if( (RegionNumRects(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->screen, portPriv->pDraw,
- portPriv->vid_x, portPriv->vid_y,
- WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- if(ret == Success) portPriv->isOn = XV_ON;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
-}
-
-static int
-KdXVReputImage(XvPortRecPrivatePtr portPriv)
-{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- ScreenPtr pScreen = portPriv->pDraw->pScreen;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- KdXVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- RegionInit(&WinRegion, &WinBox, 1);
- RegionInit(&ClipRegion, NullBox, 1);
- RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* clip and translate to the viewport */
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = screen->width;
- VPBox.y2 = screen->height;
-
- RegionInit(&VPReg, &VPBox, 1);
- RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
- RegionUninit(&VPReg);
- }
-
- /* that's all if it's totally obscured */
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- /* bailout if we have to clip but the hardware doesn't support it */
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = RegionRects(&ClipRegion);
- if( (RegionNumRects(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->screen, portPriv->pDraw,
- WinBox.x1, WinBox.y1,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
-}
-
-
-static int
-KdXVReputAllVideo(WindowPtr pWin, pointer data)
-{
- KdXVWindowPtr WinPriv;
-
- if (pWin->drawable.type != DRAWABLE_WINDOW)
- return WT_DONTWALKCHILDREN;
-
- WinPriv = GET_KDXV_WINDOW(pWin);
-
- while(WinPriv) {
- if(WinPriv->PortRec->type == XvInputMask)
- KdXVReputVideo(WinPriv->PortRec);
- else
- KdXVRegetVideo(WinPriv->PortRec);
- WinPriv = WinPriv->next;
- }
-
- return WT_WALKCHILDREN;
-}
-
-static int
-KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
-{
- KdXVWindowPtr winPriv, PrivRoot;
-
- winPriv = PrivRoot = GET_KDXV_WINDOW(pWin);
-
- /* Enlist our port in the window private */
- while(winPriv) {
- if(winPriv->PortRec == portPriv) /* we're already listed */
- break;
- winPriv = winPriv->next;
- }
-
- if(!winPriv) {
- winPriv = malloc(sizeof(KdXVWindowRec));
- if(!winPriv) return BadAlloc;
- winPriv->PortRec = portPriv;
- winPriv->next = PrivRoot;
- dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv);
- }
- return Success;
-}
-
-
-static void
-KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
-{
- KdXVWindowPtr winPriv, prevPriv = NULL;
-
- winPriv = GET_KDXV_WINDOW(pWin);
-
- while(winPriv) {
- if(winPriv->PortRec == portPriv) {
- if(prevPriv)
- prevPriv->next = winPriv->next;
- else
- dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next);
- free(winPriv);
- break;
- }
- prevPriv = winPriv;
- winPriv = winPriv->next;
- }
- portPriv->pDraw = NULL;
-}
-
-/**** ScreenRec fields ****/
-
-
-static Bool
-KdXVCreateWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- int ret;
-
- pScreen->CreateWindow = ScreenPriv->CreateWindow;
- ret = (*pScreen->CreateWindow)(pWin);
- pScreen->CreateWindow = KdXVCreateWindow;
-
- if (ret)
- dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
-
- return ret;
-}
-
-
-static Bool
-KdXVDestroyWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- KdXVWindowPtr tmp, WinPriv = GET_KDXV_WINDOW(pWin);
- int ret;
-
- while(WinPriv) {
- XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
-
- if(pPriv->isOn > XV_OFF) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, TRUE);
- pPriv->isOn = XV_OFF;
- }
-
- pPriv->pDraw = NULL;
- tmp = WinPriv;
- WinPriv = WinPriv->next;
- free(tmp);
- }
-
- dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
-
- pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
- ret = (*pScreen->DestroyWindow)(pWin);
- pScreen->DestroyWindow = KdXVDestroyWindow;
-
- return ret;
-}
-
-
-static void
-KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin);
- KdXVWindowPtr pPrev;
- XvPortRecPrivatePtr pPriv;
- Bool AreasExposed;
-
- AreasExposed = (WinPriv && reg1 && RegionNotEmpty(reg1));
-
- pScreen->WindowExposures = ScreenPriv->WindowExposures;
- (*pScreen->WindowExposures)(pWin, reg1, reg2);
- pScreen->WindowExposures = KdXVWindowExposures;
-
- /* filter out XClearWindow/Area */
- if (!pWin->valdata) return;
-
- pPrev = NULL;
-
- while(WinPriv) {
- pPriv = WinPriv->PortRec;
-
- /* Reput anyone with a reput function */
-
- switch(pPriv->type) {
- case XvInputMask:
- KdXVReputVideo(pPriv);
- break;
- case XvOutputMask:
- KdXVRegetVideo(pPriv);
- break;
- default: /* overlaid still/image*/
- if (pPriv->AdaptorRec->ReputImage)
- KdXVReputImage(pPriv);
- else if(AreasExposed) {
- KdXVWindowPtr tmp;
-
- if (pPriv->isOn == XV_ON) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, FALSE);
- pPriv->isOn = XV_PENDING;
- }
- pPriv->pDraw = NULL;
-
- if(!pPrev)
- dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next);
- else
- pPrev->next = WinPriv->next;
- tmp = WinPriv;
- WinPriv = WinPriv->next;
- free(tmp);
- continue;
- }
- break;
- }
- pPrev = WinPriv;
- WinPriv = WinPriv->next;
- }
-}
-
-
-static void
-KdXVClipNotify(WindowPtr pWin, int dx, int dy)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin);
- KdXVWindowPtr tmp, pPrev = NULL;
- XvPortRecPrivatePtr pPriv;
- Bool visible = (pWin->visibility == VisibilityUnobscured) ||
- (pWin->visibility == VisibilityPartiallyObscured);
-
- while(WinPriv) {
- pPriv = WinPriv->PortRec;
-
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- RegionDestroy(pPriv->pCompositeClip);
-
- pPriv->pCompositeClip = NULL;
-
- /* Stop everything except images, but stop them too if the
- window isn't visible. But we only remove the images. */
-
- if(pPriv->type || !visible) {
- if(pPriv->isOn == XV_ON) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, FALSE);
- pPriv->isOn = XV_PENDING;
- }
-
- if(!pPriv->type) { /* overlaid still/image */
- pPriv->pDraw = NULL;
-
- if(!pPrev)
- dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next);
- else
- pPrev->next = WinPriv->next;
- tmp = WinPriv;
- WinPriv = WinPriv->next;
- free(tmp);
- continue;
- }
- }
-
- pPrev = WinPriv;
- WinPriv = WinPriv->next;
- }
-
- if(ScreenPriv->ClipNotify) {
- pScreen->ClipNotify = ScreenPriv->ClipNotify;
- (*pScreen->ClipNotify)(pWin, dx, dy);
- pScreen->ClipNotify = KdXVClipNotify;
- }
-}
-
-
-
-/**** Required XvScreenRec fields ****/
-
-static Bool
-KdXVCloseScreen(int i, ScreenPtr pScreen)
-{
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
- KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
- XvAdaptorPtr pa;
- int c;
-
- if(!ScreenPriv) return TRUE;
-
- pScreen->CreateWindow = ScreenPriv->CreateWindow;
- pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
- pScreen->WindowExposures = ScreenPriv->WindowExposures;
- pScreen->ClipNotify = ScreenPriv->ClipNotify;
-
-/* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
-
- for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
- KdXVFreeAdaptor(pa);
- }
-
- free(pxvs->pAdaptors);
- free(ScreenPriv);
-
- return TRUE;
-}
-
-
-static int
-KdXVQueryAdaptors(
- ScreenPtr pScreen,
- XvAdaptorPtr *p_pAdaptors,
- int *p_nAdaptors
-){
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
-
- *p_nAdaptors = pxvs->nAdaptors;
- *p_pAdaptors = pxvs->pAdaptors;
-
- return Success;
-}
-
-static Bool
-KdXVRunning (ScreenPtr pScreen)
-{
- return (KdXVGeneration == serverGeneration &&
- GET_XV_SCREEN(pScreen) != 0);
-}
-
-Bool
-KdXVEnable(ScreenPtr pScreen)
-{
- if (!KdXVRunning (pScreen))
- return TRUE;
-
- WalkTree(pScreen, KdXVReputAllVideo, 0);
-
- return TRUE;
-}
-
-void
-KdXVDisable(ScreenPtr pScreen)
-{
- XvScreenPtr pxvs;
- KdXVScreenPtr ScreenPriv;
- XvAdaptorPtr pAdaptor;
- XvPortPtr pPort;
- XvPortRecPrivatePtr pPriv;
- int i, j;
-
- if (!KdXVRunning (pScreen))
- return;
-
- pxvs = GET_XV_SCREEN(pScreen);
- ScreenPriv = GET_KDXV_SCREEN(pScreen);
-
- for(i = 0; i < pxvs->nAdaptors; i++) {
- pAdaptor = &pxvs->pAdaptors[i];
- for(j = 0; j < pAdaptor->nPorts; j++) {
- pPort = &pAdaptor->pPorts[j];
- pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
- if(pPriv->isOn > XV_OFF) {
-
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->screen, pPriv->DevPriv.ptr, TRUE);
- pPriv->isOn = XV_OFF;
-
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- RegionDestroy(pPriv->pCompositeClip);
-
- pPriv->pCompositeClip = NULL;
-
- if(!pPriv->type && pPriv->pDraw) { /* still */
- KdXVRemovePortFromWindow((WindowPtr)pPriv->pDraw, pPriv);
- }
- }
- }
- }
-}
-
-/**** XvAdaptorRec fields ****/
-
-static int
-KdXVAllocatePort(
- unsigned long port,
- XvPortPtr pPort,
- XvPortPtr *ppPort
-){
- *ppPort = pPort;
- return Success;
-}
-
-static int
-KdXVFreePort(XvPortPtr pPort)
-{
- return Success;
-}
-
-static int
-KdXVPutVideo(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- KdScreenPriv(portPriv->screen->pScreen);
- int result;
-
- /* No dumping video to pixmaps... For now anyhow */
- if(pDraw->type != DRAWABLE_WINDOW) {
- pPort->pDraw = (DrawablePtr)NULL;
- return BadAlloc;
- }
-
- /* If we are changing windows, unregister our port in the old window */
- if(portPriv->pDraw && (portPriv->pDraw != pDraw))
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
-
- /* Register our port with the new window */
- result = KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- if(result != Success) return result;
-
- portPriv->pDraw = pDraw;
- portPriv->type = XvInputMask;
-
- /* save a copy of these parameters */
- portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
- portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
-
- /* make sure we have the most recent copy of the clientClip */
- KdXVCopyClip(portPriv, pGC);
-
- /* To indicate to the DI layer that we were successful */
- pPort->pDraw = pDraw;
-
- if (!pScreenPriv->enabled) return Success;
-
- return(KdXVReputVideo(portPriv));
-}
-
-static int
-KdXVPutStill(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- ScreenPtr pScreen = pDraw->pScreen;
- KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if (!pScreenPriv->enabled) return Success;
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- RegionInit(&WinRegion, &WinBox, 1);
- RegionInit(&ClipRegion, NullBox, 1);
- RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = screen->width;
- VPBox.y2 = screen->height;
-
- RegionInit(&VPReg, &VPBox, 1);
- RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
- RegionUninit(&VPReg);
- }
-
- if(portPriv->pDraw) {
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto PUT_STILL_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = RegionRects(&ClipRegion);
- if( (RegionNumRects(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto PUT_STILL_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutStill)(portPriv->screen, pDraw,
- vid_x, vid_y, WinBox.x1, WinBox.y1,
- vid_w, vid_h, drw_w, drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
- if((ret == Success) &&
- (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) {
-
- KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- portPriv->isOn = XV_ON;
- portPriv->pDraw = pDraw;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
- portPriv->type = 0; /* no mask means it's transient and should
- not be reput once it's removed */
- pPort->pDraw = pDraw; /* make sure we can get stop requests */
- }
-
-PUT_STILL_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
-}
-
-static int
-KdXVGetVideo(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- int result;
- KdScreenPriv(portPriv->screen->pScreen);
-
- /* No pixmaps... For now anyhow */
- if(pDraw->type != DRAWABLE_WINDOW) {
- pPort->pDraw = (DrawablePtr)NULL;
- return BadAlloc;
- }
-
- /* If we are changing windows, unregister our port in the old window */
- if(portPriv->pDraw && (portPriv->pDraw != pDraw))
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
-
- /* Register our port with the new window */
- result = KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- if(result != Success) return result;
-
- portPriv->pDraw = pDraw;
- portPriv->type = XvOutputMask;
-
- /* save a copy of these parameters */
- portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
- portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
-
- /* make sure we have the most recent copy of the clientClip */
- KdXVCopyClip(portPriv, pGC);
-
- /* To indicate to the DI layer that we were successful */
- pPort->pDraw = pDraw;
-
- if(!pScreenPriv->enabled) return Success;
-
- return(KdXVRegetVideo(portPriv));
-}
-
-static int
-KdXVGetStill(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- ScreenPtr pScreen = pDraw->pScreen;
- KdScreenPriv(pScreen);
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if(!pScreenPriv->enabled) return Success;
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- RegionInit(&WinRegion, &WinBox, 1);
- RegionInit(&ClipRegion, NullBox, 1);
- RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->pDraw) {
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto GET_STILL_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->GetStill)(portPriv->screen, pDraw,
- vid_x, vid_y, WinBox.x1, WinBox.y1,
- vid_w, vid_h, drw_w, drw_h,
- &ClipRegion, portPriv->DevPriv.ptr);
-
-GET_STILL_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
-}
-
-
-
-static int
-KdXVStopVideo(
- ClientPtr client,
- XvPortPtr pPort,
- DrawablePtr pDraw
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- KdScreenPriv(portPriv->screen->pScreen);
-
- if(pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- KdXVRemovePortFromWindow((WindowPtr)pDraw, portPriv);
-
- if(!pScreenPriv->enabled) return Success;
-
- /* Must free resources. */
-
- if(portPriv->isOn > XV_OFF) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, TRUE);
- portPriv->isOn = XV_OFF;
- }
-
- return Success;
-}
-
-static int
-KdXVSetPortAttribute(
- ClientPtr client,
- XvPortPtr pPort,
- Atom attribute,
- INT32 value
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen,
- attribute, value, portPriv->DevPriv.ptr));
-}
-
-
-static int
-KdXVGetPortAttribute(
- ClientPtr client,
- XvPortPtr pPort,
- Atom attribute,
- INT32 *p_value
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen,
- attribute, (int *) p_value, portPriv->DevPriv.ptr));
-}
-
-
-
-static int
-KdXVQueryBestSize(
- ClientPtr client,
- XvPortPtr pPort,
- CARD8 motion,
- CARD16 vid_w, CARD16 vid_h,
- CARD16 drw_w, CARD16 drw_h,
- unsigned int *p_w, unsigned int *p_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen,
- (Bool)motion, vid_w, vid_h, drw_w, drw_h,
- p_w, p_h, portPriv->DevPriv.ptr);
-
- return Success;
-}
-
-
-static int
-KdXVPutImage(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 src_x, INT16 src_y,
- CARD16 src_w, CARD16 src_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h,
- XvImagePtr format,
- unsigned char* data,
- Bool sync,
- CARD16 width, CARD16 height
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- ScreenPtr pScreen = pDraw->pScreen;
- KdScreenPriv(pScreen);
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if(!pScreenPriv->enabled) return Success;
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- RegionInit(&WinRegion, &WinBox, 1);
- RegionInit(&ClipRegion, NullBox, 1);
- RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = 0;
- VPBox.y1 = 0;
- VPBox.x2 = pScreen->width;
- VPBox.y2 = pScreen->height;
-
- RegionInit(&VPReg, &VPBox, 1);
- RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
- RegionUninit(&VPReg);
- }
-
- if(portPriv->pDraw) {
- KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto PUT_IMAGE_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = RegionRects(&ClipRegion);
- if( (RegionNumRects(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto PUT_IMAGE_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutImage)(portPriv->screen, pDraw,
- src_x, src_y, WinBox.x1, WinBox.y1,
- src_w, src_h, drw_w, drw_h, format->id, data, width, height,
- sync, &ClipRegion, portPriv->DevPriv.ptr);
-
- if((ret == Success) &&
- (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
-
- KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- portPriv->isOn = XV_ON;
- portPriv->pDraw = pDraw;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
- portPriv->type = 0; /* no mask means it's transient and should
- not be reput once it's removed */
- pPort->pDraw = pDraw; /* make sure we can get stop requests */
- }
-
-PUT_IMAGE_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->screen, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
-}
-
-
-static int
-KdXVQueryImageAttributes(
- ClientPtr client,
- XvPortPtr pPort,
- XvImagePtr format,
- CARD16 *width,
- CARD16 *height,
- int *pitches,
- int *offsets
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen,
- format->id, width, height, pitches, offsets);
-}
-
-
-/**************** Common video manipulation functions *******************/
-
-void
-KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
- int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,
- int h, int w)
-{
- int srcDown = srcPitch, srcRight = 2, srcNext;
- int p;
-
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- srcDown = srcPitch;
- srcRight = 2;
- break;
- case RR_Rotate_90:
- src += (srcH - 1) * 2;
- srcDown = -2;
- srcRight = srcPitch;
- break;
- case RR_Rotate_180:
- src += srcPitch * (srcH - 1) + (srcW - 1) * 2;
- srcDown = -srcPitch;
- srcRight = -2;
- break;
- case RR_Rotate_270:
- src += srcPitch * (srcW - 1);
- srcDown = 2;
- srcRight = -srcPitch;
- break;
- }
-
- src = src + top * srcDown + left * srcRight;
-
- w >>= 1;
- /* srcRight >>= 1; */
- srcNext = srcRight >> 1;
- while (h--) {
- CARD16 *s = (CARD16 *)src;
- CARD32 *d = (CARD32 *)dst;
- p = w;
- while (p--) {
- *d++ = s[0] | (s[srcNext] << 16);
- s += srcRight;
- }
- src += srcPitch;
- dst += dstPitch;
- }
-}
-
-void
-KdXVCopyPlanarData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
- int srcPitch, int srcPitch2, int dstPitch, int srcW, int srcH, int height,
- int top, int left, int h, int w, int id)
-{
- int i, j;
- CARD8 *src1, *src2, *src3, *dst1;
- int srcDown = srcPitch, srcDown2 = srcPitch2;
- int srcRight = 2, srcRight2 = 1, srcNext = 1;
-
- /* compute source data pointers */
- src1 = src;
- src2 = src1 + height * srcPitch;
- src3 = src2 + (height >> 1) * srcPitch2;
- switch (randr & RR_Rotate_All) {
- case RR_Rotate_0:
- srcDown = srcPitch;
- srcDown2 = srcPitch2;
- srcRight = 2;
- srcRight2 = 1;
- srcNext = 1;
- break;
- case RR_Rotate_90:
- src1 = src1 + srcH - 1;
- src2 = src2 + (srcH >> 1) - 1;
- src3 = src3 + (srcH >> 1) - 1;
- srcDown = -1;
- srcDown2 = -1;
- srcRight = srcPitch * 2;
- srcRight2 = srcPitch2;
- srcNext = srcPitch;
- break;
- case RR_Rotate_180:
- src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1);
- src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
- src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
- srcDown = -srcPitch;
- srcDown2 = -srcPitch2;
- srcRight = -2;
- srcRight2 = -1;
- srcNext = -1;
- break;
- case RR_Rotate_270:
- src1 = src1 + srcPitch * (srcW - 1);
- src2 = src2 + srcPitch2 * ((srcW >> 1) - 1);
- src3 = src3 + srcPitch2 * ((srcW >> 1) - 1);
- srcDown = 1;
- srcDown2 = 1;
- srcRight = -srcPitch * 2;
- srcRight2 = -srcPitch2;
- srcNext = -srcPitch;
- break;
- }
-
- /* adjust for origin */
- src1 += top * srcDown + left * srcNext;
- src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
- src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
-
- if (id == FOURCC_I420) {
- CARD8 *srct = src2;
- src2 = src3;
- src3 = srct;
- }
-
- dst1 = dst;
-
- w >>= 1;
- for (j = 0; j < h; j++) {
- CARD32 *dst = (CARD32 *)dst1;
- CARD8 *s1l = src1;
- CARD8 *s1r = src1 + srcNext;
- CARD8 *s2 = src2;
- CARD8 *s3 = src3;
-
- for (i = 0; i < w; i++) {
- *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24);
- s1l += srcRight;
- s1r += srcRight;
- s2 += srcRight2;
- s3 += srcRight2;
- }
- src1 += srcDown;
- dst1 += dstPitch;
- if (j & 1) {
- src2 += srcDown2;
- src3 += srcDown2;
- }
- }
-}
-
-void
-KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
-{
- GCPtr pGC;
- ChangeGCVal val[2];
- xRectangle *rects, *r;
- BoxPtr pBox = RegionRects (pRgn);
- int nBox = RegionNumRects (pRgn);
-
- rects = malloc(nBox * sizeof (xRectangle));
- if (!rects)
- goto bail0;
- r = rects;
- while (nBox--)
- {
- r->x = pBox->x1 - pDraw->x;
- r->y = pBox->y1 - pDraw->y;
- r->width = pBox->x2 - pBox->x1;
- r->height = pBox->y2 - pBox->y1;
- r++;
- pBox++;
- }
-
- pGC = GetScratchGC (pDraw->depth, pDraw->pScreen);
- if (!pGC)
- goto bail1;
-
- val[0].val = fg;
- val[1].val = IncludeInferiors;
- ChangeGC (NullClient, pGC, GCForeground|GCSubwindowMode, val);
-
- ValidateGC (pDraw, pGC);
-
- (*pGC->ops->PolyFillRect) (pDraw, pGC,
- RegionNumRects (pRgn), rects);
-
- FreeScratchGC (pGC);
-bail1:
- free(rects);
-bail0:
- ;
-}
+/*
+
+ XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
+ Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
+
+ Copyright (C) 2000, 2001 - Nokia Home Communications
+ Copyright (C) 1998, 1999 - The XFree86 Project Inc.
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "mivalidate.h"
+#include "validate.h"
+#include "resource.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvproto.h>
+
+#include "kxv.h"
+#include "fourcc.h"
+
+/* XvScreenRec fields */
+
+static Bool KdXVCloseScreen(int, ScreenPtr);
+static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
+
+/* XvAdaptorRec fields */
+
+static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr *);
+static int KdXVFreePort(XvPortPtr);
+static int KdXVPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int KdXVPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int KdXVGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int KdXVGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
+static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
+static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
+static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
+ CARD16, CARD16, CARD16, CARD16,
+ unsigned int *, unsigned int *);
+static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
+ XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
+static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
+ CARD16 *, CARD16 *, int *, int *);
+
+/* ScreenRec fields */
+
+static Bool KdXVCreateWindow(WindowPtr pWin);
+static Bool KdXVDestroyWindow(WindowPtr pWin);
+static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
+static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
+
+/* misc */
+static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr *, int);
+
+static DevPrivateKeyRec KdXVWindowKeyRec;
+
+#define KdXVWindowKey (&KdXVWindowKeyRec)
+static DevPrivateKey KdXvScreenKey;
+static unsigned long KdXVGeneration = 0;
+static unsigned long PortResource = 0;
+
+DevPrivateKey (*XvGetScreenKeyProc) (void) = XvGetScreenKey;
+unsigned long (*XvGetRTPortProc) (void) = XvGetRTPort;
+int (*XvScreenInitProc) (ScreenPtr) = XvScreenInit;
+
+#define GET_XV_SCREEN(pScreen) ((XvScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, KdXvScreenKey))
+
+#define GET_KDXV_SCREEN(pScreen) \
+ ((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
+
+#define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey))
+
+static KdXVInitGenericAdaptorPtr *GenDrivers = NULL;
+static int NumGenDrivers = 0;
+
+int
+KdXVRegisterGenericAdaptorDriver(KdXVInitGenericAdaptorPtr InitFunc)
+{
+ KdXVInitGenericAdaptorPtr *newdrivers;
+
+/* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */
+
+ newdrivers = realloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
+ (1 + NumGenDrivers));
+ if (!newdrivers)
+ return 0;
+ GenDrivers = newdrivers;
+
+ GenDrivers[NumGenDrivers++] = InitFunc;
+
+ return 1;
+}
+
+int
+KdXVListGenericAdaptors(KdScreenInfo * screen, KdVideoAdaptorPtr ** adaptors)
+{
+ int i, j, n, num;
+ KdVideoAdaptorPtr *DrivAdap, *new;
+
+ num = 0;
+ *adaptors = NULL;
+ for (i = 0; i < NumGenDrivers; i++) {
+ n = GenDrivers[i] (screen, &DrivAdap);
+ if (0 == n)
+ continue;
+ new = realloc(*adaptors, sizeof(KdVideoAdaptorPtr) * (num + n));
+ if (NULL == new)
+ continue;
+ *adaptors = new;
+ for (j = 0; j < n; j++, num++)
+ (*adaptors)[num] = DrivAdap[j];
+ }
+ return num;
+}
+
+KdVideoAdaptorPtr
+KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen)
+{
+ return calloc(1, sizeof(KdVideoAdaptorRec));
+}
+
+void
+KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr)
+{
+ free(ptr);
+}
+
+Bool
+KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * adaptors, int num)
+{
+ KdXVScreenPtr ScreenPriv;
+ XvScreenPtr pxvs;
+
+/* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */
+
+ if (KdXVGeneration != serverGeneration)
+ KdXVGeneration = serverGeneration;
+
+ if (!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&KdXVWindowKeyRec, PRIVATE_WINDOW, 0))
+ return FALSE;
+
+ if (Success != (*XvScreenInitProc) (pScreen))
+ return FALSE;
+
+ KdXvScreenKey = (*XvGetScreenKeyProc) ();
+ PortResource = (*XvGetRTPortProc) ();
+
+ pxvs = GET_XV_SCREEN(pScreen);
+
+ /* Anyone initializing the Xv layer must provide these two.
+ The Xv di layer calls them without even checking if they exist! */
+
+ pxvs->ddCloseScreen = KdXVCloseScreen;
+ pxvs->ddQueryAdaptors = KdXVQueryAdaptors;
+
+ /* The Xv di layer provides us with a private hook so that we don't
+ have to allocate our own screen private. They also provide
+ a CloseScreen hook so that we don't have to wrap it. I'm not
+ sure that I appreciate that. */
+
+ ScreenPriv = malloc(sizeof(KdXVScreenRec));
+ pxvs->devPriv.ptr = (pointer) ScreenPriv;
+
+ if (!ScreenPriv)
+ return FALSE;
+
+ ScreenPriv->CreateWindow = pScreen->CreateWindow;
+ ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
+ ScreenPriv->WindowExposures = pScreen->WindowExposures;
+ ScreenPriv->ClipNotify = pScreen->ClipNotify;
+
+/* fprintf(stderr,"XV: Wrapping screen funcs\n"); */
+
+ pScreen->CreateWindow = KdXVCreateWindow;
+ pScreen->DestroyWindow = KdXVDestroyWindow;
+ pScreen->WindowExposures = KdXVWindowExposures;
+ pScreen->ClipNotify = KdXVClipNotify;
+
+ if (!KdXVInitAdaptors(pScreen, adaptors, num))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
+{
+ int i;
+
+ free(pAdaptor->name);
+
+ if (pAdaptor->pEncodings) {
+ XvEncodingPtr pEncode = pAdaptor->pEncodings;
+
+ for (i = 0; i < pAdaptor->nEncodings; i++, pEncode++) {
+ free(pEncode->name);
+ }
+ free(pAdaptor->pEncodings);
+ }
+
+ free(pAdaptor->pFormats);
+
+ if (pAdaptor->pPorts) {
+ XvPortPtr pPort = pAdaptor->pPorts;
+ XvPortRecPrivatePtr pPriv;
+
+ for (i = 0; i < pAdaptor->nPorts; i++, pPort++) {
+ pPriv = (XvPortRecPrivatePtr) pPort->devPriv.ptr;
+ if (pPriv) {
+ if (pPriv->clientClip)
+ RegionDestroy(pPriv->clientClip);
+ if (pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ RegionDestroy(pPriv->pCompositeClip);
+ free(pPriv);
+ }
+ }
+ free(pAdaptor->pPorts);
+ }
+
+ if (pAdaptor->nAttributes) {
+ XvAttributePtr pAttribute = pAdaptor->pAttributes;
+
+ for (i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) {
+ free(pAttribute->name);
+ }
+
+ free(pAdaptor->pAttributes);
+ }
+
+ free(pAdaptor->pImages);
+
+ free(pAdaptor->devPriv.ptr);
+}
+
+static Bool
+KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ KdVideoAdaptorPtr adaptorPtr;
+ XvAdaptorPtr pAdaptor, pa;
+ XvAdaptorRecPrivatePtr adaptorPriv;
+ int na, numAdaptor;
+ XvPortRecPrivatePtr portPriv;
+ XvPortPtr pPort, pp;
+ int numPort;
+ KdAttributePtr attributePtr;
+ XvAttributePtr pAttribute, pat;
+ KdVideoFormatPtr formatPtr;
+ XvFormatPtr pFormat, pf;
+ int numFormat, totFormat;
+ KdVideoEncodingPtr encodingPtr;
+ XvEncodingPtr pEncode, pe;
+ KdImagePtr imagePtr;
+ XvImagePtr pImage, pi;
+ int numVisuals;
+ VisualPtr pVisual;
+ int i;
+
+ pxvs->nAdaptors = 0;
+ pxvs->pAdaptors = NULL;
+
+ if (!(pAdaptor = calloc(number, sizeof(XvAdaptorRec))))
+ return FALSE;
+
+ for (pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
+ adaptorPtr = infoPtr[na];
+
+ if (!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
+ !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
+ continue;
+
+ /* client libs expect at least one encoding */
+ if (!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
+ continue;
+
+ pa->type = adaptorPtr->type;
+
+ if (!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
+ pa->type &= ~XvVideoMask;
+
+ if (!adaptorPtr->PutStill && !adaptorPtr->GetStill)
+ pa->type &= ~XvStillMask;
+
+ if (!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
+ pa->type &= ~XvImageMask;
+
+ if (!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
+ !adaptorPtr->PutStill)
+ pa->type &= ~XvInputMask;
+
+ if (!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
+ pa->type &= ~XvOutputMask;
+
+ if (!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
+ continue;
+ if (!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
+ continue;
+
+ pa->pScreen = pScreen;
+ pa->ddAllocatePort = KdXVAllocatePort;
+ pa->ddFreePort = KdXVFreePort;
+ pa->ddPutVideo = KdXVPutVideo;
+ pa->ddPutStill = KdXVPutStill;
+ pa->ddGetVideo = KdXVGetVideo;
+ pa->ddGetStill = KdXVGetStill;
+ pa->ddStopVideo = KdXVStopVideo;
+ pa->ddPutImage = KdXVPutImage;
+ pa->ddSetPortAttribute = KdXVSetPortAttribute;
+ pa->ddGetPortAttribute = KdXVGetPortAttribute;
+ pa->ddQueryBestSize = KdXVQueryBestSize;
+ pa->ddQueryImageAttributes = KdXVQueryImageAttributes;
+ pa->name = strdup(adaptorPtr->name);
+
+ if (adaptorPtr->nEncodings &&
+ (pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
+
+ for (pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
+ i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) {
+ pe->id = encodingPtr->id;
+ pe->pScreen = pScreen;
+ pe->name = strdup(encodingPtr->name);
+ pe->width = encodingPtr->width;
+ pe->height = encodingPtr->height;
+ pe->rate.numerator = encodingPtr->rate.numerator;
+ pe->rate.denominator = encodingPtr->rate.denominator;
+ }
+ pa->nEncodings = adaptorPtr->nEncodings;
+ pa->pEncodings = pEncode;
+ }
+
+ if (adaptorPtr->nImages &&
+ (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
+
+ for (i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
+ i < adaptorPtr->nImages; i++, pi++, imagePtr++) {
+ pi->id = imagePtr->id;
+ pi->type = imagePtr->type;
+ pi->byte_order = imagePtr->byte_order;
+ memcpy(pi->guid, imagePtr->guid, 16);
+ pi->bits_per_pixel = imagePtr->bits_per_pixel;
+ pi->format = imagePtr->format;
+ pi->num_planes = imagePtr->num_planes;
+ pi->depth = imagePtr->depth;
+ pi->red_mask = imagePtr->red_mask;
+ pi->green_mask = imagePtr->green_mask;
+ pi->blue_mask = imagePtr->blue_mask;
+ pi->y_sample_bits = imagePtr->y_sample_bits;
+ pi->u_sample_bits = imagePtr->u_sample_bits;
+ pi->v_sample_bits = imagePtr->v_sample_bits;
+ pi->horz_y_period = imagePtr->horz_y_period;
+ pi->horz_u_period = imagePtr->horz_u_period;
+ pi->horz_v_period = imagePtr->horz_v_period;
+ pi->vert_y_period = imagePtr->vert_y_period;
+ pi->vert_u_period = imagePtr->vert_u_period;
+ pi->vert_v_period = imagePtr->vert_v_period;
+ memcpy(pi->component_order, imagePtr->component_order, 32);
+ pi->scanline_order = imagePtr->scanline_order;
+ }
+ pa->nImages = adaptorPtr->nImages;
+ pa->pImages = pImage;
+ }
+
+ if (adaptorPtr->nAttributes &&
+ (pAttribute =
+ calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) {
+ for (pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i =
+ 0; i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) {
+ pat->flags = attributePtr->flags;
+ pat->min_value = attributePtr->min_value;
+ pat->max_value = attributePtr->max_value;
+ pat->name = strdup(attributePtr->name);
+ }
+ pa->nAttributes = adaptorPtr->nAttributes;
+ pa->pAttributes = pAttribute;
+ }
+
+ totFormat = adaptorPtr->nFormats;
+
+ if (!(pFormat = calloc(totFormat, sizeof(XvFormatRec)))) {
+ KdXVFreeAdaptor(pa);
+ continue;
+ }
+ for (pf = pFormat, i = 0, numFormat = 0, formatPtr =
+ adaptorPtr->pFormats; i < adaptorPtr->nFormats; i++, formatPtr++) {
+ numVisuals = pScreen->numVisuals;
+ pVisual = pScreen->visuals;
+
+ while (numVisuals--) {
+ if ((pVisual->class == formatPtr->class) &&
+ (pVisual->nplanes == formatPtr->depth)) {
+
+ if (numFormat >= totFormat) {
+ void *moreSpace;
+
+ totFormat *= 2;
+ moreSpace = realloc(pFormat,
+ totFormat * sizeof(XvFormatRec));
+ if (!moreSpace)
+ break;
+ pFormat = moreSpace;
+ pf = pFormat + numFormat;
+ }
+
+ pf->visual = pVisual->vid;
+ pf->depth = formatPtr->depth;
+
+ pf++;
+ numFormat++;
+ }
+ pVisual++;
+ }
+ }
+ pa->nFormats = numFormat;
+ pa->pFormats = pFormat;
+ if (!numFormat) {
+ KdXVFreeAdaptor(pa);
+ continue;
+ }
+
+ if (!(adaptorPriv = calloc(1, sizeof(XvAdaptorRecPrivate)))) {
+ KdXVFreeAdaptor(pa);
+ continue;
+ }
+
+ adaptorPriv->flags = adaptorPtr->flags;
+ adaptorPriv->PutVideo = adaptorPtr->PutVideo;
+ adaptorPriv->PutStill = adaptorPtr->PutStill;
+ adaptorPriv->GetVideo = adaptorPtr->GetVideo;
+ adaptorPriv->GetStill = adaptorPtr->GetStill;
+ adaptorPriv->StopVideo = adaptorPtr->StopVideo;
+ adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute;
+ adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute;
+ adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
+ adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
+ adaptorPriv->PutImage = adaptorPtr->PutImage;
+ adaptorPriv->ReputImage = adaptorPtr->ReputImage;
+
+ pa->devPriv.ptr = (pointer) adaptorPriv;
+
+ if (!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
+ KdXVFreeAdaptor(pa);
+ continue;
+ }
+ for (pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) {
+
+ if (!(pp->id = FakeClientID(0)))
+ continue;
+
+ if (!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
+ continue;
+
+ if (!AddResource(pp->id, PortResource, pp)) {
+ free(portPriv);
+ continue;
+ }
+
+ pp->pAdaptor = pa;
+ pp->pNotify = (XvPortNotifyPtr) NULL;
+ pp->pDraw = (DrawablePtr) NULL;
+ pp->client = (ClientPtr) NULL;
+ pp->grab.client = (ClientPtr) NULL;
+ pp->time = currentTime;
+ pp->devPriv.ptr = portPriv;
+
+ portPriv->screen = screen;
+ portPriv->AdaptorRec = adaptorPriv;
+ portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
+
+ pp++;
+ numPort++;
+ }
+ pa->nPorts = numPort;
+ pa->pPorts = pPort;
+ if (!numPort) {
+ KdXVFreeAdaptor(pa);
+ continue;
+ }
+
+ pa->base_id = pPort->id;
+
+ pa++;
+ numAdaptor++;
+ }
+
+ if (numAdaptor) {
+ pxvs->nAdaptors = numAdaptor;
+ pxvs->pAdaptors = pAdaptor;
+ }
+ else {
+ free(pAdaptor);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Video should be clipped to the intersection of the window cliplist
+ and the client cliplist specified in the GC for which the video was
+ initialized. When we need to reclip a window, the GC that started
+ the video may not even be around anymore. That's why we save the
+ client clip from the GC when the video is initialized. We then
+ use KdXVUpdateCompositeClip to calculate the new composite clip
+ when we need it. This is different from what DEC did. They saved
+ the GC and used it's clip list when they needed to reclip the window,
+ even if the client clip was different from the one the video was
+ initialized with. If the original GC was destroyed, they had to stop
+ the video. I like the new method better (MArk).
+
+ This function only works for windows. Will need to rewrite when
+ (if) we support pixmap rendering.
+*/
+
+static void
+KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
+{
+ RegionPtr pregWin, pCompositeClip;
+ WindowPtr pWin;
+ Bool freeCompClip = FALSE;
+
+ if (portPriv->pCompositeClip)
+ return;
+
+ pWin = (WindowPtr) portPriv->pDraw;
+
+ /* get window clip list */
+ if (portPriv->subWindowMode == IncludeInferiors) {
+ pregWin = NotClippedByChildren(pWin);
+ freeCompClip = TRUE;
+ }
+ else
+ pregWin = &pWin->clipList;
+
+ if (!portPriv->clientClip) {
+ portPriv->pCompositeClip = pregWin;
+ portPriv->FreeCompositeClip = freeCompClip;
+ return;
+ }
+
+ pCompositeClip = RegionCreate(NullBox, 1);
+ RegionCopy(pCompositeClip, portPriv->clientClip);
+ RegionTranslate(pCompositeClip,
+ portPriv->pDraw->x + portPriv->clipOrg.x,
+ portPriv->pDraw->y + portPriv->clipOrg.y);
+ RegionIntersect(pCompositeClip, pregWin, pCompositeClip);
+
+ portPriv->pCompositeClip = pCompositeClip;
+ portPriv->FreeCompositeClip = TRUE;
+
+ if (freeCompClip) {
+ RegionDestroy(pregWin);
+ }
+}
+
+/* Save the current clientClip and update the CompositeClip whenever
+ we have a fresh GC */
+
+static void
+KdXVCopyClip(XvPortRecPrivatePtr portPriv, GCPtr pGC)
+{
+ /* copy the new clip if it exists */
+ if ((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
+ if (!portPriv->clientClip)
+ portPriv->clientClip = RegionCreate(NullBox, 1);
+ /* Note: this is in window coordinates */
+ RegionCopy(portPriv->clientClip, pGC->clientClip);
+ }
+ else if (portPriv->clientClip) { /* free the old clientClip */
+ RegionDestroy(portPriv->clientClip);
+ portPriv->clientClip = NULL;
+ }
+
+ /* get rid of the old clip list */
+ if (portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
+ RegionDestroy(portPriv->pCompositeClip);
+ }
+
+ portPriv->clipOrg = pGC->clipOrg;
+ portPriv->pCompositeClip = pGC->pCompositeClip;
+ portPriv->FreeCompositeClip = FALSE;
+ portPriv->subWindowMode = pGC->subWindowMode;
+}
+
+static int
+KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ KdXVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionInit(&ClipRegion, NullBox, 1);
+ RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* that's all if it's totally obscured */
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->GetVideo) (portPriv->screen, portPriv->pDraw,
+ portPriv->vid_x, portPriv->vid_y,
+ WinBox.x1, WinBox.y1,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion,
+ portPriv->DevPriv.ptr);
+
+ if (ret == Success)
+ portPriv->isOn = XV_ON;
+
+ CLIP_VIDEO_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->screen,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if (!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
+}
+
+static int
+KdXVReputVideo(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ ScreenPtr pScreen = portPriv->pDraw->pScreen;
+
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ KdXVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionInit(&ClipRegion, NullBox, 1);
+ RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* clip and translate to the viewport */
+ if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = 0;
+ VPBox.y1 = 0;
+ VPBox.x2 = screen->width;
+ VPBox.y2 = screen->height;
+
+ RegionInit(&VPReg, &VPBox, 1);
+ RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
+ RegionUninit(&VPReg);
+ }
+
+ /* that's all if it's totally obscured */
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ /* bailout if we have to clip but the hardware doesn't support it */
+ if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = RegionRects(&ClipRegion);
+
+ if ((RegionNumRects(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutVideo) (portPriv->screen, portPriv->pDraw,
+ portPriv->vid_x, portPriv->vid_y,
+ WinBox.x1, WinBox.y1,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion,
+ portPriv->DevPriv.ptr);
+
+ if (ret == Success)
+ portPriv->isOn = XV_ON;
+
+ CLIP_VIDEO_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->screen,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if (!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
+}
+
+static int
+KdXVReputImage(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ ScreenPtr pScreen = portPriv->pDraw->pScreen;
+
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ KdXVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionInit(&ClipRegion, NullBox, 1);
+ RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* clip and translate to the viewport */
+ if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = 0;
+ VPBox.y1 = 0;
+ VPBox.x2 = screen->width;
+ VPBox.y2 = screen->height;
+
+ RegionInit(&VPReg, &VPBox, 1);
+ RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
+ RegionUninit(&VPReg);
+ }
+
+ /* that's all if it's totally obscured */
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ /* bailout if we have to clip but the hardware doesn't support it */
+ if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = RegionRects(&ClipRegion);
+
+ if ((RegionNumRects(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret =
+ (*portPriv->AdaptorRec->ReputImage) (portPriv->screen, portPriv->pDraw,
+ WinBox.x1, WinBox.y1, &ClipRegion,
+ portPriv->DevPriv.ptr);
+
+ portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF;
+
+ CLIP_VIDEO_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->screen,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if (!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
+}
+
+static int
+KdXVReputAllVideo(WindowPtr pWin, pointer data)
+{
+ KdXVWindowPtr WinPriv;
+
+ if (pWin->drawable.type != DRAWABLE_WINDOW)
+ return WT_DONTWALKCHILDREN;
+
+ WinPriv = GET_KDXV_WINDOW(pWin);
+
+ while (WinPriv) {
+ if (WinPriv->PortRec->type == XvInputMask)
+ KdXVReputVideo(WinPriv->PortRec);
+ else
+ KdXVRegetVideo(WinPriv->PortRec);
+ WinPriv = WinPriv->next;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static int
+KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
+{
+ KdXVWindowPtr winPriv, PrivRoot;
+
+ winPriv = PrivRoot = GET_KDXV_WINDOW(pWin);
+
+ /* Enlist our port in the window private */
+ while (winPriv) {
+ if (winPriv->PortRec == portPriv) /* we're already listed */
+ break;
+ winPriv = winPriv->next;
+ }
+
+ if (!winPriv) {
+ winPriv = malloc(sizeof(KdXVWindowRec));
+ if (!winPriv)
+ return BadAlloc;
+ winPriv->PortRec = portPriv;
+ winPriv->next = PrivRoot;
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv);
+ }
+ return Success;
+}
+
+static void
+KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
+{
+ KdXVWindowPtr winPriv, prevPriv = NULL;
+
+ winPriv = GET_KDXV_WINDOW(pWin);
+
+ while (winPriv) {
+ if (winPriv->PortRec == portPriv) {
+ if (prevPriv)
+ prevPriv->next = winPriv->next;
+ else
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next);
+ free(winPriv);
+ break;
+ }
+ prevPriv = winPriv;
+ winPriv = winPriv->next;
+ }
+ portPriv->pDraw = NULL;
+}
+
+/**** ScreenRec fields ****/
+
+static Bool
+KdXVCreateWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
+ int ret;
+
+ pScreen->CreateWindow = ScreenPriv->CreateWindow;
+ ret = (*pScreen->CreateWindow) (pWin);
+ pScreen->CreateWindow = KdXVCreateWindow;
+
+ if (ret)
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
+
+ return ret;
+}
+
+static Bool
+KdXVDestroyWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
+ KdXVWindowPtr tmp, WinPriv = GET_KDXV_WINDOW(pWin);
+ int ret;
+
+ while (WinPriv) {
+ XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
+
+ if (pPriv->isOn > XV_OFF) {
+ (*pPriv->AdaptorRec->StopVideo) (pPriv->screen, pPriv->DevPriv.ptr,
+ TRUE);
+ pPriv->isOn = XV_OFF;
+ }
+
+ pPriv->pDraw = NULL;
+ tmp = WinPriv;
+ WinPriv = WinPriv->next;
+ free(tmp);
+ }
+
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
+
+ pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
+ ret = (*pScreen->DestroyWindow) (pWin);
+ pScreen->DestroyWindow = KdXVDestroyWindow;
+
+ return ret;
+}
+
+static void
+KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
+ KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin);
+ KdXVWindowPtr pPrev;
+ XvPortRecPrivatePtr pPriv;
+ Bool AreasExposed;
+
+ AreasExposed = (WinPriv && reg1 && RegionNotEmpty(reg1));
+
+ pScreen->WindowExposures = ScreenPriv->WindowExposures;
+ (*pScreen->WindowExposures) (pWin, reg1, reg2);
+ pScreen->WindowExposures = KdXVWindowExposures;
+
+ /* filter out XClearWindow/Area */
+ if (!pWin->valdata)
+ return;
+
+ pPrev = NULL;
+
+ while (WinPriv) {
+ pPriv = WinPriv->PortRec;
+
+ /* Reput anyone with a reput function */
+
+ switch (pPriv->type) {
+ case XvInputMask:
+ KdXVReputVideo(pPriv);
+ break;
+ case XvOutputMask:
+ KdXVRegetVideo(pPriv);
+ break;
+ default: /* overlaid still/image */
+ if (pPriv->AdaptorRec->ReputImage)
+ KdXVReputImage(pPriv);
+ else if (AreasExposed) {
+ KdXVWindowPtr tmp;
+
+ if (pPriv->isOn == XV_ON) {
+ (*pPriv->AdaptorRec->StopVideo) (pPriv->screen,
+ pPriv->DevPriv.ptr, FALSE);
+ pPriv->isOn = XV_PENDING;
+ }
+ pPriv->pDraw = NULL;
+
+ if (!pPrev)
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey,
+ WinPriv->next);
+ else
+ pPrev->next = WinPriv->next;
+ tmp = WinPriv;
+ WinPriv = WinPriv->next;
+ free(tmp);
+ continue;
+ }
+ break;
+ }
+ pPrev = WinPriv;
+ WinPriv = WinPriv->next;
+ }
+}
+
+static void
+KdXVClipNotify(WindowPtr pWin, int dx, int dy)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
+ KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin);
+ KdXVWindowPtr tmp, pPrev = NULL;
+ XvPortRecPrivatePtr pPriv;
+ Bool visible = (pWin->visibility == VisibilityUnobscured) ||
+ (pWin->visibility == VisibilityPartiallyObscured);
+
+ while (WinPriv) {
+ pPriv = WinPriv->PortRec;
+
+ if (pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ RegionDestroy(pPriv->pCompositeClip);
+
+ pPriv->pCompositeClip = NULL;
+
+ /* Stop everything except images, but stop them too if the
+ window isn't visible. But we only remove the images. */
+
+ if (pPriv->type || !visible) {
+ if (pPriv->isOn == XV_ON) {
+ (*pPriv->AdaptorRec->StopVideo) (pPriv->screen,
+ pPriv->DevPriv.ptr, FALSE);
+ pPriv->isOn = XV_PENDING;
+ }
+
+ if (!pPriv->type) { /* overlaid still/image */
+ pPriv->pDraw = NULL;
+
+ if (!pPrev)
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey,
+ WinPriv->next);
+ else
+ pPrev->next = WinPriv->next;
+ tmp = WinPriv;
+ WinPriv = WinPriv->next;
+ free(tmp);
+ continue;
+ }
+ }
+
+ pPrev = WinPriv;
+ WinPriv = WinPriv->next;
+ }
+
+ if (ScreenPriv->ClipNotify) {
+ pScreen->ClipNotify = ScreenPriv->ClipNotify;
+ (*pScreen->ClipNotify) (pWin, dx, dy);
+ pScreen->ClipNotify = KdXVClipNotify;
+ }
+}
+
+/**** Required XvScreenRec fields ****/
+
+static Bool
+KdXVCloseScreen(int i, ScreenPtr pScreen)
+{
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
+ XvAdaptorPtr pa;
+ int c;
+
+ if (!ScreenPriv)
+ return TRUE;
+
+ pScreen->CreateWindow = ScreenPriv->CreateWindow;
+ pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
+ pScreen->WindowExposures = ScreenPriv->WindowExposures;
+ pScreen->ClipNotify = ScreenPriv->ClipNotify;
+
+/* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
+
+ for (c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
+ KdXVFreeAdaptor(pa);
+ }
+
+ free(pxvs->pAdaptors);
+ free(ScreenPriv);
+
+ return TRUE;
+}
+
+static int
+KdXVQueryAdaptors(ScreenPtr pScreen,
+ XvAdaptorPtr * p_pAdaptors, int *p_nAdaptors)
+{
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+
+ *p_nAdaptors = pxvs->nAdaptors;
+ *p_pAdaptors = pxvs->pAdaptors;
+
+ return Success;
+}
+
+static Bool
+KdXVRunning(ScreenPtr pScreen)
+{
+ return (KdXVGeneration == serverGeneration && GET_XV_SCREEN(pScreen) != 0);
+}
+
+Bool
+KdXVEnable(ScreenPtr pScreen)
+{
+ if (!KdXVRunning(pScreen))
+ return TRUE;
+
+ WalkTree(pScreen, KdXVReputAllVideo, 0);
+
+ return TRUE;
+}
+
+void
+KdXVDisable(ScreenPtr pScreen)
+{
+ XvScreenPtr pxvs;
+ KdXVScreenPtr ScreenPriv;
+ XvAdaptorPtr pAdaptor;
+ XvPortPtr pPort;
+ XvPortRecPrivatePtr pPriv;
+ int i, j;
+
+ if (!KdXVRunning(pScreen))
+ return;
+
+ pxvs = GET_XV_SCREEN(pScreen);
+ ScreenPriv = GET_KDXV_SCREEN(pScreen);
+
+ for (i = 0; i < pxvs->nAdaptors; i++) {
+ pAdaptor = &pxvs->pAdaptors[i];
+ for (j = 0; j < pAdaptor->nPorts; j++) {
+ pPort = &pAdaptor->pPorts[j];
+ pPriv = (XvPortRecPrivatePtr) pPort->devPriv.ptr;
+ if (pPriv->isOn > XV_OFF) {
+
+ (*pPriv->AdaptorRec->StopVideo) (pPriv->screen,
+ pPriv->DevPriv.ptr, TRUE);
+ pPriv->isOn = XV_OFF;
+
+ if (pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ RegionDestroy(pPriv->pCompositeClip);
+
+ pPriv->pCompositeClip = NULL;
+
+ if (!pPriv->type && pPriv->pDraw) { /* still */
+ KdXVRemovePortFromWindow((WindowPtr) pPriv->pDraw, pPriv);
+ }
+ }
+ }
+ }
+}
+
+/**** XvAdaptorRec fields ****/
+
+static int
+KdXVAllocatePort(unsigned long port, XvPortPtr pPort, XvPortPtr * ppPort)
+{
+ *ppPort = pPort;
+ return Success;
+}
+
+static int
+KdXVFreePort(XvPortPtr pPort)
+{
+ return Success;
+}
+
+static int
+KdXVPutVideo(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+
+ KdScreenPriv(portPriv->screen->pScreen);
+ int result;
+
+ /* No dumping video to pixmaps... For now anyhow */
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ pPort->pDraw = (DrawablePtr) NULL;
+ return BadAlloc;
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if (portPriv->pDraw && (portPriv->pDraw != pDraw))
+ KdXVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv);
+
+ /* Register our port with the new window */
+ result = KdXVEnlistPortInWindow((WindowPtr) pDraw, portPriv);
+ if (result != Success)
+ return result;
+
+ portPriv->pDraw = pDraw;
+ portPriv->type = XvInputMask;
+
+ /* save a copy of these parameters */
+ portPriv->vid_x = vid_x;
+ portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w;
+ portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x;
+ portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w;
+ portPriv->drw_h = drw_h;
+
+ /* make sure we have the most recent copy of the clientClip */
+ KdXVCopyClip(portPriv, pGC);
+
+ /* To indicate to the DI layer that we were successful */
+ pPort->pDraw = pDraw;
+
+ if (!pScreenPriv->enabled)
+ return Success;
+
+ return (KdXVReputVideo(portPriv));
+}
+
+static int
+KdXVPutStill(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ ScreenPtr pScreen = pDraw->pScreen;
+
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if (!pScreenPriv->enabled)
+ return Success;
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionInit(&ClipRegion, NullBox, 1);
+ RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = 0;
+ VPBox.y1 = 0;
+ VPBox.x2 = screen->width;
+ VPBox.y2 = screen->height;
+
+ RegionInit(&VPReg, &VPBox, 1);
+ RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
+ RegionUninit(&VPReg);
+ }
+
+ if (portPriv->pDraw) {
+ KdXVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv);
+ }
+
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto PUT_STILL_BAILOUT;
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = RegionRects(&ClipRegion);
+
+ if ((RegionNumRects(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
+ clippedAway = TRUE;
+ goto PUT_STILL_BAILOUT;
+ }
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutStill) (portPriv->screen, pDraw,
+ vid_x, vid_y, WinBox.x1, WinBox.y1,
+ vid_w, vid_h, drw_w, drw_h,
+ &ClipRegion,
+ portPriv->DevPriv.ptr);
+
+ if ((ret == Success) &&
+ (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) {
+
+ KdXVEnlistPortInWindow((WindowPtr) pDraw, portPriv);
+ portPriv->isOn = XV_ON;
+ portPriv->pDraw = pDraw;
+ portPriv->drw_x = drw_x;
+ portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w;
+ portPriv->drw_h = drw_h;
+ portPriv->type = 0; /* no mask means it's transient and should
+ not be reput once it's removed */
+ pPort->pDraw = pDraw; /* make sure we can get stop requests */
+ }
+
+ PUT_STILL_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->screen,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
+}
+
+static int
+KdXVGetVideo(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ int result;
+
+ KdScreenPriv(portPriv->screen->pScreen);
+
+ /* No pixmaps... For now anyhow */
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ pPort->pDraw = (DrawablePtr) NULL;
+ return BadAlloc;
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if (portPriv->pDraw && (portPriv->pDraw != pDraw))
+ KdXVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv);
+
+ /* Register our port with the new window */
+ result = KdXVEnlistPortInWindow((WindowPtr) pDraw, portPriv);
+ if (result != Success)
+ return result;
+
+ portPriv->pDraw = pDraw;
+ portPriv->type = XvOutputMask;
+
+ /* save a copy of these parameters */
+ portPriv->vid_x = vid_x;
+ portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w;
+ portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x;
+ portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w;
+ portPriv->drw_h = drw_h;
+
+ /* make sure we have the most recent copy of the clientClip */
+ KdXVCopyClip(portPriv, pGC);
+
+ /* To indicate to the DI layer that we were successful */
+ pPort->pDraw = pDraw;
+
+ if (!pScreenPriv->enabled)
+ return Success;
+
+ return (KdXVRegetVideo(portPriv));
+}
+
+static int
+KdXVGetStill(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ ScreenPtr pScreen = pDraw->pScreen;
+
+ KdScreenPriv(pScreen);
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if (!pScreenPriv->enabled)
+ return Success;
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionInit(&ClipRegion, NullBox, 1);
+ RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if (portPriv->pDraw) {
+ KdXVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv);
+ }
+
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto GET_STILL_BAILOUT;
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->GetStill) (portPriv->screen, pDraw,
+ vid_x, vid_y, WinBox.x1, WinBox.y1,
+ vid_w, vid_h, drw_w, drw_h,
+ &ClipRegion,
+ portPriv->DevPriv.ptr);
+
+ GET_STILL_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->screen,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
+}
+
+static int
+KdXVStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+
+ KdScreenPriv(portPriv->screen->pScreen);
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ KdXVRemovePortFromWindow((WindowPtr) pDraw, portPriv);
+
+ if (!pScreenPriv->enabled)
+ return Success;
+
+ /* Must free resources. */
+
+ if (portPriv->isOn > XV_OFF) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->screen,
+ portPriv->DevPriv.ptr, TRUE);
+ portPriv->isOn = XV_OFF;
+ }
+
+ return Success;
+}
+
+static int
+KdXVSetPortAttribute(ClientPtr client,
+ XvPortPtr pPort, Atom attribute, INT32 value)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+
+ return ((*portPriv->AdaptorRec->SetPortAttribute) (portPriv->screen,
+ attribute, value,
+ portPriv->DevPriv.ptr));
+}
+
+static int
+KdXVGetPortAttribute(ClientPtr client,
+ XvPortPtr pPort, Atom attribute, INT32 *p_value)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+
+ return ((*portPriv->AdaptorRec->GetPortAttribute) (portPriv->screen,
+ attribute,
+ (int *) p_value,
+ portPriv->DevPriv.ptr));
+}
+
+static int
+KdXVQueryBestSize(ClientPtr client,
+ XvPortPtr pPort,
+ CARD8 motion,
+ CARD16 vid_w, CARD16 vid_h,
+ CARD16 drw_w, CARD16 drw_h,
+ unsigned int *p_w, unsigned int *p_h)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+
+ (*portPriv->AdaptorRec->QueryBestSize) (portPriv->screen,
+ (Bool) motion, vid_w, vid_h, drw_w,
+ drw_h, p_w, p_h,
+ portPriv->DevPriv.ptr);
+
+ return Success;
+}
+
+static int
+KdXVPutImage(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 src_x, INT16 src_y,
+ CARD16 src_w, CARD16 src_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h,
+ XvImagePtr format,
+ unsigned char *data, Bool sync, CARD16 width, CARD16 height)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ ScreenPtr pScreen = pDraw->pScreen;
+
+ KdScreenPriv(pScreen);
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if (!pScreenPriv->enabled)
+ return Success;
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionInit(&ClipRegion, NullBox, 1);
+ RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = 0;
+ VPBox.y1 = 0;
+ VPBox.x2 = pScreen->width;
+ VPBox.y2 = pScreen->height;
+
+ RegionInit(&VPReg, &VPBox, 1);
+ RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
+ RegionUninit(&VPReg);
+ }
+
+ if (portPriv->pDraw) {
+ KdXVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv);
+ }
+
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto PUT_IMAGE_BAILOUT;
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = RegionRects(&ClipRegion);
+
+ if ((RegionNumRects(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
+ clippedAway = TRUE;
+ goto PUT_IMAGE_BAILOUT;
+ }
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutImage) (portPriv->screen, pDraw,
+ src_x, src_y, WinBox.x1, WinBox.y1,
+ src_w, src_h, drw_w, drw_h,
+ format->id, data, width, height,
+ sync, &ClipRegion,
+ portPriv->DevPriv.ptr);
+
+ if ((ret == Success) &&
+ (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
+
+ KdXVEnlistPortInWindow((WindowPtr) pDraw, portPriv);
+ portPriv->isOn = XV_ON;
+ portPriv->pDraw = pDraw;
+ portPriv->drw_x = drw_x;
+ portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w;
+ portPriv->drw_h = drw_h;
+ portPriv->type = 0; /* no mask means it's transient and should
+ not be reput once it's removed */
+ pPort->pDraw = pDraw; /* make sure we can get stop requests */
+ }
+
+ PUT_IMAGE_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->screen,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
+}
+
+static int
+KdXVQueryImageAttributes(ClientPtr client,
+ XvPortPtr pPort,
+ XvImagePtr format,
+ CARD16 *width,
+ CARD16 *height, int *pitches, int *offsets)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+
+ return (*portPriv->AdaptorRec->QueryImageAttributes) (portPriv->screen,
+ format->id, width,
+ height, pitches,
+ offsets);
+}
+
+/**************** Common video manipulation functions *******************/
+
+void
+KdXVCopyPackedData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr,
+ int srcPitch, int dstPitch, int srcW, int srcH, int top,
+ int left, int h, int w)
+{
+ int srcDown = srcPitch, srcRight = 2, srcNext;
+ int p;
+
+ switch (randr & RR_Rotate_All) {
+ case RR_Rotate_0:
+ srcDown = srcPitch;
+ srcRight = 2;
+ break;
+ case RR_Rotate_90:
+ src += (srcH - 1) * 2;
+ srcDown = -2;
+ srcRight = srcPitch;
+ break;
+ case RR_Rotate_180:
+ src += srcPitch * (srcH - 1) + (srcW - 1) * 2;
+ srcDown = -srcPitch;
+ srcRight = -2;
+ break;
+ case RR_Rotate_270:
+ src += srcPitch * (srcW - 1);
+ srcDown = 2;
+ srcRight = -srcPitch;
+ break;
+ }
+
+ src = src + top * srcDown + left * srcRight;
+
+ w >>= 1;
+ /* srcRight >>= 1; */
+ srcNext = srcRight >> 1;
+ while (h--) {
+ CARD16 *s = (CARD16 *) src;
+ CARD32 *d = (CARD32 *) dst;
+
+ p = w;
+ while (p--) {
+ *d++ = s[0] | (s[srcNext] << 16);
+ s += srcRight;
+ }
+ src += srcPitch;
+ dst += dstPitch;
+ }
+}
+
+void
+KdXVCopyPlanarData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr,
+ int srcPitch, int srcPitch2, int dstPitch, int srcW,
+ int srcH, int height, int top, int left, int h, int w,
+ int id)
+{
+ int i, j;
+ CARD8 *src1, *src2, *src3, *dst1;
+ int srcDown = srcPitch, srcDown2 = srcPitch2;
+ int srcRight = 2, srcRight2 = 1, srcNext = 1;
+
+ /* compute source data pointers */
+ src1 = src;
+ src2 = src1 + height * srcPitch;
+ src3 = src2 + (height >> 1) * srcPitch2;
+ switch (randr & RR_Rotate_All) {
+ case RR_Rotate_0:
+ srcDown = srcPitch;
+ srcDown2 = srcPitch2;
+ srcRight = 2;
+ srcRight2 = 1;
+ srcNext = 1;
+ break;
+ case RR_Rotate_90:
+ src1 = src1 + srcH - 1;
+ src2 = src2 + (srcH >> 1) - 1;
+ src3 = src3 + (srcH >> 1) - 1;
+ srcDown = -1;
+ srcDown2 = -1;
+ srcRight = srcPitch * 2;
+ srcRight2 = srcPitch2;
+ srcNext = srcPitch;
+ break;
+ case RR_Rotate_180:
+ src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1);
+ src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
+ src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
+ srcDown = -srcPitch;
+ srcDown2 = -srcPitch2;
+ srcRight = -2;
+ srcRight2 = -1;
+ srcNext = -1;
+ break;
+ case RR_Rotate_270:
+ src1 = src1 + srcPitch * (srcW - 1);
+ src2 = src2 + srcPitch2 * ((srcW >> 1) - 1);
+ src3 = src3 + srcPitch2 * ((srcW >> 1) - 1);
+ srcDown = 1;
+ srcDown2 = 1;
+ srcRight = -srcPitch * 2;
+ srcRight2 = -srcPitch2;
+ srcNext = -srcPitch;
+ break;
+ }
+
+ /* adjust for origin */
+ src1 += top * srcDown + left * srcNext;
+ src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
+ src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
+
+ if (id == FOURCC_I420) {
+ CARD8 *srct = src2;
+
+ src2 = src3;
+ src3 = srct;
+ }
+
+ dst1 = dst;
+
+ w >>= 1;
+ for (j = 0; j < h; j++) {
+ CARD32 *dst = (CARD32 *) dst1;
+ CARD8 *s1l = src1;
+ CARD8 *s1r = src1 + srcNext;
+ CARD8 *s2 = src2;
+ CARD8 *s3 = src3;
+
+ for (i = 0; i < w; i++) {
+ *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24);
+ s1l += srcRight;
+ s1r += srcRight;
+ s2 += srcRight2;
+ s3 += srcRight2;
+ }
+ src1 += srcDown;
+ dst1 += dstPitch;
+ if (j & 1) {
+ src2 += srcDown2;
+ src3 += srcDown2;
+ }
+ }
+}
+
+void
+KXVPaintRegion(DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
+{
+ GCPtr pGC;
+ ChangeGCVal val[2];
+ xRectangle *rects, *r;
+ BoxPtr pBox = RegionRects(pRgn);
+ int nBox = RegionNumRects(pRgn);
+
+ rects = malloc(nBox * sizeof(xRectangle));
+ if (!rects)
+ goto bail0;
+ r = rects;
+ while (nBox--) {
+ r->x = pBox->x1 - pDraw->x;
+ r->y = pBox->y1 - pDraw->y;
+ r->width = pBox->x2 - pBox->x1;
+ r->height = pBox->y2 - pBox->y1;
+ r++;
+ pBox++;
+ }
+
+ pGC = GetScratchGC(pDraw->depth, pDraw->pScreen);
+ if (!pGC)
+ goto bail1;
+
+ val[0].val = fg;
+ val[1].val = IncludeInferiors;
+ ChangeGC(NullClient, pGC, GCForeground | GCSubwindowMode, val);
+
+ ValidateGC(pDraw, pGC);
+
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, RegionNumRects(pRgn), rects);
+
+ FreeScratchGC(pGC);
+ bail1:
+ free(rects);
+ bail0:
+ ;
+}
diff --git a/xorg-server/hw/kdrive/src/kxv.h b/xorg-server/hw/kdrive/src/kxv.h
index 21a295be3..29118bc96 100644
--- a/xorg-server/hw/kdrive/src/kxv.h
+++ b/xorg-server/hw/kdrive/src/kxv.h
@@ -57,80 +57,86 @@ of the copyright holder.
#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
typedef struct {
- int id;
- int type;
- int byte_order;
- unsigned char guid[16];
- int bits_per_pixel;
- int format;
- int num_planes;
-
- /* for RGB formats only */
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
-
- /* for YUV formats only */
- unsigned int y_sample_bits;
- unsigned int u_sample_bits;
- unsigned int v_sample_bits;
- unsigned int horz_y_period;
- unsigned int horz_u_period;
- unsigned int horz_v_period;
- unsigned int vert_y_period;
- unsigned int vert_u_period;
- unsigned int vert_v_period;
- char component_order[32];
- int scanline_order;
+ int id;
+ int type;
+ int byte_order;
+ unsigned char guid[16];
+ int bits_per_pixel;
+ int format;
+ int num_planes;
+
+ /* for RGB formats only */
+ int depth;
+ unsigned int red_mask;
+ unsigned int green_mask;
+ unsigned int blue_mask;
+
+ /* for YUV formats only */
+ unsigned int y_sample_bits;
+ unsigned int u_sample_bits;
+ unsigned int v_sample_bits;
+ unsigned int horz_y_period;
+ unsigned int horz_u_period;
+ unsigned int horz_v_period;
+ unsigned int vert_y_period;
+ unsigned int vert_u_period;
+ unsigned int vert_v_period;
+ char component_order[32];
+ int scanline_order;
} KdImageRec, *KdImagePtr;
-
typedef struct {
- KdScreenInfo * screen;
- int id;
- unsigned short width, height;
- int *pitches; /* bytes */
- int *offsets; /* in bytes from start of framebuffer */
- DevUnion devPrivate;
+ KdScreenInfo *screen;
+ int id;
+ unsigned short width, height;
+ int *pitches; /* bytes */
+ int *offsets; /* in bytes from start of framebuffer */
+ DevUnion devPrivate;
} KdSurfaceRec, *KdSurfacePtr;
-
-typedef int (* PutVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef int (* PutStillFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef int (* GetVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef int (* GetStillFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data );
-typedef void (* StopVideoFuncPtr)(KdScreenInfo * screen, pointer data, Bool Exit);
-typedef int (* SetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
- int value, pointer data);
-typedef int (* GetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
- int *value, pointer data);
-typedef void (* QueryBestSizeFuncPtr)(KdScreenInfo * screen, Bool motion,
- short vid_w, short vid_h, short drw_w, short drw_h,
- unsigned int *p_w, unsigned int *p_h, pointer data);
-typedef int (* PutImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short src_x, short src_y, short drw_x, short drw_y,
- short src_w, short src_h, short drw_w, short drw_h,
- int image, unsigned char* buf, short width, short height, Bool Sync,
- RegionPtr clipBoxes, pointer data );
-typedef int (* ReputImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
- short drw_x, short drw_y,
- RegionPtr clipBoxes, pointer data );
-typedef int (*QueryImageAttributesFuncPtr)(KdScreenInfo * screen,
- int image, unsigned short *width, unsigned short *height,
- int *pitches, int *offsets);
+typedef int (*PutVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
+ short vid_x, short vid_y, short drw_x,
+ short drw_y, short vid_w, short vid_h,
+ short drw_w, short drw_h, RegionPtr clipBoxes,
+ pointer data);
+typedef int (*PutStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
+ short vid_x, short vid_y, short drw_x,
+ short drw_y, short vid_w, short vid_h,
+ short drw_w, short drw_h, RegionPtr clipBoxes,
+ pointer data);
+typedef int (*GetVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
+ short vid_x, short vid_y, short drw_x,
+ short drw_y, short vid_w, short vid_h,
+ short drw_w, short drw_h, RegionPtr clipBoxes,
+ pointer data);
+typedef int (*GetStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
+ short vid_x, short vid_y, short drw_x,
+ short drw_y, short vid_w, short vid_h,
+ short drw_w, short drw_h, RegionPtr clipBoxes,
+ pointer data);
+typedef void (*StopVideoFuncPtr) (KdScreenInfo * screen, pointer data,
+ Bool Exit);
+typedef int (*SetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute,
+ int value, pointer data);
+typedef int (*GetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute,
+ int *value, pointer data);
+typedef void (*QueryBestSizeFuncPtr) (KdScreenInfo * screen, Bool motion,
+ short vid_w, short vid_h, short drw_w,
+ short drw_h, unsigned int *p_w,
+ unsigned int *p_h, pointer data);
+typedef int (*PutImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
+ short src_x, short src_y, short drw_x,
+ short drw_y, short src_w, short src_h,
+ short drw_w, short drw_h, int image,
+ unsigned char *buf, short width, short height,
+ Bool Sync, RegionPtr clipBoxes, pointer data);
+typedef int (*ReputImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
+ short drw_x, short drw_y, RegionPtr clipBoxes,
+ pointer data);
+typedef int (*QueryImageAttributesFuncPtr) (KdScreenInfo * screen, int image,
+ unsigned short *width,
+ unsigned short *height,
+ int *pitches, int *offsets);
typedef enum {
XV_OFF,
@@ -141,84 +147,78 @@ typedef enum {
/*** this is what the driver needs to fill out ***/
typedef struct {
- int id;
- char *name;
- unsigned short width, height;
- XvRationalRec rate;
+ int id;
+ char *name;
+ unsigned short width, height;
+ XvRationalRec rate;
} KdVideoEncodingRec, *KdVideoEncodingPtr;
typedef struct {
- char depth;
- short class;
+ char depth;
+ short class;
} KdVideoFormatRec, *KdVideoFormatPtr;
typedef struct {
- int flags;
- int min_value;
- int max_value;
- char *name;
+ int flags;
+ int min_value;
+ int max_value;
+ char *name;
} KdAttributeRec, *KdAttributePtr;
typedef struct {
- unsigned int type;
- int flags;
- char *name;
- int nEncodings;
- KdVideoEncodingPtr pEncodings;
- int nFormats;
- KdVideoFormatPtr pFormats;
- int nPorts;
- DevUnion *pPortPrivates;
- int nAttributes;
- KdAttributePtr pAttributes;
- int nImages;
- KdImagePtr pImages;
- PutVideoFuncPtr PutVideo;
- PutStillFuncPtr PutStill;
- GetVideoFuncPtr GetVideo;
- GetStillFuncPtr GetStill;
- StopVideoFuncPtr StopVideo;
- SetPortAttributeFuncPtr SetPortAttribute;
- GetPortAttributeFuncPtr GetPortAttribute;
- QueryBestSizeFuncPtr QueryBestSize;
- PutImageFuncPtr PutImage;
- ReputImageFuncPtr ReputImage;
- QueryImageAttributesFuncPtr QueryImageAttributes;
+ unsigned int type;
+ int flags;
+ char *name;
+ int nEncodings;
+ KdVideoEncodingPtr pEncodings;
+ int nFormats;
+ KdVideoFormatPtr pFormats;
+ int nPorts;
+ DevUnion *pPortPrivates;
+ int nAttributes;
+ KdAttributePtr pAttributes;
+ int nImages;
+ KdImagePtr pImages;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+ PutImageFuncPtr PutImage;
+ ReputImageFuncPtr ReputImage;
+ QueryImageAttributesFuncPtr QueryImageAttributes;
} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
Bool
-KdXVScreenInit(
- ScreenPtr pScreen,
- KdVideoAdaptorPtr *Adaptors,
- int num
-);
+ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * Adaptors, int num);
-typedef int (* KdXVInitGenericAdaptorPtr)(KdScreenInfo * screen,
- KdVideoAdaptorPtr **Adaptors);
+typedef int (*KdXVInitGenericAdaptorPtr) (KdScreenInfo * screen,
+ KdVideoAdaptorPtr ** Adaptors);
int
-KdXVRegisterGenericAdaptorDriver(
- KdXVInitGenericAdaptorPtr InitFunc
-);
+ KdXVRegisterGenericAdaptorDriver(KdXVInitGenericAdaptorPtr InitFunc);
int
-KdXVListGenericAdaptors(
- KdScreenInfo * screen,
- KdVideoAdaptorPtr **Adaptors
-);
+ KdXVListGenericAdaptors(KdScreenInfo * screen, KdVideoAdaptorPtr ** Adaptors);
void
-KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
- int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,
- int h, int w);
+
+KdXVCopyPackedData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr,
+ int srcPitch, int dstPitch, int srcW, int srcH, int top,
+ int left, int h, int w);
void
-KdXVCopyPlanarData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
- int srcPitch, int srcPitch2, int dstPitch, int srcW, int srcH, int height,
- int top, int left, int h, int w, int id);
+
+KdXVCopyPlanarData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr,
+ int srcPitch, int srcPitch2, int dstPitch, int srcW,
+ int srcH, int height, int top, int left, int h, int w,
+ int id);
void
-KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg);
+ KXVPaintRegion(DrawablePtr pDraw, RegionPtr pRgn, Pixel fg);
KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen);
@@ -230,50 +230,48 @@ void KdXVDisable(ScreenPtr);
/*** These are DDX layer privates ***/
-
typedef struct {
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- ClipNotifyProcPtr ClipNotify;
- WindowExposuresProcPtr WindowExposures;
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ ClipNotifyProcPtr ClipNotify;
+ WindowExposuresProcPtr WindowExposures;
} KdXVScreenRec, *KdXVScreenPtr;
typedef struct {
- int flags;
- PutVideoFuncPtr PutVideo;
- PutStillFuncPtr PutStill;
- GetVideoFuncPtr GetVideo;
- GetStillFuncPtr GetStill;
- StopVideoFuncPtr StopVideo;
- SetPortAttributeFuncPtr SetPortAttribute;
- GetPortAttributeFuncPtr GetPortAttribute;
- QueryBestSizeFuncPtr QueryBestSize;
- PutImageFuncPtr PutImage;
- ReputImageFuncPtr ReputImage;
- QueryImageAttributesFuncPtr QueryImageAttributes;
+ int flags;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+ PutImageFuncPtr PutImage;
+ ReputImageFuncPtr ReputImage;
+ QueryImageAttributesFuncPtr QueryImageAttributes;
} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
typedef struct {
- KdScreenInfo * screen;
- DrawablePtr pDraw;
- unsigned char type;
- unsigned int subWindowMode;
- DDXPointRec clipOrg;
- RegionPtr clientClip;
- RegionPtr pCompositeClip;
- Bool FreeCompositeClip;
- XvAdaptorRecPrivatePtr AdaptorRec;
- XvStatus isOn;
- Bool moved;
- int vid_x, vid_y, vid_w, vid_h;
- int drw_x, drw_y, drw_w, drw_h;
- DevUnion DevPriv;
+ KdScreenInfo *screen;
+ DrawablePtr pDraw;
+ unsigned char type;
+ unsigned int subWindowMode;
+ DDXPointRec clipOrg;
+ RegionPtr clientClip;
+ RegionPtr pCompositeClip;
+ Bool FreeCompositeClip;
+ XvAdaptorRecPrivatePtr AdaptorRec;
+ XvStatus isOn;
+ Bool moved;
+ int vid_x, vid_y, vid_w, vid_h;
+ int drw_x, drw_y, drw_w, drw_h;
+ DevUnion DevPriv;
} XvPortRecPrivate, *XvPortRecPrivatePtr;
-typedef struct _KdXVWindowRec{
- XvPortRecPrivatePtr PortRec;
- struct _KdXVWindowRec *next;
+typedef struct _KdXVWindowRec {
+ XvPortRecPrivatePtr PortRec;
+ struct _KdXVWindowRec *next;
} KdXVWindowRec, *KdXVWindowPtr;
-#endif /* _XVDIX_H_ */
-
+#endif /* _XVDIX_H_ */
diff --git a/xorg-server/hw/vfb/InitInput.c b/xorg-server/hw/vfb/InitInput.c
index 8836bbd7f..9d0fd9866 100644
--- a/xorg-server/hw/vfb/InitInput.c
+++ b/xorg-server/hw/vfb/InitInput.c
@@ -56,7 +56,8 @@ ProcessInputEvents(void)
mieqProcessInputEvents();
}
-void DDXRingBell(int volume, int pitch, int duration)
+void
+DDXRingBell(int volume, int pitch, int duration)
{
}
@@ -66,21 +67,20 @@ void DDXRingBell(int volume, int pitch, int duration)
static int
vfbKeybdProc(DeviceIntPtr pDevice, int onoff)
{
- DevicePtr pDev = (DevicePtr)pDevice;
+ DevicePtr pDev = (DevicePtr) pDevice;
- switch (onoff)
- {
+ switch (onoff) {
case DEVICE_INIT:
- InitKeyboardDeviceStruct(pDevice, NULL, NULL, NULL);
+ InitKeyboardDeviceStruct(pDevice, NULL, NULL, NULL);
break;
case DEVICE_ON:
- pDev->on = TRUE;
- break;
+ pDev->on = TRUE;
+ break;
case DEVICE_OFF:
- pDev->on = FALSE;
- break;
+ pDev->on = FALSE;
+ break;
case DEVICE_CLOSE:
- break;
+ break;
}
return Success;
}
@@ -92,38 +92,38 @@ vfbMouseProc(DeviceIntPtr pDevice, int onoff)
#define NAXES 2
BYTE map[NBUTTONS + 1];
- DevicePtr pDev = (DevicePtr)pDevice;
- Atom btn_labels[NBUTTONS] = {0};
- Atom axes_labels[NAXES] = {0};
+ DevicePtr pDev = (DevicePtr) pDevice;
+ Atom btn_labels[NBUTTONS] = { 0 };
+ Atom axes_labels[NAXES] = { 0 };
- switch (onoff)
- {
+ switch (onoff) {
case DEVICE_INIT:
- map[1] = 1;
- map[2] = 2;
- map[3] = 3;
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
- btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
- btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
- btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
- InitPointerDeviceStruct(pDev, map, NBUTTONS, btn_labels,
- (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), NAXES, axes_labels);
- break;
+ InitPointerDeviceStruct(pDev, map, NBUTTONS, btn_labels,
+ (PtrCtrlProcPtr) NoopDDA,
+ GetMotionHistorySize(), NAXES, axes_labels);
+ break;
case DEVICE_ON:
- pDev->on = TRUE;
+ pDev->on = TRUE;
break;
case DEVICE_OFF:
- pDev->on = FALSE;
- break;
+ pDev->on = FALSE;
+ break;
case DEVICE_CLOSE:
- break;
+ break;
}
return Success;
@@ -136,17 +136,18 @@ InitInput(int argc, char *argv[])
{
DeviceIntPtr p, k;
Atom xiclass;
+
p = AddInputDevice(serverClient, vfbMouseProc, TRUE);
k = AddInputDevice(serverClient, vfbKeybdProc, TRUE);
xiclass = MakeAtom(XI_MOUSE, sizeof(XI_MOUSE) - 1, TRUE);
AssignTypeAndName(p, xiclass, "Xvfb mouse");
xiclass = MakeAtom(XI_KEYBOARD, sizeof(XI_KEYBOARD) - 1, TRUE);
AssignTypeAndName(k, xiclass, "Xvfb keyboard");
- (void)mieqInit();
+ (void) mieqInit();
}
void
-CloseInput (void)
+CloseInput(void)
{
mieqFini();
}
diff --git a/xorg-server/hw/vfb/InitOutput.c b/xorg-server/hw/vfb/InitOutput.c
index e1af5a471..2d679a559 100644
--- a/xorg-server/hw/vfb/InitOutput.c
+++ b/xorg-server/hw/vfb/InitOutput.c
@@ -53,7 +53,7 @@ from The Open Group.
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
-#endif /* HAVE_MMAP */
+#endif /* HAVE_MMAP */
#include <sys/stat.h>
#include <errno.h>
#ifndef WIN32
@@ -63,7 +63,7 @@ from The Open Group.
#ifdef HAS_SHM
#include <sys/ipc.h>
#include <sys/shm.h>
-#endif /* HAS_SHM */
+#endif /* HAS_SHM */
#include "dix.h"
#include "miline.h"
@@ -75,8 +75,7 @@ from The Open Group.
#define VFB_DEFAULT_LINEBIAS 0
#define XWD_WINDOW_NAME_LEN 60
-typedef struct
-{
+typedef struct {
int width;
int paddedBytesWidth;
int paddedWidth;
@@ -105,15 +104,18 @@ typedef struct
static int vfbNumScreens;
static vfbScreenInfo *vfbScreens;
+
static vfbScreenInfo defaultScreenInfo = {
- .width = VFB_DEFAULT_WIDTH,
+ .width = VFB_DEFAULT_WIDTH,
.height = VFB_DEFAULT_HEIGHT,
- .depth = VFB_DEFAULT_DEPTH,
+ .depth = VFB_DEFAULT_DEPTH,
.blackPixel = VFB_DEFAULT_BLACKPIXEL,
.whitePixel = VFB_DEFAULT_WHITEPIXEL,
.lineBias = VFB_DEFAULT_LINEBIAS,
};
+
static Bool vfbPixmapDepths[33];
+
#ifdef HAVE_MMAP
static char *pfbdir = NULL;
#endif
@@ -130,23 +132,27 @@ static Bool Render = TRUE;
if (needswap) { CARD32 _s = _src; cpswapl(_s, _dst); } \
else _dst = _src;
-
static void
vfbInitializePixmapDepths(void)
{
int i;
- vfbPixmapDepths[1] = TRUE; /* always need bitmaps */
+
+ vfbPixmapDepths[1] = TRUE; /* always need bitmaps */
for (i = 2; i <= 32; i++)
- vfbPixmapDepths[i] = FALSE;
+ vfbPixmapDepths[i] = FALSE;
}
static int
vfbBitsPerPixel(int depth)
{
- if (depth == 1) return 1;
- else if (depth <= 8) return 8;
- else if (depth <= 16) return 16;
- else return 32;
+ if (depth == 1)
+ return 1;
+ else if (depth <= 8)
+ return 8;
+ else if (depth <= 16)
+ return 16;
+ else
+ return 32;
}
void
@@ -156,47 +162,41 @@ ddxGiveUp(enum ExitCode error)
/* clean up the framebuffers */
- switch (fbmemtype)
- {
+ switch (fbmemtype) {
#ifdef HAVE_MMAP
- case MMAPPED_FILE_FB:
- for (i = 0; i < vfbNumScreens; i++)
- {
- if (-1 == unlink(vfbScreens[i].mmap_file))
- {
- perror("unlink");
- ErrorF("unlink %s failed, %s",
- vfbScreens[i].mmap_file, strerror(errno));
- }
- }
- break;
-#else /* HAVE_MMAP */
+ case MMAPPED_FILE_FB:
+ for (i = 0; i < vfbNumScreens; i++) {
+ if (-1 == unlink(vfbScreens[i].mmap_file)) {
+ perror("unlink");
+ ErrorF("unlink %s failed, %s",
+ vfbScreens[i].mmap_file, strerror(errno));
+ }
+ }
+ break;
+#else /* HAVE_MMAP */
case MMAPPED_FILE_FB:
break;
-#endif /* HAVE_MMAP */
-
+#endif /* HAVE_MMAP */
+
#ifdef HAS_SHM
case SHARED_MEMORY_FB:
- for (i = 0; i < vfbNumScreens; i++)
- {
- if (-1 == shmdt((char *)vfbScreens[i].pXWDHeader))
- {
- perror("shmdt");
- ErrorF("shmdt failed, %s", strerror(errno));
- }
- }
- break;
-#else /* HAS_SHM */
+ for (i = 0; i < vfbNumScreens; i++) {
+ if (-1 == shmdt((char *) vfbScreens[i].pXWDHeader)) {
+ perror("shmdt");
+ ErrorF("shmdt failed, %s", strerror(errno));
+ }
+ }
+ break;
+#else /* HAS_SHM */
case SHARED_MEMORY_FB:
break;
-#endif /* HAS_SHM */
-
+#endif /* HAS_SHM */
+
case NORMAL_MEMORY_FB:
- for (i = 0; i < vfbNumScreens; i++)
- {
- free(vfbScreens[i].pXWDHeader);
- }
- break;
+ for (i = 0; i < vfbNumScreens; i++) {
+ free(vfbScreens[i].pXWDHeader);
+ }
+ break;
}
}
@@ -224,7 +224,8 @@ OsVendorFatalError(void)
}
#if defined(DDXBEFORERESET)
-void ddxBeforeReset(void)
+void
+ddxBeforeReset(void)
{
return;
}
@@ -236,13 +237,14 @@ ddxUseMsg(void)
ErrorF("-screen scrn WxHxD set screen's width, height, depth\n");
ErrorF("-pixdepths list-of-int support given pixmap depths\n");
ErrorF("+/-render turn on/off RENDER extension support"
- "(default on)\n");
+ "(default on)\n");
ErrorF("-linebias n adjust thin line pixelization\n");
ErrorF("-blackpixel n pixel value for black\n");
ErrorF("-whitepixel n pixel value for white\n");
#ifdef HAVE_MMAP
- ErrorF("-fbdir directory put framebuffers in mmap'ed files in directory\n");
+ ErrorF
+ ("-fbdir directory put framebuffers in mmap'ed files in directory\n");
#endif
#ifdef HAS_SHM
@@ -257,16 +259,15 @@ ddxProcessArgument(int argc, char *argv[], int i)
static int lastScreen = -1;
vfbScreenInfo *currentScreen;
- if (firstTime)
- {
- vfbInitializePixmapDepths();
+ if (firstTime) {
+ vfbInitializePixmapDepths();
firstTime = FALSE;
}
if (lastScreen == -1)
- currentScreen = &defaultScreenInfo;
+ currentScreen = &defaultScreenInfo;
else
- currentScreen = &vfbScreens[lastScreen];
+ currentScreen = &vfbScreens[lastScreen];
#define CHECK_FOR_REQUIRED_ARGUMENTS(num) \
if (((i + num) >= argc) || (!argv[i + num])) { \
@@ -274,117 +275,105 @@ ddxProcessArgument(int argc, char *argv[], int i)
UseMsg(); \
FatalError("Required argument to %s not specified\n", argv[i]); \
}
-
- if (strcmp (argv[i], "-screen") == 0) /* -screen n WxHxD */
- {
- int screenNum;
- CHECK_FOR_REQUIRED_ARGUMENTS(2);
- screenNum = atoi(argv[i+1]);
- /* The protocol only has a CARD8 for number of screens in the
- connection setup block, so don't allow more than that. */
- if ((screenNum < 0) || (screenNum >= 255))
- {
- ErrorF("Invalid screen number %d\n", screenNum);
- UseMsg();
- FatalError("Invalid screen number %d passed to -screen\n",
- screenNum);
- }
-
- if (vfbNumScreens <= screenNum)
- {
- vfbScreens = realloc(vfbScreens, sizeof(*vfbScreens) * (screenNum + 1));
- if (!vfbScreens)
- FatalError("Not enough memory for screen %d\n", screenNum);
- for (; vfbNumScreens <= screenNum; ++vfbNumScreens)
- vfbScreens[vfbNumScreens] = defaultScreenInfo;
- }
-
- if (3 != sscanf(argv[i+2], "%dx%dx%d",
- &vfbScreens[screenNum].width,
- &vfbScreens[screenNum].height,
- &vfbScreens[screenNum].depth))
- {
- ErrorF("Invalid screen configuration %s\n", argv[i+2]);
- UseMsg();
- FatalError("Invalid screen configuration %s for -screen %d\n",
- argv[i+2], screenNum);
- }
-
- lastScreen = screenNum;
- return 3;
- }
-
- if (strcmp (argv[i], "-pixdepths") == 0) /* -pixdepths list-of-depth */
- {
- int depth, ret = 1;
-
- CHECK_FOR_REQUIRED_ARGUMENTS(1);
- while ((++i < argc) && (depth = atoi(argv[i])) != 0)
- {
- if (depth < 0 || depth > 32)
- {
- ErrorF("Invalid pixmap depth %d\n", depth);
- UseMsg();
- FatalError("Invalid pixmap depth %d passed to -pixdepths\n",
- depth);
- }
- vfbPixmapDepths[depth] = TRUE;
- ret++;
- }
- return ret;
- }
-
- if (strcmp (argv[i], "+render") == 0) /* +render */
- {
- Render = TRUE;
- return 1;
- }
-
- if (strcmp (argv[i], "-render") == 0) /* -render */
- {
- Render = FALSE;
+
+ if (strcmp(argv[i], "-screen") == 0) { /* -screen n WxHxD */
+ int screenNum;
+
+ CHECK_FOR_REQUIRED_ARGUMENTS(2);
+ screenNum = atoi(argv[i + 1]);
+ /* The protocol only has a CARD8 for number of screens in the
+ connection setup block, so don't allow more than that. */
+ if ((screenNum < 0) || (screenNum >= 255)) {
+ ErrorF("Invalid screen number %d\n", screenNum);
+ UseMsg();
+ FatalError("Invalid screen number %d passed to -screen\n",
+ screenNum);
+ }
+
+ if (vfbNumScreens <= screenNum) {
+ vfbScreens =
+ realloc(vfbScreens, sizeof(*vfbScreens) * (screenNum + 1));
+ if (!vfbScreens)
+ FatalError("Not enough memory for screen %d\n", screenNum);
+ for (; vfbNumScreens <= screenNum; ++vfbNumScreens)
+ vfbScreens[vfbNumScreens] = defaultScreenInfo;
+ }
+
+ if (3 != sscanf(argv[i + 2], "%dx%dx%d",
+ &vfbScreens[screenNum].width,
+ &vfbScreens[screenNum].height,
+ &vfbScreens[screenNum].depth)) {
+ ErrorF("Invalid screen configuration %s\n", argv[i + 2]);
+ UseMsg();
+ FatalError("Invalid screen configuration %s for -screen %d\n",
+ argv[i + 2], screenNum);
+ }
+
+ lastScreen = screenNum;
+ return 3;
+ }
+
+ if (strcmp(argv[i], "-pixdepths") == 0) { /* -pixdepths list-of-depth */
+ int depth, ret = 1;
+
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ while ((++i < argc) && (depth = atoi(argv[i])) != 0) {
+ if (depth < 0 || depth > 32) {
+ ErrorF("Invalid pixmap depth %d\n", depth);
+ UseMsg();
+ FatalError("Invalid pixmap depth %d passed to -pixdepths\n",
+ depth);
+ }
+ vfbPixmapDepths[depth] = TRUE;
+ ret++;
+ }
+ return ret;
+ }
+
+ if (strcmp(argv[i], "+render") == 0) { /* +render */
+ Render = TRUE;
+ return 1;
+ }
+
+ if (strcmp(argv[i], "-render") == 0) { /* -render */
+ Render = FALSE;
#ifdef COMPOSITE
- noCompositeExtension = TRUE;
+ noCompositeExtension = TRUE;
#endif
- return 1;
+ return 1;
}
- if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */
- {
- CHECK_FOR_REQUIRED_ARGUMENTS(1);
- currentScreen->blackPixel = atoi(argv[++i]);
- return 2;
+ if (strcmp(argv[i], "-blackpixel") == 0) { /* -blackpixel n */
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ currentScreen->blackPixel = atoi(argv[++i]);
+ return 2;
}
- if (strcmp (argv[i], "-whitepixel") == 0) /* -whitepixel n */
- {
- CHECK_FOR_REQUIRED_ARGUMENTS(1);
- currentScreen->whitePixel = atoi(argv[++i]);
- return 2;
+ if (strcmp(argv[i], "-whitepixel") == 0) { /* -whitepixel n */
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ currentScreen->whitePixel = atoi(argv[++i]);
+ return 2;
}
- if (strcmp (argv[i], "-linebias") == 0) /* -linebias n */
- {
- CHECK_FOR_REQUIRED_ARGUMENTS(1);
- currentScreen->lineBias = atoi(argv[++i]);
- return 2;
+ if (strcmp(argv[i], "-linebias") == 0) { /* -linebias n */
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ currentScreen->lineBias = atoi(argv[++i]);
+ return 2;
}
#ifdef HAVE_MMAP
- if (strcmp (argv[i], "-fbdir") == 0) /* -fbdir directory */
- {
- CHECK_FOR_REQUIRED_ARGUMENTS(1);
- pfbdir = argv[++i];
- fbmemtype = MMAPPED_FILE_FB;
- return 2;
+ if (strcmp(argv[i], "-fbdir") == 0) { /* -fbdir directory */
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ pfbdir = argv[++i];
+ fbmemtype = MMAPPED_FILE_FB;
+ return 2;
}
-#endif /* HAVE_MMAP */
+#endif /* HAVE_MMAP */
#ifdef HAS_SHM
- if (strcmp (argv[i], "-shmem") == 0) /* -shmem */
- {
- fbmemtype = SHARED_MEMORY_FB;
- return 1;
+ if (strcmp(argv[i], "-shmem") == 0) { /* -shmem */
+ fbmemtype = SHARED_MEMORY_FB;
+ return 1;
}
#endif
@@ -392,13 +381,14 @@ ddxProcessArgument(int argc, char *argv[], int i)
}
static DevPrivateKeyRec cmapScrPrivateKeyRec;
+
#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
static int
-vfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
+vfbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps)
{
/* By the time we are processing requests, we can guarantee that there
* is always a colormap installed */
@@ -406,61 +396,60 @@ vfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
return 1;
}
-
static void
vfbInstallColormap(ColormapPtr pmap)
{
ColormapPtr oldpmap = GetInstalledColormap(pmap->pScreen);
- if (pmap != oldpmap)
- {
- int entries;
- XWDFileHeader *pXWDHeader;
- XWDColor *pXWDCmap;
- VisualPtr pVisual;
- Pixel * ppix;
- xrgb * prgb;
- xColorItem *defs;
- int i;
-
- if(oldpmap != (ColormapPtr)None)
- WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
- /* Install pmap */
- SetInstalledColormap(pmap->pScreen, pmap);
- WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
-
- entries = pmap->pVisual->ColormapEntries;
- pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader;
- pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
- pVisual = pmap->pVisual;
-
- swapcopy32(pXWDHeader->visual_class, pVisual->class);
- swapcopy32(pXWDHeader->red_mask, pVisual->redMask);
- swapcopy32(pXWDHeader->green_mask, pVisual->greenMask);
- swapcopy32(pXWDHeader->blue_mask, pVisual->blueMask);
- swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
- swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);
-
- ppix = (Pixel *)malloc(entries * sizeof(Pixel));
- prgb = (xrgb *)malloc(entries * sizeof(xrgb));
- defs = (xColorItem *)malloc(entries * sizeof(xColorItem));
-
- for (i = 0; i < entries; i++) ppix[i] = i;
- /* XXX truecolor */
- QueryColors(pmap, entries, ppix, prgb, serverClient);
-
- for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
- defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
- defs[i].red = prgb[i].red;
- defs[i].green = prgb[i].green;
- defs[i].blue = prgb[i].blue;
- defs[i].flags = DoRed|DoGreen|DoBlue;
- }
- (*pmap->pScreen->StoreColors)(pmap, entries, defs);
-
- free(ppix);
- free(prgb);
- free(defs);
+ if (pmap != oldpmap) {
+ int entries;
+ XWDFileHeader *pXWDHeader;
+ XWDColor *pXWDCmap;
+ VisualPtr pVisual;
+ Pixel *ppix;
+ xrgb *prgb;
+ xColorItem *defs;
+ int i;
+
+ if (oldpmap != (ColormapPtr) None)
+ WalkTree(pmap->pScreen, TellLostMap, (char *) &oldpmap->mid);
+ /* Install pmap */
+ SetInstalledColormap(pmap->pScreen, pmap);
+ WalkTree(pmap->pScreen, TellGainedMap, (char *) &pmap->mid);
+
+ entries = pmap->pVisual->ColormapEntries;
+ pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader;
+ pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
+ pVisual = pmap->pVisual;
+
+ swapcopy32(pXWDHeader->visual_class, pVisual->class);
+ swapcopy32(pXWDHeader->red_mask, pVisual->redMask);
+ swapcopy32(pXWDHeader->green_mask, pVisual->greenMask);
+ swapcopy32(pXWDHeader->blue_mask, pVisual->blueMask);
+ swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
+ swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);
+
+ ppix = (Pixel *) malloc(entries * sizeof(Pixel));
+ prgb = (xrgb *) malloc(entries * sizeof(xrgb));
+ defs = (xColorItem *) malloc(entries * sizeof(xColorItem));
+
+ for (i = 0; i < entries; i++)
+ ppix[i] = i;
+ /* XXX truecolor */
+ QueryColors(pmap, entries, ppix, prgb, serverClient);
+
+ for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
+ defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
+ defs[i].red = prgb[i].red;
+ defs[i].green = prgb[i].green;
+ defs[i].blue = prgb[i].blue;
+ defs[i].flags = DoRed | DoGreen | DoBlue;
+ }
+ (*pmap->pScreen->StoreColors) (pmap, entries, defs);
+
+ free(ppix);
+ free(prgb);
+ free(defs);
}
}
@@ -469,51 +458,43 @@ vfbUninstallColormap(ColormapPtr pmap)
{
ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen);
- if(pmap == curpmap)
- {
- if (pmap->mid != pmap->pScreen->defColormap)
- {
- dixLookupResourceByType((pointer *)&curpmap,
- pmap->pScreen->defColormap,
- RT_COLORMAP, serverClient,
- DixInstallAccess);
- (*pmap->pScreen->InstallColormap)(curpmap);
- }
+ if (pmap == curpmap) {
+ if (pmap->mid != pmap->pScreen->defColormap) {
+ dixLookupResourceByType((pointer *) &curpmap,
+ pmap->pScreen->defColormap,
+ RT_COLORMAP, serverClient,
+ DixInstallAccess);
+ (*pmap->pScreen->InstallColormap) (curpmap);
+ }
}
}
static void
-vfbStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs)
+vfbStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs)
{
XWDColor *pXWDCmap;
int i;
- if (pmap != GetInstalledColormap(pmap->pScreen))
- {
- return;
+ if (pmap != GetInstalledColormap(pmap->pScreen)) {
+ return;
}
pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
- if ((pmap->pVisual->class | DynamicClass) == DirectColor)
- {
- return;
- }
-
- for (i = 0; i < ndef; i++)
- {
- if (pdefs[i].flags & DoRed)
- {
- swapcopy16(pXWDCmap[pdefs[i].pixel].red, pdefs[i].red);
- }
- if (pdefs[i].flags & DoGreen)
- {
- swapcopy16(pXWDCmap[pdefs[i].pixel].green, pdefs[i].green);
- }
- if (pdefs[i].flags & DoBlue)
- {
- swapcopy16(pXWDCmap[pdefs[i].pixel].blue, pdefs[i].blue);
- }
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor) {
+ return;
+ }
+
+ for (i = 0; i < ndef; i++) {
+ if (pdefs[i].flags & DoRed) {
+ swapcopy16(pXWDCmap[pdefs[i].pixel].red, pdefs[i].red);
+ }
+ if (pdefs[i].flags & DoGreen) {
+ swapcopy16(pXWDCmap[pdefs[i].pixel].green, pdefs[i].green);
+ }
+ if (pdefs[i].flags & DoBlue) {
+ swapcopy16(pXWDCmap[pdefs[i].pixel].blue, pdefs[i].blue);
+ }
}
}
@@ -531,30 +512,27 @@ vfbBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
{
int i;
- for (i = 0; i < vfbNumScreens; i++)
- {
+ for (i = 0; i < vfbNumScreens; i++) {
#ifdef MS_ASYNC
- if (-1 == msync((caddr_t)vfbScreens[i].pXWDHeader,
- (size_t)vfbScreens[i].sizeInBytes, MS_ASYNC))
+ if (-1 == msync((caddr_t) vfbScreens[i].pXWDHeader,
+ (size_t) vfbScreens[i].sizeInBytes, MS_ASYNC))
#else
- /* silly NetBSD and who else? */
- if (-1 == msync((caddr_t)vfbScreens[i].pXWDHeader,
- (size_t)vfbScreens[i].sizeInBytes))
+ /* silly NetBSD and who else? */
+ if (-1 == msync((caddr_t) vfbScreens[i].pXWDHeader,
+ (size_t) vfbScreens[i].sizeInBytes))
#endif
- {
- perror("msync");
- ErrorF("msync failed, %s", strerror(errno));
- }
+ {
+ perror("msync");
+ ErrorF("msync failed, %s", strerror(errno));
+ }
}
}
-
static void
vfbWakeupHandler(pointer blockData, int result, pointer pReadmask)
{
}
-
static void
vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb)
{
@@ -563,53 +541,47 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb)
int currentFileSize, writeThisTime;
snprintf(pvfb->mmap_file, sizeof(pvfb->mmap_file), "%s/Xvfb_screen%d",
- pfbdir, (int) (pvfb - vfbScreens));
- if (-1 == (pvfb->mmap_fd = open(pvfb->mmap_file, O_CREAT|O_RDWR, 0666)))
- {
- perror("open");
- ErrorF("open %s failed, %s", pvfb->mmap_file, strerror(errno));
- return;
+ pfbdir, (int) (pvfb - vfbScreens));
+ if (-1 == (pvfb->mmap_fd = open(pvfb->mmap_file, O_CREAT | O_RDWR, 0666))) {
+ perror("open");
+ ErrorF("open %s failed, %s", pvfb->mmap_file, strerror(errno));
+ return;
}
/* Extend the file to be the proper size */
memset(dummyBuffer, 0, DUMMY_BUFFER_SIZE);
for (currentFileSize = 0;
- currentFileSize < pvfb->sizeInBytes;
- currentFileSize += writeThisTime)
- {
- writeThisTime = min(DUMMY_BUFFER_SIZE,
- pvfb->sizeInBytes - currentFileSize);
- if (-1 == write(pvfb->mmap_fd, dummyBuffer, writeThisTime))
- {
- perror("write");
- ErrorF("write %s failed, %s", pvfb->mmap_file, strerror(errno));
- return;
- }
+ currentFileSize < pvfb->sizeInBytes;
+ currentFileSize += writeThisTime) {
+ writeThisTime = min(DUMMY_BUFFER_SIZE,
+ pvfb->sizeInBytes - currentFileSize);
+ if (-1 == write(pvfb->mmap_fd, dummyBuffer, writeThisTime)) {
+ perror("write");
+ ErrorF("write %s failed, %s", pvfb->mmap_file, strerror(errno));
+ return;
+ }
}
/* try to mmap the file */
- pvfb->pXWDHeader = (XWDFileHeader *)mmap((caddr_t)NULL, pvfb->sizeInBytes,
- PROT_READ|PROT_WRITE,
- MAP_FILE|MAP_SHARED,
- pvfb->mmap_fd, 0);
- if (-1 == (long)pvfb->pXWDHeader)
- {
- perror("mmap");
- ErrorF("mmap %s failed, %s", pvfb->mmap_file, strerror(errno));
- pvfb->pXWDHeader = NULL;
- return;
+ pvfb->pXWDHeader = (XWDFileHeader *) mmap((caddr_t) NULL, pvfb->sizeInBytes,
+ PROT_READ | PROT_WRITE,
+ MAP_FILE | MAP_SHARED,
+ pvfb->mmap_fd, 0);
+ if (-1 == (long) pvfb->pXWDHeader) {
+ perror("mmap");
+ ErrorF("mmap %s failed, %s", pvfb->mmap_file, strerror(errno));
+ pvfb->pXWDHeader = NULL;
+ return;
}
if (!RegisterBlockAndWakeupHandlers(vfbBlockHandler, vfbWakeupHandler,
- NULL))
- {
- pvfb->pXWDHeader = NULL;
+ NULL)) {
+ pvfb->pXWDHeader = NULL;
}
}
-#endif /* HAVE_MMAP */
-
+#endif /* HAVE_MMAP */
#ifdef HAS_SHM
static void
@@ -617,33 +589,33 @@ vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb)
{
/* create the shared memory segment */
- pvfb->shmid = shmget(IPC_PRIVATE, pvfb->sizeInBytes, IPC_CREAT|0777);
- if (pvfb->shmid < 0)
- {
- perror("shmget");
- ErrorF("shmget %d bytes failed, %s", pvfb->sizeInBytes, strerror(errno));
- return;
+ pvfb->shmid = shmget(IPC_PRIVATE, pvfb->sizeInBytes, IPC_CREAT | 0777);
+ if (pvfb->shmid < 0) {
+ perror("shmget");
+ ErrorF("shmget %d bytes failed, %s", pvfb->sizeInBytes,
+ strerror(errno));
+ return;
}
/* try to attach it */
- pvfb->pXWDHeader = (XWDFileHeader *)shmat(pvfb->shmid, 0, 0);
- if (-1 == (long)pvfb->pXWDHeader)
- {
- perror("shmat");
- ErrorF("shmat failed, %s", strerror(errno));
- pvfb->pXWDHeader = NULL;
- return;
+ pvfb->pXWDHeader = (XWDFileHeader *) shmat(pvfb->shmid, 0, 0);
+ if (-1 == (long) pvfb->pXWDHeader) {
+ perror("shmat");
+ ErrorF("shmat failed, %s", strerror(errno));
+ pvfb->pXWDHeader = NULL;
+ return;
}
ErrorF("screen %d shmid %d\n", (int) (pvfb - vfbScreens), pvfb->shmid);
}
-#endif /* HAS_SHM */
+#endif /* HAS_SHM */
static char *
vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
{
- if (pvfb->pfbMemory) return pvfb->pfbMemory; /* already done */
+ if (pvfb->pfbMemory)
+ return pvfb->pfbMemory; /* already done */
pvfb->sizeInBytes = pvfb->paddedBytesWidth * pvfb->height;
@@ -653,55 +625,59 @@ vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
* below comes from the MAX_PSEUDO_DEPTH define in cfbcmap.c.
*/
- if (pvfb->depth <= 10)
- { /* single index colormaps */
- pvfb->ncolors = 1 << pvfb->depth;
+ if (pvfb->depth <= 10) { /* single index colormaps */
+ pvfb->ncolors = 1 << pvfb->depth;
}
- else
- { /* decomposed colormaps */
- int nplanes_per_color_component = pvfb->depth / 3;
- if (pvfb->depth % 3) nplanes_per_color_component++;
- pvfb->ncolors = 1 << nplanes_per_color_component;
+ else { /* decomposed colormaps */
+ int nplanes_per_color_component = pvfb->depth / 3;
+
+ if (pvfb->depth % 3)
+ nplanes_per_color_component++;
+ pvfb->ncolors = 1 << nplanes_per_color_component;
}
/* add extra bytes for XWDFileHeader, window name, and colormap */
pvfb->sizeInBytes += SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN +
- pvfb->ncolors * SIZEOF(XWDColor);
+ pvfb->ncolors * SIZEOF(XWDColor);
- pvfb->pXWDHeader = NULL;
- switch (fbmemtype)
- {
+ pvfb->pXWDHeader = NULL;
+ switch (fbmemtype) {
#ifdef HAVE_MMAP
- case MMAPPED_FILE_FB: vfbAllocateMmappedFramebuffer(pvfb); break;
+ case MMAPPED_FILE_FB:
+ vfbAllocateMmappedFramebuffer(pvfb);
+ break;
#else
- case MMAPPED_FILE_FB: break;
+ case MMAPPED_FILE_FB:
+ break;
#endif
#ifdef HAS_SHM
- case SHARED_MEMORY_FB: vfbAllocateSharedMemoryFramebuffer(pvfb); break;
+ case SHARED_MEMORY_FB:
+ vfbAllocateSharedMemoryFramebuffer(pvfb);
+ break;
#else
- case SHARED_MEMORY_FB: break;
+ case SHARED_MEMORY_FB:
+ break;
#endif
case NORMAL_MEMORY_FB:
- pvfb->pXWDHeader = (XWDFileHeader *)malloc(pvfb->sizeInBytes);
- break;
+ pvfb->pXWDHeader = (XWDFileHeader *) malloc(pvfb->sizeInBytes);
+ break;
}
- if (pvfb->pXWDHeader)
- {
- pvfb->pXWDCmap = (XWDColor *)((char *)pvfb->pXWDHeader
- + SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN);
- pvfb->pfbMemory = (char *)(pvfb->pXWDCmap + pvfb->ncolors);
+ if (pvfb->pXWDHeader) {
+ pvfb->pXWDCmap = (XWDColor *) ((char *) pvfb->pXWDHeader
+ + SIZEOF(XWDheader) +
+ XWD_WINDOW_NAME_LEN);
+ pvfb->pfbMemory = (char *) (pvfb->pXWDCmap + pvfb->ncolors);
- return pvfb->pfbMemory;
+ return pvfb->pfbMemory;
}
else
- return NULL;
+ return NULL;
}
-
static void
vfbWriteXWDFileHeader(ScreenPtr pScreen)
{
@@ -713,7 +689,8 @@ vfbWriteXWDFileHeader(ScreenPtr pScreen)
needswap = *(char *) &swaptest;
- pXWDHeader->header_size = (char *)pvfb->pXWDCmap - (char *)pvfb->pXWDHeader;
+ pXWDHeader->header_size =
+ (char *) pvfb->pXWDCmap - (char *) pvfb->pXWDHeader;
pXWDHeader->file_version = XWD_FILE_VERSION;
pXWDHeader->pixmap_format = ZPixmap;
@@ -743,45 +720,40 @@ vfbWriteXWDFileHeader(ScreenPtr pScreen)
/* write xwd "window" name: Xvfb hostname:server.screen */
if (-1 == gethostname(hostname, sizeof(hostname)))
- hostname[0] = 0;
+ hostname[0] = 0;
else
- hostname[XWD_WINDOW_NAME_LEN-1] = 0;
- sprintf((char *)(pXWDHeader+1), "Xvfb %s:%s.%d", hostname, display,
- pScreen->myNum);
+ hostname[XWD_WINDOW_NAME_LEN - 1] = 0;
+ sprintf((char *) (pXWDHeader + 1), "Xvfb %s:%s.%d", hostname, display,
+ pScreen->myNum);
/* write colormap pixel slot values */
- for (i = 0; i < pvfb->ncolors; i++)
- {
- pvfb->pXWDCmap[i].pixel = i;
+ for (i = 0; i < pvfb->ncolors; i++) {
+ pvfb->pXWDCmap[i].pixel = i;
}
/* byte swap to most significant byte first */
- if (needswap)
- {
- SwapLongs((CARD32 *)pXWDHeader, SIZEOF(XWDheader)/4);
- for (i = 0; i < pvfb->ncolors; i++)
- {
- swapl(&pvfb->pXWDCmap[i].pixel);
- }
+ if (needswap) {
+ SwapLongs((CARD32 *) pXWDHeader, SIZEOF(XWDheader) / 4);
+ for (i = 0; i < pvfb->ncolors; i++) {
+ swapl(&pvfb->pXWDCmap[i].pixel);
+ }
}
}
-
static Bool
-vfbCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
+vfbCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
{
return FALSE;
}
static void
-vfbCrossScreen (ScreenPtr pScreen, Bool entering)
+vfbCrossScreen(ScreenPtr pScreen, Bool entering)
{
}
-static miPointerScreenFuncRec vfbPointerCursorFuncs =
-{
+static miPointerScreenFuncRec vfbPointerCursorFuncs = {
vfbCursorOffScreen,
vfbCrossScreen,
miPointerWarpCursor
@@ -792,7 +764,7 @@ vfbCloseScreen(int index, ScreenPtr pScreen)
{
vfbScreenInfoPtr pvfb = &vfbScreens[index];
int i;
-
+
pScreen->CloseScreen = pvfb->closeScreen;
/*
@@ -800,7 +772,7 @@ vfbCloseScreen(int index, ScreenPtr pScreen)
* clear installed colormaps so that server reset works correctly.
*/
for (i = 0; i < screenInfo.numScreens; i++)
- SetInstalledColormap(screenInfo.screens[i], NULL);
+ SetInstalledColormap(screenInfo.screens[i], NULL);
return pScreen->CloseScreen(index, pScreen);
}
@@ -812,72 +784,74 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
int dpix = monitorResolution, dpiy = monitorResolution;
int ret;
char *pbits;
-
+
if (!dixRegisterPrivateKey(&cmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (dpix == 0)
- dpix = 100;
+ dpix = 100;
if (dpiy == 0)
- dpiy = 100;
+ dpiy = 100;
pvfb->paddedBytesWidth = PixmapBytePad(pvfb->width, pvfb->depth);
pvfb->bitsPerPixel = vfbBitsPerPixel(pvfb->depth);
- if (pvfb->bitsPerPixel >= 8 )
- pvfb->paddedWidth = pvfb->paddedBytesWidth / (pvfb->bitsPerPixel / 8);
+ if (pvfb->bitsPerPixel >= 8)
+ pvfb->paddedWidth = pvfb->paddedBytesWidth / (pvfb->bitsPerPixel / 8);
else
- pvfb->paddedWidth = pvfb->paddedBytesWidth * 8;
+ pvfb->paddedWidth = pvfb->paddedBytesWidth * 8;
pbits = vfbAllocateFramebufferMemory(pvfb);
- if (!pbits) return FALSE;
+ if (!pbits)
+ return FALSE;
switch (pvfb->depth) {
case 8:
- miSetVisualTypesAndMasks (8,
- ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor)),
- 8, PseudoColor, 0, 0, 0);
- break;
+ miSetVisualTypesAndMasks(8,
+ ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
+ (1 << DirectColor)), 8, PseudoColor, 0, 0, 0);
+ break;
case 15:
- miSetVisualTypesAndMasks (15,
- ((1 << TrueColor) |
- (1 << DirectColor)),
- 8, TrueColor, 0x7c00, 0x03e0, 0x001f);
- break;
+ miSetVisualTypesAndMasks(15,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 8, TrueColor, 0x7c00, 0x03e0, 0x001f);
+ break;
case 16:
- miSetVisualTypesAndMasks (16,
- ((1 << TrueColor) |
- (1 << DirectColor)),
- 8, TrueColor, 0xf800, 0x07e0, 0x001f);
- break;
+ miSetVisualTypesAndMasks(16,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 8, TrueColor, 0xf800, 0x07e0, 0x001f);
+ break;
case 24:
- miSetVisualTypesAndMasks (24,
- ((1 << TrueColor) |
- (1 << DirectColor)),
- 8, TrueColor, 0xff0000, 0x00ff00, 0x0000ff);
- break;
+ miSetVisualTypesAndMasks(24,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 8, TrueColor, 0xff0000, 0x00ff00, 0x0000ff);
+ break;
case 30:
- miSetVisualTypesAndMasks (30,
- ((1 << TrueColor) |
- (1 << DirectColor)),
- 10, TrueColor, 0x3ff00000, 0x000ffc00, 0x000003ff);
- break;
+ miSetVisualTypesAndMasks(30,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 10, TrueColor, 0x3ff00000, 0x000ffc00,
+ 0x000003ff);
+ break;
default:
- return FALSE;
+ return FALSE;
}
- miSetPixmapDepths ();
+ miSetPixmapDepths();
ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
- dpix, dpiy, pvfb->paddedWidth,pvfb->bitsPerPixel);
- if (ret && Render)
- fbPictureInit (pScreen, 0, 0);
+ dpix, dpiy, pvfb->paddedWidth, pvfb->bitsPerPixel);
+ if (ret && Render)
+ fbPictureInit(pScreen, 0, 0);
- if (!ret) return FALSE;
+ if (!ret)
+ return FALSE;
pScreen->InstallColormap = vfbInstallColormap;
pScreen->UninstallColormap = vfbUninstallColormap;
@@ -902,11 +876,10 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
return ret;
-} /* end vfbScreenInit */
-
+} /* end vfbScreenInit */
void
-InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
+InitOutput(ScreenInfo * screenInfo, int argc, char **argv)
{
int i;
int NumFormats = 0;
@@ -914,39 +887,36 @@ InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
/* initialize pixmap formats */
/* must have a pixmap depth to match every screen depth */
- for (i = 0; i < vfbNumScreens; i++)
- {
- vfbPixmapDepths[vfbScreens[i].depth] = TRUE;
+ for (i = 0; i < vfbNumScreens; i++) {
+ vfbPixmapDepths[vfbScreens[i].depth] = TRUE;
}
/* RENDER needs a good set of pixmaps. */
if (Render) {
- vfbPixmapDepths[1] = TRUE;
- vfbPixmapDepths[4] = TRUE;
- vfbPixmapDepths[8] = TRUE;
+ vfbPixmapDepths[1] = TRUE;
+ vfbPixmapDepths[4] = TRUE;
+ vfbPixmapDepths[8] = TRUE;
#if 0
- vfbPixmapDepths[12] = TRUE;
+ vfbPixmapDepths[12] = TRUE;
#endif
/* vfbPixmapDepths[15] = TRUE; */
- vfbPixmapDepths[16] = TRUE;
- vfbPixmapDepths[24] = TRUE;
+ vfbPixmapDepths[16] = TRUE;
+ vfbPixmapDepths[24] = TRUE;
#if 0
- vfbPixmapDepths[30] = TRUE;
+ vfbPixmapDepths[30] = TRUE;
#endif
- vfbPixmapDepths[32] = TRUE;
+ vfbPixmapDepths[32] = TRUE;
}
- for (i = 1; i <= 32; i++)
- {
- if (vfbPixmapDepths[i])
- {
- if (NumFormats >= MAXFORMATS)
- FatalError ("MAXFORMATS is too small for this server\n");
- screenInfo->formats[NumFormats].depth = i;
- screenInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i);
- screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD;
- NumFormats++;
- }
+ for (i = 1; i <= 32; i++) {
+ if (vfbPixmapDepths[i]) {
+ if (NumFormats >= MAXFORMATS)
+ FatalError("MAXFORMATS is too small for this server\n");
+ screenInfo->formats[NumFormats].depth = i;
+ screenInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i);
+ screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD;
+ NumFormats++;
+ }
}
screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
@@ -957,17 +927,14 @@ InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
/* initialize screens */
- if (vfbNumScreens < 1)
- {
- vfbScreens = &defaultScreenInfo;
- vfbNumScreens = 1;
+ if (vfbNumScreens < 1) {
+ vfbScreens = &defaultScreenInfo;
+ vfbNumScreens = 1;
}
- for (i = 0; i < vfbNumScreens; i++)
- {
- if (-1 == AddScreen(vfbScreenInit, argc, argv))
- {
- FatalError("Couldn't add screen %d", i);
- }
+ for (i = 0; i < vfbNumScreens; i++) {
+ if (-1 == AddScreen(vfbScreenInit, argc, argv)) {
+ FatalError("Couldn't add screen %d", i);
+ }
}
-} /* end InitOutput */
+} /* end InitOutput */
diff --git a/xorg-server/hw/xfree86/common/compiler.h b/xorg-server/hw/xfree86/common/compiler.h
index 01034916c..04231f8f2 100644
--- a/xorg-server/hw/xfree86/common/compiler.h
+++ b/xorg-server/hw/xfree86/common/compiler.h
@@ -49,61 +49,58 @@
#ifndef _COMPILER_H
-# define _COMPILER_H
+#define _COMPILER_H
#if defined(__SUNPRO_C)
-# define DO_PROTOTYPES
+#define DO_PROTOTYPES
#endif
/* Map Sun compiler platform defines to gcc-style used in the code */
#if defined(__amd64) && !defined(__amd64__)
-# define __amd64__
+#define __amd64__
#endif
#if defined(__i386) && !defined(__i386__)
-# define __i386__
+#define __i386__
#endif
#if defined(__sparc) && !defined(__sparc__)
-# define __sparc__
+#define __sparc__
#endif
#if defined(__sparcv9) && !defined(__sparc64__)
-# define __sparc64__
+#define __sparc64__
#endif
#ifndef _X_EXPORT
-# include <X11/Xfuncproto.h>
+#include <X11/Xfuncproto.h>
#endif
-# include <pixman.h> /* for uint*_t types */
+#include <pixman.h> /* for uint*_t types */
/* Allow drivers to use the GCC-supported __inline__ and/or __inline. */
-# ifndef __inline__
-# if defined(__GNUC__)
+#ifndef __inline__
+#if defined(__GNUC__)
/* gcc has __inline__ */
-# elif defined(__HIGHC__)
-# define __inline__ _Inline
-# else
-# define __inline__ /**/
-# endif
-# endif /* __inline__ */
-# ifndef __inline
-# if defined(__GNUC__) || defined(_MSC_VER)
+#elif defined(__HIGHC__)
+#define __inline__ _Inline
+#else
+#define __inline__ /**/
+#endif
+#endif /* __inline__ */
+#ifndef __inline
+#if defined(__GNUC__) || defined(_MSC_VER)
/* gcc has __inline */
-# elif defined(__HIGHC__)
-# define __inline _Inline
-# else
-# define __inline /**/
-# endif
-# endif /* __inline */
-
+#elif defined(__HIGHC__)
+#define __inline _Inline
+#else
+#define __inline /**/
+#endif
+#endif /* __inline */
/* Support gcc's __FUNCTION__ for people using other compilers */
#if !defined(__GNUC__) && !defined(__FUNCTION__)
-# define __FUNCTION__ __func__ /* C99 */
+#define __FUNCTION__ __func__ /* C99 */
#endif
-
-# if defined(NO_INLINE) || defined(DO_PROTOTYPES)
-
-# if !defined(__arm__)
-# if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \
+#if defined(NO_INLINE) || defined(DO_PROTOTYPES)
+#if !defined(__arm__)
+#if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \
&& !(defined(__alpha__) && defined(linux)) \
&& !(defined(__ia64__) && defined(linux)) \
@@ -114,8 +111,7 @@ extern _X_EXPORT unsigned int inb(unsigned short);
extern _X_EXPORT unsigned int inw(unsigned short);
extern _X_EXPORT unsigned int inl(unsigned short);
-# else /* __sparc__, __arm32__, __alpha__, __nds32__ */
-
+#else /* __sparc__, __arm32__, __alpha__, __nds32__ */
extern _X_EXPORT void outb(unsigned long, unsigned char);
extern _X_EXPORT void outw(unsigned long, unsigned short);
extern _X_EXPORT void outl(unsigned long, unsigned int);
@@ -123,10 +119,10 @@ extern _X_EXPORT unsigned int inb(unsigned long);
extern _X_EXPORT unsigned int inw(unsigned long);
extern _X_EXPORT unsigned int inl(unsigned long);
-# endif /* __sparc__, __arm32__, __alpha__, __nds32__ */
-# endif /* __arm__ */
+#endif /* __sparc__, __arm32__, __alpha__, __nds32__ */
+#endif /* __arm__ */
-# if defined(__powerpc__) && !defined(__OpenBSD__)
+#if defined(__powerpc__) && !defined(__OpenBSD__)
extern unsigned long ldq_u(unsigned long *);
extern unsigned long ldl_u(unsigned int *);
extern unsigned long ldw_u(unsigned short *);
@@ -139,50 +135,50 @@ extern void stl_brx(unsigned long, volatile unsigned char *, int);
extern void stw_brx(unsigned short, volatile unsigned char *, int);
extern unsigned long ldl_brx(volatile unsigned char *, int);
extern unsigned short ldw_brx(volatile unsigned char *, int);
-# endif /* __powerpc__ && !__OpenBSD */
+#endif /* __powerpc__ && !__OpenBSD */
-# endif /* NO_INLINE || DO_PROTOTYPES */
+#endif /* NO_INLINE || DO_PROTOTYPES */
-# ifndef NO_INLINE
-# ifdef __GNUC__
-# ifdef __i386__
+#ifndef NO_INLINE
+#ifdef __GNUC__
+#ifdef __i386__
-# ifdef __SSE__
-# define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory")
-# else
-# define write_mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
-# endif
+#ifdef __SSE__
+#define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory")
+#else
+#define write_mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
+#endif
-# ifdef __SSE2__
-# define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory")
-# else
-# define mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
-# endif
+#ifdef __SSE2__
+#define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory")
+#else
+#define mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
+#endif
-# elif defined __alpha__
+#elif defined __alpha__
-# define mem_barrier() __asm__ __volatile__ ("mb" : : : "memory")
-# define write_mem_barrier() __asm__ __volatile__ ("wmb" : : : "memory")
+#define mem_barrier() __asm__ __volatile__ ("mb" : : : "memory")
+#define write_mem_barrier() __asm__ __volatile__ ("wmb" : : : "memory")
-# elif defined __amd64__
+#elif defined __amd64__
-# define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory")
-# define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory")
+#define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory")
+#define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory")
-# elif defined __ia64__
+#elif defined __ia64__
-# ifndef __INTEL_COMPILER
-# define mem_barrier() __asm__ __volatile__ ("mf" : : : "memory")
-# define write_mem_barrier() __asm__ __volatile__ ("mf" : : : "memory")
-# else
-# include "ia64intrin.h"
-# define mem_barrier() __mf()
-# define write_mem_barrier() __mf()
-# endif
+#ifndef __INTEL_COMPILER
+#define mem_barrier() __asm__ __volatile__ ("mf" : : : "memory")
+#define write_mem_barrier() __asm__ __volatile__ ("mf" : : : "memory")
+#else
+#include "ia64intrin.h"
+#define mem_barrier() __mf()
+#define write_mem_barrier() __mf()
+#endif
-# elif defined __mips__
+#elif defined __mips__
/* Note: sync instruction requires MIPS II instruction set */
-# define mem_barrier() \
+#define mem_barrier() \
__asm__ __volatile__( \
".set push\n\t" \
".set noreorder\n\t" \
@@ -192,140 +188,169 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
: /* no output */ \
: /* no input */ \
: "memory")
-# define write_mem_barrier() mem_barrier()
-
-# elif defined __powerpc__
+#define write_mem_barrier() mem_barrier()
-# if defined(linux) && defined(__powerpc64__)
-# include <linux/version.h>
-# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
-# include <asm/memory.h>
-# endif
-# endif /* defined(linux) && defined(__powerpc64__) */
+#elif defined __powerpc__
-# ifndef eieio /* We deal with arch-specific eieio() routines above... */
-# define eieio() __asm__ __volatile__ ("eieio" ::: "memory")
-# endif /* eieio */
-# define mem_barrier() eieio()
-# define write_mem_barrier() eieio()
+#if defined(linux) && defined(__powerpc64__)
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+#include <asm/memory.h>
+#endif
+#endif /* defined(linux) && defined(__powerpc64__) */
-# elif defined __sparc__
+#ifndef eieio /* We deal with arch-specific eieio() routines above... */
+#define eieio() __asm__ __volatile__ ("eieio" ::: "memory")
+#endif /* eieio */
+#define mem_barrier() eieio()
+#define write_mem_barrier() eieio()
-# define barrier() __asm__ __volatile__ (".word 0x8143e00a" : : : "memory")
-# define mem_barrier() /* XXX: nop for now */
-# define write_mem_barrier() /* XXX: nop for now */
-# endif
-# endif /* __GNUC__ */
-# endif /* NO_INLINE */
+#elif defined __sparc__
-# ifndef mem_barrier
-# define mem_barrier() /* NOP */
-# endif
+#define barrier() __asm__ __volatile__ (".word 0x8143e00a" : : : "memory")
+#define mem_barrier() /* XXX: nop for now */
+#define write_mem_barrier() /* XXX: nop for now */
+#endif
+#endif /* __GNUC__ */
+#endif /* NO_INLINE */
-# ifndef write_mem_barrier
-# define write_mem_barrier() /* NOP */
-# endif
+#ifndef mem_barrier
+#define mem_barrier() /* NOP */
+#endif
+#ifndef write_mem_barrier
+#define write_mem_barrier() /* NOP */
+#endif
-# ifndef NO_INLINE
-# ifdef __GNUC__
+#ifndef NO_INLINE
+#ifdef __GNUC__
/* Define some packed structures to use with unaligned accesses */
-struct __una_u64 { uint64_t x __attribute__((packed)); };
-struct __una_u32 { uint32_t x __attribute__((packed)); };
-struct __una_u16 { uint16_t x __attribute__((packed)); };
+struct __una_u64 {
+ uint64_t x __attribute__ ((packed));
+};
+struct __una_u32 {
+ uint32_t x __attribute__ ((packed));
+};
+struct __una_u16 {
+ uint16_t x __attribute__ ((packed));
+};
/* Elemental unaligned loads */
-static __inline__ uint64_t ldq_u(uint64_t *p)
+static __inline__ uint64_t
+ldq_u(uint64_t * p)
{
- const struct __una_u64 *ptr = (const struct __una_u64 *) p;
- return ptr->x;
+ const struct __una_u64 *ptr = (const struct __una_u64 *) p;
+
+ return ptr->x;
}
-static __inline__ uint32_t ldl_u(uint32_t *p)
+static __inline__ uint32_t
+ldl_u(uint32_t * p)
{
- const struct __una_u32 *ptr = (const struct __una_u32 *) p;
- return ptr->x;
+ const struct __una_u32 *ptr = (const struct __una_u32 *) p;
+
+ return ptr->x;
}
-static __inline__ uint16_t ldw_u(uint16_t *p)
+static __inline__ uint16_t
+ldw_u(uint16_t * p)
{
- const struct __una_u16 *ptr = (const struct __una_u16 *) p;
- return ptr->x;
+ const struct __una_u16 *ptr = (const struct __una_u16 *) p;
+
+ return ptr->x;
}
/* Elemental unaligned stores */
-static __inline__ void stq_u(uint64_t val, uint64_t *p)
+static __inline__ void
+stq_u(uint64_t val, uint64_t * p)
{
- struct __una_u64 *ptr = (struct __una_u64 *) p;
- ptr->x = val;
+ struct __una_u64 *ptr = (struct __una_u64 *) p;
+
+ ptr->x = val;
}
-static __inline__ void stl_u(uint32_t val, uint32_t *p)
+static __inline__ void
+stl_u(uint32_t val, uint32_t * p)
{
- struct __una_u32 *ptr = (struct __una_u32 *) p;
- ptr->x = val;
+ struct __una_u32 *ptr = (struct __una_u32 *) p;
+
+ ptr->x = val;
}
-static __inline__ void stw_u(uint16_t val, uint16_t *p)
+static __inline__ void
+stw_u(uint16_t val, uint16_t * p)
{
- struct __una_u16 *ptr = (struct __una_u16 *) p;
- ptr->x = val;
+ struct __una_u16 *ptr = (struct __una_u16 *) p;
+
+ ptr->x = val;
}
-# else /* !__GNUC__ */
+#else /* !__GNUC__ */
-#include <string.h> /* needed for memmove */
+#include <string.h> /* needed for memmove */
-static __inline__ uint64_t ldq_u(uint64_t *p)
+static __inline__ uint64_t
+ldq_u(uint64_t * p)
{
- uint64_t ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
+ uint64_t ret;
+
+ memmove(&ret, p, sizeof(*p));
+ return ret;
}
-static __inline__ uint32_t ldl_u(uint32_t *p)
+static __inline__ uint32_t
+ldl_u(uint32_t * p)
{
- uint32_t ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
+ uint32_t ret;
+
+ memmove(&ret, p, sizeof(*p));
+ return ret;
}
-static __inline__ uint16_t ldw_u(uint16_t *p)
+static __inline__ uint16_t
+ldw_u(uint16_t * p)
{
- uint16_t ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
+ uint16_t ret;
+
+ memmove(&ret, p, sizeof(*p));
+ return ret;
}
-static __inline__ void stq_u(uint64_t val, uint64_t *p)
+static __inline__ void
+stq_u(uint64_t val, uint64_t * p)
{
- uint64_t tmp = val;
- memmove(p, &tmp, sizeof(*p));
+ uint64_t tmp = val;
+
+ memmove(p, &tmp, sizeof(*p));
}
-static __inline__ void stl_u(uint32_t val, uint32_t *p)
+static __inline__ void
+stl_u(uint32_t val, uint32_t * p)
{
- uint32_t tmp = val;
- memmove(p, &tmp, sizeof(*p));
+ uint32_t tmp = val;
+
+ memmove(p, &tmp, sizeof(*p));
}
-static __inline__ void stw_u(uint16_t val, uint16_t *p)
+static __inline__ void
+stw_u(uint16_t val, uint16_t * p)
{
- uint16_t tmp = val;
- memmove(p, &tmp, sizeof(*p));
+ uint16_t tmp = val;
+
+ memmove(p, &tmp, sizeof(*p));
}
-# endif /* __GNUC__ */
-# endif /* NO_INLINE */
+#endif /* __GNUC__ */
+#endif /* NO_INLINE */
-# ifndef NO_INLINE
-# ifdef __GNUC__
-# if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__))
+#ifndef NO_INLINE
+#ifdef __GNUC__
+#if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__))
-# ifdef linux
+#ifdef linux
/* for Linux on Alpha, we use the LIBC _inx/_outx routines */
/* note that the appropriate setup via "ioperm" needs to be done */
/* *before* any inx/outx is done. */
@@ -358,24 +383,24 @@ outl(unsigned long port, unsigned int val)
static __inline__ unsigned int
inb(unsigned long port)
{
- return _inb(port);
+ return _inb(port);
}
static __inline__ unsigned int
inw(unsigned long port)
{
- return _inw(port);
+ return _inw(port);
}
static __inline__ unsigned int
inl(unsigned long port)
{
- return _inl(port);
+ return _inl(port);
}
-# endif /* linux */
+#endif /* linux */
-# if (defined(__FreeBSD__) || defined(__OpenBSD__)) \
+#if (defined(__FreeBSD__) || defined(__OpenBSD__)) \
&& !defined(DO_PROTOTYPES)
/* for FreeBSD and OpenBSD on Alpha, we use the libio (resp. libalpha) */
@@ -390,583 +415,567 @@ extern _X_EXPORT unsigned char inb(unsigned int port);
extern _X_EXPORT unsigned short inw(unsigned int port);
extern _X_EXPORT unsigned int inl(unsigned int port);
-# endif /* (__FreeBSD__ || __OpenBSD__ ) && !DO_PROTOTYPES */
-
+#endif /* (__FreeBSD__ || __OpenBSD__ ) && !DO_PROTOTYPES */
#if defined(__NetBSD__)
#include <machine/pio.h>
-#endif /* __NetBSD__ */
+#endif /* __NetBSD__ */
+
+#elif (defined(linux) || defined(__FreeBSD__)) && defined(__amd64__)
-# elif (defined(linux) || defined(__FreeBSD__)) && defined(__amd64__)
-
-# include <inttypes.h>
+#include <inttypes.h>
static __inline__ void
outb(unsigned short port, unsigned char val)
{
- __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
+ __asm__ __volatile__("outb %0,%1"::"a"(val), "d"(port));
}
-
static __inline__ void
outw(unsigned short port, unsigned short val)
{
- __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
+ __asm__ __volatile__("outw %0,%1"::"a"(val), "d"(port));
}
static __inline__ void
outl(unsigned short port, unsigned int val)
{
- __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+ __asm__ __volatile__("outl %0,%1"::"a"(val), "d"(port));
}
static __inline__ unsigned int
inb(unsigned short port)
{
- unsigned char ret;
- __asm__ __volatile__("inb %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ unsigned char ret;
+ __asm__ __volatile__("inb %1,%0":"=a"(ret):"d"(port));
+
+ return ret;
}
static __inline__ unsigned int
inw(unsigned short port)
{
- unsigned short ret;
- __asm__ __volatile__("inw %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ unsigned short ret;
+ __asm__ __volatile__("inw %1,%0":"=a"(ret):"d"(port));
+
+ return ret;
}
static __inline__ unsigned int
inl(unsigned short port)
{
- unsigned int ret;
- __asm__ __volatile__("inl %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ unsigned int ret;
+ __asm__ __volatile__("inl %1,%0":"=a"(ret):"d"(port));
+
+ return ret;
}
-# elif (defined(linux) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__)
+#elif (defined(linux) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__)
-# ifndef ASI_PL
-# define ASI_PL 0x88
-# endif
+#ifndef ASI_PL
+#define ASI_PL 0x88
+#endif
static __inline__ void
outb(unsigned long port, unsigned char val)
{
- __asm__ __volatile__("stba %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (port), "i" (ASI_PL));
- barrier();
+ __asm__ __volatile__("stba %0, [%1] %2": /* No outputs */
+ :"r"(val), "r"(port), "i"(ASI_PL));
+
+ barrier();
}
static __inline__ void
outw(unsigned long port, unsigned short val)
{
- __asm__ __volatile__("stha %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (port), "i" (ASI_PL));
- barrier();
+ __asm__ __volatile__("stha %0, [%1] %2": /* No outputs */
+ :"r"(val), "r"(port), "i"(ASI_PL));
+
+ barrier();
}
static __inline__ void
outl(unsigned long port, unsigned int val)
{
- __asm__ __volatile__("sta %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (port), "i" (ASI_PL));
- barrier();
+ __asm__ __volatile__("sta %0, [%1] %2": /* No outputs */
+ :"r"(val), "r"(port), "i"(ASI_PL));
+
+ barrier();
}
static __inline__ unsigned int
inb(unsigned long port)
{
- unsigned int ret;
- __asm__ __volatile__("lduba [%1] %2, %0"
- : "=r" (ret)
- : "r" (port), "i" (ASI_PL));
- return ret;
+ unsigned int ret;
+ __asm__ __volatile__("lduba [%1] %2, %0":"=r"(ret)
+ :"r"(port), "i"(ASI_PL));
+
+ return ret;
}
static __inline__ unsigned int
inw(unsigned long port)
{
- unsigned int ret;
- __asm__ __volatile__("lduha [%1] %2, %0"
- : "=r" (ret)
- : "r" (port), "i" (ASI_PL));
- return ret;
+ unsigned int ret;
+ __asm__ __volatile__("lduha [%1] %2, %0":"=r"(ret)
+ :"r"(port), "i"(ASI_PL));
+
+ return ret;
}
static __inline__ unsigned int
inl(unsigned long port)
{
- unsigned int ret;
- __asm__ __volatile__("lda [%1] %2, %0"
- : "=r" (ret)
- : "r" (port), "i" (ASI_PL));
- return ret;
+ unsigned int ret;
+ __asm__ __volatile__("lda [%1] %2, %0":"=r"(ret)
+ :"r"(port), "i"(ASI_PL));
+
+ return ret;
}
static __inline__ unsigned char
xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned char ret;
+ unsigned long addr = ((unsigned long) base) + offset;
+ unsigned char ret;
+
+ __asm__ __volatile__("lduba [%1] %2, %0":"=r"(ret)
+ :"r"(addr), "i"(ASI_PL));
- __asm__ __volatile__("lduba [%1] %2, %0"
- : "=r" (ret)
- : "r" (addr), "i" (ASI_PL));
- return ret;
+ return ret;
}
static __inline__ unsigned short
xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset)
{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned short ret;
+ unsigned long addr = ((unsigned long) base) + offset;
+ unsigned short ret;
- __asm__ __volatile__("lduh [%1], %0"
- : "=r" (ret)
- : "r" (addr));
- return ret;
+ __asm__ __volatile__("lduh [%1], %0":"=r"(ret)
+ :"r"(addr));
+
+ return ret;
}
static __inline__ unsigned short
xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset)
{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned short ret;
+ unsigned long addr = ((unsigned long) base) + offset;
+ unsigned short ret;
+
+ __asm__ __volatile__("lduha [%1] %2, %0":"=r"(ret)
+ :"r"(addr), "i"(ASI_PL));
- __asm__ __volatile__("lduha [%1] %2, %0"
- : "=r" (ret)
- : "r" (addr), "i" (ASI_PL));
- return ret;
+ return ret;
}
static __inline__ unsigned int
xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned int ret;
+ unsigned long addr = ((unsigned long) base) + offset;
+ unsigned int ret;
- __asm__ __volatile__("ld [%1], %0"
- : "=r" (ret)
- : "r" (addr));
- return ret;
+ __asm__ __volatile__("ld [%1], %0":"=r"(ret)
+ :"r"(addr));
+
+ return ret;
}
static __inline__ unsigned int
xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned int ret;
+ unsigned long addr = ((unsigned long) base) + offset;
+ unsigned int ret;
+
+ __asm__ __volatile__("lda [%1] %2, %0":"=r"(ret)
+ :"r"(addr), "i"(ASI_PL));
- __asm__ __volatile__("lda [%1] %2, %0"
- : "=r" (ret)
- : "r" (addr), "i" (ASI_PL));
- return ret;
+ return ret;
}
static __inline__ void
xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
- __asm__ __volatile__("stba %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
- barrier();
+ __asm__ __volatile__("stba %0, [%1] %2": /* No outputs */
+ :"r"(val), "r"(addr), "i"(ASI_PL));
+
+ barrier();
}
static __inline__ void
xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
+
+ __asm__ __volatile__("sth %0, [%1]": /* No outputs */
+ :"r"(val), "r"(addr));
- __asm__ __volatile__("sth %0, [%1]"
- : /* No outputs */
- : "r" (val), "r" (addr));
- barrier();
+ barrier();
}
static __inline__ void
xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
+
+ __asm__ __volatile__("stha %0, [%1] %2": /* No outputs */
+ :"r"(val), "r"(addr), "i"(ASI_PL));
- __asm__ __volatile__("stha %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
- barrier();
+ barrier();
}
static __inline__ void
xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
+
+ __asm__ __volatile__("st %0, [%1]": /* No outputs */
+ :"r"(val), "r"(addr));
- __asm__ __volatile__("st %0, [%1]"
- : /* No outputs */
- : "r" (val), "r" (addr));
- barrier();
+ barrier();
}
static __inline__ void
xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
+
+ __asm__ __volatile__("sta %0, [%1] %2": /* No outputs */
+ :"r"(val), "r"(addr), "i"(ASI_PL));
- __asm__ __volatile__("sta %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
- barrier();
+ barrier();
}
static __inline__ void
xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
- __asm__ __volatile__("stba %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
+ __asm__ __volatile__("stba %0, [%1] %2": /* No outputs */
+ :"r"(val), "r"(addr), "i"(ASI_PL));
}
static __inline__ void
xf86WriteMmio16BeNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
- __asm__ __volatile__("sth %0, [%1]"
- : /* No outputs */
- : "r" (val), "r" (addr));
+ __asm__ __volatile__("sth %0, [%1]": /* No outputs */
+ :"r"(val), "r"(addr));
}
static __inline__ void
xf86WriteMmio16LeNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
- __asm__ __volatile__("stha %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
+ __asm__ __volatile__("stha %0, [%1] %2": /* No outputs */
+ :"r"(val), "r"(addr), "i"(ASI_PL));
}
static __inline__ void
xf86WriteMmio32BeNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
- __asm__ __volatile__("st %0, [%1]"
- : /* No outputs */
- : "r" (val), "r" (addr));
+ __asm__ __volatile__("st %0, [%1]": /* No outputs */
+ :"r"(val), "r"(addr));
}
static __inline__ void
xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
- __asm__ __volatile__("sta %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
+ __asm__ __volatile__("sta %0, [%1] %2": /* No outputs */
+ :"r"(val), "r"(addr), "i"(ASI_PL));
}
-# elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
-# ifdef __arm32__
-# define PORT_SIZE long
-# else
-# define PORT_SIZE short
-# endif
+#elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
+#ifdef __arm32__
+#define PORT_SIZE long
+#else
+#define PORT_SIZE short
+#endif
-_X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */
+_X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */
static __inline__ void
outb(unsigned PORT_SIZE port, unsigned char val)
{
- *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
+ *(volatile unsigned char *) (((unsigned PORT_SIZE) (port)) + IOPortBase) =
+ val;
}
static __inline__ void
outw(unsigned PORT_SIZE port, unsigned short val)
{
- *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
+ *(volatile unsigned short *) (((unsigned PORT_SIZE) (port)) + IOPortBase) =
+ val;
}
static __inline__ void
outl(unsigned PORT_SIZE port, unsigned int val)
{
- *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
+ *(volatile unsigned int *) (((unsigned PORT_SIZE) (port)) + IOPortBase) =
+ val;
}
static __inline__ unsigned int
inb(unsigned PORT_SIZE port)
{
- return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase);
+ return *(volatile unsigned char *) (((unsigned PORT_SIZE) (port)) +
+ IOPortBase);
}
static __inline__ unsigned int
inw(unsigned PORT_SIZE port)
{
- return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase);
+ return *(volatile unsigned short *) (((unsigned PORT_SIZE) (port)) +
+ IOPortBase);
}
static __inline__ unsigned int
inl(unsigned PORT_SIZE port)
{
- return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase);
+ return *(volatile unsigned int *) (((unsigned PORT_SIZE) (port)) +
+ IOPortBase);
}
-
-# if defined(__mips__)
-# ifdef linux /* don't mess with other OSs */
-# if X_BYTE_ORDER == X_BIG_ENDIAN
+#if defined(__mips__)
+#ifdef linux /* don't mess with other OSs */
+#if X_BYTE_ORDER == X_BIG_ENDIAN
static __inline__ unsigned int
xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned int ret;
+ unsigned long addr = ((unsigned long) base) + offset;
+ unsigned int ret;
- __asm__ __volatile__("lw %0, 0(%1)"
- : "=r" (ret)
- : "r" (addr));
- return ret;
+ __asm__ __volatile__("lw %0, 0(%1)":"=r"(ret)
+ :"r"(addr));
+
+ return ret;
}
static __inline__ void
xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
- __asm__ __volatile__("sw %0, 0(%1)"
- : /* No outputs */
- : "r" (val), "r" (addr));
+ __asm__ __volatile__("sw %0, 0(%1)": /* No outputs */
+ :"r"(val), "r"(addr));
}
-# endif
-# endif /* !linux */
-# endif /* __mips__ */
+#endif
+#endif /* !linux */
+#endif /* __mips__ */
-# elif (defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
+#elif (defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
-# ifndef MAP_FAILED
-# define MAP_FAILED ((void *)-1)
-# endif
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
extern _X_EXPORT volatile unsigned char *ioBase;
static __inline__ unsigned char
xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
{
- register unsigned char val;
- __asm__ __volatile__(
- "lbzx %0,%1,%2\n\t"
- "eieio"
- : "=r" (val)
- : "b" (base), "r" (offset),
- "m" (*((volatile unsigned char *)base+offset)));
- return val;
+ register unsigned char val;
+ __asm__ __volatile__("lbzx %0,%1,%2\n\t" "eieio":"=r"(val)
+ :"b"(base), "r"(offset),
+ "m"(*((volatile unsigned char *) base + offset)));
+ return val;
}
static __inline__ unsigned short
xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset)
{
- register unsigned short val;
- __asm__ __volatile__(
- "lhzx %0,%1,%2\n\t"
- "eieio"
- : "=r" (val)
- : "b" (base), "r" (offset),
- "m" (*((volatile unsigned char *)base+offset)));
- return val;
+ register unsigned short val;
+ __asm__ __volatile__("lhzx %0,%1,%2\n\t" "eieio":"=r"(val)
+ :"b"(base), "r"(offset),
+ "m"(*((volatile unsigned char *) base + offset)));
+ return val;
}
static __inline__ unsigned short
xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset)
{
- register unsigned short val;
- __asm__ __volatile__(
- "lhbrx %0,%1,%2\n\t"
- "eieio"
- : "=r" (val)
- : "b" (base), "r" (offset),
- "m" (*((volatile unsigned char *)base+offset)));
- return val;
+ register unsigned short val;
+ __asm__ __volatile__("lhbrx %0,%1,%2\n\t" "eieio":"=r"(val)
+ :"b"(base), "r"(offset),
+ "m"(*((volatile unsigned char *) base + offset)));
+ return val;
}
static __inline__ unsigned int
xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
{
- register unsigned int val;
- __asm__ __volatile__(
- "lwzx %0,%1,%2\n\t"
- "eieio"
- : "=r" (val)
- : "b" (base), "r" (offset),
- "m" (*((volatile unsigned char *)base+offset)));
- return val;
+ register unsigned int val;
+ __asm__ __volatile__("lwzx %0,%1,%2\n\t" "eieio":"=r"(val)
+ :"b"(base), "r"(offset),
+ "m"(*((volatile unsigned char *) base + offset)));
+ return val;
}
static __inline__ unsigned int
xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
{
- register unsigned int val;
- __asm__ __volatile__(
- "lwbrx %0,%1,%2\n\t"
- "eieio"
- : "=r" (val)
- : "b" (base), "r" (offset),
- "m" (*((volatile unsigned char *)base+offset)));
- return val;
+ register unsigned int val;
+ __asm__ __volatile__("lwbrx %0,%1,%2\n\t" "eieio":"=r"(val)
+ :"b"(base), "r"(offset),
+ "m"(*((volatile unsigned char *) base + offset)));
+ return val;
}
static __inline__ void
xf86WriteMmioNB8(__volatile__ void *base, const unsigned long offset,
- const unsigned char val)
+ const unsigned char val)
{
- __asm__ __volatile__(
- "stbx %1,%2,%3\n\t"
- : "=m" (*((volatile unsigned char *)base+offset))
- : "r" (val), "b" (base), "r" (offset));
+ __asm__
+ __volatile__("stbx %1,%2,%3\n\t":"=m"
+ (*((volatile unsigned char *) base + offset))
+ :"r"(val), "b"(base), "r"(offset));
}
static __inline__ void
xf86WriteMmioNB16Le(__volatile__ void *base, const unsigned long offset,
- const unsigned short val)
+ const unsigned short val)
{
- __asm__ __volatile__(
- "sthbrx %1,%2,%3\n\t"
- : "=m" (*((volatile unsigned char *)base+offset))
- : "r" (val), "b" (base), "r" (offset));
+ __asm__
+ __volatile__("sthbrx %1,%2,%3\n\t":"=m"
+ (*((volatile unsigned char *) base + offset))
+ :"r"(val), "b"(base), "r"(offset));
}
static __inline__ void
xf86WriteMmioNB16Be(__volatile__ void *base, const unsigned long offset,
- const unsigned short val)
+ const unsigned short val)
{
- __asm__ __volatile__(
- "sthx %1,%2,%3\n\t"
- : "=m" (*((volatile unsigned char *)base+offset))
- : "r" (val), "b" (base), "r" (offset));
+ __asm__
+ __volatile__("sthx %1,%2,%3\n\t":"=m"
+ (*((volatile unsigned char *) base + offset))
+ :"r"(val), "b"(base), "r"(offset));
}
static __inline__ void
xf86WriteMmioNB32Le(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- __asm__ __volatile__(
- "stwbrx %1,%2,%3\n\t"
- : "=m" (*((volatile unsigned char *)base+offset))
- : "r" (val), "b" (base), "r" (offset));
+ __asm__
+ __volatile__("stwbrx %1,%2,%3\n\t":"=m"
+ (*((volatile unsigned char *) base + offset))
+ :"r"(val), "b"(base), "r"(offset));
}
static __inline__ void
xf86WriteMmioNB32Be(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- __asm__ __volatile__(
- "stwx %1,%2,%3\n\t"
- : "=m" (*((volatile unsigned char *)base+offset))
- : "r" (val), "b" (base), "r" (offset));
+ __asm__
+ __volatile__("stwx %1,%2,%3\n\t":"=m"
+ (*((volatile unsigned char *) base + offset))
+ :"r"(val), "b"(base), "r"(offset));
}
static __inline__ void
xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
const unsigned char val)
{
- xf86WriteMmioNB8(base, offset, val);
- eieio();
+ xf86WriteMmioNB8(base, offset, val);
+ eieio();
}
static __inline__ void
xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
const unsigned short val)
{
- xf86WriteMmioNB16Le(base, offset, val);
- eieio();
+ xf86WriteMmioNB16Le(base, offset, val);
+ eieio();
}
static __inline__ void
xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
const unsigned short val)
{
- xf86WriteMmioNB16Be(base, offset, val);
- eieio();
+ xf86WriteMmioNB16Be(base, offset, val);
+ eieio();
}
static __inline__ void
xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
- xf86WriteMmioNB32Le(base, offset, val);
- eieio();
+ xf86WriteMmioNB32Le(base, offset, val);
+ eieio();
}
static __inline__ void
xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
- xf86WriteMmioNB32Be(base, offset, val);
- eieio();
+ xf86WriteMmioNB32Be(base, offset, val);
+ eieio();
}
-
static __inline__ void
outb(unsigned short port, unsigned char value)
{
- if(ioBase == MAP_FAILED) return;
- xf86WriteMmio8((void *)ioBase, port, value);
+ if (ioBase == MAP_FAILED)
+ return;
+ xf86WriteMmio8((void *) ioBase, port, value);
}
static __inline__ void
outw(unsigned short port, unsigned short value)
{
- if(ioBase == MAP_FAILED) return;
- xf86WriteMmio16Le((void *)ioBase, port, value);
+ if (ioBase == MAP_FAILED)
+ return;
+ xf86WriteMmio16Le((void *) ioBase, port, value);
}
static __inline__ void
outl(unsigned short port, unsigned int value)
{
- if(ioBase == MAP_FAILED) return;
- xf86WriteMmio32Le((void *)ioBase, port, value);
+ if (ioBase == MAP_FAILED)
+ return;
+ xf86WriteMmio32Le((void *) ioBase, port, value);
}
static __inline__ unsigned int
inb(unsigned short port)
{
- if(ioBase == MAP_FAILED) return 0;
- return xf86ReadMmio8((void *)ioBase, port);
+ if (ioBase == MAP_FAILED)
+ return 0;
+ return xf86ReadMmio8((void *) ioBase, port);
}
static __inline__ unsigned int
inw(unsigned short port)
{
- if(ioBase == MAP_FAILED) return 0;
- return xf86ReadMmio16Le((void *)ioBase, port);
+ if (ioBase == MAP_FAILED)
+ return 0;
+ return xf86ReadMmio16Le((void *) ioBase, port);
}
static __inline__ unsigned int
inl(unsigned short port)
{
- if(ioBase == MAP_FAILED) return 0;
- return xf86ReadMmio32Le((void *)ioBase, port);
+ if (ioBase == MAP_FAILED)
+ return 0;
+ return xf86ReadMmio32Le((void *) ioBase, port);
}
#elif defined(__arm__) && defined(__linux__)
@@ -999,7 +1008,7 @@ xf_outl(unsigned short port, unsigned int val)
#define outw xf_outw
#define outl xf_outl
-# elif defined(__nds32__)
+#elif defined(__nds32__)
/*
* Assume all port access are aligned. We need to revise this implementation
@@ -1007,352 +1016,326 @@ xf_outl(unsigned short port, unsigned int val)
* stw_u, they are assumed unaligned.
*/
-#define barrier() /* no barrier */
+#define barrier() /* no barrier */
#define PORT_SIZE long
static __inline__ unsigned char
xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
{
- return *(volatile unsigned char *)((unsigned char *)base + offset) ;
+ return *(volatile unsigned char *) ((unsigned char *) base + offset);
}
static __inline__ void
xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- *(volatile unsigned char *)((unsigned char *)base + offset) = val ;
- barrier();
+ *(volatile unsigned char *) ((unsigned char *) base + offset) = val;
+ barrier();
}
static __inline__ void
xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- *(volatile unsigned char *)((unsigned char *)base + offset) = val ;
+ *(volatile unsigned char *) ((unsigned char *) base + offset) = val;
}
static __inline__ unsigned short
xf86ReadMmio16Swap(__volatile__ void *base, const unsigned long offset)
{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned short ret;
+ unsigned long addr = ((unsigned long) base) + offset;
+ unsigned short ret;
- __asm__ __volatile__(
- "lhi %0, [%1];\n\t"
- "wsbh %0, %0;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
+ __asm__ __volatile__("lhi %0, [%1];\n\t" "wsbh %0, %0;\n\t":"=r"(ret)
+ :"r"(addr));
+
+ return ret;
}
static __inline__ unsigned short
xf86ReadMmio16(__volatile__ void *base, const unsigned long offset)
{
- return *(volatile unsigned short *)((char *)base + offset) ;
+ return *(volatile unsigned short *) ((char *) base + offset);
}
static __inline__ void
xf86WriteMmio16Swap(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
+
+ __asm__ __volatile__("wsbh %0, %0;\n\t" "shi %0, [%1];\n\t": /* No outputs */
+ :"r"(val), "r"(addr));
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "shi %0, [%1];\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
- barrier();
+ barrier();
}
static __inline__ void
xf86WriteMmio16(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- *(volatile unsigned short *)((unsigned char *)base + offset) = val ;
- barrier();
+ *(volatile unsigned short *) ((unsigned char *) base + offset) = val;
+ barrier();
}
static __inline__ void
xf86WriteMmio16SwapNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "shi %0, [%1];\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
+ __asm__ __volatile__("wsbh %0, %0;\n\t" "shi %0, [%1];\n\t": /* No outputs */
+ :"r"(val), "r"(addr));
}
static __inline__ void
xf86WriteMmio16NB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- *(volatile unsigned short *)((unsigned char *)base + offset) = val ;
+ *(volatile unsigned short *) ((unsigned char *) base + offset) = val;
}
static __inline__ unsigned int
xf86ReadMmio32Swap(__volatile__ void *base, const unsigned long offset)
{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned int ret;
+ unsigned long addr = ((unsigned long) base) + offset;
+ unsigned int ret;
+
+ __asm__ __volatile__("lwi %0, [%1];\n\t"
+ "wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t":"=r"(ret)
+ :"r"(addr));
- __asm__ __volatile__(
- "lwi %0, [%1];\n\t"
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
+ return ret;
}
static __inline__ unsigned int
xf86ReadMmio32(__volatile__ void *base, const unsigned long offset)
{
- return *(volatile unsigned int *)((unsigned char *)base + offset) ;
+ return *(volatile unsigned int *) ((unsigned char *) base + offset);
}
static __inline__ void
xf86WriteMmio32Swap(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- "swi %0, [%1];\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
- barrier();
+ __asm__ __volatile__("wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t" "swi %0, [%1];\n\t": /* No outputs */
+ :"r"(val), "r"(addr));
+
+ barrier();
}
static __inline__ void
xf86WriteMmio32(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- *(volatile unsigned int *)((unsigned char *)base + offset) = val ;
- barrier();
+ *(volatile unsigned int *) ((unsigned char *) base + offset) = val;
+ barrier();
}
static __inline__ void
xf86WriteMmio32SwapNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- unsigned long addr = ((unsigned long)base) + offset;
+ unsigned long addr = ((unsigned long) base) + offset;
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- "swi %0, [%1];\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
+ __asm__ __volatile__("wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t" "swi %0, [%1];\n\t": /* No outputs */
+ :"r"(val), "r"(addr));
}
static __inline__ void
xf86WriteMmio32NB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
+ const unsigned int val)
{
- *(volatile unsigned int *)((unsigned char *)base + offset) = val ;
+ *(volatile unsigned int *) ((unsigned char *) base + offset) = val;
}
-# if defined(NDS32_MMIO_SWAP)
+#if defined(NDS32_MMIO_SWAP)
static __inline__ void
outb(unsigned PORT_SIZE port, unsigned char val)
{
- xf86WriteMmio8(IOPortBase, port, val);
+ xf86WriteMmio8(IOPortBase, port, val);
}
static __inline__ void
outw(unsigned PORT_SIZE port, unsigned short val)
{
- xf86WriteMmio16Swap(IOPortBase, port, val);
+ xf86WriteMmio16Swap(IOPortBase, port, val);
}
static __inline__ void
outl(unsigned PORT_SIZE port, unsigned int val)
{
- xf86WriteMmio32Swap(IOPortBase, port, val);
+ xf86WriteMmio32Swap(IOPortBase, port, val);
}
static __inline__ unsigned int
inb(unsigned PORT_SIZE port)
{
- return xf86ReadMmio8(IOPortBase, port);
+ return xf86ReadMmio8(IOPortBase, port);
}
static __inline__ unsigned int
inw(unsigned PORT_SIZE port)
{
- return xf86ReadMmio16Swap(IOPortBase, port);
+ return xf86ReadMmio16Swap(IOPortBase, port);
}
static __inline__ unsigned int
inl(unsigned PORT_SIZE port)
{
- return xf86ReadMmio32Swap(IOPortBase, port);
+ return xf86ReadMmio32Swap(IOPortBase, port);
}
-static __inline__ unsigned long ldq_u(unsigned long *p)
+static __inline__ unsigned long
+ldq_u(unsigned long *p)
{
- unsigned long addr = (unsigned long)p;
- unsigned int ret;
+ unsigned long addr = (unsigned long) p;
+ unsigned int ret;
+
+ __asm__ __volatile__("lmw.bi %0, [%1], %0, 0;\n\t"
+ "wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t":"=r"(ret)
+ :"r"(addr));
- __asm__ __volatile__(
- "lmw.bi %0, [%1], %0, 0;\n\t"
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
+ return ret;
}
-static __inline__ unsigned long ldl_u(unsigned int *p)
+static __inline__ unsigned long
+ldl_u(unsigned int *p)
{
- unsigned long addr = (unsigned long)p;
- unsigned int ret;
+ unsigned long addr = (unsigned long) p;
+ unsigned int ret;
- __asm__ __volatile__(
- "lmw.bi %0, [%1], %0, 0;\n\t"
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
+ __asm__ __volatile__("lmw.bi %0, [%1], %0, 0;\n\t"
+ "wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t":"=r"(ret)
+ :"r"(addr));
+
+ return ret;
}
-static __inline__ void stq_u(unsigned long val, unsigned long *p)
+static __inline__ void
+stq_u(unsigned long val, unsigned long *p)
{
- unsigned long addr = (unsigned long)p;
+ unsigned long addr = (unsigned long) p;
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- "smw.bi %0, [%1], %0, 0;\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
+ __asm__ __volatile__("wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t" "smw.bi %0, [%1], %0, 0;\n\t": /* No outputs */
+ :"r"(val), "r"(addr));
}
-static __inline__ void stl_u(unsigned long val, unsigned int *p)
+static __inline__ void
+stl_u(unsigned long val, unsigned int *p)
{
- unsigned long addr = (unsigned long)p;
+ unsigned long addr = (unsigned long) p;
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- "smw.bi %0, [%1], %0, 0;\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
+ __asm__ __volatile__("wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t" "smw.bi %0, [%1], %0, 0;\n\t": /* No outputs */
+ :"r"(val), "r"(addr));
}
-# else /* !NDS32_MMIO_SWAP */
+#else /* !NDS32_MMIO_SWAP */
static __inline__ void
outb(unsigned PORT_SIZE port, unsigned char val)
{
- *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))) = val;
- barrier();
+ *(volatile unsigned char *) (((unsigned PORT_SIZE) (port))) = val;
+ barrier();
}
static __inline__ void
outw(unsigned PORT_SIZE port, unsigned short val)
{
- *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))) = val;
- barrier();
+ *(volatile unsigned short *) (((unsigned PORT_SIZE) (port))) = val;
+ barrier();
}
static __inline__ void
outl(unsigned PORT_SIZE port, unsigned int val)
{
- *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))) = val;
- barrier();
+ *(volatile unsigned int *) (((unsigned PORT_SIZE) (port))) = val;
+ barrier();
}
+
static __inline__ unsigned int
inb(unsigned PORT_SIZE port)
{
- return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port)));
+ return *(volatile unsigned char *) (((unsigned PORT_SIZE) (port)));
}
static __inline__ unsigned int
inw(unsigned PORT_SIZE port)
{
- return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port)));
+ return *(volatile unsigned short *) (((unsigned PORT_SIZE) (port)));
}
static __inline__ unsigned int
inl(unsigned PORT_SIZE port)
{
- return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port)));
+ return *(volatile unsigned int *) (((unsigned PORT_SIZE) (port)));
}
-static __inline__ unsigned long ldq_u(unsigned long *p)
+static __inline__ unsigned long
+ldq_u(unsigned long *p)
{
- unsigned long addr = (unsigned long)p;
- unsigned int ret;
+ unsigned long addr = (unsigned long) p;
+ unsigned int ret;
- __asm__ __volatile__(
- "lmw.bi %0, [%1], %0, 0;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
+ __asm__ __volatile__("lmw.bi %0, [%1], %0, 0;\n\t":"=r"(ret)
+ :"r"(addr));
+
+ return ret;
}
-static __inline__ unsigned long ldl_u(unsigned int *p)
+static __inline__ unsigned long
+ldl_u(unsigned int *p)
{
- unsigned long addr = (unsigned long)p;
- unsigned int ret;
+ unsigned long addr = (unsigned long) p;
+ unsigned int ret;
- __asm__ __volatile__(
- "lmw.bi %0, [%1], %0, 0;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
-}
+ __asm__ __volatile__("lmw.bi %0, [%1], %0, 0;\n\t":"=r"(ret)
+ :"r"(addr));
+ return ret;
+}
-static __inline__ void stq_u(unsigned long val, unsigned long *p)
+static __inline__ void
+stq_u(unsigned long val, unsigned long *p)
{
- unsigned long addr = (unsigned long)p;
+ unsigned long addr = (unsigned long) p;
- __asm__ __volatile__(
- "smw.bi %0, [%1], %0, 0;\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
+ __asm__ __volatile__("smw.bi %0, [%1], %0, 0;\n\t": /* No outputs */
+ :"r"(val), "r"(addr));
}
-static __inline__ void stl_u(unsigned long val, unsigned int *p)
+static __inline__ void
+stl_u(unsigned long val, unsigned int *p)
{
- unsigned long addr = (unsigned long)p;
+ unsigned long addr = (unsigned long) p;
- __asm__ __volatile__(
- "smw.bi %0, [%1], %0, 0;\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
+ __asm__ __volatile__("smw.bi %0, [%1], %0, 0;\n\t": /* No outputs */
+ :"r"(val), "r"(addr));
}
-# endif /* NDS32_MMIO_SWAP */
+#endif /* NDS32_MMIO_SWAP */
-# if (((X_BYTE_ORDER == X_BIG_ENDIAN) && !defined(NDS32_MMIO_SWAP)) || ((X_BYTE_ORDER != X_BIG_ENDIAN) && defined(NDS32_MMIO_SWAP)))
-# define ldw_u(p) ((*(unsigned char *)(p)) << 8 | \
+#if (((X_BYTE_ORDER == X_BIG_ENDIAN) && !defined(NDS32_MMIO_SWAP)) || ((X_BYTE_ORDER != X_BIG_ENDIAN) && defined(NDS32_MMIO_SWAP)))
+#define ldw_u(p) ((*(unsigned char *)(p)) << 8 | \
(*((unsigned char *)(p)+1)))
-# define stw_u(v,p) (*(unsigned char *)(p)) = ((v) >> 8); \
+#define stw_u(v,p) (*(unsigned char *)(p)) = ((v) >> 8); \
(*((unsigned char *)(p)+1)) = (v)
-# else
-# define ldw_u(p) ((*(unsigned char *)(p)) | \
+#else
+#define ldw_u(p) ((*(unsigned char *)(p)) | \
(*((unsigned char *)(p)+1)<<8))
-# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
+#define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
(*((unsigned char *)(p)+1)) = ((v) >> 8)
-# endif
+#endif
-# define mem_barrier() /* XXX: nop for now */
-# define write_mem_barrier() /* XXX: nop for now */
+#define mem_barrier() /* XXX: nop for now */
+#define write_mem_barrier() /* XXX: nop for now */
-# else /* ix86 */
+#else /* ix86 */
-# if !defined(__SUNPRO_C)
-# if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__m32r__)
-# ifdef GCCUSESGAS
+#if !defined(__SUNPRO_C)
+#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__m32r__)
+#ifdef GCCUSESGAS
/*
* If gcc uses gas rather than the native assembler, the syntax of these
@@ -1362,105 +1345,98 @@ static __inline__ void stl_u(unsigned long val, unsigned int *p)
static __inline__ void
outb(unsigned short port, unsigned char val)
{
- __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
+ __asm__ __volatile__("outb %0,%1"::"a"(val), "d"(port));
}
-
static __inline__ void
outw(unsigned short port, unsigned short val)
{
- __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
+ __asm__ __volatile__("outw %0,%1"::"a"(val), "d"(port));
}
static __inline__ void
outl(unsigned short port, unsigned int val)
{
- __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+ __asm__ __volatile__("outl %0,%1"::"a"(val), "d"(port));
}
static __inline__ unsigned int
inb(unsigned short port)
{
- unsigned char ret;
- __asm__ __volatile__("inb %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ unsigned char ret;
+ __asm__ __volatile__("inb %1,%0":"=a"(ret):"d"(port));
+
+ return ret;
}
static __inline__ unsigned int
inw(unsigned short port)
{
- unsigned short ret;
- __asm__ __volatile__("inw %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ unsigned short ret;
+ __asm__ __volatile__("inw %1,%0":"=a"(ret):"d"(port));
+
+ return ret;
}
static __inline__ unsigned int
inl(unsigned short port)
{
- unsigned int ret;
- __asm__ __volatile__("inl %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ unsigned int ret;
+ __asm__ __volatile__("inl %1,%0":"=a"(ret):"d"(port));
+
+ return ret;
}
-# else /* GCCUSESGAS */
+#else /* GCCUSESGAS */
static __inline__ void
outb(unsigned short port, unsigned char val)
{
- __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port));
+ __asm__ __volatile__("out%B0 (%1)"::"a"(val), "d"(port));
}
static __inline__ void
outw(unsigned short port, unsigned short val)
{
- __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port));
+ __asm__ __volatile__("out%W0 (%1)"::"a"(val), "d"(port));
}
static __inline__ void
outl(unsigned short port, unsigned int val)
{
- __asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port));
+ __asm__ __volatile__("out%L0 (%1)"::"a"(val), "d"(port));
}
static __inline__ unsigned int
inb(unsigned short port)
{
- unsigned char ret;
- __asm__ __volatile__("in%B0 (%1)" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ unsigned char ret;
+ __asm__ __volatile__("in%B0 (%1)":"=a"(ret):"d"(port));
+
+ return ret;
}
static __inline__ unsigned int
inw(unsigned short port)
{
- unsigned short ret;
- __asm__ __volatile__("in%W0 (%1)" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ unsigned short ret;
+ __asm__ __volatile__("in%W0 (%1)":"=a"(ret):"d"(port));
+
+ return ret;
}
static __inline__ unsigned int
inl(unsigned short port)
{
- unsigned int ret;
- __asm__ __volatile__("in%L0 (%1)" :
- "=a" (ret) :
- "d" (port));
- return ret;
+ unsigned int ret;
+ __asm__ __volatile__("in%L0 (%1)":"=a"(ret):"d"(port));
+
+ return ret;
}
-# endif /* GCCUSESGAS */
+#endif /* GCCUSESGAS */
-# else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__m32r__) */
+#else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__m32r__) */
static __inline__ void
outb(unsigned short port, unsigned char val)
@@ -1480,141 +1456,143 @@ outl(unsigned short port, unsigned int val)
static __inline__ unsigned int
inb(unsigned short port)
{
- return 0;
+ return 0;
}
static __inline__ unsigned int
inw(unsigned short port)
{
- return 0;
+ return 0;
}
static __inline__ unsigned int
inl(unsigned short port)
{
- return 0;
+ return 0;
}
-# endif /* FAKEIT */
-# endif /* __SUNPRO_C */
+#endif /* FAKEIT */
+#endif /* __SUNPRO_C */
-# endif /* ix86 */
+#endif /* ix86 */
-# else /* !GNUC */
-# if defined(__STDC__) && (__STDC__ == 1)
-# ifndef asm
-# define asm __asm
-# endif
-# endif
-# if !defined(__SUNPRO_C) && !defined(_MSC_VER)
-# include <sys/inline.h>
-# endif
-# if (!defined(__HIGHC__) && !defined(__SUNPRO_C) && !defined(_MSC_VER)) || \
+#else /* !GNUC */
+#if defined(__STDC__) && (__STDC__ == 1)
+#ifndef asm
+#define asm __asm
+#endif
+#endif
+#if !defined(__SUNPRO_C) && !defined(_MSC_VER)
+#include <sys/inline.h>
+#endif
+#if (!defined(__HIGHC__) && !defined(__SUNPRO_C) && !defined(_MSC_VER)) || \
defined(__USLC__)
-# pragma asm partial_optimization outl
-# pragma asm partial_optimization outw
-# pragma asm partial_optimization outb
-# pragma asm partial_optimization inl
-# pragma asm partial_optimization inw
-# pragma asm partial_optimization inb
-# endif
-# endif /* __GNUC__ */
-
-# endif /* NO_INLINE */
-
-# ifdef __alpha__
+#pragma asm partial_optimization outl
+#pragma asm partial_optimization outw
+#pragma asm partial_optimization outb
+#pragma asm partial_optimization inl
+#pragma asm partial_optimization inw
+#pragma asm partial_optimization inb
+#endif
+#endif /* __GNUC__ */
+
+#endif /* NO_INLINE */
+
+#ifdef __alpha__
/* entry points for Mmio memory access routines */
-extern _X_EXPORT int (*xf86ReadMmio8)(void *, unsigned long);
-extern _X_EXPORT int (*xf86ReadMmio16)(void *, unsigned long);
-# ifndef STANDALONE_MMIO
-extern _X_EXPORT int (*xf86ReadMmio32)(void *, unsigned long);
-# else
+extern _X_EXPORT int (*xf86ReadMmio8) (void *, unsigned long);
+extern _X_EXPORT int (*xf86ReadMmio16) (void *, unsigned long);
+
+#ifndef STANDALONE_MMIO
+extern _X_EXPORT int (*xf86ReadMmio32) (void *, unsigned long);
+#else
/* Some DRI 3D drivers need MMIO_IN32. */
static __inline__ int
xf86ReadMmio32(void *Base, unsigned long Offset)
{
- mem_barrier();
- return *(volatile unsigned int*)((unsigned long)Base+(Offset));
-}
-# endif
-extern _X_EXPORT void (*xf86WriteMmio8)(int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmio16)(int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmio32)(int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmioNB8)(int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmioNB16)(int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmioNB32)(int, void *, unsigned long);
-extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
+ mem_barrier();
+ return *(volatile unsigned int *) ((unsigned long) Base + (Offset));
+}
+#endif
+extern _X_EXPORT void (*xf86WriteMmio8) (int, void *, unsigned long);
+extern _X_EXPORT void (*xf86WriteMmio16) (int, void *, unsigned long);
+extern _X_EXPORT void (*xf86WriteMmio32) (int, void *, unsigned long);
+extern _X_EXPORT void (*xf86WriteMmioNB8) (int, void *, unsigned long);
+extern _X_EXPORT void (*xf86WriteMmioNB16) (int, void *, unsigned long);
+extern _X_EXPORT void (*xf86WriteMmioNB32) (int, void *, unsigned long);
+extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *,
+ int);
extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
/* Some macros to hide the system dependencies for MMIO accesses */
/* Changed to kill noise generated by gcc's -Wcast-align */
-# define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset)
-# define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset)
-# ifndef STANDALONE_MMIO
-# define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset)
-# else
-# define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
-# endif
-
-# define MMIO_OUT32(base, offset, val) \
+#define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset)
+#define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset)
+#ifndef STANDALONE_MMIO
+#define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset)
+#else
+#define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
+#endif
+
+#define MMIO_OUT32(base, offset, val) \
do { \
write_mem_barrier(); \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
} while (0)
-# define MMIO_ONB32(base, offset, val) \
+#define MMIO_ONB32(base, offset, val) \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
-# define MMIO_OUT8(base, offset, val) \
+#define MMIO_OUT8(base, offset, val) \
(*xf86WriteMmio8)((CARD8)(val), base, offset)
-# define MMIO_OUT16(base, offset, val) \
+#define MMIO_OUT16(base, offset, val) \
(*xf86WriteMmio16)((CARD16)(val), base, offset)
-# define MMIO_ONB8(base, offset, val) \
+#define MMIO_ONB8(base, offset, val) \
(*xf86WriteMmioNB8)((CARD8)(val), base, offset)
-# define MMIO_ONB16(base, offset, val) \
+#define MMIO_ONB16(base, offset, val) \
(*xf86WriteMmioNB16)((CARD16)(val), base, offset)
-# define MMIO_MOVE32(base, offset, val) \
+#define MMIO_MOVE32(base, offset, val) \
MMIO_OUT32(base, offset, val)
-# elif defined(__powerpc__)
+#elif defined(__powerpc__)
/*
* we provide byteswapping and no byteswapping functions here
* with byteswapping as default,
* drivers that don't need byteswapping should define PPC_MMIO_IS_BE
*/
-# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
-# define MMIO_OUT8(base, offset, val) \
+#define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
+#define MMIO_OUT8(base, offset, val) \
xf86WriteMmio8(base, offset, (CARD8)(val))
-# define MMIO_ONB8(base, offset, val) \
+#define MMIO_ONB8(base, offset, val) \
xf86WriteMmioNB8(base, offset, (CARD8)(val))
-# if defined(PPC_MMIO_IS_BE) /* No byteswapping */
-# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
-# define MMIO_OUT16(base, offset, val) \
+#if defined(PPC_MMIO_IS_BE) /* No byteswapping */
+#define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
+#define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
+#define MMIO_OUT16(base, offset, val) \
xf86WriteMmio16Be(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
+#define MMIO_OUT32(base, offset, val) \
xf86WriteMmio32Be(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
+#define MMIO_ONB16(base, offset, val) \
xf86WriteMmioNB16Be(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
+#define MMIO_ONB32(base, offset, val) \
xf86WriteMmioNB32Be(base, offset, (CARD32)(val))
-# else /* byteswapping is the default */
-# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
-# define MMIO_OUT16(base, offset, val) \
+#else /* byteswapping is the default */
+#define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
+#define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
+#define MMIO_OUT16(base, offset, val) \
xf86WriteMmio16Le(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
+#define MMIO_OUT32(base, offset, val) \
xf86WriteMmio32Le(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
+#define MMIO_ONB16(base, offset, val) \
xf86WriteMmioNB16Le(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
+#define MMIO_ONB32(base, offset, val) \
xf86WriteMmioNB32Le(base, offset, (CARD32)(val))
-# endif
+#endif
-# define MMIO_MOVE32(base, offset, val) \
+#define MMIO_MOVE32(base, offset, val) \
xf86WriteMmio32Be(base, offset, (CARD32)(val))
-# elif defined(__sparc__) || defined(sparc) || defined(__sparc)
+#elif defined(__sparc__) || defined(sparc) || defined(__sparc)
/*
* Like powerpc, we provide byteswapping and no byteswapping functions
* here with byteswapping as default, drivers that don't need byteswapping
@@ -1622,133 +1600,129 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
* do not need to use PPC_MMIO_IS_BE and the sparc one in all the same places
* of drivers?).
*/
-# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
-# define MMIO_OUT8(base, offset, val) \
+#define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
+#define MMIO_OUT8(base, offset, val) \
xf86WriteMmio8(base, offset, (CARD8)(val))
-# define MMIO_ONB8(base, offset, val) \
+#define MMIO_ONB8(base, offset, val) \
xf86WriteMmio8NB(base, offset, (CARD8)(val))
-# if defined(SPARC_MMIO_IS_BE) /* No byteswapping */
-# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
-# define MMIO_OUT16(base, offset, val) \
+#if defined(SPARC_MMIO_IS_BE) /* No byteswapping */
+#define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
+#define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
+#define MMIO_OUT16(base, offset, val) \
xf86WriteMmio16Be(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
+#define MMIO_OUT32(base, offset, val) \
xf86WriteMmio32Be(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
+#define MMIO_ONB16(base, offset, val) \
xf86WriteMmio16BeNB(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
+#define MMIO_ONB32(base, offset, val) \
xf86WriteMmio32BeNB(base, offset, (CARD32)(val))
-# else /* byteswapping is the default */
-# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
-# define MMIO_OUT16(base, offset, val) \
+#else /* byteswapping is the default */
+#define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
+#define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
+#define MMIO_OUT16(base, offset, val) \
xf86WriteMmio16Le(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
+#define MMIO_OUT32(base, offset, val) \
xf86WriteMmio32Le(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
+#define MMIO_ONB16(base, offset, val) \
xf86WriteMmio16LeNB(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
+#define MMIO_ONB32(base, offset, val) \
xf86WriteMmio32LeNB(base, offset, (CARD32)(val))
-# endif
+#endif
-# define MMIO_MOVE32(base, offset, val) \
+#define MMIO_MOVE32(base, offset, val) \
xf86WriteMmio32Be(base, offset, (CARD32)(val))
-# elif defined(__nds32__)
+#elif defined(__nds32__)
/*
* we provide byteswapping and no byteswapping functions here
* with no byteswapping as default; when endianness of CPU core
* and I/O devices don't match, byte swapping is necessary
* drivers that need byteswapping should define NDS32_MMIO_SWAP
*/
-# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
-# define MMIO_OUT8(base, offset, val) \
+#define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
+#define MMIO_OUT8(base, offset, val) \
xf86WriteMmio8(base, offset, (CARD8)(val))
-# define MMIO_ONB8(base, offset, val) \
+#define MMIO_ONB8(base, offset, val) \
xf86WriteMmioNB8(base, offset, (CARD8)(val))
-# if defined(NDS32_MMIO_SWAP) /* byteswapping */
-# define MMIO_IN16(base, offset) xf86ReadMmio16Swap(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32Swap(base, offset)
-# define MMIO_OUT16(base, offset, val) \
+#if defined(NDS32_MMIO_SWAP) /* byteswapping */
+#define MMIO_IN16(base, offset) xf86ReadMmio16Swap(base, offset)
+#define MMIO_IN32(base, offset) xf86ReadMmio32Swap(base, offset)
+#define MMIO_OUT16(base, offset, val) \
xf86WriteMmio16Swap(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
+#define MMIO_OUT32(base, offset, val) \
xf86WriteMmio32Swap(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
+#define MMIO_ONB16(base, offset, val) \
xf86WriteMmioNB16Swap(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
+#define MMIO_ONB32(base, offset, val) \
xf86WriteMmioNB32Swap(base, offset, (CARD32)(val))
-# else /* no byteswapping is the default */
-# define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
-# define MMIO_OUT16(base, offset, val) \
+#else /* no byteswapping is the default */
+#define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset)
+#define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
+#define MMIO_OUT16(base, offset, val) \
xf86WriteMmio16(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
+#define MMIO_OUT32(base, offset, val) \
xf86WriteMmio32(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
+#define MMIO_ONB16(base, offset, val) \
xf86WriteMmioNB16(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
+#define MMIO_ONB32(base, offset, val) \
xf86WriteMmioNB32(base, offset, (CARD32)(val))
-# endif
+#endif
-# define MMIO_MOVE32(base, offset, val) \
+#define MMIO_MOVE32(base, offset, val) \
xf86WriteMmio32(base, offset, (CARD32)(val))
-#ifdef N1213_HC /* for NDS32 N1213 hardcore */
-static __inline__ void nds32_flush_icache(char *addr)
+#ifdef N1213_HC /* for NDS32 N1213 hardcore */
+static __inline__ void
+nds32_flush_icache(char *addr)
{
- __asm__ volatile (
- "isync %0;"
- "msync;"
- "isb;"
- "cctl %0,L1I_VA_INVAL;"
- "isb;"
- : : "r"(addr) : "memory");
+ __asm__ volatile ("isync %0;"
+ "msync;"
+ "isb;"
+ "cctl %0,L1I_VA_INVAL;" "isb;"::"r" (addr):"memory");
}
#else
-static __inline__ void nds32_flush_icache(char *addr)
+static __inline__ void
+nds32_flush_icache(char *addr)
{
- __asm__ volatile (
- "isync %0;"
- "isb;"
- : : "r"(addr) : "memory");
+ __asm__ volatile ("isync %0;" "isb;"::"r" (addr):"memory");
}
#endif
-# else /* !__alpha__ && !__powerpc__ && !__sparc__ */
+#else /* !__alpha__ && !__powerpc__ && !__sparc__ */
-# define MMIO_IN8(base, offset) \
+#define MMIO_IN8(base, offset) \
*(volatile CARD8 *)(((CARD8*)(base)) + (offset))
-# define MMIO_IN16(base, offset) \
+#define MMIO_IN16(base, offset) \
*(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset))
-# define MMIO_IN32(base, offset) \
+#define MMIO_IN32(base, offset) \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
-# define MMIO_OUT8(base, offset, val) \
+#define MMIO_OUT8(base, offset, val) \
*(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val)
-# define MMIO_OUT16(base, offset, val) \
+#define MMIO_OUT16(base, offset, val) \
*(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
-# define MMIO_OUT32(base, offset, val) \
+#define MMIO_OUT32(base, offset, val) \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
-# define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val)
-# define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val)
-# define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val)
+#define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val)
+#define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val)
+#define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val)
-# define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val)
+#define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val)
-# endif /* __alpha__ */
+#endif /* __alpha__ */
/*
* With Intel, the version in os-support/misc/SlowBcopy.s is used.
* This avoids port I/O during the copy (which causes problems with
* some hardware).
*/
-# ifdef __alpha__
-# define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count)
-# define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count)
-# else /* __alpha__ */
-# define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count)
-# define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count)
-# endif /* __alpha__ */
-
-#endif /* _COMPILER_H */
+#ifdef __alpha__
+#define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count)
+#define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count)
+#else /* __alpha__ */
+#define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count)
+#define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count)
+#endif /* __alpha__ */
+
+#endif /* _COMPILER_H */
diff --git a/xorg-server/hw/xfree86/common/vidmodeproc.h b/xorg-server/hw/xfree86/common/vidmodeproc.h
index da4d05e1c..aa43237d4 100644
--- a/xorg-server/hw/xfree86/common/vidmodeproc.h
+++ b/xorg-server/hw/xfree86/common/vidmodeproc.h
@@ -8,7 +8,6 @@
#ifndef _VIDMODEPROC_H_
#define _VIDMODEPROC_H_
-
typedef enum {
VIDMODE_H_DISPLAY,
VIDMODE_H_SYNCSTART,
@@ -35,17 +34,20 @@ typedef enum {
} VidModeSelectMonitor;
typedef union {
- pointer ptr;
- int i;
- float f;
+ pointer ptr;
+ int i;
+ float f;
} vidMonitorValue;
extern _X_EXPORT void XFree86VidModeExtensionInit(void);
extern _X_EXPORT Bool VidModeAvailable(int scrnIndex);
-extern _X_EXPORT Bool VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock);
-extern _X_EXPORT Bool VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock);
-extern _X_EXPORT Bool VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock);
+extern _X_EXPORT Bool VidModeGetCurrentModeline(int scrnIndex, pointer *mode,
+ int *dotClock);
+extern _X_EXPORT Bool VidModeGetFirstModeline(int scrnIndex, pointer *mode,
+ int *dotClock);
+extern _X_EXPORT Bool VidModeGetNextModeline(int scrnIndex, pointer *mode,
+ int *dotClock);
extern _X_EXPORT Bool VidModeDeleteModeline(int scrnIndex, pointer mode);
extern _X_EXPORT Bool VidModeZoomViewport(int scrnIndex, int zoom);
extern _X_EXPORT Bool VidModeGetViewPort(int scrnIndex, int *x, int *y);
@@ -55,23 +57,28 @@ extern _X_EXPORT Bool VidModeLockZoom(int scrnIndex, Bool lock);
extern _X_EXPORT Bool VidModeGetMonitor(int scrnIndex, pointer *monitor);
extern _X_EXPORT int VidModeGetNumOfClocks(int scrnIndex, Bool *progClock);
extern _X_EXPORT Bool VidModeGetClocks(int scrnIndex, int *Clocks);
-extern _X_EXPORT ModeStatus VidModeCheckModeForMonitor(int scrnIndex, pointer mode);
-extern _X_EXPORT ModeStatus VidModeCheckModeForDriver(int scrnIndex, pointer mode);
+extern _X_EXPORT ModeStatus VidModeCheckModeForMonitor(int scrnIndex,
+ pointer mode);
+extern _X_EXPORT ModeStatus VidModeCheckModeForDriver(int scrnIndex,
+ pointer mode);
extern _X_EXPORT void VidModeSetCrtcForMode(int scrnIndex, pointer mode);
extern _X_EXPORT Bool VidModeAddModeline(int scrnIndex, pointer mode);
extern _X_EXPORT int VidModeGetDotClock(int scrnIndex, int Clock);
extern _X_EXPORT int VidModeGetNumOfModes(int scrnIndex);
-extern _X_EXPORT Bool VidModeSetGamma(int scrnIndex, float red, float green, float blue);
-extern _X_EXPORT Bool VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue);
+extern _X_EXPORT Bool VidModeSetGamma(int scrnIndex, float red, float green,
+ float blue);
+extern _X_EXPORT Bool VidModeGetGamma(int scrnIndex, float *red, float *green,
+ float *blue);
extern _X_EXPORT pointer VidModeCreateMode(void);
extern _X_EXPORT void VidModeCopyMode(pointer modefrom, pointer modeto);
extern _X_EXPORT int VidModeGetModeValue(pointer mode, int valtyp);
extern _X_EXPORT void VidModeSetModeValue(pointer mode, int valtyp, int val);
-extern _X_EXPORT vidMonitorValue VidModeGetMonitorValue(pointer monitor, int valtyp, int indx);
-extern _X_EXPORT Bool VidModeSetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *);
-extern _X_EXPORT Bool VidModeGetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *);
+extern _X_EXPORT vidMonitorValue VidModeGetMonitorValue(pointer monitor,
+ int valtyp, int indx);
+extern _X_EXPORT Bool VidModeSetGammaRamp(int, int, CARD16 *, CARD16 *,
+ CARD16 *);
+extern _X_EXPORT Bool VidModeGetGammaRamp(int, int, CARD16 *, CARD16 *,
+ CARD16 *);
extern _X_EXPORT int VidModeGetGammaRampSize(int scrnIndex);
#endif
-
-
diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h
index b711f0555..fc4c34e92 100644
--- a/xorg-server/hw/xfree86/common/xf86.h
+++ b/xorg-server/hw/xfree86/common/xf86.h
@@ -57,21 +57,24 @@ extern _X_EXPORT int xf86DoShowOptions;
extern _X_EXPORT Bool xf86DoConfigurePass1;
extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
+
#define xf86ScreenKey (&xf86ScreenKeyRec)
extern _X_EXPORT DevPrivateKeyRec xf86CreateRootWindowKeyRec;
+
#define xf86CreateRootWindowKey (&xf86CreateRootWindowKeyRec)
-extern _X_EXPORT ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
+extern _X_EXPORT ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
extern _X_EXPORT const unsigned char byte_reversed[256];
extern _X_EXPORT Bool fbSlotClaimed;
+
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
extern _X_EXPORT Bool sbusSlotClaimed;
#endif
extern _X_EXPORT confDRIRec xf86ConfigDRI;
extern _X_EXPORT Bool xf86DRI2Enabled(void);
-extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */
+extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */
#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
xf86ScreenKey))
@@ -104,20 +107,30 @@ extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus,
int *device, int *func);
extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus,
int device, int func);
-extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device * pPci);
-extern _X_EXPORT Bool xf86CheckPciMemBase(struct pci_device * pPci,
+extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device *pPci);
+extern _X_EXPORT Bool xf86CheckPciMemBase(struct pci_device *pPci,
memType base);
-extern _X_EXPORT struct pci_device * xf86GetPciInfoForEntity(int entityIndex);
+extern _X_EXPORT struct pci_device *xf86GetPciInfoForEntity(int entityIndex);
extern _X_EXPORT int xf86MatchPciInstances(const char *driverName,
- int vendorID, SymTabPtr chipsets, PciChipsets *PCIchipsets,
- GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities);
+ int vendorID, SymTabPtr chipsets,
+ PciChipsets * PCIchipsets,
+ GDevPtr * devList, int numDevs,
+ DriverPtr drvp, int **foundEntities);
extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn,
- int scrnFlag, int entityIndex,PciChipsets *p_chip, void *dummy,
- EntityProc init, EntityProc enter, EntityProc leave, pointer private);
+ int scrnFlag, int entityIndex,
+ PciChipsets * p_chip,
+ void *dummy, EntityProc init,
+ EntityProc enter,
+ EntityProc leave,
+ pointer private);
/* Obsolete! don't use */
extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
- int entityIndex,PciChipsets *p_chip, void *dummy, EntityProc init,
- EntityProc enter, EntityProc leave, pointer private);
+ int entityIndex,
+ PciChipsets * p_chip,
+ void *dummy, EntityProc init,
+ EntityProc enter,
+ EntityProc leave,
+ pointer private);
#else
#define xf86VGAarbiterInit() do {} while (0)
#define xf86VGAarbiterFini() do {} while (0)
@@ -130,19 +143,24 @@ extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
/* xf86Bus.c */
-extern _X_EXPORT int xf86GetFbInfoForScreen(int scrnIndex);
-extern _X_EXPORT int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
-extern _X_EXPORT int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
+extern _X_EXPORT int xf86GetFbInfoForScreen(int scrnIndex);
+extern _X_EXPORT int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev,
+ Bool active);
+extern _X_EXPORT int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev,
+ Bool active);
extern _X_EXPORT Bool xf86DriverHasEntities(DriverPtr drvp);
extern _X_EXPORT void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
-extern _X_EXPORT void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex,
- int instance);
+extern _X_EXPORT void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn,
+ int entityIndex,
+ int instance);
extern _X_EXPORT int xf86GetNumEntityInstances(int entityIndex);
extern _X_EXPORT GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
-extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
+extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn,
+ int entityIndex);
extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex);
extern _X_EXPORT Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
- EntityProc enter, EntityProc leave, pointer);
+ EntityProc enter, EntityProc leave,
+ pointer);
extern _X_EXPORT Bool xf86IsEntityPrimary(int entityIndex);
extern _X_EXPORT ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
@@ -159,8 +177,9 @@ extern _X_EXPORT int xf86AllocateEntityPrivateIndex(void);
extern _X_EXPORT DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
/* xf86Configure.c */
-extern _X_EXPORT GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus,
- void *busData, int chipset);
+extern _X_EXPORT GDevPtr xf86AddBusDeviceToConfigure(const char *driver,
+ BusType bus, void *busData,
+ int chipset);
/* xf86Cursor.c */
@@ -174,56 +193,63 @@ extern _X_EXPORT void xf86InitOrigins(void);
extern _X_EXPORT void xf86ReconfigureLayout(void);
/* xf86cvt.c */
-extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
- Bool Reduced, Bool Interlaced);
+extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay,
+ float VRefresh, Bool Reduced,
+ Bool Interlaced);
/* xf86DPMS.c */
-extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags);
+extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set,
+ int flags);
#ifdef DPMSExtension
extern _X_EXPORT int DPMSSet(ClientPtr client, int level);
extern _X_EXPORT Bool DPMSSupported(void);
#endif
-
/* xf86DGA.c */
#ifdef XFreeXDGA
-extern _X_EXPORT Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes,
- int num);
-extern _X_EXPORT Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes, int num);
+extern _X_EXPORT Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs,
+ DGAModePtr modes, int num);
+extern _X_EXPORT Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes,
+ int num);
extern _X_EXPORT xf86SetDGAModeProc xf86SetDGAMode;
#endif
/* xf86Events.c */
extern _X_EXPORT void SetTimeSinceLastInputEvent(void);
-extern _X_EXPORT pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data);
+extern _X_EXPORT pointer xf86AddInputHandler(int fd, InputHandlerProc proc,
+ pointer data);
extern _X_EXPORT int xf86RemoveInputHandler(pointer handler);
extern _X_EXPORT void xf86DisableInputHandler(pointer handler);
extern _X_EXPORT void xf86EnableInputHandler(pointer handler);
-extern _X_EXPORT pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data);
+extern _X_EXPORT pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc,
+ pointer data);
extern _X_EXPORT int xf86RemoveGeneralHandler(pointer handler);
extern _X_EXPORT void xf86DisableGeneralHandler(pointer handler);
extern _X_EXPORT void xf86EnableGeneralHandler(pointer handler);
-extern _X_EXPORT InputHandlerProc xf86SetConsoleHandler(InputHandlerProc handler, pointer data);
+extern _X_EXPORT InputHandlerProc xf86SetConsoleHandler(InputHandlerProc
+ handler, pointer data);
extern _X_EXPORT void xf86InterceptSignals(int *signo);
-extern _X_EXPORT void xf86InterceptSigIll(void (*sigillhandler)(void));
+extern _X_EXPORT void xf86InterceptSigIll(void (*sigillhandler) (void));
extern _X_EXPORT Bool xf86EnableVTSwitch(Bool new);
extern _X_EXPORT void xf86ProcessActionEvent(ActionEvent action, void *arg);
extern _X_EXPORT void xf86PrintBacktrace(void);
/* xf86Helper.c */
-extern _X_EXPORT void xf86AddDriver(DriverPtr driver, pointer module, int flags);
+extern _X_EXPORT void xf86AddDriver(DriverPtr driver, pointer module,
+ int flags);
extern _X_EXPORT void xf86DeleteDriver(int drvIndex);
extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
extern _X_EXPORT void xf86DeleteScreen(int scrnIndex, int flags);
extern _X_EXPORT int xf86AllocateScrnInfoPrivateIndex(void);
-extern _X_EXPORT Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad);
-extern _X_EXPORT Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp,
- int depth24flags);
+extern _X_EXPORT Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp,
+ int pad);
+extern _X_EXPORT Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp,
+ int fbbpp, int depth24flags);
extern _X_EXPORT void xf86PrintDepthBpp(ScrnInfoPtr scrp);
extern _X_EXPORT Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
@@ -231,125 +257,198 @@ extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma);
extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen);
extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
-extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
- const char *format, va_list args) _X_ATTRIBUTE_PRINTF(4,0);
-extern _X_EXPORT void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
- const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
-extern _X_EXPORT void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
- _X_ATTRIBUTE_PRINTF(3,4);
-extern _X_EXPORT void xf86MsgVerb(MessageType type, int verb, const char *format, ...)
- _X_ATTRIBUTE_PRINTF(3,4);
-extern _X_EXPORT void xf86Msg(MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(2,3);
-extern _X_EXPORT void xf86ErrorFVerb(int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(2,3);
-extern _X_EXPORT void xf86ErrorF(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,2);
-extern _X_EXPORT const char *xf86TokenToString(SymTabPtr table, int token);
-extern _X_EXPORT int xf86StringToToken(SymTabPtr table, const char *string);
-extern _X_EXPORT void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
-extern _X_EXPORT void xf86PrintChipsets(const char *drvname, const char *drvmsg,
- SymTabPtr chips);
-extern _X_EXPORT int xf86MatchDevice(const char *drivername, GDevPtr **driversectlist);
-extern _X_EXPORT const char *xf86GetVisualName(int visual);
-extern _X_EXPORT int xf86GetVerbosity(void);
-extern _X_EXPORT Pix24Flags xf86GetPix24(void);
-extern _X_EXPORT int xf86GetDepth(void);
-extern _X_EXPORT rgb xf86GetWeight(void);
-extern _X_EXPORT Gamma xf86GetGamma(void);
-extern _X_EXPORT Bool xf86GetFlipPixels(void);
-extern _X_EXPORT const char *xf86GetServerName(void);
-extern _X_EXPORT Bool xf86ServerIsExiting(void);
-extern _X_EXPORT Bool xf86ServerIsResetting(void);
-extern _X_EXPORT Bool xf86ServerIsInitialising(void);
-extern _X_EXPORT Bool xf86ServerIsOnlyDetecting(void);
-extern _X_EXPORT Bool xf86CaughtSignal(void);
-extern _X_EXPORT Bool xf86GetVidModeAllowNonLocal(void);
-extern _X_EXPORT Bool xf86GetVidModeEnabled(void);
-extern _X_EXPORT Bool xf86GetModInDevAllowNonLocal(void);
-extern _X_EXPORT Bool xf86GetModInDevEnabled(void);
-extern _X_EXPORT Bool xf86GetAllowMouseOpenFail(void);
-extern _X_EXPORT void xf86DisableRandR(void);
-extern _X_EXPORT CARD32 xorgGetVersion(void);
-extern _X_EXPORT CARD32 xf86GetModuleVersion(pointer module);
-extern _X_EXPORT pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name);
-extern _X_EXPORT pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
-extern _X_EXPORT pointer xf86LoadOneModule(char *name, pointer optlist);
-extern _X_EXPORT void xf86UnloadSubModule(pointer mod);
-extern _X_EXPORT Bool xf86LoaderCheckSymbol(const char *name);
-extern _X_EXPORT void xf86SetBackingStore(ScreenPtr pScreen);
-extern _X_EXPORT void xf86SetSilkenMouse(ScreenPtr pScreen);
-extern _X_EXPORT pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name,
- char **adaptor_name, pointer *adaptor_options);
-extern _X_EXPORT void xf86GetOS(const char **name, int *major, int *minor, int *teeny);
-extern _X_EXPORT ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
- int entityIndex, EntityProc init,
- EntityProc enter, EntityProc leave,
- pointer private);
-
-extern _X_EXPORT Bool xf86IsScreenPrimary(int scrnIndex);
-extern _X_EXPORT int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
- int format, unsigned long len,
- pointer value);
-extern _X_EXPORT Bool xf86IsUnblank(int mode);
+extern _X_EXPORT void
+xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
+ const char *format, va_list args)
+_X_ATTRIBUTE_PRINTF(4, 0);
+extern _X_EXPORT void
+xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
+ const char *format, ...)
+_X_ATTRIBUTE_PRINTF(4, 5);
+extern _X_EXPORT void
+xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(3, 4);
+extern _X_EXPORT void
+xf86MsgVerb(MessageType type, int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(3, 4);
+extern _X_EXPORT void
+xf86Msg(MessageType type, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
+extern _X_EXPORT void
+xf86ErrorFVerb(int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
+extern _X_EXPORT void
+xf86ErrorF(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+extern _X_EXPORT const char *
+xf86TokenToString(SymTabPtr table, int token);
+extern _X_EXPORT int
+xf86StringToToken(SymTabPtr table, const char *string);
+extern _X_EXPORT void
+xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
+extern _X_EXPORT void
+xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips);
+extern _X_EXPORT int
+xf86MatchDevice(const char *drivername, GDevPtr ** driversectlist);
+extern _X_EXPORT const char *
+xf86GetVisualName(int visual);
+extern _X_EXPORT int
+xf86GetVerbosity(void);
+extern _X_EXPORT Pix24Flags
+xf86GetPix24(void);
+extern _X_EXPORT int
+xf86GetDepth(void);
+extern _X_EXPORT rgb
+xf86GetWeight(void);
+extern _X_EXPORT Gamma
+xf86GetGamma(void);
+extern _X_EXPORT Bool
+xf86GetFlipPixels(void);
+extern _X_EXPORT const char *
+xf86GetServerName(void);
+extern _X_EXPORT Bool
+xf86ServerIsExiting(void);
+extern _X_EXPORT Bool
+xf86ServerIsResetting(void);
+extern _X_EXPORT Bool
+xf86ServerIsInitialising(void);
+extern _X_EXPORT Bool
+xf86ServerIsOnlyDetecting(void);
+extern _X_EXPORT Bool
+xf86CaughtSignal(void);
+extern _X_EXPORT Bool
+xf86GetVidModeAllowNonLocal(void);
+extern _X_EXPORT Bool
+xf86GetVidModeEnabled(void);
+extern _X_EXPORT Bool
+xf86GetModInDevAllowNonLocal(void);
+extern _X_EXPORT Bool
+xf86GetModInDevEnabled(void);
+extern _X_EXPORT Bool
+xf86GetAllowMouseOpenFail(void);
+extern _X_EXPORT void
+xf86DisableRandR(void);
+extern _X_EXPORT CARD32
+xorgGetVersion(void);
+extern _X_EXPORT CARD32
+xf86GetModuleVersion(pointer module);
+extern _X_EXPORT pointer
+xf86LoadDrvSubModule(DriverPtr drv, const char *name);
+extern _X_EXPORT pointer
+xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
+extern _X_EXPORT pointer
+xf86LoadOneModule(char *name, pointer optlist);
+extern _X_EXPORT void
+xf86UnloadSubModule(pointer mod);
+extern _X_EXPORT Bool
+xf86LoaderCheckSymbol(const char *name);
+extern _X_EXPORT void
+xf86SetBackingStore(ScreenPtr pScreen);
+extern _X_EXPORT void
+xf86SetSilkenMouse(ScreenPtr pScreen);
+extern _X_EXPORT pointer
+xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name,
+ char **adaptor_name, pointer *adaptor_options);
+extern _X_EXPORT void
+xf86GetOS(const char **name, int *major, int *minor, int *teeny);
+extern _X_EXPORT ScrnInfoPtr
+xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
+ int entityIndex, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer private);
+
+extern _X_EXPORT Bool
+xf86IsScreenPrimary(int scrnIndex);
+extern _X_EXPORT int
+xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
+ int format, unsigned long len, pointer value);
+extern _X_EXPORT Bool
+xf86IsUnblank(int mode);
/* xf86Init.c */
-extern _X_EXPORT PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth);
-extern _X_EXPORT int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth);
+extern _X_EXPORT PixmapFormatPtr
+xf86GetPixFormat(ScrnInfoPtr pScrn, int depth);
+extern _X_EXPORT int
+xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth);
/* xf86Mode.c */
-extern _X_EXPORT int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
- int DivFactor, int MulFactor, int *divider);
-extern _X_EXPORT const char *xf86ModeStatusToString(ModeStatus status);
-extern _X_EXPORT ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
- ClockRangePtr clockRanges, LookupModeFlags strategy);
-extern _X_EXPORT ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor);
-extern _X_EXPORT ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
- ClockRangePtr clockRanges,
- LookupModeFlags strategy,
- int maxPitch, int virtualX,
- int virtualY);
-extern _X_EXPORT ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
- int flags);
-extern _X_EXPORT int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
- char **modeNames, ClockRangePtr clockRanges,
- int *linePitches, int minPitch, int maxPitch,
- int minHeight, int maxHeight, int pitchInc,
- int virtualX, int virtualY, int apertureSize,
- LookupModeFlags strategy);
-extern _X_EXPORT void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode);
-extern _X_EXPORT void xf86PruneDriverModes(ScrnInfoPtr scrp);
-extern _X_EXPORT void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
-extern _X_EXPORT void xf86PrintModes(ScrnInfoPtr scrp);
-extern _X_EXPORT void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
-extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec *mode);
-extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec *mode);
-extern _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode);
-extern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
-extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode);
-extern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
-extern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec *pMode1,
- const DisplayModeRec *pMode2);
-extern _X_EXPORT void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
-extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
+extern _X_EXPORT int
+xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
+ int DivFactor, int MulFactor, int *divider);
+extern _X_EXPORT const char *
+xf86ModeStatusToString(ModeStatus status);
+extern _X_EXPORT ModeStatus
+xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
+ ClockRangePtr clockRanges, LookupModeFlags strategy);
+extern _X_EXPORT ModeStatus
+xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor);
+extern _X_EXPORT ModeStatus
+xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+ ClockRangePtr clockRanges,
+ LookupModeFlags strategy,
+ int maxPitch, int virtualX, int virtualY);
+extern _X_EXPORT ModeStatus
+xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags);
+extern _X_EXPORT int
+xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+ char **modeNames, ClockRangePtr clockRanges,
+ int *linePitches, int minPitch, int maxPitch,
+ int minHeight, int maxHeight, int pitchInc,
+ int virtualX, int virtualY, int apertureSize,
+ LookupModeFlags strategy);
+extern _X_EXPORT void
+xf86DeleteMode(DisplayModePtr * modeList, DisplayModePtr mode);
+extern _X_EXPORT void
+xf86PruneDriverModes(ScrnInfoPtr scrp);
+extern _X_EXPORT void
+xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
+extern _X_EXPORT void
+xf86PrintModes(ScrnInfoPtr scrp);
+extern _X_EXPORT void
+xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
+extern _X_EXPORT double
+xf86ModeHSync(const DisplayModeRec * mode);
+extern _X_EXPORT double
+xf86ModeVRefresh(const DisplayModeRec * mode);
+extern _X_EXPORT void
+xf86SetModeDefaultName(DisplayModePtr mode);
+extern _X_EXPORT void
+xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
+extern _X_EXPORT DisplayModePtr
+xf86DuplicateMode(const DisplayModeRec * pMode);
+extern _X_EXPORT DisplayModePtr
+xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
+extern _X_EXPORT Bool
+xf86ModesEqual(const DisplayModeRec * pMode1, const DisplayModeRec * pMode2);
+extern _X_EXPORT void
+xf86PrintModeline(int scrnIndex, DisplayModePtr mode);
+extern _X_EXPORT DisplayModePtr
+xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
/* xf86Option.c */
-extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts);
-
+extern _X_EXPORT void
+xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts);
/* xf86RandR.c */
#ifdef RANDR
-extern _X_EXPORT Bool xf86RandRInit (ScreenPtr pScreen);
-extern _X_EXPORT Rotation xf86GetRotation(ScreenPtr pScreen);
-extern _X_EXPORT Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
- int newvirtX, int newvirtY,
- int newmmWidth, int newmmHeight, Bool resetMode);
+extern _X_EXPORT Bool
+xf86RandRInit(ScreenPtr pScreen);
+extern _X_EXPORT Rotation
+xf86GetRotation(ScreenPtr pScreen);
+extern _X_EXPORT Bool
+xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
+ int newvirtX, int newvirtY,
+ int newmmWidth, int newmmHeight,
+ Bool resetMode);
#endif
/* xf86VidModeExtentionInit.c */
-extern _X_EXPORT Bool VidModeExtensionInit(ScreenPtr pScreen);
+extern _X_EXPORT Bool
+VidModeExtensionInit(ScreenPtr pScreen);
-#endif /* _NO_XF86_PROTOTYPES */
+#endif /* _NO_XF86_PROTOTYPES */
-#endif /* _XF86_H */
+#endif /* _XF86_H */
diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
index 0c465682a..43c746b7f 100644
--- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c
+++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
@@ -41,12 +41,12 @@
#include "xf86_OSlib.h"
#include "xf86pciBus.h"
#ifdef __sparc__
-# include "xf86sbusBus.h"
+#include "xf86sbusBus.h"
#endif
#ifdef sun
-# include <sys/visual_io.h>
-# include <ctype.h>
+#include <sys/visual_io.h>
+#include <ctype.h>
#endif
/* Sections for the default built-in configuration. */
@@ -103,13 +103,13 @@ AppendToList(const char *s, const char ***list, int *lines)
str = xnfstrdup(s);
for (p = strtok(str, "\n"); p; p = strtok(NULL, "\n")) {
- (*lines)++;
- *list = xnfrealloc(*list, (*lines + 1) * sizeof(**list));
- newstr = xnfalloc(strlen(p) + 2);
- strcpy(newstr, p);
- strcat(newstr, "\n");
- (*list)[*lines - 1] = newstr;
- (*list)[*lines] = NULL;
+ (*lines)++;
+ *list = xnfrealloc(*list, (*lines + 1) * sizeof(**list));
+ newstr = xnfalloc(strlen(p) + 2);
+ strcpy(newstr, p);
+ strcat(newstr, "\n");
+ (*list)[*lines - 1] = newstr;
+ (*list)[*lines] = NULL;
}
free(str);
}
@@ -120,7 +120,7 @@ FreeList(const char ***list, int *lines)
int i;
for (i = 0; i < *lines; i++) {
- free((char *)((*list)[i]));
+ free((char *) ((*list)[i]));
}
free(*list);
*list = NULL;
@@ -151,30 +151,30 @@ xf86AutoConfig(void)
listPossibleVideoDrivers(deviceList, 20);
for (p = deviceList; *p; p++) {
- snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p);
- AppendToConfig(buf);
- snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0);
- AppendToConfig(buf);
+ snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p);
+ AppendToConfig(buf);
+ snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0);
+ AppendToConfig(buf);
}
AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE);
for (p = deviceList; *p; p++) {
- snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, *p, 0);
- AppendToConfig(buf);
+ snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, *p, 0);
+ AppendToConfig(buf);
}
AppendToConfig(BUILTIN_LAYOUT_SECTION_POST);
for (p = deviceList; *p; p++) {
- free(*p);
+ free(*p);
}
xf86MsgVerb(X_DEFAULT, 0,
- "Using default built-in configuration (%d lines)\n",
- builtinLines);
+ "Using default built-in configuration (%d lines)\n",
+ builtinLines);
xf86MsgVerb(X_DEFAULT, 3, "--- Start of built-in configuration ---\n");
for (cp = builtinConfig; *cp; cp++)
- xf86ErrorFVerb(3, "\t%s", *cp);
+ xf86ErrorFVerb(3, "\t%s", *cp);
xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n");
xf86initConfigFiles();
@@ -183,7 +183,7 @@ xf86AutoConfig(void)
FreeConfig();
if (ret != CONFIG_OK)
- xf86Msg(X_ERROR, "Error parsing the built-in default configuration.\n");
+ xf86Msg(X_ERROR, "Error parsing the built-in default configuration.\n");
return ret == CONFIG_OK;
}
@@ -192,8 +192,8 @@ static void
listPossibleVideoDrivers(char *matches[], int nmatches)
{
int i;
-
- for (i = 0 ; i < nmatches ; i++) {
+
+ for (i = 0; i < nmatches; i++) {
matches[i] = NULL;
}
i = 0;
@@ -202,57 +202,60 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
/* Check for driver type based on /dev/fb type and if valid, use
it instead of PCI bus probe results */
if (xf86Info.consoleFd >= 0) {
- struct vis_identifier visid;
- const char *cp;
- extern char xf86SolarisFbDev[PATH_MAX];
- int iret;
-
- SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
- if (iret < 0) {
- int fbfd;
-
- fbfd = open(xf86SolarisFbDev, O_RDONLY);
- if (fbfd >= 0) {
- SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
- close(fbfd);
- }
- }
-
- if (iret < 0) {
- xf86Msg(X_WARNING,
- "could not get frame buffer identifier from %s\n",
- xf86SolarisFbDev);
- } else {
- xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
-
- /* Special case from before the general case was set */
- if (strcmp(visid.name, "NVDAnvda") == 0) {
- matches[i++] = xnfstrdup("nvidia");
- }
-
- /* General case - split into vendor name (initial all-caps
- prefix) & driver name (rest of the string). */
- if (strcmp(visid.name, "SUNWtext") != 0) {
- for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
- /* find end of all uppercase vendor section */
- }
- if ((cp != visid.name) && (*cp != '\0')) {
- char *driverName = xnfstrdup(cp);
- char *vendorName = xnfstrdup(visid.name);
- vendorName[cp - visid.name] = '\0';
-
- matches[i++] = vendorName;
- matches[i++] = driverName;
- }
- }
- }
+ struct vis_identifier visid;
+ const char *cp;
+ extern char xf86SolarisFbDev[PATH_MAX];
+ int iret;
+
+ SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
+ if (iret < 0) {
+ int fbfd;
+
+ fbfd = open(xf86SolarisFbDev, O_RDONLY);
+ if (fbfd >= 0) {
+ SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
+ close(fbfd);
+ }
+ }
+
+ if (iret < 0) {
+ xf86Msg(X_WARNING,
+ "could not get frame buffer identifier from %s\n",
+ xf86SolarisFbDev);
+ }
+ else {
+ xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
+
+ /* Special case from before the general case was set */
+ if (strcmp(visid.name, "NVDAnvda") == 0) {
+ matches[i++] = xnfstrdup("nvidia");
+ }
+
+ /* General case - split into vendor name (initial all-caps
+ prefix) & driver name (rest of the string). */
+ if (strcmp(visid.name, "SUNWtext") != 0) {
+ for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
+ /* find end of all uppercase vendor section */
+ }
+ if ((cp != visid.name) && (*cp != '\0')) {
+ char *driverName = xnfstrdup(cp);
+ char *vendorName = xnfstrdup(visid.name);
+
+ vendorName[cp - visid.name] = '\0';
+
+ matches[i++] = vendorName;
+ matches[i++] = driverName;
+ }
+ }
+ }
}
#endif
#ifdef __sparc__
{
- char *sbusDriver = sparcDriverName();
- if (sbusDriver)
- matches[i++] = xnfstrdup(sbusDriver);
+ char *sbusDriver = sparcDriverName();
+
+ if (sbusDriver)
+ matches[i++] = xnfstrdup(sbusDriver);
}
#endif
#ifdef XSERVER_LIBPCIACCESS
@@ -261,9 +264,9 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
/* Fallback to platform default hardware */
if (i < (nmatches - 1)) {
#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
- matches[i++] = xnfstrdup("vesa");
+ matches[i++] = xnfstrdup("vesa");
#elif defined(__sparc__) && !defined(sun)
- matches[i++] = xnfstrdup("sunffb");
+ matches[i++] = xnfstrdup("sunffb");
#endif
}
@@ -271,12 +274,12 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
/* Fallback to platform default frame buffer driver */
if (i < (nmatches - 1)) {
#if !defined(__linux__) && defined(__sparc__)
- matches[i++] = xnfstrdup("wsfb");
+ matches[i++] = xnfstrdup("wsfb");
#else
- matches[i++] = xnfstrdup("fbdev");
+ matches[i++] = xnfstrdup("fbdev");
#endif
}
-#endif /* !sun */
+#endif /* !sun */
}
/* copy a screen section and enter the desired driver
@@ -320,7 +323,7 @@ GDevPtr
autoConfigDevice(GDevPtr preconf_device)
{
GDevPtr ptr = NULL;
- char *matches[20]; /* If we have more than 20 drivers we're in trouble */
+ char *matches[20]; /* If we have more than 20 drivers we're in trouble */
int num_matches = 0, num_screens = 0, i;
screenLayoutPtr slp;
@@ -331,7 +334,8 @@ autoConfigDevice(GDevPtr preconf_device)
/* If there's a configured section with no driver chosen, use it */
if (preconf_device) {
ptr = preconf_device;
- } else {
+ }
+ else {
ptr = calloc(1, sizeof(GDevRec));
if (!ptr) {
return NULL;
@@ -361,7 +365,7 @@ autoConfigDevice(GDevPtr preconf_device)
* plus one for the terminating NULL */
for (; slp[num_screens].screen; num_screens++);
xf86ConfigLayout.screens = xnfcalloc(num_screens + num_matches,
- sizeof(screenLayoutRec));
+ sizeof(screenLayoutRec));
xf86ConfigLayout.screens[0] = slp[0];
/* do the first match and set that for the original first screen */
@@ -384,14 +388,16 @@ autoConfigDevice(GDevPtr preconf_device)
*
* TODO Handle rest of multiple screen sections */
for (i = 1; i < num_screens; i++) {
- xf86ConfigLayout.screens[i+num_matches] = slp[i];
+ xf86ConfigLayout.screens[i + num_matches] = slp[i];
}
- xf86ConfigLayout.screens[num_screens+num_matches-1].screen = NULL;
+ xf86ConfigLayout.screens[num_screens + num_matches - 1].screen =
+ NULL;
free(slp);
- } else {
+ }
+ else {
/* layout does not have any screens, not much to do */
ptr->driver = matches[0];
- for (i = 1; matches[i] ; i++) {
+ for (i = 1; matches[i]; i++) {
if (matches[i] != matches[0]) {
free(matches[i]);
}
diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c
index c665a2019..b176e8cc4 100644
--- a/xorg-server/hw/xfree86/common/xf86Bus.c
+++ b/xorg-server/hw/xfree86/common/xf86Bus.c
@@ -51,11 +51,11 @@
#include "xf86VGAarbiter.h"
#endif
/* Entity data */
-EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */
+EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */
int xf86NumEntities = 0;
static int xf86EntityPrivateCount = 0;
-BusRec primaryBus = { BUS_NONE, { 0 } };
+BusRec primaryBus = { BUS_NONE, {0} };
/**
* Call the driver's correct probe function.
@@ -73,9 +73,10 @@ BusRec primaryBus = { BUS_NONE, { 0 } };
* returned. Otherwise, \c FALSE is returned.
*/
Bool
-xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
+xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
{
- Bool foundScreen = FALSE;
+ Bool foundScreen = FALSE;
+
#ifdef XSERVER_LIBPCIACCESS
if (drv->PciProbe != NULL) {
if (xf86DoConfigure && xf86DoConfigurePass1) {
@@ -83,16 +84,16 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
foundScreen = xf86PciAddMatchingDev(drv);
}
else {
- assert(! detect_only);
+ assert(!detect_only);
foundScreen = xf86PciProbeDev(drv);
}
}
#endif
if (!foundScreen && (drv->Probe != NULL)) {
- xf86Msg( X_WARNING, "Falling back to old probe method for %s\n",
- drv->driverName);
- foundScreen = (*drv->Probe)(drv, (detect_only) ? PROBE_DETECT
- : PROBE_DEFAULT);
+ xf86Msg(X_WARNING, "Falling back to old probe method for %s\n",
+ drv->driverName);
+ foundScreen = (*drv->Probe) (drv, (detect_only) ? PROBE_DETECT
+ : PROBE_DEFAULT);
}
return foundScreen;
@@ -119,13 +120,14 @@ xf86BusConfig(void)
*/
for (i = 0; i < xf86NumDrivers; i++) {
xorgHWFlags flags;
+
if (!xorgHWAccess) {
if (!xf86DriverList[i]->driverFunc
- || !xf86DriverList[i]->driverFunc(NULL,
- GET_REQUIRED_HW_INTERFACES,
- &flags)
- || NEED_IO_ENABLED(flags))
- continue;
+ || !xf86DriverList[i]->driverFunc(NULL,
+ GET_REQUIRED_HW_INTERFACES,
+ &flags)
+ || NEED_IO_ENABLED(flags))
+ continue;
}
xf86CallDriverProbe(xf86DriverList[i], FALSE);
@@ -155,11 +157,13 @@ xf86BusConfig(void)
for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
layout++) {
Bool found = FALSE;
+
for (j = 0; j < xf86Screens[i]->numEntities; j++) {
- GDevPtr dev = xf86GetDevFromEntity(
- xf86Screens[i]->entityList[j],
- xf86Screens[i]->entityInstanceList[j]);
+ GDevPtr dev =
+ xf86GetDevFromEntity(xf86Screens[i]->entityList[j],
+ xf86Screens[i]->entityInstanceList[j]);
+
if (dev == layout->screen->device) {
/* A match has been found */
xf86Screens[i]->confScreen = layout->screen;
@@ -167,12 +171,14 @@ xf86BusConfig(void)
break;
}
}
- if (found) break;
+ if (found)
+ break;
}
if (layout->screen == NULL) {
/* No match found */
xf86Msg(X_ERROR,
- "Screen %d deleted because of no matching config section.\n", i);
+ "Screen %d deleted because of no matching config section.\n",
+ i);
xf86DeleteScreen(i--, 0);
}
}
@@ -180,7 +186,7 @@ xf86BusConfig(void)
/* If no screens left, return now. */
if (xf86NumScreens == 0) {
xf86Msg(X_ERROR,
- "Device(s) detected, but none match those in the config file.\n");
+ "Device(s) detected, but none match those in the config file.\n");
return FALSE;
}
@@ -210,31 +216,31 @@ xf86BusProbe(void)
*/
BusType
-StringToBusType(const char* busID, const char **retID)
+StringToBusType(const char *busID, const char **retID)
{
char *p, *s;
BusType ret = BUS_NONE;
/* If no type field, Default to PCI */
if (isdigit(busID[0])) {
- if (retID)
- *retID = busID;
- return BUS_PCI;
+ if (retID)
+ *retID = busID;
+ return BUS_PCI;
}
s = xstrdup(busID);
p = strtok(s, ":");
if (p == NULL || *p == 0) {
- free(s);
- return BUS_NONE;
+ free(s);
+ return BUS_NONE;
}
if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp"))
- ret = BUS_PCI;
+ ret = BUS_PCI;
if (!xf86NameCmp(p, "sbus"))
- ret = BUS_SBUS;
+ ret = BUS_SBUS;
if (ret != BUS_NONE)
- if (retID)
- *retID = busID + strlen(p) + 1;
+ if (retID)
+ *retID = busID + strlen(p) + 1;
free(s);
return ret;
}
@@ -244,10 +250,10 @@ xf86AllocateEntity(void)
{
xf86NumEntities++;
xf86Entities = xnfrealloc(xf86Entities,
- sizeof(EntityPtr) * xf86NumEntities);
- xf86Entities[xf86NumEntities - 1] = xnfcalloc(1,sizeof(EntityRec));
+ sizeof(EntityPtr) * xf86NumEntities);
+ xf86Entities[xf86NumEntities - 1] = xnfcalloc(1, sizeof(EntityRec));
xf86Entities[xf86NumEntities - 1]->entityPrivates =
- xnfcalloc(sizeof(DevUnion) * xf86EntityPrivateCount, 1);
+ xnfcalloc(sizeof(DevUnion) * xf86EntityPrivateCount, 1);
return xf86NumEntities - 1;
}
@@ -255,25 +261,26 @@ Bool
xf86IsEntityPrimary(int entityIndex)
{
EntityPtr pEnt = xf86Entities[entityIndex];
-
- if (primaryBus.type != pEnt->bus.type) return FALSE;
+
+ if (primaryBus.type != pEnt->bus.type)
+ return FALSE;
switch (pEnt->bus.type) {
case BUS_PCI:
- return pEnt->bus.id.pci == primaryBus.id.pci;
+ return pEnt->bus.id.pci == primaryBus.id.pci;
case BUS_SBUS:
- return pEnt->bus.id.sbus.fbNum == primaryBus.id.sbus.fbNum;
+ return pEnt->bus.id.sbus.fbNum == primaryBus.id.sbus.fbNum;
default:
- return FALSE;
+ return FALSE;
}
}
-
+
Bool
xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter,
- EntityProc leave, pointer private)
+ EntityProc leave, pointer private)
{
if (entityIndex >= xf86NumEntities)
- return FALSE;
+ return FALSE;
xf86Entities[entityIndex]->entityInit = init;
xf86Entities[entityIndex]->entityEnter = enter;
xf86Entities[entityIndex]->entityLeave = leave;
@@ -285,9 +292,10 @@ Bool
xf86DriverHasEntities(DriverPtr drvp)
{
int i;
+
for (i = 0; i < xf86NumEntities; i++) {
- if (xf86Entities[i]->driver == drvp)
- return TRUE;
+ if (xf86Entities[i]->driver == drvp)
+ return TRUE;
}
return FALSE;
}
@@ -296,20 +304,20 @@ void
xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)
{
if (entityIndex == -1)
- return;
+ return;
if (xf86Entities[entityIndex]->inUse &&
- !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) {
- ErrorF("Requested Entity already in use!\n");
- return;
+ !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) {
+ ErrorF("Requested Entity already in use!\n");
+ return;
}
pScrn->numEntities++;
pScrn->entityList = xnfrealloc(pScrn->entityList,
- pScrn->numEntities * sizeof(int));
+ pScrn->numEntities * sizeof(int));
pScrn->entityList[pScrn->numEntities - 1] = entityIndex;
xf86Entities[entityIndex]->inUse = TRUE;
pScrn->entityInstanceList = xnfrealloc(pScrn->entityInstanceList,
- pScrn->numEntities * sizeof(int));
+ pScrn->numEntities * sizeof(int));
pScrn->entityInstanceList[pScrn->numEntities - 1] = 0;
}
@@ -319,13 +327,13 @@ xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance)
int i;
if (entityIndex == -1 || entityIndex >= xf86NumEntities)
- return;
+ return;
for (i = 0; i < pScrn->numEntities; i++) {
- if (pScrn->entityList[i] == entityIndex) {
- pScrn->entityInstanceList[i] = instance;
- break;
- }
+ if (pScrn->entityList[i] == entityIndex) {
+ pScrn->entityInstanceList[i] = instance;
+ break;
+ }
}
}
@@ -336,17 +344,18 @@ xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance)
ScrnInfoPtr
xf86FindScreenForEntity(int entityIndex)
{
- int i,j;
+ int i, j;
+
+ if (entityIndex == -1)
+ return NULL;
- if (entityIndex == -1) return NULL;
-
if (xf86Screens) {
- for (i = 0; i < xf86NumScreens; i++) {
- for (j = 0; j < xf86Screens[i]->numEntities; j++) {
- if ( xf86Screens[i]->entityList[j] == entityIndex )
- return xf86Screens[i];
- }
- }
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+ if (xf86Screens[i]->entityList[j] == entityIndex)
+ return xf86Screens[i];
+ }
+ }
}
return NULL;
}
@@ -355,15 +364,15 @@ void
xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex)
{
int i;
-
+
for (i = 0; i < pScrn->numEntities; i++) {
- if (pScrn->entityList[i] == entityIndex) {
- for (i++; i < pScrn->numEntities; i++)
- pScrn->entityList[i-1] = pScrn->entityList[i];
- pScrn->numEntities--;
- xf86Entities[entityIndex]->inUse = FALSE;
- break;
- }
+ if (pScrn->entityList[i] == entityIndex) {
+ for (i++; i < pScrn->numEntities; i++)
+ pScrn->entityList[i - 1] = pScrn->entityList[i];
+ pScrn->numEntities--;
+ xf86Entities[entityIndex]->inUse = FALSE;
+ break;
+ }
}
}
@@ -376,13 +385,14 @@ xf86ClearEntityListForScreen(int scrnIndex)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
int i, entityIndex;
-
- if (pScrn->entityList == NULL || pScrn->numEntities == 0) return;
-
+
+ if (pScrn->entityList == NULL || pScrn->numEntities == 0)
+ return;
+
for (i = 0; i < pScrn->numEntities; i++) {
- entityIndex = pScrn->entityList[i];
- xf86Entities[entityIndex]->inUse = FALSE;
- /* disable resource: call the disable function */
+ entityIndex = pScrn->entityList[i];
+ xf86Entities[entityIndex]->inUse = FALSE;
+ /* disable resource: call the disable function */
}
free(pScrn->entityList);
free(pScrn->entityInstanceList);
@@ -398,14 +408,14 @@ void
xf86AddDevToEntity(int entityIndex, GDevPtr dev)
{
EntityPtr pEnt;
-
+
if (entityIndex >= xf86NumEntities)
- return;
-
+ return;
+
pEnt = xf86Entities[entityIndex];
pEnt->numInstances++;
pEnt->devices = xnfrealloc(pEnt->devices,
- pEnt->numInstances * sizeof(GDevPtr));
+ pEnt->numInstances * sizeof(GDevPtr));
pEnt->devices[pEnt->numInstances - 1] = dev;
dev->claimed = TRUE;
}
@@ -420,28 +430,29 @@ xf86GetEntityInfo(int entityIndex)
{
EntityInfoPtr pEnt;
int i;
-
+
if (entityIndex == -1)
- return NULL;
+ return NULL;
if (entityIndex >= xf86NumEntities)
- return NULL;
-
- pEnt = xnfcalloc(1,sizeof(EntityInfoRec));
+ return NULL;
+
+ pEnt = xnfcalloc(1, sizeof(EntityInfoRec));
pEnt->index = entityIndex;
pEnt->location = xf86Entities[entityIndex]->bus;
pEnt->active = xf86Entities[entityIndex]->active;
pEnt->chipset = xf86Entities[entityIndex]->chipset;
pEnt->driver = xf86Entities[entityIndex]->driver;
- if ( (xf86Entities[entityIndex]->devices) &&
- (xf86Entities[entityIndex]->devices[0]) ) {
- for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++)
- if (xf86Entities[entityIndex]->devices[i]->screen == 0)
- break;
- pEnt->device = xf86Entities[entityIndex]->devices[i];
- } else
- pEnt->device = NULL;
-
+ if ((xf86Entities[entityIndex]->devices) &&
+ (xf86Entities[entityIndex]->devices[0])) {
+ for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++)
+ if (xf86Entities[entityIndex]->devices[i]->screen == 0)
+ break;
+ pEnt->device = xf86Entities[entityIndex]->devices[i];
+ }
+ else
+ pEnt->device = NULL;
+
return pEnt;
}
@@ -449,8 +460,8 @@ int
xf86GetNumEntityInstances(int entityIndex)
{
if (entityIndex >= xf86NumEntities)
- return -1;
-
+ return -1;
+
return xf86Entities[entityIndex]->numInstances;
}
@@ -458,19 +469,19 @@ GDevPtr
xf86GetDevFromEntity(int entityIndex, int instance)
{
int i;
-
+
/* We might not use AddDevtoEntity */
- if ( (!xf86Entities[entityIndex]->devices) ||
- (!xf86Entities[entityIndex]->devices[0]) )
- return NULL;
+ if ((!xf86Entities[entityIndex]->devices) ||
+ (!xf86Entities[entityIndex]->devices[0]))
+ return NULL;
if (entityIndex >= xf86NumEntities ||
- instance >= xf86Entities[entityIndex]->numInstances)
- return NULL;
-
+ instance >= xf86Entities[entityIndex]->numInstances)
+ return NULL;
+
for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++)
- if (xf86Entities[entityIndex]->devices[i]->screen == instance)
- break;
+ if (xf86Entities[entityIndex]->devices[i]->screen == instance)
+ break;
return xf86Entities[entityIndex]->devices[i];
}
@@ -485,7 +496,7 @@ xf86AccessEnter(void)
for (i = 0; i < xf86NumEntities; i++)
if (xf86Entities[i]->entityEnter)
- xf86Entities[i]->entityEnter(i,xf86Entities[i]->private);
+ xf86Entities[i]->entityEnter(i, xf86Entities[i]->private);
}
void
@@ -495,7 +506,7 @@ xf86AccessLeave(void)
for (i = 0; i < xf86NumEntities; i++)
if (xf86Entities[i]->entityLeave)
- xf86Entities[i]->entityLeave(i,xf86Entities[i]->private);
+ xf86Entities[i]->entityLeave(i, xf86Entities[i]->private);
}
/*
@@ -509,28 +520,29 @@ xf86PostProbe(void)
if (fbSlotClaimed && (
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
- sbusSlotClaimed ||
+ sbusSlotClaimed ||
#endif
#ifdef XSERVER_LIBPCIACCESS
- pciSlotClaimed
+ pciSlotClaimed
#else
- TRUE
+ TRUE
#endif
- ))
- FatalError("Cannot run in framebuffer mode. Please specify busIDs "
- " for all framebuffer devices\n");
+ ))
+ FatalError("Cannot run in framebuffer mode. Please specify busIDs "
+ " for all framebuffer devices\n");
for (i = 0; i < xf86NumEntities; i++)
if (xf86Entities[i]->entityInit)
- xf86Entities[i]->entityInit(i,xf86Entities[i]->private);
+ xf86Entities[i]->entityInit(i, xf86Entities[i]->private);
}
int
xf86GetLastScrnFlag(int entityIndex)
{
- if(entityIndex < xf86NumEntities) {
+ if (entityIndex < xf86NumEntities) {
return xf86Entities[entityIndex]->lastScrnFlag;
- } else {
+ }
+ else {
return -1;
}
}
@@ -538,7 +550,7 @@ xf86GetLastScrnFlag(int entityIndex)
void
xf86SetLastScrnFlag(int entityIndex, int scrnIndex)
{
- if(entityIndex < xf86NumEntities) {
+ if (entityIndex < xf86NumEntities) {
xf86Entities[entityIndex]->lastScrnFlag = scrnIndex;
}
}
@@ -546,10 +558,10 @@ xf86SetLastScrnFlag(int entityIndex, int scrnIndex)
Bool
xf86IsEntityShared(int entityIndex)
{
- if(entityIndex < xf86NumEntities) {
- if(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL) {
- return TRUE;
- }
+ if (entityIndex < xf86NumEntities) {
+ if (xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL) {
+ return TRUE;
+ }
}
return FALSE;
}
@@ -557,7 +569,7 @@ xf86IsEntityShared(int entityIndex)
void
xf86SetEntityShared(int entityIndex)
{
- if(entityIndex < xf86NumEntities) {
+ if (entityIndex < xf86NumEntities) {
xf86Entities[entityIndex]->entityProp |= IS_SHARED_ACCEL;
}
}
@@ -565,10 +577,10 @@ xf86SetEntityShared(int entityIndex)
Bool
xf86IsEntitySharable(int entityIndex)
{
- if(entityIndex < xf86NumEntities) {
- if(xf86Entities[entityIndex]->entityProp & ACCEL_IS_SHARABLE) {
- return TRUE;
- }
+ if (entityIndex < xf86NumEntities) {
+ if (xf86Entities[entityIndex]->entityProp & ACCEL_IS_SHARABLE) {
+ return TRUE;
+ }
}
return FALSE;
}
@@ -576,7 +588,7 @@ xf86IsEntitySharable(int entityIndex)
void
xf86SetEntitySharable(int entityIndex)
{
- if(entityIndex < xf86NumEntities) {
+ if (entityIndex < xf86NumEntities) {
xf86Entities[entityIndex]->entityProp |= ACCEL_IS_SHARABLE;
}
}
@@ -584,10 +596,10 @@ xf86SetEntitySharable(int entityIndex)
Bool
xf86IsPrimInitDone(int entityIndex)
{
- if(entityIndex < xf86NumEntities) {
- if(xf86Entities[entityIndex]->entityProp & SA_PRIM_INIT_DONE) {
- return TRUE;
- }
+ if (entityIndex < xf86NumEntities) {
+ if (xf86Entities[entityIndex]->entityProp & SA_PRIM_INIT_DONE) {
+ return TRUE;
+ }
}
return FALSE;
}
@@ -595,7 +607,7 @@ xf86IsPrimInitDone(int entityIndex)
void
xf86SetPrimInitDone(int entityIndex)
{
- if(entityIndex < xf86NumEntities) {
+ if (entityIndex < xf86NumEntities) {
xf86Entities[entityIndex]->entityProp |= SA_PRIM_INIT_DONE;
}
}
@@ -603,12 +615,11 @@ xf86SetPrimInitDone(int entityIndex)
void
xf86ClearPrimInitDone(int entityIndex)
{
- if(entityIndex < xf86NumEntities) {
+ if (entityIndex < xf86NumEntities) {
xf86Entities[entityIndex]->entityProp &= ~SA_PRIM_INIT_DONE;
}
}
-
/*
* Allocate a private in the entities.
*/
@@ -622,12 +633,12 @@ xf86AllocateEntityPrivateIndex(void)
idx = xf86EntityPrivateCount++;
for (i = 0; i < xf86NumEntities; i++) {
- pEnt = xf86Entities[i];
- nprivs = xnfrealloc(pEnt->entityPrivates,
- xf86EntityPrivateCount * sizeof(DevUnion));
- /* Zero the new private */
- memset(&nprivs[idx], 0, sizeof(DevUnion));
- pEnt->entityPrivates = nprivs;
+ pEnt = xf86Entities[i];
+ nprivs = xnfrealloc(pEnt->entityPrivates,
+ xf86EntityPrivateCount * sizeof(DevUnion));
+ /* Zero the new private */
+ memset(&nprivs[idx], 0, sizeof(DevUnion));
+ pEnt->entityPrivates = nprivs;
}
return idx;
}
@@ -636,8 +647,7 @@ DevUnion *
xf86GetEntityPrivate(int entityIndex, int privIndex)
{
if (entityIndex >= xf86NumEntities || privIndex >= xf86EntityPrivateCount)
- return NULL;
+ return NULL;
return &(xf86Entities[entityIndex]->entityPrivates[privIndex]);
}
-
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index f51be7e9c..ec679df16 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -109,36 +109,36 @@
#endif
static ModuleDefault ModuleDefaults[] = {
- {.name = "extmod", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "extmod",.toLoad = TRUE,.load_opt = NULL},
#ifdef DBE
- {.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "dbe",.toLoad = TRUE,.load_opt = NULL},
#endif
#ifdef GLXEXT
- {.name = "glx", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "glx",.toLoad = TRUE,.load_opt = NULL},
#endif
#ifdef XRECORD
- {.name = "record", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "record",.toLoad = TRUE,.load_opt = NULL},
#endif
#ifdef XF86DRI
- {.name = "dri", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "dri",.toLoad = TRUE,.load_opt = NULL},
#endif
#ifdef DRI2
- {.name = "dri2", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "dri2",.toLoad = TRUE,.load_opt = NULL},
#endif
- {.name = NULL, .toLoad = FALSE, .load_opt=NULL}
+ {.name = NULL,.toLoad = FALSE,.load_opt = NULL}
};
-
/* Forward declarations */
static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen,
- int scrnum, MessageType from);
+ int scrnum, MessageType from);
static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor);
static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device,
- Bool active);
+ Bool active);
static Bool configInput(InputInfoPtr pInfo, XF86ConfInputPtr conf_input,
- MessageType from);
+ MessageType from);
static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display);
static Bool addDefaultModes(MonPtr monitorp);
+
#ifdef XF86DRI
static void configDRI(XF86ConfDRIPtr drip);
#endif
@@ -154,15 +154,15 @@ static void configExtensions(XF86ConfExtensionsPtr conf_ext);
static char *
xf86GetPathElem(char **pnt)
{
- char *p1;
-
- p1 = *pnt;
- *pnt = index(*pnt, ',');
- if (*pnt != NULL) {
- **pnt = '\0';
- *pnt += 1;
- }
- return p1;
+ char *p1;
+
+ p1 = *pnt;
+ *pnt = index(*pnt, ',');
+ if (*pnt != NULL) {
+ **pnt = '\0';
+ *pnt += 1;
+ }
+ return p1;
}
/*
@@ -178,67 +178,67 @@ xf86GetPathElem(char **pnt)
static char *
xf86ValidateFontPath(char *path)
{
- char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
- struct stat stat_buf;
- int flag;
- int dirlen;
-
- tmp_path = calloc(1,strlen(path)+1);
- out_pnt = tmp_path;
- path_elem = NULL;
- next = path;
- while (next != NULL) {
- path_elem = xf86GetPathElem(&next);
- if (*path_elem == '/') {
- dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
- if ((p1 = strchr(path_elem, ':')) != 0)
- dirlen = p1 - path_elem;
- else
- dirlen = strlen(path_elem);
- strlcpy(dir_elem, path_elem, dirlen + 1);
- flag = stat(dir_elem, &stat_buf);
- if (flag == 0)
- if (!S_ISDIR(stat_buf.st_mode))
- flag = -1;
- if (flag != 0) {
- xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n", dir_elem);
- xf86ErrorF("\tEntry deleted from font path.\n");
- free(dir_elem);
- continue;
- }
- else {
- XNFasprintf(&p1, "%s%s", dir_elem, DIR_FILE);
- flag = stat(p1, &stat_buf);
- if (flag == 0)
- if (!S_ISREG(stat_buf.st_mode))
- flag = -1;
- free(p1);
- if (flag != 0) {
- xf86Msg(X_WARNING,
- "`fonts.dir' not found (or not valid) in \"%s\".\n",
- dir_elem);
- xf86ErrorF("\tEntry deleted from font path.\n");
- xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem);
- free(dir_elem);
- continue;
- }
- }
- free(dir_elem);
- }
+ char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
+ struct stat stat_buf;
+ int flag;
+ int dirlen;
+
+ tmp_path = calloc(1, strlen(path) + 1);
+ out_pnt = tmp_path;
+ path_elem = NULL;
+ next = path;
+ while (next != NULL) {
+ path_elem = xf86GetPathElem(&next);
+ if (*path_elem == '/') {
+ dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
+ if ((p1 = strchr(path_elem, ':')) != 0)
+ dirlen = p1 - path_elem;
+ else
+ dirlen = strlen(path_elem);
+ strlcpy(dir_elem, path_elem, dirlen + 1);
+ flag = stat(dir_elem, &stat_buf);
+ if (flag == 0)
+ if (!S_ISDIR(stat_buf.st_mode))
+ flag = -1;
+ if (flag != 0) {
+ xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n",
+ dir_elem);
+ xf86ErrorF("\tEntry deleted from font path.\n");
+ free(dir_elem);
+ continue;
+ }
+ else {
+ XNFasprintf(&p1, "%s%s", dir_elem, DIR_FILE);
+ flag = stat(p1, &stat_buf);
+ if (flag == 0)
+ if (!S_ISREG(stat_buf.st_mode))
+ flag = -1;
+ free(p1);
+ if (flag != 0) {
+ xf86Msg(X_WARNING,
+ "`fonts.dir' not found (or not valid) in \"%s\".\n",
+ dir_elem);
+ xf86ErrorF("\tEntry deleted from font path.\n");
+ xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem);
+ free(dir_elem);
+ continue;
+ }
+ }
+ free(dir_elem);
+ }
- /*
- * Either an OK directory, or a font server name. So add it to
- * the path.
- */
- if (out_pnt != tmp_path)
- *out_pnt++ = ',';
- strcat(out_pnt, path_elem);
- out_pnt += strlen(path_elem);
- }
- return tmp_path;
+ /*
+ * Either an OK directory, or a font server name. So add it to
+ * the path.
+ */
+ if (out_pnt != tmp_path)
+ *out_pnt++ = ',';
+ strcat(out_pnt, path_elem);
+ out_pnt += strlen(path_elem);
+ }
+ return tmp_path;
}
-
/*
* use the datastructure that the parser provides and pick out the parts
* that we need at this point
@@ -248,13 +248,15 @@ xf86ModulelistFromConfig(pointer **optlist)
{
int count = 0, i = 0;
char **modulearray;
+
const char *ignore[] = { "GLcore", "speedo", "bitmap", "drm",
- "freetype", "type1",
- NULL };
+ "freetype", "type1",
+ NULL
+ };
pointer *optarray;
XF86LoadPtr modp;
Bool found;
-
+
/*
* make sure the config file has been parsed and that we have a
* ModulePath set; if no ModulePath was given, use the default
@@ -264,15 +266,17 @@ xf86ModulelistFromConfig(pointer **optlist)
xf86Msg(X_ERROR, "Cannot access global config data structure\n");
return NULL;
}
-
+
if (xf86configptr->conf_modules) {
/* Walk the disable list and let people know what we've parsed to
* not be loaded
*/
modp = xf86configptr->conf_modules->mod_disable_lst;
while (modp) {
- xf86Msg(X_WARNING, "\"%s\" will not be loaded unless you've specified it to be loaded elsewhere.\n", modp->load_name);
- modp = (XF86LoadPtr) modp->list.next;
+ xf86Msg(X_WARNING,
+ "\"%s\" will not be loaded unless you've specified it to be loaded elsewhere.\n",
+ modp->load_name);
+ modp = (XF86LoadPtr) modp->list.next;
}
/*
* Walk the default settings table. For each module listed to be
@@ -280,90 +284,103 @@ xf86ModulelistFromConfig(pointer **optlist)
* sure it's not in the mod_no_load_lst. If it's not disabled,
* append it to mod_load_lst
*/
- for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
+ for (i = 0; ModuleDefaults[i].name != NULL; i++) {
if (ModuleDefaults[i].toLoad == FALSE) {
- xf86Msg(X_WARNING, "\"%s\" is not to be loaded by default. Skipping.\n", ModuleDefaults[i].name);
+ xf86Msg(X_WARNING,
+ "\"%s\" is not to be loaded by default. Skipping.\n",
+ ModuleDefaults[i].name);
continue;
}
found = FALSE;
modp = xf86configptr->conf_modules->mod_load_lst;
while (modp) {
if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) {
- xf86Msg(X_INFO, "\"%s\" will be loaded. This was enabled by default and also specified in the config file.\n", ModuleDefaults[i].name);
+ xf86Msg(X_INFO,
+ "\"%s\" will be loaded. This was enabled by default and also specified in the config file.\n",
+ ModuleDefaults[i].name);
found = TRUE;
break;
}
- modp = (XF86LoadPtr) modp->list.next;
+ modp = (XF86LoadPtr) modp->list.next;
}
if (found == FALSE) {
modp = xf86configptr->conf_modules->mod_disable_lst;
while (modp) {
if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) {
- xf86Msg(X_INFO, "\"%s\" will be loaded even though the default is to disable it.\n", ModuleDefaults[i].name);
+ xf86Msg(X_INFO,
+ "\"%s\" will be loaded even though the default is to disable it.\n",
+ ModuleDefaults[i].name);
found = TRUE;
break;
}
- modp = (XF86LoadPtr) modp->list.next;
+ modp = (XF86LoadPtr) modp->list.next;
}
}
if (found == FALSE) {
- XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
- xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
- xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", ModuleDefaults[i].name);
+ XF86LoadPtr ptr = (XF86LoadPtr) xf86configptr->conf_modules;
+
+ xf86addNewLoadDirective(ptr, ModuleDefaults[i].name,
+ XF86_LOAD_MODULE,
+ ModuleDefaults[i].load_opt);
+ xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n",
+ ModuleDefaults[i].name);
}
- }
- } else {
- xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec));
- for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
- if (ModuleDefaults[i].toLoad == TRUE) {
- XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
- xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
- }
- }
- }
-
- /*
- * Walk the list of modules in the "Module" section to determine how
- * many we have.
- */
- modp = xf86configptr->conf_modules->mod_load_lst;
- while (modp) {
- for (i = 0; ignore[i]; i++) {
- if (strcmp(modp->load_name, ignore[i]) == 0)
- modp->ignore = 1;
- }
- if (!modp->ignore)
- count++;
- modp = (XF86LoadPtr) modp->list.next;
- }
+ }
+ }
+ else {
+ xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec));
+ for (i = 0; ModuleDefaults[i].name != NULL; i++) {
+ if (ModuleDefaults[i].toLoad == TRUE) {
+ XF86LoadPtr ptr = (XF86LoadPtr) xf86configptr->conf_modules;
+
+ xf86addNewLoadDirective(ptr, ModuleDefaults[i].name,
+ XF86_LOAD_MODULE,
+ ModuleDefaults[i].load_opt);
+ }
+ }
+ }
+
+ /*
+ * Walk the list of modules in the "Module" section to determine how
+ * many we have.
+ */
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ for (i = 0; ignore[i]; i++) {
+ if (strcmp(modp->load_name, ignore[i]) == 0)
+ modp->ignore = 1;
+ }
+ if (!modp->ignore)
+ count++;
+ modp = (XF86LoadPtr) modp->list.next;
+ }
/*
* allocate the memory and walk the list again to fill in the pointers
*/
- modulearray = xnfalloc((count + 1) * sizeof(char*));
+ modulearray = xnfalloc((count + 1) * sizeof(char *));
optarray = xnfalloc((count + 1) * sizeof(pointer));
count = 0;
if (xf86configptr->conf_modules) {
- modp = xf86configptr->conf_modules->mod_load_lst;
- while (modp) {
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
if (!modp->ignore) {
- modulearray[count] = modp->load_name;
- optarray[count] = modp->load_opt;
- count++;
+ modulearray[count] = modp->load_name;
+ optarray[count] = modp->load_opt;
+ count++;
}
- modp = (XF86LoadPtr) modp->list.next;
- }
+ modp = (XF86LoadPtr) modp->list.next;
+ }
}
modulearray[count] = NULL;
optarray[count] = NULL;
if (optlist)
- *optlist = optarray;
+ *optlist = optarray;
else
- free(optarray);
+ free(optarray);
return modulearray;
}
-
char **
xf86DriverlistFromConfig(void)
{
@@ -371,7 +388,7 @@ xf86DriverlistFromConfig(void)
int j;
char **modulearray;
screenLayoutPtr slp;
-
+
/*
* make sure the config file has been parsed and that we have a
* ModulePath set; if no ModulePath was given, use the default
@@ -381,7 +398,7 @@ xf86DriverlistFromConfig(void)
xf86Msg(X_ERROR, "Cannot access global config data structure\n");
return NULL;
}
-
+
/*
* Walk the list of driver lines in active "Device" sections to
* determine now many implicitly loaded modules there are.
@@ -390,7 +407,7 @@ xf86DriverlistFromConfig(void)
if (xf86ConfigLayout.screens) {
slp = xf86ConfigLayout.screens;
while ((slp++)->screen) {
- count++;
+ count++;
}
}
@@ -399,39 +416,39 @@ xf86DriverlistFromConfig(void)
*/
j = 0;
while (xf86ConfigLayout.inactives[j++].identifier)
- count++;
+ count++;
if (count == 0)
- return NULL;
+ return NULL;
/*
* allocate the memory and walk the list again to fill in the pointers
*/
- modulearray = xnfalloc((count + 1) * sizeof(char*));
+ modulearray = xnfalloc((count + 1) * sizeof(char *));
count = 0;
slp = xf86ConfigLayout.screens;
while (slp->screen) {
- modulearray[count] = slp->screen->device->driver;
- count++;
- slp++;
+ modulearray[count] = slp->screen->device->driver;
+ count++;
+ slp++;
}
j = 0;
- while (xf86ConfigLayout.inactives[j].identifier)
- modulearray[count++] = xf86ConfigLayout.inactives[j++].driver;
+ while (xf86ConfigLayout.inactives[j].identifier)
+ modulearray[count++] = xf86ConfigLayout.inactives[j++].driver;
modulearray[count] = NULL;
/* Remove duplicates */
for (count = 0; modulearray[count] != NULL; count++) {
- int i;
+ int i;
- for (i = 0; i < count; i++)
- if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
- modulearray[count] = "";
- break;
- }
+ for (i = 0; i < count; i++)
+ if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
+ modulearray[count] = "";
+ break;
+ }
}
return modulearray;
}
@@ -452,7 +469,7 @@ xf86InputDriverlistFromConfig(void)
xf86Msg(X_ERROR, "Cannot access global config data structure\n");
return NULL;
}
-
+
/*
* Walk the list of driver lines in active "InputDevice" sections to
* determine now many implicitly loaded modules there are.
@@ -460,36 +477,36 @@ xf86InputDriverlistFromConfig(void)
if (xf86ConfigLayout.inputs) {
idp = xf86ConfigLayout.inputs;
while (*idp) {
- count++;
- idp++;
+ count++;
+ idp++;
}
}
if (count == 0)
- return NULL;
+ return NULL;
/*
* allocate the memory and walk the list again to fill in the pointers
*/
- modulearray = xnfalloc((count + 1) * sizeof(char*));
+ modulearray = xnfalloc((count + 1) * sizeof(char *));
count = 0;
idp = xf86ConfigLayout.inputs;
while (idp && *idp) {
modulearray[count] = (*idp)->driver;
- count++;
- idp++;
+ count++;
+ idp++;
}
modulearray[count] = NULL;
/* Remove duplicates */
for (count = 0; modulearray[count] != NULL; count++) {
- int i;
+ int i;
- for (i = 0; i < count; i++)
- if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
- modulearray[count] = "";
- break;
- }
+ for (i = 0; i < count; i++)
+ if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
+ modulearray[count] = "";
+ break;
+ }
}
return modulearray;
}
@@ -503,7 +520,7 @@ fixup_video_driver_list(char **drivers)
int i;
/* walk to the end of the list */
- for (end = drivers; *end && **end; end++) ;
+ for (end = drivers; *end && **end; end++);
end--;
/*
@@ -513,7 +530,9 @@ fixup_video_driver_list(char **drivers)
for (i = 0; fallback[i]; i++) {
for (drv = drivers; drv != end; drv++) {
if (strstr(*drv, fallback[i])) {
- x = *drv; *drv = *end; *end = x;
+ x = *drv;
+ *drv = *end;
+ *end = x;
end--;
break;
}
@@ -522,13 +541,13 @@ fixup_video_driver_list(char **drivers)
}
static char **
-GenerateDriverlist(const char * dirname)
+GenerateDriverlist(const char *dirname)
{
char **ret;
const char *subdirs[] = { dirname, NULL };
- static const char *patlist[] = {"(.*)_drv\\.so", NULL};
+ static const char *patlist[] = { "(.*)_drv\\.so", NULL };
ret = LoaderListDirs(subdirs, patlist);
-
+
/* fix up the probe order for video drivers */
if (strstr(dirname, "drivers") && ret != NULL)
fixup_video_driver_list(ret);
@@ -552,7 +571,8 @@ xf86DriverlistFromCompile(void)
* Print a READABLE ErrorMessage!!! All information that is
* available is printed.
*/
-static void _X_ATTRIBUTE_PRINTF(1,2)
+static void
+_X_ATTRIBUTE_PRINTF(1, 2)
xf86ConfigError(const char *msg, ...)
{
va_list ap;
@@ -568,31 +588,31 @@ xf86ConfigError(const char *msg, ...)
static void
configFiles(XF86ConfFilesPtr fileconf)
{
- MessageType pathFrom;
- Bool must_copy;
- int size, countDirs;
- char *temp_path, *log_buf, *start, *end;
+ MessageType pathFrom;
+ Bool must_copy;
+ int size, countDirs;
+ char *temp_path, *log_buf, *start, *end;
/* FontPath */
must_copy = TRUE;
temp_path = defaultFontPath ? defaultFontPath : "";
if (xf86fpFlag)
- pathFrom = X_CMDLINE;
+ pathFrom = X_CMDLINE;
else if (fileconf && fileconf->file_fontpath) {
- pathFrom = X_CONFIG;
- if (xf86Info.useDefaultFontPath) {
- if (asprintf(&defaultFontPath, "%s%s%s", fileconf->file_fontpath,
- *temp_path ? "," : "", temp_path) == -1)
- defaultFontPath = NULL;
- else
- must_copy = FALSE;
- }
- else
- defaultFontPath = fileconf->file_fontpath;
+ pathFrom = X_CONFIG;
+ if (xf86Info.useDefaultFontPath) {
+ if (asprintf(&defaultFontPath, "%s%s%s", fileconf->file_fontpath,
+ *temp_path ? "," : "", temp_path) == -1)
+ defaultFontPath = NULL;
+ else
+ must_copy = FALSE;
+ }
+ else
+ defaultFontPath = fileconf->file_fontpath;
}
else
- pathFrom = X_DEFAULT;
+ pathFrom = X_DEFAULT;
temp_path = defaultFontPath ? defaultFontPath : "";
/* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
@@ -604,61 +624,61 @@ configFiles(XF86ConfFilesPtr fileconf)
countDirs = 1;
temp_path = defaultFontPath;
while ((temp_path = index(temp_path, ',')) != NULL) {
- countDirs++;
- temp_path++;
+ countDirs++;
+ temp_path++;
}
log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1);
temp_path = log_buf;
start = defaultFontPath;
- while((end = index(start, ',')) != NULL) {
- size = (end - start) + 1;
- *(temp_path++) = '\t';
- strncpy(temp_path, start, size);
- temp_path += size;
- *(temp_path++) = '\n';
- start += size;
+ while ((end = index(start, ',')) != NULL) {
+ size = (end - start) + 1;
+ *(temp_path++) = '\t';
+ strncpy(temp_path, start, size);
+ temp_path += size;
+ *(temp_path++) = '\n';
+ start += size;
}
/* copy last entry */
*(temp_path++) = '\t';
strcpy(temp_path, start);
xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf);
free(log_buf);
-
- /* ModulePath */
- if (fileconf) {
- if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
- xf86ModulePath = fileconf->file_modulepath;
- xf86ModPathFrom = X_CONFIG;
+ /* ModulePath */
+
+ if (fileconf) {
+ if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
+ xf86ModulePath = fileconf->file_modulepath;
+ xf86ModPathFrom = X_CONFIG;
+ }
}
- }
- xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
+ xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
- if (!xf86xkbdirFlag && fileconf && fileconf->file_xkbdir) {
- XkbBaseDirectory = fileconf->file_xkbdir;
- xf86Msg(X_CONFIG, "XKB base directory set to \"%s\"\n",
- XkbBaseDirectory);
- }
+ if (!xf86xkbdirFlag && fileconf && fileconf->file_xkbdir) {
+ XkbBaseDirectory = fileconf->file_xkbdir;
+ xf86Msg(X_CONFIG, "XKB base directory set to \"%s\"\n",
+ XkbBaseDirectory);
+ }
#if 0
- /* LogFile */
- /*
- * XXX The problem with this is that the log file is already open.
- * One option might be to copy the exiting contents to the new location.
- * and re-open it. The down side is that the default location would
- * already have been overwritten. Another option would be to start with
- * unique temporary location, then copy it once the correct name is known.
- * A problem with this is what happens if the server exits before that
- * happens.
- */
- if (xf86LogFileFrom == X_DEFAULT && fileconf->file_logfile) {
- xf86LogFile = fileconf->file_logfile;
- xf86LogFileFrom = X_CONFIG;
- }
+ /* LogFile */
+ /*
+ * XXX The problem with this is that the log file is already open.
+ * One option might be to copy the exiting contents to the new location.
+ * and re-open it. The down side is that the default location would
+ * already have been overwritten. Another option would be to start with
+ * unique temporary location, then copy it once the correct name is known.
+ * A problem with this is what happens if the server exits before that
+ * happens.
+ */
+ if (xf86LogFileFrom == X_DEFAULT && fileconf->file_logfile) {
+ xf86LogFile = fileconf->file_logfile;
+ xf86LogFileFrom = X_CONFIG;
+ }
#endif
- return;
+ return;
}
typedef enum {
@@ -695,58 +715,58 @@ typedef enum {
* if the parser found the option in the config file.
*/
static OptionInfoRec FlagOptions[] = {
- { FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_DISABLEVIDMODE, "DisableVidModeExtension", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER,
- {0}, FALSE },
- { FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER,
- {0}, FALSE },
- { FLAG_DPMS_SUSPENDTIME, "SuspendTime", OPTV_INTEGER,
- {0}, FALSE },
- { FLAG_DPMS_OFFTIME, "OffTime", OPTV_INTEGER,
- {0}, FALSE },
- { FLAG_PIXMAP, "Pixmap", OPTV_INTEGER,
- {0}, FALSE },
- { FLAG_NOPM, "NoPM", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_LOG, "Log", OPTV_STRING,
- {0}, FALSE },
- { FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING,
- {0}, FALSE },
- { FLAG_RANDR, "RandR", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING,
- {0}, FALSE },
- { FLAG_DRI2, "DRI2", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN,
- {0}, FALSE },
- { -1, NULL, OPTV_NONE,
- {0}, FALSE },
+ {FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_DISABLEVIDMODE, "DisableVidModeExtension", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_SAVER_BLANKTIME, "BlankTime", OPTV_INTEGER,
+ {0}, FALSE},
+ {FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER,
+ {0}, FALSE},
+ {FLAG_DPMS_SUSPENDTIME, "SuspendTime", OPTV_INTEGER,
+ {0}, FALSE},
+ {FLAG_DPMS_OFFTIME, "OffTime", OPTV_INTEGER,
+ {0}, FALSE},
+ {FLAG_PIXMAP, "Pixmap", OPTV_INTEGER,
+ {0}, FALSE},
+ {FLAG_NOPM, "NoPM", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_LOG, "Log", OPTV_STRING,
+ {0}, FALSE},
+ {FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING,
+ {0}, FALSE},
+ {FLAG_RANDR, "RandR", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING,
+ {0}, FALSE},
+ {FLAG_DRI2, "DRI2", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {-1, NULL, OPTV_NONE,
+ {0}, FALSE},
};
static Bool
@@ -759,6 +779,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
MessageType from;
const char *s;
XkbRMLVOSet set;
+
/* Default options. */
set.rules = "base";
set.model = "pc105";
@@ -772,13 +793,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
*/
optp = NULL;
if (flagsconf && flagsconf->flg_option_lst)
- optp = xf86optionListDup(flagsconf->flg_option_lst);
+ optp = xf86optionListDup(flagsconf->flg_option_lst);
if (layoutopts) {
- tmp = xf86optionListDup(layoutopts);
- if (optp)
- optp = xf86optionListMerge(optp, tmp);
- else
- optp = tmp;
+ tmp = xf86optionListDup(layoutopts);
+ if (optp)
+ optp = xf86optionListMerge(optp, tmp);
+ else
+ optp = tmp;
}
xf86ProcessOptions(-1, optp, FlagOptions);
@@ -790,23 +811,28 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI);
if (xf86Info.ignoreABI) {
- xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
+ xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
}
if (xf86SIGIOSupported()) {
- xf86Info.useSIGIO = xf86ReturnOptValBool(FlagOptions, FLAG_USE_SIGIO, USE_SIGIO_BY_DEFAULT);
- if (xf86IsOptionSet(FlagOptions, FLAG_USE_SIGIO)) {
- from = X_CONFIG;
- } else {
- from = X_DEFAULT;
- }
- if (!xf86Info.useSIGIO) {
- xf86Msg(from, "Disabling SIGIO handlers for input devices\n");
- } else if (from == X_CONFIG) {
- xf86Msg(from, "Enabling SIGIO handlers for input devices\n");
- }
- } else {
- xf86Info.useSIGIO = FALSE;
+ xf86Info.useSIGIO =
+ xf86ReturnOptValBool(FlagOptions, FLAG_USE_SIGIO,
+ USE_SIGIO_BY_DEFAULT);
+ if (xf86IsOptionSet(FlagOptions, FLAG_USE_SIGIO)) {
+ from = X_CONFIG;
+ }
+ else {
+ from = X_DEFAULT;
+ }
+ if (!xf86Info.useSIGIO) {
+ xf86Msg(from, "Disabling SIGIO handlers for input devices\n");
+ }
+ else if (from == X_CONFIG) {
+ xf86Msg(from, "Enabling SIGIO handlers for input devices\n");
+ }
+ }
+ else {
+ xf86Info.useSIGIO = FALSE;
}
if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) {
@@ -838,86 +864,92 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
*/
#ifdef XF86VIDMODE
if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEVIDMODE, &value))
- xf86Info.vidModeEnabled = !value;
+ xf86Info.vidModeEnabled = !value;
if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWNONLOCAL, &value))
- xf86Info.vidModeAllowNonLocal = value;
+ xf86Info.vidModeAllowNonLocal = value;
#endif
if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value))
- xf86Info.allowMouseOpenFail = value;
+ xf86Info.allowMouseOpenFail = value;
xf86Info.pmFlag = TRUE;
- if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value))
- xf86Info.pmFlag = !value;
+ if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value))
+ xf86Info.pmFlag = !value;
{
- if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) {
- if (!xf86NameCmp(s,"flush")) {
- xf86Msg(X_CONFIG, "Flushing logfile enabled\n");
- xf86Info.log = LogFlush;
- LogSetParameter(XLOG_FLUSH, TRUE);
- } else if (!xf86NameCmp(s,"sync")) {
- xf86Msg(X_CONFIG, "Syncing logfile enabled\n");
- xf86Info.log = LogSync;
- LogSetParameter(XLOG_FLUSH, TRUE);
- LogSetParameter(XLOG_SYNC, TRUE);
- } else {
- xf86Msg(X_WARNING,"Unknown Log option\n");
- }
- }
- }
-
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) {
+ if (!xf86NameCmp(s, "flush")) {
+ xf86Msg(X_CONFIG, "Flushing logfile enabled\n");
+ xf86Info.log = LogFlush;
+ LogSetParameter(XLOG_FLUSH, TRUE);
+ }
+ else if (!xf86NameCmp(s, "sync")) {
+ xf86Msg(X_CONFIG, "Syncing logfile enabled\n");
+ xf86Info.log = LogSync;
+ LogSetParameter(XLOG_FLUSH, TRUE);
+ LogSetParameter(XLOG_SYNC, TRUE);
+ }
+ else {
+ xf86Msg(X_WARNING, "Unknown Log option\n");
+ }
+ }
+ }
+
{
- if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))){
- int policy = PictureParseCmapPolicy (s);
- if (policy == PictureCmapPolicyInvalid)
- xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s);
- else
- {
- xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s);
- PictureCmapPolicy = policy;
- }
- }
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))) {
+ int policy = PictureParseCmapPolicy(s);
+
+ if (policy == PictureCmapPolicyInvalid)
+ xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s);
+ else {
+ xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s);
+ PictureCmapPolicy = policy;
+ }
+ }
}
#ifdef RANDR
xf86Info.disableRandR = FALSE;
xf86Info.randRFrom = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_RANDR, &value)) {
- xf86Info.disableRandR = !value;
- xf86Info.randRFrom = X_CONFIG;
+ xf86Info.disableRandR = !value;
+ xf86Info.randRFrom = X_CONFIG;
}
#endif
xf86Info.aiglx = TRUE;
xf86Info.aiglxFrom = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_AIGLX, &value)) {
- xf86Info.aiglx = value;
- xf86Info.aiglxFrom = X_CONFIG;
+ xf86Info.aiglx = value;
+ xf86Info.aiglxFrom = X_CONFIG;
}
#ifdef GLXEXT
xf86Info.glxVisuals = XF86_GlxVisualsTypical;
xf86Info.glxVisualsFrom = X_DEFAULT;
if ((s = xf86GetOptValString(FlagOptions, FLAG_GLX_VISUALS))) {
- if (!xf86NameCmp(s, "minimal")) {
- xf86Info.glxVisuals = XF86_GlxVisualsMinimal;
- } else if (!xf86NameCmp(s, "typical")) {
- xf86Info.glxVisuals = XF86_GlxVisualsTypical;
- } else if (!xf86NameCmp(s, "all")) {
- xf86Info.glxVisuals = XF86_GlxVisualsAll;
- } else {
- xf86Msg(X_WARNING,"Unknown GlxVisuals option\n");
- }
+ if (!xf86NameCmp(s, "minimal")) {
+ xf86Info.glxVisuals = XF86_GlxVisualsMinimal;
+ }
+ else if (!xf86NameCmp(s, "typical")) {
+ xf86Info.glxVisuals = XF86_GlxVisualsTypical;
+ }
+ else if (!xf86NameCmp(s, "all")) {
+ xf86Info.glxVisuals = XF86_GlxVisualsAll;
+ }
+ else {
+ xf86Msg(X_WARNING, "Unknown GlxVisuals option\n");
+ }
}
if (xf86GetOptValBool(FlagOptions, FLAG_AIGLX, &value)) {
- xf86Info.aiglx = value;
- xf86Info.aiglxFrom = X_CONFIG;
+ xf86Info.aiglx = value;
+ xf86Info.aiglxFrom = X_CONFIG;
}
#endif
/* if we're not hotplugging, force some input devices to exist */
- xf86Info.forceInputDevices = !(xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
+ xf86Info.forceInputDevices = !(xf86Info.autoAddDevices &&
+ xf86Info.autoEnableDevices);
/* when forcing input devices, we use kbd. otherwise evdev, so use the
* evdev rules set. */
@@ -930,8 +962,8 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Info.useDefaultFontPath = TRUE;
xf86Info.useDefaultFontPathFrom = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_USE_DEFAULT_FONT_PATH, &value)) {
- xf86Info.useDefaultFontPath = value;
- xf86Info.useDefaultFontPathFrom = X_CONFIG;
+ xf86Info.useDefaultFontPath = value;
+ xf86Info.useDefaultFontPathFrom = X_CONFIG;
}
/* Make sure that timers don't overflow CARD32's after multiplying */
@@ -940,86 +972,93 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_SAVER_BLANKTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN;
+ ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN;
else if (i != -1)
- xf86ConfigError("BlankTime value %d outside legal range of 0 - %d minutes",
- i, MAX_TIME_IN_MIN);
+ xf86ConfigError
+ ("BlankTime value %d outside legal range of 0 - %d minutes", i,
+ MAX_TIME_IN_MIN);
#ifdef DPMSExtension
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_STANDBYTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- DPMSStandbyTime = i * MILLI_PER_MIN;
+ DPMSStandbyTime = i * MILLI_PER_MIN;
else if (i != -1)
- xf86ConfigError("StandbyTime value %d outside legal range of 0 - %d minutes",
- i, MAX_TIME_IN_MIN);
+ xf86ConfigError
+ ("StandbyTime value %d outside legal range of 0 - %d minutes", i,
+ MAX_TIME_IN_MIN);
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_SUSPENDTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- DPMSSuspendTime = i * MILLI_PER_MIN;
+ DPMSSuspendTime = i * MILLI_PER_MIN;
else if (i != -1)
- xf86ConfigError("SuspendTime value %d outside legal range of 0 - %d minutes",
- i, MAX_TIME_IN_MIN);
+ xf86ConfigError
+ ("SuspendTime value %d outside legal range of 0 - %d minutes", i,
+ MAX_TIME_IN_MIN);
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_OFFTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- DPMSOffTime = i * MILLI_PER_MIN;
+ DPMSOffTime = i * MILLI_PER_MIN;
else if (i != -1)
- xf86ConfigError("OffTime value %d outside legal range of 0 - %d minutes",
- i, MAX_TIME_IN_MIN);
+ xf86ConfigError
+ ("OffTime value %d outside legal range of 0 - %d minutes", i,
+ MAX_TIME_IN_MIN);
#endif
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_PIXMAP, &i);
switch (i) {
case 24:
- pix24 = Pix24Use24;
- break;
+ pix24 = Pix24Use24;
+ break;
case 32:
- pix24 = Pix24Use32;
- break;
+ pix24 = Pix24Use32;
+ break;
case -1:
- break;
+ break;
default:
- xf86ConfigError("Pixmap option's value (%d) must be 24 or 32\n", i);
- return FALSE;
+ xf86ConfigError("Pixmap option's value (%d) must be 24 or 32\n", i);
+ return FALSE;
}
if (xf86Pix24 != Pix24DontCare) {
- xf86Info.pixmap24 = xf86Pix24;
- xf86Info.pix24From = X_CMDLINE;
- } else if (pix24 != Pix24DontCare) {
- xf86Info.pixmap24 = pix24;
- xf86Info.pix24From = X_CONFIG;
- } else {
- xf86Info.pixmap24 = Pix24DontCare;
- xf86Info.pix24From = X_DEFAULT;
+ xf86Info.pixmap24 = xf86Pix24;
+ xf86Info.pix24From = X_CMDLINE;
+ }
+ else if (pix24 != Pix24DontCare) {
+ xf86Info.pixmap24 = pix24;
+ xf86Info.pix24From = X_CONFIG;
+ }
+ else {
+ xf86Info.pixmap24 = Pix24DontCare;
+ xf86Info.pix24From = X_DEFAULT;
}
#ifdef PANORAMIX
from = X_DEFAULT;
if (!noPanoramiXExtension)
- from = X_CMDLINE;
+ from = X_CMDLINE;
else if (xf86GetOptValBool(FlagOptions, FLAG_XINERAMA, &value)) {
- noPanoramiXExtension = !value;
- from = X_CONFIG;
+ noPanoramiXExtension = !value;
+ from = X_CONFIG;
}
if (!noPanoramiXExtension)
- xf86Msg(from, "Xinerama: enabled\n");
+ xf86Msg(from, "Xinerama: enabled\n");
#endif
#ifdef DRI2
xf86Info.dri2 = FALSE;
xf86Info.dri2From = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_DRI2, &value)) {
- xf86Info.dri2 = value;
- xf86Info.dri2From = X_CONFIG;
+ xf86Info.dri2 = value;
+ xf86Info.dri2From = X_CONFIG;
}
#endif
return TRUE;
}
-Bool xf86DRI2Enabled(void)
+Bool
+xf86DRI2Enabled(void)
{
return xf86Info.dri2;
}
@@ -1029,17 +1068,17 @@ Bool xf86DRI2Enabled(void)
* free) it if present. All other devices are moved forward.
*/
static void
-freeDevice(InputInfoPtr *list, InputInfoPtr pInfo)
+freeDevice(InputInfoPtr * list, InputInfoPtr pInfo)
{
InputInfoPtr *devs;
for (devs = list; devs && *devs; devs++) {
- if (*devs == pInfo) {
- free(*devs);
- for (; devs && *devs; devs++)
- devs[0] = devs[1];
- break;
- }
+ if (*devs == pInfo) {
+ free(*devs);
+ for (; devs && *devs; devs++)
+ devs[0] = devs[1];
+ break;
+ }
}
}
@@ -1047,14 +1086,14 @@ freeDevice(InputInfoPtr *list, InputInfoPtr pInfo)
* Append pInfo to the null-terminated list, allocating space as necessary.
* pInfo is used as the last element.
*/
-static InputInfoPtr*
-addDevice(InputInfoPtr *list, InputInfoPtr pInfo)
+static InputInfoPtr *
+addDevice(InputInfoPtr * list, InputInfoPtr pInfo)
{
InputInfoPtr *devs;
int count = 1;
for (devs = list; devs && *devs; devs++)
- count++;
+ count++;
list = xnfrealloc(list, (count + 1) * sizeof(InputInfoPtr));
list[count] = NULL;
@@ -1084,14 +1123,16 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
InputInfoPtr corePointer = NULL, coreKeyboard = NULL;
Bool foundPointer = FALSE, foundKeyboard = FALSE;
const char *pointerMsg = NULL, *keyboardMsg = NULL;
- InputInfoPtr *devs, /* iterator */
- indp;
+ InputInfoPtr *devs, /* iterator */
+ indp;
InputInfoPtr Pointer, Keyboard;
XF86ConfInputPtr confInput;
XF86ConfInputRec defPtr, defKbd;
MessageType from = X_DEFAULT;
+
const char *mousedrivers[] = { "mouse", "synaptics", "evdev", "vmmouse",
- "void", NULL };
+ "void", NULL
+ };
/*
* First check if a core pointer or core keyboard have been specified
@@ -1100,249 +1141,255 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
*/
for (devs = servlayoutp->inputs; devs && *devs; devs++) {
indp = *devs;
- if (indp->options &&
- xf86CheckBoolOption(indp->options, "CorePointer", FALSE)) {
- if (!corePointer) {
- corePointer = indp;
- }
- }
- if (indp->options &&
- xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE)) {
- if (!coreKeyboard) {
- coreKeyboard = indp;
- }
- }
+ if (indp->options &&
+ xf86CheckBoolOption(indp->options, "CorePointer", FALSE)) {
+ if (!corePointer) {
+ corePointer = indp;
+ }
+ }
+ if (indp->options &&
+ xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE)) {
+ if (!coreKeyboard) {
+ coreKeyboard = indp;
+ }
+ }
}
confInput = NULL;
/* 1. Check for the -pointer command line option. */
if (xf86PointerName) {
- confInput = xf86findInput(xf86PointerName,
- xf86configptr->conf_input_lst);
- if (!confInput) {
- xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
- xf86PointerName);
- return FALSE;
- }
- from = X_CMDLINE;
- /*
- * If one was already specified in the ServerLayout, it needs to be
- * removed.
- */
- if (corePointer) {
- freeDevice(servlayoutp->inputs, corePointer);
- corePointer = NULL;
- }
- foundPointer = TRUE;
+ confInput = xf86findInput(xf86PointerName,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
+ xf86PointerName);
+ return FALSE;
+ }
+ from = X_CMDLINE;
+ /*
+ * If one was already specified in the ServerLayout, it needs to be
+ * removed.
+ */
+ if (corePointer) {
+ freeDevice(servlayoutp->inputs, corePointer);
+ corePointer = NULL;
+ }
+ foundPointer = TRUE;
}
/* 2. ServerLayout-specified core pointer. */
if (corePointer) {
- foundPointer = TRUE;
- from = X_CONFIG;
+ foundPointer = TRUE;
+ from = X_CONFIG;
}
/* 3. First core pointer device. */
if (!foundPointer && (xf86Info.forceInputDevices || implicitLayout)) {
- XF86ConfInputPtr p;
-
- for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
- if (p->inp_option_lst &&
- xf86CheckBoolOption(p->inp_option_lst, "CorePointer", FALSE)) {
- confInput = p;
- foundPointer = TRUE;
- from = X_DEFAULT;
- pointerMsg = "first core pointer device";
- break;
- }
- }
+ XF86ConfInputPtr p;
+
+ for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
+ if (p->inp_option_lst &&
+ xf86CheckBoolOption(p->inp_option_lst, "CorePointer", FALSE)) {
+ confInput = p;
+ foundPointer = TRUE;
+ from = X_DEFAULT;
+ pointerMsg = "first core pointer device";
+ break;
+ }
+ }
}
/* 4. First pointer with an allowed mouse driver. */
if (!foundPointer && xf86Info.forceInputDevices) {
- const char **driver = mousedrivers;
- confInput = xf86findInput(CONF_IMPLICIT_POINTER,
- xf86configptr->conf_input_lst);
- while (*driver && !confInput) {
- confInput = xf86findInputByDriver(*driver,
- xf86configptr->conf_input_lst);
- driver++;
- }
- if (confInput) {
- foundPointer = TRUE;
- from = X_DEFAULT;
- pointerMsg = "first mouse device";
- }
+ const char **driver = mousedrivers;
+
+ confInput = xf86findInput(CONF_IMPLICIT_POINTER,
+ xf86configptr->conf_input_lst);
+ while (*driver && !confInput) {
+ confInput = xf86findInputByDriver(*driver,
+ xf86configptr->conf_input_lst);
+ driver++;
+ }
+ if (confInput) {
+ foundPointer = TRUE;
+ from = X_DEFAULT;
+ pointerMsg = "first mouse device";
+ }
}
/* 5. Built-in default. */
if (!foundPointer && xf86Info.forceInputDevices) {
- memset(&defPtr, 0, sizeof(defPtr));
- defPtr.inp_identifier = strdup("<default pointer>");
- defPtr.inp_driver = strdup("mouse");
- confInput = &defPtr;
- foundPointer = TRUE;
- from = X_DEFAULT;
- pointerMsg = "default mouse configuration";
+ memset(&defPtr, 0, sizeof(defPtr));
+ defPtr.inp_identifier = strdup("<default pointer>");
+ defPtr.inp_driver = strdup("mouse");
+ confInput = &defPtr;
+ foundPointer = TRUE;
+ from = X_DEFAULT;
+ pointerMsg = "default mouse configuration";
}
/* Add the core pointer device to the layout, and set it to Core. */
if (foundPointer && confInput) {
- Pointer = xf86AllocateInput();
- if (Pointer)
- foundPointer = configInput(Pointer, confInput, from);
- if (foundPointer) {
- Pointer->options = xf86AddNewOption(Pointer->options,
- "CorePointer", "on");
- Pointer->options = xf86AddNewOption(Pointer->options,
- "driver", confInput->inp_driver);
- Pointer->options = xf86AddNewOption(Pointer->options,
- "identifier", confInput->inp_identifier);
- servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer);
- }
+ Pointer = xf86AllocateInput();
+ if (Pointer)
+ foundPointer = configInput(Pointer, confInput, from);
+ if (foundPointer) {
+ Pointer->options = xf86AddNewOption(Pointer->options,
+ "CorePointer", "on");
+ Pointer->options = xf86AddNewOption(Pointer->options,
+ "driver",
+ confInput->inp_driver);
+ Pointer->options =
+ xf86AddNewOption(Pointer->options, "identifier",
+ confInput->inp_identifier);
+ servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer);
+ }
}
if (!foundPointer && xf86Info.forceInputDevices) {
- /* This shouldn't happen. */
- xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
- xf86DeleteInput(Pointer, 0);
- return FALSE;
+ /* This shouldn't happen. */
+ xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
+ xf86DeleteInput(Pointer, 0);
+ return FALSE;
}
confInput = NULL;
/* 1. Check for the -keyboard command line option. */
if (xf86KeyboardName) {
- confInput = xf86findInput(xf86KeyboardName,
- xf86configptr->conf_input_lst);
- if (!confInput) {
- xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
- xf86KeyboardName);
- return FALSE;
- }
- from = X_CMDLINE;
- /*
- * If one was already specified in the ServerLayout, it needs to be
- * removed.
- */
- if (coreKeyboard) {
- freeDevice(servlayoutp->inputs, coreKeyboard);
- coreKeyboard = NULL;
- }
- foundKeyboard = TRUE;
+ confInput = xf86findInput(xf86KeyboardName,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
+ xf86KeyboardName);
+ return FALSE;
+ }
+ from = X_CMDLINE;
+ /*
+ * If one was already specified in the ServerLayout, it needs to be
+ * removed.
+ */
+ if (coreKeyboard) {
+ freeDevice(servlayoutp->inputs, coreKeyboard);
+ coreKeyboard = NULL;
+ }
+ foundKeyboard = TRUE;
}
/* 2. ServerLayout-specified core keyboard. */
if (coreKeyboard) {
- foundKeyboard = TRUE;
- from = X_CONFIG;
+ foundKeyboard = TRUE;
+ from = X_CONFIG;
}
/* 3. First core keyboard device. */
if (!foundKeyboard && (xf86Info.forceInputDevices || implicitLayout)) {
- XF86ConfInputPtr p;
-
- for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
- if (p->inp_option_lst &&
- xf86CheckBoolOption(p->inp_option_lst, "CoreKeyboard", FALSE)) {
- confInput = p;
- foundKeyboard = TRUE;
- from = X_DEFAULT;
- keyboardMsg = "first core keyboard device";
- break;
- }
- }
+ XF86ConfInputPtr p;
+
+ for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
+ if (p->inp_option_lst &&
+ xf86CheckBoolOption(p->inp_option_lst, "CoreKeyboard", FALSE)) {
+ confInput = p;
+ foundKeyboard = TRUE;
+ from = X_DEFAULT;
+ keyboardMsg = "first core keyboard device";
+ break;
+ }
+ }
}
/* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */
if (!foundKeyboard && xf86Info.forceInputDevices) {
- confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
- xf86configptr->conf_input_lst);
- if (!confInput) {
- confInput = xf86findInputByDriver("kbd",
- xf86configptr->conf_input_lst);
- }
- if (confInput) {
- foundKeyboard = TRUE;
- from = X_DEFAULT;
- keyboardMsg = "first keyboard device";
- }
+ confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ confInput = xf86findInputByDriver("kbd",
+ xf86configptr->conf_input_lst);
+ }
+ if (confInput) {
+ foundKeyboard = TRUE;
+ from = X_DEFAULT;
+ keyboardMsg = "first keyboard device";
+ }
}
/* 5. Built-in default. */
if (!foundKeyboard && xf86Info.forceInputDevices) {
- memset(&defKbd, 0, sizeof(defKbd));
- defKbd.inp_identifier = strdup("<default keyboard>");
- defKbd.inp_driver = strdup("kbd");
- confInput = &defKbd;
- foundKeyboard = TRUE;
- keyboardMsg = "default keyboard configuration";
- from = X_DEFAULT;
+ memset(&defKbd, 0, sizeof(defKbd));
+ defKbd.inp_identifier = strdup("<default keyboard>");
+ defKbd.inp_driver = strdup("kbd");
+ confInput = &defKbd;
+ foundKeyboard = TRUE;
+ keyboardMsg = "default keyboard configuration";
+ from = X_DEFAULT;
}
/* Add the core keyboard device to the layout, and set it to Core. */
if (foundKeyboard && confInput) {
- Keyboard = xf86AllocateInput();
- if (Keyboard)
- foundKeyboard = configInput(Keyboard, confInput, from);
- if (foundKeyboard) {
- Keyboard->options = xf86AddNewOption(Keyboard->options,
- "CoreKeyboard", "on");
- Keyboard->options = xf86AddNewOption(Keyboard->options,
- "driver", confInput->inp_driver);
- Keyboard->options = xf86AddNewOption(Keyboard->options,
- "identifier", confInput->inp_identifier);
- servlayoutp->inputs = addDevice(servlayoutp->inputs, Keyboard);
- }
+ Keyboard = xf86AllocateInput();
+ if (Keyboard)
+ foundKeyboard = configInput(Keyboard, confInput, from);
+ if (foundKeyboard) {
+ Keyboard->options = xf86AddNewOption(Keyboard->options,
+ "CoreKeyboard", "on");
+ Keyboard->options = xf86AddNewOption(Keyboard->options,
+ "driver",
+ confInput->inp_driver);
+ Keyboard->options =
+ xf86AddNewOption(Keyboard->options, "identifier",
+ confInput->inp_identifier);
+ servlayoutp->inputs = addDevice(servlayoutp->inputs, Keyboard);
+ }
}
if (!foundKeyboard && xf86Info.forceInputDevices) {
- /* This shouldn't happen. */
- xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
- xf86DeleteInput(Keyboard, 0);
- return FALSE;
+ /* This shouldn't happen. */
+ xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
+ xf86DeleteInput(Keyboard, 0);
+ return FALSE;
}
if (pointerMsg) {
- if (implicitLayout)
- xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
- pointerMsg);
- else
- xf86Msg(X_DEFAULT, "The core pointer device wasn't specified "
- "explicitly in the layout.\n"
- "\tUsing the %s.\n", pointerMsg);
+ if (implicitLayout)
+ xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
+ pointerMsg);
+ else
+ xf86Msg(X_DEFAULT, "The core pointer device wasn't specified "
+ "explicitly in the layout.\n"
+ "\tUsing the %s.\n", pointerMsg);
}
if (keyboardMsg) {
- if (implicitLayout)
- xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
- keyboardMsg);
- else
- xf86Msg(X_DEFAULT, "The core keyboard device wasn't specified "
- "explicitly in the layout.\n"
- "\tUsing the %s.\n", keyboardMsg);
+ if (implicitLayout)
+ xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
+ keyboardMsg);
+ else
+ xf86Msg(X_DEFAULT, "The core keyboard device wasn't specified "
+ "explicitly in the layout.\n"
+ "\tUsing the %s.\n", keyboardMsg);
}
if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
- const char *config_backend;
+ const char *config_backend;
+
#if defined(CONFIG_HAL)
- config_backend = "HAL";
+ config_backend = "HAL";
#elif defined(CONFIG_UDEV)
- config_backend = "udev";
+ config_backend = "udev";
#else
- config_backend = "wscons";
+ config_backend = "wscons";
#endif
- xf86Msg(X_INFO, "The server relies on %s to provide the list of "
- "input devices.\n\tIf no devices become available, "
- "reconfigure %s or disable AutoAddDevices.\n",
- config_backend, config_backend);
+ xf86Msg(X_INFO, "The server relies on %s to provide the list of "
+ "input devices.\n\tIf no devices become available, "
+ "reconfigure %s or disable AutoAddDevices.\n",
+ config_backend, config_backend);
#else
- xf86Msg(X_WARNING, "Hotplugging requested but the server was "
- "compiled without a config backend. "
- "No input devices were configured, the server "
- "will start without any input devices.\n");
+ xf86Msg(X_WARNING, "Hotplugging requested but the server was "
+ "compiled without a config backend. "
+ "No input devices were configured, the server "
+ "will start without any input devices.\n");
#endif
}
@@ -1355,12 +1402,12 @@ typedef enum {
} LayoutValues;
static OptionInfoRec LayoutOptions[] = {
- { LAYOUT_ISOLATEDEVICE, "IsolateDevice", OPTV_STRING,
- {0}, FALSE },
- { LAYOUT_SINGLECARD, "SingleCard", OPTV_BOOLEAN,
- {0}, FALSE },
- { -1, NULL, OPTV_NONE,
- {0}, FALSE },
+ {LAYOUT_ISOLATEDEVICE, "IsolateDevice", OPTV_STRING,
+ {0}, FALSE},
+ {LAYOUT_SINGLECARD, "SingleCard", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {-1, NULL, OPTV_NONE,
+ {0}, FALSE},
};
static Bool
@@ -1375,42 +1422,41 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
*/
irp = layout->lay_input_lst;
while (irp) {
- count++;
- irp = (XF86ConfInputrefPtr)irp->list.next;
+ count++;
+ irp = (XF86ConfInputrefPtr) irp->list.next;
}
DebugF("Found %d input devices in the layout section %s\n",
- count, layout->lay_identifier);
+ count, layout->lay_identifier);
indp = xnfcalloc((count + 1), sizeof(InputInfoPtr));
indp[count] = NULL;
irp = layout->lay_input_lst;
count = 0;
while (irp) {
- indp[count] = xf86AllocateInput();
- if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
- do {
- free(indp[count]);
- } while(count--);
- free(indp);
- return FALSE;
- }
- indp[count]->options = xf86OptionListMerge(indp[count]->options,
- irp->iref_option_lst);
- count++;
- irp = (XF86ConfInputrefPtr)irp->list.next;
+ indp[count] = xf86AllocateInput();
+ if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
+ do {
+ free(indp[count]);
+ } while (count--);
+ free(indp);
+ return FALSE;
+ }
+ indp[count]->options = xf86OptionListMerge(indp[count]->options,
+ irp->iref_option_lst);
+ count++;
+ irp = (XF86ConfInputrefPtr) irp->list.next;
}
servlayoutp->inputs = indp;
return TRUE;
}
-
/*
* figure out which layout is active, which screens are used in that layout,
* which drivers and monitors are used in these screens
*/
static Bool
configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
- char *default_layout)
+ char *default_layout)
{
XF86ConfAdjacencyPtr adjp;
XF86ConfInactivePtr idp;
@@ -1423,7 +1469,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
int i = 0, j;
if (!servlayoutp)
- return FALSE;
+ return FALSE;
/*
* which layout section is the active one?
@@ -1433,18 +1479,18 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
*/
from = X_DEFAULT;
if (xf86LayoutName != NULL)
- from = X_CMDLINE;
+ from = X_CMDLINE;
else if (default_layout) {
- xf86LayoutName = default_layout;
- from = X_CONFIG;
+ xf86LayoutName = default_layout;
+ from = X_CONFIG;
}
if (xf86LayoutName != NULL) {
- if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL) {
- xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n",
- xf86LayoutName);
- return FALSE;
- }
- conf_layout = l;
+ if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL) {
+ xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n",
+ xf86LayoutName);
+ return FALSE;
+ }
+ conf_layout = l;
}
xf86Msg(from, "ServerLayout \"%s\"\n", conf_layout->lay_identifier);
adjp = conf_layout->lay_adjacency_lst;
@@ -1457,12 +1503,12 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
*/
while (adjp) {
count++;
- adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
+ adjp = (XF86ConfAdjacencyPtr) adjp->list.next;
}
DebugF("Found %d screens in the layout section %s",
count, conf_layout->lay_identifier);
- if (!count) /* alloc enough storage even if no screen is specified */
+ if (!count) /* alloc enough storage even if no screen is specified */
count = 1;
slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec));
@@ -1476,107 +1522,105 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
count = 0;
while (adjp) {
slp[count].screen = xnfcalloc(1, sizeof(confScreenRec));
- if (adjp->adj_scrnum < 0)
- scrnum = count;
- else
- scrnum = adjp->adj_scrnum;
- if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
- X_CONFIG)) {
- do {
- free(slp[count].screen);
- } while(count--);
- free(slp);
- return FALSE;
- }
- slp[count].x = adjp->adj_x;
- slp[count].y = adjp->adj_y;
- slp[count].refname = adjp->adj_refscreen;
- switch (adjp->adj_where) {
- case CONF_ADJ_OBSOLETE:
- slp[count].where = PosObsolete;
- slp[count].topname = adjp->adj_top_str;
- slp[count].bottomname = adjp->adj_bottom_str;
- slp[count].leftname = adjp->adj_left_str;
- slp[count].rightname = adjp->adj_right_str;
- break;
- case CONF_ADJ_ABSOLUTE:
- slp[count].where = PosAbsolute;
- break;
- case CONF_ADJ_RIGHTOF:
- slp[count].where = PosRightOf;
- break;
- case CONF_ADJ_LEFTOF:
- slp[count].where = PosLeftOf;
- break;
- case CONF_ADJ_ABOVE:
- slp[count].where = PosAbove;
- break;
- case CONF_ADJ_BELOW:
- slp[count].where = PosBelow;
- break;
- case CONF_ADJ_RELATIVE:
- slp[count].where = PosRelative;
- break;
- }
+ if (adjp->adj_scrnum < 0)
+ scrnum = count;
+ else
+ scrnum = adjp->adj_scrnum;
+ if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
+ X_CONFIG)) {
+ do {
+ free(slp[count].screen);
+ } while (count--);
+ free(slp);
+ return FALSE;
+ }
+ slp[count].x = adjp->adj_x;
+ slp[count].y = adjp->adj_y;
+ slp[count].refname = adjp->adj_refscreen;
+ switch (adjp->adj_where) {
+ case CONF_ADJ_OBSOLETE:
+ slp[count].where = PosObsolete;
+ slp[count].topname = adjp->adj_top_str;
+ slp[count].bottomname = adjp->adj_bottom_str;
+ slp[count].leftname = adjp->adj_left_str;
+ slp[count].rightname = adjp->adj_right_str;
+ break;
+ case CONF_ADJ_ABSOLUTE:
+ slp[count].where = PosAbsolute;
+ break;
+ case CONF_ADJ_RIGHTOF:
+ slp[count].where = PosRightOf;
+ break;
+ case CONF_ADJ_LEFTOF:
+ slp[count].where = PosLeftOf;
+ break;
+ case CONF_ADJ_ABOVE:
+ slp[count].where = PosAbove;
+ break;
+ case CONF_ADJ_BELOW:
+ slp[count].where = PosBelow;
+ break;
+ case CONF_ADJ_RELATIVE:
+ slp[count].where = PosRelative;
+ break;
+ }
count++;
- adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
+ adjp = (XF86ConfAdjacencyPtr) adjp->list.next;
}
/* No screen was specified in the layout. take the first one from the
* config file, or - if it is NULL - configScreen autogenerates one for
* us */
- if (!count)
- {
+ if (!count) {
slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
- if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst,
+ if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst,
0, X_CONFIG)) {
- free(slp[0].screen);
- free(slp);
- return FALSE;
- }
+ free(slp[0].screen);
+ free(slp);
+ return FALSE;
+ }
}
/* XXX Need to tie down the upper left screen. */
/* Fill in the refscreen and top/bottom/left/right values */
for (i = 0; i < count; i++) {
- for (j = 0; j < count; j++) {
- if (slp[i].refname &&
- strcmp(slp[i].refname, slp[j].screen->id) == 0) {
- slp[i].refscreen = slp[j].screen;
- }
- if (slp[i].topname &&
- strcmp(slp[i].topname, slp[j].screen->id) == 0) {
- slp[i].top = slp[j].screen;
- }
- if (slp[i].bottomname &&
- strcmp(slp[i].bottomname, slp[j].screen->id) == 0) {
- slp[i].bottom = slp[j].screen;
- }
- if (slp[i].leftname &&
- strcmp(slp[i].leftname, slp[j].screen->id) == 0) {
- slp[i].left = slp[j].screen;
- }
- if (slp[i].rightname &&
- strcmp(slp[i].rightname, slp[j].screen->id) == 0) {
- slp[i].right = slp[j].screen;
- }
- }
- if (slp[i].where != PosObsolete
- && slp[i].where != PosAbsolute
- && !slp[i].refscreen) {
- xf86Msg(X_ERROR,"Screen %s doesn't exist: deleting placement\n",
- slp[i].refname);
- slp[i].where = PosAbsolute;
- slp[i].x = 0;
- slp[i].y = 0;
- }
+ for (j = 0; j < count; j++) {
+ if (slp[i].refname &&
+ strcmp(slp[i].refname, slp[j].screen->id) == 0) {
+ slp[i].refscreen = slp[j].screen;
+ }
+ if (slp[i].topname &&
+ strcmp(slp[i].topname, slp[j].screen->id) == 0) {
+ slp[i].top = slp[j].screen;
+ }
+ if (slp[i].bottomname &&
+ strcmp(slp[i].bottomname, slp[j].screen->id) == 0) {
+ slp[i].bottom = slp[j].screen;
+ }
+ if (slp[i].leftname &&
+ strcmp(slp[i].leftname, slp[j].screen->id) == 0) {
+ slp[i].left = slp[j].screen;
+ }
+ if (slp[i].rightname &&
+ strcmp(slp[i].rightname, slp[j].screen->id) == 0) {
+ slp[i].right = slp[j].screen;
+ }
+ }
+ if (slp[i].where != PosObsolete
+ && slp[i].where != PosAbsolute && !slp[i].refscreen) {
+ xf86Msg(X_ERROR, "Screen %s doesn't exist: deleting placement\n",
+ slp[i].refname);
+ slp[i].where = PosAbsolute;
+ slp[i].x = 0;
+ slp[i].y = 0;
+ }
}
if (!count)
- saved_count = 1;
+ saved_count = 1;
else
- saved_count = count;
+ saved_count = count;
/*
* Count the number of inactive devices.
*/
@@ -1584,7 +1628,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
idp = conf_layout->lay_inactive_lst;
while (idp) {
count++;
- idp = (XF86ConfInactivePtr)idp->list.next;
+ idp = (XF86ConfInactivePtr) idp->list.next;
}
DebugF("Found %d inactive devices in the layout section %s\n",
count, conf_layout->lay_identifier);
@@ -1593,14 +1637,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
idp = conf_layout->lay_inactive_lst;
count = 0;
while (idp) {
- if (!configDevice(&gdp[count], idp->inactive_device, FALSE))
- goto bail;
+ if (!configDevice(&gdp[count], idp->inactive_device, FALSE))
+ goto bail;
count++;
- idp = (XF86ConfInactivePtr)idp->list.next;
+ idp = (XF86ConfInactivePtr) idp->list.next;
}
if (!configInputDevices(conf_layout, servlayoutp))
- goto bail;
+ goto bail;
servlayoutp->id = conf_layout->lay_identifier;
servlayoutp->screens = slp;
@@ -1610,10 +1654,10 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
return TRUE;
-bail:
+ bail:
do {
- free(slp[saved_count].screen);
- } while(saved_count--);
+ free(slp[saved_count].screen);
+ } while (saved_count--);
free(slp);
free(gdp);
return FALSE;
@@ -1634,7 +1678,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
XF86ConfLayoutRec layout;
if (!servlayoutp)
- return FALSE;
+ return FALSE;
/*
* which screen section is the active one?
@@ -1645,13 +1689,13 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
from = X_CONFIG;
if (xf86ScreenName != NULL) {
- if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL) {
- xf86Msg(X_ERROR, "No Screen section called \"%s\"\n",
- xf86ScreenName);
- return FALSE;
- }
- conf_screen = s;
- from = X_CMDLINE;
+ if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL) {
+ xf86Msg(X_ERROR, "No Screen section called \"%s\"\n",
+ xf86ScreenName);
+ return FALSE;
+ }
+ conf_screen = s;
+ from = X_CMDLINE;
}
/* We have exactly one screen */
@@ -1660,8 +1704,8 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
slp[1].screen = NULL;
if (!configScreen(slp[0].screen, conf_screen, 0, from)) {
- free(slp);
- return FALSE;
+ free(slp);
+ return FALSE;
}
servlayoutp->id = "(implicit)";
servlayoutp->screens = slp;
@@ -1671,14 +1715,15 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
memset(&layout, 0, sizeof(layout));
layout.lay_identifier = servlayoutp->id;
if (xf86layoutAddInputDevices(xf86configptr, &layout) > 0) {
- if (!configInputDevices(&layout, servlayoutp))
- return FALSE;
- from = X_DEFAULT;
- } else {
- /* Set up an empty input device list, then look for some core devices. */
- indp = xnfalloc(sizeof(InputInfoPtr));
- *indp = NULL;
- servlayoutp->inputs = indp;
+ if (!configInputDevices(&layout, servlayoutp))
+ return FALSE;
+ from = X_DEFAULT;
+ }
+ else {
+ /* Set up an empty input device list, then look for some core devices. */
+ indp = xnfalloc(sizeof(InputInfoPtr));
+ *indp = NULL;
+ servlayoutp->inputs = indp;
}
return TRUE;
@@ -1691,31 +1736,31 @@ configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor)
XF86ConfVideoPortPtr conf_port;
xf86Msg(X_CONFIG, "| |-->VideoAdaptor \"%s\"\n",
- conf_adaptor->va_identifier);
+ conf_adaptor->va_identifier);
adaptor->identifier = conf_adaptor->va_identifier;
adaptor->options = conf_adaptor->va_option_lst;
if (conf_adaptor->va_busid || conf_adaptor->va_driver) {
- xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n");
- return FALSE;
+ xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n");
+ return FALSE;
}
/*
* figure out how many videoport subsections there are and fill them in
*/
conf_port = conf_adaptor->va_port_lst;
- while(conf_port) {
+ while (conf_port) {
count++;
- conf_port = (XF86ConfVideoPortPtr)conf_port->list.next;
+ conf_port = (XF86ConfVideoPortPtr) conf_port->list.next;
}
adaptor->ports = xnfalloc((count) * sizeof(confXvPortRec));
adaptor->numports = count;
count = 0;
conf_port = conf_adaptor->va_port_lst;
- while(conf_port) {
- adaptor->ports[count].identifier = conf_port->vp_identifier;
- adaptor->ports[count].options = conf_port->vp_option_lst;
+ while (conf_port) {
+ adaptor->ports[count].identifier = conf_port->vp_identifier;
+ adaptor->ports[count].options = conf_port->vp_option_lst;
count++;
- conf_port = (XF86ConfVideoPortPtr)conf_port->list.next;
+ conf_port = (XF86ConfVideoPortPtr) conf_port->list.next;
}
return TRUE;
@@ -1723,7 +1768,7 @@ configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor)
static Bool
configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
- MessageType from)
+ MessageType from)
{
int count = 0;
XF86ConfDisplayPtr dispptr;
@@ -1739,96 +1784,98 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
}
xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier,
- scrnum);
+ scrnum);
/*
* now we fill in the elements of the screen
*/
- screenp->id = conf_screen->scrn_identifier;
- screenp->screennum = scrnum;
+ screenp->id = conf_screen->scrn_identifier;
+ screenp->screennum = scrnum;
screenp->defaultdepth = conf_screen->scrn_defaultdepth;
screenp->defaultbpp = conf_screen->scrn_defaultbpp;
screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp;
- screenp->monitor = xnfcalloc(1, sizeof(MonRec));
+ screenp->monitor = xnfcalloc(1, sizeof(MonRec));
/* If no monitor is specified, create a default one. */
if (!conf_screen->scrn_monitor) {
- XF86ConfMonitorRec defMon;
+ XF86ConfMonitorRec defMon;
- memset(&defMon, 0, sizeof(defMon));
- defMon.mon_identifier = "<default monitor>";
- if (!configMonitor(screenp->monitor, &defMon))
- return FALSE;
- defaultMonitor = TRUE;
- } else {
- if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor))
- return FALSE;
+ memset(&defMon, 0, sizeof(defMon));
+ defMon.mon_identifier = "<default monitor>";
+ if (!configMonitor(screenp->monitor, &defMon))
+ return FALSE;
+ defaultMonitor = TRUE;
+ }
+ else {
+ if (!configMonitor(screenp->monitor, conf_screen->scrn_monitor))
+ return FALSE;
}
/* Configure the device. If there isn't one configured, attach to the
* first inactive one that we can configure. If there's none that work,
* set it to NULL so that the section can be autoconfigured later */
- screenp->device = xnfcalloc(1, sizeof(GDevRec));
+ screenp->device = xnfcalloc(1, sizeof(GDevRec));
if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) {
conf_screen->scrn_device = xf86configptr->conf_device_lst;
- xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n"
- "\tUsing the first device section listed.\n", screenp->id);
+ xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n"
+ "\tUsing the first device section listed.\n", screenp->id);
}
- if (configDevice(screenp->device,conf_screen->scrn_device, TRUE)) {
+ if (configDevice(screenp->device, conf_screen->scrn_device, TRUE)) {
screenp->device->myScreenSection = screenp;
- } else {
+ }
+ else {
screenp->device = NULL;
}
screenp->options = conf_screen->scrn_option_lst;
-
+
/*
* figure out how many display subsections there are and fill them in
*/
dispptr = conf_screen->scrn_display_lst;
- while(dispptr) {
+ while (dispptr) {
count++;
- dispptr = (XF86ConfDisplayPtr)dispptr->list.next;
+ dispptr = (XF86ConfDisplayPtr) dispptr->list.next;
}
- screenp->displays = xnfalloc((count) * sizeof(DispRec));
+ screenp->displays = xnfalloc((count) * sizeof(DispRec));
screenp->numdisplays = count;
-
+
/* Fill in the default Virtual size, if any */
if (conf_screen->scrn_virtualX && conf_screen->scrn_virtualY) {
- for (count = 0, dispptr = conf_screen->scrn_display_lst;
- dispptr;
- dispptr = (XF86ConfDisplayPtr)dispptr->list.next, count++) {
- screenp->displays[count].virtualX = conf_screen->scrn_virtualX;
- screenp->displays[count].virtualY = conf_screen->scrn_virtualY;
- }
+ for (count = 0, dispptr = conf_screen->scrn_display_lst;
+ dispptr;
+ dispptr = (XF86ConfDisplayPtr) dispptr->list.next, count++) {
+ screenp->displays[count].virtualX = conf_screen->scrn_virtualX;
+ screenp->displays[count].virtualY = conf_screen->scrn_virtualY;
+ }
}
/* Now do the per-Display Virtual sizes */
count = 0;
dispptr = conf_screen->scrn_display_lst;
- while(dispptr) {
- configDisplay(&(screenp->displays[count]),dispptr);
+ while (dispptr) {
+ configDisplay(&(screenp->displays[count]), dispptr);
count++;
- dispptr = (XF86ConfDisplayPtr)dispptr->list.next;
+ dispptr = (XF86ConfDisplayPtr) dispptr->list.next;
}
/*
* figure out how many videoadaptor references there are and fill them in
*/
conf_adaptor = conf_screen->scrn_adaptor_lst;
- while(conf_adaptor) {
+ while (conf_adaptor) {
count++;
- conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next;
+ conf_adaptor = (XF86ConfAdaptorLinkPtr) conf_adaptor->list.next;
}
screenp->xvadaptors = xnfalloc((count) * sizeof(confXvAdaptorRec));
screenp->numxvadaptors = 0;
conf_adaptor = conf_screen->scrn_adaptor_lst;
- while(conf_adaptor) {
+ while (conf_adaptor) {
if (configXvAdaptor(&(screenp->xvadaptors[screenp->numxvadaptors]),
- conf_adaptor->al_adaptor))
- screenp->numxvadaptors++;
- conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next;
+ conf_adaptor->al_adaptor))
+ screenp->numxvadaptors++;
+ conf_adaptor = (XF86ConfAdaptorLinkPtr) conf_adaptor->list.next;
}
if (defaultMonitor) {
- xf86Msg(X_DEFAULT, "No monitor specified for screen \"%s\".\n"
- "\tUsing a default monitor configuration.\n", screenp->id);
+ xf86Msg(X_DEFAULT, "No monitor specified for screen \"%s\".\n"
+ "\tUsing a default monitor configuration.\n", screenp->id);
}
return TRUE;
}
@@ -1839,28 +1886,27 @@ typedef enum {
} MonitorValues;
static OptionInfoRec MonitorOptions[] = {
- { MON_REDUCEDBLANKING, "ReducedBlanking", OPTV_BOOLEAN,
- {0}, FALSE },
- { MON_MAX_PIX_CLOCK, "MaxPixClock", OPTV_FREQ,
- {0}, FALSE },
- { -1, NULL, OPTV_NONE,
- {0}, FALSE },
+ {MON_REDUCEDBLANKING, "ReducedBlanking", OPTV_BOOLEAN,
+ {0}, FALSE},
+ {MON_MAX_PIX_CLOCK, "MaxPixClock", OPTV_FREQ,
+ {0}, FALSE},
+ {-1, NULL, OPTV_NONE,
+ {0}, FALSE},
};
static Bool
configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
{
int count;
- DisplayModePtr mode,last = NULL;
+ DisplayModePtr mode, last = NULL;
XF86ConfModeLinePtr cmodep;
XF86ConfModesPtr modes;
XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst;
- Gamma zeros = {0.0, 0.0, 0.0};
+ Gamma zeros = { 0.0, 0.0, 0.0 };
float badgamma = 0.0;
double maxPixClock;
-
- xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n",
- conf_monitor->mon_identifier);
+
+ xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n", conf_monitor->mon_identifier);
monitorp->id = conf_monitor->mon_identifier;
monitorp->vendor = conf_monitor->mon_vendor;
monitorp->model = conf_monitor->mon_modelname;
@@ -1875,17 +1921,16 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
/*
* fill in the monitor structure
- */
- for( count = 0 ;
- count < conf_monitor->mon_n_hsync && count < MAX_HSYNC;
- count++) {
+ */
+ for (count = 0;
+ count < conf_monitor->mon_n_hsync && count < MAX_HSYNC; count++) {
monitorp->hsync[count].hi = conf_monitor->mon_hsync[count].hi;
monitorp->hsync[count].lo = conf_monitor->mon_hsync[count].lo;
}
monitorp->nHsync = count;
- for( count = 0 ;
- count < conf_monitor->mon_n_vrefresh && count < MAX_VREFRESH;
- count++) {
+ for (count = 0;
+ count < conf_monitor->mon_n_vrefresh && count < MAX_VREFRESH;
+ count++) {
monitorp->vrefresh[count].hi = conf_monitor->mon_vrefresh[count].hi;
monitorp->vrefresh[count].lo = conf_monitor->mon_vrefresh[count].lo;
}
@@ -1894,27 +1939,23 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
/*
* first we collect the mode lines from the UseModes directive
*/
- while(modeslnk)
- {
- modes = xf86findModes (modeslnk->ml_modes_str,
- xf86configptr->conf_modes_lst);
- modeslnk->ml_modes = modes;
-
-
- /* now add the modes found in the modes
- section to the list of modes for this
- monitor unless it has been added before
- because we are reusing the same section
- for another screen */
- if (xf86itemNotSublist(
- (GenericListPtr)conf_monitor->mon_modeline_lst,
- (GenericListPtr)modes->mon_modeline_lst)) {
- conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr)
- xf86addListItem(
- (GenericListPtr)conf_monitor->mon_modeline_lst,
- (GenericListPtr)modes->mon_modeline_lst);
- }
- modeslnk = modeslnk->list.next;
+ while (modeslnk) {
+ modes = xf86findModes(modeslnk->ml_modes_str,
+ xf86configptr->conf_modes_lst);
+ modeslnk->ml_modes = modes;
+
+ /* now add the modes found in the modes
+ section to the list of modes for this
+ monitor unless it has been added before
+ because we are reusing the same section
+ for another screen */
+ if (xf86itemNotSublist((GenericListPtr) conf_monitor->mon_modeline_lst,
+ (GenericListPtr) modes->mon_modeline_lst)) {
+ conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr)
+ xf86addListItem((GenericListPtr) conf_monitor->mon_modeline_lst,
+ (GenericListPtr) modes->mon_modeline_lst);
+ }
+ modeslnk = modeslnk->list.next;
}
/*
@@ -1923,23 +1964,23 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
* is double linked
*/
cmodep = conf_monitor->mon_modeline_lst;
- while( cmodep ) {
+ while (cmodep) {
mode = xnfcalloc(1, sizeof(DisplayModeRec));
- mode->type = 0;
- mode->Clock = cmodep->ml_clock;
- mode->HDisplay = cmodep->ml_hdisplay;
+ mode->type = 0;
+ mode->Clock = cmodep->ml_clock;
+ mode->HDisplay = cmodep->ml_hdisplay;
mode->HSyncStart = cmodep->ml_hsyncstart;
- mode->HSyncEnd = cmodep->ml_hsyncend;
- mode->HTotal = cmodep->ml_htotal;
- mode->VDisplay = cmodep->ml_vdisplay;
+ mode->HSyncEnd = cmodep->ml_hsyncend;
+ mode->HTotal = cmodep->ml_htotal;
+ mode->VDisplay = cmodep->ml_vdisplay;
mode->VSyncStart = cmodep->ml_vsyncstart;
- mode->VSyncEnd = cmodep->ml_vsyncend;
- mode->VTotal = cmodep->ml_vtotal;
- mode->Flags = cmodep->ml_flags;
- mode->HSkew = cmodep->ml_hskew;
- mode->VScan = cmodep->ml_vscan;
- mode->name = xnfstrdup(cmodep->ml_identifier);
- if( last ) {
+ mode->VSyncEnd = cmodep->ml_vsyncend;
+ mode->VTotal = cmodep->ml_vtotal;
+ mode->Flags = cmodep->ml_flags;
+ mode->HSkew = cmodep->ml_hskew;
+ mode->VScan = cmodep->ml_vscan;
+ mode->name = xnfstrdup(cmodep->ml_identifier);
+ if (last) {
mode->prev = last;
last->next = mode;
}
@@ -1951,52 +1992,53 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
mode->prev = NULL;
}
last = mode;
- cmodep = (XF86ConfModeLinePtr)cmodep->list.next;
+ cmodep = (XF86ConfModeLinePtr) cmodep->list.next;
}
- if(last){
- last->next = NULL;
+ if (last) {
+ last->next = NULL;
}
monitorp->Last = last;
/* add the (VESA) default modes */
- if (! addDefaultModes(monitorp) )
- return FALSE;
+ if (!addDefaultModes(monitorp))
+ return FALSE;
if (conf_monitor->mon_gamma_red > GAMMA_ZERO)
- monitorp->gamma.red = conf_monitor->mon_gamma_red;
+ monitorp->gamma.red = conf_monitor->mon_gamma_red;
if (conf_monitor->mon_gamma_green > GAMMA_ZERO)
- monitorp->gamma.green = conf_monitor->mon_gamma_green;
+ monitorp->gamma.green = conf_monitor->mon_gamma_green;
if (conf_monitor->mon_gamma_blue > GAMMA_ZERO)
- monitorp->gamma.blue = conf_monitor->mon_gamma_blue;
-
+ monitorp->gamma.blue = conf_monitor->mon_gamma_blue;
+
/* Check that the gamma values are within range */
if (monitorp->gamma.red > GAMMA_ZERO &&
- (monitorp->gamma.red < GAMMA_MIN ||
- monitorp->gamma.red > GAMMA_MAX)) {
- badgamma = monitorp->gamma.red;
- } else if (monitorp->gamma.green > GAMMA_ZERO &&
- (monitorp->gamma.green < GAMMA_MIN ||
- monitorp->gamma.green > GAMMA_MAX)) {
- badgamma = monitorp->gamma.green;
- } else if (monitorp->gamma.blue > GAMMA_ZERO &&
- (monitorp->gamma.blue < GAMMA_MIN ||
- monitorp->gamma.blue > GAMMA_MAX)) {
- badgamma = monitorp->gamma.blue;
+ (monitorp->gamma.red < GAMMA_MIN || monitorp->gamma.red > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.red;
+ }
+ else if (monitorp->gamma.green > GAMMA_ZERO &&
+ (monitorp->gamma.green < GAMMA_MIN ||
+ monitorp->gamma.green > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.green;
+ }
+ else if (monitorp->gamma.blue > GAMMA_ZERO &&
+ (monitorp->gamma.blue < GAMMA_MIN ||
+ monitorp->gamma.blue > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.blue;
}
if (badgamma > GAMMA_ZERO) {
- xf86ConfigError("Gamma value %.f is out of range (%.2f - %.1f)\n",
- badgamma, GAMMA_MIN, GAMMA_MAX);
- return FALSE;
+ xf86ConfigError("Gamma value %.f is out of range (%.2f - %.1f)\n",
+ badgamma, GAMMA_MIN, GAMMA_MAX);
+ return FALSE;
}
xf86ProcessOptions(-1, monitorp->options, MonitorOptions);
xf86GetOptValBool(MonitorOptions, MON_REDUCEDBLANKING,
&monitorp->reducedblanking);
if (xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ,
- &maxPixClock) == TRUE) {
- monitorp->maxPixClock = (int) maxPixClock;
+ &maxPixClock) == TRUE) {
+ monitorp->maxPixClock = (int) maxPixClock;
}
-
+
return TRUE;
}
@@ -2006,71 +2048,71 @@ lookupVisual(const char *visname)
int i;
if (!visname || !*visname)
- return -1;
+ return -1;
for (i = 0; i <= DirectColor; i++) {
- if (!xf86nameCompare(visname, xf86VisualNames[i]))
- break;
+ if (!xf86nameCompare(visname, xf86VisualNames[i]))
+ break;
}
if (i <= DirectColor)
- return i;
+ return i;
return -1;
}
-
static Bool
configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display)
{
int count = 0;
XF86ModePtr modep;
-
- displayp->frameX0 = conf_display->disp_frameX0;
- displayp->frameY0 = conf_display->disp_frameY0;
- displayp->virtualX = conf_display->disp_virtualX;
- displayp->virtualY = conf_display->disp_virtualY;
- displayp->depth = conf_display->disp_depth;
- displayp->fbbpp = conf_display->disp_bpp;
- displayp->weight.red = conf_display->disp_weight.red;
- displayp->weight.green = conf_display->disp_weight.green;
- displayp->weight.blue = conf_display->disp_weight.blue;
- displayp->blackColour.red = conf_display->disp_black.red;
+
+ displayp->frameX0 = conf_display->disp_frameX0;
+ displayp->frameY0 = conf_display->disp_frameY0;
+ displayp->virtualX = conf_display->disp_virtualX;
+ displayp->virtualY = conf_display->disp_virtualY;
+ displayp->depth = conf_display->disp_depth;
+ displayp->fbbpp = conf_display->disp_bpp;
+ displayp->weight.red = conf_display->disp_weight.red;
+ displayp->weight.green = conf_display->disp_weight.green;
+ displayp->weight.blue = conf_display->disp_weight.blue;
+ displayp->blackColour.red = conf_display->disp_black.red;
displayp->blackColour.green = conf_display->disp_black.green;
- displayp->blackColour.blue = conf_display->disp_black.blue;
- displayp->whiteColour.red = conf_display->disp_white.red;
+ displayp->blackColour.blue = conf_display->disp_black.blue;
+ displayp->whiteColour.red = conf_display->disp_white.red;
displayp->whiteColour.green = conf_display->disp_white.green;
- displayp->whiteColour.blue = conf_display->disp_white.blue;
- displayp->options = conf_display->disp_option_lst;
+ displayp->whiteColour.blue = conf_display->disp_white.blue;
+ displayp->options = conf_display->disp_option_lst;
if (conf_display->disp_visual) {
- displayp->defaultVisual = lookupVisual(conf_display->disp_visual);
- if (displayp->defaultVisual == -1) {
- xf86ConfigError("Invalid visual name: \"%s\"",
- conf_display->disp_visual);
- return FALSE;
- }
- } else {
- displayp->defaultVisual = -1;
- }
-
+ displayp->defaultVisual = lookupVisual(conf_display->disp_visual);
+ if (displayp->defaultVisual == -1) {
+ xf86ConfigError("Invalid visual name: \"%s\"",
+ conf_display->disp_visual);
+ return FALSE;
+ }
+ }
+ else {
+ displayp->defaultVisual = -1;
+ }
+
/*
* now hook in the modes
*/
modep = conf_display->disp_mode_lst;
- while(modep) {
+ while (modep) {
count++;
- modep = (XF86ModePtr)modep->list.next;
+ modep = (XF86ModePtr) modep->list.next;
}
- displayp->modes = xnfalloc((count+1) * sizeof(char*));
+ displayp->modes = xnfalloc((count + 1) * sizeof(char *));
modep = conf_display->disp_mode_lst;
count = 0;
- while(modep) {
+ while (modep) {
displayp->modes[count] = modep->mode_name;
count++;
- modep = (XF86ModePtr)modep->list.next;
+ modep = (XF86ModePtr) modep->list.next;
}
displayp->modes[count] = NULL;
-
+
return TRUE;
}
@@ -2084,11 +2126,11 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
}
if (active)
- xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n",
- conf_device->dev_identifier);
+ xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n",
+ conf_device->dev_identifier);
else
- xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n",
- conf_device->dev_identifier);
+ xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n",
+ conf_device->dev_identifier);
devicep->identifier = conf_device->dev_identifier;
devicep->vendor = conf_device->dev_vendor;
@@ -2111,16 +2153,16 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
devicep->screen = conf_device->dev_screen;
for (i = 0; i < MAXDACSPEEDS; i++) {
- if (i < CONF_MAXDACSPEEDS)
+ if (i < CONF_MAXDACSPEEDS)
devicep->dacSpeeds[i] = conf_device->dev_dacSpeeds[i];
- else
- devicep->dacSpeeds[i] = 0;
+ else
+ devicep->dacSpeeds[i] = 0;
}
devicep->numclocks = conf_device->dev_clocks;
if (devicep->numclocks > MAXCLOCKS)
- devicep->numclocks = MAXCLOCKS;
+ devicep->numclocks = MAXCLOCKS;
for (i = 0; i < devicep->numclocks; i++) {
- devicep->clock[i] = conf_device->dev_clock[i];
+ devicep->clock[i] = conf_device->dev_clock[i];
}
devicep->claimed = FALSE;
@@ -2131,20 +2173,21 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
static void
configDRI(XF86ConfDRIPtr drip)
{
- struct group *grp;
+ struct group *grp;
- xf86ConfigDRI.group = -1;
- xf86ConfigDRI.mode = 0;
+ xf86ConfigDRI.group = -1;
+ xf86ConfigDRI.mode = 0;
if (drip) {
- if (drip->dri_group_name) {
- if ((grp = getgrnam(drip->dri_group_name)))
- xf86ConfigDRI.group = grp->gr_gid;
- } else {
- if (drip->dri_group >= 0)
- xf86ConfigDRI.group = drip->dri_group;
- }
- xf86ConfigDRI.mode = drip->dri_mode;
+ if (drip->dri_group_name) {
+ if ((grp = getgrnam(drip->dri_group_name)))
+ xf86ConfigDRI.group = grp->gr_gid;
+ }
+ else {
+ if (drip->dri_group >= 0)
+ xf86ConfigDRI.group = drip->dri_group;
+ }
+ xf86ConfigDRI.mode = drip->dri_mode;
}
}
#endif
@@ -2155,49 +2198,51 @@ configExtensions(XF86ConfExtensionsPtr conf_ext)
XF86OptionPtr o;
if (conf_ext && conf_ext->ext_option_lst) {
- for (o = conf_ext->ext_option_lst; o; o = xf86NextOption(o)) {
- char *name = xf86OptionName(o);
- char *val = xf86OptionValue(o);
- char *n;
- Bool enable = TRUE;
-
- /* Handle "No<ExtensionName>" */
- n = xf86NormalizeName(name);
- if (strncmp(n, "no", 2) == 0) {
- name += 2;
- enable = FALSE;
- }
-
- if (!val ||
- xf86NameCmp(val, "enable") == 0 ||
- xf86NameCmp(val, "enabled") == 0 ||
- xf86NameCmp(val, "on") == 0 ||
- xf86NameCmp(val, "1") == 0 ||
- xf86NameCmp(val, "yes") == 0 ||
- xf86NameCmp(val, "true") == 0) {
- /* NOTHING NEEDED -- enabling is handled below */
- } else if (xf86NameCmp(val, "disable") == 0 ||
- xf86NameCmp(val, "disabled") == 0 ||
- xf86NameCmp(val, "off") == 0 ||
- xf86NameCmp(val, "0") == 0 ||
- xf86NameCmp(val, "no") == 0 ||
- xf86NameCmp(val, "false") == 0) {
- enable = !enable;
- } else {
- xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val);
- free(n);
- continue;
- }
-
- if (EnableDisableExtension(name, enable)) {
- xf86Msg(X_CONFIG, "Extension \"%s\" is %s\n",
- name, enable ? "enabled" : "disabled");
- } else {
- xf86Msg(X_WARNING, "Ignoring unrecognized extension \"%s\"\n",
+ for (o = conf_ext->ext_option_lst; o; o = xf86NextOption(o)) {
+ char *name = xf86OptionName(o);
+ char *val = xf86OptionValue(o);
+ char *n;
+ Bool enable = TRUE;
+
+ /* Handle "No<ExtensionName>" */
+ n = xf86NormalizeName(name);
+ if (strncmp(n, "no", 2) == 0) {
+ name += 2;
+ enable = FALSE;
+ }
+
+ if (!val ||
+ xf86NameCmp(val, "enable") == 0 ||
+ xf86NameCmp(val, "enabled") == 0 ||
+ xf86NameCmp(val, "on") == 0 ||
+ xf86NameCmp(val, "1") == 0 ||
+ xf86NameCmp(val, "yes") == 0 || xf86NameCmp(val, "true") == 0) {
+ /* NOTHING NEEDED -- enabling is handled below */
+ }
+ else if (xf86NameCmp(val, "disable") == 0 ||
+ xf86NameCmp(val, "disabled") == 0 ||
+ xf86NameCmp(val, "off") == 0 ||
+ xf86NameCmp(val, "0") == 0 ||
+ xf86NameCmp(val, "no") == 0 ||
+ xf86NameCmp(val, "false") == 0) {
+ enable = !enable;
+ }
+ else {
+ xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val);
+ free(n);
+ continue;
+ }
+
+ if (EnableDisableExtension(name, enable)) {
+ xf86Msg(X_CONFIG, "Extension \"%s\" is %s\n",
+ name, enable ? "enabled" : "disabled");
+ }
+ else {
+ xf86Msg(X_WARNING, "Ignoring unrecognized extension \"%s\"\n",
name);
- }
- free(n);
- }
+ }
+ free(n);
+ }
}
}
@@ -2219,12 +2264,11 @@ modeIsPresent(DisplayModePtr mode, MonPtr monitorp)
DisplayModePtr knownmodes = monitorp->Modes;
/* all I can think of is a linear search... */
- while(knownmodes != NULL)
- {
- if(!strcmp(mode->name, knownmodes->name) &&
- !(knownmodes->type & M_T_DEFAULT))
- return TRUE;
- knownmodes = knownmodes->next;
+ while (knownmodes != NULL) {
+ if (!strcmp(mode->name, knownmodes->name) &&
+ !(knownmodes->type & M_T_DEFAULT))
+ return TRUE;
+ knownmodes = knownmodes->next;
}
return FALSE;
}
@@ -2236,16 +2280,15 @@ addDefaultModes(MonPtr monitorp)
DisplayModePtr last = monitorp->Last;
int i = 0;
- for (i = 0; i < xf86NumDefaultModes; i++)
- {
- mode = xf86DuplicateMode(&xf86DefaultModes[i]);
- if (!modeIsPresent(mode, monitorp))
- {
- monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode);
- last = mode;
- } else {
- free(mode);
- }
+ for (i = 0; i < xf86NumDefaultModes; i++) {
+ mode = xf86DuplicateMode(&xf86DefaultModes[i]);
+ if (!modeIsPresent(mode, monitorp)) {
+ monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode);
+ last = mode;
+ }
+ else {
+ free(mode);
+ }
}
monitorp->Last = last;
@@ -2253,27 +2296,25 @@ addDefaultModes(MonPtr monitorp)
}
static void
-checkInput(serverLayoutPtr layout, Bool implicit_layout) {
+checkInput(serverLayoutPtr layout, Bool implicit_layout)
+{
checkCoreInputDevices(layout, implicit_layout);
/* Unless we're forcing input devices, disable mouse/kbd devices in the
* config. Otherwise the same physical device is added multiple times,
* leading to duplicate events.
*/
- if (!xf86Info.forceInputDevices && layout->inputs)
- {
+ if (!xf86Info.forceInputDevices && layout->inputs) {
InputInfoPtr *dev = layout->inputs;
BOOL warned = FALSE;
- while(*dev)
- {
+ while (*dev) {
if (strcmp((*dev)->driver, "kbd") == 0 ||
strcmp((*dev)->driver, "mouse") == 0 ||
- strcmp((*dev)->driver, "vmmouse") == 0)
- {
+ strcmp((*dev)->driver, "vmmouse") == 0) {
InputInfoPtr *current;
- if (!warned)
- {
+
+ if (!warned) {
xf86Msg(X_WARNING, "Hotplugging is on, devices using "
"drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.\n");
warned = TRUE;
@@ -2287,8 +2328,9 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) {
do {
*current = *(current + 1);
current++;
- } while(*current);
- } else
+ } while (*current);
+ }
+ else
dev++;
}
}
@@ -2305,63 +2347,66 @@ xf86HandleConfigFile(Bool autoconfig)
Bool implicit_layout = FALSE;
if (!autoconfig) {
- char *filename, *dirname, *sysdirname;
- const char *filesearch, *dirsearch;
- MessageType filefrom = X_DEFAULT;
- MessageType dirfrom = X_DEFAULT;
-
- if (!xf86PrivsElevated()) {
- filesearch = ALL_CONFIGPATH;
- dirsearch = ALL_CONFIGDIRPATH;
- } else {
- filesearch = RESTRICTED_CONFIGPATH;
- dirsearch = RESTRICTED_CONFIGDIRPATH;
- }
-
- if (xf86ConfigFile)
- filefrom = X_CMDLINE;
- if (xf86ConfigDir)
- dirfrom = X_CMDLINE;
-
- xf86initConfigFiles();
- sysdirname = xf86openConfigDirFiles(SYS_CONFIGDIRPATH, NULL,
- PROJECTROOT);
- dirname = xf86openConfigDirFiles(dirsearch, xf86ConfigDir, PROJECTROOT);
- filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT);
- if (filename) {
- xf86MsgVerb(filefrom, 0, "Using config file: \"%s\"\n", filename);
- xf86ConfigFile = xnfstrdup(filename);
- } else {
- if (xf86ConfigFile)
- xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n",
- xf86ConfigFile);
- }
- if (dirname) {
- xf86MsgVerb(dirfrom, 0, "Using config directory: \"%s\"\n",
- dirname);
- xf86ConfigDir = xnfstrdup(dirname);
- } else {
- if (xf86ConfigDir)
- xf86Msg(X_ERROR,
- "Unable to locate/open config directory: \"%s\"\n",
- xf86ConfigDir);
- }
- if (sysdirname)
- xf86MsgVerb(X_DEFAULT, 0, "Using system config directory \"%s\"\n",
- sysdirname);
- if (!filename && !dirname && !sysdirname)
- return CONFIG_NOFILE;
-
- free(filename);
- free(dirname);
- free(sysdirname);
- }
-
- if ((xf86configptr = xf86readConfigFile ()) == NULL) {
- xf86Msg(X_ERROR, "Problem parsing the config file\n");
- return CONFIG_PARSE_ERROR;
- }
- xf86closeConfigFile ();
+ char *filename, *dirname, *sysdirname;
+ const char *filesearch, *dirsearch;
+ MessageType filefrom = X_DEFAULT;
+ MessageType dirfrom = X_DEFAULT;
+
+ if (!xf86PrivsElevated()) {
+ filesearch = ALL_CONFIGPATH;
+ dirsearch = ALL_CONFIGDIRPATH;
+ }
+ else {
+ filesearch = RESTRICTED_CONFIGPATH;
+ dirsearch = RESTRICTED_CONFIGDIRPATH;
+ }
+
+ if (xf86ConfigFile)
+ filefrom = X_CMDLINE;
+ if (xf86ConfigDir)
+ dirfrom = X_CMDLINE;
+
+ xf86initConfigFiles();
+ sysdirname = xf86openConfigDirFiles(SYS_CONFIGDIRPATH, NULL,
+ PROJECTROOT);
+ dirname = xf86openConfigDirFiles(dirsearch, xf86ConfigDir, PROJECTROOT);
+ filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT);
+ if (filename) {
+ xf86MsgVerb(filefrom, 0, "Using config file: \"%s\"\n", filename);
+ xf86ConfigFile = xnfstrdup(filename);
+ }
+ else {
+ if (xf86ConfigFile)
+ xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n",
+ xf86ConfigFile);
+ }
+ if (dirname) {
+ xf86MsgVerb(dirfrom, 0, "Using config directory: \"%s\"\n",
+ dirname);
+ xf86ConfigDir = xnfstrdup(dirname);
+ }
+ else {
+ if (xf86ConfigDir)
+ xf86Msg(X_ERROR,
+ "Unable to locate/open config directory: \"%s\"\n",
+ xf86ConfigDir);
+ }
+ if (sysdirname)
+ xf86MsgVerb(X_DEFAULT, 0, "Using system config directory \"%s\"\n",
+ sysdirname);
+ if (!filename && !dirname && !sysdirname)
+ return CONFIG_NOFILE;
+
+ free(filename);
+ free(dirname);
+ free(sysdirname);
+ }
+
+ if ((xf86configptr = xf86readConfigFile()) == NULL) {
+ xf86Msg(X_ERROR, "Problem parsing the config file\n");
+ return CONFIG_PARSE_ERROR;
+ }
+ xf86closeConfigFile();
/* Initialise a few things. */
@@ -2377,59 +2422,65 @@ xf86HandleConfigFile(Bool autoconfig)
/* First check if a layout section is present, and if it is valid. */
if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) {
- if (xf86ScreenName == NULL) {
- xf86Msg(X_DEFAULT,
- "No Layout section. Using the first Screen section.\n");
- }
- if (!configImpliedLayout(&xf86ConfigLayout,
- xf86configptr->conf_screen_lst,
- xf86configptr)) {
+ if (xf86ScreenName == NULL) {
+ xf86Msg(X_DEFAULT,
+ "No Layout section. Using the first Screen section.\n");
+ }
+ if (!configImpliedLayout(&xf86ConfigLayout,
+ xf86configptr->conf_screen_lst,
+ xf86configptr)) {
xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
- return CONFIG_PARSE_ERROR;
- }
- implicit_layout = TRUE;
- } else {
- if (xf86configptr->conf_flags != NULL) {
- char *dfltlayout = NULL;
- pointer optlist = xf86configptr->conf_flags->flg_option_lst;
-
- if (optlist && xf86FindOption(optlist, "defaultserverlayout"))
- dfltlayout = xf86SetStrOption(optlist, "defaultserverlayout", NULL);
- if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
- dfltlayout)) {
- xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
- return CONFIG_PARSE_ERROR;
- }
- } else {
- if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
- NULL)) {
- xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
- return CONFIG_PARSE_ERROR;
- }
- }
+ return CONFIG_PARSE_ERROR;
+ }
+ implicit_layout = TRUE;
+ }
+ else {
+ if (xf86configptr->conf_flags != NULL) {
+ char *dfltlayout = NULL;
+ pointer optlist = xf86configptr->conf_flags->flg_option_lst;
+
+ if (optlist && xf86FindOption(optlist, "defaultserverlayout"))
+ dfltlayout =
+ xf86SetStrOption(optlist, "defaultserverlayout", NULL);
+ if (!configLayout
+ (&xf86ConfigLayout, xf86configptr->conf_layout_lst,
+ dfltlayout)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return CONFIG_PARSE_ERROR;
+ }
+ }
+ else {
+ if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
+ NULL)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return CONFIG_PARSE_ERROR;
+ }
+ }
}
xf86ProcessOptions(-1, xf86ConfigLayout.options, LayoutOptions);
#ifdef XSERVER_LIBPCIACCESS
if ((scanptr = xf86GetOptValString(LayoutOptions, LAYOUT_ISOLATEDEVICE))) {
- ; /* IsolateDevice specified; overrides SingleCard */
- } else {
- xf86GetOptValBool(LayoutOptions, LAYOUT_SINGLECARD, &singlecard);
- if (singlecard)
- scanptr = xf86ConfigLayout.screens->screen->device->busID;
+ ; /* IsolateDevice specified; overrides SingleCard */
+ }
+ else {
+ xf86GetOptValBool(LayoutOptions, LAYOUT_SINGLECARD, &singlecard);
+ if (singlecard)
+ scanptr = xf86ConfigLayout.screens->screen->device->busID;
}
if (scanptr) {
- if (strncmp(scanptr, "PCI:", 4) != 0) {
- xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n"
- "\tIgnoring IsolateDevice option.\n");
- } else
- xf86PciIsolateDevice(scanptr);
+ if (strncmp(scanptr, "PCI:", 4) != 0) {
+ xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n"
+ "\tIgnoring IsolateDevice option.\n");
+ }
+ else
+ xf86PciIsolateDevice(scanptr);
}
#endif
/* Now process everything else */
- if (!configServerFlags(xf86configptr->conf_flags,xf86ConfigLayout.options)){
- ErrorF ("Problem when converting the config data structures\n");
- return CONFIG_PARSE_ERROR;
+ if (!configServerFlags(xf86configptr->conf_flags, xf86ConfigLayout.options)) {
+ ErrorF("Problem when converting the config data structures\n");
+ return CONFIG_PARSE_ERROR;
}
configFiles(xf86configptr->conf_files);
@@ -2446,13 +2497,13 @@ xf86HandleConfigFile(Bool autoconfig)
*/
#ifdef XF86VIDMODE
if (xf86VidModeDisabled)
- xf86Info.vidModeEnabled = FALSE;
+ xf86Info.vidModeEnabled = FALSE;
if (xf86VidModeAllowNonLocal)
- xf86Info.vidModeAllowNonLocal = TRUE;
+ xf86Info.vidModeAllowNonLocal = TRUE;
#endif
if (xf86AllowMouseOpenFail)
- xf86Info.allowMouseOpenFail = TRUE;
+ xf86Info.allowMouseOpenFail = TRUE;
return CONFIG_OK;
}
diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c
index 994d46fc2..6f69117d3 100644
--- a/xorg-server/hw/xfree86/common/xf86Configure.c
+++ b/xorg-server/hw/xfree86/common/xf86Configure.c
@@ -43,7 +43,7 @@
typedef struct _DevToConfig {
GDevRec GDev;
- struct pci_device * pVideo;
+ struct pci_device *pVideo;
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
sbusDevicePtr sVideo;
#endif
@@ -77,28 +77,29 @@ static const char *DFLT_MOUSE_PROTO = "auto";
* the caller fill in the rest and/or change it as it sees fit.
*/
GDevPtr
-xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset)
+xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData,
+ int chipset)
{
int ret, i, j;
if (!xf86DoConfigure || !xf86DoConfigurePass1)
- return NULL;
+ return NULL;
/* Check for duplicates */
- for (i = 0; i < nDevToConfig; i++) {
+ for (i = 0; i < nDevToConfig; i++) {
switch (bus) {
#ifdef XSERVER_LIBPCIACCESS
- case BUS_PCI:
- ret = xf86PciConfigure(busData, DevToConfig[i].pVideo);
- break;
+ case BUS_PCI:
+ ret = xf86PciConfigure(busData, DevToConfig[i].pVideo);
+ break;
#endif
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
- case BUS_SBUS:
- ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo);
- break;
+ case BUS_SBUS:
+ ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo);
+ break;
#endif
- default:
- return NULL;
+ default:
+ return NULL;
}
if (ret == 0)
goto out;
@@ -107,112 +108,113 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
/* Allocate new structure occurrence */
i = nDevToConfig++;
DevToConfig =
- xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec));
+ xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec));
memset(DevToConfig + i, 0, sizeof(DevToConfigRec));
DevToConfig[i].GDev.chipID =
- DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1;
+ DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1;
DevToConfig[i].iDriver = CurrentDriver;
/* Fill in what we know, converting the driver name to lower case */
DevToConfig[i].GDev.driver = xnfalloc(strlen(driver) + 1);
- for (j = 0; (DevToConfig[i].GDev.driver[j] = tolower(driver[j])); j++);
+ for (j = 0; (DevToConfig[i].GDev.driver[j] = tolower(driver[j])); j++);
switch (bus) {
#ifdef XSERVER_LIBPCIACCESS
- case BUS_PCI:
- xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo,
- &DevToConfig[i].GDev, &chipset);
- break;
+ case BUS_PCI:
+ xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo,
+ &DevToConfig[i].GDev, &chipset);
+ break;
#endif
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
- case BUS_SBUS:
- xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo,
- &DevToConfig[i].GDev);
- break;
+ case BUS_SBUS:
+ xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo,
+ &DevToConfig[i].GDev);
+ break;
#endif
- default:
- break;
+ default:
+ break;
}
/* Get driver's available options */
if (xf86DriverList[CurrentDriver]->AvailableOptions)
- DevToConfig[i].GDev.options = (OptionInfoPtr)
- (*xf86DriverList[CurrentDriver]->AvailableOptions)(chipset,
- bus);
+ DevToConfig[i].GDev.options = (OptionInfoPtr)
+ (*xf86DriverList[CurrentDriver]->AvailableOptions) (chipset, bus);
return &DevToConfig[i].GDev;
-out:
+ out:
return NULL;
}
static XF86ConfInputPtr
-configureInputSection (void)
+configureInputSection(void)
{
XF86ConfInputPtr mouse = NULL;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
- ptr->inp_identifier = "Keyboard0";
+ parsePrologue(XF86ConfInputPtr, XF86ConfInputRec)
+
+ ptr->inp_identifier = "Keyboard0";
ptr->inp_driver = "kbd";
ptr->list.next = NULL;
/* Crude mechanism to auto-detect mouse (os dependent) */
- {
- int fd;
+ {
+ int fd;
- fd = open(DFLT_MOUSE_DEV, 0);
- if (fd != -1) {
- foundMouse = TRUE;
- close(fd);
- }
+ fd = open(DFLT_MOUSE_DEV, 0);
+ if (fd != -1) {
+ foundMouse = TRUE;
+ close(fd);
+ }
}
mouse = calloc(1, sizeof(XF86ConfInputRec));
mouse->inp_identifier = "Mouse0";
mouse->inp_driver = "mouse";
- mouse->inp_option_lst =
- xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"),
- strdup(DFLT_MOUSE_PROTO));
- mouse->inp_option_lst =
- xf86addNewOption(mouse->inp_option_lst, strdup("Device"),
- strdup(DFLT_MOUSE_DEV));
- mouse->inp_option_lst =
- xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"),
- strdup("4 5 6 7"));
- ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
+ mouse->inp_option_lst =
+ xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"),
+ strdup(DFLT_MOUSE_PROTO));
+ mouse->inp_option_lst =
+ xf86addNewOption(mouse->inp_option_lst, strdup("Device"),
+ strdup(DFLT_MOUSE_DEV));
+ mouse->inp_option_lst =
+ xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"),
+ strdup("4 5 6 7"));
+ ptr = (XF86ConfInputPtr) xf86addListItem((glp) ptr, (glp) mouse);
return ptr;
}
static XF86ConfScreenPtr
-configureScreenSection (int screennum)
+configureScreenSection(int screennum)
{
int i;
- int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
- parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
+ int depths[] = { 1, 4, 8, 15, 16, 24 /*, 32 */ };
+ parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec)
- XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum);
+ XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum);
XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum);
XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum);
- for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
- {
- XF86ConfDisplayPtr display;
-
- display = calloc(1, sizeof(XF86ConfDisplayRec));
- display->disp_depth = depths[i];
- display->disp_black.red = display->disp_white.red = -1;
- display->disp_black.green = display->disp_white.green = -1;
- display->disp_black.blue = display->disp_white.blue = -1;
- ptr->scrn_display_lst = (XF86ConfDisplayPtr)xf86addListItem(
- (glp)ptr->scrn_display_lst, (glp)display);
+ for (i = 0; i < sizeof(depths) / sizeof(depths[0]); i++) {
+ XF86ConfDisplayPtr display;
+
+ display = calloc(1, sizeof(XF86ConfDisplayRec));
+ display->disp_depth = depths[i];
+ display->disp_black.red = display->disp_white.red = -1;
+ display->disp_black.green = display->disp_white.green = -1;
+ display->disp_black.blue = display->disp_white.blue = -1;
+ ptr->scrn_display_lst = (XF86ConfDisplayPtr) xf86addListItem((glp) ptr->
+ scrn_display_lst,
+ (glp)
+ display);
}
return ptr;
}
-static const char*
+static const char *
optionTypeToString(OptionValueType type)
{
switch (type) {
@@ -223,7 +225,7 @@ optionTypeToString(OptionValueType type)
case OPTV_STRING:
return "<str>";
case OPTV_ANYSTR:
- return "[<str>]";
+ return "[<str>]";
case OPTV_REAL:
return "<f>";
case OPTV_BOOLEAN:
@@ -238,20 +240,21 @@ optionTypeToString(OptionValueType type)
}
static XF86ConfDevicePtr
-configureDeviceSection (int screennum)
+configureDeviceSection(int screennum)
{
OptionInfoPtr p;
int i = 0;
- parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
- /* Move device info to parser structure */
- if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1)
+ parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec)
+
+ /* Move device info to parser structure */
+ if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1)
ptr->dev_identifier = NULL;
ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
ptr->dev_busid = DevToConfig[screennum].GDev.busID;
ptr->dev_driver = DevToConfig[screennum].GDev.driver;
ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac;
- for (i = 0; (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS); i++)
+ for (i = 0; (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS); i++)
ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i];
ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam;
ptr->dev_textclockfreq = DevToConfig[screennum].GDev.textClockFreq;
@@ -259,7 +262,8 @@ configureDeviceSection (int screennum)
ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase;
ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase;
ptr->dev_clockchip = DevToConfig[screennum].GDev.clockchip;
- for (i = 0; (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks); i++)
+ for (i = 0; (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks);
+ i++)
ptr->dev_clock[i] = DevToConfig[screennum].GDev.clock[i];
ptr->dev_clocks = i;
ptr->dev_chipid = DevToConfig[screennum].GDev.chipID;
@@ -268,161 +272,165 @@ configureDeviceSection (int screennum)
/* Make sure older drivers don't segv */
if (DevToConfig[screennum].GDev.options) {
- /* Fill in the available driver options for people to use */
- const char *descrip =
- " ### Available Driver options are:-\n"
- " ### Values: <i>: integer, <f>: float, "
- "<bool>: \"True\"/\"False\",\n"
- " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
- " ### <percent>: \"<f>%\"\n"
- " ### [arg]: arg optional\n";
- ptr->dev_comment = strdup(descrip);
- if (ptr->dev_comment) {
- for (p = DevToConfig[screennum].GDev.options;
- p->name != NULL; p++) {
- char *p_e;
- const char *prefix = " #Option ";
- const char *middle = " \t# ";
- const char *suffix = "\n";
- const char *opttype = optionTypeToString(p->type);
- char *optname;
- int len = strlen(ptr->dev_comment) + strlen(prefix) +
- strlen(middle) + strlen(suffix) + 1;
-
- if (asprintf(&optname, "\"%s\"", p->name) == -1)
- break;
-
- len += max(20, strlen(optname));
- len += strlen(opttype);
-
- ptr->dev_comment = realloc(ptr->dev_comment, len);
- if (!ptr->dev_comment)
- break;
- p_e = ptr->dev_comment + strlen(ptr->dev_comment);
- sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle,
- opttype, suffix);
- free(optname);
- }
- }
+ /* Fill in the available driver options for people to use */
+ const char *descrip =
+ " ### Available Driver options are:-\n"
+ " ### Values: <i>: integer, <f>: float, "
+ "<bool>: \"True\"/\"False\",\n"
+ " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
+ " ### <percent>: \"<f>%\"\n"
+ " ### [arg]: arg optional\n";
+ ptr->dev_comment = strdup(descrip);
+ if (ptr->dev_comment) {
+ for (p = DevToConfig[screennum].GDev.options; p->name != NULL; p++) {
+ char *p_e;
+ const char *prefix = " #Option ";
+ const char *middle = " \t# ";
+ const char *suffix = "\n";
+ const char *opttype = optionTypeToString(p->type);
+ char *optname;
+ int len = strlen(ptr->dev_comment) + strlen(prefix) +
+ strlen(middle) + strlen(suffix) + 1;
+
+ if (asprintf(&optname, "\"%s\"", p->name) == -1)
+ break;
+
+ len += max(20, strlen(optname));
+ len += strlen(opttype);
+
+ ptr->dev_comment = realloc(ptr->dev_comment, len);
+ if (!ptr->dev_comment)
+ break;
+ p_e = ptr->dev_comment + strlen(ptr->dev_comment);
+ sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle,
+ opttype, suffix);
+ free(optname);
+ }
+ }
}
return ptr;
}
static XF86ConfLayoutPtr
-configureLayoutSection (void)
+configureLayoutSection(void)
{
int scrnum = 0;
- parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec)
- ptr->lay_identifier = "X.org Configured";
+ parsePrologue(XF86ConfLayoutPtr, XF86ConfLayoutRec)
- {
- XF86ConfInputrefPtr iptr;
+ ptr->lay_identifier = "X.org Configured";
- iptr = malloc (sizeof (XF86ConfInputrefRec));
- iptr->list.next = NULL;
- iptr->iref_option_lst = NULL;
- iptr->iref_inputdev_str = "Mouse0";
- iptr->iref_option_lst =
- xf86addNewOption (iptr->iref_option_lst, strdup("CorePointer"), NULL);
- ptr->lay_input_lst = (XF86ConfInputrefPtr)
- xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
+ {
+ XF86ConfInputrefPtr iptr;
+
+ iptr = malloc(sizeof(XF86ConfInputrefRec));
+ iptr->list.next = NULL;
+ iptr->iref_option_lst = NULL;
+ iptr->iref_inputdev_str = "Mouse0";
+ iptr->iref_option_lst =
+ xf86addNewOption(iptr->iref_option_lst, strdup("CorePointer"),
+ NULL);
+ ptr->lay_input_lst = (XF86ConfInputrefPtr)
+ xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr);
}
{
- XF86ConfInputrefPtr iptr;
-
- iptr = malloc (sizeof (XF86ConfInputrefRec));
- iptr->list.next = NULL;
- iptr->iref_option_lst = NULL;
- iptr->iref_inputdev_str = "Keyboard0";
- iptr->iref_option_lst =
- xf86addNewOption (iptr->iref_option_lst, strdup("CoreKeyboard"), NULL);
- ptr->lay_input_lst = (XF86ConfInputrefPtr)
- xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
- }
-
- for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
- XF86ConfAdjacencyPtr aptr;
-
- aptr = malloc (sizeof (XF86ConfAdjacencyRec));
- aptr->list.next = NULL;
- aptr->adj_x = 0;
- aptr->adj_y = 0;
- aptr->adj_scrnum = scrnum;
- XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum);
- if (scrnum == 0) {
- aptr->adj_where = CONF_ADJ_ABSOLUTE;
- aptr->adj_refscreen = NULL;
- }
- else {
- aptr->adj_where = CONF_ADJ_RIGHTOF;
- XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1);
- }
- ptr->lay_adjacency_lst =
- (XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst,
- (glp)aptr);
+ XF86ConfInputrefPtr iptr;
+
+ iptr = malloc(sizeof(XF86ConfInputrefRec));
+ iptr->list.next = NULL;
+ iptr->iref_option_lst = NULL;
+ iptr->iref_inputdev_str = "Keyboard0";
+ iptr->iref_option_lst =
+ xf86addNewOption(iptr->iref_option_lst, strdup("CoreKeyboard"),
+ NULL);
+ ptr->lay_input_lst = (XF86ConfInputrefPtr)
+ xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr);
+ }
+
+ for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
+ XF86ConfAdjacencyPtr aptr;
+
+ aptr = malloc(sizeof(XF86ConfAdjacencyRec));
+ aptr->list.next = NULL;
+ aptr->adj_x = 0;
+ aptr->adj_y = 0;
+ aptr->adj_scrnum = scrnum;
+ XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum);
+ if (scrnum == 0) {
+ aptr->adj_where = CONF_ADJ_ABSOLUTE;
+ aptr->adj_refscreen = NULL;
+ }
+ else {
+ aptr->adj_where = CONF_ADJ_RIGHTOF;
+ XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1);
+ }
+ ptr->lay_adjacency_lst =
+ (XF86ConfAdjacencyPtr) xf86addListItem((glp) ptr->lay_adjacency_lst,
+ (glp) aptr);
}
return ptr;
}
static XF86ConfFlagsPtr
-configureFlagsSection (void)
+configureFlagsSection(void)
{
- parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec)
+ parsePrologue(XF86ConfFlagsPtr, XF86ConfFlagsRec)
- return ptr;
+ return ptr;
}
static XF86ConfModulePtr
-configureModuleSection (void)
+configureModuleSection(void)
{
char **elist, **el;
+
/* Find the list of extension & font modules. */
const char *esubdirs[] = {
- "extensions",
- "fonts",
- NULL
+ "extensions",
+ "fonts",
+ NULL
};
- parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec)
+ parsePrologue(XF86ConfModulePtr, XF86ConfModuleRec)
- elist = LoaderListDirs(esubdirs, NULL);
+ elist = LoaderListDirs(esubdirs, NULL);
if (elist) {
- for (el = elist; *el; el++) {
- XF86LoadPtr module;
-
- module = calloc(1, sizeof(XF86LoadRec));
- module->load_name = *el;
- ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
- (glp)ptr->mod_load_lst, (glp)module);
- }
- free(elist);
+ for (el = elist; *el; el++) {
+ XF86LoadPtr module;
+
+ module = calloc(1, sizeof(XF86LoadRec));
+ module->load_name = *el;
+ ptr->mod_load_lst = (XF86LoadPtr) xf86addListItem((glp) ptr->
+ mod_load_lst,
+ (glp) module);
+ }
+ free(elist);
}
return ptr;
}
static XF86ConfFilesPtr
-configureFilesSection (void)
+configureFilesSection(void)
{
- parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec)
+ parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec)
+
+ if (xf86ModulePath)
+ ptr->file_modulepath = strdup(xf86ModulePath);
+ if (defaultFontPath)
+ ptr->file_fontpath = strdup(defaultFontPath);
- if (xf86ModulePath)
- ptr->file_modulepath = strdup(xf86ModulePath);
- if (defaultFontPath)
- ptr->file_fontpath = strdup(defaultFontPath);
-
return ptr;
}
static XF86ConfMonitorPtr
-configureMonitorSection (int screennum)
+configureMonitorSection(int screennum)
{
- parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
+ parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec)
- XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
+ XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
ptr->mon_vendor = strdup("Monitor Vendor");
ptr->mon_modelname = strdup("Monitor Model");
@@ -430,29 +438,24 @@ configureMonitorSection (int screennum)
}
/* Initialize Configure Monitor from Detailed Timing Block */
-static void handle_detailed_input(struct detailed_monitor_section *det_mon,
- void *data)
+static void
+handle_detailed_input(struct detailed_monitor_section *det_mon, void *data)
{
XF86ConfMonitorPtr ptr = (XF86ConfMonitorPtr) data;
switch (det_mon->type) {
case DS_NAME:
ptr->mon_modelname = realloc(ptr->mon_modelname,
- strlen((char*)(det_mon->section.name)) +
+ strlen((char *) (det_mon->section.name)) +
1);
- strcpy(ptr->mon_modelname,
- (char*)(det_mon->section.name));
+ strcpy(ptr->mon_modelname, (char *) (det_mon->section.name));
break;
case DS_RANGES:
- ptr->mon_hsync[ptr->mon_n_hsync].lo =
- det_mon->section.ranges.min_h;
- ptr->mon_hsync[ptr->mon_n_hsync].hi =
- det_mon->section.ranges.max_h;
+ ptr->mon_hsync[ptr->mon_n_hsync].lo = det_mon->section.ranges.min_h;
+ ptr->mon_hsync[ptr->mon_n_hsync].hi = det_mon->section.ranges.max_h;
ptr->mon_n_vrefresh = 1;
- ptr->mon_vrefresh[ptr->mon_n_hsync].lo =
- det_mon->section.ranges.min_v;
- ptr->mon_vrefresh[ptr->mon_n_hsync].hi =
- det_mon->section.ranges.max_v;
+ ptr->mon_vrefresh[ptr->mon_n_hsync].lo = det_mon->section.ranges.min_v;
+ ptr->mon_vrefresh[ptr->mon_n_hsync].hi = det_mon->section.ranges.max_v;
ptr->mon_n_hsync++;
default:
break;
@@ -460,53 +463,56 @@ static void handle_detailed_input(struct detailed_monitor_section *det_mon,
}
static XF86ConfMonitorPtr
-configureDDCMonitorSection (int screennum)
+configureDDCMonitorSection(int screennum)
{
int len, mon_width, mon_height;
+
#define displaySizeMaxLen 80
char displaySize_string[displaySizeMaxLen];
int displaySizeLen;
- parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
+ parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec)
- XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
+ XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
/* features in centimetres, we want millimetres */
- mon_width = 10 * ConfiguredMonitor->features.hsize ;
- mon_height = 10 * ConfiguredMonitor->features.vsize ;
+ mon_width = 10 * ConfiguredMonitor->features.hsize;
+ mon_height = 10 * ConfiguredMonitor->features.vsize;
#ifdef CONFIGURE_DISPLAYSIZE
- ptr->mon_width = mon_width;
+ ptr->mon_width = mon_width;
ptr->mon_height = mon_height;
#else
if (mon_width && mon_height) {
- /* when values available add DisplaySize option AS A COMMENT */
-
- displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen,
- "\t#DisplaySize\t%5d %5d\t# mm\n",
- mon_width, mon_height);
-
- if (displaySizeLen>0 && displaySizeLen<displaySizeMaxLen) {
- if (ptr->mon_comment) {
- len = strlen(ptr->mon_comment);
- } else {
- len = 0;
- }
- if ((ptr->mon_comment =
- realloc(ptr->mon_comment, len + strlen(displaySize_string) + 1))) {
- strcpy(ptr->mon_comment + len, displaySize_string);
- }
- }
+ /* when values available add DisplaySize option AS A COMMENT */
+
+ displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen,
+ "\t#DisplaySize\t%5d %5d\t# mm\n",
+ mon_width, mon_height);
+
+ if (displaySizeLen > 0 && displaySizeLen < displaySizeMaxLen) {
+ if (ptr->mon_comment) {
+ len = strlen(ptr->mon_comment);
+ }
+ else {
+ len = 0;
+ }
+ if ((ptr->mon_comment =
+ realloc(ptr->mon_comment,
+ len + strlen(displaySize_string) + 1))) {
+ strcpy(ptr->mon_comment + len, displaySize_string);
+ }
+ }
}
-#endif /* def CONFIGURE_DISPLAYSIZE */
+#endif /* def CONFIGURE_DISPLAYSIZE */
- xf86ForEachDetailedBlock(ConfiguredMonitor, handle_detailed_input,
- ptr);
+ xf86ForEachDetailedBlock(ConfiguredMonitor, handle_detailed_input, ptr);
if (ConfiguredMonitor->features.dpms) {
- ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL);
+ ptr->mon_option_lst =
+ xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL);
}
return ptr;
@@ -515,7 +521,7 @@ configureDDCMonitorSection (int screennum)
void
DoConfigure(void)
{
- int i,j, screennum = -1;
+ int i, j, screennum = -1;
const char *home = NULL;
char filename[PATH_MAX];
const char *addslash = "";
@@ -526,13 +532,13 @@ DoConfigure(void)
vlist = xf86DriverlistFromCompile();
if (!vlist) {
- ErrorF("Missing output drivers. Configuration failed.\n");
- goto bail;
+ ErrorF("Missing output drivers. Configuration failed.\n");
+ goto bail;
}
ErrorF("List of video drivers:\n");
for (vl = vlist; *vl; vl++)
- ErrorF("\t%s\n", *vl);
+ ErrorF("\t%s\n", *vl);
/* Load all the drivers that were found. */
xf86LoadModules(vlist, NULL);
@@ -540,65 +546,71 @@ DoConfigure(void)
free(vlist);
for (i = 0; i < xf86NumDrivers; i++) {
- xorgHWFlags flags;
- if (!xf86DriverList[i]->driverFunc
- || !xf86DriverList[i]->driverFunc(NULL,
- GET_REQUIRED_HW_INTERFACES,
- &flags)
- || NEED_IO_ENABLED(flags)) {
- xorgHWAccess = TRUE;
- break;
- }
+ xorgHWFlags flags;
+
+ if (!xf86DriverList[i]->driverFunc
+ || !xf86DriverList[i]->driverFunc(NULL,
+ GET_REQUIRED_HW_INTERFACES,
+ &flags)
+ || NEED_IO_ENABLED(flags)) {
+ xorgHWAccess = TRUE;
+ break;
+ }
}
/* Enable full I/O access */
if (xorgHWAccess) {
- if(!xf86EnableIO())
- /* oops, we have failed */
- xorgHWAccess = FALSE;
+ if (!xf86EnableIO())
+ /* oops, we have failed */
+ xorgHWAccess = FALSE;
}
/* Create XF86Config file structure */
xf86config = calloc(1, sizeof(XF86ConfigRec));
/* Call all of the probe functions, reporting the results. */
- for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
- xorgHWFlags flags;
- Bool found_screen;
- DriverRec * const drv = xf86DriverList[CurrentDriver];
-
- if (!xorgHWAccess) {
- if (!drv->driverFunc
- || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
- || NEED_IO_ENABLED(flags))
- continue;
- }
-
- found_screen = xf86CallDriverProbe( drv, TRUE );
- if ( found_screen && drv->Identify ) {
- (*drv->Identify)(0);
- }
+ for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
+ xorgHWFlags flags;
+ Bool found_screen;
+ DriverRec *const drv = xf86DriverList[CurrentDriver];
+
+ if (!xorgHWAccess) {
+ if (!drv->driverFunc
+ || !drv->driverFunc(NULL, GET_REQUIRED_HW_INTERFACES, &flags)
+ || NEED_IO_ENABLED(flags))
+ continue;
+ }
+
+ found_screen = xf86CallDriverProbe(drv, TRUE);
+ if (found_screen && drv->Identify) {
+ (*drv->Identify) (0);
+ }
}
if (nDevToConfig <= 0) {
- ErrorF("No devices to configure. Configuration failed.\n");
- goto bail;
+ ErrorF("No devices to configure. Configuration failed.\n");
+ goto bail;
}
/* Add device, monitor and screen sections for detected devices */
- for (screennum = 0; screennum < nDevToConfig; screennum++) {
- XF86ConfDevicePtr DevicePtr;
- XF86ConfMonitorPtr MonitorPtr;
- XF86ConfScreenPtr ScreenPtr;
-
- DevicePtr = configureDeviceSection(screennum);
- xf86config->conf_device_lst = (XF86ConfDevicePtr)xf86addListItem(
- (glp)xf86config->conf_device_lst, (glp)DevicePtr);
- MonitorPtr = configureMonitorSection(screennum);
- xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem(
- (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr);
- ScreenPtr = configureScreenSection(screennum);
- xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem(
- (glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
+ for (screennum = 0; screennum < nDevToConfig; screennum++) {
+ XF86ConfDevicePtr DevicePtr;
+ XF86ConfMonitorPtr MonitorPtr;
+ XF86ConfScreenPtr ScreenPtr;
+
+ DevicePtr = configureDeviceSection(screennum);
+ xf86config->conf_device_lst = (XF86ConfDevicePtr) xf86addListItem((glp)
+ xf86config->
+ conf_device_lst,
+ (glp)
+ DevicePtr);
+ MonitorPtr = configureMonitorSection(screennum);
+ xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) MonitorPtr);
+ ScreenPtr = configureScreenSection(screennum);
+ xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp)
+ xf86config->
+ conf_screen_lst,
+ (glp)
+ ScreenPtr);
}
xf86config->conf_files = configureFilesSection();
@@ -613,91 +625,95 @@ DoConfigure(void)
home = getenv("HOME");
if ((home == NULL) || (home[0] == '\0')) {
- home = "/";
- } else {
- /* Determine if trailing slash is present or needed */
- int l = strlen(home);
+ home = "/";
+ }
+ else {
+ /* Determine if trailing slash is present or needed */
+ int l = strlen(home);
- if (home[l-1] != '/') {
- addslash = "/";
- }
+ if (home[l - 1] != '/') {
+ addslash = "/";
+ }
}
snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new",
- home, addslash);
+ home, addslash);
if (xf86writeConfigFile(filename, xf86config) == 0) {
- xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
- filename, strerror(errno));
- goto bail;
+ xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
+ filename, strerror(errno));
+ goto bail;
}
xf86DoConfigurePass1 = FALSE;
/* Try to get DDC information filled in */
xf86ConfigFile = filename;
if (xf86HandleConfigFile(FALSE) != CONFIG_OK) {
- goto bail;
+ goto bail;
}
xf86DoConfigurePass1 = FALSE;
-
- dev2screen = xnfcalloc(1,xf86NumDrivers*sizeof(int));
+
+ dev2screen = xnfcalloc(1, xf86NumDrivers * sizeof(int));
{
- Bool *driverProbed = xnfcalloc(1,xf86NumDrivers*sizeof(Bool));
- for (screennum = 0; screennum < nDevToConfig; screennum++) {
- int k,l,n,oldNumScreens;
-
- i = DevToConfig[screennum].iDriver;
-
- if (driverProbed[i]) continue;
- driverProbed[i] = TRUE;
-
- oldNumScreens = xf86NumScreens;
-
- xf86CallDriverProbe( xf86DriverList[i], FALSE );
-
- /* reorder */
- k = screennum > 0 ? screennum : 1;
- for (l = oldNumScreens; l < xf86NumScreens; l++) {
- /* is screen primary? */
- Bool primary = FALSE;
- for (n = 0; n<xf86Screens[l]->numEntities; n++) {
- if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) {
- dev2screen[0] = l;
- primary = TRUE;
- break;
- }
- }
- if (primary) continue;
- /* not primary: assign it to next device of same driver */
- /*
- * NOTE: we assume that devices in DevToConfig
- * and xf86Screens[] have the same order except
- * for the primary device which always comes first.
- */
- for (; k < nDevToConfig; k++) {
- if (DevToConfig[k].iDriver == i) {
- dev2screen[k++] = l;
- break;
- }
- }
- }
- }
- free(driverProbed);
- }
-
+ Bool *driverProbed = xnfcalloc(1, xf86NumDrivers * sizeof(Bool));
+
+ for (screennum = 0; screennum < nDevToConfig; screennum++) {
+ int k, l, n, oldNumScreens;
+
+ i = DevToConfig[screennum].iDriver;
+
+ if (driverProbed[i])
+ continue;
+ driverProbed[i] = TRUE;
+
+ oldNumScreens = xf86NumScreens;
+
+ xf86CallDriverProbe(xf86DriverList[i], FALSE);
+
+ /* reorder */
+ k = screennum > 0 ? screennum : 1;
+ for (l = oldNumScreens; l < xf86NumScreens; l++) {
+ /* is screen primary? */
+ Bool primary = FALSE;
+
+ for (n = 0; n < xf86Screens[l]->numEntities; n++) {
+ if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) {
+ dev2screen[0] = l;
+ primary = TRUE;
+ break;
+ }
+ }
+ if (primary)
+ continue;
+ /* not primary: assign it to next device of same driver */
+ /*
+ * NOTE: we assume that devices in DevToConfig
+ * and xf86Screens[] have the same order except
+ * for the primary device which always comes first.
+ */
+ for (; k < nDevToConfig; k++) {
+ if (DevToConfig[k].iDriver == i) {
+ dev2screen[k++] = l;
+ break;
+ }
+ }
+ }
+ }
+ free(driverProbed);
+ }
if (nDevToConfig != xf86NumScreens) {
- ErrorF("Number of created screens does not match number of detected"
- " devices.\n Configuration failed.\n");
- goto bail;
+ ErrorF("Number of created screens does not match number of detected"
+ " devices.\n Configuration failed.\n");
+ goto bail;
}
xf86PostProbe();
for (j = 0; j < xf86NumScreens; j++) {
- xf86Screens[j]->scrnIndex = j;
+ xf86Screens[j]->scrnIndex = j;
}
xf86freeMonitorList(xf86config->conf_monitor_lst);
@@ -705,53 +721,57 @@ DoConfigure(void)
xf86freeScreenList(xf86config->conf_screen_lst);
xf86config->conf_screen_lst = NULL;
for (j = 0; j < xf86NumScreens; j++) {
- XF86ConfMonitorPtr MonitorPtr;
- XF86ConfScreenPtr ScreenPtr;
+ XF86ConfMonitorPtr MonitorPtr;
+ XF86ConfScreenPtr ScreenPtr;
- ConfiguredMonitor = NULL;
+ ConfiguredMonitor = NULL;
- if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]],
- PROBE_DETECT) &&
- ConfiguredMonitor) {
- MonitorPtr = configureDDCMonitorSection(j);
- } else {
- MonitorPtr = configureMonitorSection(j);
- }
- ScreenPtr = configureScreenSection(j);
- xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem(
- (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr);
- xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem(
- (glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
+ if ((*xf86Screens[dev2screen[j]]->PreInit) (xf86Screens[dev2screen[j]],
+ PROBE_DETECT) &&
+ ConfiguredMonitor) {
+ MonitorPtr = configureDDCMonitorSection(j);
+ }
+ else {
+ MonitorPtr = configureMonitorSection(j);
+ }
+ ScreenPtr = configureScreenSection(j);
+
+ xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) MonitorPtr);
+ xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp)
+ xf86config->
+ conf_screen_lst,
+ (glp)
+ ScreenPtr);
}
if (xf86writeConfigFile(filename, xf86config) == 0) {
- xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
- filename, strerror(errno));
- goto bail;
+ xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
+ filename, strerror(errno));
+ goto bail;
}
ErrorF("\n");
if (!foundMouse) {
- ErrorF("\n"__XSERVERNAME__" is not able to detect your mouse.\n"
- "Edit the file and correct the Device.\n");
- } else {
- ErrorF("\n"__XSERVERNAME__" detected your mouse at device %s.\n"
- "Please check your config if the mouse is still not\n"
- "operational, as by default "__XSERVERNAME__
- " tries to autodetect\n"
- "the protocol.\n",DFLT_MOUSE_DEV);
+ ErrorF("\n" __XSERVERNAME__ " is not able to detect your mouse.\n"
+ "Edit the file and correct the Device.\n");
+ }
+ else {
+ ErrorF("\n" __XSERVERNAME__ " detected your mouse at device %s.\n"
+ "Please check your config if the mouse is still not\n"
+ "operational, as by default " __XSERVERNAME__
+ " tries to autodetect\n" "the protocol.\n", DFLT_MOUSE_DEV);
}
if (xf86NumScreens > 1) {
- ErrorF("\n"__XSERVERNAME__
- " has configured a multihead system, please check your config.\n");
+ ErrorF("\n" __XSERVERNAME__
+ " has configured a multihead system, please check your config.\n");
}
- ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE ,filename);
+ ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE, filename);
ErrorF("To test the server, run 'X -config %s'\n\n", filename);
-bail:
+ bail:
OsCleanup(TRUE);
AbortDDX(EXIT_ERR_CONFIGURE);
fflush(stderr);
@@ -765,47 +785,48 @@ bail:
* Author: Marcus Schaefer, ms@suse.de
*/
-void DoShowOptions (void) {
- int i = 0;
- char **vlist = 0;
- char *pSymbol = 0;
- XF86ModuleData *initData = 0;
- if (! (vlist = xf86DriverlistFromCompile())) {
- ErrorF("Missing output drivers\n");
- goto bail;
- }
- xf86LoadModules (vlist,0);
- free(vlist);
- for (i = 0; i < xf86NumDrivers; i++) {
- if (xf86DriverList[i]->AvailableOptions) {
- const OptionInfoRec *pOption =
- (*xf86DriverList[i]->AvailableOptions)(0,0);
- if (! pOption) {
- ErrorF ("(EE) Couldn't read option table for %s driver\n",
- xf86DriverList[i]->driverName
- );
- continue;
- }
- XNFasprintf(&pSymbol, "%sModuleData",
- xf86DriverList[i]->driverName);
- initData = LoaderSymbol (pSymbol);
- if (initData) {
- XF86ModuleVersionInfo *vers = initData->vers;
- const OptionInfoRec *p;
- ErrorF ("Driver[%d]:%s[%s] {\n",
- i,xf86DriverList[i]->driverName,vers->vendor
- );
- for (p = pOption; p->name != NULL; p++) {
- ErrorF ("\t%s:%s\n", p->name,
- optionTypeToString(p->type));
- }
- ErrorF ("}\n");
- }
- }
- }
- bail:
- OsCleanup (TRUE);
- AbortDDX (EXIT_ERR_DRIVERS);
- fflush (stderr);
- exit (0);
+void
+DoShowOptions(void)
+{
+ int i = 0;
+ char **vlist = 0;
+ char *pSymbol = 0;
+ XF86ModuleData *initData = 0;
+
+ if (!(vlist = xf86DriverlistFromCompile())) {
+ ErrorF("Missing output drivers\n");
+ goto bail;
+ }
+ xf86LoadModules(vlist, 0);
+ free(vlist);
+ for (i = 0; i < xf86NumDrivers; i++) {
+ if (xf86DriverList[i]->AvailableOptions) {
+ const OptionInfoRec *pOption =
+ (*xf86DriverList[i]->AvailableOptions) (0, 0);
+ if (!pOption) {
+ ErrorF("(EE) Couldn't read option table for %s driver\n",
+ xf86DriverList[i]->driverName);
+ continue;
+ }
+ XNFasprintf(&pSymbol, "%sModuleData",
+ xf86DriverList[i]->driverName);
+ initData = LoaderSymbol(pSymbol);
+ if (initData) {
+ XF86ModuleVersionInfo *vers = initData->vers;
+ const OptionInfoRec *p;
+
+ ErrorF("Driver[%d]:%s[%s] {\n",
+ i, xf86DriverList[i]->driverName, vers->vendor);
+ for (p = pOption; p->name != NULL; p++) {
+ ErrorF("\t%s:%s\n", p->name, optionTypeToString(p->type));
+ }
+ ErrorF("}\n");
+ }
+ }
+ }
+ bail:
+ OsCleanup(TRUE);
+ AbortDDX(EXIT_ERR_DRIVERS);
+ fflush(stderr);
+ exit(0);
}
diff --git a/xorg-server/hw/xfree86/common/xf86Cursor.c b/xorg-server/hw/xfree86/common/xf86Cursor.c
index 6f5d726f0..3716434f0 100644
--- a/xorg-server/hw/xfree86/common/xf86Cursor.c
+++ b/xorg-server/hw/xfree86/common/xf86Cursor.c
@@ -51,15 +51,15 @@
#endif
typedef struct _xf86EdgeRec {
- short screen;
- short start;
- short end;
- DDXPointRec offset;
- struct _xf86EdgeRec *next;
+ short screen;
+ short start;
+ short end;
+ DDXPointRec offset;
+ struct _xf86EdgeRec *next;
} xf86EdgeRec, *xf86EdgePtr;
typedef struct {
- xf86EdgePtr left, right, up, down;
+ xf86EdgePtr left, right, up, down;
} xf86ScreenLayoutRec, *xf86ScreenLayoutPtr;
static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y);
@@ -69,12 +69,12 @@ static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
static void xf86PointerMoved(int scrnIndex, int x, int y);
static miPointerScreenFuncRec xf86PointerScreenFuncs = {
- xf86CursorOffScreen,
- xf86CrossScreen,
- xf86WarpCursor,
- /* let miPointerInitialize take care of these */
- NULL,
- NULL
+ xf86CursorOffScreen,
+ xf86CrossScreen,
+ xf86WarpCursor,
+ /* let miPointerInitialize take care of these */
+ NULL,
+ NULL
};
static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
@@ -92,41 +92,39 @@ void
xf86InitViewport(ScrnInfoPtr pScr)
{
- pScr->PointerMoved = xf86PointerMoved;
-
- /*
- * Compute the initial Viewport if necessary
- */
- if (pScr->display) {
- if (pScr->display->frameX0 < 0) {
- pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2;
- pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2;
- } else {
- pScr->frameX0 = pScr->display->frameX0;
- pScr->frameY0 = pScr->display->frameY0;
+ pScr->PointerMoved = xf86PointerMoved;
+
+ /*
+ * Compute the initial Viewport if necessary
+ */
+ if (pScr->display) {
+ if (pScr->display->frameX0 < 0) {
+ pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2;
+ pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2;
+ }
+ else {
+ pScr->frameX0 = pScr->display->frameX0;
+ pScr->frameY0 = pScr->display->frameY0;
+ }
}
- }
-
- pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
- pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
-
- /*
- * Now adjust the initial Viewport, so it lies within the virtual area
- */
- if (pScr->frameX1 >= pScr->virtualX)
- {
- pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay;
- pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
+
+ pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
+ pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
+
+ /*
+ * Now adjust the initial Viewport, so it lies within the virtual area
+ */
+ if (pScr->frameX1 >= pScr->virtualX) {
+ pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay;
+ pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
}
- if (pScr->frameY1 >= pScr->virtualY)
- {
- pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay;
- pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
+ if (pScr->frameY1 >= pScr->virtualY) {
+ pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay;
+ pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
}
}
-
/*
* xf86SetViewport --
* Scroll the visual part of the screen so the pointer is visible.
@@ -135,48 +133,47 @@ xf86InitViewport(ScrnInfoPtr pScr)
void
xf86SetViewport(ScreenPtr pScreen, int x, int y)
{
- ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
- (*pScr->PointerMoved)(pScreen->myNum, x, y);
+ (*pScr->PointerMoved) (pScreen->myNum, x, y);
}
-
-static void
+static void
xf86PointerMoved(int scrnIndex, int x, int y)
{
- Bool frameChanged = FALSE;
- ScrnInfoPtr pScr = xf86Screens[scrnIndex];
-
- /*
- * check wether (x,y) belongs to the visual part of the screen
- * if not, change the base of the displayed frame accoring
- */
- if ( pScr->frameX0 > x) {
- pScr->frameX0 = x;
- pScr->frameX1 = x + pScr->currentMode->HDisplay - 1;
- frameChanged = TRUE ;
- }
-
- if ( pScr->frameX1 < x) {
- pScr->frameX1 = x + 1;
- pScr->frameX0 = x - pScr->currentMode->HDisplay + 1;
- frameChanged = TRUE ;
- }
-
- if ( pScr->frameY0 > y) {
- pScr->frameY0 = y;
- pScr->frameY1 = y + pScr->currentMode->VDisplay - 1;
- frameChanged = TRUE;
- }
-
- if ( pScr->frameY1 < y) {
- pScr->frameY1 = y;
- pScr->frameY0 = y - pScr->currentMode->VDisplay + 1;
- frameChanged = TRUE;
- }
-
- if (frameChanged && pScr->AdjustFrame != NULL)
- pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
+ Bool frameChanged = FALSE;
+ ScrnInfoPtr pScr = xf86Screens[scrnIndex];
+
+ /*
+ * check wether (x,y) belongs to the visual part of the screen
+ * if not, change the base of the displayed frame accoring
+ */
+ if (pScr->frameX0 > x) {
+ pScr->frameX0 = x;
+ pScr->frameX1 = x + pScr->currentMode->HDisplay - 1;
+ frameChanged = TRUE;
+ }
+
+ if (pScr->frameX1 < x) {
+ pScr->frameX1 = x + 1;
+ pScr->frameX0 = x - pScr->currentMode->HDisplay + 1;
+ frameChanged = TRUE;
+ }
+
+ if (pScr->frameY0 > y) {
+ pScr->frameY0 = y;
+ pScr->frameY1 = y + pScr->currentMode->VDisplay - 1;
+ frameChanged = TRUE;
+ }
+
+ if (pScr->frameY1 < y) {
+ pScr->frameY1 = y;
+ pScr->frameY0 = y - pScr->currentMode->VDisplay + 1;
+ frameChanged = TRUE;
+ }
+
+ if (frameChanged && pScr->AdjustFrame != NULL)
+ pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
}
/*
@@ -187,7 +184,7 @@ xf86PointerMoved(int scrnIndex, int x, int y)
void
xf86LockZoom(ScreenPtr pScreen, Bool lock)
{
- XF86SCRNINFO(pScreen)->zoomLocked = lock;
+ XF86SCRNINFO(pScreen)->zoomLocked = lock;
}
/*
@@ -199,121 +196,118 @@ xf86LockZoom(ScreenPtr pScreen, Bool lock)
Bool
xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
{
- ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
- ScreenPtr pCursorScreen;
- Bool Switched;
- int px, py, was_blocked;
- DeviceIntPtr dev, it;
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ ScreenPtr pCursorScreen;
+ Bool Switched;
+ int px, py, was_blocked;
+ DeviceIntPtr dev, it;
- if (!pScr->vtSema || !mode || !pScr->SwitchMode)
- return FALSE;
+ if (!pScr->vtSema || !mode || !pScr->SwitchMode)
+ return FALSE;
#ifdef XFreeXDGA
- if (DGAActive(pScr->scrnIndex))
- return FALSE;
+ if (DGAActive(pScr->scrnIndex))
+ return FALSE;
#endif
- if (mode == pScr->currentMode)
- return TRUE;
-
- if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY)
- return FALSE;
-
- /* Let's take an educated guess for which pointer to take here. And about as
- educated as it gets is to take the first pointer we find.
- */
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (IsPointerDevice(dev) && dev->spriteInfo->spriteOwner)
- break;
- }
-
- pCursorScreen = miPointerGetScreen(dev);
- if (pScreen == pCursorScreen)
- miPointerGetPosition(dev, &px, &py);
+ if (mode == pScr->currentMode)
+ return TRUE;
- was_blocked = xf86BlockSIGIO();
- Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0);
- if (Switched) {
- pScr->currentMode = mode;
+ if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY)
+ return FALSE;
- /*
- * Adjust frame for new display size.
- * Frame is centered around cursor position if cursor is on same screen.
+ /* Let's take an educated guess for which pointer to take here. And about as
+ educated as it gets is to take the first pointer we find.
*/
- if (pScreen == pCursorScreen)
- pScr->frameX0 = px - (mode->HDisplay / 2) + 1;
- else
- pScr->frameX0 = (pScr->frameX0 + pScr->frameX1 + 1 - mode->HDisplay) / 2;
-
- if (pScr->frameX0 < 0)
- pScr->frameX0 = 0;
-
- pScr->frameX1 = pScr->frameX0 + mode->HDisplay - 1;
- if (pScr->frameX1 >= pScr->virtualX) {
- pScr->frameX0 = pScr->virtualX - mode->HDisplay;
- pScr->frameX1 = pScr->virtualX - 1;
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (IsPointerDevice(dev) && dev->spriteInfo->spriteOwner)
+ break;
}
+ pCursorScreen = miPointerGetScreen(dev);
if (pScreen == pCursorScreen)
- pScr->frameY0 = py - (mode->VDisplay / 2) + 1;
- else
- pScr->frameY0 = (pScr->frameY0 + pScr->frameY1 + 1 - mode->VDisplay) / 2;
+ miPointerGetPosition(dev, &px, &py);
+
+ was_blocked = xf86BlockSIGIO();
+ Switched = (*pScr->SwitchMode) (pScr->scrnIndex, mode, 0);
+ if (Switched) {
+ pScr->currentMode = mode;
+
+ /*
+ * Adjust frame for new display size.
+ * Frame is centered around cursor position if cursor is on same screen.
+ */
+ if (pScreen == pCursorScreen)
+ pScr->frameX0 = px - (mode->HDisplay / 2) + 1;
+ else
+ pScr->frameX0 =
+ (pScr->frameX0 + pScr->frameX1 + 1 - mode->HDisplay) / 2;
+
+ if (pScr->frameX0 < 0)
+ pScr->frameX0 = 0;
+
+ pScr->frameX1 = pScr->frameX0 + mode->HDisplay - 1;
+ if (pScr->frameX1 >= pScr->virtualX) {
+ pScr->frameX0 = pScr->virtualX - mode->HDisplay;
+ pScr->frameX1 = pScr->virtualX - 1;
+ }
+
+ if (pScreen == pCursorScreen)
+ pScr->frameY0 = py - (mode->VDisplay / 2) + 1;
+ else
+ pScr->frameY0 =
+ (pScr->frameY0 + pScr->frameY1 + 1 - mode->VDisplay) / 2;
+
+ if (pScr->frameY0 < 0)
+ pScr->frameY0 = 0;
+
+ pScr->frameY1 = pScr->frameY0 + mode->VDisplay - 1;
+ if (pScr->frameY1 >= pScr->virtualY) {
+ pScr->frameY0 = pScr->virtualY - mode->VDisplay;
+ pScr->frameY1 = pScr->virtualY - 1;
+ }
+ }
+ xf86UnblockSIGIO(was_blocked);
- if (pScr->frameY0 < 0)
- pScr->frameY0 = 0;
+ if (pScr->AdjustFrame)
+ (*pScr->AdjustFrame) (pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
- pScr->frameY1 = pScr->frameY0 + mode->VDisplay - 1;
- if (pScr->frameY1 >= pScr->virtualY) {
- pScr->frameY0 = pScr->virtualY - mode->VDisplay;
- pScr->frameY1 = pScr->virtualY - 1;
+ /* The original code centered the frame around the cursor if possible.
+ * Since this is hard to achieve with multiple cursors, we do the following:
+ * - center around the first pointer
+ * - move all other pointers to the nearest edge on the screen (or leave
+ * them unmodified if they are within the boundaries).
+ */
+ if (pScreen == pCursorScreen) {
+ xf86WarpCursor(dev, pScreen, px, py);
+ }
+
+ for (it = inputInfo.devices; it; it = it->next) {
+ if (it == dev)
+ continue;
+
+ if (IsPointerDevice(it) && it->spriteInfo->spriteOwner) {
+ pCursorScreen = miPointerGetScreen(it);
+ if (pScreen == pCursorScreen) {
+ miPointerGetPosition(it, &px, &py);
+ if (px < pScr->frameX0)
+ px = pScr->frameX0;
+ else if (px > pScr->frameX1)
+ px = pScr->frameX1;
+
+ if (py < pScr->frameY0)
+ py = pScr->frameY0;
+ else if (py > pScr->frameY1)
+ py = pScr->frameY1;
+
+ xf86WarpCursor(it, pScreen, px, py);
+ }
+ }
}
- }
- xf86UnblockSIGIO(was_blocked);
-
- if (pScr->AdjustFrame)
- (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
-
- /* The original code centered the frame around the cursor if possible.
- * Since this is hard to achieve with multiple cursors, we do the following:
- * - center around the first pointer
- * - move all other pointers to the nearest edge on the screen (or leave
- * them unmodified if they are within the boundaries).
- */
- if (pScreen == pCursorScreen)
- {
- xf86WarpCursor(dev, pScreen, px, py);
- }
-
- for (it = inputInfo.devices; it; it = it->next)
- {
- if (it == dev)
- continue;
-
- if (IsPointerDevice(it) && it->spriteInfo->spriteOwner)
- {
- pCursorScreen = miPointerGetScreen(it);
- if (pScreen == pCursorScreen)
- {
- miPointerGetPosition(it, &px, &py);
- if (px < pScr->frameX0)
- px = pScr->frameX0;
- else if (px > pScr->frameX1)
- px = pScr->frameX1;
-
- if(py < pScr->frameY0)
- py = pScr->frameY0;
- else if(py > pScr->frameY1)
- py = pScr->frameY1;
-
- xf86WarpCursor(it, pScreen, px, py);
- }
- }
- }
-
- return Switched;
+
+ return Switched;
}
-
+
/*
* xf86ZoomViewport --
* Reinitialize the visual part of the screen for another mode.
@@ -322,31 +316,30 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
void
xf86ZoomViewport(ScreenPtr pScreen, int zoom)
{
- ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
- DisplayModePtr mode;
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ DisplayModePtr mode;
- if (pScr->zoomLocked || !(mode = pScr->currentMode))
- return;
+ if (pScr->zoomLocked || !(mode = pScr->currentMode))
+ return;
- do {
- if (zoom > 0)
- mode = mode->next;
- else
- mode = mode->prev;
- } while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF));
+ do {
+ if (zoom > 0)
+ mode = mode->next;
+ else
+ mode = mode->prev;
+ } while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF));
- (void)xf86SwitchMode(pScreen, mode);
+ (void) xf86SwitchMode(pScreen, mode);
}
-
static xf86EdgePtr
FindEdge(xf86EdgePtr edge, int val)
{
- while(edge && (edge->end <= val))
- edge = edge->next;
+ while (edge && (edge->end <= val))
+ edge = edge->next;
- if(edge && (edge->start <= val))
- return edge;
+ if (edge && (edge->start <= val))
+ return edge;
return NULL;
}
@@ -362,89 +355,98 @@ xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
xf86EdgePtr edge;
int tmp;
- if(screenInfo.numScreens == 1)
- return FALSE;
+ if (screenInfo.numScreens == 1)
+ return FALSE;
- if(*x < 0) {
+ if (*x < 0) {
tmp = *y;
- if(tmp < 0) tmp = 0;
- if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1;
-
- if((edge = xf86ScreenLayout[(*pScreen)->myNum].left))
- edge = FindEdge(edge, tmp);
-
- if(!edge) *x = 0;
- else {
- *x += edge->offset.x;
- *y += edge->offset.y;
- *pScreen = xf86Screens[edge->screen]->pScreen;
- }
+ if (tmp < 0)
+ tmp = 0;
+ if (tmp >= (*pScreen)->height)
+ tmp = (*pScreen)->height - 1;
+
+ if ((edge = xf86ScreenLayout[(*pScreen)->myNum].left))
+ edge = FindEdge(edge, tmp);
+
+ if (!edge)
+ *x = 0;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ *pScreen = xf86Screens[edge->screen]->pScreen;
+ }
}
- if(*x >= (*pScreen)->width) {
+ if (*x >= (*pScreen)->width) {
tmp = *y;
- if(tmp < 0) tmp = 0;
- if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1;
-
- if((edge = xf86ScreenLayout[(*pScreen)->myNum].right))
- edge = FindEdge(edge, tmp);
-
- if(!edge) *x = (*pScreen)->width - 1;
- else {
- *x += edge->offset.x;
- *y += edge->offset.y;
- *pScreen = xf86Screens[edge->screen]->pScreen;
- }
+ if (tmp < 0)
+ tmp = 0;
+ if (tmp >= (*pScreen)->height)
+ tmp = (*pScreen)->height - 1;
+
+ if ((edge = xf86ScreenLayout[(*pScreen)->myNum].right))
+ edge = FindEdge(edge, tmp);
+
+ if (!edge)
+ *x = (*pScreen)->width - 1;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ *pScreen = xf86Screens[edge->screen]->pScreen;
+ }
}
- if(*y < 0) {
+ if (*y < 0) {
tmp = *x;
- if(tmp < 0) tmp = 0;
- if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1;
-
- if((edge = xf86ScreenLayout[(*pScreen)->myNum].up))
- edge = FindEdge(edge, tmp);
-
- if(!edge) *y = 0;
- else {
- *x += edge->offset.x;
- *y += edge->offset.y;
- *pScreen = xf86Screens[edge->screen]->pScreen;
- }
+ if (tmp < 0)
+ tmp = 0;
+ if (tmp >= (*pScreen)->width)
+ tmp = (*pScreen)->width - 1;
+
+ if ((edge = xf86ScreenLayout[(*pScreen)->myNum].up))
+ edge = FindEdge(edge, tmp);
+
+ if (!edge)
+ *y = 0;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ *pScreen = xf86Screens[edge->screen]->pScreen;
+ }
}
- if(*y >= (*pScreen)->height) {
+ if (*y >= (*pScreen)->height) {
tmp = *x;
- if(tmp < 0) tmp = 0;
- if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1;
-
- if((edge = xf86ScreenLayout[(*pScreen)->myNum].down))
- edge = FindEdge(edge, tmp);
-
- if(!edge) *y = (*pScreen)->height - 1;
- else {
- *x += edge->offset.x;
- *y += edge->offset.y;
- (*pScreen) = xf86Screens[edge->screen]->pScreen;
- }
+ if (tmp < 0)
+ tmp = 0;
+ if (tmp >= (*pScreen)->width)
+ tmp = (*pScreen)->width - 1;
+
+ if ((edge = xf86ScreenLayout[(*pScreen)->myNum].down))
+ edge = FindEdge(edge, tmp);
+
+ if (!edge)
+ *y = (*pScreen)->height - 1;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ (*pScreen) = xf86Screens[edge->screen]->pScreen;
+ }
}
-
#if 0
/* This presents problems for overlapping screens when
- HardEdges is used. Have to think about the logic more */
- if((*x < 0) || (*x >= (*pScreen)->width) ||
- (*y < 0) || (*y >= (*pScreen)->height)) {
- /* We may have crossed more than one screen */
- xf86CursorOffScreen(pScreen, x, y);
+ HardEdges is used. Have to think about the logic more */
+ if ((*x < 0) || (*x >= (*pScreen)->width) ||
+ (*y < 0) || (*y >= (*pScreen)->height)) {
+ /* We may have crossed more than one screen */
+ xf86CursorOffScreen(pScreen, x, y);
}
#endif
return TRUE;
}
-
-
/*
* xf86CrossScreen --
* Switch to another screen
@@ -454,11 +456,10 @@ xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
*/
static void
-xf86CrossScreen (ScreenPtr pScreen, Bool entering)
+xf86CrossScreen(ScreenPtr pScreen, Bool entering)
{
}
-
/*
* xf86WarpCursor --
* Warp possible to another screen
@@ -466,88 +467,88 @@ xf86CrossScreen (ScreenPtr pScreen, Bool entering)
/* ARGSUSED */
static void
-xf86WarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
- int sigstate;
- sigstate = xf86BlockSIGIO ();
+ int sigstate;
+
+ sigstate = xf86BlockSIGIO();
miPointerWarpCursor(pDev, pScreen, x, y);
xf86Info.currentScreen = pScreen;
- xf86UnblockSIGIO (sigstate);
+ xf86UnblockSIGIO(sigstate);
}
-
void *
xf86GetPointerScreenFuncs(void)
{
- return (void *)&xf86PointerScreenFuncs;
+ return (void *) &xf86PointerScreenFuncs;
}
-
static xf86EdgePtr
-AddEdge(
- xf86EdgePtr edge,
- short min,
- short max,
- short dx,
- short dy,
- short screen
-){
- xf86EdgePtr pEdge = edge, pPrev = NULL, pNew;
-
- while(1) {
- while(pEdge && (min >= pEdge->end)) {
- pPrev = pEdge;
- pEdge = pEdge->next;
- }
-
- if(!pEdge) {
- if(!(pNew = malloc(sizeof(xf86EdgeRec))))
- break;
-
- pNew->screen = screen;
- pNew->start = min;
- pNew->end = max;
- pNew->offset.x = dx;
- pNew->offset.y = dy;
- pNew->next = NULL;
-
- if(pPrev)
- pPrev->next = pNew;
- else
- edge = pNew;
-
- break;
- } else if (min < pEdge->start) {
- if(!(pNew = malloc(sizeof(xf86EdgeRec))))
- break;
-
- pNew->screen = screen;
- pNew->start = min;
- pNew->offset.x = dx;
- pNew->offset.y = dy;
- pNew->next = pEdge;
-
- if(pPrev) pPrev->next = pNew;
- else edge = pNew;
-
- if(max <= pEdge->start) {
- pNew->end = max;
- break;
- } else {
- pNew->end = pEdge->start;
- min = pEdge->end;
- }
- } else
- min = pEdge->end;
-
- pPrev = pEdge;
- pEdge = pEdge->next;
-
- if(max <= min) break;
- }
-
- return edge;
+AddEdge(xf86EdgePtr edge,
+ short min, short max, short dx, short dy, short screen)
+{
+ xf86EdgePtr pEdge = edge, pPrev = NULL, pNew;
+
+ while (1) {
+ while (pEdge && (min >= pEdge->end)) {
+ pPrev = pEdge;
+ pEdge = pEdge->next;
+ }
+
+ if (!pEdge) {
+ if (!(pNew = malloc(sizeof(xf86EdgeRec))))
+ break;
+
+ pNew->screen = screen;
+ pNew->start = min;
+ pNew->end = max;
+ pNew->offset.x = dx;
+ pNew->offset.y = dy;
+ pNew->next = NULL;
+
+ if (pPrev)
+ pPrev->next = pNew;
+ else
+ edge = pNew;
+
+ break;
+ }
+ else if (min < pEdge->start) {
+ if (!(pNew = malloc(sizeof(xf86EdgeRec))))
+ break;
+
+ pNew->screen = screen;
+ pNew->start = min;
+ pNew->offset.x = dx;
+ pNew->offset.y = dy;
+ pNew->next = pEdge;
+
+ if (pPrev)
+ pPrev->next = pNew;
+ else
+ edge = pNew;
+
+ if (max <= pEdge->start) {
+ pNew->end = max;
+ break;
+ }
+ else {
+ pNew->end = pEdge->start;
+ min = pEdge->end;
+ }
+ }
+ else
+ min = pEdge->end;
+
+ pPrev = pEdge;
+ pEdge = pEdge->next;
+
+ if (max <= min)
+ break;
+ }
+
+ return edge;
}
static void
@@ -556,19 +557,20 @@ FillOutEdge(xf86EdgePtr pEdge, int limit)
xf86EdgePtr pNext;
int diff;
- if(pEdge->start > 0) pEdge->start = 0;
+ if (pEdge->start > 0)
+ pEdge->start = 0;
- while((pNext = pEdge->next)) {
- diff = pNext->start - pEdge->end;
- if(diff > 0) {
- pEdge->end += diff >> 1;
- pNext->start -= diff - (diff >> 1);
- }
- pEdge = pNext;
+ while ((pNext = pEdge->next)) {
+ diff = pNext->start - pEdge->end;
+ if (diff > 0) {
+ pEdge->end += diff >> 1;
+ pNext->start -= diff - (diff >> 1);
+ }
+ pEdge = pNext;
}
- if(pEdge->end < limit)
- pEdge->end = limit;
+ if (pEdge->end < limit)
+ pEdge->end = limit;
}
/*
@@ -591,252 +593,269 @@ xf86InitOrigins(void)
HardEdges = FALSE;
memset(xf86ScreenLayout, 0, MAXSCREENS * sizeof(xf86ScreenLayoutRec));
-
+
screensLeft = prevScreensLeft = (1 << xf86NumScreens) - 1;
- while(1) {
- for(mask = screensLeft, i = 0; mask; mask >>= 1, i++) {
- if(!(mask & 1L)) continue;
-
- screen = &xf86ConfigLayout.screens[i];
-
- if (screen->refscreen != NULL &&
- screen->refscreen->screennum >= xf86NumScreens) {
- screensLeft &= ~(1 << i);
- xf86Msg(X_WARNING, "Not including screen \"%s\" in origins calculation.\n",
- screen->screen->id);
- continue;
- }
-
- pScreen = xf86Screens[i]->pScreen;
- switch(screen->where) {
- case PosObsolete:
- OldStyleConfig = TRUE;
- pLayout = &xf86ScreenLayout[i];
- /* force edge lists */
- if(screen->left) {
- ref = screen->left->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- pLayout->left = AddEdge(pLayout->left,
- 0, pScreen->height,
- xf86Screens[ref]->pScreen->width, 0, ref);
- }
- if(screen->right) {
- ref = screen->right->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- pLayout->right = AddEdge(pLayout->right,
- 0, pScreen->height, -pScreen->width, 0, ref);
- }
- if(screen->top) {
- ref = screen->top->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- pLayout->up = AddEdge(pLayout->up,
- 0, pScreen->width,
- 0, xf86Screens[ref]->pScreen->height, ref);
- }
- if(screen->bottom) {
- ref = screen->bottom->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- pLayout->down = AddEdge(pLayout->down,
- 0, pScreen->width, 0, -pScreen->height, ref);
- }
- /* we could also try to place it based on those
- relative locations if we wanted to */
- screen->x = screen->y = 0;
- /* FALLTHROUGH */
- case PosAbsolute:
- pScreen->x = screen->x;
- pScreen->y = screen->y;
- screensLeft &= ~(1 << i);
- break;
- case PosRelative:
- ref = screen->refscreen->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- if(screensLeft & (1 << ref)) break;
- refScreen = xf86Screens[ref]->pScreen;
- pScreen->x = refScreen->x + screen->x;
- pScreen->y = refScreen->y + screen->y;
- screensLeft &= ~(1 << i);
- break;
- case PosRightOf:
- ref = screen->refscreen->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- if(screensLeft & (1 << ref)) break;
- refScreen = xf86Screens[ref]->pScreen;
- pScreen->x = refScreen->x + refScreen->width;
- pScreen->y = refScreen->y;
- screensLeft &= ~(1 << i);
- break;
- case PosLeftOf:
- ref = screen->refscreen->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- if(screensLeft & (1 << ref)) break;
- refScreen = xf86Screens[ref]->pScreen;
- pScreen->x = refScreen->x - pScreen->width;
- pScreen->y = refScreen->y;
- screensLeft &= ~(1 << i);
- break;
- case PosBelow:
- ref = screen->refscreen->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- if(screensLeft & (1 << ref)) break;
- refScreen = xf86Screens[ref]->pScreen;
- pScreen->x = refScreen->x;
- pScreen->y = refScreen->y + refScreen->height;
- screensLeft &= ~(1 << i);
- break;
- case PosAbove:
- ref = screen->refscreen->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- if(screensLeft & (1 << ref)) break;
- refScreen = xf86Screens[ref]->pScreen;
- pScreen->x = refScreen->x;
- pScreen->y = refScreen->y - pScreen->height;
- screensLeft &= ~(1 << i);
- break;
- default:
- ErrorF("Illegal placement keyword in Layout!\n");
- break;
- }
-
- }
-
- if(!screensLeft) break;
-
- if(screensLeft == prevScreensLeft) {
- /* All the remaining screens are referencing each other.
- Assign a value to one of them and go through again */
- i = 0;
- while(!((1 << i) & screensLeft)){ i++; }
-
- ref = xf86ConfigLayout.screens[i].refscreen->screennum;
- xf86Screens[ref]->pScreen->x = xf86Screens[ref]->pScreen->y = 0;
- screensLeft &= ~(1 << ref);
- }
-
- prevScreensLeft = screensLeft;
+ while (1) {
+ for (mask = screensLeft, i = 0; mask; mask >>= 1, i++) {
+ if (!(mask & 1L))
+ continue;
+
+ screen = &xf86ConfigLayout.screens[i];
+
+ if (screen->refscreen != NULL &&
+ screen->refscreen->screennum >= xf86NumScreens) {
+ screensLeft &= ~(1 << i);
+ xf86Msg(X_WARNING,
+ "Not including screen \"%s\" in origins calculation.\n",
+ screen->screen->id);
+ continue;
+ }
+
+ pScreen = xf86Screens[i]->pScreen;
+ switch (screen->where) {
+ case PosObsolete:
+ OldStyleConfig = TRUE;
+ pLayout = &xf86ScreenLayout[i];
+ /* force edge lists */
+ if (screen->left) {
+ ref = screen->left->screennum;
+ if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ pLayout->left = AddEdge(pLayout->left,
+ 0, pScreen->height,
+ xf86Screens[ref]->pScreen->width, 0,
+ ref);
+ }
+ if (screen->right) {
+ ref = screen->right->screennum;
+ if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ pLayout->right = AddEdge(pLayout->right,
+ 0, pScreen->height,
+ -pScreen->width, 0, ref);
+ }
+ if (screen->top) {
+ ref = screen->top->screennum;
+ if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ pLayout->up = AddEdge(pLayout->up,
+ 0, pScreen->width,
+ 0, xf86Screens[ref]->pScreen->height,
+ ref);
+ }
+ if (screen->bottom) {
+ ref = screen->bottom->screennum;
+ if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ pLayout->down = AddEdge(pLayout->down,
+ 0, pScreen->width, 0,
+ -pScreen->height, ref);
+ }
+ /* we could also try to place it based on those
+ relative locations if we wanted to */
+ screen->x = screen->y = 0;
+ /* FALLTHROUGH */
+ case PosAbsolute:
+ pScreen->x = screen->x;
+ pScreen->y = screen->y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosRelative:
+ ref = screen->refscreen->screennum;
+ if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ if (screensLeft & (1 << ref))
+ break;
+ refScreen = xf86Screens[ref]->pScreen;
+ pScreen->x = refScreen->x + screen->x;
+ pScreen->y = refScreen->y + screen->y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosRightOf:
+ ref = screen->refscreen->screennum;
+ if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ if (screensLeft & (1 << ref))
+ break;
+ refScreen = xf86Screens[ref]->pScreen;
+ pScreen->x = refScreen->x + refScreen->width;
+ pScreen->y = refScreen->y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosLeftOf:
+ ref = screen->refscreen->screennum;
+ if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ if (screensLeft & (1 << ref))
+ break;
+ refScreen = xf86Screens[ref]->pScreen;
+ pScreen->x = refScreen->x - pScreen->width;
+ pScreen->y = refScreen->y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosBelow:
+ ref = screen->refscreen->screennum;
+ if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ if (screensLeft & (1 << ref))
+ break;
+ refScreen = xf86Screens[ref]->pScreen;
+ pScreen->x = refScreen->x;
+ pScreen->y = refScreen->y + refScreen->height;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosAbove:
+ ref = screen->refscreen->screennum;
+ if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ if (screensLeft & (1 << ref))
+ break;
+ refScreen = xf86Screens[ref]->pScreen;
+ pScreen->x = refScreen->x;
+ pScreen->y = refScreen->y - pScreen->height;
+ screensLeft &= ~(1 << i);
+ break;
+ default:
+ ErrorF("Illegal placement keyword in Layout!\n");
+ break;
+ }
+
+ }
+
+ if (!screensLeft)
+ break;
+
+ if (screensLeft == prevScreensLeft) {
+ /* All the remaining screens are referencing each other.
+ Assign a value to one of them and go through again */
+ i = 0;
+ while (!((1 << i) & screensLeft)) {
+ i++;
+ }
+
+ ref = xf86ConfigLayout.screens[i].refscreen->screennum;
+ xf86Screens[ref]->pScreen->x = xf86Screens[ref]->pScreen->y = 0;
+ screensLeft &= ~(1 << ref);
+ }
+
+ prevScreensLeft = screensLeft;
}
/* justify the topmost and leftmost to (0,0) */
minX = xf86Screens[0]->pScreen->x;
minY = xf86Screens[0]->pScreen->y;
- for(i = 1; i < xf86NumScreens; i++) {
- if(xf86Screens[i]->pScreen->x < minX)
- minX = xf86Screens[i]->pScreen->x;
- if(xf86Screens[i]->pScreen->y < minY)
- minY = xf86Screens[i]->pScreen->y;
+ for (i = 1; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->pScreen->x < minX)
+ minX = xf86Screens[i]->pScreen->x;
+ if (xf86Screens[i]->pScreen->y < minY)
+ minY = xf86Screens[i]->pScreen->y;
}
if (minX || minY) {
- for(i = 0; i < xf86NumScreens; i++) {
- xf86Screens[i]->pScreen->x -= minX;
- xf86Screens[i]->pScreen->y -= minY;
- }
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->pScreen->x -= minX;
+ xf86Screens[i]->pScreen->y -= minY;
+ }
}
-
/* Create the edge lists */
- if(!OldStyleConfig) {
- for(i = 0; i < xf86NumScreens; i++) {
- pLayout = &xf86ScreenLayout[i];
-
- pScreen = xf86Screens[i]->pScreen;
-
- left = pScreen->x;
- right = left + pScreen->width;
- top = pScreen->y;
- bottom = top + pScreen->height;
-
- for(j = 0; j < xf86NumScreens; j++) {
- if(i == j) continue;
-
- refScreen = xf86Screens[j]->pScreen;
-
- x1 = refScreen->x;
- x2 = x1 + refScreen->width;
- y1 = refScreen->y;
- y2 = y1 + refScreen->height;
-
- if((bottom > y1) && (top < y2)) {
- min = y1 - top;
- if(min < 0) min = 0;
- max = pScreen->height - (bottom - y2);
- if(max > pScreen->height) max = pScreen->height;
-
- if(((left - 1) >= x1) && ((left - 1) < x2))
- pLayout->left = AddEdge(pLayout->left, min, max,
- pScreen->x - refScreen->x,
- pScreen->y - refScreen->y, j);
-
- if((right >= x1) && (right < x2))
- pLayout->right = AddEdge(pLayout->right, min, max,
- pScreen->x - refScreen->x,
- pScreen->y - refScreen->y, j);
- }
-
-
- if((left < x2) && (right > x1)) {
- min = x1 - left;
- if(min < 0) min = 0;
- max = pScreen->width - (right - x2);
- if(max > pScreen->width) max = pScreen->width;
-
- if(((top - 1) >= y1) && ((top - 1) < y2))
- pLayout->up = AddEdge(pLayout->up, min, max,
- pScreen->x - refScreen->x,
- pScreen->y - refScreen->y, j);
-
- if((bottom >= y1) && (bottom < y2))
- pLayout->down = AddEdge(pLayout->down, min, max,
- pScreen->x - refScreen->x,
- pScreen->y - refScreen->y, j);
- }
- }
- }
+ if (!OldStyleConfig) {
+ for (i = 0; i < xf86NumScreens; i++) {
+ pLayout = &xf86ScreenLayout[i];
+
+ pScreen = xf86Screens[i]->pScreen;
+
+ left = pScreen->x;
+ right = left + pScreen->width;
+ top = pScreen->y;
+ bottom = top + pScreen->height;
+
+ for (j = 0; j < xf86NumScreens; j++) {
+ if (i == j)
+ continue;
+
+ refScreen = xf86Screens[j]->pScreen;
+
+ x1 = refScreen->x;
+ x2 = x1 + refScreen->width;
+ y1 = refScreen->y;
+ y2 = y1 + refScreen->height;
+
+ if ((bottom > y1) && (top < y2)) {
+ min = y1 - top;
+ if (min < 0)
+ min = 0;
+ max = pScreen->height - (bottom - y2);
+ if (max > pScreen->height)
+ max = pScreen->height;
+
+ if (((left - 1) >= x1) && ((left - 1) < x2))
+ pLayout->left = AddEdge(pLayout->left, min, max,
+ pScreen->x - refScreen->x,
+ pScreen->y - refScreen->y, j);
+
+ if ((right >= x1) && (right < x2))
+ pLayout->right = AddEdge(pLayout->right, min, max,
+ pScreen->x - refScreen->x,
+ pScreen->y - refScreen->y, j);
+ }
+
+ if ((left < x2) && (right > x1)) {
+ min = x1 - left;
+ if (min < 0)
+ min = 0;
+ max = pScreen->width - (right - x2);
+ if (max > pScreen->width)
+ max = pScreen->width;
+
+ if (((top - 1) >= y1) && ((top - 1) < y2))
+ pLayout->up = AddEdge(pLayout->up, min, max,
+ pScreen->x - refScreen->x,
+ pScreen->y - refScreen->y, j);
+
+ if ((bottom >= y1) && (bottom < y2))
+ pLayout->down = AddEdge(pLayout->down, min, max,
+ pScreen->x - refScreen->x,
+ pScreen->y - refScreen->y, j);
+ }
+ }
+ }
}
- if(!HardEdges && !OldStyleConfig) {
- for(i = 0; i < xf86NumScreens; i++) {
- pLayout = &xf86ScreenLayout[i];
- pScreen = xf86Screens[i]->pScreen;
- if(pLayout->left)
- FillOutEdge(pLayout->left, pScreen->height);
- if(pLayout->right)
- FillOutEdge(pLayout->right, pScreen->height);
- if(pLayout->up)
- FillOutEdge(pLayout->up, pScreen->width);
- if(pLayout->down)
- FillOutEdge(pLayout->down, pScreen->width);
- }
+ if (!HardEdges && !OldStyleConfig) {
+ for (i = 0; i < xf86NumScreens; i++) {
+ pLayout = &xf86ScreenLayout[i];
+ pScreen = xf86Screens[i]->pScreen;
+ if (pLayout->left)
+ FillOutEdge(pLayout->left, pScreen->height);
+ if (pLayout->right)
+ FillOutEdge(pLayout->right, pScreen->height);
+ if (pLayout->up)
+ FillOutEdge(pLayout->up, pScreen->width);
+ if (pLayout->down)
+ FillOutEdge(pLayout->down, pScreen->width);
+ }
}
update_desktop_dimensions();
@@ -848,15 +867,14 @@ xf86ReconfigureLayout(void)
int i;
for (i = 0; i < MAXSCREENS; i++) {
- xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i];
- /* we don't have to zero these, xf86InitOrigins() takes care of that */
- free(sl->left);
- free(sl->right);
- free(sl->up);
- free(sl->down);
+ xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i];
+
+ /* we don't have to zero these, xf86InitOrigins() takes care of that */
+ free(sl->left);
+ free(sl->right);
+ free(sl->up);
+ free(sl->down);
}
xf86InitOrigins();
}
-
-
diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c
index 0c958cdf3..316978cfa 100644
--- a/xorg-server/hw/xfree86/common/xf86DGA.c
+++ b/xorg-server/hw/xfree86/common/xf86DGA.c
@@ -52,6 +52,7 @@
#include "mi.h"
static DevPrivateKeyRec DGAScreenKeyRec;
+
#define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec)
static Bool mieq_installed;
@@ -63,86 +64,76 @@ static void DGAHandleEvent(int screen_num, InternalEvent *event,
DeviceIntPtr device);
static void
-DGACopyModeInfo(
- DGAModePtr mode,
- XDGAModePtr xmode
-);
+ DGACopyModeInfo(DGAModePtr mode, XDGAModePtr xmode);
int *XDGAEventBase = NULL;
#define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, &DGAScreenKeyRec))
-
-typedef struct _FakedVisualList{
- Bool free;
- VisualPtr pVisual;
- struct _FakedVisualList *next;
+typedef struct _FakedVisualList {
+ Bool free;
+ VisualPtr pVisual;
+ struct _FakedVisualList *next;
} FakedVisualList;
-
typedef struct {
- ScrnInfoPtr pScrn;
- int numModes;
- DGAModePtr modes;
- CloseScreenProcPtr CloseScreen;
- DestroyColormapProcPtr DestroyColormap;
- InstallColormapProcPtr InstallColormap;
- UninstallColormapProcPtr UninstallColormap;
- DGADevicePtr current;
- DGAFunctionPtr funcs;
- int input;
- ClientPtr client;
- int pixmapMode;
- FakedVisualList *fakedVisuals;
- ColormapPtr dgaColormap;
- ColormapPtr savedColormap;
- Bool grabMouse;
- Bool grabKeyboard;
+ ScrnInfoPtr pScrn;
+ int numModes;
+ DGAModePtr modes;
+ CloseScreenProcPtr CloseScreen;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ UninstallColormapProcPtr UninstallColormap;
+ DGADevicePtr current;
+ DGAFunctionPtr funcs;
+ int input;
+ ClientPtr client;
+ int pixmapMode;
+ FakedVisualList *fakedVisuals;
+ ColormapPtr dgaColormap;
+ ColormapPtr savedColormap;
+ Bool grabMouse;
+ Bool grabKeyboard;
} DGAScreenRec, *DGAScreenPtr;
Bool
-DGAInit(
- ScreenPtr pScreen,
- DGAFunctionPtr funcs,
- DGAModePtr modes,
- int num
-){
+DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num)
+{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
DGAScreenPtr pScreenPriv;
int i;
- if(!funcs || !funcs->SetMode || !funcs->OpenFramebuffer)
- return FALSE;
+ if (!funcs || !funcs->SetMode || !funcs->OpenFramebuffer)
+ return FALSE;
- if(!modes || num <= 0)
- return FALSE;
+ if (!modes || num <= 0)
+ return FALSE;
if (!dixRegisterPrivateKey(&DGAScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- if (!pScreenPriv)
- {
- if(!(pScreenPriv = (DGAScreenPtr)malloc(sizeof(DGAScreenRec))))
- return FALSE;
- dixSetPrivate(&pScreen->devPrivates, &DGAScreenKeyRec, pScreenPriv);
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = DGACloseScreen;
- pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
- pScreen->DestroyColormap = DGADestroyColormap;
- pScreenPriv->InstallColormap = pScreen->InstallColormap;
- pScreen->InstallColormap = DGAInstallColormap;
- pScreenPriv->UninstallColormap = pScreen->UninstallColormap;
- pScreen->UninstallColormap = DGAUninstallColormap;
+ if (!pScreenPriv) {
+ if (!(pScreenPriv = (DGAScreenPtr) malloc(sizeof(DGAScreenRec))))
+ return FALSE;
+ dixSetPrivate(&pScreen->devPrivates, &DGAScreenKeyRec, pScreenPriv);
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = DGACloseScreen;
+ pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
+ pScreen->DestroyColormap = DGADestroyColormap;
+ pScreenPriv->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = DGAInstallColormap;
+ pScreenPriv->UninstallColormap = pScreen->UninstallColormap;
+ pScreen->UninstallColormap = DGAUninstallColormap;
}
pScreenPriv->pScrn = pScrn;
pScreenPriv->numModes = num;
pScreenPriv->modes = modes;
- pScreenPriv->current = NULL;
-
+ pScreenPriv->current = NULL;
+
pScreenPriv->funcs = funcs;
pScreenPriv->input = 0;
pScreenPriv->client = NULL;
@@ -151,14 +142,14 @@ DGAInit(
pScreenPriv->savedColormap = NULL;
pScreenPriv->grabMouse = FALSE;
pScreenPriv->grabKeyboard = FALSE;
-
- for(i = 0; i < num; i++)
- modes[i].num = i + 1;
+
+ for (i = 0; i < num; i++)
+ modes[i].num = i + 1;
#ifdef PANORAMIX
- if(!noPanoramiXExtension)
- for(i = 0; i < num; i++)
- modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
+ if (!noPanoramiXExtension)
+ for (i = 0; i < num; i++)
+ modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
#endif
return TRUE;
@@ -169,51 +160,48 @@ DGAInit(
*/
Bool
-DGAReInitModes(
- ScreenPtr pScreen,
- DGAModePtr modes,
- int num
-){
+DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes, int num)
+{
DGAScreenPtr pScreenPriv;
int i;
/* No DGA? Ignore call (but don't make it look like it failed) */
- if(!DGAScreenKeyRegistered)
- return TRUE;
-
+ if (!DGAScreenKeyRegistered)
+ return TRUE;
+
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
/* Same as above */
- if(!pScreenPriv)
- return TRUE;
+ if (!pScreenPriv)
+ return TRUE;
/* Can't do this while DGA is active */
- if(pScreenPriv->current)
- return FALSE;
+ if (pScreenPriv->current)
+ return FALSE;
/* Quick sanity check */
- if(!num)
- modes = NULL;
- else if(!modes)
- num = 0;
+ if (!num)
+ modes = NULL;
+ else if (!modes)
+ num = 0;
pScreenPriv->numModes = num;
pScreenPriv->modes = modes;
/* This practically disables DGA. So be it. */
- if(!num)
- return TRUE;
+ if (!num)
+ return TRUE;
- for(i = 0; i < num; i++)
- modes[i].num = i + 1;
+ for (i = 0; i < num; i++)
+ modes[i].num = i + 1;
#ifdef PANORAMIX
- if(!noPanoramiXExtension)
- for(i = 0; i < num; i++)
- modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
+ if (!noPanoramiXExtension)
+ for (i = 0; i < num; i++)
+ modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
#endif
- return TRUE;
+ return TRUE;
}
static void
@@ -222,346 +210,346 @@ FreeMarkedVisuals(ScreenPtr pScreen)
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
FakedVisualList *prev, *curr, *tmp;
- if(!pScreenPriv->fakedVisuals)
- return;
+ if (!pScreenPriv->fakedVisuals)
+ return;
prev = NULL;
curr = pScreenPriv->fakedVisuals;
- while(curr) {
- if(curr->free) {
- tmp = curr;
- curr = curr->next;
- if(prev)
- prev->next = curr;
- else
- pScreenPriv->fakedVisuals = curr;
- free(tmp->pVisual);
- free(tmp);
- } else {
- prev = curr;
- curr = curr->next;
- }
+ while (curr) {
+ if (curr->free) {
+ tmp = curr;
+ curr = curr->next;
+ if (prev)
+ prev->next = curr;
+ else
+ pScreenPriv->fakedVisuals = curr;
+ free(tmp->pVisual);
+ free(tmp);
+ }
+ else {
+ prev = curr;
+ curr = curr->next;
+ }
}
}
-static Bool
+static Bool
DGACloseScreen(int i, ScreenPtr pScreen)
{
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- if (mieq_installed) {
- mieqSetHandler(ET_DGAEvent, NULL);
- mieq_installed = FALSE;
- }
+ if (mieq_installed) {
+ mieqSetHandler(ET_DGAEvent, NULL);
+ mieq_installed = FALSE;
+ }
- FreeMarkedVisuals(pScreen);
+ FreeMarkedVisuals(pScreen);
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
- pScreen->InstallColormap = pScreenPriv->InstallColormap;
- pScreen->UninstallColormap = pScreenPriv->UninstallColormap;
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ pScreen->UninstallColormap = pScreenPriv->UninstallColormap;
- /* DGAShutdown() should have ensured that no DGA
- screen were active by here */
+ /* DGAShutdown() should have ensured that no DGA
+ screen were active by here */
- free(pScreenPriv);
+ free(pScreenPriv);
- return((*pScreen->CloseScreen)(i, pScreen));
+ return ((*pScreen->CloseScreen) (i, pScreen));
}
-
-static void
+static void
DGADestroyColormap(ColormapPtr pmap)
{
- ScreenPtr pScreen = pmap->pScreen;
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- VisualPtr pVisual = pmap->pVisual;
-
- if(pScreenPriv->fakedVisuals) {
- FakedVisualList *curr = pScreenPriv->fakedVisuals;
-
- while(curr) {
- if(curr->pVisual == pVisual) {
- /* We can't get rid of them yet since FreeColormap
- still needs the pVisual during the cleanup */
- curr->free = TRUE;
- break;
- }
- curr = curr->next;
- }
- }
-
- if(pScreenPriv->DestroyColormap) {
+ ScreenPtr pScreen = pmap->pScreen;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ VisualPtr pVisual = pmap->pVisual;
+
+ if (pScreenPriv->fakedVisuals) {
+ FakedVisualList *curr = pScreenPriv->fakedVisuals;
+
+ while (curr) {
+ if (curr->pVisual == pVisual) {
+ /* We can't get rid of them yet since FreeColormap
+ still needs the pVisual during the cleanup */
+ curr->free = TRUE;
+ break;
+ }
+ curr = curr->next;
+ }
+ }
+
+ if (pScreenPriv->DestroyColormap) {
pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
- (*pScreen->DestroyColormap)(pmap);
+ (*pScreen->DestroyColormap) (pmap);
pScreen->DestroyColormap = DGADestroyColormap;
- }
+ }
}
-
-static void
+static void
DGAInstallColormap(ColormapPtr pmap)
{
ScreenPtr pScreen = pmap->pScreen;
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- if(pScreenPriv->current && pScreenPriv->dgaColormap) {
- if (pmap != pScreenPriv->dgaColormap) {
- pScreenPriv->savedColormap = pmap;
- pmap = pScreenPriv->dgaColormap;
- }
+ if (pScreenPriv->current && pScreenPriv->dgaColormap) {
+ if (pmap != pScreenPriv->dgaColormap) {
+ pScreenPriv->savedColormap = pmap;
+ pmap = pScreenPriv->dgaColormap;
+ }
}
pScreen->InstallColormap = pScreenPriv->InstallColormap;
- (*pScreen->InstallColormap)(pmap);
+ (*pScreen->InstallColormap) (pmap);
pScreen->InstallColormap = DGAInstallColormap;
}
-static void
+static void
DGAUninstallColormap(ColormapPtr pmap)
{
ScreenPtr pScreen = pmap->pScreen;
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- if(pScreenPriv->current && pScreenPriv->dgaColormap) {
- if (pmap == pScreenPriv->dgaColormap) {
- pScreenPriv->dgaColormap = NULL;
- }
+ if (pScreenPriv->current && pScreenPriv->dgaColormap) {
+ if (pmap == pScreenPriv->dgaColormap) {
+ pScreenPriv->dgaColormap = NULL;
+ }
}
pScreen->UninstallColormap = pScreenPriv->UninstallColormap;
- (*pScreen->UninstallColormap)(pmap);
+ (*pScreen->UninstallColormap) (pmap);
pScreen->UninstallColormap = DGAUninstallColormap;
}
int
-xf86SetDGAMode(
- int index,
- int num,
- DGADevicePtr devRet
-){
- ScreenPtr pScreen = screenInfo.screens[index];
- DGAScreenPtr pScreenPriv;
- ScrnInfoPtr pScrn;
- DGADevicePtr device;
- PixmapPtr pPix = NULL;
- DGAModePtr pMode = NULL;
-
- /* First check if DGAInit was successful on this screen */
- if (!DGAScreenKeyRegistered)
- return BadValue;
- pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- if (!pScreenPriv)
- return BadValue;
- pScrn = pScreenPriv->pScrn;
-
- if(!num) {
- if(pScreenPriv->current) {
- PixmapPtr oldPix = pScreenPriv->current->pPix;
- if(oldPix) {
- if(oldPix->drawable.id)
- FreeResource(oldPix->drawable.id, RT_NONE);
- else
- (*pScreen->DestroyPixmap)(oldPix);
- }
- free(pScreenPriv->current);
- pScreenPriv->current = NULL;
- pScrn->vtSema = TRUE;
- (*pScreenPriv->funcs->SetMode)(pScrn, NULL);
- if(pScreenPriv->savedColormap) {
- (*pScreen->InstallColormap)(pScreenPriv->savedColormap);
- pScreenPriv->savedColormap = NULL;
- }
- pScreenPriv->dgaColormap = NULL;
- (*pScrn->EnableDisableFBAccess)(index, TRUE);
-
- FreeMarkedVisuals(pScreen);
- }
-
+xf86SetDGAMode(int index, int num, DGADevicePtr devRet)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ DGAScreenPtr pScreenPriv;
+ ScrnInfoPtr pScrn;
+ DGADevicePtr device;
+ PixmapPtr pPix = NULL;
+ DGAModePtr pMode = NULL;
+
+ /* First check if DGAInit was successful on this screen */
+ if (!DGAScreenKeyRegistered)
+ return BadValue;
+ pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ if (!pScreenPriv)
+ return BadValue;
+ pScrn = pScreenPriv->pScrn;
+
+ if (!num) {
+ if (pScreenPriv->current) {
+ PixmapPtr oldPix = pScreenPriv->current->pPix;
+
+ if (oldPix) {
+ if (oldPix->drawable.id)
+ FreeResource(oldPix->drawable.id, RT_NONE);
+ else
+ (*pScreen->DestroyPixmap) (oldPix);
+ }
+ free(pScreenPriv->current);
+ pScreenPriv->current = NULL;
+ pScrn->vtSema = TRUE;
+ (*pScreenPriv->funcs->SetMode) (pScrn, NULL);
+ if (pScreenPriv->savedColormap) {
+ (*pScreen->InstallColormap) (pScreenPriv->savedColormap);
+ pScreenPriv->savedColormap = NULL;
+ }
+ pScreenPriv->dgaColormap = NULL;
+ (*pScrn->EnableDisableFBAccess) (index, TRUE);
+
+ FreeMarkedVisuals(pScreen);
+ }
+
pScreenPriv->grabMouse = FALSE;
pScreenPriv->grabKeyboard = FALSE;
- return Success;
- }
-
- if(!pScrn->vtSema && !pScreenPriv->current) /* Really switched away */
- return BadAlloc;
-
- if((num > 0) && (num <= pScreenPriv->numModes))
- pMode = &(pScreenPriv->modes[num - 1]);
- else
- return BadValue;
-
- if(!(device = (DGADevicePtr)malloc(sizeof(DGADeviceRec))))
- return BadAlloc;
-
- if(!pScreenPriv->current) {
- Bool oldVTSema = pScrn->vtSema;
-
- pScrn->vtSema = FALSE; /* kludge until we rewrite VT switching */
- (*pScrn->EnableDisableFBAccess)(index, FALSE);
- pScrn->vtSema = oldVTSema;
- }
-
- if(!(*pScreenPriv->funcs->SetMode)(pScrn, pMode)) {
- free(device);
- return BadAlloc;
- }
-
- pScrn->currentMode = pMode->mode;
-
- if(!pScreenPriv->current && !pScreenPriv->input) {
- /* if it's multihead we need to warp the cursor off of
- our screen so it doesn't get trapped */
- }
-
- pScrn->vtSema = FALSE;
-
- if(pScreenPriv->current) {
- PixmapPtr oldPix = pScreenPriv->current->pPix;
- if(oldPix) {
- if(oldPix->drawable.id)
- FreeResource(oldPix->drawable.id, RT_NONE);
- else
- (*pScreen->DestroyPixmap)(oldPix);
- }
- free(pScreenPriv->current);
- pScreenPriv->current = NULL;
- }
-
- if(pMode->flags & DGA_PIXMAP_AVAILABLE) {
- if((pPix = (*pScreen->CreatePixmap)(pScreen, 0, 0, pMode->depth, 0))) {
- (*pScreen->ModifyPixmapHeader)(pPix,
- pMode->pixmapWidth, pMode->pixmapHeight,
- pMode->depth, pMode->bitsPerPixel,
- pMode->bytesPerScanline,
- (pointer)(pMode->address));
- }
- }
+ return Success;
+ }
- devRet->mode = device->mode = pMode;
- devRet->pPix = device->pPix = pPix;
- pScreenPriv->current = device;
- pScreenPriv->pixmapMode = FALSE;
- pScreenPriv->grabMouse = TRUE;
- pScreenPriv->grabKeyboard = TRUE;
+ if (!pScrn->vtSema && !pScreenPriv->current) /* Really switched away */
+ return BadAlloc;
- if (!mieq_installed) {
- mieqSetHandler(ET_DGAEvent, DGAHandleEvent);
- mieq_installed = TRUE;
- }
+ if ((num > 0) && (num <= pScreenPriv->numModes))
+ pMode = &(pScreenPriv->modes[num - 1]);
+ else
+ return BadValue;
- return Success;
-}
+ if (!(device = (DGADevicePtr) malloc(sizeof(DGADeviceRec))))
+ return BadAlloc;
+
+ if (!pScreenPriv->current) {
+ Bool oldVTSema = pScrn->vtSema;
+
+ pScrn->vtSema = FALSE; /* kludge until we rewrite VT switching */
+ (*pScrn->EnableDisableFBAccess) (index, FALSE);
+ pScrn->vtSema = oldVTSema;
+ }
+
+ if (!(*pScreenPriv->funcs->SetMode) (pScrn, pMode)) {
+ free(device);
+ return BadAlloc;
+ }
+
+ pScrn->currentMode = pMode->mode;
+ if (!pScreenPriv->current && !pScreenPriv->input) {
+ /* if it's multihead we need to warp the cursor off of
+ our screen so it doesn't get trapped */
+ }
+
+ pScrn->vtSema = FALSE;
+
+ if (pScreenPriv->current) {
+ PixmapPtr oldPix = pScreenPriv->current->pPix;
+
+ if (oldPix) {
+ if (oldPix->drawable.id)
+ FreeResource(oldPix->drawable.id, RT_NONE);
+ else
+ (*pScreen->DestroyPixmap) (oldPix);
+ }
+ free(pScreenPriv->current);
+ pScreenPriv->current = NULL;
+ }
+ if (pMode->flags & DGA_PIXMAP_AVAILABLE) {
+ if ((pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, pMode->depth, 0))) {
+ (*pScreen->ModifyPixmapHeader) (pPix,
+ pMode->pixmapWidth,
+ pMode->pixmapHeight, pMode->depth,
+ pMode->bitsPerPixel,
+ pMode->bytesPerScanline,
+ (pointer) (pMode->address));
+ }
+ }
+
+ devRet->mode = device->mode = pMode;
+ devRet->pPix = device->pPix = pPix;
+ pScreenPriv->current = device;
+ pScreenPriv->pixmapMode = FALSE;
+ pScreenPriv->grabMouse = TRUE;
+ pScreenPriv->grabKeyboard = TRUE;
+
+ if (!mieq_installed) {
+ mieqSetHandler(ET_DGAEvent, DGAHandleEvent);
+ mieq_installed = TRUE;
+ }
+
+ return Success;
+}
/*********** exported ones ***************/
void
DGASetInputMode(int index, Bool keyboard, Bool mouse)
{
- ScreenPtr pScreen = screenInfo.screens[index];
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
-
- if (pScreenPriv)
- {
- pScreenPriv->grabMouse = mouse;
- pScreenPriv->grabKeyboard = keyboard;
-
- if (!mieq_installed) {
- mieqSetHandler(ET_DGAEvent, DGAHandleEvent);
- mieq_installed = TRUE;
- }
- }
+ ScreenPtr pScreen = screenInfo.screens[index];
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ if (pScreenPriv) {
+ pScreenPriv->grabMouse = mouse;
+ pScreenPriv->grabKeyboard = keyboard;
+
+ if (!mieq_installed) {
+ mieqSetHandler(ET_DGAEvent, DGAHandleEvent);
+ mieq_installed = TRUE;
+ }
+ }
}
Bool
DGAChangePixmapMode(int index, int *x, int *y, int mode)
{
- DGAScreenPtr pScreenPriv;
- DGADevicePtr pDev;
- DGAModePtr pMode;
- PixmapPtr pPix;
-
- if(!DGAScreenKeyRegistered)
- return FALSE;
-
- pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- if(!pScreenPriv || !pScreenPriv->current || !pScreenPriv->current->pPix)
- return FALSE;
-
- pDev = pScreenPriv->current;
- pPix = pDev->pPix;
- pMode = pDev->mode;
-
- if(mode) {
- int shift = 2;
-
- if(*x > (pMode->pixmapWidth - pMode->viewportWidth))
- *x = pMode->pixmapWidth - pMode->viewportWidth;
- if(*y > (pMode->pixmapHeight - pMode->viewportHeight))
- *y = pMode->pixmapHeight - pMode->viewportHeight;
-
- switch(xf86Screens[index]->bitsPerPixel) {
- case 16: shift = 1; break;
- case 32: shift = 0; break;
- default: break;
- }
-
- if(BITMAP_SCANLINE_PAD == 64)
- shift++;
-
- *x = (*x >> shift) << shift;
-
- pPix->drawable.x = *x;
- pPix->drawable.y = *y;
- pPix->drawable.width = pMode->viewportWidth;
- pPix->drawable.height = pMode->viewportHeight;
- } else {
- pPix->drawable.x = 0;
- pPix->drawable.y = 0;
- pPix->drawable.width = pMode->pixmapWidth;
- pPix->drawable.height = pMode->pixmapHeight;
- }
- pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pScreenPriv->pixmapMode = mode;
-
- return TRUE;
+ DGAScreenPtr pScreenPriv;
+ DGADevicePtr pDev;
+ DGAModePtr pMode;
+ PixmapPtr pPix;
+
+ if (!DGAScreenKeyRegistered)
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if (!pScreenPriv || !pScreenPriv->current || !pScreenPriv->current->pPix)
+ return FALSE;
+
+ pDev = pScreenPriv->current;
+ pPix = pDev->pPix;
+ pMode = pDev->mode;
+
+ if (mode) {
+ int shift = 2;
+
+ if (*x > (pMode->pixmapWidth - pMode->viewportWidth))
+ *x = pMode->pixmapWidth - pMode->viewportWidth;
+ if (*y > (pMode->pixmapHeight - pMode->viewportHeight))
+ *y = pMode->pixmapHeight - pMode->viewportHeight;
+
+ switch (xf86Screens[index]->bitsPerPixel) {
+ case 16:
+ shift = 1;
+ break;
+ case 32:
+ shift = 0;
+ break;
+ default:
+ break;
+ }
+
+ if (BITMAP_SCANLINE_PAD == 64)
+ shift++;
+
+ *x = (*x >> shift) << shift;
+
+ pPix->drawable.x = *x;
+ pPix->drawable.y = *y;
+ pPix->drawable.width = pMode->viewportWidth;
+ pPix->drawable.height = pMode->viewportHeight;
+ }
+ else {
+ pPix->drawable.x = 0;
+ pPix->drawable.y = 0;
+ pPix->drawable.width = pMode->pixmapWidth;
+ pPix->drawable.height = pMode->pixmapHeight;
+ }
+ pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pScreenPriv->pixmapMode = mode;
+
+ return TRUE;
}
Bool
-DGAAvailable(int index)
+DGAAvailable(int index)
{
- if(!DGAScreenKeyRegistered)
- return FALSE;
-
- if(DGA_GET_SCREEN_PRIV(screenInfo.screens[index]))
- return TRUE;
+ if (!DGAScreenKeyRegistered)
+ return FALSE;
- return FALSE;
+ if (DGA_GET_SCREEN_PRIV(screenInfo.screens[index]))
+ return TRUE;
+
+ return FALSE;
}
Bool
-DGAActive(int index)
+DGAActive(int index)
{
- DGAScreenPtr pScreenPriv;
+ DGAScreenPtr pScreenPriv;
- if(!DGAScreenKeyRegistered)
- return FALSE;
+ if (!DGAScreenKeyRegistered)
+ return FALSE;
- pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- if(pScreenPriv && pScreenPriv->current)
- return TRUE;
+ if (pScreenPriv && pScreenPriv->current)
+ return TRUE;
- return FALSE;
+ return FALSE;
}
-
-
/* Called by the event code in case the server is abruptly terminated */
void
@@ -570,35 +558,31 @@ DGAShutdown(void)
ScrnInfoPtr pScrn;
int i;
- if(!DGAScreenKeyRegistered)
- return;
+ if (!DGAScreenKeyRegistered)
+ return;
- for(i = 0; i < screenInfo.numScreens; i++) {
- pScrn = xf86Screens[i];
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pScrn = xf86Screens[i];
- (void)(*pScrn->SetDGAMode)(pScrn->scrnIndex, 0, NULL);
+ (void) (*pScrn->SetDGAMode) (pScrn->scrnIndex, 0, NULL);
}
}
/* Called by the extension to initialize a mode */
int
-DGASetMode(
- int index,
- int num,
- XDGAModePtr mode,
- PixmapPtr *pPix
-){
+DGASetMode(int index, int num, XDGAModePtr mode, PixmapPtr *pPix)
+{
ScrnInfoPtr pScrn = xf86Screens[index];
DGADeviceRec device;
int ret;
- /* We rely on the extension to check that DGA is available */
+ /* We rely on the extension to check that DGA is available */
- ret = (*pScrn->SetDGAMode)(index, num, &device);
- if((ret == Success) && num) {
- DGACopyModeInfo(device.mode, mode);
- *pPix = device.pPix;
+ ret = (*pScrn->SetDGAMode) (index, num, &device);
+ if ((ret == Success) && num) {
+ DGACopyModeInfo(device.mode, mode);
+ *pPix = device.pPix;
}
return ret;
@@ -607,124 +591,119 @@ DGASetMode(
/* Called from the extension to let the DDX know which events are requested */
void
-DGASelectInput(
- int index,
- ClientPtr client,
- long mask
-){
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- /* We rely on the extension to check that DGA is available */
- pScreenPriv->client = client;
- pScreenPriv->input = mask;
+DGASelectInput(int index, ClientPtr client, long mask)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is available */
+ pScreenPriv->client = client;
+ pScreenPriv->input = mask;
}
int
-DGAGetViewportStatus(int index)
+DGAGetViewportStatus(int index)
{
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- /* We rely on the extension to check that DGA is active */
+ /* We rely on the extension to check that DGA is active */
- if (!pScreenPriv->funcs->GetViewport)
- return 0;
+ if (!pScreenPriv->funcs->GetViewport)
+ return 0;
- return (*pScreenPriv->funcs->GetViewport)(pScreenPriv->pScrn);
+ return (*pScreenPriv->funcs->GetViewport) (pScreenPriv->pScrn);
}
int
-DGASetViewport(
- int index,
- int x, int y,
- int mode
-){
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- if (pScreenPriv->funcs->SetViewport)
- (*pScreenPriv->funcs->SetViewport)(pScreenPriv->pScrn, x, y, mode);
- return Success;
-}
+DGASetViewport(int index, int x, int y, int mode)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ if (pScreenPriv->funcs->SetViewport)
+ (*pScreenPriv->funcs->SetViewport) (pScreenPriv->pScrn, x, y, mode);
+ return Success;
+}
static int
BitsClear(CARD32 data)
{
- int bits = 0;
- CARD32 mask;
-
- for(mask = 1; mask; mask <<= 1) {
- if(!(data & mask)) bits++;
- else break;
- }
+ int bits = 0;
+ CARD32 mask;
+
+ for (mask = 1; mask; mask <<= 1) {
+ if (!(data & mask))
+ bits++;
+ else
+ break;
+ }
- return bits;
+ return bits;
}
int
DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
{
- ScreenPtr pScreen = screenInfo.screens[index];
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- FakedVisualList *fvlp;
- VisualPtr pVisual;
- DGAModePtr pMode;
- ColormapPtr pmap;
-
- if(!mode || (mode > pScreenPriv->numModes))
- return BadValue;
-
- if((alloc != AllocNone) && (alloc != AllocAll))
- return BadValue;
-
- pMode = &(pScreenPriv->modes[mode - 1]);
-
- if(!(pVisual = malloc(sizeof(VisualRec))))
- return BadAlloc;
-
- pVisual->vid = FakeClientID(0);
- pVisual->class = pMode->visualClass;
- pVisual->nplanes = pMode->depth;
- pVisual->ColormapEntries = 1 << pMode->depth;
- pVisual->bitsPerRGBValue = (pMode->depth + 2) / 3;
-
- switch (pVisual->class) {
- case PseudoColor:
- case GrayScale:
- case StaticGray:
- pVisual->bitsPerRGBValue = 8; /* not quite */
- pVisual->redMask = 0;
- pVisual->greenMask = 0;
- pVisual->blueMask = 0;
- pVisual->offsetRed = 0;
- pVisual->offsetGreen = 0;
- pVisual->offsetBlue = 0;
- break;
- case DirectColor:
- case TrueColor:
- pVisual->ColormapEntries = 1 << pVisual->bitsPerRGBValue;
- /* fall through */
- case StaticColor:
- pVisual->redMask = pMode->red_mask;
- pVisual->greenMask = pMode->green_mask;
- pVisual->blueMask = pMode->blue_mask;
- pVisual->offsetRed = BitsClear(pVisual->redMask);
- pVisual->offsetGreen = BitsClear(pVisual->greenMask);
- pVisual->offsetBlue = BitsClear(pVisual->blueMask);
- }
-
- if(!(fvlp = malloc(sizeof(FakedVisualList)))) {
- free(pVisual);
- return BadAlloc;
- }
-
- fvlp->free = FALSE;
- fvlp->pVisual = pVisual;
- fvlp->next = pScreenPriv->fakedVisuals;
- pScreenPriv->fakedVisuals = fvlp;
-
- LEGAL_NEW_RESOURCE(id, client);
-
- return CreateColormap(id, pScreen, pVisual, &pmap, alloc, client->index);
+ ScreenPtr pScreen = screenInfo.screens[index];
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ FakedVisualList *fvlp;
+ VisualPtr pVisual;
+ DGAModePtr pMode;
+ ColormapPtr pmap;
+
+ if (!mode || (mode > pScreenPriv->numModes))
+ return BadValue;
+
+ if ((alloc != AllocNone) && (alloc != AllocAll))
+ return BadValue;
+
+ pMode = &(pScreenPriv->modes[mode - 1]);
+
+ if (!(pVisual = malloc(sizeof(VisualRec))))
+ return BadAlloc;
+
+ pVisual->vid = FakeClientID(0);
+ pVisual->class = pMode->visualClass;
+ pVisual->nplanes = pMode->depth;
+ pVisual->ColormapEntries = 1 << pMode->depth;
+ pVisual->bitsPerRGBValue = (pMode->depth + 2) / 3;
+
+ switch (pVisual->class) {
+ case PseudoColor:
+ case GrayScale:
+ case StaticGray:
+ pVisual->bitsPerRGBValue = 8; /* not quite */
+ pVisual->redMask = 0;
+ pVisual->greenMask = 0;
+ pVisual->blueMask = 0;
+ pVisual->offsetRed = 0;
+ pVisual->offsetGreen = 0;
+ pVisual->offsetBlue = 0;
+ break;
+ case DirectColor:
+ case TrueColor:
+ pVisual->ColormapEntries = 1 << pVisual->bitsPerRGBValue;
+ /* fall through */
+ case StaticColor:
+ pVisual->redMask = pMode->red_mask;
+ pVisual->greenMask = pMode->green_mask;
+ pVisual->blueMask = pMode->blue_mask;
+ pVisual->offsetRed = BitsClear(pVisual->redMask);
+ pVisual->offsetGreen = BitsClear(pVisual->greenMask);
+ pVisual->offsetBlue = BitsClear(pVisual->blueMask);
+ }
+
+ if (!(fvlp = malloc(sizeof(FakedVisualList)))) {
+ free(pVisual);
+ return BadAlloc;
+ }
+
+ fvlp->free = FALSE;
+ fvlp->pVisual = pVisual;
+ fvlp->next = pScreenPriv->fakedVisuals;
+ pScreenPriv->fakedVisuals = fvlp;
+
+ LEGAL_NEW_RESOURCE(id, client);
+
+ return CreateColormap(id, pScreen, pVisual, &pmap, alloc, client->index);
}
/* Called by the extension to install a colormap on DGA active screens */
@@ -735,198 +714,184 @@ DGAInstallCmap(ColormapPtr cmap)
ScreenPtr pScreen = cmap->pScreen;
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- /* We rely on the extension to check that DGA is active */
+ /* We rely on the extension to check that DGA is active */
- if(!pScreenPriv->dgaColormap)
- pScreenPriv->savedColormap = GetInstalledmiColormap(pScreen);
+ if (!pScreenPriv->dgaColormap)
+ pScreenPriv->savedColormap = GetInstalledmiColormap(pScreen);
- pScreenPriv->dgaColormap = cmap;
+ pScreenPriv->dgaColormap = cmap;
- (*pScreen->InstallColormap)(cmap);
+ (*pScreen->InstallColormap) (cmap);
}
int
DGASync(int index)
{
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- /* We rely on the extension to check that DGA is active */
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- if (pScreenPriv->funcs->Sync)
- (*pScreenPriv->funcs->Sync)(pScreenPriv->pScrn);
+ /* We rely on the extension to check that DGA is active */
- return Success;
+ if (pScreenPriv->funcs->Sync)
+ (*pScreenPriv->funcs->Sync) (pScreenPriv->pScrn);
+
+ return Success;
}
int
-DGAFillRect(
- int index,
- int x, int y, int w, int h,
- unsigned long color
-){
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- /* We rely on the extension to check that DGA is active */
-
- if(pScreenPriv->funcs->FillRect &&
- (pScreenPriv->current->mode->flags & DGA_FILL_RECT)) {
-
- (*pScreenPriv->funcs->FillRect)(pScreenPriv->pScrn, x, y, w, h, color);
- return Success;
- }
- return BadMatch;
+DGAFillRect(int index, int x, int y, int w, int h, unsigned long color)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if (pScreenPriv->funcs->FillRect &&
+ (pScreenPriv->current->mode->flags & DGA_FILL_RECT)) {
+
+ (*pScreenPriv->funcs->FillRect) (pScreenPriv->pScrn, x, y, w, h, color);
+ return Success;
+ }
+ return BadMatch;
}
int
-DGABlitRect(
- int index,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty
-){
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- /* We rely on the extension to check that DGA is active */
-
- if(pScreenPriv->funcs->BlitRect &&
- (pScreenPriv->current->mode->flags & DGA_BLIT_RECT)) {
-
- (*pScreenPriv->funcs->BlitRect)(pScreenPriv->pScrn,
- srcx, srcy, w, h, dstx, dsty);
- return Success;
- }
- return BadMatch;
+DGABlitRect(int index, int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if (pScreenPriv->funcs->BlitRect &&
+ (pScreenPriv->current->mode->flags & DGA_BLIT_RECT)) {
+
+ (*pScreenPriv->funcs->BlitRect) (pScreenPriv->pScrn,
+ srcx, srcy, w, h, dstx, dsty);
+ return Success;
+ }
+ return BadMatch;
}
int
-DGABlitTransRect(
- int index,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty,
- unsigned long color
-){
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- /* We rely on the extension to check that DGA is active */
-
- if(pScreenPriv->funcs->BlitTransRect &&
- (pScreenPriv->current->mode->flags & DGA_BLIT_RECT_TRANS)) {
-
- (*pScreenPriv->funcs->BlitTransRect)(pScreenPriv->pScrn,
- srcx, srcy, w, h, dstx, dsty, color);
- return Success;
- }
- return BadMatch;
-}
+DGABlitTransRect(int index,
+ int srcx, int srcy,
+ int w, int h, int dstx, int dsty, unsigned long color)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ /* We rely on the extension to check that DGA is active */
+
+ if (pScreenPriv->funcs->BlitTransRect &&
+ (pScreenPriv->current->mode->flags & DGA_BLIT_RECT_TRANS)) {
+
+ (*pScreenPriv->funcs->BlitTransRect) (pScreenPriv->pScrn,
+ srcx, srcy, w, h, dstx, dsty,
+ color);
+ return Success;
+ }
+ return BadMatch;
+}
int
DGAGetModes(int index)
{
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- /* We rely on the extension to check that DGA is available */
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- return pScreenPriv->numModes;
-}
+ /* We rely on the extension to check that DGA is available */
+ return pScreenPriv->numModes;
+}
int
-DGAGetModeInfo(
- int index,
- XDGAModePtr mode,
- int num
-){
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- /* We rely on the extension to check that DGA is available */
+DGAGetModeInfo(int index, XDGAModePtr mode, int num)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- if((num <= 0) || (num > pScreenPriv->numModes))
- return BadValue;
+ /* We rely on the extension to check that DGA is available */
- DGACopyModeInfo(&(pScreenPriv->modes[num - 1]), mode);
+ if ((num <= 0) || (num > pScreenPriv->numModes))
+ return BadValue;
- return Success;
-}
+ DGACopyModeInfo(&(pScreenPriv->modes[num - 1]), mode);
+ return Success;
+}
static void
-DGACopyModeInfo(
- DGAModePtr mode,
- XDGAModePtr xmode
-){
- DisplayModePtr dmode = mode->mode;
-
- xmode->num = mode->num;
- xmode->name = dmode->name;
- xmode->VSync_num = (int)(dmode->VRefresh * 1000.0);
- xmode->VSync_den = 1000;
- xmode->flags = mode->flags;
- xmode->imageWidth = mode->imageWidth;
- xmode->imageHeight = mode->imageHeight;
- xmode->pixmapWidth = mode->pixmapWidth;
- xmode->pixmapHeight = mode->pixmapHeight;
- xmode->bytesPerScanline = mode->bytesPerScanline;
- xmode->byteOrder = mode->byteOrder;
- xmode->depth = mode->depth;
- xmode->bitsPerPixel = mode->bitsPerPixel;
- xmode->red_mask = mode->red_mask;
- xmode->green_mask = mode->green_mask;
- xmode->blue_mask = mode->blue_mask;
- xmode->visualClass = mode->visualClass;
- xmode->viewportWidth = mode->viewportWidth;
- xmode->viewportHeight = mode->viewportHeight;
- xmode->xViewportStep = mode->xViewportStep;
- xmode->yViewportStep = mode->yViewportStep;
- xmode->maxViewportX = mode->maxViewportX;
- xmode->maxViewportY = mode->maxViewportY;
- xmode->viewportFlags = mode->viewportFlags;
- xmode->reserved1 = mode->reserved1;
- xmode->reserved2 = mode->reserved2;
- xmode->offset = mode->offset;
-
- if(dmode->Flags & V_INTERLACE) xmode->flags |= DGA_INTERLACED;
- if(dmode->Flags & V_DBLSCAN) xmode->flags |= DGA_DOUBLESCAN;
+DGACopyModeInfo(DGAModePtr mode, XDGAModePtr xmode)
+{
+ DisplayModePtr dmode = mode->mode;
+
+ xmode->num = mode->num;
+ xmode->name = dmode->name;
+ xmode->VSync_num = (int) (dmode->VRefresh * 1000.0);
+ xmode->VSync_den = 1000;
+ xmode->flags = mode->flags;
+ xmode->imageWidth = mode->imageWidth;
+ xmode->imageHeight = mode->imageHeight;
+ xmode->pixmapWidth = mode->pixmapWidth;
+ xmode->pixmapHeight = mode->pixmapHeight;
+ xmode->bytesPerScanline = mode->bytesPerScanline;
+ xmode->byteOrder = mode->byteOrder;
+ xmode->depth = mode->depth;
+ xmode->bitsPerPixel = mode->bitsPerPixel;
+ xmode->red_mask = mode->red_mask;
+ xmode->green_mask = mode->green_mask;
+ xmode->blue_mask = mode->blue_mask;
+ xmode->visualClass = mode->visualClass;
+ xmode->viewportWidth = mode->viewportWidth;
+ xmode->viewportHeight = mode->viewportHeight;
+ xmode->xViewportStep = mode->xViewportStep;
+ xmode->yViewportStep = mode->yViewportStep;
+ xmode->maxViewportX = mode->maxViewportX;
+ xmode->maxViewportY = mode->maxViewportY;
+ xmode->viewportFlags = mode->viewportFlags;
+ xmode->reserved1 = mode->reserved1;
+ xmode->reserved2 = mode->reserved2;
+ xmode->offset = mode->offset;
+
+ if (dmode->Flags & V_INTERLACE)
+ xmode->flags |= DGA_INTERLACED;
+ if (dmode->Flags & V_DBLSCAN)
+ xmode->flags |= DGA_DOUBLESCAN;
}
-
Bool
DGAVTSwitch(void)
{
ScreenPtr pScreen;
int i;
- for(i = 0; i < screenInfo.numScreens; i++) {
- pScreen = screenInfo.screens[i];
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
- /* Alternatively, this could send events to DGA clients */
+ /* Alternatively, this could send events to DGA clients */
- if(DGAScreenKeyRegistered) {
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ if (DGAScreenKeyRegistered) {
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- if(pScreenPriv && pScreenPriv->current)
- return FALSE;
- }
+ if (pScreenPriv && pScreenPriv->current)
+ return FALSE;
+ }
}
- return TRUE;
+ return TRUE;
}
Bool
DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down)
{
- DGAScreenPtr pScreenPriv;
- DGAEvent event;
+ DGAScreenPtr pScreenPriv;
+ DGAEvent event;
- if(!DGAScreenKeyRegistered) /* no DGA */
+ if (!DGAScreenKeyRegistered) /* no DGA */
return FALSE;
- if (key_code < 8 || key_code > 255)
- return FALSE;
+ if (key_code < 8 || key_code > 255)
+ return FALSE;
- pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
- return FALSE;
+ if (!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
+ return FALSE;
memset(&event, 0, sizeof(event));
event.header = ET_Internal;
@@ -937,23 +902,23 @@ DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down)
event.detail = key_code;
event.dx = 0;
event.dy = 0;
- mieqEnqueue (dev, (InternalEvent*)&event);
+ mieqEnqueue(dev, (InternalEvent *) &event);
- return TRUE;
-}
+ return TRUE;
+}
Bool
DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy)
{
- DGAScreenPtr pScreenPriv;
- DGAEvent event;
+ DGAScreenPtr pScreenPriv;
+ DGAEvent event;
- if(!DGAScreenKeyRegistered) /* no DGA */
+ if (!DGAScreenKeyRegistered) /* no DGA */
return FALSE;
-
- pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if (!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */
return FALSE;
memset(&event, 0, sizeof(event));
@@ -965,7 +930,7 @@ DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy)
event.detail = 0;
event.dx = dx;
event.dy = dy;
- mieqEnqueue (dev, (InternalEvent*)&event);
+ mieqEnqueue(dev, (InternalEvent *) &event);
return TRUE;
}
@@ -975,9 +940,9 @@ DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down)
DGAScreenPtr pScreenPriv;
DGAEvent event;
- if(!DGAScreenKeyRegistered) /* no DGA */
+ if (!DGAScreenKeyRegistered) /* no DGA */
return FALSE;
-
+
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
if (!pScreenPriv || !pScreenPriv->grabMouse)
@@ -992,32 +957,31 @@ DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down)
event.detail = button;
event.dx = 0;
event.dy = 0;
- mieqEnqueue (dev, (InternalEvent*)&event);
+ mieqEnqueue(dev, (InternalEvent *) &event);
return TRUE;
}
/* We have the power to steal or modify events that are about to get queued */
-#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
-static Mask filters[] =
-{
- NoSuchEvent, /* 0 */
- NoSuchEvent, /* 1 */
- KeyPressMask, /* KeyPress */
- KeyReleaseMask, /* KeyRelease */
- ButtonPressMask, /* ButtonPress */
- ButtonReleaseMask, /* ButtonRelease */
- PointerMotionMask, /* MotionNotify (initial state) */
+#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
+static Mask filters[] = {
+ NoSuchEvent, /* 0 */
+ NoSuchEvent, /* 1 */
+ KeyPressMask, /* KeyPress */
+ KeyReleaseMask, /* KeyRelease */
+ ButtonPressMask, /* ButtonPress */
+ ButtonReleaseMask, /* ButtonRelease */
+ PointerMotionMask, /* MotionNotify (initial state) */
};
static void
-DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd)
+DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd)
{
- KeyClassPtr keyc = keybd->key;
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- DeviceIntPtr pointer = GetMaster(keybd, POINTER_OR_FLOAT);
- DeviceEvent ev;
+ KeyClassPtr keyc = keybd->key;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ DeviceIntPtr pointer = GetMaster(keybd, POINTER_OR_FLOAT);
+ DeviceEvent ev;
memset(&ev, 0, sizeof(ev));
ev.header = ET_Internal;
@@ -1034,9 +998,9 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd)
/*
* Deliver the DGA event
*/
- if (pScreenPriv->client)
- {
+ if (pScreenPriv->client) {
dgaEvent de;
+
de.u.u.type = *XDGAEventBase + GetCoreType(ev.type);
de.u.u.detail = event->detail;
de.u.event.time = event->time;
@@ -1045,39 +1009,37 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd)
de.u.event.screen = pScreen->myNum;
de.u.event.state = ev.corestate;
- /* If the DGA client has selected input, then deliver based on the usual filter */
- TryClientEvents (pScreenPriv->client, keybd, (xEvent *)&de, 1,
- filters[ev.type], pScreenPriv->input, 0);
+ /* If the DGA client has selected input, then deliver based on the usual filter */
+ TryClientEvents(pScreenPriv->client, keybd, (xEvent *) &de, 1,
+ filters[ev.type], pScreenPriv->input, 0);
}
- else
- {
- /* If the keyboard is actively grabbed, deliver a grabbed core event */
- if (keybd->deviceGrab.grab && !keybd->deviceGrab.fromPassiveGrab)
- {
+ else {
+ /* If the keyboard is actively grabbed, deliver a grabbed core event */
+ if (keybd->deviceGrab.grab && !keybd->deviceGrab.fromPassiveGrab) {
ev.detail.key = event->detail;
- ev.time = event->time;
- ev.root_x = event->dx;
- ev.root_y = event->dy;
- ev.corestate = event->state;
- ev.deviceid = keybd->id;
- DeliverGrabbedEvent ((InternalEvent*)&ev, keybd, FALSE);
- }
+ ev.time = event->time;
+ ev.root_x = event->dx;
+ ev.root_y = event->dy;
+ ev.corestate = event->state;
+ ev.deviceid = keybd->id;
+ DeliverGrabbedEvent((InternalEvent *) &ev, keybd, FALSE);
+ }
}
}
static void
-DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
+DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse)
{
- ButtonClassPtr butc = mouse->button;
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- DeviceEvent ev;
- DeviceIntPtr master = GetMaster(mouse, MASTER_KEYBOARD);
+ ButtonClassPtr butc = mouse->button;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ DeviceEvent ev;
+ DeviceIntPtr master = GetMaster(mouse, MASTER_KEYBOARD);
memset(&ev, 0, sizeof(ev));
ev.header = ET_Internal;
ev.length = sizeof(ev);
ev.type = event->subtype;
- ev.corestate = butc ? butc->state : 0;
+ ev.corestate = butc ? butc->state : 0;
if (master && master->key)
ev.corestate |= XkbStateFieldFromRec(&master->key->xkbInfo->state);
@@ -1086,10 +1048,9 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
/*
* Deliver the DGA event
*/
- if (pScreenPriv->client)
- {
- dgaEvent de;
- int coreEquiv;
+ if (pScreenPriv->client) {
+ dgaEvent de;
+ int coreEquiv;
coreEquiv = GetCoreType(ev.type);
@@ -1101,54 +1062,49 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
de.u.event.screen = pScreen->myNum;
de.u.event.state = ev.corestate;
- /* If the DGA client has selected input, then deliver based on the usual filter */
- TryClientEvents (pScreenPriv->client, mouse, (xEvent *)&de, 1,
- filters[coreEquiv], pScreenPriv->input, 0);
+ /* If the DGA client has selected input, then deliver based on the usual filter */
+ TryClientEvents(pScreenPriv->client, mouse, (xEvent *) &de, 1,
+ filters[coreEquiv], pScreenPriv->input, 0);
}
- else
- {
- /* If the pointer is actively grabbed, deliver a grabbed core event */
- if (mouse->deviceGrab.grab && !mouse->deviceGrab.fromPassiveGrab)
- {
- ev.detail.button = event->detail;
- ev.time = event->time;
- ev.root_x = event->dx;
- ev.root_y = event->dy;
- ev.corestate = event->state;
+ else {
+ /* If the pointer is actively grabbed, deliver a grabbed core event */
+ if (mouse->deviceGrab.grab && !mouse->deviceGrab.fromPassiveGrab) {
+ ev.detail.button = event->detail;
+ ev.time = event->time;
+ ev.root_x = event->dx;
+ ev.root_y = event->dy;
+ ev.corestate = event->state;
/* DGA is core only, so valuators.data doesn't actually matter.
* Mask must be set for EventToCore to create motion events. */
SetBit(ev.valuators.mask, 0);
SetBit(ev.valuators.mask, 1);
- DeliverGrabbedEvent ((InternalEvent*)&ev, mouse, FALSE);
- }
+ DeliverGrabbedEvent((InternalEvent *) &ev, mouse, FALSE);
+ }
}
}
Bool
-DGAOpenFramebuffer(
- int index,
- char **name,
- unsigned char **mem,
- int *size,
- int *offset,
- int *flags
-){
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- /* We rely on the extension to check that DGA is available */
-
- return (*pScreenPriv->funcs->OpenFramebuffer)(pScreenPriv->pScrn,
- name, mem, size, offset, flags);
+DGAOpenFramebuffer(int index,
+ char **name,
+ unsigned char **mem, int *size, int *offset, int *flags)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is available */
+
+ return (*pScreenPriv->funcs->OpenFramebuffer) (pScreenPriv->pScrn,
+ name, mem, size, offset,
+ flags);
}
void
DGACloseFramebuffer(int index)
{
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- /* We rely on the extension to check that DGA is available */
- if(pScreenPriv->funcs->CloseFramebuffer)
- (*pScreenPriv->funcs->CloseFramebuffer)(pScreenPriv->pScrn);
+ /* We rely on the extension to check that DGA is available */
+ if (pScreenPriv->funcs->CloseFramebuffer)
+ (*pScreenPriv->funcs->CloseFramebuffer) (pScreenPriv->pScrn);
}
/* For DGA 1.0 backwards compatibility only */
@@ -1156,62 +1112,62 @@ DGACloseFramebuffer(int index)
int
DGAGetOldDGAMode(int index)
{
- DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
- ScrnInfoPtr pScrn = pScreenPriv->pScrn;
- DGAModePtr mode;
- int i, w, h, p;
-
- /* We rely on the extension to check that DGA is available */
-
- w = pScrn->currentMode->HDisplay;
- h = pScrn->currentMode->VDisplay;
- p = pad_to_int32(pScrn->displayWidth * bits_to_bytes(pScrn->bitsPerPixel));
-
- for(i = 0; i < pScreenPriv->numModes; i++) {
- mode = &(pScreenPriv->modes[i]);
-
- if((mode->viewportWidth == w) && (mode->viewportHeight == h) &&
- (mode->bytesPerScanline == p) &&
- (mode->bitsPerPixel == pScrn->bitsPerPixel) &&
- (mode->depth == pScrn->depth)) {
-
- return mode->num;
- }
- }
-
- return 0;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ ScrnInfoPtr pScrn = pScreenPriv->pScrn;
+ DGAModePtr mode;
+ int i, w, h, p;
+
+ /* We rely on the extension to check that DGA is available */
+
+ w = pScrn->currentMode->HDisplay;
+ h = pScrn->currentMode->VDisplay;
+ p = pad_to_int32(pScrn->displayWidth * bits_to_bytes(pScrn->bitsPerPixel));
+
+ for (i = 0; i < pScreenPriv->numModes; i++) {
+ mode = &(pScreenPriv->modes[i]);
+
+ if ((mode->viewportWidth == w) && (mode->viewportHeight == h) &&
+ (mode->bytesPerScanline == p) &&
+ (mode->bitsPerPixel == pScrn->bitsPerPixel) &&
+ (mode->depth == pScrn->depth)) {
+
+ return mode->num;
+ }
+ }
+
+ return 0;
}
static void
DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device)
{
- DGAEvent *event= &ev->dga_event;
- ScreenPtr pScreen = screenInfo.screens[screen_num];
- DGAScreenPtr pScreenPriv;
+ DGAEvent *event = &ev->dga_event;
+ ScreenPtr pScreen = screenInfo.screens[screen_num];
+ DGAScreenPtr pScreenPriv;
/* no DGA */
if (!DGAScreenKeyRegistered || XDGAEventBase == 0)
- return;
+ return;
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
/* DGA not initialized on this screen */
if (!pScreenPriv)
- return;
+ return;
if (!IsMaster(device))
- return;
+ return;
switch (event->subtype) {
case KeyPress:
case KeyRelease:
- DGAProcessKeyboardEvent (pScreen, event, device);
- break;
+ DGAProcessKeyboardEvent(pScreen, event, device);
+ break;
case MotionNotify:
case ButtonPress:
case ButtonRelease:
- DGAProcessPointerEvent (pScreen, event, device);
+ DGAProcessPointerEvent(pScreen, event, device);
break;
default:
- break;
+ break;
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
index 41ffabde3..058057e92 100644
--- a/xorg-server/hw/xfree86/common/xf86Events.c
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -93,15 +93,15 @@
* This has been generalised to work with Linux and *BSD+syscons (DHD)
*/
-Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
- *BSD and for avoiding VT
- switches when using the DRI
- automatic full screen mode.*/
+Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
+ *BSD and for avoiding VT
+ switches when using the DRI
+ automatic full screen mode.*/
extern fd_set EnabledDevices;
#ifdef XF86PM
-extern void (*xf86OSPMClose)(void);
+extern void (*xf86OSPMClose) (void);
#endif
static void xf86VTSwitch(void);
@@ -111,16 +111,15 @@ static void xf86VTSwitch(void);
* Wakeup handler.
*/
typedef struct x_IHRec {
- int fd;
- InputHandlerProc ihproc;
- pointer data;
- Bool enabled;
- struct x_IHRec * next;
+ int fd;
+ InputHandlerProc ihproc;
+ pointer data;
+ Bool enabled;
+ struct x_IHRec *next;
} IHRec, *IHPtr;
static IHPtr InputHandlers = NULL;
-
Bool
LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
@@ -135,10 +134,10 @@ LegalModifier(unsigned int key, DeviceIntPtr pDev)
int
TimeSinceLastInputEvent(void)
{
- if (xf86Info.lastEventTime == 0) {
- xf86Info.lastEventTime = GetTimeInMillis();
- }
- return GetTimeInMillis() - xf86Info.lastEventTime;
+ if (xf86Info.lastEventTime == 0) {
+ xf86Info.lastEventTime = GetTimeInMillis();
+ }
+ return GetTimeInMillis() - xf86Info.lastEventTime;
}
/*
@@ -148,7 +147,7 @@ TimeSinceLastInputEvent(void)
void
SetTimeSinceLastInputEvent(void)
{
- xf86Info.lastEventTime = GetTimeInMillis();
+ xf86Info.lastEventTime = GetTimeInMillis();
}
/*
@@ -158,15 +157,16 @@ SetTimeSinceLastInputEvent(void)
* and keyboard.
*/
void
-ProcessInputEvents (void)
+ProcessInputEvents(void)
{
- int x, y;
+ int x, y;
+
+ mieqProcessInputEvents();
- mieqProcessInputEvents();
+ /* FIXME: This is a problem if we have multiple pointers */
+ miPointerGetPosition(inputInfo.pointer, &x, &y);
- /* FIXME: This is a problem if we have multiple pointers */
- miPointerGetPosition(inputInfo.pointer, &x, &y);
- xf86SetViewport(xf86Info.currentScreen, x, y);
+ xf86SetViewport(xf86Info.currentScreen, x, y);
}
/*
@@ -179,57 +179,57 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
DebugF("ProcessActionEvent(%d,%x)\n", (int) action, arg);
switch (action) {
case ACTION_TERMINATE:
- if (!xf86Info.dontZap) {
+ if (!xf86Info.dontZap) {
#ifdef XFreeXDGA
- DGAShutdown();
+ DGAShutdown();
#endif
- GiveUp(0);
- }
- break;
+ GiveUp(0);
+ }
+ break;
case ACTION_NEXT_MODE:
- if (!xf86Info.dontZoom)
- xf86ZoomViewport(xf86Info.currentScreen, 1);
- break;
+ if (!xf86Info.dontZoom)
+ xf86ZoomViewport(xf86Info.currentScreen, 1);
+ break;
case ACTION_PREV_MODE:
- if (!xf86Info.dontZoom)
- xf86ZoomViewport(xf86Info.currentScreen, -1);
- break;
+ if (!xf86Info.dontZoom)
+ xf86ZoomViewport(xf86Info.currentScreen, -1);
+ break;
case ACTION_SWITCHSCREEN:
- if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
- int vtno = *((int *) arg);
-
- if (vtno != xf86Info.vtno) {
- if (!xf86VTActivate(vtno)) {
- ErrorF("Failed to switch from vt%02d to vt%02d: %s\n",
- xf86Info.vtno, vtno, strerror(errno));
- }
- }
- }
- break;
+ if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
+ int vtno = *((int *) arg);
+
+ if (vtno != xf86Info.vtno) {
+ if (!xf86VTActivate(vtno)) {
+ ErrorF("Failed to switch from vt%02d to vt%02d: %s\n",
+ xf86Info.vtno, vtno, strerror(errno));
+ }
+ }
+ }
+ break;
case ACTION_SWITCHSCREEN_NEXT:
- if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
- if (!xf86VTActivate(xf86Info.vtno + 1)) {
- /* If first try failed, assume this is the last VT and
- * try wrapping around to the first vt.
- */
- if (!xf86VTActivate(1)) {
- ErrorF("Failed to switch from vt%02d to next vt: %s\n",
- xf86Info.vtno, strerror(errno));
- }
- }
- }
- break;
+ if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
+ if (!xf86VTActivate(xf86Info.vtno + 1)) {
+ /* If first try failed, assume this is the last VT and
+ * try wrapping around to the first vt.
+ */
+ if (!xf86VTActivate(1)) {
+ ErrorF("Failed to switch from vt%02d to next vt: %s\n",
+ xf86Info.vtno, strerror(errno));
+ }
+ }
+ }
+ break;
case ACTION_SWITCHSCREEN_PREV:
- if (VTSwitchEnabled && !xf86Info.dontVTSwitch && xf86Info.vtno > 0) {
- if (!xf86VTActivate(xf86Info.vtno - 1)) {
- /* Don't know what the maximum VT is, so can't wrap around */
- ErrorF("Failed to switch from vt%02d to previous vt: %s\n",
- xf86Info.vtno, strerror(errno));
- }
- }
- break;
+ if (VTSwitchEnabled && !xf86Info.dontVTSwitch && xf86Info.vtno > 0) {
+ if (!xf86VTActivate(xf86Info.vtno - 1)) {
+ /* Don't know what the maximum VT is, so can't wrap around */
+ ErrorF("Failed to switch from vt%02d to previous vt: %s\n",
+ xf86Info.vtno, strerror(errno));
+ }
+ }
+ break;
default:
- break;
+ break;
}
}
@@ -242,49 +242,49 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
void
xf86Wakeup(pointer blockData, int err, pointer pReadmask)
{
- fd_set* LastSelectMask = (fd_set*)pReadmask;
+ fd_set *LastSelectMask = (fd_set *) pReadmask;
fd_set devicesWithInput;
InputInfoPtr pInfo;
if (err >= 0) {
- XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
- if (XFD_ANYSET(&devicesWithInput)) {
- pInfo = xf86InputDevs;
- while (pInfo) {
- if (pInfo->read_input && pInfo->fd >= 0 &&
- (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) {
- int sigstate = xf86BlockSIGIO();
-
- /*
- * Remove the descriptior from the set because more than one
- * device may share the same file descriptor.
- */
- FD_CLR(pInfo->fd, &devicesWithInput);
-
- pInfo->read_input(pInfo);
- xf86UnblockSIGIO(sigstate);
- }
- pInfo = pInfo->next;
- }
- }
+ XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
+ if (XFD_ANYSET(&devicesWithInput)) {
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->read_input && pInfo->fd >= 0 &&
+ (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) {
+ int sigstate = xf86BlockSIGIO();
+
+ /*
+ * Remove the descriptior from the set because more than one
+ * device may share the same file descriptor.
+ */
+ FD_CLR(pInfo->fd, &devicesWithInput);
+
+ pInfo->read_input(pInfo);
+ xf86UnblockSIGIO(sigstate);
+ }
+ pInfo = pInfo->next;
+ }
+ }
}
- if (err >= 0) { /* we don't want the handlers called if select() */
- IHPtr ih; /* returned with an error condition, do we? */
-
- for (ih = InputHandlers; ih; ih = ih->next) {
- if (ih->enabled && ih->fd >= 0 && ih->ihproc &&
- (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) {
- ih->ihproc(ih->fd, ih->data);
- }
- }
+ if (err >= 0) { /* we don't want the handlers called if select() */
+ IHPtr ih; /* returned with an error condition, do we? */
+
+ for (ih = InputHandlers; ih; ih = ih->next) {
+ if (ih->enabled && ih->fd >= 0 && ih->ihproc &&
+ (FD_ISSET(ih->fd, ((fd_set *) pReadmask)) != 0)) {
+ ih->ihproc(ih->fd, ih->data);
+ }
+ }
}
- if (xf86VTSwitchPending()) xf86VTSwitch();
+ if (xf86VTSwitchPending())
+ xf86VTSwitch();
}
-
/*
* xf86SigioReadInput --
* signal handler for the SIGIO signal.
@@ -307,8 +307,8 @@ xf86SigioReadInput(int fd, void *closure)
void
xf86AddEnabledDevice(InputInfoPtr pInfo)
{
- if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) {
- AddEnabledDevice(pInfo->fd);
+ if (!xf86InstallSIGIOHandler(pInfo->fd, xf86SigioReadInput, pInfo)) {
+ AddEnabledDevice(pInfo->fd);
}
}
@@ -319,8 +319,8 @@ xf86AddEnabledDevice(InputInfoPtr pInfo)
void
xf86RemoveEnabledDevice(InputInfoPtr pInfo)
{
- if (!xf86RemoveSIGIOHandler (pInfo->fd)) {
- RemoveEnabledDevice(pInfo->fd);
+ if (!xf86RemoveSIGIOHandler(pInfo->fd)) {
+ RemoveEnabledDevice(pInfo->fd);
}
}
@@ -330,13 +330,13 @@ void
xf86InterceptSignals(int *signo)
{
if ((xf86SignalIntercept = signo))
- *signo = -1;
+ *signo = -1;
}
-static void (*xf86SigIllHandler)(void) = NULL;
+static void (*xf86SigIllHandler) (void) = NULL;
void
-xf86InterceptSigIll(void (*sigillhandler)(void))
+xf86InterceptSigIll(void (*sigillhandler) (void))
{
xf86SigIllHandler = sigillhandler;
}
@@ -348,18 +348,18 @@ xf86InterceptSigIll(void (*sigillhandler)(void))
int
xf86SigWrapper(int signo)
{
- if ((signo == SIGILL) && xf86SigIllHandler) {
- (*xf86SigIllHandler)();
- return 0; /* continue */
- }
-
- if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) {
- *xf86SignalIntercept = signo;
- return 0; /* continue */
- }
-
- xf86Info.caughtSignal = TRUE;
- return 1; /* abort */
+ if ((signo == SIGILL) && xf86SigIllHandler) {
+ (*xf86SigIllHandler) ();
+ return 0; /* continue */
+ }
+
+ if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) {
+ *xf86SignalIntercept = signo;
+ return 0; /* continue */
+ }
+
+ xf86Info.caughtSignal = TRUE;
+ return 1; /* abort */
}
/*
@@ -395,10 +395,9 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
*/
for (i = keyc->xkbInfo->desc->min_key_code;
- i < keyc->xkbInfo->desc->max_key_code;
- i++) {
+ i < keyc->xkbInfo->desc->max_key_code; i++) {
if (key_is_down(pDev, i, KEY_POSTED)) {
- sigstate = xf86BlockSIGIO ();
+ sigstate = xf86BlockSIGIO();
QueueKeyboardEvents(pDev, KeyRelease, i, NULL);
xf86UnblockSIGIO(sigstate);
}
@@ -412,142 +411,144 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
static void
xf86VTSwitch(void)
{
- int i;
- static int prevSIGIO;
- InputInfoPtr pInfo;
- IHPtr ih;
+ int i;
+ static int prevSIGIO;
+ InputInfoPtr pInfo;
+ IHPtr ih;
- DebugF("xf86VTSwitch()\n");
+ DebugF("xf86VTSwitch()\n");
#ifdef XFreeXDGA
- if(!DGAVTSwitch())
- return;
+ if (!DGAVTSwitch())
+ return;
#endif
- /*
- * Since all screens are currently all in the same state it is sufficient
- * check the first. This might change in future.
- */
- if (xf86Screens[0]->vtSema) {
+ /*
+ * Since all screens are currently all in the same state it is sufficient
+ * check the first. This might change in future.
+ */
+ if (xf86Screens[0]->vtSema) {
- DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
- BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
+ DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
+ BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
#ifdef DPMSExtension
- if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(serverClient, DPMSModeOn);
+ if (DPMSPowerLevel != DPMSModeOn)
+ DPMSSet(serverClient, DPMSModeOn);
#endif
- for (i = 0; i < xf86NumScreens; i++) {
- if (!(dispatchException & DE_TERMINATE))
- if (xf86Screens[i]->EnableDisableFBAccess)
- (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
- }
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (!(dispatchException & DE_TERMINATE))
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
+ }
- /*
- * Keep the order: Disable Device > LeaveVT
- * EnterVT > EnableDevice
- */
- for (ih = InputHandlers; ih; ih = ih->next)
- xf86DisableInputHandler(ih);
- for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
- if (pInfo->dev) {
- xf86ReleaseKeys(pInfo->dev);
- ProcessInputEvents();
- DisableDevice(pInfo->dev, TRUE);
- }
- }
+ /*
+ * Keep the order: Disable Device > LeaveVT
+ * EnterVT > EnableDevice
+ */
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86DisableInputHandler(ih);
+ for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
+ if (pInfo->dev) {
+ xf86ReleaseKeys(pInfo->dev);
+ ProcessInputEvents();
+ DisableDevice(pInfo->dev, TRUE);
+ }
+ }
+
+ prevSIGIO = xf86BlockSIGIO();
+ for (i = 0; i < xf86NumScreens; i++)
+ xf86Screens[i]->LeaveVT(i, 0);
+
+ xf86AccessLeave(); /* We need this here, otherwise */
+
+ if (!xf86VTSwitchAway()) {
+ /*
+ * switch failed
+ */
+
+ DebugF("xf86VTSwitch: Leave failed\n");
+ xf86AccessEnter();
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (!xf86Screens[i]->EnterVT(i, 0))
+ FatalError("EnterVT failed for screen %d\n", i);
+ }
+ if (!(dispatchException & DE_TERMINATE)) {
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
+ }
+ }
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->dev)
+ EnableDevice(pInfo->dev, TRUE);
+ pInfo = pInfo->next;
+ }
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86EnableInputHandler(ih);
+
+ xf86UnblockSIGIO(prevSIGIO);
- prevSIGIO = xf86BlockSIGIO();
- for (i = 0; i < xf86NumScreens; i++)
- xf86Screens[i]->LeaveVT(i, 0);
-
- xf86AccessLeave(); /* We need this here, otherwise */
-
- if (!xf86VTSwitchAway()) {
- /*
- * switch failed
- */
-
- DebugF("xf86VTSwitch: Leave failed\n");
- xf86AccessEnter();
- for (i = 0; i < xf86NumScreens; i++) {
- if (!xf86Screens[i]->EnterVT(i, 0))
- FatalError("EnterVT failed for screen %d\n", i);
- }
- if (!(dispatchException & DE_TERMINATE)) {
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->EnableDisableFBAccess)
- (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
- }
- }
- dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
-
- pInfo = xf86InputDevs;
- while (pInfo) {
- if (pInfo->dev)
- EnableDevice(pInfo->dev, TRUE);
- pInfo = pInfo->next;
- }
- for (ih = InputHandlers; ih; ih = ih->next)
- xf86EnableInputHandler(ih);
-
- xf86UnblockSIGIO(prevSIGIO);
-
- } else {
+ }
+ else {
#ifdef XF86PM
- if (xf86OSPMClose)
- xf86OSPMClose();
- xf86OSPMClose = NULL;
+ if (xf86OSPMClose)
+ xf86OSPMClose();
+ xf86OSPMClose = NULL;
#endif
- for (i = 0; i < xf86NumScreens; i++) {
- /*
- * zero all access functions to
- * trap calls when switched away.
- */
- xf86Screens[i]->vtSema = FALSE;
- }
- if (xorgHWAccess)
- xf86DisableIO();
+ for (i = 0; i < xf86NumScreens; i++) {
+ /*
+ * zero all access functions to
+ * trap calls when switched away.
+ */
+ xf86Screens[i]->vtSema = FALSE;
+ }
+ if (xorgHWAccess)
+ xf86DisableIO();
+ }
}
- } else {
- DebugF("xf86VTSwitch: Entering\n");
- if (!xf86VTSwitchTo()) return;
+ else {
+ DebugF("xf86VTSwitch: Entering\n");
+ if (!xf86VTSwitchTo())
+ return;
#ifdef XF86PM
- xf86OSPMClose = xf86OSPMOpen();
+ xf86OSPMClose = xf86OSPMOpen();
#endif
- if (xorgHWAccess)
- xf86EnableIO();
- xf86AccessEnter();
- for (i = 0; i < xf86NumScreens; i++) {
- xf86Screens[i]->vtSema = TRUE;
- if (!xf86Screens[i]->EnterVT(i, 0))
- FatalError("EnterVT failed for screen %d\n", i);
- }
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->EnableDisableFBAccess)
- (*xf86Screens[i]->EnableDisableFBAccess)(i, TRUE);
- }
+ if (xorgHWAccess)
+ xf86EnableIO();
+ xf86AccessEnter();
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->vtSema = TRUE;
+ if (!xf86Screens[i]->EnterVT(i, 0))
+ FatalError("EnterVT failed for screen %d\n", i);
+ }
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
+ }
- /* Turn screen saver off when switching back */
- dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ /* Turn screen saver off when switching back */
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
- pInfo = xf86InputDevs;
- while (pInfo) {
- if (pInfo->dev)
- EnableDevice(pInfo->dev, TRUE);
- pInfo = pInfo->next;
- }
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->dev)
+ EnableDevice(pInfo->dev, TRUE);
+ pInfo = pInfo->next;
+ }
- for (ih = InputHandlers; ih; ih = ih->next)
- xf86EnableInputHandler(ih);
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86EnableInputHandler(ih);
- xf86UnblockSIGIO(prevSIGIO);
- }
+ xf86UnblockSIGIO(prevSIGIO);
+ }
}
-
/* Input handler registration */
static pointer
@@ -556,11 +557,11 @@ addInputHandler(int fd, InputHandlerProc proc, pointer data)
IHPtr ih;
if (fd < 0 || !proc)
- return NULL;
+ return NULL;
ih = calloc(sizeof(*ih), 1);
if (!ih)
- return NULL;
+ return NULL;
ih->fd = fd;
ih->ihproc = proc;
@@ -618,13 +619,13 @@ removeInputHandler(IHPtr ih)
IHPtr p;
if (ih == InputHandlers)
- InputHandlers = ih->next;
+ InputHandlers = ih->next;
else {
- p = InputHandlers;
- while (p && p->next != ih)
- p = p->next;
- if (ih)
- p->next = ih->next;
+ p = InputHandlers;
+ while (p && p->next != ih)
+ p = p->next;
+ if (ih)
+ p->next = ih->next;
}
free(ih);
}
@@ -636,13 +637,13 @@ xf86RemoveInputHandler(pointer handler)
int fd;
if (!handler)
- return -1;
+ return -1;
ih = handler;
fd = ih->fd;
if (ih->fd >= 0)
- RemoveEnabledDevice(ih->fd);
+ RemoveEnabledDevice(ih->fd);
removeInputHandler(ih);
return fd;
@@ -655,13 +656,13 @@ xf86RemoveGeneralHandler(pointer handler)
int fd;
if (!handler)
- return -1;
+ return -1;
ih = handler;
fd = ih->fd;
if (ih->fd >= 0)
- RemoveGeneralSocket(ih->fd);
+ RemoveGeneralSocket(ih->fd);
removeInputHandler(ih);
return fd;
@@ -673,12 +674,12 @@ xf86DisableInputHandler(pointer handler)
IHPtr ih;
if (!handler)
- return;
+ return;
ih = handler;
ih->enabled = FALSE;
if (ih->fd >= 0)
- RemoveEnabledDevice(ih->fd);
+ RemoveEnabledDevice(ih->fd);
}
void
@@ -687,12 +688,12 @@ xf86DisableGeneralHandler(pointer handler)
IHPtr ih;
if (!handler)
- return;
+ return;
ih = handler;
ih->enabled = FALSE;
if (ih->fd >= 0)
- RemoveGeneralSocket(ih->fd);
+ RemoveGeneralSocket(ih->fd);
}
void
@@ -701,12 +702,12 @@ xf86EnableInputHandler(pointer handler)
IHPtr ih;
if (!handler)
- return;
+ return;
ih = handler;
ih->enabled = TRUE;
if (ih->fd >= 0)
- AddEnabledDevice(ih->fd);
+ AddEnabledDevice(ih->fd);
}
void
@@ -715,12 +716,12 @@ xf86EnableGeneralHandler(pointer handler)
IHPtr ih;
if (!handler)
- return;
+ return;
ih = handler;
ih->enabled = TRUE;
if (ih->fd >= 0)
- AddGeneralSocket(ih->fd);
+ AddGeneralSocket(ih->fd);
}
/*
@@ -734,17 +735,19 @@ xf86EnableVTSwitch(Bool new)
old = VTSwitchEnabled;
if (!new) {
- /* Disable VT switching */
- def = VTSwitchEnabled;
- VTSwitchEnabled = FALSE;
- } else {
- /* Restore VT switching to default */
- VTSwitchEnabled = def;
+ /* Disable VT switching */
+ def = VTSwitchEnabled;
+ VTSwitchEnabled = FALSE;
+ }
+ else {
+ /* Restore VT switching to default */
+ VTSwitchEnabled = def;
}
return old;
}
void
-DDXRingBell(int volume, int pitch, int duration) {
+DDXRingBell(int volume, int pitch, int duration)
+{
xf86OSRingBell(volume, pitch, duration);
}
diff --git a/xorg-server/hw/xfree86/common/xf86Globals.c b/xorg-server/hw/xfree86/common/xf86Globals.c
index d576fb915..0071004eb 100644
--- a/xorg-server/hw/xfree86/common/xf86Globals.c
+++ b/xorg-server/hw/xfree86/common/xf86Globals.c
@@ -50,9 +50,9 @@
DevPrivateKeyRec xf86CreateRootWindowKeyRec;
DevPrivateKeyRec xf86ScreenKeyRec;
-ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
-const unsigned char byte_reversed[256] =
-{
+ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
+
+const unsigned char byte_reversed[256] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
@@ -90,49 +90,49 @@ const unsigned char byte_reversed[256] =
/* Globals that input drivers may access */
InputInfoPtr xf86InputDevs = NULL;
-
/* Globals that video drivers may not access */
xf86InfoRec xf86Info = {
- .consoleFd = -1,
- .vtno = -1,
- .lastEventTime = -1,
- .vtRequestsPending = FALSE,
+ .consoleFd = -1,
+ .vtno = -1,
+ .lastEventTime = -1,
+ .vtRequestsPending = FALSE,
#ifdef sun
- .vtPendingNum = -1,
+ .vtPendingNum = -1,
#endif
- .dontVTSwitch = FALSE,
- .autoVTSwitch = TRUE,
- .ShareVTs = FALSE,
- .dontZap = FALSE,
- .dontZoom = FALSE,
- .notrapSignals = FALSE,
- .caughtSignal = FALSE,
- .currentScreen = NULL,
+ .dontVTSwitch = FALSE,
+ .autoVTSwitch = TRUE,
+ .ShareVTs = FALSE,
+ .dontZap = FALSE,
+ .dontZoom = FALSE,
+ .notrapSignals = FALSE,
+ .caughtSignal = FALSE,
+ .currentScreen = NULL,
#ifdef CSRG_BASED
- .consType = -1,
+ .consType = -1,
#endif
- .allowMouseOpenFail = FALSE,
- .vidModeEnabled = TRUE,
- .vidModeAllowNonLocal = FALSE,
- .miscModInDevEnabled = TRUE,
- .miscModInDevAllowNonLocal = FALSE,
- .pixmap24 = Pix24DontCare,
- .pix24From = X_DEFAULT,
- .pmFlag = TRUE,
- .log = LogNone,
- .disableRandR = FALSE,
- .randRFrom = X_DEFAULT,
+ .allowMouseOpenFail = FALSE,
+ .vidModeEnabled = TRUE,
+ .vidModeAllowNonLocal = FALSE,
+ .miscModInDevEnabled = TRUE,
+ .miscModInDevAllowNonLocal = FALSE,
+ .pixmap24 = Pix24DontCare,
+ .pix24From = X_DEFAULT,
+ .pmFlag = TRUE,
+ .log = LogNone,
+ .disableRandR = FALSE,
+ .randRFrom = X_DEFAULT,
#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
- .forceInputDevices = FALSE,
- .autoAddDevices = TRUE,
- .autoEnableDevices = TRUE
+ .forceInputDevices = FALSE,
+ .autoAddDevices = TRUE,
+ .autoEnableDevices = TRUE
#else
- .forceInputDevices = TRUE,
- .autoAddDevices = FALSE,
- .autoEnableDevices = FALSE
+ .forceInputDevices = TRUE,
+ .autoAddDevices = FALSE,
+ .autoEnableDevices = FALSE
#endif
};
+
const char *xf86ConfigFile = NULL;
const char *xf86ConfigDir = NULL;
const char *xf86ModulePath = DEFAULT_MODULE_PATH;
@@ -140,8 +140,9 @@ MessageType xf86ModPathFrom = X_DEFAULT;
const char *xf86LogFile = DEFAULT_LOGPREFIX;
MessageType xf86LogFileFrom = X_DEFAULT;
Bool xf86LogFileWasOpened = FALSE;
-serverLayoutRec xf86ConfigLayout = {NULL, };
-confDRIRec xf86ConfigDRI = {0, };
+serverLayoutRec xf86ConfigLayout = { NULL, };
+confDRIRec xf86ConfigDRI = { 0, };
+
XF86ConfigPtr xf86configptr = NULL;
Bool xf86Resetting = FALSE;
Bool xf86Initialising = FALSE;
@@ -154,12 +155,12 @@ int xf86NumInputDrivers = 0;
int xf86NumScreens = 0;
const char *xf86VisualNames[] = {
- "StaticGray",
- "GrayScale",
- "StaticColor",
- "PseudoColor",
- "TrueColor",
- "DirectColor"
+ "StaticGray",
+ "GrayScale",
+ "StaticColor",
+ "PseudoColor",
+ "TrueColor",
+ "DirectColor"
};
/* Parameters set only from the command line */
@@ -170,6 +171,7 @@ Bool xf86bsEnableFlag = FALSE;
Bool xf86bsDisableFlag = FALSE;
Bool xf86silkenMouseDisableFlag = FALSE;
Bool xf86xkbdirFlag = FALSE;
+
#ifdef HAVE_ACPI
Bool xf86acpiDisableFlag = FALSE;
#endif
@@ -182,10 +184,13 @@ int xf86LogVerbose = DEFAULT_LOG_VERBOSE;
int xf86FbBpp = -1;
Pix24Flags xf86Pix24 = Pix24DontCare;
int xf86Depth = -1;
-rgb xf86Weight = {0, 0, 0};
+rgb xf86Weight = { 0, 0, 0 };
+
Bool xf86FlipPixels = FALSE;
-Gamma xf86Gamma = {0.0, 0.0, 0.0};
+Gamma xf86Gamma = { 0.0, 0.0, 0.0 };
+
Bool xf86AllowMouseOpenFail = FALSE;
+
#ifdef XF86VIDMODE
Bool xf86VidModeDisabled = FALSE;
Bool xf86VidModeAllowNonLocal = FALSE;
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index 248ccf47e..8c948cf6f 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -64,7 +64,6 @@
static int xf86ScrnInfoPrivateCount = 0;
-
/* Add a pointer to a new DriverRec to xf86DriverList */
void
@@ -72,22 +71,21 @@ xf86AddDriver(DriverPtr driver, pointer module, int flags)
{
/* Don't add null entries */
if (!driver)
- return;
+ return;
if (xf86DriverList == NULL)
- xf86NumDrivers = 0;
+ xf86NumDrivers = 0;
xf86NumDrivers++;
xf86DriverList = xnfrealloc(xf86DriverList,
- xf86NumDrivers * sizeof(DriverPtr));
+ xf86NumDrivers * sizeof(DriverPtr));
xf86DriverList[xf86NumDrivers - 1] = xnfalloc(sizeof(DriverRec));
if (flags & HaveDriverFuncs)
- *xf86DriverList[xf86NumDrivers - 1] = *driver;
+ *xf86DriverList[xf86NumDrivers - 1] = *driver;
else {
- (void) memset( xf86DriverList[xf86NumDrivers - 1], 0,
- sizeof( DriverRec ) );
- (void) memcpy( xf86DriverList[xf86NumDrivers - 1], driver,
- sizeof(DriverRec1));
+ (void) memset(xf86DriverList[xf86NumDrivers - 1], 0, sizeof(DriverRec));
+ (void) memcpy(xf86DriverList[xf86NumDrivers - 1], driver,
+ sizeof(DriverRec1));
}
xf86DriverList[xf86NumDrivers - 1]->module = module;
@@ -98,11 +96,11 @@ void
xf86DeleteDriver(int drvIndex)
{
if (xf86DriverList[drvIndex]
- && (!xf86DriverHasEntities(xf86DriverList[drvIndex]))) {
- if (xf86DriverList[drvIndex]->module)
- UnloadModule(xf86DriverList[drvIndex]->module);
- free(xf86DriverList[drvIndex]);
- xf86DriverList[drvIndex] = NULL;
+ && (!xf86DriverHasEntities(xf86DriverList[drvIndex]))) {
+ if (xf86DriverList[drvIndex]->module)
+ UnloadModule(xf86DriverList[drvIndex]->module);
+ free(xf86DriverList[drvIndex]);
+ xf86DriverList[drvIndex] = NULL;
}
}
@@ -113,16 +111,17 @@ xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags)
{
/* Don't add null entries */
if (!driver)
- return;
+ return;
if (xf86InputDriverList == NULL)
- xf86NumInputDrivers = 0;
+ xf86NumInputDrivers = 0;
xf86NumInputDrivers++;
xf86InputDriverList = xnfrealloc(xf86InputDriverList,
- xf86NumInputDrivers * sizeof(InputDriverPtr));
+ xf86NumInputDrivers *
+ sizeof(InputDriverPtr));
xf86InputDriverList[xf86NumInputDrivers - 1] =
- xnfalloc(sizeof(InputDriverRec));
+ xnfalloc(sizeof(InputDriverRec));
*xf86InputDriverList[xf86NumInputDrivers - 1] = *driver;
xf86InputDriverList[xf86NumInputDrivers - 1]->module = module;
}
@@ -131,7 +130,7 @@ void
xf86DeleteInputDriver(int drvIndex)
{
if (xf86InputDriverList[drvIndex] && xf86InputDriverList[drvIndex]->module)
- UnloadModule(xf86InputDriverList[drvIndex]->module);
+ UnloadModule(xf86InputDriverList[drvIndex]->module);
free(xf86InputDriverList[drvIndex]);
xf86InputDriverList[drvIndex] = NULL;
}
@@ -142,9 +141,9 @@ xf86LookupInputDriver(const char *name)
int i;
for (i = 0; i < xf86NumInputDrivers; i++) {
- if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
- xf86NameCmp(name, xf86InputDriverList[i]->driverName) == 0)
- return xf86InputDriverList[i];
+ if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
+ xf86NameCmp(name, xf86InputDriverList[i]->driverName) == 0)
+ return xf86InputDriverList[i];
}
return NULL;
}
@@ -170,15 +169,15 @@ xf86AllocateScreen(DriverPtr drv, int flags)
int i;
if (xf86Screens == NULL)
- xf86NumScreens = 0;
+ xf86NumScreens = 0;
i = xf86NumScreens++;
xf86Screens = xnfrealloc(xf86Screens, xf86NumScreens * sizeof(ScrnInfoPtr));
xf86Screens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1);
- xf86Screens[i]->scrnIndex = i; /* Changes when a screen is removed */
- xf86Screens[i]->origIndex = i; /* This never changes */
+ xf86Screens[i]->scrnIndex = i; /* Changes when a screen is removed */
+ xf86Screens[i]->origIndex = i; /* This never changes */
xf86Screens[i]->privates = xnfcalloc(sizeof(DevUnion),
- xf86ScrnInfoPrivateCount);
+ xf86ScrnInfoPrivateCount);
/*
* EnableDisableFBAccess now gets initialized in InitOutput()
* xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
@@ -193,7 +192,6 @@ xf86AllocateScreen(DriverPtr drv, int flags)
return xf86Screens[i];
}
-
/*
* Remove an entry from xf86Screens. Ideally it should free all allocated
* data. To do this properly may require a driver hook.
@@ -207,31 +205,31 @@ xf86DeleteScreen(int scrnIndex, int flags)
/* First check if the screen is valid */
if (xf86NumScreens == 0 || xf86Screens == NULL)
- return;
+ return;
if (scrnIndex > xf86NumScreens - 1)
- return;
+ return;
if (!(pScrn = xf86Screens[scrnIndex]))
- return;
+ return;
/* If a FreeScreen function is defined, call it here */
if (pScrn->FreeScreen != NULL)
- pScrn->FreeScreen(scrnIndex, 0);
+ pScrn->FreeScreen(scrnIndex, 0);
while (pScrn->modes)
- xf86DeleteMode(&pScrn->modes, pScrn->modes);
+ xf86DeleteMode(&pScrn->modes, pScrn->modes);
while (pScrn->modePool)
- xf86DeleteMode(&pScrn->modePool, pScrn->modePool);
+ xf86DeleteMode(&pScrn->modePool, pScrn->modePool);
xf86OptionListFree(pScrn->options);
if (pScrn->module)
- UnloadModule(pScrn->module);
+ UnloadModule(pScrn->module);
if (pScrn->drv)
- pScrn->drv->refCount--;
+ pScrn->drv->refCount--;
free(pScrn->privates);
@@ -244,9 +242,9 @@ xf86DeleteScreen(int scrnIndex, int flags)
xf86NumScreens--;
for (i = scrnIndex; i < xf86NumScreens; i++) {
- xf86Screens[i] = xf86Screens[i + 1];
- xf86Screens[i]->scrnIndex = i;
- /* Also need to take care of the screen layout settings */
+ xf86Screens[i] = xf86Screens[i + 1];
+ xf86Screens[i]->scrnIndex = i;
+ /* Also need to take care of the screen layout settings */
}
}
@@ -263,12 +261,12 @@ xf86AllocateScrnInfoPrivateIndex(void)
idx = xf86ScrnInfoPrivateCount++;
for (i = 0; i < xf86NumScreens; i++) {
- pScr = xf86Screens[i];
- nprivs = xnfrealloc(pScr->privates,
- xf86ScrnInfoPrivateCount * sizeof(DevUnion));
- /* Zero the new private */
- memset(&nprivs[idx], 0, sizeof(DevUnion));
- pScr->privates = nprivs;
+ pScr = xf86Screens[i];
+ nprivs = xnfrealloc(pScr->privates,
+ xf86ScrnInfoPrivateCount * sizeof(DevUnion));
+ /* Zero the new private */
+ memset(&nprivs[idx], 0, sizeof(DevUnion));
+ pScr->privates = nprivs;
}
return idx;
}
@@ -279,22 +277,22 @@ xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
int i;
if (pScrn->numFormats >= MAXFORMATS)
- return FALSE;
+ return FALSE;
if (bpp <= 0) {
- if (depth == 1)
- bpp = 1;
- else if (depth <= 8)
- bpp = 8;
- else if (depth <= 16)
- bpp = 16;
- else if (depth <= 32)
- bpp = 32;
- else
- return FALSE;
+ if (depth == 1)
+ bpp = 1;
+ else if (depth <= 8)
+ bpp = 8;
+ else if (depth <= 16)
+ bpp = 16;
+ else if (depth <= 32)
+ bpp = 32;
+ else
+ return FALSE;
}
if (pad <= 0)
- pad = BITMAP_SCANLINE_PAD;
+ pad = BITMAP_SCANLINE_PAD;
i = pScrn->numFormats++;
pScrn->formats[i].depth = depth;
@@ -346,7 +344,7 @@ xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
Bool
xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
- int depth24flags)
+ int depth24flags)
{
int i;
DispPtr disp;
@@ -360,174 +358,182 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
scrp->depthFrom = X_DEFAULT;
if (xf86FbBpp > 0) {
- scrp->bitsPerPixel = xf86FbBpp;
- scrp->bitsPerPixelFrom = X_CMDLINE;
+ scrp->bitsPerPixel = xf86FbBpp;
+ scrp->bitsPerPixelFrom = X_CMDLINE;
}
if (xf86Depth > 0) {
- scrp->depth = xf86Depth;
- scrp->depthFrom = X_CMDLINE;
+ scrp->depth = xf86Depth;
+ scrp->depthFrom = X_CMDLINE;
}
if (xf86FbBpp < 0 && xf86Depth < 0) {
- if (scrp->confScreen->defaultfbbpp > 0) {
- scrp->bitsPerPixel = scrp->confScreen->defaultfbbpp;
- scrp->bitsPerPixelFrom = X_CONFIG;
- }
- if (scrp->confScreen->defaultdepth > 0) {
- scrp->depth = scrp->confScreen->defaultdepth;
- scrp->depthFrom = X_CONFIG;
- }
-
- if (scrp->confScreen->defaultfbbpp <= 0 &&
- scrp->confScreen->defaultdepth <= 0) {
- /*
- * Check for DefaultDepth and DefaultFbBpp options in the
- * Device sections.
- */
- int i;
- GDevPtr device;
- Bool found = FALSE;
-
- for (i = 0; i < scrp->numEntities; i++) {
- device = xf86GetDevFromEntity(scrp->entityList[i],
- scrp->entityInstanceList[i]);
- if (device && device->options) {
- if (xf86FindOption(device->options, "DefaultDepth")) {
- scrp->depth = xf86SetIntOption(device->options,
- "DefaultDepth", -1);
- scrp->depthFrom = X_CONFIG;
- found = TRUE;
- }
- if (xf86FindOption(device->options, "DefaultFbBpp")) {
- scrp->bitsPerPixel = xf86SetIntOption(device->options,
- "DefaultFbBpp",
- -1);
- scrp->bitsPerPixelFrom = X_CONFIG;
- found = TRUE;
- }
- }
- if (found)
- break;
- }
- }
+ if (scrp->confScreen->defaultfbbpp > 0) {
+ scrp->bitsPerPixel = scrp->confScreen->defaultfbbpp;
+ scrp->bitsPerPixelFrom = X_CONFIG;
+ }
+ if (scrp->confScreen->defaultdepth > 0) {
+ scrp->depth = scrp->confScreen->defaultdepth;
+ scrp->depthFrom = X_CONFIG;
+ }
+
+ if (scrp->confScreen->defaultfbbpp <= 0 &&
+ scrp->confScreen->defaultdepth <= 0) {
+ /*
+ * Check for DefaultDepth and DefaultFbBpp options in the
+ * Device sections.
+ */
+ int i;
+ GDevPtr device;
+ Bool found = FALSE;
+
+ for (i = 0; i < scrp->numEntities; i++) {
+ device = xf86GetDevFromEntity(scrp->entityList[i],
+ scrp->entityInstanceList[i]);
+ if (device && device->options) {
+ if (xf86FindOption(device->options, "DefaultDepth")) {
+ scrp->depth = xf86SetIntOption(device->options,
+ "DefaultDepth", -1);
+ scrp->depthFrom = X_CONFIG;
+ found = TRUE;
+ }
+ if (xf86FindOption(device->options, "DefaultFbBpp")) {
+ scrp->bitsPerPixel = xf86SetIntOption(device->options,
+ "DefaultFbBpp",
+ -1);
+ scrp->bitsPerPixelFrom = X_CONFIG;
+ found = TRUE;
+ }
+ }
+ if (found)
+ break;
+ }
+ }
}
/* If none of these is set, pick a default */
if (scrp->bitsPerPixel < 0 && scrp->depth < 0) {
if (fbbpp > 0 || depth > 0) {
- if (fbbpp > 0)
- scrp->bitsPerPixel = fbbpp;
- if (depth > 0)
- scrp->depth = depth;
- } else {
- scrp->depth = GLOBAL_DEFAULT_DEPTH;
- }
+ if (fbbpp > 0)
+ scrp->bitsPerPixel = fbbpp;
+ if (depth > 0)
+ scrp->depth = depth;
+ }
+ else {
+ scrp->depth = GLOBAL_DEFAULT_DEPTH;
+ }
}
/* If any are not given, determine a default for the others */
if (scrp->bitsPerPixel < 0) {
- /* The depth must be set */
- if (scrp->depth > -1) {
- if (scrp->depth == 1)
- scrp->bitsPerPixel = 1;
- else if (scrp->depth <= 4)
- scrp->bitsPerPixel = 4;
- else if (scrp->depth <= 8)
- scrp->bitsPerPixel = 8;
- else if (scrp->depth <= 16)
- scrp->bitsPerPixel = 16;
- else if (scrp->depth <= 24) {
- /*
- * Figure out if a choice is possible based on the depth24
- * and pix24 flags.
- */
- /* Check pix24 first */
- if (pix24 != Pix24DontCare) {
- if (pix24 == Pix24Use32) {
- if (DO_PIX32(depth24flags)) {
- if (CHOOSE24FOR32(depth24flags))
- scrp->bitsPerPixel = 24;
- else
- scrp->bitsPerPixel = 32;
- } else {
- nomatch = TRUE;
- }
- } else if (pix24 == Pix24Use24) {
- if (DO_PIX24(depth24flags)) {
- if (CHOOSE32FOR24(depth24flags))
- scrp->bitsPerPixel = 32;
- else
- scrp->bitsPerPixel = 24;
- } else {
- nomatch = TRUE;
- }
- }
- } else {
- if (DO_PIX32(depth24flags)) {
- if (CHOOSE24FOR32(depth24flags))
- scrp->bitsPerPixel = 24;
- else
- scrp->bitsPerPixel = 32;
- } else if (DO_PIX24(depth24flags)) {
- if (CHOOSE32FOR24(depth24flags))
- scrp->bitsPerPixel = 32;
- else
- scrp->bitsPerPixel = 24;
- }
- }
- } else if (scrp->depth <= 32)
- scrp->bitsPerPixel = 32;
- else {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Specified depth (%d) is greater than 32\n",
- scrp->depth);
- return FALSE;
- }
- } else {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "xf86SetDepthBpp: internal error: depth and fbbpp"
- " are both not set\n");
- return FALSE;
- }
- if (scrp->bitsPerPixel < 0) {
- if (nomatch)
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Driver can't support depth 24 pixmap format (%d)\n",
- PIX24TOBPP(pix24));
- else if ((depth24flags & (Support24bppFb | Support32bppFb)) ==
- NoDepth24Support)
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Driver can't support depth 24\n");
- else
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Can't find fbbpp for depth 24\n");
- return FALSE;
- }
- scrp->bitsPerPixelFrom = X_PROBED;
+ /* The depth must be set */
+ if (scrp->depth > -1) {
+ if (scrp->depth == 1)
+ scrp->bitsPerPixel = 1;
+ else if (scrp->depth <= 4)
+ scrp->bitsPerPixel = 4;
+ else if (scrp->depth <= 8)
+ scrp->bitsPerPixel = 8;
+ else if (scrp->depth <= 16)
+ scrp->bitsPerPixel = 16;
+ else if (scrp->depth <= 24) {
+ /*
+ * Figure out if a choice is possible based on the depth24
+ * and pix24 flags.
+ */
+ /* Check pix24 first */
+ if (pix24 != Pix24DontCare) {
+ if (pix24 == Pix24Use32) {
+ if (DO_PIX32(depth24flags)) {
+ if (CHOOSE24FOR32(depth24flags))
+ scrp->bitsPerPixel = 24;
+ else
+ scrp->bitsPerPixel = 32;
+ }
+ else {
+ nomatch = TRUE;
+ }
+ }
+ else if (pix24 == Pix24Use24) {
+ if (DO_PIX24(depth24flags)) {
+ if (CHOOSE32FOR24(depth24flags))
+ scrp->bitsPerPixel = 32;
+ else
+ scrp->bitsPerPixel = 24;
+ }
+ else {
+ nomatch = TRUE;
+ }
+ }
+ }
+ else {
+ if (DO_PIX32(depth24flags)) {
+ if (CHOOSE24FOR32(depth24flags))
+ scrp->bitsPerPixel = 24;
+ else
+ scrp->bitsPerPixel = 32;
+ }
+ else if (DO_PIX24(depth24flags)) {
+ if (CHOOSE32FOR24(depth24flags))
+ scrp->bitsPerPixel = 32;
+ else
+ scrp->bitsPerPixel = 24;
+ }
+ }
+ }
+ else if (scrp->depth <= 32)
+ scrp->bitsPerPixel = 32;
+ else {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is greater than 32\n",
+ scrp->depth);
+ return FALSE;
+ }
+ }
+ else {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "xf86SetDepthBpp: internal error: depth and fbbpp"
+ " are both not set\n");
+ return FALSE;
+ }
+ if (scrp->bitsPerPixel < 0) {
+ if (nomatch)
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Driver can't support depth 24 pixmap format (%d)\n",
+ PIX24TOBPP(pix24));
+ else if ((depth24flags & (Support24bppFb | Support32bppFb)) ==
+ NoDepth24Support)
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Driver can't support depth 24\n");
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Can't find fbbpp for depth 24\n");
+ return FALSE;
+ }
+ scrp->bitsPerPixelFrom = X_PROBED;
}
if (scrp->depth <= 0) {
- /* bitsPerPixel is already set */
- switch (scrp->bitsPerPixel) {
- case 32:
- scrp->depth = 24;
- break;
- default:
- /* 1, 4, 8, 16 and 24 */
- scrp->depth = scrp->bitsPerPixel;
- break;
- }
- scrp->depthFrom = X_PROBED;
+ /* bitsPerPixel is already set */
+ switch (scrp->bitsPerPixel) {
+ case 32:
+ scrp->depth = 24;
+ break;
+ default:
+ /* 1, 4, 8, 16 and 24 */
+ scrp->depth = scrp->bitsPerPixel;
+ break;
+ }
+ scrp->depthFrom = X_PROBED;
}
/* Sanity checks */
if (scrp->depth < 1 || scrp->depth > 32) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Specified depth (%d) is not in the range 1-32\n",
- scrp->depth);
- return FALSE;
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is not in the range 1-32\n",
+ scrp->depth);
+ return FALSE;
}
switch (scrp->bitsPerPixel) {
case 1:
@@ -536,26 +542,26 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
case 16:
case 24:
case 32:
- break;
+ break;
default:
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Specified fbbpp (%d) is not a permitted value\n",
- scrp->bitsPerPixel);
- return FALSE;
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified fbbpp (%d) is not a permitted value\n",
+ scrp->bitsPerPixel);
+ return FALSE;
}
if (scrp->depth > scrp->bitsPerPixel) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Specified depth (%d) is greater than the fbbpp (%d)\n",
- scrp->depth, scrp->bitsPerPixel);
- return FALSE;
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is greater than the fbbpp (%d)\n",
+ scrp->depth, scrp->bitsPerPixel);
+ return FALSE;
}
/* set scrp->pixmap24 if the driver isn't flexible */
if (scrp->bitsPerPixel == 24 && !DO_PIX32FOR24(depth24flags)) {
- scrp->pixmap24 = Pix24Use24;
+ scrp->pixmap24 = Pix24Use24;
}
if (scrp->bitsPerPixel == 32 && !DO_PIX24FOR32(depth24flags)) {
- scrp->pixmap24 = Pix24Use32;
+ scrp->pixmap24 = Pix24Use32;
}
/*
@@ -563,13 +569,13 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
* scrp->display with it.
*/
for (i = 0, disp = scrp->confScreen->displays;
- i < scrp->confScreen->numdisplays; i++, disp++) {
- if ((disp->depth == scrp->depth && disp->fbbpp == scrp->bitsPerPixel)
- || (disp->depth == scrp->depth && disp->fbbpp <= 0)
- || (disp->fbbpp == scrp->bitsPerPixel && disp->depth <= 0)) {
- scrp->display = disp;
- break;
- }
+ i < scrp->confScreen->numdisplays; i++, disp++) {
+ if ((disp->depth == scrp->depth && disp->fbbpp == scrp->bitsPerPixel)
+ || (disp->depth == scrp->depth && disp->fbbpp <= 0)
+ || (disp->fbbpp == scrp->bitsPerPixel && disp->depth <= 0)) {
+ scrp->display = disp;
+ break;
+ }
}
/*
@@ -577,40 +583,40 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
* depth or fbbpp specified.
*/
if (i == scrp->confScreen->numdisplays) {
- for (i = 0, disp = scrp->confScreen->displays;
- i < scrp->confScreen->numdisplays; i++, disp++) {
- if (disp->depth <= 0 && disp->fbbpp <= 0) {
- scrp->display = disp;
- break;
- }
- }
+ for (i = 0, disp = scrp->confScreen->displays;
+ i < scrp->confScreen->numdisplays; i++, disp++) {
+ if (disp->depth <= 0 && disp->fbbpp <= 0) {
+ scrp->display = disp;
+ break;
+ }
+ }
}
/*
* If all else fails, create a default one.
*/
if (i == scrp->confScreen->numdisplays) {
- scrp->confScreen->numdisplays++;
- scrp->confScreen->displays =
- xnfrealloc(scrp->confScreen->displays,
- scrp->confScreen->numdisplays * sizeof(DispRec));
- xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "Creating default Display subsection in Screen section\n"
- "\t\"%s\" for depth/fbbpp %d/%d\n",
- scrp->confScreen->id, scrp->depth, scrp->bitsPerPixel);
- memset(&scrp->confScreen->displays[i], 0, sizeof(DispRec));
- scrp->confScreen->displays[i].blackColour.red = -1;
- scrp->confScreen->displays[i].blackColour.green = -1;
- scrp->confScreen->displays[i].blackColour.blue = -1;
- scrp->confScreen->displays[i].whiteColour.red = -1;
- scrp->confScreen->displays[i].whiteColour.green = -1;
- scrp->confScreen->displays[i].whiteColour.blue = -1;
- scrp->confScreen->displays[i].defaultVisual = -1;
- scrp->confScreen->displays[i].modes = xnfalloc(sizeof(char *));
- scrp->confScreen->displays[i].modes[0] = NULL;
- scrp->confScreen->displays[i].depth = depth;
- scrp->confScreen->displays[i].fbbpp = fbbpp;
- scrp->display = &scrp->confScreen->displays[i];
+ scrp->confScreen->numdisplays++;
+ scrp->confScreen->displays =
+ xnfrealloc(scrp->confScreen->displays,
+ scrp->confScreen->numdisplays * sizeof(DispRec));
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "Creating default Display subsection in Screen section\n"
+ "\t\"%s\" for depth/fbbpp %d/%d\n",
+ scrp->confScreen->id, scrp->depth, scrp->bitsPerPixel);
+ memset(&scrp->confScreen->displays[i], 0, sizeof(DispRec));
+ scrp->confScreen->displays[i].blackColour.red = -1;
+ scrp->confScreen->displays[i].blackColour.green = -1;
+ scrp->confScreen->displays[i].blackColour.blue = -1;
+ scrp->confScreen->displays[i].whiteColour.red = -1;
+ scrp->confScreen->displays[i].whiteColour.green = -1;
+ scrp->confScreen->displays[i].whiteColour.blue = -1;
+ scrp->confScreen->displays[i].defaultVisual = -1;
+ scrp->confScreen->displays[i].modes = xnfalloc(sizeof(char *));
+ scrp->confScreen->displays[i].modes[0] = NULL;
+ scrp->confScreen->displays[i].depth = depth;
+ scrp->confScreen->displays[i].fbbpp = fbbpp;
+ scrp->display = &scrp->confScreen->displays[i];
}
/*
@@ -621,12 +627,13 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
scrp->imageByteOrder = IMAGE_BYTE_ORDER;
scrp->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
if (scrp->depth < 8) {
- /* Planar modes need these settings */
- scrp->bitmapScanlineUnit = 8;
- scrp->bitmapBitOrder = MSBFirst;
- } else {
- scrp->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- scrp->bitmapBitOrder = BITMAP_BIT_ORDER;
+ /* Planar modes need these settings */
+ scrp->bitmapScanlineUnit = 8;
+ scrp->bitmapBitOrder = MSBFirst;
+ }
+ else {
+ scrp->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ scrp->bitmapBitOrder = BITMAP_BIT_ORDER;
}
/*
@@ -640,14 +647,14 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
case 15:
case 16:
case 24:
- /* Common depths. Nothing to do for them */
- break;
+ /* Common depths. Nothing to do for them */
+ break;
default:
- if (!xf86AddPixFormat(scrp, scrp->depth, 0, 0)) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Can't add pixmap format for depth %d\n", scrp->depth);
- return FALSE;
- }
+ if (!xf86AddPixFormat(scrp, scrp->depth, 0, 0)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Can't add pixmap format for depth %d\n", scrp->depth);
+ return FALSE;
+ }
}
/* Initialise the framebuffer format for this screen */
@@ -682,87 +689,91 @@ xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask)
scrp->weight.blue = 0;
if (xf86Weight.red > 0 && xf86Weight.green > 0 && xf86Weight.blue > 0) {
- scrp->weight = xf86Weight;
- weightFrom = X_CMDLINE;
- } else if (scrp->display->weight.red > 0 && scrp->display->weight.green > 0
- && scrp->display->weight.blue > 0) {
- scrp->weight = scrp->display->weight;
- weightFrom = X_CONFIG;
- } else if (weight.red > 0 && weight.green > 0 && weight.blue > 0) {
- scrp->weight = weight;
- } else {
- switch (scrp->depth) {
- case 1:
- case 4:
- case 8:
- scrp->weight.red = scrp->weight.green =
- scrp->weight.blue = scrp->rgbBits;
- break;
- case 15:
- scrp->weight.red = scrp->weight.green = scrp->weight.blue = 5;
- break;
- case 16:
- scrp->weight.red = scrp->weight.blue = 5;
- scrp->weight.green = 6;
- break;
- case 18:
- scrp->weight.red = scrp->weight.green = scrp->weight.blue = 6;
- break;
- case 24:
- scrp->weight.red = scrp->weight.green = scrp->weight.blue = 8;
- break;
- case 30:
- scrp->weight.red = scrp->weight.green = scrp->weight.blue = 10;
- break;
- }
+ scrp->weight = xf86Weight;
+ weightFrom = X_CMDLINE;
+ }
+ else if (scrp->display->weight.red > 0 && scrp->display->weight.green > 0
+ && scrp->display->weight.blue > 0) {
+ scrp->weight = scrp->display->weight;
+ weightFrom = X_CONFIG;
+ }
+ else if (weight.red > 0 && weight.green > 0 && weight.blue > 0) {
+ scrp->weight = weight;
+ }
+ else {
+ switch (scrp->depth) {
+ case 1:
+ case 4:
+ case 8:
+ scrp->weight.red = scrp->weight.green =
+ scrp->weight.blue = scrp->rgbBits;
+ break;
+ case 15:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 5;
+ break;
+ case 16:
+ scrp->weight.red = scrp->weight.blue = 5;
+ scrp->weight.green = 6;
+ break;
+ case 18:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 6;
+ break;
+ case 24:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 8;
+ break;
+ case 30:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 10;
+ break;
+ }
}
if (scrp->weight.red)
- xf86DrvMsg(scrp->scrnIndex, weightFrom, "RGB weight %d%d%d\n",
- (int)scrp->weight.red, (int)scrp->weight.green,
- (int)scrp->weight.blue);
+ xf86DrvMsg(scrp->scrnIndex, weightFrom, "RGB weight %d%d%d\n",
+ (int) scrp->weight.red, (int) scrp->weight.green,
+ (int) scrp->weight.blue);
if (scrp->depth > MAX_PSEUDO_DEPTH &&
- (scrp->depth != scrp->weight.red + scrp->weight.green +
- scrp->weight.blue)) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Weight given (%d%d%d) is inconsistent with the "
- "depth (%d)\n",
- (int)scrp->weight.red, (int)scrp->weight.green,
- (int)scrp->weight.blue, scrp->depth);
- return FALSE;
+ (scrp->depth != scrp->weight.red + scrp->weight.green +
+ scrp->weight.blue)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Weight given (%d%d%d) is inconsistent with the "
+ "depth (%d)\n",
+ (int) scrp->weight.red, (int) scrp->weight.green,
+ (int) scrp->weight.blue, scrp->depth);
+ return FALSE;
}
if (scrp->depth > MAX_PSEUDO_DEPTH && scrp->weight.red) {
- /*
- * XXX Does this even mean anything for TrueColor visuals?
- * If not, we shouldn't even be setting it here. However, this
- * matches the behaviour of 3.x versions of XFree86.
- */
- scrp->rgbBits = scrp->weight.red;
- if (scrp->weight.green > scrp->rgbBits)
- scrp->rgbBits = scrp->weight.green;
- if (scrp->weight.blue > scrp->rgbBits)
- scrp->rgbBits = scrp->weight.blue;
+ /*
+ * XXX Does this even mean anything for TrueColor visuals?
+ * If not, we shouldn't even be setting it here. However, this
+ * matches the behaviour of 3.x versions of XFree86.
+ */
+ scrp->rgbBits = scrp->weight.red;
+ if (scrp->weight.green > scrp->rgbBits)
+ scrp->rgbBits = scrp->weight.green;
+ if (scrp->weight.blue > scrp->rgbBits)
+ scrp->rgbBits = scrp->weight.blue;
}
/* Set the mask and offsets */
if (mask.red == 0 || mask.green == 0 || mask.blue == 0) {
- /* Default to a setting common to PC hardware */
- scrp->offset.red = scrp->weight.green + scrp->weight.blue;
- scrp->offset.green = scrp->weight.blue;
- scrp->offset.blue = 0;
- scrp->mask.red = ((1 << scrp->weight.red) - 1) << scrp->offset.red;
- scrp->mask.green = ((1 << scrp->weight.green) - 1)
- << scrp->offset.green;
- scrp->mask.blue = (1 << scrp->weight.blue) - 1;
- } else {
- /* Initialise to the values passed */
- scrp->mask.red = mask.red;
- scrp->mask.green = mask.green;
- scrp->mask.blue = mask.blue;
- scrp->offset.red = ffs(mask.red);
- scrp->offset.green = ffs(mask.green);
- scrp->offset.blue = ffs(mask.blue);
+ /* Default to a setting common to PC hardware */
+ scrp->offset.red = scrp->weight.green + scrp->weight.blue;
+ scrp->offset.green = scrp->weight.blue;
+ scrp->offset.blue = 0;
+ scrp->mask.red = ((1 << scrp->weight.red) - 1) << scrp->offset.red;
+ scrp->mask.green = ((1 << scrp->weight.green) - 1)
+ << scrp->offset.green;
+ scrp->mask.blue = (1 << scrp->weight.blue) - 1;
+ }
+ else {
+ /* Initialise to the values passed */
+ scrp->mask.red = mask.red;
+ scrp->mask.green = mask.green;
+ scrp->mask.blue = mask.blue;
+ scrp->offset.red = ffs(mask.red);
+ scrp->offset.green = ffs(mask.green);
+ scrp->offset.blue = ffs(mask.blue);
}
return TRUE;
}
@@ -773,22 +784,25 @@ xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)
MessageType visualFrom = X_DEFAULT;
if (defaultColorVisualClass >= 0) {
- scrp->defaultVisual = defaultColorVisualClass;
- visualFrom = X_CMDLINE;
- } else if (scrp->display->defaultVisual >= 0) {
- scrp->defaultVisual = scrp->display->defaultVisual;
- visualFrom = X_CONFIG;
- } else if (visual >= 0) {
- scrp->defaultVisual = visual;
- } else {
- if (scrp->depth == 1)
- scrp->defaultVisual = StaticGray;
- else if (scrp->depth == 4)
- scrp->defaultVisual = StaticColor;
- else if (scrp->depth <= MAX_PSEUDO_DEPTH)
- scrp->defaultVisual = PseudoColor;
- else
- scrp->defaultVisual = TrueColor;
+ scrp->defaultVisual = defaultColorVisualClass;
+ visualFrom = X_CMDLINE;
+ }
+ else if (scrp->display->defaultVisual >= 0) {
+ scrp->defaultVisual = scrp->display->defaultVisual;
+ visualFrom = X_CONFIG;
+ }
+ else if (visual >= 0) {
+ scrp->defaultVisual = visual;
+ }
+ else {
+ if (scrp->depth == 1)
+ scrp->defaultVisual = StaticGray;
+ else if (scrp->depth == 4)
+ scrp->defaultVisual = StaticColor;
+ else if (scrp->depth <= MAX_PSEUDO_DEPTH)
+ scrp->defaultVisual = PseudoColor;
+ else
+ scrp->defaultVisual = TrueColor;
}
switch (scrp->defaultVisual) {
case StaticGray:
@@ -797,14 +811,14 @@ xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)
case PseudoColor:
case TrueColor:
case DirectColor:
- xf86DrvMsg(scrp->scrnIndex, visualFrom, "Default visual is %s\n",
- xf86VisualNames[scrp->defaultVisual]);
- return TRUE;
+ xf86DrvMsg(scrp->scrnIndex, visualFrom, "Default visual is %s\n",
+ xf86VisualNames[scrp->defaultVisual]);
+ return TRUE;
default:
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Invalid default visual class (%d)\n", scrp->defaultVisual);
- return FALSE;
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Invalid default visual class (%d)\n", scrp->defaultVisual);
+ return FALSE;
}
}
@@ -818,45 +832,50 @@ Bool
xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
{
MessageType from = X_DEFAULT;
+
#if 0
- xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC);
+ xf86MonPtr DDC = (xf86MonPtr) (scrp->monitor->DDC);
#endif
if (TEST_GAMMA(xf86Gamma)) {
- from = X_CMDLINE;
- scrp->gamma.red = SET_GAMMA(xf86Gamma.red);
- scrp->gamma.green = SET_GAMMA(xf86Gamma.green);
- scrp->gamma.blue = SET_GAMMA(xf86Gamma.blue);
- } else if (TEST_GAMMA(scrp->monitor->gamma)) {
- from = X_CONFIG;
- scrp->gamma.red = SET_GAMMA(scrp->monitor->gamma.red);
- scrp->gamma.green = SET_GAMMA(scrp->monitor->gamma.green);
- scrp->gamma.blue = SET_GAMMA(scrp->monitor->gamma.blue);
+ from = X_CMDLINE;
+ scrp->gamma.red = SET_GAMMA(xf86Gamma.red);
+ scrp->gamma.green = SET_GAMMA(xf86Gamma.green);
+ scrp->gamma.blue = SET_GAMMA(xf86Gamma.blue);
+ }
+ else if (TEST_GAMMA(scrp->monitor->gamma)) {
+ from = X_CONFIG;
+ scrp->gamma.red = SET_GAMMA(scrp->monitor->gamma.red);
+ scrp->gamma.green = SET_GAMMA(scrp->monitor->gamma.green);
+ scrp->gamma.blue = SET_GAMMA(scrp->monitor->gamma.blue);
#if 0
- } else if ( DDC && DDC->features.gamma > GAMMA_ZERO ) {
+ }
+ else if (DDC && DDC->features.gamma > GAMMA_ZERO) {
from = X_PROBED;
- scrp->gamma.red = SET_GAMMA(DDC->features.gamma);
- scrp->gamma.green = SET_GAMMA(DDC->features.gamma);
- scrp->gamma.blue = SET_GAMMA(DDC->features.gamma);
- /* EDID structure version 2 gives optional seperate red, green & blue gamma values
- * in bytes 0x57-0x59 */
+ scrp->gamma.red = SET_GAMMA(DDC->features.gamma);
+ scrp->gamma.green = SET_GAMMA(DDC->features.gamma);
+ scrp->gamma.blue = SET_GAMMA(DDC->features.gamma);
+ /* EDID structure version 2 gives optional seperate red, green & blue gamma values
+ * in bytes 0x57-0x59 */
#endif
- } else if (TEST_GAMMA(gamma)) {
- scrp->gamma.red = SET_GAMMA(gamma.red);
- scrp->gamma.green = SET_GAMMA(gamma.green);
- scrp->gamma.blue = SET_GAMMA(gamma.blue);
- } else {
- scrp->gamma.red = 1.0;
- scrp->gamma.green = 1.0;
- scrp->gamma.blue = 1.0;
+ }
+ else if (TEST_GAMMA(gamma)) {
+ scrp->gamma.red = SET_GAMMA(gamma.red);
+ scrp->gamma.green = SET_GAMMA(gamma.green);
+ scrp->gamma.blue = SET_GAMMA(gamma.blue);
+ }
+ else {
+ scrp->gamma.red = 1.0;
+ scrp->gamma.green = 1.0;
+ scrp->gamma.blue = 1.0;
}
/* Pretend we succeeded if we support better a gamma system.
* This avoids a confusing message.
*/
if (xf86_crtc_supports_gamma(scrp))
- return TRUE;
+ return TRUE;
xf86DrvMsg(scrp->scrnIndex, from,
- "Using gamma correction (%.1f, %.1f, %.1f)\n",
- scrp->gamma.red, scrp->gamma.green, scrp->gamma.blue);
+ "Using gamma correction (%.1f, %.1f, %.1f)\n",
+ scrp->gamma.red, scrp->gamma.green, scrp->gamma.blue);
return TRUE;
}
@@ -864,7 +883,6 @@ xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
#undef TEST_GAMMA
#undef SET_GAMMA
-
/*
* Set the DPI from the command line option. XXX should allow it to be
* calculated from the widthmm/heightmm values.
@@ -877,7 +895,7 @@ void
xf86SetDpi(ScrnInfoPtr pScrn, int x, int y)
{
MessageType from = X_DEFAULT;
- xf86MonPtr DDC = (xf86MonPtr)(pScrn->monitor->DDC);
+ xf86MonPtr DDC = (xf86MonPtr) (pScrn->monitor->DDC);
int ddcWidthmm, ddcHeightmm;
int widthErr, heightErr;
@@ -885,100 +903,107 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int y)
pScrn->widthmm = pScrn->monitor->widthmm;
pScrn->heightmm = pScrn->monitor->heightmm;
- if (DDC && (DDC->features.hsize > 0 && DDC->features.vsize > 0) ) {
- /* DDC gives display size in mm for individual modes,
- * but cm for monitor
- */
- ddcWidthmm = DDC->features.hsize * 10; /* 10mm in 1cm */
- ddcHeightmm = DDC->features.vsize * 10; /* 10mm in 1cm */
- } else {
- ddcWidthmm = ddcHeightmm = 0;
+ if (DDC && (DDC->features.hsize > 0 && DDC->features.vsize > 0)) {
+ /* DDC gives display size in mm for individual modes,
+ * but cm for monitor
+ */
+ ddcWidthmm = DDC->features.hsize * 10; /* 10mm in 1cm */
+ ddcHeightmm = DDC->features.vsize * 10; /* 10mm in 1cm */
+ }
+ else {
+ ddcWidthmm = ddcHeightmm = 0;
}
if (monitorResolution > 0) {
- pScrn->xDpi = monitorResolution;
- pScrn->yDpi = monitorResolution;
- from = X_CMDLINE;
- } else if (pScrn->widthmm > 0 || pScrn->heightmm > 0) {
- from = X_CONFIG;
- if (pScrn->widthmm > 0) {
- pScrn->xDpi =
- (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
- }
- if (pScrn->heightmm > 0) {
- pScrn->yDpi =
- (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
- }
- if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
- pScrn->yDpi = pScrn->xDpi;
- if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
- pScrn->xDpi = pScrn->yDpi;
- xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
- pScrn->widthmm, pScrn->heightmm);
-
- /* Warn if config and probe disagree about display size */
- if ( ddcWidthmm && ddcHeightmm ) {
- if (pScrn->widthmm > 0) {
- widthErr = abs(ddcWidthmm - pScrn->widthmm);
- } else {
- widthErr = 0;
- }
- if (pScrn->heightmm > 0) {
- heightErr = abs(ddcHeightmm - pScrn->heightmm);
- } else {
- heightErr = 0;
- }
- if (widthErr>10 || heightErr>10) {
- /* Should include config file name for monitor here */
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Probed monitor is %dx%d mm, using Displaysize %dx%d mm\n",
- ddcWidthmm,ddcHeightmm, pScrn->widthmm,pScrn->heightmm);
- }
- }
- } else if ( ddcWidthmm && ddcHeightmm ) {
- from = X_PROBED;
- xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
- ddcWidthmm, ddcHeightmm );
- pScrn->widthmm = ddcWidthmm;
- pScrn->heightmm = ddcHeightmm;
- if (pScrn->widthmm > 0) {
- pScrn->xDpi =
- (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
- }
- if (pScrn->heightmm > 0) {
- pScrn->yDpi =
- (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
- }
- if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
- pScrn->yDpi = pScrn->xDpi;
- if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
- pScrn->xDpi = pScrn->yDpi;
- } else {
- if (x > 0)
- pScrn->xDpi = x;
- else
- pScrn->xDpi = DEFAULT_DPI;
- if (y > 0)
- pScrn->yDpi = y;
- else
- pScrn->yDpi = DEFAULT_DPI;
+ pScrn->xDpi = monitorResolution;
+ pScrn->yDpi = monitorResolution;
+ from = X_CMDLINE;
+ }
+ else if (pScrn->widthmm > 0 || pScrn->heightmm > 0) {
+ from = X_CONFIG;
+ if (pScrn->widthmm > 0) {
+ pScrn->xDpi =
+ (int) ((double) pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+ }
+ if (pScrn->heightmm > 0) {
+ pScrn->yDpi =
+ (int) ((double) pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+ }
+ if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
+ pScrn->yDpi = pScrn->xDpi;
+ if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
+ pScrn->xDpi = pScrn->yDpi;
+ xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
+ pScrn->widthmm, pScrn->heightmm);
+
+ /* Warn if config and probe disagree about display size */
+ if (ddcWidthmm && ddcHeightmm) {
+ if (pScrn->widthmm > 0) {
+ widthErr = abs(ddcWidthmm - pScrn->widthmm);
+ }
+ else {
+ widthErr = 0;
+ }
+ if (pScrn->heightmm > 0) {
+ heightErr = abs(ddcHeightmm - pScrn->heightmm);
+ }
+ else {
+ heightErr = 0;
+ }
+ if (widthErr > 10 || heightErr > 10) {
+ /* Should include config file name for monitor here */
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Probed monitor is %dx%d mm, using Displaysize %dx%d mm\n",
+ ddcWidthmm, ddcHeightmm, pScrn->widthmm,
+ pScrn->heightmm);
+ }
+ }
+ }
+ else if (ddcWidthmm && ddcHeightmm) {
+ from = X_PROBED;
+ xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
+ ddcWidthmm, ddcHeightmm);
+ pScrn->widthmm = ddcWidthmm;
+ pScrn->heightmm = ddcHeightmm;
+ if (pScrn->widthmm > 0) {
+ pScrn->xDpi =
+ (int) ((double) pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+ }
+ if (pScrn->heightmm > 0) {
+ pScrn->yDpi =
+ (int) ((double) pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+ }
+ if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
+ pScrn->yDpi = pScrn->xDpi;
+ if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
+ pScrn->xDpi = pScrn->yDpi;
+ }
+ else {
+ if (x > 0)
+ pScrn->xDpi = x;
+ else
+ pScrn->xDpi = DEFAULT_DPI;
+ if (y > 0)
+ pScrn->yDpi = y;
+ else
+ pScrn->yDpi = DEFAULT_DPI;
}
xf86DrvMsg(pScrn->scrnIndex, from, "DPI set to (%d, %d)\n",
- pScrn->xDpi, pScrn->yDpi);
+ pScrn->xDpi, pScrn->yDpi);
}
#undef MMPERINCH
-
void
xf86SetBlackWhitePixels(ScreenPtr pScreen)
{
if (xf86FlipPixels) {
- pScreen->whitePixel = 0;
- pScreen->blackPixel = 1;
- } else {
- pScreen->whitePixel = 1;
- pScreen->blackPixel = 0;
+ pScreen->whitePixel = 0;
+ pScreen->blackPixel = 1;
+ }
+ else {
+ pScreen->whitePixel = 1;
+ pScreen->blackPixel = 0;
}
}
@@ -1009,21 +1034,19 @@ xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
PixmapPtr pspix;
pspix = (*pScreen->GetScreenPixmap) (pScreen);
- if (enable)
- {
- /*
- * Restore all of the clip lists on the screen
- */
- if (!xf86Resetting)
- SetRootClip (pScreen, TRUE);
+ if (enable) {
+ /*
+ * Restore all of the clip lists on the screen
+ */
+ if (!xf86Resetting)
+ SetRootClip(pScreen, TRUE);
}
- else
- {
- /*
- * Empty all of the clip lists on the screen
- */
- SetRootClip (pScreen, FALSE);
+ else {
+ /*
+ * Empty all of the clip lists on the screen
+ */
+ SetRootClip(pScreen, FALSE);
}
}
@@ -1031,21 +1054,21 @@ xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
(<type>) <screen name>(<screen index>): <message> */
void
xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
- va_list args)
+ va_list args)
{
/* Prefix the scrnIndex name to the format string. */
if (scrnIndex >= 0 && scrnIndex < xf86NumScreens &&
- xf86Screens[scrnIndex]->name)
- LogHdrMessageVerb(type, verb, format, args, "%s(%d): ",
- xf86Screens[scrnIndex]->name, scrnIndex);
+ xf86Screens[scrnIndex]->name)
+ LogHdrMessageVerb(type, verb, format, args, "%s(%d): ",
+ xf86Screens[scrnIndex]->name, scrnIndex);
else
- LogVMessageVerb(type, verb, format, args);
+ LogVMessageVerb(type, verb, format, args);
}
/* Print driver messages, with verbose level specified directly */
void
xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
- ...)
+ ...)
{
va_list ap;
@@ -1069,26 +1092,26 @@ xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
(<type>) <driver>: <device name>: <message> */
void
xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb,
- const char *format, va_list args)
+ const char *format, va_list args)
{
const char *driverName = NULL;
const char *deviceName = NULL;
/* Prefix driver and device names to formatted message. */
if (dev) {
- deviceName = dev->name;
- if (dev->drv)
- driverName = dev->drv->driverName;
+ deviceName = dev->name;
+ if (dev->drv)
+ driverName = dev->drv->driverName;
}
LogHdrMessageVerb(type, verb, format, args, "%s: %s: ", driverName,
- deviceName);
+ deviceName);
}
/* Print input driver message, with verbose level specified directly */
void
-xf86IDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
- ...)
+xf86IDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb,
+ const char *format, ...)
{
va_list ap;
@@ -1108,7 +1131,6 @@ xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...)
va_end(ap);
}
-
/* Print non-driver messages with verbose level specified directly */
void
xf86MsgVerb(MessageType type, int verb, const char *format, ...)
@@ -1139,7 +1161,7 @@ xf86ErrorFVerb(int verb, const char *format, ...)
va_start(ap, format);
if (xf86Verbose >= verb || xf86LogVerbose >= verb)
- LogVWrite(verb, format, ap);
+ LogVWrite(verb, format, ap);
va_end(ap);
}
@@ -1151,11 +1173,10 @@ xf86ErrorF(const char *format, ...)
va_start(ap, format);
if (xf86Verbose >= 1 || xf86LogVerbose >= 1)
- LogVWrite(1, format, ap);
+ LogVWrite(1, format, ap);
va_end(ap);
}
-
void
xf86LogInit(void)
{
@@ -1166,10 +1187,10 @@ xf86LogInit(void)
/* Get the log file name */
if (xf86LogFileFrom == X_DEFAULT) {
- /* Append the display number and ".log" */
- if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
- FatalError("Cannot allocate space for the log file name\n");
- xf86LogFile = lf;
+ /* Append the display number and ".log" */
+ if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
+ FatalError("Cannot allocate space for the log file name\n");
+ xf86LogFile = lf;
}
xf86LogFile = LogInit(xf86LogFile, LOGOLDSUFFIX);
@@ -1190,7 +1211,6 @@ xf86CloseLog(enum ExitCode error)
LogClose(error);
}
-
/*
* Drivers can use these for using their own SymTabRecs.
*/
@@ -1200,13 +1220,12 @@ xf86TokenToString(SymTabPtr table, int token)
{
int i;
- for (i = 0; table[i].token >= 0 && table[i].token != token; i++)
- ;
+ for (i = 0; table[i].token >= 0 && table[i].token != token; i++);
if (table[i].token < 0)
- return NULL;
+ return NULL;
else
- return table[i].name;
+ return table[i].name;
}
int
@@ -1215,10 +1234,9 @@ xf86StringToToken(SymTabPtr table, const char *string)
int i;
if (string == NULL)
- return -1;
+ return -1;
- for (i = 0; table[i].token >= 0 && xf86NameCmp(string, table[i].name); i++)
- ;
+ for (i = 0; table[i].token >= 0 && xf86NameCmp(string, table[i].name); i++);
return table[i].token;
}
@@ -1232,17 +1250,16 @@ xf86ShowClocks(ScrnInfoPtr scrp, MessageType from)
int j;
xf86DrvMsg(scrp->scrnIndex, from, "Pixel clocks available:");
- for (j=0; j < scrp->numClocks; j++) {
- if ((j % 4) == 0) {
- xf86ErrorF("\n");
- xf86DrvMsg(scrp->scrnIndex, from, "pixel clocks:");
- }
- xf86ErrorF(" %7.3f", (double)scrp->clock[j] / 1000.0);
+ for (j = 0; j < scrp->numClocks; j++) {
+ if ((j % 4) == 0) {
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrp->scrnIndex, from, "pixel clocks:");
+ }
+ xf86ErrorF(" %7.3f", (double) scrp->clock[j] / 1000.0);
}
xf86ErrorF("\n");
}
-
/*
* This prints out the driver identify message, including the names of
* the supported chipsets.
@@ -1258,40 +1275,40 @@ xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips)
len = 6 + strlen(drvname) + 2 + strlen(drvmsg) + 2;
xf86Msg(X_INFO, "%s: %s:", drvname, drvmsg);
for (i = 0; chips[i].name != NULL; i++) {
- if (i != 0) {
- xf86ErrorF(",");
- len++;
- }
- if (len + 2 + strlen(chips[i].name) < 78) {
- xf86ErrorF(" ");
- len++;
- } else {
- xf86ErrorF("\n\t");
- len = 8;
- }
- xf86ErrorF("%s", chips[i].name);
- len += strlen(chips[i].name);
+ if (i != 0) {
+ xf86ErrorF(",");
+ len++;
+ }
+ if (len + 2 + strlen(chips[i].name) < 78) {
+ xf86ErrorF(" ");
+ len++;
+ }
+ else {
+ xf86ErrorF("\n\t");
+ len = 8;
+ }
+ xf86ErrorF("%s", chips[i].name);
+ len += strlen(chips[i].name);
}
xf86ErrorF("\n");
}
-
int
-xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
+xf86MatchDevice(const char *drivername, GDevPtr ** sectlist)
{
- GDevPtr gdp, *pgdp = NULL;
+ GDevPtr gdp, *pgdp = NULL;
confScreenPtr screensecptr;
- int i,j;
+ int i, j;
if (sectlist)
- *sectlist = NULL;
+ *sectlist = NULL;
/*
* This can happen when running Xorg -showopts and a module like ati
* or vmware tries to load its submodules when xf86ConfigLayout is empty
*/
if (!xf86ConfigLayout.screens)
- return 0;
+ return 0;
/*
* This is a very important function that matches the device sections
@@ -1314,11 +1331,11 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
* first we need to loop over all the Screens sections to get to all
* 'active' device sections
*/
- for (j=0; xf86ConfigLayout.screens[j].screen != NULL; j++) {
+ for (j = 0; xf86ConfigLayout.screens[j].screen != NULL; j++) {
screensecptr = xf86ConfigLayout.screens[j].screen;
if ((screensecptr->device->driver != NULL)
- && (xf86NameCmp( screensecptr->device->driver,drivername) == 0)
- && (! screensecptr->device->claimed)) {
+ && (xf86NameCmp(screensecptr->device->driver, drivername) == 0)
+ && (!screensecptr->device->claimed)) {
/*
* we have a matching driver that wasn't claimed, yet
*/
@@ -1330,14 +1347,14 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
/* Then handle the inactive devices */
j = 0;
while (xf86ConfigLayout.inactives[j].identifier) {
- gdp = &xf86ConfigLayout.inactives[j];
- if (gdp->driver && !gdp->claimed &&
- !xf86NameCmp(gdp->driver,drivername)) {
- /* we have a matching driver that wasn't claimed yet */
- pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
- pgdp[i++] = gdp;
- }
- j++;
+ gdp = &xf86ConfigLayout.inactives[j];
+ if (gdp->driver && !gdp->claimed &&
+ !xf86NameCmp(gdp->driver, drivername)) {
+ /* we have a matching driver that wasn't claimed yet */
+ pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
+ pgdp[i++] = gdp;
+ }
+ j++;
}
/*
@@ -1347,9 +1364,9 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
pgdp[i] = NULL;
if (sectlist)
- *sectlist = pgdp;
+ *sectlist = pgdp;
else
- free(pgdp);
+ free(pgdp);
return i;
}
@@ -1357,12 +1374,11 @@ const char *
xf86GetVisualName(int visual)
{
if (visual < 0 || visual > DirectColor)
- return NULL;
+ return NULL;
return xf86VisualNames[visual];
}
-
int
xf86GetVerbosity(void)
{
@@ -1375,84 +1391,72 @@ xf86GetPix24(void)
return xf86Info.pixmap24;
}
-
int
xf86GetDepth(void)
{
return xf86Depth;
}
-
rgb
xf86GetWeight(void)
{
return xf86Weight;
}
-
Gamma
xf86GetGamma(void)
{
return xf86Gamma;
}
-
Bool
xf86GetFlipPixels(void)
{
return xf86FlipPixels;
}
-
const char *
xf86GetServerName(void)
{
return xf86ServerName;
}
-
Bool
xf86ServerIsExiting(void)
{
return (dispatchException & DE_TERMINATE) == DE_TERMINATE;
}
-
Bool
xf86ServerIsResetting(void)
{
return xf86Resetting;
}
-
Bool
xf86ServerIsInitialising(void)
{
return xf86Initialising;
}
-
Bool
xf86ServerIsOnlyDetecting(void)
{
return xf86DoConfigure;
}
-
Bool
xf86CaughtSignal(void)
{
return xf86Info.caughtSignal;
}
-
Bool
xf86GetVidModeAllowNonLocal(void)
{
return xf86Info.vidModeAllowNonLocal;
}
-
Bool
xf86GetVidModeEnabled(void)
{
@@ -1465,21 +1469,18 @@ xf86GetModInDevAllowNonLocal(void)
return xf86Info.miscModInDevAllowNonLocal;
}
-
Bool
xf86GetModInDevEnabled(void)
{
return xf86Info.miscModInDevEnabled;
}
-
Bool
xf86GetAllowMouseOpenFail(void)
{
return xf86Info.allowMouseOpenFail;
}
-
void
xf86DisableRandR(void)
{
@@ -1490,7 +1491,7 @@ xf86DisableRandR(void)
CARD32
xf86GetModuleVersion(pointer module)
{
- return (CARD32)LoaderGetModuleVersion(module);
+ return (CARD32) LoaderGetModuleVersion(module);
}
pointer
@@ -1500,9 +1501,9 @@ xf86LoadDrvSubModule(DriverPtr drv, const char *name)
int errmaj = 0, errmin = 0;
ret = LoadSubModule(drv->module, name, NULL, NULL, NULL, NULL,
- &errmaj, &errmin);
+ &errmaj, &errmin);
if (!ret)
- LoaderErrorMsg(NULL, name, errmaj, errmin);
+ LoaderErrorMsg(NULL, name, errmaj, errmin);
return ret;
}
@@ -1513,9 +1514,9 @@ xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)
int errmaj = 0, errmin = 0;
ret = LoadSubModule(pScrn->module, name, NULL, NULL, NULL, NULL,
- &errmaj, &errmin);
+ &errmaj, &errmin);
if (!ret)
- LoaderErrorMsg(pScrn->name, name, errmaj, errmin);
+ LoaderErrorMsg(pScrn->name, name, errmaj, errmin);
return ret;
}
@@ -1530,22 +1531,22 @@ xf86LoadOneModule(char *name, pointer opt)
pointer mod;
if (!name)
- return NULL;
+ return NULL;
/* Normalise the module name */
Name = xf86NormalizeName(name);
/* Skip empty names */
if (Name == NULL)
- return NULL;
+ return NULL;
if (*Name == '\0') {
- free(Name);
- return NULL;
+ free(Name);
+ return NULL;
}
mod = LoadModule(Name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin);
if (!mod)
- LoaderErrorMsg(NULL, Name, errmaj, errmin);
+ LoaderErrorMsg(NULL, Name, errmaj, errmin);
free(Name);
return mod;
}
@@ -1563,12 +1564,12 @@ xf86LoaderCheckSymbol(const char *name)
}
typedef enum {
- OPTION_BACKING_STORE
+ OPTION_BACKING_STORE
} BSOpts;
static const OptionInfoRec BSOptions[] = {
- { OPTION_BACKING_STORE, "BackingStore", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE }
+ {OPTION_BACKING_STORE, "BackingStore", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE}
};
void
@@ -1580,39 +1581,40 @@ xf86SetBackingStore(ScreenPtr pScreen)
OptionInfoPtr options;
options = xnfalloc(sizeof(BSOptions));
- (void)memcpy(options, BSOptions, sizeof(BSOptions));
+ (void) memcpy(options, BSOptions, sizeof(BSOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
/* check for commandline option here */
if (xf86bsEnableFlag) {
- from = X_CMDLINE;
- useBS = TRUE;
- } else if (xf86bsDisableFlag) {
- from = X_CMDLINE;
- useBS = FALSE;
- } else {
- if (xf86GetOptValBool(options, OPTION_BACKING_STORE, &useBS))
- from = X_CONFIG;
+ from = X_CMDLINE;
+ useBS = TRUE;
+ }
+ else if (xf86bsDisableFlag) {
+ from = X_CMDLINE;
+ useBS = FALSE;
+ }
+ else {
+ if (xf86GetOptValBool(options, OPTION_BACKING_STORE, &useBS))
+ from = X_CONFIG;
}
free(options);
pScreen->backingStoreSupport = useBS ? Always : NotUseful;
if (serverGeneration == 1)
- xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n",
- useBS ? "enabled" : "disabled");
+ xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n",
+ useBS ? "enabled" : "disabled");
}
-
typedef enum {
- OPTION_SILKEN_MOUSE
+ OPTION_SILKEN_MOUSE
} SMOpts;
static const OptionInfoRec SMOptions[] = {
- { OPTION_SILKEN_MOUSE, "SilkenMouse", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE }
+ {OPTION_SILKEN_MOUSE, "SilkenMouse", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE}
};
void
-xf86SetSilkenMouse (ScreenPtr pScreen)
+xf86SetSilkenMouse(ScreenPtr pScreen)
{
Bool useSM = TRUE;
MessageType from = X_DEFAULT;
@@ -1620,18 +1622,19 @@ xf86SetSilkenMouse (ScreenPtr pScreen)
OptionInfoPtr options;
options = xnfalloc(sizeof(SMOptions));
- (void)memcpy(options, SMOptions, sizeof(SMOptions));
+ (void) memcpy(options, SMOptions, sizeof(SMOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
/* check for commandline option here */
/* disable if screen shares resources */
- /* TODO VGA arb disable silken mouse */
+ /* TODO VGA arb disable silken mouse */
if (xf86silkenMouseDisableFlag) {
from = X_CMDLINE;
- useSM = FALSE;
- } else {
- if (xf86GetOptValBool(options, OPTION_SILKEN_MOUSE, &useSM))
- from = X_CONFIG;
+ useSM = FALSE;
+ }
+ else {
+ if (xf86GetOptValBool(options, OPTION_SILKEN_MOUSE, &useSM))
+ from = X_CONFIG;
}
free(options);
/*
@@ -1641,33 +1644,37 @@ xf86SetSilkenMouse (ScreenPtr pScreen)
*/
pScrn->silkenMouse = useSM && xf86Info.useSIGIO && xf86SIGIOSupported();
if (serverGeneration == 1)
- xf86DrvMsg(pScreen->myNum, from, "Silken mouse %s\n",
- pScrn->silkenMouse ? "enabled" : "disabled");
+ xf86DrvMsg(pScreen->myNum, from, "Silken mouse %s\n",
+ pScrn->silkenMouse ? "enabled" : "disabled");
}
/* Wrote this function for the PM2 Xv driver, preliminary. */
pointer
xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
- char **adaptor_name, pointer *adaptor_options)
+ char **adaptor_name, pointer *adaptor_options)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
confXvAdaptorPtr adaptor;
int i;
if (adaptor_index >= pScrn->confScreen->numxvadaptors) {
- if (adaptor_name) *adaptor_name = NULL;
- if (adaptor_options) *adaptor_options = NULL;
- return NULL;
+ if (adaptor_name)
+ *adaptor_name = NULL;
+ if (adaptor_options)
+ *adaptor_options = NULL;
+ return NULL;
}
adaptor = &pScrn->confScreen->xvadaptors[adaptor_index];
- if (adaptor_name) *adaptor_name = adaptor->identifier;
- if (adaptor_options) *adaptor_options = adaptor->options;
+ if (adaptor_name)
+ *adaptor_name = adaptor->identifier;
+ if (adaptor_options)
+ *adaptor_options = adaptor->options;
for (i = 0; i < adaptor->numports; i++)
- if (!xf86NameCmp(adaptor->ports[i].identifier, port_name))
- return adaptor->ports[i].options;
+ if (!xf86NameCmp(adaptor->ports[i].identifier, port_name))
+ return adaptor->ports[i].options;
return NULL;
}
@@ -1678,39 +1685,41 @@ xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
static void
xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
- EntityProc enter, EntityProc leave, pointer private)
+ EntityProc enter, EntityProc leave, pointer private)
{
ScrnInfoPtr pScrn;
if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
- xf86RemoveEntityFromScreen(pScrn,pEnt->index);
- xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
+ xf86RemoveEntityFromScreen(pScrn, pEnt->index);
+ xf86SetEntityFuncs(pEnt->index, init, enter, leave, private);
}
ScrnInfoPtr
xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
- EntityProc init, EntityProc enter, EntityProc leave,
- pointer private)
+ EntityProc init, EntityProc enter, EntityProc leave,
+ pointer private)
{
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
- if (!pEnt) return pScrn;
+
+ if (!pEnt)
+ return pScrn;
if (!(pEnt->location.type == BUS_NONE)) {
- free(pEnt);
- return pScrn;
+ free(pEnt);
+ return pScrn;
}
if (!pEnt->active) {
- xf86ConfigFbEntityInactive(pEnt, init, enter, leave, private);
- free(pEnt);
- return pScrn;
+ xf86ConfigFbEntityInactive(pEnt, init, enter, leave, private);
+ free(pEnt);
+ return pScrn;
}
if (!pScrn)
- pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag);
- xf86AddEntityToScreen(pScrn,entityIndex);
+ pScrn = xf86AllocateScreen(pEnt->driver, scrnFlag);
+ xf86AddEntityToScreen(pScrn, entityIndex);
- xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
+ xf86SetEntityFuncs(entityIndex, init, enter, leave, private);
free(pEnt);
return pScrn;
@@ -1722,48 +1731,49 @@ xf86IsScreenPrimary(int scrnIndex)
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
int i;
- for (i=0 ; i < pScrn->numEntities; i++) {
- if (xf86IsEntityPrimary(i))
- return TRUE;
+ for (i = 0; i < pScrn->numEntities; i++) {
+ if (xf86IsEntityPrimary(i))
+ return TRUE;
}
return FALSE;
}
int
xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
- int format, unsigned long len, pointer value )
+ int format, unsigned long len, pointer value)
{
RootWinPropPtr pNewProp = NULL, pRegProp;
Bool existing = FALSE;
DebugF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
- ScrnIndex, property, type, format, len, value);
+ ScrnIndex, property, type, format, len, value);
- if (ScrnIndex<0 || ScrnIndex>=xf86NumScreens) {
- return BadMatch;
+ if (ScrnIndex < 0 || ScrnIndex >= xf86NumScreens) {
+ return BadMatch;
}
if (xf86RegisteredPropertiesTable &&
- xf86RegisteredPropertiesTable[ScrnIndex]) {
- for (pNewProp = xf86RegisteredPropertiesTable[ScrnIndex];
- pNewProp; pNewProp = pNewProp->next) {
- if (strcmp(pNewProp->name, NameForAtom(property)) == 0)
- break;
- }
+ xf86RegisteredPropertiesTable[ScrnIndex]) {
+ for (pNewProp = xf86RegisteredPropertiesTable[ScrnIndex];
+ pNewProp; pNewProp = pNewProp->next) {
+ if (strcmp(pNewProp->name, NameForAtom(property)) == 0)
+ break;
+ }
}
if (!pNewProp) {
- if ((pNewProp = (RootWinPropPtr)malloc(sizeof(RootWinProp))) == NULL) {
- return BadAlloc;
- }
- /*
- * We will put this property at the end of the list so that
- * the changes are made in the order they were requested.
- */
- pNewProp->next = NULL;
- } else {
- free(pNewProp->name);
- existing = TRUE;
+ if ((pNewProp = (RootWinPropPtr) malloc(sizeof(RootWinProp))) == NULL) {
+ return BadAlloc;
+ }
+ /*
+ * We will put this property at the end of the list so that
+ * the changes are made in the order they were requested.
+ */
+ pNewProp->next = NULL;
+ }
+ else {
+ free(pNewProp->name);
+ existing = TRUE;
}
pNewProp->name = xnfstrdup(NameForAtom(property));
@@ -1775,28 +1785,29 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
DebugF("new property filled\n");
if (xf86RegisteredPropertiesTable == NULL) {
- DebugF("creating xf86RegisteredPropertiesTable[] size %d\n",
- xf86NumScreens);
- xf86RegisteredPropertiesTable =
- xnfcalloc(sizeof(RootWinProp), xf86NumScreens);
+ DebugF("creating xf86RegisteredPropertiesTable[] size %d\n",
+ xf86NumScreens);
+ xf86RegisteredPropertiesTable =
+ xnfcalloc(sizeof(RootWinProp), xf86NumScreens);
}
DebugF("xf86RegisteredPropertiesTable %p\n",
- (void *)xf86RegisteredPropertiesTable);
+ (void *) xf86RegisteredPropertiesTable);
DebugF("xf86RegisteredPropertiesTable[%d] %p\n",
- ScrnIndex, (void *)xf86RegisteredPropertiesTable[ScrnIndex]);
+ ScrnIndex, (void *) xf86RegisteredPropertiesTable[ScrnIndex]);
if (!existing) {
- if ( xf86RegisteredPropertiesTable[ScrnIndex] == NULL) {
- xf86RegisteredPropertiesTable[ScrnIndex] = pNewProp;
- } else {
- pRegProp = xf86RegisteredPropertiesTable[ScrnIndex];
- while (pRegProp->next != NULL) {
- DebugF("- next %p\n", (void *)pRegProp);
- pRegProp = pRegProp->next;
+ if (xf86RegisteredPropertiesTable[ScrnIndex] == NULL) {
+ xf86RegisteredPropertiesTable[ScrnIndex] = pNewProp;
+ }
+ else {
+ pRegProp = xf86RegisteredPropertiesTable[ScrnIndex];
+ while (pRegProp->next != NULL) {
+ DebugF("- next %p\n", (void *) pRegProp);
+ pRegProp = pRegProp->next;
+ }
+ pRegProp->next = pNewProp;
}
- pRegProp->next = pNewProp;
- }
}
DebugF("xf86RegisterRootWindowProperty succeeded\n");
return Success;
@@ -1805,16 +1816,16 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
Bool
xf86IsUnblank(int mode)
{
- switch(mode) {
+ switch (mode) {
case SCREEN_SAVER_OFF:
case SCREEN_SAVER_FORCER:
- return TRUE;
+ return TRUE;
case SCREEN_SAVER_ON:
case SCREEN_SAVER_CYCLE:
- return FALSE;
+ return FALSE;
default:
- xf86MsgVerb(X_WARNING, 0, "Unexpected save screen mode: %d\n", mode);
- return TRUE;
+ xf86MsgVerb(X_WARNING, 0, "Unexpected save screen mode: %d\n", mode);
+ return TRUE;
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index 5263b5f73..0974893d3 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -91,21 +91,22 @@
#include <hotplug.h>
#ifdef XF86PM
-void (*xf86OSPMClose)(void) = NULL;
+void (*xf86OSPMClose) (void) = NULL;
#endif
static Bool xorgHWOpenConsole = FALSE;
/* Common pixmap formats */
static PixmapFormatRec formats[MAXFORMATS] = {
- { 1, 1, BITMAP_SCANLINE_PAD },
- { 4, 8, BITMAP_SCANLINE_PAD },
- { 8, 8, BITMAP_SCANLINE_PAD },
- { 15, 16, BITMAP_SCANLINE_PAD },
- { 16, 16, BITMAP_SCANLINE_PAD },
- { 24, 32, BITMAP_SCANLINE_PAD },
- { 32, 32, BITMAP_SCANLINE_PAD },
+ {1, 1, BITMAP_SCANLINE_PAD},
+ {4, 8, BITMAP_SCANLINE_PAD},
+ {8, 8, BITMAP_SCANLINE_PAD},
+ {15, 16, BITMAP_SCANLINE_PAD},
+ {16, 16, BITMAP_SCANLINE_PAD},
+ {24, 32, BITMAP_SCANLINE_PAD},
+ {32, 32, BITMAP_SCANLINE_PAD},
};
+
static int numFormats = 7;
static Bool formatsDone = FALSE;
@@ -123,241 +124,242 @@ static void
xf86PrintBanner(void)
{
#if PRE_RELEASE
- xf86ErrorFVerb(0, "\n"
- "This is a pre-release version of the X server from " XVENDORNAME ".\n"
- "It is not supported in any way.\n"
- "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
- "Select the \"xorg\" product for bugs you find in this release.\n"
- "Before reporting bugs in pre-release versions please check the\n"
- "latest version in the X.Org Foundation git repository.\n"
- "See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
+ xf86ErrorFVerb(0, "\n"
+ "This is a pre-release version of the X server from "
+ XVENDORNAME ".\n" "It is not supported in any way.\n"
+ "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
+ "Select the \"xorg\" product for bugs you find in this release.\n"
+ "Before reporting bugs in pre-release versions please check the\n"
+ "latest version in the X.Org Foundation git repository.\n"
+ "See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
#endif
- xf86ErrorFVerb(0, "\nX.Org X Server %d.%d.%d",
- XORG_VERSION_MAJOR,
- XORG_VERSION_MINOR,
- XORG_VERSION_PATCH);
+ xf86ErrorFVerb(0, "\nX.Org X Server %d.%d.%d",
+ XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH);
#if XORG_VERSION_SNAP > 0
- xf86ErrorFVerb(0, ".%d", XORG_VERSION_SNAP);
+ xf86ErrorFVerb(0, ".%d", XORG_VERSION_SNAP);
#endif
#if XORG_VERSION_SNAP >= 900
- /* When the minor number is 99, that signifies that the we are making
- * a release candidate for a major version. (X.0.0)
- * When the patch number is 99, that signifies that the we are making
- * a release candidate for a minor version. (X.Y.0)
- * When the patch number is < 99, then we are making a release
- * candidate for the next point release. (X.Y.Z)
- */
+ /* When the minor number is 99, that signifies that the we are making
+ * a release candidate for a major version. (X.0.0)
+ * When the patch number is 99, that signifies that the we are making
+ * a release candidate for a minor version. (X.Y.0)
+ * When the patch number is < 99, then we are making a release
+ * candidate for the next point release. (X.Y.Z)
+ */
#if XORG_VERSION_MINOR >= 99
- xf86ErrorFVerb(0, " (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1,
- XORG_VERSION_SNAP - 900);
+ xf86ErrorFVerb(0, " (%d.0.0 RC %d)", XORG_VERSION_MAJOR + 1,
+ XORG_VERSION_SNAP - 900);
#elif XORG_VERSION_PATCH == 99
- xf86ErrorFVerb(0, " (%d.%d.0 RC %d)", XORG_VERSION_MAJOR,
- XORG_VERSION_MINOR + 1, XORG_VERSION_SNAP - 900);
+ xf86ErrorFVerb(0, " (%d.%d.0 RC %d)", XORG_VERSION_MAJOR,
+ XORG_VERSION_MINOR + 1, XORG_VERSION_SNAP - 900);
#else
- xf86ErrorFVerb(0, " (%d.%d.%d RC %d)", XORG_VERSION_MAJOR,
- XORG_VERSION_MINOR, XORG_VERSION_PATCH + 1,
- XORG_VERSION_SNAP - 900);
+ xf86ErrorFVerb(0, " (%d.%d.%d RC %d)", XORG_VERSION_MAJOR,
+ XORG_VERSION_MINOR, XORG_VERSION_PATCH + 1,
+ XORG_VERSION_SNAP - 900);
#endif
#endif
#ifdef XORG_CUSTOM_VERSION
- xf86ErrorFVerb(0, " (%s)", XORG_CUSTOM_VERSION);
+ xf86ErrorFVerb(0, " (%s)", XORG_CUSTOM_VERSION);
#endif
#ifndef XORG_DATE
-# define XORG_DATE "Unknown"
+#define XORG_DATE "Unknown"
#endif
- xf86ErrorFVerb(0, "\nRelease Date: %s\n", XORG_DATE);
- xf86ErrorFVerb(0, "X Protocol Version %d, Revision %d\n",
- X_PROTOCOL, X_PROTOCOL_REVISION);
- xf86ErrorFVerb(0, "Build Operating System: %s %s\n", OSNAME, OSVENDOR);
+ xf86ErrorFVerb(0, "\nRelease Date: %s\n", XORG_DATE);
+ xf86ErrorFVerb(0, "X Protocol Version %d, Revision %d\n",
+ X_PROTOCOL, X_PROTOCOL_REVISION);
+ xf86ErrorFVerb(0, "Build Operating System: %s %s\n", OSNAME, OSVENDOR);
#ifdef HAS_UTSNAME
- {
- struct utsname name;
+ {
+ struct utsname name;
- /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
- and Irix) and Single Unix Spec 3 just say that non-negative is success.
- All agree that failure is represented by a negative number.
- */
- if (uname(&name) >= 0) {
- xf86ErrorFVerb(0, "Current Operating System: %s %s %s %s %s\n",
- name.sysname, name.nodename, name.release, name.version, name.machine);
+ /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
+ and Irix) and Single Unix Spec 3 just say that non-negative is success.
+ All agree that failure is represented by a negative number.
+ */
+ if (uname(&name) >= 0) {
+ xf86ErrorFVerb(0, "Current Operating System: %s %s %s %s %s\n",
+ name.sysname, name.nodename, name.release,
+ name.version, name.machine);
#ifdef linux
- do {
- char buf[80];
- int fd = open("/proc/cmdline", O_RDONLY);
- if (fd != -1) {
- xf86ErrorFVerb(0, "Kernel command line: ");
- memset(buf, 0, 80);
- while (read(fd, buf, 80) > 0) {
- xf86ErrorFVerb(0, "%.80s", buf);
- memset(buf, 0, 80);
- }
- close(fd);
- }
- } while (0);
+ do {
+ char buf[80];
+ int fd = open("/proc/cmdline", O_RDONLY);
+
+ if (fd != -1) {
+ xf86ErrorFVerb(0, "Kernel command line: ");
+ memset(buf, 0, 80);
+ while (read(fd, buf, 80) > 0) {
+ xf86ErrorFVerb(0, "%.80s", buf);
+ memset(buf, 0, 80);
+ }
+ close(fd);
+ }
+ } while (0);
#endif
+ }
}
- }
#endif
#if defined(BUILD_DATE) && (BUILD_DATE > 19000000)
- {
- struct tm t;
- char buf[100];
-
- memset(&t, 0, sizeof(t));
- memset(buf, 0, sizeof(buf));
- t.tm_mday = BUILD_DATE % 100;
- t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
- t.tm_year = BUILD_DATE / 10000 - 1900;
+ {
+ struct tm t;
+ char buf[100];
+
+ memset(&t, 0, sizeof(t));
+ memset(buf, 0, sizeof(buf));
+ t.tm_mday = BUILD_DATE % 100;
+ t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
+ t.tm_year = BUILD_DATE / 10000 - 1900;
#if defined(BUILD_TIME)
- t.tm_sec = BUILD_TIME % 100;
- t.tm_min = (BUILD_TIME / 100) % 100;
- t.tm_hour = (BUILD_TIME / 10000) % 100;
- if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t))
- xf86ErrorFVerb(0, "Build Date: %s\n", buf);
+ t.tm_sec = BUILD_TIME % 100;
+ t.tm_min = (BUILD_TIME / 100) % 100;
+ t.tm_hour = (BUILD_TIME / 10000) % 100;
+ if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t))
+ xf86ErrorFVerb(0, "Build Date: %s\n", buf);
#else
- if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
- xf86ErrorFVerb(0, "Build Date: %s\n", buf);
+ if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
+ xf86ErrorFVerb(0, "Build Date: %s\n", buf);
#endif
- }
+ }
#endif
#if defined(BUILDERSTRING)
- xf86ErrorFVerb(0, "%s \n", BUILDERSTRING);
+ xf86ErrorFVerb(0, "%s \n", BUILDERSTRING);
#endif
- xf86ErrorFVerb(0, "Current version of pixman: %s\n",
- pixman_version_string());
- xf86ErrorFVerb(0, "\tBefore reporting problems, check "
- ""__VENDORDWEBSUPPORT__"\n"
- "\tto make sure that you have the latest version.\n");
+ xf86ErrorFVerb(0, "Current version of pixman: %s\n",
+ pixman_version_string());
+ xf86ErrorFVerb(0, "\tBefore reporting problems, check "
+ "" __VENDORDWEBSUPPORT__ "\n"
+ "\tto make sure that you have the latest version.\n");
}
static void
xf86PrintMarkers(void)
{
- LogPrintMarkers();
+ LogPrintMarkers();
}
-Bool xf86PrivsElevated(void)
+Bool
+xf86PrivsElevated(void)
{
- static Bool privsTested = FALSE;
- static Bool privsElevated = TRUE;
+ static Bool privsTested = FALSE;
+ static Bool privsElevated = TRUE;
- if (!privsTested) {
+ if (!privsTested) {
#if defined(WIN32)
- privsElevated = FALSE;
+ privsElevated = FALSE;
#else
- if ((getuid() != geteuid()) || (getgid() != getegid())) {
- privsElevated = TRUE;
- } else {
+ if ((getuid() != geteuid()) || (getgid() != getegid())) {
+ privsElevated = TRUE;
+ }
+ else {
#if defined(HAVE_ISSETUGID)
- privsElevated = issetugid();
+ privsElevated = issetugid();
#elif defined(HAVE_GETRESUID)
- uid_t ruid, euid, suid;
- gid_t rgid, egid, sgid;
-
- if ((getresuid(&ruid, &euid, &suid) == 0) &&
- (getresgid(&rgid, &egid, &sgid) == 0)) {
- privsElevated = (euid != suid) || (egid != sgid);
- }
- else {
- printf("Failed getresuid or getresgid");
- /* Something went wrong, make defensive assumption */
- privsElevated = TRUE;
- }
+ uid_t ruid, euid, suid;
+ gid_t rgid, egid, sgid;
+
+ if ((getresuid(&ruid, &euid, &suid) == 0) &&
+ (getresgid(&rgid, &egid, &sgid) == 0)) {
+ privsElevated = (euid != suid) || (egid != sgid);
+ }
+ else {
+ printf("Failed getresuid or getresgid");
+ /* Something went wrong, make defensive assumption */
+ privsElevated = TRUE;
+ }
#else
- if (getuid()==0) {
- /* running as root: uid==euid==0 */
- privsElevated = FALSE;
- }
- else {
- /*
- * If there are saved ID's the process might still be privileged
- * even though the above test succeeded. If issetugid() and
- * getresgid() aren't available, test this by trying to set
- * euid to 0.
- */
- unsigned int oldeuid;
- oldeuid = geteuid();
-
- if (seteuid(0) != 0) {
- privsElevated = FALSE;
- } else {
- if (seteuid(oldeuid) != 0) {
- FatalError("Failed to drop privileges. Exiting\n");
- }
- privsElevated = TRUE;
+ if (getuid() == 0) {
+ /* running as root: uid==euid==0 */
+ privsElevated = FALSE;
+ }
+ else {
+ /*
+ * If there are saved ID's the process might still be privileged
+ * even though the above test succeeded. If issetugid() and
+ * getresgid() aren't available, test this by trying to set
+ * euid to 0.
+ */
+ unsigned int oldeuid;
+
+ oldeuid = geteuid();
+
+ if (seteuid(0) != 0) {
+ privsElevated = FALSE;
+ }
+ else {
+ if (seteuid(oldeuid) != 0) {
+ FatalError("Failed to drop privileges. Exiting\n");
+ }
+ privsElevated = TRUE;
+ }
+ }
+#endif
}
- }
#endif
+ privsTested = TRUE;
}
-#endif
- privsTested = TRUE;
- }
- return privsElevated;
+ return privsElevated;
}
static Bool
xf86CreateRootWindow(WindowPtr pWin)
{
- int ret = TRUE;
- int err = Success;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RootWinPropPtr pProp;
- CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
- dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
-
- DebugF("xf86CreateRootWindow(%p)\n", pWin);
-
- if ( pScreen->CreateWindow != xf86CreateRootWindow ) {
- /* Can't find hook we are hung on */
- xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */,
- "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n",
- (void *)xf86CreateRootWindow,
- (void *)pScreen->CreateWindow );
- }
-
- /* Unhook this function ... */
- pScreen->CreateWindow = CreateWindow;
- dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
-
- /* ... and call the previous CreateWindow fuction, if any */
- if (NULL!=pScreen->CreateWindow) {
- ret = (*pScreen->CreateWindow)(pWin);
- }
-
- /* Now do our stuff */
- if (xf86RegisteredPropertiesTable != NULL) {
- if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) {
- for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum];
- pProp != NULL && err==Success;
- pProp = pProp->next )
- {
- Atom prop;
-
- prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
- err = dixChangeWindowProperty(serverClient, pWin,
- prop, pProp->type,
- pProp->format, PropModeReplace,
- pProp->size, pProp->data,
- FALSE);
- }
-
- /* Look at err */
- ret &= (err==Success);
-
- } else {
- xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
- "non-root window %p (parent %p)\n",
- (void *)pWin, (void *)pWin->parent);
- ret = FALSE;
+ int ret = TRUE;
+ int err = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RootWinPropPtr pProp;
+ CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
+ dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
+
+ DebugF("xf86CreateRootWindow(%p)\n", pWin);
+
+ if (pScreen->CreateWindow != xf86CreateRootWindow) {
+ /* Can't find hook we are hung on */
+ xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */ ,
+ "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n",
+ (void *) xf86CreateRootWindow,
+ (void *) pScreen->CreateWindow);
}
- }
- DebugF("xf86CreateRootWindow() returns %d\n", ret);
- return ret;
-}
+ /* Unhook this function ... */
+ pScreen->CreateWindow = CreateWindow;
+ dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
+
+ /* ... and call the previous CreateWindow fuction, if any */
+ if (NULL != pScreen->CreateWindow) {
+ ret = (*pScreen->CreateWindow) (pWin);
+ }
+
+ /* Now do our stuff */
+ if (xf86RegisteredPropertiesTable != NULL) {
+ if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) {
+ for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum];
+ pProp != NULL && err == Success; pProp = pProp->next) {
+ Atom prop;
+
+ prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
+ err = dixChangeWindowProperty(serverClient, pWin,
+ prop, pProp->type,
+ pProp->format, PropModeReplace,
+ pProp->size, pProp->data, FALSE);
+ }
+
+ /* Look at err */
+ ret &= (err == Success);
+
+ }
+ else {
+ xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
+ "non-root window %p (parent %p)\n",
+ (void *) pWin, (void *) pWin->parent);
+ ret = FALSE;
+ }
+ }
+ DebugF("xf86CreateRootWindow() returns %d\n", ret);
+ return ret;
+}
static void
InstallSignalHandlers(void)
@@ -365,20 +367,21 @@ InstallSignalHandlers(void)
/*
* Install signal handler for unexpected signals
*/
- xf86Info.caughtSignal=FALSE;
+ xf86Info.caughtSignal = FALSE;
if (!xf86Info.notrapSignals) {
- OsRegisterSigWrapper(xf86SigWrapper);
- } else {
- signal(SIGSEGV, SIG_DFL);
- signal(SIGILL, SIG_DFL);
+ OsRegisterSigWrapper(xf86SigWrapper);
+ }
+ else {
+ signal(SIGSEGV, SIG_DFL);
+ signal(SIGILL, SIG_DFL);
#ifdef SIGEMT
- signal(SIGEMT, SIG_DFL);
+ signal(SIGEMT, SIG_DFL);
#endif
- signal(SIGFPE, SIG_DFL);
- signal(SIGBUS, SIG_DFL);
- signal(SIGSYS, SIG_DFL);
- signal(SIGXCPU, SIG_DFL);
- signal(SIGXFSZ, SIG_DFL);
+ signal(SIGFPE, SIG_DFL);
+ signal(SIGBUS, SIG_DFL);
+ signal(SIGSYS, SIG_DFL);
+ signal(SIGXCPU, SIG_DFL);
+ signal(SIGXFSZ, SIG_DFL);
}
}
@@ -389,485 +392,500 @@ InstallSignalHandlers(void)
* collecting the pixmap formats.
*/
void
-InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
+InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
{
- int i, j, k, scr_index, was_blocked = 0;
- char **modulelist;
- pointer *optionlist;
- Pix24Flags screenpix24, pix24;
- MessageType pix24From = X_DEFAULT;
- Bool pix24Fail = FALSE;
- Bool autoconfig = FALSE;
- GDevPtr configured_device;
-
- xf86Initialising = TRUE;
-
- if (serverGeneration == 1) {
- if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
- xf86ServerName++;
- else
- xf86ServerName = argv[0];
-
- xf86PrintBanner();
- xf86PrintMarkers();
- if (xf86LogFile) {
- time_t t;
- const char *ct;
- t = time(NULL);
- ct = ctime(&t);
- xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
- xf86LogFile, ct);
- }
-
- /* Read and parse the config file */
- if (!xf86DoConfigure && !xf86DoShowOptions) {
- switch (xf86HandleConfigFile(FALSE)) {
- case CONFIG_OK:
- break;
- case CONFIG_PARSE_ERROR:
- xf86Msg(X_ERROR, "Error parsing the config file\n");
- return;
- case CONFIG_NOFILE:
- autoconfig = TRUE;
- break;
- }
- }
+ int i, j, k, scr_index, was_blocked = 0;
+ char **modulelist;
+ pointer *optionlist;
+ Pix24Flags screenpix24, pix24;
+ MessageType pix24From = X_DEFAULT;
+ Bool pix24Fail = FALSE;
+ Bool autoconfig = FALSE;
+ GDevPtr configured_device;
+
+ xf86Initialising = TRUE;
+
+ if (serverGeneration == 1) {
+ if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
+ xf86ServerName++;
+ else
+ xf86ServerName = argv[0];
+
+ xf86PrintBanner();
+ xf86PrintMarkers();
+ if (xf86LogFile) {
+ time_t t;
+ const char *ct;
+
+ t = time(NULL);
+ ct = ctime(&t);
+ xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
+ xf86LogFile, ct);
+ }
- InstallSignalHandlers();
+ /* Read and parse the config file */
+ if (!xf86DoConfigure && !xf86DoShowOptions) {
+ switch (xf86HandleConfigFile(FALSE)) {
+ case CONFIG_OK:
+ break;
+ case CONFIG_PARSE_ERROR:
+ xf86Msg(X_ERROR, "Error parsing the config file\n");
+ return;
+ case CONFIG_NOFILE:
+ autoconfig = TRUE;
+ break;
+ }
+ }
- /* Initialise the loader */
- LoaderInit();
+ InstallSignalHandlers();
- /* Tell the loader the default module search path */
- LoaderSetPath(xf86ModulePath);
+ /* Initialise the loader */
+ LoaderInit();
- if (xf86Info.ignoreABI) {
- LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
- }
+ /* Tell the loader the default module search path */
+ LoaderSetPath(xf86ModulePath);
- if (xf86DoShowOptions)
- DoShowOptions();
+ if (xf86Info.ignoreABI) {
+ LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
+ }
- /* Do a general bus probe. This will be a PCI probe for x86 platforms */
- xf86BusProbe();
+ if (xf86DoShowOptions)
+ DoShowOptions();
- if (xf86DoConfigure)
- DoConfigure();
+ /* Do a general bus probe. This will be a PCI probe for x86 platforms */
+ xf86BusProbe();
- if (autoconfig) {
- if (!xf86AutoConfig()) {
- xf86Msg(X_ERROR, "Auto configuration failed\n");
- return;
- }
- }
+ if (xf86DoConfigure)
+ DoConfigure();
+
+ if (autoconfig) {
+ if (!xf86AutoConfig()) {
+ xf86Msg(X_ERROR, "Auto configuration failed\n");
+ return;
+ }
+ }
#ifdef XF86PM
- xf86OSPMClose = xf86OSPMOpen();
+ xf86OSPMClose = xf86OSPMOpen();
#endif
- /* Load all modules specified explicitly in the config file */
- if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
- xf86LoadModules(modulelist, optionlist);
- free(modulelist);
- free(optionlist);
- }
+ /* Load all modules specified explicitly in the config file */
+ if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
+ xf86LoadModules(modulelist, optionlist);
+ free(modulelist);
+ free(optionlist);
+ }
- /* Load all driver modules specified in the config file */
- /* If there aren't any specified in the config file, autoconfig them */
- /* FIXME: Does not handle multiple active screen sections, but I'm not
- * sure if we really want to handle that case*/
- configured_device = xf86ConfigLayout.screens->screen->device;
- if ((!configured_device) || (!configured_device->driver)) {
- if (!autoConfigDevice(configured_device)) {
- xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
- return ;
+ /* Load all driver modules specified in the config file */
+ /* If there aren't any specified in the config file, autoconfig them */
+ /* FIXME: Does not handle multiple active screen sections, but I'm not
+ * sure if we really want to handle that case*/
+ configured_device = xf86ConfigLayout.screens->screen->device;
+ if ((!configured_device) || (!configured_device->driver)) {
+ if (!autoConfigDevice(configured_device)) {
+ xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
+ return;
+ }
+ }
+ if ((modulelist = xf86DriverlistFromConfig())) {
+ xf86LoadModules(modulelist, NULL);
+ free(modulelist);
}
- }
- if ((modulelist = xf86DriverlistFromConfig())) {
- xf86LoadModules(modulelist, NULL);
- free(modulelist);
- }
- /* Load all input driver modules specified in the config file. */
- if ((modulelist = xf86InputDriverlistFromConfig())) {
- xf86LoadModules(modulelist, NULL);
- free(modulelist);
- }
+ /* Load all input driver modules specified in the config file. */
+ if ((modulelist = xf86InputDriverlistFromConfig())) {
+ xf86LoadModules(modulelist, NULL);
+ free(modulelist);
+ }
- /*
- * It is expected that xf86AddDriver()/xf86AddInputDriver will be
- * called for each driver as it is loaded. Those functions save the
- * module pointers for drivers.
- * XXX Nothing keeps track of them for other modules.
- */
- /* XXX What do we do if not all of these could be loaded? */
+ /*
+ * It is expected that xf86AddDriver()/xf86AddInputDriver will be
+ * called for each driver as it is loaded. Those functions save the
+ * module pointers for drivers.
+ * XXX Nothing keeps track of them for other modules.
+ */
+ /* XXX What do we do if not all of these could be loaded? */
- /*
- * At this point, xf86DriverList[] is all filled in with entries for
- * each of the drivers to try and xf86NumDrivers has the number of
- * drivers. If there are none, return now.
- */
+ /*
+ * At this point, xf86DriverList[] is all filled in with entries for
+ * each of the drivers to try and xf86NumDrivers has the number of
+ * drivers. If there are none, return now.
+ */
- if (xf86NumDrivers == 0) {
- xf86Msg(X_ERROR, "No drivers available.\n");
- return;
- }
+ if (xf86NumDrivers == 0) {
+ xf86Msg(X_ERROR, "No drivers available.\n");
+ return;
+ }
- /*
- * Call each of the Identify functions and call the driverFunc to check
- * if HW access is required. The Identify functions print out some
- * identifying information, and anything else that might be
- * needed at this early stage.
- */
+ /*
+ * Call each of the Identify functions and call the driverFunc to check
+ * if HW access is required. The Identify functions print out some
+ * identifying information, and anything else that might be
+ * needed at this early stage.
+ */
- for (i = 0; i < xf86NumDrivers; i++) {
- if (xf86DriverList[i]->Identify != NULL)
- xf86DriverList[i]->Identify(0);
-
- if (!xorgHWAccess || !xorgHWOpenConsole) {
- xorgHWFlags flags;
- if(!xf86DriverList[i]->driverFunc
- || !xf86DriverList[i]->driverFunc(NULL,
- GET_REQUIRED_HW_INTERFACES,
- &flags))
- flags = HW_IO;
-
- if(NEED_IO_ENABLED(flags))
- xorgHWAccess = TRUE;
- if(!(flags & HW_SKIP_CONSOLE))
- xorgHWOpenConsole = TRUE;
- }
- }
+ for (i = 0; i < xf86NumDrivers; i++) {
+ if (xf86DriverList[i]->Identify != NULL)
+ xf86DriverList[i]->Identify(0);
- if (xorgHWOpenConsole)
- xf86OpenConsole();
- else
- xf86Info.dontVTSwitch = TRUE;
+ if (!xorgHWAccess || !xorgHWOpenConsole) {
+ xorgHWFlags flags;
- if (xf86BusConfig() == FALSE)
- return;
+ if (!xf86DriverList[i]->driverFunc
+ || !xf86DriverList[i]->driverFunc(NULL,
+ GET_REQUIRED_HW_INTERFACES,
+ &flags))
+ flags = HW_IO;
- xf86PostProbe();
+ if (NEED_IO_ENABLED(flags))
+ xorgHWAccess = TRUE;
+ if (!(flags & HW_SKIP_CONSOLE))
+ xorgHWOpenConsole = TRUE;
+ }
+ }
- /*
- * Sort the drivers to match the requested ording. Using a slow
- * bubble sort.
- */
- for (j = 0; j < xf86NumScreens - 1; j++) {
- for (i = 0; i < xf86NumScreens - j - 1; i++) {
- if (xf86Screens[i + 1]->confScreen->screennum <
- xf86Screens[i]->confScreen->screennum) {
- ScrnInfoPtr tmpScrn = xf86Screens[i + 1];
- xf86Screens[i + 1] = xf86Screens[i];
- xf86Screens[i] = tmpScrn;
- }
- }
- }
- /* Fix up the indexes */
- for (i = 0; i < xf86NumScreens; i++) {
- xf86Screens[i]->scrnIndex = i;
- }
+ if (xorgHWOpenConsole)
+ xf86OpenConsole();
+ else
+ xf86Info.dontVTSwitch = TRUE;
- /*
- * Call the driver's PreInit()'s to complete initialisation for the first
- * generation.
- */
+ if (xf86BusConfig() == FALSE)
+ return;
- for (i = 0; i < xf86NumScreens; i++) {
- xf86VGAarbiterScrnInit(xf86Screens[i]);
- xf86VGAarbiterLock(xf86Screens[i]);
- if (xf86Screens[i]->PreInit &&
- xf86Screens[i]->PreInit(xf86Screens[i], 0))
- xf86Screens[i]->configured = TRUE;
- xf86VGAarbiterUnlock(xf86Screens[i]);
- }
- for (i = 0; i < xf86NumScreens; i++)
- if (!xf86Screens[i]->configured)
- xf86DeleteScreen(i--, 0);
+ xf86PostProbe();
- /*
- * If no screens left, return now.
- */
+ /*
+ * Sort the drivers to match the requested ording. Using a slow
+ * bubble sort.
+ */
+ for (j = 0; j < xf86NumScreens - 1; j++) {
+ for (i = 0; i < xf86NumScreens - j - 1; i++) {
+ if (xf86Screens[i + 1]->confScreen->screennum <
+ xf86Screens[i]->confScreen->screennum) {
+ ScrnInfoPtr tmpScrn = xf86Screens[i + 1];
+
+ xf86Screens[i + 1] = xf86Screens[i];
+ xf86Screens[i] = tmpScrn;
+ }
+ }
+ }
+ /* Fix up the indexes */
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->scrnIndex = i;
+ }
- if (xf86NumScreens == 0) {
- xf86Msg(X_ERROR,
- "Screen(s) found, but none have a usable configuration.\n");
- return;
- }
+ /*
+ * Call the driver's PreInit()'s to complete initialisation for the first
+ * generation.
+ */
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->name == NULL) {
- XNFasprintf(&xf86Screens[i]->name, "screen%d", i);
- xf86MsgVerb(X_WARNING, 0,
- "Screen driver %d has no name set, using `%s'.\n",
- i, xf86Screens[i]->name);
- }
- }
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86VGAarbiterScrnInit(xf86Screens[i]);
+ xf86VGAarbiterLock(xf86Screens[i]);
+ if (xf86Screens[i]->PreInit &&
+ xf86Screens[i]->PreInit(xf86Screens[i], 0))
+ xf86Screens[i]->configured = TRUE;
+ xf86VGAarbiterUnlock(xf86Screens[i]);
+ }
+ for (i = 0; i < xf86NumScreens; i++)
+ if (!xf86Screens[i]->configured)
+ xf86DeleteScreen(i--, 0);
- /* Remove (unload) drivers that are not required */
- for (i = 0; i < xf86NumDrivers; i++)
- if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
- xf86DeleteDriver(i);
+ /*
+ * If no screens left, return now.
+ */
- /*
- * At this stage we know how many screens there are.
- */
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR,
+ "Screen(s) found, but none have a usable configuration.\n");
+ return;
+ }
- for (i = 0; i < xf86NumScreens; i++)
- xf86InitViewport(xf86Screens[i]);
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->name == NULL) {
+ XNFasprintf(&xf86Screens[i]->name, "screen%d", i);
+ xf86MsgVerb(X_WARNING, 0,
+ "Screen driver %d has no name set, using `%s'.\n",
+ i, xf86Screens[i]->name);
+ }
+ }
- /*
- * Collect all pixmap formats and check for conflicts at the display
- * level. Should we die here? Or just delete the offending screens?
- */
- screenpix24 = Pix24DontCare;
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->imageByteOrder !=
- xf86Screens[0]->imageByteOrder)
- FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
- if (xf86Screens[i]->bitmapScanlinePad !=
- xf86Screens[0]->bitmapScanlinePad)
- FatalError("Inconsistent display bitmapScanlinePad. Exiting\n");
- if (xf86Screens[i]->bitmapScanlineUnit !=
- xf86Screens[0]->bitmapScanlineUnit)
- FatalError("Inconsistent display bitmapScanlineUnit. Exiting\n");
- if (xf86Screens[i]->bitmapBitOrder !=
- xf86Screens[0]->bitmapBitOrder)
- FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
-
- /* Determine the depth 24 pixmap format the screens would like */
- if (xf86Screens[i]->pixmap24 != Pix24DontCare) {
- if (screenpix24 == Pix24DontCare)
- screenpix24 = xf86Screens[i]->pixmap24;
- else if (screenpix24 != xf86Screens[i]->pixmap24)
- FatalError("Inconsistent depth 24 pixmap format. Exiting\n");
- }
- }
- /* check if screenpix24 is consistent with the config/cmdline */
- if (xf86Info.pixmap24 != Pix24DontCare) {
- pix24 = xf86Info.pixmap24;
- pix24From = xf86Info.pix24From;
- if (screenpix24 != Pix24DontCare && screenpix24 != xf86Info.pixmap24)
- pix24Fail = TRUE;
- } else if (screenpix24 != Pix24DontCare) {
- pix24 = screenpix24;
- pix24From = X_PROBED;
- } else
- pix24 = Pix24Use32;
-
- if (pix24Fail)
- FatalError("Screen(s) can't use the required depth 24 pixmap format"
- " (%d). Exiting\n", PIX24TOBPP(pix24));
-
- /* Initialise the depth 24 format */
- for (j = 0; j < numFormats && formats[j].depth != 24; j++)
- ;
- formats[j].bitsPerPixel = PIX24TOBPP(pix24);
-
- /* Collect additional formats */
- for (i = 0; i < xf86NumScreens; i++) {
- for (j = 0; j < xf86Screens[i]->numFormats; j++) {
- for (k = 0; ; k++) {
- if (k >= numFormats) {
- if (k >= MAXFORMATS)
- FatalError("Too many pixmap formats! Exiting\n");
- formats[k] = xf86Screens[i]->formats[j];
- numFormats++;
- break;
- }
- if (formats[k].depth == xf86Screens[i]->formats[j].depth) {
- if ((formats[k].bitsPerPixel ==
- xf86Screens[i]->formats[j].bitsPerPixel) &&
- (formats[k].scanlinePad ==
- xf86Screens[i]->formats[j].scanlinePad))
- break;
- FatalError("Inconsistent pixmap format for depth %d."
- " Exiting\n", formats[k].depth);
- }
- }
- }
- }
- formatsDone = TRUE;
+ /* Remove (unload) drivers that are not required */
+ for (i = 0; i < xf86NumDrivers; i++)
+ if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
+ xf86DeleteDriver(i);
- if (xf86Info.vtno >= 0 ) {
-#define VT_ATOM_NAME "XFree86_VT"
- Atom VTAtom=-1;
- CARD32 *VT = NULL;
- int ret;
-
- /* This memory needs to stay available until the screen has been
- initialized, and we can create the property for real.
- */
- if ( (VT = malloc(sizeof(CARD32)))==NULL ) {
- FatalError("Unable to make VT property - out of memory. Exiting...\n");
- }
- *VT = xf86Info.vtno;
-
- VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
-
- for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) {
- ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
- VTAtom, XA_INTEGER, 32,
- 1, VT );
- if (ret != Success)
- xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
- "Failed to register VT property\n");
- }
- }
+ /*
+ * At this stage we know how many screens there are.
+ */
+
+ for (i = 0; i < xf86NumScreens; i++)
+ xf86InitViewport(xf86Screens[i]);
+
+ /*
+ * Collect all pixmap formats and check for conflicts at the display
+ * level. Should we die here? Or just delete the offending screens?
+ */
+ screenpix24 = Pix24DontCare;
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->imageByteOrder !=
+ xf86Screens[0]->imageByteOrder)
+ FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
+ if (xf86Screens[i]->bitmapScanlinePad !=
+ xf86Screens[0]->bitmapScanlinePad)
+ FatalError
+ ("Inconsistent display bitmapScanlinePad. Exiting\n");
+ if (xf86Screens[i]->bitmapScanlineUnit !=
+ xf86Screens[0]->bitmapScanlineUnit)
+ FatalError
+ ("Inconsistent display bitmapScanlineUnit. Exiting\n");
+ if (xf86Screens[i]->bitmapBitOrder !=
+ xf86Screens[0]->bitmapBitOrder)
+ FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
+
+ /* Determine the depth 24 pixmap format the screens would like */
+ if (xf86Screens[i]->pixmap24 != Pix24DontCare) {
+ if (screenpix24 == Pix24DontCare)
+ screenpix24 = xf86Screens[i]->pixmap24;
+ else if (screenpix24 != xf86Screens[i]->pixmap24)
+ FatalError
+ ("Inconsistent depth 24 pixmap format. Exiting\n");
+ }
+ }
+ /* check if screenpix24 is consistent with the config/cmdline */
+ if (xf86Info.pixmap24 != Pix24DontCare) {
+ pix24 = xf86Info.pixmap24;
+ pix24From = xf86Info.pix24From;
+ if (screenpix24 != Pix24DontCare &&
+ screenpix24 != xf86Info.pixmap24)
+ pix24Fail = TRUE;
+ }
+ else if (screenpix24 != Pix24DontCare) {
+ pix24 = screenpix24;
+ pix24From = X_PROBED;
+ }
+ else
+ pix24 = Pix24Use32;
- if (SeatId) {
- Atom SeatAtom;
+ if (pix24Fail)
+ FatalError("Screen(s) can't use the required depth 24 pixmap format"
+ " (%d). Exiting\n", PIX24TOBPP(pix24));
- SeatAtom = MakeAtom(SEAT_ATOM_NAME, sizeof(SEAT_ATOM_NAME) - 1, TRUE);
+ /* Initialise the depth 24 format */
+ for (j = 0; j < numFormats && formats[j].depth != 24; j++);
+ formats[j].bitsPerPixel = PIX24TOBPP(pix24);
+ /* Collect additional formats */
for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numFormats; j++) {
+ for (k = 0;; k++) {
+ if (k >= numFormats) {
+ if (k >= MAXFORMATS)
+ FatalError("Too many pixmap formats! Exiting\n");
+ formats[k] = xf86Screens[i]->formats[j];
+ numFormats++;
+ break;
+ }
+ if (formats[k].depth == xf86Screens[i]->formats[j].depth) {
+ if ((formats[k].bitsPerPixel ==
+ xf86Screens[i]->formats[j].bitsPerPixel) &&
+ (formats[k].scanlinePad ==
+ xf86Screens[i]->formats[j].scanlinePad))
+ break;
+ FatalError("Inconsistent pixmap format for depth %d."
+ " Exiting\n", formats[k].depth);
+ }
+ }
+ }
+ }
+ formatsDone = TRUE;
+
+ if (xf86Info.vtno >= 0) {
+#define VT_ATOM_NAME "XFree86_VT"
+ Atom VTAtom = -1;
+ CARD32 *VT = NULL;
int ret;
- ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
- SeatAtom, XA_STRING, 8,
- strlen(SeatId)+1, SeatId );
- if (ret != Success) {
- xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
- "Failed to register seat property\n");
+ /* This memory needs to stay available until the screen has been
+ initialized, and we can create the property for real.
+ */
+ if ((VT = malloc(sizeof(CARD32))) == NULL) {
+ FatalError
+ ("Unable to make VT property - out of memory. Exiting...\n");
+ }
+ *VT = xf86Info.vtno;
+
+ VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
+
+ for (i = 0, ret = Success; i < xf86NumScreens && ret == Success;
+ i++) {
+ ret =
+ xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
+ VTAtom, XA_INTEGER, 32, 1,
+ VT);
+ if (ret != Success)
+ xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
+ "Failed to register VT property\n");
+ }
+ }
+
+ if (SeatId) {
+ Atom SeatAtom;
+
+ SeatAtom =
+ MakeAtom(SEAT_ATOM_NAME, sizeof(SEAT_ATOM_NAME) - 1, TRUE);
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ int ret;
+
+ ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
+ SeatAtom, XA_STRING, 8,
+ strlen(SeatId) + 1,
+ SeatId);
+ if (ret != Success) {
+ xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
+ "Failed to register seat property\n");
+ }
+ }
+ }
+
+ /* If a screen uses depth 24, show what the pixmap format is */
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->depth == 24) {
+ xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n",
+ PIX24TOBPP(pix24));
+ break;
}
}
}
+ else {
+ /*
+ * serverGeneration != 1; some OSs have to do things here, too.
+ */
+ if (xorgHWOpenConsole)
+ xf86OpenConsole();
- /* If a screen uses depth 24, show what the pixmap format is */
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->depth == 24) {
- xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n",
- PIX24TOBPP(pix24));
- break;
- }
+#ifdef XF86PM
+ /*
+ should we reopen it here? We need to deal with an already opened
+ device. We could leave this to the OS layer. For now we simply
+ close it here
+ */
+ if (xf86OSPMClose)
+ xf86OSPMClose();
+ if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
+ xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
+#endif
+
+ /* Make sure full I/O access is enabled */
+ if (xorgHWAccess)
+ xf86EnableIO();
}
- } else {
+
/*
- * serverGeneration != 1; some OSs have to do things here, too.
+ * Use the previously collected parts to setup pScreenInfo
*/
- if (xorgHWOpenConsole)
- xf86OpenConsole();
-#ifdef XF86PM
- /*
- should we reopen it here? We need to deal with an already opened
- device. We could leave this to the OS layer. For now we simply
- close it here
- */
- if (xf86OSPMClose)
- xf86OSPMClose();
- if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
- xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
-#endif
+ pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder;
+ pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad;
+ pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit;
+ pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder;
+ pScreenInfo->numPixmapFormats = numFormats;
+ for (i = 0; i < numFormats; i++)
+ pScreenInfo->formats[i] = formats[i];
- /* Make sure full I/O access is enabled */
- if (xorgHWAccess)
- xf86EnableIO();
- }
-
- /*
- * Use the previously collected parts to setup pScreenInfo
- */
-
- pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder;
- pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad;
- pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit;
- pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder;
- pScreenInfo->numPixmapFormats = numFormats;
- for (i = 0; i < numFormats; i++)
- pScreenInfo->formats[i] = formats[i];
-
- /* Make sure the server's VT is active */
-
- if (serverGeneration != 1) {
- xf86Resetting = TRUE;
- /* All screens are in the same state, so just check the first */
- if (!xf86Screens[0]->vtSema) {
+ /* Make sure the server's VT is active */
+
+ if (serverGeneration != 1) {
+ xf86Resetting = TRUE;
+ /* All screens are in the same state, so just check the first */
+ if (!xf86Screens[0]->vtSema) {
#ifdef HAS_USL_VTS
- ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
+ ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
#endif
- xf86AccessEnter();
- was_blocked = xf86BlockSIGIO();
+ xf86AccessEnter();
+ was_blocked = xf86BlockSIGIO();
+ }
}
- }
-
- for (i = 0; i < xf86NumScreens; i++)
- if (!xf86ColormapAllocatePrivates(xf86Screens[i]))
- FatalError("Cannot register DDX private keys");
-
- if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0) ||
- !dixRegisterPrivateKey(&xf86CreateRootWindowKeyRec, PRIVATE_SCREEN, 0))
- FatalError("Cannot register DDX private keys");
-
- for (i = 0; i < xf86NumScreens; i++) {
- xf86VGAarbiterLock(xf86Screens[i]);
- /*
- * Almost everything uses these defaults, and many of those that
- * don't, will wrap them.
- */
- xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
+
+ for (i = 0; i < xf86NumScreens; i++)
+ if (!xf86ColormapAllocatePrivates(xf86Screens[i]))
+ FatalError("Cannot register DDX private keys");
+
+ if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0) ||
+ !dixRegisterPrivateKey(&xf86CreateRootWindowKeyRec, PRIVATE_SCREEN, 0))
+ FatalError("Cannot register DDX private keys");
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86VGAarbiterLock(xf86Screens[i]);
+ /*
+ * Almost everything uses these defaults, and many of those that
+ * don't, will wrap them.
+ */
+ xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
#ifdef XFreeXDGA
- xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
+ xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
#endif
- xf86Screens[i]->DPMSSet = NULL;
- xf86Screens[i]->LoadPalette = NULL;
- xf86Screens[i]->SetOverscan = NULL;
- xf86Screens[i]->DriverFunc = NULL;
- xf86Screens[i]->pScreen = NULL;
- scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
- xf86VGAarbiterUnlock(xf86Screens[i]);
- if (scr_index == i) {
- /*
- * Hook in our ScrnInfoRec, and initialise some other pScreen
- * fields.
- */
- dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
- xf86ScreenKey, xf86Screens[i]);
- xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
- /* The driver should set this, but make sure it is set anyway */
- xf86Screens[i]->vtSema = TRUE;
- } else {
- /* This shouldn't normally happen */
- FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
- }
-
- DebugF("InitOutput - xf86Screens[%d]->pScreen = %p\n",
- i, xf86Screens[i]->pScreen );
- DebugF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
- i, xf86Screens[i]->pScreen->CreateWindow );
-
- dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
- xf86CreateRootWindowKey,
- xf86Screens[i]->pScreen->CreateWindow);
- xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
-
- if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown)
- {
- xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC);
- PictureSetSubpixelOrder (xf86Screens[i]->pScreen,
- DDC ?
- (DDC->features.input_type ?
- SubPixelHorizontalRGB : SubPixelNone) :
- SubPixelUnknown);
- }
+ xf86Screens[i]->DPMSSet = NULL;
+ xf86Screens[i]->LoadPalette = NULL;
+ xf86Screens[i]->SetOverscan = NULL;
+ xf86Screens[i]->DriverFunc = NULL;
+ xf86Screens[i]->pScreen = NULL;
+ scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
+ xf86VGAarbiterUnlock(xf86Screens[i]);
+ if (scr_index == i) {
+ /*
+ * Hook in our ScrnInfoRec, and initialise some other pScreen
+ * fields.
+ */
+ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
+ xf86ScreenKey, xf86Screens[i]);
+ xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
+ /* The driver should set this, but make sure it is set anyway */
+ xf86Screens[i]->vtSema = TRUE;
+ }
+ else {
+ /* This shouldn't normally happen */
+ FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
+ }
+
+ DebugF("InitOutput - xf86Screens[%d]->pScreen = %p\n",
+ i, xf86Screens[i]->pScreen);
+ DebugF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
+ i, xf86Screens[i]->pScreen->CreateWindow);
+
+ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
+ xf86CreateRootWindowKey,
+ xf86Screens[i]->pScreen->CreateWindow);
+ xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
+
+ if (PictureGetSubpixelOrder(xf86Screens[i]->pScreen) == SubPixelUnknown) {
+ xf86MonPtr DDC = (xf86MonPtr) (xf86Screens[i]->monitor->DDC);
+
+ PictureSetSubpixelOrder(xf86Screens[i]->pScreen,
+ DDC ?
+ (DDC->features.input_type ?
+ SubPixelHorizontalRGB : SubPixelNone) :
+ SubPixelUnknown);
+ }
#ifdef RANDR
- if (!xf86Info.disableRandR)
- xf86RandRInit (screenInfo.screens[scr_index]);
- xf86Msg(xf86Info.randRFrom, "RandR %s\n",
- xf86Info.disableRandR ? "disabled" : "enabled");
+ if (!xf86Info.disableRandR)
+ xf86RandRInit(screenInfo.screens[scr_index]);
+ xf86Msg(xf86Info.randRFrom, "RandR %s\n",
+ xf86Info.disableRandR ? "disabled" : "enabled");
#endif
- }
+ }
- xf86VGAarbiterWrapFunctions();
- xf86UnblockSIGIO(was_blocked);
+ xf86VGAarbiterWrapFunctions();
+ xf86UnblockSIGIO(was_blocked);
- xf86InitOrigins();
+ xf86InitOrigins();
- xf86Resetting = FALSE;
- xf86Initialising = FALSE;
+ xf86Resetting = FALSE;
+ xf86Initialising = FALSE;
- RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup,
- NULL);
+ RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr) NoopDDA, xf86Wakeup,
+ NULL);
}
/**
@@ -877,7 +895,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput(int argc, char **argv)
{
- InputInfoPtr* pInfo;
+ InputInfoPtr *pInfo;
DeviceIntPtr dev;
xf86Info.vtRequestsPending = FALSE;
@@ -886,8 +904,10 @@ InitInput(int argc, char **argv)
/* Initialize all configured input devices */
for (pInfo = xf86ConfigLayout.inputs; pInfo && *pInfo; pInfo++) {
- (*pInfo)->options = xf86AddNewOption((*pInfo)->options, "driver", (*pInfo)->driver);
- (*pInfo)->options = xf86AddNewOption((*pInfo)->options, "identifier", (*pInfo)->name);
+ (*pInfo)->options =
+ xf86AddNewOption((*pInfo)->options, "driver", (*pInfo)->driver);
+ (*pInfo)->options =
+ xf86AddNewOption((*pInfo)->options, "identifier", (*pInfo)->name);
/* If one fails, the others will too */
if (NewInputDeviceRequest((*pInfo)->options, NULL, &dev) == BadAlloc)
break;
@@ -897,7 +917,7 @@ InitInput(int argc, char **argv)
}
void
-CloseInput (void)
+CloseInput(void)
{
config_fini();
mieqFini();
@@ -912,16 +932,16 @@ CloseInput (void)
void
OsVendorInit(void)
{
- static Bool beenHere = FALSE;
+ static Bool beenHere = FALSE;
- signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
+ signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
- if (!beenHere) {
- umask(022);
- xf86LogInit();
- }
+ if (!beenHere) {
+ umask(022);
+ xf86LogInit();
+ }
- /* Set stderr to non-blocking. */
+ /* Set stderr to non-blocking. */
#ifndef O_NONBLOCK
#if defined(FNDELAY)
#define O_NONBLOCK FNDELAY
@@ -930,21 +950,20 @@ OsVendorInit(void)
#endif
#ifdef O_NONBLOCK
- if (!beenHere) {
- if (xf86PrivsElevated())
- {
- int status;
+ if (!beenHere) {
+ if (xf86PrivsElevated()) {
+ int status;
- status = fcntl(fileno(stderr), F_GETFL, 0);
- if (status != -1) {
- fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK);
- }
+ status = fcntl(fileno(stderr), F_GETFL, 0);
+ if (status != -1) {
+ fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK);
+ }
+ }
}
- }
#endif
#endif
- beenHere = TRUE;
+ beenHere = TRUE;
}
/*
@@ -963,16 +982,16 @@ ddxGiveUp(enum ExitCode error)
#ifdef XF86PM
if (xf86OSPMClose)
- xf86OSPMClose();
+ xf86OSPMClose();
xf86OSPMClose = NULL;
#endif
for (i = 0; i < xf86NumScreens; i++) {
- /*
- * zero all access functions to
- * trap calls when switched away.
- */
- xf86Screens[i]->vtSema = FALSE;
+ /*
+ * zero all access functions to
+ * trap calls when switched away.
+ */
+ xf86Screens[i]->vtSema = FALSE;
}
#ifdef XFreeXDGA
@@ -980,17 +999,15 @@ ddxGiveUp(enum ExitCode error)
#endif
if (xorgHWOpenConsole)
- xf86CloseConsole();
+ xf86CloseConsole();
xf86CloseLog(error);
/* If an unexpected signal was caught, dump a core for debugging */
if (xf86Info.caughtSignal)
- OsAbort();
+ OsAbort();
}
-
-
/*
* AbortDDX --
* DDX - specific abort routine. Called by AbortServer(). The attempt is
@@ -1001,38 +1018,38 @@ ddxGiveUp(enum ExitCode error)
void
AbortDDX(enum ExitCode error)
{
- int i;
+ int i;
- xf86BlockSIGIO();
+ xf86BlockSIGIO();
- /*
- * try to restore the original video state
- */
-#ifdef DPMSExtension /* Turn screens back on */
- if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(serverClient, DPMSModeOn);
+ /*
+ * try to restore the original video state
+ */
+#ifdef DPMSExtension /* Turn screens back on */
+ if (DPMSPowerLevel != DPMSModeOn)
+ DPMSSet(serverClient, DPMSModeOn);
#endif
- if (xf86Screens) {
- for (i = 0; i < xf86NumScreens; i++)
- if (xf86Screens[i]->vtSema) {
- /*
- * if we are aborting before ScreenInit() has finished
- * we might not have been wrapped yet. Therefore enable
- * screen explicitely.
- */
- xf86VGAarbiterLock(xf86Screens[i]);
- (xf86Screens[i]->LeaveVT)(i, 0);
- xf86VGAarbiterUnlock(xf86Screens[i]);
- }
- }
-
- xf86AccessLeave();
-
- /*
- * This is needed for an abnormal server exit, since the normal exit stuff
- * MUST also be performed (i.e. the vt must be left in a defined state)
- */
- ddxGiveUp(error);
+ if (xf86Screens) {
+ for (i = 0; i < xf86NumScreens; i++)
+ if (xf86Screens[i]->vtSema) {
+ /*
+ * if we are aborting before ScreenInit() has finished
+ * we might not have been wrapped yet. Therefore enable
+ * screen explicitely.
+ */
+ xf86VGAarbiterLock(xf86Screens[i]);
+ (xf86Screens[i]->LeaveVT) (i, 0);
+ xf86VGAarbiterUnlock(xf86Screens[i]);
+ }
+ }
+
+ xf86AccessLeave();
+
+ /*
+ * This is needed for an abnormal server exit, since the normal exit stuff
+ * MUST also be performed (i.e. the vt must be left in a defined state)
+ */
+ ddxGiveUp(error);
}
void
@@ -1040,14 +1057,14 @@ OsVendorFatalError(void)
{
#ifdef VENDORSUPPORT
ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
- "at %s for support on this crash.\n",VENDORSUPPORT);
+ "at %s for support on this crash.\n", VENDORSUPPORT);
#else
- ErrorF("\nPlease consult the "XVENDORNAME" support \n"
- "\t at "__VENDORDWEBSUPPORT__"\n for help. \n");
+ ErrorF("\nPlease consult the " XVENDORNAME " support \n"
+ "\t at " __VENDORDWEBSUPPORT__ "\n for help. \n");
#endif
if (xf86LogFile && xf86LogFileWasOpened)
- ErrorF("Please also check the log file at \"%s\" for additional "
- "information.\n", xf86LogFile);
+ ErrorF("Please also check the log file at \"%s\" for additional "
+ "information.\n", xf86LogFile);
ErrorF("\n");
}
@@ -1074,13 +1091,13 @@ xf86SetLogVerbosity(int verb)
static void
xf86PrintDefaultModulePath(void)
{
- ErrorF("%s\n", DEFAULT_MODULE_PATH);
+ ErrorF("%s\n", DEFAULT_MODULE_PATH);
}
static void
xf86PrintDefaultLibraryPath(void)
{
- ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
+ ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
}
/*
@@ -1102,325 +1119,289 @@ ddxProcessArgument(int argc, char **argv, int i)
FatalError("Required argument to %s not specified\n", argv[i]); \
}
- /* First the options that are not allowed with elevated privileges */
- if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
- if (xf86PrivsElevated()) {
- FatalError("The '%s' option cannot be used with "
- "elevated privileges.\n", argv[i]);
- }
- else if (!strcmp(argv[i], "-modulepath"))
- {
- char *mp;
- CHECK_FOR_REQUIRED_ARGUMENT();
- mp = strdup(argv[i + 1]);
- if (!mp)
- FatalError("Can't allocate memory for ModulePath\n");
- xf86ModulePath = mp;
- xf86ModPathFrom = X_CMDLINE;
- return 2;
+ /* First the options that are not allowed with elevated privileges */
+ if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
+ if (xf86PrivsElevated()) {
+ FatalError("The '%s' option cannot be used with "
+ "elevated privileges.\n", argv[i]);
+ }
+ else if (!strcmp(argv[i], "-modulepath")) {
+ char *mp;
+
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ mp = strdup(argv[i + 1]);
+ if (!mp)
+ FatalError("Can't allocate memory for ModulePath\n");
+ xf86ModulePath = mp;
+ xf86ModPathFrom = X_CMDLINE;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "-logfile")) {
+ char *lf;
+
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ lf = strdup(argv[i + 1]);
+ if (!lf)
+ FatalError("Can't allocate memory for LogFile\n");
+ xf86LogFile = lf;
+ xf86LogFileFrom = X_CMDLINE;
+ return 2;
+ }
}
- else if (!strcmp(argv[i], "-logfile"))
- {
- char *lf;
- CHECK_FOR_REQUIRED_ARGUMENT();
- lf = strdup(argv[i + 1]);
- if (!lf)
- FatalError("Can't allocate memory for LogFile\n");
- xf86LogFile = lf;
- xf86LogFileFrom = X_CMDLINE;
- return 2;
+ if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) {
+ FatalError("\nInvalid argument for %s\n"
+ "\tWith elevated privileges, the file specified with %s must be\n"
+ "\ta relative path and must not contain any \"..\" elements.\n"
+ "\tUsing default " __XCONFIGFILE__ " search path.\n\n",
+ argv[i], argv[i]);
+ }
+ xf86ConfigFile = argv[i + 1];
+ return 2;
}
- }
- if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) {
- FatalError("\nInvalid argument for %s\n"
- "\tWith elevated privileges, the file specified with %s must be\n"
- "\ta relative path and must not contain any \"..\" elements.\n"
- "\tUsing default "__XCONFIGFILE__" search path.\n\n",
- argv[i], argv[i]);
+ if (!strcmp(argv[i], "-configdir")) {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) {
+ FatalError("\nInvalid argument for %s\n"
+ "\tWith elevated privileges, the file specified with %s must be\n"
+ "\ta relative path and must not contain any \"..\" elements.\n"
+ "\tUsing default " __XCONFIGDIR__ " search path.\n\n",
+ argv[i], argv[i]);
+ }
+ xf86ConfigDir = argv[i + 1];
+ return 2;
}
- xf86ConfigFile = argv[i + 1];
- return 2;
- }
- if (!strcmp(argv[i], "-configdir"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) {
- FatalError("\nInvalid argument for %s\n"
- "\tWith elevated privileges, the file specified with %s must be\n"
- "\ta relative path and must not contain any \"..\" elements.\n"
- "\tUsing default "__XCONFIGDIR__" search path.\n\n",
- argv[i], argv[i]);
+ if (!strcmp(argv[i], "-flipPixels")) {
+ xf86FlipPixels = TRUE;
+ return 1;
}
- xf86ConfigDir = argv[i + 1];
- return 2;
- }
- if (!strcmp(argv[i],"-flipPixels"))
- {
- xf86FlipPixels = TRUE;
- return 1;
- }
#ifdef XF86VIDMODE
- if (!strcmp(argv[i],"-disableVidMode"))
- {
- xf86VidModeDisabled = TRUE;
- return 1;
- }
- if (!strcmp(argv[i],"-allowNonLocalXvidtune"))
- {
- xf86VidModeAllowNonLocal = TRUE;
- return 1;
- }
+ if (!strcmp(argv[i], "-disableVidMode")) {
+ xf86VidModeDisabled = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-allowNonLocalXvidtune")) {
+ xf86VidModeAllowNonLocal = TRUE;
+ return 1;
+ }
#endif
- if (!strcmp(argv[i],"-allowMouseOpenFail"))
- {
- xf86AllowMouseOpenFail = TRUE;
- return 1;
- }
- if (!strcmp(argv[i],"-ignoreABI"))
- {
- LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
- return 1;
- }
- if (!strcmp(argv[i],"-verbose"))
- {
- if (++i < argc && argv[i])
- {
- char *end;
- long val;
- val = strtol(argv[i], &end, 0);
- if (*end == '\0')
- {
- xf86SetVerbosity(val);
- return 2;
- }
+ if (!strcmp(argv[i], "-allowMouseOpenFail")) {
+ xf86AllowMouseOpenFail = TRUE;
+ return 1;
}
- xf86SetVerbosity(++xf86Verbose);
- return 1;
- }
- if (!strcmp(argv[i],"-logverbose"))
- {
- if (++i < argc && argv[i])
- {
- char *end;
- long val;
- val = strtol(argv[i], &end, 0);
- if (*end == '\0')
- {
- xf86SetLogVerbosity(val);
- return 2;
- }
+ if (!strcmp(argv[i], "-ignoreABI")) {
+ LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
+ return 1;
}
- xf86SetLogVerbosity(++xf86LogVerbose);
- return 1;
- }
- if (!strcmp(argv[i],"-quiet"))
- {
- xf86SetVerbosity(-1);
- return 1;
- }
- if (!strcmp(argv[i],"-showconfig") || !strcmp(argv[i],"-version"))
- {
- xf86PrintBanner();
- exit(0);
- }
- if (!strcmp(argv[i],"-showDefaultModulePath"))
- {
- xf86PrintDefaultModulePath();
- exit(0);
- }
- if (!strcmp(argv[i],"-showDefaultLibPath"))
- {
- xf86PrintDefaultLibraryPath();
- exit(0);
- }
- /* Notice the -fp flag, but allow it to pass to the dix layer */
- if (!strcmp(argv[i], "-fp"))
- {
- xf86fpFlag = TRUE;
- return 0;
- }
- /* Notice the -bs flag, but allow it to pass to the dix layer */
- if (!strcmp(argv[i], "-bs"))
- {
- xf86bsDisableFlag = TRUE;
- return 0;
- }
- /* Notice the +bs flag, but allow it to pass to the dix layer */
- if (!strcmp(argv[i], "+bs"))
- {
- xf86bsEnableFlag = TRUE;
- return 0;
- }
- /* Notice the -s flag, but allow it to pass to the dix layer */
- if (!strcmp(argv[i], "-s"))
- {
- xf86sFlag = TRUE;
- return 0;
- }
- if (!strcmp(argv[i], "-pixmap24"))
- {
- xf86Pix24 = Pix24Use24;
- return 1;
- }
- if (!strcmp(argv[i], "-pixmap32"))
- {
- xf86Pix24 = Pix24Use32;
- return 1;
- }
- if (!strcmp(argv[i], "-fbbpp"))
- {
- int bpp;
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (sscanf(argv[++i], "%d", &bpp) == 1)
- {
- xf86FbBpp = bpp;
- return 2;
+ if (!strcmp(argv[i], "-verbose")) {
+ if (++i < argc && argv[i]) {
+ char *end;
+ long val;
+
+ val = strtol(argv[i], &end, 0);
+ if (*end == '\0') {
+ xf86SetVerbosity(val);
+ return 2;
+ }
+ }
+ xf86SetVerbosity(++xf86Verbose);
+ return 1;
}
- else
- {
- ErrorF("Invalid fbbpp\n");
- return 0;
+ if (!strcmp(argv[i], "-logverbose")) {
+ if (++i < argc && argv[i]) {
+ char *end;
+ long val;
+
+ val = strtol(argv[i], &end, 0);
+ if (*end == '\0') {
+ xf86SetLogVerbosity(val);
+ return 2;
+ }
+ }
+ xf86SetLogVerbosity(++xf86LogVerbose);
+ return 1;
}
- }
- if (!strcmp(argv[i], "-depth"))
- {
- int depth;
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (sscanf(argv[++i], "%d", &depth) == 1)
- {
- xf86Depth = depth;
- return 2;
+ if (!strcmp(argv[i], "-quiet")) {
+ xf86SetVerbosity(-1);
+ return 1;
}
- else
- {
- ErrorF("Invalid depth\n");
- return 0;
+ if (!strcmp(argv[i], "-showconfig") || !strcmp(argv[i], "-version")) {
+ xf86PrintBanner();
+ exit(0);
}
- }
- if (!strcmp(argv[i], "-weight"))
- {
- int red, green, blue;
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (sscanf(argv[++i], "%1d%1d%1d", &red, &green, &blue) == 3)
- {
- xf86Weight.red = red;
- xf86Weight.green = green;
- xf86Weight.blue = blue;
- return 2;
+ if (!strcmp(argv[i], "-showDefaultModulePath")) {
+ xf86PrintDefaultModulePath();
+ exit(0);
}
- else
- {
- ErrorF("Invalid weighting\n");
- return 0;
+ if (!strcmp(argv[i], "-showDefaultLibPath")) {
+ xf86PrintDefaultLibraryPath();
+ exit(0);
+ }
+ /* Notice the -fp flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-fp")) {
+ xf86fpFlag = TRUE;
+ return 0;
+ }
+ /* Notice the -bs flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-bs")) {
+ xf86bsDisableFlag = TRUE;
+ return 0;
+ }
+ /* Notice the +bs flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "+bs")) {
+ xf86bsEnableFlag = TRUE;
+ return 0;
}
- }
- if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
- !strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma"))
- {
- double gamma;
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (sscanf(argv[++i], "%lf", &gamma) == 1) {
- if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
- ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
- " is valid\n", GAMMA_MIN, GAMMA_MAX);
- return 0;
- }
- if (!strcmp(argv[i-1], "-gamma"))
- xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma;
- else if (!strcmp(argv[i-1], "-rgamma")) xf86Gamma.red = gamma;
- else if (!strcmp(argv[i-1], "-ggamma")) xf86Gamma.green = gamma;
- else if (!strcmp(argv[i-1], "-bgamma")) xf86Gamma.blue = gamma;
- return 2;
+ /* Notice the -s flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-s")) {
+ xf86sFlag = TRUE;
+ return 0;
+ }
+ if (!strcmp(argv[i], "-pixmap24")) {
+ xf86Pix24 = Pix24Use24;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-pixmap32")) {
+ xf86Pix24 = Pix24Use32;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-fbbpp")) {
+ int bpp;
+
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (sscanf(argv[++i], "%d", &bpp) == 1) {
+ xf86FbBpp = bpp;
+ return 2;
+ }
+ else {
+ ErrorF("Invalid fbbpp\n");
+ return 0;
+ }
+ }
+ if (!strcmp(argv[i], "-depth")) {
+ int depth;
+
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (sscanf(argv[++i], "%d", &depth) == 1) {
+ xf86Depth = depth;
+ return 2;
+ }
+ else {
+ ErrorF("Invalid depth\n");
+ return 0;
+ }
+ }
+ if (!strcmp(argv[i], "-weight")) {
+ int red, green, blue;
+
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (sscanf(argv[++i], "%1d%1d%1d", &red, &green, &blue) == 3) {
+ xf86Weight.red = red;
+ xf86Weight.green = green;
+ xf86Weight.blue = blue;
+ return 2;
+ }
+ else {
+ ErrorF("Invalid weighting\n");
+ return 0;
+ }
+ }
+ if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
+ !strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma")) {
+ double gamma;
+
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (sscanf(argv[++i], "%lf", &gamma) == 1) {
+ if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
+ ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
+ " is valid\n", GAMMA_MIN, GAMMA_MAX);
+ return 0;
+ }
+ if (!strcmp(argv[i - 1], "-gamma"))
+ xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma;
+ else if (!strcmp(argv[i - 1], "-rgamma"))
+ xf86Gamma.red = gamma;
+ else if (!strcmp(argv[i - 1], "-ggamma"))
+ xf86Gamma.green = gamma;
+ else if (!strcmp(argv[i - 1], "-bgamma"))
+ xf86Gamma.blue = gamma;
+ return 2;
+ }
+ }
+ if (!strcmp(argv[i], "-layout")) {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86LayoutName = argv[++i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-screen")) {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86ScreenName = argv[++i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-pointer")) {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86PointerName = argv[++i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-keyboard")) {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86KeyboardName = argv[++i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-nosilk")) {
+ xf86silkenMouseDisableFlag = TRUE;
+ return 1;
}
- }
- if (!strcmp(argv[i], "-layout"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86LayoutName = argv[++i];
- return 2;
- }
- if (!strcmp(argv[i], "-screen"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86ScreenName = argv[++i];
- return 2;
- }
- if (!strcmp(argv[i], "-pointer"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86PointerName = argv[++i];
- return 2;
- }
- if (!strcmp(argv[i], "-keyboard"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86KeyboardName = argv[++i];
- return 2;
- }
- if (!strcmp(argv[i], "-nosilk"))
- {
- xf86silkenMouseDisableFlag = TRUE;
- return 1;
- }
#ifdef HAVE_ACPI
- if (!strcmp(argv[i], "-noacpi"))
- {
- xf86acpiDisableFlag = TRUE;
- return 1;
- }
+ if (!strcmp(argv[i], "-noacpi")) {
+ xf86acpiDisableFlag = TRUE;
+ return 1;
+ }
#endif
- if (!strcmp(argv[i], "-configure"))
- {
- if (getuid() != 0 && geteuid() == 0) {
- ErrorF("The '-configure' option can only be used by root.\n");
- exit(1);
+ if (!strcmp(argv[i], "-configure")) {
+ if (getuid() != 0 && geteuid() == 0) {
+ ErrorF("The '-configure' option can only be used by root.\n");
+ exit(1);
+ }
+ xf86DoConfigure = TRUE;
+ xf86AllowMouseOpenFail = TRUE;
+ return 1;
}
- xf86DoConfigure = TRUE;
- xf86AllowMouseOpenFail = TRUE;
- return 1;
- }
- if (!strcmp(argv[i], "-showopts"))
- {
- if (getuid() != 0 && geteuid() == 0) {
- ErrorF("The '-showopts' option can only be used by root.\n");
- exit(1);
+ if (!strcmp(argv[i], "-showopts")) {
+ if (getuid() != 0 && geteuid() == 0) {
+ ErrorF("The '-showopts' option can only be used by root.\n");
+ exit(1);
+ }
+ xf86DoShowOptions = TRUE;
+ return 1;
}
- xf86DoShowOptions = TRUE;
- return 1;
- }
#ifdef XSERVER_LIBPCIACCESS
- if (!strcmp(argv[i], "-isolateDevice"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (strncmp(argv[++i], "PCI:", 4)) {
- FatalError("Bus types other than PCI not yet isolable\n");
+ if (!strcmp(argv[i], "-isolateDevice")) {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (strncmp(argv[++i], "PCI:", 4)) {
+ FatalError("Bus types other than PCI not yet isolable\n");
+ }
+ xf86PciIsolateDevice(argv[i]);
+ return 2;
}
- xf86PciIsolateDevice(argv[i]);
- return 2;
- }
#endif
- /* Notice cmdline xkbdir, but pass to dix as well */
- if (!strcmp(argv[i], "-xkbdir"))
- {
- xf86xkbdirFlag = TRUE;
- return 0;
- }
- if (!strcmp(argv[i], "-novtswitch"))
- {
- xf86Info.autoVTSwitch = FALSE;
- return 1;
- }
- if (!strcmp(argv[i], "-sharevts"))
- {
- xf86Info.ShareVTs = TRUE;
- return 1;
- }
-
- /* OS-specific processing */
- return xf86ProcessArgument(argc, argv, i);
+ /* Notice cmdline xkbdir, but pass to dix as well */
+ if (!strcmp(argv[i], "-xkbdir")) {
+ xf86xkbdirFlag = TRUE;
+ return 0;
+ }
+ if (!strcmp(argv[i], "-novtswitch")) {
+ xf86Info.autoVTSwitch = FALSE;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-sharevts")) {
+ xf86Info.ShareVTs = TRUE;
+ return 1;
+ }
+
+ /* OS-specific processing */
+ return xf86ProcessArgument(argc, argv, i);
}
/*
@@ -1432,58 +1413,70 @@ ddxProcessArgument(int argc, char **argv, int i)
void
ddxUseMsg(void)
{
- ErrorF("\n");
- ErrorF("\n");
- ErrorF("Device Dependent Usage\n");
- if (!xf86PrivsElevated())
- {
- ErrorF("-modulepath paths specify the module search path\n");
- ErrorF("-logfile file specify a log file name\n");
- ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n");
- ErrorF("-showopts print available options for all installed drivers\n");
- }
- ErrorF("-config file specify a configuration file, relative to the\n");
- ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n");
- ErrorF("-configdir dir specify a configuration directory, relative to the\n");
- ErrorF(" "__XCONFIGDIR__" search path, only root can use absolute\n");
- ErrorF("-verbose [n] verbose startup messages\n");
- ErrorF("-logverbose [n] verbose log messages\n");
- ErrorF("-quiet minimal startup messages\n");
- ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n");
- ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n");
- ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n");
- ErrorF("-depth n set colour depth. Default: 8\n");
- ErrorF("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n");
- ErrorF("-rgamma f set gamma value for red phase\n");
- ErrorF("-ggamma f set gamma value for green phase\n");
- ErrorF("-bgamma f set gamma value for blue phase\n");
- ErrorF("-weight nnn set RGB weighting at 16 bpp. Default: 565\n");
- ErrorF("-layout name specify the ServerLayout section name\n");
- ErrorF("-screen name specify the Screen section name\n");
- ErrorF("-keyboard name specify the core keyboard InputDevice name\n");
- ErrorF("-pointer name specify the core pointer InputDevice name\n");
- ErrorF("-nosilk disable Silken Mouse\n");
- ErrorF("-flipPixels swap default black/white Pixel values\n");
+ ErrorF("\n");
+ ErrorF("\n");
+ ErrorF("Device Dependent Usage\n");
+ if (!xf86PrivsElevated()) {
+ ErrorF("-modulepath paths specify the module search path\n");
+ ErrorF("-logfile file specify a log file name\n");
+ ErrorF("-configure probe for devices and write an "
+ __XCONFIGFILE__ "\n");
+ ErrorF
+ ("-showopts print available options for all installed drivers\n");
+ }
+ ErrorF
+ ("-config file specify a configuration file, relative to the\n");
+ ErrorF(" " __XCONFIGFILE__
+ " search path, only root can use absolute\n");
+ ErrorF
+ ("-configdir dir specify a configuration directory, relative to the\n");
+ ErrorF(" " __XCONFIGDIR__
+ " search path, only root can use absolute\n");
+ ErrorF("-verbose [n] verbose startup messages\n");
+ ErrorF("-logverbose [n] verbose log messages\n");
+ ErrorF("-quiet minimal startup messages\n");
+ ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n");
+ ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n");
+ ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n");
+ ErrorF("-depth n set colour depth. Default: 8\n");
+ ErrorF
+ ("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n");
+ ErrorF("-rgamma f set gamma value for red phase\n");
+ ErrorF("-ggamma f set gamma value for green phase\n");
+ ErrorF("-bgamma f set gamma value for blue phase\n");
+ ErrorF
+ ("-weight nnn set RGB weighting at 16 bpp. Default: 565\n");
+ ErrorF("-layout name specify the ServerLayout section name\n");
+ ErrorF("-screen name specify the Screen section name\n");
+ ErrorF
+ ("-keyboard name specify the core keyboard InputDevice name\n");
+ ErrorF
+ ("-pointer name specify the core pointer InputDevice name\n");
+ ErrorF("-nosilk disable Silken Mouse\n");
+ ErrorF("-flipPixels swap default black/white Pixel values\n");
#ifdef XF86VIDMODE
- ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
- ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n");
+ ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
+ ErrorF
+ ("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n");
#endif
- ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
- ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
+ ErrorF
+ ("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
+ ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
#ifdef XSERVER_LIBPCIACCESS
- ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n");
+ ErrorF
+ ("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n");
#endif
- ErrorF("-version show the server version\n");
- ErrorF("-showDefaultModulePath show the server default module path\n");
- ErrorF("-showDefaultLibPath show the server default library path\n");
- ErrorF("-novtswitch don't automatically switch VT at reset & exit\n");
- ErrorF("-sharevts share VTs with another X server\n");
- /* OS-specific usage */
- xf86UseMsg();
- ErrorF("\n");
+ ErrorF("-version show the server version\n");
+ ErrorF("-showDefaultModulePath show the server default module path\n");
+ ErrorF("-showDefaultLibPath show the server default library path\n");
+ ErrorF
+ ("-novtswitch don't automatically switch VT at reset & exit\n");
+ ErrorF("-sharevts share VTs with another X server\n");
+ /* OS-specific usage */
+ xf86UseMsg();
+ ErrorF("\n");
}
-
/*
* xf86LoadModules iterates over a list that is being passed in.
*/
@@ -1497,34 +1490,34 @@ xf86LoadModules(char **list, pointer *optlist)
Bool failed = FALSE;
if (!list)
- return TRUE;
+ return TRUE;
for (i = 0; list[i] != NULL; i++) {
- /* Normalise the module name */
- name = xf86NormalizeName(list[i]);
+ /* Normalise the module name */
+ name = xf86NormalizeName(list[i]);
- /* Skip empty names */
- if (name == NULL || *name == '\0') {
- free(name);
- continue;
- }
+ /* Skip empty names */
+ if (name == NULL || *name == '\0') {
+ free(name);
+ continue;
+ }
- /* Replace obsolete keyboard driver with kbd */
- if (!xf86NameCmp(name, "keyboard")) {
- strcpy(name, "kbd");
- }
+ /* Replace obsolete keyboard driver with kbd */
+ if (!xf86NameCmp(name, "keyboard")) {
+ strcpy(name, "kbd");
+ }
- if (optlist)
- opt = optlist[i];
- else
- opt = NULL;
+ if (optlist)
+ opt = optlist[i];
+ else
+ opt = NULL;
if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) {
- LoaderErrorMsg(NULL, name, errmaj, errmin);
- failed = TRUE;
- }
- free(name);
+ LoaderErrorMsg(NULL, name, errmaj, errmin);
+ failed = TRUE;
+ }
+ free(name);
}
return !failed;
}
@@ -1535,7 +1528,7 @@ PixmapFormatPtr
xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
{
int i;
- static PixmapFormatRec format; /* XXX not reentrant */
+ static PixmapFormatRec format; /* XXX not reentrant */
/*
* When the formats[] list initialisation isn't complete, check the
@@ -1543,35 +1536,35 @@ xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
*/
if (!formatsDone) {
- if (depth == 24) {
- Pix24Flags pix24 = Pix24DontCare;
-
- format.depth = 24;
- format.scanlinePad = BITMAP_SCANLINE_PAD;
- if (xf86Info.pixmap24 != Pix24DontCare)
- pix24 = xf86Info.pixmap24;
- else if (pScrn->pixmap24 != Pix24DontCare)
- pix24 = pScrn->pixmap24;
- if (pix24 == Pix24Use24)
- format.bitsPerPixel = 24;
- else
- format.bitsPerPixel = 32;
- return &format;
- }
+ if (depth == 24) {
+ Pix24Flags pix24 = Pix24DontCare;
+
+ format.depth = 24;
+ format.scanlinePad = BITMAP_SCANLINE_PAD;
+ if (xf86Info.pixmap24 != Pix24DontCare)
+ pix24 = xf86Info.pixmap24;
+ else if (pScrn->pixmap24 != Pix24DontCare)
+ pix24 = pScrn->pixmap24;
+ if (pix24 == Pix24Use24)
+ format.bitsPerPixel = 24;
+ else
+ format.bitsPerPixel = 32;
+ return &format;
+ }
}
for (i = 0; i < numFormats; i++)
- if (formats[i].depth == depth)
- break;
+ if (formats[i].depth == depth)
+ break;
if (i != numFormats)
- return &formats[i];
+ return &formats[i];
else if (!formatsDone) {
- /* Check for screen-specified formats */
- for (i = 0; i < pScrn->numFormats; i++)
- if (pScrn->formats[i].depth == depth)
- break;
- if (i != pScrn->numFormats)
- return &pScrn->formats[i];
+ /* Check for screen-specified formats */
+ for (i = 0; i < pScrn->numFormats; i++)
+ if (pScrn->formats[i].depth == depth)
+ break;
+ if (i != pScrn->numFormats)
+ return &pScrn->formats[i];
}
return NULL;
}
@@ -1581,10 +1574,9 @@ xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth)
{
PixmapFormatPtr format;
-
format = xf86GetPixFormat(pScrn, depth);
if (format)
- return format->bitsPerPixel;
+ return format->bitsPerPixel;
else
- return 0;
+ return 0;
}
diff --git a/xorg-server/hw/xfree86/common/xf86Mode.c b/xorg-server/hw/xfree86/common/xf86Mode.c
index d202d4079..ab4d595c7 100644
--- a/xorg-server/hw/xfree86/common/xf86Mode.c
+++ b/xorg-server/hw/xfree86/common/xf86Mode.c
@@ -99,16 +99,16 @@ printModeRejectMessage(int index, DisplayModePtr p, int status)
const char *type;
if (p->type & M_T_BUILTIN)
- type = "built-in ";
+ type = "built-in ";
else if (p->type & M_T_DEFAULT)
- type = "default ";
+ type = "default ";
else if (p->type & M_T_DRIVER)
- type = "driver ";
+ type = "driver ";
else
- type = "";
+ type = "";
xf86DrvMsg(index, X_INFO, "Not using %smode \"%s\" (%s)\n", type, p->name,
- xf86ModeStatusToString(status));
+ xf86ModeStatusToString(status));
}
/*
@@ -118,33 +118,32 @@ printModeRejectMessage(int index, DisplayModePtr p, int status)
*/
int
xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
- int DivFactor, int MulFactor, int *divider)
+ int DivFactor, int MulFactor, int *divider)
{
int nearestClock = 0, nearestDiv = 1;
int minimumGap = abs(freq - scrp->clock[0]);
int i, j, k, gap;
if (allowDiv2)
- k = 2;
+ k = 2;
else
- k = 1;
+ k = 1;
/* Must set this here in case the best match is scrp->clock[0] */
if (divider != NULL)
- *divider = 0;
-
- for (i = 0; i < scrp->numClocks; i++) {
- for (j = 1; j <= k; j++) {
- gap = abs((freq * j) - ((scrp->clock[i] * DivFactor) / MulFactor));
- if ((gap < minimumGap) ||
- ((gap == minimumGap) && (j < nearestDiv))) {
- minimumGap = gap;
- nearestClock = i;
- nearestDiv = j;
- if (divider != NULL)
- *divider = (j - 1) * V_CLKDIV2;
- }
- }
+ *divider = 0;
+
+ for (i = 0; i < scrp->numClocks; i++) {
+ for (j = 1; j <= k; j++) {
+ gap = abs((freq * j) - ((scrp->clock[i] * DivFactor) / MulFactor));
+ if ((gap < minimumGap) || ((gap == minimumGap) && (j < nearestDiv))) {
+ minimumGap = gap;
+ nearestClock = i;
+ nearestDiv = j;
+ if (divider != NULL)
+ *divider = (j - 1) * V_CLKDIV2;
+ }
+ }
}
return nearestClock;
}
@@ -160,67 +159,67 @@ xf86ModeStatusToString(ModeStatus status)
{
switch (status) {
case MODE_OK:
- return "Mode OK";
+ return "Mode OK";
case MODE_HSYNC:
- return "hsync out of range";
+ return "hsync out of range";
case MODE_VSYNC:
- return "vrefresh out of range";
+ return "vrefresh out of range";
case MODE_H_ILLEGAL:
- return "illegal horizontal timings";
+ return "illegal horizontal timings";
case MODE_V_ILLEGAL:
- return "illegal vertical timings";
+ return "illegal vertical timings";
case MODE_BAD_WIDTH:
- return "width requires unsupported line pitch";
+ return "width requires unsupported line pitch";
case MODE_NOMODE:
- return "no mode of this name";
+ return "no mode of this name";
case MODE_NO_INTERLACE:
- return "interlace mode not supported";
+ return "interlace mode not supported";
case MODE_NO_DBLESCAN:
- return "doublescan mode not supported";
+ return "doublescan mode not supported";
case MODE_NO_VSCAN:
- return "multiscan mode not supported";
+ return "multiscan mode not supported";
case MODE_MEM:
- return "insufficient memory for mode";
+ return "insufficient memory for mode";
case MODE_VIRTUAL_X:
- return "width too large for virtual size";
+ return "width too large for virtual size";
case MODE_VIRTUAL_Y:
- return "height too large for virtual size";
+ return "height too large for virtual size";
case MODE_MEM_VIRT:
- return "insufficient memory given virtual size";
+ return "insufficient memory given virtual size";
case MODE_NOCLOCK:
- return "no clock available for mode";
+ return "no clock available for mode";
case MODE_CLOCK_HIGH:
- return "mode clock too high";
+ return "mode clock too high";
case MODE_CLOCK_LOW:
- return "mode clock too low";
+ return "mode clock too low";
case MODE_CLOCK_RANGE:
- return "bad mode clock/interlace/doublescan";
+ return "bad mode clock/interlace/doublescan";
case MODE_BAD_HVALUE:
- return "horizontal timing out of range";
+ return "horizontal timing out of range";
case MODE_BAD_VVALUE:
- return "vertical timing out of range";
+ return "vertical timing out of range";
case MODE_BAD_VSCAN:
- return "VScan value out of range";
+ return "VScan value out of range";
case MODE_HSYNC_NARROW:
- return "horizontal sync too narrow";
+ return "horizontal sync too narrow";
case MODE_HSYNC_WIDE:
- return "horizontal sync too wide";
+ return "horizontal sync too wide";
case MODE_HBLANK_NARROW:
- return "horizontal blanking too narrow";
+ return "horizontal blanking too narrow";
case MODE_HBLANK_WIDE:
- return "horizontal blanking too wide";
+ return "horizontal blanking too wide";
case MODE_VSYNC_NARROW:
- return "vertical sync too narrow";
+ return "vertical sync too narrow";
case MODE_VSYNC_WIDE:
- return "vertical sync too wide";
+ return "vertical sync too wide";
case MODE_VBLANK_NARROW:
- return "vertical blanking too narrow";
+ return "vertical blanking too narrow";
case MODE_VBLANK_WIDE:
- return "vertical blanking too wide";
+ return "vertical blanking too wide";
case MODE_PANEL:
- return "exceeds panel dimensions";
+ return "exceeds panel dimensions";
case MODE_INTERLACE_WIDTH:
- return "width too large for interlaced mode";
+ return "width too large for interlaced mode";
case MODE_ONE_WIDTH:
return "all modes must have the same width";
case MODE_ONE_HEIGHT:
@@ -230,13 +229,13 @@ xf86ModeStatusToString(ModeStatus status)
case MODE_NO_REDUCED:
return "monitor doesn't support reduced blanking";
case MODE_BANDWIDTH:
- return "mode requires too much memory bandwidth";
+ return "mode requires too much memory bandwidth";
case MODE_BAD:
- return "unknown reason";
+ return "unknown reason";
case MODE_ERROR:
- return "internal error";
+ return "internal error";
default:
- return "unknown";
+ return "unknown";
}
}
@@ -254,43 +253,46 @@ xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges)
int scaledClock;
for (cp = clockRanges; cp != NULL; cp = cp->next) {
- DivFactor = max(1, cp->ClockDivFactor);
- MulFactor = max(1, cp->ClockMulFactor);
- if (scrp->progClock) {
- if (cp->minClock) {
- if (cp->maxClock) {
- xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "Clock range: %6.2f to %6.2f MHz\n",
- (double)cp->minClock / 1000.0,
- (double)cp->maxClock / 1000.0);
- } else {
- xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "Minimum clock: %6.2f MHz\n",
- (double)cp->minClock / 1000.0);
- }
- } else {
- if (cp->maxClock) {
- xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "Maximum clock: %6.2f MHz\n",
- (double)cp->maxClock / 1000.0);
- }
- }
- } else if (DivFactor > 1 || MulFactor > 1) {
- j = 0;
- for (i = 0; i < scrp->numClocks; i++) {
- scaledClock = (scrp->clock[i] * DivFactor) / MulFactor;
- if (scaledClock >= cp->minClock && scaledClock <= cp->maxClock) {
- if ((j % 8) == 0) {
- if (j > 0)
- xf86ErrorF("\n");
- xf86DrvMsg(scrp->scrnIndex, X_INFO, "scaled clocks:");
- }
- xf86ErrorF(" %6.2f", (double)scaledClock / 1000.0);
- j++;
- }
- }
- xf86ErrorF("\n");
- }
+ DivFactor = max(1, cp->ClockDivFactor);
+ MulFactor = max(1, cp->ClockMulFactor);
+ if (scrp->progClock) {
+ if (cp->minClock) {
+ if (cp->maxClock) {
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "Clock range: %6.2f to %6.2f MHz\n",
+ (double) cp->minClock / 1000.0,
+ (double) cp->maxClock / 1000.0);
+ }
+ else {
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "Minimum clock: %6.2f MHz\n",
+ (double) cp->minClock / 1000.0);
+ }
+ }
+ else {
+ if (cp->maxClock) {
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "Maximum clock: %6.2f MHz\n",
+ (double) cp->maxClock / 1000.0);
+ }
+ }
+ }
+ else if (DivFactor > 1 || MulFactor > 1) {
+ j = 0;
+ for (i = 0; i < scrp->numClocks; i++) {
+ scaledClock = (scrp->clock[i] * DivFactor) / MulFactor;
+ if (scaledClock >= cp->minClock && scaledClock <= cp->maxClock) {
+ if ((j % 8) == 0) {
+ if (j > 0)
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrp->scrnIndex, X_INFO, "scaled clocks:");
+ }
+ xf86ErrorF(" %6.2f", (double) scaledClock / 1000.0);
+ j++;
+ }
+ }
+ xf86ErrorF("\n");
+ }
}
}
@@ -298,10 +300,10 @@ static Bool
modeInClockRange(ClockRangePtr cp, DisplayModePtr p)
{
return ((p->Clock >= cp->minClock) &&
- (p->Clock <= cp->maxClock) &&
- (cp->interlaceAllowed || !(p->Flags & V_INTERLACE)) &&
- (cp->doubleScanAllowed ||
- ((p->VScan <= 1) && !(p->Flags & V_DBLSCAN))));
+ (p->Clock <= cp->maxClock) &&
+ (cp->interlaceAllowed || !(p->Flags & V_INTERLACE)) &&
+ (cp->doubleScanAllowed ||
+ ((p->VScan <= 1) && !(p->Flags & V_DBLSCAN))));
}
/*
@@ -312,111 +314,112 @@ xf86FindClockRangeForMode(ClockRangePtr clockRanges, DisplayModePtr p)
{
ClockRangePtr cp;
- for (cp = clockRanges; ; cp = cp->next)
- if (!cp || modeInClockRange(cp, p))
- return cp;
+ for (cp = clockRanges;; cp = cp->next)
+ if (!cp || modeInClockRange(cp, p))
+ return cp;
}
-
/*
* xf86HandleBuiltinMode() - handles built-in modes
*/
static ModeStatus
xf86HandleBuiltinMode(ScrnInfoPtr scrp,
- DisplayModePtr p,
- DisplayModePtr modep,
- ClockRangePtr clockRanges,
- Bool allowDiv2)
+ DisplayModePtr p,
+ DisplayModePtr modep,
+ ClockRangePtr clockRanges, Bool allowDiv2)
{
ClockRangePtr cp;
int extraFlags = 0;
int MulFactor = 1;
int DivFactor = 1;
int clockIndex;
-
+
/* Reject previously rejected modes */
if (p->status != MODE_OK)
- return p->status;
+ return p->status;
/* Reject previously considered modes */
if (p->prev)
return MODE_NOMODE;
if ((p->type & M_T_CLOCK_C) == M_T_CLOCK_C) {
- /* Check clock is in range */
- cp = xf86FindClockRangeForMode(clockRanges, p);
- if (cp == NULL){
- modep->type = p->type;
- p->status = MODE_CLOCK_RANGE;
- return MODE_CLOCK_RANGE;
- }
- DivFactor = cp->ClockDivFactor;
- MulFactor = cp->ClockMulFactor;
- if (!scrp->progClock) {
- clockIndex = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
- cp->ClockDivFactor,
- cp->ClockMulFactor, &extraFlags);
- modep->Clock = (scrp->clock[clockIndex] * DivFactor)
- / MulFactor;
- modep->ClockIndex = clockIndex;
- modep->SynthClock = scrp->clock[clockIndex];
- if (extraFlags & V_CLKDIV2) {
- modep->Clock /= 2;
- modep->SynthClock /= 2;
- }
- } else {
- modep->Clock = p->Clock;
- modep->ClockIndex = -1;
- modep->SynthClock = (modep->Clock * MulFactor)
- / DivFactor;
- }
- modep->PrivFlags = cp->PrivFlags;
- } else {
- if(!scrp->progClock) {
+ /* Check clock is in range */
+ cp = xf86FindClockRangeForMode(clockRanges, p);
+ if (cp == NULL) {
+ modep->type = p->type;
+ p->status = MODE_CLOCK_RANGE;
+ return MODE_CLOCK_RANGE;
+ }
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ if (!scrp->progClock) {
+ clockIndex = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
+ cp->ClockDivFactor,
+ cp->ClockMulFactor, &extraFlags);
+ modep->Clock = (scrp->clock[clockIndex] * DivFactor)
+ / MulFactor;
+ modep->ClockIndex = clockIndex;
+ modep->SynthClock = scrp->clock[clockIndex];
+ if (extraFlags & V_CLKDIV2) {
+ modep->Clock /= 2;
+ modep->SynthClock /= 2;
+ }
+ }
+ else {
modep->Clock = p->Clock;
- modep->ClockIndex = p->ClockIndex;
- modep->SynthClock = p->SynthClock;
- } else {
- modep->Clock = p->Clock;
- modep->ClockIndex = -1;
- modep->SynthClock = p->SynthClock;
- }
- modep->PrivFlags = p->PrivFlags;
+ modep->ClockIndex = -1;
+ modep->SynthClock = (modep->Clock * MulFactor)
+ / DivFactor;
+ }
+ modep->PrivFlags = cp->PrivFlags;
}
- modep->type = p->type;
- modep->HDisplay = p->HDisplay;
- modep->HSyncStart = p->HSyncStart;
- modep->HSyncEnd = p->HSyncEnd;
- modep->HTotal = p->HTotal;
- modep->HSkew = p->HSkew;
- modep->VDisplay = p->VDisplay;
- modep->VSyncStart = p->VSyncStart;
- modep->VSyncEnd = p->VSyncEnd;
- modep->VTotal = p->VTotal;
- modep->VScan = p->VScan;
- modep->Flags = p->Flags | extraFlags;
- modep->CrtcHDisplay = p->CrtcHDisplay;
+ else {
+ if (!scrp->progClock) {
+ modep->Clock = p->Clock;
+ modep->ClockIndex = p->ClockIndex;
+ modep->SynthClock = p->SynthClock;
+ }
+ else {
+ modep->Clock = p->Clock;
+ modep->ClockIndex = -1;
+ modep->SynthClock = p->SynthClock;
+ }
+ modep->PrivFlags = p->PrivFlags;
+ }
+ modep->type = p->type;
+ modep->HDisplay = p->HDisplay;
+ modep->HSyncStart = p->HSyncStart;
+ modep->HSyncEnd = p->HSyncEnd;
+ modep->HTotal = p->HTotal;
+ modep->HSkew = p->HSkew;
+ modep->VDisplay = p->VDisplay;
+ modep->VSyncStart = p->VSyncStart;
+ modep->VSyncEnd = p->VSyncEnd;
+ modep->VTotal = p->VTotal;
+ modep->VScan = p->VScan;
+ modep->Flags = p->Flags | extraFlags;
+ modep->CrtcHDisplay = p->CrtcHDisplay;
modep->CrtcHBlankStart = p->CrtcHBlankStart;
- modep->CrtcHSyncStart = p->CrtcHSyncStart;
- modep->CrtcHSyncEnd = p->CrtcHSyncEnd;
- modep->CrtcHBlankEnd = p->CrtcHBlankEnd;
- modep->CrtcHTotal = p->CrtcHTotal;
- modep->CrtcHSkew = p->CrtcHSkew;
- modep->CrtcVDisplay = p->CrtcVDisplay;
+ modep->CrtcHSyncStart = p->CrtcHSyncStart;
+ modep->CrtcHSyncEnd = p->CrtcHSyncEnd;
+ modep->CrtcHBlankEnd = p->CrtcHBlankEnd;
+ modep->CrtcHTotal = p->CrtcHTotal;
+ modep->CrtcHSkew = p->CrtcHSkew;
+ modep->CrtcVDisplay = p->CrtcVDisplay;
modep->CrtcVBlankStart = p->CrtcVBlankStart;
- modep->CrtcVSyncStart = p->CrtcVSyncStart;
- modep->CrtcVSyncEnd = p->CrtcVSyncEnd;
- modep->CrtcVBlankEnd = p->CrtcVBlankEnd;
- modep->CrtcVTotal = p->CrtcVTotal;
- modep->CrtcHAdjusted = p->CrtcHAdjusted;
- modep->CrtcVAdjusted = p->CrtcVAdjusted;
- modep->HSync = p->HSync;
- modep->VRefresh = p->VRefresh;
- modep->Private = p->Private;
- modep->PrivSize = p->PrivSize;
+ modep->CrtcVSyncStart = p->CrtcVSyncStart;
+ modep->CrtcVSyncEnd = p->CrtcVSyncEnd;
+ modep->CrtcVBlankEnd = p->CrtcVBlankEnd;
+ modep->CrtcVTotal = p->CrtcVTotal;
+ modep->CrtcHAdjusted = p->CrtcHAdjusted;
+ modep->CrtcVAdjusted = p->CrtcVAdjusted;
+ modep->HSync = p->HSync;
+ modep->VRefresh = p->VRefresh;
+ modep->Private = p->Private;
+ modep->PrivSize = p->PrivSize;
p->prev = modep;
-
+
return MODE_OK;
}
@@ -450,7 +453,7 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp,
ModeStatus
xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
- ClockRangePtr clockRanges, LookupModeFlags strategy)
+ ClockRangePtr clockRanges, LookupModeFlags strategy)
{
DisplayModePtr p, bestMode = NULL;
ClockRangePtr cp;
@@ -465,14 +468,15 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
ModeStatus status = MODE_NOMODE;
Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0;
int n;
+
const int types[] = {
- M_T_BUILTIN | M_T_PREFERRED,
- M_T_BUILTIN,
- M_T_USERDEF | M_T_PREFERRED,
- M_T_USERDEF,
- M_T_DRIVER | M_T_PREFERRED,
- M_T_DRIVER,
- 0
+ M_T_BUILTIN | M_T_PREFERRED,
+ M_T_BUILTIN,
+ M_T_USERDEF | M_T_PREFERRED,
+ M_T_USERDEF,
+ M_T_DRIVER | M_T_PREFERRED,
+ M_T_DRIVER,
+ 0
};
const int ntypes = sizeof(types) / sizeof(int);
@@ -480,206 +484,209 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
/* Some sanity checking */
if (scrp == NULL || scrp->modePool == NULL ||
- (!scrp->progClock && scrp->numClocks == 0)) {
- ErrorF("xf86LookupMode: called with invalid scrnInfoRec\n");
- return MODE_ERROR;
+ (!scrp->progClock && scrp->numClocks == 0)) {
+ ErrorF("xf86LookupMode: called with invalid scrnInfoRec\n");
+ return MODE_ERROR;
}
if (modep == NULL || modep->name == NULL) {
- ErrorF("xf86LookupMode: called with invalid modep\n");
- return MODE_ERROR;
+ ErrorF("xf86LookupMode: called with invalid modep\n");
+ return MODE_ERROR;
}
for (cp = clockRanges; cp != NULL; cp = cp->next) {
- /* DivFactor and MulFactor must be > 0 */
- cp->ClockDivFactor = max(1, cp->ClockDivFactor);
- cp->ClockMulFactor = max(1, cp->ClockMulFactor);
+ /* DivFactor and MulFactor must be > 0 */
+ cp->ClockDivFactor = max(1, cp->ClockDivFactor);
+ cp->ClockMulFactor = max(1, cp->ClockMulFactor);
}
/* Scan the mode pool for matching names */
for (n = 0; n < ntypes; n++) {
- int type = types[n];
- for (p = scrp->modePool; p != NULL; p = p->next) {
-
- /* scan through the modes in the sort order above */
- if ((p->type & type) != type)
- continue;
-
- if (strcmp(p->name, modep->name) == 0) {
-
- /* Skip over previously rejected modes */
- if (p->status != MODE_OK) {
- if (!found)
- status = p->status;
- continue;
- }
-
- /* Skip over previously considered modes */
- if (p->prev)
- continue;
-
- if (p->type & M_T_BUILTIN) {
- return xf86HandleBuiltinMode(scrp, p,modep, clockRanges,
- allowDiv2);
- }
-
- /* Check clock is in range */
- cp = xf86FindClockRangeForMode(clockRanges, p);
- if (cp == NULL) {
- /*
- * XXX Could do more here to provide a more detailed
- * reason for not finding a mode.
- */
- p->status = MODE_CLOCK_RANGE;
- if (!found)
- status = MODE_CLOCK_RANGE;
- continue;
- }
-
- /*
- * If programmable clock and strategy is not
- * LOOKUP_BEST_REFRESH, the required mode has been found,
- * otherwise record the refresh and continue looking.
- */
- if (scrp->progClock) {
- found = TRUE;
- if (strategy != LOOKUP_BEST_REFRESH) {
- bestMode = p;
- DivFactor = cp->ClockDivFactor;
- MulFactor = cp->ClockMulFactor;
- ModePrivFlags = cp->PrivFlags;
- break;
- }
- refresh = xf86ModeVRefresh(p);
- if (p->Flags & V_INTERLACE)
- refresh /= INTERLACE_REFRESH_WEIGHT;
- if (refresh > bestRefresh) {
- bestMode = p;
- DivFactor = cp->ClockDivFactor;
- MulFactor = cp->ClockMulFactor;
- ModePrivFlags = cp->PrivFlags;
- bestRefresh = refresh;
- }
- continue;
- }
-
- /*
- * Clock is in range, so if it is not a programmable clock, find
- * a matching clock.
- */
-
- i = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
- cp->ClockDivFactor, cp->ClockMulFactor, &k);
- /*
- * If the clock is too far from the requested clock, this
- * mode is no good.
- */
- if (k & V_CLKDIV2)
- gap = abs((p->Clock * 2) -
- ((scrp->clock[i] * cp->ClockDivFactor) /
- cp->ClockMulFactor));
- else
- gap = abs(p->Clock -
- ((scrp->clock[i] * cp->ClockDivFactor) /
- cp->ClockMulFactor));
- if (gap > minimumGap) {
- p->status = MODE_NOCLOCK;
- if (!found)
- status = MODE_NOCLOCK;
- continue;
- }
- found = TRUE;
-
- if (strategy == LOOKUP_BEST_REFRESH) {
- refresh = xf86ModeVRefresh(p);
- if (p->Flags & V_INTERLACE)
- refresh /= INTERLACE_REFRESH_WEIGHT;
- if (refresh > bestRefresh) {
- bestMode = p;
- DivFactor = cp->ClockDivFactor;
- MulFactor = cp->ClockMulFactor;
- ModePrivFlags = cp->PrivFlags;
- extraFlags = k;
- clockIndex = i;
- bestRefresh = refresh;
- }
- continue;
- }
- if (strategy == LOOKUP_CLOSEST_CLOCK) {
- if (gap < minimumGap) {
- bestMode = p;
- DivFactor = cp->ClockDivFactor;
- MulFactor = cp->ClockMulFactor;
- ModePrivFlags = cp->PrivFlags;
- extraFlags = k;
- clockIndex = i;
- minimumGap = gap;
- }
- continue;
- }
- /*
- * If strategy is neither LOOKUP_BEST_REFRESH or
- * LOOKUP_CLOSEST_CLOCK the required mode has been found.
- */
- bestMode = p;
- DivFactor = cp->ClockDivFactor;
- MulFactor = cp->ClockMulFactor;
- ModePrivFlags = cp->PrivFlags;
- extraFlags = k;
- clockIndex = i;
- break;
- }
- }
- if (found) break;
+ int type = types[n];
+
+ for (p = scrp->modePool; p != NULL; p = p->next) {
+
+ /* scan through the modes in the sort order above */
+ if ((p->type & type) != type)
+ continue;
+
+ if (strcmp(p->name, modep->name) == 0) {
+
+ /* Skip over previously rejected modes */
+ if (p->status != MODE_OK) {
+ if (!found)
+ status = p->status;
+ continue;
+ }
+
+ /* Skip over previously considered modes */
+ if (p->prev)
+ continue;
+
+ if (p->type & M_T_BUILTIN) {
+ return xf86HandleBuiltinMode(scrp, p, modep, clockRanges,
+ allowDiv2);
+ }
+
+ /* Check clock is in range */
+ cp = xf86FindClockRangeForMode(clockRanges, p);
+ if (cp == NULL) {
+ /*
+ * XXX Could do more here to provide a more detailed
+ * reason for not finding a mode.
+ */
+ p->status = MODE_CLOCK_RANGE;
+ if (!found)
+ status = MODE_CLOCK_RANGE;
+ continue;
+ }
+
+ /*
+ * If programmable clock and strategy is not
+ * LOOKUP_BEST_REFRESH, the required mode has been found,
+ * otherwise record the refresh and continue looking.
+ */
+ if (scrp->progClock) {
+ found = TRUE;
+ if (strategy != LOOKUP_BEST_REFRESH) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ break;
+ }
+ refresh = xf86ModeVRefresh(p);
+ if (p->Flags & V_INTERLACE)
+ refresh /= INTERLACE_REFRESH_WEIGHT;
+ if (refresh > bestRefresh) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ bestRefresh = refresh;
+ }
+ continue;
+ }
+
+ /*
+ * Clock is in range, so if it is not a programmable clock, find
+ * a matching clock.
+ */
+
+ i = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
+ cp->ClockDivFactor, cp->ClockMulFactor,
+ &k);
+ /*
+ * If the clock is too far from the requested clock, this
+ * mode is no good.
+ */
+ if (k & V_CLKDIV2)
+ gap = abs((p->Clock * 2) -
+ ((scrp->clock[i] * cp->ClockDivFactor) /
+ cp->ClockMulFactor));
+ else
+ gap = abs(p->Clock -
+ ((scrp->clock[i] * cp->ClockDivFactor) /
+ cp->ClockMulFactor));
+ if (gap > minimumGap) {
+ p->status = MODE_NOCLOCK;
+ if (!found)
+ status = MODE_NOCLOCK;
+ continue;
+ }
+ found = TRUE;
+
+ if (strategy == LOOKUP_BEST_REFRESH) {
+ refresh = xf86ModeVRefresh(p);
+ if (p->Flags & V_INTERLACE)
+ refresh /= INTERLACE_REFRESH_WEIGHT;
+ if (refresh > bestRefresh) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ bestRefresh = refresh;
+ }
+ continue;
+ }
+ if (strategy == LOOKUP_CLOSEST_CLOCK) {
+ if (gap < minimumGap) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ minimumGap = gap;
+ }
+ continue;
+ }
+ /*
+ * If strategy is neither LOOKUP_BEST_REFRESH or
+ * LOOKUP_CLOSEST_CLOCK the required mode has been found.
+ */
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ break;
+ }
+ }
+ if (found)
+ break;
}
if (!found || bestMode == NULL)
- return status;
+ return status;
/* Fill in the mode parameters */
if (scrp->progClock) {
- modep->Clock = bestMode->Clock;
- modep->ClockIndex = -1;
- modep->SynthClock = (modep->Clock * MulFactor) / DivFactor;
- } else {
- modep->Clock = (scrp->clock[clockIndex] * DivFactor) /
- MulFactor;
- modep->ClockIndex = clockIndex;
- modep->SynthClock = scrp->clock[clockIndex];
- if (extraFlags & V_CLKDIV2) {
- modep->Clock /= 2;
- modep->SynthClock /= 2;
- }
+ modep->Clock = bestMode->Clock;
+ modep->ClockIndex = -1;
+ modep->SynthClock = (modep->Clock * MulFactor) / DivFactor;
+ }
+ else {
+ modep->Clock = (scrp->clock[clockIndex] * DivFactor) / MulFactor;
+ modep->ClockIndex = clockIndex;
+ modep->SynthClock = scrp->clock[clockIndex];
+ if (extraFlags & V_CLKDIV2) {
+ modep->Clock /= 2;
+ modep->SynthClock /= 2;
+ }
}
- modep->type = bestMode->type;
- modep->PrivFlags = ModePrivFlags;
- modep->HDisplay = bestMode->HDisplay;
- modep->HSyncStart = bestMode->HSyncStart;
- modep->HSyncEnd = bestMode->HSyncEnd;
- modep->HTotal = bestMode->HTotal;
- modep->HSkew = bestMode->HSkew;
- modep->VDisplay = bestMode->VDisplay;
- modep->VSyncStart = bestMode->VSyncStart;
- modep->VSyncEnd = bestMode->VSyncEnd;
- modep->VTotal = bestMode->VTotal;
- modep->VScan = bestMode->VScan;
- modep->Flags = bestMode->Flags | extraFlags;
- modep->CrtcHDisplay = bestMode->CrtcHDisplay;
- modep->CrtcHBlankStart = bestMode->CrtcHBlankStart;
- modep->CrtcHSyncStart = bestMode->CrtcHSyncStart;
- modep->CrtcHSyncEnd = bestMode->CrtcHSyncEnd;
- modep->CrtcHBlankEnd = bestMode->CrtcHBlankEnd;
- modep->CrtcHTotal = bestMode->CrtcHTotal;
- modep->CrtcHSkew = bestMode->CrtcHSkew;
- modep->CrtcVDisplay = bestMode->CrtcVDisplay;
- modep->CrtcVBlankStart = bestMode->CrtcVBlankStart;
- modep->CrtcVSyncStart = bestMode->CrtcVSyncStart;
- modep->CrtcVSyncEnd = bestMode->CrtcVSyncEnd;
- modep->CrtcVBlankEnd = bestMode->CrtcVBlankEnd;
- modep->CrtcVTotal = bestMode->CrtcVTotal;
- modep->CrtcHAdjusted = bestMode->CrtcHAdjusted;
- modep->CrtcVAdjusted = bestMode->CrtcVAdjusted;
- modep->HSync = bestMode->HSync;
- modep->VRefresh = bestMode->VRefresh;
- modep->Private = bestMode->Private;
- modep->PrivSize = bestMode->PrivSize;
+ modep->type = bestMode->type;
+ modep->PrivFlags = ModePrivFlags;
+ modep->HDisplay = bestMode->HDisplay;
+ modep->HSyncStart = bestMode->HSyncStart;
+ modep->HSyncEnd = bestMode->HSyncEnd;
+ modep->HTotal = bestMode->HTotal;
+ modep->HSkew = bestMode->HSkew;
+ modep->VDisplay = bestMode->VDisplay;
+ modep->VSyncStart = bestMode->VSyncStart;
+ modep->VSyncEnd = bestMode->VSyncEnd;
+ modep->VTotal = bestMode->VTotal;
+ modep->VScan = bestMode->VScan;
+ modep->Flags = bestMode->Flags | extraFlags;
+ modep->CrtcHDisplay = bestMode->CrtcHDisplay;
+ modep->CrtcHBlankStart = bestMode->CrtcHBlankStart;
+ modep->CrtcHSyncStart = bestMode->CrtcHSyncStart;
+ modep->CrtcHSyncEnd = bestMode->CrtcHSyncEnd;
+ modep->CrtcHBlankEnd = bestMode->CrtcHBlankEnd;
+ modep->CrtcHTotal = bestMode->CrtcHTotal;
+ modep->CrtcHSkew = bestMode->CrtcHSkew;
+ modep->CrtcVDisplay = bestMode->CrtcVDisplay;
+ modep->CrtcVBlankStart = bestMode->CrtcVBlankStart;
+ modep->CrtcVSyncStart = bestMode->CrtcVSyncStart;
+ modep->CrtcVSyncEnd = bestMode->CrtcVSyncEnd;
+ modep->CrtcVBlankEnd = bestMode->CrtcVBlankEnd;
+ modep->CrtcVTotal = bestMode->CrtcVTotal;
+ modep->CrtcHAdjusted = bestMode->CrtcHAdjusted;
+ modep->CrtcVAdjusted = bestMode->CrtcVAdjusted;
+ modep->HSync = bestMode->HSync;
+ modep->VRefresh = bestMode->VRefresh;
+ modep->Private = bestMode->Private;
+ modep->PrivSize = bestMode->PrivSize;
bestMode->prev = modep;
@@ -699,51 +706,53 @@ xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor)
/* Sanity checks */
if (mode == NULL || monitor == NULL) {
- ErrorF("xf86CheckModeForMonitor: called with invalid parameters\n");
- return MODE_ERROR;
+ ErrorF("xf86CheckModeForMonitor: called with invalid parameters\n");
+ return MODE_ERROR;
}
DebugF("xf86CheckModeForMonitor(%p %s, %p %s)\n",
- mode, mode->name, monitor, monitor->id);
+ mode, mode->name, monitor, monitor->id);
/* Some basic mode validity checks */
if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart ||
- mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal)
- return MODE_H_ILLEGAL;
+ mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal)
+ return MODE_H_ILLEGAL;
if (0 >= mode->VDisplay || mode->VDisplay > mode->VSyncStart ||
- mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal)
- return MODE_V_ILLEGAL;
+ mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal)
+ return MODE_V_ILLEGAL;
if (monitor->nHsync > 0) {
- /* Check hsync against the allowed ranges */
- float hsync = xf86ModeHSync(mode);
- for (i = 0; i < monitor->nHsync; i++)
- if ((hsync > monitor->hsync[i].lo * (1.0 - SYNC_TOLERANCE)) &&
- (hsync < monitor->hsync[i].hi * (1.0 + SYNC_TOLERANCE)))
- break;
-
- /* Now see whether we ran out of sync ranges without finding a match */
- if (i == monitor->nHsync)
- return MODE_HSYNC;
+ /* Check hsync against the allowed ranges */
+ float hsync = xf86ModeHSync(mode);
+
+ for (i = 0; i < monitor->nHsync; i++)
+ if ((hsync > monitor->hsync[i].lo * (1.0 - SYNC_TOLERANCE)) &&
+ (hsync < monitor->hsync[i].hi * (1.0 + SYNC_TOLERANCE)))
+ break;
+
+ /* Now see whether we ran out of sync ranges without finding a match */
+ if (i == monitor->nHsync)
+ return MODE_HSYNC;
}
if (monitor->nVrefresh > 0) {
- /* Check vrefresh against the allowed ranges */
- float vrefrsh = xf86ModeVRefresh(mode);
- for (i = 0; i < monitor->nVrefresh; i++)
- if ((vrefrsh > monitor->vrefresh[i].lo * (1.0 - SYNC_TOLERANCE)) &&
- (vrefrsh < monitor->vrefresh[i].hi * (1.0 + SYNC_TOLERANCE)))
- break;
-
- /* Now see whether we ran out of refresh ranges without finding a match */
- if (i == monitor->nVrefresh)
- return MODE_VSYNC;
+ /* Check vrefresh against the allowed ranges */
+ float vrefrsh = xf86ModeVRefresh(mode);
+
+ for (i = 0; i < monitor->nVrefresh; i++)
+ if ((vrefrsh > monitor->vrefresh[i].lo * (1.0 - SYNC_TOLERANCE)) &&
+ (vrefrsh < monitor->vrefresh[i].hi * (1.0 + SYNC_TOLERANCE)))
+ break;
+
+ /* Now see whether we ran out of refresh ranges without finding a match */
+ if (i == monitor->nVrefresh)
+ return MODE_VSYNC;
}
/* Force interlaced modes to have an odd VTotal */
if (mode->Flags & V_INTERLACE)
- mode->CrtcVTotal = mode->VTotal |= 1;
+ mode->CrtcVTotal = mode->VTotal |= 1;
/*
* This code stops cvt -r modes, and only cvt -r modes, from hitting 15y+
@@ -759,7 +768,7 @@ xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor)
}
if ((monitor->maxPixClock) && (mode->Clock > monitor->maxPixClock))
- return MODE_CLOCK_HIGH;
+ return MODE_CLOCK_HIGH;
return MODE_OK;
}
@@ -774,16 +783,15 @@ xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor)
static Bool
xf86CheckModeSize(ScrnInfoPtr scrp, int w, int x, int y)
{
- int bpp = scrp->fbFormat.bitsPerPixel,
- pad = scrp->fbFormat.scanlinePad;
+ int bpp = scrp->fbFormat.bitsPerPixel, pad = scrp->fbFormat.scanlinePad;
int lineWidth, lastWidth;
if (scrp->depth == 4)
- pad *= 4; /* 4 planes */
+ pad *= 4; /* 4 planes */
/* Sanity check */
if ((w < 0) || (x < 0) || (y <= 0))
- return FALSE;
+ return FALSE;
lineWidth = (((w * bpp) + pad - 1) / pad) * pad;
lastWidth = x * bpp;
@@ -791,11 +799,11 @@ xf86CheckModeSize(ScrnInfoPtr scrp, int w, int x, int y)
/*
* At this point, we need to compare
*
- * (lineWidth * (y - 1)) + lastWidth
+ * (lineWidth * (y - 1)) + lastWidth
*
* against
*
- * scrp->videoRam * (1024 * 8)
+ * scrp->videoRam * (1024 * 8)
*
* These are bit quantities. To avoid overflows, do the comparison in
* terms of BITMAP_SCANLINE_PAD units. This assumes BITMAP_SCANLINE_PAD
@@ -807,8 +815,8 @@ xf86CheckModeSize(ScrnInfoPtr scrp, int w, int x, int y)
lastWidth = (lastWidth + (BITMAP_SCANLINE_PAD - 1)) / BITMAP_SCANLINE_PAD;
if ((lineWidth * (y - 1) + lastWidth) >
- (scrp->videoRam * ((1024 * 8) / BITMAP_SCANLINE_PAD)))
- return FALSE;
+ (scrp->videoRam * ((1024 * 8) / BITMAP_SCANLINE_PAD)))
+ return FALSE;
return TRUE;
}
@@ -839,52 +847,53 @@ xf86CheckModeSize(ScrnInfoPtr scrp, int w, int x, int y)
ModeStatus
xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
- ClockRangePtr clockRanges,
- LookupModeFlags strategy,
- int maxPitch, int virtualX, int virtualY)
+ ClockRangePtr clockRanges,
+ LookupModeFlags strategy,
+ int maxPitch, int virtualX, int virtualY)
{
ClockRangePtr cp;
ModeStatus status;
Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0;
int i, needDiv2;
-
+
/* Sanity checks */
if (!scrp || !mode || !clockRanges) {
- ErrorF("xf86InitialCheckModeForDriver: "
- "called with invalid parameters\n");
- return MODE_ERROR;
+ ErrorF("xf86InitialCheckModeForDriver: "
+ "called with invalid parameters\n");
+ return MODE_ERROR;
}
DebugF("xf86InitialCheckModeForDriver(%p, %p %s, %p, 0x%x, %d, %d, %d)\n",
- scrp, mode, mode->name , clockRanges, strategy, maxPitch, virtualX, virtualY);
+ scrp, mode, mode->name, clockRanges, strategy, maxPitch, virtualX,
+ virtualY);
/* Some basic mode validity checks */
if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart ||
- mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal)
- return MODE_H_ILLEGAL;
+ mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal)
+ return MODE_H_ILLEGAL;
if (0 >= mode->VDisplay || mode->VDisplay > mode->VSyncStart ||
- mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal)
- return MODE_V_ILLEGAL;
+ mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal)
+ return MODE_V_ILLEGAL;
if (!xf86CheckModeSize(scrp, mode->HDisplay, mode->HDisplay,
- mode->VDisplay))
+ mode->VDisplay))
return MODE_MEM;
if (maxPitch > 0 && mode->HDisplay > maxPitch)
- return MODE_BAD_WIDTH;
+ return MODE_BAD_WIDTH;
if (virtualX > 0 && mode->HDisplay > virtualX)
- return MODE_VIRTUAL_X;
+ return MODE_VIRTUAL_X;
if (virtualY > 0 && mode->VDisplay > virtualY)
- return MODE_VIRTUAL_Y;
+ return MODE_VIRTUAL_Y;
if (scrp->maxHValue > 0 && mode->HTotal > scrp->maxHValue)
- return MODE_BAD_HVALUE;
+ return MODE_BAD_HVALUE;
if (scrp->maxVValue > 0 && mode->VTotal > scrp->maxVValue)
- return MODE_BAD_VVALUE;
+ return MODE_BAD_VVALUE;
/*
* The use of the DisplayModeRec's Crtc* and SynthClock elements below is
@@ -910,48 +919,49 @@ xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
* confusion and is bad software design. However since it's part of
* the driver API it's hard to change.
*/
-
+
if (scrp->ValidMode) {
-
- xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
-
- cp = xf86FindClockRangeForMode(clockRanges, mode);
- if (!cp)
- return MODE_CLOCK_RANGE;
-
- if (cp->ClockMulFactor < 1)
- cp->ClockMulFactor = 1;
- if (cp->ClockDivFactor < 1)
- cp->ClockDivFactor = 1;
-
- /*
- * XXX The effect of clock dividers and multipliers on the monitor's
- * pixel clock needs to be verified.
- */
- if (scrp->progClock) {
- mode->SynthClock = mode->Clock;
- } else {
- i = xf86GetNearestClock(scrp, mode->Clock, allowDiv2,
- cp->ClockDivFactor, cp->ClockMulFactor,
- &needDiv2);
- mode->SynthClock = (scrp->clock[i] * cp->ClockDivFactor) /
- cp->ClockMulFactor;
- if (needDiv2 & V_CLKDIV2)
- mode->SynthClock /= 2;
- }
-
- status = (*scrp->ValidMode)(scrp->scrnIndex, mode, FALSE,
- MODECHECK_INITIAL);
- if (status != MODE_OK)
- return status;
-
- if (mode->HSync <= 0.0)
- mode->HSync = (float)mode->SynthClock / (float)mode->CrtcHTotal;
- if (mode->VRefresh <= 0.0)
- mode->VRefresh = (mode->SynthClock * 1000.0)
- / (mode->CrtcHTotal * mode->CrtcVTotal);
+
+ xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
+
+ cp = xf86FindClockRangeForMode(clockRanges, mode);
+ if (!cp)
+ return MODE_CLOCK_RANGE;
+
+ if (cp->ClockMulFactor < 1)
+ cp->ClockMulFactor = 1;
+ if (cp->ClockDivFactor < 1)
+ cp->ClockDivFactor = 1;
+
+ /*
+ * XXX The effect of clock dividers and multipliers on the monitor's
+ * pixel clock needs to be verified.
+ */
+ if (scrp->progClock) {
+ mode->SynthClock = mode->Clock;
+ }
+ else {
+ i = xf86GetNearestClock(scrp, mode->Clock, allowDiv2,
+ cp->ClockDivFactor, cp->ClockMulFactor,
+ &needDiv2);
+ mode->SynthClock = (scrp->clock[i] * cp->ClockDivFactor) /
+ cp->ClockMulFactor;
+ if (needDiv2 & V_CLKDIV2)
+ mode->SynthClock /= 2;
+ }
+
+ status = (*scrp->ValidMode) (scrp->scrnIndex, mode, FALSE,
+ MODECHECK_INITIAL);
+ if (status != MODE_OK)
+ return status;
+
+ if (mode->HSync <= 0.0)
+ mode->HSync = (float) mode->SynthClock / (float) mode->CrtcHTotal;
+ if (mode->VRefresh <= 0.0)
+ mode->VRefresh = (mode->SynthClock * 1000.0)
+ / (mode->CrtcHTotal * mode->CrtcVTotal);
}
-
+
mode->HSync = xf86ModeHSync(mode);
mode->VRefresh = xf86ModeVRefresh(mode);
@@ -996,109 +1006,112 @@ xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags)
ModeStatus status = MODE_NOMODE;
/* Some sanity checking */
- if (scrp == NULL || (!scrp->progClock && scrp->numClocks == 0)) {
- ErrorF("xf86CheckModeForDriver: called with invalid scrnInfoRec\n");
- return MODE_ERROR;
+ if (scrp == NULL || (!scrp->progClock && scrp->numClocks == 0)) {
+ ErrorF("xf86CheckModeForDriver: called with invalid scrnInfoRec\n");
+ return MODE_ERROR;
}
if (mode == NULL) {
- ErrorF("xf86CheckModeForDriver: called with invalid modep\n");
- return MODE_ERROR;
+ ErrorF("xf86CheckModeForDriver: called with invalid modep\n");
+ return MODE_ERROR;
}
/* Check the mode size */
if (mode->HDisplay > scrp->virtualX)
- return MODE_VIRTUAL_X;
+ return MODE_VIRTUAL_X;
if (mode->VDisplay > scrp->virtualY)
- return MODE_VIRTUAL_Y;
+ return MODE_VIRTUAL_Y;
if (scrp->maxHValue > 0 && mode->HTotal > scrp->maxHValue)
- return MODE_BAD_HVALUE;
+ return MODE_BAD_HVALUE;
if (scrp->maxVValue > 0 && mode->VTotal > scrp->maxVValue)
- return MODE_BAD_VVALUE;
+ return MODE_BAD_VVALUE;
for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) {
- /* DivFactor and MulFactor must be > 0 */
- cp->ClockDivFactor = max(1, cp->ClockDivFactor);
- cp->ClockMulFactor = max(1, cp->ClockMulFactor);
+ /* DivFactor and MulFactor must be > 0 */
+ cp->ClockDivFactor = max(1, cp->ClockDivFactor);
+ cp->ClockMulFactor = max(1, cp->ClockMulFactor);
}
if (scrp->progClock) {
- /* Check clock is in range */
- for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) {
- if (modeInClockRange(cp, mode))
- break;
- }
- if (cp == NULL) {
- return MODE_CLOCK_RANGE;
- }
- /*
- * If programmable clock the required mode has been found
- */
- DivFactor = cp->ClockDivFactor;
- MulFactor = cp->ClockMulFactor;
- ModePrivFlags = cp->PrivFlags;
- } else {
- status = MODE_CLOCK_RANGE;
- /* Check clock is in range */
- for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) {
- if (modeInClockRange(cp, mode)) {
- /*
- * Clock is in range, so if it is not a programmable clock,
- * find a matching clock.
- */
-
- i = xf86GetNearestClock(scrp, mode->Clock, 0,
- cp->ClockDivFactor, cp->ClockMulFactor, &k);
- /*
- * If the clock is too far from the requested clock, this
- * mode is no good.
- */
- if (k & V_CLKDIV2)
- gap = abs((mode->Clock * 2) -
- ((scrp->clock[i] * cp->ClockDivFactor) /
- cp->ClockMulFactor));
- else
- gap = abs(mode->Clock -
- ((scrp->clock[i] * cp->ClockDivFactor) /
- cp->ClockMulFactor));
- if (gap > minimumGap) {
- status = MODE_NOCLOCK;
- continue;
- }
-
- DivFactor = cp->ClockDivFactor;
- MulFactor = cp->ClockMulFactor;
- ModePrivFlags = cp->PrivFlags;
- extraFlags = k;
- clockIndex = i;
- break;
- }
- }
- if (cp == NULL)
- return status;
+ /* Check clock is in range */
+ for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) {
+ if (modeInClockRange(cp, mode))
+ break;
+ }
+ if (cp == NULL) {
+ return MODE_CLOCK_RANGE;
+ }
+ /*
+ * If programmable clock the required mode has been found
+ */
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ }
+ else {
+ status = MODE_CLOCK_RANGE;
+ /* Check clock is in range */
+ for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) {
+ if (modeInClockRange(cp, mode)) {
+ /*
+ * Clock is in range, so if it is not a programmable clock,
+ * find a matching clock.
+ */
+
+ i = xf86GetNearestClock(scrp, mode->Clock, 0,
+ cp->ClockDivFactor, cp->ClockMulFactor,
+ &k);
+ /*
+ * If the clock is too far from the requested clock, this
+ * mode is no good.
+ */
+ if (k & V_CLKDIV2)
+ gap = abs((mode->Clock * 2) -
+ ((scrp->clock[i] * cp->ClockDivFactor) /
+ cp->ClockMulFactor));
+ else
+ gap = abs(mode->Clock -
+ ((scrp->clock[i] * cp->ClockDivFactor) /
+ cp->ClockMulFactor));
+ if (gap > minimumGap) {
+ status = MODE_NOCLOCK;
+ continue;
+ }
+
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ break;
+ }
+ }
+ if (cp == NULL)
+ return status;
}
/* Fill in the mode parameters */
if (scrp->progClock) {
- mode->ClockIndex = -1;
- mode->SynthClock = (mode->Clock * MulFactor) / DivFactor;
- } else {
- mode->Clock = (scrp->clock[clockIndex] * DivFactor) / MulFactor;
- mode->ClockIndex = clockIndex;
- mode->SynthClock = scrp->clock[clockIndex];
- if (extraFlags & V_CLKDIV2) {
- mode->Clock /= 2;
- mode->SynthClock /= 2;
- }
+ mode->ClockIndex = -1;
+ mode->SynthClock = (mode->Clock * MulFactor) / DivFactor;
}
- mode->PrivFlags = ModePrivFlags;
+ else {
+ mode->Clock = (scrp->clock[clockIndex] * DivFactor) / MulFactor;
+ mode->ClockIndex = clockIndex;
+ mode->SynthClock = scrp->clock[clockIndex];
+ if (extraFlags & V_CLKDIV2) {
+ mode->Clock /= 2;
+ mode->SynthClock /= 2;
+ }
+ }
+ mode->PrivFlags = ModePrivFlags;
return MODE_OK;
}
-static int
+static int
inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy)
{
float aspect = 0.0;
@@ -1107,24 +1120,25 @@ inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy)
int x = 0, y = 0;
DisplayModePtr mode;
- if (!mon) return 0;
+ if (!mon)
+ return 0;
DDC = mon->DDC;
if (DDC && DDC->ver.revision >= 4) {
- /* For 1.4, we might actually get native pixel format. How novel. */
- if (PREFERRED_TIMING_MODE(DDC->features.msc)) {
- for (mode = modes; mode; mode = mode->next) {
- if (mode->type & (M_T_DRIVER | M_T_PREFERRED)) {
- x = mode->HDisplay;
- y = mode->VDisplay;
- goto found;
- }
- }
- }
- /*
- * Even if we don't, we might get aspect ratio from extra CVT info
- * or from the monitor size fields. TODO.
- */
+ /* For 1.4, we might actually get native pixel format. How novel. */
+ if (PREFERRED_TIMING_MODE(DDC->features.msc)) {
+ for (mode = modes; mode; mode = mode->next) {
+ if (mode->type & (M_T_DRIVER | M_T_PREFERRED)) {
+ x = mode->HDisplay;
+ y = mode->VDisplay;
+ goto found;
+ }
+ }
+ }
+ /*
+ * Even if we don't, we might get aspect ratio from extra CVT info
+ * or from the monitor size fields. TODO.
+ */
}
/*
@@ -1132,41 +1146,42 @@ inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy)
* before EDID 1.4, but right now we'll get that wrong. TODO.
*/
if (!aspect) {
- if (!mon->widthmm || !mon->heightmm)
- aspect = 4.0/3.0;
- else
- aspect = (float)mon->widthmm / (float)mon->heightmm;
+ if (!mon->widthmm || !mon->heightmm)
+ aspect = 4.0 / 3.0;
+ else
+ aspect = (float) mon->widthmm / (float) mon->heightmm;
}
/* find the largest M_T_DRIVER mode with that aspect ratio */
for (mode = modes; mode; mode = mode->next) {
- float mode_aspect, metaspect;
- if (!(mode->type & (M_T_DRIVER|M_T_USERDEF)))
- continue;
- mode_aspect = (float)mode->HDisplay / (float)mode->VDisplay;
- metaspect = aspect / mode_aspect;
- /* 5% slop or so, since we only get size in centimeters */
- if (fabs(1.0 - metaspect) < 0.05) {
- if ((mode->HDisplay > x) && (mode->VDisplay > y)) {
- x = mode->HDisplay;
- y = mode->VDisplay;
- }
- }
+ float mode_aspect, metaspect;
+
+ if (!(mode->type & (M_T_DRIVER | M_T_USERDEF)))
+ continue;
+ mode_aspect = (float) mode->HDisplay / (float) mode->VDisplay;
+ metaspect = aspect / mode_aspect;
+ /* 5% slop or so, since we only get size in centimeters */
+ if (fabs(1.0 - metaspect) < 0.05) {
+ if ((mode->HDisplay > x) && (mode->VDisplay > y)) {
+ x = mode->HDisplay;
+ y = mode->VDisplay;
+ }
+ }
}
if (!x || !y) {
- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
- "Unable to estimate virtual size\n");
- return 0;
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+ "Unable to estimate virtual size\n");
+ return 0;
}
-found:
+ found:
*vx = x;
*vy = y;
xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "Estimated virtual size for aspect ratio %.4f is %dx%d\n",
- aspect, *vx, *vy);
+ "Estimated virtual size for aspect ratio %.4f is %dx%d\n",
+ aspect, *vx, *vy);
return 1;
}
@@ -1177,8 +1192,7 @@ LCM(unsigned int x, unsigned int y)
{
unsigned int m = x, n = y, o;
- while ((o = m % n))
- {
+ while ((o = m % n)) {
m = n;
n = o;
}
@@ -1193,14 +1207,12 @@ LCM(unsigned int x, unsigned int y)
* cannot exist.
*/
static int
-scanLineWidth(
- unsigned int xsize, /* pixels */
- unsigned int ysize, /* pixels */
- unsigned int width, /* pixels */
- unsigned long BankSize, /* char's */
- PixmapFormatRec *pBankFormat,
- unsigned int nWidthUnit /* bits */
-)
+scanLineWidth(unsigned int xsize, /* pixels */
+ unsigned int ysize, /* pixels */
+ unsigned int width, /* pixels */
+ unsigned long BankSize, /* char's */
+ PixmapFormatRec * pBankFormat, unsigned int nWidthUnit /* bits */
+ )
{
unsigned long nBitsPerBank, nBitsPerScanline, nBitsPerScanlinePadUnit;
unsigned long minBitsPerScanline, maxBitsPerScanline;
@@ -1223,7 +1235,7 @@ scanLineWidth(
width = nBitsPerScanline / pBankFormat->bitsPerPixel;
if (!xsize || !(nBitsPerBank % pBankFormat->bitsPerPixel))
- return (int)width;
+ return (int) width;
/*
* Scanlines will be server-pad aligned at this point. They will also be
@@ -1244,40 +1256,36 @@ scanLineWidth(
return -1;
if (ysize == 1)
- return (int)width;
+ return (int) width;
maxBitsPerScanline =
- (((unsigned long)(-1) >> 1) - minBitsPerScanline) / (ysize - 1);
- while (nBitsPerScanline <= maxBitsPerScanline)
- {
+ (((unsigned long) (-1) >> 1) - minBitsPerScanline) / (ysize - 1);
+ while (nBitsPerScanline <= maxBitsPerScanline) {
unsigned long BankBase, BankUnit;
BankUnit = ((nBitsPerBank + nBitsPerScanline - 1) / nBitsPerBank) *
nBitsPerBank;
if (!(BankUnit % nBitsPerScanline))
- return (int)width;
+ return (int) width;
- for (BankBase = BankUnit; ; BankBase += nBitsPerBank)
- {
+ for (BankBase = BankUnit;; BankBase += nBitsPerBank) {
unsigned long x, y;
y = BankBase / nBitsPerScanline;
if (y >= ysize)
- return (int)width;
+ return (int) width;
x = BankBase % nBitsPerScanline;
if (!(x % pBankFormat->bitsPerPixel))
continue;
- if (x < minBitsPerScanline)
- {
+ if (x < minBitsPerScanline) {
/*
* Skip ahead certain widths by dividing the excess scanline
* amongst the y's.
*/
y *= nBitsPerScanlinePadUnit;
- nBitsPerScanline +=
- ((x + y - 1) / y) * nBitsPerScanlinePadUnit;
+ nBitsPerScanline += ((x + y - 1) / y) * nBitsPerScanlinePadUnit;
width = nBitsPerScanline / pBankFormat->bitsPerPixel;
break;
}
@@ -1286,10 +1294,10 @@ scanLineWidth(
continue;
if (!(nBitsPerScanline % x))
- return (int)width;
+ return (int) width;
BankBase = ((nBitsPerScanline - minBitsPerScanline) /
- (nBitsPerScanline - x)) * BankUnit;
+ (nBitsPerScanline - x)) * BankUnit;
}
}
@@ -1346,17 +1354,17 @@ scanLineWidth(
int
xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
- char **modeNames, ClockRangePtr clockRanges,
- int *linePitches, int minPitch, int maxPitch, int pitchInc,
- int minHeight, int maxHeight, int virtualX, int virtualY,
- int apertureSize, LookupModeFlags strategy)
+ char **modeNames, ClockRangePtr clockRanges,
+ int *linePitches, int minPitch, int maxPitch, int pitchInc,
+ int minHeight, int maxHeight, int virtualX, int virtualY,
+ int apertureSize, LookupModeFlags strategy)
{
DisplayModePtr p, q, r, new, last, *endp;
int i, numModes = 0;
ModeStatus status;
int linePitch = -1, virtX = 0, virtY = 0;
int newLinePitch, newVirtX, newVirtY;
- int modeSize; /* in pixels */
+ int modeSize; /* in pixels */
Bool validateAllDefaultModes = FALSE;
Bool userModes = FALSE;
int saveType;
@@ -1368,30 +1376,29 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
range vrefresh[MAX_VREFRESH];
Bool inferred_virtual = FALSE;
- DebugF("xf86ValidateModes(%p, %p, %p, %p,\n\t\t %p, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x)\n",
- scrp, availModes, modeNames, clockRanges,
- linePitches, minPitch, maxPitch, pitchInc,
- minHeight, maxHeight, virtualX, virtualY,
- apertureSize, strategy
- );
+ DebugF
+ ("xf86ValidateModes(%p, %p, %p, %p,\n\t\t %p, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x)\n",
+ scrp, availModes, modeNames, clockRanges, linePitches, minPitch,
+ maxPitch, pitchInc, minHeight, maxHeight, virtualX, virtualY,
+ apertureSize, strategy);
/* Some sanity checking */
if (scrp == NULL || scrp->name == NULL || !scrp->monitor ||
- (!scrp->progClock && scrp->numClocks == 0)) {
- ErrorF("xf86ValidateModes: called with invalid scrnInfoRec\n");
- return -1;
+ (!scrp->progClock && scrp->numClocks == 0)) {
+ ErrorF("xf86ValidateModes: called with invalid scrnInfoRec\n");
+ return -1;
}
if (linePitches != NULL && linePitches[0] <= 0) {
- ErrorF("xf86ValidateModes: called with invalid linePitches\n");
- return -1;
+ ErrorF("xf86ValidateModes: called with invalid linePitches\n");
+ return -1;
}
if (pitchInc <= 0) {
- ErrorF("xf86ValidateModes: called with invalid pitchInc\n");
- return -1;
+ ErrorF("xf86ValidateModes: called with invalid pitchInc\n");
+ return -1;
}
if ((virtualX > 0) != (virtualY > 0)) {
- ErrorF("xf86ValidateModes: called with invalid virtual resolution\n");
- return -1;
+ ErrorF("xf86ValidateModes: called with invalid virtual resolution\n");
+ return -1;
}
/*
@@ -1399,83 +1406,87 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
* in the monitor section.
*/
if (strategy & LOOKUP_OPTIONAL_TOLERANCES) {
- strategy &= ~LOOKUP_OPTIONAL_TOLERANCES;
- } else {
- const char *type = "";
+ strategy &= ~LOOKUP_OPTIONAL_TOLERANCES;
+ }
+ else {
+ const char *type = "";
Bool specified = FALSE;
- if (scrp->monitor->nHsync <= 0) {
- if (numTimings > 0) {
- scrp->monitor->nHsync = numTimings;
- for (i = 0; i < numTimings; i++) {
- scrp->monitor->hsync[i].lo = hsync[i].lo;
- scrp->monitor->hsync[i].hi = hsync[i].hi;
- }
- } else {
- scrp->monitor->hsync[0].lo = 31.5;
- scrp->monitor->hsync[0].hi = 48.0;
- scrp->monitor->nHsync = 1;
- }
- type = "default ";
- } else {
+ if (scrp->monitor->nHsync <= 0) {
+ if (numTimings > 0) {
+ scrp->monitor->nHsync = numTimings;
+ for (i = 0; i < numTimings; i++) {
+ scrp->monitor->hsync[i].lo = hsync[i].lo;
+ scrp->monitor->hsync[i].hi = hsync[i].hi;
+ }
+ }
+ else {
+ scrp->monitor->hsync[0].lo = 31.5;
+ scrp->monitor->hsync[0].hi = 48.0;
+ scrp->monitor->nHsync = 1;
+ }
+ type = "default ";
+ }
+ else {
specified = TRUE;
}
- for (i = 0; i < scrp->monitor->nHsync; i++) {
- if (scrp->monitor->hsync[i].lo == scrp->monitor->hsync[i].hi)
- xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "%s: Using %shsync value of %.2f kHz\n",
- scrp->monitor->id, type,
- scrp->monitor->hsync[i].lo);
- else
- xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "%s: Using %shsync range of %.2f-%.2f kHz\n",
- scrp->monitor->id, type,
- scrp->monitor->hsync[i].lo,
- scrp->monitor->hsync[i].hi);
- }
-
- type = "";
- if (scrp->monitor->nVrefresh <= 0) {
- if (numTimings > 0) {
- scrp->monitor->nVrefresh = numTimings;
- for (i = 0; i < numTimings; i++) {
- scrp->monitor->vrefresh[i].lo = vrefresh[i].lo;
- scrp->monitor->vrefresh[i].hi = vrefresh[i].hi;
- }
- } else {
- scrp->monitor->vrefresh[0].lo = 50;
- scrp->monitor->vrefresh[0].hi = 70;
- scrp->monitor->nVrefresh = 1;
- }
- type = "default ";
- } else {
+ for (i = 0; i < scrp->monitor->nHsync; i++) {
+ if (scrp->monitor->hsync[i].lo == scrp->monitor->hsync[i].hi)
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "%s: Using %shsync value of %.2f kHz\n",
+ scrp->monitor->id, type, scrp->monitor->hsync[i].lo);
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "%s: Using %shsync range of %.2f-%.2f kHz\n",
+ scrp->monitor->id, type,
+ scrp->monitor->hsync[i].lo,
+ scrp->monitor->hsync[i].hi);
+ }
+
+ type = "";
+ if (scrp->monitor->nVrefresh <= 0) {
+ if (numTimings > 0) {
+ scrp->monitor->nVrefresh = numTimings;
+ for (i = 0; i < numTimings; i++) {
+ scrp->monitor->vrefresh[i].lo = vrefresh[i].lo;
+ scrp->monitor->vrefresh[i].hi = vrefresh[i].hi;
+ }
+ }
+ else {
+ scrp->monitor->vrefresh[0].lo = 50;
+ scrp->monitor->vrefresh[0].hi = 70;
+ scrp->monitor->nVrefresh = 1;
+ }
+ type = "default ";
+ }
+ else {
specified = TRUE;
}
- for (i = 0; i < scrp->monitor->nVrefresh; i++) {
- if (scrp->monitor->vrefresh[i].lo == scrp->monitor->vrefresh[i].hi)
- xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "%s: Using %svrefresh value of %.2f Hz\n",
- scrp->monitor->id, type,
- scrp->monitor->vrefresh[i].lo);
- else
- xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "%s: Using %svrefresh range of %.2f-%.2f Hz\n",
- scrp->monitor->id, type,
- scrp->monitor->vrefresh[i].lo,
- scrp->monitor->vrefresh[i].hi);
- }
+ for (i = 0; i < scrp->monitor->nVrefresh; i++) {
+ if (scrp->monitor->vrefresh[i].lo == scrp->monitor->vrefresh[i].hi)
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "%s: Using %svrefresh value of %.2f Hz\n",
+ scrp->monitor->id, type,
+ scrp->monitor->vrefresh[i].lo);
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "%s: Using %svrefresh range of %.2f-%.2f Hz\n",
+ scrp->monitor->id, type,
+ scrp->monitor->vrefresh[i].lo,
+ scrp->monitor->vrefresh[i].hi);
+ }
type = "";
- if (!scrp->monitor->maxPixClock && !specified) {
+ if (!scrp->monitor->maxPixClock && !specified) {
type = "default ";
scrp->monitor->maxPixClock = 65000.0;
}
- if (scrp->monitor->maxPixClock) {
- xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "%s: Using %smaximum pixel clock of %.2f MHz\n",
- scrp->monitor->id, type,
- (float)scrp->monitor->maxPixClock / 1000.0);
- }
+ if (scrp->monitor->maxPixClock) {
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "%s: Using %smaximum pixel clock of %.2f MHz\n",
+ scrp->monitor->id, type,
+ (float) scrp->monitor->maxPixClock / 1000.0);
+ }
}
/*
@@ -1483,24 +1494,24 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
*/
storeClockRanges = scrp->clockRanges;
while (storeClockRanges != NULL) {
- storeClockRanges = storeClockRanges->next;
+ storeClockRanges = storeClockRanges->next;
}
for (cp = clockRanges; cp != NULL; cp = cp->next,
- storeClockRanges = storeClockRanges->next) {
- storeClockRanges = xnfalloc(sizeof(ClockRange));
- if (scrp->clockRanges == NULL)
- scrp->clockRanges = storeClockRanges;
- memcpy(storeClockRanges, cp, sizeof(ClockRange));
+ storeClockRanges = storeClockRanges->next) {
+ storeClockRanges = xnfalloc(sizeof(ClockRange));
+ if (scrp->clockRanges == NULL)
+ scrp->clockRanges = storeClockRanges;
+ memcpy(storeClockRanges, cp, sizeof(ClockRange));
}
/* Determine which pixmap format to pass to scanLineWidth() */
if (scrp->depth > 4)
- BankFormat = &scrp->fbFormat;
+ BankFormat = &scrp->fbFormat;
else
- BankFormat = xf86GetPixFormat(scrp, 1); /* >not< scrp->depth! */
+ BankFormat = xf86GetPixFormat(scrp, 1); /* >not< scrp->depth! */
if (scrp->xInc <= 0)
- scrp->xInc = 8; /* Suitable for VGA and others */
+ scrp->xInc = 8; /* Suitable for VGA and others */
#define _VIRTUALX(x) ((((x) + scrp->xInc - 1) / scrp->xInc) * scrp->xInc)
@@ -1510,13 +1521,13 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
* maxPitch values passed are ignored.
*/
if (linePitches) {
- minPitch = maxPitch = linePitches[0];
- for (i = 1; linePitches[i] > 0; i++) {
- if (linePitches[i] > maxPitch)
- maxPitch = linePitches[i];
- if (linePitches[i] < minPitch)
- minPitch = linePitches[i];
- }
+ minPitch = maxPitch = linePitches[0];
+ for (i = 1; linePitches[i] > 0; i++) {
+ if (linePitches[i] > maxPitch)
+ maxPitch = linePitches[i];
+ if (linePitches[i] < minPitch)
+ minPitch = linePitches[i];
+ }
}
/* Initial check of virtual size against other constraints */
@@ -1525,60 +1536,62 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
* Initialise virtX and virtY if the values are fixed.
*/
if (virtualY > 0) {
- if (maxHeight > 0 && virtualY > maxHeight) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Virtual height (%d) is too large for the hardware "
- "(max %d)\n", virtualY, maxHeight);
- return -1;
- }
-
- if (minHeight > 0 && virtualY < minHeight) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Virtual height (%d) is too small for the hardware "
- "(min %d)\n", virtualY, minHeight);
- return -1;
- }
-
- virtualX = _VIRTUALX(virtualX);
- if (linePitches != NULL) {
- for (i = 0; linePitches[i] != 0; i++) {
- if ((linePitches[i] >= virtualX) &&
- (linePitches[i] ==
- scanLineWidth(virtualX, virtualY, linePitches[i],
- apertureSize, BankFormat, pitchInc))) {
- linePitch = linePitches[i];
- break;
- }
- }
- } else {
- linePitch = scanLineWidth(virtualX, virtualY, minPitch,
- apertureSize, BankFormat, pitchInc);
- }
-
- if ((linePitch < minPitch) || (linePitch > maxPitch)) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Virtual width (%d) is too large for the hardware "
- "(max %d)\n", virtualX, maxPitch);
- return -1;
- }
-
- if (!xf86CheckModeSize(scrp, linePitch, virtualX, virtualY)) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Virtual size (%dx%d) (pitch %d) exceeds video memory\n",
- virtualX, virtualY, linePitch);
- return -1;
- }
-
- virtX = virtualX;
- virtY = virtualY;
- scrp->virtualFrom = X_CONFIG;
- } else if (!modeNames || !*modeNames) {
- /* No virtual size given in the config, try to infer */
- /* XXX this doesn't take m{in,ax}Pitch into account; oh well */
- inferred_virtual = inferVirtualSize(scrp, availModes, &virtX, &virtY);
- if (inferred_virtual)
- linePitch = scanLineWidth(virtX, virtY, minPitch, apertureSize,
- BankFormat, pitchInc);
+ if (maxHeight > 0 && virtualY > maxHeight) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual height (%d) is too large for the hardware "
+ "(max %d)\n", virtualY, maxHeight);
+ return -1;
+ }
+
+ if (minHeight > 0 && virtualY < minHeight) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual height (%d) is too small for the hardware "
+ "(min %d)\n", virtualY, minHeight);
+ return -1;
+ }
+
+ virtualX = _VIRTUALX(virtualX);
+ if (linePitches != NULL) {
+ for (i = 0; linePitches[i] != 0; i++) {
+ if ((linePitches[i] >= virtualX) &&
+ (linePitches[i] ==
+ scanLineWidth(virtualX, virtualY, linePitches[i],
+ apertureSize, BankFormat, pitchInc))) {
+ linePitch = linePitches[i];
+ break;
+ }
+ }
+ }
+ else {
+ linePitch = scanLineWidth(virtualX, virtualY, minPitch,
+ apertureSize, BankFormat, pitchInc);
+ }
+
+ if ((linePitch < minPitch) || (linePitch > maxPitch)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual width (%d) is too large for the hardware "
+ "(max %d)\n", virtualX, maxPitch);
+ return -1;
+ }
+
+ if (!xf86CheckModeSize(scrp, linePitch, virtualX, virtualY)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual size (%dx%d) (pitch %d) exceeds video memory\n",
+ virtualX, virtualY, linePitch);
+ return -1;
+ }
+
+ virtX = virtualX;
+ virtY = virtualY;
+ scrp->virtualFrom = X_CONFIG;
+ }
+ else if (!modeNames || !*modeNames) {
+ /* No virtual size given in the config, try to infer */
+ /* XXX this doesn't take m{in,ax}Pitch into account; oh well */
+ inferred_virtual = inferVirtualSize(scrp, availModes, &virtX, &virtY);
+ if (inferred_virtual)
+ linePitch = scanLineWidth(virtX, virtY, minPitch, apertureSize,
+ BankFormat, pitchInc);
}
/* Print clock ranges and scaled clocks */
@@ -1591,253 +1604,256 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
* member of the scrp->modes list for which a match was considered.
*/
if (scrp->modePool == NULL) {
- q = NULL;
- for (p = availModes; p != NULL; p = p->next) {
- status = xf86InitialCheckModeForDriver(scrp, p, clockRanges,
- strategy, maxPitch,
- virtX, virtY);
-
- if (status == MODE_OK) {
- status = xf86CheckModeForMonitor(p, scrp->monitor);
- }
-
- if (status == MODE_OK) {
- new = xnfalloc(sizeof(DisplayModeRec));
- *new = *p;
- new->next = NULL;
- if (!q) {
- scrp->modePool = new;
- } else {
- q->next = new;
- }
- new->prev = NULL;
- q = new;
- q->name = xnfstrdup(p->name);
- q->status = MODE_OK;
- } else {
- printModeRejectMessage(scrp->scrnIndex, p, status);
- }
- }
-
- if (scrp->modePool == NULL) {
- xf86DrvMsg(scrp->scrnIndex, X_WARNING, "Mode pool is empty\n");
- return 0;
- }
- } else {
- for (p = scrp->modePool; p != NULL; p = p->next) {
- p->prev = NULL;
- p->status = MODE_OK;
- }
+ q = NULL;
+ for (p = availModes; p != NULL; p = p->next) {
+ status = xf86InitialCheckModeForDriver(scrp, p, clockRanges,
+ strategy, maxPitch,
+ virtX, virtY);
+
+ if (status == MODE_OK) {
+ status = xf86CheckModeForMonitor(p, scrp->monitor);
+ }
+
+ if (status == MODE_OK) {
+ new = xnfalloc(sizeof(DisplayModeRec));
+ *new = *p;
+ new->next = NULL;
+ if (!q) {
+ scrp->modePool = new;
+ }
+ else {
+ q->next = new;
+ }
+ new->prev = NULL;
+ q = new;
+ q->name = xnfstrdup(p->name);
+ q->status = MODE_OK;
+ }
+ else {
+ printModeRejectMessage(scrp->scrnIndex, p, status);
+ }
+ }
+
+ if (scrp->modePool == NULL) {
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING, "Mode pool is empty\n");
+ return 0;
+ }
+ }
+ else {
+ for (p = scrp->modePool; p != NULL; p = p->next) {
+ p->prev = NULL;
+ p->status = MODE_OK;
+ }
}
/*
* Allocate one entry in scrp->modes for each named mode.
*/
while (scrp->modes)
- xf86DeleteMode(&scrp->modes, scrp->modes);
+ xf86DeleteMode(&scrp->modes, scrp->modes);
endp = &scrp->modes;
last = NULL;
if (modeNames != NULL) {
- for (i = 0; modeNames[i] != NULL; i++) {
- userModes = TRUE;
- new = xnfcalloc(1, sizeof(DisplayModeRec));
- new->prev = last;
- new->type = M_T_USERDEF;
- new->name = xnfstrdup(modeNames[i]);
- if (new->prev)
- new->prev->next = new;
- *endp = last = new;
- endp = &new->next;
- }
+ for (i = 0; modeNames[i] != NULL; i++) {
+ userModes = TRUE;
+ new = xnfcalloc(1, sizeof(DisplayModeRec));
+ new->prev = last;
+ new->type = M_T_USERDEF;
+ new->name = xnfstrdup(modeNames[i]);
+ if (new->prev)
+ new->prev->next = new;
+ *endp = last = new;
+ endp = &new->next;
+ }
}
/* Lookup each mode */
#ifdef RANDR
- if (!xf86Info.disableRandR
+ if (!xf86Info.disableRandR
#ifdef PANORAMIX
- && noPanoramiXExtension
+ && noPanoramiXExtension
#endif
- )
- validateAllDefaultModes = TRUE;
+ )
+ validateAllDefaultModes = TRUE;
#endif
- for (p = scrp->modes; ; p = p->next) {
- Bool repeat;
-
- /*
- * If the supplied mode names don't produce a valid mode, scan through
- * unconsidered modePool members until one survives validation. This
- * is done in decreasing order by mode pixel area.
- */
-
- if (p == NULL) {
- if ((numModes > 0) && !validateAllDefaultModes)
- break;
-
- validateAllDefaultModes = TRUE;
- r = NULL;
- modeSize = 0;
- for (q = scrp->modePool; q != NULL; q = q->next) {
- if ((q->prev == NULL) && (q->status == MODE_OK)) {
- /*
- * Deal with the case where this mode wasn't considered
- * because of a builtin mode of the same name.
- */
- for (p = scrp->modes; p != NULL; p = p->next) {
- if ((p->status != MODE_OK) &&
- !strcmp(p->name, q->name))
- break;
- }
-
- if (p != NULL)
- q->prev = p;
- else {
- /*
- * A quick check to not allow default modes with
- * horizontal timing parameters that CRTs may have
- * problems with.
- */
- if (!scrp->monitor->reducedblanking &&
- (q->type & M_T_DEFAULT) &&
- ((double)q->HTotal / (double)q->HDisplay) < 1.15)
- continue;
-
- if (modeSize < (q->HDisplay * q->VDisplay)) {
- r = q;
- modeSize = q->HDisplay * q->VDisplay;
- }
- }
- }
- }
-
- if (r == NULL)
- break;
-
- p = xnfcalloc(1, sizeof(DisplayModeRec));
- p->prev = last;
- p->name = xnfstrdup(r->name);
- if (!userModes)
- p->type = M_T_USERDEF;
- if (p->prev)
- p->prev->next = p;
- *endp = last = p;
- endp = &p->next;
- }
-
- repeat = FALSE;
- lookupNext:
- if (repeat && ((status = p->status) != MODE_OK))
- printModeRejectMessage(scrp->scrnIndex, p, status);
- saveType = p->type;
- status = xf86LookupMode(scrp, p, clockRanges, strategy);
- if (repeat && status == MODE_NOMODE)
- continue;
- if (status != MODE_OK)
- printModeRejectMessage(scrp->scrnIndex, p, status);
- if (status == MODE_ERROR) {
- ErrorF("xf86ValidateModes: "
- "unexpected result from xf86LookupMode()\n");
- return -1;
- }
- if (status != MODE_OK) {
- if (p->status == MODE_OK)
- p->status = status;
- continue;
- }
- p->type |= saveType;
- repeat = TRUE;
-
- newLinePitch = linePitch;
- newVirtX = virtX;
- newVirtY = virtY;
-
- /*
- * Don't let non-user defined modes increase the virtual size
- */
- if (!(p->type & M_T_USERDEF) && (numModes > 0)) {
- if (p->HDisplay > virtX) {
- p->status = MODE_VIRTUAL_X;
- goto lookupNext;
- }
- if (p->VDisplay > virtY) {
- p->status = MODE_VIRTUAL_Y;
- goto lookupNext;
- }
- }
- /*
- * Adjust virtual width and height if the mode is too large for the
- * current values and if they are not fixed.
- */
- if (virtualX <= 0 && p->HDisplay > newVirtX)
- newVirtX = _VIRTUALX(p->HDisplay);
- if (virtualY <= 0 && p->VDisplay > newVirtY) {
- if (maxHeight > 0 && p->VDisplay > maxHeight) {
- p->status = MODE_VIRTUAL_Y; /* ? */
- goto lookupNext;
- }
- newVirtY = p->VDisplay;
- }
-
- /*
- * If virtual resolution is to be increased, revalidate it.
- */
- if ((virtX != newVirtX) || (virtY != newVirtY)) {
- if (linePitches != NULL) {
- newLinePitch = -1;
- for (i = 0; linePitches[i] != 0; i++) {
- if ((linePitches[i] >= newVirtX) &&
- (linePitches[i] >= linePitch) &&
- (linePitches[i] ==
- scanLineWidth(newVirtX, newVirtY, linePitches[i],
- apertureSize, BankFormat, pitchInc))) {
- newLinePitch = linePitches[i];
- break;
- }
- }
- } else {
- if (linePitch < minPitch)
- linePitch = minPitch;
- newLinePitch = scanLineWidth(newVirtX, newVirtY, linePitch,
- apertureSize, BankFormat,
- pitchInc);
- }
- if ((newLinePitch < minPitch) || (newLinePitch > maxPitch)) {
- p->status = MODE_BAD_WIDTH;
- goto lookupNext;
- }
-
- /*
- * Check that the pixel area required by the new virtual height
- * and line pitch isn't too large.
- */
- if (!xf86CheckModeSize(scrp, newLinePitch, newVirtX, newVirtY)) {
- p->status = MODE_MEM_VIRT;
- goto lookupNext;
- }
- }
-
- if (scrp->ValidMode) {
- /*
- * Give the driver a final say, passing it the proposed virtual
- * geometry.
- */
- scrp->virtualX = newVirtX;
- scrp->virtualY = newVirtY;
- scrp->displayWidth = newLinePitch;
- p->status = (scrp->ValidMode)(scrp->scrnIndex, p, FALSE,
- MODECHECK_FINAL);
-
- if (p->status != MODE_OK) {
- goto lookupNext;
- }
- }
-
- /* Mode has passed all the tests */
- virtX = newVirtX;
- virtY = newVirtY;
- linePitch = newLinePitch;
- p->status = MODE_OK;
- numModes++;
+ for (p = scrp->modes;; p = p->next) {
+ Bool repeat;
+
+ /*
+ * If the supplied mode names don't produce a valid mode, scan through
+ * unconsidered modePool members until one survives validation. This
+ * is done in decreasing order by mode pixel area.
+ */
+
+ if (p == NULL) {
+ if ((numModes > 0) && !validateAllDefaultModes)
+ break;
+
+ validateAllDefaultModes = TRUE;
+ r = NULL;
+ modeSize = 0;
+ for (q = scrp->modePool; q != NULL; q = q->next) {
+ if ((q->prev == NULL) && (q->status == MODE_OK)) {
+ /*
+ * Deal with the case where this mode wasn't considered
+ * because of a builtin mode of the same name.
+ */
+ for (p = scrp->modes; p != NULL; p = p->next) {
+ if ((p->status != MODE_OK) && !strcmp(p->name, q->name))
+ break;
+ }
+
+ if (p != NULL)
+ q->prev = p;
+ else {
+ /*
+ * A quick check to not allow default modes with
+ * horizontal timing parameters that CRTs may have
+ * problems with.
+ */
+ if (!scrp->monitor->reducedblanking &&
+ (q->type & M_T_DEFAULT) &&
+ ((double) q->HTotal / (double) q->HDisplay) < 1.15)
+ continue;
+
+ if (modeSize < (q->HDisplay * q->VDisplay)) {
+ r = q;
+ modeSize = q->HDisplay * q->VDisplay;
+ }
+ }
+ }
+ }
+
+ if (r == NULL)
+ break;
+
+ p = xnfcalloc(1, sizeof(DisplayModeRec));
+ p->prev = last;
+ p->name = xnfstrdup(r->name);
+ if (!userModes)
+ p->type = M_T_USERDEF;
+ if (p->prev)
+ p->prev->next = p;
+ *endp = last = p;
+ endp = &p->next;
+ }
+
+ repeat = FALSE;
+ lookupNext:
+ if (repeat && ((status = p->status) != MODE_OK))
+ printModeRejectMessage(scrp->scrnIndex, p, status);
+ saveType = p->type;
+ status = xf86LookupMode(scrp, p, clockRanges, strategy);
+ if (repeat && status == MODE_NOMODE)
+ continue;
+ if (status != MODE_OK)
+ printModeRejectMessage(scrp->scrnIndex, p, status);
+ if (status == MODE_ERROR) {
+ ErrorF("xf86ValidateModes: "
+ "unexpected result from xf86LookupMode()\n");
+ return -1;
+ }
+ if (status != MODE_OK) {
+ if (p->status == MODE_OK)
+ p->status = status;
+ continue;
+ }
+ p->type |= saveType;
+ repeat = TRUE;
+
+ newLinePitch = linePitch;
+ newVirtX = virtX;
+ newVirtY = virtY;
+
+ /*
+ * Don't let non-user defined modes increase the virtual size
+ */
+ if (!(p->type & M_T_USERDEF) && (numModes > 0)) {
+ if (p->HDisplay > virtX) {
+ p->status = MODE_VIRTUAL_X;
+ goto lookupNext;
+ }
+ if (p->VDisplay > virtY) {
+ p->status = MODE_VIRTUAL_Y;
+ goto lookupNext;
+ }
+ }
+ /*
+ * Adjust virtual width and height if the mode is too large for the
+ * current values and if they are not fixed.
+ */
+ if (virtualX <= 0 && p->HDisplay > newVirtX)
+ newVirtX = _VIRTUALX(p->HDisplay);
+ if (virtualY <= 0 && p->VDisplay > newVirtY) {
+ if (maxHeight > 0 && p->VDisplay > maxHeight) {
+ p->status = MODE_VIRTUAL_Y; /* ? */
+ goto lookupNext;
+ }
+ newVirtY = p->VDisplay;
+ }
+
+ /*
+ * If virtual resolution is to be increased, revalidate it.
+ */
+ if ((virtX != newVirtX) || (virtY != newVirtY)) {
+ if (linePitches != NULL) {
+ newLinePitch = -1;
+ for (i = 0; linePitches[i] != 0; i++) {
+ if ((linePitches[i] >= newVirtX) &&
+ (linePitches[i] >= linePitch) &&
+ (linePitches[i] ==
+ scanLineWidth(newVirtX, newVirtY, linePitches[i],
+ apertureSize, BankFormat, pitchInc))) {
+ newLinePitch = linePitches[i];
+ break;
+ }
+ }
+ }
+ else {
+ if (linePitch < minPitch)
+ linePitch = minPitch;
+ newLinePitch = scanLineWidth(newVirtX, newVirtY, linePitch,
+ apertureSize, BankFormat,
+ pitchInc);
+ }
+ if ((newLinePitch < minPitch) || (newLinePitch > maxPitch)) {
+ p->status = MODE_BAD_WIDTH;
+ goto lookupNext;
+ }
+
+ /*
+ * Check that the pixel area required by the new virtual height
+ * and line pitch isn't too large.
+ */
+ if (!xf86CheckModeSize(scrp, newLinePitch, newVirtX, newVirtY)) {
+ p->status = MODE_MEM_VIRT;
+ goto lookupNext;
+ }
+ }
+
+ if (scrp->ValidMode) {
+ /*
+ * Give the driver a final say, passing it the proposed virtual
+ * geometry.
+ */
+ scrp->virtualX = newVirtX;
+ scrp->virtualY = newVirtY;
+ scrp->displayWidth = newLinePitch;
+ p->status = (scrp->ValidMode) (scrp->scrnIndex, p, FALSE,
+ MODECHECK_FINAL);
+
+ if (p->status != MODE_OK) {
+ goto lookupNext;
+ }
+ }
+
+ /* Mode has passed all the tests */
+ virtX = newVirtX;
+ virtY = newVirtY;
+ linePitch = newLinePitch;
+ p->status = MODE_OK;
+ numModes++;
}
/*
@@ -1846,102 +1862,105 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
* fix up if so.
*/
if (inferred_virtual) {
- int vx = 0, vy = 0;
- for (p = scrp->modes; p; p = p->next) {
- if (p->HDisplay > vx && p->VDisplay > vy) {
- vx = p->HDisplay;
- vy = p->VDisplay;
- }
- }
- if (vx < virtX || vy < virtY) {
- const int types[] = {
- M_T_BUILTIN | M_T_PREFERRED,
- M_T_BUILTIN,
- M_T_DRIVER | M_T_PREFERRED,
- M_T_DRIVER,
- 0
- };
- const int ntypes = sizeof(types) / sizeof(int);
- int n;
-
- /*
- * We did not find the estimated virtual size. So now we want to
- * find the largest mode available, but we want to search in the
- * modes in the order of "types" listed above.
- */
- for (n = 0; n < ntypes; n++) {
- int type = types[n];
-
- vx = 0; vy = 0;
- for (p = scrp->modes; p; p = p->next) {
- /* scan through the modes in the sort order above */
- if ((p->type & type) != type)
- continue;
- if (p->HDisplay > vx && p->VDisplay > vy) {
- vx = p->HDisplay;
- vy = p->VDisplay;
- }
- }
- if (vx && vy)
- /* Found one */
- break;
- }
- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
- "Shrinking virtual size estimate from %dx%d to %dx%d\n",
- virtX, virtY, vx, vy);
- virtX = _VIRTUALX(vx);
- virtY = vy;
- for (p = scrp->modes; p; p = p->next) {
- if (numModes > 0) {
- if (p->HDisplay > virtX)
- p->status = MODE_VIRTUAL_X;
- if (p->VDisplay > virtY)
- p->status = MODE_VIRTUAL_Y;
- if (p->status != MODE_OK) {
- numModes--;
- printModeRejectMessage(scrp->scrnIndex, p, p->status);
- }
- }
- }
- if (linePitches != NULL) {
- for (i = 0; linePitches[i] != 0; i++) {
- if ((linePitches[i] >= virtX) &&
- (linePitches[i] ==
- scanLineWidth(virtX, virtY, linePitches[i],
- apertureSize, BankFormat, pitchInc))) {
- linePitch = linePitches[i];
- break;
- }
- }
- } else {
- linePitch = scanLineWidth(virtX, virtY, minPitch,
- apertureSize, BankFormat, pitchInc);
- }
- }
+ int vx = 0, vy = 0;
+
+ for (p = scrp->modes; p; p = p->next) {
+ if (p->HDisplay > vx && p->VDisplay > vy) {
+ vx = p->HDisplay;
+ vy = p->VDisplay;
+ }
+ }
+ if (vx < virtX || vy < virtY) {
+ const int types[] = {
+ M_T_BUILTIN | M_T_PREFERRED,
+ M_T_BUILTIN,
+ M_T_DRIVER | M_T_PREFERRED,
+ M_T_DRIVER,
+ 0
+ };
+ const int ntypes = sizeof(types) / sizeof(int);
+ int n;
+
+ /*
+ * We did not find the estimated virtual size. So now we want to
+ * find the largest mode available, but we want to search in the
+ * modes in the order of "types" listed above.
+ */
+ for (n = 0; n < ntypes; n++) {
+ int type = types[n];
+
+ vx = 0;
+ vy = 0;
+ for (p = scrp->modes; p; p = p->next) {
+ /* scan through the modes in the sort order above */
+ if ((p->type & type) != type)
+ continue;
+ if (p->HDisplay > vx && p->VDisplay > vy) {
+ vx = p->HDisplay;
+ vy = p->VDisplay;
+ }
+ }
+ if (vx && vy)
+ /* Found one */
+ break;
+ }
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+ "Shrinking virtual size estimate from %dx%d to %dx%d\n",
+ virtX, virtY, vx, vy);
+ virtX = _VIRTUALX(vx);
+ virtY = vy;
+ for (p = scrp->modes; p; p = p->next) {
+ if (numModes > 0) {
+ if (p->HDisplay > virtX)
+ p->status = MODE_VIRTUAL_X;
+ if (p->VDisplay > virtY)
+ p->status = MODE_VIRTUAL_Y;
+ if (p->status != MODE_OK) {
+ numModes--;
+ printModeRejectMessage(scrp->scrnIndex, p, p->status);
+ }
+ }
+ }
+ if (linePitches != NULL) {
+ for (i = 0; linePitches[i] != 0; i++) {
+ if ((linePitches[i] >= virtX) &&
+ (linePitches[i] ==
+ scanLineWidth(virtX, virtY, linePitches[i],
+ apertureSize, BankFormat, pitchInc))) {
+ linePitch = linePitches[i];
+ break;
+ }
+ }
+ }
+ else {
+ linePitch = scanLineWidth(virtX, virtY, minPitch,
+ apertureSize, BankFormat, pitchInc);
+ }
+ }
}
/* Update the ScrnInfoRec parameters */
-
+
scrp->virtualX = virtX;
scrp->virtualY = virtY;
scrp->displayWidth = linePitch;
if (numModes <= 0)
- return 0;
-
+ return 0;
+
/* Make the mode list into a circular list by joining up the ends */
p = scrp->modes;
while (p->next != NULL)
- p = p->next;
+ p = p->next;
/* p is now the last mode on the list */
p->next = scrp->modes;
scrp->modes->prev = p;
if (minHeight > 0 && virtY < minHeight) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Virtual height (%d) is too small for the hardware "
- "(min %d)\n", virtY, minHeight);
- return -1;
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual height (%d) is too small for the hardware "
+ "(min %d)\n", virtY, minHeight);
+ return -1;
}
return numModes;
@@ -1959,26 +1978,27 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
* - doubly linked circular lists
*
*/
-
+
void
-xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode)
+xf86DeleteMode(DisplayModePtr * modeList, DisplayModePtr mode)
{
/* Catch the easy/insane cases */
if (modeList == NULL || *modeList == NULL || mode == NULL)
- return;
+ return;
/* If the mode is at the start of the list, move the start of the list */
if (*modeList == mode)
- *modeList = mode->next;
+ *modeList = mode->next;
/* If mode is the only one on the list, set the list to NULL */
if ((mode == mode->prev) && (mode == mode->next)) {
- *modeList = NULL;
- } else {
- if ((mode->prev != NULL) && (mode->prev->next == mode))
- mode->prev->next = mode->next;
- if ((mode->next != NULL) && (mode->next->prev == mode))
- mode->next->prev = mode->prev;
+ *modeList = NULL;
+ }
+ else {
+ if ((mode->prev != NULL) && (mode->prev->next == mode))
+ mode->prev->next = mode->next;
+ if ((mode->next != NULL) && (mode->next->prev == mode))
+ mode->next->prev = mode->prev;
}
free(mode->name);
@@ -1999,32 +2019,31 @@ xf86PruneDriverModes(ScrnInfoPtr scrp)
p = scrp->modes;
if (p == NULL)
- return;
+ return;
do {
- if (!(first = scrp->modes))
- return;
- n = p->next;
- if (p->status != MODE_OK) {
- xf86DeleteMode(&(scrp->modes), p);
- }
- p = n;
+ if (!(first = scrp->modes))
+ return;
+ n = p->next;
+ if (p->status != MODE_OK) {
+ xf86DeleteMode(&(scrp->modes), p);
+ }
+ p = n;
} while (p != NULL && p != first);
/* modePool is no longer needed, turf it */
while (scrp->modePool) {
- /*
- * A modePool mode's prev field is used to hold a pointer to the
- * member of the scrp->modes list for which a match was considered.
- * Clear that pointer first, otherwise xf86DeleteMode might get
- * confused
- */
- scrp->modePool->prev = NULL;
- xf86DeleteMode(&scrp->modePool, scrp->modePool);
+ /*
+ * A modePool mode's prev field is used to hold a pointer to the
+ * member of the scrp->modes list for which a match was considered.
+ * Clear that pointer first, otherwise xf86DeleteMode might get
+ * confused
+ */
+ scrp->modePool->prev = NULL;
+ xf86DeleteMode(&scrp->modePool, scrp->modePool);
}
}
-
/*
* xf86SetCrtcForModes
*
@@ -2045,18 +2064,18 @@ xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags)
p = scrp->modes;
if (p == NULL)
- return;
+ return;
do {
- xf86SetModeCrtc(p, adjustFlags);
- DebugF("%sMode %s: %d (%d) %d %d (%d) %d %d (%d) %d %d (%d) %d\n",
- (p->type & M_T_DEFAULT) ? "Default " : "",
- p->name, p->CrtcHDisplay, p->CrtcHBlankStart,
- p->CrtcHSyncStart, p->CrtcHSyncEnd, p->CrtcHBlankEnd,
- p->CrtcHTotal, p->CrtcVDisplay, p->CrtcVBlankStart,
- p->CrtcVSyncStart, p->CrtcVSyncEnd, p->CrtcVBlankEnd,
- p->CrtcVTotal);
- p = p->next;
+ xf86SetModeCrtc(p, adjustFlags);
+ DebugF("%sMode %s: %d (%d) %d %d (%d) %d %d (%d) %d %d (%d) %d\n",
+ (p->type & M_T_DEFAULT) ? "Default " : "",
+ p->name, p->CrtcHDisplay, p->CrtcHBlankStart,
+ p->CrtcHSyncStart, p->CrtcHSyncEnd, p->CrtcHBlankEnd,
+ p->CrtcHTotal, p->CrtcVDisplay, p->CrtcVBlankStart,
+ p->CrtcVSyncStart, p->CrtcVSyncEnd, p->CrtcVBlankEnd,
+ p->CrtcVTotal);
+ p = p->next;
} while (p != NULL && p != scrp->modes);
}
@@ -2068,63 +2087,65 @@ xf86PrintModes(ScrnInfoPtr scrp)
const char *desc, *desc2, *prefix, *uprefix;
if (scrp == NULL)
- return;
+ return;
xf86DrvMsg(scrp->scrnIndex, scrp->virtualFrom, "Virtual size is %dx%d "
- "(pitch %d)\n", scrp->virtualX, scrp->virtualY,
- scrp->displayWidth);
-
+ "(pitch %d)\n", scrp->virtualX, scrp->virtualY,
+ scrp->displayWidth);
+
p = scrp->modes;
if (p == NULL)
- return;
+ return;
do {
- desc = desc2 = "";
- hsync = xf86ModeHSync(p);
- refresh = xf86ModeVRefresh(p);
- if (p->Flags & V_INTERLACE) {
- desc = " (I)";
- }
- if (p->Flags & V_DBLSCAN) {
- desc = " (D)";
- }
- if (p->VScan > 1) {
- desc2 = " (VScan)";
- }
- if (p->type & M_T_BUILTIN)
- prefix = "Built-in mode";
- else if (p->type & M_T_DEFAULT)
- prefix = "Default mode";
- else if (p->type & M_T_DRIVER)
- prefix = "Driver mode";
- else
- prefix = "Mode";
- if (p->type & M_T_USERDEF)
- uprefix = "*";
- else
- uprefix = " ";
- if (hsync == 0 || refresh == 0) {
- if (p->name)
- xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
- "%s%s \"%s\"\n", uprefix, prefix, p->name);
- else
- xf86DrvMsg(scrp->scrnIndex, X_PROBED,
- "%s%s %dx%d (unnamed)\n",
- uprefix, prefix, p->HDisplay, p->VDisplay);
- } else if (p->Clock == p->SynthClock) {
- xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
- "%s%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n",
- uprefix, prefix, p->name, p->Clock / 1000.0,
- hsync, refresh, desc, desc2);
- } else {
- xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
- "%s%s \"%s\": %.1f MHz (scaled from %.1f MHz), "
- "%.1f kHz, %.1f Hz%s%s\n",
- uprefix, prefix, p->name, p->Clock / 1000.0,
- p->SynthClock / 1000.0, hsync, refresh, desc, desc2);
- }
- if (hsync != 0 && refresh != 0)
- xf86PrintModeline(scrp->scrnIndex,p);
- p = p->next;
+ desc = desc2 = "";
+ hsync = xf86ModeHSync(p);
+ refresh = xf86ModeVRefresh(p);
+ if (p->Flags & V_INTERLACE) {
+ desc = " (I)";
+ }
+ if (p->Flags & V_DBLSCAN) {
+ desc = " (D)";
+ }
+ if (p->VScan > 1) {
+ desc2 = " (VScan)";
+ }
+ if (p->type & M_T_BUILTIN)
+ prefix = "Built-in mode";
+ else if (p->type & M_T_DEFAULT)
+ prefix = "Default mode";
+ else if (p->type & M_T_DRIVER)
+ prefix = "Driver mode";
+ else
+ prefix = "Mode";
+ if (p->type & M_T_USERDEF)
+ uprefix = "*";
+ else
+ uprefix = " ";
+ if (hsync == 0 || refresh == 0) {
+ if (p->name)
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
+ "%s%s \"%s\"\n", uprefix, prefix, p->name);
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_PROBED,
+ "%s%s %dx%d (unnamed)\n",
+ uprefix, prefix, p->HDisplay, p->VDisplay);
+ }
+ else if (p->Clock == p->SynthClock) {
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
+ "%s%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n",
+ uprefix, prefix, p->name, p->Clock / 1000.0,
+ hsync, refresh, desc, desc2);
+ }
+ else {
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
+ "%s%s \"%s\": %.1f MHz (scaled from %.1f MHz), "
+ "%.1f kHz, %.1f Hz%s%s\n",
+ uprefix, prefix, p->name, p->Clock / 1000.0,
+ p->SynthClock / 1000.0, hsync, refresh, desc, desc2);
+ }
+ if (hsync != 0 && refresh != 0)
+ xf86PrintModeline(scrp->scrnIndex, p);
+ p = p->next;
} while (p != NULL && p != scrp->modes);
}
diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h
index 1de87dbbe..894b93f59 100644
--- a/xorg-server/hw/xfree86/common/xf86Module.h
+++ b/xorg-server/hw/xfree86/common/xf86Module.h
@@ -47,10 +47,10 @@
#endif
typedef enum {
- LD_RESOLV_IFDONE = 0, /* only check if no more
- delays pending */
- LD_RESOLV_NOW = 1, /* finish one delay step */
- LD_RESOLV_FORCE = 2 /* force checking... */
+ LD_RESOLV_IFDONE = 0, /* only check if no more
+ delays pending */
+ LD_RESOLV_NOW = 1, /* finish one delay step */
+ LD_RESOLV_FORCE = 2 /* force checking... */
} LoaderResolveOptions;
#define DEFAULT_LIST ((char *)-1)
@@ -97,21 +97,21 @@ typedef enum {
/* Error return codes for errmaj. New codes must only be added at the end. */
typedef enum {
LDR_NOERROR = 0,
- LDR_NOMEM, /* memory allocation failed */
- LDR_NOENT, /* Module file does not exist */
- LDR_NOSUBENT, /* pre-requsite file to be sub-loaded does not exist */
- LDR_NOSPACE, /* internal module array full */
- LDR_NOMODOPEN, /* module file could not be opened (check errmin) */
- LDR_UNKTYPE, /* file is not a recognized module type */
- LDR_NOLOAD, /* type specific loader failed */
- LDR_ONCEONLY, /* Module should only be loaded once (not an error) */
- LDR_NOPORTOPEN, /* could not open port (check errmin) */
- LDR_NOHARDWARE, /* could not query/initialize the hardware device */
- LDR_MISMATCH, /* the module didn't match the spec'd requirments */
- LDR_BADUSAGE, /* LoadModule is called with bad arguments */
- LDR_INVALID, /* The module doesn't have a valid ModuleData object */
- LDR_BADOS, /* The module doesn't support the OS */
- LDR_MODSPECIFIC /* A module-specific error in the SetupProc */
+ LDR_NOMEM, /* memory allocation failed */
+ LDR_NOENT, /* Module file does not exist */
+ LDR_NOSUBENT, /* pre-requsite file to be sub-loaded does not exist */
+ LDR_NOSPACE, /* internal module array full */
+ LDR_NOMODOPEN, /* module file could not be opened (check errmin) */
+ LDR_UNKTYPE, /* file is not a recognized module type */
+ LDR_NOLOAD, /* type specific loader failed */
+ LDR_ONCEONLY, /* Module should only be loaded once (not an error) */
+ LDR_NOPORTOPEN, /* could not open port (check errmin) */
+ LDR_NOHARDWARE, /* could not query/initialize the hardware device */
+ LDR_MISMATCH, /* the module didn't match the spec'd requirments */
+ LDR_BADUSAGE, /* LoadModule is called with bad arguments */
+ LDR_INVALID, /* The module doesn't have a valid ModuleData object */
+ LDR_BADOS, /* The module doesn't support the OS */
+ LDR_MODSPECIFIC /* A module-specific error in the SetupProc */
} LoaderErrorCode;
/*
@@ -129,19 +129,19 @@ typedef enum {
/* This structure is expected to be returned by the initfunc */
typedef struct {
- const char * modname; /* name of module, e.g. "foo" */
- const char * vendor; /* vendor specific string */
- CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */
- CARD32 _modinfo2_; /* infoarea with a binary editor or sign tool */
- CARD32 xf86version; /* contains XF86_VERSION_CURRENT */
- CARD8 majorversion; /* module-specific major version */
- CARD8 minorversion; /* module-specific minor version */
- CARD16 patchlevel; /* module-specific patch level */
- const char * abiclass; /* ABI class that the module uses */
- CARD32 abiversion; /* ABI version */
- const char * moduleclass; /* module class description */
- CARD32 checksum[4]; /* contains a digital signature of the */
- /* version info structure */
+ const char *modname; /* name of module, e.g. "foo" */
+ const char *vendor; /* vendor specific string */
+ CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */
+ CARD32 _modinfo2_; /* infoarea with a binary editor or sign tool */
+ CARD32 xf86version; /* contains XF86_VERSION_CURRENT */
+ CARD8 majorversion; /* module-specific major version */
+ CARD8 minorversion; /* module-specific minor version */
+ CARD16 patchlevel; /* module-specific patch level */
+ const char *abiclass; /* ABI class that the module uses */
+ CARD32 abiversion; /* ABI version */
+ const char *moduleclass; /* module class description */
+ CARD32 checksum[4]; /* contains a digital signature of the */
+ /* version info structure */
} XF86ModuleVersionInfo;
/*
@@ -149,12 +149,12 @@ typedef struct {
* specify version and/or ABI requirements.
*/
typedef struct {
- CARD8 majorversion; /* module-specific major version */
- CARD8 minorversion; /* moudle-specific minor version */
- CARD16 patchlevel; /* module-specific patch level */
- const char * abiclass; /* ABI class that the module uses */
- CARD32 abiversion; /* ABI version */
- const char * moduleclass; /* module class */
+ CARD8 majorversion; /* module-specific major version */
+ CARD8 minorversion; /* moudle-specific minor version */
+ CARD16 patchlevel; /* module-specific patch level */
+ const char *abiclass; /* ABI class that the module uses */
+ CARD32 abiversion; /* ABI version */
+ const char *moduleclass; /* module class */
} XF86ModReqInfo;
/* values to indicate unspecified fields in XF86ModReqInfo. */
@@ -171,42 +171,44 @@ typedef struct {
#define INITARGS void
-typedef void (*InitExtension)(INITARGS);
+typedef void (*InitExtension) (INITARGS);
typedef struct {
- InitExtension initFunc;
- const char * name;
- Bool *disablePtr;
- InitExtension setupFunc;
- const char ** initDependencies;
+ InitExtension initFunc;
+ const char *name;
+ Bool *disablePtr;
+ InitExtension setupFunc;
+ const char **initDependencies;
} ExtensionModule;
extern _X_EXPORT ExtensionModule *ExtensionModuleList;
/* Prototypes for Loader functions that are exported to modules */
extern _X_EXPORT pointer LoadSubModule(pointer, const char *, const char **,
- const char **, pointer, const XF86ModReqInfo *,
- int *, int *);
+ const char **, pointer,
+ const XF86ModReqInfo *, int *, int *);
extern _X_EXPORT void UnloadSubModule(pointer);
-extern _X_EXPORT void UnloadModule (pointer);
+extern _X_EXPORT void UnloadModule(pointer);
extern _X_EXPORT pointer LoaderSymbol(const char *);
extern _X_EXPORT char **LoaderListDirs(const char **, const char **);
extern _X_EXPORT void LoaderFreeDirList(char **);
extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
extern _X_EXPORT void LoadExtension(ExtensionModule *, Bool);
-extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor, int *teeny);
+extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor,
+ int *teeny);
extern _X_EXPORT Bool LoaderShouldIgnoreABI(void);
extern _X_EXPORT int LoaderGetABIVersion(const char *abiclass);
-typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *);
-typedef void (*ModuleTearDownProc)(pointer);
+typedef pointer (*ModuleSetupProc) (pointer, pointer, int *, int *);
+typedef void (*ModuleTearDownProc) (pointer);
+
#define MODULESETUPPROTO(func) pointer func(pointer, pointer, int*, int*)
#define MODULETEARDOWNPROTO(func) void func(pointer)
typedef struct {
- XF86ModuleVersionInfo * vers;
- ModuleSetupProc setup;
- ModuleTearDownProc teardown;
+ XF86ModuleVersionInfo *vers;
+ ModuleSetupProc setup;
+ ModuleTearDownProc teardown;
} XF86ModuleData;
-#endif /* _XF86STR_H */
+#endif /* _XF86STR_H */
diff --git a/xorg-server/hw/xfree86/common/xf86Opt.h b/xorg-server/hw/xfree86/common/xf86Opt.h
index b0fdaa6b6..0d808de14 100644
--- a/xorg-server/hw/xfree86/common/xf86Opt.h
+++ b/xorg-server/hw/xfree86/common/xf86Opt.h
@@ -38,13 +38,13 @@ typedef struct {
} OptFrequency;
typedef union {
- unsigned long num;
- char * str;
- double realnum;
- Bool bool;
- OptFrequency freq;
+ unsigned long num;
+ char *str;
+ double realnum;
+ Bool bool;
+ OptFrequency freq;
} ValueUnion;
-
+
typedef enum {
OPTV_NONE = 0,
OPTV_INTEGER,
@@ -63,57 +63,96 @@ typedef enum {
} OptFreqUnits;
typedef struct {
- int token;
- const char* name;
- OptionValueType type;
- ValueUnion value;
- Bool found;
+ int token;
+ const char *name;
+ OptionValueType type;
+ ValueUnion value;
+ Bool found;
} OptionInfoRec, *OptionInfoPtr;
-extern _X_EXPORT int xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt);
-extern _X_EXPORT double xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt);
-extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt);
-extern _X_EXPORT int xf86SetBoolOption(XF86OptionPtr list, const char *name, int deflt );
-extern _X_EXPORT double xf86SetPercentOption(XF86OptionPtr list, const char *name, double deflt );
-extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt);
-extern _X_EXPORT double xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt);
-extern _X_EXPORT char *xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
-extern _X_EXPORT int xf86CheckBoolOption(XF86OptionPtr list, const char *name, int deflt );
-extern _X_EXPORT double xf86CheckPercentOption(XF86OptionPtr list, const char *name, double deflt );
-extern _X_EXPORT XF86OptionPtr xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val );
-extern _X_EXPORT XF86OptionPtr xf86NewOption(char *name, char *value );
-extern _X_EXPORT XF86OptionPtr xf86NextOption(XF86OptionPtr list );
-extern _X_EXPORT XF86OptionPtr xf86OptionListCreate(const char **options, int count, int used);
-extern _X_EXPORT XF86OptionPtr xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
+extern _X_EXPORT int xf86SetIntOption(XF86OptionPtr optlist, const char *name,
+ int deflt);
+extern _X_EXPORT double xf86SetRealOption(XF86OptionPtr optlist,
+ const char *name, double deflt);
+extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name,
+ const char *deflt);
+extern _X_EXPORT int xf86SetBoolOption(XF86OptionPtr list, const char *name,
+ int deflt);
+extern _X_EXPORT double xf86SetPercentOption(XF86OptionPtr list,
+ const char *name, double deflt);
+extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name,
+ int deflt);
+extern _X_EXPORT double xf86CheckRealOption(XF86OptionPtr optlist,
+ const char *name, double deflt);
+extern _X_EXPORT char *xf86CheckStrOption(XF86OptionPtr optlist,
+ const char *name, char *deflt);
+extern _X_EXPORT int xf86CheckBoolOption(XF86OptionPtr list, const char *name,
+ int deflt);
+extern _X_EXPORT double xf86CheckPercentOption(XF86OptionPtr list,
+ const char *name, double deflt);
+extern _X_EXPORT XF86OptionPtr xf86AddNewOption(XF86OptionPtr head,
+ const char *name,
+ const char *val);
+extern _X_EXPORT XF86OptionPtr xf86NewOption(char *name, char *value);
+extern _X_EXPORT XF86OptionPtr xf86NextOption(XF86OptionPtr list);
+extern _X_EXPORT XF86OptionPtr xf86OptionListCreate(const char **options,
+ int count, int used);
+extern _X_EXPORT XF86OptionPtr xf86OptionListMerge(XF86OptionPtr head,
+ XF86OptionPtr tail);
extern _X_EXPORT XF86OptionPtr xf86OptionListDuplicate(XF86OptionPtr list);
extern _X_EXPORT void xf86OptionListFree(XF86OptionPtr opt);
extern _X_EXPORT char *xf86OptionName(XF86OptionPtr opt);
extern _X_EXPORT char *xf86OptionValue(XF86OptionPtr opt);
extern _X_EXPORT void xf86OptionListReport(XF86OptionPtr parm);
-extern _X_EXPORT XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name);
-extern _X_EXPORT const char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
+extern _X_EXPORT XF86OptionPtr xf86FindOption(XF86OptionPtr options,
+ const char *name);
+extern _X_EXPORT const char *xf86FindOptionValue(XF86OptionPtr options,
+ const char *name);
extern _X_EXPORT void xf86MarkOptionUsed(XF86OptionPtr option);
-extern _X_EXPORT void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name);
+extern _X_EXPORT void xf86MarkOptionUsedByName(XF86OptionPtr options,
+ const char *name);
extern _X_EXPORT Bool xf86CheckIfOptionUsed(XF86OptionPtr option);
-extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name);
-extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr options);
-extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo);
-extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
-extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec *table, int token);
-extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec *table, int token);
-extern _X_EXPORT char *xf86GetOptValString(const OptionInfoRec *table, int token);
-extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value);
-extern _X_EXPORT Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value);
-extern _X_EXPORT Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value);
-extern _X_EXPORT Bool xf86GetOptValFreq(const OptionInfoRec *table, int token,
- OptFreqUnits expectedUnits, double *value);
-extern _X_EXPORT Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value);
-extern _X_EXPORT Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
+extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(XF86OptionPtr options,
+ const char *name);
+extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex,
+ XF86OptionPtr options);
+extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options,
+ OptionInfoPtr optinfo);
+extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec * table,
+ int token);
+extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec * table,
+ int token);
+extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec * table, int token);
+extern _X_EXPORT char *xf86GetOptValString(const OptionInfoRec * table,
+ int token);
+extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec * table,
+ int token, int *value);
+extern _X_EXPORT Bool xf86GetOptValULong(const OptionInfoRec * table, int token,
+ unsigned long *value);
+extern _X_EXPORT Bool xf86GetOptValReal(const OptionInfoRec * table, int token,
+ double *value);
+extern _X_EXPORT Bool xf86GetOptValFreq(const OptionInfoRec * table, int token,
+ OptFreqUnits expectedUnits,
+ double *value);
+extern _X_EXPORT Bool xf86GetOptValBool(const OptionInfoRec * table, int token,
+ Bool *value);
+extern _X_EXPORT Bool xf86ReturnOptValBool(const OptionInfoRec * table,
+ int token, Bool def);
extern _X_EXPORT int xf86NameCmp(const char *s1, const char *s2);
extern _X_EXPORT char *xf86NormalizeName(const char *s);
-extern _X_EXPORT XF86OptionPtr xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val);
-extern _X_EXPORT XF86OptionPtr xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val);
-extern _X_EXPORT XF86OptionPtr xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val);
-extern _X_EXPORT XF86OptionPtr xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val);
-extern _X_EXPORT XF86OptionPtr xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char* val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceIntOption(XF86OptionPtr optlist,
+ const char *name,
+ const int val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceRealOption(XF86OptionPtr optlist,
+ const char *name,
+ const double val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceBoolOption(XF86OptionPtr optlist,
+ const char *name,
+ const Bool val);
+extern _X_EXPORT XF86OptionPtr xf86ReplacePercentOption(XF86OptionPtr optlist,
+ const char *name,
+ const double val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceStrOption(XF86OptionPtr optlist,
+ const char *name,
+ const char *val);
#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c
index dc0a01899..7cc744029 100644
--- a/xorg-server/hw/xfree86/common/xf86Option.c
+++ b/xorg-server/hw/xfree86/common/xf86Option.c
@@ -46,8 +46,8 @@
#include "xf86Parser.h"
#include "optionstr.h"
-static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
- Bool markUsed);
+static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options,
+ OptionInfoPtr p, Bool markUsed);
/*
* xf86CollectOptions collects the options from each of the config file
@@ -71,51 +71,51 @@ void
xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts)
{
XF86OptionPtr tmp;
- XF86OptionPtr extras = (XF86OptionPtr)extraOpts;
+ XF86OptionPtr extras = (XF86OptionPtr) extraOpts;
GDevPtr device;
-
+
int i;
pScrn->options = NULL;
- for (i=pScrn->numEntities - 1; i >= 0; i--) {
- device = xf86GetDevFromEntity(pScrn->entityList[i],
- pScrn->entityInstanceList[i]);
- if (device && device->options) {
- tmp = xf86optionListDup(device->options);
- if (pScrn->options)
- xf86optionListMerge(pScrn->options,tmp);
- else
- pScrn->options = tmp;
- }
+ for (i = pScrn->numEntities - 1; i >= 0; i--) {
+ device = xf86GetDevFromEntity(pScrn->entityList[i],
+ pScrn->entityInstanceList[i]);
+ if (device && device->options) {
+ tmp = xf86optionListDup(device->options);
+ if (pScrn->options)
+ xf86optionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
+ }
}
if (pScrn->monitor->options) {
- tmp = xf86optionListDup(pScrn->monitor->options);
- if (pScrn->options)
- pScrn->options = xf86optionListMerge(pScrn->options, tmp);
- else
- pScrn->options = tmp;
+ tmp = xf86optionListDup(pScrn->monitor->options);
+ if (pScrn->options)
+ pScrn->options = xf86optionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
}
if (pScrn->confScreen->options) {
- tmp = xf86optionListDup(pScrn->confScreen->options);
- if (pScrn->options)
- pScrn->options = xf86optionListMerge(pScrn->options, tmp);
- else
- pScrn->options = tmp;
+ tmp = xf86optionListDup(pScrn->confScreen->options);
+ if (pScrn->options)
+ pScrn->options = xf86optionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
}
if (pScrn->display->options) {
- tmp = xf86optionListDup(pScrn->display->options);
- if (pScrn->options)
- pScrn->options = xf86optionListMerge(pScrn->options, tmp);
- else
- pScrn->options = tmp;
+ tmp = xf86optionListDup(pScrn->display->options);
+ if (pScrn->options)
+ pScrn->options = xf86optionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
}
if (extras) {
- tmp = xf86optionListDup(extras);
- if (pScrn->options)
- pScrn->options = xf86optionListMerge(pScrn->options, tmp);
- else
- pScrn->options = tmp;
+ tmp = xf86optionListDup(extras);
+ if (pScrn->options)
+ pScrn->options = xf86optionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
}
}
@@ -130,11 +130,12 @@ void
xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts)
{
if (defaultOpts) {
- XF86OptionPtr tmp =xf86optionListCreate(defaultOpts, -1, 0);
- if (pInfo->options)
- pInfo->options = xf86optionListMerge(tmp, pInfo->options);
- else
- pInfo->options = tmp;
+ XF86OptionPtr tmp = xf86optionListCreate(defaultOpts, -1, 0);
+
+ if (pInfo->options)
+ pInfo->options = xf86optionListMerge(tmp, pInfo->options);
+ else
+ pInfo->options = tmp;
}
}
@@ -147,47 +148,46 @@ xf86OptionListDuplicate(XF86OptionPtr options)
{
XF86OptionPtr o = NULL;
- while (options)
- {
- o = xf86AddNewOption(o, xf86OptionName(options), xf86OptionValue(options));
+ while (options) {
+ o = xf86AddNewOption(o, xf86OptionName(options),
+ xf86OptionValue(options));
options = xf86nextOption(options);
}
return o;
}
-
/* Created for new XInput stuff -- essentially extensions to the parser */
static int
-LookupIntOption(XF86OptionPtr optlist, const char *name, int deflt, Bool markUsed)
+LookupIntOption(XF86OptionPtr optlist, const char *name, int deflt,
+ Bool markUsed)
{
OptionInfoRec o;
o.name = name;
o.type = OPTV_INTEGER;
if (ParseOptionValue(-1, optlist, &o, markUsed))
- deflt = o.value.num;
+ deflt = o.value.num;
return deflt;
}
-
static double
LookupRealOption(XF86OptionPtr optlist, const char *name, double deflt,
- Bool markUsed)
+ Bool markUsed)
{
OptionInfoRec o;
o.name = name;
o.type = OPTV_REAL;
if (ParseOptionValue(-1, optlist, &o, markUsed))
- deflt = o.value.realnum;
+ deflt = o.value.realnum;
return deflt;
}
-
static char *
-LookupStrOption(XF86OptionPtr optlist, const char *name, const char *deflt, Bool markUsed)
+LookupStrOption(XF86OptionPtr optlist, const char *name, const char *deflt,
+ Bool markUsed)
{
OptionInfoRec o;
@@ -196,33 +196,34 @@ LookupStrOption(XF86OptionPtr optlist, const char *name, const char *deflt, Bool
if (ParseOptionValue(-1, optlist, &o, markUsed))
deflt = o.value.str;
if (deflt)
- return strdup(deflt);
+ return strdup(deflt);
else
- return NULL;
+ return NULL;
}
-
static int
-LookupBoolOption(XF86OptionPtr optlist, const char *name, int deflt, Bool markUsed)
+LookupBoolOption(XF86OptionPtr optlist, const char *name, int deflt,
+ Bool markUsed)
{
OptionInfoRec o;
o.name = name;
o.type = OPTV_BOOLEAN;
if (ParseOptionValue(-1, optlist, &o, markUsed))
- deflt = o.value.bool;
+ deflt = o.value.bool;
return deflt;
}
static double
-LookupPercentOption(XF86OptionPtr optlist, const char *name, double deflt, Bool markUsed)
+LookupPercentOption(XF86OptionPtr optlist, const char *name, double deflt,
+ Bool markUsed)
{
OptionInfoRec o;
o.name = name;
o.type = OPTV_PERCENT;
if (ParseOptionValue(-1, optlist, &o, markUsed))
- deflt = o.value.realnum;
+ deflt = o.value.realnum;
return deflt;
}
@@ -234,21 +235,18 @@ xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt)
return LookupIntOption(optlist, name, deflt, TRUE);
}
-
double
xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupRealOption(optlist, name, deflt, TRUE);
}
-
char *
xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt)
{
return LookupStrOption(optlist, name, deflt, TRUE);
}
-
int
xf86SetBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
{
@@ -271,33 +269,30 @@ xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt)
return LookupIntOption(optlist, name, deflt, FALSE);
}
-
double
xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupRealOption(optlist, name, deflt, FALSE);
}
-
char *
xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
{
return LookupStrOption(optlist, name, deflt, FALSE);
}
-
int
xf86CheckBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupBoolOption(optlist, name, deflt, FALSE);
}
-
double
xf86CheckPercentOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupPercentOption(optlist, name, deflt, FALSE);
}
+
/*
* xf86AddNewOption() has the required property of replacing the option value
* if the option is already present.
@@ -306,36 +301,40 @@ XF86OptionPtr
xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val)
{
char tmp[16];
- snprintf(tmp,sizeof(tmp),"%i",val);
- return xf86AddNewOption(optlist,name,tmp);
+
+ snprintf(tmp, sizeof(tmp), "%i", val);
+ return xf86AddNewOption(optlist, name, tmp);
}
XF86OptionPtr
xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val)
{
char tmp[32];
- snprintf(tmp,sizeof(tmp),"%f",val);
- return xf86AddNewOption(optlist,name,tmp);
+
+ snprintf(tmp, sizeof(tmp), "%f", val);
+ return xf86AddNewOption(optlist, name, tmp);
}
XF86OptionPtr
xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val)
{
- return xf86AddNewOption(optlist,name,val?"True":"False");
+ return xf86AddNewOption(optlist, name, val ? "True" : "False");
}
XF86OptionPtr
-xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val)
+xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name,
+ const double val)
{
char tmp[16];
+
snprintf(tmp, sizeof(tmp), "%lf%%", val);
- return xf86AddNewOption(optlist,name,tmp);
+ return xf86AddNewOption(optlist, name, tmp);
}
XF86OptionPtr
-xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char* val)
+xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char *val)
{
- return xf86AddNewOption(optlist,name,val);
+ return xf86AddNewOption(optlist, name, val);
}
XF86OptionPtr
@@ -348,14 +347,12 @@ xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val)
return xf86addNewOption(head, tmp_name, tmp);
}
-
XF86OptionPtr
xf86NewOption(char *name, char *value)
{
return xf86newOption(name, value);
}
-
XF86OptionPtr
xf86NextOption(XF86OptionPtr list)
{
@@ -365,31 +362,31 @@ xf86NextOption(XF86OptionPtr list)
XF86OptionPtr
xf86OptionListCreate(const char **options, int count, int used)
{
- return xf86optionListCreate(options, count, used);
+ return xf86optionListCreate(options, count, used);
}
XF86OptionPtr
xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail)
{
- return xf86optionListMerge(head, tail);
+ return xf86optionListMerge(head, tail);
}
void
xf86OptionListFree(XF86OptionPtr opt)
{
- xf86optionListFree(opt);
+ xf86optionListFree(opt);
}
char *
xf86OptionName(XF86OptionPtr opt)
{
- return xf86optionName(opt);
+ return xf86optionName(opt);
}
char *
xf86OptionValue(XF86OptionPtr opt)
{
- return xf86optionValue(opt);
+ return xf86optionValue(opt);
}
void
@@ -397,13 +394,13 @@ xf86OptionListReport(XF86OptionPtr parm)
{
XF86OptionPtr opts = parm;
- while(opts) {
- if (xf86optionValue(opts))
- xf86ErrorFVerb(5, "\tOption \"%s\" \"%s\"\n",
- xf86optionName(opts), xf86optionValue(opts));
- else
- xf86ErrorFVerb( 5, "\tOption \"%s\"\n", xf86optionName(opts));
- opts = xf86nextOption(opts);
+ while (opts) {
+ if (xf86optionValue(opts))
+ xf86ErrorFVerb(5, "\tOption \"%s\" \"%s\"\n",
+ xf86optionName(opts), xf86optionValue(opts));
+ else
+ xf86ErrorFVerb(5, "\tOption \"%s\"\n", xf86optionName(opts));
+ opts = xf86nextOption(opts);
}
}
@@ -415,22 +412,19 @@ xf86FindOption(XF86OptionPtr options, const char *name)
return xf86findOption(options, name);
}
-
const char *
xf86FindOptionValue(XF86OptionPtr options, const char *name)
{
return xf86findOptionValue(options, name);
}
-
void
xf86MarkOptionUsed(XF86OptionPtr option)
{
if (option != NULL)
- option->opt_used = TRUE;
+ option->opt_used = TRUE;
}
-
void
xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name)
{
@@ -438,16 +432,16 @@ xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name)
opt = xf86findOption(options, name);
if (opt != NULL)
- opt->opt_used = TRUE;
+ opt->opt_used = TRUE;
}
Bool
xf86CheckIfOptionUsed(XF86OptionPtr option)
{
if (option != NULL)
- return option->opt_used;
+ return option->opt_used;
else
- return FALSE;
+ return FALSE;
}
Bool
@@ -457,24 +451,23 @@ xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name)
opt = xf86findOption(options, name);
if (opt != NULL)
- return opt->opt_used;
+ return opt->opt_used;
else
- return FALSE;
+ return FALSE;
}
void
xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr opt)
{
while (opt) {
- if (opt->opt_name && !opt->opt_used) {
- xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n",
- opt->opt_name);
- }
- opt = opt->list.next;
+ if (opt->opt_name && !opt->opt_used) {
+ xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n",
+ opt->opt_name);
+ }
+ opt = opt->list.next;
}
}
-
static Bool
GetBoolValue(OptionInfoPtr p, const char *s)
{
@@ -483,257 +476,269 @@ GetBoolValue(OptionInfoPtr p, const char *s)
static Bool
ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
- Bool markUsed)
+ Bool markUsed)
{
char *s, *end;
Bool wasUsed = FALSE;
if ((s = xf86findOptionValue(options, p->name)) != NULL) {
- if (markUsed) {
- wasUsed = xf86CheckIfOptionUsedByName(options, p->name);
- xf86MarkOptionUsedByName(options, p->name);
- }
- switch (p->type) {
- case OPTV_INTEGER:
- if (*s == '\0') {
- if (markUsed) {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires an integer value\n",
- p->name);
- }
- p->found = FALSE;
- } else {
- p->value.num = strtoul(s, &end, 0);
- if (*end == '\0') {
- p->found = TRUE;
- } else {
- if (markUsed) {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires an integer value\n",
- p->name);
- }
- p->found = FALSE;
- }
- }
- break;
- case OPTV_STRING:
- if (*s == '\0') {
- if (markUsed) {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires an string value\n",
- p->name);
- }
- p->found = FALSE;
- } else {
- p->value.str = s;
- p->found = TRUE;
- }
- break;
- case OPTV_ANYSTR:
- p->value.str = s;
- p->found = TRUE;
- break;
- case OPTV_REAL:
- if (*s == '\0') {
- if (markUsed) {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires a floating point "
- "value\n", p->name);
- }
- p->found = FALSE;
- } else {
- p->value.realnum = strtod(s, &end);
- if (*end == '\0') {
- p->found = TRUE;
- } else {
- if (markUsed) {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires a floating point "
- "value\n", p->name);
- }
- p->found = FALSE;
- }
- }
- break;
- case OPTV_BOOLEAN:
- if (GetBoolValue(p, s)) {
- p->found = TRUE;
- } else {
- if (markUsed) {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires a boolean value\n",
- p->name);
- }
- p->found = FALSE;
- }
- break;
- case OPTV_PERCENT:
- {
- char tmp = 0;
- /* awkward match, but %% doesn't increase the match counter,
- * hence 100 looks the same as 100% to the caller of sccanf
- */
- if (sscanf(s, "%lf%c", &p->value.realnum, &tmp) != 2 || tmp != '%') {
- if (markUsed) {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires a percent value\n", p->name);
- }
- p->found = FALSE;
- } else {
- p->found = TRUE;
- }
- }
- break;
- case OPTV_FREQ:
- if (*s == '\0') {
- if (markUsed) {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires a frequency value\n",
- p->name);
- }
- p->found = FALSE;
- } else {
- double freq = strtod(s, &end);
- int units = 0;
-
- if (end != s) {
- p->found = TRUE;
- if (!xf86NameCmp(end, "Hz"))
- units = 1;
- else if (!xf86NameCmp(end, "kHz") ||
- !xf86NameCmp(end, "k"))
- units = 1000;
- else if (!xf86NameCmp(end, "MHz") ||
- !xf86NameCmp(end, "M"))
- units = 1000000;
- else {
- if (markUsed) {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires a frequency value\n",
- p->name);
- }
- p->found = FALSE;
- }
- if (p->found)
- freq *= (double)units;
- } else {
- if (markUsed) {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires a frequency value\n",
- p->name);
- }
- p->found = FALSE;
- }
- if (p->found) {
- p->value.freq.freq = freq;
- p->value.freq.units = units;
- }
- }
- break;
- case OPTV_NONE:
- /* Should never get here */
- p->found = FALSE;
- break;
- }
- if (p->found && markUsed) {
- int verb = 2;
- if (wasUsed)
- verb = 4;
- xf86DrvMsgVerb(scrnIndex, X_CONFIG, verb, "Option \"%s\"", p->name);
- if (!(p->type == OPTV_BOOLEAN && *s == 0)) {
- xf86ErrorFVerb(verb, " \"%s\"", s);
- }
- xf86ErrorFVerb(verb, "\n");
- }
- } else if (p->type == OPTV_BOOLEAN) {
- /* Look for matches with options with or without a "No" prefix. */
- char *n, *newn;
- OptionInfoRec opt;
-
- n = xf86NormalizeName(p->name);
- if (!n) {
- p->found = FALSE;
- return FALSE;
- }
- if (strncmp(n, "no", 2) == 0) {
- newn = n + 2;
- } else {
- free(n);
- if (asprintf(&n, "No%s", p->name) == -1) {
- p->found = FALSE;
- return FALSE;
- }
- newn = n;
- }
- if ((s = xf86findOptionValue(options, newn)) != NULL) {
- if (markUsed)
- xf86MarkOptionUsedByName(options, newn);
- if (GetBoolValue(&opt, s)) {
- p->value.bool = !opt.value.bool;
- p->found = TRUE;
- } else {
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Option \"%s\" requires a boolean value\n", newn);
- p->found = FALSE;
- }
- } else {
- p->found = FALSE;
- }
- if (p->found && markUsed) {
- xf86DrvMsgVerb(scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn);
- if (*s != 0) {
- xf86ErrorFVerb(2, " \"%s\"", s);
- }
- xf86ErrorFVerb(2, "\n");
- }
- free(n);
- } else {
- p->found = FALSE;
+ if (markUsed) {
+ wasUsed = xf86CheckIfOptionUsedByName(options, p->name);
+ xf86MarkOptionUsedByName(options, p->name);
+ }
+ switch (p->type) {
+ case OPTV_INTEGER:
+ if (*s == '\0') {
+ if (markUsed) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires an integer value\n",
+ p->name);
+ }
+ p->found = FALSE;
+ }
+ else {
+ p->value.num = strtoul(s, &end, 0);
+ if (*end == '\0') {
+ p->found = TRUE;
+ }
+ else {
+ if (markUsed) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires an integer value\n",
+ p->name);
+ }
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_STRING:
+ if (*s == '\0') {
+ if (markUsed) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires an string value\n",
+ p->name);
+ }
+ p->found = FALSE;
+ }
+ else {
+ p->value.str = s;
+ p->found = TRUE;
+ }
+ break;
+ case OPTV_ANYSTR:
+ p->value.str = s;
+ p->found = TRUE;
+ break;
+ case OPTV_REAL:
+ if (*s == '\0') {
+ if (markUsed) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a floating point "
+ "value\n", p->name);
+ }
+ p->found = FALSE;
+ }
+ else {
+ p->value.realnum = strtod(s, &end);
+ if (*end == '\0') {
+ p->found = TRUE;
+ }
+ else {
+ if (markUsed) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a floating point "
+ "value\n", p->name);
+ }
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_BOOLEAN:
+ if (GetBoolValue(p, s)) {
+ p->found = TRUE;
+ }
+ else {
+ if (markUsed) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a boolean value\n",
+ p->name);
+ }
+ p->found = FALSE;
+ }
+ break;
+ case OPTV_PERCENT:
+ {
+ char tmp = 0;
+
+ /* awkward match, but %% doesn't increase the match counter,
+ * hence 100 looks the same as 100% to the caller of sccanf
+ */
+ if (sscanf(s, "%lf%c", &p->value.realnum, &tmp) != 2 || tmp != '%') {
+ if (markUsed) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a percent value\n",
+ p->name);
+ }
+ p->found = FALSE;
+ }
+ else {
+ p->found = TRUE;
+ }
+ }
+ break;
+ case OPTV_FREQ:
+ if (*s == '\0') {
+ if (markUsed) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ }
+ p->found = FALSE;
+ }
+ else {
+ double freq = strtod(s, &end);
+ int units = 0;
+
+ if (end != s) {
+ p->found = TRUE;
+ if (!xf86NameCmp(end, "Hz"))
+ units = 1;
+ else if (!xf86NameCmp(end, "kHz") || !xf86NameCmp(end, "k"))
+ units = 1000;
+ else if (!xf86NameCmp(end, "MHz") || !xf86NameCmp(end, "M"))
+ units = 1000000;
+ else {
+ if (markUsed) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ }
+ p->found = FALSE;
+ }
+ if (p->found)
+ freq *= (double) units;
+ }
+ else {
+ if (markUsed) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ }
+ p->found = FALSE;
+ }
+ if (p->found) {
+ p->value.freq.freq = freq;
+ p->value.freq.units = units;
+ }
+ }
+ break;
+ case OPTV_NONE:
+ /* Should never get here */
+ p->found = FALSE;
+ break;
+ }
+ if (p->found && markUsed) {
+ int verb = 2;
+
+ if (wasUsed)
+ verb = 4;
+ xf86DrvMsgVerb(scrnIndex, X_CONFIG, verb, "Option \"%s\"", p->name);
+ if (!(p->type == OPTV_BOOLEAN && *s == 0)) {
+ xf86ErrorFVerb(verb, " \"%s\"", s);
+ }
+ xf86ErrorFVerb(verb, "\n");
+ }
+ }
+ else if (p->type == OPTV_BOOLEAN) {
+ /* Look for matches with options with or without a "No" prefix. */
+ char *n, *newn;
+ OptionInfoRec opt;
+
+ n = xf86NormalizeName(p->name);
+ if (!n) {
+ p->found = FALSE;
+ return FALSE;
+ }
+ if (strncmp(n, "no", 2) == 0) {
+ newn = n + 2;
+ }
+ else {
+ free(n);
+ if (asprintf(&n, "No%s", p->name) == -1) {
+ p->found = FALSE;
+ return FALSE;
+ }
+ newn = n;
+ }
+ if ((s = xf86findOptionValue(options, newn)) != NULL) {
+ if (markUsed)
+ xf86MarkOptionUsedByName(options, newn);
+ if (GetBoolValue(&opt, s)) {
+ p->value.bool = !opt.value.bool;
+ p->found = TRUE;
+ }
+ else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a boolean value\n", newn);
+ p->found = FALSE;
+ }
+ }
+ else {
+ p->found = FALSE;
+ }
+ if (p->found && markUsed) {
+ xf86DrvMsgVerb(scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn);
+ if (*s != 0) {
+ xf86ErrorFVerb(2, " \"%s\"", s);
+ }
+ xf86ErrorFVerb(2, "\n");
+ }
+ free(n);
+ }
+ else {
+ p->found = FALSE;
}
return p->found;
}
-
void
xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo)
{
OptionInfoPtr p;
for (p = optinfo; p->name != NULL; p++) {
- ParseOptionValue(scrnIndex, options, p, TRUE);
+ ParseOptionValue(scrnIndex, options, p, TRUE);
}
}
-
OptionInfoPtr
-xf86TokenToOptinfo(const OptionInfoRec *table, int token)
+xf86TokenToOptinfo(const OptionInfoRec * table, int token)
{
const OptionInfoRec *p, *match = NULL, *set = NULL;
if (!table) {
- ErrorF("xf86TokenToOptinfo: table is NULL\n");
- return NULL;
+ ErrorF("xf86TokenToOptinfo: table is NULL\n");
+ return NULL;
}
for (p = table; p->token >= 0; p++) {
- if (p->token == token) {
- match = p;
- if (p->found)
- set = p;
- }
+ if (p->token == token) {
+ match = p;
+ if (p->found)
+ set = p;
+ }
}
if (set)
- return (OptionInfoPtr)set;
+ return (OptionInfoPtr) set;
else if (match)
- return (OptionInfoPtr)match;
+ return (OptionInfoPtr) match;
else
- return NULL;
+ return NULL;
}
-
const char *
-xf86TokenToOptName(const OptionInfoRec *table, int token)
+xf86TokenToOptName(const OptionInfoRec * table, int token)
{
const OptionInfoRec *p;
@@ -741,9 +746,8 @@ xf86TokenToOptName(const OptionInfoRec *table, int token)
return p->name;
}
-
Bool
-xf86IsOptionSet(const OptionInfoRec *table, int token)
+xf86IsOptionSet(const OptionInfoRec * table, int token)
{
OptionInfoPtr p;
@@ -751,137 +755,136 @@ xf86IsOptionSet(const OptionInfoRec *table, int token)
return p && p->found;
}
-
char *
-xf86GetOptValString(const OptionInfoRec *table, int token)
+xf86GetOptValString(const OptionInfoRec * table, int token)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found)
- return p->value.str;
+ return p->value.str;
else
- return NULL;
+ return NULL;
}
-
Bool
-xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value)
+xf86GetOptValInteger(const OptionInfoRec * table, int token, int *value)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
- *value = p->value.num;
- return TRUE;
- } else
- return FALSE;
+ *value = p->value.num;
+ return TRUE;
+ }
+ else
+ return FALSE;
}
-
Bool
-xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value)
+xf86GetOptValULong(const OptionInfoRec * table, int token, unsigned long *value)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
- *value = p->value.num;
- return TRUE;
- } else
- return FALSE;
+ *value = p->value.num;
+ return TRUE;
+ }
+ else
+ return FALSE;
}
-
Bool
-xf86GetOptValReal(const OptionInfoRec *table, int token, double *value)
+xf86GetOptValReal(const OptionInfoRec * table, int token, double *value)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
- *value = p->value.realnum;
- return TRUE;
- } else
- return FALSE;
+ *value = p->value.realnum;
+ return TRUE;
+ }
+ else
+ return FALSE;
}
-
Bool
-xf86GetOptValFreq(const OptionInfoRec *table, int token,
- OptFreqUnits expectedUnits, double *value)
+xf86GetOptValFreq(const OptionInfoRec * table, int token,
+ OptFreqUnits expectedUnits, double *value)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
- if (p->value.freq.units > 0) {
- /* Units give, so the scaling is known. */
- switch (expectedUnits) {
- case OPTUNITS_HZ:
- *value = p->value.freq.freq;
- break;
- case OPTUNITS_KHZ:
- *value = p->value.freq.freq / 1000.0;
- break;
- case OPTUNITS_MHZ:
- *value = p->value.freq.freq / 1000000.0;
- break;
- }
- } else {
- /* No units given, so try to guess the scaling. */
- switch (expectedUnits) {
- case OPTUNITS_HZ:
- *value = p->value.freq.freq;
- break;
- case OPTUNITS_KHZ:
- if (p->value.freq.freq > 1000.0)
- *value = p->value.freq.freq / 1000.0;
- else
- *value = p->value.freq.freq;
- break;
- case OPTUNITS_MHZ:
- if (p->value.freq.freq > 1000000.0)
- *value = p->value.freq.freq / 1000000.0;
- else if (p->value.freq.freq > 1000.0)
- *value = p->value.freq.freq / 1000.0;
- else
- *value = p->value.freq.freq;
- }
- }
- return TRUE;
- } else
- return FALSE;
+ if (p->value.freq.units > 0) {
+ /* Units give, so the scaling is known. */
+ switch (expectedUnits) {
+ case OPTUNITS_HZ:
+ *value = p->value.freq.freq;
+ break;
+ case OPTUNITS_KHZ:
+ *value = p->value.freq.freq / 1000.0;
+ break;
+ case OPTUNITS_MHZ:
+ *value = p->value.freq.freq / 1000000.0;
+ break;
+ }
+ }
+ else {
+ /* No units given, so try to guess the scaling. */
+ switch (expectedUnits) {
+ case OPTUNITS_HZ:
+ *value = p->value.freq.freq;
+ break;
+ case OPTUNITS_KHZ:
+ if (p->value.freq.freq > 1000.0)
+ *value = p->value.freq.freq / 1000.0;
+ else
+ *value = p->value.freq.freq;
+ break;
+ case OPTUNITS_MHZ:
+ if (p->value.freq.freq > 1000000.0)
+ *value = p->value.freq.freq / 1000000.0;
+ else if (p->value.freq.freq > 1000.0)
+ *value = p->value.freq.freq / 1000.0;
+ else
+ *value = p->value.freq.freq;
+ }
+ }
+ return TRUE;
+ }
+ else
+ return FALSE;
}
-
Bool
-xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value)
+xf86GetOptValBool(const OptionInfoRec * table, int token, Bool *value)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
- *value = p->value.bool;
- return TRUE;
- } else
- return FALSE;
+ *value = p->value.bool;
+ return TRUE;
+ }
+ else
+ return FALSE;
}
-
Bool
-xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def)
+xf86ReturnOptValBool(const OptionInfoRec * table, int token, Bool def)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
- return p->value.bool;
- } else
- return def;
+ return p->value.bool;
+ }
+ else
+ return def;
}
-
int
xf86NameCmp(const char *s1, const char *s2)
{
@@ -895,21 +898,21 @@ xf86NormalizeName(const char *s)
const char *p;
if (s == NULL)
- return NULL;
+ return NULL;
ret = malloc(strlen(s) + 1);
for (p = s, q = ret; *p != 0; p++) {
- switch (*p) {
- case '_':
- case ' ':
- case '\t':
- continue;
- default:
- if (isupper(*p))
- *q++ = tolower(*p);
- else
- *q++ = *p;
- }
+ switch (*p) {
+ case '_':
+ case ' ':
+ case '\t':
+ continue;
+ default:
+ if (isupper(*p))
+ *q++ = tolower(*p);
+ else
+ *q++ = *p;
+ }
}
*q = '\0';
return ret;
diff --git a/xorg-server/hw/xfree86/common/xf86Optionstr.h b/xorg-server/hw/xfree86/common/xf86Optionstr.h
index fc9385617..c38499cb5 100644
--- a/xorg-server/hw/xfree86/common/xf86Optionstr.h
+++ b/xorg-server/hw/xfree86/common/xf86Optionstr.h
@@ -29,15 +29,13 @@
/*
* All options are stored using this data type.
*/
-typedef struct _XF86OptionRec
-{
- GenericListRec list;
- char *opt_name;
- char *opt_val;
- int opt_used;
- char *opt_comment;
-}
-XF86OptionRec;
+typedef struct _XF86OptionRec {
+ GenericListRec list;
+ char *opt_name;
+ char *opt_val;
+ int opt_used;
+ char *opt_comment;
+} XF86OptionRec;
typedef struct _InputOption *XF86OptionPtr;
diff --git a/xorg-server/hw/xfree86/common/xf86PM.c b/xorg-server/hw/xfree86/common/xf86PM.c
index 47e0297d6..f69fffa0e 100644
--- a/xorg-server/hw/xfree86/common/xf86PM.c
+++ b/xorg-server/hw/xfree86/common/xf86PM.c
@@ -35,60 +35,90 @@
#include "xf86Xinput.h"
#include "xf86_OSproc.h"
-int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num) = NULL;
-pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event) = NULL;
+int (*xf86PMGetEventFromOs) (int fd, pmEvent * events, int num) = NULL;
+pmWait (*xf86PMConfirmEventToOs) (int fd, pmEvent event) = NULL;
static Bool suspended = FALSE;
static int
eventName(pmEvent event, const char **str)
{
- switch(event) {
- case XF86_APM_SYS_STANDBY: *str="System Standby Request"; return 0;
- case XF86_APM_SYS_SUSPEND: *str="System Suspend Request"; return 0;
- case XF86_APM_CRITICAL_SUSPEND: *str="Critical Suspend"; return 0;
- case XF86_APM_USER_STANDBY: *str="User System Standby Request"; return 0;
- case XF86_APM_USER_SUSPEND: *str="User System Suspend Request"; return 0;
- case XF86_APM_STANDBY_RESUME: *str="System Standby Resume"; return 0;
- case XF86_APM_NORMAL_RESUME: *str="Normal Resume System"; return 0;
- case XF86_APM_CRITICAL_RESUME: *str="Critical Resume System"; return 0;
- case XF86_APM_LOW_BATTERY: *str="Battery Low"; return 3;
- case XF86_APM_POWER_STATUS_CHANGE: *str="Power Status Change";return 3;
- case XF86_APM_UPDATE_TIME: *str="Update Time";return 3;
- case XF86_APM_CAPABILITY_CHANGED: *str="Capability Changed"; return 3;
- case XF86_APM_STANDBY_FAILED: *str="Standby Request Failed"; return 0;
- case XF86_APM_SUSPEND_FAILED: *str="Suspend Request Failed"; return 0;
- default: *str="Unknown Event"; return 0;
+ switch (event) {
+ case XF86_APM_SYS_STANDBY:
+ *str = "System Standby Request";
+ return 0;
+ case XF86_APM_SYS_SUSPEND:
+ *str = "System Suspend Request";
+ return 0;
+ case XF86_APM_CRITICAL_SUSPEND:
+ *str = "Critical Suspend";
+ return 0;
+ case XF86_APM_USER_STANDBY:
+ *str = "User System Standby Request";
+ return 0;
+ case XF86_APM_USER_SUSPEND:
+ *str = "User System Suspend Request";
+ return 0;
+ case XF86_APM_STANDBY_RESUME:
+ *str = "System Standby Resume";
+ return 0;
+ case XF86_APM_NORMAL_RESUME:
+ *str = "Normal Resume System";
+ return 0;
+ case XF86_APM_CRITICAL_RESUME:
+ *str = "Critical Resume System";
+ return 0;
+ case XF86_APM_LOW_BATTERY:
+ *str = "Battery Low";
+ return 3;
+ case XF86_APM_POWER_STATUS_CHANGE:
+ *str = "Power Status Change";
+ return 3;
+ case XF86_APM_UPDATE_TIME:
+ *str = "Update Time";
+ return 3;
+ case XF86_APM_CAPABILITY_CHANGED:
+ *str = "Capability Changed";
+ return 3;
+ case XF86_APM_STANDBY_FAILED:
+ *str = "Standby Request Failed";
+ return 0;
+ case XF86_APM_SUSPEND_FAILED:
+ *str = "Suspend Request Failed";
+ return 0;
+ default:
+ *str = "Unknown Event";
+ return 0;
}
}
static int sigio_blocked_for_suspend;
static void
-suspend (pmEvent event, Bool undo)
+suspend(pmEvent event, Bool undo)
{
int i;
InputInfoPtr pInfo;
for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->EnableDisableFBAccess)
- (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
}
pInfo = xf86InputDevs;
while (pInfo) {
- DisableDevice(pInfo->dev, TRUE);
- pInfo = pInfo->next;
+ DisableDevice(pInfo->dev, TRUE);
+ pInfo = pInfo->next;
}
sigio_blocked_for_suspend = xf86BlockSIGIO();
for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->PMEvent)
- xf86Screens[i]->PMEvent(i,event,undo);
- else {
- xf86Screens[i]->LeaveVT(i, 0);
- xf86Screens[i]->vtSema = FALSE;
- }
+ if (xf86Screens[i]->PMEvent)
+ xf86Screens[i]->PMEvent(i, event, undo);
+ else {
+ xf86Screens[i]->LeaveVT(i, 0);
+ xf86Screens[i]->vtSema = FALSE;
+ }
}
- xf86AccessLeave();
+ xf86AccessLeave();
}
@@ -100,23 +130,23 @@ resume(pmEvent event, Bool undo)
xf86AccessEnter();
for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->PMEvent)
- xf86Screens[i]->PMEvent(i,event,undo);
- else {
- xf86Screens[i]->vtSema = TRUE;
- xf86Screens[i]->EnterVT(i, 0);
- }
+ if (xf86Screens[i]->PMEvent)
+ xf86Screens[i]->PMEvent(i, event, undo);
+ else {
+ xf86Screens[i]->vtSema = TRUE;
+ xf86Screens[i]->EnterVT(i, 0);
+ }
}
xf86UnblockSIGIO(sigio_blocked_for_suspend);
for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->EnableDisableFBAccess)
- (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
}
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
- EnableDevice(pInfo->dev, TRUE);
- pInfo = pInfo->next;
+ EnableDevice(pInfo->dev, TRUE);
+ pInfo = pInfo->next;
}
}
@@ -124,43 +154,44 @@ static void
DoApmEvent(pmEvent event, Bool undo)
{
int i, was_blocked;
-
- switch(event) {
+
+ switch (event) {
#if 0
case XF86_APM_SYS_STANDBY:
case XF86_APM_USER_STANDBY:
#endif
case XF86_APM_SYS_SUSPEND:
- case XF86_APM_CRITICAL_SUSPEND: /*do we want to delay a critical suspend?*/
+ case XF86_APM_CRITICAL_SUSPEND: /*do we want to delay a critical suspend? */
case XF86_APM_USER_SUSPEND:
- /* should we do this ? */
- if (!undo && !suspended) {
- suspend(event,undo);
- suspended = TRUE;
- } else if (undo && suspended) {
- resume(event,undo);
- suspended = FALSE;
- }
- break;
+ /* should we do this ? */
+ if (!undo && !suspended) {
+ suspend(event, undo);
+ suspended = TRUE;
+ }
+ else if (undo && suspended) {
+ resume(event, undo);
+ suspended = FALSE;
+ }
+ break;
#if 0
case XF86_APM_STANDBY_RESUME:
#endif
case XF86_APM_NORMAL_RESUME:
case XF86_APM_CRITICAL_RESUME:
- if (suspended) {
- resume(event,undo);
- suspended = FALSE;
- }
- break;
+ if (suspended) {
+ resume(event, undo);
+ suspended = FALSE;
+ }
+ break;
default:
- was_blocked = xf86BlockSIGIO();
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->PMEvent) {
- xf86Screens[i]->PMEvent(i,event,undo);
- }
- }
- xf86UnblockSIGIO(was_blocked);
- break;
+ was_blocked = xf86BlockSIGIO();
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->PMEvent) {
+ xf86Screens[i]->PMEvent(i, event, undo);
+ }
+ }
+ xf86UnblockSIGIO(was_blocked);
+ break;
}
}
@@ -170,39 +201,39 @@ void
xf86HandlePMEvents(int fd, pointer data)
{
pmEvent events[MAX_NO_EVENTS];
- int i,n;
+ int i, n;
Bool wait = FALSE;
if (!xf86PMGetEventFromOs)
- return;
-
- if ((n = xf86PMGetEventFromOs(fd,events,MAX_NO_EVENTS))) {
- do {
- for (i = 0; i < n; i++) {
- const char *str = NULL;
- int verb = eventName(events[i],&str);
-
- xf86MsgVerb(X_INFO,verb,"PM Event received: %s\n",str);
- DoApmEvent(events[i],FALSE);
- switch (xf86PMConfirmEventToOs(fd,events[i])) {
- case PM_WAIT:
- wait = TRUE;
- break;
- case PM_CONTINUE:
- wait = FALSE;
- break;
- case PM_FAILED:
- DoApmEvent(events[i],TRUE);
- wait = FALSE;
- break;
- default:
- break;
- }
- }
- if (wait)
- n = xf86PMGetEventFromOs(fd,events,MAX_NO_EVENTS);
- else
- break;
- } while (1);
+ return;
+
+ if ((n = xf86PMGetEventFromOs(fd, events, MAX_NO_EVENTS))) {
+ do {
+ for (i = 0; i < n; i++) {
+ const char *str = NULL;
+ int verb = eventName(events[i], &str);
+
+ xf86MsgVerb(X_INFO, verb, "PM Event received: %s\n", str);
+ DoApmEvent(events[i], FALSE);
+ switch (xf86PMConfirmEventToOs(fd, events[i])) {
+ case PM_WAIT:
+ wait = TRUE;
+ break;
+ case PM_CONTINUE:
+ wait = FALSE;
+ break;
+ case PM_FAILED:
+ DoApmEvent(events[i], TRUE);
+ wait = FALSE;
+ break;
+ default:
+ break;
+ }
+ }
+ if (wait)
+ n = xf86PMGetEventFromOs(fd, events, MAX_NO_EVENTS);
+ else
+ break;
+ } while (1);
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h
index 255407b48..8d9cb5539 100644
--- a/xorg-server/hw/xfree86/common/xf86Priv.h
+++ b/xorg-server/hw/xfree86/common/xf86Priv.h
@@ -45,53 +45,55 @@
*/
extern _X_EXPORT const char *xf86ConfigFile;
extern _X_EXPORT const char *xf86ConfigDir;
-extern _X_EXPORT Bool xf86AllowMouseOpenFail;
+extern _X_EXPORT Bool xf86AllowMouseOpenFail;
+
#ifdef XF86VIDMODE
-extern _X_EXPORT Bool xf86VidModeDisabled;
-extern _X_EXPORT Bool xf86VidModeAllowNonLocal;
-#endif
-extern _X_EXPORT Bool xf86fpFlag;
-extern _X_EXPORT Bool xf86sFlag;
-extern _X_EXPORT Bool xf86bsEnableFlag;
-extern _X_EXPORT Bool xf86bsDisableFlag;
-extern _X_EXPORT Bool xf86silkenMouseDisableFlag;
-extern _X_EXPORT Bool xf86xkbdirFlag;
+extern _X_EXPORT Bool xf86VidModeDisabled;
+extern _X_EXPORT Bool xf86VidModeAllowNonLocal;
+#endif
+extern _X_EXPORT Bool xf86fpFlag;
+extern _X_EXPORT Bool xf86sFlag;
+extern _X_EXPORT Bool xf86bsEnableFlag;
+extern _X_EXPORT Bool xf86bsDisableFlag;
+extern _X_EXPORT Bool xf86silkenMouseDisableFlag;
+extern _X_EXPORT Bool xf86xkbdirFlag;
+
#ifdef HAVE_ACPI
-extern _X_EXPORT Bool xf86acpiDisableFlag;
+extern _X_EXPORT Bool xf86acpiDisableFlag;
#endif
-extern _X_EXPORT char *xf86LayoutName;
-extern _X_EXPORT char *xf86ScreenName;
-extern _X_EXPORT char *xf86PointerName;
-extern _X_EXPORT char *xf86KeyboardName;
-extern _X_EXPORT int xf86FbBpp;
-extern _X_EXPORT int xf86Depth;
-extern _X_EXPORT Pix24Flags xf86Pix24;
-extern _X_EXPORT rgb xf86Weight;
-extern _X_EXPORT Bool xf86FlipPixels;
-extern _X_EXPORT Gamma xf86Gamma;
-extern _X_EXPORT const char *xf86ServerName;
+extern _X_EXPORT char *xf86LayoutName;
+extern _X_EXPORT char *xf86ScreenName;
+extern _X_EXPORT char *xf86PointerName;
+extern _X_EXPORT char *xf86KeyboardName;
+extern _X_EXPORT int xf86FbBpp;
+extern _X_EXPORT int xf86Depth;
+extern _X_EXPORT Pix24Flags xf86Pix24;
+extern _X_EXPORT rgb xf86Weight;
+extern _X_EXPORT Bool xf86FlipPixels;
+extern _X_EXPORT Gamma xf86Gamma;
+extern _X_EXPORT const char *xf86ServerName;
/* Other parameters */
-extern _X_EXPORT xf86InfoRec xf86Info;
-extern _X_EXPORT const char *xf86ModulePath;
-extern _X_EXPORT MessageType xf86ModPathFrom;
-extern _X_EXPORT const char *xf86LogFile;
-extern _X_EXPORT MessageType xf86LogFileFrom;
-extern _X_EXPORT Bool xf86LogFileWasOpened;
-extern _X_EXPORT serverLayoutRec xf86ConfigLayout;
-
-extern _X_EXPORT DriverPtr *xf86DriverList;
-extern _X_EXPORT int xf86NumDrivers;
-extern _X_EXPORT Bool xf86Resetting;
-extern _X_EXPORT Bool xf86Initialising;
-extern _X_EXPORT int xf86NumScreens;
-extern _X_EXPORT const char *xf86VisualNames[];
-extern _X_EXPORT int xf86Verbose; /* verbosity level */
-extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */
-extern _X_EXPORT Bool xorgHWAccess;
-
-extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable;
+extern _X_EXPORT xf86InfoRec xf86Info;
+extern _X_EXPORT const char *xf86ModulePath;
+extern _X_EXPORT MessageType xf86ModPathFrom;
+extern _X_EXPORT const char *xf86LogFile;
+extern _X_EXPORT MessageType xf86LogFileFrom;
+extern _X_EXPORT Bool xf86LogFileWasOpened;
+extern _X_EXPORT serverLayoutRec xf86ConfigLayout;
+
+extern _X_EXPORT DriverPtr *xf86DriverList;
+extern _X_EXPORT int xf86NumDrivers;
+extern _X_EXPORT Bool xf86Resetting;
+extern _X_EXPORT Bool xf86Initialising;
+extern _X_EXPORT int xf86NumScreens;
+extern _X_EXPORT const char *xf86VisualNames[];
+extern _X_EXPORT int xf86Verbose; /* verbosity level */
+extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */
+extern _X_EXPORT Bool xorgHWAccess;
+
+extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable;
#ifndef DEFAULT_VERBOSE
#define DEFAULT_VERBOSE 0
@@ -125,29 +127,43 @@ extern _X_EXPORT const DisplayModeRec xf86DefaultModes[];
extern _X_EXPORT const int xf86NumDefaultModes;
/* xf86Configure.c */
-extern _X_EXPORT void DoConfigure(void) _X_NORETURN;
-extern _X_EXPORT void DoShowOptions(void) _X_NORETURN;
+extern _X_EXPORT void
+DoConfigure(void)
+ _X_NORETURN;
+extern _X_EXPORT void
+DoShowOptions(void)
+ _X_NORETURN;
/* xf86Events.c */
-extern _X_EXPORT void xf86Wakeup(pointer blockData, int err, pointer pReadmask);
-extern _X_HIDDEN int xf86SigWrapper(int signo);
-extern _X_EXPORT void xf86HandlePMEvents(int fd, pointer data);
-extern _X_EXPORT int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num);
-extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event);
+extern _X_EXPORT void
+xf86Wakeup(pointer blockData, int err, pointer pReadmask);
+extern _X_HIDDEN int
+xf86SigWrapper(int signo);
+extern _X_EXPORT void
+xf86HandlePMEvents(int fd, pointer data);
+extern _X_EXPORT int (*xf86PMGetEventFromOs) (int fd, pmEvent * events,
+ int num);
+extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs) (int fd, pmEvent event);
/* xf86Helper.c */
-extern _X_EXPORT void xf86LogInit(void);
-extern _X_EXPORT void xf86CloseLog(enum ExitCode error);
+extern _X_EXPORT void
+xf86LogInit(void);
+extern _X_EXPORT void
+xf86CloseLog(enum ExitCode error);
/* xf86Init.c */
-extern _X_EXPORT Bool xf86LoadModules(char **list, pointer *optlist);
-extern _X_EXPORT int xf86SetVerbosity(int verb);
-extern _X_EXPORT int xf86SetLogVerbosity(int verb);
-extern _X_EXPORT Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only );
-extern _X_EXPORT Bool xf86PrivsElevated(void);
-
-#endif /* _NO_XF86_PROTOTYPES */
-
-
-#endif /* _XF86PRIV_H */
+extern _X_EXPORT Bool
+xf86LoadModules(char **list, pointer *optlist);
+extern _X_EXPORT int
+xf86SetVerbosity(int verb);
+extern _X_EXPORT int
+xf86SetLogVerbosity(int verb);
+extern _X_EXPORT Bool
+xf86CallDriverProbe(struct _DriverRec *drv, Bool detect_only);
+extern _X_EXPORT Bool
+xf86PrivsElevated(void);
+
+#endif /* _NO_XF86_PROTOTYPES */
+
+#endif /* _XF86PRIV_H */
diff --git a/xorg-server/hw/xfree86/common/xf86RandR.c b/xorg-server/hw/xfree86/common/xf86RandR.c
index d0e47841e..abd894dff 100644
--- a/xorg-server/hw/xfree86/common/xf86RandR.c
+++ b/xorg-server/hw/xfree86/common/xf86RandR.c
@@ -37,13 +37,13 @@
#include "inputstr.h"
typedef struct _xf86RandRInfo {
- CreateScreenResourcesProcPtr CreateScreenResources;
- CloseScreenProcPtr CloseScreen;
- int virtualX;
- int virtualY;
- int mmWidth;
- int mmHeight;
- Rotation rotation;
+ CreateScreenResourcesProcPtr CreateScreenResources;
+ CloseScreenProcPtr CloseScreen;
+ int virtualX;
+ int virtualY;
+ int mmWidth;
+ int mmHeight;
+ Rotation rotation;
} XF86RandRInfoRec, *XF86RandRInfoPtr;
static DevPrivateKeyRec xf86RandRKeyRec;
@@ -52,171 +52,162 @@ static DevPrivateKey xf86RandRKey;
#define XF86RANDRINFO(p) ((XF86RandRInfoPtr)dixLookupPrivate(&(p)->devPrivates, xf86RandRKey))
static int
-xf86RandRModeRefresh (DisplayModePtr mode)
+xf86RandRModeRefresh(DisplayModePtr mode)
{
if (mode->VRefresh)
- return (int) (mode->VRefresh + 0.5);
+ return (int) (mode->VRefresh + 0.5);
else if (mode->Clock == 0)
- return 0;
+ return 0;
else
- return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
+ return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
}
static Bool
-xf86RandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
+xf86RandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
{
- RRScreenSizePtr pSize;
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- DisplayModePtr mode;
- int refresh0 = 60;
- xorgRRModeMM RRModeMM;
+ RRScreenSizePtr pSize;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int refresh0 = 60;
+ xorgRRModeMM RRModeMM;
*rotations = RR_Rotate_0;
- for (mode = scrp->modes; mode != NULL ; mode = mode->next)
- {
- int refresh = xf86RandRModeRefresh (mode);
-
- if (mode == scrp->modes)
- refresh0 = refresh;
-
- RRModeMM.mode = mode;
- RRModeMM.virtX = randrp->virtualX;
- RRModeMM.virtY = randrp->virtualY;
- RRModeMM.mmWidth = randrp->mmWidth;
- RRModeMM.mmHeight = randrp->mmHeight;
-
- if(scrp->DriverFunc) {
- (*scrp->DriverFunc)(scrp, RR_GET_MODE_MM, &RRModeMM);
- }
-
- pSize = RRRegisterSize (pScreen,
- mode->HDisplay, mode->VDisplay,
- RRModeMM.mmWidth, RRModeMM.mmHeight);
- if (!pSize)
- return FALSE;
- RRRegisterRate (pScreen, pSize, refresh);
- if (mode == scrp->currentMode &&
- mode->HDisplay == scrp->virtualX && mode->VDisplay == scrp->virtualY)
- RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize);
- if (mode->next == scrp->modes)
- break;
+ for (mode = scrp->modes; mode != NULL; mode = mode->next) {
+ int refresh = xf86RandRModeRefresh(mode);
+
+ if (mode == scrp->modes)
+ refresh0 = refresh;
+
+ RRModeMM.mode = mode;
+ RRModeMM.virtX = randrp->virtualX;
+ RRModeMM.virtY = randrp->virtualY;
+ RRModeMM.mmWidth = randrp->mmWidth;
+ RRModeMM.mmHeight = randrp->mmHeight;
+
+ if (scrp->DriverFunc) {
+ (*scrp->DriverFunc) (scrp, RR_GET_MODE_MM, &RRModeMM);
+ }
+
+ pSize = RRRegisterSize(pScreen,
+ mode->HDisplay, mode->VDisplay,
+ RRModeMM.mmWidth, RRModeMM.mmHeight);
+ if (!pSize)
+ return FALSE;
+ RRRegisterRate(pScreen, pSize, refresh);
+ if (mode == scrp->currentMode &&
+ mode->HDisplay == scrp->virtualX &&
+ mode->VDisplay == scrp->virtualY)
+ RRSetCurrentConfig(pScreen, randrp->rotation, refresh, pSize);
+ if (mode->next == scrp->modes)
+ break;
}
if (scrp->currentMode->HDisplay != randrp->virtualX ||
- scrp->currentMode->VDisplay != randrp->virtualY)
- {
- mode = scrp->modes;
-
- RRModeMM.mode = NULL;
- RRModeMM.virtX = randrp->virtualX;
- RRModeMM.virtY = randrp->virtualY;
- RRModeMM.mmWidth = randrp->mmWidth;
- RRModeMM.mmHeight = randrp->mmHeight;
-
- if(scrp->DriverFunc) {
- (*scrp->DriverFunc)(scrp, RR_GET_MODE_MM, &RRModeMM);
- }
-
- pSize = RRRegisterSize (pScreen,
- randrp->virtualX, randrp->virtualY,
- RRModeMM.mmWidth, RRModeMM.mmHeight);
- if (!pSize)
- return FALSE;
- RRRegisterRate (pScreen, pSize, refresh0);
- if (scrp->virtualX == randrp->virtualX &&
- scrp->virtualY == randrp->virtualY)
- {
- RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize);
- }
+ scrp->currentMode->VDisplay != randrp->virtualY) {
+ mode = scrp->modes;
+
+ RRModeMM.mode = NULL;
+ RRModeMM.virtX = randrp->virtualX;
+ RRModeMM.virtY = randrp->virtualY;
+ RRModeMM.mmWidth = randrp->mmWidth;
+ RRModeMM.mmHeight = randrp->mmHeight;
+
+ if (scrp->DriverFunc) {
+ (*scrp->DriverFunc) (scrp, RR_GET_MODE_MM, &RRModeMM);
+ }
+
+ pSize = RRRegisterSize(pScreen,
+ randrp->virtualX, randrp->virtualY,
+ RRModeMM.mmWidth, RRModeMM.mmHeight);
+ if (!pSize)
+ return FALSE;
+ RRRegisterRate(pScreen, pSize, refresh0);
+ if (scrp->virtualX == randrp->virtualX &&
+ scrp->virtualY == randrp->virtualY) {
+ RRSetCurrentConfig(pScreen, randrp->rotation, refresh0, pSize);
+ }
}
/* If there is driver support for randr, let it set our supported rotations */
- if(scrp->DriverFunc) {
- xorgRRRotation RRRotation;
+ if (scrp->DriverFunc) {
+ xorgRRRotation RRRotation;
- RRRotation.RRRotations = *rotations;
- if (!(*scrp->DriverFunc)(scrp, RR_GET_INFO, &RRRotation))
- return TRUE;
- *rotations = RRRotation.RRRotations;
+ RRRotation.RRRotations = *rotations;
+ if (!(*scrp->DriverFunc) (scrp, RR_GET_INFO, &RRRotation))
+ return TRUE;
+ *rotations = RRRotation.RRRotations;
}
return TRUE;
}
static Bool
-xf86RandRSetMode (ScreenPtr pScreen,
- DisplayModePtr mode,
- Bool useVirtual,
- int mmWidth,
- int mmHeight)
+xf86RandRSetMode(ScreenPtr pScreen,
+ DisplayModePtr mode,
+ Bool useVirtual, int mmWidth, int mmHeight)
{
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- int oldWidth = pScreen->width;
- int oldHeight = pScreen->height;
- int oldmmWidth = pScreen->mmWidth;
- int oldmmHeight = pScreen->mmHeight;
- int oldVirtualX = scrp->virtualX;
- int oldVirtualY = scrp->virtualY;
- WindowPtr pRoot = pScreen->root;
- Bool ret = TRUE;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int oldWidth = pScreen->width;
+ int oldHeight = pScreen->height;
+ int oldmmWidth = pScreen->mmWidth;
+ int oldmmHeight = pScreen->mmHeight;
+ int oldVirtualX = scrp->virtualX;
+ int oldVirtualY = scrp->virtualY;
+ WindowPtr pRoot = pScreen->root;
+ Bool ret = TRUE;
if (pRoot && scrp->vtSema)
- (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
- if (useVirtual)
- {
- scrp->virtualX = randrp->virtualX;
- scrp->virtualY = randrp->virtualY;
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+ if (useVirtual) {
+ scrp->virtualX = randrp->virtualX;
+ scrp->virtualY = randrp->virtualY;
}
- else
- {
- scrp->virtualX = mode->HDisplay;
- scrp->virtualY = mode->VDisplay;
+ else {
+ scrp->virtualX = mode->HDisplay;
+ scrp->virtualY = mode->VDisplay;
}
/*
* The DIX forgets the physical dimensions we passed into RRRegisterSize, so
* reconstruct them if possible.
*/
- if(scrp->DriverFunc) {
- xorgRRModeMM RRModeMM;
+ if (scrp->DriverFunc) {
+ xorgRRModeMM RRModeMM;
- RRModeMM.mode = mode;
- RRModeMM.virtX = scrp->virtualX;
- RRModeMM.virtY = scrp->virtualY;
- RRModeMM.mmWidth = mmWidth;
- RRModeMM.mmHeight = mmHeight;
+ RRModeMM.mode = mode;
+ RRModeMM.virtX = scrp->virtualX;
+ RRModeMM.virtY = scrp->virtualY;
+ RRModeMM.mmWidth = mmWidth;
+ RRModeMM.mmHeight = mmHeight;
- (*scrp->DriverFunc)(scrp, RR_GET_MODE_MM, &RRModeMM);
+ (*scrp->DriverFunc) (scrp, RR_GET_MODE_MM, &RRModeMM);
- mmWidth = RRModeMM.mmWidth;
- mmHeight = RRModeMM.mmHeight;
+ mmWidth = RRModeMM.mmWidth;
+ mmHeight = RRModeMM.mmHeight;
}
- if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270))
- {
- /* If the screen is rotated 90 or 270 degrees, swap the sizes. */
- pScreen->width = scrp->virtualY;
- pScreen->height = scrp->virtualX;
- pScreen->mmWidth = mmHeight;
- pScreen->mmHeight = mmWidth;
+ if (randrp->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
+ /* If the screen is rotated 90 or 270 degrees, swap the sizes. */
+ pScreen->width = scrp->virtualY;
+ pScreen->height = scrp->virtualX;
+ pScreen->mmWidth = mmHeight;
+ pScreen->mmHeight = mmWidth;
}
- else
- {
- pScreen->width = scrp->virtualX;
- pScreen->height = scrp->virtualY;
- pScreen->mmWidth = mmWidth;
- pScreen->mmHeight = mmHeight;
+ else {
+ pScreen->width = scrp->virtualX;
+ pScreen->height = scrp->virtualY;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
}
- if (!xf86SwitchMode (pScreen, mode))
- {
- pScreen->width = oldWidth;
- pScreen->height = oldHeight;
- pScreen->mmWidth = oldmmWidth;
- pScreen->mmHeight = oldmmHeight;
- scrp->virtualX = oldVirtualX;
- scrp->virtualY = oldVirtualY;
- ret = FALSE;
+ if (!xf86SwitchMode(pScreen, mode)) {
+ pScreen->width = oldWidth;
+ pScreen->height = oldHeight;
+ pScreen->mmWidth = oldmmWidth;
+ pScreen->mmHeight = oldmmHeight;
+ scrp->virtualX = oldVirtualX;
+ scrp->virtualY = oldVirtualY;
+ ret = FALSE;
}
/*
* Make sure the layout is correct
@@ -226,120 +217,117 @@ xf86RandRSetMode (ScreenPtr pScreen,
/*
* Make sure the whole screen is visible
*/
- xf86SetViewport (pScreen, pScreen->width, pScreen->height);
- xf86SetViewport (pScreen, 0, 0);
+ xf86SetViewport(pScreen, pScreen->width, pScreen->height);
+ xf86SetViewport(pScreen, 0, 0);
if (pRoot && scrp->vtSema)
- (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
return ret;
}
static Bool
-xf86RandRSetConfig (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize)
+xf86RandRSetConfig(ScreenPtr pScreen,
+ Rotation rotation, int rate, RRScreenSizePtr pSize)
{
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- DisplayModePtr mode;
- int pos[MAXDEVICES][2];
- Bool useVirtual = FALSE;
- Rotation oldRotation = randrp->rotation;
- DeviceIntPtr dev;
- Bool view_adjusted = FALSE;
-
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (!IsMaster(dev) && !IsFloating(dev))
- continue;
-
- miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]);
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int pos[MAXDEVICES][2];
+ Bool useVirtual = FALSE;
+ Rotation oldRotation = randrp->rotation;
+ DeviceIntPtr dev;
+ Bool view_adjusted = FALSE;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (!IsMaster(dev) && !IsFloating(dev))
+ continue;
+
+ miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]);
}
- for (mode = scrp->modes; ; mode = mode->next)
- {
- if (mode->HDisplay == pSize->width &&
- mode->VDisplay == pSize->height &&
- (rate == 0 || xf86RandRModeRefresh (mode) == rate))
- break;
- if (mode->next == scrp->modes)
- {
- if (pSize->width == randrp->virtualX &&
- pSize->height == randrp->virtualY)
- {
- mode = scrp->modes;
- useVirtual = TRUE;
- break;
- }
- return FALSE;
- }
+ for (mode = scrp->modes;; mode = mode->next) {
+ if (mode->HDisplay == pSize->width &&
+ mode->VDisplay == pSize->height &&
+ (rate == 0 || xf86RandRModeRefresh(mode) == rate))
+ break;
+ if (mode->next == scrp->modes) {
+ if (pSize->width == randrp->virtualX &&
+ pSize->height == randrp->virtualY) {
+ mode = scrp->modes;
+ useVirtual = TRUE;
+ break;
+ }
+ return FALSE;
+ }
}
if (randrp->rotation != rotation) {
/* Have the driver do its thing. */
- if (scrp->DriverFunc) {
- xorgRRRotation RRRotation;
- RRRotation.RRConfig.rotation = rotation;
- RRRotation.RRConfig.rate = rate;
- RRRotation.RRConfig.width = pSize->width;
- RRRotation.RRConfig.height = pSize->height;
-
- /*
- * Currently we need to rely on HW support for rotation.
- */
- if (!(*scrp->DriverFunc)(scrp, RR_SET_CONFIG, &RRRotation))
- return FALSE;
- } else
- return FALSE;
-
- randrp->rotation = rotation;
+ if (scrp->DriverFunc) {
+ xorgRRRotation RRRotation;
+
+ RRRotation.RRConfig.rotation = rotation;
+ RRRotation.RRConfig.rate = rate;
+ RRRotation.RRConfig.width = pSize->width;
+ RRRotation.RRConfig.height = pSize->height;
+
+ /*
+ * Currently we need to rely on HW support for rotation.
+ */
+ if (!(*scrp->DriverFunc) (scrp, RR_SET_CONFIG, &RRRotation))
+ return FALSE;
+ }
+ else
+ return FALSE;
+
+ randrp->rotation = rotation;
}
- if (!xf86RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) {
- if(randrp->rotation != oldRotation) {
- /* Have the driver undo its thing. */
- if (scrp->DriverFunc) {
- xorgRRRotation RRRotation;
- RRRotation.RRConfig.rotation = oldRotation;
- RRRotation.RRConfig.rate = xf86RandRModeRefresh (scrp->currentMode);
- RRRotation.RRConfig.width = scrp->virtualX;
- RRRotation.RRConfig.height = scrp->virtualY;
- (*scrp->DriverFunc)(scrp, RR_SET_CONFIG, &RRRotation);
- }
-
- randrp->rotation = oldRotation;
- }
- return FALSE;
+ if (!xf86RandRSetMode
+ (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) {
+ if (randrp->rotation != oldRotation) {
+ /* Have the driver undo its thing. */
+ if (scrp->DriverFunc) {
+ xorgRRRotation RRRotation;
+
+ RRRotation.RRConfig.rotation = oldRotation;
+ RRRotation.RRConfig.rate =
+ xf86RandRModeRefresh(scrp->currentMode);
+ RRRotation.RRConfig.width = scrp->virtualX;
+ RRRotation.RRConfig.height = scrp->virtualY;
+ (*scrp->DriverFunc) (scrp, RR_SET_CONFIG, &RRRotation);
+ }
+
+ randrp->rotation = oldRotation;
+ }
+ return FALSE;
}
-
update_desktop_dimensions();
/*
* Move the cursor back where it belongs; SwitchMode repositions it
* FIXME: duplicated code, see modes/xf86RandR12.c
*/
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (!IsMaster(dev) && !IsFloating(dev))
- continue;
-
- if (pScreen == miPointerGetScreen(dev)) {
- int px = pos[dev->id][0];
- int py = pos[dev->id][1];
-
- px = (px >= pScreen->width ? (pScreen->width - 1) : px);
- py = (py >= pScreen->height ? (pScreen->height - 1) : py);
-
- /* Setting the viewpoint makes only sense on one device */
- if (!view_adjusted && IsMaster(dev)) {
- xf86SetViewport(pScreen, px, py);
- view_adjusted = TRUE;
- }
-
- (*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE);
- }
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (!IsMaster(dev) && !IsFloating(dev))
+ continue;
+
+ if (pScreen == miPointerGetScreen(dev)) {
+ int px = pos[dev->id][0];
+ int py = pos[dev->id][1];
+
+ px = (px >= pScreen->width ? (pScreen->width - 1) : px);
+ py = (py >= pScreen->height ? (pScreen->height - 1) : py);
+
+ /* Setting the viewpoint makes only sense on one device */
+ if (!view_adjusted && IsMaster(dev)) {
+ xf86SetViewport(pScreen, px, py);
+ view_adjusted = TRUE;
+ }
+
+ (*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE);
+ }
}
return TRUE;
@@ -351,22 +339,23 @@ xf86RandRSetConfig (ScreenPtr pScreen,
* at the current mode size rather than the maximum size
*/
static Bool
-xf86RandRCreateScreenResources (ScreenPtr pScreen)
+xf86RandRCreateScreenResources(ScreenPtr pScreen)
{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+
#if 0
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- DisplayModePtr mode;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ DisplayModePtr mode;
#endif
pScreen->CreateScreenResources = randrp->CreateScreenResources;
if (!(*pScreen->CreateScreenResources) (pScreen))
- return FALSE;
+ return FALSE;
#if 0
mode = scrp->currentMode;
if (mode)
- xf86RandRSetMode (pScreen, mode, TRUE);
+ xf86RandRSetMode(pScreen, mode, TRUE);
#endif
return TRUE;
@@ -376,10 +365,10 @@ xf86RandRCreateScreenResources (ScreenPtr pScreen)
* Reset size back to original
*/
static Bool
-xf86RandRCloseScreen (int index, ScreenPtr pScreen)
+xf86RandRCloseScreen(int index, ScreenPtr pScreen)
{
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
scrp->virtualX = pScreen->width = randrp->virtualX;
scrp->virtualY = pScreen->height = randrp->virtualY;
@@ -394,7 +383,7 @@ Rotation
xf86GetRotation(ScreenPtr pScreen)
{
if (xf86RandRKey == NULL)
- return RR_Rotate_0;
+ return RR_Rotate_0;
return XF86RANDRINFO(pScreen)->rotation;
}
@@ -402,67 +391,65 @@ xf86GetRotation(ScreenPtr pScreen)
/* Function to change RandR's idea of the virtual screen size */
Bool
xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
- int newvirtX, int newvirtY, int newmmWidth, int newmmHeight,
- Bool resetMode)
+ int newvirtX, int newvirtY, int newmmWidth,
+ int newmmHeight, Bool resetMode)
{
XF86RandRInfoPtr randrp;
if (xf86RandRKey == NULL)
- return FALSE;
+ return FALSE;
randrp = XF86RANDRINFO(pScreen);
if (randrp == NULL)
- return FALSE;
+ return FALSE;
if (newvirtX > 0)
- randrp->virtualX = newvirtX;
+ randrp->virtualX = newvirtX;
if (newvirtY > 0)
- randrp->virtualY = newvirtY;
+ randrp->virtualY = newvirtY;
if (newmmWidth > 0)
- randrp->mmWidth = newmmWidth;
+ randrp->mmWidth = newmmWidth;
if (newmmHeight > 0)
- randrp->mmHeight = newmmHeight;
+ randrp->mmHeight = newmmHeight;
/* This is only for during server start */
if (resetMode) {
- return (xf86RandRSetMode(pScreen,
- XF86SCRNINFO(pScreen)->currentMode,
- TRUE,
- pScreen->mmWidth, pScreen->mmHeight));
+ return (xf86RandRSetMode(pScreen,
+ XF86SCRNINFO(pScreen)->currentMode,
+ TRUE, pScreen->mmWidth, pScreen->mmHeight));
}
return TRUE;
}
Bool
-xf86RandRInit (ScreenPtr pScreen)
+xf86RandRInit(ScreenPtr pScreen)
{
- rrScrPrivPtr rp;
- XF86RandRInfoPtr randrp;
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ rrScrPrivPtr rp;
+ XF86RandRInfoPtr randrp;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
#ifdef PANORAMIX
/* XXX disable RandR when using Xinerama */
if (!noPanoramiXExtension)
- return TRUE;
+ return TRUE;
#endif
xf86RandRKey = &xf86RandRKeyRec;
if (!dixRegisterPrivateKey(&xf86RandRKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
- randrp = malloc(sizeof (XF86RandRInfoRec));
+ randrp = malloc(sizeof(XF86RandRInfoRec));
if (!randrp)
- return FALSE;
+ return FALSE;
- if (!RRScreenInit (pScreen))
- {
- free(randrp);
- return FALSE;
+ if (!RRScreenInit(pScreen)) {
+ free(randrp);
+ return FALSE;
}
rp = rrGetScrPriv(pScreen);
rp->rrGetInfo = xf86RandRGetInfo;
@@ -484,5 +471,3 @@ xf86RandRInit (ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, randrp);
return TRUE;
}
-
-
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
index 819ad6e7c..7c9e6ba02 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
@@ -36,7 +36,6 @@
#include "xf86Priv.h"
#include "pciaccess.h"
-
static GCFuncs VGAarbiterGCFuncs = {
VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC,
VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip,
@@ -60,8 +59,10 @@ static miPointerSpriteFuncRec VGAarbiterSpriteFuncs = {
};
static DevPrivateKeyRec VGAarbiterScreenKeyRec;
+
#define VGAarbiterScreenKey (&VGAarbiterScreenKeyRec)
static DevPrivateKeyRec VGAarbiterGCKeyRec;
+
#define VGAarbiterGCKey (&VGAarbiterGCKeyRec)
static int vga_no_arb = 0;
@@ -69,8 +70,9 @@ void
xf86VGAarbiterInit(void)
{
if (pci_device_vgaarb_init() != 0) {
- vga_no_arb = 1;
- xf86Msg(X_WARNING, "VGA arbiter: cannot open kernel arbiter, no multi-card support\n");
+ vga_no_arb = 1;
+ xf86Msg(X_WARNING,
+ "VGA arbiter: cannot open kernel arbiter, no multi-card support\n");
}
}
@@ -78,7 +80,7 @@ void
xf86VGAarbiterFini(void)
{
if (vga_no_arb)
- return;
+ return;
pci_device_vgaarb_fini();
}
@@ -86,7 +88,7 @@ void
xf86VGAarbiterLock(ScrnInfoPtr pScrn)
{
if (vga_no_arb)
- return;
+ return;
pci_device_vgaarb_set_target(pScrn->vgaDev);
pci_device_vgaarb_lock();
}
@@ -95,18 +97,19 @@ void
xf86VGAarbiterUnlock(ScrnInfoPtr pScrn)
{
if (vga_no_arb)
- return;
+ return;
pci_device_vgaarb_unlock();
}
-Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen)
+Bool
+xf86VGAarbiterAllowDRI(ScreenPtr pScreen)
{
int vga_count;
int rsrc_decodes;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
if (vga_no_arb)
- return TRUE;
+ return TRUE;
pci_device_vgaarb_get_info(pScrn->vgaDev, &vga_count, &rsrc_decodes);
if (vga_count > 1) {
@@ -124,11 +127,11 @@ xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn)
EntityPtr pEnt;
if (vga_no_arb)
- return;
+ return;
pEnt = xf86Entities[pScrn->entityList[0]];
if (pEnt->bus.type != BUS_PCI)
- return;
+ return;
dev = pEnt->bus.id.pci;
pScrn->vgaDev = dev;
@@ -138,7 +141,7 @@ void
xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn, int rsrc)
{
if (vga_no_arb)
- return;
+ return;
pci_device_vgaarb_set_target(pScrn->vgaDev);
pci_device_vgaarb_decodes(rsrc);
}
@@ -149,7 +152,7 @@ xf86VGAarbiterWrapFunctions(void)
ScrnInfoPtr pScrn;
VGAarbiterScreenPtr pScreenPriv;
miPointerScreenPtr PointPriv;
- PictureScreenPtr ps;
+ PictureScreenPtr ps;
ScreenPtr pScreen;
int vga_count, i;
@@ -164,7 +167,7 @@ xf86VGAarbiterWrapFunctions(void)
if (vga_count < 2 || !xf86Screens)
return FALSE;
- xf86Msg(X_INFO,"Found %d VGA devices: arbiter wrapping enabled\n",
+ xf86Msg(X_INFO, "Found %d VGA devices: arbiter wrapping enabled\n",
vga_count);
for (i = 0; i < xf86NumScreens; i++) {
@@ -173,11 +176,12 @@ xf86VGAarbiterWrapFunctions(void)
pScrn = xf86Screens[pScreen->myNum];
PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
- if (!dixRegisterPrivateKey(&VGAarbiterGCKeyRec, PRIVATE_GC, sizeof(VGAarbiterGCRec)))
+ if (!dixRegisterPrivateKey
+ (&VGAarbiterGCKeyRec, PRIVATE_GC, sizeof(VGAarbiterGCRec)))
return FALSE;
- if (!dixRegisterPrivateKey(&VGAarbiterScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ if (!dixRegisterPrivateKey(&VGAarbiterScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
if (!(pScreenPriv = malloc(sizeof(VGAarbiterScreenRec))))
return FALSE;
@@ -201,9 +205,9 @@ xf86VGAarbiterWrapFunctions(void)
WRAP_SCREEN(UnrealizeCursor, VGAarbiterUnrealizeCursor);
WRAP_SCREEN(RecolorCursor, VGAarbiterRecolorCursor);
WRAP_SCREEN(SetCursorPosition, VGAarbiterSetCursorPosition);
- WRAP_PICT(Composite,VGAarbiterComposite);
- WRAP_PICT(Glyphs,VGAarbiterGlyphs);
- WRAP_PICT(CompositeRects,VGAarbiterCompositeRects);
+ WRAP_PICT(Composite, VGAarbiterComposite);
+ WRAP_PICT(Glyphs, VGAarbiterGlyphs);
+ WRAP_PICT(CompositeRects, VGAarbiterCompositeRects);
WRAP_SCREEN_INFO(AdjustFrame, VGAarbiterAdjustFrame);
WRAP_SCREEN_INFO(SwitchMode, VGAarbiterSwitchMode);
WRAP_SCREEN_INFO(EnterVT, VGAarbiterEnterVT);
@@ -217,15 +221,17 @@ xf86VGAarbiterWrapFunctions(void)
/* Screen funcs */
static Bool
-VGAarbiterCloseScreen (int i, ScreenPtr pScreen)
+VGAarbiterCloseScreen(int i, ScreenPtr pScreen)
{
Bool val;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
- miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, miPointerScreenKey);
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ VGAarbiterScreenPtr pScreenPriv =
+ (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ VGAarbiterScreenKey);
+ miPointerScreenPtr PointPriv =
+ (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ miPointerScreenKey);
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
UNWRAP_SCREEN(CreateGC);
UNWRAP_SCREEN(CloseScreen);
@@ -263,6 +269,7 @@ VGAarbiterBlockHandler(int i,
pointer blockData, pointer pTimeout, pointer pReadmask)
{
ScreenPtr pScreen = screenInfo.screens[i];
+
SCREEN_PROLOG(BlockHandler);
VGAGet(pScreen);
pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
@@ -271,9 +278,11 @@ VGAarbiterBlockHandler(int i,
}
static void
-VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask)
+VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result,
+ pointer pReadmask)
{
ScreenPtr pScreen = screenInfo.screens[i];
+
SCREEN_PROLOG(WakeupHandler);
VGAGet(pScreen);
pScreen->WakeupHandler(i, blockData, result, pReadmask);
@@ -282,100 +291,87 @@ VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer
}
static void
-VGAarbiterGetImage (
- DrawablePtr pDrawable,
- int sx, int sy, int w, int h,
- unsigned int format,
- unsigned long planemask,
- char *pdstLine
- )
+VGAarbiterGetImage(DrawablePtr pDrawable,
+ int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planemask, char *pdstLine)
{
ScreenPtr pScreen = pDrawable->pScreen;
+
SCREEN_PROLOG(GetImage);
// if (xf86Screens[pScreen->myNum]->vtSema) {
VGAGet(pScreen);
// }
- (*pScreen->GetImage) (pDrawable, sx, sy, w, h,
- format, planemask, pdstLine);
+ (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine);
VGAPut();
- SCREEN_EPILOG (GetImage, VGAarbiterGetImage);
+ SCREEN_EPILOG(GetImage, VGAarbiterGetImage);
}
static void
-VGAarbiterGetSpans (
- DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pdstStart
- )
-{
- ScreenPtr pScreen = pDrawable->pScreen;
-
- SCREEN_PROLOG (GetSpans);
+VGAarbiterGetSpans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ SCREEN_PROLOG(GetSpans);
VGAGet(pScreen);
(*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
VGAPut();
- SCREEN_EPILOG (GetSpans, VGAarbiterGetSpans);
+ SCREEN_EPILOG(GetSpans, VGAarbiterGetSpans);
}
static void
-VGAarbiterSourceValidate (
- DrawablePtr pDrawable,
- int x, int y, int width, int height,
- unsigned int subWindowMode )
+VGAarbiterSourceValidate(DrawablePtr pDrawable,
+ int x, int y, int width, int height,
+ unsigned int subWindowMode)
{
- ScreenPtr pScreen = pDrawable->pScreen;
- SCREEN_PROLOG (SourceValidate);
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ SCREEN_PROLOG(SourceValidate);
VGAGet(pScreen);
if (pScreen->SourceValidate)
- (*pScreen->SourceValidate) (pDrawable, x, y, width, height, subWindowMode);
+ (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
+ subWindowMode);
VGAPut();
- SCREEN_EPILOG (SourceValidate, VGAarbiterSourceValidate);
+ SCREEN_EPILOG(SourceValidate, VGAarbiterSourceValidate);
}
static void
-VGAarbiterCopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc )
+VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- SCREEN_PROLOG (CopyWindow);
+ SCREEN_PROLOG(CopyWindow);
VGAGet(pScreen);
(*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
VGAPut();
- SCREEN_EPILOG (CopyWindow, VGAarbiterCopyWindow);
+ SCREEN_EPILOG(CopyWindow, VGAarbiterCopyWindow);
}
static void
-VGAarbiterClearToBackground (
- WindowPtr pWin,
- int x, int y,
- int w, int h,
- Bool generateExposures )
+VGAarbiterClearToBackground(WindowPtr pWin,
+ int x, int y, int w, int h, Bool generateExposures)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- SCREEN_PROLOG ( ClearToBackground);
+ SCREEN_PROLOG(ClearToBackground);
VGAGet(pScreen);
(*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures);
VGAPut();
- SCREEN_EPILOG (ClearToBackground, VGAarbiterClearToBackground);
+ SCREEN_EPILOG(ClearToBackground, VGAarbiterClearToBackground);
}
static PixmapPtr
-VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
+ unsigned usage_hint)
{
PixmapPtr pPix;
- SCREEN_PROLOG ( CreatePixmap);
+ SCREEN_PROLOG(CreatePixmap);
VGAGet(pScreen);
pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
VGAPut();
- SCREEN_EPILOG (CreatePixmap, VGAarbiterCreatePixmap);
+ SCREEN_EPILOG(CreatePixmap, VGAarbiterCreatePixmap);
return pPix;
}
@@ -385,110 +381,89 @@ VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank)
{
Bool val;
- SCREEN_PROLOG (SaveScreen);
+ SCREEN_PROLOG(SaveScreen);
VGAGet(pScreen);
val = (*pScreen->SaveScreen) (pScreen, unblank);
VGAPut();
- SCREEN_EPILOG (SaveScreen, VGAarbiterSaveScreen);
+ SCREEN_EPILOG(SaveScreen, VGAarbiterSaveScreen);
return val;
}
static void
-VGAarbiterStoreColors (
- ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs)
+VGAarbiterStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs)
{
ScreenPtr pScreen = pmap->pScreen;
- SCREEN_PROLOG (StoreColors);
+ SCREEN_PROLOG(StoreColors);
VGAGet(pScreen);
- (*pScreen->StoreColors) (pmap,ndef,pdefs);
+ (*pScreen->StoreColors) (pmap, ndef, pdefs);
VGAPut();
- SCREEN_EPILOG ( StoreColors, VGAarbiterStoreColors);
+ SCREEN_EPILOG(StoreColors, VGAarbiterStoreColors);
}
static void
-VGAarbiterRecolorCursor (
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCurs,
- Bool displayed
- )
-{
- SCREEN_PROLOG (RecolorCursor);
+VGAarbiterRecolorCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
+{
+ SCREEN_PROLOG(RecolorCursor);
VGAGet(pScreen);
(*pScreen->RecolorCursor) (pDev, pScreen, pCurs, displayed);
VGAPut();
- SCREEN_EPILOG ( RecolorCursor, VGAarbiterRecolorCursor);
+ SCREEN_EPILOG(RecolorCursor, VGAarbiterRecolorCursor);
}
static Bool
-VGAarbiterRealizeCursor (
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor
- )
+VGAarbiterRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
Bool val;
- SCREEN_PROLOG (RealizeCursor);
+ SCREEN_PROLOG(RealizeCursor);
VGAGet(pScreen);
- val = (*pScreen->RealizeCursor) (pDev, pScreen,pCursor);
+ val = (*pScreen->RealizeCursor) (pDev, pScreen, pCursor);
VGAPut();
- SCREEN_EPILOG ( RealizeCursor, VGAarbiterRealizeCursor);
+ SCREEN_EPILOG(RealizeCursor, VGAarbiterRealizeCursor);
return val;
}
static Bool
-VGAarbiterUnrealizeCursor (
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor
- )
+VGAarbiterUnrealizeCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen, CursorPtr pCursor)
{
Bool val;
- SCREEN_PROLOG (UnrealizeCursor);
+ SCREEN_PROLOG(UnrealizeCursor);
VGAGet(pScreen);
val = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor);
VGAPut();
- SCREEN_EPILOG ( UnrealizeCursor, VGAarbiterUnrealizeCursor);
+ SCREEN_EPILOG(UnrealizeCursor, VGAarbiterUnrealizeCursor);
return val;
}
static Bool
-VGAarbiterDisplayCursor (
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor
- )
+VGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
Bool val;
- SCREEN_PROLOG (DisplayCursor);
+ SCREEN_PROLOG(DisplayCursor);
VGAGet(pScreen);
val = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
VGAPut();
- SCREEN_EPILOG ( DisplayCursor, VGAarbiterDisplayCursor);
+ SCREEN_EPILOG(DisplayCursor, VGAarbiterDisplayCursor);
return val;
}
static Bool
-VGAarbiterSetCursorPosition (
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- int x, int y,
- Bool generateEvent)
+VGAarbiterSetCursorPosition(DeviceIntPtr pDev,
+ ScreenPtr pScreen, int x, int y, Bool generateEvent)
{
Bool val;
- SCREEN_PROLOG (SetCursorPosition);
+ SCREEN_PROLOG(SetCursorPosition);
VGAGet(pScreen);
val = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
VGAPut();
- SCREEN_EPILOG ( SetCursorPosition, VGAarbiterSetCursorPosition);
+ SCREEN_EPILOG(SetCursorPosition, VGAarbiterSetCursorPosition);
return val;
}
@@ -496,11 +471,12 @@ static void
VGAarbiterAdjustFrame(int index, int x, int y, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
+ VGAarbiterScreenPtr pScreenPriv =
+ (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ VGAarbiterScreenKey);
VGAGet(pScreen);
- (*pScreenPriv->AdjustFrame)(index, x, y, flags);
+ (*pScreenPriv->AdjustFrame) (index, x, y, flags);
VGAPut();
}
@@ -509,11 +485,12 @@ VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags)
{
Bool val;
ScreenPtr pScreen = screenInfo.screens[index];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
+ VGAarbiterScreenPtr pScreenPriv =
+ (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ VGAarbiterScreenKey);
VGAGet(pScreen);
- val = (*pScreenPriv->SwitchMode)(index, mode, flags);
+ val = (*pScreenPriv->SwitchMode) (index, mode, flags);
VGAPut();
return val;
}
@@ -524,12 +501,13 @@ VGAarbiterEnterVT(int index, int flags)
Bool val;
ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = screenInfo.screens[index];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
+ VGAarbiterScreenPtr pScreenPriv =
+ (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ VGAarbiterScreenKey);
VGAGet(pScreen);
pScrn->EnterVT = pScreenPriv->EnterVT;
- val = (*pScrn->EnterVT)(index, flags);
+ val = (*pScrn->EnterVT) (index, flags);
pScreenPriv->EnterVT = pScrn->EnterVT;
pScrn->EnterVT = VGAarbiterEnterVT;
VGAPut();
@@ -541,12 +519,13 @@ VGAarbiterLeaveVT(int index, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = screenInfo.screens[index];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
+ VGAarbiterScreenPtr pScreenPriv =
+ (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ VGAarbiterScreenKey);
VGAGet(pScreen);
pScrn->LeaveVT = pScreenPriv->LeaveVT;
- (*pScreenPriv->LeaveVT)(index, flags);
+ (*pScreenPriv->LeaveVT) (index, flags);
pScreenPriv->LeaveVT = pScrn->LeaveVT;
pScrn->LeaveVT = VGAarbiterLeaveVT;
VGAPut();
@@ -556,450 +535,389 @@ static void
VGAarbiterFreeScreen(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
+ VGAarbiterScreenPtr pScreenPriv =
+ (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ VGAarbiterScreenKey);
VGAGet(pScreen);
- (*pScreenPriv->FreeScreen)(index, flags);
+ (*pScreenPriv->FreeScreen) (index, flags);
VGAPut();
}
static Bool
VGAarbiterCreateGC(GCPtr pGC)
{
- ScreenPtr pScreen = pGC->pScreen;
- VGAarbiterGCPtr pGCPriv = (VGAarbiterGCPtr)dixLookupPrivate(&pGC->devPrivates, VGAarbiterGCKey);
- Bool ret;
+ ScreenPtr pScreen = pGC->pScreen;
+ VGAarbiterGCPtr pGCPriv =
+ (VGAarbiterGCPtr) dixLookupPrivate(&pGC->devPrivates, VGAarbiterGCKey);
+ Bool ret;
SCREEN_PROLOG(CreateGC);
- ret = (*pScreen->CreateGC)(pGC);
+ ret = (*pScreen->CreateGC) (pGC);
GC_WRAP(pGC);
- SCREEN_EPILOG(CreateGC,VGAarbiterCreateGC);
+ SCREEN_EPILOG(CreateGC, VGAarbiterCreateGC);
return ret;
}
/* GC funcs */
static void
-VGAarbiterValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw )
+VGAarbiterValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
GC_UNWRAP(pGC);
- (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+ (*pGC->funcs->ValidateGC) (pGC, changes, pDraw);
GC_WRAP(pGC);
}
-
static void
VGAarbiterDestroyGC(GCPtr pGC)
{
- GC_UNWRAP (pGC);
- (*pGC->funcs->DestroyGC)(pGC);
- GC_WRAP (pGC);
+ GC_UNWRAP(pGC);
+ (*pGC->funcs->DestroyGC) (pGC);
+ GC_WRAP(pGC);
}
static void
-VGAarbiterChangeGC (
- GCPtr pGC,
- unsigned long mask)
+VGAarbiterChangeGC(GCPtr pGC, unsigned long mask)
{
- GC_UNWRAP (pGC);
+ GC_UNWRAP(pGC);
(*pGC->funcs->ChangeGC) (pGC, mask);
- GC_WRAP (pGC);
+ GC_WRAP(pGC);
}
static void
-VGAarbiterCopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst)
+VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
{
- GC_UNWRAP (pGCDst);
+ GC_UNWRAP(pGCDst);
(*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- GC_WRAP (pGCDst);
+ GC_WRAP(pGCDst);
}
static void
-VGAarbiterChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects )
+VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
{
- GC_UNWRAP (pGC);
+ GC_UNWRAP(pGC);
(*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- GC_WRAP (pGC);
+ GC_WRAP(pGC);
}
static void
VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
{
- GC_UNWRAP (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- GC_WRAP (pgcDst);
+ GC_UNWRAP(pgcDst);
+ (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
+ GC_WRAP(pgcDst);
}
static void
VGAarbiterDestroyClip(GCPtr pGC)
{
- GC_UNWRAP (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- GC_WRAP (pGC);
+ GC_UNWRAP(pGC);
+ (*pGC->funcs->DestroyClip) (pGC);
+ GC_WRAP(pGC);
}
/* GC Ops */
static void
-VGAarbiterFillSpans(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted )
+VGAarbiterFillSpans(DrawablePtr pDraw,
+ GC * pGC,
+ int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+ (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterSetSpans(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- register DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted )
+VGAarbiterSetSpans(DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth, int nspans, int fSorted)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage )
+VGAarbiterPutImage(DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad, int format, char *pImage)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
+ (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
VGAPut();
GC_WRAP(pGC);
}
static RegionPtr
-VGAarbiterCopyArea(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty )
+VGAarbiterCopyArea(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC * pGC,
+ int srcx, int srcy,
+ int width, int height, int dstx, int dsty)
{
RegionPtr ret;
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
+ ret = (*pGC->ops->CopyArea) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
VGAPut();
GC_WRAP(pGC);
return ret;
}
static RegionPtr
-VGAarbiterCopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane )
+VGAarbiterCopyPlane(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
{
RegionPtr ret;
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy,
- width, height, dstx, dsty, bitPlane);
+ ret = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty, bitPlane);
VGAPut();
GC_WRAP(pGC);
return ret;
}
static void
-VGAarbiterPolyPoint(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit )
+VGAarbiterPolyPoint(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int npt, xPoint * pptInit)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
+ (*pGC->ops->PolyPoint) (pDraw, pGC, mode, npt, pptInit);
VGAPut();
GC_WRAP(pGC);
}
-
static void
-VGAarbiterPolylines(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit )
+VGAarbiterPolylines(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
+ (*pGC->ops->Polylines) (pDraw, pGC, mode, npt, pptInit);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterPolySegment(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg )
+VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSeg)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
+ (*pGC->ops->PolySegment) (pDraw, pGC, nseg, pSeg);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterPolyRectangle(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit )
+VGAarbiterPolyRectangle(DrawablePtr pDraw,
+ GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+ (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterPolyArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs )
+VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
+ (*pGC->ops->PolyArc) (pDraw, pGC, narcs, parcs);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterFillPolygon(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn )
+VGAarbiterFillPolygon(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit)
+VGAarbiterPolyFillRect(DrawablePtr pDraw,
+ GCPtr pGC, int nrectFill, xRectangle *prectInit)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, nrectFill, prectInit);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterPolyFillArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs )
+VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
+ (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, parcs);
VGAPut();
GC_WRAP(pGC);
}
static int
-VGAarbiterPolyText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars )
+VGAarbiterPolyText8(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
{
int ret;
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+ ret = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars);
VGAPut();
GC_WRAP(pGC);
return ret;
}
static int
-VGAarbiterPolyText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars )
+VGAarbiterPolyText16(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
{
int ret;
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+ ret = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars);
VGAPut();
GC_WRAP(pGC);
return ret;
}
static void
-VGAarbiterImageText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars )
+VGAarbiterImageText8(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+ (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterImageText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars )
+VGAarbiterImageText16(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+ (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars);
VGAPut();
GC_WRAP(pGC);
}
-
static void
-VGAarbiterImageGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase )
+VGAarbiterImageGlyphBlt(DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit,
- nglyph, ppci, pglyphBase);
+ (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, xInit, yInit,
+ nglyph, ppci, pglyphBase);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterPolyGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase )
+VGAarbiterPolyGlyphBlt(DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit,
- nglyph, ppci, pglyphBase);
+ (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, xInit, yInit,
+ nglyph, ppci, pglyphBase);
VGAPut();
GC_WRAP(pGC);
}
static void
-VGAarbiterPushPixels(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg )
+VGAarbiterPushPixels(GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg)
{
ScreenPtr pScreen = pGC->pScreen;
+
GC_UNWRAP(pGC);
VGAGet(pScreen);
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
VGAPut();
GC_WRAP(pGC);
}
-
/* miSpriteFuncs */
static Bool
-VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur)
+VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCur)
{
Bool val;
+
SPRITE_PROLOG;
VGAGet(pScreen);
val = PointPriv->spriteFuncs->RealizeCursor(pDev, pScreen, pCur);
@@ -1009,9 +927,11 @@ VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pC
}
static Bool
-VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur)
+VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCur)
{
Bool val;
+
SPRITE_PROLOG;
VGAGet(pScreen);
val = PointPriv->spriteFuncs->UnrealizeCursor(pDev, pScreen, pCur);
@@ -1021,7 +941,8 @@ VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr
}
static void
-VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur, int x, int y)
+VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur,
+ int x, int y)
{
SPRITE_PROLOG;
VGAGet(pScreen);
@@ -1044,6 +965,7 @@ static Bool
VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
Bool val;
+
SPRITE_PROLOG;
VGAGet(pScreen);
val = PointPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen);
@@ -1064,49 +986,49 @@ VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
static void
VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
- PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask,
- INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width,
- CARD16 height)
+ PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width,
+ CARD16 height)
{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
PICTURE_PROLOGUE(Composite);
VGAGet(pScreen);
(*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst,
- yDst, width, height);
+ yDst, width, height);
VGAPut();
PICTURE_EPILOGUE(Composite, VGAarbiterComposite);
}
static void
VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
- GlyphListPtr list, GlyphPtr *glyphs)
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
+ GlyphListPtr list, GlyphPtr * glyphs)
{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
PICTURE_PROLOGUE(Glyphs);
VGAGet(pScreen);
- (*ps->Glyphs)(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
+ (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
VGAPut();
- PICTURE_EPILOGUE (Glyphs, VGAarbiterGlyphs);
+ PICTURE_EPILOGUE(Glyphs, VGAarbiterGlyphs);
}
static void
-VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect,
- xRectangle *rects)
+VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor * color,
+ int nRect, xRectangle *rects)
{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
PICTURE_PROLOGUE(CompositeRects);
VGAGet(pScreen);
- (*ps->CompositeRects)(op, pDst, color, nRect, rects);
+ (*ps->CompositeRects) (op, pDst, color, nRect, rects);
VGAPut();
- PICTURE_EPILOGUE (CompositeRects, VGAarbiterCompositeRects);
+ PICTURE_EPILOGUE(CompositeRects, VGAarbiterCompositeRects);
}
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
index 13fde5e79..2513ce65d 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -1,253 +1,268 @@
-/*
- * Copyright (c) 2009 Tiago Vignatti
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include <X11/X.h>
-#include "colormapst.h"
-#include "scrnintstr.h"
-#include "screenint.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "pixmap.h"
-#include "windowstr.h"
-#include "window.h"
-#include "xf86str.h"
-#include "mipointer.h"
-#include "mipointrst.h"
-# include "picturestr.h"
-
-
-#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;}
-
-#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
-
-#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x
-
-#define SCREEN_EPILOG(x,y) pScreen->x = y;
-
-#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\
- ps->x = y;}
-
-#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;}
-
-#define PICTURE_PROLOGUE(field) ps->field = \
- ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
- VGAarbiterScreenKey))->field
-
-#define PICTURE_EPILOGUE(field, wrap) ps->field = wrap
-
-#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0)
-
-#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
-
-#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \
- (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, \
- miPointerScreenKey); VGAarbiterScreenPtr pScreenPriv = \
- ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
- VGAarbiterScreenKey)); PointPriv->spriteFuncs = pScreenPriv->miSprite;
-
-#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
- PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs;
-
-#define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\
- PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \
- } while (0)
-
-#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite
-
-#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\
- pGCPriv->wrapFuncs = (x)->funcs; (x)->ops = &VGAarbiterGCOps;\
- (x)->funcs = &VGAarbiterGCFuncs;
-
-#define GC_UNWRAP(x) VGAarbiterGCPtr pGCPriv = \
- (VGAarbiterGCPtr)dixLookupPrivate(&(x)->devPrivates, VGAarbiterGCKey);\
- (x)->ops = pGCPriv->wrapOps; (x)->funcs = pGCPriv->wrapFuncs;
-
-static inline void
-VGAGet(ScreenPtr pScreen) {
- pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev);
- pci_device_vgaarb_lock();
-}
-
-static inline void
-VGAPut(void) {
- pci_device_vgaarb_unlock();
-}
-
-typedef struct _VGAarbiterScreen {
- CreateGCProcPtr CreateGC;
- CloseScreenProcPtr CloseScreen;
- ScreenBlockHandlerProcPtr BlockHandler;
- ScreenWakeupHandlerProcPtr WakeupHandler;
- GetImageProcPtr GetImage;
- GetSpansProcPtr GetSpans;
- SourceValidateProcPtr SourceValidate;
- CopyWindowProcPtr CopyWindow;
- ClearToBackgroundProcPtr ClearToBackground;
- CreatePixmapProcPtr CreatePixmap;
- SaveScreenProcPtr SaveScreen;
- /* Colormap */
- StoreColorsProcPtr StoreColors;
- /* Cursor */
- DisplayCursorProcPtr DisplayCursor;
- RealizeCursorProcPtr RealizeCursor;
- UnrealizeCursorProcPtr UnrealizeCursor;
- RecolorCursorProcPtr RecolorCursor;
- SetCursorPositionProcPtr SetCursorPosition;
- void (*AdjustFrame)(int,int,int,int);
- Bool (*SwitchMode)(int, DisplayModePtr,int);
- Bool (*EnterVT)(int, int);
- void (*LeaveVT)(int, int);
- void (*FreeScreen)(int, int);
- miPointerSpriteFuncPtr miSprite;
- CompositeProcPtr Composite;
- GlyphsProcPtr Glyphs;
- CompositeRectsProcPtr CompositeRects;
-} VGAarbiterScreenRec, *VGAarbiterScreenPtr;
-
-typedef struct _VGAarbiterGC {
- GCOps *wrapOps;
- GCFuncs *wrapFuncs;
-} VGAarbiterGCRec, *VGAarbiterGCPtr;
-
-/* Screen funcs */
-static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask);
-static void VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask);
-static Bool VGAarbiterCloseScreen (int i, ScreenPtr pScreen);
-static void VGAarbiterGetImage (DrawablePtr pDrawable, int sx, int sy, int w,
- int h, unsigned int format, unsigned long planemask, char *pdstLine);
-static void VGAarbiterGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr
- ppt, int *pwidth, int nspans, char *pdstStart);
-static void VGAarbiterSourceValidate (DrawablePtr pDrawable, int x, int y,
- int width, int height, unsigned int subWindowMode);
-static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-static void VGAarbiterClearToBackground (WindowPtr pWin, int x, int y, int w,
- int h, Bool generateExposures);
-static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h,
- int depth, unsigned int usage_hint);
-static Bool VGAarbiterCreateGC(GCPtr pGC);
-static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank);
-static void VGAarbiterStoreColors (ColormapPtr pmap, int ndef, xColorItem
- *pdefs);
-static void VGAarbiterRecolorCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
- CursorPtr pCurs, Bool displayed);
-static Bool VGAarbiterRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
- CursorPtr pCursor);
-static Bool VGAarbiterUnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
- CursorPtr pCursor);
-static Bool VGAarbiterDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
- CursorPtr pCursor);
-static Bool VGAarbiterSetCursorPosition (DeviceIntPtr pDev, ScreenPtr
- pScreen, int x, int y, Bool generateEvent);
-static void VGAarbiterAdjustFrame(int index, int x, int y, int flags);
-static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags);
-static Bool VGAarbiterEnterVT(int index, int flags);
-static void VGAarbiterLeaveVT(int index, int flags);
-static void VGAarbiterFreeScreen(int index, int flags);
-
-/* GC funcs */
-static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw);
-static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask);
-static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
-static void VGAarbiterDestroyGC(GCPtr pGC);
-static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue,
- int nrects);
-static void VGAarbiterDestroyClip(GCPtr pGC);
-static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
-
-/* GC ops */
-static void VGAarbiterFillSpans( DrawablePtr pDraw, GC *pGC, int nInit,
- DDXPointPtr pptInit, int *pwidthInit, int fSorted);
-static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc,
- register DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
-static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth,
- int x, int y, int w, int h, int leftPad, int format, char *pImage);
-static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
- GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty);
-static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
- GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty,
- unsigned long bitPlane);
-static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode,
- int npt, xPoint *pptInit);
-static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode,
- int npt, DDXPointPtr pptInit);
-static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg,
- xSegment *pSeg);
-static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC,
- int nRectsInit, xRectangle *pRectsInit);
-static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
- xArc *parcs);
-static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn);
-static void VGAarbiterPolyFillRect( DrawablePtr pDraw, GCPtr pGC,
- int nrectFill, xRectangle *prectInit);
-static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
- xArc *parcs);
-static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars);
-static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
-static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars);
-static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
-static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase);
-static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase);
-static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr
- pDraw, int dx, int dy, int xOrg, int yOrg);
-
-/* miSpriteFuncs */
-static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr
- pScreen, CursorPtr pCur);
-static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr
- pScreen, CursorPtr pCur);
-static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
- CursorPtr pCur, int x, int y);
-static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
- int x, int y);
-static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
-static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
-
-
-static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
- PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
-static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr
- list, GlyphPtr *glyphs);
-static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor
- *color, int nRect, xRectangle *rects);
+/*
+ * Copyright (c) 2009 Tiago Vignatti
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include <X11/X.h>
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "screenint.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "pixmap.h"
+#include "windowstr.h"
+#include "window.h"
+#include "xf86str.h"
+#include "mipointer.h"
+#include "mipointrst.h"
+#include "picturestr.h"
+
+#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;}
+
+#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
+
+#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x
+
+#define SCREEN_EPILOG(x,y) pScreen->x = y;
+
+#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\
+ ps->x = y;}
+
+#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;}
+
+#define PICTURE_PROLOGUE(field) ps->field = \
+ ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
+ VGAarbiterScreenKey))->field
+
+#define PICTURE_EPILOGUE(field, wrap) ps->field = wrap
+
+#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0)
+
+#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
+
+#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \
+ (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, \
+ miPointerScreenKey); VGAarbiterScreenPtr pScreenPriv = \
+ ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
+ VGAarbiterScreenKey)); PointPriv->spriteFuncs = pScreenPriv->miSprite;
+
+#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
+ PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs;
+
+#define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\
+ PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \
+ } while (0)
+
+#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite
+
+#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\
+ pGCPriv->wrapFuncs = (x)->funcs; (x)->ops = &VGAarbiterGCOps;\
+ (x)->funcs = &VGAarbiterGCFuncs;
+
+#define GC_UNWRAP(x) VGAarbiterGCPtr pGCPriv = \
+ (VGAarbiterGCPtr)dixLookupPrivate(&(x)->devPrivates, VGAarbiterGCKey);\
+ (x)->ops = pGCPriv->wrapOps; (x)->funcs = pGCPriv->wrapFuncs;
+
+static inline void
+VGAGet(ScreenPtr pScreen)
+{
+ pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev);
+ pci_device_vgaarb_lock();
+}
+
+static inline void
+VGAPut(void)
+{
+ pci_device_vgaarb_unlock();
+}
+
+typedef struct _VGAarbiterScreen {
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
+ ScreenBlockHandlerProcPtr BlockHandler;
+ ScreenWakeupHandlerProcPtr WakeupHandler;
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ SourceValidateProcPtr SourceValidate;
+ CopyWindowProcPtr CopyWindow;
+ ClearToBackgroundProcPtr ClearToBackground;
+ CreatePixmapProcPtr CreatePixmap;
+ SaveScreenProcPtr SaveScreen;
+ /* Colormap */
+ StoreColorsProcPtr StoreColors;
+ /* Cursor */
+ DisplayCursorProcPtr DisplayCursor;
+ RealizeCursorProcPtr RealizeCursor;
+ UnrealizeCursorProcPtr UnrealizeCursor;
+ RecolorCursorProcPtr RecolorCursor;
+ SetCursorPositionProcPtr SetCursorPosition;
+ void (*AdjustFrame) (int, int, int, int);
+ Bool (*SwitchMode) (int, DisplayModePtr, int);
+ Bool (*EnterVT) (int, int);
+ void (*LeaveVT) (int, int);
+ void (*FreeScreen) (int, int);
+ miPointerSpriteFuncPtr miSprite;
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+ CompositeRectsProcPtr CompositeRects;
+} VGAarbiterScreenRec, *VGAarbiterScreenPtr;
+
+typedef struct _VGAarbiterGC {
+ GCOps *wrapOps;
+ GCFuncs *wrapFuncs;
+} VGAarbiterGCRec, *VGAarbiterGCPtr;
+
+/* Screen funcs */
+static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout,
+ pointer pReadmask);
+static void VGAarbiterWakeupHandler(int i, pointer blockData,
+ unsigned long result, pointer pReadmask);
+static Bool VGAarbiterCloseScreen(int i, ScreenPtr pScreen);
+static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w,
+ int h, unsigned int format,
+ unsigned long planemask, char *pdstLine);
+static void VGAarbiterGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart);
+static void VGAarbiterSourceValidate(DrawablePtr pDrawable, int x, int y,
+ int width, int height,
+ unsigned int subWindowMode);
+static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+static void VGAarbiterClearToBackground(WindowPtr pWin, int x, int y, int w,
+ int h, Bool generateExposures);
+static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h,
+ int depth, unsigned int usage_hint);
+static Bool VGAarbiterCreateGC(GCPtr pGC);
+static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank);
+static void VGAarbiterStoreColors(ColormapPtr pmap, int ndef, xColorItem
+ * pdefs);
+static void VGAarbiterRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCurs, Bool displayed);
+static Bool VGAarbiterRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static Bool VGAarbiterUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static Bool VGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr
+ pScreen, int x, int y,
+ Bool generateEvent);
+static void VGAarbiterAdjustFrame(int index, int x, int y, int flags);
+static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags);
+static Bool VGAarbiterEnterVT(int index, int flags);
+static void VGAarbiterLeaveVT(int index, int flags);
+static void VGAarbiterFreeScreen(int index, int flags);
+
+/* GC funcs */
+static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw);
+static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask);
+static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void VGAarbiterDestroyGC(GCPtr pGC);
+static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue,
+ int nrects);
+static void VGAarbiterDestroyClip(GCPtr pGC);
+static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+
+/* GC ops */
+static void VGAarbiterFillSpans(DrawablePtr pDraw, GC * pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit,
+ int fSorted);
+static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc,
+ register DDXPointPtr ppt, int *pwidth,
+ int nspans, int fSorted);
+static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x,
+ int y, int w, int h, int leftPad, int format,
+ char *pImage);
+static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
+ GC * pGC, int srcx, int srcy, int width,
+ int height, int dstx, int dsty);
+static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int width,
+ int height, int dstx, int dsty,
+ unsigned long bitPlane);
+static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode, int npt,
+ xPoint * pptInit);
+static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt,
+ DDXPointPtr pptInit);
+static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg,
+ xSegment * pSeg);
+static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit);
+static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc * parcs);
+static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+static void VGAarbiterPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit);
+static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc * parcs);
+static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars);
+static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars);
+static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr
+ pDraw, int dx, int dy, int xOrg, int yOrg);
+
+/* miSpriteFuncs */
+static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr
+ pScreen, CursorPtr pCur);
+static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr
+ pScreen, CursorPtr pCur);
+static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCur, int x, int y);
+static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y);
+static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev,
+ ScreenPtr pScreen);
+static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
+
+static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
+ PicturePtr pDst, INT16 xSrc, INT16 ySrc,
+ INT16 xMask, INT16 yMask, INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height);
+static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
+ int nlist, GlyphListPtr list, GlyphPtr * glyphs);
+static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst,
+ xRenderColor * color, int nRect,
+ xRectangle *rects);
diff --git a/xorg-server/hw/xfree86/common/xf86VidMode.c b/xorg-server/hw/xfree86/common/xf86VidMode.c
index 2ae5484e3..13ffe061c 100644
--- a/xorg-server/hw/xfree86/common/xf86VidMode.c
+++ b/xorg-server/hw/xfree86/common/xf86VidMode.c
@@ -61,20 +61,20 @@ VidModeExtensionInit(ScreenPtr pScreen)
{
#ifdef XF86VIDMODE
VidModePtr pVidMode;
-
+
if (!xf86GetVidModeEnabled()) {
- DebugF("!xf86GetVidModeEnabled()\n");
- return FALSE;
+ DebugF("!xf86GetVidModeEnabled()\n");
+ return FALSE;
}
VidModeKey = &VidModeKeyRec;
if (!dixRegisterPrivateKey(&VidModeKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
pVidMode = calloc(sizeof(VidModeRec), 1);
if (!pVidMode)
- return FALSE;
+ return FALSE;
dixSetPrivate(&pScreen->devPrivates, VidModeKey, pVidMode);
@@ -90,7 +90,6 @@ VidModeExtensionInit(ScreenPtr pScreen)
#endif
}
-
#ifdef XF86VIDMODE
static Bool
@@ -100,14 +99,14 @@ VidModeClose(int i, ScreenPtr pScreen)
/* This shouldn't happen */
if (!pVidMode)
- return FALSE;
+ return FALSE;
pScreen->CloseScreen = pVidMode->CloseScreen;
if (--VidModeCount == 0) {
- free(dixLookupPrivate(&pScreen->devPrivates, VidModeKey));
- dixSetPrivate(&pScreen->devPrivates, VidModeKey, NULL);
- VidModeKey = NULL;
+ free(dixLookupPrivate(&pScreen->devPrivates, VidModeKey));
+ dixSetPrivate(&pScreen->devPrivates, VidModeKey, NULL);
+ VidModeKey = NULL;
}
return pScreen->CloseScreen(i, pScreen);
}
@@ -119,22 +118,22 @@ VidModeAvailable(int scrnIndex)
VidModePtr pVidMode;
if (VidModeKey == NULL) {
- DebugF("VidModeKey == NULL\n");
- return FALSE;
+ DebugF("VidModeKey == NULL\n");
+ return FALSE;
}
-
+
pScrn = xf86Screens[scrnIndex];
if (pScrn == NULL) {
- DebugF("pScrn == NULL\n");
- return FALSE;
+ DebugF("pScrn == NULL\n");
+ return FALSE;
}
-
+
pVidMode = VMPTR(pScrn->pScreen);
if (pVidMode)
- return TRUE;
+ return TRUE;
else {
- DebugF("pVidMode == NULL\n");
- return FALSE;
+ DebugF("pVidMode == NULL\n");
+ return FALSE;
}
}
@@ -144,15 +143,15 @@ VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock)
ScrnInfoPtr pScrn;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
if (pScrn->currentMode) {
- *mode = (pointer)(pScrn->currentMode);
- *dotClock = pScrn->currentMode->Clock;
+ *mode = (pointer) (pScrn->currentMode);
+ *dotClock = pScrn->currentMode->Clock;
- return TRUE;
+ return TRUE;
}
return FALSE;
}
@@ -163,13 +162,13 @@ VidModeGetDotClock(int scrnIndex, int Clock)
ScrnInfoPtr pScrn;
if (!VidModeAvailable(scrnIndex))
- return 0;
+ return 0;
pScrn = xf86Screens[scrnIndex];
if ((pScrn->progClock) || (Clock >= MAXCLOCKS))
- return Clock;
- else
- return pScrn->clock[Clock];
+ return Clock;
+ else
+ return pScrn->clock[Clock];
}
int
@@ -178,15 +177,16 @@ VidModeGetNumOfClocks(int scrnIndex, Bool *progClock)
ScrnInfoPtr pScrn;
if (!VidModeAvailable(scrnIndex))
- return 0;
+ return 0;
pScrn = xf86Screens[scrnIndex];
- if (pScrn->progClock){
- *progClock = TRUE;
- return 0;
- } else {
- *progClock = FALSE;
- return pScrn->numClocks;
+ if (pScrn->progClock) {
+ *progClock = TRUE;
+ return 0;
+ }
+ else {
+ *progClock = FALSE;
+ return pScrn->numClocks;
}
}
@@ -197,20 +197,19 @@ VidModeGetClocks(int scrnIndex, int *Clocks)
int i;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
if (pScrn->progClock)
- return FALSE;
+ return FALSE;
- for (i = 0; i < pScrn->numClocks; i++)
- *Clocks++ = pScrn->clock[i];
+ for (i = 0; i < pScrn->numClocks; i++)
+ *Clocks++ = pScrn->clock[i];
return TRUE;
}
-
Bool
VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
{
@@ -218,20 +217,20 @@ VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
VidModePtr pVidMode;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
if (pScrn->modes == NULL)
- return FALSE;
+ return FALSE;
pVidMode = VMPTR(pScrn->pScreen);
pVidMode->First = pScrn->modes;
- pVidMode->Next = pVidMode->First->next;
+ pVidMode->Next = pVidMode->First->next;
if (pVidMode->First->status == MODE_OK) {
- *mode = (pointer)(pVidMode->First);
- *dotClock = VidModeGetDotClock(scrnIndex, pVidMode->First->Clock);
- return TRUE;
+ *mode = (pointer) (pVidMode->First);
+ *dotClock = VidModeGetDotClock(scrnIndex, pVidMode->First->Clock);
+ return TRUE;
}
return VidModeGetNextModeline(scrnIndex, mode, dotClock);
@@ -245,20 +244,20 @@ VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock)
DisplayModePtr p;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
pVidMode = VMPTR(pScrn->pScreen);
for (p = pVidMode->Next; p != NULL && p != pVidMode->First; p = p->next) {
- if (p->status == MODE_OK) {
- pVidMode->Next = p->next;
- *mode = (pointer)p;
- *dotClock = VidModeGetDotClock(scrnIndex, p->Clock);
- return TRUE;
- }
+ if (p->status == MODE_OK) {
+ pVidMode->Next = p->next;
+ *mode = (pointer) p;
+ *dotClock = VidModeGetDotClock(scrnIndex, p->Clock);
+ return TRUE;
+ }
}
-
+
return FALSE;
}
@@ -268,10 +267,10 @@ VidModeDeleteModeline(int scrnIndex, pointer mode)
ScrnInfoPtr pScrn;
if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
- xf86DeleteMode(&(pScrn->modes), (DisplayModePtr)mode);
+ xf86DeleteMode(&(pScrn->modes), (DisplayModePtr) mode);
return TRUE;
}
@@ -281,7 +280,7 @@ VidModeZoomViewport(int scrnIndex, int zoom)
ScrnInfoPtr pScrn;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
xf86ZoomViewport(pScrn->pScreen, zoom);
@@ -294,17 +293,17 @@ VidModeSetViewPort(int scrnIndex, int x, int y)
ScrnInfoPtr pScrn;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
- pScrn->frameX0 = min( max(x, 0),
- pScrn->virtualX - pScrn->currentMode->HDisplay );
+ pScrn->frameX0 = min(max(x, 0),
+ pScrn->virtualX - pScrn->currentMode->HDisplay);
pScrn->frameX1 = pScrn->frameX0 + pScrn->currentMode->HDisplay - 1;
- pScrn->frameY0 = min( max(y, 0),
- pScrn->virtualY - pScrn->currentMode->VDisplay );
+ pScrn->frameY0 = min(max(y, 0),
+ pScrn->virtualY - pScrn->currentMode->VDisplay);
pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1;
if (pScrn->AdjustFrame != NULL)
- (pScrn->AdjustFrame)(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ (pScrn->AdjustFrame) (scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
return TRUE;
}
@@ -315,7 +314,7 @@ VidModeGetViewPort(int scrnIndex, int *x, int *y)
ScrnInfoPtr pScrn;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
*x = pScrn->frameX0;
@@ -331,7 +330,7 @@ VidModeSwitchMode(int scrnIndex, pointer mode)
Bool retval;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
/* save in case we fail */
@@ -341,7 +340,7 @@ VidModeSwitchMode(int scrnIndex, pointer mode)
retval = xf86SwitchMode(pScrn->pScreen, mode);
/* we failed: restore it */
if (retval == FALSE)
- pScrn->currentMode = pTmpMode;
+ pScrn->currentMode = pTmpMode;
return retval;
}
@@ -351,12 +350,12 @@ VidModeLockZoom(int scrnIndex, Bool lock)
ScrnInfoPtr pScrn;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
if (xf86Info.dontZoom)
- return FALSE;
+ return FALSE;
xf86LockZoom(pScrn->pScreen, lock);
return TRUE;
@@ -368,10 +367,10 @@ VidModeGetMonitor(int scrnIndex, pointer *monitor)
ScrnInfoPtr pScrn;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
- *monitor = (pointer)(pScrn->monitor);
+ *monitor = (pointer) (pScrn->monitor);
return TRUE;
}
@@ -382,11 +381,11 @@ VidModeCheckModeForMonitor(int scrnIndex, pointer mode)
ScrnInfoPtr pScrn;
if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
- return MODE_ERROR;
+ return MODE_ERROR;
pScrn = xf86Screens[scrnIndex];
- return xf86CheckModeForMonitor((DisplayModePtr)mode, pScrn->monitor);
+ return xf86CheckModeForMonitor((DisplayModePtr) mode, pScrn->monitor);
}
ModeStatus
@@ -395,11 +394,11 @@ VidModeCheckModeForDriver(int scrnIndex, pointer mode)
ScrnInfoPtr pScrn;
if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
- return MODE_ERROR;
+ return MODE_ERROR;
pScrn = xf86Screens[scrnIndex];
- return xf86CheckModeForDriver(pScrn, (DisplayModePtr)mode, 0);
+ return xf86CheckModeForDriver(pScrn, (DisplayModePtr) mode, 0);
}
void
@@ -407,15 +406,15 @@ VidModeSetCrtcForMode(int scrnIndex, pointer mode)
{
ScrnInfoPtr pScrn;
DisplayModePtr ScreenModes;
-
+
if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
- return;
+ return;
/* Ugly hack so that the xf86Mode.c function can be used without change */
pScrn = xf86Screens[scrnIndex];
ScreenModes = pScrn->modes;
- pScrn->modes = (DisplayModePtr)mode;
-
+ pScrn->modes = (DisplayModePtr) mode;
+
xf86SetCrtcForModes(pScrn, pScrn->adjustFlags);
pScrn->modes = ScreenModes;
return;
@@ -425,19 +424,19 @@ Bool
VidModeAddModeline(int scrnIndex, pointer mode)
{
ScrnInfoPtr pScrn;
-
+
if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
- ((DisplayModePtr)mode)->name = strdup(""); /* freed by deletemode */
- ((DisplayModePtr)mode)->status = MODE_OK;
- ((DisplayModePtr)mode)->next = pScrn->modes->next;
- ((DisplayModePtr)mode)->prev = pScrn->modes;
- pScrn->modes->next = (DisplayModePtr)mode;
- if( ((DisplayModePtr)mode)->next != NULL )
- ((DisplayModePtr)mode)->next->prev = (DisplayModePtr)mode;
+ ((DisplayModePtr) mode)->name = strdup(""); /* freed by deletemode */
+ ((DisplayModePtr) mode)->status = MODE_OK;
+ ((DisplayModePtr) mode)->next = pScrn->modes->next;
+ ((DisplayModePtr) mode)->prev = pScrn->modes;
+ pScrn->modes->next = (DisplayModePtr) mode;
+ if (((DisplayModePtr) mode)->next != NULL)
+ ((DisplayModePtr) mode)->next->prev = (DisplayModePtr) mode;
return TRUE;
}
@@ -446,15 +445,15 @@ int
VidModeGetNumOfModes(int scrnIndex)
{
pointer mode = NULL;
- int dotClock= 0, nummodes = 0;
-
+ int dotClock = 0, nummodes = 0;
+
if (!VidModeGetFirstModeline(scrnIndex, &mode, &dotClock))
- return nummodes;
+ return nummodes;
do {
- nummodes++;
- if (!VidModeGetNextModeline(scrnIndex, &mode, &dotClock))
- return nummodes;
+ nummodes++;
+ if (!VidModeGetNextModeline(scrnIndex, &mode, &dotClock))
+ return nummodes;
} while (TRUE);
}
@@ -465,16 +464,16 @@ VidModeSetGamma(int scrnIndex, float red, float green, float blue)
Gamma gamma;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
gamma.red = red;
gamma.green = green;
gamma.blue = blue;
if (xf86ChangeGamma(pScrn->pScreen, gamma) != Success)
- return FALSE;
+ return FALSE;
else
- return TRUE;
+ return TRUE;
}
Bool
@@ -483,7 +482,7 @@ VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue)
ScrnInfoPtr pScrn;
if (!VidModeAvailable(scrnIndex))
- return FALSE;
+ return FALSE;
pScrn = xf86Screens[scrnIndex];
*red = pScrn->gamma.red;
@@ -499,7 +498,7 @@ VidModeSetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b)
if (!VidModeAvailable(scrnIndex))
return FALSE;
-
+
pScrn = xf86Screens[scrnIndex];
xf86ChangeGammaRamp(pScrn->pScreen, size, r, g, b);
return TRUE;
@@ -531,14 +530,14 @@ pointer
VidModeCreateMode(void)
{
DisplayModePtr mode;
-
+
mode = malloc(sizeof(DisplayModeRec));
if (mode != NULL) {
- mode->name = "";
- mode->VScan = 1; /* divides refresh rate. default = 1 */
- mode->Private = NULL;
- mode->next = mode;
- mode->prev = mode;
+ mode->name = "";
+ mode->VScan = 1; /* divides refresh rate. default = 1 */
+ mode->Private = NULL;
+ mode->next = mode;
+ mode->prev = mode;
}
return mode;
}
@@ -546,127 +545,125 @@ VidModeCreateMode(void)
void
VidModeCopyMode(pointer modefrom, pointer modeto)
{
- memcpy(modeto, modefrom, sizeof(DisplayModeRec));
+ memcpy(modeto, modefrom, sizeof(DisplayModeRec));
}
-
int
VidModeGetModeValue(pointer mode, int valtyp)
{
- int ret = 0;
-
- switch (valtyp) {
+ int ret = 0;
+
+ switch (valtyp) {
case VIDMODE_H_DISPLAY:
- ret = ((DisplayModePtr) mode)->HDisplay;
- break;
+ ret = ((DisplayModePtr) mode)->HDisplay;
+ break;
case VIDMODE_H_SYNCSTART:
- ret = ((DisplayModePtr)mode)->HSyncStart;
- break;
+ ret = ((DisplayModePtr) mode)->HSyncStart;
+ break;
case VIDMODE_H_SYNCEND:
- ret = ((DisplayModePtr)mode)->HSyncEnd;
- break;
+ ret = ((DisplayModePtr) mode)->HSyncEnd;
+ break;
case VIDMODE_H_TOTAL:
- ret = ((DisplayModePtr)mode)->HTotal;
- break;
+ ret = ((DisplayModePtr) mode)->HTotal;
+ break;
case VIDMODE_H_SKEW:
- ret = ((DisplayModePtr)mode)->HSkew;
- break;
+ ret = ((DisplayModePtr) mode)->HSkew;
+ break;
case VIDMODE_V_DISPLAY:
- ret = ((DisplayModePtr)mode)->VDisplay;
- break;
+ ret = ((DisplayModePtr) mode)->VDisplay;
+ break;
case VIDMODE_V_SYNCSTART:
- ret = ((DisplayModePtr)mode)->VSyncStart;
- break;
+ ret = ((DisplayModePtr) mode)->VSyncStart;
+ break;
case VIDMODE_V_SYNCEND:
- ret = ((DisplayModePtr)mode)->VSyncEnd;
- break;
+ ret = ((DisplayModePtr) mode)->VSyncEnd;
+ break;
case VIDMODE_V_TOTAL:
- ret = ((DisplayModePtr)mode)->VTotal;
- break;
+ ret = ((DisplayModePtr) mode)->VTotal;
+ break;
case VIDMODE_FLAGS:
- ret = ((DisplayModePtr)mode)->Flags;
- break;
+ ret = ((DisplayModePtr) mode)->Flags;
+ break;
case VIDMODE_CLOCK:
- ret = ((DisplayModePtr)mode)->Clock;
- break;
- }
- return ret;
+ ret = ((DisplayModePtr) mode)->Clock;
+ break;
+ }
+ return ret;
}
void
VidModeSetModeValue(pointer mode, int valtyp, int val)
{
- switch (valtyp) {
+ switch (valtyp) {
case VIDMODE_H_DISPLAY:
- ((DisplayModePtr)mode)->HDisplay = val;
- break;
+ ((DisplayModePtr) mode)->HDisplay = val;
+ break;
case VIDMODE_H_SYNCSTART:
- ((DisplayModePtr)mode)->HSyncStart = val;
- break;
+ ((DisplayModePtr) mode)->HSyncStart = val;
+ break;
case VIDMODE_H_SYNCEND:
- ((DisplayModePtr)mode)->HSyncEnd = val;
- break;
+ ((DisplayModePtr) mode)->HSyncEnd = val;
+ break;
case VIDMODE_H_TOTAL:
- ((DisplayModePtr)mode)->HTotal = val;
- break;
+ ((DisplayModePtr) mode)->HTotal = val;
+ break;
case VIDMODE_H_SKEW:
- ((DisplayModePtr)mode)->HSkew = val;
- break;
+ ((DisplayModePtr) mode)->HSkew = val;
+ break;
case VIDMODE_V_DISPLAY:
- ((DisplayModePtr)mode)->VDisplay = val;
- break;
+ ((DisplayModePtr) mode)->VDisplay = val;
+ break;
case VIDMODE_V_SYNCSTART:
- ((DisplayModePtr)mode)->VSyncStart = val;
- break;
+ ((DisplayModePtr) mode)->VSyncStart = val;
+ break;
case VIDMODE_V_SYNCEND:
- ((DisplayModePtr)mode)->VSyncEnd = val;
- break;
+ ((DisplayModePtr) mode)->VSyncEnd = val;
+ break;
case VIDMODE_V_TOTAL:
- ((DisplayModePtr)mode)->VTotal = val;
- break;
+ ((DisplayModePtr) mode)->VTotal = val;
+ break;
case VIDMODE_FLAGS:
- ((DisplayModePtr)mode)->Flags = val;
- break;
+ ((DisplayModePtr) mode)->Flags = val;
+ break;
case VIDMODE_CLOCK:
- ((DisplayModePtr)mode)->Clock = val;
- break;
- }
- return;
+ ((DisplayModePtr) mode)->Clock = val;
+ break;
+ }
+ return;
}
vidMonitorValue
VidModeGetMonitorValue(pointer monitor, int valtyp, int indx)
{
- vidMonitorValue ret = { NULL, };
-
- switch (valtyp) {
+ vidMonitorValue ret = { NULL, };
+
+ switch (valtyp) {
case VIDMODE_MON_VENDOR:
- ret.ptr = (((MonPtr)monitor)->vendor);
- break;
+ ret.ptr = (((MonPtr) monitor)->vendor);
+ break;
case VIDMODE_MON_MODEL:
- ret.ptr = (((MonPtr)monitor)->model);
- break;
+ ret.ptr = (((MonPtr) monitor)->model);
+ break;
case VIDMODE_MON_NHSYNC:
- ret.i = ((MonPtr)monitor)->nHsync;
- break;
+ ret.i = ((MonPtr) monitor)->nHsync;
+ break;
case VIDMODE_MON_NVREFRESH:
- ret.i = ((MonPtr)monitor)->nVrefresh;
- break;
+ ret.i = ((MonPtr) monitor)->nVrefresh;
+ break;
case VIDMODE_MON_HSYNC_LO:
- ret.f = (100.0 * ((MonPtr)monitor)->hsync[indx].lo);
- break;
+ ret.f = (100.0 * ((MonPtr) monitor)->hsync[indx].lo);
+ break;
case VIDMODE_MON_HSYNC_HI:
- ret.f = (100.0 * ((MonPtr)monitor)->hsync[indx].hi);
- break;
+ ret.f = (100.0 * ((MonPtr) monitor)->hsync[indx].hi);
+ break;
case VIDMODE_MON_VREFRESH_LO:
- ret.f = (100.0 * ((MonPtr)monitor)->vrefresh[indx].lo);
- break;
+ ret.f = (100.0 * ((MonPtr) monitor)->vrefresh[indx].lo);
+ break;
case VIDMODE_MON_VREFRESH_HI:
- ret.f = (100.0 * ((MonPtr)monitor)->vrefresh[indx].hi);
- break;
- }
- return ret;
+ ret.f = (100.0 * ((MonPtr) monitor)->vrefresh[indx].hi);
+ break;
+ }
+ return ret;
}
-
-#endif /* XF86VIDMODE */
+#endif /* XF86VIDMODE */
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index f6be99910..77b800000 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -64,13 +64,13 @@
#include "extinit.h"
#include "loaderProcs.h"
-#include "exevents.h" /* AddInputDevice */
+#include "exevents.h" /* AddInputDevice */
#include "exglobals.h"
#include "eventstr.h"
#include "inpututils.h"
#include "optionstr.h"
-#include <string.h> /* InputClassMatches */
+#include <string.h> /* InputClassMatches */
#ifdef HAVE_FNMATCH_H
#include <fnmatch.h>
#endif
@@ -79,11 +79,11 @@
#endif
#include <stdarg.h>
-#include <stdint.h> /* for int64_t */
+#include <stdint.h> /* for int64_t */
#include "mi.h"
-#include <ptrveloc.h> /* dix pointer acceleration */
+#include <ptrveloc.h> /* dix pointer acceleration */
#include <xserver-properties.h>
#ifdef XFreeXDGA
@@ -101,13 +101,13 @@
}
static int
-xf86InputDevicePostInit(DeviceIntPtr dev);
+ xf86InputDevicePostInit(DeviceIntPtr dev);
/**
* Eval config and modify DeviceVelocityRec accordingly
*/
static void
-ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
+ProcessVelocityConfiguration(DeviceIntPtr pDev, char *devname, pointer list,
DeviceVelocityPtr s)
{
int tempi;
@@ -115,7 +115,7 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
Atom float_prop = XIGetKnownProperty(XATOM_FLOAT);
Atom prop;
- if(!s)
+ if (!s)
return;
/* common settings (available via device properties) */
@@ -139,14 +139,15 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
/* select profile by number */
tempi = xf86SetIntOption(list, "AccelerationProfile",
- s->statistics.profile_number);
+ s->statistics.profile_number);
prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
if (XIChangeDeviceProperty(pDev, prop, XA_INTEGER, 32,
PropModeReplace, 1, &tempi, FALSE) == Success) {
xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i\n", devname,
tempi);
- } else {
+ }
+ else {
xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i is unknown\n",
devname, tempi);
}
@@ -158,7 +159,8 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
tempf = 1000.0 / tempf;
XIChangeDeviceProperty(pDev, prop, float_prop, 32,
PropModeReplace, 1, &tempf, FALSE);
- } else {
+ }
+ else {
tempf = xf86SetRealOption(list, "VelocityScale", s->corr_mul);
XIChangeDeviceProperty(pDev, prop, float_prop, 32,
PropModeReplace, 1, &tempf, FALSE);
@@ -166,7 +168,7 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
tempi = xf86SetIntOption(list, "VelocityTrackerCount", -1);
if (tempi > 1)
- InitTrackers(s, tempi);
+ InitTrackers(s, tempi);
s->initial_range = xf86SetIntOption(list, "VelocityInitialRange",
s->initial_range);
@@ -175,9 +177,9 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
tempf = xf86SetRealOption(list, "VelocityRelDiff", -1);
if (tempf >= 0) {
- xf86Msg(X_CONFIG, "%s: (accel) max rel. velocity difference: %.1f%%\n",
- devname, tempf*100.0);
- s->max_rel_diff = tempf;
+ xf86Msg(X_CONFIG, "%s: (accel) max rel. velocity difference: %.1f%%\n",
+ devname, tempf * 100.0);
+ s->max_rel_diff = tempf;
}
/* Configure softening. If const deceleration is used, this is expected
@@ -194,25 +196,26 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
}
static void
-ApplyAccelerationSettings(DeviceIntPtr dev){
+ApplyAccelerationSettings(DeviceIntPtr dev)
+{
int scheme, i;
DeviceVelocityPtr pVel;
- InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
- char* schemeStr;
+ InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate;
+ char *schemeStr;
if (dev->valuator && dev->ptrfeed) {
- schemeStr = xf86SetStrOption(pInfo->options, "AccelerationScheme", "");
+ schemeStr = xf86SetStrOption(pInfo->options, "AccelerationScheme", "");
- scheme = dev->valuator->accelScheme.number;
+ scheme = dev->valuator->accelScheme.number;
- if (!xf86NameCmp(schemeStr, "predictable"))
- scheme = PtrAccelPredictable;
+ if (!xf86NameCmp(schemeStr, "predictable"))
+ scheme = PtrAccelPredictable;
- if (!xf86NameCmp(schemeStr, "lightweight"))
- scheme = PtrAccelLightweight;
+ if (!xf86NameCmp(schemeStr, "lightweight"))
+ scheme = PtrAccelLightweight;
- if (!xf86NameCmp(schemeStr, "none"))
- scheme = PtrAccelNoOp;
+ if (!xf86NameCmp(schemeStr, "none"))
+ scheme = PtrAccelNoOp;
/* reinit scheme if needed */
if (dev->valuator->accelScheme.number != scheme) {
@@ -221,14 +224,16 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
}
if (InitPointerAccelerationScheme(dev, scheme)) {
- xf86Msg(X_CONFIG, "%s: (accel) selected scheme %s/%i\n",
- pInfo->name, schemeStr, scheme);
- } else {
- xf86Msg(X_CONFIG, "%s: (accel) could not init scheme %s\n",
- pInfo->name, schemeStr);
- scheme = dev->valuator->accelScheme.number;
+ xf86Msg(X_CONFIG, "%s: (accel) selected scheme %s/%i\n",
+ pInfo->name, schemeStr, scheme);
}
- } else {
+ else {
+ xf86Msg(X_CONFIG, "%s: (accel) could not init scheme %s\n",
+ pInfo->name, schemeStr);
+ scheme = dev->valuator->accelScheme.number;
+ }
+ }
+ else {
xf86Msg(X_CONFIG, "%s: (accel) keeping acceleration scheme %i\n",
pInfo->name, scheme);
}
@@ -237,11 +242,11 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
/* process special configuration */
switch (scheme) {
- case PtrAccelPredictable:
- pVel = GetDevicePredictableAccelData(dev);
- ProcessVelocityConfiguration (dev, pInfo->name, pInfo->options,
- pVel);
- break;
+ case PtrAccelPredictable:
+ pVel = GetDevicePredictableAccelData(dev);
+ ProcessVelocityConfiguration(dev, pInfo->name, pInfo->options,
+ pVel);
+ break;
}
i = xf86SetIntOption(pInfo->options, "AccelerationNumerator",
@@ -260,8 +265,8 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
dev->ptrfeed->ctrl.threshold = i;
xf86Msg(X_CONFIG, "%s: (accel) acceleration factor: %.3f\n",
- pInfo->name, ((float)dev->ptrfeed->ctrl.num)/
- ((float)dev->ptrfeed->ctrl.den));
+ pInfo->name, ((float) dev->ptrfeed->ctrl.num) /
+ ((float) dev->ptrfeed->ctrl.den));
xf86Msg(X_CONFIG, "%s: (accel) acceleration threshold: %i\n",
pInfo->name, dev->ptrfeed->ctrl.threshold);
}
@@ -270,10 +275,10 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
static void
ApplyTransformationMatrix(DeviceIntPtr dev)
{
- InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
+ InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate;
char *str;
int rc;
- float matrix[9] = {0};
+ float matrix[9] = { 0 };
if (!dev->valuator)
return;
@@ -282,10 +287,12 @@ ApplyTransformationMatrix(DeviceIntPtr dev)
if (!str)
return;
- rc = sscanf(str, "%f %f %f %f %f %f %f %f %f", &matrix[0], &matrix[1], &matrix[2],
- &matrix[3], &matrix[4], &matrix[5], &matrix[6], &matrix[7], &matrix[8]);
+ rc = sscanf(str, "%f %f %f %f %f %f %f %f %f", &matrix[0], &matrix[1],
+ &matrix[2], &matrix[3], &matrix[4], &matrix[5], &matrix[6],
+ &matrix[7], &matrix[8]);
if (rc != 9) {
- xf86Msg(X_ERROR, "%s: invalid format for transformation matrix. Ignoring configuration.\n",
+ xf86Msg(X_ERROR,
+ "%s: invalid format for transformation matrix. Ignoring configuration.\n",
pInfo->name);
return;
}
@@ -304,8 +311,7 @@ ApplyTransformationMatrix(DeviceIntPtr dev)
***********************************************************************
*/
void
-xf86ProcessCommonOptions(InputInfoPtr pInfo,
- XF86OptionPtr list)
+xf86ProcessCommonOptions(InputInfoPtr pInfo, XF86OptionPtr list)
{
if (xf86SetBoolOption(list, "Floating", 0) ||
!xf86SetBoolOption(list, "AlwaysCore", 1) ||
@@ -313,7 +319,8 @@ xf86ProcessCommonOptions(InputInfoPtr pInfo,
!xf86SetBoolOption(list, "CorePointer", 1) ||
!xf86SetBoolOption(list, "CoreKeyboard", 1)) {
xf86Msg(X_CONFIG, "%s: doesn't report core events\n", pInfo->name);
- } else {
+ }
+ else {
pInfo->flags |= XI86_ALWAYS_CORE;
xf86Msg(X_CONFIG, "%s: always reports core events\n", pInfo->name);
}
@@ -331,15 +338,13 @@ xf86ProcessCommonOptions(InputInfoPtr pInfo,
static DeviceIntPtr
xf86ActivateDevice(InputInfoPtr pInfo)
{
- DeviceIntPtr dev;
- Atom atom;
+ DeviceIntPtr dev;
+ Atom atom;
dev = AddInputDevice(serverClient, pInfo->device_control, TRUE);
- if (dev == NULL)
- {
- xf86Msg(X_ERROR, "Too many input devices. Ignoring %s\n",
- pInfo->name);
+ if (dev == NULL) {
+ xf86Msg(X_ERROR, "Too many input devices. Ignoring %s\n", pInfo->name);
pInfo->dev = NULL;
return NULL;
}
@@ -356,7 +361,8 @@ xf86ActivateDevice(InputInfoPtr pInfo)
dev->config_info = xf86SetStrOption(pInfo->options, "config_info", NULL);
if (serverGeneration == 1)
- xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s, id %d)\n",
+ xf86Msg(X_INFO,
+ "XINPUT: Adding extended input device \"%s\" (type: %s, id %d)\n",
pInfo->name, pInfo->type_name, dev->id);
return dev;
@@ -376,18 +382,17 @@ xf86ActivateDevice(InputInfoPtr pInfo)
*/
int
-SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
+SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
{
- InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
+ InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate;
- if (pInfo->switch_mode) {
- return (*pInfo->switch_mode)(client, dev, mode);
- }
- else
- return BadMatch;
+ if (pInfo->switch_mode) {
+ return (*pInfo->switch_mode) (client, dev, mode);
+ }
+ else
+ return BadMatch;
}
-
/***********************************************************************
*
* Caller: ProcXSetDeviceValuators
@@ -402,19 +407,18 @@ SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
*/
int
-SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
- int first_valuator, int num_valuators)
+SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, int *valuators,
+ int first_valuator, int num_valuators)
{
InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate;
if (pInfo->set_device_valuators)
- return (*pInfo->set_device_valuators)(pInfo, valuators, first_valuator,
- num_valuators);
+ return (*pInfo->set_device_valuators) (pInfo, valuators, first_valuator,
+ num_valuators);
return BadMatch;
}
-
/***********************************************************************
*
* Caller: ProcXChangeDeviceControl
@@ -425,26 +429,26 @@ SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
*/
int
-ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
+ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control)
{
- InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
-
- if (!pInfo->control_proc) {
- switch (control->control) {
- case DEVICE_CORE:
- case DEVICE_ABS_CALIB:
- case DEVICE_ABS_AREA:
- return BadMatch;
- case DEVICE_RESOLUTION:
- case DEVICE_ENABLE:
- return Success;
- default:
- return BadMatch;
- }
- }
- else {
- return (*pInfo->control_proc)(pInfo, control);
- }
+ InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate;
+
+ if (!pInfo->control_proc) {
+ switch (control->control) {
+ case DEVICE_CORE:
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return BadMatch;
+ case DEVICE_RESOLUTION:
+ case DEVICE_ENABLE:
+ return Success;
+ default:
+ return BadMatch;
+ }
+ }
+ else {
+ return (*pInfo->control_proc) (pInfo, control);
+ }
}
/*
@@ -506,8 +510,9 @@ match_string_implicit(const char *attr, const char *pattern)
{
if (strlen(pattern)) {
return strcmp(attr, pattern);
- } else {
- return strcmp(attr,"(implicit)");
+ }
+ else {
+ return strcmp(attr, "(implicit)");
}
}
@@ -517,7 +522,7 @@ match_string_implicit(const char *attr, const char *pattern)
*/
static Bool
MatchAttrToken(const char *attr, struct xorg_list *patterns,
- int (*compare)(const char *attr, const char *pattern))
+ int (*compare) (const char *attr, const char *pattern))
{
const xf86MatchGroup *group;
@@ -534,11 +539,11 @@ MatchAttrToken(const char *attr, struct xorg_list *patterns,
* match. Each list entry is a separate Match line of the same type.
*/
xorg_list_for_each_entry(group, patterns, entry) {
- char * const *cur;
+ char *const *cur;
Bool match = FALSE;
for (cur = group->values; *cur; cur++)
- if ((*compare)(attr, *cur) == 0) {
+ if ((*compare) (attr, *cur) == 0) {
match = TRUE;
break;
}
@@ -556,10 +561,11 @@ MatchAttrToken(const char *attr, struct xorg_list *patterns,
*/
static Bool
InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
- const InputAttributes *attrs)
+ const InputAttributes * attrs)
{
/* MatchProduct substring */
- if (!MatchAttrToken(attrs->product, &iclass->match_product, match_substring))
+ if (!MatchAttrToken
+ (attrs->product, &iclass->match_product, match_substring))
return FALSE;
/* MatchVendor substring */
@@ -567,7 +573,8 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
return FALSE;
/* MatchDevicePath pattern */
- if (!MatchAttrToken(attrs->device, &iclass->match_device, match_path_pattern))
+ if (!MatchAttrToken
+ (attrs->device, &iclass->match_device, match_path_pattern))
return FALSE;
/* MatchOS case-insensitive string */
@@ -591,7 +598,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
* See if any of the device's tags match any of the MatchTag tokens.
*/
if (!xorg_list_is_empty(&iclass->match_tag)) {
- char * const *tag;
+ char *const *tag;
Bool match;
if (!attrs->tags)
@@ -615,22 +622,22 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
/* MatchIs* booleans */
if (iclass->is_keyboard.set &&
- iclass->is_keyboard.val != !!(attrs->flags & ATTR_KEYBOARD))
+ iclass->is_keyboard.val != ! !(attrs->flags & ATTR_KEYBOARD))
return FALSE;
if (iclass->is_pointer.set &&
- iclass->is_pointer.val != !!(attrs->flags & ATTR_POINTER))
+ iclass->is_pointer.val != ! !(attrs->flags & ATTR_POINTER))
return FALSE;
if (iclass->is_joystick.set &&
- iclass->is_joystick.val != !!(attrs->flags & ATTR_JOYSTICK))
+ iclass->is_joystick.val != ! !(attrs->flags & ATTR_JOYSTICK))
return FALSE;
if (iclass->is_tablet.set &&
- iclass->is_tablet.val != !!(attrs->flags & ATTR_TABLET))
+ iclass->is_tablet.val != ! !(attrs->flags & ATTR_TABLET))
return FALSE;
if (iclass->is_touchpad.set &&
- iclass->is_touchpad.val != !!(attrs->flags & ATTR_TOUCHPAD))
+ iclass->is_touchpad.val != ! !(attrs->flags & ATTR_TOUCHPAD))
return FALSE;
if (iclass->is_touchscreen.set &&
- iclass->is_touchscreen.val != !!(attrs->flags & ATTR_TOUCHSCREEN))
+ iclass->is_touchscreen.val != ! !(attrs->flags & ATTR_TOUCHSCREEN))
return FALSE;
return TRUE;
@@ -642,7 +649,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
* well as any previous InputClass sections.
*/
static int
-MergeInputClasses(const InputInfoPtr idev, const InputAttributes *attrs)
+MergeInputClasses(const InputInfoPtr idev, const InputAttributes * attrs)
{
XF86ConfInputClassPtr cl;
XF86OptionPtr classopts;
@@ -661,8 +668,7 @@ MergeInputClasses(const InputInfoPtr idev, const InputAttributes *attrs)
"InputClass configuration");
return BadAlloc;
}
- classopts = xf86ReplaceStrOption(classopts, "driver",
- idev->driver);
+ classopts = xf86ReplaceStrOption(classopts, "driver", idev->driver);
}
/* Apply options to device with InputClass settings preferred. */
@@ -679,7 +685,7 @@ MergeInputClasses(const InputInfoPtr idev, const InputAttributes *attrs)
* value of the last matching class and holler when returning TRUE.
*/
static Bool
-IgnoreInputClass(const InputInfoPtr idev, const InputAttributes *attrs)
+IgnoreInputClass(const InputInfoPtr idev, const InputAttributes * attrs)
{
XF86ConfInputClassPtr cl;
Bool ignore = FALSE;
@@ -724,13 +730,12 @@ xf86AddInput(InputDriverPtr drv, InputInfoPtr pInfo)
pInfo->drv = drv;
pInfo->module = DuplicateModule(drv->module, NULL);
- for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next)
- ;
+ for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next);
*prev = pInfo;
pInfo->next = NULL;
- xf86CollectInputOptions(pInfo, (const char**)drv->default_options);
+ xf86CollectInputOptions(pInfo, (const char **) drv->default_options);
xf86OptionListReport(pInfo->options);
xf86ProcessCommonOptions(pInfo, pInfo->options);
}
@@ -743,10 +748,10 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
{
/* First check if the inputdev is valid. */
if (pInp == NULL)
- return;
+ return;
if (pInp->module)
- UnloadModule(pInp->module);
+ UnloadModule(pInp->module);
/* This should *really* be handled in drv->UnInit(dev) call instead, but
* if the driver forgets about it make sure we free it or at least crash
@@ -757,14 +762,15 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
/* Remove the entry from the list. */
if (pInp == xf86InputDevs)
- xf86InputDevs = pInp->next;
+ xf86InputDevs = pInp->next;
else {
- InputInfoPtr p = xf86InputDevs;
- while (p && p->next != pInp)
- p = p->next;
- if (p)
- p->next = pInp->next;
- /* Else the entry wasn't in the xf86InputDevs list (ignore this). */
+ InputInfoPtr p = xf86InputDevs;
+
+ while (p && p->next != pInp)
+ p = p->next;
+ if (p)
+ p->next = pInp->next;
+ /* Else the entry wasn't in the xf86InputDevs list (ignore this). */
}
free(pInp->driver);
@@ -781,7 +787,8 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
* @return Success or an error code
*/
static int
-xf86InputDevicePostInit(DeviceIntPtr dev) {
+xf86InputDevicePostInit(DeviceIntPtr dev)
+{
ApplyAccelerationSettings(dev);
ApplyTransformationMatrix(dev);
return Success;
@@ -823,7 +830,8 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
goto unwind;
}
- xf86Msg(X_INFO, "Using input driver '%s' for '%s'\n", drv->driverName, pInfo->name);
+ xf86Msg(X_INFO, "Using input driver '%s' for '%s'\n", drv->driverName,
+ pInfo->name);
if (!drv->PreInit) {
xf86Msg(X_ERROR,
@@ -842,35 +850,30 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
goto unwind;
}
- if (!(dev = xf86ActivateDevice(pInfo)))
- {
+ if (!(dev = xf86ActivateDevice(pInfo))) {
rval = BadAlloc;
goto unwind;
}
rval = ActivateDevice(dev, TRUE);
- if (rval != Success)
- {
+ if (rval != Success) {
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
RemoveDevice(dev, TRUE);
goto unwind;
}
rval = xf86InputDevicePostInit(dev);
- if (rval != Success)
- {
- xf86Msg(X_ERROR, "Couldn't post-init device \"%s\"\n", pInfo->name);
- RemoveDevice(dev, TRUE);
- goto unwind;
+ if (rval != Success) {
+ xf86Msg(X_ERROR, "Couldn't post-init device \"%s\"\n", pInfo->name);
+ RemoveDevice(dev, TRUE);
+ goto unwind;
}
/* Enable it if it's properly initialised and we're currently in the VT */
- if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)
- {
+ if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema) {
OsBlockSignals();
EnableDevice(dev, TRUE);
- if (!dev->enabled)
- {
+ if (!dev->enabled) {
OsReleaseSignals();
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
RemoveDevice(dev, TRUE);
@@ -885,9 +888,9 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
*pdev = dev;
return Success;
-unwind:
- if(pInfo) {
- if(drv && drv->UnInit)
+ unwind:
+ if (pInfo) {
+ if (drv && drv->UnInit)
drv->UnInit(drv, pInfo, 0);
else
xf86DeleteInput(pInfo, 0);
@@ -896,8 +899,8 @@ unwind:
}
int
-NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
- DeviceIntPtr *pdev)
+NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
+ DeviceIntPtr *pdev)
{
InputInfoPtr pInfo = NULL;
InputOption *option = NULL;
@@ -924,8 +927,7 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
}
}
- if (strcasecmp(key, "name") == 0 ||
- strcasecmp(key, "identifier") == 0) {
+ if (strcasecmp(key, "name") == 0 || strcasecmp(key, "identifier") == 0) {
if (pInfo->name) {
rval = BadRequest;
goto unwind;
@@ -978,17 +980,19 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
if (!pInfo->driver) {
xf86Msg(X_INFO, "No input driver specified, ignoring this device.\n");
- xf86Msg(X_INFO, "This device may have been added with another device file.\n");
+ xf86Msg(X_INFO,
+ "This device may have been added with another device file.\n");
rval = BadRequest;
goto unwind;
}
rval = xf86NewInputDevice(pInfo, pdev,
- (!is_auto || (is_auto && xf86Info.autoEnableDevices)));
+ (!is_auto ||
+ (is_auto && xf86Info.autoEnableDevices)));
return rval;
-unwind:
+ unwind:
if (is_auto && !xf86Info.autoAddDevices)
xf86Msg(X_INFO, "AutoAddDevices is off - not adding device.\n");
xf86DeleteInput(pInfo, 0);
@@ -1002,15 +1006,14 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
InputDriverPtr drv = NULL;
Bool isMaster = IsMaster(pDev);
- if (pInfo) /* need to get these before RemoveDevice */
+ if (pInfo) /* need to get these before RemoveDevice */
drv = pInfo->drv;
OsBlockSignals();
RemoveDevice(pDev, TRUE);
- if (!isMaster && pInfo != NULL)
- {
- if(drv->UnInit)
+ if (!isMaster && pInfo != NULL) {
+ if (drv->UnInit)
drv->UnInit(drv, pInfo, 0);
else
xf86DeleteInput(pInfo, 0);
@@ -1023,11 +1026,8 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
*/
void
-xf86PostMotionEvent(DeviceIntPtr device,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- ...)
+xf86PostMotionEvent(DeviceIntPtr device,
+ int is_absolute, int first_valuator, int num_valuators, ...)
{
va_list var;
int i = 0;
@@ -1039,17 +1039,17 @@ xf86PostMotionEvent(DeviceIntPtr device,
va_start(var, num_valuators);
for (i = 0; i < num_valuators; i++)
valuator_mask_set(&mask, first_valuator + i, va_arg(var, int));
+
va_end(var);
xf86PostMotionEventM(device, is_absolute, &mask);
}
void
-xf86PostMotionEventP(DeviceIntPtr device,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- const int *valuators)
+xf86PostMotionEventP(DeviceIntPtr device,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators, const int *valuators)
{
ValuatorMask mask;
@@ -1060,14 +1060,12 @@ xf86PostMotionEventP(DeviceIntPtr device,
}
void
-xf86PostMotionEventM(DeviceIntPtr device,
- int is_absolute,
- const ValuatorMask *mask)
+xf86PostMotionEventM(DeviceIntPtr device,
+ int is_absolute, const ValuatorMask *mask)
{
int flags = 0;
- if (valuator_mask_num_valuators(mask) > 0)
- {
+ if (valuator_mask_num_valuators(mask) > 0) {
if (is_absolute)
flags = POINTER_ABSOLUTE;
else
@@ -1076,21 +1074,18 @@ xf86PostMotionEventM(DeviceIntPtr device,
#if XFreeXDGA
/* The evdev driver may not always send all axes across. */
- if (valuator_mask_isset(mask, 0) ||
- valuator_mask_isset(mask, 1))
+ if (valuator_mask_isset(mask, 0) || valuator_mask_isset(mask, 1))
if (miPointerGetScreen(device)) {
int index = miPointerGetScreen(device)->myNum;
int dx = 0, dy = 0;
- if (valuator_mask_isset(mask, 0))
- {
+ if (valuator_mask_isset(mask, 0)) {
dx = valuator_mask_get(mask, 0);
if (is_absolute)
dx -= device->last.valuators[0];
}
- if (valuator_mask_isset(mask, 1))
- {
+ if (valuator_mask_isset(mask, 1)) {
dy = valuator_mask_get(mask, 1);
if (is_absolute)
dy -= device->last.valuators[1];
@@ -1105,11 +1100,8 @@ xf86PostMotionEventM(DeviceIntPtr device,
}
void
-xf86PostProximityEvent(DeviceIntPtr device,
- int is_in,
- int first_valuator,
- int num_valuators,
- ...)
+xf86PostProximityEvent(DeviceIntPtr device,
+ int is_in, int first_valuator, int num_valuators, ...)
{
va_list var;
int i;
@@ -1121,17 +1113,17 @@ xf86PostProximityEvent(DeviceIntPtr device,
va_start(var, num_valuators);
for (i = 0; i < num_valuators; i++)
valuator_mask_set(&mask, first_valuator + i, va_arg(var, int));
+
va_end(var);
xf86PostProximityEventM(device, is_in, &mask);
}
void
-xf86PostProximityEventP(DeviceIntPtr device,
- int is_in,
- int first_valuator,
- int num_valuators,
- const int *valuators)
+xf86PostProximityEventP(DeviceIntPtr device,
+ int is_in,
+ int first_valuator,
+ int num_valuators, const int *valuators)
{
ValuatorMask mask;
@@ -1142,21 +1134,17 @@ xf86PostProximityEventP(DeviceIntPtr device,
}
void
-xf86PostProximityEventM(DeviceIntPtr device,
- int is_in,
- const ValuatorMask *mask)
+xf86PostProximityEventM(DeviceIntPtr device,
+ int is_in, const ValuatorMask *mask)
{
QueueProximityEvents(device, is_in ? ProximityIn : ProximityOut, mask);
}
void
-xf86PostButtonEvent(DeviceIntPtr device,
- int is_absolute,
- int button,
- int is_down,
- int first_valuator,
- int num_valuators,
- ...)
+xf86PostButtonEvent(DeviceIntPtr device,
+ int is_absolute,
+ int button,
+ int is_down, int first_valuator, int num_valuators, ...)
{
va_list var;
ValuatorMask mask;
@@ -1169,19 +1157,19 @@ xf86PostButtonEvent(DeviceIntPtr device,
va_start(var, num_valuators);
for (i = 0; i < num_valuators; i++)
valuator_mask_set(&mask, first_valuator + i, va_arg(var, int));
+
va_end(var);
xf86PostButtonEventM(device, is_absolute, button, is_down, &mask);
}
void
-xf86PostButtonEventP(DeviceIntPtr device,
- int is_absolute,
- int button,
- int is_down,
- int first_valuator,
- int num_valuators,
- const int *valuators)
+xf86PostButtonEventP(DeviceIntPtr device,
+ int is_absolute,
+ int button,
+ int is_down,
+ int first_valuator,
+ int num_valuators, const int *valuators)
{
ValuatorMask mask;
@@ -1192,16 +1180,13 @@ xf86PostButtonEventP(DeviceIntPtr device,
}
void
-xf86PostButtonEventM(DeviceIntPtr device,
- int is_absolute,
- int button,
- int is_down,
- const ValuatorMask *mask)
+xf86PostButtonEventM(DeviceIntPtr device,
+ int is_absolute,
+ int button, int is_down, const ValuatorMask *mask)
{
int flags = 0;
- if (valuator_mask_num_valuators(mask) > 0)
- {
+ if (valuator_mask_num_valuators(mask) > 0) {
if (is_absolute)
flags = POINTER_ABSOLUTE;
else
@@ -1223,13 +1208,10 @@ xf86PostButtonEventM(DeviceIntPtr device,
}
void
-xf86PostKeyEvent(DeviceIntPtr device,
- unsigned int key_code,
- int is_down,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- ...)
+xf86PostKeyEvent(DeviceIntPtr device,
+ unsigned int key_code,
+ int is_down,
+ int is_absolute, int first_valuator, int num_valuators, ...)
{
va_list var;
int i = 0;
@@ -1242,19 +1224,18 @@ xf86PostKeyEvent(DeviceIntPtr device,
va_start(var, num_valuators);
for (i = 0; i < num_valuators; i++)
valuator_mask_set(&mask, first_valuator + i, va_arg(var, int));
+
va_end(var);
xf86PostKeyEventM(device, key_code, is_down, is_absolute, &mask);
}
void
-xf86PostKeyEventP(DeviceIntPtr device,
- unsigned int key_code,
- int is_down,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- const int *valuators)
+xf86PostKeyEventP(DeviceIntPtr device,
+ unsigned int key_code,
+ int is_down,
+ int is_absolute,
+ int first_valuator, int num_valuators, const int *valuators)
{
ValuatorMask mask;
@@ -1265,17 +1246,16 @@ xf86PostKeyEventP(DeviceIntPtr device,
}
void
-xf86PostKeyEventM(DeviceIntPtr device,
- unsigned int key_code,
- int is_down,
- int is_absolute,
- const ValuatorMask *mask)
+xf86PostKeyEventM(DeviceIntPtr device,
+ unsigned int key_code,
+ int is_down, int is_absolute, const ValuatorMask *mask)
{
#if XFreeXDGA
DeviceIntPtr pointer;
/* Some pointers send key events, paired device is wrong then. */
pointer = GetMaster(device, POINTER_OR_FLOAT);
+
if (miPointerGetScreen(pointer)) {
int index = miPointerGetScreen(pointer)->myNum;
@@ -1285,14 +1265,11 @@ xf86PostKeyEventM(DeviceIntPtr device,
#endif
QueueKeyboardEvents(device,
- is_down ? KeyPress : KeyRelease,
- key_code, mask);
+ is_down ? KeyPress : KeyRelease, key_code, mask);
}
void
-xf86PostKeyboardEvent(DeviceIntPtr device,
- unsigned int key_code,
- int is_down)
+xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code, int is_down)
{
ValuatorMask mask;
@@ -1323,41 +1300,38 @@ xf86FirstLocalDevice(void)
*/
int
-xf86ScaleAxis(int Cx,
- int to_max,
- int to_min,
- int from_max,
- int from_min )
+xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min)
{
int X;
int64_t to_width = to_max - to_min;
int64_t from_width = from_max - from_min;
if (from_width) {
- X = (int)(((to_width * (Cx - from_min)) / from_width) + to_min);
+ X = (int) (((to_width * (Cx - from_min)) / from_width) + to_min);
}
else {
- X = 0;
- ErrorF ("Divide by Zero in xf86ScaleAxis\n");
+ X = 0;
+ ErrorF("Divide by Zero in xf86ScaleAxis\n");
}
-
+
if (X > to_max)
- X = to_max;
+ X = to_max;
if (X < to_min)
- X = to_min;
-
+ X = to_min;
+
return X;
}
Bool
-xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval,
- int resolution, int min_res, int max_res, int mode)
+xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
+ int maxval, int resolution, int min_res, int max_res,
+ int mode)
{
if (!dev || !dev->valuator)
return FALSE;
- return InitValuatorAxisStruct(dev, axnum, label, minval, maxval, resolution, min_res,
- max_res, mode);
+ return InitValuatorAxisStruct(dev, axnum, label, minval, maxval, resolution,
+ min_res, max_res, mode);
}
/*
@@ -1368,16 +1342,15 @@ void
xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
{
if (axnum == 0) {
- dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
+ dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
dev->last.valuators[0] = dev->valuator->axisVal[0];
}
else if (axnum == 1) {
- dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
+ dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
dev->last.valuators[1] = dev->valuator->axisVal[1];
}
}
-
/**
* Deactivate a device. Call this function from the driver if you receive a
* read error or something else that spoils your day.
@@ -1390,11 +1363,10 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
void
xf86DisableDevice(DeviceIntPtr dev, Bool panic)
{
- if(!panic)
- {
+ if (!panic) {
DisableDevice(dev, TRUE);
- } else
- {
+ }
+ else {
SendDevicePresenceEvent(dev->id, DeviceUnrecoverable);
DeleteInputDeviceRequest(dev);
}
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.h b/xorg-server/hw/xfree86/common/xf86Xinput.h
index ad092dd03..3731a34d5 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.h
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.h
@@ -48,7 +48,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
#ifndef _xf86Xinput_h
#define _xf86Xinput_h
@@ -59,52 +58,48 @@
#include "XIstubs.h"
/* Input device flags */
-#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
+#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
/* the device sends Xinput and core pointer events */
#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
/* This holds the input driver entry and module information. */
typedef struct _InputDriverRec {
- int driverVersion;
- char * driverName;
- void (*Identify)(int flags);
- int (*PreInit)(struct _InputDriverRec *drv,
- struct _InputInfoRec* pInfo, int flags);
- void (*UnInit)(struct _InputDriverRec *drv,
- struct _InputInfoRec *pInfo,
- int flags);
- pointer module;
- char ** default_options;
+ int driverVersion;
+ char *driverName;
+ void (*Identify) (int flags);
+ int (*PreInit) (struct _InputDriverRec * drv,
+ struct _InputInfoRec * pInfo, int flags);
+ void (*UnInit) (struct _InputDriverRec * drv,
+ struct _InputInfoRec * pInfo, int flags);
+ pointer module;
+ char **default_options;
} InputDriverRec, *InputDriverPtr;
/* This is to input devices what the ScrnInfoRec is to screens. */
typedef struct _InputInfoRec {
struct _InputInfoRec *next;
- char * name;
- char * driver;
-
- int flags;
-
- Bool (*device_control)(DeviceIntPtr device, int what);
- void (*read_input)(struct _InputInfoRec *local);
- int (*control_proc)(struct _InputInfoRec *local,
- xDeviceCtl *control);
- int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
- int mode);
- int (*set_device_valuators)
- (struct _InputInfoRec *local,
- int *valuators, int first_valuator,
- int num_valuators);
-
- int fd;
- DeviceIntPtr dev;
- pointer private;
- char * type_name;
- InputDriverPtr drv;
- pointer module;
- XF86OptionPtr options;
- InputAttributes *attrs;
+ char *name;
+ char *driver;
+
+ int flags;
+
+ Bool (*device_control) (DeviceIntPtr device, int what);
+ void (*read_input) (struct _InputInfoRec * local);
+ int (*control_proc) (struct _InputInfoRec * local, xDeviceCtl * control);
+ int (*switch_mode) (ClientPtr client, DeviceIntPtr dev, int mode);
+ int (*set_device_valuators)
+ (struct _InputInfoRec * local,
+ int *valuators, int first_valuator, int num_valuators);
+
+ int fd;
+ DeviceIntPtr dev;
+ pointer private;
+ char *type_name;
+ InputDriverPtr drv;
+ pointer module;
+ XF86OptionPtr options;
+ InputAttributes *attrs;
} *InputInfoPtr;
/* xf86Globals.c */
@@ -112,73 +107,95 @@ extern InputInfoPtr xf86InputDevs;
/* xf86Xinput.c */
extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
- int first_valuator, int num_valuators, ...);
+ int first_valuator, int num_valuators,
+ ...);
extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
- int first_valuator, int num_valuators, const int *valuators);
+ int first_valuator,
+ int num_valuators,
+ const int *valuators);
extern _X_EXPORT void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute,
- const ValuatorMask *mask);
+ const ValuatorMask *mask);
extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
- int first_valuator, int num_valuators, ...);
-extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator,
- int num_valuators, const int *valuators);
+ int first_valuator,
+ int num_valuators, ...);
+extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in,
+ int first_valuator,
+ int num_valuators,
+ const int *valuators);
extern _X_EXPORT void xf86PostProximityEventM(DeviceIntPtr device, int is_in,
- const ValuatorMask *mask);
-extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
- int is_down, int first_valuator, int num_valuators,
- ...);
-extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button,
- int is_down, int first_valuator, int num_valuators,
- const int *valuators);
-extern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute, int button,
- int is_down, const ValuatorMask *mask);
-extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
- int is_absolute, int first_valuator, int num_valuators,
- ...);
-extern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device, unsigned int key_code, int is_down,
- int is_absolute, const ValuatorMask *mask);
-extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down,
- int is_absolute, int first_valuator, int num_valuators,
- const int *valuators);
-extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
- int is_down);
+ const ValuatorMask *mask);
+extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute,
+ int button, int is_down,
+ int first_valuator, int num_valuators,
+ ...);
+extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute,
+ int button, int is_down,
+ int first_valuator,
+ int num_valuators,
+ const int *valuators);
+extern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute,
+ int button, int is_down,
+ const ValuatorMask *mask);
+extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device,
+ unsigned int key_code, int is_down,
+ int is_absolute, int first_valuator,
+ int num_valuators, ...);
+extern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device,
+ unsigned int key_code, int is_down,
+ int is_absolute,
+ const ValuatorMask *mask);
+extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device,
+ unsigned int key_code, int is_down,
+ int is_absolute, int first_valuator,
+ int num_valuators,
+ const int *valuators);
+extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device,
+ unsigned int key_code, int is_down);
extern _X_EXPORT void xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid,
uint16_t type, uint32_t flags,
const ValuatorMask *mask);
extern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void);
-extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min);
-extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, XF86OptionPtr options);
-extern _X_EXPORT Bool xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
- int maxval, int resolution, int min_res,
- int max_res, int mode);
+extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max,
+ int from_min);
+extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo,
+ XF86OptionPtr options);
+extern _X_EXPORT Bool xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum,
+ Atom label, int minval,
+ int maxval, int resolution,
+ int min_res, int max_res,
+ int mode);
extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo);
extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev);
+
/* not exported */
int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto);
InputInfoPtr xf86AllocateInput(void);
/* xf86Helper.c */
-extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
+extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module,
+ int flags);
extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);
extern _X_EXPORT void xf86MotionHistoryAllocate(InputInfoPtr pInfo);
-extern _X_EXPORT void xf86IDrvMsgVerb(InputInfoPtr dev,
- MessageType type, int verb,
- const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
-extern _X_EXPORT void xf86IDrvMsg(InputInfoPtr dev,
- MessageType type,
- const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4);
-extern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev,
- MessageType type,
- int verb,
- const char *format,
- va_list args) _X_ATTRIBUTE_PRINTF(4,0);
+extern _X_EXPORT void
+xf86IDrvMsgVerb(InputInfoPtr dev,
+ MessageType type, int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(4, 5);
+extern _X_EXPORT void
+xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(3, 4);
+extern _X_EXPORT void
+xf86VIDrvMsgVerb(InputInfoPtr dev,
+ MessageType type, int verb, const char *format, va_list args)
+_X_ATTRIBUTE_PRINTF(4, 0);
/* xf86Option.c */
-extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
+extern _X_EXPORT void
+xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
-#endif /* _xf86Xinput_h */
+#endif /* _xf86Xinput_h */
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.c b/xorg-server/hw/xfree86/common/xf86cmap.c
index 191ae6132..cdc8459af 100644
--- a/xorg-server/hw/xfree86/common/xf86cmap.c
+++ b/xorg-server/hw/xfree86/common/xf86cmap.c
@@ -1,1183 +1,1181 @@
-/*
- * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#if defined(_XOPEN_SOURCE) || defined(sun) && defined(__SVR4)
-#include <math.h>
-#else
-#define _XOPEN_SOURCE /* to get prototype for pow on some systems */
-#include <math.h>
-#undef _XOPEN_SOURCE
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include <X11/Xproto.h>
-#include "colormapst.h"
-#include "scrnintstr.h"
-
-#include "resource.h"
-
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86str.h"
-#include "micmap.h"
-#include "xf86Crtc.h"
-
-#ifdef XFreeXDGA
-#include <X11/extensions/xf86dgaproto.h>
-#include "dgaproc.h"
-#endif
-
-#include "xf86cmap.h"
-
-#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
- ((CMapScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, CMapScreenKey))->field)
-#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
- ((pScreen)->field = wrapper)
-
-#define LOAD_PALETTE(pmap) \
- ((pmap == GetInstalledmiColormap(pmap->pScreen)) && \
- ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
- xf86Screens[pmap->pScreen->myNum]->vtSema || pScreenPriv->isDGAmode))
-
-
-typedef struct _CMapLink {
- ColormapPtr cmap;
- struct _CMapLink *next;
-} CMapLink, *CMapLinkPtr;
-
-typedef struct {
- ScrnInfoPtr pScrn;
- CloseScreenProcPtr CloseScreen;
- CreateColormapProcPtr CreateColormap;
- DestroyColormapProcPtr DestroyColormap;
- InstallColormapProcPtr InstallColormap;
- StoreColorsProcPtr StoreColors;
- Bool (*EnterVT)(int, int);
- Bool (*SwitchMode)(int, DisplayModePtr, int);
- int (*SetDGAMode)(int, int, DGADevicePtr);
- xf86ChangeGammaProc *ChangeGamma;
- int maxColors;
- int sigRGBbits;
- int gammaElements;
- LOCO *gamma;
- int *PreAllocIndices;
- CMapLinkPtr maps;
- unsigned int flags;
- Bool isDGAmode;
-} CMapScreenRec, *CMapScreenPtr;
-
-typedef struct {
- int numColors;
- LOCO *colors;
- Bool recalculate;
- int overscan;
-} CMapColormapRec, *CMapColormapPtr;
-
-static DevPrivateKeyRec CMapScreenKeyRec;
-#define CMapScreenKeyRegistered dixPrivateKeyRegistered(&CMapScreenKeyRec)
-#define CMapScreenKey (&CMapScreenKeyRec)
-static DevPrivateKeyRec CMapColormapKeyRec;
-#define CMapColormapKey (&CMapColormapKeyRec)
-
-static void CMapInstallColormap(ColormapPtr);
-static void CMapStoreColors(ColormapPtr, int, xColorItem *);
-static Bool CMapCloseScreen (int, ScreenPtr);
-static Bool CMapCreateColormap (ColormapPtr);
-static void CMapDestroyColormap (ColormapPtr);
-
-static Bool CMapEnterVT(int, int);
-static Bool CMapSwitchMode(int, DisplayModePtr, int);
-#ifdef XFreeXDGA
-static int CMapSetDGAMode(int, int, DGADevicePtr);
-#endif
-static int CMapChangeGamma(int, Gamma);
-
-static void ComputeGamma(CMapScreenPtr);
-static Bool CMapAllocateColormapPrivate(ColormapPtr);
-static void CMapRefreshColors(ColormapPtr, int, int*);
-static void CMapSetOverscan(ColormapPtr, int, int *);
-static void CMapReinstallMap(ColormapPtr);
-static void CMapUnwrapScreen(ScreenPtr pScreen);
-
-
-Bool xf86ColormapAllocatePrivates(ScrnInfoPtr pScrn)
-{
- /* If we support a better colormap system, then pretend we succeeded. */
- if (xf86_crtc_supports_gamma(pScrn))
- return TRUE;
- if (!dixRegisterPrivateKey(&CMapScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- if (!dixRegisterPrivateKey(&CMapColormapKeyRec, PRIVATE_COLORMAP, 0))
- return FALSE;
- return TRUE;
-}
-
-Bool xf86HandleColormaps(
- ScreenPtr pScreen,
- int maxColors,
- int sigRGBbits,
- xf86LoadPaletteProc *loadPalette,
- xf86SetOverscanProc *setOverscan,
- unsigned int flags
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ColormapPtr pDefMap = NULL;
- CMapScreenPtr pScreenPriv;
- LOCO *gamma;
- int *indices;
- int elements;
-
- /* If we support a better colormap system, then pretend we succeeded. */
- if (xf86_crtc_supports_gamma(pScrn))
- return TRUE;
-
- if(!maxColors || !sigRGBbits || !loadPalette)
- return FALSE;
-
- elements = 1 << sigRGBbits;
-
- if(!(gamma = malloc(elements * sizeof(LOCO))))
- return FALSE;
-
- if(!(indices = malloc(maxColors * sizeof(int)))) {
- free(gamma);
- return FALSE;
- }
-
- if(!(pScreenPriv = malloc(sizeof(CMapScreenRec)))) {
- free(gamma);
- free(indices);
- return FALSE;
- }
-
- dixSetPrivate(&pScreen->devPrivates, &CMapScreenKeyRec, pScreenPriv);
-
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreenPriv->CreateColormap = pScreen->CreateColormap;
- pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
- pScreenPriv->InstallColormap = pScreen->InstallColormap;
- pScreenPriv->StoreColors = pScreen->StoreColors;
- pScreen->CloseScreen = CMapCloseScreen;
- pScreen->CreateColormap = CMapCreateColormap;
- pScreen->DestroyColormap = CMapDestroyColormap;
- pScreen->InstallColormap = CMapInstallColormap;
- pScreen->StoreColors = CMapStoreColors;
-
- pScreenPriv->pScrn = pScrn;
- pScrn->LoadPalette = loadPalette;
- pScrn->SetOverscan = setOverscan;
- pScreenPriv->maxColors = maxColors;
- pScreenPriv->sigRGBbits = sigRGBbits;
- pScreenPriv->gammaElements = elements;
- pScreenPriv->gamma = gamma;
- pScreenPriv->PreAllocIndices = indices;
- pScreenPriv->maps = NULL;
- pScreenPriv->flags = flags;
- pScreenPriv->isDGAmode = FALSE;
-
- pScreenPriv->EnterVT = pScrn->EnterVT;
- pScreenPriv->SwitchMode = pScrn->SwitchMode;
- pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
- pScreenPriv->ChangeGamma = pScrn->ChangeGamma;
-
- if (!(flags & CMAP_LOAD_EVEN_IF_OFFSCREEN)) {
- pScrn->EnterVT = CMapEnterVT;
- if ((flags & CMAP_RELOAD_ON_MODE_SWITCH) && pScrn->SwitchMode)
- pScrn->SwitchMode = CMapSwitchMode;
- }
-#ifdef XFreeXDGA
- pScrn->SetDGAMode = CMapSetDGAMode;
-#endif
- pScrn->ChangeGamma = CMapChangeGamma;
-
- ComputeGamma(pScreenPriv);
-
- /* get the default map */
- dixLookupResourceByType((pointer *)&pDefMap, pScreen->defColormap,
- RT_COLORMAP, serverClient, DixInstallAccess);
-
- if(!CMapAllocateColormapPrivate(pDefMap)) {
- CMapUnwrapScreen(pScreen);
- return FALSE;
- }
-
- /* Force the initial map to be loaded */
- SetInstalledmiColormap(pScreen, NULL);
- CMapInstallColormap(pDefMap);
- return TRUE;
-}
-
-
-/**** Screen functions ****/
-
-
-static Bool
-CMapCloseScreen (int i, ScreenPtr pScreen)
-{
- CMapUnwrapScreen(pScreen);
-
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-static Bool
-CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv)
-{
- if (pVisual->nplanes > 16)
- return TRUE;
- return ((1 << pVisual->nplanes) > pScreenPriv->maxColors);
-}
-
-static Bool
-CMapAllocateColormapPrivate(ColormapPtr pmap)
-{
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pmap->pScreen->devPrivates, CMapScreenKey);
- CMapColormapPtr pColPriv;
- CMapLinkPtr pLink;
- int numColors;
- LOCO *colors;
-
- if (CMapColormapUseMax(pmap->pVisual, pScreenPriv))
- numColors = pmap->pVisual->ColormapEntries;
- else
- numColors = 1 << pmap->pVisual->nplanes;
-
- if(!(colors = malloc(numColors * sizeof(LOCO))))
- return FALSE;
-
- if(!(pColPriv = malloc(sizeof(CMapColormapRec)))) {
- free(colors);
- return FALSE;
- }
-
- dixSetPrivate(&pmap->devPrivates, CMapColormapKey, pColPriv);
-
- pColPriv->numColors = numColors;
- pColPriv->colors = colors;
- pColPriv->recalculate = TRUE;
- pColPriv->overscan = -1;
-
- /* add map to list */
- pLink = malloc(sizeof(CMapLink));
- if(pLink) {
- pLink->cmap = pmap;
- pLink->next = pScreenPriv->maps;
- pScreenPriv->maps = pLink;
- }
-
- return TRUE;
-}
-
-static Bool
-CMapCreateColormap (ColormapPtr pmap)
-{
- ScreenPtr pScreen = pmap->pScreen;
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
- Bool ret = FALSE;
-
- pScreen->CreateColormap = pScreenPriv->CreateColormap;
- if((*pScreen->CreateColormap)(pmap)) {
- if(CMapAllocateColormapPrivate(pmap))
- ret = TRUE;
- }
- pScreen->CreateColormap = CMapCreateColormap;
-
- return ret;
-}
-
-static void
-CMapDestroyColormap (ColormapPtr cmap)
-{
- ScreenPtr pScreen = cmap->pScreen;
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
- CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
- &cmap->devPrivates, CMapColormapKey);
- CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
-
- if(pColPriv) {
- free(pColPriv->colors);
- free(pColPriv);
- }
-
- /* remove map from list */
- while(pLink) {
- if(pLink->cmap == cmap) {
- if(prevLink)
- prevLink->next = pLink->next;
- else
- pScreenPriv->maps = pLink->next;
- free(pLink);
- break;
- }
- prevLink = pLink;
- pLink = pLink->next;
- }
-
- if(pScreenPriv->DestroyColormap) {
- pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
- (*pScreen->DestroyColormap)(cmap);
- pScreen->DestroyColormap = CMapDestroyColormap;
- }
-}
-
-
-
-static void
-CMapStoreColors(
- ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs
-){
- ScreenPtr pScreen = pmap->pScreen;
- VisualPtr pVisual = pmap->pVisual;
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
- int *indices = pScreenPriv->PreAllocIndices;
- int num = ndef;
-
- /* At the moment this isn't necessary since there's nobody below us */
- pScreen->StoreColors = pScreenPriv->StoreColors;
- (*pScreen->StoreColors)(pmap, ndef, pdefs);
- pScreen->StoreColors = CMapStoreColors;
-
- /* should never get here for these */
- if( (pVisual->class == TrueColor) ||
- (pVisual->class == StaticColor) ||
- (pVisual->class == StaticGray))
- return;
-
- if(pVisual->class == DirectColor) {
- CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
- &pmap->devPrivates, CMapColormapKey);
- int i;
-
- if (CMapColormapUseMax(pVisual, pScreenPriv)) {
- int index;
-
- num = 0;
- while(ndef--) {
- if(pdefs[ndef].flags & DoRed) {
- index = (pdefs[ndef].pixel & pVisual->redMask) >>
- pVisual->offsetRed;
- i = num;
- while(i--)
- if(indices[i] == index) break;
- if(i == -1)
- indices[num++] = index;
- }
- if(pdefs[ndef].flags & DoGreen) {
- index = (pdefs[ndef].pixel & pVisual->greenMask) >>
- pVisual->offsetGreen;
- i = num;
- while(i--)
- if(indices[i] == index) break;
- if(i == -1)
- indices[num++] = index;
- }
- if(pdefs[ndef].flags & DoBlue) {
- index = (pdefs[ndef].pixel & pVisual->blueMask) >>
- pVisual->offsetBlue;
- i = num;
- while(i--)
- if(indices[i] == index) break;
- if(i == -1)
- indices[num++] = index;
- }
- }
-
- } else {
- /* not really as overkill as it seems */
- num = pColPriv->numColors;
- for(i = 0; i < pColPriv->numColors; i++)
- indices[i] = i;
- }
- } else {
- while(ndef--)
- indices[ndef] = pdefs[ndef].pixel;
- }
-
- CMapRefreshColors(pmap, num, indices);
-}
-
-
-static void
-CMapInstallColormap(ColormapPtr pmap)
-{
- ScreenPtr pScreen = pmap->pScreen;
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
-
- if (pmap == GetInstalledmiColormap(pmap->pScreen))
- return;
-
- pScreen->InstallColormap = pScreenPriv->InstallColormap;
- (*pScreen->InstallColormap)(pmap);
- pScreen->InstallColormap = CMapInstallColormap;
-
- /* Important. We let the lower layers, namely DGA,
- overwrite the choice of Colormap to install */
- if (GetInstalledmiColormap(pmap->pScreen))
- pmap = GetInstalledmiColormap(pmap->pScreen);
-
- if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
- (pmap->pVisual->class == TrueColor) &&
- CMapColormapUseMax(pmap->pVisual, pScreenPriv))
- return;
-
- if(LOAD_PALETTE(pmap))
- CMapReinstallMap(pmap);
-}
-
-
-/**** ScrnInfoRec functions ****/
-
-static Bool
-CMapEnterVT(int index, int flags)
-{
- ScrnInfoPtr pScrn = xf86Screens[index];
- ScreenPtr pScreen = screenInfo.screens[index];
- Bool ret;
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
-
- pScrn->EnterVT = pScreenPriv->EnterVT;
- ret = (*pScreenPriv->EnterVT)(index, flags);
- pScreenPriv->EnterVT = pScrn->EnterVT;
- pScrn->EnterVT = CMapEnterVT;
- if(ret) {
- if(GetInstalledmiColormap(pScreen))
- CMapReinstallMap(GetInstalledmiColormap(pScreen));
- return TRUE;
- }
- return FALSE;
-}
-
-
-static Bool
-CMapSwitchMode(int index, DisplayModePtr mode, int flags)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
-
- if((*pScreenPriv->SwitchMode)(index, mode, flags)) {
- if(GetInstalledmiColormap(pScreen))
- CMapReinstallMap(GetInstalledmiColormap(pScreen));
- return TRUE;
- }
- return FALSE;
-}
-
-#ifdef XFreeXDGA
-static int
-CMapSetDGAMode(int index, int num, DGADevicePtr dev)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
- int ret;
-
- ret = (*pScreenPriv->SetDGAMode)(index, num, dev);
-
- pScreenPriv->isDGAmode = DGAActive(index);
-
- if(!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen)
- && xf86Screens[pScreen->myNum]->vtSema)
- CMapReinstallMap(GetInstalledmiColormap(pScreen));
-
- return ret;
-}
-#endif
-
-
-/**** Utilities ****/
-
-static void
-CMapReinstallMap(ColormapPtr pmap)
-{
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pmap->pScreen->devPrivates, CMapScreenKey);
- CMapColormapPtr cmapPriv = (CMapColormapPtr)dixLookupPrivate(
- &pmap->devPrivates, CMapColormapKey);
- ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
- int i = cmapPriv->numColors;
- int *indices = pScreenPriv->PreAllocIndices;
-
- while(i--)
- indices[i] = i;
-
- if(cmapPriv->recalculate)
- CMapRefreshColors(pmap, cmapPriv->numColors, indices);
- else {
- (*pScrn->LoadPalette)(pScrn, cmapPriv->numColors,
- indices, cmapPriv->colors, pmap->pVisual);
- if (pScrn->SetOverscan) {
-#ifdef DEBUGOVERSCAN
- ErrorF("SetOverscan() called from CMapReinstallMap\n");
-#endif
- pScrn->SetOverscan(pScrn, cmapPriv->overscan);
- }
- }
-
- cmapPriv->recalculate = FALSE;
-}
-
-
-static void
-CMapRefreshColors(ColormapPtr pmap, int defs, int* indices)
-{
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pmap->pScreen->devPrivates, CMapScreenKey);
- CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
- &pmap->devPrivates, CMapColormapKey);
- VisualPtr pVisual = pmap->pVisual;
- ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
- int numColors, i;
- LOCO *gamma, *colors;
- EntryPtr entry;
- int reds, greens, blues, maxValue, index, shift;
-
- numColors = pColPriv->numColors;
- shift = 16 - pScreenPriv->sigRGBbits;
- maxValue = (1 << pScreenPriv->sigRGBbits) - 1;
- gamma = pScreenPriv->gamma;
- colors = pColPriv->colors;
-
- reds = pVisual->redMask >> pVisual->offsetRed;
- greens = pVisual->greenMask >> pVisual->offsetGreen;
- blues = pVisual->blueMask >> pVisual->offsetBlue;
-
- switch(pVisual->class) {
- case StaticGray:
- for(i = 0; i < numColors; i++) {
- index = (i+1) * maxValue / numColors;
- colors[i].red = gamma[index].red;
- colors[i].green = gamma[index].green;
- colors[i].blue = gamma[index].blue;
- }
- break;
- case TrueColor:
- if (CMapColormapUseMax(pVisual, pScreenPriv)) {
- for(i = 0; i <= reds; i++)
- colors[i].red = gamma[i * maxValue / reds].red;
- for(i = 0; i <= greens; i++)
- colors[i].green = gamma[i * maxValue / greens].green;
- for(i = 0; i <= blues; i++)
- colors[i].blue = gamma[i * maxValue / blues].blue;
- break;
- }
- for(i = 0; i < numColors; i++) {
- colors[i].red = gamma[((i >> pVisual->offsetRed) & reds) *
- maxValue / reds].red;
- colors[i].green = gamma[((i >> pVisual->offsetGreen) & greens) *
- maxValue / greens].green;
- colors[i].blue = gamma[((i >> pVisual->offsetBlue) & blues) *
- maxValue / blues].blue;
- }
- break;
- case StaticColor:
- case PseudoColor:
- case GrayScale:
- for(i = 0; i < defs; i++) {
- index = indices[i];
- entry = (EntryPtr)&pmap->red[index];
-
- if(entry->fShared) {
- colors[index].red =
- gamma[entry->co.shco.red->color >> shift].red;
- colors[index].green =
- gamma[entry->co.shco.green->color >> shift].green;
- colors[index].blue =
- gamma[entry->co.shco.blue->color >> shift].blue;
- } else {
- colors[index].red =
- gamma[entry->co.local.red >> shift].red;
- colors[index].green =
- gamma[entry->co.local.green >> shift].green;
- colors[index].blue =
- gamma[entry->co.local.blue >> shift].blue;
- }
- }
- break;
- case DirectColor:
- if (CMapColormapUseMax(pVisual, pScreenPriv)) {
- for(i = 0; i < defs; i++) {
- index = indices[i];
- if(index <= reds)
- colors[index].red =
- gamma[pmap->red[index].co.local.red >> shift].red;
- if(index <= greens)
- colors[index].green =
- gamma[pmap->green[index].co.local.green >> shift].green;
- if(index <= blues)
- colors[index].blue =
- gamma[pmap->blue[index].co.local.blue >> shift].blue;
-
- }
- break;
- }
- for(i = 0; i < defs; i++) {
- index = indices[i];
-
- colors[index].red = gamma[pmap->red[
- (index >> pVisual->offsetRed) & reds
- ].co.local.red >> shift].red;
- colors[index].green = gamma[pmap->green[
- (index >> pVisual->offsetGreen) & greens
- ].co.local.green >> shift].green;
- colors[index].blue = gamma[pmap->blue[
- (index >> pVisual->offsetBlue) & blues
- ].co.local.blue >> shift].blue;
- }
- break;
- }
-
-
- if(LOAD_PALETTE(pmap))
- (*pScrn->LoadPalette)(pScreenPriv->pScrn, defs, indices,
- colors, pmap->pVisual);
-
- if (pScrn->SetOverscan)
- CMapSetOverscan(pmap, defs, indices);
-
-}
-
-static Bool
-CMapCompareColors(LOCO *color1, LOCO *color2)
-{
- /* return TRUE if the color1 is "closer" to black than color2 */
-#ifdef DEBUGOVERSCAN
- ErrorF("#%02x%02x%02x vs #%02x%02x%02x (%d vs %d)\n",
- color1->red, color1->green, color1->blue,
- color2->red, color2->green, color2->blue,
- color1->red + color1->green + color1->blue,
- color2->red + color2->green + color2->blue);
-#endif
- return (color1->red + color1->green + color1->blue <
- color2->red + color2->green + color2->blue);
-}
-
-static void
-CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
-{
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pmap->pScreen->devPrivates, CMapScreenKey);
- CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
- &pmap->devPrivates, CMapColormapKey);
- ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
- VisualPtr pVisual = pmap->pVisual;
- int i;
- LOCO *colors;
- int index;
- Bool newOverscan = FALSE;
- int overscan, tmpOverscan;
-
- colors = pColPriv->colors;
- overscan = pColPriv->overscan;
-
- /*
- * Search for a new overscan index in the following cases:
- *
- * - The index hasn't yet been initialised.  In this case search
- * for an index that is black or a close match to black.
- *
- * - The colour of the old index is changed. In this case search
- * all indices for a black or close match to black.
- *
- * - The colour of the old index wasn't black. In this case only
- * search the indices that were changed for a better match to black.
- */
-
- switch (pVisual->class) {
- case StaticGray:
- case TrueColor:
- /* Should only come here once. Initialise the overscan index to 0 */
- overscan = 0;
- newOverscan = TRUE;
- break;
- case StaticColor:
- /*
- * Only come here once, but search for the overscan in the same way
- * as for the other cases.
- */
- case DirectColor:
- case PseudoColor:
- case GrayScale:
- if (overscan < 0 || overscan > pScreenPriv->maxColors - 1) {
- /* Uninitialised */
- newOverscan = TRUE;
- } else {
- /* Check if the overscan was changed */
- for (i = 0; i < defs; i++) {
- index = indices[i];
- if (index == overscan) {
- newOverscan = TRUE;
- break;
- }
- }
- }
- if (newOverscan) {
- /* The overscan is either uninitialised or it has been changed */
-
- if (overscan < 0 || overscan > pScreenPriv->maxColors - 1)
- tmpOverscan = pScreenPriv->maxColors - 1;
- else
- tmpOverscan = overscan;
-
- /* search all entries for a close match to black */
- for (i = pScreenPriv->maxColors - 1; i >= 0; i--) {
- if (colors[i].red == 0 && colors[i].green == 0 &&
- colors[i].blue == 0) {
- overscan = i;
-#ifdef DEBUGOVERSCAN
- ErrorF("Black found at index 0x%02x\n", i);
-#endif
- break;
- } else {
-#ifdef DEBUGOVERSCAN
- ErrorF("0x%02x: ", i);
-#endif
- if (CMapCompareColors(&colors[i], &colors[tmpOverscan])) {
- tmpOverscan = i;
-#ifdef DEBUGOVERSCAN
- ErrorF("possible \"Black\" at index 0x%02x\n", i);
-#endif
- }
- }
- }
- if (i < 0)
- overscan = tmpOverscan;
- } else {
- /* Check of the old overscan wasn't black */
- if (colors[overscan].red != 0 || colors[overscan].green != 0 ||
- colors[overscan].blue != 0) {
- int oldOverscan = tmpOverscan = overscan;
- /* See of there is now a better match */
- for (i = 0; i < defs; i++) {
- index = indices[i];
- if (colors[index].red == 0 && colors[index].green == 0 &&
- colors[index].blue == 0) {
- overscan = index;
-#ifdef DEBUGOVERSCAN
- ErrorF("Black found at index 0x%02x\n", index);
-#endif
- break;
- } else {
-#ifdef DEBUGOVERSCAN
- ErrorF("0x%02x: ", index);
-#endif
- if (CMapCompareColors(&colors[index],
- &colors[tmpOverscan])) {
- tmpOverscan = index;
-#ifdef DEBUGOVERSCAN
- ErrorF("possible \"Black\" at index 0x%02x\n",
- index);
-#endif
- }
- }
- }
- if (i == defs)
- overscan = tmpOverscan;
- if (overscan != oldOverscan)
- newOverscan = TRUE;
- }
- }
- break;
- }
- if (newOverscan) {
- pColPriv->overscan = overscan;
- if (LOAD_PALETTE(pmap)) {
-#ifdef DEBUGOVERSCAN
- ErrorF("SetOverscan() called from CmapSetOverscan\n");
-#endif
- pScrn->SetOverscan(pScreenPriv->pScrn, overscan);
- }
- }
-}
-
-static void
-CMapUnwrapScreen(ScreenPtr pScreen)
-{
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- pScreen->CreateColormap = pScreenPriv->CreateColormap;
- pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
- pScreen->InstallColormap = pScreenPriv->InstallColormap;
- pScreen->StoreColors = pScreenPriv->StoreColors;
-
- pScrn->EnterVT = pScreenPriv->EnterVT;
- pScrn->SwitchMode = pScreenPriv->SwitchMode;
- pScrn->SetDGAMode = pScreenPriv->SetDGAMode;
- pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
-
- free(pScreenPriv->gamma);
- free(pScreenPriv->PreAllocIndices);
- free(pScreenPriv);
-}
-
-
-static void
-ComputeGamma(CMapScreenPtr priv)
-{
- int elements = priv->gammaElements - 1;
- double RedGamma, GreenGamma, BlueGamma;
- int i;
-
-#ifndef DONT_CHECK_GAMMA
- /* This check is to catch drivers that are not initialising pScrn->gamma */
- if (priv->pScrn->gamma.red < GAMMA_MIN ||
- priv->pScrn->gamma.red > GAMMA_MAX ||
- priv->pScrn->gamma.green < GAMMA_MIN ||
- priv->pScrn->gamma.green > GAMMA_MAX ||
- priv->pScrn->gamma.blue < GAMMA_MIN ||
- priv->pScrn->gamma.blue > GAMMA_MAX) {
-
- xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
- "The %s driver didn't call xf86SetGamma() to initialise\n"
- "\tthe gamma values.\n", priv->pScrn->driverName);
- xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
- "PLEASE FIX THE `%s' DRIVER!\n", priv->pScrn->driverName);
- priv->pScrn->gamma.red = 1.0;
- priv->pScrn->gamma.green = 1.0;
- priv->pScrn->gamma.blue = 1.0;
- }
-#endif
-
- RedGamma = 1.0 / (double)priv->pScrn->gamma.red;
- GreenGamma = 1.0 / (double)priv->pScrn->gamma.green;
- BlueGamma = 1.0 / (double)priv->pScrn->gamma.blue;
-
- for(i = 0; i <= elements; i++) {
- if(RedGamma == 1.0)
- priv->gamma[i].red = i;
- else
- priv->gamma[i].red = (CARD16)(pow((double)i/(double)elements,
- RedGamma) * (double)elements + 0.5);
-
- if(GreenGamma == 1.0)
- priv->gamma[i].green = i;
- else
- priv->gamma[i].green = (CARD16)(pow((double)i/(double)elements,
- GreenGamma) * (double)elements + 0.5);
-
- if(BlueGamma == 1.0)
- priv->gamma[i].blue = i;
- else
- priv->gamma[i].blue = (CARD16)(pow((double)i/(double)elements,
- BlueGamma) * (double)elements + 0.5);
- }
-}
-
-
-int
-CMapChangeGamma(
- int index,
- Gamma gamma
-){
- int ret = Success;
- ScrnInfoPtr pScrn = xf86Screens[index];
- ScreenPtr pScreen = pScrn->pScreen;
- CMapColormapPtr pColPriv;
- CMapScreenPtr pScreenPriv;
- CMapLinkPtr pLink;
-
- /* Is this sufficient checking ? */
- if(!CMapScreenKeyRegistered)
- return BadImplementation;
-
- pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- CMapScreenKey);
- if(!pScreenPriv)
- return BadImplementation;
-
- if (gamma.red < GAMMA_MIN || gamma.red > GAMMA_MAX ||
- gamma.green < GAMMA_MIN || gamma.green > GAMMA_MAX ||
- gamma.blue < GAMMA_MIN || gamma.blue > GAMMA_MAX)
- return BadValue;
-
- pScrn->gamma.red = gamma.red;
- pScrn->gamma.green = gamma.green;
- pScrn->gamma.blue = gamma.blue;
-
- ComputeGamma(pScreenPriv);
-
- /* mark all colormaps on this screen */
- pLink = pScreenPriv->maps;
- while(pLink) {
- pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
- CMapColormapKey);
- pColPriv->recalculate = TRUE;
- pLink = pLink->next;
- }
-
- if(GetInstalledmiColormap(pScreen) &&
- ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
- pScrn->vtSema || pScreenPriv->isDGAmode)) {
- ColormapPtr pMap = GetInstalledmiColormap(pScreen);
-
- if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
- (pMap->pVisual->class == TrueColor) &&
- CMapColormapUseMax(pMap->pVisual, pScreenPriv)) {
-
- /* if the current map doesn't have a palette look
- for another map to change the gamma on. */
-
- pLink = pScreenPriv->maps;
- while(pLink) {
- if(pLink->cmap->pVisual->class == PseudoColor)
- break;
- pLink = pLink->next;
- }
-
- if(pLink) {
- /* need to trick CMapRefreshColors() into thinking
- this is the currently installed map */
- SetInstalledmiColormap(pScreen, pLink->cmap);
- CMapReinstallMap(pLink->cmap);
- SetInstalledmiColormap(pScreen, pMap);
- }
- } else
- CMapReinstallMap(pMap);
- }
-
- pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
- if (pScrn->ChangeGamma)
- ret = pScrn->ChangeGamma(index, gamma);
- pScrn->ChangeGamma = CMapChangeGamma;
-
- return ret;
-}
-
-
-static void
-ComputeGammaRamp (
- CMapScreenPtr priv,
- unsigned short *red,
- unsigned short *green,
- unsigned short *blue
-){
- int elements = priv->gammaElements;
- LOCO *entry = priv->gamma;
- int shift = 16 - priv->sigRGBbits;
-
- while(elements--) {
- entry->red = *(red++) >> shift;
- entry->green = *(green++) >> shift;
- entry->blue = *(blue++) >> shift;
- entry++;
- }
-}
-
-int
-xf86ChangeGammaRamp(
- ScreenPtr pScreen,
- int size,
- unsigned short *red,
- unsigned short *green,
- unsigned short *blue
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- CMapColormapPtr pColPriv;
- CMapScreenPtr pScreenPriv;
- CMapLinkPtr pLink;
-
- if (xf86_crtc_supports_gamma(pScrn)) {
- RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
-
- if (crtc) {
- if (crtc->gammaSize != size)
- return BadValue;
-
- RRCrtcGammaSet(crtc, red, green, blue);
-
- return Success;
- }
- }
-
- if(!CMapScreenKeyRegistered)
- return BadImplementation;
-
- pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- CMapScreenKey);
- if(!pScreenPriv)
- return BadImplementation;
-
- if(pScreenPriv->gammaElements != size)
- return BadValue;
-
- ComputeGammaRamp(pScreenPriv, red, green, blue);
-
- /* mark all colormaps on this screen */
- pLink = pScreenPriv->maps;
- while(pLink) {
- pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
- CMapColormapKey);
- pColPriv->recalculate = TRUE;
- pLink = pLink->next;
- }
-
- if(GetInstalledmiColormap(pScreen) &&
- ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
- pScrn->vtSema || pScreenPriv->isDGAmode)) {
- ColormapPtr pMap = GetInstalledmiColormap(pScreen);
-
- if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
- (pMap->pVisual->class == TrueColor) &&
- CMapColormapUseMax(pMap->pVisual, pScreenPriv)) {
-
- /* if the current map doesn't have a palette look
- for another map to change the gamma on. */
-
- pLink = pScreenPriv->maps;
- while(pLink) {
- if(pLink->cmap->pVisual->class == PseudoColor)
- break;
- pLink = pLink->next;
- }
-
- if(pLink) {
- /* need to trick CMapRefreshColors() into thinking
- this is the currently installed map */
- SetInstalledmiColormap(pScreen, pLink->cmap);
- CMapReinstallMap(pLink->cmap);
- SetInstalledmiColormap(pScreen, pMap);
- }
- } else
- CMapReinstallMap(pMap);
- }
-
- return Success;
-}
-
-int
-xf86GetGammaRampSize(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- CMapScreenPtr pScreenPriv;
-
- if (xf86_crtc_supports_gamma(pScrn)) {
- RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
-
- if (crtc)
- return crtc->gammaSize;
- }
-
- if(!CMapScreenKeyRegistered) return 0;
-
- pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- CMapScreenKey);
- if(!pScreenPriv) return 0;
-
- return pScreenPriv->gammaElements;
-}
-
-int
-xf86GetGammaRamp(
- ScreenPtr pScreen,
- int size,
- unsigned short *red,
- unsigned short *green,
- unsigned short *blue
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- CMapScreenPtr pScreenPriv;
- LOCO *entry;
- int shift, sigbits;
-
- if (xf86_crtc_supports_gamma(pScrn)) {
- RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
-
- if (crtc) {
- if (crtc->gammaSize < size)
- return BadValue;
-
- if (!RRCrtcGammaGet(crtc))
- return BadImplementation;
-
- memcpy(red, crtc->gammaRed, size * sizeof(*red));
- memcpy(green, crtc->gammaGreen, size * sizeof(*green));
- memcpy(blue, crtc->gammaBlue, size * sizeof(*blue));
-
- return Success;
- }
- }
-
- if(!CMapScreenKeyRegistered)
- return BadImplementation;
-
- pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- CMapScreenKey);
- if(!pScreenPriv)
- return BadImplementation;
-
- if(size > pScreenPriv->gammaElements)
- return BadValue;
-
- entry = pScreenPriv->gamma;
- sigbits = pScreenPriv->sigRGBbits;
-
- while(size--) {
- *red = entry->red << (16 - sigbits);
- *green = entry->green << (16 - sigbits);
- *blue = entry->blue << (16 - sigbits);
- shift = sigbits;
- while(shift < 16) {
- *red |= *red >> shift;
- *green |= *green >> shift;
- *blue |= *blue >> shift;
- shift += sigbits;
- }
- red++; green++; blue++;
- entry++;
- }
-
- return Success;
-}
-
-int
-xf86ChangeGamma(
- ScreenPtr pScreen,
- Gamma gamma
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
- if(pScrn->ChangeGamma)
- return (*pScrn->ChangeGamma)(pScreen->myNum, gamma);
-
- return BadImplementation;
-}
+/*
+ * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(sun) && defined(__SVR4)
+#include <math.h>
+#else
+#define _XOPEN_SOURCE /* to get prototype for pow on some systems */
+#include <math.h>
+#undef _XOPEN_SOURCE
+#endif
+
+#include <X11/X.h>
+#include "misc.h"
+#include <X11/Xproto.h>
+#include "colormapst.h"
+#include "scrnintstr.h"
+
+#include "resource.h"
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86str.h"
+#include "micmap.h"
+#include "xf86Crtc.h"
+
+#ifdef XFreeXDGA
+#include <X11/extensions/xf86dgaproto.h>
+#include "dgaproc.h"
+#endif
+
+#include "xf86cmap.h"
+
+#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
+ ((CMapScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, CMapScreenKey))->field)
+#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
+ ((pScreen)->field = wrapper)
+
+#define LOAD_PALETTE(pmap) \
+ ((pmap == GetInstalledmiColormap(pmap->pScreen)) && \
+ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
+ xf86Screens[pmap->pScreen->myNum]->vtSema || pScreenPriv->isDGAmode))
+
+typedef struct _CMapLink {
+ ColormapPtr cmap;
+ struct _CMapLink *next;
+} CMapLink, *CMapLinkPtr;
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ CloseScreenProcPtr CloseScreen;
+ CreateColormapProcPtr CreateColormap;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ StoreColorsProcPtr StoreColors;
+ Bool (*EnterVT) (int, int);
+ Bool (*SwitchMode) (int, DisplayModePtr, int);
+ int (*SetDGAMode) (int, int, DGADevicePtr);
+ xf86ChangeGammaProc *ChangeGamma;
+ int maxColors;
+ int sigRGBbits;
+ int gammaElements;
+ LOCO *gamma;
+ int *PreAllocIndices;
+ CMapLinkPtr maps;
+ unsigned int flags;
+ Bool isDGAmode;
+} CMapScreenRec, *CMapScreenPtr;
+
+typedef struct {
+ int numColors;
+ LOCO *colors;
+ Bool recalculate;
+ int overscan;
+} CMapColormapRec, *CMapColormapPtr;
+
+static DevPrivateKeyRec CMapScreenKeyRec;
+
+#define CMapScreenKeyRegistered dixPrivateKeyRegistered(&CMapScreenKeyRec)
+#define CMapScreenKey (&CMapScreenKeyRec)
+static DevPrivateKeyRec CMapColormapKeyRec;
+
+#define CMapColormapKey (&CMapColormapKeyRec)
+
+static void CMapInstallColormap(ColormapPtr);
+static void CMapStoreColors(ColormapPtr, int, xColorItem *);
+static Bool CMapCloseScreen(int, ScreenPtr);
+static Bool CMapCreateColormap(ColormapPtr);
+static void CMapDestroyColormap(ColormapPtr);
+
+static Bool CMapEnterVT(int, int);
+static Bool CMapSwitchMode(int, DisplayModePtr, int);
+
+#ifdef XFreeXDGA
+static int CMapSetDGAMode(int, int, DGADevicePtr);
+#endif
+static int CMapChangeGamma(int, Gamma);
+
+static void ComputeGamma(CMapScreenPtr);
+static Bool CMapAllocateColormapPrivate(ColormapPtr);
+static void CMapRefreshColors(ColormapPtr, int, int *);
+static void CMapSetOverscan(ColormapPtr, int, int *);
+static void CMapReinstallMap(ColormapPtr);
+static void CMapUnwrapScreen(ScreenPtr pScreen);
+
+Bool
+xf86ColormapAllocatePrivates(ScrnInfoPtr pScrn)
+{
+ /* If we support a better colormap system, then pretend we succeeded. */
+ if (xf86_crtc_supports_gamma(pScrn))
+ return TRUE;
+ if (!dixRegisterPrivateKey(&CMapScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&CMapColormapKeyRec, PRIVATE_COLORMAP, 0))
+ return FALSE;
+ return TRUE;
+}
+
+Bool
+xf86HandleColormaps(ScreenPtr pScreen,
+ int maxColors,
+ int sigRGBbits,
+ xf86LoadPaletteProc * loadPalette,
+ xf86SetOverscanProc * setOverscan, unsigned int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ColormapPtr pDefMap = NULL;
+ CMapScreenPtr pScreenPriv;
+ LOCO *gamma;
+ int *indices;
+ int elements;
+
+ /* If we support a better colormap system, then pretend we succeeded. */
+ if (xf86_crtc_supports_gamma(pScrn))
+ return TRUE;
+
+ if (!maxColors || !sigRGBbits || !loadPalette)
+ return FALSE;
+
+ elements = 1 << sigRGBbits;
+
+ if (!(gamma = malloc(elements * sizeof(LOCO))))
+ return FALSE;
+
+ if (!(indices = malloc(maxColors * sizeof(int)))) {
+ free(gamma);
+ return FALSE;
+ }
+
+ if (!(pScreenPriv = malloc(sizeof(CMapScreenRec)))) {
+ free(gamma);
+ free(indices);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pScreen->devPrivates, &CMapScreenKeyRec, pScreenPriv);
+
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreenPriv->CreateColormap = pScreen->CreateColormap;
+ pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
+ pScreenPriv->InstallColormap = pScreen->InstallColormap;
+ pScreenPriv->StoreColors = pScreen->StoreColors;
+ pScreen->CloseScreen = CMapCloseScreen;
+ pScreen->CreateColormap = CMapCreateColormap;
+ pScreen->DestroyColormap = CMapDestroyColormap;
+ pScreen->InstallColormap = CMapInstallColormap;
+ pScreen->StoreColors = CMapStoreColors;
+
+ pScreenPriv->pScrn = pScrn;
+ pScrn->LoadPalette = loadPalette;
+ pScrn->SetOverscan = setOverscan;
+ pScreenPriv->maxColors = maxColors;
+ pScreenPriv->sigRGBbits = sigRGBbits;
+ pScreenPriv->gammaElements = elements;
+ pScreenPriv->gamma = gamma;
+ pScreenPriv->PreAllocIndices = indices;
+ pScreenPriv->maps = NULL;
+ pScreenPriv->flags = flags;
+ pScreenPriv->isDGAmode = FALSE;
+
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScreenPriv->SwitchMode = pScrn->SwitchMode;
+ pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
+ pScreenPriv->ChangeGamma = pScrn->ChangeGamma;
+
+ if (!(flags & CMAP_LOAD_EVEN_IF_OFFSCREEN)) {
+ pScrn->EnterVT = CMapEnterVT;
+ if ((flags & CMAP_RELOAD_ON_MODE_SWITCH) && pScrn->SwitchMode)
+ pScrn->SwitchMode = CMapSwitchMode;
+ }
+#ifdef XFreeXDGA
+ pScrn->SetDGAMode = CMapSetDGAMode;
+#endif
+ pScrn->ChangeGamma = CMapChangeGamma;
+
+ ComputeGamma(pScreenPriv);
+
+ /* get the default map */
+ dixLookupResourceByType((pointer *) &pDefMap, pScreen->defColormap,
+ RT_COLORMAP, serverClient, DixInstallAccess);
+
+ if (!CMapAllocateColormapPrivate(pDefMap)) {
+ CMapUnwrapScreen(pScreen);
+ return FALSE;
+ }
+
+ /* Force the initial map to be loaded */
+ SetInstalledmiColormap(pScreen, NULL);
+ CMapInstallColormap(pDefMap);
+ return TRUE;
+}
+
+/**** Screen functions ****/
+
+static Bool
+CMapCloseScreen(int i, ScreenPtr pScreen)
+{
+ CMapUnwrapScreen(pScreen);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static Bool
+CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv)
+{
+ if (pVisual->nplanes > 16)
+ return TRUE;
+ return ((1 << pVisual->nplanes) > pScreenPriv->maxColors);
+}
+
+static Bool
+CMapAllocateColormapPrivate(ColormapPtr pmap)
+{
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pmap->pScreen->devPrivates,
+ CMapScreenKey);
+ CMapColormapPtr pColPriv;
+ CMapLinkPtr pLink;
+ int numColors;
+ LOCO *colors;
+
+ if (CMapColormapUseMax(pmap->pVisual, pScreenPriv))
+ numColors = pmap->pVisual->ColormapEntries;
+ else
+ numColors = 1 << pmap->pVisual->nplanes;
+
+ if (!(colors = malloc(numColors * sizeof(LOCO))))
+ return FALSE;
+
+ if (!(pColPriv = malloc(sizeof(CMapColormapRec)))) {
+ free(colors);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pmap->devPrivates, CMapColormapKey, pColPriv);
+
+ pColPriv->numColors = numColors;
+ pColPriv->colors = colors;
+ pColPriv->recalculate = TRUE;
+ pColPriv->overscan = -1;
+
+ /* add map to list */
+ pLink = malloc(sizeof(CMapLink));
+ if (pLink) {
+ pLink->cmap = pmap;
+ pLink->next = pScreenPriv->maps;
+ pScreenPriv->maps = pLink;
+ }
+
+ return TRUE;
+}
+
+static Bool
+CMapCreateColormap(ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
+ Bool ret = FALSE;
+
+ pScreen->CreateColormap = pScreenPriv->CreateColormap;
+ if ((*pScreen->CreateColormap) (pmap)) {
+ if (CMapAllocateColormapPrivate(pmap))
+ ret = TRUE;
+ }
+ pScreen->CreateColormap = CMapCreateColormap;
+
+ return ret;
+}
+
+static void
+CMapDestroyColormap(ColormapPtr cmap)
+{
+ ScreenPtr pScreen = cmap->pScreen;
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv =
+ (CMapColormapPtr) dixLookupPrivate(&cmap->devPrivates, CMapColormapKey);
+ CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
+
+ if (pColPriv) {
+ free(pColPriv->colors);
+ free(pColPriv);
+ }
+
+ /* remove map from list */
+ while (pLink) {
+ if (pLink->cmap == cmap) {
+ if (prevLink)
+ prevLink->next = pLink->next;
+ else
+ pScreenPriv->maps = pLink->next;
+ free(pLink);
+ break;
+ }
+ prevLink = pLink;
+ pLink = pLink->next;
+ }
+
+ if (pScreenPriv->DestroyColormap) {
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ (*pScreen->DestroyColormap) (cmap);
+ pScreen->DestroyColormap = CMapDestroyColormap;
+ }
+}
+
+static void
+CMapStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ VisualPtr pVisual = pmap->pVisual;
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
+ int *indices = pScreenPriv->PreAllocIndices;
+ int num = ndef;
+
+ /* At the moment this isn't necessary since there's nobody below us */
+ pScreen->StoreColors = pScreenPriv->StoreColors;
+ (*pScreen->StoreColors) (pmap, ndef, pdefs);
+ pScreen->StoreColors = CMapStoreColors;
+
+ /* should never get here for these */
+ if ((pVisual->class == TrueColor) ||
+ (pVisual->class == StaticColor) || (pVisual->class == StaticGray))
+ return;
+
+ if (pVisual->class == DirectColor) {
+ CMapColormapPtr pColPriv =
+ (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates,
+ CMapColormapKey);
+ int i;
+
+ if (CMapColormapUseMax(pVisual, pScreenPriv)) {
+ int index;
+
+ num = 0;
+ while (ndef--) {
+ if (pdefs[ndef].flags & DoRed) {
+ index = (pdefs[ndef].pixel & pVisual->redMask) >>
+ pVisual->offsetRed;
+ i = num;
+ while (i--)
+ if (indices[i] == index)
+ break;
+ if (i == -1)
+ indices[num++] = index;
+ }
+ if (pdefs[ndef].flags & DoGreen) {
+ index = (pdefs[ndef].pixel & pVisual->greenMask) >>
+ pVisual->offsetGreen;
+ i = num;
+ while (i--)
+ if (indices[i] == index)
+ break;
+ if (i == -1)
+ indices[num++] = index;
+ }
+ if (pdefs[ndef].flags & DoBlue) {
+ index = (pdefs[ndef].pixel & pVisual->blueMask) >>
+ pVisual->offsetBlue;
+ i = num;
+ while (i--)
+ if (indices[i] == index)
+ break;
+ if (i == -1)
+ indices[num++] = index;
+ }
+ }
+
+ }
+ else {
+ /* not really as overkill as it seems */
+ num = pColPriv->numColors;
+ for (i = 0; i < pColPriv->numColors; i++)
+ indices[i] = i;
+ }
+ }
+ else {
+ while (ndef--)
+ indices[ndef] = pdefs[ndef].pixel;
+ }
+
+ CMapRefreshColors(pmap, num, indices);
+}
+
+static void
+CMapInstallColormap(ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
+
+ if (pmap == GetInstalledmiColormap(pmap->pScreen))
+ return;
+
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ (*pScreen->InstallColormap) (pmap);
+ pScreen->InstallColormap = CMapInstallColormap;
+
+ /* Important. We let the lower layers, namely DGA,
+ overwrite the choice of Colormap to install */
+ if (GetInstalledmiColormap(pmap->pScreen))
+ pmap = GetInstalledmiColormap(pmap->pScreen);
+
+ if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pmap->pVisual->class == TrueColor) &&
+ CMapColormapUseMax(pmap->pVisual, pScreenPriv))
+ return;
+
+ if (LOAD_PALETTE(pmap))
+ CMapReinstallMap(pmap);
+}
+
+/**** ScrnInfoRec functions ****/
+
+static Bool
+CMapEnterVT(int index, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ScreenPtr pScreen = screenInfo.screens[index];
+ Bool ret;
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
+
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ ret = (*pScreenPriv->EnterVT) (index, flags);
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = CMapEnterVT;
+ if (ret) {
+ if (GetInstalledmiColormap(pScreen))
+ CMapReinstallMap(GetInstalledmiColormap(pScreen));
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static Bool
+CMapSwitchMode(int index, DisplayModePtr mode, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
+
+ if ((*pScreenPriv->SwitchMode) (index, mode, flags)) {
+ if (GetInstalledmiColormap(pScreen))
+ CMapReinstallMap(GetInstalledmiColormap(pScreen));
+ return TRUE;
+ }
+ return FALSE;
+}
+
+#ifdef XFreeXDGA
+static int
+CMapSetDGAMode(int index, int num, DGADevicePtr dev)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
+ int ret;
+
+ ret = (*pScreenPriv->SetDGAMode) (index, num, dev);
+
+ pScreenPriv->isDGAmode = DGAActive(index);
+
+ if (!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen)
+ && xf86Screens[pScreen->myNum]->vtSema)
+ CMapReinstallMap(GetInstalledmiColormap(pScreen));
+
+ return ret;
+}
+#endif
+
+/**** Utilities ****/
+
+static void
+CMapReinstallMap(ColormapPtr pmap)
+{
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pmap->pScreen->devPrivates,
+ CMapScreenKey);
+ CMapColormapPtr cmapPriv =
+ (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey);
+ ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ int i = cmapPriv->numColors;
+ int *indices = pScreenPriv->PreAllocIndices;
+
+ while (i--)
+ indices[i] = i;
+
+ if (cmapPriv->recalculate)
+ CMapRefreshColors(pmap, cmapPriv->numColors, indices);
+ else {
+ (*pScrn->LoadPalette) (pScrn, cmapPriv->numColors,
+ indices, cmapPriv->colors, pmap->pVisual);
+ if (pScrn->SetOverscan) {
+#ifdef DEBUGOVERSCAN
+ ErrorF("SetOverscan() called from CMapReinstallMap\n");
+#endif
+ pScrn->SetOverscan(pScrn, cmapPriv->overscan);
+ }
+ }
+
+ cmapPriv->recalculate = FALSE;
+}
+
+static void
+CMapRefreshColors(ColormapPtr pmap, int defs, int *indices)
+{
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pmap->pScreen->devPrivates,
+ CMapScreenKey);
+ CMapColormapPtr pColPriv =
+ (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey);
+ VisualPtr pVisual = pmap->pVisual;
+ ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ int numColors, i;
+ LOCO *gamma, *colors;
+ EntryPtr entry;
+ int reds, greens, blues, maxValue, index, shift;
+
+ numColors = pColPriv->numColors;
+ shift = 16 - pScreenPriv->sigRGBbits;
+ maxValue = (1 << pScreenPriv->sigRGBbits) - 1;
+ gamma = pScreenPriv->gamma;
+ colors = pColPriv->colors;
+
+ reds = pVisual->redMask >> pVisual->offsetRed;
+ greens = pVisual->greenMask >> pVisual->offsetGreen;
+ blues = pVisual->blueMask >> pVisual->offsetBlue;
+
+ switch (pVisual->class) {
+ case StaticGray:
+ for (i = 0; i < numColors; i++) {
+ index = (i + 1) * maxValue / numColors;
+ colors[i].red = gamma[index].red;
+ colors[i].green = gamma[index].green;
+ colors[i].blue = gamma[index].blue;
+ }
+ break;
+ case TrueColor:
+ if (CMapColormapUseMax(pVisual, pScreenPriv)) {
+ for (i = 0; i <= reds; i++)
+ colors[i].red = gamma[i * maxValue / reds].red;
+ for (i = 0; i <= greens; i++)
+ colors[i].green = gamma[i * maxValue / greens].green;
+ for (i = 0; i <= blues; i++)
+ colors[i].blue = gamma[i * maxValue / blues].blue;
+ break;
+ }
+ for (i = 0; i < numColors; i++) {
+ colors[i].red = gamma[((i >> pVisual->offsetRed) & reds) *
+ maxValue / reds].red;
+ colors[i].green = gamma[((i >> pVisual->offsetGreen) & greens) *
+ maxValue / greens].green;
+ colors[i].blue = gamma[((i >> pVisual->offsetBlue) & blues) *
+ maxValue / blues].blue;
+ }
+ break;
+ case StaticColor:
+ case PseudoColor:
+ case GrayScale:
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+ entry = (EntryPtr) & pmap->red[index];
+
+ if (entry->fShared) {
+ colors[index].red =
+ gamma[entry->co.shco.red->color >> shift].red;
+ colors[index].green =
+ gamma[entry->co.shco.green->color >> shift].green;
+ colors[index].blue =
+ gamma[entry->co.shco.blue->color >> shift].blue;
+ }
+ else {
+ colors[index].red = gamma[entry->co.local.red >> shift].red;
+ colors[index].green =
+ gamma[entry->co.local.green >> shift].green;
+ colors[index].blue = gamma[entry->co.local.blue >> shift].blue;
+ }
+ }
+ break;
+ case DirectColor:
+ if (CMapColormapUseMax(pVisual, pScreenPriv)) {
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+ if (index <= reds)
+ colors[index].red =
+ gamma[pmap->red[index].co.local.red >> shift].red;
+ if (index <= greens)
+ colors[index].green =
+ gamma[pmap->green[index].co.local.green >> shift].green;
+ if (index <= blues)
+ colors[index].blue =
+ gamma[pmap->blue[index].co.local.blue >> shift].blue;
+
+ }
+ break;
+ }
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+
+ colors[index].red = gamma[pmap->red[(index >> pVisual->
+ offsetRed) & reds].co.local.
+ red >> shift].red;
+ colors[index].green =
+ gamma[pmap->green[(index >> pVisual->offsetGreen) & greens].co.
+ local.green >> shift].green;
+ colors[index].blue =
+ gamma[pmap->blue[(index >> pVisual->offsetBlue) & blues].co.
+ local.blue >> shift].blue;
+ }
+ break;
+ }
+
+ if (LOAD_PALETTE(pmap))
+ (*pScrn->LoadPalette) (pScreenPriv->pScrn, defs, indices,
+ colors, pmap->pVisual);
+
+ if (pScrn->SetOverscan)
+ CMapSetOverscan(pmap, defs, indices);
+
+}
+
+static Bool
+CMapCompareColors(LOCO * color1, LOCO * color2)
+{
+ /* return TRUE if the color1 is "closer" to black than color2 */
+#ifdef DEBUGOVERSCAN
+ ErrorF("#%02x%02x%02x vs #%02x%02x%02x (%d vs %d)\n",
+ color1->red, color1->green, color1->blue,
+ color2->red, color2->green, color2->blue,
+ color1->red + color1->green + color1->blue,
+ color2->red + color2->green + color2->blue);
+#endif
+ return (color1->red + color1->green + color1->blue <
+ color2->red + color2->green + color2->blue);
+}
+
+static void
+CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
+{
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pmap->pScreen->devPrivates,
+ CMapScreenKey);
+ CMapColormapPtr pColPriv =
+ (CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey);
+ ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ VisualPtr pVisual = pmap->pVisual;
+ int i;
+ LOCO *colors;
+ int index;
+ Bool newOverscan = FALSE;
+ int overscan, tmpOverscan;
+
+ colors = pColPriv->colors;
+ overscan = pColPriv->overscan;
+
+ /*
+ * Search for a new overscan index in the following cases:
+ *
+ * - The index hasn't yet been initialised.  In this case search
+ * for an index that is black or a close match to black.
+ *
+ * - The colour of the old index is changed. In this case search
+ * all indices for a black or close match to black.
+ *
+ * - The colour of the old index wasn't black. In this case only
+ * search the indices that were changed for a better match to black.
+ */
+
+ switch (pVisual->class) {
+ case StaticGray:
+ case TrueColor:
+ /* Should only come here once. Initialise the overscan index to 0 */
+ overscan = 0;
+ newOverscan = TRUE;
+ break;
+ case StaticColor:
+ /*
+ * Only come here once, but search for the overscan in the same way
+ * as for the other cases.
+ */
+ case DirectColor:
+ case PseudoColor:
+ case GrayScale:
+ if (overscan < 0 || overscan > pScreenPriv->maxColors - 1) {
+ /* Uninitialised */
+ newOverscan = TRUE;
+ }
+ else {
+ /* Check if the overscan was changed */
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+ if (index == overscan) {
+ newOverscan = TRUE;
+ break;
+ }
+ }
+ }
+ if (newOverscan) {
+ /* The overscan is either uninitialised or it has been changed */
+
+ if (overscan < 0 || overscan > pScreenPriv->maxColors - 1)
+ tmpOverscan = pScreenPriv->maxColors - 1;
+ else
+ tmpOverscan = overscan;
+
+ /* search all entries for a close match to black */
+ for (i = pScreenPriv->maxColors - 1; i >= 0; i--) {
+ if (colors[i].red == 0 && colors[i].green == 0 &&
+ colors[i].blue == 0) {
+ overscan = i;
+#ifdef DEBUGOVERSCAN
+ ErrorF("Black found at index 0x%02x\n", i);
+#endif
+ break;
+ }
+ else {
+#ifdef DEBUGOVERSCAN
+ ErrorF("0x%02x: ", i);
+#endif
+ if (CMapCompareColors(&colors[i], &colors[tmpOverscan])) {
+ tmpOverscan = i;
+#ifdef DEBUGOVERSCAN
+ ErrorF("possible \"Black\" at index 0x%02x\n", i);
+#endif
+ }
+ }
+ }
+ if (i < 0)
+ overscan = tmpOverscan;
+ }
+ else {
+ /* Check of the old overscan wasn't black */
+ if (colors[overscan].red != 0 || colors[overscan].green != 0 ||
+ colors[overscan].blue != 0) {
+ int oldOverscan = tmpOverscan = overscan;
+
+ /* See of there is now a better match */
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+ if (colors[index].red == 0 && colors[index].green == 0 &&
+ colors[index].blue == 0) {
+ overscan = index;
+#ifdef DEBUGOVERSCAN
+ ErrorF("Black found at index 0x%02x\n", index);
+#endif
+ break;
+ }
+ else {
+#ifdef DEBUGOVERSCAN
+ ErrorF("0x%02x: ", index);
+#endif
+ if (CMapCompareColors(&colors[index],
+ &colors[tmpOverscan])) {
+ tmpOverscan = index;
+#ifdef DEBUGOVERSCAN
+ ErrorF("possible \"Black\" at index 0x%02x\n",
+ index);
+#endif
+ }
+ }
+ }
+ if (i == defs)
+ overscan = tmpOverscan;
+ if (overscan != oldOverscan)
+ newOverscan = TRUE;
+ }
+ }
+ break;
+ }
+ if (newOverscan) {
+ pColPriv->overscan = overscan;
+ if (LOAD_PALETTE(pmap)) {
+#ifdef DEBUGOVERSCAN
+ ErrorF("SetOverscan() called from CmapSetOverscan\n");
+#endif
+ pScrn->SetOverscan(pScreenPriv->pScrn, overscan);
+ }
+ }
+}
+
+static void
+CMapUnwrapScreen(ScreenPtr pScreen)
+{
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->CreateColormap = pScreenPriv->CreateColormap;
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ pScreen->StoreColors = pScreenPriv->StoreColors;
+
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ pScrn->SwitchMode = pScreenPriv->SwitchMode;
+ pScrn->SetDGAMode = pScreenPriv->SetDGAMode;
+ pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
+
+ free(pScreenPriv->gamma);
+ free(pScreenPriv->PreAllocIndices);
+ free(pScreenPriv);
+}
+
+static void
+ComputeGamma(CMapScreenPtr priv)
+{
+ int elements = priv->gammaElements - 1;
+ double RedGamma, GreenGamma, BlueGamma;
+ int i;
+
+#ifndef DONT_CHECK_GAMMA
+ /* This check is to catch drivers that are not initialising pScrn->gamma */
+ if (priv->pScrn->gamma.red < GAMMA_MIN ||
+ priv->pScrn->gamma.red > GAMMA_MAX ||
+ priv->pScrn->gamma.green < GAMMA_MIN ||
+ priv->pScrn->gamma.green > GAMMA_MAX ||
+ priv->pScrn->gamma.blue < GAMMA_MIN ||
+ priv->pScrn->gamma.blue > GAMMA_MAX) {
+
+ xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
+ "The %s driver didn't call xf86SetGamma() to initialise\n"
+ "\tthe gamma values.\n", priv->pScrn->driverName);
+ xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
+ "PLEASE FIX THE `%s' DRIVER!\n",
+ priv->pScrn->driverName);
+ priv->pScrn->gamma.red = 1.0;
+ priv->pScrn->gamma.green = 1.0;
+ priv->pScrn->gamma.blue = 1.0;
+ }
+#endif
+
+ RedGamma = 1.0 / (double) priv->pScrn->gamma.red;
+ GreenGamma = 1.0 / (double) priv->pScrn->gamma.green;
+ BlueGamma = 1.0 / (double) priv->pScrn->gamma.blue;
+
+ for (i = 0; i <= elements; i++) {
+ if (RedGamma == 1.0)
+ priv->gamma[i].red = i;
+ else
+ priv->gamma[i].red = (CARD16) (pow((double) i / (double) elements,
+ RedGamma) * (double) elements +
+ 0.5);
+
+ if (GreenGamma == 1.0)
+ priv->gamma[i].green = i;
+ else
+ priv->gamma[i].green = (CARD16) (pow((double) i / (double) elements,
+ GreenGamma) *
+ (double) elements + 0.5);
+
+ if (BlueGamma == 1.0)
+ priv->gamma[i].blue = i;
+ else
+ priv->gamma[i].blue = (CARD16) (pow((double) i / (double) elements,
+ BlueGamma) * (double) elements +
+ 0.5);
+ }
+}
+
+int
+CMapChangeGamma(int index, Gamma gamma)
+{
+ int ret = Success;
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ScreenPtr pScreen = pScrn->pScreen;
+ CMapColormapPtr pColPriv;
+ CMapScreenPtr pScreenPriv;
+ CMapLinkPtr pLink;
+
+ /* Is this sufficient checking ? */
+ if (!CMapScreenKeyRegistered)
+ return BadImplementation;
+
+ pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if (!pScreenPriv)
+ return BadImplementation;
+
+ if (gamma.red < GAMMA_MIN || gamma.red > GAMMA_MAX ||
+ gamma.green < GAMMA_MIN || gamma.green > GAMMA_MAX ||
+ gamma.blue < GAMMA_MIN || gamma.blue > GAMMA_MAX)
+ return BadValue;
+
+ pScrn->gamma.red = gamma.red;
+ pScrn->gamma.green = gamma.green;
+ pScrn->gamma.blue = gamma.blue;
+
+ ComputeGamma(pScreenPriv);
+
+ /* mark all colormaps on this screen */
+ pLink = pScreenPriv->maps;
+ while (pLink) {
+ pColPriv = (CMapColormapPtr) dixLookupPrivate(&pLink->cmap->devPrivates,
+ CMapColormapKey);
+ pColPriv->recalculate = TRUE;
+ pLink = pLink->next;
+ }
+
+ if (GetInstalledmiColormap(pScreen) &&
+ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
+ pScrn->vtSema || pScreenPriv->isDGAmode)) {
+ ColormapPtr pMap = GetInstalledmiColormap(pScreen);
+
+ if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pMap->pVisual->class == TrueColor) &&
+ CMapColormapUseMax(pMap->pVisual, pScreenPriv)) {
+
+ /* if the current map doesn't have a palette look
+ for another map to change the gamma on. */
+
+ pLink = pScreenPriv->maps;
+ while (pLink) {
+ if (pLink->cmap->pVisual->class == PseudoColor)
+ break;
+ pLink = pLink->next;
+ }
+
+ if (pLink) {
+ /* need to trick CMapRefreshColors() into thinking
+ this is the currently installed map */
+ SetInstalledmiColormap(pScreen, pLink->cmap);
+ CMapReinstallMap(pLink->cmap);
+ SetInstalledmiColormap(pScreen, pMap);
+ }
+ }
+ else
+ CMapReinstallMap(pMap);
+ }
+
+ pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
+ if (pScrn->ChangeGamma)
+ ret = pScrn->ChangeGamma(index, gamma);
+ pScrn->ChangeGamma = CMapChangeGamma;
+
+ return ret;
+}
+
+static void
+ComputeGammaRamp(CMapScreenPtr priv,
+ unsigned short *red,
+ unsigned short *green, unsigned short *blue)
+{
+ int elements = priv->gammaElements;
+ LOCO *entry = priv->gamma;
+ int shift = 16 - priv->sigRGBbits;
+
+ while (elements--) {
+ entry->red = *(red++) >> shift;
+ entry->green = *(green++) >> shift;
+ entry->blue = *(blue++) >> shift;
+ entry++;
+ }
+}
+
+int
+xf86ChangeGammaRamp(ScreenPtr pScreen,
+ int size,
+ unsigned short *red,
+ unsigned short *green, unsigned short *blue)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ CMapColormapPtr pColPriv;
+ CMapScreenPtr pScreenPriv;
+ CMapLinkPtr pLink;
+
+ if (xf86_crtc_supports_gamma(pScrn)) {
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
+
+ if (crtc) {
+ if (crtc->gammaSize != size)
+ return BadValue;
+
+ RRCrtcGammaSet(crtc, red, green, blue);
+
+ return Success;
+ }
+ }
+
+ if (!CMapScreenKeyRegistered)
+ return BadImplementation;
+
+ pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if (!pScreenPriv)
+ return BadImplementation;
+
+ if (pScreenPriv->gammaElements != size)
+ return BadValue;
+
+ ComputeGammaRamp(pScreenPriv, red, green, blue);
+
+ /* mark all colormaps on this screen */
+ pLink = pScreenPriv->maps;
+ while (pLink) {
+ pColPriv = (CMapColormapPtr) dixLookupPrivate(&pLink->cmap->devPrivates,
+ CMapColormapKey);
+ pColPriv->recalculate = TRUE;
+ pLink = pLink->next;
+ }
+
+ if (GetInstalledmiColormap(pScreen) &&
+ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
+ pScrn->vtSema || pScreenPriv->isDGAmode)) {
+ ColormapPtr pMap = GetInstalledmiColormap(pScreen);
+
+ if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pMap->pVisual->class == TrueColor) &&
+ CMapColormapUseMax(pMap->pVisual, pScreenPriv)) {
+
+ /* if the current map doesn't have a palette look
+ for another map to change the gamma on. */
+
+ pLink = pScreenPriv->maps;
+ while (pLink) {
+ if (pLink->cmap->pVisual->class == PseudoColor)
+ break;
+ pLink = pLink->next;
+ }
+
+ if (pLink) {
+ /* need to trick CMapRefreshColors() into thinking
+ this is the currently installed map */
+ SetInstalledmiColormap(pScreen, pLink->cmap);
+ CMapReinstallMap(pLink->cmap);
+ SetInstalledmiColormap(pScreen, pMap);
+ }
+ }
+ else
+ CMapReinstallMap(pMap);
+ }
+
+ return Success;
+}
+
+int
+xf86GetGammaRampSize(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ CMapScreenPtr pScreenPriv;
+
+ if (xf86_crtc_supports_gamma(pScrn)) {
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
+
+ if (crtc)
+ return crtc->gammaSize;
+ }
+
+ if (!CMapScreenKeyRegistered)
+ return 0;
+
+ pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if (!pScreenPriv)
+ return 0;
+
+ return pScreenPriv->gammaElements;
+}
+
+int
+xf86GetGammaRamp(ScreenPtr pScreen,
+ int size,
+ unsigned short *red,
+ unsigned short *green, unsigned short *blue)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ CMapScreenPtr pScreenPriv;
+ LOCO *entry;
+ int shift, sigbits;
+
+ if (xf86_crtc_supports_gamma(pScrn)) {
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
+
+ if (crtc) {
+ if (crtc->gammaSize < size)
+ return BadValue;
+
+ if (!RRCrtcGammaGet(crtc))
+ return BadImplementation;
+
+ memcpy(red, crtc->gammaRed, size * sizeof(*red));
+ memcpy(green, crtc->gammaGreen, size * sizeof(*green));
+ memcpy(blue, crtc->gammaBlue, size * sizeof(*blue));
+
+ return Success;
+ }
+ }
+
+ if (!CMapScreenKeyRegistered)
+ return BadImplementation;
+
+ pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if (!pScreenPriv)
+ return BadImplementation;
+
+ if (size > pScreenPriv->gammaElements)
+ return BadValue;
+
+ entry = pScreenPriv->gamma;
+ sigbits = pScreenPriv->sigRGBbits;
+
+ while (size--) {
+ *red = entry->red << (16 - sigbits);
+ *green = entry->green << (16 - sigbits);
+ *blue = entry->blue << (16 - sigbits);
+ shift = sigbits;
+ while (shift < 16) {
+ *red |= *red >> shift;
+ *green |= *green >> shift;
+ *blue |= *blue >> shift;
+ shift += sigbits;
+ }
+ red++;
+ green++;
+ blue++;
+ entry++;
+ }
+
+ return Success;
+}
+
+int
+xf86ChangeGamma(ScreenPtr pScreen, Gamma gamma)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if (pScrn->ChangeGamma)
+ return (*pScrn->ChangeGamma) (pScreen->myNum, gamma);
+
+ return BadImplementation;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.h b/xorg-server/hw/xfree86/common/xf86cmap.h
index caa01e8ed..2661cf429 100644
--- a/xorg-server/hw/xfree86/common/xf86cmap.h
+++ b/xorg-server/hw/xfree86/common/xf86cmap.h
@@ -1,79 +1,67 @@
-
-/*
- * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifndef _XF86CMAP_H
-#define _XF86CMAP_H
-
-#include "xf86str.h"
-#include "colormapst.h"
-
-#define CMAP_PALETTED_TRUECOLOR 0x0000001
-#define CMAP_RELOAD_ON_MODE_SWITCH 0x0000002
-#define CMAP_LOAD_EVEN_IF_OFFSCREEN 0x0000004
-
-extern _X_EXPORT Bool xf86HandleColormaps(
- ScreenPtr pScreen,
- int maxCol,
- int sigRGBbits,
- xf86LoadPaletteProc *loadPalette,
- xf86SetOverscanProc *setOverscan,
- unsigned int flags
-);
-
-extern _X_EXPORT Bool xf86ColormapAllocatePrivates(
- ScrnInfoPtr pScrn
-);
-
-extern _X_EXPORT int
-xf86ChangeGamma(
- ScreenPtr pScreen,
- Gamma newGamma
-);
-
-extern _X_EXPORT int
-xf86ChangeGammaRamp(
- ScreenPtr pScreen,
- int size,
- unsigned short *red,
- unsigned short *green,
- unsigned short *blue
-);
-
-extern _X_EXPORT int xf86GetGammaRampSize(ScreenPtr pScreen);
-
-extern _X_EXPORT int
-xf86GetGammaRamp(
- ScreenPtr pScreen,
- int size,
- unsigned short *red,
- unsigned short *green,
- unsigned short *blue
-);
-
-#endif /* _XF86CMAP_H */
-
+
+/*
+ * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _XF86CMAP_H
+#define _XF86CMAP_H
+
+#include "xf86str.h"
+#include "colormapst.h"
+
+#define CMAP_PALETTED_TRUECOLOR 0x0000001
+#define CMAP_RELOAD_ON_MODE_SWITCH 0x0000002
+#define CMAP_LOAD_EVEN_IF_OFFSCREEN 0x0000004
+
+extern _X_EXPORT Bool xf86HandleColormaps(ScreenPtr pScreen,
+ int maxCol,
+ int sigRGBbits,
+ xf86LoadPaletteProc * loadPalette,
+ xf86SetOverscanProc * setOverscan,
+ unsigned int flags);
+
+extern _X_EXPORT Bool xf86ColormapAllocatePrivates(ScrnInfoPtr pScrn);
+
+extern _X_EXPORT int
+ xf86ChangeGamma(ScreenPtr pScreen, Gamma newGamma);
+
+extern _X_EXPORT int
+
+xf86ChangeGammaRamp(ScreenPtr pScreen,
+ int size,
+ unsigned short *red,
+ unsigned short *green, unsigned short *blue);
+
+extern _X_EXPORT int xf86GetGammaRampSize(ScreenPtr pScreen);
+
+extern _X_EXPORT int
+
+xf86GetGammaRamp(ScreenPtr pScreen,
+ int size,
+ unsigned short *red,
+ unsigned short *green, unsigned short *blue);
+
+#endif /* _XF86CMAP_H */
diff --git a/xorg-server/hw/xfree86/common/xf86fbman.c b/xorg-server/hw/xfree86/common/xf86fbman.c
index ccb761a2c..3c29bf531 100644
--- a/xorg-server/hw/xfree86/common/xf86fbman.c
+++ b/xorg-server/hw/xfree86/common/xf86fbman.c
@@ -1,1446 +1,1431 @@
-
-/*
- * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "xf86fbman.h"
-
-/*
-#define DEBUG
-*/
-
-static DevPrivateKeyRec xf86FBManagerKeyRec;
-static DevPrivateKey xf86FBManagerKey;
-
-Bool xf86RegisterOffscreenManager(
- ScreenPtr pScreen,
- FBManagerFuncsPtr funcs
-){
-
- xf86FBManagerKey = &xf86FBManagerKeyRec;
-
- if (!dixRegisterPrivateKey(&xf86FBManagerKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, xf86FBManagerKey, funcs);
-
- return TRUE;
-}
-
-
-Bool
-xf86FBManagerRunning(ScreenPtr pScreen)
-{
- if (xf86FBManagerKey == NULL)
- return FALSE;
-
- if(!dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))
- return FALSE;
-
- return TRUE;
-}
-
-Bool
-xf86RegisterFreeBoxCallback(
- ScreenPtr pScreen,
- FreeBoxCallbackProcPtr FreeBoxCallback,
- pointer devPriv
-){
- FBManagerFuncsPtr funcs;
-
- if(xf86FBManagerKey == NULL)
- return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBManagerKey)))
- return FALSE;
-
- return (*funcs->RegisterFreeBoxCallback)(pScreen, FreeBoxCallback, devPriv);
-}
-
-
-FBAreaPtr
-xf86AllocateOffscreenArea(
- ScreenPtr pScreen,
- int w, int h,
- int gran,
- MoveAreaCallbackProcPtr moveCB,
- RemoveAreaCallbackProcPtr removeCB,
- pointer privData
-){
- FBManagerFuncsPtr funcs;
-
- if(xf86FBManagerKey == NULL)
- return NULL;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBManagerKey)))
- return NULL;
-
- return (*funcs->AllocateOffscreenArea)(
- pScreen, w, h, gran, moveCB, removeCB, privData);
-}
-
-
-FBLinearPtr
-xf86AllocateOffscreenLinear(
- ScreenPtr pScreen,
- int length,
- int gran,
- MoveLinearCallbackProcPtr moveCB,
- RemoveLinearCallbackProcPtr removeCB,
- pointer privData
-){
- FBManagerFuncsPtr funcs;
-
- if(xf86FBManagerKey == NULL)
- return NULL;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBManagerKey)))
- return NULL;
-
- return (*funcs->AllocateOffscreenLinear)(
- pScreen, length, gran, moveCB, removeCB, privData);
-}
-
-
-void
-xf86FreeOffscreenArea(FBAreaPtr area)
-{
- FBManagerFuncsPtr funcs;
-
- if(!area) return;
-
- if(xf86FBManagerKey == NULL)
- return;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
- &area->pScreen->devPrivates, xf86FBManagerKey)))
- return;
-
- (*funcs->FreeOffscreenArea)(area);
-
- return;
-}
-
-
-void
-xf86FreeOffscreenLinear(FBLinearPtr linear)
-{
- FBManagerFuncsPtr funcs;
-
- if(!linear) return;
-
- if(xf86FBManagerKey == NULL)
- return;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
- &linear->pScreen->devPrivates, xf86FBManagerKey)))
- return;
-
- (*funcs->FreeOffscreenLinear)(linear);
-
- return;
-}
-
-
-Bool
-xf86ResizeOffscreenArea(
- FBAreaPtr resize,
- int w, int h
-){
- FBManagerFuncsPtr funcs;
-
- if(!resize) return FALSE;
-
- if(xf86FBManagerKey == NULL)
- return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
- &resize->pScreen->devPrivates, xf86FBManagerKey)))
- return FALSE;
-
- return (*funcs->ResizeOffscreenArea)(resize, w, h);
-}
-
-Bool
-xf86ResizeOffscreenLinear(
- FBLinearPtr resize,
- int size
-){
- FBManagerFuncsPtr funcs;
-
- if(!resize) return FALSE;
-
- if(xf86FBManagerKey == NULL)
- return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
- &resize->pScreen->devPrivates, xf86FBManagerKey)))
- return FALSE;
-
- return (*funcs->ResizeOffscreenLinear)(resize, size);
-}
-
-
-Bool
-xf86QueryLargestOffscreenArea(
- ScreenPtr pScreen,
- int *w, int *h,
- int gran,
- int preferences,
- int severity
-){
- FBManagerFuncsPtr funcs;
-
- *w = 0;
- *h = 0;
-
- if(xf86FBManagerKey == NULL)
- return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBManagerKey)))
- return FALSE;
-
- return (*funcs->QueryLargestOffscreenArea)(
- pScreen, w, h, gran, preferences, severity);
-}
-
-Bool
-xf86QueryLargestOffscreenLinear(
- ScreenPtr pScreen,
- int *size,
- int gran,
- int severity
-){
- FBManagerFuncsPtr funcs;
-
- *size = 0;
-
- if(xf86FBManagerKey == NULL)
- return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBManagerKey)))
- return FALSE;
-
- return (*funcs->QueryLargestOffscreenLinear)(
- pScreen, size, gran, severity);
-}
-
-
-Bool
-xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
-{
- FBManagerFuncsPtr funcs;
-
- if(xf86FBManagerKey == NULL)
- return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBManagerKey)))
- return FALSE;
-
- return (*funcs->PurgeOffscreenAreas)(pScreen);
-}
-
-/************************************************************\
-
- Below is a specific implementation of an offscreen manager.
-
-\************************************************************/
-
-static DevPrivateKeyRec xf86FBScreenKeyRec;
-#define xf86FBScreenKey (&xf86FBScreenKeyRec)
-
-typedef struct _FBLink {
- FBArea area;
- struct _FBLink *next;
-} FBLink, *FBLinkPtr;
-
-typedef struct _FBLinearLink {
- FBLinear linear;
- int free; /* need to add free here as FBLinear is publicly accessible */
- FBAreaPtr area; /* only used if allocation came from XY area */
- struct _FBLinearLink *next;
-} FBLinearLink, *FBLinearLinkPtr;
-
-
-typedef struct {
- ScreenPtr pScreen;
- RegionPtr InitialBoxes;
- RegionPtr FreeBoxes;
- FBLinkPtr UsedAreas;
- int NumUsedAreas;
- FBLinearLinkPtr LinearAreas;
- CloseScreenProcPtr CloseScreen;
- int NumCallbacks;
- FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback;
- DevUnion *devPrivates;
-} FBManager, *FBManagerPtr;
-
-
-static void
-SendCallFreeBoxCallbacks(FBManagerPtr offman)
-{
- int i = offman->NumCallbacks;
-
- while(i--) {
- (*offman->FreeBoxesUpdateCallback[i])(
- offman->pScreen, offman->FreeBoxes, offman->devPrivates[i].ptr);
- }
-}
-
-static Bool
-localRegisterFreeBoxCallback(
- ScreenPtr pScreen,
- FreeBoxCallbackProcPtr FreeBoxCallback,
- pointer devPriv
-){
- FBManagerPtr offman;
- FreeBoxCallbackProcPtr *newCallbacks;
- DevUnion *newPrivates;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- newCallbacks = realloc( offman->FreeBoxesUpdateCallback,
- sizeof(FreeBoxCallbackProcPtr) * (offman->NumCallbacks + 1));
-
- newPrivates = realloc(offman->devPrivates,
- sizeof(DevUnion) * (offman->NumCallbacks + 1));
-
- if(!newCallbacks || !newPrivates)
- return FALSE;
-
- offman->FreeBoxesUpdateCallback = newCallbacks;
- offman->devPrivates = newPrivates;
-
- offman->FreeBoxesUpdateCallback[offman->NumCallbacks] = FreeBoxCallback;
- offman->devPrivates[offman->NumCallbacks].ptr = devPriv;
- offman->NumCallbacks++;
-
- SendCallFreeBoxCallbacks(offman);
-
- return TRUE;
-}
-
-
-static FBAreaPtr
-AllocateArea(
- FBManagerPtr offman,
- int w, int h,
- int granularity,
- MoveAreaCallbackProcPtr moveCB,
- RemoveAreaCallbackProcPtr removeCB,
- pointer privData
-){
- ScreenPtr pScreen = offman->pScreen;
- FBLinkPtr link = NULL;
- FBAreaPtr area = NULL;
- RegionRec NewReg;
- int i, x = 0, num;
- BoxPtr boxp;
-
- if(granularity <= 1) granularity = 0;
-
- boxp = RegionRects(offman->FreeBoxes);
- num = RegionNumRects(offman->FreeBoxes);
-
- /* look through the free boxes */
- for(i = 0; i < num; i++, boxp++) {
- x = boxp->x1;
- if (granularity > 1)
- x = ((x + granularity - 1) / granularity) * granularity;
-
- if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w))
- continue;
-
- link = malloc(sizeof(FBLink));
- if(!link) return NULL;
-
- area = &(link->area);
- link->next = offman->UsedAreas;
- offman->UsedAreas = link;
- offman->NumUsedAreas++;
- break;
- }
-
- /* try to boot a removeable one out if we are not expendable ourselves */
- if(!area && !removeCB) {
- link = offman->UsedAreas;
-
- while(link) {
- if(!link->area.RemoveAreaCallback) {
- link = link->next;
- continue;
- }
-
- boxp = &(link->area.box);
- x = boxp->x1;
- if (granularity > 1)
- x = ((x + granularity - 1) / granularity) * granularity;
-
- if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) {
- link = link->next;
- continue;
- }
-
- /* bye, bye */
- (*link->area.RemoveAreaCallback)(&link->area);
- RegionInit(&NewReg, &(link->area.box), 1);
- RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &NewReg);
- RegionUninit(&NewReg);
-
- area = &(link->area);
- break;
- }
- }
-
- if(area) {
- area->pScreen = pScreen;
- area->granularity = granularity;
- area->box.x1 = x;
- area->box.x2 = x + w;
- area->box.y1 = boxp->y1;
- area->box.y2 = boxp->y1 + h;
- area->MoveAreaCallback = moveCB;
- area->RemoveAreaCallback = removeCB;
- area->devPrivate.ptr = privData;
-
- RegionInit(&NewReg, &(area->box), 1);
- RegionSubtract(offman->FreeBoxes, offman->FreeBoxes, &NewReg);
- RegionUninit(&NewReg);
- }
-
- return area;
-}
-
-static FBAreaPtr
-localAllocateOffscreenArea(
- ScreenPtr pScreen,
- int w, int h,
- int gran,
- MoveAreaCallbackProcPtr moveCB,
- RemoveAreaCallbackProcPtr removeCB,
- pointer privData
-){
- FBManagerPtr offman;
- FBAreaPtr area = NULL;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- if((area = AllocateArea(offman, w, h, gran, moveCB, removeCB, privData)))
- SendCallFreeBoxCallbacks(offman);
-
- return area;
-}
-
-
-static void
-localFreeOffscreenArea(FBAreaPtr area)
-{
- FBManagerPtr offman;
- FBLinkPtr pLink, pLinkPrev = NULL;
- RegionRec FreedRegion;
- ScreenPtr pScreen;
-
- pScreen = area->pScreen;
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- pLink = offman->UsedAreas;
- if(!pLink) return;
-
- while(&(pLink->area) != area) {
- pLinkPrev = pLink;
- pLink = pLink->next;
- if(!pLink) return;
- }
-
- /* put the area back into the pool */
- RegionInit(&FreedRegion, &(pLink->area.box), 1);
- RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &FreedRegion);
- RegionUninit(&FreedRegion);
-
- if(pLinkPrev)
- pLinkPrev->next = pLink->next;
- else offman->UsedAreas = pLink->next;
-
- free(pLink);
- offman->NumUsedAreas--;
-
- SendCallFreeBoxCallbacks(offman);
-}
-
-
-
-static Bool
-localResizeOffscreenArea(
- FBAreaPtr resize,
- int w, int h
-){
- FBManagerPtr offman;
- ScreenPtr pScreen;
- BoxRec OrigArea;
- RegionRec FreedReg;
- FBAreaPtr area = NULL;
- FBLinkPtr pLink, newLink, pLinkPrev = NULL;
-
- pScreen = resize->pScreen;
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- /* find this link */
- if(!(pLink = offman->UsedAreas))
- return FALSE;
-
- while(&(pLink->area) != resize) {
- pLinkPrev = pLink;
- pLink = pLink->next;
- if(!pLink) return FALSE;
- }
-
- OrigArea.x1 = resize->box.x1;
- OrigArea.x2 = resize->box.x2;
- OrigArea.y1 = resize->box.y1;
- OrigArea.y2 = resize->box.y2;
-
- /* if it's smaller, this is easy */
-
- if((w <= (resize->box.x2 - resize->box.x1)) &&
- (h <= (resize->box.y2 - resize->box.y1))) {
- RegionRec NewReg;
-
- resize->box.x2 = resize->box.x1 + w;
- resize->box.y2 = resize->box.y1 + h;
-
- if((resize->box.y2 == OrigArea.y2) &&
- (resize->box.x2 == OrigArea.x2))
- return TRUE;
-
- RegionInit(&FreedReg, &OrigArea, 1);
- RegionInit(&NewReg, &(resize->box), 1);
- RegionSubtract(&FreedReg, &FreedReg, &NewReg);
- RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
- RegionUninit(&FreedReg);
- RegionUninit(&NewReg);
-
- SendCallFreeBoxCallbacks(offman);
-
- return TRUE;
- }
-
-
- /* otherwise we remove the old region */
-
- RegionInit(&FreedReg, &OrigArea, 1);
- RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
-
- /* remove the old link */
- if(pLinkPrev)
- pLinkPrev->next = pLink->next;
- else offman->UsedAreas = pLink->next;
-
- /* and try to add a new one */
-
- if((area = AllocateArea(offman, w, h, resize->granularity,
- resize->MoveAreaCallback, resize->RemoveAreaCallback,
- resize->devPrivate.ptr))) {
-
- /* copy data over to our link and replace the new with old */
- memcpy(resize, area, sizeof(FBArea));
-
- pLinkPrev = NULL;
- newLink = offman->UsedAreas;
-
- while(&(newLink->area) != area) {
- pLinkPrev = newLink;
- newLink = newLink->next;
- }
-
- if(pLinkPrev)
- pLinkPrev->next = newLink->next;
- else offman->UsedAreas = newLink->next;
-
- pLink->next = offman->UsedAreas;
- offman->UsedAreas = pLink;
-
- free(newLink);
-
- /* AllocateArea added one but we really only exchanged one */
- offman->NumUsedAreas--;
- } else {
- /* reinstate the old region */
- RegionSubtract(offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
- RegionUninit(&FreedReg);
-
- pLink->next = offman->UsedAreas;
- offman->UsedAreas = pLink;
- return FALSE;
- }
-
-
- RegionUninit(&FreedReg);
-
- SendCallFreeBoxCallbacks(offman);
-
- return TRUE;
-}
-
-static Bool
-localQueryLargestOffscreenArea(
- ScreenPtr pScreen,
- int *width, int *height,
- int granularity,
- int preferences,
- int severity
-){
- FBManagerPtr offman;
- RegionPtr newRegion = NULL;
- BoxPtr pbox;
- int nbox;
- int x, w, h, area, oldArea;
-
- *width = *height = oldArea = 0;
-
- if(granularity <= 1) granularity = 0;
-
- if((preferences < 0) || (preferences > 3))
- return FALSE;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- if(severity < 0) severity = 0;
- if(severity > 2) severity = 2;
-
- switch(severity) {
- case 2:
- if(offman->NumUsedAreas) {
- FBLinkPtr pLink;
- RegionRec tmpRegion;
- newRegion = RegionCreate(NULL, 1);
- RegionCopy(newRegion, offman->InitialBoxes);
- pLink = offman->UsedAreas;
-
- while(pLink) {
- if(!pLink->area.RemoveAreaCallback) {
- RegionInit(&tmpRegion, &(pLink->area.box), 1);
- RegionSubtract(newRegion, newRegion, &tmpRegion);
- RegionUninit(&tmpRegion);
- }
- pLink = pLink->next;
- }
-
- nbox = RegionNumRects(newRegion);
- pbox = RegionRects(newRegion);
- break;
- }
- case 1:
- if(offman->NumUsedAreas) {
- FBLinkPtr pLink;
- RegionRec tmpRegion;
- newRegion = RegionCreate(NULL, 1);
- RegionCopy(newRegion, offman->FreeBoxes);
- pLink = offman->UsedAreas;
-
- while(pLink) {
- if(pLink->area.RemoveAreaCallback) {
- RegionInit(&tmpRegion, &(pLink->area.box), 1);
- RegionAppend(newRegion, &tmpRegion);
- RegionUninit(&tmpRegion);
- }
- pLink = pLink->next;
- }
-
- nbox = RegionNumRects(newRegion);
- pbox = RegionRects(newRegion);
- break;
- }
- default:
- nbox = RegionNumRects(offman->FreeBoxes);
- pbox = RegionRects(offman->FreeBoxes);
- break;
- }
-
- while(nbox--) {
- x = pbox->x1;
- if (granularity > 1)
- x = ((x + granularity - 1) / granularity) * granularity;
-
- w = pbox->x2 - x;
- h = pbox->y2 - pbox->y1;
- area = w * h;
-
- if(w > 0) {
- Bool gotIt = FALSE;
- switch(preferences) {
- case FAVOR_AREA_THEN_WIDTH:
- if((area > oldArea) || ((area == oldArea) && (w > *width)))
- gotIt = TRUE;
- break;
- case FAVOR_AREA_THEN_HEIGHT:
- if((area > oldArea) || ((area == oldArea) && (h > *height)))
- gotIt = TRUE;
- break;
- case FAVOR_WIDTH_THEN_AREA:
- if((w > *width) || ((w == *width) && (area > oldArea)))
- gotIt = TRUE;
- break;
- case FAVOR_HEIGHT_THEN_AREA:
- if((h > *height) || ((h == *height) && (area > oldArea)))
- gotIt = TRUE;
- break;
- }
- if(gotIt) {
- *width = w;
- *height = h;
- oldArea = area;
- }
- }
- pbox++;
- }
-
- if(newRegion)
- RegionDestroy(newRegion);
-
- return TRUE;
-}
-
-static Bool
-localPurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
-{
- FBManagerPtr offman;
- FBLinkPtr pLink, tmp, pPrev = NULL;
- RegionRec FreedRegion;
- Bool anyUsed = FALSE;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- pLink = offman->UsedAreas;
- if(!pLink) return TRUE;
-
- while(pLink) {
- if(pLink->area.RemoveAreaCallback) {
- (*pLink->area.RemoveAreaCallback)(&pLink->area);
-
- RegionInit(&FreedRegion, &(pLink->area.box), 1);
- RegionAppend(offman->FreeBoxes, &FreedRegion);
- RegionUninit(&FreedRegion);
-
- if(pPrev)
- pPrev->next = pLink->next;
- else offman->UsedAreas = pLink->next;
-
- tmp = pLink;
- pLink = pLink->next;
- free(tmp);
- offman->NumUsedAreas--;
- anyUsed = TRUE;
- } else {
- pPrev = pLink;
- pLink = pLink->next;
- }
- }
-
- if(anyUsed) {
- RegionValidate(offman->FreeBoxes, &anyUsed);
- SendCallFreeBoxCallbacks(offman);
- }
-
- return TRUE;
-}
-
-static void
-LinearMoveCBWrapper(FBAreaPtr from, FBAreaPtr to)
-{
- /* this will never get called */
-}
-
-static void
-LinearRemoveCBWrapper(FBAreaPtr area)
-{
- FBManagerPtr offman;
- FBLinearLinkPtr pLink, pLinkPrev = NULL;
- ScreenPtr pScreen = area->pScreen;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- pLink = offman->LinearAreas;
- if(!pLink) return;
-
- while(pLink->area != area) {
- pLinkPrev = pLink;
- pLink = pLink->next;
- if(!pLink) return;
- }
-
- /* give the user the callback it is expecting */
- (*pLink->linear.RemoveLinearCallback)(&(pLink->linear));
-
- if(pLinkPrev)
- pLinkPrev->next = pLink->next;
- else offman->LinearAreas = pLink->next;
-
- free(pLink);
-}
-
-static void
-DumpDebug(FBLinearLinkPtr pLink)
-{
-#ifdef DEBUG
- if (!pLink) ErrorF("MMmm, PLINK IS NULL!\n");
-
- while (pLink) {
- ErrorF(" Offset:%08x, Size:%08x, %s,%s\n",
- pLink->linear.offset,
- pLink->linear.size,
- pLink->free ? "Free" : "Used",
- pLink->area ? "Area" : "Linear");
-
- pLink = pLink->next;
- }
-#endif
-}
-
-static FBLinearPtr
-AllocateLinear(
- FBManagerPtr offman,
- int size,
- int granularity,
- pointer privData
-){
- ScreenPtr pScreen = offman->pScreen;
- FBLinearLinkPtr linear = NULL;
- FBLinearLinkPtr newlink = NULL;
- int offset, end;
-
- if(size <= 0) return NULL;
-
- if (!offman->LinearAreas) return NULL;
-
- linear = offman->LinearAreas;
- while (linear) {
- /* Make sure we get a free area that's not an XY fallback case */
- if (!linear->area && linear->free) {
- offset = linear->linear.offset;
- if (granularity > 1)
- offset = ((offset + granularity - 1) / granularity) * granularity;
- end = offset+size;
- if (end <= (linear->linear.offset + linear->linear.size))
- break;
- }
- linear = linear->next;
- }
- if (!linear)
- return NULL;
-
- /* break left */
- if (offset > linear->linear.offset) {
- newlink = malloc(sizeof(FBLinearLink));
- if (!newlink)
- return NULL;
- newlink->area = NULL;
- newlink->linear.offset = offset;
- newlink->linear.size = linear->linear.size - (offset - linear->linear.offset);
- newlink->free = 1;
- newlink->next = linear->next;
- linear->linear.size -= newlink->linear.size;
- linear->next = newlink;
- linear = newlink;
- }
-
- /* break right */
- if (size < linear->linear.size) {
- newlink = malloc(sizeof(FBLinearLink));
- if (!newlink)
- return NULL;
- newlink->area = NULL;
- newlink->linear.offset = offset + size;
- newlink->linear.size = linear->linear.size - size;
- newlink->free = 1;
- newlink->next = linear->next;
- linear->linear.size = size;
- linear->next = newlink;
- }
-
- /* p = middle block */
- linear->linear.granularity = granularity;
- linear->free = 0;
- linear->linear.pScreen = pScreen;
- linear->linear.MoveLinearCallback = NULL;
- linear->linear.RemoveLinearCallback = NULL;
- linear->linear.devPrivate.ptr = NULL;
-
- DumpDebug(offman->LinearAreas);
-
- return &(linear->linear);
-}
-
-static FBLinearPtr
-localAllocateOffscreenLinear(
- ScreenPtr pScreen,
- int length,
- int gran,
- MoveLinearCallbackProcPtr moveCB,
- RemoveLinearCallbackProcPtr removeCB,
- pointer privData
-){
- FBManagerPtr offman;
- FBLinearLinkPtr link;
- FBAreaPtr area;
- FBLinearPtr linear = NULL;
- BoxPtr extents;
- int w, h, pitch;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
-
- /* Try to allocate from linear memory first...... */
- DebugF("ALLOCATING LINEAR\n");
- if ((linear = AllocateLinear(offman, length, gran, privData)))
- return linear;
-
- DebugF("NOPE, ALLOCATING AREA\n");
-
- if(!(link = malloc(sizeof(FBLinearLink))))
- return NULL;
-
- /* No linear available, so try and pinch some from the XY areas */
- extents = RegionExtents(offman->InitialBoxes);
- pitch = extents->x2 - extents->x1;
-
- if (gran > 1) {
- if (gran > pitch) {
- /* we can't match the specified alignment with XY allocations */
- free(link);
- return NULL;
- }
-
- if (pitch % gran) {
- /* pitch and granularity aren't a perfect match, let's allocate
- * a bit more so we can align later on
- */
- length += gran - 1;
- }
- }
-
- if(length < pitch) { /* special case */
- w = length;
- h = 1;
- } else {
- w = pitch;
- h = (length + pitch - 1) / pitch;
- }
-
- if((area = localAllocateOffscreenArea(pScreen, w, h, gran,
- moveCB ? LinearMoveCBWrapper : NULL,
- removeCB ? LinearRemoveCBWrapper : NULL,
- privData)))
- {
- link->area = area;
- link->free = 0;
- link->next = offman->LinearAreas;
- offman->LinearAreas = link;
- linear = &(link->linear);
- linear->pScreen = pScreen;
- linear->size = h * w;
- linear->offset = (pitch * area->box.y1) + area->box.x1;
- if (gran > 1)
- linear->offset = ((linear->offset + gran - 1) / gran) * gran;
- linear->granularity = gran;
- linear->MoveLinearCallback = moveCB;
- linear->RemoveLinearCallback = removeCB;
- linear->devPrivate.ptr = privData;
- } else
- free(link);
-
- DumpDebug(offman->LinearAreas);
-
- return linear;
-}
-
-
-static void
-localFreeOffscreenLinear(FBLinearPtr linear)
-{
- FBManagerPtr offman;
- FBLinearLinkPtr pLink, pLinkPrev = NULL;
- ScreenPtr pScreen = linear->pScreen;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- pLink = offman->LinearAreas;
- if(!pLink) return;
-
- while(&(pLink->linear) != linear) {
- pLinkPrev = pLink;
- pLink = pLink->next;
- if(!pLink) return;
- }
-
- if(pLink->area) { /* really an XY area */
- DebugF("FREEING AREA\n");
- localFreeOffscreenArea(pLink->area);
- if(pLinkPrev)
- pLinkPrev->next = pLink->next;
- else offman->LinearAreas = pLink->next;
- free(pLink);
- DumpDebug(offman->LinearAreas);
- return;
- }
-
- pLink->free = 1;
-
- if (pLink->next && pLink->next->free) {
- FBLinearLinkPtr p = pLink->next;
- pLink->linear.size += p->linear.size;
- pLink->next = p->next;
- free(p);
- }
-
- if(pLinkPrev) {
- if (pLinkPrev->next && pLinkPrev->next->free && !pLinkPrev->area) {
- FBLinearLinkPtr p = pLinkPrev->next;
- pLinkPrev->linear.size += p->linear.size;
- pLinkPrev->next = p->next;
- free(p);
- }
- }
-
- DebugF("FREEING LINEAR\n");
- DumpDebug(offman->LinearAreas);
-}
-
-
-static Bool
-localResizeOffscreenLinear(FBLinearPtr resize, int length)
-{
- FBManagerPtr offman;
- FBLinearLinkPtr pLink;
- ScreenPtr pScreen = resize->pScreen;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- pLink = offman->LinearAreas;
- if(!pLink) return FALSE;
-
- while(&(pLink->linear) != resize) {
- pLink = pLink->next;
- if(!pLink) return FALSE;
- }
-
- /* This could actually be alot smarter and try to move allocations
- from XY to linear when available. For now if it was XY, we keep
- it XY */
-
- if(pLink->area) { /* really an XY area */
- BoxPtr extents;
- int pitch, w, h;
-
- extents = RegionExtents(offman->InitialBoxes);
- pitch = extents->x2 - extents->x1;
-
- if(length < pitch) { /* special case */
- w = length;
- h = 1;
- } else {
- w = pitch;
- h = (length + pitch - 1) / pitch;
- }
-
- if(localResizeOffscreenArea(pLink->area, w, h)) {
- resize->size = h * w;
- resize->offset = (pitch * pLink->area->box.y1) + pLink->area->box.x1;
- return TRUE;
- }
- } else {
- /* TODO!!!! resize the linear area */
- }
-
- return FALSE;
-}
-
-
-static Bool
-localQueryLargestOffscreenLinear(
- ScreenPtr pScreen,
- int *size,
- int gran,
- int priority
-)
-{
- FBManagerPtr offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- FBLinearLinkPtr pLink;
- FBLinearLinkPtr pLinkRet;
-
- *size = 0;
-
- pLink = offman->LinearAreas;
-
- if (pLink && !pLink->area) {
- pLinkRet = pLink;
- while (pLink) {
- if (pLink->free) {
- if (pLink->linear.size > pLinkRet->linear.size)
- pLinkRet = pLink;
- }
- pLink = pLink->next;
- }
-
- if (pLinkRet->free) {
- *size = pLinkRet->linear.size;
- return TRUE;
- }
- } else {
- int w, h;
-
- if(localQueryLargestOffscreenArea(pScreen, &w, &h, gran,
- FAVOR_WIDTH_THEN_AREA, priority))
- {
- FBManagerPtr offman;
- BoxPtr extents;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- extents = RegionExtents(offman->InitialBoxes);
- if((extents->x2 - extents->x1) == w)
- *size = w * h;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-
-static FBManagerFuncs xf86FBManFuncs = {
- localAllocateOffscreenArea,
- localFreeOffscreenArea,
- localResizeOffscreenArea,
- localQueryLargestOffscreenArea,
- localRegisterFreeBoxCallback,
- localAllocateOffscreenLinear,
- localFreeOffscreenLinear,
- localResizeOffscreenLinear,
- localQueryLargestOffscreenLinear,
- localPurgeUnlockedOffscreenAreas
- };
-
-
-static Bool
-xf86FBCloseScreen (int i, ScreenPtr pScreen)
-{
- FBLinkPtr pLink, tmp;
- FBLinearLinkPtr pLinearLink, tmp2;
- FBManagerPtr offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
-
- pScreen->CloseScreen = offman->CloseScreen;
-
- pLink = offman->UsedAreas;
- while(pLink) {
- tmp = pLink;
- pLink = pLink->next;
- free(tmp);
- }
-
- pLinearLink = offman->LinearAreas;
- while(pLinearLink) {
- tmp2 = pLinearLink;
- pLinearLink = pLinearLink->next;
- free(tmp2);
- }
-
- RegionDestroy(offman->InitialBoxes);
- RegionDestroy(offman->FreeBoxes);
-
- free(offman->FreeBoxesUpdateCallback);
- free(offman->devPrivates);
- free(offman);
- dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL);
-
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-Bool
-xf86InitFBManager(
- ScreenPtr pScreen,
- BoxPtr FullBox
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- RegionRec ScreenRegion;
- RegionRec FullRegion;
- BoxRec ScreenBox;
- Bool ret;
-
- ScreenBox.x1 = 0;
- ScreenBox.y1 = 0;
- ScreenBox.x2 = pScrn->virtualX;
- ScreenBox.y2 = pScrn->virtualY;
-
- if((FullBox->x1 > ScreenBox.x1) || (FullBox->y1 > ScreenBox.y1) ||
- (FullBox->x2 < ScreenBox.x2) || (FullBox->y2 < ScreenBox.y2)) {
- return FALSE;
- }
-
- if (FullBox->y2 < FullBox->y1) return FALSE;
- if (FullBox->x2 < FullBox->x1) return FALSE;
-
- RegionInit(&ScreenRegion, &ScreenBox, 1);
- RegionInit(&FullRegion, FullBox, 1);
-
- RegionSubtract(&FullRegion, &FullRegion, &ScreenRegion);
-
- ret = xf86InitFBManagerRegion(pScreen, &FullRegion);
-
- RegionUninit(&ScreenRegion);
- RegionUninit(&FullRegion);
-
- return ret;
-}
-
-Bool
-xf86InitFBManagerArea(
- ScreenPtr pScreen,
- int PixelArea,
- int Verbosity
-)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xRectangle Rect[3];
- RegionPtr pRegion, pScreenRegion;
- int nRect;
- Bool ret = FALSE;
-
- if (PixelArea < (pScrn->displayWidth * pScrn->virtualY))
- return FALSE;
-
- Rect[0].x = Rect[0].y = 0;
- Rect[0].width = pScrn->displayWidth;
- Rect[0].height = PixelArea / pScrn->displayWidth;
- nRect = 1;
-
- /* Add a possible partial scanline */
- if ((Rect[1].height = Rect[1].width = PixelArea % pScrn->displayWidth)) {
- Rect[1].x = 0;
- Rect[1].y = Rect[0].height;
- Rect[1].height = 1;
- nRect++;
- }
-
- /* Factor out virtual resolution */
- pRegion = RegionFromRects(nRect, Rect, 0);
- if (pRegion) {
- if (!RegionNar(pRegion)) {
- Rect[2].x = Rect[2].y = 0;
- Rect[2].width = pScrn->virtualX;
- Rect[2].height = pScrn->virtualY;
-
- pScreenRegion = RegionFromRects(1, &Rect[2], 0);
- if (pScreenRegion) {
- if (!RegionNar(pScreenRegion)) {
- RegionSubtract(pRegion, pRegion, pScreenRegion);
-
- ret = xf86InitFBManagerRegion(pScreen, pRegion);
-
- if (ret && xf86GetVerbosity() >= Verbosity) {
- int scrnIndex = pScrn->scrnIndex;
-
- xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
- "Largest offscreen areas (with overlaps):\n");
-
- if (Rect[2].width < Rect[0].width) {
- xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
- "\t%d x %d rectangle at %d,0\n",
- Rect[0].width - Rect[2].width,
- Rect[0].height,
- Rect[2].width);
- }
- if (Rect[2].width < Rect[1].width) {
- xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
- "\t%d x %d rectangle at %d,0\n",
- Rect[1].width - Rect[2].width,
- Rect[0].height + Rect[1].height,
- Rect[2].width);
- }
- if (Rect[2].height < Rect[0].height) {
- xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
- "\t%d x %d rectangle at 0,%d\n",
- Rect[0].width,
- Rect[0].height - Rect[2].height,
- Rect[2].height);
- }
- if (Rect[1].height) {
- xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
- "\t%d x %d rectangle at 0,%d\n",
- Rect[1].width,
- Rect[0].height - Rect[2].height +
- Rect[1].height,
- Rect[2].height);
- }
- }
- }
-
- RegionDestroy(pScreenRegion);
- }
- }
-
- RegionDestroy(pRegion);
- }
-
- return ret;
-}
-
-Bool
-xf86InitFBManagerRegion(
- ScreenPtr pScreen,
- RegionPtr FullRegion
-){
- FBManagerPtr offman;
-
- if(RegionNil(FullRegion))
- return FALSE;
-
- if (!dixRegisterPrivateKey(&xf86FBScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- if(!xf86RegisterOffscreenManager(pScreen, &xf86FBManFuncs))
- return FALSE;
-
- offman = malloc(sizeof(FBManager));
- if(!offman) return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, offman);
-
- offman->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = xf86FBCloseScreen;
-
- offman->InitialBoxes = RegionCreate(NULL, 1);
- offman->FreeBoxes = RegionCreate(NULL, 1);
-
- RegionCopy(offman->InitialBoxes, FullRegion);
- RegionCopy(offman->FreeBoxes, FullRegion);
-
- offman->pScreen = pScreen;
- offman->UsedAreas = NULL;
- offman->LinearAreas = NULL;
- offman->NumUsedAreas = 0;
- offman->NumCallbacks = 0;
- offman->FreeBoxesUpdateCallback = NULL;
- offman->devPrivates = NULL;
-
- return TRUE;
-}
-
-Bool
-xf86InitFBManagerLinear(
- ScreenPtr pScreen,
- int offset,
- int size
-){
- FBManagerPtr offman;
- FBLinearLinkPtr link;
- FBLinearPtr linear;
-
- if (size <= 0)
- return FALSE;
-
- /* we expect people to have called the Area setup first for pixmap cache */
- if (!dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey))
- return FALSE;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- offman->LinearAreas = malloc(sizeof(FBLinearLink));
- if (!offman->LinearAreas)
- return FALSE;
-
- link = offman->LinearAreas;
- link->area = NULL;
- link->next = NULL;
- link->free = 1;
- linear = &(link->linear);
- linear->pScreen = pScreen;
- linear->size = size;
- linear->offset = offset;
- linear->granularity = 0;
- linear->MoveLinearCallback = NULL;
- linear->RemoveLinearCallback = NULL;
- linear->devPrivate.ptr = NULL;
-
- return TRUE;
-}
-
-
-/* This is an implementation specific function and should
- disappear after the next release. People should use the
- real linear functions instead */
-
-FBAreaPtr
-xf86AllocateLinearOffscreenArea (
- ScreenPtr pScreen,
- int length,
- int gran,
- MoveAreaCallbackProcPtr moveCB,
- RemoveAreaCallbackProcPtr removeCB,
- pointer privData
-){
- FBManagerFuncsPtr funcs;
- FBManagerPtr offman;
- BoxPtr extents;
- int w, h;
-
- if(xf86FBManagerKey == NULL)
- return NULL;
- if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBManagerKey)))
- return NULL;
-
- offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
- xf86FBScreenKey);
- extents = RegionExtents(offman->InitialBoxes);
- w = extents->x2 - extents->x1;
-
- if (gran > 1) {
- if (gran > w)
- return NULL;
-
- if (w % gran)
- length += gran - 1;
- }
-
- if(length <= w) { /* special case */
- h = 1;
- w = length;
- } else {
- h = (length + w - 1) / w;
- }
-
- return (*funcs->AllocateOffscreenArea)(
- pScreen, w, h, gran, moveCB, removeCB, privData);
-}
+
+/*
+ * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "xf86fbman.h"
+
+/*
+#define DEBUG
+*/
+
+static DevPrivateKeyRec xf86FBManagerKeyRec;
+static DevPrivateKey xf86FBManagerKey;
+
+Bool
+xf86RegisterOffscreenManager(ScreenPtr pScreen, FBManagerFuncsPtr funcs)
+{
+
+ xf86FBManagerKey = &xf86FBManagerKeyRec;
+
+ if (!dixRegisterPrivateKey(&xf86FBManagerKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, xf86FBManagerKey, funcs);
+
+ return TRUE;
+}
+
+Bool
+xf86FBManagerRunning(ScreenPtr pScreen)
+{
+ if (xf86FBManagerKey == NULL)
+ return FALSE;
+
+ if (!dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+xf86RegisterFreeBoxCallback(ScreenPtr pScreen,
+ FreeBoxCallbackProcPtr FreeBoxCallback,
+ pointer devPriv)
+{
+ FBManagerFuncsPtr funcs;
+
+ if (xf86FBManagerKey == NULL)
+ return FALSE;
+ if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->RegisterFreeBoxCallback) (pScreen, FreeBoxCallback,
+ devPriv);
+}
+
+FBAreaPtr
+xf86AllocateOffscreenArea(ScreenPtr pScreen,
+ int w, int h,
+ int gran,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB, pointer privData)
+{
+ FBManagerFuncsPtr funcs;
+
+ if (xf86FBManagerKey == NULL)
+ return NULL;
+ if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return NULL;
+
+ return (*funcs->AllocateOffscreenArea) (pScreen, w, h, gran, moveCB,
+ removeCB, privData);
+}
+
+FBLinearPtr
+xf86AllocateOffscreenLinear(ScreenPtr pScreen,
+ int length,
+ int gran,
+ MoveLinearCallbackProcPtr moveCB,
+ RemoveLinearCallbackProcPtr removeCB,
+ pointer privData)
+{
+ FBManagerFuncsPtr funcs;
+
+ if (xf86FBManagerKey == NULL)
+ return NULL;
+ if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return NULL;
+
+ return (*funcs->AllocateOffscreenLinear) (pScreen, length, gran, moveCB,
+ removeCB, privData);
+}
+
+void
+xf86FreeOffscreenArea(FBAreaPtr area)
+{
+ FBManagerFuncsPtr funcs;
+
+ if (!area)
+ return;
+
+ if (xf86FBManagerKey == NULL)
+ return;
+ if (!
+ (funcs =
+ (FBManagerFuncsPtr) dixLookupPrivate(&area->pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return;
+
+ (*funcs->FreeOffscreenArea) (area);
+
+ return;
+}
+
+void
+xf86FreeOffscreenLinear(FBLinearPtr linear)
+{
+ FBManagerFuncsPtr funcs;
+
+ if (!linear)
+ return;
+
+ if (xf86FBManagerKey == NULL)
+ return;
+ if (!
+ (funcs =
+ (FBManagerFuncsPtr) dixLookupPrivate(&linear->pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return;
+
+ (*funcs->FreeOffscreenLinear) (linear);
+
+ return;
+}
+
+Bool
+xf86ResizeOffscreenArea(FBAreaPtr resize, int w, int h)
+{
+ FBManagerFuncsPtr funcs;
+
+ if (!resize)
+ return FALSE;
+
+ if (xf86FBManagerKey == NULL)
+ return FALSE;
+ if (!
+ (funcs =
+ (FBManagerFuncsPtr) dixLookupPrivate(&resize->pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->ResizeOffscreenArea) (resize, w, h);
+}
+
+Bool
+xf86ResizeOffscreenLinear(FBLinearPtr resize, int size)
+{
+ FBManagerFuncsPtr funcs;
+
+ if (!resize)
+ return FALSE;
+
+ if (xf86FBManagerKey == NULL)
+ return FALSE;
+ if (!
+ (funcs =
+ (FBManagerFuncsPtr) dixLookupPrivate(&resize->pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->ResizeOffscreenLinear) (resize, size);
+}
+
+Bool
+xf86QueryLargestOffscreenArea(ScreenPtr pScreen,
+ int *w, int *h,
+ int gran, int preferences, int severity)
+{
+ FBManagerFuncsPtr funcs;
+
+ *w = 0;
+ *h = 0;
+
+ if (xf86FBManagerKey == NULL)
+ return FALSE;
+ if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->QueryLargestOffscreenArea) (pScreen, w, h, gran,
+ preferences, severity);
+}
+
+Bool
+xf86QueryLargestOffscreenLinear(ScreenPtr pScreen,
+ int *size, int gran, int severity)
+{
+ FBManagerFuncsPtr funcs;
+
+ *size = 0;
+
+ if (xf86FBManagerKey == NULL)
+ return FALSE;
+ if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->QueryLargestOffscreenLinear) (pScreen, size, gran,
+ severity);
+}
+
+Bool
+xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
+{
+ FBManagerFuncsPtr funcs;
+
+ if (xf86FBManagerKey == NULL)
+ return FALSE;
+ if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->PurgeOffscreenAreas) (pScreen);
+}
+
+/************************************************************\
+
+ Below is a specific implementation of an offscreen manager.
+
+\************************************************************/
+
+static DevPrivateKeyRec xf86FBScreenKeyRec;
+
+#define xf86FBScreenKey (&xf86FBScreenKeyRec)
+
+typedef struct _FBLink {
+ FBArea area;
+ struct _FBLink *next;
+} FBLink, *FBLinkPtr;
+
+typedef struct _FBLinearLink {
+ FBLinear linear;
+ int free; /* need to add free here as FBLinear is publicly accessible */
+ FBAreaPtr area; /* only used if allocation came from XY area */
+ struct _FBLinearLink *next;
+} FBLinearLink, *FBLinearLinkPtr;
+
+typedef struct {
+ ScreenPtr pScreen;
+ RegionPtr InitialBoxes;
+ RegionPtr FreeBoxes;
+ FBLinkPtr UsedAreas;
+ int NumUsedAreas;
+ FBLinearLinkPtr LinearAreas;
+ CloseScreenProcPtr CloseScreen;
+ int NumCallbacks;
+ FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback;
+ DevUnion *devPrivates;
+} FBManager, *FBManagerPtr;
+
+static void
+SendCallFreeBoxCallbacks(FBManagerPtr offman)
+{
+ int i = offman->NumCallbacks;
+
+ while (i--) {
+ (*offman->FreeBoxesUpdateCallback[i]) (offman->pScreen,
+ offman->FreeBoxes,
+ offman->devPrivates[i].ptr);
+ }
+}
+
+static Bool
+localRegisterFreeBoxCallback(ScreenPtr pScreen,
+ FreeBoxCallbackProcPtr FreeBoxCallback,
+ pointer devPriv)
+{
+ FBManagerPtr offman;
+ FreeBoxCallbackProcPtr *newCallbacks;
+ DevUnion *newPrivates;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ newCallbacks = realloc(offman->FreeBoxesUpdateCallback,
+ sizeof(FreeBoxCallbackProcPtr) *
+ (offman->NumCallbacks + 1));
+
+ newPrivates = realloc(offman->devPrivates,
+ sizeof(DevUnion) * (offman->NumCallbacks + 1));
+
+ if (!newCallbacks || !newPrivates)
+ return FALSE;
+
+ offman->FreeBoxesUpdateCallback = newCallbacks;
+ offman->devPrivates = newPrivates;
+
+ offman->FreeBoxesUpdateCallback[offman->NumCallbacks] = FreeBoxCallback;
+ offman->devPrivates[offman->NumCallbacks].ptr = devPriv;
+ offman->NumCallbacks++;
+
+ SendCallFreeBoxCallbacks(offman);
+
+ return TRUE;
+}
+
+static FBAreaPtr
+AllocateArea(FBManagerPtr offman,
+ int w, int h,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB, pointer privData)
+{
+ ScreenPtr pScreen = offman->pScreen;
+ FBLinkPtr link = NULL;
+ FBAreaPtr area = NULL;
+ RegionRec NewReg;
+ int i, x = 0, num;
+ BoxPtr boxp;
+
+ if (granularity <= 1)
+ granularity = 0;
+
+ boxp = RegionRects(offman->FreeBoxes);
+ num = RegionNumRects(offman->FreeBoxes);
+
+ /* look through the free boxes */
+ for (i = 0; i < num; i++, boxp++) {
+ x = boxp->x1;
+ if (granularity > 1)
+ x = ((x + granularity - 1) / granularity) * granularity;
+
+ if (((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w))
+ continue;
+
+ link = malloc(sizeof(FBLink));
+ if (!link)
+ return NULL;
+
+ area = &(link->area);
+ link->next = offman->UsedAreas;
+ offman->UsedAreas = link;
+ offman->NumUsedAreas++;
+ break;
+ }
+
+ /* try to boot a removeable one out if we are not expendable ourselves */
+ if (!area && !removeCB) {
+ link = offman->UsedAreas;
+
+ while (link) {
+ if (!link->area.RemoveAreaCallback) {
+ link = link->next;
+ continue;
+ }
+
+ boxp = &(link->area.box);
+ x = boxp->x1;
+ if (granularity > 1)
+ x = ((x + granularity - 1) / granularity) * granularity;
+
+ if (((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) {
+ link = link->next;
+ continue;
+ }
+
+ /* bye, bye */
+ (*link->area.RemoveAreaCallback) (&link->area);
+ RegionInit(&NewReg, &(link->area.box), 1);
+ RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &NewReg);
+ RegionUninit(&NewReg);
+
+ area = &(link->area);
+ break;
+ }
+ }
+
+ if (area) {
+ area->pScreen = pScreen;
+ area->granularity = granularity;
+ area->box.x1 = x;
+ area->box.x2 = x + w;
+ area->box.y1 = boxp->y1;
+ area->box.y2 = boxp->y1 + h;
+ area->MoveAreaCallback = moveCB;
+ area->RemoveAreaCallback = removeCB;
+ area->devPrivate.ptr = privData;
+
+ RegionInit(&NewReg, &(area->box), 1);
+ RegionSubtract(offman->FreeBoxes, offman->FreeBoxes, &NewReg);
+ RegionUninit(&NewReg);
+ }
+
+ return area;
+}
+
+static FBAreaPtr
+localAllocateOffscreenArea(ScreenPtr pScreen,
+ int w, int h,
+ int gran,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB, pointer privData)
+{
+ FBManagerPtr offman;
+ FBAreaPtr area = NULL;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ if ((area = AllocateArea(offman, w, h, gran, moveCB, removeCB, privData)))
+ SendCallFreeBoxCallbacks(offman);
+
+ return area;
+}
+
+static void
+localFreeOffscreenArea(FBAreaPtr area)
+{
+ FBManagerPtr offman;
+ FBLinkPtr pLink, pLinkPrev = NULL;
+ RegionRec FreedRegion;
+ ScreenPtr pScreen;
+
+ pScreen = area->pScreen;
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ pLink = offman->UsedAreas;
+ if (!pLink)
+ return;
+
+ while (&(pLink->area) != area) {
+ pLinkPrev = pLink;
+ pLink = pLink->next;
+ if (!pLink)
+ return;
+ }
+
+ /* put the area back into the pool */
+ RegionInit(&FreedRegion, &(pLink->area.box), 1);
+ RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &FreedRegion);
+ RegionUninit(&FreedRegion);
+
+ if (pLinkPrev)
+ pLinkPrev->next = pLink->next;
+ else
+ offman->UsedAreas = pLink->next;
+
+ free(pLink);
+ offman->NumUsedAreas--;
+
+ SendCallFreeBoxCallbacks(offman);
+}
+
+static Bool
+localResizeOffscreenArea(FBAreaPtr resize, int w, int h)
+{
+ FBManagerPtr offman;
+ ScreenPtr pScreen;
+ BoxRec OrigArea;
+ RegionRec FreedReg;
+ FBAreaPtr area = NULL;
+ FBLinkPtr pLink, newLink, pLinkPrev = NULL;
+
+ pScreen = resize->pScreen;
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ /* find this link */
+ if (!(pLink = offman->UsedAreas))
+ return FALSE;
+
+ while (&(pLink->area) != resize) {
+ pLinkPrev = pLink;
+ pLink = pLink->next;
+ if (!pLink)
+ return FALSE;
+ }
+
+ OrigArea.x1 = resize->box.x1;
+ OrigArea.x2 = resize->box.x2;
+ OrigArea.y1 = resize->box.y1;
+ OrigArea.y2 = resize->box.y2;
+
+ /* if it's smaller, this is easy */
+
+ if ((w <= (resize->box.x2 - resize->box.x1)) &&
+ (h <= (resize->box.y2 - resize->box.y1))) {
+ RegionRec NewReg;
+
+ resize->box.x2 = resize->box.x1 + w;
+ resize->box.y2 = resize->box.y1 + h;
+
+ if ((resize->box.y2 == OrigArea.y2) && (resize->box.x2 == OrigArea.x2))
+ return TRUE;
+
+ RegionInit(&FreedReg, &OrigArea, 1);
+ RegionInit(&NewReg, &(resize->box), 1);
+ RegionSubtract(&FreedReg, &FreedReg, &NewReg);
+ RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
+ RegionUninit(&FreedReg);
+ RegionUninit(&NewReg);
+
+ SendCallFreeBoxCallbacks(offman);
+
+ return TRUE;
+ }
+
+ /* otherwise we remove the old region */
+
+ RegionInit(&FreedReg, &OrigArea, 1);
+ RegionUnion(offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
+
+ /* remove the old link */
+ if (pLinkPrev)
+ pLinkPrev->next = pLink->next;
+ else
+ offman->UsedAreas = pLink->next;
+
+ /* and try to add a new one */
+
+ if ((area = AllocateArea(offman, w, h, resize->granularity,
+ resize->MoveAreaCallback,
+ resize->RemoveAreaCallback,
+ resize->devPrivate.ptr))) {
+
+ /* copy data over to our link and replace the new with old */
+ memcpy(resize, area, sizeof(FBArea));
+
+ pLinkPrev = NULL;
+ newLink = offman->UsedAreas;
+
+ while (&(newLink->area) != area) {
+ pLinkPrev = newLink;
+ newLink = newLink->next;
+ }
+
+ if (pLinkPrev)
+ pLinkPrev->next = newLink->next;
+ else
+ offman->UsedAreas = newLink->next;
+
+ pLink->next = offman->UsedAreas;
+ offman->UsedAreas = pLink;
+
+ free(newLink);
+
+ /* AllocateArea added one but we really only exchanged one */
+ offman->NumUsedAreas--;
+ }
+ else {
+ /* reinstate the old region */
+ RegionSubtract(offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
+ RegionUninit(&FreedReg);
+
+ pLink->next = offman->UsedAreas;
+ offman->UsedAreas = pLink;
+ return FALSE;
+ }
+
+ RegionUninit(&FreedReg);
+
+ SendCallFreeBoxCallbacks(offman);
+
+ return TRUE;
+}
+
+static Bool
+localQueryLargestOffscreenArea(ScreenPtr pScreen,
+ int *width, int *height,
+ int granularity, int preferences, int severity)
+{
+ FBManagerPtr offman;
+ RegionPtr newRegion = NULL;
+ BoxPtr pbox;
+ int nbox;
+ int x, w, h, area, oldArea;
+
+ *width = *height = oldArea = 0;
+
+ if (granularity <= 1)
+ granularity = 0;
+
+ if ((preferences < 0) || (preferences > 3))
+ return FALSE;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ if (severity < 0)
+ severity = 0;
+ if (severity > 2)
+ severity = 2;
+
+ switch (severity) {
+ case 2:
+ if (offman->NumUsedAreas) {
+ FBLinkPtr pLink;
+ RegionRec tmpRegion;
+
+ newRegion = RegionCreate(NULL, 1);
+ RegionCopy(newRegion, offman->InitialBoxes);
+ pLink = offman->UsedAreas;
+
+ while (pLink) {
+ if (!pLink->area.RemoveAreaCallback) {
+ RegionInit(&tmpRegion, &(pLink->area.box), 1);
+ RegionSubtract(newRegion, newRegion, &tmpRegion);
+ RegionUninit(&tmpRegion);
+ }
+ pLink = pLink->next;
+ }
+
+ nbox = RegionNumRects(newRegion);
+ pbox = RegionRects(newRegion);
+ break;
+ }
+ case 1:
+ if (offman->NumUsedAreas) {
+ FBLinkPtr pLink;
+ RegionRec tmpRegion;
+
+ newRegion = RegionCreate(NULL, 1);
+ RegionCopy(newRegion, offman->FreeBoxes);
+ pLink = offman->UsedAreas;
+
+ while (pLink) {
+ if (pLink->area.RemoveAreaCallback) {
+ RegionInit(&tmpRegion, &(pLink->area.box), 1);
+ RegionAppend(newRegion, &tmpRegion);
+ RegionUninit(&tmpRegion);
+ }
+ pLink = pLink->next;
+ }
+
+ nbox = RegionNumRects(newRegion);
+ pbox = RegionRects(newRegion);
+ break;
+ }
+ default:
+ nbox = RegionNumRects(offman->FreeBoxes);
+ pbox = RegionRects(offman->FreeBoxes);
+ break;
+ }
+
+ while (nbox--) {
+ x = pbox->x1;
+ if (granularity > 1)
+ x = ((x + granularity - 1) / granularity) * granularity;
+
+ w = pbox->x2 - x;
+ h = pbox->y2 - pbox->y1;
+ area = w * h;
+
+ if (w > 0) {
+ Bool gotIt = FALSE;
+
+ switch (preferences) {
+ case FAVOR_AREA_THEN_WIDTH:
+ if ((area > oldArea) || ((area == oldArea) && (w > *width)))
+ gotIt = TRUE;
+ break;
+ case FAVOR_AREA_THEN_HEIGHT:
+ if ((area > oldArea) || ((area == oldArea) && (h > *height)))
+ gotIt = TRUE;
+ break;
+ case FAVOR_WIDTH_THEN_AREA:
+ if ((w > *width) || ((w == *width) && (area > oldArea)))
+ gotIt = TRUE;
+ break;
+ case FAVOR_HEIGHT_THEN_AREA:
+ if ((h > *height) || ((h == *height) && (area > oldArea)))
+ gotIt = TRUE;
+ break;
+ }
+ if (gotIt) {
+ *width = w;
+ *height = h;
+ oldArea = area;
+ }
+ }
+ pbox++;
+ }
+
+ if (newRegion)
+ RegionDestroy(newRegion);
+
+ return TRUE;
+}
+
+static Bool
+localPurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
+{
+ FBManagerPtr offman;
+ FBLinkPtr pLink, tmp, pPrev = NULL;
+ RegionRec FreedRegion;
+ Bool anyUsed = FALSE;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ pLink = offman->UsedAreas;
+ if (!pLink)
+ return TRUE;
+
+ while (pLink) {
+ if (pLink->area.RemoveAreaCallback) {
+ (*pLink->area.RemoveAreaCallback) (&pLink->area);
+
+ RegionInit(&FreedRegion, &(pLink->area.box), 1);
+ RegionAppend(offman->FreeBoxes, &FreedRegion);
+ RegionUninit(&FreedRegion);
+
+ if (pPrev)
+ pPrev->next = pLink->next;
+ else
+ offman->UsedAreas = pLink->next;
+
+ tmp = pLink;
+ pLink = pLink->next;
+ free(tmp);
+ offman->NumUsedAreas--;
+ anyUsed = TRUE;
+ }
+ else {
+ pPrev = pLink;
+ pLink = pLink->next;
+ }
+ }
+
+ if (anyUsed) {
+ RegionValidate(offman->FreeBoxes, &anyUsed);
+ SendCallFreeBoxCallbacks(offman);
+ }
+
+ return TRUE;
+}
+
+static void
+LinearMoveCBWrapper(FBAreaPtr from, FBAreaPtr to)
+{
+ /* this will never get called */
+}
+
+static void
+LinearRemoveCBWrapper(FBAreaPtr area)
+{
+ FBManagerPtr offman;
+ FBLinearLinkPtr pLink, pLinkPrev = NULL;
+ ScreenPtr pScreen = area->pScreen;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ pLink = offman->LinearAreas;
+ if (!pLink)
+ return;
+
+ while (pLink->area != area) {
+ pLinkPrev = pLink;
+ pLink = pLink->next;
+ if (!pLink)
+ return;
+ }
+
+ /* give the user the callback it is expecting */
+ (*pLink->linear.RemoveLinearCallback) (&(pLink->linear));
+
+ if (pLinkPrev)
+ pLinkPrev->next = pLink->next;
+ else
+ offman->LinearAreas = pLink->next;
+
+ free(pLink);
+}
+
+static void
+DumpDebug(FBLinearLinkPtr pLink)
+{
+#ifdef DEBUG
+ if (!pLink)
+ ErrorF("MMmm, PLINK IS NULL!\n");
+
+ while (pLink) {
+ ErrorF(" Offset:%08x, Size:%08x, %s,%s\n",
+ pLink->linear.offset,
+ pLink->linear.size,
+ pLink->free ? "Free" : "Used", pLink->area ? "Area" : "Linear");
+
+ pLink = pLink->next;
+ }
+#endif
+}
+
+static FBLinearPtr
+AllocateLinear(FBManagerPtr offman, int size, int granularity, pointer privData)
+{
+ ScreenPtr pScreen = offman->pScreen;
+ FBLinearLinkPtr linear = NULL;
+ FBLinearLinkPtr newlink = NULL;
+ int offset, end;
+
+ if (size <= 0)
+ return NULL;
+
+ if (!offman->LinearAreas)
+ return NULL;
+
+ linear = offman->LinearAreas;
+ while (linear) {
+ /* Make sure we get a free area that's not an XY fallback case */
+ if (!linear->area && linear->free) {
+ offset = linear->linear.offset;
+ if (granularity > 1)
+ offset =
+ ((offset + granularity - 1) / granularity) * granularity;
+ end = offset + size;
+ if (end <= (linear->linear.offset + linear->linear.size))
+ break;
+ }
+ linear = linear->next;
+ }
+ if (!linear)
+ return NULL;
+
+ /* break left */
+ if (offset > linear->linear.offset) {
+ newlink = malloc(sizeof(FBLinearLink));
+ if (!newlink)
+ return NULL;
+ newlink->area = NULL;
+ newlink->linear.offset = offset;
+ newlink->linear.size =
+ linear->linear.size - (offset - linear->linear.offset);
+ newlink->free = 1;
+ newlink->next = linear->next;
+ linear->linear.size -= newlink->linear.size;
+ linear->next = newlink;
+ linear = newlink;
+ }
+
+ /* break right */
+ if (size < linear->linear.size) {
+ newlink = malloc(sizeof(FBLinearLink));
+ if (!newlink)
+ return NULL;
+ newlink->area = NULL;
+ newlink->linear.offset = offset + size;
+ newlink->linear.size = linear->linear.size - size;
+ newlink->free = 1;
+ newlink->next = linear->next;
+ linear->linear.size = size;
+ linear->next = newlink;
+ }
+
+ /* p = middle block */
+ linear->linear.granularity = granularity;
+ linear->free = 0;
+ linear->linear.pScreen = pScreen;
+ linear->linear.MoveLinearCallback = NULL;
+ linear->linear.RemoveLinearCallback = NULL;
+ linear->linear.devPrivate.ptr = NULL;
+
+ DumpDebug(offman->LinearAreas);
+
+ return &(linear->linear);
+}
+
+static FBLinearPtr
+localAllocateOffscreenLinear(ScreenPtr pScreen,
+ int length,
+ int gran,
+ MoveLinearCallbackProcPtr moveCB,
+ RemoveLinearCallbackProcPtr removeCB,
+ pointer privData)
+{
+ FBManagerPtr offman;
+ FBLinearLinkPtr link;
+ FBAreaPtr area;
+ FBLinearPtr linear = NULL;
+ BoxPtr extents;
+ int w, h, pitch;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+
+ /* Try to allocate from linear memory first...... */
+ DebugF("ALLOCATING LINEAR\n");
+ if ((linear = AllocateLinear(offman, length, gran, privData)))
+ return linear;
+
+ DebugF("NOPE, ALLOCATING AREA\n");
+
+ if (!(link = malloc(sizeof(FBLinearLink))))
+ return NULL;
+
+ /* No linear available, so try and pinch some from the XY areas */
+ extents = RegionExtents(offman->InitialBoxes);
+ pitch = extents->x2 - extents->x1;
+
+ if (gran > 1) {
+ if (gran > pitch) {
+ /* we can't match the specified alignment with XY allocations */
+ free(link);
+ return NULL;
+ }
+
+ if (pitch % gran) {
+ /* pitch and granularity aren't a perfect match, let's allocate
+ * a bit more so we can align later on
+ */
+ length += gran - 1;
+ }
+ }
+
+ if (length < pitch) { /* special case */
+ w = length;
+ h = 1;
+ }
+ else {
+ w = pitch;
+ h = (length + pitch - 1) / pitch;
+ }
+
+ if ((area = localAllocateOffscreenArea(pScreen, w, h, gran,
+ moveCB ? LinearMoveCBWrapper : NULL,
+ removeCB ? LinearRemoveCBWrapper :
+ NULL, privData))) {
+ link->area = area;
+ link->free = 0;
+ link->next = offman->LinearAreas;
+ offman->LinearAreas = link;
+ linear = &(link->linear);
+ linear->pScreen = pScreen;
+ linear->size = h * w;
+ linear->offset = (pitch * area->box.y1) + area->box.x1;
+ if (gran > 1)
+ linear->offset = ((linear->offset + gran - 1) / gran) * gran;
+ linear->granularity = gran;
+ linear->MoveLinearCallback = moveCB;
+ linear->RemoveLinearCallback = removeCB;
+ linear->devPrivate.ptr = privData;
+ }
+ else
+ free(link);
+
+ DumpDebug(offman->LinearAreas);
+
+ return linear;
+}
+
+static void
+localFreeOffscreenLinear(FBLinearPtr linear)
+{
+ FBManagerPtr offman;
+ FBLinearLinkPtr pLink, pLinkPrev = NULL;
+ ScreenPtr pScreen = linear->pScreen;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ pLink = offman->LinearAreas;
+ if (!pLink)
+ return;
+
+ while (&(pLink->linear) != linear) {
+ pLinkPrev = pLink;
+ pLink = pLink->next;
+ if (!pLink)
+ return;
+ }
+
+ if (pLink->area) { /* really an XY area */
+ DebugF("FREEING AREA\n");
+ localFreeOffscreenArea(pLink->area);
+ if (pLinkPrev)
+ pLinkPrev->next = pLink->next;
+ else
+ offman->LinearAreas = pLink->next;
+ free(pLink);
+ DumpDebug(offman->LinearAreas);
+ return;
+ }
+
+ pLink->free = 1;
+
+ if (pLink->next && pLink->next->free) {
+ FBLinearLinkPtr p = pLink->next;
+
+ pLink->linear.size += p->linear.size;
+ pLink->next = p->next;
+ free(p);
+ }
+
+ if (pLinkPrev) {
+ if (pLinkPrev->next && pLinkPrev->next->free && !pLinkPrev->area) {
+ FBLinearLinkPtr p = pLinkPrev->next;
+
+ pLinkPrev->linear.size += p->linear.size;
+ pLinkPrev->next = p->next;
+ free(p);
+ }
+ }
+
+ DebugF("FREEING LINEAR\n");
+ DumpDebug(offman->LinearAreas);
+}
+
+static Bool
+localResizeOffscreenLinear(FBLinearPtr resize, int length)
+{
+ FBManagerPtr offman;
+ FBLinearLinkPtr pLink;
+ ScreenPtr pScreen = resize->pScreen;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ pLink = offman->LinearAreas;
+ if (!pLink)
+ return FALSE;
+
+ while (&(pLink->linear) != resize) {
+ pLink = pLink->next;
+ if (!pLink)
+ return FALSE;
+ }
+
+ /* This could actually be alot smarter and try to move allocations
+ from XY to linear when available. For now if it was XY, we keep
+ it XY */
+
+ if (pLink->area) { /* really an XY area */
+ BoxPtr extents;
+ int pitch, w, h;
+
+ extents = RegionExtents(offman->InitialBoxes);
+ pitch = extents->x2 - extents->x1;
+
+ if (length < pitch) { /* special case */
+ w = length;
+ h = 1;
+ }
+ else {
+ w = pitch;
+ h = (length + pitch - 1) / pitch;
+ }
+
+ if (localResizeOffscreenArea(pLink->area, w, h)) {
+ resize->size = h * w;
+ resize->offset =
+ (pitch * pLink->area->box.y1) + pLink->area->box.x1;
+ return TRUE;
+ }
+ }
+ else {
+ /* TODO!!!! resize the linear area */
+ }
+
+ return FALSE;
+}
+
+static Bool
+localQueryLargestOffscreenLinear(ScreenPtr pScreen,
+ int *size, int gran, int priority)
+{
+ FBManagerPtr offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ FBLinearLinkPtr pLink;
+ FBLinearLinkPtr pLinkRet;
+
+ *size = 0;
+
+ pLink = offman->LinearAreas;
+
+ if (pLink && !pLink->area) {
+ pLinkRet = pLink;
+ while (pLink) {
+ if (pLink->free) {
+ if (pLink->linear.size > pLinkRet->linear.size)
+ pLinkRet = pLink;
+ }
+ pLink = pLink->next;
+ }
+
+ if (pLinkRet->free) {
+ *size = pLinkRet->linear.size;
+ return TRUE;
+ }
+ }
+ else {
+ int w, h;
+
+ if (localQueryLargestOffscreenArea(pScreen, &w, &h, gran,
+ FAVOR_WIDTH_THEN_AREA, priority)) {
+ FBManagerPtr offman;
+ BoxPtr extents;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ extents = RegionExtents(offman->InitialBoxes);
+ if ((extents->x2 - extents->x1) == w)
+ *size = w * h;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static FBManagerFuncs xf86FBManFuncs = {
+ localAllocateOffscreenArea,
+ localFreeOffscreenArea,
+ localResizeOffscreenArea,
+ localQueryLargestOffscreenArea,
+ localRegisterFreeBoxCallback,
+ localAllocateOffscreenLinear,
+ localFreeOffscreenLinear,
+ localResizeOffscreenLinear,
+ localQueryLargestOffscreenLinear,
+ localPurgeUnlockedOffscreenAreas
+};
+
+static Bool
+xf86FBCloseScreen(int i, ScreenPtr pScreen)
+{
+ FBLinkPtr pLink, tmp;
+ FBLinearLinkPtr pLinearLink, tmp2;
+ FBManagerPtr offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+
+ pScreen->CloseScreen = offman->CloseScreen;
+
+ pLink = offman->UsedAreas;
+ while (pLink) {
+ tmp = pLink;
+ pLink = pLink->next;
+ free(tmp);
+ }
+
+ pLinearLink = offman->LinearAreas;
+ while (pLinearLink) {
+ tmp2 = pLinearLink;
+ pLinearLink = pLinearLink->next;
+ free(tmp2);
+ }
+
+ RegionDestroy(offman->InitialBoxes);
+ RegionDestroy(offman->FreeBoxes);
+
+ free(offman->FreeBoxesUpdateCallback);
+ free(offman->devPrivates);
+ free(offman);
+ dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+Bool
+xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RegionRec ScreenRegion;
+ RegionRec FullRegion;
+ BoxRec ScreenBox;
+ Bool ret;
+
+ ScreenBox.x1 = 0;
+ ScreenBox.y1 = 0;
+ ScreenBox.x2 = pScrn->virtualX;
+ ScreenBox.y2 = pScrn->virtualY;
+
+ if ((FullBox->x1 > ScreenBox.x1) || (FullBox->y1 > ScreenBox.y1) ||
+ (FullBox->x2 < ScreenBox.x2) || (FullBox->y2 < ScreenBox.y2)) {
+ return FALSE;
+ }
+
+ if (FullBox->y2 < FullBox->y1)
+ return FALSE;
+ if (FullBox->x2 < FullBox->x1)
+ return FALSE;
+
+ RegionInit(&ScreenRegion, &ScreenBox, 1);
+ RegionInit(&FullRegion, FullBox, 1);
+
+ RegionSubtract(&FullRegion, &FullRegion, &ScreenRegion);
+
+ ret = xf86InitFBManagerRegion(pScreen, &FullRegion);
+
+ RegionUninit(&ScreenRegion);
+ RegionUninit(&FullRegion);
+
+ return ret;
+}
+
+Bool
+xf86InitFBManagerArea(ScreenPtr pScreen, int PixelArea, int Verbosity)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xRectangle Rect[3];
+ RegionPtr pRegion, pScreenRegion;
+ int nRect;
+ Bool ret = FALSE;
+
+ if (PixelArea < (pScrn->displayWidth * pScrn->virtualY))
+ return FALSE;
+
+ Rect[0].x = Rect[0].y = 0;
+ Rect[0].width = pScrn->displayWidth;
+ Rect[0].height = PixelArea / pScrn->displayWidth;
+ nRect = 1;
+
+ /* Add a possible partial scanline */
+ if ((Rect[1].height = Rect[1].width = PixelArea % pScrn->displayWidth)) {
+ Rect[1].x = 0;
+ Rect[1].y = Rect[0].height;
+ Rect[1].height = 1;
+ nRect++;
+ }
+
+ /* Factor out virtual resolution */
+ pRegion = RegionFromRects(nRect, Rect, 0);
+ if (pRegion) {
+ if (!RegionNar(pRegion)) {
+ Rect[2].x = Rect[2].y = 0;
+ Rect[2].width = pScrn->virtualX;
+ Rect[2].height = pScrn->virtualY;
+
+ pScreenRegion = RegionFromRects(1, &Rect[2], 0);
+ if (pScreenRegion) {
+ if (!RegionNar(pScreenRegion)) {
+ RegionSubtract(pRegion, pRegion, pScreenRegion);
+
+ ret = xf86InitFBManagerRegion(pScreen, pRegion);
+
+ if (ret && xf86GetVerbosity() >= Verbosity) {
+ int scrnIndex = pScrn->scrnIndex;
+
+ xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
+ "Largest offscreen areas (with overlaps):\n");
+
+ if (Rect[2].width < Rect[0].width) {
+ xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
+ "\t%d x %d rectangle at %d,0\n",
+ Rect[0].width - Rect[2].width,
+ Rect[0].height, Rect[2].width);
+ }
+ if (Rect[2].width < Rect[1].width) {
+ xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
+ "\t%d x %d rectangle at %d,0\n",
+ Rect[1].width - Rect[2].width,
+ Rect[0].height + Rect[1].height,
+ Rect[2].width);
+ }
+ if (Rect[2].height < Rect[0].height) {
+ xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
+ "\t%d x %d rectangle at 0,%d\n",
+ Rect[0].width,
+ Rect[0].height - Rect[2].height,
+ Rect[2].height);
+ }
+ if (Rect[1].height) {
+ xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
+ "\t%d x %d rectangle at 0,%d\n",
+ Rect[1].width,
+ Rect[0].height - Rect[2].height +
+ Rect[1].height, Rect[2].height);
+ }
+ }
+ }
+
+ RegionDestroy(pScreenRegion);
+ }
+ }
+
+ RegionDestroy(pRegion);
+ }
+
+ return ret;
+}
+
+Bool
+xf86InitFBManagerRegion(ScreenPtr pScreen, RegionPtr FullRegion)
+{
+ FBManagerPtr offman;
+
+ if (RegionNil(FullRegion))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&xf86FBScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ if (!xf86RegisterOffscreenManager(pScreen, &xf86FBManFuncs))
+ return FALSE;
+
+ offman = malloc(sizeof(FBManager));
+ if (!offman)
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, offman);
+
+ offman->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xf86FBCloseScreen;
+
+ offman->InitialBoxes = RegionCreate(NULL, 1);
+ offman->FreeBoxes = RegionCreate(NULL, 1);
+
+ RegionCopy(offman->InitialBoxes, FullRegion);
+ RegionCopy(offman->FreeBoxes, FullRegion);
+
+ offman->pScreen = pScreen;
+ offman->UsedAreas = NULL;
+ offman->LinearAreas = NULL;
+ offman->NumUsedAreas = 0;
+ offman->NumCallbacks = 0;
+ offman->FreeBoxesUpdateCallback = NULL;
+ offman->devPrivates = NULL;
+
+ return TRUE;
+}
+
+Bool
+xf86InitFBManagerLinear(ScreenPtr pScreen, int offset, int size)
+{
+ FBManagerPtr offman;
+ FBLinearLinkPtr link;
+ FBLinearPtr linear;
+
+ if (size <= 0)
+ return FALSE;
+
+ /* we expect people to have called the Area setup first for pixmap cache */
+ if (!dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey))
+ return FALSE;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ offman->LinearAreas = malloc(sizeof(FBLinearLink));
+ if (!offman->LinearAreas)
+ return FALSE;
+
+ link = offman->LinearAreas;
+ link->area = NULL;
+ link->next = NULL;
+ link->free = 1;
+ linear = &(link->linear);
+ linear->pScreen = pScreen;
+ linear->size = size;
+ linear->offset = offset;
+ linear->granularity = 0;
+ linear->MoveLinearCallback = NULL;
+ linear->RemoveLinearCallback = NULL;
+ linear->devPrivate.ptr = NULL;
+
+ return TRUE;
+}
+
+/* This is an implementation specific function and should
+ disappear after the next release. People should use the
+ real linear functions instead */
+
+FBAreaPtr
+xf86AllocateLinearOffscreenArea(ScreenPtr pScreen,
+ int length,
+ int gran,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData)
+{
+ FBManagerFuncsPtr funcs;
+ FBManagerPtr offman;
+ BoxPtr extents;
+ int w, h;
+
+ if (xf86FBManagerKey == NULL)
+ return NULL;
+ if (!(funcs = (FBManagerFuncsPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return NULL;
+
+ offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ extents = RegionExtents(offman->InitialBoxes);
+ w = extents->x2 - extents->x1;
+
+ if (gran > 1) {
+ if (gran > w)
+ return NULL;
+
+ if (w % gran)
+ length += gran - 1;
+ }
+
+ if (length <= w) { /* special case */
+ h = 1;
+ w = length;
+ }
+ else {
+ h = (length + w - 1) / w;
+ }
+
+ return (*funcs->AllocateOffscreenArea) (pScreen, w, h, gran, moveCB,
+ removeCB, privData);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86fbman.h b/xorg-server/hw/xfree86/common/xf86fbman.h
index 1b3c31635..99bf9917b 100644
--- a/xorg-server/hw/xfree86/common/xf86fbman.h
+++ b/xorg-server/hw/xfree86/common/xf86fbman.h
@@ -29,11 +29,9 @@
#ifndef _XF86FBMAN_H
#define _XF86FBMAN_H
-
#include "scrnintstr.h"
#include "regionstr.h"
-
#define FAVOR_AREA_THEN_WIDTH 0
#define FAVOR_AREA_THEN_HEIGHT 1
#define FAVOR_WIDTH_THEN_AREA 2
@@ -43,184 +41,131 @@
#define PRIORITY_NORMAL 1
#define PRIORITY_EXTREME 2
-
typedef struct _FBArea {
- ScreenPtr pScreen;
- BoxRec box;
- int granularity;
- void (*MoveAreaCallback)(struct _FBArea*, struct _FBArea*);
- void (*RemoveAreaCallback)(struct _FBArea*);
- DevUnion devPrivate;
+ ScreenPtr pScreen;
+ BoxRec box;
+ int granularity;
+ void (*MoveAreaCallback) (struct _FBArea *, struct _FBArea *);
+ void (*RemoveAreaCallback) (struct _FBArea *);
+ DevUnion devPrivate;
} FBArea, *FBAreaPtr;
typedef struct _FBLinear {
- ScreenPtr pScreen;
- int size;
- int offset;
- int granularity;
- void (*MoveLinearCallback)(struct _FBLinear*, struct _FBLinear*);
- void (*RemoveLinearCallback)(struct _FBLinear*);
- DevUnion devPrivate;
+ ScreenPtr pScreen;
+ int size;
+ int offset;
+ int granularity;
+ void (*MoveLinearCallback) (struct _FBLinear *, struct _FBLinear *);
+ void (*RemoveLinearCallback) (struct _FBLinear *);
+ DevUnion devPrivate;
} FBLinear, *FBLinearPtr;
-typedef void (*FreeBoxCallbackProcPtr)(ScreenPtr, RegionPtr, pointer);
-typedef void (*MoveAreaCallbackProcPtr)(FBAreaPtr, FBAreaPtr);
-typedef void (*RemoveAreaCallbackProcPtr)(FBAreaPtr);
-
-typedef void (*MoveLinearCallbackProcPtr)(FBLinearPtr, FBLinearPtr);
-typedef void (*RemoveLinearCallbackProcPtr)(FBLinearPtr);
+typedef void (*FreeBoxCallbackProcPtr) (ScreenPtr, RegionPtr, pointer);
+typedef void (*MoveAreaCallbackProcPtr) (FBAreaPtr, FBAreaPtr);
+typedef void (*RemoveAreaCallbackProcPtr) (FBAreaPtr);
+typedef void (*MoveLinearCallbackProcPtr) (FBLinearPtr, FBLinearPtr);
+typedef void (*RemoveLinearCallbackProcPtr) (FBLinearPtr);
typedef struct {
- FBAreaPtr (*AllocateOffscreenArea)(
- ScreenPtr pScreen,
- int w, int h,
- int granularity,
- MoveAreaCallbackProcPtr moveCB,
- RemoveAreaCallbackProcPtr removeCB,
- pointer privData);
- void (*FreeOffscreenArea)(FBAreaPtr area);
- Bool (*ResizeOffscreenArea)(FBAreaPtr area, int w, int h);
- Bool (*QueryLargestOffscreenArea)(
- ScreenPtr pScreen,
- int *width, int *height,
- int granularity,
- int preferences,
- int priority);
- Bool (*RegisterFreeBoxCallback)(
- ScreenPtr pScreen,
- FreeBoxCallbackProcPtr FreeBoxCallback,
- pointer devPriv);
+ FBAreaPtr(*AllocateOffscreenArea) (ScreenPtr pScreen,
+ int w, int h,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData);
+ void (*FreeOffscreenArea) (FBAreaPtr area);
+ Bool (*ResizeOffscreenArea) (FBAreaPtr area, int w, int h);
+ Bool (*QueryLargestOffscreenArea) (ScreenPtr pScreen,
+ int *width, int *height,
+ int granularity,
+ int preferences, int priority);
+ Bool (*RegisterFreeBoxCallback) (ScreenPtr pScreen,
+ FreeBoxCallbackProcPtr FreeBoxCallback,
+ pointer devPriv);
/* linear functions */
- FBLinearPtr (*AllocateOffscreenLinear)(
- ScreenPtr pScreen,
- int size,
- int granularity,
- MoveLinearCallbackProcPtr moveCB,
- RemoveLinearCallbackProcPtr removeCB,
- pointer privData);
- void (*FreeOffscreenLinear)(FBLinearPtr area);
- Bool (*ResizeOffscreenLinear)(FBLinearPtr area, int size);
- Bool (*QueryLargestOffscreenLinear)(
- ScreenPtr pScreen,
- int *size,
- int granularity,
- int priority);
- Bool (*PurgeOffscreenAreas) (ScreenPtr);
+ FBLinearPtr(*AllocateOffscreenLinear) (ScreenPtr pScreen,
+ int size,
+ int granularity,
+ MoveLinearCallbackProcPtr moveCB,
+ RemoveLinearCallbackProcPtr
+ removeCB, pointer privData);
+ void (*FreeOffscreenLinear) (FBLinearPtr area);
+ Bool (*ResizeOffscreenLinear) (FBLinearPtr area, int size);
+ Bool (*QueryLargestOffscreenLinear) (ScreenPtr pScreen,
+ int *size,
+ int granularity, int priority);
+ Bool (*PurgeOffscreenAreas) (ScreenPtr);
} FBManagerFuncs, *FBManagerFuncsPtr;
-
-extern _X_EXPORT Bool xf86RegisterOffscreenManager(
- ScreenPtr pScreen,
- FBManagerFuncsPtr funcs
-);
+extern _X_EXPORT Bool xf86RegisterOffscreenManager(ScreenPtr pScreen,
+ FBManagerFuncsPtr funcs);
extern _X_EXPORT Bool
-xf86InitFBManagerRegion(
- ScreenPtr pScreen,
- RegionPtr ScreenRegion
-);
+ xf86InitFBManagerRegion(ScreenPtr pScreen, RegionPtr ScreenRegion);
extern _X_EXPORT Bool
-xf86InitFBManagerArea(
- ScreenPtr pScreen,
- int PixalArea,
- int Verbosity
-);
+ xf86InitFBManagerArea(ScreenPtr pScreen, int PixalArea, int Verbosity);
extern _X_EXPORT Bool
-xf86InitFBManager(
- ScreenPtr pScreen,
- BoxPtr FullBox
-);
+ xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox);
extern _X_EXPORT Bool
-xf86InitFBManagerLinear(
- ScreenPtr pScreen,
- int offset,
- int size
-);
+ xf86InitFBManagerLinear(ScreenPtr pScreen, int offset, int size);
extern _X_EXPORT Bool
-xf86FBManagerRunning(
- ScreenPtr pScreen
-);
+ xf86FBManagerRunning(ScreenPtr pScreen);
extern _X_EXPORT FBAreaPtr
-xf86AllocateOffscreenArea (
- ScreenPtr pScreen,
- int w, int h,
- int granularity,
- MoveAreaCallbackProcPtr moveCB,
- RemoveAreaCallbackProcPtr removeCB,
- pointer privData
-);
+xf86AllocateOffscreenArea(ScreenPtr pScreen,
+ int w, int h,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB, pointer privData);
extern _X_EXPORT FBAreaPtr
-xf86AllocateLinearOffscreenArea (
- ScreenPtr pScreen,
- int length,
- int granularity,
- MoveAreaCallbackProcPtr moveCB,
- RemoveAreaCallbackProcPtr removeCB,
- pointer privData
-);
+xf86AllocateLinearOffscreenArea(ScreenPtr pScreen,
+ int length,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData);
extern _X_EXPORT FBLinearPtr
-xf86AllocateOffscreenLinear (
- ScreenPtr pScreen,
- int length,
- int granularity,
- MoveLinearCallbackProcPtr moveCB,
- RemoveLinearCallbackProcPtr removeCB,
- pointer privData
-);
+xf86AllocateOffscreenLinear(ScreenPtr pScreen,
+ int length,
+ int granularity,
+ MoveLinearCallbackProcPtr moveCB,
+ RemoveLinearCallbackProcPtr removeCB,
+ pointer privData);
extern _X_EXPORT void xf86FreeOffscreenArea(FBAreaPtr area);
extern _X_EXPORT void xf86FreeOffscreenLinear(FBLinearPtr area);
extern _X_EXPORT Bool
-xf86ResizeOffscreenArea(
- FBAreaPtr resize,
- int w, int h
-);
+ xf86ResizeOffscreenArea(FBAreaPtr resize, int w, int h);
extern _X_EXPORT Bool
-xf86ResizeOffscreenLinear(
- FBLinearPtr resize,
- int size
-);
-
+ xf86ResizeOffscreenLinear(FBLinearPtr resize, int size);
extern _X_EXPORT Bool
-xf86RegisterFreeBoxCallback(
- ScreenPtr pScreen,
- FreeBoxCallbackProcPtr FreeBoxCallback,
- pointer devPriv
-);
-extern _X_EXPORT Bool
-xf86PurgeUnlockedOffscreenAreas(
- ScreenPtr pScreen
-);
+xf86RegisterFreeBoxCallback(ScreenPtr pScreen,
+ FreeBoxCallbackProcPtr FreeBoxCallback,
+ pointer devPriv);
+extern _X_EXPORT Bool
+ xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen);
extern _X_EXPORT Bool
-xf86QueryLargestOffscreenArea(
- ScreenPtr pScreen,
- int *width, int *height,
- int granularity,
- int preferences,
- int priority
-);
+
+xf86QueryLargestOffscreenArea(ScreenPtr pScreen,
+ int *width, int *height,
+ int granularity, int preferences, int priority);
extern _X_EXPORT Bool
-xf86QueryLargestOffscreenLinear(
- ScreenPtr pScreen,
- int *size,
- int granularity,
- int priority
-);
+xf86QueryLargestOffscreenLinear(ScreenPtr pScreen,
+ int *size, int granularity, int priority);
-#endif /* _XF86FBMAN_H */
+#endif /* _XF86FBMAN_H */
diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.c b/xorg-server/hw/xfree86/common/xf86pciBus.c
index b95b25359..e52f1da84 100644
--- a/xorg-server/hw/xfree86/common/xf86pciBus.c
+++ b/xorg-server/hw/xfree86/common/xf86pciBus.c
@@ -41,7 +41,7 @@
#include "Pci.h"
#include "xf86.h"
#include "xf86Priv.h"
-#include "dirent.h" /* DIR, FILE type definitions */
+#include "dirent.h" /* DIR, FILE type definitions */
/* Bus-specific headers */
#include "xf86Bus.h"
@@ -77,7 +77,6 @@ Bool pciSlotClaimed = FALSE;
(((c) & 0x00ffff00) \
== ((PCI_CLASS_DISPLAY << 16) | (PCI_SUBCLASS_DISPLAY_VGA << 8)))
-
static struct pci_slot_match xf86IsolateDevice = {
PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0
};
@@ -93,108 +92,110 @@ xf86PciProbe(void)
int num = 0;
struct pci_device *info;
struct pci_device_iterator *iter;
- struct pci_device ** xf86PciVideoInfo = NULL;
-
+ struct pci_device **xf86PciVideoInfo = NULL;
if (!xf86scanpci()) {
- xf86PciVideoInfo = NULL;
- return;
+ xf86PciVideoInfo = NULL;
+ return;
}
- iter = pci_slot_match_iterator_create(& xf86IsolateDevice);
+ iter = pci_slot_match_iterator_create(&xf86IsolateDevice);
while ((info = pci_device_next(iter)) != NULL) {
- if (PCIINFOCLASSES(info->device_class)) {
- num++;
- xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo,
- (sizeof(struct pci_device *)
- * (num + 1)));
- xf86PciVideoInfo[num] = NULL;
- xf86PciVideoInfo[num - 1] = info;
-
- pci_device_probe(info);
- if (pci_device_is_boot_vga(info)) {
+ if (PCIINFOCLASSES(info->device_class)) {
+ num++;
+ xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo,
+ (sizeof(struct pci_device *)
+ * (num + 1)));
+ xf86PciVideoInfo[num] = NULL;
+ xf86PciVideoInfo[num - 1] = info;
+
+ pci_device_probe(info);
+ if (pci_device_is_boot_vga(info)) {
primaryBus.type = BUS_PCI;
primaryBus.id.pci = info;
}
- info->user_data = 0;
- }
+ info->user_data = 0;
+ }
}
free(iter);
/* If we haven't found a primary device try a different heuristic */
if (primaryBus.type == BUS_NONE && num) {
- for (i = 0; i < num; i++) {
- uint16_t command;
-
- info = xf86PciVideoInfo[i];
- pci_device_cfg_read_u16(info, & command, 4);
-
- if ((command & PCI_CMD_MEM_ENABLE)
- && ((num == 1) || IS_VGA(info->device_class))) {
- if (primaryBus.type == BUS_NONE) {
- primaryBus.type = BUS_PCI;
- primaryBus.id.pci = info;
- } else {
- xf86Msg(X_NOTICE,
- "More than one possible primary device found\n");
- primaryBus.type ^= (BusType)(-1);
- }
- }
- }
+ for (i = 0; i < num; i++) {
+ uint16_t command;
+
+ info = xf86PciVideoInfo[i];
+ pci_device_cfg_read_u16(info, &command, 4);
+
+ if ((command & PCI_CMD_MEM_ENABLE)
+ && ((num == 1) || IS_VGA(info->device_class))) {
+ if (primaryBus.type == BUS_NONE) {
+ primaryBus.type = BUS_PCI;
+ primaryBus.id.pci = info;
+ }
+ else {
+ xf86Msg(X_NOTICE,
+ "More than one possible primary device found\n");
+ primaryBus.type ^= (BusType) (-1);
+ }
+ }
+ }
}
-
+
/* Print a summary of the video devices found */
for (k = 0; k < num; k++) {
- const char *prim = " ";
- Bool memdone = FALSE, iodone = FALSE;
-
+ const char *prim = " ";
+ Bool memdone = FALSE, iodone = FALSE;
- info = xf86PciVideoInfo[k];
+ info = xf86PciVideoInfo[k];
- if (!PCIALWAYSPRINTCLASSES(info->device_class))
- continue;
+ if (!PCIALWAYSPRINTCLASSES(info->device_class))
+ continue;
- if (xf86IsPrimaryPci(info))
- prim = "*";
+ if (xf86IsPrimaryPci(info))
+ prim = "*";
- xf86Msg(X_PROBED, "PCI:%s(%u:%u:%u:%u) %04x:%04x:%04x:%04x ", prim,
- info->domain, info->bus, info->dev, info->func,
- info->vendor_id, info->device_id,
- info->subvendor_id, info->subdevice_id);
+ xf86Msg(X_PROBED, "PCI:%s(%u:%u:%u:%u) %04x:%04x:%04x:%04x ", prim,
+ info->domain, info->bus, info->dev, info->func,
+ info->vendor_id, info->device_id,
+ info->subvendor_id, info->subdevice_id);
- xf86ErrorF("rev %d", info->revision);
+ xf86ErrorF("rev %d", info->revision);
- for (i = 0; i < 6; i++) {
- struct pci_mem_region * r = & info->regions[i];
+ for (i = 0; i < 6; i++) {
+ struct pci_mem_region *r = &info->regions[i];
- if ( r->size && ! r->is_IO ) {
- if (!memdone) {
- xf86ErrorF(", Mem @ ");
- memdone = TRUE;
- } else
- xf86ErrorF(", ");
- xf86ErrorF("0x%08lx/%ld", (long)r->base_addr, (long)r->size);
- }
- }
+ if (r->size && !r->is_IO) {
+ if (!memdone) {
+ xf86ErrorF(", Mem @ ");
+ memdone = TRUE;
+ }
+ else
+ xf86ErrorF(", ");
+ xf86ErrorF("0x%08lx/%ld", (long) r->base_addr, (long) r->size);
+ }
+ }
- for (i = 0; i < 6; i++) {
- struct pci_mem_region * r = & info->regions[i];
+ for (i = 0; i < 6; i++) {
+ struct pci_mem_region *r = &info->regions[i];
- if ( r->size && r->is_IO ) {
- if (!iodone) {
- xf86ErrorF(", I/O @ ");
- iodone = TRUE;
- } else
- xf86ErrorF(", ");
- xf86ErrorF("0x%08lx/%ld", (long)r->base_addr, (long)r->size);
- }
- }
+ if (r->size && r->is_IO) {
+ if (!iodone) {
+ xf86ErrorF(", I/O @ ");
+ iodone = TRUE;
+ }
+ else
+ xf86ErrorF(", ");
+ xf86ErrorF("0x%08lx/%ld", (long) r->base_addr, (long) r->size);
+ }
+ }
- if ( info->rom_size ) {
- xf86ErrorF(", BIOS @ 0x\?\?\?\?\?\?\?\?/%ld", (long)info->rom_size);
- }
+ if (info->rom_size) {
+ xf86ErrorF(", BIOS @ 0x\?\?\?\?\?\?\?\?/%ld",
+ (long) info->rom_size);
+ }
- xf86ErrorF("\n");
+ xf86ErrorF("\n");
}
free(xf86PciVideoInfo);
}
@@ -205,28 +206,29 @@ xf86PciProbe(void)
*/
int
-xf86ClaimPciSlot(struct pci_device * d, DriverPtr drvp,
- int chipset, GDevPtr dev, Bool active)
+xf86ClaimPciSlot(struct pci_device *d, DriverPtr drvp,
+ int chipset, GDevPtr dev, Bool active)
{
EntityPtr p = NULL;
int num;
-
+
if (xf86CheckPciSlot(d)) {
- num = xf86AllocateEntity();
- p = xf86Entities[num];
- p->driver = drvp;
- p->chipset = chipset;
- p->bus.type = BUS_PCI;
- p->bus.id.pci = d;
- p->active = active;
- p->inUse = FALSE;
- if (dev)
+ num = xf86AllocateEntity();
+ p = xf86Entities[num];
+ p->driver = drvp;
+ p->chipset = chipset;
+ p->bus.type = BUS_PCI;
+ p->bus.id.pci = d;
+ p->active = active;
+ p->inUse = FALSE;
+ if (dev)
xf86AddDevToEntity(num, dev);
- pciSlotClaimed = TRUE;
+ pciSlotClaimed = TRUE;
- return num;
- } else
- return -1;
+ return num;
+ }
+ else
+ return -1;
}
/*
@@ -238,13 +240,13 @@ xf86UnclaimPciSlot(struct pci_device *d)
int i;
for (i = 0; i < xf86NumEntities; i++) {
- const EntityPtr p = xf86Entities[i];
+ const EntityPtr p = xf86Entities[i];
- if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) {
- /* Probably the slot should be deallocated? */
- p->bus.type = BUS_NONE;
- return;
- }
+ if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) {
+ /* Probably the slot should be deallocated? */
+ p->bus.type = BUS_NONE;
+ return;
+ }
}
}
@@ -267,56 +269,56 @@ xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func)
int i;
if (StringToBusType(busID, &id) != BUS_PCI)
- return FALSE;
+ return FALSE;
s = xstrdup(id);
p = strtok(s, ":");
if (p == NULL || *p == 0) {
- free(s);
- return FALSE;
+ free(s);
+ return FALSE;
}
d = strpbrk(p, "@");
if (d != NULL) {
- *(d++) = 0;
- for (i = 0; d[i] != 0; i++) {
- if (!isdigit(d[i])) {
- free(s);
- return FALSE;
- }
- }
+ *(d++) = 0;
+ for (i = 0; d[i] != 0; i++) {
+ if (!isdigit(d[i])) {
+ free(s);
+ return FALSE;
+ }
+ }
}
for (i = 0; p[i] != 0; i++) {
- if (!isdigit(p[i])) {
- free(s);
- return FALSE;
- }
+ if (!isdigit(p[i])) {
+ free(s);
+ return FALSE;
+ }
}
*bus = atoi(p);
if (d != NULL && *d != 0)
- *bus += atoi(d) << 8;
+ *bus += atoi(d) << 8;
p = strtok(NULL, ":");
if (p == NULL || *p == 0) {
- free(s);
- return FALSE;
+ free(s);
+ return FALSE;
}
for (i = 0; p[i] != 0; i++) {
- if (!isdigit(p[i])) {
- free(s);
- return FALSE;
- }
+ if (!isdigit(p[i])) {
+ free(s);
+ return FALSE;
+ }
}
*device = atoi(p);
*func = 0;
p = strtok(NULL, ":");
if (p == NULL || *p == 0) {
- free(s);
- return TRUE;
+ free(s);
+ return TRUE;
}
for (i = 0; p[i] != 0; i++) {
- if (!isdigit(p[i])) {
- free(s);
- return FALSE;
- }
+ if (!isdigit(p[i])) {
+ free(s);
+ return FALSE;
+ }
}
*func = atoi(p);
free(s);
@@ -333,9 +335,10 @@ xf86ComparePciBusString(const char *busID, int bus, int device, int func)
int ibus, idevice, ifunc;
if (xf86ParsePciBusString(busID, &ibus, &idevice, &ifunc)) {
- return bus == ibus && device == idevice && func == ifunc;
- } else {
- return FALSE;
+ return bus == ibus && device == idevice && func == ifunc;
+ }
+ else {
+ return FALSE;
}
}
@@ -343,7 +346,7 @@ xf86ComparePciBusString(const char *busID, int bus, int device, int func)
* xf86IsPrimaryPci() -- return TRUE if primary device
* is PCI and bus, dev and func numbers match.
*/
-
+
Bool
xf86IsPrimaryPci(struct pci_device *pPci)
{
@@ -357,9 +360,9 @@ struct pci_device *
xf86GetPciInfoForEntity(int entityIndex)
{
EntityPtr p;
-
+
if (entityIndex >= xf86NumEntities)
- return NULL;
+ return NULL;
p = xf86Entities[entityIndex];
return (p->bus.type == BUS_PCI) ? p->bus.id.pci : NULL;
@@ -370,13 +373,13 @@ xf86GetPciInfoForEntity(int entityIndex)
* PCI base address register values for the given PCI device.
*/
Bool
-xf86CheckPciMemBase( struct pci_device * pPci, memType base )
+xf86CheckPciMemBase(struct pci_device *pPci, memType base)
{
int i;
for (i = 0; i < 6; i++)
- if (base == pPci->regions[i].base_addr)
- return TRUE;
+ if (base == pPci->regions[i].base_addr)
+ return TRUE;
return FALSE;
}
@@ -390,11 +393,11 @@ xf86CheckPciSlot(const struct pci_device *d)
int i;
for (i = 0; i < xf86NumEntities; i++) {
- const EntityPtr p = xf86Entities[i];
+ const EntityPtr p = xf86Entities[i];
- if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) {
- return FALSE;
- }
+ if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) {
+ return FALSE;
+ }
}
return TRUE;
}
@@ -405,41 +408,41 @@ xf86CheckPciSlot(const struct pci_device *d)
Bool
xf86PciAddMatchingDev(DriverPtr drvp)
{
- const struct pci_id_match * const devices = drvp->supported_devices;
+ const struct pci_id_match *const devices = drvp->supported_devices;
int j;
struct pci_device *pPci;
struct pci_device_iterator *iter;
int numFound = 0;
-
iter = pci_id_match_iterator_create(NULL);
while ((pPci = pci_device_next(iter)) != NULL) {
- /* Determine if this device is supported by the driver. If it is,
- * add it to the list of devices to configure.
- */
- for (j = 0 ; ! END_OF_MATCHES(devices[j]) ; j++) {
- if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
- && PCI_ID_COMPARE( devices[j].device_id, pPci->device_id )
- && ((devices[j].device_class_mask & pPci->device_class)
- == devices[j].device_class) ) {
- if (xf86CheckPciSlot(pPci)) {
- GDevPtr pGDev = xf86AddBusDeviceToConfigure(
- drvp->driverName, BUS_PCI, pPci, -1);
- if (pGDev != NULL) {
- /* After configure pass 1, chipID and chipRev are
- * treated as over-rides, so clobber them here.
- */
- pGDev->chipID = -1;
- pGDev->chipRev = -1;
- }
+ /* Determine if this device is supported by the driver. If it is,
+ * add it to the list of devices to configure.
+ */
+ for (j = 0; !END_OF_MATCHES(devices[j]); j++) {
+ if (PCI_ID_COMPARE(devices[j].vendor_id, pPci->vendor_id)
+ && PCI_ID_COMPARE(devices[j].device_id, pPci->device_id)
+ && ((devices[j].device_class_mask & pPci->device_class)
+ == devices[j].device_class)) {
+ if (xf86CheckPciSlot(pPci)) {
+ GDevPtr pGDev =
+ xf86AddBusDeviceToConfigure(drvp->driverName, BUS_PCI,
+ pPci, -1);
+ if (pGDev != NULL) {
+ /* After configure pass 1, chipID and chipRev are
+ * treated as over-rides, so clobber them here.
+ */
+ pGDev->chipID = -1;
+ pGDev->chipRev = -1;
+ }
- numFound++;
- }
+ numFound++;
+ }
- break;
+ break;
+ }
}
}
- }
pci_iterator_destroy(iter);
@@ -450,97 +453,96 @@ Bool
xf86PciProbeDev(DriverPtr drvp)
{
int i, j;
- struct pci_device * pPci;
+ struct pci_device *pPci;
Bool foundScreen = FALSE;
- const struct pci_id_match * const devices = drvp->supported_devices;
+ const struct pci_id_match *const devices = drvp->supported_devices;
GDevPtr *devList;
- const unsigned numDevs = xf86MatchDevice(drvp->driverName, & devList);
-
- for ( i = 0 ; i < numDevs ; i++ ) {
- struct pci_device_iterator *iter;
- unsigned device_id;
-
-
- /* Find the pciVideoRec associated with this device section.
- */
- iter = pci_id_match_iterator_create(NULL);
- while ((pPci = pci_device_next(iter)) != NULL) {
- if (devList[i]->busID && *devList[i]->busID) {
- if (xf86ComparePciBusString(devList[i]->busID,
- ((pPci->domain << 8)
- | pPci->bus),
- pPci->dev,
- pPci->func)) {
- break;
- }
- }
- else if (xf86IsPrimaryPci(pPci)) {
- break;
- }
- }
-
- pci_iterator_destroy(iter);
-
- if (pPci == NULL) {
- continue;
- }
- device_id = (devList[i]->chipID > 0)
- ? devList[i]->chipID : pPci->device_id;
-
-
- /* Once the pciVideoRec is found, determine if the device is supported
- * by the driver. If it is, probe it!
- */
- for ( j = 0 ; ! END_OF_MATCHES( devices[j] ) ; j++ ) {
- if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
- && PCI_ID_COMPARE( devices[j].device_id, device_id )
+ const unsigned numDevs = xf86MatchDevice(drvp->driverName, &devList);
+
+ for (i = 0; i < numDevs; i++) {
+ struct pci_device_iterator *iter;
+ unsigned device_id;
+
+ /* Find the pciVideoRec associated with this device section.
+ */
+ iter = pci_id_match_iterator_create(NULL);
+ while ((pPci = pci_device_next(iter)) != NULL) {
+ if (devList[i]->busID && *devList[i]->busID) {
+ if (xf86ComparePciBusString(devList[i]->busID,
+ ((pPci->domain << 8)
+ | pPci->bus),
+ pPci->dev, pPci->func)) {
+ break;
+ }
+ }
+ else if (xf86IsPrimaryPci(pPci)) {
+ break;
+ }
+ }
+
+ pci_iterator_destroy(iter);
+
+ if (pPci == NULL) {
+ continue;
+ }
+ device_id = (devList[i]->chipID > 0)
+ ? devList[i]->chipID : pPci->device_id;
+
+ /* Once the pciVideoRec is found, determine if the device is supported
+ * by the driver. If it is, probe it!
+ */
+ for (j = 0; !END_OF_MATCHES(devices[j]); j++) {
+ if (PCI_ID_COMPARE(devices[j].vendor_id, pPci->vendor_id)
+ && PCI_ID_COMPARE(devices[j].device_id, device_id)
&& ((devices[j].device_class_mask & pPci->device_class)
- == devices[j].device_class) ) {
- int entry;
-
- /* Allow the same entity to be used more than once for
- * devices with multiple screens per entity. This assumes
- * implicitly that there will be a screen == 0 instance.
- *
- * FIXME Need to make sure that two different drivers don't
- * FIXME claim the same screen > 0 instance.
- */
- if ((devList[i]->screen == 0) && !xf86CheckPciSlot(pPci))
- continue;
-
- DebugF("%s: card at %d:%d:%d is claimed by a Device section\n",
- drvp->driverName, pPci->bus, pPci->dev, pPci->func);
-
- /* Allocate an entry in the lists to be returned */
- entry = xf86ClaimPciSlot(pPci, drvp, device_id,
+ == devices[j].device_class)) {
+ int entry;
+
+ /* Allow the same entity to be used more than once for
+ * devices with multiple screens per entity. This assumes
+ * implicitly that there will be a screen == 0 instance.
+ *
+ * FIXME Need to make sure that two different drivers don't
+ * FIXME claim the same screen > 0 instance.
+ */
+ if ((devList[i]->screen == 0) && !xf86CheckPciSlot(pPci))
+ continue;
+
+ DebugF("%s: card at %d:%d:%d is claimed by a Device section\n",
+ drvp->driverName, pPci->bus, pPci->dev, pPci->func);
+
+ /* Allocate an entry in the lists to be returned */
+ entry = xf86ClaimPciSlot(pPci, drvp, device_id,
devList[i], devList[i]->active);
- if ((entry == -1) && (devList[i]->screen > 0)) {
- unsigned k;
-
- for (k = 0; k < xf86NumEntities; k++ ) {
- EntityPtr pEnt = xf86Entities[k];
- if (pEnt->bus.type != BUS_PCI)
- continue;
- if (pEnt->bus.id.pci == pPci) {
- entry = k;
- xf86AddDevToEntity(k, devList[i]);
- break;
- }
- }
- }
-
- if (entry != -1) {
- if ((*drvp->PciProbe)(drvp, entry, pPci,
- devices[j].match_data)) {
- foundScreen = TRUE;
- } else
- xf86UnclaimPciSlot(pPci);
- }
-
- break;
- }
- }
+ if ((entry == -1) && (devList[i]->screen > 0)) {
+ unsigned k;
+
+ for (k = 0; k < xf86NumEntities; k++) {
+ EntityPtr pEnt = xf86Entities[k];
+
+ if (pEnt->bus.type != BUS_PCI)
+ continue;
+ if (pEnt->bus.id.pci == pPci) {
+ entry = k;
+ xf86AddDevToEntity(k, devList[i]);
+ break;
+ }
+ }
+ }
+
+ if (entry != -1) {
+ if ((*drvp->PciProbe) (drvp, entry, pPci,
+ devices[j].match_data)) {
+ foundScreen = TRUE;
+ }
+ else
+ xf86UnclaimPciSlot(pPci);
+ }
+
+ break;
+ }
+ }
}
free(devList);
@@ -557,7 +559,8 @@ xf86PciIsolateDevice(char *argument)
xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus);
xf86IsolateDevice.dev = device;
xf86IsolateDevice.func = func;
- } else
+ }
+ else
FatalError("Invalid isolated device specification\n");
}
@@ -567,25 +570,24 @@ pciDeviceHasBars(struct pci_device *pci)
int i;
for (i = 0; i < 6; i++)
- if (pci->regions[i].size)
- return TRUE;
+ if (pci->regions[i].size)
+ return TRUE;
if (pci->rom_size)
- return TRUE;
+ return TRUE;
return FALSE;
}
struct Inst {
- struct pci_device * pci;
- GDevPtr dev;
- Bool foundHW; /* PCIid in list of supported chipsets */
- Bool claimed; /* BusID matches with a device section */
- int chip;
- int screen;
+ struct pci_device *pci;
+ GDevPtr dev;
+ Bool foundHW; /* PCIid in list of supported chipsets */
+ Bool claimed; /* BusID matches with a device section */
+ int chip;
+ int screen;
};
-
/**
* Find set of unclaimed devices matching a given vendor ID.
*
@@ -620,12 +622,12 @@ struct Inst {
*/
int
xf86MatchPciInstances(const char *driverName, int vendorID,
- SymTabPtr chipsets, PciChipsets *PCIchipsets,
- GDevPtr *devList, int numDevs, DriverPtr drvp,
- int **foundEntities)
+ SymTabPtr chipsets, PciChipsets * PCIchipsets,
+ GDevPtr * devList, int numDevs, DriverPtr drvp,
+ int **foundEntities)
{
- int i,j;
- struct pci_device * pPci;
+ int i, j;
+ struct pci_device *pPci;
struct pci_device_iterator *iter;
struct Inst *instances = NULL;
int numClaimedInstances = 0;
@@ -637,7 +639,6 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
*foundEntities = NULL;
-
/* Each PCI device will contribute at least one entry. Each device
* section can contribute at most one entry. The sum of the two is
* guaranteed to be larger than the maximum possible number of entries.
@@ -645,199 +646,199 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
* need for realloc calls inside the loop.
*/
if (!(xf86DoConfigure && xf86DoConfigurePass1)) {
- unsigned max_entries = numDevs;
+ unsigned max_entries = numDevs;
- iter = pci_slot_match_iterator_create(NULL);
- while ((pPci = pci_device_next(iter)) != NULL) {
- max_entries++;
- }
+ iter = pci_slot_match_iterator_create(NULL);
+ while ((pPci = pci_device_next(iter)) != NULL) {
+ max_entries++;
+ }
- pci_iterator_destroy(iter);
- instances = xnfalloc(max_entries * sizeof(struct Inst));
+ pci_iterator_destroy(iter);
+ instances = xnfalloc(max_entries * sizeof(struct Inst));
}
iter = pci_slot_match_iterator_create(NULL);
while ((pPci = pci_device_next(iter)) != NULL) {
- unsigned device_class = pPci->device_class;
- Bool foundVendor = FALSE;
-
-
- /* Convert the pre-PCI 2.0 device class for a VGA adapter to the
- * 2.0 version of the same class.
- */
- if ( device_class == 0x00000101 ) {
- device_class = 0x00030000;
- }
-
-
- /* Find PCI devices that match the given vendor ID. The vendor ID is
- * either specified explicitly as a parameter to the function or
- * implicitly encoded in the high bits of id->PCIid.
- *
- * The first device with a matching vendor is recorded, even if the
- * device ID doesn't match. This is done because the Device section
- * in the xorg.conf file can over-ride the device ID. A matching PCI
- * ID might not be found now, but after the device ID over-ride is
- * applied there /might/ be a match.
- */
- for (id = PCIchipsets; id->PCIid != -1; id++) {
- const unsigned vendor_id = ((id->PCIid & 0xFFFF0000) >> 16)
- | vendorID;
- const unsigned device_id = (id->PCIid & 0x0000FFFF);
- const unsigned match_class = 0x00030000 | id->PCIid;
-
- if ((vendor_id == pPci->vendor_id)
- || ((vendorID == PCI_VENDOR_GENERIC) && (match_class == device_class))) {
- if (!foundVendor && (instances != NULL)) {
- ++allocatedInstances;
- instances[allocatedInstances - 1].pci = pPci;
- instances[allocatedInstances - 1].dev = NULL;
- instances[allocatedInstances - 1].claimed = FALSE;
- instances[allocatedInstances - 1].foundHW = FALSE;
- instances[allocatedInstances - 1].screen = 0;
- }
-
- foundVendor = TRUE;
-
- if ( (device_id == pPci->device_id)
- || ((vendorID == PCI_VENDOR_GENERIC)
- && (match_class == device_class)) ) {
- if ( instances != NULL ) {
- instances[allocatedInstances - 1].foundHW = TRUE;
- instances[allocatedInstances - 1].chip = id->numChipset;
- }
-
-
- if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
- if (xf86CheckPciSlot(pPci)) {
- GDevPtr pGDev =
- xf86AddBusDeviceToConfigure(drvp->driverName,
- BUS_PCI, pPci, -1);
- if (pGDev) {
- /* After configure pass 1, chipID and chipRev
- * are treated as over-rides, so clobber them
- * here.
- */
- pGDev->chipID = -1;
- pGDev->chipRev = -1;
- }
-
- numFound++;
- }
- }
- else {
- numFound++;
- }
-
- break;
- }
- }
- }
+ unsigned device_class = pPci->device_class;
+ Bool foundVendor = FALSE;
+
+ /* Convert the pre-PCI 2.0 device class for a VGA adapter to the
+ * 2.0 version of the same class.
+ */
+ if (device_class == 0x00000101) {
+ device_class = 0x00030000;
+ }
+
+ /* Find PCI devices that match the given vendor ID. The vendor ID is
+ * either specified explicitly as a parameter to the function or
+ * implicitly encoded in the high bits of id->PCIid.
+ *
+ * The first device with a matching vendor is recorded, even if the
+ * device ID doesn't match. This is done because the Device section
+ * in the xorg.conf file can over-ride the device ID. A matching PCI
+ * ID might not be found now, but after the device ID over-ride is
+ * applied there /might/ be a match.
+ */
+ for (id = PCIchipsets; id->PCIid != -1; id++) {
+ const unsigned vendor_id = ((id->PCIid & 0xFFFF0000) >> 16)
+ | vendorID;
+ const unsigned device_id = (id->PCIid & 0x0000FFFF);
+ const unsigned match_class = 0x00030000 | id->PCIid;
+
+ if ((vendor_id == pPci->vendor_id)
+ || ((vendorID == PCI_VENDOR_GENERIC) &&
+ (match_class == device_class))) {
+ if (!foundVendor && (instances != NULL)) {
+ ++allocatedInstances;
+ instances[allocatedInstances - 1].pci = pPci;
+ instances[allocatedInstances - 1].dev = NULL;
+ instances[allocatedInstances - 1].claimed = FALSE;
+ instances[allocatedInstances - 1].foundHW = FALSE;
+ instances[allocatedInstances - 1].screen = 0;
+ }
+
+ foundVendor = TRUE;
+
+ if ((device_id == pPci->device_id)
+ || ((vendorID == PCI_VENDOR_GENERIC)
+ && (match_class == device_class))) {
+ if (instances != NULL) {
+ instances[allocatedInstances - 1].foundHW = TRUE;
+ instances[allocatedInstances - 1].chip = id->numChipset;
+ }
+
+ if (xf86DoConfigure && xf86DoConfigurePass1) {
+ if (xf86CheckPciSlot(pPci)) {
+ GDevPtr pGDev =
+ xf86AddBusDeviceToConfigure(drvp->driverName,
+ BUS_PCI, pPci, -1);
+
+ if (pGDev) {
+ /* After configure pass 1, chipID and chipRev
+ * are treated as over-rides, so clobber them
+ * here.
+ */
+ pGDev->chipID = -1;
+ pGDev->chipRev = -1;
+ }
+
+ numFound++;
+ }
+ }
+ else {
+ numFound++;
+ }
+
+ break;
+ }
+ }
+ }
}
pci_iterator_destroy(iter);
-
/* In "probe only" or "configure" mode (signaled by instances being NULL),
* our work is done. Return the number of detected devices.
*/
- if ( instances == NULL ) {
- return numFound;
+ if (instances == NULL) {
+ return numFound;
}
-
/*
* This may be debatable, but if no PCI devices with a matching vendor
* type is found, return zero now. It is probably not desirable to
* allow the config file to override this.
*/
if (allocatedInstances <= 0) {
- free(instances);
- return 0;
+ free(instances);
+ return 0;
}
-
DebugF("%s instances found: %d\n", driverName, allocatedInstances);
- /*
- * Check for devices that need duplicated instances. This is required
- * when there is more than one screen per entity.
- *
- * XXX This currently doesn't work for cases where the BusID isn't
- * specified explicitly in the config file.
- */
+ /*
+ * Check for devices that need duplicated instances. This is required
+ * when there is more than one screen per entity.
+ *
+ * XXX This currently doesn't work for cases where the BusID isn't
+ * specified explicitly in the config file.
+ */
for (j = 0; j < numDevs; j++) {
- if (devList[j]->screen > 0 && devList[j]->busID
- && *devList[j]->busID) {
- for (i = 0; i < allocatedInstances; i++) {
- pPci = instances[i].pci;
- if (xf86ComparePciBusString(devList[j]->busID,
- PCI_MAKE_BUS( pPci->domain, pPci->bus ),
- pPci->dev,
- pPci->func)) {
- allocatedInstances++;
- instances[allocatedInstances - 1] = instances[i];
- instances[allocatedInstances - 1].screen = devList[j]->screen;
- numFound++;
- break;
- }
- }
- }
+ if (devList[j]->screen > 0 && devList[j]->busID && *devList[j]->busID) {
+ for (i = 0; i < allocatedInstances; i++) {
+ pPci = instances[i].pci;
+ if (xf86ComparePciBusString(devList[j]->busID,
+ PCI_MAKE_BUS(pPci->domain,
+ pPci->bus), pPci->dev,
+ pPci->func)) {
+ allocatedInstances++;
+ instances[allocatedInstances - 1] = instances[i];
+ instances[allocatedInstances - 1].screen =
+ devList[j]->screen;
+ numFound++;
+ break;
+ }
+ }
+ }
}
for (i = 0; i < allocatedInstances; i++) {
- GDevPtr dev = NULL;
- GDevPtr devBus = NULL;
-
- pPci = instances[i].pci;
- for (j = 0; j < numDevs; j++) {
- if (devList[j]->busID && *devList[j]->busID) {
- if (xf86ComparePciBusString(devList[j]->busID,
- PCI_MAKE_BUS( pPci->domain, pPci->bus ),
- pPci->dev,
- pPci->func) &&
- devList[j]->screen == instances[i].screen) {
-
- if (devBus)
- xf86MsgVerb(X_WARNING,0,
- "%s: More than one matching Device section for "
- "instances\n\t(BusID: %s) found: %s\n",
- driverName, devList[j]->busID,
- devList[j]->identifier);
- else
- devBus = devList[j];
- }
- } else {
- /*
- * if device section without BusID is found
- * only assign to it to the primary device.
- */
- if (xf86IsPrimaryPci(pPci)) {
- xf86Msg(X_PROBED, "Assigning device section with no busID"
- " to primary device\n");
- if (dev || devBus)
- xf86MsgVerb(X_WARNING, 0,
- "%s: More than one matching Device section "
- "found: %s\n", driverName, devList[j]->identifier);
- else
- dev = devList[j];
- }
- }
- }
- if (devBus) dev = devBus; /* busID preferred */
- if (!dev) {
- if (xf86CheckPciSlot(pPci) && pciDeviceHasBars(pPci)) {
- xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
- "for instance (BusID PCI:%u@%u:%u:%u) found\n",
- driverName, pPci->domain, pPci->bus, pPci->dev,
- pPci->func);
- }
- } else {
- numClaimedInstances++;
- instances[i].claimed = TRUE;
- instances[i].dev = dev;
- }
+ GDevPtr dev = NULL;
+ GDevPtr devBus = NULL;
+
+ pPci = instances[i].pci;
+ for (j = 0; j < numDevs; j++) {
+ if (devList[j]->busID && *devList[j]->busID) {
+ if (xf86ComparePciBusString(devList[j]->busID,
+ PCI_MAKE_BUS(pPci->domain,
+ pPci->bus), pPci->dev,
+ pPci->func) &&
+ devList[j]->screen == instances[i].screen) {
+
+ if (devBus)
+ xf86MsgVerb(X_WARNING, 0,
+ "%s: More than one matching Device section for "
+ "instances\n\t(BusID: %s) found: %s\n",
+ driverName, devList[j]->busID,
+ devList[j]->identifier);
+ else
+ devBus = devList[j];
+ }
+ }
+ else {
+ /*
+ * if device section without BusID is found
+ * only assign to it to the primary device.
+ */
+ if (xf86IsPrimaryPci(pPci)) {
+ xf86Msg(X_PROBED, "Assigning device section with no busID"
+ " to primary device\n");
+ if (dev || devBus)
+ xf86MsgVerb(X_WARNING, 0,
+ "%s: More than one matching Device section "
+ "found: %s\n", driverName,
+ devList[j]->identifier);
+ else
+ dev = devList[j];
+ }
+ }
+ }
+ if (devBus)
+ dev = devBus; /* busID preferred */
+ if (!dev) {
+ if (xf86CheckPciSlot(pPci) && pciDeviceHasBars(pPci)) {
+ xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
+ "for instance (BusID PCI:%u@%u:%u:%u) found\n",
+ driverName, pPci->domain, pPci->bus, pPci->dev,
+ pPci->func);
+ }
+ }
+ else {
+ numClaimedInstances++;
+ instances[i].claimed = TRUE;
+ instances[i].dev = dev;
+ }
}
DebugF("%s instances found: %d\n", driverName, numClaimedInstances);
/*
@@ -846,78 +847,82 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
* If chipset is not valid ignore BusSlot completely.
*/
for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
- MessageType from = X_PROBED;
-
- if (!instances[i].claimed) {
- continue;
- }
- if (instances[i].dev->chipset) {
- for (c = chipsets; c->token >= 0; c++) {
- if (xf86NameCmp(c->name, instances[i].dev->chipset) == 0)
- break;
- }
- if (c->token == -1) {
- instances[i].claimed = FALSE;
- numClaimedInstances--;
- xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
- "section \"%s\" isn't valid for this driver\n",
- driverName, instances[i].dev->chipset,
- instances[i].dev->identifier);
- } else {
- instances[i].chip = c->token;
-
- for (id = PCIchipsets; id->numChipset >= 0; id++) {
- if (id->numChipset == instances[i].chip)
- break;
- }
- if(id->numChipset >=0){
- xf86Msg(X_CONFIG,"Chipset override: %s\n",
- instances[i].dev->chipset);
- from = X_CONFIG;
- } else {
- instances[i].claimed = FALSE;
- numClaimedInstances--;
- xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
- "section \"%s\" isn't a valid PCI chipset\n",
- driverName, instances[i].dev->chipset,
- instances[i].dev->identifier);
- }
- }
- } else if (instances[i].dev->chipID > 0) {
- for (id = PCIchipsets; id->numChipset >= 0; id++) {
- if (id->PCIid == instances[i].dev->chipID)
- break;
- }
- if (id->numChipset == -1) {
- instances[i].claimed = FALSE;
- numClaimedInstances--;
- xf86MsgVerb(X_WARNING, 0, "%s: ChipID 0x%04X in Device "
- "section \"%s\" isn't valid for this driver\n",
- driverName, instances[i].dev->chipID,
- instances[i].dev->identifier);
- } else {
- instances[i].chip = id->numChipset;
-
- xf86Msg( X_CONFIG,"ChipID override: 0x%04X\n",
- instances[i].dev->chipID);
- from = X_CONFIG;
- }
- } else if (!instances[i].foundHW) {
- /*
- * This means that there was no override and the PCI chipType
- * doesn't match one that is supported
- */
- instances[i].claimed = FALSE;
- numClaimedInstances--;
- }
- if (instances[i].claimed == TRUE){
- for (c = chipsets; c->token >= 0; c++) {
- if (c->token == instances[i].chip)
- break;
- }
- xf86Msg(from,"Chipset %s found\n",
- c->name);
- }
+ MessageType from = X_PROBED;
+
+ if (!instances[i].claimed) {
+ continue;
+ }
+ if (instances[i].dev->chipset) {
+ for (c = chipsets; c->token >= 0; c++) {
+ if (xf86NameCmp(c->name, instances[i].dev->chipset) == 0)
+ break;
+ }
+ if (c->token == -1) {
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
+ "section \"%s\" isn't valid for this driver\n",
+ driverName, instances[i].dev->chipset,
+ instances[i].dev->identifier);
+ }
+ else {
+ instances[i].chip = c->token;
+
+ for (id = PCIchipsets; id->numChipset >= 0; id++) {
+ if (id->numChipset == instances[i].chip)
+ break;
+ }
+ if (id->numChipset >= 0) {
+ xf86Msg(X_CONFIG, "Chipset override: %s\n",
+ instances[i].dev->chipset);
+ from = X_CONFIG;
+ }
+ else {
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
+ "section \"%s\" isn't a valid PCI chipset\n",
+ driverName, instances[i].dev->chipset,
+ instances[i].dev->identifier);
+ }
+ }
+ }
+ else if (instances[i].dev->chipID > 0) {
+ for (id = PCIchipsets; id->numChipset >= 0; id++) {
+ if (id->PCIid == instances[i].dev->chipID)
+ break;
+ }
+ if (id->numChipset == -1) {
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ xf86MsgVerb(X_WARNING, 0, "%s: ChipID 0x%04X in Device "
+ "section \"%s\" isn't valid for this driver\n",
+ driverName, instances[i].dev->chipID,
+ instances[i].dev->identifier);
+ }
+ else {
+ instances[i].chip = id->numChipset;
+
+ xf86Msg(X_CONFIG, "ChipID override: 0x%04X\n",
+ instances[i].dev->chipID);
+ from = X_CONFIG;
+ }
+ }
+ else if (!instances[i].foundHW) {
+ /*
+ * This means that there was no override and the PCI chipType
+ * doesn't match one that is supported
+ */
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ }
+ if (instances[i].claimed == TRUE) {
+ for (c = chipsets; c->token >= 0; c++) {
+ if (c->token == instances[i].chip)
+ break;
+ }
+ xf86Msg(from, "Chipset %s found\n", c->name);
+ }
}
/*
@@ -926,48 +931,48 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
*/
numFound = 0;
for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
- if (!instances[i].claimed)
- continue;
- pPci = instances[i].pci;
-
+ if (!instances[i].claimed)
+ continue;
+ pPci = instances[i].pci;
/*
- * Allow the same entity to be used more than once for devices with
- * multiple screens per entity. This assumes implicitly that there
- * will be a screen == 0 instance.
- *
- * XXX Need to make sure that two different drivers don't claim
- * the same screen > 0 instance.
- */
- if (instances[i].screen == 0 && !xf86CheckPciSlot( pPci ))
- continue;
-
- DebugF("%s: card at %d:%d:%d is claimed by a Device section\n",
- driverName, pPci->bus, pPci->dev, pPci->func);
-
- /* Allocate an entry in the lists to be returned */
- numFound++;
- retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
- retEntities[numFound - 1] = xf86ClaimPciSlot( pPci, drvp,
- instances[i].chip,
- instances[i].dev,
- instances[i].dev->active);
+ * Allow the same entity to be used more than once for devices with
+ * multiple screens per entity. This assumes implicitly that there
+ * will be a screen == 0 instance.
+ *
+ * XXX Need to make sure that two different drivers don't claim
+ * the same screen > 0 instance.
+ */
+ if (instances[i].screen == 0 && !xf86CheckPciSlot(pPci))
+ continue;
+
+ DebugF("%s: card at %d:%d:%d is claimed by a Device section\n",
+ driverName, pPci->bus, pPci->dev, pPci->func);
+
+ /* Allocate an entry in the lists to be returned */
+ numFound++;
+ retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
+ retEntities[numFound - 1] = xf86ClaimPciSlot(pPci, drvp,
+ instances[i].chip,
+ instances[i].dev,
+ instances[i].dev->active);
if (retEntities[numFound - 1] == -1 && instances[i].screen > 0) {
- for (j = 0; j < xf86NumEntities; j++) {
- EntityPtr pEnt = xf86Entities[j];
- if (pEnt->bus.type != BUS_PCI)
- continue;
- if (pEnt->bus.id.pci == pPci) {
- retEntities[numFound - 1] = j;
- xf86AddDevToEntity(j, instances[i].dev);
- break;
- }
- }
- }
+ for (j = 0; j < xf86NumEntities; j++) {
+ EntityPtr pEnt = xf86Entities[j];
+
+ if (pEnt->bus.type != BUS_PCI)
+ continue;
+ if (pEnt->bus.id.pci == pPci) {
+ retEntities[numFound - 1] = j;
+ xf86AddDevToEntity(j, instances[i].dev);
+ break;
+ }
+ }
+ }
}
free(instances);
if (numFound > 0) {
- *foundEntities = retEntities;
+ *foundEntities = retEntities;
}
return numFound;
@@ -981,51 +986,52 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
* non-NULL all static resources listed there will be registered.
*/
static void
-xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
- EntityProc init, EntityProc enter,
- EntityProc leave, pointer private)
+xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets * p_chip,
+ EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private)
{
ScrnInfoPtr pScrn;
if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
- xf86RemoveEntityFromScreen(pScrn,pEnt->index);
+ xf86RemoveEntityFromScreen(pScrn, pEnt->index);
/* shared resources are only needed when entity is active: remove */
- xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
+ xf86SetEntityFuncs(pEnt->index, init, enter, leave, private);
}
ScrnInfoPtr
xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
- PciChipsets *p_chip, void *dummy, EntityProc init,
- EntityProc enter, EntityProc leave, pointer private)
+ PciChipsets * p_chip, void *dummy, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer private)
{
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
- if (!pEnt) return pScrn;
+
+ if (!pEnt)
+ return pScrn;
if (!(pEnt->location.type == BUS_PCI)
- || !xf86GetPciInfoForEntity(entityIndex)) {
- free(pEnt);
- return pScrn;
+ || !xf86GetPciInfoForEntity(entityIndex)) {
+ free(pEnt);
+ return pScrn;
}
if (!pEnt->active) {
- xf86ConfigPciEntityInactive(pEnt, p_chip, init, enter,
- leave, private);
- free(pEnt);
- return pScrn;
+ xf86ConfigPciEntityInactive(pEnt, p_chip, init, enter, leave, private);
+ free(pEnt);
+ return pScrn;
}
if (!pScrn)
- pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag);
+ pScrn = xf86AllocateScreen(pEnt->driver, scrnFlag);
if (xf86IsEntitySharable(entityIndex)) {
xf86SetEntityShared(entityIndex);
}
- xf86AddEntityToScreen(pScrn,entityIndex);
+ xf86AddEntityToScreen(pScrn, entityIndex);
if (xf86IsEntityShared(entityIndex)) {
return pScrn;
}
free(pEnt);
- xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
+ xf86SetEntityFuncs(entityIndex, init, enter, leave, private);
return pScrn;
}
@@ -1036,20 +1042,22 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
*/
Bool
xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
- PciChipsets *p_chip, void *dummy, EntityProc init,
+ PciChipsets * p_chip, void *dummy, EntityProc init,
EntityProc enter, EntityProc leave, pointer private)
{
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
- if (!pEnt) return FALSE;
+
+ if (!pEnt)
+ return FALSE;
if (!pEnt->active || !(pEnt->location.type == BUS_PCI)) {
free(pEnt);
return FALSE;
}
- xf86AddEntityToScreen(pScrn,entityIndex);
+ xf86AddEntityToScreen(pScrn, entityIndex);
free(pEnt);
- if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private))
+ if (!xf86SetEntityFuncs(entityIndex, init, enter, leave, private))
return FALSE;
return TRUE;
@@ -1057,106 +1065,165 @@ xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
static int
videoPtrToDriverList(struct pci_device *dev,
- char *returnList[], int returnListMax)
+ char *returnList[], int returnListMax)
{
int i;
+
/* Add more entries here if we ever return more than 4 drivers for
any device */
const char *driverList[5] = { NULL, NULL, NULL, NULL, NULL };
- switch (dev->vendor_id)
+ switch (dev->vendor_id) {
+ /* AMD Geode LX */
+ case 0x1022:
+ if (dev->device_id == 0x2081)
+ driverList[0] = "geode";
+ break;
+ /* older Geode products acquired by AMD still carry an NSC vendor_id */
+ case 0x100b:
+ if (dev->device_id == 0x0030) {
+ /* NSC Geode GX2 specifically */
+ driverList[0] = "geode";
+ /* GX2 support started its life in the NSC tree and was later
+ forked by AMD for GEODE so we keep it as a backup */
+ driverList[1] = "nsc";
+ }
+ else
+ /* other NSC variant e.g. 0x0104 (SC1400), 0x0504 (SCx200) */
+ driverList[0] = "nsc";
+ break;
+ /* Cyrix Geode GX1 */
+ case 0x1078:
+ if (dev->device_id == 0x0104)
+ driverList[0] = "cyrix";
+ break;
+ case 0x1142:
+ driverList[0] = "apm";
+ break;
+ case 0xedd8:
+ driverList[0] = "ark";
+ break;
+ case 0x1a03:
+ driverList[0] = "ast";
+ break;
+ case 0x1002:
+ driverList[0] = "ati";
+ break;
+ case 0x102c:
+ driverList[0] = "chips";
+ break;
+ case 0x1013:
+ driverList[0] = "cirrus";
+ break;
+ case 0x3d3d:
+ driverList[0] = "glint";
+ break;
+ case 0x105d:
+ driverList[0] = "i128";
+ break;
+ case 0x8086:
+ if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800)) {
+ driverList[0] = "i740";
+ }
+ else if (dev->device_id == 0x8108) {
+ break; /* "hooray" for poulsbo */
+ }
+ else {
+ driverList[0] = "intel";
+ }
+ break;
+ case 0x102b:
+ driverList[0] = "mga";
+ break;
+ case 0x10c8:
+ driverList[0] = "neomagic";
+ break;
+ case 0x10de:
+ case 0x12d2:
{
- /* AMD Geode LX */
- case 0x1022:
- if (dev->device_id == 0x2081)
- driverList[0] = "geode";
- break;
- /* older Geode products acquired by AMD still carry an NSC vendor_id */
- case 0x100b:
- if (dev->device_id == 0x0030) {
- /* NSC Geode GX2 specifically */
- driverList[0] = "geode";
- /* GX2 support started its life in the NSC tree and was later
- forked by AMD for GEODE so we keep it as a backup */
- driverList[1] = "nsc";
- } else
- /* other NSC variant e.g. 0x0104 (SC1400), 0x0504 (SCx200) */
- driverList[0] = "nsc";
- break;
- /* Cyrix Geode GX1 */
- case 0x1078:
- if (dev->device_id == 0x0104)
- driverList[0] = "cyrix";
- break;
- case 0x1142: driverList[0] = "apm"; break;
- case 0xedd8: driverList[0] = "ark"; break;
- case 0x1a03: driverList[0] = "ast"; break;
- case 0x1002: driverList[0] = "ati"; break;
- case 0x102c: driverList[0] = "chips"; break;
- case 0x1013: driverList[0] = "cirrus"; break;
- case 0x3d3d: driverList[0] = "glint"; break;
- case 0x105d: driverList[0] = "i128"; break;
- case 0x8086:
- if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800)) {
- driverList[0] = "i740";
- } else if (dev->device_id == 0x8108) {
- break; /* "hooray" for poulsbo */
- } else {
- driverList[0] = "intel";
- }
- break;
- case 0x102b: driverList[0] = "mga"; break;
- case 0x10c8: driverList[0] = "neomagic"; break;
- case 0x10de: case 0x12d2:
- {
- int idx = 0;
+ int idx = 0;
+
#ifdef __linux__
- driverList[idx++] = "nouveau";
+ driverList[idx++] = "nouveau";
#endif
- driverList[idx++] = "nv";
- break;
- }
- case 0x1106: driverList[0] = "openchrome"; break;
- case 0x1b36: driverList[0] = "qxl"; break;
- case 0x1163: driverList[0] = "rendition"; break;
- case 0x5333:
- switch (dev->device_id)
- {
- case 0x88d0: case 0x88d1: case 0x88f0: case 0x8811:
- case 0x8812: case 0x8814: case 0x8901:
- driverList[0] = "s3"; break;
- case 0x5631: case 0x883d: case 0x8a01: case 0x8a10:
- case 0x8c01: case 0x8c03: case 0x8904: case 0x8a13:
- driverList[0] = "s3virge"; break;
- default:
- driverList[0] = "savage"; break;
- }
- break;
- case 0x1039: driverList[0] = "sis"; break;
- case 0x126f: driverList[0] = "siliconmotion"; break;
- case 0x121a:
- if (dev->device_id < 0x0003)
- driverList[0] = "voodoo";
- else
- driverList[0] = "tdfx";
- break;
- case 0x1011: driverList[0] = "tga"; break;
- case 0x1023: driverList[0] = "trident"; break;
- case 0x100c: driverList[0] = "tseng"; break;
- case 0x80ee: driverList[0] = "vboxvideo"; break;
- case 0x15ad: driverList[0] = "vmware"; break;
- case 0x18ca:
- if (dev->device_id == 0x47)
- driverList[0] = "xgixp";
- else
- driverList[0] = "xgi";
- break;
- default: break;
+ driverList[idx++] = "nv";
+ break;
+ }
+ case 0x1106:
+ driverList[0] = "openchrome";
+ break;
+ case 0x1b36:
+ driverList[0] = "qxl";
+ break;
+ case 0x1163:
+ driverList[0] = "rendition";
+ break;
+ case 0x5333:
+ switch (dev->device_id) {
+ case 0x88d0:
+ case 0x88d1:
+ case 0x88f0:
+ case 0x8811:
+ case 0x8812:
+ case 0x8814:
+ case 0x8901:
+ driverList[0] = "s3";
+ break;
+ case 0x5631:
+ case 0x883d:
+ case 0x8a01:
+ case 0x8a10:
+ case 0x8c01:
+ case 0x8c03:
+ case 0x8904:
+ case 0x8a13:
+ driverList[0] = "s3virge";
+ break;
+ default:
+ driverList[0] = "savage";
+ break;
+ }
+ break;
+ case 0x1039:
+ driverList[0] = "sis";
+ break;
+ case 0x126f:
+ driverList[0] = "siliconmotion";
+ break;
+ case 0x121a:
+ if (dev->device_id < 0x0003)
+ driverList[0] = "voodoo";
+ else
+ driverList[0] = "tdfx";
+ break;
+ case 0x1011:
+ driverList[0] = "tga";
+ break;
+ case 0x1023:
+ driverList[0] = "trident";
+ break;
+ case 0x100c:
+ driverList[0] = "tseng";
+ break;
+ case 0x80ee:
+ driverList[0] = "vboxvideo";
+ break;
+ case 0x15ad:
+ driverList[0] = "vmware";
+ break;
+ case 0x18ca:
+ if (dev->device_id == 0x47)
+ driverList[0] = "xgixp";
+ else
+ driverList[0] = "xgi";
+ break;
+ default:
+ break;
}
for (i = 0; (i < returnListMax) && (driverList[i] != NULL); i++) {
- returnList[i] = xnfstrdup(driverList[i]);
+ returnList[i] = xnfstrdup(driverList[i]);
}
- return i; /* Number of entries added */
+ return i; /* Number of entries added */
}
#ifdef __linux__
@@ -1181,7 +1248,7 @@ xchomp(char *line)
* feature it can and should be removed because the symbol-based resolution
* scheme should be the primary one */
static void
-matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip)
+matchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip)
{
DIR *idsdir;
FILE *fp;
@@ -1197,7 +1264,9 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
if (!idsdir)
return;
- xf86Msg(X_INFO, "Scanning %s directory for additional PCI ID's supported by the drivers\n", PCI_TXT_IDS_PATH);
+ xf86Msg(X_INFO,
+ "Scanning %s directory for additional PCI ID's supported by the drivers\n",
+ PCI_TXT_IDS_PATH);
direntry = readdir(idsdir);
/* Read the directory */
while (direntry) {
@@ -1207,63 +1276,72 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
}
len = strlen(direntry->d_name);
/* A tiny bit of sanity checking. We should probably do better */
- if (strncmp(&(direntry->d_name[len-4]), ".ids", 4) == 0) {
+ if (strncmp(&(direntry->d_name[len - 4]), ".ids", 4) == 0) {
/* We need the full path name to open the file */
snprintf(path_name, sizeof(path_name), "%s/%s",
PCI_TXT_IDS_PATH, direntry->d_name);
fp = fopen(path_name, "r");
if (fp == NULL) {
- xf86Msg(X_ERROR, "Could not open %s for reading. Exiting.\n", path_name);
+ xf86Msg(X_ERROR, "Could not open %s for reading. Exiting.\n",
+ path_name);
goto end;
}
/* Read the file */
#ifdef __GLIBC__
while ((read = getline(&line, &len, fp)) != -1) {
#else
- while ((line = fgetln(fp, &len)) != (char *)NULL) {
-#endif /* __GLIBC __ */
+ while ((line = fgetln(fp, &len)) != (char *) NULL) {
+#endif /* __GLIBC __ */
xchomp(line);
if (isdigit(line[0])) {
strlcpy(vendor_str, line, sizeof(vendor_str));
- vendor = (int)strtol(vendor_str, NULL, 16);
+ vendor = (int) strtol(vendor_str, NULL, 16);
if ((strlen(&line[4])) == 0) {
chip_str[0] = '\0';
chip = -1;
- } else {
+ }
+ else {
/* Handle trailing whitespace */
if (isspace(line[4])) {
chip_str[0] = '\0';
chip = -1;
- } else {
+ }
+ else {
/* Ok, it's a real ID */
strlcpy(chip_str, &line[4], sizeof(chip_str));
- chip = (int)strtol(chip_str, NULL, 16);
+ chip = (int) strtol(chip_str, NULL, 16);
}
}
- if (vendor == match_vendor && chip == match_chip ) {
+ if (vendor == match_vendor && chip == match_chip) {
i = 0;
while (matches[i]) {
i++;
}
- matches[i] = (char*)malloc(sizeof(char) * strlen(direntry->d_name) - 3);
+ matches[i] =
+ (char *) malloc(sizeof(char) *
+ strlen(direntry->d_name) - 3);
if (!matches[i]) {
- xf86Msg(X_ERROR, "Could not allocate space for the module name. Exiting.\n");
+ xf86Msg(X_ERROR,
+ "Could not allocate space for the module name. Exiting.\n");
goto end;
}
/* hack off the .ids suffix. This should guard
* against other problems, but it will end up
* taking off anything after the first '.' */
- for (j = 0; j < (strlen(direntry->d_name) - 3) ; j++) {
+ for (j = 0; j < (strlen(direntry->d_name) - 3); j++) {
if (direntry->d_name[j] == '.') {
matches[i][j] = '\0';
break;
- } else {
+ }
+ else {
matches[i][j] = direntry->d_name[j];
}
}
- xf86Msg(X_INFO, "Matched %s from file name %s\n", matches[i], direntry->d_name);
+ xf86Msg(X_INFO, "Matched %s from file name %s\n",
+ matches[i], direntry->d_name);
}
- } else {
+ }
+ else {
/* TODO Handle driver overrides here */
}
}
@@ -1275,38 +1353,39 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
free(line);
closedir(idsdir);
}
-#endif /* __linux__ */
+#endif /* __linux__ */
/**
* @return The numbers of found devices that match with the current system
* drivers.
*/
int
-xf86PciMatchDriver(char* matches[], int nmatches) {
+xf86PciMatchDriver(char *matches[], int nmatches)
+{
int i;
- struct pci_device * info = NULL;
+ struct pci_device *info = NULL;
struct pci_device_iterator *iter;
/* Find the primary device, and get some information about it. */
iter = pci_slot_match_iterator_create(NULL);
while ((info = pci_device_next(iter)) != NULL) {
- if (xf86IsPrimaryPci(info)) {
- break;
- }
+ if (xf86IsPrimaryPci(info)) {
+ break;
+ }
}
pci_iterator_destroy(iter);
#ifdef __linux__
if (info)
- matchDriverFromFiles(matches, info->vendor_id, info->device_id);
+ matchDriverFromFiles(matches, info->vendor_id, info->device_id);
#endif
for (i = 0; (i < nmatches) && (matches[i]); i++) {
- /* find end of matches list */
+ /* find end of matches list */
}
if ((info != NULL) && (i < nmatches)) {
- i += videoPtrToDriverList(info, &(matches[i]), nmatches - i);
+ i += videoPtrToDriverList(info, &(matches[i]), nmatches - i);
}
return i;
@@ -1315,14 +1394,13 @@ xf86PciMatchDriver(char* matches[], int nmatches) {
Bool
xf86PciConfigure(void *busData, struct pci_device *pDev)
{
- struct pci_device * pVideo = NULL;
+ struct pci_device *pVideo = NULL;
pVideo = (struct pci_device *) busData;
if (pDev &&
(pDev->domain == pVideo->domain) &&
(pDev->bus == pVideo->bus) &&
- (pDev->dev == pVideo->dev) &&
- (pDev->func == pVideo->func))
+ (pDev->dev == pVideo->dev) && (pDev->func == pVideo->func))
return 0;
return 1;
@@ -1330,20 +1408,20 @@ xf86PciConfigure(void *busData, struct pci_device *pDev)
void
xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
- GDevRec *GDev, int *chipset)
+ GDevRec * GDev, int *chipset)
{
char busnum[8];
pVideo = (struct pci_device *) busData;
if (pVideo->bus < 256)
- snprintf(busnum, sizeof(busnum), "%d", pVideo->bus);
+ snprintf(busnum, sizeof(busnum), "%d", pVideo->bus);
else
- snprintf(busnum, sizeof(busnum), "%d@%d",
- pVideo->bus & 0x00ff, pVideo->bus >> 8);
+ snprintf(busnum, sizeof(busnum), "%d@%d",
+ pVideo->bus & 0x00ff, pVideo->bus >> 8);
XNFasprintf(&GDev->busID, "PCI:%s:%d:%d",
- busnum, pVideo->dev, pVideo->func);
+ busnum, pVideo->dev, pVideo->func);
GDev->chipID = pVideo->device_id;
GDev->chipRev = pVideo->revision;
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c
index b7bb913fe..c993b603c 100644
--- a/xorg-server/hw/xfree86/common/xf86sbusBus.c
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c
@@ -53,23 +53,24 @@ CheckSbusDevice(const char *device, int fbNum)
fd = open(device, O_RDONLY, 0);
if (fd < 0)
- return;
+ return;
memset(&fbattr, 0, sizeof(fbattr));
if (ioctl(fd, FBIOGATTR, &fbattr) < 0) {
- if (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0) {
- close(fd);
- return;
- }
+ if (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0) {
+ close(fd);
+ return;
+ }
}
close(fd);
for (i = 0; sbusDeviceTable[i].devId; i++)
- if (sbusDeviceTable[i].fbType == fbattr.fbtype.fb_type)
- break;
- if (! sbusDeviceTable[i].devId)
- return;
- xf86SbusInfo = xnfrealloc(xf86SbusInfo, sizeof(psdp) * (++xf86nSbusInfo + 1));
+ if (sbusDeviceTable[i].fbType == fbattr.fbtype.fb_type)
+ break;
+ if (!sbusDeviceTable[i].devId)
+ return;
+ xf86SbusInfo =
+ xnfrealloc(xf86SbusInfo, sizeof(psdp) * (++xf86nSbusInfo + 1));
xf86SbusInfo[xf86nSbusInfo] = NULL;
- xf86SbusInfo[xf86nSbusInfo - 1] = psdp = xnfcalloc(sizeof (sbusDevice), 1);
+ xf86SbusInfo[xf86nSbusInfo - 1] = psdp = xnfcalloc(sizeof(sbusDevice), 1);
psdp->devId = sbusDeviceTable[i].devId;
psdp->fbNum = fbNum;
psdp->device = xnfstrdup(device);
@@ -88,136 +89,154 @@ xf86SbusProbe(void)
xf86SbusInfo = malloc(sizeof(psdp));
*xf86SbusInfo = NULL;
for (i = 0; i < 32; i++) {
- snprintf(fbDevName, sizeof(fbDevName), "/dev/fb%d", i);
- CheckSbusDevice(fbDevName, i);
+ snprintf(fbDevName, sizeof(fbDevName), "/dev/fb%d", i);
+ CheckSbusDevice(fbDevName, i);
}
if (sparcPromInit() >= 0) {
- useProm = 1;
- sparcPromAssignNodes();
+ useProm = 1;
+ sparcPromAssignNodes();
}
for (psdpp = xf86SbusInfo; (psdp = *psdpp); psdpp++) {
- for (i = 0; sbusDeviceTable[i].devId; i++)
- if (sbusDeviceTable[i].devId == psdp->devId)
- psdp->descr = sbusDeviceTable[i].descr;
- /*
- * If we can use PROM information and found the PROM node for this
- * device, we can tell more about the card.
- */
- if (useProm && psdp->node.node) {
- char *prop, *promPath;
- int len, chiprev, vmsize;
-
- switch (psdp->devId) {
- case SBUS_DEVICE_MGX:
- prop = sparcPromGetProperty(&psdp->node, "fb_size", &len);
- if (prop && len == 4 && *(int *)prop == 0x400000)
- psdp->descr = "Quantum 3D MGXplus with 4M VRAM";
- break;
- case SBUS_DEVICE_CG6:
- chiprev = 0;
- vmsize = 0;
- prop = sparcPromGetProperty(&psdp->node, "chiprev", &len);
- if (prop && len == 4)
- chiprev = *(int *)prop;
- prop = sparcPromGetProperty(&psdp->node, "vmsize", &len);
- if (prop && len == 4)
- vmsize = *(int *)prop;
- switch (chiprev) {
- case 1:
- case 2:
- case 3:
- case 4:
- psdp->descr = "Sun Double width GX"; break;
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- psdp->descr = "Sun Single width GX"; break;
- case 11:
- switch (vmsize) {
- case 2:
- psdp->descr = "Sun Turbo GX with 1M VSIMM"; break;
- case 4:
- psdp->descr = "Sun Turbo GX Plus"; break;
- default:
- psdp->descr = "Sun Turbo GX"; break;
- }
- }
- break;
- case SBUS_DEVICE_CG14:
- prop = sparcPromGetProperty(&psdp->node, "reg", &len);
- vmsize = 0;
- if (prop && !(len % 12) && len > 0)
- vmsize = *(int *)(prop + len - 4);
- switch (vmsize) {
- case 0x400000:
- psdp->descr = "Sun SX with 4M VSIMM"; break;
- case 0x800000:
- psdp->descr = "Sun SX with 8M VSIMM"; break;
- }
- break;
- case SBUS_DEVICE_LEO:
- prop = sparcPromGetProperty(&psdp->node, "model", &len);
- if (prop && len > 0 && !strstr(prop, "501-2503"))
- psdp->descr = "Sun Turbo ZX";
- break;
- case SBUS_DEVICE_TCX:
- if (sparcPromGetBool(&psdp->node, "tcx-8-bit"))
- psdp->descr = "Sun TCX (8bit)";
- else
- psdp->descr = "Sun TCX (S24)";
- break;
- case SBUS_DEVICE_FFB:
- prop = sparcPromGetProperty(&psdp->node, "name", &len);
- chiprev = 0;
- prop = sparcPromGetProperty(&psdp->node, "board_type", &len);
- if (prop && len == 4)
- chiprev = *(int *)prop;
- if (strstr (prop, "afb")) {
- if (chiprev == 3)
- psdp->descr = "Sun|Elite3D-M6 Horizontal";
- } else {
- switch (chiprev) {
- case 0x08:
- psdp->descr = "Sun FFB 67MHz Creator"; break;
- case 0x0b:
- psdp->descr = "Sun FFB 67MHz Creator 3D"; break;
- case 0x1b:
- psdp->descr = "Sun FFB 75MHz Creator 3D"; break;
- case 0x20:
- case 0x28:
- psdp->descr = "Sun FFB2 Vertical Creator"; break;
- case 0x23:
- case 0x2b:
- psdp->descr = "Sun FFB2 Vertical Creator 3D"; break;
- case 0x30:
- psdp->descr = "Sun FFB2+ Vertical Creator"; break;
- case 0x33:
- psdp->descr = "Sun FFB2+ Vertical Creator 3D"; break;
- case 0x40:
- case 0x48:
- psdp->descr = "Sun FFB2 Horizontal Creator"; break;
- case 0x43:
- case 0x4b:
- psdp->descr = "Sun FFB2 Horizontal Creator 3D"; break;
- }
- }
- break;
- }
-
- xf86Msg(X_PROBED, "SBUS:(0x%08x) %s", psdp->node.node, psdp->descr);
- promPath = sparcPromNode2Pathname (&psdp->node);
- if (promPath) {
- xf86ErrorF(" at %s", promPath);
- free(promPath);
- }
- } else
- xf86Msg(X_PROBED, "SBUS: %s", psdp->descr);
- xf86ErrorF("\n");
+ for (i = 0; sbusDeviceTable[i].devId; i++)
+ if (sbusDeviceTable[i].devId == psdp->devId)
+ psdp->descr = sbusDeviceTable[i].descr;
+ /*
+ * If we can use PROM information and found the PROM node for this
+ * device, we can tell more about the card.
+ */
+ if (useProm && psdp->node.node) {
+ char *prop, *promPath;
+ int len, chiprev, vmsize;
+
+ switch (psdp->devId) {
+ case SBUS_DEVICE_MGX:
+ prop = sparcPromGetProperty(&psdp->node, "fb_size", &len);
+ if (prop && len == 4 && *(int *) prop == 0x400000)
+ psdp->descr = "Quantum 3D MGXplus with 4M VRAM";
+ break;
+ case SBUS_DEVICE_CG6:
+ chiprev = 0;
+ vmsize = 0;
+ prop = sparcPromGetProperty(&psdp->node, "chiprev", &len);
+ if (prop && len == 4)
+ chiprev = *(int *) prop;
+ prop = sparcPromGetProperty(&psdp->node, "vmsize", &len);
+ if (prop && len == 4)
+ vmsize = *(int *) prop;
+ switch (chiprev) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ psdp->descr = "Sun Double width GX";
+ break;
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ psdp->descr = "Sun Single width GX";
+ break;
+ case 11:
+ switch (vmsize) {
+ case 2:
+ psdp->descr = "Sun Turbo GX with 1M VSIMM";
+ break;
+ case 4:
+ psdp->descr = "Sun Turbo GX Plus";
+ break;
+ default:
+ psdp->descr = "Sun Turbo GX";
+ break;
+ }
+ }
+ break;
+ case SBUS_DEVICE_CG14:
+ prop = sparcPromGetProperty(&psdp->node, "reg", &len);
+ vmsize = 0;
+ if (prop && !(len % 12) && len > 0)
+ vmsize = *(int *) (prop + len - 4);
+ switch (vmsize) {
+ case 0x400000:
+ psdp->descr = "Sun SX with 4M VSIMM";
+ break;
+ case 0x800000:
+ psdp->descr = "Sun SX with 8M VSIMM";
+ break;
+ }
+ break;
+ case SBUS_DEVICE_LEO:
+ prop = sparcPromGetProperty(&psdp->node, "model", &len);
+ if (prop && len > 0 && !strstr(prop, "501-2503"))
+ psdp->descr = "Sun Turbo ZX";
+ break;
+ case SBUS_DEVICE_TCX:
+ if (sparcPromGetBool(&psdp->node, "tcx-8-bit"))
+ psdp->descr = "Sun TCX (8bit)";
+ else
+ psdp->descr = "Sun TCX (S24)";
+ break;
+ case SBUS_DEVICE_FFB:
+ prop = sparcPromGetProperty(&psdp->node, "name", &len);
+ chiprev = 0;
+ prop = sparcPromGetProperty(&psdp->node, "board_type", &len);
+ if (prop && len == 4)
+ chiprev = *(int *) prop;
+ if (strstr(prop, "afb")) {
+ if (chiprev == 3)
+ psdp->descr = "Sun|Elite3D-M6 Horizontal";
+ }
+ else {
+ switch (chiprev) {
+ case 0x08:
+ psdp->descr = "Sun FFB 67MHz Creator";
+ break;
+ case 0x0b:
+ psdp->descr = "Sun FFB 67MHz Creator 3D";
+ break;
+ case 0x1b:
+ psdp->descr = "Sun FFB 75MHz Creator 3D";
+ break;
+ case 0x20:
+ case 0x28:
+ psdp->descr = "Sun FFB2 Vertical Creator";
+ break;
+ case 0x23:
+ case 0x2b:
+ psdp->descr = "Sun FFB2 Vertical Creator 3D";
+ break;
+ case 0x30:
+ psdp->descr = "Sun FFB2+ Vertical Creator";
+ break;
+ case 0x33:
+ psdp->descr = "Sun FFB2+ Vertical Creator 3D";
+ break;
+ case 0x40:
+ case 0x48:
+ psdp->descr = "Sun FFB2 Horizontal Creator";
+ break;
+ case 0x43:
+ case 0x4b:
+ psdp->descr = "Sun FFB2 Horizontal Creator 3D";
+ break;
+ }
+ }
+ break;
+ }
+
+ xf86Msg(X_PROBED, "SBUS:(0x%08x) %s", psdp->node.node, psdp->descr);
+ promPath = sparcPromNode2Pathname(&psdp->node);
+ if (promPath) {
+ xf86ErrorF(" at %s", promPath);
+ free(promPath);
+ }
+ }
+ else
+ xf86Msg(X_PROBED, "SBUS: %s", psdp->descr);
+ xf86ErrorF("\n");
}
if (useProm)
- sparcPromClose();
+ sparcPromClose();
}
/*
@@ -240,52 +259,55 @@ xf86ParseSbusBusString(const char *busID, int *fbNum)
int i, len;
if (StringToBusType(busID, &id) != BUS_SBUS)
- return FALSE;
+ return FALSE;
if (*id != '/') {
- if (!strncmp (id, "fb", 2)) {
- if (!isdigit(id[2]))
- return FALSE;
- *fbNum = atoi(id + 2);
- return TRUE;
- } else {
- sbusDevicePtr *psdpp;
- int devId;
-
- for (i = 0, len = 0; sbusDeviceTable[i].devId; i++) {
- len = strlen(sbusDeviceTable[i].promName);
- if (!strncmp (sbusDeviceTable[i].promName, id, len)
- && isdigit(id[len]))
- break;
- }
- devId = sbusDeviceTable[i].devId;
- if (!devId) return FALSE;
- i = atoi(id + len);
- for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
- if ((*psdpp)->devId != devId)
- continue;
- if (!i) {
- *fbNum = (*psdpp)->fbNum;
- return TRUE;
- }
- i--;
- }
- }
- return FALSE;
+ if (!strncmp(id, "fb", 2)) {
+ if (!isdigit(id[2]))
+ return FALSE;
+ *fbNum = atoi(id + 2);
+ return TRUE;
+ }
+ else {
+ sbusDevicePtr *psdpp;
+ int devId;
+
+ for (i = 0, len = 0; sbusDeviceTable[i].devId; i++) {
+ len = strlen(sbusDeviceTable[i].promName);
+ if (!strncmp(sbusDeviceTable[i].promName, id, len)
+ && isdigit(id[len]))
+ break;
+ }
+ devId = sbusDeviceTable[i].devId;
+ if (!devId)
+ return FALSE;
+ i = atoi(id + len);
+ for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
+ if ((*psdpp)->devId != devId)
+ continue;
+ if (!i) {
+ *fbNum = (*psdpp)->fbNum;
+ return TRUE;
+ }
+ i--;
+ }
+ }
+ return FALSE;
}
if (sparcPromInit() >= 0) {
- i = sparcPromPathname2Node(id);
- sparcPromClose();
- if (i) {
- sbusDevicePtr *psdpp;
- for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
- if ((*psdpp)->node.node == i) {
- *fbNum = (*psdpp)->fbNum;
- return TRUE;
- }
- }
- }
+ i = sparcPromPathname2Node(id);
+ sparcPromClose();
+ if (i) {
+ sbusDevicePtr *psdpp;
+
+ for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
+ if ((*psdpp)->node.node == i) {
+ *fbNum = (*psdpp)->fbNum;
+ return TRUE;
+ }
+ }
+ }
}
return FALSE;
}
@@ -300,9 +322,10 @@ xf86CompareSbusBusString(const char *busID, int fbNum)
int iFbNum;
if (xf86ParseSbusBusString(busID, &iFbNum)) {
- return fbNum == iFbNum;
- } else {
- return FALSE;
+ return fbNum == iFbNum;
+ }
+ else {
+ return FALSE;
}
}
@@ -317,10 +340,10 @@ xf86CheckSbusSlot(int fbNum)
EntityPtr p;
for (i = 0; i < xf86NumEntities; i++) {
- p = xf86Entities[i];
- /* Check if this SBUS slot is taken */
- if (p->bus.type == BUS_SBUS && p->bus.id.sbus.fbNum == fbNum)
- return FALSE;
+ p = xf86Entities[i];
+ /* Check if this SBUS slot is taken */
+ if (p->bus.type == BUS_SBUS && p->bus.id.sbus.fbNum == fbNum)
+ return FALSE;
}
return TRUE;
@@ -332,8 +355,7 @@ xf86CheckSbusSlot(int fbNum)
*/
int
-xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp,
- GDevPtr dev, Bool active)
+xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp, GDevPtr dev, Bool active)
{
EntityPtr p = NULL;
@@ -349,18 +371,19 @@ xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp,
p->bus.id.sbus.fbNum = psdp->fbNum;
p->active = active;
p->inUse = FALSE;
- sbusSlotClaimed = TRUE;
- return num;
- } else
- return -1;
+ sbusSlotClaimed = TRUE;
+ return num;
+ }
+ else
+ return -1;
}
int
-xf86MatchSbusInstances(const char *driverName, int sbusDevId,
- GDevPtr *devList, int numDevs, DriverPtr drvp,
- int **foundEntities)
+xf86MatchSbusInstances(const char *driverName, int sbusDevId,
+ GDevPtr * devList, int numDevs, DriverPtr drvp,
+ int **foundEntities)
{
- int i,j;
+ int i, j;
sbusDevicePtr psdp, *psdpp;
int numClaimedInstances = 0;
int allocatedInstances = 0;
@@ -371,24 +394,24 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
int useProm = 0;
struct Inst {
- sbusDevicePtr sbus;
- GDevPtr dev;
- Bool claimed; /* BusID matches with a device section */
+ sbusDevicePtr sbus;
+ GDevPtr dev;
+ Bool claimed; /* BusID matches with a device section */
} *instances = NULL;
*foundEntities = NULL;
for (psdpp = xf86SbusInfo, psdp = *psdpp; psdp; psdp = *++psdpp) {
- if (psdp->devId != sbusDevId)
- continue;
- if (psdp->fd == -2)
- continue;
- ++allocatedInstances;
- instances = xnfrealloc(instances,
- allocatedInstances * sizeof(struct Inst));
- instances[allocatedInstances - 1].sbus = psdp;
- instances[allocatedInstances - 1].dev = NULL;
- instances[allocatedInstances - 1].claimed = FALSE;
- numFound++;
+ if (psdp->devId != sbusDevId)
+ continue;
+ if (psdp->fd == -2)
+ continue;
+ ++allocatedInstances;
+ instances = xnfrealloc(instances,
+ allocatedInstances * sizeof(struct Inst));
+ instances[allocatedInstances - 1].sbus = psdp;
+ instances[allocatedInstances - 1].dev = NULL;
+ instances[allocatedInstances - 1].claimed = FALSE;
+ numFound++;
}
/*
@@ -397,88 +420,97 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
* allow the config file to override this.
*/
if (allocatedInstances <= 0) {
- free(instances);
- return 0;
+ free(instances);
+ return 0;
}
if (sparcPromInit() >= 0)
- useProm = 1;
+ useProm = 1;
if (xf86DoConfigure && xf86DoConfigurePass1) {
- GDevPtr pGDev;
- int actualcards = 0;
- for (i = 0; i < allocatedInstances; i++) {
- actualcards++;
- pGDev = xf86AddBusDeviceToConfigure(drvp->driverName, BUS_SBUS,
- instances[i].sbus, -1);
- if (pGDev) {
- /*
- * XF86Match???Instances() treat chipID and chipRev as
- * overrides, so clobber them here.
- */
- pGDev->chipID = pGDev->chipRev = -1;
- }
- }
- free(instances);
- if (useProm)
- sparcPromClose();
- return actualcards;
+ GDevPtr pGDev;
+ int actualcards = 0;
+
+ for (i = 0; i < allocatedInstances; i++) {
+ actualcards++;
+ pGDev = xf86AddBusDeviceToConfigure(drvp->driverName, BUS_SBUS,
+ instances[i].sbus, -1);
+ if (pGDev) {
+ /*
+ * XF86Match???Instances() treat chipID and chipRev as
+ * overrides, so clobber them here.
+ */
+ pGDev->chipID = pGDev->chipRev = -1;
+ }
+ }
+ free(instances);
+ if (useProm)
+ sparcPromClose();
+ return actualcards;
}
DebugF("%s instances found: %d\n", driverName, allocatedInstances);
for (i = 0; i < allocatedInstances; i++) {
- char *promPath = NULL;
-
- psdp = instances[i].sbus;
- devBus = NULL;
- dev = NULL;
- if (useProm && psdp->node.node)
- promPath = sparcPromNode2Pathname(&psdp->node);
-
- for (j = 0; j < numDevs; j++) {
- if (devList[j]->busID && *devList[j]->busID) {
- if (xf86CompareSbusBusString(devList[j]->busID, psdp->fbNum)) {
- if (devBus)
- xf86MsgVerb(X_WARNING,0,
- "%s: More than one matching Device section for "
- "instance (BusID: %s) found: %s\n",
- driverName,devList[j]->identifier,
- devList[j]->busID);
- else
- devBus = devList[j];
- }
- } else {
- if (!dev && !devBus) {
- if (promPath)
- xf86Msg(X_PROBED, "Assigning device section with no busID to SBUS:%s\n",
- promPath);
- else
- xf86Msg(X_PROBED, "Assigning device section with no busID to SBUS:fb%d\n",
- psdp->fbNum);
- dev = devList[j];
- } else
- xf86MsgVerb(X_WARNING, 0,
- "%s: More than one matching Device section "
- "found: %s\n", driverName, devList[j]->identifier);
- }
- }
- if (devBus) dev = devBus; /* busID preferred */
- if (!dev && psdp->fd != -2) {
- if (promPath) {
- xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
- "for instance (BusID SBUS:%s) found\n",
- driverName, promPath);
- } else
- xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
- "for instance (BusID SBUS:fb%d) found\n",
- driverName, psdp->fbNum);
- } else if (dev) {
- numClaimedInstances++;
- instances[i].claimed = TRUE;
- instances[i].dev = dev;
- }
- free(promPath);
+ char *promPath = NULL;
+
+ psdp = instances[i].sbus;
+ devBus = NULL;
+ dev = NULL;
+ if (useProm && psdp->node.node)
+ promPath = sparcPromNode2Pathname(&psdp->node);
+
+ for (j = 0; j < numDevs; j++) {
+ if (devList[j]->busID && *devList[j]->busID) {
+ if (xf86CompareSbusBusString(devList[j]->busID, psdp->fbNum)) {
+ if (devBus)
+ xf86MsgVerb(X_WARNING, 0,
+ "%s: More than one matching Device section for "
+ "instance (BusID: %s) found: %s\n",
+ driverName, devList[j]->identifier,
+ devList[j]->busID);
+ else
+ devBus = devList[j];
+ }
+ }
+ else {
+ if (!dev && !devBus) {
+ if (promPath)
+ xf86Msg(X_PROBED,
+ "Assigning device section with no busID to SBUS:%s\n",
+ promPath);
+ else
+ xf86Msg(X_PROBED,
+ "Assigning device section with no busID to SBUS:fb%d\n",
+ psdp->fbNum);
+ dev = devList[j];
+ }
+ else
+ xf86MsgVerb(X_WARNING, 0,
+ "%s: More than one matching Device section "
+ "found: %s\n", driverName,
+ devList[j]->identifier);
+ }
+ }
+ if (devBus)
+ dev = devBus; /* busID preferred */
+ if (!dev && psdp->fd != -2) {
+ if (promPath) {
+ xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
+ "for instance (BusID SBUS:%s) found\n",
+ driverName, promPath);
+ }
+ else
+ xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
+ "for instance (BusID SBUS:fb%d) found\n",
+ driverName, psdp->fbNum);
+ }
+ else if (dev) {
+ numClaimedInstances++;
+ instances[i].claimed = TRUE;
+ instances[i].dev = dev;
+ }
+ free(promPath);
}
DebugF("%s instances found: %d\n", driverName, numClaimedInstances);
@@ -489,29 +521,29 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
*/
numFound = 0;
for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
- if (!instances[i].claimed)
- continue;
- psdp = instances[i].sbus;
- if (!xf86CheckSbusSlot(psdp->fbNum))
- continue;
-
- DebugF("%s: card at fb%d %08x is claimed by a Device section\n",
- driverName, psdp->fbNum, psdp->node.node);
-
- /* Allocate an entry in the lists to be returned */
- numFound++;
- retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
- retEntities[numFound - 1]
- = xf86ClaimSbusSlot(psdp, drvp, instances[i].dev,instances[i].dev->active ?
- TRUE : FALSE);
+ if (!instances[i].claimed)
+ continue;
+ psdp = instances[i].sbus;
+ if (!xf86CheckSbusSlot(psdp->fbNum))
+ continue;
+
+ DebugF("%s: card at fb%d %08x is claimed by a Device section\n",
+ driverName, psdp->fbNum, psdp->node.node);
+
+ /* Allocate an entry in the lists to be returned */
+ numFound++;
+ retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
+ retEntities[numFound - 1]
+ = xf86ClaimSbusSlot(psdp, drvp, instances[i].dev,
+ instances[i].dev->active ? TRUE : FALSE);
}
free(instances);
if (numFound > 0) {
- *foundEntities = retEntities;
+ *foundEntities = retEntities;
}
if (useProm)
- sparcPromClose();
+ sparcPromClose();
return numFound;
}
@@ -525,12 +557,12 @@ xf86GetSbusInfoForEntity(int entityIndex)
sbusDevicePtr *psdpp;
EntityPtr p = xf86Entities[entityIndex];
- if (entityIndex >= xf86NumEntities
- || p->bus.type != BUS_SBUS) return NULL;
+ if (entityIndex >= xf86NumEntities || p->bus.type != BUS_SBUS)
+ return NULL;
for (psdpp = xf86SbusInfo; *psdpp != NULL; psdpp++) {
- if (p->bus.id.sbus.fbNum == (*psdpp)->fbNum)
- return *psdpp;
+ if (p->bus.id.sbus.fbNum == (*psdpp)->fbNum)
+ return *psdpp;
}
return NULL;
}
@@ -541,11 +573,13 @@ xf86GetEntityForSbusInfo(sbusDevicePtr psdp)
int i;
for (i = 0; i < xf86NumEntities; i++) {
- EntityPtr p = xf86Entities[i];
- if (p->bus.type != BUS_SBUS) continue;
+ EntityPtr p = xf86Entities[i];
- if (p->bus.id.sbus.fbNum == psdp->fbNum)
- return i;
+ if (p->bus.type != BUS_SBUS)
+ continue;
+
+ if (p->bus.id.sbus.fbNum == psdp->fbNum)
+ return i;
}
return -1;
}
@@ -601,32 +635,33 @@ typedef struct _sbusCmap {
static void
xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
- LOCO *colors, VisualPtr pVisual)
+ LOCO * colors, VisualPtr pVisual)
{
int i, index;
sbusCmapPtr cmap;
struct fbcmap fbcmap;
- unsigned char *data = malloc(numColors*3);
-
+ unsigned char *data = malloc(numColors * 3);
+
cmap = SBUSCMAPPTR(pScrn->pScreen);
- if (!cmap) return;
+ if (!cmap)
+ return;
fbcmap.count = 0;
fbcmap.index = indices[0];
fbcmap.red = data;
fbcmap.green = data + numColors;
fbcmap.blue = fbcmap.green + numColors;
for (i = 0; i < numColors; i++) {
- index = indices[i];
- if (fbcmap.count && index != fbcmap.index + fbcmap.count) {
- ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
- fbcmap.count = 0;
- fbcmap.index = index;
- }
- fbcmap.red[fbcmap.count] = colors[index].red;
- fbcmap.green[fbcmap.count] = colors[index].green;
- fbcmap.blue[fbcmap.count++] = colors[index].blue;
+ index = indices[i];
+ if (fbcmap.count && index != fbcmap.index + fbcmap.count) {
+ ioctl(cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
+ fbcmap.count = 0;
+ fbcmap.index = index;
+ }
+ fbcmap.red[fbcmap.count] = colors[index].red;
+ fbcmap.green[fbcmap.count] = colors[index].green;
+ fbcmap.blue[fbcmap.count++] = colors[index].blue;
}
- ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
+ ioctl(cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
free(data);
}
@@ -635,20 +670,20 @@ xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen)
{
sbusCmapPtr cmap;
struct fbcmap fbcmap;
-
+
cmap = SBUSCMAPPTR(pScreen);
if (cmap->origCmapValid) {
- fbcmap.index = 0;
- fbcmap.count = 16;
- fbcmap.red = cmap->origRed;
- fbcmap.green = cmap->origGreen;
- fbcmap.blue = cmap->origBlue;
- ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
+ fbcmap.index = 0;
+ fbcmap.count = 16;
+ fbcmap.red = cmap->origRed;
+ fbcmap.green = cmap->origGreen;
+ fbcmap.blue = cmap->origBlue;
+ ioctl(cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
}
pScreen->CloseScreen = cmap->CloseScreen;
free(cmap);
return (*pScreen->CloseScreen) (i, pScreen);
-}
+}
Bool
xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
@@ -665,25 +700,26 @@ xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
fbcmap.red = cmap->origRed;
fbcmap.green = cmap->origGreen;
fbcmap.blue = cmap->origBlue;
- if (ioctl (psdp->fd, FBIOGETCMAP, &fbcmap) >= 0)
- cmap->origCmapValid = TRUE;
+ if (ioctl(psdp->fd, FBIOGETCMAP, &fbcmap) >= 0)
+ cmap->origCmapValid = TRUE;
fbcmap.index = 0;
fbcmap.count = 2;
fbcmap.red = data;
fbcmap.green = data;
fbcmap.blue = data;
if (pScreen->whitePixel == 0) {
- data[0] = 255;
- data[1] = 0;
- } else {
- data[0] = 0;
- data[1] = 255;
+ data[0] = 255;
+ data[1] = 0;
+ }
+ else {
+ data[0] = 0;
+ data[1] = 255;
}
- ioctl (psdp->fd, FBIOPUTCMAP, &fbcmap);
+ ioctl(psdp->fd, FBIOPUTCMAP, &fbcmap);
cmap->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86SbusCmapCloseScreen;
return xf86HandleColormaps(pScreen, 256, 8,
- xf86SbusCmapLoadPalette, NULL, 0);
+ xf86SbusCmapLoadPalette, NULL, 0);
}
Bool
@@ -695,7 +731,7 @@ xf86SbusConfigure(void *busData, sbusDevicePtr sBus)
}
void
-xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec *GDev)
+xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec * GDev)
{
char *promPath = NULL;
@@ -708,7 +744,8 @@ xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec *GDev)
if (promPath) {
XNFasprintf(&GDev->busID, "SBUS:%s", promPath);
free(promPath);
- } else {
+ }
+ else {
XNFasprintf(&GDev->busID, "SBUS:fb%d", sBus->fbNum);
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.h b/xorg-server/hw/xfree86/common/xf86sbusBus.h
index e210770db..a4d9c6cde 100644
--- a/xorg-server/hw/xfree86/common/xf86sbusBus.h
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.h
@@ -1,104 +1,111 @@
-/*
- * SBUS bus-specific declarations
- *
- * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _XF86_SBUSBUS_H
-#define _XF86_SBUSBUS_H
-
-#include "xf86str.h"
-
-#define SBUS_DEVICE_BW2 0x0001
-#define SBUS_DEVICE_CG2 0x0002
-#define SBUS_DEVICE_CG3 0x0003
-#define SBUS_DEVICE_CG4 0x0004
-#define SBUS_DEVICE_CG6 0x0005
-#define SBUS_DEVICE_CG8 0x0006
-#define SBUS_DEVICE_CG12 0x0007
-#define SBUS_DEVICE_CG14 0x0008
-#define SBUS_DEVICE_LEO 0x0009
-#define SBUS_DEVICE_TCX 0x000a
-#define SBUS_DEVICE_FFB 0x000b
-#define SBUS_DEVICE_GT 0x000c
-#define SBUS_DEVICE_MGX 0x000d
-
-typedef struct sbus_prom_node {
- int node;
- /* Because of misdesigned openpromio */
- int cookie[2];
-} sbusPromNode, *sbusPromNodePtr;
-
-typedef struct sbus_device {
- int devId;
- int fbNum;
- int fd;
- int width, height;
- sbusPromNode node;
- char *descr;
- char *device;
-} sbusDevice, *sbusDevicePtr;
-
-struct sbus_devtable {
- int devId;
- int fbType;
- char *promName;
- char *driverName;
- char *descr;
-};
-
-extern _X_EXPORT void xf86SbusProbe(void);
-extern _X_EXPORT sbusDevicePtr *xf86SbusInfo;
-extern _X_EXPORT struct sbus_devtable sbusDeviceTable[];
-
-extern _X_EXPORT int xf86MatchSbusInstances(const char *driverName, int sbusDevId,
- GDevPtr *devList, int numDevs, DriverPtr drvp,
- int **foundEntities);
-extern _X_EXPORT sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex);
-extern _X_EXPORT int xf86GetEntityForSbusInfo(sbusDevicePtr psdp);
-extern _X_EXPORT void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp);
-extern _X_EXPORT pointer xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset,
- unsigned long size);
-extern _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size);
-extern _X_EXPORT void xf86SbusHideOsHwCursor(sbusDevicePtr psdp);
-extern _X_EXPORT void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg);
-extern _X_EXPORT Bool xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp);
-
-extern _X_EXPORT int promRootNode;
-
-extern _X_EXPORT int promGetSibling(int node);
-extern _X_EXPORT int promGetChild(int node);
-extern _X_EXPORT char * promGetProperty(const char *prop, int *lenp);
-extern _X_EXPORT int promGetBool(const char *prop);
-
-extern _X_EXPORT int sparcPromInit(void);
-extern _X_EXPORT void sparcPromClose(void);
-extern _X_EXPORT char * sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp);
-extern _X_EXPORT int sparcPromGetBool(sbusPromNodePtr pnode, const char *prop);
-extern _X_EXPORT void sparcPromAssignNodes(void);
-extern _X_EXPORT char * sparcPromNode2Pathname(sbusPromNodePtr pnode);
-extern _X_EXPORT int sparcPromPathname2Node(const char *pathName);
-extern _X_EXPORT char *sparcDriverName(void);
-
-extern Bool xf86SbusConfigure(void *busData, sbusDevicePtr sBus);
-extern void xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus,
- GDevRec *GDev);
-
-#endif /* _XF86_SBUSBUS_H */
+/*
+ * SBUS bus-specific declarations
+ *
+ * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _XF86_SBUSBUS_H
+#define _XF86_SBUSBUS_H
+
+#include "xf86str.h"
+
+#define SBUS_DEVICE_BW2 0x0001
+#define SBUS_DEVICE_CG2 0x0002
+#define SBUS_DEVICE_CG3 0x0003
+#define SBUS_DEVICE_CG4 0x0004
+#define SBUS_DEVICE_CG6 0x0005
+#define SBUS_DEVICE_CG8 0x0006
+#define SBUS_DEVICE_CG12 0x0007
+#define SBUS_DEVICE_CG14 0x0008
+#define SBUS_DEVICE_LEO 0x0009
+#define SBUS_DEVICE_TCX 0x000a
+#define SBUS_DEVICE_FFB 0x000b
+#define SBUS_DEVICE_GT 0x000c
+#define SBUS_DEVICE_MGX 0x000d
+
+typedef struct sbus_prom_node {
+ int node;
+ /* Because of misdesigned openpromio */
+ int cookie[2];
+} sbusPromNode, *sbusPromNodePtr;
+
+typedef struct sbus_device {
+ int devId;
+ int fbNum;
+ int fd;
+ int width, height;
+ sbusPromNode node;
+ char *descr;
+ char *device;
+} sbusDevice, *sbusDevicePtr;
+
+struct sbus_devtable {
+ int devId;
+ int fbType;
+ char *promName;
+ char *driverName;
+ char *descr;
+};
+
+extern _X_EXPORT void xf86SbusProbe(void);
+extern _X_EXPORT sbusDevicePtr *xf86SbusInfo;
+extern _X_EXPORT struct sbus_devtable sbusDeviceTable[];
+
+extern _X_EXPORT int xf86MatchSbusInstances(const char *driverName,
+ int sbusDevId, GDevPtr * devList,
+ int numDevs, DriverPtr drvp,
+ int **foundEntities);
+extern _X_EXPORT sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex);
+extern _X_EXPORT int xf86GetEntityForSbusInfo(sbusDevicePtr psdp);
+extern _X_EXPORT void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn,
+ sbusDevicePtr psdp);
+extern _X_EXPORT pointer xf86MapSbusMem(sbusDevicePtr psdp,
+ unsigned long offset,
+ unsigned long size);
+extern _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr,
+ unsigned long size);
+extern _X_EXPORT void xf86SbusHideOsHwCursor(sbusDevicePtr psdp);
+extern _X_EXPORT void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg,
+ int fg);
+extern _X_EXPORT Bool xf86SbusHandleColormaps(ScreenPtr pScreen,
+ sbusDevicePtr psdp);
+
+extern _X_EXPORT int promRootNode;
+
+extern _X_EXPORT int promGetSibling(int node);
+extern _X_EXPORT int promGetChild(int node);
+extern _X_EXPORT char *promGetProperty(const char *prop, int *lenp);
+extern _X_EXPORT int promGetBool(const char *prop);
+
+extern _X_EXPORT int sparcPromInit(void);
+extern _X_EXPORT void sparcPromClose(void);
+extern _X_EXPORT char *sparcPromGetProperty(sbusPromNodePtr pnode,
+ const char *prop, int *lenp);
+extern _X_EXPORT int sparcPromGetBool(sbusPromNodePtr pnode, const char *prop);
+extern _X_EXPORT void sparcPromAssignNodes(void);
+extern _X_EXPORT char *sparcPromNode2Pathname(sbusPromNodePtr pnode);
+extern _X_EXPORT int sparcPromPathname2Node(const char *pathName);
+extern _X_EXPORT char *sparcDriverName(void);
+
+extern Bool xf86SbusConfigure(void *busData, sbusDevicePtr sBus);
+extern void xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus,
+ GDevRec * GDev);
+
+#endif /* _XF86_SBUSBUS_H */
diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h
index e2ca55875..6294845bc 100644
--- a/xorg-server/hw/xfree86/common/xf86str.h
+++ b/xorg-server/hw/xfree86/common/xf86str.h
@@ -55,139 +55,138 @@ typedef uint64_t memType;
typedef uintptr_t memType;
#endif
-
/* Video mode flags */
typedef enum {
- V_PHSYNC = 0x0001,
- V_NHSYNC = 0x0002,
- V_PVSYNC = 0x0004,
- V_NVSYNC = 0x0008,
- V_INTERLACE = 0x0010,
- V_DBLSCAN = 0x0020,
- V_CSYNC = 0x0040,
- V_PCSYNC = 0x0080,
- V_NCSYNC = 0x0100,
- V_HSKEW = 0x0200, /* hskew provided */
- V_BCAST = 0x0400,
- V_PIXMUX = 0x1000,
- V_DBLCLK = 0x2000,
- V_CLKDIV2 = 0x4000
+ V_PHSYNC = 0x0001,
+ V_NHSYNC = 0x0002,
+ V_PVSYNC = 0x0004,
+ V_NVSYNC = 0x0008,
+ V_INTERLACE = 0x0010,
+ V_DBLSCAN = 0x0020,
+ V_CSYNC = 0x0040,
+ V_PCSYNC = 0x0080,
+ V_NCSYNC = 0x0100,
+ V_HSKEW = 0x0200, /* hskew provided */
+ V_BCAST = 0x0400,
+ V_PIXMUX = 0x1000,
+ V_DBLCLK = 0x2000,
+ V_CLKDIV2 = 0x4000
} ModeFlags;
typedef enum {
- INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */
+ INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */
} CrtcAdjustFlags;
/* Flags passed to ChipValidMode() */
typedef enum {
MODECHECK_INITIAL = 0,
- MODECHECK_FINAL = 1
+ MODECHECK_FINAL = 1
} ModeCheckFlags;
/* These are possible return values for xf86CheckMode() and ValidMode() */
typedef enum {
- MODE_OK = 0, /* Mode OK */
- MODE_HSYNC, /* hsync out of range */
- MODE_VSYNC, /* vsync out of range */
- MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
- MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
- MODE_BAD_WIDTH, /* requires an unsupported linepitch */
- MODE_NOMODE, /* no mode with a maching name */
- MODE_NO_INTERLACE, /* interlaced mode not supported */
- MODE_NO_DBLESCAN, /* doublescan mode not supported */
- MODE_NO_VSCAN, /* multiscan mode not supported */
- MODE_MEM, /* insufficient video memory */
- MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
- MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
- MODE_MEM_VIRT, /* insufficient video memory given virtual size */
- MODE_NOCLOCK, /* no fixed clock available */
- MODE_CLOCK_HIGH, /* clock required is too high */
- MODE_CLOCK_LOW, /* clock required is too low */
- MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
- MODE_BAD_HVALUE, /* horizontal timing was out of range */
- MODE_BAD_VVALUE, /* vertical timing was out of range */
- MODE_BAD_VSCAN, /* VScan value out of range */
- MODE_HSYNC_NARROW, /* horizontal sync too narrow */
- MODE_HSYNC_WIDE, /* horizontal sync too wide */
- MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
- MODE_HBLANK_WIDE, /* horizontal blanking too wide */
- MODE_VSYNC_NARROW, /* vertical sync too narrow */
- MODE_VSYNC_WIDE, /* vertical sync too wide */
- MODE_VBLANK_NARROW, /* vertical blanking too narrow */
- MODE_VBLANK_WIDE, /* vertical blanking too wide */
- MODE_PANEL, /* exceeds panel dimensions */
- MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
- MODE_ONE_WIDTH, /* only one width is supported */
- MODE_ONE_HEIGHT, /* only one height is supported */
- MODE_ONE_SIZE, /* only one resolution is supported */
- MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
- MODE_BANDWIDTH, /* mode requires too much memory bandwidth */
- MODE_BAD = -2, /* unspecified reason */
- MODE_ERROR = -1 /* error condition */
+ MODE_OK = 0, /* Mode OK */
+ MODE_HSYNC, /* hsync out of range */
+ MODE_VSYNC, /* vsync out of range */
+ MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
+ MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
+ MODE_BAD_WIDTH, /* requires an unsupported linepitch */
+ MODE_NOMODE, /* no mode with a maching name */
+ MODE_NO_INTERLACE, /* interlaced mode not supported */
+ MODE_NO_DBLESCAN, /* doublescan mode not supported */
+ MODE_NO_VSCAN, /* multiscan mode not supported */
+ MODE_MEM, /* insufficient video memory */
+ MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
+ MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
+ MODE_MEM_VIRT, /* insufficient video memory given virtual size */
+ MODE_NOCLOCK, /* no fixed clock available */
+ MODE_CLOCK_HIGH, /* clock required is too high */
+ MODE_CLOCK_LOW, /* clock required is too low */
+ MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
+ MODE_BAD_HVALUE, /* horizontal timing was out of range */
+ MODE_BAD_VVALUE, /* vertical timing was out of range */
+ MODE_BAD_VSCAN, /* VScan value out of range */
+ MODE_HSYNC_NARROW, /* horizontal sync too narrow */
+ MODE_HSYNC_WIDE, /* horizontal sync too wide */
+ MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
+ MODE_HBLANK_WIDE, /* horizontal blanking too wide */
+ MODE_VSYNC_NARROW, /* vertical sync too narrow */
+ MODE_VSYNC_WIDE, /* vertical sync too wide */
+ MODE_VBLANK_NARROW, /* vertical blanking too narrow */
+ MODE_VBLANK_WIDE, /* vertical blanking too wide */
+ MODE_PANEL, /* exceeds panel dimensions */
+ MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
+ MODE_ONE_WIDTH, /* only one width is supported */
+ MODE_ONE_HEIGHT, /* only one height is supported */
+ MODE_ONE_SIZE, /* only one resolution is supported */
+ MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
+ MODE_BANDWIDTH, /* mode requires too much memory bandwidth */
+ MODE_BAD = -2, /* unspecified reason */
+ MODE_ERROR = -1 /* error condition */
} ModeStatus;
/*
* The mode sets are, from best to worst: USERDEF, DRIVER, and DEFAULT/BUILTIN.
* Preferred will bubble a mode to the top within a set.
*/
-# define M_T_BUILTIN 0x01 /* built-in mode */
-# define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */
-# define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */
-# define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C)
+#define M_T_BUILTIN 0x01 /* built-in mode */
+#define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */
+#define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */
+#define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C)
/* built-in mode - configure CRTC and clock */
-# define M_T_PREFERRED 0x08 /* preferred mode within a set */
-# define M_T_DEFAULT 0x10 /* (VESA) default modes */
-# define M_T_USERDEF 0x20 /* One of the modes from the config file */
-# define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */
-# define M_T_USERPREF 0x80 /* mode preferred by the user config */
+#define M_T_PREFERRED 0x08 /* preferred mode within a set */
+#define M_T_DEFAULT 0x10 /* (VESA) default modes */
+#define M_T_USERDEF 0x20 /* One of the modes from the config file */
+#define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */
+#define M_T_USERPREF 0x80 /* mode preferred by the user config */
/* Video mode */
typedef struct _DisplayModeRec {
- struct _DisplayModeRec * prev;
- struct _DisplayModeRec * next;
- char * name; /* identifier for the mode */
- ModeStatus status;
- int type;
+ struct _DisplayModeRec *prev;
+ struct _DisplayModeRec *next;
+ char *name; /* identifier for the mode */
+ ModeStatus status;
+ int type;
/* These are the values that the user sees/provides */
- int Clock; /* pixel clock freq (kHz) */
- int HDisplay; /* horizontal timing */
- int HSyncStart;
- int HSyncEnd;
- int HTotal;
- int HSkew;
- int VDisplay; /* vertical timing */
- int VSyncStart;
- int VSyncEnd;
- int VTotal;
- int VScan;
- int Flags;
-
- /* These are the values the hardware uses */
- int ClockIndex;
- int SynthClock; /* Actual clock freq to
- * be programmed (kHz) */
- int CrtcHDisplay;
- int CrtcHBlankStart;
- int CrtcHSyncStart;
- int CrtcHSyncEnd;
- int CrtcHBlankEnd;
- int CrtcHTotal;
- int CrtcHSkew;
- int CrtcVDisplay;
- int CrtcVBlankStart;
- int CrtcVSyncStart;
- int CrtcVSyncEnd;
- int CrtcVBlankEnd;
- int CrtcVTotal;
- Bool CrtcHAdjusted;
- Bool CrtcVAdjusted;
- int PrivSize;
- INT32 * Private;
- int PrivFlags;
-
- float HSync, VRefresh;
+ int Clock; /* pixel clock freq (kHz) */
+ int HDisplay; /* horizontal timing */
+ int HSyncStart;
+ int HSyncEnd;
+ int HTotal;
+ int HSkew;
+ int VDisplay; /* vertical timing */
+ int VSyncStart;
+ int VSyncEnd;
+ int VTotal;
+ int VScan;
+ int Flags;
+
+ /* These are the values the hardware uses */
+ int ClockIndex;
+ int SynthClock; /* Actual clock freq to
+ * be programmed (kHz) */
+ int CrtcHDisplay;
+ int CrtcHBlankStart;
+ int CrtcHSyncStart;
+ int CrtcHSyncEnd;
+ int CrtcHBlankEnd;
+ int CrtcHTotal;
+ int CrtcHSkew;
+ int CrtcVDisplay;
+ int CrtcVBlankStart;
+ int CrtcVSyncStart;
+ int CrtcVSyncEnd;
+ int CrtcVBlankEnd;
+ int CrtcVTotal;
+ Bool CrtcHAdjusted;
+ Bool CrtcVAdjusted;
+ int PrivSize;
+ INT32 *Private;
+ int PrivFlags;
+
+ float HSync, VRefresh;
} DisplayModeRec, *DisplayModePtr;
/* The monitor description */
@@ -195,11 +194,17 @@ typedef struct _DisplayModeRec {
#define MAX_HSYNC 8
#define MAX_VREFRESH 8
-typedef struct { float hi, lo; } range;
+typedef struct {
+ float hi, lo;
+} range;
-typedef struct { CARD32 red, green, blue; } rgb;
+typedef struct {
+ CARD32 red, green, blue;
+} rgb;
-typedef struct { float red, green, blue; } Gamma;
+typedef struct {
+ float red, green, blue;
+} Gamma;
/* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */
#define GAMMA_MAX 10.0
@@ -207,35 +212,35 @@ typedef struct { float red, green, blue; } Gamma;
#define GAMMA_ZERO (GAMMA_MIN / 100.0)
typedef struct {
- char * id;
- char * vendor;
- char * model;
- int nHsync;
- range hsync[MAX_HSYNC];
- int nVrefresh;
- range vrefresh[MAX_VREFRESH];
- DisplayModePtr Modes; /* Start of the monitor's mode list */
- DisplayModePtr Last; /* End of the monitor's mode list */
- Gamma gamma; /* Gamma of the monitor */
- int widthmm;
- int heightmm;
- pointer options;
- pointer DDC;
- Bool reducedblanking; /* Allow CVT reduced blanking modes? */
- int maxPixClock; /* in kHz, like mode->Clock */
+ char *id;
+ char *vendor;
+ char *model;
+ int nHsync;
+ range hsync[MAX_HSYNC];
+ int nVrefresh;
+ range vrefresh[MAX_VREFRESH];
+ DisplayModePtr Modes; /* Start of the monitor's mode list */
+ DisplayModePtr Last; /* End of the monitor's mode list */
+ Gamma gamma; /* Gamma of the monitor */
+ int widthmm;
+ int heightmm;
+ pointer options;
+ pointer DDC;
+ Bool reducedblanking; /* Allow CVT reduced blanking modes? */
+ int maxPixClock; /* in kHz, like mode->Clock */
} MonRec, *MonPtr;
/* the list of clock ranges */
typedef struct x_ClockRange {
struct x_ClockRange *next;
- int minClock; /* (kHz) */
- int maxClock; /* (kHz) */
- int clockIndex; /* -1 for programmable clocks */
- Bool interlaceAllowed;
- Bool doubleScanAllowed;
- int ClockMulFactor;
- int ClockDivFactor;
- int PrivFlags;
+ int minClock; /* (kHz) */
+ int maxClock; /* (kHz) */
+ int clockIndex; /* -1 for programmable clocks */
+ Bool interlaceAllowed;
+ Bool doubleScanAllowed;
+ int ClockMulFactor;
+ int ClockDivFactor;
+ int PrivFlags;
} ClockRange, *ClockRangePtr;
/*
@@ -254,8 +259,7 @@ typedef enum {
GET_REQUIRED_HW_INTERFACES = 10
} xorgDriverFuncOp;
-typedef Bool xorgDriverFuncProc (ScrnInfoPtr, xorgDriverFuncOp,
- pointer);
+typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, pointer);
/* RR_GET_INFO, RR_SET_CONFIG */
typedef struct {
@@ -294,13 +298,13 @@ typedef CARD32 xorgHWFlags;
struct _DriverRec;
typedef struct {
- int driverVersion;
- char * driverName;
- void (*Identify)(int flags);
- Bool (*Probe)(struct _DriverRec *drv, int flags);
- const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
- pointer module;
- int refCount;
+ int driverVersion;
+ char *driverName;
+ void (*Identify) (int flags);
+ Bool (*Probe) (struct _DriverRec * drv, int flags);
+ const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype);
+ pointer module;
+ int refCount;
} DriverRec1;
struct _SymTabRec;
@@ -309,18 +313,18 @@ struct _PciChipsets;
struct pci_device;
typedef struct _DriverRec {
- int driverVersion;
- char * driverName;
- void (*Identify)(int flags);
- Bool (*Probe)(struct _DriverRec *drv, int flags);
- const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
- pointer module;
- int refCount;
- xorgDriverFuncProc *driverFunc;
-
- const struct pci_id_match * supported_devices;
- Bool (*PciProbe)( struct _DriverRec * drv, int entity_num,
- struct pci_device * dev, intptr_t match_data );
+ int driverVersion;
+ char *driverName;
+ void (*Identify) (int flags);
+ Bool (*Probe) (struct _DriverRec * drv, int flags);
+ const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype);
+ pointer module;
+ int refCount;
+ xorgDriverFuncProc *driverFunc;
+
+ const struct pci_id_match *supported_devices;
+ Bool (*PciProbe) (struct _DriverRec * drv, int entity_num,
+ struct pci_device * dev, intptr_t match_data);
} DriverRec, *DriverPtr;
/*
@@ -346,18 +350,18 @@ typedef enum {
BUS_NONE,
BUS_PCI,
BUS_SBUS,
- BUS_last /* Keep last */
+ BUS_last /* Keep last */
} BusType;
typedef struct {
- int fbNum;
+ int fbNum;
} SbusBusId;
typedef struct _bus {
BusType type;
union {
- struct pci_device *pci;
- SbusBusId sbus;
+ struct pci_device *pci;
+ SbusBusId sbus;
} id;
} BusRec, *BusPtr;
@@ -371,73 +375,73 @@ typedef enum {
} DacSpeedIndex;
typedef struct {
- char * identifier;
- char * vendor;
- char * board;
- char * chipset;
- char * ramdac;
- char * driver;
- struct _confscreenrec * myScreenSection;
- Bool claimed;
- int dacSpeeds[MAXDACSPEEDS];
- int numclocks;
- int clock[MAXCLOCKS];
- char * clockchip;
- char * busID;
- Bool active;
- Bool inUse;
- int videoRam;
- int textClockFreq;
- unsigned long BiosBase; /* Base address of video BIOS */
- unsigned long MemBase; /* Frame buffer base address */
- unsigned long IOBase;
- int chipID;
- int chipRev;
- pointer options;
- int irq;
- int screen; /* For multi-CRTC cards */
+ char *identifier;
+ char *vendor;
+ char *board;
+ char *chipset;
+ char *ramdac;
+ char *driver;
+ struct _confscreenrec *myScreenSection;
+ Bool claimed;
+ int dacSpeeds[MAXDACSPEEDS];
+ int numclocks;
+ int clock[MAXCLOCKS];
+ char *clockchip;
+ char *busID;
+ Bool active;
+ Bool inUse;
+ int videoRam;
+ int textClockFreq;
+ unsigned long BiosBase; /* Base address of video BIOS */
+ unsigned long MemBase; /* Frame buffer base address */
+ unsigned long IOBase;
+ int chipID;
+ int chipRev;
+ pointer options;
+ int irq;
+ int screen; /* For multi-CRTC cards */
} GDevRec, *GDevPtr;
typedef struct {
- int frameX0;
- int frameY0;
- int virtualX;
- int virtualY;
- int depth;
- int fbbpp;
- rgb weight;
- rgb blackColour;
- rgb whiteColour;
- int defaultVisual;
- char ** modes;
- pointer options;
+ int frameX0;
+ int frameY0;
+ int virtualX;
+ int virtualY;
+ int depth;
+ int fbbpp;
+ rgb weight;
+ rgb blackColour;
+ rgb whiteColour;
+ int defaultVisual;
+ char **modes;
+ pointer options;
} DispRec, *DispPtr;
typedef struct _confxvportrec {
- char * identifier;
- pointer options;
+ char *identifier;
+ pointer options;
} confXvPortRec, *confXvPortPtr;
typedef struct _confxvadaptrec {
- char * identifier;
- int numports;
- confXvPortPtr ports;
- pointer options;
+ char *identifier;
+ int numports;
+ confXvPortPtr ports;
+ pointer options;
} confXvAdaptorRec, *confXvAdaptorPtr;
typedef struct _confscreenrec {
- char * id;
- int screennum;
- int defaultdepth;
- int defaultbpp;
- int defaultfbbpp;
- MonPtr monitor;
- GDevPtr device;
- int numdisplays;
- DispPtr displays;
- int numxvadaptors;
- confXvAdaptorPtr xvadaptors;
- pointer options;
+ char *id;
+ int screennum;
+ int defaultdepth;
+ int defaultbpp;
+ int defaultfbbpp;
+ MonPtr monitor;
+ GDevPtr device;
+ int numdisplays;
+ DispPtr displays;
+ int numxvadaptors;
+ confXvAdaptorPtr xvadaptors;
+ pointer options;
} confScreenRec, *confScreenPtr;
typedef enum {
@@ -451,45 +455,45 @@ typedef enum {
} PositionType;
typedef struct _screenlayoutrec {
- confScreenPtr screen;
- char * topname;
- confScreenPtr top;
- char * bottomname;
- confScreenPtr bottom;
- char * leftname;
- confScreenPtr left;
- char * rightname;
- confScreenPtr right;
- PositionType where;
- int x;
- int y;
- char * refname;
- confScreenPtr refscreen;
+ confScreenPtr screen;
+ char *topname;
+ confScreenPtr top;
+ char *bottomname;
+ confScreenPtr bottom;
+ char *leftname;
+ confScreenPtr left;
+ char *rightname;
+ confScreenPtr right;
+ PositionType where;
+ int x;
+ int y;
+ char *refname;
+ confScreenPtr refscreen;
} screenLayoutRec, *screenLayoutPtr;
typedef struct _InputInfoRec InputInfoRec;
typedef struct _serverlayoutrec {
- char * id;
- screenLayoutPtr screens;
- GDevPtr inactives;
- InputInfoRec** inputs; /* NULL terminated */
- pointer options;
+ char *id;
+ screenLayoutPtr screens;
+ GDevPtr inactives;
+ InputInfoRec **inputs; /* NULL terminated */
+ pointer options;
} serverLayoutRec, *serverLayoutPtr;
typedef struct _confdribufferrec {
- int count;
- int size;
+ int count;
+ int size;
enum {
- XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
- } flags;
+ XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
+ } flags;
} confDRIBufferRec, *confDRIBufferPtr;
typedef struct _confdrirec {
- int group;
- int mode;
- int bufs_count;
- confDRIBufferRec *bufs;
+ int group;
+ int mode;
+ int bufs_count;
+ confDRIBufferRec *bufs;
} confDRIRec, *confDRIPtr;
/* These values should be adjusted when new fields are added to ScrnInfoRec */
@@ -497,7 +501,7 @@ typedef struct _confdrirec {
#define NUM_RESERVED_POINTERS 14
#define NUM_RESERVED_FUNCS 10
-typedef pointer (*funcPointer)(void);
+typedef pointer (*funcPointer) (void);
/* flags for depth 24 pixmap options */
typedef enum {
@@ -565,9 +569,8 @@ typedef struct _PciChipsets {
void *dummy;
} PciChipsets;
-
/* Entity properties */
-typedef void (*EntityProc)(int entityIndex,pointer private);
+typedef void (*EntityProc) (int entityIndex, pointer private);
typedef struct _entityInfo {
int index;
@@ -581,37 +584,37 @@ typedef struct _entityInfo {
/* DGA */
typedef struct {
- int num; /* A unique identifier for the mode (num > 0) */
- DisplayModePtr mode;
- int flags; /* DGA_CONCURRENT_ACCESS, etc... */
- int imageWidth; /* linear accessible portion (pixels) */
- int imageHeight;
- int pixmapWidth; /* Xlib accessible portion (pixels) */
- int pixmapHeight; /* both fields ignored if no concurrent access */
- int bytesPerScanline;
- int byteOrder; /* MSBFirst, LSBFirst */
- int depth;
- int bitsPerPixel;
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
- short visualClass;
- int viewportWidth;
- int viewportHeight;
- int xViewportStep; /* viewport position granularity */
- int yViewportStep;
- int maxViewportX; /* max viewport origin */
- int maxViewportY;
- int viewportFlags; /* types of page flipping possible */
- int offset; /* offset into physical memory */
- unsigned char *address; /* server's mapped framebuffer */
- int reserved1;
- int reserved2;
+ int num; /* A unique identifier for the mode (num > 0) */
+ DisplayModePtr mode;
+ int flags; /* DGA_CONCURRENT_ACCESS, etc... */
+ int imageWidth; /* linear accessible portion (pixels) */
+ int imageHeight;
+ int pixmapWidth; /* Xlib accessible portion (pixels) */
+ int pixmapHeight; /* both fields ignored if no concurrent access */
+ int bytesPerScanline;
+ int byteOrder; /* MSBFirst, LSBFirst */
+ int depth;
+ int bitsPerPixel;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ short visualClass;
+ int viewportWidth;
+ int viewportHeight;
+ int xViewportStep; /* viewport position granularity */
+ int yViewportStep;
+ int maxViewportX; /* max viewport origin */
+ int maxViewportY;
+ int viewportFlags; /* types of page flipping possible */
+ int offset; /* offset into physical memory */
+ unsigned char *address; /* server's mapped framebuffer */
+ int reserved1;
+ int reserved2;
} DGAModeRec, *DGAModePtr;
typedef struct {
- DGAModePtr mode;
- PixmapPtr pPix;
+ DGAModePtr mode;
+ PixmapPtr pPix;
} DGADeviceRec, *DGADevicePtr;
/*
@@ -625,25 +628,24 @@ typedef struct {
* Driver entry point types
*/
-typedef Bool xf86ProbeProc (DriverPtr, int);
-typedef Bool xf86PreInitProc (ScrnInfoPtr, int);
-typedef Bool xf86ScreenInitProc (int, ScreenPtr, int, char**);
-typedef Bool xf86SwitchModeProc (int, DisplayModePtr, int);
-typedef void xf86AdjustFrameProc (int, int, int, int);
-typedef Bool xf86EnterVTProc (int, int);
-typedef void xf86LeaveVTProc (int, int);
-typedef void xf86FreeScreenProc (int, int);
-typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int);
+typedef Bool xf86ProbeProc(DriverPtr, int);
+typedef Bool xf86PreInitProc(ScrnInfoPtr, int);
+typedef Bool xf86ScreenInitProc(int, ScreenPtr, int, char **);
+typedef Bool xf86SwitchModeProc(int, DisplayModePtr, int);
+typedef void xf86AdjustFrameProc(int, int, int, int);
+typedef Bool xf86EnterVTProc(int, int);
+typedef void xf86LeaveVTProc(int, int);
+typedef void xf86FreeScreenProc(int, int);
+typedef ModeStatus xf86ValidModeProc(int, DisplayModePtr, Bool, int);
typedef void xf86EnableDisableFBAccessProc(int, Bool);
-typedef int xf86SetDGAModeProc (int, int, DGADevicePtr);
-typedef int xf86ChangeGammaProc (int, Gamma);
-typedef void xf86PointerMovedProc (int, int, int);
-typedef Bool xf86PMEventProc (int, pmEvent, Bool);
-typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int);
-typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
-typedef void xf86SetOverscanProc (ScrnInfoPtr, int);
-typedef void xf86ModeSetProc (ScrnInfoPtr);
-
+typedef int xf86SetDGAModeProc(int, int, DGADevicePtr);
+typedef int xf86ChangeGammaProc(int, Gamma);
+typedef void xf86PointerMovedProc(int, int, int);
+typedef Bool xf86PMEventProc(int, pmEvent, Bool);
+typedef void xf86DPMSSetProc(ScrnInfoPtr, int, int);
+typedef void xf86LoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
+typedef void xf86SetOverscanProc(ScrnInfoPtr, int);
+typedef void xf86ModeSetProc(ScrnInfoPtr);
/*
* ScrnInfoRec
@@ -656,217 +658,200 @@ typedef void xf86ModeSetProc (ScrnInfoPtr);
* are to be dependent on compile-time defines.
*/
-
typedef struct _ScrnInfoRec {
- int driverVersion;
- char * driverName; /* canonical name used in */
- /* the config file */
- ScreenPtr pScreen; /* Pointer to the ScreenRec */
- int scrnIndex; /* Number of this screen */
- Bool configured; /* Is this screen valid */
- int origIndex; /* initial number assigned to
- * this screen before
- * finalising the number of
- * available screens */
+ int driverVersion;
+ char *driverName; /* canonical name used in */
+ /* the config file */
+ ScreenPtr pScreen; /* Pointer to the ScreenRec */
+ int scrnIndex; /* Number of this screen */
+ Bool configured; /* Is this screen valid */
+ int origIndex; /* initial number assigned to
+ * this screen before
+ * finalising the number of
+ * available screens */
/* Display-wide screenInfo values needed by this screen */
- int imageByteOrder;
- int bitmapScanlineUnit;
- int bitmapScanlinePad;
- int bitmapBitOrder;
- int numFormats;
- PixmapFormatRec formats[MAXFORMATS];
- PixmapFormatRec fbFormat;
-
- int bitsPerPixel; /* fb bpp */
- Pix24Flags pixmap24; /* pixmap pref for depth 24 */
- int depth; /* depth of default visual */
- MessageType depthFrom; /* set from config? */
- MessageType bitsPerPixelFrom; /* set from config? */
- rgb weight; /* r/g/b weights */
- rgb mask; /* rgb masks */
- rgb offset; /* rgb offsets */
- int rgbBits; /* Number of bits in r/g/b */
- Gamma gamma; /* Gamma of the monitor */
- int defaultVisual; /* default visual class */
- int maxHValue; /* max horizontal timing */
- int maxVValue; /* max vertical timing value */
- int virtualX; /* Virtual width */
- int virtualY; /* Virtual height */
- int xInc; /* Horizontal timing increment */
- MessageType virtualFrom; /* set from config? */
- int displayWidth; /* memory pitch */
- int frameX0; /* viewport position */
- int frameY0;
- int frameX1;
- int frameY1;
- int zoomLocked; /* Disallow mode changes */
- DisplayModePtr modePool; /* list of compatible modes */
- DisplayModePtr modes; /* list of actual modes */
- DisplayModePtr currentMode; /* current mode
- * This was previously
- * overloaded with the modes
- * field, which is a pointer
- * into a circular list */
- confScreenPtr confScreen; /* Screen config info */
- MonPtr monitor; /* Monitor information */
- DispPtr display; /* Display information */
- int * entityList; /* List of device entities */
- int numEntities;
- int widthmm; /* physical display dimensions
- * in mm */
- int heightmm;
- int xDpi; /* width DPI */
- int yDpi; /* height DPI */
- char * name; /* Name to prefix messages */
- pointer driverPrivate; /* Driver private area */
- DevUnion * privates; /* Other privates can hook in
- * here */
- DriverPtr drv; /* xf86DriverList[] entry */
- pointer module; /* Pointer to module head */
- int colorKey;
- int overlayFlags;
+ int imageByteOrder;
+ int bitmapScanlineUnit;
+ int bitmapScanlinePad;
+ int bitmapBitOrder;
+ int numFormats;
+ PixmapFormatRec formats[MAXFORMATS];
+ PixmapFormatRec fbFormat;
+
+ int bitsPerPixel; /* fb bpp */
+ Pix24Flags pixmap24; /* pixmap pref for depth 24 */
+ int depth; /* depth of default visual */
+ MessageType depthFrom; /* set from config? */
+ MessageType bitsPerPixelFrom; /* set from config? */
+ rgb weight; /* r/g/b weights */
+ rgb mask; /* rgb masks */
+ rgb offset; /* rgb offsets */
+ int rgbBits; /* Number of bits in r/g/b */
+ Gamma gamma; /* Gamma of the monitor */
+ int defaultVisual; /* default visual class */
+ int maxHValue; /* max horizontal timing */
+ int maxVValue; /* max vertical timing value */
+ int virtualX; /* Virtual width */
+ int virtualY; /* Virtual height */
+ int xInc; /* Horizontal timing increment */
+ MessageType virtualFrom; /* set from config? */
+ int displayWidth; /* memory pitch */
+ int frameX0; /* viewport position */
+ int frameY0;
+ int frameX1;
+ int frameY1;
+ int zoomLocked; /* Disallow mode changes */
+ DisplayModePtr modePool; /* list of compatible modes */
+ DisplayModePtr modes; /* list of actual modes */
+ DisplayModePtr currentMode; /* current mode
+ * This was previously
+ * overloaded with the modes
+ * field, which is a pointer
+ * into a circular list */
+ confScreenPtr confScreen; /* Screen config info */
+ MonPtr monitor; /* Monitor information */
+ DispPtr display; /* Display information */
+ int *entityList; /* List of device entities */
+ int numEntities;
+ int widthmm; /* physical display dimensions
+ * in mm */
+ int heightmm;
+ int xDpi; /* width DPI */
+ int yDpi; /* height DPI */
+ char *name; /* Name to prefix messages */
+ pointer driverPrivate; /* Driver private area */
+ DevUnion *privates; /* Other privates can hook in
+ * here */
+ DriverPtr drv; /* xf86DriverList[] entry */
+ pointer module; /* Pointer to module head */
+ int colorKey;
+ int overlayFlags;
/* Some of these may be moved out of here into the driver private area */
- char * chipset; /* chipset name */
- char * ramdac; /* ramdac name */
- char * clockchip; /* clock name */
- Bool progClock; /* clock is programmable */
- int numClocks; /* number of clocks */
- int clock[MAXCLOCKS]; /* list of clock frequencies */
- int videoRam; /* amount of video ram (kb) */
- unsigned long biosBase; /* Base address of video BIOS */
- unsigned long memPhysBase; /* Physical address of FB */
- unsigned long fbOffset; /* Offset of FB in the above */
- int memClk; /* memory clock */
- int textClockFreq; /* clock of text mode */
- Bool flipPixels; /* swap default black/white */
- pointer options;
-
- int chipID;
- int chipRev;
+ char *chipset; /* chipset name */
+ char *ramdac; /* ramdac name */
+ char *clockchip; /* clock name */
+ Bool progClock; /* clock is programmable */
+ int numClocks; /* number of clocks */
+ int clock[MAXCLOCKS]; /* list of clock frequencies */
+ int videoRam; /* amount of video ram (kb) */
+ unsigned long biosBase; /* Base address of video BIOS */
+ unsigned long memPhysBase; /* Physical address of FB */
+ unsigned long fbOffset; /* Offset of FB in the above */
+ int memClk; /* memory clock */
+ int textClockFreq; /* clock of text mode */
+ Bool flipPixels; /* swap default black/white */
+ pointer options;
+
+ int chipID;
+ int chipRev;
/* Allow screens to be enabled/disabled individually */
- Bool vtSema;
+ Bool vtSema;
/* hw cursor moves at SIGIO time */
- Bool silkenMouse;
+ Bool silkenMouse;
/* Storage for clockRanges and adjustFlags for use with the VidMode ext */
- ClockRangePtr clockRanges;
- int adjustFlags;
+ ClockRangePtr clockRanges;
+ int adjustFlags;
/*
* These can be used when the minor ABI version is incremented.
* The NUM_* parameters must be reduced appropriately to keep the
* structure size and alignment unchanged.
*/
- int reservedInt[NUM_RESERVED_INTS];
+ int reservedInt[NUM_RESERVED_INTS];
- int * entityInstanceList;
- struct pci_device *vgaDev;
+ int *entityInstanceList;
+ struct pci_device *vgaDev;
- pointer reservedPtr[NUM_RESERVED_POINTERS];
+ pointer reservedPtr[NUM_RESERVED_POINTERS];
/*
* Driver entry points.
*
*/
- xf86ProbeProc *Probe;
- xf86PreInitProc *PreInit;
- xf86ScreenInitProc *ScreenInit;
- xf86SwitchModeProc *SwitchMode;
- xf86AdjustFrameProc *AdjustFrame;
- xf86EnterVTProc *EnterVT;
- xf86LeaveVTProc *LeaveVT;
- xf86FreeScreenProc *FreeScreen;
- xf86ValidModeProc *ValidMode;
- xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
- xf86SetDGAModeProc *SetDGAMode;
- xf86ChangeGammaProc *ChangeGamma;
- xf86PointerMovedProc *PointerMoved;
- xf86PMEventProc *PMEvent;
- xf86DPMSSetProc *DPMSSet;
- xf86LoadPaletteProc *LoadPalette;
- xf86SetOverscanProc *SetOverscan;
- xorgDriverFuncProc *DriverFunc;
- xf86ModeSetProc *ModeSet;
+ xf86ProbeProc *Probe;
+ xf86PreInitProc *PreInit;
+ xf86ScreenInitProc *ScreenInit;
+ xf86SwitchModeProc *SwitchMode;
+ xf86AdjustFrameProc *AdjustFrame;
+ xf86EnterVTProc *EnterVT;
+ xf86LeaveVTProc *LeaveVT;
+ xf86FreeScreenProc *FreeScreen;
+ xf86ValidModeProc *ValidMode;
+ xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
+ xf86SetDGAModeProc *SetDGAMode;
+ xf86ChangeGammaProc *ChangeGamma;
+ xf86PointerMovedProc *PointerMoved;
+ xf86PMEventProc *PMEvent;
+ xf86DPMSSetProc *DPMSSet;
+ xf86LoadPaletteProc *LoadPalette;
+ xf86SetOverscanProc *SetOverscan;
+ xorgDriverFuncProc *DriverFunc;
+ xf86ModeSetProc *ModeSet;
/*
* This can be used when the minor ABI version is incremented.
* The NUM_* parameter must be reduced appropriately to keep the
* structure size and alignment unchanged.
*/
- funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
+ funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
} ScrnInfoRec;
-
typedef struct {
- Bool (*OpenFramebuffer)(
- ScrnInfoPtr pScrn,
- char **name,
- unsigned char **mem,
- int *size,
- int *offset,
- int *extra
- );
- void (*CloseFramebuffer)(ScrnInfoPtr pScrn);
- Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode);
- void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags);
- int (*GetViewport)(ScrnInfoPtr pScrn);
- void (*Sync)(ScrnInfoPtr);
- void (*FillRect)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned long color
- );
- void (*BlitRect)(
- ScrnInfoPtr pScrn,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty
- );
- void (*BlitTransRect)(
- ScrnInfoPtr pScrn,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty,
- unsigned long color
- );
+ Bool (*OpenFramebuffer) (ScrnInfoPtr pScrn,
+ char **name,
+ unsigned char **mem,
+ int *size, int *offset, int *extra);
+ void (*CloseFramebuffer) (ScrnInfoPtr pScrn);
+ Bool (*SetMode) (ScrnInfoPtr pScrn, DGAModePtr pMode);
+ void (*SetViewport) (ScrnInfoPtr pScrn, int x, int y, int flags);
+ int (*GetViewport) (ScrnInfoPtr pScrn);
+ void (*Sync) (ScrnInfoPtr);
+ void (*FillRect) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, unsigned long color);
+ void (*BlitRect) (ScrnInfoPtr pScrn,
+ int srcx, int srcy, int w, int h, int dstx, int dsty);
+ void (*BlitTransRect) (ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty, unsigned long color);
} DGAFunctionRec, *DGAFunctionPtr;
typedef struct _SymTabRec {
- int token; /* id of the token */
- const char * name; /* token name */
+ int token; /* id of the token */
+ const char *name; /* token name */
} SymTabRec, *SymTabPtr;
/* flags for xf86LookupMode */
typedef enum {
- LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
- LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
- LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
- LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
- LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */
- LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
+ LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
+ LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
+ LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
+ LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
+ LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */
+ LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
} LookupModeFlags;
#define NoDepth24Support 0x00
-#define Support24bppFb 0x01 /* 24bpp framebuffer supported */
-#define Support32bppFb 0x02 /* 32bpp framebuffer supported */
-#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
-#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
-#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
-#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
-
+#define Support24bppFb 0x01 /* 24bpp framebuffer supported */
+#define Support32bppFb 0x02 /* 32bpp framebuffer supported */
+#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
+#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
+#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
+#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
/* For DPMS */
-typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int);
+typedef void (*DPMSSetProcPtr) (ScrnInfoPtr, int, int);
/* Input handler proc */
-typedef void (*InputHandlerProc)(int fd, pointer data);
+typedef void (*InputHandlerProc) (int fd, pointer data);
/* These are used by xf86GetClocks */
#define CLK_REG_SAVE -1
@@ -876,9 +861,8 @@ typedef void (*InputHandlerProc)(int fd, pointer data);
* misc constants
*/
#define INTERLACE_REFRESH_WEIGHT 1.5
-#define SYNC_TOLERANCE 0.01 /* 1 percent */
-#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
-
+#define SYNC_TOLERANCE 0.01 /* 1 percent */
+#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
#define OVERLAY_8_32_DUALFB 0x00000001
#define OVERLAY_8_24_DUALFB 0x00000002
@@ -891,12 +875,12 @@ typedef void (*InputHandlerProc)(int fd, pointer data);
/* Action Events */
typedef enum {
- ACTION_TERMINATE = 0, /* Terminate Server */
- ACTION_NEXT_MODE = 10, /* Switch to next video mode */
+ ACTION_TERMINATE = 0, /* Terminate Server */
+ ACTION_NEXT_MODE = 10, /* Switch to next video mode */
ACTION_PREV_MODE,
- ACTION_SWITCHSCREEN = 100, /* VT switch */
+ ACTION_SWITCHSCREEN = 100, /* VT switch */
ACTION_SWITCHSCREEN_NEXT,
ACTION_SWITCHSCREEN_PREV,
} ActionEvent;
-#endif /* _XF86STR_H */
+#endif /* _XF86STR_H */
diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c
index b46dfefed..88e2f314b 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.c
+++ b/xorg-server/hw/xfree86/common/xf86xv.c
@@ -28,7 +28,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@@ -56,7 +55,6 @@
#include "xf86xvpriv.h"
-
/* XvScreenRec fields */
static Bool xf86XVCloseScreen(int, ScreenPtr);
@@ -64,40 +62,39 @@ static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
/* XvAdaptorRec fields */
-static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*);
+static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr *);
static int xf86XVFreePort(XvPortPtr);
-static int xf86XVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int xf86XVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int xf86XVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
-static int xf86XVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16);
+static int xf86XVPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
static int xf86XVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
static int xf86XVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
-static int xf86XVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*);
+static int xf86XVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
static int xf86XVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
- CARD16, CARD16,CARD16, CARD16,
- unsigned int*, unsigned int*);
+ CARD16, CARD16, CARD16, CARD16,
+ unsigned int *, unsigned int *);
static int xf86XVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
- INT16, INT16, CARD16, CARD16,
- XvImagePtr, unsigned char*, Bool,
- CARD16, CARD16);
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
+ XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
- CARD16*, CARD16*, int*, int*);
-
+ CARD16 *, CARD16 *, int *, int *);
/* ScreenRec fields */
static Bool xf86XVDestroyWindow(WindowPtr pWin);
static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
-static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind);
+static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin,
+ VTKind kind);
static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
#define PostValidateTreeUndefined ((PostValidateTreeProcPtr)-1)
@@ -111,19 +108,19 @@ static void xf86XVModeSet(ScrnInfoPtr pScrn);
/* misc */
-static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int);
-
+static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr *, int);
static DevPrivateKeyRec XF86XVWindowKeyRec;
+
#define XF86XVWindowKey (&XF86XVWindowKeyRec)
DevPrivateKey XF86XvScreenKey;
static unsigned long PortResource = 0;
-DevPrivateKey (*XvGetScreenKeyProc)(void) = NULL;
-unsigned long (*XvGetRTPortProc)(void) = NULL;
-int (*XvScreenInitProc)(ScreenPtr) = NULL;
+DevPrivateKey (*XvGetScreenKeyProc) (void) = NULL;
+unsigned long (*XvGetRTPortProc) (void) = NULL;
+int (*XvScreenInitProc) (ScreenPtr) = NULL;
#define GET_XV_SCREEN(pScreen) \
((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey))
@@ -138,29 +135,26 @@ static xf86XVInitGenericAdaptorPtr *GenDrivers = NULL;
static int NumGenDrivers = 0;
int
-xf86XVRegisterGenericAdaptorDriver(
- xf86XVInitGenericAdaptorPtr InitFunc
-){
- xf86XVInitGenericAdaptorPtr *newdrivers;
+xf86XVRegisterGenericAdaptorDriver(xf86XVInitGenericAdaptorPtr InitFunc)
+{
+ xf86XVInitGenericAdaptorPtr *newdrivers;
- newdrivers = realloc(GenDrivers, sizeof(xf86XVInitGenericAdaptorPtr) *
- (1 + NumGenDrivers));
- if (!newdrivers)
- return 0;
- GenDrivers = newdrivers;
+ newdrivers = realloc(GenDrivers, sizeof(xf86XVInitGenericAdaptorPtr) *
+ (1 + NumGenDrivers));
+ if (!newdrivers)
+ return 0;
+ GenDrivers = newdrivers;
- GenDrivers[NumGenDrivers++] = InitFunc;
+ GenDrivers[NumGenDrivers++] = InitFunc;
- return 1;
+ return 1;
}
int
-xf86XVListGenericAdaptors(
- ScrnInfoPtr pScrn,
- XF86VideoAdaptorPtr **adaptors
-){
- int i,j,n,num;
- XF86VideoAdaptorPtr *DrivAdap,*new;
+xf86XVListGenericAdaptors(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr ** adaptors)
+{
+ int i, j, n, num;
+ XF86VideoAdaptorPtr *DrivAdap, *new;
num = 0;
*adaptors = NULL;
@@ -168,48 +162,49 @@ xf86XVListGenericAdaptors(
* The v4l driver registers itself first, but can use surfaces registered
* by other drivers. So, call the v4l driver last.
*/
- for (i = NumGenDrivers; --i >= 0; ) {
- DrivAdap = NULL;
- n = (*GenDrivers[i])(pScrn, &DrivAdap);
- if (0 == n)
- continue;
- new = realloc(*adaptors, sizeof(XF86VideoAdaptorPtr) * (num+n));
- if (NULL == new)
- continue;
- *adaptors = new;
- for (j = 0; j < n; j++, num++)
- (*adaptors)[num] = DrivAdap[j];
+ for (i = NumGenDrivers; --i >= 0;) {
+ DrivAdap = NULL;
+ n = (*GenDrivers[i]) (pScrn, &DrivAdap);
+ if (0 == n)
+ continue;
+ new = realloc(*adaptors, sizeof(XF86VideoAdaptorPtr) * (num + n));
+ if (NULL == new)
+ continue;
+ *adaptors = new;
+ for (j = 0; j < n; j++, num++)
+ (*adaptors)[num] = DrivAdap[j];
}
return num;
}
-
/**************** Offscreen surface stuff *******************/
typedef struct {
- XF86OffscreenImagePtr images;
- int num;
+ XF86OffscreenImagePtr images;
+ int num;
} OffscreenImageRec;
static DevPrivateKeyRec OffscreenPrivateKeyRec;
+
#define OffscreenPrivateKey (&OffscreenPrivateKeyRec)
#define GetOffscreenImage(pScreen) ((OffscreenImageRec *) dixLookupPrivate(&(pScreen)->devPrivates, OffscreenPrivateKey))
Bool
-xf86XVRegisterOffscreenImages(
- ScreenPtr pScreen,
- XF86OffscreenImagePtr images,
- int num
-){
+xf86XVRegisterOffscreenImages(ScreenPtr pScreen,
+ XF86OffscreenImagePtr images, int num)
+{
OffscreenImageRec *OffscreenImage;
+
/* This function may be called before xf86XVScreenInit, so there's
* no better place than this to call dixRegisterPrivateKey to ensure we
* have space reserved. After the first call it is a no-op. */
- if(!dixRegisterPrivateKey(OffscreenPrivateKey, PRIVATE_SCREEN, sizeof(OffscreenImageRec)) ||
- !(OffscreenImage = GetOffscreenImage(pScreen)))
+ if (!dixRegisterPrivateKey
+ (OffscreenPrivateKey, PRIVATE_SCREEN, sizeof(OffscreenImageRec)) ||
+ !(OffscreenImage = GetOffscreenImage(pScreen)))
/* Every X.org driver assumes this function always succeeds, so
* just die on allocation failure. */
- FatalError("Could not allocate private storage for XV offscreen images.\n");
+ FatalError
+ ("Could not allocate private storage for XV offscreen images.\n");
OffscreenImage->num = num;
OffscreenImage->images = images;
@@ -217,16 +212,14 @@ xf86XVRegisterOffscreenImages(
}
XF86OffscreenImagePtr
-xf86XVQueryOffscreenImages(
- ScreenPtr pScreen,
- int *num
-){
+xf86XVQueryOffscreenImages(ScreenPtr pScreen, int *num)
+{
OffscreenImageRec *OffscreenImage = GetOffscreenImage(pScreen);
+
*num = OffscreenImage->num;
return OffscreenImage->images;
}
-
XF86VideoAdaptorPtr
xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn)
{
@@ -239,396 +232,388 @@ xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr)
free(ptr);
}
-
Bool
-xf86XVScreenInit(
- ScreenPtr pScreen,
- XF86VideoAdaptorPtr *adaptors,
- int num
-){
- ScrnInfoPtr pScrn;
- XF86XVScreenPtr ScreenPriv;
- XvScreenPtr pxvs;
+xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
+{
+ ScrnInfoPtr pScrn;
+ XF86XVScreenPtr ScreenPriv;
+ XvScreenPtr pxvs;
- if(num <= 0 ||
- !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
- return FALSE;
+ if (num <= 0 ||
+ !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
+ return FALSE;
- if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
+ if (Success != (*XvScreenInitProc) (pScreen))
+ return FALSE;
- if (!dixRegisterPrivateKey(&XF86XVWindowKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ if (!dixRegisterPrivateKey(&XF86XVWindowKeyRec, PRIVATE_WINDOW, 0))
+ return FALSE;
- XF86XvScreenKey = (*XvGetScreenKeyProc)();
+ XF86XvScreenKey = (*XvGetScreenKeyProc) ();
- PortResource = (*XvGetRTPortProc)();
+ PortResource = (*XvGetRTPortProc) ();
- pxvs = GET_XV_SCREEN(pScreen);
+ pxvs = GET_XV_SCREEN(pScreen);
- /* Anyone initializing the Xv layer must provide these two.
- The Xv di layer calls them without even checking if they exist! */
+ /* Anyone initializing the Xv layer must provide these two.
+ The Xv di layer calls them without even checking if they exist! */
- pxvs->ddCloseScreen = xf86XVCloseScreen;
- pxvs->ddQueryAdaptors = xf86XVQueryAdaptors;
+ pxvs->ddCloseScreen = xf86XVCloseScreen;
+ pxvs->ddQueryAdaptors = xf86XVQueryAdaptors;
- /* The Xv di layer provides us with a private hook so that we don't
- have to allocate our own screen private. They also provide
- a CloseScreen hook so that we don't have to wrap it. I'm not
- sure that I appreciate that. */
+ /* The Xv di layer provides us with a private hook so that we don't
+ have to allocate our own screen private. They also provide
+ a CloseScreen hook so that we don't have to wrap it. I'm not
+ sure that I appreciate that. */
- ScreenPriv = malloc(sizeof(XF86XVScreenRec));
- pxvs->devPriv.ptr = (pointer)ScreenPriv;
+ ScreenPriv = malloc(sizeof(XF86XVScreenRec));
+ pxvs->devPriv.ptr = (pointer) ScreenPriv;
- if(!ScreenPriv) return FALSE;
+ if (!ScreenPriv)
+ return FALSE;
- pScrn = xf86Screens[pScreen->myNum];
+ pScrn = xf86Screens[pScreen->myNum];
- ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
- ScreenPriv->WindowExposures = pScreen->WindowExposures;
- ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
- ScreenPriv->ClipNotify = pScreen->ClipNotify;
- ScreenPriv->EnterVT = pScrn->EnterVT;
- ScreenPriv->LeaveVT = pScrn->LeaveVT;
- ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
- ScreenPriv->ModeSet = pScrn->ModeSet;
+ ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
+ ScreenPriv->WindowExposures = pScreen->WindowExposures;
+ ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
+ ScreenPriv->ClipNotify = pScreen->ClipNotify;
+ ScreenPriv->EnterVT = pScrn->EnterVT;
+ ScreenPriv->LeaveVT = pScrn->LeaveVT;
+ ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
+ ScreenPriv->ModeSet = pScrn->ModeSet;
- pScreen->DestroyWindow = xf86XVDestroyWindow;
- pScreen->WindowExposures = xf86XVWindowExposures;
- pScreen->ClipNotify = xf86XVClipNotify;
- pScrn->EnterVT = xf86XVEnterVT;
- pScrn->LeaveVT = xf86XVLeaveVT;
- if(pScrn->AdjustFrame)
- pScrn->AdjustFrame = xf86XVAdjustFrame;
- pScrn->ModeSet = xf86XVModeSet;
+ pScreen->DestroyWindow = xf86XVDestroyWindow;
+ pScreen->WindowExposures = xf86XVWindowExposures;
+ pScreen->ClipNotify = xf86XVClipNotify;
+ pScrn->EnterVT = xf86XVEnterVT;
+ pScrn->LeaveVT = xf86XVLeaveVT;
+ if (pScrn->AdjustFrame)
+ pScrn->AdjustFrame = xf86XVAdjustFrame;
+ pScrn->ModeSet = xf86XVModeSet;
- if(!xf86XVInitAdaptors(pScreen, adaptors, num))
- return FALSE;
+ if (!xf86XVInitAdaptors(pScreen, adaptors, num))
+ return FALSE;
- return TRUE;
+ return TRUE;
}
static void
xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor)
{
- int i;
-
- free(pAdaptor->name);
- pAdaptor->name = NULL;
-
- if(pAdaptor->pEncodings) {
- XvEncodingPtr pEncode = pAdaptor->pEncodings;
-
- for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++)
- free(pEncode->name);
- free(pAdaptor->pEncodings);
- pAdaptor->pEncodings = NULL;
- }
-
- free(pAdaptor->pFormats);
- pAdaptor->pFormats = NULL;
-
- if(pAdaptor->pPorts) {
- XvPortPtr pPort = pAdaptor->pPorts;
- XvPortRecPrivatePtr pPriv;
-
- for(i = 0; i < pAdaptor->nPorts; i++, pPort++) {
- pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
- if(pPriv) {
- if(pPriv->clientClip)
- RegionDestroy(pPriv->clientClip);
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- RegionDestroy(pPriv->pCompositeClip);
- if (pPriv->ckeyFilled)
- RegionDestroy(pPriv->ckeyFilled);
- free(pPriv);
- }
- }
- free(pAdaptor->pPorts);
- pAdaptor->pPorts = NULL;
- }
-
- if(pAdaptor->pAttributes) {
- XvAttributePtr pAttribute = pAdaptor->pAttributes;
-
- for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++)
- free(pAttribute->name);
- free(pAdaptor->pAttributes);
- pAdaptor->pAttributes = NULL;
- }
-
- free(pAdaptor->pImages);
- free(pAdaptor->devPriv.ptr);
- pAdaptor->pImages = NULL;
- pAdaptor->devPriv.ptr = NULL;
+ int i;
+
+ free(pAdaptor->name);
+ pAdaptor->name = NULL;
+
+ if (pAdaptor->pEncodings) {
+ XvEncodingPtr pEncode = pAdaptor->pEncodings;
+
+ for (i = 0; i < pAdaptor->nEncodings; i++, pEncode++)
+ free(pEncode->name);
+ free(pAdaptor->pEncodings);
+ pAdaptor->pEncodings = NULL;
+ }
+
+ free(pAdaptor->pFormats);
+ pAdaptor->pFormats = NULL;
+
+ if (pAdaptor->pPorts) {
+ XvPortPtr pPort = pAdaptor->pPorts;
+ XvPortRecPrivatePtr pPriv;
+
+ for (i = 0; i < pAdaptor->nPorts; i++, pPort++) {
+ pPriv = (XvPortRecPrivatePtr) pPort->devPriv.ptr;
+ if (pPriv) {
+ if (pPriv->clientClip)
+ RegionDestroy(pPriv->clientClip);
+ if (pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ RegionDestroy(pPriv->pCompositeClip);
+ if (pPriv->ckeyFilled)
+ RegionDestroy(pPriv->ckeyFilled);
+ free(pPriv);
+ }
+ }
+ free(pAdaptor->pPorts);
+ pAdaptor->pPorts = NULL;
+ }
+
+ if (pAdaptor->pAttributes) {
+ XvAttributePtr pAttribute = pAdaptor->pAttributes;
+
+ for (i = 0; i < pAdaptor->nAttributes; i++, pAttribute++)
+ free(pAttribute->name);
+ free(pAdaptor->pAttributes);
+ pAdaptor->pAttributes = NULL;
+ }
+
+ free(pAdaptor->pImages);
+ free(pAdaptor->devPriv.ptr);
+ pAdaptor->pImages = NULL;
+ pAdaptor->devPriv.ptr = NULL;
}
static Bool
-xf86XVInitAdaptors(
- ScreenPtr pScreen,
- XF86VideoAdaptorPtr *infoPtr,
- int number
-) {
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XF86VideoAdaptorPtr adaptorPtr;
- XvAdaptorPtr pAdaptor, pa;
- XvAdaptorRecPrivatePtr adaptorPriv;
- int na, numAdaptor;
- XvPortRecPrivatePtr portPriv;
- XvPortPtr pPort, pp;
- int numPort;
- XF86AttributePtr attributePtr;
- XvAttributePtr pAttribute, pat;
- XF86VideoFormatPtr formatPtr;
- XvFormatPtr pFormat, pf;
- int numFormat, totFormat;
- XF86VideoEncodingPtr encodingPtr;
- XvEncodingPtr pEncode, pe;
- XF86ImagePtr imagePtr;
- XvImagePtr pImage, pi;
- int numVisuals;
- VisualPtr pVisual;
- int i;
-
- pxvs->nAdaptors = 0;
- pxvs->pAdaptors = NULL;
-
- if(!(pAdaptor = calloc(number, sizeof(XvAdaptorRec))))
- return FALSE;
-
- for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
- adaptorPtr = infoPtr[na];
-
- if(!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
- !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
- continue;
-
- /* client libs expect at least one encoding */
- if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
- continue;
-
- pa->type = adaptorPtr->type;
-
- if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
- pa->type &= ~XvVideoMask;
-
- if(!adaptorPtr->PutStill && !adaptorPtr->GetStill)
- pa->type &= ~XvStillMask;
-
- if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
- pa->type &= ~XvImageMask;
-
- if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
- !adaptorPtr->PutStill)
- pa->type &= ~XvInputMask;
-
- if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
- pa->type &= ~XvOutputMask;
-
- if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
- continue;
- if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
- continue;
-
- pa->pScreen = pScreen;
- pa->ddAllocatePort = xf86XVAllocatePort;
- pa->ddFreePort = xf86XVFreePort;
- pa->ddPutVideo = xf86XVPutVideo;
- pa->ddPutStill = xf86XVPutStill;
- pa->ddGetVideo = xf86XVGetVideo;
- pa->ddGetStill = xf86XVGetStill;
- pa->ddStopVideo = xf86XVStopVideo;
- pa->ddPutImage = xf86XVPutImage;
- pa->ddSetPortAttribute = xf86XVSetPortAttribute;
- pa->ddGetPortAttribute = xf86XVGetPortAttribute;
- pa->ddQueryBestSize = xf86XVQueryBestSize;
- pa->ddQueryImageAttributes = xf86XVQueryImageAttributes;
- pa->name = strdup(adaptorPtr->name);
-
- if(adaptorPtr->nEncodings &&
- (pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
-
- for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
- i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
- {
- pe->id = encodingPtr->id;
- pe->pScreen = pScreen;
- pe->name = strdup(encodingPtr->name);
- pe->width = encodingPtr->width;
- pe->height = encodingPtr->height;
- pe->rate.numerator = encodingPtr->rate.numerator;
- pe->rate.denominator = encodingPtr->rate.denominator;
- }
- pa->nEncodings = adaptorPtr->nEncodings;
- pa->pEncodings = pEncode;
- }
-
- if(adaptorPtr->nImages &&
- (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
-
- for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
- i < adaptorPtr->nImages; i++, pi++, imagePtr++)
- {
- pi->id = imagePtr->id;
- pi->type = imagePtr->type;
- pi->byte_order = imagePtr->byte_order;
- memcpy(pi->guid, imagePtr->guid, 16);
- pi->bits_per_pixel = imagePtr->bits_per_pixel;
- pi->format = imagePtr->format;
- pi->num_planes = imagePtr->num_planes;
- pi->depth = imagePtr->depth;
- pi->red_mask = imagePtr->red_mask;
- pi->green_mask = imagePtr->green_mask;
- pi->blue_mask = imagePtr->blue_mask;
- pi->y_sample_bits = imagePtr->y_sample_bits;
- pi->u_sample_bits = imagePtr->u_sample_bits;
- pi->v_sample_bits = imagePtr->v_sample_bits;
- pi->horz_y_period = imagePtr->horz_y_period;
- pi->horz_u_period = imagePtr->horz_u_period;
- pi->horz_v_period = imagePtr->horz_v_period;
- pi->vert_y_period = imagePtr->vert_y_period;
- pi->vert_u_period = imagePtr->vert_u_period;
- pi->vert_v_period = imagePtr->vert_v_period;
- memcpy(pi->component_order, imagePtr->component_order, 32);
- pi->scanline_order = imagePtr->scanline_order;
- }
- pa->nImages = adaptorPtr->nImages;
- pa->pImages = pImage;
- }
-
- if(adaptorPtr->nAttributes &&
- (pAttribute = calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
- {
- for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
- i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
- {
- pat->flags = attributePtr->flags;
- pat->min_value = attributePtr->min_value;
- pat->max_value = attributePtr->max_value;
- pat->name = strdup(attributePtr->name);
- }
- pa->nAttributes = adaptorPtr->nAttributes;
- pa->pAttributes = pAttribute;
- }
-
-
- totFormat = adaptorPtr->nFormats;
-
- if(!(pFormat = calloc(totFormat, sizeof(XvFormatRec)))) {
- xf86XVFreeAdaptor(pa);
- continue;
- }
- for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats;
- i < adaptorPtr->nFormats; i++, formatPtr++)
- {
- numVisuals = pScreen->numVisuals;
- pVisual = pScreen->visuals;
-
- while(numVisuals--) {
- if((pVisual->class == formatPtr->class) &&
- (pVisual->nplanes == formatPtr->depth)) {
-
- if(numFormat >= totFormat) {
- void *moreSpace;
- totFormat *= 2;
- moreSpace = realloc(pFormat,
- totFormat * sizeof(XvFormatRec));
- if(!moreSpace) break;
- pFormat = moreSpace;
- pf = pFormat + numFormat;
- }
-
- pf->visual = pVisual->vid;
- pf->depth = formatPtr->depth;
-
- pf++;
- numFormat++;
- }
- pVisual++;
- }
- }
- pa->nFormats = numFormat;
- pa->pFormats = pFormat;
- if(!numFormat) {
- xf86XVFreeAdaptor(pa);
- continue;
- }
-
- if(!(adaptorPriv = calloc(1, sizeof(XvAdaptorRecPrivate)))) {
- xf86XVFreeAdaptor(pa);
- continue;
- }
-
- adaptorPriv->flags = adaptorPtr->flags;
- adaptorPriv->PutVideo = adaptorPtr->PutVideo;
- adaptorPriv->PutStill = adaptorPtr->PutStill;
- adaptorPriv->GetVideo = adaptorPtr->GetVideo;
- adaptorPriv->GetStill = adaptorPtr->GetStill;
- adaptorPriv->StopVideo = adaptorPtr->StopVideo;
- adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute;
- adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute;
- adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
- adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
- adaptorPriv->PutImage = adaptorPtr->PutImage;
- adaptorPriv->ReputImage = adaptorPtr->ReputImage; /* image/still */
-
- pa->devPriv.ptr = (pointer)adaptorPriv;
-
- if(!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
- xf86XVFreeAdaptor(pa);
- continue;
- }
- for(pp = pPort, i = 0, numPort = 0;
- i < adaptorPtr->nPorts; i++) {
-
- if(!(pp->id = FakeClientID(0)))
- continue;
-
- if(!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
- continue;
-
- if(!AddResource(pp->id, PortResource, pp)) {
- free(portPriv);
- continue;
- }
-
- pp->pAdaptor = pa;
- pp->pNotify = (XvPortNotifyPtr)NULL;
- pp->pDraw = (DrawablePtr)NULL;
- pp->client = (ClientPtr)NULL;
- pp->grab.client = (ClientPtr)NULL;
- pp->time = currentTime;
- pp->devPriv.ptr = portPriv;
-
- portPriv->pScrn = pScrn;
- portPriv->AdaptorRec = adaptorPriv;
- portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
-
- pp++;
- numPort++;
- }
- pa->nPorts = numPort;
- pa->pPorts = pPort;
- if(!numPort) {
- xf86XVFreeAdaptor(pa);
- continue;
- }
-
- pa->base_id = pPort->id;
-
- pa++;
- numAdaptor++;
- }
-
- if(numAdaptor) {
- pxvs->nAdaptors = numAdaptor;
- pxvs->pAdaptors = pAdaptor;
- } else {
- free(pAdaptor);
- return FALSE;
- }
-
- return TRUE;
+xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
+{
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XF86VideoAdaptorPtr adaptorPtr;
+ XvAdaptorPtr pAdaptor, pa;
+ XvAdaptorRecPrivatePtr adaptorPriv;
+ int na, numAdaptor;
+ XvPortRecPrivatePtr portPriv;
+ XvPortPtr pPort, pp;
+ int numPort;
+ XF86AttributePtr attributePtr;
+ XvAttributePtr pAttribute, pat;
+ XF86VideoFormatPtr formatPtr;
+ XvFormatPtr pFormat, pf;
+ int numFormat, totFormat;
+ XF86VideoEncodingPtr encodingPtr;
+ XvEncodingPtr pEncode, pe;
+ XF86ImagePtr imagePtr;
+ XvImagePtr pImage, pi;
+ int numVisuals;
+ VisualPtr pVisual;
+ int i;
+
+ pxvs->nAdaptors = 0;
+ pxvs->pAdaptors = NULL;
+
+ if (!(pAdaptor = calloc(number, sizeof(XvAdaptorRec))))
+ return FALSE;
+
+ for (pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
+ adaptorPtr = infoPtr[na];
+
+ if (!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
+ !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
+ continue;
+
+ /* client libs expect at least one encoding */
+ if (!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
+ continue;
+
+ pa->type = adaptorPtr->type;
+
+ if (!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
+ pa->type &= ~XvVideoMask;
+
+ if (!adaptorPtr->PutStill && !adaptorPtr->GetStill)
+ pa->type &= ~XvStillMask;
+
+ if (!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
+ pa->type &= ~XvImageMask;
+
+ if (!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
+ !adaptorPtr->PutStill)
+ pa->type &= ~XvInputMask;
+
+ if (!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
+ pa->type &= ~XvOutputMask;
+
+ if (!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
+ continue;
+ if (!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
+ continue;
+
+ pa->pScreen = pScreen;
+ pa->ddAllocatePort = xf86XVAllocatePort;
+ pa->ddFreePort = xf86XVFreePort;
+ pa->ddPutVideo = xf86XVPutVideo;
+ pa->ddPutStill = xf86XVPutStill;
+ pa->ddGetVideo = xf86XVGetVideo;
+ pa->ddGetStill = xf86XVGetStill;
+ pa->ddStopVideo = xf86XVStopVideo;
+ pa->ddPutImage = xf86XVPutImage;
+ pa->ddSetPortAttribute = xf86XVSetPortAttribute;
+ pa->ddGetPortAttribute = xf86XVGetPortAttribute;
+ pa->ddQueryBestSize = xf86XVQueryBestSize;
+ pa->ddQueryImageAttributes = xf86XVQueryImageAttributes;
+ pa->name = strdup(adaptorPtr->name);
+
+ if (adaptorPtr->nEncodings &&
+ (pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
+
+ for (pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
+ i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) {
+ pe->id = encodingPtr->id;
+ pe->pScreen = pScreen;
+ pe->name = strdup(encodingPtr->name);
+ pe->width = encodingPtr->width;
+ pe->height = encodingPtr->height;
+ pe->rate.numerator = encodingPtr->rate.numerator;
+ pe->rate.denominator = encodingPtr->rate.denominator;
+ }
+ pa->nEncodings = adaptorPtr->nEncodings;
+ pa->pEncodings = pEncode;
+ }
+
+ if (adaptorPtr->nImages &&
+ (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
+
+ for (i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
+ i < adaptorPtr->nImages; i++, pi++, imagePtr++) {
+ pi->id = imagePtr->id;
+ pi->type = imagePtr->type;
+ pi->byte_order = imagePtr->byte_order;
+ memcpy(pi->guid, imagePtr->guid, 16);
+ pi->bits_per_pixel = imagePtr->bits_per_pixel;
+ pi->format = imagePtr->format;
+ pi->num_planes = imagePtr->num_planes;
+ pi->depth = imagePtr->depth;
+ pi->red_mask = imagePtr->red_mask;
+ pi->green_mask = imagePtr->green_mask;
+ pi->blue_mask = imagePtr->blue_mask;
+ pi->y_sample_bits = imagePtr->y_sample_bits;
+ pi->u_sample_bits = imagePtr->u_sample_bits;
+ pi->v_sample_bits = imagePtr->v_sample_bits;
+ pi->horz_y_period = imagePtr->horz_y_period;
+ pi->horz_u_period = imagePtr->horz_u_period;
+ pi->horz_v_period = imagePtr->horz_v_period;
+ pi->vert_y_period = imagePtr->vert_y_period;
+ pi->vert_u_period = imagePtr->vert_u_period;
+ pi->vert_v_period = imagePtr->vert_v_period;
+ memcpy(pi->component_order, imagePtr->component_order, 32);
+ pi->scanline_order = imagePtr->scanline_order;
+ }
+ pa->nImages = adaptorPtr->nImages;
+ pa->pImages = pImage;
+ }
+
+ if (adaptorPtr->nAttributes &&
+ (pAttribute =
+ calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) {
+ for (pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i =
+ 0; i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) {
+ pat->flags = attributePtr->flags;
+ pat->min_value = attributePtr->min_value;
+ pat->max_value = attributePtr->max_value;
+ pat->name = strdup(attributePtr->name);
+ }
+ pa->nAttributes = adaptorPtr->nAttributes;
+ pa->pAttributes = pAttribute;
+ }
+
+ totFormat = adaptorPtr->nFormats;
+
+ if (!(pFormat = calloc(totFormat, sizeof(XvFormatRec)))) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+ for (pf = pFormat, i = 0, numFormat = 0, formatPtr =
+ adaptorPtr->pFormats; i < adaptorPtr->nFormats; i++, formatPtr++) {
+ numVisuals = pScreen->numVisuals;
+ pVisual = pScreen->visuals;
+
+ while (numVisuals--) {
+ if ((pVisual->class == formatPtr->class) &&
+ (pVisual->nplanes == formatPtr->depth)) {
+
+ if (numFormat >= totFormat) {
+ void *moreSpace;
+
+ totFormat *= 2;
+ moreSpace = realloc(pFormat,
+ totFormat * sizeof(XvFormatRec));
+ if (!moreSpace)
+ break;
+ pFormat = moreSpace;
+ pf = pFormat + numFormat;
+ }
+
+ pf->visual = pVisual->vid;
+ pf->depth = formatPtr->depth;
+
+ pf++;
+ numFormat++;
+ }
+ pVisual++;
+ }
+ }
+ pa->nFormats = numFormat;
+ pa->pFormats = pFormat;
+ if (!numFormat) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+
+ if (!(adaptorPriv = calloc(1, sizeof(XvAdaptorRecPrivate)))) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+
+ adaptorPriv->flags = adaptorPtr->flags;
+ adaptorPriv->PutVideo = adaptorPtr->PutVideo;
+ adaptorPriv->PutStill = adaptorPtr->PutStill;
+ adaptorPriv->GetVideo = adaptorPtr->GetVideo;
+ adaptorPriv->GetStill = adaptorPtr->GetStill;
+ adaptorPriv->StopVideo = adaptorPtr->StopVideo;
+ adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute;
+ adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute;
+ adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
+ adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
+ adaptorPriv->PutImage = adaptorPtr->PutImage;
+ adaptorPriv->ReputImage = adaptorPtr->ReputImage; /* image/still */
+
+ pa->devPriv.ptr = (pointer) adaptorPriv;
+
+ if (!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+ for (pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) {
+
+ if (!(pp->id = FakeClientID(0)))
+ continue;
+
+ if (!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
+ continue;
+
+ if (!AddResource(pp->id, PortResource, pp)) {
+ free(portPriv);
+ continue;
+ }
+
+ pp->pAdaptor = pa;
+ pp->pNotify = (XvPortNotifyPtr) NULL;
+ pp->pDraw = (DrawablePtr) NULL;
+ pp->client = (ClientPtr) NULL;
+ pp->grab.client = (ClientPtr) NULL;
+ pp->time = currentTime;
+ pp->devPriv.ptr = portPriv;
+
+ portPriv->pScrn = pScrn;
+ portPriv->AdaptorRec = adaptorPriv;
+ portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
+
+ pp++;
+ numPort++;
+ }
+ pa->nPorts = numPort;
+ pa->pPorts = pPort;
+ if (!numPort) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+
+ pa->base_id = pPort->id;
+
+ pa++;
+ numAdaptor++;
+ }
+
+ if (numAdaptor) {
+ pxvs->nAdaptors = numAdaptor;
+ pxvs->pAdaptors = pAdaptor;
+ }
+ else {
+ free(pAdaptor);
+ return FALSE;
+ }
+
+ return TRUE;
}
/* Video should be clipped to the intersection of the window cliplist
@@ -650,66 +635,64 @@ xf86XVInitAdaptors(
static void
xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
{
- RegionPtr pregWin, pCompositeClip;
- WindowPtr pWin;
- Bool freeCompClip = FALSE;
-
- if(portPriv->pCompositeClip)
- return;
-
- pWin = (WindowPtr)portPriv->pDraw;
-
- /* get window clip list */
- if(portPriv->subWindowMode == IncludeInferiors) {
- pregWin = NotClippedByChildren(pWin);
- freeCompClip = TRUE;
- } else
- pregWin = &pWin->clipList;
-
- if(!portPriv->clientClip) {
- portPriv->pCompositeClip = pregWin;
- portPriv->FreeCompositeClip = freeCompClip;
- return;
- }
-
- pCompositeClip = RegionCreate(NullBox, 1);
- RegionCopy(pCompositeClip, portPriv->clientClip);
- RegionTranslate(pCompositeClip,
- portPriv->pDraw->x, portPriv->pDraw->y);
- RegionIntersect(pCompositeClip, pregWin, pCompositeClip);
-
- portPriv->pCompositeClip = pCompositeClip;
- portPriv->FreeCompositeClip = TRUE;
-
- if(freeCompClip) {
- RegionDestroy(pregWin);
- }
+ RegionPtr pregWin, pCompositeClip;
+ WindowPtr pWin;
+ Bool freeCompClip = FALSE;
+
+ if (portPriv->pCompositeClip)
+ return;
+
+ pWin = (WindowPtr) portPriv->pDraw;
+
+ /* get window clip list */
+ if (portPriv->subWindowMode == IncludeInferiors) {
+ pregWin = NotClippedByChildren(pWin);
+ freeCompClip = TRUE;
+ }
+ else
+ pregWin = &pWin->clipList;
+
+ if (!portPriv->clientClip) {
+ portPriv->pCompositeClip = pregWin;
+ portPriv->FreeCompositeClip = freeCompClip;
+ return;
+ }
+
+ pCompositeClip = RegionCreate(NullBox, 1);
+ RegionCopy(pCompositeClip, portPriv->clientClip);
+ RegionTranslate(pCompositeClip, portPriv->pDraw->x, portPriv->pDraw->y);
+ RegionIntersect(pCompositeClip, pregWin, pCompositeClip);
+
+ portPriv->pCompositeClip = pCompositeClip;
+ portPriv->FreeCompositeClip = TRUE;
+
+ if (freeCompClip) {
+ RegionDestroy(pregWin);
+ }
}
/* Save the current clientClip and update the CompositeClip whenever
we have a fresh GC */
static void
-xf86XVCopyClip(
- XvPortRecPrivatePtr portPriv,
- GCPtr pGC
-){
+xf86XVCopyClip(XvPortRecPrivatePtr portPriv, GCPtr pGC)
+{
/* copy the new clip if it exists */
- if((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
- if(!portPriv->clientClip)
- portPriv->clientClip = RegionCreate(NullBox, 1);
- /* Note: this is in window coordinates */
- RegionCopy(portPriv->clientClip, pGC->clientClip);
- RegionTranslate(portPriv->clientClip,
- pGC->clipOrg.x, pGC->clipOrg.y);
- } else if(portPriv->clientClip) { /* free the old clientClip */
- RegionDestroy(portPriv->clientClip);
- portPriv->clientClip = NULL;
+ if ((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
+ if (!portPriv->clientClip)
+ portPriv->clientClip = RegionCreate(NullBox, 1);
+ /* Note: this is in window coordinates */
+ RegionCopy(portPriv->clientClip, pGC->clientClip);
+ RegionTranslate(portPriv->clientClip, pGC->clipOrg.x, pGC->clipOrg.y);
+ }
+ else if (portPriv->clientClip) { /* free the old clientClip */
+ RegionDestroy(portPriv->clientClip);
+ portPriv->clientClip = NULL;
}
/* get rid of the old clip list */
- if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
- RegionDestroy(portPriv->pCompositeClip);
+ if (portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
+ RegionDestroy(portPriv->pCompositeClip);
}
portPriv->pCompositeClip = pGC->pCompositeClip;
@@ -719,19 +702,17 @@ xf86XVCopyClip(
static void
xf86XVCopyCompositeClip(XvPortRecPrivatePtr portPriv,
- GCPtr pGC,
- DrawablePtr pDraw)
+ GCPtr pGC, DrawablePtr pDraw)
{
if (!portPriv->clientClip)
- portPriv->clientClip = RegionCreate(NullBox, 1);
+ portPriv->clientClip = RegionCreate(NullBox, 1);
/* Keep the original GC composite clip around for ReputImage */
RegionCopy(portPriv->clientClip, pGC->pCompositeClip);
- RegionTranslate(portPriv->clientClip,
- -pDraw->x, -pDraw->y);
+ RegionTranslate(portPriv->clientClip, -pDraw->x, -pDraw->y);
/* get rid of the old clip list */
if (portPriv->pCompositeClip && portPriv->FreeCompositeClip)
- RegionDestroy(portPriv->pCompositeClip);
+ RegionDestroy(portPriv->pCompositeClip);
portPriv->pCompositeClip = pGC->pCompositeClip;
portPriv->FreeCompositeClip = FALSE;
@@ -741,257 +722,257 @@ xf86XVCopyCompositeClip(XvPortRecPrivatePtr portPriv,
static int
xf86XVRegetVideo(XvPortRecPrivatePtr portPriv)
{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- xf86XVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- RegionInit(&WinRegion, &WinBox, 1);
- RegionNull(&ClipRegion);
- RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* that's all if it's totally obscured */
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->pScrn,
- portPriv->vid_x, portPriv->vid_y,
- WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
- &ClipRegion, portPriv->DevPriv.ptr,
- portPriv->pDraw);
-
- if(ret == Success)
- portPriv->isOn = XV_ON;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
-}
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ xf86XVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionNull(&ClipRegion);
+ RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* that's all if it's totally obscured */
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->GetVideo) (portPriv->pScrn,
+ portPriv->vid_x, portPriv->vid_y,
+ WinBox.x1, WinBox.y1,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr,
+ portPriv->pDraw);
+
+ if (ret == Success)
+ portPriv->isOn = XV_ON;
+
+ CLIP_VIDEO_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+ /* This clip was copied and only good for one shot */
+ if (!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
+}
static int
xf86XVReputVideo(XvPortRecPrivatePtr portPriv)
{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- xf86XVUpdateCompositeClip(portPriv);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- RegionInit(&WinRegion, &WinBox, 1);
- RegionNull(&ClipRegion);
- RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* clip and translate to the viewport */
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = portPriv->pScrn->frameX0;
- VPBox.y1 = portPriv->pScrn->frameY0;
- VPBox.x2 = portPriv->pScrn->frameX1 + 1;
- VPBox.y2 = portPriv->pScrn->frameY1 + 1;
-
- RegionInit(&VPReg, &VPBox, 1);
- RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
- RegionUninit(&VPReg);
- }
-
- /* that's all if it's totally obscured */
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- /* bailout if we have to clip but the hardware doesn't support it */
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = RegionRects(&ClipRegion);
- if( (RegionNumRects(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->pScrn,
- portPriv->vid_x, portPriv->vid_y,
- WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
- &ClipRegion, portPriv->DevPriv.ptr,
- portPriv->pDraw);
-
- if(ret == Success) portPriv->isOn = XV_ON;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ xf86XVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionNull(&ClipRegion);
+ RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* clip and translate to the viewport */
+ if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = portPriv->pScrn->frameX0;
+ VPBox.y1 = portPriv->pScrn->frameY0;
+ VPBox.x2 = portPriv->pScrn->frameX1 + 1;
+ VPBox.y2 = portPriv->pScrn->frameY1 + 1;
+
+ RegionInit(&VPReg, &VPBox, 1);
+ RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
+ RegionUninit(&VPReg);
+ }
+
+ /* that's all if it's totally obscured */
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ /* bailout if we have to clip but the hardware doesn't support it */
+ if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = RegionRects(&ClipRegion);
+
+ if ((RegionNumRects(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutVideo) (portPriv->pScrn,
+ portPriv->vid_x, portPriv->vid_y,
+ WinBox.x1, WinBox.y1,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr,
+ portPriv->pDraw);
+
+ if (ret == Success)
+ portPriv->isOn = XV_ON;
+
+ CLIP_VIDEO_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if (!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
}
/* Reput image/still */
static int
xf86XVReputImage(XvPortRecPrivatePtr portPriv)
{
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- xf86XVUpdateCompositeClip(portPriv);
-
- /* the clip can get smaller over time */
- RegionCopy(portPriv->clientClip, portPriv->pCompositeClip);
- RegionTranslate(portPriv->clientClip,
- -portPriv->pDraw->x, -portPriv->pDraw->y);
-
- /* translate the video region to the screen */
- WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
- WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
- WinBox.x2 = WinBox.x1 + portPriv->drw_w;
- WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
- /* clip to the window composite clip */
- RegionInit(&WinRegion, &WinBox, 1);
- RegionNull(&ClipRegion);
- RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
- /* clip and translate to the viewport */
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = portPriv->pScrn->frameX0;
- VPBox.y1 = portPriv->pScrn->frameY0;
- VPBox.x2 = portPriv->pScrn->frameX1 + 1;
- VPBox.y2 = portPriv->pScrn->frameY1 + 1;
-
- RegionInit(&VPReg, &VPBox, 1);
- RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
- RegionUninit(&VPReg);
- }
-
- /* that's all if it's totally obscured */
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
-
- /* bailout if we have to clip but the hardware doesn't support it */
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = RegionRects(&ClipRegion);
- if( (RegionNumRects(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto CLIP_VIDEO_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->pScrn,
- portPriv->vid_x, portPriv->vid_y,
- WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
- &ClipRegion, portPriv->DevPriv.ptr,
- portPriv->pDraw);
-
- portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF;
-
-CLIP_VIDEO_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
-}
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ xf86XVUpdateCompositeClip(portPriv);
+
+ /* the clip can get smaller over time */
+ RegionCopy(portPriv->clientClip, portPriv->pCompositeClip);
+ RegionTranslate(portPriv->clientClip,
+ -portPriv->pDraw->x, -portPriv->pDraw->y);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionNull(&ClipRegion);
+ RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* clip and translate to the viewport */
+ if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = portPriv->pScrn->frameX0;
+ VPBox.y1 = portPriv->pScrn->frameY0;
+ VPBox.x2 = portPriv->pScrn->frameX1 + 1;
+ VPBox.y2 = portPriv->pScrn->frameY1 + 1;
+
+ RegionInit(&VPReg, &VPBox, 1);
+ RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
+ RegionUninit(&VPReg);
+ }
+
+ /* that's all if it's totally obscured */
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ /* bailout if we have to clip but the hardware doesn't support it */
+ if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = RegionRects(&ClipRegion);
+
+ if ((RegionNumRects(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->ReputImage) (portPriv->pScrn,
+ portPriv->vid_x, portPriv->vid_y,
+ WinBox.x1, WinBox.y1,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion,
+ portPriv->DevPriv.ptr,
+ portPriv->pDraw);
+ portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF;
+
+ CLIP_VIDEO_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if (!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
+}
static int
xf86XVReputAllVideo(WindowPtr pWin, pointer data)
{
XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
- while(WinPriv) {
- if(WinPriv->PortRec->type == XvInputMask)
- xf86XVReputVideo(WinPriv->PortRec);
- else
- xf86XVRegetVideo(WinPriv->PortRec);
- WinPriv = WinPriv->next;
+ while (WinPriv) {
+ if (WinPriv->PortRec->type == XvInputMask)
+ xf86XVReputVideo(WinPriv->PortRec);
+ else
+ xf86XVRegetVideo(WinPriv->PortRec);
+ WinPriv = WinPriv->next;
}
return WT_WALKCHILDREN;
@@ -1000,86 +981,86 @@ xf86XVReputAllVideo(WindowPtr pWin, pointer data)
static int
xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
{
- XF86XVWindowPtr winPriv, PrivRoot;
+ XF86XVWindowPtr winPriv, PrivRoot;
- winPriv = PrivRoot = GET_XF86XV_WINDOW(pWin);
+ winPriv = PrivRoot = GET_XF86XV_WINDOW(pWin);
- /* Enlist our port in the window private */
- while(winPriv) {
- if(winPriv->PortRec == portPriv) /* we're already listed */
- break;
- winPriv = winPriv->next;
- }
+ /* Enlist our port in the window private */
+ while (winPriv) {
+ if (winPriv->PortRec == portPriv) /* we're already listed */
+ break;
+ winPriv = winPriv->next;
+ }
- if(!winPriv) {
- winPriv = calloc(1, sizeof(XF86XVWindowRec));
- if(!winPriv) return BadAlloc;
- winPriv->PortRec = portPriv;
- winPriv->next = PrivRoot;
- dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, winPriv);
- }
+ if (!winPriv) {
+ winPriv = calloc(1, sizeof(XF86XVWindowRec));
+ if (!winPriv)
+ return BadAlloc;
+ winPriv->PortRec = portPriv;
+ winPriv->next = PrivRoot;
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, winPriv);
+ }
- portPriv->pDraw = (DrawablePtr)pWin;
+ portPriv->pDraw = (DrawablePtr) pWin;
- return Success;
+ return Success;
}
-
static void
xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
{
- XF86XVWindowPtr winPriv, prevPriv = NULL;
- winPriv = GET_XF86XV_WINDOW(pWin);
-
- while(winPriv) {
- if(winPriv->PortRec == portPriv) {
- if(prevPriv)
- prevPriv->next = winPriv->next;
- else
- dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
- winPriv->next);
- free(winPriv);
- break;
- }
- prevPriv = winPriv;
- winPriv = winPriv->next;
- }
- portPriv->pDraw = NULL;
- if (portPriv->ckeyFilled) {
- RegionDestroy(portPriv->ckeyFilled);
- portPriv->ckeyFilled = NULL;
- }
- portPriv->clipChanged = FALSE;
+ XF86XVWindowPtr winPriv, prevPriv = NULL;
+
+ winPriv = GET_XF86XV_WINDOW(pWin);
+
+ while (winPriv) {
+ if (winPriv->PortRec == portPriv) {
+ if (prevPriv)
+ prevPriv->next = winPriv->next;
+ else
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
+ winPriv->next);
+ free(winPriv);
+ break;
+ }
+ prevPriv = winPriv;
+ winPriv = winPriv->next;
+ }
+ portPriv->pDraw = NULL;
+ if (portPriv->ckeyFilled) {
+ RegionDestroy(portPriv->ckeyFilled);
+ portPriv->ckeyFilled = NULL;
+ }
+ portPriv->clipChanged = FALSE;
}
static void
-xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
- WindowPtr pWin,
- Bool visible)
+xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv, WindowPtr pWin, Bool visible)
{
if (!visible) {
- if (pPriv->isOn == XV_ON) {
- (*pPriv->AdaptorRec->StopVideo)(pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
- pPriv->isOn = XV_PENDING;
- }
+ if (pPriv->isOn == XV_ON) {
+ (*pPriv->AdaptorRec->StopVideo) (pPriv->pScrn, pPriv->DevPriv.ptr,
+ FALSE);
+ pPriv->isOn = XV_PENDING;
+ }
- if (!pPriv->type) /* overlaid still/image*/
- xf86XVRemovePortFromWindow(pWin, pPriv);
+ if (!pPriv->type) /* overlaid still/image */
+ xf86XVRemovePortFromWindow(pWin, pPriv);
- return;
+ return;
}
switch (pPriv->type) {
case XvInputMask:
- xf86XVReputVideo(pPriv);
- break;
+ xf86XVReputVideo(pPriv);
+ break;
case XvOutputMask:
- xf86XVRegetVideo(pPriv);
- break;
- default: /* overlaid still/image*/
- if (pPriv->AdaptorRec->ReputImage)
- xf86XVReputImage(pPriv);
- break;
+ xf86XVRegetVideo(pPriv);
+ break;
+ default: /* overlaid still/image */
+ if (pPriv->AdaptorRec->ReputImage)
+ xf86XVReputImage(pPriv);
+ break;
}
}
@@ -1092,33 +1073,34 @@ xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged)
int c, i;
for (c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) {
- XvPortPtr pPort = pa->pPorts;
+ XvPortPtr pPort = pa->pPorts;
- for (i = pa->nPorts; i > 0; i--, pPort++) {
- XvPortRecPrivatePtr pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
- WindowPtr pWin = (WindowPtr)pPriv->pDraw;
- Bool visible;
+ for (i = pa->nPorts; i > 0; i--, pPort++) {
+ XvPortRecPrivatePtr pPriv =
+ (XvPortRecPrivatePtr) pPort->devPriv.ptr;
+ WindowPtr pWin = (WindowPtr) pPriv->pDraw;
+ Bool visible;
- if (pPriv->isOn == XV_OFF || !pWin)
- continue;
+ if (pPriv->isOn == XV_OFF || !pWin)
+ continue;
- if (onlyChanged && !pPriv->clipChanged)
- continue;
+ if (onlyChanged && !pPriv->clipChanged)
+ continue;
- visible = pWin->visibility == VisibilityUnobscured ||
- pWin->visibility == VisibilityPartiallyObscured;
+ visible = pWin->visibility == VisibilityUnobscured ||
+ pWin->visibility == VisibilityPartiallyObscured;
- /*
- * Stop and remove still/images if
- * ReputImage isn't supported.
- */
- if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
- visible = FALSE;
+ /*
+ * Stop and remove still/images if
+ * ReputImage isn't supported.
+ */
+ if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
+ visible = FALSE;
- xf86XVReputOrStopPort(pPriv, pWin, visible);
+ xf86XVReputOrStopPort(pPriv, pWin, visible);
- pPriv->clipChanged = FALSE;
- }
+ pPriv->clipChanged = FALSE;
+ }
}
}
@@ -1127,33 +1109,33 @@ xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged)
static Bool
xf86XVDestroyWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
- XF86XVWindowPtr tmp, WinPriv = GET_XF86XV_WINDOW(pWin);
- int ret;
-
- while(WinPriv) {
- XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
-
- if(pPriv->isOn > XV_OFF) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->pScrn, pPriv->DevPriv.ptr, TRUE);
- pPriv->isOn = XV_OFF;
- }
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ XF86XVWindowPtr tmp, WinPriv = GET_XF86XV_WINDOW(pWin);
+ int ret;
- pPriv->pDraw = NULL;
- tmp = WinPriv;
- WinPriv = WinPriv->next;
- free(tmp);
- }
+ while (WinPriv) {
+ XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
+
+ if (pPriv->isOn > XV_OFF) {
+ (*pPriv->AdaptorRec->StopVideo) (pPriv->pScrn, pPriv->DevPriv.ptr,
+ TRUE);
+ pPriv->isOn = XV_OFF;
+ }
+
+ pPriv->pDraw = NULL;
+ tmp = WinPriv;
+ WinPriv = WinPriv->next;
+ free(tmp);
+ }
- dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL);
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL);
- pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
- ret = (*pScreen->DestroyWindow)(pWin);
- pScreen->DestroyWindow = xf86XVDestroyWindow;
+ pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
+ ret = (*pScreen->DestroyWindow) (pWin);
+ pScreen->DestroyWindow = xf86XVDestroyWindow;
- return ret;
+ return ret;
}
static void
@@ -1164,9 +1146,9 @@ xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
ScrnInfoPtr pScrn;
if (pWin)
- pScreen = pWin->drawable.pScreen;
+ pScreen = pWin->drawable.pScreen;
else
- pScreen = pLayerWin->drawable.pScreen;
+ pScreen = pLayerWin->drawable.pScreen;
ScreenPriv = GET_XF86XV_SCREEN(pScreen);
pScrn = xf86Screens[pScreen->myNum];
@@ -1175,7 +1157,7 @@ xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
pScreen->PostValidateTree = ScreenPriv->PostValidateTree;
if (pScreen->PostValidateTree) {
- (*pScreen->PostValidateTree)(pWin, pLayerWin, kind);
+ (*pScreen->PostValidateTree) (pWin, pLayerWin, kind);
}
ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
}
@@ -1183,140 +1165,137 @@ xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
static void
xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
- XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
- XvPortRecPrivatePtr pPriv;
- Bool AreasExposed;
-
- AreasExposed = (WinPriv && reg1 && RegionNotEmpty(reg1));
-
- pScreen->WindowExposures = ScreenPriv->WindowExposures;
- (*pScreen->WindowExposures)(pWin, reg1, reg2);
- pScreen->WindowExposures = xf86XVWindowExposures;
-
- /* filter out XClearWindow/Area */
- if (!pWin->valdata) return;
-
- while(WinPriv) {
- Bool visible = TRUE;
-
- pPriv = WinPriv->PortRec;
-
- /*
- * Stop and remove still/images if areas were exposed and
- * ReputImage isn't supported.
- */
- if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
- visible = !AreasExposed;
-
- /*
- * Subtract exposed areas from overlaid image to match textured video
- * behavior.
- */
- if (!pPriv->type && pPriv->clientClip)
- RegionSubtract(pPriv->clientClip, pPriv->clientClip, reg1);
-
- if (visible && pPriv->ckeyFilled) {
- RegionRec tmp;
- RegionNull(&tmp);
- RegionCopy(&tmp, reg1);
- RegionTranslate(&tmp, pWin->drawable.x, pWin->drawable.y);
- RegionSubtract(pPriv->ckeyFilled, pPriv->ckeyFilled, &tmp);
- }
-
- WinPriv = WinPriv->next;
- xf86XVReputOrStopPort(pPriv, pWin, visible);
-
- pPriv->clipChanged = FALSE;
- }
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
+ XvPortRecPrivatePtr pPriv;
+ Bool AreasExposed;
+
+ AreasExposed = (WinPriv && reg1 && RegionNotEmpty(reg1));
+
+ pScreen->WindowExposures = ScreenPriv->WindowExposures;
+ (*pScreen->WindowExposures) (pWin, reg1, reg2);
+ pScreen->WindowExposures = xf86XVWindowExposures;
+
+ /* filter out XClearWindow/Area */
+ if (!pWin->valdata)
+ return;
+
+ while (WinPriv) {
+ Bool visible = TRUE;
+
+ pPriv = WinPriv->PortRec;
+
+ /*
+ * Stop and remove still/images if areas were exposed and
+ * ReputImage isn't supported.
+ */
+ if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
+ visible = !AreasExposed;
+
+ /*
+ * Subtract exposed areas from overlaid image to match textured video
+ * behavior.
+ */
+ if (!pPriv->type && pPriv->clientClip)
+ RegionSubtract(pPriv->clientClip, pPriv->clientClip, reg1);
+
+ if (visible && pPriv->ckeyFilled) {
+ RegionRec tmp;
+
+ RegionNull(&tmp);
+ RegionCopy(&tmp, reg1);
+ RegionTranslate(&tmp, pWin->drawable.x, pWin->drawable.y);
+ RegionSubtract(pPriv->ckeyFilled, pPriv->ckeyFilled, &tmp);
+ }
+
+ WinPriv = WinPriv->next;
+ xf86XVReputOrStopPort(pPriv, pWin, visible);
+
+ pPriv->clipChanged = FALSE;
+ }
}
static void
xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
- XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
- XvPortRecPrivatePtr pPriv;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
+ XvPortRecPrivatePtr pPriv;
- while(WinPriv) {
- pPriv = WinPriv->PortRec;
+ while (WinPriv) {
+ pPriv = WinPriv->PortRec;
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- RegionDestroy(pPriv->pCompositeClip);
+ if (pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ RegionDestroy(pPriv->pCompositeClip);
- pPriv->pCompositeClip = NULL;
+ pPriv->pCompositeClip = NULL;
- if (pPriv->AdaptorRec->ClipNotify)
- (*pPriv->AdaptorRec->ClipNotify)(pPriv->pScrn, pPriv->DevPriv.ptr,
- pWin, dx, dy);
+ if (pPriv->AdaptorRec->ClipNotify)
+ (*pPriv->AdaptorRec->ClipNotify) (pPriv->pScrn, pPriv->DevPriv.ptr,
+ pWin, dx, dy);
- pPriv->clipChanged = TRUE;
+ pPriv->clipChanged = TRUE;
- if (ScreenPriv->PostValidateTree == PostValidateTreeUndefined) {
- ScreenPriv->PostValidateTree = pScreen->PostValidateTree;
- pScreen->PostValidateTree = xf86XVPostValidateTree;
- }
+ if (ScreenPriv->PostValidateTree == PostValidateTreeUndefined) {
+ ScreenPriv->PostValidateTree = pScreen->PostValidateTree;
+ pScreen->PostValidateTree = xf86XVPostValidateTree;
+ }
- WinPriv = WinPriv->next;
- }
+ WinPriv = WinPriv->next;
+ }
- if(ScreenPriv->ClipNotify) {
- pScreen->ClipNotify = ScreenPriv->ClipNotify;
- (*pScreen->ClipNotify)(pWin, dx, dy);
- pScreen->ClipNotify = xf86XVClipNotify;
- }
+ if (ScreenPriv->ClipNotify) {
+ pScreen->ClipNotify = ScreenPriv->ClipNotify;
+ (*pScreen->ClipNotify) (pWin, dx, dy);
+ pScreen->ClipNotify = xf86XVClipNotify;
+ }
}
-
-
/**** Required XvScreenRec fields ****/
static Bool
xf86XVCloseScreen(int i, ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
- XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
- XvAdaptorPtr pa;
- int c;
-
- if(!ScreenPriv) return TRUE;
-
- pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
- pScreen->WindowExposures = ScreenPriv->WindowExposures;
- pScreen->ClipNotify = ScreenPriv->ClipNotify;
-
- pScrn->EnterVT = ScreenPriv->EnterVT;
- pScrn->LeaveVT = ScreenPriv->LeaveVT;
- pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
- pScrn->ModeSet = ScreenPriv->ModeSet;
-
- for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
- xf86XVFreeAdaptor(pa);
- }
-
- free(pxvs->pAdaptors);
- free(ScreenPriv);
- return TRUE;
-}
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ XvAdaptorPtr pa;
+ int c;
+ if (!ScreenPriv)
+ return TRUE;
-static int
-xf86XVQueryAdaptors(
- ScreenPtr pScreen,
- XvAdaptorPtr *p_pAdaptors,
- int *p_nAdaptors
-){
- XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
+ pScreen->WindowExposures = ScreenPriv->WindowExposures;
+ pScreen->ClipNotify = ScreenPriv->ClipNotify;
+
+ pScrn->EnterVT = ScreenPriv->EnterVT;
+ pScrn->LeaveVT = ScreenPriv->LeaveVT;
+ pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
+ pScrn->ModeSet = ScreenPriv->ModeSet;
- *p_nAdaptors = pxvs->nAdaptors;
- *p_pAdaptors = pxvs->pAdaptors;
+ for (c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
+ xf86XVFreeAdaptor(pa);
+ }
- return Success;
+ free(pxvs->pAdaptors);
+ free(ScreenPriv);
+ return TRUE;
}
+static int
+xf86XVQueryAdaptors(ScreenPtr pScreen,
+ XvAdaptorPtr * p_pAdaptors, int *p_nAdaptors)
+{
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+
+ *p_nAdaptors = pxvs->nAdaptors;
+ *p_pAdaptors = pxvs->pAdaptors;
+
+ return Success;
+}
/**** ScrnInfoRec fields ****/
@@ -1329,11 +1308,12 @@ xf86XVEnterVT(int index, int flags)
Bool ret;
pScrn->EnterVT = ScreenPriv->EnterVT;
- ret = (*ScreenPriv->EnterVT)(index, flags);
+ ret = (*ScreenPriv->EnterVT) (index, flags);
ScreenPriv->EnterVT = pScrn->EnterVT;
pScrn->EnterVT = xf86XVEnterVT;
- if(ret) WalkTree(pScreen, xf86XVReputAllVideo, 0);
+ if (ret)
+ WalkTree(pScreen, xf86XVReputAllVideo, 0);
return ret;
}
@@ -1350,31 +1330,31 @@ xf86XVLeaveVT(int index, int flags)
XvPortRecPrivatePtr pPriv;
int i, j;
- for(i = 0; i < pxvs->nAdaptors; i++) {
- pAdaptor = &pxvs->pAdaptors[i];
- for(j = 0; j < pAdaptor->nPorts; j++) {
- pPort = &pAdaptor->pPorts[j];
- pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
- if(pPriv->isOn > XV_OFF) {
+ for (i = 0; i < pxvs->nAdaptors; i++) {
+ pAdaptor = &pxvs->pAdaptors[i];
+ for (j = 0; j < pAdaptor->nPorts; j++) {
+ pPort = &pAdaptor->pPorts[j];
+ pPriv = (XvPortRecPrivatePtr) pPort->devPriv.ptr;
+ if (pPriv->isOn > XV_OFF) {
- (*pPriv->AdaptorRec->StopVideo)(
- pPriv->pScrn, pPriv->DevPriv.ptr, TRUE);
- pPriv->isOn = XV_OFF;
+ (*pPriv->AdaptorRec->StopVideo) (pPriv->pScrn,
+ pPriv->DevPriv.ptr, TRUE);
+ pPriv->isOn = XV_OFF;
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
- RegionDestroy(pPriv->pCompositeClip);
+ if (pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ RegionDestroy(pPriv->pCompositeClip);
- pPriv->pCompositeClip = NULL;
+ pPriv->pCompositeClip = NULL;
- if(!pPriv->type && pPriv->pDraw) { /* still */
- xf86XVRemovePortFromWindow((WindowPtr)pPriv->pDraw, pPriv);
- }
- }
- }
+ if (!pPriv->type && pPriv->pDraw) { /* still */
+ xf86XVRemovePortFromWindow((WindowPtr) pPriv->pDraw, pPriv);
+ }
+ }
+ }
}
pScrn->LeaveVT = ScreenPriv->LeaveVT;
- (*ScreenPriv->LeaveVT)(index, flags);
+ (*ScreenPriv->LeaveVT) (index, flags);
ScreenPriv->LeaveVT = pScrn->LeaveVT;
pScrn->LeaveVT = xf86XVLeaveVT;
}
@@ -1382,17 +1362,17 @@ xf86XVLeaveVT(int index, int flags)
static void
xf86XVAdjustFrame(int index, int x, int y, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[index];
- ScreenPtr pScreen = pScrn->pScreen;
- XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ScreenPtr pScreen = pScrn->pScreen;
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
- if(ScreenPriv->AdjustFrame) {
- pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
- (*pScrn->AdjustFrame)(index, x, y, flags);
- pScrn->AdjustFrame = xf86XVAdjustFrame;
- }
+ if (ScreenPriv->AdjustFrame) {
+ pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
+ (*pScrn->AdjustFrame) (index, x, y, flags);
+ pScrn->AdjustFrame = xf86XVAdjustFrame;
+ }
- xf86XVReputOrStopAllPorts(pScrn, FALSE);
+ xf86XVReputOrStopAllPorts(pScrn, FALSE);
}
static void
@@ -1403,14 +1383,14 @@ xf86XVModeSet(ScrnInfoPtr pScrn)
/* Can be called before pScrn->pScreen is set */
if (!pScreen)
- return;
+ return;
ScreenPriv = GET_XF86XV_SCREEN(pScreen);
if (ScreenPriv->ModeSet) {
- pScrn->ModeSet = ScreenPriv->ModeSet;
- (*pScrn->ModeSet)(pScrn);
- pScrn->ModeSet = xf86XVModeSet;
+ pScrn->ModeSet = ScreenPriv->ModeSet;
+ (*pScrn->ModeSet) (pScrn);
+ pScrn->ModeSet = xf86XVModeSet;
}
xf86XVReputOrStopAllPorts(pScrn, FALSE);
@@ -1419,589 +1399,583 @@ xf86XVModeSet(ScrnInfoPtr pScrn)
/**** XvAdaptorRec fields ****/
static int
-xf86XVAllocatePort(
- unsigned long port,
- XvPortPtr pPort,
- XvPortPtr *ppPort
-){
- *ppPort = pPort;
- return Success;
+xf86XVAllocatePort(unsigned long port, XvPortPtr pPort, XvPortPtr * ppPort)
+{
+ *ppPort = pPort;
+ return Success;
}
-
-
static int
xf86XVFreePort(XvPortPtr pPort)
{
- return Success;
+ return Success;
}
-
static int
-xf86XVPutVideo(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- int result;
-
- /* No dumping video to pixmaps... For now anyhow */
- if(pDraw->type != DRAWABLE_WINDOW) {
- pPort->pDraw = (DrawablePtr)NULL;
- return BadAlloc;
- }
-
- /* If we are changing windows, unregister our port in the old window */
- if(portPriv->pDraw && (portPriv->pDraw != pDraw))
- xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
-
- /* Register our port with the new window */
- result = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- if(result != Success) return result;
-
- portPriv->type = XvInputMask;
-
- /* save a copy of these parameters */
- portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
- portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
-
- /* make sure we have the most recent copy of the clientClip */
- xf86XVCopyClip(portPriv, pGC);
-
- /* To indicate to the DI layer that we were successful */
- pPort->pDraw = pDraw;
-
- if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
-
- return(xf86XVReputVideo(portPriv));
+xf86XVPutVideo(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ int result;
+
+ /* No dumping video to pixmaps... For now anyhow */
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ pPort->pDraw = (DrawablePtr) NULL;
+ return BadAlloc;
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if (portPriv->pDraw && (portPriv->pDraw != pDraw))
+ xf86XVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv);
+
+ /* Register our port with the new window */
+ result = xf86XVEnlistPortInWindow((WindowPtr) pDraw, portPriv);
+ if (result != Success)
+ return result;
+
+ portPriv->type = XvInputMask;
+
+ /* save a copy of these parameters */
+ portPriv->vid_x = vid_x;
+ portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w;
+ portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x;
+ portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w;
+ portPriv->drw_h = drw_h;
+
+ /* make sure we have the most recent copy of the clientClip */
+ xf86XVCopyClip(portPriv, pGC);
+
+ /* To indicate to the DI layer that we were successful */
+ pPort->pDraw = pDraw;
+
+ if (!portPriv->pScrn->vtSema)
+ return Success; /* Success ? */
+
+ return (xf86XVReputVideo(portPriv));
}
static int
-xf86XVPutStill(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- xf86XVCopyCompositeClip(portPriv, pGC, pDraw);
-
- RegionInit(&WinRegion, &WinBox, 1);
- RegionNull(&ClipRegion);
- RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = portPriv->pScrn->frameX0;
- VPBox.y1 = portPriv->pScrn->frameY0;
- VPBox.x2 = portPriv->pScrn->frameX1 + 1;
- VPBox.y2 = portPriv->pScrn->frameY1 + 1;
-
- RegionInit(&VPReg, &VPBox, 1);
- RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
- RegionUninit(&VPReg);
- }
-
- if(portPriv->pDraw) {
- xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto PUT_STILL_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = RegionRects(&ClipRegion);
- if( (RegionNumRects(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto PUT_STILL_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutStill)(portPriv->pScrn,
- vid_x, vid_y, WinBox.x1, WinBox.y1,
- vid_w, vid_h, drw_w, drw_h,
- &ClipRegion, portPriv->DevPriv.ptr,
- pDraw);
-
- if((ret == Success) &&
- (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) {
-
- xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- portPriv->isOn = XV_ON;
- portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
- portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
- portPriv->type = 0; /* no mask means it's transient and should
- not be reput once it's removed */
- pPort->pDraw = pDraw; /* make sure we can get stop requests */
- }
-
-PUT_STILL_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
+xf86XVPutStill(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if (!portPriv->pScrn->vtSema)
+ return Success; /* Success ? */
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ xf86XVCopyCompositeClip(portPriv, pGC, pDraw);
+
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionNull(&ClipRegion);
+ RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = portPriv->pScrn->frameX0;
+ VPBox.y1 = portPriv->pScrn->frameY0;
+ VPBox.x2 = portPriv->pScrn->frameX1 + 1;
+ VPBox.y2 = portPriv->pScrn->frameY1 + 1;
+
+ RegionInit(&VPReg, &VPBox, 1);
+ RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
+ RegionUninit(&VPReg);
+ }
+
+ if (portPriv->pDraw) {
+ xf86XVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv);
+ }
+
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto PUT_STILL_BAILOUT;
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = RegionRects(&ClipRegion);
+
+ if ((RegionNumRects(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
+ clippedAway = TRUE;
+ goto PUT_STILL_BAILOUT;
+ }
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutStill) (portPriv->pScrn,
+ vid_x, vid_y, WinBox.x1, WinBox.y1,
+ vid_w, vid_h, drw_w, drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr,
+ pDraw);
+
+ if ((ret == Success) &&
+ (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) {
+
+ xf86XVEnlistPortInWindow((WindowPtr) pDraw, portPriv);
+ portPriv->isOn = XV_ON;
+ portPriv->vid_x = vid_x;
+ portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w;
+ portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x;
+ portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w;
+ portPriv->drw_h = drw_h;
+ portPriv->type = 0; /* no mask means it's transient and should
+ not be reput once it's removed */
+ pPort->pDraw = pDraw; /* make sure we can get stop requests */
+ }
+
+ PUT_STILL_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if (!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
}
static int
-xf86XVGetVideo(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- int result;
-
- /* No pixmaps... For now anyhow */
- if(pDraw->type != DRAWABLE_WINDOW) {
- pPort->pDraw = (DrawablePtr)NULL;
- return BadAlloc;
- }
-
- /* If we are changing windows, unregister our port in the old window */
- if(portPriv->pDraw && (portPriv->pDraw != pDraw))
- xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
-
- /* Register our port with the new window */
- result = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- if(result != Success) return result;
-
- portPriv->type = XvOutputMask;
-
- /* save a copy of these parameters */
- portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
- portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
-
- /* make sure we have the most recent copy of the clientClip */
- xf86XVCopyClip(portPriv, pGC);
-
- /* To indicate to the DI layer that we were successful */
- pPort->pDraw = pDraw;
-
- if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
-
- return(xf86XVRegetVideo(portPriv));
+xf86XVGetVideo(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ int result;
+
+ /* No pixmaps... For now anyhow */
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ pPort->pDraw = (DrawablePtr) NULL;
+ return BadAlloc;
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if (portPriv->pDraw && (portPriv->pDraw != pDraw))
+ xf86XVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv);
+
+ /* Register our port with the new window */
+ result = xf86XVEnlistPortInWindow((WindowPtr) pDraw, portPriv);
+ if (result != Success)
+ return result;
+
+ portPriv->type = XvOutputMask;
+
+ /* save a copy of these parameters */
+ portPriv->vid_x = vid_x;
+ portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w;
+ portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x;
+ portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w;
+ portPriv->drw_h = drw_h;
+
+ /* make sure we have the most recent copy of the clientClip */
+ xf86XVCopyClip(portPriv, pGC);
+
+ /* To indicate to the DI layer that we were successful */
+ pPort->pDraw = pDraw;
+
+ if (!portPriv->pScrn->vtSema)
+ return Success; /* Success ? */
+
+ return (xf86XVRegetVideo(portPriv));
}
static int
-xf86XVGetStill(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- RegionInit(&WinRegion, &WinBox, 1);
- RegionNull(&ClipRegion);
- RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->pDraw) {
- xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
-
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto GET_STILL_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->GetStill)(portPriv->pScrn,
- vid_x, vid_y, WinBox.x1, WinBox.y1,
- vid_w, vid_h, drw_w, drw_h,
- &ClipRegion, portPriv->DevPriv.ptr,
- pDraw);
-
-GET_STILL_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
-}
+xf86XVGetStill(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if (!portPriv->pScrn->vtSema)
+ return Success; /* Success ? */
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionNull(&ClipRegion);
+ RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if (portPriv->pDraw) {
+ xf86XVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv);
+ }
+
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto GET_STILL_BAILOUT;
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->GetStill) (portPriv->pScrn,
+ vid_x, vid_y, WinBox.x1, WinBox.y1,
+ vid_w, vid_h, drw_w, drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr,
+ pDraw);
+ GET_STILL_BAILOUT:
+ if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
+}
static int
-xf86XVStopVideo(
- ClientPtr client,
- XvPortPtr pPort,
- DrawablePtr pDraw
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+xf86XVStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
- if(pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
- xf86XVRemovePortFromWindow((WindowPtr)pDraw, portPriv);
+ xf86XVRemovePortFromWindow((WindowPtr) pDraw, portPriv);
- if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+ if (!portPriv->pScrn->vtSema)
+ return Success; /* Success ? */
- /* Must free resources. */
+ /* Must free resources. */
- if(portPriv->isOn > XV_OFF) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->pScrn, portPriv->DevPriv.ptr, TRUE);
- portPriv->isOn = XV_OFF;
- }
+ if (portPriv->isOn > XV_OFF) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn,
+ portPriv->DevPriv.ptr, TRUE);
+ portPriv->isOn = XV_OFF;
+ }
- return Success;
+ return Success;
}
static int
-xf86XVSetPortAttribute(
- ClientPtr client,
- XvPortPtr pPort,
- Atom attribute,
- INT32 value
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->pScrn,
- attribute, value, portPriv->DevPriv.ptr));
-}
+xf86XVSetPortAttribute(ClientPtr client,
+ XvPortPtr pPort, Atom attribute, INT32 value)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ return ((*portPriv->AdaptorRec->SetPortAttribute) (portPriv->pScrn,
+ attribute, value,
+ portPriv->DevPriv.ptr));
+}
static int
-xf86XVGetPortAttribute(
- ClientPtr client,
- XvPortPtr pPort,
- Atom attribute,
- INT32 *p_value
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->pScrn,
- attribute, p_value, portPriv->DevPriv.ptr));
+xf86XVGetPortAttribute(ClientPtr client,
+ XvPortPtr pPort, Atom attribute, INT32 *p_value)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+
+ return ((*portPriv->AdaptorRec->GetPortAttribute) (portPriv->pScrn,
+ attribute, p_value,
+ portPriv->DevPriv.ptr));
}
+static int
+xf86XVQueryBestSize(ClientPtr client,
+ XvPortPtr pPort,
+ CARD8 motion,
+ CARD16 vid_w, CARD16 vid_h,
+ CARD16 drw_w, CARD16 drw_h,
+ unsigned int *p_w, unsigned int *p_h)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ (*portPriv->AdaptorRec->QueryBestSize) (portPriv->pScrn,
+ (Bool) motion, vid_w, vid_h, drw_w,
+ drw_h, p_w, p_h,
+ portPriv->DevPriv.ptr);
-static int
-xf86XVQueryBestSize(
- ClientPtr client,
- XvPortPtr pPort,
- CARD8 motion,
- CARD16 vid_w, CARD16 vid_h,
- CARD16 drw_w, CARD16 drw_h,
- unsigned int *p_w, unsigned int *p_h
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- (*portPriv->AdaptorRec->QueryBestSize)(portPriv->pScrn,
- (Bool)motion, vid_w, vid_h, drw_w, drw_h,
- p_w, p_h, portPriv->DevPriv.ptr);
-
- return Success;
+ return Success;
}
-
static int
-xf86XVPutImage(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
- GCPtr pGC,
- INT16 src_x, INT16 src_y,
- CARD16 src_w, CARD16 src_h,
- INT16 drw_x, INT16 drw_y,
- CARD16 drw_w, CARD16 drw_h,
- XvImagePtr format,
- unsigned char* data,
- Bool sync,
- CARD16 width, CARD16 height
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- RegionRec WinRegion;
- RegionRec ClipRegion;
- BoxRec WinBox;
- int ret = Success;
- Bool clippedAway = FALSE;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return BadAlloc;
-
- if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
-
- xf86XVCopyCompositeClip(portPriv, pGC, pDraw);
-
- WinBox.x1 = pDraw->x + drw_x;
- WinBox.y1 = pDraw->y + drw_y;
- WinBox.x2 = WinBox.x1 + drw_w;
- WinBox.y2 = WinBox.y1 + drw_h;
-
- RegionInit(&WinRegion, &WinBox, 1);
- RegionNull(&ClipRegion);
- RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
-
- if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
- RegionRec VPReg;
- BoxRec VPBox;
-
- VPBox.x1 = portPriv->pScrn->frameX0;
- VPBox.y1 = portPriv->pScrn->frameY0;
- VPBox.x2 = portPriv->pScrn->frameX1 + 1;
- VPBox.y2 = portPriv->pScrn->frameY1 + 1;
-
- RegionInit(&VPReg, &VPBox, 1);
- RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
- RegionUninit(&VPReg);
- }
-
- /* If we are changing windows, unregister our port in the old window */
- if(portPriv->pDraw && (portPriv->pDraw != pDraw))
- xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
-
- /* Register our port with the new window */
- ret = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
- if(ret != Success) goto PUT_IMAGE_BAILOUT;
-
- if(!RegionNotEmpty(&ClipRegion)) {
- clippedAway = TRUE;
- goto PUT_IMAGE_BAILOUT;
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
- BoxPtr clipBox = RegionRects(&ClipRegion);
- if( (RegionNumRects(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
- {
- clippedAway = TRUE;
- goto PUT_IMAGE_BAILOUT;
- }
- }
-
- if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
- }
-
- ret = (*portPriv->AdaptorRec->PutImage)(portPriv->pScrn,
- src_x, src_y, WinBox.x1, WinBox.y1,
- src_w, src_h, drw_w, drw_h, format->id, data, width, height,
- sync, &ClipRegion, portPriv->DevPriv.ptr,
- pDraw);
-
- if((ret == Success) &&
- (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
-
- portPriv->isOn = XV_ON;
- portPriv->vid_x = src_x; portPriv->vid_y = src_y;
- portPriv->vid_w = src_w; portPriv->vid_h = src_h;
- portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
- portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
- portPriv->type = 0; /* no mask means it's transient and should
- not be reput once it's removed */
- pPort->pDraw = pDraw; /* make sure we can get stop requests */
- }
-
-PUT_IMAGE_BAILOUT:
-
- if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
- (*portPriv->AdaptorRec->StopVideo)(
- portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
- portPriv->isOn = XV_PENDING;
- }
-
- /* This clip was copied and only good for one shot */
- if(!portPriv->FreeCompositeClip)
- portPriv->pCompositeClip = NULL;
-
- RegionUninit(&WinRegion);
- RegionUninit(&ClipRegion);
-
- return ret;
+xf86XVPutImage(ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 src_x, INT16 src_y,
+ CARD16 src_w, CARD16 src_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h,
+ XvImagePtr format,
+ unsigned char *data, Bool sync, CARD16 width, CARD16 height)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if (!portPriv->pScrn->vtSema)
+ return Success; /* Success ? */
+
+ xf86XVCopyCompositeClip(portPriv, pGC, pDraw);
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ RegionInit(&WinRegion, &WinBox, 1);
+ RegionNull(&ClipRegion);
+ RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if (portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = portPriv->pScrn->frameX0;
+ VPBox.y1 = portPriv->pScrn->frameY0;
+ VPBox.x2 = portPriv->pScrn->frameX1 + 1;
+ VPBox.y2 = portPriv->pScrn->frameY1 + 1;
+
+ RegionInit(&VPReg, &VPBox, 1);
+ RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
+ RegionUninit(&VPReg);
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if (portPriv->pDraw && (portPriv->pDraw != pDraw))
+ xf86XVRemovePortFromWindow((WindowPtr) (portPriv->pDraw), portPriv);
+
+ /* Register our port with the new window */
+ ret = xf86XVEnlistPortInWindow((WindowPtr) pDraw, portPriv);
+ if (ret != Success)
+ goto PUT_IMAGE_BAILOUT;
+
+ if (!RegionNotEmpty(&ClipRegion)) {
+ clippedAway = TRUE;
+ goto PUT_IMAGE_BAILOUT;
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = RegionRects(&ClipRegion);
+
+ if ((RegionNumRects(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
+ clippedAway = TRUE;
+ goto PUT_IMAGE_BAILOUT;
+ }
+ }
+
+ if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutImage) (portPriv->pScrn,
+ src_x, src_y, WinBox.x1, WinBox.y1,
+ src_w, src_h, drw_w, drw_h,
+ format->id, data, width, height,
+ sync, &ClipRegion,
+ portPriv->DevPriv.ptr, pDraw);
+
+ if ((ret == Success) &&
+ (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
+
+ portPriv->isOn = XV_ON;
+ portPriv->vid_x = src_x;
+ portPriv->vid_y = src_y;
+ portPriv->vid_w = src_w;
+ portPriv->vid_h = src_h;
+ portPriv->drw_x = drw_x;
+ portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w;
+ portPriv->drw_h = drw_h;
+ portPriv->type = 0; /* no mask means it's transient and should
+ not be reput once it's removed */
+ pPort->pDraw = pDraw; /* make sure we can get stop requests */
+ }
+
+ PUT_IMAGE_BAILOUT:
+
+ if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo) (portPriv->pScrn,
+ portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if (!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ RegionUninit(&WinRegion);
+ RegionUninit(&ClipRegion);
+
+ return ret;
}
+static int
+xf86XVQueryImageAttributes(ClientPtr client,
+ XvPortPtr pPort,
+ XvImagePtr format,
+ CARD16 *width,
+ CARD16 *height, int *pitches, int *offsets)
+{
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
-static int
-xf86XVQueryImageAttributes(
- ClientPtr client,
- XvPortPtr pPort,
- XvImagePtr format,
- CARD16 *width,
- CARD16 *height,
- int *pitches,
- int *offsets
-){
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->pScrn,
- format->id, width, height, pitches, offsets);
+ return (*portPriv->AdaptorRec->QueryImageAttributes) (portPriv->pScrn,
+ format->id, width,
+ height, pitches,
+ offsets);
}
void
-xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
+xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
{
- ScreenPtr pScreen = pDraw->pScreen;
- ChangeGCVal pval[2];
- BoxPtr pbox = RegionRects(fillboxes);
- int i, nbox = RegionNumRects(fillboxes);
- xRectangle *rects;
- GCPtr gc;
-
- if(!xf86Screens[pScreen->myNum]->vtSema) return;
-
- gc = GetScratchGC(pDraw->depth, pScreen);
- pval[0].val = key;
- pval[1].val = IncludeInferiors;
- (void) ChangeGC(NullClient, gc, GCForeground|GCSubwindowMode, pval);
- ValidateGC(pDraw, gc);
-
- rects = malloc(nbox * sizeof(xRectangle));
-
- for(i = 0; i < nbox; i++, pbox++)
- {
- rects[i].x = pbox->x1 - pDraw->x;
- rects[i].y = pbox->y1 - pDraw->y;
- rects[i].width = pbox->x2 - pbox->x1;
- rects[i].height = pbox->y2 - pbox->y1;
- }
-
- (*gc->ops->PolyFillRect)(pDraw, gc, nbox, rects);
-
- free(rects);
- FreeScratchGC (gc);
+ ScreenPtr pScreen = pDraw->pScreen;
+ ChangeGCVal pval[2];
+ BoxPtr pbox = RegionRects(fillboxes);
+ int i, nbox = RegionNumRects(fillboxes);
+ xRectangle *rects;
+ GCPtr gc;
+
+ if (!xf86Screens[pScreen->myNum]->vtSema)
+ return;
+
+ gc = GetScratchGC(pDraw->depth, pScreen);
+ pval[0].val = key;
+ pval[1].val = IncludeInferiors;
+ (void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
+ ValidateGC(pDraw, gc);
+
+ rects = malloc(nbox * sizeof(xRectangle));
+
+ for (i = 0; i < nbox; i++, pbox++) {
+ rects[i].x = pbox->x1 - pDraw->x;
+ rects[i].y = pbox->y1 - pDraw->y;
+ rects[i].width = pbox->x2 - pbox->x1;
+ rects[i].height = pbox->y2 - pbox->y1;
+ }
+
+ (*gc->ops->PolyFillRect) (pDraw, gc, nbox, rects);
+
+ free(rects);
+ FreeScratchGC(gc);
}
void
-xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr fillboxes)
+xf86XVFillKeyHelper(ScreenPtr pScreen, CARD32 key, RegionPtr fillboxes)
{
- xf86XVFillKeyHelperDrawable (&pScreen->root->drawable, key, fillboxes);
+ xf86XVFillKeyHelperDrawable(&pScreen->root->drawable, key, fillboxes);
}
void
-xf86XVFillKeyHelperPort (DrawablePtr pDraw, pointer data, CARD32 key, RegionPtr clipboxes, Bool fillEverything)
+xf86XVFillKeyHelperPort(DrawablePtr pDraw, pointer data, CARD32 key,
+ RegionPtr clipboxes, Bool fillEverything)
{
- WindowPtr pWin = (WindowPtr)pDraw;
+ WindowPtr pWin = (WindowPtr) pDraw;
XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
XvPortRecPrivatePtr portPriv = NULL;
RegionRec reg;
RegionPtr fillboxes;
while (WinPriv) {
- XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
+ XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
- if (data == pPriv->DevPriv.ptr) {
- portPriv = pPriv;
- break;
- }
+ if (data == pPriv->DevPriv.ptr) {
+ portPriv = pPriv;
+ break;
+ }
- WinPriv = WinPriv->next;
+ WinPriv = WinPriv->next;
}
if (!portPriv)
- return;
+ return;
if (!portPriv->ckeyFilled)
- portPriv->ckeyFilled = RegionCreate(NULL, 0);
+ portPriv->ckeyFilled = RegionCreate(NULL, 0);
if (!fillEverything) {
- RegionNull(&reg);
- fillboxes = &reg;
- RegionSubtract(fillboxes, clipboxes, portPriv->ckeyFilled);
-
- if (!RegionNotEmpty(fillboxes))
- goto out;
- } else
- fillboxes = clipboxes;
+ RegionNull(&reg);
+ fillboxes = &reg;
+ RegionSubtract(fillboxes, clipboxes, portPriv->ckeyFilled);
+ if (!RegionNotEmpty(fillboxes))
+ goto out;
+ }
+ else
+ fillboxes = clipboxes;
RegionCopy(portPriv->ckeyFilled, clipboxes);
xf86XVFillKeyHelperDrawable(pDraw, key, fillboxes);
-out:
+ out:
if (!fillEverything)
RegionUninit(&reg);
}
-
/* xf86XVClipVideoHelper -
Takes the dst box in standard X BoxRec form (top and left
@@ -2012,16 +1986,12 @@ out:
*/
Bool
-xf86XVClipVideoHelper(
- BoxPtr dst,
- INT32 *xa,
- INT32 *xb,
- INT32 *ya,
- INT32 *yb,
- RegionPtr reg,
- INT32 width,
- INT32 height
-){
+xf86XVClipVideoHelper(BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb, RegionPtr reg, INT32 width, INT32 height)
+{
double xsw, xdw, ysw, ydw;
INT32 delta;
BoxPtr extents = RegionExtents(reg);
@@ -2032,159 +2002,168 @@ xf86XVClipVideoHelper(
ysw = (*yb - *ya) << 16;
ydw = dst->y2 - dst->y1;
- *xa <<= 16; *xb <<= 16;
- *ya <<= 16; *yb <<= 16;
+ *xa <<= 16;
+ *xb <<= 16;
+ *ya <<= 16;
+ *yb <<= 16;
diff = extents->x1 - dst->x1;
if (diff > 0) {
- dst->x1 = extents->x1;
- *xa += (diff * xsw) / xdw;
+ dst->x1 = extents->x1;
+ *xa += (diff * xsw) / xdw;
}
diff = dst->x2 - extents->x2;
if (diff > 0) {
- dst->x2 = extents->x2;
- *xb -= (diff * xsw) / xdw;
+ dst->x2 = extents->x2;
+ *xb -= (diff * xsw) / xdw;
}
diff = extents->y1 - dst->y1;
if (diff > 0) {
- dst->y1 = extents->y1;
- *ya += (diff * ysw) / ydw;
+ dst->y1 = extents->y1;
+ *ya += (diff * ysw) / ydw;
}
diff = dst->y2 - extents->y2;
if (diff > 0) {
- dst->y2 = extents->y2;
- *yb -= (diff * ysw) / ydw;
+ dst->y2 = extents->y2;
+ *yb -= (diff * ysw) / ydw;
}
if (*xa < 0) {
- diff = (((-*xa) * xdw) + xsw - 1) / xsw;
- dst->x1 += diff;
- *xa += (diff * xsw) / xdw;
+ diff = (((-*xa) * xdw) + xsw - 1) / xsw;
+ dst->x1 += diff;
+ *xa += (diff * xsw) / xdw;
}
delta = *xb - (width << 16);
if (delta > 0) {
- diff = ((delta * xdw) + xsw - 1) / xsw;
- dst->x2 -= diff;
- *xb -= (diff * xsw) / xdw;
+ diff = ((delta * xdw) + xsw - 1) / xsw;
+ dst->x2 -= diff;
+ *xb -= (diff * xsw) / xdw;
}
- if (*xa >= *xb) return FALSE;
+ if (*xa >= *xb)
+ return FALSE;
if (*ya < 0) {
- diff = (((-*ya) * ydw) + ysw - 1) / ysw;
- dst->y1 += diff;
- *ya += (diff * ysw) / ydw;
+ diff = (((-*ya) * ydw) + ysw - 1) / ysw;
+ dst->y1 += diff;
+ *ya += (diff * ysw) / ydw;
}
delta = *yb - (height << 16);
if (delta > 0) {
- diff = ((delta * ydw) + ysw - 1) / ysw;
- dst->y2 -= diff;
- *yb -= (diff * ysw) / ydw;
+ diff = ((delta * ydw) + ysw - 1) / ysw;
+ dst->y2 -= diff;
+ *yb -= (diff * ysw) / ydw;
}
- if (*ya >= *yb) return FALSE;
+ if (*ya >= *yb)
+ return FALSE;
if ((dst->x1 > extents->x1) || (dst->x2 < extents->x2) ||
- (dst->y1 > extents->y1) || (dst->y2 < extents->y2))
- {
- RegionRec clipReg;
- RegionInit(&clipReg, dst, 1);
- RegionIntersect(reg, reg, &clipReg);
- RegionUninit(&clipReg);
+ (dst->y1 > extents->y1) || (dst->y2 < extents->y2)) {
+ RegionRec clipReg;
+
+ RegionInit(&clipReg, dst, 1);
+ RegionIntersect(reg, reg, &clipReg);
+ RegionUninit(&clipReg);
}
return TRUE;
}
void
-xf86XVCopyYUV12ToPacked(
- const void *srcy,
- const void *srcv,
- const void *srcu,
- void *dst,
- int srcPitchy,
- int srcPitchuv,
- int dstPitch,
- int h,
- int w
-){
+xf86XVCopyYUV12ToPacked(const void *srcy,
+ const void *srcv,
+ const void *srcu,
+ void *dst,
+ int srcPitchy,
+ int srcPitchuv, int dstPitch, int h, int w)
+{
CARD32 *Dst;
const CARD8 *Y, *U, *V;
int i, j;
w >>= 1;
- for (j = 0; j < h; j++) {
- Dst = dst;
- Y = srcy; V = srcv; U = srcu;
- i = w;
- while (i >= 4) {
+ for (j = 0; j < h; j++) {
+ Dst = dst;
+ Y = srcy;
+ V = srcv;
+ U = srcu;
+ i = w;
+ while (i >= 4) {
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24);
- Dst[1] = Y[2] | (Y[3] << 16) | (U[1] << 8) | (V[1] << 24);
- Dst[2] = Y[4] | (Y[5] << 16) | (U[2] << 8) | (V[2] << 24);
- Dst[3] = Y[6] | (Y[7] << 16) | (U[3] << 8) | (V[3] << 24);
+ Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24);
+ Dst[1] = Y[2] | (Y[3] << 16) | (U[1] << 8) | (V[1] << 24);
+ Dst[2] = Y[4] | (Y[5] << 16) | (U[2] << 8) | (V[2] << 24);
+ Dst[3] = Y[6] | (Y[7] << 16) | (U[3] << 8) | (V[3] << 24);
#else
- /* This assumes a little-endian framebuffer */
- Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0];
- Dst[1] = (Y[2] << 24) | (Y[3] << 8) | (U[1] << 16) | V[1];
- Dst[2] = (Y[4] << 24) | (Y[5] << 8) | (U[2] << 16) | V[2];
- Dst[3] = (Y[6] << 24) | (Y[7] << 8) | (U[3] << 16) | V[3];
+ /* This assumes a little-endian framebuffer */
+ Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0];
+ Dst[1] = (Y[2] << 24) | (Y[3] << 8) | (U[1] << 16) | V[1];
+ Dst[2] = (Y[4] << 24) | (Y[5] << 8) | (U[2] << 16) | V[2];
+ Dst[3] = (Y[6] << 24) | (Y[7] << 8) | (U[3] << 16) | V[3];
#endif
- Dst += 4; Y += 8; V += 4; U += 4;
- i -= 4;
- }
-
- while (i--) {
+ Dst += 4;
+ Y += 8;
+ V += 4;
+ U += 4;
+ i -= 4;
+ }
+
+ while (i--) {
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24);
+ Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24);
#else
- /* This assumes a little-endian framebuffer */
- Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0];
+ /* This assumes a little-endian framebuffer */
+ Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0];
#endif
- Dst++; Y += 2; V++; U++;
- }
-
- dst = (CARD8 *)dst + dstPitch;
- srcy = (const CARD8 *)srcy + srcPitchy;
- if (j & 1) {
- srcu = (const CARD8 *)srcu + srcPitchuv;
- srcv = (const CARD8 *)srcv + srcPitchuv;
- }
+ Dst++;
+ Y += 2;
+ V++;
+ U++;
+ }
+
+ dst = (CARD8 *) dst + dstPitch;
+ srcy = (const CARD8 *) srcy + srcPitchy;
+ if (j & 1) {
+ srcu = (const CARD8 *) srcu + srcPitchuv;
+ srcv = (const CARD8 *) srcv + srcPitchuv;
+ }
}
}
void
-xf86XVCopyPacked(
- const void *src,
- void *dst,
- int srcPitch,
- int dstPitch,
- int h,
- int w
-){
+xf86XVCopyPacked(const void *src,
+ void *dst, int srcPitch, int dstPitch, int h, int w)
+{
const CARD32 *Src;
CARD32 *Dst;
int i;
w >>= 1;
while (--h >= 0) {
- do {
- Dst = dst; Src = src;
- i = w;
- while (i >= 4) {
- Dst[0] = Src[0];
- Dst[1] = Src[1];
- Dst[2] = Src[2];
- Dst[3] = Src[3];
- Dst += 4; Src += 4; i -= 4;
- }
- if (!i) break;
- Dst[0] = Src[0];
- if (i == 1) break;
- Dst[1] = Src[1];
- if (i == 2) break;
- Dst[2] = Src[2];
- } while (0);
-
- src = (const CARD8 *)src + srcPitch;
- dst = (CARD8 *)dst + dstPitch;
+ do {
+ Dst = dst;
+ Src = src;
+ i = w;
+ while (i >= 4) {
+ Dst[0] = Src[0];
+ Dst[1] = Src[1];
+ Dst[2] = Src[2];
+ Dst[3] = Src[3];
+ Dst += 4;
+ Src += 4;
+ i -= 4;
+ }
+ if (!i)
+ break;
+ Dst[0] = Src[0];
+ if (i == 1)
+ break;
+ Dst[1] = Src[1];
+ if (i == 2)
+ break;
+ Dst[2] = Src[2];
+ } while (0);
+
+ src = (const CARD8 *) src + srcPitch;
+ dst = (CARD8 *) dst + dstPitch;
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86xv.h b/xorg-server/hw/xfree86/common/xf86xv.h
index 08e5c790d..2db00a83f 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.h
+++ b/xorg-server/hw/xfree86/common/xf86xv.h
@@ -1,289 +1,270 @@
-
-/*
- * Copyright (c) 1998-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifndef _XF86XV_H_
-#define _XF86XV_H_
-
-#include "xvdix.h"
-#include "xf86str.h"
-
-#define VIDEO_NO_CLIPPING 0x00000001
-#define VIDEO_INVERT_CLIPLIST 0x00000002
-#define VIDEO_OVERLAID_IMAGES 0x00000004
-#define VIDEO_OVERLAID_STILLS 0x00000008
-/*
- * Usage of VIDEO_CLIP_TO_VIEWPORT is not recommended.
- * It can make reput behaviour inconsistent.
- */
-#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
-
-typedef struct {
- int id;
- int type;
- int byte_order;
- unsigned char guid[16];
- int bits_per_pixel;
- int format;
- int num_planes;
-
- /* for RGB formats only */
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
-
- /* for YUV formats only */
- unsigned int y_sample_bits;
- unsigned int u_sample_bits;
- unsigned int v_sample_bits;
- unsigned int horz_y_period;
- unsigned int horz_u_period;
- unsigned int horz_v_period;
- unsigned int vert_y_period;
- unsigned int vert_u_period;
- unsigned int vert_v_period;
- char component_order[32];
- int scanline_order;
-} XF86ImageRec, *XF86ImagePtr;
-
-
-typedef struct {
- ScrnInfoPtr pScrn;
- int id;
- unsigned short width, height;
- int *pitches; /* bytes */
- int *offsets; /* in bytes from start of framebuffer */
- DevUnion devPrivate;
-} XF86SurfaceRec, *XF86SurfacePtr;
-
-
-typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
-typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
-typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
-typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn,
- short vid_x, short vid_y, short drw_x, short drw_y,
- short vid_w, short vid_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
-typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, pointer data, Bool Exit);
-typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute,
- INT32 value, pointer data);
-typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute,
- INT32 *value, pointer data);
-typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn, Bool motion,
- short vid_w, short vid_h, short drw_w, short drw_h,
- unsigned int *p_w, unsigned int *p_h, pointer data);
-typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn,
- short src_x, short src_y, short drw_x, short drw_y,
- short src_w, short src_h, short drw_w, short drw_h,
- int image, unsigned char* buf, short width, short height, Bool Sync,
- RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
-typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn,
- short src_x, short src_y, short drw_x, short drw_y,
- short src_w, short src_h, short drw_w, short drw_h,
- RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
-typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn,
- int image, unsigned short *width, unsigned short *height,
- int *pitches, int *offsets);
-typedef void (*ClipNotifyFuncPtr)(ScrnInfoPtr pScrn, pointer data,
- WindowPtr window, int dx, int dy);
-
-typedef enum {
- XV_OFF,
- XV_PENDING,
- XV_ON
-} XvStatus;
-
-/*** this is what the driver needs to fill out ***/
-
-typedef struct {
- int id;
- char *name;
- unsigned short width, height;
- XvRationalRec rate;
-} XF86VideoEncodingRec, *XF86VideoEncodingPtr;
-
-typedef struct {
- char depth;
- short class;
-} XF86VideoFormatRec, *XF86VideoFormatPtr;
-
-typedef struct {
- int flags;
- int min_value;
- int max_value;
- char *name;
-} XF86AttributeRec, *XF86AttributePtr;
-
-typedef struct {
- unsigned int type;
- int flags;
- char *name;
- int nEncodings;
- XF86VideoEncodingPtr pEncodings;
- int nFormats;
- XF86VideoFormatPtr pFormats;
- int nPorts;
- DevUnion *pPortPrivates;
- int nAttributes;
- XF86AttributePtr pAttributes;
- int nImages;
- XF86ImagePtr pImages;
- PutVideoFuncPtr PutVideo;
- PutStillFuncPtr PutStill;
- GetVideoFuncPtr GetVideo;
- GetStillFuncPtr GetStill;
- StopVideoFuncPtr StopVideo;
- SetPortAttributeFuncPtr SetPortAttribute;
- GetPortAttributeFuncPtr GetPortAttribute;
- QueryBestSizeFuncPtr QueryBestSize;
- PutImageFuncPtr PutImage;
- ReputImageFuncPtr ReputImage; /* image/still */
- QueryImageAttributesFuncPtr QueryImageAttributes;
- ClipNotifyFuncPtr ClipNotify;
-} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
-
-typedef struct {
- XF86ImagePtr image;
- int flags;
- int (*alloc_surface)(ScrnInfoPtr pScrn,
- int id,
- unsigned short width,
- unsigned short height,
- XF86SurfacePtr surface);
- int (*free_surface)(XF86SurfacePtr surface);
- int (*display) (XF86SurfacePtr surface,
- short vid_x, short vid_y,
- short drw_x, short drw_y,
- short vid_w, short vid_h,
- short drw_w, short drw_h,
- RegionPtr clipBoxes);
- int (*stop) (XF86SurfacePtr surface);
- int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value);
- int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value);
- int max_width;
- int max_height;
- int num_attributes;
- XF86AttributePtr attributes;
-} XF86OffscreenImageRec, *XF86OffscreenImagePtr;
-
-extern _X_EXPORT Bool
-xf86XVScreenInit(
- ScreenPtr pScreen,
- XF86VideoAdaptorPtr *Adaptors,
- int num
-);
-
-typedef int (* xf86XVInitGenericAdaptorPtr)(ScrnInfoPtr pScrn,
- XF86VideoAdaptorPtr **Adaptors);
-
-extern _X_EXPORT int
-xf86XVRegisterGenericAdaptorDriver(
- xf86XVInitGenericAdaptorPtr InitFunc
-);
-
-extern _X_EXPORT int
-xf86XVListGenericAdaptors(
- ScrnInfoPtr pScrn,
- XF86VideoAdaptorPtr **Adaptors
-);
-
-extern _X_EXPORT Bool
-xf86XVRegisterOffscreenImages(
- ScreenPtr pScreen,
- XF86OffscreenImagePtr images,
- int num
-);
-
-extern _X_EXPORT XF86OffscreenImagePtr
-xf86XVQueryOffscreenImages(
- ScreenPtr pScreen,
- int *num
-);
-
-extern _X_EXPORT XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn);
-
-extern _X_EXPORT void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
-
-extern _X_EXPORT void
-xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
-
-extern _X_EXPORT void
-xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
-
-extern _X_EXPORT void
-xf86XVFillKeyHelperPort (DrawablePtr pDraw, pointer data, CARD32 key, RegionPtr clipboxes, Bool fillEverything);
-
-extern _X_EXPORT Bool
-xf86XVClipVideoHelper(
- BoxPtr dst,
- INT32 *xa,
- INT32 *xb,
- INT32 *ya,
- INT32 *yb,
- RegionPtr reg,
- INT32 width,
- INT32 height
-);
-
-extern _X_EXPORT void
-xf86XVCopyYUV12ToPacked(
- const void *srcy,
- const void *srcv,
- const void *srcu,
- void *dst,
- int srcPitchy,
- int srcPitchuv,
- int dstPitch,
- int h,
- int w
-);
-
-extern _X_EXPORT void
-xf86XVCopyPacked(
- const void *src,
- void *dst,
- int srcPitch,
- int dstPitch,
- int h,
- int w
-);
-
-extern _X_EXPORT DevPrivateKey (*XvGetScreenKeyProc)(void);
-extern _X_EXPORT unsigned long (*XvGetRTPortProc)(void);
-extern _X_EXPORT int (*XvScreenInitProc)(ScreenPtr);
-
-#endif /* _XF86XV_H_ */
+
+/*
+ * Copyright (c) 1998-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _XF86XV_H_
+#define _XF86XV_H_
+
+#include "xvdix.h"
+#include "xf86str.h"
+
+#define VIDEO_NO_CLIPPING 0x00000001
+#define VIDEO_INVERT_CLIPLIST 0x00000002
+#define VIDEO_OVERLAID_IMAGES 0x00000004
+#define VIDEO_OVERLAID_STILLS 0x00000008
+/*
+ * Usage of VIDEO_CLIP_TO_VIEWPORT is not recommended.
+ * It can make reput behaviour inconsistent.
+ */
+#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
+
+typedef struct {
+ int id;
+ int type;
+ int byte_order;
+ unsigned char guid[16];
+ int bits_per_pixel;
+ int format;
+ int num_planes;
+
+ /* for RGB formats only */
+ int depth;
+ unsigned int red_mask;
+ unsigned int green_mask;
+ unsigned int blue_mask;
+
+ /* for YUV formats only */
+ unsigned int y_sample_bits;
+ unsigned int u_sample_bits;
+ unsigned int v_sample_bits;
+ unsigned int horz_y_period;
+ unsigned int horz_u_period;
+ unsigned int horz_v_period;
+ unsigned int vert_y_period;
+ unsigned int vert_u_period;
+ unsigned int vert_v_period;
+ char component_order[32];
+ int scanline_order;
+} XF86ImageRec, *XF86ImagePtr;
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ int id;
+ unsigned short width, height;
+ int *pitches; /* bytes */
+ int *offsets; /* in bytes from start of framebuffer */
+ DevUnion devPrivate;
+} XF86SurfaceRec, *XF86SurfacePtr;
+
+typedef int (*PutVideoFuncPtr) (ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x,
+ short drw_y, short vid_w, short vid_h,
+ short drw_w, short drw_h, RegionPtr clipBoxes,
+ pointer data, DrawablePtr pDraw);
+typedef int (*PutStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
+ short drw_x, short drw_y, short vid_w,
+ short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data,
+ DrawablePtr pDraw);
+typedef int (*GetVideoFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
+ short drw_x, short drw_y, short vid_w,
+ short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data,
+ DrawablePtr pDraw);
+typedef int (*GetStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
+ short drw_x, short drw_y, short vid_w,
+ short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data,
+ DrawablePtr pDraw);
+typedef void (*StopVideoFuncPtr) (ScrnInfoPtr pScrn, pointer data, Bool Exit);
+typedef int (*SetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute,
+ INT32 value, pointer data);
+typedef int (*GetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute,
+ INT32 *value, pointer data);
+typedef void (*QueryBestSizeFuncPtr) (ScrnInfoPtr pScrn, Bool motion,
+ short vid_w, short vid_h, short drw_w,
+ short drw_h, unsigned int *p_w,
+ unsigned int *p_h, pointer data);
+typedef int (*PutImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y,
+ short drw_x, short drw_y, short src_w,
+ short src_h, short drw_w, short drw_h,
+ int image, unsigned char *buf, short width,
+ short height, Bool Sync, RegionPtr clipBoxes,
+ pointer data, DrawablePtr pDraw);
+typedef int (*ReputImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y,
+ short drw_x, short drw_y, short src_w,
+ short src_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data,
+ DrawablePtr pDraw);
+typedef int (*QueryImageAttributesFuncPtr) (ScrnInfoPtr pScrn, int image,
+ unsigned short *width,
+ unsigned short *height,
+ int *pitches, int *offsets);
+typedef void (*ClipNotifyFuncPtr) (ScrnInfoPtr pScrn, pointer data,
+ WindowPtr window, int dx, int dy);
+
+typedef enum {
+ XV_OFF,
+ XV_PENDING,
+ XV_ON
+} XvStatus;
+
+/*** this is what the driver needs to fill out ***/
+
+typedef struct {
+ int id;
+ char *name;
+ unsigned short width, height;
+ XvRationalRec rate;
+} XF86VideoEncodingRec, *XF86VideoEncodingPtr;
+
+typedef struct {
+ char depth;
+ short class;
+} XF86VideoFormatRec, *XF86VideoFormatPtr;
+
+typedef struct {
+ int flags;
+ int min_value;
+ int max_value;
+ char *name;
+} XF86AttributeRec, *XF86AttributePtr;
+
+typedef struct {
+ unsigned int type;
+ int flags;
+ char *name;
+ int nEncodings;
+ XF86VideoEncodingPtr pEncodings;
+ int nFormats;
+ XF86VideoFormatPtr pFormats;
+ int nPorts;
+ DevUnion *pPortPrivates;
+ int nAttributes;
+ XF86AttributePtr pAttributes;
+ int nImages;
+ XF86ImagePtr pImages;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+ PutImageFuncPtr PutImage;
+ ReputImageFuncPtr ReputImage; /* image/still */
+ QueryImageAttributesFuncPtr QueryImageAttributes;
+ ClipNotifyFuncPtr ClipNotify;
+} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
+
+typedef struct {
+ XF86ImagePtr image;
+ int flags;
+ int (*alloc_surface) (ScrnInfoPtr pScrn,
+ int id,
+ unsigned short width,
+ unsigned short height, XF86SurfacePtr surface);
+ int (*free_surface) (XF86SurfacePtr surface);
+ int (*display) (XF86SurfacePtr surface,
+ short vid_x, short vid_y,
+ short drw_x, short drw_y,
+ short vid_w, short vid_h,
+ short drw_w, short drw_h, RegionPtr clipBoxes);
+ int (*stop) (XF86SurfacePtr surface);
+ int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value);
+ int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value);
+ int max_width;
+ int max_height;
+ int num_attributes;
+ XF86AttributePtr attributes;
+} XF86OffscreenImageRec, *XF86OffscreenImagePtr;
+
+extern _X_EXPORT Bool
+ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * Adaptors, int num);
+
+typedef int (*xf86XVInitGenericAdaptorPtr) (ScrnInfoPtr pScrn,
+ XF86VideoAdaptorPtr ** Adaptors);
+
+extern _X_EXPORT int
+ xf86XVRegisterGenericAdaptorDriver(xf86XVInitGenericAdaptorPtr InitFunc);
+
+extern _X_EXPORT int
+ xf86XVListGenericAdaptors(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr ** Adaptors);
+
+extern _X_EXPORT Bool
+
+xf86XVRegisterOffscreenImages(ScreenPtr pScreen,
+ XF86OffscreenImagePtr images, int num);
+
+extern _X_EXPORT XF86OffscreenImagePtr
+xf86XVQueryOffscreenImages(ScreenPtr pScreen, int *num);
+
+extern _X_EXPORT XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr
+ pScrn);
+
+extern _X_EXPORT void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
+
+extern _X_EXPORT void
+ xf86XVFillKeyHelper(ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
+
+extern _X_EXPORT void
+
+xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
+
+extern _X_EXPORT void
+
+xf86XVFillKeyHelperPort(DrawablePtr pDraw, pointer data, CARD32 key,
+ RegionPtr clipboxes, Bool fillEverything);
+
+extern _X_EXPORT Bool
+
+xf86XVClipVideoHelper(BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb, RegionPtr reg, INT32 width, INT32 height);
+
+extern _X_EXPORT void
+
+xf86XVCopyYUV12ToPacked(const void *srcy,
+ const void *srcv,
+ const void *srcu,
+ void *dst,
+ int srcPitchy,
+ int srcPitchuv, int dstPitch, int h, int w);
+
+extern _X_EXPORT void
+
+xf86XVCopyPacked(const void *src,
+ void *dst, int srcPitch, int dstPitch, int h, int w);
+
+extern _X_EXPORT DevPrivateKey (*XvGetScreenKeyProc) (void);
+extern _X_EXPORT unsigned long (*XvGetRTPortProc) (void);
+extern _X_EXPORT int (*XvScreenInitProc) (ScreenPtr);
+
+#endif /* _XF86XV_H_ */
diff --git a/xorg-server/hw/xfree86/common/xf86xvmc.c b/xorg-server/hw/xfree86/common/xf86xvmc.c
index 5a7f69d8a..e58465289 100644
--- a/xorg-server/hw/xfree86/common/xf86xvmc.c
+++ b/xorg-server/hw/xfree86/common/xf86xvmc.c
@@ -1,232 +1,224 @@
-
-/*
- * Copyright (c) 2001-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "scrnintstr.h"
-#include "resource.h"
-#include "dixstruct.h"
-
-#include "xvmodproc.h"
-
-#include "xf86xvpriv.h"
-#include "xf86xvmc.h"
-
-XvMCScreenInitProcPtr XvMCScreenInitProc = NULL;
-
-
-typedef struct {
- CloseScreenProcPtr CloseScreen;
- int num_adaptors;
- XF86MCAdaptorPtr *adaptors;
- XvMCAdaptorPtr dixinfo;
-} xf86XvMCScreenRec, *xf86XvMCScreenPtr;
-
-static DevPrivateKeyRec XF86XvMCScreenKeyRec;
-#define XF86XvMCScreenKey (&XF86XvMCScreenKeyRec)
-
-#define XF86XVMC_GET_PRIVATE(pScreen) (xf86XvMCScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, XF86XvMCScreenKey)
-
-
-static int
-xf86XvMCCreateContext (
- XvPortPtr pPort,
- XvMCContextPtr pContext,
- int *num_priv,
- CARD32 **priv
-)
-{
- xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
-
- pContext->port_priv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateContext)(
- pScrn, pContext, num_priv, priv);
-}
-
-static void
-xf86XvMCDestroyContext ( XvMCContextPtr pContext)
-{
- xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
-
- (*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext)(
- pScrn, pContext);
-}
-
-static int
-xf86XvMCCreateSurface (
- XvMCSurfacePtr pSurface,
- int *num_priv,
- CARD32 **priv
-)
-{
- XvMCContextPtr pContext = pSurface->context;
- xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
-
- return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface)(
- pScrn, pSurface, num_priv, priv);
-}
-
-static void
-xf86XvMCDestroySurface (XvMCSurfacePtr pSurface)
-{
- XvMCContextPtr pContext = pSurface->context;
- xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
-
- (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface)(
- pScrn, pSurface);
-}
-
-static int
-xf86XvMCCreateSubpicture (
- XvMCSubpicturePtr pSubpicture,
- int *num_priv,
- CARD32 **priv
-)
-{
- XvMCContextPtr pContext = pSubpicture->context;
- xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
-
- return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSubpicture)(
- pScrn, pSubpicture, num_priv, priv);
-}
-
-static void
-xf86XvMCDestroySubpicture (XvMCSubpicturePtr pSubpicture)
-{
- XvMCContextPtr pContext = pSubpicture->context;
- xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
-
- (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture)(
- pScrn, pSubpicture);
-}
-
-
-static Bool
-xf86XvMCCloseScreen (int i, ScreenPtr pScreen)
-{
- xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen);
-
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
-
- free(pScreenPriv->dixinfo);
- free(pScreenPriv);
-
- return (*pScreen->CloseScreen)(i, pScreen);
-}
-
-Bool xf86XvMCScreenInit(
- ScreenPtr pScreen,
- int num_adaptors,
- XF86MCAdaptorPtr *adaptors
-)
-{
- XvMCAdaptorPtr pAdapt;
- xf86XvMCScreenPtr pScreenPriv;
- XvScreenPtr pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- XF86XvScreenKey);
- int i, j;
-
- if(!XvMCScreenInitProc) return FALSE;
-
- if(!(pAdapt = malloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
- return FALSE;
-
- if (!dixRegisterPrivateKey(&XF86XvMCScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- if(!(pScreenPriv = malloc(sizeof(xf86XvMCScreenRec)))) {
- free(pAdapt);
- return FALSE;
- }
-
- dixSetPrivate(&pScreen->devPrivates, XF86XvMCScreenKey, pScreenPriv);
-
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = xf86XvMCCloseScreen;
-
- pScreenPriv->num_adaptors = num_adaptors;
- pScreenPriv->adaptors = adaptors;
- pScreenPriv->dixinfo = pAdapt;
-
- for(i = 0; i < num_adaptors; i++) {
- pAdapt[i].xv_adaptor = NULL;
- for(j = 0; j < pxvs->nAdaptors; j++) {
- if(!strcmp((*adaptors)->name, pxvs->pAdaptors[j].name)) {
- pAdapt[i].xv_adaptor = &(pxvs->pAdaptors[j]);
- break;
- }
- }
- if(!pAdapt[i].xv_adaptor) {
- /* no adaptor by that name */
- free(pAdapt);
- return FALSE;
- }
- pAdapt[i].num_surfaces = (*adaptors)->num_surfaces;
- pAdapt[i].surfaces = (XvMCSurfaceInfoPtr*)((*adaptors)->surfaces);
- pAdapt[i].num_subpictures = (*adaptors)->num_subpictures;
- pAdapt[i].subpictures = (XvImagePtr*)((*adaptors)->subpictures);
- pAdapt[i].CreateContext = xf86XvMCCreateContext;
- pAdapt[i].DestroyContext = xf86XvMCDestroyContext;
- pAdapt[i].CreateSurface = xf86XvMCCreateSurface;
- pAdapt[i].DestroySurface = xf86XvMCDestroySurface;
- pAdapt[i].CreateSubpicture = xf86XvMCCreateSubpicture;
- pAdapt[i].DestroySubpicture = xf86XvMCDestroySubpicture;
- adaptors++;
- }
-
- if(Success != (*XvMCScreenInitProc)(pScreen, num_adaptors, pAdapt))
- return FALSE;
-
- return TRUE;
-}
-
-XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void)
-{
- return calloc(1, sizeof(XF86MCAdaptorRec));
-}
-
-void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor)
-{
- free(adaptor);
-}
+
+/*
+ * Copyright (c) 2001-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+
+#include "xvmodproc.h"
+
+#include "xf86xvpriv.h"
+#include "xf86xvmc.h"
+
+XvMCScreenInitProcPtr XvMCScreenInitProc = NULL;
+
+typedef struct {
+ CloseScreenProcPtr CloseScreen;
+ int num_adaptors;
+ XF86MCAdaptorPtr *adaptors;
+ XvMCAdaptorPtr dixinfo;
+} xf86XvMCScreenRec, *xf86XvMCScreenPtr;
+
+static DevPrivateKeyRec XF86XvMCScreenKeyRec;
+
+#define XF86XvMCScreenKey (&XF86XvMCScreenKeyRec)
+
+#define XF86XVMC_GET_PRIVATE(pScreen) (xf86XvMCScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, XF86XvMCScreenKey)
+
+static int
+xf86XvMCCreateContext(XvPortPtr pPort,
+ XvMCContextPtr pContext, int *num_priv, CARD32 **priv)
+{
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ pContext->port_priv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+
+ return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateContext) (pScrn,
+ pContext,
+ num_priv,
+ priv);
+}
+
+static void
+xf86XvMCDestroyContext(XvMCContextPtr pContext)
+{
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ (*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext) (pScrn,
+ pContext);
+}
+
+static int
+xf86XvMCCreateSurface(XvMCSurfacePtr pSurface, int *num_priv, CARD32 **priv)
+{
+ XvMCContextPtr pContext = pSurface->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface) (pScrn,
+ pSurface,
+ num_priv,
+ priv);
+}
+
+static void
+xf86XvMCDestroySurface(XvMCSurfacePtr pSurface)
+{
+ XvMCContextPtr pContext = pSurface->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface) (pScrn,
+ pSurface);
+}
+
+static int
+xf86XvMCCreateSubpicture(XvMCSubpicturePtr pSubpicture,
+ int *num_priv, CARD32 **priv)
+{
+ XvMCContextPtr pContext = pSubpicture->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ return (*pScreenPriv->adaptors[pContext->adapt_num]->
+ CreateSubpicture) (pScrn, pSubpicture, num_priv, priv);
+}
+
+static void
+xf86XvMCDestroySubpicture(XvMCSubpicturePtr pSubpicture)
+{
+ XvMCContextPtr pContext = pSubpicture->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture) (pScrn,
+ pSubpicture);
+}
+
+static Bool
+xf86XvMCCloseScreen(int i, ScreenPtr pScreen)
+{
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen);
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+
+ free(pScreenPriv->dixinfo);
+ free(pScreenPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+Bool
+xf86XvMCScreenInit(ScreenPtr pScreen,
+ int num_adaptors, XF86MCAdaptorPtr * adaptors)
+{
+ XvMCAdaptorPtr pAdapt;
+ xf86XvMCScreenPtr pScreenPriv;
+ XvScreenPtr pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ XF86XvScreenKey);
+ int i, j;
+
+ if (!XvMCScreenInitProc)
+ return FALSE;
+
+ if (!(pAdapt = malloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&XF86XvMCScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ if (!(pScreenPriv = malloc(sizeof(xf86XvMCScreenRec)))) {
+ free(pAdapt);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pScreen->devPrivates, XF86XvMCScreenKey, pScreenPriv);
+
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xf86XvMCCloseScreen;
+
+ pScreenPriv->num_adaptors = num_adaptors;
+ pScreenPriv->adaptors = adaptors;
+ pScreenPriv->dixinfo = pAdapt;
+
+ for (i = 0; i < num_adaptors; i++) {
+ pAdapt[i].xv_adaptor = NULL;
+ for (j = 0; j < pxvs->nAdaptors; j++) {
+ if (!strcmp((*adaptors)->name, pxvs->pAdaptors[j].name)) {
+ pAdapt[i].xv_adaptor = &(pxvs->pAdaptors[j]);
+ break;
+ }
+ }
+ if (!pAdapt[i].xv_adaptor) {
+ /* no adaptor by that name */
+ free(pAdapt);
+ return FALSE;
+ }
+ pAdapt[i].num_surfaces = (*adaptors)->num_surfaces;
+ pAdapt[i].surfaces = (XvMCSurfaceInfoPtr *) ((*adaptors)->surfaces);
+ pAdapt[i].num_subpictures = (*adaptors)->num_subpictures;
+ pAdapt[i].subpictures = (XvImagePtr *) ((*adaptors)->subpictures);
+ pAdapt[i].CreateContext = xf86XvMCCreateContext;
+ pAdapt[i].DestroyContext = xf86XvMCDestroyContext;
+ pAdapt[i].CreateSurface = xf86XvMCCreateSurface;
+ pAdapt[i].DestroySurface = xf86XvMCDestroySurface;
+ pAdapt[i].CreateSubpicture = xf86XvMCCreateSubpicture;
+ pAdapt[i].DestroySubpicture = xf86XvMCDestroySubpicture;
+ adaptors++;
+ }
+
+ if (Success != (*XvMCScreenInitProc) (pScreen, num_adaptors, pAdapt))
+ return FALSE;
+
+ return TRUE;
+}
+
+XF86MCAdaptorPtr
+xf86XvMCCreateAdaptorRec(void)
+{
+ return calloc(1, sizeof(XF86MCAdaptorRec));
+}
+
+void
+xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor)
+{
+ free(adaptor);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86xvmc.h b/xorg-server/hw/xfree86/common/xf86xvmc.h
index 902b4f8fc..ff32379fe 100644
--- a/xorg-server/hw/xfree86/common/xf86xvmc.h
+++ b/xorg-server/hw/xfree86/common/xf86xvmc.h
@@ -33,24 +33,23 @@
#include "xf86xv.h"
typedef struct {
- int num_xvimages;
- int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */
-} XF86MCImageIDList;
+ int num_xvimages;
+ int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */
+} XF86MCImageIDList;
typedef struct {
- int surface_type_id; /* Driver generated. Must be unique on the port */
- int chroma_format;
- int color_description; /* no longer used */
- unsigned short max_width;
- unsigned short max_height;
- unsigned short subpicture_max_width;
- unsigned short subpicture_max_height;
- int mc_type;
- int flags;
- XF86MCImageIDList *compatible_subpictures; /* can be null, if none */
+ int surface_type_id; /* Driver generated. Must be unique on the port */
+ int chroma_format;
+ int color_description; /* no longer used */
+ unsigned short max_width;
+ unsigned short max_height;
+ unsigned short subpicture_max_width;
+ unsigned short subpicture_max_height;
+ int mc_type;
+ int flags;
+ XF86MCImageIDList *compatible_subpictures; /* can be null, if none */
} XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr;
-
/*
xf86XvMCCreateContextProc
@@ -63,19 +62,13 @@ typedef struct {
of 32 bit words in num_priv. This must be dynamically allocated
space because DIX will free it after it passes it to the client.
*/
-
-typedef int (*xf86XvMCCreateContextProcPtr) (
- ScrnInfoPtr pScrn,
- XvMCContextPtr context,
- int *num_priv,
- CARD32 **priv
-);
+typedef int (*xf86XvMCCreateContextProcPtr) (ScrnInfoPtr pScrn,
+ XvMCContextPtr context,
+ int *num_priv, CARD32 **priv);
-typedef void (*xf86XvMCDestroyContextProcPtr) (
- ScrnInfoPtr pScrn,
- XvMCContextPtr context
-);
+typedef void (*xf86XvMCDestroyContextProcPtr) (ScrnInfoPtr pScrn,
+ XvMCContextPtr context);
/*
xf86XvMCCreateSurfaceProc
@@ -86,18 +79,12 @@ typedef void (*xf86XvMCDestroyContextProcPtr) (
xf86XvMCCreateContextProc.
*/
+typedef int (*xf86XvMCCreateSurfaceProcPtr) (ScrnInfoPtr pScrn,
+ XvMCSurfacePtr surface,
+ int *num_priv, CARD32 **priv);
-typedef int (*xf86XvMCCreateSurfaceProcPtr) (
- ScrnInfoPtr pScrn,
- XvMCSurfacePtr surface,
- int *num_priv,
- CARD32 **priv
-);
-
-typedef void (*xf86XvMCDestroySurfaceProcPtr) (
- ScrnInfoPtr pScrn,
- XvMCSurfacePtr surface
-);
+typedef void (*xf86XvMCDestroySurfaceProcPtr) (ScrnInfoPtr pScrn,
+ XvMCSurfacePtr surface);
/*
xf86XvMCCreateSubpictureProc
@@ -114,32 +101,25 @@ typedef void (*xf86XvMCDestroySurfaceProcPtr) (
xf86XvMCCreateContextProc.
*/
+typedef int (*xf86XvMCCreateSubpictureProcPtr) (ScrnInfoPtr pScrn,
+ XvMCSubpicturePtr subpicture,
+ int *num_priv, CARD32 **priv);
-typedef int (*xf86XvMCCreateSubpictureProcPtr) (
- ScrnInfoPtr pScrn,
- XvMCSubpicturePtr subpicture,
- int *num_priv,
- CARD32 **priv
-);
-
-typedef void (*xf86XvMCDestroySubpictureProcPtr) (
- ScrnInfoPtr pScrn,
- XvMCSubpicturePtr subpicture
-);
-
+typedef void (*xf86XvMCDestroySubpictureProcPtr) (ScrnInfoPtr pScrn,
+ XvMCSubpicturePtr subpicture);
typedef struct {
- char *name;
- int num_surfaces;
- XF86MCSurfaceInfoPtr *surfaces;
- int num_subpictures;
- XF86ImagePtr *subpictures;
- xf86XvMCCreateContextProcPtr CreateContext;
- xf86XvMCDestroyContextProcPtr DestroyContext;
- xf86XvMCCreateSurfaceProcPtr CreateSurface;
- xf86XvMCDestroySurfaceProcPtr DestroySurface;
- xf86XvMCCreateSubpictureProcPtr CreateSubpicture;
- xf86XvMCDestroySubpictureProcPtr DestroySubpicture;
+ char *name;
+ int num_surfaces;
+ XF86MCSurfaceInfoPtr *surfaces;
+ int num_subpictures;
+ XF86ImagePtr *subpictures;
+ xf86XvMCCreateContextProcPtr CreateContext;
+ xf86XvMCDestroyContextProcPtr DestroyContext;
+ xf86XvMCCreateSurfaceProcPtr CreateSurface;
+ xf86XvMCDestroySurfaceProcPtr DestroySurface;
+ xf86XvMCCreateSubpictureProcPtr CreateSubpicture;
+ xf86XvMCDestroySubpictureProcPtr DestroySubpicture;
} XF86MCAdaptorRec, *XF86MCAdaptorPtr;
/*
@@ -151,16 +131,14 @@ typedef struct {
an array of structures.
*/
-extern _X_EXPORT Bool xf86XvMCScreenInit(
- ScreenPtr pScreen,
- int num_adaptors,
- XF86MCAdaptorPtr *adaptors
-);
+extern _X_EXPORT Bool xf86XvMCScreenInit(ScreenPtr pScreen,
+ int num_adaptors,
+ XF86MCAdaptorPtr * adaptors);
-extern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void);
+extern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec(void);
extern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor);
-typedef int (*XvMCScreenInitProcPtr)(ScreenPtr, int, XvMCAdaptorPtr);
+typedef int (*XvMCScreenInitProcPtr) (ScreenPtr, int, XvMCAdaptorPtr);
extern _X_EXPORT XvMCScreenInitProcPtr XvMCScreenInitProc;
-#endif /* _XF86XVMC_H */
+#endif /* _XF86XVMC_H */
diff --git a/xorg-server/hw/xfree86/common/xisb.c b/xorg-server/hw/xfree86/common/xisb.c
index 287a98b53..3568a578c 100644
--- a/xorg-server/hw/xfree86/common/xisb.c
+++ b/xorg-server/hw/xfree86/common/xisb.c
@@ -1,174 +1,168 @@
-/*
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-
-/*
- X Input Serial Buffer routines for use in any XInput driver that accesses
- a serial device.
-*/
-
-
-/*****************************************************************************
- * Standard Headers
- ****************************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <misc.h>
-#include <xf86.h>
-#include <xf86_OSproc.h>
-#include <xf86_OSlib.h>
-#include <xf86Xinput.h>
-#include "xisb.h"
-
-/*****************************************************************************
- * Local Headers
- ****************************************************************************/
-
-/*****************************************************************************
- * Variables without includable headers
- ****************************************************************************/
-
-/*****************************************************************************
- * Local Variables
- ****************************************************************************/
-
-/*****************************************************************************
- * Function Definitions
- ****************************************************************************/
-
-XISBuffer *
-XisbNew (int fd, ssize_t size)
-{
- XISBuffer *b;
-
- b = malloc(sizeof (XISBuffer));
- if (!b)
- return NULL;
- b->buf = malloc((sizeof (unsigned char) * size));
- if (!b->buf)
- {
- free(b);
- return NULL;
- }
-
- b->fd = fd;
- b->trace = 0;
- b->block_duration = 0;
- b->current = 1; /* force it to be past the end to trigger initial read */
- b->end = 0;
- b->buffer_size = size;
- return b;
-}
-
-void
-XisbFree (XISBuffer *b)
-{
- free(b->buf);
- free(b);
-}
-
-int
-XisbRead (XISBuffer *b)
-{
- int ret;
-
- if (b->current >= b->end)
- {
- if (b->block_duration >= 0)
- {
- if (xf86WaitForInput (b->fd, b->block_duration) < 1)
- return -1;
- }
- else
- {
- /*
- * automatically clear it so if XisbRead is called in a loop
- * the next call will make sure there is data with select and
- * thus prevent a blocking read
- */
- b->block_duration = 0;
- }
-
- ret = xf86ReadSerial (b->fd, b->buf, b->buffer_size);
- switch (ret)
- {
- case 0:
- return -1; /* timeout */
- case -1:
- return -2; /* error */
- default:
- b->end = ret;
- b->current = 0;
- break;
- }
- }
- if (b->trace)
- ErrorF ("read 0x%02x (%c)\n", b->buf[b->current],
- isprint(b->buf[b->current])?b->buf[b->current]:'.');
-
- return b->buf[b->current++];
-}
-
-/* the only purpose of this function is to provide output tracing */
-ssize_t
-XisbWrite (XISBuffer *b, unsigned char *msg, ssize_t len)
-{
- if (b->trace)
- {
- int i = 0;
- for (i = 0; i < len; i++)
- ErrorF ("\t\twrote 0x%02x (%c)\n", msg[i], msg[i]);
- }
- return (xf86WriteSerial (b->fd, msg, len));
-}
-
-/* turn tracing of this buffer on (1) or off (0) */
-void
-XisbTrace (XISBuffer *b, int trace)
-{
- b->trace = trace;
-}
-
-/*
- * specify a block_duration of -1 when you know the buffer's fd is ready to
- * read. After a read, it is automatically set to 0 so that the next read
- * will use check to select for data and prevent a block.
- * It is the caller's responsibility to set the block_duration to -1 if it
- * knows that there is data to read (because the main select loop triggered
- * the read) and want's to avoid the unnecessary overhead of the select call
- *
- * a zero or positive block duration will cause the select to block for the
- * give duration in usecs.
- */
-
-void
-XisbBlockDuration (XISBuffer *b, int block_duration)
-{
- b->block_duration = block_duration;
-}
+/*
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+
+/*
+ X Input Serial Buffer routines for use in any XInput driver that accesses
+ a serial device.
+*/
+
+/*****************************************************************************
+ * Standard Headers
+ ****************************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <misc.h>
+#include <xf86.h>
+#include <xf86_OSproc.h>
+#include <xf86_OSlib.h>
+#include <xf86Xinput.h>
+#include "xisb.h"
+
+/*****************************************************************************
+ * Local Headers
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Variables without includable headers
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Local Variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Function Definitions
+ ****************************************************************************/
+
+XISBuffer *
+XisbNew(int fd, ssize_t size)
+{
+ XISBuffer *b;
+
+ b = malloc(sizeof(XISBuffer));
+ if (!b)
+ return NULL;
+ b->buf = malloc((sizeof(unsigned char) * size));
+ if (!b->buf) {
+ free(b);
+ return NULL;
+ }
+
+ b->fd = fd;
+ b->trace = 0;
+ b->block_duration = 0;
+ b->current = 1; /* force it to be past the end to trigger initial read */
+ b->end = 0;
+ b->buffer_size = size;
+ return b;
+}
+
+void
+XisbFree(XISBuffer * b)
+{
+ free(b->buf);
+ free(b);
+}
+
+int
+XisbRead(XISBuffer * b)
+{
+ int ret;
+
+ if (b->current >= b->end) {
+ if (b->block_duration >= 0) {
+ if (xf86WaitForInput(b->fd, b->block_duration) < 1)
+ return -1;
+ }
+ else {
+ /*
+ * automatically clear it so if XisbRead is called in a loop
+ * the next call will make sure there is data with select and
+ * thus prevent a blocking read
+ */
+ b->block_duration = 0;
+ }
+
+ ret = xf86ReadSerial(b->fd, b->buf, b->buffer_size);
+ switch (ret) {
+ case 0:
+ return -1; /* timeout */
+ case -1:
+ return -2; /* error */
+ default:
+ b->end = ret;
+ b->current = 0;
+ break;
+ }
+ }
+ if (b->trace)
+ ErrorF("read 0x%02x (%c)\n", b->buf[b->current],
+ isprint(b->buf[b->current]) ? b->buf[b->current] : '.');
+
+ return b->buf[b->current++];
+}
+
+/* the only purpose of this function is to provide output tracing */
+ssize_t
+XisbWrite(XISBuffer * b, unsigned char *msg, ssize_t len)
+{
+ if (b->trace) {
+ int i = 0;
+
+ for (i = 0; i < len; i++)
+ ErrorF("\t\twrote 0x%02x (%c)\n", msg[i], msg[i]);
+ }
+ return (xf86WriteSerial(b->fd, msg, len));
+}
+
+/* turn tracing of this buffer on (1) or off (0) */
+void
+XisbTrace(XISBuffer * b, int trace)
+{
+ b->trace = trace;
+}
+
+/*
+ * specify a block_duration of -1 when you know the buffer's fd is ready to
+ * read. After a read, it is automatically set to 0 so that the next read
+ * will use check to select for data and prevent a block.
+ * It is the caller's responsibility to set the block_duration to -1 if it
+ * knows that there is data to read (because the main select loop triggered
+ * the read) and want's to avoid the unnecessary overhead of the select call
+ *
+ * a zero or positive block duration will cause the select to block for the
+ * give duration in usecs.
+ */
+
+void
+XisbBlockDuration(XISBuffer * b, int block_duration)
+{
+ b->block_duration = block_duration;
+}
diff --git a/xorg-server/hw/xfree86/common/xisb.h b/xorg-server/hw/xfree86/common/xisb.h
index bacfde166..6ac1a6e37 100644
--- a/xorg-server/hw/xfree86/common/xisb.h
+++ b/xorg-server/hw/xfree86/common/xisb.h
@@ -35,15 +35,14 @@
* structs, typedefs, #defines, enums
*****************************************************************************/
-typedef struct _XISBuffer
-{
- int fd;
- int trace;
- int block_duration;
- ssize_t current; /* bytes read */
- ssize_t end;
- ssize_t buffer_size;
- unsigned char *buf;
+typedef struct _XISBuffer {
+ int fd;
+ int trace;
+ int block_duration;
+ ssize_t current; /* bytes read */
+ ssize_t end;
+ ssize_t buffer_size;
+ unsigned char *buf;
} XISBuffer;
/******************************************************************************
@@ -52,12 +51,13 @@ typedef struct _XISBuffer
* of globals.
* put locals in the .c file.
*****************************************************************************/
-extern _X_EXPORT XISBuffer * XisbNew (int fd, ssize_t size);
-extern _X_EXPORT void XisbFree (XISBuffer *b);
-extern _X_EXPORT int XisbRead (XISBuffer *b);
-extern _X_EXPORT ssize_t XisbWrite (XISBuffer *b, unsigned char *msg, ssize_t len);
-extern _X_EXPORT void XisbTrace (XISBuffer *b, int trace);
-extern _X_EXPORT void XisbBlockDuration (XISBuffer *b, int block_duration);
+extern _X_EXPORT XISBuffer *XisbNew(int fd, ssize_t size);
+extern _X_EXPORT void XisbFree(XISBuffer * b);
+extern _X_EXPORT int XisbRead(XISBuffer * b);
+extern _X_EXPORT ssize_t XisbWrite(XISBuffer * b, unsigned char *msg,
+ ssize_t len);
+extern _X_EXPORT void XisbTrace(XISBuffer * b, int trace);
+extern _X_EXPORT void XisbBlockDuration(XISBuffer * b, int block_duration);
/*
* DO NOT PUT ANYTHING AFTER THIS ENDIF
diff --git a/xorg-server/hw/xfree86/ddc/ddc.c b/xorg-server/hw/xfree86/ddc/ddc.c
index 179f42ccd..a1281d735 100644
--- a/xorg-server/hw/xfree86/ddc/ddc.c
+++ b/xorg-server/hw/xfree86/ddc/ddc.c
@@ -29,10 +29,10 @@ typedef enum {
} DDCOpts;
static const OptionInfoRec DDCOptions[] = {
- { DDCOPT_NODDC1, "NoDDC1", OPTV_BOOLEAN, {0}, FALSE },
- { DDCOPT_NODDC2, "NoDDC2", OPTV_BOOLEAN, {0}, FALSE },
- { DDCOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE },
+ {DDCOPT_NODDC1, "NoDDC1", OPTV_BOOLEAN, {0}, FALSE},
+ {DDCOPT_NODDC2, "NoDDC2", OPTV_BOOLEAN, {0}, FALSE},
+ {DDCOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE},
};
/* DDC1 */
@@ -41,19 +41,20 @@ static int
find_start(unsigned int *ptr)
{
unsigned int comp[9], test[9];
- int i,j;
-
- for (i=0;i<9;i++){
- comp[i] = *(ptr++);
- test[i] = 1;
+ int i, j;
+
+ for (i = 0; i < 9; i++) {
+ comp[i] = *(ptr++);
+ test[i] = 1;
}
- for (i=0;i<127;i++){
- for (j=0;j<9;j++){
- test[j] = test[j] & !(comp[j] ^ *(ptr++));
- }
+ for (i = 0; i < 127; i++) {
+ for (j = 0; j < 9; j++) {
+ test[j] = test[j] & !(comp[j] ^ *(ptr++));
+ }
}
- for (i=0;i<9;i++)
- if (test[i]) return i+1;
+ for (i = 0; i < 9; i++)
+ if (test[i])
+ return i + 1;
return -1;
}
@@ -61,21 +62,26 @@ static unsigned char *
find_header(unsigned char *block)
{
unsigned char *ptr, *head_ptr, *end;
- unsigned char header[]={0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
-
+ unsigned char header[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
+
ptr = block;
end = block + EDID1_LEN;
- while (ptr<end) {
- int i;
- head_ptr = ptr;
- for (i=0;i<8;i++){
- if (header[i] != *(head_ptr++)) break;
- if (head_ptr == end) head_ptr = block;
- }
- if (i==8) break;
- ptr++;
+ while (ptr < end) {
+ int i;
+
+ head_ptr = ptr;
+ for (i = 0; i < 8; i++) {
+ if (header[i] != *(head_ptr++))
+ break;
+ if (head_ptr == end)
+ head_ptr = block;
+ }
+ if (i == 8)
+ break;
+ ptr++;
}
- if (ptr == end) return NULL;
+ if (ptr == end)
+ return NULL;
return ptr;
}
@@ -87,15 +93,18 @@ resort(unsigned char *s_block)
s_end = s_block + EDID1_LEN;
d_new = malloc(EDID1_LEN);
- if (!d_new) return NULL;
+ if (!d_new)
+ return NULL;
d_end = d_new + EDID1_LEN;
s_ptr = find_header(s_block);
- if (!s_ptr) return NULL;
- for (d_ptr=d_new;d_ptr<d_end;d_ptr++){
- tmp = *(s_ptr++);
- *d_ptr = tmp;
- if (s_ptr == s_end) s_ptr = s_block;
+ if (!s_ptr)
+ return NULL;
+ for (d_ptr = d_new; d_ptr < d_end; d_ptr++) {
+ tmp = *(s_ptr++);
+ *d_ptr = tmp;
+ if (s_ptr == s_end)
+ s_ptr = s_block;
}
free(s_block);
return d_new;
@@ -106,21 +115,24 @@ DDC_checksum(const unsigned char *block, int len)
{
int i, result = 0;
int not_null = 0;
-
- for (i=0;i<len;i++) {
- not_null |= block[i];
- result += block[i];
+
+ for (i = 0; i < len; i++) {
+ not_null |= block[i];
+ result += block[i];
}
-
+
#ifdef DEBUG
- if (result & 0xFF) ErrorF("DDC checksum not correct\n");
- if (!not_null) ErrorF("DDC read all Null\n");
+ if (result & 0xFF)
+ ErrorF("DDC checksum not correct\n");
+ if (!not_null)
+ ErrorF("DDC read all Null\n");
#endif
/* catch the trivial case where all bytes are 0 */
- if (!not_null) return 1;
+ if (!not_null)
+ return 1;
- return result&0xFF;
+ return result & 0xFF;
}
static unsigned char *
@@ -129,64 +141,73 @@ GetEDID_DDC1(unsigned int *s_ptr)
unsigned char *d_block, *d_pos;
unsigned int *s_pos, *s_end;
int s_start;
- int i,j;
+ int i, j;
+
s_start = find_start(s_ptr);
- if (s_start==-1) return NULL;
+ if (s_start == -1)
+ return NULL;
s_end = s_ptr + NUM;
s_pos = s_ptr + s_start;
- d_block=malloc(EDID1_LEN);
- if (!d_block) return NULL;
+ d_block = malloc(EDID1_LEN);
+ if (!d_block)
+ return NULL;
d_pos = d_block;
- for (i=0;i<EDID1_LEN;i++) {
- for (j=0;j<8;j++) {
- *d_pos <<= 1;
- if (*s_pos) {
- *d_pos |= 0x01;
- }
- s_pos++; if (s_pos == s_end) s_pos=s_ptr;
- };
- s_pos++; if (s_pos == s_end) s_pos=s_ptr;
- d_pos++;
+ for (i = 0; i < EDID1_LEN; i++) {
+ for (j = 0; j < 8; j++) {
+ *d_pos <<= 1;
+ if (*s_pos) {
+ *d_pos |= 0x01;
+ }
+ s_pos++;
+ if (s_pos == s_end)
+ s_pos = s_ptr;
+ };
+ s_pos++;
+ if (s_pos == s_end)
+ s_pos = s_ptr;
+ d_pos++;
}
free(s_ptr);
- if (d_block && DDC_checksum(d_block,EDID1_LEN)) {
- free(d_block);
- return NULL;
+ if (d_block && DDC_checksum(d_block, EDID1_LEN)) {
+ free(d_block);
+ return NULL;
}
return (resort(d_block));
}
/* fetch entire EDID record; DDC bit needs to be masked */
-static unsigned int *
+static unsigned int *
FetchEDID_DDC1(register ScrnInfoPtr pScrn,
- register unsigned int (*read_DDC)(ScrnInfoPtr))
+ register unsigned int (*read_DDC) (ScrnInfoPtr))
{
int count = NUM;
unsigned int *ptr, *xp;
- ptr=xp=malloc(sizeof(int)*NUM);
+ ptr = xp = malloc(sizeof(int) * NUM);
- if (!ptr) return NULL;
+ if (!ptr)
+ return NULL;
do {
- /* wait for next retrace */
- *xp = read_DDC(pScrn);
- xp++;
- } while(--count);
+ /* wait for next retrace */
+ *xp = read_DDC(pScrn);
+ xp++;
+ } while (--count);
return ptr;
}
/* test if DDC1 return 0 if not */
static Bool
-TestDDC1(ScrnInfoPtr pScrn, unsigned int (*read_DDC)(ScrnInfoPtr))
+TestDDC1(ScrnInfoPtr pScrn, unsigned int (*read_DDC) (ScrnInfoPtr))
{
int old, count;
old = read_DDC(pScrn);
count = HEADER * BITS_PER_BYTE;
do {
- /* wait for next retrace */
- if (old != read_DDC(pScrn)) break;
- } while(count--);
+ /* wait for next retrace */
+ if (old != read_DDC(pScrn))
+ break;
+ } while (count--);
return count;
}
@@ -196,29 +217,31 @@ TestDDC1(ScrnInfoPtr pScrn, unsigned int (*read_DDC)(ScrnInfoPtr))
* function; it will also decide if we need to reread it
*/
static unsigned char *
-EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed,
- unsigned int (*read_DDC)(ScrnInfoPtr))
+EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed,
+ unsigned int (*read_DDC) (ScrnInfoPtr))
{
unsigned char *EDID_block = NULL;
int count = RETRIES;
- if (!read_DDC) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "chipset doesn't support DDC1\n");
- return NULL;
+ if (!read_DDC) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "chipset doesn't support DDC1\n");
+ return NULL;
};
- if (TestDDC1(pScrn,read_DDC)==-1) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "No DDC signal\n");
- return NULL;
+ if (TestDDC1(pScrn, read_DDC) == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "No DDC signal\n");
+ return NULL;
};
- if (DDCSpeed) DDCSpeed(pScrn,DDC_FAST);
+ if (DDCSpeed)
+ DDCSpeed(pScrn, DDC_FAST);
do {
- EDID_block = GetEDID_DDC1(FetchEDID_DDC1(pScrn,read_DDC));
- count --;
+ EDID_block = GetEDID_DDC1(FetchEDID_DDC1(pScrn, read_DDC));
+ count--;
} while (!EDID_block && count);
- if (DDCSpeed) DDCSpeed(pScrn,DDC_SLOW);
+ if (DDCSpeed)
+ DDCSpeed(pScrn, DDC_SLOW);
return EDID_block;
}
@@ -235,40 +258,42 @@ EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed,
* @return NULL if no monitor attached or failure to interpret the EDID.
*/
xf86MonPtr
-xf86DoEDID_DDC1(int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed,
- unsigned int (*DDC1Read)(ScrnInfoPtr))
+xf86DoEDID_DDC1(int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed,
+ unsigned int (*DDC1Read) (ScrnInfoPtr))
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
unsigned char *EDID_block = NULL;
xf86MonPtr tmp = NULL;
+
/* Default DDC and DDC1 to enabled. */
Bool noddc = FALSE, noddc1 = FALSE;
OptionInfoPtr options;
options = xnfalloc(sizeof(DDCOptions));
- (void)memcpy(options, DDCOptions, sizeof(DDCOptions));
+ (void) memcpy(options, DDCOptions, sizeof(DDCOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
xf86GetOptValBool(options, DDCOPT_NODDC1, &noddc1);
free(options);
-
+
if (noddc || noddc1)
- return NULL;
-
+ return NULL;
+
OsBlockSignals();
- EDID_block = EDIDRead_DDC1(pScrn,DDC1SetSpeed,DDC1Read);
+ EDID_block = EDIDRead_DDC1(pScrn, DDC1SetSpeed, DDC1Read);
OsReleaseSignals();
- if (EDID_block){
- tmp = xf86InterpretEDID(scrnIndex,EDID_block);
+ if (EDID_block) {
+ tmp = xf86InterpretEDID(scrnIndex, EDID_block);
}
#ifdef DEBUG
- else ErrorF("No EDID block returned\n");
+ else
+ ErrorF("No EDID block returned\n");
if (!tmp)
- ErrorF("Cannot interpret EDID block\n");
+ ErrorF("Cannot interpret EDID block\n");
#endif
- return tmp;
+ return tmp;
}
/* DDC2 */
@@ -279,19 +304,19 @@ DDC2MakeDevice(I2CBusPtr pBus, int address, char *name)
I2CDevPtr dev = NULL;
if (!(dev = xf86I2CFindDev(pBus, address))) {
- dev = xf86CreateI2CDevRec();
- dev->DevName = name;
- dev->SlaveAddr = address;
- dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
- dev->StartTimeout = 550;
- dev->BitTimeout = 40;
- dev->AcknTimeout = 40;
-
- dev->pI2CBus = pBus;
- if (!xf86I2CDevInit(dev)) {
- xf86DrvMsg(pBus->scrnIndex, X_PROBED, "No DDC2 device\n");
- return NULL;
- }
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = name;
+ dev->SlaveAddr = address;
+ dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
+ dev->StartTimeout = 550;
+ dev->BitTimeout = 40;
+ dev->AcknTimeout = 40;
+
+ dev->pI2CBus = pBus;
+ if (!xf86I2CDevInit(dev)) {
+ xf86DrvMsg(pBus->scrnIndex, X_PROBED, "No DDC2 device\n");
+ return NULL;
+ }
}
return dev;
@@ -307,10 +332,10 @@ DDC2Init(int scrnIndex, I2CBusPtr pBus)
* miss things.
*/
pBus->RiseFallTime = 20;
-
+
dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2");
if (xf86I2CProbeAddress(pBus, 0x0060))
- DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register");
+ DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register");
return dev;
}
@@ -328,39 +353,39 @@ DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer)
unsigned char W_Buffer[1];
int i, segment;
I2CDevPtr seg;
- void (*stop)(I2CDevPtr);
+ void (*stop) (I2CDevPtr);
for (i = 0; i < RETRIES; i++) {
- /* Stop bits reset the segment pointer to 0, so be careful here. */
- segment = block >> 1;
- if (segment) {
- Bool b;
-
- if (!(seg = xf86I2CFindDev(dev->pI2CBus, 0x0060)))
- return FALSE;
-
- W_Buffer[0] = segment;
-
- stop = dev->pI2CBus->I2CStop;
- dev->pI2CBus->I2CStop = EEDIDStop;
-
- b = xf86I2CWriteRead(seg, W_Buffer, 1, NULL, 0);
-
- dev->pI2CBus->I2CStop = stop;
- if (!b) {
- dev->pI2CBus->I2CStop(dev);
- continue;
- }
- }
-
- W_Buffer[0] = (block & 0x01) * EDID1_LEN;
-
- if (xf86I2CWriteRead(dev, W_Buffer, 1, R_Buffer, EDID1_LEN)) {
- if (!DDC_checksum(R_Buffer, EDID1_LEN))
- return TRUE;
- }
+ /* Stop bits reset the segment pointer to 0, so be careful here. */
+ segment = block >> 1;
+ if (segment) {
+ Bool b;
+
+ if (!(seg = xf86I2CFindDev(dev->pI2CBus, 0x0060)))
+ return FALSE;
+
+ W_Buffer[0] = segment;
+
+ stop = dev->pI2CBus->I2CStop;
+ dev->pI2CBus->I2CStop = EEDIDStop;
+
+ b = xf86I2CWriteRead(seg, W_Buffer, 1, NULL, 0);
+
+ dev->pI2CBus->I2CStop = stop;
+ if (!b) {
+ dev->pI2CBus->I2CStop(dev);
+ continue;
+ }
+ }
+
+ W_Buffer[0] = (block & 0x01) * EDID1_LEN;
+
+ if (xf86I2CWriteRead(dev, W_Buffer, 1, R_Buffer, EDID1_LEN)) {
+ if (!DDC_checksum(R_Buffer, EDID1_LEN))
+ return TRUE;
+ }
}
-
+
return FALSE;
}
@@ -384,13 +409,14 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
unsigned char *EDID_block = NULL;
xf86MonPtr tmp = NULL;
I2CDevPtr dev = NULL;
+
/* Default DDC and DDC2 to enabled. */
Bool noddc = FALSE, noddc2 = FALSE;
OptionInfoPtr options;
options = malloc(sizeof(DDCOptions));
if (!options)
- return NULL;
+ return NULL;
memcpy(options, DDCOptions, sizeof(DDCOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
@@ -399,30 +425,30 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
free(options);
if (noddc || noddc2)
- return NULL;
+ return NULL;
if (!(dev = DDC2Init(scrnIndex, pBus)))
- return NULL;
+ return NULL;
EDID_block = calloc(1, EDID1_LEN);
if (!EDID_block)
- return NULL;
+ return NULL;
if (DDC2Read(dev, 0, EDID_block)) {
- int i, n = EDID_block[0x7e];
+ int i, n = EDID_block[0x7e];
- if (complete && n) {
- EDID_block = realloc(EDID_block, EDID1_LEN * (1+n));
+ if (complete && n) {
+ EDID_block = realloc(EDID_block, EDID1_LEN * (1 + n));
- for (i = 0; i < n; i++)
- DDC2Read(dev, i+1, EDID_block + (EDID1_LEN * (1+i)));
- }
+ for (i = 0; i < n; i++)
+ DDC2Read(dev, i + 1, EDID_block + (EDID1_LEN * (1 + i)));
+ }
- tmp = xf86InterpretEEDID(scrnIndex, EDID_block);
+ tmp = xf86InterpretEEDID(scrnIndex, EDID_block);
}
if (tmp && complete)
- tmp->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
+ tmp->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
return tmp;
}
@@ -469,13 +495,14 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus)
unsigned char *did = NULL;
xf86MonPtr tmp = NULL;
I2CDevPtr dev = NULL;
+
/* Default DDC and DDC2 to enabled. */
Bool noddc = FALSE, noddc2 = FALSE;
OptionInfoPtr options;
options = malloc(sizeof(DDCOptions));
if (!options)
- return NULL;
+ return NULL;
memcpy(options, DDCOptions, sizeof(DDCOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
@@ -484,19 +511,19 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus)
free(options);
if (noddc || noddc2)
- return NULL;
+ return NULL;
if (!(dev = DDC2Init(scrnIndex, pBus)))
- return NULL;
+ return NULL;
if ((did = DDC2ReadDisplayID())) {
- tmp = calloc(1, sizeof(*tmp));
- if (!tmp)
- return NULL;
+ tmp = calloc(1, sizeof(*tmp));
+ if (!tmp)
+ return NULL;
- tmp->scrnIndex = scrnIndex;
- tmp->flags |= MONITOR_DISPLAYID;
- tmp->rawData = did;
+ tmp->scrnIndex = scrnIndex;
+ tmp->flags |= MONITOR_DISPLAYID;
+ tmp->rawData = did;
}
return tmp;
diff --git a/xorg-server/hw/xfree86/ddc/ddcProperty.c b/xorg-server/hw/xfree86/ddc/ddcProperty.c
index c3aced5c2..fc63f0e8a 100644
--- a/xorg-server/hw/xfree86/ddc/ddcProperty.c
+++ b/xorg-server/hw/xfree86/ddc/ddcProperty.c
@@ -40,8 +40,8 @@ edidMakeAtom(int i, const char *name, CARD8 *data, int size)
Atom atom;
unsigned char *atom_data;
- if (!(atom_data = malloc(size*sizeof(CARD8))))
- return;
+ if (!(atom_data = malloc(size * sizeof(CARD8))))
+ return;
atom = MakeAtom(name, strlen(name), TRUE);
memcpy(atom_data, data, size);
@@ -54,17 +54,19 @@ addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
int scrnIndex = pScrn->scrnIndex;
if (DDC->flags & MONITOR_DISPLAYID) {
- /* Don't bother, use RANDR already */
- return;
- } else if (DDC->ver.version == 1) {
- int size = 128 +
- (DDC->flags & EDID_COMPLETE_RAWDATA ? DDC->no_sections * 128 : 0);
+ /* Don't bother, use RANDR already */
+ return;
+ }
+ else if (DDC->ver.version == 1) {
+ int size = 128 +
+ (DDC->flags & EDID_COMPLETE_RAWDATA ? DDC->no_sections * 128 : 0);
- edidMakeAtom(scrnIndex, EDID1_ATOM_NAME, DDC->rawData, size);
- } else {
- xf86DrvMsg(scrnIndex, X_PROBED, "unexpected EDID version %d.%d\n",
- DDC->ver.version, DDC->ver.revision);
- return;
+ edidMakeAtom(scrnIndex, EDID1_ATOM_NAME, DDC->rawData, size);
+ }
+ else {
+ xf86DrvMsg(scrnIndex, X_PROBED, "unexpected EDID version %d.%d\n",
+ DDC->ver.version, DDC->ver.revision);
+ return;
}
}
@@ -74,10 +76,9 @@ xf86SetDDCproperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
if (!pScrn || !pScrn->monitor || !DDC)
return FALSE;
- if (DDC->flags & MONITOR_DISPLAYID)
- ;
+ if (DDC->flags & MONITOR_DISPLAYID);
else
- xf86EdidMonitorSet(pScrn->scrnIndex, pScrn->monitor, DDC);
+ xf86EdidMonitorSet(pScrn->scrnIndex, pScrn->monitor, DDC);
addRootWindowProperties(pScrn, DDC);
diff --git a/xorg-server/hw/xfree86/ddc/edid.h b/xorg-server/hw/xfree86/ddc/edid.h
index cc4bd02ea..91565a2cf 100644
--- a/xorg-server/hw/xfree86/ddc/edid.h
+++ b/xorg-server/hw/xfree86/ddc/edid.h
@@ -10,12 +10,12 @@
*/
#ifndef _EDID_H_
-#define _EDID_H_
+#define _EDID_H_
#include <X11/Xmd.h>
#ifndef _X_EXPORT
-# include <X11/Xfuncproto.h>
+#include <X11/Xfuncproto.h>
#endif
/* read complete EDID record */
@@ -72,7 +72,7 @@
#define E_T1 0
#define E_T2 (E_T1 + 1)
#define E_TMANU (E_T2 + 1)
-#define E_TIMING_LENGTH (E_TMANU + 1)
+#define E_TIMING_LENGTH (E_TMANU + 1)
/* non predefined standard timings supported by display */
#define STD_TIMING_SECTION (ESTABLISHED_TIMING_SECTION + E_TIMING_LENGTH)
@@ -90,13 +90,12 @@
/* number of EDID sections to follow */
#define NO_EDID (DET_TIMING_SECTION + DET_TIMING_LENGTH)
/* one byte checksum */
-#define CHECKSUM (NO_EDID + 1)
+#define CHECKSUM (NO_EDID + 1)
#if (CHECKSUM != (EDID1_LEN - 1))
-# error "EDID1 length != 128!"
+#error "EDID1 length != 128!"
#endif
-
#define SECTION(x,y) (Uchar *)(x + y)
#define GET_ARRAY(y) ((Uchar *)(c + y))
#define GET(y) *(Uchar *)(c + y)
@@ -146,7 +145,6 @@
#define _MSC(x) (x & 0x7)
#define MSC _MSC(GET(FEAT_S))
-
/* color characteristics */
#define CC_L(x,y) ((x & (0x03 << y)) >> y)
#define CC_H(x) (x << 2)
@@ -198,7 +196,6 @@
#define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN))
#define NEXT_STD_TIMING _NEXT_STD_TIMING(c)
-
/* EDID Ver. >= 1.2 */
/**
* Returns true if the pointer is the start of a monitor descriptor block
@@ -264,7 +261,7 @@
#define _MAX_H(x) x[8]
#define MAX_H (_MAX_H(c) + _MAX_H_OFFSET(c))
#define _MAX_CLOCK(x) x[9]
-#define MAX_CLOCK _MAX_CLOCK(c)
+#define MAX_CLOCK _MAX_CLOCK(c)
#define _HAVE_2ND_GTF(x) (x[10] == 0x02)
#define HAVE_2ND_GTF _HAVE_2ND_GTF(c)
#define _F_2ND_GTF(x) (x[12] * 2)
@@ -325,7 +322,7 @@
#define WHITEX2 _WHITEX_ADD(c,12)
#define WHITEY2 _WHITEY_ADD(c,12)
#define _WHITE_GAMMA1(x) _GAMMA(x[9])
-#define WHITE_GAMMA1 _WHITE_GAMMA1(c)
+#define WHITE_GAMMA1 _WHITE_GAMMA1(c)
#define _WHITE_GAMMA2(x) _GAMMA(x[14])
#define WHITE_GAMMA2 _WHITE_GAMMA2(c)
#define ADD_STD_TIMINGS 0xFA
@@ -337,7 +334,7 @@
#define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN))
#define NEXT_DT_MD_SECTION _NEXT_DT_MD_SECTION(c)
-#endif /* _PARSE_EDID_ */
+#endif /* _PARSE_EDID_ */
/* input type */
#define DIGITAL(x) x
@@ -346,10 +343,10 @@
#define DFP1(x) x
/* input voltage level */
-#define V070 0 /* 0.700V/0.300V */
-#define V071 1 /* 0.714V/0.286V */
-#define V100 2 /* 1.000V/0.400V */
-#define V007 3 /* 0.700V/0.000V */
+#define V070 0 /* 0.700V/0.300V */
+#define V071 1 /* 0.714V/0.286V */
+#define V100 2 /* 1.000V/0.400V */
+#define V007 3 /* 0.700V/0.000V */
/* Signal level setup */
#define SIG_SETUP(x) (x)
@@ -382,88 +379,87 @@
#define CVT_SUPPORTED(x) (x & 0x1)
/* detailed timing misc */
-#define IS_INTERLACED(x) (x)
-#define IS_STEREO(x) (x)
+#define IS_INTERLACED(x) (x)
+#define IS_STEREO(x) (x)
#define IS_RIGHT_STEREO(x) (x & 0x01)
#define IS_LEFT_STEREO(x) (x & 0x02)
#define IS_4WAY_STEREO(x) (x & 0x03)
#define IS_RIGHT_ON_SYNC(x) IS_RIGHT_STEREO(x)
#define IS_LEFT_ON_SYNC(x) IS_LEFT_STEREO(x)
-
typedef unsigned int Uint;
typedef unsigned char Uchar;
struct vendor {
- char name[4];
- int prod_id;
- Uint serial;
- int week;
- int year;
+ char name[4];
+ int prod_id;
+ Uint serial;
+ int week;
+ int year;
};
struct edid_version {
- int version;
- int revision;
+ int version;
+ int revision;
};
struct disp_features {
- unsigned int input_type:1;
- unsigned int input_voltage:2;
- unsigned int input_setup:1;
- unsigned int input_sync:5;
- unsigned int input_dfp:1;
- unsigned int input_bpc:3;
- unsigned int input_interface:4;
- /* 15 bit hole */
- int hsize;
- int vsize;
- float gamma;
- unsigned int dpms:3;
- unsigned int display_type:2;
- unsigned int msc:3;
- float redx;
- float redy;
- float greenx;
- float greeny;
- float bluex;
- float bluey;
- float whitex;
- float whitey;
+ unsigned int input_type:1;
+ unsigned int input_voltage:2;
+ unsigned int input_setup:1;
+ unsigned int input_sync:5;
+ unsigned int input_dfp:1;
+ unsigned int input_bpc:3;
+ unsigned int input_interface:4;
+ /* 15 bit hole */
+ int hsize;
+ int vsize;
+ float gamma;
+ unsigned int dpms:3;
+ unsigned int display_type:2;
+ unsigned int msc:3;
+ float redx;
+ float redy;
+ float greenx;
+ float greeny;
+ float bluex;
+ float bluey;
+ float whitex;
+ float whitey;
};
struct established_timings {
- Uchar t1;
- Uchar t2;
- Uchar t_manu;
+ Uchar t1;
+ Uchar t2;
+ Uchar t_manu;
};
struct std_timings {
- int hsize;
- int vsize;
- int refresh;
- CARD16 id;
+ int hsize;
+ int vsize;
+ int refresh;
+ CARD16 id;
};
struct detailed_timings {
- int clock;
- int h_active;
- int h_blanking;
- int v_active;
- int v_blanking;
- int h_sync_off;
- int h_sync_width;
- int v_sync_off;
- int v_sync_width;
- int h_size;
- int v_size;
- int h_border;
- int v_border;
- unsigned int interlaced:1;
- unsigned int stereo:2;
- unsigned int sync:2;
- unsigned int misc:2;
- unsigned int stereo_1:1;
+ int clock;
+ int h_active;
+ int h_blanking;
+ int v_active;
+ int v_blanking;
+ int h_sync_off;
+ int h_sync_width;
+ int v_sync_off;
+ int v_sync_width;
+ int h_size;
+ int v_size;
+ int h_border;
+ int v_border;
+ unsigned int interlaced:1;
+ unsigned int stereo:2;
+ unsigned int sync:2;
+ unsigned int misc:2;
+ unsigned int stereo_1:1;
};
#define DT 0
@@ -477,35 +473,35 @@ struct detailed_timings {
#define DS_CVT 0xF8
#define DS_EST_III 0xF7
#define DS_DUMMY 0x10
-#define DS_UNKOWN 0x100 /* type is an int */
+#define DS_UNKOWN 0x100 /* type is an int */
#define DS_VENDOR 0x101
#define DS_VENDOR_MAX 0x110
struct monitor_ranges {
- int min_v;
- int max_v;
- int min_h;
- int max_h;
- int max_clock; /* in mhz */
- int gtf_2nd_f;
- int gtf_2nd_c;
- int gtf_2nd_m;
- int gtf_2nd_k;
- int gtf_2nd_j;
- int max_clock_khz;
- int maxwidth; /* in pixels */
- char supported_aspect;
- char preferred_aspect;
- char supported_blanking;
- char supported_scaling;
- int preferred_refresh; /* in hz */
+ int min_v;
+ int max_v;
+ int min_h;
+ int max_h;
+ int max_clock; /* in mhz */
+ int gtf_2nd_f;
+ int gtf_2nd_c;
+ int gtf_2nd_m;
+ int gtf_2nd_k;
+ int gtf_2nd_j;
+ int max_clock_khz;
+ int maxwidth; /* in pixels */
+ char supported_aspect;
+ char preferred_aspect;
+ char supported_blanking;
+ char supported_scaling;
+ int preferred_refresh; /* in hz */
};
-struct whitePoints{
- int index;
- float white_x;
- float white_y;
- float white_gamma;
+struct whitePoints {
+ int index;
+ float white_x;
+ float white_y;
+ float white_gamma;
};
struct cvt_timings {
@@ -522,19 +518,19 @@ struct cvt_timings {
* literally like serial and friends.
*/
struct detailed_monitor_section {
- int type;
- union {
- struct detailed_timings d_timings; /* 56 */
- Uchar serial[13];
- Uchar ascii_data[13];
- Uchar name[13];
- struct monitor_ranges ranges; /* 56 */
- struct std_timings std_t[5]; /* 80 */
- struct whitePoints wp[2]; /* 32 */
- /* color management data */
- struct cvt_timings cvt[4]; /* 64 */
- Uchar est_iii[6]; /* 6 */
- } section; /* max: 80 */
+ int type;
+ union {
+ struct detailed_timings d_timings; /* 56 */
+ Uchar serial[13];
+ Uchar ascii_data[13];
+ Uchar name[13];
+ struct monitor_ranges ranges; /* 56 */
+ struct std_timings std_t[5]; /* 80 */
+ struct whitePoints wp[2]; /* 32 */
+ /* color management data */
+ struct cvt_timings cvt[4]; /* 64 */
+ Uchar est_iii[6]; /* 6 */
+ } section; /* max: 80 */
};
/* flags */
@@ -548,16 +544,16 @@ struct detailed_monitor_section {
* are meaningful. For EDID, they all are.
*/
typedef struct {
- int scrnIndex;
- struct vendor vendor;
- struct edid_version ver;
- struct disp_features features;
- struct established_timings timings1;
- struct std_timings timings2[8];
- struct detailed_monitor_section det_mon[4];
- unsigned long flags;
- int no_sections;
- Uchar *rawData;
+ int scrnIndex;
+ struct vendor vendor;
+ struct edid_version ver;
+ struct disp_features features;
+ struct established_timings timings1;
+ struct std_timings timings2[8];
+ struct detailed_monitor_section det_mon[4];
+ unsigned long flags;
+ int no_sections;
+ Uchar *rawData;
} xf86Monitor, *xf86MonPtr;
extern _X_EXPORT xf86MonPtr ConfiguredMonitor;
@@ -590,73 +586,72 @@ extern _X_EXPORT xf86MonPtr ConfiguredMonitor;
#define HDMI_MAX_TMDS_UNIT (5000)
struct cea_video_block {
- Uchar video_code;
+ Uchar video_code;
};
struct cea_audio_block_descriptor {
- Uchar audio_code[3];
+ Uchar audio_code[3];
};
struct cea_audio_block {
- struct cea_audio_block_descriptor descriptor[10];
+ struct cea_audio_block_descriptor descriptor[10];
};
struct cea_vendor_block_hdmi {
- Uchar portB:4;
- Uchar portA:4;
- Uchar portD:4;
- Uchar portC:4;
- Uchar support_flags;
- Uchar max_tmds_clock;
- Uchar latency_present;
- Uchar video_latency;
- Uchar audio_latency;
- Uchar interlaced_video_latency;
- Uchar interlaced_audio_latency;
+ Uchar portB:4;
+ Uchar portA:4;
+ Uchar portD:4;
+ Uchar portC:4;
+ Uchar support_flags;
+ Uchar max_tmds_clock;
+ Uchar latency_present;
+ Uchar video_latency;
+ Uchar audio_latency;
+ Uchar interlaced_video_latency;
+ Uchar interlaced_audio_latency;
};
struct cea_vendor_block {
- unsigned char ieee_id[3];
- union {
- struct cea_vendor_block_hdmi hdmi;
- /* any other vendor blocks we know about */
- };
+ unsigned char ieee_id[3];
+ union {
+ struct cea_vendor_block_hdmi hdmi;
+ /* any other vendor blocks we know about */
+ };
};
-struct cea_speaker_block
-{
- Uchar FLR:1;
- Uchar LFE:1;
- Uchar FC:1;
- Uchar RLR:1;
- Uchar RC:1;
- Uchar FLRC:1;
- Uchar RLRC:1;
- Uchar FLRW:1;
- Uchar FLRH:1;
- Uchar TC:1;
- Uchar FCH:1;
- Uchar Resv:5;
- Uchar ResvByte;
+struct cea_speaker_block {
+ Uchar FLR:1;
+ Uchar LFE:1;
+ Uchar FC:1;
+ Uchar RLR:1;
+ Uchar RC:1;
+ Uchar FLRC:1;
+ Uchar RLRC:1;
+ Uchar FLRW:1;
+ Uchar FLRH:1;
+ Uchar TC:1;
+ Uchar FCH:1;
+ Uchar Resv:5;
+ Uchar ResvByte;
};
struct cea_data_block {
- Uchar len:5;
- Uchar tag:3;
- union{
- struct cea_video_block video;
- struct cea_audio_block audio;
- struct cea_vendor_block vendor;
- struct cea_speaker_block speaker;
- }u;
+ Uchar len:5;
+ Uchar tag:3;
+ union {
+ struct cea_video_block video;
+ struct cea_audio_block audio;
+ struct cea_vendor_block vendor;
+ struct cea_speaker_block speaker;
+ } u;
};
struct cea_ext_body {
- Uchar tag;
- Uchar rev;
- Uchar dt_offset;
- Uchar flags;
- struct cea_data_block data_collection;
+ Uchar tag;
+ Uchar rev;
+ Uchar dt_offset;
+ Uchar flags;
+ struct cea_data_block data_collection;
};
-#endif /* _EDID_H_ */
+#endif /* _EDID_H_ */
diff --git a/xorg-server/hw/xfree86/ddc/interpret_edid.c b/xorg-server/hw/xfree86/ddc/interpret_edid.c
index d1001a21f..882a6b201 100644
--- a/xorg-server/hw/xfree86/ddc/interpret_edid.c
+++ b/xorg-server/hw/xfree86/ddc/interpret_edid.c
@@ -1,685 +1,714 @@
-/*
- * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
- * Copyright 2007 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * interpret_edid.c: interpret a primary EDID block
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#define _PARSE_EDID_
-#include "xf86DDC.h"
-#include <string.h>
-
-static void get_vendor_section(Uchar*, struct vendor *);
-static void get_version_section(Uchar*, struct edid_version *);
-static void get_display_section(Uchar*, struct disp_features *,
- struct edid_version *);
-static void get_established_timing_section(Uchar*, struct established_timings *);
-static void get_std_timing_section(Uchar*, struct std_timings *,
- struct edid_version *);
-static void fetch_detailed_block(Uchar *c, struct edid_version *ver,
- struct detailed_monitor_section *det_mon);
-static void get_dt_md_section(Uchar *, struct edid_version *,
- struct detailed_monitor_section *det_mon);
-static void copy_string(Uchar *, Uchar *);
-static void get_dst_timing_section(Uchar *, struct std_timings *,
- struct edid_version *);
-static void get_monitor_ranges(Uchar *, struct monitor_ranges *);
-static void get_whitepoint_section(Uchar *, struct whitePoints *);
-static void get_detailed_timing_section(Uchar*, struct detailed_timings *);
-static Bool validate_version(int scrnIndex, struct edid_version *);
-
-static void
-find_ranges_section(struct detailed_monitor_section *det, void *ranges)
-{
- if (det->type == DS_RANGES && det->section.ranges.max_clock)
- *(struct monitor_ranges **)ranges = &det->section.ranges;
-}
-
-static void
-find_max_detailed_clock(struct detailed_monitor_section *det, void *ret)
-{
- if (det->type == DT) {
- *(int *)ret = max(*((int *)ret),
- det->section.d_timings.clock);
- }
-}
-
-static void
-handle_edid_quirks(xf86MonPtr m)
-{
- struct monitor_ranges *ranges = NULL;
-
- /*
- * max_clock is only encoded in EDID in tens of MHz, so occasionally we
- * find a monitor claiming a max of 160 with a mode requiring 162, or
- * similar. Strictly we should refuse to round up too far, but let's
- * see how well this works.
- */
-
- /* Try to find Monitor Range and max clock, then re-set range value*/
- xf86ForEachDetailedBlock(m, find_ranges_section, &ranges);
- if (ranges && ranges->max_clock) {
- int clock = 0;
- xf86ForEachDetailedBlock(m, find_max_detailed_clock, &clock);
- if (clock && (ranges->max_clock * 1e6 < clock)) {
- xf86Msg(X_WARNING, "EDID timing clock %.2f exceeds claimed max "
- "%dMHz, fixing\n", clock / 1.0e6, ranges->max_clock);
- ranges->max_clock = (clock+999999)/1e6;
- }
- }
-}
-
-struct det_hv_parameter {
- int real_hsize;
- int real_vsize;
- float target_aspect;
-};
-
-static void handle_detailed_hvsize(struct detailed_monitor_section *det_mon,
- void *data)
-{
- struct det_hv_parameter *p = (struct det_hv_parameter *)data;
- float timing_aspect;
-
- if (det_mon->type == DT) {
- struct detailed_timings *timing;
- timing = &det_mon->section.d_timings;
-
- if (!timing->v_size)
- return;
-
- timing_aspect = (float)timing->h_size / timing->v_size;
- if (fabs(1 - (timing_aspect / p->target_aspect)) < 0.05) {
- p->real_hsize = max(p->real_hsize, timing->h_size);
- p->real_vsize = max(p->real_vsize, timing->v_size);
- }
- }
-}
-
-static void encode_aspect_ratio(xf86MonPtr m)
-{
- /*
- * some monitors encode the aspect ratio instead of the physical size.
- * try to find the largest detailed timing that matches that aspect
- * ratio and use that to fill in the feature section.
- */
- if ((m->features.hsize == 16 && m->features.vsize == 9) ||
- (m->features.hsize == 16 && m->features.vsize == 10) ||
- (m->features.hsize == 4 && m->features.vsize == 3) ||
- (m->features.hsize == 5 && m->features.vsize == 4)) {
-
- struct det_hv_parameter p;
- p.real_hsize = 0;
- p.real_vsize = 0;
- p.target_aspect = (float)m->features.hsize /m->features.vsize;
-
- xf86ForEachDetailedBlock(m, handle_detailed_hvsize, &p);
-
- if (!p.real_hsize || !p.real_vsize) {
- m->features.hsize = m->features.vsize = 0;
- } else if ((m->features.hsize * 10 == p.real_hsize) &&
- (m->features.vsize * 10 == p.real_vsize)) {
- /* exact match is just unlikely, should do a better check though */
- m->features.hsize = m->features.vsize = 0;
- } else {
- /* convert mm to cm */
- m->features.hsize = (p.real_hsize + 5) / 10;
- m->features.vsize = (p.real_vsize + 5) / 10;
- }
-
- xf86Msg(X_INFO, "Quirked EDID physical size to %dx%d cm\n",
- m->features.hsize, m->features.vsize);
- }
-}
-
-xf86MonPtr
-xf86InterpretEDID(int scrnIndex, Uchar *block)
-{
- xf86MonPtr m;
-
- if (!block) return NULL;
- if (! (m = xnfcalloc(sizeof(xf86Monitor),1))) return NULL;
- m->scrnIndex = scrnIndex;
- m->rawData = block;
-
- get_vendor_section(SECTION(VENDOR_SECTION,block),&m->vendor);
- get_version_section(SECTION(VERSION_SECTION,block),&m->ver);
- if (!validate_version(scrnIndex, &m->ver)) goto error;
- get_display_section(SECTION(DISPLAY_SECTION,block),&m->features,
- &m->ver);
- get_established_timing_section(SECTION(ESTABLISHED_TIMING_SECTION,block),
- &m->timings1);
- get_std_timing_section(SECTION(STD_TIMING_SECTION,block),m->timings2,
- &m->ver);
- get_dt_md_section(SECTION(DET_TIMING_SECTION,block),&m->ver, m->det_mon);
- m->no_sections = (int)*(char *)SECTION(NO_EDID,block);
-
- handle_edid_quirks(m);
- encode_aspect_ratio(m);
-
- return m;
-
- error:
- free(m);
- return NULL;
-}
-
-static int get_cea_detail_timing(Uchar *blk, xf86MonPtr mon,
- struct detailed_monitor_section *det_mon)
-{
- int dt_num;
- int dt_offset = ((struct cea_ext_body *)blk)->dt_offset;
-
- dt_num = 0;
-
- if (dt_offset < CEA_EXT_MIN_DATA_OFFSET)
- return dt_num;
-
- for (; dt_offset < (CEA_EXT_MAX_DATA_OFFSET - DET_TIMING_INFO_LEN) &&
- dt_num < CEA_EXT_DET_TIMING_NUM;
- _NEXT_DT_MD_SECTION(dt_offset)) {
-
- fetch_detailed_block(blk + dt_offset, &mon->ver, det_mon + dt_num);
- dt_num = dt_num + 1 ;
- }
-
- return dt_num;
-}
-
-static void handle_cea_detail_block(Uchar *ext, xf86MonPtr mon,
- handle_detailed_fn fn,
- void *data)
-{
- int i;
- struct detailed_monitor_section det_mon[CEA_EXT_DET_TIMING_NUM];
- int det_mon_num;
-
- det_mon_num = get_cea_detail_timing(ext, mon, det_mon);
-
- for (i = 0; i < det_mon_num; i++)
- fn(det_mon + i, data);
-}
-
-void xf86ForEachDetailedBlock(xf86MonPtr mon,
- handle_detailed_fn fn,
- void *data)
-{
- int i;
- Uchar *ext;
-
- if (mon == NULL)
- return;
-
- for (i = 0; i < DET_TIMINGS; i++)
- fn(mon->det_mon + i, data);
-
- for (i = 0; i < mon->no_sections; i++) {
- ext = mon->rawData + EDID1_LEN * (i + 1);
- switch (ext[EXT_TAG]){
- case CEA_EXT:
- handle_cea_detail_block(ext, mon, fn, data);
- break;
- case VTB_EXT:
- case DI_EXT:
- case LS_EXT:
- case MI_EXT:
- break;
- }
- }
-}
-
-static struct cea_data_block *
-extract_cea_data_block(Uchar *ext, int data_type)
-{
- struct cea_ext_body *cea;
- struct cea_data_block *data_collection;
- struct cea_data_block *data_end;
-
- cea = (struct cea_ext_body *)ext;
-
- if (cea->dt_offset <= CEA_EXT_MIN_DATA_OFFSET)
- return NULL;
-
- data_collection = &cea->data_collection;
- data_end = (struct cea_data_block *)(cea->dt_offset + ext);
-
- for ( ;data_collection < data_end;) {
-
- if (data_type == data_collection->tag) {
- return data_collection;
- }
- data_collection = (void *)((unsigned char *)data_collection +
- data_collection->len + 1);
- }
-
- return NULL;
-}
-
-static void handle_cea_video_block(Uchar *ext, handle_video_fn fn, void *data)
-{
- struct cea_video_block *video;
- struct cea_video_block *video_end;
- struct cea_data_block *data_collection;
-
- data_collection = extract_cea_data_block(ext, CEA_VIDEO_BLK);
- if (data_collection == NULL)
- return;
-
- video = &data_collection->u.video;
- video_end = (struct cea_video_block *)
- ((Uchar *)video + data_collection->len);
-
- for (; video < video_end; video = video + 1) {
- fn(video, data);
- }
-}
-
-void xf86ForEachVideoBlock(xf86MonPtr mon,
- handle_video_fn fn,
- void *data)
-{
- int i;
- Uchar *ext;
-
- if (mon == NULL)
- return;
-
- for (i = 0; i < mon->no_sections; i++) {
- ext = mon->rawData + EDID1_LEN * (i + 1);
- switch (ext[EXT_TAG]) {
- case CEA_EXT:
- handle_cea_video_block(ext, fn, data);
- break;
- case VTB_EXT:
- case DI_EXT:
- case LS_EXT:
- case MI_EXT:
- break;
- }
- }
-}
-
-xf86MonPtr
-xf86InterpretEEDID(int scrnIndex, Uchar *block)
-{
- xf86MonPtr m;
-
- m = xf86InterpretEDID(scrnIndex, block);
- if (!m)
- return NULL;
-
- /* extension parse */
-
- return m;
-}
-
-static void
-get_vendor_section(Uchar *c, struct vendor *r)
-{
- r->name[0] = L1;
- r->name[1] = L2;
- r->name[2] = L3;
- r->name[3] = '\0';
-
- r->prod_id = PROD_ID;
- r->serial = SERIAL_NO;
- r->week = WEEK;
- r->year = YEAR;
-}
-
-static void
-get_version_section(Uchar *c, struct edid_version *r)
-{
- r->version = VERSION;
- r->revision = REVISION;
-}
-
-static void
-get_display_section(Uchar *c, struct disp_features *r,
- struct edid_version *v)
-{
- r->input_type = INPUT_TYPE;
- if (!DIGITAL(r->input_type)) {
- r->input_voltage = INPUT_VOLTAGE;
- r->input_setup = SETUP;
- r->input_sync = SYNC;
- } else if (v->revision == 2 || v->revision == 3) {
- r->input_dfp = DFP;
- } else if (v->revision >= 4) {
- r->input_bpc = BPC;
- r->input_interface = DIGITAL_INTERFACE;
- }
- r->hsize = HSIZE_MAX;
- r->vsize = VSIZE_MAX;
- r->gamma = GAMMA;
- r->dpms = DPMS;
- r->display_type = DISPLAY_TYPE;
- r->msc = MSC;
- r->redx = REDX;
- r->redy = REDY;
- r->greenx = GREENX;
- r->greeny = GREENY;
- r->bluex = BLUEX;
- r->bluey = BLUEY;
- r->whitex = WHITEX;
- r->whitey = WHITEY;
-}
-
-static void
-get_established_timing_section(Uchar *c, struct established_timings *r)
-{
- r->t1 = T1;
- r->t2 = T2;
- r->t_manu = T_MANU;
-}
-
-static void
-get_cvt_timing_section(Uchar *c, struct cvt_timings *r)
-{
- int i;
-
- for (i = 0; i < 4; i++) {
- if (c[0] && c[1] && c[2]) {
- r[i].height = (c[0] + ((c[1] & 0xF0) << 8) + 1) * 2;
- switch (c[1] & 0xc0) {
- case 0x00: r[i].width = r[i].height * 4 / 3; break;
- case 0x40: r[i].width = r[i].height * 16 / 9; break;
- case 0x80: r[i].width = r[i].height * 16 / 10; break;
- case 0xc0: r[i].width = r[i].height * 15 / 9; break;
- }
- switch (c[2] & 0x60) {
- case 0x00: r[i].rate = 50; break;
- case 0x20: r[i].rate = 60; break;
- case 0x40: r[i].rate = 75; break;
- case 0x60: r[i].rate = 85; break;
- }
- r[i].rates = c[2] & 0x1f;
- } else {
- return;
- }
- c += 3;
- }
-}
-
-static void
-get_std_timing_section(Uchar *c, struct std_timings *r,
- struct edid_version *v)
-{
- int i;
-
- for (i=0;i<STD_TIMINGS;i++){
- if (VALID_TIMING) {
- r[i].hsize = HSIZE1;
- VSIZE1(r[i].vsize);
- r[i].refresh = REFRESH_R;
- r[i].id = STD_TIMING_ID;
- } else {
- r[i].hsize = r[i].vsize = r[i].refresh = r[i].id = 0;
- }
- NEXT_STD_TIMING;
- }
-}
-
-static const unsigned char empty_block[18];
-
-static void
-fetch_detailed_block(Uchar *c, struct edid_version *ver,
- struct detailed_monitor_section *det_mon)
-{
- if (ver->version == 1 && ver->revision >= 1 && IS_MONITOR_DESC) {
- switch (MONITOR_DESC_TYPE) {
- case SERIAL_NUMBER:
- det_mon->type = DS_SERIAL;
- copy_string(c,det_mon->section.serial);
- break;
- case ASCII_STR:
- det_mon->type = DS_ASCII_STR;
- copy_string(c,det_mon->section.ascii_data);
- break;
- case MONITOR_RANGES:
- det_mon->type = DS_RANGES;
- get_monitor_ranges(c,&det_mon->section.ranges);
- break;
- case MONITOR_NAME:
- det_mon->type = DS_NAME;
- copy_string(c,det_mon->section.name);
- break;
- case ADD_COLOR_POINT:
- det_mon->type = DS_WHITE_P;
- get_whitepoint_section(c,det_mon->section.wp);
- break;
- case ADD_STD_TIMINGS:
- det_mon->type = DS_STD_TIMINGS;
- get_dst_timing_section(c,det_mon->section.std_t, ver);
- break;
- case COLOR_MANAGEMENT_DATA:
- det_mon->type = DS_CMD;
- break;
- case CVT_3BYTE_DATA:
- det_mon->type = DS_CVT;
- get_cvt_timing_section(c, det_mon->section.cvt);
- break;
- case ADD_EST_TIMINGS:
- det_mon->type = DS_EST_III;
- memcpy(det_mon->section.est_iii, c + 6, 6);
- break;
- case ADD_DUMMY:
- det_mon->type = DS_DUMMY;
- break;
- default:
- det_mon->type = DS_UNKOWN;
- break;
- }
- if (c[3] <= 0x0F && memcmp(c, empty_block, sizeof(empty_block))) {
- det_mon->type = DS_VENDOR + c[3];
- }
- } else {
- det_mon->type = DT;
- get_detailed_timing_section(c, &det_mon->section.d_timings);
- }
-}
-
-static void
-get_dt_md_section(Uchar *c, struct edid_version *ver,
- struct detailed_monitor_section *det_mon)
-{
- int i;
-
- for (i=0; i < DET_TIMINGS; i++) {
- fetch_detailed_block(c, ver, det_mon + i);
- NEXT_DT_MD_SECTION;
- }
-}
-
-static void
-copy_string(Uchar *c, Uchar *s)
-{
- int i;
- c = c + 5;
- for (i = 0; (i < 13 && *c != 0x0A); i++)
- *(s++) = *(c++);
- *s = 0;
- while (i-- && (*--s == 0x20)) *s = 0;
-}
-
-static void
-get_dst_timing_section(Uchar *c, struct std_timings *t,
- struct edid_version *v)
-{
- int j;
- c = c + 5;
- for (j = 0; j < 5; j++) {
- t[j].hsize = HSIZE1;
- VSIZE1(t[j].vsize);
- t[j].refresh = REFRESH_R;
- t[j].id = STD_TIMING_ID;
- NEXT_STD_TIMING;
- }
-}
-
-static void
-get_monitor_ranges(Uchar *c, struct monitor_ranges *r)
-{
- r->min_v = MIN_V;
- r->max_v = MAX_V;
- r->min_h = MIN_H;
- r->max_h = MAX_H;
- r->max_clock = 0;
- if(MAX_CLOCK != 0xff) /* is specified? */
- r->max_clock = MAX_CLOCK * 10 + 5;
- if (HAVE_2ND_GTF) {
- r->gtf_2nd_f = F_2ND_GTF;
- r->gtf_2nd_c = C_2ND_GTF;
- r->gtf_2nd_m = M_2ND_GTF;
- r->gtf_2nd_k = K_2ND_GTF;
- r->gtf_2nd_j = J_2ND_GTF;
- } else {
- r->gtf_2nd_f = 0;
- }
- if (HAVE_CVT) {
- r->max_clock_khz = MAX_CLOCK_KHZ;
- r->max_clock = r->max_clock_khz / 1000;
- r->maxwidth = MAXWIDTH;
- r->supported_aspect = SUPPORTED_ASPECT;
- r->preferred_aspect = PREFERRED_ASPECT;
- r->supported_blanking = SUPPORTED_BLANKING;
- r->supported_scaling = SUPPORTED_SCALING;
- r->preferred_refresh = PREFERRED_REFRESH;
- } else {
- r->max_clock_khz = 0;
- }
-}
-
-static void
-get_whitepoint_section(Uchar *c, struct whitePoints *wp)
-{
- wp[0].white_x = WHITEX1;
- wp[0].white_y = WHITEY1;
- wp[1].white_x = WHITEX2;
- wp[1].white_y = WHITEY2;
- wp[0].index = WHITE_INDEX1;
- wp[1].index = WHITE_INDEX2;
- wp[0].white_gamma = WHITE_GAMMA1;
- wp[1].white_gamma = WHITE_GAMMA2;
-}
-
-static void
-get_detailed_timing_section(Uchar *c, struct detailed_timings *r)
-{
- r->clock = PIXEL_CLOCK;
- r->h_active = H_ACTIVE;
- r->h_blanking = H_BLANK;
- r->v_active = V_ACTIVE;
- r->v_blanking = V_BLANK;
- r->h_sync_off = H_SYNC_OFF;
- r->h_sync_width = H_SYNC_WIDTH;
- r->v_sync_off = V_SYNC_OFF;
- r->v_sync_width = V_SYNC_WIDTH;
- r->h_size = H_SIZE;
- r->v_size = V_SIZE;
- r->h_border = H_BORDER;
- r->v_border = V_BORDER;
- r->interlaced = INTERLACED;
- r->stereo = STEREO;
- r->stereo_1 = STEREO1;
- r->sync = SYNC_T;
- r->misc = MISC;
-}
-
-#define MAX_EDID_MINOR 4
-
-static Bool
-validate_version(int scrnIndex, struct edid_version *r)
-{
- if (r->version != 1) {
- xf86DrvMsg(scrnIndex, X_ERROR, "Unknown EDID version %d\n",
- r->version);
- return FALSE;
- }
-
- if (r->revision > MAX_EDID_MINOR)
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Assuming version 1.%d is compatible with 1.%d\n",
- r->revision, MAX_EDID_MINOR);
-
- return TRUE;
-}
-
-/*
- * Returns true if HDMI, false if definitely not or unknown.
- */
-Bool
-xf86MonitorIsHDMI(xf86MonPtr mon)
-{
- int i = 0, version, offset;
- char *edid = NULL;
-
- if (!mon)
- return FALSE;
-
- if (!(mon->flags & EDID_COMPLETE_RAWDATA))
- return FALSE;
-
- if (!mon->no_sections)
- return FALSE;
-
- edid = (char *)mon->rawData;
- if (!edid)
- return FALSE;
-
- /* find the CEA extension block */
- for (i = 1; i <= mon->no_sections; i++)
- if (edid[i * 128] == 0x02)
- break;
- if (i == mon->no_sections + 1)
- return FALSE;
- edid += (i * 128);
-
- version = edid[1];
- offset = edid[2];
- if (version < 3 || offset < 4)
- return FALSE;
-
- /* walk the cea data blocks */
- for (i = 4; i < offset; i += (edid[i] & 0x1f) + 1) {
- char *x = edid + i;
-
- /* find a vendor specific block */
- if ((x[0] & 0xe0) >> 5 == 0x03) {
- int oui = (x[3] << 16) + (x[2] << 8) + x[1];
-
- /* find the HDMI vendor OUI */
- if (oui == 0x000c03)
- return TRUE;
- }
- }
-
- /* guess it's not HDMI after all */
- return FALSE;
-}
+/*
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ * Copyright 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * interpret_edid.c: interpret a primary EDID block
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#define _PARSE_EDID_
+#include "xf86DDC.h"
+#include <string.h>
+
+static void get_vendor_section(Uchar *, struct vendor *);
+static void get_version_section(Uchar *, struct edid_version *);
+static void get_display_section(Uchar *, struct disp_features *,
+ struct edid_version *);
+static void get_established_timing_section(Uchar *,
+ struct established_timings *);
+static void get_std_timing_section(Uchar *, struct std_timings *,
+ struct edid_version *);
+static void fetch_detailed_block(Uchar * c, struct edid_version *ver,
+ struct detailed_monitor_section *det_mon);
+static void get_dt_md_section(Uchar *, struct edid_version *,
+ struct detailed_monitor_section *det_mon);
+static void copy_string(Uchar *, Uchar *);
+static void get_dst_timing_section(Uchar *, struct std_timings *,
+ struct edid_version *);
+static void get_monitor_ranges(Uchar *, struct monitor_ranges *);
+static void get_whitepoint_section(Uchar *, struct whitePoints *);
+static void get_detailed_timing_section(Uchar *, struct detailed_timings *);
+static Bool validate_version(int scrnIndex, struct edid_version *);
+
+static void
+find_ranges_section(struct detailed_monitor_section *det, void *ranges)
+{
+ if (det->type == DS_RANGES && det->section.ranges.max_clock)
+ *(struct monitor_ranges **) ranges = &det->section.ranges;
+}
+
+static void
+find_max_detailed_clock(struct detailed_monitor_section *det, void *ret)
+{
+ if (det->type == DT) {
+ *(int *) ret = max(*((int *) ret), det->section.d_timings.clock);
+ }
+}
+
+static void
+handle_edid_quirks(xf86MonPtr m)
+{
+ struct monitor_ranges *ranges = NULL;
+
+ /*
+ * max_clock is only encoded in EDID in tens of MHz, so occasionally we
+ * find a monitor claiming a max of 160 with a mode requiring 162, or
+ * similar. Strictly we should refuse to round up too far, but let's
+ * see how well this works.
+ */
+
+ /* Try to find Monitor Range and max clock, then re-set range value */
+ xf86ForEachDetailedBlock(m, find_ranges_section, &ranges);
+ if (ranges && ranges->max_clock) {
+ int clock = 0;
+
+ xf86ForEachDetailedBlock(m, find_max_detailed_clock, &clock);
+ if (clock && (ranges->max_clock * 1e6 < clock)) {
+ xf86Msg(X_WARNING, "EDID timing clock %.2f exceeds claimed max "
+ "%dMHz, fixing\n", clock / 1.0e6, ranges->max_clock);
+ ranges->max_clock = (clock + 999999) / 1e6;
+ }
+ }
+}
+
+struct det_hv_parameter {
+ int real_hsize;
+ int real_vsize;
+ float target_aspect;
+};
+
+static void
+handle_detailed_hvsize(struct detailed_monitor_section *det_mon, void *data)
+{
+ struct det_hv_parameter *p = (struct det_hv_parameter *) data;
+ float timing_aspect;
+
+ if (det_mon->type == DT) {
+ struct detailed_timings *timing;
+
+ timing = &det_mon->section.d_timings;
+
+ if (!timing->v_size)
+ return;
+
+ timing_aspect = (float) timing->h_size / timing->v_size;
+ if (fabs(1 - (timing_aspect / p->target_aspect)) < 0.05) {
+ p->real_hsize = max(p->real_hsize, timing->h_size);
+ p->real_vsize = max(p->real_vsize, timing->v_size);
+ }
+ }
+}
+
+static void
+encode_aspect_ratio(xf86MonPtr m)
+{
+ /*
+ * some monitors encode the aspect ratio instead of the physical size.
+ * try to find the largest detailed timing that matches that aspect
+ * ratio and use that to fill in the feature section.
+ */
+ if ((m->features.hsize == 16 && m->features.vsize == 9) ||
+ (m->features.hsize == 16 && m->features.vsize == 10) ||
+ (m->features.hsize == 4 && m->features.vsize == 3) ||
+ (m->features.hsize == 5 && m->features.vsize == 4)) {
+
+ struct det_hv_parameter p;
+
+ p.real_hsize = 0;
+ p.real_vsize = 0;
+ p.target_aspect = (float) m->features.hsize / m->features.vsize;
+
+ xf86ForEachDetailedBlock(m, handle_detailed_hvsize, &p);
+
+ if (!p.real_hsize || !p.real_vsize) {
+ m->features.hsize = m->features.vsize = 0;
+ }
+ else if ((m->features.hsize * 10 == p.real_hsize) &&
+ (m->features.vsize * 10 == p.real_vsize)) {
+ /* exact match is just unlikely, should do a better check though */
+ m->features.hsize = m->features.vsize = 0;
+ }
+ else {
+ /* convert mm to cm */
+ m->features.hsize = (p.real_hsize + 5) / 10;
+ m->features.vsize = (p.real_vsize + 5) / 10;
+ }
+
+ xf86Msg(X_INFO, "Quirked EDID physical size to %dx%d cm\n",
+ m->features.hsize, m->features.vsize);
+ }
+}
+
+xf86MonPtr
+xf86InterpretEDID(int scrnIndex, Uchar * block)
+{
+ xf86MonPtr m;
+
+ if (!block)
+ return NULL;
+ if (!(m = xnfcalloc(sizeof(xf86Monitor), 1)))
+ return NULL;
+ m->scrnIndex = scrnIndex;
+ m->rawData = block;
+
+ get_vendor_section(SECTION(VENDOR_SECTION, block), &m->vendor);
+ get_version_section(SECTION(VERSION_SECTION, block), &m->ver);
+ if (!validate_version(scrnIndex, &m->ver))
+ goto error;
+ get_display_section(SECTION(DISPLAY_SECTION, block), &m->features, &m->ver);
+ get_established_timing_section(SECTION(ESTABLISHED_TIMING_SECTION, block),
+ &m->timings1);
+ get_std_timing_section(SECTION(STD_TIMING_SECTION, block), m->timings2,
+ &m->ver);
+ get_dt_md_section(SECTION(DET_TIMING_SECTION, block), &m->ver, m->det_mon);
+ m->no_sections = (int) *(char *) SECTION(NO_EDID, block);
+
+ handle_edid_quirks(m);
+ encode_aspect_ratio(m);
+
+ return m;
+
+ error:
+ free(m);
+ return NULL;
+}
+
+static int
+get_cea_detail_timing(Uchar * blk, xf86MonPtr mon,
+ struct detailed_monitor_section *det_mon)
+{
+ int dt_num;
+ int dt_offset = ((struct cea_ext_body *) blk)->dt_offset;
+
+ dt_num = 0;
+
+ if (dt_offset < CEA_EXT_MIN_DATA_OFFSET)
+ return dt_num;
+
+ for (; dt_offset < (CEA_EXT_MAX_DATA_OFFSET - DET_TIMING_INFO_LEN) &&
+ dt_num < CEA_EXT_DET_TIMING_NUM; _NEXT_DT_MD_SECTION(dt_offset)) {
+
+ fetch_detailed_block(blk + dt_offset, &mon->ver, det_mon + dt_num);
+ dt_num = dt_num + 1;
+ }
+
+ return dt_num;
+}
+
+static void
+handle_cea_detail_block(Uchar * ext, xf86MonPtr mon,
+ handle_detailed_fn fn, void *data)
+{
+ int i;
+ struct detailed_monitor_section det_mon[CEA_EXT_DET_TIMING_NUM];
+ int det_mon_num;
+
+ det_mon_num = get_cea_detail_timing(ext, mon, det_mon);
+
+ for (i = 0; i < det_mon_num; i++)
+ fn(det_mon + i, data);
+}
+
+void
+xf86ForEachDetailedBlock(xf86MonPtr mon, handle_detailed_fn fn, void *data)
+{
+ int i;
+ Uchar *ext;
+
+ if (mon == NULL)
+ return;
+
+ for (i = 0; i < DET_TIMINGS; i++)
+ fn(mon->det_mon + i, data);
+
+ for (i = 0; i < mon->no_sections; i++) {
+ ext = mon->rawData + EDID1_LEN * (i + 1);
+ switch (ext[EXT_TAG]) {
+ case CEA_EXT:
+ handle_cea_detail_block(ext, mon, fn, data);
+ break;
+ case VTB_EXT:
+ case DI_EXT:
+ case LS_EXT:
+ case MI_EXT:
+ break;
+ }
+ }
+}
+
+static struct cea_data_block *
+extract_cea_data_block(Uchar * ext, int data_type)
+{
+ struct cea_ext_body *cea;
+ struct cea_data_block *data_collection;
+ struct cea_data_block *data_end;
+
+ cea = (struct cea_ext_body *) ext;
+
+ if (cea->dt_offset <= CEA_EXT_MIN_DATA_OFFSET)
+ return NULL;
+
+ data_collection = &cea->data_collection;
+ data_end = (struct cea_data_block *) (cea->dt_offset + ext);
+
+ for (; data_collection < data_end;) {
+
+ if (data_type == data_collection->tag) {
+ return data_collection;
+ }
+ data_collection = (void *) ((unsigned char *) data_collection +
+ data_collection->len + 1);
+ }
+
+ return NULL;
+}
+
+static void
+handle_cea_video_block(Uchar * ext, handle_video_fn fn, void *data)
+{
+ struct cea_video_block *video;
+ struct cea_video_block *video_end;
+ struct cea_data_block *data_collection;
+
+ data_collection = extract_cea_data_block(ext, CEA_VIDEO_BLK);
+ if (data_collection == NULL)
+ return;
+
+ video = &data_collection->u.video;
+ video_end = (struct cea_video_block *)
+ ((Uchar *) video + data_collection->len);
+
+ for (; video < video_end; video = video + 1) {
+ fn(video, data);
+ }
+}
+
+void
+xf86ForEachVideoBlock(xf86MonPtr mon, handle_video_fn fn, void *data)
+{
+ int i;
+ Uchar *ext;
+
+ if (mon == NULL)
+ return;
+
+ for (i = 0; i < mon->no_sections; i++) {
+ ext = mon->rawData + EDID1_LEN * (i + 1);
+ switch (ext[EXT_TAG]) {
+ case CEA_EXT:
+ handle_cea_video_block(ext, fn, data);
+ break;
+ case VTB_EXT:
+ case DI_EXT:
+ case LS_EXT:
+ case MI_EXT:
+ break;
+ }
+ }
+}
+
+xf86MonPtr
+xf86InterpretEEDID(int scrnIndex, Uchar * block)
+{
+ xf86MonPtr m;
+
+ m = xf86InterpretEDID(scrnIndex, block);
+ if (!m)
+ return NULL;
+
+ /* extension parse */
+
+ return m;
+}
+
+static void
+get_vendor_section(Uchar * c, struct vendor *r)
+{
+ r->name[0] = L1;
+ r->name[1] = L2;
+ r->name[2] = L3;
+ r->name[3] = '\0';
+
+ r->prod_id = PROD_ID;
+ r->serial = SERIAL_NO;
+ r->week = WEEK;
+ r->year = YEAR;
+}
+
+static void
+get_version_section(Uchar * c, struct edid_version *r)
+{
+ r->version = VERSION;
+ r->revision = REVISION;
+}
+
+static void
+get_display_section(Uchar * c, struct disp_features *r, struct edid_version *v)
+{
+ r->input_type = INPUT_TYPE;
+ if (!DIGITAL(r->input_type)) {
+ r->input_voltage = INPUT_VOLTAGE;
+ r->input_setup = SETUP;
+ r->input_sync = SYNC;
+ }
+ else if (v->revision == 2 || v->revision == 3) {
+ r->input_dfp = DFP;
+ }
+ else if (v->revision >= 4) {
+ r->input_bpc = BPC;
+ r->input_interface = DIGITAL_INTERFACE;
+ }
+ r->hsize = HSIZE_MAX;
+ r->vsize = VSIZE_MAX;
+ r->gamma = GAMMA;
+ r->dpms = DPMS;
+ r->display_type = DISPLAY_TYPE;
+ r->msc = MSC;
+ r->redx = REDX;
+ r->redy = REDY;
+ r->greenx = GREENX;
+ r->greeny = GREENY;
+ r->bluex = BLUEX;
+ r->bluey = BLUEY;
+ r->whitex = WHITEX;
+ r->whitey = WHITEY;
+}
+
+static void
+get_established_timing_section(Uchar * c, struct established_timings *r)
+{
+ r->t1 = T1;
+ r->t2 = T2;
+ r->t_manu = T_MANU;
+}
+
+static void
+get_cvt_timing_section(Uchar * c, struct cvt_timings *r)
+{
+ int i;
+
+ for (i = 0; i < 4; i++) {
+ if (c[0] && c[1] && c[2]) {
+ r[i].height = (c[0] + ((c[1] & 0xF0) << 8) + 1) * 2;
+ switch (c[1] & 0xc0) {
+ case 0x00:
+ r[i].width = r[i].height * 4 / 3;
+ break;
+ case 0x40:
+ r[i].width = r[i].height * 16 / 9;
+ break;
+ case 0x80:
+ r[i].width = r[i].height * 16 / 10;
+ break;
+ case 0xc0:
+ r[i].width = r[i].height * 15 / 9;
+ break;
+ }
+ switch (c[2] & 0x60) {
+ case 0x00:
+ r[i].rate = 50;
+ break;
+ case 0x20:
+ r[i].rate = 60;
+ break;
+ case 0x40:
+ r[i].rate = 75;
+ break;
+ case 0x60:
+ r[i].rate = 85;
+ break;
+ }
+ r[i].rates = c[2] & 0x1f;
+ }
+ else {
+ return;
+ }
+ c += 3;
+ }
+}
+
+static void
+get_std_timing_section(Uchar * c, struct std_timings *r, struct edid_version *v)
+{
+ int i;
+
+ for (i = 0; i < STD_TIMINGS; i++) {
+ if (VALID_TIMING) {
+ r[i].hsize = HSIZE1;
+ VSIZE1(r[i].vsize);
+ r[i].refresh = REFRESH_R;
+ r[i].id = STD_TIMING_ID;
+ }
+ else {
+ r[i].hsize = r[i].vsize = r[i].refresh = r[i].id = 0;
+ }
+ NEXT_STD_TIMING;
+ }
+}
+
+static const unsigned char empty_block[18];
+
+static void
+fetch_detailed_block(Uchar * c, struct edid_version *ver,
+ struct detailed_monitor_section *det_mon)
+{
+ if (ver->version == 1 && ver->revision >= 1 && IS_MONITOR_DESC) {
+ switch (MONITOR_DESC_TYPE) {
+ case SERIAL_NUMBER:
+ det_mon->type = DS_SERIAL;
+ copy_string(c, det_mon->section.serial);
+ break;
+ case ASCII_STR:
+ det_mon->type = DS_ASCII_STR;
+ copy_string(c, det_mon->section.ascii_data);
+ break;
+ case MONITOR_RANGES:
+ det_mon->type = DS_RANGES;
+ get_monitor_ranges(c, &det_mon->section.ranges);
+ break;
+ case MONITOR_NAME:
+ det_mon->type = DS_NAME;
+ copy_string(c, det_mon->section.name);
+ break;
+ case ADD_COLOR_POINT:
+ det_mon->type = DS_WHITE_P;
+ get_whitepoint_section(c, det_mon->section.wp);
+ break;
+ case ADD_STD_TIMINGS:
+ det_mon->type = DS_STD_TIMINGS;
+ get_dst_timing_section(c, det_mon->section.std_t, ver);
+ break;
+ case COLOR_MANAGEMENT_DATA:
+ det_mon->type = DS_CMD;
+ break;
+ case CVT_3BYTE_DATA:
+ det_mon->type = DS_CVT;
+ get_cvt_timing_section(c, det_mon->section.cvt);
+ break;
+ case ADD_EST_TIMINGS:
+ det_mon->type = DS_EST_III;
+ memcpy(det_mon->section.est_iii, c + 6, 6);
+ break;
+ case ADD_DUMMY:
+ det_mon->type = DS_DUMMY;
+ break;
+ default:
+ det_mon->type = DS_UNKOWN;
+ break;
+ }
+ if (c[3] <= 0x0F && memcmp(c, empty_block, sizeof(empty_block))) {
+ det_mon->type = DS_VENDOR + c[3];
+ }
+ }
+ else {
+ det_mon->type = DT;
+ get_detailed_timing_section(c, &det_mon->section.d_timings);
+ }
+}
+
+static void
+get_dt_md_section(Uchar * c, struct edid_version *ver,
+ struct detailed_monitor_section *det_mon)
+{
+ int i;
+
+ for (i = 0; i < DET_TIMINGS; i++) {
+ fetch_detailed_block(c, ver, det_mon + i);
+ NEXT_DT_MD_SECTION;
+ }
+}
+
+static void
+copy_string(Uchar * c, Uchar * s)
+{
+ int i;
+
+ c = c + 5;
+ for (i = 0; (i < 13 && *c != 0x0A); i++)
+ *(s++) = *(c++);
+ *s = 0;
+ while (i-- && (*--s == 0x20))
+ *s = 0;
+}
+
+static void
+get_dst_timing_section(Uchar * c, struct std_timings *t, struct edid_version *v)
+{
+ int j;
+
+ c = c + 5;
+ for (j = 0; j < 5; j++) {
+ t[j].hsize = HSIZE1;
+ VSIZE1(t[j].vsize);
+ t[j].refresh = REFRESH_R;
+ t[j].id = STD_TIMING_ID;
+ NEXT_STD_TIMING;
+ }
+}
+
+static void
+get_monitor_ranges(Uchar * c, struct monitor_ranges *r)
+{
+ r->min_v = MIN_V;
+ r->max_v = MAX_V;
+ r->min_h = MIN_H;
+ r->max_h = MAX_H;
+ r->max_clock = 0;
+ if (MAX_CLOCK != 0xff) /* is specified? */
+ r->max_clock = MAX_CLOCK * 10 + 5;
+ if (HAVE_2ND_GTF) {
+ r->gtf_2nd_f = F_2ND_GTF;
+ r->gtf_2nd_c = C_2ND_GTF;
+ r->gtf_2nd_m = M_2ND_GTF;
+ r->gtf_2nd_k = K_2ND_GTF;
+ r->gtf_2nd_j = J_2ND_GTF;
+ }
+ else {
+ r->gtf_2nd_f = 0;
+ }
+ if (HAVE_CVT) {
+ r->max_clock_khz = MAX_CLOCK_KHZ;
+ r->max_clock = r->max_clock_khz / 1000;
+ r->maxwidth = MAXWIDTH;
+ r->supported_aspect = SUPPORTED_ASPECT;
+ r->preferred_aspect = PREFERRED_ASPECT;
+ r->supported_blanking = SUPPORTED_BLANKING;
+ r->supported_scaling = SUPPORTED_SCALING;
+ r->preferred_refresh = PREFERRED_REFRESH;
+ }
+ else {
+ r->max_clock_khz = 0;
+ }
+}
+
+static void
+get_whitepoint_section(Uchar * c, struct whitePoints *wp)
+{
+ wp[0].white_x = WHITEX1;
+ wp[0].white_y = WHITEY1;
+ wp[1].white_x = WHITEX2;
+ wp[1].white_y = WHITEY2;
+ wp[0].index = WHITE_INDEX1;
+ wp[1].index = WHITE_INDEX2;
+ wp[0].white_gamma = WHITE_GAMMA1;
+ wp[1].white_gamma = WHITE_GAMMA2;
+}
+
+static void
+get_detailed_timing_section(Uchar * c, struct detailed_timings *r)
+{
+ r->clock = PIXEL_CLOCK;
+ r->h_active = H_ACTIVE;
+ r->h_blanking = H_BLANK;
+ r->v_active = V_ACTIVE;
+ r->v_blanking = V_BLANK;
+ r->h_sync_off = H_SYNC_OFF;
+ r->h_sync_width = H_SYNC_WIDTH;
+ r->v_sync_off = V_SYNC_OFF;
+ r->v_sync_width = V_SYNC_WIDTH;
+ r->h_size = H_SIZE;
+ r->v_size = V_SIZE;
+ r->h_border = H_BORDER;
+ r->v_border = V_BORDER;
+ r->interlaced = INTERLACED;
+ r->stereo = STEREO;
+ r->stereo_1 = STEREO1;
+ r->sync = SYNC_T;
+ r->misc = MISC;
+}
+
+#define MAX_EDID_MINOR 4
+
+static Bool
+validate_version(int scrnIndex, struct edid_version *r)
+{
+ if (r->version != 1) {
+ xf86DrvMsg(scrnIndex, X_ERROR, "Unknown EDID version %d\n", r->version);
+ return FALSE;
+ }
+
+ if (r->revision > MAX_EDID_MINOR)
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Assuming version 1.%d is compatible with 1.%d\n",
+ r->revision, MAX_EDID_MINOR);
+
+ return TRUE;
+}
+
+/*
+ * Returns true if HDMI, false if definitely not or unknown.
+ */
+Bool
+xf86MonitorIsHDMI(xf86MonPtr mon)
+{
+ int i = 0, version, offset;
+ char *edid = NULL;
+
+ if (!mon)
+ return FALSE;
+
+ if (!(mon->flags & EDID_COMPLETE_RAWDATA))
+ return FALSE;
+
+ if (!mon->no_sections)
+ return FALSE;
+
+ edid = (char *) mon->rawData;
+ if (!edid)
+ return FALSE;
+
+ /* find the CEA extension block */
+ for (i = 1; i <= mon->no_sections; i++)
+ if (edid[i * 128] == 0x02)
+ break;
+ if (i == mon->no_sections + 1)
+ return FALSE;
+ edid += (i * 128);
+
+ version = edid[1];
+ offset = edid[2];
+ if (version < 3 || offset < 4)
+ return FALSE;
+
+ /* walk the cea data blocks */
+ for (i = 4; i < offset; i += (edid[i] & 0x1f) + 1) {
+ char *x = edid + i;
+
+ /* find a vendor specific block */
+ if ((x[0] & 0xe0) >> 5 == 0x03) {
+ int oui = (x[3] << 16) + (x[2] << 8) + x[1];
+
+ /* find the HDMI vendor OUI */
+ if (oui == 0x000c03)
+ return TRUE;
+ }
+ }
+
+ /* guess it's not HDMI after all */
+ return FALSE;
+}
diff --git a/xorg-server/hw/xfree86/ddc/print_edid.c b/xorg-server/hw/xfree86/ddc/print_edid.c
index 1faae1e33..4f983f934 100644
--- a/xorg-server/hw/xfree86/ddc/print_edid.c
+++ b/xorg-server/hw/xfree86/ddc/print_edid.c
@@ -36,24 +36,24 @@
#include "xf86_OSproc.h"
#include "xf86DDC.h"
#include "edid.h"
-
+
#define EDID_WIDTH 16
-
+
static void
print_vendor(int scrnIndex, struct vendor *c)
{
xf86DrvMsg(scrnIndex, X_INFO, "Manufacturer: %s Model: %x Serial#: %u\n",
- (char *)&c->name, c->prod_id, c->serial);
+ (char *) &c->name, c->prod_id, c->serial);
xf86DrvMsg(scrnIndex, X_INFO, "Year: %u Week: %u\n", c->year, c->week);
}
static void
print_version(int scrnIndex, struct edid_version *c)
{
- xf86DrvMsg(scrnIndex,X_INFO,"EDID Version: %u.%u\n",c->version,
- c->revision);
+ xf86DrvMsg(scrnIndex, X_INFO, "EDID Version: %u.%u\n", c->version,
+ c->revision);
}
-
+
static const char *digital_interfaces[] = {
"undefined",
"DVI",
@@ -64,212 +64,241 @@ static const char *digital_interfaces[] = {
"unknown"
};
-static void
+static void
print_input_features(int scrnIndex, struct disp_features *c,
- struct edid_version *v)
+ struct edid_version *v)
{
if (DIGITAL(c->input_type)) {
- xf86DrvMsg(scrnIndex, X_INFO, "Digital Display Input\n");
- if (v->revision == 2 || v->revision == 3) {
- if (DFP1(c->input_dfp))
- xf86DrvMsg(scrnIndex, X_INFO, "DFP 1.x compatible TMDS\n");
- } else if (v->revision >= 4) {
- int interface = c->input_interface;
- int bpc = c->input_bpc;
- if (interface > 6)
- interface = 6; /* unknown */
- if (bpc == 0 || bpc == 7)
- xf86DrvMsg(scrnIndex, X_INFO, "Undefined color depth\n");
- else
- xf86DrvMsg(scrnIndex, X_INFO, "%d bits per channel\n",
- bpc * 2 + 4);
- xf86DrvMsg(scrnIndex, X_INFO, "Digital interface is %s\n",
- digital_interfaces[interface]);
- }
- } else {
- xf86DrvMsg(scrnIndex,X_INFO,"Analog Display Input, ");
- xf86ErrorF("Input Voltage Level: ");
- switch (c->input_voltage){
- case V070:
- xf86ErrorF("0.700/0.300 V\n");
- break;
- case V071:
- xf86ErrorF("0.714/0.286 V\n");
- break;
- case V100:
- xf86ErrorF("1.000/0.400 V\n");
- break;
- case V007:
+ xf86DrvMsg(scrnIndex, X_INFO, "Digital Display Input\n");
+ if (v->revision == 2 || v->revision == 3) {
+ if (DFP1(c->input_dfp))
+ xf86DrvMsg(scrnIndex, X_INFO, "DFP 1.x compatible TMDS\n");
+ }
+ else if (v->revision >= 4) {
+ int interface = c->input_interface;
+ int bpc = c->input_bpc;
+
+ if (interface > 6)
+ interface = 6; /* unknown */
+ if (bpc == 0 || bpc == 7)
+ xf86DrvMsg(scrnIndex, X_INFO, "Undefined color depth\n");
+ else
+ xf86DrvMsg(scrnIndex, X_INFO, "%d bits per channel\n",
+ bpc * 2 + 4);
+ xf86DrvMsg(scrnIndex, X_INFO, "Digital interface is %s\n",
+ digital_interfaces[interface]);
+ }
+ }
+ else {
+ xf86DrvMsg(scrnIndex, X_INFO, "Analog Display Input, ");
+ xf86ErrorF("Input Voltage Level: ");
+ switch (c->input_voltage) {
+ case V070:
+ xf86ErrorF("0.700/0.300 V\n");
+ break;
+ case V071:
+ xf86ErrorF("0.714/0.286 V\n");
+ break;
+ case V100:
+ xf86ErrorF("1.000/0.400 V\n");
+ break;
+ case V007:
xf86ErrorF("0.700/0.700 V\n");
- break;
- default:
- xf86ErrorF("undefined\n");
- }
- if (SIG_SETUP(c->input_setup))
- xf86DrvMsg(scrnIndex,X_INFO,"Signal levels configurable\n");
- xf86DrvMsg(scrnIndex,X_INFO,"Sync:");
- if (SEP_SYNC(c->input_sync))
- xf86ErrorF(" Separate");
- if (COMP_SYNC(c->input_sync))
- xf86ErrorF(" Composite");
- if (SYNC_O_GREEN(c->input_sync))
- xf86ErrorF(" SyncOnGreen");
- if (SYNC_SERR(c->input_sync))
- xf86ErrorF("Serration on. "
- "V.Sync Pulse req. if CompSync or SyncOnGreen\n");
- else xf86ErrorF("\n");
+ break;
+ default:
+ xf86ErrorF("undefined\n");
+ }
+ if (SIG_SETUP(c->input_setup))
+ xf86DrvMsg(scrnIndex, X_INFO, "Signal levels configurable\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Sync:");
+ if (SEP_SYNC(c->input_sync))
+ xf86ErrorF(" Separate");
+ if (COMP_SYNC(c->input_sync))
+ xf86ErrorF(" Composite");
+ if (SYNC_O_GREEN(c->input_sync))
+ xf86ErrorF(" SyncOnGreen");
+ if (SYNC_SERR(c->input_sync))
+ xf86ErrorF("Serration on. "
+ "V.Sync Pulse req. if CompSync or SyncOnGreen\n");
+ else
+ xf86ErrorF("\n");
}
}
-
-static void
+
+static void
print_dpms_features(int scrnIndex, struct disp_features *c,
- struct edid_version *v)
+ struct edid_version *v)
{
- if (c->dpms) {
- xf86DrvMsg(scrnIndex,X_INFO,"DPMS capabilities:");
- if (DPMS_STANDBY(c->dpms)) xf86ErrorF(" StandBy");
- if (DPMS_SUSPEND(c->dpms)) xf86ErrorF(" Suspend");
- if (DPMS_OFF(c->dpms)) xf86ErrorF(" Off");
- } else
- xf86DrvMsg(scrnIndex,X_INFO,"No DPMS capabilities specified");
- if (!c->input_type) { /* analog */
- switch (c->display_type){
- case DISP_MONO:
- xf86ErrorF("; Monochorome/GrayScale Display\n");
- break;
- case DISP_RGB:
- xf86ErrorF("; RGB/Color Display\n");
- break;
- case DISP_MULTCOLOR:
- xf86ErrorF("; Non RGB Multicolor Display\n");
- break;
- default:
- xf86ErrorF("\n");
- break;
- }
- } else {
- int enc = c->display_type;
- xf86ErrorF("\n");
- xf86DrvMsg(scrnIndex, X_INFO, "Supported color encodings: "
- "RGB 4:4:4 %s%s\n",
- enc & DISP_YCRCB444 ? "YCrCb 4:4:4 " : "",
- enc & DISP_YCRCB422 ? "YCrCb 4:2:2" : "");
+ if (c->dpms) {
+ xf86DrvMsg(scrnIndex, X_INFO, "DPMS capabilities:");
+ if (DPMS_STANDBY(c->dpms))
+ xf86ErrorF(" StandBy");
+ if (DPMS_SUSPEND(c->dpms))
+ xf86ErrorF(" Suspend");
+ if (DPMS_OFF(c->dpms))
+ xf86ErrorF(" Off");
+ }
+ else
+ xf86DrvMsg(scrnIndex, X_INFO, "No DPMS capabilities specified");
+ if (!c->input_type) { /* analog */
+ switch (c->display_type) {
+ case DISP_MONO:
+ xf86ErrorF("; Monochorome/GrayScale Display\n");
+ break;
+ case DISP_RGB:
+ xf86ErrorF("; RGB/Color Display\n");
+ break;
+ case DISP_MULTCOLOR:
+ xf86ErrorF("; Non RGB Multicolor Display\n");
+ break;
+ default:
+ xf86ErrorF("\n");
+ break;
+ }
+ }
+ else {
+ int enc = c->display_type;
+
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported color encodings: "
+ "RGB 4:4:4 %s%s\n",
+ enc & DISP_YCRCB444 ? "YCrCb 4:4:4 " : "",
+ enc & DISP_YCRCB422 ? "YCrCb 4:2:2" : "");
}
if (STD_COLOR_SPACE(c->msc))
- xf86DrvMsg(scrnIndex,X_INFO,
- "Default color space is primary color space\n");
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Default color space is primary color space\n");
if (PREFERRED_TIMING_MODE(c->msc) || v->revision >= 4) {
- xf86DrvMsg(scrnIndex, X_INFO,
- "First detailed timing is preferred mode\n");
- if (v->revision >= 4)
- xf86DrvMsg(scrnIndex, X_INFO,
- "Preferred mode is native pixel format and refresh rate\n");
- } else if (v->revision == 3) {
- xf86DrvMsg(scrnIndex,X_INFO,
- "First detailed timing not preferred "
- "mode in violation of standard!\n");
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "First detailed timing is preferred mode\n");
+ if (v->revision >= 4)
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Preferred mode is native pixel format and refresh rate\n");
+ }
+ else if (v->revision == 3) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "First detailed timing not preferred "
+ "mode in violation of standard!\n");
}
if (v->revision >= 4) {
- if (GFT_SUPPORTED(c->msc)) {
- xf86DrvMsg(scrnIndex, X_INFO, "Display is continuous-frequency\n");
- }
- } else {
- if (GFT_SUPPORTED(c->msc))
- xf86DrvMsg(scrnIndex, X_INFO, "GTF timings supported\n");
+ if (GFT_SUPPORTED(c->msc)) {
+ xf86DrvMsg(scrnIndex, X_INFO, "Display is continuous-frequency\n");
+ }
+ }
+ else {
+ if (GFT_SUPPORTED(c->msc))
+ xf86DrvMsg(scrnIndex, X_INFO, "GTF timings supported\n");
}
}
-
-static void
+
+static void
print_whitepoint(int scrnIndex, struct disp_features *disp)
{
- xf86DrvMsg(scrnIndex,X_INFO,"redX: %.3f redY: %.3f ",
- disp->redx,disp->redy);
- xf86ErrorF("greenX: %.3f greenY: %.3f\n",
- disp->greenx,disp->greeny);
- xf86DrvMsg(scrnIndex,X_INFO,"blueX: %.3f blueY: %.3f ",
- disp->bluex,disp->bluey);
- xf86ErrorF("whiteX: %.3f whiteY: %.3f\n",
- disp->whitex,disp->whitey);
+ xf86DrvMsg(scrnIndex, X_INFO, "redX: %.3f redY: %.3f ",
+ disp->redx, disp->redy);
+ xf86ErrorF("greenX: %.3f greenY: %.3f\n", disp->greenx, disp->greeny);
+ xf86DrvMsg(scrnIndex, X_INFO, "blueX: %.3f blueY: %.3f ",
+ disp->bluex, disp->bluey);
+ xf86ErrorF("whiteX: %.3f whiteY: %.3f\n", disp->whitex, disp->whitey);
}
static void
-print_display(int scrnIndex, struct disp_features *disp,
- struct edid_version *v)
+print_display(int scrnIndex, struct disp_features *disp, struct edid_version *v)
{
print_input_features(scrnIndex, disp, v);
if (disp->hsize && disp->vsize) {
- xf86DrvMsg(scrnIndex, X_INFO, "Max Image Size [cm]: ");
- xf86ErrorF("horiz.: %i ", disp->hsize);
- xf86ErrorF("vert.: %i\n", disp->vsize);
- } else if (v->revision >= 4 && (disp->hsize || disp->vsize)) {
- if (disp->hsize)
- xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (landscape)\n",
- (disp->hsize + 99) / 100.0);
- if (disp->vsize)
- xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (portrait)\n",
- 100.0 / (float)(disp->vsize + 99));
-
- } else {
- xf86DrvMsg(scrnIndex, X_INFO, "Indeterminate output size\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Max Image Size [cm]: ");
+ xf86ErrorF("horiz.: %i ", disp->hsize);
+ xf86ErrorF("vert.: %i\n", disp->vsize);
+ }
+ else if (v->revision >= 4 && (disp->hsize || disp->vsize)) {
+ if (disp->hsize)
+ xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (landscape)\n",
+ (disp->hsize + 99) / 100.0);
+ if (disp->vsize)
+ xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (portrait)\n",
+ 100.0 / (float) (disp->vsize + 99));
+
+ }
+ else {
+ xf86DrvMsg(scrnIndex, X_INFO, "Indeterminate output size\n");
}
if (!disp->gamma && v->revision >= 1.4)
- xf86DrvMsg(scrnIndex, X_INFO, "Gamma defined in extension block\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Gamma defined in extension block\n");
else
- xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma);
+ xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma);
print_dpms_features(scrnIndex, disp, v);
print_whitepoint(scrnIndex, disp);
}
-static void
+static void
print_established_timings(int scrnIndex, struct established_timings *t)
{
unsigned char c;
if (t->t1 || t->t2 || t->t_manu)
- xf86DrvMsg(scrnIndex,X_INFO,"Supported established timings:\n");
- c=t->t1;
- if (c&0x80) xf86DrvMsg(scrnIndex,X_INFO,"720x400@70Hz\n");
- if (c&0x40) xf86DrvMsg(scrnIndex,X_INFO,"720x400@88Hz\n");
- if (c&0x20) xf86DrvMsg(scrnIndex,X_INFO,"640x480@60Hz\n");
- if (c&0x10) xf86DrvMsg(scrnIndex,X_INFO,"640x480@67Hz\n");
- if (c&0x08) xf86DrvMsg(scrnIndex,X_INFO,"640x480@72Hz\n");
- if (c&0x04) xf86DrvMsg(scrnIndex,X_INFO,"640x480@75Hz\n");
- if (c&0x02) xf86DrvMsg(scrnIndex,X_INFO,"800x600@56Hz\n");
- if (c&0x01) xf86DrvMsg(scrnIndex,X_INFO,"800x600@60Hz\n");
- c=t->t2;
- if (c&0x80) xf86DrvMsg(scrnIndex,X_INFO,"800x600@72Hz\n");
- if (c&0x40) xf86DrvMsg(scrnIndex,X_INFO,"800x600@75Hz\n");
- if (c&0x20) xf86DrvMsg(scrnIndex,X_INFO,"832x624@75Hz\n");
- if (c&0x10) xf86DrvMsg(scrnIndex,X_INFO,"1024x768@87Hz (interlaced)\n");
- if (c&0x08) xf86DrvMsg(scrnIndex,X_INFO,"1024x768@60Hz\n");
- if (c&0x04) xf86DrvMsg(scrnIndex,X_INFO,"1024x768@70Hz\n");
- if (c&0x02) xf86DrvMsg(scrnIndex,X_INFO,"1024x768@75Hz\n");
- if (c&0x01) xf86DrvMsg(scrnIndex,X_INFO,"1280x1024@75Hz\n");
- c=t->t_manu;
- if (c&0x80) xf86DrvMsg(scrnIndex,X_INFO,"1152x864@75Hz\n");
- xf86DrvMsg(scrnIndex,X_INFO,"Manufacturer's mask: %X\n",c&0x7F);
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported established timings:\n");
+ c = t->t1;
+ if (c & 0x80)
+ xf86DrvMsg(scrnIndex, X_INFO, "720x400@70Hz\n");
+ if (c & 0x40)
+ xf86DrvMsg(scrnIndex, X_INFO, "720x400@88Hz\n");
+ if (c & 0x20)
+ xf86DrvMsg(scrnIndex, X_INFO, "640x480@60Hz\n");
+ if (c & 0x10)
+ xf86DrvMsg(scrnIndex, X_INFO, "640x480@67Hz\n");
+ if (c & 0x08)
+ xf86DrvMsg(scrnIndex, X_INFO, "640x480@72Hz\n");
+ if (c & 0x04)
+ xf86DrvMsg(scrnIndex, X_INFO, "640x480@75Hz\n");
+ if (c & 0x02)
+ xf86DrvMsg(scrnIndex, X_INFO, "800x600@56Hz\n");
+ if (c & 0x01)
+ xf86DrvMsg(scrnIndex, X_INFO, "800x600@60Hz\n");
+ c = t->t2;
+ if (c & 0x80)
+ xf86DrvMsg(scrnIndex, X_INFO, "800x600@72Hz\n");
+ if (c & 0x40)
+ xf86DrvMsg(scrnIndex, X_INFO, "800x600@75Hz\n");
+ if (c & 0x20)
+ xf86DrvMsg(scrnIndex, X_INFO, "832x624@75Hz\n");
+ if (c & 0x10)
+ xf86DrvMsg(scrnIndex, X_INFO, "1024x768@87Hz (interlaced)\n");
+ if (c & 0x08)
+ xf86DrvMsg(scrnIndex, X_INFO, "1024x768@60Hz\n");
+ if (c & 0x04)
+ xf86DrvMsg(scrnIndex, X_INFO, "1024x768@70Hz\n");
+ if (c & 0x02)
+ xf86DrvMsg(scrnIndex, X_INFO, "1024x768@75Hz\n");
+ if (c & 0x01)
+ xf86DrvMsg(scrnIndex, X_INFO, "1280x1024@75Hz\n");
+ c = t->t_manu;
+ if (c & 0x80)
+ xf86DrvMsg(scrnIndex, X_INFO, "1152x864@75Hz\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Manufacturer's mask: %X\n", c & 0x7F);
}
-
+
static void
print_std_timings(int scrnIndex, struct std_timings *t)
{
int i;
char done = 0;
- for (i=0;i<STD_TIMINGS;i++) {
- if (t[i].hsize > 256) { /* sanity check */
- if (!done) {
- xf86DrvMsg(scrnIndex,X_INFO,"Supported standard timings:\n");
- done = 1;
- }
- xf86DrvMsg(scrnIndex,X_INFO,
- "#%i: hsize: %i vsize %i refresh: %i vid: %i\n",
- i, t[i].hsize, t[i].vsize, t[i].refresh, t[i].id);
- }
+
+ for (i = 0; i < STD_TIMINGS; i++) {
+ if (t[i].hsize > 256) { /* sanity check */
+ if (!done) {
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported standard timings:\n");
+ done = 1;
+ }
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "#%i: hsize: %i vsize %i refresh: %i vid: %i\n",
+ i, t[i].hsize, t[i].vsize, t[i].refresh, t[i].id);
+ }
}
}
@@ -279,15 +308,17 @@ print_cvt_timings(int si, struct cvt_timings *t)
int i;
for (i = 0; i < 4; i++) {
- if (t[i].height) {
- xf86DrvMsg(si, X_INFO, "%dx%d @ %s%s%s%s%s Hz\n",
- t[i].width, t[i].height,
- t[i].rates & 0x10 ? "50," : "",
- t[i].rates & 0x08 ? "60," : "",
- t[i].rates & 0x04 ? "75," : "",
- t[i].rates & 0x02 ? "85," : "",
- t[i].rates & 0x01 ? "60RB" : "");
- } else break;
+ if (t[i].height) {
+ xf86DrvMsg(si, X_INFO, "%dx%d @ %s%s%s%s%s Hz\n",
+ t[i].width, t[i].height,
+ t[i].rates & 0x10 ? "50," : "",
+ t[i].rates & 0x08 ? "60," : "",
+ t[i].rates & 0x04 ? "75," : "",
+ t[i].rates & 0x02 ? "85," : "",
+ t[i].rates & 0x01 ? "60RB" : "");
+ }
+ else
+ break;
}
}
@@ -296,166 +327,174 @@ print_detailed_timings(int scrnIndex, struct detailed_timings *t)
{
if (t->clock > 15000000) { /* sanity check */
- xf86DrvMsg(scrnIndex,X_INFO,"Supported detailed timing:\n");
- xf86DrvMsg(scrnIndex,X_INFO,"clock: %.1f MHz ",t->clock/1000000.0);
- xf86ErrorF("Image Size: %i x %i mm\n",t->h_size,t->v_size);
- xf86DrvMsg(scrnIndex,X_INFO,
- "h_active: %i h_sync: %i h_sync_end %i h_blank_end %i ",
- t->h_active, t->h_sync_off + t->h_active,
- t->h_sync_off + t->h_sync_width + t->h_active,
- t->h_active + t->h_blanking);
- xf86ErrorF("h_border: %i\n",t->h_border);
- xf86DrvMsg(scrnIndex,X_INFO,
- "v_active: %i v_sync: %i v_sync_end %i v_blanking: %i ",
- t->v_active, t->v_sync_off + t->v_active,
- t->v_sync_off + t->v_sync_width + t->v_active,
- t->v_active + t->v_blanking);
- xf86ErrorF("v_border: %i\n",t->v_border);
- if (IS_STEREO(t->stereo)) {
- xf86DrvMsg(scrnIndex,X_INFO,"Stereo: ");
- if (IS_RIGHT_STEREO(t->stereo)) {
- if (!t->stereo_1)
- xf86ErrorF("right channel on sync\n");
- else
- xf86ErrorF("left channel on sync\n");
- } else if (IS_LEFT_STEREO(t->stereo)) {
- if (!t->stereo_1)
- xf86ErrorF("right channel on even line\n");
- else
- xf86ErrorF("left channel on evel line\n");
- }
- if (IS_4WAY_STEREO(t->stereo)) {
- if (!t->stereo_1)
- xf86ErrorF("4-way interleaved\n");
- else
- xf86ErrorF("side-by-side interleaved");
- }
- }
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported detailed timing:\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "clock: %.1f MHz ",
+ t->clock / 1000000.0);
+ xf86ErrorF("Image Size: %i x %i mm\n", t->h_size, t->v_size);
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "h_active: %i h_sync: %i h_sync_end %i h_blank_end %i ",
+ t->h_active, t->h_sync_off + t->h_active,
+ t->h_sync_off + t->h_sync_width + t->h_active,
+ t->h_active + t->h_blanking);
+ xf86ErrorF("h_border: %i\n", t->h_border);
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "v_active: %i v_sync: %i v_sync_end %i v_blanking: %i ",
+ t->v_active, t->v_sync_off + t->v_active,
+ t->v_sync_off + t->v_sync_width + t->v_active,
+ t->v_active + t->v_blanking);
+ xf86ErrorF("v_border: %i\n", t->v_border);
+ if (IS_STEREO(t->stereo)) {
+ xf86DrvMsg(scrnIndex, X_INFO, "Stereo: ");
+ if (IS_RIGHT_STEREO(t->stereo)) {
+ if (!t->stereo_1)
+ xf86ErrorF("right channel on sync\n");
+ else
+ xf86ErrorF("left channel on sync\n");
+ }
+ else if (IS_LEFT_STEREO(t->stereo)) {
+ if (!t->stereo_1)
+ xf86ErrorF("right channel on even line\n");
+ else
+ xf86ErrorF("left channel on evel line\n");
+ }
+ if (IS_4WAY_STEREO(t->stereo)) {
+ if (!t->stereo_1)
+ xf86ErrorF("4-way interleaved\n");
+ else
+ xf86ErrorF("side-by-side interleaved");
+ }
+ }
}
}
/* This function handle all detailed patchs,
* including EDID and EDID-extension
*/
-struct det_print_parameter{
- xf86MonPtr m;
- int index;
- ddc_quirk_t quirks;
+struct det_print_parameter {
+ xf86MonPtr m;
+ int index;
+ ddc_quirk_t quirks;
};
static void
-handle_detailed_print(struct detailed_monitor_section *det_mon,
- void *data)
+handle_detailed_print(struct detailed_monitor_section *det_mon, void *data)
{
int j, scrnIndex;
struct det_print_parameter *p;
- p = (struct det_print_parameter *)data;
+ p = (struct det_print_parameter *) data;
scrnIndex = p->m->scrnIndex;
- xf86DetTimingApplyQuirks(det_mon,p->quirks,
- p->m->features.hsize,
- p->m->features.vsize);
+ xf86DetTimingApplyQuirks(det_mon, p->quirks,
+ p->m->features.hsize, p->m->features.vsize);
switch (det_mon->type) {
case DT:
- print_detailed_timings(scrnIndex,&det_mon->section.d_timings);
+ print_detailed_timings(scrnIndex, &det_mon->section.d_timings);
break;
case DS_SERIAL:
- xf86DrvMsg(scrnIndex,X_INFO,"Serial No: %s\n",det_mon->section.serial);
+ xf86DrvMsg(scrnIndex, X_INFO, "Serial No: %s\n",
+ det_mon->section.serial);
break;
case DS_ASCII_STR:
- xf86DrvMsg(scrnIndex,X_INFO," %s\n",det_mon->section.ascii_data);
+ xf86DrvMsg(scrnIndex, X_INFO, " %s\n", det_mon->section.ascii_data);
break;
case DS_NAME:
- xf86DrvMsg(scrnIndex,X_INFO,"Monitor name: %s\n",det_mon->section.name);
+ xf86DrvMsg(scrnIndex, X_INFO, "Monitor name: %s\n",
+ det_mon->section.name);
break;
case DS_RANGES:
{
struct monitor_ranges *r = &det_mon->section.ranges;
- xf86DrvMsg(scrnIndex,X_INFO,
+
+ xf86DrvMsg(scrnIndex, X_INFO,
"Ranges: V min: %i V max: %i Hz, H min: %i H max: %i kHz,",
r->min_v, r->max_v, r->min_h, r->max_h);
if (r->max_clock_khz != 0) {
xf86ErrorF(" PixClock max %i kHz\n", r->max_clock_khz);
- if (r->maxwidth)
- xf86DrvMsg(scrnIndex, X_INFO, "Maximum pixel width: %d\n",
- r->maxwidth);
- xf86DrvMsg(scrnIndex, X_INFO, "Supported aspect ratios:");
- if (r->supported_aspect & SUPPORTED_ASPECT_4_3)
- xf86ErrorF(" 4:3%s",
- r->preferred_aspect == PREFERRED_ASPECT_4_3?"*":"");
- if (r->supported_aspect & SUPPORTED_ASPECT_16_9)
- xf86ErrorF(" 16:9%s",
- r->preferred_aspect == PREFERRED_ASPECT_16_9?"*":"");
- if (r->supported_aspect & SUPPORTED_ASPECT_16_10)
- xf86ErrorF(" 16:10%s",
- r->preferred_aspect == PREFERRED_ASPECT_16_10?"*":"");
- if (r->supported_aspect & SUPPORTED_ASPECT_5_4)
- xf86ErrorF(" 5:4%s",
- r->preferred_aspect == PREFERRED_ASPECT_5_4?"*":"");
- if (r->supported_aspect & SUPPORTED_ASPECT_15_9)
- xf86ErrorF(" 15:9%s",
- r->preferred_aspect == PREFERRED_ASPECT_15_9?"*":"");
- xf86ErrorF("\n");
- xf86DrvMsg(scrnIndex, X_INFO, "Supported blankings:");
- if (r->supported_blanking & CVT_STANDARD)
- xf86ErrorF(" standard");
- if (r->supported_blanking & CVT_REDUCED)
- xf86ErrorF(" reduced");
- xf86ErrorF("\n");
- xf86DrvMsg(scrnIndex, X_INFO, "Supported scalings:");
- if (r->supported_scaling & SCALING_HSHRINK)
- xf86ErrorF(" hshrink");
- if (r->supported_scaling & SCALING_HSTRETCH)
- xf86ErrorF(" hstretch");
- if (r->supported_scaling & SCALING_VSHRINK)
- xf86ErrorF(" vshrink");
- if (r->supported_scaling & SCALING_VSTRETCH)
- xf86ErrorF(" vstretch");
- xf86ErrorF("\n");
- if (r->preferred_refresh)
- xf86DrvMsg(scrnIndex, X_INFO, "Preferred refresh rate: %d\n",
- r->preferred_refresh);
- else
- xf86DrvMsg(scrnIndex, X_INFO, "Buggy monitor, no preferred "
- "refresh rate given\n");
- } else if (r->max_clock != 0) {
- xf86ErrorF(" PixClock max %i MHz\n", r->max_clock);
- } else {
- xf86ErrorF("\n");
+ if (r->maxwidth)
+ xf86DrvMsg(scrnIndex, X_INFO, "Maximum pixel width: %d\n",
+ r->maxwidth);
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported aspect ratios:");
+ if (r->supported_aspect & SUPPORTED_ASPECT_4_3)
+ xf86ErrorF(" 4:3%s",
+ r->preferred_aspect ==
+ PREFERRED_ASPECT_4_3 ? "*" : "");
+ if (r->supported_aspect & SUPPORTED_ASPECT_16_9)
+ xf86ErrorF(" 16:9%s",
+ r->preferred_aspect ==
+ PREFERRED_ASPECT_16_9 ? "*" : "");
+ if (r->supported_aspect & SUPPORTED_ASPECT_16_10)
+ xf86ErrorF(" 16:10%s",
+ r->preferred_aspect ==
+ PREFERRED_ASPECT_16_10 ? "*" : "");
+ if (r->supported_aspect & SUPPORTED_ASPECT_5_4)
+ xf86ErrorF(" 5:4%s",
+ r->preferred_aspect ==
+ PREFERRED_ASPECT_5_4 ? "*" : "");
+ if (r->supported_aspect & SUPPORTED_ASPECT_15_9)
+ xf86ErrorF(" 15:9%s",
+ r->preferred_aspect ==
+ PREFERRED_ASPECT_15_9 ? "*" : "");
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported blankings:");
+ if (r->supported_blanking & CVT_STANDARD)
+ xf86ErrorF(" standard");
+ if (r->supported_blanking & CVT_REDUCED)
+ xf86ErrorF(" reduced");
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported scalings:");
+ if (r->supported_scaling & SCALING_HSHRINK)
+ xf86ErrorF(" hshrink");
+ if (r->supported_scaling & SCALING_HSTRETCH)
+ xf86ErrorF(" hstretch");
+ if (r->supported_scaling & SCALING_VSHRINK)
+ xf86ErrorF(" vshrink");
+ if (r->supported_scaling & SCALING_VSTRETCH)
+ xf86ErrorF(" vstretch");
+ xf86ErrorF("\n");
+ if (r->preferred_refresh)
+ xf86DrvMsg(scrnIndex, X_INFO, "Preferred refresh rate: %d\n",
+ r->preferred_refresh);
+ else
+ xf86DrvMsg(scrnIndex, X_INFO, "Buggy monitor, no preferred "
+ "refresh rate given\n");
+ }
+ else if (r->max_clock != 0) {
+ xf86ErrorF(" PixClock max %i MHz\n", r->max_clock);
+ }
+ else {
+ xf86ErrorF("\n");
}
if (r->gtf_2nd_f > 0)
- xf86DrvMsg(scrnIndex,X_INFO," 2nd GTF parameters: f: %i kHz "
+ xf86DrvMsg(scrnIndex, X_INFO, " 2nd GTF parameters: f: %i kHz "
"c: %i m: %i k %i j %i\n", r->gtf_2nd_f,
- r->gtf_2nd_c, r->gtf_2nd_m, r->gtf_2nd_k,
- r->gtf_2nd_j);
+ r->gtf_2nd_c, r->gtf_2nd_m, r->gtf_2nd_k, r->gtf_2nd_j);
break;
}
case DS_STD_TIMINGS:
- for (j = 0; j<5; j++)
- xf86DrvMsg(scrnIndex,X_INFO,
- "#%i: hsize: %i vsize %i refresh: %i "
- "vid: %i\n",p->index ,det_mon->section.std_t[j].hsize,
- det_mon->section.std_t[j].vsize,
- det_mon->section.std_t[j].refresh,
- det_mon->section.std_t[j].id);
+ for (j = 0; j < 5; j++)
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "#%i: hsize: %i vsize %i refresh: %i "
+ "vid: %i\n", p->index, det_mon->section.std_t[j].hsize,
+ det_mon->section.std_t[j].vsize,
+ det_mon->section.std_t[j].refresh,
+ det_mon->section.std_t[j].id);
break;
case DS_WHITE_P:
- for (j = 0; j<2; j++)
- if (det_mon->section.wp[j].index != 0)
- xf86DrvMsg(scrnIndex,X_INFO,
- "White point %i: whiteX: %f, whiteY: %f; gamma: %f\n",
- det_mon->section.wp[j].index,det_mon->section.wp[j].white_x,
- det_mon->section.wp[j].white_y,
- det_mon->section.wp[j].white_gamma);
+ for (j = 0; j < 2; j++)
+ if (det_mon->section.wp[j].index != 0)
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "White point %i: whiteX: %f, whiteY: %f; gamma: %f\n",
+ det_mon->section.wp[j].index,
+ det_mon->section.wp[j].white_x,
+ det_mon->section.wp[j].white_y,
+ det_mon->section.wp[j].white_gamma);
break;
case DS_CMD:
- xf86DrvMsg(scrnIndex, X_INFO,
- "Color management data: (not decoded)\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Color management data: (not decoded)\n");
break;
case DS_CVT:
- xf86DrvMsg(scrnIndex, X_INFO,
- "CVT 3-byte-code modes:\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "CVT 3-byte-code modes:\n");
print_cvt_timings(scrnIndex, det_mon->section.cvt);
break;
case DS_EST_III:
@@ -479,8 +518,8 @@ static void
print_number_sections(int scrnIndex, int num)
{
if (num)
- xf86DrvMsg(scrnIndex,X_INFO,"Number of EDID sections to follow: %i\n",
- num);
+ xf86DrvMsg(scrnIndex, X_INFO, "Number of EDID sections to follow: %i\n",
+ num);
}
xf86MonPtr
@@ -490,7 +529,8 @@ xf86PrintEDID(xf86MonPtr m)
char buf[EDID_WIDTH * 2 + 1];
struct det_print_parameter p;
- if (!m) return NULL;
+ if (!m)
+ return NULL;
print_vendor(m->scrnIndex, &m->vendor);
print_version(m->scrnIndex, &m->ver);
@@ -500,9 +540,7 @@ xf86PrintEDID(xf86MonPtr m)
p.m = m;
p.index = 0;
p.quirks = xf86DDCDetectQuirks(m->scrnIndex, m, FALSE);
- xf86ForEachDetailedBlock(m,
- handle_detailed_print ,
- &p);
+ xf86ForEachDetailedBlock(m, handle_detailed_print, &p);
print_number_sections(m->scrnIndex, m->no_sections);
/* extension block section stuff */
@@ -511,13 +549,13 @@ xf86PrintEDID(xf86MonPtr m)
n = 128;
if (m->flags & EDID_COMPLETE_RAWDATA)
- n += m->no_sections * 128;
+ n += m->no_sections * 128;
for (i = 0; i < n; i += j) {
- for (j = 0; j < EDID_WIDTH; ++j) {
- sprintf(&buf[j * 2], "%02x", m->rawData[i + j]);
- }
- xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf);
+ for (j = 0; j < EDID_WIDTH; ++j) {
+ sprintf(&buf[j * 2], "%02x", m->rawData[i + j]);
+ }
+ xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf);
}
return m;
diff --git a/xorg-server/hw/xfree86/ddc/xf86DDC.h b/xorg-server/hw/xfree86/ddc/xf86DDC.h
index 16a8641c6..2071d530d 100644
--- a/xorg-server/hw/xfree86/ddc/xf86DDC.h
+++ b/xorg-server/hw/xfree86/ddc/xf86DDC.h
@@ -10,7 +10,7 @@
*/
#ifndef XF86_DDC_H
-# define XF86_DDC_H
+#define XF86_DDC_H
#include "edid.h"
#include "xf86i2c.h"
@@ -18,55 +18,42 @@
/* speed up / slow down */
typedef enum {
- DDC_SLOW,
- DDC_FAST
+ DDC_SLOW,
+ DDC_FAST
} xf86ddcSpeed;
-typedef void (* DDC1SetSpeedProc)(ScrnInfoPtr, xf86ddcSpeed);
+typedef void (*DDC1SetSpeedProc) (ScrnInfoPtr, xf86ddcSpeed);
-extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(
- int scrnIndex,
- DDC1SetSpeedProc DDC1SetSpeed,
- unsigned int (*DDC1Read)(ScrnInfoPtr)
-);
+extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(int scrnIndex,
+ DDC1SetSpeedProc DDC1SetSpeed,
+ unsigned
+ int (*DDC1Read) (ScrnInfoPtr)
+ );
-extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(
- int scrnIndex,
- I2CBusPtr pBus
-);
+extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus);
extern _X_EXPORT xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool);
-extern _X_EXPORT xf86MonPtr xf86PrintEDID(
- xf86MonPtr monPtr
-);
+extern _X_EXPORT xf86MonPtr xf86PrintEDID(xf86MonPtr monPtr);
-extern _X_EXPORT xf86MonPtr xf86InterpretEDID(
- int screenIndex, Uchar *block
-);
+extern _X_EXPORT xf86MonPtr xf86InterpretEDID(int screenIndex, Uchar * block);
-extern _X_EXPORT xf86MonPtr xf86InterpretEEDID(
- int screenIndex, Uchar *block
-);
+extern _X_EXPORT xf86MonPtr xf86InterpretEEDID(int screenIndex, Uchar * block);
extern _X_EXPORT void
-xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC);
+ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC);
-extern _X_EXPORT Bool xf86SetDDCproperties(
- ScrnInfoPtr pScreen,
- xf86MonPtr DDC
-);
+extern _X_EXPORT Bool xf86SetDDCproperties(ScrnInfoPtr pScreen, xf86MonPtr DDC);
extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
extern _X_EXPORT Bool
-xf86MonitorIsHDMI(xf86MonPtr mon);
+ xf86MonitorIsHDMI(xf86MonPtr mon);
-extern _X_EXPORT xf86MonPtr
-xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus);
+extern _X_EXPORT xf86MonPtr xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus);
extern _X_EXPORT void
-xf86DisplayIDMonitorSet(int scrnIndex, MonPtr mon, xf86MonPtr DDC);
+ xf86DisplayIDMonitorSet(int scrnIndex, MonPtr mon, xf86MonPtr DDC);
extern _X_EXPORT DisplayModePtr
FindDMTMode(int hsize, int vsize, int refresh, Bool rb);
@@ -100,22 +87,17 @@ typedef enum {
DDC_QUIRK_DVI_SINGLE_LINK = 1 << 8,
} ddc_quirk_t;
-typedef void (* handle_detailed_fn)(struct detailed_monitor_section *,void *);
+typedef void (*handle_detailed_fn) (struct detailed_monitor_section *, void *);
-void xf86ForEachDetailedBlock(xf86MonPtr mon,
- handle_detailed_fn,
- void *data);
+void xf86ForEachDetailedBlock(xf86MonPtr mon, handle_detailed_fn, void *data);
-ddc_quirk_t
-xf86DDCDetectQuirks(int scrnIndex, xf86MonPtr DDC, Bool verbose);
+ddc_quirk_t xf86DDCDetectQuirks(int scrnIndex, xf86MonPtr DDC, Bool verbose);
void xf86DetTimingApplyQuirks(struct detailed_monitor_section *det_mon,
ddc_quirk_t quirks, int hsize, int vsize);
-typedef void (* handle_video_fn)(struct cea_video_block *, void *);
+typedef void (*handle_video_fn) (struct cea_video_block *, void *);
-void xf86ForEachVideoBlock(xf86MonPtr,
- handle_video_fn,
- void *);
+void xf86ForEachVideoBlock(xf86MonPtr, handle_video_fn, void *);
#endif
diff --git a/xorg-server/hw/xfree86/dixmods/dbemodule.c b/xorg-server/hw/xfree86/dixmods/dbemodule.c
index 73639886f..5541eacab 100644
--- a/xorg-server/hw/xfree86/dixmods/dbemodule.c
+++ b/xorg-server/hw/xfree86/dixmods/dbemodule.c
@@ -17,18 +17,17 @@ static ExtensionModule dbeExt = {
NULL
};
-static XF86ModuleVersionInfo VersRec =
-{
- "dbe",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_EXTENSION,
- ABI_EXTENSION_VERSION,
- MOD_CLASS_EXTENSION,
- {0,0,0,0}
+static XF86ModuleVersionInfo VersRec = {
+ "dbe",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0, 0, 0, 0}
};
/*
@@ -42,5 +41,5 @@ dbeSetup(pointer module, pointer opts, int *errmaj, int *errmin)
LoadExtension(&dbeExt, FALSE);
/* Need a non-NULL return value to indicate success */
- return (pointer)1;
+ return (pointer) 1;
}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h b/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h
index a13a51794..b4e0ddfea 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h
+++ b/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h
@@ -23,58 +23,45 @@
#define DGA_NEED_ROOT 0x00000001
typedef struct {
- int num; /* A unique identifier for the mode (num > 0) */
- char *name; /* name of mode given in the XF86Config */
- int VSync_num;
- int VSync_den;
- int flags; /* DGA_CONCURRENT_ACCESS, etc... */
- int imageWidth; /* linear accessible portion (pixels) */
- int imageHeight;
- int pixmapWidth; /* Xlib accessible portion (pixels) */
- int pixmapHeight; /* both fields ignored if no concurrent access */
- int bytesPerScanline;
- int byteOrder; /* MSBFirst, LSBFirst */
- int depth;
- int bitsPerPixel;
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
- short visualClass;
- int viewportWidth;
- int viewportHeight;
- int xViewportStep; /* viewport position granularity */
- int yViewportStep;
- int maxViewportX; /* max viewport origin */
- int maxViewportY;
- int viewportFlags; /* types of page flipping possible */
- int offset;
- int reserved1;
- int reserved2;
+ int num; /* A unique identifier for the mode (num > 0) */
+ char *name; /* name of mode given in the XF86Config */
+ int VSync_num;
+ int VSync_den;
+ int flags; /* DGA_CONCURRENT_ACCESS, etc... */
+ int imageWidth; /* linear accessible portion (pixels) */
+ int imageHeight;
+ int pixmapWidth; /* Xlib accessible portion (pixels) */
+ int pixmapHeight; /* both fields ignored if no concurrent access */
+ int bytesPerScanline;
+ int byteOrder; /* MSBFirst, LSBFirst */
+ int depth;
+ int bitsPerPixel;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ short visualClass;
+ int viewportWidth;
+ int viewportHeight;
+ int xViewportStep; /* viewport position granularity */
+ int yViewportStep;
+ int maxViewportX; /* max viewport origin */
+ int maxViewportY;
+ int viewportFlags; /* types of page flipping possible */
+ int offset;
+ int reserved1;
+ int reserved2;
} XDGAModeRec, *XDGAModePtr;
/* DDX interface */
extern _X_EXPORT int
-DGASetMode(
- int Index,
- int num,
- XDGAModePtr mode,
- PixmapPtr *pPix
-);
+ DGASetMode(int Index, int num, XDGAModePtr mode, PixmapPtr *pPix);
extern _X_EXPORT void
-DGASetInputMode(
- int Index,
- Bool keyboard,
- Bool mouse
-);
+ DGASetInputMode(int Index, Bool keyboard, Bool mouse);
extern _X_EXPORT void
-DGASelectInput(
- int Index,
- ClientPtr client,
- long mask
-);
+ DGASelectInput(int Index, ClientPtr client, long mask);
extern _X_EXPORT Bool DGAAvailable(int Index);
extern _X_EXPORT Bool DGAActive(int Index);
@@ -84,35 +71,19 @@ extern _X_EXPORT int DGAGetViewportStatus(int Index);
extern _X_EXPORT int DGASync(int Index);
extern _X_EXPORT int
-DGAFillRect(
- int Index,
- int x, int y, int w, int h,
- unsigned long color
-);
+ DGAFillRect(int Index, int x, int y, int w, int h, unsigned long color);
extern _X_EXPORT int
-DGABlitRect(
- int Index,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty
-);
+ DGABlitRect(int Index, int srcx, int srcy, int w, int h, int dstx, int dsty);
extern _X_EXPORT int
-DGABlitTransRect(
- int Index,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty,
- unsigned long color
-);
+
+DGABlitTransRect(int Index,
+ int srcx, int srcy,
+ int w, int h, int dstx, int dsty, unsigned long color);
extern _X_EXPORT int
-DGASetViewport(
- int Index,
- int x, int y,
- int mode
-);
+ DGASetViewport(int Index, int x, int y, int mode);
extern _X_EXPORT int DGAGetModes(int Index);
extern _X_EXPORT int DGAGetOldDGAMode(int Index);
@@ -120,23 +91,24 @@ extern _X_EXPORT int DGAGetOldDGAMode(int Index);
extern _X_EXPORT int DGAGetModeInfo(int Index, XDGAModePtr mode, int num);
extern _X_EXPORT Bool DGAVTSwitch(void);
-extern _X_EXPORT Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index, int button,
- int is_down);
-extern _X_EXPORT Bool DGAStealMotionEvent(DeviceIntPtr dev, int Index, int dx, int dy);
-extern _X_EXPORT Bool DGAStealKeyEvent(DeviceIntPtr dev, int Index, int key_code, int is_down);
-
-extern _X_EXPORT Bool DGAOpenFramebuffer(int Index, char **name, unsigned char **mem,
- int *size, int *offset, int *flags);
+extern _X_EXPORT Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index,
+ int button, int is_down);
+extern _X_EXPORT Bool DGAStealMotionEvent(DeviceIntPtr dev, int Index, int dx,
+ int dy);
+extern _X_EXPORT Bool DGAStealKeyEvent(DeviceIntPtr dev, int Index,
+ int key_code, int is_down);
+
+extern _X_EXPORT Bool DGAOpenFramebuffer(int Index, char **name,
+ unsigned char **mem, int *size,
+ int *offset, int *flags);
extern _X_EXPORT void DGACloseFramebuffer(int Index);
extern _X_EXPORT Bool DGAChangePixmapMode(int Index, int *x, int *y, int mode);
-extern _X_EXPORT int DGACreateColormap(int Index, ClientPtr client, int id, int mode,
- int alloc);
+extern _X_EXPORT int DGACreateColormap(int Index, ClientPtr client, int id,
+ int mode, int alloc);
extern _X_EXPORT unsigned char DGAReqCode;
extern _X_EXPORT int DGAErrorBase;
extern _X_EXPORT int DGAEventBase;
extern _X_EXPORT int *XDGAEventBase;
-
-
-#endif /* __DGAPROC_H */
+#endif /* __DGAPROC_H */
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
index 632454f37..ca15ee0e7 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
+++ b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
@@ -1,184 +1,177 @@
-/*
- * Copyright (c) 1997 Matthieu Herrb
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Matthieu Herrb not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Matthieu Herrb makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * MATTHIEU HERRB DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL MATTHIEU HERRB BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-#include "xf86Opt.h"
-
-#include <X11/Xproto.h>
-
-#include "modinit.h"
-#include "globals.h"
-
-static MODULESETUPPROTO(extmodSetup);
-
-/*
- * Array describing extensions to be initialized
- */
-static ExtensionModule extensionModules[] = {
-#ifdef XSELINUX
- {
- SELinuxExtensionInit,
- SELINUX_EXTENSION_NAME,
- &noSELinuxExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef SCREENSAVER
- {
- ScreenSaverExtensionInit,
- ScreenSaverName,
- &noScreenSaverExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XF86VIDMODE
- {
- XFree86VidModeExtensionInit,
- XF86VIDMODENAME,
- &noXFree86VidModeExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XFreeXDGA
- {
- XFree86DGAExtensionInit,
- XF86DGANAME,
- &noXFree86DGAExtension,
- XFree86DGARegister,
- NULL
- },
-#endif
-#ifdef DPMSExtension
- {
- DPMSExtensionInit,
- DPMSExtensionName,
- &noDPMSExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XV
- {
- XvExtensionInit,
- XvName,
- &noXvExtension,
- XvRegister,
- NULL
- },
- {
- XvMCExtensionInit,
- XvMCName,
- &noXvExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef RES
- {
- ResExtensionInit,
- XRES_NAME,
- &noResExtension,
- NULL,
- NULL
- },
-#endif
- { /* DON'T delete this entry ! */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- }
-};
-
-static XF86ModuleVersionInfo VersRec =
-{
- "extmod",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_EXTENSION,
- ABI_EXTENSION_VERSION,
- MOD_CLASS_EXTENSION,
- {0,0,0,0}
-};
-
-/*
- * Data for the loader
- */
-_X_EXPORT XF86ModuleData extmodModuleData = { &VersRec, extmodSetup, NULL };
-
-static pointer
-extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- int i;
-
- /* XXX the option stuff here is largely a sample/test case */
-
- for (i = 0; extensionModules[i].name != NULL; i++) {
- if (opts) {
- char *s;
- if (asprintf(&s, "omit%s", extensionModules[i].name) != -1) {
- pointer o;
- o = xf86FindOption(opts, s);
- free(s);
- if (o) {
- xf86MarkOptionUsed(o);
- continue;
- }
- }
- }
-
-#ifdef XSELINUX
- if (! strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) {
- pointer o;
- selinuxEnforcingState = SELINUX_MODE_DEFAULT;
-
- if ((o = xf86FindOption(opts, "SELinux mode disabled"))) {
- xf86MarkOptionUsed(o);
- selinuxEnforcingState = SELINUX_MODE_DISABLED;
- }
- if ((o = xf86FindOption(opts, "SELinux mode permissive"))) {
- xf86MarkOptionUsed(o);
- selinuxEnforcingState = SELINUX_MODE_PERMISSIVE;
- }
- if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) {
- xf86MarkOptionUsed(o);
- selinuxEnforcingState = SELINUX_MODE_ENFORCING;
- }
- }
-#endif
-
- LoadExtension(&extensionModules[i], FALSE);
- }
- /* Need a non-NULL return */
- return (pointer)1;
-}
+/*
+ * Copyright (c) 1997 Matthieu Herrb
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Matthieu Herrb not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Matthieu Herrb makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * MATTHIEU HERRB DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL MATTHIEU HERRB BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+#include "xf86Opt.h"
+
+#include <X11/Xproto.h>
+
+#include "modinit.h"
+#include "globals.h"
+
+static MODULESETUPPROTO(extmodSetup);
+
+/*
+ * Array describing extensions to be initialized
+ */
+static ExtensionModule extensionModules[] = {
+#ifdef XSELINUX
+ {
+ SELinuxExtensionInit,
+ SELINUX_EXTENSION_NAME,
+ &noSELinuxExtension,
+ NULL,
+ NULL},
+#endif
+#ifdef SCREENSAVER
+ {
+ ScreenSaverExtensionInit,
+ ScreenSaverName,
+ &noScreenSaverExtension,
+ NULL,
+ NULL},
+#endif
+#ifdef XF86VIDMODE
+ {
+ XFree86VidModeExtensionInit,
+ XF86VIDMODENAME,
+ &noXFree86VidModeExtension,
+ NULL,
+ NULL},
+#endif
+#ifdef XFreeXDGA
+ {
+ XFree86DGAExtensionInit,
+ XF86DGANAME,
+ &noXFree86DGAExtension,
+ XFree86DGARegister,
+ NULL},
+#endif
+#ifdef DPMSExtension
+ {
+ DPMSExtensionInit,
+ DPMSExtensionName,
+ &noDPMSExtension,
+ NULL,
+ NULL},
+#endif
+#ifdef XV
+ {
+ XvExtensionInit,
+ XvName,
+ &noXvExtension,
+ XvRegister,
+ NULL},
+ {
+ XvMCExtensionInit,
+ XvMCName,
+ &noXvExtension,
+ NULL,
+ NULL},
+#endif
+#ifdef RES
+ {
+ ResExtensionInit,
+ XRES_NAME,
+ &noResExtension,
+ NULL,
+ NULL},
+#endif
+ { /* DON'T delete this entry ! */
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL}
+};
+
+static XF86ModuleVersionInfo VersRec = {
+ "extmod",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0, 0, 0, 0}
+};
+
+/*
+ * Data for the loader
+ */
+_X_EXPORT XF86ModuleData extmodModuleData = { &VersRec, extmodSetup, NULL };
+
+static pointer
+extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ int i;
+
+ /* XXX the option stuff here is largely a sample/test case */
+
+ for (i = 0; extensionModules[i].name != NULL; i++) {
+ if (opts) {
+ char *s;
+
+ if (asprintf(&s, "omit%s", extensionModules[i].name) != -1) {
+ pointer o;
+
+ o = xf86FindOption(opts, s);
+ free(s);
+ if (o) {
+ xf86MarkOptionUsed(o);
+ continue;
+ }
+ }
+ }
+
+#ifdef XSELINUX
+ if (!strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) {
+ pointer o;
+
+ selinuxEnforcingState = SELINUX_MODE_DEFAULT;
+
+ if ((o = xf86FindOption(opts, "SELinux mode disabled"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_DISABLED;
+ }
+ if ((o = xf86FindOption(opts, "SELinux mode permissive"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_PERMISSIVE;
+ }
+ if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_ENFORCING;
+ }
+ }
+#endif
+
+ LoadExtension(&extensionModules[i], FALSE);
+ }
+ /* Need a non-NULL return */
+ return (pointer) 1;
+}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/modinit.h b/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
index 9753e6f14..9753fe0fd 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
+++ b/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
@@ -1,86 +1,93 @@
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef INITARGS
-#define INITARGS void
-#endif
-
-#include <X11/extensions/shapeproto.h>
-
-#ifdef XTEST
-extern void XTestExtensionInit(INITARGS);
-#include <X11/extensions/xtestproto.h>
-#endif
-
-#if 1
-extern void XTestExtension1Init(INITARGS);
-#endif
-
-#if 1
-extern void XCMiscExtensionInit(INITARGS);
-#endif
-
-#ifdef SCREENSAVER
-extern void ScreenSaverExtensionInit (INITARGS);
-#include <X11/extensions/saver.h>
-#endif
-
-#ifdef XF86VIDMODE
-extern void XFree86VidModeExtensionInit(INITARGS);
-#include <X11/extensions/xf86vmproto.h>
-#endif
-
-#ifdef XFreeXDGA
-extern void XFree86DGAExtensionInit(INITARGS);
-extern void XFree86DGARegister(INITARGS);
-#include <X11/extensions/xf86dgaproto.h>
-#endif
-
-#ifdef DPMSExtension
-extern void DPMSExtensionInit(INITARGS);
-#include <X11/extensions/dpmsconst.h>
-#endif
-
-#ifdef XV
-extern void XvExtensionInit(INITARGS);
-extern void XvMCExtensionInit(INITARGS);
-extern void XvRegister(INITARGS);
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/XvMC.h>
-#endif
-
-#ifdef RES
-extern void ResExtensionInit(INITARGS);
-#include <X11/extensions/XResproto.h>
-#endif
-
-#ifdef SHM
-extern void ShmExtensionInit(INITARGS);
-#include <X11/extensions/shmproto.h>
-extern void ShmRegisterFuncs(
- ScreenPtr pScreen,
- ShmFuncsPtr funcs);
-#endif
-
-#ifdef XSELINUX
-extern void SELinuxExtensionInit(INITARGS);
-#include "xselinux.h"
-#endif
-
-#ifdef XEVIE
-extern void XevieExtensionInit(INITARGS);
-#endif
-
-#if 1
-extern void SecurityExtensionInit(INITARGS);
-#endif
-
-#if 1
-extern void PanoramiXExtensionInit(int argc, char *argv[]);
-#endif
-
-#if 1
-extern void XkbExtensionInit(INITARGS);
-#endif
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef INITARGS
+#define INITARGS void
+#endif
+
+#include <X11/extensions/shapeproto.h>
+
+#ifdef XTEST
+extern void XTestExtensionInit(INITARGS);
+
+#include <X11/extensions/xtestproto.h>
+#endif
+
+#if 1
+extern void XTestExtension1Init(INITARGS);
+#endif
+
+#if 1
+extern void XCMiscExtensionInit(INITARGS);
+#endif
+
+#ifdef SCREENSAVER
+extern void ScreenSaverExtensionInit(INITARGS);
+
+#include <X11/extensions/saver.h>
+#endif
+
+#ifdef XF86VIDMODE
+extern void XFree86VidModeExtensionInit(INITARGS);
+
+#include <X11/extensions/xf86vmproto.h>
+#endif
+
+#ifdef XFreeXDGA
+extern void XFree86DGAExtensionInit(INITARGS);
+extern void XFree86DGARegister(INITARGS);
+
+#include <X11/extensions/xf86dgaproto.h>
+#endif
+
+#ifdef DPMSExtension
+extern void DPMSExtensionInit(INITARGS);
+
+#include <X11/extensions/dpmsconst.h>
+#endif
+
+#ifdef XV
+extern void XvExtensionInit(INITARGS);
+extern void XvMCExtensionInit(INITARGS);
+extern void XvRegister(INITARGS);
+
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/XvMC.h>
+#endif
+
+#ifdef RES
+extern void ResExtensionInit(INITARGS);
+
+#include <X11/extensions/XResproto.h>
+#endif
+
+#ifdef SHM
+extern void ShmExtensionInit(INITARGS);
+
+#include <X11/extensions/shmproto.h>
+extern void ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
+#endif
+
+#ifdef XSELINUX
+extern void SELinuxExtensionInit(INITARGS);
+
+#include "xselinux.h"
+#endif
+
+#ifdef XEVIE
+extern void XevieExtensionInit(INITARGS);
+#endif
+
+#if 1
+extern void SecurityExtensionInit(INITARGS);
+#endif
+
+#if 1
+extern void PanoramiXExtensionInit(int argc, char *argv[]);
+#endif
+
+#if 1
+extern void XkbExtensionInit(INITARGS);
+#endif
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c
index 4bcf77efd..6b33941ef 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -6,7 +6,6 @@
* Written by Mark Vojkovich
*/
-
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@@ -33,26 +32,27 @@
#define DGA_PROTOCOL_OLD_SUPPORT 1
+static void XDGAResetProc(ExtensionEntry * extEntry);
-static void XDGAResetProc(ExtensionEntry *extEntry);
-
-static void DGAClientStateChange (CallbackListPtr*, pointer, pointer);
+static void DGAClientStateChange(CallbackListPtr *, pointer, pointer);
unsigned char DGAReqCode = 0;
int DGAErrorBase;
int DGAEventBase;
static DevPrivateKeyRec DGAScreenPrivateKeyRec;
+
#define DGAScreenPrivateKey (&DGAScreenPrivateKeyRec)
#define DGAScreenPrivateKeyRegistered (DGAScreenPrivateKeyRec.initialized)
static DevPrivateKeyRec DGAClientPrivateKeyRec;
+
#define DGAClientPrivateKey (&DGAClientPrivateKeyRec)
static int DGACallbackRefCount = 0;
/* This holds the client's version information */
typedef struct {
- int major;
- int minor;
+ int major;
+ int minor;
} DGAPrivRec, *DGAPrivPtr;
#define DGA_GETCLIENT(idx) ((ClientPtr) \
@@ -65,15 +65,13 @@ typedef struct {
#define DGA_SETPRIV(c,p) \
dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, p)
-
static void
-XDGAResetProc (ExtensionEntry *extEntry)
+XDGAResetProc(ExtensionEntry * extEntry)
{
- DeleteCallback (&ClientStateCallback, DGAClientStateChange, NULL);
- DGACallbackRefCount = 0;
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ DGACallbackRefCount = 0;
}
-
static int
ProcXDGAQueryVersion(ClientPtr client)
{
@@ -86,11 +84,10 @@ ProcXDGAQueryVersion(ClientPtr client)
rep.majorVersion = SERVER_XDGA_MAJOR_VERSION;
rep.minorVersion = SERVER_XDGA_MINOR_VERSION;
- WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *) &rep);
return Success;
}
-
static int
ProcXDGAOpenFramebuffer(ClientPtr client)
{
@@ -110,24 +107,23 @@ ProcXDGAOpenFramebuffer(ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if(!DGAOpenFramebuffer(stuff->screen, &deviceName,
- (unsigned char**)(&rep.mem1),
- (int*)&rep.size, (int*)&rep.offset, (int*)&rep.extra))
- {
- return BadAlloc;
+ if (!DGAOpenFramebuffer(stuff->screen, &deviceName,
+ (unsigned char **) (&rep.mem1),
+ (int *) &rep.size, (int *) &rep.offset,
+ (int *) &rep.extra)) {
+ return BadAlloc;
}
nameSize = deviceName ? (strlen(deviceName) + 1) : 0;
rep.length = bytes_to_int32(nameSize);
- WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *)&rep);
- if(rep.length)
- WriteToClient(client, nameSize, deviceName);
+ WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *) &rep);
+ if (rep.length)
+ WriteToClient(client, nameSize, deviceName);
return Success;
}
-
static int
ProcXDGACloseFramebuffer(ClientPtr client)
{
@@ -150,6 +146,7 @@ static int
ProcXDGAQueryModes(ClientPtr client)
{
int i, num, size;
+
REQUEST(xXDGAQueryModesReq);
xXDGAQueryModesReply rep;
xXDGAModeInfo info;
@@ -165,64 +162,64 @@ ProcXDGAQueryModes(ClientPtr client)
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen)) {
- rep.number = 0;
- rep.length = 0;
- WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
- return Success;
+ rep.number = 0;
+ rep.length = 0;
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
+ return Success;
}
- if(!(num = DGAGetModes(stuff->screen))) {
- WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
- return Success;
+ if (!(num = DGAGetModes(stuff->screen))) {
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
+ return Success;
}
- if(!(mode = (XDGAModePtr)malloc(num * sizeof(XDGAModeRec))))
- return BadAlloc;
+ if (!(mode = (XDGAModePtr) malloc(num * sizeof(XDGAModeRec))))
+ return BadAlloc;
- for(i = 0; i < num; i++)
- DGAGetModeInfo(stuff->screen, mode + i, i + 1);
+ for (i = 0; i < num; i++)
+ DGAGetModeInfo(stuff->screen, mode + i, i + 1);
size = num * sz_xXDGAModeInfo;
- for(i = 0; i < num; i++)
- size += pad_to_int32(strlen(mode[i].name) + 1); /* plus NULL */
+ for (i = 0; i < num; i++)
+ size += pad_to_int32(strlen(mode[i].name) + 1); /* plus NULL */
rep.number = num;
rep.length = bytes_to_int32(size);
- WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
-
- for(i = 0; i < num; i++) {
- size = strlen(mode[i].name) + 1;
-
- info.byte_order = mode[i].byteOrder;
- info.depth = mode[i].depth;
- info.num = mode[i].num;
- info.bpp = mode[i].bitsPerPixel;
- info.name_size = (size + 3) & ~3L;
- info.vsync_num = mode[i].VSync_num;
- info.vsync_den = mode[i].VSync_den;
- info.flags = mode[i].flags;
- info.image_width = mode[i].imageWidth;
- info.image_height = mode[i].imageHeight;
- info.pixmap_width = mode[i].pixmapWidth;
- info.pixmap_height = mode[i].pixmapHeight;
- info.bytes_per_scanline = mode[i].bytesPerScanline;
- info.red_mask = mode[i].red_mask;
- info.green_mask = mode[i].green_mask;
- info.blue_mask = mode[i].blue_mask;
- info.visual_class = mode[i].visualClass;
- info.viewport_width = mode[i].viewportWidth;
- info.viewport_height = mode[i].viewportHeight;
- info.viewport_xstep = mode[i].xViewportStep;
- info.viewport_ystep = mode[i].yViewportStep;
- info.viewport_xmax = mode[i].maxViewportX;
- info.viewport_ymax = mode[i].maxViewportY;
- info.viewport_flags = mode[i].viewportFlags;
- info.reserved1 = mode[i].reserved1;
- info.reserved2 = mode[i].reserved2;
-
- WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
- WriteToClient(client, size, mode[i].name);
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
+
+ for (i = 0; i < num; i++) {
+ size = strlen(mode[i].name) + 1;
+
+ info.byte_order = mode[i].byteOrder;
+ info.depth = mode[i].depth;
+ info.num = mode[i].num;
+ info.bpp = mode[i].bitsPerPixel;
+ info.name_size = (size + 3) & ~3L;
+ info.vsync_num = mode[i].VSync_num;
+ info.vsync_den = mode[i].VSync_den;
+ info.flags = mode[i].flags;
+ info.image_width = mode[i].imageWidth;
+ info.image_height = mode[i].imageHeight;
+ info.pixmap_width = mode[i].pixmapWidth;
+ info.pixmap_height = mode[i].pixmapHeight;
+ info.bytes_per_scanline = mode[i].bytesPerScanline;
+ info.red_mask = mode[i].red_mask;
+ info.green_mask = mode[i].green_mask;
+ info.blue_mask = mode[i].blue_mask;
+ info.visual_class = mode[i].visualClass;
+ info.viewport_width = mode[i].viewportWidth;
+ info.viewport_height = mode[i].viewportHeight;
+ info.viewport_xstep = mode[i].xViewportStep;
+ info.viewport_ystep = mode[i].yViewportStep;
+ info.viewport_xmax = mode[i].maxViewportX;
+ info.viewport_ymax = mode[i].maxViewportY;
+ info.viewport_flags = mode[i].viewportFlags;
+ info.reserved1 = mode[i].reserved1;
+ info.reserved2 = mode[i].reserved2;
+
+ WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info));
+ WriteToClient(client, size, mode[i].name);
}
free(mode);
@@ -230,36 +227,32 @@ ProcXDGAQueryModes(ClientPtr client)
return Success;
}
-
static void
-DGAClientStateChange (
- CallbackListPtr* pcbl,
- pointer nulldata,
- pointer calldata
-){
- NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
+DGAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+{
+ NewClientInfoRec *pci = (NewClientInfoRec *) calldata;
ClientPtr client = NULL;
int i;
- for(i = 0; i < screenInfo.numScreens; i++) {
- if(DGA_GETCLIENT(i) == pci->client) {
- client = pci->client;
- break;
- }
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ if (DGA_GETCLIENT(i) == pci->client) {
+ client = pci->client;
+ break;
+ }
}
- if(client &&
- ((client->clientState == ClientStateGone) ||
- (client->clientState == ClientStateRetained))) {
- XDGAModeRec mode;
- PixmapPtr pPix;
+ if (client &&
+ ((client->clientState == ClientStateGone) ||
+ (client->clientState == ClientStateRetained))) {
+ XDGAModeRec mode;
+ PixmapPtr pPix;
- DGA_SETCLIENT(i, NULL);
- DGASelectInput(i, NULL, 0);
- DGASetMode(i, 0, &mode, &pPix);
+ DGA_SETCLIENT(i, NULL);
+ DGASelectInput(i, NULL, 0);
+ DGASetMode(i, 0, &mode, &pPix);
- if(--DGACallbackRefCount == 0)
- DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ if (--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
}
}
@@ -288,36 +281,37 @@ ProcXDGASetMode(ClientPtr client)
if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode;
- if(owner && owner != client)
+ if (owner && owner != client)
return DGAErrorBase + XF86DGANoDirectVideoMode;
- if(!stuff->mode) {
- if(owner) {
- if(--DGACallbackRefCount == 0)
- DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
- }
- DGA_SETCLIENT(stuff->screen, NULL);
- DGASelectInput(stuff->screen, NULL, 0);
- DGASetMode(stuff->screen, 0, &mode, &pPix);
- WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
- return Success;
+ if (!stuff->mode) {
+ if (owner) {
+ if (--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange,
+ NULL);
+ }
+ DGA_SETCLIENT(stuff->screen, NULL);
+ DGASelectInput(stuff->screen, NULL, 0);
+ DGASetMode(stuff->screen, 0, &mode, &pPix);
+ WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep);
+ return Success;
}
- if(Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix))
- return BadValue;
+ if (Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix))
+ return BadValue;
- if(!owner) {
- if(DGACallbackRefCount++ == 0)
- AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
+ if (!owner) {
+ if (DGACallbackRefCount++ == 0)
+ AddCallback(&ClientStateCallback, DGAClientStateChange, NULL);
}
DGA_SETCLIENT(stuff->screen, client);
- if(pPix) {
- if(AddResource(stuff->pid, RT_PIXMAP, (pointer)(pPix))) {
- pPix->drawable.id = (int)stuff->pid;
- rep.flags = DGA_PIXMAP_AVAILABLE;
- }
+ if (pPix) {
+ if (AddResource(stuff->pid, RT_PIXMAP, (pointer) (pPix))) {
+ pPix->drawable.id = (int) stuff->pid;
+ rep.flags = DGA_PIXMAP_AVAILABLE;
+ }
}
size = strlen(mode.name) + 1;
@@ -351,8 +345,8 @@ ProcXDGASetMode(ClientPtr client)
rep.length = bytes_to_int32(sz_xXDGAModeInfo + info.name_size);
- WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
- WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
+ WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep);
+ WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info));
WriteToClient(client, size, mode.name);
return Success;
@@ -366,7 +360,7 @@ ProcXDGASetViewport(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASetViewportReq);
@@ -381,25 +375,25 @@ ProcXDGAInstallColormap(ClientPtr client)
{
ColormapPtr cmap;
int rc;
+
REQUEST(xXDGAInstallColormapReq);
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
- rc = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, RT_COLORMAP,
- client, DixInstallAccess);
+ rc = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, RT_COLORMAP,
+ client, DixInstallAccess);
if (rc != Success)
return rc;
DGAInstallCmap(cmap);
return Success;
}
-
static int
ProcXDGASelectInput(ClientPtr client)
{
@@ -408,18 +402,17 @@ ProcXDGASelectInput(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASelectInputReq);
- if(DGA_GETCLIENT(stuff->screen) == client)
- DGASelectInput(stuff->screen, client, stuff->mask);
+ if (DGA_GETCLIENT(stuff->screen) == client)
+ DGASelectInput(stuff->screen, client, stuff->mask);
return Success;
}
-
static int
ProcXDGAFillRectangle(ClientPtr client)
{
@@ -428,14 +421,14 @@ ProcXDGAFillRectangle(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
- if(Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
- stuff->width, stuff->height, stuff->color))
- return BadMatch;
+ if (Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
+ stuff->width, stuff->height, stuff->color))
+ return BadMatch;
return Success;
}
@@ -448,19 +441,19 @@ ProcXDGACopyArea(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
- if(Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
- stuff->width, stuff->height, stuff->dstx, stuff->dsty))
- return BadMatch;
+ if (Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
+ stuff->width, stuff->height, stuff->dstx,
+ stuff->dsty))
+ return BadMatch;
return Success;
}
-
static int
ProcXDGACopyTransparentArea(ClientPtr client)
{
@@ -469,19 +462,19 @@ ProcXDGACopyTransparentArea(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
- if(Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
- stuff->width, stuff->height, stuff->dstx, stuff->dsty, stuff->key))
- return BadMatch;
+ if (Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
+ stuff->width, stuff->height, stuff->dstx,
+ stuff->dsty, stuff->key))
+ return BadMatch;
return Success;
}
-
static int
ProcXDGAGetViewportStatus(ClientPtr client)
{
@@ -491,7 +484,7 @@ ProcXDGAGetViewportStatus(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
@@ -501,7 +494,7 @@ ProcXDGAGetViewportStatus(ClientPtr client)
rep.status = DGAGetViewportStatus(stuff->screen);
- WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *) &rep);
return Success;
}
@@ -514,7 +507,7 @@ ProcXDGASync(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASyncReq);
@@ -524,7 +517,7 @@ ProcXDGASync(ClientPtr client)
DGASync(stuff->screen);
- WriteToClient(client, sizeof(xXDGASyncReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXDGASyncReply), (char *) &rep);
return Success;
}
@@ -537,11 +530,11 @@ ProcXDGASetClientVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xXDGASetClientVersionReq);
if ((pPriv = DGA_GETPRIV(client)) == NULL) {
- pPriv = malloc(sizeof(DGAPrivRec));
- /* XXX Need to look into freeing this */
- if (!pPriv)
- return BadAlloc;
- DGA_SETPRIV(client, pPriv);
+ pPriv = malloc(sizeof(DGAPrivRec));
+ /* XXX Need to look into freeing this */
+ if (!pPriv)
+ return BadAlloc;
+ DGA_SETPRIV(client, pPriv);
}
pPriv->major = stuff->major;
pPriv->minor = stuff->minor;
@@ -559,7 +552,7 @@ ProcXDGAChangePixmapMode(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
@@ -570,17 +563,16 @@ ProcXDGAChangePixmapMode(ClientPtr client)
x = stuff->x;
y = stuff->y;
- if(!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
- return BadMatch;
+ if (!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
+ return BadMatch;
rep.x = x;
rep.y = y;
- WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *) &rep);
return Success;
}
-
static int
ProcXDGACreateColormap(ClientPtr client)
{
@@ -590,18 +582,18 @@ ProcXDGACreateColormap(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
- if(!stuff->mode)
- return BadValue;
+ if (!stuff->mode)
+ return BadValue;
result = DGACreateColormap(stuff->screen, client, stuff->id,
- stuff->mode, stuff->alloc);
- if(result != Success)
- return result;
+ stuff->mode, stuff->alloc);
+ if (result != Success)
+ return result;
return Success;
}
@@ -614,8 +606,6 @@ ProcXDGACreateColormap(ClientPtr client)
#ifdef DGA_PROTOCOL_OLD_SUPPORT
-
-
static int
ProcXF86DGAGetVideoLL(ClientPtr client)
{
@@ -626,32 +616,32 @@ ProcXF86DGAGetVideoLL(ClientPtr client)
char *name;
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if(!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ if (!(num = DGAGetOldDGAMode(stuff->screen)))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
/* get the parameters for the mode that best matches */
DGAGetModeInfo(stuff->screen, &mode, num);
- if(!DGAOpenFramebuffer(stuff->screen, &name,
- (unsigned char**)(&rep.offset),
- (int*)(&rep.bank_size), &offset, &flags))
- return BadAlloc;
+ if (!DGAOpenFramebuffer(stuff->screen, &name,
+ (unsigned char **) (&rep.offset),
+ (int *) (&rep.bank_size), &offset, &flags))
+ return BadAlloc;
rep.offset += mode.offset;
rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3);
rep.ram_size = rep.bank_size >> 10;
- WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *) &rep);
return Success;
}
@@ -662,14 +652,15 @@ ProcXF86DGADirectVideo(ClientPtr client)
PixmapPtr pix;
XDGAModeRec mode;
ClientPtr owner;
+
REQUEST(xXF86DGADirectVideoReq);
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
if (!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
owner = DGA_GETCLIENT(stuff->screen);
@@ -677,34 +668,37 @@ ProcXF86DGADirectVideo(ClientPtr client)
return DGAErrorBase + XF86DGANoDirectVideoMode;
if (stuff->enable & XF86DGADirectGraphics) {
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
- } else
- num = 0;
+ if (!(num = DGAGetOldDGAMode(stuff->screen)))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+ }
+ else
+ num = 0;
- if(Success != DGASetMode(stuff->screen, num, &mode, &pix))
- return DGAErrorBase + XF86DGAScreenNotActive;
+ if (Success != DGASetMode(stuff->screen, num, &mode, &pix))
+ return DGAErrorBase + XF86DGAScreenNotActive;
- DGASetInputMode (stuff->screen,
- (stuff->enable & XF86DGADirectKeyb) != 0,
- (stuff->enable & XF86DGADirectMouse) != 0);
+ DGASetInputMode(stuff->screen,
+ (stuff->enable & XF86DGADirectKeyb) != 0,
+ (stuff->enable & XF86DGADirectMouse) != 0);
/* We need to track the client and attach the teardown callback */
if (stuff->enable &
- (XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse)) {
- if (!owner) {
- if (DGACallbackRefCount++ == 0)
- AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
- }
-
- DGA_SETCLIENT(stuff->screen, client);
- } else {
- if (owner) {
- if (--DGACallbackRefCount == 0)
- DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
- }
-
- DGA_SETCLIENT(stuff->screen, NULL);
+ (XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse)) {
+ if (!owner) {
+ if (DGACallbackRefCount++ == 0)
+ AddCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ }
+
+ DGA_SETCLIENT(stuff->screen, client);
+ }
+ else {
+ if (owner) {
+ if (--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange,
+ NULL);
+ }
+
+ DGA_SETCLIENT(stuff->screen, NULL);
}
return Success;
@@ -715,11 +709,12 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
{
int num;
XDGAModeRec mode;
+
REQUEST(xXF86DGAGetViewPortSizeReq);
xXF86DGAGetViewPortSizeReply rep;
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
rep.type = X_Reply;
@@ -727,17 +722,17 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ if (!(num = DGAGetOldDGAMode(stuff->screen)))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
DGAGetModeInfo(stuff->screen, &mode, num);
rep.width = mode.viewportWidth;
rep.height = mode.viewportHeight;
- WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *) &rep);
return Success;
}
@@ -747,7 +742,7 @@ ProcXF86DGASetViewPort(ClientPtr client)
REQUEST(xXF86DGASetViewPortReq);
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
@@ -755,14 +750,14 @@ ProcXF86DGASetViewPort(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
if (!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
if (!DGAActive(stuff->screen))
- return DGAErrorBase + XF86DGADirectNotActivated;
+ return DGAErrorBase + XF86DGADirectNotActivated;
if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE)
- != Success)
- return DGAErrorBase + XF86DGADirectNotActivated;
+ != Success)
+ return DGAErrorBase + XF86DGADirectNotActivated;
return Success;
}
@@ -774,26 +769,25 @@ ProcXF86DGAGetVidPage(ClientPtr client)
xXF86DGAGetVidPageReply rep;
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.vpage = 0; /* silently fail */
+ rep.vpage = 0; /* silently fail */
- WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *) &rep);
return Success;
}
-
static int
ProcXF86DGASetVidPage(ClientPtr client)
{
REQUEST(xXF86DGASetVidPageReq);
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
@@ -802,16 +796,16 @@ ProcXF86DGASetVidPage(ClientPtr client)
return Success;
}
-
static int
ProcXF86DGAInstallColormap(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xXF86DGAInstallColormapReq);
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
@@ -819,14 +813,15 @@ ProcXF86DGAInstallColormap(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
if (!DGAActive(stuff->screen))
- return DGAErrorBase + XF86DGADirectNotActivated;
+ return DGAErrorBase + XF86DGADirectNotActivated;
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP,
- client, DixInstallAccess);
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP,
+ client, DixInstallAccess);
if (rc == Success) {
- DGAInstallCmap(pcmp);
+ DGAInstallCmap(pcmp);
return Success;
- } else {
+ }
+ else {
return rc;
}
}
@@ -838,7 +833,7 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client)
xXF86DGAQueryDirectVideoReply rep;
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
rep.type = X_Reply;
@@ -847,9 +842,9 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client)
rep.flags = 0;
if (DGAAvailable(stuff->screen))
- rep.flags = XF86DGADirectPresent;
+ rep.flags = XF86DGADirectPresent;
- WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *) &rep);
return Success;
}
@@ -860,7 +855,7 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
xXF86DGAViewPortChangedReply rep;
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
@@ -868,23 +863,23 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
if (!DGAActive(stuff->screen))
- return DGAErrorBase + XF86DGADirectNotActivated;
+ return DGAErrorBase + XF86DGADirectNotActivated;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.result = 1;
- WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *) &rep);
return Success;
}
-#endif /* DGA_PROTOCOL_OLD_SUPPORT */
+#endif /* DGA_PROTOCOL_OLD_SUPPORT */
static int
-SProcXDGADispatch (ClientPtr client)
+SProcXDGADispatch(ClientPtr client)
{
- return DGAErrorBase + XF86DGAClientNotLocal;
+ return DGAErrorBase + XF86DGAClientNotLocal;
}
#if 0
@@ -924,112 +919,111 @@ static char *dgaMinor[] = {
#endif
static int
-ProcXDGADispatch (ClientPtr client)
+ProcXDGADispatch(ClientPtr client)
{
REQUEST(xReq);
if (!LocalClient(client))
- return DGAErrorBase + XF86DGAClientNotLocal;
+ return DGAErrorBase + XF86DGAClientNotLocal;
#ifdef DGA_REQ_DEBUG
if (stuff->data <= X_XDGACreateColormap)
- fprintf (stderr, " DGA %s\n", dgaMinor[stuff->data]);
+ fprintf(stderr, " DGA %s\n", dgaMinor[stuff->data]);
#endif
- switch (stuff->data){
- /*
- * DGA2 Protocol
- */
+ switch (stuff->data) {
+ /*
+ * DGA2 Protocol
+ */
case X_XDGAQueryVersion:
- return ProcXDGAQueryVersion(client);
+ return ProcXDGAQueryVersion(client);
case X_XDGAQueryModes:
- return ProcXDGAQueryModes(client);
+ return ProcXDGAQueryModes(client);
case X_XDGASetMode:
- return ProcXDGASetMode(client);
+ return ProcXDGASetMode(client);
case X_XDGAOpenFramebuffer:
- return ProcXDGAOpenFramebuffer(client);
+ return ProcXDGAOpenFramebuffer(client);
case X_XDGACloseFramebuffer:
- return ProcXDGACloseFramebuffer(client);
+ return ProcXDGACloseFramebuffer(client);
case X_XDGASetViewport:
- return ProcXDGASetViewport(client);
+ return ProcXDGASetViewport(client);
case X_XDGAInstallColormap:
- return ProcXDGAInstallColormap(client);
+ return ProcXDGAInstallColormap(client);
case X_XDGASelectInput:
- return ProcXDGASelectInput(client);
+ return ProcXDGASelectInput(client);
case X_XDGAFillRectangle:
- return ProcXDGAFillRectangle(client);
+ return ProcXDGAFillRectangle(client);
case X_XDGACopyArea:
- return ProcXDGACopyArea(client);
+ return ProcXDGACopyArea(client);
case X_XDGACopyTransparentArea:
- return ProcXDGACopyTransparentArea(client);
+ return ProcXDGACopyTransparentArea(client);
case X_XDGAGetViewportStatus:
- return ProcXDGAGetViewportStatus(client);
+ return ProcXDGAGetViewportStatus(client);
case X_XDGASync:
- return ProcXDGASync(client);
+ return ProcXDGASync(client);
case X_XDGASetClientVersion:
- return ProcXDGASetClientVersion(client);
+ return ProcXDGASetClientVersion(client);
case X_XDGAChangePixmapMode:
- return ProcXDGAChangePixmapMode(client);
+ return ProcXDGAChangePixmapMode(client);
case X_XDGACreateColormap:
- return ProcXDGACreateColormap(client);
- /*
- * Old DGA Protocol
- */
+ return ProcXDGACreateColormap(client);
+ /*
+ * Old DGA Protocol
+ */
#ifdef DGA_PROTOCOL_OLD_SUPPORT
case X_XF86DGAGetVideoLL:
- return ProcXF86DGAGetVideoLL(client);
+ return ProcXF86DGAGetVideoLL(client);
case X_XF86DGADirectVideo:
- return ProcXF86DGADirectVideo(client);
+ return ProcXF86DGADirectVideo(client);
case X_XF86DGAGetViewPortSize:
- return ProcXF86DGAGetViewPortSize(client);
+ return ProcXF86DGAGetViewPortSize(client);
case X_XF86DGASetViewPort:
- return ProcXF86DGASetViewPort(client);
+ return ProcXF86DGASetViewPort(client);
case X_XF86DGAGetVidPage:
- return ProcXF86DGAGetVidPage(client);
+ return ProcXF86DGAGetVidPage(client);
case X_XF86DGASetVidPage:
- return ProcXF86DGASetVidPage(client);
+ return ProcXF86DGASetVidPage(client);
case X_XF86DGAInstallColormap:
- return ProcXF86DGAInstallColormap(client);
+ return ProcXF86DGAInstallColormap(client);
case X_XF86DGAQueryDirectVideo:
- return ProcXF86DGAQueryDirectVideo(client);
+ return ProcXF86DGAQueryDirectVideo(client);
case X_XF86DGAViewPortChanged:
- return ProcXF86DGAViewPortChanged(client);
-#endif /* DGA_PROTOCOL_OLD_SUPPORT */
+ return ProcXF86DGAViewPortChanged(client);
+#endif /* DGA_PROTOCOL_OLD_SUPPORT */
default:
- return BadRequest;
+ return BadRequest;
}
}
void
XFree86DGARegister(INITARGS)
{
- XDGAEventBase = &DGAEventBase;
+ XDGAEventBase = &DGAEventBase;
}
void
XFree86DGAExtensionInit(INITARGS)
{
- ExtensionEntry* extEntry;
+ ExtensionEntry *extEntry;
if (!dixRegisterPrivateKey(&DGAClientPrivateKeyRec, PRIVATE_CLIENT, 0))
- return;
+ return;
if (!dixRegisterPrivateKey(&DGAScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return;
+ return;
if ((extEntry = AddExtension(XF86DGANAME,
- XF86DGANumberEvents,
- XF86DGANumberErrors,
- ProcXDGADispatch,
- SProcXDGADispatch,
- XDGAResetProc,
- StandardMinorOpcode))) {
- int i;
-
- DGAReqCode = (unsigned char)extEntry->base;
- DGAErrorBase = extEntry->errorBase;
- DGAEventBase = extEntry->eventBase;
- for (i = KeyPress; i <= MotionNotify; i++)
- SetCriticalEvent (DGAEventBase + i);
+ XF86DGANumberEvents,
+ XF86DGANumberErrors,
+ ProcXDGADispatch,
+ SProcXDGADispatch,
+ XDGAResetProc, StandardMinorOpcode))) {
+ int i;
+
+ DGAReqCode = (unsigned char) extEntry->base;
+ DGAErrorBase = extEntry->errorBase;
+ DGAEventBase = extEntry->eventBase;
+ for (i = KeyPress; i <= MotionNotify; i++)
+ SetCriticalEvent(DGAEventBase + i);
}
}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
index 6d3d5fcbc..6e2a8e9b2 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -52,12 +52,13 @@ from Kaleb S. KEITHLEY
static int VidModeErrorBase;
static DevPrivateKeyRec VidModeClientPrivateKeyRec;
+
#define VidModeClientPrivateKey (&VidModeClientPrivateKeyRec)
/* This holds the client's version information */
typedef struct {
- int major;
- int minor;
+ int major;
+ int minor;
} VidModePrivRec, *VidModePrivPtr;
#define VM_GETPRIV(c) ((VidModePrivPtr) \
@@ -65,7 +66,6 @@ typedef struct {
#define VM_SETPRIV(c,p) \
dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, p)
-
#if 0
static unsigned char XF86VidModeReqCode = 0;
#endif
@@ -76,30 +76,30 @@ static unsigned char XF86VidModeReqCode = 0;
static int XF86VidModeEventBase = 0;
static void SXF86VidModeNotifyEvent();
- xXF86VidModeNotifyEvent * /* from */,
- xXF86VidModeNotifyEvent * /* to */
-);
+xXF86VidModeNotifyEvent * /* from */ , xXF86VidModeNotifyEvent * /* to */
+ );
-static RESTYPE EventType; /* resource type for event masks */
+static RESTYPE EventType; /* resource type for event masks */
typedef struct _XF86VidModeEvent *XF86VidModeEventPtr;
typedef struct _XF86VidModeEvent {
- XF86VidModeEventPtr next;
- ClientPtr client;
- ScreenPtr screen;
- XID resource;
- CARD32 mask;
+ XF86VidModeEventPtr next;
+ ClientPtr client;
+ ScreenPtr screen;
+ XID resource;
+ CARD32 mask;
} XF86VidModeEventRec;
static int XF86VidModeFreeEvents();
typedef struct _XF86VidModeScreenPrivate {
- XF86VidModeEventPtr events;
- Bool hasWindow;
+ XF86VidModeEventPtr events;
+ Bool hasWindow;
} XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr;
static DevPrivateKeyRec ScreenPrivateKeyRec;
+
#define ScreenPrivateKey (&ScreenPrivateKeyRec)
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
@@ -112,198 +112,181 @@ static DevPrivateKeyRec ScreenPrivateKeyRec;
#endif
#ifdef DEBUG
-# define DEBUG_P(x) ErrorF(x"\n");
+#define DEBUG_P(x) ErrorF(x"\n");
#else
-# define DEBUG_P(x) /**/
+#define DEBUG_P(x) /**/
#endif
-
-static int
-ClientMajorVersion(ClientPtr client)
-{
+ static int
+ ClientMajorVersion(ClientPtr client) {
VidModePrivPtr pPriv;
- pPriv = VM_GETPRIV(client);
+ pPriv = VM_GETPRIV(client);
if (!pPriv)
- return 0;
+ return 0;
else
- return pPriv->major;
+ return pPriv->major;
}
-
#ifdef XF86VIDMODE_EVENTS
static void
-CheckScreenPrivate (pScreen)
- ScreenPtr pScreen;
+ CheckScreenPrivate(pScreen)
+ScreenPtr
+ pScreen;
{
- SetupScreen (pScreen);
+ SetupScreen(pScreen);
if (!pPriv)
- return;
+ return;
if (!pPriv->events && !pPriv->hasWindow) {
- free(pPriv);
- SetScreenPrivate (pScreen, NULL);
+ free(pPriv);
+ SetScreenPrivate(pScreen, NULL);
}
}
-
-static XF86VidModeScreenPrivatePtr
-MakeScreenPrivate (pScreen)
- ScreenPtr pScreen;
+
+static XF86VidModeScreenPrivatePtr MakeScreenPrivate(pScreen)
+ScreenPtr
+ pScreen;
{
- SetupScreen (pScreen);
+ SetupScreen(pScreen);
if (pPriv)
- return pPriv;
- pPriv = New (XF86VidModeScreenPrivateRec);
+ return pPriv;
+ pPriv = New(XF86VidModeScreenPrivateRec);
if (!pPriv)
- return 0;
+ return 0;
pPriv->events = 0;
pPriv->hasWindow = FALSE;
- SetScreenPrivate (pScreen, pPriv);
+ SetScreenPrivate(pScreen, pPriv);
return pPriv;
}
static unsigned long
-getEventMask (ScreenPtr pScreen, ClientPtr client)
-{
+ getEventMask(ScreenPtr pScreen, ClientPtr client) {
SetupScreen(pScreen);
XF86VidModeEventPtr pEv;
if (!pPriv)
- return 0;
+ return 0;
for (pEv = pPriv->events; pEv; pEv = pEv->next)
- if (pEv->client == client)
- return pEv->mask;
- return 0;
-}
-
-static Bool
-setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
-{
+ if (pEv->client == client)
+ return pEv->mask;
+ return 0;
+} static Bool
+ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask) {
SetupScreen(pScreen);
XF86VidModeEventPtr pEv, *pPrev;
- if (getEventMask (pScreen, client) == mask)
- return TRUE;
+ if (getEventMask(pScreen, client) == mask)
+ return TRUE;
if (!pPriv) {
- pPriv = MakeScreenPrivate (pScreen);
- if (!pPriv)
- return FALSE;
- }
- for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
- if (pEv->client == client)
- break;
+ pPriv = MakeScreenPrivate(pScreen);
+ if (!pPriv)
+ return FALSE;
+ } for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
+ if (pEv->client == client)
+ break;
if (mask == 0) {
- *pPrev = pEv->next;
- free(pEv);
- CheckScreenPrivate (pScreen);
- } else {
- if (!pEv) {
- pEv = New (ScreenSaverEventRec);
- if (!pEv) {
- CheckScreenPrivate (pScreen);
- return FALSE;
- }
- *pPrev = pEv;
- pEv->next = NULL;
- pEv->client = client;
- pEv->screen = pScreen;
- pEv->resource = FakeClientID (client->index);
- }
- pEv->mask = mask;
+ *pPrev = pEv->next;
+ free(pEv);
+ CheckScreenPrivate(pScreen);
+ }
+ else {
+ if (!pEv) {
+ pEv = New(ScreenSaverEventRec);
+ if (!pEv) {
+ CheckScreenPrivate(pScreen);
+ return FALSE;
+ }
+ *pPrev = pEv;
+ pEv->next = NULL;
+ pEv->client = client;
+ pEv->screen = pScreen;
+ pEv->resource = FakeClientID(client->index);
+ }
+ pEv->mask = mask;
}
return TRUE;
}
static int
-XF86VidModeFreeEvents(pointer value, XID id)
-{
- XF86VidModeEventPtr pOld = (XF86VidModeEventPtr)value;
+ XF86VidModeFreeEvents(pointer value, XID id) {
+ XF86VidModeEventPtr pOld = (XF86VidModeEventPtr) value;
ScreenPtr pScreen = pOld->screen;
- SetupScreen (pScreen);
- XF86VidModeEventPtr pEv, *pPrev;
+ SetupScreen(pScreen);
+ XF86VidModeEventPtr pEv, *pPrev;
if (!pPriv)
- return TRUE;
+ return TRUE;
for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
- if (pEv == pOld)
- break;
+ if (pEv == pOld)
+ break;
if (!pEv)
- return TRUE;
+ return TRUE;
*pPrev = pEv->next;
- free(pEv);
- CheckScreenPrivate (pScreen);
- return TRUE;
-}
-
-static void
-SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
-{
- XF86VidModeScreenPrivatePtr pPriv;
- XF86VidModeEventPtr pEv;
- unsigned long mask;
- xXF86VidModeNotifyEvent ev;
- int kind;
-
- UpdateCurrentTimeIf ();
- mask = XF86VidModeNotifyMask;
- pScreen = screenInfo.screens[pScreen->myNum];
- pPriv = GetScreenPrivate(pScreen);
+ free(pEv);
+ CheckScreenPrivate(pScreen);
+ return TRUE;
+} static void
+ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) {
+ XF86VidModeScreenPrivatePtr pPriv;
+ XF86VidModeEventPtr pEv;
+ unsigned long mask;
+ xXF86VidModeNotifyEvent ev;
+ int kind;
+
+ UpdateCurrentTimeIf();
+ mask = XF86VidModeNotifyMask;
+ pScreen = screenInfo.screens[pScreen->myNum];
+ pPriv = GetScreenPrivate(pScreen);
if (!pPriv)
- return;
- kind = XF86VidModeModeChange;
- for (pEv = pPriv->events; pEv; pEv = pEv->next)
- {
- if (!(pEv->mask & mask))
- continue;
- ev.type = XF86VidModeNotify + XF86VidModeEventBase;
- ev.state = state;
- ev.timestamp = currentTime.milliseconds;
- ev.root = pScreen->root->drawable.id;
- ev.kind = kind;
- ev.forced = forced;
- WriteEventsToClient (pEv->client, 1, (xEvent *) &ev);
- }
-}
-
-static void
-SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent *from,
- xXF86VidModeNotifyEvent *to)
-{
+ return;
+ kind = XF86VidModeModeChange;
+ for (pEv = pPriv->events; pEv; pEv = pEv->next) {
+ if (!(pEv->mask & mask))
+ continue;
+ ev.type = XF86VidModeNotify + XF86VidModeEventBase;
+ ev.state = state;
+ ev.timestamp = currentTime.milliseconds;
+ ev.root = pScreen->root->drawable.id;
+ ev.kind = kind;
+ ev.forced = forced;
+ WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
+}} static void
+ SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from,
+ xXF86VidModeNotifyEvent * to) {
to->type = from->type;
to->state = from->state;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->timestamp, to->timestamp);
- cpswapl (from->root, to->root);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->root, to->root);
to->kind = from->kind;
to->forced = from->forced;
}
#endif
-
+
static int
-ProcXF86VidModeQueryVersion(ClientPtr client)
-{
+ ProcXF86VidModeQueryVersion(ClientPtr client) {
xXF86VidModeQueryVersionReply rep;
- DEBUG_P("XF86VidModeQueryVersion");
+ DEBUG_P("XF86VidModeQueryVersion");
- REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION;
- rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION;
+ REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION;
+ rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
- }
- WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *)&rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
+ } WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply),
+ (char *) &rep);
return Success;
}
static int
-ProcXF86VidModeGetModeLine(ClientPtr client)
-{
+ ProcXF86VidModeGetModeLine(ClientPtr client) {
REQUEST(xXF86VidModeGetModeLineReq);
xXF86VidModeGetModeLineReply rep;
xXF86OldVidModeGetModeLineReply oldrep;
@@ -311,25 +294,26 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
int dotClock;
int ver;
- DEBUG_P("XF86VidModeGetModeline");
+ DEBUG_P("XF86VidModeGetModeline");
- ver = ClientMajorVersion(client);
- REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
- rep.type = X_Reply;
+ ver = ClientMajorVersion(client);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
+ rep.type = X_Reply;
if (ver < 2) {
- rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) -
- SIZEOF(xGenericReply));
- } else {
- rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetModeLineReply) -
- SIZEOF(xGenericReply));
+ rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) -
+ SIZEOF(xGenericReply));
+ }
+ else {
+ rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetModeLineReply) -
+ SIZEOF(xGenericReply));
}
rep.sequenceNumber = client->sequence;
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
rep.dotclock = dotClock;
rep.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
@@ -344,16 +328,15 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
rep.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("GetModeLine - scrn: %d clock: %ld\n",
- stuff->screen, (unsigned long)rep.dotclock);
- ErrorF("GetModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
- rep.hdisplay, rep.hsyncstart,
- rep.hsyncend, rep.htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- rep.vdisplay, rep.vsyncstart, rep.vsyncend,
- rep.vtotal, (unsigned long)rep.flags);
+ ErrorF("GetModeLine - scrn: %d clock: %ld\n",
+ stuff->screen, (unsigned long) rep.dotclock);
+ ErrorF("GetModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ rep.hdisplay, rep.hsyncstart, rep.hsyncend, rep.htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ rep.vdisplay, rep.vsyncstart, rep.vsyncend,
+ rep.vtotal, (unsigned long) rep.flags);
}
-
+
/*
* Older servers sometimes had server privates that the VidMode
* extention made available. So to be compatiable pretend that
@@ -362,48 +345,48 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
rep.privsize = 0;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.dotclock);
- swaps(&rep.hdisplay);
- swaps(&rep.hsyncstart);
- swaps(&rep.hsyncend);
- swaps(&rep.htotal);
- swaps(&rep.hskew);
- swaps(&rep.vdisplay);
- swaps(&rep.vsyncstart);
- swaps(&rep.vsyncend);
- swaps(&rep.vtotal);
- swapl(&rep.flags);
- swapl(&rep.privsize);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.dotclock);
+ swaps(&rep.hdisplay);
+ swaps(&rep.hsyncstart);
+ swaps(&rep.hsyncend);
+ swaps(&rep.htotal);
+ swaps(&rep.hskew);
+ swaps(&rep.vdisplay);
+ swaps(&rep.vsyncstart);
+ swaps(&rep.vsyncend);
+ swaps(&rep.vtotal);
+ swapl(&rep.flags);
+ swapl(&rep.privsize);
}
if (ver < 2) {
- oldrep.type = rep.type;
- oldrep.sequenceNumber = rep.sequenceNumber;
- oldrep.length = rep.length;
- oldrep.dotclock = rep.dotclock;
- oldrep.hdisplay = rep.hdisplay;
- oldrep.hsyncstart = rep.hsyncstart;
- oldrep.hsyncend = rep.hsyncend;
- oldrep.htotal = rep.htotal;
- oldrep.vdisplay = rep.vdisplay;
- oldrep.vsyncstart = rep.vsyncstart;
- oldrep.vsyncend = rep.vsyncend;
- oldrep.vtotal = rep.vtotal;
- oldrep.flags = rep.flags;
- oldrep.privsize = rep.privsize;
- WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply),
- (char *)&oldrep);
- } else {
- WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply),
- (char *)&rep);
+ oldrep.type = rep.type;
+ oldrep.sequenceNumber = rep.sequenceNumber;
+ oldrep.length = rep.length;
+ oldrep.dotclock = rep.dotclock;
+ oldrep.hdisplay = rep.hdisplay;
+ oldrep.hsyncstart = rep.hsyncstart;
+ oldrep.hsyncend = rep.hsyncend;
+ oldrep.htotal = rep.htotal;
+ oldrep.vdisplay = rep.vdisplay;
+ oldrep.vsyncstart = rep.vsyncstart;
+ oldrep.vsyncend = rep.vsyncend;
+ oldrep.vtotal = rep.vtotal;
+ oldrep.flags = rep.flags;
+ oldrep.privsize = rep.privsize;
+ WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply),
+ (char *) &oldrep);
+ }
+ else {
+ WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply),
+ (char *) &rep);
}
return Success;
}
static int
-ProcXF86VidModeGetAllModeLines(ClientPtr client)
-{
+ ProcXF86VidModeGetAllModeLines(ClientPtr client) {
REQUEST(xXF86VidModeGetAllModeLinesReq);
xXF86VidModeGetAllModeLinesReply rep;
xXF86VidModeModeInfo mdinf;
@@ -412,85 +395,87 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
int modecount, dotClock;
int ver;
- DEBUG_P("XF86VidModeGetAllModelines");
+ DEBUG_P("XF86VidModeGetAllModelines");
- REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- ver = ClientMajorVersion(client);
+ ver = ClientMajorVersion(client);
- modecount = VidModeGetNumOfModes(stuff->screen);
+ modecount = VidModeGetNumOfModes(stuff->screen);
if (modecount < 1)
- return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- rep.type = X_Reply;
- rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
- SIZEOF(xGenericReply);
+ return BadValue;
+
+ rep.type = X_Reply;
+ rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
+ SIZEOF(xGenericReply);
if (ver < 2)
- rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
+ rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
else
- rep.length += modecount * sizeof(xXF86VidModeModeInfo);
- rep.length >>= 2;
- rep.sequenceNumber = client->sequence;
- rep.modecount = modecount;
+ rep.length += modecount * sizeof(xXF86VidModeModeInfo);
+ rep.length >>= 2;
+ rep.sequenceNumber = client->sequence;
+ rep.modecount = modecount;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.modecount);
- }
- WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), (char *)&rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.modecount);
+ } WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply),
+ (char *) &rep);
do {
- mdinf.dotclock = dotClock;
- mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
- mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
- mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
- mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
- mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
- mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
- mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
- mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
- mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
- mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
- mdinf.privsize = 0;
+ mdinf.dotclock = dotClock;
+ mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
+ mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
+ mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
+ mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
+ mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
+ mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
+ mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
+ mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
+ mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
+ mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
+ mdinf.privsize = 0;
if (client->swapped) {
- swapl(&mdinf.dotclock);
- swaps(&mdinf.hdisplay);
- swaps(&mdinf.hsyncstart);
- swaps(&mdinf.hsyncend);
- swaps(&mdinf.htotal);
- swapl(&mdinf.hskew);
- swaps(&mdinf.vdisplay);
- swaps(&mdinf.vsyncstart);
- swaps(&mdinf.vsyncend);
- swaps(&mdinf.vtotal);
- swapl(&mdinf.flags);
- swapl(&mdinf.privsize);
- }
- if (ver < 2) {
- oldmdinf.dotclock = mdinf.dotclock;
- oldmdinf.hdisplay = mdinf.hdisplay;
- oldmdinf.hsyncstart = mdinf.hsyncstart;
- oldmdinf.hsyncend = mdinf.hsyncend;
- oldmdinf.htotal = mdinf.htotal;
- oldmdinf.vdisplay = mdinf.vdisplay;
- oldmdinf.vsyncstart = mdinf.vsyncstart;
- oldmdinf.vsyncend = mdinf.vsyncend;
- oldmdinf.vtotal = mdinf.vtotal;
- oldmdinf.flags = mdinf.flags;
- oldmdinf.privsize = mdinf.privsize;
+ swapl(&mdinf.dotclock);
+ swaps(&mdinf.hdisplay);
+ swaps(&mdinf.hsyncstart);
+ swaps(&mdinf.hsyncend);
+ swaps(&mdinf.htotal);
+ swapl(&mdinf.hskew);
+ swaps(&mdinf.vdisplay);
+ swaps(&mdinf.vsyncstart);
+ swaps(&mdinf.vsyncend);
+ swaps(&mdinf.vtotal);
+ swapl(&mdinf.flags);
+ swapl(&mdinf.privsize);
+ }
+ if (ver < 2) {
+ oldmdinf.dotclock = mdinf.dotclock;
+ oldmdinf.hdisplay = mdinf.hdisplay;
+ oldmdinf.hsyncstart = mdinf.hsyncstart;
+ oldmdinf.hsyncend = mdinf.hsyncend;
+ oldmdinf.htotal = mdinf.htotal;
+ oldmdinf.vdisplay = mdinf.vdisplay;
+ oldmdinf.vsyncstart = mdinf.vsyncstart;
+ oldmdinf.vsyncend = mdinf.vsyncend;
+ oldmdinf.vtotal = mdinf.vtotal;
+ oldmdinf.flags = mdinf.flags;
+ oldmdinf.privsize = mdinf.privsize;
WriteToClient(client, sizeof(xXF86OldVidModeModeInfo),
- (char *)&oldmdinf);
- } else {
- WriteToClient(client, sizeof(xXF86VidModeModeInfo), (char *)&mdinf);
- }
+ (char *) &oldmdinf);
+ }
+ else {
+ WriteToClient(client, sizeof(xXF86VidModeModeInfo),
+ (char *) &mdinf);
+ }
- } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
return Success;
}
@@ -507,394 +492,404 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
&& VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags )
static int
-ProcXF86VidModeAddModeLine(ClientPtr client)
-{
+ ProcXF86VidModeAddModeLine(ClientPtr client) {
REQUEST(xXF86VidModeAddModeLineReq);
xXF86OldVidModeAddModeLineReq *oldstuff =
- (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
xXF86VidModeAddModeLineReq newstuff;
pointer mode;
int len;
int dotClock;
int ver;
- DEBUG_P("XF86VidModeAddModeline");
+ DEBUG_P("XF86VidModeAddModeline");
- ver = ClientMajorVersion(client);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- /* convert from old format */
- stuff = &newstuff;
- stuff->length = oldstuff->length;
- stuff->screen = oldstuff->screen;
- stuff->dotclock = oldstuff->dotclock;
- stuff->hdisplay = oldstuff->hdisplay;
- stuff->hsyncstart = oldstuff->hsyncstart;
- stuff->hsyncend = oldstuff->hsyncend;
- stuff->htotal = oldstuff->htotal;
- stuff->hskew = 0;
- stuff->vdisplay = oldstuff->vdisplay;
- stuff->vsyncstart = oldstuff->vsyncstart;
- stuff->vsyncend = oldstuff->vsyncend;
- stuff->vtotal = oldstuff->vtotal;
- stuff->flags = oldstuff->flags;
- stuff->privsize = oldstuff->privsize;
- stuff->after_dotclock = oldstuff->after_dotclock;
- stuff->after_hdisplay = oldstuff->after_hdisplay;
- stuff->after_hsyncstart = oldstuff->after_hsyncstart;
- stuff->after_hsyncend = oldstuff->after_hsyncend;
- stuff->after_htotal = oldstuff->after_htotal;
- stuff->after_hskew = 0;
- stuff->after_vdisplay = oldstuff->after_vdisplay;
- stuff->after_vsyncstart = oldstuff->after_vsyncstart;
- stuff->after_vsyncend = oldstuff->after_vsyncend;
- stuff->after_vtotal = oldstuff->after_vtotal;
- stuff->after_flags = oldstuff->after_flags;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("AddModeLine - scrn: %d clock: %ld\n",
- (int)stuff->screen, (unsigned long)stuff->dotclock);
- ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
- stuff->hdisplay, stuff->hsyncstart,
- stuff->hsyncend, stuff->htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
- stuff->vtotal, (unsigned long)stuff->flags);
- ErrorF(" after - scrn: %d clock: %ld\n",
- (int)stuff->screen, (unsigned long)stuff->after_dotclock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- stuff->after_hdisplay, stuff->after_hsyncstart,
- stuff->after_hsyncend, stuff->after_htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->after_vdisplay, stuff->after_vsyncstart,
- stuff->after_vsyncend, stuff->after_vtotal,
- (unsigned long)stuff->after_flags);
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ stuff->after_dotclock = oldstuff->after_dotclock;
+ stuff->after_hdisplay = oldstuff->after_hdisplay;
+ stuff->after_hsyncstart = oldstuff->after_hsyncstart;
+ stuff->after_hsyncend = oldstuff->after_hsyncend;
+ stuff->after_htotal = oldstuff->after_htotal;
+ stuff->after_hskew = 0;
+ stuff->after_vdisplay = oldstuff->after_vdisplay;
+ stuff->after_vsyncstart = oldstuff->after_vsyncstart;
+ stuff->after_vsyncend = oldstuff->after_vsyncend;
+ stuff->after_vtotal = oldstuff->after_vtotal;
+ stuff->after_flags = oldstuff->after_flags;
+ } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("AddModeLine - scrn: %d clock: %ld\n",
+ (int) stuff->screen, (unsigned long) stuff->dotclock);
+ ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, (unsigned long) stuff->flags);
+ ErrorF(" after - scrn: %d clock: %ld\n",
+ (int) stuff->screen, (unsigned long) stuff->after_dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->after_hdisplay, stuff->after_hsyncstart,
+ stuff->after_hsyncend, stuff->after_htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->after_vdisplay, stuff->after_vsyncstart,
+ stuff->after_vsyncend, stuff->after_vtotal,
+ (unsigned long) stuff->after_flags);
}
if (ver < 2) {
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
- len = client->req_len - bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq));
- } else {
- REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
- len = client->req_len - bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq));
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq));
+ }
+ else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq));
}
if (len != stuff->privsize)
- return BadLength;
+ return BadLength;
+
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->hsyncstart < stuff->hdisplay ||
+ stuff->hsyncend < stuff->hsyncstart ||
+ stuff->htotal < stuff->hsyncend ||
+ stuff->vsyncstart < stuff->vdisplay ||
+ stuff->vsyncend < stuff->vsyncstart || stuff->vtotal < stuff->vsyncend)
return BadValue;
- if (stuff->hsyncstart < stuff->hdisplay ||
- stuff->hsyncend < stuff->hsyncstart ||
- stuff->htotal < stuff->hsyncend ||
- stuff->vsyncstart < stuff->vdisplay ||
- stuff->vsyncend < stuff->vsyncstart ||
- stuff->vtotal < stuff->vsyncend)
- return BadValue;
-
- if (stuff->after_hsyncstart < stuff->after_hdisplay ||
- stuff->after_hsyncend < stuff->after_hsyncstart ||
- stuff->after_htotal < stuff->after_hsyncend ||
- stuff->after_vsyncstart < stuff->after_vdisplay ||
- stuff->after_vsyncend < stuff->after_vsyncstart ||
- stuff->after_vtotal < stuff->after_vsyncend)
- return BadValue;
+ if (stuff->after_hsyncstart < stuff->after_hdisplay ||
+ stuff->after_hsyncend < stuff->after_hsyncstart ||
+ stuff->after_htotal < stuff->after_hsyncend ||
+ stuff->after_vsyncstart < stuff->after_vdisplay ||
+ stuff->after_vsyncend < stuff->after_vsyncstart ||
+ stuff->after_vtotal < stuff->after_vsyncend)
+ return BadValue;
if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) {
- Bool found = FALSE;
- if (VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) {
- do {
- if ((VidModeGetDotClock(stuff->screen, stuff->dotclock)
- == dotClock) && MODEMATCH(mode, stuff)) {
- found = TRUE;
- break;
- }
- } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
- }
- if (!found)
- return BadValue;
+ Bool found = FALSE;
+
+ if (VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) {
+ do {
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock)
+ == dotClock) && MODEMATCH(mode, stuff)) {
+ found = TRUE;
+ break;
+ }
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+ }
+ if (!found)
+ return BadValue;
}
-
mode = VidModeCreateMode();
if (mode == NULL)
- return BadValue;
+ return BadValue;
VidModeSetModeValue(mode, VIDMODE_CLOCK, stuff->dotclock);
VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
- VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
if (stuff->privsize)
- ErrorF("AddModeLine - Privates in request have been ignored\n");
+ ErrorF("AddModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
switch (VidModeCheckModeForMonitor(stuff->screen, mode)) {
- case MODE_OK:
- break;
- case MODE_HSYNC:
- case MODE_H_ILLEGAL:
- free(mode);
- return VidModeErrorBase + XF86VidModeBadHTimings;
- case MODE_VSYNC:
- case MODE_V_ILLEGAL:
- free(mode);
- return VidModeErrorBase + XF86VidModeBadVTimings;
- default:
- free(mode);
- return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ case MODE_OK:
+ break;
+ case MODE_HSYNC:
+ case MODE_H_ILLEGAL:
+ free(mode);
+ return VidModeErrorBase + XF86VidModeBadHTimings;
+ case MODE_VSYNC:
+ case MODE_V_ILLEGAL:
+ free(mode);
+ return VidModeErrorBase + XF86VidModeBadVTimings;
+ default:
+ free(mode);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
/* Check that the driver is happy with the mode */
if (VidModeCheckModeForDriver(stuff->screen, mode) != MODE_OK) {
- free(mode);
- return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ free(mode);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
VidModeSetCrtcForMode(stuff->screen, mode);
-
+
VidModeAddModeline(stuff->screen, mode);
-
+
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("AddModeLine - Succeeded\n");
+ ErrorF("AddModeLine - Succeeded\n");
return Success;
}
static int
-ProcXF86VidModeDeleteModeLine(ClientPtr client)
-{
+ ProcXF86VidModeDeleteModeLine(ClientPtr client) {
REQUEST(xXF86VidModeDeleteModeLineReq);
xXF86OldVidModeDeleteModeLineReq *oldstuff =
- (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
xXF86VidModeDeleteModeLineReq newstuff;
pointer mode;
int len, dotClock;
int ver;
- DEBUG_P("XF86VidModeDeleteModeline");
+ DEBUG_P("XF86VidModeDeleteModeline");
- ver = ClientMajorVersion(client);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- /* convert from old format */
- stuff = &newstuff;
- stuff->length = oldstuff->length;
- stuff->screen = oldstuff->screen;
- stuff->dotclock = oldstuff->dotclock;
- stuff->hdisplay = oldstuff->hdisplay;
- stuff->hsyncstart = oldstuff->hsyncstart;
- stuff->hsyncend = oldstuff->hsyncend;
- stuff->htotal = oldstuff->htotal;
- stuff->hskew = 0;
- stuff->vdisplay = oldstuff->vdisplay;
- stuff->vsyncstart = oldstuff->vsyncstart;
- stuff->vsyncend = oldstuff->vsyncend;
- stuff->vtotal = oldstuff->vtotal;
- stuff->flags = oldstuff->flags;
- stuff->privsize = oldstuff->privsize;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("DeleteModeLine - scrn: %d clock: %ld\n",
- (int)stuff->screen, (unsigned long)stuff->dotclock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- stuff->hdisplay, stuff->hsyncstart,
- stuff->hsyncend, stuff->htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
- stuff->vtotal, (unsigned long)stuff->flags);
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("DeleteModeLine - scrn: %d clock: %ld\n",
+ (int) stuff->screen, (unsigned long) stuff->dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF
+ (" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
+ (unsigned long) stuff->flags);
}
if (ver < 2) {
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
- len = client->req_len - bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq));
- } else {
- REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
- len = client->req_len - bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq));
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq));
+ }
+ else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq));
}
if (len != stuff->privsize) {
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("req_len = %ld, sizeof(Req) = %d, privsize = %ld, "
- "len = %d, length = %d\n",
- (unsigned long)client->req_len,
- (int)sizeof(xXF86VidModeDeleteModeLineReq)>>2,
- (unsigned long)stuff->privsize, len, stuff->length);
- }
- return BadLength;
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("req_len = %ld, sizeof(Req) = %d, privsize = %ld, "
+ "len = %d, length = %d\n",
+ (unsigned long) client->req_len,
+ (int) sizeof(xXF86VidModeDeleteModeLineReq) >> 2,
+ (unsigned long) stuff->privsize, len, stuff->length);
+ }
+ return BadLength;
}
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("Checking against clock: %d (%d)\n",
- VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
- VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
- VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF
+ (" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
}
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
- MODEMATCH(mode, stuff))
- return BadValue;
+ MODEMATCH(mode, stuff))
+ return BadValue;
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- do {
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("Checking against clock: %d (%d)\n",
- VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
- VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
- VidModeGetModeValue(mode, VIDMODE_FLAGS));
- }
- if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
- MODEMATCH(mode, stuff)) {
- VidModeDeleteModeline(stuff->screen, mode);
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("DeleteModeLine - Succeeded\n");
- return Success;
- }
+ return BadValue;
+
+ do {
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF
+ (" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff)) {
+ VidModeDeleteModeline(stuff->screen, mode);
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
+ ErrorF("DeleteModeLine - Succeeded\n");
+ return Success;
+ }
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
return BadValue;
}
static int
-ProcXF86VidModeModModeLine(ClientPtr client)
-{
+ ProcXF86VidModeModModeLine(ClientPtr client) {
REQUEST(xXF86VidModeModModeLineReq);
xXF86OldVidModeModModeLineReq *oldstuff =
- (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeModModeLineReq *) client->requestBuffer;
xXF86VidModeModModeLineReq newstuff;
pointer mode, modetmp;
int len, dotClock;
int ver;
- DEBUG_P("XF86VidModeModModeline");
-
- ver = ClientMajorVersion(client);
- if (ver < 2 ) {
- /* convert from old format */
- stuff = &newstuff;
- stuff->length = oldstuff->length;
- stuff->screen = oldstuff->screen;
- stuff->hdisplay = oldstuff->hdisplay;
- stuff->hsyncstart = oldstuff->hsyncstart;
- stuff->hsyncend = oldstuff->hsyncend;
- stuff->htotal = oldstuff->htotal;
- stuff->hskew = 0;
- stuff->vdisplay = oldstuff->vdisplay;
- stuff->vsyncstart = oldstuff->vsyncstart;
- stuff->vsyncend = oldstuff->vsyncend;
- stuff->vtotal = oldstuff->vtotal;
- stuff->flags = oldstuff->flags;
- stuff->privsize = oldstuff->privsize;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
- (int)stuff->screen, stuff->hdisplay, stuff->hsyncstart,
- stuff->hsyncend, stuff->htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
- stuff->vtotal, (unsigned long)stuff->flags);
+ DEBUG_P("XF86VidModeModModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ (int) stuff->screen, stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, (unsigned long) stuff->flags);
}
if (ver < 2) {
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
- len = client->req_len - bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq));
- } else {
- REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
- len = client->req_len - bytes_to_int32(sizeof(xXF86VidModeModModeLineReq));
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq));
+ }
+ else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xXF86VidModeModModeLineReq));
}
if (len != stuff->privsize)
- return BadLength;
+ return BadLength;
- if (stuff->hsyncstart < stuff->hdisplay ||
- stuff->hsyncend < stuff->hsyncstart ||
- stuff->htotal < stuff->hsyncend ||
- stuff->vsyncstart < stuff->vdisplay ||
- stuff->vsyncend < stuff->vsyncstart ||
- stuff->vtotal < stuff->vsyncend)
- return BadValue;
+ if (stuff->hsyncstart < stuff->hdisplay ||
+ stuff->hsyncend < stuff->hsyncstart ||
+ stuff->htotal < stuff->hsyncend ||
+ stuff->vsyncstart < stuff->vdisplay ||
+ stuff->vsyncend < stuff->vsyncstart || stuff->vtotal < stuff->vsyncend)
+ return BadValue;
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
modetmp = VidModeCreateMode();
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
- VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
if (stuff->privsize)
- ErrorF("ModModeLine - Privates in request have been ignored\n");
+ ErrorF("ModModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
switch (VidModeCheckModeForMonitor(stuff->screen, modetmp)) {
- case MODE_OK:
- break;
- case MODE_HSYNC:
- case MODE_H_ILLEGAL:
- free(modetmp);
- return VidModeErrorBase + XF86VidModeBadHTimings;
- case MODE_VSYNC:
- case MODE_V_ILLEGAL:
- free(modetmp);
- return VidModeErrorBase + XF86VidModeBadVTimings;
- default:
- free(modetmp);
- return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ case MODE_OK:
+ break;
+ case MODE_HSYNC:
+ case MODE_H_ILLEGAL:
+ free(modetmp);
+ return VidModeErrorBase + XF86VidModeBadHTimings;
+ case MODE_VSYNC:
+ case MODE_V_ILLEGAL:
+ free(modetmp);
+ return VidModeErrorBase + XF86VidModeBadVTimings;
+ default:
+ free(modetmp);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
/* Check that the driver is happy with the mode */
if (VidModeCheckModeForDriver(stuff->screen, modetmp) != MODE_OK) {
- free(modetmp);
- return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ free(modetmp);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
free(modetmp);
VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
- VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
@@ -903,337 +898,349 @@ ProcXF86VidModeModModeLine(ClientPtr client)
VidModeSwitchMode(stuff->screen, mode);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("ModModeLine - Succeeded\n");
+ ErrorF("ModModeLine - Succeeded\n");
return Success;
}
static int
-ProcXF86VidModeValidateModeLine(ClientPtr client)
-{
+ ProcXF86VidModeValidateModeLine(ClientPtr client) {
REQUEST(xXF86VidModeValidateModeLineReq);
xXF86OldVidModeValidateModeLineReq *oldstuff =
- (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
xXF86VidModeValidateModeLineReq newstuff;
xXF86VidModeValidateModeLineReply rep;
pointer mode, modetmp = NULL;
int len, status, dotClock;
int ver;
- DEBUG_P("XF86VidModeValidateModeline");
+ DEBUG_P("XF86VidModeValidateModeline");
- ver = ClientMajorVersion(client);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- /* convert from old format */
- stuff = &newstuff;
- stuff->length = oldstuff->length;
- stuff->screen = oldstuff->screen;
- stuff->dotclock = oldstuff->dotclock;
- stuff->hdisplay = oldstuff->hdisplay;
- stuff->hsyncstart = oldstuff->hsyncstart;
- stuff->hsyncend = oldstuff->hsyncend;
- stuff->htotal = oldstuff->htotal;
- stuff->hskew = 0;
- stuff->vdisplay = oldstuff->vdisplay;
- stuff->vsyncstart = oldstuff->vsyncstart;
- stuff->vsyncend = oldstuff->vsyncend;
- stuff->vtotal = oldstuff->vtotal;
- stuff->flags = oldstuff->flags;
- stuff->privsize = oldstuff->privsize;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("ValidateModeLine - scrn: %d clock: %ld\n",
- (int)stuff->screen, (unsigned long)stuff->dotclock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- stuff->hdisplay, stuff->hsyncstart,
- stuff->hsyncend, stuff->htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
- stuff->vtotal, (unsigned long)stuff->flags);
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("ValidateModeLine - scrn: %d clock: %ld\n",
+ (int) stuff->screen, (unsigned long) stuff->dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF
+ (" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
+ (unsigned long) stuff->flags);
}
if (ver < 2) {
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
- len = client->req_len -
- bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq));
- } else {
- REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
- len = client->req_len - bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq));
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
+ len = client->req_len -
+ bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq));
+ }
+ else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq));
}
if (len != stuff->privsize)
- return BadLength;
+ return BadLength;
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
status = MODE_OK;
- if (stuff->hsyncstart < stuff->hdisplay ||
- stuff->hsyncend < stuff->hsyncstart ||
- stuff->htotal < stuff->hsyncend ||
- stuff->vsyncstart < stuff->vdisplay ||
- stuff->vsyncend < stuff->vsyncstart ||
- stuff->vtotal < stuff->vsyncend)
- {
- status = MODE_BAD;
- goto status_reply;
+ if (stuff->hsyncstart < stuff->hdisplay ||
+ stuff->hsyncend < stuff->hsyncstart ||
+ stuff->htotal < stuff->hsyncend ||
+ stuff->vsyncstart < stuff->vdisplay ||
+ stuff->vsyncend < stuff->vsyncstart ||
+ stuff->vtotal < stuff->vsyncend) {
+ status = MODE_BAD;
+ goto status_reply;
}
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
modetmp = VidModeCreateMode();
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
- VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
if (stuff->privsize)
- ErrorF("ValidateModeLine - Privates in request have been ignored\n");
+ ErrorF("ValidateModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
- if ((status = VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
- goto status_reply;
+ if ((status =
+ VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
+ goto status_reply;
/* Check that the driver is happy with the mode */
status = VidModeCheckModeForDriver(stuff->screen, modetmp);
-status_reply:
+ status_reply:
free(modetmp);
rep.type = X_Reply;
rep.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply)
- - SIZEOF(xGenericReply));
+ - SIZEOF(xGenericReply));
rep.sequenceNumber = client->sequence;
rep.status = status;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.status);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.status);
}
- WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply),
+ (char *) &rep);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
+ ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
return Success;
}
static int
-ProcXF86VidModeSwitchMode(ClientPtr client)
-{
+ ProcXF86VidModeSwitchMode(ClientPtr client) {
REQUEST(xXF86VidModeSwitchModeReq);
DEBUG_P("XF86VidModeSwitchMode");
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- VidModeZoomViewport(stuff->screen, (short)stuff->zoom);
+ VidModeZoomViewport(stuff->screen, (short) stuff->zoom);
return Success;
-}
-
-static int
-ProcXF86VidModeSwitchToMode(ClientPtr client)
-{
+} static int
+ ProcXF86VidModeSwitchToMode(ClientPtr client) {
REQUEST(xXF86VidModeSwitchToModeReq);
xXF86OldVidModeSwitchToModeReq *oldstuff =
- (xXF86OldVidModeSwitchToModeReq *)client->requestBuffer;
+ (xXF86OldVidModeSwitchToModeReq *) client->requestBuffer;
xXF86VidModeSwitchToModeReq newstuff;
pointer mode;
int len, dotClock;
int ver;
- DEBUG_P("XF86VidModeSwitchToMode");
+ DEBUG_P("XF86VidModeSwitchToMode");
- ver = ClientMajorVersion(client);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- /* convert from old format */
- stuff = &newstuff;
- stuff->length = oldstuff->length;
- stuff->screen = oldstuff->screen;
- stuff->dotclock = oldstuff->dotclock;
- stuff->hdisplay = oldstuff->hdisplay;
- stuff->hsyncstart = oldstuff->hsyncstart;
- stuff->hsyncend = oldstuff->hsyncend;
- stuff->htotal = oldstuff->htotal;
- stuff->hskew = 0;
- stuff->vdisplay = oldstuff->vdisplay;
- stuff->vsyncstart = oldstuff->vsyncstart;
- stuff->vsyncend = oldstuff->vsyncend;
- stuff->vtotal = oldstuff->vtotal;
- stuff->flags = oldstuff->flags;
- stuff->privsize = oldstuff->privsize;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("SwitchToMode - scrn: %d clock: %ld\n",
- (int)stuff->screen, (unsigned long)stuff->dotclock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- stuff->hdisplay, stuff->hsyncstart,
- stuff->hsyncend, stuff->htotal);
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
- stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
- stuff->vtotal, (unsigned long)stuff->flags);
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("SwitchToMode - scrn: %d clock: %ld\n",
+ (int) stuff->screen, (unsigned long) stuff->dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF
+ (" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
+ (unsigned long) stuff->flags);
}
if (ver < 2) {
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
- len = client->req_len - bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq));
- } else {
- REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
- len = client->req_len - bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq));
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq));
+ }
+ else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq));
}
if (len != stuff->privsize)
- return BadLength;
+ return BadLength;
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock)
- && MODEMATCH(mode, stuff))
- return Success;
+ && MODEMATCH(mode, stuff))
+ return Success;
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
do {
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- ErrorF("Checking against clock: %d (%d)\n",
- VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
- ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
- VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
- ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
- VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
- VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
- VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
- VidModeGetModeValue(mode, VIDMODE_FLAGS));
- }
- if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
- MODEMATCH(mode, stuff)) {
-
- if (!VidModeSwitchMode(stuff->screen, mode))
- return BadValue;
-
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("SwitchToMode - Succeeded\n");
- return Success;
- }
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF
+ (" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff)) {
+
+ if (!VidModeSwitchMode(stuff->screen, mode))
+ return BadValue;
+
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
+ ErrorF("SwitchToMode - Succeeded\n");
+ return Success;
+ }
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
return BadValue;
}
static int
-ProcXF86VidModeLockModeSwitch(ClientPtr client)
-{
+ ProcXF86VidModeLockModeSwitch(ClientPtr client) {
REQUEST(xXF86VidModeLockModeSwitchReq);
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
DEBUG_P("XF86VidModeLockModeSwitch");
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if (!VidModeLockZoom(stuff->screen, (short)stuff->lock))
- return VidModeErrorBase + XF86VidModeZoomLocked;
+ if (!VidModeLockZoom(stuff->screen, (short) stuff->lock))
+ return VidModeErrorBase + XF86VidModeZoomLocked;
return Success;
-}
-
-static int
-ProcXF86VidModeGetMonitor(ClientPtr client)
-{
+} static int
+ ProcXF86VidModeGetMonitor(ClientPtr client) {
REQUEST(xXF86VidModeGetMonitorReq);
xXF86VidModeGetMonitorReply rep;
CARD32 *hsyncdata, *vsyncdata;
int i, nHsync, nVrefresh;
pointer monitor;
-
- DEBUG_P("XF86VidModeGetMonitor");
- REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
+ DEBUG_P("XF86VidModeGetMonitor");
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
+
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
if (!VidModeGetMonitor(stuff->screen, &monitor))
- return BadValue;
+ return BadValue;
- nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
- nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
-
- rep.type = X_Reply;
- if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
- rep.vendorLength = strlen((char *)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_VENDOR, 0)).ptr);
+ nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
+ nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
+
+ rep.type = X_Reply;
+ if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
+ rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VENDOR,
+ 0)).ptr);
else
- rep.vendorLength = 0;
- if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr)
- rep.modelLength = strlen((char *)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_MODEL, 0)).ptr);
+ rep.vendorLength = 0;
+ if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr)
+ rep.modelLength = strlen((char *) (VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_MODEL,
+ 0)).ptr);
else
- rep.modelLength = 0;
- rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetMonitorReply) - SIZEOF(xGenericReply) +
- (nHsync + nVrefresh) * sizeof(CARD32) +
- pad_to_int32(rep.vendorLength) +
- pad_to_int32(rep.modelLength));
- rep.sequenceNumber = client->sequence;
- rep.nhsync = nHsync;
- rep.nvsync = nVrefresh;
- hsyncdata = malloc(nHsync * sizeof(CARD32));
+ rep.modelLength = 0;
+ rep.length =
+ bytes_to_int32(SIZEOF(xXF86VidModeGetMonitorReply) -
+ SIZEOF(xGenericReply) + (nHsync +
+ nVrefresh) * sizeof(CARD32) +
+ pad_to_int32(rep.vendorLength) +
+ pad_to_int32(rep.modelLength));
+ rep.sequenceNumber = client->sequence;
+ rep.nhsync = nHsync;
+ rep.nvsync = nVrefresh;
+ hsyncdata = malloc(nHsync * sizeof(CARD32));
if (!hsyncdata) {
- return BadAlloc;
- }
+ return BadAlloc;
+ } vsyncdata = malloc(nVrefresh * sizeof(CARD32));
- vsyncdata = malloc(nVrefresh * sizeof(CARD32));
if (!vsyncdata) {
- free(hsyncdata);
- return BadAlloc;
+ free(hsyncdata);
+ return BadAlloc;
}
for (i = 0; i < nHsync; i++) {
- hsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_HSYNC_LO, i)).f |
- (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_HSYNC_HI, i)).f << 16;
+ hsyncdata[i] = (unsigned short) (VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_HSYNC_LO,
+ i)).
+ f | (unsigned
+ short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_HSYNC_HI,
+ i)).f << 16;
}
for (i = 0; i < nVrefresh; i++) {
- vsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_VREFRESH_LO, i)).f |
- (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_VREFRESH_HI, i)).f << 16;
+ vsyncdata[i] = (unsigned short) (VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VREFRESH_LO,
+ i)).
+ f | (unsigned
+ short) (VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VREFRESH_HI,
+ i)).f << 16;
}
-
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
- WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *) &rep);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, nHsync * sizeof(CARD32),
- hsyncdata);
- WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32),
- vsyncdata);
+ WriteSwappedDataToClient(client, nHsync * sizeof(CARD32), hsyncdata);
+ WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32), vsyncdata);
if (rep.vendorLength)
- WriteToClient(client, rep.vendorLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr);
+ WriteToClient(client, rep.vendorLength,
+ (char
+ *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR,
+ 0)).ptr);
if (rep.modelLength)
- WriteToClient(client, rep.modelLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr);
+ WriteToClient(client, rep.modelLength,
+ (char
+ *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL,
+ 0)).ptr);
free(hsyncdata);
free(vsyncdata);
@@ -1242,113 +1249,106 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
}
static int
-ProcXF86VidModeGetViewPort(ClientPtr client)
-{
+ ProcXF86VidModeGetViewPort(ClientPtr client) {
REQUEST(xXF86VidModeGetViewPortReq);
xXF86VidModeGetViewPortReply rep;
int x, y;
- DEBUG_P("XF86VidModeGetViewPort");
+ DEBUG_P("XF86VidModeGetViewPort");
- REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
- VidModeGetViewPort(stuff->screen, &x, &y);
- rep.x = x;
- rep.y = y;
+ VidModeGetViewPort(stuff->screen, &x, &y);
+ rep.x = x;
+ rep.y = y;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.x);
- swapl(&rep.y);
- }
- WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *)&rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.x);
+ swapl(&rep.y);
+ } WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply),
+ (char *) &rep);
return Success;
}
static int
-ProcXF86VidModeSetViewPort(ClientPtr client)
-{
+ ProcXF86VidModeSetViewPort(ClientPtr client) {
REQUEST(xXF86VidModeSetViewPortReq);
DEBUG_P("XF86VidModeSetViewPort");
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeSetViewPort(stuff->screen, stuff->x, stuff->y))
- return BadValue;
+ return BadValue;
return Success;
-}
-
-static int
-ProcXF86VidModeGetDotClocks(ClientPtr client)
-{
+} static int
+ ProcXF86VidModeGetDotClocks(ClientPtr client) {
REQUEST(xXF86VidModeGetDotClocksReq);
xXF86VidModeGetDotClocksReply rep;
- int n;
+ int n;
int numClocks;
CARD32 dotclock;
int *Clocks = NULL;
Bool ClockProg;
- DEBUG_P("XF86VidModeGetDotClocks");
+ DEBUG_P("XF86VidModeGetDotClocks");
- REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
+ numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
- rep.type = X_Reply;
- rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
- - SIZEOF(xGenericReply) + numClocks);
- rep.sequenceNumber = client->sequence;
- rep.clocks = numClocks;
- rep.maxclocks = MAXCLOCKS;
- rep.flags = 0;
+ rep.type = X_Reply;
+ rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
+ - SIZEOF(xGenericReply) + numClocks);
+ rep.sequenceNumber = client->sequence;
+ rep.clocks = numClocks;
+ rep.maxclocks = MAXCLOCKS;
+ rep.flags = 0;
if (!ClockProg) {
- Clocks = malloc(numClocks * sizeof(int));
- if (!Clocks)
- return BadValue;
- if (!VidModeGetClocks(stuff->screen, Clocks)) {
- free(Clocks);
- return BadValue;
- }
- }
-
- if (ClockProg) {
- rep.flags |= CLKFLAG_PROGRAMABLE;
+ Clocks = malloc(numClocks * sizeof(int));
+ if (!Clocks)
+ return BadValue;
+ if (!VidModeGetClocks(stuff->screen, Clocks)) {
+ free(Clocks);
+ return BadValue;
+ }} if (ClockProg) {
+ rep.flags |= CLKFLAG_PROGRAMABLE;
}
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.clocks);
- swapl(&rep.maxclocks);
- swapl(&rep.flags);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.clocks);
+ swapl(&rep.maxclocks);
+ swapl(&rep.flags);
}
- WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *) &rep);
if (!ClockProg) {
- for (n = 0; n < numClocks; n++) {
- dotclock = *Clocks++;
- if (client->swapped) {
- WriteSwappedDataToClient(client, 4, (char *)&dotclock);
- } else {
- WriteToClient(client, 4, (char *)&dotclock);
- }
- }
+ for (n = 0; n < numClocks; n++) {
+ dotclock = *Clocks++;
+ if (client->swapped) {
+ WriteSwappedDataToClient(client, 4, (char *) &dotclock);
+ }
+ else {
+ WriteToClient(client, 4, (char *) &dotclock);
+ }
+ }
}
free(Clocks);
@@ -1356,534 +1356,486 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
}
static int
-ProcXF86VidModeSetGamma(ClientPtr client)
-{
+ ProcXF86VidModeSetGamma(ClientPtr client) {
REQUEST(xXF86VidModeSetGammaReq);
DEBUG_P("XF86VidModeSetGamma");
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if (!VidModeSetGamma(stuff->screen, ((float)stuff->red)/10000.,
- ((float)stuff->green)/10000., ((float)stuff->blue)/10000.))
- return BadValue;
+ if (!VidModeSetGamma(stuff->screen, ((float) stuff->red) / 10000.,
+ ((float) stuff->green) / 10000.,
+ ((float) stuff->blue) / 10000.))
+ return BadValue;
return Success;
-}
-
-static int
-ProcXF86VidModeGetGamma(ClientPtr client)
-{
+} static int
+ ProcXF86VidModeGetGamma(ClientPtr client) {
REQUEST(xXF86VidModeGetGammaReq);
xXF86VidModeGetGammaReply rep;
float red, green, blue;
- DEBUG_P("XF86VidModeGetGamma");
+ DEBUG_P("XF86VidModeGetGamma");
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
- return BadValue;
- rep.red = (CARD32)(red * 10000.);
- rep.green = (CARD32)(green * 10000.);
- rep.blue = (CARD32)(blue * 10000.);
+ return BadValue;
+ rep.red = (CARD32) (red * 10000.);
+ rep.green = (CARD32) (green * 10000.);
+ rep.blue = (CARD32) (blue * 10000.);
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.red);
- swapl(&rep.green);
- swapl(&rep.blue);
- }
- WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *)&rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.red);
+ swapl(&rep.green);
+ swapl(&rep.blue);
+ } WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *) &rep);
+
return Success;
}
static int
-ProcXF86VidModeSetGammaRamp(ClientPtr client)
-{
+ ProcXF86VidModeSetGammaRamp(ClientPtr client) {
CARD16 *r, *g, *b;
int length;
- REQUEST(xXF86VidModeSetGammaRampReq);
+ REQUEST(xXF86VidModeSetGammaRampReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
- return BadValue;
+ if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
+ return BadValue;
- length = (stuff->size + 1) & ~1;
+ length = (stuff->size + 1) & ~1;
- REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
+ REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
- r = (CARD16*)&stuff[1];
- g = r + length;
- b = g + length;
+ r = (CARD16 *) &stuff[1];
+ g = r + length;
+ b = g + length;
if (!VidModeSetGammaRamp(stuff->screen, stuff->size, r, g, b))
- return BadValue;
-
- return Success;
-}
+ return BadValue;
-static int
-ProcXF86VidModeGetGammaRamp(ClientPtr client)
-{
+ return Success;
+} static int
+ ProcXF86VidModeGetGammaRamp(ClientPtr client) {
CARD16 *ramp = NULL;
int length;
size_t ramplen = 0;
xXF86VidModeGetGammaRampReply rep;
- REQUEST(xXF86VidModeGetGammaRampReq);
+ REQUEST(xXF86VidModeGetGammaRampReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
- return BadValue;
+ if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
+ return BadValue;
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
- length = (stuff->size + 1) & ~1;
+ length = (stuff->size + 1) & ~1;
- if(stuff->size) {
- ramplen = length * 3 * sizeof(CARD16);
- if (!(ramp = malloc(ramplen)))
- return BadAlloc;
-
- if (!VidModeGetGammaRamp(stuff->screen, stuff->size,
- ramp, ramp + length, ramp + (length * 2))) {
- free(ramp);
- return BadValue;
- }
- }
+ if (stuff->size) {
+ ramplen = length * 3 * sizeof(CARD16);
+ if (!(ramp = malloc(ramplen)))
+ return BadAlloc;
- rep.type = X_Reply;
+ if (!VidModeGetGammaRamp(stuff->screen, stuff->size,
+ ramp, ramp + length, ramp + (length * 2))) {
+ free(ramp);
+ return BadValue;
+ }} rep.type = X_Reply;
rep.length = (length >> 1) * 3;
rep.sequenceNumber = client->sequence;
rep.size = stuff->size;
- if(client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.size);
- SwapShorts((short*)ramp, length * 3);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.size);
+ SwapShorts((short *) ramp, length * 3);
}
- WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *) &rep);
- if(stuff->size) {
- WriteToClient(client, ramplen, (char*)ramp);
+ if (stuff->size) {
+ WriteToClient(client, ramplen, (char *) ramp);
free(ramp);
}
return Success;
}
-
static int
-ProcXF86VidModeGetGammaRampSize(ClientPtr client)
-{
+ ProcXF86VidModeGetGammaRampSize(ClientPtr client) {
xXF86VidModeGetGammaRampSizeReply rep;
- REQUEST(xXF86VidModeGetGammaRampSizeReq);
+ REQUEST(xXF86VidModeGetGammaRampSizeReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.size = VidModeGetGammaRampSize(stuff->screen);
- if(client->swapped) {
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.size = VidModeGetGammaRampSize(stuff->screen);
+ if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.size);
- }
- WriteToClient(client,sizeof(xXF86VidModeGetGammaRampSizeReply),(char*)&rep);
+ } WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply),
+ (char *) &rep);
return Success;
}
static int
-ProcXF86VidModeGetPermissions(ClientPtr client)
-{
+ ProcXF86VidModeGetPermissions(ClientPtr client) {
xXF86VidModeGetPermissionsReply rep;
- REQUEST(xXF86VidModeGetPermissionsReq);
+ REQUEST(xXF86VidModeGetPermissionsReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.permissions = XF86VM_READ_PERMISSION;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.permissions = XF86VM_READ_PERMISSION;
if (xf86GetVidModeEnabled() &&
- (xf86GetVidModeAllowNonLocal() || LocalClient (client))) {
- rep.permissions |= XF86VM_WRITE_PERMISSION;
- }
- if(client->swapped) {
+ (xf86GetVidModeAllowNonLocal() || LocalClient(client))) {
+ rep.permissions |= XF86VM_WRITE_PERMISSION;
+ } if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.permissions);
}
- WriteToClient(client,sizeof(xXF86VidModeGetPermissionsReply),(char*)&rep);
+ WriteToClient(client, sizeof(xXF86VidModeGetPermissionsReply),
+ (char *) &rep);
return Success;
}
-
static int
-ProcXF86VidModeSetClientVersion(ClientPtr client)
-{
+ ProcXF86VidModeSetClientVersion(ClientPtr client) {
REQUEST(xXF86VidModeSetClientVersionReq);
VidModePrivPtr pPriv;
- DEBUG_P("XF86VidModeSetClientVersion");
+ DEBUG_P("XF86VidModeSetClientVersion");
- REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
if ((pPriv = VM_GETPRIV(client)) == NULL) {
- pPriv = malloc(sizeof(VidModePrivRec));
- if (!pPriv)
- return BadAlloc;
- VM_SETPRIV(client, pPriv);
- }
- pPriv->major = stuff->major;
+ pPriv = malloc(sizeof(VidModePrivRec));
+ if (!pPriv)
+ return BadAlloc;
+ VM_SETPRIV(client, pPriv);
+ } pPriv->major = stuff->major;
+
pPriv->minor = stuff->minor;
-
+
return Success;
}
static int
-ProcXF86VidModeDispatch(ClientPtr client)
-{
+ ProcXF86VidModeDispatch(ClientPtr client) {
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_XF86VidModeQueryVersion:
- return ProcXF86VidModeQueryVersion(client);
- case X_XF86VidModeGetModeLine:
- return ProcXF86VidModeGetModeLine(client);
- case X_XF86VidModeGetMonitor:
- return ProcXF86VidModeGetMonitor(client);
- case X_XF86VidModeGetAllModeLines:
- return ProcXF86VidModeGetAllModeLines(client);
- case X_XF86VidModeValidateModeLine:
- return ProcXF86VidModeValidateModeLine(client);
- case X_XF86VidModeGetViewPort:
- return ProcXF86VidModeGetViewPort(client);
- case X_XF86VidModeGetDotClocks:
- return ProcXF86VidModeGetDotClocks(client);
- case X_XF86VidModeSetClientVersion:
- return ProcXF86VidModeSetClientVersion(client);
- case X_XF86VidModeGetGamma:
- return ProcXF86VidModeGetGamma(client);
- case X_XF86VidModeGetGammaRamp:
- return ProcXF86VidModeGetGammaRamp(client);
- case X_XF86VidModeGetGammaRampSize:
- return ProcXF86VidModeGetGammaRampSize(client);
- case X_XF86VidModeGetPermissions:
- return ProcXF86VidModeGetPermissions(client);
- default:
- if (!xf86GetVidModeEnabled())
- return VidModeErrorBase + XF86VidModeExtensionDisabled;
- if (xf86GetVidModeAllowNonLocal() || LocalClient (client)) {
- switch (stuff->data) {
- case X_XF86VidModeAddModeLine:
- return ProcXF86VidModeAddModeLine(client);
- case X_XF86VidModeDeleteModeLine:
- return ProcXF86VidModeDeleteModeLine(client);
- case X_XF86VidModeModModeLine:
- return ProcXF86VidModeModModeLine(client);
- case X_XF86VidModeSwitchMode:
- return ProcXF86VidModeSwitchMode(client);
- case X_XF86VidModeSwitchToMode:
- return ProcXF86VidModeSwitchToMode(client);
- case X_XF86VidModeLockModeSwitch:
- return ProcXF86VidModeLockModeSwitch(client);
- case X_XF86VidModeSetViewPort:
- return ProcXF86VidModeSetViewPort(client);
- case X_XF86VidModeSetGamma:
- return ProcXF86VidModeSetGamma(client);
- case X_XF86VidModeSetGammaRamp:
- return ProcXF86VidModeSetGammaRamp(client);
- default:
- return BadRequest;
- }
- } else
- return VidModeErrorBase + XF86VidModeClientNotLocal;
+ return ProcXF86VidModeQueryVersion(client);
+ case X_XF86VidModeGetModeLine:return ProcXF86VidModeGetModeLine(client);
+ case X_XF86VidModeGetMonitor:return ProcXF86VidModeGetMonitor(client);
+ case X_XF86VidModeGetAllModeLines:return
+ ProcXF86VidModeGetAllModeLines(client);
+ case X_XF86VidModeValidateModeLine:return
+ ProcXF86VidModeValidateModeLine(client);
+ case X_XF86VidModeGetViewPort:return ProcXF86VidModeGetViewPort(client);
+ case X_XF86VidModeGetDotClocks:return
+ ProcXF86VidModeGetDotClocks(client);
+ case X_XF86VidModeSetClientVersion:return
+ ProcXF86VidModeSetClientVersion(client);
+ case X_XF86VidModeGetGamma:return ProcXF86VidModeGetGamma(client);
+ case X_XF86VidModeGetGammaRamp:return
+ ProcXF86VidModeGetGammaRamp(client);
+ case X_XF86VidModeGetGammaRampSize:return
+ ProcXF86VidModeGetGammaRampSize(client);
+ case X_XF86VidModeGetPermissions:return
+ ProcXF86VidModeGetPermissions(client);
+ default:if (!xf86GetVidModeEnabled())
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+ switch (stuff->data) {
+ case X_XF86VidModeAddModeLine:
+ return ProcXF86VidModeAddModeLine(client);
+ case X_XF86VidModeDeleteModeLine:return
+ ProcXF86VidModeDeleteModeLine(client);
+ case X_XF86VidModeModModeLine:return
+ ProcXF86VidModeModModeLine(client);
+ case X_XF86VidModeSwitchMode:return
+ ProcXF86VidModeSwitchMode(client);
+ case X_XF86VidModeSwitchToMode:return
+ ProcXF86VidModeSwitchToMode(client);
+ case X_XF86VidModeLockModeSwitch:return
+ ProcXF86VidModeLockModeSwitch(client);
+ case X_XF86VidModeSetViewPort:return
+ ProcXF86VidModeSetViewPort(client);
+ case X_XF86VidModeSetGamma:return
+ ProcXF86VidModeSetGamma(client);
+ case X_XF86VidModeSetGammaRamp:return
+ ProcXF86VidModeSetGammaRamp(client);
+ default:return BadRequest;
+ }}
+ else
+ return VidModeErrorBase + XF86VidModeClientNotLocal;
}
}
static int
-SProcXF86VidModeQueryVersion(ClientPtr client)
-{
+ SProcXF86VidModeQueryVersion(ClientPtr client) {
REQUEST(xXF86VidModeQueryVersionReq);
swaps(&stuff->length);
return ProcXF86VidModeQueryVersion(client);
-}
-
-static int
-SProcXF86VidModeGetModeLine(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetModeLine(ClientPtr client) {
REQUEST(xXF86VidModeGetModeLineReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetModeLine(client);
-}
-
-static int
-SProcXF86VidModeGetAllModeLines(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetAllModeLines(ClientPtr client) {
REQUEST(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetAllModeLines(client);
-}
-
-static int
-SProcXF86VidModeAddModeLine(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeAddModeLine(ClientPtr client) {
xXF86OldVidModeAddModeLineReq *oldstuff =
- (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
int ver;
-
- REQUEST(xXF86VidModeAddModeLineReq);
- ver = ClientMajorVersion(client);
+
+ REQUEST(xXF86VidModeAddModeLineReq);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- swaps(&oldstuff->length);
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
- swapl(&oldstuff->screen);
- swaps(&oldstuff->hdisplay);
- swaps(&oldstuff->hsyncstart);
- swaps(&oldstuff->hsyncend);
- swaps(&oldstuff->htotal);
- swaps(&oldstuff->vdisplay);
- swaps(&oldstuff->vsyncstart);
- swaps(&oldstuff->vsyncend);
- swaps(&oldstuff->vtotal);
- swapl(&oldstuff->flags);
- swapl(&oldstuff->privsize);
- SwapRestL(oldstuff);
- } else {
- swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
- swapl(&stuff->screen);
- swaps(&stuff->hdisplay);
- swaps(&stuff->hsyncstart);
- swaps(&stuff->hsyncend);
- swaps(&stuff->htotal);
- swaps(&stuff->hskew);
- swaps(&stuff->vdisplay);
- swaps(&stuff->vsyncstart);
- swaps(&stuff->vsyncend);
- swaps(&stuff->vtotal);
- swapl(&stuff->flags);
- swapl(&stuff->privsize);
- SwapRestL(stuff);
+ swaps(&oldstuff->length);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
+ swapl(&oldstuff->screen);
+ swaps(&oldstuff->hdisplay);
+ swaps(&oldstuff->hsyncstart);
+ swaps(&oldstuff->hsyncend);
+ swaps(&oldstuff->htotal);
+ swaps(&oldstuff->vdisplay);
+ swaps(&oldstuff->vsyncstart);
+ swaps(&oldstuff->vsyncend);
+ swaps(&oldstuff->vtotal);
+ swapl(&oldstuff->flags);
+ swapl(&oldstuff->privsize);
+ SwapRestL(oldstuff);
+ }
+ else {
+ swaps(&stuff->length);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
+ swapl(&stuff->screen);
+ swaps(&stuff->hdisplay);
+ swaps(&stuff->hsyncstart);
+ swaps(&stuff->hsyncend);
+ swaps(&stuff->htotal);
+ swaps(&stuff->hskew);
+ swaps(&stuff->vdisplay);
+ swaps(&stuff->vsyncstart);
+ swaps(&stuff->vsyncend);
+ swaps(&stuff->vtotal);
+ swapl(&stuff->flags);
+ swapl(&stuff->privsize);
+ SwapRestL(stuff);
}
return ProcXF86VidModeAddModeLine(client);
}
static int
-SProcXF86VidModeDeleteModeLine(ClientPtr client)
-{
+ SProcXF86VidModeDeleteModeLine(ClientPtr client) {
xXF86OldVidModeDeleteModeLineReq *oldstuff =
- (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
int ver;
- REQUEST(xXF86VidModeDeleteModeLineReq);
- ver = ClientMajorVersion(client);
+ REQUEST(xXF86VidModeDeleteModeLineReq);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- swaps(&oldstuff->length);
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
- swapl(&oldstuff->screen);
- swaps(&oldstuff->hdisplay);
- swaps(&oldstuff->hsyncstart);
- swaps(&oldstuff->hsyncend);
- swaps(&oldstuff->htotal);
- swaps(&oldstuff->vdisplay);
- swaps(&oldstuff->vsyncstart);
- swaps(&oldstuff->vsyncend);
- swaps(&oldstuff->vtotal);
- swapl(&oldstuff->flags);
- swapl(&oldstuff->privsize);
- SwapRestL(oldstuff);
- } else {
- swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
- swapl(&stuff->screen);
- swaps(&stuff->hdisplay);
- swaps(&stuff->hsyncstart);
- swaps(&stuff->hsyncend);
- swaps(&stuff->htotal);
- swaps(&stuff->hskew);
- swaps(&stuff->vdisplay);
- swaps(&stuff->vsyncstart);
- swaps(&stuff->vsyncend);
- swaps(&stuff->vtotal);
- swapl(&stuff->flags);
- swapl(&stuff->privsize);
- SwapRestL(stuff);
+ swaps(&oldstuff->length);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
+ swapl(&oldstuff->screen);
+ swaps(&oldstuff->hdisplay);
+ swaps(&oldstuff->hsyncstart);
+ swaps(&oldstuff->hsyncend);
+ swaps(&oldstuff->htotal);
+ swaps(&oldstuff->vdisplay);
+ swaps(&oldstuff->vsyncstart);
+ swaps(&oldstuff->vsyncend);
+ swaps(&oldstuff->vtotal);
+ swapl(&oldstuff->flags);
+ swapl(&oldstuff->privsize);
+ SwapRestL(oldstuff);
+ }
+ else {
+ swaps(&stuff->length);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
+ swapl(&stuff->screen);
+ swaps(&stuff->hdisplay);
+ swaps(&stuff->hsyncstart);
+ swaps(&stuff->hsyncend);
+ swaps(&stuff->htotal);
+ swaps(&stuff->hskew);
+ swaps(&stuff->vdisplay);
+ swaps(&stuff->vsyncstart);
+ swaps(&stuff->vsyncend);
+ swaps(&stuff->vtotal);
+ swapl(&stuff->flags);
+ swapl(&stuff->privsize);
+ SwapRestL(stuff);
}
return ProcXF86VidModeDeleteModeLine(client);
}
static int
-SProcXF86VidModeModModeLine(ClientPtr client)
-{
+ SProcXF86VidModeModModeLine(ClientPtr client) {
xXF86OldVidModeModModeLineReq *oldstuff =
- (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeModModeLineReq *) client->requestBuffer;
int ver;
- REQUEST(xXF86VidModeModModeLineReq);
- ver = ClientMajorVersion(client);
+ REQUEST(xXF86VidModeModModeLineReq);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- swaps(&oldstuff->length);
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
- swapl(&oldstuff->screen);
- swaps(&oldstuff->hdisplay);
- swaps(&oldstuff->hsyncstart);
- swaps(&oldstuff->hsyncend);
- swaps(&oldstuff->htotal);
- swaps(&oldstuff->vdisplay);
- swaps(&oldstuff->vsyncstart);
- swaps(&oldstuff->vsyncend);
- swaps(&oldstuff->vtotal);
- swapl(&oldstuff->flags);
- swapl(&oldstuff->privsize);
- SwapRestL(oldstuff);
- } else {
- swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
- swapl(&stuff->screen);
- swaps(&stuff->hdisplay);
- swaps(&stuff->hsyncstart);
- swaps(&stuff->hsyncend);
- swaps(&stuff->htotal);
- swaps(&stuff->hskew);
- swaps(&stuff->vdisplay);
- swaps(&stuff->vsyncstart);
- swaps(&stuff->vsyncend);
- swaps(&stuff->vtotal);
- swapl(&stuff->flags);
- swapl(&stuff->privsize);
- SwapRestL(stuff);
+ swaps(&oldstuff->length);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
+ swapl(&oldstuff->screen);
+ swaps(&oldstuff->hdisplay);
+ swaps(&oldstuff->hsyncstart);
+ swaps(&oldstuff->hsyncend);
+ swaps(&oldstuff->htotal);
+ swaps(&oldstuff->vdisplay);
+ swaps(&oldstuff->vsyncstart);
+ swaps(&oldstuff->vsyncend);
+ swaps(&oldstuff->vtotal);
+ swapl(&oldstuff->flags);
+ swapl(&oldstuff->privsize);
+ SwapRestL(oldstuff);
+ }
+ else {
+ swaps(&stuff->length);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
+ swapl(&stuff->screen);
+ swaps(&stuff->hdisplay);
+ swaps(&stuff->hsyncstart);
+ swaps(&stuff->hsyncend);
+ swaps(&stuff->htotal);
+ swaps(&stuff->hskew);
+ swaps(&stuff->vdisplay);
+ swaps(&stuff->vsyncstart);
+ swaps(&stuff->vsyncend);
+ swaps(&stuff->vtotal);
+ swapl(&stuff->flags);
+ swapl(&stuff->privsize);
+ SwapRestL(stuff);
}
return ProcXF86VidModeModModeLine(client);
}
static int
-SProcXF86VidModeValidateModeLine(ClientPtr client)
-{
+ SProcXF86VidModeValidateModeLine(ClientPtr client) {
xXF86OldVidModeValidateModeLineReq *oldstuff =
- (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
int ver;
- REQUEST(xXF86VidModeValidateModeLineReq);
- ver = ClientMajorVersion(client);
+ REQUEST(xXF86VidModeValidateModeLineReq);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- swaps(&oldstuff->length);
- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
- swapl(&oldstuff->screen);
- swaps(&oldstuff->hdisplay);
- swaps(&oldstuff->hsyncstart);
- swaps(&oldstuff->hsyncend);
- swaps(&oldstuff->htotal);
- swaps(&oldstuff->vdisplay);
- swaps(&oldstuff->vsyncstart);
- swaps(&oldstuff->vsyncend);
- swaps(&oldstuff->vtotal);
- swapl(&oldstuff->flags);
- swapl(&oldstuff->privsize);
- SwapRestL(oldstuff);
- } else {
- swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
- swapl(&stuff->screen);
- swaps(&stuff->hdisplay);
- swaps(&stuff->hsyncstart);
- swaps(&stuff->hsyncend);
- swaps(&stuff->htotal);
- swaps(&stuff->hskew);
- swaps(&stuff->vdisplay);
- swaps(&stuff->vsyncstart);
- swaps(&stuff->vsyncend);
- swaps(&stuff->vtotal);
- swapl(&stuff->flags);
- swapl(&stuff->privsize);
- SwapRestL(stuff);
+ swaps(&oldstuff->length);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
+ swapl(&oldstuff->screen);
+ swaps(&oldstuff->hdisplay);
+ swaps(&oldstuff->hsyncstart);
+ swaps(&oldstuff->hsyncend);
+ swaps(&oldstuff->htotal);
+ swaps(&oldstuff->vdisplay);
+ swaps(&oldstuff->vsyncstart);
+ swaps(&oldstuff->vsyncend);
+ swaps(&oldstuff->vtotal);
+ swapl(&oldstuff->flags);
+ swapl(&oldstuff->privsize);
+ SwapRestL(oldstuff);
+ }
+ else {
+ swaps(&stuff->length);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
+ swapl(&stuff->screen);
+ swaps(&stuff->hdisplay);
+ swaps(&stuff->hsyncstart);
+ swaps(&stuff->hsyncend);
+ swaps(&stuff->htotal);
+ swaps(&stuff->hskew);
+ swaps(&stuff->vdisplay);
+ swaps(&stuff->vsyncstart);
+ swaps(&stuff->vsyncend);
+ swaps(&stuff->vtotal);
+ swapl(&stuff->flags);
+ swapl(&stuff->privsize);
+ SwapRestL(stuff);
}
return ProcXF86VidModeValidateModeLine(client);
}
static int
-SProcXF86VidModeSwitchMode(ClientPtr client)
-{
+ SProcXF86VidModeSwitchMode(ClientPtr client) {
REQUEST(xXF86VidModeSwitchModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
swaps(&stuff->screen);
swaps(&stuff->zoom);
return ProcXF86VidModeSwitchMode(client);
-}
-
-static int
-SProcXF86VidModeSwitchToMode(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeSwitchToMode(ClientPtr client) {
REQUEST(xXF86VidModeSwitchToModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
swapl(&stuff->screen);
return ProcXF86VidModeSwitchToMode(client);
-}
-
-static int
-SProcXF86VidModeLockModeSwitch(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeLockModeSwitch(ClientPtr client) {
REQUEST(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->screen);
swaps(&stuff->lock);
return ProcXF86VidModeLockModeSwitch(client);
-}
-
-static int
-SProcXF86VidModeGetMonitor(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetMonitor(ClientPtr client) {
REQUEST(xXF86VidModeGetMonitorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetMonitor(client);
-}
-
-static int
-SProcXF86VidModeGetViewPort(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetViewPort(ClientPtr client) {
REQUEST(xXF86VidModeGetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetViewPort(client);
-}
-
-static int
-SProcXF86VidModeSetViewPort(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeSetViewPort(ClientPtr client) {
REQUEST(xXF86VidModeSetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
@@ -1891,32 +1843,23 @@ SProcXF86VidModeSetViewPort(ClientPtr client)
swapl(&stuff->x);
swapl(&stuff->y);
return ProcXF86VidModeSetViewPort(client);
-}
-
-static int
-SProcXF86VidModeGetDotClocks(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetDotClocks(ClientPtr client) {
REQUEST(xXF86VidModeGetDotClocksReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetDotClocks(client);
-}
-
-static int
-SProcXF86VidModeSetClientVersion(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeSetClientVersion(ClientPtr client) {
REQUEST(xXF86VidModeSetClientVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
swaps(&stuff->major);
swaps(&stuff->minor);
return ProcXF86VidModeSetClientVersion(client);
-}
-
-static int
-SProcXF86VidModeSetGamma(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeSetGamma(ClientPtr client) {
REQUEST(xXF86VidModeSetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
@@ -1925,174 +1868,149 @@ SProcXF86VidModeSetGamma(ClientPtr client)
swapl(&stuff->green);
swapl(&stuff->blue);
return ProcXF86VidModeSetGamma(client);
-}
-
-static int
-SProcXF86VidModeGetGamma(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetGamma(ClientPtr client) {
REQUEST(xXF86VidModeGetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetGamma(client);
-}
-
-static int
-SProcXF86VidModeSetGammaRamp(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeSetGammaRamp(ClientPtr client) {
int length;
- REQUEST(xXF86VidModeSetGammaRampReq);
- swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
- swaps(&stuff->size);
- swaps(&stuff->screen);
- length = ((stuff->size + 1) & ~1) * 6;
- REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
- SwapRestS(stuff);
- return ProcXF86VidModeSetGammaRamp(client);
-}
-
-static int
-SProcXF86VidModeGetGammaRamp(ClientPtr client)
-{
+ REQUEST(xXF86VidModeSetGammaRampReq);
+ swaps(&stuff->length);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
+ swaps(&stuff->size);
+ swaps(&stuff->screen);
+ length = ((stuff->size + 1) & ~1) * 6;
+ REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
+ SwapRestS(stuff);
+ return ProcXF86VidModeSetGammaRamp(client);
+} static int
+ SProcXF86VidModeGetGammaRamp(ClientPtr client) {
REQUEST(xXF86VidModeGetGammaRampReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
swaps(&stuff->size);
swaps(&stuff->screen);
return ProcXF86VidModeGetGammaRamp(client);
-}
-
-static int
-SProcXF86VidModeGetGammaRampSize(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetGammaRampSize(ClientPtr client) {
REQUEST(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetGammaRampSize(client);
-}
-
-static int
-SProcXF86VidModeGetPermissions(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetPermissions(ClientPtr client) {
REQUEST(xXF86VidModeGetPermissionsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetPermissions(client);
-}
-
-
-static int
-SProcXF86VidModeDispatch(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeDispatch(ClientPtr client) {
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_XF86VidModeQueryVersion:
- return SProcXF86VidModeQueryVersion(client);
- case X_XF86VidModeGetModeLine:
- return SProcXF86VidModeGetModeLine(client);
- case X_XF86VidModeGetMonitor:
- return SProcXF86VidModeGetMonitor(client);
- case X_XF86VidModeGetAllModeLines:
- return SProcXF86VidModeGetAllModeLines(client);
- case X_XF86VidModeGetViewPort:
- return SProcXF86VidModeGetViewPort(client);
- case X_XF86VidModeValidateModeLine:
- return SProcXF86VidModeValidateModeLine(client);
- case X_XF86VidModeGetDotClocks:
- return SProcXF86VidModeGetDotClocks(client);
- case X_XF86VidModeSetClientVersion:
- return SProcXF86VidModeSetClientVersion(client);
- case X_XF86VidModeGetGamma:
- return SProcXF86VidModeGetGamma(client);
- case X_XF86VidModeGetGammaRamp:
- return SProcXF86VidModeGetGammaRamp(client);
- case X_XF86VidModeGetGammaRampSize:
- return SProcXF86VidModeGetGammaRampSize(client);
- case X_XF86VidModeGetPermissions:
- return SProcXF86VidModeGetPermissions(client);
- default:
- if (!xf86GetVidModeEnabled())
- return VidModeErrorBase + XF86VidModeExtensionDisabled;
- if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
- switch (stuff->data) {
- case X_XF86VidModeAddModeLine:
- return SProcXF86VidModeAddModeLine(client);
- case X_XF86VidModeDeleteModeLine:
- return SProcXF86VidModeDeleteModeLine(client);
- case X_XF86VidModeModModeLine:
- return SProcXF86VidModeModModeLine(client);
- case X_XF86VidModeSwitchMode:
- return SProcXF86VidModeSwitchMode(client);
- case X_XF86VidModeSwitchToMode:
- return SProcXF86VidModeSwitchToMode(client);
- case X_XF86VidModeLockModeSwitch:
- return SProcXF86VidModeLockModeSwitch(client);
- case X_XF86VidModeSetViewPort:
- return SProcXF86VidModeSetViewPort(client);
- case X_XF86VidModeSetGamma:
- return SProcXF86VidModeSetGamma(client);
- case X_XF86VidModeSetGammaRamp:
- return SProcXF86VidModeSetGammaRamp(client);
- default:
- return BadRequest;
- }
- } else
- return VidModeErrorBase + XF86VidModeClientNotLocal;
+ return SProcXF86VidModeQueryVersion(client);
+ case X_XF86VidModeGetModeLine:return
+ SProcXF86VidModeGetModeLine(client);
+ case X_XF86VidModeGetMonitor:return SProcXF86VidModeGetMonitor(client);
+ case X_XF86VidModeGetAllModeLines:return
+ SProcXF86VidModeGetAllModeLines(client);
+ case X_XF86VidModeGetViewPort:return
+ SProcXF86VidModeGetViewPort(client);
+ case X_XF86VidModeValidateModeLine:return
+ SProcXF86VidModeValidateModeLine(client);
+ case X_XF86VidModeGetDotClocks:return
+ SProcXF86VidModeGetDotClocks(client);
+ case X_XF86VidModeSetClientVersion:return
+ SProcXF86VidModeSetClientVersion(client);
+ case X_XF86VidModeGetGamma:return SProcXF86VidModeGetGamma(client);
+ case X_XF86VidModeGetGammaRamp:return
+ SProcXF86VidModeGetGammaRamp(client);
+ case X_XF86VidModeGetGammaRampSize:return
+ SProcXF86VidModeGetGammaRampSize(client);
+ case X_XF86VidModeGetPermissions:return
+ SProcXF86VidModeGetPermissions(client);
+ default:if (!xf86GetVidModeEnabled())
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+ switch (stuff->data) {
+ case X_XF86VidModeAddModeLine:
+ return SProcXF86VidModeAddModeLine(client);
+ case X_XF86VidModeDeleteModeLine:return
+ SProcXF86VidModeDeleteModeLine(client);
+ case X_XF86VidModeModModeLine:return
+ SProcXF86VidModeModModeLine(client);
+ case X_XF86VidModeSwitchMode:return
+ SProcXF86VidModeSwitchMode(client);
+ case X_XF86VidModeSwitchToMode:return
+ SProcXF86VidModeSwitchToMode(client);
+ case X_XF86VidModeLockModeSwitch:return
+ SProcXF86VidModeLockModeSwitch(client);
+ case X_XF86VidModeSetViewPort:return
+ SProcXF86VidModeSetViewPort(client);
+ case X_XF86VidModeSetGamma:return
+ SProcXF86VidModeSetGamma(client);
+ case X_XF86VidModeSetGammaRamp:return
+ SProcXF86VidModeSetGammaRamp(client);
+ default:return BadRequest;
+ }}
+ else
+ return VidModeErrorBase + XF86VidModeClientNotLocal;
}
}
void
-XFree86VidModeExtensionInit(void)
-{
- ExtensionEntry* extEntry;
+ XFree86VidModeExtensionInit(void) {
+ ExtensionEntry *extEntry;
ScreenPtr pScreen;
- int i;
- Bool enabled = FALSE;
+ int i;
+ Bool enabled = FALSE;
- DEBUG_P("XFree86VidModeExtensionInit");
+ DEBUG_P("XFree86VidModeExtensionInit");
if (!dixRegisterPrivateKey(&VidModeClientPrivateKeyRec, PRIVATE_CLIENT, 0))
- return;
+ return;
#ifdef XF86VIDMODE_EVENTS
if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return;
+ return;
#endif
#ifdef XF86VIDMODE_EVENTS
- EventType = CreateNewResourceType(XF86VidModeFreeEvents, "VidModeEvent");
+ EventType = CreateNewResourceType(XF86VidModeFreeEvents, "VidModeEvent");
#endif
- for(i = 0; i < screenInfo.numScreens; i++) {
+ for (i = 0; i < screenInfo.numScreens; i++) {
pScreen = screenInfo.screens[i];
- if (VidModeExtensionInit(pScreen))
- enabled = TRUE;
+ if (VidModeExtensionInit(pScreen))
+ enabled = TRUE;
}
/* This means that the DDX doesn't want the vidmode extension enabled */
- if (!enabled)
- return;
+ if (!enabled)
+ return;
if (
#ifdef XF86VIDMODE_EVENTS
- EventType &&
+ EventType &&
#endif
- (extEntry = AddExtension(XF86VIDMODENAME,
- XF86VidModeNumberEvents,
- XF86VidModeNumberErrors,
- ProcXF86VidModeDispatch,
- SProcXF86VidModeDispatch,
- NULL,
- StandardMinorOpcode))) {
+ (extEntry = AddExtension(XF86VIDMODENAME,
+ XF86VidModeNumberEvents,
+ XF86VidModeNumberErrors,
+ ProcXF86VidModeDispatch,
+ SProcXF86VidModeDispatch,
+ NULL, StandardMinorOpcode))) {
#if 0
- XF86VidModeReqCode = (unsigned char)extEntry->base;
+ XF86VidModeReqCode = (unsigned char) extEntry->base;
#endif
- VidModeErrorBase = extEntry->errorBase;
+ VidModeErrorBase = extEntry->errorBase;
#ifdef XF86VIDMODE_EVENTS
- XF86VidModeEventBase = extEntry->eventBase;
- EventSwapVector[XF86VidModeEventBase] = (EventSwapPtr)SXF86VidModeNotifyEvent;
+ XF86VidModeEventBase = extEntry->eventBase;
+ EventSwapVector[XF86VidModeEventBase] =
+ (EventSwapPtr) SXF86VidModeNotifyEvent;
#endif
}
}
diff --git a/xorg-server/hw/xfree86/dixmods/fbmodule.c b/xorg-server/hw/xfree86/dixmods/fbmodule.c
index 4df2646dd..5895ba296 100644
--- a/xorg-server/hw/xfree86/dixmods/fbmodule.c
+++ b/xorg-server/hw/xfree86/dixmods/fbmodule.c
@@ -31,22 +31,22 @@
#include "xf86Module.h"
#include "fb.h"
-static XF86ModuleVersionInfo VersRec =
-{
+static XF86ModuleVersionInfo VersRec = {
#ifdef FB_ACCESS_WRAPPER
- "wfb",
+ "wfb",
#else
- "fb",
+ "fb",
#endif
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_ANSIC, /* Only need the ansic layer */
- ABI_ANSIC_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0} /* signature, to be patched into the file by a tool */
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0} /* signature, to be patched into the file by a tool */
};
-_X_EXPORT XF86ModuleData FBPREFIX(ModuleData) = { &VersRec, NULL, NULL };
+_X_EXPORT XF86ModuleData FBPREFIX(ModuleData) = {
+&VersRec, NULL, NULL};
diff --git a/xorg-server/hw/xfree86/dixmods/glxmodule.c b/xorg-server/hw/xfree86/dixmods/glxmodule.c
index 62a047e26..e72f3821a 100644
--- a/xorg-server/hw/xfree86/dixmods/glxmodule.c
+++ b/xorg-server/hw/xfree86/dixmods/glxmodule.c
@@ -47,8 +47,7 @@ static MODULESETUPPROTO(glxSetup);
static const char *initdeps[] = { "DOUBLE-BUFFER", "COMPOSITE", NULL };
-static ExtensionModule GLXExt =
-{
+static ExtensionModule GLXExt = {
GlxExtensionInit,
"GLX",
&noGlxExtension,
@@ -56,18 +55,17 @@ static ExtensionModule GLXExt =
initdeps
};
-static XF86ModuleVersionInfo VersRec =
-{
- "glx",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_EXTENSION,
- ABI_EXTENSION_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
+static XF86ModuleVersionInfo VersRec = {
+ "glx",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
};
_X_EXPORT XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL };
@@ -79,26 +77,27 @@ glxSetup(pointer module, pointer opts, int *errmaj, int *errmin)
__GLXprovider *provider;
if (setupDone) {
- if (errmaj) *errmaj = LDR_ONCEONLY;
- return NULL;
- }
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
+ return NULL;
+ }
setupDone = TRUE;
provider = LoaderSymbol("__glXDRISWRastProvider");
if (provider == NULL)
- return NULL;
+ return NULL;
GlxPushProvider(provider);
- xf86Msg(xf86Info.aiglxFrom, "AIGLX %s\n",
- xf86Info.aiglx ? "enabled" : "disabled");
+ xf86Msg(xf86Info.aiglxFrom, "AIGLX %s\n",
+ xf86Info.aiglx ? "enabled" : "disabled");
if (xf86Info.aiglx) {
- provider = LoaderSymbol("__glXDRIProvider");
- if (provider)
- GlxPushProvider(provider);
- provider = LoaderSymbol("__glXDRI2Provider");
- if (provider)
- GlxPushProvider(provider);
+ provider = LoaderSymbol("__glXDRIProvider");
+ if (provider)
+ GlxPushProvider(provider);
+ provider = LoaderSymbol("__glXDRI2Provider");
+ if (provider)
+ GlxPushProvider(provider);
}
LoadExtension(&GLXExt, FALSE);
diff --git a/xorg-server/hw/xfree86/dixmods/shmodule.c b/xorg-server/hw/xfree86/dixmods/shmodule.c
index 3136c0c05..0cbb9df71 100644
--- a/xorg-server/hw/xfree86/dixmods/shmodule.c
+++ b/xorg-server/hw/xfree86/dixmods/shmodule.c
@@ -37,18 +37,17 @@
#include "gcstruct.h"
#include "shadow.h"
-static XF86ModuleVersionInfo VersRec =
-{
- "shadow",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 1, 0,
- ABI_CLASS_ANSIC, /* Only need the ansic layer */
- ABI_ANSIC_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0} /* signature, to be patched into the file by a tool */
+static XF86ModuleVersionInfo VersRec = {
+ "shadow",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 1, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0} /* signature, to be patched into the file by a tool */
};
_X_EXPORT XF86ModuleData shadowModuleData = { &VersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c
index 1726960ae..9530eb40e 100644
--- a/xorg-server/hw/xfree86/dri/dri.c
+++ b/xorg-server/hw/xfree86/dri/dri.c
@@ -71,23 +71,25 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
static int DRIEntPrivIndex = -1;
static DevPrivateKeyRec DRIScreenPrivKeyRec;
+
#define DRIScreenPrivKey (&DRIScreenPrivKeyRec)
static DevPrivateKeyRec DRIWindowPrivKeyRec;
+
#define DRIWindowPrivKey (&DRIWindowPrivKeyRec)
static unsigned long DRIGeneration = 0;
static unsigned int DRIDrawableValidationStamp = 0;
static RESTYPE DRIDrawablePrivResType;
static RESTYPE DRIContextPrivResType;
-static void DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv);
+static void DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv);
drmServerInfo DRIDRMServerInfo;
- /* Wrapper just like xf86DrvMsg, but
- without the verbosity level checking.
- This will make it easy to turn off some
- messages later, based on verbosity
- level. */
+ /* Wrapper just like xf86DrvMsg, but
+ without the verbosity level checking.
+ This will make it easy to turn off some
+ messages later, based on verbosity
+ level. */
/*
* Since we're already referencing things from the XFree86 common layer in
@@ -99,27 +101,26 @@ drmServerInfo DRIDRMServerInfo;
static void
DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
{
- va_list ap;
+ va_list ap;
va_start(ap, format);
xf86VDrvMsgVerb(scrnIndex, type, DRI_MSG_VERBOSITY, format, ap);
va_end(ap);
}
-
static void
DRIOpenDRMCleanup(DRIEntPrivPtr pDRIEntPriv)
{
if (pDRIEntPriv->pLSAREA != NULL) {
- drmUnmap(pDRIEntPriv->pLSAREA, pDRIEntPriv->sAreaSize);
- pDRIEntPriv->pLSAREA = NULL;
+ drmUnmap(pDRIEntPriv->pLSAREA, pDRIEntPriv->sAreaSize);
+ pDRIEntPriv->pLSAREA = NULL;
}
if (pDRIEntPriv->hLSAREA != 0) {
- drmRmMap(pDRIEntPriv->drmFD, pDRIEntPriv->hLSAREA);
+ drmRmMap(pDRIEntPriv->drmFD, pDRIEntPriv->hLSAREA);
}
if (pDRIEntPriv->drmFD >= 0) {
- drmClose(pDRIEntPriv->drmFD);
- pDRIEntPriv->drmFD = 0;
+ drmClose(pDRIEntPriv->drmFD);
+ pDRIEntPriv->drmFD = 0;
}
}
@@ -141,12 +142,10 @@ DRIMasterSareaHandle(ScrnInfoPtr pScrn)
return DRI_ENT_PRIV(pScrn)->hLSAREA;
}
-
Bool
DRIOpenDRMMaster(ScrnInfoPtr pScrn,
- unsigned long sAreaSize,
- const char *busID,
- const char *drmDriverName)
+ unsigned long sAreaSize,
+ const char *busID, const char *drmDriverName)
{
drmSetVersion saveSv, sv;
Bool drmWasAvailable;
@@ -159,12 +158,12 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn,
int err;
if (DRIEntPrivIndex == -1)
- DRIEntPrivIndex = xf86AllocateEntityPrivateIndex();
+ DRIEntPrivIndex = xf86AllocateEntityPrivateIndex();
pDRIEntPriv = DRI_ENT_PRIV(pScrn);
if (pDRIEntPriv && pDRIEntPriv->drmFD != -1)
- return TRUE;
+ return TRUE;
drmWasAvailable = drmAvailable();
@@ -178,12 +177,12 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn,
drmlibmajor = 1;
drmlibminor = 0;
if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
- drmlibv = drmGetLibVersion(-1);
- if (drmlibv != NULL) {
- drmlibmajor = drmlibv->version_major;
- drmlibminor = drmlibv->version_minor;
- drmFreeVersion(drmlibv);
- }
+ drmlibv = drmGetLibVersion(-1);
+ if (drmlibv != NULL) {
+ drmlibmajor = drmlibv->version_major;
+ drmlibminor = drmlibv->version_minor;
+ drmFreeVersion(drmlibv);
+ }
}
/* Check if the libdrm can handle falling back to loading based on name
@@ -199,69 +198,69 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn,
saveSv = sv;
count = 10;
while (count--) {
- tmp.drmFD = drmOpen(drmDriverName, openBusID);
+ tmp.drmFD = drmOpen(drmDriverName, openBusID);
- if (tmp.drmFD < 0) {
- DRIDrvMsg(-1, X_ERROR, "[drm] drmOpen failed.\n");
- goto out_err;
- }
+ if (tmp.drmFD < 0) {
+ DRIDrvMsg(-1, X_ERROR, "[drm] drmOpen failed.\n");
+ goto out_err;
+ }
- err = drmSetInterfaceVersion(tmp.drmFD, &sv);
+ err = drmSetInterfaceVersion(tmp.drmFD, &sv);
- if (err != -EPERM)
- break;
+ if (err != -EPERM)
+ break;
- sv = saveSv;
- drmClose(tmp.drmFD);
- tmp.drmFD = -1;
- usleep(100000);
+ sv = saveSv;
+ drmClose(tmp.drmFD);
+ tmp.drmFD = -1;
+ usleep(100000);
}
if (tmp.drmFD <= 0) {
- DRIDrvMsg(-1, X_ERROR, "[drm] DRM was busy with another master.\n");
- goto out_err;
+ DRIDrvMsg(-1, X_ERROR, "[drm] DRM was busy with another master.\n");
+ goto out_err;
}
if (!drmWasAvailable) {
- DRIDrvMsg(-1, X_INFO,
- "[drm] loaded kernel module for \"%s\" driver.\n",
- drmDriverName);
+ DRIDrvMsg(-1, X_INFO,
+ "[drm] loaded kernel module for \"%s\" driver.\n",
+ drmDriverName);
}
if (err != 0) {
- sv.drm_di_major = 1;
- sv.drm_di_minor = 0;
+ sv.drm_di_major = 1;
+ sv.drm_di_minor = 0;
}
DRIDrvMsg(-1, X_INFO, "[drm] DRM interface version %d.%d\n",
- sv.drm_di_major, sv.drm_di_minor);
+ sv.drm_di_major, sv.drm_di_minor);
if (sv.drm_di_major == 1 && sv.drm_di_minor >= 1)
- err = 0;
+ err = 0;
else
- err = drmSetBusid(tmp.drmFD, busID);
+ err = drmSetBusid(tmp.drmFD, busID);
if (err) {
- DRIDrvMsg(-1, X_ERROR, "[drm] Could not set DRM device bus ID.\n");
- goto out_err;
+ DRIDrvMsg(-1, X_ERROR, "[drm] Could not set DRM device bus ID.\n");
+ goto out_err;
}
/*
* Create a lock-containing sarea.
*/
- if (drmAddMap( tmp.drmFD, 0, sAreaSize, DRM_SHM,
- DRM_CONTAINS_LOCK, &tmp.hLSAREA) < 0) {
+ if (drmAddMap(tmp.drmFD, 0, sAreaSize, DRM_SHM,
+ DRM_CONTAINS_LOCK, &tmp.hLSAREA) < 0) {
DRIDrvMsg(-1, X_INFO, "[drm] Could not create SAREA for DRM lock.\n");
- tmp.hLSAREA = 0;
- goto out_err;
+ tmp.hLSAREA = 0;
+ goto out_err;
}
- if (drmMap( tmp.drmFD, tmp.hLSAREA, sAreaSize,
- (drmAddressPtr)(&tmp.pLSAREA)) < 0) {
+ if (drmMap(tmp.drmFD, tmp.hLSAREA, sAreaSize,
+ (drmAddressPtr) (&tmp.pLSAREA)) < 0) {
DRIDrvMsg(-1, X_INFO, "[drm] Mapping SAREA for DRM lock failed.\n");
- tmp.pLSAREA = NULL;
- goto out_err;
+ tmp.pLSAREA = NULL;
+ goto out_err;
}
memset(tmp.pLSAREA, 0, sAreaSize);
@@ -273,62 +272,64 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn,
tmp.resOwner = NULL;
if (!pDRIEntPriv)
- pDRIEntPriv = xnfcalloc(sizeof(*pDRIEntPriv), 1);
+ pDRIEntPriv = xnfcalloc(sizeof(*pDRIEntPriv), 1);
if (!pDRIEntPriv) {
DRIDrvMsg(-1, X_INFO, "[drm] Failed to allocate memory for "
- "DRM device.\n");
- goto out_err;
+ "DRM device.\n");
+ goto out_err;
}
*pDRIEntPriv = tmp;
- xf86GetEntityPrivate((pScrn)->entityList[0],DRIEntPrivIndex)->ptr =
- pDRIEntPriv;
+ xf86GetEntityPrivate((pScrn)->entityList[0], DRIEntPrivIndex)->ptr =
+ pDRIEntPriv;
DRIDrvMsg(-1, X_INFO, "[drm] DRM open master succeeded.\n");
return TRUE;
- out_err:
+ out_err:
DRIOpenDRMCleanup(&tmp);
return FALSE;
}
static void
-DRIClipNotifyAllDrawables(ScreenPtr pScreen);
+ DRIClipNotifyAllDrawables(ScreenPtr pScreen);
static void
dri_crtc_notify(ScreenPtr pScreen)
{
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
DRIClipNotifyAllDrawables(pScreen);
xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify);
xf86_crtc_notify(pScreen);
- pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen, dri_crtc_notify);
+ pDRIPriv->xf86_crtc_notify =
+ xf86_wrap_crtc_notify(pScreen, dri_crtc_notify);
}
Bool
DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
{
- DRIScreenPrivPtr pDRIPriv;
- drm_context_t * reserved;
- int reserved_count;
- int i;
- DRIEntPrivPtr pDRIEntPriv;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- DRIContextFlags flags = 0;
- DRIContextPrivPtr pDRIContextPriv;
+ DRIScreenPrivPtr pDRIPriv;
+ drm_context_t *reserved;
+ int reserved_count;
+ int i;
+ DRIEntPrivPtr pDRIEntPriv;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ DRIContextFlags flags = 0;
+ DRIContextPrivPtr pDRIContextPriv;
/* If the DRI extension is disabled, do not initialize the DRI */
if (noXFree86DRIExtension) {
- DRIDrvMsg(pScreen->myNum, X_WARNING,
- "Direct rendering has been disabled.\n");
- return FALSE;
+ DRIDrvMsg(pScreen->myNum, X_WARNING,
+ "Direct rendering has been disabled.\n");
+ return FALSE;
}
if (!xf86VGAarbiterAllowDRI(pScreen)) {
DRIDrvMsg(pScreen->myNum, X_WARNING,
"Direct rendering is not supported when VGA arb is necessary for the device\n");
- return FALSE;
+ return FALSE;
}
#ifdef PANORAMIX
@@ -336,31 +337,30 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
* If Xinerama is on, don't allow DRI to initialise. It won't be usable
* anyway.
*/
- if (!noPanoramiXExtension) {
- DRIDrvMsg(pScreen->myNum, X_WARNING,
- "Direct rendering is not supported when Xinerama is enabled\n");
- return FALSE;
- }
+ if (!noPanoramiXExtension) {
+ DRIDrvMsg(pScreen->myNum, X_WARNING,
+ "Direct rendering is not supported when Xinerama is enabled\n");
+ return FALSE;
+ }
#endif
if (!DRIOpenDRMMaster(pScrn, pDRIInfo->SAREASize,
- pDRIInfo->busIdString,
- pDRIInfo->drmDriverName))
- return FALSE;
+ pDRIInfo->busIdString, pDRIInfo->drmDriverName))
+ return FALSE;
pDRIEntPriv = DRI_ENT_PRIV(pScrn);
if (DRIGeneration != serverGeneration)
- DRIGeneration = serverGeneration;
+ DRIGeneration = serverGeneration;
if (!dixRegisterPrivateKey(&DRIScreenPrivKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&DRIWindowPrivKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ return FALSE;
pDRIPriv = (DRIScreenPrivPtr) calloc(1, sizeof(DRIScreenPrivRec));
if (!pDRIPriv) {
- dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
return FALSE;
}
@@ -372,7 +372,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIPriv->nrWindowsVisible = 0;
pDRIPriv->fullscreen = NULL;
- pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx;
+ pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx;
pDRIPriv->createDummyCtxPriv = pDRIInfo->createDummyCtxPriv;
pDRIPriv->grabbedDRILock = FALSE;
@@ -381,141 +381,132 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
if (pDRIEntPriv->sAreaGrabbed || pDRIInfo->allocSarea) {
- if (drmAddMap( pDRIPriv->drmFD,
- 0,
- pDRIPriv->pDriverInfo->SAREASize,
- DRM_SHM,
- 0,
- &pDRIPriv->hSAREA) < 0)
- {
- pDRIPriv->directRenderingSupport = FALSE;
- dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
- drmClose(pDRIPriv->drmFD);
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] drmAddMap failed\n");
- return FALSE;
- }
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] added %d byte SAREA at %p\n",
- pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
-
- /* Backwards compat. */
- if (drmMap( pDRIPriv->drmFD,
- pDRIPriv->hSAREA,
- pDRIPriv->pDriverInfo->SAREASize,
- (drmAddressPtr)(&pDRIPriv->pSAREA)) < 0)
- {
- pDRIPriv->directRenderingSupport = FALSE;
- dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
- drmClose(pDRIPriv->drmFD);
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] drmMap failed\n");
- return FALSE;
- }
- DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
- pDRIPriv->hSAREA, pDRIPriv->pSAREA);
- memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
- } else {
- DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Using the DRM lock "
- "SAREA also for drawables.\n");
- pDRIPriv->hSAREA = pDRIEntPriv->hLSAREA;
- pDRIPriv->pSAREA = (XF86DRISAREAPtr) pDRIEntPriv->pLSAREA;
- pDRIEntPriv->sAreaGrabbed = TRUE;
+ if (drmAddMap(pDRIPriv->drmFD,
+ 0,
+ pDRIPriv->pDriverInfo->SAREASize,
+ DRM_SHM, 0, &pDRIPriv->hSAREA) < 0) {
+ pDRIPriv->directRenderingSupport = FALSE;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ drmClose(pDRIPriv->drmFD);
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] drmAddMap failed\n");
+ return FALSE;
+ }
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] added %d byte SAREA at %p\n",
+ pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
+
+ /* Backwards compat. */
+ if (drmMap(pDRIPriv->drmFD,
+ pDRIPriv->hSAREA,
+ pDRIPriv->pDriverInfo->SAREASize,
+ (drmAddressPtr) (&pDRIPriv->pSAREA)) < 0) {
+ pDRIPriv->directRenderingSupport = FALSE;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ drmClose(pDRIPriv->drmFD);
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] drmMap failed\n");
+ return FALSE;
+ }
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
+ pDRIPriv->hSAREA, pDRIPriv->pSAREA);
+ memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
+ }
+ else {
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Using the DRM lock "
+ "SAREA also for drawables.\n");
+ pDRIPriv->hSAREA = pDRIEntPriv->hLSAREA;
+ pDRIPriv->pSAREA = (XF86DRISAREAPtr) pDRIEntPriv->pLSAREA;
+ pDRIEntPriv->sAreaGrabbed = TRUE;
}
pDRIPriv->hLSAREA = pDRIEntPriv->hLSAREA;
pDRIPriv->pLSAREA = pDRIEntPriv->pLSAREA;
- if (!pDRIPriv->pDriverInfo->dontMapFrameBuffer)
- {
- if (drmAddMap( pDRIPriv->drmFD,
- (uintptr_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress,
- pDRIPriv->pDriverInfo->frameBufferSize,
- DRM_FRAME_BUFFER,
- 0,
- &pDRIPriv->pDriverInfo->hFrameBuffer) < 0)
- {
- pDRIPriv->directRenderingSupport = FALSE;
- dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
- drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize);
- drmClose(pDRIPriv->drmFD);
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] drmAddMap failed\n");
- return FALSE;
- }
- DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n",
- pDRIPriv->pDriverInfo->hFrameBuffer);
- } else {
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] framebuffer mapped by ddx driver\n");
+ if (!pDRIPriv->pDriverInfo->dontMapFrameBuffer) {
+ if (drmAddMap(pDRIPriv->drmFD,
+ (uintptr_t) pDRIPriv->pDriverInfo->
+ frameBufferPhysicalAddress,
+ pDRIPriv->pDriverInfo->frameBufferSize, DRM_FRAME_BUFFER,
+ 0, &pDRIPriv->pDriverInfo->hFrameBuffer) < 0) {
+ pDRIPriv->directRenderingSupport = FALSE;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize);
+ drmClose(pDRIPriv->drmFD);
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] drmAddMap failed\n");
+ return FALSE;
+ }
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n",
+ pDRIPriv->pDriverInfo->hFrameBuffer);
+ }
+ else {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] framebuffer mapped by ddx driver\n");
}
if (pDRIEntPriv->resOwner == NULL) {
- pDRIEntPriv->resOwner = pScreen;
-
- /* Add tags for reserved contexts */
- if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
- &reserved_count))) {
- int i;
- void *tag;
-
- for (i = 0; i < reserved_count; i++) {
- tag = DRICreateContextPrivFromHandle(pScreen,
- reserved[i],
- DRI_CONTEXT_RESERVED);
- drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag);
- }
- drmFreeReservedContextList(reserved);
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] added %d reserved context%s for kernel\n",
- reserved_count, reserved_count > 1 ? "s" : "");
- }
+ pDRIEntPriv->resOwner = pScreen;
+
+ /* Add tags for reserved contexts */
+ if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
+ &reserved_count))) {
+ int i;
+ void *tag;
+
+ for (i = 0; i < reserved_count; i++) {
+ tag = DRICreateContextPrivFromHandle(pScreen,
+ reserved[i],
+ DRI_CONTEXT_RESERVED);
+ drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag);
+ }
+ drmFreeReservedContextList(reserved);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] added %d reserved context%s for kernel\n",
+ reserved_count, reserved_count > 1 ? "s" : "");
+ }
}
/* validate max drawable table entry set by driver */
if ((pDRIPriv->pDriverInfo->maxDrawableTableEntry <= 0) ||
(pDRIPriv->pDriverInfo->maxDrawableTableEntry > SAREA_MAX_DRAWABLES)) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "Invalid max drawable table size set by driver: %d\n",
- pDRIPriv->pDriverInfo->maxDrawableTableEntry);
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "Invalid max drawable table size set by driver: %d\n",
+ pDRIPriv->pDriverInfo->maxDrawableTableEntry);
}
/* Initialize drawable tables (screen private and SAREA) */
- for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) {
- pDRIPriv->DRIDrawables[i] = NULL;
- pDRIPriv->pSAREA->drawableTable[i].stamp = 0;
- pDRIPriv->pSAREA->drawableTable[i].flags = 0;
+ for (i = 0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) {
+ pDRIPriv->DRIDrawables[i] = NULL;
+ pDRIPriv->pSAREA->drawableTable[i].stamp = 0;
+ pDRIPriv->pSAREA->drawableTable[i].flags = 0;
}
pDRIPriv->pLockRefCount = &pDRIEntPriv->lockRefCount;
pDRIPriv->pLockingContext = &pDRIEntPriv->lockingContext;
if (!pDRIEntPriv->keepFDOpen)
- pDRIEntPriv->keepFDOpen = pDRIInfo->keepFDOpen;
+ pDRIEntPriv->keepFDOpen = pDRIInfo->keepFDOpen;
pDRIEntPriv->refCount++;
/* Set up flags for DRICreateContextPriv */
switch (pDRIInfo->driverSwapMethod) {
case DRI_KERNEL_SWAP:
- flags = DRI_CONTEXT_2DONLY;
- break;
+ flags = DRI_CONTEXT_2DONLY;
+ break;
case DRI_HIDE_X_CONTEXT:
- flags = DRI_CONTEXT_PRESERVED;
- break;
+ flags = DRI_CONTEXT_PRESERVED;
+ break;
}
if (!(pDRIContextPriv = DRICreateContextPriv(pScreen,
- &pDRIPriv->myContext,
- flags))) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "failed to create server context\n");
- return FALSE;
+ &pDRIPriv->myContext,
+ flags))) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to create server context\n");
+ return FALSE;
}
pDRIPriv->myContextPriv = pDRIContextPriv;
DRIDrvMsg(pScreen->myNum, X_INFO,
- "X context handle = %p\n", pDRIPriv->myContext);
+ "X context handle = %p\n", pDRIPriv->myContext);
/* Now that we have created the X server's context, we can grab the
* hardware lock for the X server.
@@ -524,67 +515,66 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIPriv->grabbedDRILock = TRUE;
/* pointers so that we can prevent memory leaks later */
- pDRIPriv->hiddenContextStore = NULL;
+ pDRIPriv->hiddenContextStore = NULL;
pDRIPriv->partial3DContextStore = NULL;
- switch(pDRIInfo->driverSwapMethod) {
+ switch (pDRIInfo->driverSwapMethod) {
case DRI_HIDE_X_CONTEXT:
- /* Server will handle 3D swaps, and hide 2D swaps from kernel.
- * Register server context as a preserved context.
- */
-
- /* allocate memory for hidden context store */
- pDRIPriv->hiddenContextStore
- = (void *)calloc(1, pDRIInfo->contextSize);
- if (!pDRIPriv->hiddenContextStore) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "failed to allocate hidden context\n");
- DRIDestroyContextPriv(pDRIContextPriv);
- return FALSE;
- }
-
- /* allocate memory for partial 3D context store */
- pDRIPriv->partial3DContextStore
- = (void *)calloc(1, pDRIInfo->contextSize);
- if (!pDRIPriv->partial3DContextStore) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "[DRI] failed to allocate partial 3D context\n");
- free(pDRIPriv->hiddenContextStore);
- DRIDestroyContextPriv(pDRIContextPriv);
- return FALSE;
- }
-
- /* save initial context store */
- if (pDRIInfo->SwapContext) {
- (*pDRIInfo->SwapContext)(
- pScreen,
- DRI_NO_SYNC,
- DRI_2D_CONTEXT,
- pDRIPriv->hiddenContextStore,
- DRI_NO_CONTEXT,
- NULL);
- }
- /* fall through */
+ /* Server will handle 3D swaps, and hide 2D swaps from kernel.
+ * Register server context as a preserved context.
+ */
+
+ /* allocate memory for hidden context store */
+ pDRIPriv->hiddenContextStore
+ = (void *) calloc(1, pDRIInfo->contextSize);
+ if (!pDRIPriv->hiddenContextStore) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "failed to allocate hidden context\n");
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
+
+ /* allocate memory for partial 3D context store */
+ pDRIPriv->partial3DContextStore
+ = (void *) calloc(1, pDRIInfo->contextSize);
+ if (!pDRIPriv->partial3DContextStore) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] failed to allocate partial 3D context\n");
+ free(pDRIPriv->hiddenContextStore);
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
+
+ /* save initial context store */
+ if (pDRIInfo->SwapContext) {
+ (*pDRIInfo->SwapContext) (pScreen,
+ DRI_NO_SYNC,
+ DRI_2D_CONTEXT,
+ pDRIPriv->hiddenContextStore,
+ DRI_NO_CONTEXT, NULL);
+ }
+ /* fall through */
case DRI_SERVER_SWAP:
/* For swap methods of DRI_SERVER_SWAP and DRI_HIDE_X_CONTEXT
* setup signal handler for receiving swap requests from kernel
- */
- if (!(pDRIPriv->drmSIGIOHandlerInstalled =
- drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext))) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "[drm] failed to setup DRM signal handler\n");
- free(pDRIPriv->hiddenContextStore);
- free(pDRIPriv->partial3DContextStore);
- DRIDestroyContextPriv(pDRIContextPriv);
- return FALSE;
- } else {
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] installed DRM signal handler\n");
- }
+ */
+ if (!(pDRIPriv->drmSIGIOHandlerInstalled =
+ drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext))) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to setup DRM signal handler\n");
+ free(pDRIPriv->hiddenContextStore);
+ free(pDRIPriv->partial3DContextStore);
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
+ else {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] installed DRM signal handler\n");
+ }
default:
- break;
+ break;
}
return TRUE;
@@ -593,41 +583,42 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
Bool
DRIFinishScreenInit(ScreenPtr pScreen)
{
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
/* Wrap DRI support */
if (pDRIInfo->wrap.ValidateTree) {
- pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
- pScreen->ValidateTree = pDRIInfo->wrap.ValidateTree;
+ pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
+ pScreen->ValidateTree = pDRIInfo->wrap.ValidateTree;
}
if (pDRIInfo->wrap.PostValidateTree) {
- pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
- pScreen->PostValidateTree = pDRIInfo->wrap.PostValidateTree;
+ pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
+ pScreen->PostValidateTree = pDRIInfo->wrap.PostValidateTree;
}
if (pDRIInfo->wrap.WindowExposures) {
- pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
- pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures;
+ pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
+ pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures;
}
- pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
- pScreen->DestroyWindow = DRIDestroyWindow;
+ pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = DRIDestroyWindow;
pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen,
- dri_crtc_notify);
-
+ dri_crtc_notify);
+
if (pDRIInfo->wrap.CopyWindow) {
- pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
- pScreen->CopyWindow = pDRIInfo->wrap.CopyWindow;
+ pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = pDRIInfo->wrap.CopyWindow;
}
if (pDRIInfo->wrap.ClipNotify) {
- pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify;
- pScreen->ClipNotify = pDRIInfo->wrap.ClipNotify;
+ pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = pDRIInfo->wrap.ClipNotify;
}
if (pDRIInfo->wrap.AdjustFrame) {
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame;
- pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame;
+ pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame;
}
pDRIPriv->wrapped = TRUE;
@@ -640,161 +631,161 @@ void
DRICloseScreen(ScreenPtr pScreen)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- DRIInfoPtr pDRIInfo;
- drm_context_t * reserved;
- int reserved_count;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- DRIEntPrivPtr pDRIEntPriv = DRI_ENT_PRIV(pScrn);
+ DRIInfoPtr pDRIInfo;
+ drm_context_t *reserved;
+ int reserved_count;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ DRIEntPrivPtr pDRIEntPriv = DRI_ENT_PRIV(pScrn);
Bool closeMaster;
if (pDRIPriv) {
pDRIInfo = pDRIPriv->pDriverInfo;
- if (pDRIPriv->wrapped) {
- /* Unwrap DRI Functions */
- if (pDRIInfo->wrap.ValidateTree) {
- pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
- pDRIPriv->wrap.ValidateTree = NULL;
- }
- if (pDRIInfo->wrap.PostValidateTree) {
- pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
- pDRIPriv->wrap.PostValidateTree = NULL;
- }
- if (pDRIInfo->wrap.WindowExposures) {
- pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
- pDRIPriv->wrap.WindowExposures = NULL;
- }
- if (pDRIPriv->DestroyWindow) {
- pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
- pDRIPriv->DestroyWindow = NULL;
- }
-
- xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify);
-
- if (pDRIInfo->wrap.CopyWindow) {
- pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow;
- pDRIPriv->wrap.CopyWindow = NULL;
- }
- if (pDRIInfo->wrap.ClipNotify) {
- pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify;
- pDRIPriv->wrap.ClipNotify = NULL;
- }
- if (pDRIInfo->wrap.AdjustFrame) {
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
- pDRIPriv->wrap.AdjustFrame = NULL;
- }
-
- pDRIPriv->wrapped = FALSE;
- }
-
- if (pDRIPriv->drmSIGIOHandlerInstalled) {
- if (!drmRemoveSIGIOHandler(pDRIPriv->drmFD)) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "[drm] failed to remove DRM signal handler\n");
- }
- }
+ if (pDRIPriv->wrapped) {
+ /* Unwrap DRI Functions */
+ if (pDRIInfo->wrap.ValidateTree) {
+ pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
+ pDRIPriv->wrap.ValidateTree = NULL;
+ }
+ if (pDRIInfo->wrap.PostValidateTree) {
+ pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
+ pDRIPriv->wrap.PostValidateTree = NULL;
+ }
+ if (pDRIInfo->wrap.WindowExposures) {
+ pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
+ pDRIPriv->wrap.WindowExposures = NULL;
+ }
+ if (pDRIPriv->DestroyWindow) {
+ pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
+ pDRIPriv->DestroyWindow = NULL;
+ }
+
+ xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify);
+
+ if (pDRIInfo->wrap.CopyWindow) {
+ pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow;
+ pDRIPriv->wrap.CopyWindow = NULL;
+ }
+ if (pDRIInfo->wrap.ClipNotify) {
+ pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify;
+ pDRIPriv->wrap.ClipNotify = NULL;
+ }
+ if (pDRIInfo->wrap.AdjustFrame) {
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
+ pDRIPriv->wrap.AdjustFrame = NULL;
+ }
+
+ pDRIPriv->wrapped = FALSE;
+ }
+
+ if (pDRIPriv->drmSIGIOHandlerInstalled) {
+ if (!drmRemoveSIGIOHandler(pDRIPriv->drmFD)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to remove DRM signal handler\n");
+ }
+ }
if (pDRIPriv->dummyCtxPriv && pDRIPriv->createDummyCtx) {
- DRIDestroyDummyContext(pScreen, pDRIPriv->createDummyCtxPriv);
- }
-
- if (!DRIDestroyContextPriv(pDRIPriv->myContextPriv)) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "failed to destroy server context\n");
- }
-
- /* Remove tags for reserved contexts */
- if (pDRIEntPriv->resOwner == pScreen) {
- pDRIEntPriv->resOwner = NULL;
-
- if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
- &reserved_count))) {
- int i;
-
- for (i = 0; i < reserved_count; i++) {
- DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD,
- reserved[i]));
- }
- drmFreeReservedContextList(reserved);
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] removed %d reserved context%s for kernel\n",
- reserved_count, reserved_count > 1 ? "s" : "");
- }
- }
-
- /* Make sure signals get unblocked etc. */
- drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext);
- pDRIPriv->pLockRefCount = NULL;
- closeMaster = (--pDRIEntPriv->refCount == 0) &&
- !pDRIEntPriv->keepFDOpen;
- if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) {
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] unmapping %d bytes of SAREA %p at %p\n",
- pDRIInfo->SAREASize,
- pDRIPriv->hSAREA,
- pDRIPriv->pSAREA);
- if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "[drm] unable to unmap %d bytes"
- " of SAREA %p at %p\n",
- pDRIInfo->SAREASize,
- pDRIPriv->hSAREA,
- pDRIPriv->pSAREA);
- }
- } else {
- pDRIEntPriv->sAreaGrabbed = FALSE;
- }
-
- if (closeMaster || (pDRIEntPriv->drmFD != pDRIPriv->drmFD)) {
- drmClose(pDRIPriv->drmFD);
- if (pDRIEntPriv->drmFD == pDRIPriv->drmFD) {
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] Closed DRM master.\n");
- pDRIEntPriv->drmFD = -1;
- }
- }
-
- free(pDRIPriv);
- dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ DRIDestroyDummyContext(pScreen, pDRIPriv->createDummyCtxPriv);
+ }
+
+ if (!DRIDestroyContextPriv(pDRIPriv->myContextPriv)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "failed to destroy server context\n");
+ }
+
+ /* Remove tags for reserved contexts */
+ if (pDRIEntPriv->resOwner == pScreen) {
+ pDRIEntPriv->resOwner = NULL;
+
+ if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
+ &reserved_count))) {
+ int i;
+
+ for (i = 0; i < reserved_count; i++) {
+ DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD,
+ reserved[i]));
+ }
+ drmFreeReservedContextList(reserved);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] removed %d reserved context%s for kernel\n",
+ reserved_count, reserved_count > 1 ? "s" : "");
+ }
+ }
+
+ /* Make sure signals get unblocked etc. */
+ drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext);
+ pDRIPriv->pLockRefCount = NULL;
+ closeMaster = (--pDRIEntPriv->refCount == 0) &&
+ !pDRIEntPriv->keepFDOpen;
+ if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] unmapping %d bytes of SAREA %p at %p\n",
+ pDRIInfo->SAREASize, pDRIPriv->hSAREA, pDRIPriv->pSAREA);
+ if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] unable to unmap %d bytes"
+ " of SAREA %p at %p\n",
+ pDRIInfo->SAREASize,
+ pDRIPriv->hSAREA, pDRIPriv->pSAREA);
+ }
+ }
+ else {
+ pDRIEntPriv->sAreaGrabbed = FALSE;
+ }
+
+ if (closeMaster || (pDRIEntPriv->drmFD != pDRIPriv->drmFD)) {
+ drmClose(pDRIPriv->drmFD);
+ if (pDRIEntPriv->drmFD == pDRIPriv->drmFD) {
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Closed DRM master.\n");
+ pDRIEntPriv->drmFD = -1;
+ }
+ }
+
+ free(pDRIPriv);
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
}
}
#define DRM_MSG_VERBOSITY 3
-static int dri_drm_debug_print(const char *format, va_list ap)
+static int
+dri_drm_debug_print(const char *format, va_list ap)
{
- xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap);
- return 0;
+ xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap);
+ return 0;
}
-static void dri_drm_get_perms(gid_t *group, mode_t *mode)
+static void
+dri_drm_get_perms(gid_t * group, mode_t * mode)
{
- *group = xf86ConfigDRI.group;
- *mode = xf86ConfigDRI.mode;
+ *group = xf86ConfigDRI.group;
+ *mode = xf86ConfigDRI.mode;
}
-drmServerInfo DRIDRMServerInfo = {
- dri_drm_debug_print,
- xf86LoadKernelModule,
- dri_drm_get_perms,
+drmServerInfo DRIDRMServerInfo = {
+ dri_drm_debug_print,
+ xf86LoadKernelModule,
+ dri_drm_get_perms,
};
Bool
DRIExtensionInit(void)
{
if (DRIGeneration != serverGeneration) {
- return FALSE;
+ return FALSE;
}
DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete,
- "DRIDrawable");
+ "DRIDrawable");
DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete,
- "DRIContext");
+ "DRIContext");
if (!DRIDrawablePrivResType || !DRIContextPrivResType)
- return FALSE;
+ return FALSE;
RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
@@ -814,14 +805,14 @@ DRIReset(void)
}
Bool
-DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool* isCapable)
+DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if (pDRIPriv)
- *isCapable = pDRIPriv->directRenderingSupport;
+ *isCapable = pDRIPriv->directRenderingSupport;
else
- *isCapable = FALSE;
+ *isCapable = FALSE;
return TRUE;
}
@@ -831,8 +822,8 @@ DRIOpenConnection(ScreenPtr pScreen, drm_handle_t * hSAREA, char **busIdString)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- *hSAREA = pDRIPriv->hSAREA;
- *busIdString = pDRIPriv->pDriverInfo->busIdString;
+ *hSAREA = pDRIPriv->hSAREA;
+ *busIdString = pDRIPriv->pDriverInfo->busIdString;
return TRUE;
}
@@ -842,7 +833,8 @@ DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE;
+ if (drmAuthMagic(pDRIPriv->drmFD, magic))
+ return FALSE;
return TRUE;
}
@@ -856,15 +848,14 @@ Bool
DRIGetClientDriverName(ScreenPtr pScreen,
int *ddxDriverMajorVersion,
int *ddxDriverMinorVersion,
- int *ddxDriverPatchVersion,
- char **clientDriverName)
+ int *ddxDriverPatchVersion, char **clientDriverName)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
*ddxDriverMajorVersion = pDRIPriv->pDriverInfo->ddxDriverMajorVersion;
*ddxDriverMinorVersion = pDRIPriv->pDriverInfo->ddxDriverMinorVersion;
*ddxDriverPatchVersion = pDRIPriv->pDriverInfo->ddxDriverPatchVersion;
- *clientDriverName = pDRIPriv->pDriverInfo->clientDriverName;
+ *clientDriverName = pDRIPriv->pDriverInfo->clientDriverName;
return TRUE;
}
@@ -883,13 +874,12 @@ DRIGetClientDriverName(ScreenPtr pScreen,
DRIContextPrivPtr
DRICreateContextPriv(ScreenPtr pScreen,
- drm_context_t * pHWContext,
- DRIContextFlags flags)
+ drm_context_t * pHWContext, DRIContextFlags flags)
{
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if (drmCreateContext(pDRIPriv->drmFD, pHWContext)) {
- return NULL;
+ return NULL;
}
return DRICreateContextPrivFromHandle(pScreen, *pHWContext, flags);
@@ -897,46 +887,42 @@ DRICreateContextPriv(ScreenPtr pScreen,
DRIContextPrivPtr
DRICreateContextPrivFromHandle(ScreenPtr pScreen,
- drm_context_t hHWContext,
- DRIContextFlags flags)
+ drm_context_t hHWContext, DRIContextFlags flags)
{
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
DRIContextPrivPtr pDRIContextPriv;
- int contextPrivSize;
+ int contextPrivSize;
contextPrivSize = sizeof(DRIContextPrivRec) +
- pDRIPriv->pDriverInfo->contextSize;
+ pDRIPriv->pDriverInfo->contextSize;
if (!(pDRIContextPriv = calloc(1, contextPrivSize))) {
- return NULL;
+ return NULL;
}
- pDRIContextPriv->pContextStore = (void *)(pDRIContextPriv + 1);
+ pDRIContextPriv->pContextStore = (void *) (pDRIContextPriv + 1);
drmAddContextTag(pDRIPriv->drmFD, hHWContext, pDRIContextPriv);
pDRIContextPriv->hwContext = hHWContext;
- pDRIContextPriv->pScreen = pScreen;
- pDRIContextPriv->flags = flags;
- pDRIContextPriv->valid3D = FALSE;
+ pDRIContextPriv->pScreen = pScreen;
+ pDRIContextPriv->flags = flags;
+ pDRIContextPriv->valid3D = FALSE;
if (flags & DRI_CONTEXT_2DONLY) {
- if (drmSetContextFlags(pDRIPriv->drmFD,
- hHWContext,
- DRM_CONTEXT_2DONLY)) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "[drm] failed to set 2D context flag\n");
- DRIDestroyContextPriv(pDRIContextPriv);
- return NULL;
- }
+ if (drmSetContextFlags(pDRIPriv->drmFD, hHWContext, DRM_CONTEXT_2DONLY)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to set 2D context flag\n");
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return NULL;
+ }
}
if (flags & DRI_CONTEXT_PRESERVED) {
- if (drmSetContextFlags(pDRIPriv->drmFD,
- hHWContext,
- DRM_CONTEXT_PRESERVED)) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "[drm] failed to set preserved flag\n");
- DRIDestroyContextPriv(pDRIContextPriv);
- return NULL;
- }
+ if (drmSetContextFlags(pDRIPriv->drmFD,
+ hHWContext, DRM_CONTEXT_PRESERVED)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to set preserved flag\n");
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return NULL;
+ }
}
return pDRIContextPriv;
}
@@ -946,23 +932,24 @@ DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv)
{
DRIScreenPrivPtr pDRIPriv;
- if (!pDRIContextPriv) return TRUE;
+ if (!pDRIContextPriv)
+ return TRUE;
pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen);
if (!(pDRIContextPriv->flags & DRI_CONTEXT_RESERVED)) {
- /* Don't delete reserved contexts from
- kernel area -- the kernel manages its
- reserved contexts itself. */
- if (drmDestroyContext(pDRIPriv->drmFD, pDRIContextPriv->hwContext))
- return FALSE;
- }
-
- /* Remove the tag last to prevent a race
- condition where the context has pending
- buffers. The context can't be re-used
- while in this thread, but buffers can be
- dispatched asynchronously. */
+ /* Don't delete reserved contexts from
+ kernel area -- the kernel manages its
+ reserved contexts itself. */
+ if (drmDestroyContext(pDRIPriv->drmFD, pDRIContextPriv->hwContext))
+ return FALSE;
+ }
+
+ /* Remove the tag last to prevent a race
+ condition where the context has pending
+ buffers. The context can't be re-used
+ while in this thread, but buffers can be
+ dispatched asynchronously. */
drmDelContextTag(pDRIPriv->drmFD, pDRIContextPriv->hwContext);
free(pDRIContextPriv);
return TRUE;
@@ -976,20 +963,20 @@ DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv)
void *contextStore;
if (!(pDRIContextPriv =
- DRICreateContextPriv(pScreen,
- &pDRIPriv->pSAREA->dummy_context, 0))) {
- return FALSE;
+ DRICreateContextPriv(pScreen, &pDRIPriv->pSAREA->dummy_context, 0))) {
+ return FALSE;
}
contextStore = DRIGetContextStore(pDRIContextPriv);
if (pDRIPriv->pDriverInfo->CreateContext && needCtxPriv) {
- if (!pDRIPriv->pDriverInfo->CreateContext(pScreen, NULL,
- pDRIPriv->pSAREA->dummy_context,
- NULL,
- (DRIContextType)(long)contextStore)) {
- DRIDestroyContextPriv(pDRIContextPriv);
- return FALSE;
- }
+ if (!pDRIPriv->pDriverInfo->CreateContext(pScreen, NULL,
+ pDRIPriv->pSAREA->
+ dummy_context, NULL,
+ (DRIContextType) (long)
+ contextStore)) {
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
}
pDRIPriv->dummyCtxPriv = pDRIContextPriv;
@@ -1003,12 +990,14 @@ DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv)
DRIContextPrivPtr pDRIContextPriv = pDRIPriv->dummyCtxPriv;
void *contextStore;
- if (!pDRIContextPriv) return;
+ if (!pDRIContextPriv)
+ return;
if (pDRIPriv->pDriverInfo->DestroyContext && hasCtxPriv) {
- contextStore = DRIGetContextStore(pDRIContextPriv);
- pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen,
- pDRIContextPriv->hwContext,
- (DRIContextType)(long)contextStore);
+ contextStore = DRIGetContextStore(pDRIContextPriv);
+ pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen,
+ pDRIContextPriv->hwContext,
+ (DRIContextType) (long)
+ contextStore);
}
DRIDestroyContextPriv(pDRIPriv->dummyCtxPriv);
@@ -1025,28 +1014,29 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual,
if (pDRIPriv->createDummyCtx && !pDRIPriv->dummyCtxPriv) {
if (!DRICreateDummyContext(pScreen, pDRIPriv->createDummyCtxPriv)) {
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] Could not create dummy context\n");
- return FALSE;
- }
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] Could not create dummy context\n");
+ return FALSE;
+ }
}
if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, pHWContext, 0))) {
- return FALSE;
+ return FALSE;
}
contextStore = DRIGetContextStore(pDRIContextPriv);
if (pDRIPriv->pDriverInfo->CreateContext) {
- if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, NULL,
- *pHWContext, NULL,
- (DRIContextType)(long)contextStore))) {
- DRIDestroyContextPriv(pDRIContextPriv);
- return FALSE;
- }
+ if (!((*pDRIPriv->pDriverInfo->CreateContext) (pScreen, NULL,
+ *pHWContext, NULL,
+ (DRIContextType) (long)
+ contextStore))) {
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
}
/* track this in case the client dies before cleanup */
- AddResource(context, DRIContextPrivResType, (pointer)pDRIContextPriv);
+ AddResource(context, DRIContextPrivResType, (pointer) pDRIContextPriv);
return TRUE;
}
@@ -1063,21 +1053,21 @@ DRIDestroyContext(ScreenPtr pScreen, XID context)
Bool
DRIContextPrivDelete(pointer pResource, XID id)
{
- DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr)pResource;
+ DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr) pResource;
DRIScreenPrivPtr pDRIPriv;
void *contextStore;
pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen);
if (pDRIPriv->pDriverInfo->DestroyContext) {
- contextStore = DRIGetContextStore(pDRIContextPriv);
- pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen,
- pDRIContextPriv->hwContext,
- (DRIContextType)(long)contextStore);
+ contextStore = DRIGetContextStore(pDRIContextPriv);
+ pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen,
+ pDRIContextPriv->hwContext,
+ (DRIContextType) (long)
+ contextStore);
}
return DRIDestroyContextPriv(pDRIContextPriv);
}
-
/* This walks the drawable timestamp array and invalidates all of them
* in the case of transition from private to shared backbuffers. It's
* not necessary for correctness, because DRIClipNotify gets called in
@@ -1087,51 +1077,48 @@ DRIContextPrivDelete(pointer pResource, XID id)
static void
DRIClipNotifyAllDrawables(ScreenPtr pScreen)
{
- int i;
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ int i;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) {
- pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++;
- }
+ for (i = 0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) {
+ pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++;
+ }
}
-
static void
DRITransitionToSharedBuffers(ScreenPtr pScreen)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
- DRIClipNotifyAllDrawables( pScreen );
+ DRIClipNotifyAllDrawables(pScreen);
if (pDRIInfo->TransitionSingleToMulti3D)
- pDRIInfo->TransitionSingleToMulti3D( pScreen );
+ pDRIInfo->TransitionSingleToMulti3D(pScreen);
}
-
static void
DRITransitionToPrivateBuffers(ScreenPtr pScreen)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
- DRIClipNotifyAllDrawables( pScreen );
+ DRIClipNotifyAllDrawables(pScreen);
if (pDRIInfo->TransitionMultiToSingle3D)
- pDRIInfo->TransitionMultiToSingle3D( pScreen );
+ pDRIInfo->TransitionMultiToSingle3D(pScreen);
}
-
static void
DRITransitionTo3d(ScreenPtr pScreen)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
- DRIClipNotifyAllDrawables( pScreen );
+ DRIClipNotifyAllDrawables(pScreen);
if (pDRIInfo->TransitionTo3d)
- pDRIInfo->TransitionTo3d( pScreen );
+ pDRIInfo->TransitionTo3d(pScreen);
}
static void
@@ -1140,36 +1127,35 @@ DRITransitionTo2d(ScreenPtr pScreen)
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
- DRIClipNotifyAllDrawables( pScreen );
+ DRIClipNotifyAllDrawables(pScreen);
if (pDRIInfo->TransitionTo2d)
- pDRIInfo->TransitionTo2d( pScreen );
+ pDRIInfo->TransitionTo2d(pScreen);
}
-
static int
DRIDCNTreeTraversal(WindowPtr pWin, pointer data)
{
DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
if (pDRIDrawablePriv) {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if (RegionNumRects(&pWin->clipList) > 0) {
- WindowPtr *pDRIWindows = (WindowPtr*)data;
- int i = 0;
+ if (RegionNumRects(&pWin->clipList) > 0) {
+ WindowPtr *pDRIWindows = (WindowPtr *) data;
+ int i = 0;
- while (pDRIWindows[i])
- i++;
+ while (pDRIWindows[i])
+ i++;
- pDRIWindows[i] = pWin;
+ pDRIWindows[i] = pWin;
- pDRIPriv->nrWalked++;
- }
+ pDRIPriv->nrWalked++;
+ }
- if (pDRIPriv->nrWindows == pDRIPriv->nrWalked)
- return WT_STOPWALKING;
+ if (pDRIPriv->nrWindows == pDRIPriv->nrWalked)
+ return WT_STOPWALKING;
}
return WT_WALKCHILDREN;
@@ -1181,18 +1167,18 @@ DRIDriverClipNotify(ScreenPtr pScreen)
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if (pDRIPriv->pDriverInfo->ClipNotify) {
- WindowPtr *pDRIWindows = calloc(sizeof(WindowPtr), pDRIPriv->nrWindows);
- DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
+ WindowPtr *pDRIWindows = calloc(sizeof(WindowPtr), pDRIPriv->nrWindows);
+ DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
- if (pDRIPriv->nrWindows > 0) {
- pDRIPriv->nrWalked = 0;
- TraverseTree(pScreen->root, DRIDCNTreeTraversal,
- (pointer)pDRIWindows);
- }
+ if (pDRIPriv->nrWindows > 0) {
+ pDRIPriv->nrWalked = 0;
+ TraverseTree(pScreen->root, DRIDCNTreeTraversal,
+ (pointer) pDRIWindows);
+ }
- pDRIInfo->ClipNotify(pScreen, pDRIWindows, pDRIPriv->nrWindows);
+ pDRIInfo->ClipNotify(pScreen, pDRIWindows, pDRIPriv->nrWindows);
- free(pDRIWindows);
+ free(pDRIWindows);
}
}
@@ -1203,13 +1189,13 @@ DRIIncreaseNumberVisible(ScreenPtr pScreen)
switch (++pDRIPriv->nrWindowsVisible) {
case 1:
- DRITransitionTo3d( pScreen );
- break;
+ DRITransitionTo3d(pScreen);
+ break;
case 2:
- DRITransitionToSharedBuffers( pScreen );
- break;
+ DRITransitionToSharedBuffers(pScreen);
+ break;
default:
- break;
+ break;
}
DRIDriverClipNotify(pScreen);
@@ -1222,13 +1208,13 @@ DRIDecreaseNumberVisible(ScreenPtr pScreen)
switch (--pDRIPriv->nrWindowsVisible) {
case 0:
- DRITransitionTo2d( pScreen );
- break;
+ DRITransitionTo2d(pScreen);
+ break;
case 1:
- DRITransitionToPrivateBuffers( pScreen );
- break;
+ DRITransitionToPrivateBuffers(pScreen);
+ break;
default:
- break;
+ break;
}
DRIDriverClipNotify(pScreen);
@@ -1236,65 +1222,66 @@ DRIDecreaseNumberVisible(ScreenPtr pScreen)
Bool
DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable,
- drm_drawable_t * hHWDrawable)
+ drm_drawable_t * hHWDrawable)
{
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- DRIDrawablePrivPtr pDRIDrawablePriv;
- WindowPtr pWin;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+ WindowPtr pWin;
if (pDrawable->type == DRAWABLE_WINDOW) {
- pWin = (WindowPtr)pDrawable;
- if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
- pDRIDrawablePriv->refCount++;
-
- if (!pDRIDrawablePriv->hwDrawable) {
- drmCreateDrawable(pDRIPriv->drmFD, &pDRIDrawablePriv->hwDrawable);
- }
- }
- else {
- /* allocate a DRI Window Private record */
- if (!(pDRIDrawablePriv = malloc(sizeof(DRIDrawablePrivRec)))) {
- return FALSE;
- }
-
- /* Only create a drm_drawable_t once */
- if (drmCreateDrawable(pDRIPriv->drmFD,
- &pDRIDrawablePriv->hwDrawable)) {
- free(pDRIDrawablePriv);
- return FALSE;
- }
-
- /* add it to the list of DRI drawables for this screen */
- pDRIDrawablePriv->pScreen = pScreen;
- pDRIDrawablePriv->refCount = 1;
- pDRIDrawablePriv->drawableIndex = -1;
- pDRIDrawablePriv->nrects = RegionNumRects(&pWin->clipList);
-
- /* save private off of preallocated index */
- dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
- pDRIDrawablePriv);
- pDRIPriv->nrWindows++;
-
- if (pDRIDrawablePriv->nrects)
- DRIIncreaseNumberVisible(pScreen);
- }
-
- /* track this in case the client dies */
- AddResource(FakeClientID(client->index), DRIDrawablePrivResType,
- (pointer)(intptr_t)pDrawable->id);
-
- if (pDRIDrawablePriv->hwDrawable) {
- drmUpdateDrawableInfo(pDRIPriv->drmFD,
- pDRIDrawablePriv->hwDrawable,
- DRM_DRAWABLE_CLIPRECTS,
- RegionNumRects(&pWin->clipList),
- RegionRects(&pWin->clipList));
- *hHWDrawable = pDRIDrawablePriv->hwDrawable;
- }
- }
- else if (pDrawable->type != DRAWABLE_PIXMAP) { /* PBuffer */
- /* NOT_DONE */
- return FALSE;
+ pWin = (WindowPtr) pDrawable;
+ if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+ pDRIDrawablePriv->refCount++;
+
+ if (!pDRIDrawablePriv->hwDrawable) {
+ drmCreateDrawable(pDRIPriv->drmFD,
+ &pDRIDrawablePriv->hwDrawable);
+ }
+ }
+ else {
+ /* allocate a DRI Window Private record */
+ if (!(pDRIDrawablePriv = malloc(sizeof(DRIDrawablePrivRec)))) {
+ return FALSE;
+ }
+
+ /* Only create a drm_drawable_t once */
+ if (drmCreateDrawable(pDRIPriv->drmFD,
+ &pDRIDrawablePriv->hwDrawable)) {
+ free(pDRIDrawablePriv);
+ return FALSE;
+ }
+
+ /* add it to the list of DRI drawables for this screen */
+ pDRIDrawablePriv->pScreen = pScreen;
+ pDRIDrawablePriv->refCount = 1;
+ pDRIDrawablePriv->drawableIndex = -1;
+ pDRIDrawablePriv->nrects = RegionNumRects(&pWin->clipList);
+
+ /* save private off of preallocated index */
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
+ pDRIDrawablePriv);
+ pDRIPriv->nrWindows++;
+
+ if (pDRIDrawablePriv->nrects)
+ DRIIncreaseNumberVisible(pScreen);
+ }
+
+ /* track this in case the client dies */
+ AddResource(FakeClientID(client->index), DRIDrawablePrivResType,
+ (pointer) (intptr_t) pDrawable->id);
+
+ if (pDRIDrawablePriv->hwDrawable) {
+ drmUpdateDrawableInfo(pDRIPriv->drmFD,
+ pDRIDrawablePriv->hwDrawable,
+ DRM_DRAWABLE_CLIPRECTS,
+ RegionNumRects(&pWin->clipList),
+ RegionRects(&pWin->clipList));
+ *hHWDrawable = pDRIDrawablePriv->hwDrawable;
+ }
+ }
+ else if (pDrawable->type != DRAWABLE_PIXMAP) { /* PBuffer */
+ /* NOT_DONE */
+ return FALSE;
}
return TRUE;
@@ -1308,24 +1295,24 @@ DRIDrawablePrivDestroy(WindowPtr pWin)
DRIScreenPrivPtr pDRIPriv;
if (!pDRIDrawablePriv)
- return;
+ return;
pScreen = pWin->drawable.pScreen;
pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if (pDRIDrawablePriv->drawableIndex != -1) {
- /* bump stamp to force outstanding 3D requests to resync */
- pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
- = DRIDrawableValidationStamp++;
+ /* bump stamp to force outstanding 3D requests to resync */
+ pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
+ = DRIDrawableValidationStamp++;
- /* release drawable table entry */
- pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL;
+ /* release drawable table entry */
+ pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL;
}
pDRIPriv->nrWindows--;
if (pDRIDrawablePriv->nrects)
- DRIDecreaseNumberVisible(pScreen);
+ DRIDecreaseNumberVisible(pScreen);
drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable);
@@ -1337,10 +1324,10 @@ static Bool
DRIDestroyDrawableCB(pointer value, XID id, pointer data)
{
if (value == data) {
- /* This calls back DRIDrawablePrivDelete which frees private area */
- FreeResourceByType(id, DRIDrawablePrivResType, FALSE);
+ /* This calls back DRIDrawablePrivDelete which frees private area */
+ FreeResourceByType(id, DRIDrawablePrivResType, FALSE);
- return TRUE;
+ return TRUE;
}
return FALSE;
@@ -1350,13 +1337,13 @@ Bool
DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable)
{
if (pDrawable->type == DRAWABLE_WINDOW) {
- LookupClientResourceComplex(client, DRIDrawablePrivResType,
- DRIDestroyDrawableCB,
- (pointer)(intptr_t)pDrawable->id);
+ LookupClientResourceComplex(client, DRIDrawablePrivResType,
+ DRIDestroyDrawableCB,
+ (pointer) (intptr_t) pDrawable->id);
}
- else { /* pixmap (or for GLX 1.3, a PBuffer) */
- /* NOT_DONE */
- return FALSE;
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
}
return TRUE;
@@ -1370,189 +1357,198 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
/* For DRIDrawablePrivResType, the XID is the client's fake ID. The
* important XID is the value in pResource. */
- id = (XID)(intptr_t)pResource;
+ id = (XID) (intptr_t) pResource;
rc = dixLookupWindow(&pWin, id, serverClient, DixGetAttrAccess);
if (rc == Success) {
- DRIDrawablePrivPtr pDRIDrwPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+ DRIDrawablePrivPtr pDRIDrwPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
- if (!pDRIDrwPriv)
- return FALSE;
+ if (!pDRIDrwPriv)
+ return FALSE;
- if (--pDRIDrwPriv->refCount == 0)
- DRIDrawablePrivDestroy(pWin);
+ if (--pDRIDrwPriv->refCount == 0)
+ DRIDrawablePrivDestroy(pWin);
- return TRUE;
+ return TRUE;
}
- else { /* pixmap (or for GLX 1.3, a PBuffer) */
- /* NOT_DONE */
- return FALSE;
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
}
}
Bool
DRIGetDrawableInfo(ScreenPtr pScreen,
DrawablePtr pDrawable,
- unsigned int* index,
- unsigned int* stamp,
- int* X,
- int* Y,
- int* W,
- int* H,
- int* numClipRects,
+ unsigned int *index,
+ unsigned int *stamp,
+ int *X,
+ int *Y,
+ int *W,
+ int *H,
+ int *numClipRects,
drm_clip_rect_t ** pClipRects,
- int* backX,
- int* backY,
- int* numBackClipRects,
- drm_clip_rect_t ** pBackClipRects)
+ int *backX,
+ int *backY,
+ int *numBackClipRects, drm_clip_rect_t ** pBackClipRects)
{
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv;
- WindowPtr pWin, pOldWin;
- int i;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv;
+ WindowPtr pWin, pOldWin;
+ int i;
#if 0
- printf("maxDrawableTableEntry = %d\n", pDRIPriv->pDriverInfo->maxDrawableTableEntry);
+ printf("maxDrawableTableEntry = %d\n",
+ pDRIPriv->pDriverInfo->maxDrawableTableEntry);
#endif
if (pDrawable->type == DRAWABLE_WINDOW) {
- pWin = (WindowPtr)pDrawable;
- if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
-
- /* Manage drawable table */
- if (pDRIDrawablePriv->drawableIndex == -1) { /* load SAREA table */
-
- /* Search table for empty entry */
- i = 0;
- while (i < pDRIPriv->pDriverInfo->maxDrawableTableEntry) {
- if (!(pDRIPriv->DRIDrawables[i])) {
- pDRIPriv->DRIDrawables[i] = pDrawable;
- pDRIDrawablePriv->drawableIndex = i;
- pDRIPriv->pSAREA->drawableTable[i].stamp =
- DRIDrawableValidationStamp++;
- break;
- }
- i++;
- }
-
- /* Search table for oldest entry */
- if (i == pDRIPriv->pDriverInfo->maxDrawableTableEntry) {
+ pWin = (WindowPtr) pDrawable;
+ if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+
+ /* Manage drawable table */
+ if (pDRIDrawablePriv->drawableIndex == -1) { /* load SAREA table */
+
+ /* Search table for empty entry */
+ i = 0;
+ while (i < pDRIPriv->pDriverInfo->maxDrawableTableEntry) {
+ if (!(pDRIPriv->DRIDrawables[i])) {
+ pDRIPriv->DRIDrawables[i] = pDrawable;
+ pDRIDrawablePriv->drawableIndex = i;
+ pDRIPriv->pSAREA->drawableTable[i].stamp =
+ DRIDrawableValidationStamp++;
+ break;
+ }
+ i++;
+ }
+
+ /* Search table for oldest entry */
+ if (i == pDRIPriv->pDriverInfo->maxDrawableTableEntry) {
unsigned int oldestStamp = ~0;
int oldestIndex = 0;
- i = pDRIPriv->pDriverInfo->maxDrawableTableEntry;
- while (i--) {
- if (pDRIPriv->pSAREA->drawableTable[i].stamp <
- oldestStamp) {
- oldestIndex = i;
- oldestStamp =
- pDRIPriv->pSAREA->drawableTable[i].stamp;
- }
- }
- pDRIDrawablePriv->drawableIndex = oldestIndex;
-
- /* release oldest drawable table entry */
- pOldWin = (WindowPtr)pDRIPriv->DRIDrawables[oldestIndex];
- pOldDrawPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pOldWin);
- pOldDrawPriv->drawableIndex = -1;
-
- /* claim drawable table entry */
- pDRIPriv->DRIDrawables[oldestIndex] = pDrawable;
-
- /* validate SAREA entry */
- pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp =
- DRIDrawableValidationStamp++;
-
- /* check for stamp wrap around */
- if (oldestStamp > DRIDrawableValidationStamp) {
-
- /* walk SAREA table and invalidate all drawables */
- for( i=0;
+
+ i = pDRIPriv->pDriverInfo->maxDrawableTableEntry;
+ while (i--) {
+ if (pDRIPriv->pSAREA->drawableTable[i].stamp <
+ oldestStamp) {
+ oldestIndex = i;
+ oldestStamp =
+ pDRIPriv->pSAREA->drawableTable[i].stamp;
+ }
+ }
+ pDRIDrawablePriv->drawableIndex = oldestIndex;
+
+ /* release oldest drawable table entry */
+ pOldWin = (WindowPtr) pDRIPriv->DRIDrawables[oldestIndex];
+ pOldDrawPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pOldWin);
+ pOldDrawPriv->drawableIndex = -1;
+
+ /* claim drawable table entry */
+ pDRIPriv->DRIDrawables[oldestIndex] = pDrawable;
+
+ /* validate SAREA entry */
+ pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp =
+ DRIDrawableValidationStamp++;
+
+ /* check for stamp wrap around */
+ if (oldestStamp > DRIDrawableValidationStamp) {
+
+ /* walk SAREA table and invalidate all drawables */
+ for (i = 0;
i < pDRIPriv->pDriverInfo->maxDrawableTableEntry;
i++) {
- pDRIPriv->pSAREA->drawableTable[i].stamp =
- DRIDrawableValidationStamp++;
- }
- }
- }
-
- /* If the driver wants to be notified when the index is
- * set for a drawable, let it know now.
- */
- if (pDRIPriv->pDriverInfo->SetDrawableIndex)
- pDRIPriv->pDriverInfo->SetDrawableIndex(pWin,
- pDRIDrawablePriv->drawableIndex);
-
- /* reinit drawable ID if window is visible */
- if ((pWin->viewable) &&
- (pDRIPriv->pDriverInfo->bufferRequests != DRI_NO_WINDOWS))
- {
- (*pDRIPriv->pDriverInfo->InitBuffers)(pWin,
- &pWin->clipList, pDRIDrawablePriv->drawableIndex);
- }
- }
-
- *index = pDRIDrawablePriv->drawableIndex;
- *stamp = pDRIPriv->pSAREA->drawableTable[*index].stamp;
- *X = (int)(pWin->drawable.x);
- *Y = (int)(pWin->drawable.y);
- *W = (int)(pWin->drawable.width);
- *H = (int)(pWin->drawable.height);
- *numClipRects = RegionNumRects(&pWin->clipList);
- *pClipRects = (drm_clip_rect_t *)RegionRects(&pWin->clipList);
-
- if (!*numClipRects && pDRIPriv->fullscreen) {
- /* use fake full-screen clip rect */
- pDRIPriv->fullscreen_rect.x1 = *X;
- pDRIPriv->fullscreen_rect.y1 = *Y;
- pDRIPriv->fullscreen_rect.x2 = *X + *W;
- pDRIPriv->fullscreen_rect.y2 = *Y + *H;
-
- *numClipRects = 1;
- *pClipRects = &pDRIPriv->fullscreen_rect;
- }
-
- *backX = *X;
- *backY = *Y;
-
- if (pDRIPriv->nrWindowsVisible == 1 && *numClipRects) {
- /* Use a single cliprect. */
-
- int x0 = *X;
- int y0 = *Y;
- int x1 = x0 + *W;
- int y1 = y0 + *H;
-
- if (x0 < 0) x0 = 0;
- if (y0 < 0) y0 = 0;
- if (x1 > pScreen->width) x1 = pScreen->width;
- if (y1 > pScreen->height) y1 = pScreen->height;
-
- if (y0 >= y1 || x0 >= x1) {
- *numBackClipRects = 0;
- *pBackClipRects = NULL;
- } else {
- pDRIPriv->private_buffer_rect.x1 = x0;
- pDRIPriv->private_buffer_rect.y1 = y0;
- pDRIPriv->private_buffer_rect.x2 = x1;
- pDRIPriv->private_buffer_rect.y2 = y1;
-
- *numBackClipRects = 1;
- *pBackClipRects = &(pDRIPriv->private_buffer_rect);
- }
- } else {
- /* Use the frontbuffer cliprects for back buffers. */
- *numBackClipRects = 0;
- *pBackClipRects = 0;
- }
- }
- else {
- /* Not a DRIDrawable */
- return FALSE;
- }
- }
- else { /* pixmap (or for GLX 1.3, a PBuffer) */
- /* NOT_DONE */
- return FALSE;
+ pDRIPriv->pSAREA->drawableTable[i].stamp =
+ DRIDrawableValidationStamp++;
+ }
+ }
+ }
+
+ /* If the driver wants to be notified when the index is
+ * set for a drawable, let it know now.
+ */
+ if (pDRIPriv->pDriverInfo->SetDrawableIndex)
+ pDRIPriv->pDriverInfo->SetDrawableIndex(pWin,
+ pDRIDrawablePriv->
+ drawableIndex);
+
+ /* reinit drawable ID if window is visible */
+ if ((pWin->viewable) &&
+ (pDRIPriv->pDriverInfo->bufferRequests != DRI_NO_WINDOWS)) {
+ (*pDRIPriv->pDriverInfo->InitBuffers) (pWin,
+ &pWin->clipList,
+ pDRIDrawablePriv->
+ drawableIndex);
+ }
+ }
+
+ *index = pDRIDrawablePriv->drawableIndex;
+ *stamp = pDRIPriv->pSAREA->drawableTable[*index].stamp;
+ *X = (int) (pWin->drawable.x);
+ *Y = (int) (pWin->drawable.y);
+ *W = (int) (pWin->drawable.width);
+ *H = (int) (pWin->drawable.height);
+ *numClipRects = RegionNumRects(&pWin->clipList);
+ *pClipRects = (drm_clip_rect_t *) RegionRects(&pWin->clipList);
+
+ if (!*numClipRects && pDRIPriv->fullscreen) {
+ /* use fake full-screen clip rect */
+ pDRIPriv->fullscreen_rect.x1 = *X;
+ pDRIPriv->fullscreen_rect.y1 = *Y;
+ pDRIPriv->fullscreen_rect.x2 = *X + *W;
+ pDRIPriv->fullscreen_rect.y2 = *Y + *H;
+
+ *numClipRects = 1;
+ *pClipRects = &pDRIPriv->fullscreen_rect;
+ }
+
+ *backX = *X;
+ *backY = *Y;
+
+ if (pDRIPriv->nrWindowsVisible == 1 && *numClipRects) {
+ /* Use a single cliprect. */
+
+ int x0 = *X;
+ int y0 = *Y;
+ int x1 = x0 + *W;
+ int y1 = y0 + *H;
+
+ if (x0 < 0)
+ x0 = 0;
+ if (y0 < 0)
+ y0 = 0;
+ if (x1 > pScreen->width)
+ x1 = pScreen->width;
+ if (y1 > pScreen->height)
+ y1 = pScreen->height;
+
+ if (y0 >= y1 || x0 >= x1) {
+ *numBackClipRects = 0;
+ *pBackClipRects = NULL;
+ }
+ else {
+ pDRIPriv->private_buffer_rect.x1 = x0;
+ pDRIPriv->private_buffer_rect.y1 = y0;
+ pDRIPriv->private_buffer_rect.x2 = x1;
+ pDRIPriv->private_buffer_rect.y2 = y1;
+
+ *numBackClipRects = 1;
+ *pBackClipRects = &(pDRIPriv->private_buffer_rect);
+ }
+ }
+ else {
+ /* Use the frontbuffer cliprects for back buffers. */
+ *numBackClipRects = 0;
+ *pBackClipRects = 0;
+ }
+ }
+ else {
+ /* Not a DRIDrawable */
+ return FALSE;
+ }
+ }
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
}
return TRUE;
@@ -1561,11 +1557,9 @@ DRIGetDrawableInfo(ScreenPtr pScreen,
Bool
DRIGetDeviceInfo(ScreenPtr pScreen,
drm_handle_t * hFrameBuffer,
- int* fbOrigin,
- int* fbSize,
- int* fbStride,
- int* devPrivateSize,
- void** pDevPrivate)
+ int *fbOrigin,
+ int *fbSize,
+ int *fbStride, int *devPrivateSize, void **pDevPrivate)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
@@ -1582,21 +1576,23 @@ DRIGetDeviceInfo(ScreenPtr pScreen,
DRIInfoPtr
DRICreateInfoRec(void)
{
- DRIInfoPtr inforec = (DRIInfoPtr)calloc(1, sizeof(DRIInfoRec));
- if (!inforec) return NULL;
+ DRIInfoPtr inforec = (DRIInfoPtr) calloc(1, sizeof(DRIInfoRec));
+
+ if (!inforec)
+ return NULL;
/* Initialize defaults */
inforec->busIdString = NULL;
/* Wrapped function defaults */
- inforec->wrap.WakeupHandler = DRIDoWakeupHandler;
- inforec->wrap.BlockHandler = DRIDoBlockHandler;
- inforec->wrap.WindowExposures = DRIWindowExposures;
- inforec->wrap.CopyWindow = DRICopyWindow;
- inforec->wrap.ValidateTree = DRIValidateTree;
- inforec->wrap.PostValidateTree = DRIPostValidateTree;
- inforec->wrap.ClipNotify = DRIClipNotify;
- inforec->wrap.AdjustFrame = DRIAdjustFrame;
+ inforec->wrap.WakeupHandler = DRIDoWakeupHandler;
+ inforec->wrap.BlockHandler = DRIDoBlockHandler;
+ inforec->wrap.WindowExposures = DRIWindowExposures;
+ inforec->wrap.CopyWindow = DRICopyWindow;
+ inforec->wrap.ValidateTree = DRIValidateTree;
+ inforec->wrap.PostValidateTree = DRIPostValidateTree;
+ inforec->wrap.ClipNotify = DRIClipNotify;
+ inforec->wrap.AdjustFrame = DRIAdjustFrame;
inforec->TransitionTo2d = 0;
inforec->TransitionTo3d = 0;
@@ -1609,23 +1605,21 @@ void
DRIDestroyInfoRec(DRIInfoPtr DRIInfo)
{
free(DRIInfo->busIdString);
- free((char*)DRIInfo);
+ free((char *) DRIInfo);
}
-
void
DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask)
{
int i;
for (i = 0; i < screenInfo.numScreens; i++) {
- ScreenPtr pScreen = screenInfo.screens[i];
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ ScreenPtr pScreen = screenInfo.screens[i];
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if (pDRIPriv &&
- pDRIPriv->pDriverInfo->wrap.WakeupHandler)
- (*pDRIPriv->pDriverInfo->wrap.WakeupHandler)(i, wakeupData,
- result, pReadmask);
+ if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.WakeupHandler)
+ (*pDRIPriv->pDriverInfo->wrap.WakeupHandler) (i, wakeupData,
+ result, pReadmask);
}
}
@@ -1635,13 +1629,12 @@ DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
int i;
for (i = 0; i < screenInfo.numScreens; i++) {
- ScreenPtr pScreen = screenInfo.screens[i];
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ ScreenPtr pScreen = screenInfo.screens[i];
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if (pDRIPriv &&
- pDRIPriv->pDriverInfo->wrap.BlockHandler)
- (*pDRIPriv->pDriverInfo->wrap.BlockHandler)(i, blockData,
- pTimeout, pReadmask);
+ if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.BlockHandler)
+ (*pDRIPriv->pDriverInfo->wrap.BlockHandler) (i, blockData,
+ pTimeout, pReadmask);
}
}
@@ -1654,13 +1647,13 @@ DRIDoWakeupHandler(int screenNum, pointer wakeupData,
DRILock(pScreen, 0);
if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
- /* hide X context by swapping 2D component here */
- (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
- DRI_3D_SYNC,
- DRI_2D_CONTEXT,
- pDRIPriv->partial3DContextStore,
- DRI_2D_CONTEXT,
- pDRIPriv->hiddenContextStore);
+ /* hide X context by swapping 2D component here */
+ (*pDRIPriv->pDriverInfo->SwapContext) (pScreen,
+ DRI_3D_SYNC,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore,
+ DRI_2D_CONTEXT,
+ pDRIPriv->hiddenContextStore);
}
}
@@ -1672,13 +1665,13 @@ DRIDoBlockHandler(int screenNum, pointer blockData,
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
- /* hide X context by swapping 2D component here */
- (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
- DRI_2D_SYNC,
- DRI_NO_CONTEXT,
- NULL,
- DRI_2D_CONTEXT,
- pDRIPriv->partial3DContextStore);
+ /* hide X context by swapping 2D component here */
+ (*pDRIPriv->pDriverInfo->SwapContext) (pScreen,
+ DRI_2D_SYNC,
+ DRI_NO_CONTEXT,
+ NULL,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore);
}
if (pDRIPriv->windowsTouched)
@@ -1691,154 +1684,155 @@ DRIDoBlockHandler(int screenNum, pointer blockData,
void
DRISwapContext(int drmFD, void *oldctx, void *newctx)
{
- DRIContextPrivPtr oldContext = (DRIContextPrivPtr)oldctx;
- DRIContextPrivPtr newContext = (DRIContextPrivPtr)newctx;
- ScreenPtr pScreen = newContext->pScreen;
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- void* oldContextStore = NULL;
- DRIContextType oldContextType;
- void* newContextStore = NULL;
- DRIContextType newContextType;
- DRISyncType syncType;
+ DRIContextPrivPtr oldContext = (DRIContextPrivPtr) oldctx;
+ DRIContextPrivPtr newContext = (DRIContextPrivPtr) newctx;
+ ScreenPtr pScreen = newContext->pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ void *oldContextStore = NULL;
+ DRIContextType oldContextType;
+ void *newContextStore = NULL;
+ DRIContextType newContextType;
+ DRISyncType syncType;
+
#ifdef DEBUG
- static int count = 0;
+ static int count = 0;
if (!newContext) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "[DRI] Context Switch Error: oldContext=%x, newContext=%x\n",
- oldContext, newContext);
- return;
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] Context Switch Error: oldContext=%x, newContext=%x\n",
+ oldContext, newContext);
+ return;
}
/* usefull for debugging, just print out after n context switches */
if (!count || !(count % 1)) {
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[DRI] Context switch %5d from %p/0x%08x (%d)\n",
- count,
- oldContext,
- oldContext ? oldContext->flags : 0,
- oldContext ? oldContext->hwContext : -1);
- DRIDrvMsg(pScreen->myNum, X_INFO,
- "[DRI] Context switch %5d to %p/0x%08x (%d)\n",
- count,
- newContext,
- newContext ? newContext->flags : 0,
- newContext ? newContext->hwContext : -1);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[DRI] Context switch %5d from %p/0x%08x (%d)\n",
+ count,
+ oldContext,
+ oldContext ? oldContext->flags : 0,
+ oldContext ? oldContext->hwContext : -1);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[DRI] Context switch %5d to %p/0x%08x (%d)\n",
+ count,
+ newContext,
+ newContext ? newContext->flags : 0,
+ newContext ? newContext->hwContext : -1);
}
++count;
#endif
if (!pDRIPriv->pDriverInfo->SwapContext) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "[DRI] DDX driver missing context swap call back\n");
- return;
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] DDX driver missing context swap call back\n");
+ return;
}
if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
/* only 3D contexts are swapped in this case */
- if (oldContext) {
- oldContextStore = DRIGetContextStore(oldContext);
- oldContext->valid3D = TRUE;
- oldContextType = DRI_3D_CONTEXT;
- } else {
- oldContextType = DRI_NO_CONTEXT;
- }
- newContextStore = DRIGetContextStore(newContext);
- if ((newContext->valid3D) &&
- (newContext->hwContext != pDRIPriv->myContext)) {
- newContextType = DRI_3D_CONTEXT;
- }
- else {
- newContextType = DRI_2D_CONTEXT;
- }
- syncType = DRI_3D_SYNC;
- }
- else /* default: driverSwapMethod == DRI_SERVER_SWAP */ {
+ if (oldContext) {
+ oldContextStore = DRIGetContextStore(oldContext);
+ oldContext->valid3D = TRUE;
+ oldContextType = DRI_3D_CONTEXT;
+ }
+ else {
+ oldContextType = DRI_NO_CONTEXT;
+ }
+ newContextStore = DRIGetContextStore(newContext);
+ if ((newContext->valid3D) &&
+ (newContext->hwContext != pDRIPriv->myContext)) {
+ newContextType = DRI_3D_CONTEXT;
+ }
+ else {
+ newContextType = DRI_2D_CONTEXT;
+ }
+ syncType = DRI_3D_SYNC;
+ }
+ else { /* default: driverSwapMethod == DRI_SERVER_SWAP */
/* optimize 2D context swaps */
- if (newContext->flags & DRI_CONTEXT_2DONLY) {
- /* go from 3D context to 2D context and only save 2D
+ if (newContext->flags & DRI_CONTEXT_2DONLY) {
+ /* go from 3D context to 2D context and only save 2D
* subset of 3D state
*/
- oldContextStore = DRIGetContextStore(oldContext);
- oldContextType = DRI_2D_CONTEXT;
- newContextStore = DRIGetContextStore(newContext);
- newContextType = DRI_2D_CONTEXT;
- syncType = DRI_3D_SYNC;
- pDRIPriv->lastPartial3DContext = oldContext;
- }
- else if (oldContext->flags & DRI_CONTEXT_2DONLY) {
- if (pDRIPriv->lastPartial3DContext == newContext) {
- /* go from 2D context back to previous 3D context and
- * only restore 2D subset of previous 3D state
- */
- oldContextStore = DRIGetContextStore(oldContext);
- oldContextType = DRI_2D_CONTEXT;
- newContextStore = DRIGetContextStore(newContext);
- newContextType = DRI_2D_CONTEXT;
- syncType = DRI_2D_SYNC;
- }
- else {
- /* go from 2D context to a different 3D context */
-
- /* call DDX driver to do partial restore */
- oldContextStore = DRIGetContextStore(oldContext);
- newContextStore =
- DRIGetContextStore(pDRIPriv->lastPartial3DContext);
- (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
- DRI_2D_SYNC,
- DRI_2D_CONTEXT,
- oldContextStore,
- DRI_2D_CONTEXT,
- newContextStore);
-
- /* now setup for a complete 3D swap */
- oldContextStore = newContextStore;
- oldContext->valid3D = TRUE;
- oldContextType = DRI_3D_CONTEXT;
- newContextStore = DRIGetContextStore(newContext);
- if ((newContext->valid3D) &&
- (newContext->hwContext != pDRIPriv->myContext)) {
- newContextType = DRI_3D_CONTEXT;
- }
- else {
- newContextType = DRI_2D_CONTEXT;
- }
- syncType = DRI_NO_SYNC;
- }
- }
- else {
- /* now setup for a complete 3D swap */
- oldContextStore = newContextStore;
- oldContext->valid3D = TRUE;
- oldContextType = DRI_3D_CONTEXT;
- newContextStore = DRIGetContextStore(newContext);
- if ((newContext->valid3D) &&
- (newContext->hwContext != pDRIPriv->myContext)) {
- newContextType = DRI_3D_CONTEXT;
- }
- else {
- newContextType = DRI_2D_CONTEXT;
- }
- syncType = DRI_3D_SYNC;
- }
+ oldContextStore = DRIGetContextStore(oldContext);
+ oldContextType = DRI_2D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ newContextType = DRI_2D_CONTEXT;
+ syncType = DRI_3D_SYNC;
+ pDRIPriv->lastPartial3DContext = oldContext;
+ }
+ else if (oldContext->flags & DRI_CONTEXT_2DONLY) {
+ if (pDRIPriv->lastPartial3DContext == newContext) {
+ /* go from 2D context back to previous 3D context and
+ * only restore 2D subset of previous 3D state
+ */
+ oldContextStore = DRIGetContextStore(oldContext);
+ oldContextType = DRI_2D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ newContextType = DRI_2D_CONTEXT;
+ syncType = DRI_2D_SYNC;
+ }
+ else {
+ /* go from 2D context to a different 3D context */
+
+ /* call DDX driver to do partial restore */
+ oldContextStore = DRIGetContextStore(oldContext);
+ newContextStore =
+ DRIGetContextStore(pDRIPriv->lastPartial3DContext);
+ (*pDRIPriv->pDriverInfo->SwapContext) (pScreen,
+ DRI_2D_SYNC,
+ DRI_2D_CONTEXT,
+ oldContextStore,
+ DRI_2D_CONTEXT,
+ newContextStore);
+
+ /* now setup for a complete 3D swap */
+ oldContextStore = newContextStore;
+ oldContext->valid3D = TRUE;
+ oldContextType = DRI_3D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ if ((newContext->valid3D) &&
+ (newContext->hwContext != pDRIPriv->myContext)) {
+ newContextType = DRI_3D_CONTEXT;
+ }
+ else {
+ newContextType = DRI_2D_CONTEXT;
+ }
+ syncType = DRI_NO_SYNC;
+ }
+ }
+ else {
+ /* now setup for a complete 3D swap */
+ oldContextStore = newContextStore;
+ oldContext->valid3D = TRUE;
+ oldContextType = DRI_3D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ if ((newContext->valid3D) &&
+ (newContext->hwContext != pDRIPriv->myContext)) {
+ newContextType = DRI_3D_CONTEXT;
+ }
+ else {
+ newContextType = DRI_2D_CONTEXT;
+ }
+ syncType = DRI_3D_SYNC;
+ }
}
/* call DDX driver to perform the swap */
- (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
- syncType,
- oldContextType,
- oldContextStore,
- newContextType,
- newContextStore);
+ (*pDRIPriv->pDriverInfo->SwapContext) (pScreen,
+ syncType,
+ oldContextType,
+ oldContextStore,
+ newContextType, newContextStore);
}
-void*
+void *
DRIGetContextStore(DRIContextPrivPtr context)
{
- return((void *)context->pContextStore);
+ return ((void *) context->pContextStore);
}
void
@@ -1848,45 +1842,44 @@ DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg)
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
- if(pDRIDrawablePriv) {
- (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn,
+ if (pDRIDrawablePriv) {
+ (*pDRIPriv->pDriverInfo->InitBuffers) (pWin, prgn,
pDRIDrawablePriv->drawableIndex);
}
/* call lower wrapped functions */
if (pDRIPriv && pDRIPriv->wrap.WindowExposures) {
- /* unwrap */
- pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
+ /* unwrap */
+ pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
- /* call lower layers */
- (*pScreen->WindowExposures)(pWin, prgn, bsreg);
+ /* call lower layers */
+ (*pScreen->WindowExposures) (pWin, prgn, bsreg);
- /* rewrap */
- pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
- pScreen->WindowExposures = DRIWindowExposures;
+ /* rewrap */
+ pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
+ pScreen->WindowExposures = DRIWindowExposures;
}
}
-
static int
DRITreeTraversal(WindowPtr pWin, pointer data)
{
DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
- if(pDRIDrawablePriv) {
+ if (pDRIDrawablePriv) {
ScreenPtr pScreen = pWin->drawable.pScreen;
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if(RegionNumRects(&(pWin->clipList)) > 0) {
- RegionPtr reg = (RegionPtr)data;
+ if (RegionNumRects(&(pWin->clipList)) > 0) {
+ RegionPtr reg = (RegionPtr) data;
- RegionUnion(reg, reg, &(pWin->clipList));
- pDRIPriv->nrWalked++;
- }
+ RegionUnion(reg, reg, &(pWin->clipList));
+ pDRIPriv->nrWalked++;
+ }
- if(pDRIPriv->nrWindows == pDRIPriv->nrWalked)
- return WT_STOPWALKING;
+ if (pDRIPriv->nrWindows == pDRIPriv->nrWalked)
+ return WT_STOPWALKING;
}
return WT_WALKCHILDREN;
}
@@ -1901,16 +1894,16 @@ DRIDestroyWindow(WindowPtr pWin)
DRIDrawablePrivDestroy(pWin);
/* call lower wrapped functions */
- if(pDRIPriv->DestroyWindow) {
- /* unwrap */
- pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
+ if (pDRIPriv->DestroyWindow) {
+ /* unwrap */
+ pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
- /* call lower layers */
- retval = (*pScreen->DestroyWindow)(pWin);
+ /* call lower layers */
+ retval = (*pScreen->DestroyWindow) (pWin);
- /* rewrap */
- pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
- pScreen->DestroyWindow = DRIDestroyWindow;
+ /* rewrap */
+ pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = DRIDestroyWindow;
}
return retval;
@@ -1922,39 +1915,41 @@ DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
ScreenPtr pScreen = pWin->drawable.pScreen;
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if(!pDRIPriv) return;
+ if (!pDRIPriv)
+ return;
- if(pDRIPriv->nrWindowsVisible > 0) {
- RegionRec reg;
+ if (pDRIPriv->nrWindowsVisible > 0) {
+ RegionRec reg;
- RegionNull(&reg);
- pDRIPriv->nrWalked = 0;
- TraverseTree(pWin, DRITreeTraversal, (pointer)(&reg));
+ RegionNull(&reg);
+ pDRIPriv->nrWalked = 0;
+ TraverseTree(pWin, DRITreeTraversal, (pointer) (&reg));
- if(RegionNotEmpty(&reg)) {
- RegionTranslate(&reg, ptOldOrg.x - pWin->drawable.x,
- ptOldOrg.y - pWin->drawable.y);
- RegionIntersect(&reg, &reg, prgnSrc);
+ if (RegionNotEmpty(&reg)) {
+ RegionTranslate(&reg, ptOldOrg.x - pWin->drawable.x,
+ ptOldOrg.y - pWin->drawable.y);
+ RegionIntersect(&reg, &reg, prgnSrc);
- /* The MoveBuffers interface is not ideal */
- (*pDRIPriv->pDriverInfo->MoveBuffers)(pWin, ptOldOrg, &reg,
- pDRIPriv->pDriverInfo->ddxDrawableTableEntry);
- }
+ /* The MoveBuffers interface is not ideal */
+ (*pDRIPriv->pDriverInfo->MoveBuffers) (pWin, ptOldOrg, &reg,
+ pDRIPriv->pDriverInfo->
+ ddxDrawableTableEntry);
+ }
- RegionUninit(&reg);
+ RegionUninit(&reg);
}
/* call lower wrapped functions */
- if(pDRIPriv->wrap.CopyWindow) {
- /* unwrap */
- pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow;
+ if (pDRIPriv->wrap.CopyWindow) {
+ /* unwrap */
+ pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow;
- /* call lower layers */
- (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
+ /* call lower layers */
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- /* rewrap */
- pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
- pScreen->CopyWindow = DRICopyWindow;
+ /* rewrap */
+ pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = DRICopyWindow;
}
}
@@ -1965,25 +1960,26 @@ DRIGetSecs(long *secs, long *usecs)
gettimeofday(&tv, NULL);
- *secs = tv.tv_sec;
+ *secs = tv.tv_sec;
*usecs = tv.tv_usec;
}
static unsigned long
DRIComputeMilliSeconds(unsigned long s_secs, unsigned long s_usecs,
- unsigned long f_secs, unsigned long f_usecs)
+ unsigned long f_secs, unsigned long f_usecs)
{
if (f_usecs < s_usecs) {
- --f_secs;
- f_usecs += 1000000;
+ --f_secs;
+ f_usecs += 1000000;
}
return (f_secs - s_secs) * 1000 + (f_usecs - s_usecs) / 1000;
}
static void
-DRISpinLockTimeout(drmLock *lock, int val, unsigned long timeout /* in mS */)
+DRISpinLockTimeout(drmLock * lock, int val, unsigned long timeout /* in mS */ )
{
- int count = 10000;
+ int count = 10000;
+
#if !defined(__alpha__) && !defined(__powerpc__)
char ret;
#else
@@ -1992,25 +1988,27 @@ DRISpinLockTimeout(drmLock *lock, int val, unsigned long timeout /* in mS */)
long s_secs, s_usecs;
long f_secs, f_usecs;
long msecs;
- long prev = 0;
+ long prev = 0;
DRIGetSecs(&s_secs, &s_usecs);
do {
- DRM_SPINLOCK_COUNT(lock, val, count, ret);
- if (!ret) return; /* Got lock */
- DRIGetSecs(&f_secs, &f_usecs);
- msecs = DRIComputeMilliSeconds(s_secs, s_usecs, f_secs, f_usecs);
- if (msecs - prev < 250) count *= 2; /* Not more than 0.5S */
+ DRM_SPINLOCK_COUNT(lock, val, count, ret);
+ if (!ret)
+ return; /* Got lock */
+ DRIGetSecs(&f_secs, &f_usecs);
+ msecs = DRIComputeMilliSeconds(s_secs, s_usecs, f_secs, f_usecs);
+ if (msecs - prev < 250)
+ count *= 2; /* Not more than 0.5S */
} while (msecs < timeout);
- /* Didn't get lock, so take it. The worst
- that can happen is that there is some
- garbage written to the wrong part of the
- framebuffer that a refresh will repair.
- That's undesirable, but better than
- locking the server. This should be a
- very rare event. */
+ /* Didn't get lock, so take it. The worst
+ that can happen is that there is some
+ garbage written to the wrong part of the
+ framebuffer that a refresh will repair.
+ That's undesirable, but better than
+ locking the server. This should be a
+ very rare event. */
DRM_SPINLOCK_TAKE(lock, val);
}
@@ -2019,16 +2017,17 @@ DRILockTree(ScreenPtr pScreen)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if(!pDRIPriv) return;
+ if (!pDRIPriv)
+ return;
/* Restore the last known 3D context if the X context is hidden */
if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
- (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
- DRI_2D_SYNC,
- DRI_NO_CONTEXT,
- NULL,
- DRI_2D_CONTEXT,
- pDRIPriv->partial3DContextStore);
+ (*pDRIPriv->pDriverInfo->SwapContext) (pScreen,
+ DRI_2D_SYNC,
+ DRI_NO_CONTEXT,
+ NULL,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore);
}
/* Call kernel to release lock */
@@ -2038,20 +2037,20 @@ DRILockTree(ScreenPtr pScreen)
appropriate, since this should never time out except in the case of
client death while the lock is being held. The timeout must be
greater than any reasonable rendering time. */
- DRISpinLockTimeout(&pDRIPriv->pSAREA->drawable_lock, 1, 10000); /*10 secs*/
+ DRISpinLockTimeout(&pDRIPriv->pSAREA->drawable_lock, 1, 10000); /*10 secs */
/* Call kernel flush outstanding buffers and relock */
- DRILock(pScreen, DRM_LOCK_QUIESCENT|DRM_LOCK_FLUSH_ALL);
+ DRILock(pScreen, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH_ALL);
/* Switch back to our 2D context if the X context is hidden */
if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
- /* hide X context by swapping 2D component here */
- (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
- DRI_3D_SYNC,
- DRI_2D_CONTEXT,
- pDRIPriv->partial3DContextStore,
- DRI_2D_CONTEXT,
- pDRIPriv->hiddenContextStore);
+ /* hide X context by swapping 2D component here */
+ (*pDRIPriv->pDriverInfo->SwapContext) (pScreen,
+ DRI_3D_SYNC,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore,
+ DRI_2D_CONTEXT,
+ pDRIPriv->hiddenContextStore);
}
}
@@ -2061,21 +2060,22 @@ DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
ScreenPtr pScreen = pParent->drawable.pScreen;
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- int returnValue = 1; /* always return 1, not checked by dix/window.c */
+ int returnValue = 1; /* always return 1, not checked by dix/window.c */
- if(!pDRIPriv) return returnValue;
+ if (!pDRIPriv)
+ return returnValue;
/* call lower wrapped functions */
- if(pDRIPriv->wrap.ValidateTree) {
- /* unwrap */
- pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
+ if (pDRIPriv->wrap.ValidateTree) {
+ /* unwrap */
+ pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
- /* call lower layers */
- returnValue = (*pScreen->ValidateTree)(pParent, pChild, kind);
+ /* call lower layers */
+ returnValue = (*pScreen->ValidateTree) (pParent, pChild, kind);
- /* rewrap */
- pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
- pScreen->ValidateTree = DRIValidateTree;
+ /* rewrap */
+ pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
+ pScreen->ValidateTree = DRIValidateTree;
}
return returnValue;
@@ -2088,22 +2088,24 @@ DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
DRIScreenPrivPtr pDRIPriv;
if (pParent) {
- pScreen = pParent->drawable.pScreen;
- } else {
- pScreen = pChild->drawable.pScreen;
+ pScreen = pParent->drawable.pScreen;
}
- if(!(pDRIPriv = DRI_SCREEN_PRIV(pScreen))) return;
+ else {
+ pScreen = pChild->drawable.pScreen;
+ }
+ if (!(pDRIPriv = DRI_SCREEN_PRIV(pScreen)))
+ return;
if (pDRIPriv->wrap.PostValidateTree) {
- /* unwrap */
- pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
+ /* unwrap */
+ pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
- /* call lower layers */
- (*pScreen->PostValidateTree)(pParent, pChild, kind);
+ /* call lower layers */
+ (*pScreen->PostValidateTree) (pParent, pChild, kind);
- /* rewrap */
- pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
- pScreen->PostValidateTree = DRIPostValidateTree;
+ /* rewrap */
+ pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
+ pScreen->PostValidateTree = DRIPostValidateTree;
}
}
@@ -2112,45 +2114,46 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- DRIDrawablePrivPtr pDRIDrawablePriv;
+ DRIDrawablePrivPtr pDRIDrawablePriv;
- if(!pDRIPriv) return;
+ if (!pDRIPriv)
+ return;
if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
int nrects = RegionNumRects(&pWin->clipList);
- if(!pDRIPriv->windowsTouched) {
+ if (!pDRIPriv->windowsTouched) {
DRILockTree(pScreen);
pDRIPriv->windowsTouched = TRUE;
}
- if (nrects && !pDRIDrawablePriv->nrects)
- DRIIncreaseNumberVisible(pScreen);
- else if (!nrects && pDRIDrawablePriv->nrects)
- DRIDecreaseNumberVisible(pScreen);
- else
- DRIDriverClipNotify(pScreen);
+ if (nrects && !pDRIDrawablePriv->nrects)
+ DRIIncreaseNumberVisible(pScreen);
+ else if (!nrects && pDRIDrawablePriv->nrects)
+ DRIDecreaseNumberVisible(pScreen);
+ else
+ DRIDriverClipNotify(pScreen);
- pDRIDrawablePriv->nrects = nrects;
+ pDRIDrawablePriv->nrects = nrects;
- pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
- = DRIDrawableValidationStamp++;
+ pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
+ = DRIDrawableValidationStamp++;
- drmUpdateDrawableInfo(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable,
- DRM_DRAWABLE_CLIPRECTS,
- nrects, RegionRects(&pWin->clipList));
+ drmUpdateDrawableInfo(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable,
+ DRM_DRAWABLE_CLIPRECTS,
+ nrects, RegionRects(&pWin->clipList));
}
/* call lower wrapped functions */
- if(pDRIPriv->wrap.ClipNotify) {
+ if (pDRIPriv->wrap.ClipNotify) {
- /* unwrap */
+ /* unwrap */
pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify;
- /* call lower layers */
- (*pScreen->ClipNotify)(pWin, dx, dy);
+ /* call lower layers */
+ (*pScreen->ClipNotify) (pWin, dx, dy);
- /* rewrap */
+ /* rewrap */
pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify;
pScreen->ClipNotify = DRIClipNotify;
}
@@ -2165,10 +2168,10 @@ DRIGetDrawableIndex(WindowPtr pWin)
CARD32 index;
if (pDRIDrawablePriv) {
- index = pDRIDrawablePriv->drawableIndex;
+ index = pDRIDrawablePriv->drawableIndex;
}
else {
- index = pDRIPriv->pDriverInfo->ddxDrawableTableEntry;
+ index = pDRIPriv->pDriverInfo->ddxDrawableTableEntry;
}
return index;
@@ -2178,16 +2181,16 @@ unsigned int
DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
return pDRIPriv->pSAREA->drawableTable[drawable_index].stamp;
}
-
void
DRIPrintDrawableLock(ScreenPtr pScreen, char *msg)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- ErrorF("%s: %d\n", msg, pDRIPriv->pSAREA->drawable_lock.lock);
+ ErrorF("%s: %d\n", msg, pDRIPriv->pSAREA->drawable_lock.lock);
}
void
@@ -2195,18 +2198,20 @@ DRILock(ScreenPtr pScreen, int flags)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if(!pDRIPriv || !pDRIPriv->pLockRefCount) return;
+ if (!pDRIPriv || !pDRIPriv->pLockRefCount)
+ return;
if (!*pDRIPriv->pLockRefCount) {
- DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext, flags);
- *pDRIPriv->pLockingContext = pDRIPriv->myContext;
- } else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "[DRI] Locking deadlock.\n"
- "\tAlready locked with context %d,\n"
- "\ttrying to lock with context %d.\n",
- pDRIPriv->pLockingContext,
- pDRIPriv->myContext);
+ DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext,
+ flags);
+ *pDRIPriv->pLockingContext = pDRIPriv->myContext;
+ }
+ else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] Locking deadlock.\n"
+ "\tAlready locked with context %d,\n"
+ "\ttrying to lock with context %d.\n",
+ pDRIPriv->pLockingContext, pDRIPriv->myContext);
}
(*pDRIPriv->pLockRefCount)++;
}
@@ -2216,23 +2221,24 @@ DRIUnlock(ScreenPtr pScreen)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if(!pDRIPriv || !pDRIPriv->pLockRefCount) return;
+ if (!pDRIPriv || !pDRIPriv->pLockRefCount)
+ return;
if (*pDRIPriv->pLockRefCount > 0) {
- if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) {
- DRIDrvMsg(pScreen->myNum, X_ERROR,
- "[DRI] Unlocking inconsistency:\n"
- "\tContext %d trying to unlock lock held by context %d\n",
- pDRIPriv->pLockingContext,
- pDRIPriv->myContext);
- }
- (*pDRIPriv->pLockRefCount)--;
- } else {
+ if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] Unlocking inconsistency:\n"
+ "\tContext %d trying to unlock lock held by context %d\n",
+ pDRIPriv->pLockingContext, pDRIPriv->myContext);
+ }
+ (*pDRIPriv->pLockRefCount)--;
+ }
+ else {
DRIDrvMsg(pScreen->myNum, X_ERROR,
- "DRIUnlock called when not locked.\n");
+ "DRIUnlock called when not locked.\n");
return;
}
- if (! *pDRIPriv->pLockRefCount)
+ if (!*pDRIPriv->pLockRefCount)
DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext);
}
@@ -2240,30 +2246,35 @@ void *
DRIGetSAREAPrivate(ScreenPtr pScreen)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if (!pDRIPriv) return 0;
- return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec));
+ if (!pDRIPriv)
+ return 0;
+
+ return (void *) (((char *) pDRIPriv->pSAREA) + sizeof(XF86DRISAREARec));
}
drm_context_t
DRIGetContext(ScreenPtr pScreen)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if (!pDRIPriv) return 0;
+
+ if (!pDRIPriv)
+ return 0;
return pDRIPriv->myContext;
}
void
DRIGetTexOffsetFuncs(ScreenPtr pScreen,
- DRITexOffsetStartProcPtr *texOffsetStartFunc,
- DRITexOffsetFinishProcPtr *texOffsetFinishFunc)
+ DRITexOffsetStartProcPtr * texOffsetStartFunc,
+ DRITexOffsetFinishProcPtr * texOffsetFinishFunc)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if (!pDRIPriv) return;
+ if (!pDRIPriv)
+ return;
- *texOffsetStartFunc = pDRIPriv->pDriverInfo->texOffsetStart;
+ *texOffsetStartFunc = pDRIPriv->pDriverInfo->texOffsetStart;
*texOffsetFinishFunc = pDRIPriv->pDriverInfo->texOffsetFinish;
}
@@ -2279,9 +2290,7 @@ DRIGetWrappedFuncs(ScreenPtr pScreen)
/* note that this returns the library version, not the protocol version */
void
-DRIQueryVersion(int *majorVersion,
- int *minorVersion,
- int *patchVersion)
+DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion)
{
*majorVersion = DRIINFO_MAJOR_VERSION;
*minorVersion = DRIINFO_MINOR_VERSION;
@@ -2291,51 +2300,57 @@ DRIQueryVersion(int *majorVersion,
static void
_DRIAdjustFrame(ScrnInfoPtr pScrn, DRIScreenPrivPtr pDRIPriv, int x, int y)
{
- pDRIPriv->pSAREA->frame.x = x;
- pDRIPriv->pSAREA->frame.y = y;
- pDRIPriv->pSAREA->frame.width = pScrn->frameX1 - x + 1;
+ pDRIPriv->pSAREA->frame.x = x;
+ pDRIPriv->pSAREA->frame.y = y;
+ pDRIPriv->pSAREA->frame.width = pScrn->frameX1 - x + 1;
pDRIPriv->pSAREA->frame.height = pScrn->frameY1 - y + 1;
}
void
DRIAdjustFrame(int scrnIndex, int x, int y, int flags)
{
- ScreenPtr pScreen = screenInfo.screens[scrnIndex];
+ ScreenPtr pScreen = screenInfo.screens[scrnIndex];
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- int px, py;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int px, py;
if (!pDRIPriv || !pDRIPriv->pSAREA) {
- DRIDrvMsg(scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n",
- pDRIPriv, pDRIPriv ? pDRIPriv->pSAREA : NULL);
- return;
+ DRIDrvMsg(scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n",
+ pDRIPriv, pDRIPriv ? pDRIPriv->pSAREA : NULL);
+ return;
}
if (pDRIPriv->fullscreen) {
- /* Fix up frame */
- pScrn->frameX0 = pDRIPriv->pSAREA->frame.x;
- pScrn->frameY0 = pDRIPriv->pSAREA->frame.y;
- pScrn->frameX1 = pScrn->frameX0 + pDRIPriv->pSAREA->frame.width - 1;
- pScrn->frameY1 = pScrn->frameY0 + pDRIPriv->pSAREA->frame.height - 1;
-
- /* Fix up cursor */
- miPointerGetPosition(inputInfo.pointer, &px, &py);
- if (px < pScrn->frameX0) px = pScrn->frameX0;
- if (px > pScrn->frameX1) px = pScrn->frameX1;
- if (py < pScrn->frameY0) py = pScrn->frameY0;
- if (py > pScrn->frameY1) py = pScrn->frameY1;
- pScreen->SetCursorPosition(inputInfo.pointer, pScreen, px, py, TRUE);
- return;
+ /* Fix up frame */
+ pScrn->frameX0 = pDRIPriv->pSAREA->frame.x;
+ pScrn->frameY0 = pDRIPriv->pSAREA->frame.y;
+ pScrn->frameX1 = pScrn->frameX0 + pDRIPriv->pSAREA->frame.width - 1;
+ pScrn->frameY1 = pScrn->frameY0 + pDRIPriv->pSAREA->frame.height - 1;
+
+ /* Fix up cursor */
+ miPointerGetPosition(inputInfo.pointer, &px, &py);
+
+ if (px < pScrn->frameX0)
+ px = pScrn->frameX0;
+ if (px > pScrn->frameX1)
+ px = pScrn->frameX1;
+ if (py < pScrn->frameY0)
+ py = pScrn->frameY0;
+ if (py > pScrn->frameY1)
+ py = pScrn->frameY1;
+ pScreen->SetCursorPosition(inputInfo.pointer, pScreen, px, py, TRUE);
+
+ return;
}
if (pDRIPriv->wrap.AdjustFrame) {
- /* unwrap */
- pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
- /* call lower layers */
- (*pScrn->AdjustFrame)(scrnIndex, x, y, flags);
- /* rewrap */
- pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame;
- pScrn->AdjustFrame = DRIAdjustFrame;
+ /* unwrap */
+ pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
+ /* call lower layers */
+ (*pScrn->AdjustFrame) (scrnIndex, x, y, flags);
+ /* rewrap */
+ pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame;
+ pScrn->AdjustFrame = DRIAdjustFrame;
}
_DRIAdjustFrame(pScrn, pDRIPriv, x, y);
@@ -2350,145 +2365,147 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags)
*/
void
-DRIMoveBuffersHelper(
- ScreenPtr pScreen,
- int dx,
- int dy,
- int *xdir,
- int *ydir,
- RegionPtr reg
-)
-{
- BoxPtr extents, pbox, firstBox, lastBox;
- BoxRec tmpBox;
- int y, nbox;
-
- extents = RegionExtents(reg);
- nbox = RegionNumRects(reg);
- pbox = RegionRects(reg);
-
- if((dy > 0) && (dy < (extents->y2 - extents->y1))) {
- *ydir = -1;
- if(nbox > 1) {
- firstBox = pbox;
- lastBox = pbox + nbox - 1;
- while((unsigned long)firstBox < (unsigned long)lastBox) {
- tmpBox = *firstBox;
- *firstBox = *lastBox;
- *lastBox = tmpBox;
- firstBox++;
- lastBox--;
+DRIMoveBuffersHelper(ScreenPtr pScreen,
+ int dx, int dy, int *xdir, int *ydir, RegionPtr reg)
+{
+ BoxPtr extents, pbox, firstBox, lastBox;
+ BoxRec tmpBox;
+ int y, nbox;
+
+ extents = RegionExtents(reg);
+ nbox = RegionNumRects(reg);
+ pbox = RegionRects(reg);
+
+ if ((dy > 0) && (dy < (extents->y2 - extents->y1))) {
+ *ydir = -1;
+ if (nbox > 1) {
+ firstBox = pbox;
+ lastBox = pbox + nbox - 1;
+ while ((unsigned long) firstBox < (unsigned long) lastBox) {
+ tmpBox = *firstBox;
+ *firstBox = *lastBox;
+ *lastBox = tmpBox;
+ firstBox++;
+ lastBox--;
+ }
}
- }
- } else *ydir = 1;
-
- if((dx > 0) && (dx < (extents->x2 - extents->x1))) {
- *xdir = -1;
- if(nbox > 1) {
- firstBox = lastBox = pbox;
- y = pbox->y1;
- while(--nbox) {
- pbox++;
- if(pbox->y1 == y) lastBox++;
- else {
- while((unsigned long)firstBox < (unsigned long)lastBox) {
- tmpBox = *firstBox;
- *firstBox = *lastBox;
- *lastBox = tmpBox;
- firstBox++;
- lastBox--;
- }
-
- firstBox = lastBox = pbox;
- y = pbox->y1;
- }
- }
- while((unsigned long)firstBox < (unsigned long)lastBox) {
- tmpBox = *firstBox;
- *firstBox = *lastBox;
- *lastBox = tmpBox;
- firstBox++;
- lastBox--;
+ }
+ else
+ *ydir = 1;
+
+ if ((dx > 0) && (dx < (extents->x2 - extents->x1))) {
+ *xdir = -1;
+ if (nbox > 1) {
+ firstBox = lastBox = pbox;
+ y = pbox->y1;
+ while (--nbox) {
+ pbox++;
+ if (pbox->y1 == y)
+ lastBox++;
+ else {
+ while ((unsigned long) firstBox < (unsigned long) lastBox) {
+ tmpBox = *firstBox;
+ *firstBox = *lastBox;
+ *lastBox = tmpBox;
+ firstBox++;
+ lastBox--;
+ }
+
+ firstBox = lastBox = pbox;
+ y = pbox->y1;
+ }
+ }
+ while ((unsigned long) firstBox < (unsigned long) lastBox) {
+ tmpBox = *firstBox;
+ *firstBox = *lastBox;
+ *lastBox = tmpBox;
+ firstBox++;
+ lastBox--;
+ }
}
- }
- } else *xdir = 1;
+ }
+ else
+ *xdir = 1;
}
char *
-DRICreatePCIBusID(const struct pci_device * dev)
+DRICreatePCIBusID(const struct pci_device *dev)
{
char *busID;
if (asprintf(&busID, "pci:%04x:%02x:%02x.%d",
- dev->domain, dev->bus, dev->dev, dev->func) == -1)
- return NULL;
+ dev->domain, dev->bus, dev->dev, dev->func) == -1)
+ return NULL;
return busID;
}
-static void drmSIGIOHandler(int interrupt, void *closure)
+static void
+drmSIGIOHandler(int interrupt, void *closure)
{
unsigned long key;
- void *value;
- ssize_t count;
- drm_ctx_t ctx;
- typedef void (*_drmCallback)(int, void *, void *);
- char buf[256];
- drm_context_t old;
- drm_context_t new;
- void *oldctx;
- void *newctx;
- char *pt;
- drmHashEntry *entry;
+ void *value;
+ ssize_t count;
+ drm_ctx_t ctx;
+ typedef void (*_drmCallback) (int, void *, void *);
+ char buf[256];
+ drm_context_t old;
+ drm_context_t new;
+ void *oldctx;
+ void *newctx;
+ char *pt;
+ drmHashEntry *entry;
void *hash_table;
hash_table = drmGetHashTable();
- if (!hash_table) return;
+ if (!hash_table)
+ return;
if (drmHashFirst(hash_table, &key, &value)) {
- entry = value;
- do {
+ entry = value;
+ do {
#if 0
- fprintf(stderr, "Trying %d\n", entry->fd);
+ fprintf(stderr, "Trying %d\n", entry->fd);
#endif
- if ((count = read(entry->fd, buf, sizeof(buf) - 1)) > 0) {
- buf[count] = '\0';
+ if ((count = read(entry->fd, buf, sizeof(buf) - 1)) > 0) {
+ buf[count] = '\0';
#if 0
- fprintf(stderr, "Got %s\n", buf);
+ fprintf(stderr, "Got %s\n", buf);
#endif
- for (pt = buf; *pt != ' '; ++pt); /* Find first space */
- ++pt;
- old = strtol(pt, &pt, 0);
- new = strtol(pt, NULL, 0);
- oldctx = drmGetContextTag(entry->fd, old);
- newctx = drmGetContextTag(entry->fd, new);
+ for (pt = buf; *pt != ' '; ++pt); /* Find first space */
+ ++pt;
+ old = strtol(pt, &pt, 0);
+ new = strtol(pt, NULL, 0);
+ oldctx = drmGetContextTag(entry->fd, old);
+ newctx = drmGetContextTag(entry->fd, new);
#if 0
- fprintf(stderr, "%d %d %p %p\n", old, new, oldctx, newctx);
+ fprintf(stderr, "%d %d %p %p\n", old, new, oldctx, newctx);
#endif
- ((_drmCallback)entry->f)(entry->fd, oldctx, newctx);
- ctx.handle = new;
- ioctl(entry->fd, DRM_IOCTL_NEW_CTX, &ctx);
- }
- } while (drmHashNext(hash_table, &key, &value));
+ ((_drmCallback) entry->f) (entry->fd, oldctx, newctx);
+ ctx.handle = new;
+ ioctl(entry->fd, DRM_IOCTL_NEW_CTX, &ctx);
+ }
+ } while (drmHashNext(hash_table, &key, &value));
}
}
-
-int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *))
+int
+drmInstallSIGIOHandler(int fd, void (*f) (int, void *, void *))
{
- drmHashEntry *entry;
+ drmHashEntry *entry;
- entry = drmGetEntry(fd);
- entry->f = f;
+ entry = drmGetEntry(fd);
+ entry->f = f;
return xf86InstallSIGIOHandler(fd, drmSIGIOHandler, 0);
}
-int drmRemoveSIGIOHandler(int fd)
+int
+drmRemoveSIGIOHandler(int fd)
{
- drmHashEntry *entry = drmGetEntry(fd);
+ drmHashEntry *entry = drmGetEntry(fd);
entry->f = NULL;
diff --git a/xorg-server/hw/xfree86/dri/dri.h b/xorg-server/hw/xfree86/dri/dri.h
index f690e234b..53458bb4a 100644
--- a/xorg-server/hw/xfree86/dri/dri.h
+++ b/xorg-server/hw/xfree86/dri/dri.h
@@ -50,11 +50,10 @@ typedef int DRIContextType;
typedef struct _DRIContextPrivRec DRIContextPrivRec, *DRIContextPrivPtr;
-typedef enum _DRIContextFlags
-{
- DRI_CONTEXT_2DONLY = 0x01,
+typedef enum _DRIContextFlags {
+ DRI_CONTEXT_2DONLY = 0x01,
DRI_CONTEXT_PRESERVED = 0x02,
- DRI_CONTEXT_RESERVED = 0x04 /* DRI Only -- no kernel equivalent */
+ DRI_CONTEXT_RESERVED = 0x04 /* DRI Only -- no kernel equivalent */
} DRIContextFlags;
#define DRI_NO_CONTEXT 0
@@ -73,10 +72,8 @@ typedef int DRIWindowRequests;
#define DRI_3D_WINDOWS_ONLY 1
#define DRI_ALL_WINDOWS 2
-
-typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
-typedef void (*AdjustFramePtr)(int scrnIndex, int x, int y, int flags);
-
+typedef void (*ClipNotifyPtr) (WindowPtr, int, int);
+typedef void (*AdjustFramePtr) (int scrnIndex, int x, int y, int flags);
/*
* These functions can be wrapped by the DRI. Each of these have
@@ -84,17 +81,16 @@ typedef void (*AdjustFramePtr)(int scrnIndex, int x, int y, int flags);
* overridden by the driver in its [driver]DRIScreenInit function.
*/
typedef struct {
- ScreenWakeupHandlerProcPtr WakeupHandler;
- ScreenBlockHandlerProcPtr BlockHandler;
- WindowExposuresProcPtr WindowExposures;
- CopyWindowProcPtr CopyWindow;
- ValidateTreeProcPtr ValidateTree;
- PostValidateTreeProcPtr PostValidateTree;
- ClipNotifyProcPtr ClipNotify;
- AdjustFramePtr AdjustFrame;
+ ScreenWakeupHandlerProcPtr WakeupHandler;
+ ScreenBlockHandlerProcPtr BlockHandler;
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ ClipNotifyProcPtr ClipNotify;
+ AdjustFramePtr AdjustFrame;
} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
-
/*
* Prior to Xorg 6.8.99.8, the DRIInfoRec structure was implicitly versioned
* by the XF86DRI_*_VERSION defines in xf86dristr.h. These numbers were also
@@ -112,8 +108,8 @@ typedef struct {
#define DRIINFO_MINOR_VERSION 4
#define DRIINFO_PATCH_VERSION 0
-typedef unsigned long long (*DRITexOffsetStartProcPtr)(PixmapPtr pPix);
-typedef void (*DRITexOffsetFinishProcPtr)(PixmapPtr pPix);
+typedef unsigned long long (*DRITexOffsetStartProcPtr) (PixmapPtr pPix);
+typedef void (*DRITexOffsetFinishProcPtr) (PixmapPtr pPix);
typedef struct {
/* driver call back functions
@@ -123,88 +119,81 @@ typedef struct {
* Bump the DRIINFO minor number to indicate new fields.
* Bump the DRIINFO major number to indicate binary-incompatible changes.
*/
- Bool (*CreateContext)(ScreenPtr pScreen,
- VisualPtr visual,
- drm_context_t hHWContext,
- void* pVisualConfigPriv,
- DRIContextType context);
- void (*DestroyContext)(ScreenPtr pScreen,
- drm_context_t hHWContext,
- DRIContextType context);
- void (*SwapContext)(ScreenPtr pScreen,
- DRISyncType syncType,
- DRIContextType readContextType,
- void* readContextStore,
- DRIContextType writeContextType,
- void* writeContextStore);
- void (*InitBuffers)(WindowPtr pWin,
- RegionPtr prgn,
- CARD32 indx);
- void (*MoveBuffers)(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc,
- CARD32 indx);
- void (*TransitionTo3d)(ScreenPtr pScreen);
- void (*TransitionTo2d)(ScreenPtr pScreen);
-
- void (*SetDrawableIndex)(WindowPtr pWin, CARD32 indx);
- Bool (*OpenFullScreen)(ScreenPtr pScreen);
- Bool (*CloseFullScreen)(ScreenPtr pScreen);
+ Bool (*CreateContext) (ScreenPtr pScreen,
+ VisualPtr visual,
+ drm_context_t hHWContext,
+ void *pVisualConfigPriv, DRIContextType context);
+ void (*DestroyContext) (ScreenPtr pScreen,
+ drm_context_t hHWContext, DRIContextType context);
+ void (*SwapContext) (ScreenPtr pScreen,
+ DRISyncType syncType,
+ DRIContextType readContextType,
+ void *readContextStore,
+ DRIContextType writeContextType,
+ void *writeContextStore);
+ void (*InitBuffers) (WindowPtr pWin, RegionPtr prgn, CARD32 indx);
+ void (*MoveBuffers) (WindowPtr pWin,
+ DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 indx);
+ void (*TransitionTo3d) (ScreenPtr pScreen);
+ void (*TransitionTo2d) (ScreenPtr pScreen);
+
+ void (*SetDrawableIndex) (WindowPtr pWin, CARD32 indx);
+ Bool (*OpenFullScreen) (ScreenPtr pScreen);
+ Bool (*CloseFullScreen) (ScreenPtr pScreen);
/* wrapped functions */
- DRIWrappedFuncsRec wrap;
+ DRIWrappedFuncsRec wrap;
/* device info */
- char* drmDriverName;
- char* clientDriverName;
- char* busIdString;
- int ddxDriverMajorVersion;
- int ddxDriverMinorVersion;
- int ddxDriverPatchVersion;
- pointer frameBufferPhysicalAddress;
- long frameBufferSize;
- long frameBufferStride;
- long SAREASize;
- int maxDrawableTableEntry;
- int ddxDrawableTableEntry;
- long contextSize;
- DRISwapMethod driverSwapMethod;
- DRIWindowRequests bufferRequests;
- int devPrivateSize;
- void* devPrivate;
- Bool createDummyCtx;
- Bool createDummyCtxPriv;
+ char *drmDriverName;
+ char *clientDriverName;
+ char *busIdString;
+ int ddxDriverMajorVersion;
+ int ddxDriverMinorVersion;
+ int ddxDriverPatchVersion;
+ pointer frameBufferPhysicalAddress;
+ long frameBufferSize;
+ long frameBufferStride;
+ long SAREASize;
+ int maxDrawableTableEntry;
+ int ddxDrawableTableEntry;
+ long contextSize;
+ DRISwapMethod driverSwapMethod;
+ DRIWindowRequests bufferRequests;
+ int devPrivateSize;
+ void *devPrivate;
+ Bool createDummyCtx;
+ Bool createDummyCtxPriv;
/* New with DRI version 4.1.0 */
- void (*TransitionSingleToMulti3D)(ScreenPtr pScreen);
- void (*TransitionMultiToSingle3D)(ScreenPtr pScreen);
+ void (*TransitionSingleToMulti3D) (ScreenPtr pScreen);
+ void (*TransitionMultiToSingle3D) (ScreenPtr pScreen);
/* New with DRI version 5.1.0 */
- void (*ClipNotify)(ScreenPtr pScreen, WindowPtr *ppWin, int num);
+ void (*ClipNotify) (ScreenPtr pScreen, WindowPtr *ppWin, int num);
/* New with DRI version 5.2.0 */
- Bool allocSarea;
- Bool keepFDOpen;
+ Bool allocSarea;
+ Bool keepFDOpen;
/* New with DRI version 5.3.0 */
- DRITexOffsetStartProcPtr texOffsetStart;
+ DRITexOffsetStartProcPtr texOffsetStart;
DRITexOffsetFinishProcPtr texOffsetFinish;
/* New with DRI version 5.4.0 */
- int dontMapFrameBuffer;
- drm_handle_t hFrameBuffer; /* Handle to framebuffer, either
- * mapped by DDX driver or DRI */
-
-} DRIInfoRec, *DRIInfoPtr;
+ int dontMapFrameBuffer;
+ drm_handle_t hFrameBuffer; /* Handle to framebuffer, either
+ * mapped by DDX driver or DRI */
+} DRIInfoRec, *DRIInfoPtr;
-extern _X_EXPORT Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn, unsigned long sAreaSize,
- const char *busID,
- const char *drmDriverName);
+extern _X_EXPORT Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn,
+ unsigned long sAreaSize,
+ const char *busID,
+ const char *drmDriverName);
extern _X_EXPORT Bool DRIScreenInit(ScreenPtr pScreen,
- DRIInfoPtr pDRIInfo,
- int *pDRMFD);
+ DRIInfoPtr pDRIInfo, int *pDRMFD);
extern _X_EXPORT void DRICloseScreen(ScreenPtr pScreen);
@@ -213,65 +202,62 @@ extern _X_EXPORT Bool DRIExtensionInit(void);
extern _X_EXPORT void DRIReset(void);
extern _X_EXPORT Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
- Bool *isCapable);
+ Bool *isCapable);
extern _X_EXPORT Bool DRIOpenConnection(ScreenPtr pScreen,
- drm_handle_t * hSAREA,
- char **busIdString);
+ drm_handle_t * hSAREA,
+ char **busIdString);
extern _X_EXPORT Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic);
extern _X_EXPORT Bool DRICloseConnection(ScreenPtr pScreen);
extern _X_EXPORT Bool DRIGetClientDriverName(ScreenPtr pScreen,
- int* ddxDriverMajorVersion,
- int* ddxDriverMinorVersion,
- int* ddxDriverPatchVersion,
- char** clientDriverName);
+ int *ddxDriverMajorVersion,
+ int *ddxDriverMinorVersion,
+ int *ddxDriverPatchVersion,
+ char **clientDriverName);
extern _X_EXPORT Bool DRICreateContext(ScreenPtr pScreen,
- VisualPtr visual,
- XID context,
- drm_context_t * pHWContext);
+ VisualPtr visual,
+ XID context, drm_context_t * pHWContext);
extern _X_EXPORT Bool DRIDestroyContext(ScreenPtr pScreen, XID context);
extern _X_EXPORT Bool DRIContextPrivDelete(pointer pResource, XID id);
extern _X_EXPORT Bool DRICreateDrawable(ScreenPtr pScreen,
- ClientPtr client,
- DrawablePtr pDrawable,
- drm_drawable_t * hHWDrawable);
+ ClientPtr client,
+ DrawablePtr pDrawable,
+ drm_drawable_t * hHWDrawable);
extern _X_EXPORT Bool DRIDestroyDrawable(ScreenPtr pScreen,
- ClientPtr client,
- DrawablePtr pDrawable);
+ ClientPtr client,
+ DrawablePtr pDrawable);
-extern _X_EXPORT Bool DRIDrawablePrivDelete(pointer pResource,
- XID id);
+extern _X_EXPORT Bool DRIDrawablePrivDelete(pointer pResource, XID id);
extern _X_EXPORT Bool DRIGetDrawableInfo(ScreenPtr pScreen,
- DrawablePtr pDrawable,
- unsigned int* indx,
- unsigned int* stamp,
- int* X,
- int* Y,
- int* W,
- int* H,
- int* numClipRects,
- drm_clip_rect_t ** pClipRects,
- int* backX,
- int* backY,
- int* numBackClipRects,
- drm_clip_rect_t ** pBackClipRects);
+ DrawablePtr pDrawable,
+ unsigned int *indx,
+ unsigned int *stamp,
+ int *X,
+ int *Y,
+ int *W,
+ int *H,
+ int *numClipRects,
+ drm_clip_rect_t ** pClipRects,
+ int *backX,
+ int *backY,
+ int *numBackClipRects,
+ drm_clip_rect_t ** pBackClipRects);
extern _X_EXPORT Bool DRIGetDeviceInfo(ScreenPtr pScreen,
- drm_handle_t * hFrameBuffer,
- int* fbOrigin,
- int* fbSize,
- int* fbStride,
- int* devPrivateSize,
- void** pDevPrivate);
+ drm_handle_t * hFrameBuffer,
+ int *fbOrigin,
+ int *fbSize,
+ int *fbStride,
+ int *devPrivateSize, void **pDevPrivate);
extern _X_EXPORT DRIInfoPtr DRICreateInfoRec(void);
@@ -280,50 +266,39 @@ extern _X_EXPORT void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
extern _X_EXPORT Bool DRIFinishScreenInit(ScreenPtr pScreen);
extern _X_EXPORT void DRIWakeupHandler(pointer wakeupData,
- int result,
- pointer pReadmask);
+ int result, pointer pReadmask);
extern _X_EXPORT void DRIBlockHandler(pointer blockData,
- OSTimePtr pTimeout,
- pointer pReadmask);
+ OSTimePtr pTimeout, pointer pReadmask);
extern _X_EXPORT void DRIDoWakeupHandler(int screenNum,
- pointer wakeupData,
- unsigned long result,
- pointer pReadmask);
+ pointer wakeupData,
+ unsigned long result,
+ pointer pReadmask);
extern _X_EXPORT void DRIDoBlockHandler(int screenNum,
- pointer blockData,
- pointer pTimeout,
- pointer pReadmask);
+ pointer blockData,
+ pointer pTimeout, pointer pReadmask);
-extern _X_EXPORT void DRISwapContext(int drmFD,
- void *oldctx,
- void *newctx);
+extern _X_EXPORT void DRISwapContext(int drmFD, void *oldctx, void *newctx);
extern _X_EXPORT void *DRIGetContextStore(DRIContextPrivPtr context);
extern _X_EXPORT void DRIWindowExposures(WindowPtr pWin,
- RegionPtr prgn,
- RegionPtr bsreg);
+ RegionPtr prgn, RegionPtr bsreg);
extern _X_EXPORT Bool DRIDestroyWindow(WindowPtr pWin);
extern _X_EXPORT void DRICopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
+ DDXPointRec ptOldOrg, RegionPtr prgnSrc);
extern _X_EXPORT int DRIValidateTree(WindowPtr pParent,
- WindowPtr pChild,
- VTKind kind);
+ WindowPtr pChild, VTKind kind);
extern _X_EXPORT void DRIPostValidateTree(WindowPtr pParent,
- WindowPtr pChild,
- VTKind kind);
+ WindowPtr pChild, VTKind kind);
-extern _X_EXPORT void DRIClipNotify(WindowPtr pWin,
- int dx,
- int dy);
+extern _X_EXPORT void DRIClipNotify(WindowPtr pWin, int dx, int dy);
extern _X_EXPORT CARD32 DRIGetDrawableIndex(WindowPtr pWin);
@@ -338,36 +313,38 @@ extern _X_EXPORT DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
extern _X_EXPORT void *DRIGetSAREAPrivate(ScreenPtr pScreen);
extern _X_EXPORT unsigned int DRIGetDrawableStamp(ScreenPtr pScreen,
- CARD32 drawable_index);
+ CARD32 drawable_index);
extern _X_EXPORT DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen,
- drm_context_t * pHWContext,
- DRIContextFlags flags);
-
-extern _X_EXPORT DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen,
- drm_context_t hHWContext,
+ drm_context_t *
+ pHWContext,
DRIContextFlags flags);
+extern _X_EXPORT DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr
+ pScreen,
+ drm_context_t
+ hHWContext,
+ DRIContextFlags
+ flags);
+
extern _X_EXPORT Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv);
extern _X_EXPORT drm_context_t DRIGetContext(ScreenPtr pScreen);
extern _X_EXPORT void DRIQueryVersion(int *majorVersion,
- int *minorVersion,
- int *patchVersion);
+ int *minorVersion, int *patchVersion);
extern _X_EXPORT void DRIAdjustFrame(int scrnIndex, int x, int y, int flags);
extern _X_EXPORT void DRIMoveBuffersHelper(ScreenPtr pScreen,
- int dx,
- int dy,
- int *xdir,
- int *ydir,
- RegionPtr reg);
+ int dx,
+ int dy,
+ int *xdir, int *ydir, RegionPtr reg);
extern _X_EXPORT char *DRICreatePCIBusID(const struct pci_device *PciInfo);
-extern _X_EXPORT int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *));
+extern _X_EXPORT int drmInstallSIGIOHandler(int fd,
+ void (*f) (int, void *, void *));
extern _X_EXPORT int drmRemoveSIGIOHandler(int fd);
extern _X_EXPORT int DRIMasterFD(ScrnInfoPtr pScrn);
@@ -376,8 +353,10 @@ extern _X_EXPORT void *DRIMasterSareaPointer(ScrnInfoPtr pScrn);
extern _X_EXPORT drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn);
extern _X_EXPORT void DRIGetTexOffsetFuncs(ScreenPtr pScreen,
- DRITexOffsetStartProcPtr *texOffsetStartFunc,
- DRITexOffsetFinishProcPtr *texOffsetFinishFunc);
+ DRITexOffsetStartProcPtr *
+ texOffsetStartFunc,
+ DRITexOffsetFinishProcPtr *
+ texOffsetFinishFunc);
#define _DRI_H_
diff --git a/xorg-server/hw/xfree86/dri/drimodule.c b/xorg-server/hw/xfree86/dri/drimodule.c
index 28f6ad8c0..83eca4eb9 100644
--- a/xorg-server/hw/xfree86/dri/drimodule.c
+++ b/xorg-server/hw/xfree86/dri/drimodule.c
@@ -44,26 +44,25 @@ static MODULESETUPPROTO(driSetup);
drmServerInfo DRIDRMServerInfo;
-static XF86ModuleVersionInfo VersRec =
-{
- "dri",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_EXTENSION,
- ABI_EXTENSION_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
+static XF86ModuleVersionInfo VersRec = {
+ "dri",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
};
extern void XFree86DRIExtensionInit(INITARGS);
+
#define _XF86DRI_SERVER_
#include <X11/dri/xf86driproto.h>
-static ExtensionModule XF86DRIExt =
-{
+static ExtensionModule XF86DRIExt = {
XFree86DRIExtensionInit,
XF86DRINAME,
&noXFree86DRIExtension,
@@ -79,15 +78,16 @@ driSetup(pointer module, pointer opts, int *errmaj, int *errmin)
static Bool setupDone = FALSE;
if (!setupDone) {
- setupDone = TRUE;
- LoadExtension(&XF86DRIExt, FALSE);
- } else {
- if (errmaj) *errmaj = LDR_ONCEONLY;
+ setupDone = TRUE;
+ LoadExtension(&XF86DRIExt, FALSE);
+ }
+ else {
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
}
drmSetServerInfo(&DRIDRMServerInfo);
/* Need a non-NULL return value to indicate success */
- return (pointer)1;
+ return (pointer) 1;
}
-
diff --git a/xorg-server/hw/xfree86/dri/dristruct.h b/xorg-server/hw/xfree86/dri/dristruct.h
index bbd158e11..9f944a793 100644
--- a/xorg-server/hw/xfree86/dri/dristruct.h
+++ b/xorg-server/hw/xfree86/dri/dristruct.h
@@ -1,129 +1,124 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Jens Owen <jens@tungstengraphics.com>
- *
- */
-
-#ifndef DRI_STRUCT_H
-#define DRI_STRUCT_H
-
-#include "xf86drm.h"
-#include "xf86Crtc.h"
-
-
-#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
- dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
-#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
- dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey))
-
-typedef struct _DRIDrawablePrivRec
-{
- drm_drawable_t hwDrawable;
- int drawableIndex;
- ScreenPtr pScreen;
- int refCount;
- int nrects;
-} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
-
-struct _DRIContextPrivRec
-{
- drm_context_t hwContext;
- ScreenPtr pScreen;
- Bool valid3D;
- DRIContextFlags flags;
- void** pContextStore;
-};
-
-#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
- (dixPrivateKeyRegistered(DRIScreenPrivKey) ? \
- dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey) : NULL))
-
-#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
- dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
- DRIScreenPrivKey))
-
-#define DRI_ENT_PRIV(pScrn) \
- ((DRIEntPrivIndex < 0) ? \
- NULL: \
- ((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \
- DRIEntPrivIndex)->ptr)))
-
-typedef struct _DRIScreenPrivRec
-{
- Bool directRenderingSupport;
- int drmFD; /* File descriptor for /dev/video/? */
- drm_handle_t hSAREA; /* Handle to SAREA, for mapping */
- XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */
- drm_context_t myContext; /* DDX Driver's context */
- DRIContextPrivPtr myContextPriv;/* Pointer to server's private area */
- DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */
- void** hiddenContextStore; /* hidden X context */
- void** partial3DContextStore; /* parital 3D context */
- DRIInfoPtr pDriverInfo;
- int nrWindows;
- int nrWindowsVisible;
- int nrWalked;
- drm_clip_rect_t private_buffer_rect; /* management of private buffers */
- DrawablePtr fullscreen; /* pointer to fullscreen drawable */
- drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
- DRIWrappedFuncsRec wrap;
- DestroyWindowProcPtr DestroyWindow;
- DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
- DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */
- Bool createDummyCtx;
- Bool createDummyCtxPriv;
- Bool grabbedDRILock;
- Bool drmSIGIOHandlerInstalled;
- Bool wrapped;
- Bool windowsTouched;
- int lockRefCount;
- drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */
- XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
- int* pLockRefCount;
- int* pLockingContext;
- xf86_crtc_notify_proc_ptr xf86_crtc_notify;
-} DRIScreenPrivRec, *DRIScreenPrivPtr;
-
-
-typedef struct _DRIEntPrivRec {
- int drmFD;
- Bool drmOpened;
- Bool sAreaGrabbed;
- drm_handle_t hLSAREA;
- XF86DRILSAREAPtr pLSAREA;
- unsigned long sAreaSize;
- int lockRefCount;
- int lockingContext;
- ScreenPtr resOwner;
- Bool keepFDOpen;
- int refCount;
-} DRIEntPrivRec, *DRIEntPrivPtr;
-
-#endif /* DRI_STRUCT_H */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Jens Owen <jens@tungstengraphics.com>
+ *
+ */
+
+#ifndef DRI_STRUCT_H
+#define DRI_STRUCT_H
+
+#include "xf86drm.h"
+#include "xf86Crtc.h"
+
+#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
+#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey))
+
+typedef struct _DRIDrawablePrivRec {
+ drm_drawable_t hwDrawable;
+ int drawableIndex;
+ ScreenPtr pScreen;
+ int refCount;
+ int nrects;
+} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
+
+struct _DRIContextPrivRec {
+ drm_context_t hwContext;
+ ScreenPtr pScreen;
+ Bool valid3D;
+ DRIContextFlags flags;
+ void **pContextStore;
+};
+
+#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
+ (dixPrivateKeyRegistered(DRIScreenPrivKey) ? \
+ dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey) : NULL))
+
+#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
+ dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
+ DRIScreenPrivKey))
+
+#define DRI_ENT_PRIV(pScrn) \
+ ((DRIEntPrivIndex < 0) ? \
+ NULL: \
+ ((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \
+ DRIEntPrivIndex)->ptr)))
+
+typedef struct _DRIScreenPrivRec {
+ Bool directRenderingSupport;
+ int drmFD; /* File descriptor for /dev/video/? */
+ drm_handle_t hSAREA; /* Handle to SAREA, for mapping */
+ XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */
+ drm_context_t myContext; /* DDX Driver's context */
+ DRIContextPrivPtr myContextPriv; /* Pointer to server's private area */
+ DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */
+ void **hiddenContextStore; /* hidden X context */
+ void **partial3DContextStore; /* parital 3D context */
+ DRIInfoPtr pDriverInfo;
+ int nrWindows;
+ int nrWindowsVisible;
+ int nrWalked;
+ drm_clip_rect_t private_buffer_rect; /* management of private buffers */
+ DrawablePtr fullscreen; /* pointer to fullscreen drawable */
+ drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
+ DRIWrappedFuncsRec wrap;
+ DestroyWindowProcPtr DestroyWindow;
+ DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
+ DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */
+ Bool createDummyCtx;
+ Bool createDummyCtxPriv;
+ Bool grabbedDRILock;
+ Bool drmSIGIOHandlerInstalled;
+ Bool wrapped;
+ Bool windowsTouched;
+ int lockRefCount;
+ drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */
+ XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
+ int *pLockRefCount;
+ int *pLockingContext;
+ xf86_crtc_notify_proc_ptr xf86_crtc_notify;
+} DRIScreenPrivRec, *DRIScreenPrivPtr;
+
+typedef struct _DRIEntPrivRec {
+ int drmFD;
+ Bool drmOpened;
+ Bool sAreaGrabbed;
+ drm_handle_t hLSAREA;
+ XF86DRILSAREAPtr pLSAREA;
+ unsigned long sAreaSize;
+ int lockRefCount;
+ int lockingContext;
+ ScreenPtr resOwner;
+ Bool keepFDOpen;
+ int refCount;
+} DRIEntPrivRec, *DRIEntPrivPtr;
+
+#endif /* DRI_STRUCT_H */
diff --git a/xorg-server/hw/xfree86/dri/xf86dri.c b/xorg-server/hw/xfree86/dri/xf86dri.c
index c35ba2f94..72ce8690d 100644
--- a/xorg-server/hw/xfree86/dri/xf86dri.c
+++ b/xorg-server/hw/xfree86/dri/xf86dri.c
@@ -63,27 +63,20 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
static int DRIErrorBase;
-
-
-static void XF86DRIResetProc(ExtensionEntry* extEntry);
+static void XF86DRIResetProc(ExtensionEntry * extEntry);
static unsigned char DRIReqCode = 0;
extern void XFree86DRIExtensionInit(void);
-/*ARGSUSED*/
-static void
-XF86DRIResetProc (
- ExtensionEntry* extEntry
-)
+ /*ARGSUSED*/ static void
+XF86DRIResetProc(ExtensionEntry * extEntry)
{
DRIReset();
}
static int
-ProcXF86DRIQueryVersion(
- register ClientPtr client
-)
+ProcXF86DRIQueryVersion(register ClientPtr client)
{
xXF86DRIQueryVersionReply rep;
@@ -95,109 +88,105 @@ ProcXF86DRIQueryVersion(
rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
- swapl(&rep.patchVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
+ swapl(&rep.patchVersion);
}
- WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *) &rep);
return Success;
}
static int
-ProcXF86DRIQueryDirectRenderingCapable(
- register ClientPtr client
-)
+ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
{
- xXF86DRIQueryDirectRenderingCapableReply rep;
+ xXF86DRIQueryDirectRenderingCapableReply rep;
Bool isCapable;
REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if (!DRIQueryDirectRenderingCapable( screenInfo.screens[stuff->screen],
- &isCapable)) {
- return BadValue;
+ if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen],
+ &isCapable)) {
+ return BadValue;
}
rep.isCapable = isCapable;
if (!LocalClient(client) || client->swapped)
- rep.isCapable = 0;
+ rep.isCapable = 0;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
- WriteToClient(client,
- sizeof(xXF86DRIQueryDirectRenderingCapableReply), (char *)&rep);
+ WriteToClient(client,
+ sizeof(xXF86DRIQueryDirectRenderingCapableReply),
+ (char *) &rep);
return Success;
}
static int
-ProcXF86DRIOpenConnection(
- register ClientPtr client
-)
+ProcXF86DRIOpenConnection(register ClientPtr client)
{
xXF86DRIOpenConnectionReply rep;
- drm_handle_t hSAREA;
- char* busIdString;
+ drm_handle_t hSAREA;
+ char *busIdString;
REQUEST(xXF86DRIOpenConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
- if (!DRIOpenConnection( screenInfo.screens[stuff->screen],
- &hSAREA,
- &busIdString)) {
- return BadValue;
+ if (!DRIOpenConnection(screenInfo.screens[stuff->screen],
+ &hSAREA, &busIdString)) {
+ return BadValue;
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.busIdStringLength = 0;
if (busIdString)
- rep.busIdStringLength = strlen(busIdString);
- rep.length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) - SIZEOF(xGenericReply) +
- pad_to_int32(rep.busIdStringLength));
+ rep.busIdStringLength = strlen(busIdString);
+ rep.length =
+ bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
+ SIZEOF(xGenericReply) +
+ pad_to_int32(rep.busIdStringLength));
- rep.hSAREALow = (CARD32)(hSAREA & 0xffffffff);
+ rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
#if defined(LONG64) && !defined(__linux__)
- rep.hSAREAHigh = (CARD32)(hSAREA >> 32);
+ rep.hSAREAHigh = (CARD32) (hSAREA >> 32);
#else
rep.hSAREAHigh = 0;
#endif
- WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *) &rep);
if (rep.busIdStringLength)
- WriteToClient(client, rep.busIdStringLength, busIdString);
+ WriteToClient(client, rep.busIdStringLength, busIdString);
return Success;
}
static int
-ProcXF86DRIAuthConnection(
- register ClientPtr client
-)
+ProcXF86DRIAuthConnection(register ClientPtr client)
{
xXF86DRIAuthConnectionReply rep;
-
+
REQUEST(xXF86DRIAuthConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
rep.type = X_Reply;
@@ -205,83 +194,75 @@ ProcXF86DRIAuthConnection(
rep.sequenceNumber = client->sequence;
rep.authenticated = 1;
- if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic)) {
- ErrorF("Failed to authenticate %lu\n", (unsigned long)stuff->magic);
- rep.authenticated = 0;
+ if (!DRIAuthConnection(screenInfo.screens[stuff->screen], stuff->magic)) {
+ ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
+ rep.authenticated = 0;
}
- WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *) &rep);
return Success;
}
static int
-ProcXF86DRICloseConnection(
- register ClientPtr client
-)
+ProcXF86DRICloseConnection(register ClientPtr client)
{
REQUEST(xXF86DRICloseConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRICloseConnectionReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
- DRICloseConnection( screenInfo.screens[stuff->screen]);
+ DRICloseConnection(screenInfo.screens[stuff->screen]);
return Success;
}
static int
-ProcXF86DRIGetClientDriverName(
- register ClientPtr client
-)
+ProcXF86DRIGetClientDriverName(register ClientPtr client)
{
- xXF86DRIGetClientDriverNameReply rep;
- char* clientDriverName;
+ xXF86DRIGetClientDriverNameReply rep;
+ char *clientDriverName;
REQUEST(xXF86DRIGetClientDriverNameReq);
REQUEST_SIZE_MATCH(xXF86DRIGetClientDriverNameReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
- DRIGetClientDriverName( screenInfo.screens[stuff->screen],
- (int *)&rep.ddxDriverMajorVersion,
- (int *)&rep.ddxDriverMinorVersion,
- (int *)&rep.ddxDriverPatchVersion,
- &clientDriverName);
+ DRIGetClientDriverName(screenInfo.screens[stuff->screen],
+ (int *) &rep.ddxDriverMajorVersion,
+ (int *) &rep.ddxDriverMinorVersion,
+ (int *) &rep.ddxDriverPatchVersion,
+ &clientDriverName);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.clientDriverNameLength = 0;
if (clientDriverName)
- rep.clientDriverNameLength = strlen(clientDriverName);
+ rep.clientDriverNameLength = strlen(clientDriverName);
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
- SIZEOF(xGenericReply) +
- pad_to_int32(rep.clientDriverNameLength));
+ SIZEOF(xGenericReply) +
+ pad_to_int32(rep.clientDriverNameLength));
- WriteToClient(client,
- sizeof(xXF86DRIGetClientDriverNameReply), (char *)&rep);
+ WriteToClient(client,
+ sizeof(xXF86DRIGetClientDriverNameReply), (char *) &rep);
if (rep.clientDriverNameLength)
- WriteToClient(client,
- rep.clientDriverNameLength,
- clientDriverName);
+ WriteToClient(client, rep.clientDriverNameLength, clientDriverName);
return Success;
}
static int
-ProcXF86DRICreateContext(
- register ClientPtr client
-)
+ProcXF86DRICreateContext(register ClientPtr client)
{
- xXF86DRICreateContextReply rep;
+ xXF86DRICreateContextReply rep;
ScreenPtr pScreen;
REQUEST(xXF86DRICreateContextReq);
REQUEST_SIZE_MATCH(xXF86DRICreateContextReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
rep.type = X_Reply;
@@ -290,51 +271,45 @@ ProcXF86DRICreateContext(
pScreen = screenInfo.screens[stuff->screen];
- if (!DRICreateContext( pScreen,
- NULL,
- stuff->context,
- (drm_context_t *)&rep.hHWContext)) {
- return BadValue;
+ if (!DRICreateContext(pScreen,
+ NULL,
+ stuff->context, (drm_context_t *) & rep.hHWContext)) {
+ return BadValue;
}
- WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *) &rep);
return Success;
}
static int
-ProcXF86DRIDestroyContext(
- register ClientPtr client
-)
+ProcXF86DRIDestroyContext(register ClientPtr client)
{
REQUEST(xXF86DRIDestroyContextReq);
REQUEST_SIZE_MATCH(xXF86DRIDestroyContextReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
- if (!DRIDestroyContext( screenInfo.screens[stuff->screen],
- stuff->context)) {
- return BadValue;
+ if (!DRIDestroyContext(screenInfo.screens[stuff->screen], stuff->context)) {
+ return BadValue;
}
return Success;
}
static int
-ProcXF86DRICreateDrawable(
- ClientPtr client
-)
+ProcXF86DRICreateDrawable(ClientPtr client)
{
- xXF86DRICreateDrawableReply rep;
+ xXF86DRICreateDrawableReply rep;
DrawablePtr pDrawable;
int rc;
REQUEST(xXF86DRICreateDrawableReq);
REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
rep.type = X_Reply;
@@ -342,64 +317,61 @@ ProcXF86DRICreateDrawable(
rep.sequenceNumber = client->sequence;
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
if (!DRICreateDrawable(screenInfo.screens[stuff->screen], client,
- pDrawable, (drm_drawable_t *)&rep.hHWDrawable)) {
- return BadValue;
+ pDrawable, (drm_drawable_t *) & rep.hHWDrawable)) {
+ return BadValue;
}
- WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *) &rep);
return Success;
}
static int
-ProcXF86DRIDestroyDrawable(
- register ClientPtr client
-)
+ProcXF86DRIDestroyDrawable(register ClientPtr client)
{
REQUEST(xXF86DRIDestroyDrawableReq);
DrawablePtr pDrawable;
int rc;
+
REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
if (!DRIDestroyDrawable(screenInfo.screens[stuff->screen], client,
- pDrawable)) {
- return BadValue;
+ pDrawable)) {
+ return BadValue;
}
return Success;
}
static int
-ProcXF86DRIGetDrawableInfo(
- register ClientPtr client
-)
+ProcXF86DRIGetDrawableInfo(register ClientPtr client)
{
- xXF86DRIGetDrawableInfoReply rep;
+ xXF86DRIGetDrawableInfoReply rep;
DrawablePtr pDrawable;
int X, Y, W, H;
- drm_clip_rect_t * pClipRects, *pClippedRects;
- drm_clip_rect_t * pBackClipRects;
+ drm_clip_rect_t *pClipRects, *pClippedRects;
+ drm_clip_rect_t *pBackClipRects;
int backX, backY, rc;
REQUEST(xXF86DRIGetDrawableInfoReq);
REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
rep.type = X_Reply;
@@ -407,191 +379,181 @@ ProcXF86DRIGetDrawableInfo(
rep.sequenceNumber = client->sequence;
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ DixReadAccess);
if (rc != Success)
- return rc;
-
- if (!DRIGetDrawableInfo( screenInfo.screens[stuff->screen],
- pDrawable,
- (unsigned int*)&rep.drawableTableIndex,
- (unsigned int*)&rep.drawableTableStamp,
- (int*)&X,
- (int*)&Y,
- (int*)&W,
- (int*)&H,
- (int*)&rep.numClipRects,
- &pClipRects,
- &backX,
- &backY,
- (int*)&rep.numBackClipRects,
- &pBackClipRects)) {
- return BadValue;
+ return rc;
+
+ if (!DRIGetDrawableInfo(screenInfo.screens[stuff->screen],
+ pDrawable,
+ (unsigned int *) &rep.drawableTableIndex,
+ (unsigned int *) &rep.drawableTableStamp,
+ (int *) &X,
+ (int *) &Y,
+ (int *) &W,
+ (int *) &H,
+ (int *) &rep.numClipRects,
+ &pClipRects,
+ &backX,
+ &backY,
+ (int *) &rep.numBackClipRects, &pBackClipRects)) {
+ return BadValue;
}
rep.drawableX = X;
rep.drawableY = Y;
rep.drawableWidth = W;
rep.drawableHeight = H;
- rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) -
- SIZEOF(xGenericReply));
+ rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - SIZEOF(xGenericReply));
rep.backX = backX;
rep.backY = backY;
-
- if (rep.numBackClipRects)
- rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;
+
+ if (rep.numBackClipRects)
+ rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;
pClippedRects = pClipRects;
if (rep.numClipRects) {
- /* Clip cliprects to screen dimensions (redirected windows) */
- pClippedRects = malloc(rep.numClipRects * sizeof(drm_clip_rect_t));
-
- if (pClippedRects) {
- ScreenPtr pScreen = screenInfo.screens[stuff->screen];
- int i, j;
-
- for (i = 0, j = 0; i < rep.numClipRects; i++) {
- pClippedRects[j].x1 = max(pClipRects[i].x1, 0);
- pClippedRects[j].y1 = max(pClipRects[i].y1, 0);
- pClippedRects[j].x2 = min(pClipRects[i].x2, pScreen->width);
- pClippedRects[j].y2 = min(pClipRects[i].y2, pScreen->height);
-
- if (pClippedRects[j].x1 < pClippedRects[j].x2 &&
- pClippedRects[j].y1 < pClippedRects[j].y2) {
- j++;
- }
- }
-
- rep.numClipRects = j;
- } else {
- rep.numClipRects = 0;
- }
-
- rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
+ /* Clip cliprects to screen dimensions (redirected windows) */
+ pClippedRects = malloc(rep.numClipRects * sizeof(drm_clip_rect_t));
+
+ if (pClippedRects) {
+ ScreenPtr pScreen = screenInfo.screens[stuff->screen];
+ int i, j;
+
+ for (i = 0, j = 0; i < rep.numClipRects; i++) {
+ pClippedRects[j].x1 = max(pClipRects[i].x1, 0);
+ pClippedRects[j].y1 = max(pClipRects[i].y1, 0);
+ pClippedRects[j].x2 = min(pClipRects[i].x2, pScreen->width);
+ pClippedRects[j].y2 = min(pClipRects[i].y2, pScreen->height);
+
+ if (pClippedRects[j].x1 < pClippedRects[j].x2 &&
+ pClippedRects[j].y1 < pClippedRects[j].y2) {
+ j++;
+ }
+ }
+
+ rep.numClipRects = j;
+ }
+ else {
+ rep.numClipRects = 0;
+ }
+
+ rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
}
-
+
rep.length = bytes_to_int32(rep.length);
- WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *) &rep);
if (rep.numClipRects) {
- WriteToClient(client,
- sizeof(drm_clip_rect_t) * rep.numClipRects,
- (char *)pClippedRects);
- free(pClippedRects);
+ WriteToClient(client,
+ sizeof(drm_clip_rect_t) * rep.numClipRects,
+ (char *) pClippedRects);
+ free(pClippedRects);
}
if (rep.numBackClipRects) {
- WriteToClient(client,
- sizeof(drm_clip_rect_t) * rep.numBackClipRects,
- (char *)pBackClipRects);
+ WriteToClient(client,
+ sizeof(drm_clip_rect_t) * rep.numBackClipRects,
+ (char *) pBackClipRects);
}
return Success;
}
static int
-ProcXF86DRIGetDeviceInfo(
- register ClientPtr client
-)
+ProcXF86DRIGetDeviceInfo(register ClientPtr client)
{
- xXF86DRIGetDeviceInfoReply rep;
+ xXF86DRIGetDeviceInfoReply rep;
drm_handle_t hFrameBuffer;
void *pDevPrivate;
REQUEST(xXF86DRIGetDeviceInfoReq);
REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq);
if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
+ client->errorValue = stuff->screen;
+ return BadValue;
}
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if (!DRIGetDeviceInfo( screenInfo.screens[stuff->screen],
- &hFrameBuffer,
- (int*)&rep.framebufferOrigin,
- (int*)&rep.framebufferSize,
- (int*)&rep.framebufferStride,
- (int*)&rep.devPrivateSize,
- &pDevPrivate)) {
- return BadValue;
+ if (!DRIGetDeviceInfo(screenInfo.screens[stuff->screen],
+ &hFrameBuffer,
+ (int *) &rep.framebufferOrigin,
+ (int *) &rep.framebufferSize,
+ (int *) &rep.framebufferStride,
+ (int *) &rep.devPrivateSize, &pDevPrivate)) {
+ return BadValue;
}
- rep.hFrameBufferLow = (CARD32)(hFrameBuffer & 0xffffffff);
+ rep.hFrameBufferLow = (CARD32) (hFrameBuffer & 0xffffffff);
#if defined(LONG64) && !defined(__linux__)
- rep.hFrameBufferHigh = (CARD32)(hFrameBuffer >> 32);
+ rep.hFrameBufferHigh = (CARD32) (hFrameBuffer >> 32);
#else
rep.hFrameBufferHigh = 0;
#endif
rep.length = 0;
if (rep.devPrivateSize) {
- rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
- SIZEOF(xGenericReply) +
- pad_to_int32(rep.devPrivateSize));
+ rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
+ SIZEOF(xGenericReply) +
+ pad_to_int32(rep.devPrivateSize));
}
- WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *) &rep);
if (rep.length) {
- WriteToClient(client, rep.devPrivateSize, (char *)pDevPrivate);
+ WriteToClient(client, rep.devPrivateSize, (char *) pDevPrivate);
}
return Success;
}
static int
-ProcXF86DRIDispatch (
- register ClientPtr client
-)
+ProcXF86DRIDispatch(register ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_XF86DRIQueryVersion:
- return ProcXF86DRIQueryVersion(client);
+ return ProcXF86DRIQueryVersion(client);
case X_XF86DRIQueryDirectRenderingCapable:
- return ProcXF86DRIQueryDirectRenderingCapable(client);
+ return ProcXF86DRIQueryDirectRenderingCapable(client);
}
if (!LocalClient(client))
- return DRIErrorBase + XF86DRIClientNotLocal;
+ return DRIErrorBase + XF86DRIClientNotLocal;
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_XF86DRIOpenConnection:
- return ProcXF86DRIOpenConnection(client);
+ return ProcXF86DRIOpenConnection(client);
case X_XF86DRICloseConnection:
- return ProcXF86DRICloseConnection(client);
+ return ProcXF86DRICloseConnection(client);
case X_XF86DRIGetClientDriverName:
- return ProcXF86DRIGetClientDriverName(client);
+ return ProcXF86DRIGetClientDriverName(client);
case X_XF86DRICreateContext:
- return ProcXF86DRICreateContext(client);
+ return ProcXF86DRICreateContext(client);
case X_XF86DRIDestroyContext:
- return ProcXF86DRIDestroyContext(client);
+ return ProcXF86DRIDestroyContext(client);
case X_XF86DRICreateDrawable:
- return ProcXF86DRICreateDrawable(client);
+ return ProcXF86DRICreateDrawable(client);
case X_XF86DRIDestroyDrawable:
- return ProcXF86DRIDestroyDrawable(client);
+ return ProcXF86DRIDestroyDrawable(client);
case X_XF86DRIGetDrawableInfo:
- return ProcXF86DRIGetDrawableInfo(client);
+ return ProcXF86DRIGetDrawableInfo(client);
case X_XF86DRIGetDeviceInfo:
- return ProcXF86DRIGetDeviceInfo(client);
+ return ProcXF86DRIGetDeviceInfo(client);
case X_XF86DRIAuthConnection:
- return ProcXF86DRIAuthConnection(client);
- /* {Open,Close}FullScreen are deprecated now */
+ return ProcXF86DRIAuthConnection(client);
+ /* {Open,Close}FullScreen are deprecated now */
default:
- return BadRequest;
+ return BadRequest;
}
}
static int
-SProcXF86DRIQueryVersion(
- register ClientPtr client
-)
+SProcXF86DRIQueryVersion(register ClientPtr client)
{
REQUEST(xXF86DRIQueryVersionReq);
swaps(&stuff->length);
@@ -599,9 +561,7 @@ SProcXF86DRIQueryVersion(
}
static int
-SProcXF86DRIQueryDirectRenderingCapable(
- register ClientPtr client
-)
+SProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
{
REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
swaps(&stuff->length);
@@ -610,9 +570,7 @@ SProcXF86DRIQueryDirectRenderingCapable(
}
static int
-SProcXF86DRIDispatch (
- register ClientPtr client
-)
+SProcXF86DRIDispatch(register ClientPtr client)
{
REQUEST(xReq);
@@ -620,39 +578,36 @@ SProcXF86DRIDispatch (
* Only local clients are allowed DRI access, but remote clients still need
* these requests to find out cleanly.
*/
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_XF86DRIQueryVersion:
- return SProcXF86DRIQueryVersion(client);
+ return SProcXF86DRIQueryVersion(client);
case X_XF86DRIQueryDirectRenderingCapable:
- return SProcXF86DRIQueryDirectRenderingCapable(client);
+ return SProcXF86DRIQueryDirectRenderingCapable(client);
default:
- return DRIErrorBase + XF86DRIClientNotLocal;
+ return DRIErrorBase + XF86DRIClientNotLocal;
}
}
void
XFree86DRIExtensionInit(void)
{
- ExtensionEntry* extEntry;
+ ExtensionEntry *extEntry;
#ifdef XF86DRI_EVENTS
EventType = CreateNewResourceType(XF86DRIFreeEvents, "DRIEvent");
#endif
- if (
- DRIExtensionInit() &&
+ if (DRIExtensionInit() &&
#ifdef XF86DRI_EVENTS
EventType && ScreenPrivateIndex != -1 &&
#endif
- (extEntry = AddExtension(XF86DRINAME,
- XF86DRINumberEvents,
- XF86DRINumberErrors,
- ProcXF86DRIDispatch,
- SProcXF86DRIDispatch,
- XF86DRIResetProc,
- StandardMinorOpcode))) {
- DRIReqCode = (unsigned char)extEntry->base;
- DRIErrorBase = extEntry->errorBase;
+ (extEntry = AddExtension(XF86DRINAME,
+ XF86DRINumberEvents,
+ XF86DRINumberErrors,
+ ProcXF86DRIDispatch,
+ SProcXF86DRIDispatch,
+ XF86DRIResetProc, StandardMinorOpcode))) {
+ DRIReqCode = (unsigned char) extEntry->base;
+ DRIErrorBase = extEntry->errorBase;
}
}
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
index 5cc9068af..591ff3ace 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.c
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -48,66 +48,69 @@
#include "xf86.h"
-CARD8 dri2_major; /* version of DRI2 supported by DDX */
+CARD8 dri2_major; /* version of DRI2 supported by DDX */
CARD8 dri2_minor;
static DevPrivateKeyRec dri2ScreenPrivateKeyRec;
+
#define dri2ScreenPrivateKey (&dri2ScreenPrivateKeyRec)
static DevPrivateKeyRec dri2WindowPrivateKeyRec;
+
#define dri2WindowPrivateKey (&dri2WindowPrivateKeyRec)
static DevPrivateKeyRec dri2PixmapPrivateKeyRec;
+
#define dri2PixmapPrivateKey (&dri2PixmapPrivateKeyRec)
-static RESTYPE dri2DrawableRes;
+static RESTYPE dri2DrawableRes;
typedef struct _DRI2Screen *DRI2ScreenPtr;
typedef struct _DRI2Drawable {
- DRI2ScreenPtr dri2_screen;
- DrawablePtr drawable;
- struct xorg_list reference_list;
- int width;
- int height;
- DRI2BufferPtr *buffers;
- int bufferCount;
- unsigned int swapsPending;
- ClientPtr blockedClient;
- Bool blockedOnMsc;
- int swap_interval;
- CARD64 swap_count;
- int64_t target_sbc; /* -1 means no SBC wait outstanding */
- CARD64 last_swap_target; /* most recently queued swap target */
- CARD64 last_swap_msc; /* msc at completion of most recent swap */
- CARD64 last_swap_ust; /* ust at completion of most recent swap */
- int swap_limit; /* for N-buffering */
- unsigned long serialNumber;
- Bool needInvalidate;
+ DRI2ScreenPtr dri2_screen;
+ DrawablePtr drawable;
+ struct xorg_list reference_list;
+ int width;
+ int height;
+ DRI2BufferPtr *buffers;
+ int bufferCount;
+ unsigned int swapsPending;
+ ClientPtr blockedClient;
+ Bool blockedOnMsc;
+ int swap_interval;
+ CARD64 swap_count;
+ int64_t target_sbc; /* -1 means no SBC wait outstanding */
+ CARD64 last_swap_target; /* most recently queued swap target */
+ CARD64 last_swap_msc; /* msc at completion of most recent swap */
+ CARD64 last_swap_ust; /* ust at completion of most recent swap */
+ int swap_limit; /* for N-buffering */
+ unsigned long serialNumber;
+ Bool needInvalidate;
} DRI2DrawableRec, *DRI2DrawablePtr;
typedef struct _DRI2Screen {
- ScreenPtr screen;
- int refcnt;
- unsigned int numDrivers;
- const char **driverNames;
- const char *deviceName;
- int fd;
- unsigned int lastSequence;
-
- DRI2CreateBufferProcPtr CreateBuffer;
- DRI2DestroyBufferProcPtr DestroyBuffer;
- DRI2CopyRegionProcPtr CopyRegion;
- DRI2ScheduleSwapProcPtr ScheduleSwap;
- DRI2GetMSCProcPtr GetMSC;
- DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
- DRI2AuthMagicProcPtr AuthMagic;
+ ScreenPtr screen;
+ int refcnt;
+ unsigned int numDrivers;
+ const char **driverNames;
+ const char *deviceName;
+ int fd;
+ unsigned int lastSequence;
+
+ DRI2CreateBufferProcPtr CreateBuffer;
+ DRI2DestroyBufferProcPtr DestroyBuffer;
+ DRI2CopyRegionProcPtr CopyRegion;
+ DRI2ScheduleSwapProcPtr ScheduleSwap;
+ DRI2GetMSCProcPtr GetMSC;
+ DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
+ DRI2AuthMagicProcPtr AuthMagic;
DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify;
DRI2SwapLimitValidateProcPtr SwapLimitValidate;
- HandleExposuresProcPtr HandleExposures;
+ HandleExposuresProcPtr HandleExposures;
- ConfigNotifyProcPtr ConfigNotify;
+ ConfigNotifyProcPtr ConfigNotify;
} DRI2ScreenRec;
static DRI2ScreenPtr
@@ -124,13 +127,13 @@ DRI2GetDrawable(DrawablePtr pDraw)
switch (pDraw->type) {
case DRAWABLE_WINDOW:
- pWin = (WindowPtr) pDraw;
- return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
+ pWin = (WindowPtr) pDraw;
+ return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
case DRAWABLE_PIXMAP:
- pPixmap = (PixmapPtr) pDraw;
- return dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
+ pPixmap = (PixmapPtr) pDraw;
+ return dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
default:
- return NULL;
+ return NULL;
}
}
@@ -141,24 +144,24 @@ DRI2DrawableSerial(DrawablePtr pDraw)
PixmapPtr pPix;
if (pDraw->type != DRAWABLE_WINDOW)
- return pDraw->serialNumber;
+ return pDraw->serialNumber;
- pPix = pScreen->GetWindowPixmap((WindowPtr)pDraw);
+ pPix = pScreen->GetWindowPixmap((WindowPtr) pDraw);
return pPix->drawable.serialNumber;
}
static DRI2DrawablePtr
DRI2AllocateDrawable(DrawablePtr pDraw)
{
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
DRI2DrawablePtr pPriv;
- CARD64 ust;
+ CARD64 ust;
WindowPtr pWin;
PixmapPtr pPixmap;
pPriv = malloc(sizeof *pPriv);
if (pPriv == NULL)
- return NULL;
+ return NULL;
pPriv->dri2_screen = ds;
pPriv->drawable = pDraw;
@@ -173,10 +176,10 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
pPriv->target_sbc = -1;
pPriv->swap_interval = 1;
/* Initialize last swap target from DDX if possible */
- if (!ds->GetMSC || !(*ds->GetMSC)(pDraw, &ust, &pPriv->last_swap_target))
- pPriv->last_swap_target = 0;
+ if (!ds->GetMSC || !(*ds->GetMSC) (pDraw, &ust, &pPriv->last_swap_target))
+ pPriv->last_swap_target = 0;
- pPriv->swap_limit = 1; /* default to double buffering */
+ pPriv->swap_limit = 1; /* default to double buffering */
pPriv->last_swap_msc = 0;
pPriv->last_swap_ust = 0;
xorg_list_init(&pPriv->reference_list);
@@ -184,11 +187,12 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
pPriv->needInvalidate = FALSE;
if (pDraw->type == DRAWABLE_WINDOW) {
- pWin = (WindowPtr) pDraw;
- dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv);
- } else {
- pPixmap = (PixmapPtr) pDraw;
- dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, pPriv);
+ pWin = (WindowPtr) pDraw;
+ dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv);
+ }
+ else {
+ pPixmap = (PixmapPtr) pDraw;
+ dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, pPriv);
}
return pPriv;
@@ -199,37 +203,37 @@ DRI2SwapLimit(DrawablePtr pDraw, int swap_limit)
{
DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
DRI2ScreenPtr ds;
+
if (!pPriv)
- return FALSE;
+ return FALSE;
ds = pPriv->dri2_screen;
- if (!ds->SwapLimitValidate
- || !ds->SwapLimitValidate(pDraw, swap_limit))
- return FALSE;
+ if (!ds->SwapLimitValidate || !ds->SwapLimitValidate(pDraw, swap_limit))
+ return FALSE;
pPriv->swap_limit = swap_limit;
/* Check throttling */
if (pPriv->swapsPending >= pPriv->swap_limit)
- return TRUE;
+ return TRUE;
if (pPriv->target_sbc == -1 && !pPriv->blockedOnMsc) {
- if (pPriv->blockedClient) {
- AttendClient(pPriv->blockedClient);
- pPriv->blockedClient = NULL;
- }
+ if (pPriv->blockedClient) {
+ AttendClient(pPriv->blockedClient);
+ pPriv->blockedClient = NULL;
+ }
}
return TRUE;
}
typedef struct DRI2DrawableRefRec {
- XID id;
- XID dri2_id;
- DRI2InvalidateProcPtr invalidate;
- void *priv;
- struct xorg_list link;
+ XID id;
+ XID dri2_id;
+ DRI2InvalidateProcPtr invalidate;
+ void *priv;
+ struct xorg_list link;
} DRI2DrawableRefRec, *DRI2DrawableRefPtr;
static DRI2DrawableRefPtr
@@ -238,36 +242,36 @@ DRI2LookupDrawableRef(DRI2DrawablePtr pPriv, XID id)
DRI2DrawableRefPtr ref;
xorg_list_for_each_entry(ref, &pPriv->reference_list, link) {
- if (ref->id == id)
- return ref;
+ if (ref->id == id)
+ return ref;
}
-
+
return NULL;
}
static int
DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id,
- DRI2InvalidateProcPtr invalidate, void *priv)
+ DRI2InvalidateProcPtr invalidate, void *priv)
{
DRI2DrawableRefPtr ref;
ref = malloc(sizeof *ref);
if (ref == NULL)
- return BadAlloc;
-
+ return BadAlloc;
+
if (!AddResource(dri2_id, dri2DrawableRes, pPriv)) {
- free(ref);
- return BadAlloc;
+ free(ref);
+ return BadAlloc;
}
if (!DRI2LookupDrawableRef(pPriv, id))
- if (!AddResource(id, dri2DrawableRes, pPriv)) {
- FreeResourceByType(dri2_id, dri2DrawableRes, TRUE);
- free(ref);
- return BadAlloc;
+ if (!AddResource(id, dri2DrawableRes, pPriv)) {
+ FreeResourceByType(dri2_id, dri2DrawableRes, TRUE);
+ free(ref);
+ return BadAlloc;
}
ref->id = id;
- ref->dri2_id = dri2_id;
+ ref->dri2_id = dri2_id;
ref->invalidate = invalidate;
ref->priv = priv;
xorg_list_add(&ref->link, &pPriv->reference_list);
@@ -277,7 +281,7 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id,
int
DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id,
- DRI2InvalidateProcPtr invalidate, void *priv)
+ DRI2InvalidateProcPtr invalidate, void *priv)
{
DRI2DrawablePtr pPriv;
XID dri2_id;
@@ -285,22 +289,23 @@ DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id,
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL)
- pPriv = DRI2AllocateDrawable(pDraw);
+ pPriv = DRI2AllocateDrawable(pDraw);
if (pPriv == NULL)
- return BadAlloc;
-
+ return BadAlloc;
+
dri2_id = FakeClientID(client->index);
rc = DRI2AddDrawableRef(pPriv, id, dri2_id, invalidate, priv);
if (rc != Success)
- return rc;
+ return rc;
return Success;
}
-static int DRI2DrawableGone(pointer p, XID id)
+static int
+DRI2DrawableGone(pointer p, XID id)
{
DRI2DrawablePtr pPriv = p;
- DRI2ScreenPtr ds = pPriv->dri2_screen;
+ DRI2ScreenPtr ds = pPriv->dri2_screen;
DRI2DrawableRefPtr ref, next;
WindowPtr pWin;
PixmapPtr pPixmap;
@@ -308,40 +313,41 @@ static int DRI2DrawableGone(pointer p, XID id)
int i;
xorg_list_for_each_entry_safe(ref, next, &pPriv->reference_list, link) {
- if (ref->dri2_id == id) {
- xorg_list_del(&ref->link);
- /* If this was the last ref under this X drawable XID,
- * unregister the X drawable resource. */
- if (!DRI2LookupDrawableRef(pPriv, ref->id))
- FreeResourceByType(ref->id, dri2DrawableRes, TRUE);
- free(ref);
- break;
- }
-
- if (ref->id == id) {
- xorg_list_del(&ref->link);
- FreeResourceByType(ref->dri2_id, dri2DrawableRes, TRUE);
- free(ref);
- }
+ if (ref->dri2_id == id) {
+ xorg_list_del(&ref->link);
+ /* If this was the last ref under this X drawable XID,
+ * unregister the X drawable resource. */
+ if (!DRI2LookupDrawableRef(pPriv, ref->id))
+ FreeResourceByType(ref->id, dri2DrawableRes, TRUE);
+ free(ref);
+ break;
+ }
+
+ if (ref->id == id) {
+ xorg_list_del(&ref->link);
+ FreeResourceByType(ref->dri2_id, dri2DrawableRes, TRUE);
+ free(ref);
+ }
}
if (!xorg_list_is_empty(&pPriv->reference_list))
- return Success;
+ return Success;
pDraw = pPriv->drawable;
if (pDraw->type == DRAWABLE_WINDOW) {
- pWin = (WindowPtr) pDraw;
- dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
- } else {
- pPixmap = (PixmapPtr) pDraw;
- dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
+ pWin = (WindowPtr) pDraw;
+ dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
+ }
+ else {
+ pPixmap = (PixmapPtr) pDraw;
+ dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
}
if (pPriv->buffers != NULL) {
- for (i = 0; i < pPriv->bufferCount; i++)
- (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
+ for (i = 0; i < pPriv->bufferCount; i++)
+ (*ds->DestroyBuffer) (pDraw, pPriv->buffers[i]);
- free(pPriv->buffers);
+ free(pPriv->buffers);
}
free(pPriv);
@@ -355,14 +361,14 @@ find_attachment(DRI2DrawablePtr pPriv, unsigned attachment)
int i;
if (pPriv->buffers == NULL) {
- return -1;
+ return -1;
}
for (i = 0; i < pPriv->bufferCount; i++) {
- if ((pPriv->buffers[i] != NULL)
- && (pPriv->buffers[i]->attachment == attachment)) {
- return i;
- }
+ if ((pPriv->buffers[i] != NULL)
+ && (pPriv->buffers[i]->attachment == attachment)) {
+ return i;
+ }
}
return -1;
@@ -370,46 +376,47 @@ find_attachment(DRI2DrawablePtr pPriv, unsigned attachment)
static Bool
allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
- DRI2DrawablePtr pPriv,
- unsigned int attachment, unsigned int format,
- int dimensions_match, DRI2BufferPtr *buffer)
+ DRI2DrawablePtr pPriv,
+ unsigned int attachment, unsigned int format,
+ int dimensions_match, DRI2BufferPtr * buffer)
{
int old_buf = find_attachment(pPriv, attachment);
if ((old_buf < 0)
- || attachment == DRI2BufferFrontLeft
- || !dimensions_match
- || (pPriv->buffers[old_buf]->format != format)) {
- *buffer = (*ds->CreateBuffer)(pDraw, attachment, format);
- pPriv->serialNumber = DRI2DrawableSerial(pDraw);
- return TRUE;
+ || attachment == DRI2BufferFrontLeft
+ || !dimensions_match || (pPriv->buffers[old_buf]->format != format)) {
+ *buffer = (*ds->CreateBuffer) (pDraw, attachment, format);
+ pPriv->serialNumber = DRI2DrawableSerial(pDraw);
+ return TRUE;
- } else {
- *buffer = pPriv->buffers[old_buf];
+ }
+ else {
+ *buffer = pPriv->buffers[old_buf];
- if (ds->ReuseBufferNotify)
- (*ds->ReuseBufferNotify)(pDraw, *buffer);
+ if (ds->ReuseBufferNotify)
+ (*ds->ReuseBufferNotify) (pDraw, *buffer);
- pPriv->buffers[old_buf] = NULL;
- return FALSE;
+ pPriv->buffers[old_buf] = NULL;
+ return FALSE;
}
}
static void
update_dri2_drawable_buffers(DRI2DrawablePtr pPriv, DrawablePtr pDraw,
- DRI2BufferPtr *buffers, int out_count, int *width, int *height)
+ DRI2BufferPtr * buffers, int out_count, int *width,
+ int *height)
{
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
int i;
if (pPriv->buffers != NULL) {
- for (i = 0; i < pPriv->bufferCount; i++) {
- if (pPriv->buffers[i] != NULL) {
- (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
- }
- }
+ for (i = 0; i < pPriv->bufferCount; i++) {
+ if (pPriv->buffers[i] != NULL) {
+ (*ds->DestroyBuffer) (pDraw, pPriv->buffers[i]);
+ }
+ }
- free(pPriv->buffers);
+ free(pPriv->buffers);
}
pPriv->buffers = buffers;
@@ -422,12 +429,12 @@ update_dri2_drawable_buffers(DRI2DrawablePtr pPriv, DrawablePtr pDraw,
static DRI2BufferPtr *
do_get_buffers(DrawablePtr pDraw, int *width, int *height,
- unsigned int *attachments, int count, int *out_count,
- int has_format)
+ unsigned int *attachments, int count, int *out_count,
+ int has_format)
{
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
- DRI2BufferPtr *buffers;
+ DRI2BufferPtr *buffers;
int need_real_front = 0;
int need_fake_front = 0;
int have_fake_front = 0;
@@ -437,142 +444,143 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
int i;
if (!pPriv) {
- *width = pDraw->width;
- *height = pDraw->height;
- *out_count = 0;
- return NULL;
+ *width = pDraw->width;
+ *height = pDraw->height;
+ *out_count = 0;
+ return NULL;
}
dimensions_match = (pDraw->width == pPriv->width)
- && (pDraw->height == pPriv->height)
- && (pPriv->serialNumber == DRI2DrawableSerial(pDraw));
+ && (pDraw->height == pPriv->height)
+ && (pPriv->serialNumber == DRI2DrawableSerial(pDraw));
buffers = calloc((count + 1), sizeof(buffers[0]));
if (!buffers)
- goto err_out;
+ goto err_out;
for (i = 0; i < count; i++) {
- const unsigned attachment = *(attachments++);
- const unsigned format = (has_format) ? *(attachments++) : 0;
-
- if (allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment,
- format, dimensions_match,
- &buffers[i]))
- buffers_changed = 1;
-
- if (buffers[i] == NULL)
- goto err_out;
-
- /* If the drawable is a window and the front-buffer is requested,
- * silently add the fake front-buffer to the list of requested
- * attachments. The counting logic in the loop accounts for the case
- * where the client requests both the fake and real front-buffer.
- */
- if (attachment == DRI2BufferBackLeft) {
- need_real_front++;
- front_format = format;
- }
-
- if (attachment == DRI2BufferFrontLeft) {
- need_real_front--;
- front_format = format;
-
- if (pDraw->type == DRAWABLE_WINDOW) {
- need_fake_front++;
- }
- }
-
- if (pDraw->type == DRAWABLE_WINDOW) {
- if (attachment == DRI2BufferFakeFrontLeft) {
- need_fake_front--;
- have_fake_front = 1;
- }
- }
+ const unsigned attachment = *(attachments++);
+ const unsigned format = (has_format) ? *(attachments++) : 0;
+
+ if (allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment,
+ format, dimensions_match, &buffers[i]))
+ buffers_changed = 1;
+
+ if (buffers[i] == NULL)
+ goto err_out;
+
+ /* If the drawable is a window and the front-buffer is requested,
+ * silently add the fake front-buffer to the list of requested
+ * attachments. The counting logic in the loop accounts for the case
+ * where the client requests both the fake and real front-buffer.
+ */
+ if (attachment == DRI2BufferBackLeft) {
+ need_real_front++;
+ front_format = format;
+ }
+
+ if (attachment == DRI2BufferFrontLeft) {
+ need_real_front--;
+ front_format = format;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ need_fake_front++;
+ }
+ }
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ if (attachment == DRI2BufferFakeFrontLeft) {
+ need_fake_front--;
+ have_fake_front = 1;
+ }
+ }
}
if (need_real_front > 0) {
- if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFrontLeft,
- front_format, dimensions_match,
- &buffers[i]))
- buffers_changed = 1;
-
- if (buffers[i] == NULL)
- goto err_out;
- i++;
+ if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFrontLeft,
+ front_format, dimensions_match,
+ &buffers[i]))
+ buffers_changed = 1;
+
+ if (buffers[i] == NULL)
+ goto err_out;
+ i++;
}
if (need_fake_front > 0) {
- if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFakeFrontLeft,
- front_format, dimensions_match,
- &buffers[i]))
- buffers_changed = 1;
+ if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFakeFrontLeft,
+ front_format, dimensions_match,
+ &buffers[i]))
+ buffers_changed = 1;
- if (buffers[i] == NULL)
- goto err_out;
+ if (buffers[i] == NULL)
+ goto err_out;
- i++;
- have_fake_front = 1;
+ i++;
+ have_fake_front = 1;
}
*out_count = i;
- update_dri2_drawable_buffers(pPriv, pDraw, buffers, *out_count, width, height);
+ update_dri2_drawable_buffers(pPriv, pDraw, buffers, *out_count, width,
+ height);
/* If the client is getting a fake front-buffer, pre-fill it with the
* contents of the real front-buffer. This ensures correct operation of
* applications that call glXWaitX before calling glDrawBuffer.
*/
if (have_fake_front && buffers_changed) {
- BoxRec box;
- RegionRec region;
+ BoxRec box;
+ RegionRec region;
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pPriv->width;
- box.y2 = pPriv->height;
- RegionInit(&region, &box, 0);
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPriv->width;
+ box.y2 = pPriv->height;
+ RegionInit(&region, &box, 0);
- DRI2CopyRegion(pDraw, &region, DRI2BufferFakeFrontLeft,
- DRI2BufferFrontLeft);
+ DRI2CopyRegion(pDraw, &region, DRI2BufferFakeFrontLeft,
+ DRI2BufferFrontLeft);
}
pPriv->needInvalidate = TRUE;
return pPriv->buffers;
-err_out:
+ err_out:
*out_count = 0;
if (buffers) {
- for (i = 0; i < count; i++) {
- if (buffers[i] != NULL)
- (*ds->DestroyBuffer)(pDraw, buffers[i]);
- }
+ for (i = 0; i < count; i++) {
+ if (buffers[i] != NULL)
+ (*ds->DestroyBuffer) (pDraw, buffers[i]);
+ }
- free(buffers);
- buffers = NULL;
+ free(buffers);
+ buffers = NULL;
}
- update_dri2_drawable_buffers(pPriv, pDraw, buffers, *out_count, width, height);
+ update_dri2_drawable_buffers(pPriv, pDraw, buffers, *out_count, width,
+ height);
return buffers;
}
DRI2BufferPtr *
DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
- unsigned int *attachments, int count, int *out_count)
+ unsigned int *attachments, int count, int *out_count)
{
return do_get_buffers(pDraw, width, height, attachments, count,
- out_count, FALSE);
+ out_count, FALSE);
}
DRI2BufferPtr *
DRI2GetBuffersWithFormat(DrawablePtr pDraw, int *width, int *height,
- unsigned int *attachments, int count, int *out_count)
+ unsigned int *attachments, int count, int *out_count)
{
return do_get_buffers(pDraw, width, height, attachments, count,
- out_count, TRUE);
+ out_count, TRUE);
}
static void
@@ -587,7 +595,7 @@ DRI2InvalidateDrawable(DrawablePtr pDraw)
pPriv->needInvalidate = FALSE;
xorg_list_for_each_entry(ref, &pPriv->reference_list, link)
- ref->invalidate(pDraw, ref->priv, ref->id);
+ ref->invalidate(pDraw, ref->priv, ref->id);
}
/*
@@ -604,16 +612,15 @@ DRI2ThrottleClient(ClientPtr client, DrawablePtr pDraw)
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL)
- return FALSE;
+ return FALSE;
/* Throttle to swap limit */
- if ((pPriv->swapsPending >= pPriv->swap_limit) &&
- !pPriv->blockedClient) {
- ResetCurrentRequest(client);
- client->sequence--;
- IgnoreClient(client);
- pPriv->blockedClient = client;
- return TRUE;
+ if ((pPriv->swapsPending >= pPriv->swap_limit) && !pPriv->blockedClient) {
+ ResetCurrentRequest(client);
+ client->sequence--;
+ IgnoreClient(client);
+ pPriv->blockedClient = client;
+ return TRUE;
}
return FALSE;
@@ -623,8 +630,8 @@ static void
__DRI2BlockClient(ClientPtr client, DRI2DrawablePtr pPriv)
{
if (pPriv->blockedClient == NULL) {
- IgnoreClient(client);
- pPriv->blockedClient = client;
+ IgnoreClient(client);
+ pPriv->blockedClient = client;
}
}
@@ -635,7 +642,7 @@ DRI2BlockClient(ClientPtr client, DrawablePtr pDraw)
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL)
- return;
+ return;
__DRI2BlockClient(client, pPriv);
pPriv->blockedOnMsc = TRUE;
@@ -643,30 +650,29 @@ DRI2BlockClient(ClientPtr client, DrawablePtr pDraw)
int
DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
- unsigned int dest, unsigned int src)
+ unsigned int dest, unsigned int src)
{
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
DRI2DrawablePtr pPriv;
- DRI2BufferPtr pDestBuffer, pSrcBuffer;
- int i;
+ DRI2BufferPtr pDestBuffer, pSrcBuffer;
+ int i;
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL)
- return BadDrawable;
+ return BadDrawable;
pDestBuffer = NULL;
pSrcBuffer = NULL;
- for (i = 0; i < pPriv->bufferCount; i++)
- {
- if (pPriv->buffers[i]->attachment == dest)
- pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
- if (pPriv->buffers[i]->attachment == src)
- pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
+ for (i = 0; i < pPriv->bufferCount; i++) {
+ if (pPriv->buffers[i]->attachment == dest)
+ pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
+ if (pPriv->buffers[i]->attachment == src)
+ pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
}
if (pSrcBuffer == NULL || pDestBuffer == NULL)
- return BadValue;
+ return BadValue;
- (*ds->CopyRegion)(pDraw, pRegion, pDestBuffer, pSrcBuffer);
+ (*ds->CopyRegion) (pDraw, pRegion, pDestBuffer, pSrcBuffer);
return Success;
}
@@ -680,7 +686,7 @@ DRI2CanFlip(DrawablePtr pDraw)
PixmapPtr pWinPixmap, pRootPixmap;
if (pDraw->type == DRAWABLE_PIXMAP)
- return TRUE;
+ return TRUE;
pRoot = pScreen->root;
pRootPixmap = pScreen->GetWindowPixmap(pRoot);
@@ -688,20 +694,18 @@ DRI2CanFlip(DrawablePtr pDraw)
pWin = (WindowPtr) pDraw;
pWinPixmap = pScreen->GetWindowPixmap(pWin);
if (pRootPixmap != pWinPixmap)
- return FALSE;
+ return FALSE;
if (!RegionEqual(&pWin->clipList, &pRoot->winSize))
- return FALSE;
+ return FALSE;
/* Does the window match the pixmap exactly? */
- if (pDraw->x != 0 ||
- pDraw->y != 0 ||
+ if (pDraw->x != 0 || pDraw->y != 0 ||
#ifdef COMPOSITE
- pDraw->x != pWinPixmap->screen_x ||
- pDraw->y != pWinPixmap->screen_y ||
+ pDraw->x != pWinPixmap->screen_x || pDraw->y != pWinPixmap->screen_y ||
#endif
- pDraw->width != pWinPixmap->drawable.width ||
- pDraw->height != pWinPixmap->drawable.height)
- return FALSE;
+ pDraw->width != pWinPixmap->drawable.width ||
+ pDraw->height != pWinPixmap->drawable.height)
+ return FALSE;
return TRUE;
}
@@ -715,19 +719,19 @@ DRI2CanExchange(DrawablePtr pDraw)
void
DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw, int frame,
- unsigned int tv_sec, unsigned int tv_usec)
+ unsigned int tv_sec, unsigned int tv_usec)
{
DRI2DrawablePtr pPriv;
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL)
- return;
+ return;
- ProcDRI2WaitMSCReply(client, ((CARD64)tv_sec * 1000000) + tv_usec,
- frame, pPriv->swap_count);
+ ProcDRI2WaitMSCReply(client, ((CARD64) tv_sec * 1000000) + tv_usec,
+ frame, pPriv->swap_count);
if (pPriv->blockedClient)
- AttendClient(pPriv->blockedClient);
+ AttendClient(pPriv->blockedClient);
pPriv->blockedClient = NULL;
pPriv->blockedOnMsc = FALSE;
@@ -735,16 +739,16 @@ DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw, int frame,
static void
DRI2WakeClient(ClientPtr client, DrawablePtr pDraw, int frame,
- unsigned int tv_sec, unsigned int tv_usec)
+ unsigned int tv_sec, unsigned int tv_usec)
{
- ScreenPtr pScreen = pDraw->pScreen;
+ ScreenPtr pScreen = pDraw->pScreen;
DRI2DrawablePtr pPriv;
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: bad drawable\n", __func__);
- return;
+ "[DRI2] %s: bad drawable\n", __func__);
+ return;
}
/*
@@ -755,38 +759,38 @@ DRI2WakeClient(ClientPtr client, DrawablePtr pDraw, int frame,
* - was blocked due to swap throttling
* - is not blocked due to an MSC wait
*/
- if (pPriv->target_sbc != -1 &&
- pPriv->target_sbc <= pPriv->swap_count) {
- ProcDRI2WaitMSCReply(client, ((CARD64)tv_sec * 1000000) + tv_usec,
- frame, pPriv->swap_count);
- pPriv->target_sbc = -1;
-
- AttendClient(pPriv->blockedClient);
- pPriv->blockedClient = NULL;
- } else if (pPriv->target_sbc == -1 && !pPriv->blockedOnMsc) {
- if (pPriv->blockedClient) {
- AttendClient(pPriv->blockedClient);
- pPriv->blockedClient = NULL;
- }
+ if (pPriv->target_sbc != -1 && pPriv->target_sbc <= pPriv->swap_count) {
+ ProcDRI2WaitMSCReply(client, ((CARD64) tv_sec * 1000000) + tv_usec,
+ frame, pPriv->swap_count);
+ pPriv->target_sbc = -1;
+
+ AttendClient(pPriv->blockedClient);
+ pPriv->blockedClient = NULL;
+ }
+ else if (pPriv->target_sbc == -1 && !pPriv->blockedOnMsc) {
+ if (pPriv->blockedClient) {
+ AttendClient(pPriv->blockedClient);
+ pPriv->blockedClient = NULL;
+ }
}
}
void
DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame,
- unsigned int tv_sec, unsigned int tv_usec, int type,
- DRI2SwapEventPtr swap_complete, void *swap_data)
+ unsigned int tv_sec, unsigned int tv_usec, int type,
+ DRI2SwapEventPtr swap_complete, void *swap_data)
{
- ScreenPtr pScreen = pDraw->pScreen;
+ ScreenPtr pScreen = pDraw->pScreen;
DRI2DrawablePtr pPriv;
- CARD64 ust = 0;
- BoxRec box;
- RegionRec region;
+ CARD64 ust = 0;
+ BoxRec box;
+ RegionRec region;
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: bad drawable\n", __func__);
- return;
+ "[DRI2] %s: bad drawable\n", __func__);
+ return;
}
pPriv->swapsPending--;
@@ -798,11 +802,11 @@ DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame,
box.y2 = pDraw->height;
RegionInit(&region, &box, 0);
DRI2CopyRegion(pDraw, &region, DRI2BufferFakeFrontLeft,
- DRI2BufferFrontLeft);
+ DRI2BufferFrontLeft);
- ust = ((CARD64)tv_sec * 1000000) + tv_usec;
+ ust = ((CARD64) tv_sec * 1000000) + tv_usec;
if (swap_complete)
- swap_complete(client, swap_data, type, ust, frame, pPriv->swap_count);
+ swap_complete(client, swap_data, type, ust, frame, pPriv->swap_count);
pPriv->last_swap_msc = frame;
pPriv->last_swap_ust = ust;
@@ -818,13 +822,11 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
/* If we're currently waiting for a swap on this drawable, reset
* the request and suspend the client. We only support one
* blocked client per drawable. */
- if (pPriv &&
- pPriv->swapsPending &&
- pPriv->blockedClient == NULL) {
- ResetCurrentRequest(client);
- client->sequence--;
- __DRI2BlockClient(client, pPriv);
- return TRUE;
+ if (pPriv && pPriv->swapsPending && pPriv->blockedClient == NULL) {
+ ResetCurrentRequest(client);
+ client->sequence--;
+ __DRI2BlockClient(client, pPriv);
+ return TRUE;
}
return FALSE;
@@ -838,59 +840,59 @@ static int
DRI2InvalidateWalk(WindowPtr pWin, pointer data)
{
if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data)
- return WT_DONTWALKCHILDREN;
+ return WT_DONTWALKCHILDREN;
DRI2InvalidateDrawable(&pWin->drawable);
return WT_WALKCHILDREN;
}
int
DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
- CARD64 divisor, CARD64 remainder, CARD64 *swap_target,
- DRI2SwapEventPtr func, void *data)
+ CARD64 divisor, CARD64 remainder, CARD64 * swap_target,
+ DRI2SwapEventPtr func, void *data)
{
- ScreenPtr pScreen = pDraw->pScreen;
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ ScreenPtr pScreen = pDraw->pScreen;
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
DRI2DrawablePtr pPriv;
- DRI2BufferPtr pDestBuffer = NULL, pSrcBuffer = NULL;
- int ret, i;
- CARD64 ust, current_msc;
+ DRI2BufferPtr pDestBuffer = NULL, pSrcBuffer = NULL;
+ int ret, i;
+ CARD64 ust, current_msc;
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: bad drawable\n", __func__);
- return BadDrawable;
+ "[DRI2] %s: bad drawable\n", __func__);
+ return BadDrawable;
}
for (i = 0; i < pPriv->bufferCount; i++) {
- if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft)
- pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
- if (pPriv->buffers[i]->attachment == DRI2BufferBackLeft)
- pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
+ if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft)
+ pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
+ if (pPriv->buffers[i]->attachment == DRI2BufferBackLeft)
+ pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
}
if (pSrcBuffer == NULL || pDestBuffer == NULL) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: drawable has no back or front?\n", __func__);
- return BadDrawable;
+ "[DRI2] %s: drawable has no back or front?\n", __func__);
+ return BadDrawable;
}
/* Old DDX or no swap interval, just blit */
if (!ds->ScheduleSwap || !pPriv->swap_interval) {
- BoxRec box;
- RegionRec region;
+ BoxRec box;
+ RegionRec region;
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pDraw->width;
- box.y2 = pDraw->height;
- RegionInit(&region, &box, 0);
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pDraw->width;
+ box.y2 = pDraw->height;
+ RegionInit(&region, &box, 0);
- pPriv->swapsPending++;
+ pPriv->swapsPending++;
- (*ds->CopyRegion)(pDraw, &region, pDestBuffer, pSrcBuffer);
- DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE,
- func, data);
- return Success;
+ (*ds->CopyRegion) (pDraw, &region, pDestBuffer, pSrcBuffer);
+ DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE,
+ func, data);
+ return Success;
}
/*
@@ -898,42 +900,43 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
* need to schedule a swap for the last swap target + the swap interval.
*/
if (target_msc == 0 && divisor == 0 && remainder == 0) {
- /* If the current vblank count of the drawable's crtc is lower
- * than the count stored in last_swap_target from a previous swap
- * then reinitialize last_swap_target to the current crtc's msc,
- * otherwise the swap will hang. This will happen if the drawable
- * is moved to a crtc with a lower refresh rate, or a crtc that just
- * got enabled.
- */
- if (ds->GetMSC) {
- if (!(*ds->GetMSC)(pDraw, &ust, &current_msc))
- pPriv->last_swap_target = 0;
-
- if (current_msc < pPriv->last_swap_target)
- pPriv->last_swap_target = current_msc;
-
- }
-
- /*
- * Swap target for this swap is last swap target + swap interval since
- * we have to account for the current swap count, interval, and the
- * number of pending swaps.
- */
- *swap_target = pPriv->last_swap_target + pPriv->swap_interval;
-
- } else {
- /* glXSwapBuffersMscOML could have a 0 target_msc, honor it */
- *swap_target = target_msc;
+ /* If the current vblank count of the drawable's crtc is lower
+ * than the count stored in last_swap_target from a previous swap
+ * then reinitialize last_swap_target to the current crtc's msc,
+ * otherwise the swap will hang. This will happen if the drawable
+ * is moved to a crtc with a lower refresh rate, or a crtc that just
+ * got enabled.
+ */
+ if (ds->GetMSC) {
+ if (!(*ds->GetMSC) (pDraw, &ust, &current_msc))
+ pPriv->last_swap_target = 0;
+
+ if (current_msc < pPriv->last_swap_target)
+ pPriv->last_swap_target = current_msc;
+
+ }
+
+ /*
+ * Swap target for this swap is last swap target + swap interval since
+ * we have to account for the current swap count, interval, and the
+ * number of pending swaps.
+ */
+ *swap_target = pPriv->last_swap_target + pPriv->swap_interval;
+
+ }
+ else {
+ /* glXSwapBuffersMscOML could have a 0 target_msc, honor it */
+ *swap_target = target_msc;
}
pPriv->swapsPending++;
- ret = (*ds->ScheduleSwap)(client, pDraw, pDestBuffer, pSrcBuffer,
- swap_target, divisor, remainder, func, data);
+ ret = (*ds->ScheduleSwap) (client, pDraw, pDestBuffer, pSrcBuffer,
+ swap_target, divisor, remainder, func, data);
if (!ret) {
- pPriv->swapsPending--; /* didn't schedule */
+ pPriv->swapsPending--; /* didn't schedule */
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: driver failed to schedule swap\n", __func__);
- return BadDrawable;
+ "[DRI2] %s: driver failed to schedule swap\n", __func__);
+ return BadDrawable;
}
pPriv->last_swap_target = *swap_target;
@@ -944,23 +947,25 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
*swap_target = pPriv->swap_count + pPriv->swapsPending;
if (pDraw->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr) pDraw;
- PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin);
-
- /*
- * Find the top-most window using this pixmap
- */
- while (pWin->parent && pScreen->GetWindowPixmap(pWin->parent) == pPixmap)
- pWin = pWin->parent;
-
- /*
- * Walk the sub-tree to invalidate all of the
- * windows using the same pixmap
- */
- TraverseTree(pWin, DRI2InvalidateWalk, pPixmap);
- DRI2InvalidateDrawable(&pPixmap->drawable);
- } else
- DRI2InvalidateDrawable(pDraw);
+ WindowPtr pWin = (WindowPtr) pDraw;
+ PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin);
+
+ /*
+ * Find the top-most window using this pixmap
+ */
+ while (pWin->parent &&
+ pScreen->GetWindowPixmap(pWin->parent) == pPixmap)
+ pWin = pWin->parent;
+
+ /*
+ * Walk the sub-tree to invalidate all of the
+ * windows using the same pixmap
+ */
+ TraverseTree(pWin, DRI2InvalidateWalk, pPixmap);
+ DRI2InvalidateDrawable(&pPixmap->drawable);
+ }
+ else
+ DRI2InvalidateDrawable(pDraw);
return Success;
}
@@ -968,13 +973,13 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
void
DRI2SwapInterval(DrawablePtr pDrawable, int interval)
{
- ScreenPtr pScreen = pDrawable->pScreen;
+ ScreenPtr pScreen = pDrawable->pScreen;
DRI2DrawablePtr pPriv = DRI2GetDrawable(pDrawable);
if (pPriv == NULL) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: bad drawable\n", __func__);
- return;
+ "[DRI2] %s: bad drawable\n", __func__);
+ return;
}
/* fixme: check against arbitrary max? */
@@ -982,7 +987,7 @@ DRI2SwapInterval(DrawablePtr pDrawable, int interval)
}
int
-DRI2GetMSC(DrawablePtr pDraw, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
+DRI2GetMSC(DrawablePtr pDraw, CARD64 * ust, CARD64 * msc, CARD64 * sbc)
{
ScreenPtr pScreen = pDraw->pScreen;
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
@@ -992,15 +997,15 @@ DRI2GetMSC(DrawablePtr pDraw, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: bad drawable\n", __func__);
- return BadDrawable;
+ "[DRI2] %s: bad drawable\n", __func__);
+ return BadDrawable;
}
if (!ds->GetMSC) {
- *ust = 0;
- *msc = 0;
- *sbc = pPriv->swap_count;
- return Success;
+ *ust = 0;
+ *msc = 0;
+ *sbc = pPriv->swap_count;
+ return Success;
}
/*
@@ -1008,9 +1013,9 @@ DRI2GetMSC(DrawablePtr pDraw, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
* drawables
*/
- ret = (*ds->GetMSC)(pDraw, ust, msc);
+ ret = (*ds->GetMSC) (pDraw, ust, msc);
if (!ret)
- return BadDrawable;
+ return BadDrawable;
*sbc = pPriv->swap_count;
@@ -1019,7 +1024,7 @@ DRI2GetMSC(DrawablePtr pDraw, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
int
DRI2WaitMSC(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
- CARD64 divisor, CARD64 remainder)
+ CARD64 divisor, CARD64 remainder)
{
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
DRI2DrawablePtr pPriv;
@@ -1027,18 +1032,19 @@ DRI2WaitMSC(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL)
- return BadDrawable;
+ return BadDrawable;
/* Old DDX just completes immediately */
if (!ds->ScheduleWaitMSC) {
- DRI2WaitMSCComplete(client, pDraw, target_msc, 0, 0);
+ DRI2WaitMSCComplete(client, pDraw, target_msc, 0, 0);
- return Success;
+ return Success;
}
- ret = (*ds->ScheduleWaitMSC)(client, pDraw, target_msc, divisor, remainder);
+ ret =
+ (*ds->ScheduleWaitMSC) (client, pDraw, target_msc, divisor, remainder);
if (!ret)
- return BadDrawable;
+ return BadDrawable;
return Success;
}
@@ -1050,7 +1056,7 @@ DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc)
pPriv = DRI2GetDrawable(pDraw);
if (pPriv == NULL)
- return BadDrawable;
+ return BadDrawable;
/* target_sbc == 0 means to block until all pending swaps are
* finished. Recalculate target_sbc to get that behaviour.
@@ -1084,17 +1090,17 @@ DRI2HasSwapControl(ScreenPtr pScreen)
Bool
DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd,
- const char **driverName, const char **deviceName)
+ const char **driverName, const char **deviceName)
{
DRI2ScreenPtr ds;
if (!dixPrivateKeyRegistered(dri2ScreenPrivateKey))
- return FALSE;
+ return FALSE;
ds = DRI2GetScreen(pScreen);
if (ds == NULL || driverType >= ds->numDrivers ||
- !ds->driverNames[driverType])
- return FALSE;
+ !ds->driverNames[driverType])
+ return FALSE;
*fd = ds->fd;
*driverName = ds->driverNames[driverType];
@@ -1108,7 +1114,7 @@ DRI2Authenticate(ScreenPtr pScreen, uint32_t magic)
{
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
- if (ds == NULL || (*ds->AuthMagic)(ds->fd, magic))
+ if (ds == NULL || (*ds->AuthMagic) (ds->fd, magic))
return FALSE;
return TRUE;
@@ -1116,27 +1122,27 @@ DRI2Authenticate(ScreenPtr pScreen, uint32_t magic)
static int
DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw,
- WindowPtr pSib)
+ WindowPtr pSib)
{
- DrawablePtr pDraw = (DrawablePtr)pWin;
+ DrawablePtr pDraw = (DrawablePtr) pWin;
ScreenPtr pScreen = pDraw->pScreen;
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
DRI2DrawablePtr dd = DRI2GetDrawable(pDraw);
int ret;
if (ds->ConfigNotify) {
- pScreen->ConfigNotify = ds->ConfigNotify;
+ pScreen->ConfigNotify = ds->ConfigNotify;
- ret = (*pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
+ ret = (*pScreen->ConfigNotify) (pWin, x, y, w, h, bw, pSib);
- ds->ConfigNotify = pScreen->ConfigNotify;
- pScreen->ConfigNotify = DRI2ConfigNotify;
- if (ret)
- return ret;
+ ds->ConfigNotify = pScreen->ConfigNotify;
+ pScreen->ConfigNotify = DRI2ConfigNotify;
+ if (ret)
+ return ret;
}
if (!dd || (dd->width == w && dd->height == h))
- return Success;
+ return Success;
DRI2InvalidateDrawable(pDraw);
return Success;
@@ -1146,51 +1152,53 @@ Bool
DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
{
DRI2ScreenPtr ds;
- const char* driverTypeNames[] = {
- "DRI", /* DRI2DriverDRI */
- "VDPAU", /* DRI2DriverVDPAU */
+
+ const char *driverTypeNames[] = {
+ "DRI", /* DRI2DriverDRI */
+ "VDPAU", /* DRI2DriverVDPAU */
};
unsigned int i;
CARD8 cur_minor;
if (info->version < 3)
- return FALSE;
+ return FALSE;
if (!xf86VGAarbiterAllowDRI(pScreen)) {
xf86DrvMsg(pScreen->myNum, X_WARNING,
- "[DRI2] Direct rendering is not supported when VGA arb is necessary for the device\n");
+ "[DRI2] Direct rendering is not supported when VGA arb is necessary for the device\n");
return FALSE;
}
if (!dixRegisterPrivateKey(&dri2ScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&dri2WindowPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&dri2PixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
- return FALSE;
+ return FALSE;
ds = calloc(1, sizeof *ds);
if (!ds)
- return FALSE;
+ return FALSE;
- ds->screen = pScreen;
- ds->fd = info->fd;
- ds->deviceName = info->deviceName;
- dri2_major = 1;
+ ds->screen = pScreen;
+ ds->fd = info->fd;
+ ds->deviceName = info->deviceName;
+ dri2_major = 1;
- ds->CreateBuffer = info->CreateBuffer;
- ds->DestroyBuffer = info->DestroyBuffer;
- ds->CopyRegion = info->CopyRegion;
+ ds->CreateBuffer = info->CreateBuffer;
+ ds->DestroyBuffer = info->DestroyBuffer;
+ ds->CopyRegion = info->CopyRegion;
if (info->version >= 4) {
- ds->ScheduleSwap = info->ScheduleSwap;
- ds->ScheduleWaitMSC = info->ScheduleWaitMSC;
- ds->GetMSC = info->GetMSC;
- cur_minor = 3;
- } else {
- cur_minor = 1;
+ ds->ScheduleSwap = info->ScheduleSwap;
+ ds->ScheduleWaitMSC = info->ScheduleWaitMSC;
+ ds->GetMSC = info->GetMSC;
+ cur_minor = 3;
+ }
+ else {
+ cur_minor = 1;
}
if (info->version >= 5) {
@@ -1198,8 +1206,8 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
}
if (info->version >= 6) {
- ds->ReuseBufferNotify = info->ReuseBufferNotify;
- ds->SwapLimitValidate = info->SwapLimitValidate;
+ ds->ReuseBufferNotify = info->ReuseBufferNotify;
+ ds->SwapLimitValidate = info->SwapLimitValidate;
}
/*
@@ -1215,22 +1223,23 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
/* Initialize minor if needed and set to minimum provied by DDX */
if (!dri2_minor || dri2_minor > cur_minor)
- dri2_minor = cur_minor;
+ dri2_minor = cur_minor;
if (info->version == 3 || info->numDrivers == 0) {
- /* Driver too old: use the old-style driverName field */
- ds->numDrivers = 1;
- ds->driverNames = malloc(sizeof(*ds->driverNames));
- if (!ds->driverNames)
- goto err_out;
- ds->driverNames[0] = info->driverName;
- } else {
- ds->numDrivers = info->numDrivers;
- ds->driverNames = malloc(info->numDrivers * sizeof(*ds->driverNames));
- if (!ds->driverNames)
- goto err_out;
- memcpy(ds->driverNames, info->driverNames,
- info->numDrivers * sizeof(*ds->driverNames));
+ /* Driver too old: use the old-style driverName field */
+ ds->numDrivers = 1;
+ ds->driverNames = malloc(sizeof(*ds->driverNames));
+ if (!ds->driverNames)
+ goto err_out;
+ ds->driverNames[0] = info->driverName;
+ }
+ else {
+ ds->numDrivers = info->numDrivers;
+ ds->driverNames = malloc(info->numDrivers * sizeof(*ds->driverNames));
+ if (!ds->driverNames)
+ goto err_out;
+ memcpy(ds->driverNames, info->driverNames,
+ info->numDrivers * sizeof(*ds->driverNames));
}
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds);
@@ -1240,17 +1249,18 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
for (i = 0; i < sizeof(driverTypeNames) / sizeof(driverTypeNames[0]); i++) {
- if (i < ds->numDrivers && ds->driverNames[i]) {
- xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] %s driver: %s\n",
- driverTypeNames[i], ds->driverNames[i]);
- }
+ if (i < ds->numDrivers && ds->driverNames[i]) {
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] %s driver: %s\n",
+ driverTypeNames[i], ds->driverNames[i]);
+ }
}
return TRUE;
-err_out:
+ err_out:
xf86DrvMsg(pScreen->myNum, X_WARNING,
- "[DRI2] Initialization failed for info version %d.\n", info->version);
+ "[DRI2] Initialization failed for info version %d.\n",
+ info->version);
free(ds);
return FALSE;
}
@@ -1259,6 +1269,7 @@ void
DRI2CloseScreen(ScreenPtr pScreen)
{
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
pScreen->ConfigNotify = ds->ConfigNotify;
free(ds->driverNames);
@@ -1275,7 +1286,7 @@ DRI2ModuleSetup(void)
{
dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable");
if (!dri2DrawableRes)
- return FALSE;
+ return FALSE;
return TRUE;
}
@@ -1285,22 +1296,19 @@ DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
{
static Bool setupDone = FALSE;
- if (!setupDone)
- {
- setupDone = TRUE;
- LoadExtension(&dri2ExtensionModule, FALSE);
+ if (!setupDone) {
+ setupDone = TRUE;
+ LoadExtension(&dri2ExtensionModule, FALSE);
}
- else
- {
- if (errmaj)
- *errmaj = LDR_ONCEONLY;
+ else {
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
}
return (pointer) 1;
}
-static XF86ModuleVersionInfo DRI2VersRec =
-{
+static XF86ModuleVersionInfo DRI2VersRec = {
"dri2",
MODULEVENDORSTRING,
MODINFOSTRING1,
@@ -1310,7 +1318,7 @@ static XF86ModuleVersionInfo DRI2VersRec =
ABI_CLASS_EXTENSION,
ABI_EXTENSION_VERSION,
MOD_CLASS_NONE,
- { 0, 0, 0, 0 }
+ {0, 0, 0, 0}
};
_X_EXPORT XF86ModuleData dri2ModuleData = { &DRI2VersRec, DRI2Setup, NULL };
@@ -1319,8 +1327,8 @@ void
DRI2Version(int *major, int *minor)
{
if (major != NULL)
- *major = DRI2VersRec.majorversion;
+ *major = DRI2VersRec.majorversion;
if (minor != NULL)
- *minor = DRI2VersRec.minorversion;
+ *minor = DRI2VersRec.minorversion;
}
diff --git a/xorg-server/hw/xfree86/dri2/dri2.h b/xorg-server/hw/xfree86/dri2/dri2.h
index a67e35f73..00b3668cc 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.h
+++ b/xorg-server/hw/xfree86/dri2/dri2.h
@@ -46,27 +46,24 @@ typedef struct {
void *driverPrivate;
} DRI2BufferRec, *DRI2BufferPtr;
-extern CARD8 dri2_major; /* version of DRI2 supported by DDX */
+extern CARD8 dri2_major; /* version of DRI2 supported by DDX */
extern CARD8 dri2_minor;
typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr;
-typedef void (*DRI2SwapEventPtr)(ClientPtr client, void *data, int type,
- CARD64 ust, CARD64 msc, CARD32 sbc);
-
-
-typedef DRI2BufferPtr (*DRI2CreateBuffersProcPtr)(DrawablePtr pDraw,
- unsigned int *attachments,
- int count);
-typedef void (*DRI2DestroyBuffersProcPtr)(DrawablePtr pDraw,
- DRI2BufferPtr buffers,
- int count);
-typedef void (*DRI2CopyRegionProcPtr)(DrawablePtr pDraw,
- RegionPtr pRegion,
- DRI2BufferPtr pDestBuffer,
- DRI2BufferPtr pSrcBuffer);
-typedef void (*DRI2WaitProcPtr)(WindowPtr pWin,
- unsigned int sequence);
-typedef int (*DRI2AuthMagicProcPtr)(int fd, uint32_t magic);
+typedef void (*DRI2SwapEventPtr) (ClientPtr client, void *data, int type,
+ CARD64 ust, CARD64 msc, CARD32 sbc);
+
+typedef DRI2BufferPtr(*DRI2CreateBuffersProcPtr) (DrawablePtr pDraw,
+ unsigned int *attachments,
+ int count);
+typedef void (*DRI2DestroyBuffersProcPtr) (DrawablePtr pDraw,
+ DRI2BufferPtr buffers, int count);
+typedef void (*DRI2CopyRegionProcPtr) (DrawablePtr pDraw,
+ RegionPtr pRegion,
+ DRI2BufferPtr pDestBuffer,
+ DRI2BufferPtr pSrcBuffer);
+typedef void (*DRI2WaitProcPtr) (WindowPtr pWin, unsigned int sequence);
+typedef int (*DRI2AuthMagicProcPtr) (int fd, uint32_t magic);
/**
* Schedule a buffer swap
@@ -95,20 +92,19 @@ typedef int (*DRI2AuthMagicProcPtr)(int fd, uint32_t magic);
* \param func function to call when the swap completes
* \param data data for the callback \p func.
*/
-typedef int (*DRI2ScheduleSwapProcPtr)(ClientPtr client,
- DrawablePtr pDraw,
- DRI2BufferPtr pDestBuffer,
- DRI2BufferPtr pSrcBuffer,
- CARD64 *target_msc,
- CARD64 divisor,
- CARD64 remainder,
- DRI2SwapEventPtr func,
- void *data);
-typedef DRI2BufferPtr (*DRI2CreateBufferProcPtr)(DrawablePtr pDraw,
- unsigned int attachment,
- unsigned int format);
-typedef void (*DRI2DestroyBufferProcPtr)(DrawablePtr pDraw,
- DRI2BufferPtr buffer);
+typedef int (*DRI2ScheduleSwapProcPtr) (ClientPtr client,
+ DrawablePtr pDraw,
+ DRI2BufferPtr pDestBuffer,
+ DRI2BufferPtr pSrcBuffer,
+ CARD64 * target_msc,
+ CARD64 divisor,
+ CARD64 remainder,
+ DRI2SwapEventPtr func, void *data);
+typedef DRI2BufferPtr(*DRI2CreateBufferProcPtr) (DrawablePtr pDraw,
+ unsigned int attachment,
+ unsigned int format);
+typedef void (*DRI2DestroyBufferProcPtr) (DrawablePtr pDraw,
+ DRI2BufferPtr buffer);
/**
* Notifies driver when DRI2GetBuffers reuses a dri2 buffer.
*
@@ -117,8 +113,8 @@ typedef void (*DRI2DestroyBufferProcPtr)(DrawablePtr pDraw,
* \param pDraw drawable whose count we want
* \param buffer buffer that will be returned to client
*/
-typedef void (*DRI2ReuseBufferNotifyProcPtr)(DrawablePtr pDraw,
- DRI2BufferPtr buffer);
+typedef void (*DRI2ReuseBufferNotifyProcPtr) (DrawablePtr pDraw,
+ DRI2BufferPtr buffer);
/**
* Get current media stamp counter values
*
@@ -137,8 +133,8 @@ typedef void (*DRI2ReuseBufferNotifyProcPtr)(DrawablePtr pDraw,
* \param ust timestamp from when the count was last incremented.
* \param mst current frame count
*/
-typedef int (*DRI2GetMSCProcPtr)(DrawablePtr pDraw, CARD64 *ust,
- CARD64 *msc);
+typedef int (*DRI2GetMSCProcPtr) (DrawablePtr pDraw, CARD64 * ust,
+ CARD64 * msc);
/**
* Schedule a frame count related wait
*
@@ -159,15 +155,12 @@ typedef int (*DRI2GetMSCProcPtr)(DrawablePtr pDraw, CARD64 *ust,
* \param divisor divisor for condition equation
* \param remainder remainder for division equation
*/
-typedef int (*DRI2ScheduleWaitMSCProcPtr)(ClientPtr client,
- DrawablePtr pDraw,
- CARD64 target_msc,
- CARD64 divisor,
- CARD64 remainder);
+typedef int (*DRI2ScheduleWaitMSCProcPtr) (ClientPtr client,
+ DrawablePtr pDraw,
+ CARD64 target_msc,
+ CARD64 divisor, CARD64 remainder);
-typedef void (*DRI2InvalidateProcPtr)(DrawablePtr pDraw,
- void *data,
- XID id);
+typedef void (*DRI2InvalidateProcPtr) (DrawablePtr pDraw, void *data, XID id);
/**
* DRI2 calls this hook when ever swap_limit is going to be changed. Default
@@ -179,8 +172,8 @@ typedef void (*DRI2InvalidateProcPtr)(DrawablePtr pDraw,
* \param swap_limit new swap_limit that going to be set
* \return TRUE if limit is support, FALSE if not.
*/
-typedef Bool (*DRI2SwapLimitValidateProcPtr)(DrawablePtr pDraw,
- int swap_limit);
+typedef Bool (*DRI2SwapLimitValidateProcPtr) (DrawablePtr pDraw,
+ int swap_limit);
/**
* Version of the DRI2InfoRec structure defined in this header
@@ -188,74 +181,71 @@ typedef Bool (*DRI2SwapLimitValidateProcPtr)(DrawablePtr pDraw,
#define DRI2INFOREC_VERSION 6
typedef struct {
- unsigned int version; /**< Version of this struct */
+ unsigned int version; /**< Version of this struct */
int fd;
const char *driverName;
const char *deviceName;
- DRI2CreateBufferProcPtr CreateBuffer;
- DRI2DestroyBufferProcPtr DestroyBuffer;
- DRI2CopyRegionProcPtr CopyRegion;
- DRI2WaitProcPtr Wait;
+ DRI2CreateBufferProcPtr CreateBuffer;
+ DRI2DestroyBufferProcPtr DestroyBuffer;
+ DRI2CopyRegionProcPtr CopyRegion;
+ DRI2WaitProcPtr Wait;
/* added in version 4 */
- DRI2ScheduleSwapProcPtr ScheduleSwap;
- DRI2GetMSCProcPtr GetMSC;
- DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
+ DRI2ScheduleSwapProcPtr ScheduleSwap;
+ DRI2GetMSCProcPtr GetMSC;
+ DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
/* number of drivers in the driverNames array */
unsigned int numDrivers;
/* array of driver names, indexed by DRI2Driver* driver types */
/* a name of NULL means that driver is not supported */
- const char * const *driverNames;
+ const char *const *driverNames;
/* added in version 5 */
- DRI2AuthMagicProcPtr AuthMagic;
+ DRI2AuthMagicProcPtr AuthMagic;
/* added in version 6 */
DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify;
DRI2SwapLimitValidateProcPtr SwapLimitValidate;
-} DRI2InfoRec, *DRI2InfoPtr;
+} DRI2InfoRec, *DRI2InfoPtr;
extern _X_EXPORT int DRI2EventBase;
-extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen,
- DRI2InfoPtr info);
+extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info);
extern _X_EXPORT void DRI2CloseScreen(ScreenPtr pScreen);
extern _X_EXPORT Bool DRI2HasSwapControl(ScreenPtr pScreen);
extern _X_EXPORT Bool DRI2Connect(ScreenPtr pScreen,
- unsigned int driverType,
- int *fd,
- const char **driverName,
- const char **deviceName);
+ unsigned int driverType,
+ int *fd,
+ const char **driverName,
+ const char **deviceName);
extern _X_EXPORT Bool DRI2Authenticate(ScreenPtr pScreen, uint32_t magic);
extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client,
- DrawablePtr pDraw,
- XID id,
- DRI2InvalidateProcPtr invalidate,
- void *priv);
+ DrawablePtr pDraw,
+ XID id,
+ DRI2InvalidateProcPtr invalidate,
+ void *priv);
extern _X_EXPORT void DRI2DestroyDrawable(DrawablePtr pDraw);
extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffers(DrawablePtr pDraw,
- int *width,
- int *height,
- unsigned int *attachments,
- int count,
- int *out_count);
+ int *width,
+ int *height,
+ unsigned int *attachments,
+ int count, int *out_count);
extern _X_EXPORT int DRI2CopyRegion(DrawablePtr pDraw,
- RegionPtr pRegion,
- unsigned int dest,
- unsigned int src);
+ RegionPtr pRegion,
+ unsigned int dest, unsigned int src);
/**
* Determine the major and minor version of the DRI2 extension.
@@ -276,26 +266,30 @@ extern _X_EXPORT int DRI2CopyRegion(DrawablePtr pDraw,
extern _X_EXPORT void DRI2Version(int *major, int *minor);
extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffersWithFormat(DrawablePtr pDraw,
- int *width, int *height, unsigned int *attachments, int count,
- int *out_count);
+ int *width,
+ int *height,
+ unsigned int
+ *attachments,
+ int count,
+ int *out_count);
extern _X_EXPORT void DRI2SwapInterval(DrawablePtr pDrawable, int interval);
extern _X_EXPORT Bool DRI2SwapLimit(DrawablePtr pDraw, int swap_limit);
extern _X_EXPORT int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDrawable,
- CARD64 target_msc, CARD64 divisor,
- CARD64 remainder, CARD64 *swap_target,
- DRI2SwapEventPtr func, void *data);
+ CARD64 target_msc, CARD64 divisor,
+ CARD64 remainder, CARD64 * swap_target,
+ DRI2SwapEventPtr func, void *data);
extern _X_EXPORT Bool DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable);
-extern _X_EXPORT int DRI2GetMSC(DrawablePtr pDrawable, CARD64 *ust,
- CARD64 *msc, CARD64 *sbc);
+extern _X_EXPORT int DRI2GetMSC(DrawablePtr pDrawable, CARD64 * ust,
+ CARD64 * msc, CARD64 * sbc);
extern _X_EXPORT int DRI2WaitMSC(ClientPtr client, DrawablePtr pDrawable,
- CARD64 target_msc, CARD64 divisor,
- CARD64 remainder);
+ CARD64 target_msc, CARD64 divisor,
+ CARD64 remainder);
extern _X_EXPORT int ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust,
- CARD64 msc, CARD64 sbc);
+ CARD64 msc, CARD64 sbc);
extern _X_EXPORT int DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw,
- CARD64 target_sbc);
+ CARD64 target_sbc);
extern _X_EXPORT Bool DRI2ThrottleClient(ClientPtr client, DrawablePtr pDraw);
extern _X_EXPORT Bool DRI2CanFlip(DrawablePtr pDraw);
@@ -306,12 +300,12 @@ extern _X_EXPORT Bool DRI2CanExchange(DrawablePtr pDraw);
extern _X_EXPORT void DRI2BlockClient(ClientPtr client, DrawablePtr pDraw);
extern _X_EXPORT void DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw,
- int frame, unsigned int tv_sec,
- unsigned int tv_usec, int type,
- DRI2SwapEventPtr swap_complete,
- void *swap_data);
+ int frame, unsigned int tv_sec,
+ unsigned int tv_usec, int type,
+ DRI2SwapEventPtr swap_complete,
+ void *swap_data);
extern _X_EXPORT void DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw,
- int frame, unsigned int tv_sec,
- unsigned int tv_usec);
+ int frame, unsigned int tv_sec,
+ unsigned int tv_usec);
#endif
diff --git a/xorg-server/hw/xfree86/dri2/dri2ext.c b/xorg-server/hw/xfree86/dri2/dri2ext.c
index 73ef7f25e..2579a5c86 100644
--- a/xorg-server/hw/xfree86/dri2/dri2ext.c
+++ b/xorg-server/hw/xfree86/dri2/dri2ext.c
@@ -49,19 +49,19 @@
/* The only xf86 include */
#include "xf86Module.h"
-static ExtensionEntry *dri2Extension;
+static ExtensionEntry *dri2Extension;
extern Bool DRI2ModuleSetup(void);
static Bool
validDrawable(ClientPtr client, XID drawable, Mask access_mode,
- DrawablePtr *pDrawable, int *status)
+ DrawablePtr *pDrawable, int *status)
{
*status = dixLookupDrawable(pDrawable, drawable, client,
- M_DRAWABLE_WINDOW | M_DRAWABLE_PIXMAP,
- access_mode);
+ M_DRAWABLE_WINDOW | M_DRAWABLE_PIXMAP,
+ access_mode);
if (*status != Success) {
- client->errorValue = drawable;
- return FALSE;
+ client->errorValue = drawable;
+ return FALSE;
}
return TRUE;
@@ -74,7 +74,7 @@ ProcDRI2QueryVersion(ClientPtr client)
xDRI2QueryVersionReply rep;
if (client->swapped)
- swaps(&stuff->length);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDRI2QueryVersionReq);
rep.type = X_Reply;
@@ -84,10 +84,10 @@ ProcDRI2QueryVersion(ClientPtr client)
rep.minorVersion = dri2_minor;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
}
WriteToClient(client, sizeof(xDRI2QueryVersionReply), &rep);
@@ -107,9 +107,9 @@ ProcDRI2Connect(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2ConnectReq);
if (!validDrawable(client, stuff->window, DixGetAttrAccess,
- &pDraw, &status))
- return status;
-
+ &pDraw, &status))
+ return status;
+
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@@ -117,13 +117,13 @@ ProcDRI2Connect(ClientPtr client)
rep.deviceNameLength = 0;
if (!DRI2Connect(pDraw->pScreen,
- stuff->driverType, &fd, &driverName, &deviceName))
- goto fail;
+ stuff->driverType, &fd, &driverName, &deviceName))
+ goto fail;
rep.driverNameLength = strlen(driverName);
rep.deviceNameLength = strlen(deviceName);
rep.length = (rep.driverNameLength + 3) / 4 +
- (rep.deviceNameLength + 3) / 4;
+ (rep.deviceNameLength + 3) / 4;
fail:
WriteToClient(client, sizeof(xDRI2ConnectReply), &rep);
@@ -143,8 +143,8 @@ ProcDRI2Authenticate(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2AuthenticateReq);
if (!validDrawable(client, stuff->window, DixGetAttrAccess,
- &pDraw, &status))
- return status;
+ &pDraw, &status))
+ return status;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
@@ -164,7 +164,7 @@ DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv, XID id)
event.type = DRI2EventBase + DRI2_InvalidateBuffers;
event.drawable = id;
- WriteEventsToClient(client, 1, (xEvent *)&event);
+ WriteEventsToClient(client, 1, (xEvent *) &event);
}
static int
@@ -177,13 +177,13 @@ ProcDRI2CreateDrawable(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq);
if (!validDrawable(client, stuff->drawable, DixAddAccess,
- &pDrawable, &status))
- return status;
+ &pDrawable, &status))
+ return status;
status = DRI2CreateDrawable(client, pDrawable, stuff->drawable,
- DRI2InvalidateBuffersEvent, client);
+ DRI2InvalidateBuffersEvent, client);
if (status != Success)
- return status;
+ return status;
return Success;
}
@@ -197,33 +197,32 @@ ProcDRI2DestroyDrawable(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq);
if (!validDrawable(client, stuff->drawable, DixRemoveAccess,
- &pDrawable, &status))
- return status;
+ &pDrawable, &status))
+ return status;
return Success;
}
-
static int
send_buffers_reply(ClientPtr client, DrawablePtr pDrawable,
- DRI2BufferPtr *buffers, int count, int width, int height)
+ DRI2BufferPtr * buffers, int count, int width, int height)
{
xDRI2GetBuffersReply rep;
int skip = 0;
int i;
if (buffers == NULL)
- return BadAlloc;
+ return BadAlloc;
if (pDrawable->type == DRAWABLE_WINDOW) {
- for (i = 0; i < count; i++) {
- /* Do not send the real front buffer of a window to the client.
- */
- if (buffers[i]->attachment == DRI2BufferFrontLeft) {
- skip++;
- continue;
- }
- }
+ for (i = 0; i < count; i++) {
+ /* Do not send the real front buffer of a window to the client.
+ */
+ if (buffers[i]->attachment == DRI2BufferFrontLeft) {
+ skip++;
+ continue;
+ }
+ }
}
rep.type = X_Reply;
@@ -235,26 +234,25 @@ send_buffers_reply(ClientPtr client, DrawablePtr pDrawable,
WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep);
for (i = 0; i < count; i++) {
- xDRI2Buffer buffer;
-
- /* Do not send the real front buffer of a window to the client.
- */
- if ((pDrawable->type == DRAWABLE_WINDOW)
- && (buffers[i]->attachment == DRI2BufferFrontLeft)) {
- continue;
- }
-
- buffer.attachment = buffers[i]->attachment;
- buffer.name = buffers[i]->name;
- buffer.pitch = buffers[i]->pitch;
- buffer.cpp = buffers[i]->cpp;
- buffer.flags = buffers[i]->flags;
- WriteToClient(client, sizeof(xDRI2Buffer), &buffer);
+ xDRI2Buffer buffer;
+
+ /* Do not send the real front buffer of a window to the client.
+ */
+ if ((pDrawable->type == DRAWABLE_WINDOW)
+ && (buffers[i]->attachment == DRI2BufferFrontLeft)) {
+ continue;
+ }
+
+ buffer.attachment = buffers[i]->attachment;
+ buffer.name = buffers[i]->name;
+ buffer.pitch = buffers[i]->pitch;
+ buffer.cpp = buffers[i]->cpp;
+ buffer.flags = buffers[i]->flags;
+ WriteToClient(client, sizeof(xDRI2Buffer), &buffer);
}
return Success;
}
-
static int
ProcDRI2GetBuffers(ClientPtr client)
{
@@ -266,16 +264,15 @@ ProcDRI2GetBuffers(ClientPtr client)
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4);
if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
- &pDrawable, &status))
- return status;
+ &pDrawable, &status))
+ return status;
if (DRI2ThrottleClient(client, pDrawable))
- return Success;
+ return Success;
attachments = (unsigned int *) &stuff[1];
buffers = DRI2GetBuffers(pDrawable, &width, &height,
- attachments, stuff->count, &count);
-
+ attachments, stuff->count, &count);
return send_buffers_reply(client, pDrawable, buffers, count, width, height);
@@ -292,15 +289,15 @@ ProcDRI2GetBuffersWithFormat(ClientPtr client)
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * (2 * 4));
if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
- &pDrawable, &status))
- return status;
+ &pDrawable, &status))
+ return status;
if (DRI2ThrottleClient(client, pDrawable))
- return Success;
+ return Success;
attachments = (unsigned int *) &stuff[1];
buffers = DRI2GetBuffersWithFormat(pDrawable, &width, &height,
- attachments, stuff->count, &count);
+ attachments, stuff->count, &count);
return send_buffers_reply(client, pDrawable, buffers, count, width, height);
}
@@ -317,14 +314,14 @@ ProcDRI2CopyRegion(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2CopyRegionReq);
if (!validDrawable(client, stuff->drawable, DixWriteAccess,
- &pDrawable, &status))
- return status;
+ &pDrawable, &status))
+ return status;
VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);
status = DRI2CopyRegion(pDrawable, pRegion, stuff->dest, stuff->src);
if (status != Success)
- return status;
+ return status;
/* CopyRegion needs to be a round trip to make sure the X server
* queues the swap buffer rendering commands before the DRI client
@@ -343,7 +340,7 @@ ProcDRI2CopyRegion(ClientPtr client)
}
static void
-load_swap_reply(xDRI2SwapBuffersReply *rep, CARD64 sbc)
+load_swap_reply(xDRI2SwapBuffersReply * rep, CARD64 sbc)
{
rep->swap_hi = sbc >> 32;
rep->swap_lo = sbc & 0xffffffff;
@@ -352,12 +349,12 @@ load_swap_reply(xDRI2SwapBuffersReply *rep, CARD64 sbc)
static CARD64
vals_to_card64(CARD32 lo, CARD32 hi)
{
- return (CARD64)hi << 32 | lo;
+ return (CARD64) hi << 32 | lo;
}
static void
DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc,
- CARD32 sbc)
+ CARD32 sbc)
{
xDRI2BufferSwapComplete2 event;
DrawablePtr pDrawable = data;
@@ -365,13 +362,13 @@ DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc,
event.type = DRI2EventBase + DRI2_BufferSwapComplete;
event.event_type = type;
event.drawable = pDrawable->id;
- event.ust_hi = (CARD64)ust >> 32;
+ event.ust_hi = (CARD64) ust >> 32;
event.ust_lo = ust & 0xffffffff;
- event.msc_hi = (CARD64)msc >> 32;
+ event.msc_hi = (CARD64) msc >> 32;
event.msc_lo = msc & 0xffffffff;
event.sbc = sbc;
- WriteEventsToClient(client, 1, (xEvent *)&event);
+ WriteEventsToClient(client, 1, (xEvent *) &event);
}
static int
@@ -386,24 +383,24 @@ ProcDRI2SwapBuffers(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2SwapBuffersReq);
if (!validDrawable(client, stuff->drawable,
- DixReadAccess | DixWriteAccess, &pDrawable, &status))
- return status;
+ DixReadAccess | DixWriteAccess, &pDrawable, &status))
+ return status;
/*
* Ensures an out of control client can't exhaust our swap queue, and
* also orders swaps.
*/
if (DRI2ThrottleClient(client, pDrawable))
- return Success;
+ return Success;
target_msc = vals_to_card64(stuff->target_msc_lo, stuff->target_msc_hi);
divisor = vals_to_card64(stuff->divisor_lo, stuff->divisor_hi);
remainder = vals_to_card64(stuff->remainder_lo, stuff->remainder_hi);
status = DRI2SwapBuffers(client, pDrawable, target_msc, divisor, remainder,
- &swap_target, DRI2SwapEvent, pDrawable);
+ &swap_target, DRI2SwapEvent, pDrawable);
if (status != Success)
- return BadDrawable;
+ return BadDrawable;
rep.type = X_Reply;
rep.length = 0;
@@ -416,7 +413,7 @@ ProcDRI2SwapBuffers(ClientPtr client)
}
static void
-load_msc_reply(xDRI2MSCReply *rep, CARD64 ust, CARD64 msc, CARD64 sbc)
+load_msc_reply(xDRI2MSCReply * rep, CARD64 ust, CARD64 msc, CARD64 sbc)
{
rep->ust_hi = ust >> 32;
rep->ust_lo = ust & 0xffffffff;
@@ -438,12 +435,12 @@ ProcDRI2GetMSC(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2GetMSCReq);
if (!validDrawable(client, stuff->drawable, DixReadAccess, &pDrawable,
- &status))
- return status;
+ &status))
+ return status;
status = DRI2GetMSC(pDrawable, &ust, &msc, &sbc);
if (status != Success)
- return status;
+ return status;
rep.type = X_Reply;
rep.length = 0;
@@ -468,8 +465,8 @@ ProcDRI2WaitMSC(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2WaitMSCReq);
if (!validDrawable(client, stuff->drawable, DixReadAccess, &pDrawable,
- &status))
- return status;
+ &status))
+ return status;
target = vals_to_card64(stuff->target_msc_lo, stuff->target_msc_hi);
divisor = vals_to_card64(stuff->divisor_lo, stuff->divisor_hi);
@@ -477,7 +474,7 @@ ProcDRI2WaitMSC(ClientPtr client)
status = DRI2WaitMSC(client, pDrawable, target, divisor, remainder);
if (status != Success)
- return status;
+ return status;
return Success;
}
@@ -509,8 +506,8 @@ ProcDRI2SwapInterval(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2SwapIntervalReq);
if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
- &pDrawable, &status))
- return status;
+ &pDrawable, &status))
+ return status;
DRI2SwapInterval(pDrawable, stuff->interval);
@@ -528,8 +525,8 @@ ProcDRI2WaitSBC(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2WaitSBCReq);
if (!validDrawable(client, stuff->drawable, DixReadAccess, &pDrawable,
- &status))
- return status;
+ &status))
+ return status;
target = vals_to_card64(stuff->target_sbc_lo, stuff->target_sbc_hi);
status = DRI2WaitSBC(client, pDrawable, target);
@@ -538,45 +535,45 @@ ProcDRI2WaitSBC(ClientPtr client)
}
static int
-ProcDRI2Dispatch (ClientPtr client)
+ProcDRI2Dispatch(ClientPtr client)
{
REQUEST(xReq);
-
+
switch (stuff->data) {
case X_DRI2QueryVersion:
- return ProcDRI2QueryVersion(client);
+ return ProcDRI2QueryVersion(client);
}
if (!LocalClient(client))
- return BadRequest;
+ return BadRequest;
switch (stuff->data) {
case X_DRI2Connect:
- return ProcDRI2Connect(client);
+ return ProcDRI2Connect(client);
case X_DRI2Authenticate:
- return ProcDRI2Authenticate(client);
+ return ProcDRI2Authenticate(client);
case X_DRI2CreateDrawable:
- return ProcDRI2CreateDrawable(client);
+ return ProcDRI2CreateDrawable(client);
case X_DRI2DestroyDrawable:
- return ProcDRI2DestroyDrawable(client);
+ return ProcDRI2DestroyDrawable(client);
case X_DRI2GetBuffers:
- return ProcDRI2GetBuffers(client);
+ return ProcDRI2GetBuffers(client);
case X_DRI2CopyRegion:
- return ProcDRI2CopyRegion(client);
+ return ProcDRI2CopyRegion(client);
case X_DRI2GetBuffersWithFormat:
- return ProcDRI2GetBuffersWithFormat(client);
+ return ProcDRI2GetBuffersWithFormat(client);
case X_DRI2SwapBuffers:
- return ProcDRI2SwapBuffers(client);
+ return ProcDRI2SwapBuffers(client);
case X_DRI2GetMSC:
- return ProcDRI2GetMSC(client);
+ return ProcDRI2GetMSC(client);
case X_DRI2WaitMSC:
- return ProcDRI2WaitMSC(client);
+ return ProcDRI2WaitMSC(client);
case X_DRI2WaitSBC:
- return ProcDRI2WaitSBC(client);
+ return ProcDRI2WaitSBC(client);
case X_DRI2SwapInterval:
- return ProcDRI2SwapInterval(client);
+ return ProcDRI2SwapInterval(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
@@ -590,7 +587,7 @@ SProcDRI2Connect(ClientPtr client)
swaps(&stuff->length);
if (sizeof(*stuff) / 4 != client->req_len)
- return BadLength;
+ return BadLength;
rep.sequenceNumber = client->sequence;
swaps(&rep.sequenceNumber);
@@ -602,7 +599,7 @@ SProcDRI2Connect(ClientPtr client)
}
static int
-SProcDRI2Dispatch (ClientPtr client)
+SProcDRI2Dispatch(ClientPtr client)
{
REQUEST(xReq);
@@ -610,14 +607,13 @@ SProcDRI2Dispatch (ClientPtr client)
* Only local clients are allowed DRI access, but remote clients
* still need these requests to find out cleanly.
*/
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_DRI2QueryVersion:
- return ProcDRI2QueryVersion(client);
+ return ProcDRI2QueryVersion(client);
case X_DRI2Connect:
- return SProcDRI2Connect(client);
+ return SProcDRI2Connect(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
@@ -627,12 +623,10 @@ static void
DRI2ExtensionInit(void)
{
dri2Extension = AddExtension(DRI2_NAME,
- DRI2NumberEvents,
- DRI2NumberErrors,
- ProcDRI2Dispatch,
- SProcDRI2Dispatch,
- NULL,
- StandardMinorOpcode);
+ DRI2NumberEvents,
+ DRI2NumberErrors,
+ ProcDRI2Dispatch,
+ SProcDRI2Dispatch, NULL, StandardMinorOpcode);
DRI2EventBase = dri2Extension->eventBase;
diff --git a/xorg-server/hw/xfree86/exa/examodule.c b/xorg-server/hw/xfree86/exa/examodule.c
index 15560513d..72cf7988d 100644
--- a/xorg-server/hw/xfree86/exa/examodule.c
+++ b/xorg-server/hw/xfree86/exa/examodule.c
@@ -37,12 +37,13 @@
#include "xf86.h"
typedef struct _ExaXorgScreenPrivRec {
- CloseScreenProcPtr SavedCloseScreen;
+ CloseScreenProcPtr SavedCloseScreen;
EnableDisableFBAccessProcPtr SavedEnableDisableFBAccess;
- OptionInfoPtr options;
+ OptionInfoPtr options;
} ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr;
static DevPrivateKeyRec exaXorgScreenPrivateKeyRec;
+
#define exaXorgScreenPrivateKey (&exaXorgScreenPrivateKeyRec)
typedef enum {
@@ -54,26 +55,26 @@ typedef enum {
} EXAOpts;
static const OptionInfoRec EXAOptions[] = {
- { EXAOPT_MIGRATION_HEURISTIC, "MigrationHeuristic",
- OPTV_ANYSTR, {0}, FALSE },
- { EXAOPT_NO_COMPOSITE, "EXANoComposite",
- OPTV_BOOLEAN, {0}, FALSE },
- { EXAOPT_NO_UTS, "EXANoUploadToScreen",
- OPTV_BOOLEAN, {0}, FALSE },
- { EXAOPT_NO_DFS, "EXANoDownloadFromScreen",
- OPTV_BOOLEAN, {0}, FALSE },
- { EXAOPT_OPTIMIZE_MIGRATION, "EXAOptimizeMigration",
- OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL,
- OPTV_NONE, {0}, FALSE }
+ {EXAOPT_MIGRATION_HEURISTIC, "MigrationHeuristic",
+ OPTV_ANYSTR, {0}, FALSE},
+ {EXAOPT_NO_COMPOSITE, "EXANoComposite",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {EXAOPT_NO_UTS, "EXANoUploadToScreen",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {EXAOPT_NO_DFS, "EXANoDownloadFromScreen",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {EXAOPT_OPTIMIZE_MIGRATION, "EXAOptimizeMigration",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL,
+ OPTV_NONE, {0}, FALSE}
};
static Bool
-exaXorgCloseScreen (int i, ScreenPtr pScreen)
+exaXorgCloseScreen(int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
- dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
+ dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
pScreen->CloseScreen = pScreenPriv->SavedCloseScreen;
@@ -82,24 +83,24 @@ exaXorgCloseScreen (int i, ScreenPtr pScreen)
free(pScreenPriv->options);
free(pScreenPriv);
- return pScreen->CloseScreen (i, pScreen);
+ return pScreen->CloseScreen(i, pScreen);
}
static void
-exaXorgEnableDisableFBAccess (int index, Bool enable)
+exaXorgEnableDisableFBAccess(int index, Bool enable)
{
ScreenPtr pScreen = screenInfo.screens[index];
ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
- dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
+ dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
if (!enable)
- exaEnableDisableFBAccess (index, enable);
+ exaEnableDisableFBAccess(index, enable);
if (pScreenPriv->SavedEnableDisableFBAccess)
- pScreenPriv->SavedEnableDisableFBAccess (index, enable);
+ pScreenPriv->SavedEnableDisableFBAccess(index, enable);
if (enable)
- exaEnableDisableFBAccess (index, enable);
+ exaEnableDisableFBAccess(index, enable);
}
/**
@@ -115,87 +116,83 @@ exaDDXDriverInit(ScreenPtr pScreen)
ExaXorgScreenPrivPtr pScreenPriv;
if (!dixRegisterPrivateKey(&exaXorgScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return;
+ return;
pScreenPriv = calloc(1, sizeof(ExaXorgScreenPrivRec));
if (pScreenPriv == NULL)
- return;
+ return;
- pScreenPriv->options = xnfalloc (sizeof(EXAOptions));
+ pScreenPriv->options = xnfalloc(sizeof(EXAOptions));
memcpy(pScreenPriv->options, EXAOptions, sizeof(EXAOptions));
- xf86ProcessOptions (pScrn->scrnIndex, pScrn->options, pScreenPriv->options);
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pScreenPriv->options);
if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) {
- if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) &&
- pExaScr->info->offScreenBase < pExaScr->info->memorySize) {
- char *heuristicName;
-
- heuristicName = xf86GetOptValString (pScreenPriv->options,
- EXAOPT_MIGRATION_HEURISTIC);
- if (heuristicName != NULL) {
- if (strcmp(heuristicName, "greedy") == 0)
- pExaScr->migration = ExaMigrationGreedy;
- else if (strcmp(heuristicName, "always") == 0)
- pExaScr->migration = ExaMigrationAlways;
- else if (strcmp(heuristicName, "smart") == 0)
- pExaScr->migration = ExaMigrationSmart;
- else {
- xf86DrvMsg (pScreen->myNum, X_WARNING,
- "EXA: unknown migration heuristic %s\n",
- heuristicName);
- }
- }
- }
-
- pExaScr->optimize_migration =
- xf86ReturnOptValBool(pScreenPriv->options,
- EXAOPT_OPTIMIZE_MIGRATION,
- TRUE);
+ if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) &&
+ pExaScr->info->offScreenBase < pExaScr->info->memorySize) {
+ char *heuristicName;
+
+ heuristicName = xf86GetOptValString(pScreenPriv->options,
+ EXAOPT_MIGRATION_HEURISTIC);
+ if (heuristicName != NULL) {
+ if (strcmp(heuristicName, "greedy") == 0)
+ pExaScr->migration = ExaMigrationGreedy;
+ else if (strcmp(heuristicName, "always") == 0)
+ pExaScr->migration = ExaMigrationAlways;
+ else if (strcmp(heuristicName, "smart") == 0)
+ pExaScr->migration = ExaMigrationSmart;
+ else {
+ xf86DrvMsg(pScreen->myNum, X_WARNING,
+ "EXA: unknown migration heuristic %s\n",
+ heuristicName);
+ }
+ }
+ }
+
+ pExaScr->optimize_migration =
+ xf86ReturnOptValBool(pScreenPriv->options,
+ EXAOPT_OPTIMIZE_MIGRATION, TRUE);
}
- if (xf86ReturnOptValBool(pScreenPriv->options,
- EXAOPT_NO_COMPOSITE, FALSE)) {
- xf86DrvMsg(pScreen->myNum, X_CONFIG,
- "EXA: Disabling Composite operation "
- "(RENDER acceleration)\n");
- pExaScr->info->CheckComposite = NULL;
- pExaScr->info->PrepareComposite = NULL;
+ if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_COMPOSITE, FALSE)) {
+ xf86DrvMsg(pScreen->myNum, X_CONFIG,
+ "EXA: Disabling Composite operation "
+ "(RENDER acceleration)\n");
+ pExaScr->info->CheckComposite = NULL;
+ pExaScr->info->PrepareComposite = NULL;
}
if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_UTS, FALSE)) {
- xf86DrvMsg(pScreen->myNum, X_CONFIG,
- "EXA: Disabling UploadToScreen\n");
- pExaScr->info->UploadToScreen = NULL;
+ xf86DrvMsg(pScreen->myNum, X_CONFIG, "EXA: Disabling UploadToScreen\n");
+ pExaScr->info->UploadToScreen = NULL;
}
if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_DFS, FALSE)) {
- xf86DrvMsg(pScreen->myNum, X_CONFIG,
- "EXA: Disabling DownloadFromScreen\n");
- pExaScr->info->DownloadFromScreen = NULL;
+ xf86DrvMsg(pScreen->myNum, X_CONFIG,
+ "EXA: Disabling DownloadFromScreen\n");
+ pExaScr->info->DownloadFromScreen = NULL;
}
dixSetPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey, pScreenPriv);
pScreenPriv->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess;
pScrn->EnableDisableFBAccess = exaXorgEnableDisableFBAccess;
-
+
pScreenPriv->SavedCloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = exaXorgCloseScreen;
-
+
}
-static XF86ModuleVersionInfo exaVersRec =
-{
- "exa",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- EXA_VERSION_MAJOR, EXA_VERSION_MINOR, EXA_VERSION_RELEASE,
- ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
+static XF86ModuleVersionInfo exaVersRec = {
+ "exa",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ EXA_VERSION_MAJOR, EXA_VERSION_MINOR, EXA_VERSION_RELEASE,
+ ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
};
_X_EXPORT XF86ModuleData exaModuleData = { &exaVersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c
index 309fa654a..2881d7ec2 100644
--- a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c
@@ -20,18 +20,17 @@
#define PAGE_MASK (~(getpagesize() - 1))
-static XF86ModuleVersionInfo fbdevHWVersRec =
-{
- "fbdevhw",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 0, 0, 2,
- ABI_CLASS_VIDEODRV,
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
+static XF86ModuleVersionInfo fbdevHWVersRec = {
+ "fbdevhw",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 0, 0, 2,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
};
_X_EXPORT XF86ModuleData fbdevhwModuleData = {
@@ -57,49 +56,49 @@ _X_EXPORT XF86ModuleData fbdevhwModuleData = {
static int fbdevHWPrivateIndex = -1;
typedef struct {
- /* framebuffer device: filename (/dev/fb*), handle, more */
- char* device;
- int fd;
- void* fbmem;
- unsigned int fbmem_len;
- unsigned int fboff;
- char* mmio;
- unsigned int mmio_len;
+ /* framebuffer device: filename (/dev/fb*), handle, more */
+ char *device;
+ int fd;
+ void *fbmem;
+ unsigned int fbmem_len;
+ unsigned int fboff;
+ char *mmio;
+ unsigned int mmio_len;
- /* current hardware state */
- struct fb_fix_screeninfo fix;
- struct fb_var_screeninfo var;
+ /* current hardware state */
+ struct fb_fix_screeninfo fix;
+ struct fb_var_screeninfo var;
- /* saved video mode */
- struct fb_var_screeninfo saved_var;
+ /* saved video mode */
+ struct fb_var_screeninfo saved_var;
- /* buildin video mode */
- DisplayModeRec buildin;
+ /* buildin video mode */
+ DisplayModeRec buildin;
} fbdevHWRec, *fbdevHWPtr;
Bool
fbdevHWGetRec(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr;
-
- if (fbdevHWPrivateIndex < 0)
- fbdevHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+ fbdevHWPtr fPtr;
+
+ if (fbdevHWPrivateIndex < 0)
+ fbdevHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+
+ if (FBDEVHWPTR(pScrn) != NULL)
+ return TRUE;
- if (FBDEVHWPTR(pScrn) != NULL)
- return TRUE;
-
- fPtr = FBDEVHWPTRLVAL(pScrn) = xnfcalloc(sizeof(fbdevHWRec), 1);
- return TRUE;
+ fPtr = FBDEVHWPTRLVAL(pScrn) = xnfcalloc(sizeof(fbdevHWRec), 1);
+ return TRUE;
}
void
fbdevHWFreeRec(ScrnInfoPtr pScrn)
{
- if (fbdevHWPrivateIndex < 0)
- return;
- free(FBDEVHWPTR(pScrn));
- FBDEVHWPTRLVAL(pScrn) = NULL;
+ if (fbdevHWPrivateIndex < 0)
+ return;
+ free(FBDEVHWPTR(pScrn));
+ FBDEVHWPTRLVAL(pScrn) = NULL;
}
int
@@ -120,21 +119,21 @@ fbdevHWGetFD(ScrnInfoPtr pScrn)
static void
print_fbdev_mode(char *txt, struct fb_var_screeninfo *var)
{
- ErrorF( "fbdev %s mode:\t%d %d %d %d %d %d %d %d %d %d %d:%d:%d\n",
- txt,var->pixclock,
- var->xres, var->right_margin, var->hsync_len, var->left_margin,
- var->yres, var->lower_margin, var->vsync_len, var->upper_margin,
- var->bits_per_pixel,
- var->red.length, var->green.length, var->blue.length);
+ ErrorF("fbdev %s mode:\t%d %d %d %d %d %d %d %d %d %d %d:%d:%d\n",
+ txt, var->pixclock,
+ var->xres, var->right_margin, var->hsync_len, var->left_margin,
+ var->yres, var->lower_margin, var->vsync_len, var->upper_margin,
+ var->bits_per_pixel,
+ var->red.length, var->green.length, var->blue.length);
}
static void
print_xfree_mode(char *txt, DisplayModePtr mode)
{
- ErrorF( "xfree %s mode:\t%d %d %d %d %d %d %d %d %d\n",
- txt,mode->Clock,
- mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
- mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal);
+ ErrorF("xfree %s mode:\t%d %d %d %d %d %d %d %d %d\n",
+ txt, mode->Clock,
+ mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
+ mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal);
}
#endif
@@ -144,111 +143,111 @@ print_xfree_mode(char *txt, DisplayModePtr mode)
static void
xfree2fbdev_fblayout(ScrnInfoPtr pScrn, struct fb_var_screeninfo *var)
{
- var->xres_virtual = pScrn->displayWidth ? pScrn->displayWidth :
- pScrn->virtualX;
- var->yres_virtual = pScrn->virtualY;
- var->bits_per_pixel = pScrn->bitsPerPixel;
- if (pScrn->defaultVisual == TrueColor ||
- pScrn->defaultVisual == DirectColor) {
- var->red.length = pScrn->weight.red;
- var->green.length = pScrn->weight.green;
- var->blue.length = pScrn->weight.blue;
- } else {
- var->red.length = 8;
- var->green.length = 8;
- var->blue.length = 8;
- }
+ var->xres_virtual = pScrn->displayWidth ? pScrn->displayWidth :
+ pScrn->virtualX;
+ var->yres_virtual = pScrn->virtualY;
+ var->bits_per_pixel = pScrn->bitsPerPixel;
+ if (pScrn->defaultVisual == TrueColor ||
+ pScrn->defaultVisual == DirectColor) {
+ var->red.length = pScrn->weight.red;
+ var->green.length = pScrn->weight.green;
+ var->blue.length = pScrn->weight.blue;
+ }
+ else {
+ var->red.length = 8;
+ var->green.length = 8;
+ var->blue.length = 8;
+ }
}
static void
xfree2fbdev_timing(DisplayModePtr mode, struct fb_var_screeninfo *var)
{
- var->xres = mode->HDisplay;
- var->yres = mode->VDisplay;
- if (var->xres_virtual < var->xres)
- var->xres_virtual = var->xres;
- if (var->yres_virtual < var->yres)
- var->yres_virtual = var->yres;
- var->xoffset = var->yoffset = 0;
- var->pixclock = mode->Clock ? 1000000000/mode->Clock : 0;
- var->right_margin = mode->HSyncStart-mode->HDisplay;
- var->hsync_len = mode->HSyncEnd-mode->HSyncStart;
- var->left_margin = mode->HTotal-mode->HSyncEnd;
- var->lower_margin = mode->VSyncStart-mode->VDisplay;
- var->vsync_len = mode->VSyncEnd-mode->VSyncStart;
- var->upper_margin = mode->VTotal-mode->VSyncEnd;
- var->sync = 0;
- if (mode->Flags & V_PHSYNC)
- var->sync |= FB_SYNC_HOR_HIGH_ACT;
- if (mode->Flags & V_PVSYNC)
- var->sync |= FB_SYNC_VERT_HIGH_ACT;
- if (mode->Flags & V_PCSYNC)
- var->sync |= FB_SYNC_COMP_HIGH_ACT;
- if (mode->Flags & V_BCAST)
- var->sync |= FB_SYNC_BROADCAST;
- if (mode->Flags & V_INTERLACE)
- var->vmode = FB_VMODE_INTERLACED;
- else if (mode->Flags & V_DBLSCAN)
- var->vmode = FB_VMODE_DOUBLE;
- else
- var->vmode = FB_VMODE_NONINTERLACED;
+ var->xres = mode->HDisplay;
+ var->yres = mode->VDisplay;
+ if (var->xres_virtual < var->xres)
+ var->xres_virtual = var->xres;
+ if (var->yres_virtual < var->yres)
+ var->yres_virtual = var->yres;
+ var->xoffset = var->yoffset = 0;
+ var->pixclock = mode->Clock ? 1000000000 / mode->Clock : 0;
+ var->right_margin = mode->HSyncStart - mode->HDisplay;
+ var->hsync_len = mode->HSyncEnd - mode->HSyncStart;
+ var->left_margin = mode->HTotal - mode->HSyncEnd;
+ var->lower_margin = mode->VSyncStart - mode->VDisplay;
+ var->vsync_len = mode->VSyncEnd - mode->VSyncStart;
+ var->upper_margin = mode->VTotal - mode->VSyncEnd;
+ var->sync = 0;
+ if (mode->Flags & V_PHSYNC)
+ var->sync |= FB_SYNC_HOR_HIGH_ACT;
+ if (mode->Flags & V_PVSYNC)
+ var->sync |= FB_SYNC_VERT_HIGH_ACT;
+ if (mode->Flags & V_PCSYNC)
+ var->sync |= FB_SYNC_COMP_HIGH_ACT;
+ if (mode->Flags & V_BCAST)
+ var->sync |= FB_SYNC_BROADCAST;
+ if (mode->Flags & V_INTERLACE)
+ var->vmode = FB_VMODE_INTERLACED;
+ else if (mode->Flags & V_DBLSCAN)
+ var->vmode = FB_VMODE_DOUBLE;
+ else
+ var->vmode = FB_VMODE_NONINTERLACED;
}
static Bool
fbdev_modes_equal(struct fb_var_screeninfo *set, struct fb_var_screeninfo *req)
{
- return (set->xres_virtual >= req->xres_virtual &&
- set->yres_virtual >= req->yres_virtual &&
- set->bits_per_pixel == req->bits_per_pixel &&
- set->red.length == req->red.length &&
- set->green.length == req->green.length &&
- set->blue.length == req->blue.length &&
- set->xres == req->xres && set->yres == req->yres &&
- set->right_margin == req->right_margin &&
- set->hsync_len == req->hsync_len &&
- set->left_margin == req->left_margin &&
- set->lower_margin == req->lower_margin &&
- set->vsync_len == req->vsync_len &&
- set->upper_margin == req->upper_margin &&
- set->sync == req->sync && set->vmode == req->vmode);
+ return (set->xres_virtual >= req->xres_virtual &&
+ set->yres_virtual >= req->yres_virtual &&
+ set->bits_per_pixel == req->bits_per_pixel &&
+ set->red.length == req->red.length &&
+ set->green.length == req->green.length &&
+ set->blue.length == req->blue.length &&
+ set->xres == req->xres && set->yres == req->yres &&
+ set->right_margin == req->right_margin &&
+ set->hsync_len == req->hsync_len &&
+ set->left_margin == req->left_margin &&
+ set->lower_margin == req->lower_margin &&
+ set->vsync_len == req->vsync_len &&
+ set->upper_margin == req->upper_margin &&
+ set->sync == req->sync && set->vmode == req->vmode);
}
static void
fbdev2xfree_timing(struct fb_var_screeninfo *var, DisplayModePtr mode)
{
- mode->Clock = var->pixclock ? 1000000000/var->pixclock : 0;
- mode->HDisplay = var->xres;
- mode->HSyncStart = mode->HDisplay+var->right_margin;
- mode->HSyncEnd = mode->HSyncStart+var->hsync_len;
- mode->HTotal = mode->HSyncEnd+var->left_margin;
- mode->VDisplay = var->yres;
- mode->VSyncStart = mode->VDisplay+var->lower_margin;
- mode->VSyncEnd = mode->VSyncStart+var->vsync_len;
- mode->VTotal = mode->VSyncEnd+var->upper_margin;
- mode->Flags = 0;
- mode->Flags |= var->sync & FB_SYNC_HOR_HIGH_ACT ? V_PHSYNC : V_NHSYNC;
- mode->Flags |= var->sync & FB_SYNC_VERT_HIGH_ACT ? V_PVSYNC : V_NVSYNC;
- mode->Flags |= var->sync & FB_SYNC_COMP_HIGH_ACT ? V_PCSYNC : V_NCSYNC;
- if (var->sync & FB_SYNC_BROADCAST)
- mode->Flags |= V_BCAST;
- if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED)
- mode->Flags |= V_INTERLACE;
- else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
- mode->Flags |= V_DBLSCAN;
- mode->SynthClock = mode->Clock;
- mode->CrtcHDisplay = mode->HDisplay;
- mode->CrtcHSyncStart = mode->HSyncStart;
- mode->CrtcHSyncEnd = mode->HSyncEnd;
- mode->CrtcHTotal = mode->HTotal;
- mode->CrtcVDisplay = mode->VDisplay;
- mode->CrtcVSyncStart = mode->VSyncStart;
- mode->CrtcVSyncEnd = mode->VSyncEnd;
- mode->CrtcVTotal = mode->VTotal;
- mode->CrtcHAdjusted = FALSE;
- mode->CrtcVAdjusted = FALSE;
+ mode->Clock = var->pixclock ? 1000000000 / var->pixclock : 0;
+ mode->HDisplay = var->xres;
+ mode->HSyncStart = mode->HDisplay + var->right_margin;
+ mode->HSyncEnd = mode->HSyncStart + var->hsync_len;
+ mode->HTotal = mode->HSyncEnd + var->left_margin;
+ mode->VDisplay = var->yres;
+ mode->VSyncStart = mode->VDisplay + var->lower_margin;
+ mode->VSyncEnd = mode->VSyncStart + var->vsync_len;
+ mode->VTotal = mode->VSyncEnd + var->upper_margin;
+ mode->Flags = 0;
+ mode->Flags |= var->sync & FB_SYNC_HOR_HIGH_ACT ? V_PHSYNC : V_NHSYNC;
+ mode->Flags |= var->sync & FB_SYNC_VERT_HIGH_ACT ? V_PVSYNC : V_NVSYNC;
+ mode->Flags |= var->sync & FB_SYNC_COMP_HIGH_ACT ? V_PCSYNC : V_NCSYNC;
+ if (var->sync & FB_SYNC_BROADCAST)
+ mode->Flags |= V_BCAST;
+ if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED)
+ mode->Flags |= V_INTERLACE;
+ else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
+ mode->Flags |= V_DBLSCAN;
+ mode->SynthClock = mode->Clock;
+ mode->CrtcHDisplay = mode->HDisplay;
+ mode->CrtcHSyncStart = mode->HSyncStart;
+ mode->CrtcHSyncEnd = mode->HSyncEnd;
+ mode->CrtcHTotal = mode->HTotal;
+ mode->CrtcVDisplay = mode->VDisplay;
+ mode->CrtcVSyncStart = mode->VSyncStart;
+ mode->CrtcVSyncEnd = mode->VSyncEnd;
+ mode->CrtcVTotal = mode->VTotal;
+ mode->CrtcHAdjusted = FALSE;
+ mode->CrtcVAdjusted = FALSE;
}
-
/* -------------------------------------------------------------------- */
/* open correct framebuffer device */
@@ -256,314 +255,316 @@ fbdev2xfree_timing(struct fb_var_screeninfo *var, DisplayModePtr mode)
* Try to find the framebuffer device for a given PCI device
*/
static int
-fbdev_open_pci(struct pci_device * pPci, char **namep)
+fbdev_open_pci(struct pci_device *pPci, char **namep)
{
- struct fb_fix_screeninfo fix;
- char filename[256];
- int fd, i;
+ struct fb_fix_screeninfo fix;
+ char filename[256];
+ int fd, i;
for (i = 0; i < 8; i++) {
- snprintf(filename, sizeof(filename),
- "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics/fb%d",
- pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
+ snprintf(filename, sizeof(filename),
+ "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics/fb%d",
+ pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
- fd = open(filename, O_RDONLY, 0);
+ fd = open(filename, O_RDONLY, 0);
if (fd < 0) {
snprintf(filename, sizeof(filename),
- "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics:fb%d",
- pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
+ "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics:fb%d",
+ pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
fd = open(filename, O_RDONLY, 0);
}
- if (fd >= 0) {
- close(fd);
- snprintf(filename, sizeof(filename), "/dev/fb%d", i);
-
- fd = open(filename, O_RDWR, 0);
- if (fd != -1) {
- if (ioctl(fd, FBIOGET_FSCREENINFO, (void*) & fix) != -1) {
- if (namep) {
- *namep = xnfalloc(16);
- strncpy(*namep,fix.id,16);
- }
-
- return fd;
- }
- close(fd);
- }
- }
+ if (fd >= 0) {
+ close(fd);
+ snprintf(filename, sizeof(filename), "/dev/fb%d", i);
+
+ fd = open(filename, O_RDWR, 0);
+ if (fd != -1) {
+ if (ioctl(fd, FBIOGET_FSCREENINFO, (void *) &fix) != -1) {
+ if (namep) {
+ *namep = xnfalloc(16);
+ strncpy(*namep, fix.id, 16);
+ }
+
+ return fd;
+ }
+ close(fd);
+ }
+ }
}
if (namep)
- *namep = NULL;
+ *namep = NULL;
xf86DrvMsg(-1, X_ERROR, "Unable to find a valid framebuffer device\n");
return -1;
}
static int
-fbdev_open(int scrnIndex, char *dev, char** namep)
-{
- struct fb_fix_screeninfo fix;
- int fd;
-
- /* try argument (from XF86Config) first */
- if (dev) {
- fd = open(dev,O_RDWR,0);
- } else {
- /* second: environment variable */
- dev = getenv("FRAMEBUFFER");
- if ((NULL == dev) || ((fd = open(dev,O_RDWR,0)) == -1)) {
- /* last try: default device */
- dev = "/dev/fb0";
- fd = open(dev,O_RDWR,0);
- }
- }
-
- if (fd == -1) {
- xf86DrvMsg(scrnIndex, X_ERROR,
- "open %s: %s\n", dev, strerror(errno));
- return -1;
- }
-
- if (namep) {
- if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)(&fix))) {
- *namep = NULL;
- xf86DrvMsg(scrnIndex, X_ERROR,
- "FBIOGET_FSCREENINFO: %s\n", strerror(errno));
- return -1;
- } else {
- *namep = xnfalloc(16);
- strncpy(*namep,fix.id,16);
- }
- }
- return fd;
+fbdev_open(int scrnIndex, char *dev, char **namep)
+{
+ struct fb_fix_screeninfo fix;
+ int fd;
+
+ /* try argument (from XF86Config) first */
+ if (dev) {
+ fd = open(dev, O_RDWR, 0);
+ }
+ else {
+ /* second: environment variable */
+ dev = getenv("FRAMEBUFFER");
+ if ((NULL == dev) || ((fd = open(dev, O_RDWR, 0)) == -1)) {
+ /* last try: default device */
+ dev = "/dev/fb0";
+ fd = open(dev, O_RDWR, 0);
+ }
+ }
+
+ if (fd == -1) {
+ xf86DrvMsg(scrnIndex, X_ERROR, "open %s: %s\n", dev, strerror(errno));
+ return -1;
+ }
+
+ if (namep) {
+ if (-1 == ioctl(fd, FBIOGET_FSCREENINFO, (void *) (&fix))) {
+ *namep = NULL;
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "FBIOGET_FSCREENINFO: %s\n", strerror(errno));
+ return -1;
+ }
+ else {
+ *namep = xnfalloc(16);
+ strncpy(*namep, fix.id, 16);
+ }
+ }
+ return fd;
}
/* -------------------------------------------------------------------- */
Bool
-fbdevHWProbe(struct pci_device * pPci, char *device,char **namep)
+fbdevHWProbe(struct pci_device *pPci, char *device, char **namep)
{
- int fd;
+ int fd;
- if (pPci)
- fd = fbdev_open_pci(pPci,namep);
- else
- fd = fbdev_open(-1,device,namep);
+ if (pPci)
+ fd = fbdev_open_pci(pPci, namep);
+ else
+ fd = fbdev_open(-1, device, namep);
- if (-1 == fd)
- return FALSE;
- close(fd);
- return TRUE;
+ if (-1 == fd)
+ return FALSE;
+ close(fd);
+ return TRUE;
}
Bool
-fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device * pPci, char *device)
-{
- fbdevHWPtr fPtr;
-
- fbdevHWGetRec(pScrn);
- fPtr = FBDEVHWPTR(pScrn);
-
- /* open device */
- if (pPci)
- fPtr->fd = fbdev_open_pci(pPci,NULL);
- else
- fPtr->fd = fbdev_open(pScrn->scrnIndex,device,NULL);
- if (-1 == fPtr->fd) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to open framebuffer device, consult warnings"
- " and/or errors above for possible reasons\n"
- "\t(you may have to look at the server log to see"
- " warnings)\n");
- return FALSE;
- }
-
- /* get current fb device settings */
- if (-1 == ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "ioctl FBIOGET_FSCREENINFO: %s\n",
- strerror(errno));
- return FALSE;
- }
- if (-1 == ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->var))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "ioctl FBIOGET_VSCREENINFO: %s\n",
- strerror(errno));
- return FALSE;
- }
-
- /* we can use the current settings as "buildin mode" */
- fbdev2xfree_timing(&fPtr->var, &fPtr->buildin);
- fPtr->buildin.name = "current";
- fPtr->buildin.next = &fPtr->buildin;
- fPtr->buildin.prev = &fPtr->buildin;
- fPtr->buildin.type |= M_T_BUILTIN;
-
- return TRUE;
-}
-
-char*
+fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci, char *device)
+{
+ fbdevHWPtr fPtr;
+
+ fbdevHWGetRec(pScrn);
+ fPtr = FBDEVHWPTR(pScrn);
+
+ /* open device */
+ if (pPci)
+ fPtr->fd = fbdev_open_pci(pPci, NULL);
+ else
+ fPtr->fd = fbdev_open(pScrn->scrnIndex, device, NULL);
+ if (-1 == fPtr->fd) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to open framebuffer device, consult warnings"
+ " and/or errors above for possible reasons\n"
+ "\t(you may have to look at the server log to see"
+ " warnings)\n");
+ return FALSE;
+ }
+
+ /* get current fb device settings */
+ if (-1 == ioctl(fPtr->fd, FBIOGET_FSCREENINFO, (void *) (&fPtr->fix))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "ioctl FBIOGET_FSCREENINFO: %s\n", strerror(errno));
+ return FALSE;
+ }
+ if (-1 == ioctl(fPtr->fd, FBIOGET_VSCREENINFO, (void *) (&fPtr->var))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno));
+ return FALSE;
+ }
+
+ /* we can use the current settings as "buildin mode" */
+ fbdev2xfree_timing(&fPtr->var, &fPtr->buildin);
+ fPtr->buildin.name = "current";
+ fPtr->buildin.next = &fPtr->buildin;
+ fPtr->buildin.prev = &fPtr->buildin;
+ fPtr->buildin.type |= M_T_BUILTIN;
+
+ return TRUE;
+}
+
+char *
fbdevHWGetName(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- return fPtr->fix.id;
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ return fPtr->fix.id;
}
int
fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- if (fbbpp)
- *fbbpp = fPtr->var.bits_per_pixel;
+ if (fbbpp)
+ *fbbpp = fPtr->var.bits_per_pixel;
- if (fPtr->fix.visual == FB_VISUAL_TRUECOLOR ||
- fPtr->fix.visual == FB_VISUAL_DIRECTCOLOR)
- return fPtr->var.red.length+fPtr->var.green.length+
- fPtr->var.blue.length;
- else
- return fPtr->var.bits_per_pixel;
+ if (fPtr->fix.visual == FB_VISUAL_TRUECOLOR ||
+ fPtr->fix.visual == FB_VISUAL_DIRECTCOLOR)
+ return fPtr->var.red.length + fPtr->var.green.length +
+ fPtr->var.blue.length;
+ else
+ return fPtr->var.bits_per_pixel;
}
int
fbdevHWGetLineLength(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- if (fPtr->fix.line_length)
- return fPtr->fix.line_length;
- else
- return fPtr->var.xres_virtual*fPtr->var.bits_per_pixel/8;
+ if (fPtr->fix.line_length)
+ return fPtr->fix.line_length;
+ else
+ return fPtr->var.xres_virtual * fPtr->var.bits_per_pixel / 8;
}
int
fbdevHWGetType(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- return fPtr->fix.type;
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ return fPtr->fix.type;
}
int
fbdevHWGetVidmem(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- return fPtr->fix.smem_len;
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ return fPtr->fix.smem_len;
}
static Bool
fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- struct fb_var_screeninfo req_var = fPtr->var, set_var;
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ struct fb_var_screeninfo req_var = fPtr->var, set_var;
- xfree2fbdev_fblayout(pScrn, &req_var);
- xfree2fbdev_timing(mode, &req_var);
+ xfree2fbdev_fblayout(pScrn, &req_var);
+ xfree2fbdev_timing(mode, &req_var);
#if DEBUG
- print_xfree_mode("init", mode);
- print_fbdev_mode("init", &req_var);
+ print_xfree_mode("init", mode);
+ print_fbdev_mode("init", &req_var);
#endif
- set_var = req_var;
+ set_var = req_var;
- if (check)
- set_var.activate = FB_ACTIVATE_TEST;
+ if (check)
+ set_var.activate = FB_ACTIVATE_TEST;
- if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void*)(&set_var))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
- return FALSE;
- }
+ if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void *) (&set_var))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
+ return FALSE;
+ }
- if (!fbdev_modes_equal(&set_var, &req_var)) {
- if (!check)
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "FBIOPUT_VSCREENINFO succeeded but modified "
- "mode\n");
+ if (!fbdev_modes_equal(&set_var, &req_var)) {
+ if (!check)
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOPUT_VSCREENINFO succeeded but modified " "mode\n");
#if DEBUG
- print_fbdev_mode("returned", &set_var);
+ print_fbdev_mode("returned", &set_var);
#endif
- return FALSE;
- }
+ return FALSE;
+ }
- if (!check)
- fPtr->var = set_var;
+ if (!check)
+ fPtr->var = set_var;
- return TRUE;
+ return TRUE;
}
void
fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
{
- char **modename;
- DisplayModePtr mode,this,last = pScrn->modes;
-
- if (NULL == pScrn->display->modes)
- return;
-
- pScrn->virtualX = pScrn->display->virtualX;
- pScrn->virtualY = pScrn->display->virtualY;
-
- for (modename = pScrn->display->modes; *modename != NULL; modename++) {
- for (mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next) {
- if (0 == strcmp(mode->name,*modename)) {
- if (fbdevHWSetMode(pScrn, mode, TRUE))
- break;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "\tmode \"%s\" test failed\n", *modename);
- }
- }
-
- if (NULL == mode) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "\tmode \"%s\" not found\n", *modename);
- continue;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "\tmode \"%s\" ok\n", *modename);
-
- if (pScrn->virtualX < mode->HDisplay)
- pScrn->virtualX = mode->HDisplay;
- if (pScrn->virtualY < mode->VDisplay)
- pScrn->virtualY = mode->VDisplay;
-
- if (NULL == pScrn->modes) {
- this = pScrn->modes = xf86DuplicateMode(mode);
- this->next = this;
- this->prev = this;
- } else {
- this = xf86DuplicateMode(mode);
- this->next = pScrn->modes;
- this->prev = last;
- last->next = this;
- pScrn->modes->prev = this;
- }
- last = this;
- }
+ char **modename;
+ DisplayModePtr mode, this, last = pScrn->modes;
+
+ if (NULL == pScrn->display->modes)
+ return;
+
+ pScrn->virtualX = pScrn->display->virtualX;
+ pScrn->virtualY = pScrn->display->virtualY;
+
+ for (modename = pScrn->display->modes; *modename != NULL; modename++) {
+ for (mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next) {
+ if (0 == strcmp(mode->name, *modename)) {
+ if (fbdevHWSetMode(pScrn, mode, TRUE))
+ break;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "\tmode \"%s\" test failed\n", *modename);
+ }
+ }
+
+ if (NULL == mode) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "\tmode \"%s\" not found\n", *modename);
+ continue;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" ok\n", *modename);
+
+ if (pScrn->virtualX < mode->HDisplay)
+ pScrn->virtualX = mode->HDisplay;
+ if (pScrn->virtualY < mode->VDisplay)
+ pScrn->virtualY = mode->VDisplay;
+
+ if (NULL == pScrn->modes) {
+ this = pScrn->modes = xf86DuplicateMode(mode);
+ this->next = this;
+ this->prev = this;
+ }
+ else {
+ this = xf86DuplicateMode(mode);
+ this->next = pScrn->modes;
+ this->prev = last;
+ last->next = this;
+ pScrn->modes->prev = this;
+ }
+ last = this;
+ }
}
DisplayModePtr
fbdevHWGetBuildinMode(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- return &fPtr->buildin;
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ return &fPtr->buildin;
}
void
fbdevHWUseBuildinMode(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- pScrn->modes = &fPtr->buildin;
- pScrn->virtualX = pScrn->display->virtualX;
- pScrn->virtualY = pScrn->display->virtualY;
- if (pScrn->virtualX < fPtr->buildin.HDisplay)
- pScrn->virtualX = fPtr->buildin.HDisplay;
- if (pScrn->virtualY < fPtr->buildin.VDisplay)
- pScrn->virtualY = fPtr->buildin.VDisplay;
+ pScrn->modes = &fPtr->buildin;
+ pScrn->virtualX = pScrn->display->virtualX;
+ pScrn->virtualY = pScrn->display->virtualY;
+ if (pScrn->virtualX < fPtr->buildin.HDisplay)
+ pScrn->virtualX = fPtr->buildin.HDisplay;
+ if (pScrn->virtualY < fPtr->buildin.VDisplay)
+ pScrn->virtualY = fPtr->buildin.VDisplay;
}
/* -------------------------------------------------------------------- */
@@ -571,145 +572,153 @@ fbdevHWUseBuildinMode(ScrnInfoPtr pScrn)
static void
calculateFbmem_len(fbdevHWPtr fPtr)
{
- fPtr->fboff = (unsigned long) fPtr->fix.smem_start & ~PAGE_MASK;
- fPtr->fbmem_len = (fPtr->fboff+fPtr->fix.smem_len+~PAGE_MASK) &
- PAGE_MASK;
+ fPtr->fboff = (unsigned long) fPtr->fix.smem_start & ~PAGE_MASK;
+ fPtr->fbmem_len = (fPtr->fboff + fPtr->fix.smem_len + ~PAGE_MASK) &
+ PAGE_MASK;
}
-
-void*
+void *
fbdevHWMapVidmem(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
-
- if (NULL == fPtr->fbmem) {
- calculateFbmem_len(fPtr);
- fPtr->fbmem = mmap(NULL, fPtr->fbmem_len, PROT_READ | PROT_WRITE,
- MAP_SHARED, fPtr->fd, 0);
- if (-1 == (long)fPtr->fbmem) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "mmap fbmem: %s\n", strerror(errno));
- fPtr->fbmem = NULL;
- } else {
- /* Perhaps we'd better add fboff to fbmem and return 0 in
- fbdevHWLinearOffset()? Of course we then need to mask
- fPtr->fbmem with PAGE_MASK in fbdevHWUnmapVidmem() as
- well. [geert] */
- }
- }
- pScrn->memPhysBase = (unsigned long)fPtr->fix.smem_start & (unsigned long)(PAGE_MASK);
- pScrn->fbOffset = (unsigned long)fPtr->fix.smem_start & (unsigned long)(~PAGE_MASK);
- return fPtr->fbmem;
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ if (NULL == fPtr->fbmem) {
+ calculateFbmem_len(fPtr);
+ fPtr->fbmem = mmap(NULL, fPtr->fbmem_len, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fPtr->fd, 0);
+ if (-1 == (long) fPtr->fbmem) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "mmap fbmem: %s\n", strerror(errno));
+ fPtr->fbmem = NULL;
+ }
+ else {
+ /* Perhaps we'd better add fboff to fbmem and return 0 in
+ fbdevHWLinearOffset()? Of course we then need to mask
+ fPtr->fbmem with PAGE_MASK in fbdevHWUnmapVidmem() as
+ well. [geert] */
+ }
+ }
+ pScrn->memPhysBase =
+ (unsigned long) fPtr->fix.smem_start & (unsigned long) (PAGE_MASK);
+ pScrn->fbOffset =
+ (unsigned long) fPtr->fix.smem_start & (unsigned long) (~PAGE_MASK);
+ return fPtr->fbmem;
}
int
fbdevHWLinearOffset(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- return fPtr->fboff;
+ return fPtr->fboff;
}
Bool
fbdevHWUnmapVidmem(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- if (NULL != fPtr->fbmem) {
- if (-1 == munmap(fPtr->fbmem, fPtr->fbmem_len))
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "munmap fbmem: %s\n", strerror(errno));
- fPtr->fbmem = NULL;
- }
- return TRUE;
+ if (NULL != fPtr->fbmem) {
+ if (-1 == munmap(fPtr->fbmem, fPtr->fbmem_len))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "munmap fbmem: %s\n", strerror(errno));
+ fPtr->fbmem = NULL;
+ }
+ return TRUE;
}
-void*
+void *
fbdevHWMapMMIO(ScrnInfoPtr pScrn)
{
- unsigned int mmio_off;
-
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
-
- if (NULL == fPtr->mmio) {
- /* tell the kernel not to use accels to speed up console scrolling */
- fPtr->var.accel_flags = 0;
- if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
- return FALSE;
- }
- mmio_off = (unsigned long) fPtr->fix.mmio_start & ~PAGE_MASK;
- fPtr->mmio_len = (mmio_off+fPtr->fix.mmio_len+~PAGE_MASK) &
- PAGE_MASK;
- if (NULL == fPtr->fbmem)
- calculateFbmem_len(fPtr);
- fPtr->mmio = mmap(NULL, fPtr->mmio_len, PROT_READ | PROT_WRITE,
- MAP_SHARED, fPtr->fd, fPtr->fbmem_len);
- if (-1 == (long)fPtr->mmio) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "mmap mmio: %s\n", strerror(errno));
- fPtr->mmio = NULL;
- } else
- fPtr->mmio += mmio_off;
- }
- return fPtr->mmio;
+ unsigned int mmio_off;
+
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ if (NULL == fPtr->mmio) {
+ /* tell the kernel not to use accels to speed up console scrolling */
+ fPtr->var.accel_flags = 0;
+ if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void *) (&fPtr->var))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
+ return FALSE;
+ }
+ mmio_off = (unsigned long) fPtr->fix.mmio_start & ~PAGE_MASK;
+ fPtr->mmio_len = (mmio_off + fPtr->fix.mmio_len + ~PAGE_MASK) &
+ PAGE_MASK;
+ if (NULL == fPtr->fbmem)
+ calculateFbmem_len(fPtr);
+ fPtr->mmio = mmap(NULL, fPtr->mmio_len, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fPtr->fd, fPtr->fbmem_len);
+ if (-1 == (long) fPtr->mmio) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "mmap mmio: %s\n", strerror(errno));
+ fPtr->mmio = NULL;
+ }
+ else
+ fPtr->mmio += mmio_off;
+ }
+ return fPtr->mmio;
}
Bool
fbdevHWUnmapMMIO(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- if (NULL != fPtr->mmio) {
- if (-1 == munmap((void *)((unsigned long)fPtr->mmio & PAGE_MASK), fPtr->mmio_len))
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "munmap mmio: %s\n", strerror(errno));
- fPtr->mmio = NULL;
- /* FIXME: restore var.accel_flags [geert] */
- }
- return TRUE;
+ if (NULL != fPtr->mmio) {
+ if (-1 ==
+ munmap((void *) ((unsigned long) fPtr->mmio & PAGE_MASK),
+ fPtr->mmio_len))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "munmap mmio: %s\n",
+ strerror(errno));
+ fPtr->mmio = NULL;
+ /* FIXME: restore var.accel_flags [geert] */
+ }
+ return TRUE;
}
/* -------------------------------------------------------------------- */
Bool
fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
-{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
-
- pScrn->vtSema = TRUE;
-
- /* set */
- if (!fbdevHWSetMode(pScrn, mode, FALSE))
- return FALSE;
-
- /* read back */
- if (0 != ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "FBIOGET_FSCREENINFO: %s\n", strerror(errno));
- return FALSE;
- }
- if (0 != ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->var))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "FBIOGET_VSCREENINFO: %s\n", strerror(errno));
- return FALSE;
- }
-
- if (pScrn->defaultVisual == TrueColor ||
- pScrn->defaultVisual == DirectColor) {
- /* XXX: This is a hack, but it should be a NOP for all the setups that
- * worked before and actually seems to fix some others...
- */
- pScrn->offset.red = fPtr->var.red.offset;
- pScrn->offset.green = fPtr->var.green.offset;
- pScrn->offset.blue = fPtr->var.blue.offset;
- pScrn->mask.red = ((1 << fPtr->var.red.length) - 1) << fPtr->var.red.offset;
- pScrn->mask.green = ((1 << fPtr->var.green.length) - 1) << fPtr->var.green.offset;
- pScrn->mask.blue = ((1 << fPtr->var.blue.length) - 1) << fPtr->var.blue.offset;
- }
-
- return TRUE;
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ pScrn->vtSema = TRUE;
+
+ /* set */
+ if (!fbdevHWSetMode(pScrn, mode, FALSE))
+ return FALSE;
+
+ /* read back */
+ if (0 != ioctl(fPtr->fd, FBIOGET_FSCREENINFO, (void *) (&fPtr->fix))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOGET_FSCREENINFO: %s\n", strerror(errno));
+ return FALSE;
+ }
+ if (0 != ioctl(fPtr->fd, FBIOGET_VSCREENINFO, (void *) (&fPtr->var))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOGET_VSCREENINFO: %s\n", strerror(errno));
+ return FALSE;
+ }
+
+ if (pScrn->defaultVisual == TrueColor ||
+ pScrn->defaultVisual == DirectColor) {
+ /* XXX: This is a hack, but it should be a NOP for all the setups that
+ * worked before and actually seems to fix some others...
+ */
+ pScrn->offset.red = fPtr->var.red.offset;
+ pScrn->offset.green = fPtr->var.green.offset;
+ pScrn->offset.blue = fPtr->var.blue.offset;
+ pScrn->mask.red =
+ ((1 << fPtr->var.red.length) - 1) << fPtr->var.red.offset;
+ pScrn->mask.green =
+ ((1 << fPtr->var.green.length) - 1) << fPtr->var.green.offset;
+ pScrn->mask.blue =
+ ((1 << fPtr->var.blue.length) - 1) << fPtr->var.blue.offset;
+ }
+
+ return TRUE;
}
/* -------------------------------------------------------------------- */
@@ -717,21 +726,21 @@ fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
void
fbdevHWSave(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- if (0 != ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->saved_var)))
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "FBIOGET_VSCREENINFO: %s\n", strerror(errno));
+ if (0 != ioctl(fPtr->fd, FBIOGET_VSCREENINFO, (void *) (&fPtr->saved_var)))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOGET_VSCREENINFO: %s\n", strerror(errno));
}
void
fbdevHWRestore(ScrnInfoPtr pScrn)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->saved_var)))
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
+ if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void *) (&fPtr->saved_var)))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
}
/* -------------------------------------------------------------------- */
@@ -739,30 +748,27 @@ fbdevHWRestore(ScrnInfoPtr pScrn)
void
fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
- LOCO *colors, VisualPtr pVisual)
-{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- struct fb_cmap cmap;
- unsigned short red,green,blue;
- int i;
-
- cmap.len = 1;
- cmap.red = &red;
- cmap.green = &green;
- cmap.blue = &blue;
- cmap.transp = NULL;
- for (i = 0; i < numColors; i++) {
- cmap.start = indices[i];
- red = (colors[indices[i]].red << 8) |
- colors[indices[i]].red;
- green = (colors[indices[i]].green << 8) |
- colors[indices[i]].green;
- blue = (colors[indices[i]].blue << 8) |
- colors[indices[i]].blue;
- if (-1 == ioctl(fPtr->fd,FBIOPUTCMAP,(void*)&cmap))
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "FBIOPUTCMAP: %s\n", strerror(errno));
- }
+ LOCO * colors, VisualPtr pVisual)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ struct fb_cmap cmap;
+ unsigned short red, green, blue;
+ int i;
+
+ cmap.len = 1;
+ cmap.red = &red;
+ cmap.green = &green;
+ cmap.blue = &blue;
+ cmap.transp = NULL;
+ for (i = 0; i < numColors; i++) {
+ cmap.start = indices[i];
+ red = (colors[indices[i]].red << 8) | colors[indices[i]].red;
+ green = (colors[indices[i]].green << 8) | colors[indices[i]].green;
+ blue = (colors[indices[i]].blue << 8) | colors[indices[i]].blue;
+ if (-1 == ioctl(fPtr->fd, FBIOPUTCMAP, (void *) &cmap))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOPUTCMAP: %s\n", strerror(errno));
+ }
}
/* -------------------------------------------------------------------- */
@@ -771,134 +777,157 @@ fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
ModeStatus
fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- if (!fbdevHWSetMode(pScrn, mode, TRUE))
- return MODE_BAD;
+ if (!fbdevHWSetMode(pScrn, mode, TRUE))
+ return MODE_BAD;
- return MODE_OK;
+ return MODE_OK;
}
Bool
fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- if (!fbdevHWSetMode(pScrn, mode, FALSE))
- return FALSE;
+ if (!fbdevHWSetMode(pScrn, mode, FALSE))
+ return FALSE;
- return TRUE;
+ return TRUE;
}
void
fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- if ( x < 0 || x + fPtr->var.xres > fPtr->var.xres_virtual ||
- y < 0 || y + fPtr->var.yres > fPtr->var.yres_virtual )
- return;
+ if (x < 0 || x + fPtr->var.xres > fPtr->var.xres_virtual ||
+ y < 0 || y + fPtr->var.yres > fPtr->var.yres_virtual)
+ return;
- fPtr->var.xoffset = x;
- fPtr->var.yoffset = y;
- if (-1 == ioctl(fPtr->fd,FBIOPAN_DISPLAY,(void*)&fPtr->var))
- xf86DrvMsgVerb(scrnIndex, X_WARNING, 5,
- "FBIOPAN_DISPLAY: %s\n", strerror(errno));
+ fPtr->var.xoffset = x;
+ fPtr->var.yoffset = y;
+ if (-1 == ioctl(fPtr->fd, FBIOPAN_DISPLAY, (void *) &fPtr->var))
+ xf86DrvMsgVerb(scrnIndex, X_WARNING, 5,
+ "FBIOPAN_DISPLAY: %s\n", strerror(errno));
}
Bool
fbdevHWEnterVT(int scrnIndex, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
- if (!fbdevHWModeInit(pScrn, pScrn->currentMode))
- return FALSE;
- fbdevHWAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
- return TRUE;
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+
+ if (!fbdevHWModeInit(pScrn, pScrn->currentMode))
+ return FALSE;
+ fbdevHWAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ return TRUE;
}
void
fbdevHWLeaveVT(int scrnIndex, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- fbdevHWRestore(pScrn);
+ fbdevHWRestore(pScrn);
}
void
fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
{
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- unsigned long fbmode;
-
- if (!pScrn->vtSema)
- return;
-
- switch (mode) {
- case DPMSModeOn:
- fbmode = 0;
- break;
- case DPMSModeStandby:
- fbmode = 2;
- break;
- case DPMSModeSuspend:
- fbmode = 3;
- break;
- case DPMSModeOff:
- fbmode = 4;
- break;
- default:
- return;
- }
-
- if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)fbmode))
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "FBIOBLANK: %s\n", strerror(errno));
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ unsigned long fbmode;
+
+ if (!pScrn->vtSema)
+ return;
+
+ switch (mode) {
+ case DPMSModeOn:
+ fbmode = 0;
+ break;
+ case DPMSModeStandby:
+ fbmode = 2;
+ break;
+ case DPMSModeSuspend:
+ fbmode = 3;
+ break;
+ case DPMSModeOff:
+ fbmode = 4;
+ break;
+ default:
+ return;
+ }
+
+ if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) fbmode))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOBLANK: %s\n", strerror(errno));
}
Bool
fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
- unsigned long unblank;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ unsigned long unblank;
- if (!pScrn->vtSema)
- return TRUE;
+ if (!pScrn->vtSema)
+ return TRUE;
- unblank = xf86IsUnblank(mode);
+ unblank = xf86IsUnblank(mode);
- if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)(1-unblank))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "FBIOBLANK: %s\n", strerror(errno));
- return FALSE;
- }
+ if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) (1 - unblank))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOBLANK: %s\n", strerror(errno));
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
xf86SwitchModeProc *
-fbdevHWSwitchModeWeak(void) { return fbdevHWSwitchMode; }
+fbdevHWSwitchModeWeak(void)
+{
+ return fbdevHWSwitchMode;
+}
xf86AdjustFrameProc *
-fbdevHWAdjustFrameWeak(void) { return fbdevHWAdjustFrame; }
+fbdevHWAdjustFrameWeak(void)
+{
+ return fbdevHWAdjustFrame;
+}
xf86EnterVTProc *
-fbdevHWEnterVTWeak(void) { return fbdevHWEnterVT; }
+fbdevHWEnterVTWeak(void)
+{
+ return fbdevHWEnterVT;
+}
xf86LeaveVTProc *
-fbdevHWLeaveVTWeak(void) { return fbdevHWLeaveVT; }
+fbdevHWLeaveVTWeak(void)
+{
+ return fbdevHWLeaveVT;
+}
xf86ValidModeProc *
-fbdevHWValidModeWeak(void) { return fbdevHWValidMode; }
+fbdevHWValidModeWeak(void)
+{
+ return fbdevHWValidMode;
+}
xf86DPMSSetProc *
-fbdevHWDPMSSetWeak(void) { return fbdevHWDPMSSet; }
+fbdevHWDPMSSetWeak(void)
+{
+ return fbdevHWDPMSSet;
+}
xf86LoadPaletteProc *
-fbdevHWLoadPaletteWeak(void) { return fbdevHWLoadPalette; }
+fbdevHWLoadPaletteWeak(void)
+{
+ return fbdevHWLoadPalette;
+}
SaveScreenProcPtr
-fbdevHWSaveScreenWeak(void) { return fbdevHWSaveScreen; }
+fbdevHWSaveScreenWeak(void)
+{
+ return fbdevHWSaveScreen;
+}
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h
index 34870c27d..536987101 100644
--- a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h
@@ -5,58 +5,64 @@
#include "xf86str.h"
#include "colormapst.h"
-#define FBDEVHW_PACKED_PIXELS 0 /* Packed Pixels */
-#define FBDEVHW_PLANES 1 /* Non interleaved planes */
-#define FBDEVHW_INTERLEAVED_PLANES 2 /* Interleaved planes */
-#define FBDEVHW_TEXT 3 /* Text/attributes */
-#define FBDEVHW_VGA_PLANES 4 /* EGA/VGA planes */
+#define FBDEVHW_PACKED_PIXELS 0 /* Packed Pixels */
+#define FBDEVHW_PLANES 1 /* Non interleaved planes */
+#define FBDEVHW_INTERLEAVED_PLANES 2 /* Interleaved planes */
+#define FBDEVHW_TEXT 3 /* Text/attributes */
+#define FBDEVHW_VGA_PLANES 4 /* EGA/VGA planes */
-extern _X_EXPORT Bool fbdevHWGetRec(ScrnInfoPtr pScrn);
-extern _X_EXPORT void fbdevHWFreeRec(ScrnInfoPtr pScrn);
+extern _X_EXPORT Bool fbdevHWGetRec(ScrnInfoPtr pScrn);
+extern _X_EXPORT void fbdevHWFreeRec(ScrnInfoPtr pScrn);
-extern _X_EXPORT int fbdevHWGetFD(ScrnInfoPtr pScrn);
+extern _X_EXPORT int fbdevHWGetFD(ScrnInfoPtr pScrn);
-extern _X_EXPORT Bool fbdevHWProbe(struct pci_device * pPci, char *device, char **namep);
-extern _X_EXPORT Bool fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device * pPci, char *device);
+extern _X_EXPORT Bool fbdevHWProbe(struct pci_device *pPci, char *device,
+ char **namep);
+extern _X_EXPORT Bool fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci,
+ char *device);
-extern _X_EXPORT char* fbdevHWGetName(ScrnInfoPtr pScrn);
-extern _X_EXPORT int fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp);
-extern _X_EXPORT int fbdevHWGetLineLength(ScrnInfoPtr pScrn);
-extern _X_EXPORT int fbdevHWGetType(ScrnInfoPtr pScrn);
-extern _X_EXPORT int fbdevHWGetVidmem(ScrnInfoPtr pScrn);
+extern _X_EXPORT char *fbdevHWGetName(ScrnInfoPtr pScrn);
+extern _X_EXPORT int fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp);
+extern _X_EXPORT int fbdevHWGetLineLength(ScrnInfoPtr pScrn);
+extern _X_EXPORT int fbdevHWGetType(ScrnInfoPtr pScrn);
+extern _X_EXPORT int fbdevHWGetVidmem(ScrnInfoPtr pScrn);
-extern _X_EXPORT void* fbdevHWMapVidmem(ScrnInfoPtr pScrn);
-extern _X_EXPORT int fbdevHWLinearOffset(ScrnInfoPtr pScrn);
-extern _X_EXPORT Bool fbdevHWUnmapVidmem(ScrnInfoPtr pScrn);
-extern _X_EXPORT void* fbdevHWMapMMIO(ScrnInfoPtr pScrn);
-extern _X_EXPORT Bool fbdevHWUnmapMMIO(ScrnInfoPtr pScrn);
+extern _X_EXPORT void *fbdevHWMapVidmem(ScrnInfoPtr pScrn);
+extern _X_EXPORT int fbdevHWLinearOffset(ScrnInfoPtr pScrn);
+extern _X_EXPORT Bool fbdevHWUnmapVidmem(ScrnInfoPtr pScrn);
+extern _X_EXPORT void *fbdevHWMapMMIO(ScrnInfoPtr pScrn);
+extern _X_EXPORT Bool fbdevHWUnmapMMIO(ScrnInfoPtr pScrn);
-extern _X_EXPORT void fbdevHWSetVideoModes(ScrnInfoPtr pScrn);
+extern _X_EXPORT void fbdevHWSetVideoModes(ScrnInfoPtr pScrn);
extern _X_EXPORT DisplayModePtr fbdevHWGetBuildinMode(ScrnInfoPtr pScrn);
-extern _X_EXPORT void fbdevHWUseBuildinMode(ScrnInfoPtr pScrn);
-extern _X_EXPORT Bool fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
-extern _X_EXPORT void fbdevHWSave(ScrnInfoPtr pScrn);
-extern _X_EXPORT void fbdevHWRestore(ScrnInfoPtr pScrn);
-
-extern _X_EXPORT void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
- LOCO *colors, VisualPtr pVisual);
-
-extern _X_EXPORT ModeStatus fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags);
-extern _X_EXPORT Bool fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
-extern _X_EXPORT void fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags);
-extern _X_EXPORT Bool fbdevHWEnterVT(int scrnIndex, int flags);
-extern _X_EXPORT void fbdevHWLeaveVT(int scrnIndex, int flags);
-extern _X_EXPORT void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags);
-
-extern _X_EXPORT Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode);
-
-extern _X_EXPORT xf86SwitchModeProc *fbdevHWSwitchModeWeak(void);
-extern _X_EXPORT xf86AdjustFrameProc *fbdevHWAdjustFrameWeak(void);
-extern _X_EXPORT xf86EnterVTProc *fbdevHWEnterVTWeak(void);
-extern _X_EXPORT xf86LeaveVTProc *fbdevHWLeaveVTWeak(void);
-extern _X_EXPORT xf86ValidModeProc *fbdevHWValidModeWeak(void);
-extern _X_EXPORT xf86DPMSSetProc *fbdevHWDPMSSetWeak(void);
-extern _X_EXPORT xf86LoadPaletteProc *fbdevHWLoadPaletteWeak(void);
-extern _X_EXPORT SaveScreenProcPtr fbdevHWSaveScreenWeak(void);
+extern _X_EXPORT void fbdevHWUseBuildinMode(ScrnInfoPtr pScrn);
+extern _X_EXPORT Bool fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
+extern _X_EXPORT void fbdevHWSave(ScrnInfoPtr pScrn);
+extern _X_EXPORT void fbdevHWRestore(ScrnInfoPtr pScrn);
+
+extern _X_EXPORT void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors,
+ int *indices, LOCO * colors,
+ VisualPtr pVisual);
+
+extern _X_EXPORT ModeStatus fbdevHWValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flags);
+extern _X_EXPORT Bool fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode,
+ int flags);
+extern _X_EXPORT void fbdevHWAdjustFrame(int scrnIndex, int x, int y,
+ int flags);
+extern _X_EXPORT Bool fbdevHWEnterVT(int scrnIndex, int flags);
+extern _X_EXPORT void fbdevHWLeaveVT(int scrnIndex, int flags);
+extern _X_EXPORT void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags);
+
+extern _X_EXPORT Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode);
+
+extern _X_EXPORT xf86SwitchModeProc *fbdevHWSwitchModeWeak(void);
+extern _X_EXPORT xf86AdjustFrameProc *fbdevHWAdjustFrameWeak(void);
+extern _X_EXPORT xf86EnterVTProc *fbdevHWEnterVTWeak(void);
+extern _X_EXPORT xf86LeaveVTProc *fbdevHWLeaveVTWeak(void);
+extern _X_EXPORT xf86ValidModeProc *fbdevHWValidModeWeak(void);
+extern _X_EXPORT xf86DPMSSetProc *fbdevHWDPMSSetWeak(void);
+extern _X_EXPORT xf86LoadPaletteProc *fbdevHWLoadPaletteWeak(void);
+extern _X_EXPORT SaveScreenProcPtr fbdevHWSaveScreenWeak(void);
#endif
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
index 191a6d33d..6e0a470b8 100644
--- a/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
@@ -8,11 +8,10 @@
/* Stubs for the static server on platforms that don't support fbdev */
-
Bool
fbdevHWGetRec(ScrnInfoPtr pScrn)
{
- return FALSE;
+ return FALSE;
}
void
@@ -20,48 +19,47 @@ fbdevHWFreeRec(ScrnInfoPtr pScrn)
{
}
-
Bool
fbdevHWProbe(struct pci_device *pPci, char *device, char **namep)
{
- return FALSE;
+ return FALSE;
}
Bool
fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci, char *device)
{
- xf86Msg(X_ERROR, "fbdevhw is not available on this platform\n");
- return FALSE;
+ xf86Msg(X_ERROR, "fbdevhw is not available on this platform\n");
+ return FALSE;
}
-char*
+char *
fbdevHWGetName(ScrnInfoPtr pScrn)
{
- return NULL;
+ return NULL;
}
int
fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp)
{
- return -1;
+ return -1;
}
int
fbdevHWGetLineLength(ScrnInfoPtr pScrn)
{
- return -1; /* Should cause something spectacular... */
+ return -1; /* Should cause something spectacular... */
}
int
fbdevHWGetType(ScrnInfoPtr pScrn)
{
- return -1;
+ return -1;
}
int
fbdevHWGetVidmem(ScrnInfoPtr pScrn)
{
- return -1;
+ return -1;
}
void
@@ -72,7 +70,7 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
DisplayModePtr
fbdevHWGetBuildinMode(ScrnInfoPtr pScrn)
{
- return NULL;
+ return NULL;
}
void
@@ -80,40 +78,40 @@ fbdevHWUseBuildinMode(ScrnInfoPtr pScrn)
{
}
-void*
+void *
fbdevHWMapVidmem(ScrnInfoPtr pScrn)
{
- return NULL;
+ return NULL;
}
int
fbdevHWLinearOffset(ScrnInfoPtr pScrn)
{
- return 0;
+ return 0;
}
Bool
fbdevHWUnmapVidmem(ScrnInfoPtr pScrn)
{
- return FALSE;
+ return FALSE;
}
-void*
+void *
fbdevHWMapMMIO(ScrnInfoPtr pScrn)
{
- return NULL;
+ return NULL;
}
Bool
fbdevHWUnmapMMIO(ScrnInfoPtr pScrn)
{
- return FALSE;
+ return FALSE;
}
Bool
fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
-{
- return FALSE;
+{
+ return FALSE;
}
void
@@ -128,20 +126,20 @@ fbdevHWRestore(ScrnInfoPtr pScrn)
void
fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
- LOCO *colors, VisualPtr pVisual)
+ LOCO * colors, VisualPtr pVisual)
{
}
ModeStatus
fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
{
- return MODE_ERROR;
+ return MODE_ERROR;
}
Bool
fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
{
- return FALSE;
+ return FALSE;
}
void
@@ -152,7 +150,7 @@ fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
Bool
fbdevHWEnterVT(int scrnIndex, int flags)
{
- return FALSE;
+ return FALSE;
}
void
@@ -168,29 +166,53 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
Bool
fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
{
- return FALSE;
+ return FALSE;
}
xf86SwitchModeProc *
-fbdevHWSwitchModeWeak(void) { return fbdevHWSwitchMode; }
+fbdevHWSwitchModeWeak(void)
+{
+ return fbdevHWSwitchMode;
+}
xf86AdjustFrameProc *
-fbdevHWAdjustFrameWeak(void) { return fbdevHWAdjustFrame; }
+fbdevHWAdjustFrameWeak(void)
+{
+ return fbdevHWAdjustFrame;
+}
xf86EnterVTProc *
-fbdevHWEnterVTWeak(void) { return fbdevHWEnterVT; }
+fbdevHWEnterVTWeak(void)
+{
+ return fbdevHWEnterVT;
+}
xf86LeaveVTProc *
-fbdevHWLeaveVTWeak(void) { return fbdevHWLeaveVT; }
+fbdevHWLeaveVTWeak(void)
+{
+ return fbdevHWLeaveVT;
+}
xf86ValidModeProc *
-fbdevHWValidModeWeak(void) { return fbdevHWValidMode; }
+fbdevHWValidModeWeak(void)
+{
+ return fbdevHWValidMode;
+}
xf86DPMSSetProc *
-fbdevHWDPMSSetWeak(void) { return fbdevHWDPMSSet; }
+fbdevHWDPMSSetWeak(void)
+{
+ return fbdevHWDPMSSet;
+}
xf86LoadPaletteProc *
-fbdevHWLoadPaletteWeak(void) { return fbdevHWLoadPalette; }
+fbdevHWLoadPaletteWeak(void)
+{
+ return fbdevHWLoadPalette;
+}
SaveScreenProcPtr
-fbdevHWSaveScreenWeak(void) { return fbdevHWSaveScreen; }
+fbdevHWSaveScreenWeak(void)
+{
+ return fbdevHWSaveScreen;
+}
diff --git a/xorg-server/hw/xfree86/i2c/bt829.c b/xorg-server/hw/xfree86/i2c/bt829.c
index 64c711681..070cb2044 100644
--- a/xorg-server/hw/xfree86/i2c/bt829.c
+++ b/xorg-server/hw/xfree86/i2c/bt829.c
@@ -1,745 +1,821 @@
-/* TODO: clean up/fix CC code */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "xf86.h"
-#include "xf86i2c.h"
-#include "bt829.h"
-#include "i2c_def.h"
-
-/* Changing the following settings (especially VCROP) may */
-/* require modifying code that calls this driver. */
-#define HCROP 0 /* amount to crop from the left and right edges */
-#define VCROP 0 /* amount to crop from the top and bottom edges */
-
-#define BTVERSION (bt->id>>4)
-
-#define H(X) ( ((X)>>8) & 0xFF )
-#define L(X) ( (X) & 0xFF )
-
-#define LIMIT(X,A,B) (((X)<(A)) ? (A) : ((X)>(B)) ? (B) : (X) )
-
-/* Bt829 family chip ID's */
-#define BT815 0x02
-#define BT817 0x06
-#define BT819 0x07
-#define BT827 0x0C
-#define BT829 0x0E
-
-/* Bt829 registers */
-#define STATUS 0x00 /* Device Status */
-#define IFORM 0x01 /* Input Format */
-#define TDEC 0x02 /* Temporal Decimation */
-#define CROP 0x03 /* MSB Cropping */
-#define VDELAY_LO 0x04 /* Vertical Delay */
-#define VACTIVE_LO 0x05 /* Vertical Active */
-#define HDELAY_LO 0x06 /* Horizontal Delay */
-#define HACTIVE_LO 0x07 /* Horizontal Active */
-#define HSCALE_HI 0x08 /* Horizontal Scaling */
-#define HSCALE_LO 0x09 /* Horizontal Scaling */
-#define BRIGHT 0x0A /* Brightness Control */
-#define CONTROL 0x0B /* Miscellaneous Control */
-#define CONTRAST_LO 0x0C /* Luma Gain (Contrast) */
-#define SAT_U_LO 0x0D /* Chroma (U) Gain (Saturation) */
-#define SAT_V_LO 0x0E /* Chroma (V) Gain (Saturation) */
-#define HUE 0x0F /* Hue Control */
-#define SCLOOP 0x10 /* SC Loop Control */
-#define WC_UP 0x11 /* White Crush Up Count */
-#define OFORM 0x12 /* Output Format */
-#define VSCALE_HI 0x13 /* Vertical Scaling */
-#define VSCALE_LO 0x14 /* Vertical Scaling */
-#define TEST 0x15 /* Test Control */
-#define VPOLE 0x16 /* Video Timing Polarity */
-#define IDCODE 0x17 /* ID Code */
-#define ADELAY 0x18 /* AGC Delay */
-#define BDELAY 0x19 /* Burst Gate Delay */
-#define ADC 0x1A /* ADC Interface */
-#define VTC 0x1B /* Video Timing Control */
-#define CC_STATUS 0x1C /* Extended Data Services/Closed Capt Status */
-#define CC_DATA 0x1D /* Extended Data Services/Closed Capt Data */
-#define WC_DN 0x1E /* White Crush Down Count */
-#define SRESET 0x1F /* Software Reset */
-#define P_IO 0x3F /* Programmable I/O */
-
-static CARD8 btread(BT829Ptr bt, CARD8 reg)
-{
- CARD8 v;
-
- I2C_WriteRead(&(bt->d), &reg, 1, &v, 1);
-
- return v;
-}
-
-static void btwrite(BT829Ptr bt, CARD8 reg, CARD8 val)
-{
- CARD8 data[2];
-
- data[0] = reg;
- data[1] = val;
- I2C_WriteRead(&(bt->d), data, 2, NULL, 0);
-}
-
-/*
- * Register access
- */
-static void btwrite_status(BT829Ptr bt) /* STATUS */
-{
- btwrite(bt, STATUS, 0x00); /* clear */
-}
-
-static void btwrite_iform(BT829Ptr bt) /* IFORM */
-{
- int xtsel;
-
- switch (bt->format) {
- case BT829_NTSC:
- case BT829_NTSC_JAPAN:
- case BT829_PAL_M:
- case BT829_PAL_N_COMB: /* gatos says xtsel = 2 */
- xtsel = 1;
- break;
- case BT829_PAL:
- case BT829_PAL_N:
- case BT829_SECAM:
- xtsel = 2;
- break;
- default: /* shouldn't get here */
- xtsel = 3; /* hardware default */
- break;
- }
-
- btwrite(bt, IFORM, (bt->mux<<5) | (xtsel<<3) | bt->format);
-}
-
-static void btwrite_tdec(BT829Ptr bt) /* TDEC */
-{
- /* use default */
-}
-
-static void btwrite_crop(BT829Ptr bt) /* CROP */
-{
- btwrite(bt, CROP, (H(bt->vdelay)<<6) | (H(bt->vactive)<<4) |
- (H(bt->hdelay)<<2) | H(bt->width));
-}
-
-static void btwrite_vdelay_lo(BT829Ptr bt) /* VDELAY_LO */
-{
- btwrite(bt, VDELAY_LO, L(bt->vdelay));
-}
-
-static void btwrite_vactive_lo(BT829Ptr bt) /* VACTIVE_LO */
-{
- btwrite(bt, VACTIVE_LO, L(bt->vactive));
-}
-
-static void btwrite_hdelay_lo(BT829Ptr bt) /* HDELAY_LO */
-{
- btwrite(bt, HDELAY_LO, L(bt->hdelay));
-}
-
-static void btwrite_hactive_lo(BT829Ptr bt) /* HACTIVE_LO */
-{
- btwrite(bt, HACTIVE_LO, L(bt->width));
-}
-
-static void btwrite_hscale_hi(BT829Ptr bt) /* HSCALE_HI */
-{
- btwrite(bt, HSCALE_HI, H(bt->hscale));
-}
-
-static void btwrite_hscale_lo(BT829Ptr bt) /* HSCALE_LO */
-{
- btwrite(bt, HSCALE_LO, L(bt->hscale));
-}
-
-static void btwrite_bright(BT829Ptr bt) /* BRIGHT */
-{
- btwrite(bt, BRIGHT, bt->brightness);
-}
-
-static void btwrite_control(BT829Ptr bt) /* CONTROL */
-{
- int ldec;
-
- /* The data sheet says ldec should always be 0 for SECAM */
- /* but the picture quality is better with ldec = 1 */
- ldec = (bt->width > 360); /* gatos says 384 */
-
- btwrite(bt, CONTROL,
- ((bt->mux==bt->svideo_mux) ? 0xC0:0x00) | /* LNOTCH and COMP */
- (ldec<<5) | (H(bt->contrast)<<2) | (H(bt->sat_u)<<1) | H(bt->sat_v));
-}
-
-static void btwrite_contrast_lo(BT829Ptr bt) /* CONTRAST_LO */
-{
- btwrite(bt, CONTRAST_LO, L(bt->contrast));
-}
-
-static void btwrite_sat_u_lo(BT829Ptr bt) /* SAT_U_LO */
-{
- btwrite(bt, SAT_U_LO, L(bt->sat_u));
-}
-
-static void btwrite_sat_v_lo(BT829Ptr bt) /* SAT_V_LO */
-{
- btwrite(bt, SAT_V_LO, L(bt->sat_v));
-}
-
-static void btwrite_hue(BT829Ptr bt) /* HUE */
-{
- btwrite(bt, HUE, bt->hue);
-}
-
-static void btwrite_scloop(BT829Ptr bt) /* SCLOOP */
-{
- if (BTVERSION >= BT827) {
- btwrite(bt, SCLOOP,
- (bt->format==BT829_SECAM) ? 0x10:0x00 /* QCIF or AUTO */
- );
- }
-}
-
-static void btwrite_wc_up(BT829Ptr bt) /* WC_UP */
-{
- if (BTVERSION >= BT827) {
- /* use default */
- }
-}
-
-static void btwrite_oform(BT829Ptr bt) /* OFORM */
-{
- btwrite(bt, OFORM, (bt->code<<3) | (bt->len<<2) |
- 0x02 /* RANGE = 0, CORE = 0, VBI_FRAME = 0, OES = 2 (default) */
- );
-}
-
-static void btwrite_vscale_hi(BT829Ptr bt) /* VSCALE_HI */
-{
- btwrite(bt, VSCALE_HI, H(bt->vscale) |
- 0x60 /* YCOMB = 0, COMB = 1, INT = 1 (default) */
- );
-}
-
-static void btwrite_vscale_lo(BT829Ptr bt) /* VSCALE_LO */
-{
- btwrite(bt, VSCALE_LO, L(bt->vscale));
-}
-
-/* TEST should not be written to */
-
-static void btwrite_vpole(BT829Ptr bt) /* VPOLE */
-{
- btwrite(bt, VPOLE, (bt->out_en<<7));
-}
-
-/* IDCODE is read only */
-
-static void btwrite_adelay(BT829Ptr bt) /* ADELAY */
-{
- switch (bt->format) {
- case BT829_NTSC:
- case BT829_NTSC_JAPAN:
- case BT829_PAL_M:
- btwrite(bt, ADELAY, 104);
- break;
- case BT829_PAL:
- case BT829_PAL_N:
- case BT829_SECAM:
- case BT829_PAL_N_COMB:
- btwrite(bt, ADELAY, 127);
- break;
- default: /* shouldn't get here */
- btwrite(bt, ADELAY, 104); /* hardware default */
- break;
- }
-}
-
-static void btwrite_bdelay(BT829Ptr bt) /* BDELAY */
-{
- switch (bt->format) {
- case BT829_NTSC:
- case BT829_NTSC_JAPAN:
- case BT829_PAL_M:
- btwrite(bt, BDELAY, 93);
- break;
- case BT829_PAL:
- case BT829_PAL_N:
- case BT829_PAL_N_COMB:
- btwrite(bt, BDELAY, 114);
- break;
- case BT829_SECAM:
- btwrite(bt, BDELAY, 160);
- break;
- default: /* shouldn't get here */
- btwrite(bt, BDELAY, 93); /* hardware default */
- break;
- }
-}
-
-static void btwrite_adc(BT829Ptr bt) /* ADC */
-{
- btwrite(bt, ADC, bt->mux==bt->svideo_mux ? 0x80:0x82); /* CSLEEP = 0 or 1 */
-}
-
-static void btwrite_vtc(BT829Ptr bt) /* VTC */
-{
- int vfilt = 0; /* hardware default */
-
- if (BTVERSION > BT827) { /* gatos says >= BT827 */
- switch (bt->format) {
- case BT829_NTSC:
- case BT829_NTSC_JAPAN:
- case BT829_PAL_M:
- case BT829_PAL_N_COMB: /* gatos groups with BT829_PAL */
- if (bt->width <= 360) vfilt = 1; /* gatos says <= 240 */
- if (bt->width <= 180) vfilt = 2; /* gatos says <= 120 */
- if (bt->width <= 90) vfilt = 3; /* gatos says <= 60 */
- break;
- case BT829_PAL:
- case BT829_PAL_N:
- case BT829_SECAM:
- if (bt->width <= 384) vfilt = 1;
- if (bt->width <= 192) vfilt = 2;
- if (bt->width<= 96) vfilt = 3;
- break;
- default: /* shouldn't get here */
- break; /* use hardware default */
- }
- btwrite(bt, VTC, (bt->vbien<<4) | (bt->vbifmt<<3) | vfilt);
- }
-}
-
-static void btwrite_cc_status(BT829Ptr bt) /* CC_STATUS */
-{ /* FIXME: ATI specific */
- if (BTVERSION >= BT827) {
- if (bt->ccmode == 0) btwrite(bt, CC_STATUS, 0x00);
- /* 0x40 is activate to set the CCVALID line. Not required yet */
- else btwrite(bt, CC_STATUS, (bt->ccmode<<4) | 0x40);
- }
-}
-
-/* CC_DATA is read only */
-
-static void btwrite_wc_dn(BT829Ptr bt) /* WC_DN */
-{
- if (BTVERSION >= BT827) {
- /* use default */
- }
-}
-
-static void bt_reset(BT829Ptr bt) { /* SRESET */
- btwrite(bt, SRESET, 0x0); /* Reset all registers */
-}
-
-static void btwrite_p_io(BT829Ptr bt) /* P_IO */
-{
- if (BTVERSION >= BT827) {
- btwrite(bt, P_IO, bt->p_io);
- }
-}
-
-/*
- * Deal with dependencies
- */
-static void propagate_changes(BT829Ptr bt)
-{
- CARD16 hdelay, unscaled_hdelay, vdelay, hscale, vscale;
- int htotal, vactive;
-
- switch (bt->format) {
- case BT829_NTSC:
- case BT829_NTSC_JAPAN:
- case BT829_PAL_M:
- vdelay = 22;
- htotal = 754;
- vactive = 480;
- unscaled_hdelay = 135;
- break;
- case BT829_PAL:
- case BT829_PAL_N:
- vdelay = (bt->tunertype==5) ? 34 : 22;
- htotal = 922;
- vactive = 576;
- unscaled_hdelay = 186;
- break;
- case BT829_SECAM:
- vdelay = 34;
- htotal = 922;
- vactive = 576;
- unscaled_hdelay = 186;
- break;
- case BT829_PAL_N_COMB:
- vdelay = (bt->tunertype==5) ? 34 : 22; /* windows says 22 */
- htotal = 754; /* gatos and windows say 922 */
- vactive = 576;
- unscaled_hdelay = 135; /* gatos and windows say 186 */
- break;
- default: /* shouldn't get here */
- vdelay = 22; /* hardware default */
- htotal = 754;
- vactive = 480; /* hardware default */
- unscaled_hdelay = 135;
- break;
- }
-
- bt->htotal = htotal; /* Used for error checking in bt829_SetCaptSize */
-
- hscale = 4096 * htotal / (bt->width + 2 * HCROP)-4096;
- hdelay = (
- HCROP + (bt->width + 2 * HCROP) * unscaled_hdelay / htotal
- ) & 0x3FE;
-
- vactive = vactive - 2 * VCROP;
- vdelay = vdelay + VCROP;
- vscale = (0x10000 - (512*vactive/bt->height-512)) & 0x1FFF;
-
- if ((hdelay != bt->hdelay) || (vdelay != bt->vdelay) ||
- (vactive != bt->vactive) || (hscale != bt->hscale) ||
- (vscale != bt->vscale)) {
- bt->hdelay = hdelay;
- bt->vdelay = vdelay;
- bt->vactive = vactive;
- bt->hscale = hscale;
- bt->vscale = vscale;
- btwrite_crop(bt);
- btwrite_vdelay_lo(bt);
- btwrite_vactive_lo(bt);
- btwrite_hdelay_lo(bt);
- btwrite_hscale_hi(bt);
- btwrite_hscale_lo(bt);
- btwrite_control(bt);
- btwrite_vscale_hi(bt);
- btwrite_vscale_lo(bt);
- }
-}
-
-static void write_all(BT829Ptr bt)
-{
- bt_reset(bt);
- propagate_changes(bt); /* ensure consistency */
- btwrite_iform(bt);
- btwrite_tdec(bt);
- btwrite_crop(bt);
- btwrite_vdelay_lo(bt);
- btwrite_vactive_lo(bt);
- btwrite_hdelay_lo(bt);
- btwrite_hactive_lo(bt);
- btwrite_hscale_hi(bt);
- btwrite_hscale_lo(bt);
- btwrite_bright(bt);
- btwrite_control(bt);
- btwrite_contrast_lo(bt);
- btwrite_sat_u_lo(bt);
- btwrite_sat_v_lo(bt);
- btwrite_hue(bt);
- btwrite_scloop(bt);
- btwrite_wc_up(bt);
- btwrite_oform(bt);
- btwrite_vscale_hi(bt);
- btwrite_vscale_lo(bt);
- btwrite_vpole(bt);
- btwrite_adelay(bt);
- btwrite_bdelay(bt);
- btwrite_adc(bt);
- btwrite_vtc(bt);
-/* btwrite_cc_status(bt); */ /* FIXME: CC code needs cleaning */
- btwrite_wc_dn(bt);
- btwrite_p_io(bt);
-}
-
-/*
- * Public functions
- */
-BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr)
-{
- BT829Ptr bt;
- I2CByte a;
-
- bt = calloc(1, sizeof(BT829Rec));
- if(bt == NULL) return NULL;
- bt->d.DevName = strdup("BT829 video decoder");
- bt->d.SlaveAddr = addr;
- bt->d.pI2CBus = b;
- bt->d.NextDev = NULL;
- bt->d.StartTimeout = b->StartTimeout;
- bt->d.BitTimeout = b->BitTimeout;
- bt->d.AcknTimeout = b->AcknTimeout;
- bt->d.ByteTimeout = b->ByteTimeout;
-
-
- if(!I2C_WriteRead(&(bt->d), NULL, 0, &a, 1))
- {
- free(bt);
- return NULL;
- }
-
- bt->id = btread(bt,IDCODE);
-
- free(bt->d.DevName);
- bt->d.DevName = calloc(200, sizeof(char));
- switch(BTVERSION){
- case BT815:
- sprintf(bt->d.DevName, "bt815a video decoder, revision %d",bt->id & 0xf);
- break;
- case BT817:
- sprintf(bt->d.DevName, "bt817a video decoder, revision %d",bt->id & 0xf);
- break;
- case BT819:
- sprintf(bt->d.DevName, "bt819a video decoder, revision %d",bt->id & 0xf);
- break;
- case BT827:
- sprintf(bt->d.DevName, "bt827a/b video decoder, revision %d",bt->id & 0xf);
- break;
- case BT829:
- sprintf(bt->d.DevName, "bt829a/b video decoder, revision %d",bt->id & 0xf);
- break;
- default:
- sprintf(bt->d.DevName, "bt8xx/unknown video decoder version %d, revision %d",bt->id >> 4,bt->id & 0xf);
- break;
- }
-
- /* set default parameters */
- if(!I2CDevInit(&(bt->d)))
- {
- free(bt);
- return NULL;
- }
-
- bt->tunertype = 1;
-
- bt->brightness = 0; /* hardware default */
- bt->ccmode = 0;
- bt->code = 0; /* hardware default */
- bt->contrast = 216; /* hardware default */
- bt->format = BT829_NTSC;
- bt->height = 480; /* hardware default for vactive */
- bt->hue = 0; /* hardware default */
- bt->len = 1; /* hardware default */
- bt->mux = BT829_MUX0; /* hardware default */
- bt->out_en = 0; /* hardware default */
- bt->p_io = 0; /* hardware default */
- bt->sat_u = 254; /* hardware default */
- bt->sat_v = 180; /* hardware default */
- bt->vbien = 0; /* hardware default */
- bt->vbifmt = 0; /* hardware default */
- bt->width = 640; /* hardware default for hactive */
-
- bt->hdelay = 120; /* hardware default */
- bt->hscale = 684; /* hardware default */
- bt->vactive = 480; /* hardware default */
- bt->vdelay = 22; /* hardware default */
- bt->vscale = 0; /* hardware default */
-
- bt->htotal = 754; /* NTSC */
- bt->svideo_mux = 0; /* no s-video */
-
- return bt;
-}
-
-int bt829_ATIInit(BT829Ptr bt)
-{
- bt->code = 1;
- bt->len = 0;
- bt->vbien = 1;
- bt->vbifmt = 1;
- bt->svideo_mux = BT829_MUX1;
-
- write_all (bt);
-
- return 0;
-}
-
-int bt829_SetFormat(BT829Ptr bt, CARD8 format)
-{
- if ((format < 1) || (format > 7)) return -1;
- if ((BTVERSION <= BT819) &&
- (format != BT829_NTSC) && (format != BT829_PAL)) return -1;
- if (format == bt->format) return 0;
- bt->format = format;
- propagate_changes(bt);
- btwrite_iform(bt);
- btwrite_scloop(bt);
- btwrite_adelay(bt);
- btwrite_bdelay(bt);
- btwrite_vtc(bt);
- return 0;
-}
-
-int bt829_SetMux(BT829Ptr bt, CARD8 mux)
-{
- if ((mux < 1) || (mux > 3)) return -1;
- if (mux == bt->mux) return 0;
- bt->mux = mux;
- /* propagate_changes(bt); */ /* no dependencies */
- btwrite_iform(bt);
- btwrite_control(bt);
- btwrite_adc(bt);
- return 0;
-}
-
-void bt829_SetBrightness(BT829Ptr bt, int brightness)
-{
- brightness = LIMIT(brightness,-1000,999); /* ensure -128 <= brightness <= 127 below */
- brightness = (128*brightness)/1000;
- if (brightness == bt->brightness) return;
- bt->brightness = brightness;
- /* propagate_changes(bt); */ /* no dependencies */
- btwrite_bright(bt);
-}
-
-void bt829_SetContrast(BT829Ptr bt, int contrast)
-{
- contrast = LIMIT(contrast,-1000,1000);
- contrast = (216*(contrast+1000))/1000;
- if (contrast == bt->contrast) return;
- bt->contrast = contrast;
- /* propagate_changes(bt); */ /* no dependencies */
- btwrite_control(bt);
- btwrite_contrast_lo(bt);
-}
-
-void bt829_SetSaturation(BT829Ptr bt, int saturation)
-{
- CARD16 sat_u, sat_v;
-
- saturation = LIMIT(saturation,-1000,1000);
- sat_u = (254*(saturation+1000))/1000;
- sat_v = (180*(saturation+1000))/1000;
- if ((sat_u == bt->sat_u) && (sat_v == bt->sat_v)) return;
- bt->sat_u = sat_u;
- bt->sat_v = sat_v;
- /* propagate_changes(bt); */ /* no dependencies */
- btwrite_control(bt);
- btwrite_sat_u_lo(bt);
- btwrite_sat_v_lo(bt);
-}
-
-void bt829_SetTint(BT829Ptr bt, int hue)
-{
- hue = LIMIT(hue,-1000,999); /* ensure -128 <= hue <= 127 below */
- hue = (128*hue)/1000;
- if (hue == bt->hue) return;
- bt->hue = hue;
- /* propagate_changes(bt); */ /* no dependencies */
- btwrite_hue(bt);
-}
-
-int bt829_SetCaptSize(BT829Ptr bt, int width, int height)
-{
- if ((width > bt->htotal - 2 * HCROP) ||
- (16 * width < bt->htotal - 32 * HCROP)) return -1;
- if ((height > bt->vactive) || (16 * height < bt->vactive)) return -1;
- if ((width == bt->width) && (height == bt->height)) return 0;
- bt->width = width;
- bt->height = height;
- propagate_changes(bt);
- btwrite_crop(bt);
- btwrite_hactive_lo(bt);
- btwrite_control(bt);
- btwrite_vtc(bt);
- return 0;
-}
-
-int bt829_SetCC(BT829Ptr bt) /* FIXME: should take ccmode as a parameter */
-{
- if (BTVERSION < BT827) return -1; /* can't do it */
- /* propagate_changes(bt); */ /* no dependencies */
- btwrite_cc_status(bt);
- /* we write to STATUS to reset the CCVALID flag */
- if (bt->ccmode != 0) btwrite_status(bt);
- return 0;
-}
-
-void bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en)
-{
- out_en = (out_en != 0);
- if (out_en == bt->out_en) return;
- bt->out_en = out_en;
- /* propagate_changes(bt); */ /* no dependencies */
- btwrite_vpole(bt);
-}
-
-void bt829_SetP_IO(BT829Ptr bt, CARD8 p_io)
-{
- if (p_io == bt->p_io) return;
- bt->p_io = p_io;
- /* propagate_changes(bt); */ /* no dependencies */
- btwrite_p_io(bt);
-}
-
-#define BTREAD(R) btread(bt,(R))
-
-#if 0
-
-void bt829_getCCdata(BT829Ptr bt,struct CCdata *data)
-{
- CARD8 status;
- data->num_valid=0;
- /* wait for buffer to be half full (means 8/16 bytes)
- * either 4 (one of CC/EDS) or 2 (both CC/EDS) frames */
- if(!(BTREAD(STATUS)&0x04)) return; /* could comment this line */
- for(;data->num_valid<CC_FIFO_SIZE;data->num_valid++) {
- status=BTREAD(CC_STATUS);
- if(!(status&0x04)) break;
- data->data[data->num_valid]= BTREAD(CC_DATA)&0x7f;
- /* stripped high bit (parity) */
- data->status[data->num_valid]= (CCS_EDS*((status&0x02)>>1)) |
- (CCS_HIGH*(status&0x01)) |
- (CCS_OVER*((status&0x08)>>3)) |
- (CCS_PAR*((status&0x80)>>7)) ; }
- btwrite(bt,STATUS,0x00); /* Reset CCVALID status bit */
- return;
-}
-
-#endif
-
-/* ------------------------------------------------------------------------ */
-/* Debug and report routines */
-
-#define DUMPREG(REG) \
- xf86DrvMsg(bt->d.pI2CBus->scrnIndex,X_INFO," %-12s (0x%02X) = 0x%02X\n", \
- #REG,REG,BTREAD(REG))
-
-/*static void bt829_dumpregs(BT829Ptr bt)
-{
- DUMPREG(STATUS);
- DUMPREG(IFORM);
- DUMPREG(TDEC);
- DUMPREG(CROP);
- DUMPREG(VDELAY_LO);
- DUMPREG(VACTIVE_LO);
- DUMPREG(HDELAY_LO);
- DUMPREG(HACTIVE_LO);
- DUMPREG(HSCALE_HI);
- DUMPREG(HSCALE_LO);
- DUMPREG(BRIGHT);
- DUMPREG(CONTROL);
- DUMPREG(CONTRAST_LO);
- DUMPREG(SAT_U_LO);
- DUMPREG(SAT_V_LO);
- DUMPREG(HUE);
- if (BTVERSION >= BT827) {
- DUMPREG(SCLOOP);
- DUMPREG(WC_UP) ; }
- DUMPREG(OFORM);
- DUMPREG(VSCALE_HI);
- DUMPREG(VSCALE_LO);
- DUMPREG(TEST);
- DUMPREG(VPOLE);
- DUMPREG(IDCODE);
- DUMPREG(ADELAY);
- DUMPREG(BDELAY);
- DUMPREG(ADC);
- if (BTVERSION >= BT827) {
- DUMPREG(VTC);
- DUMPREG(CC_STATUS);
- DUMPREG(CC_DATA);
- DUMPREG(WC_DN);
- DUMPREG(P_IO) ; }
-}*/
+/* TODO: clean up/fix CC code */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "bt829.h"
+#include "i2c_def.h"
+
+/* Changing the following settings (especially VCROP) may */
+/* require modifying code that calls this driver. */
+#define HCROP 0 /* amount to crop from the left and right edges */
+#define VCROP 0 /* amount to crop from the top and bottom edges */
+
+#define BTVERSION (bt->id>>4)
+
+#define H(X) ( ((X)>>8) & 0xFF )
+#define L(X) ( (X) & 0xFF )
+
+#define LIMIT(X,A,B) (((X)<(A)) ? (A) : ((X)>(B)) ? (B) : (X) )
+
+/* Bt829 family chip ID's */
+#define BT815 0x02
+#define BT817 0x06
+#define BT819 0x07
+#define BT827 0x0C
+#define BT829 0x0E
+
+/* Bt829 registers */
+#define STATUS 0x00 /* Device Status */
+#define IFORM 0x01 /* Input Format */
+#define TDEC 0x02 /* Temporal Decimation */
+#define CROP 0x03 /* MSB Cropping */
+#define VDELAY_LO 0x04 /* Vertical Delay */
+#define VACTIVE_LO 0x05 /* Vertical Active */
+#define HDELAY_LO 0x06 /* Horizontal Delay */
+#define HACTIVE_LO 0x07 /* Horizontal Active */
+#define HSCALE_HI 0x08 /* Horizontal Scaling */
+#define HSCALE_LO 0x09 /* Horizontal Scaling */
+#define BRIGHT 0x0A /* Brightness Control */
+#define CONTROL 0x0B /* Miscellaneous Control */
+#define CONTRAST_LO 0x0C /* Luma Gain (Contrast) */
+#define SAT_U_LO 0x0D /* Chroma (U) Gain (Saturation) */
+#define SAT_V_LO 0x0E /* Chroma (V) Gain (Saturation) */
+#define HUE 0x0F /* Hue Control */
+#define SCLOOP 0x10 /* SC Loop Control */
+#define WC_UP 0x11 /* White Crush Up Count */
+#define OFORM 0x12 /* Output Format */
+#define VSCALE_HI 0x13 /* Vertical Scaling */
+#define VSCALE_LO 0x14 /* Vertical Scaling */
+#define TEST 0x15 /* Test Control */
+#define VPOLE 0x16 /* Video Timing Polarity */
+#define IDCODE 0x17 /* ID Code */
+#define ADELAY 0x18 /* AGC Delay */
+#define BDELAY 0x19 /* Burst Gate Delay */
+#define ADC 0x1A /* ADC Interface */
+#define VTC 0x1B /* Video Timing Control */
+#define CC_STATUS 0x1C /* Extended Data Services/Closed Capt Status */
+#define CC_DATA 0x1D /* Extended Data Services/Closed Capt Data */
+#define WC_DN 0x1E /* White Crush Down Count */
+#define SRESET 0x1F /* Software Reset */
+#define P_IO 0x3F /* Programmable I/O */
+
+static CARD8
+btread(BT829Ptr bt, CARD8 reg)
+{
+ CARD8 v;
+
+ I2C_WriteRead(&(bt->d), &reg, 1, &v, 1);
+
+ return v;
+}
+
+static void
+btwrite(BT829Ptr bt, CARD8 reg, CARD8 val)
+{
+ CARD8 data[2];
+
+ data[0] = reg;
+ data[1] = val;
+ I2C_WriteRead(&(bt->d), data, 2, NULL, 0);
+}
+
+/*
+ * Register access
+ */
+static void
+btwrite_status(BT829Ptr bt)
+{ /* STATUS */
+ btwrite(bt, STATUS, 0x00); /* clear */
+}
+
+static void
+btwrite_iform(BT829Ptr bt)
+{ /* IFORM */
+ int xtsel;
+
+ switch (bt->format) {
+ case BT829_NTSC:
+ case BT829_NTSC_JAPAN:
+ case BT829_PAL_M:
+ case BT829_PAL_N_COMB: /* gatos says xtsel = 2 */
+ xtsel = 1;
+ break;
+ case BT829_PAL:
+ case BT829_PAL_N:
+ case BT829_SECAM:
+ xtsel = 2;
+ break;
+ default: /* shouldn't get here */
+ xtsel = 3; /* hardware default */
+ break;
+ }
+
+ btwrite(bt, IFORM, (bt->mux << 5) | (xtsel << 3) | bt->format);
+}
+
+static void
+btwrite_tdec(BT829Ptr bt)
+{ /* TDEC */
+ /* use default */
+}
+
+static void
+btwrite_crop(BT829Ptr bt)
+{ /* CROP */
+ btwrite(bt, CROP, (H(bt->vdelay) << 6) | (H(bt->vactive) << 4) |
+ (H(bt->hdelay) << 2) | H(bt->width));
+}
+
+static void
+btwrite_vdelay_lo(BT829Ptr bt)
+{ /* VDELAY_LO */
+ btwrite(bt, VDELAY_LO, L(bt->vdelay));
+}
+
+static void
+btwrite_vactive_lo(BT829Ptr bt)
+{ /* VACTIVE_LO */
+ btwrite(bt, VACTIVE_LO, L(bt->vactive));
+}
+
+static void
+btwrite_hdelay_lo(BT829Ptr bt)
+{ /* HDELAY_LO */
+ btwrite(bt, HDELAY_LO, L(bt->hdelay));
+}
+
+static void
+btwrite_hactive_lo(BT829Ptr bt)
+{ /* HACTIVE_LO */
+ btwrite(bt, HACTIVE_LO, L(bt->width));
+}
+
+static void
+btwrite_hscale_hi(BT829Ptr bt)
+{ /* HSCALE_HI */
+ btwrite(bt, HSCALE_HI, H(bt->hscale));
+}
+
+static void
+btwrite_hscale_lo(BT829Ptr bt)
+{ /* HSCALE_LO */
+ btwrite(bt, HSCALE_LO, L(bt->hscale));
+}
+
+static void
+btwrite_bright(BT829Ptr bt)
+{ /* BRIGHT */
+ btwrite(bt, BRIGHT, bt->brightness);
+}
+
+static void
+btwrite_control(BT829Ptr bt)
+{ /* CONTROL */
+ int ldec;
+
+ /* The data sheet says ldec should always be 0 for SECAM */
+ /* but the picture quality is better with ldec = 1 */
+ ldec = (bt->width > 360); /* gatos says 384 */
+
+ btwrite(bt, CONTROL, ((bt->mux == bt->svideo_mux) ? 0xC0 : 0x00) | /* LNOTCH and COMP */
+ (ldec << 5) | (H(bt->contrast) << 2) | (H(bt->sat_u) << 1) | H(bt->
+ sat_v));
+}
+
+static void
+btwrite_contrast_lo(BT829Ptr bt)
+{ /* CONTRAST_LO */
+ btwrite(bt, CONTRAST_LO, L(bt->contrast));
+}
+
+static void
+btwrite_sat_u_lo(BT829Ptr bt)
+{ /* SAT_U_LO */
+ btwrite(bt, SAT_U_LO, L(bt->sat_u));
+}
+
+static void
+btwrite_sat_v_lo(BT829Ptr bt)
+{ /* SAT_V_LO */
+ btwrite(bt, SAT_V_LO, L(bt->sat_v));
+}
+
+static void
+btwrite_hue(BT829Ptr bt)
+{ /* HUE */
+ btwrite(bt, HUE, bt->hue);
+}
+
+static void
+btwrite_scloop(BT829Ptr bt)
+{ /* SCLOOP */
+ if (BTVERSION >= BT827) {
+ btwrite(bt, SCLOOP, (bt->format == BT829_SECAM) ? 0x10 : 0x00 /* QCIF or AUTO */
+ );
+ }
+}
+
+static void
+btwrite_wc_up(BT829Ptr bt)
+{ /* WC_UP */
+ if (BTVERSION >= BT827) {
+ /* use default */
+ }
+}
+
+static void
+btwrite_oform(BT829Ptr bt)
+{ /* OFORM */
+ btwrite(bt, OFORM, (bt->code << 3) | (bt->len << 2) | 0x02 /* RANGE = 0, CORE = 0, VBI_FRAME = 0, OES = 2 (default) */
+ );
+}
+
+static void
+btwrite_vscale_hi(BT829Ptr bt)
+{ /* VSCALE_HI */
+ btwrite(bt, VSCALE_HI, H(bt->vscale) | 0x60 /* YCOMB = 0, COMB = 1, INT = 1 (default) */
+ );
+}
+
+static void
+btwrite_vscale_lo(BT829Ptr bt)
+{ /* VSCALE_LO */
+ btwrite(bt, VSCALE_LO, L(bt->vscale));
+}
+
+/* TEST should not be written to */
+
+static void
+btwrite_vpole(BT829Ptr bt)
+{ /* VPOLE */
+ btwrite(bt, VPOLE, (bt->out_en << 7));
+}
+
+/* IDCODE is read only */
+
+static void
+btwrite_adelay(BT829Ptr bt)
+{ /* ADELAY */
+ switch (bt->format) {
+ case BT829_NTSC:
+ case BT829_NTSC_JAPAN:
+ case BT829_PAL_M:
+ btwrite(bt, ADELAY, 104);
+ break;
+ case BT829_PAL:
+ case BT829_PAL_N:
+ case BT829_SECAM:
+ case BT829_PAL_N_COMB:
+ btwrite(bt, ADELAY, 127);
+ break;
+ default: /* shouldn't get here */
+ btwrite(bt, ADELAY, 104); /* hardware default */
+ break;
+ }
+}
+
+static void
+btwrite_bdelay(BT829Ptr bt)
+{ /* BDELAY */
+ switch (bt->format) {
+ case BT829_NTSC:
+ case BT829_NTSC_JAPAN:
+ case BT829_PAL_M:
+ btwrite(bt, BDELAY, 93);
+ break;
+ case BT829_PAL:
+ case BT829_PAL_N:
+ case BT829_PAL_N_COMB:
+ btwrite(bt, BDELAY, 114);
+ break;
+ case BT829_SECAM:
+ btwrite(bt, BDELAY, 160);
+ break;
+ default: /* shouldn't get here */
+ btwrite(bt, BDELAY, 93); /* hardware default */
+ break;
+ }
+}
+
+static void
+btwrite_adc(BT829Ptr bt)
+{ /* ADC */
+ btwrite(bt, ADC, bt->mux == bt->svideo_mux ? 0x80 : 0x82); /* CSLEEP = 0 or 1 */
+}
+
+static void
+btwrite_vtc(BT829Ptr bt)
+{ /* VTC */
+ int vfilt = 0; /* hardware default */
+
+ if (BTVERSION > BT827) { /* gatos says >= BT827 */
+ switch (bt->format) {
+ case BT829_NTSC:
+ case BT829_NTSC_JAPAN:
+ case BT829_PAL_M:
+ case BT829_PAL_N_COMB: /* gatos groups with BT829_PAL */
+ if (bt->width <= 360)
+ vfilt = 1; /* gatos says <= 240 */
+ if (bt->width <= 180)
+ vfilt = 2; /* gatos says <= 120 */
+ if (bt->width <= 90)
+ vfilt = 3; /* gatos says <= 60 */
+ break;
+ case BT829_PAL:
+ case BT829_PAL_N:
+ case BT829_SECAM:
+ if (bt->width <= 384)
+ vfilt = 1;
+ if (bt->width <= 192)
+ vfilt = 2;
+ if (bt->width <= 96)
+ vfilt = 3;
+ break;
+ default: /* shouldn't get here */
+ break; /* use hardware default */
+ }
+ btwrite(bt, VTC, (bt->vbien << 4) | (bt->vbifmt << 3) | vfilt);
+ }
+}
+
+static void
+btwrite_cc_status(BT829Ptr bt)
+{ /* CC_STATUS *//* FIXME: ATI specific */
+ if (BTVERSION >= BT827) {
+ if (bt->ccmode == 0)
+ btwrite(bt, CC_STATUS, 0x00);
+ /* 0x40 is activate to set the CCVALID line. Not required yet */
+ else
+ btwrite(bt, CC_STATUS, (bt->ccmode << 4) | 0x40);
+ }
+}
+
+/* CC_DATA is read only */
+
+static void
+btwrite_wc_dn(BT829Ptr bt)
+{ /* WC_DN */
+ if (BTVERSION >= BT827) {
+ /* use default */
+ }
+}
+
+static void
+bt_reset(BT829Ptr bt)
+{ /* SRESET */
+ btwrite(bt, SRESET, 0x0); /* Reset all registers */
+}
+
+static void
+btwrite_p_io(BT829Ptr bt)
+{ /* P_IO */
+ if (BTVERSION >= BT827) {
+ btwrite(bt, P_IO, bt->p_io);
+ }
+}
+
+/*
+ * Deal with dependencies
+ */
+static void
+propagate_changes(BT829Ptr bt)
+{
+ CARD16 hdelay, unscaled_hdelay, vdelay, hscale, vscale;
+ int htotal, vactive;
+
+ switch (bt->format) {
+ case BT829_NTSC:
+ case BT829_NTSC_JAPAN:
+ case BT829_PAL_M:
+ vdelay = 22;
+ htotal = 754;
+ vactive = 480;
+ unscaled_hdelay = 135;
+ break;
+ case BT829_PAL:
+ case BT829_PAL_N:
+ vdelay = (bt->tunertype == 5) ? 34 : 22;
+ htotal = 922;
+ vactive = 576;
+ unscaled_hdelay = 186;
+ break;
+ case BT829_SECAM:
+ vdelay = 34;
+ htotal = 922;
+ vactive = 576;
+ unscaled_hdelay = 186;
+ break;
+ case BT829_PAL_N_COMB:
+ vdelay = (bt->tunertype == 5) ? 34 : 22; /* windows says 22 */
+ htotal = 754; /* gatos and windows say 922 */
+ vactive = 576;
+ unscaled_hdelay = 135; /* gatos and windows say 186 */
+ break;
+ default: /* shouldn't get here */
+ vdelay = 22; /* hardware default */
+ htotal = 754;
+ vactive = 480; /* hardware default */
+ unscaled_hdelay = 135;
+ break;
+ }
+
+ bt->htotal = htotal; /* Used for error checking in bt829_SetCaptSize */
+
+ hscale = 4096 * htotal / (bt->width + 2 * HCROP) - 4096;
+ hdelay =
+ (HCROP + (bt->width + 2 * HCROP) * unscaled_hdelay / htotal) & 0x3FE;
+
+ vactive = vactive - 2 * VCROP;
+ vdelay = vdelay + VCROP;
+ vscale = (0x10000 - (512 * vactive / bt->height - 512)) & 0x1FFF;
+
+ if ((hdelay != bt->hdelay) || (vdelay != bt->vdelay) ||
+ (vactive != bt->vactive) || (hscale != bt->hscale) ||
+ (vscale != bt->vscale)) {
+ bt->hdelay = hdelay;
+ bt->vdelay = vdelay;
+ bt->vactive = vactive;
+ bt->hscale = hscale;
+ bt->vscale = vscale;
+ btwrite_crop(bt);
+ btwrite_vdelay_lo(bt);
+ btwrite_vactive_lo(bt);
+ btwrite_hdelay_lo(bt);
+ btwrite_hscale_hi(bt);
+ btwrite_hscale_lo(bt);
+ btwrite_control(bt);
+ btwrite_vscale_hi(bt);
+ btwrite_vscale_lo(bt);
+ }
+}
+
+static void
+write_all(BT829Ptr bt)
+{
+ bt_reset(bt);
+ propagate_changes(bt); /* ensure consistency */
+ btwrite_iform(bt);
+ btwrite_tdec(bt);
+ btwrite_crop(bt);
+ btwrite_vdelay_lo(bt);
+ btwrite_vactive_lo(bt);
+ btwrite_hdelay_lo(bt);
+ btwrite_hactive_lo(bt);
+ btwrite_hscale_hi(bt);
+ btwrite_hscale_lo(bt);
+ btwrite_bright(bt);
+ btwrite_control(bt);
+ btwrite_contrast_lo(bt);
+ btwrite_sat_u_lo(bt);
+ btwrite_sat_v_lo(bt);
+ btwrite_hue(bt);
+ btwrite_scloop(bt);
+ btwrite_wc_up(bt);
+ btwrite_oform(bt);
+ btwrite_vscale_hi(bt);
+ btwrite_vscale_lo(bt);
+ btwrite_vpole(bt);
+ btwrite_adelay(bt);
+ btwrite_bdelay(bt);
+ btwrite_adc(bt);
+ btwrite_vtc(bt);
+ /* btwrite_cc_status(bt); *//* FIXME: CC code needs cleaning */
+ btwrite_wc_dn(bt);
+ btwrite_p_io(bt);
+}
+
+/*
+ * Public functions
+ */
+BT829Ptr
+bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ BT829Ptr bt;
+ I2CByte a;
+
+ bt = calloc(1, sizeof(BT829Rec));
+ if (bt == NULL)
+ return NULL;
+ bt->d.DevName = strdup("BT829 video decoder");
+ bt->d.SlaveAddr = addr;
+ bt->d.pI2CBus = b;
+ bt->d.NextDev = NULL;
+ bt->d.StartTimeout = b->StartTimeout;
+ bt->d.BitTimeout = b->BitTimeout;
+ bt->d.AcknTimeout = b->AcknTimeout;
+ bt->d.ByteTimeout = b->ByteTimeout;
+
+ if (!I2C_WriteRead(&(bt->d), NULL, 0, &a, 1)) {
+ free(bt);
+ return NULL;
+ }
+
+ bt->id = btread(bt, IDCODE);
+
+ free(bt->d.DevName);
+ bt->d.DevName = calloc(200, sizeof(char));
+ switch (BTVERSION) {
+ case BT815:
+ sprintf(bt->d.DevName, "bt815a video decoder, revision %d",
+ bt->id & 0xf);
+ break;
+ case BT817:
+ sprintf(bt->d.DevName, "bt817a video decoder, revision %d",
+ bt->id & 0xf);
+ break;
+ case BT819:
+ sprintf(bt->d.DevName, "bt819a video decoder, revision %d",
+ bt->id & 0xf);
+ break;
+ case BT827:
+ sprintf(bt->d.DevName, "bt827a/b video decoder, revision %d",
+ bt->id & 0xf);
+ break;
+ case BT829:
+ sprintf(bt->d.DevName, "bt829a/b video decoder, revision %d",
+ bt->id & 0xf);
+ break;
+ default:
+ sprintf(bt->d.DevName,
+ "bt8xx/unknown video decoder version %d, revision %d",
+ bt->id >> 4, bt->id & 0xf);
+ break;
+ }
+
+ /* set default parameters */
+ if (!I2CDevInit(&(bt->d))) {
+ free(bt);
+ return NULL;
+ }
+
+ bt->tunertype = 1;
+
+ bt->brightness = 0; /* hardware default */
+ bt->ccmode = 0;
+ bt->code = 0; /* hardware default */
+ bt->contrast = 216; /* hardware default */
+ bt->format = BT829_NTSC;
+ bt->height = 480; /* hardware default for vactive */
+ bt->hue = 0; /* hardware default */
+ bt->len = 1; /* hardware default */
+ bt->mux = BT829_MUX0; /* hardware default */
+ bt->out_en = 0; /* hardware default */
+ bt->p_io = 0; /* hardware default */
+ bt->sat_u = 254; /* hardware default */
+ bt->sat_v = 180; /* hardware default */
+ bt->vbien = 0; /* hardware default */
+ bt->vbifmt = 0; /* hardware default */
+ bt->width = 640; /* hardware default for hactive */
+
+ bt->hdelay = 120; /* hardware default */
+ bt->hscale = 684; /* hardware default */
+ bt->vactive = 480; /* hardware default */
+ bt->vdelay = 22; /* hardware default */
+ bt->vscale = 0; /* hardware default */
+
+ bt->htotal = 754; /* NTSC */
+ bt->svideo_mux = 0; /* no s-video */
+
+ return bt;
+}
+
+int
+bt829_ATIInit(BT829Ptr bt)
+{
+ bt->code = 1;
+ bt->len = 0;
+ bt->vbien = 1;
+ bt->vbifmt = 1;
+ bt->svideo_mux = BT829_MUX1;
+
+ write_all(bt);
+
+ return 0;
+}
+
+int
+bt829_SetFormat(BT829Ptr bt, CARD8 format)
+{
+ if ((format < 1) || (format > 7))
+ return -1;
+ if ((BTVERSION <= BT819) && (format != BT829_NTSC) && (format != BT829_PAL))
+ return -1;
+ if (format == bt->format)
+ return 0;
+ bt->format = format;
+ propagate_changes(bt);
+ btwrite_iform(bt);
+ btwrite_scloop(bt);
+ btwrite_adelay(bt);
+ btwrite_bdelay(bt);
+ btwrite_vtc(bt);
+ return 0;
+}
+
+int
+bt829_SetMux(BT829Ptr bt, CARD8 mux)
+{
+ if ((mux < 1) || (mux > 3))
+ return -1;
+ if (mux == bt->mux)
+ return 0;
+ bt->mux = mux;
+ /* propagate_changes(bt); *//* no dependencies */
+ btwrite_iform(bt);
+ btwrite_control(bt);
+ btwrite_adc(bt);
+ return 0;
+}
+
+void
+bt829_SetBrightness(BT829Ptr bt, int brightness)
+{
+ brightness = LIMIT(brightness, -1000, 999); /* ensure -128 <= brightness <= 127 below */
+ brightness = (128 * brightness) / 1000;
+ if (brightness == bt->brightness)
+ return;
+ bt->brightness = brightness;
+ /* propagate_changes(bt); *//* no dependencies */
+ btwrite_bright(bt);
+}
+
+void
+bt829_SetContrast(BT829Ptr bt, int contrast)
+{
+ contrast = LIMIT(contrast, -1000, 1000);
+ contrast = (216 * (contrast + 1000)) / 1000;
+ if (contrast == bt->contrast)
+ return;
+ bt->contrast = contrast;
+ /* propagate_changes(bt); *//* no dependencies */
+ btwrite_control(bt);
+ btwrite_contrast_lo(bt);
+}
+
+void
+bt829_SetSaturation(BT829Ptr bt, int saturation)
+{
+ CARD16 sat_u, sat_v;
+
+ saturation = LIMIT(saturation, -1000, 1000);
+ sat_u = (254 * (saturation + 1000)) / 1000;
+ sat_v = (180 * (saturation + 1000)) / 1000;
+ if ((sat_u == bt->sat_u) && (sat_v == bt->sat_v))
+ return;
+ bt->sat_u = sat_u;
+ bt->sat_v = sat_v;
+ /* propagate_changes(bt); *//* no dependencies */
+ btwrite_control(bt);
+ btwrite_sat_u_lo(bt);
+ btwrite_sat_v_lo(bt);
+}
+
+void
+bt829_SetTint(BT829Ptr bt, int hue)
+{
+ hue = LIMIT(hue, -1000, 999); /* ensure -128 <= hue <= 127 below */
+ hue = (128 * hue) / 1000;
+ if (hue == bt->hue)
+ return;
+ bt->hue = hue;
+ /* propagate_changes(bt); *//* no dependencies */
+ btwrite_hue(bt);
+}
+
+int
+bt829_SetCaptSize(BT829Ptr bt, int width, int height)
+{
+ if ((width > bt->htotal - 2 * HCROP) ||
+ (16 * width < bt->htotal - 32 * HCROP))
+ return -1;
+ if ((height > bt->vactive) || (16 * height < bt->vactive))
+ return -1;
+ if ((width == bt->width) && (height == bt->height))
+ return 0;
+ bt->width = width;
+ bt->height = height;
+ propagate_changes(bt);
+ btwrite_crop(bt);
+ btwrite_hactive_lo(bt);
+ btwrite_control(bt);
+ btwrite_vtc(bt);
+ return 0;
+}
+
+int
+bt829_SetCC(BT829Ptr bt)
+{ /* FIXME: should take ccmode as a parameter */
+ if (BTVERSION < BT827)
+ return -1; /* can't do it */
+ /* propagate_changes(bt); *//* no dependencies */
+ btwrite_cc_status(bt);
+ /* we write to STATUS to reset the CCVALID flag */
+ if (bt->ccmode != 0)
+ btwrite_status(bt);
+ return 0;
+}
+
+void
+bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en)
+{
+ out_en = (out_en != 0);
+ if (out_en == bt->out_en)
+ return;
+ bt->out_en = out_en;
+ /* propagate_changes(bt); *//* no dependencies */
+ btwrite_vpole(bt);
+}
+
+void
+bt829_SetP_IO(BT829Ptr bt, CARD8 p_io)
+{
+ if (p_io == bt->p_io)
+ return;
+ bt->p_io = p_io;
+ /* propagate_changes(bt); *//* no dependencies */
+ btwrite_p_io(bt);
+}
+
+#define BTREAD(R) btread(bt,(R))
+
+#if 0
+
+void
+bt829_getCCdata(BT829Ptr bt, struct CCdata *data)
+{
+ CARD8 status;
+
+ data->num_valid = 0;
+ /* wait for buffer to be half full (means 8/16 bytes)
+ * either 4 (one of CC/EDS) or 2 (both CC/EDS) frames */
+ if (!(BTREAD(STATUS) & 0x04))
+ return; /* could comment this line */
+ for (; data->num_valid < CC_FIFO_SIZE; data->num_valid++) {
+ status = BTREAD(CC_STATUS);
+ if (!(status & 0x04))
+ break;
+ data->data[data->num_valid] = BTREAD(CC_DATA) & 0x7f;
+ /* stripped high bit (parity) */
+ data->status[data->num_valid] = (CCS_EDS * ((status & 0x02) >> 1)) |
+ (CCS_HIGH * (status & 0x01)) |
+ (CCS_OVER * ((status & 0x08) >> 3)) |
+ (CCS_PAR * ((status & 0x80) >> 7));
+ }
+ btwrite(bt, STATUS, 0x00); /* Reset CCVALID status bit */
+ return;
+}
+
+#endif
+
+/* ------------------------------------------------------------------------ */
+/* Debug and report routines */
+
+#define DUMPREG(REG) \
+ xf86DrvMsg(bt->d.pI2CBus->scrnIndex,X_INFO," %-12s (0x%02X) = 0x%02X\n", \
+ #REG,REG,BTREAD(REG))
+
+/*static void bt829_dumpregs(BT829Ptr bt)
+{
+ DUMPREG(STATUS);
+ DUMPREG(IFORM);
+ DUMPREG(TDEC);
+ DUMPREG(CROP);
+ DUMPREG(VDELAY_LO);
+ DUMPREG(VACTIVE_LO);
+ DUMPREG(HDELAY_LO);
+ DUMPREG(HACTIVE_LO);
+ DUMPREG(HSCALE_HI);
+ DUMPREG(HSCALE_LO);
+ DUMPREG(BRIGHT);
+ DUMPREG(CONTROL);
+ DUMPREG(CONTRAST_LO);
+ DUMPREG(SAT_U_LO);
+ DUMPREG(SAT_V_LO);
+ DUMPREG(HUE);
+ if (BTVERSION >= BT827) {
+ DUMPREG(SCLOOP);
+ DUMPREG(WC_UP) ; }
+ DUMPREG(OFORM);
+ DUMPREG(VSCALE_HI);
+ DUMPREG(VSCALE_LO);
+ DUMPREG(TEST);
+ DUMPREG(VPOLE);
+ DUMPREG(IDCODE);
+ DUMPREG(ADELAY);
+ DUMPREG(BDELAY);
+ DUMPREG(ADC);
+ if (BTVERSION >= BT827) {
+ DUMPREG(VTC);
+ DUMPREG(CC_STATUS);
+ DUMPREG(CC_DATA);
+ DUMPREG(WC_DN);
+ DUMPREG(P_IO) ; }
+}*/
diff --git a/xorg-server/hw/xfree86/i2c/bt829_module.c b/xorg-server/hw/xfree86/i2c/bt829_module.c
index 12801fbf3..c8a6ac6d1 100644
--- a/xorg-server/hw/xfree86/i2c/bt829_module.c
+++ b/xorg-server/hw/xfree86/i2c/bt829_module.c
@@ -1,21 +1,20 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static XF86ModuleVersionInfo bt829VersRec =
-{
- "bt829",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData bt829ModuleData = { &bt829VersRec, NULL, NULL };
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo bt829VersRec = {
+ "bt829",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData bt829ModuleData = { &bt829VersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/i2c/fi1236.c b/xorg-server/hw/xfree86/i2c/fi1236.c
index 0bc50e566..282fe7e34 100644
--- a/xorg-server/hw/xfree86/i2c/fi1236.c
+++ b/xorg-server/hw/xfree86/i2c/fi1236.c
@@ -15,38 +15,36 @@
#define NUM_TUNERS 8
-const FI1236_parameters tuner_parms[NUM_TUNERS] =
-{
+const FI1236_parameters tuner_parms[NUM_TUNERS] = {
/* 0 - FI1236 */
- { 733, 884, 12820, 2516, 7220, 0xA2, 0x94, 0x34, 0x8e },
+ {733, 884, 12820, 2516, 7220, 0xA2, 0x94, 0x34, 0x8e},
/* !!!based on documentation - it should be:
- {733, 16*55.25, 16*801.25, 16*160, 16*454, 0xA0, 0x90, 0x30, 0x8e},*/
+ {733, 16*55.25, 16*801.25, 16*160, 16*454, 0xA0, 0x90, 0x30, 0x8e}, */
/* 1 - FI1216 */
- { 623, 16*48.75, 16*855.25, 16*170, 16*450, 0xA0, 0x90, 0x30, 0x8e },
+ {623, 16 * 48.75, 16 * 855.25, 16 * 170, 16 * 450, 0xA0, 0x90, 0x30, 0x8e},
/* 2 - TEMIC FN5AL */
- { 623, 16*45.75, 16*855.25, 16*169, 16*454, 0xA0, 0x90, 0x30, 0x8e },
+ {623, 16 * 45.75, 16 * 855.25, 16 * 169, 16 * 454, 0xA0, 0x90, 0x30, 0x8e},
/* 3 - MT2032.. */
- { 733, 768, 13760, 0, 0, 0, 0, 0, 0 },
+ {733, 768, 13760, 0, 0, 0, 0, 0, 0},
/* 4 - FI1246 */
- { 623, 16*45.75, 16*855.25, 16*170, 16*450, 0xA0, 0x90, 0x30, 0x8e },
+ {623, 16 * 45.75, 16 * 855.25, 16 * 170, 16 * 450, 0xA0, 0x90, 0x30, 0x8e},
/* 5 - FI1256 */
- { 623, 16*49.75, 16*863.25, 16*170, 16*450, 0xA0, 0x90, 0x30, 0x8e },
+ {623, 16 * 49.75, 16 * 863.25, 16 * 170, 16 * 450, 0xA0, 0x90, 0x30, 0x8e},
/* 6 - FI1236W */
- /*{ 733, 884, 12820, 2516, 7220, 0x1, 0x2, 0x4, 0x8e },*/
- { 732, 16*55.25, 16*801.25, 16*160, 16*442, 0x1, 0x2, 0x4, 0x8e },
+ /*{ 733, 884, 12820, 2516, 7220, 0x1, 0x2, 0x4, 0x8e }, */
+ {732, 16 * 55.25, 16 * 801.25, 16 * 160, 16 * 442, 0x1, 0x2, 0x4, 0x8e},
/* 7 - FM1216ME */
- { 623, 16*48.25, 16*863.25, 16*158.00, 16*442.00, 0x1, 0x2, 0x4, 0x8e }
+ {623, 16 * 48.25, 16 * 863.25, 16 * 158.00, 16 * 442.00, 0x1, 0x2, 0x4, 0x8e}
};
-
FI1236Ptr
-Detect_FI1236 (I2CBusPtr b, I2CSlaveAddr addr)
+Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr)
{
FI1236Ptr f;
I2CByte a;
- f = calloc(1,sizeof(FI1236Rec));
+ f = calloc(1, sizeof(FI1236Rec));
if (f == NULL)
return NULL;
f->d.DevName = strdup("FI12xx Tuner");
@@ -57,10 +55,10 @@ Detect_FI1236 (I2CBusPtr b, I2CSlaveAddr addr)
f->d.BitTimeout = b->BitTimeout;
f->d.AcknTimeout = b->AcknTimeout;
f->d.ByteTimeout = b->ByteTimeout;
- f->type=TUNER_TYPE_FI1236;
- f->afc_timer_installed=FALSE;
- f->last_afc_hint=TUNER_OFF;
- f->video_if=45.7812;
+ f->type = TUNER_TYPE_FI1236;
+ f->afc_timer_installed = FALSE;
+ f->last_afc_hint = TUNER_OFF;
+ f->video_if = 45.7812;
if (!I2C_WriteRead(&(f->d), NULL, 0, &a, 1)) {
free(f);
@@ -75,7 +73,7 @@ Detect_FI1236 (I2CBusPtr b, I2CSlaveAddr addr)
}
static void
-MT2032_dump_parameters (FI1236Ptr f, MT2032_parameters *m)
+MT2032_dump_parameters(FI1236Ptr f, MT2032_parameters * m)
{
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: input f_rf=%g f_if1=%g f_if2=%g f_ref=%g f_ifbw=%g f_step=%g\n",
@@ -86,15 +84,14 @@ MT2032_dump_parameters (FI1236Ptr f, MT2032_parameters *m)
m->f_lo1, m->f_lo2, m->LO1I, m->LO2I, m->SEL, m->STEP, m->NUM);
}
-
static void
-MT2032_getid (FI1236Ptr f)
+MT2032_getid(FI1236Ptr f)
{
CARD8 out[4];
CARD8 in;
in = 0x11;
- I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 4);
+ I2C_WriteRead(&(f->d), (I2CByte *) & in, 1, out, 4);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: Company code 0x%02x%02x, part code 0x%02x, revision code 0x%02x\n",
out[0], out[1], out[2], out[3]);
@@ -104,37 +101,37 @@ MT2032_getid (FI1236Ptr f)
/* might be buggy */
#if 0
static void
-MT2032_shutdown (FI1236Ptr f)
+MT2032_shutdown(FI1236Ptr f)
{
CARD8 data[10];
- data[0] = 0x00; /* start with register 0x00 */
+ data[0] = 0x00; /* start with register 0x00 */
data[1] = 0x1A;
data[2] = 0x44;
data[3] = 0x20;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 4, NULL, 0);
- data[0] = 0x05; /* now start with register 0x05 */
+ data[0] = 0x05; /* now start with register 0x05 */
data[1] = 0xD7;
data[2] = 0x14;
data[3] = 0x05;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 4, NULL, 0);
- data[0] = 0x0B; /* now start with register 0x05 */
+ data[0] = 0x0B; /* now start with register 0x05 */
data[1] = 0x8F;
data[2] = 0x07;
data[3] = 0x43;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 4, NULL, 0);
usleep(15000);
}
#endif
-static void MT2032_dump_status (FI1236Ptr f);
+static void MT2032_dump_status(FI1236Ptr f);
static void
-MT2032_init (FI1236Ptr f)
+MT2032_init(FI1236Ptr f)
{
CARD8 data[10];
CARD8 value;
@@ -142,31 +139,31 @@ MT2032_init (FI1236Ptr f)
MT2032_getid(f);
- data[0] = 0x02; /* start with register 0x02 */
+ data[0] = 0x02; /* start with register 0x02 */
data[1] = 0xFF;
data[2] = 0x0F;
data[3] = 0x1F;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 4, NULL, 0);
- data[0] = 0x06; /* now start with register 0x06 */
+ data[0] = 0x06; /* now start with register 0x06 */
data[1] = 0xE4;
data[2] = 0x8F;
data[3] = 0xC3;
data[4] = 0x4E;
data[5] = 0xEC;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 6, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 6, NULL, 0);
- data[0] = 0x0d; /* now start with register 0x0d */
+ data[0] = 0x0d; /* now start with register 0x0d */
data[1] = 0x32;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0);
while (1) {
- usleep(15000); /* wait 15 milliseconds */
+ usleep(15000); /* wait 15 milliseconds */
- data[0] = 0x0e; /* register number 7, status */
+ data[0] = 0x0e; /* register number 7, status */
value = 0xFF;
- if (!I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1))
+ if (!I2C_WriteRead(&(f->d), (I2CByte *) data, 1, &value, 1))
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: failed to read XOK\n");
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
@@ -175,32 +172,33 @@ MT2032_init (FI1236Ptr f)
break;
data[0] = 0x07;
- if (!I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1))
+ if (!I2C_WriteRead(&(f->d), (I2CByte *) data, 1, &value, 1))
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: failed to read XOGC\n");
- xogc=value & 0x7;
+ xogc = value & 0x7;
if (xogc == 4)
- break; /* XOGC has reached 4.. stop */
+ break; /* XOGC has reached 4.. stop */
xogc--;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: try XOGC=%d\n", xogc);
usleep(15000);
- data[0] = 0x07; /* register number 7, control byte 2 */
+ data[0] = 0x07; /* register number 7, control byte 2 */
data[1] = 0x08 | xogc;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0);
}
f->xogc = xogc;
/* wait before continuing */
- usleep(15000); /* wait 50 milliseconds */
+ usleep(15000); /* wait 50 milliseconds */
MT2032_dump_status(f);
}
static int
-MT2032_no_spur_in_band (MT2032_parameters *m)
+MT2032_no_spur_in_band(MT2032_parameters * m)
{
int n_max, n1, n2;
double f_test;
+
n_max = 5;
n1 = 1;
while (1) {
@@ -233,10 +231,12 @@ MT2032_no_spur_in_band (MT2032_parameters *m)
}
static void
-MT2032_calculate_register_settings (MT2032_parameters *m, double f_rf,
- double f_if1, double f_if2, double f_ref, double f_ifbw, double f_step)
+MT2032_calculate_register_settings(MT2032_parameters * m, double f_rf,
+ double f_if1, double f_if2, double f_ref,
+ double f_ifbw, double f_step)
{
int n;
+
m->f_rf = f_rf;
m->f_if1 = f_if1;
m->f_if2 = f_if2;
@@ -244,7 +244,7 @@ MT2032_calculate_register_settings (MT2032_parameters *m, double f_rf,
m->f_ifbw = f_ifbw;
m->f_step = f_step;
- m->f_lo1 = f_rf+f_if1;
+ m->f_lo1 = f_rf + f_if1;
m->LO1I = lrint(m->f_lo1 / f_ref);
m->f_lo1 = f_ref * m->LO1I;
@@ -277,33 +277,33 @@ MT2032_calculate_register_settings (MT2032_parameters *m, double f_rf,
m->SEL = 2;
else if (m->f_lo1 < 1890.0)
m->SEL = 1;
- else /* m->f_lo1 < 1958.0 */
+ else /* m->f_lo1 < 1958.0 */
m->SEL = 0;
/* calculate the rest of the registers */
m->LO2I = floor(m->f_lo2 / f_ref);
m->STEP = floor(3780.0 * f_step / f_ref);
- m->NUM = floor(3780.0 * (m->f_lo2 / f_ref - m->LO2I));
- m->NUM = m->STEP * lrint((1.0 * m->NUM) / (1.0 * m->STEP));
+ m->NUM = floor(3780.0 * (m->f_lo2 / f_ref - m->LO2I));
+ m->NUM = m->STEP * lrint((1.0 * m->NUM) / (1.0 * m->STEP));
}
static int
-MT2032_wait_for_lock (FI1236Ptr f)
+MT2032_wait_for_lock(FI1236Ptr f)
{
int n;
CARD8 data[10];
CARD8 value;
- n=12;
- while(1) {
- data[0] = 0x0e; /* register number 7, status */
- I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
- /* xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
- "MT2032: LO1LK=%d LO2LK=%d\n",
- (value & 0x04)>>2, (value & 0x02)>>1); */
- if ((value & 6)==6)
+ n = 12;
+ while (1) {
+ data[0] = 0x0e; /* register number 7, status */
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 1, &value, 1);
+ /* xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+ "MT2032: LO1LK=%d LO2LK=%d\n",
+ (value & 0x04)>>2, (value & 0x02)>>1); */
+ if ((value & 6) == 6)
break;
- usleep (1500);
+ usleep(1500);
n--;
if (n < 0)
break;
@@ -317,50 +317,50 @@ MT2032_wait_for_lock (FI1236Ptr f)
}
static void
-MT2032_implement_settings (FI1236Ptr f, MT2032_parameters *m)
+MT2032_implement_settings(FI1236Ptr f, MT2032_parameters * m)
{
CARD8 data[10];
CARD8 value;
- data[0] = 0x00; /* start with register 0x00 */
+ data[0] = 0x00; /* start with register 0x00 */
data[1] = (m->LO1I >> 3) - 1;
data[2] = (m->SEL << 4) | (m->LO1I & 0x7);
data[3] = 0x86;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 4, NULL, 0);
- data[0] = 0x05; /* start with register 0x05 */
+ data[0] = 0x05; /* start with register 0x05 */
data[1] = ((m->LO2I & 0x7) << 5) | ((m->LO2I >> 3) - 1);
if (m->f_rf < 400.0)
data[2] = 0xe4;
else
data[2] = 0xf4;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 3, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 3, NULL, 0);
- data[0] = 0x07; /* register number 7, control byte 2 */
- I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
+ data[0] = 0x07; /* register number 7, control byte 2 */
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 1, &value, 1);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: using XOGC=%d\n", (value & 0x07));
data[1] = 8 | (value & 0x7);
- I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0);
- data[0] = 0x0b; /* start with register 0x0b */
+ data[0] = 0x0b; /* start with register 0x0b */
data[1] = m->NUM & 0xff;
- data[2] = (1<<7) | ((m->NUM >> 8) & 0x0f);
- I2C_WriteRead(&(f->d), (I2CByte *)data, 3, NULL, 0);
+ data[2] = (1 << 7) | ((m->NUM >> 8) & 0x0f);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 3, NULL, 0);
MT2032_wait_for_lock(f);
}
static void
-MT2032_optimize_VCO (FI1236Ptr f, MT2032_parameters *m)
+MT2032_optimize_VCO(FI1236Ptr f, MT2032_parameters * m)
{
CARD8 data[10];
CARD8 value;
CARD8 TAD1;
- data[0] = 0x0f; /* register number 7, status */
- I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
- TAD1=value & 0x07;
+ data[0] = 0x0f; /* register number 7, status */
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 1, &value, 1);
+ TAD1 = value & 0x07;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: TAD1=%d SEL=%d\n", TAD1, m->SEL);
if (TAD1 < 2)
@@ -369,25 +369,27 @@ MT2032_optimize_VCO (FI1236Ptr f, MT2032_parameters *m)
if (m->SEL == 0)
return;
m->SEL--;
- } else {
+ }
+ else {
if (m->SEL >= 4)
return;
m->SEL++;
}
- data[0] = 0x01; /* start with register 1 */
+ data[0] = 0x01; /* start with register 1 */
data[1] = (m->SEL << 4) | (m->LO1I & 0x7);
- I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0);
}
static int
-FI1236_get_afc_hint (FI1236Ptr f)
+FI1236_get_afc_hint(FI1236Ptr f)
{
CARD8 out;
CARD8 AFC;
if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) {
- TDA9885Ptr t = (TDA9885Ptr)f->afc_source;
+ TDA9885Ptr t = (TDA9885Ptr) f->afc_source;
+
if (t == NULL)
return TUNER_OFF;
@@ -405,7 +407,8 @@ FI1236_get_afc_hint (FI1236Ptr f)
return TUNER_JUST_ABOVE;
else if (AFC == 0x0f)
return TUNER_TUNED;
- } else {
+ }
+ else {
I2C_WriteRead(&(f->d), NULL, 0, &out, 1);
AFC = out & 0x7;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
@@ -422,17 +425,18 @@ FI1236_get_afc_hint (FI1236Ptr f)
}
static int
-MT2032_get_afc_hint (FI1236Ptr f)
+MT2032_get_afc_hint(FI1236Ptr f)
{
CARD8 in;
CARD8 out[2];
CARD8 AFC;
+
in = 0x0e;
- I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 2);
+ I2C_WriteRead(&(f->d), (I2CByte *) & in, 1, out, 2);
AFC = (out[0] >> 4) & 0x7;
#if 0
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC=%d TAD1=%d TAD2=%d\n",
- AFC, out[1] & 0x7, (out[1]>>4)& 0x07);
+ AFC, out[1] & 0x7, (out[1] >> 4) & 0x07);
#endif
if (AFC == 2)
return TUNER_TUNED;
@@ -445,7 +449,7 @@ MT2032_get_afc_hint (FI1236Ptr f)
/* this function is for external use only */
int
-TUNER_get_afc_hint (FI1236Ptr f)
+TUNER_get_afc_hint(FI1236Ptr f)
{
if (f->afc_timer_installed)
return TUNER_STILL_TUNING;
@@ -453,7 +457,7 @@ TUNER_get_afc_hint (FI1236Ptr f)
}
static void
-MT2032_dump_status (FI1236Ptr f)
+MT2032_dump_status(FI1236Ptr f)
{
CARD8 in;
CARD8 out[2];
@@ -463,16 +467,16 @@ MT2032_dump_status (FI1236Ptr f)
CARD8 TAD2, TAD1;
in = 0x0e;
- I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 2);
+ I2C_WriteRead(&(f->d), (I2CByte *) & in, 1, out, 2);
XOK = out[0] & 1;
- LO1LK = (out[0] >> 2) & 1;
- LO2LK = (out[0] >> 1) & 1;
+ LO1LK = (out[0] >> 2) & 1;
+ LO2LK = (out[0] >> 1) & 1;
LDONrb = (out[0] >> 3) & 1;
- AFC = (out[0] >> 4) & 0x7;
+ AFC = (out[0] >> 4) & 0x7;
- TAD1 = (out[1] & 0x7);
- TAD2 = (out[1] >> 4) & 0x7;
+ TAD1 = (out[1] & 0x7);
+ TAD2 = (out[1] >> 4) & 0x7;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: status: XOK=%d LO1LK=%d LO2LK=%d LDONrb=%d AFC=%d TAD1=%d TAD2=%d\n",
@@ -480,12 +484,12 @@ MT2032_dump_status (FI1236Ptr f)
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: status: OSCILLATOR:%s PLL1:%s PLL2:%s\n",
XOK ? "ok" : "off",
- LO1LK ? "locked" : "off",
- LO2LK ? "locked" : "off");
+ LO1LK ? "locked" : "off", LO2LK ? "locked" : "off");
}
-static void MT2032_tune(FI1236Ptr f, double freq, double step)
+static void
+MT2032_tune(FI1236Ptr f, double freq, double step)
{
MT2032_parameters m;
CARD8 data[10];
@@ -494,38 +498,41 @@ static void MT2032_tune(FI1236Ptr f, double freq, double step)
/* NTSC IF is 44mhz.. but 733/16=45.8125 and all TDAXXXX docs mention
45.75, 39, 58.75 and 30. */
#if 0
- MT2032_calculate_register_settings(&m, freq, 1090.0, 45.125, 5.25, 6.0, step);
- MT2032_calculate_register_settings(&m, freq, 1090.0, 45.74, 5.25, 6.0, step);
+ MT2032_calculate_register_settings(&m, freq, 1090.0, 45.125, 5.25, 6.0,
+ step);
+ MT2032_calculate_register_settings(&m, freq, 1090.0, 45.74, 5.25, 6.0,
+ step);
#endif
- MT2032_calculate_register_settings(&m, freq, 1090.0, f->video_if, 5.25, 3.0, step);
+ MT2032_calculate_register_settings(&m, freq, 1090.0, f->video_if, 5.25, 3.0,
+ step);
MT2032_dump_parameters(f, &m);
MT2032_implement_settings(f, &m);
- /* MT2032_dump_parameters(f, &m); */
+ /* MT2032_dump_parameters(f, &m); */
for (i = 0; i < 3; i++) {
MT2032_optimize_VCO(f, &m);
if (MT2032_wait_for_lock(f)) {
- data[0] = 0x02; /* LO Gain control register 0x02 */
+ data[0] = 0x02; /* LO Gain control register 0x02 */
data[1] = 0x20;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0);
return;
}
data[0] = 0x07;
data[1] = 0x88 | f->xogc;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0);
usleep(15000);
data[1] = 0x08 | f->xogc;
- I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0);
}
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"MT2032: failed to set frequency\n");
}
void
-FI1236_set_tuner_type (FI1236Ptr f, int type)
+FI1236_set_tuner_type(FI1236Ptr f, int type)
{
f->type = type;
if (type >= NUM_TUNERS)
- type = NUM_TUNERS-1;
+ type = NUM_TUNERS - 1;
if (type < 0)
type = 0;
memcpy(&(f->parm), &(tuner_parms[type]), sizeof(FI1236_parameters));
@@ -537,11 +544,11 @@ FI1236_set_tuner_type (FI1236Ptr f, int type)
}
}
-
static CARD32
AFC_TimerCallback(OsTimerPtr timer, CARD32 time, pointer data)
{
- FI1236Ptr f = (FI1236Ptr)data;
+ FI1236Ptr f = (FI1236Ptr) data;
+
if (FI1236_AFC(f))
return 150;
else {
@@ -557,12 +564,14 @@ FI1236_tune(FI1236Ptr f, CARD32 frequency)
CARD16 divider;
CARD8 data;
- if (frequency < f->parm.min_freq) frequency = f->parm.min_freq;
- if (frequency > f->parm.max_freq) frequency = f->parm.max_freq;
+ if (frequency < f->parm.min_freq)
+ frequency = f->parm.min_freq;
+ if (frequency > f->parm.max_freq)
+ frequency = f->parm.max_freq;
- divider = (f->parm.fcar + (CARD16)frequency) & 0x7fff;
- f->tuner_data.div1 = (CARD8)((divider >> 8)&0x7f);
- f->tuner_data.div2 = (CARD8)(divider & 0xff);
+ divider = (f->parm.fcar + (CARD16) frequency) & 0x7fff;
+ f->tuner_data.div1 = (CARD8) ((divider >> 8) & 0x7f);
+ f->tuner_data.div2 = (CARD8) (divider & 0xff);
f->tuner_data.control = f->parm.control;
if (frequency < f->parm.threshold1)
@@ -576,41 +585,42 @@ FI1236_tune(FI1236Ptr f, CARD32 frequency)
"Setting tuner band to %d\n", f->tuner_data.band);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
- "Setting tuner frequency to %d\n", (int)frequency);
+ "Setting tuner frequency to %d\n", (int) frequency);
if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) {
f->tuner_data.aux = 0x20;
- I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 5, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) & (f->tuner_data), 5, NULL, 0);
I2C_WriteRead(&(f->d), NULL, 0, &data, 1);
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Tuner status %x\n", data);
}
else
- I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 4, NULL, 0);
+ I2C_WriteRead(&(f->d), (I2CByte *) & (f->tuner_data), 4, NULL, 0);
}
void
TUNER_set_frequency(FI1236Ptr f, CARD32 frequency)
{
- if (frequency < f->parm.min_freq) frequency = f->parm.min_freq;
- if (frequency > f->parm.max_freq) frequency = f->parm.max_freq;
+ if (frequency < f->parm.min_freq)
+ frequency = f->parm.min_freq;
+ if (frequency > f->parm.max_freq)
+ frequency = f->parm.max_freq;
- f->afc_delta=0;
- f->original_frequency=frequency;
+ f->afc_delta = 0;
+ f->original_frequency = frequency;
if (f->type == TUNER_TYPE_MT2032)
- MT2032_tune(f, (1.0*frequency)/16.0, 0.0625);
+ MT2032_tune(f, (1.0 * frequency) / 16.0, 0.0625);
else
FI1236_tune(f, frequency);
if (!f->afc_timer_installed) {
- f->afc_timer_installed=TRUE;
+ f->afc_timer_installed = TRUE;
/* RegisterBlockAndWakeupHandlers(FI1236_BlockHandler, AFCWakeup, f); */
TimerSet(NULL, 0, 300, AFC_TimerCallback, f);
}
}
-
int
FI1236_AFC(FI1236Ptr f)
{
@@ -637,12 +647,13 @@ FI1236_AFC(FI1236Ptr f)
"AFC: Setting tuner frequency to %g\n",
(0.5 * (2 * f->original_frequency + f->afc_delta)) / 16.0);
MT2032_tune(f,
- (1.0 * f->original_frequency+ 0.5 * f->afc_delta) / 16.0,
+ (1.0 * f->original_frequency + 0.5 * f->afc_delta) / 16.0,
0.03125);
if (f->last_afc_hint == TUNER_OFF)
return 0;
- return 1; /* call me again */
- } else {
+ return 1; /* call me again */
+ }
+ else {
f->last_afc_hint = FI1236_get_afc_hint(f);
if (f->last_afc_hint == TUNER_TUNED) {
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: TUNER_TUNNED\n");
@@ -652,9 +663,9 @@ FI1236_AFC(FI1236Ptr f)
f->last_afc_hint = TUNER_OFF;
if (f->last_afc_hint == TUNER_OFF)
- f->afc_delta=0;
+ f->afc_delta = 0;
else
- f->afc_delta+=f->last_afc_hint;
+ f->afc_delta += f->last_afc_hint;
xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
"AFC: Setting tuner frequency to %g\n",
@@ -662,9 +673,9 @@ FI1236_AFC(FI1236Ptr f)
FI1236_tune(f, f->original_frequency + f->afc_delta);
if (f->last_afc_hint == TUNER_OFF)
return 0;
- return 1; /* call me again */
+ return 1; /* call me again */
}
- return 0; /* done */
+ return 0; /* done */
}
void
diff --git a/xorg-server/hw/xfree86/i2c/fi1236_module.c b/xorg-server/hw/xfree86/i2c/fi1236_module.c
index 7375e0fb9..2f453d964 100644
--- a/xorg-server/hw/xfree86/i2c/fi1236_module.c
+++ b/xorg-server/hw/xfree86/i2c/fi1236_module.c
@@ -1,25 +1,24 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static XF86ModuleVersionInfo fi1236VersRec =
-{
- "fi1236",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData fi1236ModuleData = {
- &fi1236VersRec,
- NULL,
- NULL
-};
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo fi1236VersRec = {
+ "fi1236",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData fi1236ModuleData = {
+ &fi1236VersRec,
+ NULL,
+ NULL
+};
diff --git a/xorg-server/hw/xfree86/i2c/msp3430.c b/xorg-server/hw/xfree86/i2c/msp3430.c
index df8adc435..312a2d1d1 100644
--- a/xorg-server/hw/xfree86/i2c/msp3430.c
+++ b/xorg-server/hw/xfree86/i2c/msp3430.c
@@ -16,11 +16,10 @@
#define WR_DSP 0x12
#define RD_DSP 0x13
-
void InitMSP34xxG(MSP3430Ptr m);
void InitMSP34x5D(MSP3430Ptr m);
void CheckModeMSP34x5D(MSP3430Ptr m);
-static const char *MSP_getProductName (CARD16 product_id);
+static const char *MSP_getProductName(CARD16 product_id);
void mpause(int milliseconds);
#define __MSPDEBUG__ 0
@@ -28,275 +27,296 @@ void mpause(int milliseconds);
#if __MSPDEBUG__ > 3
void MSPBeep(MSP3430Ptr m, CARD8 freq);
+
#define __MSPBEEP MSPBeep(m,0x14);
#else
-#define __MSPBEEP
+#define __MSPBEEP
#endif
-static void SetMSP3430Control(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegValueHigh, CARD8 RegValueLow)
+static void
+SetMSP3430Control(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegValueHigh,
+ CARD8 RegValueLow)
{
- I2CByte data[3];
-
- data[0]=RegAddress;
- data[1]=RegValueHigh;
- data[2]=RegValueLow;
-
- I2C_WriteRead(&(m->d),data,3,NULL,0);
+ I2CByte data[3];
+
+ data[0] = RegAddress;
+ data[1] = RegValueHigh;
+ data[2] = RegValueLow;
+
+ I2C_WriteRead(&(m->d), data, 3, NULL, 0);
}
-static void SetMSP3430Data(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegSubAddressHigh, CARD8 RegSubAddressLow,
- CARD8 RegValueHigh, CARD8 RegValueLow)
+static void
+SetMSP3430Data(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegSubAddressHigh,
+ CARD8 RegSubAddressLow, CARD8 RegValueHigh, CARD8 RegValueLow)
{
- I2CByte data[5];
+ I2CByte data[5];
+
#ifdef MSP_DEBUG
- if(!m->registers_present[RegSubAddressLow]){
- xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_ERROR, "Attempt to access non-existent register in MSP34xxX: 0x%02x 0x%02x 0x%02x <- 0x%02x 0x%02x\n",
- RegAddress, RegSubAddressHigh, RegSubAddressLow, RegValueHigh, RegValueLow);
- }
+ if (!m->registers_present[RegSubAddressLow]) {
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_ERROR,
+ "Attempt to access non-existent register in MSP34xxX: 0x%02x 0x%02x 0x%02x <- 0x%02x 0x%02x\n",
+ RegAddress, RegSubAddressHigh, RegSubAddressLow,
+ RegValueHigh, RegValueLow);
+ }
#endif
-
- data[0] = RegAddress;
- data[1] = RegSubAddressHigh;
- data[2] = RegSubAddressLow;
- data[3] = RegValueHigh;
- data[4] = RegValueLow;
-
- I2C_WriteRead(&(m->d),data,5,NULL,0);
+
+ data[0] = RegAddress;
+ data[1] = RegSubAddressHigh;
+ data[2] = RegSubAddressLow;
+ data[3] = RegValueHigh;
+ data[4] = RegValueLow;
+
+ I2C_WriteRead(&(m->d), data, 5, NULL, 0);
}
-static void GetMSP3430Data(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegSubAddressHigh, CARD8 RegSubAddressLow,
- CARD8 *RegValueHigh, CARD8 *RegValueLow)
+static void
+GetMSP3430Data(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegSubAddressHigh,
+ CARD8 RegSubAddressLow, CARD8 *RegValueHigh, CARD8 *RegValueLow)
{
- I2CByte send[3];
- I2CByte receive[2];
-
- send[0] = RegAddress;
- send[1] = RegSubAddressHigh;
- send[2] = RegSubAddressLow;
-
- I2C_WriteRead(&(m->d), send, 3, receive, 2);
-
- *RegValueHigh = receive[0];
- *RegValueLow = receive[1];
+ I2CByte send[3];
+ I2CByte receive[2];
+
+ send[0] = RegAddress;
+ send[1] = RegSubAddressHigh;
+ send[2] = RegSubAddressLow;
+
+ I2C_WriteRead(&(m->d), send, 3, receive, 2);
+
+ *RegValueHigh = receive[0];
+ *RegValueLow = receive[1];
}
#if __MSPDEBUG__ > 2
-static void MSP3430DumpStatus(MSP3430Ptr m)
+static void
+MSP3430DumpStatus(MSP3430Ptr m)
{
-CARD8 status_hi, status_lo;
-CARD8 subaddr, data[2];
-
-GetMSP3430Data(m, RD_DEM, 0x02, 0x00, &status_hi, &status_lo);
-xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP34xx: SAP(8)=%d mono/NICAM(7)=%d stereo=%d %s O_1=%d O_0=%d 2nd car=%d 1st car=%d\n",
- status_hi & 1, (status_lo>>7) & 1, (status_lo>>6)&1,
- (status_lo>>5)? ( (status_hi>>1)&1? "bad NICAM reception" : "NICAM" ) :
- ((status_hi>>1)&1 ? "bogus" : "ANALOG FM/AM") ,
- (status_lo>>4)&1, (status_lo>>3)&1,!( (status_lo>>2)&1), !((status_lo>>1)&1));
-
-GetMSP3430Data(m, RD_DEM, 0x00, 0x7E, &status_hi, &status_lo);
-xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP34xx: standard result=0x%02x%02x\n",
- status_hi, status_lo);
-subaddr=0x0;
-I2C_WriteRead(&(m->d), &subaddr, 1, data, 2);
-xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP34xx: control=0x%02x%02x\n",
- data[1], data[0]);
+ CARD8 status_hi, status_lo;
+ CARD8 subaddr, data[2];
+
+ GetMSP3430Data(m, RD_DEM, 0x02, 0x00, &status_hi, &status_lo);
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO,
+ "MSP34xx: SAP(8)=%d mono/NICAM(7)=%d stereo=%d %s O_1=%d O_0=%d 2nd car=%d 1st car=%d\n",
+ status_hi & 1, (status_lo >> 7) & 1, (status_lo >> 6) & 1,
+ (status_lo >> 5) ? ((status_hi >> 1) & 1 ? "bad NICAM reception"
+ : "NICAM") : ((status_hi >> 1) & 1 ? "bogus"
+ : "ANALOG FM/AM"),
+ (status_lo >> 4) & 1, (status_lo >> 3) & 1,
+ !((status_lo >> 2) & 1), !((status_lo >> 1) & 1));
+
+ GetMSP3430Data(m, RD_DEM, 0x00, 0x7E, &status_hi, &status_lo);
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO,
+ "MSP34xx: standard result=0x%02x%02x\n", status_hi, status_lo);
+ subaddr = 0x0;
+ I2C_WriteRead(&(m->d), &subaddr, 1, data, 2);
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP34xx: control=0x%02x%02x\n",
+ data[1], data[0]);
}
#endif
/* wrapper */
-void InitMSP3430(MSP3430Ptr m)
+void
+InitMSP3430(MSP3430Ptr m)
{
- #if __MSPDEBUG__ > 1
- xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"InitMSP3430(m->connector=%d, m->standard=%d, m->chip_family=%d)\n",
- m->connector, m->standard, m->chip_family);
- #endif
- switch (m->chip_family) {
- case MSPFAMILY_34x0G:
- InitMSP34xxG(m);
- break;
- case MSPFAMILY_34x5G:
- InitMSP34xxG(m);
- break;
- case MSPFAMILY_34x5D:
- InitMSP34x5D(m);
- break;
- }
+#if __MSPDEBUG__ > 1
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO,
+ "InitMSP3430(m->connector=%d, m->standard=%d, m->chip_family=%d)\n",
+ m->connector, m->standard, m->chip_family);
+#endif
+ switch (m->chip_family) {
+ case MSPFAMILY_34x0G:
+ InitMSP34xxG(m);
+ break;
+ case MSPFAMILY_34x5G:
+ InitMSP34xxG(m);
+ break;
+ case MSPFAMILY_34x5D:
+ InitMSP34x5D(m);
+ break;
+ }
}
/*-----------------------------------------------------------------
| common functions for all MSP34xx chips
|----------------------------------------------------------------*/
-MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
+MSP3430Ptr
+DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
{
- MSP3430Ptr m;
- I2CByte a;
- CARD8 hardware_version, major_revision, product_code, rom_version;
- Bool supported;
-
- m = calloc(1,sizeof(MSP3430Rec));
- if(m == NULL)return NULL;
- m->d.DevName = strdup("MSP34xx");
- m->d.SlaveAddr = addr;
- m->d.pI2CBus = b;
- m->d.NextDev = NULL;
- m->d.StartTimeout = b->StartTimeout;
- m->d.BitTimeout = b->BitTimeout;
- m->d.AcknTimeout = b->AcknTimeout;
- m->d.ByteTimeout = b->ByteTimeout;
-
- if(!I2C_WriteRead(&(m->d), NULL, 0, &a, 1))
- {
- free(m->d.DevName);
- free(m);
- return NULL;
+ MSP3430Ptr m;
+ I2CByte a;
+ CARD8 hardware_version, major_revision, product_code, rom_version;
+ Bool supported;
+
+ m = calloc(1, sizeof(MSP3430Rec));
+ if (m == NULL)
+ return NULL;
+ m->d.DevName = strdup("MSP34xx");
+ m->d.SlaveAddr = addr;
+ m->d.pI2CBus = b;
+ m->d.NextDev = NULL;
+ m->d.StartTimeout = b->StartTimeout;
+ m->d.BitTimeout = b->BitTimeout;
+ m->d.AcknTimeout = b->AcknTimeout;
+ m->d.ByteTimeout = b->ByteTimeout;
+
+ if (!I2C_WriteRead(&(m->d), NULL, 0, &a, 1)) {
+ free(m->d.DevName);
+ free(m);
+ return NULL;
+ }
+
+ m->standard = MSP3430_NTSC;
+ m->connector = MSP3430_CONNECTOR_1;
+ m->mode = MSPMODE_STEREO_A; /*stereo or chanel A if avail. */
+ m->c_format = MSPFORMAT_UNKNOWN;
+ m->c_standard = MSPSTANDARD_UNKNOWN;
+ m->c_matrix = m->c_fmmatrix = m->c_source = 0;
+ m->volume = 0;
+ m->recheck = FALSE;
+
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x1E, &hardware_version, &major_revision);
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x1F, &product_code, &rom_version);
+ m->hardware_version = hardware_version;
+ m->major_revision = major_revision;
+ m->product_code = product_code;
+ m->rom_version = rom_version;
+
+ m->chip_id = ((major_revision << 8) | product_code);
+
+ supported = FALSE;
+ switch (major_revision) {
+ case 4: /* 34xxD */
+ switch (product_code) {
+ case 0x05: /* 3405D */
+ case 0x0A: /* 3410D */
+ case 0x0F: /* 3415D */
+ m->chip_family = MSPFAMILY_34x5D;
+ m->recheck = TRUE;
+ supported = TRUE;
+ break;
+ default:
+ m->chip_family = MSPFAMILY_34x0D;
+ }
+ break;
+ case 7: /* 34xxG */
+ switch (product_code) {
+ case 0x00:
+ case 0x0A:
+ case 0x1E:
+ case 0x28:
+ case 0x32:
+ m->chip_family = MSPFAMILY_34x0G;
+ supported = TRUE;
+ break;
+ case 0x0f:
+ case 0x19:
+ case 0x2d:
+ case 0x37:
+ case 0x41:
+ m->chip_family = MSPFAMILY_34x5G;
+ supported = TRUE;
+#ifdef MSP_DEBUG
+ memset(m->registers_present, 0, 256);
+#define A(num) m->registers_present[(num)]=1;
+#define B(num1, num2) memset(&(m->registers_present[num1]), 1, num2-num1);
+ A(0x20)
+ A(0x30)
+ A(0x40)
+ A(0x00)
+ B(0x01, 0x08)
+ B(0x0B, 0x0E)
+ A(0x10)
+ B(0x12, 0x14)
+ A(0x16)
+ A(0x29)
+#undef B
+#undef A
+#endif
+ break;
+ default:
+ m->chip_family = MSPFAMILY_UNKNOWN;
+ }
+ break;
+ default:
+ m->chip_family = MSPFAMILY_UNKNOWN;
}
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO,
+ "Found %s%s, rom version 0x%02x, chip_id=0x%04x\n",
+ MSP_getProductName(m->chip_id),
+ supported ? "" : " (unsupported)", rom_version, m->chip_id);
- m->standard=MSP3430_NTSC;
- m->connector=MSP3430_CONNECTOR_1;
- m->mode=MSPMODE_STEREO_A; /*stereo or chanel A if avail. */
- m->c_format=MSPFORMAT_UNKNOWN;
- m->c_standard=MSPSTANDARD_UNKNOWN;
- m->c_matrix=m->c_fmmatrix=m->c_source=0;
- m->volume=0;
- m->recheck=FALSE;
-
- GetMSP3430Data(m, RD_DSP, 0x00, 0x1E, &hardware_version, &major_revision);
- GetMSP3430Data(m, RD_DSP, 0x00, 0x1F, &product_code, &rom_version);
- m->hardware_version=hardware_version;
- m->major_revision=major_revision;
- m->product_code=product_code;
- m->rom_version=rom_version;
-
- m->chip_id=((major_revision << 8) | product_code);
-
- supported=FALSE;
- switch (major_revision) {
- case 4: /* 34xxD */
- switch (product_code) {
- case 0x05: /* 3405D */
- case 0x0A: /* 3410D */
- case 0x0F: /* 3415D */
- m->chip_family=MSPFAMILY_34x5D;
- m->recheck=TRUE;
- supported=TRUE;
- break;
- default:
- m->chip_family=MSPFAMILY_34x0D;
- }
- break;
- case 7: /* 34xxG */
- switch(product_code){
- case 0x00:
- case 0x0A:
- case 0x1E:
- case 0x28:
- case 0x32:
- m->chip_family=MSPFAMILY_34x0G;
- supported=TRUE;
- break;
- case 0x0f:
- case 0x19:
- case 0x2d:
- case 0x37:
- case 0x41:
- m->chip_family=MSPFAMILY_34x5G;
- supported=TRUE;
- #ifdef MSP_DEBUG
- memset(m->registers_present, 0, 256);
- #define A(num) m->registers_present[(num)]=1;
- #define B(num1, num2) memset(&(m->registers_present[num1]), 1, num2-num1);
- A(0x20)
- A(0x30)
- A(0x40)
- A(0x00)
- B(0x01, 0x08)
- B(0x0B, 0x0E)
- A(0x10)
- B(0x12,0x14)
- A(0x16)
- A(0x29)
- #undef B
- #undef A
- #endif
- break;
- default:
- m->chip_family=MSPFAMILY_UNKNOWN;
- }
- break;
- default:
- m->chip_family=MSPFAMILY_UNKNOWN;
- }
-
- xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "Found %s%s, rom version 0x%02x, chip_id=0x%04x\n",
- MSP_getProductName(m->chip_id), supported?"":" (unsupported)", rom_version, m->chip_id);
-
- if (!supported) {
- free(m->d.DevName);
- free(m);
- return NULL;
- }
- if(!I2CDevInit(&(m->d)))
- {
- free(m->d.DevName);
- free(m);
- return NULL;
- }
-
- return m;
+ if (!supported) {
+ free(m->d.DevName);
+ free(m);
+ return NULL;
+ }
+ if (!I2CDevInit(&(m->d))) {
+ free(m->d.DevName);
+ free(m);
+ return NULL;
+ }
+
+ return m;
}
-void ResetMSP3430(MSP3430Ptr m)
+void
+ResetMSP3430(MSP3430Ptr m)
{
/* Reset the MSP3430 */
SetMSP3430Control(m, 0x00, 0x80, 0x00);
/* Set it back to normal operation */
SetMSP3430Control(m, 0x00, 0x00, 0x00);
- m->c_format=MSPFORMAT_UNKNOWN;
- m->c_standard=MSPSTANDARD_UNKNOWN;
- m->c_matrix=m->c_fmmatrix=m->c_source=0;
- m->volume=0;
-}
+ m->c_format = MSPFORMAT_UNKNOWN;
+ m->c_standard = MSPSTANDARD_UNKNOWN;
+ m->c_matrix = m->c_fmmatrix = m->c_source = 0;
+ m->volume = 0;
+}
-void MSP3430SetVolume (MSP3430Ptr m, CARD8 value)
+void
+MSP3430SetVolume(MSP3430Ptr m, CARD8 value)
{
CARD8 result;
+
#if 0
CARD8 old_volume;
- GetMSP3430Data(m, RD_DSP, 0x00, 0x00, &old_volume, &result);
- xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP3430 result 0x%02x\n", result);
+
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x00, &old_volume, &result);
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP3430 result 0x%02x\n",
+ result);
#endif
/* save an extra Get call */
- result=0;
+ result = 0;
SetMSP3430Data(m, WR_DSP, 0x00, 0x00, value, result);
SetMSP3430Data(m, WR_DSP, 0x00, 0x07, value, 0);
- m->volume=value;
+ m->volume = value;
#if __MSPDEBUG__ > 2
- MSP3430DumpStatus(m);
- __MSPBEEP
- GetMSP3430Data(m, RD_DSP, 0x00, 0x00, &old_volume, &result);
- xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP3430 volume 0x%02x\n",value);
+ MSP3430DumpStatus(m);
+ __MSPBEEP GetMSP3430Data(m, RD_DSP, 0x00, 0x00, &old_volume, &result);
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP3430 volume 0x%02x\n",
+ value);
#endif
}
-
-void MSP3430SetSAP (MSP3430Ptr m, int mode)
+void
+MSP3430SetSAP(MSP3430Ptr m, int mode)
{
- xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "Put actual code to change SAP here\n");
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO,
+ "Put actual code to change SAP here\n");
- SetMSP3430Data(m, WR_DSP, 0x00, 0x08, mode & 0xff, 0x20);
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x08, mode & 0xff, 0x20);
}
-
#if 0
-void MSP3430SetSource(MSP3430Ptr m, CARD8 value)
+void
+MSP3430SetSource(MSP3430Ptr m, CARD8 value)
{
/* Write to DSP, register 0x0008, (loudspeaker channel source/matrix) */
/* This sets the source to the TV tuner, for stereo operation */
@@ -304,121 +324,142 @@ void MSP3430SetSource(MSP3430Ptr m, CARD8 value)
}
#endif
-
static const char *
-MSP_getProductName (CARD16 product_id)
+MSP_getProductName(CARD16 product_id)
{
- switch (product_id) {
- case 0x0400: return "MSP3400D";
- case 0x040a: return "MSP3410D";
- case 0x0405: return "MSP3405D";
- case 0x040f: return "MSP3415D";
- case 0x0700: return "MSP3400G";
- case 0x070a: return "MSP3410G";
- case 0x071e: return "MSP3430G";
- case 0x0728: return "MSP3440G";
- case 0x0732: return "MSP3450G";
- case 0x070f: return "MSP3415G";
- case 0x0719: return "MSP3425G";
- case 0x072d: return "MSP3445G";
- case 0x0737: return "MSP3455G";
- case 0x0741: return "MSP3465G";
- }
- return "MSP - unknown type";
+ switch (product_id) {
+ case 0x0400:
+ return "MSP3400D";
+ case 0x040a:
+ return "MSP3410D";
+ case 0x0405:
+ return "MSP3405D";
+ case 0x040f:
+ return "MSP3415D";
+ case 0x0700:
+ return "MSP3400G";
+ case 0x070a:
+ return "MSP3410G";
+ case 0x071e:
+ return "MSP3430G";
+ case 0x0728:
+ return "MSP3440G";
+ case 0x0732:
+ return "MSP3450G";
+ case 0x070f:
+ return "MSP3415G";
+ case 0x0719:
+ return "MSP3425G";
+ case 0x072d:
+ return "MSP3445G";
+ case 0x0737:
+ return "MSP3455G";
+ case 0x0741:
+ return "MSP3465G";
+ }
+ return "MSP - unknown type";
}
#if __MSPDEBUG__ > 2
/*puts beep in MSP output
freq = 0x01 - 16Hz ... 0x40 - 1kHz ... 0xff - 4kHz
*/
-void MSPBeep(MSP3430Ptr m, CARD8 freq) {
- SetMSP3430Data (m, WR_DSP, 0x00, freq, 0x7f, 0x40);
+void
+MSPBeep(MSP3430Ptr m, CARD8 freq)
+{
+ SetMSP3430Data(m, WR_DSP, 0x00, freq, 0x7f, 0x40);
mpause(100);
- SetMSP3430Data (m, WR_DSP, 0x00, 0x14, 0x00, 0x00);
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x14, 0x00, 0x00);
}
#endif
-void mpause(int milliseconds) {
- int i,m;
- m=milliseconds/20;
- for (i=0;i<m;i++) usleep(20000);
+void
+mpause(int milliseconds)
+{
+ int i, m;
+
+ m = milliseconds / 20;
+ for (i = 0; i < m; i++)
+ usleep(20000);
}
/*-----------------------------------------------------------------
| specific functions for all MSP34xxG chips
|----------------------------------------------------------------*/
-void InitMSP34xxG(MSP3430Ptr m)
+void
+InitMSP34xxG(MSP3430Ptr m)
{
- #if __MSPDEBUG__ > 1
- xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"InitMSP34xxG(m->connector=%d, m->standard=%d, m->chip_family=%d)\n",
- m->connector, m->standard, m->chip_family);
- #endif
- /* Reset MSP3430 */
- SetMSP3430Control(m, 0x00, 0x80, 0x00);
- /* Set it back to normal operation */
- SetMSP3430Control(m, 0x00, 0x00, 0x00);
-
- /*set MODUS register */
- /* bits: 0 - automatic sound detection */
- /* 1 - enable STATUS change */
- /* 12 - detect 6.5 Mhz carrier as D/K1, D/K2 or D/K NICAM (does not seem to work ) */
- /* 13 - detect 4.5 Mhz carrier as BTSC */
- if ( (m->standard & 0xff) == MSP3430_PAL )
- {
- SetMSP3430Data(m, WR_DEM, 0x00, 0x30, 0x30, 0x03|0x08); /* make O_ pins tristate */
- /* PAL standard */
- SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x01); /* possibly wrong */
- } else {
- SetMSP3430Data(m, WR_DEM, 0x00, 0x30, 0x20, 0x03|0x08);
- /* standard selection is M-BTSC-Stereo */
- SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x20);
- }
-
- switch(m->connector){
- case MSP3430_CONNECTOR_1:
- SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x03, 0x20);
- break;
- case MSP3430_CONNECTOR_2:
- /* this has not been checked yet.. could be bogus */
- /* SCART Input Prescale: 0 dB gain */
- SetMSP3430Data(m, WR_DSP, 0x00, 0x0d, 0x19, 0x00);
- SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x02, 0x20);
- break;
- case MSP3430_CONNECTOR_3:
- default:
- /* SCART Input Prescale: 0 dB gain */
- SetMSP3430Data(m, WR_DSP, 0x00, 0x0d, 0x19, 0x00);
-
- SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x02, 0x20);
- break;
- }
-
- switch(m->standard){
- case MSP3430_PAL:
- SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03);
- SetMSP3430Data(m, WR_DSP, 0x00, 0x10, 0x00, 0x5a);
- SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x03);
- /* Set volume to FAST_MUTE. */
- SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);
- break;
- case MSP3430_PAL_DK1:
- SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03);
- SetMSP3430Data(m, WR_DSP, 0x00, 0x10, 0x00, 0x5a);
- SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x04);
- /* Set volume to FAST_MUTE. */
- SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);
- break;
- case MSP3430_SECAM: /* is this right ? */
- case MSP3430_NTSC:
- /* Write to DSP, register 0x000E, (prescale FM/FM matrix) */
- SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03);
-
- /* Set volume to FAST_MUTE. */
- SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);
- break;
- }
+#if __MSPDEBUG__ > 1
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO,
+ "InitMSP34xxG(m->connector=%d, m->standard=%d, m->chip_family=%d)\n",
+ m->connector, m->standard, m->chip_family);
+#endif
+ /* Reset MSP3430 */
+ SetMSP3430Control(m, 0x00, 0x80, 0x00);
+ /* Set it back to normal operation */
+ SetMSP3430Control(m, 0x00, 0x00, 0x00);
+
+ /*set MODUS register */
+ /* bits: 0 - automatic sound detection */
+ /* 1 - enable STATUS change */
+ /* 12 - detect 6.5 Mhz carrier as D/K1, D/K2 or D/K NICAM (does not seem to work ) */
+ /* 13 - detect 4.5 Mhz carrier as BTSC */
+ if ((m->standard & 0xff) == MSP3430_PAL) {
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x30, 0x30, 0x03 | 0x08); /* make O_ pins tristate */
+ /* PAL standard */
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x01); /* possibly wrong */
+ }
+ else {
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x30, 0x20, 0x03 | 0x08);
+ /* standard selection is M-BTSC-Stereo */
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x20);
+ }
+
+ switch (m->connector) {
+ case MSP3430_CONNECTOR_1:
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x03, 0x20);
+ break;
+ case MSP3430_CONNECTOR_2:
+ /* this has not been checked yet.. could be bogus */
+ /* SCART Input Prescale: 0 dB gain */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0d, 0x19, 0x00);
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x02, 0x20);
+ break;
+ case MSP3430_CONNECTOR_3:
+ default:
+ /* SCART Input Prescale: 0 dB gain */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0d, 0x19, 0x00);
+
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x02, 0x20);
+ break;
+ }
+
+ switch (m->standard) {
+ case MSP3430_PAL:
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03);
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x10, 0x00, 0x5a);
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x03);
+ /* Set volume to FAST_MUTE. */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);
+ break;
+ case MSP3430_PAL_DK1:
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03);
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x10, 0x00, 0x5a);
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x04);
+ /* Set volume to FAST_MUTE. */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);
+ break;
+ case MSP3430_SECAM: /* is this right ? */
+ case MSP3430_NTSC:
+ /* Write to DSP, register 0x000E, (prescale FM/FM matrix) */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03);
+
+ /* Set volume to FAST_MUTE. */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);
+ break;
+ }
}
@@ -426,41 +467,40 @@ void InitMSP34xxG(MSP3430Ptr m)
| specific functions for all MSP34x5D chips
|----------------------------------------------------------------*/
-void InitMSP34x5D(MSP3430Ptr m)
+void
+InitMSP34x5D(MSP3430Ptr m)
{
-int count;
-CARD8 high,low;
-CARD16 result,standard;
-CARD16 peak;
-
-
-if (m->c_format==MSPFORMAT_UNKNOWN) ResetMSP3430(m);
-else {
- /*mute volume*/
- SetMSP3430Data (m, WR_DSP, 0x00, 0x00, 0x00, 0x00);
-}
-
-
+ int count;
+ CARD8 high, low;
+ CARD16 result, standard;
+ CARD16 peak;
+
+ if (m->c_format == MSPFORMAT_UNKNOWN)
+ ResetMSP3430(m);
+ else {
+ /*mute volume */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0x00, 0x00);
+ }
- switch(m->connector){
- case MSP3430_CONNECTOR_2:
- case MSP3430_CONNECTOR_3:
- if (m->c_format!=MSPFORMAT_SCART) {
- /* SCART Input Prescale: 0 dB gain */
- SetMSP3430Data (m, WR_DSP, 0x00, 0x0d, 0x19, 0x00);
- /* this has not been checked yet.. could be bogus */
- m->c_format=MSPFORMAT_SCART; /*stereo*/
- }
- break;
- case MSP3430_CONNECTOR_1:
- default:
-
- switch ( m->standard & 0x00ff ) {
- case MSP3430_PAL:
- switch( m->standard ) {
- case MSP3430_PAL_DK1:
- standard=MSPSTANDARD_FM_DK1;
- break;
+ switch (m->connector) {
+ case MSP3430_CONNECTOR_2:
+ case MSP3430_CONNECTOR_3:
+ if (m->c_format != MSPFORMAT_SCART) {
+ /* SCART Input Prescale: 0 dB gain */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0d, 0x19, 0x00);
+ /* this has not been checked yet.. could be bogus */
+ m->c_format = MSPFORMAT_SCART; /*stereo */
+ }
+ break;
+ case MSP3430_CONNECTOR_1:
+ default:
+
+ switch (m->standard & 0x00ff) {
+ case MSP3430_PAL:
+ switch (m->standard) {
+ case MSP3430_PAL_DK1:
+ standard = MSPSTANDARD_FM_DK1;
+ break;
/* case MSP3430_PAL_DK2:
standard=MSPSTANDARD_FM_DK2;
break;
@@ -469,259 +509,271 @@ else {
standard=MSPSTANDARD_AUTO;
break;
*/
- default:
- standard=MSPSTANDARD_AUTO;
- }
- break;
- case MSP3430_SECAM:
- standard=MSPSTANDARD_AUTO;
- case MSP3430_NTSC:
- /* Only MSP34x5 supported format - Korean NTSC-M*/
- standard=MSPSTANDARD_FM_M;
- default:
- standard=MSPSTANDARD_AUTO;
- }
-
- /*no NICAM support in MSP3410D - force to autodetect*/
- if ((m->chip_id==0x405) && (standard>=MSPSTANDARD_NICAM_BG))
- standard=MSPSTANDARD_AUTO;
-
- if (m->c_standard != standard) {
-
- SetMSP3430Data (m, WR_DEM, 0x00, 0x20, standard>>8, standard & 0xFF);
- if (standard==MSPSTANDARD_AUTO) {
- count = 50; /* time shouldn't exceed 1s, just in case */
- do {
- usleep(20000);
- GetMSP3430Data (m, RD_DEM, 0x00, 0x7e, &high, &low);
- result = ( high << 8 ) | low;
- --count;
- } while( result > 0x07ff && count > 0 );
-
- if ((result > MSPSTANDARD_AUTO))
- standard=result;
- else standard=MSPSTANDARD_UNKNOWN;
+ default:
+ standard = MSPSTANDARD_AUTO;
+ }
+ break;
+ case MSP3430_SECAM:
+ standard = MSPSTANDARD_AUTO;
+ case MSP3430_NTSC:
+ /* Only MSP34x5 supported format - Korean NTSC-M */
+ standard = MSPSTANDARD_FM_M;
+ default:
+ standard = MSPSTANDARD_AUTO;
+ }
+
+ /*no NICAM support in MSP3410D - force to autodetect */
+ if ((m->chip_id == 0x405) && (standard >= MSPSTANDARD_NICAM_BG))
+ standard = MSPSTANDARD_AUTO;
+
+ if (m->c_standard != standard) {
+
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x20, standard >> 8,
+ standard & 0xFF);
+ if (standard == MSPSTANDARD_AUTO) {
+ count = 50; /* time shouldn't exceed 1s, just in case */
+ do {
+ usleep(20000);
+ GetMSP3430Data(m, RD_DEM, 0x00, 0x7e, &high, &low);
+ result = (high << 8) | low;
+ --count;
+ } while (result > 0x07ff && count > 0);
+
+ if ((result > MSPSTANDARD_AUTO))
+ standard = result;
+ else
+ standard = MSPSTANDARD_UNKNOWN;
#if __MSPDEBUG__ > 1
- xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"Detected audio standard: %d\n",result);
-#endif
- /* result = MSPSTANDARD_NICAM_L can be one of:
- SECAM_L - MSPSTANDARD_NICAM_L
- D/K1 - MSPSTANDARD_FM_DK1
- D/K2 - MSPSTANDARD_FM_DK2
- D/K-NICAM - MSPSTANDARD_NICAM_DK*/
- if( standard == MSPSTANDARD_NICAM_L ) {
- if ((m->standard & 0x00ff)==MSP3430_PAL) {
- /* force PAL D/K */
- standard=MSPSTANDARD_FM_DK1;
- SetMSP3430Data (m, WR_DEM, 0x00, 0x20, standard>>8, standard & 0xFF);
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO,
+ "Detected audio standard: %d\n", result);
+#endif
+ /* result = MSPSTANDARD_NICAM_L can be one of:
+ SECAM_L - MSPSTANDARD_NICAM_L
+ D/K1 - MSPSTANDARD_FM_DK1
+ D/K2 - MSPSTANDARD_FM_DK2
+ D/K-NICAM - MSPSTANDARD_NICAM_DK */
+ if (standard == MSPSTANDARD_NICAM_L) {
+ if ((m->standard & 0x00ff) == MSP3430_PAL) {
+ /* force PAL D/K */
+ standard = MSPSTANDARD_FM_DK1;
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x20, standard >> 8,
+ standard & 0xFF);
#if __MSPDEBUG__ > 1
- xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO, "Detected 6.5MHz carrier - forced to D/K1 !!!\n" );
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO,
+ "Detected 6.5MHz carrier - forced to D/K1 !!!\n");
#endif
- }
- }
- }
- m->c_standard=standard;
- } /*end - standard changed*/
- else {
- if (standard<MSPSTANDARD_NICAM_BG) {
- /* get old value of ident. mode register*/
- GetMSP3430Data (m, RD_DSP, 0x00, 0x15, &high, &low);
- /* reset Ident-Filter */
- SetMSP3430Data (m, WR_DSP, 0x00, 0x14, 0x00, 0x3F);
- /* put back old value to ident. mode register*/
- SetMSP3430Data (m, WR_DSP, 0x00, 0x14, 0x00, low);
- }
- }
-
- if (standard<=MSPSTANDARD_AUTO) {
- m->c_format=MSPFORMAT_1xFM;
- }
- else if (standard<MSPSTANDARD_NICAM_BG) {
- /* set FM prescale */
- SetMSP3430Data (m, WR_DSP, 0x00, 0x0e, 0x30, 0);
- /* set FM deemphasis*/
- SetMSP3430Data (m, WR_DSP, 0x00, 0x0f, ((standard==MSPSTANDARD_FM_M)?0:1), 0);
-
- /* check if FM2 carrier is present */
- /*turn off FM DC Notch*/
- SetMSP3430Data (m, WR_DSP, 0x00, 0x17, 0x00, 0x3f);
- /*matrix source for Quasi-Peak Detector - stereo: ch2->L ch1->R*/
- SetMSP3430Data (m, WR_DSP, 0x00, 0x0c, 0x00, 0x20);
-
- mpause(250);
- GetMSP3430Data (m, RD_DSP, 0x00, 0x1A, &high, &low);
- peak = (high << 8) | low;
+ }
+ }
+ }
+ m->c_standard = standard;
+ } /*end - standard changed */
+ else {
+ if (standard < MSPSTANDARD_NICAM_BG) {
+ /* get old value of ident. mode register */
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x15, &high, &low);
+ /* reset Ident-Filter */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x14, 0x00, 0x3F);
+ /* put back old value to ident. mode register */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x14, 0x00, low);
+ }
+ }
+
+ if (standard <= MSPSTANDARD_AUTO) {
+ m->c_format = MSPFORMAT_1xFM;
+ }
+ else if (standard < MSPSTANDARD_NICAM_BG) {
+ /* set FM prescale */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x30, 0);
+ /* set FM deemphasis */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0f,
+ ((standard == MSPSTANDARD_FM_M) ? 0 : 1), 0);
+
+ /* check if FM2 carrier is present */
+ /*turn off FM DC Notch */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x17, 0x00, 0x3f);
+ /*matrix source for Quasi-Peak Detector - stereo: ch2->L ch1->R */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0c, 0x00, 0x20);
+
+ mpause(250);
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x1A, &high, &low);
+ peak = (high << 8) | low;
#if __MSPDEBUG__ > 1
- xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"Second carrier Quasi-Peak detection: %d\n",peak);
-#endif
- /*turn on FM DC Notch*/
- SetMSP3430Data (m, WR_DSP, 0x00, 0x17, 0x00, 0x00);
-
- if (peak<5) {
- /* if second carrier not detected - only mono from first carrier*/
- m->c_format=MSPFORMAT_1xFM;
- }
- else {
- m->c_format=MSPFORMAT_2xFM;
- /*start of FM identification process - FM_WAIT
- wait at least 0.5s - used 1s - gives beter resolution*/
- mpause(1000);
- }
- }
- else {
- if (standard==MSPSTANDARD_NICAM_L) {
- m->c_format=MSPFORMAT_NICAM_AM;
- /* set AM prescale */
- SetMSP3430Data (m, WR_DSP, 0x00, 0x0e, 0x7C, 0);
- }
- else {
- m->c_format=MSPFORMAT_NICAM_FM;
- /* set FM prescale */
- SetMSP3430Data (m, WR_DSP, 0x00, 0x0e, 0x30, 0);
- }
- /* set FM deemphasis*/
- SetMSP3430Data (m, WR_DSP, 0x00, 0x0f, 0x00, 0);
- /* set NICAM prescale to 0dB */
- SetMSP3430Data (m, WR_DSP, 0x00, 0x10, 0x20, 0);
- }
-
- break;
- } /*end - case conector*/
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO,
+ "Second carrier Quasi-Peak detection: %d\n", peak);
+#endif
+ /*turn on FM DC Notch */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x17, 0x00, 0x00);
+
+ if (peak < 5) {
+ /* if second carrier not detected - only mono from first carrier */
+ m->c_format = MSPFORMAT_1xFM;
+ }
+ else {
+ m->c_format = MSPFORMAT_2xFM;
+ /*start of FM identification process - FM_WAIT
+ wait at least 0.5s - used 1s - gives beter resolution */
+ mpause(1000);
+ }
+ }
+ else {
+ if (standard == MSPSTANDARD_NICAM_L) {
+ m->c_format = MSPFORMAT_NICAM_AM;
+ /* set AM prescale */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x7C, 0);
+ }
+ else {
+ m->c_format = MSPFORMAT_NICAM_FM;
+ /* set FM prescale */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x30, 0);
+ }
+ /* set FM deemphasis */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0f, 0x00, 0);
+ /* set NICAM prescale to 0dB */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x10, 0x20, 0);
+ }
+
+ break;
+ } /*end - case conector */
CheckModeMSP34x5D(m);
-
- /* Set volume to FAST_MUTE. */
- /*SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);*/
- /*set volume*/
- MSP3430SetVolume(m,m->volume);
-
- __MSPBEEP
-
-
-} /* EnableMSP34x5D ()... */
-
+ /* Set volume to FAST_MUTE. */
+ /*SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00); */
+ /*set volume */
+ MSP3430SetVolume(m, m->volume);
+__MSPBEEP} /* EnableMSP34x5D ()... */
-void CheckModeMSP34x5D(MSP3430Ptr m) {
- const char stereo_on=25;
- const char stereo_off=20;
- const char dual_on=-stereo_on;
- const char dual_off=-stereo_off;
+void
+CheckModeMSP34x5D(MSP3430Ptr m)
+{
+ const char stereo_on = 25;
+ const char stereo_off = 20;
+ const char dual_on = -stereo_on;
+ const char dual_off = -stereo_off;
char detect;
CARD8 matrix, fmmatrix, source, high, low;
- fmmatrix=0; /*no matrix*/
- source=0; /*FM*/
- switch (m->c_format) {
- case MSPFORMAT_NICAM_FM:
- case MSPFORMAT_NICAM_AM:
- case MSPFORMAT_SCART:
- source=( (m->c_format == MSPFORMAT_SCART)?2:1 );
- switch (m->mode) {
- case MSPMODE_MONO:
- matrix=0x30; /*MONO*/
- break;
- case MSPMODE_A:
- matrix=0x00; /*A*/
- break;
- case MSPMODE_B:
- matrix=0x10; /*B*/
- break;
- default:
- matrix=0x20; /*STEREO*/
- break;
- }
- break;
- default:
- case MSPFORMAT_1xFM:
- matrix=0x00; /*A*/
- break;
- case MSPFORMAT_2xFM:
- switch (m->mode) {
- case MSPMODE_MONO:
- matrix=0x30; /*MONO*/
- break;
- case MSPMODE_STEREO:
- matrix=0x20; /*STEREO*/
- fmmatrix=((m->c_standard==MSPSTANDARD_FM_M)?2:1);
- break;
- case MSPMODE_AB:
- matrix=0x20; /*STEREO*/
- break;
- case MSPMODE_A:
- matrix=0x00; /*A*/
- break;
- case MSPMODE_B:
- matrix=0x10; /*B*/
- break;
- default:
- /*FM_IDENT_CHECK*/
- GetMSP3430Data (m, RD_DSP, 0x00, 0x18, &high, &low);
- detect=(char)high;
+ fmmatrix = 0; /*no matrix */
+ source = 0;
+ /*FM*/ switch (m->c_format) {
+ case MSPFORMAT_NICAM_FM:
+ case MSPFORMAT_NICAM_AM:
+ case MSPFORMAT_SCART:
+ source = ((m->c_format == MSPFORMAT_SCART) ? 2 : 1);
+ switch (m->mode) {
+ case MSPMODE_MONO:
+ matrix = 0x30;
+ /*MONO*/ break;
+ case MSPMODE_A:
+ matrix = 0x00;
+ /*A*/ break;
+ case MSPMODE_B:
+ matrix = 0x10;
+ /*B*/ break;
+ default:
+ matrix = 0x20;
+ /*STEREO*/ break;
+ }
+ break;
+ default:
+ case MSPFORMAT_1xFM:
+ matrix = 0x00;
+ /*A*/ break;
+ case MSPFORMAT_2xFM:
+ switch (m->mode) {
+ case MSPMODE_MONO:
+ matrix = 0x30;
+ /*MONO*/ break;
+ case MSPMODE_STEREO:
+ matrix = 0x20;
+ /*STEREO*/ fmmatrix = ((m->c_standard == MSPSTANDARD_FM_M) ? 2 : 1);
+ break;
+ case MSPMODE_AB:
+ matrix = 0x20;
+ /*STEREO*/ break;
+ case MSPMODE_A:
+ matrix = 0x00;
+ /*A*/ break;
+ case MSPMODE_B:
+ matrix = 0x10;
+ /*B*/ break;
+ default:
+ /*FM_IDENT_CHECK */
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x18, &high, &low);
+ detect = (char) high;
#if __MSPDEBUG__ > 1
- xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"Stereo Detection Register: %d\n",detect);
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO,
+ "Stereo Detection Register: %d\n", detect);
#endif
- if (detect>=((m->c_mode==MSPMODE_STEREO)?stereo_off:stereo_on)) {
- m->c_mode=MSPMODE_STEREO;
- matrix=0x20; /*STEREO*/
- fmmatrix=((m->c_standard==MSPSTANDARD_FM_M)?2:1);
- }
- else if (detect<=((m->c_mode==MSPMODE_AB)?dual_off:dual_on)) {
- m->c_mode=MSPMODE_AB;
- switch (m->mode) {
- case MSPMODE_STEREO_AB: matrix=0x20; break;
- case MSPMODE_STEREO_B: matrix=0x10; break;
- default:
- case MSPMODE_A: matrix=0x00; break;
- }
- }
- else {
- m->c_mode=MSPMODE_MONO;
- matrix=0x30; /*MONO*/
- }
- break;
- } /* end - case mode*/
- break;
+ if (detect >=
+ ((m->c_mode == MSPMODE_STEREO) ? stereo_off : stereo_on)) {
+ m->c_mode = MSPMODE_STEREO;
+ matrix = 0x20;
+ /*STEREO*/
+ fmmatrix = ((m->c_standard == MSPSTANDARD_FM_M) ? 2 : 1);
+ }
+ else if (detect <= ((m->c_mode == MSPMODE_AB) ? dual_off : dual_on)) {
+ m->c_mode = MSPMODE_AB;
+ switch (m->mode) {
+ case MSPMODE_STEREO_AB:
+ matrix = 0x20;
+ break;
+ case MSPMODE_STEREO_B:
+ matrix = 0x10;
+ break;
+ default:
+ case MSPMODE_A:
+ matrix = 0x00;
+ break;
+ }
+ }
+ else {
+ m->c_mode = MSPMODE_MONO;
+ matrix = 0x30;
+ /*MONO*/}
+ break;
+ } /* end - case mode */
+ break;
}
if (m->c_fmmatrix != fmmatrix) {
- GetMSP3430Data (m, RD_DSP, 0x00, 0x0e, &high, &low);
- SetMSP3430Data (m, WR_DSP, 0x00, 0x0e, high, fmmatrix);
- m->c_fmmatrix = fmmatrix;
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x0e, &high, &low);
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, high, fmmatrix);
+ m->c_fmmatrix = fmmatrix;
}
if ((m->c_matrix != matrix) || (m->c_source != source)) {
- /*set chanel source and matrix for loudspeaker*/
- SetMSP3430Data (m, WR_DSP, 0x00, 0x08, source, matrix);
-
- m->c_matrix = matrix;
- m->c_source = source;
+ /*set chanel source and matrix for loudspeaker */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x08, source, matrix);
+
+ m->c_matrix = matrix;
+ m->c_source = source;
}
- if ( ((m->c_format) & 0xF0) == MSPFORMAT_NICAM)
- SetMSP3430Data (m, WR_DEM, 0x00, 0x21, 0, 1);
+ if (((m->c_format) & 0xF0) == MSPFORMAT_NICAM)
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x21, 0, 1);
#if __MSPDEBUG__ > 0
- char *msg;
- switch (matrix) {
- case 0x30: /*MONO*/
- msg="MONO";
- break;
- case 0x00: /*LEFT*/
- msg="MONO/CHANNEL_1";
- break;
- case 0x10: /*RIGHT*/
- msg="MONO/CHANNEL_2";
- break;
- case 0x20: /*LEFT*/
- msg="STEREO";
- break;
- default:
- msg="unknown";
- break;
- }
- xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"Audio mode set to: %s\n",msg);
+ char *msg;
+
+ switch (matrix) {
+ case 0x30:
+ /*MONO*/ msg = "MONO";
+ break;
+ case 0x00:
+ /*LEFT*/ msg = "MONO/CHANNEL_1";
+ break;
+ case 0x10:
+ /*RIGHT*/ msg = "MONO/CHANNEL_2";
+ break;
+ case 0x20:
+ /*LEFT*/ msg = "STEREO";
+ break;
+ default:
+ msg = "unknown";
+ break;
+ }
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "Audio mode set to: %s\n", msg);
#endif
}
-
diff --git a/xorg-server/hw/xfree86/i2c/msp3430_module.c b/xorg-server/hw/xfree86/i2c/msp3430_module.c
index c5c24635f..e177efe7f 100644
--- a/xorg-server/hw/xfree86/i2c/msp3430_module.c
+++ b/xorg-server/hw/xfree86/i2c/msp3430_module.c
@@ -1,25 +1,24 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static XF86ModuleVersionInfo msp3430VersRec =
-{
- "msp3430",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData msp3430ModuleData = {
- &msp3430VersRec,
- NULL,
- NULL
-};
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo msp3430VersRec = {
+ "msp3430",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData msp3430ModuleData = {
+ &msp3430VersRec,
+ NULL,
+ NULL
+};
diff --git a/xorg-server/hw/xfree86/i2c/tda8425.c b/xorg-server/hw/xfree86/i2c/tda8425.c
index abbbb2a03..051249b8a 100644
--- a/xorg-server/hw/xfree86/i2c/tda8425.c
+++ b/xorg-server/hw/xfree86/i2c/tda8425.c
@@ -1,78 +1,83 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86i2c.h"
-#include "tda8425.h"
-#include "i2c_def.h"
-
-#define TDA8425(a,b) { \
- data[0]=a; \
- data[1]=b; \
- I2C_WriteRead(&(t->d), data, 2, NULL, 0); \
- }
-
-TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force)
-{
- TDA8425Ptr t;
-
- t = calloc(1, sizeof(TDA8425Rec));
- if(t == NULL) return NULL;
- t->d.DevName = "TDA8425 BTSC Stereo Audio Processor";
- t->d.SlaveAddr = addr;
- t->d.pI2CBus = b;
- t->d.NextDev = NULL;
- t->d.StartTimeout = b->StartTimeout;
- t->d.BitTimeout = b->BitTimeout;
- t->d.AcknTimeout = b->AcknTimeout;
- t->d.ByteTimeout = b->ByteTimeout;
-
- if(!force && !I2CProbeAddress(b, addr))
- {
- free(t);
- return NULL;
- }
-
- /* set default parameters */
- if(!I2CDevInit(&(t->d)))
- {
- free(t);
- return NULL;
- }
-
- return t;
-}
-
-Bool tda8425_init(TDA8425Ptr t)
-{
- t->stereo = 3; /* 3 = Spacial 2 = Linear 1 = Pseudo 0 = Forced mono */
- t->v_left = 0xFF; /* FF - C0 */
- t->v_right = 0xFF; /* FF - C0 */
- t->bass = 0xF6; /* 0xFF - 0xF0 */
- t->treble = 0xF6; /* 0xFF - 0xF0 */
- t->src_sel = 3; /* 3 - stereo */
- t->mute = TRUE;
- t->mux = 0; /* 0 - source one, 1 -source 2 */
-
- tda8425_setaudio(t);
- return TRUE;
-}
-
-void tda8425_setaudio(TDA8425Ptr t)
-{
- I2CByte data[2];
-
- TDA8425(0x00, t->v_left );
- TDA8425(0x01, t->v_right );
- TDA8425(0x02, t->bass );
- TDA8425(0x03, t->treble );
- TDA8425(0x08, 0xC0 | (t->mute ? 0x20 : 0x0) | (t->stereo << 3) | (t->src_sel << 1) |
- t->mux);
-}
-
-void tda8425_mute(TDA8425Ptr t, Bool mute)
-{
- t->mute = mute;
- tda8425_setaudio(t);
-}
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "tda8425.h"
+#include "i2c_def.h"
+
+#define TDA8425(a,b) { \
+ data[0]=a; \
+ data[1]=b; \
+ I2C_WriteRead(&(t->d), data, 2, NULL, 0); \
+ }
+
+TDA8425Ptr
+Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force)
+{
+ TDA8425Ptr t;
+
+ t = calloc(1, sizeof(TDA8425Rec));
+ if (t == NULL)
+ return NULL;
+ t->d.DevName = "TDA8425 BTSC Stereo Audio Processor";
+ t->d.SlaveAddr = addr;
+ t->d.pI2CBus = b;
+ t->d.NextDev = NULL;
+ t->d.StartTimeout = b->StartTimeout;
+ t->d.BitTimeout = b->BitTimeout;
+ t->d.AcknTimeout = b->AcknTimeout;
+ t->d.ByteTimeout = b->ByteTimeout;
+
+ if (!force && !I2CProbeAddress(b, addr)) {
+ free(t);
+ return NULL;
+ }
+
+ /* set default parameters */
+ if (!I2CDevInit(&(t->d))) {
+ free(t);
+ return NULL;
+ }
+
+ return t;
+}
+
+Bool
+tda8425_init(TDA8425Ptr t)
+{
+ t->stereo = 3; /* 3 = Spacial 2 = Linear 1 = Pseudo 0 = Forced mono */
+ t->v_left = 0xFF; /* FF - C0 */
+ t->v_right = 0xFF; /* FF - C0 */
+ t->bass = 0xF6; /* 0xFF - 0xF0 */
+ t->treble = 0xF6; /* 0xFF - 0xF0 */
+ t->src_sel = 3; /* 3 - stereo */
+ t->mute = TRUE;
+ t->mux = 0; /* 0 - source one, 1 -source 2 */
+
+ tda8425_setaudio(t);
+ return TRUE;
+}
+
+void
+tda8425_setaudio(TDA8425Ptr t)
+{
+ I2CByte data[2];
+
+ TDA8425(0x00, t->v_left);
+ TDA8425(0x01, t->v_right);
+ TDA8425(0x02, t->bass);
+ TDA8425(0x03, t->treble);
+ TDA8425(0x08,
+ 0xC0 | (t->mute ? 0x20 : 0x0) | (t->stereo << 3) | (t->
+ src_sel << 1) |
+ t->mux);
+}
+
+void
+tda8425_mute(TDA8425Ptr t, Bool mute)
+{
+ t->mute = mute;
+ tda8425_setaudio(t);
+}
diff --git a/xorg-server/hw/xfree86/i2c/tda8425.h b/xorg-server/hw/xfree86/i2c/tda8425.h
index 9c33e7f60..e3dfb1384 100644
--- a/xorg-server/hw/xfree86/i2c/tda8425.h
+++ b/xorg-server/hw/xfree86/i2c/tda8425.h
@@ -4,17 +4,17 @@
#include "xf86i2c.h"
typedef struct {
- I2CDevRec d;
-
- int mux;
- int stereo;
- int v_left;
- int v_right;
- int bass;
- int treble;
- int src_sel;
- Bool mute;
- } TDA8425Rec, *TDA8425Ptr;
+ I2CDevRec d;
+
+ int mux;
+ int stereo;
+ int v_left;
+ int v_right;
+ int bass;
+ int treble;
+ int src_sel;
+ Bool mute;
+} TDA8425Rec, *TDA8425Ptr;
#define TDA8425_ADDR_1 0x82
@@ -22,13 +22,16 @@ typedef struct {
This is because tda8425 is write-only and complete implementation
of I2C protocol is not always available. Besides address there is no good
way to autodetect it so we have to _know_ it is there anyway */
-
+
#define xf86_Detect_tda8425 Detect_tda8425
-extern _X_EXPORT TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr,Bool force);
+extern _X_EXPORT TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr,
+ Bool force);
#define xf86_tda8425_init tda8425_init
extern _X_EXPORT Bool tda8425_init(TDA8425Ptr t);
+
#define xf86_tda8425_setaudio tda8425_setaudio
extern _X_EXPORT void tda8425_setaudio(TDA8425Ptr t);
+
#define xf86_tda8425_mute tda8425_mute
extern _X_EXPORT void tda8425_mute(TDA8425Ptr t, Bool mute);
diff --git a/xorg-server/hw/xfree86/i2c/tda8425_module.c b/xorg-server/hw/xfree86/i2c/tda8425_module.c
index 936281460..74c820f73 100644
--- a/xorg-server/hw/xfree86/i2c/tda8425_module.c
+++ b/xorg-server/hw/xfree86/i2c/tda8425_module.c
@@ -1,25 +1,24 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static XF86ModuleVersionInfo tda8425VersRec =
-{
- "tda8425",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData tda8425ModuleData = {
- &tda8425VersRec,
- NULL,
- NULL
-};
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo tda8425VersRec = {
+ "tda8425",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData tda8425ModuleData = {
+ &tda8425VersRec,
+ NULL,
+ NULL
+};
diff --git a/xorg-server/hw/xfree86/i2c/tda9850.c b/xorg-server/hw/xfree86/i2c/tda9850.c
index 5d794dfe5..c2ce6971f 100644
--- a/xorg-server/hw/xfree86/i2c/tda9850.c
+++ b/xorg-server/hw/xfree86/i2c/tda9850.c
@@ -1,112 +1,136 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86i2c.h"
-#include "tda9850.h"
-#include "i2c_def.h"
-
-#define TDA9850(a,b) { \
- data[0]=a; \
- data[1]=b; \
- I2C_WriteRead(&(t->d), data, 2, NULL, 0); \
- }
-
-TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr)
-{
- TDA9850Ptr t;
- I2CByte a;
-
- t = calloc(1, sizeof(TDA9850Rec));
- if(t == NULL) return NULL;
- switch(addr)
- {
- case TDA9850_ADDR_1:
- t->d.DevName = "TDA9850 BTSC Stereo+SAP Audio Processor";
- break;
- default:
- t->d.DevName = "Generic TDAxxxx";
- break;
- }
- t->d.SlaveAddr = addr;
- t->d.pI2CBus = b;
- t->d.NextDev = NULL;
- t->d.StartTimeout = b->StartTimeout;
- t->d.BitTimeout = b->BitTimeout;
- t->d.AcknTimeout = b->AcknTimeout;
- t->d.ByteTimeout = b->ByteTimeout;
-
- if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
- {
- free(t);
- return NULL;
- }
-
- /* set default parameters */
- if(!I2CDevInit(&(t->d)))
- {
- free(t);
- return NULL;
- }
-
- return t;
-}
-
-Bool tda9850_init(TDA9850Ptr t)
-{
- t->stereo = 1;
- t->sap = 0;
- t->mute = TRUE;
- t->sap_mute = TRUE;
- tda9850_setaudio(t);
- return TRUE;
-}
-
-void tda9850_setaudio(TDA9850Ptr t)
-{
-CARD8 data[2];
-
-if(t->mux==2)
-{
- TDA9850(0x04,0x0F); TDA9850(0x05,0x0F); TDA9850(0x06, 0x58);
- TDA9850(0x07,0x07); TDA9850(0x08,0x00);
- TDA9850(0x09,0x00); TDA9850(0x0A,0x03);
-} else
-{
- TDA9850(0x04,0x07); TDA9850(0x05,0x07);
- TDA9850(0x06,0x58); TDA9850(0x07,0x07);
- TDA9850(0x08,0x10); TDA9850(0x09,0x10);
- TDA9850(0x0A,0x03);
-}
-
-TDA9850(0x06,(t->stereo<<6)|(t->sap<<7)|(t->mute?0x8:0)|(t->sap_mute?0x10:0x0));
-}
-
-void tda9850_mute(TDA9850Ptr t, Bool mute)
-{
-CARD8 data[2];
-
-xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, "tda9850_mute %s\n", mute ? "on" : "off");
-t->mute = mute;
-
-TDA9850(0x06,(t->stereo<<6)|(t->sap<<7)|(t->mute?0x8:0x0)|(t->sap_mute?0x10:0x0));
-}
-
-void tda9850_sap_mute(TDA9850Ptr t, Bool sap_mute)
-{
-CARD8 data[2];
-
-xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, "tda9850_sap_mute %s\n", sap_mute ? "on" : "off");
-t->sap_mute = sap_mute;
-
-TDA9850(0x06,(t->stereo<<6)|(t->sap<<7)|(t->mute?0x8:0x0)|(t->sap_mute?0x10:0x0));
-}
-
-CARD16 tda9850_getstatus(TDA9850Ptr t)
-{
-CARD16 status;
-
-I2C_WriteRead(&(t->d), NULL, 0, (I2CByte *)&status, 2);
-return status;
-}
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "tda9850.h"
+#include "i2c_def.h"
+
+#define TDA9850(a,b) { \
+ data[0]=a; \
+ data[1]=b; \
+ I2C_WriteRead(&(t->d), data, 2, NULL, 0); \
+ }
+
+TDA9850Ptr
+Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ TDA9850Ptr t;
+ I2CByte a;
+
+ t = calloc(1, sizeof(TDA9850Rec));
+ if (t == NULL)
+ return NULL;
+ switch (addr) {
+ case TDA9850_ADDR_1:
+ t->d.DevName = "TDA9850 BTSC Stereo+SAP Audio Processor";
+ break;
+ default:
+ t->d.DevName = "Generic TDAxxxx";
+ break;
+ }
+ t->d.SlaveAddr = addr;
+ t->d.pI2CBus = b;
+ t->d.NextDev = NULL;
+ t->d.StartTimeout = b->StartTimeout;
+ t->d.BitTimeout = b->BitTimeout;
+ t->d.AcknTimeout = b->AcknTimeout;
+ t->d.ByteTimeout = b->ByteTimeout;
+
+ if (!I2C_WriteRead(&(t->d), NULL, 0, &a, 1)) {
+ free(t);
+ return NULL;
+ }
+
+ /* set default parameters */
+ if (!I2CDevInit(&(t->d))) {
+ free(t);
+ return NULL;
+ }
+
+ return t;
+}
+
+Bool
+tda9850_init(TDA9850Ptr t)
+{
+ t->stereo = 1;
+ t->sap = 0;
+ t->mute = TRUE;
+ t->sap_mute = TRUE;
+ tda9850_setaudio(t);
+ return TRUE;
+}
+
+void
+tda9850_setaudio(TDA9850Ptr t)
+{
+ CARD8 data[2];
+
+ if (t->mux == 2) {
+ TDA9850(0x04, 0x0F);
+ TDA9850(0x05, 0x0F);
+ TDA9850(0x06, 0x58);
+ TDA9850(0x07, 0x07);
+ TDA9850(0x08, 0x00);
+ TDA9850(0x09, 0x00);
+ TDA9850(0x0A, 0x03);
+ }
+ else {
+ TDA9850(0x04, 0x07);
+ TDA9850(0x05, 0x07);
+ TDA9850(0x06, 0x58);
+ TDA9850(0x07, 0x07);
+ TDA9850(0x08, 0x10);
+ TDA9850(0x09, 0x10);
+ TDA9850(0x0A, 0x03);
+ }
+
+ TDA9850(0x06,
+ (t->stereo << 6) | (t->sap << 7) | (t->mute ? 0x8 : 0) | (t->
+ sap_mute ?
+ 0x10 :
+ 0x0));
+}
+
+void
+tda9850_mute(TDA9850Ptr t, Bool mute)
+{
+ CARD8 data[2];
+
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, "tda9850_mute %s\n",
+ mute ? "on" : "off");
+ t->mute = mute;
+
+ TDA9850(0x06,
+ (t->stereo << 6) | (t->sap << 7) | (t->mute ? 0x8 : 0x0) | (t->
+ sap_mute
+ ? 0x10 :
+ 0x0));
+}
+
+void
+tda9850_sap_mute(TDA9850Ptr t, Bool sap_mute)
+{
+ CARD8 data[2];
+
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, "tda9850_sap_mute %s\n",
+ sap_mute ? "on" : "off");
+ t->sap_mute = sap_mute;
+
+ TDA9850(0x06,
+ (t->stereo << 6) | (t->sap << 7) | (t->mute ? 0x8 : 0x0) | (t->
+ sap_mute
+ ? 0x10 :
+ 0x0));
+}
+
+CARD16
+tda9850_getstatus(TDA9850Ptr t)
+{
+ CARD16 status;
+
+ I2C_WriteRead(&(t->d), NULL, 0, (I2CByte *) & status, 2);
+ return status;
+}
diff --git a/xorg-server/hw/xfree86/i2c/tda9850_module.c b/xorg-server/hw/xfree86/i2c/tda9850_module.c
index 239cff4fd..197d65a71 100644
--- a/xorg-server/hw/xfree86/i2c/tda9850_module.c
+++ b/xorg-server/hw/xfree86/i2c/tda9850_module.c
@@ -1,25 +1,24 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static XF86ModuleVersionInfo tda9850VersRec =
-{
- "tda9850",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData tda9850ModuleData = {
- &tda9850VersRec,
- NULL,
- NULL
-};
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo tda9850VersRec = {
+ "tda9850",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData tda9850ModuleData = {
+ &tda9850VersRec,
+ NULL,
+ NULL
+};
diff --git a/xorg-server/hw/xfree86/i2c/tda9885.c b/xorg-server/hw/xfree86/i2c/tda9885.c
index f22233995..fd859bde0 100644
--- a/xorg-server/hw/xfree86/i2c/tda9885.c
+++ b/xorg-server/hw/xfree86/i2c/tda9885.c
@@ -1,104 +1,100 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86i2c.h"
-#include "tda9885.h"
-#include "i2c_def.h"
-
-
-TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr)
-{
- TDA9885Ptr t;
- I2CByte a;
-
- t = calloc(1, sizeof(TDA9885Rec));
- if(t == NULL) return NULL;
- switch(addr)
- {
- case TDA9885_ADDR_1:
- case TDA9885_ADDR_2:
- case TDA9885_ADDR_3:
- case TDA9885_ADDR_4:
- t->d.DevName = "TDA9885 Alignment-free IF-PLL";
- break;
- default:
- t->d.DevName = "Generic TDAxxxx";
- break;
- }
- t->d.SlaveAddr = addr;
- t->d.pI2CBus = b;
- t->d.NextDev = NULL;
- t->d.StartTimeout = b->StartTimeout;
- t->d.BitTimeout = b->BitTimeout;
- t->d.AcknTimeout = b->AcknTimeout;
- t->d.ByteTimeout = b->ByteTimeout;
-
- if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
- {
- free(t);
- return NULL;
- }
-
- /* set default parameters */
- if(!I2CDevInit(&(t->d)))
- {
- free(t);
- return NULL;
- }
-
- return t;
-}
-
-Bool tda9885_init(TDA9885Ptr t)
-{
- t->forced_mute_audio=1;
- return TRUE;
-}
-
-void tda9885_getstatus(TDA9885Ptr t)
-{
-CARD8 value;
-
-I2C_WriteRead(&(t->d), NULL, 0, &value, 1);
-t->after_reset=value & 1;
-t->afc_status=(value >> 1) & 0xf;
-t->fm_carrier=(value>>5)& 1;
-t->vif_level=(value >>6) & 1;
-t->afc_win=(value >> 7)&1;
-}
-
-void tda9885_setparameters(TDA9885Ptr t)
-{
-CARD8 data[4];
-
-data[0]=0; /* start with subaddress 0 */
-data[1]=(t->sound_trap & 1) |
- ((t->auto_mute_fm &1)<<1) |
- ((t->carrier_mode &1)<<2) |
- ((t->modulation &3)<<3) |
- ((t->forced_mute_audio &1)<<5) |
- ((t->port1 & 1)<<6) |
- ((t->port2 &1)<<7); /* B data */
-data[2]=(t->top_adjustment & 0x1f) |
- ((t->deemphasis & 0x3)<<5) |
- ((t->audio_gain & 1) << 7); /* C data */
-data[3]=(t->standard_sound_carrier & 0x3) |
- ((t->standard_video_if & 0x07)<<2) |
- ((t->minimum_gain & 0x01)<<5) |
- ((t->gating & 0x01)<<6) |
- ((t->vif_agc & 0x01)<<7); /* E data */
-
-I2C_WriteRead(&(t->d), data, 4, NULL, 0);
-
-xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"TDA9885 setparam: B data: %x, C data: %x, E data: %x\n", data[1], data[2], data[3]);
-}
-
-void tda9885_dumpstatus(TDA9885Ptr t)
-{
-xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"TDA9885 status: after_reset=%d afc_status=%d (%3.1f kHz off) fm_carrier=%d vif_level=%d afc_win=%d %s\n",
- t->after_reset, t->afc_status,
- (t->afc_status<8)?-12.5-t->afc_status*25.0:-12.5+(16-t->afc_status)*25.0,
- t->fm_carrier, t->vif_level, t->afc_win, t->afc_win?"VCO in": "VCO out");
-}
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "tda9885.h"
+#include "i2c_def.h"
+
+TDA9885Ptr
+Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ TDA9885Ptr t;
+ I2CByte a;
+
+ t = calloc(1, sizeof(TDA9885Rec));
+ if (t == NULL)
+ return NULL;
+ switch (addr) {
+ case TDA9885_ADDR_1:
+ case TDA9885_ADDR_2:
+ case TDA9885_ADDR_3:
+ case TDA9885_ADDR_4:
+ t->d.DevName = "TDA9885 Alignment-free IF-PLL";
+ break;
+ default:
+ t->d.DevName = "Generic TDAxxxx";
+ break;
+ }
+ t->d.SlaveAddr = addr;
+ t->d.pI2CBus = b;
+ t->d.NextDev = NULL;
+ t->d.StartTimeout = b->StartTimeout;
+ t->d.BitTimeout = b->BitTimeout;
+ t->d.AcknTimeout = b->AcknTimeout;
+ t->d.ByteTimeout = b->ByteTimeout;
+
+ if (!I2C_WriteRead(&(t->d), NULL, 0, &a, 1)) {
+ free(t);
+ return NULL;
+ }
+
+ /* set default parameters */
+ if (!I2CDevInit(&(t->d))) {
+ free(t);
+ return NULL;
+ }
+
+ return t;
+}
+
+Bool
+tda9885_init(TDA9885Ptr t)
+{
+ t->forced_mute_audio = 1;
+ return TRUE;
+}
+
+void
+tda9885_getstatus(TDA9885Ptr t)
+{
+ CARD8 value;
+
+ I2C_WriteRead(&(t->d), NULL, 0, &value, 1);
+ t->after_reset = value & 1;
+ t->afc_status = (value >> 1) & 0xf;
+ t->fm_carrier = (value >> 5) & 1;
+ t->vif_level = (value >> 6) & 1;
+ t->afc_win = (value >> 7) & 1;
+}
+
+void
+tda9885_setparameters(TDA9885Ptr t)
+{
+ CARD8 data[4];
+
+ data[0] = 0; /* start with subaddress 0 */
+ data[1] = (t->sound_trap & 1) | ((t->auto_mute_fm & 1) << 1) | ((t->carrier_mode & 1) << 2) | ((t->modulation & 3) << 3) | ((t->forced_mute_audio & 1) << 5) | ((t->port1 & 1) << 6) | ((t->port2 & 1) << 7); /* B data */
+ data[2] = (t->top_adjustment & 0x1f) | ((t->deemphasis & 0x3) << 5) | ((t->audio_gain & 1) << 7); /* C data */
+ data[3] = (t->standard_sound_carrier & 0x3) | ((t->standard_video_if & 0x07) << 2) | ((t->minimum_gain & 0x01) << 5) | ((t->gating & 0x01) << 6) | ((t->vif_agc & 0x01) << 7); /* E data */
+
+ I2C_WriteRead(&(t->d), data, 4, NULL, 0);
+
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO,
+ "TDA9885 setparam: B data: %x, C data: %x, E data: %x\n",
+ data[1], data[2], data[3]);
+}
+
+void
+tda9885_dumpstatus(TDA9885Ptr t)
+{
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO,
+ "TDA9885 status: after_reset=%d afc_status=%d (%3.1f kHz off) fm_carrier=%d vif_level=%d afc_win=%d %s\n",
+ t->after_reset, t->afc_status,
+ (t->afc_status <
+ 8) ? -12.5 - t->afc_status * 25.0 : -12.5 + (16 -
+ t->afc_status) *
+ 25.0, t->fm_carrier, t->vif_level, t->afc_win,
+ t->afc_win ? "VCO in" : "VCO out");
+}
diff --git a/xorg-server/hw/xfree86/i2c/tda9885_module.c b/xorg-server/hw/xfree86/i2c/tda9885_module.c
index 51eaca7e8..e71bd6061 100644
--- a/xorg-server/hw/xfree86/i2c/tda9885_module.c
+++ b/xorg-server/hw/xfree86/i2c/tda9885_module.c
@@ -1,25 +1,24 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static XF86ModuleVersionInfo tda9885VersRec =
-{
- "tda9885",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData tda9885ModuleData = {
- &tda9885VersRec,
- NULL,
- NULL
-};
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo tda9885VersRec = {
+ "tda9885",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData tda9885ModuleData = {
+ &tda9885VersRec,
+ NULL,
+ NULL
+};
diff --git a/xorg-server/hw/xfree86/i2c/uda1380.c b/xorg-server/hw/xfree86/i2c/uda1380.c
index eebe127ed..87226877b 100644
--- a/xorg-server/hw/xfree86/i2c/uda1380.c
+++ b/xorg-server/hw/xfree86/i2c/uda1380.c
@@ -1,183 +1,196 @@
-/*************************************************************************************
- * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this
- * software and associated documentation files (the "Software"), to deal in the Software
- * without restriction, including without limitation the rights to use, copy, modify,
- * merge, publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or
- * substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
- * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the author shall not be used in advertising or
- * otherwise to promote the sale, use or other dealings in this Software without prior written
- * authorization from the author.
- *
- ************************************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86i2c.h"
-#include "uda1380.h"
-#include "i2c_def.h"
-
-UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr)
-{
- UDA1380Ptr t;
- I2CByte a;
-
- t = calloc(1, sizeof(UDA1380Rec));
- if(t == NULL) return NULL;
- switch(addr)
- {
- case UDA1380_ADDR_1:
- case UDA1380_ADDR_2:
- t->d.DevName = "UDA1380 Stereo audion coder-decoder";
- break;
- default:
- t->d.DevName = "Generic UDAxxxx";
- break;
- }
- t->d.SlaveAddr = addr;
- t->d.pI2CBus = b;
- t->d.NextDev = NULL;
- t->d.StartTimeout = b->StartTimeout;
- t->d.BitTimeout = b->BitTimeout;
- t->d.AcknTimeout = b->AcknTimeout;
- t->d.ByteTimeout = b->ByteTimeout;
-
- if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
- {
- free(t);
- return NULL;
- }
-
- /* set default parameters */
- if(!I2CDevInit(&(t->d)))
- {
- free(t);
- return NULL;
- }
-
- xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 stereo coder-decoder detected\n");
-
- return t;
-}
-
-Bool uda1380_init(UDA1380Ptr t)
-{
- CARD8 data[3];
- CARD16 tmp;
- Bool ret;
-
- /* Power control */
- data[0] = 0x02;
- tmp = (1 << 13) | (1 << 10) | ( 1 << 8) | (1 << 7) | (1 << 6) | (1 << 3) | (1 << 1);
- data[1] = (CARD8)((tmp >> 8) & 0xff);
- data[2] = (CARD8)(tmp & 0xff);
- ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
- if (ret == FALSE)
- {
- xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to initialize\n");
- return FALSE;
- }
-
- /* Analog mixer (AVC) */
- data[0] = 0x03;
- /* the analog mixer is muted initially */
- data[1] = 0x3f;
- data[2] = 0x3f;
- ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
- if (ret == FALSE)
- {
- xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to initialize\n");
- return FALSE;
- }
-
- xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 initialized\n");
-
- return TRUE;
-}
-
-void uda1380_shutdown(UDA1380Ptr t)
-{
- CARD8 data[3];
- Bool ret;
-
- /* Power control */
- data[0] = 0x02;
- data[1] = 0;
- data[2] = 0;
- ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
- if (ret == FALSE)
- xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to shutdown\n");
-}
-
-void uda1380_setvolume(UDA1380Ptr t, INT32 value)
-{
- CARD8 data[3];
- /*
- * We have to scale the value ranging from -1000 to 1000 to 0x2c to 0
- */
- CARD8 volume = 47 - (CARD8)((value + 1000) * 47 / 2000);
- Bool ret;
-
- t->analog_mixer_settings = ((volume << 8) & 0x3f00) | (volume & 0x3f);
-
- /* Analog mixer (AVC) */
- data[0] = 0x03;
- data[1] = volume & 0x3f;
- data[2] = volume & 0x3f;
- ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
- if (ret == FALSE)
- xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to set volume\n");
-}
-
-void uda1380_mute(UDA1380Ptr t, Bool mute)
-{
- CARD8 data[3];
- Bool ret;
-
- if (mute == TRUE)
- {
- /* Analog mixer (AVC) */
- data[0] = 0x03;
- data[1] = 0xff;
- data[2] = 0xff;
- ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
- if (ret == FALSE)
- xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to mute\n");
- }
- else
- {
- /* Analog mixer (AVC) */
- data[0] = 0x03;
- data[1] = (CARD8)((t->analog_mixer_settings >> 8) & 0x3f);
- data[2] = (CARD8)(t->analog_mixer_settings & 0x3f);
- ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
- if (ret == FALSE)
- xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to unmute\n");
- }
-}
-
-void uda1380_getstatus(UDA1380Ptr t)
-{
-}
-
-void uda1380_setparameters(UDA1380Ptr t)
-{
-}
-
-void uda1380_dumpstatus(UDA1380Ptr t)
-{
-}
+/*************************************************************************************
+ * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ * software and associated documentation files (the "Software"), to deal in the Software
+ * without restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
+ * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the author shall not be used in advertising or
+ * otherwise to promote the sale, use or other dealings in this Software without prior written
+ * authorization from the author.
+ *
+ ************************************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "uda1380.h"
+#include "i2c_def.h"
+
+UDA1380Ptr
+Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ UDA1380Ptr t;
+ I2CByte a;
+
+ t = calloc(1, sizeof(UDA1380Rec));
+ if (t == NULL)
+ return NULL;
+ switch (addr) {
+ case UDA1380_ADDR_1:
+ case UDA1380_ADDR_2:
+ t->d.DevName = "UDA1380 Stereo audion coder-decoder";
+ break;
+ default:
+ t->d.DevName = "Generic UDAxxxx";
+ break;
+ }
+ t->d.SlaveAddr = addr;
+ t->d.pI2CBus = b;
+ t->d.NextDev = NULL;
+ t->d.StartTimeout = b->StartTimeout;
+ t->d.BitTimeout = b->BitTimeout;
+ t->d.AcknTimeout = b->AcknTimeout;
+ t->d.ByteTimeout = b->ByteTimeout;
+
+ if (!I2C_WriteRead(&(t->d), NULL, 0, &a, 1)) {
+ free(t);
+ return NULL;
+ }
+
+ /* set default parameters */
+ if (!I2CDevInit(&(t->d))) {
+ free(t);
+ return NULL;
+ }
+
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO,
+ "UDA1380 stereo coder-decoder detected\n");
+
+ return t;
+}
+
+Bool
+uda1380_init(UDA1380Ptr t)
+{
+ CARD8 data[3];
+ CARD16 tmp;
+ Bool ret;
+
+ /* Power control */
+ data[0] = 0x02;
+ tmp =
+ (1 << 13) | (1 << 10) | (1 << 8) | (1 << 7) | (1 << 6) | (1 << 3) | (1
+ <<
+ 1);
+ data[1] = (CARD8) ((tmp >> 8) & 0xff);
+ data[2] = (CARD8) (tmp & 0xff);
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE) {
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO,
+ "UDA1380 failed to initialize\n");
+ return FALSE;
+ }
+
+ /* Analog mixer (AVC) */
+ data[0] = 0x03;
+ /* the analog mixer is muted initially */
+ data[1] = 0x3f;
+ data[2] = 0x3f;
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE) {
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO,
+ "UDA1380 failed to initialize\n");
+ return FALSE;
+ }
+
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, "UDA1380 initialized\n");
+
+ return TRUE;
+}
+
+void
+uda1380_shutdown(UDA1380Ptr t)
+{
+ CARD8 data[3];
+ Bool ret;
+
+ /* Power control */
+ data[0] = 0x02;
+ data[1] = 0;
+ data[2] = 0;
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE)
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO,
+ "UDA1380 failed to shutdown\n");
+}
+
+void
+uda1380_setvolume(UDA1380Ptr t, INT32 value)
+{
+ CARD8 data[3];
+
+ /*
+ * We have to scale the value ranging from -1000 to 1000 to 0x2c to 0
+ */
+ CARD8 volume = 47 - (CARD8) ((value + 1000) * 47 / 2000);
+ Bool ret;
+
+ t->analog_mixer_settings = ((volume << 8) & 0x3f00) | (volume & 0x3f);
+
+ /* Analog mixer (AVC) */
+ data[0] = 0x03;
+ data[1] = volume & 0x3f;
+ data[2] = volume & 0x3f;
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE)
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO,
+ "UDA1380 failed to set volume\n");
+}
+
+void
+uda1380_mute(UDA1380Ptr t, Bool mute)
+{
+ CARD8 data[3];
+ Bool ret;
+
+ if (mute == TRUE) {
+ /* Analog mixer (AVC) */
+ data[0] = 0x03;
+ data[1] = 0xff;
+ data[2] = 0xff;
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE)
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO,
+ "UDA1380 failed to mute\n");
+ }
+ else {
+ /* Analog mixer (AVC) */
+ data[0] = 0x03;
+ data[1] = (CARD8) ((t->analog_mixer_settings >> 8) & 0x3f);
+ data[2] = (CARD8) (t->analog_mixer_settings & 0x3f);
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE)
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO,
+ "UDA1380 failed to unmute\n");
+ }
+}
+
+void
+uda1380_getstatus(UDA1380Ptr t)
+{
+}
+
+void
+uda1380_setparameters(UDA1380Ptr t)
+{
+}
+
+void
+uda1380_dumpstatus(UDA1380Ptr t)
+{
+}
diff --git a/xorg-server/hw/xfree86/i2c/uda1380_module.c b/xorg-server/hw/xfree86/i2c/uda1380_module.c
index 203055d46..dca834b12 100644
--- a/xorg-server/hw/xfree86/i2c/uda1380_module.c
+++ b/xorg-server/hw/xfree86/i2c/uda1380_module.c
@@ -1,25 +1,24 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static XF86ModuleVersionInfo uda1380VersRec =
-{
- "uda1380",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData uda1380ModuleData = {
- &uda1380VersRec,
- NULL,
- NULL
-};
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo uda1380VersRec = {
+ "uda1380",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData uda1380ModuleData = {
+ &uda1380VersRec,
+ NULL,
+ NULL
+};
diff --git a/xorg-server/hw/xfree86/i2c/xf86i2c.c b/xorg-server/hw/xfree86/i2c/xf86i2c.c
index 488b6815f..1273f4bab 100644
--- a/xorg-server/hw/xfree86/i2c/xf86i2c.c
+++ b/xorg-server/hw/xfree86/i2c/xf86i2c.c
@@ -1,866 +1,879 @@
-/*
- * Copyright (C) 1998 Itai Nahshon, Michael Schimek
- *
- * The original code was derived from and inspired by
- * the I2C driver from the Linux kernel.
- * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de>
- */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <sys/time.h>
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include <X11/Xos.h>
-#include <X11/Xproto.h>
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "validate.h"
-#include "resource.h"
-#include "gcstruct.h"
-#include "dixstruct.h"
-
-#include "xf86i2c.h"
-
-#define I2C_TIMEOUT(x) /*(x)*/ /* Report timeouts */
-#define I2C_TRACE(x) /*(x)*/ /* Report progress */
-
-/* This is the default I2CUDelay function if not supplied by the driver.
- * High level I2C interfaces implementing the bus protocol in hardware
- * should supply this function too.
- *
- * Delay execution at least usec microseconds.
- * All values 0 to 1e6 inclusive must be expected.
- */
-
-static void
-I2CUDelay(I2CBusPtr b, int usec)
-{
- struct timeval begin, cur;
- long d_secs, d_usecs;
- long diff;
-
- if (usec > 0) {
- X_GETTIMEOFDAY(&begin);
- do {
- /* It would be nice to use {xf86}usleep,
- * but usleep (1) takes >10000 usec !
- */
- X_GETTIMEOFDAY(&cur);
- d_secs = (cur.tv_sec - begin.tv_sec);
- d_usecs = (cur.tv_usec - begin.tv_usec);
- diff = d_secs*1000000 + d_usecs;
- } while (diff>=0 && diff< (usec + 1));
- }
-}
-
-/* Most drivers will register just with GetBits/PutBits functions.
- * The following functions implement a software I2C protocol
- * by using the promitive functions given by the driver.
- * ================================================================
- *
- * It is assumed that there is just one master on the I2C bus, therefore
- * there is no explicit test for conflits.
- */
-
-#define RISEFALLTIME 2 /* usec, actually 300 to 1000 ns according to the i2c specs */
-
-/* Some devices will hold SCL low to slow down the bus or until
- * ready for transmission.
- *
- * This condition will be noticed when the master tries to raise
- * the SCL line. You can set the timeout to zero if the slave device
- * does not support this clock synchronization.
- */
-
-static Bool
-I2CRaiseSCL(I2CBusPtr b, int sda, int timeout)
-{
- int i, scl;
-
- b->I2CPutBits(b, 1, sda);
- b->I2CUDelay(b, b->RiseFallTime);
-
- for (i = timeout; i > 0; i -= b->RiseFallTime) {
- b->I2CGetBits(b, &scl, &sda);
- if (scl) break;
- b->I2CUDelay(b, b->RiseFallTime);
- }
-
- if (i <= 0) {
- I2C_TIMEOUT(ErrorF("[I2CRaiseSCL(<%s>, %d, %d) timeout]", b->BusName, sda, timeout));
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Send a start signal on the I2C bus. The start signal notifies
- * devices that a new transaction is initiated by the bus master.
- *
- * The start signal is always followed by a slave address.
- * Slave addresses are 8+ bits. The first 7 bits identify the
- * device and the last bit signals if this is a read (1) or
- * write (0) operation.
- *
- * There may be more than one start signal on one transaction.
- * This happens for example on some devices that allow reading
- * of registers. First send a start bit followed by the device
- * address (with the last bit 0) and the register number. Then send
- * a new start bit with the device address (with the last bit 1)
- * and then read the value from the device.
- *
- * Note this is function does not implement a multiple master
- * arbitration procedure.
- */
-
-static Bool
-I2CStart(I2CBusPtr b, int timeout)
-{
- if (!I2CRaiseSCL(b, 1, timeout))
- return FALSE;
-
- b->I2CPutBits(b, 1, 0);
- b->I2CUDelay(b, b->HoldTime);
- b->I2CPutBits(b, 0, 0);
- b->I2CUDelay(b, b->HoldTime);
-
- I2C_TRACE(ErrorF("\ni2c: <"));
-
- return TRUE;
-}
-
-/* This is the default I2CStop function if not supplied by the driver.
- *
- * Signal devices on the I2C bus that a transaction on the
- * bus has finished. There may be more than one start signal
- * on a transaction but only one stop signal.
- */
-
-static void
-I2CStop(I2CDevPtr d)
-{
- I2CBusPtr b = d->pI2CBus;
-
- b->I2CPutBits(b, 0, 0);
- b->I2CUDelay(b, b->RiseFallTime);
-
- b->I2CPutBits(b, 1, 0);
- b->I2CUDelay(b, b->HoldTime);
- b->I2CPutBits(b, 1, 1);
- b->I2CUDelay(b, b->HoldTime);
-
- I2C_TRACE(ErrorF(">\n"));
-}
-
-/* Write/Read a single bit to/from a device.
- * Return FALSE if a timeout occurs.
- */
-
-static Bool
-I2CWriteBit(I2CBusPtr b, int sda, int timeout)
-{
- Bool r;
-
- b->I2CPutBits(b, 0, sda);
- b->I2CUDelay(b, b->RiseFallTime);
-
- r = I2CRaiseSCL(b, sda, timeout);
- b->I2CUDelay(b, b->HoldTime);
-
- b->I2CPutBits(b, 0, sda);
- b->I2CUDelay(b, b->HoldTime);
-
- return r;
-}
-
-static Bool
-I2CReadBit(I2CBusPtr b, int *psda, int timeout)
-{
- Bool r;
- int scl;
-
- r = I2CRaiseSCL(b, 1, timeout);
- b->I2CUDelay(b, b->HoldTime);
-
- b->I2CGetBits(b, &scl, psda);
-
- b->I2CPutBits(b, 0, 1);
- b->I2CUDelay(b, b->HoldTime);
-
- return r;
-}
-
-/* This is the default I2CPutByte function if not supplied by the driver.
- *
- * A single byte is sent to the device.
- * The function returns FALSE if a timeout occurs, you should send
- * a stop condition afterwards to reset the bus.
- *
- * A timeout occurs,
- * if the slave pulls SCL to slow down the bus more than ByteTimeout usecs,
- * or slows down the bus for more than BitTimeout usecs for each bit,
- * or does not send an ACK bit (0) to acknowledge the transmission within
- * AcknTimeout usecs, but a NACK (1) bit.
- *
- * AcknTimeout must be at least b->HoldTime, the other timeouts can be
- * zero according to the comment on I2CRaiseSCL.
- */
-
-static Bool
-I2CPutByte(I2CDevPtr d, I2CByte data)
-{
- Bool r;
- int i, scl, sda;
- I2CBusPtr b = d->pI2CBus;
-
- if (!I2CWriteBit(b, (data >> 7) & 1, d->ByteTimeout))
- return FALSE;
-
- for (i = 6; i >= 0; i--)
- if (!I2CWriteBit(b, (data >> i) & 1, d->BitTimeout))
- return FALSE;
-
- b->I2CPutBits(b, 0, 1);
- b->I2CUDelay(b, b->RiseFallTime);
-
- r = I2CRaiseSCL(b, 1, b->HoldTime);
-
- if (r) {
- for (i = d->AcknTimeout; i > 0; i -= b->HoldTime) {
- b->I2CUDelay(b, b->HoldTime);
- b->I2CGetBits(b, &scl, &sda);
- if (sda == 0) break;
- }
-
- if (i <= 0) {
- I2C_TIMEOUT(ErrorF("[I2CPutByte(<%s>, 0x%02x, %d, %d, %d) timeout]",
- b->BusName, data, d->BitTimeout,
- d->ByteTimeout, d->AcknTimeout));
- r = FALSE;
- }
-
- I2C_TRACE(ErrorF("W%02x%c ", (int) data, sda ? '-' : '+'));
- }
-
- b->I2CPutBits(b, 0, 1);
- b->I2CUDelay(b, b->HoldTime);
-
- return r;
-}
-
-/* This is the default I2CGetByte function if not supplied by the driver.
- *
- * A single byte is read from the device.
- * The function returns FALSE if a timeout occurs, you should send
- * a stop condition afterwards to reset the bus.
- *
- * A timeout occurs,
- * if the slave pulls SCL to slow down the bus more than ByteTimeout usecs,
- * or slows down the bus for more than b->BitTimeout usecs for each bit.
- *
- * ByteTimeout must be at least b->HoldTime, the other timeouts can be
- * zero according to the comment on I2CRaiseSCL.
- *
- * For the <last> byte in a sequence the acknowledge bit NACK (1),
- * otherwise ACK (0) will be sent.
- */
-
-static Bool
-I2CGetByte(I2CDevPtr d, I2CByte *data, Bool last)
-{
- int i, sda;
- I2CBusPtr b = d->pI2CBus;
-
- b->I2CPutBits(b, 0, 1);
- b->I2CUDelay(b, b->RiseFallTime);
-
- if (!I2CReadBit(b, &sda, d->ByteTimeout))
- return FALSE;
-
- *data = (sda > 0) << 7;
-
- for (i = 6; i >= 0; i--)
- if (!I2CReadBit(b, &sda, d->BitTimeout))
- return FALSE;
- else
- *data |= (sda > 0) << i;
-
- if (!I2CWriteBit(b, last ? 1 : 0, d->BitTimeout))
- return FALSE;
-
- I2C_TRACE(ErrorF("R%02x%c ", (int) *data, last ? '+' : '-'));
-
- return TRUE;
-}
-
-/* This is the default I2CAddress function if not supplied by the driver.
- *
- * It creates the start condition, followed by the d->SlaveAddr.
- * Higher level functions must call this routine rather than
- * I2CStart/PutByte because a hardware I2C master may not be able
- * to send a slave address without a start condition.
- *
- * The same timeouts apply as with I2CPutByte and additional a
- * StartTimeout, similar to the ByteTimeout but for the start
- * condition.
- *
- * In case of a timeout, the bus is left in a clean idle condition.
- * I. e. you *must not* send a Stop. If this function succeeds, you *must*.
- *
- * The slave address format is 16 bit, with the legacy _8_bit_ slave address
- * in the least significant byte. This is, the slave address must include the
- * R/_W flag as least significant bit.
- *
- * The most significant byte of the address will be sent _after_ the LSB,
- * but only if the LSB indicates:
- * a) an 11 bit address, this is LSB = 1111 0xxx.
- * b) a 'general call address', this is LSB = 0000 000x - see the I2C specs
- * for more.
- */
-
-static Bool
-I2CAddress(I2CDevPtr d, I2CSlaveAddr addr)
-{
- if (I2CStart(d->pI2CBus, d->StartTimeout)) {
- if (I2CPutByte(d, addr & 0xFF)) {
- if ((addr & 0xF8) != 0xF0 &&
- (addr & 0xFE) != 0x00)
- return TRUE;
-
- if (I2CPutByte(d, (addr >> 8) & 0xFF))
- return TRUE;
- }
-
- I2CStop(d);
- }
-
- return FALSE;
-}
-
-/* These are the hardware independent I2C helper functions.
- * ========================================================
- */
-
-/* Function for probing. Just send the slave address
- * and return true if the device responds. The slave address
- * must have the lsb set to reflect a read (1) or write (0) access.
- * Don't expect a read- or write-only device will respond otherwise.
- */
-
-Bool
-xf86I2CProbeAddress(I2CBusPtr b, I2CSlaveAddr addr)
-{
- int r;
- I2CDevRec d;
-
- d.DevName = "Probing";
- d.BitTimeout = b->BitTimeout;
- d.ByteTimeout = b->ByteTimeout;
- d.AcknTimeout = b->AcknTimeout;
- d.StartTimeout = b->StartTimeout;
- d.SlaveAddr = addr;
- d.pI2CBus = b;
- d.NextDev = NULL;
-
- r = b->I2CAddress(&d, addr);
-
- if (r) b->I2CStop(&d);
-
- return r;
-}
-
-/* All functions below are related to devices and take the
- * slave address and timeout values from an I2CDevRec. They
- * return FALSE in case of an error (presumably a timeout).
- */
-
-/* General purpose read and write function.
- *
- * 1st, if nWrite > 0
- * Send a start condition
- * Send the slave address (1 or 2 bytes) with write flag
- * Write n bytes from WriteBuffer
- * 2nd, if nRead > 0
- * Send a start condition [again]
- * Send the slave address (1 or 2 bytes) with read flag
- * Read n bytes to ReadBuffer
- * 3rd, if a Start condition has been successfully sent,
- * Send a Stop condition.
- *
- * The functions exits immediately when an error occures,
- * not proceeding any data left. However, step 3 will
- * be executed anyway to leave the bus in clean idle state.
- */
-
-static Bool
-I2CWriteRead(I2CDevPtr d,
- I2CByte *WriteBuffer, int nWrite,
- I2CByte *ReadBuffer, int nRead)
-{
- Bool r = TRUE;
- I2CBusPtr b = d->pI2CBus;
- int s = 0;
-
- if (r && nWrite > 0) {
- r = b->I2CAddress(d, d->SlaveAddr & ~1);
- if (r) {
- for (; nWrite > 0; WriteBuffer++, nWrite--)
- if (!(r = b->I2CPutByte(d, *WriteBuffer)))
- break;
- s++;
- }
- }
-
- if (r && nRead > 0) {
- r = b->I2CAddress(d, d->SlaveAddr | 1);
- if (r) {
- for (; nRead > 0; ReadBuffer++, nRead--)
- if (!(r = b->I2CGetByte(d, ReadBuffer, nRead == 1)))
- break;
- s++;
- }
- }
-
- if (s) b->I2CStop(d);
-
- return r;
-}
-
-/* wrapper - for compatibility and convinience */
-
-Bool
-xf86I2CWriteRead(I2CDevPtr d,
- I2CByte *WriteBuffer, int nWrite,
- I2CByte *ReadBuffer, int nRead)
-{
- I2CBusPtr b = d->pI2CBus;
- return b->I2CWriteRead(d,WriteBuffer,nWrite,ReadBuffer,nRead);
-}
-
-/* Read a byte, the only readable register of a device.
- */
-
-Bool
-xf86I2CReadStatus(I2CDevPtr d, I2CByte *pbyte)
-{
- return xf86I2CWriteRead(d, NULL, 0, pbyte, 1);
-}
-
-/* Read a byte from one of the registers determined by its sub-address.
- */
-
-Bool
-xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte)
-{
- return xf86I2CWriteRead(d, &subaddr, 1, pbyte, 1);
-}
-
-/* Read bytes from subsequent registers determined by the
- * sub-address of the first register.
- */
-
-Bool
-xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte, int n)
-{
- return xf86I2CWriteRead(d, &subaddr, 1, pbyte, n);
-}
-
-/* Read a word (high byte, then low byte) from one of the registers
- * determined by its sub-address.
- */
-
-Bool
-xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr, unsigned short *pword)
-{
- I2CByte rb[2];
-
- if (!xf86I2CWriteRead(d, &subaddr, 1, rb, 2)) return FALSE;
-
- *pword = (rb[0] << 8) | rb[1];
-
- return TRUE;
-}
-
-/* Write a byte to one of the registers determined by its sub-address.
- */
-
-Bool
-xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr, I2CByte byte)
-{
- I2CByte wb[2];
-
- wb[0] = subaddr;
- wb[1] = byte;
-
- return xf86I2CWriteRead(d, wb, 2, NULL, 0);
-}
-
-/* Write bytes to subsequent registers determined by the
- * sub-address of the first register.
- */
-
-Bool
-xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr,
- I2CByte *WriteBuffer, int nWrite)
-{
- I2CBusPtr b = d->pI2CBus;
- Bool r = TRUE;
-
- if (nWrite > 0) {
- r = b->I2CAddress(d, d->SlaveAddr & ~1);
- if (r){
- if ((r = b->I2CPutByte(d, subaddr)))
- for (; nWrite > 0; WriteBuffer++, nWrite--)
- if (!(r = b->I2CPutByte(d, *WriteBuffer)))
- break;
-
- b->I2CStop(d);
- }
- }
-
- return r;
-}
-
-/* Write a word (high byte, then low byte) to one of the registers
- * determined by its sub-address.
- */
-
-Bool
-xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr, unsigned short word)
-{
- I2CByte wb[3];
-
- wb[0] = subaddr;
- wb[1] = word >> 8;
- wb[2] = word & 0xFF;
-
- return xf86I2CWriteRead(d, wb, 3, NULL, 0);
-}
-
-/* Write a vector of bytes to not adjacent registers. This vector is,
- * 1st byte sub-address, 2nd byte value, 3rd byte sub-address asf.
- * This function is intended to initialize devices. Note this function
- * exits immediately when an error occurs, some registers may
- * remain uninitialized.
- */
-
-Bool
-xf86I2CWriteVec(I2CDevPtr d, I2CByte *vec, int nValues)
-{
- I2CBusPtr b = d->pI2CBus;
- Bool r = TRUE;
- int s = 0;
-
- if (nValues > 0) {
- for (; nValues > 0; nValues--, vec += 2) {
- if (!(r = b->I2CAddress(d, d->SlaveAddr & ~1)))
- break;
-
- s++;
-
- if (!(r = b->I2CPutByte(d, vec[0])))
- break;
-
- if (!(r = b->I2CPutByte(d, vec[1])))
- break;
- }
-
- if (s > 0) b->I2CStop(d);
- }
-
- return r;
-}
-
-/* Administrative functions.
- * =========================
- */
-
-/* Allocates an I2CDevRec for you and initializes with propper defaults
- * you may modify before calling xf86I2CDevInit. Your I2CDevRec must
- * contain at least a SlaveAddr, and a pI2CBus pointer to the bus this
- * device shall be linked to.
- *
- * See function I2CAddress for the slave address format. Always set
- * the least significant bit, indicating a read or write access, to zero.
- */
-
-I2CDevPtr
-xf86CreateI2CDevRec(void)
-{
- return calloc(1, sizeof(I2CDevRec));
-}
-
-/* Unlink an I2C device. If you got the I2CDevRec from xf86CreateI2CDevRec
- * you should set <unalloc> to free it.
- */
-
-void
-xf86DestroyI2CDevRec(I2CDevPtr d, Bool unalloc)
-{
- if (d) {
- I2CDevPtr *p;
-
- /* Remove this from the list of active I2C devices. */
-
- for (p = &d->pI2CBus->FirstDev; *p != NULL; p = &(*p)->NextDev)
- if (*p == d) {
- *p = (*p)->NextDev;
- break;
- }
-
- xf86DrvMsg(d->pI2CBus->scrnIndex, X_INFO,
- "I2C device \"%s:%s\" removed.\n",
- d->pI2CBus->BusName, d->DevName);
-
- if (unalloc) free(d);
- }
-}
-
-/* I2C transmissions are related to an I2CDevRec you must link to a
- * previously registered bus (see xf86I2CBusInit) before attempting
- * to read and write data. You may call xf86I2CProbeAddress first to
- * see if the device in question is present on this bus.
- *
- * xf86I2CDevInit will not allocate an I2CBusRec for you, instead you
- * may enter a pointer to a statically allocated I2CDevRec or the (modified)
- * result of xf86CreateI2CDevRec.
- *
- * If you don't specify timeouts for the device (n <= 0), it will inherit
- * the bus-wide defaults. The function returns TRUE on success.
- */
-
-Bool
-xf86I2CDevInit(I2CDevPtr d)
-{
- I2CBusPtr b;
-
- if (d == NULL ||
- (b = d->pI2CBus) == NULL ||
- (d->SlaveAddr & 1) ||
- xf86I2CFindDev(b, d->SlaveAddr) != NULL)
- return FALSE;
-
- if (d->BitTimeout <= 0) d->BitTimeout = b->BitTimeout;
- if (d->ByteTimeout <= 0) d->ByteTimeout = b->ByteTimeout;
- if (d->AcknTimeout <= 0) d->AcknTimeout = b->AcknTimeout;
- if (d->StartTimeout <= 0) d->StartTimeout = b->StartTimeout;
-
- d->NextDev = b->FirstDev;
- b->FirstDev = d;
-
- xf86DrvMsg(b->scrnIndex, X_INFO,
- "I2C device \"%s:%s\" registered at address 0x%02X.\n",
- b->BusName, d->DevName, d->SlaveAddr);
-
- return TRUE;
-}
-
-I2CDevPtr
-xf86I2CFindDev(I2CBusPtr b, I2CSlaveAddr addr)
-{
- I2CDevPtr d;
-
- if (b) {
- for (d = b->FirstDev; d != NULL; d = d->NextDev)
- if (d->SlaveAddr == addr)
- return d;
- }
-
- return NULL;
-}
-
-static I2CBusPtr I2CBusList;
-
-/* Allocates an I2CBusRec for you and initializes with propper defaults
- * you may modify before calling xf86I2CBusInit. Your I2CBusRec must
- * contain at least a BusName, a scrnIndex (or -1), and a complete set
- * of either high or low level I2C function pointers. You may pass
- * bus-wide timeouts, otherwise inplausible values will be replaced
- * with safe defaults.
- */
-
-I2CBusPtr
-xf86CreateI2CBusRec(void)
-{
- I2CBusPtr b;
-
- b = (I2CBusPtr) calloc(1, sizeof(I2CBusRec));
-
- if (b != NULL) {
- b->scrnIndex = -1;
- b->HoldTime = 5; /* 100 kHz bus */
- b->BitTimeout = 5;
- b->ByteTimeout = 5;
- b->AcknTimeout = 5;
- b->StartTimeout = 5;
- b->RiseFallTime = RISEFALLTIME;
- }
-
- return b;
-}
-
-/* Unregister an I2C bus. If you got the I2CBusRec from xf86CreateI2CBusRec
- * you should set <unalloc> to free it. If you set <devs_too>, the function
- * xf86DestroyI2CDevRec will be called for all devices linked to the bus
- * first, passing down the <unalloc> option.
- */
-
-void
-xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too)
-{
- if (b) {
- I2CBusPtr *p;
-
- /* Remove this from the list of active I2C buses */
-
- for (p = &I2CBusList; *p != NULL; p = &(*p)->NextBus)
- if (*p == b) {
- *p = (*p)->NextBus;
- break;
- }
-
- if (b->FirstDev != NULL) {
- if (devs_too) {
- I2CDevPtr d;
-
- while ((d = b->FirstDev) != NULL) {
- b->FirstDev = d->NextDev;
- xf86DestroyI2CDevRec(d, unalloc);
- }
- } else {
- if (unalloc) {
- xf86Msg(X_ERROR, "i2c bug: Attempt to remove I2C bus \"%s\", "
- "but device list is not empty.\n",
- b->BusName);
- return;
- }
- }
- }
-
- xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" removed.\n",
- b->BusName);
-
- if (unalloc) free(b);
- }
-}
-
-/* I2C masters have to register themselves using this function.
- * It will not allocate an I2CBusRec for you, instead you may enter
- * a pointer to a statically allocated I2CBusRec or the (modified)
- * result of xf86CreateI2CBusRec. Returns TRUE on success.
- *
- * At this point there won't be any traffic on the I2C bus.
- */
-
-Bool
-xf86I2CBusInit(I2CBusPtr b)
-{
- /* I2C buses must be identified by a unique scrnIndex
- * and name. If scrnIndex is unspecified (a negative value),
- * then the name must be unique throughout the server.
- */
-
- if (b->BusName == NULL ||
- xf86I2CFindBus(b->scrnIndex, b->BusName) != NULL)
- return FALSE;
-
- /* If the high level functions are not
- * supplied, use the generic functions.
- * In this case we need the low-level
- * function.
- */
- if (b->I2CWriteRead == NULL)
- {
- b->I2CWriteRead=I2CWriteRead;
-
- if (b->I2CPutBits == NULL ||
- b->I2CGetBits == NULL)
- {
- if (b->I2CPutByte == NULL ||
- b->I2CGetByte == NULL ||
- b->I2CAddress == NULL ||
- b->I2CStart == NULL ||
- b->I2CStop == NULL)
- return FALSE;
- } else {
- b->I2CPutByte = I2CPutByte;
- b->I2CGetByte = I2CGetByte;
- b->I2CAddress = I2CAddress;
- b->I2CStop = I2CStop;
- b->I2CStart = I2CStart;
- }
- }
-
- if (b->I2CUDelay == NULL)
- b->I2CUDelay = I2CUDelay;
-
- if (b->HoldTime < 2) b->HoldTime = 5;
- if (b->BitTimeout <= 0) b->BitTimeout = b->HoldTime;
- if (b->ByteTimeout <= 0) b->ByteTimeout = b->HoldTime;
- if (b->AcknTimeout <= 0) b->AcknTimeout = b->HoldTime;
- if (b->StartTimeout <= 0) b->StartTimeout = b->HoldTime;
-
- /* Put new bus on list. */
-
- b->NextBus = I2CBusList;
- I2CBusList = b;
-
- xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" initialized.\n",
- b->BusName);
-
- return TRUE;
-}
-
-I2CBusPtr
-xf86I2CFindBus(int scrnIndex, char *name)
-{
- I2CBusPtr p;
-
- if (name != NULL)
- for (p = I2CBusList; p != NULL; p = p->NextBus)
- if (scrnIndex < 0 || p->scrnIndex == scrnIndex)
- if (!strcmp(p->BusName, name))
- return p;
-
- return NULL;
-}
-
-/*
- * Return an array of I2CBusPtr's related to a screen. The caller is
- * responsible for freeing the array.
- */
-int
-xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr **pppI2CBus)
-{
- I2CBusPtr pI2CBus;
- int n = 0;
-
- if (pppI2CBus)
- *pppI2CBus = NULL;
-
- for (pI2CBus = I2CBusList; pI2CBus; pI2CBus = pI2CBus->NextBus) {
- if ((pI2CBus->scrnIndex >= 0) && (pI2CBus->scrnIndex != scrnIndex))
- continue;
-
- n++;
-
- if (!pppI2CBus)
- continue;
-
- *pppI2CBus = xnfrealloc(*pppI2CBus, n * sizeof(I2CBusPtr));
- (*pppI2CBus)[n - 1] = pI2CBus;
- }
-
- return n;
-}
+/*
+ * Copyright (C) 1998 Itai Nahshon, Michael Schimek
+ *
+ * The original code was derived from and inspired by
+ * the I2C driver from the Linux kernel.
+ * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/time.h>
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/Xos.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "validate.h"
+#include "resource.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+
+#include "xf86i2c.h"
+
+#define I2C_TIMEOUT(x) /*(x)*/ /* Report timeouts */
+#define I2C_TRACE(x) /*(x)*/ /* Report progress */
+
+/* This is the default I2CUDelay function if not supplied by the driver.
+ * High level I2C interfaces implementing the bus protocol in hardware
+ * should supply this function too.
+ *
+ * Delay execution at least usec microseconds.
+ * All values 0 to 1e6 inclusive must be expected.
+ */
+
+static void
+I2CUDelay(I2CBusPtr b, int usec)
+{
+ struct timeval begin, cur;
+ long d_secs, d_usecs;
+ long diff;
+
+ if (usec > 0) {
+ X_GETTIMEOFDAY(&begin);
+ do {
+ /* It would be nice to use {xf86}usleep,
+ * but usleep (1) takes >10000 usec !
+ */
+ X_GETTIMEOFDAY(&cur);
+ d_secs = (cur.tv_sec - begin.tv_sec);
+ d_usecs = (cur.tv_usec - begin.tv_usec);
+ diff = d_secs * 1000000 + d_usecs;
+ } while (diff >= 0 && diff < (usec + 1));
+ }
+}
+
+/* Most drivers will register just with GetBits/PutBits functions.
+ * The following functions implement a software I2C protocol
+ * by using the promitive functions given by the driver.
+ * ================================================================
+ *
+ * It is assumed that there is just one master on the I2C bus, therefore
+ * there is no explicit test for conflits.
+ */
+
+#define RISEFALLTIME 2 /* usec, actually 300 to 1000 ns according to the i2c specs */
+
+/* Some devices will hold SCL low to slow down the bus or until
+ * ready for transmission.
+ *
+ * This condition will be noticed when the master tries to raise
+ * the SCL line. You can set the timeout to zero if the slave device
+ * does not support this clock synchronization.
+ */
+
+static Bool
+I2CRaiseSCL(I2CBusPtr b, int sda, int timeout)
+{
+ int i, scl;
+
+ b->I2CPutBits(b, 1, sda);
+ b->I2CUDelay(b, b->RiseFallTime);
+
+ for (i = timeout; i > 0; i -= b->RiseFallTime) {
+ b->I2CGetBits(b, &scl, &sda);
+ if (scl)
+ break;
+ b->I2CUDelay(b, b->RiseFallTime);
+ }
+
+ if (i <= 0) {
+ I2C_TIMEOUT(ErrorF
+ ("[I2CRaiseSCL(<%s>, %d, %d) timeout]", b->BusName, sda,
+ timeout));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Send a start signal on the I2C bus. The start signal notifies
+ * devices that a new transaction is initiated by the bus master.
+ *
+ * The start signal is always followed by a slave address.
+ * Slave addresses are 8+ bits. The first 7 bits identify the
+ * device and the last bit signals if this is a read (1) or
+ * write (0) operation.
+ *
+ * There may be more than one start signal on one transaction.
+ * This happens for example on some devices that allow reading
+ * of registers. First send a start bit followed by the device
+ * address (with the last bit 0) and the register number. Then send
+ * a new start bit with the device address (with the last bit 1)
+ * and then read the value from the device.
+ *
+ * Note this is function does not implement a multiple master
+ * arbitration procedure.
+ */
+
+static Bool
+I2CStart(I2CBusPtr b, int timeout)
+{
+ if (!I2CRaiseSCL(b, 1, timeout))
+ return FALSE;
+
+ b->I2CPutBits(b, 1, 0);
+ b->I2CUDelay(b, b->HoldTime);
+ b->I2CPutBits(b, 0, 0);
+ b->I2CUDelay(b, b->HoldTime);
+
+ I2C_TRACE(ErrorF("\ni2c: <"));
+
+ return TRUE;
+}
+
+/* This is the default I2CStop function if not supplied by the driver.
+ *
+ * Signal devices on the I2C bus that a transaction on the
+ * bus has finished. There may be more than one start signal
+ * on a transaction but only one stop signal.
+ */
+
+static void
+I2CStop(I2CDevPtr d)
+{
+ I2CBusPtr b = d->pI2CBus;
+
+ b->I2CPutBits(b, 0, 0);
+ b->I2CUDelay(b, b->RiseFallTime);
+
+ b->I2CPutBits(b, 1, 0);
+ b->I2CUDelay(b, b->HoldTime);
+ b->I2CPutBits(b, 1, 1);
+ b->I2CUDelay(b, b->HoldTime);
+
+ I2C_TRACE(ErrorF(">\n"));
+}
+
+/* Write/Read a single bit to/from a device.
+ * Return FALSE if a timeout occurs.
+ */
+
+static Bool
+I2CWriteBit(I2CBusPtr b, int sda, int timeout)
+{
+ Bool r;
+
+ b->I2CPutBits(b, 0, sda);
+ b->I2CUDelay(b, b->RiseFallTime);
+
+ r = I2CRaiseSCL(b, sda, timeout);
+ b->I2CUDelay(b, b->HoldTime);
+
+ b->I2CPutBits(b, 0, sda);
+ b->I2CUDelay(b, b->HoldTime);
+
+ return r;
+}
+
+static Bool
+I2CReadBit(I2CBusPtr b, int *psda, int timeout)
+{
+ Bool r;
+ int scl;
+
+ r = I2CRaiseSCL(b, 1, timeout);
+ b->I2CUDelay(b, b->HoldTime);
+
+ b->I2CGetBits(b, &scl, psda);
+
+ b->I2CPutBits(b, 0, 1);
+ b->I2CUDelay(b, b->HoldTime);
+
+ return r;
+}
+
+/* This is the default I2CPutByte function if not supplied by the driver.
+ *
+ * A single byte is sent to the device.
+ * The function returns FALSE if a timeout occurs, you should send
+ * a stop condition afterwards to reset the bus.
+ *
+ * A timeout occurs,
+ * if the slave pulls SCL to slow down the bus more than ByteTimeout usecs,
+ * or slows down the bus for more than BitTimeout usecs for each bit,
+ * or does not send an ACK bit (0) to acknowledge the transmission within
+ * AcknTimeout usecs, but a NACK (1) bit.
+ *
+ * AcknTimeout must be at least b->HoldTime, the other timeouts can be
+ * zero according to the comment on I2CRaiseSCL.
+ */
+
+static Bool
+I2CPutByte(I2CDevPtr d, I2CByte data)
+{
+ Bool r;
+ int i, scl, sda;
+ I2CBusPtr b = d->pI2CBus;
+
+ if (!I2CWriteBit(b, (data >> 7) & 1, d->ByteTimeout))
+ return FALSE;
+
+ for (i = 6; i >= 0; i--)
+ if (!I2CWriteBit(b, (data >> i) & 1, d->BitTimeout))
+ return FALSE;
+
+ b->I2CPutBits(b, 0, 1);
+ b->I2CUDelay(b, b->RiseFallTime);
+
+ r = I2CRaiseSCL(b, 1, b->HoldTime);
+
+ if (r) {
+ for (i = d->AcknTimeout; i > 0; i -= b->HoldTime) {
+ b->I2CUDelay(b, b->HoldTime);
+ b->I2CGetBits(b, &scl, &sda);
+ if (sda == 0)
+ break;
+ }
+
+ if (i <= 0) {
+ I2C_TIMEOUT(ErrorF("[I2CPutByte(<%s>, 0x%02x, %d, %d, %d) timeout]",
+ b->BusName, data, d->BitTimeout,
+ d->ByteTimeout, d->AcknTimeout));
+ r = FALSE;
+ }
+
+ I2C_TRACE(ErrorF("W%02x%c ", (int) data, sda ? '-' : '+'));
+ }
+
+ b->I2CPutBits(b, 0, 1);
+ b->I2CUDelay(b, b->HoldTime);
+
+ return r;
+}
+
+/* This is the default I2CGetByte function if not supplied by the driver.
+ *
+ * A single byte is read from the device.
+ * The function returns FALSE if a timeout occurs, you should send
+ * a stop condition afterwards to reset the bus.
+ *
+ * A timeout occurs,
+ * if the slave pulls SCL to slow down the bus more than ByteTimeout usecs,
+ * or slows down the bus for more than b->BitTimeout usecs for each bit.
+ *
+ * ByteTimeout must be at least b->HoldTime, the other timeouts can be
+ * zero according to the comment on I2CRaiseSCL.
+ *
+ * For the <last> byte in a sequence the acknowledge bit NACK (1),
+ * otherwise ACK (0) will be sent.
+ */
+
+static Bool
+I2CGetByte(I2CDevPtr d, I2CByte * data, Bool last)
+{
+ int i, sda;
+ I2CBusPtr b = d->pI2CBus;
+
+ b->I2CPutBits(b, 0, 1);
+ b->I2CUDelay(b, b->RiseFallTime);
+
+ if (!I2CReadBit(b, &sda, d->ByteTimeout))
+ return FALSE;
+
+ *data = (sda > 0) << 7;
+
+ for (i = 6; i >= 0; i--)
+ if (!I2CReadBit(b, &sda, d->BitTimeout))
+ return FALSE;
+ else
+ *data |= (sda > 0) << i;
+
+ if (!I2CWriteBit(b, last ? 1 : 0, d->BitTimeout))
+ return FALSE;
+
+ I2C_TRACE(ErrorF("R%02x%c ", (int) *data, last ? '+' : '-'));
+
+ return TRUE;
+}
+
+/* This is the default I2CAddress function if not supplied by the driver.
+ *
+ * It creates the start condition, followed by the d->SlaveAddr.
+ * Higher level functions must call this routine rather than
+ * I2CStart/PutByte because a hardware I2C master may not be able
+ * to send a slave address without a start condition.
+ *
+ * The same timeouts apply as with I2CPutByte and additional a
+ * StartTimeout, similar to the ByteTimeout but for the start
+ * condition.
+ *
+ * In case of a timeout, the bus is left in a clean idle condition.
+ * I. e. you *must not* send a Stop. If this function succeeds, you *must*.
+ *
+ * The slave address format is 16 bit, with the legacy _8_bit_ slave address
+ * in the least significant byte. This is, the slave address must include the
+ * R/_W flag as least significant bit.
+ *
+ * The most significant byte of the address will be sent _after_ the LSB,
+ * but only if the LSB indicates:
+ * a) an 11 bit address, this is LSB = 1111 0xxx.
+ * b) a 'general call address', this is LSB = 0000 000x - see the I2C specs
+ * for more.
+ */
+
+static Bool
+I2CAddress(I2CDevPtr d, I2CSlaveAddr addr)
+{
+ if (I2CStart(d->pI2CBus, d->StartTimeout)) {
+ if (I2CPutByte(d, addr & 0xFF)) {
+ if ((addr & 0xF8) != 0xF0 && (addr & 0xFE) != 0x00)
+ return TRUE;
+
+ if (I2CPutByte(d, (addr >> 8) & 0xFF))
+ return TRUE;
+ }
+
+ I2CStop(d);
+ }
+
+ return FALSE;
+}
+
+/* These are the hardware independent I2C helper functions.
+ * ========================================================
+ */
+
+/* Function for probing. Just send the slave address
+ * and return true if the device responds. The slave address
+ * must have the lsb set to reflect a read (1) or write (0) access.
+ * Don't expect a read- or write-only device will respond otherwise.
+ */
+
+Bool
+xf86I2CProbeAddress(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ int r;
+ I2CDevRec d;
+
+ d.DevName = "Probing";
+ d.BitTimeout = b->BitTimeout;
+ d.ByteTimeout = b->ByteTimeout;
+ d.AcknTimeout = b->AcknTimeout;
+ d.StartTimeout = b->StartTimeout;
+ d.SlaveAddr = addr;
+ d.pI2CBus = b;
+ d.NextDev = NULL;
+
+ r = b->I2CAddress(&d, addr);
+
+ if (r)
+ b->I2CStop(&d);
+
+ return r;
+}
+
+/* All functions below are related to devices and take the
+ * slave address and timeout values from an I2CDevRec. They
+ * return FALSE in case of an error (presumably a timeout).
+ */
+
+/* General purpose read and write function.
+ *
+ * 1st, if nWrite > 0
+ * Send a start condition
+ * Send the slave address (1 or 2 bytes) with write flag
+ * Write n bytes from WriteBuffer
+ * 2nd, if nRead > 0
+ * Send a start condition [again]
+ * Send the slave address (1 or 2 bytes) with read flag
+ * Read n bytes to ReadBuffer
+ * 3rd, if a Start condition has been successfully sent,
+ * Send a Stop condition.
+ *
+ * The functions exits immediately when an error occures,
+ * not proceeding any data left. However, step 3 will
+ * be executed anyway to leave the bus in clean idle state.
+ */
+
+static Bool
+I2CWriteRead(I2CDevPtr d,
+ I2CByte * WriteBuffer, int nWrite, I2CByte * ReadBuffer, int nRead)
+{
+ Bool r = TRUE;
+ I2CBusPtr b = d->pI2CBus;
+ int s = 0;
+
+ if (r && nWrite > 0) {
+ r = b->I2CAddress(d, d->SlaveAddr & ~1);
+ if (r) {
+ for (; nWrite > 0; WriteBuffer++, nWrite--)
+ if (!(r = b->I2CPutByte(d, *WriteBuffer)))
+ break;
+ s++;
+ }
+ }
+
+ if (r && nRead > 0) {
+ r = b->I2CAddress(d, d->SlaveAddr | 1);
+ if (r) {
+ for (; nRead > 0; ReadBuffer++, nRead--)
+ if (!(r = b->I2CGetByte(d, ReadBuffer, nRead == 1)))
+ break;
+ s++;
+ }
+ }
+
+ if (s)
+ b->I2CStop(d);
+
+ return r;
+}
+
+/* wrapper - for compatibility and convinience */
+
+Bool
+xf86I2CWriteRead(I2CDevPtr d,
+ I2CByte * WriteBuffer, int nWrite,
+ I2CByte * ReadBuffer, int nRead)
+{
+ I2CBusPtr b = d->pI2CBus;
+
+ return b->I2CWriteRead(d, WriteBuffer, nWrite, ReadBuffer, nRead);
+}
+
+/* Read a byte, the only readable register of a device.
+ */
+
+Bool
+xf86I2CReadStatus(I2CDevPtr d, I2CByte * pbyte)
+{
+ return xf86I2CWriteRead(d, NULL, 0, pbyte, 1);
+}
+
+/* Read a byte from one of the registers determined by its sub-address.
+ */
+
+Bool
+xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte * pbyte)
+{
+ return xf86I2CWriteRead(d, &subaddr, 1, pbyte, 1);
+}
+
+/* Read bytes from subsequent registers determined by the
+ * sub-address of the first register.
+ */
+
+Bool
+xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte * pbyte, int n)
+{
+ return xf86I2CWriteRead(d, &subaddr, 1, pbyte, n);
+}
+
+/* Read a word (high byte, then low byte) from one of the registers
+ * determined by its sub-address.
+ */
+
+Bool
+xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr, unsigned short *pword)
+{
+ I2CByte rb[2];
+
+ if (!xf86I2CWriteRead(d, &subaddr, 1, rb, 2))
+ return FALSE;
+
+ *pword = (rb[0] << 8) | rb[1];
+
+ return TRUE;
+}
+
+/* Write a byte to one of the registers determined by its sub-address.
+ */
+
+Bool
+xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr, I2CByte byte)
+{
+ I2CByte wb[2];
+
+ wb[0] = subaddr;
+ wb[1] = byte;
+
+ return xf86I2CWriteRead(d, wb, 2, NULL, 0);
+}
+
+/* Write bytes to subsequent registers determined by the
+ * sub-address of the first register.
+ */
+
+Bool
+xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr,
+ I2CByte * WriteBuffer, int nWrite)
+{
+ I2CBusPtr b = d->pI2CBus;
+ Bool r = TRUE;
+
+ if (nWrite > 0) {
+ r = b->I2CAddress(d, d->SlaveAddr & ~1);
+ if (r) {
+ if ((r = b->I2CPutByte(d, subaddr)))
+ for (; nWrite > 0; WriteBuffer++, nWrite--)
+ if (!(r = b->I2CPutByte(d, *WriteBuffer)))
+ break;
+
+ b->I2CStop(d);
+ }
+ }
+
+ return r;
+}
+
+/* Write a word (high byte, then low byte) to one of the registers
+ * determined by its sub-address.
+ */
+
+Bool
+xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr, unsigned short word)
+{
+ I2CByte wb[3];
+
+ wb[0] = subaddr;
+ wb[1] = word >> 8;
+ wb[2] = word & 0xFF;
+
+ return xf86I2CWriteRead(d, wb, 3, NULL, 0);
+}
+
+/* Write a vector of bytes to not adjacent registers. This vector is,
+ * 1st byte sub-address, 2nd byte value, 3rd byte sub-address asf.
+ * This function is intended to initialize devices. Note this function
+ * exits immediately when an error occurs, some registers may
+ * remain uninitialized.
+ */
+
+Bool
+xf86I2CWriteVec(I2CDevPtr d, I2CByte * vec, int nValues)
+{
+ I2CBusPtr b = d->pI2CBus;
+ Bool r = TRUE;
+ int s = 0;
+
+ if (nValues > 0) {
+ for (; nValues > 0; nValues--, vec += 2) {
+ if (!(r = b->I2CAddress(d, d->SlaveAddr & ~1)))
+ break;
+
+ s++;
+
+ if (!(r = b->I2CPutByte(d, vec[0])))
+ break;
+
+ if (!(r = b->I2CPutByte(d, vec[1])))
+ break;
+ }
+
+ if (s > 0)
+ b->I2CStop(d);
+ }
+
+ return r;
+}
+
+/* Administrative functions.
+ * =========================
+ */
+
+/* Allocates an I2CDevRec for you and initializes with propper defaults
+ * you may modify before calling xf86I2CDevInit. Your I2CDevRec must
+ * contain at least a SlaveAddr, and a pI2CBus pointer to the bus this
+ * device shall be linked to.
+ *
+ * See function I2CAddress for the slave address format. Always set
+ * the least significant bit, indicating a read or write access, to zero.
+ */
+
+I2CDevPtr
+xf86CreateI2CDevRec(void)
+{
+ return calloc(1, sizeof(I2CDevRec));
+}
+
+/* Unlink an I2C device. If you got the I2CDevRec from xf86CreateI2CDevRec
+ * you should set <unalloc> to free it.
+ */
+
+void
+xf86DestroyI2CDevRec(I2CDevPtr d, Bool unalloc)
+{
+ if (d) {
+ I2CDevPtr *p;
+
+ /* Remove this from the list of active I2C devices. */
+
+ for (p = &d->pI2CBus->FirstDev; *p != NULL; p = &(*p)->NextDev)
+ if (*p == d) {
+ *p = (*p)->NextDev;
+ break;
+ }
+
+ xf86DrvMsg(d->pI2CBus->scrnIndex, X_INFO,
+ "I2C device \"%s:%s\" removed.\n",
+ d->pI2CBus->BusName, d->DevName);
+
+ if (unalloc)
+ free(d);
+ }
+}
+
+/* I2C transmissions are related to an I2CDevRec you must link to a
+ * previously registered bus (see xf86I2CBusInit) before attempting
+ * to read and write data. You may call xf86I2CProbeAddress first to
+ * see if the device in question is present on this bus.
+ *
+ * xf86I2CDevInit will not allocate an I2CBusRec for you, instead you
+ * may enter a pointer to a statically allocated I2CDevRec or the (modified)
+ * result of xf86CreateI2CDevRec.
+ *
+ * If you don't specify timeouts for the device (n <= 0), it will inherit
+ * the bus-wide defaults. The function returns TRUE on success.
+ */
+
+Bool
+xf86I2CDevInit(I2CDevPtr d)
+{
+ I2CBusPtr b;
+
+ if (d == NULL ||
+ (b = d->pI2CBus) == NULL ||
+ (d->SlaveAddr & 1) || xf86I2CFindDev(b, d->SlaveAddr) != NULL)
+ return FALSE;
+
+ if (d->BitTimeout <= 0)
+ d->BitTimeout = b->BitTimeout;
+ if (d->ByteTimeout <= 0)
+ d->ByteTimeout = b->ByteTimeout;
+ if (d->AcknTimeout <= 0)
+ d->AcknTimeout = b->AcknTimeout;
+ if (d->StartTimeout <= 0)
+ d->StartTimeout = b->StartTimeout;
+
+ d->NextDev = b->FirstDev;
+ b->FirstDev = d;
+
+ xf86DrvMsg(b->scrnIndex, X_INFO,
+ "I2C device \"%s:%s\" registered at address 0x%02X.\n",
+ b->BusName, d->DevName, d->SlaveAddr);
+
+ return TRUE;
+}
+
+I2CDevPtr
+xf86I2CFindDev(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ I2CDevPtr d;
+
+ if (b) {
+ for (d = b->FirstDev; d != NULL; d = d->NextDev)
+ if (d->SlaveAddr == addr)
+ return d;
+ }
+
+ return NULL;
+}
+
+static I2CBusPtr I2CBusList;
+
+/* Allocates an I2CBusRec for you and initializes with propper defaults
+ * you may modify before calling xf86I2CBusInit. Your I2CBusRec must
+ * contain at least a BusName, a scrnIndex (or -1), and a complete set
+ * of either high or low level I2C function pointers. You may pass
+ * bus-wide timeouts, otherwise inplausible values will be replaced
+ * with safe defaults.
+ */
+
+I2CBusPtr
+xf86CreateI2CBusRec(void)
+{
+ I2CBusPtr b;
+
+ b = (I2CBusPtr) calloc(1, sizeof(I2CBusRec));
+
+ if (b != NULL) {
+ b->scrnIndex = -1;
+ b->HoldTime = 5; /* 100 kHz bus */
+ b->BitTimeout = 5;
+ b->ByteTimeout = 5;
+ b->AcknTimeout = 5;
+ b->StartTimeout = 5;
+ b->RiseFallTime = RISEFALLTIME;
+ }
+
+ return b;
+}
+
+/* Unregister an I2C bus. If you got the I2CBusRec from xf86CreateI2CBusRec
+ * you should set <unalloc> to free it. If you set <devs_too>, the function
+ * xf86DestroyI2CDevRec will be called for all devices linked to the bus
+ * first, passing down the <unalloc> option.
+ */
+
+void
+xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too)
+{
+ if (b) {
+ I2CBusPtr *p;
+
+ /* Remove this from the list of active I2C buses */
+
+ for (p = &I2CBusList; *p != NULL; p = &(*p)->NextBus)
+ if (*p == b) {
+ *p = (*p)->NextBus;
+ break;
+ }
+
+ if (b->FirstDev != NULL) {
+ if (devs_too) {
+ I2CDevPtr d;
+
+ while ((d = b->FirstDev) != NULL) {
+ b->FirstDev = d->NextDev;
+ xf86DestroyI2CDevRec(d, unalloc);
+ }
+ }
+ else {
+ if (unalloc) {
+ xf86Msg(X_ERROR,
+ "i2c bug: Attempt to remove I2C bus \"%s\", "
+ "but device list is not empty.\n", b->BusName);
+ return;
+ }
+ }
+ }
+
+ xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" removed.\n",
+ b->BusName);
+
+ if (unalloc)
+ free(b);
+ }
+}
+
+/* I2C masters have to register themselves using this function.
+ * It will not allocate an I2CBusRec for you, instead you may enter
+ * a pointer to a statically allocated I2CBusRec or the (modified)
+ * result of xf86CreateI2CBusRec. Returns TRUE on success.
+ *
+ * At this point there won't be any traffic on the I2C bus.
+ */
+
+Bool
+xf86I2CBusInit(I2CBusPtr b)
+{
+ /* I2C buses must be identified by a unique scrnIndex
+ * and name. If scrnIndex is unspecified (a negative value),
+ * then the name must be unique throughout the server.
+ */
+
+ if (b->BusName == NULL || xf86I2CFindBus(b->scrnIndex, b->BusName) != NULL)
+ return FALSE;
+
+ /* If the high level functions are not
+ * supplied, use the generic functions.
+ * In this case we need the low-level
+ * function.
+ */
+ if (b->I2CWriteRead == NULL) {
+ b->I2CWriteRead = I2CWriteRead;
+
+ if (b->I2CPutBits == NULL || b->I2CGetBits == NULL) {
+ if (b->I2CPutByte == NULL ||
+ b->I2CGetByte == NULL ||
+ b->I2CAddress == NULL ||
+ b->I2CStart == NULL || b->I2CStop == NULL)
+ return FALSE;
+ }
+ else {
+ b->I2CPutByte = I2CPutByte;
+ b->I2CGetByte = I2CGetByte;
+ b->I2CAddress = I2CAddress;
+ b->I2CStop = I2CStop;
+ b->I2CStart = I2CStart;
+ }
+ }
+
+ if (b->I2CUDelay == NULL)
+ b->I2CUDelay = I2CUDelay;
+
+ if (b->HoldTime < 2)
+ b->HoldTime = 5;
+ if (b->BitTimeout <= 0)
+ b->BitTimeout = b->HoldTime;
+ if (b->ByteTimeout <= 0)
+ b->ByteTimeout = b->HoldTime;
+ if (b->AcknTimeout <= 0)
+ b->AcknTimeout = b->HoldTime;
+ if (b->StartTimeout <= 0)
+ b->StartTimeout = b->HoldTime;
+
+ /* Put new bus on list. */
+
+ b->NextBus = I2CBusList;
+ I2CBusList = b;
+
+ xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" initialized.\n",
+ b->BusName);
+
+ return TRUE;
+}
+
+I2CBusPtr
+xf86I2CFindBus(int scrnIndex, char *name)
+{
+ I2CBusPtr p;
+
+ if (name != NULL)
+ for (p = I2CBusList; p != NULL; p = p->NextBus)
+ if (scrnIndex < 0 || p->scrnIndex == scrnIndex)
+ if (!strcmp(p->BusName, name))
+ return p;
+
+ return NULL;
+}
+
+/*
+ * Return an array of I2CBusPtr's related to a screen. The caller is
+ * responsible for freeing the array.
+ */
+int
+xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr ** pppI2CBus)
+{
+ I2CBusPtr pI2CBus;
+ int n = 0;
+
+ if (pppI2CBus)
+ *pppI2CBus = NULL;
+
+ for (pI2CBus = I2CBusList; pI2CBus; pI2CBus = pI2CBus->NextBus) {
+ if ((pI2CBus->scrnIndex >= 0) && (pI2CBus->scrnIndex != scrnIndex))
+ continue;
+
+ n++;
+
+ if (!pppI2CBus)
+ continue;
+
+ *pppI2CBus = xnfrealloc(*pppI2CBus, n * sizeof(I2CBusPtr));
+ (*pppI2CBus)[n - 1] = pI2CBus;
+ }
+
+ return n;
+}
diff --git a/xorg-server/hw/xfree86/i2c/xf86i2c.h b/xorg-server/hw/xfree86/i2c/xf86i2c.h
index f2ded09db..9a8fb21a3 100644
--- a/xorg-server/hw/xfree86/i2c/xf86i2c.h
+++ b/xorg-server/hw/xfree86/i2c/xf86i2c.h
@@ -2,13 +2,12 @@
* Copyright (C) 1998 Itai Nahshon, Michael Schimek
*/
-
#ifndef _XF86I2C_H
#define _XF86I2C_H
#include "regionstr.h"
-typedef unsigned char I2CByte;
+typedef unsigned char I2CByte;
typedef unsigned short I2CSlaveAddr;
typedef struct _I2CBusRec *I2CBusPtr;
@@ -17,68 +16,71 @@ typedef struct _I2CDevRec *I2CDevPtr;
/* I2C masters have to register themselves */
typedef struct _I2CBusRec {
- char * BusName;
- int scrnIndex;
-
- void (*I2CUDelay) (I2CBusPtr b, int usec);
-
- void (*I2CPutBits)(I2CBusPtr b, int scl, int sda);
- void (*I2CGetBits)(I2CBusPtr b, int *scl, int *sda);
+ char *BusName;
+ int scrnIndex;
+
+ void (*I2CUDelay) (I2CBusPtr b, int usec);
+
+ void (*I2CPutBits) (I2CBusPtr b, int scl, int sda);
+ void (*I2CGetBits) (I2CBusPtr b, int *scl, int *sda);
/* Look at the generic routines to see how these functions should behave. */
- Bool (*I2CStart) (I2CBusPtr b, int timeout);
- Bool (*I2CAddress)(I2CDevPtr d, I2CSlaveAddr);
- void (*I2CStop) (I2CDevPtr d);
- Bool (*I2CPutByte)(I2CDevPtr d, I2CByte data);
- Bool (*I2CGetByte)(I2CDevPtr d, I2CByte *data, Bool);
+ Bool (*I2CStart) (I2CBusPtr b, int timeout);
+ Bool (*I2CAddress) (I2CDevPtr d, I2CSlaveAddr);
+ void (*I2CStop) (I2CDevPtr d);
+ Bool (*I2CPutByte) (I2CDevPtr d, I2CByte data);
+ Bool (*I2CGetByte) (I2CDevPtr d, I2CByte * data, Bool);
- DevUnion DriverPrivate;
+ DevUnion DriverPrivate;
- int HoldTime; /* 1 / bus clock frequency, 5 or 2 usec */
+ int HoldTime; /* 1 / bus clock frequency, 5 or 2 usec */
- int BitTimeout; /* usec */
- int ByteTimeout; /* usec */
- int AcknTimeout; /* usec */
- int StartTimeout; /* usec */
- int RiseFallTime; /* usec */
+ int BitTimeout; /* usec */
+ int ByteTimeout; /* usec */
+ int AcknTimeout; /* usec */
+ int StartTimeout; /* usec */
+ int RiseFallTime; /* usec */
- I2CDevPtr FirstDev;
- I2CBusPtr NextBus;
- Bool (*I2CWriteRead)(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite,
- I2CByte *ReadBuffer, int nRead);
+ I2CDevPtr FirstDev;
+ I2CBusPtr NextBus;
+ Bool (*I2CWriteRead) (I2CDevPtr d, I2CByte * WriteBuffer, int nWrite,
+ I2CByte * ReadBuffer, int nRead);
} I2CBusRec;
#define CreateI2CBusRec xf86CreateI2CBusRec
extern _X_EXPORT I2CBusPtr xf86CreateI2CBusRec(void);
+
#define DestroyI2CBusRec xf86DestroyI2CBusRec
-extern _X_EXPORT void xf86DestroyI2CBusRec(I2CBusPtr pI2CBus, Bool unalloc, Bool devs_too);
+extern _X_EXPORT void xf86DestroyI2CBusRec(I2CBusPtr pI2CBus, Bool unalloc,
+ Bool devs_too);
#define I2CBusInit xf86I2CBusInit
extern _X_EXPORT Bool xf86I2CBusInit(I2CBusPtr pI2CBus);
extern _X_EXPORT I2CBusPtr xf86I2CFindBus(int scrnIndex, char *name);
-extern _X_EXPORT int xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr **pppI2CBus);
-
+extern _X_EXPORT int xf86I2CGetScreenBuses(int scrnIndex,
+ I2CBusPtr ** pppI2CBus);
/* I2C slave devices */
typedef struct _I2CDevRec {
- char * DevName;
+ char *DevName;
- int BitTimeout; /* usec */
- int ByteTimeout; /* usec */
- int AcknTimeout; /* usec */
- int StartTimeout; /* usec */
+ int BitTimeout; /* usec */
+ int ByteTimeout; /* usec */
+ int AcknTimeout; /* usec */
+ int StartTimeout; /* usec */
- I2CSlaveAddr SlaveAddr;
- I2CBusPtr pI2CBus;
- I2CDevPtr NextDev;
- DevUnion DriverPrivate;
+ I2CSlaveAddr SlaveAddr;
+ I2CBusPtr pI2CBus;
+ I2CDevPtr NextDev;
+ DevUnion DriverPrivate;
} I2CDevRec;
#define CreateI2CDevRec xf86CreateI2CDevRec
extern _X_EXPORT I2CDevPtr xf86CreateI2CDevRec(void);
extern _X_EXPORT void xf86DestroyI2CDevRec(I2CDevPtr pI2CDev, Bool unalloc);
+
#define I2CDevInit xf86I2CDevInit
extern _X_EXPORT Bool xf86I2CDevInit(I2CDevPtr pI2CDev);
extern _X_EXPORT I2CDevPtr xf86I2CFindDev(I2CBusPtr, I2CSlaveAddr);
@@ -89,18 +91,25 @@ extern _X_EXPORT I2CDevPtr xf86I2CFindDev(I2CBusPtr, I2CSlaveAddr);
extern _X_EXPORT Bool xf86I2CProbeAddress(I2CBusPtr pI2CBus, I2CSlaveAddr);
#define I2C_WriteRead xf86I2CWriteRead
-extern _X_EXPORT Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite,
- I2CByte *ReadBuffer, int nRead);
+extern _X_EXPORT Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte * WriteBuffer,
+ int nWrite, I2CByte * ReadBuffer,
+ int nRead);
#define xf86I2CRead(d, rb, nr) xf86I2CWriteRead(d, NULL, 0, rb, nr)
-extern _X_EXPORT Bool xf86I2CReadStatus(I2CDevPtr d, I2CByte *pbyte);
-extern _X_EXPORT Bool xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte);
-extern _X_EXPORT Bool xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte, int n);
-extern _X_EXPORT Bool xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr, unsigned short *pword);
+extern _X_EXPORT Bool xf86I2CReadStatus(I2CDevPtr d, I2CByte * pbyte);
+extern _X_EXPORT Bool xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr,
+ I2CByte * pbyte);
+extern _X_EXPORT Bool xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr,
+ I2CByte * pbyte, int n);
+extern _X_EXPORT Bool xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr,
+ unsigned short *pword);
#define xf86I2CWrite(d, wb, nw) xf86I2CWriteRead(d, wb, nw, NULL, 0)
-extern _X_EXPORT Bool xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr, I2CByte byte);
-extern _X_EXPORT Bool xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *WriteBuffer, int nWrite);
-extern _X_EXPORT Bool xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr, unsigned short word);
-extern _X_EXPORT Bool xf86I2CWriteVec(I2CDevPtr d, I2CByte *vec, int nValues);
+extern _X_EXPORT Bool xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr,
+ I2CByte byte);
+extern _X_EXPORT Bool xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr,
+ I2CByte * WriteBuffer, int nWrite);
+extern _X_EXPORT Bool xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr,
+ unsigned short word);
+extern _X_EXPORT Bool xf86I2CWriteVec(I2CDevPtr d, I2CByte * vec, int nValues);
#endif /*_XF86I2C_H */
diff --git a/xorg-server/hw/xfree86/int10/generic.c b/xorg-server/hw/xfree86/int10/generic.c
index fbc9b8507..8614e0b9b 100644
--- a/xorg-server/hw/xfree86/int10/generic.c
+++ b/xorg-server/hw/xfree86/int10/generic.c
@@ -20,12 +20,12 @@
#define ALLOC_ENTRIES(x) ((V_RAM / x) - 1)
-static CARD8 read_b(xf86Int10InfoPtr pInt,int addr);
-static CARD16 read_w(xf86Int10InfoPtr pInt,int addr);
-static CARD32 read_l(xf86Int10InfoPtr pInt,int addr);
-static void write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val);
-static void write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val);
-static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val);
+static CARD8 read_b(xf86Int10InfoPtr pInt, int addr);
+static CARD16 read_w(xf86Int10InfoPtr pInt, int addr);
+static CARD32 read_l(xf86Int10InfoPtr pInt, int addr);
+static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val);
+static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val);
+static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val);
/*
* the emulator cannot pass a pointer to the current xf86Int10InfoRec
@@ -35,11 +35,11 @@ static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val);
typedef struct {
int shift;
int entries;
- void* base;
- void* vRam;
+ void *base;
+ void *vRam;
int highMemory;
- void* sysMem;
- char* alloc;
+ void *sysMem;
+ char *alloc;
} genericInt10Priv;
#define INTPriv(x) ((genericInt10Priv*)x->private)
@@ -55,6 +55,7 @@ int10MemRec genericMem = {
static void MapVRam(xf86Int10InfoPtr pInt);
static void UnmapVRam(xf86Int10InfoPtr pInt);
+
#ifdef _PC
#define GET_HIGH_BASE(x) (((V_BIOS + (x) + getpagesize() - 1)/getpagesize()) \
* getpagesize())
@@ -66,28 +67,28 @@ xf86Int10InfoPtr
xf86ExtendedInitInt10(int entityIndex, int Flags)
{
xf86Int10InfoPtr pInt;
- void* base = 0;
- void* vbiosMem = 0;
- void* options = NULL;
+ void *base = 0;
+ void *vbiosMem = 0;
+ void *options = NULL;
int screen;
legacyVGARec vga;
-
+
screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
- options = xf86HandleInt10Options(xf86Screens[screen],entityIndex);
-
+ options = xf86HandleInt10Options(xf86Screens[screen], entityIndex);
+
if (int10skip(options)) {
- free(options);
- return NULL;
+ free(options);
+ return NULL;
}
-
- pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec));
+
+ pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec));
pInt->entityIndex = entityIndex;
if (!xf86Int10ExecSetup(pInt))
- goto error0;
+ goto error0;
pInt->mem = &genericMem;
- pInt->private = (pointer)xnfcalloc(1, sizeof(genericInt10Priv));
- INTPriv(pInt)->alloc = (pointer)xnfcalloc(1, ALLOC_ENTRIES(getpagesize()));
+ pInt->private = (pointer) xnfcalloc(1, sizeof(genericInt10Priv));
+ INTPriv(pInt)->alloc = (pointer) xnfcalloc(1, ALLOC_ENTRIES(getpagesize()));
pInt->scrnIndex = screen;
base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS);
@@ -103,69 +104,70 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
MapVRam(pInt);
#ifdef _PC
if (!sysMem)
- pci_device_map_legacy(pInt->dev, V_BIOS, BIOS_SIZE + SYS_BIOS - V_BIOS,
- PCI_DEV_MAP_FLAG_WRITABLE, &sysMem);
+ pci_device_map_legacy(pInt->dev, V_BIOS, BIOS_SIZE + SYS_BIOS - V_BIOS,
+ PCI_DEV_MAP_FLAG_WRITABLE, &sysMem);
INTPriv(pInt)->sysMem = sysMem;
if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) {
- xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
- goto error1;
+ xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
+ goto error1;
}
/*
* Retrieve everything between V_BIOS and SYS_BIOS as some system BIOSes
* have executable code there.
*/
- memset((char *)base + V_BIOS, 0, SYS_BIOS - V_BIOS);
+ memset((char *) base + V_BIOS, 0, SYS_BIOS - V_BIOS);
INTPriv(pInt)->highMemory = V_BIOS;
-
+
if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) {
- if (!xf86int10GetBiosSegment(pInt, (unsigned char *)sysMem - V_BIOS))
- goto error1;
+ if (!xf86int10GetBiosSegment(pInt, (unsigned char *) sysMem - V_BIOS))
+ goto error1;
+
+ set_return_trap(pInt);
- set_return_trap(pInt);
+ pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
+ if (!(pInt->Flags & SET_BIOS_SCRATCH))
+ pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
+ xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
- pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
- if (! (pInt->Flags & SET_BIOS_SCRATCH))
- pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
- xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
-
- } else {
- const BusType location_type = xf86int10GetBiosLocationType(pInt);
- int bios_location = V_BIOS;
+ }
+ else {
+ const BusType location_type = xf86int10GetBiosLocationType(pInt);
+ int bios_location = V_BIOS;
reset_int_vect(pInt);
- set_return_trap(pInt);
-
- switch (location_type) {
- case BUS_PCI: {
- int err;
- struct pci_device *rom_device =
- xf86GetPciInfoForEntity(pInt->entityIndex);
-
- vbiosMem = (unsigned char *)base + bios_location;
- err = pci_device_read_rom(rom_device, vbiosMem);
- if (err) {
- xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3) %s\n",
- strerror(err));
- goto error1;
- }
- INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size);
- break;
- }
- default:
- goto error1;
- }
- pInt->BIOSseg = V_BIOS >> 4;
- pInt->num = 0xe6;
- LockLegacyVGA(pInt, &vga);
- xf86ExecX86int10(pInt);
- UnlockLegacyVGA(pInt, &vga);
+ set_return_trap(pInt);
+
+ switch (location_type) {
+ case BUS_PCI:{
+ int err;
+ struct pci_device *rom_device =
+ xf86GetPciInfoForEntity(pInt->entityIndex);
+
+ vbiosMem = (unsigned char *) base + bios_location;
+ err = pci_device_read_rom(rom_device, vbiosMem);
+ if (err) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (3) %s\n",
+ strerror(err));
+ goto error1;
+ }
+ INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size);
+ break;
+ }
+ default:
+ goto error1;
+ }
+ pInt->BIOSseg = V_BIOS >> 4;
+ pInt->num = 0xe6;
+ LockLegacyVGA(pInt, &vga);
+ xf86ExecX86int10(pInt);
+ UnlockLegacyVGA(pInt, &vga);
}
#else
if (!sysMem) {
- sysMem = xnfalloc(BIOS_SIZE);
- setup_system_bios(sysMem);
+ sysMem = xnfalloc(BIOS_SIZE);
+ setup_system_bios(sysMem);
}
INTPriv(pInt)->sysMem = sysMem;
setup_int_vect(pInt);
@@ -174,11 +176,11 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
/* Retrieve the entire legacy video BIOS segment. This can be upto
* 128KiB.
*/
- vbiosMem = (char *)base + V_BIOS;
+ vbiosMem = (char *) base + V_BIOS;
memset(vbiosMem, 0, 2 * V_BIOS_SIZE);
if (pci_device_read_rom(pInt->dev, vbiosMem) < V_BIOS_SIZE) {
- xf86DrvMsg(screen, X_WARNING,
- "Unable to retrieve all of segment 0x0C0000.\n");
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x0C0000.\n");
}
/*
@@ -186,29 +188,30 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
* it).
*/
{
- int bios_location = V_BIOS;
- Bool done = FALSE;
- vbiosMem = (unsigned char *)base + bios_location;
-
- if (xf86IsEntityPrimary(entityIndex)) {
- if (int10_check_bios(screen, bios_location >> 4, vbiosMem))
- done = TRUE;
- else
- xf86DrvMsg(screen,X_INFO,
- "No legacy BIOS found -- trying PCI\n");
- }
- if (!done) {
- int err;
- struct pci_device *rom_device =
- xf86GetPciInfoForEntity(pInt->entityIndex);
-
- err = pci_device_read_rom(rom_device, vbiosMem);
- if (err) {
- xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (5) %s\n",
- strerror(err));
- goto error1;
- }
- }
+ int bios_location = V_BIOS;
+ Bool done = FALSE;
+
+ vbiosMem = (unsigned char *) base + bios_location;
+
+ if (xf86IsEntityPrimary(entityIndex)) {
+ if (int10_check_bios(screen, bios_location >> 4, vbiosMem))
+ done = TRUE;
+ else
+ xf86DrvMsg(screen, X_INFO,
+ "No legacy BIOS found -- trying PCI\n");
+ }
+ if (!done) {
+ int err;
+ struct pci_device *rom_device =
+ xf86GetPciInfoForEntity(pInt->entityIndex);
+
+ err = pci_device_read_rom(rom_device, vbiosMem);
+ if (err) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (5) %s\n",
+ strerror(err));
+ goto error1;
+ }
+ }
}
pInt->BIOSseg = V_BIOS >> 4;
@@ -228,7 +231,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
error0:
free(pInt);
free(options);
-
+
return NULL;
}
@@ -238,7 +241,8 @@ MapVRam(xf86Int10InfoPtr pInt)
int pagesize = getpagesize();
int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize;
- pci_device_map_legacy(pInt->dev, V_RAM, size, PCI_DEV_MAP_FLAG_WRITABLE, &(INTPriv(pInt)->vRam));
+ pci_device_map_legacy(pInt->dev, V_RAM, size, PCI_DEV_MAP_FLAG_WRITABLE,
+ &(INTPriv(pInt)->vRam));
pInt->io = pci_legacy_open_io(pInt->dev, 0, 64 * 1024);
}
@@ -247,7 +251,7 @@ UnmapVRam(xf86Int10InfoPtr pInt)
{
int screen = pInt->scrnIndex;
int pagesize = getpagesize();
- int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize;
+ int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize;
pci_device_unmap_legacy(pInt->dev, INTPriv(pInt)->vRam, size);
pci_device_close_io(pInt->dev, pInt->io);
@@ -265,12 +269,12 @@ void
xf86FreeInt10(xf86Int10InfoPtr pInt)
{
if (!pInt)
- return;
+ return;
#if defined (_PC)
xf86Int10SaveRestoreBIOSVars(pInt, FALSE);
#endif
if (Int10Current == pInt)
- Int10Current = NULL;
+ Int10Current = NULL;
free(INTPriv(pInt)->base);
UnmapVRam(pInt);
free(INTPriv(pInt)->alloc);
@@ -283,49 +287,50 @@ xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off)
{
int pagesize = getpagesize();
int num_pages = ALLOC_ENTRIES(pagesize);
- int i,j;
+ int i, j;
for (i = 0; i < (num_pages - num); i++) {
- if (INTPriv(pInt)->alloc[i] == 0) {
- for (j = i; j < (num + i); j++)
- if (INTPriv(pInt)->alloc[j] != 0)
- break;
- if (j == (num + i))
- break;
- i += num;
- }
+ if (INTPriv(pInt)->alloc[i] == 0) {
+ for (j = i; j < (num + i); j++)
+ if (INTPriv(pInt)->alloc[j] != 0)
+ break;
+ if (j == (num + i))
+ break;
+ i += num;
+ }
}
if (i == (num_pages - num))
- return NULL;
+ return NULL;
for (j = i; j < (i + num); j++)
- INTPriv(pInt)->alloc[j] = 1;
+ INTPriv(pInt)->alloc[j] = 1;
*off = (i + 1) * pagesize;
- return (char *)INTPriv(pInt)->base + *off;
+ return (char *) INTPriv(pInt)->base + *off;
}
void
xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
{
int pagesize = getpagesize();
- int first = (((char *)pbase - (char *)INTPriv(pInt)->base) / pagesize) - 1;
+ int first =
+ (((char *) pbase - (char *) INTPriv(pInt)->base) / pagesize) - 1;
int i;
for (i = first; i < (first + num); i++)
- INTPriv(pInt)->alloc[i] = 0;
+ INTPriv(pInt)->alloc[i] = 0;
}
#define OFF(addr) ((addr) & 0xffff)
#if defined _PC
-# define HIGH_OFFSET (INTPriv(pInt)->highMemory)
-# define HIGH_BASE V_BIOS
+#define HIGH_OFFSET (INTPriv(pInt)->highMemory)
+#define HIGH_BASE V_BIOS
#else
-# define HIGH_OFFSET SYS_BIOS
-# define HIGH_BASE SYS_BIOS
+#define HIGH_OFFSET SYS_BIOS
+#define HIGH_BASE SYS_BIOS
#endif
-# define SYS(addr) ((addr) >= HIGH_OFFSET)
+#define SYS(addr) ((addr) >= HIGH_OFFSET)
#define V_ADDR(addr) \
(SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - HIGH_BASE) \
: (((char*)(INTPriv(pInt)->base) + addr)))
@@ -371,7 +376,7 @@ read_w(xf86Int10InfoPtr pInt, int addr)
{
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
if (OFF(addr + 1) > 0)
- return V_ADDR_RW(addr);
+ return V_ADDR_RW(addr);
#endif
return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8);
}
@@ -381,26 +386,26 @@ read_l(xf86Int10InfoPtr pInt, int addr)
{
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
if (OFF(addr + 3) > 2)
- return V_ADDR_RL(addr);
+ return V_ADDR_RL(addr);
#endif
return V_ADDR_RB(addr) |
- (V_ADDR_RB(addr + 1) << 8) |
- (V_ADDR_RB(addr + 2) << 16) |
- (V_ADDR_RB(addr + 3) << 24);
+ (V_ADDR_RB(addr + 1) << 8) |
+ (V_ADDR_RB(addr + 2) << 16) | (V_ADDR_RB(addr + 3) << 24);
}
static void
write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val)
{
- V_ADDR_WB(addr,val);
+ V_ADDR_WB(addr, val);
}
static void
write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
{
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- if (OFF(addr + 1) > 0)
- { V_ADDR_WW(addr, val); }
+ if (OFF(addr + 1) > 0) {
+ V_ADDR_WW(addr, val);
+ }
#endif
V_ADDR_WB(addr, val);
V_ADDR_WB(addr + 1, val >> 8);
@@ -410,8 +415,9 @@ static void
write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
{
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- if (OFF(addr + 3) > 2)
- { V_ADDR_WL(addr, val); }
+ if (OFF(addr + 3) > 2) {
+ V_ADDR_WL(addr, val);
+ }
#endif
V_ADDR_WB(addr, val);
V_ADDR_WB(addr + 1, val >> 8);
diff --git a/xorg-server/hw/xfree86/int10/helper_exec.c b/xorg-server/hw/xfree86/int10/helper_exec.c
index 03f9f7da6..1e908778f 100644
--- a/xorg-server/hw/xfree86/int10/helper_exec.c
+++ b/xorg-server/hw/xfree86/int10/helper_exec.c
@@ -43,6 +43,7 @@ static int pciCfg1inw(CARD16 addr, CARD16 *val);
static int pciCfg1outw(CARD16 addr, CARD16 val);
static int pciCfg1inb(CARD16 addr, CARD8 *val);
static int pciCfg1outb(CARD16 addr, CARD8 val);
+
#if defined (_PC)
static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set);
#endif
@@ -53,9 +54,9 @@ int
setup_int(xf86Int10InfoPtr pInt)
{
if (pInt != Int10Current) {
- if (!MapCurrentInt10(pInt))
- return -1;
- Int10Current = pInt;
+ if (!MapCurrentInt10(pInt))
+ return -1;
+ Int10Current = pInt;
}
X86_EAX = (CARD32) pInt->ax;
X86_EBX = (CARD32) pInt->bx;
@@ -64,16 +65,18 @@ setup_int(xf86Int10InfoPtr pInt)
X86_ESI = (CARD32) pInt->si;
X86_EDI = (CARD32) pInt->di;
X86_EBP = (CARD32) pInt->bp;
- X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4;
- X86_EIP = 0x0600; X86_CS = 0x0; /* address of 'hlt' */
- X86_DS = 0x40; /* standard pc ds */
+ X86_ESP = 0x1000;
+ X86_SS = pInt->stackseg >> 4;
+ X86_EIP = 0x0600;
+ X86_CS = 0x0; /* address of 'hlt' */
+ X86_DS = 0x40; /* standard pc ds */
X86_ES = pInt->es;
X86_FS = 0;
X86_GS = 0;
X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK;
#if defined (_PC)
if (pInt->Flags & SET_BIOS_SCRATCH)
- SetResetBIOSVars(pInt, TRUE);
+ SetResetBIOSVars(pInt, TRUE);
#endif
OsBlockSignals();
return 0;
@@ -94,13 +97,13 @@ finish_int(xf86Int10InfoPtr pInt, int sig)
pInt->flags = (CARD32) X86_FLAGS;
#if defined (_PC)
if (pInt->Flags & RESTORE_BIOS_SCRATCH)
- SetResetBIOSVars(pInt, FALSE);
+ SetResetBIOSVars(pInt, FALSE);
#endif
}
/* general software interrupt handler */
CARD32
-getIntVect(xf86Int10InfoPtr pInt,int num)
+getIntVect(xf86Int10InfoPtr pInt, int num)
{
return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4);
}
@@ -116,26 +119,28 @@ int
run_bios_int(int num, xf86Int10InfoPtr pInt)
{
CARD32 eflags;
+
#ifndef _PC
/* check if bios vector is initialized */
- if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/
-
- if (num == 21 && X86_AH == 0x4e) {
- xf86DrvMsg(pInt->scrnIndex, X_NOTICE,
- "Failing Find-Matching-File on non-PC"
- " (int 21, func 4e)\n");
- X86_AX = 2;
- SET_FLAG(F_CF);
- return 1;
- } else {
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "Ignoring int 0x%02x call\n", num);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- return 1;
- }
+ if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ? */
+
+ if (num == 21 && X86_AH == 0x4e) {
+ xf86DrvMsg(pInt->scrnIndex, X_NOTICE,
+ "Failing Find-Matching-File on non-PC"
+ " (int 21, func 4e)\n");
+ X86_AX = 2;
+ SET_FLAG(F_CF);
+ return 1;
+ }
+ else {
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "Ignoring int 0x%02x call\n", num);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ return 1;
+ }
}
#endif
#ifdef PRINT_INT
@@ -144,13 +149,13 @@ run_bios_int(int num, xf86Int10InfoPtr pInt)
eflags = X86_EFLAGS;
#if 0
eflags = eflags | IF_MASK;
- X86_EFLAGS = X86_EFLAGS & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK);
+ X86_EFLAGS = X86_EFLAGS & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK);
#endif
pushw(pInt, eflags);
pushw(pInt, X86_CS);
pushw(pInt, X86_IP);
X86_CS = MEM_RW(pInt, (num << 2) + 2);
- X86_IP = MEM_RW(pInt, num << 2);
+ X86_IP = MEM_RW(pInt, num << 2);
#ifdef PRINT_INT
ErrorF("0x%x:%lx\n", X86_CS, X86_EIP);
#endif
@@ -164,12 +169,13 @@ dump_code(xf86Int10InfoPtr pInt)
int i;
CARD32 lina = SEG_ADR((CARD32), X86_CS, IP);
- xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n", lina);
- for (i=0; i<0x10; i++)
- xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n",
+ lina);
+ for (i = 0; i < 0x10; i++)
+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
xf86ErrorFVerb(3, "\n");
- for (; i<0x20; i++)
- xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
+ for (; i < 0x20; i++)
+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
xf86ErrorFVerb(3, "\n");
}
@@ -177,20 +183,20 @@ void
dump_registers(xf86Int10InfoPtr pInt)
{
xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n",
- (unsigned long)X86_EAX, (unsigned long)X86_EBX,
- (unsigned long)X86_ECX, (unsigned long)X86_EDX);
+ "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n",
+ (unsigned long) X86_EAX, (unsigned long) X86_EBX,
+ (unsigned long) X86_ECX, (unsigned long) X86_EDX);
xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n",
- (unsigned long)X86_ESP, (unsigned long)X86_EBP,
- (unsigned long)X86_ESI, (unsigned long)X86_EDI);
+ "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n",
+ (unsigned long) X86_ESP, (unsigned long) X86_EBP,
+ (unsigned long) X86_ESI, (unsigned long) X86_EDI);
xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "CS=0x%4.4x, SS=0x%4.4x,"
- " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n",
- X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS);
+ "CS=0x%4.4x, SS=0x%4.4x,"
+ " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n",
+ X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS);
xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n",
- (unsigned long)X86_EIP, (unsigned long)X86_EFLAGS);
+ "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n",
+ (unsigned long) X86_EIP, (unsigned long) X86_EFLAGS);
}
void
@@ -198,113 +204,120 @@ stack_trace(xf86Int10InfoPtr pInt)
{
int i = 0;
unsigned long stack = SEG_ADR((CARD32), X86_SS, SP);
- unsigned long tail = (CARD32)((X86_SS << 4) + 0x1000);
+ unsigned long tail = (CARD32) ((X86_SS << 4) + 0x1000);
- if (stack >= tail) return;
+ if (stack >= tail)
+ return;
xf86MsgVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack);
for (; stack < tail; stack++) {
- xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack));
- i = (i + 1) % 0x10;
- if (!i)
- xf86ErrorFVerb(3, "\n");
+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack));
+ i = (i + 1) % 0x10;
+ if (!i)
+ xf86ErrorFVerb(3, "\n");
}
if (i)
- xf86ErrorFVerb(3, "\n");
+ xf86ErrorFVerb(3, "\n");
}
int
port_rep_inb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -1 : 1;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_insb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_insb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- MEM_WB(pInt, dst, x_inb(port));
- dst += inc;
+ MEM_WB(pInt, dst, x_inb(port));
+ dst += inc;
}
return dst - base;
}
int
port_rep_inw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -2 : 2;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_insw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_insw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- MEM_WW(pInt, dst, x_inw(port));
- dst += inc;
+ MEM_WW(pInt, dst, x_inw(port));
+ dst += inc;
}
return dst - base;
}
int
port_rep_inl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -4 : 4;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_insl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_insl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- MEM_WL(pInt, dst, x_inl(port));
- dst += inc;
+ MEM_WL(pInt, dst, x_inl(port));
+ dst += inc;
}
return dst - base;
}
int
port_rep_outb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -1 : 1;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_outb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_outb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- x_outb(port, MEM_RB(pInt, dst));
- dst += inc;
+ x_outb(port, MEM_RB(pInt, dst));
+ dst += inc;
}
return dst - base;
}
int
port_rep_outw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -2 : 2;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_outw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_outw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- x_outw(port, MEM_RW(pInt, dst));
- dst += inc;
+ x_outw(port, MEM_RW(pInt, dst));
+ dst += inc;
}
return dst - base;
}
int
port_rep_outl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -4 : 4;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_outl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_outl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- x_outl(port, MEM_RL(pInt, dst));
- dst += inc;
+ x_outl(port, MEM_RL(pInt, dst));
+ dst += inc;
}
return dst - base;
}
@@ -315,25 +328,27 @@ x_inb(CARD16 port)
CARD8 val;
if (port == 0x40) {
- Int10Current->inb40time++;
- val = (CARD8)(Int10Current->inb40time >>
- ((Int10Current->inb40time & 1) << 3));
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inb(%#x) = %2.2x\n", port, val);
+ Int10Current->inb40time++;
+ val = (CARD8) (Int10Current->inb40time >>
+ ((Int10Current->inb40time & 1) << 3));
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inb(%#x) = %2.2x\n", port, val);
#ifdef __NOT_YET__
- } else if (port < 0x0100) { /* Don't interfere with mainboard */
- val = 0;
- xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "inb 0x%4.4x\n", port);
- if (xf86GetVerbosity() > 3) {
- dump_registers(Int10Current);
- stack_trace(Int10Current);
- }
-#endif /* __NOT_YET__ */
- } else if (!pciCfg1inb(port, &val)) {
- val = pci_io_read8(Int10Current->io, port);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inb(%#x) = %2.2x\n", port, val);
+ }
+ else if (port < 0x0100) { /* Don't interfere with mainboard */
+ val = 0;
+ xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "inb 0x%4.4x\n", port);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(Int10Current);
+ stack_trace(Int10Current);
+ }
+#endif /* __NOT_YET__ */
+ }
+ else if (!pciCfg1inb(port, &val)) {
+ val = pci_io_read8(Int10Current->io, port);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inb(%#x) = %2.2x\n", port, val);
}
return val;
}
@@ -344,18 +359,19 @@ x_inw(CARD16 port)
CARD16 val;
if (port == 0x5c) {
- struct timeval tv;
-
- /*
- * Emulate a PC's timer. Typical resolution is 3.26 usec.
- * Approximate this by dividing by 3.
- */
- X_GETTIMEOFDAY(&tv);
- val = (CARD16)(tv.tv_usec / 3);
- } else if (!pciCfg1inw(port, &val)) {
- val = pci_io_read16(Int10Current->io, port);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inw(%#x) = %4.4x\n", port, val);
+ struct timeval tv;
+
+ /*
+ * Emulate a PC's timer. Typical resolution is 3.26 usec.
+ * Approximate this by dividing by 3.
+ */
+ X_GETTIMEOFDAY(&tv);
+ val = (CARD16) (tv.tv_usec / 3);
+ }
+ else if (!pciCfg1inw(port, &val)) {
+ val = pci_io_read16(Int10Current->io, port);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inw(%#x) = %4.4x\n", port, val);
}
return val;
}
@@ -364,30 +380,33 @@ void
x_outb(CARD16 port, CARD8 val)
{
if ((port == 0x43) && (val == 0)) {
- struct timeval tv;
- /*
- * Emulate a PC's timer 0. Such timers typically have a resolution of
- * some .838 usec per tick, but this can only provide 1 usec per tick.
- * (Not that this matters much, given inherent emulation delays.) Use
- * the bottom bit as a byte select. See inb(0x40) above.
- */
- X_GETTIMEOFDAY(&tv);
- Int10Current->inb40time = (CARD16)(tv.tv_usec | 1);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outb(%#x, %2.2x)\n", port, val);
+ struct timeval tv;
+
+ /*
+ * Emulate a PC's timer 0. Such timers typically have a resolution of
+ * some .838 usec per tick, but this can only provide 1 usec per tick.
+ * (Not that this matters much, given inherent emulation delays.) Use
+ * the bottom bit as a byte select. See inb(0x40) above.
+ */
+ X_GETTIMEOFDAY(&tv);
+ Int10Current->inb40time = (CARD16) (tv.tv_usec | 1);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outb(%#x, %2.2x)\n", port, val);
#ifdef __NOT_YET__
- } else if (port < 0x0100) { /* Don't interfere with mainboard */
- xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "outb 0x%4.4x,0x%2.2x\n", port, val);
- if (xf86GetVerbosity() > 3) {
- dump_registers(Int10Current);
- stack_trace(Int10Current);
- }
-#endif /* __NOT_YET__ */
- } else if (!pciCfg1outb(port, val)) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outb(%#x, %2.2x)\n", port, val);
- pci_io_write8(Int10Current->io, port, val);
+ }
+ else if (port < 0x0100) { /* Don't interfere with mainboard */
+ xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "outb 0x%4.4x,0x%2.2x\n", port, val);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(Int10Current);
+ stack_trace(Int10Current);
+ }
+#endif /* __NOT_YET__ */
+ }
+ else if (!pciCfg1outb(port, val)) {
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outb(%#x, %2.2x)\n", port, val);
+ pci_io_write8(Int10Current->io, port, val);
}
}
@@ -396,9 +415,9 @@ x_outw(CARD16 port, CARD16 val)
{
if (!pciCfg1outw(port, val)) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outw(%#x, %4.4x)\n", port, val);
- pci_io_write16(Int10Current->io, port, val);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outw(%#x, %4.4x)\n", port, val);
+ pci_io_write16(Int10Current->io, port, val);
}
}
@@ -408,9 +427,9 @@ x_inl(CARD16 port)
CARD32 val;
if (!pciCfg1in(port, &val)) {
- val = pci_io_read32(Int10Current->io, port);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, val);
+ val = pci_io_read32(Int10Current->io, port);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, val);
}
return val;
}
@@ -419,46 +438,46 @@ void
x_outl(CARD16 port, CARD32 val)
{
if (!pciCfg1out(port, val)) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, val);
- pci_io_write32(Int10Current->io, port, val);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, val);
+ pci_io_write32(Int10Current->io, port, val);
}
}
CARD8
Mem_rb(CARD32 addr)
{
- return (*Int10Current->mem->rb)(Int10Current, addr);
+ return (*Int10Current->mem->rb) (Int10Current, addr);
}
CARD16
Mem_rw(CARD32 addr)
{
- return (*Int10Current->mem->rw)(Int10Current, addr);
+ return (*Int10Current->mem->rw) (Int10Current, addr);
}
CARD32
Mem_rl(CARD32 addr)
{
- return (*Int10Current->mem->rl)(Int10Current, addr);
+ return (*Int10Current->mem->rl) (Int10Current, addr);
}
void
Mem_wb(CARD32 addr, CARD8 val)
{
- (*Int10Current->mem->wb)(Int10Current, addr, val);
+ (*Int10Current->mem->wb) (Int10Current, addr, val);
}
void
Mem_ww(CARD32 addr, CARD16 val)
{
- (*Int10Current->mem->ww)(Int10Current, addr, val);
+ (*Int10Current->mem->ww) (Int10Current, addr, val);
}
void
Mem_wl(CARD32 addr, CARD32 val)
{
- (*Int10Current->mem->wl)(Int10Current, addr, val);
+ (*Int10Current->mem->wl) (Int10Current, addr, val);
}
static CARD32 PciCfg1Addr = 0;
@@ -471,43 +490,45 @@ static CARD32 PciCfg1Addr = 0;
#define PCI_OFFSET(x) ((x) & 0x000000ff)
#define PCI_TAG(x) ((x) & 0x7fffff00)
-static struct pci_device*
-pci_device_for_cfg_address (CARD32 addr)
+static struct pci_device *
+pci_device_for_cfg_address(CARD32 addr)
{
- struct pci_device *dev = NULL;
- CARD32 tag = PCI_TAG(addr);
- struct pci_slot_match slot_match = {
- .domain = PCI_DOM_FROM_TAG(tag),
- .bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)),
- .dev = PCI_DEV_FROM_TAG(tag),
- .func = PCI_FUNC_FROM_TAG(tag),
- .match_data = 0
- };
+ struct pci_device *dev = NULL;
+ CARD32 tag = PCI_TAG(addr);
+
+ struct pci_slot_match slot_match = {
+ .domain = PCI_DOM_FROM_TAG(tag),
+ .bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)),
+ .dev = PCI_DEV_FROM_TAG(tag),
+ .func = PCI_FUNC_FROM_TAG(tag),
+ .match_data = 0
+ };
- struct pci_device_iterator *iter =
- pci_slot_match_iterator_create (&slot_match);
+ struct pci_device_iterator *iter =
+ pci_slot_match_iterator_create(&slot_match);
- if (iter)
- dev = pci_device_next(iter);
+ if (iter)
+ dev = pci_device_next(iter);
- pci_iterator_destroy(iter);
+ pci_iterator_destroy(iter);
- return dev;
+ return dev;
}
static int
pciCfg1in(CARD16 addr, CARD32 *val)
{
if (addr == 0xCF8) {
- *val = PciCfg1Addr;
- return 1;
+ *val = PciCfg1Addr;
+ return 1;
}
if (addr == 0xCFC) {
- pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
- (uint32_t *)val, PCI_OFFSET(PciCfg1Addr));
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", PciCfg1Addr, *val);
- return 1;
+ pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
+ (uint32_t *) val, PCI_OFFSET(PciCfg1Addr));
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", PciCfg1Addr,
+ *val);
+ return 1;
}
return 0;
}
@@ -516,15 +537,16 @@ static int
pciCfg1out(CARD16 addr, CARD32 val)
{
if (addr == 0xCF8) {
- PciCfg1Addr = val;
- return 1;
+ PciCfg1Addr = val;
+ return 1;
}
if (addr == 0xCFC) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", PciCfg1Addr, val);
- pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr));
- return 1;
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", PciCfg1Addr,
+ val);
+ pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr), val,
+ PCI_OFFSET(PciCfg1Addr));
+ return 1;
}
return 0;
}
@@ -535,18 +557,19 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- *val = (PciCfg1Addr >> shift) & 0xffff;
- return 1;
+ shift = (addr - 0xCF8) * 8;
+ *val = (PciCfg1Addr >> shift) & 0xffff;
+ return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", PciCfg1Addr + offset, *val);
- return 1;
+ const unsigned offset = addr - 0xCFC;
+
+ pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", PciCfg1Addr + offset,
+ *val);
+ return 1;
}
return 0;
}
@@ -557,19 +580,20 @@ pciCfg1outw(CARD16 addr, CARD16 val)
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- PciCfg1Addr &= ~(0xffff << shift);
- PciCfg1Addr |= ((CARD32) val) << shift;
- return 1;
+ shift = (addr - 0xCF8) * 8;
+ PciCfg1Addr &= ~(0xffff << shift);
+ PciCfg1Addr |= ((CARD32) val) << shift;
+ return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", PciCfg1Addr + offset, val);
- pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- return 1;
+ const unsigned offset = addr - 0xCFC;
+
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", PciCfg1Addr + offset,
+ val);
+ pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr), val,
+ PCI_OFFSET(PciCfg1Addr) + offset);
+ return 1;
}
return 0;
}
@@ -580,18 +604,19 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- *val = (PciCfg1Addr >> shift) & 0xff;
- return 1;
+ shift = (addr - 0xCF8) * 8;
+ *val = (PciCfg1Addr >> shift) & 0xff;
+ return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", PciCfg1Addr + offset, *val);
- return 1;
+ const unsigned offset = addr - 0xCFC;
+
+ pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", PciCfg1Addr + offset,
+ *val);
+ return 1;
}
return 0;
}
@@ -602,19 +627,20 @@ pciCfg1outb(CARD16 addr, CARD8 val)
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- PciCfg1Addr &= ~(0xff << shift);
- PciCfg1Addr |= ((CARD32) val) << shift;
- return 1;
+ shift = (addr - 0xCF8) * 8;
+ PciCfg1Addr &= ~(0xff << shift);
+ PciCfg1Addr |= ((CARD32) val) << shift;
+ return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", PciCfg1Addr + offset, val);
- pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- return 1;
+ const unsigned offset = addr - 0xCFC;
+
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", PciCfg1Addr + offset,
+ val);
+ pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr), val,
+ PCI_OFFSET(PciCfg1Addr) + offset);
+ return 1;
}
return 0;
}
@@ -625,7 +651,7 @@ bios_checksum(const CARD8 *start, int size)
CARD8 sum = 0;
while (size-- > 0)
- sum += *start++;
+ sum += *start++;
return sum;
}
@@ -650,18 +676,18 @@ bios_checksum(const CARD8 *start, int size)
void
LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga)
{
- vga->save_msr = pci_io_read8(pInt->io, 0x03CC);
- vga->save_vse = pci_io_read8(pInt->io, 0x03C3);
+ vga->save_msr = pci_io_read8(pInt->io, 0x03CC);
+ vga->save_vse = pci_io_read8(pInt->io, 0x03C3);
#ifndef __ia64__
- vga->save_46e8 = pci_io_read8(pInt->io, 0x46E8);
+ vga->save_46e8 = pci_io_read8(pInt->io, 0x46E8);
#endif
vga->save_pos102 = pci_io_read8(pInt->io, 0x0102);
- pci_io_write8(pInt->io, 0x03C2, ~(CARD8)0x03 & vga->save_msr);
- pci_io_write8(pInt->io, 0x03C3, ~(CARD8)0x01 & vga->save_vse);
+ pci_io_write8(pInt->io, 0x03C2, ~(CARD8) 0x03 & vga->save_msr);
+ pci_io_write8(pInt->io, 0x03C3, ~(CARD8) 0x01 & vga->save_vse);
#ifndef __ia64__
- pci_io_write8(pInt->io, 0x46E8, ~(CARD8)0x08 & vga->save_46e8);
+ pci_io_write8(pInt->io, 0x46E8, ~(CARD8) 0x08 & vga->save_46e8);
#endif
- pci_io_write8(pInt->io, 0x0102, ~(CARD8)0x01 & vga->save_pos102);
+ pci_io_write8(pInt->io, 0x0102, ~(CARD8) 0x01 & vga->save_pos102);
}
void
@@ -680,20 +706,22 @@ static void
SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set)
{
int pagesize = getpagesize();
- unsigned char* base;
+ unsigned char *base;
int i;
- if (pci_device_map_legacy(pInt->dev, 0, pagesize, PCI_DEV_MAP_FLAG_WRITABLE, (void **)&base))
- return; /* eek */
+ if (pci_device_map_legacy
+ (pInt->dev, 0, pagesize, PCI_DEV_MAP_FLAG_WRITABLE, (void **) &base))
+ return; /* eek */
if (set) {
- for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
- MEM_WW(pInt, i, *(base + i));
- } else {
- for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
- *(base + i) = MEM_RW(pInt, i);
+ for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
+ MEM_WW(pInt, i, *(base + i));
}
-
+ else {
+ for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
+ *(base + i) = MEM_RW(pInt, i);
+ }
+
pci_device_unmap_legacy(pInt->dev, base, pagesize);
}
@@ -701,31 +729,32 @@ void
xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save)
{
int pagesize = getpagesize();
- unsigned char* base;
+ unsigned char *base;
int i;
if (!xf86IsEntityPrimary(pInt->entityIndex)
- || (!save && !pInt->BIOSScratch))
- return;
-
- if (pci_device_map_legacy(pInt->dev, 0, pagesize, PCI_DEV_MAP_FLAG_WRITABLE, (void **)&base))
- return; /* eek */
+ || (!save && !pInt->BIOSScratch))
+ return;
+
+ if (pci_device_map_legacy
+ (pInt->dev, 0, pagesize, PCI_DEV_MAP_FLAG_WRITABLE, (void **) &base))
+ return; /* eek */
base += BIOS_SCRATCH_OFF;
if (save) {
- if ((pInt->BIOSScratch
- = xnfalloc(BIOS_SCRATCH_LEN)))
- for (i = 0; i < BIOS_SCRATCH_LEN; i++)
- *(((char*)pInt->BIOSScratch + i)) = *(base + i);
- } else {
- if (pInt->BIOSScratch) {
- for (i = 0; i < BIOS_SCRATCH_LEN; i++)
- *(base + i) = *(pInt->BIOSScratch + i);
- free(pInt->BIOSScratch);
- pInt->BIOSScratch = NULL;
- }
- }
-
+ if ((pInt->BIOSScratch = xnfalloc(BIOS_SCRATCH_LEN)))
+ for (i = 0; i < BIOS_SCRATCH_LEN; i++)
+ *(((char *) pInt->BIOSScratch + i)) = *(base + i);
+ }
+ else {
+ if (pInt->BIOSScratch) {
+ for (i = 0; i < BIOS_SCRATCH_LEN; i++)
+ *(base + i) = *(pInt->BIOSScratch + i);
+ free(pInt->BIOSScratch);
+ pInt->BIOSScratch = NULL;
+ }
+ }
+
pci_device_unmap_legacy(pInt->dev, base - BIOS_SCRATCH_OFF, pagesize);
}
#endif
diff --git a/xorg-server/hw/xfree86/int10/helper_mem.c b/xorg-server/hw/xfree86/int10/helper_mem.c
index 9088298a9..96c598a53 100644
--- a/xorg-server/hw/xfree86/int10/helper_mem.c
+++ b/xorg-server/hw/xfree86/int10/helper_mem.c
@@ -28,29 +28,30 @@ typedef enum {
} INT10Opts;
static const OptionInfoRec INT10Options[] = {
- {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE },
- {OPT_INIT_PRIMARY, "InitPrimary", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE },
+ {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE},
+ {OPT_INIT_PRIMARY, "InitPrimary", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE},
};
#ifdef DEBUG
void
dprint(unsigned long start, unsigned long size)
{
- int i,j;
- char *c = (char *)start;
+ int i, j;
+ char *c = (char *) start;
for (j = 0; j < (size >> 4); j++) {
- char *d = c;
- ErrorF("\n0x%lx: ",(unsigned long)c);
- for (i = 0; i<16; i++)
- ErrorF("%2.2x ",(unsigned char) (*(c++)));
- c = d;
- for (i = 0; i<16; i++) {
- ErrorF("%c",((((CARD8)(*c)) > 32) && (((CARD8)(*c)) < 128)) ?
- (unsigned char) (*(c)): '.');
- c++;
- }
+ char *d = c;
+
+ ErrorF("\n0x%lx: ", (unsigned long) c);
+ for (i = 0; i < 16; i++)
+ ErrorF("%2.2x ", (unsigned char) (*(c++)));
+ c = d;
+ for (i = 0; i < 16; i++) {
+ ErrorF("%c", ((((CARD8) (*c)) > 32) && (((CARD8) (*c)) < 128)) ?
+ (unsigned char) (*(c)) : '.');
+ c++;
+ }
}
ErrorF("\n");
}
@@ -69,13 +70,13 @@ setup_int_vect(xf86Int10InfoPtr pInt)
/* let the int vects point to the SYS_BIOS seg */
for (i = 0; i < 0x80; i++) {
- MEM_WW(pInt, i << 2, 0);
- MEM_WW(pInt, (i << 2) + 2, SYS_BIOS >> 4);
+ MEM_WW(pInt, i << 2, 0);
+ MEM_WW(pInt, (i << 2) + 2, SYS_BIOS >> 4);
}
reset_int_vect(pInt);
/* font tables default location (int 1F) */
- MEM_WW(pInt,0x1f<<2,0xfa6e);
+ MEM_WW(pInt, 0x1f << 2, 0xfa6e);
/* int 11 default location (Get Equipment Configuration) */
MEM_WW(pInt, 0x11 << 2, 0xf84d);
@@ -122,7 +123,7 @@ setup_system_bios(void *base_addr)
/* set up eisa ident string */
strcpy(base + 0x0FFD9, "PCI_ISA");
/* write system model id for IBM-AT */
- *((unsigned char *)(base + 0x0FFFE)) = 0xfc;
+ *((unsigned char *) (base + 0x0FFFE)) = 0xfc;
return 1;
}
@@ -137,42 +138,42 @@ reset_int_vect(xf86Int10InfoPtr pInt)
* only be used during EGA/VGA BIOS initialisation.
*/
static const CARD8 VideoParms[] = {
- /* Timing for modes 0x00 & 0x01 */
- 0x38, 0x28, 0x2d, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
- 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
- /* Timing for modes 0x02 & 0x03 */
- 0x71, 0x50, 0x5a, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
- 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
- /* Timing for modes 0x04, 0x05 & 0x06 */
- 0x38, 0x28, 0x2d, 0x0a, 0x7f, 0x06, 0x64, 0x70,
- 0x02, 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
- /* Timing for mode 0x07 */
- 0x61, 0x50, 0x52, 0x0f, 0x19, 0x06, 0x19, 0x19,
- 0x02, 0x0d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00,
- /* Display page lengths in little endian order */
- 0x00, 0x08, /* Modes 0x00 and 0x01 */
- 0x00, 0x10, /* Modes 0x02 and 0x03 */
- 0x00, 0x40, /* Modes 0x04 and 0x05 */
- 0x00, 0x40, /* Modes 0x06 and 0x07 */
- /* Number of columns for each mode */
- 40, 40, 80, 80, 40, 40, 80, 80,
- /* CGA Mode register value for each mode */
- 0x2c, 0x28, 0x2d, 0x29, 0x2a, 0x2e, 0x1e, 0x29,
- /* Padding */
- 0x00, 0x00, 0x00, 0x00
- };
+ /* Timing for modes 0x00 & 0x01 */
+ 0x38, 0x28, 0x2d, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
+ 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
+ /* Timing for modes 0x02 & 0x03 */
+ 0x71, 0x50, 0x5a, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
+ 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
+ /* Timing for modes 0x04, 0x05 & 0x06 */
+ 0x38, 0x28, 0x2d, 0x0a, 0x7f, 0x06, 0x64, 0x70,
+ 0x02, 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
+ /* Timing for mode 0x07 */
+ 0x61, 0x50, 0x52, 0x0f, 0x19, 0x06, 0x19, 0x19,
+ 0x02, 0x0d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00,
+ /* Display page lengths in little endian order */
+ 0x00, 0x08, /* Modes 0x00 and 0x01 */
+ 0x00, 0x10, /* Modes 0x02 and 0x03 */
+ 0x00, 0x40, /* Modes 0x04 and 0x05 */
+ 0x00, 0x40, /* Modes 0x06 and 0x07 */
+ /* Number of columns for each mode */
+ 40, 40, 80, 80, 40, 40, 80, 80,
+ /* CGA Mode register value for each mode */
+ 0x2c, 0x28, 0x2d, 0x29, 0x2a, 0x2e, 0x1e, 0x29,
+ /* Padding */
+ 0x00, 0x00, 0x00, 0x00
+ };
int i;
for (i = 0; i < sizeof(VideoParms); i++)
- MEM_WB(pInt, i + (0x1000 - sizeof(VideoParms)), VideoParms[i]);
- MEM_WW(pInt, 0x1d << 2, 0x1000 - sizeof(VideoParms));
+ MEM_WB(pInt, i + (0x1000 - sizeof(VideoParms)), VideoParms[i]);
+ MEM_WW(pInt, 0x1d << 2, 0x1000 - sizeof(VideoParms));
MEM_WW(pInt, (0x1d << 2) + 2, 0);
- MEM_WW(pInt, 0x10 << 2, 0xf065);
+ MEM_WW(pInt, 0x10 << 2, 0xf065);
MEM_WW(pInt, (0x10 << 2) + 2, SYS_BIOS >> 4);
- MEM_WW(pInt, 0x42 << 2, 0xf065);
+ MEM_WW(pInt, 0x42 << 2, 0xf065);
MEM_WW(pInt, (0x42 << 2) + 2, SYS_BIOS >> 4);
- MEM_WW(pInt, 0x6D << 2, 0xf065);
+ MEM_WW(pInt, 0x6D << 2, 0xf065);
MEM_WW(pInt, (0x6D << 2) + 2, SYS_BIOS >> 4);
}
@@ -196,24 +197,22 @@ xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex)
{
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
OptionInfoPtr options = NULL;
-
+
if (pEnt->device) {
- pointer configOptions = NULL;
-
- /* Check if xf86CollectOptions() has already been called */
- if (((pEnt->index < 0) ||
- !pScrn ||
- !(configOptions = pScrn->options)) &&
- pEnt->device)
- configOptions = pEnt->device->options;
-
- if (configOptions) {
- if (!(options = (OptionInfoPtr) malloc(sizeof(INT10Options))))
- return NULL;
-
- (void)memcpy(options, INT10Options, sizeof(INT10Options));
- xf86ProcessOptions(pScrn->scrnIndex, configOptions, options);
- }
+ pointer configOptions = NULL;
+
+ /* Check if xf86CollectOptions() has already been called */
+ if (((pEnt->index < 0) ||
+ !pScrn || !(configOptions = pScrn->options)) && pEnt->device)
+ configOptions = pEnt->device->options;
+
+ if (configOptions) {
+ if (!(options = (OptionInfoPtr) malloc(sizeof(INT10Options))))
+ return NULL;
+
+ (void) memcpy(options, INT10Options, sizeof(INT10Options));
+ xf86ProcessOptions(pScrn->scrnIndex, configOptions, options);
+ }
}
free(pEnt);
@@ -221,47 +220,48 @@ xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex)
}
Bool
-int10skip(const void* options)
+int10skip(const void *options)
{
Bool noint10 = FALSE;
- if (!options) return FALSE;
-
+ if (!options)
+ return FALSE;
+
xf86GetOptValBool(options, OPT_NOINT10, &noint10);
return noint10;
}
Bool
-int10_check_bios(int scrnIndex, int codeSeg, const unsigned char* vbiosMem)
+int10_check_bios(int scrnIndex, int codeSeg, const unsigned char *vbiosMem)
{
int size;
- if ((codeSeg & 0x1f) || /* Not 512-byte aligned otherwise */
- ((codeSeg << 4) < V_BIOS) ||
- ((codeSeg << 4) >= SYS_SIZE))
- return FALSE;
+ if ((codeSeg & 0x1f) || /* Not 512-byte aligned otherwise */
+ ((codeSeg << 4) < V_BIOS) || ((codeSeg << 4) >= SYS_SIZE))
+ return FALSE;
- if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2))
- return FALSE;
+ if ((*vbiosMem != 0x55) || (*(vbiosMem + 1) != 0xAA) || !*(vbiosMem + 2))
+ return FALSE;
size = *(vbiosMem + 2) * 512;
if ((size + (codeSeg << 4)) > SYS_SIZE)
- return FALSE;
+ return FALSE;
if (bios_checksum(vbiosMem, size))
- xf86DrvMsg(scrnIndex, X_INFO, "Bad V_BIOS checksum\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Bad V_BIOS checksum\n");
return TRUE;
}
Bool
-initPrimary(const void* options)
+initPrimary(const void *options)
{
Bool initPrimary = FALSE;
- if (!options) return FALSE;
-
+ if (!options)
+ return FALSE;
+
xf86GetOptValBool(options, OPT_INIT_PRIMARY, &initPrimary);
return initPrimary;
}
@@ -272,13 +272,13 @@ xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt)
BusType location_type;
EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
+
location_type = pEnt->location.type;
free(pEnt);
return location_type;
}
-
#define CHECK_V_SEGMENT_RANGE(x) \
if (((x) << 4) < V_BIOS) { \
xf86DrvMsg(pInt->scrnIndex, X_ERROR, \
@@ -300,24 +300,24 @@ xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base)
segments[3] = ~0;
for (i = 0; segments[i] != ~0; i++) {
- unsigned char * vbiosMem;
+ unsigned char *vbiosMem;
- cs = segments[i];
+ cs = segments[i];
- CHECK_V_SEGMENT_RANGE(cs);
- vbiosMem = (unsigned char *)base + (cs << 4);
- if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) {
- break;
- }
+ CHECK_V_SEGMENT_RANGE(cs);
+ vbiosMem = (unsigned char *) base + (cs << 4);
+ if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) {
+ break;
+ }
}
if (segments[i] == ~0) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "No V_BIOS found\n");
- return FALSE;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "No V_BIOS found\n");
+ return FALSE;
}
xf86DrvMsg(pInt->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n",
- (unsigned long)cs);
+ (unsigned long) cs);
pInt->BIOSseg = cs;
return TRUE;
diff --git a/xorg-server/hw/xfree86/int10/xf86int10.c b/xorg-server/hw/xfree86/int10/xf86int10.c
index dd00e5465..df347d4dd 100644
--- a/xorg-server/hw/xfree86/int10/xf86int10.c
+++ b/xorg-server/hw/xfree86/int10/xf86int10.c
@@ -20,12 +20,13 @@
xf86Int10InfoPtr Int10Current = NULL;
static int int1A_handler(xf86Int10InfoPtr pInt);
+
#ifndef _PC
static int int42_handler(xf86Int10InfoPtr pInt);
#endif
static int intE6_handler(xf86Int10InfoPtr pInt);
static struct pci_device *findPci(xf86Int10InfoPtr pInt, unsigned short bx);
-static CARD32 pciSlotBX( const struct pci_device * pvp );
+static CARD32 pciSlotBX(const struct pci_device *pvp);
int
int_handler(xf86Int10InfoPtr pInt)
@@ -38,28 +39,27 @@ int_handler(xf86Int10InfoPtr pInt)
case 0x10:
case 0x42:
case 0x6D:
- if (getIntVect(pInt, num) == I_S_DEFAULT_INT_VECT)
- ret = int42_handler(pInt);
- break;
+ if (getIntVect(pInt, num) == I_S_DEFAULT_INT_VECT)
+ ret = int42_handler(pInt);
+ break;
#endif
case 0x1A:
- ret = int1A_handler(pInt);
- break;
+ ret = int1A_handler(pInt);
+ break;
case 0xe6:
- ret = intE6_handler(pInt);
- break;
+ ret = intE6_handler(pInt);
+ break;
default:
- break;
+ break;
}
if (!ret)
- ret = run_bios_int(num, pInt);
+ ret = run_bios_int(num, pInt);
if (!ret) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "Halting on int 0x%2.2x!\n", num);
- dump_registers(pInt);
- stack_trace(pInt);
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num);
+ dump_registers(pInt);
+ stack_trace(pInt);
}
return ret;
@@ -79,507 +79,511 @@ int42_handler(xf86Int10InfoPtr pInt)
{
switch (X86_AH) {
case 0x00:
- /* Set Video Mode */
- /* Enter: AL = video mode number */
- /* Leave: Nothing */
- /* Implemented (except for clearing the screen) */
- { /* Localise */
- unsigned int ioport;
- int i;
- CARD16 int1d, regvals, tmp;
- CARD8 mode, cgamode, cgacolour;
-
- /*
- * Ignore all mode numbers but 0x00-0x13. Some systems also ignore
- * 0x0B and 0x0C, but don't do that here.
- */
- if (X86_AL > 0x13)
- break;
-
- /*
- * You didn't think that was really the mode set, did you? There
- * are only so many slots in the video parameter table...
- */
- mode = X86_AL;
- ioport = 0x03D4;
- switch (MEM_RB(pInt, 0x0410) & 0x30) {
- case 0x30: /* MDA */
- mode = 0x07; /* Force mode to 0x07 */
- ioport = 0x03B4;
- break;
- case 0x10: /* CGA 40x25 */
- if (mode >= 0x07)
- mode = 0x01;
- break;
- case 0x20: /* CGA 80x25 (MCGA?) */
- if (mode >= 0x07)
- mode = 0x03;
- break;
- case 0x00: /* EGA/VGA */
- if (mode >= 0x07) /* Don't try MDA timings */
- mode = 0x01; /* !?!?! */
- break;
- }
-
- /* Locate data in video parameter table */
- int1d = MEM_RW(pInt, 0x1d << 2);
- regvals = ((mode >> 1) << 4) + int1d;
- cgacolour = 0x30;
- if (mode == 0x06) {
- regvals -= 0x10;
- cgacolour = 0x3F;
- }
-
- /** Update BIOS Data Area **/
-
- /* Video mode */
- MEM_WB(pInt, 0x0449, mode);
-
- /* Columns */
- tmp = MEM_RB(pInt, mode + int1d + 0x48);
- MEM_WW(pInt, 0x044A, tmp);
-
- /* Page length */
- tmp = MEM_RW(pInt, (mode & 0x06) + int1d + 0x40);
- MEM_WW(pInt, 0x044C, tmp);
-
- /* Start Address */
- MEM_WW(pInt, 0x044E, 0);
-
- /* Cursor positions, one for each display page */
- for (i = 0x0450; i < 0x0460; i += 2)
- MEM_WW(pInt, i, 0);
-
- /* Cursor start & end scanlines */
- tmp = MEM_RB(pInt, regvals + 0x0B);
- MEM_WB(pInt, 0x0460, tmp);
- tmp = MEM_RB(pInt, regvals + 0x0A);
- MEM_WB(pInt, 0x0461, tmp);
-
- /* Current display page number */
- MEM_WB(pInt, 0x0462, 0);
-
- /* CRTC I/O address */
- MEM_WW(pInt, 0x0463, ioport);
-
- /* CGA Mode register value */
- cgamode = MEM_RB(pInt, mode + int1d + 0x50);
- MEM_WB(pInt, 0x0465, cgamode);
-
- /* CGA Colour register value */
- MEM_WB(pInt, 0x0466, cgacolour);
-
- /* Rows */
- MEM_WB(pInt, 0x0484, (25 - 1));
-
- /* Program the mode */
- pci_io_write8(pInt->io, ioport + 4, cgamode & 0x37); /* Turn off screen */
- for (i = 0; i < 0x10; i++) {
- tmp = MEM_RB(pInt, regvals + i);
- pci_io_write8(pInt->io, ioport, i);
- pci_io_write8(pInt->io, ioport + 1, tmp);
- }
- pci_io_write8(pInt->io, ioport + 5, cgacolour); /* Select colour mode */
- pci_io_write8(pInt->io, ioport + 4, cgamode); /* Turn on screen */
- }
- break;
+ /* Set Video Mode */
+ /* Enter: AL = video mode number */
+ /* Leave: Nothing */
+ /* Implemented (except for clearing the screen) */
+ { /* Localise */
+ unsigned int ioport;
+ int i;
+ CARD16 int1d, regvals, tmp;
+ CARD8 mode, cgamode, cgacolour;
+
+ /*
+ * Ignore all mode numbers but 0x00-0x13. Some systems also ignore
+ * 0x0B and 0x0C, but don't do that here.
+ */
+ if (X86_AL > 0x13)
+ break;
+
+ /*
+ * You didn't think that was really the mode set, did you? There
+ * are only so many slots in the video parameter table...
+ */
+ mode = X86_AL;
+ ioport = 0x03D4;
+ switch (MEM_RB(pInt, 0x0410) & 0x30) {
+ case 0x30: /* MDA */
+ mode = 0x07; /* Force mode to 0x07 */
+ ioport = 0x03B4;
+ break;
+ case 0x10: /* CGA 40x25 */
+ if (mode >= 0x07)
+ mode = 0x01;
+ break;
+ case 0x20: /* CGA 80x25 (MCGA?) */
+ if (mode >= 0x07)
+ mode = 0x03;
+ break;
+ case 0x00: /* EGA/VGA */
+ if (mode >= 0x07) /* Don't try MDA timings */
+ mode = 0x01; /* !?!?! */
+ break;
+ }
+
+ /* Locate data in video parameter table */
+ int1d = MEM_RW(pInt, 0x1d << 2);
+ regvals = ((mode >> 1) << 4) + int1d;
+ cgacolour = 0x30;
+ if (mode == 0x06) {
+ regvals -= 0x10;
+ cgacolour = 0x3F;
+ }
+
+ /** Update BIOS Data Area **/
+
+ /* Video mode */
+ MEM_WB(pInt, 0x0449, mode);
+
+ /* Columns */
+ tmp = MEM_RB(pInt, mode + int1d + 0x48);
+ MEM_WW(pInt, 0x044A, tmp);
+
+ /* Page length */
+ tmp = MEM_RW(pInt, (mode & 0x06) + int1d + 0x40);
+ MEM_WW(pInt, 0x044C, tmp);
+
+ /* Start Address */
+ MEM_WW(pInt, 0x044E, 0);
+
+ /* Cursor positions, one for each display page */
+ for (i = 0x0450; i < 0x0460; i += 2)
+ MEM_WW(pInt, i, 0);
+
+ /* Cursor start & end scanlines */
+ tmp = MEM_RB(pInt, regvals + 0x0B);
+ MEM_WB(pInt, 0x0460, tmp);
+ tmp = MEM_RB(pInt, regvals + 0x0A);
+ MEM_WB(pInt, 0x0461, tmp);
+
+ /* Current display page number */
+ MEM_WB(pInt, 0x0462, 0);
+
+ /* CRTC I/O address */
+ MEM_WW(pInt, 0x0463, ioport);
+
+ /* CGA Mode register value */
+ cgamode = MEM_RB(pInt, mode + int1d + 0x50);
+ MEM_WB(pInt, 0x0465, cgamode);
+
+ /* CGA Colour register value */
+ MEM_WB(pInt, 0x0466, cgacolour);
+
+ /* Rows */
+ MEM_WB(pInt, 0x0484, (25 - 1));
+
+ /* Program the mode */
+ pci_io_write8(pInt->io, ioport + 4, cgamode & 0x37); /* Turn off screen */
+ for (i = 0; i < 0x10; i++) {
+ tmp = MEM_RB(pInt, regvals + i);
+ pci_io_write8(pInt->io, ioport, i);
+ pci_io_write8(pInt->io, ioport + 1, tmp);
+ }
+ pci_io_write8(pInt->io, ioport + 5, cgacolour); /* Select colour mode */
+ pci_io_write8(pInt->io, ioport + 4, cgamode); /* Turn on screen */
+ }
+ break;
case 0x01:
- /* Set Cursor Type */
- /* Enter: CH = starting line for cursor */
- /* CL = ending line for cursor */
- /* Leave: Nothing */
- /* Implemented */
- { /* Localise */
- unsigned int ioport = MEM_RW(pInt, 0x0463);
-
- MEM_WB(pInt, 0x0460, X86_CL);
- MEM_WB(pInt, 0x0461, X86_CH);
-
- pci_io_write8(pInt->io, ioport, 0x0A);
- pci_io_write8(pInt->io, ioport + 1, X86_CH);
- pci_io_write8(pInt->io, ioport, 0x0B);
- pci_io_write8(pInt->io, ioport + 1, X86_CL);
- }
- break;
+ /* Set Cursor Type */
+ /* Enter: CH = starting line for cursor */
+ /* CL = ending line for cursor */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ unsigned int ioport = MEM_RW(pInt, 0x0463);
+
+ MEM_WB(pInt, 0x0460, X86_CL);
+ MEM_WB(pInt, 0x0461, X86_CH);
+
+ pci_io_write8(pInt->io, ioport, 0x0A);
+ pci_io_write8(pInt->io, ioport + 1, X86_CH);
+ pci_io_write8(pInt->io, ioport, 0x0B);
+ pci_io_write8(pInt->io, ioport + 1, X86_CL);
+ }
+ break;
case 0x02:
- /* Set Cursor Position */
- /* Enter: BH = display page number */
- /* DH = row */
- /* DL = column */
- /* Leave: Nothing */
- /* Implemented */
- { /* Localise */
- unsigned int ioport;
- CARD16 offset;
-
- MEM_WB(pInt, (X86_BH << 1) + 0x0450, X86_DL);
- MEM_WB(pInt, (X86_BH << 1) + 0x0451, X86_DH);
-
- if (X86_BH != MEM_RB(pInt, 0x0462))
- break;
-
- offset = (X86_DH * MEM_RW(pInt, 0x044A)) + X86_DL;
- offset += MEM_RW(pInt, 0x044E) << 1;
-
- ioport = MEM_RW(pInt, 0x0463);
- pci_io_write8(pInt->io, ioport, 0x0E);
- pci_io_write8(pInt->io, ioport + 1, offset >> 8);
- pci_io_write8(pInt->io, ioport, 0x0F);
- pci_io_write8(pInt->io, ioport + 1, offset & 0xFF);
- }
- break;
+ /* Set Cursor Position */
+ /* Enter: BH = display page number */
+ /* DH = row */
+ /* DL = column */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ unsigned int ioport;
+ CARD16 offset;
+
+ MEM_WB(pInt, (X86_BH << 1) + 0x0450, X86_DL);
+ MEM_WB(pInt, (X86_BH << 1) + 0x0451, X86_DH);
+
+ if (X86_BH != MEM_RB(pInt, 0x0462))
+ break;
+
+ offset = (X86_DH * MEM_RW(pInt, 0x044A)) + X86_DL;
+ offset += MEM_RW(pInt, 0x044E) << 1;
+
+ ioport = MEM_RW(pInt, 0x0463);
+ pci_io_write8(pInt->io, ioport, 0x0E);
+ pci_io_write8(pInt->io, ioport + 1, offset >> 8);
+ pci_io_write8(pInt->io, ioport, 0x0F);
+ pci_io_write8(pInt->io, ioport + 1, offset & 0xFF);
+ }
+ break;
case 0x03:
- /* Get Cursor Position */
- /* Enter: BH = display page number */
- /* Leave: CH = starting line for cursor */
- /* CL = ending line for cursor */
- /* DH = row */
- /* DL = column */
- /* Implemented */
- { /* Localise */
- X86_CL = MEM_RB(pInt, 0x0460);
- X86_CH = MEM_RB(pInt, 0x0461);
- X86_DL = MEM_RB(pInt, (X86_BH << 1) + 0x0450);
- X86_DH = MEM_RB(pInt, (X86_BH << 1) + 0x0451);
- }
- break;
+ /* Get Cursor Position */
+ /* Enter: BH = display page number */
+ /* Leave: CH = starting line for cursor */
+ /* CL = ending line for cursor */
+ /* DH = row */
+ /* DL = column */
+ /* Implemented */
+ { /* Localise */
+ X86_CL = MEM_RB(pInt, 0x0460);
+ X86_CH = MEM_RB(pInt, 0x0461);
+ X86_DL = MEM_RB(pInt, (X86_BH << 1) + 0x0450);
+ X86_DH = MEM_RB(pInt, (X86_BH << 1) + 0x0451);
+ }
+ break;
case 0x04:
- /* Get Light Pen Position */
- /* Enter: Nothing */
- /* Leave: AH = 0x01 (down/triggered) or 0x00 (not) */
- /* BX = pixel column */
- /* CX = pixel row */
- /* DH = character row */
- /* DL = character column */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n", pInt->num);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- X86_AH = X86_BX = X86_CX = X86_DX = 0;
- }
- break;
+ /* Get Light Pen Position */
+ /* Enter: Nothing */
+ /* Leave: AH = 0x01 (down/triggered) or 0x00 (not) */
+ /* BX = pixel column */
+ /* CX = pixel row */
+ /* DH = character row */
+ /* DL = character column */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n",
+ pInt->num);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ X86_AH = X86_BX = X86_CX = X86_DX = 0;
+ }
+ break;
case 0x05:
- /* Set Display Page */
- /* Enter: AL = display page number */
- /* Leave: Nothing */
- /* Implemented */
- { /* Localise */
- unsigned int ioport = MEM_RW(pInt, 0x0463);
- CARD16 start;
- CARD8 x, y;
-
- /* Calculate new start address */
- MEM_WB(pInt, 0x0462, X86_AL);
- start = X86_AL * MEM_RW(pInt, 0x044C);
- MEM_WW(pInt, 0x044E, start);
- start <<= 1;
-
- /* Update start address */
- pci_io_write8(pInt->io, ioport, 0x0C);
- pci_io_write8(pInt->io, ioport + 1, start >> 8);
- pci_io_write8(pInt->io, ioport, 0x0D);
- pci_io_write8(pInt->io, ioport + 1, start & 0xFF);
-
- /* Switch cursor position */
- y = MEM_RB(pInt, (X86_AL << 1) + 0x0450);
- x = MEM_RB(pInt, (X86_AL << 1) + 0x0451);
- start += (y * MEM_RW(pInt, 0x044A)) + x;
-
- /* Update cursor position */
- pci_io_write8(pInt->io, ioport, 0x0E);
- pci_io_write8(pInt->io, ioport + 1, start >> 8);
- pci_io_write8(pInt->io, ioport, 0x0F);
- pci_io_write8(pInt->io, ioport + 1, start & 0xFF);
- }
- break;
+ /* Set Display Page */
+ /* Enter: AL = display page number */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ unsigned int ioport = MEM_RW(pInt, 0x0463);
+ CARD16 start;
+ CARD8 x, y;
+
+ /* Calculate new start address */
+ MEM_WB(pInt, 0x0462, X86_AL);
+ start = X86_AL * MEM_RW(pInt, 0x044C);
+ MEM_WW(pInt, 0x044E, start);
+ start <<= 1;
+
+ /* Update start address */
+ pci_io_write8(pInt->io, ioport, 0x0C);
+ pci_io_write8(pInt->io, ioport + 1, start >> 8);
+ pci_io_write8(pInt->io, ioport, 0x0D);
+ pci_io_write8(pInt->io, ioport + 1, start & 0xFF);
+
+ /* Switch cursor position */
+ y = MEM_RB(pInt, (X86_AL << 1) + 0x0450);
+ x = MEM_RB(pInt, (X86_AL << 1) + 0x0451);
+ start += (y * MEM_RW(pInt, 0x044A)) + x;
+
+ /* Update cursor position */
+ pci_io_write8(pInt->io, ioport, 0x0E);
+ pci_io_write8(pInt->io, ioport + 1, start >> 8);
+ pci_io_write8(pInt->io, ioport, 0x0F);
+ pci_io_write8(pInt->io, ioport + 1, start & 0xFF);
+ }
+ break;
case 0x06:
- /* Initialise or Scroll Window Up */
- /* Enter: AL = lines to scroll up */
- /* BH = attribute for blank */
- /* CH = upper y of window */
- /* CL = left x of window */
- /* DH = lower y of window */
- /* DL = right x of window */
- /* Leave: Nothing */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n",
- pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- " AL=0x%2.2x, BH=0x%2.2x,"
- " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
- X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Initialise or Scroll Window Up */
+ /* Enter: AL = lines to scroll up */
+ /* BH = attribute for blank */
+ /* CH = upper y of window */
+ /* CL = left x of window */
+ /* DH = lower y of window */
+ /* DL = right x of window */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ " AL=0x%2.2x, BH=0x%2.2x,"
+ " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
+ X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x07:
- /* Initialise or Scroll Window Down */
- /* Enter: AL = lines to scroll down */
- /* BH = attribute for blank */
- /* CH = upper y of window */
- /* CL = left x of window */
- /* DH = lower y of window */
- /* DL = right x of window */
- /* Leave: Nothing */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n",
- pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- " AL=0x%2.2x, BH=0x%2.2x,"
- " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
- X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Initialise or Scroll Window Down */
+ /* Enter: AL = lines to scroll down */
+ /* BH = attribute for blank */
+ /* CH = upper y of window */
+ /* CL = left x of window */
+ /* DH = lower y of window */
+ /* DL = right x of window */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ " AL=0x%2.2x, BH=0x%2.2x,"
+ " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
+ X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x08:
- /* Read Character and Attribute at Cursor */
- /* Enter: BH = display page number */
- /* Leave: AH = attribute */
- /* AL = character */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at"
- " Cursor\n", pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "BH=0x%2.2x\n", X86_BH);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- X86_AX = 0;
- }
- break;
+ /* Read Character and Attribute at Cursor */
+ /* Enter: BH = display page number */
+ /* Leave: AH = attribute */
+ /* AL = character */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at"
+ " Cursor\n", pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "BH=0x%2.2x\n", X86_BH);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ X86_AX = 0;
+ }
+ break;
case 0x09:
- /* Write Character and Attribute at Cursor */
- /* Enter: AL = character */
- /* BH = display page number */
- /* BL = attribute (text) or colour (graphics) */
- /* CX = replication count */
- /* Leave: Nothing */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at"
- " Cursor\n", pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
- X86_AL, X86_BH, X86_BL, X86_CX);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Write Character and Attribute at Cursor */
+ /* Enter: AL = character */
+ /* BH = display page number */
+ /* BL = attribute (text) or colour (graphics) */
+ /* CX = replication count */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at"
+ " Cursor\n", pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
+ X86_AL, X86_BH, X86_BL, X86_CX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x0a:
- /* Write Character at Cursor */
- /* Enter: AL = character */
- /* BH = display page number */
- /* BL = colour */
- /* CX = replication count */
- /* Leave: Nothing */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n",
- pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
- X86_AL, X86_BH, X86_BL, X86_CX);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Write Character at Cursor */
+ /* Enter: AL = character */
+ /* BH = display page number */
+ /* BL = colour */
+ /* CX = replication count */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
+ X86_AL, X86_BH, X86_BL, X86_CX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x0b:
- /* Set Palette, Background or Border */
- /* Enter: BH = 0x00 or 0x01 */
- /* BL = colour or palette (respectively) */
- /* Leave: Nothing */
- /* Implemented */
- { /* Localise */
- unsigned int ioport = MEM_RW(pInt, 0x0463) + 5;
- CARD8 cgacolour = MEM_RB(pInt, 0x0466);
-
- if (X86_BH) {
- cgacolour &= 0xDF;
- cgacolour |= (X86_BL & 0x01) << 5;
- } else {
- cgacolour &= 0xE0;
- cgacolour |= X86_BL & 0x1F;
- }
-
- MEM_WB(pInt, 0x0466, cgacolour);
- pci_io_write8(pInt->io, ioport, cgacolour);
- }
- break;
+ /* Set Palette, Background or Border */
+ /* Enter: BH = 0x00 or 0x01 */
+ /* BL = colour or palette (respectively) */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ unsigned int ioport = MEM_RW(pInt, 0x0463) + 5;
+ CARD8 cgacolour = MEM_RB(pInt, 0x0466);
+
+ if (X86_BH) {
+ cgacolour &= 0xDF;
+ cgacolour |= (X86_BL & 0x01) << 5;
+ }
+ else {
+ cgacolour &= 0xE0;
+ cgacolour |= X86_BL & 0x1F;
+ }
+
+ MEM_WB(pInt, 0x0466, cgacolour);
+ pci_io_write8(pInt->io, ioport, cgacolour);
+ }
+ break;
case 0x0c:
- /* Write Graphics Pixel */
- /* Enter: AL = pixel value */
- /* BH = display page number */
- /* CX = column */
- /* DX = row */
- /* Leave: Nothing */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n", pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
- X86_AL, X86_BH, X86_CX, X86_DX);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Write Graphics Pixel */
+ /* Enter: AL = pixel value */
+ /* BH = display page number */
+ /* CX = column */
+ /* DX = row */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
+ X86_AL, X86_BH, X86_CX, X86_DX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x0d:
- /* Read Graphics Pixel */
- /* Enter: BH = display page number */
- /* CX = column */
- /* DX = row */
- /* Leave: AL = pixel value */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n", pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
- X86_BH, X86_CX, X86_DX);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- X86_AL = 0;
- }
- break;
+ /* Read Graphics Pixel */
+ /* Enter: BH = display page number */
+ /* CX = column */
+ /* DX = row */
+ /* Leave: AL = pixel value */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", X86_BH, X86_CX,
+ X86_DX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ X86_AL = 0;
+ }
+ break;
case 0x0e:
- /* Write Character in Teletype Mode */
- /* Enter: AL = character */
- /* BH = display page number */
- /* BL = foreground colour */
- /* Leave: Nothing */
- /* Not Implemented */
- /* WARNING: Emulation of BEL characters will require */
- /* emulation of RTC and PC speaker I/O. */
- /* Also, this recurses through int 0x10 */
- /* which might or might not have been */
- /* installed yet. */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n",
- pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n",
- X86_AL, X86_BH, X86_BL);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Write Character in Teletype Mode */
+ /* Enter: AL = character */
+ /* BH = display page number */
+ /* BL = foreground colour */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ /* WARNING: Emulation of BEL characters will require */
+ /* emulation of RTC and PC speaker I/O. */
+ /* Also, this recurses through int 0x10 */
+ /* which might or might not have been */
+ /* installed yet. */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n",
+ X86_AL, X86_BH, X86_BL);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x0f:
- /* Get Video Mode */
- /* Enter: Nothing */
- /* Leave: AH = number of columns */
- /* AL = video mode number */
- /* BH = display page number */
- /* Implemented */
- { /* Localise */
- X86_AH = MEM_RW(pInt, 0x044A);
- X86_AL = MEM_RB(pInt, 0x0449);
- X86_BH = MEM_RB(pInt, 0x0462);
- }
- break;
+ /* Get Video Mode */
+ /* Enter: Nothing */
+ /* Leave: AH = number of columns */
+ /* AL = video mode number */
+ /* BH = display page number */
+ /* Implemented */
+ { /* Localise */
+ X86_AH = MEM_RW(pInt, 0x044A);
+ X86_AL = MEM_RB(pInt, 0x0449);
+ X86_BH = MEM_RB(pInt, 0x0462);
+ }
+ break;
case 0x10:
- /* Colour Control (subfunction in AL) */
- /* Enter: Various */
- /* Leave: Various */
- /* Ignored */
- break;
+ /* Colour Control (subfunction in AL) */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored */
+ break;
case 0x11:
- /* Font Control (subfunction in AL) */
- /* Enter: Various */
- /* Leave: Various */
- /* Ignored */
- break;
+ /* Font Control (subfunction in AL) */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored */
+ break;
case 0x12:
- /* Miscellaneous (subfunction in BL) */
- /* Enter: Various */
- /* Leave: Various */
- /* Ignored. Previous code here optionally allowed */
- /* the enabling and disabling of VGA, but no system */
- /* BIOS I've come across actually implements it. */
- break;
+ /* Miscellaneous (subfunction in BL) */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored. Previous code here optionally allowed */
+ /* the enabling and disabling of VGA, but no system */
+ /* BIOS I've come across actually implements it. */
+ break;
case 0x13:
- /* Write String in Teletype Mode */
- /* Enter: AL = write mode */
- /* BL = attribute (if (AL & 0x02) == 0) */
- /* CX = string length */
- /* DH = row */
- /* DL = column */
- /* ES:BP = string segment:offset */
- /* Leave: Nothing */
- /* Not Implemented */
- /* WARNING: Emulation of BEL characters will require */
- /* emulation of RTC and PC speaker I/O. */
- /* Also, this recurses through int 0x10 */
- /* which might or might not have been */
- /* installed yet. */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n",
- pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x,"
- " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n",
- X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Write String in Teletype Mode */
+ /* Enter: AL = write mode */
+ /* BL = attribute (if (AL & 0x02) == 0) */
+ /* CX = string length */
+ /* DH = row */
+ /* DL = column */
+ /* ES:BP = string segment:offset */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ /* WARNING: Emulation of BEL characters will require */
+ /* emulation of RTC and PC speaker I/O. */
+ /* Also, this recurses through int 0x10 */
+ /* which might or might not have been */
+ /* installed yet. */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x,"
+ " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n",
+ X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
default:
- /* Various extensions */
- /* Enter: Various */
- /* Leave: Various */
- /* Ignored */
- break;
+ /* Various extensions */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored */
+ break;
}
return 1;
@@ -598,7 +602,7 @@ int42_handler(xf86Int10InfoPtr pInt)
* required.
*/
static struct pci_device *
-do_find(const struct pci_id_match *m, char n, const struct pci_device * exclude)
+do_find(const struct pci_id_match *m, char n, const struct pci_device *exclude)
{
struct pci_device *dev;
struct pci_device_iterator *iter;
@@ -607,9 +611,9 @@ do_find(const struct pci_id_match *m, char n, const struct pci_device * exclude)
iter = pci_id_match_iterator_create(m);
while ((dev = pci_device_next(iter)) != NULL) {
- if ((dev != exclude) && !(--n)) {
- break;
- }
+ if ((dev != exclude) && !(--n)) {
+ break;
+ }
}
pci_iterator_destroy(iter);
@@ -617,10 +621,9 @@ do_find(const struct pci_id_match *m, char n, const struct pci_device * exclude)
return dev;
}
-
static struct pci_device *
find_pci_device_vendor(CARD16 vendorID, CARD16 deviceID,
- char n, const struct pci_device * exclude)
+ char n, const struct pci_device *exclude)
{
struct pci_id_match m;
@@ -631,12 +634,12 @@ find_pci_device_vendor(CARD16 vendorID, CARD16 deviceID,
m.device_class = 0;
m.device_class_mask = 0;
- return do_find(& m, n, exclude);
+ return do_find(&m, n, exclude);
}
static struct pci_device *
find_pci_class(CARD8 intf, CARD8 subClass, CARD16 _class,
- char n, const struct pci_device * exclude)
+ char n, const struct pci_device *exclude)
{
struct pci_id_match m;
@@ -644,11 +647,11 @@ find_pci_class(CARD8 intf, CARD8 subClass, CARD16 _class,
m.device_id = PCI_MATCH_ANY;
m.subvendor_id = PCI_MATCH_ANY;
m.subdevice_id = PCI_MATCH_ANY;
- m.device_class = (((uint32_t)_class) << 16)
- | (((uint32_t)subClass) << 8) | intf;
+ m.device_class = (((uint32_t) _class) << 16)
+ | (((uint32_t) subClass) << 8) | intf;
m.device_class_mask = 0x00ffffff;
- return do_find(& m, n, exclude);
+ return do_find(&m, n, exclude);
}
#endif
@@ -660,18 +663,20 @@ static int
int1A_last_bus_number(struct pci_device *dev)
{
struct pci_device *d;
+
struct pci_slot_match m = { dev->domain,
- PCI_MATCH_ANY,
- PCI_MATCH_ANY,
- PCI_MATCH_ANY };
+ PCI_MATCH_ANY,
+ PCI_MATCH_ANY,
+ PCI_MATCH_ANY
+ };
struct pci_device_iterator *iter;
int i = 0;
iter = pci_slot_match_iterator_create(&m);
while ((d = pci_device_next(iter)))
- if (d->bus > i)
- i = d->bus;
+ if (d->bus > i)
+ i = d->bus;
pci_iterator_destroy(iter);
@@ -681,176 +686,181 @@ int1A_last_bus_number(struct pci_device *dev)
static int
int1A_handler(xf86Int10InfoPtr pInt)
{
- struct pci_device * const pvp = xf86GetPciInfoForEntity(pInt->entityIndex);
- struct pci_device * dev;
+ struct pci_device *const pvp = xf86GetPciInfoForEntity(pInt->entityIndex);
+ struct pci_device *dev;
if (pvp == NULL)
- return 0; /* oops */
+ return 0; /* oops */
#ifdef PRINT_INT
ErrorF("int 0x1a: ax=0x%x bx=0x%x cx=0x%x dx=0x%x di=0x%x es=0x%x\n",
- X86_EAX, X86_EBX, X86_ECX, X86_EDX, X86_EDI, X86_ESI);
+ X86_EAX, X86_EBX, X86_ECX, X86_EDX, X86_EDI, X86_ESI);
#endif
switch (X86_AX) {
case 0xb101:
- X86_EAX &= 0xFF00; /* no config space/special cycle support */
- X86_EDX = 0x20494350; /* " ICP" */
- X86_EBX = 0x0210; /* Version 2.10 */
- X86_ECX &= 0xFF00;
- X86_ECX |= int1A_last_bus_number(pvp);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ X86_EAX &= 0xFF00; /* no config space/special cycle support */
+ X86_EDX = 0x20494350; /* " ICP" */
+ X86_EBX = 0x0210; /* Version 2.10 */
+ X86_ECX &= 0xFF00;
+ X86_ECX |= int1A_last_bus_number(pvp);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
#ifdef PRINT_INT
- ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n",
- X86_EAX, X86_EDX, X86_EBX, X86_ECX, X86_EFLAGS);
+ ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n",
+ X86_EAX, X86_EDX, X86_EBX, X86_ECX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb102:
- if ( (X86_DX == pvp->vendor_id)
- && (X86_CX == pvp->device_id)
- && (X86_ESI == 0) ) {
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- X86_EBX = pciSlotBX(pvp);
- }
+ if ((X86_DX == pvp->vendor_id)
+ && (X86_CX == pvp->device_id)
+ && (X86_ESI == 0)) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ X86_EBX = pciSlotBX(pvp);
+ }
#ifdef SHOW_ALL_DEVICES
- else
- if ((dev = find_pci_device_vendor(X86_EDX, X86_ECX, X86_ESI, pvp))) {
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- X86_EBX = pciSlotBX(dev);
- }
+ else if ((dev = find_pci_device_vendor(X86_EDX, X86_ECX, X86_ESI, pvp))) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ X86_EBX = pciSlotBX(dev);
+ }
#endif
- else {
- X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ else {
+ X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", X86_EAX, X86_EBX, X86_EFLAGS);
+ ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", X86_EAX, X86_EBX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb103:
- if ( (X86_ECX & 0x00FFFFFF) == pvp->device_class ) {
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EBX = pciSlotBX(pvp);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- }
+ if ((X86_ECX & 0x00FFFFFF) == pvp->device_class) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EBX = pciSlotBX(pvp);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
#ifdef SHOW_ALL_DEVICES
- else if ((dev = find_pci_class(X86_CL, X86_CH,
- (X86_ECX & 0xffff0000) >> 16,
- X86_ESI, pvp))) {
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- X86_EBX = pciSlotBX(dev);
- }
+ else if ((dev = find_pci_class(X86_CL, X86_CH,
+ (X86_ECX & 0xffff0000) >> 16,
+ X86_ESI, pvp))) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ X86_EBX = pciSlotBX(dev);
+ }
#endif
- else {
- X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ else {
+ X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb108:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_read_u8(dev, & X86_CL, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_read_u8(dev, &X86_CL, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb109:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_read_u16(dev, & X86_CX, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_read_u16(dev, &X86_CX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb10a:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_read_u32(dev, & X86_ECX, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_read_u32(dev, &X86_ECX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb10b:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_write_u8(dev, X86_CL, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_write_u8(dev, X86_CL, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb10c:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_write_u16(dev, X86_CX, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_write_u16(dev, X86_CX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb10d:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_write_u32(dev, X86_ECX, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_write_u32(dev, X86_ECX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
default:
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x1a subfunction\n");
- dump_registers(pInt);
- if (xf86GetVerbosity() > 3)
- stack_trace(pInt);
- return 0;
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x1a subfunction\n");
+ dump_registers(pInt);
+ if (xf86GetVerbosity() > 3)
+ stack_trace(pInt);
+ return 0;
}
}
static struct pci_device *
findPci(xf86Int10InfoPtr pInt, unsigned short bx)
{
- const unsigned bus = (bx >> 8) & 0x00FF;
- const unsigned dev = (bx >> 3) & 0x001F;
- const unsigned func = (bx ) & 0x0007;
+ const unsigned bus = (bx >> 8) & 0x00FF;
+ const unsigned dev = (bx >> 3) & 0x001F;
+ const unsigned func = (bx) & 0x0007;
return pci_device_find_by_slot(pInt->dev->domain, bus, dev, func);
}
static CARD32
-pciSlotBX(const struct pci_device * pvp)
+pciSlotBX(const struct pci_device *pvp)
{
return ((pvp->bus << 8) & 0x00FF00) | (pvp->dev << 3) | (pvp->func);
}
@@ -861,14 +871,14 @@ pciSlotBX(const struct pci_device * pvp)
static int
intE6_handler(xf86Int10InfoPtr pInt)
{
- struct pci_device * pvp;
+ struct pci_device *pvp;
if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex)))
- X86_AX = (pvp->bus << 8) | (pvp->dev << 3) | (pvp->func & 0x7);
+ X86_AX = (pvp->bus << 8) | (pvp->dev << 3) | (pvp->func & 0x7);
pushw(pInt, X86_CS);
pushw(pInt, X86_IP);
X86_CS = pInt->BIOSseg;
X86_EIP = 0x0003;
- X86_ES = 0; /* standard pc es */
+ X86_ES = 0; /* standard pc es */
return 1;
}
diff --git a/xorg-server/hw/xfree86/int10/xf86int10.h b/xorg-server/hw/xfree86/int10/xf86int10.h
index 5bf326e78..36b659fd7 100644
--- a/xorg-server/hw/xfree86/int10/xf86int10.h
+++ b/xorg-server/hw/xfree86/int10/xf86int10.h
@@ -23,12 +23,12 @@ typedef struct {
int entityIndex;
int scrnIndex;
pointer cpuRegs;
- CARD16 BIOSseg;
- CARD16 inb40time;
- char * BIOSScratch;
+ CARD16 BIOSseg;
+ CARD16 inb40time;
+ char *BIOSScratch;
int Flags;
pointer private;
- struct _int10Mem* mem;
+ struct _int10Mem *mem;
int num;
int ax;
int bx;
@@ -45,12 +45,12 @@ typedef struct {
} xf86Int10InfoRec, *xf86Int10InfoPtr;
typedef struct _int10Mem {
- CARD8(*rb)(xf86Int10InfoPtr, int);
- CARD16(*rw)(xf86Int10InfoPtr, int);
- CARD32(*rl)(xf86Int10InfoPtr, int);
- void(*wb)(xf86Int10InfoPtr, int, CARD8);
- void(*ww)(xf86Int10InfoPtr, int, CARD16);
- void(*wl)(xf86Int10InfoPtr, int, CARD32);
+ CARD8 (*rb) (xf86Int10InfoPtr, int);
+ CARD16 (*rw) (xf86Int10InfoPtr, int);
+ CARD32 (*rl) (xf86Int10InfoPtr, int);
+ void (*wb) (xf86Int10InfoPtr, int, CARD8);
+ void (*ww) (xf86Int10InfoPtr, int, CARD16);
+ void (*wl) (xf86Int10InfoPtr, int, CARD32);
} int10MemRec, *int10MemPtr;
typedef struct {
@@ -59,16 +59,16 @@ typedef struct {
CARD8 save_vse;
CARD8 save_46e8;
} legacyVGARec, *legacyVGAPtr;
-
+
/* OS dependent functions */
extern _X_EXPORT xf86Int10InfoPtr xf86InitInt10(int entityIndex);
extern _X_EXPORT xf86Int10InfoPtr xf86ExtendedInitInt10(int entityIndex,
- int Flags);
+ int Flags);
extern _X_EXPORT void xf86FreeInt10(xf86Int10InfoPtr pInt);
extern _X_EXPORT void *xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num,
- int *off);
+ int *off);
extern _X_EXPORT void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase,
- int num);
+ int num);
extern _X_EXPORT pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr);
/* x86 executor related functions */
@@ -81,7 +81,7 @@ extern _X_EXPORT void xf86ExecX86int10(xf86Int10InfoPtr pInt);
#define SYS_BIOS 0xF0000
#if 1
#define BIOS_SIZE 0x10000
-#else /* a bug in DGUX requires this - let's try it */
+#else /* a bug in DGUX requires this - let's try it */
#define BIOS_SIZE (0x10000 - 1)
#endif
#define LOW_PAGE_SIZE 0x600
@@ -103,8 +103,8 @@ extern _X_EXPORT void xf86ExecX86int10(xf86Int10InfoPtr pInt);
#define X86_NT_MASK 0x00004000
#define X86_VM_MASK 0x00020000
#define X86_AC_MASK 0x00040000
-#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */
-#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */
+#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */
+#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */
#define X86_ID_MASK 0x00200000
#define MEM_RB(name, addr) (*name->mem->rb)(name, addr)
@@ -116,6 +116,7 @@ extern _X_EXPORT void xf86ExecX86int10(xf86Int10InfoPtr pInt);
/* OS dependent functions */
extern _X_EXPORT Bool MapCurrentInt10(xf86Int10InfoPtr pInt);
+
/* x86 executor related functions */
extern _X_EXPORT Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt);
@@ -135,21 +136,23 @@ void stack_trace(xf86Int10InfoPtr pInt);
CARD8 bios_checksum(const CARD8 *start, int size);
void LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga);
void UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga);
+
#if defined (_PC)
-extern _X_EXPORT void xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save);
+extern _X_EXPORT void xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt,
+ Bool save);
#endif
int port_rep_inb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
int port_rep_inw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
int port_rep_inl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
int port_rep_outb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
int port_rep_outw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
int port_rep_outl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
CARD8 x_inb(CARD16 port);
CARD16 x_inw(CARD16 port);
@@ -170,16 +173,19 @@ void setup_int_vect(xf86Int10InfoPtr pInt);
int setup_system_bios(void *base_addr);
void reset_int_vect(xf86Int10InfoPtr pInt);
void set_return_trap(xf86Int10InfoPtr pInt);
-extern _X_EXPORT void * xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex);
-Bool int10skip(const void* options);
+extern _X_EXPORT void *xf86HandleInt10Options(ScrnInfoPtr pScrn,
+ int entityIndex);
+Bool int10skip(const void *options);
Bool int10_check_bios(int scrnIndex, int codeSeg,
- const unsigned char* vbiosMem);
-Bool initPrimary(const void* options);
-extern _X_EXPORT BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt);
-extern _X_EXPORT Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base);
+ const unsigned char *vbiosMem);
+Bool initPrimary(const void *options);
+extern _X_EXPORT BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr
+ pInt);
+extern _X_EXPORT Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt,
+ void *base);
#ifdef DEBUG
void dprint(unsigned long start, unsigned long size);
#endif
-#endif /* _INT10_PRIVATE */
-#endif /* _XF86INT10_H */
+#endif /* _INT10_PRIVATE */
+#endif /* _XF86INT10_H */
diff --git a/xorg-server/hw/xfree86/int10/xf86int10module.c b/xorg-server/hw/xfree86/int10/xf86int10module.c
index 52bf0eeb1..1eb5a0783 100644
--- a/xorg-server/hw/xfree86/int10/xf86int10module.c
+++ b/xorg-server/hw/xfree86/int10/xf86int10module.c
@@ -1,43 +1,32 @@
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86str.h"
-#include "xf86Pci.h"
-#include "xf86int10.h"
-
-#ifndef MOD_NAME
-# define MOD_NAME int10
-#endif
-
-#define stringify(x) #x
-#define STRING(x) stringify(x)
-#define concat(x,y) x ## y
-#define combine(a,b) concat(a,b)
-#define NAME(x) combine(MOD_NAME,x)
-
-static XF86ModuleVersionInfo NAME(VersRec) =
-{
- STRING(NAME( )),
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData NAME(ModuleData) = {
- &NAME(VersRec),
- NULL,
- NULL
-};
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86str.h"
+#include "xf86Pci.h"
+#include "xf86int10.h"
+
+#ifndef MOD_NAME
+#define MOD_NAME int10
+#endif
+
+#define stringify(x) #x
+#define STRING(x) stringify(x)
+#define concat(x,y) x ## y
+#define combine(a,b) concat(a,b)
+#define NAME(x) combine(MOD_NAME,x)
+
+static XF86ModuleVersionInfo NAME(VersRec) = {
+ STRING(NAME()), MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 1, 0, 0, ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
+ ABI_VIDEODRV_VERSION, MOD_CLASS_NONE, {
+ 0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData NAME(ModuleData) = {
+&NAME(VersRec), NULL, NULL};
diff --git a/xorg-server/hw/xfree86/loader/loader.c b/xorg-server/hw/xfree86/loader/loader.c
index 159b61198..b72b8b89d 100644
--- a/xorg-server/hw/xfree86/loader/loader.c
+++ b/xorg-server/hw/xfree86/loader/loader.c
@@ -99,20 +99,20 @@ extern void *xorg_symbols[];
void
LoaderInit(void)
{
- xf86MsgVerb(X_INFO, 2, "Loader magic: %p\n", (void *)xorg_symbols);
+ xf86MsgVerb(X_INFO, 2, "Loader magic: %p\n", (void *) xorg_symbols);
xf86MsgVerb(X_INFO, 2, "Module ABI versions:\n");
xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC,
- GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion),
- GET_ABI_MINOR(LoaderVersionInfo.ansicVersion));
+ GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion),
+ GET_ABI_MINOR(LoaderVersionInfo.ansicVersion));
xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV,
- GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion),
- GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion));
+ GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion),
+ GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion));
xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT,
- GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion),
- GET_ABI_MINOR(LoaderVersionInfo.xinputVersion));
+ GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion),
+ GET_ABI_MINOR(LoaderVersionInfo.xinputVersion));
xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION,
- GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion),
- GET_ABI_MINOR(LoaderVersionInfo.extensionVersion));
+ GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion),
+ GET_ABI_MINOR(LoaderVersionInfo.extensionVersion));
}
@@ -130,12 +130,12 @@ LoaderOpen(const char *module, int *errmaj, int *errmin)
xf86Msg(X_INFO, "Loading %s\n", module);
if (!(ret = dlopen(module, DLOPEN_LAZY | DLOPEN_GLOBAL))) {
- xf86Msg(X_ERROR, "Failed to load %s: %s\n", module, dlerror());
- if (errmaj)
- *errmaj = LDR_NOLOAD;
- if (errmin)
- *errmin = LDR_NOLOAD;
- return NULL;
+ xf86Msg(X_ERROR, "Failed to load %s: %s\n", module, dlerror());
+ if (errmaj)
+ *errmaj = LDR_NOLOAD;
+ if (errmin)
+ *errmin = LDR_NOLOAD;
+ return NULL;
}
return ret;
@@ -149,13 +149,13 @@ LoaderSymbol(const char *name)
p = dlsym(RTLD_DEFAULT, name);
if (p != NULL)
- return p;
+ return p;
if (!global_scope)
- global_scope = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL);
+ global_scope = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL);
if (global_scope)
- return dlsym(global_scope, name);
+ return dlsym(global_scope, name);
return NULL;
}
@@ -165,7 +165,7 @@ LoaderUnload(const char *name, void *handle)
{
xf86Msg(X_INFO, "Unloading %s\n", name);
if (handle)
- dlclose(handle);
+ dlclose(handle);
}
unsigned long LoaderOptions = 0;
@@ -189,17 +189,18 @@ LoaderGetABIVersion(const char *abiclass)
const char *name;
int version;
} classes[] = {
- { ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion },
- { ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion },
- { ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion },
- { ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion },
- { ABI_CLASS_FONT, LoaderVersionInfo.fontVersion },
- { NULL, 0 }
+ {
+ ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion}, {
+ ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion}, {
+ ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion}, {
+ ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion}, {
+ ABI_CLASS_FONT, LoaderVersionInfo.fontVersion}, {
+ NULL, 0}
};
int i;
- for(i = 0; classes[i].name; i++) {
- if(!strcmp(classes[i].name, abiclass)) {
+ for (i = 0; classes[i].name; i++) {
+ if (!strcmp(classes[i].name, abiclass)) {
return classes[i].version;
}
}
diff --git a/xorg-server/hw/xfree86/loader/loadext.c b/xorg-server/hw/xfree86/loader/loadext.c
index 8380c300b..daa1abf8d 100644
--- a/xorg-server/hw/xfree86/loader/loadext.c
+++ b/xorg-server/hw/xfree86/loader/loadext.c
@@ -1,440 +1,440 @@
-/*
- * Copyright (c) 2000 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-/* Maybe this file belongs elsewhere? */
-
-#define LOADERDECLARATIONS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "loaderProcs.h"
-#include "misc.h"
-#include "xf86.h"
-
-/*
- * This should be static, but miinitext wants it. FIXME: make extension
- * initialization not completely terrible.
- */
-ExtensionModule *ExtensionModuleList = NULL;
-static int numExtensionModules = 0;
-
-static ExtensionModule *
-NewExtensionModule(void)
-{
- ExtensionModule *save = ExtensionModuleList;
- int n;
-
- /* Sanity check */
- if (!ExtensionModuleList)
- numExtensionModules = 0;
-
- n = numExtensionModules + 1;
- ExtensionModuleList = realloc(ExtensionModuleList,
- (n + 1) * sizeof(ExtensionModule));
- if (ExtensionModuleList == NULL) {
- ExtensionModuleList = save;
- return NULL;
- } else {
- numExtensionModules++;
- ExtensionModuleList[numExtensionModules].name = NULL;
- return ExtensionModuleList + (numExtensionModules - 1);
- }
-}
-
-void
-LoadExtension(ExtensionModule * e, Bool builtin)
-{
- ExtensionModule *newext;
-
- if (e == NULL || e->name == NULL)
- return;
-
- if (!(newext = NewExtensionModule()))
- return;
-
- if (builtin)
- xf86MsgVerb(X_INFO, 2, "Initializing built-in extension %s\n",
- e->name);
- else
- xf86MsgVerb(X_INFO, 2, "Loading extension %s\n", e->name);
-
- newext->name = e->name;
- newext->initFunc = e->initFunc;
- newext->disablePtr = e->disablePtr;
- newext->setupFunc = e->setupFunc;
- newext->initDependencies = e->initDependencies;
-
- if (e->setupFunc != NULL)
- e->setupFunc();
-}
-
-/*
- * Sort ExtensionModuleList according to the initialisation order
- * dependencies. The code for this is taken from BSD's tsort,
- * and carries the following copyright/license:
- *
- *
- * Copyright (c) 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Michael Rendell of Memorial University of Newfoundland.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#define NF_MARK 0x1 /* marker for cycle detection */
-#define NF_ACYCLIC 0x2 /* this node is cycle free */
-#define NF_NODEST 0x4 /* Unreachable */
-
-typedef struct node_str NODE;
-struct node_str {
- NODE **n_prevp; /* pointer to previous node's n_next */
- NODE *n_next; /* next node in graph */
- NODE **n_arcs; /* array of arcs to other nodes */
- int n_narcs; /* number of arcs in n_arcs[] */
- int n_arcsize; /* size of n_arcs[] array */
- int n_refcnt; /* # of arcs pointing to this node */
- int n_flags; /* NF_* */
- const char *n_name; /* name of this node */
-};
-
-static NODE *graph = NULL, **cycle_buf = NULL, **longest_cycle = NULL;
-static int longest = 0;
-static NODE *sorted = NULL, *last = NULL;
-
-/* Find a node in the graph (insert if not found) and return a pointer to it. */
-static NODE *
-get_node(const char *name)
-{
- NODE *n;
-
- for (n = graph; n && n->n_name && strcmp(n->n_name, name);
- n = n->n_next) ;
- if (n)
- return n;
-
- n = xnfalloc(sizeof(NODE));
-
- n->n_narcs = 0;
- n->n_arcsize = 0;
- n->n_arcs = NULL;
- n->n_refcnt = 0;
- n->n_flags = 0;
- n->n_name = name;
-
- /* Add to linked list. */
- if ((n->n_next = graph) != NULL)
- graph->n_prevp = &n->n_next;
- n->n_prevp = &graph;
- graph = n;
-
- return n;
-}
-
-/*
- * add an arc from node s1 to node s2 in the graph. If s1 or s2 are not in
- * the graph, then add them.
- */
-static void
-add_arc(const char *s1, const char *s2)
-{
- NODE *n1;
- NODE *n2;
- int bsize, i;
-
- n1 = get_node(s1);
-
- if (!strcmp(s1, s2))
- return;
-
- n2 = get_node(s2);
-
- /*
- * Check if this arc is already here.
- */
- for (i = 0; i < n1->n_narcs; i++)
- if (n1->n_arcs[i] == n2)
- return;
- /*
- * Add it.
- */
- if (n1->n_narcs == n1->n_arcsize) {
- if (!n1->n_arcsize)
- n1->n_arcsize = 10;
- bsize = n1->n_arcsize * sizeof(*n1->n_arcs) * 2;
- n1->n_arcs = xnfrealloc(n1->n_arcs, bsize);
- n1->n_arcsize = bsize / sizeof(*n1->n_arcs);
- }
- n1->n_arcs[n1->n_narcs++] = n2;
- ++n2->n_refcnt;
-}
-
-/*
- * Clear the NODEST flag from all nodes.
- */
-static void
-clear_cycle(void)
-{
- NODE *n;
-
- for (n = graph; n != NULL; n = n->n_next)
- n->n_flags &= ~NF_NODEST;
-}
-
-/* print node and remove from graph (does not actually free node) */
-static void
-remove_node(NODE * n)
-{
- NODE **np;
- NODE *newnode;
- int i;
-
-#ifdef DEBUG
- ErrorF("%s\n", n->n_name);
-#endif
- newnode = xnfalloc(sizeof(NODE));
- memcpy(newnode, n, sizeof(NODE));
- if (last)
- last->n_next = newnode;
- else
- sorted = newnode;
- last = newnode;
- newnode->n_next = NULL;
-
- for (np = n->n_arcs, i = n->n_narcs; --i >= 0; np++)
- --(*np)->n_refcnt;
- n->n_narcs = 0;
- *n->n_prevp = n->n_next;
- if (n->n_next)
- n->n_next->n_prevp = n->n_prevp;
-}
-
-static void
-free_nodes(NODE * nodelist)
-{
- NODE *n, *nextnode;
-
- for (n = nodelist; n;) {
- nextnode = n->n_next;
- free(n);
- n = nextnode;
- }
-}
-
-/* look for the longest? cycle from node from to node to. */
-static int
-find_cycle(NODE * from, NODE * to, int longest_len, int depth)
-{
- NODE **np;
- int i, len;
-
- /*
- * avoid infinite loops and ignore portions of the graph known
- * to be acyclic
- */
- if (from->n_flags & (NF_NODEST | NF_MARK | NF_ACYCLIC))
- return 0;
- from->n_flags |= NF_MARK;
-
- for (np = from->n_arcs, i = from->n_narcs; --i >= 0; np++) {
- cycle_buf[depth] = *np;
- if (*np == to) {
- if (depth + 1 > longest_len) {
- longest_len = depth + 1;
- memcpy((char *)longest_cycle,
- (char *)cycle_buf, longest_len * sizeof(NODE *));
- }
- } else {
- if ((*np)->n_flags & (NF_MARK | NF_ACYCLIC | NF_NODEST))
- continue;
- len = find_cycle(*np, to, longest_len, depth + 1);
-
-#ifdef DEBUG
- ErrorF("%*s %s->%s %d\n", depth, "",
- from->n_name, to->n_name, len);
-#endif
-
- if (len == 0)
- (*np)->n_flags |= NF_NODEST;
-
- if (len > longest_len)
- longest_len = len;
-
- if (len > 0 && !longest)
- break;
- }
- }
- from->n_flags &= ~NF_MARK;
- return longest_len;
-}
-
-/* do topological sort on graph */
-static void
-tsort(void)
-{
- NODE *n, *next;
- int cnt, i;
-
- while (graph != NULL) {
- /*
- * Keep getting rid of simple cases until there are none left,
- * if there are any nodes still in the graph, then there is
- * a cycle in it.
- */
- do {
- for (cnt = 0, n = graph; n != NULL; n = next) {
- next = n->n_next;
- if (n->n_refcnt == 0) {
- remove_node(n);
- ++cnt;
- }
- }
- } while (graph != NULL && cnt);
-
- if (graph == NULL)
- break;
-
- if (!cycle_buf) {
- /*
- * Allocate space for two cycle logs - one to be used
- * as scratch space, the other to save the longest
- * cycle.
- */
- for (cnt = 0, n = graph; n != NULL; n = n->n_next)
- ++cnt;
- cycle_buf = xnfalloc(sizeof(NODE *) * cnt);
- longest_cycle = xnfalloc(sizeof(NODE *) * cnt);
- if (cycle_buf == NULL || longest_cycle == NULL)
- return;
- }
- for (n = graph; n != NULL; n = n->n_next)
- if (!(n->n_flags & NF_ACYCLIC)) {
- if ((cnt = find_cycle(n, n, 0, 0))) {
- ErrorF("tsort: cycle in data");
- for (i = 0; i < cnt; i++)
- ErrorF("%s", longest_cycle[i]->n_name);
- remove_node(n);
- clear_cycle();
- break;
- } else {
- /* to avoid further checks */
- n->n_flags |= NF_ACYCLIC;
- clear_cycle();
- }
- }
-
- if (n == NULL)
- ErrorF("tsort: internal error -- could not find cycle");
- }
- free(cycle_buf);
- free(longest_cycle);
- if (graph)
- free_nodes(graph);
-}
-
-void
-LoaderSortExtensions(void)
-{
- int i, j;
- ExtensionModule *ext, *newList;
- NODE *node;
-
- graph = NULL;
- longest = 0;
- sorted = NULL;
- last = NULL;
- cycle_buf = NULL;
- longest_cycle = NULL;
-
- /*
- * Parse list and build the graph. Enter them in reverse order
- * because tsort() will reverse those that have no depedencies.
- */
- for (i = numExtensionModules - 1; i >= 0; i--) {
- ext = &ExtensionModuleList[i];
- add_arc(ext->name, ext->name);
-#ifdef DEBUG
- ErrorF("Extension %s:\n", ext->name);
-#endif
- if (ext->initDependencies)
- for (j = 0; ext->initDependencies[j]; j++) {
- add_arc(ext->initDependencies[j], ext->name);
-#ifdef DEBUG
- ErrorF("\t%s\n", ext->initDependencies[j]);
-#endif
- }
- }
- tsort();
- newList = xnfalloc((numExtensionModules + 1) * sizeof(ExtensionModule));
- i = 0;
- for (node = sorted; node; node = node->n_next) {
- for (j = 0; j < numExtensionModules; j++)
- if (!strcmp(node->n_name, ExtensionModuleList[j].name))
- break;
- if (j != numExtensionModules)
- newList[i++] = ExtensionModuleList[j];
- }
- if (sorted)
- free_nodes(sorted);
- if (graph)
- free_nodes(graph);
- newList[i].name = NULL;
- free(ExtensionModuleList);
- ExtensionModuleList = newList;
-#ifdef DEBUG
- for (i = 0; ExtensionModuleList[i].name; i++)
- ErrorF("Extension %s\n", ExtensionModuleList[i].name);
-#endif
-}
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* Maybe this file belongs elsewhere? */
+
+#define LOADERDECLARATIONS
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "loaderProcs.h"
+#include "misc.h"
+#include "xf86.h"
+
+/*
+ * This should be static, but miinitext wants it. FIXME: make extension
+ * initialization not completely terrible.
+ */
+ExtensionModule *ExtensionModuleList = NULL;
+static int numExtensionModules = 0;
+
+static ExtensionModule *
+NewExtensionModule(void)
+{
+ ExtensionModule *save = ExtensionModuleList;
+ int n;
+
+ /* Sanity check */
+ if (!ExtensionModuleList)
+ numExtensionModules = 0;
+
+ n = numExtensionModules + 1;
+ ExtensionModuleList = realloc(ExtensionModuleList,
+ (n + 1) * sizeof(ExtensionModule));
+ if (ExtensionModuleList == NULL) {
+ ExtensionModuleList = save;
+ return NULL;
+ }
+ else {
+ numExtensionModules++;
+ ExtensionModuleList[numExtensionModules].name = NULL;
+ return ExtensionModuleList + (numExtensionModules - 1);
+ }
+}
+
+void
+LoadExtension(ExtensionModule * e, Bool builtin)
+{
+ ExtensionModule *newext;
+
+ if (e == NULL || e->name == NULL)
+ return;
+
+ if (!(newext = NewExtensionModule()))
+ return;
+
+ if (builtin)
+ xf86MsgVerb(X_INFO, 2, "Initializing built-in extension %s\n", e->name);
+ else
+ xf86MsgVerb(X_INFO, 2, "Loading extension %s\n", e->name);
+
+ newext->name = e->name;
+ newext->initFunc = e->initFunc;
+ newext->disablePtr = e->disablePtr;
+ newext->setupFunc = e->setupFunc;
+ newext->initDependencies = e->initDependencies;
+
+ if (e->setupFunc != NULL)
+ e->setupFunc();
+}
+
+/*
+ * Sort ExtensionModuleList according to the initialisation order
+ * dependencies. The code for this is taken from BSD's tsort,
+ * and carries the following copyright/license:
+ *
+ *
+ * Copyright (c) 1989, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Michael Rendell of Memorial University of Newfoundland.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#define NF_MARK 0x1 /* marker for cycle detection */
+#define NF_ACYCLIC 0x2 /* this node is cycle free */
+#define NF_NODEST 0x4 /* Unreachable */
+
+typedef struct node_str NODE;
+struct node_str {
+ NODE **n_prevp; /* pointer to previous node's n_next */
+ NODE *n_next; /* next node in graph */
+ NODE **n_arcs; /* array of arcs to other nodes */
+ int n_narcs; /* number of arcs in n_arcs[] */
+ int n_arcsize; /* size of n_arcs[] array */
+ int n_refcnt; /* # of arcs pointing to this node */
+ int n_flags; /* NF_* */
+ const char *n_name; /* name of this node */
+};
+
+static NODE *graph = NULL, **cycle_buf = NULL, **longest_cycle = NULL;
+static int longest = 0;
+static NODE *sorted = NULL, *last = NULL;
+
+/* Find a node in the graph (insert if not found) and return a pointer to it. */
+static NODE *
+get_node(const char *name)
+{
+ NODE *n;
+
+ for (n = graph; n && n->n_name && strcmp(n->n_name, name); n = n->n_next);
+ if (n)
+ return n;
+
+ n = xnfalloc(sizeof(NODE));
+
+ n->n_narcs = 0;
+ n->n_arcsize = 0;
+ n->n_arcs = NULL;
+ n->n_refcnt = 0;
+ n->n_flags = 0;
+ n->n_name = name;
+
+ /* Add to linked list. */
+ if ((n->n_next = graph) != NULL)
+ graph->n_prevp = &n->n_next;
+ n->n_prevp = &graph;
+ graph = n;
+
+ return n;
+}
+
+/*
+ * add an arc from node s1 to node s2 in the graph. If s1 or s2 are not in
+ * the graph, then add them.
+ */
+static void
+add_arc(const char *s1, const char *s2)
+{
+ NODE *n1;
+ NODE *n2;
+ int bsize, i;
+
+ n1 = get_node(s1);
+
+ if (!strcmp(s1, s2))
+ return;
+
+ n2 = get_node(s2);
+
+ /*
+ * Check if this arc is already here.
+ */
+ for (i = 0; i < n1->n_narcs; i++)
+ if (n1->n_arcs[i] == n2)
+ return;
+ /*
+ * Add it.
+ */
+ if (n1->n_narcs == n1->n_arcsize) {
+ if (!n1->n_arcsize)
+ n1->n_arcsize = 10;
+ bsize = n1->n_arcsize * sizeof(*n1->n_arcs) * 2;
+ n1->n_arcs = xnfrealloc(n1->n_arcs, bsize);
+ n1->n_arcsize = bsize / sizeof(*n1->n_arcs);
+ }
+ n1->n_arcs[n1->n_narcs++] = n2;
+ ++n2->n_refcnt;
+}
+
+/*
+ * Clear the NODEST flag from all nodes.
+ */
+static void
+clear_cycle(void)
+{
+ NODE *n;
+
+ for (n = graph; n != NULL; n = n->n_next)
+ n->n_flags &= ~NF_NODEST;
+}
+
+/* print node and remove from graph (does not actually free node) */
+static void
+remove_node(NODE * n)
+{
+ NODE **np;
+ NODE *newnode;
+ int i;
+
+#ifdef DEBUG
+ ErrorF("%s\n", n->n_name);
+#endif
+ newnode = xnfalloc(sizeof(NODE));
+ memcpy(newnode, n, sizeof(NODE));
+ if (last)
+ last->n_next = newnode;
+ else
+ sorted = newnode;
+ last = newnode;
+ newnode->n_next = NULL;
+
+ for (np = n->n_arcs, i = n->n_narcs; --i >= 0; np++)
+ --(*np)->n_refcnt;
+ n->n_narcs = 0;
+ *n->n_prevp = n->n_next;
+ if (n->n_next)
+ n->n_next->n_prevp = n->n_prevp;
+}
+
+static void
+free_nodes(NODE * nodelist)
+{
+ NODE *n, *nextnode;
+
+ for (n = nodelist; n;) {
+ nextnode = n->n_next;
+ free(n);
+ n = nextnode;
+ }
+}
+
+/* look for the longest? cycle from node from to node to. */
+static int
+find_cycle(NODE * from, NODE * to, int longest_len, int depth)
+{
+ NODE **np;
+ int i, len;
+
+ /*
+ * avoid infinite loops and ignore portions of the graph known
+ * to be acyclic
+ */
+ if (from->n_flags & (NF_NODEST | NF_MARK | NF_ACYCLIC))
+ return 0;
+ from->n_flags |= NF_MARK;
+
+ for (np = from->n_arcs, i = from->n_narcs; --i >= 0; np++) {
+ cycle_buf[depth] = *np;
+ if (*np == to) {
+ if (depth + 1 > longest_len) {
+ longest_len = depth + 1;
+ memcpy((char *) longest_cycle,
+ (char *) cycle_buf, longest_len * sizeof(NODE *));
+ }
+ }
+ else {
+ if ((*np)->n_flags & (NF_MARK | NF_ACYCLIC | NF_NODEST))
+ continue;
+ len = find_cycle(*np, to, longest_len, depth + 1);
+
+#ifdef DEBUG
+ ErrorF("%*s %s->%s %d\n", depth, "", from->n_name, to->n_name, len);
+#endif
+
+ if (len == 0)
+ (*np)->n_flags |= NF_NODEST;
+
+ if (len > longest_len)
+ longest_len = len;
+
+ if (len > 0 && !longest)
+ break;
+ }
+ }
+ from->n_flags &= ~NF_MARK;
+ return longest_len;
+}
+
+/* do topological sort on graph */
+static void
+tsort(void)
+{
+ NODE *n, *next;
+ int cnt, i;
+
+ while (graph != NULL) {
+ /*
+ * Keep getting rid of simple cases until there are none left,
+ * if there are any nodes still in the graph, then there is
+ * a cycle in it.
+ */
+ do {
+ for (cnt = 0, n = graph; n != NULL; n = next) {
+ next = n->n_next;
+ if (n->n_refcnt == 0) {
+ remove_node(n);
+ ++cnt;
+ }
+ }
+ } while (graph != NULL && cnt);
+
+ if (graph == NULL)
+ break;
+
+ if (!cycle_buf) {
+ /*
+ * Allocate space for two cycle logs - one to be used
+ * as scratch space, the other to save the longest
+ * cycle.
+ */
+ for (cnt = 0, n = graph; n != NULL; n = n->n_next)
+ ++cnt;
+ cycle_buf = xnfalloc(sizeof(NODE *) * cnt);
+ longest_cycle = xnfalloc(sizeof(NODE *) * cnt);
+ if (cycle_buf == NULL || longest_cycle == NULL)
+ return;
+ }
+ for (n = graph; n != NULL; n = n->n_next)
+ if (!(n->n_flags & NF_ACYCLIC)) {
+ if ((cnt = find_cycle(n, n, 0, 0))) {
+ ErrorF("tsort: cycle in data");
+ for (i = 0; i < cnt; i++)
+ ErrorF("%s", longest_cycle[i]->n_name);
+ remove_node(n);
+ clear_cycle();
+ break;
+ }
+ else {
+ /* to avoid further checks */
+ n->n_flags |= NF_ACYCLIC;
+ clear_cycle();
+ }
+ }
+
+ if (n == NULL)
+ ErrorF("tsort: internal error -- could not find cycle");
+ }
+ free(cycle_buf);
+ free(longest_cycle);
+ if (graph)
+ free_nodes(graph);
+}
+
+void
+LoaderSortExtensions(void)
+{
+ int i, j;
+ ExtensionModule *ext, *newList;
+ NODE *node;
+
+ graph = NULL;
+ longest = 0;
+ sorted = NULL;
+ last = NULL;
+ cycle_buf = NULL;
+ longest_cycle = NULL;
+
+ /*
+ * Parse list and build the graph. Enter them in reverse order
+ * because tsort() will reverse those that have no depedencies.
+ */
+ for (i = numExtensionModules - 1; i >= 0; i--) {
+ ext = &ExtensionModuleList[i];
+ add_arc(ext->name, ext->name);
+#ifdef DEBUG
+ ErrorF("Extension %s:\n", ext->name);
+#endif
+ if (ext->initDependencies)
+ for (j = 0; ext->initDependencies[j]; j++) {
+ add_arc(ext->initDependencies[j], ext->name);
+#ifdef DEBUG
+ ErrorF("\t%s\n", ext->initDependencies[j]);
+#endif
+ }
+ }
+ tsort();
+ newList = xnfalloc((numExtensionModules + 1) * sizeof(ExtensionModule));
+ i = 0;
+ for (node = sorted; node; node = node->n_next) {
+ for (j = 0; j < numExtensionModules; j++)
+ if (!strcmp(node->n_name, ExtensionModuleList[j].name))
+ break;
+ if (j != numExtensionModules)
+ newList[i++] = ExtensionModuleList[j];
+ }
+ if (sorted)
+ free_nodes(sorted);
+ if (graph)
+ free_nodes(graph);
+ newList[i].name = NULL;
+ free(ExtensionModuleList);
+ ExtensionModuleList = newList;
+#ifdef DEBUG
+ for (i = 0; ExtensionModuleList[i].name; i++)
+ ErrorF("Extension %s\n", ExtensionModuleList[i].name);
+#endif
+}
diff --git a/xorg-server/hw/xfree86/loader/loadmod.c b/xorg-server/hw/xfree86/loader/loadmod.c
index 5b9c11950..c6b559072 100644
--- a/xorg-server/hw/xfree86/loader/loadmod.c
+++ b/xorg-server/hw/xfree86/loader/loadmod.c
@@ -74,16 +74,15 @@ typedef struct _pattern {
} PatternRec, *PatternPtr;
/* Prototypes for static functions */
-static char *FindModule(const char *, const char *, const char **,
- PatternPtr);
+static char *FindModule(const char *, const char *, const char **, PatternPtr);
static Bool CheckVersion(const char *, XF86ModuleVersionInfo *,
- const XF86ModReqInfo *);
+ const XF86ModReqInfo *);
static void UnloadModuleOrDriver(ModuleDescPtr mod);
static char *LoaderGetCanonicalName(const char *, PatternPtr);
static void RemoveChild(ModuleDescPtr);
static ModuleDescPtr doLoadModule(const char *, const char *, const char **,
- const char **, pointer,
- const XF86ModReqInfo *, int *, int *);
+ const char **, pointer,
+ const XF86ModReqInfo *, int *, int *);
const ModuleVersions LoaderVersionInfo = {
XORG_VERSION_CURRENT,
@@ -94,7 +93,7 @@ const ModuleVersions LoaderVersionInfo = {
ABI_FONT_VERSION
};
-static int ModuleDuplicated[] = {};
+static int ModuleDuplicated[] = { };
static void
FreeStringList(char **paths)
@@ -102,10 +101,10 @@ FreeStringList(char **paths)
char **p;
if (!paths)
- return;
+ return;
for (p = paths; *p; p++)
- free(*p);
+ free(*p);
free(paths);
}
@@ -116,7 +115,7 @@ static Bool
PathIsAbsolute(const char *path)
{
return *path == '/';
-}
+}
/*
* Convert a comma-separated path into a NULL-terminated array of path
@@ -134,46 +133,45 @@ InitPathList(const char *path)
int n = 0;
if (!path)
- return defaultPathList;
+ return defaultPathList;
fullpath = strdup(path);
if (!fullpath)
- return NULL;
+ return NULL;
elem = strtok(fullpath, ",");
while (elem) {
- if (PathIsAbsolute(elem))
- {
- len = strlen(elem);
- addslash = (elem[len - 1] != '/');
- if (addslash)
- len++;
- save = list;
- list = realloc(list, (n + 2) * sizeof(char *));
- if (!list) {
- if (save) {
- save[n] = NULL;
- FreeStringList(save);
- }
- free(fullpath);
- return NULL;
- }
- list[n] = malloc(len + 1);
- if (!list[n]) {
- FreeStringList(list);
- free(fullpath);
- return NULL;
- }
- strcpy(list[n], elem);
- if (addslash) {
- list[n][len - 1] = '/';
- list[n][len] = '\0';
- }
- n++;
- }
- elem = strtok(NULL, ",");
+ if (PathIsAbsolute(elem)) {
+ len = strlen(elem);
+ addslash = (elem[len - 1] != '/');
+ if (addslash)
+ len++;
+ save = list;
+ list = realloc(list, (n + 2) * sizeof(char *));
+ if (!list) {
+ if (save) {
+ save[n] = NULL;
+ FreeStringList(save);
+ }
+ free(fullpath);
+ return NULL;
+ }
+ list[n] = malloc(len + 1);
+ if (!list[n]) {
+ FreeStringList(list);
+ free(fullpath);
+ return NULL;
+ }
+ strcpy(list[n], elem);
+ if (addslash) {
+ list[n][len - 1] = '/';
+ list[n][len] = '\0';
+ }
+ n++;
+ }
+ elem = strtok(NULL, ",");
}
if (list)
- list[n] = NULL;
+ list[n] = NULL;
free(fullpath);
return list;
}
@@ -182,14 +180,14 @@ static void
FreePathList(char **pathlist)
{
if (pathlist && pathlist != defaultPathList)
- FreeStringList(pathlist);
+ FreeStringList(pathlist);
}
void
LoaderSetPath(const char *path)
{
if (!path)
- return;
+ return;
defaultPathList = InitPathList(path);
}
@@ -231,43 +229,45 @@ InitPatterns(const char **patternlist)
const char **s;
if (firstTime) {
- /* precompile stdPatterns */
- firstTime = 0;
- for (p = stdPatterns; p->pattern; p++)
- if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) {
- regerror(e, &p->rex, errmsg, sizeof(errmsg));
- FatalError("InitPatterns: regcomp error for `%s': %s\n",
- p->pattern, errmsg);
- }
+ /* precompile stdPatterns */
+ firstTime = 0;
+ for (p = stdPatterns; p->pattern; p++)
+ if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) {
+ regerror(e, &p->rex, errmsg, sizeof(errmsg));
+ FatalError("InitPatterns: regcomp error for `%s': %s\n",
+ p->pattern, errmsg);
+ }
}
if (patternlist) {
- for (i = 0, s = patternlist; *s; i++, s++)
- if (*s == DEFAULT_LIST)
- i += sizeof(stdPatterns) / sizeof(stdPatterns[0]) - 1 - 1;
- patterns = malloc((i + 1) * sizeof(PatternRec));
- if (!patterns) {
- return NULL;
- }
- for (i = 0, s = patternlist; *s; i++, s++)
- if (*s != DEFAULT_LIST) {
- p = patterns + i;
- p->pattern = *s;
- if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) {
- regerror(e, &p->rex, errmsg, sizeof(errmsg));
- ErrorF("InitPatterns: regcomp error for `%s': %s\n",
- p->pattern, errmsg);
- i--;
- }
- } else {
- for (p = stdPatterns; p->pattern; p++, i++)
- patterns[i] = *p;
- if (p != stdPatterns)
- i--;
- }
- patterns[i].pattern = NULL;
- } else
- patterns = stdPatterns;
+ for (i = 0, s = patternlist; *s; i++, s++)
+ if (*s == DEFAULT_LIST)
+ i += sizeof(stdPatterns) / sizeof(stdPatterns[0]) - 1 - 1;
+ patterns = malloc((i + 1) * sizeof(PatternRec));
+ if (!patterns) {
+ return NULL;
+ }
+ for (i = 0, s = patternlist; *s; i++, s++)
+ if (*s != DEFAULT_LIST) {
+ p = patterns + i;
+ p->pattern = *s;
+ if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) {
+ regerror(e, &p->rex, errmsg, sizeof(errmsg));
+ ErrorF("InitPatterns: regcomp error for `%s': %s\n",
+ p->pattern, errmsg);
+ i--;
+ }
+ }
+ else {
+ for (p = stdPatterns; p->pattern; p++, i++)
+ patterns[i] = *p;
+ if (p != stdPatterns)
+ i--;
+ }
+ patterns[i].pattern = NULL;
+ }
+ else
+ patterns = stdPatterns;
return patterns;
}
@@ -275,7 +275,7 @@ static void
FreePatterns(PatternPtr patterns)
{
if (patterns && patterns != stdPatterns)
- free(patterns);
+ free(patterns);
}
static const char **
@@ -291,82 +291,84 @@ InitSubdirs(const char **subdirlist)
Bool indefault;
if (subdirlist == NULL) {
- subdirlist = tmp_subdirlist = malloc(2 * sizeof(char *));
- if (subdirlist == NULL)
- return NULL;
- subdirlist[0] = DEFAULT_LIST;
- subdirlist[1] = NULL;
+ subdirlist = tmp_subdirlist = malloc(2 * sizeof(char *));
+ if (subdirlist == NULL)
+ return NULL;
+ subdirlist[0] = DEFAULT_LIST;
+ subdirlist[1] = NULL;
}
LoaderGetOS(&osname, NULL, NULL, NULL);
oslen = strlen(osname);
{
- /* Count number of entries and check for invalid paths */
- for (i = 0, s = subdirlist; *s; i++, s++) {
- if (*s == DEFAULT_LIST) {
- i += sizeof(stdSubdirs) / sizeof(stdSubdirs[0]) - 1 - 1;
- } else {
- /*
- * Path validity check. Don't allow absolute paths, or
- * paths containing "..". To catch absolute paths on
- * platforms that use driver letters, don't allow the ':'
- * character to appear at all.
- */
- if (**s == '/' || **s == '\\' || strchr(*s, ':') ||
- strstr(*s, "..")) {
- xf86Msg(X_ERROR, "InitSubdirs: Bad subdir: \"%s\"\n", *s);
- free(tmp_subdirlist);
- return NULL;
- }
- }
- }
- subdirs = malloc((i * 2 + 1) * sizeof(char *));
- if (!subdirs) {
- free(tmp_subdirlist);
- return NULL;
- }
- i = 0;
- s = subdirlist;
- indefault = FALSE;
- while (*s) {
- if (*s == DEFAULT_LIST) {
- /* Divert to the default list */
- indefault = TRUE;
- stmp = ++s;
- s = stdSubdirs;
- }
- len = strlen(*s);
- if (**s && (*s)[len - 1] != '/') {
- slash = "/";
- len++;
- } else
- slash = "";
- len += oslen + 2;
- if (!(subdirs[i] = malloc(len))) {
- while (--i >= 0)
- free(subdirs[i]);
- free(subdirs);
- free(tmp_subdirlist);
- return NULL;
- }
- /* tack on the OS name */
- sprintf(subdirs[i], "%s%s%s/", *s, slash, osname);
- i++;
- /* path as given */
- subdirs[i] = strdup(*s);
- i++;
- s++;
- if (indefault && !s) {
- /* revert back to the main list */
- indefault = FALSE;
- s = stmp;
- }
- }
- subdirs[i] = NULL;
+ /* Count number of entries and check for invalid paths */
+ for (i = 0, s = subdirlist; *s; i++, s++) {
+ if (*s == DEFAULT_LIST) {
+ i += sizeof(stdSubdirs) / sizeof(stdSubdirs[0]) - 1 - 1;
+ }
+ else {
+ /*
+ * Path validity check. Don't allow absolute paths, or
+ * paths containing "..". To catch absolute paths on
+ * platforms that use driver letters, don't allow the ':'
+ * character to appear at all.
+ */
+ if (**s == '/' || **s == '\\' || strchr(*s, ':') ||
+ strstr(*s, "..")) {
+ xf86Msg(X_ERROR, "InitSubdirs: Bad subdir: \"%s\"\n", *s);
+ free(tmp_subdirlist);
+ return NULL;
+ }
+ }
+ }
+ subdirs = malloc((i * 2 + 1) * sizeof(char *));
+ if (!subdirs) {
+ free(tmp_subdirlist);
+ return NULL;
+ }
+ i = 0;
+ s = subdirlist;
+ indefault = FALSE;
+ while (*s) {
+ if (*s == DEFAULT_LIST) {
+ /* Divert to the default list */
+ indefault = TRUE;
+ stmp = ++s;
+ s = stdSubdirs;
+ }
+ len = strlen(*s);
+ if (**s && (*s)[len - 1] != '/') {
+ slash = "/";
+ len++;
+ }
+ else
+ slash = "";
+ len += oslen + 2;
+ if (!(subdirs[i] = malloc(len))) {
+ while (--i >= 0)
+ free(subdirs[i]);
+ free(subdirs);
+ free(tmp_subdirlist);
+ return NULL;
+ }
+ /* tack on the OS name */
+ sprintf(subdirs[i], "%s%s%s/", *s, slash, osname);
+ i++;
+ /* path as given */
+ subdirs[i] = strdup(*s);
+ i++;
+ s++;
+ if (indefault && !s) {
+ /* revert back to the main list */
+ indefault = FALSE;
+ s = stmp;
+ }
+ }
+ subdirs[i] = NULL;
}
free(tmp_subdirlist);
- return (const char **)subdirs;
+ return (const char **) subdirs;
}
static void
@@ -375,9 +377,9 @@ FreeSubdirs(const char **subdirs)
const char **s;
if (subdirs) {
- for (s = subdirs; *s; s++)
- free((char *)*s);
- free(subdirs);
+ for (s = subdirs; *s; s++)
+ free((char *) *s);
+ free(subdirs);
}
}
@@ -397,44 +399,44 @@ FindModuleInSubdir(const char *dirpath, const char *module)
if (direntry->d_name[0] == '.')
continue;
snprintf(tmpBuf, PATH_MAX, "%s%s/", dirpath, direntry->d_name);
- /* the stat with the appended / fails for normal files,
- and works for sub dirs fine, looks a bit strange in strace
- but does seem to work */
+ /* the stat with the appended / fails for normal files,
+ and works for sub dirs fine, looks a bit strange in strace
+ but does seem to work */
if ((stat(tmpBuf, &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode)) {
if ((ret = FindModuleInSubdir(tmpBuf, module)))
break;
continue;
}
-
+
snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
- ret = NULL;
+ ret = NULL;
break;
}
snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
- ret = NULL;
+ ret = NULL;
break;
}
snprintf(tmpBuf, PATH_MAX, "%s.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
- ret = NULL;
+ ret = NULL;
break;
}
}
-
+
closedir(dir);
return ret;
}
static char *
FindModule(const char *module, const char *dirname, const char **subdirlist,
- PatternPtr patterns)
+ PatternPtr patterns)
{
char buf[PATH_MAX + 1];
char *name = NULL;
@@ -442,17 +444,17 @@ FindModule(const char *module, const char *dirname, const char **subdirlist,
const char **s;
if (strlen(dirname) > PATH_MAX)
- return NULL;
-
+ return NULL;
+
subdirs = InitSubdirs(subdirlist);
if (!subdirs)
- return NULL;
+ return NULL;
for (s = subdirs; *s; s++) {
- if ((strlen(dirname) + strlen(*s)) > PATH_MAX)
- continue;
- strcpy(buf, dirname);
- strcat(buf, *s);
+ if ((strlen(dirname) + strlen(*s)) > PATH_MAX)
+ continue;
+ strcpy(buf, dirname);
+ strcat(buf, *s);
if ((name = FindModuleInSubdir(buf, module)))
break;
}
@@ -484,70 +486,70 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
int n = 0;
if (!(pathlist = InitPathList(NULL)))
- return NULL;
+ return NULL;
if (!(subdirs = InitSubdirs(subdirlist)))
- goto bail;
+ goto bail;
if (!(patterns = InitPatterns(patternlist)))
- goto bail;
+ goto bail;
for (elem = pathlist; *elem; elem++) {
- for (s = subdirs; *s; s++) {
- if ((dirlen = strlen(*elem) + strlen(*s)) > PATH_MAX)
- continue;
- strcpy(buf, *elem);
- strcat(buf, *s);
- fp = buf + dirlen;
- if (stat(buf, &stat_buf) == 0 && S_ISDIR(stat_buf.st_mode) &&
- (d = opendir(buf))) {
- if (buf[dirlen - 1] != '/') {
- buf[dirlen++] = '/';
- fp++;
- }
- while ((dp = readdir(d))) {
- if (dirlen + strlen(dp->d_name) > PATH_MAX)
- continue;
- strcpy(fp, dp->d_name);
- if (!(stat(buf, &stat_buf) == 0 &&
- S_ISREG(stat_buf.st_mode)))
- continue;
- for (p = patterns; p->pattern; p++) {
- if (regexec(&p->rex, dp->d_name, 2, match, 0) == 0 &&
- match[1].rm_so != -1) {
- len = match[1].rm_eo - match[1].rm_so;
- save = listing;
- listing = realloc(listing,
- (n + 2) * sizeof(char *));
- if (!listing) {
- if (save) {
- save[n] = NULL;
- FreeStringList(save);
- }
- closedir(d);
- goto bail;
- }
- listing[n] = malloc(len + 1);
- if (!listing[n]) {
- FreeStringList(listing);
- closedir(d);
- goto bail;
- }
- strncpy(listing[n], dp->d_name + match[1].rm_so,
- len);
- listing[n][len] = '\0';
- n++;
- break;
- }
- }
- }
- closedir(d);
- }
- }
+ for (s = subdirs; *s; s++) {
+ if ((dirlen = strlen(*elem) + strlen(*s)) > PATH_MAX)
+ continue;
+ strcpy(buf, *elem);
+ strcat(buf, *s);
+ fp = buf + dirlen;
+ if (stat(buf, &stat_buf) == 0 && S_ISDIR(stat_buf.st_mode) &&
+ (d = opendir(buf))) {
+ if (buf[dirlen - 1] != '/') {
+ buf[dirlen++] = '/';
+ fp++;
+ }
+ while ((dp = readdir(d))) {
+ if (dirlen + strlen(dp->d_name) > PATH_MAX)
+ continue;
+ strcpy(fp, dp->d_name);
+ if (!(stat(buf, &stat_buf) == 0 &&
+ S_ISREG(stat_buf.st_mode)))
+ continue;
+ for (p = patterns; p->pattern; p++) {
+ if (regexec(&p->rex, dp->d_name, 2, match, 0) == 0 &&
+ match[1].rm_so != -1) {
+ len = match[1].rm_eo - match[1].rm_so;
+ save = listing;
+ listing = realloc(listing,
+ (n + 2) * sizeof(char *));
+ if (!listing) {
+ if (save) {
+ save[n] = NULL;
+ FreeStringList(save);
+ }
+ closedir(d);
+ goto bail;
+ }
+ listing[n] = malloc(len + 1);
+ if (!listing[n]) {
+ FreeStringList(listing);
+ closedir(d);
+ goto bail;
+ }
+ strncpy(listing[n], dp->d_name + match[1].rm_so,
+ len);
+ listing[n][len] = '\0';
+ n++;
+ break;
+ }
+ }
+ }
+ closedir(d);
+ }
+ }
}
if (listing)
- listing[n] = NULL;
+ listing[n] = NULL;
ret = listing;
-bail:
+ bail:
FreePatterns(patterns);
FreeSubdirs(subdirs);
FreePathList(pathlist);
@@ -562,7 +564,7 @@ LoaderFreeDirList(char **list)
static Bool
CheckVersion(const char *module, XF86ModuleVersionInfo * data,
- const XF86ModReqInfo * req)
+ const XF86ModReqInfo * req)
{
int vercode[4];
char verstr[4];
@@ -570,8 +572,8 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
MessageType errtype;
xf86Msg(X_INFO, "Module %s: vendor=\"%s\"\n",
- data->modname ? data->modname : "UNKNOWN!",
- data->vendor ? data->vendor : "UNKNOWN!");
+ data->modname ? data->modname : "UNKNOWN!",
+ data->vendor ? data->vendor : "UNKNOWN!");
/* Check for the different scheme used in XFree86 4.0.x releases:
* ((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha)
@@ -579,152 +581,157 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
* range, which limits the overlap with the new version scheme to conflicts
* with 6.71.8.764 through 6.72.39.934.
*/
- if ((ver > (4 << 24)) && (ver < ( (4 << 24) + (1 << 17)))) {
- /* 4.0.x and earlier */
- verstr[1] = verstr[3] = 0;
- verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0;
- ver >>= 5;
- verstr[0] = (ver & 0x1f) ? (ver & 0x1f) + 'A' - 1 : 0;
- ver >>= 5;
- vercode[2] = ver & 0x7f;
- ver >>= 7;
- vercode[1] = ver & 0x7f;
- ver >>= 7;
- vercode[0] = ver;
- xf86ErrorF("\tcompiled for %d.%d", vercode[0], vercode[1]);
- if (vercode[2] != 0)
- xf86ErrorF(".%d", vercode[2]);
- xf86ErrorF("%s%s, module version = %d.%d.%d\n", verstr, verstr + 2,
- data->majorversion, data->minorversion, data->patchlevel);
- } else {
- vercode[0] = ver / 10000000;
- vercode[1] = (ver / 100000) % 100;
- vercode[2] = (ver / 1000) % 100;
- vercode[3] = ver % 1000;
- xf86ErrorF("\tcompiled for %d.%d.%d", vercode[0], vercode[1],
- vercode[2]);
- if (vercode[3] != 0)
- xf86ErrorF(".%d", vercode[3]);
- xf86ErrorF(", module version = %d.%d.%d\n", data->majorversion,
- data->minorversion, data->patchlevel);
+ if ((ver > (4 << 24)) && (ver < ((4 << 24) + (1 << 17)))) {
+ /* 4.0.x and earlier */
+ verstr[1] = verstr[3] = 0;
+ verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0;
+ ver >>= 5;
+ verstr[0] = (ver & 0x1f) ? (ver & 0x1f) + 'A' - 1 : 0;
+ ver >>= 5;
+ vercode[2] = ver & 0x7f;
+ ver >>= 7;
+ vercode[1] = ver & 0x7f;
+ ver >>= 7;
+ vercode[0] = ver;
+ xf86ErrorF("\tcompiled for %d.%d", vercode[0], vercode[1]);
+ if (vercode[2] != 0)
+ xf86ErrorF(".%d", vercode[2]);
+ xf86ErrorF("%s%s, module version = %d.%d.%d\n", verstr, verstr + 2,
+ data->majorversion, data->minorversion, data->patchlevel);
+ }
+ else {
+ vercode[0] = ver / 10000000;
+ vercode[1] = (ver / 100000) % 100;
+ vercode[2] = (ver / 1000) % 100;
+ vercode[3] = ver % 1000;
+ xf86ErrorF("\tcompiled for %d.%d.%d", vercode[0], vercode[1],
+ vercode[2]);
+ if (vercode[3] != 0)
+ xf86ErrorF(".%d", vercode[3]);
+ xf86ErrorF(", module version = %d.%d.%d\n", data->majorversion,
+ data->minorversion, data->patchlevel);
}
if (data->moduleclass)
- xf86ErrorFVerb(2, "\tModule class: %s\n", data->moduleclass);
+ xf86ErrorFVerb(2, "\tModule class: %s\n", data->moduleclass);
ver = -1;
if (data->abiclass) {
- int abimaj, abimin;
- int vermaj, vermin;
-
- if (!strcmp(data->abiclass, ABI_CLASS_ANSIC))
- ver = LoaderVersionInfo.ansicVersion;
- else if (!strcmp(data->abiclass, ABI_CLASS_VIDEODRV))
- ver = LoaderVersionInfo.videodrvVersion;
- else if (!strcmp(data->abiclass, ABI_CLASS_XINPUT))
- ver = LoaderVersionInfo.xinputVersion;
- else if (!strcmp(data->abiclass, ABI_CLASS_EXTENSION))
- ver = LoaderVersionInfo.extensionVersion;
- else if (!strcmp(data->abiclass, ABI_CLASS_FONT))
- ver = LoaderVersionInfo.fontVersion;
-
- abimaj = GET_ABI_MAJOR(data->abiversion);
- abimin = GET_ABI_MINOR(data->abiversion);
- xf86ErrorFVerb(2, "\tABI class: %s, version %d.%d\n",
- data->abiclass, abimaj, abimin);
- if (ver != -1) {
- vermaj = GET_ABI_MAJOR(ver);
- vermin = GET_ABI_MINOR(ver);
- if (abimaj != vermaj) {
- if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
- errtype = X_WARNING;
- else
- errtype = X_ERROR;
- xf86MsgVerb(errtype, 0,
- "module ABI major version (%d) doesn't"
- " match the server's version (%d)\n",
- abimaj, vermaj);
- if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
- return FALSE;
- } else if (abimin > vermin) {
- if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
- errtype = X_WARNING;
- else
- errtype = X_ERROR;
- xf86MsgVerb(errtype, 0,
- "module ABI minor version (%d) is "
- "newer than the server's version "
- "(%d)\n", abimin, vermin);
- if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
- return FALSE;
- }
- }
+ int abimaj, abimin;
+ int vermaj, vermin;
+
+ if (!strcmp(data->abiclass, ABI_CLASS_ANSIC))
+ ver = LoaderVersionInfo.ansicVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_VIDEODRV))
+ ver = LoaderVersionInfo.videodrvVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_XINPUT))
+ ver = LoaderVersionInfo.xinputVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_EXTENSION))
+ ver = LoaderVersionInfo.extensionVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_FONT))
+ ver = LoaderVersionInfo.fontVersion;
+
+ abimaj = GET_ABI_MAJOR(data->abiversion);
+ abimin = GET_ABI_MINOR(data->abiversion);
+ xf86ErrorFVerb(2, "\tABI class: %s, version %d.%d\n",
+ data->abiclass, abimaj, abimin);
+ if (ver != -1) {
+ vermaj = GET_ABI_MAJOR(ver);
+ vermin = GET_ABI_MINOR(ver);
+ if (abimaj != vermaj) {
+ if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
+ errtype = X_WARNING;
+ else
+ errtype = X_ERROR;
+ xf86MsgVerb(errtype, 0,
+ "module ABI major version (%d) doesn't"
+ " match the server's version (%d)\n",
+ abimaj, vermaj);
+ if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
+ return FALSE;
+ }
+ else if (abimin > vermin) {
+ if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
+ errtype = X_WARNING;
+ else
+ errtype = X_ERROR;
+ xf86MsgVerb(errtype, 0,
+ "module ABI minor version (%d) is "
+ "newer than the server's version "
+ "(%d)\n", abimin, vermin);
+ if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
+ return FALSE;
+ }
+ }
}
/* Check against requirements that the caller has specified */
if (req) {
- if (req->majorversion != MAJOR_UNSPEC) {
- if (data->majorversion != req->majorversion) {
- xf86MsgVerb(X_WARNING, 2, "module major version (%d) "
- "doesn't match required major version (%d)\n",
- data->majorversion, req->majorversion);
- return FALSE;
- } else if (req->minorversion != MINOR_UNSPEC) {
- if (data->minorversion < req->minorversion) {
- xf86MsgVerb(X_WARNING, 2, "module minor version (%d) "
- "is less than the required minor version (%d)\n",
- data->minorversion, req->minorversion);
- return FALSE;
- } else if (data->minorversion == req->minorversion &&
- req->patchlevel != PATCH_UNSPEC) {
- if (data->patchlevel < req->patchlevel) {
- xf86MsgVerb(X_WARNING, 2, "module patch level (%d) "
- "is less than the required patch level (%d)\n",
- data->patchlevel, req->patchlevel);
- return FALSE;
- }
- }
- }
- }
- if (req->moduleclass) {
- if (!data->moduleclass ||
- strcmp(req->moduleclass, data->moduleclass)) {
- xf86MsgVerb(X_WARNING, 2, "Module class (%s) doesn't match "
- "the required class (%s)\n",
- data->moduleclass ? data->moduleclass : "<NONE>",
- req->moduleclass);
- return FALSE;
- }
- } else if (req->abiclass != ABI_CLASS_NONE) {
- if (!data->abiclass || strcmp(req->abiclass, data->abiclass)) {
- xf86MsgVerb(X_WARNING, 2, "ABI class (%s) doesn't match the "
- "required ABI class (%s)\n",
- data->abiclass ? data->abiclass : "<NONE>",
- req->abiclass);
- return FALSE;
- }
- }
- if ((req->abiclass != ABI_CLASS_NONE) &&
- req->abiversion != ABI_VERS_UNSPEC) {
- int reqmaj, reqmin, maj, min;
-
- reqmaj = GET_ABI_MAJOR(req->abiversion);
- reqmin = GET_ABI_MINOR(req->abiversion);
- maj = GET_ABI_MAJOR(data->abiversion);
- min = GET_ABI_MINOR(data->abiversion);
- if (maj != reqmaj) {
- xf86MsgVerb(X_WARNING, 2, "ABI major version (%d) doesn't "
- "match the required ABI major version (%d)\n",
- maj, reqmaj);
- return FALSE;
- }
- /* XXX Maybe this should be the other way around? */
- if (min > reqmin) {
- xf86MsgVerb(X_WARNING, 2, "module ABI minor version (%d) "
- "is newer than that available (%d)\n", min, reqmin);
- return FALSE;
- }
- }
+ if (req->majorversion != MAJOR_UNSPEC) {
+ if (data->majorversion != req->majorversion) {
+ xf86MsgVerb(X_WARNING, 2, "module major version (%d) "
+ "doesn't match required major version (%d)\n",
+ data->majorversion, req->majorversion);
+ return FALSE;
+ }
+ else if (req->minorversion != MINOR_UNSPEC) {
+ if (data->minorversion < req->minorversion) {
+ xf86MsgVerb(X_WARNING, 2, "module minor version (%d) "
+ "is less than the required minor version (%d)\n",
+ data->minorversion, req->minorversion);
+ return FALSE;
+ }
+ else if (data->minorversion == req->minorversion &&
+ req->patchlevel != PATCH_UNSPEC) {
+ if (data->patchlevel < req->patchlevel) {
+ xf86MsgVerb(X_WARNING, 2, "module patch level (%d) "
+ "is less than the required patch level (%d)\n",
+ data->patchlevel, req->patchlevel);
+ return FALSE;
+ }
+ }
+ }
+ }
+ if (req->moduleclass) {
+ if (!data->moduleclass ||
+ strcmp(req->moduleclass, data->moduleclass)) {
+ xf86MsgVerb(X_WARNING, 2, "Module class (%s) doesn't match "
+ "the required class (%s)\n",
+ data->moduleclass ? data->moduleclass : "<NONE>",
+ req->moduleclass);
+ return FALSE;
+ }
+ }
+ else if (req->abiclass != ABI_CLASS_NONE) {
+ if (!data->abiclass || strcmp(req->abiclass, data->abiclass)) {
+ xf86MsgVerb(X_WARNING, 2, "ABI class (%s) doesn't match the "
+ "required ABI class (%s)\n",
+ data->abiclass ? data->abiclass : "<NONE>",
+ req->abiclass);
+ return FALSE;
+ }
+ }
+ if ((req->abiclass != ABI_CLASS_NONE) &&
+ req->abiversion != ABI_VERS_UNSPEC) {
+ int reqmaj, reqmin, maj, min;
+
+ reqmaj = GET_ABI_MAJOR(req->abiversion);
+ reqmin = GET_ABI_MINOR(req->abiversion);
+ maj = GET_ABI_MAJOR(data->abiversion);
+ min = GET_ABI_MINOR(data->abiversion);
+ if (maj != reqmaj) {
+ xf86MsgVerb(X_WARNING, 2, "ABI major version (%d) doesn't "
+ "match the required ABI major version (%d)\n",
+ maj, reqmaj);
+ return FALSE;
+ }
+ /* XXX Maybe this should be the other way around? */
+ if (min > reqmin) {
+ xf86MsgVerb(X_WARNING, 2, "module ABI minor version (%d) "
+ "is newer than that available (%d)\n", min, reqmin);
+ return FALSE;
+ }
+ }
}
return TRUE;
}
@@ -738,31 +745,31 @@ AddSibling(ModuleDescPtr head, ModuleDescPtr new)
pointer
LoadSubModule(pointer _parent, const char *module,
- const char **subdirlist, const char **patternlist,
- pointer options, const XF86ModReqInfo * modreq,
- int *errmaj, int *errmin)
+ const char **subdirlist, const char **patternlist,
+ pointer options, const XF86ModReqInfo * modreq,
+ int *errmaj, int *errmin)
{
ModuleDescPtr submod;
- ModuleDescPtr parent = (ModuleDescPtr)_parent;
+ ModuleDescPtr parent = (ModuleDescPtr) _parent;
xf86MsgVerb(X_INFO, 3, "Loading sub module \"%s\"\n", module);
if (PathIsAbsolute(module)) {
- xf86Msg(X_ERROR,
- "LoadSubModule: Absolute module path not permitted: \"%s\"\n",
- module);
- if (errmaj)
- *errmaj = LDR_BADUSAGE;
- if (errmin)
- *errmin = 0;
- return NULL;
+ xf86Msg(X_ERROR,
+ "LoadSubModule: Absolute module path not permitted: \"%s\"\n",
+ module);
+ if (errmaj)
+ *errmaj = LDR_BADUSAGE;
+ if (errmin)
+ *errmin = 0;
+ return NULL;
}
submod = doLoadModule(module, NULL, subdirlist, patternlist, options,
- modreq, errmaj, errmin);
+ modreq, errmaj, errmin);
if (submod && submod != (ModuleDescPtr) 1) {
- parent->child = AddSibling(parent->child, submod);
- submod->parent = parent;
+ parent->child = AddSibling(parent->child, submod);
+ submod->parent = parent;
}
return submod;
}
@@ -773,7 +780,7 @@ NewModuleDesc(const char *name)
ModuleDescPtr mdp = calloc(1, sizeof(ModuleDesc));
if (mdp)
- mdp->name = xstrdup(name);
+ mdp->name = xstrdup(name);
return mdp;
}
@@ -784,11 +791,11 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent)
ModuleDescPtr ret;
if (!mod)
- return NULL;
+ return NULL;
ret = NewModuleDesc(mod->name);
if (ret == NULL)
- return NULL;
+ return NULL;
ret->handle = mod->handle;
@@ -813,9 +820,8 @@ static const char *compiled_in_modules[] = {
static ModuleDescPtr
doLoadModule(const char *module, const char *path, const char **subdirlist,
- const char **patternlist, pointer options,
- const XF86ModReqInfo * modreq,
- int *errmaj, int *errmin)
+ const char **patternlist, pointer options,
+ const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
{
XF86ModuleData *initdata = NULL;
char **pathlist = NULL;
@@ -835,48 +841,48 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
name = LoaderGetCanonicalName(module, patterns);
noncanonical = (name && strcmp(module, name) != 0);
if (noncanonical) {
- xf86ErrorFVerb(3, " (%s)\n", name);
- xf86MsgVerb(X_WARNING, 1,
- "LoadModule: given non-canonical module name \"%s\"\n",
- module);
- m = name;
- } else {
- xf86ErrorFVerb(3, "\n");
- m = (char *)module;
+ xf86ErrorFVerb(3, " (%s)\n", name);
+ xf86MsgVerb(X_WARNING, 1,
+ "LoadModule: given non-canonical module name \"%s\"\n",
+ module);
+ m = name;
+ }
+ else {
+ xf86ErrorFVerb(3, "\n");
+ m = (char *) module;
}
for (cim = compiled_in_modules; *cim; cim++)
- if (!strcmp (m, *cim))
- {
- xf86MsgVerb(X_INFO, 3, "Module \"%s\" already built-in\n", m);
- ret = (ModuleDescPtr) 1;
- goto LoadModule_exit;
- }
+ if (!strcmp(m, *cim)) {
+ xf86MsgVerb(X_INFO, 3, "Module \"%s\" already built-in\n", m);
+ ret = (ModuleDescPtr) 1;
+ goto LoadModule_exit;
+ }
if (!name) {
- if (errmaj)
- *errmaj = LDR_BADUSAGE;
- if (errmin)
- *errmin = 0;
- goto LoadModule_fail;
+ if (errmaj)
+ *errmaj = LDR_BADUSAGE;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
}
ret = NewModuleDesc(name);
if (!ret) {
- if (errmaj)
- *errmaj = LDR_NOMEM;
- if (errmin)
- *errmin = 0;
- goto LoadModule_fail;
+ if (errmaj)
+ *errmaj = LDR_NOMEM;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
}
pathlist = InitPathList(path);
if (!pathlist) {
- /* This could be a malloc failure too */
- if (errmaj)
- *errmaj = LDR_BADUSAGE;
- if (errmin)
- *errmin = 1;
- goto LoadModule_fail;
+ /* This could be a malloc failure too */
+ if (errmaj)
+ *errmaj = LDR_BADUSAGE;
+ if (errmin)
+ *errmin = 1;
+ goto LoadModule_fail;
}
/*
@@ -884,35 +890,35 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
* check the elements in the path
*/
if (PathIsAbsolute(module))
- found = xstrdup(module);
+ found = xstrdup(module);
path_elem = pathlist;
while (!found && *path_elem != NULL) {
- found = FindModule(m, *path_elem, subdirlist, patterns);
- path_elem++;
- /*
- * When the module name isn't the canonical name, search for the
- * former if no match was found for the latter.
- */
- if (!*path_elem && m == name) {
- path_elem = pathlist;
- m = (char *)module;
- }
+ found = FindModule(m, *path_elem, subdirlist, patterns);
+ path_elem++;
+ /*
+ * When the module name isn't the canonical name, search for the
+ * former if no match was found for the latter.
+ */
+ if (!*path_elem && m == name) {
+ path_elem = pathlist;
+ m = (char *) module;
+ }
}
/*
* did we find the module?
*/
if (!found) {
- xf86Msg(X_WARNING, "Warning, couldn't open module %s\n", module);
- if (errmaj)
- *errmaj = LDR_NOENT;
- if (errmin)
- *errmin = 0;
- goto LoadModule_fail;
+ xf86Msg(X_WARNING, "Warning, couldn't open module %s\n", module);
+ if (errmaj)
+ *errmaj = LDR_NOENT;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
}
ret->handle = LoaderOpen(found, errmaj, errmin);
if (ret->handle == NULL)
- goto LoadModule_fail;
+ goto LoadModule_fail;
ret->path = strdup(found);
/* drop any explicit suffix from the module name */
@@ -925,22 +931,22 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
* present.
*/
if (asprintf(&p, "%sModuleData", name) == -1) {
- p = NULL;
- if (errmaj)
- *errmaj = LDR_NOMEM;
- if (errmin)
- *errmin = 0;
- goto LoadModule_fail;
+ p = NULL;
+ if (errmaj)
+ *errmaj = LDR_NOMEM;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
}
initdata = LoaderSymbol(p);
if (initdata) {
- ModuleSetupProc setup;
- ModuleTearDownProc teardown;
- XF86ModuleVersionInfo *vers;
+ ModuleSetupProc setup;
+ ModuleTearDownProc teardown;
+ XF86ModuleVersionInfo *vers;
- vers = initdata->vers;
- setup = initdata->setup;
- teardown = initdata->teardown;
+ vers = initdata->vers;
+ setup = initdata->setup;
+ teardown = initdata->teardown;
if (vers) {
if (!CheckVersion(module, vers, modreq)) {
@@ -950,7 +956,8 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
*errmin = 0;
goto LoadModule_fail;
}
- } else {
+ }
+ else {
xf86Msg(X_ERROR,
"LoadModule: Module %s does not supply"
" version information\n", module);
@@ -960,41 +967,43 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
*errmin = 0;
goto LoadModule_fail;
}
- if (setup)
- ret->SetupProc = setup;
- if (teardown)
- ret->TearDownProc = teardown;
- ret->VersionInfo = vers;
- } else {
- /* No initdata is OK for external modules */
- if (options == EXTERN_MODULE)
- goto LoadModule_exit;
-
- /* no initdata, fail the load */
- xf86Msg(X_ERROR, "LoadModule: Module %s does not have a %s "
- "data object.\n", module, p);
- if (errmaj)
- *errmaj = LDR_INVALID;
- if (errmin)
- *errmin = 0;
- goto LoadModule_fail;
+ if (setup)
+ ret->SetupProc = setup;
+ if (teardown)
+ ret->TearDownProc = teardown;
+ ret->VersionInfo = vers;
+ }
+ else {
+ /* No initdata is OK for external modules */
+ if (options == EXTERN_MODULE)
+ goto LoadModule_exit;
+
+ /* no initdata, fail the load */
+ xf86Msg(X_ERROR, "LoadModule: Module %s does not have a %s "
+ "data object.\n", module, p);
+ if (errmaj)
+ *errmaj = LDR_INVALID;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
}
if (ret->SetupProc) {
- ret->TearDownData = ret->SetupProc(ret, options, errmaj, errmin);
- if (!ret->TearDownData) {
- goto LoadModule_fail;
- }
- } else if (options) {
- xf86Msg(X_WARNING, "Module Options present, but no SetupProc "
- "available for %s\n", module);
+ ret->TearDownData = ret->SetupProc(ret, options, errmaj, errmin);
+ if (!ret->TearDownData) {
+ goto LoadModule_fail;
+ }
+ }
+ else if (options) {
+ xf86Msg(X_WARNING, "Module Options present, but no SetupProc "
+ "available for %s\n", module);
}
goto LoadModule_exit;
- LoadModule_fail:
+ LoadModule_fail:
UnloadModule(ret);
ret = NULL;
- LoadModule_exit:
+ LoadModule_exit:
FreePathList(pathlist);
FreePatterns(patterns);
free(found);
@@ -1043,43 +1052,43 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
*/
ModuleDescPtr
LoadModule(const char *module, const char *path, const char **subdirlist,
- const char **patternlist, pointer options,
- const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
+ const char **patternlist, pointer options,
+ const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
{
- return doLoadModule(module, path, subdirlist, patternlist, options,
- modreq, errmaj, errmin);
+ return doLoadModule(module, path, subdirlist, patternlist, options,
+ modreq, errmaj, errmin);
}
void
UnloadModule(pointer mod)
{
- UnloadModuleOrDriver((ModuleDescPtr)mod);
+ UnloadModuleOrDriver((ModuleDescPtr) mod);
}
static void
UnloadModuleOrDriver(ModuleDescPtr mod)
{
if (mod == (ModuleDescPtr) 1)
- return;
+ return;
if (mod == NULL || mod->name == NULL)
- return;
+ return;
if (mod->parent)
- xf86MsgVerb(X_INFO, 3, "UnloadSubModule: \"%s\"\n", mod->name);
+ xf86MsgVerb(X_INFO, 3, "UnloadSubModule: \"%s\"\n", mod->name);
else
- xf86MsgVerb(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name);
+ xf86MsgVerb(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name);
if (mod->TearDownData != ModuleDuplicated) {
- if ((mod->TearDownProc) && (mod->TearDownData))
- mod->TearDownProc(mod->TearDownData);
- LoaderUnload(mod->name, mod->handle);
+ if ((mod->TearDownProc) && (mod->TearDownData))
+ mod->TearDownProc(mod->TearDownData);
+ LoaderUnload(mod->name, mod->handle);
}
if (mod->child)
- UnloadModuleOrDriver(mod->child);
+ UnloadModuleOrDriver(mod->child);
if (mod->sib)
- UnloadModuleOrDriver(mod->sib);
+ UnloadModuleOrDriver(mod->sib);
free(mod->path);
free(mod->name);
free(mod);
@@ -1088,11 +1097,11 @@ UnloadModuleOrDriver(ModuleDescPtr mod)
void
UnloadSubModule(pointer _mod)
{
- ModuleDescPtr mod = (ModuleDescPtr)_mod;
+ ModuleDescPtr mod = (ModuleDescPtr) _mod;
/* Some drivers are calling us on built-in submodules, ignore them */
- if (mod == (ModuleDescPtr)1)
- return;
+ if (mod == (ModuleDescPtr) 1)
+ return;
RemoveChild(mod);
UnloadModuleOrDriver(mod);
}
@@ -1105,22 +1114,22 @@ RemoveChild(ModuleDescPtr child)
ModuleDescPtr parent;
if (!child->parent)
- return;
+ return;
parent = child->parent;
if (parent->child == child) {
- parent->child = child->sib;
- return;
+ parent->child = child->sib;
+ return;
}
prevsib = parent->child;
mdp = prevsib->sib;
while (mdp && mdp != child) {
- prevsib = mdp;
- mdp = mdp->sib;
+ prevsib = mdp;
+ mdp = mdp->sib;
}
if (mdp == child)
- prevsib->sib = child->sib;
+ prevsib->sib = child->sib;
child->sib = NULL;
return;
}
@@ -1133,63 +1142,63 @@ LoaderErrorMsg(const char *name, const char *modname, int errmaj, int errmin)
switch (errmaj) {
case LDR_NOERROR:
- msg = "no error";
- break;
+ msg = "no error";
+ break;
case LDR_NOMEM:
- msg = "out of memory";
- break;
+ msg = "out of memory";
+ break;
case LDR_NOENT:
- msg = "module does not exist";
- break;
+ msg = "module does not exist";
+ break;
case LDR_NOSUBENT:
- msg = "a required submodule could not be loaded";
- break;
+ msg = "a required submodule could not be loaded";
+ break;
case LDR_NOSPACE:
- msg = "too many modules";
- break;
+ msg = "too many modules";
+ break;
case LDR_NOMODOPEN:
- msg = "open failed";
- break;
+ msg = "open failed";
+ break;
case LDR_UNKTYPE:
- msg = "unknown module type";
- break;
+ msg = "unknown module type";
+ break;
case LDR_NOLOAD:
- msg = "loader failed";
- break;
+ msg = "loader failed";
+ break;
case LDR_ONCEONLY:
- msg = "already loaded";
+ msg = "already loaded";
type = X_INFO;
- break;
+ break;
case LDR_NOPORTOPEN:
- msg = "port open failed";
- break;
+ msg = "port open failed";
+ break;
case LDR_NOHARDWARE:
- msg = "no hardware found";
- break;
+ msg = "no hardware found";
+ break;
case LDR_MISMATCH:
- msg = "module requirement mismatch";
- break;
+ msg = "module requirement mismatch";
+ break;
case LDR_BADUSAGE:
- msg = "invalid argument(s) to LoadModule()";
- break;
+ msg = "invalid argument(s) to LoadModule()";
+ break;
case LDR_INVALID:
- msg = "invalid module";
- break;
+ msg = "invalid module";
+ break;
case LDR_BADOS:
- msg = "module doesn't support this OS";
- break;
+ msg = "module doesn't support this OS";
+ break;
case LDR_MODSPECIFIC:
- msg = "module-specific error";
- break;
+ msg = "module-specific error";
+ break;
default:
- msg = "unknown error";
+ msg = "unknown error";
}
if (name)
- xf86Msg(type, "%s: Failed to load module \"%s\" (%s, %d)\n",
- name, modname, msg, errmin);
+ xf86Msg(type, "%s: Failed to load module \"%s\" (%s, %d)\n",
+ name, modname, msg, errmin);
else
- xf86Msg(type, "Failed to load module \"%s\" (%s, %d)\n",
- modname, msg, errmin);
+ xf86Msg(type, "Failed to load module \"%s\" (%s, %d)\n",
+ modname, msg, errmin);
}
/* Given a module path or file name, return the module's canonical name */
@@ -1205,21 +1214,21 @@ LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
/* Strip off any leading path */
s = strrchr(modname, '/');
if (s == NULL)
- s = modname;
+ s = modname;
else
- s++;
+ s++;
/* Find the first regex that is matched */
for (p = patterns; p->pattern; p++)
- if (regexec(&p->rex, s, 2, match, 0) == 0 && match[1].rm_so != -1) {
- len = match[1].rm_eo - match[1].rm_so;
- str = malloc(len + 1);
- if (!str)
- return NULL;
- strncpy(str, s + match[1].rm_so, len);
- str[len] = '\0';
- return str;
- }
+ if (regexec(&p->rex, s, 2, match, 0) == 0 && match[1].rm_so != -1) {
+ len = match[1].rm_eo - match[1].rm_so;
+ str = malloc(len + 1);
+ if (!str)
+ return NULL;
+ strncpy(str, s + match[1].rm_so, len);
+ str[len] = '\0';
+ return str;
+ }
/* If there is no match, return the whole name minus the leading path */
return strdup(s);
@@ -1232,9 +1241,9 @@ unsigned long
LoaderGetModuleVersion(ModuleDescPtr mod)
{
if (!mod || mod == (ModuleDescPtr) 1 || !mod->VersionInfo)
- return 0;
+ return 0;
return MODULE_VERSION_NUMERIC(mod->VersionInfo->majorversion,
- mod->VersionInfo->minorversion,
- mod->VersionInfo->patchlevel);
+ mod->VersionInfo->minorversion,
+ mod->VersionInfo->patchlevel);
}
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index da9db3460..6d5e92f12 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -55,26 +55,24 @@
int xf86CrtcConfigPrivateIndex = -1;
void
-xf86CrtcConfigInit (ScrnInfoPtr scrn,
- const xf86CrtcConfigFuncsRec *funcs)
+xf86CrtcConfigInit(ScrnInfoPtr scrn, const xf86CrtcConfigFuncsRec * funcs)
{
- xf86CrtcConfigPtr config;
-
+ xf86CrtcConfigPtr config;
+
if (xf86CrtcConfigPrivateIndex == -1)
- xf86CrtcConfigPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
- config = xnfcalloc (1, sizeof (xf86CrtcConfigRec));
+ xf86CrtcConfigPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+ config = xnfcalloc(1, sizeof(xf86CrtcConfigRec));
config->funcs = funcs;
scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config;
}
-
+
void
-xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
- int minWidth, int minHeight,
- int maxWidth, int maxHeight)
+xf86CrtcSetSizeRange(ScrnInfoPtr scrn,
+ int minWidth, int minHeight, int maxWidth, int maxHeight)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
config->minWidth = minWidth;
config->minHeight = minHeight;
@@ -86,15 +84,14 @@ xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
* Crtc functions
*/
xf86CrtcPtr
-xf86CrtcCreate (ScrnInfoPtr scrn,
- const xf86CrtcFuncsRec *funcs)
+xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CrtcPtr crtc, *crtcs;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcPtr crtc, *crtcs;
- crtc = calloc(sizeof (xf86CrtcRec), 1);
+ crtc = calloc(sizeof(xf86CrtcRec), 1);
if (!crtc)
- return NULL;
+ return NULL;
crtc->version = XF86_CRTC_VERSION;
crtc->scrn = scrn;
crtc->funcs = funcs;
@@ -103,9 +100,9 @@ xf86CrtcCreate (ScrnInfoPtr scrn,
#endif
crtc->rotation = RR_Rotate_0;
crtc->desiredRotation = RR_Rotate_0;
- pixman_transform_init_identity (&crtc->crtc_to_framebuffer);
- pixman_f_transform_init_identity (&crtc->f_crtc_to_framebuffer);
- pixman_f_transform_init_identity (&crtc->f_framebuffer_to_crtc);
+ pixman_transform_init_identity(&crtc->crtc_to_framebuffer);
+ pixman_f_transform_init_identity(&crtc->f_crtc_to_framebuffer);
+ pixman_f_transform_init_identity(&crtc->f_framebuffer_to_crtc);
crtc->filter = NULL;
crtc->params = NULL;
crtc->nparams = 0;
@@ -114,28 +111,27 @@ xf86CrtcCreate (ScrnInfoPtr scrn,
crtc->transform_in_use = FALSE;
crtc->transformPresent = FALSE;
crtc->desiredTransformPresent = FALSE;
- memset (&crtc->bounds, '\0', sizeof (crtc->bounds));
+ memset(&crtc->bounds, '\0', sizeof(crtc->bounds));
/* Preallocate gamma at a sensible size. */
crtc->gamma_size = 256;
- crtc->gamma_red = malloc(3 * crtc->gamma_size * sizeof (CARD16));
+ crtc->gamma_red = malloc(3 * crtc->gamma_size * sizeof(CARD16));
if (!crtc->gamma_red) {
- free(crtc);
- return NULL;
+ free(crtc);
+ return NULL;
}
crtc->gamma_green = crtc->gamma_red + crtc->gamma_size;
crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
if (xf86_config->crtc)
- crtcs = realloc(xf86_config->crtc,
- (xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
+ crtcs = realloc(xf86_config->crtc,
+ (xf86_config->num_crtc + 1) * sizeof(xf86CrtcPtr));
else
- crtcs = malloc((xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
- if (!crtcs)
- {
- free(crtc->gamma_red);
- free(crtc);
- return NULL;
+ crtcs = malloc((xf86_config->num_crtc + 1) * sizeof(xf86CrtcPtr));
+ if (!crtcs) {
+ free(crtc->gamma_red);
+ free(crtc);
+ return NULL;
}
xf86_config->crtc = crtcs;
xf86_config->crtc[xf86_config->num_crtc++] = crtc;
@@ -143,146 +139,140 @@ xf86CrtcCreate (ScrnInfoPtr scrn,
}
void
-xf86CrtcDestroy (xf86CrtcPtr crtc)
+xf86CrtcDestroy(xf86CrtcPtr crtc)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
- int c;
-
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ int c;
+
(*crtc->funcs->destroy) (crtc);
for (c = 0; c < xf86_config->num_crtc; c++)
- if (xf86_config->crtc[c] == crtc)
- {
- memmove (&xf86_config->crtc[c],
- &xf86_config->crtc[c+1],
- ((xf86_config->num_crtc - (c + 1)) * sizeof(void*)));
- xf86_config->num_crtc--;
- break;
- }
+ if (xf86_config->crtc[c] == crtc) {
+ memmove(&xf86_config->crtc[c],
+ &xf86_config->crtc[c + 1],
+ ((xf86_config->num_crtc - (c + 1)) * sizeof(void *)));
+ xf86_config->num_crtc--;
+ break;
+ }
free(crtc->params);
free(crtc->gamma_red);
free(crtc);
}
-
/**
* Return whether any outputs are connected to the specified pipe
*/
Bool
-xf86CrtcInUse (xf86CrtcPtr crtc)
+xf86CrtcInUse(xf86CrtcPtr crtc)
{
- ScrnInfoPtr pScrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int o;
-
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o;
+
for (o = 0; o < xf86_config->num_output; o++)
- if (xf86_config->output[o]->crtc == crtc)
- return TRUE;
+ if (xf86_config->output[o]->crtc == crtc)
+ return TRUE;
return FALSE;
}
void
-xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen)
+xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen)
{
- int subpixel_order = SubPixelUnknown;
- Bool has_none = FALSE;
- ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c, o;
+ int subpixel_order = SubPixelUnknown;
+ Bool has_none = FALSE;
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- for (o = 0; o < xf86_config->num_output; o++)
- {
- xf86OutputPtr output = xf86_config->output[o];
-
- if (output->crtc == crtc)
- {
- switch (output->subpixel_order) {
- case SubPixelNone:
- has_none = TRUE;
- break;
- case SubPixelUnknown:
- break;
- default:
- subpixel_order = output->subpixel_order;
- break;
- }
- }
- if (subpixel_order != SubPixelUnknown)
- break;
- }
- if (subpixel_order != SubPixelUnknown)
- {
- static const int circle[4] = {
- SubPixelHorizontalRGB,
- SubPixelVerticalRGB,
- SubPixelHorizontalBGR,
- SubPixelVerticalBGR,
- };
- int rotate;
- int c;
- for (rotate = 0; rotate < 4; rotate++)
- if (crtc->rotation & (1 << rotate))
- break;
- for (c = 0; c < 4; c++)
- if (circle[c] == subpixel_order)
- break;
- c = (c + rotate) & 0x3;
- if ((crtc->rotation & RR_Reflect_X) && !(c & 1))
- c ^= 2;
- if ((crtc->rotation & RR_Reflect_Y) && (c & 1))
- c ^= 2;
- subpixel_order = circle[c];
- break;
- }
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ for (o = 0; o < xf86_config->num_output; o++) {
+ xf86OutputPtr output = xf86_config->output[o];
+
+ if (output->crtc == crtc) {
+ switch (output->subpixel_order) {
+ case SubPixelNone:
+ has_none = TRUE;
+ break;
+ case SubPixelUnknown:
+ break;
+ default:
+ subpixel_order = output->subpixel_order;
+ break;
+ }
+ }
+ if (subpixel_order != SubPixelUnknown)
+ break;
+ }
+ if (subpixel_order != SubPixelUnknown) {
+ static const int circle[4] = {
+ SubPixelHorizontalRGB,
+ SubPixelVerticalRGB,
+ SubPixelHorizontalBGR,
+ SubPixelVerticalBGR,
+ };
+ int rotate;
+ int c;
+
+ for (rotate = 0; rotate < 4; rotate++)
+ if (crtc->rotation & (1 << rotate))
+ break;
+ for (c = 0; c < 4; c++)
+ if (circle[c] == subpixel_order)
+ break;
+ c = (c + rotate) & 0x3;
+ if ((crtc->rotation & RR_Reflect_X) && !(c & 1))
+ c ^= 2;
+ if ((crtc->rotation & RR_Reflect_Y) && (c & 1))
+ c ^= 2;
+ subpixel_order = circle[c];
+ break;
+ }
}
if (subpixel_order == SubPixelUnknown && has_none)
- subpixel_order = SubPixelNone;
- PictureSetSubpixelOrder (pScreen, subpixel_order);
+ subpixel_order = SubPixelNone;
+ PictureSetSubpixelOrder(pScreen, subpixel_order);
}
/**
* Sets the given video mode on the given crtc
*/
Bool
-xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
- RRTransformPtr transform, int x, int y)
-{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int i;
- Bool ret = FALSE;
- Bool didLock = FALSE;
- DisplayModePtr adjusted_mode;
- DisplayModeRec saved_mode;
- int saved_x, saved_y;
- Rotation saved_rotation;
- RRTransformRec saved_transform;
- Bool saved_transform_present;
-
- crtc->enabled = xf86CrtcInUse (crtc);
+xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
+ Rotation rotation, RRTransformPtr transform, int x,
+ int y)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+ Bool ret = FALSE;
+ Bool didLock = FALSE;
+ DisplayModePtr adjusted_mode;
+ DisplayModeRec saved_mode;
+ int saved_x, saved_y;
+ Rotation saved_rotation;
+ RRTransformRec saved_transform;
+ Bool saved_transform_present;
+
+ crtc->enabled = xf86CrtcInUse(crtc);
/* We only hit this if someone explicitly sends a "disabled" modeset. */
- if (!crtc->enabled)
- {
- /* Check everything for stuff that should be off. */
- xf86DisableUnusedFunctions(scrn);
- return TRUE;
+ if (!crtc->enabled) {
+ /* Check everything for stuff that should be off. */
+ xf86DisableUnusedFunctions(scrn);
+ return TRUE;
}
adjusted_mode = xf86DuplicateMode(mode);
-
saved_mode = crtc->mode;
saved_x = crtc->x;
saved_y = crtc->y;
saved_rotation = crtc->rotation;
if (crtc->transformPresent) {
- RRTransformInit (&saved_transform);
- RRTransformCopy (&saved_transform, &crtc->transform);
+ RRTransformInit(&saved_transform);
+ RRTransformCopy(&saved_transform, &crtc->transform);
}
saved_transform_present = crtc->transformPresent;
@@ -294,48 +284,49 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati
crtc->y = y;
crtc->rotation = rotation;
if (transform) {
- RRTransformCopy (&crtc->transform, transform);
- crtc->transformPresent = TRUE;
- } else
- crtc->transformPresent = FALSE;
+ RRTransformCopy(&crtc->transform, transform);
+ crtc->transformPresent = TRUE;
+ }
+ else
+ crtc->transformPresent = FALSE;
if (crtc->funcs->set_mode_major) {
- ret = crtc->funcs->set_mode_major(crtc, mode, rotation, x, y);
- goto done;
+ ret = crtc->funcs->set_mode_major(crtc, mode, rotation, x, y);
+ goto done;
}
- didLock = crtc->funcs->lock (crtc);
+ didLock = crtc->funcs->lock(crtc);
/* Pass our mode to the outputs and the CRTC to give them a chance to
* adjust it according to limitations or output properties, and also
* a chance to reject the mode entirely.
*/
for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
+ xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc != crtc)
- continue;
+ if (output->crtc != crtc)
+ continue;
- if (!output->funcs->mode_fixup(output, mode, adjusted_mode)) {
- goto done;
- }
+ if (!output->funcs->mode_fixup(output, mode, adjusted_mode)) {
+ goto done;
+ }
}
if (!crtc->funcs->mode_fixup(crtc, mode, adjusted_mode)) {
- goto done;
+ goto done;
}
- if (!xf86CrtcRotate (crtc))
- goto done;
+ if (!xf86CrtcRotate(crtc))
+ goto done;
/* Prepare the outputs and CRTCs before setting the mode. */
for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
+ xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc != crtc)
- continue;
+ if (output->crtc != crtc)
+ continue;
- /* Disable the output as the first thing we do. */
- output->funcs->prepare(output);
+ /* Disable the output as the first thing we do. */
+ output->funcs->prepare(output);
}
crtc->funcs->prepare(crtc);
@@ -344,51 +335,52 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati
* on the DPLL.
*/
crtc->funcs->mode_set(crtc, mode, adjusted_mode, crtc->x, crtc->y);
- for (i = 0; i < xf86_config->num_output; i++)
- {
- xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc == crtc)
- output->funcs->mode_set(output, mode, adjusted_mode);
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc == crtc)
+ output->funcs->mode_set(output, mode, adjusted_mode);
}
/* Only upload when needed, to avoid unneeded delays. */
if (!crtc->active && crtc->funcs->gamma_set)
- crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
- crtc->gamma_blue, crtc->gamma_size);
+ crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+ crtc->gamma_blue, crtc->gamma_size);
/* Now, enable the clocks, plane, pipe, and outputs that we set up. */
crtc->funcs->commit(crtc);
- for (i = 0; i < xf86_config->num_output; i++)
- {
- xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc == crtc)
- output->funcs->commit(output);
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc == crtc)
+ output->funcs->commit(output);
}
ret = TRUE;
-done:
+ done:
if (ret) {
- crtc->active = TRUE;
- if (scrn->pScreen)
- xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
- if (scrn->ModeSet)
- scrn->ModeSet(scrn);
- } else {
- crtc->x = saved_x;
- crtc->y = saved_y;
- crtc->rotation = saved_rotation;
- crtc->mode = saved_mode;
- if (saved_transform_present)
- RRTransformCopy (&crtc->transform, &saved_transform);
- crtc->transformPresent = saved_transform_present;
+ crtc->active = TRUE;
+ if (scrn->pScreen)
+ xf86CrtcSetScreenSubpixelOrder(scrn->pScreen);
+ if (scrn->ModeSet)
+ scrn->ModeSet(scrn);
+ }
+ else {
+ crtc->x = saved_x;
+ crtc->y = saved_y;
+ crtc->rotation = saved_rotation;
+ crtc->mode = saved_mode;
+ if (saved_transform_present)
+ RRTransformCopy(&crtc->transform, &saved_transform);
+ crtc->transformPresent = saved_transform_present;
}
free(adjusted_mode->name);
free(adjusted_mode);
if (didLock)
- crtc->funcs->unlock (crtc);
+ crtc->funcs->unlock(crtc);
return ret;
}
@@ -398,31 +390,31 @@ done:
* a transform
*/
Bool
-xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
- int x, int y)
+xf86CrtcSetMode(xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ int x, int y)
{
- return xf86CrtcSetModeTransform (crtc, mode, rotation, NULL, x, y);
+ return xf86CrtcSetModeTransform(crtc, mode, rotation, NULL, x, y);
}
/**
* Pans the screen, does not change the mode
*/
void
-xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y)
+xf86CrtcSetOrigin(xf86CrtcPtr crtc, int x, int y)
{
ScrnInfoPtr scrn = crtc->scrn;
crtc->x = x;
crtc->y = y;
if (crtc->funcs->set_origin) {
- if (!xf86CrtcRotate (crtc))
- return;
- crtc->funcs->set_origin (crtc, x, y);
- if (scrn->ModeSet)
- scrn->ModeSet(scrn);
+ if (!xf86CrtcRotate(crtc))
+ return;
+ crtc->funcs->set_origin(crtc, x, y);
+ if (scrn->ModeSet)
+ scrn->ModeSet(scrn);
}
else
- xf86CrtcSetMode (crtc, &crtc->mode, crtc->rotation, x, y);
+ xf86CrtcSetMode(crtc, &crtc->mode, crtc->rotation, x, y);
}
/*
@@ -450,22 +442,22 @@ typedef enum {
} OutputOpts;
static OptionInfoRec xf86OutputOptions[] = {
- {OPTION_PREFERRED_MODE, "PreferredMode", OPTV_STRING, {0}, FALSE },
- {OPTION_POSITION, "Position", OPTV_STRING, {0}, FALSE },
- {OPTION_BELOW, "Below", OPTV_STRING, {0}, FALSE },
- {OPTION_RIGHT_OF, "RightOf", OPTV_STRING, {0}, FALSE },
- {OPTION_ABOVE, "Above", OPTV_STRING, {0}, FALSE },
- {OPTION_LEFT_OF, "LeftOf", OPTV_STRING, {0}, FALSE },
- {OPTION_ENABLE, "Enable", OPTV_BOOLEAN, {0}, FALSE },
- {OPTION_DISABLE, "Disable", OPTV_BOOLEAN, {0}, FALSE },
- {OPTION_MIN_CLOCK, "MinClock", OPTV_FREQ, {0}, FALSE },
- {OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE },
- {OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE },
- {OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
- {OPTION_PANNING, "Panning", OPTV_STRING, {0}, FALSE },
- {OPTION_PRIMARY, "Primary", OPTV_BOOLEAN, {0}, FALSE },
- {OPTION_DEFAULT_MODES, "DefaultModes", OPTV_BOOLEAN, {0}, FALSE },
- {-1, NULL, OPTV_NONE, {0}, FALSE },
+ {OPTION_PREFERRED_MODE, "PreferredMode", OPTV_STRING, {0}, FALSE},
+ {OPTION_POSITION, "Position", OPTV_STRING, {0}, FALSE},
+ {OPTION_BELOW, "Below", OPTV_STRING, {0}, FALSE},
+ {OPTION_RIGHT_OF, "RightOf", OPTV_STRING, {0}, FALSE},
+ {OPTION_ABOVE, "Above", OPTV_STRING, {0}, FALSE},
+ {OPTION_LEFT_OF, "LeftOf", OPTV_STRING, {0}, FALSE},
+ {OPTION_ENABLE, "Enable", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DISABLE, "Disable", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_MIN_CLOCK, "MinClock", OPTV_FREQ, {0}, FALSE},
+ {OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE},
+ {OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE},
+ {OPTION_PANNING, "Panning", OPTV_STRING, {0}, FALSE},
+ {OPTION_PRIMARY, "Primary", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DEFAULT_MODES, "DefaultModes", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE},
};
enum {
@@ -473,144 +465,138 @@ enum {
};
static OptionInfoRec xf86DeviceOptions[] = {
- {OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE },
- {-1, NULL, OPTV_NONE, {0}, FALSE },
+ {OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE},
};
static void
-xf86OutputSetMonitor (xf86OutputPtr output)
+xf86OutputSetMonitor(xf86OutputPtr output)
{
- char *option_name;
- const char *monitor;
+ char *option_name;
+ const char *monitor;
if (!output->name)
- return;
+ return;
free(output->options);
- output->options = xnfalloc (sizeof (xf86OutputOptions));
- memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
+ output->options = xnfalloc(sizeof(xf86OutputOptions));
+ memcpy(output->options, xf86OutputOptions, sizeof(xf86OutputOptions));
XNFasprintf(&option_name, "monitor-%s", output->name);
- monitor = xf86findOptionValue (output->scrn->options, option_name);
+ monitor = xf86findOptionValue(output->scrn->options, option_name);
if (!monitor)
- monitor = output->name;
+ monitor = output->name;
else
- xf86MarkOptionUsedByName (output->scrn->options, option_name);
+ xf86MarkOptionUsedByName(output->scrn->options, option_name);
free(option_name);
- output->conf_monitor = xf86findMonitor (monitor,
- xf86configptr->conf_monitor_lst);
+ output->conf_monitor = xf86findMonitor(monitor,
+ xf86configptr->conf_monitor_lst);
/*
* Find the monitor section of the screen and use that
*/
if (!output->conf_monitor && output->use_screen_monitor)
- output->conf_monitor = xf86findMonitor (output->scrn->monitor->id,
- xf86configptr->conf_monitor_lst);
- if (output->conf_monitor)
- {
- xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
- "Output %s using monitor section %s\n",
- output->name, output->conf_monitor->mon_identifier);
- xf86ProcessOptions (output->scrn->scrnIndex,
- output->conf_monitor->mon_option_lst,
- output->options);
+ output->conf_monitor = xf86findMonitor(output->scrn->monitor->id,
+ xf86configptr->conf_monitor_lst);
+ if (output->conf_monitor) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
+ "Output %s using monitor section %s\n",
+ output->name, output->conf_monitor->mon_identifier);
+ xf86ProcessOptions(output->scrn->scrnIndex,
+ output->conf_monitor->mon_option_lst,
+ output->options);
}
else
- xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
- "Output %s has no monitor section\n",
- output->name);
+ xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
+ "Output %s has no monitor section\n", output->name);
}
static Bool
-xf86OutputEnabled (xf86OutputPtr output, Bool strict)
+xf86OutputEnabled(xf86OutputPtr output, Bool strict)
{
- Bool enable, disable;
+ Bool enable, disable;
/* check to see if this output was enabled in the config file */
- if (xf86GetOptValBool (output->options, OPTION_ENABLE, &enable) && enable)
- {
- xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
- "Output %s enabled by config file\n", output->name);
- return TRUE;
+ if (xf86GetOptValBool(output->options, OPTION_ENABLE, &enable) && enable) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
+ "Output %s enabled by config file\n", output->name);
+ return TRUE;
}
/* or if this output was disabled in the config file */
- if (xf86GetOptValBool (output->options, OPTION_DISABLE, &disable) && disable)
- {
- xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
- "Output %s disabled by config file\n", output->name);
- return FALSE;
+ if (xf86GetOptValBool(output->options, OPTION_DISABLE, &disable) && disable) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
+ "Output %s disabled by config file\n", output->name);
+ return FALSE;
}
/* If not, try to only light up the ones we know are connected */
if (strict) {
- enable = output->status == XF86OutputStatusConnected;
+ enable = output->status == XF86OutputStatusConnected;
}
/* But if that fails, try to light up even outputs we're unsure of */
else {
- enable = output->status != XF86OutputStatusDisconnected;
+ enable = output->status != XF86OutputStatusDisconnected;
}
- xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
- "Output %s %sconnected\n", output->name, enable ? "" : "dis");
+ xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
+ "Output %s %sconnected\n", output->name, enable ? "" : "dis");
return enable;
}
static Bool
-xf86OutputIgnored (xf86OutputPtr output)
+xf86OutputIgnored(xf86OutputPtr output)
{
- return xf86ReturnOptValBool (output->options, OPTION_IGNORE, FALSE);
+ return xf86ReturnOptValBool(output->options, OPTION_IGNORE, FALSE);
}
static const char *direction[4] = {
- "normal",
- "left",
- "inverted",
+ "normal",
+ "left",
+ "inverted",
"right"
};
static Rotation
-xf86OutputInitialRotation (xf86OutputPtr output)
+xf86OutputInitialRotation(xf86OutputPtr output)
{
- char *rotate_name = xf86GetOptValString (output->options,
- OPTION_ROTATE);
- int i;
+ char *rotate_name = xf86GetOptValString(output->options,
+ OPTION_ROTATE);
+ int i;
if (!rotate_name) {
- if (output->initial_rotation)
- return output->initial_rotation;
- return RR_Rotate_0;
+ if (output->initial_rotation)
+ return output->initial_rotation;
+ return RR_Rotate_0;
}
-
+
for (i = 0; i < 4; i++)
- if (xf86nameCompare (direction[i], rotate_name) == 0)
- return 1 << i;
+ if (xf86nameCompare(direction[i], rotate_name) == 0)
+ return 1 << i;
return RR_Rotate_0;
}
xf86OutputPtr
-xf86OutputCreate (ScrnInfoPtr scrn,
- const xf86OutputFuncsRec *funcs,
- const char *name)
+xf86OutputCreate(ScrnInfoPtr scrn,
+ const xf86OutputFuncsRec * funcs, const char *name)
{
- xf86OutputPtr output, *outputs;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int len;
- Bool primary;
+ xf86OutputPtr output, *outputs;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int len;
+ Bool primary;
if (name)
- len = strlen (name) + 1;
+ len = strlen(name) + 1;
else
- len = 0;
+ len = 0;
- output = calloc(sizeof (xf86OutputRec) + len, 1);
+ output = calloc(sizeof(xf86OutputRec) + len, 1);
if (!output)
- return NULL;
+ return NULL;
output->scrn = scrn;
output->funcs = funcs;
- if (name)
- {
- output->name = (char *) (output + 1);
- strcpy (output->name, name);
+ if (name) {
+ output->name = (char *) (output + 1);
+ strcpy(output->name, name);
}
output->subpixel_order = SubPixelUnknown;
/*
@@ -620,39 +606,34 @@ xf86OutputCreate (ScrnInfoPtr scrn,
#ifdef RANDR_12_INTERFACE
output->randr_output = NULL;
#endif
- if (name)
- {
- xf86OutputSetMonitor (output);
- if (xf86OutputIgnored (output))
- {
- free(output);
- return FALSE;
- }
- }
-
-
+ if (name) {
+ xf86OutputSetMonitor(output);
+ if (xf86OutputIgnored(output)) {
+ free(output);
+ return FALSE;
+ }
+ }
+
if (xf86_config->output)
- outputs = realloc(xf86_config->output,
- (xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
+ outputs = realloc(xf86_config->output,
+ (xf86_config->num_output +
+ 1) * sizeof(xf86OutputPtr));
else
- outputs = malloc((xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
- if (!outputs)
- {
- free(output);
- return NULL;
+ outputs = malloc((xf86_config->num_output + 1) * sizeof(xf86OutputPtr));
+ if (!outputs) {
+ free(output);
+ return NULL;
}
xf86_config->output = outputs;
- if (xf86GetOptValBool (output->options, OPTION_PRIMARY, &primary) && primary)
- {
- memmove(xf86_config->output + 1, xf86_config->output,
- xf86_config->num_output * sizeof (xf86OutputPtr));
- xf86_config->output[0] = output;
+ if (xf86GetOptValBool(output->options, OPTION_PRIMARY, &primary) && primary) {
+ memmove(xf86_config->output + 1, xf86_config->output,
+ xf86_config->num_output * sizeof(xf86OutputPtr));
+ xf86_config->output[0] = output;
}
- else
- {
- xf86_config->output[xf86_config->num_output] = output;
+ else {
+ xf86_config->output[xf86_config->num_output] = output;
}
xf86_config->num_output++;
@@ -661,53 +642,51 @@ xf86OutputCreate (ScrnInfoPtr scrn,
}
Bool
-xf86OutputRename (xf86OutputPtr output, const char *name)
+xf86OutputRename(xf86OutputPtr output, const char *name)
{
- char *newname = strdup(name);
-
+ char *newname = strdup(name);
+
if (!newname)
- return FALSE; /* so sorry... */
-
+ return FALSE; /* so sorry... */
+
if (output->name && output->name != (char *) (output + 1))
- free(output->name);
+ free(output->name);
output->name = newname;
- xf86OutputSetMonitor (output);
- if (xf86OutputIgnored (output))
- return FALSE;
+ xf86OutputSetMonitor(output);
+ if (xf86OutputIgnored(output))
+ return FALSE;
return TRUE;
}
void
-xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
+xf86OutputUseScreenMonitor(xf86OutputPtr output, Bool use_screen_monitor)
{
- if (use_screen_monitor != output->use_screen_monitor)
- {
- output->use_screen_monitor = use_screen_monitor;
- xf86OutputSetMonitor (output);
+ if (use_screen_monitor != output->use_screen_monitor) {
+ output->use_screen_monitor = use_screen_monitor;
+ xf86OutputSetMonitor(output);
}
}
void
-xf86OutputDestroy (xf86OutputPtr output)
+xf86OutputDestroy(xf86OutputPtr output)
{
- ScrnInfoPtr scrn = output->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
-
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
(*output->funcs->destroy) (output);
while (output->probed_modes)
- xf86DeleteMode (&output->probed_modes, output->probed_modes);
+ xf86DeleteMode(&output->probed_modes, output->probed_modes);
for (o = 0; o < xf86_config->num_output; o++)
- if (xf86_config->output[o] == output)
- {
- memmove (&xf86_config->output[o],
- &xf86_config->output[o+1],
- ((xf86_config->num_output - (o + 1)) * sizeof(void*)));
- xf86_config->num_output--;
- break;
- }
+ if (xf86_config->output[o] == output) {
+ memmove(&xf86_config->output[o],
+ &xf86_config->output[o + 1],
+ ((xf86_config->num_output - (o + 1)) * sizeof(void *)));
+ xf86_config->num_output--;
+ break;
+ }
if (output->name && output->name != (char *) (output + 1))
- free(output->name);
+ free(output->name);
free(output);
}
@@ -715,18 +694,18 @@ xf86OutputDestroy (xf86OutputPtr output)
* Called during CreateScreenResources to hook up RandR
*/
static Bool
-xf86CrtcCreateScreenResources (ScreenPtr screen)
+xf86CrtcCreateScreenResources(ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
screen->CreateScreenResources = config->CreateScreenResources;
-
- if (!(*screen->CreateScreenResources)(screen))
- return FALSE;
- if (!xf86RandR12CreateScreenResources (screen))
- return FALSE;
+ if (!(*screen->CreateScreenResources) (screen))
+ return FALSE;
+
+ if (!xf86RandR12CreateScreenResources(screen))
+ return FALSE;
return TRUE;
}
@@ -735,31 +714,29 @@ xf86CrtcCreateScreenResources (ScreenPtr screen)
* Clean up config on server reset
*/
static Bool
-xf86CrtcCloseScreen (int index, ScreenPtr screen)
+xf86CrtcCloseScreen(int index, ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o, c;
-
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o, c;
+
screen->CloseScreen = config->CloseScreen;
- xf86RotateCloseScreen (screen);
+ xf86RotateCloseScreen(screen);
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
- output->randr_output = NULL;
+ output->randr_output = NULL;
}
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
- crtc->randr_crtc = NULL;
+ crtc->randr_crtc = NULL;
}
- xf86RandR12CloseScreen (screen);
+ xf86RandR12CloseScreen(screen);
- return screen->CloseScreen (index, screen);
+ return screen->CloseScreen(index, screen);
}
/*
@@ -770,37 +747,36 @@ int
#else
Bool
#endif
-xf86CrtcScreenInit (ScreenPtr screen)
+xf86CrtcScreenInit(ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
/* Rotation */
- xf86DrvMsg(scrn->scrnIndex, X_INFO, "RandR 1.2 enabled, ignore the following RandR disabled message.\n");
- xf86DisableRandR(); /* Disable old RandR extension support */
- xf86RandR12Init (screen);
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "RandR 1.2 enabled, ignore the following RandR disabled message.\n");
+ xf86DisableRandR(); /* Disable old RandR extension support */
+ xf86RandR12Init(screen);
/* support all rotations if every crtc has the shadow alloc funcs */
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
- if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create)
- break;
- }
- if (c == config->num_crtc)
- {
- xf86RandR12SetRotations (screen, RR_Rotate_0 | RR_Rotate_90 |
- RR_Rotate_180 | RR_Rotate_270 |
- RR_Reflect_X | RR_Reflect_Y);
- xf86RandR12SetTransformSupport (screen, TRUE);
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create)
+ break;
}
- else
- {
- xf86RandR12SetRotations (screen, RR_Rotate_0);
- xf86RandR12SetTransformSupport (screen, FALSE);
+ if (c == config->num_crtc) {
+ xf86RandR12SetRotations(screen, RR_Rotate_0 | RR_Rotate_90 |
+ RR_Rotate_180 | RR_Rotate_270 |
+ RR_Reflect_X | RR_Reflect_Y);
+ xf86RandR12SetTransformSupport(screen, TRUE);
+ }
+ else {
+ xf86RandR12SetRotations(screen, RR_Rotate_0);
+ xf86RandR12SetTransformSupport(screen, FALSE);
}
-
+
/* Wrap CreateScreenResources so we can initialize the RandR code */
config->CreateScreenResources = screen->CreateScreenResources;
screen->CreateScreenResources = xf86CrtcCreateScreenResources;
@@ -810,7 +786,7 @@ xf86CrtcScreenInit (ScreenPtr screen)
/* This might still be marked wrapped from a previous generation */
config->BlockHandler = NULL;
-
+
#ifdef XFreeXDGA
_xf86_di_dga_init_internal(screen);
#endif
@@ -822,205 +798,198 @@ xf86CrtcScreenInit (ScreenPtr screen)
}
static DisplayModePtr
-xf86DefaultMode (xf86OutputPtr output, int width, int height)
-{
- DisplayModePtr target_mode = NULL;
- DisplayModePtr mode;
- int target_diff = 0;
- int target_preferred = 0;
- int mm_height;
-
+xf86DefaultMode(xf86OutputPtr output, int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ DisplayModePtr mode;
+ int target_diff = 0;
+ int target_preferred = 0;
+ int mm_height;
+
mm_height = output->mm_height;
if (!mm_height)
- mm_height = (768 * 25.4) / DEFAULT_DPI;
+ mm_height = (768 * 25.4) / DEFAULT_DPI;
/*
* Pick a mode closest to DEFAULT_DPI
*/
- for (mode = output->probed_modes; mode; mode = mode->next)
- {
- int dpi;
- int preferred = (((mode->type & M_T_PREFERRED) != 0) +
- ((mode->type & M_T_USERPREF) != 0));
- int diff;
-
- if (xf86ModeWidth (mode, output->initial_rotation) > width ||
- xf86ModeHeight (mode, output->initial_rotation) > height)
- continue;
-
- /* yes, use VDisplay here, not xf86ModeHeight */
- dpi = (mode->VDisplay * 254) / (mm_height * 10);
- diff = dpi - DEFAULT_DPI;
- diff = diff < 0 ? -diff : diff;
- if (target_mode == NULL || (preferred > target_preferred) ||
- (preferred == target_preferred && diff < target_diff))
- {
- target_mode = mode;
- target_diff = diff;
- target_preferred = preferred;
- }
+ for (mode = output->probed_modes; mode; mode = mode->next) {
+ int dpi;
+ int preferred = (((mode->type & M_T_PREFERRED) != 0) +
+ ((mode->type & M_T_USERPREF) != 0));
+ int diff;
+
+ if (xf86ModeWidth(mode, output->initial_rotation) > width ||
+ xf86ModeHeight(mode, output->initial_rotation) > height)
+ continue;
+
+ /* yes, use VDisplay here, not xf86ModeHeight */
+ dpi = (mode->VDisplay * 254) / (mm_height * 10);
+ diff = dpi - DEFAULT_DPI;
+ diff = diff < 0 ? -diff : diff;
+ if (target_mode == NULL || (preferred > target_preferred) ||
+ (preferred == target_preferred && diff < target_diff)) {
+ target_mode = mode;
+ target_diff = diff;
+ target_preferred = preferred;
+ }
}
return target_mode;
}
static DisplayModePtr
-xf86ClosestMode (xf86OutputPtr output,
- DisplayModePtr match, Rotation match_rotation,
- int width, int height)
-{
- DisplayModePtr target_mode = NULL;
- DisplayModePtr mode;
- int target_diff = 0;
-
+xf86ClosestMode(xf86OutputPtr output,
+ DisplayModePtr match, Rotation match_rotation,
+ int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ DisplayModePtr mode;
+ int target_diff = 0;
+
/*
* Pick a mode closest to the specified mode
*/
- for (mode = output->probed_modes; mode; mode = mode->next)
- {
- int dx, dy;
- int diff;
-
- if (xf86ModeWidth (mode, output->initial_rotation) > width ||
- xf86ModeHeight (mode, output->initial_rotation) > height)
- continue;
-
- /* exact matches are preferred */
- if (output->initial_rotation == match_rotation &&
- xf86ModesEqual (mode, match))
- return mode;
-
- dx = xf86ModeWidth (match, match_rotation) - xf86ModeWidth (mode, output->initial_rotation);
- dy = xf86ModeHeight (match, match_rotation) - xf86ModeHeight (mode, output->initial_rotation);
- diff = dx * dx + dy * dy;
- if (target_mode == NULL || diff < target_diff)
- {
- target_mode = mode;
- target_diff = diff;
- }
+ for (mode = output->probed_modes; mode; mode = mode->next) {
+ int dx, dy;
+ int diff;
+
+ if (xf86ModeWidth(mode, output->initial_rotation) > width ||
+ xf86ModeHeight(mode, output->initial_rotation) > height)
+ continue;
+
+ /* exact matches are preferred */
+ if (output->initial_rotation == match_rotation &&
+ xf86ModesEqual(mode, match))
+ return mode;
+
+ dx = xf86ModeWidth(match, match_rotation) - xf86ModeWidth(mode,
+ output->
+ initial_rotation);
+ dy = xf86ModeHeight(match, match_rotation) - xf86ModeHeight(mode,
+ output->
+ initial_rotation);
+ diff = dx * dx + dy * dy;
+ if (target_mode == NULL || diff < target_diff) {
+ target_mode = mode;
+ target_diff = diff;
+ }
}
return target_mode;
}
static DisplayModePtr
-xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
+xf86OutputHasPreferredMode(xf86OutputPtr output, int width, int height)
{
- DisplayModePtr mode;
+ DisplayModePtr mode;
- for (mode = output->probed_modes; mode; mode = mode->next)
- {
- if (xf86ModeWidth (mode, output->initial_rotation) > width ||
- xf86ModeHeight (mode, output->initial_rotation) > height)
- continue;
+ for (mode = output->probed_modes; mode; mode = mode->next) {
+ if (xf86ModeWidth(mode, output->initial_rotation) > width ||
+ xf86ModeHeight(mode, output->initial_rotation) > height)
+ continue;
- if (mode->type & M_T_PREFERRED)
- return mode;
+ if (mode->type & M_T_PREFERRED)
+ return mode;
}
return NULL;
}
static DisplayModePtr
-xf86OutputHasUserPreferredMode (xf86OutputPtr output)
+xf86OutputHasUserPreferredMode(xf86OutputPtr output)
{
DisplayModePtr mode, first = output->probed_modes;
for (mode = first; mode && mode->next != first; mode = mode->next)
- if (mode->type & M_T_USERPREF)
- return mode;
+ if (mode->type & M_T_USERPREF)
+ return mode;
return NULL;
}
static int
-xf86PickCrtcs (ScrnInfoPtr scrn,
- xf86CrtcPtr *best_crtcs,
- DisplayModePtr *modes,
- int n,
- int width,
- int height)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int c, o;
- xf86OutputPtr output;
- xf86CrtcPtr crtc;
- xf86CrtcPtr *crtcs;
- xf86CrtcPtr best_crtc;
- int best_score;
- int score;
- int my_score;
-
+xf86PickCrtcs(ScrnInfoPtr scrn,
+ xf86CrtcPtr * best_crtcs,
+ DisplayModePtr * modes, int n, int width, int height)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ xf86CrtcPtr *crtcs;
+ xf86CrtcPtr best_crtc;
+ int best_score;
+ int score;
+ int my_score;
+
if (n == config->num_output)
- return 0;
+ return 0;
output = config->output[n];
-
+
/*
* Compute score with this output disabled
*/
best_crtcs[n] = NULL;
best_crtc = NULL;
- best_score = xf86PickCrtcs (scrn, best_crtcs, modes, n+1, width, height);
+ best_score = xf86PickCrtcs(scrn, best_crtcs, modes, n + 1, width, height);
if (modes[n] == NULL)
- return best_score;
-
- crtcs = malloc(config->num_output * sizeof (xf86CrtcPtr));
+ return best_score;
+
+ crtcs = malloc(config->num_output * sizeof(xf86CrtcPtr));
if (!crtcs)
- return best_score;
+ return best_score;
my_score = 1;
/* Score outputs that are known to be connected higher */
if (output->status == XF86OutputStatusConnected)
- my_score++;
+ my_score++;
/* Score outputs with preferred modes higher */
- if (xf86OutputHasPreferredMode (output, width, height))
- my_score++;
+ if (xf86OutputHasPreferredMode(output, width, height))
+ my_score++;
/*
* Select a crtc for this output and
* then attempt to configure the remaining
* outputs
*/
- for (c = 0; c < config->num_crtc; c++)
- {
- if ((output->possible_crtcs & (1 << c)) == 0)
- continue;
-
- crtc = config->crtc[c];
- /*
- * Check to see if some other output is
- * using this crtc
- */
- for (o = 0; o < n; o++)
- if (best_crtcs[o] == crtc)
- break;
- if (o < n)
- {
- /*
- * If the two outputs desire the same mode,
- * see if they can be cloned
- */
- if (xf86ModesEqual (modes[o], modes[n]) &&
- config->output[o]->initial_rotation == config->output[n]->initial_rotation &&
- config->output[o]->initial_x == config->output[n]->initial_x &&
- config->output[o]->initial_y == config->output[n]->initial_y)
- {
- if ((output->possible_clones & (1 << o)) == 0)
- continue; /* nope, try next CRTC */
- }
- else
- continue; /* different modes, can't clone */
- }
- crtcs[n] = crtc;
- memcpy (crtcs, best_crtcs, n * sizeof (xf86CrtcPtr));
- score = my_score + xf86PickCrtcs (scrn, crtcs, modes, n+1, width, height);
- if (score > best_score)
- {
- best_crtc = crtc;
- best_score = score;
- memcpy (best_crtcs, crtcs, config->num_output * sizeof (xf86CrtcPtr));
- }
+ for (c = 0; c < config->num_crtc; c++) {
+ if ((output->possible_crtcs & (1 << c)) == 0)
+ continue;
+
+ crtc = config->crtc[c];
+ /*
+ * Check to see if some other output is
+ * using this crtc
+ */
+ for (o = 0; o < n; o++)
+ if (best_crtcs[o] == crtc)
+ break;
+ if (o < n) {
+ /*
+ * If the two outputs desire the same mode,
+ * see if they can be cloned
+ */
+ if (xf86ModesEqual(modes[o], modes[n]) &&
+ config->output[o]->initial_rotation ==
+ config->output[n]->initial_rotation &&
+ config->output[o]->initial_x == config->output[n]->initial_x &&
+ config->output[o]->initial_y == config->output[n]->initial_y) {
+ if ((output->possible_clones & (1 << o)) == 0)
+ continue; /* nope, try next CRTC */
+ }
+ else
+ continue; /* different modes, can't clone */
+ }
+ crtcs[n] = crtc;
+ memcpy(crtcs, best_crtcs, n * sizeof(xf86CrtcPtr));
+ score =
+ my_score + xf86PickCrtcs(scrn, crtcs, modes, n + 1, width, height);
+ if (score > best_score) {
+ best_crtc = crtc;
+ best_score = score;
+ memcpy(best_crtcs, crtcs, config->num_output * sizeof(xf86CrtcPtr));
+ }
}
free(crtcs);
return best_score;
}
-
/*
* Compute the virtual size necessary to place all of the available
* crtcs in the specified configuration.
@@ -1031,57 +1000,62 @@ xf86PickCrtcs (ScrnInfoPtr scrn,
*/
static void
-xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp,
- Bool canGrow)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int width = 0, height = 0;
- int o;
- int c;
- int s;
-
- for (c = 0; c < config->num_crtc; c++)
- {
- int crtc_width = 0, crtc_height = 0;
- xf86CrtcPtr crtc = config->crtc[c];
-
- if (crtc->enabled)
- {
- crtc_width = crtc->desiredX + xf86ModeWidth (&crtc->desiredMode, crtc->desiredRotation);
- crtc_height = crtc->desiredY + xf86ModeHeight (&crtc->desiredMode, crtc->desiredRotation);
- }
- if (!canGrow) {
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- for (s = 0; s < config->num_crtc; s++)
- if (output->possible_crtcs & (1 << s))
- {
- DisplayModePtr mode;
- for (mode = output->probed_modes; mode; mode = mode->next)
- {
- if (mode->HDisplay > crtc_width)
- crtc_width = mode->HDisplay;
- if (mode->VDisplay > crtc_width)
- crtc_width = mode->VDisplay;
- if (mode->VDisplay > crtc_height)
- crtc_height = mode->VDisplay;
- if (mode->HDisplay > crtc_height)
- crtc_height = mode->HDisplay;
- }
- }
- }
- }
- if (crtc_width > width)
- width = crtc_width;
- if (crtc_height > height)
- height = crtc_height;
- }
- if (config->maxWidth && width > config->maxWidth) width = config->maxWidth;
- if (config->maxHeight && height > config->maxHeight) height = config->maxHeight;
- if (config->minWidth && width < config->minWidth) width = config->minWidth;
- if (config->minHeight && height < config->minHeight) height = config->minHeight;
+xf86DefaultScreenLimits(ScrnInfoPtr scrn, int *widthp, int *heightp,
+ Bool canGrow)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int width = 0, height = 0;
+ int o;
+ int c;
+ int s;
+
+ for (c = 0; c < config->num_crtc; c++) {
+ int crtc_width = 0, crtc_height = 0;
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ if (crtc->enabled) {
+ crtc_width =
+ crtc->desiredX + xf86ModeWidth(&crtc->desiredMode,
+ crtc->desiredRotation);
+ crtc_height =
+ crtc->desiredY + xf86ModeHeight(&crtc->desiredMode,
+ crtc->desiredRotation);
+ }
+ if (!canGrow) {
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+
+ for (s = 0; s < config->num_crtc; s++)
+ if (output->possible_crtcs & (1 << s)) {
+ DisplayModePtr mode;
+
+ for (mode = output->probed_modes; mode;
+ mode = mode->next) {
+ if (mode->HDisplay > crtc_width)
+ crtc_width = mode->HDisplay;
+ if (mode->VDisplay > crtc_width)
+ crtc_width = mode->VDisplay;
+ if (mode->VDisplay > crtc_height)
+ crtc_height = mode->VDisplay;
+ if (mode->HDisplay > crtc_height)
+ crtc_height = mode->HDisplay;
+ }
+ }
+ }
+ }
+ if (crtc_width > width)
+ width = crtc_width;
+ if (crtc_height > height)
+ height = crtc_height;
+ }
+ if (config->maxWidth && width > config->maxWidth)
+ width = config->maxWidth;
+ if (config->maxHeight && height > config->maxHeight)
+ height = config->maxHeight;
+ if (config->minWidth && width < config->minWidth)
+ width = config->minWidth;
+ if (config->minHeight && height < config->minHeight)
+ height = config->minHeight;
*widthp = width;
*heightp = height;
}
@@ -1093,216 +1067,200 @@ xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp,
* with either a position or a relative setting or a mode.
*/
static Bool
-xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr *modes)
+xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr * modes)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o;
Bool user_conf = FALSE;
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- char *position;
- char *relative_name;
- OutputOpts relation;
- int r;
- static const OutputOpts relations[] = {
- OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
- };
-
- position = xf86GetOptValString (output->options,
- OPTION_POSITION);
- if (position)
- user_conf = TRUE;
-
- relation = 0;
- relative_name = NULL;
- for (r = 0; r < 4; r++)
- {
- relation = relations[r];
- relative_name = xf86GetOptValString (output->options,
- relation);
- if (relative_name)
- break;
- }
- if (relative_name)
- user_conf = TRUE;
-
- modes[o] = xf86OutputHasUserPreferredMode(output);
- if (modes[o])
- user_conf = TRUE;
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+ char *position;
+ char *relative_name;
+ OutputOpts relation;
+ int r;
+
+ static const OutputOpts relations[] = {
+ OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
+ };
+
+ position = xf86GetOptValString(output->options, OPTION_POSITION);
+ if (position)
+ user_conf = TRUE;
+
+ relation = 0;
+ relative_name = NULL;
+ for (r = 0; r < 4; r++) {
+ relation = relations[r];
+ relative_name = xf86GetOptValString(output->options, relation);
+ if (relative_name)
+ break;
+ }
+ if (relative_name)
+ user_conf = TRUE;
+
+ modes[o] = xf86OutputHasUserPreferredMode(output);
+ if (modes[o])
+ user_conf = TRUE;
}
return user_conf;
}
static Bool
-xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
+xf86InitialOutputPositions(ScrnInfoPtr scrn, DisplayModePtr * modes)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
- int min_x, min_y;
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+ int min_x, min_y;
+
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
- output->initial_x = output->initial_y = POSITION_UNSET;
+ output->initial_x = output->initial_y = POSITION_UNSET;
}
-
+
/*
* Loop until all outputs are set
*/
- for (;;)
- {
- Bool any_set = FALSE;
- Bool keep_going = FALSE;
-
- for (o = 0; o < config->num_output; o++)
- {
- static const OutputOpts relations[] = {
- OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
- };
- xf86OutputPtr output = config->output[o];
- xf86OutputPtr relative;
- char *relative_name;
- char *position;
- OutputOpts relation;
- int r;
-
- if (output->initial_x != POSITION_UNSET)
- continue;
- position = xf86GetOptValString (output->options,
- OPTION_POSITION);
- /*
- * Absolute position wins
- */
- if (position)
- {
- int x, y;
- if (sscanf (position, "%d %d", &x, &y) == 2)
- {
- output->initial_x = x;
- output->initial_y = y;
- }
- else
- {
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Output %s position not of form \"x y\"\n",
- output->name);
- output->initial_x = output->initial_y = 0;
- }
- any_set = TRUE;
- continue;
- }
- /*
- * Next comes relative positions
- */
- relation = 0;
- relative_name = NULL;
- for (r = 0; r < 4; r++)
- {
- relation = relations[r];
- relative_name = xf86GetOptValString (output->options,
- relation);
- if (relative_name)
- break;
- }
- if (relative_name)
- {
- int or;
- relative = NULL;
- for (or = 0; or < config->num_output; or++)
- {
- xf86OutputPtr out_rel = config->output[or];
- XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor;
-
- if (rel_mon)
- {
- if (xf86nameCompare (rel_mon->mon_identifier,
- relative_name) == 0)
- {
- relative = config->output[or];
- break;
- }
- }
- if (strcmp (out_rel->name, relative_name) == 0)
- {
- relative = config->output[or];
- break;
- }
- }
- if (!relative)
- {
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Cannot position output %s relative to unknown output %s\n",
- output->name, relative_name);
- output->initial_x = 0;
- output->initial_y = 0;
- any_set = TRUE;
- continue;
- }
- if (!modes[or])
- {
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Cannot position output %s relative to output %s without modes\n",
- output->name, relative_name);
- output->initial_x = 0;
- output->initial_y = 0;
- any_set = TRUE;
- continue;
- }
- if (relative->initial_x == POSITION_UNSET)
- {
- keep_going = TRUE;
- continue;
- }
- output->initial_x = relative->initial_x;
- output->initial_y = relative->initial_y;
- switch (relation) {
- case OPTION_BELOW:
- output->initial_y += xf86ModeHeight (modes[or], relative->initial_rotation);
- break;
- case OPTION_RIGHT_OF:
- output->initial_x += xf86ModeWidth (modes[or], relative->initial_rotation);
- break;
- case OPTION_ABOVE:
- if (modes[o])
- output->initial_y -= xf86ModeHeight (modes[o], output->initial_rotation);
- break;
- case OPTION_LEFT_OF:
- if (modes[o])
- output->initial_x -= xf86ModeWidth (modes[o], output->initial_rotation);
- break;
- default:
- break;
- }
- any_set = TRUE;
- continue;
- }
-
- /* Nothing set, just stick them at 0,0 */
- output->initial_x = 0;
- output->initial_y = 0;
- any_set = TRUE;
- }
- if (!keep_going)
- break;
- if (!any_set)
- {
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- if (output->initial_x == POSITION_UNSET)
- {
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Output position loop. Moving %s to 0,0\n",
- output->name);
- output->initial_x = output->initial_y = 0;
- break;
- }
- }
- }
+ for (;;) {
+ Bool any_set = FALSE;
+ Bool keep_going = FALSE;
+
+ for (o = 0; o < config->num_output; o++) {
+ static const OutputOpts relations[] = {
+ OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
+ };
+ xf86OutputPtr output = config->output[o];
+ xf86OutputPtr relative;
+ char *relative_name;
+ char *position;
+ OutputOpts relation;
+ int r;
+
+ if (output->initial_x != POSITION_UNSET)
+ continue;
+ position = xf86GetOptValString(output->options, OPTION_POSITION);
+ /*
+ * Absolute position wins
+ */
+ if (position) {
+ int x, y;
+
+ if (sscanf(position, "%d %d", &x, &y) == 2) {
+ output->initial_x = x;
+ output->initial_y = y;
+ }
+ else {
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "Output %s position not of form \"x y\"\n",
+ output->name);
+ output->initial_x = output->initial_y = 0;
+ }
+ any_set = TRUE;
+ continue;
+ }
+ /*
+ * Next comes relative positions
+ */
+ relation = 0;
+ relative_name = NULL;
+ for (r = 0; r < 4; r++) {
+ relation = relations[r];
+ relative_name = xf86GetOptValString(output->options, relation);
+ if (relative_name)
+ break;
+ }
+ if (relative_name) {
+ int or;
+
+ relative = NULL;
+ for (or = 0; or < config->num_output; or++) {
+ xf86OutputPtr out_rel = config->output[or];
+ XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor;
+
+ if (rel_mon) {
+ if (xf86nameCompare(rel_mon->mon_identifier,
+ relative_name) == 0) {
+ relative = config->output[or];
+ break;
+ }
+ }
+ if (strcmp(out_rel->name, relative_name) == 0) {
+ relative = config->output[or];
+ break;
+ }
+ }
+ if (!relative) {
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "Cannot position output %s relative to unknown output %s\n",
+ output->name, relative_name);
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ continue;
+ }
+ if (!modes[or]) {
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "Cannot position output %s relative to output %s without modes\n",
+ output->name, relative_name);
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ continue;
+ }
+ if (relative->initial_x == POSITION_UNSET) {
+ keep_going = TRUE;
+ continue;
+ }
+ output->initial_x = relative->initial_x;
+ output->initial_y = relative->initial_y;
+ switch (relation) {
+ case OPTION_BELOW:
+ output->initial_y +=
+ xf86ModeHeight(modes[or], relative->initial_rotation);
+ break;
+ case OPTION_RIGHT_OF:
+ output->initial_x +=
+ xf86ModeWidth(modes[or], relative->initial_rotation);
+ break;
+ case OPTION_ABOVE:
+ if (modes[o])
+ output->initial_y -=
+ xf86ModeHeight(modes[o], output->initial_rotation);
+ break;
+ case OPTION_LEFT_OF:
+ if (modes[o])
+ output->initial_x -=
+ xf86ModeWidth(modes[o], output->initial_rotation);
+ break;
+ default:
+ break;
+ }
+ any_set = TRUE;
+ continue;
+ }
+
+ /* Nothing set, just stick them at 0,0 */
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ }
+ if (!keep_going)
+ break;
+ if (!any_set) {
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+
+ if (output->initial_x == POSITION_UNSET) {
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "Output position loop. Moving %s to 0,0\n",
+ output->name);
+ output->initial_x = output->initial_y = 0;
+ break;
+ }
+ }
+ }
}
/*
@@ -1310,92 +1268,89 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
*/
min_x = 1000000;
min_y = 1000000;
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
- if (output->initial_x < min_x)
- min_x = output->initial_x;
- if (output->initial_y < min_y)
- min_y = output->initial_y;
+ if (output->initial_x < min_x)
+ min_x = output->initial_x;
+ if (output->initial_y < min_y)
+ min_y = output->initial_y;
}
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- output->initial_x -= min_x;
- output->initial_y -= min_y;
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+
+ output->initial_x -= min_x;
+ output->initial_y -= min_y;
}
return TRUE;
}
static void
-xf86InitialPanning (ScrnInfoPtr scrn)
+xf86InitialPanning(ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- char *panning = xf86GetOptValString (output->options, OPTION_PANNING);
- int width, height, left, top;
- int track_width, track_height, track_left, track_top;
- int brdr[4];
-
- memset (&output->initialTotalArea, 0, sizeof(BoxRec));
- memset (&output->initialTrackingArea, 0, sizeof(BoxRec));
- memset (output->initialBorder, 0, 4*sizeof(INT16));
-
- if (! panning)
- continue;
-
- switch (sscanf (panning, "%dx%d+%d+%d/%dx%d+%d+%d/%d/%d/%d/%d",
- &width, &height, &left, &top,
- &track_width, &track_height, &track_left, &track_top,
- &brdr[0], &brdr[1], &brdr[2], &brdr[3])) {
- case 12:
- output->initialBorder[0] = brdr[0];
- output->initialBorder[1] = brdr[1];
- output->initialBorder[2] = brdr[2];
- output->initialBorder[3] = brdr[3];
- /* fall through */
- case 8:
- output->initialTrackingArea.x1 = track_left;
- output->initialTrackingArea.y1 = track_top;
- output->initialTrackingArea.x2 = track_left + track_width;
- output->initialTrackingArea.y2 = track_top + track_height;
- /* fall through */
- case 4:
- output->initialTotalArea.x1 = left;
- output->initialTotalArea.y1 = top;
- /* fall through */
- case 2:
- output->initialTotalArea.x2 = output->initialTotalArea.x1 + width;
- output->initialTotalArea.y2 = output->initialTotalArea.y1 + height;
- break;
- default:
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Broken panning specification '%s' for output %s in config file\n",
- panning, output->name);
- }
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+ char *panning = xf86GetOptValString(output->options, OPTION_PANNING);
+ int width, height, left, top;
+ int track_width, track_height, track_left, track_top;
+ int brdr[4];
+
+ memset(&output->initialTotalArea, 0, sizeof(BoxRec));
+ memset(&output->initialTrackingArea, 0, sizeof(BoxRec));
+ memset(output->initialBorder, 0, 4 * sizeof(INT16));
+
+ if (!panning)
+ continue;
+
+ switch (sscanf(panning, "%dx%d+%d+%d/%dx%d+%d+%d/%d/%d/%d/%d",
+ &width, &height, &left, &top,
+ &track_width, &track_height, &track_left, &track_top,
+ &brdr[0], &brdr[1], &brdr[2], &brdr[3])) {
+ case 12:
+ output->initialBorder[0] = brdr[0];
+ output->initialBorder[1] = brdr[1];
+ output->initialBorder[2] = brdr[2];
+ output->initialBorder[3] = brdr[3];
+ /* fall through */
+ case 8:
+ output->initialTrackingArea.x1 = track_left;
+ output->initialTrackingArea.y1 = track_top;
+ output->initialTrackingArea.x2 = track_left + track_width;
+ output->initialTrackingArea.y2 = track_top + track_height;
+ /* fall through */
+ case 4:
+ output->initialTotalArea.x1 = left;
+ output->initialTotalArea.y1 = top;
+ /* fall through */
+ case 2:
+ output->initialTotalArea.x2 = output->initialTotalArea.x1 + width;
+ output->initialTotalArea.y2 = output->initialTotalArea.y1 + height;
+ break;
+ default:
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "Broken panning specification '%s' for output %s in config file\n",
+ panning, output->name);
+ }
}
}
/** Return - 0 + if a should be earlier, same or later than b in list
*/
static int
-xf86ModeCompare (DisplayModePtr a, DisplayModePtr b)
+xf86ModeCompare(DisplayModePtr a, DisplayModePtr b)
{
- int diff;
+ int diff;
diff = ((b->type & M_T_PREFERRED) != 0) - ((a->type & M_T_PREFERRED) != 0);
if (diff)
- return diff;
+ return diff;
diff = b->HDisplay * b->VDisplay - a->HDisplay * a->VDisplay;
if (diff)
- return diff;
+ return diff;
diff = b->Clock - a->Clock;
return diff;
}
@@ -1404,38 +1359,34 @@ xf86ModeCompare (DisplayModePtr a, DisplayModePtr b)
* Insertion sort input in-place and return the resulting head
*/
static DisplayModePtr
-xf86SortModes (DisplayModePtr input)
+xf86SortModes(DisplayModePtr input)
{
- DisplayModePtr output = NULL, i, o, n, *op, prev;
+ DisplayModePtr output = NULL, i, o, n, *op, prev;
/* sort by preferred status and pixel area */
- while (input)
- {
- i = input;
- input = input->next;
- for (op = &output; (o = *op); op = &o->next)
- if (xf86ModeCompare (o, i) > 0)
- break;
- i->next = *op;
- *op = i;
+ while (input) {
+ i = input;
+ input = input->next;
+ for (op = &output; (o = *op); op = &o->next)
+ if (xf86ModeCompare(o, i) > 0)
+ break;
+ i->next = *op;
+ *op = i;
}
/* prune identical modes */
- for (o = output; o && (n = o->next); o = n)
- {
- if (!strcmp (o->name, n->name) && xf86ModesEqual (o, n))
- {
- o->next = n->next;
- free(n->name);
- free(n);
- n = o;
- }
+ for (o = output; o && (n = o->next); o = n) {
+ if (!strcmp(o->name, n->name) && xf86ModesEqual(o, n)) {
+ o->next = n->next;
+ free(n->name);
+ free(n);
+ n = o;
+ }
}
/* hook up backward links */
prev = NULL;
- for (o = output; o; o = o->next)
- {
- o->prev = prev;
- prev = o;
+ for (o = output; o; o = o->next) {
+ o->prev = prev;
+ prev = o;
}
return output;
}
@@ -1446,13 +1397,13 @@ preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output)
char *preferred_mode = NULL;
/* Check for a configured preference for a particular mode */
- preferred_mode = xf86GetOptValString (output->options,
- OPTION_PREFERRED_MODE);
+ preferred_mode = xf86GetOptValString(output->options,
+ OPTION_PREFERRED_MODE);
if (preferred_mode)
- return preferred_mode;
+ return preferred_mode;
if (pScrn->display->modes && *pScrn->display->modes)
- preferred_mode = *pScrn->display->modes;
+ preferred_mode = *pScrn->display->modes;
return preferred_mode;
}
@@ -1461,7 +1412,7 @@ static void
GuessRangeFromModes(MonPtr mon, DisplayModePtr mode)
{
if (!mon || !mode)
- return;
+ return;
mon->nHsync = 1;
mon->hsync[0].lo = 1024.0;
@@ -1472,33 +1423,33 @@ GuessRangeFromModes(MonPtr mon, DisplayModePtr mode)
mon->vrefresh[0].hi = 0.0;
while (mode) {
- if (!mode->HSync)
- mode->HSync = ((float) mode->Clock ) / ((float) mode->HTotal);
+ if (!mode->HSync)
+ mode->HSync = ((float) mode->Clock) / ((float) mode->HTotal);
- if (!mode->VRefresh)
- mode->VRefresh = (1000.0 * ((float) mode->Clock)) /
- ((float) (mode->HTotal * mode->VTotal));
+ if (!mode->VRefresh)
+ mode->VRefresh = (1000.0 * ((float) mode->Clock)) /
+ ((float) (mode->HTotal * mode->VTotal));
- if (mode->HSync < mon->hsync[0].lo)
- mon->hsync[0].lo = mode->HSync;
+ if (mode->HSync < mon->hsync[0].lo)
+ mon->hsync[0].lo = mode->HSync;
- if (mode->HSync > mon->hsync[0].hi)
- mon->hsync[0].hi = mode->HSync;
+ if (mode->HSync > mon->hsync[0].hi)
+ mon->hsync[0].hi = mode->HSync;
- if (mode->VRefresh < mon->vrefresh[0].lo)
- mon->vrefresh[0].lo = mode->VRefresh;
+ if (mode->VRefresh < mon->vrefresh[0].lo)
+ mon->vrefresh[0].lo = mode->VRefresh;
- if (mode->VRefresh > mon->vrefresh[0].hi)
- mon->vrefresh[0].hi = mode->VRefresh;
+ if (mode->VRefresh > mon->vrefresh[0].hi)
+ mon->vrefresh[0].hi = mode->VRefresh;
- mode = mode->next;
+ mode = mode->next;
}
/* stretch out the bottom to fit 640x480@60 */
if (mon->hsync[0].lo > 31.0)
- mon->hsync[0].lo = 31.0;
+ mon->hsync[0].lo = 31.0;
if (mon->vrefresh[0].lo > 58.0)
- mon->vrefresh[0].lo = 58.0;
+ mon->vrefresh[0].lo = 58.0;
}
enum det_monrec_source {
@@ -1513,14 +1464,16 @@ struct det_monrec_parameter {
enum det_monrec_source *sync_source;
};
-static void handle_detailed_monrec(struct detailed_monitor_section *det_mon,
- void *data)
+static void
+handle_detailed_monrec(struct detailed_monitor_section *det_mon, void *data)
{
struct det_monrec_parameter *p;
- p = (struct det_monrec_parameter *)data;
+
+ p = (struct det_monrec_parameter *) data;
if (det_mon->type == DS_RANGES) {
struct monitor_ranges *ranges = &det_mon->section.ranges;
+
if (p->set_hsync && ranges->max_h) {
p->mon_rec->hsync[p->mon_rec->nHsync].lo = ranges->min_h;
p->mon_rec->hsync[p->mon_rec->nHsync].hi = ranges->max_h;
@@ -1541,10 +1494,10 @@ static void handle_detailed_monrec(struct detailed_monitor_section *det_mon,
}
void
-xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
+xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
/* When canGrow was TRUE in the initial configuration we have to
* compare against the maximum values so that we don't drop modes.
@@ -1552,251 +1505,238 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
* anyway.
*/
if (maxX == 0 || maxY == 0) {
- maxX = config->maxWidth;
- maxY = config->maxHeight;
+ maxX = config->maxWidth;
+ maxY = config->maxHeight;
}
/* Probe the list of modes for each output. */
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- DisplayModePtr mode;
- DisplayModePtr config_modes = NULL, output_modes, default_modes = NULL;
- char *preferred_mode;
- xf86MonPtr edid_monitor;
- XF86ConfMonitorPtr conf_monitor;
- MonRec mon_rec;
- int min_clock = 0;
- int max_clock = 0;
- double clock;
- Bool add_default_modes;
- Bool debug_modes = config->debug_modes ||
- xf86Initialising;
- enum det_monrec_source sync_source = sync_default;
-
- while (output->probed_modes != NULL)
- xf86DeleteMode(&output->probed_modes, output->probed_modes);
-
- /*
- * Check connection status
- */
- output->status = (*output->funcs->detect)(output);
-
- if (output->status == XF86OutputStatusDisconnected &&
- !xf86ReturnOptValBool(output->options, OPTION_ENABLE, FALSE))
- {
- xf86OutputSetEDID (output, NULL);
- continue;
- }
-
- memset (&mon_rec, '\0', sizeof (mon_rec));
-
- conf_monitor = output->conf_monitor;
-
- if (conf_monitor)
- {
- int i;
-
- for (i = 0; i < conf_monitor->mon_n_hsync; i++)
- {
- mon_rec.hsync[mon_rec.nHsync].lo = conf_monitor->mon_hsync[i].lo;
- mon_rec.hsync[mon_rec.nHsync].hi = conf_monitor->mon_hsync[i].hi;
- mon_rec.nHsync++;
- sync_source = sync_config;
- }
- for (i = 0; i < conf_monitor->mon_n_vrefresh; i++)
- {
- mon_rec.vrefresh[mon_rec.nVrefresh].lo = conf_monitor->mon_vrefresh[i].lo;
- mon_rec.vrefresh[mon_rec.nVrefresh].hi = conf_monitor->mon_vrefresh[i].hi;
- mon_rec.nVrefresh++;
- sync_source = sync_config;
- }
- config_modes = xf86GetMonitorModes (scrn, conf_monitor);
- }
-
- output_modes = (*output->funcs->get_modes) (output);
-
- /*
- * If the user has a preference, respect it.
- * Otherwise, don't second-guess the driver.
- */
- if (!xf86GetOptValBool(output->options, OPTION_DEFAULT_MODES,
- &add_default_modes))
- add_default_modes = (output_modes == NULL);
-
- edid_monitor = output->MonInfo;
-
- if (edid_monitor)
- {
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr mode;
+ DisplayModePtr config_modes = NULL, output_modes, default_modes = NULL;
+ char *preferred_mode;
+ xf86MonPtr edid_monitor;
+ XF86ConfMonitorPtr conf_monitor;
+ MonRec mon_rec;
+ int min_clock = 0;
+ int max_clock = 0;
+ double clock;
+ Bool add_default_modes;
+ Bool debug_modes = config->debug_modes || xf86Initialising;
+ enum det_monrec_source sync_source = sync_default;
+
+ while (output->probed_modes != NULL)
+ xf86DeleteMode(&output->probed_modes, output->probed_modes);
+
+ /*
+ * Check connection status
+ */
+ output->status = (*output->funcs->detect) (output);
+
+ if (output->status == XF86OutputStatusDisconnected &&
+ !xf86ReturnOptValBool(output->options, OPTION_ENABLE, FALSE)) {
+ xf86OutputSetEDID(output, NULL);
+ continue;
+ }
+
+ memset(&mon_rec, '\0', sizeof(mon_rec));
+
+ conf_monitor = output->conf_monitor;
+
+ if (conf_monitor) {
+ int i;
+
+ for (i = 0; i < conf_monitor->mon_n_hsync; i++) {
+ mon_rec.hsync[mon_rec.nHsync].lo =
+ conf_monitor->mon_hsync[i].lo;
+ mon_rec.hsync[mon_rec.nHsync].hi =
+ conf_monitor->mon_hsync[i].hi;
+ mon_rec.nHsync++;
+ sync_source = sync_config;
+ }
+ for (i = 0; i < conf_monitor->mon_n_vrefresh; i++) {
+ mon_rec.vrefresh[mon_rec.nVrefresh].lo =
+ conf_monitor->mon_vrefresh[i].lo;
+ mon_rec.vrefresh[mon_rec.nVrefresh].hi =
+ conf_monitor->mon_vrefresh[i].hi;
+ mon_rec.nVrefresh++;
+ sync_source = sync_config;
+ }
+ config_modes = xf86GetMonitorModes(scrn, conf_monitor);
+ }
+
+ output_modes = (*output->funcs->get_modes) (output);
+
+ /*
+ * If the user has a preference, respect it.
+ * Otherwise, don't second-guess the driver.
+ */
+ if (!xf86GetOptValBool(output->options, OPTION_DEFAULT_MODES,
+ &add_default_modes))
+ add_default_modes = (output_modes == NULL);
+
+ edid_monitor = output->MonInfo;
+
+ if (edid_monitor) {
struct det_monrec_parameter p;
- struct disp_features *features = &edid_monitor->features;
-
- /* if display is not continuous-frequency, don't add default modes */
- if (!GTF_SUPPORTED(features->msc))
- add_default_modes = FALSE;
-
- p.mon_rec = &mon_rec;
- p.max_clock = &max_clock;
- p.set_hsync = mon_rec.nHsync == 0;
- p.set_vrefresh = mon_rec.nVrefresh == 0;
- p.sync_source = &sync_source;
-
- xf86ForEachDetailedBlock(edid_monitor,
- handle_detailed_monrec,
- &p);
- }
-
- if (xf86GetOptValFreq (output->options, OPTION_MIN_CLOCK,
- OPTUNITS_KHZ, &clock))
- min_clock = (int) clock;
- if (xf86GetOptValFreq (output->options, OPTION_MAX_CLOCK,
- OPTUNITS_KHZ, &clock))
- max_clock = (int) clock;
-
- /* If we still don't have a sync range, guess wildly */
- if (!mon_rec.nHsync || !mon_rec.nVrefresh)
- GuessRangeFromModes(&mon_rec, output_modes);
-
- /*
- * These limits will end up setting a 1024x768@60Hz mode by default,
- * which seems like a fairly good mode to use when nothing else is
- * specified
- */
- if (mon_rec.nHsync == 0)
- {
- mon_rec.hsync[0].lo = 31.0;
- mon_rec.hsync[0].hi = 55.0;
- mon_rec.nHsync = 1;
- }
- if (mon_rec.nVrefresh == 0)
- {
- mon_rec.vrefresh[0].lo = 58.0;
- mon_rec.vrefresh[0].hi = 62.0;
- mon_rec.nVrefresh = 1;
- }
-
- if (add_default_modes)
- default_modes = xf86GetDefaultModes ();
-
- /*
- * If this is not an RB monitor, remove RB modes from the default
- * pool. RB modes from the config or the monitor itself are fine.
- */
- if (!mon_rec.reducedblanking)
- xf86ValidateModesReducedBlanking (scrn, default_modes);
-
- if (sync_source == sync_config)
- {
- /*
- * Check output and config modes against sync range from config file
- */
- xf86ValidateModesSync (scrn, output_modes, &mon_rec);
- xf86ValidateModesSync (scrn, config_modes, &mon_rec);
- }
- /*
- * Check default modes against sync range
- */
- xf86ValidateModesSync (scrn, default_modes, &mon_rec);
- /*
- * Check default modes against monitor max clock
- */
- if (max_clock) {
- xf86ValidateModesClocks(scrn, default_modes,
- &min_clock, &max_clock, 1);
- xf86ValidateModesClocks(scrn, output_modes,
- &min_clock, &max_clock, 1);
- }
-
- output->probed_modes = NULL;
- output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes);
- output->probed_modes = xf86ModesAdd (output->probed_modes, output_modes);
- output->probed_modes = xf86ModesAdd (output->probed_modes, default_modes);
-
- /*
- * Check all modes against max size, interlace, and doublescan
- */
- if (maxX && maxY)
- xf86ValidateModesSize (scrn, output->probed_modes,
- maxX, maxY, 0);
-
- {
- int flags = (output->interlaceAllowed ? V_INTERLACE : 0) |
- (output->doubleScanAllowed ? V_DBLSCAN : 0);
- xf86ValidateModesFlags (scrn, output->probed_modes, flags);
- }
-
- /*
- * Check all modes against output
- */
- for (mode = output->probed_modes; mode != NULL; mode = mode->next)
- if (mode->status == MODE_OK)
- mode->status = (*output->funcs->mode_valid)(output, mode);
-
- xf86PruneInvalidModes(scrn, &output->probed_modes, debug_modes);
-
- output->probed_modes = xf86SortModes (output->probed_modes);
-
- /* Check for a configured preference for a particular mode */
- preferred_mode = preferredMode(scrn, output);
-
- if (preferred_mode)
- {
- for (mode = output->probed_modes; mode; mode = mode->next)
- {
- if (!strcmp (preferred_mode, mode->name))
- {
- if (mode != output->probed_modes)
- {
- if (mode->prev)
- mode->prev->next = mode->next;
- if (mode->next)
- mode->next->prev = mode->prev;
- mode->next = output->probed_modes;
- output->probed_modes->prev = mode;
- mode->prev = NULL;
- output->probed_modes = mode;
- }
- mode->type |= (M_T_PREFERRED|M_T_USERPREF);
- break;
- }
- }
- }
-
- output->initial_rotation = xf86OutputInitialRotation (output);
-
- if (debug_modes) {
- if (output->probed_modes != NULL) {
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "Printing probed modes for output %s\n",
- output->name);
- } else {
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "No remaining probed modes for output %s\n",
- output->name);
- }
- }
- for (mode = output->probed_modes; mode != NULL; mode = mode->next)
- {
- /* The code to choose the best mode per pipe later on will require
- * VRefresh to be set.
- */
- mode->VRefresh = xf86ModeVRefresh(mode);
- xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
-
- if (debug_modes)
- xf86PrintModeline(scrn->scrnIndex, mode);
- }
+ struct disp_features *features = &edid_monitor->features;
+
+ /* if display is not continuous-frequency, don't add default modes */
+ if (!GTF_SUPPORTED(features->msc))
+ add_default_modes = FALSE;
+
+ p.mon_rec = &mon_rec;
+ p.max_clock = &max_clock;
+ p.set_hsync = mon_rec.nHsync == 0;
+ p.set_vrefresh = mon_rec.nVrefresh == 0;
+ p.sync_source = &sync_source;
+
+ xf86ForEachDetailedBlock(edid_monitor, handle_detailed_monrec, &p);
+ }
+
+ if (xf86GetOptValFreq(output->options, OPTION_MIN_CLOCK,
+ OPTUNITS_KHZ, &clock))
+ min_clock = (int) clock;
+ if (xf86GetOptValFreq(output->options, OPTION_MAX_CLOCK,
+ OPTUNITS_KHZ, &clock))
+ max_clock = (int) clock;
+
+ /* If we still don't have a sync range, guess wildly */
+ if (!mon_rec.nHsync || !mon_rec.nVrefresh)
+ GuessRangeFromModes(&mon_rec, output_modes);
+
+ /*
+ * These limits will end up setting a 1024x768@60Hz mode by default,
+ * which seems like a fairly good mode to use when nothing else is
+ * specified
+ */
+ if (mon_rec.nHsync == 0) {
+ mon_rec.hsync[0].lo = 31.0;
+ mon_rec.hsync[0].hi = 55.0;
+ mon_rec.nHsync = 1;
+ }
+ if (mon_rec.nVrefresh == 0) {
+ mon_rec.vrefresh[0].lo = 58.0;
+ mon_rec.vrefresh[0].hi = 62.0;
+ mon_rec.nVrefresh = 1;
+ }
+
+ if (add_default_modes)
+ default_modes = xf86GetDefaultModes();
+
+ /*
+ * If this is not an RB monitor, remove RB modes from the default
+ * pool. RB modes from the config or the monitor itself are fine.
+ */
+ if (!mon_rec.reducedblanking)
+ xf86ValidateModesReducedBlanking(scrn, default_modes);
+
+ if (sync_source == sync_config) {
+ /*
+ * Check output and config modes against sync range from config file
+ */
+ xf86ValidateModesSync(scrn, output_modes, &mon_rec);
+ xf86ValidateModesSync(scrn, config_modes, &mon_rec);
+ }
+ /*
+ * Check default modes against sync range
+ */
+ xf86ValidateModesSync(scrn, default_modes, &mon_rec);
+ /*
+ * Check default modes against monitor max clock
+ */
+ if (max_clock) {
+ xf86ValidateModesClocks(scrn, default_modes,
+ &min_clock, &max_clock, 1);
+ xf86ValidateModesClocks(scrn, output_modes,
+ &min_clock, &max_clock, 1);
+ }
+
+ output->probed_modes = NULL;
+ output->probed_modes = xf86ModesAdd(output->probed_modes, config_modes);
+ output->probed_modes = xf86ModesAdd(output->probed_modes, output_modes);
+ output->probed_modes =
+ xf86ModesAdd(output->probed_modes, default_modes);
+
+ /*
+ * Check all modes against max size, interlace, and doublescan
+ */
+ if (maxX && maxY)
+ xf86ValidateModesSize(scrn, output->probed_modes, maxX, maxY, 0);
+
+ {
+ int flags = (output->interlaceAllowed ? V_INTERLACE : 0) |
+ (output->doubleScanAllowed ? V_DBLSCAN : 0);
+ xf86ValidateModesFlags(scrn, output->probed_modes, flags);
+ }
+
+ /*
+ * Check all modes against output
+ */
+ for (mode = output->probed_modes; mode != NULL; mode = mode->next)
+ if (mode->status == MODE_OK)
+ mode->status = (*output->funcs->mode_valid) (output, mode);
+
+ xf86PruneInvalidModes(scrn, &output->probed_modes, debug_modes);
+
+ output->probed_modes = xf86SortModes(output->probed_modes);
+
+ /* Check for a configured preference for a particular mode */
+ preferred_mode = preferredMode(scrn, output);
+
+ if (preferred_mode) {
+ for (mode = output->probed_modes; mode; mode = mode->next) {
+ if (!strcmp(preferred_mode, mode->name)) {
+ if (mode != output->probed_modes) {
+ if (mode->prev)
+ mode->prev->next = mode->next;
+ if (mode->next)
+ mode->next->prev = mode->prev;
+ mode->next = output->probed_modes;
+ output->probed_modes->prev = mode;
+ mode->prev = NULL;
+ output->probed_modes = mode;
+ }
+ mode->type |= (M_T_PREFERRED | M_T_USERPREF);
+ break;
+ }
+ }
+ }
+
+ output->initial_rotation = xf86OutputInitialRotation(output);
+
+ if (debug_modes) {
+ if (output->probed_modes != NULL) {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Printing probed modes for output %s\n",
+ output->name);
+ }
+ else {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "No remaining probed modes for output %s\n",
+ output->name);
+ }
+ }
+ for (mode = output->probed_modes; mode != NULL; mode = mode->next) {
+ /* The code to choose the best mode per pipe later on will require
+ * VRefresh to be set.
+ */
+ mode->VRefresh = xf86ModeVRefresh(mode);
+ xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
+
+ if (debug_modes)
+ xf86PrintModeline(scrn->scrnIndex, mode);
+ }
}
}
-
/**
* Copy one of the output mode lists to the ScrnInfo record
*/
/* XXX where does this function belong? Here? */
void
-xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
+ xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
static DisplayModePtr
biggestMode(DisplayModePtr a, DisplayModePtr b)
@@ -1804,15 +1744,15 @@ biggestMode(DisplayModePtr a, DisplayModePtr b)
int A, B;
if (!a)
- return b;
+ return b;
if (!b)
- return a;
+ return a;
A = a->HDisplay * a->VDisplay;
B = b->HDisplay * b->VDisplay;
if (A > B)
- return a;
+ return a;
return b;
}
@@ -1825,141 +1765,143 @@ SetCompatOutput(xf86CrtcConfigPtr config)
int o, compat = -1, count, mincount = 0;
/* Look for one that's definitely connected */
- for (o = 0; o < config->num_output; o++)
- {
- test = config->output[o];
- if (!test->crtc)
- continue;
- if (test->status != XF86OutputStatusConnected)
- continue;
- if (!test->probed_modes)
- continue;
-
- testmode = mode = test->probed_modes;
- for (count = 0; mode; mode = mode->next, count++)
- testmode = biggestMode(testmode, mode);
-
- if (!output) {
- output = test;
- compat = o;
- maxmode = testmode;
- mincount = count;
- } else if (maxmode == biggestMode(maxmode, testmode)) {
- output = test;
- compat = o;
- maxmode = testmode;
- mincount = count;
- } else if ((maxmode->HDisplay == testmode->HDisplay) &&
- (maxmode->VDisplay == testmode->VDisplay) &&
- count <= mincount) {
- output = test;
- compat = o;
- maxmode = testmode;
- mincount = count;
- }
+ for (o = 0; o < config->num_output; o++) {
+ test = config->output[o];
+ if (!test->crtc)
+ continue;
+ if (test->status != XF86OutputStatusConnected)
+ continue;
+ if (!test->probed_modes)
+ continue;
+
+ testmode = mode = test->probed_modes;
+ for (count = 0; mode; mode = mode->next, count++)
+ testmode = biggestMode(testmode, mode);
+
+ if (!output) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
+ }
+ else if (maxmode == biggestMode(maxmode, testmode)) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
+ }
+ else if ((maxmode->HDisplay == testmode->HDisplay) &&
+ (maxmode->VDisplay == testmode->VDisplay) &&
+ count <= mincount) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
+ }
}
/* If we didn't find one, take anything we can get */
- if (!output)
- {
- for (o = 0; o < config->num_output; o++)
- {
- test = config->output[o];
- if (!test->crtc)
- continue;
- if (!test->probed_modes)
- continue;
-
- if (!output) {
- output = test;
- compat = o;
- } else if (test->probed_modes->HDisplay < output->probed_modes->HDisplay) {
- output = test;
- compat = o;
- }
- }
+ if (!output) {
+ for (o = 0; o < config->num_output; o++) {
+ test = config->output[o];
+ if (!test->crtc)
+ continue;
+ if (!test->probed_modes)
+ continue;
+
+ if (!output) {
+ output = test;
+ compat = o;
+ }
+ else if (test->probed_modes->HDisplay <
+ output->probed_modes->HDisplay) {
+ output = test;
+ compat = o;
+ }
+ }
}
if (compat >= 0) {
- config->compat_output = compat;
- } else {
- /* Don't change the compat output when no valid outputs found */
- output = config->output[config->compat_output];
+ config->compat_output = compat;
+ }
+ else {
+ /* Don't change the compat output when no valid outputs found */
+ output = config->output[config->compat_output];
}
return output;
}
void
-xf86SetScrnInfoModes (ScrnInfoPtr scrn)
+xf86SetScrnInfoModes(ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86OutputPtr output;
- xf86CrtcPtr crtc;
- DisplayModePtr last, mode = NULL;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ DisplayModePtr last, mode = NULL;
output = SetCompatOutput(config);
if (!output)
- return; /* punt */
+ return; /* punt */
crtc = output->crtc;
/* Clear any existing modes from scrn->modes */
while (scrn->modes != NULL)
- xf86DeleteMode(&scrn->modes, scrn->modes);
+ xf86DeleteMode(&scrn->modes, scrn->modes);
/* Set scrn->modes to the mode list for the 'compat' output */
scrn->modes = xf86DuplicateModes(scrn, output->probed_modes);
if (crtc) {
- for (mode = scrn->modes; mode; mode = mode->next)
- if (xf86ModesEqual (mode, &crtc->desiredMode))
- break;
+ for (mode = scrn->modes; mode; mode = mode->next)
+ if (xf86ModesEqual(mode, &crtc->desiredMode))
+ break;
}
if (!scrn->modes) {
- scrn->modes = xf86ModesAdd(scrn->modes,
- xf86CVTMode(scrn->display->virtualX,
- scrn->display->virtualY,
- 60, 0, 0));
+ scrn->modes = xf86ModesAdd(scrn->modes,
+ xf86CVTMode(scrn->display->virtualX,
+ scrn->display->virtualY,
+ 60, 0, 0));
}
/* For some reason, scrn->modes is circular, unlike the other mode
* lists. How great is that?
*/
- for (last = scrn->modes; last && last->next; last = last->next)
- ;
+ for (last = scrn->modes; last && last->next; last = last->next);
last->next = scrn->modes;
scrn->modes->prev = last;
if (mode) {
- while (scrn->modes != mode)
- scrn->modes = scrn->modes->next;
+ while (scrn->modes != mode)
+ scrn->modes = scrn->modes->next;
}
scrn->currentMode = scrn->modes;
#ifdef XFreeXDGA
if (scrn->pScreen)
- _xf86_di_dga_reinit_internal(scrn->pScreen);
+ _xf86_di_dga_reinit_internal(scrn->pScreen);
#endif
}
static Bool
xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- Bool *enabled)
+ Bool *enabled)
{
Bool any_enabled = FALSE;
int o;
for (o = 0; o < config->num_output; o++)
- any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
-
+ any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
+
if (!any_enabled) {
- xf86DrvMsg(scrn->scrnIndex, X_WARNING,
- "No outputs definitely connected, trying again...\n");
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "No outputs definitely connected, trying again...\n");
- for (o = 0; o < config->num_output; o++)
- any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
+ for (o = 0; o < config->num_output; o++)
+ any_enabled |= enabled[o] =
+ xf86OutputEnabled(config->output[o], FALSE);
}
return any_enabled;
@@ -1971,12 +1913,12 @@ nextEnabledOutput(xf86CrtcConfigPtr config, Bool *enabled, int *index)
int o = *index;
for (o++; o < config->num_output; o++) {
- if (enabled[o]) {
- *index = o;
- return TRUE;
- }
+ if (enabled[o]) {
+ *index = o;
+ return TRUE;
+ }
}
-
+
return FALSE;
}
@@ -1992,16 +1934,16 @@ nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect)
DisplayModePtr m = NULL;
if (!o)
- return NULL;
+ return NULL;
if (!last)
- m = o->probed_modes;
+ m = o->probed_modes;
else
- m = last->next;
+ m = last->next;
for (; m; m = m->next)
- if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
- return m;
+ if (aspectMatch(aspect, (float) m->HDisplay / (float) m->VDisplay))
+ return m;
return NULL;
}
@@ -2013,27 +1955,27 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
DisplayModePtr mode = NULL, test = NULL, match = NULL;
if (!nextEnabledOutput(config, enabled, &o))
- return NULL;
+ return NULL;
while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
- test = mode;
- for (p = o; nextEnabledOutput(config, enabled, &p); ) {
- test = xf86OutputFindClosestMode(config->output[p], mode);
- if (!test)
- break;
- if (test->HDisplay != mode->HDisplay ||
- test->VDisplay != mode->VDisplay) {
- test = NULL;
- break;
- }
- }
-
- /* if we didn't match it on all outputs, try the next one */
- if (!test)
- continue;
-
- /* if it's bigger than the last one, save it */
- if (!match || (test->HDisplay > match->HDisplay))
- match = test;
+ test = mode;
+ for (p = o; nextEnabledOutput(config, enabled, &p);) {
+ test = xf86OutputFindClosestMode(config->output[p], mode);
+ if (!test)
+ break;
+ if (test->HDisplay != mode->HDisplay ||
+ test->VDisplay != mode->VDisplay) {
+ test = NULL;
+ break;
+ }
+ }
+
+ /* if we didn't match it on all outputs, try the next one */
+ if (!test)
+ continue;
+
+ /* if it's bigger than the last one, save it */
+ if (!match || (test->HDisplay > match->HDisplay))
+ match = test;
}
/* return the biggest one found */
@@ -2042,8 +1984,8 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
static Bool
xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- DisplayModePtr *modes, Bool *enabled,
- int width, int height)
+ DisplayModePtr * modes, Bool *enabled,
+ int width, int height)
{
int o, p;
int max_pref_width = 0, max_pref_height = 0;
@@ -2054,91 +1996,95 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
preferred_match = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
/* Check if the preferred mode is available on all outputs */
- for (p = -1; nextEnabledOutput(config, enabled, &p); ) {
- Rotation r = config->output[p]->initial_rotation;
- DisplayModePtr mode;
- if ((preferred[p] = xf86OutputHasPreferredMode(config->output[p],
- width, height))) {
- int pref_width = xf86ModeWidth(preferred[p], r);
- int pref_height = xf86ModeHeight(preferred[p], r);
- Bool all_match = TRUE;
-
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- Bool match = FALSE;
- xf86OutputPtr output = config->output[o];
- if (o == p)
- continue;
-
- /*
- * First see if the preferred mode matches on the next
- * output as well. This catches the common case of identical
- * monitors and makes sure they all have the same timings
- * and refresh. If that fails, we fall back to trying to
- * match just width & height.
- */
- mode = xf86OutputHasPreferredMode(output, pref_width,
- pref_height);
- if (mode && xf86ModesEqual(mode, preferred[p])) {
- preferred[o] = mode;
- match = TRUE;
- } else {
- for (mode = output->probed_modes; mode;
- mode = mode->next) {
- Rotation r = output->initial_rotation;
- if (xf86ModeWidth(mode, r) == pref_width &&
- xf86ModeHeight(mode, r) == pref_height) {
- preferred[o] = mode;
- match = TRUE;
- }
- }
- }
-
- all_match &= match;
- }
-
- if (all_match &&
- (pref_width*pref_height > max_pref_width*max_pref_height)) {
- for (o = -1; nextEnabledOutput(config, enabled, &o); )
- preferred_match[o] = preferred[o];
- max_pref_width = pref_width;
- max_pref_height = pref_height;
- ret = TRUE;
- }
- }
+ for (p = -1; nextEnabledOutput(config, enabled, &p);) {
+ Rotation r = config->output[p]->initial_rotation;
+ DisplayModePtr mode;
+
+ if ((preferred[p] = xf86OutputHasPreferredMode(config->output[p],
+ width, height))) {
+ int pref_width = xf86ModeWidth(preferred[p], r);
+ int pref_height = xf86ModeHeight(preferred[p], r);
+ Bool all_match = TRUE;
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o);) {
+ Bool match = FALSE;
+ xf86OutputPtr output = config->output[o];
+
+ if (o == p)
+ continue;
+
+ /*
+ * First see if the preferred mode matches on the next
+ * output as well. This catches the common case of identical
+ * monitors and makes sure they all have the same timings
+ * and refresh. If that fails, we fall back to trying to
+ * match just width & height.
+ */
+ mode = xf86OutputHasPreferredMode(output, pref_width,
+ pref_height);
+ if (mode && xf86ModesEqual(mode, preferred[p])) {
+ preferred[o] = mode;
+ match = TRUE;
+ }
+ else {
+ for (mode = output->probed_modes; mode; mode = mode->next) {
+ Rotation r = output->initial_rotation;
+
+ if (xf86ModeWidth(mode, r) == pref_width &&
+ xf86ModeHeight(mode, r) == pref_height) {
+ preferred[o] = mode;
+ match = TRUE;
+ }
+ }
+ }
+
+ all_match &= match;
+ }
+
+ if (all_match &&
+ (pref_width * pref_height > max_pref_width * max_pref_height)) {
+ for (o = -1; nextEnabledOutput(config, enabled, &o);)
+ preferred_match[o] = preferred[o];
+ max_pref_width = pref_width;
+ max_pref_height = pref_height;
+ ret = TRUE;
+ }
+ }
}
/*
* If there's no preferred mode, but only one monitor, pick the
* biggest mode for its aspect ratio, assuming one exists.
*/
- if (!ret) do {
- int i = 0;
- float aspect = 0.0;
+ if (!ret)
+ do {
+ int i = 0;
+ float aspect = 0.0;
- /* count the number of enabled outputs */
- for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ;
+ /* count the number of enabled outputs */
+ for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++);
- if (i != 1)
- break;
+ if (i != 1)
+ break;
- p = -1;
- nextEnabledOutput(config, enabled, &p);
- if (config->output[p]->mm_height)
- aspect = (float)config->output[p]->mm_width /
- (float)config->output[p]->mm_height;
+ p = -1;
+ nextEnabledOutput(config, enabled, &p);
+ if (config->output[p]->mm_height)
+ aspect = (float) config->output[p]->mm_width /
+ (float) config->output[p]->mm_height;
- if (aspect)
- preferred_match[p] = bestModeForAspect(config, enabled, aspect);
+ if (aspect)
+ preferred_match[p] = bestModeForAspect(config, enabled, aspect);
- if (preferred_match[p])
- ret = TRUE;
+ if (preferred_match[p])
+ ret = TRUE;
- } while (0);
+ } while (0);
if (ret) {
- /* oh good, there is a match. stash the selected modes and return. */
- memcpy(modes, preferred_match,
- config->num_output * sizeof(DisplayModePtr));
+ /* oh good, there is a match. stash the selected modes and return. */
+ memcpy(modes, preferred_match,
+ config->num_output * sizeof(DisplayModePtr));
}
free(preferred);
@@ -2148,8 +2094,7 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
static Bool
xf86TargetAspect(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- DisplayModePtr *modes, Bool *enabled,
- int width, int height)
+ DisplayModePtr * modes, Bool *enabled, int width, int height)
{
int o;
float aspect = 0.0, *aspects;
@@ -2160,51 +2105,51 @@ xf86TargetAspect(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
aspects = xnfcalloc(config->num_output, sizeof(float));
/* collect the aspect ratios */
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- output = config->output[o];
- if (output->mm_height)
- aspects[o] = (float)output->mm_width / (float)output->mm_height;
- else
- aspects[o] = 4.0 / 3.0;
+ for (o = -1; nextEnabledOutput(config, enabled, &o);) {
+ output = config->output[o];
+ if (output->mm_height)
+ aspects[o] = (float) output->mm_width / (float) output->mm_height;
+ else
+ aspects[o] = 4.0 / 3.0;
}
/* check that they're all the same */
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- output = config->output[o];
- if (!aspect) {
- aspect = aspects[o];
- } else if (!aspectMatch(aspect, aspects[o])) {
- goto no_aspect_match;
- }
+ for (o = -1; nextEnabledOutput(config, enabled, &o);) {
+ output = config->output[o];
+ if (!aspect) {
+ aspect = aspects[o];
+ }
+ else if (!aspectMatch(aspect, aspects[o])) {
+ goto no_aspect_match;
+ }
}
/* if they're all 4:3, just skip ahead and save effort */
- if (!aspectMatch(aspect, 4.0/3.0))
- aspect_guess = bestModeForAspect(config, enabled, aspect);
+ if (!aspectMatch(aspect, 4.0 / 3.0))
+ aspect_guess = bestModeForAspect(config, enabled, aspect);
-no_aspect_match:
- base_guess = bestModeForAspect(config, enabled, 4.0/3.0);
+ no_aspect_match:
+ base_guess = bestModeForAspect(config, enabled, 4.0 / 3.0);
guess = biggestMode(base_guess, aspect_guess);
if (!guess)
- goto out;
+ goto out;
/* found a mode that works everywhere, now apply it */
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- modes[o] = xf86OutputFindClosestMode(config->output[o], guess);
+ for (o = -1; nextEnabledOutput(config, enabled, &o);) {
+ modes[o] = xf86OutputFindClosestMode(config->output[o], guess);
}
ret = TRUE;
-out:
+ out:
free(aspects);
return ret;
}
static Bool
xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- DisplayModePtr *modes, Bool *enabled,
- int width, int height)
+ DisplayModePtr * modes, Bool *enabled, int width, int height)
{
DisplayModePtr target_mode = NULL;
Rotation target_rotation = RR_Rotate_0;
@@ -2212,30 +2157,30 @@ xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
int default_preferred, target_preferred = 0, o;
/* User preferred > preferred > other modes */
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- default_mode = xf86DefaultMode (config->output[o], width, height);
- if (!default_mode)
- continue;
-
- default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
- ((default_mode->type & M_T_USERPREF) != 0));
-
- if (default_preferred > target_preferred || !target_mode) {
- target_mode = default_mode;
- target_preferred = default_preferred;
- target_rotation = config->output[o]->initial_rotation;
- config->compat_output = o;
- }
+ for (o = -1; nextEnabledOutput(config, enabled, &o);) {
+ default_mode = xf86DefaultMode(config->output[o], width, height);
+ if (!default_mode)
+ continue;
+
+ default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
+ ((default_mode->type & M_T_USERPREF) != 0));
+
+ if (default_preferred > target_preferred || !target_mode) {
+ target_mode = default_mode;
+ target_preferred = default_preferred;
+ target_rotation = config->output[o]->initial_rotation;
+ config->compat_output = o;
+ }
}
if (target_mode)
- modes[config->compat_output] = target_mode;
+ modes[config->compat_output] = target_mode;
/* Fill in other output modes */
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- if (!modes[o])
- modes[o] = xf86ClosestMode(config->output[o], target_mode,
- target_rotation, width, height);
+ for (o = -1; nextEnabledOutput(config, enabled, &o);) {
+ if (!modes[o])
+ modes[o] = xf86ClosestMode(config->output[o], target_mode,
+ target_rotation, width, height);
}
return target_mode != NULL;
@@ -2243,25 +2188,24 @@ xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
static Bool
xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- DisplayModePtr *modes, Bool *enabled,
- int width, int height)
+ DisplayModePtr * modes, Bool *enabled, int width, int height)
{
int o;
if (xf86UserConfiguredOutputs(scrn, modes))
- return xf86TargetFallback(scrn, config, modes, enabled, width, height);
-
- for (o = -1; nextEnabledOutput(config, enabled, &o); )
- if (xf86OutputHasUserPreferredMode(config->output[o]))
- return
- xf86TargetFallback(scrn, config, modes, enabled, width, height);
+ return xf86TargetFallback(scrn, config, modes, enabled, width, height);
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o);)
+ if (xf86OutputHasUserPreferredMode(config->output[o]))
+ return
+ xf86TargetFallback(scrn, config, modes, enabled, width, height);
return FALSE;
}
static Bool
xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
- float gamma_blue)
+ float gamma_blue)
{
int i, size = 256;
CARD16 *red, *green, *blue;
@@ -2270,14 +2214,16 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
green = red + size;
blue = green + size;
- /* Only cause warning if user wanted gamma to be set. */
- if (!crtc->funcs->gamma_set && (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0)) {
+ /* Only cause warning if user wanted gamma to be set. */
+ if (!crtc->funcs->gamma_set &&
+ (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0)) {
free(red);
return FALSE;
- } else if (!crtc->funcs->gamma_set) {
+ }
+ else if (!crtc->funcs->gamma_set) {
free(red);
return TRUE;
- }
+ }
/* At this early stage none of the randr-interface stuff is up.
* So take the default gamma size for lack of something better.
@@ -2286,32 +2232,37 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
if (gamma_red == 1.0)
red[i] = i << 8;
else
- red[i] = (CARD16)(pow((double)i/(double)(size - 1),
- 1. / (double)gamma_red) * (double)(size - 1) * 256);
+ red[i] = (CARD16) (pow((double) i / (double) (size - 1),
+ 1. / (double) gamma_red) * (double) (size -
+ 1) *
+ 256);
if (gamma_green == 1.0)
green[i] = i << 8;
else
- green[i] = (CARD16)(pow((double)i/(double)(size - 1),
- 1. / (double)gamma_green) * (double)(size - 1) * 256);
+ green[i] = (CARD16) (pow((double) i / (double) (size - 1),
+ 1. / (double) gamma_green) *
+ (double) (size - 1) * 256);
if (gamma_blue == 1.0)
blue[i] = i << 8;
else
- blue[i] = (CARD16)(pow((double)i/(double)(size - 1),
- 1. / (double)gamma_blue) * (double)(size - 1) * 256);
+ blue[i] = (CARD16) (pow((double) i / (double) (size - 1),
+ 1. / (double) gamma_blue) * (double) (size -
+ 1) *
+ 256);
}
/* Default size is 256, so anything else is failure. */
if (size != crtc->gamma_size) {
free(red);
return FALSE;
- }
+ }
crtc->gamma_size = size;
- memcpy (crtc->gamma_red, red, crtc->gamma_size * sizeof (CARD16));
- memcpy (crtc->gamma_green, green, crtc->gamma_size * sizeof (CARD16));
- memcpy (crtc->gamma_blue, blue, crtc->gamma_size * sizeof (CARD16));
+ memcpy(crtc->gamma_red, red, crtc->gamma_size * sizeof(CARD16));
+ memcpy(crtc->gamma_green, green, crtc->gamma_size * sizeof(CARD16));
+ memcpy(crtc->gamma_blue, blue, crtc->gamma_size * sizeof(CARD16));
/* Do not set gamma now, delay until the crtc is activated. */
@@ -2325,7 +2276,7 @@ xf86OutputSetInitialGamma(xf86OutputPtr output)
{
XF86ConfMonitorPtr mon = output->conf_monitor;
float gamma_red = 1.0, gamma_green = 1.0, gamma_blue = 1.0;
-
+
if (!mon)
return TRUE;
@@ -2333,24 +2284,25 @@ xf86OutputSetInitialGamma(xf86OutputPtr output)
return FALSE;
/* Get configured values, where they exist. */
- if (mon->mon_gamma_red >= GAMMA_MIN &&
- mon->mon_gamma_red <= GAMMA_MAX)
- gamma_red = mon->mon_gamma_red;
+ if (mon->mon_gamma_red >= GAMMA_MIN && mon->mon_gamma_red <= GAMMA_MAX)
+ gamma_red = mon->mon_gamma_red;
- if (mon->mon_gamma_green >= GAMMA_MIN &&
- mon->mon_gamma_green <= GAMMA_MAX)
- gamma_green = mon->mon_gamma_green;
+ if (mon->mon_gamma_green >= GAMMA_MIN && mon->mon_gamma_green <= GAMMA_MAX)
+ gamma_green = mon->mon_gamma_green;
- if (mon->mon_gamma_blue >= GAMMA_MIN &&
- mon->mon_gamma_blue <= GAMMA_MAX)
- gamma_blue = mon->mon_gamma_blue;
+ if (mon->mon_gamma_blue >= GAMMA_MIN && mon->mon_gamma_blue <= GAMMA_MAX)
+ gamma_blue = mon->mon_gamma_blue;
/* This avoids setting gamma 1.0 in case another cloned output on this crtc has a specific gamma. */
if (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0) {
- xf86DrvMsg(output->scrn->scrnIndex, X_INFO, "Output %s wants gamma correction (%.1f, %.1f, %.1f)\n", output->name, gamma_red, gamma_green, gamma_blue);
- return xf86CrtcSetInitialGamma(output->crtc, gamma_red, gamma_green, gamma_blue);
- }else
- return TRUE;
+ xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
+ "Output %s wants gamma correction (%.1f, %.1f, %.1f)\n",
+ output->name, gamma_red, gamma_green, gamma_blue);
+ return xf86CrtcSetInitialGamma(output->crtc, gamma_red, gamma_green,
+ gamma_blue);
+ }
+ else
+ return TRUE;
}
/**
@@ -2368,177 +2320,183 @@ xf86OutputSetInitialGamma(xf86OutputPtr output)
*/
Bool
-xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o, c;
- xf86CrtcPtr *crtcs;
- DisplayModePtr *modes;
- Bool *enabled;
- int width, height;
- int i = scrn->scrnIndex;
+xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o, c;
+ xf86CrtcPtr *crtcs;
+ DisplayModePtr *modes;
+ Bool *enabled;
+ int width, height;
+ int i = scrn->scrnIndex;
Bool have_outputs = TRUE;
Bool ret;
Bool success = FALSE;
/* Set up the device options */
- config->options = xnfalloc (sizeof (xf86DeviceOptions));
- memcpy (config->options, xf86DeviceOptions, sizeof (xf86DeviceOptions));
- xf86ProcessOptions (scrn->scrnIndex,
- scrn->options,
- config->options);
- config->debug_modes = xf86ReturnOptValBool (config->options,
- OPTION_MODEDEBUG, FALSE);
+ config->options = xnfalloc(sizeof(xf86DeviceOptions));
+ memcpy(config->options, xf86DeviceOptions, sizeof(xf86DeviceOptions));
+ xf86ProcessOptions(scrn->scrnIndex, scrn->options, config->options);
+ config->debug_modes = xf86ReturnOptValBool(config->options,
+ OPTION_MODEDEBUG, FALSE);
if (scrn->display->virtualX)
- width = scrn->display->virtualX;
+ width = scrn->display->virtualX;
else
- width = config->maxWidth;
+ width = config->maxWidth;
if (scrn->display->virtualY)
- height = scrn->display->virtualY;
+ height = scrn->display->virtualY;
else
- height = config->maxHeight;
+ height = config->maxHeight;
- xf86ProbeOutputModes (scrn, width, height);
+ xf86ProbeOutputModes(scrn, width, height);
+
+ crtcs = xnfcalloc(config->num_output, sizeof(xf86CrtcPtr));
+ modes = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
+ enabled = xnfcalloc(config->num_output, sizeof(Bool));
- crtcs = xnfcalloc (config->num_output, sizeof (xf86CrtcPtr));
- modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
- enabled = xnfcalloc (config->num_output, sizeof (Bool));
-
ret = xf86CollectEnabledOutputs(scrn, config, enabled);
if (ret == FALSE && canGrow) {
- xf86DrvMsg(i, X_WARNING, "Unable to find connected outputs - setting %dx%d initial framebuffer\n",
- NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
- have_outputs = FALSE;
- } else {
- if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
- else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
- else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
- else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
- else
- xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
- }
-
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- if (!modes[o])
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Output %s enabled but has no modes\n",
- config->output[o]->name);
- else
- xf86DrvMsg (scrn->scrnIndex, X_INFO,
- "Output %s using initial mode %s\n",
- config->output[o]->name, modes[o]->name);
+ xf86DrvMsg(i, X_WARNING,
+ "Unable to find connected outputs - setting %dx%d initial framebuffer\n",
+ NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
+ have_outputs = FALSE;
+ }
+ else {
+ if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
+ else if (xf86TargetPreferred
+ (scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
+ else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO,
+ "Using fuzzy aspect match for initial modes\n");
+ else if (xf86TargetFallback
+ (scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
+ else
+ xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
+ }
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o);) {
+ if (!modes[o])
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "Output %s enabled but has no modes\n",
+ config->output[o]->name);
+ else
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Output %s using initial mode %s\n",
+ config->output[o]->name, modes[o]->name);
}
/*
* Set the position of each output
*/
- if (!xf86InitialOutputPositions (scrn, modes))
- goto bailout;
+ if (!xf86InitialOutputPositions(scrn, modes))
+ goto bailout;
/*
* Set initial panning of each output
*/
- xf86InitialPanning (scrn);
-
+ xf86InitialPanning(scrn);
+
/*
* Assign CRTCs to fit output configuration
*/
- if (have_outputs && !xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
- goto bailout;
-
+ if (have_outputs && !xf86PickCrtcs(scrn, crtcs, modes, 0, width, height))
+ goto bailout;
+
/* XXX override xf86 common frame computation code */
-
+
scrn->display->frameX0 = 0;
scrn->display->frameY0 = 0;
-
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
- crtc->enabled = FALSE;
- memset (&crtc->desiredMode, '\0', sizeof (crtc->desiredMode));
- /* Set default gamma for all crtc's. */
- /* This is done to avoid problems later on with cloned outputs. */
- xf86CrtcSetInitialGamma(crtc, 1.0, 1.0, 1.0);
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->enabled = FALSE;
+ memset(&crtc->desiredMode, '\0', sizeof(crtc->desiredMode));
+ /* Set default gamma for all crtc's. */
+ /* This is done to avoid problems later on with cloned outputs. */
+ xf86CrtcSetInitialGamma(crtc, 1.0, 1.0, 1.0);
}
if (xf86_crtc_supports_gamma(scrn))
- xf86DrvMsg(scrn->scrnIndex, X_INFO, "Using default gamma of (1.0, 1.0, 1.0) unless otherwise stated.\n");
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Using default gamma of (1.0, 1.0, 1.0) unless otherwise stated.\n");
/*
* Set initial configuration
*/
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- DisplayModePtr mode = modes[o];
- xf86CrtcPtr crtc = crtcs[o];
-
- if (mode && crtc)
- {
- crtc->desiredMode = *mode;
- crtc->desiredRotation = output->initial_rotation;
- crtc->desiredX = output->initial_x;
- crtc->desiredY = output->initial_y;
- crtc->desiredTransformPresent = FALSE;
- crtc->enabled = TRUE;
- memcpy (&crtc->panningTotalArea, &output->initialTotalArea, sizeof(BoxRec));
- memcpy (&crtc->panningTrackingArea, &output->initialTrackingArea, sizeof(BoxRec));
- memcpy (crtc->panningBorder, output->initialBorder, 4*sizeof(INT16));
- output->crtc = crtc;
- if (!xf86OutputSetInitialGamma(output))
- xf86DrvMsg (scrn->scrnIndex, X_WARNING, "Initial gamma correction for output %s: failed.\n", output->name);
- } else {
- output->crtc = NULL;
- }
- }
-
- if (scrn->display->virtualX == 0)
- {
- /*
- * Expand virtual size to cover the current config and potential mode
- * switches, if the driver can't enlarge the screen later.
- */
- xf86DefaultScreenLimits (scrn, &width, &height, canGrow);
-
- if (have_outputs == FALSE) {
- if (width < NO_OUTPUT_DEFAULT_WIDTH && height < NO_OUTPUT_DEFAULT_HEIGHT) {
- width = NO_OUTPUT_DEFAULT_WIDTH;
- height = NO_OUTPUT_DEFAULT_HEIGHT;
- }
- }
-
- scrn->display->virtualX = width;
- scrn->display->virtualY = height;
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr mode = modes[o];
+ xf86CrtcPtr crtc = crtcs[o];
+
+ if (mode && crtc) {
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = output->initial_rotation;
+ crtc->desiredX = output->initial_x;
+ crtc->desiredY = output->initial_y;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->enabled = TRUE;
+ memcpy(&crtc->panningTotalArea, &output->initialTotalArea,
+ sizeof(BoxRec));
+ memcpy(&crtc->panningTrackingArea, &output->initialTrackingArea,
+ sizeof(BoxRec));
+ memcpy(crtc->panningBorder, output->initialBorder,
+ 4 * sizeof(INT16));
+ output->crtc = crtc;
+ if (!xf86OutputSetInitialGamma(output))
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "Initial gamma correction for output %s: failed.\n",
+ output->name);
+ }
+ else {
+ output->crtc = NULL;
+ }
+ }
+
+ if (scrn->display->virtualX == 0) {
+ /*
+ * Expand virtual size to cover the current config and potential mode
+ * switches, if the driver can't enlarge the screen later.
+ */
+ xf86DefaultScreenLimits(scrn, &width, &height, canGrow);
+
+ if (have_outputs == FALSE) {
+ if (width < NO_OUTPUT_DEFAULT_WIDTH &&
+ height < NO_OUTPUT_DEFAULT_HEIGHT) {
+ width = NO_OUTPUT_DEFAULT_WIDTH;
+ height = NO_OUTPUT_DEFAULT_HEIGHT;
+ }
+ }
+
+ scrn->display->virtualX = width;
+ scrn->display->virtualY = height;
}
if (width > scrn->virtualX)
- scrn->virtualX = width;
+ scrn->virtualX = width;
if (height > scrn->virtualY)
- scrn->virtualY = height;
+ scrn->virtualY = height;
/*
* Make sure the configuration isn't too small.
*/
if (width < config->minWidth || height < config->minHeight)
- goto bailout;
+ goto bailout;
/*
* Limit the crtc config to virtual[XY] if the driver can't grow the
* desktop.
*/
- if (!canGrow)
- {
- xf86CrtcSetSizeRange (scrn, config->minWidth, config->minHeight,
- width, height);
+ if (!canGrow) {
+ xf86CrtcSetSizeRange(scrn, config->minWidth, config->minHeight,
+ width, height);
}
- xf86SetScrnInfoModes (scrn);
+ xf86SetScrnInfoModes(scrn);
success = TRUE;
bailout:
@@ -2554,58 +2512,58 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
* since the driver will have to re-route things.
*/
static void
-xf86PrepareOutputs (ScrnInfoPtr scrn)
+xf86PrepareOutputs(ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
+ xf86OutputPtr output = config->output[o];
+
#if RANDR_GET_CRTC_INTERFACE
- /* Disable outputs that are unused or will be re-routed */
- if (!output->funcs->get_crtc ||
- output->crtc != (*output->funcs->get_crtc)(output) ||
- output->crtc == NULL)
+ /* Disable outputs that are unused or will be re-routed */
+ if (!output->funcs->get_crtc ||
+ output->crtc != (*output->funcs->get_crtc) (output) ||
+ output->crtc == NULL)
#endif
- (*output->funcs->dpms)(output, DPMSModeOff);
+ (*output->funcs->dpms) (output, DPMSModeOff);
}
}
static void
-xf86PrepareCrtcs (ScrnInfoPtr scrn)
+xf86PrepareCrtcs(ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
for (c = 0; c < config->num_crtc; c++) {
#if RANDR_GET_CRTC_INTERFACE
- xf86CrtcPtr crtc = config->crtc[c];
- xf86OutputPtr output = NULL;
- uint32_t desired_outputs = 0, current_outputs = 0;
- int o;
-
- for (o = 0; o < config->num_output; o++) {
- output = config->output[o];
- if (output->crtc == crtc)
- desired_outputs |= (1<<o);
- /* If we can't tell where it's mapped, force it off */
- if (!output->funcs->get_crtc) {
- desired_outputs = 0;
- break;
- }
- if ((*output->funcs->get_crtc)(output) == crtc)
- current_outputs |= (1<<o);
- }
-
- /*
- * If mappings are different or the CRTC is unused,
- * we need to disable it
- */
- if (desired_outputs != current_outputs ||
- !desired_outputs)
- (*crtc->funcs->dpms)(crtc, DPMSModeOff);
+ xf86CrtcPtr crtc = config->crtc[c];
+ xf86OutputPtr output = NULL;
+ uint32_t desired_outputs = 0, current_outputs = 0;
+ int o;
+
+ for (o = 0; o < config->num_output; o++) {
+ output = config->output[o];
+ if (output->crtc == crtc)
+ desired_outputs |= (1 << o);
+ /* If we can't tell where it's mapped, force it off */
+ if (!output->funcs->get_crtc) {
+ desired_outputs = 0;
+ break;
+ }
+ if ((*output->funcs->get_crtc) (output) == crtc)
+ current_outputs |= (1 << o);
+ }
+
+ /*
+ * If mappings are different or the CRTC is unused,
+ * we need to disable it
+ */
+ if (desired_outputs != current_outputs || !desired_outputs)
+ (*crtc->funcs->dpms) (crtc, DPMSModeOff);
#else
- (*crtc->funcs->dpms)(crtc, DPMSModeOff);
+ (*crtc->funcs->dpms) (crtc, DPMSModeOff);
#endif
}
}
@@ -2616,67 +2574,65 @@ xf86PrepareCrtcs (ScrnInfoPtr scrn)
*/
Bool
-xf86SetDesiredModes (ScrnInfoPtr scrn)
+xf86SetDesiredModes(ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CrtcPtr crtc = config->crtc[0];
- int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcPtr crtc = config->crtc[0];
+ int c;
/* A driver with this hook will take care of this */
if (!crtc->funcs->set_mode_major) {
- xf86PrepareOutputs(scrn);
- xf86PrepareCrtcs(scrn);
- }
-
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86OutputPtr output = NULL;
- int o;
- RRTransformPtr transform;
-
- crtc = config->crtc[c];
-
- /* Skip disabled CRTCs */
- if (!crtc->enabled)
- continue;
-
- if (xf86CompatOutput(scrn) && xf86CompatCrtc(scrn) == crtc)
- output = xf86CompatOutput(scrn);
- else
- {
- for (o = 0; o < config->num_output; o++)
- if (config->output[o]->crtc == crtc)
- {
- output = config->output[o];
- break;
- }
- }
- /* paranoia */
- if (!output)
- continue;
-
- /* Mark that we'll need to re-set the mode for sure */
- memset(&crtc->mode, 0, sizeof(crtc->mode));
- if (!crtc->desiredMode.CrtcHDisplay)
- {
- DisplayModePtr mode = xf86OutputFindClosestMode (output, scrn->currentMode);
-
- if (!mode)
- return FALSE;
- crtc->desiredMode = *mode;
- crtc->desiredRotation = RR_Rotate_0;
- crtc->desiredTransformPresent = FALSE;
- crtc->desiredX = 0;
- crtc->desiredY = 0;
- }
-
- if (crtc->desiredTransformPresent)
- transform = &crtc->desiredTransform;
- else
- transform = NULL;
- if (!xf86CrtcSetModeTransform (crtc, &crtc->desiredMode, crtc->desiredRotation,
- transform, crtc->desiredX, crtc->desiredY))
- return FALSE;
+ xf86PrepareOutputs(scrn);
+ xf86PrepareCrtcs(scrn);
+ }
+
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86OutputPtr output = NULL;
+ int o;
+ RRTransformPtr transform;
+
+ crtc = config->crtc[c];
+
+ /* Skip disabled CRTCs */
+ if (!crtc->enabled)
+ continue;
+
+ if (xf86CompatOutput(scrn) && xf86CompatCrtc(scrn) == crtc)
+ output = xf86CompatOutput(scrn);
+ else {
+ for (o = 0; o < config->num_output; o++)
+ if (config->output[o]->crtc == crtc) {
+ output = config->output[o];
+ break;
+ }
+ }
+ /* paranoia */
+ if (!output)
+ continue;
+
+ /* Mark that we'll need to re-set the mode for sure */
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ if (!crtc->desiredMode.CrtcHDisplay) {
+ DisplayModePtr mode =
+ xf86OutputFindClosestMode(output, scrn->currentMode);
+
+ if (!mode)
+ return FALSE;
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = RR_Rotate_0;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
+
+ if (crtc->desiredTransformPresent)
+ transform = &crtc->desiredTransform;
+ else
+ transform = NULL;
+ if (!xf86CrtcSetModeTransform
+ (crtc, &crtc->desiredMode, crtc->desiredRotation, transform,
+ crtc->desiredX, crtc->desiredY))
+ return FALSE;
}
xf86DisableUnusedFunctions(scrn);
@@ -2694,56 +2650,52 @@ xf86SetDesiredModes (ScrnInfoPtr scrn)
*/
DisplayModePtr
-xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired)
-{
- DisplayModePtr best = NULL, scan = NULL;
-
- for (scan = output->probed_modes; scan != NULL; scan = scan->next)
- {
- /* If there's an exact match, we're done. */
- if (xf86ModesEqual(scan, desired)) {
- best = desired;
- break;
- }
-
- /* Reject if it's larger than the desired mode. */
- if (scan->HDisplay > desired->HDisplay ||
- scan->VDisplay > desired->VDisplay)
- {
- continue;
- }
-
- /*
- * If we haven't picked a best mode yet, use the first
- * one in the size range
- */
- if (best == NULL)
- {
- best = scan;
- continue;
- }
-
- /* Find if it's closer to the right size than the current best
- * option.
- */
- if ((scan->HDisplay > best->HDisplay &&
- scan->VDisplay >= best->VDisplay) ||
- (scan->HDisplay >= best->HDisplay &&
- scan->VDisplay > best->VDisplay))
- {
- best = scan;
- continue;
- }
-
- /* Find if it's still closer to the right refresh than the current
- * best resolution.
- */
- if (scan->HDisplay == best->HDisplay &&
- scan->VDisplay == best->VDisplay &&
- (fabs(scan->VRefresh - desired->VRefresh) <
- fabs(best->VRefresh - desired->VRefresh))) {
- best = scan;
- }
+xf86OutputFindClosestMode(xf86OutputPtr output, DisplayModePtr desired)
+{
+ DisplayModePtr best = NULL, scan = NULL;
+
+ for (scan = output->probed_modes; scan != NULL; scan = scan->next) {
+ /* If there's an exact match, we're done. */
+ if (xf86ModesEqual(scan, desired)) {
+ best = desired;
+ break;
+ }
+
+ /* Reject if it's larger than the desired mode. */
+ if (scan->HDisplay > desired->HDisplay ||
+ scan->VDisplay > desired->VDisplay) {
+ continue;
+ }
+
+ /*
+ * If we haven't picked a best mode yet, use the first
+ * one in the size range
+ */
+ if (best == NULL) {
+ best = scan;
+ continue;
+ }
+
+ /* Find if it's closer to the right size than the current best
+ * option.
+ */
+ if ((scan->HDisplay > best->HDisplay &&
+ scan->VDisplay >= best->VDisplay) ||
+ (scan->HDisplay >= best->HDisplay &&
+ scan->VDisplay > best->VDisplay)) {
+ best = scan;
+ continue;
+ }
+
+ /* Find if it's still closer to the right refresh than the current
+ * best resolution.
+ */
+ if (scan->HDisplay == best->HDisplay &&
+ scan->VDisplay == best->VDisplay &&
+ (fabs(scan->VRefresh - desired->VRefresh) <
+ fabs(best->VRefresh - desired->VRefresh))) {
+ best = scan;
+ }
}
return best;
}
@@ -2757,74 +2709,68 @@ xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired)
*/
Bool
-xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
+xf86SetSingleMode(ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- Bool ok = TRUE;
- xf86OutputPtr compat_output;
- DisplayModePtr compat_mode = NULL;
- int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ Bool ok = TRUE;
+ xf86OutputPtr compat_output;
+ DisplayModePtr compat_mode = NULL;
+ int c;
/*
* Let the compat output drive the final mode selection
*/
compat_output = xf86CompatOutput(pScrn);
if (compat_output)
- compat_mode = xf86OutputFindClosestMode (compat_output, desired);
+ compat_mode = xf86OutputFindClosestMode(compat_output, desired);
if (compat_mode)
- desired = compat_mode;
-
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
- DisplayModePtr crtc_mode = NULL;
- int o;
-
- if (!crtc->enabled)
- continue;
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- DisplayModePtr output_mode;
-
- /* skip outputs not on this crtc */
- if (output->crtc != crtc)
- continue;
-
- if (crtc_mode)
- {
- output_mode = xf86OutputFindClosestMode (output, crtc_mode);
- if (output_mode != crtc_mode)
- output->crtc = NULL;
- }
- else
- crtc_mode = xf86OutputFindClosestMode (output, desired);
- }
- if (!crtc_mode)
- {
- crtc->enabled = FALSE;
- continue;
- }
- if (!xf86CrtcSetModeTransform (crtc, crtc_mode, rotation, NULL, 0, 0))
- ok = FALSE;
- else
- {
- crtc->desiredMode = *crtc_mode;
- crtc->desiredRotation = rotation;
- crtc->desiredTransformPresent = FALSE;
- crtc->desiredX = 0;
- crtc->desiredY = 0;
- }
+ desired = compat_mode;
+
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+ DisplayModePtr crtc_mode = NULL;
+ int o;
+
+ if (!crtc->enabled)
+ continue;
+
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr output_mode;
+
+ /* skip outputs not on this crtc */
+ if (output->crtc != crtc)
+ continue;
+
+ if (crtc_mode) {
+ output_mode = xf86OutputFindClosestMode(output, crtc_mode);
+ if (output_mode != crtc_mode)
+ output->crtc = NULL;
+ }
+ else
+ crtc_mode = xf86OutputFindClosestMode(output, desired);
+ }
+ if (!crtc_mode) {
+ crtc->enabled = FALSE;
+ continue;
+ }
+ if (!xf86CrtcSetModeTransform(crtc, crtc_mode, rotation, NULL, 0, 0))
+ ok = FALSE;
+ else {
+ crtc->desiredMode = *crtc_mode;
+ crtc->desiredRotation = rotation;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
}
xf86DisableUnusedFunctions(pScrn);
#ifdef RANDR_12_INTERFACE
- xf86RandR12TellChanged (pScrn->pScreen);
+ xf86RandR12TellChanged(pScrn->pScreen);
#endif
return ok;
}
-
/**
* Set the DPMS power mode of all outputs and CRTCs.
*
@@ -2834,32 +2780,35 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
void
xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int i;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
if (!scrn->vtSema)
- return;
+ return;
if (mode == DPMSModeOff) {
- for (i = 0; i < config->num_output; i++) {
- xf86OutputPtr output = config->output[i];
- if (output->crtc != NULL)
- (*output->funcs->dpms) (output, mode);
- }
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
+
+ if (output->crtc != NULL)
+ (*output->funcs->dpms) (output, mode);
+ }
}
for (i = 0; i < config->num_crtc; i++) {
- xf86CrtcPtr crtc = config->crtc[i];
- if (crtc->enabled)
- (*crtc->funcs->dpms) (crtc, mode);
+ xf86CrtcPtr crtc = config->crtc[i];
+
+ if (crtc->enabled)
+ (*crtc->funcs->dpms) (crtc, mode);
}
if (mode != DPMSModeOff) {
- for (i = 0; i < config->num_output; i++) {
- xf86OutputPtr output = config->output[i];
- if (output->crtc != NULL)
- (*output->funcs->dpms) (output, mode);
- }
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
+
+ if (output->crtc != NULL)
+ (*output->funcs->dpms) (output, mode);
+ }
}
}
@@ -2875,9 +2824,9 @@ xf86SaveScreen(ScreenPtr pScreen, int mode)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
if (xf86IsUnblank(mode))
- xf86DPMSSet(pScrn, DPMSModeOn, 0);
+ xf86DPMSSet(pScrn, DPMSModeOn, 0);
else
- xf86DPMSSet(pScrn, DPMSModeOff, 0);
+ xf86DPMSSet(pScrn, DPMSModeOff, 0);
return TRUE;
}
@@ -2888,32 +2837,30 @@ xf86SaveScreen(ScreenPtr pScreen, int mode)
void
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int o, c;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o, c;
+
+ for (o = 0; o < xf86_config->num_output; o++) {
+ xf86OutputPtr output = xf86_config->output[o];
- for (o = 0; o < xf86_config->num_output; o++)
- {
- xf86OutputPtr output = xf86_config->output[o];
- if (!output->crtc)
- (*output->funcs->dpms)(output, DPMSModeOff);
+ if (!output->crtc)
+ (*output->funcs->dpms) (output, DPMSModeOff);
}
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
- if (!crtc->enabled)
- {
- crtc->funcs->dpms(crtc, DPMSModeOff);
- memset(&crtc->mode, 0, sizeof(crtc->mode));
- xf86RotateDestroy(crtc);
- crtc->active = FALSE;
- }
+ if (!crtc->enabled) {
+ crtc->funcs->dpms(crtc, DPMSModeOff);
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ xf86RotateDestroy(crtc);
+ crtc->active = FALSE;
+ }
}
if (pScrn->pScreen)
- xf86_crtc_notify(pScrn->pScreen);
+ xf86_crtc_notify(pScrn->pScreen);
if (pScrn->ModeSet)
- pScrn->ModeSet(pScrn);
+ pScrn->ModeSet(pScrn);
}
#ifdef RANDR_12_INTERFACE
@@ -2924,19 +2871,20 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
* Set the RandR EDID property
*/
static void
-xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
+xf86OutputSetEDIDProperty(xf86OutputPtr output, void *data, int data_len)
{
Atom edid_atom = MakeAtom(EDID_ATOM_NAME, sizeof(EDID_ATOM_NAME) - 1, TRUE);
/* This may get called before the RandR resources have been created */
if (output->randr_output == NULL)
- return;
+ return;
if (data_len != 0) {
- RRChangeOutputProperty(output->randr_output, edid_atom, XA_INTEGER, 8,
- PropModeReplace, data_len, data, FALSE, TRUE);
- } else {
- RRDeleteOutputProperty(output->randr_output, edid_atom);
+ RRChangeOutputProperty(output->randr_output, edid_atom, XA_INTEGER, 8,
+ PropModeReplace, data_len, data, FALSE, TRUE);
+ }
+ else {
+ RRDeleteOutputProperty(output->randr_output, edid_atom);
}
}
@@ -2949,14 +2897,16 @@ struct det_phySize_parameter {
Bool ret;
};
-static void handle_detailed_physical_size(struct detailed_monitor_section
- *det_mon, void *data)
+static void
+handle_detailed_physical_size(struct detailed_monitor_section
+ *det_mon, void *data)
{
struct det_phySize_parameter *p;
- p = (struct det_phySize_parameter *)data;
- if (p->ret == TRUE )
- return ;
+ p = (struct det_phySize_parameter *) data;
+
+ if (p->ret == TRUE)
+ return;
xf86DetTimingApplyQuirks(det_mon, p->quirks,
p->output->MonInfo->features.hsize,
@@ -2975,25 +2925,26 @@ static void handle_detailed_physical_size(struct detailed_monitor_section
* Set the EDID information for the specified output
*/
void
-xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
+xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon)
{
- ScrnInfoPtr scrn = output->scrn;
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- Bool debug_modes = config->debug_modes || xf86Initialising;
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ Bool debug_modes = config->debug_modes || xf86Initialising;
+
#ifdef RANDR_12_INTERFACE
- int size;
+ int size;
#endif
-
+
free(output->MonInfo);
-
+
output->MonInfo = edid_mon;
output->mm_width = 0;
output->mm_height = 0;
if (debug_modes) {
- xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n",
- output->name);
- xf86PrintEDID(edid_mon);
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n",
+ output->name);
+ xf86PrintEDID(edid_mon);
}
/* Set the DDC properties for the 'compat' output */
@@ -3003,34 +2954,34 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
#ifdef RANDR_12_INTERFACE
/* Set the RandR output properties */
size = 0;
- if (edid_mon)
- {
- if (edid_mon->ver.version == 1) {
- size = 128;
- if (edid_mon->flags & EDID_COMPLETE_RAWDATA)
- size += edid_mon->no_sections * 128;
- } else if (edid_mon->ver.version == 2)
- size = 256;
- }
- xf86OutputSetEDIDProperty (output, edid_mon ? edid_mon->rawData : NULL, size);
+ if (edid_mon) {
+ if (edid_mon->ver.version == 1) {
+ size = 128;
+ if (edid_mon->flags & EDID_COMPLETE_RAWDATA)
+ size += edid_mon->no_sections * 128;
+ }
+ else if (edid_mon->ver.version == 2)
+ size = 256;
+ }
+ xf86OutputSetEDIDProperty(output, edid_mon ? edid_mon->rawData : NULL,
+ size);
#endif
if (edid_mon) {
struct det_phySize_parameter p;
+
p.output = output;
- p.quirks = xf86DDCDetectQuirks(scrn->scrnIndex,edid_mon, FALSE);
+ p.quirks = xf86DDCDetectQuirks(scrn->scrnIndex, edid_mon, FALSE);
p.ret = FALSE;
- xf86ForEachDetailedBlock(edid_mon,
- handle_detailed_physical_size, &p);
+ xf86ForEachDetailedBlock(edid_mon, handle_detailed_physical_size, &p);
- /* if no mm size is available from a detailed timing, check the max size field */
- if ((!output->mm_width || !output->mm_height) &&
- (edid_mon->features.hsize && edid_mon->features.vsize))
- {
- output->mm_width = edid_mon->features.hsize * 10;
- output->mm_height = edid_mon->features.vsize * 10;
- }
+ /* if no mm size is available from a detailed timing, check the max size field */
+ if ((!output->mm_width || !output->mm_height) &&
+ (edid_mon->features.hsize && edid_mon->features.vsize)) {
+ output->mm_width = edid_mon->features.hsize * 10;
+ output->mm_height = edid_mon->features.vsize * 10;
+ }
}
}
@@ -3039,21 +2990,21 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
* stored in 'output'
*/
DisplayModePtr
-xf86OutputGetEDIDModes (xf86OutputPtr output)
+xf86OutputGetEDIDModes(xf86OutputPtr output)
{
- ScrnInfoPtr scrn = output->scrn;
- xf86MonPtr edid_mon = output->MonInfo;
+ ScrnInfoPtr scrn = output->scrn;
+ xf86MonPtr edid_mon = output->MonInfo;
if (!edid_mon)
- return NULL;
+ return NULL;
return xf86DDCGetModes(scrn->scrnIndex, edid_mon);
}
/* maybe we should care about DDC1? meh. */
xf86MonPtr
-xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
+xf86OutputGetEDID(xf86OutputPtr output, I2CBusPtr pDDCBus)
{
- ScrnInfoPtr scrn = output->scrn;
+ ScrnInfoPtr scrn = output->scrn;
xf86MonPtr mon;
mon = xf86DoEEDID(scrn->scrnIndex, pDDCBus, TRUE);
@@ -3064,11 +3015,12 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
}
static const char *_xf86ConnectorNames[] = {
- "None", "VGA", "DVI-I", "DVI-D",
- "DVI-A", "Composite", "S-Video",
- "Component", "LFP", "Proprietary",
- "HDMI", "DisplayPort",
- };
+ "None", "VGA", "DVI-I", "DVI-D",
+ "DVI-A", "Composite", "S-Video",
+ "Component", "LFP", "Proprietary",
+ "HDMI", "DisplayPort",
+};
+
const char *
xf86ConnectorGetName(xf86ConnectorType connector)
{
@@ -3084,19 +3036,20 @@ x86_crtc_box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b)
dest->y2 = a->y2 < b->y2 ? a->y2 : b->y2;
if (dest->x1 >= dest->x2 || dest->y1 >= dest->y2)
- dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0;
+ dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0;
}
static void
x86_crtc_box(xf86CrtcPtr crtc, BoxPtr crtc_box)
{
if (crtc->enabled) {
- crtc_box->x1 = crtc->x;
- crtc_box->x2 = crtc->x + xf86ModeWidth(&crtc->mode, crtc->rotation);
- crtc_box->y1 = crtc->y;
- crtc_box->y2 = crtc->y + xf86ModeHeight(&crtc->mode, crtc->rotation);
- } else
- crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
+ crtc_box->x1 = crtc->x;
+ crtc_box->x2 = crtc->x + xf86ModeWidth(&crtc->mode, crtc->rotation);
+ crtc_box->y1 = crtc->y;
+ crtc_box->y2 = crtc->y + xf86ModeHeight(&crtc->mode, crtc->rotation);
+ }
+ else
+ crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
}
static int
@@ -3114,15 +3067,13 @@ xf86_crtc_box_area(BoxPtr box)
static xf86CrtcPtr
xf86_covering_crtc(ScrnInfoPtr pScrn,
- BoxPtr box,
- xf86CrtcPtr desired,
- BoxPtr crtc_box_ret)
+ BoxPtr box, xf86CrtcPtr desired, BoxPtr crtc_box_ret)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- xf86CrtcPtr crtc, best_crtc;
- int coverage, best_coverage;
- int c;
- BoxRec crtc_box, cover_box;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc, best_crtc;
+ int coverage, best_coverage;
+ int c;
+ BoxRec crtc_box, cover_box;
best_crtc = NULL;
best_coverage = 0;
@@ -3131,18 +3082,19 @@ xf86_covering_crtc(ScrnInfoPtr pScrn,
crtc_box_ret->y1 = 0;
crtc_box_ret->y2 = 0;
for (c = 0; c < xf86_config->num_crtc; c++) {
- crtc = xf86_config->crtc[c];
- x86_crtc_box(crtc, &crtc_box);
- x86_crtc_box_intersect(&cover_box, &crtc_box, box);
- coverage = xf86_crtc_box_area(&cover_box);
- if (coverage && crtc == desired) {
- *crtc_box_ret = crtc_box;
- return crtc;
- } else if (coverage > best_coverage) {
- *crtc_box_ret = crtc_box;
- best_crtc = crtc;
- best_coverage = coverage;
- }
+ crtc = xf86_config->crtc[c];
+ x86_crtc_box(crtc, &crtc_box);
+ x86_crtc_box_intersect(&cover_box, &crtc_box, box);
+ coverage = xf86_crtc_box_area(&cover_box);
+ if (coverage && crtc == desired) {
+ *crtc_box_ret = crtc_box;
+ return crtc;
+ }
+ else if (coverage > best_coverage) {
+ *crtc_box_ret = crtc_box;
+ best_crtc = crtc;
+ best_coverage = coverage;
+ }
}
return best_crtc;
}
@@ -3157,57 +3109,53 @@ xf86_covering_crtc(ScrnInfoPtr pScrn,
Bool
xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
- xf86CrtcPtr *crtc_ret,
- xf86CrtcPtr desired_crtc,
- BoxPtr dst,
- INT32 *xa,
- INT32 *xb,
- INT32 *ya,
- INT32 *yb,
- RegionPtr reg,
- INT32 width,
- INT32 height)
-{
- Bool ret;
- RegionRec crtc_region_local;
- RegionPtr crtc_region = reg;
-
- if (crtc_ret) {
- BoxRec crtc_box;
- xf86CrtcPtr crtc = xf86_covering_crtc(pScrn, dst,
- desired_crtc,
- &crtc_box);
+ xf86CrtcPtr * crtc_ret,
+ xf86CrtcPtr desired_crtc,
+ BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb, RegionPtr reg, INT32 width, INT32 height)
+{
+ Bool ret;
+ RegionRec crtc_region_local;
+ RegionPtr crtc_region = reg;
- if (crtc) {
- RegionInit(&crtc_region_local, &crtc_box, 1);
- crtc_region = &crtc_region_local;
- RegionIntersect(crtc_region, crtc_region, reg);
- }
- *crtc_ret = crtc;
+ if (crtc_ret) {
+ BoxRec crtc_box;
+ xf86CrtcPtr crtc = xf86_covering_crtc(pScrn, dst,
+ desired_crtc,
+ &crtc_box);
+
+ if (crtc) {
+ RegionInit(&crtc_region_local, &crtc_box, 1);
+ crtc_region = &crtc_region_local;
+ RegionIntersect(crtc_region, crtc_region, reg);
+ }
+ *crtc_ret = crtc;
}
- ret = xf86XVClipVideoHelper(dst, xa, xb, ya, yb,
- crtc_region, width, height);
+ ret = xf86XVClipVideoHelper(dst, xa, xb, ya, yb,
+ crtc_region, width, height);
if (crtc_region != reg)
- RegionUninit(&crtc_region_local);
+ RegionUninit(&crtc_region_local);
return ret;
}
#endif
xf86_crtc_notify_proc_ptr
-xf86_wrap_crtc_notify (ScreenPtr screen, xf86_crtc_notify_proc_ptr new)
-{
- if (xf86CrtcConfigPrivateIndex != -1)
- {
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86_crtc_notify_proc_ptr old;
-
- old = config->xf86_crtc_notify;
- config->xf86_crtc_notify = new;
- return old;
+xf86_wrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr new)
+{
+ if (xf86CrtcConfigPrivateIndex != -1) {
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86_crtc_notify_proc_ptr old;
+
+ old = config->xf86_crtc_notify;
+ config->xf86_crtc_notify = new;
+ return old;
}
return NULL;
}
@@ -3215,40 +3163,39 @@ xf86_wrap_crtc_notify (ScreenPtr screen, xf86_crtc_notify_proc_ptr new)
void
xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old)
{
- if (xf86CrtcConfigPrivateIndex != -1)
- {
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-
- config->xf86_crtc_notify = old;
+ if (xf86CrtcConfigPrivateIndex != -1) {
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ config->xf86_crtc_notify = old;
}
}
void
xf86_crtc_notify(ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
if (config->xf86_crtc_notify)
- config->xf86_crtc_notify(screen);
+ config->xf86_crtc_notify(screen);
}
Bool
xf86_crtc_supports_gamma(ScrnInfoPtr pScrn)
{
if (xf86CrtcConfigPrivateIndex != -1) {
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- xf86CrtcPtr crtc;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc;
- /* for multiple drivers loaded we need this */
- if (!xf86_config)
- return FALSE;
- if (xf86_config->num_crtc == 0)
- return FALSE;
- crtc = xf86_config->crtc[0];
+ /* for multiple drivers loaded we need this */
+ if (!xf86_config)
+ return FALSE;
+ if (xf86_config->num_crtc == 0)
+ return FALSE;
+ crtc = xf86_config->crtc[0];
- return crtc->funcs->gamma_set != NULL;
+ return crtc->funcs->gamma_set != NULL;
}
return FALSE;
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.h b/xorg-server/hw/xfree86/modes/xf86Crtc.h
index 8d4a08938..a6a3c2e95 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.h
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.h
@@ -53,24 +53,24 @@ typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr;
/* define a standard for connector types */
typedef enum _xf86ConnectorType {
- XF86ConnectorNone,
- XF86ConnectorVGA,
- XF86ConnectorDVI_I,
- XF86ConnectorDVI_D,
- XF86ConnectorDVI_A,
- XF86ConnectorComposite,
- XF86ConnectorSvideo,
- XF86ConnectorComponent,
- XF86ConnectorLFP,
- XF86ConnectorProprietary,
- XF86ConnectorHDMI,
- XF86ConnectorDisplayPort,
+ XF86ConnectorNone,
+ XF86ConnectorVGA,
+ XF86ConnectorDVI_I,
+ XF86ConnectorDVI_D,
+ XF86ConnectorDVI_A,
+ XF86ConnectorComposite,
+ XF86ConnectorSvideo,
+ XF86ConnectorComponent,
+ XF86ConnectorLFP,
+ XF86ConnectorProprietary,
+ XF86ConnectorHDMI,
+ XF86ConnectorDisplayPort,
} xf86ConnectorType;
typedef enum _xf86OutputStatus {
- XF86OutputStatusConnected,
- XF86OutputStatusDisconnected,
- XF86OutputStatusUnknown
+ XF86OutputStatusConnected,
+ XF86OutputStatusDisconnected,
+ XF86OutputStatusUnknown
} xf86OutputStatus;
typedef struct _xf86CrtcFuncs {
@@ -81,35 +81,34 @@ typedef struct _xf86CrtcFuncs {
* mode is DPMSModeOff, the crtc must be disabled sufficiently for it to
* be safe to call mode_set.
*/
- void
- (*dpms)(xf86CrtcPtr crtc,
- int mode);
+ void
+ (*dpms) (xf86CrtcPtr crtc, int mode);
/**
* Saves the crtc's state for restoration on VT switch.
*/
- void
- (*save)(xf86CrtcPtr crtc);
+ void
+ (*save) (xf86CrtcPtr crtc);
/**
* Restore's the crtc's state at VT switch.
*/
- void
- (*restore)(xf86CrtcPtr crtc);
+ void
+ (*restore) (xf86CrtcPtr crtc);
/**
* Lock CRTC prior to mode setting, mostly for DRI.
* Returns whether unlock is needed
*/
Bool
- (*lock) (xf86CrtcPtr crtc);
-
+ (*lock) (xf86CrtcPtr crtc);
+
/**
* Unlock CRTC after mode setting, mostly for DRI
*/
void
- (*unlock) (xf86CrtcPtr crtc);
-
+ (*unlock) (xf86CrtcPtr crtc);
+
/**
* Callback to adjust the mode to be set in the CRTC.
*
@@ -118,109 +117,106 @@ typedef struct _xf86CrtcFuncs {
* buses with clock limitations.
*/
Bool
- (*mode_fixup)(xf86CrtcPtr crtc,
- DisplayModePtr mode,
- DisplayModePtr adjusted_mode);
+ (*mode_fixup) (xf86CrtcPtr crtc,
+ DisplayModePtr mode, DisplayModePtr adjusted_mode);
/**
* Prepare CRTC for an upcoming mode set.
*/
void
- (*prepare)(xf86CrtcPtr crtc);
+ (*prepare) (xf86CrtcPtr crtc);
/**
* Callback for setting up a video mode after fixups have been made.
*/
void
- (*mode_set)(xf86CrtcPtr crtc,
- DisplayModePtr mode,
- DisplayModePtr adjusted_mode,
- int x, int y);
+ (*mode_set) (xf86CrtcPtr crtc,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode, int x, int y);
/**
* Commit mode changes to a CRTC
*/
void
- (*commit)(xf86CrtcPtr crtc);
+ (*commit) (xf86CrtcPtr crtc);
/* Set the color ramps for the CRTC to the given values. */
void
- (*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
- int size);
+ (*gamma_set) (xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
+ int size);
/**
* Allocate the shadow area, delay the pixmap creation until needed
*/
- void *
- (*shadow_allocate) (xf86CrtcPtr crtc, int width, int height);
-
+ void *(*shadow_allocate) (xf86CrtcPtr crtc, int width, int height);
+
/**
* Create shadow pixmap for rotation support
*/
PixmapPtr
- (*shadow_create) (xf86CrtcPtr crtc, void *data, int width, int height);
-
+ (*shadow_create) (xf86CrtcPtr crtc, void *data, int width, int height);
+
/**
* Destroy shadow pixmap
*/
void
- (*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data);
+ (*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data);
/**
* Set cursor colors
*/
void
- (*set_cursor_colors) (xf86CrtcPtr crtc, int bg, int fg);
+ (*set_cursor_colors) (xf86CrtcPtr crtc, int bg, int fg);
/**
* Set cursor position
*/
void
- (*set_cursor_position) (xf86CrtcPtr crtc, int x, int y);
+ (*set_cursor_position) (xf86CrtcPtr crtc, int x, int y);
/**
* Show cursor
*/
void
- (*show_cursor) (xf86CrtcPtr crtc);
+ (*show_cursor) (xf86CrtcPtr crtc);
/**
* Hide cursor
*/
void
- (*hide_cursor) (xf86CrtcPtr crtc);
+ (*hide_cursor) (xf86CrtcPtr crtc);
/**
* Load monochrome image
*/
void
- (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
+ (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
/**
* Load ARGB image
*/
- void
+ void
(*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
-
+
/**
* Clean up driver-specific bits of the crtc
*/
void
- (*destroy) (xf86CrtcPtr crtc);
+ (*destroy) (xf86CrtcPtr crtc);
/**
* Less fine-grained mode setting entry point for kernel modesetting
*/
Bool
- (*set_mode_major)(xf86CrtcPtr crtc, DisplayModePtr mode,
- Rotation rotation, int x, int y);
+ (*set_mode_major) (xf86CrtcPtr crtc, DisplayModePtr mode,
+ Rotation rotation, int x, int y);
/**
* Callback for panning. Doesn't change the mode.
* Added in ABI version 2
*/
void
- (*set_origin)(xf86CrtcPtr crtc, int x, int y);
+ (*set_origin) (xf86CrtcPtr crtc, int x, int y);
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
@@ -235,15 +231,15 @@ struct _xf86Crtc {
/**
* Associated ScrnInfo
*/
- ScrnInfoPtr scrn;
-
+ ScrnInfoPtr scrn;
+
/**
* Desired state of this CRTC
*
* Set when this CRTC should be driving one or more outputs
*/
- Bool enabled;
-
+ Bool enabled;
+
/**
* Active mode
*
@@ -251,18 +247,18 @@ struct _xf86Crtc {
* It will be cleared when the VT is not active or
* during server startup
*/
- DisplayModeRec mode;
- Rotation rotation;
- PixmapPtr rotatedPixmap;
- void *rotatedData;
-
+ DisplayModeRec mode;
+ Rotation rotation;
+ PixmapPtr rotatedPixmap;
+ void *rotatedData;
+
/**
* Position on screen
*
* Locates this CRTC within the frame buffer
*/
- int x, y;
-
+ int x, y;
+
/**
* Desired mode
*
@@ -271,10 +267,10 @@ struct _xf86Crtc {
* the startup configured mode and saves the active mode
* on VT switch.
*/
- DisplayModeRec desiredMode;
- Rotation desiredRotation;
- int desiredX, desiredY;
-
+ DisplayModeRec desiredMode;
+ Rotation desiredRotation;
+ int desiredX, desiredY;
+
/** crtc-specific functions */
const xf86CrtcFuncsRec *funcs;
@@ -283,7 +279,7 @@ struct _xf86Crtc {
*
* Holds driver-private information
*/
- void *driver_private;
+ void *driver_private;
#ifdef RANDR_12_INTERFACE
/**
@@ -292,45 +288,45 @@ struct _xf86Crtc {
* When RandR 1.2 is available, this
* points at the associated crtc object
*/
- RRCrtcPtr randr_crtc;
+ RRCrtcPtr randr_crtc;
#else
- void *randr_crtc;
+ void *randr_crtc;
#endif
/**
* Current cursor is ARGB
*/
- Bool cursor_argb;
+ Bool cursor_argb;
/**
* Track whether cursor is within CRTC range
*/
- Bool cursor_in_range;
+ Bool cursor_in_range;
/**
* Track state of cursor associated with this CRTC
*/
- Bool cursor_shown;
+ Bool cursor_shown;
/**
* Current transformation matrix
*/
- PictTransform crtc_to_framebuffer;
+ PictTransform crtc_to_framebuffer;
/* framebuffer_to_crtc was removed in ABI 2 */
- struct pict_f_transform f_crtc_to_framebuffer; /* ABI 2 */
- struct pict_f_transform f_framebuffer_to_crtc; /* ABI 2 */
- PictFilterPtr filter; /* ABI 2 */
- xFixed *params; /* ABI 2 */
- int nparams; /* ABI 2 */
- int filter_width; /* ABI 2 */
- int filter_height; /* ABI 2 */
- Bool transform_in_use;
- RRTransformRec transform; /* ABI 2 */
- Bool transformPresent; /* ABI 2 */
- RRTransformRec desiredTransform; /* ABI 2 */
- Bool desiredTransformPresent; /* ABI 2 */
+ struct pict_f_transform f_crtc_to_framebuffer; /* ABI 2 */
+ struct pict_f_transform f_framebuffer_to_crtc; /* ABI 2 */
+ PictFilterPtr filter; /* ABI 2 */
+ xFixed *params; /* ABI 2 */
+ int nparams; /* ABI 2 */
+ int filter_width; /* ABI 2 */
+ int filter_height; /* ABI 2 */
+ Bool transform_in_use;
+ RRTransformRec transform; /* ABI 2 */
+ Bool transformPresent; /* ABI 2 */
+ RRTransformRec desiredTransform; /* ABI 2 */
+ Bool desiredTransformPresent; /* ABI 2 */
/**
* Bounding box in screen space
*/
- BoxRec bounds;
+ BoxRec bounds;
/**
* Panning:
* TotalArea: total panning area, larger than CRTC's size
@@ -338,9 +334,9 @@ struct _xf86Crtc {
* border: Borders of the displayed CRTC area which induces panning if the pointer reaches them
* Added in ABI version 2
*/
- BoxRec panningTotalArea;
- BoxRec panningTrackingArea;
- INT16 panningBorder[4];
+ BoxRec panningTotalArea;
+ BoxRec panningTrackingArea;
+ INT16 panningBorder[4];
/**
* Current gamma, especially useful after initial config.
@@ -357,11 +353,11 @@ struct _xf86Crtc {
* Set to TRUE after modesetting, set to FALSE if no outputs are connected
* Added in ABI version 3
*/
- Bool active;
+ Bool active;
/**
* Clear the shadow
*/
- Bool shadowClear;
+ Bool shadowClear;
/**
* Indicates that the driver is handling the transform, so the shadow
@@ -374,7 +370,7 @@ struct _xf86Crtc {
*
* Added in ABI version 4
*/
- Bool driverIsPerformingTransform;
+ Bool driverIsPerformingTransform;
};
typedef struct _xf86OutputFuncs {
@@ -383,7 +379,7 @@ typedef struct _xf86OutputFuncs {
* RandR objects have been created.
*/
void
- (*create_resources)(xf86OutputPtr output);
+ (*create_resources) (xf86OutputPtr output);
/**
* Turns the output on/off, or sets intermediate power levels if available.
@@ -393,20 +389,19 @@ typedef struct _xf86OutputFuncs {
* disabled afterwards.
*/
void
- (*dpms)(xf86OutputPtr output,
- int mode);
+ (*dpms) (xf86OutputPtr output, int mode);
/**
* Saves the output's state for restoration on VT switch.
*/
void
- (*save)(xf86OutputPtr output);
+ (*save) (xf86OutputPtr output);
/**
* Restore's the output's state at VT switch.
*/
void
- (*restore)(xf86OutputPtr output);
+ (*restore) (xf86OutputPtr output);
/**
* Callback for testing a video mode for a given output.
@@ -417,8 +412,7 @@ typedef struct _xf86OutputFuncs {
* \return MODE_OK if the mode is valid, or another MODE_* otherwise.
*/
int
- (*mode_valid)(xf86OutputPtr output,
- DisplayModePtr pMode);
+ (*mode_valid) (xf86OutputPtr output, DisplayModePtr pMode);
/**
* Callback to adjust the mode to be set in the CRTC.
@@ -428,21 +422,20 @@ typedef struct _xf86OutputFuncs {
* buses with clock limitations.
*/
Bool
- (*mode_fixup)(xf86OutputPtr output,
- DisplayModePtr mode,
- DisplayModePtr adjusted_mode);
+ (*mode_fixup) (xf86OutputPtr output,
+ DisplayModePtr mode, DisplayModePtr adjusted_mode);
/**
* Callback for preparing mode changes on an output
*/
void
- (*prepare)(xf86OutputPtr output);
+ (*prepare) (xf86OutputPtr output);
/**
* Callback for committing mode changes on an output
*/
void
- (*commit)(xf86OutputPtr output);
+ (*commit) (xf86OutputPtr output);
/**
* Callback for setting up a video mode after fixups have been made.
@@ -452,15 +445,13 @@ typedef struct _xf86OutputFuncs {
* after this function is called.
*/
void
- (*mode_set)(xf86OutputPtr output,
- DisplayModePtr mode,
- DisplayModePtr adjusted_mode);
+ (*mode_set) (xf86OutputPtr output,
+ DisplayModePtr mode, DisplayModePtr adjusted_mode);
/**
* Probe for a connected output, and return detect_status.
*/
- xf86OutputStatus
- (*detect)(xf86OutputPtr output);
+ xf86OutputStatus(*detect) (xf86OutputPtr output);
/**
* Query the device for the modes it provides.
@@ -469,41 +460,36 @@ typedef struct _xf86OutputFuncs {
*
* \return singly-linked list of modes or NULL if no modes found.
*/
- DisplayModePtr
- (*get_modes)(xf86OutputPtr output);
+ DisplayModePtr(*get_modes) (xf86OutputPtr output);
#ifdef RANDR_12_INTERFACE
/**
* Callback when an output's property has changed.
*/
Bool
- (*set_property)(xf86OutputPtr output,
- Atom property,
- RRPropertyValuePtr value);
+ (*set_property) (xf86OutputPtr output,
+ Atom property, RRPropertyValuePtr value);
#endif
#ifdef RANDR_13_INTERFACE
/**
* Callback to get an updated property value
*/
Bool
- (*get_property)(xf86OutputPtr output,
- Atom property);
+ (*get_property) (xf86OutputPtr output, Atom property);
#endif
#ifdef RANDR_GET_CRTC_INTERFACE
/**
* Callback to get current CRTC for a given output
*/
- xf86CrtcPtr
- (*get_crtc)(xf86OutputPtr output);
+ xf86CrtcPtr(*get_crtc) (xf86OutputPtr output);
#endif
/**
* Clean up driver-specific bits of the output
*/
void
- (*destroy) (xf86OutputPtr output);
+ (*destroy) (xf86OutputPtr output);
} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
-
#define XF86_OUTPUT_VERSION 2
struct _xf86Output {
@@ -515,34 +501,34 @@ struct _xf86Output {
/**
* Associated ScrnInfo
*/
- ScrnInfoPtr scrn;
+ ScrnInfoPtr scrn;
/**
* Currently connected crtc (if any)
*
* If this output is not in use, this field will be NULL.
*/
- xf86CrtcPtr crtc;
+ xf86CrtcPtr crtc;
/**
* Possible CRTCs for this output as a mask of crtc indices
*/
- CARD32 possible_crtcs;
+ CARD32 possible_crtcs;
/**
* Possible outputs to share the same CRTC as a mask of output indices
*/
- CARD32 possible_clones;
-
+ CARD32 possible_clones;
+
/**
* Whether this output can support interlaced modes
*/
- Bool interlaceAllowed;
+ Bool interlaceAllowed;
/**
* Whether this output can support double scan modes
*/
- Bool doubleScanAllowed;
+ Bool doubleScanAllowed;
/**
* List of available modes on this output.
@@ -550,27 +536,27 @@ struct _xf86Output {
* This should be the list from get_modes(), plus perhaps additional
* compatible modes added later.
*/
- DisplayModePtr probed_modes;
+ DisplayModePtr probed_modes;
/**
* Options parsed from the related monitor section
*/
- OptionInfoPtr options;
-
+ OptionInfoPtr options;
+
/**
* Configured monitor section
*/
- XF86ConfMonitorPtr conf_monitor;
-
+ XF86ConfMonitorPtr conf_monitor;
+
/**
* Desired initial position
*/
- int initial_x, initial_y;
+ int initial_x, initial_y;
/**
* Desired initial rotation
*/
- Rotation initial_rotation;
+ Rotation initial_rotation;
/**
* Current connection status
@@ -578,28 +564,28 @@ struct _xf86Output {
* This indicates whether a monitor is known to be connected
* to this output or not, or whether there is no way to tell
*/
- xf86OutputStatus status;
+ xf86OutputStatus status;
/** EDID monitor information */
- xf86MonPtr MonInfo;
+ xf86MonPtr MonInfo;
/** subpixel order */
- int subpixel_order;
+ int subpixel_order;
/** Physical size of the currently attached output device. */
- int mm_width, mm_height;
+ int mm_width, mm_height;
/** Output name */
- char *name;
+ char *name;
/** output-specific functions */
const xf86OutputFuncsRec *funcs;
/** driver private information */
- void *driver_private;
-
+ void *driver_private;
+
/** Whether to use the old per-screen Monitor config section */
- Bool use_screen_monitor;
+ Bool use_screen_monitor;
#ifdef RANDR_12_INTERFACE
/**
@@ -608,17 +594,17 @@ struct _xf86Output {
* When RandR 1.2 is available, this points at the associated
* RandR output structure and is created when this output is created
*/
- RROutputPtr randr_output;
+ RROutputPtr randr_output;
#else
- void *randr_output;
+ void *randr_output;
#endif
/**
* Desired initial panning
* Added in ABI version 2
*/
- BoxRec initialTotalArea;
- BoxRec initialTrackingArea;
- INT16 initialBorder[4];
+ BoxRec initialTotalArea;
+ BoxRec initialTrackingArea;
+ INT16 initialBorder[4];
};
typedef struct _xf86CrtcConfigFuncs {
@@ -635,67 +621,65 @@ typedef struct _xf86CrtcConfigFuncs {
* pixmaps it may have moved, and change pScrn->displayWidth.
*/
Bool
- (*resize)(ScrnInfoPtr scrn,
- int width,
- int height);
+ (*resize) (ScrnInfoPtr scrn, int width, int height);
} xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
typedef void (*xf86_crtc_notify_proc_ptr) (ScreenPtr pScreen);
typedef struct _xf86CrtcConfig {
- int num_output;
- xf86OutputPtr *output;
+ int num_output;
+ xf86OutputPtr *output;
/**
* compat_output is used whenever we deal
* with legacy code that only understands a single
* output. pScrn->modes will be loaded from this output,
* adjust frame will whack this output, etc.
*/
- int compat_output;
+ int compat_output;
+
+ int num_crtc;
+ xf86CrtcPtr *crtc;
- int num_crtc;
- xf86CrtcPtr *crtc;
+ int minWidth, minHeight;
+ int maxWidth, maxHeight;
- int minWidth, minHeight;
- int maxWidth, maxHeight;
-
/* For crtc-based rotation */
- DamagePtr rotation_damage;
- Bool rotation_damage_registered;
+ DamagePtr rotation_damage;
+ Bool rotation_damage_registered;
/* DGA */
- unsigned int dga_flags;
- unsigned long dga_address;
- DGAModePtr dga_modes;
- int dga_nmode;
- int dga_width, dga_height, dga_stride;
- DisplayModePtr dga_save_mode;
+ unsigned int dga_flags;
+ unsigned long dga_address;
+ DGAModePtr dga_modes;
+ int dga_nmode;
+ int dga_width, dga_height, dga_stride;
+ DisplayModePtr dga_save_mode;
const xf86CrtcConfigFuncsRec *funcs;
- CreateScreenResourcesProcPtr CreateScreenResources;
+ CreateScreenResourcesProcPtr CreateScreenResources;
- CloseScreenProcPtr CloseScreen;
+ CloseScreenProcPtr CloseScreen;
/* Cursor information */
- xf86CursorInfoPtr cursor_info;
- CursorPtr cursor;
- CARD8 *cursor_image;
- Bool cursor_on;
- CARD32 cursor_fg, cursor_bg;
+ xf86CursorInfoPtr cursor_info;
+ CursorPtr cursor;
+ CARD8 *cursor_image;
+ Bool cursor_on;
+ CARD32 cursor_fg, cursor_bg;
/**
* Options parsed from the related device section
*/
- OptionInfoPtr options;
+ OptionInfoPtr options;
- Bool debug_modes;
+ Bool debug_modes;
/* wrap screen BlockHandler for rotation */
- ScreenBlockHandlerProcPtr BlockHandler;
+ ScreenBlockHandlerProcPtr BlockHandler;
/* callback when crtc configuration changes */
- xf86_crtc_notify_proc_ptr xf86_crtc_notify;
+ xf86_crtc_notify_proc_ptr xf86_crtc_notify;
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
@@ -707,6 +691,7 @@ static _X_INLINE xf86OutputPtr
xf86CompatOutput(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+
return config->output[config->compat_output];
}
@@ -714,156 +699,155 @@ static _X_INLINE xf86CrtcPtr
xf86CompatCrtc(ScrnInfoPtr pScrn)
{
xf86OutputPtr compat_output = xf86CompatOutput(pScrn);
+
if (!compat_output)
- return NULL;
+ return NULL;
return compat_output->crtc;
}
static _X_INLINE RRCrtcPtr
xf86CompatRRCrtc(ScrnInfoPtr pScrn)
{
- xf86CrtcPtr compat_crtc = xf86CompatCrtc(pScrn);
+ xf86CrtcPtr compat_crtc = xf86CompatCrtc(pScrn);
+
if (!compat_crtc)
- return NULL;
+ return NULL;
return compat_crtc->randr_crtc;
}
-
/*
* Initialize xf86CrtcConfig structure
*/
extern _X_EXPORT void
-xf86CrtcConfigInit (ScrnInfoPtr scrn,
- const xf86CrtcConfigFuncsRec *funcs);
+ xf86CrtcConfigInit(ScrnInfoPtr scrn, const xf86CrtcConfigFuncsRec * funcs);
extern _X_EXPORT void
-xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
- int minWidth, int minHeight,
- int maxWidth, int maxHeight);
+
+xf86CrtcSetSizeRange(ScrnInfoPtr scrn,
+ int minWidth, int minHeight, int maxWidth, int maxHeight);
/*
* Crtc functions
*/
extern _X_EXPORT xf86CrtcPtr
-xf86CrtcCreate (ScrnInfoPtr scrn,
- const xf86CrtcFuncsRec *funcs);
+xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs);
extern _X_EXPORT void
-xf86CrtcDestroy (xf86CrtcPtr crtc);
-
+ xf86CrtcDestroy(xf86CrtcPtr crtc);
/**
* Sets the given video mode on the given crtc
*/
extern _X_EXPORT Bool
-xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
- RRTransformPtr transform, int x, int y);
+
+xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
+ Rotation rotation, RRTransformPtr transform, int x,
+ int y);
extern _X_EXPORT Bool
-xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
- int x, int y);
+
+xf86CrtcSetMode(xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ int x, int y);
extern _X_EXPORT void
-xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y);
+ xf86CrtcSetOrigin(xf86CrtcPtr crtc, int x, int y);
/*
* Assign crtc rotation during mode set
*/
extern _X_EXPORT Bool
-xf86CrtcRotate (xf86CrtcPtr crtc);
+ xf86CrtcRotate(xf86CrtcPtr crtc);
/*
* Clean up any rotation data, used when a crtc is turned off
* as well as when rotation is disabled.
*/
extern _X_EXPORT void
-xf86RotateDestroy (xf86CrtcPtr crtc);
+ xf86RotateDestroy(xf86CrtcPtr crtc);
/*
* free shadow memory allocated for all crtcs
*/
extern _X_EXPORT void
-xf86RotateFreeShadow(ScrnInfoPtr pScrn);
+ xf86RotateFreeShadow(ScrnInfoPtr pScrn);
/*
* Clean up rotation during CloseScreen
*/
extern _X_EXPORT void
-xf86RotateCloseScreen (ScreenPtr pScreen);
+ xf86RotateCloseScreen(ScreenPtr pScreen);
/**
* Return whether any output is assigned to the crtc
*/
extern _X_EXPORT Bool
-xf86CrtcInUse (xf86CrtcPtr crtc);
+ xf86CrtcInUse(xf86CrtcPtr crtc);
/*
* Output functions
*/
extern _X_EXPORT xf86OutputPtr
-xf86OutputCreate (ScrnInfoPtr scrn,
- const xf86OutputFuncsRec *funcs,
- const char *name);
+xf86OutputCreate(ScrnInfoPtr scrn,
+ const xf86OutputFuncsRec * funcs, const char *name);
extern _X_EXPORT void
-xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor);
+ xf86OutputUseScreenMonitor(xf86OutputPtr output, Bool use_screen_monitor);
extern _X_EXPORT Bool
-xf86OutputRename (xf86OutputPtr output, const char *name);
+ xf86OutputRename(xf86OutputPtr output, const char *name);
extern _X_EXPORT void
-xf86OutputDestroy (xf86OutputPtr output);
+ xf86OutputDestroy(xf86OutputPtr output);
extern _X_EXPORT void
-xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
+ xf86ProbeOutputModes(ScrnInfoPtr pScrn, int maxX, int maxY);
extern _X_EXPORT void
-xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
+ xf86SetScrnInfoModes(ScrnInfoPtr pScrn);
#ifdef RANDR_13_INTERFACE
-# define ScreenInitRetType int
+#define ScreenInitRetType int
#else
-# define ScreenInitRetType Bool
+#define ScreenInitRetType Bool
#endif
-extern _X_EXPORT ScreenInitRetType
-xf86CrtcScreenInit (ScreenPtr pScreen);
+extern _X_EXPORT ScreenInitRetType xf86CrtcScreenInit(ScreenPtr pScreen);
extern _X_EXPORT Bool
-xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
+ xf86InitialConfiguration(ScrnInfoPtr pScrn, Bool canGrow);
extern _X_EXPORT void
-xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
-
+ xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
+
extern _X_EXPORT Bool
-xf86SaveScreen(ScreenPtr pScreen, int mode);
+ xf86SaveScreen(ScreenPtr pScreen, int mode);
extern _X_EXPORT void
-xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
+ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
extern _X_EXPORT DisplayModePtr
-xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired);
-
+xf86OutputFindClosestMode(xf86OutputPtr output, DisplayModePtr desired);
+
extern _X_EXPORT Bool
-xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
+
+xf86SetSingleMode(ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
/**
* Set the EDID information for the specified output
*/
extern _X_EXPORT void
-xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
+ xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon);
/**
* Return the list of modes supported by the EDID information
* stored in 'output'
*/
-extern _X_EXPORT DisplayModePtr
-xf86OutputGetEDIDModes (xf86OutputPtr output);
+extern _X_EXPORT DisplayModePtr xf86OutputGetEDIDModes(xf86OutputPtr output);
extern _X_EXPORT xf86MonPtr
-xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
+xf86OutputGetEDID(xf86OutputPtr output, I2CBusPtr pDDCBus);
/**
* Initialize dga for this screen
@@ -871,23 +855,23 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
#ifdef XFreeXDGA
extern _X_EXPORT Bool
-xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
+ xf86DiDGAInit(ScreenPtr pScreen, unsigned long dga_address);
/* this is the real function, used only internally */
_X_INTERNAL Bool
-_xf86_di_dga_init_internal (ScreenPtr pScreen);
+ _xf86_di_dga_init_internal(ScreenPtr pScreen);
/**
* Re-initialize dga for this screen (as when the set of modes changes)
*/
extern _X_EXPORT Bool
-xf86DiDGAReInit (ScreenPtr pScreen);
+ xf86DiDGAReInit(ScreenPtr pScreen);
#endif
/* This is the real function, used only internally */
_X_INTERNAL Bool
-_xf86_di_dga_reinit_internal (ScreenPtr pScreen);
+ _xf86_di_dga_reinit_internal(ScreenPtr pScreen);
/*
* Set the subpixel order reported for the screen using
@@ -895,13 +879,12 @@ _xf86_di_dga_reinit_internal (ScreenPtr pScreen);
*/
extern _X_EXPORT void
-xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
+ xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen);
/*
* Get a standard string name for a connector type
*/
-extern _X_EXPORT const char *
-xf86ConnectorGetName(xf86ConnectorType connector);
+extern _X_EXPORT const char *xf86ConnectorGetName(xf86ConnectorType connector);
/*
* Using the desired mode information in each crtc, set
@@ -909,7 +892,7 @@ xf86ConnectorGetName(xf86ConnectorType connector);
*/
extern _X_EXPORT Bool
-xf86SetDesiredModes (ScrnInfoPtr pScrn);
+ xf86SetDesiredModes(ScrnInfoPtr pScrn);
/**
* Initialize the CRTC-based cursor code. CRTC function vectors must
@@ -918,7 +901,7 @@ xf86SetDesiredModes (ScrnInfoPtr pScrn);
* Driver should call this from ScreenInit function
*/
extern _X_EXPORT Bool
-xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags);
+ xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags);
/**
* Called when anything on the screen is reconfigured.
@@ -928,25 +911,25 @@ xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags);
* Driver should call this from crtc commit function.
*/
extern _X_EXPORT void
-xf86_reload_cursors (ScreenPtr screen);
+ xf86_reload_cursors(ScreenPtr screen);
/**
* Called from EnterVT to turn the cursors back on
*/
extern _X_EXPORT void
-xf86_show_cursors (ScrnInfoPtr scrn);
+ xf86_show_cursors(ScrnInfoPtr scrn);
/**
* Called by the driver to turn cursors off
*/
extern _X_EXPORT void
-xf86_hide_cursors (ScrnInfoPtr scrn);
+ xf86_hide_cursors(ScrnInfoPtr scrn);
/**
* Clean up CRTC-based cursor code. Driver must call this at CloseScreen time.
*/
extern _X_EXPORT void
-xf86_cursors_fini (ScreenPtr screen);
+ xf86_cursors_fini(ScreenPtr screen);
/**
* Transform the cursor's coordinates based on the crtc transform. Normally
@@ -954,7 +937,7 @@ xf86_cursors_fini (ScreenPtr screen);
* then the server does not transform the cursor position automatically.
*/
extern _X_EXPORT void
-xf86CrtcTransformCursorPos (xf86CrtcPtr crtc, int *x, int *y);
+ xf86CrtcTransformCursorPos(xf86CrtcPtr crtc, int *x, int *y);
#ifdef XV
/*
@@ -964,33 +947,32 @@ xf86CrtcTransformCursorPos (xf86CrtcPtr crtc, int *x, int *y);
*/
extern _X_EXPORT Bool
+
xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
- xf86CrtcPtr *crtc_ret,
- xf86CrtcPtr desired_crtc,
- BoxPtr dst,
- INT32 *xa,
- INT32 *xb,
- INT32 *ya,
- INT32 *yb,
- RegionPtr reg,
- INT32 width,
- INT32 height);
+ xf86CrtcPtr * crtc_ret,
+ xf86CrtcPtr desired_crtc,
+ BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb,
+ RegionPtr reg, INT32 width, INT32 height);
#endif
-
+
extern _X_EXPORT xf86_crtc_notify_proc_ptr
-xf86_wrap_crtc_notify (ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new);
+xf86_wrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new);
extern _X_EXPORT void
-xf86_unwrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr old);
+ xf86_unwrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr old);
extern _X_EXPORT void
-xf86_crtc_notify(ScreenPtr pScreen);
+ xf86_crtc_notify(ScreenPtr pScreen);
/**
* Gamma
*/
extern _X_EXPORT Bool
-xf86_crtc_supports_gamma(ScrnInfoPtr pScrn);
+ xf86_crtc_supports_gamma(ScrnInfoPtr pScrn);
-#endif /* _XF86CRTC_H_ */
+#endif /* _XF86CRTC_H_ */
diff --git a/xorg-server/hw/xfree86/modes/xf86Cursors.c b/xorg-server/hw/xfree86/modes/xf86Cursors.c
index 669da0d5b..95a78921d 100644
--- a/xorg-server/hw/xfree86/modes/xf86Cursors.c
+++ b/xorg-server/hw/xfree86/modes/xf86Cursors.c
@@ -52,10 +52,10 @@
* that it's handling the screen transform, then this returns RR_Rotate_0.
*/
static Rotation
-xf86_crtc_cursor_rotation (xf86CrtcPtr crtc)
+xf86_crtc_cursor_rotation(xf86CrtcPtr crtc)
{
if (crtc->driverIsPerformingTransform)
- return RR_Rotate_0;
+ return RR_Rotate_0;
return crtc->rotation;
}
@@ -63,38 +63,34 @@ xf86_crtc_cursor_rotation (xf86CrtcPtr crtc)
* Given a screen coordinate, rotate back to a cursor source coordinate
*/
static void
-xf86_crtc_rotate_coord (Rotation rotation,
- int width,
- int height,
- int x_dst,
- int y_dst,
- int *x_src,
- int *y_src)
+xf86_crtc_rotate_coord(Rotation rotation,
+ int width,
+ int height, int x_dst, int y_dst, int *x_src, int *y_src)
{
int t;
-
+
switch (rotation & 0xf) {
case RR_Rotate_0:
- break;
+ break;
case RR_Rotate_90:
- t = x_dst;
- x_dst = height - y_dst - 1;
- y_dst = t;
- break;
+ t = x_dst;
+ x_dst = height - y_dst - 1;
+ y_dst = t;
+ break;
case RR_Rotate_180:
- x_dst = width - x_dst - 1;
- y_dst = height - y_dst - 1;
- break;
+ x_dst = width - x_dst - 1;
+ y_dst = height - y_dst - 1;
+ break;
case RR_Rotate_270:
- t = x_dst;
- x_dst = y_dst;
- y_dst = width - t - 1;
- break;
+ t = x_dst;
+ x_dst = y_dst;
+ y_dst = width - t - 1;
+ break;
}
if (rotation & RR_Reflect_X)
- x_dst = width - x_dst - 1;
+ x_dst = width - x_dst - 1;
if (rotation & RR_Reflect_Y)
- y_dst = height - y_dst - 1;
+ y_dst = height - y_dst - 1;
*x_src = x_dst;
*y_src = y_dst;
}
@@ -103,38 +99,35 @@ xf86_crtc_rotate_coord (Rotation rotation,
* Given a cursor source coordinate, rotate to a screen coordinate
*/
static void
-xf86_crtc_rotate_coord_back (Rotation rotation,
- int width,
- int height,
- int x_dst,
- int y_dst,
- int *x_src,
- int *y_src)
+xf86_crtc_rotate_coord_back(Rotation rotation,
+ int width,
+ int height,
+ int x_dst, int y_dst, int *x_src, int *y_src)
{
int t;
-
+
if (rotation & RR_Reflect_X)
- x_dst = width - x_dst - 1;
+ x_dst = width - x_dst - 1;
if (rotation & RR_Reflect_Y)
- y_dst = height - y_dst - 1;
+ y_dst = height - y_dst - 1;
switch (rotation & 0xf) {
case RR_Rotate_0:
- break;
+ break;
case RR_Rotate_90:
- t = x_dst;
- x_dst = y_dst;
- y_dst = width - t - 1;
- break;
+ t = x_dst;
+ x_dst = y_dst;
+ y_dst = width - t - 1;
+ break;
case RR_Rotate_180:
- x_dst = width - x_dst - 1;
- y_dst = height - y_dst - 1;
- break;
+ x_dst = width - x_dst - 1;
+ y_dst = height - y_dst - 1;
+ break;
case RR_Rotate_270:
- t = x_dst;
- x_dst = height - y_dst - 1;
- y_dst = t;
- break;
+ t = x_dst;
+ x_dst = height - y_dst - 1;
+ y_dst = t;
+ break;
}
*x_src = x_dst;
*y_src = y_dst;
@@ -149,16 +142,16 @@ struct cursor_bit {
* Convert an x coordinate to a position within the cursor bitmap
*/
static struct cursor_bit
-cursor_bitpos (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y,
- Bool mask)
+cursor_bitpos(CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y,
+ Bool mask)
{
const int flags = cursor_info->Flags;
const Bool interleaved =
- !!(flags & (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 |
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 |
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 |
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64));
+ ! !(flags & (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64));
const int width = cursor_info->MaxWidth;
const int height = cursor_info->MaxHeight;
const int stride = interleaved ? width / 4 : width / 8;
@@ -168,24 +161,24 @@ cursor_bitpos (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y,
image += y * stride;
if (flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK)
- mask = !mask;
+ mask = !mask;
if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED)
- x = (x & ~3) | (3 - (x & 3));
+ x = (x & ~3) | (3 - (x & 3));
if (((flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) == 0) ==
- (X_BYTE_ORDER == X_BIG_ENDIAN))
- x = (x & ~7) | (7 - (x & 7));
+ (X_BYTE_ORDER == X_BIG_ENDIAN))
+ x = (x & ~7) | (7 - (x & 7));
if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1)
- x = (x << 1) + mask;
+ x = (x << 1) + mask;
else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8)
- x = ((x & ~7) << 1) | (mask << 3) | (x & 7);
+ x = ((x & ~7) << 1) | (mask << 3) | (x & 7);
else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16)
- x = ((x & ~15) << 1) | (mask << 4) | (x & 15);
+ x = ((x & ~15) << 1) | (mask << 4) | (x & 15);
else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32)
- x = ((x & ~31) << 1) | (mask << 5) | (x & 31);
+ x = ((x & ~31) << 1) | (mask << 5) | (x & 31);
else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64)
- x = ((x & ~63) << 1) | (mask << 6) | (x & 63);
+ x = ((x & ~63) << 1) | (mask << 6) | (x & 63);
else if (mask)
- image += stride * height;
+ image += stride * height;
ret.byte = image + (x / 8);
ret.bitpos = x & 7;
@@ -197,9 +190,10 @@ cursor_bitpos (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y,
* Fetch one bit from a cursor bitmap
*/
static CARD8
-get_bit (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
+get_bit(CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
{
struct cursor_bit bit = cursor_bitpos(image, cursor_info, x, y, mask);
+
return (*bit.byte >> bit.bitpos) & 1;
}
@@ -207,185 +201,177 @@ get_bit (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
* Set one bit in a cursor bitmap
*/
static void
-set_bit (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
+set_bit(CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
{
struct cursor_bit bit = cursor_bitpos(image, cursor_info, x, y, mask);
+
*bit.byte |= 1 << bit.bitpos;
}
-
+
/*
* Load a two color cursor into a driver that supports only ARGB cursors
*/
static void
-xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src)
+xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src)
{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
- CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
- int x, y;
- int xin, yin;
- int flags = cursor_info->Flags;
- CARD32 bits;
- const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
+ int x, y;
+ int xin, yin;
+ int flags = cursor_info->Flags;
+ CARD32 bits;
+ const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
#ifdef ARGB_CURSOR
crtc->cursor_argb = FALSE;
#endif
for (y = 0; y < cursor_info->MaxHeight; y++)
- for (x = 0; x < cursor_info->MaxWidth; x++)
- {
- xf86_crtc_rotate_coord (rotation,
- cursor_info->MaxWidth,
- cursor_info->MaxHeight,
- x, y, &xin, &yin);
- if (get_bit (src, cursor_info, xin, yin, TRUE) ==
- ((flags & HARDWARE_CURSOR_INVERT_MASK) == 0))
- {
- if (get_bit (src, cursor_info, xin, yin, FALSE))
- bits = xf86_config->cursor_fg;
- else
- bits = xf86_config->cursor_bg;
- }
- else
- bits = 0;
- cursor_image[y * cursor_info->MaxWidth + x] = bits;
- }
- crtc->funcs->load_cursor_argb (crtc, cursor_image);
+ for (x = 0; x < cursor_info->MaxWidth; x++) {
+ xf86_crtc_rotate_coord(rotation,
+ cursor_info->MaxWidth,
+ cursor_info->MaxHeight, x, y, &xin, &yin);
+ if (get_bit(src, cursor_info, xin, yin, TRUE) ==
+ ((flags & HARDWARE_CURSOR_INVERT_MASK) == 0)) {
+ if (get_bit(src, cursor_info, xin, yin, FALSE))
+ bits = xf86_config->cursor_fg;
+ else
+ bits = xf86_config->cursor_bg;
+ }
+ else
+ bits = 0;
+ cursor_image[y * cursor_info->MaxWidth + x] = bits;
+ }
+ crtc->funcs->load_cursor_argb(crtc, cursor_image);
}
/*
* Set the colors for a two-color cursor (ignore for ARGB cursors)
*/
static void
-xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
+xf86_set_cursor_colors(ScrnInfoPtr scrn, int bg, int fg)
{
- ScreenPtr screen = scrn->pScreen;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- CursorPtr cursor = xf86_config->cursor;
- int c;
- CARD8 *bits = cursor ?
+ ScreenPtr screen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ CursorPtr cursor = xf86_config->cursor;
+ int c;
+ CARD8 *bits = cursor ?
dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey, screen)
- : NULL;
+ : NULL;
/* Save ARGB versions of these colors */
xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
xf86_config->cursor_bg = (CARD32) bg | 0xff000000;
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->enabled && !crtc->cursor_argb)
- {
- if (crtc->funcs->load_cursor_image)
- crtc->funcs->set_cursor_colors (crtc, bg, fg);
- else if (bits)
- xf86_crtc_convert_cursor_to_argb (crtc, bits);
- }
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled && !crtc->cursor_argb) {
+ if (crtc->funcs->load_cursor_image)
+ crtc->funcs->set_cursor_colors(crtc, bg, fg);
+ else if (bits)
+ xf86_crtc_convert_cursor_to_argb(crtc, bits);
+ }
}
}
static void
-xf86_crtc_hide_cursor (xf86CrtcPtr crtc)
+xf86_crtc_hide_cursor(xf86CrtcPtr crtc)
{
- if (crtc->cursor_shown)
- {
- crtc->funcs->hide_cursor (crtc);
- crtc->cursor_shown = FALSE;
+ if (crtc->cursor_shown) {
+ crtc->funcs->hide_cursor(crtc);
+ crtc->cursor_shown = FALSE;
}
}
void
-xf86_hide_cursors (ScrnInfoPtr scrn)
+xf86_hide_cursors(ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
xf86_config->cursor_on = FALSE;
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
- if (crtc->enabled)
- xf86_crtc_hide_cursor (crtc);
+ if (crtc->enabled)
+ xf86_crtc_hide_cursor(crtc);
}
}
-
+
static void
-xf86_crtc_show_cursor (xf86CrtcPtr crtc)
+xf86_crtc_show_cursor(xf86CrtcPtr crtc)
{
- if (!crtc->cursor_shown && crtc->cursor_in_range)
- {
- crtc->funcs->show_cursor (crtc);
- crtc->cursor_shown = TRUE;
+ if (!crtc->cursor_shown && crtc->cursor_in_range) {
+ crtc->funcs->show_cursor(crtc);
+ crtc->cursor_shown = TRUE;
}
}
void
-xf86_show_cursors (ScrnInfoPtr scrn)
+xf86_show_cursors(ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
xf86_config->cursor_on = TRUE;
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
- if (crtc->enabled)
- xf86_crtc_show_cursor (crtc);
+ if (crtc->enabled)
+ xf86_crtc_show_cursor(crtc);
}
}
-void xf86CrtcTransformCursorPos (xf86CrtcPtr crtc, int *x, int *y)
+void
+xf86CrtcTransformCursorPos(xf86CrtcPtr crtc, int *x, int *y)
{
ScrnInfoPtr scrn = crtc->scrn;
ScreenPtr screen = scrn->pScreen;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
xf86CursorScreenPtr ScreenPriv =
- (xf86CursorScreenPtr)dixLookupPrivate(&screen->devPrivates,
- xf86CursorScreenKey);
+ (xf86CursorScreenPtr) dixLookupPrivate(&screen->devPrivates,
+ xf86CursorScreenKey);
struct pict_f_vector v;
int dx, dy;
v.v[0] = (*x + ScreenPriv->HotX) + 0.5;
v.v[1] = (*y + ScreenPriv->HotY) + 0.5;
v.v[2] = 1;
- pixman_f_transform_point (&crtc->f_framebuffer_to_crtc, &v);
+ pixman_f_transform_point(&crtc->f_framebuffer_to_crtc, &v);
/* cursor will have 0.5 added to it already so floor is sufficent */
- *x = floor (v.v[0]);
- *y = floor (v.v[1]);
+ *x = floor(v.v[0]);
+ *y = floor(v.v[1]);
/*
* Transform position of cursor upper left corner
*/
- xf86_crtc_rotate_coord_back (crtc->rotation, cursor_info->MaxWidth,
- cursor_info->MaxHeight, ScreenPriv->HotX,
- ScreenPriv->HotY, &dx, &dy);
+ xf86_crtc_rotate_coord_back(crtc->rotation, cursor_info->MaxWidth,
+ cursor_info->MaxHeight, ScreenPriv->HotX,
+ ScreenPriv->HotY, &dx, &dy);
*x -= dx;
*y -= dy;
}
static void
-xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
+xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
- DisplayModePtr mode = &crtc->mode;
- Bool in_range;
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ DisplayModePtr mode = &crtc->mode;
+ Bool in_range;
/*
* Transform position of cursor on screen
*/
if (crtc->transform_in_use && !crtc->driverIsPerformingTransform)
- xf86CrtcTransformCursorPos(crtc, &x, &y);
- else
- {
- x -= crtc->x;
- y -= crtc->y;
+ xf86CrtcTransformCursorPos(crtc, &x, &y);
+ else {
+ x -= crtc->x;
+ y -= crtc->y;
}
/*
@@ -393,216 +379,206 @@ xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
*/
in_range = TRUE;
if (x >= mode->HDisplay || y >= mode->VDisplay ||
- x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight)
- {
- in_range = FALSE;
- x = 0;
- y = 0;
+ x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight) {
+ in_range = FALSE;
+ x = 0;
+ y = 0;
}
crtc->cursor_in_range = in_range;
-
- if (in_range)
- {
- crtc->funcs->set_cursor_position (crtc, x, y);
- xf86_crtc_show_cursor (crtc);
+
+ if (in_range) {
+ crtc->funcs->set_cursor_position(crtc, x, y);
+ xf86_crtc_show_cursor(crtc);
}
else
- xf86_crtc_hide_cursor (crtc);
+ xf86_crtc_hide_cursor(crtc);
}
static void
-xf86_set_cursor_position (ScrnInfoPtr scrn, int x, int y)
+xf86_set_cursor_position(ScrnInfoPtr scrn, int x, int y)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
/* undo what xf86HWCurs did to the coordinates */
x += scrn->frameX0;
y += scrn->frameY0;
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
- if (crtc->enabled)
- xf86_crtc_set_cursor_position (crtc, x, y);
+ if (crtc->enabled)
+ xf86_crtc_set_cursor_position(crtc, x, y);
}
}
-
+
/*
* Load a two-color cursor into a crtc, performing rotation as needed
*/
static void
-xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src)
+xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
- CARD8 *cursor_image;
- const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD8 *cursor_image;
+ const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
#ifdef ARGB_CURSOR
crtc->cursor_argb = FALSE;
#endif
if (rotation == RR_Rotate_0)
- cursor_image = src;
- else
- {
+ cursor_image = src;
+ else {
int x, y;
- int xin, yin;
- int stride = cursor_info->MaxWidth >> 2;
-
- cursor_image = xf86_config->cursor_image;
- memset(cursor_image, 0, cursor_info->MaxHeight * stride);
-
+ int xin, yin;
+ int stride = cursor_info->MaxWidth >> 2;
+
+ cursor_image = xf86_config->cursor_image;
+ memset(cursor_image, 0, cursor_info->MaxHeight * stride);
+
for (y = 0; y < cursor_info->MaxHeight; y++)
- for (x = 0; x < cursor_info->MaxWidth; x++)
- {
- xf86_crtc_rotate_coord (rotation,
- cursor_info->MaxWidth,
- cursor_info->MaxHeight,
- x, y, &xin, &yin);
- if (get_bit(src, cursor_info, xin, yin, FALSE))
- set_bit(cursor_image, cursor_info, x, y, FALSE);
- if (get_bit(src, cursor_info, xin, yin, TRUE))
- set_bit(cursor_image, cursor_info, x, y, TRUE);
- }
+ for (x = 0; x < cursor_info->MaxWidth; x++) {
+ xf86_crtc_rotate_coord(rotation,
+ cursor_info->MaxWidth,
+ cursor_info->MaxHeight,
+ x, y, &xin, &yin);
+ if (get_bit(src, cursor_info, xin, yin, FALSE))
+ set_bit(cursor_image, cursor_info, x, y, FALSE);
+ if (get_bit(src, cursor_info, xin, yin, TRUE))
+ set_bit(cursor_image, cursor_info, x, y, TRUE);
+ }
}
- crtc->funcs->load_cursor_image (crtc, cursor_image);
+ crtc->funcs->load_cursor_image(crtc, cursor_image);
}
-
+
/*
* Load a cursor image into all active CRTCs
*/
static void
-xf86_load_cursor_image (ScrnInfoPtr scrn, unsigned char *src)
+xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->enabled)
- {
- if (crtc->funcs->load_cursor_image)
- xf86_crtc_load_cursor_image (crtc, src);
- else if (crtc->funcs->load_cursor_argb)
- xf86_crtc_convert_cursor_to_argb (crtc, src);
- }
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled) {
+ if (crtc->funcs->load_cursor_image)
+ xf86_crtc_load_cursor_image(crtc, src);
+ else if (crtc->funcs->load_cursor_argb)
+ xf86_crtc_convert_cursor_to_argb(crtc, src);
+ }
}
}
static Bool
-xf86_use_hw_cursor (ScreenPtr screen, CursorPtr cursor)
+xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
++cursor->refcnt;
if (xf86_config->cursor)
- FreeCursor (xf86_config->cursor, None);
+ FreeCursor(xf86_config->cursor, None);
xf86_config->cursor = cursor;
if (cursor->bits->width > cursor_info->MaxWidth ||
- cursor->bits->height> cursor_info->MaxHeight)
- return FALSE;
+ cursor->bits->height > cursor_info->MaxHeight)
+ return FALSE;
return TRUE;
}
static Bool
-xf86_use_hw_cursor_argb (ScreenPtr screen, CursorPtr cursor)
+xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
-
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+
++cursor->refcnt;
if (xf86_config->cursor)
- FreeCursor (xf86_config->cursor, None);
+ FreeCursor(xf86_config->cursor, None);
xf86_config->cursor = cursor;
-
+
/* Make sure ARGB support is available */
if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
- return FALSE;
-
+ return FALSE;
+
if (cursor->bits->width > cursor_info->MaxWidth ||
- cursor->bits->height> cursor_info->MaxHeight)
- return FALSE;
+ cursor->bits->height > cursor_info->MaxHeight)
+ return FALSE;
return TRUE;
}
static void
-xf86_crtc_load_cursor_argb (xf86CrtcPtr crtc, CursorPtr cursor)
+xf86_crtc_load_cursor_argb(xf86CrtcPtr crtc, CursorPtr cursor)
{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
- CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
- CARD32 *cursor_source = (CARD32 *) cursor->bits->argb;
- int x, y;
- int xin, yin;
- CARD32 bits;
- int source_width = cursor->bits->width;
- int source_height = cursor->bits->height;
- int image_width = cursor_info->MaxWidth;
- int image_height = cursor_info->MaxHeight;
- const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
+ CARD32 *cursor_source = (CARD32 *) cursor->bits->argb;
+ int x, y;
+ int xin, yin;
+ CARD32 bits;
+ int source_width = cursor->bits->width;
+ int source_height = cursor->bits->height;
+ int image_width = cursor_info->MaxWidth;
+ int image_height = cursor_info->MaxHeight;
+ const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
for (y = 0; y < image_height; y++)
- for (x = 0; x < image_width; x++)
- {
- xf86_crtc_rotate_coord (rotation, image_width, image_height, x, y,
- &xin, &yin);
- if (xin < source_width && yin < source_height)
- bits = cursor_source[yin * source_width + xin];
- else
- bits = 0;
- cursor_image[y * image_width + x] = bits;
- }
-
- crtc->funcs->load_cursor_argb (crtc, cursor_image);
+ for (x = 0; x < image_width; x++) {
+ xf86_crtc_rotate_coord(rotation, image_width, image_height, x, y,
+ &xin, &yin);
+ if (xin < source_width && yin < source_height)
+ bits = cursor_source[yin * source_width + xin];
+ else
+ bits = 0;
+ cursor_image[y * image_width + x] = bits;
+ }
+
+ crtc->funcs->load_cursor_argb(crtc, cursor_image);
}
static void
-xf86_load_cursor_argb (ScrnInfoPtr scrn, CursorPtr cursor)
+xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
- if (crtc->enabled)
- xf86_crtc_load_cursor_argb (crtc, cursor);
+ if (crtc->enabled)
+ xf86_crtc_load_cursor_argb(crtc, cursor);
}
}
Bool
-xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
+xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info;
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info;
cursor_info = xf86CreateCursorInfoRec();
if (!cursor_info)
- return FALSE;
+ return FALSE;
xf86_config->cursor_image = malloc(max_width * max_height * 4);
- if (!xf86_config->cursor_image)
- {
- xf86DestroyCursorInfoRec (cursor_info);
- return FALSE;
+ if (!xf86_config->cursor_image) {
+ xf86DestroyCursorInfoRec(cursor_info);
+ return FALSE;
}
-
+
xf86_config->cursor_info = cursor_info;
cursor_info->MaxWidth = max_width;
@@ -616,17 +592,16 @@ xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
cursor_info->ShowCursor = xf86_show_cursors;
cursor_info->UseHWCursor = xf86_use_hw_cursor;
#ifdef ARGB_CURSOR
- if (flags & HARDWARE_CURSOR_ARGB)
- {
- cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb;
- cursor_info->LoadCursorARGB = xf86_load_cursor_argb;
+ if (flags & HARDWARE_CURSOR_ARGB) {
+ cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb;
+ cursor_info->LoadCursorARGB = xf86_load_cursor_argb;
}
#endif
-
+
xf86_config->cursor = NULL;
- xf86_hide_cursors (scrn);
-
- return xf86InitCursor (screen, cursor_info);
+ xf86_hide_cursors(scrn);
+
+ return xf86InitCursor(screen, cursor_info);
}
/**
@@ -636,25 +611,25 @@ xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
*/
void
-xf86_reload_cursors (ScreenPtr screen)
+xf86_reload_cursors(ScreenPtr screen)
{
- ScrnInfoPtr scrn;
- xf86CrtcConfigPtr xf86_config;
- xf86CursorInfoPtr cursor_info;
- CursorPtr cursor;
- int x, y;
+ ScrnInfoPtr scrn;
+ xf86CrtcConfigPtr xf86_config;
+ xf86CursorInfoPtr cursor_info;
+ CursorPtr cursor;
+ int x, y;
xf86CursorScreenPtr cursor_screen_priv;
-
+
/* initial mode setting will not have set a screen yet.
May be called before the devices are initialised.
*/
if (!screen || !inputInfo.pointer)
- return;
+ return;
cursor_screen_priv = dixLookupPrivate(&screen->devPrivates,
- xf86CursorScreenKey);
+ xf86CursorScreenKey);
/* return if HW cursor is inactive, to avoid displaying two cursors */
if (!cursor_screen_priv || !cursor_screen_priv->isUp)
- return;
+ return;
scrn = xf86Screens[screen->myNum];
xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -662,26 +637,27 @@ xf86_reload_cursors (ScreenPtr screen)
/* make sure the cursor code has been initialized */
cursor_info = xf86_config->cursor_info;
if (!cursor_info)
- return;
+ return;
cursor = xf86_config->cursor;
- GetSpritePosition (inputInfo.pointer, &x, &y);
+ GetSpritePosition(inputInfo.pointer, &x, &y);
if (!(cursor_info->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
- (*cursor_info->HideCursor)(scrn);
+ (*cursor_info->HideCursor) (scrn);
- if (cursor)
- {
- void *src = dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey, screen);
+ if (cursor) {
+ void *src =
+ dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey,
+ screen);
#ifdef ARGB_CURSOR
- if (cursor->bits->argb && cursor_info->LoadCursorARGB)
- (*cursor_info->LoadCursorARGB) (scrn, cursor);
- else if (src)
+ if (cursor->bits->argb && cursor_info->LoadCursorARGB)
+ (*cursor_info->LoadCursorARGB) (scrn, cursor);
+ else if (src)
#endif
- (*cursor_info->LoadCursorImage)(scrn, src);
+ (*cursor_info->LoadCursorImage) (scrn, src);
- x += scrn->frameX0 + cursor_screen_priv->HotX;
- y += scrn->frameY0 + cursor_screen_priv->HotY;
- (*cursor_info->SetCursorPosition)(scrn, x, y);
+ x += scrn->frameX0 + cursor_screen_priv->HotX;
+ y += scrn->frameY0 + cursor_screen_priv->HotY;
+ (*cursor_info->SetCursorPosition) (scrn, x, y);
}
}
@@ -689,21 +665,19 @@ xf86_reload_cursors (ScreenPtr screen)
* Clean up CRTC-based cursor code
*/
void
-xf86_cursors_fini (ScreenPtr screen)
+xf86_cursors_fini(ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-
- if (xf86_config->cursor_info)
- {
- xf86DestroyCursorInfoRec (xf86_config->cursor_info);
- xf86_config->cursor_info = NULL;
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (xf86_config->cursor_info) {
+ xf86DestroyCursorInfoRec(xf86_config->cursor_info);
+ xf86_config->cursor_info = NULL;
}
free(xf86_config->cursor_image);
xf86_config->cursor_image = NULL;
- if (xf86_config->cursor)
- {
- FreeCursor (xf86_config->cursor, None);
- xf86_config->cursor = NULL;
+ if (xf86_config->cursor) {
+ FreeCursor(xf86_config->cursor, None);
+ xf86_config->cursor = NULL;
}
}
diff --git a/xorg-server/hw/xfree86/modes/xf86DiDGA.c b/xorg-server/hw/xfree86/modes/xf86DiDGA.c
index b2bbefa62..fafd95aed 100644
--- a/xorg-server/hw/xfree86/modes/xf86DiDGA.c
+++ b/xorg-server/hw/xfree86/modes/xf86DiDGA.c
@@ -1,217 +1,214 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#else
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#endif
-
-#include "xf86.h"
-#include "xf86DDC.h"
-#include "xf86_OSproc.h"
-#include "dgaproc.h"
-#include "xf86Crtc.h"
-#include "xf86Modes.h"
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-
-static Bool
-xf86_dga_get_modes (ScreenPtr pScreen)
-{
- ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- DGAModePtr modes, mode;
- DisplayModePtr display_mode;
- int bpp = scrn->bitsPerPixel >> 3;
- int num;
-
- num = 0;
- display_mode = scrn->modes;
- while (display_mode)
- {
- num++;
- display_mode = display_mode->next;
- if (display_mode == scrn->modes)
- break;
- }
-
- if (!num)
- return FALSE;
-
- modes = malloc(num * sizeof(DGAModeRec));
- if (!modes)
- return FALSE;
-
- num = 0;
- display_mode = scrn->modes;
- while (display_mode)
- {
- mode = modes + num++;
-
- mode->mode = display_mode;
- mode->flags = DGA_CONCURRENT_ACCESS;
- if (display_mode->Flags & V_DBLSCAN)
- mode->flags |= DGA_DOUBLESCAN;
- if (display_mode->Flags & V_INTERLACE)
- mode->flags |= DGA_INTERLACED;
- mode->byteOrder = scrn->imageByteOrder;
- mode->depth = scrn->depth;
- mode->bitsPerPixel = scrn->bitsPerPixel;
- mode->red_mask = scrn->mask.red;
- mode->green_mask = scrn->mask.green;
- mode->blue_mask = scrn->mask.blue;
- mode->visualClass = (bpp == 1) ? PseudoColor : TrueColor;
- mode->viewportWidth = display_mode->HDisplay;
- mode->viewportHeight = display_mode->VDisplay;
- mode->xViewportStep = (bpp == 3) ? 2 : 1;
- mode->yViewportStep = 1;
- mode->viewportFlags = DGA_FLIP_RETRACE;
- mode->offset = 0;
- mode->address = 0;
- mode->imageWidth = mode->viewportWidth;
- mode->imageHeight = mode->viewportHeight;
- mode->bytesPerScanline = (mode->imageWidth * scrn->bitsPerPixel) >> 3;
- mode->pixmapWidth = mode->imageWidth;
- mode->pixmapHeight = mode->imageHeight;
- mode->maxViewportX = 0;
- mode->maxViewportY = 0;
-
- display_mode = display_mode->next;
- if (display_mode == scrn->modes)
- break;
- }
- free(xf86_config->dga_modes);
- xf86_config->dga_nmode = num;
- xf86_config->dga_modes = modes;
- return TRUE;
-}
-
-static Bool
-xf86_dga_set_mode(ScrnInfoPtr scrn, DGAModePtr display_mode)
-{
- ScreenPtr pScreen = scrn->pScreen;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-
- if (!display_mode)
- {
- if (xf86_config->dga_save_mode)
- {
- xf86SwitchMode(pScreen, xf86_config->dga_save_mode);
- xf86_config->dga_save_mode = NULL;
- }
- }
- else
- {
- if (!xf86_config->dga_save_mode)
- {
- xf86_config->dga_save_mode = scrn->currentMode;
- xf86SwitchMode(pScreen, display_mode->mode);
- }
- }
- return TRUE;
-}
-
-static int
-xf86_dga_get_viewport(ScrnInfoPtr scrn)
-{
- return 0;
-}
-
-static void
-xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags)
-{
- scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags);
-}
-
-static Bool
-xf86_dga_open_framebuffer(ScrnInfoPtr scrn,
- char **name,
- unsigned char **mem, int *size, int *offset, int *flags)
-{
- return FALSE;
-}
-
-static void
-xf86_dga_close_framebuffer(ScrnInfoPtr scrn)
-{
-}
-
-static DGAFunctionRec xf86_dga_funcs = {
- xf86_dga_open_framebuffer,
- xf86_dga_close_framebuffer,
- xf86_dga_set_mode,
- xf86_dga_set_viewport,
- xf86_dga_get_viewport,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-Bool
-xf86DiDGAReInit (ScreenPtr pScreen)
-{
- return TRUE;
-}
-
-Bool
-_xf86_di_dga_reinit_internal (ScreenPtr pScreen)
-{
- ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-
- if (!DGAAvailable(pScreen->myNum))
- return TRUE;
-
- if (!xf86_dga_get_modes (pScreen))
- return FALSE;
-
- return DGAReInitModes (pScreen, xf86_config->dga_modes, xf86_config->dga_nmode);
-}
-
-Bool
-xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address)
-{
- return TRUE;
-}
-
-Bool
-_xf86_di_dga_init_internal (ScreenPtr pScreen)
-{
- ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-
- xf86_config->dga_flags = 0;
- xf86_config->dga_address = 0;
- xf86_config->dga_width = 0;
- xf86_config->dga_height = 0;
- xf86_config->dga_stride = 0;
-
- if (!xf86_dga_get_modes (pScreen))
- return FALSE;
-
- return DGAInit(pScreen, &xf86_dga_funcs, xf86_config->dga_modes, xf86_config->dga_nmode);
-}
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "xf86_OSproc.h"
+#include "dgaproc.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+static Bool
+xf86_dga_get_modes(ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ DGAModePtr modes, mode;
+ DisplayModePtr display_mode;
+ int bpp = scrn->bitsPerPixel >> 3;
+ int num;
+
+ num = 0;
+ display_mode = scrn->modes;
+ while (display_mode) {
+ num++;
+ display_mode = display_mode->next;
+ if (display_mode == scrn->modes)
+ break;
+ }
+
+ if (!num)
+ return FALSE;
+
+ modes = malloc(num * sizeof(DGAModeRec));
+ if (!modes)
+ return FALSE;
+
+ num = 0;
+ display_mode = scrn->modes;
+ while (display_mode) {
+ mode = modes + num++;
+
+ mode->mode = display_mode;
+ mode->flags = DGA_CONCURRENT_ACCESS;
+ if (display_mode->Flags & V_DBLSCAN)
+ mode->flags |= DGA_DOUBLESCAN;
+ if (display_mode->Flags & V_INTERLACE)
+ mode->flags |= DGA_INTERLACED;
+ mode->byteOrder = scrn->imageByteOrder;
+ mode->depth = scrn->depth;
+ mode->bitsPerPixel = scrn->bitsPerPixel;
+ mode->red_mask = scrn->mask.red;
+ mode->green_mask = scrn->mask.green;
+ mode->blue_mask = scrn->mask.blue;
+ mode->visualClass = (bpp == 1) ? PseudoColor : TrueColor;
+ mode->viewportWidth = display_mode->HDisplay;
+ mode->viewportHeight = display_mode->VDisplay;
+ mode->xViewportStep = (bpp == 3) ? 2 : 1;
+ mode->yViewportStep = 1;
+ mode->viewportFlags = DGA_FLIP_RETRACE;
+ mode->offset = 0;
+ mode->address = 0;
+ mode->imageWidth = mode->viewportWidth;
+ mode->imageHeight = mode->viewportHeight;
+ mode->bytesPerScanline = (mode->imageWidth * scrn->bitsPerPixel) >> 3;
+ mode->pixmapWidth = mode->imageWidth;
+ mode->pixmapHeight = mode->imageHeight;
+ mode->maxViewportX = 0;
+ mode->maxViewportY = 0;
+
+ display_mode = display_mode->next;
+ if (display_mode == scrn->modes)
+ break;
+ }
+ free(xf86_config->dga_modes);
+ xf86_config->dga_nmode = num;
+ xf86_config->dga_modes = modes;
+ return TRUE;
+}
+
+static Bool
+xf86_dga_set_mode(ScrnInfoPtr scrn, DGAModePtr display_mode)
+{
+ ScreenPtr pScreen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (!display_mode) {
+ if (xf86_config->dga_save_mode) {
+ xf86SwitchMode(pScreen, xf86_config->dga_save_mode);
+ xf86_config->dga_save_mode = NULL;
+ }
+ }
+ else {
+ if (!xf86_config->dga_save_mode) {
+ xf86_config->dga_save_mode = scrn->currentMode;
+ xf86SwitchMode(pScreen, display_mode->mode);
+ }
+ }
+ return TRUE;
+}
+
+static int
+xf86_dga_get_viewport(ScrnInfoPtr scrn)
+{
+ return 0;
+}
+
+static void
+xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags)
+{
+ scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags);
+}
+
+static Bool
+xf86_dga_open_framebuffer(ScrnInfoPtr scrn,
+ char **name,
+ unsigned char **mem, int *size, int *offset,
+ int *flags)
+{
+ return FALSE;
+}
+
+static void
+xf86_dga_close_framebuffer(ScrnInfoPtr scrn)
+{
+}
+
+static DGAFunctionRec xf86_dga_funcs = {
+ xf86_dga_open_framebuffer,
+ xf86_dga_close_framebuffer,
+ xf86_dga_set_mode,
+ xf86_dga_set_viewport,
+ xf86_dga_get_viewport,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+Bool
+xf86DiDGAReInit(ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+Bool
+_xf86_di_dga_reinit_internal(ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (!DGAAvailable(pScreen->myNum))
+ return TRUE;
+
+ if (!xf86_dga_get_modes(pScreen))
+ return FALSE;
+
+ return DGAReInitModes(pScreen, xf86_config->dga_modes,
+ xf86_config->dga_nmode);
+}
+
+Bool
+xf86DiDGAInit(ScreenPtr pScreen, unsigned long dga_address)
+{
+ return TRUE;
+}
+
+Bool
+_xf86_di_dga_init_internal(ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ xf86_config->dga_flags = 0;
+ xf86_config->dga_address = 0;
+ xf86_config->dga_width = 0;
+ xf86_config->dga_height = 0;
+ xf86_config->dga_stride = 0;
+
+ if (!xf86_dga_get_modes(pScreen))
+ return FALSE;
+
+ return DGAInit(pScreen, &xf86_dga_funcs, xf86_config->dga_modes,
+ xf86_config->dga_nmode);
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c b/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c
index d507e3b14..781c806bc 100644
--- a/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c
+++ b/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c
@@ -1,437 +1,452 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software")
- * to deal in the software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * them Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Adam Jackson <ajax@redhat.com>
- */
-
-#include "xorg-config.h"
-#include "xf86.h"
-#include "xf86str.h"
-#include "edid.h"
-#include "xf86DDC.h"
-
-typedef void (*did_proc)(int scrnIndex, unsigned char *data, void *closure);
-
-#define DID_PRODUCT_ID 0x00
-#define DID_DISPLAY_PARAMETERS 0x01
-#define DID_COLOR_INFO 0x02
-#define DID_TIMING_1_DETAILED 0x03
-#define DID_TIMING_2_DETAILED 0x04
-#define DID_TIMING_3_SHORT 0x05
-#define DID_TIMING_4_DMT 0x06
-#define DID_TIMING_VESA 0x07
-#define DID_TIMING_CEA 0x08
-#define DID_TIMING_RANGE_LIMITS 0x09
-#define DID_PRODUCT_SERIAL 0x0A
-#define DID_ASCII_STRING 0x0B
-#define DID_DISPLAY_DEVICE 0x0C
-#define DID_POWER_SEQUENCING 0x0D
-#define DID_TRANSFER_INFO 0x0E
-#define DID_DISPLAY_INTERFACE 0x0F
-#define DID_STEREO 0x10
-#define DID_VENDOR 0x7F
-
-#define extract_le16(x, i) ((x[i+1] << 8) + (x[i]))
-#define extract_le24(x, i) ((x[i+2] << 16) + (x[i+1] << 8) + (x[i]))
-
-static DisplayModePtr
-modeCalloc(void)
-{
- return calloc(1, sizeof(DisplayModeRec));
-}
-
-/*
- * How awesome is it to have two detailed timing formats, neither of which
- * are compatible with the format in EDID? So awesome.
- */
-
-static void
-didDetailedTiming1(int i, unsigned char *x, MonPtr mon)
-{
- DisplayModePtr m = modeCalloc();
-
- if (!m)
- return;
-
- m->Clock = extract_le24(x, 0);
-
- m->HDisplay = extract_le16(x, 4);
- m->HSyncStart = m->HDisplay + (extract_le16(x, 8) & 0x7f);
- m->HSyncEnd = m->HSyncStart + extract_le16(x, 10);
- m->HTotal = m->HDisplay + extract_le16(x, 6);
- m->Flags |= (x[9] & 0x80) ? V_PHSYNC : V_NHSYNC;
-
- m->VDisplay = extract_le16(x, 12);
- m->VSyncStart = m->VDisplay + (extract_le16(x, 16) & 0x7f);
- m->VSyncEnd = m->VSyncStart + extract_le16(x, 18);
- m->VTotal = m->VDisplay + extract_le16(x, 14);
- m->Flags |= (x[17] & 0x80) ? V_PVSYNC : V_NVSYNC;
-
- m->type = M_T_DRIVER;
- if (x[3] & 0x80)
- m->type |= M_T_PREFERRED;
-
- /* XXX double check handling of this */
- if (x[3] & 0x10)
- m->Flags |= V_INTERLACE;
-
- mon->Modes = xf86ModesAdd(mon->Modes, m);
-}
-
-/* XXX no sync bits. what to do? */
-static void
-didDetailedTiming2(int i, unsigned char *x, MonPtr mon)
-{
- DisplayModePtr mode = modeCalloc();
-
- if (!mode)
- return;
-
- mode->Clock = extract_le24(x, 0);
-
- /* horiz sizes are in character cells, not pixels, hence * 8 */
- mode->HDisplay = ((extract_le16(x, 4) & 0x01ff) + 1) * 8;
- mode->HSyncStart = mode->HDisplay + (((x[6] & 0xf0) >> 4) + 1) * 8;
- mode->HSyncEnd = mode->HSyncStart + ((x[6] & 0x0f) + 1) * 8;
- mode->HTotal = mode->HDisplay + ((x[5] >> 1) + 1) * 8;
-
- mode->VDisplay = extract_le16(x, 7) & 0x07ff;
- mode->VSyncStart = mode->VDisplay + (x[10] >> 4) + 1;
- mode->VSyncEnd = mode->VSyncStart + (x[10] & 0x0f) + 1;
- mode->VTotal = mode->VDisplay + x[9];
-
- mode->status = M_T_DRIVER;
- if (x[3] & 0x80)
- mode->status |= M_T_PREFERRED;
-
- /* XXX double check handling of this */
- if (x[3] & 0x10)
- mode->Flags |= V_INTERLACE;
-
- mon->Modes = xf86ModesAdd(mon->Modes, mode);
-}
-
-static void
-didShortTiming(int i, unsigned char *x, MonPtr mon)
-{
- DisplayModePtr m;
- int w, h, r;
-
- w = (x[1] + 1) * 8;
- switch (x[0] & 0x0f) {
- case 0:
- h = w;
- break;
- case 1:
- h = (w * 4) / 5;
- break;
- case 2:
- h = (w * 3) / 4;
- break;
- case 3:
- h = (w * 9) / 15;
- break;
- case 4:
- h = (w * 9) / 16;
- break;
- case 5:
- h = (w * 10) / 16;
- break;
- default:
- return;
- }
- r = (x[2] & 0x7f) + 1;
-
- m = xf86CVTMode(w, h, r, !!(x[0] & 0x10), !!(x[2] & 0x80));
-
- m->type = M_T_DRIVER;
- if (x[0] & 0x80)
- m->type |= M_T_PREFERRED;
-
- mon->Modes = xf86ModesAdd(mon->Modes, m);
-}
-
-static void
-didDMTTiming(int i, unsigned char *x, void *closure)
-{
- MonPtr mon = closure;
-
- mon->Modes = xf86ModesAdd(mon->Modes,
- xf86DuplicateMode(DMTModes + *x));
-}
-
-#define RB 1
-#define INT 2
-static const struct did_dmt {
- short w, h, r, f;
-} did_dmt[] = {
- /* byte 3 */
- { 640, 350, 85, 0 },
- { 640, 400, 85, 0 },
- { 720, 400, 85, 0 },
- { 640, 480, 60, 0 },
- { 640, 480, 72, 0 },
- { 640, 480, 75, 0 },
- { 640, 480, 85, 0 },
- { 800, 600, 56, 0 },
- /* byte 4 */
- { 800, 600, 60, 0 },
- { 800, 600, 72, 0 },
- { 800, 600, 75, 0 },
- { 800, 600, 85, 0 },
- { 800, 600, 120, RB },
- { 848, 480, 60, 0 },
- { 1024, 768, 43, INT },
- { 1024, 768, 60, 0 },
- /* byte 5 */
- { 1024, 768, 70, 0 },
- { 1024, 768, 75, 0 },
- { 1024, 768, 85, 0 },
- { 1024, 768, 120, RB },
- { 1152, 864, 75, 0 },
- { 1280, 768, 60, RB },
- { 1280, 768, 60, 0 },
- { 1280, 768, 75, 0 },
- /* byte 6 */
- { 1280, 768, 85, 0 },
- { 1280, 768, 120, RB },
- { 1280, 800, 60, RB },
- { 1280, 800, 60, 0 },
- { 1280, 800, 75, 0 },
- { 1280, 800, 85, 0 },
- { 1280, 800, 120, RB },
- { 1280, 960, 60, 0 },
- /* byte 7 */
- { 1280, 960, 85, 0 },
- { 1280, 960, 120, RB },
- { 1280, 1024, 60, 0 },
- { 1280, 1024, 75, 0 },
- { 1280, 1024, 85, 0 },
- { 1280, 1024, 120, RB },
- { 1360, 768, 60, 0 },
- { 1360, 768, 120, RB },
- /* byte 8 */
- { 1400, 1050, 60, RB },
- { 1400, 1050, 60, 0 },
- { 1400, 1050, 75, 0 },
- { 1400, 1050, 85, 0 },
- { 1400, 1050, 120, RB },
- { 1440, 900, 60, RB },
- { 1440, 900, 60, 0 },
- { 1440, 900, 75, 0 },
- /* byte 9 */
- { 1440, 900, 85, 0 },
- { 1440, 900, 120, RB },
- { 1600, 1200, 60, 0 },
- { 1600, 1200, 65, 0 },
- { 1600, 1200, 70, 0 },
- { 1600, 1200, 75, 0 },
- { 1600, 1200, 85, 0 },
- { 1600, 1200, 120, RB },
- /* byte a */
- { 1680, 1050, 60, RB },
- { 1680, 1050, 60, 0 },
- { 1680, 1050, 75, 0 },
- { 1680, 1050, 85, 0 },
- { 1680, 1050, 120, RB },
- { 1792, 1344, 60, 0 },
- { 1792, 1344, 75, 0 },
- { 1792, 1344, 120, RB },
- /* byte b */
- { 1856, 1392, 60, 0 },
- { 1856, 1392, 75, 0 },
- { 1856, 1392, 120, RB },
- { 1920, 1200, 60, RB },
- { 1920, 1200, 60, 0 },
- { 1920, 1200, 75, 0 },
- { 1920, 1200, 85, 0 },
- { 1920, 1200, 120, RB },
- /* byte c */
- { 1920, 1440, 60, 0 },
- { 1920, 1440, 75, 0 },
- { 1920, 1440, 120, RB },
- { 2560, 1600, 60, RB },
- { 2560, 1600, 60, 0 },
- { 2560, 1600, 75, 0 },
- { 2560, 1600, 85, 0 },
- { 2560, 1600, 120, RB },
-};
-
-static void
-didVesaTiming(int scrn, unsigned char *x, MonPtr mon)
-{
- int i, j;
-
- x += 3;
-
- for (i = 0; i < 10; i++)
- for (j = 0; j < 8; j++)
- if (x[i] & (1 << j)) {
- const struct did_dmt *d = &(did_dmt[i * 8 + j]);
- if (d->f == INT)
- continue;
- mon->Modes = xf86ModesAdd(mon->Modes,
- FindDMTMode(d->w, d->h, d->r,
- d->f == RB));
- }
-
-}
-
-static void
-handleDisplayIDBlock(int scrnIndex, unsigned char *x, void *closure)
-{
- MonPtr mon = closure;
-
- switch (x[0]) {
- case DID_DISPLAY_PARAMETERS:
- /* w/h are in decimillimeters */
- mon->widthmm = (extract_le16(x, 3) + 5) / 10;
- mon->heightmm = (extract_le16(x, 5) + 5) / 10;
- /* XXX pixel count, feature flags, gamma, aspect, color depth */
- break;
-
- case DID_TIMING_RANGE_LIMITS:
- {
- int n;
-
- mon->maxPixClock = max(mon->maxPixClock, extract_le24(x, 6) * 10);
-
- n = mon->nHsync++;
- if (n < MAX_HSYNC) {
- mon->hsync[n].lo = x[9];
- mon->hsync[n].hi = x[10];
- } else {
- n = MAX_HSYNC;
- }
- n = mon->nVrefresh++;
- if (n < MAX_VREFRESH) {
- mon->vrefresh[n].lo = x[13];
- mon->vrefresh[n].hi = x[14];
- } else {
- n = MAX_VREFRESH;
- }
- break;
- }
-
- case DID_TIMING_1_DETAILED:
- {
- int i;
- for (i = 0; i < x[2]; i += 20)
- didDetailedTiming1(scrnIndex, x + i + 3, mon);
- break;
- }
-
- case DID_TIMING_2_DETAILED:
- {
- int i;
- for (i = 0; i < x[2]; i += 11)
- didDetailedTiming2(scrnIndex, x + i + 3, mon);
- break;
- }
-
- case DID_TIMING_3_SHORT:
- {
- int i;
- for (i = 0; i < x[2]; i += 3)
- didShortTiming(scrnIndex, x + i + 3, mon);
- break;
- }
-
- case DID_TIMING_4_DMT:
- {
- int i;
- for (i = 0; i < x[2]; i++)
- didDMTTiming(scrnIndex, x + i + 3, mon);
- break;
- }
-
- case DID_TIMING_VESA:
- didVesaTiming(scrnIndex, x, mon);
- break;
-
- /* XXX pixel format, ar, orientation, subpixel, dot pitch, bit depth */
- case DID_DISPLAY_DEVICE:
-
- /* XXX interface, links, color encoding, ss, drm */
- case DID_DISPLAY_INTERFACE:
-
- /* XXX stereo */
- case DID_STEREO:
-
- /* nothing interesting in these */
- case DID_COLOR_INFO:
- case DID_PRODUCT_SERIAL:
- case DID_ASCII_STRING:
- case DID_POWER_SEQUENCING:
- case DID_TRANSFER_INFO:
- case DID_VENDOR:
- break;
-
- /* warn about anything else */
- default:
- xf86DrvMsg(scrnIndex, X_WARNING,
- "Unknown DisplayID block type %hx\n", x[0]);
- break;
- }
-}
-
-static void
-forEachDisplayIDBlock(int scrnIndex, unsigned char *did, did_proc proc,
- void *closure)
-{
- int num_extensions = did[3];
- int section_size = did[1];
- unsigned char *block;
-
- do {
- if ((did[0] & 0xf0) != 0x10) /* not 1.x, abort */
- return;
- /* XXX also, checksum */
-
- block = did + 4;
-
- while (section_size > 0) {
- int block_size = (block[2] + 2);
-
- proc(scrnIndex, block, closure);
-
- section_size -= block_size;
- block += block_size;
- }
-
- did += (did[1] + 5);
- } while (num_extensions--);
-}
-
-/*
- * Fill out MonPtr with xf86MonPtr information.
- */
-void
-xf86DisplayIDMonitorSet(int scrnIndex, MonPtr mon, xf86MonPtr DDC)
-{
- if (!mon || !DDC)
- return;
-
- mon->DDC = DDC;
-
- forEachDisplayIDBlock(scrnIndex, DDC->rawData, handleDisplayIDBlock, mon);
-}
+/*
+ * Copyright 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software")
+ * to deal in the software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * them Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Adam Jackson <ajax@redhat.com>
+ */
+
+#include "xorg-config.h"
+#include "xf86.h"
+#include "xf86str.h"
+#include "edid.h"
+#include "xf86DDC.h"
+
+typedef void (*did_proc) (int scrnIndex, unsigned char *data, void *closure);
+
+#define DID_PRODUCT_ID 0x00
+#define DID_DISPLAY_PARAMETERS 0x01
+#define DID_COLOR_INFO 0x02
+#define DID_TIMING_1_DETAILED 0x03
+#define DID_TIMING_2_DETAILED 0x04
+#define DID_TIMING_3_SHORT 0x05
+#define DID_TIMING_4_DMT 0x06
+#define DID_TIMING_VESA 0x07
+#define DID_TIMING_CEA 0x08
+#define DID_TIMING_RANGE_LIMITS 0x09
+#define DID_PRODUCT_SERIAL 0x0A
+#define DID_ASCII_STRING 0x0B
+#define DID_DISPLAY_DEVICE 0x0C
+#define DID_POWER_SEQUENCING 0x0D
+#define DID_TRANSFER_INFO 0x0E
+#define DID_DISPLAY_INTERFACE 0x0F
+#define DID_STEREO 0x10
+#define DID_VENDOR 0x7F
+
+#define extract_le16(x, i) ((x[i+1] << 8) + (x[i]))
+#define extract_le24(x, i) ((x[i+2] << 16) + (x[i+1] << 8) + (x[i]))
+
+static DisplayModePtr
+modeCalloc(void)
+{
+ return calloc(1, sizeof(DisplayModeRec));
+}
+
+/*
+ * How awesome is it to have two detailed timing formats, neither of which
+ * are compatible with the format in EDID? So awesome.
+ */
+
+static void
+didDetailedTiming1(int i, unsigned char *x, MonPtr mon)
+{
+ DisplayModePtr m = modeCalloc();
+
+ if (!m)
+ return;
+
+ m->Clock = extract_le24(x, 0);
+
+ m->HDisplay = extract_le16(x, 4);
+ m->HSyncStart = m->HDisplay + (extract_le16(x, 8) & 0x7f);
+ m->HSyncEnd = m->HSyncStart + extract_le16(x, 10);
+ m->HTotal = m->HDisplay + extract_le16(x, 6);
+ m->Flags |= (x[9] & 0x80) ? V_PHSYNC : V_NHSYNC;
+
+ m->VDisplay = extract_le16(x, 12);
+ m->VSyncStart = m->VDisplay + (extract_le16(x, 16) & 0x7f);
+ m->VSyncEnd = m->VSyncStart + extract_le16(x, 18);
+ m->VTotal = m->VDisplay + extract_le16(x, 14);
+ m->Flags |= (x[17] & 0x80) ? V_PVSYNC : V_NVSYNC;
+
+ m->type = M_T_DRIVER;
+ if (x[3] & 0x80)
+ m->type |= M_T_PREFERRED;
+
+ /* XXX double check handling of this */
+ if (x[3] & 0x10)
+ m->Flags |= V_INTERLACE;
+
+ mon->Modes = xf86ModesAdd(mon->Modes, m);
+}
+
+/* XXX no sync bits. what to do? */
+static void
+didDetailedTiming2(int i, unsigned char *x, MonPtr mon)
+{
+ DisplayModePtr mode = modeCalloc();
+
+ if (!mode)
+ return;
+
+ mode->Clock = extract_le24(x, 0);
+
+ /* horiz sizes are in character cells, not pixels, hence * 8 */
+ mode->HDisplay = ((extract_le16(x, 4) & 0x01ff) + 1) * 8;
+ mode->HSyncStart = mode->HDisplay + (((x[6] & 0xf0) >> 4) + 1) * 8;
+ mode->HSyncEnd = mode->HSyncStart + ((x[6] & 0x0f) + 1) * 8;
+ mode->HTotal = mode->HDisplay + ((x[5] >> 1) + 1) * 8;
+
+ mode->VDisplay = extract_le16(x, 7) & 0x07ff;
+ mode->VSyncStart = mode->VDisplay + (x[10] >> 4) + 1;
+ mode->VSyncEnd = mode->VSyncStart + (x[10] & 0x0f) + 1;
+ mode->VTotal = mode->VDisplay + x[9];
+
+ mode->status = M_T_DRIVER;
+ if (x[3] & 0x80)
+ mode->status |= M_T_PREFERRED;
+
+ /* XXX double check handling of this */
+ if (x[3] & 0x10)
+ mode->Flags |= V_INTERLACE;
+
+ mon->Modes = xf86ModesAdd(mon->Modes, mode);
+}
+
+static void
+didShortTiming(int i, unsigned char *x, MonPtr mon)
+{
+ DisplayModePtr m;
+ int w, h, r;
+
+ w = (x[1] + 1) * 8;
+ switch (x[0] & 0x0f) {
+ case 0:
+ h = w;
+ break;
+ case 1:
+ h = (w * 4) / 5;
+ break;
+ case 2:
+ h = (w * 3) / 4;
+ break;
+ case 3:
+ h = (w * 9) / 15;
+ break;
+ case 4:
+ h = (w * 9) / 16;
+ break;
+ case 5:
+ h = (w * 10) / 16;
+ break;
+ default:
+ return;
+ }
+ r = (x[2] & 0x7f) + 1;
+
+ m = xf86CVTMode(w, h, r, ! !(x[0] & 0x10), ! !(x[2] & 0x80));
+
+ m->type = M_T_DRIVER;
+ if (x[0] & 0x80)
+ m->type |= M_T_PREFERRED;
+
+ mon->Modes = xf86ModesAdd(mon->Modes, m);
+}
+
+static void
+didDMTTiming(int i, unsigned char *x, void *closure)
+{
+ MonPtr mon = closure;
+
+ mon->Modes = xf86ModesAdd(mon->Modes, xf86DuplicateMode(DMTModes + *x));
+}
+
+#define RB 1
+#define INT 2
+static const struct did_dmt {
+ short w, h, r, f;
+} did_dmt[] = {
+ /* byte 3 */
+ {
+ 640, 350, 85, 0}, {
+ 640, 400, 85, 0}, {
+ 720, 400, 85, 0}, {
+ 640, 480, 60, 0}, {
+ 640, 480, 72, 0}, {
+ 640, 480, 75, 0}, {
+ 640, 480, 85, 0}, {
+ 800, 600, 56, 0},
+ /* byte 4 */
+ {
+ 800, 600, 60, 0}, {
+ 800, 600, 72, 0}, {
+ 800, 600, 75, 0}, {
+ 800, 600, 85, 0}, {
+ 800, 600, 120, RB}, {
+ 848, 480, 60, 0}, {
+ 1024, 768, 43, INT}, {
+ 1024, 768, 60, 0},
+ /* byte 5 */
+ {
+ 1024, 768, 70, 0}, {
+ 1024, 768, 75, 0}, {
+ 1024, 768, 85, 0}, {
+ 1024, 768, 120, RB}, {
+ 1152, 864, 75, 0}, {
+ 1280, 768, 60, RB}, {
+ 1280, 768, 60, 0}, {
+ 1280, 768, 75, 0},
+ /* byte 6 */
+ {
+ 1280, 768, 85, 0}, {
+ 1280, 768, 120, RB}, {
+ 1280, 800, 60, RB}, {
+ 1280, 800, 60, 0}, {
+ 1280, 800, 75, 0}, {
+ 1280, 800, 85, 0}, {
+ 1280, 800, 120, RB}, {
+ 1280, 960, 60, 0},
+ /* byte 7 */
+ {
+ 1280, 960, 85, 0}, {
+ 1280, 960, 120, RB}, {
+ 1280, 1024, 60, 0}, {
+ 1280, 1024, 75, 0}, {
+ 1280, 1024, 85, 0}, {
+ 1280, 1024, 120, RB}, {
+ 1360, 768, 60, 0}, {
+ 1360, 768, 120, RB},
+ /* byte 8 */
+ {
+ 1400, 1050, 60, RB}, {
+ 1400, 1050, 60, 0}, {
+ 1400, 1050, 75, 0}, {
+ 1400, 1050, 85, 0}, {
+ 1400, 1050, 120, RB}, {
+ 1440, 900, 60, RB}, {
+ 1440, 900, 60, 0}, {
+ 1440, 900, 75, 0},
+ /* byte 9 */
+ {
+ 1440, 900, 85, 0}, {
+ 1440, 900, 120, RB}, {
+ 1600, 1200, 60, 0}, {
+ 1600, 1200, 65, 0}, {
+ 1600, 1200, 70, 0}, {
+ 1600, 1200, 75, 0}, {
+ 1600, 1200, 85, 0}, {
+ 1600, 1200, 120, RB},
+ /* byte a */
+ {
+ 1680, 1050, 60, RB}, {
+ 1680, 1050, 60, 0}, {
+ 1680, 1050, 75, 0}, {
+ 1680, 1050, 85, 0}, {
+ 1680, 1050, 120, RB}, {
+ 1792, 1344, 60, 0}, {
+ 1792, 1344, 75, 0}, {
+ 1792, 1344, 120, RB},
+ /* byte b */
+ {
+ 1856, 1392, 60, 0}, {
+ 1856, 1392, 75, 0}, {
+ 1856, 1392, 120, RB}, {
+ 1920, 1200, 60, RB}, {
+ 1920, 1200, 60, 0}, {
+ 1920, 1200, 75, 0}, {
+ 1920, 1200, 85, 0}, {
+ 1920, 1200, 120, RB},
+ /* byte c */
+ {
+ 1920, 1440, 60, 0}, {
+ 1920, 1440, 75, 0}, {
+ 1920, 1440, 120, RB}, {
+ 2560, 1600, 60, RB}, {
+ 2560, 1600, 60, 0}, {
+ 2560, 1600, 75, 0}, {
+ 2560, 1600, 85, 0}, {
+2560, 1600, 120, RB},};
+
+static void
+didVesaTiming(int scrn, unsigned char *x, MonPtr mon)
+{
+ int i, j;
+
+ x += 3;
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 8; j++)
+ if (x[i] & (1 << j)) {
+ const struct did_dmt *d = &(did_dmt[i * 8 + j]);
+
+ if (d->f == INT)
+ continue;
+ mon->Modes = xf86ModesAdd(mon->Modes,
+ FindDMTMode(d->w, d->h, d->r,
+ d->f == RB));
+ }
+
+}
+
+static void
+handleDisplayIDBlock(int scrnIndex, unsigned char *x, void *closure)
+{
+ MonPtr mon = closure;
+
+ switch (x[0]) {
+ case DID_DISPLAY_PARAMETERS:
+ /* w/h are in decimillimeters */
+ mon->widthmm = (extract_le16(x, 3) + 5) / 10;
+ mon->heightmm = (extract_le16(x, 5) + 5) / 10;
+ /* XXX pixel count, feature flags, gamma, aspect, color depth */
+ break;
+
+ case DID_TIMING_RANGE_LIMITS:
+ {
+ int n;
+
+ mon->maxPixClock = max(mon->maxPixClock, extract_le24(x, 6) * 10);
+
+ n = mon->nHsync++;
+ if (n < MAX_HSYNC) {
+ mon->hsync[n].lo = x[9];
+ mon->hsync[n].hi = x[10];
+ }
+ else {
+ n = MAX_HSYNC;
+ }
+ n = mon->nVrefresh++;
+ if (n < MAX_VREFRESH) {
+ mon->vrefresh[n].lo = x[13];
+ mon->vrefresh[n].hi = x[14];
+ }
+ else {
+ n = MAX_VREFRESH;
+ }
+ break;
+ }
+
+ case DID_TIMING_1_DETAILED:
+ {
+ int i;
+
+ for (i = 0; i < x[2]; i += 20)
+ didDetailedTiming1(scrnIndex, x + i + 3, mon);
+ break;
+ }
+
+ case DID_TIMING_2_DETAILED:
+ {
+ int i;
+
+ for (i = 0; i < x[2]; i += 11)
+ didDetailedTiming2(scrnIndex, x + i + 3, mon);
+ break;
+ }
+
+ case DID_TIMING_3_SHORT:
+ {
+ int i;
+
+ for (i = 0; i < x[2]; i += 3)
+ didShortTiming(scrnIndex, x + i + 3, mon);
+ break;
+ }
+
+ case DID_TIMING_4_DMT:
+ {
+ int i;
+
+ for (i = 0; i < x[2]; i++)
+ didDMTTiming(scrnIndex, x + i + 3, mon);
+ break;
+ }
+
+ case DID_TIMING_VESA:
+ didVesaTiming(scrnIndex, x, mon);
+ break;
+
+ /* XXX pixel format, ar, orientation, subpixel, dot pitch, bit depth */
+ case DID_DISPLAY_DEVICE:
+
+ /* XXX interface, links, color encoding, ss, drm */
+ case DID_DISPLAY_INTERFACE:
+
+ /* XXX stereo */
+ case DID_STEREO:
+
+ /* nothing interesting in these */
+ case DID_COLOR_INFO:
+ case DID_PRODUCT_SERIAL:
+ case DID_ASCII_STRING:
+ case DID_POWER_SEQUENCING:
+ case DID_TRANSFER_INFO:
+ case DID_VENDOR:
+ break;
+
+ /* warn about anything else */
+ default:
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Unknown DisplayID block type %hx\n", x[0]);
+ break;
+ }
+}
+
+static void
+forEachDisplayIDBlock(int scrnIndex, unsigned char *did, did_proc proc,
+ void *closure)
+{
+ int num_extensions = did[3];
+ int section_size = did[1];
+ unsigned char *block;
+
+ do {
+ if ((did[0] & 0xf0) != 0x10) /* not 1.x, abort */
+ return;
+ /* XXX also, checksum */
+
+ block = did + 4;
+
+ while (section_size > 0) {
+ int block_size = (block[2] + 2);
+
+ proc(scrnIndex, block, closure);
+
+ section_size -= block_size;
+ block += block_size;
+ }
+
+ did += (did[1] + 5);
+ } while (num_extensions--);
+}
+
+/*
+ * Fill out MonPtr with xf86MonPtr information.
+ */
+void
+xf86DisplayIDMonitorSet(int scrnIndex, MonPtr mon, xf86MonPtr DDC)
+{
+ if (!mon || !DDC)
+ return;
+
+ mon->DDC = DDC;
+
+ forEachDisplayIDBlock(scrnIndex, DDC->rawData, handleDisplayIDBlock, mon);
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86EdidModes.c b/xorg-server/hw/xfree86/modes/xf86EdidModes.c
index 0100d2a59..8aa82d114 100644
--- a/xorg-server/hw/xfree86/modes/xf86EdidModes.c
+++ b/xorg-server/hw/xfree86/modes/xf86EdidModes.c
@@ -45,12 +45,12 @@
#include <string.h>
#include <math.h>
-static void handle_detailed_rblank(struct detailed_monitor_section *det_mon,
- void *data)
+static void
+handle_detailed_rblank(struct detailed_monitor_section *det_mon, void *data)
{
if (det_mon->type == DS_RANGES)
if (det_mon->section.ranges.supported_blanking & CVT_REDUCED)
- *(Bool*)data = TRUE;
+ *(Bool *) data = TRUE;
}
static Bool
@@ -71,209 +71,189 @@ xf86MonitorSupportsReducedBlanking(xf86MonPtr DDC)
return FALSE;
}
-static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
+static Bool
+quirk_prefer_large_60(int scrnIndex, xf86MonPtr DDC)
{
/* Belinea 10 15 55 */
- if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
- ((DDC->vendor.prod_id == 1516) ||
- (DDC->vendor.prod_id == 0x77e)))
- return TRUE;
-
+ if (memcmp(DDC->vendor.name, "MAX", 4) == 0 &&
+ ((DDC->vendor.prod_id == 1516) || (DDC->vendor.prod_id == 0x77e)))
+ return TRUE;
+
/* Acer AL1706 */
- if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
- DDC->vendor.prod_id == 44358)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "ACR", 4) == 0 && DDC->vendor.prod_id == 44358)
+ return TRUE;
/* Bug #10814: Samsung SyncMaster 225BW */
- if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
- DDC->vendor.prod_id == 596)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "SAM", 4) == 0 && DDC->vendor.prod_id == 596)
+ return TRUE;
/* Bug #10545: Samsung SyncMaster 226BW */
- if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
- DDC->vendor.prod_id == 638)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "SAM", 4) == 0 && DDC->vendor.prod_id == 638)
+ return TRUE;
/* Acer F51 */
- if (memcmp (DDC->vendor.name, "API", 4) == 0 &&
- DDC->vendor.prod_id == 0x7602)
- return TRUE;
-
+ if (memcmp(DDC->vendor.name, "API", 4) == 0 &&
+ DDC->vendor.prod_id == 0x7602)
+ return TRUE;
return FALSE;
}
-static Bool quirk_prefer_large_75 (int scrnIndex, xf86MonPtr DDC)
+static Bool
+quirk_prefer_large_75(int scrnIndex, xf86MonPtr DDC)
{
/* Bug #11603: Funai Electronics PM36B */
- if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
- DDC->vendor.prod_id == 13600)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "FCM", 4) == 0 && DDC->vendor.prod_id == 13600)
+ return TRUE;
return FALSE;
}
-static Bool quirk_detailed_h_in_cm (int scrnIndex, xf86MonPtr DDC)
+static Bool
+quirk_detailed_h_in_cm(int scrnIndex, xf86MonPtr DDC)
{
/* Bug #11603: Funai Electronics PM36B */
- if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
- DDC->vendor.prod_id == 13600)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "FCM", 4) == 0 && DDC->vendor.prod_id == 13600)
+ return TRUE;
return FALSE;
}
-static Bool quirk_detailed_v_in_cm (int scrnIndex, xf86MonPtr DDC)
+static Bool
+quirk_detailed_v_in_cm(int scrnIndex, xf86MonPtr DDC)
{
/* Bug #11603: Funai Electronics PM36B */
- if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
- DDC->vendor.prod_id == 13600)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "FCM", 4) == 0 && DDC->vendor.prod_id == 13600)
+ return TRUE;
/* Bug #21000: LGPhilipsLCD LP154W01-TLAJ */
- if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
- DDC->vendor.prod_id == 47360)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "LPL", 4) == 0 && DDC->vendor.prod_id == 47360)
+ return TRUE;
/* Bug #10304: LGPhilipsLCD LP154W01-A5 */
- if (memcmp(DDC->vendor.name, "LPL", 4) == 0 &&
- DDC->vendor.prod_id == 0)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "LPL", 4) == 0 && DDC->vendor.prod_id == 0)
+ return TRUE;
/* Bug #24482: LGPhilipsLCD LP154W01-TLA1 */
if (memcmp(DDC->vendor.name, "LPL", 4) == 0 &&
- DDC->vendor.prod_id == 0x2a00)
- return TRUE;
+ DDC->vendor.prod_id == 0x2a00)
+ return TRUE;
/* Bug #28414: HP Compaq NC8430 LP154W01-TLA8 */
- if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
- DDC->vendor.prod_id == 5750)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "LPL", 4) == 0 && DDC->vendor.prod_id == 5750)
+ return TRUE;
/* Bug #21750: Samsung Syncmaster 2333HD */
- if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
- DDC->vendor.prod_id == 1157)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "SAM", 4) == 0 && DDC->vendor.prod_id == 1157)
+ return TRUE;
return FALSE;
}
-static Bool quirk_detailed_use_maximum_size (int scrnIndex, xf86MonPtr DDC)
+static Bool
+quirk_detailed_use_maximum_size(int scrnIndex, xf86MonPtr DDC)
{
/* Bug #21324: Iiyama Vision Master 450 */
- if (memcmp (DDC->vendor.name, "IVM", 4) == 0 &&
- DDC->vendor.prod_id == 6400)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "IVM", 4) == 0 && DDC->vendor.prod_id == 6400)
+ return TRUE;
/* Bug #41141: Acer Aspire One */
- if (memcmp (DDC->vendor.name, "LGD", 4) == 0 &&
- DDC->vendor.prod_id == 0x7f01)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "LGD", 4) == 0 &&
+ DDC->vendor.prod_id == 0x7f01)
+ return TRUE;
return FALSE;
}
-static Bool quirk_135_clock_too_high (int scrnIndex, xf86MonPtr DDC)
+static Bool
+quirk_135_clock_too_high(int scrnIndex, xf86MonPtr DDC)
{
/* Envision Peripherals, Inc. EN-7100e. See bug #9550. */
- if (memcmp (DDC->vendor.name, "EPI", 4) == 0 &&
- DDC->vendor.prod_id == 59264)
- return TRUE;
-
+ if (memcmp(DDC->vendor.name, "EPI", 4) == 0 && DDC->vendor.prod_id == 59264)
+ return TRUE;
+
return FALSE;
}
-static Bool quirk_first_detailed_preferred (int scrnIndex, xf86MonPtr DDC)
+static Bool
+quirk_first_detailed_preferred(int scrnIndex, xf86MonPtr DDC)
{
/* Philips 107p5 CRT. Reported on xorg@ with pastebin. */
- if (memcmp (DDC->vendor.name, "PHL", 4) == 0 &&
- DDC->vendor.prod_id == 57364)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "PHL", 4) == 0 && DDC->vendor.prod_id == 57364)
+ return TRUE;
- /* Proview AY765C 17" LCD. See bug #15160*/
- if (memcmp (DDC->vendor.name, "PTS", 4) == 0 &&
- DDC->vendor.prod_id == 765)
- return TRUE;
+ /* Proview AY765C 17" LCD. See bug #15160 */
+ if (memcmp(DDC->vendor.name, "PTS", 4) == 0 && DDC->vendor.prod_id == 765)
+ return TRUE;
/* ACR of some sort RH #284231 */
- if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
- DDC->vendor.prod_id == 2423)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "ACR", 4) == 0 && DDC->vendor.prod_id == 2423)
+ return TRUE;
/* Peacock Ergovision 19. See rh#492359 */
- if (memcmp (DDC->vendor.name, "PEA", 4) == 0 &&
- DDC->vendor.prod_id == 9003)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "PEA", 4) == 0 && DDC->vendor.prod_id == 9003)
+ return TRUE;
return FALSE;
}
-static Bool quirk_detailed_sync_pp(int scrnIndex, xf86MonPtr DDC)
+static Bool
+quirk_detailed_sync_pp(int scrnIndex, xf86MonPtr DDC)
{
/* Bug #12439: Samsung SyncMaster 205BW */
- if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
- DDC->vendor.prod_id == 541)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "SAM", 4) == 0 && DDC->vendor.prod_id == 541)
+ return TRUE;
return FALSE;
}
/* This should probably be made more generic */
-static Bool quirk_dvi_single_link(int scrnIndex, xf86MonPtr DDC)
+static Bool
+quirk_dvi_single_link(int scrnIndex, xf86MonPtr DDC)
{
/* Red Hat bug #453106: Apple 23" Cinema Display */
- if (memcmp (DDC->vendor.name, "APL", 4) == 0 &&
- DDC->vendor.prod_id == 0x921c)
- return TRUE;
+ if (memcmp(DDC->vendor.name, "APL", 4) == 0 &&
+ DDC->vendor.prod_id == 0x921c)
+ return TRUE;
return FALSE;
}
typedef struct {
- Bool (*detect) (int scrnIndex, xf86MonPtr DDC);
- ddc_quirk_t quirk;
- const char *description;
+ Bool (*detect) (int scrnIndex, xf86MonPtr DDC);
+ ddc_quirk_t quirk;
+ const char *description;
} ddc_quirk_map_t;
static const ddc_quirk_map_t ddc_quirks[] = {
{
- quirk_prefer_large_60, DDC_QUIRK_PREFER_LARGE_60,
- "Detailed timing is not preferred, use largest mode at 60Hz"
- },
+ quirk_prefer_large_60, DDC_QUIRK_PREFER_LARGE_60,
+ "Detailed timing is not preferred, use largest mode at 60Hz"},
+ {
+ quirk_135_clock_too_high, DDC_QUIRK_135_CLOCK_TOO_HIGH,
+ "Recommended 135MHz pixel clock is too high"},
{
- quirk_135_clock_too_high, DDC_QUIRK_135_CLOCK_TOO_HIGH,
- "Recommended 135MHz pixel clock is too high"
- },
+ quirk_prefer_large_75, DDC_QUIRK_PREFER_LARGE_75,
+ "Detailed timing is not preferred, use largest mode at 75Hz"},
{
- quirk_prefer_large_75, DDC_QUIRK_PREFER_LARGE_75,
- "Detailed timing is not preferred, use largest mode at 75Hz"
- },
+ quirk_detailed_h_in_cm, DDC_QUIRK_DETAILED_H_IN_CM,
+ "Detailed timings give horizontal size in cm."},
{
- quirk_detailed_h_in_cm, DDC_QUIRK_DETAILED_H_IN_CM,
- "Detailed timings give horizontal size in cm."
- },
+ quirk_detailed_v_in_cm, DDC_QUIRK_DETAILED_V_IN_CM,
+ "Detailed timings give vertical size in cm."},
{
- quirk_detailed_v_in_cm, DDC_QUIRK_DETAILED_V_IN_CM,
- "Detailed timings give vertical size in cm."
- },
+ quirk_detailed_use_maximum_size, DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE,
+ "Use maximum size instead of detailed timing sizes."},
{
- quirk_detailed_use_maximum_size, DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE,
- "Use maximum size instead of detailed timing sizes."
- },
+ quirk_first_detailed_preferred, DDC_QUIRK_FIRST_DETAILED_PREFERRED,
+ "First detailed timing was not marked as preferred."},
{
- quirk_first_detailed_preferred, DDC_QUIRK_FIRST_DETAILED_PREFERRED,
- "First detailed timing was not marked as preferred."
- },
+ quirk_detailed_sync_pp, DDC_QUIRK_DETAILED_SYNC_PP,
+ "Use +hsync +vsync for detailed timing."},
{
- quirk_detailed_sync_pp, DDC_QUIRK_DETAILED_SYNC_PP,
- "Use +hsync +vsync for detailed timing."
- },
+ quirk_dvi_single_link, DDC_QUIRK_DVI_SINGLE_LINK,
+ "Forcing maximum pixel clock to single DVI link."},
{
- quirk_dvi_single_link, DDC_QUIRK_DVI_SINGLE_LINK,
- "Forcing maximum pixel clock to single DVI link."
- },
- {
- NULL, DDC_QUIRK_NONE,
- "No known quirks"
- },
+ NULL, DDC_QUIRK_NONE,
+ "No known quirks"},
};
/*
@@ -289,28 +269,28 @@ static const ddc_quirk_map_t ddc_quirks[] = {
#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
static const DisplayModeRec DDCEstablishedModes[17] = {
- { MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
- { MODEPREFIX, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
- { MODEPREFIX, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
- { MODEPREFIX, 31500, 640, 664, 704, 832, 0, 480, 489, 492, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
- { MODEPREFIX, 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
- { MODEPREFIX, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
- { MODEPREFIX, 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
- { MODEPREFIX, 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
- { MODEPREFIX, 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
- { MODEPREFIX, 78750, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
- { MODEPREFIX, 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
- { MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
- { MODEPREFIX, 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 772, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
- { MODEPREFIX, 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
- { MODEPREFIX, 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
- { MODEPREFIX, 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
- { MODEPREFIX, 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
+ {MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@60Hz */
+ {MODEPREFIX, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@56Hz */
+ {MODEPREFIX, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@75Hz */
+ {MODEPREFIX, 31500, 640, 664, 704, 832, 0, 480, 489, 492, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@72Hz */
+ {MODEPREFIX, 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@67Hz */
+ {MODEPREFIX, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@60Hz */
+ {MODEPREFIX, 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 720x400@88Hz */
+ {MODEPREFIX, 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 720x400@70Hz */
+ {MODEPREFIX, 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x1024@75Hz */
+ {MODEPREFIX, 78750, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1024x768@75Hz */
+ {MODEPREFIX, 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 1024x768@70Hz */
+ {MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 1024x768@60Hz */
+ {MODEPREFIX, 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 772, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* 1024x768@43Hz */
+ {MODEPREFIX, 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 832x624@75Hz */
+ {MODEPREFIX, 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@75Hz */
+ {MODEPREFIX, 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@72Hz */
+ {MODEPREFIX, 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1152x864@75Hz */
};
static DisplayModePtr
DDCModesFromEstablished(int scrnIndex, struct established_timings *timing,
- ddc_quirk_t quirks)
+ ddc_quirk_t quirks)
{
DisplayModePtr Modes = NULL, Mode = NULL;
CARD32 bits = (timing->t1) | (timing->t2 << 8) |
@@ -329,86 +309,86 @@ DDCModesFromEstablished(int scrnIndex, struct established_timings *timing,
/* Autogenerated from the DMT spec */
const DisplayModeRec DMTModes[] = {
- { MODEPREFIX, 31500, 640, 672, 736, 832, 0, 350, 382, 385, 445, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x350@85Hz */
- { MODEPREFIX, 31500, 640, 672, 736, 832, 0, 400, 401, 404, 445, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 640x400@85Hz */
- { MODEPREFIX, 35500, 720, 756, 828, 936, 0, 400, 401, 404, 446, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@85Hz */
- { MODEPREFIX, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
- { MODEPREFIX, 31500, 640, 664, 704, 832, 0, 480, 489, 492, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
- { MODEPREFIX, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
- { MODEPREFIX, 36000, 640, 696, 752, 832, 0, 480, 481, 484, 509, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@85Hz */
- { MODEPREFIX, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
- { MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
- { MODEPREFIX, 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
- { MODEPREFIX, 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
- { MODEPREFIX, 56250, 800, 832, 896, 1048, 0, 600, 601, 604, 631, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@85Hz */
- { MODEPREFIX, 73250, 800, 848, 880, 960, 0, 600, 603, 607, 636, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 800x600@120Hz RB */
- { MODEPREFIX, 33750, 848, 864, 976, 1088, 0, 480, 486, 494, 517, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 848x480@60Hz */
- { MODEPREFIX, 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 772, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz (interlaced) */
- { MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
- { MODEPREFIX, 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
- { MODEPREFIX, 78750, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
- { MODEPREFIX, 94500, 1024, 1072, 1168, 1376, 0, 768, 769, 772, 808, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@85Hz */
- { MODEPREFIX, 115500, 1024, 1072, 1104, 1184, 0, 768, 771, 775, 813, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@120Hz RB */
- { MODEPREFIX, 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
- { MODEPREFIX, 68250, 1280, 1328, 1360, 1440, 0, 768, 771, 778, 790, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1280x768@60Hz RB */
- { MODEPREFIX, 79500, 1280, 1344, 1472, 1664, 0, 768, 771, 778, 798, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x768@60Hz */
- { MODEPREFIX, 102250, 1280, 1360, 1488, 1696, 0, 768, 771, 778, 805, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x768@75Hz */
- { MODEPREFIX, 117500, 1280, 1360, 1496, 1712, 0, 768, 771, 778, 809, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x768@85Hz */
- { MODEPREFIX, 140250, 1280, 1328, 1360, 1440, 0, 768, 771, 778, 813, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1280x768@120Hz RB */
- { MODEPREFIX, 71000, 1280, 1328, 1360, 1440, 0, 800, 803, 809, 823, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1280x800@60Hz RB */
- { MODEPREFIX, 83500, 1280, 1352, 1480, 1680, 0, 800, 803, 809, 831, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x800@60Hz */
- { MODEPREFIX, 106500, 1280, 1360, 1488, 1696, 0, 800, 803, 809, 838, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x800@75Hz */
- { MODEPREFIX, 122500, 1280, 1360, 1496, 1712, 0, 800, 803, 809, 843, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x800@85Hz */
- { MODEPREFIX, 146250, 1280, 1328, 1360, 1440, 0, 800, 803, 809, 847, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1280x800@120Hz RB */
- { MODEPREFIX, 108000, 1280, 1376, 1488, 1800, 0, 960, 961, 964, 1000, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x960@60Hz */
- { MODEPREFIX, 148500, 1280, 1344, 1504, 1728, 0, 960, 961, 964, 1011, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x960@85Hz */
- { MODEPREFIX, 175500, 1280, 1328, 1360, 1440, 0, 960, 963, 967, 1017, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1280x960@120Hz RB */
- { MODEPREFIX, 108000, 1280, 1328, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@60Hz */
- { MODEPREFIX, 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
- { MODEPREFIX, 157500, 1280, 1344, 1504, 1728, 0, 1024, 1025, 1028, 1072, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@85Hz */
- { MODEPREFIX, 187250, 1280, 1328, 1360, 1440, 0, 1024, 1027, 1034, 1084, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1280x1024@120Hz RB */
- { MODEPREFIX, 85500, 1360, 1424, 1536, 1792, 0, 768, 771, 777, 795, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1360x768@60Hz */
- { MODEPREFIX, 148250, 1360, 1408, 1440, 1520, 0, 768, 771, 776, 813, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1360x768@120Hz RB */
- { MODEPREFIX, 101000, 1400, 1448, 1480, 1560, 0, 1050, 1053, 1057, 1080, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1400x1050@60Hz RB */
- { MODEPREFIX, 121750, 1400, 1488, 1632, 1864, 0, 1050, 1053, 1057, 1089, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1400x1050@60Hz */
- { MODEPREFIX, 156000, 1400, 1504, 1648, 1896, 0, 1050, 1053, 1057, 1099, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1400x1050@75Hz */
- { MODEPREFIX, 179500, 1400, 1504, 1656, 1912, 0, 1050, 1053, 1057, 1105, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1400x1050@85Hz */
- { MODEPREFIX, 208000, 1400, 1448, 1480, 1560, 0, 1050, 1053, 1057, 1112, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1400x1050@120Hz RB */
- { MODEPREFIX, 88750, 1440, 1488, 1520, 1600, 0, 900, 903, 909, 926, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1440x900@60Hz RB */
- { MODEPREFIX, 106500, 1440, 1520, 1672, 1904, 0, 900, 903, 909, 934, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1440x900@60Hz */
- { MODEPREFIX, 136750, 1440, 1536, 1688, 1936, 0, 900, 903, 909, 942, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1440x900@75Hz */
- { MODEPREFIX, 157000, 1440, 1544, 1696, 1952, 0, 900, 903, 909, 948, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1440x900@85Hz */
- { MODEPREFIX, 182750, 1440, 1488, 1520, 1600, 0, 900, 903, 909, 953, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1440x900@120Hz RB */
- { MODEPREFIX, 162000, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1600x1200@60Hz */
- { MODEPREFIX, 175500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1600x1200@65Hz */
- { MODEPREFIX, 189000, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1600x1200@70Hz */
- { MODEPREFIX, 202500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1600x1200@75Hz */
- { MODEPREFIX, 229500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1600x1200@85Hz */
- { MODEPREFIX, 268250, 1600, 1648, 1680, 1760, 0, 1200, 1203, 1207, 1271, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1600x1200@120Hz RB */
- { MODEPREFIX, 119000, 1680, 1728, 1760, 1840, 0, 1050, 1053, 1059, 1080, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1680x1050@60Hz RB */
- { MODEPREFIX, 146250, 1680, 1784, 1960, 2240, 0, 1050, 1053, 1059, 1089, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1680x1050@60Hz */
- { MODEPREFIX, 187000, 1680, 1800, 1976, 2272, 0, 1050, 1053, 1059, 1099, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1680x1050@75Hz */
- { MODEPREFIX, 214750, 1680, 1808, 1984, 2288, 0, 1050, 1053, 1059, 1105, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1680x1050@85Hz */
- { MODEPREFIX, 245500, 1680, 1728, 1760, 1840, 0, 1050, 1053, 1059, 1112, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1680x1050@120Hz RB */
- { MODEPREFIX, 204750, 1792, 1920, 2120, 2448, 0, 1344, 1345, 1348, 1394, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1792x1344@60Hz */
- { MODEPREFIX, 261000, 1792, 1888, 2104, 2456, 0, 1344, 1345, 1348, 1417, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1792x1344@75Hz */
- { MODEPREFIX, 333250, 1792, 1840, 1872, 1952, 0, 1344, 1347, 1351, 1423, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1792x1344@120Hz RB */
- { MODEPREFIX, 218250, 1856, 1952, 2176, 2528, 0, 1392, 1393, 1396, 1439, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1856x1392@60Hz */
- { MODEPREFIX, 288000, 1856, 1984, 2208, 2560, 0, 1392, 1393, 1396, 1500, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1856x1392@75Hz */
- { MODEPREFIX, 356500, 1856, 1904, 1936, 2016, 0, 1392, 1395, 1399, 1474, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1856x1392@120Hz RB */
- { MODEPREFIX, 154000, 1920, 1968, 2000, 2080, 0, 1200, 1203, 1209, 1235, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1920x1200@60Hz RB */
- { MODEPREFIX, 193250, 1920, 2056, 2256, 2592, 0, 1200, 1203, 1209, 1245, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1920x1200@60Hz */
- { MODEPREFIX, 245250, 1920, 2056, 2264, 2608, 0, 1200, 1203, 1209, 1255, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1920x1200@75Hz */
- { MODEPREFIX, 281250, 1920, 2064, 2272, 2624, 0, 1200, 1203, 1209, 1262, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1920x1200@85Hz */
- { MODEPREFIX, 317000, 1920, 1968, 2000, 2080, 0, 1200, 1203, 1209, 1271, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1920x1200@120Hz RB */
- { MODEPREFIX, 234000, 1920, 2048, 2256, 2600, 0, 1440, 1441, 1444, 1500, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1920x1440@60Hz */
- { MODEPREFIX, 297000, 1920, 2064, 2288, 2640, 0, 1440, 1441, 1444, 1500, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1920x1440@75Hz */
- { MODEPREFIX, 380500, 1920, 1968, 2000, 2080, 0, 1440, 1443, 1447, 1525, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1920x1440@120Hz RB */
- { MODEPREFIX, 268500, 2560, 2608, 2640, 2720, 0, 1600, 1603, 1609, 1646, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 2560x1600@60Hz RB */
- { MODEPREFIX, 348500, 2560, 2752, 3032, 3504, 0, 1600, 1603, 1609, 1658, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 2560x1600@60Hz */
- { MODEPREFIX, 443250, 2560, 2768, 3048, 3536, 0, 1600, 1603, 1609, 1672, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 2560x1600@75Hz */
- { MODEPREFIX, 505250, 2560, 2768, 3048, 3536, 0, 1600, 1603, 1609, 1682, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 2560x1600@85Hz */
- { MODEPREFIX, 552750, 2560, 2608, 2640, 2720, 0, 1600, 1603, 1609, 1694, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 2560x1600@120Hz RB */
+ {MODEPREFIX, 31500, 640, 672, 736, 832, 0, 350, 382, 385, 445, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x350@85Hz */
+ {MODEPREFIX, 31500, 640, 672, 736, 832, 0, 400, 401, 404, 445, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 640x400@85Hz */
+ {MODEPREFIX, 35500, 720, 756, 828, 936, 0, 400, 401, 404, 446, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 720x400@85Hz */
+ {MODEPREFIX, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@60Hz */
+ {MODEPREFIX, 31500, 640, 664, 704, 832, 0, 480, 489, 492, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@72Hz */
+ {MODEPREFIX, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@75Hz */
+ {MODEPREFIX, 36000, 640, 696, 752, 832, 0, 480, 481, 484, 509, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 640x480@85Hz */
+ {MODEPREFIX, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@56Hz */
+ {MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@60Hz */
+ {MODEPREFIX, 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@72Hz */
+ {MODEPREFIX, 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@75Hz */
+ {MODEPREFIX, 56250, 800, 832, 896, 1048, 0, 600, 601, 604, 631, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 800x600@85Hz */
+ {MODEPREFIX, 73250, 800, 848, 880, 960, 0, 600, 603, 607, 636, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 800x600@120Hz RB */
+ {MODEPREFIX, 33750, 848, 864, 976, 1088, 0, 480, 486, 494, 517, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 848x480@60Hz */
+ {MODEPREFIX, 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 772, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* 1024x768@43Hz (interlaced) */
+ {MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 1024x768@60Hz */
+ {MODEPREFIX, 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* 1024x768@70Hz */
+ {MODEPREFIX, 78750, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1024x768@75Hz */
+ {MODEPREFIX, 94500, 1024, 1072, 1168, 1376, 0, 768, 769, 772, 808, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1024x768@85Hz */
+ {MODEPREFIX, 115500, 1024, 1072, 1104, 1184, 0, 768, 771, 775, 813, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1024x768@120Hz RB */
+ {MODEPREFIX, 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1152x864@75Hz */
+ {MODEPREFIX, 68250, 1280, 1328, 1360, 1440, 0, 768, 771, 778, 790, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x768@60Hz RB */
+ {MODEPREFIX, 79500, 1280, 1344, 1472, 1664, 0, 768, 771, 778, 798, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x768@60Hz */
+ {MODEPREFIX, 102250, 1280, 1360, 1488, 1696, 0, 768, 771, 778, 805, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x768@75Hz */
+ {MODEPREFIX, 117500, 1280, 1360, 1496, 1712, 0, 768, 771, 778, 809, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x768@85Hz */
+ {MODEPREFIX, 140250, 1280, 1328, 1360, 1440, 0, 768, 771, 778, 813, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x768@120Hz RB */
+ {MODEPREFIX, 71000, 1280, 1328, 1360, 1440, 0, 800, 803, 809, 823, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x800@60Hz RB */
+ {MODEPREFIX, 83500, 1280, 1352, 1480, 1680, 0, 800, 803, 809, 831, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x800@60Hz */
+ {MODEPREFIX, 106500, 1280, 1360, 1488, 1696, 0, 800, 803, 809, 838, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x800@75Hz */
+ {MODEPREFIX, 122500, 1280, 1360, 1496, 1712, 0, 800, 803, 809, 843, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x800@85Hz */
+ {MODEPREFIX, 146250, 1280, 1328, 1360, 1440, 0, 800, 803, 809, 847, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x800@120Hz RB */
+ {MODEPREFIX, 108000, 1280, 1376, 1488, 1800, 0, 960, 961, 964, 1000, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x960@60Hz */
+ {MODEPREFIX, 148500, 1280, 1344, 1504, 1728, 0, 960, 961, 964, 1011, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x960@85Hz */
+ {MODEPREFIX, 175500, 1280, 1328, 1360, 1440, 0, 960, 963, 967, 1017, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x960@120Hz RB */
+ {MODEPREFIX, 108000, 1280, 1328, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x1024@60Hz */
+ {MODEPREFIX, 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x1024@75Hz */
+ {MODEPREFIX, 157500, 1280, 1344, 1504, 1728, 0, 1024, 1025, 1028, 1072, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1280x1024@85Hz */
+ {MODEPREFIX, 187250, 1280, 1328, 1360, 1440, 0, 1024, 1027, 1034, 1084, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1280x1024@120Hz RB */
+ {MODEPREFIX, 85500, 1360, 1424, 1536, 1792, 0, 768, 771, 777, 795, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1360x768@60Hz */
+ {MODEPREFIX, 148250, 1360, 1408, 1440, 1520, 0, 768, 771, 776, 813, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1360x768@120Hz RB */
+ {MODEPREFIX, 101000, 1400, 1448, 1480, 1560, 0, 1050, 1053, 1057, 1080, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1400x1050@60Hz RB */
+ {MODEPREFIX, 121750, 1400, 1488, 1632, 1864, 0, 1050, 1053, 1057, 1089, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1400x1050@60Hz */
+ {MODEPREFIX, 156000, 1400, 1504, 1648, 1896, 0, 1050, 1053, 1057, 1099, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1400x1050@75Hz */
+ {MODEPREFIX, 179500, 1400, 1504, 1656, 1912, 0, 1050, 1053, 1057, 1105, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1400x1050@85Hz */
+ {MODEPREFIX, 208000, 1400, 1448, 1480, 1560, 0, 1050, 1053, 1057, 1112, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1400x1050@120Hz RB */
+ {MODEPREFIX, 88750, 1440, 1488, 1520, 1600, 0, 900, 903, 909, 926, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1440x900@60Hz RB */
+ {MODEPREFIX, 106500, 1440, 1520, 1672, 1904, 0, 900, 903, 909, 934, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1440x900@60Hz */
+ {MODEPREFIX, 136750, 1440, 1536, 1688, 1936, 0, 900, 903, 909, 942, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1440x900@75Hz */
+ {MODEPREFIX, 157000, 1440, 1544, 1696, 1952, 0, 900, 903, 909, 948, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1440x900@85Hz */
+ {MODEPREFIX, 182750, 1440, 1488, 1520, 1600, 0, 900, 903, 909, 953, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1440x900@120Hz RB */
+ {MODEPREFIX, 162000, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1600x1200@60Hz */
+ {MODEPREFIX, 175500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1600x1200@65Hz */
+ {MODEPREFIX, 189000, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1600x1200@70Hz */
+ {MODEPREFIX, 202500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1600x1200@75Hz */
+ {MODEPREFIX, 229500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* 1600x1200@85Hz */
+ {MODEPREFIX, 268250, 1600, 1648, 1680, 1760, 0, 1200, 1203, 1207, 1271, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1600x1200@120Hz RB */
+ {MODEPREFIX, 119000, 1680, 1728, 1760, 1840, 0, 1050, 1053, 1059, 1080, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1680x1050@60Hz RB */
+ {MODEPREFIX, 146250, 1680, 1784, 1960, 2240, 0, 1050, 1053, 1059, 1089, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1680x1050@60Hz */
+ {MODEPREFIX, 187000, 1680, 1800, 1976, 2272, 0, 1050, 1053, 1059, 1099, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1680x1050@75Hz */
+ {MODEPREFIX, 214750, 1680, 1808, 1984, 2288, 0, 1050, 1053, 1059, 1105, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1680x1050@85Hz */
+ {MODEPREFIX, 245500, 1680, 1728, 1760, 1840, 0, 1050, 1053, 1059, 1112, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1680x1050@120Hz RB */
+ {MODEPREFIX, 204750, 1792, 1920, 2120, 2448, 0, 1344, 1345, 1348, 1394, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1792x1344@60Hz */
+ {MODEPREFIX, 261000, 1792, 1888, 2104, 2456, 0, 1344, 1345, 1348, 1417, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1792x1344@75Hz */
+ {MODEPREFIX, 333250, 1792, 1840, 1872, 1952, 0, 1344, 1347, 1351, 1423, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1792x1344@120Hz RB */
+ {MODEPREFIX, 218250, 1856, 1952, 2176, 2528, 0, 1392, 1393, 1396, 1439, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1856x1392@60Hz */
+ {MODEPREFIX, 288000, 1856, 1984, 2208, 2560, 0, 1392, 1393, 1396, 1500, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1856x1392@75Hz */
+ {MODEPREFIX, 356500, 1856, 1904, 1936, 2016, 0, 1392, 1395, 1399, 1474, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1856x1392@120Hz RB */
+ {MODEPREFIX, 154000, 1920, 1968, 2000, 2080, 0, 1200, 1203, 1209, 1235, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1920x1200@60Hz RB */
+ {MODEPREFIX, 193250, 1920, 2056, 2256, 2592, 0, 1200, 1203, 1209, 1245, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1200@60Hz */
+ {MODEPREFIX, 245250, 1920, 2056, 2264, 2608, 0, 1200, 1203, 1209, 1255, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1200@75Hz */
+ {MODEPREFIX, 281250, 1920, 2064, 2272, 2624, 0, 1200, 1203, 1209, 1262, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1200@85Hz */
+ {MODEPREFIX, 317000, 1920, 1968, 2000, 2080, 0, 1200, 1203, 1209, 1271, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1920x1200@120Hz RB */
+ {MODEPREFIX, 234000, 1920, 2048, 2256, 2600, 0, 1440, 1441, 1444, 1500, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1440@60Hz */
+ {MODEPREFIX, 297000, 1920, 2064, 2288, 2640, 0, 1440, 1441, 1444, 1500, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1440@75Hz */
+ {MODEPREFIX, 380500, 1920, 1968, 2000, 2080, 0, 1440, 1443, 1447, 1525, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 1920x1440@120Hz RB */
+ {MODEPREFIX, 268500, 2560, 2608, 2640, 2720, 0, 1600, 1603, 1609, 1646, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 2560x1600@60Hz RB */
+ {MODEPREFIX, 348500, 2560, 2752, 3032, 3504, 0, 1600, 1603, 1609, 1658, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 2560x1600@60Hz */
+ {MODEPREFIX, 443250, 2560, 2768, 3048, 3536, 0, 1600, 1603, 1609, 1672, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 2560x1600@75Hz */
+ {MODEPREFIX, 505250, 2560, 2768, 3048, 3536, 0, 1600, 1603, 1609, 1682, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 2560x1600@85Hz */
+ {MODEPREFIX, 552750, 2560, 2608, 2640, 2720, 0, 1600, 1603, 1609, 1694, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, /* 2560x1600@120Hz RB */
};
#define LEVEL_DMT 0
@@ -419,18 +399,18 @@ static int
MonitorStandardTimingLevel(xf86MonPtr DDC)
{
if (DDC->ver.revision >= 2) {
- if (DDC->ver.revision >= 4 && CVT_SUPPORTED(DDC->features.msc)) {
- return LEVEL_CVT;
- }
- return LEVEL_GTF;
+ if (DDC->ver.revision >= 4 && CVT_SUPPORTED(DDC->features.msc)) {
+ return LEVEL_CVT;
+ }
+ return LEVEL_GTF;
}
return LEVEL_DMT;
}
static int
-ModeRefresh(const DisplayModeRec *mode)
+ModeRefresh(const DisplayModeRec * mode)
{
- return (int)(xf86ModeVRefresh(mode) + 0.5);
+ return (int) (xf86ModeVRefresh(mode) + 0.5);
}
/*
@@ -445,15 +425,14 @@ FindDMTMode(int hsize, int vsize, int refresh, Bool rb)
const DisplayModeRec *ret;
for (i = 0; i < sizeof(DMTModes) / sizeof(DisplayModeRec); i++) {
- ret = &DMTModes[i];
+ ret = &DMTModes[i];
- if (!rb && xf86ModeIsReduced(ret))
- continue;
+ if (!rb && xf86ModeIsReduced(ret))
+ continue;
- if (ret->HDisplay == hsize &&
- ret->VDisplay == vsize &&
- refresh == ModeRefresh(ret))
- return xf86DuplicateMode(ret);
+ if (ret->HDisplay == hsize &&
+ ret->VDisplay == vsize && refresh == ModeRefresh(ret))
+ return xf86DuplicateMode(ret);
}
return NULL;
@@ -478,42 +457,43 @@ FindDMTMode(int hsize, int vsize, int refresh, Bool rb)
*/
static DisplayModePtr
DDCModesFromStandardTiming(struct std_timings *timing, ddc_quirk_t quirks,
- int timing_level, Bool rb)
+ int timing_level, Bool rb)
{
DisplayModePtr Modes = NULL, Mode = NULL;
int i, hsize, vsize, refresh;
for (i = 0; i < STD_TIMINGS; i++) {
- hsize = timing[i].hsize;
- vsize = timing[i].vsize;
- refresh = timing[i].refresh;
-
- /* HDTV hack, because you can't say 1366 */
- if (refresh == 60 &&
- ((hsize == 1360 && vsize == 765) ||
- (hsize == 1368 && vsize == 769))) {
- Mode = xf86CVTMode(1366, 768, 60, FALSE, FALSE);
- Mode->HDisplay = 1366;
- Mode->HSyncStart--;
- Mode->HSyncEnd--;
- } else if (hsize && vsize && refresh) {
- Mode = FindDMTMode(hsize, vsize, refresh, rb);
-
- if (!Mode) {
- if (timing_level == LEVEL_CVT)
- /* pass rb here too? */
- Mode = xf86CVTMode(hsize, vsize, refresh, FALSE, FALSE);
- else if (timing_level == LEVEL_GTF)
- Mode = xf86GTFMode(hsize, vsize, refresh, FALSE, FALSE);
- }
-
- }
-
- if (Mode) {
- Mode->type = M_T_DRIVER;
- Modes = xf86ModesAdd(Modes, Mode);
- }
- Mode = NULL;
+ hsize = timing[i].hsize;
+ vsize = timing[i].vsize;
+ refresh = timing[i].refresh;
+
+ /* HDTV hack, because you can't say 1366 */
+ if (refresh == 60 &&
+ ((hsize == 1360 && vsize == 765) ||
+ (hsize == 1368 && vsize == 769))) {
+ Mode = xf86CVTMode(1366, 768, 60, FALSE, FALSE);
+ Mode->HDisplay = 1366;
+ Mode->HSyncStart--;
+ Mode->HSyncEnd--;
+ }
+ else if (hsize && vsize && refresh) {
+ Mode = FindDMTMode(hsize, vsize, refresh, rb);
+
+ if (!Mode) {
+ if (timing_level == LEVEL_CVT)
+ /* pass rb here too? */
+ Mode = xf86CVTMode(hsize, vsize, refresh, FALSE, FALSE);
+ else if (timing_level == LEVEL_GTF)
+ Mode = xf86GTFMode(hsize, vsize, refresh, FALSE, FALSE);
+ }
+
+ }
+
+ if (Mode) {
+ Mode->type = M_T_DRIVER;
+ Modes = xf86ModesAdd(Modes, Mode);
+ }
+ Mode = NULL;
}
return Modes;
@@ -531,28 +511,29 @@ DDCModeDoInterlaceQuirks(DisplayModePtr mode)
* should be checking refresh rate too. Whatever.
*/
static const struct {
- int w, h;
+ int w, h;
} cea_interlaced[] = {
- { 1920, 1080 },
- { 720, 480 },
- { 1440, 480 },
- { 2880, 480 },
- { 720, 576 },
- { 1440, 576 },
- { 2880, 576 },
- };
- static const int n_modes = sizeof(cea_interlaced)/sizeof(cea_interlaced[0]);
+ {
+ 1920, 1080}, {
+ 720, 480}, {
+ 1440, 480}, {
+ 2880, 480}, {
+ 720, 576}, {
+ 1440, 576}, {
+ 2880, 576},};
+ static const int n_modes =
+ sizeof(cea_interlaced) / sizeof(cea_interlaced[0]);
int i;
for (i = 0; i < n_modes; i++) {
- if ((mode->HDisplay == cea_interlaced[i].w) &&
- (mode->VDisplay == cea_interlaced[i].h / 2)) {
- mode->VDisplay *= 2;
- mode->VSyncStart *= 2;
- mode->VSyncEnd *= 2;
- mode->VTotal *= 2;
- mode->VTotal |= 1;
- }
+ if ((mode->HDisplay == cea_interlaced[i].w) &&
+ (mode->VDisplay == cea_interlaced[i].h / 2)) {
+ mode->VDisplay *= 2;
+ mode->VSyncStart *= 2;
+ mode->VSyncEnd *= 2;
+ mode->VTotal *= 2;
+ mode->VTotal |= 1;
+ }
}
mode->Flags |= V_INTERLACE;
@@ -563,7 +544,7 @@ DDCModeDoInterlaceQuirks(DisplayModePtr mode)
*/
static DisplayModePtr
DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
- Bool preferred, ddc_quirk_t quirks)
+ Bool preferred, ddc_quirk_t quirks)
{
DisplayModePtr Mode;
@@ -574,34 +555,33 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
* our parser is just being too aggresive there.
*/
if (timing->h_active < 64 || timing->v_active < 64) {
- xf86DrvMsg(scrnIndex, X_INFO,
- "%s: Ignoring tiny %dx%d mode\n", __func__,
- timing->h_active, timing->v_active);
- return NULL;
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "%s: Ignoring tiny %dx%d mode\n", __func__,
+ timing->h_active, timing->v_active);
+ return NULL;
}
/* We don't do stereo */
if (timing->stereo) {
xf86DrvMsg(scrnIndex, X_INFO,
- "%s: Ignoring: We don't handle stereo.\n", __func__);
+ "%s: Ignoring: We don't handle stereo.\n", __func__);
return NULL;
}
/* We only do seperate sync currently */
if (timing->sync != 0x03) {
- xf86DrvMsg(scrnIndex, X_INFO,
- "%s: %dx%d Warning: We only handle separate"
- " sync.\n", __func__, timing->h_active, timing->v_active);
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "%s: %dx%d Warning: We only handle separate"
+ " sync.\n", __func__, timing->h_active, timing->v_active);
}
Mode = xnfcalloc(1, sizeof(DisplayModeRec));
Mode->type = M_T_DRIVER;
if (preferred)
- Mode->type |= M_T_PREFERRED;
+ Mode->type |= M_T_PREFERRED;
- if( ( quirks & DDC_QUIRK_135_CLOCK_TOO_HIGH ) &&
- timing->clock == 135000000 )
+ if ((quirks & DDC_QUIRK_135_CLOCK_TOO_HIGH) && timing->clock == 135000000)
Mode->Clock = 108880;
else
Mode->Clock = timing->clock / 1000.0;
@@ -618,27 +598,27 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
/* perform basic check on the detail timing */
if (Mode->HSyncEnd > Mode->HTotal || Mode->VSyncEnd > Mode->VTotal) {
- free(Mode);
- return NULL;
+ free(Mode);
+ return NULL;
}
/* We ignore h/v_size and h/v_border for now. */
if (timing->interlaced)
- DDCModeDoInterlaceQuirks(Mode);
+ DDCModeDoInterlaceQuirks(Mode);
if (quirks & DDC_QUIRK_DETAILED_SYNC_PP)
- Mode->Flags |= V_PVSYNC | V_PHSYNC;
+ Mode->Flags |= V_PVSYNC | V_PHSYNC;
else {
- if (timing->misc & 0x02)
- Mode->Flags |= V_PVSYNC;
- else
- Mode->Flags |= V_NVSYNC;
-
- if (timing->misc & 0x01)
- Mode->Flags |= V_PHSYNC;
- else
- Mode->Flags |= V_NHSYNC;
+ if (timing->misc & 0x02)
+ Mode->Flags |= V_PVSYNC;
+ else
+ Mode->Flags |= V_NVSYNC;
+
+ if (timing->misc & 0x01)
+ Mode->Flags |= V_PHSYNC;
+ else
+ Mode->Flags |= V_NHSYNC;
}
xf86SetModeDefaultName(Mode);
@@ -653,23 +633,30 @@ DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
int i;
for (i = 0; i < 4; i++) {
- if (t[i].height) {
- if (t[i].rates & 0x10)
- modes = xf86ModesAdd(modes,
- xf86CVTMode(t[i].width, t[i].height, 50, 0, 0));
- if (t[i].rates & 0x08)
- modes = xf86ModesAdd(modes,
- xf86CVTMode(t[i].width, t[i].height, 60, 0, 0));
- if (t[i].rates & 0x04)
- modes = xf86ModesAdd(modes,
- xf86CVTMode(t[i].width, t[i].height, 75, 0, 0));
- if (t[i].rates & 0x02)
- modes = xf86ModesAdd(modes,
- xf86CVTMode(t[i].width, t[i].height, 85, 0, 0));
- if (t[i].rates & 0x01)
- modes = xf86ModesAdd(modes,
- xf86CVTMode(t[i].width, t[i].height, 60, 1, 0));
- } else break;
+ if (t[i].height) {
+ if (t[i].rates & 0x10)
+ modes = xf86ModesAdd(modes,
+ xf86CVTMode(t[i].width, t[i].height, 50, 0,
+ 0));
+ if (t[i].rates & 0x08)
+ modes = xf86ModesAdd(modes,
+ xf86CVTMode(t[i].width, t[i].height, 60, 0,
+ 0));
+ if (t[i].rates & 0x04)
+ modes = xf86ModesAdd(modes,
+ xf86CVTMode(t[i].width, t[i].height, 75, 0,
+ 0));
+ if (t[i].rates & 0x02)
+ modes = xf86ModesAdd(modes,
+ xf86CVTMode(t[i].width, t[i].height, 85, 0,
+ 0));
+ if (t[i].rates & 0x01)
+ modes = xf86ModesAdd(modes,
+ xf86CVTMode(t[i].width, t[i].height, 60, 1,
+ 0));
+ }
+ else
+ break;
}
return modes;
@@ -682,56 +669,61 @@ static const struct {
short rb;
} EstIIIModes[] = {
/* byte 6 */
- { 640, 350, 85, 0 },
- { 640, 400, 85, 0 },
- { 720, 400, 85, 0 },
- { 640, 480, 85, 0 },
- { 848, 480, 60, 0 },
- { 800, 600, 85, 0 },
- { 1024, 768, 85, 0 },
- { 1152, 864, 75, 0 },
- /* byte 7 */
- { 1280, 768, 60, 1 },
- { 1280, 768, 60, 0 },
- { 1280, 768, 75, 0 },
- { 1280, 768, 85, 0 },
- { 1280, 960, 60, 0 },
- { 1280, 960, 85, 0 },
- { 1280, 1024, 60, 0 },
- { 1280, 1024, 85, 0 },
- /* byte 8 */
- { 1360, 768, 60, 0 },
- { 1440, 900, 60, 1 },
- { 1440, 900, 60, 0 },
- { 1440, 900, 75, 0 },
- { 1440, 900, 85, 0 },
- { 1400, 1050, 60, 1 },
- { 1400, 1050, 60, 0 },
- { 1400, 1050, 75, 0 },
- /* byte 9 */
- { 1400, 1050, 85, 0 },
- { 1680, 1050, 60, 1 },
- { 1680, 1050, 60, 0 },
- { 1680, 1050, 75, 0 },
- { 1680, 1050, 85, 0 },
- { 1600, 1200, 60, 0 },
- { 1600, 1200, 65, 0 },
- { 1600, 1200, 70, 0 },
- /* byte 10 */
- { 1600, 1200, 75, 0 },
- { 1600, 1200, 85, 0 },
- { 1792, 1344, 60, 0 },
- { 1792, 1344, 85, 0 },
- { 1856, 1392, 60, 0 },
- { 1856, 1392, 75, 0 },
- { 1920, 1200, 60, 1 },
- { 1920, 1200, 60, 0 },
- /* byte 11 */
- { 1920, 1200, 75, 0 },
- { 1920, 1200, 85, 0 },
- { 1920, 1440, 60, 0 },
- { 1920, 1440, 75, 0 },
-};
+ {
+ 640, 350, 85, 0}, {
+ 640, 400, 85, 0}, {
+ 720, 400, 85, 0}, {
+ 640, 480, 85, 0}, {
+ 848, 480, 60, 0}, {
+ 800, 600, 85, 0}, {
+ 1024, 768, 85, 0}, {
+ 1152, 864, 75, 0},
+ /* byte 7 */
+ {
+ 1280, 768, 60, 1}, {
+ 1280, 768, 60, 0}, {
+ 1280, 768, 75, 0}, {
+ 1280, 768, 85, 0}, {
+ 1280, 960, 60, 0}, {
+ 1280, 960, 85, 0}, {
+ 1280, 1024, 60, 0}, {
+ 1280, 1024, 85, 0},
+ /* byte 8 */
+ {
+ 1360, 768, 60, 0}, {
+ 1440, 900, 60, 1}, {
+ 1440, 900, 60, 0}, {
+ 1440, 900, 75, 0}, {
+ 1440, 900, 85, 0}, {
+ 1400, 1050, 60, 1}, {
+ 1400, 1050, 60, 0}, {
+ 1400, 1050, 75, 0},
+ /* byte 9 */
+ {
+ 1400, 1050, 85, 0}, {
+ 1680, 1050, 60, 1}, {
+ 1680, 1050, 60, 0}, {
+ 1680, 1050, 75, 0}, {
+ 1680, 1050, 85, 0}, {
+ 1600, 1200, 60, 0}, {
+ 1600, 1200, 65, 0}, {
+ 1600, 1200, 70, 0},
+ /* byte 10 */
+ {
+ 1600, 1200, 75, 0}, {
+ 1600, 1200, 85, 0}, {
+ 1792, 1344, 60, 0}, {
+ 1792, 1344, 85, 0}, {
+ 1856, 1392, 60, 0}, {
+ 1856, 1392, 75, 0}, {
+ 1920, 1200, 60, 1}, {
+ 1920, 1200, 60, 0},
+ /* byte 11 */
+ {
+ 1920, 1200, 75, 0}, {
+ 1920, 1200, 85, 0}, {
+ 1920, 1440, 60, 0}, {
+1920, 1440, 75, 0},};
static DisplayModePtr
DDCModesFromEstIII(unsigned char *est)
@@ -740,16 +732,16 @@ DDCModesFromEstIII(unsigned char *est)
int i, j, m;
for (i = 0; i < 6; i++) {
- for (j = 7; j > 0; j--) {
- if (est[i] & (1 << j)) {
- m = (i * 8) + (7 - j);
- modes = xf86ModesAdd(modes,
- FindDMTMode(EstIIIModes[m].w,
- EstIIIModes[m].h,
- EstIIIModes[m].r,
- EstIIIModes[m].rb));
- }
- }
+ for (j = 7; j > 0; j--) {
+ if (est[i] & (1 << j)) {
+ m = (i * 8) + (7 - j);
+ modes = xf86ModesAdd(modes,
+ FindDMTMode(EstIIIModes[m].w,
+ EstIIIModes[m].h,
+ EstIIIModes[m].r,
+ EstIIIModes[m].rb));
+ }
+ }
}
return modes;
@@ -781,10 +773,10 @@ DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
while (Mode) {
if (!Mode->HSync)
- Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
+ Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
if (!Mode->VRefresh)
- Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
+ Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
((float) (Mode->HTotal * Mode->VTotal));
if (Mode->HSync < Monitor->hsync[0].lo)
@@ -806,26 +798,26 @@ DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
ddc_quirk_t
xf86DDCDetectQuirks(int scrnIndex, xf86MonPtr DDC, Bool verbose)
{
- ddc_quirk_t quirks;
+ ddc_quirk_t quirks;
int i;
quirks = DDC_QUIRK_NONE;
for (i = 0; ddc_quirks[i].detect; i++) {
- if (ddc_quirks[i].detect (scrnIndex, DDC)) {
- if (verbose) {
- xf86DrvMsg (scrnIndex, X_INFO, " EDID quirk: %s\n",
- ddc_quirks[i].description);
- }
- quirks |= ddc_quirks[i].quirk;
- }
+ if (ddc_quirks[i].detect(scrnIndex, DDC)) {
+ if (verbose) {
+ xf86DrvMsg(scrnIndex, X_INFO, " EDID quirk: %s\n",
+ ddc_quirks[i].description);
+ }
+ quirks |= ddc_quirks[i].quirk;
+ }
}
return quirks;
}
-void xf86DetTimingApplyQuirks(struct detailed_monitor_section *det_mon,
- ddc_quirk_t quirks,
- int hsize, int vsize)
+void
+xf86DetTimingApplyQuirks(struct detailed_monitor_section *det_mon,
+ ddc_quirk_t quirks, int hsize, int vsize)
{
if (det_mon->type != DT)
return;
@@ -851,13 +843,12 @@ void xf86DetTimingApplyQuirks(struct detailed_monitor_section *det_mon,
void
xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC)
{
- ddc_quirk_t quirks = xf86DDCDetectQuirks (scrnIndex, DDC, FALSE);
+ ddc_quirk_t quirks = xf86DDCDetectQuirks(scrnIndex, DDC, FALSE);
int i;
for (i = 0; i < DET_TIMINGS; i++) {
xf86DetTimingApplyQuirks(DDC->det_mon + i, quirks,
- DDC->features.hsize,
- DDC->features.vsize);
+ DDC->features.hsize, DDC->features.vsize);
}
}
@@ -867,120 +858,116 @@ xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC)
*/
static void
xf86DDCSetPreferredRefresh(int scrnIndex, DisplayModePtr modes,
- float target_refresh)
+ float target_refresh)
{
- DisplayModePtr mode, best = modes;
-
- for (mode = modes; mode; mode = mode->next)
- {
- mode->type &= ~M_T_PREFERRED;
-
- if (mode == best) continue;
-
- if (mode->HDisplay * mode->VDisplay >
- best->HDisplay * best->VDisplay)
- {
- best = mode;
- continue;
- }
- if (mode->HDisplay * mode->VDisplay ==
- best->HDisplay * best->VDisplay)
- {
- double mode_refresh = xf86ModeVRefresh (mode);
- double best_refresh = xf86ModeVRefresh (best);
- double mode_dist = fabs(mode_refresh - target_refresh);
- double best_dist = fabs(best_refresh - target_refresh);
-
- if (mode_dist < best_dist)
- {
- best = mode;
- continue;
- }
- }
- }
- if (best)
- best->type |= M_T_PREFERRED;
+ DisplayModePtr mode, best = modes;
+
+ for (mode = modes; mode; mode = mode->next) {
+ mode->type &= ~M_T_PREFERRED;
+
+ if (mode == best)
+ continue;
+
+ if (mode->HDisplay * mode->VDisplay > best->HDisplay * best->VDisplay) {
+ best = mode;
+ continue;
+ }
+ if (mode->HDisplay * mode->VDisplay == best->HDisplay * best->VDisplay) {
+ double mode_refresh = xf86ModeVRefresh(mode);
+ double best_refresh = xf86ModeVRefresh(best);
+ double mode_dist = fabs(mode_refresh - target_refresh);
+ double best_dist = fabs(best_refresh - target_refresh);
+
+ if (mode_dist < best_dist) {
+ best = mode;
+ continue;
+ }
+ }
+ }
+ if (best)
+ best->type |= M_T_PREFERRED;
}
#define CEA_VIDEO_MODES_NUM 64
static const DisplayModeRec CEAVideoModes[CEA_VIDEO_MODES_NUM] = {
- { MODEPREFIX, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 1:640x480@60Hz */
- { MODEPREFIX, 27000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 2:720x480@60Hz */
- { MODEPREFIX, 27000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 3:720x480@60Hz */
- { MODEPREFIX, 74250, 1280, 1390, 1430, 1650, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 4: 1280x720@60Hz */
- { MODEPREFIX, 74250, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 5:1920x1080i@60Hz */
- { MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 6:1440x480i@60Hz */
- { MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 7:1440x480i@60Hz */
- { MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 8:1440x240@60Hz */
- { MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 9:1440x240@60Hz */
- { MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 10:2880x480i@60Hz */
- { MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 11:2880x480i@60Hz */
- { MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 12:2880x240@60Hz */
- { MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 13:2880x240@60Hz */
- { MODEPREFIX, 54000, 1440, 1472, 1596, 1716, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 14:1440x480@60Hz */
- { MODEPREFIX, 54000, 1440, 1472, 1596, 1716, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 15:1440x480@60Hz */
- { MODEPREFIX, 148500, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 16:1920x1080@60Hz */
- { MODEPREFIX, 27000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 17:720x576@50Hz */
- { MODEPREFIX, 27000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 18:720x576@50Hz */
- { MODEPREFIX, 74250, 1280, 1720, 1760, 1980, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 19: 1280x720@50Hz */
- { MODEPREFIX, 74250, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 20:1920x1080i@50Hz */
- { MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 21:1440x576i@50Hz */
- { MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 22:1440x576i@50Hz */
- { MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 23:1440x288@50Hz */
- { MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 24:1440x288@50Hz */
- { MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 25:2880x576i@50Hz */
- { MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 26:2880x576i@50Hz */
- { MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 27:2880x288@50Hz */
- { MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 28:2880x288@50Hz */
- { MODEPREFIX, 54000, 1440, 1464, 1592, 1728, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 29:1440x576@50Hz */
- { MODEPREFIX, 54000, 1440, 1464, 1592, 1728, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 30:1440x576@50Hz */
- { MODEPREFIX, 148500, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 31:1920x1080@50Hz */
- { MODEPREFIX, 74250, 1920, 2558, 2602, 2750, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 32:1920x1080@24Hz */
- { MODEPREFIX, 74250, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 33:1920x1080@25Hz */
- { MODEPREFIX, 74250, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 34:1920x1080@30Hz */
- { MODEPREFIX, 108000, 2880, 2944, 3192, 3432, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 35:2880x480@60Hz */
- { MODEPREFIX, 108000, 2880, 2944, 3192, 3432, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 36:2880x480@60Hz */
- { MODEPREFIX, 108000, 2880, 2928, 3184, 3456, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 37:2880x576@50Hz */
- { MODEPREFIX, 108000, 2880, 2928, 3184, 3456, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 38:2880x576@50Hz */
- { MODEPREFIX, 72000, 1920, 1952, 2120, 2304, 0, 1080, 1126, 1136, 1250, 0, V_PHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 39:1920x1080i@50Hz */
- { MODEPREFIX, 148500, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 40:1920x1080i@100Hz */
- { MODEPREFIX, 148500, 1280, 1720, 1760, 1980, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 41:1280x720@100Hz */
- { MODEPREFIX, 54000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 42:720x576@100Hz */
- { MODEPREFIX, 54000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 43:720x576@100Hz */
- { MODEPREFIX, 54000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 44:1440x576i@100Hz */
- { MODEPREFIX, 54000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 45:1440x576i@100Hz */
- { MODEPREFIX, 148500, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* VIC 46:1920x1080i@120Hz */
- { MODEPREFIX, 148500, 1280, 1390, 1430, 1650, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 47:1280x720@120Hz */
- { MODEPREFIX, 54000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 48:720x480@120Hz */
- { MODEPREFIX, 54000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 49:720x480@120Hz */
- { MODEPREFIX, 54000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX },/* VIC 50:1440x480i@120Hz */
- { MODEPREFIX, 54000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX },/* VIC 51:1440x480i@120Hz */
- { MODEPREFIX, 108000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 52:720x576@200Hz */
- { MODEPREFIX, 108000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 53:720x576@200Hz */
- { MODEPREFIX, 108000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX },/* VIC 54:1440x576i@200Hz */
- { MODEPREFIX, 108000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX },/* VIC 55:1440x576i@200Hz */
- { MODEPREFIX, 108000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 56:720x480@240Hz */
- { MODEPREFIX, 108000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* VIC 57:720x480@240Hz */
- { MODEPREFIX, 108000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX },/* VIC 58:1440x480i@240 */
- { MODEPREFIX, 108000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX },/* VIC 59:1440x480i@240 */
- { MODEPREFIX, 59400, 1280, 3040, 3080, 3300, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 60: 1280x720@24Hz */
- { MODEPREFIX, 74250, 1280, 3700, 3740, 3960, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 61: 1280x720@25Hz */
- { MODEPREFIX, 74250, 1280, 3040, 3080, 3300, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 62: 1280x720@30Hz */
- { MODEPREFIX, 297000, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 63: 1920x1080@120Hz */
- { MODEPREFIX, 297000, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* VIC 64:1920x1080@100Hz */
+ {MODEPREFIX, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 1:640x480@60Hz */
+ {MODEPREFIX, 27000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 2:720x480@60Hz */
+ {MODEPREFIX, 27000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 3:720x480@60Hz */
+ {MODEPREFIX, 74250, 1280, 1390, 1430, 1650, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 4: 1280x720@60Hz */
+ {MODEPREFIX, 74250, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 5:1920x1080i@60Hz */
+ {MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 6:1440x480i@60Hz */
+ {MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 7:1440x480i@60Hz */
+ {MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 8:1440x240@60Hz */
+ {MODEPREFIX, 27000, 1440, 1478, 1602, 1716, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 9:1440x240@60Hz */
+ {MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 10:2880x480i@60Hz */
+ {MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 11:2880x480i@60Hz */
+ {MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 12:2880x240@60Hz */
+ {MODEPREFIX, 54000, 2880, 2956, 3204, 3432, 0, 240, 244, 247, 262, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 13:2880x240@60Hz */
+ {MODEPREFIX, 54000, 1440, 1472, 1596, 1716, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 14:1440x480@60Hz */
+ {MODEPREFIX, 54000, 1440, 1472, 1596, 1716, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 15:1440x480@60Hz */
+ {MODEPREFIX, 148500, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 16:1920x1080@60Hz */
+ {MODEPREFIX, 27000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 17:720x576@50Hz */
+ {MODEPREFIX, 27000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 18:720x576@50Hz */
+ {MODEPREFIX, 74250, 1280, 1720, 1760, 1980, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 19: 1280x720@50Hz */
+ {MODEPREFIX, 74250, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 20:1920x1080i@50Hz */
+ {MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 21:1440x576i@50Hz */
+ {MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 22:1440x576i@50Hz */
+ {MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 23:1440x288@50Hz */
+ {MODEPREFIX, 27000, 1440, 1464, 1590, 1728, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 24:1440x288@50Hz */
+ {MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 25:2880x576i@50Hz */
+ {MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 26:2880x576i@50Hz */
+ {MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 27:2880x288@50Hz */
+ {MODEPREFIX, 54000, 2880, 2928, 3180, 3456, 0, 288, 290, 293, 312, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 28:2880x288@50Hz */
+ {MODEPREFIX, 54000, 1440, 1464, 1592, 1728, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 29:1440x576@50Hz */
+ {MODEPREFIX, 54000, 1440, 1464, 1592, 1728, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 30:1440x576@50Hz */
+ {MODEPREFIX, 148500, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 31:1920x1080@50Hz */
+ {MODEPREFIX, 74250, 1920, 2558, 2602, 2750, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 32:1920x1080@24Hz */
+ {MODEPREFIX, 74250, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 33:1920x1080@25Hz */
+ {MODEPREFIX, 74250, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 34:1920x1080@30Hz */
+ {MODEPREFIX, 108000, 2880, 2944, 3192, 3432, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 35:2880x480@60Hz */
+ {MODEPREFIX, 108000, 2880, 2944, 3192, 3432, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 36:2880x480@60Hz */
+ {MODEPREFIX, 108000, 2880, 2928, 3184, 3456, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 37:2880x576@50Hz */
+ {MODEPREFIX, 108000, 2880, 2928, 3184, 3456, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 38:2880x576@50Hz */
+ {MODEPREFIX, 72000, 1920, 1952, 2120, 2304, 0, 1080, 1126, 1136, 1250, 0, V_PHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 39:1920x1080i@50Hz */
+ {MODEPREFIX, 148500, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 40:1920x1080i@100Hz */
+ {MODEPREFIX, 148500, 1280, 1720, 1760, 1980, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 41:1280x720@100Hz */
+ {MODEPREFIX, 54000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 42:720x576@100Hz */
+ {MODEPREFIX, 54000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 43:720x576@100Hz */
+ {MODEPREFIX, 54000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 44:1440x576i@100Hz */
+ {MODEPREFIX, 54000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 45:1440x576i@100Hz */
+ {MODEPREFIX, 148500, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 46:1920x1080i@120Hz */
+ {MODEPREFIX, 148500, 1280, 1390, 1430, 1650, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 47:1280x720@120Hz */
+ {MODEPREFIX, 54000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 48:720x480@120Hz */
+ {MODEPREFIX, 54000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 49:720x480@120Hz */
+ {MODEPREFIX, 54000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 50:1440x480i@120Hz */
+ {MODEPREFIX, 54000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 51:1440x480i@120Hz */
+ {MODEPREFIX, 108000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 52:720x576@200Hz */
+ {MODEPREFIX, 108000, 720, 732, 796, 864, 0, 576, 581, 586, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 53:720x576@200Hz */
+ {MODEPREFIX, 108000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 54:1440x576i@200Hz */
+ {MODEPREFIX, 108000, 1440, 1464, 1590, 1728, 0, 576, 580, 586, 625, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 55:1440x576i@200Hz */
+ {MODEPREFIX, 108000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 56:720x480@240Hz */
+ {MODEPREFIX, 108000, 720, 736, 798, 858, 0, 480, 489, 495, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, /* VIC 57:720x480@240Hz */
+ {MODEPREFIX, 108000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 58:1440x480i@240 */
+ {MODEPREFIX, 108000, 1440, 1478, 1602, 1716, 0, 480, 488, 494, 525, 0, V_NHSYNC | V_NVSYNC | V_INTERLACE, MODESUFFIX}, /* VIC 59:1440x480i@240 */
+ {MODEPREFIX, 59400, 1280, 3040, 3080, 3300, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 60: 1280x720@24Hz */
+ {MODEPREFIX, 74250, 1280, 3700, 3740, 3960, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 61: 1280x720@25Hz */
+ {MODEPREFIX, 74250, 1280, 3040, 3080, 3300, 0, 720, 725, 730, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 62: 1280x720@30Hz */
+ {MODEPREFIX, 297000, 1920, 2008, 2052, 2200, 0, 1080, 1084, 1089, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 63: 1920x1080@120Hz */
+ {MODEPREFIX, 297000, 1920, 2448, 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, /* VIC 64:1920x1080@100Hz */
};
/* chose mode line by cea short video descriptor*/
-static void handle_cea_svd(struct cea_video_block *video, void *data)
+static void
+handle_cea_svd(struct cea_video_block *video, void *data)
{
DisplayModePtr Mode;
DisplayModePtr *Modes = (DisplayModePtr *) data;
int vid;
- vid = video ->video_code & 0x7f;
+ vid = video->video_code & 0x7f;
if (vid < CEA_VIDEO_MODES_NUM) {
- Mode = xf86DuplicateMode(CEAVideoModes + vid);
- *Modes = xf86ModesAdd(*Modes, Mode);
+ Mode = xf86DuplicateMode(CEAVideoModes + vid);
+ *Modes = xf86ModesAdd(*Modes, Mode);
}
}
@@ -989,9 +976,7 @@ DDCModesFromCEAExtension(int scrnIndex, xf86MonPtr MonPtr)
{
DisplayModePtr Modes = NULL;
- xf86ForEachVideoBlock(MonPtr,
- handle_cea_svd,
- &Modes);
+ xf86ForEachVideoBlock(MonPtr, handle_cea_svd, &Modes);
return Modes;
}
@@ -999,34 +984,32 @@ DDCModesFromCEAExtension(int scrnIndex, xf86MonPtr MonPtr)
struct det_modes_parameter {
xf86MonPtr DDC;
ddc_quirk_t quirks;
- DisplayModePtr Modes;
+ DisplayModePtr Modes;
Bool rb;
Bool preferred;
int timing_level;
};
-static void handle_detailed_modes(struct detailed_monitor_section *det_mon,
- void *data)
+static void
+handle_detailed_modes(struct detailed_monitor_section *det_mon, void *data)
{
- DisplayModePtr Mode;
- struct det_modes_parameter *p = (struct det_modes_parameter *)data;
+ DisplayModePtr Mode;
+ struct det_modes_parameter *p = (struct det_modes_parameter *) data;
- xf86DetTimingApplyQuirks(det_mon,p->quirks,
- p->DDC->features.hsize,
- p->DDC->features.vsize);
+ xf86DetTimingApplyQuirks(det_mon, p->quirks,
+ p->DDC->features.hsize, p->DDC->features.vsize);
switch (det_mon->type) {
case DT:
Mode = DDCModeFromDetailedTiming(p->DDC->scrnIndex,
&det_mon->section.d_timings,
- p->preferred,
- p->quirks);
+ p->preferred, p->quirks);
p->preferred = FALSE;
p->Modes = xf86ModesAdd(p->Modes, Mode);
break;
case DS_STD_TIMINGS:
Mode = DDCModesFromStandardTiming(det_mon->section.std_t,
- p->quirks, p->timing_level,p->rb);
+ p->quirks, p->timing_level, p->rb);
p->Modes = xf86ModesAdd(p->Modes, Mode);
break;
case DS_CVT:
@@ -1034,9 +1017,9 @@ static void handle_detailed_modes(struct detailed_monitor_section *det_mon,
p->Modes = xf86ModesAdd(p->Modes, Mode);
break;
case DS_EST_III:
- Mode = DDCModesFromEstIII(det_mon->section.est_iii);
- p->Modes = xf86ModesAdd(p->Modes, Mode);
- break;
+ Mode = DDCModesFromEstIII(det_mon->section.est_iii);
+ p->Modes = xf86ModesAdd(p->Modes, Mode);
+ break;
default:
break;
}
@@ -1045,24 +1028,24 @@ static void handle_detailed_modes(struct detailed_monitor_section *det_mon,
DisplayModePtr
xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
{
- DisplayModePtr Modes = NULL, Mode;
- ddc_quirk_t quirks;
- Bool preferred, rb;
- int timing_level;
+ DisplayModePtr Modes = NULL, Mode;
+ ddc_quirk_t quirks;
+ Bool preferred, rb;
+ int timing_level;
struct det_modes_parameter p;
- xf86DrvMsg (scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n",
- DDC->vendor.name, DDC->vendor.prod_id);
+ xf86DrvMsg(scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n",
+ DDC->vendor.name, DDC->vendor.prod_id);
quirks = xf86DDCDetectQuirks(scrnIndex, DDC, TRUE);
preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
if (DDC->ver.revision >= 4)
- preferred = TRUE;
+ preferred = TRUE;
if (quirks & DDC_QUIRK_FIRST_DETAILED_PREFERRED)
- preferred = TRUE;
+ preferred = TRUE;
if (quirks & (DDC_QUIRK_PREFER_LARGE_60 | DDC_QUIRK_PREFER_LARGE_75))
- preferred = FALSE;
+ preferred = FALSE;
rb = xf86MonitorSupportsReducedBlanking(DDC);
@@ -1086,14 +1069,14 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
Modes = xf86ModesAdd(Modes, Mode);
/* Add cea-extension mode timings */
- Mode = DDCModesFromCEAExtension(scrnIndex,DDC);
+ Mode = DDCModesFromCEAExtension(scrnIndex, DDC);
Modes = xf86ModesAdd(Modes, Mode);
if (quirks & DDC_QUIRK_PREFER_LARGE_60)
- xf86DDCSetPreferredRefresh(scrnIndex, Modes, 60);
+ xf86DDCSetPreferredRefresh(scrnIndex, Modes, 60);
if (quirks & DDC_QUIRK_PREFER_LARGE_75)
- xf86DDCSetPreferredRefresh(scrnIndex, Modes, 75);
+ xf86DDCSetPreferredRefresh(scrnIndex, Modes, 75);
Modes = xf86PruneDuplicateModes(Modes);
@@ -1108,41 +1091,43 @@ struct det_mon_parameter {
Bool have_maxpixclock;
};
-static void handle_detailed_monset(struct detailed_monitor_section *det_mon,
- void *data)
+static void
+handle_detailed_monset(struct detailed_monitor_section *det_mon, void *data)
{
int clock;
- struct det_mon_parameter *p = (struct det_mon_parameter *)data;
- int scrnIndex = ((xf86MonPtr)(p->Monitor->DDC))->scrnIndex;
+ struct det_mon_parameter *p = (struct det_mon_parameter *) data;
+ int scrnIndex = ((xf86MonPtr) (p->Monitor->DDC))->scrnIndex;
switch (det_mon->type) {
case DS_RANGES:
if (!p->have_hsync) {
if (!p->Monitor->nHsync)
xf86DrvMsg(scrnIndex, X_INFO,
- "Using EDID range info for horizontal sync\n");
- p->Monitor->hsync[p->Monitor->nHsync].lo =
- det_mon->section.ranges.min_h;
- p->Monitor->hsync[p->Monitor->nHsync].hi =
- det_mon->section.ranges.max_h;
- p->Monitor->nHsync++;
- } else {
+ "Using EDID range info for horizontal sync\n");
+ p->Monitor->hsync[p->Monitor->nHsync].lo =
+ det_mon->section.ranges.min_h;
+ p->Monitor->hsync[p->Monitor->nHsync].hi =
+ det_mon->section.ranges.max_h;
+ p->Monitor->nHsync++;
+ }
+ else {
xf86DrvMsg(scrnIndex, X_INFO,
- "Using hsync ranges from config file\n");
+ "Using hsync ranges from config file\n");
}
if (!p->have_vrefresh) {
if (!p->Monitor->nVrefresh)
xf86DrvMsg(scrnIndex, X_INFO,
- "Using EDID range info for vertical refresh\n");
+ "Using EDID range info for vertical refresh\n");
p->Monitor->vrefresh[p->Monitor->nVrefresh].lo =
det_mon->section.ranges.min_v;
p->Monitor->vrefresh[p->Monitor->nVrefresh].hi =
det_mon->section.ranges.max_v;
p->Monitor->nVrefresh++;
- } else {
+ }
+ else {
xf86DrvMsg(scrnIndex, X_INFO,
- "Using vrefresh ranges from config file\n");
+ "Using vrefresh ranges from config file\n");
}
clock = det_mon->section.ranges.max_clock * 1000;
@@ -1172,8 +1157,8 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
Monitor->DDC = DDC;
if (Monitor->widthmm <= 0 || Monitor->heightmm <= 0) {
- Monitor->widthmm = 10 * DDC->features.hsize;
- Monitor->heightmm = 10 * DDC->features.vsize;
+ Monitor->widthmm = 10 * DDC->features.hsize;
+ Monitor->heightmm = 10 * DDC->features.vsize;
}
Monitor->reducedblanking = xf86MonitorSupportsReducedBlanking(DDC);
@@ -1213,7 +1198,8 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
Monitor->Last->next = Modes;
Modes->prev = Monitor->Last;
Monitor->Last = Mode;
- } else {
+ }
+ else {
Monitor->Modes = Modes;
Monitor->Last = Mode;
}
diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.c b/xorg-server/hw/xfree86/modes/xf86Modes.c
index 49cc14992..2a6d26756 100644
--- a/xorg-server/hw/xfree86/modes/xf86Modes.c
+++ b/xorg-server/hw/xfree86/modes/xf86Modes.c
@@ -42,14 +42,14 @@ extern XF86ConfigPtr xf86configptr;
* Calculates the horizontal sync rate of a mode.
*/
double
-xf86ModeHSync(const DisplayModeRec *mode)
+xf86ModeHSync(const DisplayModeRec * mode)
{
double hsync = 0.0;
-
+
if (mode->HSync > 0.0)
- hsync = mode->HSync;
+ hsync = mode->HSync;
else if (mode->HTotal > 0)
- hsync = (float)mode->Clock / (float)mode->HTotal;
+ hsync = (float) mode->Clock / (float) mode->HTotal;
return hsync;
}
@@ -58,51 +58,51 @@ xf86ModeHSync(const DisplayModeRec *mode)
* Calculates the vertical refresh rate of a mode.
*/
double
-xf86ModeVRefresh(const DisplayModeRec *mode)
+xf86ModeVRefresh(const DisplayModeRec * mode)
{
double refresh = 0.0;
if (mode->VRefresh > 0.0)
- refresh = mode->VRefresh;
+ refresh = mode->VRefresh;
else if (mode->HTotal > 0 && mode->VTotal > 0) {
- refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal;
- if (mode->Flags & V_INTERLACE)
- refresh *= 2.0;
- if (mode->Flags & V_DBLSCAN)
- refresh /= 2.0;
- if (mode->VScan > 1)
- refresh /= (float)(mode->VScan);
+ refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal;
+ if (mode->Flags & V_INTERLACE)
+ refresh *= 2.0;
+ if (mode->Flags & V_DBLSCAN)
+ refresh /= 2.0;
+ if (mode->VScan > 1)
+ refresh /= (float) (mode->VScan);
}
return refresh;
}
int
-xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation)
+xf86ModeWidth(const DisplayModeRec * mode, Rotation rotation)
{
switch (rotation & 0xf) {
case RR_Rotate_0:
case RR_Rotate_180:
- return mode->HDisplay;
+ return mode->HDisplay;
case RR_Rotate_90:
case RR_Rotate_270:
- return mode->VDisplay;
+ return mode->VDisplay;
default:
- return 0;
+ return 0;
}
}
int
-xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation)
+xf86ModeHeight(const DisplayModeRec * mode, Rotation rotation)
{
switch (rotation & 0xf) {
case RR_Rotate_0:
case RR_Rotate_180:
- return mode->VDisplay;
+ return mode->VDisplay;
case RR_Rotate_90:
case RR_Rotate_270:
- return mode->HDisplay;
+ return mode->HDisplay;
default:
- return 0;
+ return 0;
}
}
@@ -114,26 +114,26 @@ xf86ModeBandwidth(DisplayModePtr mode, int depth)
int bytes_per_pixel = bits_to_bytes(depth);
if (!mode->HTotal || !mode->VTotal || !mode->Clock)
- return 0;
+ return 0;
a_active = mode->HDisplay * mode->VDisplay;
a_total = mode->HTotal * mode->VTotal;
active_percent = a_active / a_total;
pixels_per_second = active_percent * mode->Clock * 1000.0;
- return (unsigned int)(pixels_per_second * bytes_per_pixel / (1024 * 1024));
+ return (unsigned int) (pixels_per_second * bytes_per_pixel / (1024 * 1024));
}
/** Sets a default mode name of <width>x<height> on a mode. */
void
xf86SetModeDefaultName(DisplayModePtr mode)
{
- Bool interlaced = !!(mode->Flags & V_INTERLACE);
+ Bool interlaced = ! !(mode->Flags & V_INTERLACE);
free(mode->name);
XNFasprintf(&mode->name, "%dx%d%s", mode->HDisplay, mode->VDisplay,
- interlaced ? "i" : "");
+ interlaced ? "i" : "");
}
/*
@@ -146,40 +146,40 @@ void
xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
{
if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN))
- return;
-
- p->CrtcHDisplay = p->HDisplay;
- p->CrtcHSyncStart = p->HSyncStart;
- p->CrtcHSyncEnd = p->HSyncEnd;
- p->CrtcHTotal = p->HTotal;
- p->CrtcHSkew = p->HSkew;
- p->CrtcVDisplay = p->VDisplay;
- p->CrtcVSyncStart = p->VSyncStart;
- p->CrtcVSyncEnd = p->VSyncEnd;
- p->CrtcVTotal = p->VTotal;
+ return;
+
+ p->CrtcHDisplay = p->HDisplay;
+ p->CrtcHSyncStart = p->HSyncStart;
+ p->CrtcHSyncEnd = p->HSyncEnd;
+ p->CrtcHTotal = p->HTotal;
+ p->CrtcHSkew = p->HSkew;
+ p->CrtcVDisplay = p->VDisplay;
+ p->CrtcVSyncStart = p->VSyncStart;
+ p->CrtcVSyncEnd = p->VSyncEnd;
+ p->CrtcVTotal = p->VTotal;
if (p->Flags & V_INTERLACE) {
- if (adjustFlags & INTERLACE_HALVE_V) {
- p->CrtcVDisplay /= 2;
- p->CrtcVSyncStart /= 2;
- p->CrtcVSyncEnd /= 2;
- p->CrtcVTotal /= 2;
- }
- /* Force interlaced modes to have an odd VTotal */
- /* maybe we should only do this when INTERLACE_HALVE_V is set? */
- p->CrtcVTotal |= 1;
+ if (adjustFlags & INTERLACE_HALVE_V) {
+ p->CrtcVDisplay /= 2;
+ p->CrtcVSyncStart /= 2;
+ p->CrtcVSyncEnd /= 2;
+ p->CrtcVTotal /= 2;
+ }
+ /* Force interlaced modes to have an odd VTotal */
+ /* maybe we should only do this when INTERLACE_HALVE_V is set? */
+ p->CrtcVTotal |= 1;
}
if (p->Flags & V_DBLSCAN) {
- p->CrtcVDisplay *= 2;
- p->CrtcVSyncStart *= 2;
- p->CrtcVSyncEnd *= 2;
- p->CrtcVTotal *= 2;
+ p->CrtcVDisplay *= 2;
+ p->CrtcVSyncStart *= 2;
+ p->CrtcVSyncEnd *= 2;
+ p->CrtcVTotal *= 2;
}
if (p->VScan > 1) {
- p->CrtcVDisplay *= p->VScan;
- p->CrtcVSyncStart *= p->VScan;
- p->CrtcVSyncEnd *= p->VScan;
- p->CrtcVTotal *= p->VScan;
+ p->CrtcVDisplay *= p->VScan;
+ p->CrtcVSyncStart *= p->VScan;
+ p->CrtcVSyncEnd *= p->VScan;
+ p->CrtcVTotal *= p->VScan;
}
p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay);
p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal);
@@ -194,7 +194,7 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
* Allocates and returns a copy of pMode, including pointers within pMode.
*/
DisplayModePtr
-xf86DuplicateMode(const DisplayModeRec *pMode)
+xf86DuplicateMode(const DisplayModeRec * pMode)
{
DisplayModePtr pNew;
@@ -204,9 +204,9 @@ xf86DuplicateMode(const DisplayModeRec *pMode)
pNew->prev = NULL;
if (pMode->name == NULL)
- xf86SetModeDefaultName(pNew);
+ xf86SetModeDefaultName(pNew);
else
- pNew->name = xnfstrdup(pMode->name);
+ pNew->name = xnfstrdup(pMode->name);
return pNew;
}
@@ -224,20 +224,21 @@ xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
DisplayModePtr mode;
for (mode = modeList; mode != NULL; mode = mode->next) {
- DisplayModePtr new;
-
- new = xf86DuplicateMode(mode);
-
- /* Insert pNew into modeList */
- if (last) {
- last->next = new;
- new->prev = last;
- } else {
- first = new;
- new->prev = NULL;
- }
- new->next = NULL;
- last = new;
+ DisplayModePtr new;
+
+ new = xf86DuplicateMode(mode);
+
+ /* Insert pNew into modeList */
+ if (last) {
+ last->next = new;
+ new->prev = last;
+ }
+ else {
+ first = new;
+ new->prev = NULL;
+ }
+ new->next = NULL;
+ last = new;
}
return first;
@@ -250,25 +251,24 @@ xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
* Crtc values set. So, it's assumed that the other numbers are enough.
*/
Bool
-xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2)
+xf86ModesEqual(const DisplayModeRec * pMode1, const DisplayModeRec * pMode2)
{
- if (pMode1->Clock == pMode2->Clock &&
- pMode1->HDisplay == pMode2->HDisplay &&
- pMode1->HSyncStart == pMode2->HSyncStart &&
- pMode1->HSyncEnd == pMode2->HSyncEnd &&
- pMode1->HTotal == pMode2->HTotal &&
- pMode1->HSkew == pMode2->HSkew &&
- pMode1->VDisplay == pMode2->VDisplay &&
- pMode1->VSyncStart == pMode2->VSyncStart &&
- pMode1->VSyncEnd == pMode2->VSyncEnd &&
- pMode1->VTotal == pMode2->VTotal &&
- pMode1->VScan == pMode2->VScan &&
- pMode1->Flags == pMode2->Flags)
- {
- return TRUE;
- } else {
- return FALSE;
- }
+ if (pMode1->Clock == pMode2->Clock &&
+ pMode1->HDisplay == pMode2->HDisplay &&
+ pMode1->HSyncStart == pMode2->HSyncStart &&
+ pMode1->HSyncEnd == pMode2->HSyncEnd &&
+ pMode1->HTotal == pMode2->HTotal &&
+ pMode1->HSkew == pMode2->HSkew &&
+ pMode1->VDisplay == pMode2->VDisplay &&
+ pMode1->VSyncStart == pMode2->VSyncStart &&
+ pMode1->VSyncEnd == pMode2->VSyncEnd &&
+ pMode1->VTotal == pMode2->VTotal &&
+ pMode1->VScan == pMode2->VScan && pMode1->Flags == pMode2->Flags) {
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
}
static void
@@ -309,54 +309,68 @@ xf86PrintModeline(int scrnIndex, DisplayModePtr mode)
{
char tmp[256];
char *flags = xnfcalloc(1, 1);
+
#define TBITS 6
- const char tchar[TBITS+1] = "UezdPb";
+ const char tchar[TBITS + 1] = "UezdPb";
+
int tbit[TBITS] = {
- M_T_USERPREF, M_T_DRIVER, M_T_USERDEF,
- M_T_DEFAULT, M_T_PREFERRED, M_T_BUILTIN
+ M_T_USERPREF, M_T_DRIVER, M_T_USERDEF,
+ M_T_DEFAULT, M_T_PREFERRED, M_T_BUILTIN
};
- char type[TBITS+2]; /* +1 for leading space */
+ char type[TBITS + 2]; /* +1 for leading space */
+
#undef TBITS
int tlen = 0;
if (mode->type) {
- int i;
+ int i;
- type[tlen++] = ' ';
- for (i = 0; tchar[i]; i++)
- if (mode->type & tbit[i])
- type[tlen++] = tchar[i];
+ type[tlen++] = ' ';
+ for (i = 0; tchar[i]; i++)
+ if (mode->type & tbit[i])
+ type[tlen++] = tchar[i];
}
type[tlen] = '\0';
- if (mode->HSkew) {
- snprintf(tmp, 256, "hskew %i", mode->HSkew);
- add(&flags, tmp);
+ if (mode->HSkew) {
+ snprintf(tmp, 256, "hskew %i", mode->HSkew);
+ add(&flags, tmp);
}
- if (mode->VScan) {
- snprintf(tmp, 256, "vscan %i", mode->VScan);
- add(&flags, tmp);
+ if (mode->VScan) {
+ snprintf(tmp, 256, "vscan %i", mode->VScan);
+ add(&flags, tmp);
}
- if (mode->Flags & V_INTERLACE) add(&flags, "interlace");
- if (mode->Flags & V_CSYNC) add(&flags, "composite");
- if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan");
- if (mode->Flags & V_BCAST) add(&flags, "bcast");
- if (mode->Flags & V_PHSYNC) add(&flags, "+hsync");
- if (mode->Flags & V_NHSYNC) add(&flags, "-hsync");
- if (mode->Flags & V_PVSYNC) add(&flags, "+vsync");
- if (mode->Flags & V_NVSYNC) add(&flags, "-vsync");
- if (mode->Flags & V_PCSYNC) add(&flags, "+csync");
- if (mode->Flags & V_NCSYNC) add(&flags, "-csync");
+ if (mode->Flags & V_INTERLACE)
+ add(&flags, "interlace");
+ if (mode->Flags & V_CSYNC)
+ add(&flags, "composite");
+ if (mode->Flags & V_DBLSCAN)
+ add(&flags, "doublescan");
+ if (mode->Flags & V_BCAST)
+ add(&flags, "bcast");
+ if (mode->Flags & V_PHSYNC)
+ add(&flags, "+hsync");
+ if (mode->Flags & V_NHSYNC)
+ add(&flags, "-hsync");
+ if (mode->Flags & V_PVSYNC)
+ add(&flags, "+vsync");
+ if (mode->Flags & V_NVSYNC)
+ add(&flags, "-vsync");
+ if (mode->Flags & V_PCSYNC)
+ add(&flags, "+csync");
+ if (mode->Flags & V_NCSYNC)
+ add(&flags, "-csync");
#if 0
- if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2");
+ if (mode->Flags & V_CLKDIV2)
+ add(&flags, "vclk/2");
#endif
xf86DrvMsg(scrnIndex, X_INFO,
- "Modeline \"%s\"x%.01f %6.2f %i %i %i %i %i %i %i %i%s"
- " (%.01f kHz%s)\n",
- mode->name, mode->VRefresh, mode->Clock/1000.,
- mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
- mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal,
- flags, xf86ModeHSync(mode), type);
+ "Modeline \"%s\"x%.01f %6.2f %i %i %i %i %i %i %i %i%s"
+ " (%.01f kHz%s)\n",
+ mode->name, mode->VRefresh, mode->Clock / 1000.,
+ mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
+ mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal,
+ flags, xf86ModeHSync(mode), type);
free(flags);
}
@@ -369,19 +383,18 @@ xf86PrintModeline(int scrnIndex, DisplayModePtr mode)
* \bug only V_INTERLACE and V_DBLSCAN are supported. Is that enough?
*/
void
-xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int flags)
+xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, int flags)
{
DisplayModePtr mode;
if (flags == (V_INTERLACE | V_DBLSCAN))
- return;
+ return;
for (mode = modeList; mode != NULL; mode = mode->next) {
- if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE))
- mode->status = MODE_NO_INTERLACE;
- if (mode->Flags & V_DBLSCAN && !(flags & V_DBLSCAN))
- mode->status = MODE_NO_DBLESCAN;
+ if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE))
+ mode->status = MODE_NO_INTERLACE;
+ if (mode->Flags & V_DBLSCAN && !(flags & V_DBLSCAN))
+ mode->status = MODE_NO_DBLESCAN;
}
}
@@ -392,39 +405,39 @@ xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
*/
void
xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int maxX, int maxY, int maxPitch)
+ int maxX, int maxY, int maxPitch)
{
DisplayModePtr mode;
if (maxPitch <= 0)
- maxPitch = MAXINT;
+ maxPitch = MAXINT;
if (maxX <= 0)
- maxX = MAXINT;
+ maxX = MAXINT;
if (maxY <= 0)
- maxY = MAXINT;
+ maxY = MAXINT;
for (mode = modeList; mode != NULL; mode = mode->next) {
- if ((xf86ModeWidth(mode, RR_Rotate_0) > maxPitch ||
- xf86ModeWidth(mode, RR_Rotate_0) > maxX ||
- xf86ModeHeight(mode, RR_Rotate_0) > maxY) &&
- (xf86ModeWidth(mode, RR_Rotate_90) > maxPitch ||
- xf86ModeWidth(mode, RR_Rotate_90) > maxX ||
- xf86ModeHeight(mode, RR_Rotate_90) > maxY)) {
- if (xf86ModeWidth(mode, RR_Rotate_0) > maxPitch ||
- xf86ModeWidth(mode, RR_Rotate_90) > maxPitch)
- mode->status = MODE_BAD_WIDTH;
-
- if (xf86ModeWidth(mode, RR_Rotate_0) > maxX ||
- xf86ModeWidth(mode, RR_Rotate_90) > maxX)
- mode->status = MODE_VIRTUAL_X;
-
- if (xf86ModeHeight(mode, RR_Rotate_0) > maxY ||
- xf86ModeHeight(mode, RR_Rotate_90) > maxY)
- mode->status = MODE_VIRTUAL_Y;
- }
-
- if (mode->next == modeList)
- break;
+ if ((xf86ModeWidth(mode, RR_Rotate_0) > maxPitch ||
+ xf86ModeWidth(mode, RR_Rotate_0) > maxX ||
+ xf86ModeHeight(mode, RR_Rotate_0) > maxY) &&
+ (xf86ModeWidth(mode, RR_Rotate_90) > maxPitch ||
+ xf86ModeWidth(mode, RR_Rotate_90) > maxX ||
+ xf86ModeHeight(mode, RR_Rotate_90) > maxY)) {
+ if (xf86ModeWidth(mode, RR_Rotate_0) > maxPitch ||
+ xf86ModeWidth(mode, RR_Rotate_90) > maxPitch)
+ mode->status = MODE_BAD_WIDTH;
+
+ if (xf86ModeWidth(mode, RR_Rotate_0) > maxX ||
+ xf86ModeWidth(mode, RR_Rotate_90) > maxX)
+ mode->status = MODE_VIRTUAL_X;
+
+ if (xf86ModeHeight(mode, RR_Rotate_0) > maxY ||
+ xf86ModeHeight(mode, RR_Rotate_90) > maxY)
+ mode->status = MODE_VIRTUAL_Y;
+ }
+
+ if (mode->next == modeList)
+ break;
}
}
@@ -435,39 +448,39 @@ xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
* \param modeList doubly-linked list of modes.
*/
void
-xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- MonPtr mon)
+xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, MonPtr mon)
{
DisplayModePtr mode;
for (mode = modeList; mode != NULL; mode = mode->next) {
- Bool bad;
- int i;
-
- bad = TRUE;
- for (i = 0; i < mon->nHsync; i++) {
- if (xf86ModeHSync(mode) >= mon->hsync[i].lo * (1-SYNC_TOLERANCE) &&
- xf86ModeHSync(mode) <= mon->hsync[i].hi * (1+SYNC_TOLERANCE))
- {
- bad = FALSE;
- }
- }
- if (bad)
- mode->status = MODE_HSYNC;
-
- bad = TRUE;
- for (i = 0; i < mon->nVrefresh; i++) {
- if (xf86ModeVRefresh(mode) >= mon->vrefresh[i].lo * (1-SYNC_TOLERANCE) &&
- xf86ModeVRefresh(mode) <= mon->vrefresh[i].hi * (1+SYNC_TOLERANCE))
- {
- bad = FALSE;
- }
- }
- if (bad)
- mode->status = MODE_VSYNC;
-
- if (mode->next == modeList)
- break;
+ Bool bad;
+ int i;
+
+ bad = TRUE;
+ for (i = 0; i < mon->nHsync; i++) {
+ if (xf86ModeHSync(mode) >= mon->hsync[i].lo * (1 - SYNC_TOLERANCE)
+ && xf86ModeHSync(mode) <=
+ mon->hsync[i].hi * (1 + SYNC_TOLERANCE)) {
+ bad = FALSE;
+ }
+ }
+ if (bad)
+ mode->status = MODE_HSYNC;
+
+ bad = TRUE;
+ for (i = 0; i < mon->nVrefresh; i++) {
+ if (xf86ModeVRefresh(mode) >=
+ mon->vrefresh[i].lo * (1 - SYNC_TOLERANCE) &&
+ xf86ModeVRefresh(mode) <=
+ mon->vrefresh[i].hi * (1 + SYNC_TOLERANCE)) {
+ bad = FALSE;
+ }
+ }
+ if (bad)
+ mode->status = MODE_VSYNC;
+
+ if (mode->next == modeList)
+ break;
}
}
@@ -481,22 +494,23 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
*/
void
xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int *min, int *max, int n_ranges)
+ int *min, int *max, int n_ranges)
{
DisplayModePtr mode;
int i;
for (mode = modeList; mode != NULL; mode = mode->next) {
- Bool good = FALSE;
- for (i = 0; i < n_ranges; i++) {
- if (mode->Clock >= min[i] * (1-SYNC_TOLERANCE) &&
- mode->Clock <= max[i] * (1+SYNC_TOLERANCE)) {
- good = TRUE;
- break;
- }
- }
- if (!good)
- mode->status = MODE_CLOCK_RANGE;
+ Bool good = FALSE;
+
+ for (i = 0; i < n_ranges; i++) {
+ if (mode->Clock >= min[i] * (1 - SYNC_TOLERANCE) &&
+ mode->Clock <= max[i] * (1 + SYNC_TOLERANCE)) {
+ good = TRUE;
+ break;
+ }
+ }
+ if (!good)
+ mode->status = MODE_CLOCK_RANGE;
}
}
@@ -518,25 +532,24 @@ xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
DisplayModePtr mode;
if (pScrn->display->modes[0] == NULL)
- return;
+ return;
for (mode = modeList; mode != NULL; mode = mode->next) {
- int i;
- Bool good = FALSE;
-
- for (i = 0; pScrn->display->modes[i] != NULL; i++) {
- if (strncmp(pScrn->display->modes[i], mode->name,
- strlen(pScrn->display->modes[i])) == 0) {
- good = TRUE;
- break;
- }
- }
- if (!good)
- mode->status = MODE_BAD;
+ int i;
+ Bool good = FALSE;
+
+ for (i = 0; pScrn->display->modes[i] != NULL; i++) {
+ if (strncmp(pScrn->display->modes[i], mode->name,
+ strlen(pScrn->display->modes[i])) == 0) {
+ good = TRUE;
+ break;
+ }
+ }
+ if (!good)
+ mode->status = MODE_BAD;
}
}
-
/**
* Marks as bad any modes exceeding the given bandwidth.
*
@@ -546,25 +559,25 @@ xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
*/
void
xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- unsigned int bandwidth, int depth)
+ unsigned int bandwidth, int depth)
{
DisplayModePtr mode;
for (mode = modeList; mode != NULL; mode = mode->next) {
- if (xf86ModeBandwidth(mode, depth) > bandwidth)
- mode->status = MODE_BANDWIDTH;
+ if (xf86ModeBandwidth(mode, depth) > bandwidth)
+ mode->status = MODE_BANDWIDTH;
}
}
Bool
-xf86ModeIsReduced(const DisplayModeRec *mode)
+xf86ModeIsReduced(const DisplayModeRec * mode)
{
if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) &&
((mode->HTotal - mode->HDisplay) == 160) &&
- ((mode->HSyncEnd - mode->HDisplay) == 80) &&
- ((mode->HSyncEnd - mode->HSyncStart) == 32) &&
- ((mode->VSyncStart - mode->VDisplay) == 3))
- return TRUE;
+ ((mode->HSyncEnd - mode->HDisplay) == 80) &&
+ ((mode->HSyncEnd - mode->HSyncStart) == 32) &&
+ ((mode->VSyncStart - mode->VDisplay) == 3))
+ return TRUE;
return FALSE;
}
@@ -577,8 +590,8 @@ void
xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList)
{
for (; modeList != NULL; modeList = modeList->next)
- if (xf86ModeIsReduced(modeList))
- modeList->status = MODE_NO_REDUCED;
+ if (xf86ModeIsReduced(modeList))
+ modeList->status = MODE_NO_REDUCED;
}
/**
@@ -589,31 +602,32 @@ xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList)
* printed.
*/
void
-xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
- Bool verbose)
+xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr * modeList,
+ Bool verbose)
{
DisplayModePtr mode;
for (mode = *modeList; mode != NULL;) {
- DisplayModePtr next = mode->next, first = *modeList;
-
- if (mode->status != MODE_OK) {
- if (verbose) {
- const char *type = "";
- if (mode->type & M_T_BUILTIN)
- type = "built-in ";
- else if (mode->type & M_T_DEFAULT)
- type = "default ";
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Not using %smode \"%s\" (%s)\n", type, mode->name,
- xf86ModeStatusToString(mode->status));
- }
- xf86DeleteMode(modeList, mode);
- }
-
- if (next == first)
- break;
- mode = next;
+ DisplayModePtr next = mode->next, first = *modeList;
+
+ if (mode->status != MODE_OK) {
+ if (verbose) {
+ const char *type = "";
+
+ if (mode->type & M_T_BUILTIN)
+ type = "built-in ";
+ else if (mode->type & M_T_DEFAULT)
+ type = "default ";
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Not using %smode \"%s\" (%s)\n", type, mode->name,
+ xf86ModeStatusToString(mode->status));
+ }
+ xf86DeleteMode(modeList, mode);
+ }
+
+ if (next == first)
+ break;
+ mode = next;
}
}
@@ -626,16 +640,16 @@ DisplayModePtr
xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
{
if (modes == NULL)
- return new;
+ return new;
if (new) {
- DisplayModePtr mode = modes;
+ DisplayModePtr mode = modes;
- while (mode->next)
- mode = mode->next;
+ while (mode->next)
+ mode = mode->next;
- mode->next = new;
- new->prev = mode;
+ mode->next = new;
+ new->prev = mode;
}
return modes;
@@ -645,42 +659,40 @@ xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
* Build a mode list from a list of config file modes
*/
static DisplayModePtr
-xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
+xf86GetConfigModes(XF86ConfModeLinePtr conf_mode)
{
- DisplayModePtr head = NULL, prev = NULL, mode;
-
- for (; conf_mode; conf_mode = (XF86ConfModeLinePtr) conf_mode->list.next)
- {
+ DisplayModePtr head = NULL, prev = NULL, mode;
+
+ for (; conf_mode; conf_mode = (XF86ConfModeLinePtr) conf_mode->list.next) {
mode = calloc(1, sizeof(DisplayModeRec));
- if (!mode)
- continue;
- mode->name = xstrdup(conf_mode->ml_identifier);
- if (!mode->name)
- {
- free(mode);
- continue;
- }
- mode->type = 0;
- mode->Clock = conf_mode->ml_clock;
- mode->HDisplay = conf_mode->ml_hdisplay;
+ if (!mode)
+ continue;
+ mode->name = xstrdup(conf_mode->ml_identifier);
+ if (!mode->name) {
+ free(mode);
+ continue;
+ }
+ mode->type = 0;
+ mode->Clock = conf_mode->ml_clock;
+ mode->HDisplay = conf_mode->ml_hdisplay;
mode->HSyncStart = conf_mode->ml_hsyncstart;
- mode->HSyncEnd = conf_mode->ml_hsyncend;
- mode->HTotal = conf_mode->ml_htotal;
- mode->VDisplay = conf_mode->ml_vdisplay;
+ mode->HSyncEnd = conf_mode->ml_hsyncend;
+ mode->HTotal = conf_mode->ml_htotal;
+ mode->VDisplay = conf_mode->ml_vdisplay;
mode->VSyncStart = conf_mode->ml_vsyncstart;
- mode->VSyncEnd = conf_mode->ml_vsyncend;
- mode->VTotal = conf_mode->ml_vtotal;
- mode->Flags = conf_mode->ml_flags;
- mode->HSkew = conf_mode->ml_hskew;
- mode->VScan = conf_mode->ml_vscan;
+ mode->VSyncEnd = conf_mode->ml_vsyncend;
+ mode->VTotal = conf_mode->ml_vtotal;
+ mode->Flags = conf_mode->ml_flags;
+ mode->HSkew = conf_mode->ml_hskew;
+ mode->VScan = conf_mode->ml_vscan;
mode->prev = prev;
- mode->next = NULL;
- if (prev)
- prev->next = mode;
- else
- head = mode;
- prev = mode;
+ mode->next = NULL;
+ if (prev)
+ prev->next = mode;
+ else
+ head = mode;
+ prev = mode;
}
return head;
}
@@ -689,49 +701,47 @@ xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
* Build a mode list from a monitor configuration
*/
DisplayModePtr
-xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
+xf86GetMonitorModes(ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
{
- DisplayModePtr modes = NULL;
- XF86ConfModesLinkPtr modes_link;
-
+ DisplayModePtr modes = NULL;
+ XF86ConfModesLinkPtr modes_link;
+
if (!conf_monitor)
- return NULL;
+ return NULL;
/*
* first we collect the mode lines from the UseModes directive
*/
- for (modes_link = conf_monitor->mon_modes_sect_lst;
- modes_link;
- modes_link = modes_link->list.next)
- {
- /* If this modes link hasn't been resolved, go look it up now */
- if (!modes_link->ml_modes)
- modes_link->ml_modes = xf86findModes (modes_link->ml_modes_str,
- xf86configptr->conf_modes_lst);
- if (modes_link->ml_modes)
- modes = xf86ModesAdd (modes,
- xf86GetConfigModes (modes_link->ml_modes->mon_modeline_lst));
+ for (modes_link = conf_monitor->mon_modes_sect_lst;
+ modes_link; modes_link = modes_link->list.next) {
+ /* If this modes link hasn't been resolved, go look it up now */
+ if (!modes_link->ml_modes)
+ modes_link->ml_modes = xf86findModes(modes_link->ml_modes_str,
+ xf86configptr->conf_modes_lst);
+ if (modes_link->ml_modes)
+ modes = xf86ModesAdd(modes,
+ xf86GetConfigModes(modes_link->ml_modes->
+ mon_modeline_lst));
}
- return xf86ModesAdd (modes,
- xf86GetConfigModes (conf_monitor->mon_modeline_lst));
+ return xf86ModesAdd(modes,
+ xf86GetConfigModes(conf_monitor->mon_modeline_lst));
}
/**
* Build a mode list containing all of the default modes
*/
DisplayModePtr
-xf86GetDefaultModes (void)
+xf86GetDefaultModes(void)
{
- DisplayModePtr head = NULL, mode;
- int i;
-
- for (i = 0; i < xf86NumDefaultModes; i++)
- {
- const DisplayModeRec *defMode = &xf86DefaultModes[i];
-
- mode = xf86DuplicateMode(defMode);
- head = xf86ModesAdd(head, mode);
+ DisplayModePtr head = NULL, mode;
+ int i;
+
+ for (i = 0; i < xf86NumDefaultModes; i++) {
+ const DisplayModeRec *defMode = &xf86DefaultModes[i];
+
+ mode = xf86DuplicateMode(defMode);
+ head = xf86ModesAdd(head, mode);
}
return head;
}
@@ -752,19 +762,19 @@ xf86PruneDuplicateModes(DisplayModePtr modes)
{
DisplayModePtr m, n, o;
-top:
+ top:
for (m = modes; m; m = m->next) {
- for (n = m->next; n; n = o) {
- o = n->next;
- if (xf86ModesEqual(m, n)) {
- if (n->type & M_T_PREFERRED) {
- xf86DeleteMode(&modes, m);
- goto top;
- }
- else
- xf86DeleteMode(&modes, n);
- }
- }
+ for (n = m->next; n; n = o) {
+ o = n->next;
+ if (xf86ModesEqual(m, n)) {
+ if (n->type & M_T_PREFERRED) {
+ xf86DeleteMode(&modes, m);
+ goto top;
+ }
+ else
+ xf86DeleteMode(&modes, n);
+ }
+ }
}
return modes;
diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.h b/xorg-server/hw/xfree86/modes/xf86Modes.h
index 89ec0d81d..aec7688c4 100644
--- a/xorg-server/hw/xfree86/modes/xf86Modes.h
+++ b/xorg-server/hw/xfree86/modes/xf86Modes.h
@@ -40,74 +40,78 @@
#include "xf86Rename.h"
#endif
-extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec *mode);
-extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec *mode);
+extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec * mode);
+extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec * mode);
extern _X_EXPORT unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth);
extern _X_EXPORT int
-xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation);
-
+ xf86ModeWidth(const DisplayModeRec * mode, Rotation rotation);
+
extern _X_EXPORT int
-xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation);
+ xf86ModeHeight(const DisplayModeRec * mode, Rotation rotation);
-extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode);
+extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec * pMode);
extern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
- DisplayModePtr modeList);
+ DisplayModePtr modeList);
extern _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode);
extern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
-extern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec *pMode1,
- const DisplayModeRec *pMode2);
-extern _X_EXPORT void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
-extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
+extern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec * pMode1,
+ const DisplayModeRec * pMode2);
+extern _X_EXPORT void xf86PrintModeline(int scrnIndex, DisplayModePtr mode);
+extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes,
+ DisplayModePtr new);
extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
-extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
- Bool Reduced, Bool Interlaced);
-extern _X_EXPORT DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins);
+extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay,
+ float VRefresh, Bool Reduced,
+ Bool Interlaced);
+extern _X_EXPORT DisplayModePtr xf86GTFMode(int h_pixels, int v_lines,
+ float freq, int interlaced,
+ int margins);
extern _X_EXPORT Bool
-xf86ModeIsReduced(const DisplayModeRec *mode);
+ xf86ModeIsReduced(const DisplayModeRec * mode);
extern _X_EXPORT void
-xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int flags);
+ xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, int flags);
extern _X_EXPORT void
+
xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int *min, int *max, int n_ranges);
+ int *min, int *max, int n_ranges);
extern _X_EXPORT void
+
xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int maxX, int maxY, int maxPitch);
+ int maxX, int maxY, int maxPitch);
extern _X_EXPORT void
-xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- MonPtr mon);
+ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, MonPtr mon);
extern _X_EXPORT void
+
xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- unsigned int bandwidth, int depth);
+ unsigned int bandwidth, int depth);
extern _X_EXPORT void
-xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList);
+ xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList);
extern _X_EXPORT void
-xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
- Bool verbose);
-extern _X_EXPORT DisplayModePtr
-xf86PruneDuplicateModes(DisplayModePtr modes);
+xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr * modeList,
+ Bool verbose);
+
+extern _X_EXPORT DisplayModePtr xf86PruneDuplicateModes(DisplayModePtr modes);
extern _X_EXPORT void
-xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
+ xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
extern _X_EXPORT DisplayModePtr
-xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
+xf86GetMonitorModes(ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
-extern _X_EXPORT DisplayModePtr
-xf86GetDefaultModes (void);
+extern _X_EXPORT DisplayModePtr xf86GetDefaultModes(void);
extern _X_EXPORT void
-xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC);
+ xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC);
-#endif /* _XF86MODES_H_ */
+#endif /* _XF86MODES_H_ */
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c
index d5031a2f1..a773c34c6 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.c
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c
@@ -43,16 +43,16 @@
#include "xf86RandR12.h"
typedef struct _xf86RandR12Info {
- int virtualX;
- int virtualY;
- int mmWidth;
- int mmHeight;
- int maxX;
- int maxY;
- int pointerX;
- int pointerY;
- Rotation rotation; /* current mode */
- Rotation supported_rotations; /* driver supported */
+ int virtualX;
+ int virtualY;
+ int mmWidth;
+ int mmHeight;
+ int maxX;
+ int maxY;
+ int pointerX;
+ int pointerY;
+ Rotation rotation; /* current mode */
+ Rotation supported_rotations; /* driver supported */
/* Used to wrap EnterVT so we can re-probe the outputs when a laptop unsuspends
* (actually, any time that we switch back into our VT).
@@ -63,106 +63,117 @@ typedef struct _xf86RandR12Info {
} XF86RandRInfoRec, *XF86RandRInfoPtr;
#ifdef RANDR_12_INTERFACE
-static Bool xf86RandR12Init12 (ScreenPtr pScreen);
-static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
+static Bool xf86RandR12Init12(ScreenPtr pScreen);
+static Bool xf86RandR12CreateScreenResources12(ScreenPtr pScreen);
#endif
static int xf86RandR12Generation;
static DevPrivateKeyRec xf86RandR12KeyRec;
static DevPrivateKey xf86RandR12Key;
+
#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
-
static int
-xf86RandR12ModeRefresh (DisplayModePtr mode)
+xf86RandR12ModeRefresh(DisplayModePtr mode)
{
if (mode->VRefresh)
- return (int) (mode->VRefresh + 0.5);
+ return (int) (mode->VRefresh + 0.5);
else
- return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
+ return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
}
/* Adapt panning area; return TRUE if panning area was valid without adaption */
static int
-xf86RandR13VerifyPanningArea (xf86CrtcPtr crtc, int screenWidth, int screenHeight)
+xf86RandR13VerifyPanningArea(xf86CrtcPtr crtc, int screenWidth,
+ int screenHeight)
{
int ret = TRUE;
if (crtc->version < 2)
- return FALSE;
+ return FALSE;
if (crtc->panningTotalArea.x2 <= crtc->panningTotalArea.x1) {
- /* Panning in X is disabled */
- if (crtc->panningTotalArea.x1 || crtc->panningTotalArea.x2)
- /* Illegal configuration -> fail/disable */
- ret = FALSE;
- crtc->panningTotalArea.x1 = crtc->panningTotalArea.x2 = 0;
- crtc->panningTrackingArea.x1 = crtc->panningTrackingArea.x2 = 0;
- crtc->panningBorder[0] = crtc->panningBorder[2] = 0;
- } else {
- /* Panning in X is enabled */
- if (crtc->panningTotalArea.x1 < 0) {
- /* Panning region outside screen -> move inside */
- crtc->panningTotalArea.x2 -= crtc->panningTotalArea.x1;
- crtc->panningTotalArea.x1 = 0;
- ret = FALSE;
- }
- if (crtc->panningTotalArea.x2 < crtc->panningTotalArea.x1 + crtc->mode.HDisplay) {
- /* Panning region smaller than displayed area -> crop to displayed area */
- crtc->panningTotalArea.x2 = crtc->panningTotalArea.x1 + crtc->mode.HDisplay;
- ret = FALSE;
- }
- if (crtc->panningTotalArea.x2 > screenWidth) {
- /* Panning region larger than screen -> move inside, then crop to screen */
- crtc->panningTotalArea.x1 -= crtc->panningTotalArea.x2 - screenWidth;
- crtc->panningTotalArea.x2 = screenWidth;
- ret = FALSE;
- if (crtc->panningTotalArea.x1 < 0)
- crtc->panningTotalArea.x1 = 0;
- }
- if (crtc->panningBorder[0] + crtc->panningBorder[2] > crtc->mode.HDisplay) {
- /* Borders too large -> set to 0 */
- crtc->panningBorder[0] = crtc->panningBorder[2] = 0;
- ret = FALSE;
- }
+ /* Panning in X is disabled */
+ if (crtc->panningTotalArea.x1 || crtc->panningTotalArea.x2)
+ /* Illegal configuration -> fail/disable */
+ ret = FALSE;
+ crtc->panningTotalArea.x1 = crtc->panningTotalArea.x2 = 0;
+ crtc->panningTrackingArea.x1 = crtc->panningTrackingArea.x2 = 0;
+ crtc->panningBorder[0] = crtc->panningBorder[2] = 0;
+ }
+ else {
+ /* Panning in X is enabled */
+ if (crtc->panningTotalArea.x1 < 0) {
+ /* Panning region outside screen -> move inside */
+ crtc->panningTotalArea.x2 -= crtc->panningTotalArea.x1;
+ crtc->panningTotalArea.x1 = 0;
+ ret = FALSE;
+ }
+ if (crtc->panningTotalArea.x2 <
+ crtc->panningTotalArea.x1 + crtc->mode.HDisplay) {
+ /* Panning region smaller than displayed area -> crop to displayed area */
+ crtc->panningTotalArea.x2 =
+ crtc->panningTotalArea.x1 + crtc->mode.HDisplay;
+ ret = FALSE;
+ }
+ if (crtc->panningTotalArea.x2 > screenWidth) {
+ /* Panning region larger than screen -> move inside, then crop to screen */
+ crtc->panningTotalArea.x1 -=
+ crtc->panningTotalArea.x2 - screenWidth;
+ crtc->panningTotalArea.x2 = screenWidth;
+ ret = FALSE;
+ if (crtc->panningTotalArea.x1 < 0)
+ crtc->panningTotalArea.x1 = 0;
+ }
+ if (crtc->panningBorder[0] + crtc->panningBorder[2] >
+ crtc->mode.HDisplay) {
+ /* Borders too large -> set to 0 */
+ crtc->panningBorder[0] = crtc->panningBorder[2] = 0;
+ ret = FALSE;
+ }
}
if (crtc->panningTotalArea.y2 <= crtc->panningTotalArea.y1) {
- /* Panning in Y is disabled */
- if (crtc->panningTotalArea.y1 || crtc->panningTotalArea.y2)
- /* Illegal configuration -> fail/disable */
- ret = FALSE;
- crtc->panningTotalArea.y1 = crtc->panningTotalArea.y2 = 0;
- crtc->panningTrackingArea.y1 = crtc->panningTrackingArea.y2 = 0;
- crtc->panningBorder[1] = crtc->panningBorder[3] = 0;
- } else {
- /* Panning in Y is enabled */
- if (crtc->panningTotalArea.y1 < 0) {
- /* Panning region outside screen -> move inside */
- crtc->panningTotalArea.y2 -= crtc->panningTotalArea.y1;
- crtc->panningTotalArea.y1 = 0;
- ret = FALSE;
- }
- if (crtc->panningTotalArea.y2 < crtc->panningTotalArea.y1 + crtc->mode.VDisplay) {
- /* Panning region smaller than displayed area -> crop to displayed area */
- crtc->panningTotalArea.y2 = crtc->panningTotalArea.y1 + crtc->mode.VDisplay;
- ret = FALSE;
- }
- if (crtc->panningTotalArea.y2 > screenHeight) {
- /* Panning region larger than screen -> move inside, then crop to screen */
- crtc->panningTotalArea.y1 -= crtc->panningTotalArea.y2 - screenHeight;
- crtc->panningTotalArea.y2 = screenHeight;
- ret = FALSE;
- if (crtc->panningTotalArea.y1 < 0)
- crtc->panningTotalArea.y1 = 0;
- }
- if (crtc->panningBorder[1] + crtc->panningBorder[3] > crtc->mode.VDisplay) {
- /* Borders too large -> set to 0 */
- crtc->panningBorder[1] = crtc->panningBorder[3] = 0;
- ret = FALSE;
- }
+ /* Panning in Y is disabled */
+ if (crtc->panningTotalArea.y1 || crtc->panningTotalArea.y2)
+ /* Illegal configuration -> fail/disable */
+ ret = FALSE;
+ crtc->panningTotalArea.y1 = crtc->panningTotalArea.y2 = 0;
+ crtc->panningTrackingArea.y1 = crtc->panningTrackingArea.y2 = 0;
+ crtc->panningBorder[1] = crtc->panningBorder[3] = 0;
+ }
+ else {
+ /* Panning in Y is enabled */
+ if (crtc->panningTotalArea.y1 < 0) {
+ /* Panning region outside screen -> move inside */
+ crtc->panningTotalArea.y2 -= crtc->panningTotalArea.y1;
+ crtc->panningTotalArea.y1 = 0;
+ ret = FALSE;
+ }
+ if (crtc->panningTotalArea.y2 <
+ crtc->panningTotalArea.y1 + crtc->mode.VDisplay) {
+ /* Panning region smaller than displayed area -> crop to displayed area */
+ crtc->panningTotalArea.y2 =
+ crtc->panningTotalArea.y1 + crtc->mode.VDisplay;
+ ret = FALSE;
+ }
+ if (crtc->panningTotalArea.y2 > screenHeight) {
+ /* Panning region larger than screen -> move inside, then crop to screen */
+ crtc->panningTotalArea.y1 -=
+ crtc->panningTotalArea.y2 - screenHeight;
+ crtc->panningTotalArea.y2 = screenHeight;
+ ret = FALSE;
+ if (crtc->panningTotalArea.y1 < 0)
+ crtc->panningTotalArea.y1 = 0;
+ }
+ if (crtc->panningBorder[1] + crtc->panningBorder[3] >
+ crtc->mode.VDisplay) {
+ /* Borders too large -> set to 0 */
+ crtc->panningBorder[1] = crtc->panningBorder[3] = 0;
+ ret = FALSE;
+ }
}
return ret;
@@ -179,232 +190,232 @@ xf86RandR13VerifyPanningArea (xf86CrtcPtr crtc, int screenWidth, int screenHeigh
*/
static void
-xf86ComputeCrtcPan (Bool transform_in_use,
- struct pixman_f_transform *m,
- double screen_x, double screen_y,
- double crtc_x, double crtc_y,
- int old_pan_x, int old_pan_y,
- int *new_pan_x, int *new_pan_y)
+xf86ComputeCrtcPan(Bool transform_in_use,
+ struct pixman_f_transform *m,
+ double screen_x, double screen_y,
+ double crtc_x, double crtc_y,
+ int old_pan_x, int old_pan_y, int *new_pan_x, int *new_pan_y)
{
if (transform_in_use) {
- /*
- * Given the current transform, M, the current position
- * on the Screen, S, and the desired position on the CRTC,
- * C, compute a translation, T, such that:
- *
- * M T S = C
- *
- * where T is of the form
- *
- * | 1 0 dx |
- * | 0 1 dy |
- * | 0 0 1 |
- *
- * M T S =
- * | M00 Sx + M01 Sy + M00 dx + M01 dy + M02 | | Cx F |
- * | M10 Sx + M11 Sy + M10 dx + M11 dy + M12 | = | Cy F |
- * | M20 Sx + M21 Sy + M20 dx + M21 dy + M22 | | F |
- *
- * R = M S
- *
- * Cx F = M00 dx + M01 dy + R0
- * Cy F = M10 dx + M11 dy + R1
- * F = M20 dx + M21 dy + R2
- *
- * Zero out dx, then dy
- *
- * F (Cx M10 - Cy M00) =
- * (M10 M01 - M00 M11) dy + M10 R0 - M00 R1
- * F (M10 - Cy M20) =
- * (M10 M21 - M20 M11) dy + M10 R2 - M20 R1
- *
- * F (Cx M11 - Cy M01) =
- * (M11 M00 - M01 M10) dx + M11 R0 - M01 R1
- * F (M11 - Cy M21) =
- * (M11 M20 - M21 M10) dx + M11 R2 - M21 R1
- *
- * Make some temporaries
- *
- * T = | Cx M10 - Cy M00 |
- * | Cx M11 - Cy M01 |
- *
- * U = | M10 M01 - M00 M11 |
- * | M11 M00 - M01 M10 |
- *
- * Q = | M10 R0 - M00 R1 |
- * | M11 R0 - M01 R1 |
- *
- * P = | M10 - Cy M20 |
- * | M11 - Cy M21 |
- *
- * W = | M10 M21 - M20 M11 |
- * | M11 M20 - M21 M10 |
- *
- * V = | M10 R2 - M20 R1 |
- * | M11 R2 - M21 R1 |
- *
- * Rewrite:
- *
- * F T0 = U0 dy + Q0
- * F P0 = W0 dy + V0
- * F T1 = U1 dx + Q1
- * F P1 = W1 dx + V1
- *
- * Solve for F (two ways)
- *
- * F (W0 T0 - U0 P0) = W0 Q0 - U0 V0
- *
- * W0 Q0 - U0 V0
- * F = -------------
- * W0 T0 - U0 P0
- *
- * F (W1 T1 - U1 P1) = W1 Q1 - U1 V1
- *
- * W1 Q1 - U1 V1
- * F = -------------
- * W1 T1 - U1 P1
- *
- * We'll use which ever solution works (denominator != 0)
- *
- * Finally, solve for dx and dy:
- *
- * dx = (F T1 - Q1) / U1
- * dx = (F P1 - V1) / W1
- *
- * dy = (F T0 - Q0) / U0
- * dy = (F P0 - V0) / W0
- */
- double r[3];
- double q[2], u[2], t[2], v[2], w[2], p[2];
- double f;
- struct pict_f_vector d;
- int i;
-
- /* Get the un-normalized crtc coordinates again */
- for (i = 0; i < 3; i++)
- r[i] = m->m[i][0] * screen_x + m->m[i][1] * screen_y + m->m[i][2];
-
- /* Combine values into temporaries */
- for (i = 0; i < 2; i++) {
- q[i] = m->m[1][i] * r[0] - m->m[0][i] * r[1];
- u[i] = m->m[1][i] * m->m[0][1-i] - m->m[0][i] * m->m[1][1-i];
- t[i] = m->m[1][i] * crtc_x - m->m[0][i] * crtc_y;
-
- v[i] = m->m[1][i] * r[2] - m->m[2][i] * r[1];
- w[i] = m->m[1][i] * m->m[2][1-i] - m->m[2][i] * m->m[1][1-i];
- p[i] = m->m[1][i] - m->m[2][i] * crtc_y;
- }
-
- /* Find a way to compute f */
- f = 0;
- for (i = 0; i < 2; i++) {
- double a = w[i] * q[i] - u[i] * v[i];
- double b = w[i] * t[i] - u[i] * p[i];
- if (b != 0) {
- f = a/b;
- break;
- }
- }
-
- /* Solve for the resulting transform vector */
- for (i = 0; i < 2; i++) {
- if (u[i])
- d.v[1-i] = (t[i] * f - q[i]) / u[i];
- else if (w[1])
- d.v[1-i] = (p[i] * f - v[i]) / w[i];
- else
- d.v[1-i] = 0;
- }
- *new_pan_x = old_pan_x - floor (d.v[0] + 0.5);
- *new_pan_y = old_pan_y - floor (d.v[1] + 0.5);
- } else {
- *new_pan_x = screen_x - crtc_x;
- *new_pan_y = screen_y - crtc_y;
+ /*
+ * Given the current transform, M, the current position
+ * on the Screen, S, and the desired position on the CRTC,
+ * C, compute a translation, T, such that:
+ *
+ * M T S = C
+ *
+ * where T is of the form
+ *
+ * | 1 0 dx |
+ * | 0 1 dy |
+ * | 0 0 1 |
+ *
+ * M T S =
+ * | M00 Sx + M01 Sy + M00 dx + M01 dy + M02 | | Cx F |
+ * | M10 Sx + M11 Sy + M10 dx + M11 dy + M12 | = | Cy F |
+ * | M20 Sx + M21 Sy + M20 dx + M21 dy + M22 | | F |
+ *
+ * R = M S
+ *
+ * Cx F = M00 dx + M01 dy + R0
+ * Cy F = M10 dx + M11 dy + R1
+ * F = M20 dx + M21 dy + R2
+ *
+ * Zero out dx, then dy
+ *
+ * F (Cx M10 - Cy M00) =
+ * (M10 M01 - M00 M11) dy + M10 R0 - M00 R1
+ * F (M10 - Cy M20) =
+ * (M10 M21 - M20 M11) dy + M10 R2 - M20 R1
+ *
+ * F (Cx M11 - Cy M01) =
+ * (M11 M00 - M01 M10) dx + M11 R0 - M01 R1
+ * F (M11 - Cy M21) =
+ * (M11 M20 - M21 M10) dx + M11 R2 - M21 R1
+ *
+ * Make some temporaries
+ *
+ * T = | Cx M10 - Cy M00 |
+ * | Cx M11 - Cy M01 |
+ *
+ * U = | M10 M01 - M00 M11 |
+ * | M11 M00 - M01 M10 |
+ *
+ * Q = | M10 R0 - M00 R1 |
+ * | M11 R0 - M01 R1 |
+ *
+ * P = | M10 - Cy M20 |
+ * | M11 - Cy M21 |
+ *
+ * W = | M10 M21 - M20 M11 |
+ * | M11 M20 - M21 M10 |
+ *
+ * V = | M10 R2 - M20 R1 |
+ * | M11 R2 - M21 R1 |
+ *
+ * Rewrite:
+ *
+ * F T0 = U0 dy + Q0
+ * F P0 = W0 dy + V0
+ * F T1 = U1 dx + Q1
+ * F P1 = W1 dx + V1
+ *
+ * Solve for F (two ways)
+ *
+ * F (W0 T0 - U0 P0) = W0 Q0 - U0 V0
+ *
+ * W0 Q0 - U0 V0
+ * F = -------------
+ * W0 T0 - U0 P0
+ *
+ * F (W1 T1 - U1 P1) = W1 Q1 - U1 V1
+ *
+ * W1 Q1 - U1 V1
+ * F = -------------
+ * W1 T1 - U1 P1
+ *
+ * We'll use which ever solution works (denominator != 0)
+ *
+ * Finally, solve for dx and dy:
+ *
+ * dx = (F T1 - Q1) / U1
+ * dx = (F P1 - V1) / W1
+ *
+ * dy = (F T0 - Q0) / U0
+ * dy = (F P0 - V0) / W0
+ */
+ double r[3];
+ double q[2], u[2], t[2], v[2], w[2], p[2];
+ double f;
+ struct pict_f_vector d;
+ int i;
+
+ /* Get the un-normalized crtc coordinates again */
+ for (i = 0; i < 3; i++)
+ r[i] = m->m[i][0] * screen_x + m->m[i][1] * screen_y + m->m[i][2];
+
+ /* Combine values into temporaries */
+ for (i = 0; i < 2; i++) {
+ q[i] = m->m[1][i] * r[0] - m->m[0][i] * r[1];
+ u[i] = m->m[1][i] * m->m[0][1 - i] - m->m[0][i] * m->m[1][1 - i];
+ t[i] = m->m[1][i] * crtc_x - m->m[0][i] * crtc_y;
+
+ v[i] = m->m[1][i] * r[2] - m->m[2][i] * r[1];
+ w[i] = m->m[1][i] * m->m[2][1 - i] - m->m[2][i] * m->m[1][1 - i];
+ p[i] = m->m[1][i] - m->m[2][i] * crtc_y;
+ }
+
+ /* Find a way to compute f */
+ f = 0;
+ for (i = 0; i < 2; i++) {
+ double a = w[i] * q[i] - u[i] * v[i];
+ double b = w[i] * t[i] - u[i] * p[i];
+
+ if (b != 0) {
+ f = a / b;
+ break;
+ }
+ }
+
+ /* Solve for the resulting transform vector */
+ for (i = 0; i < 2; i++) {
+ if (u[i])
+ d.v[1 - i] = (t[i] * f - q[i]) / u[i];
+ else if (w[1])
+ d.v[1 - i] = (p[i] * f - v[i]) / w[i];
+ else
+ d.v[1 - i] = 0;
+ }
+ *new_pan_x = old_pan_x - floor(d.v[0] + 0.5);
+ *new_pan_y = old_pan_y - floor(d.v[1] + 0.5);
+ }
+ else {
+ *new_pan_x = screen_x - crtc_x;
+ *new_pan_y = screen_y - crtc_y;
}
}
static void
-xf86RandR13Pan (xf86CrtcPtr crtc, int x, int y)
+xf86RandR13Pan(xf86CrtcPtr crtc, int x, int y)
{
int newX, newY;
int width, height;
Bool panned = FALSE;
if (crtc->version < 2)
- return;
+ return;
- if (! crtc->enabled ||
- (crtc->panningTotalArea.x2 <= crtc->panningTotalArea.x1 &&
- crtc->panningTotalArea.y2 <= crtc->panningTotalArea.y1))
- return;
+ if (!crtc->enabled ||
+ (crtc->panningTotalArea.x2 <= crtc->panningTotalArea.x1 &&
+ crtc->panningTotalArea.y2 <= crtc->panningTotalArea.y1))
+ return;
- newX = crtc->x;
- newY = crtc->y;
- width = crtc->mode.HDisplay;
+ newX = crtc->x;
+ newY = crtc->y;
+ width = crtc->mode.HDisplay;
height = crtc->mode.VDisplay;
if ((crtc->panningTrackingArea.x2 <= crtc->panningTrackingArea.x1 ||
- (x >= crtc->panningTrackingArea.x1 && x < crtc->panningTrackingArea.x2)) &&
- (crtc->panningTrackingArea.y2 <= crtc->panningTrackingArea.y1 ||
- (y >= crtc->panningTrackingArea.y1 && y < crtc->panningTrackingArea.y2)))
- {
- struct pict_f_vector c;
-
- /*
- * Pre-clip the mouse position to the panning area so that we don't
- * push the crtc outside. This doesn't deal with changes to the
- * panning values, only mouse position changes.
- */
- if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1)
- {
- if (x < crtc->panningTotalArea.x1)
- x = crtc->panningTotalArea.x1;
- if (x >= crtc->panningTotalArea.x2)
- x = crtc->panningTotalArea.x2 - 1;
- }
- if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1)
- {
- if (y < crtc->panningTotalArea.y1)
- y = crtc->panningTotalArea.y1;
- if (y >= crtc->panningTotalArea.y2)
- y = crtc->panningTotalArea.y2 - 1;
- }
-
- c.v[0] = x;
- c.v[1] = y;
- c.v[2] = 1.0;
- if (crtc->transform_in_use) {
- pixman_f_transform_point(&crtc->f_framebuffer_to_crtc, &c);
- } else {
- c.v[0] -= crtc->x;
- c.v[1] -= crtc->y;
- }
-
- if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
- if (c.v[0] < crtc->panningBorder[0]) {
- c.v[0] = crtc->panningBorder[0];
- panned = TRUE;
- }
- if (c.v[0] >= width - crtc->panningBorder[2]) {
- c.v[0] = width - crtc->panningBorder[2] - 1;
- panned = TRUE;
- }
- }
- if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
- if (c.v[1] < crtc->panningBorder[1]) {
- c.v[1] = crtc->panningBorder[1];
- panned = TRUE;
- }
- if (c.v[1] >= height - crtc->panningBorder[3]) {
- c.v[1] = height - crtc->panningBorder[3] - 1;
- panned = TRUE;
- }
- }
- if (panned)
- xf86ComputeCrtcPan (crtc->transform_in_use,
- &crtc->f_framebuffer_to_crtc,
- x, y, c.v[0], c.v[1],
- newX, newY, &newX, &newY);
+ (x >= crtc->panningTrackingArea.x1 &&
+ x < crtc->panningTrackingArea.x2)) &&
+ (crtc->panningTrackingArea.y2 <= crtc->panningTrackingArea.y1 ||
+ (y >= crtc->panningTrackingArea.y1 &&
+ y < crtc->panningTrackingArea.y2))) {
+ struct pict_f_vector c;
+
+ /*
+ * Pre-clip the mouse position to the panning area so that we don't
+ * push the crtc outside. This doesn't deal with changes to the
+ * panning values, only mouse position changes.
+ */
+ if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
+ if (x < crtc->panningTotalArea.x1)
+ x = crtc->panningTotalArea.x1;
+ if (x >= crtc->panningTotalArea.x2)
+ x = crtc->panningTotalArea.x2 - 1;
+ }
+ if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
+ if (y < crtc->panningTotalArea.y1)
+ y = crtc->panningTotalArea.y1;
+ if (y >= crtc->panningTotalArea.y2)
+ y = crtc->panningTotalArea.y2 - 1;
+ }
+
+ c.v[0] = x;
+ c.v[1] = y;
+ c.v[2] = 1.0;
+ if (crtc->transform_in_use) {
+ pixman_f_transform_point(&crtc->f_framebuffer_to_crtc, &c);
+ }
+ else {
+ c.v[0] -= crtc->x;
+ c.v[1] -= crtc->y;
+ }
+
+ if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
+ if (c.v[0] < crtc->panningBorder[0]) {
+ c.v[0] = crtc->panningBorder[0];
+ panned = TRUE;
+ }
+ if (c.v[0] >= width - crtc->panningBorder[2]) {
+ c.v[0] = width - crtc->panningBorder[2] - 1;
+ panned = TRUE;
+ }
+ }
+ if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
+ if (c.v[1] < crtc->panningBorder[1]) {
+ c.v[1] = crtc->panningBorder[1];
+ panned = TRUE;
+ }
+ if (c.v[1] >= height - crtc->panningBorder[3]) {
+ c.v[1] = height - crtc->panningBorder[3] - 1;
+ panned = TRUE;
+ }
+ }
+ if (panned)
+ xf86ComputeCrtcPan(crtc->transform_in_use,
+ &crtc->f_framebuffer_to_crtc,
+ x, y, c.v[0], c.v[1], newX, newY, &newX, &newY);
}
/*
@@ -413,131 +424,119 @@ xf86RandR13Pan (xf86CrtcPtr crtc, int x, int y)
* XXX This computation only works when we do not have a transform
* in use.
*/
- if (!crtc->transform_in_use)
- {
- /* Validate against [xy]1 after [xy]2, to be sure that results are > 0 for [xy]1 > 0 */
- if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
- if (newX > crtc->panningTotalArea.x2 - width)
- newX = crtc->panningTotalArea.x2 - width;
- if (newX < crtc->panningTotalArea.x1)
- newX = crtc->panningTotalArea.x1;
- }
- if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
- if (newY > crtc->panningTotalArea.y2 - height)
- newY = crtc->panningTotalArea.y2 - height;
- if (newY < crtc->panningTotalArea.y1)
- newY = crtc->panningTotalArea.y1;
- }
+ if (!crtc->transform_in_use) {
+ /* Validate against [xy]1 after [xy]2, to be sure that results are > 0 for [xy]1 > 0 */
+ if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
+ if (newX > crtc->panningTotalArea.x2 - width)
+ newX = crtc->panningTotalArea.x2 - width;
+ if (newX < crtc->panningTotalArea.x1)
+ newX = crtc->panningTotalArea.x1;
+ }
+ if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
+ if (newY > crtc->panningTotalArea.y2 - height)
+ newY = crtc->panningTotalArea.y2 - height;
+ if (newY < crtc->panningTotalArea.y1)
+ newY = crtc->panningTotalArea.y1;
+ }
}
if (newX != crtc->x || newY != crtc->y)
- xf86CrtcSetOrigin (crtc, newX, newY);
+ xf86CrtcSetOrigin(crtc, newX, newY);
}
static Bool
-xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
+xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations)
{
- RRScreenSizePtr pSize;
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- DisplayModePtr mode;
- int refresh0 = 60;
- int maxX = 0, maxY = 0;
+ RRScreenSizePtr pSize;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int refresh0 = 60;
+ int maxX = 0, maxY = 0;
*rotations = randrp->supported_rotations;
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = scrp->virtualX;
- randrp->virtualY = scrp->virtualY;
+ if (randrp->virtualX == -1 || randrp->virtualY == -1) {
+ randrp->virtualX = scrp->virtualX;
+ randrp->virtualY = scrp->virtualY;
}
/* Re-probe the outputs for new monitors or modes */
- if (scrp->vtSema)
- {
- xf86ProbeOutputModes (scrp, 0, 0);
- xf86SetScrnInfoModes (scrp);
+ if (scrp->vtSema) {
+ xf86ProbeOutputModes(scrp, 0, 0);
+ xf86SetScrnInfoModes(scrp);
}
- for (mode = scrp->modes; ; mode = mode->next)
- {
- int refresh = xf86RandR12ModeRefresh (mode);
- if (randrp->maxX == 0 || randrp->maxY == 0)
- {
- if (maxX < mode->HDisplay)
- maxX = mode->HDisplay;
- if (maxY < mode->VDisplay)
- maxY = mode->VDisplay;
- }
- if (mode == scrp->modes)
- refresh0 = refresh;
- pSize = RRRegisterSize (pScreen,
- mode->HDisplay, mode->VDisplay,
- randrp->mmWidth, randrp->mmHeight);
- if (!pSize)
- return FALSE;
- RRRegisterRate (pScreen, pSize, refresh);
-
- if (xf86ModesEqual(mode, scrp->currentMode))
- {
- RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize);
- }
- if (mode->next == scrp->modes)
- break;
+ for (mode = scrp->modes;; mode = mode->next) {
+ int refresh = xf86RandR12ModeRefresh(mode);
+
+ if (randrp->maxX == 0 || randrp->maxY == 0) {
+ if (maxX < mode->HDisplay)
+ maxX = mode->HDisplay;
+ if (maxY < mode->VDisplay)
+ maxY = mode->VDisplay;
+ }
+ if (mode == scrp->modes)
+ refresh0 = refresh;
+ pSize = RRRegisterSize(pScreen,
+ mode->HDisplay, mode->VDisplay,
+ randrp->mmWidth, randrp->mmHeight);
+ if (!pSize)
+ return FALSE;
+ RRRegisterRate(pScreen, pSize, refresh);
+
+ if (xf86ModesEqual(mode, scrp->currentMode)) {
+ RRSetCurrentConfig(pScreen, randrp->rotation, refresh, pSize);
+ }
+ if (mode->next == scrp->modes)
+ break;
}
- if (randrp->maxX == 0 || randrp->maxY == 0)
- {
- randrp->maxX = maxX;
- randrp->maxY = maxY;
+ if (randrp->maxX == 0 || randrp->maxY == 0) {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
}
return TRUE;
}
static Bool
-xf86RandR12SetMode (ScreenPtr pScreen,
- DisplayModePtr mode,
- Bool useVirtual,
- int mmWidth,
- int mmHeight)
+xf86RandR12SetMode(ScreenPtr pScreen,
+ DisplayModePtr mode,
+ Bool useVirtual, int mmWidth, int mmHeight)
{
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- int oldWidth = pScreen->width;
- int oldHeight = pScreen->height;
- int oldmmWidth = pScreen->mmWidth;
- int oldmmHeight = pScreen->mmHeight;
- WindowPtr pRoot = pScreen->root;
- DisplayModePtr currentMode = NULL;
- Bool ret = TRUE;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int oldWidth = pScreen->width;
+ int oldHeight = pScreen->height;
+ int oldmmWidth = pScreen->mmWidth;
+ int oldmmHeight = pScreen->mmHeight;
+ WindowPtr pRoot = pScreen->root;
+ DisplayModePtr currentMode = NULL;
+ Bool ret = TRUE;
if (pRoot)
- (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
- if (useVirtual)
- {
- scrp->virtualX = randrp->virtualX;
- scrp->virtualY = randrp->virtualY;
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+ if (useVirtual) {
+ scrp->virtualX = randrp->virtualX;
+ scrp->virtualY = randrp->virtualY;
}
- else
- {
- scrp->virtualX = mode->HDisplay;
- scrp->virtualY = mode->VDisplay;
+ else {
+ scrp->virtualX = mode->HDisplay;
+ scrp->virtualY = mode->VDisplay;
}
- if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270))
- {
- /* If the screen is rotated 90 or 270 degrees, swap the sizes. */
- pScreen->width = scrp->virtualY;
- pScreen->height = scrp->virtualX;
- pScreen->mmWidth = mmHeight;
- pScreen->mmHeight = mmWidth;
+ if (randrp->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
+ /* If the screen is rotated 90 or 270 degrees, swap the sizes. */
+ pScreen->width = scrp->virtualY;
+ pScreen->height = scrp->virtualX;
+ pScreen->mmWidth = mmHeight;
+ pScreen->mmHeight = mmWidth;
}
- else
- {
- pScreen->width = scrp->virtualX;
- pScreen->height = scrp->virtualY;
- pScreen->mmWidth = mmWidth;
- pScreen->mmHeight = mmHeight;
+ else {
+ pScreen->width = scrp->virtualX;
+ pScreen->height = scrp->virtualY;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
}
if (scrp->currentMode == mode) {
/* Save current mode */
@@ -549,13 +548,12 @@ xf86RandR12SetMode (ScreenPtr pScreen,
* We know that if the driver failed to SwitchMode to the rotated
* version, then it should revert back to it's prior mode.
*/
- if (!xf86SwitchMode (pScreen, mode))
- {
+ if (!xf86SwitchMode(pScreen, mode)) {
ret = FALSE;
- scrp->virtualX = pScreen->width = oldWidth;
- scrp->virtualY = pScreen->height = oldHeight;
- pScreen->mmWidth = oldmmWidth;
- pScreen->mmHeight = oldmmHeight;
+ scrp->virtualX = pScreen->width = oldWidth;
+ scrp->virtualY = pScreen->height = oldHeight;
+ pScreen->mmWidth = oldmmWidth;
+ pScreen->mmHeight = oldmmHeight;
scrp->currentMode = currentMode;
}
@@ -567,182 +565,169 @@ xf86RandR12SetMode (ScreenPtr pScreen,
/*
* Make sure the whole screen is visible
*/
- xf86SetViewport (pScreen, pScreen->width, pScreen->height);
- xf86SetViewport (pScreen, 0, 0);
+ xf86SetViewport(pScreen, pScreen->width, pScreen->height);
+ xf86SetViewport(pScreen, 0, 0);
if (pRoot)
- (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
return ret;
}
Bool
-xf86RandR12SetConfig (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize)
+xf86RandR12SetConfig(ScreenPtr pScreen,
+ Rotation rotation, int rate, RRScreenSizePtr pSize)
{
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- DisplayModePtr mode;
- int pos[MAXDEVICES][2];
- Bool useVirtual = FALSE;
- int maxX = 0, maxY = 0;
- Rotation oldRotation = randrp->rotation;
- DeviceIntPtr dev;
- Bool view_adjusted = FALSE;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int pos[MAXDEVICES][2];
+ Bool useVirtual = FALSE;
+ int maxX = 0, maxY = 0;
+ Rotation oldRotation = randrp->rotation;
+ DeviceIntPtr dev;
+ Bool view_adjusted = FALSE;
randrp->rotation = rotation;
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = scrp->virtualX;
- randrp->virtualY = scrp->virtualY;
+ if (randrp->virtualX == -1 || randrp->virtualY == -1) {
+ randrp->virtualX = scrp->virtualX;
+ randrp->virtualY = scrp->virtualY;
}
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (!IsMaster(dev) && !IsFloating(dev))
- continue;
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (!IsMaster(dev) && !IsFloating(dev))
+ continue;
- miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]);
+ miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]);
}
- for (mode = scrp->modes; ; mode = mode->next)
- {
- if (randrp->maxX == 0 || randrp->maxY == 0)
- {
- if (maxX < mode->HDisplay)
- maxX = mode->HDisplay;
- if (maxY < mode->VDisplay)
- maxY = mode->VDisplay;
- }
- if (mode->HDisplay == pSize->width &&
- mode->VDisplay == pSize->height &&
- (rate == 0 || xf86RandR12ModeRefresh (mode) == rate))
- break;
- if (mode->next == scrp->modes)
- {
- if (pSize->width == randrp->virtualX &&
- pSize->height == randrp->virtualY)
- {
- mode = scrp->modes;
- useVirtual = TRUE;
- break;
- }
- if (randrp->maxX == 0 || randrp->maxY == 0)
- {
- randrp->maxX = maxX;
- randrp->maxY = maxY;
- }
- return FALSE;
- }
+ for (mode = scrp->modes;; mode = mode->next) {
+ if (randrp->maxX == 0 || randrp->maxY == 0) {
+ if (maxX < mode->HDisplay)
+ maxX = mode->HDisplay;
+ if (maxY < mode->VDisplay)
+ maxY = mode->VDisplay;
+ }
+ if (mode->HDisplay == pSize->width &&
+ mode->VDisplay == pSize->height &&
+ (rate == 0 || xf86RandR12ModeRefresh(mode) == rate))
+ break;
+ if (mode->next == scrp->modes) {
+ if (pSize->width == randrp->virtualX &&
+ pSize->height == randrp->virtualY) {
+ mode = scrp->modes;
+ useVirtual = TRUE;
+ break;
+ }
+ if (randrp->maxX == 0 || randrp->maxY == 0) {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
+ }
+ return FALSE;
+ }
}
- if (randrp->maxX == 0 || randrp->maxY == 0)
- {
- randrp->maxX = maxX;
- randrp->maxY = maxY;
+ if (randrp->maxX == 0 || randrp->maxY == 0) {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
}
- if (!xf86RandR12SetMode (pScreen, mode, useVirtual, pSize->mmWidth,
- pSize->mmHeight)) {
+ if (!xf86RandR12SetMode(pScreen, mode, useVirtual, pSize->mmWidth,
+ pSize->mmHeight)) {
randrp->rotation = oldRotation;
- return FALSE;
+ return FALSE;
}
/*
* Move the cursor back where it belongs; SwitchMode repositions it
* FIXME: duplicated code, see modes/xf86RandR12.c
*/
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (!IsMaster(dev) && !IsFloating(dev))
- continue;
-
- if (pScreen == miPointerGetScreen(dev)) {
- int px = pos[dev->id][0];
- int py = pos[dev->id][1];
-
- px = (px >= pScreen->width ? (pScreen->width - 1) : px);
- py = (py >= pScreen->height ? (pScreen->height - 1) : py);
-
- /* Setting the viewpoint makes only sense on one device */
- if (!view_adjusted && IsMaster(dev)) {
- xf86SetViewport(pScreen, px, py);
- view_adjusted = TRUE;
- }
-
- (*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE);
- }
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (!IsMaster(dev) && !IsFloating(dev))
+ continue;
+
+ if (pScreen == miPointerGetScreen(dev)) {
+ int px = pos[dev->id][0];
+ int py = pos[dev->id][1];
+
+ px = (px >= pScreen->width ? (pScreen->width - 1) : px);
+ py = (py >= pScreen->height ? (pScreen->height - 1) : py);
+
+ /* Setting the viewpoint makes only sense on one device */
+ if (!view_adjusted && IsMaster(dev)) {
+ xf86SetViewport(pScreen, px, py);
+ view_adjusted = TRUE;
+ }
+
+ (*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE);
+ }
}
return TRUE;
}
static Bool
-xf86RandR12ScreenSetSize (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight)
+xf86RandR12ScreenSetSize(ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height, CARD32 mmWidth, CARD32 mmHeight)
{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- WindowPtr pRoot = pScreen->root;
- PixmapPtr pScrnPix;
- Bool ret = FALSE;
- int c;
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ WindowPtr pRoot = pScreen->root;
+ PixmapPtr pScrnPix;
+ Bool ret = FALSE;
+ int c;
if (xf86RandR12Key) {
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = pScrn->virtualX;
- randrp->virtualY = pScrn->virtualY;
+ if (randrp->virtualX == -1 || randrp->virtualY == -1) {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
}
}
if (pRoot && pScrn->vtSema)
- (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
/* Let the driver update virtualX and virtualY */
- if (!(*config->funcs->resize)(pScrn, width, height))
- goto finish;
+ if (!(*config->funcs->resize) (pScrn, width, height))
+ goto finish;
ret = TRUE;
/* Update panning information */
for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
- if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1 ||
- crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
- if (crtc->panningTotalArea.x2 > crtc->panningTrackingArea.x1)
- crtc->panningTotalArea.x2 += width - pScreen->width;
- if (crtc->panningTotalArea.y2 > crtc->panningTrackingArea.y1)
- crtc->panningTotalArea.y2 += height - pScreen->height;
- if (crtc->panningTrackingArea.x2 > crtc->panningTrackingArea.x1)
- crtc->panningTrackingArea.x2 += width - pScreen->width;
- if (crtc->panningTrackingArea.y2 > crtc->panningTrackingArea.y1)
- crtc->panningTrackingArea.y2 += height - pScreen->height;
- xf86RandR13VerifyPanningArea (crtc, width, height);
- xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
- }
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1 ||
+ crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
+ if (crtc->panningTotalArea.x2 > crtc->panningTrackingArea.x1)
+ crtc->panningTotalArea.x2 += width - pScreen->width;
+ if (crtc->panningTotalArea.y2 > crtc->panningTrackingArea.y1)
+ crtc->panningTotalArea.y2 += height - pScreen->height;
+ if (crtc->panningTrackingArea.x2 > crtc->panningTrackingArea.x1)
+ crtc->panningTrackingArea.x2 += width - pScreen->width;
+ if (crtc->panningTrackingArea.y2 > crtc->panningTrackingArea.y1)
+ crtc->panningTrackingArea.y2 += height - pScreen->height;
+ xf86RandR13VerifyPanningArea(crtc, width, height);
+ xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY);
+ }
}
- pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
+ pScrnPix = (*pScreen->GetScreenPixmap) (pScreen);
pScreen->width = pScrnPix->drawable.width = width;
pScreen->height = pScrnPix->drawable.height = height;
randrp->mmWidth = pScreen->mmWidth = mmWidth;
randrp->mmHeight = pScreen->mmHeight = mmHeight;
- xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
- xf86SetViewport (pScreen, 0, 0);
+ xf86SetViewport(pScreen, pScreen->width - 1, pScreen->height - 1);
+ xf86SetViewport(pScreen, 0, 0);
-finish:
+ finish:
update_desktop_dimensions();
if (pRoot && pScrn->vtSema)
- (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
#if RANDR_12_INTERFACE
if (xf86RandR12Key && pScreen->root && ret)
- RRScreenSizeNotify (pScreen);
+ RRScreenSizeNotify(pScreen);
#endif
return ret;
}
@@ -750,24 +735,25 @@ finish:
Rotation
xf86RandR12GetRotation(ScreenPtr pScreen)
{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
return randrp->rotation;
}
Bool
-xf86RandR12CreateScreenResources (ScreenPtr pScreen)
+xf86RandR12CreateScreenResources(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config;
- XF86RandRInfoPtr randrp;
- int c;
- int width, height;
- int mmWidth, mmHeight;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config;
+ XF86RandRInfoPtr randrp;
+ int c;
+ int width, height;
+ int mmWidth, mmHeight;
+
#ifdef PANORAMIX
/* XXX disable RandR when using Xinerama */
if (!noPanoramiXExtension)
- return TRUE;
+ return TRUE;
#endif
config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -775,103 +761,91 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
/*
* Compute size of screen
*/
- width = 0; height = 0;
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
- int crtc_width = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
- int crtc_height = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
-
- if (crtc->enabled) {
- if (crtc_width > width)
- width = crtc_width;
- if (crtc_height > height)
- height = crtc_height;
- if (crtc->panningTotalArea.x2 > width)
- width = crtc->panningTotalArea.x2;
- if (crtc->panningTotalArea.y2 > height)
- height = crtc->panningTotalArea.y2;
- }
+ width = 0;
+ height = 0;
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+ int crtc_width = crtc->x + xf86ModeWidth(&crtc->mode, crtc->rotation);
+ int crtc_height = crtc->y + xf86ModeHeight(&crtc->mode, crtc->rotation);
+
+ if (crtc->enabled) {
+ if (crtc_width > width)
+ width = crtc_width;
+ if (crtc_height > height)
+ height = crtc_height;
+ if (crtc->panningTotalArea.x2 > width)
+ width = crtc->panningTotalArea.x2;
+ if (crtc->panningTotalArea.y2 > height)
+ height = crtc->panningTotalArea.y2;
+ }
}
-
- if (width && height)
- {
- /*
- * Compute physical size of screen
- */
- if (monitorResolution)
- {
- mmWidth = width * 25.4 / monitorResolution;
- mmHeight = height * 25.4 / monitorResolution;
- }
- else
- {
- xf86OutputPtr output = xf86CompatOutput(pScrn);
-
- if (output &&
- output->conf_monitor &&
- (output->conf_monitor->mon_width > 0 &&
- output->conf_monitor->mon_height > 0))
- {
- /*
- * Prefer user configured DisplaySize
- */
- mmWidth = output->conf_monitor->mon_width;
- mmHeight = output->conf_monitor->mon_height;
- }
- else
- {
- /*
- * Otherwise, just set the screen to DEFAULT_DPI
- */
- mmWidth = width * 25.4 / DEFAULT_DPI;
- mmHeight = height * 25.4 / DEFAULT_DPI;
- }
- }
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Setting screen physical size to %d x %d\n",
- mmWidth, mmHeight);
- /*
- * This is the initial setting of the screen size.
- * We have to pre-set it here, otherwise panning would be adapted
- * to the new screen size.
- */
- pScreen->width = width;
- pScreen->height = height;
- xf86RandR12ScreenSetSize (pScreen,
- width,
- height,
- mmWidth,
- mmHeight);
+
+ if (width && height) {
+ /*
+ * Compute physical size of screen
+ */
+ if (monitorResolution) {
+ mmWidth = width * 25.4 / monitorResolution;
+ mmHeight = height * 25.4 / monitorResolution;
+ }
+ else {
+ xf86OutputPtr output = xf86CompatOutput(pScrn);
+
+ if (output &&
+ output->conf_monitor &&
+ (output->conf_monitor->mon_width > 0 &&
+ output->conf_monitor->mon_height > 0)) {
+ /*
+ * Prefer user configured DisplaySize
+ */
+ mmWidth = output->conf_monitor->mon_width;
+ mmHeight = output->conf_monitor->mon_height;
+ }
+ else {
+ /*
+ * Otherwise, just set the screen to DEFAULT_DPI
+ */
+ mmWidth = width * 25.4 / DEFAULT_DPI;
+ mmHeight = height * 25.4 / DEFAULT_DPI;
+ }
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Setting screen physical size to %d x %d\n",
+ mmWidth, mmHeight);
+ /*
+ * This is the initial setting of the screen size.
+ * We have to pre-set it here, otherwise panning would be adapted
+ * to the new screen size.
+ */
+ pScreen->width = width;
+ pScreen->height = height;
+ xf86RandR12ScreenSetSize(pScreen, width, height, mmWidth, mmHeight);
}
if (xf86RandR12Key == NULL)
- return TRUE;
+ return TRUE;
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = pScrn->virtualX;
- randrp->virtualY = pScrn->virtualY;
+ if (randrp->virtualX == -1 || randrp->virtualY == -1) {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
}
- xf86CrtcSetScreenSubpixelOrder (pScreen);
+ xf86CrtcSetScreenSubpixelOrder(pScreen);
#if RANDR_12_INTERFACE
- if (xf86RandR12CreateScreenResources12 (pScreen))
- return TRUE;
+ if (xf86RandR12CreateScreenResources12(pScreen))
+ return TRUE;
#endif
return TRUE;
}
-
Bool
-xf86RandR12Init (ScreenPtr pScreen)
+xf86RandR12Init(ScreenPtr pScreen)
{
- rrScrPrivPtr rp;
- XF86RandRInfoPtr randrp;
+ rrScrPrivPtr rp;
+ XF86RandRInfoPtr randrp;
#ifdef PANORAMIX
/* XXX disable RandR when using Xinerama */
- if (!noPanoramiXExtension)
- {
+ if (!noPanoramiXExtension) {
if (xf86NumScreens == 1)
noPanoramiXExtension = TRUE;
else
@@ -880,20 +854,19 @@ xf86RandR12Init (ScreenPtr pScreen)
#endif
if (xf86RandR12Generation != serverGeneration)
- xf86RandR12Generation = serverGeneration;
+ xf86RandR12Generation = serverGeneration;
xf86RandR12Key = &xf86RandR12KeyRec;
if (!dixRegisterPrivateKey(&xf86RandR12KeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
- randrp = malloc(sizeof (XF86RandRInfoRec));
+ randrp = malloc(sizeof(XF86RandRInfoRec));
if (!randrp)
- return FALSE;
+ return FALSE;
- if (!RRScreenInit(pScreen))
- {
- free(randrp);
- return FALSE;
+ if (!RRScreenInit(pScreen)) {
+ free(randrp);
+ return FALSE;
}
rp = rrGetScrPriv(pScreen);
rp->rrGetInfo = xf86RandR12GetInfo;
@@ -904,7 +877,7 @@ xf86RandR12Init (ScreenPtr pScreen)
randrp->mmWidth = pScreen->mmWidth;
randrp->mmHeight = pScreen->mmHeight;
- randrp->rotation = RR_Rotate_0; /* initial rotated mode */
+ randrp->rotation = RR_Rotate_0; /* initial rotated mode */
randrp->supported_rotations = RR_Rotate_0;
@@ -913,19 +886,19 @@ xf86RandR12Init (ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
#if RANDR_12_INTERFACE
- if (!xf86RandR12Init12 (pScreen))
- return FALSE;
+ if (!xf86RandR12Init12(pScreen))
+ return FALSE;
#endif
return TRUE;
}
void
-xf86RandR12CloseScreen (ScreenPtr pScreen)
+xf86RandR12CloseScreen(ScreenPtr pScreen)
{
- XF86RandRInfoPtr randrp;
+ XF86RandRInfoPtr randrp;
if (xf86RandR12Key == NULL)
- return;
+ return;
randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE
@@ -936,48 +909,50 @@ xf86RandR12CloseScreen (ScreenPtr pScreen)
}
void
-xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
+xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotations)
{
- XF86RandRInfoPtr randrp;
+ XF86RandRInfoPtr randrp;
+
#if RANDR_12_INTERFACE
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- int c;
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif
if (xf86RandR12Key == NULL)
- return;
+ return;
randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE
for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
+ xf86CrtcPtr crtc = config->crtc[c];
- RRCrtcSetRotations (crtc->randr_crtc, rotations);
+ RRCrtcSetRotations(crtc->randr_crtc, rotations);
}
#endif
randrp->supported_rotations = rotations;
}
void
-xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms)
+xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms)
{
- XF86RandRInfoPtr randrp;
+ XF86RandRInfoPtr randrp;
+
#if RANDR_13_INTERFACE
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- int c;
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif
if (xf86RandR12Key == NULL)
- return;
+ return;
randrp = XF86RANDRINFO(pScreen);
#if RANDR_13_INTERFACE
for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
+ xf86CrtcPtr crtc = config->crtc[c];
- RRCrtcSetTransformSupport (crtc->randr_crtc, transforms);
+ RRCrtcSetTransformSupport(crtc->randr_crtc, transforms);
}
#endif
}
@@ -988,15 +963,15 @@ xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y)
ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
if (xf86RandR12Generation != serverGeneration ||
- XF86RANDRINFO(pScreen)->virtualX == -1)
- {
- *x = pScrn->virtualX;
- *y = pScrn->virtualY;
- } else {
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
-
- *x = randrp->virtualX;
- *y = randrp->virtualY;
+ XF86RANDRINFO(pScreen)->virtualX == -1) {
+ *x = pScrn->virtualX;
+ *y = pScrn->virtualY;
+ }
+ else {
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+
+ *x = randrp->virtualX;
+ *y = randrp->virtualY;
}
}
@@ -1018,95 +993,106 @@ xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y)
RR_ClockDivideBy2)
static Bool
-xf86RandRModeMatches (RRModePtr randr_mode,
- DisplayModePtr mode)
+xf86RandRModeMatches(RRModePtr randr_mode, DisplayModePtr mode)
{
#if 0
- if (match_name)
- {
- /* check for same name */
- int len = strlen (mode->name);
- if (randr_mode->mode.nameLength != len) return FALSE;
- if (memcmp (randr_mode->name, mode->name, len) != 0) return FALSE;
+ if (match_name) {
+ /* check for same name */
+ int len = strlen(mode->name);
+
+ if (randr_mode->mode.nameLength != len)
+ return FALSE;
+ if (memcmp(randr_mode->name, mode->name, len) != 0)
+ return FALSE;
}
#endif
-
+
/* check for same timings */
- if (randr_mode->mode.dotClock / 1000 != mode->Clock) return FALSE;
- if (randr_mode->mode.width != mode->HDisplay) return FALSE;
- if (randr_mode->mode.hSyncStart != mode->HSyncStart) return FALSE;
- if (randr_mode->mode.hSyncEnd != mode->HSyncEnd) return FALSE;
- if (randr_mode->mode.hTotal != mode->HTotal) return FALSE;
- if (randr_mode->mode.hSkew != mode->HSkew) return FALSE;
- if (randr_mode->mode.height != mode->VDisplay) return FALSE;
- if (randr_mode->mode.vSyncStart != mode->VSyncStart) return FALSE;
- if (randr_mode->mode.vSyncEnd != mode->VSyncEnd) return FALSE;
- if (randr_mode->mode.vTotal != mode->VTotal) return FALSE;
-
+ if (randr_mode->mode.dotClock / 1000 != mode->Clock)
+ return FALSE;
+ if (randr_mode->mode.width != mode->HDisplay)
+ return FALSE;
+ if (randr_mode->mode.hSyncStart != mode->HSyncStart)
+ return FALSE;
+ if (randr_mode->mode.hSyncEnd != mode->HSyncEnd)
+ return FALSE;
+ if (randr_mode->mode.hTotal != mode->HTotal)
+ return FALSE;
+ if (randr_mode->mode.hSkew != mode->HSkew)
+ return FALSE;
+ if (randr_mode->mode.height != mode->VDisplay)
+ return FALSE;
+ if (randr_mode->mode.vSyncStart != mode->VSyncStart)
+ return FALSE;
+ if (randr_mode->mode.vSyncEnd != mode->VSyncEnd)
+ return FALSE;
+ if (randr_mode->mode.vTotal != mode->VTotal)
+ return FALSE;
+
/* check for same flags (using only the XF86 valid flag bits) */
if ((randr_mode->mode.modeFlags & FLAG_BITS) != (mode->Flags & FLAG_BITS))
- return FALSE;
-
+ return FALSE;
+
/* everything matches */
return TRUE;
}
static Bool
-xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
+xf86RandR12CrtcNotify(RRCrtcPtr randr_crtc)
{
- ScreenPtr pScreen = randr_crtc->pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RRModePtr randr_mode = NULL;
- int x;
- int y;
- Rotation rotation;
- int numOutputs;
- RROutputPtr *randr_outputs;
- RROutputPtr randr_output;
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
- xf86OutputPtr output;
- int i, j;
- DisplayModePtr mode = &crtc->mode;
- Bool ret;
-
- randr_outputs = malloc(config->num_output * sizeof (RROutputPtr));
+ ScreenPtr pScreen = randr_crtc->pScreen;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RRModePtr randr_mode = NULL;
+ int x;
+ int y;
+ Rotation rotation;
+ int numOutputs;
+ RROutputPtr *randr_outputs;
+ RROutputPtr randr_output;
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ xf86OutputPtr output;
+ int i, j;
+ DisplayModePtr mode = &crtc->mode;
+ Bool ret;
+
+ randr_outputs = malloc(config->num_output * sizeof(RROutputPtr));
if (!randr_outputs)
- return FALSE;
+ return FALSE;
x = crtc->x;
y = crtc->y;
rotation = crtc->rotation;
numOutputs = 0;
randr_mode = NULL;
- for (i = 0; i < config->num_output; i++)
- {
- output = config->output[i];
- if (output->crtc == crtc)
- {
- randr_output = output->randr_output;
- randr_outputs[numOutputs++] = randr_output;
- /*
- * We make copies of modes, so pointer equality
- * isn't sufficient
- */
- for (j = 0; j < randr_output->numModes + randr_output->numUserModes; j++)
- {
- RRModePtr m = (j < randr_output->numModes ?
- randr_output->modes[j] :
- randr_output->userModes[j-randr_output->numModes]);
-
- if (xf86RandRModeMatches (m, mode))
- {
- randr_mode = m;
- break;
- }
- }
- }
+ for (i = 0; i < config->num_output; i++) {
+ output = config->output[i];
+ if (output->crtc == crtc) {
+ randr_output = output->randr_output;
+ randr_outputs[numOutputs++] = randr_output;
+ /*
+ * We make copies of modes, so pointer equality
+ * isn't sufficient
+ */
+ for (j = 0; j < randr_output->numModes + randr_output->numUserModes;
+ j++) {
+ RRModePtr m =
+ (j <
+ randr_output->numModes ? randr_output->
+ modes[j] : randr_output->userModes[j -
+ randr_output->
+ numModes]);
+
+ if (xf86RandRModeMatches(m, mode)) {
+ randr_mode = m;
+ break;
+ }
+ }
+ }
}
- ret = RRCrtcNotify (randr_crtc, randr_mode, x, y,
- rotation,
- crtc->transformPresent ? &crtc->transform : NULL,
- numOutputs, randr_outputs);
+ ret = RRCrtcNotify(randr_crtc, randr_mode, x, y,
+ rotation,
+ crtc->transformPresent ? &crtc->transform : NULL,
+ numOutputs, randr_outputs);
free(randr_outputs);
return ret;
}
@@ -1115,21 +1101,20 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
* Convert a RandR mode to a DisplayMode
*/
static void
-xf86RandRModeConvert (ScrnInfoPtr scrn,
- RRModePtr randr_mode,
- DisplayModePtr mode)
+xf86RandRModeConvert(ScrnInfoPtr scrn,
+ RRModePtr randr_mode, DisplayModePtr mode)
{
memset(mode, 0, sizeof(DisplayModeRec));
mode->status = MODE_OK;
mode->Clock = randr_mode->mode.dotClock / 1000;
-
+
mode->HDisplay = randr_mode->mode.width;
mode->HSyncStart = randr_mode->mode.hSyncStart;
mode->HSyncEnd = randr_mode->mode.hSyncEnd;
mode->HTotal = randr_mode->mode.hTotal;
mode->HSkew = randr_mode->mode.hSkew;
-
+
mode->VDisplay = randr_mode->mode.height;
mode->VSyncStart = randr_mode->mode.vSyncStart;
mode->VSyncEnd = randr_mode->mode.vSyncEnd;
@@ -1138,137 +1123,134 @@ xf86RandRModeConvert (ScrnInfoPtr scrn,
mode->Flags = randr_mode->mode.modeFlags & FLAG_BITS;
- xf86SetModeCrtc (mode, scrn->adjustFlags);
+ xf86SetModeCrtc(mode, scrn->adjustFlags);
}
static Bool
-xf86RandR12CrtcSet (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- RRModePtr randr_mode,
- int x,
- int y,
- Rotation rotation,
- int num_randr_outputs,
- RROutputPtr *randr_outputs)
+xf86RandR12CrtcSet(ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc,
+ RRModePtr randr_mode,
+ int x,
+ int y,
+ Rotation rotation,
+ int num_randr_outputs, RROutputPtr * randr_outputs)
{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
- RRTransformPtr transform;
- Bool changed = FALSE;
- int o, ro;
- xf86CrtcPtr *save_crtcs;
- Bool save_enabled = crtc->enabled;
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ RRTransformPtr transform;
+ Bool changed = FALSE;
+ int o, ro;
+ xf86CrtcPtr *save_crtcs;
+ Bool save_enabled = crtc->enabled;
if (!crtc->scrn->vtSema)
- return FALSE;
+ return FALSE;
- save_crtcs = malloc(config->num_output * sizeof (xf86CrtcPtr));
+ save_crtcs = malloc(config->num_output * sizeof(xf86CrtcPtr));
if ((randr_mode != NULL) != crtc->enabled)
- changed = TRUE;
- else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode))
- changed = TRUE;
-
+ changed = TRUE;
+ else if (randr_mode && !xf86RandRModeMatches(randr_mode, &crtc->mode))
+ changed = TRUE;
+
if (rotation != crtc->rotation)
- changed = TRUE;
+ changed = TRUE;
- transform = RRCrtcGetTransform (randr_crtc);
+ transform = RRCrtcGetTransform(randr_crtc);
if ((transform != NULL) != crtc->transformPresent)
- changed = TRUE;
- else if (transform && memcmp (&transform->transform, &crtc->transform.transform,
- sizeof (transform->transform)) != 0)
- changed = TRUE;
+ changed = TRUE;
+ else if (transform &&
+ memcmp(&transform->transform, &crtc->transform.transform,
+ sizeof(transform->transform)) != 0)
+ changed = TRUE;
if (x != crtc->x || y != crtc->y)
- changed = TRUE;
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- xf86CrtcPtr new_crtc;
-
- save_crtcs[o] = output->crtc;
-
- if (output->crtc == crtc)
- new_crtc = NULL;
- else
- new_crtc = output->crtc;
- for (ro = 0; ro < num_randr_outputs; ro++)
- if (output->randr_output == randr_outputs[ro])
- {
- new_crtc = crtc;
- break;
- }
- if (new_crtc != output->crtc)
- {
- changed = TRUE;
- output->crtc = new_crtc;
- }
+ changed = TRUE;
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+ xf86CrtcPtr new_crtc;
+
+ save_crtcs[o] = output->crtc;
+
+ if (output->crtc == crtc)
+ new_crtc = NULL;
+ else
+ new_crtc = output->crtc;
+ for (ro = 0; ro < num_randr_outputs; ro++)
+ if (output->randr_output == randr_outputs[ro]) {
+ new_crtc = crtc;
+ break;
+ }
+ if (new_crtc != output->crtc) {
+ changed = TRUE;
+ output->crtc = new_crtc;
+ }
}
- for (ro = 0; ro < num_randr_outputs; ro++)
+ for (ro = 0; ro < num_randr_outputs; ro++)
if (randr_outputs[ro]->pendingProperties)
- changed = TRUE;
+ changed = TRUE;
/* XXX need device-independent mode setting code through an API */
- if (changed)
- {
- crtc->enabled = randr_mode != NULL;
-
- if (randr_mode)
- {
- DisplayModeRec mode;
- RRTransformPtr transform = RRCrtcGetTransform (randr_crtc);
-
- xf86RandRModeConvert (pScrn, randr_mode, &mode);
- if (!xf86CrtcSetModeTransform (crtc, &mode, rotation, transform, x, y))
- {
- crtc->enabled = save_enabled;
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- output->crtc = save_crtcs[o];
- }
- free(save_crtcs);
- return FALSE;
- }
- xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height);
- xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
- /*
- * Save the last successful setting for EnterVT
- */
- crtc->desiredMode = mode;
- crtc->desiredRotation = rotation;
- if (transform) {
- crtc->desiredTransform = *transform;
- crtc->desiredTransformPresent = TRUE;
- } else
- crtc->desiredTransformPresent = FALSE;
-
- crtc->desiredX = x;
- crtc->desiredY = y;
- }
- xf86DisableUnusedFunctions (pScrn);
+ if (changed) {
+ crtc->enabled = randr_mode != NULL;
+
+ if (randr_mode) {
+ DisplayModeRec mode;
+ RRTransformPtr transform = RRCrtcGetTransform(randr_crtc);
+
+ xf86RandRModeConvert(pScrn, randr_mode, &mode);
+ if (!xf86CrtcSetModeTransform
+ (crtc, &mode, rotation, transform, x, y)) {
+ crtc->enabled = save_enabled;
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+
+ output->crtc = save_crtcs[o];
+ }
+ free(save_crtcs);
+ return FALSE;
+ }
+ xf86RandR13VerifyPanningArea(crtc, pScreen->width, pScreen->height);
+ xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY);
+ /*
+ * Save the last successful setting for EnterVT
+ */
+ crtc->desiredMode = mode;
+ crtc->desiredRotation = rotation;
+ if (transform) {
+ crtc->desiredTransform = *transform;
+ crtc->desiredTransformPresent = TRUE;
+ }
+ else
+ crtc->desiredTransformPresent = FALSE;
+
+ crtc->desiredX = x;
+ crtc->desiredY = y;
+ }
+ xf86DisableUnusedFunctions(pScrn);
}
free(save_crtcs);
- return xf86RandR12CrtcNotify (randr_crtc);
+ return xf86RandR12CrtcNotify(randr_crtc);
}
static Bool
-xf86RandR12CrtcSetGamma (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc)
+xf86RandR12CrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc)
{
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
if (crtc->funcs->gamma_set == NULL)
- return FALSE;
+ return FALSE;
if (!crtc->scrn->vtSema)
- return TRUE;
+ return TRUE;
/* Realloc local gamma if needed. */
if (randr_crtc->gammaSize != crtc->gamma_size) {
CARD16 *tmp_ptr;
- tmp_ptr = realloc(crtc->gamma_red, 3 * crtc->gamma_size * sizeof (CARD16));
+
+ tmp_ptr =
+ realloc(crtc->gamma_red, 3 * crtc->gamma_size * sizeof(CARD16));
if (!tmp_ptr)
return FALSE;
crtc->gamma_red = tmp_ptr;
@@ -1277,23 +1259,25 @@ xf86RandR12CrtcSetGamma (ScreenPtr pScreen,
}
crtc->gamma_size = randr_crtc->gammaSize;
- memcpy (crtc->gamma_red, randr_crtc->gammaRed, crtc->gamma_size * sizeof (CARD16));
- memcpy (crtc->gamma_green, randr_crtc->gammaGreen, crtc->gamma_size * sizeof (CARD16));
- memcpy (crtc->gamma_blue, randr_crtc->gammaBlue, crtc->gamma_size * sizeof (CARD16));
+ memcpy(crtc->gamma_red, randr_crtc->gammaRed,
+ crtc->gamma_size * sizeof(CARD16));
+ memcpy(crtc->gamma_green, randr_crtc->gammaGreen,
+ crtc->gamma_size * sizeof(CARD16));
+ memcpy(crtc->gamma_blue, randr_crtc->gammaBlue,
+ crtc->gamma_size * sizeof(CARD16));
/* Only set it when the crtc is actually running.
* Otherwise it will be set when it's activated.
*/
if (crtc->active)
- crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
- crtc->gamma_blue, crtc->gamma_size);
+ crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+ crtc->gamma_blue, crtc->gamma_size);
return TRUE;
}
static Bool
-xf86RandR12CrtcGetGamma (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc)
+xf86RandR12CrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc)
{
xf86CrtcPtr crtc = randr_crtc->devPrivate;
@@ -1306,7 +1290,10 @@ xf86RandR12CrtcGetGamma (ScreenPtr pScreen,
/* Realloc randr gamma if needed. */
if (randr_crtc->gammaSize != crtc->gamma_size) {
CARD16 *tmp_ptr;
- tmp_ptr = realloc(randr_crtc->gammaRed, 3 * crtc->gamma_size * sizeof (CARD16));
+
+ tmp_ptr =
+ realloc(randr_crtc->gammaRed,
+ 3 * crtc->gamma_size * sizeof(CARD16));
if (!tmp_ptr)
return FALSE;
randr_crtc->gammaRed = tmp_ptr;
@@ -1314,18 +1301,20 @@ xf86RandR12CrtcGetGamma (ScreenPtr pScreen,
randr_crtc->gammaBlue = randr_crtc->gammaGreen + crtc->gamma_size;
}
randr_crtc->gammaSize = crtc->gamma_size;
- memcpy (randr_crtc->gammaRed, crtc->gamma_red, crtc->gamma_size * sizeof (CARD16));
- memcpy (randr_crtc->gammaGreen, crtc->gamma_green, crtc->gamma_size * sizeof (CARD16));
- memcpy (randr_crtc->gammaBlue, crtc->gamma_blue, crtc->gamma_size * sizeof (CARD16));
+ memcpy(randr_crtc->gammaRed, crtc->gamma_red,
+ crtc->gamma_size * sizeof(CARD16));
+ memcpy(randr_crtc->gammaGreen, crtc->gamma_green,
+ crtc->gamma_size * sizeof(CARD16));
+ memcpy(randr_crtc->gammaBlue, crtc->gamma_blue,
+ crtc->gamma_size * sizeof(CARD16));
return TRUE;
}
static Bool
-xf86RandR12OutputSetProperty (ScreenPtr pScreen,
- RROutputPtr randr_output,
- Atom property,
- RRPropertyValuePtr value)
+xf86RandR12OutputSetProperty(ScreenPtr pScreen,
+ RROutputPtr randr_output,
+ Atom property, RRPropertyValuePtr value)
{
xf86OutputPtr output = randr_output->devPrivate;
@@ -1333,7 +1322,7 @@ xf86RandR12OutputSetProperty (ScreenPtr pScreen,
* user is setting properties to.
*/
if (output->funcs->set_property == NULL)
- return TRUE;
+ return TRUE;
/*
* This function gets called even when vtSema is FALSE, as
@@ -1344,41 +1333,39 @@ xf86RandR12OutputSetProperty (ScreenPtr pScreen,
}
static Bool
-xf86RandR13OutputGetProperty (ScreenPtr pScreen,
- RROutputPtr randr_output,
- Atom property)
+xf86RandR13OutputGetProperty(ScreenPtr pScreen,
+ RROutputPtr randr_output, Atom property)
{
xf86OutputPtr output = randr_output->devPrivate;
if (output->funcs->get_property == NULL)
- return TRUE;
+ return TRUE;
/* Should be safe even w/o vtSema */
return output->funcs->get_property(output, property);
}
static Bool
-xf86RandR12OutputValidateMode (ScreenPtr pScreen,
- RROutputPtr randr_output,
- RRModePtr randr_mode)
+xf86RandR12OutputValidateMode(ScreenPtr pScreen,
+ RROutputPtr randr_output, RRModePtr randr_mode)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86OutputPtr output = randr_output->devPrivate;
- DisplayModeRec mode;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86OutputPtr output = randr_output->devPrivate;
+ DisplayModeRec mode;
- xf86RandRModeConvert (pScrn, randr_mode, &mode);
+ xf86RandRModeConvert(pScrn, randr_mode, &mode);
/*
* This function may be called when vtSema is FALSE, so
* the underlying function must either avoid touching the hardware
* or return FALSE when vtSema is FALSE
*/
- if (output->funcs->mode_valid (output, &mode) != MODE_OK)
- return FALSE;
+ if (output->funcs->mode_valid(output, &mode) != MODE_OK)
+ return FALSE;
return TRUE;
}
static void
-xf86RandR12ModeDestroy (ScreenPtr pScreen, RRModePtr randr_mode)
+xf86RandR12ModeDestroy(ScreenPtr pScreen, RRModePtr randr_mode)
{
}
@@ -1387,56 +1374,56 @@ xf86RandR12ModeDestroy (ScreenPtr pScreen, RRModePtr randr_mode)
* RandR modes and assign them to the output
*/
static Bool
-xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes)
+xf86RROutputSetModes(RROutputPtr randr_output, DisplayModePtr modes)
{
- DisplayModePtr mode;
- RRModePtr *rrmodes = NULL;
- int nmode = 0;
- int npreferred = 0;
- Bool ret = TRUE;
- int pref;
+ DisplayModePtr mode;
+ RRModePtr *rrmodes = NULL;
+ int nmode = 0;
+ int npreferred = 0;
+ Bool ret = TRUE;
+ int pref;
for (mode = modes; mode; mode = mode->next)
- nmode++;
+ nmode++;
if (nmode) {
- rrmodes = malloc(nmode * sizeof (RRModePtr));
-
- if (!rrmodes)
- return FALSE;
- nmode = 0;
-
- for (pref = 1; pref >= 0; pref--) {
- for (mode = modes; mode; mode = mode->next) {
- if ((pref != 0) == ((mode->type & M_T_PREFERRED) != 0)) {
- xRRModeInfo modeInfo;
- RRModePtr rrmode;
-
- modeInfo.nameLength = strlen (mode->name);
- modeInfo.width = mode->HDisplay;
- modeInfo.dotClock = mode->Clock * 1000;
- modeInfo.hSyncStart = mode->HSyncStart;
- modeInfo.hSyncEnd = mode->HSyncEnd;
- modeInfo.hTotal = mode->HTotal;
- modeInfo.hSkew = mode->HSkew;
-
- modeInfo.height = mode->VDisplay;
- modeInfo.vSyncStart = mode->VSyncStart;
- modeInfo.vSyncEnd = mode->VSyncEnd;
- modeInfo.vTotal = mode->VTotal;
- modeInfo.modeFlags = mode->Flags;
-
- rrmode = RRModeGet (&modeInfo, mode->name);
- if (rrmode) {
- rrmodes[nmode++] = rrmode;
- npreferred += pref;
- }
- }
- }
- }
+ rrmodes = malloc(nmode * sizeof(RRModePtr));
+
+ if (!rrmodes)
+ return FALSE;
+ nmode = 0;
+
+ for (pref = 1; pref >= 0; pref--) {
+ for (mode = modes; mode; mode = mode->next) {
+ if ((pref != 0) == ((mode->type & M_T_PREFERRED) != 0)) {
+ xRRModeInfo modeInfo;
+ RRModePtr rrmode;
+
+ modeInfo.nameLength = strlen(mode->name);
+ modeInfo.width = mode->HDisplay;
+ modeInfo.dotClock = mode->Clock * 1000;
+ modeInfo.hSyncStart = mode->HSyncStart;
+ modeInfo.hSyncEnd = mode->HSyncEnd;
+ modeInfo.hTotal = mode->HTotal;
+ modeInfo.hSkew = mode->HSkew;
+
+ modeInfo.height = mode->VDisplay;
+ modeInfo.vSyncStart = mode->VSyncStart;
+ modeInfo.vSyncEnd = mode->VSyncEnd;
+ modeInfo.vTotal = mode->VTotal;
+ modeInfo.modeFlags = mode->Flags;
+
+ rrmode = RRModeGet(&modeInfo, mode->name);
+ if (rrmode) {
+ rrmodes[nmode++] = rrmode;
+ npreferred += pref;
+ }
+ }
+ }
+ }
}
-
- ret = RROutputSetModes (randr_output, rrmodes, nmode, npreferred);
+
+ ret = RROutputSetModes(randr_output, rrmodes, nmode, npreferred);
free(rrmodes);
return ret;
}
@@ -1445,154 +1432,144 @@ xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes)
* Mirror the current mode configuration to RandR
*/
static Bool
-xf86RandR12SetInfo12 (ScreenPtr pScreen)
+xf86RandR12SetInfo12(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RROutputPtr *clones;
- RRCrtcPtr *crtcs;
- int ncrtc;
- int o, c, l;
- RRCrtcPtr randr_crtc;
- int nclone;
-
- clones = malloc(config->num_output * sizeof (RROutputPtr));
- crtcs = malloc(config->num_crtc * sizeof (RRCrtcPtr));
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- ncrtc = 0;
- for (c = 0; c < config->num_crtc; c++)
- if (output->possible_crtcs & (1 << c))
- crtcs[ncrtc++] = config->crtc[c]->randr_crtc;
-
- if (output->crtc)
- randr_crtc = output->crtc->randr_crtc;
- else
- randr_crtc = NULL;
-
- if (!RROutputSetCrtcs (output->randr_output, crtcs, ncrtc))
- {
- free(crtcs);
- free(clones);
- return FALSE;
- }
-
- RROutputSetPhysicalSize(output->randr_output,
- output->mm_width,
- output->mm_height);
- xf86RROutputSetModes (output->randr_output, output->probed_modes);
-
- switch (output->status) {
- case XF86OutputStatusConnected:
- RROutputSetConnection (output->randr_output, RR_Connected);
- break;
- case XF86OutputStatusDisconnected:
- RROutputSetConnection (output->randr_output, RR_Disconnected);
- break;
- case XF86OutputStatusUnknown:
- RROutputSetConnection (output->randr_output, RR_UnknownConnection);
- break;
- }
-
- RROutputSetSubpixelOrder (output->randr_output, output->subpixel_order);
-
- /*
- * Valid clones
- */
- nclone = 0;
- for (l = 0; l < config->num_output; l++)
- {
- xf86OutputPtr clone = config->output[l];
-
- if (l != o && (output->possible_clones & (1 << l)))
- clones[nclone++] = clone->randr_output;
- }
- if (!RROutputSetClones (output->randr_output, clones, nclone))
- {
- free(crtcs);
- free(clones);
- return FALSE;
- }
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RROutputPtr *clones;
+ RRCrtcPtr *crtcs;
+ int ncrtc;
+ int o, c, l;
+ RRCrtcPtr randr_crtc;
+ int nclone;
+
+ clones = malloc(config->num_output * sizeof(RROutputPtr));
+ crtcs = malloc(config->num_crtc * sizeof(RRCrtcPtr));
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+
+ ncrtc = 0;
+ for (c = 0; c < config->num_crtc; c++)
+ if (output->possible_crtcs & (1 << c))
+ crtcs[ncrtc++] = config->crtc[c]->randr_crtc;
+
+ if (output->crtc)
+ randr_crtc = output->crtc->randr_crtc;
+ else
+ randr_crtc = NULL;
+
+ if (!RROutputSetCrtcs(output->randr_output, crtcs, ncrtc)) {
+ free(crtcs);
+ free(clones);
+ return FALSE;
+ }
+
+ RROutputSetPhysicalSize(output->randr_output,
+ output->mm_width, output->mm_height);
+ xf86RROutputSetModes(output->randr_output, output->probed_modes);
+
+ switch (output->status) {
+ case XF86OutputStatusConnected:
+ RROutputSetConnection(output->randr_output, RR_Connected);
+ break;
+ case XF86OutputStatusDisconnected:
+ RROutputSetConnection(output->randr_output, RR_Disconnected);
+ break;
+ case XF86OutputStatusUnknown:
+ RROutputSetConnection(output->randr_output, RR_UnknownConnection);
+ break;
+ }
+
+ RROutputSetSubpixelOrder(output->randr_output, output->subpixel_order);
+
+ /*
+ * Valid clones
+ */
+ nclone = 0;
+ for (l = 0; l < config->num_output; l++) {
+ xf86OutputPtr clone = config->output[l];
+
+ if (l != o && (output->possible_clones & (1 << l)))
+ clones[nclone++] = clone->randr_output;
+ }
+ if (!RROutputSetClones(output->randr_output, clones, nclone)) {
+ free(crtcs);
+ free(clones);
+ return FALSE;
+ }
}
free(crtcs);
free(clones);
return TRUE;
}
-
-
/*
* Query the hardware for the current state, then mirror
* that to RandR
*/
static Bool
-xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations)
+xf86RandR12GetInfo12(ScreenPtr pScreen, Rotation * rotations)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
if (!pScrn->vtSema)
- return TRUE;
- xf86ProbeOutputModes (pScrn, 0, 0);
- xf86SetScrnInfoModes (pScrn);
- return xf86RandR12SetInfo12 (pScreen);
+ return TRUE;
+ xf86ProbeOutputModes(pScrn, 0, 0);
+ xf86SetScrnInfoModes(pScrn);
+ return xf86RandR12SetInfo12(pScreen);
}
static Bool
-xf86RandR12CreateObjects12 (ScreenPtr pScreen)
+xf86RandR12CreateObjects12(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- int c;
- int o;
-
- if (!RRInit ())
- return FALSE;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+ int o;
+
+ if (!RRInit())
+ return FALSE;
/*
* Configure crtcs
*/
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
-
- crtc->randr_crtc = RRCrtcCreate (pScreen, crtc);
- RRCrtcGammaSetSize (crtc->randr_crtc, 256);
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->randr_crtc = RRCrtcCreate(pScreen, crtc);
+ RRCrtcGammaSetSize(crtc->randr_crtc, 256);
}
/*
* Configure outputs
*/
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
- output->randr_output = RROutputCreate (pScreen, output->name,
- strlen (output->name),
- output);
+ output->randr_output = RROutputCreate(pScreen, output->name,
+ strlen(output->name), output);
- if (output->funcs->create_resources != NULL)
- output->funcs->create_resources(output);
- RRPostPendingProperties (output->randr_output);
+ if (output->funcs->create_resources != NULL)
+ output->funcs->create_resources(output);
+ RRPostPendingProperties(output->randr_output);
}
return TRUE;
}
static Bool
-xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
+xf86RandR12CreateScreenResources12(ScreenPtr pScreen)
{
- int c;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
if (xf86RandR12Key == NULL)
- return TRUE;
+ return TRUE;
for (c = 0; c < config->num_crtc; c++)
- xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
-
- RRScreenSetSizeRange (pScreen, config->minWidth, config->minHeight,
- config->maxWidth, config->maxHeight);
+ xf86RandR12CrtcNotify(config->crtc[c]->randr_crtc);
+
+ RRScreenSetSizeRange(pScreen, config->minWidth, config->minHeight,
+ config->maxWidth, config->maxHeight);
return TRUE;
}
@@ -1602,95 +1579,91 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
*/
void
-xf86RandR12TellChanged (ScreenPtr pScreen)
+xf86RandR12TellChanged(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- int c;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
if (xf86RandR12Key == NULL)
- return;
+ return;
- xf86RandR12SetInfo12 (pScreen);
+ xf86RandR12SetInfo12(pScreen);
for (c = 0; c < config->num_crtc; c++)
- xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
+ xf86RandR12CrtcNotify(config->crtc[c]->randr_crtc);
- RRTellChanged (pScreen);
+ RRTellChanged(pScreen);
}
static void
-xf86RandR12PointerMoved (int scrnIndex, int x, int y)
+xf86RandR12PointerMoved(int scrnIndex, int x, int y)
{
- ScreenPtr pScreen = screenInfo.screens[scrnIndex];
- ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ ScreenPtr pScreen = screenInfo.screens[scrnIndex];
+ ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
int c;
randrp->pointerX = x;
randrp->pointerY = y;
for (c = 0; c < config->num_crtc; c++)
- xf86RandR13Pan (config->crtc[c], x, y);
+ xf86RandR13Pan(config->crtc[c], x, y);
}
static Bool
-xf86RandR13GetPanning (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- BoxPtr totalArea,
- BoxPtr trackingArea,
- INT16 *border)
+xf86RandR13GetPanning(ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc,
+ BoxPtr totalArea, BoxPtr trackingArea, INT16 *border)
{
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
if (crtc->version < 2)
- return FALSE;
+ return FALSE;
if (totalArea)
- memcpy (totalArea, &crtc->panningTotalArea, sizeof(BoxRec));
+ memcpy(totalArea, &crtc->panningTotalArea, sizeof(BoxRec));
if (trackingArea)
- memcpy (trackingArea, &crtc->panningTrackingArea, sizeof(BoxRec));
+ memcpy(trackingArea, &crtc->panningTrackingArea, sizeof(BoxRec));
if (border)
- memcpy (border, crtc->panningBorder, 4*sizeof(INT16));
+ memcpy(border, crtc->panningBorder, 4 * sizeof(INT16));
return TRUE;
}
static Bool
-xf86RandR13SetPanning (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- BoxPtr totalArea,
- BoxPtr trackingArea,
- INT16 *border)
+xf86RandR13SetPanning(ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc,
+ BoxPtr totalArea, BoxPtr trackingArea, INT16 *border)
{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
- BoxRec oldTotalArea;
- BoxRec oldTrackingArea;
- INT16 oldBorder[4];
-
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ BoxRec oldTotalArea;
+ BoxRec oldTrackingArea;
+ INT16 oldBorder[4];
if (crtc->version < 2)
- return FALSE;
+ return FALSE;
- memcpy (&oldTotalArea, &crtc->panningTotalArea, sizeof(BoxRec));
- memcpy (&oldTrackingArea, &crtc->panningTrackingArea, sizeof(BoxRec));
- memcpy (oldBorder, crtc->panningBorder, 4*sizeof(INT16));
+ memcpy(&oldTotalArea, &crtc->panningTotalArea, sizeof(BoxRec));
+ memcpy(&oldTrackingArea, &crtc->panningTrackingArea, sizeof(BoxRec));
+ memcpy(oldBorder, crtc->panningBorder, 4 * sizeof(INT16));
if (totalArea)
- memcpy (&crtc->panningTotalArea, totalArea, sizeof(BoxRec));
+ memcpy(&crtc->panningTotalArea, totalArea, sizeof(BoxRec));
if (trackingArea)
- memcpy (&crtc->panningTrackingArea, trackingArea, sizeof(BoxRec));
+ memcpy(&crtc->panningTrackingArea, trackingArea, sizeof(BoxRec));
if (border)
- memcpy (crtc->panningBorder, border, 4*sizeof(INT16));
-
- if (xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height)) {
- xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
- return TRUE;
- } else {
- /* Restore old settings */
- memcpy (&crtc->panningTotalArea, &oldTotalArea, sizeof(BoxRec));
- memcpy (&crtc->panningTrackingArea, &oldTrackingArea, sizeof(BoxRec));
- memcpy (crtc->panningBorder, oldBorder, 4*sizeof(INT16));
- return FALSE;
+ memcpy(crtc->panningBorder, border, 4 * sizeof(INT16));
+
+ if (xf86RandR13VerifyPanningArea(crtc, pScreen->width, pScreen->height)) {
+ xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY);
+ return TRUE;
+ }
+ else {
+ /* Restore old settings */
+ memcpy(&crtc->panningTotalArea, &oldTotalArea, sizeof(BoxRec));
+ memcpy(&crtc->panningTrackingArea, &oldTrackingArea, sizeof(BoxRec));
+ memcpy(crtc->panningBorder, oldBorder, 4 * sizeof(INT16));
+ return FALSE;
}
}
@@ -1705,11 +1678,12 @@ gamma_to_ramp(float gamma, CARD16 *ramp, int size)
int i;
for (i = 0; i < size; i++) {
- if (gamma == 1.0)
- ramp[i] = i << 8;
- else
- ramp[i] = (CARD16)(pow((double)i / (double)(size - 1), 1. / gamma)
- * (double)(size - 1) * 256);
+ if (gamma == 1.0)
+ ramp[i] = i << 8;
+ else
+ ramp[i] =
+ (CARD16) (pow((double) i / (double) (size - 1), 1. / gamma)
+ * (double) (size - 1) * 256);
}
}
@@ -1722,15 +1696,15 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
int size;
if (!crtc)
- return Success;
+ return Success;
size = max(0, crtc->gammaSize);
if (!size)
- return Success;
+ return Success;
points = calloc(size, 3 * sizeof(CARD16));
if (!points)
- return BadAlloc;
+ return BadAlloc;
red = points;
green = points + size;
@@ -1749,37 +1723,37 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
}
static Bool
-xf86RandR12EnterVT (int screen_index, int flags)
+xf86RandR12EnterVT(int screen_index, int flags)
{
- ScreenPtr pScreen = screenInfo.screens[screen_index];
- ScrnInfoPtr pScrn = xf86Screens[screen_index];
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- rrScrPrivPtr rp = rrGetScrPriv(pScreen);
- Bool ret;
- int i;
+ ScreenPtr pScreen = screenInfo.screens[screen_index];
+ ScrnInfoPtr pScrn = xf86Screens[screen_index];
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ rrScrPrivPtr rp = rrGetScrPriv(pScreen);
+ Bool ret;
+ int i;
if (randrp->orig_EnterVT) {
- pScrn->EnterVT = randrp->orig_EnterVT;
- ret = pScrn->EnterVT (screen_index, flags);
- randrp->orig_EnterVT = pScrn->EnterVT;
- pScrn->EnterVT = xf86RandR12EnterVT;
- if (!ret)
- return FALSE;
+ pScrn->EnterVT = randrp->orig_EnterVT;
+ ret = pScrn->EnterVT(screen_index, flags);
+ randrp->orig_EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = xf86RandR12EnterVT;
+ if (!ret)
+ return FALSE;
}
/* reload gamma */
for (i = 0; i < rp->numCrtcs; i++)
- xf86RandR12CrtcSetGamma(pScreen, rp->crtcs[i]);
+ xf86RandR12CrtcSetGamma(pScreen, rp->crtcs[i]);
- return RRGetInfo (pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */
+ return RRGetInfo(pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */
}
static Bool
-xf86RandR12Init12 (ScreenPtr pScreen)
+xf86RandR12Init12(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- rrScrPrivPtr rp = rrGetScrPriv(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ rrScrPrivPtr rp = rrGetScrPriv(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
int i;
rp->rrGetInfo = xf86RandR12GetInfo12;
@@ -1802,16 +1776,16 @@ xf86RandR12Init12 (ScreenPtr pScreen)
randrp->orig_EnterVT = pScrn->EnterVT;
pScrn->EnterVT = xf86RandR12EnterVT;
- if (!xf86RandR12CreateObjects12 (pScreen))
- return FALSE;
+ if (!xf86RandR12CreateObjects12(pScreen))
+ return FALSE;
/*
* Configure output modes
*/
- if (!xf86RandR12SetInfo12 (pScreen))
- return FALSE;
+ if (!xf86RandR12SetInfo12(pScreen))
+ return FALSE;
for (i = 0; i < rp->numCrtcs; i++) {
- xf86RandR12CrtcGetGamma(pScreen, rp->crtcs[i]);
+ xf86RandR12CrtcGetGamma(pScreen, rp->crtcs[i]);
}
return TRUE;
}
@@ -1819,7 +1793,7 @@ xf86RandR12Init12 (ScreenPtr pScreen)
#endif
Bool
-xf86RandR12PreInit (ScrnInfoPtr pScrn)
+xf86RandR12PreInit(ScrnInfoPtr pScrn)
{
return TRUE;
}
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.h b/xorg-server/hw/xfree86/modes/xf86RandR12.h
index 755a472d1..9ad695cec 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.h
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.h
@@ -1,43 +1,46 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#ifndef _XF86_RANDR_H_
-#define _XF86_RANDR_H_
-#include <randrstr.h>
-#include <X11/extensions/render.h>
-#if XF86_MODES_RENAME
-#include "xf86Rename.h"
-#endif
-
-extern _X_EXPORT Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen);
-extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen);
-extern _X_EXPORT void xf86RandR12CloseScreen(ScreenPtr pScreen);
-extern _X_EXPORT void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotation);
-extern _X_EXPORT void xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms);
-extern _X_EXPORT Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate,
- RRScreenSizePtr pSize);
-extern _X_EXPORT Rotation xf86RandR12GetRotation(ScreenPtr pScreen);
-extern _X_EXPORT void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y);
-extern _X_EXPORT Bool xf86RandR12PreInit (ScrnInfoPtr pScrn);
-extern _X_EXPORT void xf86RandR12TellChanged (ScreenPtr pScreen);
-
-#endif /* _XF86_RANDR_H_ */
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _XF86_RANDR_H_
+#define _XF86_RANDR_H_
+#include <randrstr.h>
+#include <X11/extensions/render.h>
+#if XF86_MODES_RENAME
+#include "xf86Rename.h"
+#endif
+
+extern _X_EXPORT Bool xf86RandR12CreateScreenResources(ScreenPtr pScreen);
+extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen);
+extern _X_EXPORT void xf86RandR12CloseScreen(ScreenPtr pScreen);
+extern _X_EXPORT void xf86RandR12SetRotations(ScreenPtr pScreen,
+ Rotation rotation);
+extern _X_EXPORT void xf86RandR12SetTransformSupport(ScreenPtr pScreen,
+ Bool transforms);
+extern _X_EXPORT Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation,
+ int rate, RRScreenSizePtr pSize);
+extern _X_EXPORT Rotation xf86RandR12GetRotation(ScreenPtr pScreen);
+extern _X_EXPORT void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn,
+ int *x, int *y);
+extern _X_EXPORT Bool xf86RandR12PreInit(ScrnInfoPtr pScrn);
+extern _X_EXPORT void xf86RandR12TellChanged(ScreenPtr pScreen);
+
+#endif /* _XF86_RANDR_H_ */
diff --git a/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c
index ff7000b5a..85d75573d 100644
--- a/xorg-server/hw/xfree86/modes/xf86Rotate.c
+++ b/xorg-server/hw/xfree86/modes/xf86Rotate.c
@@ -47,25 +47,25 @@
/* borrowed from composite extension, move to Render and publish? */
static VisualPtr
-compGetWindowVisual (WindowPtr pWin)
+compGetWindowVisual(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- VisualID vid = wVisual (pWin);
- int i;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual(pWin);
+ int i;
for (i = 0; i < pScreen->numVisuals; i++)
- if (pScreen->visuals[i].vid == vid)
- return &pScreen->visuals[i];
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
return 0;
}
static PictFormatPtr
-compWindowFormat (WindowPtr pWin)
+compWindowFormat(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- return PictureMatchVisual (pScreen, pWin->drawable.depth,
- compGetWindowVisual (pWin));
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ return PictureMatchVisual(pScreen, pWin->drawable.depth,
+ compGetWindowVisual(pWin));
}
#define F(x) IntToxFixed(x)
@@ -73,201 +73,190 @@ compWindowFormat (WindowPtr pWin)
#define toF(x) ((float) (x) / 65536.0f)
static void
-xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
+xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region)
{
- ScrnInfoPtr scrn = crtc->scrn;
- ScreenPtr screen = scrn->pScreen;
- WindowPtr root = screen->root;
- PixmapPtr dst_pixmap = crtc->rotatedPixmap;
- PictFormatPtr format = compWindowFormat (screen->root);
- int error;
- PicturePtr src, dst;
- int n = RegionNumRects(region);
- BoxPtr b = RegionRects(region);
- XID include_inferiors = IncludeInferiors;
+ ScrnInfoPtr scrn = crtc->scrn;
+ ScreenPtr screen = scrn->pScreen;
+ WindowPtr root = screen->root;
+ PixmapPtr dst_pixmap = crtc->rotatedPixmap;
+ PictFormatPtr format = compWindowFormat(screen->root);
+ int error;
+ PicturePtr src, dst;
+ int n = RegionNumRects(region);
+ BoxPtr b = RegionRects(region);
+ XID include_inferiors = IncludeInferiors;
if (crtc->driverIsPerformingTransform)
- return;
-
- src = CreatePicture (None,
- &root->drawable,
- format,
- CPSubwindowMode,
- &include_inferiors,
- serverClient,
- &error);
+ return;
+
+ src = CreatePicture(None,
+ &root->drawable,
+ format,
+ CPSubwindowMode,
+ &include_inferiors, serverClient, &error);
if (!src)
- return;
-
- dst = CreatePicture (None,
- &dst_pixmap->drawable,
- format,
- 0L,
- NULL,
- serverClient,
- &error);
+ return;
+
+ dst = CreatePicture(None,
+ &dst_pixmap->drawable,
+ format, 0L, NULL, serverClient, &error);
if (!dst)
- return;
+ return;
- error = SetPictureTransform (src, &crtc->crtc_to_framebuffer);
+ error = SetPictureTransform(src, &crtc->crtc_to_framebuffer);
if (error)
- return;
+ return;
if (crtc->transform_in_use && crtc->filter)
- SetPicturePictFilter (src, crtc->filter,
- crtc->params, crtc->nparams);
-
- if (crtc->shadowClear)
- {
- CompositePicture (PictOpSrc,
- src, NULL, dst,
- 0, 0, 0, 0, 0, 0,
- crtc->mode.HDisplay, crtc->mode.VDisplay);
- crtc->shadowClear = FALSE;
+ SetPicturePictFilter(src, crtc->filter, crtc->params, crtc->nparams);
+
+ if (crtc->shadowClear) {
+ CompositePicture(PictOpSrc,
+ src, NULL, dst,
+ 0, 0, 0, 0, 0, 0,
+ crtc->mode.HDisplay, crtc->mode.VDisplay);
+ crtc->shadowClear = FALSE;
}
- else
- {
- while (n--)
- {
- BoxRec dst_box;
-
- dst_box = *b;
- dst_box.x1 -= crtc->filter_width >> 1;
- dst_box.x2 += crtc->filter_width >> 1;
- dst_box.y1 -= crtc->filter_height >> 1;
- dst_box.y2 += crtc->filter_height >> 1;
- pixman_f_transform_bounds (&crtc->f_framebuffer_to_crtc, &dst_box);
- CompositePicture (PictOpSrc,
- src, NULL, dst,
- dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
- dst_box.x2 - dst_box.x1,
- dst_box.y2 - dst_box.y1);
- b++;
- }
+ else {
+ while (n--) {
+ BoxRec dst_box;
+
+ dst_box = *b;
+ dst_box.x1 -= crtc->filter_width >> 1;
+ dst_box.x2 += crtc->filter_width >> 1;
+ dst_box.y1 -= crtc->filter_height >> 1;
+ dst_box.y2 += crtc->filter_height >> 1;
+ pixman_f_transform_bounds(&crtc->f_framebuffer_to_crtc, &dst_box);
+ CompositePicture(PictOpSrc,
+ src, NULL, dst,
+ dst_box.x1, dst_box.y1, 0, 0, dst_box.x1,
+ dst_box.y1, dst_box.x2 - dst_box.x1,
+ dst_box.y2 - dst_box.y1);
+ b++;
+ }
}
- FreePicture (src, None);
- FreePicture (dst, None);
+ FreePicture(src, None);
+ FreePicture(dst, None);
}
static void
-xf86CrtcDamageShadow (xf86CrtcPtr crtc)
+xf86CrtcDamageShadow(xf86CrtcPtr crtc)
{
- ScrnInfoPtr pScrn = crtc->scrn;
- BoxRec damage_box;
- RegionRec damage_region;
- ScreenPtr pScreen = pScrn->pScreen;
+ ScrnInfoPtr pScrn = crtc->scrn;
+ BoxRec damage_box;
+ RegionRec damage_region;
+ ScreenPtr pScreen = pScrn->pScreen;
damage_box.x1 = 0;
damage_box.x2 = crtc->mode.HDisplay;
damage_box.y1 = 0;
damage_box.y2 = crtc->mode.VDisplay;
- if (!pixman_transform_bounds (&crtc->crtc_to_framebuffer, &damage_box))
- {
- damage_box.x1 = 0;
- damage_box.y1 = 0;
- damage_box.x2 = pScreen->width;
- damage_box.y2 = pScreen->height;
+ if (!pixman_transform_bounds(&crtc->crtc_to_framebuffer, &damage_box)) {
+ damage_box.x1 = 0;
+ damage_box.y1 = 0;
+ damage_box.x2 = pScreen->width;
+ damage_box.y2 = pScreen->height;
}
- if (damage_box.x1 < 0) damage_box.x1 = 0;
- if (damage_box.y1 < 0) damage_box.y1 = 0;
- if (damage_box.x2 > pScreen->width) damage_box.x2 = pScreen->width;
- if (damage_box.y2 > pScreen->height) damage_box.y2 = pScreen->height;
+ if (damage_box.x1 < 0)
+ damage_box.x1 = 0;
+ if (damage_box.y1 < 0)
+ damage_box.y1 = 0;
+ if (damage_box.x2 > pScreen->width)
+ damage_box.x2 = pScreen->width;
+ if (damage_box.y2 > pScreen->height)
+ damage_box.y2 = pScreen->height;
RegionInit(&damage_region, &damage_box, 1);
- DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
- &damage_region);
+ DamageDamageRegion(&(*pScreen->GetScreenPixmap) (pScreen)->drawable,
+ &damage_region);
RegionUninit(&damage_region);
crtc->shadowClear = TRUE;
}
static void
-xf86RotatePrepare (ScreenPtr pScreen)
+xf86RotatePrepare(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int c;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->rotatedData && !crtc->rotatedPixmap)
- {
- crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
- crtc->rotatedData,
- crtc->mode.HDisplay,
- crtc->mode.VDisplay);
- if (!xf86_config->rotation_damage_registered)
- {
- /* Hook damage to screen pixmap */
- DamageRegister (&pScreen->root->drawable,
- xf86_config->rotation_damage);
- xf86_config->rotation_damage_registered = TRUE;
- EnableLimitedSchedulingLatency();
- }
-
- xf86CrtcDamageShadow (crtc);
- }
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->rotatedData && !crtc->rotatedPixmap) {
+ crtc->rotatedPixmap = crtc->funcs->shadow_create(crtc,
+ crtc->rotatedData,
+ crtc->mode.
+ HDisplay,
+ crtc->mode.
+ VDisplay);
+ if (!xf86_config->rotation_damage_registered) {
+ /* Hook damage to screen pixmap */
+ DamageRegister(&pScreen->root->drawable,
+ xf86_config->rotation_damage);
+ xf86_config->rotation_damage_registered = TRUE;
+ EnableLimitedSchedulingLatency();
+ }
+
+ xf86CrtcDamageShadow(crtc);
+ }
}
}
static Bool
xf86RotateRedisplay(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- DamagePtr damage = xf86_config->rotation_damage;
- RegionPtr region;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ DamagePtr damage = xf86_config->rotation_damage;
+ RegionPtr region;
if (!damage)
- return FALSE;
- xf86RotatePrepare (pScreen);
+ return FALSE;
+ xf86RotatePrepare(pScreen);
region = DamageRegion(damage);
- if (RegionNotEmpty(region))
- {
- int c;
- SourceValidateProcPtr SourceValidate;
-
- /*
- * SourceValidate is used by the software cursor code
- * to pull the cursor off of the screen when reading
- * bits from the frame buffer. Bypassing this function
- * leaves the software cursor in place
- */
- SourceValidate = pScreen->SourceValidate;
- pScreen->SourceValidate = NULL;
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->transform_in_use && crtc->enabled)
- {
- RegionRec crtc_damage;
-
- /* compute portion of damage that overlaps crtc */
- RegionInit(&crtc_damage, &crtc->bounds, 1);
- RegionIntersect(&crtc_damage, &crtc_damage, region);
-
- /* update damaged region */
- if (RegionNotEmpty(&crtc_damage))
- xf86RotateCrtcRedisplay (crtc, &crtc_damage);
-
- RegionUninit(&crtc_damage);
- }
- }
- pScreen->SourceValidate = SourceValidate;
- DamageEmpty(damage);
+ if (RegionNotEmpty(region)) {
+ int c;
+ SourceValidateProcPtr SourceValidate;
+
+ /*
+ * SourceValidate is used by the software cursor code
+ * to pull the cursor off of the screen when reading
+ * bits from the frame buffer. Bypassing this function
+ * leaves the software cursor in place
+ */
+ SourceValidate = pScreen->SourceValidate;
+ pScreen->SourceValidate = NULL;
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->transform_in_use && crtc->enabled) {
+ RegionRec crtc_damage;
+
+ /* compute portion of damage that overlaps crtc */
+ RegionInit(&crtc_damage, &crtc->bounds, 1);
+ RegionIntersect(&crtc_damage, &crtc_damage, region);
+
+ /* update damaged region */
+ if (RegionNotEmpty(&crtc_damage))
+ xf86RotateCrtcRedisplay(crtc, &crtc_damage);
+
+ RegionUninit(&crtc_damage);
+ }
+ }
+ pScreen->SourceValidate = SourceValidate;
+ DamageEmpty(damage);
}
return TRUE;
}
static void
xf86RotateBlockHandler(int screenNum, pointer blockData,
- pointer pTimeout, pointer pReadmask)
+ pointer pTimeout, pointer pReadmask)
{
- ScreenPtr pScreen = screenInfo.screens[screenNum];
- ScrnInfoPtr pScrn = xf86Screens[screenNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- Bool rotation_active;
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ ScrnInfoPtr pScrn = xf86Screens[screenNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ Bool rotation_active;
rotation_active = xf86RotateRedisplay(pScreen);
pScreen->BlockHandler = xf86_config->BlockHandler;
@@ -278,40 +267,38 @@ xf86RotateBlockHandler(int screenNum, pointer blockData,
}
void
-xf86RotateDestroy (xf86CrtcPtr crtc)
+xf86RotateDestroy(xf86CrtcPtr crtc)
{
- ScrnInfoPtr pScrn = crtc->scrn;
- ScreenPtr pScreen = pScrn->pScreen;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int c;
-
+ ScrnInfoPtr pScrn = crtc->scrn;
+ ScreenPtr pScreen = pScrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
/* Free memory from rotation */
- if (crtc->rotatedPixmap || crtc->rotatedData)
- {
- crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData);
- crtc->rotatedPixmap = NULL;
- crtc->rotatedData = NULL;
+ if (crtc->rotatedPixmap || crtc->rotatedData) {
+ crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap,
+ crtc->rotatedData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
}
for (c = 0; c < xf86_config->num_crtc; c++)
- if (xf86_config->crtc[c]->rotatedData)
- return;
+ if (xf86_config->crtc[c]->rotatedData)
+ return;
/*
* Clean up damage structures when no crtcs are rotated
*/
- if (xf86_config->rotation_damage)
- {
- /* Free damage structure */
- if (xf86_config->rotation_damage_registered)
- {
- DamageUnregister (&pScreen->root->drawable,
- xf86_config->rotation_damage);
- xf86_config->rotation_damage_registered = FALSE;
- DisableLimitedSchedulingLatency();
- }
- DamageDestroy (xf86_config->rotation_damage);
- xf86_config->rotation_damage = NULL;
+ if (xf86_config->rotation_damage) {
+ /* Free damage structure */
+ if (xf86_config->rotation_damage_registered) {
+ DamageUnregister(&pScreen->root->drawable,
+ xf86_config->rotation_damage);
+ xf86_config->rotation_damage_registered = FALSE;
+ DisableLimitedSchedulingLatency();
+ }
+ DamageDestroy(xf86_config->rotation_damage);
+ xf86_config->rotation_damage = NULL;
}
}
@@ -321,193 +308,186 @@ xf86RotateFreeShadow(ScrnInfoPtr pScrn)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
- for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
- if (crtc->rotatedPixmap || crtc->rotatedData) {
- crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap,
- crtc->rotatedData);
- crtc->rotatedPixmap = NULL;
- crtc->rotatedData = NULL;
- }
- }
+ if (crtc->rotatedPixmap || crtc->rotatedData) {
+ crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap,
+ crtc->rotatedData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+ }
}
void
-xf86RotateCloseScreen (ScreenPtr screen)
+xf86RotateCloseScreen(ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
for (c = 0; c < xf86_config->num_crtc; c++)
- xf86RotateDestroy (xf86_config->crtc[c]);
+ xf86RotateDestroy(xf86_config->crtc[c]);
}
static Bool
-xf86CrtcFitsScreen (xf86CrtcPtr crtc, struct pict_f_transform *crtc_to_fb)
+xf86CrtcFitsScreen(xf86CrtcPtr crtc, struct pict_f_transform *crtc_to_fb)
{
- ScrnInfoPtr pScrn = crtc->scrn;
- BoxRec b;
+ ScrnInfoPtr pScrn = crtc->scrn;
+ BoxRec b;
/* When called before PreInit, the driver is
* presumably doing load detect
*/
if (pScrn->virtualX == 0 || pScrn->virtualY == 0)
- return TRUE;
+ return TRUE;
b.x1 = 0;
b.y1 = 0;
b.x2 = crtc->mode.HDisplay;
b.y2 = crtc->mode.VDisplay;
if (crtc_to_fb)
- pixman_f_transform_bounds (crtc_to_fb, &b);
+ pixman_f_transform_bounds(crtc_to_fb, &b);
else {
- b.x1 += crtc->x;
- b.y1 += crtc->y;
- b.x2 += crtc->x;
- b.y2 += crtc->y;
+ b.x1 += crtc->x;
+ b.y1 += crtc->y;
+ b.x2 += crtc->x;
+ b.y2 += crtc->y;
}
return (0 <= b.x1 && b.x2 <= pScrn->virtualX &&
- 0 <= b.y1 && b.y2 <= pScrn->virtualY);
+ 0 <= b.y1 && b.y2 <= pScrn->virtualY);
}
Bool
-xf86CrtcRotate (xf86CrtcPtr crtc)
+xf86CrtcRotate(xf86CrtcPtr crtc)
{
- ScrnInfoPtr pScrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+
/* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
- PictTransform crtc_to_fb;
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+ PictTransform crtc_to_fb;
struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc;
- xFixed *new_params = NULL;
- int new_nparams = 0;
- PictFilterPtr new_filter = NULL;
- int new_width = 0;
- int new_height = 0;
- RRTransformPtr transform = NULL;
- Bool damage = FALSE;
+ xFixed *new_params = NULL;
+ int new_nparams = 0;
+ PictFilterPtr new_filter = NULL;
+ int new_width = 0;
+ int new_height = 0;
+ RRTransformPtr transform = NULL;
+ Bool damage = FALSE;
if (crtc->transformPresent)
- transform = &crtc->transform;
-
- if (!RRTransformCompute (crtc->x, crtc->y,
- crtc->mode.HDisplay, crtc->mode.VDisplay,
- crtc->rotation,
- transform,
-
- &crtc_to_fb,
- &f_crtc_to_fb,
- &f_fb_to_crtc) &&
- xf86CrtcFitsScreen (crtc, &f_crtc_to_fb))
- {
- /*
- * If the untranslated transformation is the identity,
- * disable the shadow buffer
- */
- xf86RotateDestroy (crtc);
- crtc->transform_in_use = FALSE;
- free(new_params);
- new_params = NULL;
- new_nparams = 0;
- new_filter = NULL;
- new_width = 0;
- new_height = 0;
+ transform = &crtc->transform;
+
+ if (!RRTransformCompute(crtc->x, crtc->y,
+ crtc->mode.HDisplay, crtc->mode.VDisplay,
+ crtc->rotation,
+ transform,
+ &crtc_to_fb,
+ &f_crtc_to_fb,
+ &f_fb_to_crtc) &&
+ xf86CrtcFitsScreen(crtc, &f_crtc_to_fb)) {
+ /*
+ * If the untranslated transformation is the identity,
+ * disable the shadow buffer
+ */
+ xf86RotateDestroy(crtc);
+ crtc->transform_in_use = FALSE;
+ free(new_params);
+ new_params = NULL;
+ new_nparams = 0;
+ new_filter = NULL;
+ new_width = 0;
+ new_height = 0;
}
- else
- {
- if (crtc->driverIsPerformingTransform) {
- xf86RotateDestroy(crtc);
- } else {
- /*
- * these are the size of the shadow pixmap, which
- * matches the mode, not the pre-rotated copy in the
- * frame buffer
- */
- int width = crtc->mode.HDisplay;
- int height = crtc->mode.VDisplay;
- void *shadowData = crtc->rotatedData;
- PixmapPtr shadow = crtc->rotatedPixmap;
- int old_width = shadow ? shadow->drawable.width : 0;
- int old_height = shadow ? shadow->drawable.height : 0;
-
- /* Allocate memory for rotation */
- if (old_width != width || old_height != height)
- {
- if (shadow || shadowData)
- {
- crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
- crtc->rotatedPixmap = NULL;
- crtc->rotatedData = NULL;
- }
- shadowData = crtc->funcs->shadow_allocate (crtc, width, height);
- if (!shadowData)
- goto bail1;
- crtc->rotatedData = shadowData;
- /* shadow will be damaged in xf86RotatePrepare */
- }
- else
- {
- /* mark shadowed area as damaged so it will be repainted */
- damage = TRUE;
- }
-
- if (!xf86_config->rotation_damage)
- {
- /* Create damage structure */
- xf86_config->rotation_damage = DamageCreate (NULL, NULL,
- DamageReportNone,
- TRUE, pScreen, pScreen);
- if (!xf86_config->rotation_damage)
- goto bail2;
-
- /* Wrap block handler */
- if (!xf86_config->BlockHandler) {
- xf86_config->BlockHandler = pScreen->BlockHandler;
- pScreen->BlockHandler = xf86RotateBlockHandler;
- }
- }
-
- if (0)
- {
- bail2:
- if (shadow || shadowData)
- {
- crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
- crtc->rotatedPixmap = NULL;
- crtc->rotatedData = NULL;
- }
- bail1:
- if (old_width && old_height)
- crtc->rotatedPixmap =
- crtc->funcs->shadow_create (crtc, NULL, old_width,
- old_height);
- return FALSE;
- }
- }
+ else {
+ if (crtc->driverIsPerformingTransform) {
+ xf86RotateDestroy(crtc);
+ }
+ else {
+ /*
+ * these are the size of the shadow pixmap, which
+ * matches the mode, not the pre-rotated copy in the
+ * frame buffer
+ */
+ int width = crtc->mode.HDisplay;
+ int height = crtc->mode.VDisplay;
+ void *shadowData = crtc->rotatedData;
+ PixmapPtr shadow = crtc->rotatedPixmap;
+ int old_width = shadow ? shadow->drawable.width : 0;
+ int old_height = shadow ? shadow->drawable.height : 0;
+
+ /* Allocate memory for rotation */
+ if (old_width != width || old_height != height) {
+ if (shadow || shadowData) {
+ crtc->funcs->shadow_destroy(crtc, shadow, shadowData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+ shadowData = crtc->funcs->shadow_allocate(crtc, width, height);
+ if (!shadowData)
+ goto bail1;
+ crtc->rotatedData = shadowData;
+ /* shadow will be damaged in xf86RotatePrepare */
+ }
+ else {
+ /* mark shadowed area as damaged so it will be repainted */
+ damage = TRUE;
+ }
+
+ if (!xf86_config->rotation_damage) {
+ /* Create damage structure */
+ xf86_config->rotation_damage = DamageCreate(NULL, NULL,
+ DamageReportNone,
+ TRUE, pScreen,
+ pScreen);
+ if (!xf86_config->rotation_damage)
+ goto bail2;
+
+ /* Wrap block handler */
+ if (!xf86_config->BlockHandler) {
+ xf86_config->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = xf86RotateBlockHandler;
+ }
+ }
+
+ if (0) {
+ bail2:
+ if (shadow || shadowData) {
+ crtc->funcs->shadow_destroy(crtc, shadow, shadowData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+ bail1:
+ if (old_width && old_height)
+ crtc->rotatedPixmap =
+ crtc->funcs->shadow_create(crtc, NULL, old_width,
+ old_height);
+ return FALSE;
+ }
+ }
#ifdef RANDR_12_INTERFACE
- if (transform)
- {
- if (transform->nparams) {
- new_params = malloc(transform->nparams * sizeof (xFixed));
- if (new_params) {
- memcpy (new_params, transform->params,
- transform->nparams * sizeof (xFixed));
- new_nparams = transform->nparams;
- new_filter = transform->filter;
- }
- } else
- new_filter = transform->filter;
- if (new_filter)
- {
- new_width = new_filter->width;
- new_height = new_filter->height;
- }
- }
+ if (transform) {
+ if (transform->nparams) {
+ new_params = malloc(transform->nparams * sizeof(xFixed));
+ if (new_params) {
+ memcpy(new_params, transform->params,
+ transform->nparams * sizeof(xFixed));
+ new_nparams = transform->nparams;
+ new_filter = transform->filter;
+ }
+ }
+ else
+ new_filter = transform->filter;
+ if (new_filter) {
+ new_width = new_filter->width;
+ new_height = new_filter->height;
+ }
+ }
#endif
- crtc->transform_in_use = TRUE;
+ crtc->transform_in_use = TRUE;
}
crtc->crtc_to_framebuffer = crtc_to_fb;
crtc->f_crtc_to_framebuffer = f_crtc_to_fb;
@@ -522,10 +502,10 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
crtc->bounds.x2 = crtc->mode.HDisplay;
crtc->bounds.y1 = 0;
crtc->bounds.y2 = crtc->mode.VDisplay;
- pixman_f_transform_bounds (&f_crtc_to_fb, &crtc->bounds);
+ pixman_f_transform_bounds(&f_crtc_to_fb, &crtc->bounds);
if (damage)
- xf86CrtcDamageShadow (crtc);
+ xf86CrtcDamageShadow(crtc);
/* All done */
return TRUE;
diff --git a/xorg-server/hw/xfree86/modes/xf86cvt.c b/xorg-server/hw/xfree86/modes/xf86cvt.c
index d5fecccb5..de0784493 100644
--- a/xorg-server/hw/xfree86/modes/xf86cvt.c
+++ b/xorg-server/hw/xfree86/modes/xf86cvt.c
@@ -65,12 +65,12 @@
*/
DisplayModePtr
xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
- Bool Interlaced)
+ Bool Interlaced)
{
- DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
+ DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
/* 1) top/bottom margin size (% of height) - default: 1.8 */
-#define CVT_MARGIN_PERCENTAGE 1.8
+#define CVT_MARGIN_PERCENTAGE 1.8
/* 2) character cell horizontal granularity (pixels) - default 8 */
#define CVT_H_GRANULARITY 8
@@ -85,10 +85,10 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
#define CVT_CLOCK_STEP 250
Bool Margins = FALSE;
- float VFieldRate, HPeriod;
- int HDisplayRnd, HMargin;
- int VDisplayRnd, VMargin, VSync;
- float Interlace; /* Please rename this */
+ float VFieldRate, HPeriod;
+ int HDisplayRnd, HMargin;
+ int VDisplayRnd, VMargin, VSync;
+ float Interlace; /* Please rename this */
/* CVT default is 60.0Hz */
if (!VRefresh)
@@ -108,11 +108,12 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
/* right margin is actually exactly the same as left */
HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
HMargin -= HMargin % CVT_H_GRANULARITY;
- } else
+ }
+ else
HMargin = 0;
/* 4. Find total active pixels */
- Mode->HDisplay = HDisplayRnd + 2*HMargin;
+ Mode->HDisplay = HDisplayRnd + 2 * HMargin;
/* 5. Find number of lines per field */
if (Interlaced)
@@ -128,7 +129,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
else
VMargin = 0;
- Mode->VDisplay = VDisplay + 2*VMargin;
+ Mode->VDisplay = VDisplay + 2 * VMargin;
/* 7. Interlace */
if (Interlaced)
@@ -147,10 +148,10 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
VSync = 7;
else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
VSync = 7;
- else /* Custom */
+ else /* Custom */
VSync = 10;
- if (!Reduced) { /* simplified GTF calculation */
+ if (!Reduced) { /* simplified GTF calculation */
/* 4) Minimum time of vertical sync + back porch interval (µs)
* default 550.0 */
@@ -159,19 +160,20 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
/* 3) Nominal HSync width (% of line period) - default 8 */
#define CVT_HSYNC_PERCENTAGE 8
- float HBlankPercentage;
- int VSyncAndBackPorch, VBackPorch;
- int HBlank;
+ float HBlankPercentage;
+ int VSyncAndBackPorch, VBackPorch;
+ int HBlank;
/* 8. Estimated Horizontal period */
- HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
(VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
/* 9. Find number of lines in sync + backporch */
- if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH))
+ if (((int) (CVT_MIN_VSYNC_BP / HPeriod) + 1) <
+ (VSync + CVT_MIN_V_PORCH))
VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
else
- VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1;
+ VSyncAndBackPorch = (int) (CVT_MIN_VSYNC_BP / HPeriod) + 1;
/* 10. Find number of lines in back porch */
VBackPorch = VSyncAndBackPorch - VSync;
@@ -198,31 +200,32 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
CVT_J_FACTOR
/* 12. Find ideal blanking duty cycle from formula */
- HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0;
+ HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod / 1000.0;
/* 13. Blanking time */
if (HBlankPercentage < 20)
HBlankPercentage = 20;
- HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage);
- HBlank -= HBlank % (2*CVT_H_GRANULARITY);
-
+ HBlank = Mode->HDisplay * HBlankPercentage / (100.0 - HBlankPercentage);
+ HBlank -= HBlank % (2 * CVT_H_GRANULARITY);
+
/* 14. Find total number of pixels in a line. */
Mode->HTotal = Mode->HDisplay + HBlank;
/* Fill in HSync values */
Mode->HSyncEnd = Mode->HDisplay + HBlank / 2;
- Mode->HSyncStart = Mode->HSyncEnd -
+ Mode->HSyncStart = Mode->HSyncEnd -
(Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100;
- Mode->HSyncStart += CVT_H_GRANULARITY -
+ Mode->HSyncStart += CVT_H_GRANULARITY -
Mode->HSyncStart % CVT_H_GRANULARITY;
/* Fill in VSync values */
Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH;
Mode->VSyncEnd = Mode->VSyncStart + VSync;
- } else { /* Reduced blanking */
+ }
+ else { /* Reduced blanking */
/* Minimum vertical blanking interval time (µs) - default 460 */
#define CVT_RB_MIN_VBLANK 460.0
@@ -235,11 +238,11 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
/* Fixed number of lines for vertical front porch - default 3 */
#define CVT_RB_VFPORCH 3
- int VBILines;
+ int VBILines;
/* 8. Estimate Horizontal period. */
- HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
- (VDisplayRnd + 2*VMargin);
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
+ (VDisplayRnd + 2 * VMargin);
/* 9. Find number of lines in vertical blanking */
VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
@@ -247,7 +250,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
/* 10. Check if vertical blanking is sufficient */
if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
-
+
/* 11. Find total number of lines in vertical field */
Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
@@ -271,7 +274,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
/* 17/15. Find actual Field rate */
- Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
+ Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
((float) (Mode->HTotal * Mode->VTotal));
/* 18/16. Find actual vertical frame frequency */
diff --git a/xorg-server/hw/xfree86/modes/xf86gtf.c b/xorg-server/hw/xfree86/modes/xf86gtf.c
index 9d5d50a2d..23707b481 100644
--- a/xorg-server/hw/xfree86/modes/xf86gtf.c
+++ b/xorg-server/hw/xfree86/modes/xf86gtf.c
@@ -61,7 +61,7 @@
/* Ruthlessly converted to server code by Adam Jackson <ajax@redhat.com> */
#ifdef HAVE_XORG_CONFIG_H
-# include <xorg-config.h>
+#include <xorg-config.h>
#else
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -88,7 +88,6 @@
#define C_PRIME (((C - J) * K/256.0) + J)
#define M_PRIME (K/256.0 * M)
-
/*
* xf86GTFMode() - as defined by the GTF Timing Standard, compute the
* Stage 1 Parameters using the vertical refresh frequency. In other
@@ -141,9 +140,9 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
*
* [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND])
*/
-
+
h_pixels_rnd = rint((float) h_pixels / CELL_GRAN) * CELL_GRAN;
-
+
/* 2. If interlace is requested, the number of vertical lines assumed
* by the calculation must be halved, as the computation calculates
* the number of vertical lines per field. In either case, the
@@ -154,9 +153,8 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
*/
v_lines_rnd = interlaced ?
- rint((float) v_lines) / 2.0 :
- rint((float) v_lines);
-
+ rint((float) v_lines) / 2.0 : rint((float) v_lines);
+
/* 3. Find the frame rate required:
*
* [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2,
@@ -181,7 +179,8 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
* 0)
*/
- bottom_margin = margins ? rint(MARGIN_PERCENT/100.0 * v_lines_rnd) : (0.0);
+ bottom_margin =
+ margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0);
/* 6. If interlace is required, then set variable [INTERLACE]=0.5:
*
@@ -197,8 +196,8 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
* [MIN PORCH RND]+[INTERLACE]) * 1000000
*/
- h_period_est = (((1.0/v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP/1000000.0))
- / (v_lines_rnd + (2*top_margin) + MIN_PORCH + interlace)
+ h_period_est = (((1.0 / v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP / 1000000.0))
+ / (v_lines_rnd + (2 * top_margin) + MIN_PORCH + interlace)
* 1000000.0);
/* 8. Find the number of lines in V sync + back porch:
@@ -206,7 +205,7 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
* [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0)
*/
- vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP/h_period_est);
+ vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP / h_period_est);
/* 9. Find the number of lines in V back porch alone:
*
@@ -214,9 +213,9 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
*
* XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]?
*/
-
+
v_back_porch = vsync_plus_bp - V_SYNC_RQD;
-
+
/* 10. Find the total number of lines in Vertical field period:
*
* [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] +
@@ -226,21 +225,21 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp +
interlace + MIN_PORCH;
-
+
/* 11. Estimate the Vertical field frequency:
*
* [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000
*/
v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0;
-
+
/* 12. Find the actual horizontal period:
*
* [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST])
*/
h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est);
-
+
/* 13. Find the actual Vertical field frequency:
*
* [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000
@@ -266,7 +265,7 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
left_margin = margins ?
rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
0.0;
-
+
/* 16. Find number of pixels in right margin:
*
* [RIGHT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y",
@@ -274,11 +273,11 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
* [CELL GRAN RND]),0)) * [CELL GRAN RND],
* 0))
*/
-
+
right_margin = margins ?
rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
0.0;
-
+
/* 17. Find total number of active pixels in image and left and right
* margins:
*
@@ -287,7 +286,7 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
*/
total_active_pixels = h_pixels_rnd + left_margin + right_margin;
-
+
/* 18. Find the ideal blanking duty cycle from the blanking duty cycle
* equation:
*
@@ -295,7 +294,7 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
*/
ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0);
-
+
/* 19. Find the number of pixels in the blanking time to the nearest
* double character cell:
*
@@ -310,34 +309,32 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
ideal_duty_cycle /
(100.0 - ideal_duty_cycle) /
(2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN);
-
+
/* 20. Find total number of pixels:
*
* [TOTAL PIXELS] = [TOTAL ACTIVE PIXELS] + [H BLANK (PIXELS)]
*/
total_pixels = total_active_pixels + h_blank;
-
+
/* 21. Find pixel clock frequency:
*
* [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD]
*/
-
+
pixel_freq = total_pixels / h_period;
-
+
/* 22. Find horizontal frequency:
*
* [H FREQ] = 1000 / [H PERIOD]
*/
h_freq = 1000.0 / h_period;
-
/* Stage 1 computations are now complete; I should really pass
the results to another function and do the Stage 2
computations, but I only need a few more values so I'll just
append the computations here for now */
-
/* 17. Find the number of pixels in the horizontal sync period:
*
@@ -345,7 +342,8 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
* [CELL GRAN RND]),0))*[CELL GRAN RND]
*/
- h_sync = rint(H_SYNC_PERCENT/100.0 * total_pixels / CELL_GRAN) * CELL_GRAN;
+ h_sync =
+ rint(H_SYNC_PERCENT / 100.0 * total_pixels / CELL_GRAN) * CELL_GRAN;
/* 18. Find the number of pixels in the horizontal front porch period:
*
@@ -358,30 +356,30 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
*
* [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE])
*/
-
+
v_odd_front_porch_lines = MIN_PORCH + interlace;
-
+
/* finally, pack the results in the mode struct */
- mode->HDisplay = (int) (h_pixels_rnd);
- mode->HSyncStart = (int) (h_pixels_rnd + h_front_porch);
- mode->HSyncEnd = (int) (h_pixels_rnd + h_front_porch + h_sync);
- mode->HTotal = (int) (total_pixels);
- mode->VDisplay = (int) (v_lines_rnd);
- mode->VSyncStart = (int) (v_lines_rnd + v_odd_front_porch_lines);
- mode->VSyncEnd = (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD);
- mode->VTotal = (int) (total_v_lines);
+ mode->HDisplay = (int) (h_pixels_rnd);
+ mode->HSyncStart = (int) (h_pixels_rnd + h_front_porch);
+ mode->HSyncEnd = (int) (h_pixels_rnd + h_front_porch + h_sync);
+ mode->HTotal = (int) (total_pixels);
+ mode->VDisplay = (int) (v_lines_rnd);
+ mode->VSyncStart = (int) (v_lines_rnd + v_odd_front_porch_lines);
+ mode->VSyncEnd = (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD);
+ mode->VTotal = (int) (total_v_lines);
- mode->Clock = (int) (pixel_freq * 1000.0);
- mode->HSync = h_freq;
- mode->VRefresh = freq;
+ mode->Clock = (int) (pixel_freq * 1000.0);
+ mode->HSync = h_freq;
+ mode->VRefresh = freq;
xf86SetModeDefaultName(mode);
mode->Flags = V_NHSYNC | V_PVSYNC;
if (interlaced) {
- mode->VTotal *= 2;
- mode->Flags |= V_INTERLACE;
+ mode->VTotal *= 2;
+ mode->Flags |= V_INTERLACE;
}
return mode;
diff --git a/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c b/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
index 882fb3b46..91f9fc826 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
@@ -65,21 +65,21 @@ memory_base(void)
static unsigned long base = 0;
if (base == 0) {
- size_t len = sizeof(base);
- int error;
+ size_t len = sizeof(base);
+ int error;
+
#ifdef __OpenBSD__
- int mib[3];
+ int mib[3];
- mib[0] = CTL_MACHDEP;
- mib[1] = CPU_CHIPSET;
- mib[2] = CPU_CHIPSET_MEM;
+ mib[0] = CTL_MACHDEP;
+ mib[1] = CPU_CHIPSET;
+ mib[2] = CPU_CHIPSET_MEM;
- if ((error = sysctl(mib, 3, &base, &len, NULL, 0)) < 0)
+ if ((error = sysctl(mib, 3, &base, &len, NULL, 0)) < 0)
#else
- if ((error = sysctlbyname("hw.chipset.memory", &base, &len,
- 0, 0)) < 0)
+ if ((error = sysctlbyname("hw.chipset.memory", &base, &len, 0, 0)) < 0)
#endif
- FatalError("xf86MapVidMem: can't find memory\n");
+ FatalError("xf86MapVidMem: can't find memory\n");
}
return base;
@@ -91,6 +91,7 @@ has_bwx(void)
static int bwx = 0;
size_t len = sizeof(bwx);
int error;
+
#ifdef __OpenBSD__
int mib[3];
@@ -99,76 +100,74 @@ has_bwx(void)
mib[2] = CPU_CHIPSET_BWX;
if ((error = sysctl(mib, 3, &bwx, &len, NULL, 0)) < 0)
- return FALSE;
+ return FALSE;
else
- return bwx;
+ return bwx;
#else
if ((error = sysctlbyname("hw.chipset.bwx", &bwx, &len, 0, 0)) < 0)
- return FALSE;
+ return FALSE;
else
- return bwx;
+ return bwx;
#endif
}
-#else /* __NetBSD__ */
+#else /* __NetBSD__ */
static unsigned long hae_thresh = (1UL << 24);
-static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */
+static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */
static struct alpha_bus_window *abw;
static int abw_count = -1;
static void
init_abw(void)
{
- if (abw_count < 0) {
- abw_count = alpha_bus_getwindows(ALPHA_BUS_TYPE_PCI_MEM, &abw);
- if (abw_count <= 0)
- FatalError("init_abw: alpha_bus_getwindows failed\n");
- }
+ if (abw_count < 0) {
+ abw_count = alpha_bus_getwindows(ALPHA_BUS_TYPE_PCI_MEM, &abw);
+ if (abw_count <= 0)
+ FatalError("init_abw: alpha_bus_getwindows failed\n");
+ }
}
static int
has_bwx(void)
{
- if (abw_count < 0)
- init_abw();
+ if (abw_count < 0)
+ init_abw();
- xf86Msg(X_INFO, "has_bwx = %d\n",
- abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */
- return abw[0].abw_abst.abst_flags & ABST_BWX;
+ xf86Msg(X_INFO, "has_bwx = %d\n", abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */
+ return abw[0].abw_abst.abst_flags & ABST_BWX;
}
static unsigned long
dense_base(void)
{
- if (abw_count < 0)
- init_abw();
+ if (abw_count < 0)
+ init_abw();
- /* XXX check abst_flags for ABST_DENSE just to be safe? */
- xf86Msg(X_INFO, "dense base = %#lx\n",
- abw[0].abw_abst.abst_sys_start); /* XXXX */
- return abw[0].abw_abst.abst_sys_start;
+ /* XXX check abst_flags for ABST_DENSE just to be safe? */
+ xf86Msg(X_INFO, "dense base = %#lx\n", abw[0].abw_abst.abst_sys_start); /* XXXX */
+ return abw[0].abw_abst.abst_sys_start;
}
static unsigned long
memory_base(void)
{
- if (abw_count < 0)
- init_abw();
-
- if (abw_count > 1) {
- xf86Msg(X_INFO, "memory base = %#lx\n",
- abw[1].abw_abst.abst_sys_start); /* XXXX */
- return abw[1].abw_abst.abst_sys_start;
- } else if (abw_count == 1) {
- /* assume memory_base == dense_base */
- xf86Msg(X_INFO, "memory base = %#lx\n",
- abw[0].abw_abst.abst_sys_start); /* XXXX */
- return abw[0].abw_abst.abst_sys_start;
- } else {
- xf86Msg(X_INFO, "no memory base\n"); /* XXXX */
- return 0;
- }
+ if (abw_count < 0)
+ init_abw();
+
+ if (abw_count > 1) {
+ xf86Msg(X_INFO, "memory base = %#lx\n", abw[1].abw_abst.abst_sys_start); /* XXXX */
+ return abw[1].abw_abst.abst_sys_start;
+ }
+ else if (abw_count == 1) {
+ /* assume memory_base == dense_base */
+ xf86Msg(X_INFO, "memory base = %#lx\n", abw[0].abw_abst.abst_sys_start); /* XXXX */
+ return abw[0].abw_abst.abst_sys_start;
+ }
+ else {
+ xf86Msg(X_INFO, "no memory base\n"); /* XXXX */
+ return 0;
+ }
}
-#endif /* __NetBSD__ */
+#endif /* __NetBSD__ */
#define BUS_BASE dense_base()
#define BUS_BASE_BWX memory_base()
@@ -184,7 +183,7 @@ memory_base(void)
#endif
static Bool useDevMem = FALSE;
-static int devMemFd = -1;
+static int devMemFd = -1;
#ifdef HAS_APERTURE_DRV
#define DEV_APERTURE "/dev/xf86"
@@ -202,148 +201,144 @@ static void unmapVidMemSparse(int, pointer, unsigned long);
static void
checkDevMem(Bool warn)
{
- static Bool devMemChecked = FALSE;
- int fd;
- pointer base;
+ static Bool devMemChecked = FALSE;
+ int fd;
+ pointer base;
- if (devMemChecked)
- return;
- devMemChecked = TRUE;
+ if (devMemChecked)
+ return;
+ devMemChecked = TRUE;
#ifdef HAS_APERTURE_DRV
- /* Try the aperture driver first */
- if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) {
- /* Try to map a page at the VGA address */
- base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
- MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE);
-
- if (base != MAP_FAILED) {
- munmap((caddr_t)base, 4096);
- devMemFd = fd;
- useDevMem = TRUE;
- xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
- DEV_APERTURE);
- return;
- } else {
- if (warn) {
- xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
- DEV_APERTURE, strerror(errno));
- }
- }
- }
+ /* Try the aperture driver first */
+ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE);
+
+ if (base != MAP_FAILED) {
+ munmap((caddr_t) base, 4096);
+ devMemFd = fd;
+ useDevMem = TRUE;
+ xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
+ DEV_APERTURE);
+ return;
+ }
+ else {
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_APERTURE, strerror(errno));
+ }
+ }
+ }
#endif
- if ((fd = open(DEV_MEM, O_RDWR)) >= 0) {
- /* Try to map a page at the VGA address */
- base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
- MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE);
-
- if (base != MAP_FAILED) {
- munmap((caddr_t)base, 4096);
- devMemFd = fd;
- useDevMem = TRUE;
- return;
- } else {
- if (warn) {
- xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- }
- }
- if (warn) {
+ if ((fd = open(DEV_MEM, O_RDWR)) >= 0) {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE);
+
+ if (base != MAP_FAILED) {
+ munmap((caddr_t) base, 4096);
+ devMemFd = fd;
+ useDevMem = TRUE;
+ return;
+ }
+ else {
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ }
+ }
+ if (warn) {
#ifndef HAS_APERTURE_DRV
- xf86Msg(X_WARNING, "checkDevMem: failed to open/mmap %s (%s)\n",
- DEV_MEM, strerror(errno));
+ xf86Msg(X_WARNING, "checkDevMem: failed to open/mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
#else
#ifndef __OpenBSD__
- xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
- "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno));
-#else /* __OpenBSD__ */
- xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
- "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno),
- SYSCTL_MSG);
-#endif /* __OpenBSD__ */
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
+ "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno));
+#else /* __OpenBSD__ */
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
+ "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno),
+ SYSCTL_MSG);
+#endif /* __OpenBSD__ */
#endif
- xf86ErrorF("\tlinear framebuffer access unavailable\n");
- }
- useDevMem = FALSE;
- return;
+ xf86ErrorF("\tlinear framebuffer access unavailable\n");
+ }
+ useDevMem = FALSE;
+ return;
}
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- checkDevMem(TRUE);
- pVidMem->linearSupported = useDevMem;
-
- if (has_bwx()) {
- xf86Msg(X_PROBED,"Machine type has 8/16 bit access\n");
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
- } else {
- xf86Msg(X_PROBED,"Machine needs sparse mapping\n");
- pVidMem->mapMem = mapVidMemSparse;
- pVidMem->unmapMem = unmapVidMemSparse;
+ checkDevMem(TRUE);
+ pVidMem->linearSupported = useDevMem;
+
+ if (has_bwx()) {
+ xf86Msg(X_PROBED, "Machine type has 8/16 bit access\n");
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+ }
+ else {
+ xf86Msg(X_PROBED, "Machine needs sparse mapping\n");
+ pVidMem->mapMem = mapVidMemSparse;
+ pVidMem->unmapMem = unmapVidMemSparse;
#ifndef __NetBSD__
- if (axpSystem == -1)
- axpSystem = bsdGetAXP();
- hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
- hae_mask = xf86AXPParams[axpSystem].hae_mask;
-#endif /* __NetBSD__ */
- }
- pVidMem->initialised = TRUE;
+ if (axpSystem == -1)
+ axpSystem = bsdGetAXP();
+ hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
+ hae_mask = xf86AXPParams[axpSystem].hae_mask;
+#endif /* __NetBSD__ */
+ }
+ pVidMem->initialised = TRUE;
}
static pointer
mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- pointer base;
-
- checkDevMem(FALSE);
- Base = Base & ((1L<<32) - 1);
-
- if (useDevMem)
- {
- if (devMemFd < 0)
- {
- FatalError("xf86MapVidMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t)0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
- if (base == MAP_FAILED)
- {
- FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n",
- "xf86MapVidMem", DEV_MEM, Size, Base,
- strerror(errno));
- }
- return base;
- }
-
- /* else, mmap /dev/vga */
- if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000)
- {
- FatalError("%s: Address 0x%lx outside allowable range\n",
- "xf86MapVidMem", Base);
- }
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.consoleFd,
- (unsigned long)Base + BUS_BASE);
- if (base == MAP_FAILED)
- {
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
- strerror(errno));
- }
- return base;
+ pointer base;
+
+ checkDevMem(FALSE);
+ Base = Base & ((1L << 32) - 1);
+
+ if (useDevMem) {
+ if (devMemFd < 0) {
+ FatalError("xf86MapVidMem: failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ base = mmap((caddr_t) 0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, devMemFd, (off_t) Base + BUS_BASE_BWX);
+ if (base == MAP_FAILED) {
+ FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n",
+ "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno));
+ }
+ return base;
+ }
+
+ /* else, mmap /dev/vga */
+ if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) {
+ FatalError("%s: Address 0x%lx outside allowable range\n",
+ "xf86MapVidMem", Base);
+ }
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base + BUS_BASE);
+ if (base == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
+ strerror(errno));
+ }
+ return base;
}
static void
unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- munmap((caddr_t)Base, Size);
+ munmap((caddr_t) Base, Size);
}
/*
@@ -352,45 +347,44 @@ unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
int
xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
+ int Len)
{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- checkDevMem(TRUE);
- if (devMemFd == -1) {
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
- MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE);
- if ((long)ptr == -1)
- {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
- DEV_MEM, Len, Base, Offset, strerror(errno));
- return -1;
- }
+ unsigned char *ptr;
+ int psize;
+ int mlen;
+
+ checkDevMem(TRUE);
+ if (devMemFd == -1) {
+ return -1;
+ }
+
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
+ MAP_SHARED, devMemFd, (off_t) Base + BUS_BASE);
+ if ((long) ptr == -1) {
+ xf86Msg(X_WARNING,
+ "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
+ DEV_MEM, Len, Base, Offset, strerror(errno));
+ return -1;
+ }
#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
- Base, ptr[0] | (ptr[1] << 8));
+ xf86MsgVerb(X_INFO, 3,
+ "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", Base,
+ ptr[0] | (ptr[1] << 8));
#endif
- (void)memcpy(Buf, (void *)(ptr + Offset), Len);
- (void)munmap((caddr_t)ptr, mlen);
+ (void) memcpy(Buf, (void *) (ptr + Offset), Len);
+ (void) munmap((caddr_t) ptr, mlen);
#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
- "-> %02x %02x %02x %02x...\n",
- Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
+ xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
+ "-> %02x %02x %02x %02x...\n",
+ Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
#endif
- return Len;
+ return Len;
}
-
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
extern int ioperm(unsigned long from, unsigned long num, int on);
@@ -399,34 +393,34 @@ Bool
xf86EnableIO()
{
if (!ioperm(0, 65536, TRUE))
- return TRUE;
+ return TRUE;
return FALSE;
}
void
xf86DisableIO()
{
- return;
+ return;
}
-#endif /* __FreeBSD_kernel__ || __OpenBSD__ */
+#endif /* __FreeBSD_kernel__ || __OpenBSD__ */
#ifdef USE_ALPHA_PIO
Bool
xf86EnableIO()
{
- alpha_pci_io_enable(1);
- return TRUE;
+ alpha_pci_io_enable(1);
+ return TRUE;
}
void
xf86DisableIO()
{
- alpha_pci_io_enable(0);
+ alpha_pci_io_enable(0);
}
-#endif /* USE_ALPHA_PIO */
+#endif /* USE_ALPHA_PIO */
#define vuip volatile unsigned int *
@@ -437,39 +431,39 @@ extern int readDense8(pointer Base, register unsigned long Offset);
extern int readDense16(pointer Base, register unsigned long Offset);
extern int readDense32(pointer Base, register unsigned long Offset);
extern void
-writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDense8(int Value, pointer Base, register unsigned long Offset);
+ writeDense8(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDense16(int Value, pointer Base, register unsigned long Offset);
+ writeDense16(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDense32(int Value, pointer Base, register unsigned long Offset);
+ writeDense32(int Value, pointer Base, register unsigned long Offset);
static int readSparse8(pointer Base, register unsigned long Offset);
static int readSparse16(pointer Base, register unsigned long Offset);
static int readSparse32(pointer Base, register unsigned long Offset);
static void
-writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparse8(int Value, pointer Base, register unsigned long Offset);
+ writeSparse8(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparse16(int Value, pointer Base, register unsigned long Offset);
+ writeSparse16(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparse32(int Value, pointer Base, register unsigned long Offset);
+ writeSparse32(int Value, pointer Base, register unsigned long Offset);
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
extern int sysarch(int, void *);
struct parms {
- u_int64_t hae;
+ u_int64_t hae;
};
static void
@@ -478,50 +472,49 @@ sethae(u_int64_t hae)
#ifndef ALPHA_SETHAE
#define ALPHA_SETHAE 0
#endif
- static struct parms p;
+ static struct parms p;
- if (p.hae != hae) {
- p.hae = hae;
- sysarch(ALPHA_SETHAE, (char *)&p);
- }
+ if (p.hae != hae) {
+ p.hae = hae;
+ sysarch(ALPHA_SETHAE, (char *) &p);
+ }
}
#endif
static pointer
-mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
+ int flags)
{
static Bool was_here = FALSE;
if (!was_here) {
- was_here = TRUE;
-
- checkDevMem(FALSE);
-
- xf86WriteMmio8 = writeSparse8;
- xf86WriteMmio16 = writeSparse16;
- xf86WriteMmio32 = writeSparse32;
- xf86WriteMmioNB8 = writeSparseNB8;
- xf86WriteMmioNB16 = writeSparseNB16;
- xf86WriteMmioNB32 = writeSparseNB32;
- xf86ReadMmio8 = readSparse8;
- xf86ReadMmio16 = readSparse16;
- xf86ReadMmio32 = readSparse32;
-
- memBase = mmap((caddr_t)0, 0x100000000,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, devMemFd,
- (off_t) BUS_BASE);
- memSBase = mmap((caddr_t)0, 0x100000000,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, devMemFd,
- (off_t) BUS_BASE_BWX);
-
- if (memSBase == MAP_FAILED || memBase == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n",
- strerror(errno));
- }
+ was_here = TRUE;
+
+ checkDevMem(FALSE);
+
+ xf86WriteMmio8 = writeSparse8;
+ xf86WriteMmio16 = writeSparse16;
+ xf86WriteMmio32 = writeSparse32;
+ xf86WriteMmioNB8 = writeSparseNB8;
+ xf86WriteMmioNB16 = writeSparseNB16;
+ xf86WriteMmioNB32 = writeSparseNB32;
+ xf86ReadMmio8 = readSparse8;
+ xf86ReadMmio16 = readSparse16;
+ xf86ReadMmio32 = readSparse32;
+
+ memBase = mmap((caddr_t) 0, 0x100000000,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, devMemFd, (off_t) BUS_BASE);
+ memSBase = mmap((caddr_t) 0, 0x100000000,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, devMemFd, (off_t) BUS_BASE_BWX);
+
+ if (memSBase == MAP_FAILED || memBase == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n",
+ strerror(errno));
+ }
}
- return (pointer)((unsigned long)memBase + Base);
+ return (pointer) ((unsigned long) memBase + Base);
}
static void
@@ -534,17 +527,18 @@ readSparse8(pointer Base, register unsigned long Offset)
{
register unsigned long result, shift;
register unsigned long msb;
+
mem_barrier();
- Offset += (unsigned long)Base - (unsigned long)memBase;
+ Offset += (unsigned long) Base - (unsigned long) memBase;
shift = (Offset & 0x3) << 3;
- if (Offset >= (hae_thresh)) {
+ if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
+ sethae(msb);
#endif
- }
- result = *(vuip) ((unsigned long)memSBase + (Offset << 5));
+ }
+ result = *(vuip) ((unsigned long) memSBase + (Offset << 5));
result >>= shift;
return 0xffUL & result;
}
@@ -556,16 +550,17 @@ readSparse16(pointer Base, register unsigned long Offset)
register unsigned long msb;
mem_barrier();
- Offset += (unsigned long)Base - (unsigned long)memBase;
+ Offset += (unsigned long) Base - (unsigned long) memBase;
shift = (Offset & 0x2) << 3;
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
+ sethae(msb);
#endif
}
- result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2)));
+ result =
+ *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2)));
result >>= shift;
return 0xffffUL & result;
}
@@ -574,7 +569,7 @@ static int
readSparse32(pointer Base, register unsigned long Offset)
{
mem_barrier();
- return *(vuip)((unsigned long)Base+(Offset));
+ return *(vuip) ((unsigned long) Base + (Offset));
}
static void
@@ -584,15 +579,15 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
register unsigned int b = Value & 0xffU;
write_mem_barrier();
- Offset += (unsigned long)Base - (unsigned long)memBase;
+ Offset += (unsigned long) Base - (unsigned long) memBase;
if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
+ msb = Offset & hae_mask;
+ Offset -= msb;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
+ sethae(msb);
#endif
}
- *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
+ *(vuip) ((unsigned long) memSBase + (Offset << 5)) = b * 0x01010101;
}
static void
@@ -602,16 +597,16 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
register unsigned int w = Value & 0xffffU;
write_mem_barrier();
- Offset += (unsigned long)Base - (unsigned long)memBase;
+ Offset += (unsigned long) Base - (unsigned long) memBase;
if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
+ msb = Offset & hae_mask;
+ Offset -= msb;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
+ sethae(msb);
#endif
}
- *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
- w * 0x00010001;
+ *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))) =
+ w * 0x00010001;
}
@@ -619,7 +614,7 @@ static void
writeSparse32(int Value, pointer Base, register unsigned long Offset)
{
write_mem_barrier();
- *(vuip)((unsigned long)Base + (Offset)) = Value;
+ *(vuip) ((unsigned long) Base + (Offset)) = Value;
return;
}
@@ -629,15 +624,15 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
register unsigned long msb;
register unsigned int b = Value & 0xffU;
- Offset += (unsigned long)Base - (unsigned long)memBase;
+ Offset += (unsigned long) Base - (unsigned long) memBase;
if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
+ msb = Offset & hae_mask;
+ Offset -= msb;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
+ sethae(msb);
#endif
}
- *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
+ *(vuip) ((unsigned long) memSBase + (Offset << 5)) = b * 0x01010101;
}
static void
@@ -646,41 +641,40 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
register unsigned long msb;
register unsigned int w = Value & 0xffffU;
- Offset += (unsigned long)Base - (unsigned long)memBase;
+ Offset += (unsigned long) Base - (unsigned long) memBase;
if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask ;
- Offset -= msb;
+ msb = Offset & hae_mask;
+ Offset -= msb;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
+ sethae(msb);
#endif
}
- *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
- w * 0x00010001;
+ *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))) =
+ w * 0x00010001;
}
static void
writeSparseNB32(int Value, pointer Base, register unsigned long Offset)
{
- *(vuip)((unsigned long)Base + (Offset)) = Value;
+ *(vuip) ((unsigned long) Base + (Offset)) = Value;
return;
}
-void (*xf86WriteMmio8)(int Value, pointer Base, unsigned long Offset)
- = writeDense8;
-void (*xf86WriteMmio16)(int Value, pointer Base, unsigned long Offset)
- = writeDense16;
-void (*xf86WriteMmio32)(int Value, pointer Base, unsigned long Offset)
- = writeDense32;
-void (*xf86WriteMmioNB8)(int Value, pointer Base, unsigned long Offset)
- = writeDenseNB8;
-void (*xf86WriteMmioNB16)(int Value, pointer Base, unsigned long Offset)
- = writeDenseNB16;
-void (*xf86WriteMmioNB32)(int Value, pointer Base, unsigned long Offset)
- = writeDenseNB32;
-int (*xf86ReadMmio8)(pointer Base, unsigned long Offset)
- = readDense8;
-int (*xf86ReadMmio16)(pointer Base, unsigned long Offset)
- = readDense16;
-int (*xf86ReadMmio32)(pointer Base, unsigned long Offset)
- = readDense32;
-
+void (*xf86WriteMmio8) (int Value, pointer Base, unsigned long Offset)
+ = writeDense8;
+void (*xf86WriteMmio16) (int Value, pointer Base, unsigned long Offset)
+ = writeDense16;
+void (*xf86WriteMmio32) (int Value, pointer Base, unsigned long Offset)
+ = writeDense32;
+void (*xf86WriteMmioNB8) (int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB8;
+void (*xf86WriteMmioNB16) (int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB16;
+void (*xf86WriteMmioNB32) (int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB32;
+int (*xf86ReadMmio8) (pointer Base, unsigned long Offset)
+ = readDense8;
+int (*xf86ReadMmio16) (pointer Base, unsigned long Offset)
+ = readDense16;
+int (*xf86ReadMmio32) (pointer Base, unsigned long Offset)
+ = readDense32;
diff --git a/xorg-server/hw/xfree86/os-support/bsd/arm_video.c b/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
index 1de6c87d6..71064af03 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
@@ -68,8 +68,7 @@
#ifdef __arm32__
#include "machine/devmap.h"
-struct memAccess
-{
+struct memAccess {
int ioctl;
struct map_info memInfo;
pointer regionVirtBase;
@@ -82,14 +81,19 @@ static void xf86MapInfoUnmap();
static struct memAccess *checkMapInfo();
extern int vgaPhysLinearBase;
-/* A memAccess structure is needed for each possible region */
-struct memAccess vgaMemInfo = { CONSOLE_GET_MEM_INFO, NULL, NULL,
- FALSE, FALSE };
-struct memAccess linearMemInfo = { CONSOLE_GET_LINEAR_INFO, NULL, NULL,
- FALSE, FALSE };
+/* A memAccess structure is needed for each possible region */
+struct memAccess vgaMemInfo = { CONSOLE_GET_MEM_INFO, NULL, NULL,
+ FALSE, FALSE
+};
+
+struct memAccess linearMemInfo = { CONSOLE_GET_LINEAR_INFO, NULL, NULL,
+ FALSE, FALSE
+};
+
struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL,
- FALSE, FALSE };
-#endif /* __arm32__ */
+ FALSE, FALSE
+};
+#endif /* __arm32__ */
#if defined(__NetBSD__) && !defined(MAP_FILE)
#define MAP_FLAGS MAP_SHARED
@@ -100,13 +104,12 @@ struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL,
#define BUS_BASE 0L
#define BUS_BASE_BWX 0L
-
/***************************************************************************/
/* Video Memory Mapping section */
/***************************************************************************/
static Bool useDevMem = FALSE;
-static int devMemFd = -1;
+static int devMemFd = -1;
static pointer mapVidMem(int, unsigned long, unsigned long, int);
static void unmapVidMem(int, pointer, unsigned long);
@@ -118,108 +121,98 @@ static void unmapVidMem(int, pointer, unsigned long);
static void
checkDevMem(Bool warn)
{
- static Bool devMemChecked = FALSE;
- int fd;
- pointer base;
-
- if (devMemChecked)
- return;
- devMemChecked = TRUE;
-
- if ((fd = open(DEV_MEM, O_RDWR)) >= 0)
- {
- /* Try to map a page at the VGA address */
- base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
- MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE);
-
- if (base != MAP_FAILED)
- {
- munmap((caddr_t)base, 4096);
- devMemFd = fd;
- useDevMem = TRUE;
- return;
- } else {
- /* This should not happen */
- if (warn)
- {
- xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- useDevMem = FALSE;
- return;
- }
- }
- if (warn)
- {
- xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- useDevMem = FALSE;
- return;
+ static Bool devMemChecked = FALSE;
+ int fd;
+ pointer base;
+
+ if (devMemChecked)
+ return;
+ devMemChecked = TRUE;
+
+ if ((fd = open(DEV_MEM, O_RDWR)) >= 0) {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE);
+
+ if (base != MAP_FAILED) {
+ munmap((caddr_t) base, 4096);
+ devMemFd = fd;
+ useDevMem = TRUE;
+ return;
+ }
+ else {
+ /* This should not happen */
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ useDevMem = FALSE;
+ return;
+ }
+ }
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ useDevMem = FALSE;
+ return;
}
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- checkDevMem(TRUE);
- pVidMem->linearSupported = useDevMem;
- pVidMem->mapMem = armMapVidMem;
- pVidMem->unmapVidMem = armUnmapVidMem;
+ checkDevMem(TRUE);
+ pVidMem->linearSupported = useDevMem;
+ pVidMem->mapMem = armMapVidMem;
+ pVidMem->unmapVidMem = armUnmapVidMem;
- pVidMem->initialised = TRUE;
+ pVidMem->initialised = TRUE;
}
static pointer
mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- pointer base;
-
- checkDevMem(FALSE);
-
- if (useDevMem)
- {
- if (devMemFd < 0)
- {
- FatalError("xf86MapVidMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t)0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
- if (base == MAP_FAILED)
- {
- FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n",
- "xf86MapVidMem", DEV_MEM, Size, Base,
- strerror(errno));
- }
- return base;
- }
-
- /* else, mmap /dev/vga */
- if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000)
- {
- FatalError("%s: Address 0x%x outside allowable range\n",
- "xf86MapVidMem", Base);
- }
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.consoleFd,
- (unsigned long)Base - 0xA0000);
- if (base == MAP_FAILED)
- {
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
- strerror(errno));
- }
- return base;
+ pointer base;
+
+ checkDevMem(FALSE);
+
+ if (useDevMem) {
+ if (devMemFd < 0) {
+ FatalError("xf86MapVidMem: failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ base = mmap((caddr_t) 0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, devMemFd, (off_t) Base + BUS_BASE_BWX);
+ if (base == MAP_FAILED) {
+ FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n",
+ "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno));
+ }
+ return base;
+ }
+
+ /* else, mmap /dev/vga */
+ if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) {
+ FatalError("%s: Address 0x%x outside allowable range\n",
+ "xf86MapVidMem", Base);
+ }
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base - 0xA0000);
+ if (base == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
+ strerror(errno));
+ }
+ return base;
}
static void
unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- munmap((caddr_t)Base, Size);
+ munmap((caddr_t) Base, Size);
}
/*
@@ -228,45 +221,43 @@ unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
int
xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
+ int Len)
{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- checkDevMem(TRUE);
- if (devMemFd == -1) {
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
- MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE);
- if ((long)ptr == -1)
- {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n",
- DEV_MEM, Len, Base, Offset, strerror(errno));
- return -1;
- }
+ unsigned char *ptr;
+ int psize;
+ int mlen;
+
+ checkDevMem(TRUE);
+ if (devMemFd == -1) {
+ return -1;
+ }
+
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
+ MAP_SHARED, devMemFd, (off_t) Base + BUS_BASE);
+ if ((long) ptr == -1) {
+ xf86Msg(X_WARNING,
+ "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n",
+ DEV_MEM, Len, Base, Offset, strerror(errno));
+ return -1;
+ }
#ifdef DEBUG
- ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
- Base, ptr[0] | (ptr[1] << 8));
+ ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
+ Base, ptr[0] | (ptr[1] << 8));
#endif
- (void)memcpy(Buf, (void *)(ptr + Offset), Len);
- (void)munmap((caddr_t)ptr, mlen);
+ (void) memcpy(Buf, (void *) (ptr + Offset), Len);
+ (void) munmap((caddr_t) ptr, mlen);
#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
- "-> %02x %02x %02x %02x...\n",
- Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
+ xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
+ "-> %02x %02x %02x %02x...\n",
+ Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
#endif
- return Len;
+ return Len;
}
-
/* XXX This needs to be updated for the ND */
/*
@@ -277,52 +268,45 @@ static struct memAccess *
checkMapInfo(Bool warn, int Region)
{
struct memAccess *memAccP;
-
- switch (Region)
- {
- case VGA_REGION:
- memAccP = &vgaMemInfo;
- break;
-
- case LINEAR_REGION:
- memAccP = &linearMemInfo;
- break;
-
- case MMIO_REGION:
- memAccP = &ioMemInfo;
- break;
-
- default:
- return NULL;
- break;
+
+ switch (Region) {
+ case VGA_REGION:
+ memAccP = &vgaMemInfo;
+ break;
+
+ case LINEAR_REGION:
+ memAccP = &linearMemInfo;
+ break;
+
+ case MMIO_REGION:
+ memAccP = &ioMemInfo;
+ break;
+
+ default:
+ return NULL;
+ break;
}
-
- if(!memAccP->Checked)
- {
- if(ioctl(xf86Info.consoleFd, memAccP->ioctl, &(memAccP->memInfo)) == -1)
- {
- if(warn)
- {
- xf86Msg(X_WARNING,
- "checkMapInfo: failed to get map info for region %d\n\t(%s)\n",
- Region, strerror(errno));
- }
- }
- else
- {
- if(memAccP->memInfo.u.map_info_mmap.map_offset
- != MAP_INFO_UNKNOWN)
- memAccP->OK = TRUE;
- }
- memAccP->Checked = TRUE;
+
+ if (!memAccP->Checked) {
+ if (ioctl(xf86Info.consoleFd, memAccP->ioctl, &(memAccP->memInfo)) ==
+ -1) {
+ if (warn) {
+ xf86Msg(X_WARNING,
+ "checkMapInfo: failed to get map info for region %d\n\t(%s)\n",
+ Region, strerror(errno));
+ }
+ }
+ else {
+ if (memAccP->memInfo.u.map_info_mmap.map_offset != MAP_INFO_UNKNOWN)
+ memAccP->OK = TRUE;
+ }
+ memAccP->Checked = TRUE;
}
- if (memAccP->OK)
- {
- return memAccP;
+ if (memAccP->OK) {
+ return memAccP;
}
- else
- {
- return NULL;
+ else {
+ return NULL;
}
}
@@ -331,113 +315,103 @@ xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size)
{
struct map_info *mapInfoP = &(memInfoP->memInfo);
- if (mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN)
- {
- Size = (unsigned long)Base + Size;
+ if (mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) {
+ Size = (unsigned long) Base + Size;
}
- else
- {
- Size = mapInfoP->u.map_info_mmap.map_size;
+ else {
+ Size = mapInfoP->u.map_info_mmap.map_size;
}
-
- switch(mapInfoP->method)
- {
- case MAP_MMAP:
- /* Need to remap if size is unknown because we may not have
- mapped the whole region initially */
- if(memInfoP->regionVirtBase == NULL ||
- mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN)
- {
- if((memInfoP->regionVirtBase =
- mmap((caddr_t)0,
- Size,
- PROT_READ | PROT_WRITE,
- MAP_SHARED,
- xf86Info.consoleFd,
- (unsigned long)mapInfoP->u.map_info_mmap.map_offset))
- == (pointer)-1)
- {
- FatalError("xf86MapInfoMap: Failed to map memory at 0x%x\n\t%s\n",
- mapInfoP->u.map_info_mmap.map_offset, strerror(errno));
- }
- if(mapInfoP->u.map_info_mmap.internal_offset > 0)
- memInfoP->regionVirtBase +=
- mapInfoP->u.map_info_mmap.internal_offset;
- }
- break;
-
- default:
- FatalError("xf86MapInfoMap: Unsuported mapping method\n");
- break;
+
+ switch (mapInfoP->method) {
+ case MAP_MMAP:
+ /* Need to remap if size is unknown because we may not have
+ mapped the whole region initially */
+ if (memInfoP->regionVirtBase == NULL ||
+ mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) {
+ if ((memInfoP->regionVirtBase =
+ mmap((caddr_t) 0,
+ Size,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+ xf86Info.consoleFd,
+ (unsigned long) mapInfoP->u.map_info_mmap.map_offset))
+ == (pointer) -1) {
+ FatalError
+ ("xf86MapInfoMap: Failed to map memory at 0x%x\n\t%s\n",
+ mapInfoP->u.map_info_mmap.map_offset, strerror(errno));
+ }
+ if (mapInfoP->u.map_info_mmap.internal_offset > 0)
+ memInfoP->regionVirtBase +=
+ mapInfoP->u.map_info_mmap.internal_offset;
+ }
+ break;
+
+ default:
+ FatalError("xf86MapInfoMap: Unsuported mapping method\n");
+ break;
}
-
- return (pointer)((int)memInfoP->regionVirtBase + (int)Base);
+
+ return (pointer) ((int) memInfoP->regionVirtBase + (int) Base);
}
static void
xf86MapInfoUnmap(struct memAccess *memInfoP, unsigned long Size)
{
struct map_info *mapInfoP = &(memInfoP->memInfo);
-
- switch(mapInfoP->method)
- {
- case MAP_MMAP:
- if(memInfoP->regionVirtBase != NULL)
- {
- if(mapInfoP->u.map_info_mmap.map_size != MAP_INFO_UNKNOWN)
- Size = mapInfoP->u.map_info_mmap.map_size;
- munmap((caddr_t)memInfoP->regionVirtBase, Size);
- memInfoP->regionVirtBase = NULL;
- }
- break;
- default:
- FatalError("xf86MapInfoMap: Unsuported mapping method\n");
- break;
+
+ switch (mapInfoP->method) {
+ case MAP_MMAP:
+ if (memInfoP->regionVirtBase != NULL) {
+ if (mapInfoP->u.map_info_mmap.map_size != MAP_INFO_UNKNOWN)
+ Size = mapInfoP->u.map_info_mmap.map_size;
+ munmap((caddr_t) memInfoP->regionVirtBase, Size);
+ memInfoP->regionVirtBase = NULL;
+ }
+ break;
+ default:
+ FatalError("xf86MapInfoMap: Unsuported mapping method\n");
+ break;
}
}
static pointer
armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- struct memAccess *memInfoP;
-
- if((memInfoP = checkMapInfo(FALSE, Region)) != NULL)
- {
- /*
- ** xf86 passes in a physical address offset from the start
- ** of physical memory, but xf86MapInfoMap expects an
- ** offset from the start of the specified region - it gets
- ** the physical address of the region from the display driver.
- */
- switch(Region)
- {
- case LINEAR_REGION:
- if (vgaPhysLinearBase)
- {
- Base -= vgaPhysLinearBase;
- }
- break;
- case VGA_REGION:
- Base -= 0xA0000;
- break;
- }
-
- base = xf86MapInfoMap(memInfoP, Base, Size);
- return base;
- }
- return mapVidMem(ScreenNum, Base, Size, flags);
+ struct memAccess *memInfoP;
+
+ if ((memInfoP = checkMapInfo(FALSE, Region)) != NULL) {
+ /*
+ ** xf86 passes in a physical address offset from the start
+ ** of physical memory, but xf86MapInfoMap expects an
+ ** offset from the start of the specified region - it gets
+ ** the physical address of the region from the display driver.
+ */
+ switch (Region) {
+ case LINEAR_REGION:
+ if (vgaPhysLinearBase) {
+ Base -= vgaPhysLinearBase;
+ }
+ break;
+ case VGA_REGION:
+ Base -= 0xA0000;
+ break;
+ }
+
+ base = xf86MapInfoMap(memInfoP, Base, Size);
+ return base;
+ }
+ return mapVidMem(ScreenNum, Base, Size, flags);
}
static void
armUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- struct memAccess *memInfoP;
-
- if((memInfoP = checkMapInfo(FALSE, Region)) != NULL)
- {
- xf86MapInfoUnmap(memInfoP, Base, Size);
- }
- unmapVidMem(ScreenNum, Base, Size);
+ struct memAccess *memInfoP;
+
+ if ((memInfoP = checkMapInfo(FALSE, Region)) != NULL) {
+ xf86MapInfoUnmap(memInfoP, Base, Size);
+ }
+ unmapVidMem(ScreenNum, Base, Size);
}
#ifdef USE_DEV_IO
@@ -446,27 +420,26 @@ static int IoFd = -1;
Bool
xf86EnableIO()
{
- if (IoFd >= 0)
- return TRUE;
-
- if ((IoFd = open("/dev/io", O_RDWR)) == -1)
- {
- xf86Msg(X_WARNING,"xf86EnableIO: "
- "Failed to open /dev/io for extended I/O\n");
- return FALSE;
- }
- return TRUE;
+ if (IoFd >= 0)
+ return TRUE;
+
+ if ((IoFd = open("/dev/io", O_RDWR)) == -1) {
+ xf86Msg(X_WARNING, "xf86EnableIO: "
+ "Failed to open /dev/io for extended I/O\n");
+ return FALSE;
+ }
+ return TRUE;
}
void
xf86DisableIO()
{
- if (IoFd < 0)
- return;
+ if (IoFd < 0)
+ return;
- close(IoFd);
- IoFd = -1;
- return;
+ close(IoFd);
+ IoFd = -1;
+ return;
}
#endif
@@ -476,44 +449,44 @@ xf86DisableIO()
Bool
xf86EnableIO()
{
- int fd;
- pointer base;
-
- if (ExtendedEnabled)
- return TRUE;
-
- if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
- /* Try to map a page at the pccons I/O space */
- base = (pointer)mmap((caddr_t)0, 65536, PROT_READ | PROT_WRITE,
- MAP_FLAGS, fd, (off_t)0x0000);
-
- if (base != (pointer)-1) {
- IOPortBase = base;
- }
- else {
- xf86Msg(X_WARNING,"EnableIO: failed to mmap %s (%s)\n",
- "/dev/ttyC0", strerror(errno));
- return FALSE;
- }
- }
- else {
- xf86Msg("EnableIO: failed to open %s (%s)\n",
- "/dev/ttyC0", strerror(errno));
- return FALSE;
- }
-
- ExtendedEnabled = TRUE;
-
- return TRUE;
+ int fd;
+ pointer base;
+
+ if (ExtendedEnabled)
+ return TRUE;
+
+ if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
+ /* Try to map a page at the pccons I/O space */
+ base = (pointer) mmap((caddr_t) 0, 65536, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t) 0x0000);
+
+ if (base != (pointer) -1) {
+ IOPortBase = base;
+ }
+ else {
+ xf86Msg(X_WARNING, "EnableIO: failed to mmap %s (%s)\n",
+ "/dev/ttyC0", strerror(errno));
+ return FALSE;
+ }
+ }
+ else {
+ xf86Msg("EnableIO: failed to open %s (%s)\n",
+ "/dev/ttyC0", strerror(errno));
+ return FALSE;
+ }
+
+ ExtendedEnabled = TRUE;
+
+ return TRUE;
}
void
xf86DisableIO()
{
- return;
+ return;
}
-#endif /* USE_ARC_MMAP */
+#endif /* USE_ARC_MMAP */
#if 0
/*
@@ -534,126 +507,122 @@ Bool
xf86EnableIOPorts(ScreenNum)
int ScreenNum;
{
- int i;
- int fd;
- pointer base;
+ int i;
+ int fd;
+ pointer base;
#ifdef __arm32__
- struct memAccess *memInfoP;
- int *Size;
+ struct memAccess *memInfoP;
+ int *Size;
#endif
- ScreenEnabled[ScreenNum] = TRUE;
+ ScreenEnabled[ScreenNum] = TRUE;
- if (ExtendedEnabled)
- return TRUE;
+ if (ExtendedEnabled)
+ return TRUE;
#ifdef USE_ARC_MMAP
- if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
- /* Try to map a page at the pccons I/O space */
- base = (pointer)mmap((caddr_t)0, 65536, PROT_READ | PROT_WRITE,
- MAP_FLAGS, fd, (off_t)0x0000);
-
- if (base != (pointer)-1) {
- IOPortBase = base;
- }
- else {
- xf86Msg(X_ERROR,
- "EnableIOPorts: failed to mmap %s (%s)\n",
- "/dev/ttyC0", strerror(errno));
- }
- }
- else {
- xf86Msg(X_ERROR, "EnableIOPorts: failed to open %s (%s)\n",
- "/dev/ttyC0", strerror(errno));
- }
+ if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
+ /* Try to map a page at the pccons I/O space */
+ base = (pointer) mmap((caddr_t) 0, 65536, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t) 0x0000);
+
+ if (base != (pointer) -1) {
+ IOPortBase = base;
+ }
+ else {
+ xf86Msg(X_ERROR,
+ "EnableIOPorts: failed to mmap %s (%s)\n",
+ "/dev/ttyC0", strerror(errno));
+ }
+ }
+ else {
+ xf86Msg(X_ERROR, "EnableIOPorts: failed to open %s (%s)\n",
+ "/dev/ttyC0", strerror(errno));
+ }
#endif
#ifdef __arm32__
- IOPortBase = (unsigned int)-1;
-
- if((memInfoP = checkMapInfo(TRUE, MMIO_REGION)) != NULL)
- {
- /*
- * xf86MapInfoMap maps an offset from the start of video IO
- * space (e.g. 0x3B0), but IOPortBase is expected to map to
- * physical address 0x000, so subtract the start of video I/O
- * space from the result. This is safe for now becase we
- * actually mmap the start of the page, then the start of video
- * I/O space is added as an internal offset.
- */
- IOPortBase = (unsigned int)xf86MapInfoMap(memInfoP,
- (caddr_t)0x0, 0L)
- - memInfoP->memInfo.u.map_info_mmap.internal_offset;
- ExtendedEnabled = TRUE;
- return TRUE;
- }
+ IOPortBase = (unsigned int) -1;
+
+ if ((memInfoP = checkMapInfo(TRUE, MMIO_REGION)) != NULL) {
+ /*
+ * xf86MapInfoMap maps an offset from the start of video IO
+ * space (e.g. 0x3B0), but IOPortBase is expected to map to
+ * physical address 0x000, so subtract the start of video I/O
+ * space from the result. This is safe for now becase we
+ * actually mmap the start of the page, then the start of video
+ * I/O space is added as an internal offset.
+ */
+ IOPortBase = (unsigned int) xf86MapInfoMap(memInfoP, (caddr_t) 0x0, 0L)
+ - memInfoP->memInfo.u.map_info_mmap.internal_offset;
+ ExtendedEnabled = TRUE;
+ return TRUE;
+ }
#ifdef USE_ARM32_MMAP
- checkDevMem(TRUE);
+ checkDevMem(TRUE);
- if (devMemFd >= 0 && useDevMem)
- {
- base = (pointer)mmap((caddr_t)0, 0x400, PROT_READ | PROT_WRITE,
- MAP_FLAGS, devMemFd, (off_t)DEV_MEM_IOBASE);
+ if (devMemFd >= 0 && useDevMem) {
+ base = (pointer) mmap((caddr_t) 0, 0x400, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, devMemFd, (off_t) DEV_MEM_IOBASE);
- if (base != (pointer)-1)
- IOPortBase = (unsigned int)base;
- }
+ if (base != (pointer) -1)
+ IOPortBase = (unsigned int) base;
+ }
- if (IOPortBase == (unsigned int)-1)
- {
- xf86Msg(X_WARNING,"xf86EnableIOPorts: failed to open mem device or map IO base. \n\
+ if (IOPortBase == (unsigned int) -1) {
+ xf86Msg(X_WARNING,
+ "xf86EnableIOPorts: failed to open mem device or map IO base. \n\
Make sure you have the Aperture Driver installed, or a kernel built with the INSECURE option\n");
- return FALSE;
- }
+ return FALSE;
+ }
#else
- /* We don't have the IOBASE, so we can't map the address */
- xf86Msg(X_WARNING,"xf86EnableIOPorts: failed to open mem device or map IO base. \n\
+ /* We don't have the IOBASE, so we can't map the address */
+ xf86Msg(X_WARNING,
+ "xf86EnableIOPorts: failed to open mem device or map IO base. \n\
Try building the server with USE_ARM32_MMAP defined\n");
- return FALSE;
+ return FALSE;
#endif
#endif
-
- ExtendedEnabled = TRUE;
- return TRUE;
+ ExtendedEnabled = TRUE;
+
+ return TRUE;
}
void
xf86DisableIOPorts(ScreenNum)
int ScreenNum;
{
- int i;
+ int i;
+
#ifdef __arm32__
- struct memAccess *memInfoP;
+ struct memAccess *memInfoP;
#endif
- ScreenEnabled[ScreenNum] = FALSE;
+ ScreenEnabled[ScreenNum] = FALSE;
#ifdef __arm32__
- if((memInfoP = checkMapInfo(FALSE, MMIO_REGION)) != NULL)
- {
- xf86MapInfoUnmap(memInfoP, 0);
- }
+ if ((memInfoP = checkMapInfo(FALSE, MMIO_REGION)) != NULL) {
+ xf86MapInfoUnmap(memInfoP, 0);
+ }
#endif
#ifdef USE_ARM32_MMAP
- if (!ExtendedEnabled)
- return;
+ if (!ExtendedEnabled)
+ return;
- for (i = 0; i < MAXSCREENS; i++)
- if (ScreenEnabled[i])
- return;
+ for (i = 0; i < MAXSCREENS; i++)
+ if (ScreenEnabled[i])
+ return;
- munmap((caddr_t)IOPortBase, 0x400);
- IOPortBase = (unsigned int)-1;
- ExtendedEnabled = FALSE;
+ munmap((caddr_t) IOPortBase, 0x400);
+ IOPortBase = (unsigned int) -1;
+ ExtendedEnabled = FALSE;
#endif
- return;
+ return;
}
-#endif /* USE_ARC_MMAP || USE_ARM32_MMAP */
+#endif /* USE_ARC_MMAP || USE_ARM32_MMAP */
#endif
-
-
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c
index 73c88dca3..a8a4164e0 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c
@@ -20,20 +20,22 @@ static void bsdCloseAPM(void);
static struct {
u_int apmBsd;
pmEvent xf86;
-} bsdToXF86Array [] = {
- { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
- { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
- { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
- { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
- { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
- { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
- { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
- { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
- { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
- { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
- { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+} bsdToXF86Array[] = {
+ {
+ APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, {
+ APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, {
+ APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {
+ APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, {
+ APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, {
+ APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {
+ APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {
+ APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, {
+ APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, {
+ APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, {
+ APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
#ifdef APM_CAPABILITY_CHANGE
- { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
+ {
+ APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED},
#endif
};
@@ -45,9 +47,9 @@ bsdToXF86(int type)
int i;
for (i = 0; i < numApmEvents; i++) {
- if (type == bsdToXF86Array[i].apmBsd) {
- return bsdToXF86Array[i].xf86;
- }
+ if (type == bsdToXF86Array[i].apmBsd) {
+ return bsdToXF86Array[i].xf86;
+ }
}
return XF86_APM_UNKNOWN;
}
@@ -55,22 +57,22 @@ bsdToXF86(int type)
/*
* APM events can be requested direclty from /dev/apm
*/
-static int
-bsdPMGetEventFromOS(int fd, pmEvent *events, int num)
+static int
+bsdPMGetEventFromOS(int fd, pmEvent * events, int num)
{
struct apm_event_info bsdEvent;
int i;
for (i = 0; i < num; i++) {
-
- if (ioctl(fd, APM_IOC_NEXTEVENT, &bsdEvent) < 0) {
- if (errno != EAGAIN) {
- xf86Msg(X_WARNING, "bsdPMGetEventFromOS: APM_IOC_NEXTEVENT"
- " %s\n", strerror(errno));
- }
- break;
- }
- events[i] = bsdToXF86(bsdEvent.type);
+
+ if (ioctl(fd, APM_IOC_NEXTEVENT, &bsdEvent) < 0) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_WARNING, "bsdPMGetEventFromOS: APM_IOC_NEXTEVENT"
+ " %s\n", strerror(errno));
+ }
+ break;
+ }
+ events[i] = bsdToXF86(bsdEvent.type);
}
return i;
}
@@ -84,27 +86,27 @@ static pmWait
bsdPMConfirmEventToOs(int fd, pmEvent event)
{
switch (event) {
- case XF86_APM_SYS_STANDBY:
- case XF86_APM_USER_STANDBY:
- if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0)
- return PM_WAIT; /* should we stop the Xserver in standby, too? */
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+ if (ioctl(fd, APM_IOC_STANDBY, NULL) == 0)
+ return PM_WAIT; /* should we stop the Xserver in standby, too? */
else
return PM_NONE;
- case XF86_APM_SYS_SUSPEND:
- case XF86_APM_CRITICAL_SUSPEND:
- case XF86_APM_USER_SUSPEND:
- if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0)
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND:
+ case XF86_APM_USER_SUSPEND:
+ if (ioctl(fd, APM_IOC_SUSPEND, NULL) == 0)
return PM_WAIT;
else
return PM_NONE;
- case XF86_APM_STANDBY_RESUME:
- case XF86_APM_NORMAL_RESUME:
- case XF86_APM_CRITICAL_RESUME:
- case XF86_APM_STANDBY_FAILED:
- case XF86_APM_SUSPEND_FAILED:
+ case XF86_APM_STANDBY_RESUME:
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ case XF86_APM_STANDBY_FAILED:
+ case XF86_APM_SUSPEND_FAILED:
return PM_CONTINUE;
- default:
- return PM_NONE;
+ default:
+ return PM_NONE;
}
}
@@ -114,11 +116,11 @@ xf86OSPMOpen(void)
int fd;
if (APMihPtr || !xf86Info.pmFlag) {
- return NULL;
+ return NULL;
}
if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
- return NULL;
+ return NULL;
}
xf86PMGetEventFromOs = bsdPMGetEventFromOS;
xf86PMConfirmEventToOs = bsdPMConfirmEventToOs;
@@ -132,8 +134,8 @@ bsdCloseAPM(void)
int fd;
if (APMihPtr) {
- fd = xf86RemoveGeneralHandler(APMihPtr);
- close(fd);
- APMihPtr = NULL;
+ fd = xf86RemoveGeneralHandler(APMihPtr);
+ close(fd);
+ APMihPtr = NULL;
}
}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c
index 77c87ce1d..e7a36f8bf 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c
@@ -24,49 +24,48 @@ axpDevice bsdGetAXP(void);
*/
typedef struct {
- char *name;
- int type;
-} _AXP;
+ char *name;
+ int type;
+} _AXP;
static _AXP axpList[] = {
- {"apecs",APECS},
- {"pyxis",PYXIS},
- {"cia",CIA},
- {"irongate",IRONGATE},
- {"lca",LCA},
- {"t2",T2},
- {"tsunami",TSUNAMI},
- {NULL,SYS_NONE}
+ {"apecs", APECS},
+ {"pyxis", PYXIS},
+ {"cia", CIA},
+ {"irongate", IRONGATE},
+ {"lca", LCA},
+ {"t2", T2},
+ {"tsunami", TSUNAMI},
+ {NULL, SYS_NONE}
};
axpDevice
bsdGetAXP(void)
{
- int i;
- char sysname[64];
- size_t len = sizeof(sysname);
-
+ int i;
+ char sysname[64];
+ size_t len = sizeof(sysname);
+
#ifdef __OpenBSD__
- int mib[3];
- int error;
+ int mib[3];
+ int error;
- mib[0] = CTL_MACHDEP;
- mib[1] = CPU_CHIPSET;
- mib[2] = CPU_CHIPSET_TYPE;
+ mib[0] = CTL_MACHDEP;
+ mib[1] = CPU_CHIPSET;
+ mib[2] = CPU_CHIPSET_TYPE;
- if ((error = sysctl(mib, 3, &sysname, &len, NULL, 0)) < 0)
-#else
- if ((sysctlbyname("hw.chipset.type", &sysname, &len,
- 0, 0)) < 0)
+ if ((error = sysctl(mib, 3, &sysname, &len, NULL, 0)) < 0)
+#else
+ if ((sysctlbyname("hw.chipset.type", &sysname, &len, 0, 0)) < 0)
#endif
- FatalError("bsdGetAXP: can't find machine type\n");
+ FatalError("bsdGetAXP: can't find machine type\n");
#ifdef DEBUG
- xf86Msg(X_INFO,"AXP is a: %s\n",sysname);
+ xf86Msg(X_INFO, "AXP is a: %s\n", sysname);
#endif
- for (i=0;;i++) {
- if (axpList[i].name == NULL)
- return SYS_NONE;
- if (!strcmp(sysname, axpList[i].name))
- return axpList[i].type;
- }
-}
+ for (i = 0;; i++) {
+ if (axpList[i].name == NULL)
+ return SYS_NONE;
+ if (!strcmp(sysname, axpList[i].name))
+ return axpList[i].type;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_bell.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_bell.c
index fb457db71..f6643ee62 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/bsd_bell.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_bell.c
@@ -41,42 +41,40 @@ void
xf86OSRingBell(int loudness, int pitch, int duration)
{
#ifdef WSCONS_SUPPORT
- struct wskbd_bell_data wsb;
+ struct wskbd_bell_data wsb;
#endif
- if (loudness && pitch)
- {
+ if (loudness && pitch) {
#ifdef PCCONS_SUPPORT
- int data[2];
+ int data[2];
#endif
- switch (xf86Info.consType) {
+ switch (xf86Info.consType) {
#ifdef PCCONS_SUPPORT
- case PCCONS:
- data[0] = pitch;
- data[1] = (duration * loudness) / 50;
- ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data);
- break;
+ case PCCONS:
+ data[0] = pitch;
+ data[1] = (duration * loudness) / 50;
+ ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data);
+ break;
#endif
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration*loudness/50)<<16));
- break;
+ case SYSCONS:
+ case PCVT:
+ ioctl(xf86Info.consoleFd, KDMKTONE,
+ ((1193190 / pitch) & 0xffff) |
+ (((unsigned long) duration * loudness / 50) << 16));
+ break;
#endif
#if defined (WSCONS_SUPPORT)
- case WSCONS:
- wsb.which = WSKBD_BELL_DOALL;
- wsb.pitch = pitch;
- wsb.period = duration;
- wsb.volume = loudness;
- ioctl(xf86Info.consoleFd, WSKBDIO_COMPLEXBELL,
- &wsb);
- break;
+ case WSCONS:
+ wsb.which = WSKBD_BELL_DOALL;
+ wsb.pitch = pitch;
+ wsb.period = duration;
+ wsb.volume = loudness;
+ ioctl(xf86Info.consoleFd, WSKBDIO_COMPLEXBELL, &wsb);
+ break;
#endif
- }
}
+ }
}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c
index 7079d62b4..c9f823321 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c
@@ -67,9 +67,9 @@ static int initialVT = -1;
#ifdef PCVT_SUPPORT
/* Hellmuth Michaelis' pcvt driver */
#ifndef __OpenBSD__
-# define PCVT_CONSOLE_DEV "/dev/ttyv0"
+#define PCVT_CONSOLE_DEV "/dev/ttyv0"
#else
-# define PCVT_CONSOLE_DEV "/dev/ttyC0"
+#define PCVT_CONSOLE_DEV "/dev/ttyC0"
#endif
#define PCVT_CONSOLE_MODE O_RDWR|O_NDELAY
#endif
@@ -88,20 +88,19 @@ static int initialVT = -1;
static char *supported_drivers[] = {
#ifdef PCCONS_SUPPORT
- "pccons (with X support)",
+ "pccons (with X support)",
#endif
#ifdef SYSCONS_SUPPORT
- "syscons",
+ "syscons",
#endif
#ifdef PCVT_SUPPORT
- "pcvt",
+ "pcvt",
#endif
#ifdef WSCONS_SUPPORT
- "wscons",
+ "wscons",
#endif
};
-
/*
* Functions to probe for the existance of a supported console driver.
* Any function returns either a valid file descriptor (driver probed
@@ -110,19 +109,19 @@ static char *supported_drivers[] = {
* an X server.
*/
-typedef int (*xf86ConsOpen_t)(void);
+typedef int (*xf86ConsOpen_t) (void);
#ifdef PCCONS_SUPPORT
static int xf86OpenPccons(void);
-#endif /* PCCONS_SUPPORT */
+#endif /* PCCONS_SUPPORT */
#ifdef SYSCONS_SUPPORT
static int xf86OpenSyscons(void);
-#endif /* SYSCONS_SUPPORT */
+#endif /* SYSCONS_SUPPORT */
#ifdef PCVT_SUPPORT
static int xf86OpenPcvt(void);
-#endif /* PCVT_SUPPORT */
+#endif /* PCVT_SUPPORT */
#ifdef WSCONS_SUPPORT
static int xf86OpenWScons(void);
@@ -147,191 +146,174 @@ static xf86ConsOpen_t xf86ConsTab[] = {
#ifdef WSCONS_SUPPORT
xf86OpenWScons,
#endif
- (xf86ConsOpen_t)NULL
+ (xf86ConsOpen_t) NULL
};
-
void
xf86OpenConsole()
{
int i, fd = -1;
xf86ConsOpen_t *driver;
+
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
int result;
+
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
struct utsname uts;
#endif
vtmode_t vtmode;
#endif
-
- if (serverGeneration == 1)
- {
- /* check if we are run with euid==0 */
- if (geteuid() != 0)
- {
- FatalError("xf86OpenConsole: Server must be suid root");
- }
-
- if (!KeepTty)
- {
- /*
- * detaching the controlling tty solves problems of kbd character
- * loss. This is not interesting for CO driver, because it is
- * exclusive.
- */
- setpgrp(0, getpid());
- if ((i = open("/dev/tty",O_RDWR)) >= 0)
- {
- ioctl(i,TIOCNOTTY,(char *)0);
- close(i);
- }
- }
-
- /* detect which driver we are running on */
- for (driver = xf86ConsTab; *driver; driver++)
- {
- if ((fd = (*driver)()) >= 0)
- break;
- }
-
- /* Check that a supported console driver was found */
- if (fd < 0)
- {
- char cons_drivers[80] = {0, };
- for (i = 0; i < sizeof(supported_drivers) / sizeof(char *); i++)
- {
- if (i)
- {
- strcat(cons_drivers, ", ");
- }
- strcat(cons_drivers, supported_drivers[i]);
- }
- FatalError(
- "%s: No console driver found\n\tSupported drivers: %s\n\t%s",
- "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG);
- }
- xf86Info.consoleFd = fd;
-
- switch (xf86Info.consType)
- {
+
+ if (serverGeneration == 1) {
+ /* check if we are run with euid==0 */
+ if (geteuid() != 0) {
+ FatalError("xf86OpenConsole: Server must be suid root");
+ }
+
+ if (!KeepTty) {
+ /*
+ * detaching the controlling tty solves problems of kbd character
+ * loss. This is not interesting for CO driver, because it is
+ * exclusive.
+ */
+ setpgrp(0, getpid());
+ if ((i = open("/dev/tty", O_RDWR)) >= 0) {
+ ioctl(i, TIOCNOTTY, (char *) 0);
+ close(i);
+ }
+ }
+
+ /* detect which driver we are running on */
+ for (driver = xf86ConsTab; *driver; driver++) {
+ if ((fd = (*driver) ()) >= 0)
+ break;
+ }
+
+ /* Check that a supported console driver was found */
+ if (fd < 0) {
+ char cons_drivers[80] = { 0, };
+ for (i = 0; i < sizeof(supported_drivers) / sizeof(char *); i++) {
+ if (i) {
+ strcat(cons_drivers, ", ");
+ }
+ strcat(cons_drivers, supported_drivers[i]);
+ }
+ FatalError
+ ("%s: No console driver found\n\tSupported drivers: %s\n\t%s",
+ "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG);
+ }
+ xf86Info.consoleFd = fd;
+
+ switch (xf86Info.consType) {
#ifdef PCCONS_SUPPORT
- case PCCONS:
- if (ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0)
- {
- FatalError("%s: CONSOLE_X_MODE_ON failed (%s)\n%s",
- "xf86OpenConsole", strerror(errno),
- CHECK_DRIVER_MSG);
- }
- /*
- * Hack to prevent keyboard hanging when syslogd closes
- * /dev/console
- */
- if ((devConsoleFd = open("/dev/console", O_WRONLY,0)) < 0)
- {
- xf86Msg(X_WARNING,
- "xf86OpenConsole: couldn't open /dev/console (%s)\n",
- strerror(errno));
- }
- break;
+ case PCCONS:
+ if (ioctl(xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0) {
+ FatalError("%s: CONSOLE_X_MODE_ON failed (%s)\n%s",
+ "xf86OpenConsole", strerror(errno),
+ CHECK_DRIVER_MSG);
+ }
+ /*
+ * Hack to prevent keyboard hanging when syslogd closes
+ * /dev/console
+ */
+ if ((devConsoleFd = open("/dev/console", O_WRONLY, 0)) < 0) {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: couldn't open /dev/console (%s)\n",
+ strerror(errno));
+ }
+ break;
#endif
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt
- * switching anymore. Here we check for FreeBSD 3.1 and up.
- * Add cases for other *BSD that behave the same.
- */
+ case SYSCONS:
+ /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt
+ * switching anymore. Here we check for FreeBSD 3.1 and up.
+ * Add cases for other *BSD that behave the same.
+ */
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- uname (&uts);
- i = atof(uts.release) * 100;
- if (i >= 310) goto acquire_vt;
+ uname(&uts);
+ i = atof(uts.release) * 100;
+ if (i >= 310)
+ goto acquire_vt;
#endif
- /* otherwise fall through */
- case PCVT:
+ /* otherwise fall through */
+ case PCVT:
#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000))
- /*
- * First activate the #1 VT. This is a hack to allow a server
- * to be started while another one is active. There should be
- * a better way.
- */
- if (initialVT != 1) {
-
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0)
- {
- xf86Msg(X_WARNING,
- "xf86OpenConsole: VT_ACTIVATE failed\n");
- }
- sleep(1);
- }
-#endif
-acquire_vt:
- if (!xf86Info.ShareVTs) {
- /*
- * now get the VT
- */
- SYSCALL(result =
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
- if (result != 0)
- {
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
- }
- SYSCALL(result =
- ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno));
- if (result != 0)
- {
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
- }
-
- signal(SIGUSR1, xf86VTRequest);
-
- vtmode.mode = VT_PROCESS;
- vtmode.relsig = SIGUSR1;
- vtmode.acqsig = SIGUSR1;
- vtmode.frsig = SIGUSR1;
- if (ioctl(xf86Info.consoleFd, VT_SETMODE, &vtmode) < 0)
- {
- FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed");
- }
+ /*
+ * First activate the #1 VT. This is a hack to allow a server
+ * to be started while another one is active. There should be
+ * a better way.
+ */
+ if (initialVT != 1) {
+
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0) {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ sleep(1);
+ }
+#endif
+ acquire_vt:
+ if (!xf86Info.ShareVTs) {
+ /*
+ * now get the VT
+ */
+ SYSCALL(result =
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
+ if (result != 0) {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ SYSCALL(result =
+ ioctl(xf86Info.consoleFd, VT_WAITACTIVE,
+ xf86Info.vtno));
+ if (result != 0) {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: VT_WAITACTIVE failed\n");
+ }
+
+ signal(SIGUSR1, xf86VTRequest);
+
+ vtmode.mode = VT_PROCESS;
+ vtmode.relsig = SIGUSR1;
+ vtmode.acqsig = SIGUSR1;
+ vtmode.frsig = SIGUSR1;
+ if (ioctl(xf86Info.consoleFd, VT_SETMODE, &vtmode) < 0) {
+ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed");
+ }
#if !defined(__OpenBSD__) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
- if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0)
- {
- FatalError("xf86OpenConsole: KDENABIO failed (%s)",
- strerror(errno));
- }
-#endif
- if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
- {
- FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
- }
- } else { /* xf86Info.ShareVTs */
- close(xf86Info.consoleFd);
- }
- break;
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0) {
+ FatalError("xf86OpenConsole: KDENABIO failed (%s)",
+ strerror(errno));
+ }
+#endif
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
+ FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
+ }
+ }
+ else { /* xf86Info.ShareVTs */
+ close(xf86Info.consoleFd);
+ }
+ break;
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
#ifdef WSCONS_SUPPORT
- case WSCONS:
- /* Nothing to do */
- break;
+ case WSCONS:
+ /* Nothing to do */
+ break;
#endif
}
}
- else
- {
- /* serverGeneration != 1 */
+ else {
+ /* serverGeneration != 1 */
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- if (!xf86Info.ShareVTs &&
- (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT))
- {
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
- {
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
- }
+ if (!xf86Info.ShareVTs &&
+ (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)) {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
}
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
}
return;
}
-
#ifdef PCCONS_SUPPORT
static int
@@ -340,26 +322,22 @@ xf86OpenPccons()
int fd = -1;
if ((fd = open(PCCONS_CONSOLE_DEV1, PCCONS_CONSOLE_MODE, 0))
- >= 0 ||
- (fd = open(PCCONS_CONSOLE_DEV2, PCCONS_CONSOLE_MODE, 0))
- >= 0)
- {
- if (ioctl(fd, CONSOLE_X_MODE_OFF, 0) < 0)
- {
- FatalError(
- "%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s",
- "xf86OpenPccons",
- strerror(errno),
- "Was expecting pccons driver with X support",
- CHECK_DRIVER_MSG);
- }
- xf86Info.consType = PCCONS;
- xf86Msg(X_PROBED, "Using pccons driver with X support\n");
+ >= 0 || (fd = open(PCCONS_CONSOLE_DEV2, PCCONS_CONSOLE_MODE, 0))
+ >= 0) {
+ if (ioctl(fd, CONSOLE_X_MODE_OFF, 0) < 0) {
+ FatalError("%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s",
+ "xf86OpenPccons",
+ strerror(errno),
+ "Was expecting pccons driver with X support",
+ CHECK_DRIVER_MSG);
+ }
+ xf86Info.consType = PCCONS;
+ xf86Msg(X_PROBED, "Using pccons driver with X support\n");
}
return fd;
}
-#endif /* PCCONS_SUPPORT */
+#endif /* PCCONS_SUPPORT */
#ifdef SYSCONS_SUPPORT
@@ -374,113 +352,98 @@ xf86OpenSyscons()
/* Check for syscons */
if ((fd = open(SYSCONS_CONSOLE_DEV1, SYSCONS_CONSOLE_MODE, 0)) >= 0
- || (fd = open(SYSCONS_CONSOLE_DEV2, SYSCONS_CONSOLE_MODE, 0)) >= 0)
- {
- if (ioctl(fd, VT_GETMODE, &vtmode) >= 0)
- {
- /* Get syscons version */
- if (ioctl(fd, CONS_GETVERS, &syscons_version) < 0)
- {
- syscons_version = 0;
- }
+ || (fd = open(SYSCONS_CONSOLE_DEV2, SYSCONS_CONSOLE_MODE, 0)) >= 0) {
+ if (ioctl(fd, VT_GETMODE, &vtmode) >= 0) {
+ /* Get syscons version */
+ if (ioctl(fd, CONS_GETVERS, &syscons_version) < 0) {
+ syscons_version = 0;
+ }
- xf86Info.vtno = VTnum;
- from = X_CMDLINE;
+ xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
#ifdef VT_GETACTIVE
- if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
- initialVT = -1;
+ if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
+ initialVT = -1;
#endif
if (xf86Info.ShareVTs)
- xf86Info.vtno = initialVT;
+ xf86Info.vtno = initialVT;
- if (xf86Info.vtno == -1)
- {
- /*
- * For old syscons versions (<0x100), VT_OPENQRY returns
- * the current VT rather than the next free VT. In this
- * case, the server gets started on the current VT instead
- * of the next free VT.
- */
+ if (xf86Info.vtno == -1) {
+ /*
+ * For old syscons versions (<0x100), VT_OPENQRY returns
+ * the current VT rather than the next free VT. In this
+ * case, the server gets started on the current VT instead
+ * of the next free VT.
+ */
#if 0
- /* check for the fixed VT_OPENQRY */
- if (syscons_version >= 0x100)
- {
-#endif
- if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0)
- {
- /* No free VTs */
- xf86Info.vtno = -1;
- }
+ /* check for the fixed VT_OPENQRY */
+ if (syscons_version >= 0x100) {
+#endif
+ if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) {
+ /* No free VTs */
+ xf86Info.vtno = -1;
+ }
#if 0
- }
-#endif
-
- if (xf86Info.vtno == -1)
- {
- /*
- * All VTs are in use. If initialVT was found, use it.
- */
- if (initialVT != -1)
- {
- xf86Info.vtno = initialVT;
- }
- else
- {
- if (syscons_version >= 0x100)
- {
- FatalError("%s: Cannot find a free VT",
- "xf86OpenSyscons");
- }
- /* Should no longer reach here */
- FatalError("%s: %s %s\n\t%s %s",
- "xf86OpenSyscons",
- "syscons versions prior to 1.0 require",
- "either the",
- "server's stdin be a VT",
- "or the use of the vtxx server option");
- }
- }
- from = X_PROBED;
- }
-
- close(fd);
- snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x", xf86Info.vtno - 1);
- if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0)
- {
- FatalError("xf86OpenSyscons: Cannot open %s (%s)",
- vtname, strerror(errno));
- }
- if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
- {
- FatalError("xf86OpenSyscons: VT_GETMODE failed");
- }
- xf86Info.consType = SYSCONS;
- xf86Msg(X_PROBED, "Using syscons driver with X support");
- if (syscons_version >= 0x100)
- {
- xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8,
- syscons_version & 0xFF);
- }
- else
- {
- xf86ErrorF(" (version 0.x)\n");
- }
- xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
- }
- else
- {
- /* VT_GETMODE failed, probably not syscons */
- close(fd);
- fd = -1;
- }
+ }
+#endif
+
+ if (xf86Info.vtno == -1) {
+ /*
+ * All VTs are in use. If initialVT was found, use it.
+ */
+ if (initialVT != -1) {
+ xf86Info.vtno = initialVT;
+ }
+ else {
+ if (syscons_version >= 0x100) {
+ FatalError("%s: Cannot find a free VT",
+ "xf86OpenSyscons");
+ }
+ /* Should no longer reach here */
+ FatalError("%s: %s %s\n\t%s %s",
+ "xf86OpenSyscons",
+ "syscons versions prior to 1.0 require",
+ "either the",
+ "server's stdin be a VT",
+ "or the use of the vtxx server option");
+ }
+ }
+ from = X_PROBED;
+ }
+
+ close(fd);
+ snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x",
+ xf86Info.vtno - 1);
+ if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) {
+ FatalError("xf86OpenSyscons: Cannot open %s (%s)",
+ vtname, strerror(errno));
+ }
+ if (ioctl(fd, VT_GETMODE, &vtmode) < 0) {
+ FatalError("xf86OpenSyscons: VT_GETMODE failed");
+ }
+ xf86Info.consType = SYSCONS;
+ xf86Msg(X_PROBED, "Using syscons driver with X support");
+ if (syscons_version >= 0x100) {
+ xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8,
+ syscons_version & 0xFF);
+ }
+ else {
+ xf86ErrorF(" (version 0.x)\n");
+ }
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+ }
+ else {
+ /* VT_GETMODE failed, probably not syscons */
+ close(fd);
+ fd = -1;
+ }
}
return fd;
}
-#endif /* SYSCONS_SUPPORT */
-
+#endif /* SYSCONS_SUPPORT */
#ifdef PCVT_SUPPORT
@@ -501,93 +464,82 @@ xf86OpenPcvt()
fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
#ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV
- if (fd < 0)
- {
- fd = open(WSCONS_PCVT_COMPAT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
- vtprefix = "/dev/ttyE";
+ if (fd < 0) {
+ fd = open(WSCONS_PCVT_COMPAT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
+ vtprefix = "/dev/ttyE";
}
#endif
- if (fd >= 0)
- {
- if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0)
- {
- if(ioctl(fd, VT_GETMODE, &vtmode) < 0)
- {
- FatalError("%s: VT_GETMODE failed\n%s%s\n%s",
- "xf86OpenPcvt",
- "Found pcvt driver but X11 seems to be",
- " not supported.", CHECK_DRIVER_MSG);
- }
-
- xf86Info.vtno = VTnum;
-
- if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
- initialVT = -1;
-
- if (xf86Info.vtno == -1)
- {
- if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0)
- {
- /* No free VTs */
- xf86Info.vtno = -1;
- }
-
- if (xf86Info.vtno == -1)
- {
- /*
- * All VTs are in use. If initialVT was found, use it.
- */
- if (initialVT != -1)
- {
- xf86Info.vtno = initialVT;
- }
- else
- {
- FatalError("%s: Cannot find a free VT",
- "xf86OpenPcvt");
- }
- }
- }
-
- close(fd);
- snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1);
- if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0)
- {
- ErrorF("xf86OpenPcvt: Cannot open %s (%s)",
- vtname, strerror(errno));
- xf86Info.vtno = initialVT;
- snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1);
- if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
- FatalError("xf86OpenPcvt: Cannot open %s (%s)",
- vtname, strerror(errno));
- }
- }
- if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
- {
- FatalError("xf86OpenPcvt: VT_GETMODE failed");
- }
- xf86Info.consType = PCVT;
+ if (fd >= 0) {
+ if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0) {
+ if (ioctl(fd, VT_GETMODE, &vtmode) < 0) {
+ FatalError("%s: VT_GETMODE failed\n%s%s\n%s",
+ "xf86OpenPcvt",
+ "Found pcvt driver but X11 seems to be",
+ " not supported.", CHECK_DRIVER_MSG);
+ }
+
+ xf86Info.vtno = VTnum;
+
+ if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
+ initialVT = -1;
+
+ if (xf86Info.vtno == -1) {
+ if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) {
+ /* No free VTs */
+ xf86Info.vtno = -1;
+ }
+
+ if (xf86Info.vtno == -1) {
+ /*
+ * All VTs are in use. If initialVT was found, use it.
+ */
+ if (initialVT != -1) {
+ xf86Info.vtno = initialVT;
+ }
+ else {
+ FatalError("%s: Cannot find a free VT", "xf86OpenPcvt");
+ }
+ }
+ }
+
+ close(fd);
+ snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix,
+ xf86Info.vtno - 1);
+ if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
+ ErrorF("xf86OpenPcvt: Cannot open %s (%s)",
+ vtname, strerror(errno));
+ xf86Info.vtno = initialVT;
+ snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix,
+ xf86Info.vtno - 1);
+ if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
+ FatalError("xf86OpenPcvt: Cannot open %s (%s)",
+ vtname, strerror(errno));
+ }
+ }
+ if (ioctl(fd, VT_GETMODE, &vtmode) < 0) {
+ FatalError("xf86OpenPcvt: VT_GETMODE failed");
+ }
+ xf86Info.consType = PCVT;
#ifdef WSCONS_SUPPORT
- xf86Msg(X_PROBED,
- "Using wscons driver on %s in pcvt compatibility mode "
- "(version %d.%d)\n", vtname,
- pcvt_version.rmajor, pcvt_version.rminor);
+ xf86Msg(X_PROBED,
+ "Using wscons driver on %s in pcvt compatibility mode "
+ "(version %d.%d)\n", vtname,
+ pcvt_version.rmajor, pcvt_version.rminor);
#else
- xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n",
- pcvt_version.rmajor, pcvt_version.rminor);
-#endif
- }
- else
- {
- /* Not pcvt */
- close(fd);
- fd = -1;
- }
+ xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n",
+ pcvt_version.rmajor, pcvt_version.rminor);
+#endif
+ }
+ else {
+ /* Not pcvt */
+ close(fd);
+ fd = -1;
+ }
}
return fd;
}
-#endif /* PCVT_SUPPORT */
+#endif /* PCVT_SUPPORT */
#ifdef WSCONS_SUPPORT
@@ -602,77 +554,75 @@ xf86OpenWScons()
/* XXX Is this ok? */
for (i = 0; i < 8; i++) {
#if defined(__NetBSD__)
- snprintf(ttyname, sizeof(ttyname), "/dev/ttyE%d", i);
+ snprintf(ttyname, sizeof(ttyname), "/dev/ttyE%d", i);
#elif defined(__OpenBSD__)
- snprintf(ttyname, sizeof(ttyname), "/dev/ttyC%x", i);
+ snprintf(ttyname, sizeof(ttyname), "/dev/ttyC%x", i);
#endif
- if ((fd = open(ttyname, 2)) != -1)
- break;
+ if ((fd = open(ttyname, 2)) != -1)
+ break;
}
if (fd != -1) {
- if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) {
- FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s",
- "xf86OpenConsole", strerror(errno),
- CHECK_DRIVER_MSG);
- }
- xf86Info.consType = WSCONS;
- xf86Msg(X_PROBED, "Using wscons driver\n");
+ if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) {
+ FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s",
+ "xf86OpenConsole", strerror(errno), CHECK_DRIVER_MSG);
+ }
+ xf86Info.consType = WSCONS;
+ xf86Msg(X_PROBED, "Using wscons driver\n");
}
return fd;
}
-#endif /* WSCONS_SUPPORT */
+#endif /* WSCONS_SUPPORT */
void
xf86CloseConsole()
{
#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
- struct vt_mode VT;
+ struct vt_mode VT;
#endif
- if (xf86Info.ShareVTs) return;
+ if (xf86Info.ShareVTs)
+ return;
- switch (xf86Info.consType)
- {
+ switch (xf86Info.consType) {
#ifdef PCCONS_SUPPORT
case PCCONS:
- ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0);
- break;
-#endif /* PCCONS_SUPPORT */
+ ioctl(xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0);
+ break;
+#endif /* PCCONS_SUPPORT */
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
case PCVT:
ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode */
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
- {
- VT.mode = VT_AUTO;
- ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) {
+ VT.mode = VT_AUTO;
+ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
}
#if !defined(__OpenBSD__) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
- if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0)
- {
+ if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0) {
xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
- strerror(errno));
+ strerror(errno));
}
#endif
- if (initialVT != -1)
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT);
+ if (initialVT != -1)
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT);
break;
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
#ifdef WSCONS_SUPPORT
case WSCONS:
- {
- int mode = WSDISPLAYIO_MODE_EMUL;
- ioctl(xf86Info.consoleFd, WSDISPLAYIO_SMODE, &mode);
- break;
- }
+ {
+ int mode = WSDISPLAYIO_MODE_EMUL;
+
+ ioctl(xf86Info.consoleFd, WSDISPLAYIO_SMODE, &mode);
+ break;
+ }
#endif
}
close(xf86Info.consoleFd);
#ifdef PCCONS_SUPPORT
if (devConsoleFd >= 0)
- close(devConsoleFd);
+ close(devConsoleFd);
#endif
return;
}
@@ -680,38 +630,34 @@ xf86CloseConsole()
int
xf86ProcessArgument(int argc, char *argv[], int i)
{
- /*
- * Keep server from detaching from controlling tty. This is useful
- * when debugging (so the server can receive keyboard signals.
- */
- if (!strcmp(argv[i], "-keeptty"))
- {
- KeepTty = TRUE;
- return 1;
- }
+ /*
+ * Keep server from detaching from controlling tty. This is useful
+ * when debugging (so the server can receive keyboard signals.
+ */
+ if (!strcmp(argv[i], "-keeptty")) {
+ KeepTty = TRUE;
+ return 1;
+ }
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
- {
- if (sscanf(argv[i], "vt%2d", &VTnum) == 0 ||
- VTnum < 1 || VTnum > 12)
- {
- UseMsg();
- VTnum = -1;
- return 0;
- }
- return 1;
- }
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
- return 0;
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0 || VTnum < 1 || VTnum > 12) {
+ UseMsg();
+ VTnum = -1;
+ return 0;
+ }
+ return 1;
+ }
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ return 0;
}
void
xf86UseMsg()
{
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- ErrorF("vtXX use the specified VT number (1-12)\n");
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
- ErrorF("-keeptty ");
- ErrorF("don't detach controlling tty (for debugging only)\n");
- return;
+ ErrorF("vtXX use the specified VT number (1-12)\n");
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ ErrorF("-keeptty ");
+ ErrorF("don't detach controlling tty (for debugging only)\n");
+ return;
}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_kmod.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_kmod.c
index 34e434188..150bb0db4 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/bsd_kmod.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_kmod.c
@@ -19,10 +19,11 @@
* Return:
* 0 for failure, 1 for success
*/
-int xf86LoadKernelModule(const char *modName)
+int
+xf86LoadKernelModule(const char *modName)
{
if (kldload(modName) != -1)
- return 1;
+ return 1;
else
- return 0;
+ return 0;
}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c
index 053619e1d..10251f38e 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c
@@ -53,20 +53,22 @@ static void bsdCloseAPM(void);
static struct {
u_int apmBsd;
pmEvent xf86;
-} bsdToXF86Array [] = {
- { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
- { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
- { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
- { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
- { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
- { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
- { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
- { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
- { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
- { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
- { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+} bsdToXF86Array[] = {
+ {
+ APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, {
+ APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, {
+ APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {
+ APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, {
+ APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, {
+ APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {
+ APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {
+ APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, {
+ APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, {
+ APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, {
+ APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
#ifdef APM_CAPABILITY_CHANGE
- { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
+ {
+ APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED},
#endif
};
@@ -78,9 +80,9 @@ bsdToXF86(int type)
int i;
for (i = 0; i < numApmEvents; i++) {
- if (type == bsdToXF86Array[i].apmBsd) {
- return bsdToXF86Array[i].xf86;
- }
+ if (type == bsdToXF86Array[i].apmBsd) {
+ return bsdToXF86Array[i].xf86;
+ }
}
return XF86_APM_UNKNOWN;
}
@@ -88,24 +90,25 @@ bsdToXF86(int type)
/*
* APM events can be requested direclty from /dev/apm
*/
-static int
-bsdPMGetEventFromOS(int kq, pmEvent *events, int num)
+static int
+bsdPMGetEventFromOS(int kq, pmEvent * events, int num)
{
struct kevent ev;
int i, result;
struct timespec ts = { 0, 0 };
-
+
for (i = 0; i < num; i++) {
- result = kevent(kq, NULL, 0, &ev, 1, &ts);
- if (result == 0 || APM_EVENT_TYPE(ev.data) == APM_NOEVENT) {
- /* no event */
- break;
- } else if (result < 0) {
- xf86Msg(X_WARNING, "bsdPMGetEventFromOS: kevent returns"
- " %s\n", strerror(errno));
- break;
- }
- events[i] = bsdToXF86(APM_EVENT_TYPE(ev.data));
+ result = kevent(kq, NULL, 0, &ev, 1, &ts);
+ if (result == 0 || APM_EVENT_TYPE(ev.data) == APM_NOEVENT) {
+ /* no event */
+ break;
+ }
+ else if (result < 0) {
+ xf86Msg(X_WARNING, "bsdPMGetEventFromOS: kevent returns"
+ " %s\n", strerror(errno));
+ break;
+ }
+ events[i] = bsdToXF86(APM_EVENT_TYPE(ev.data));
}
return i;
}
@@ -120,36 +123,36 @@ static pmWait
bsdPMConfirmEventToOs(int dummyfd, pmEvent event)
{
if (ctlFd < 0) {
- if ((ctlFd = open(_PATH_APM_CTLDEV, O_RDWR)) < 0) {
- return PM_NONE;
- }
+ if ((ctlFd = open(_PATH_APM_CTLDEV, O_RDWR)) < 0) {
+ return PM_NONE;
+ }
}
/* apmctl open succeedeed */
switch (event) {
- case XF86_APM_SYS_STANDBY:
- case XF86_APM_USER_STANDBY:
- if (ioctl( ctlFd, APM_IOC_STANDBY, NULL ) == 0)
- return PM_WAIT; /* should we stop the Xserver in standby, too? */
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+ if (ioctl(ctlFd, APM_IOC_STANDBY, NULL) == 0)
+ return PM_WAIT; /* should we stop the Xserver in standby, too? */
else
return PM_NONE;
- case XF86_APM_SYS_SUSPEND:
- case XF86_APM_CRITICAL_SUSPEND:
- case XF86_APM_USER_SUSPEND:
- if (ioctl( ctlFd, APM_IOC_SUSPEND, NULL ) == 0)
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND:
+ case XF86_APM_USER_SUSPEND:
+ if (ioctl(ctlFd, APM_IOC_SUSPEND, NULL) == 0)
return PM_WAIT;
else
return PM_NONE;
- break;
- case XF86_APM_STANDBY_RESUME:
- case XF86_APM_NORMAL_RESUME:
- case XF86_APM_CRITICAL_RESUME:
- case XF86_APM_STANDBY_FAILED:
- case XF86_APM_SUSPEND_FAILED:
+ break;
+ case XF86_APM_STANDBY_RESUME:
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ case XF86_APM_STANDBY_FAILED:
+ case XF86_APM_SUSPEND_FAILED:
return PM_CONTINUE;
- break;
- default:
- return PM_NONE;
+ break;
+ default:
+ return PM_NONE;
}
}
@@ -160,20 +163,19 @@ xf86OSPMOpen(void)
struct kevent ev;
if (APMihPtr || !xf86Info.pmFlag) {
- return NULL;
+ return NULL;
}
if ((devFd = open(_PATH_APM_DEV, O_RDONLY)) == -1) {
- return NULL;
+ return NULL;
}
if ((kq = kqueue()) <= 0) {
- close(devFd);
- return NULL;
+ close(devFd);
+ return NULL;
}
- EV_SET(&ev, devFd, EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR,
- 0, 0, NULL);
+ EV_SET(&ev, devFd, EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR, 0, 0, NULL);
if (kevent(kq, &ev, 1, NULL, 0, NULL) < 0) {
- close(devFd);
- return NULL;
+ close(devFd);
+ return NULL;
}
xf86PMGetEventFromOs = bsdPMGetEventFromOS;
@@ -188,14 +190,14 @@ bsdCloseAPM(void)
int kq;
if (APMihPtr) {
- kq = xf86RemoveGeneralHandler(APMihPtr);
- close(devFd);
- devFd = -1;
- close(kq);
- if (ctlFd >= 0) {
- close(ctlFd);
- ctlFd = -1;
- }
- APMihPtr = NULL;
+ kq = xf86RemoveGeneralHandler(APMihPtr);
+ close(devFd);
+ devFd = -1;
+ close(kq);
+ if (ctlFd >= 0) {
+ close(ctlFd);
+ ctlFd = -1;
+ }
+ APMihPtr = NULL;
}
}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/i386_video.c b/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
index 35e00fce7..569a4ec51 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
@@ -79,7 +79,7 @@
/***************************************************************************/
static Bool useDevMem = FALSE;
-static int devMemFd = -1;
+static int devMemFd = -1;
#ifdef HAS_APERTURE_DRV
#define DEV_APERTURE "/dev/xf86"
@@ -95,7 +95,7 @@ static Bool cleanMTRR(void);
#endif
#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool,
- MessageType);
+ MessageType);
static void NetBSDundoWC(int, pointer);
#endif
@@ -106,85 +106,80 @@ static void NetBSDundoWC(int, pointer);
static void
checkDevMem(Bool warn)
{
- static Bool devMemChecked = FALSE;
- int fd;
- pointer base;
-
- if (devMemChecked)
- return;
- devMemChecked = TRUE;
-
- if ((fd = open(DEV_MEM, O_RDWR)) >= 0)
- {
- /* Try to map a page at the VGA address */
- base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
- MAP_FLAGS, fd, (off_t)0xA0000);
-
- if (base != MAP_FAILED)
- {
- munmap((caddr_t)base, 4096);
- devMemFd = fd;
- useDevMem = TRUE;
- return;
- } else {
- /* This should not happen */
- if (warn)
- {
- xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- useDevMem = FALSE;
- return;
- }
- }
+ static Bool devMemChecked = FALSE;
+ int fd;
+ pointer base;
+
+ if (devMemChecked)
+ return;
+ devMemChecked = TRUE;
+
+ if ((fd = open(DEV_MEM, O_RDWR)) >= 0) {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t) 0xA0000);
+
+ if (base != MAP_FAILED) {
+ munmap((caddr_t) base, 4096);
+ devMemFd = fd;
+ useDevMem = TRUE;
+ return;
+ }
+ else {
+ /* This should not happen */
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ useDevMem = FALSE;
+ return;
+ }
+ }
#ifndef HAS_APERTURE_DRV
- if (warn)
- {
- xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- useDevMem = FALSE;
- return;
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ useDevMem = FALSE;
+ return;
#else
- /* Failed to open /dev/mem, try the aperture driver */
- if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0)
- {
- /* Try to map a page at the VGA address */
- base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
- MAP_FLAGS, fd, (off_t)0xA0000);
-
- if (base != MAP_FAILED)
- {
- munmap((caddr_t)base, 4096);
- devMemFd = fd;
- useDevMem = TRUE;
- xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
- DEV_APERTURE);
- return;
- } else {
-
- if (warn)
- {
- xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
- DEV_APERTURE, strerror(errno));
- }
- }
- } else {
- if (warn)
- {
+ /* Failed to open /dev/mem, try the aperture driver */
+ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t) 0xA0000);
+
+ if (base != MAP_FAILED) {
+ munmap((caddr_t) base, 4096);
+ devMemFd = fd;
+ useDevMem = TRUE;
+ xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
+ DEV_APERTURE);
+ return;
+ }
+ else {
+
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_APERTURE, strerror(errno));
+ }
+ }
+ }
+ else {
+ if (warn) {
#ifndef __OpenBSD__
- xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
- "\t(%s)\n", DEV_MEM, DEV_APERTURE, strerror(errno));
-#else /* __OpenBSD__ */
- xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
- "\t(%s)\n%s", DEV_MEM, DEV_APERTURE, strerror(errno),
- SYSCTL_MSG);
-#endif /* __OpenBSD__ */
- }
- }
-
- useDevMem = FALSE;
- return;
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
+ "\t(%s)\n", DEV_MEM, DEV_APERTURE, strerror(errno));
+#else /* __OpenBSD__ */
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
+ "\t(%s)\n%s", DEV_MEM, DEV_APERTURE, strerror(errno),
+ SYSCTL_MSG);
+#endif /* __OpenBSD__ */
+ }
+ }
+
+ useDevMem = FALSE;
+ return;
#endif
}
@@ -192,80 +187,72 @@ checkDevMem(Bool warn)
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- checkDevMem(TRUE);
- pVidMem->linearSupported = useDevMem;
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
+ checkDevMem(TRUE);
+ pVidMem->linearSupported = useDevMem;
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
- if (useDevMem)
- pci_system_init_dev_mem(devMemFd);
+ if (useDevMem)
+ pci_system_init_dev_mem(devMemFd);
#ifdef HAS_MTRR_SUPPORT
- if (useDevMem) {
- if (cleanMTRR()) {
- pVidMem->setWC = setWC;
- pVidMem->undoWC = undoWC;
- }
- }
+ if (useDevMem) {
+ if (cleanMTRR()) {
+ pVidMem->setWC = setWC;
+ pVidMem->undoWC = undoWC;
+ }
+ }
#endif
#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
- pVidMem->setWC = NetBSDsetWC;
- pVidMem->undoWC = NetBSDundoWC;
+ pVidMem->setWC = NetBSDsetWC;
+ pVidMem->undoWC = NetBSDundoWC;
#endif
- pVidMem->initialised = TRUE;
+ pVidMem->initialised = TRUE;
}
static pointer
mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- pointer base;
-
- checkDevMem(FALSE);
-
- if (useDevMem)
- {
- if (devMemFd < 0)
- {
- FatalError("xf86MapVidMem: failed to open %s (%s)",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t)0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, devMemFd, (off_t)Base);
- if (base == MAP_FAILED)
- {
- FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)",
- "xf86MapVidMem", DEV_MEM, Size, Base,
- strerror(errno));
- }
- return base;
- }
-
- /* else, mmap /dev/vga */
- if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000)
- {
- FatalError("%s: Address 0x%lx outside allowable range",
- "xf86MapVidMem", Base);
- }
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.consoleFd,
- (unsigned long)Base - 0xA0000
- );
- if (base == MAP_FAILED)
- {
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)",
- strerror(errno));
- }
- return base;
+ pointer base;
+
+ checkDevMem(FALSE);
+
+ if (useDevMem) {
+ if (devMemFd < 0) {
+ FatalError("xf86MapVidMem: failed to open %s (%s)",
+ DEV_MEM, strerror(errno));
+ }
+ base = mmap((caddr_t) 0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, devMemFd, (off_t) Base);
+ if (base == MAP_FAILED) {
+ FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)",
+ "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno));
+ }
+ return base;
+ }
+
+ /* else, mmap /dev/vga */
+ if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) {
+ FatalError("%s: Address 0x%lx outside allowable range",
+ "xf86MapVidMem", Base);
+ }
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base - 0xA0000);
+ if (base == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)",
+ strerror(errno));
+ }
+ return base;
}
static void
unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- munmap((caddr_t)Base, Size);
+ munmap((caddr_t) Base, Size);
}
/*
@@ -274,47 +261,46 @@ unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
int
xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
+ int Len)
{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- checkDevMem(TRUE);
- if (devMemFd == -1) {
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
- MAP_SHARED, devMemFd, (off_t)Base);
- if ((long)ptr == -1)
- {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
- DEV_MEM, Len, Base, Offset, strerror(errno));
+ unsigned char *ptr;
+ int psize;
+ int mlen;
+
+ checkDevMem(TRUE);
+ if (devMemFd == -1) {
+ return -1;
+ }
+
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
+ MAP_SHARED, devMemFd, (off_t) Base);
+ if ((long) ptr == -1) {
+ xf86Msg(X_WARNING,
+ "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
+ DEV_MEM, Len, Base, Offset, strerror(errno));
#ifdef __OpenBSD__
- if (Base < 0xa0000) {
- xf86Msg(X_WARNING, SYSCTL_MSG2);
- }
+ if (Base < 0xa0000) {
+ xf86Msg(X_WARNING, SYSCTL_MSG2);
+ }
#endif
- return -1;
- }
+ return -1;
+ }
#ifdef DEBUG
- ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
- Base, ptr[0] | (ptr[1] << 8));
+ ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
+ Base, ptr[0] | (ptr[1] << 8));
#endif
- (void)memcpy(Buf, (void *)(ptr + Offset), Len);
- (void)munmap((caddr_t)ptr, mlen);
+ (void) memcpy(Buf, (void *) (ptr + Offset), Len);
+ (void) munmap((caddr_t) ptr, mlen);
#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
- "-> %02x %02x %02x %02x...\n",
- Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
+ xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
+ "-> %02x %02x %02x %02x...\n",
+ Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
#endif
- return Len;
+ return Len;
}
#ifdef USE_I386_IOPL
@@ -327,38 +313,37 @@ static Bool ExtendedEnabled = FALSE;
Bool
xf86EnableIO()
{
- if (ExtendedEnabled)
- return TRUE;
+ if (ExtendedEnabled)
+ return TRUE;
- if (i386_iopl(TRUE) < 0)
- {
+ if (i386_iopl(TRUE) < 0) {
#ifndef __OpenBSD__
- xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O",
- "xf86EnableIO");
+ xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O",
+ "xf86EnableIO");
#else
- xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s",
- "xf86EnableIO", SYSCTL_MSG);
+ xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s",
+ "xf86EnableIO", SYSCTL_MSG);
#endif
- return FALSE;
- }
- ExtendedEnabled = TRUE;
+ return FALSE;
+ }
+ ExtendedEnabled = TRUE;
- return TRUE;
+ return TRUE;
}
-
+
void
xf86DisableIO()
{
- if (!ExtendedEnabled)
- return;
+ if (!ExtendedEnabled)
+ return;
- i386_iopl(FALSE);
- ExtendedEnabled = FALSE;
+ i386_iopl(FALSE);
+ ExtendedEnabled = FALSE;
- return;
+ return;
}
-#endif /* USE_I386_IOPL */
+#endif /* USE_I386_IOPL */
#ifdef USE_AMD64_IOPL
/***************************************************************************/
@@ -370,41 +355,40 @@ static Bool ExtendedEnabled = FALSE;
Bool
xf86EnableIO()
{
- if (ExtendedEnabled)
- return TRUE;
+ if (ExtendedEnabled)
+ return TRUE;
- if (amd64_iopl(TRUE) < 0)
- {
+ if (amd64_iopl(TRUE) < 0) {
#ifndef __OpenBSD__
- xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O",
- "xf86EnableIO");
+ xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O",
+ "xf86EnableIO");
#else
- xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s",
- "xf86EnableIO", SYSCTL_MSG);
+ xf86Msg(X_WARNING, "%s: Failed to set IOPL for extended I/O\n%s",
+ "xf86EnableIO", SYSCTL_MSG);
#endif
- return FALSE;
- }
- ExtendedEnabled = TRUE;
+ return FALSE;
+ }
+ ExtendedEnabled = TRUE;
- return TRUE;
+ return TRUE;
}
-
+
void
xf86DisableIO()
{
- if (!ExtendedEnabled)
- return;
-
- if (amd64_iopl(FALSE) == 0) {
- ExtendedEnabled = FALSE;
- }
- /* Otherwise, the X server has revoqued its root uid,
- and thus cannot give up IO privileges any more */
-
- return;
+ if (!ExtendedEnabled)
+ return;
+
+ if (amd64_iopl(FALSE) == 0) {
+ ExtendedEnabled = FALSE;
+ }
+ /* Otherwise, the X server has revoqued its root uid,
+ and thus cannot give up IO privileges any more */
+
+ return;
}
-#endif /* USE_AMD64_IOPL */
+#endif /* USE_AMD64_IOPL */
#ifdef USE_DEV_IO
static int IoFd = -1;
@@ -412,27 +396,26 @@ static int IoFd = -1;
Bool
xf86EnableIO()
{
- if (IoFd >= 0)
- return TRUE;
-
- if ((IoFd = open("/dev/io", O_RDWR)) == -1)
- {
- xf86Msg(X_WARNING,"xf86EnableIO: "
- "Failed to open /dev/io for extended I/O");
- return FALSE;
- }
- return TRUE;
+ if (IoFd >= 0)
+ return TRUE;
+
+ if ((IoFd = open("/dev/io", O_RDWR)) == -1) {
+ xf86Msg(X_WARNING, "xf86EnableIO: "
+ "Failed to open /dev/io for extended I/O");
+ return FALSE;
+ }
+ return TRUE;
}
void
xf86DisableIO()
{
- if (IoFd < 0)
- return;
+ if (IoFd < 0)
+ return;
- close(IoFd);
- IoFd = -1;
- return;
+ close(IoFd);
+ IoFd = -1;
+ return;
}
#endif
@@ -443,50 +426,46 @@ xf86DisableIO()
/***************************************************************************/
void
xf86SetTVOut(int mode)
-{
- switch (xf86Info.consType)
- {
+{
+ switch (xf86Info.consType) {
#ifdef PCCONS_SUPPORT
- case PCCONS:{
-
- if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0)
- {
- xf86Msg(X_WARNING,
- "xf86SetTVOut: Could not set console to TV output, %s\n",
- strerror(errno));
- }
- }
- break;
-#endif /* PCCONS_SUPPORT */
-
- default:
- FatalError("Xf86SetTVOut: Unsupported console");
- break;
+ case PCCONS:{
+
+ if (ioctl(xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0) {
+ xf86Msg(X_WARNING,
+ "xf86SetTVOut: Could not set console to TV output, %s\n",
+ strerror(errno));
+ }
+ }
+ break;
+#endif /* PCCONS_SUPPORT */
+
+ default:
+ FatalError("Xf86SetTVOut: Unsupported console");
+ break;
}
return;
}
void
xf86SetRGBOut()
-{
- switch (xf86Info.consType)
- {
+{
+ switch (xf86Info.consType) {
#ifdef PCCONS_SUPPORT
- case PCCONS:{
-
- if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0)
- {
- xf86Msg(X_WARNING,
- "xf86SetTVOut: Could not set console to RGB output, %s\n",
- strerror(errno));
- }
- }
- break;
-#endif /* PCCONS_SUPPORT */
-
- default:
- FatalError("Xf86SetTVOut: Unsupported console");
- break;
+ case PCCONS:{
+
+ if (ioctl(xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0) {
+ xf86Msg(X_WARNING,
+ "xf86SetTVOut: Could not set console to RGB output, %s\n",
+ strerror(errno));
+ }
+ }
+ break;
+#endif /* PCCONS_SUPPORT */
+
+ default:
+ FatalError("Xf86SetTVOut: Unsupported console");
+ break;
}
return;
}
@@ -507,25 +486,25 @@ xf86SetRGBOut()
static struct mem_range_desc *
getAllRanges(int *nmr)
{
- struct mem_range_desc *mrd;
- struct mem_range_op mro;
-
- /*
- * Find how many ranges there are. If this fails, then the kernel
- * probably doesn't have MTRR support.
- */
- mro.mo_arg[0] = 0;
- if (ioctl(devMemFd, MEMRANGE_GET, &mro))
- return NULL;
- *nmr = mro.mo_arg[0];
- mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc));
- mro.mo_arg[0] = *nmr;
- mro.mo_desc = mrd;
- if (ioctl(devMemFd, MEMRANGE_GET, &mro)) {
- free(mrd);
- return NULL;
- }
- return mrd;
+ struct mem_range_desc *mrd;
+ struct mem_range_op mro;
+
+ /*
+ * Find how many ranges there are. If this fails, then the kernel
+ * probably doesn't have MTRR support.
+ */
+ mro.mo_arg[0] = 0;
+ if (ioctl(devMemFd, MEMRANGE_GET, &mro))
+ return NULL;
+ *nmr = mro.mo_arg[0];
+ mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc));
+ mro.mo_arg[0] = *nmr;
+ mro.mo_desc = mrd;
+ if (ioctl(devMemFd, MEMRANGE_GET, &mro)) {
+ free(mrd);
+ return NULL;
+ }
+ return mrd;
}
/*
@@ -537,109 +516,111 @@ getAllRanges(int *nmr)
static Bool
cleanMTRR()
{
- struct mem_range_desc *mrd;
- struct mem_range_op mro;
- int nmr, i;
+ struct mem_range_desc *mrd;
+ struct mem_range_op mro;
+ int nmr, i;
- /* This shouldn't happen */
- if (devMemFd < 0)
- return FALSE;
+ /* This shouldn't happen */
+ if (devMemFd < 0)
+ return FALSE;
- if (!(mrd = getAllRanges(&nmr)))
- return FALSE;
+ if (!(mrd = getAllRanges(&nmr)))
+ return FALSE;
- for (i = 0; i < nmr; i++) {
- if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 &&
- (mrd[i].mr_flags & MDF_ACTIVE)) {
+ for (i = 0; i < nmr; i++) {
+ if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 &&
+ (mrd[i].mr_flags & MDF_ACTIVE)) {
#ifdef DEBUG
- ErrorF("Clean for (0x%lx,0x%lx)\n",
- (unsigned long)mrd[i].mr_base,
- (unsigned long)mrd[i].mr_len);
+ ErrorF("Clean for (0x%lx,0x%lx)\n",
+ (unsigned long) mrd[i].mr_base,
+ (unsigned long) mrd[i].mr_len);
#endif
- if (mrd[i].mr_flags & MDF_FIXACTIVE) {
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- mrd[i].mr_flags = MDF_UNCACHEABLE;
- } else {
- mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
- }
- mro.mo_desc = mrd + i;
- ioctl(devMemFd, MEMRANGE_SET, &mro);
- }
- }
+ if (mrd[i].mr_flags & MDF_FIXACTIVE) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ mrd[i].mr_flags = MDF_UNCACHEABLE;
+ }
+ else {
+ mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
+ }
+ mro.mo_desc = mrd + i;
+ ioctl(devMemFd, MEMRANGE_SET, &mro);
+ }
+ }
#ifdef DEBUG
- sleep(10);
+ sleep(10);
#endif
- free(mrd);
- return TRUE;
+ free(mrd);
+ return TRUE;
}
typedef struct x_RangeRec {
- struct mem_range_desc mrd;
- Bool wasWC;
- struct x_RangeRec * next;
+ struct mem_range_desc mrd;
+ Bool wasWC;
+ struct x_RangeRec *next;
} RangeRec, *RangePtr;
static void
freeRangeList(RangePtr range)
{
- RangePtr rp;
+ RangePtr rp;
- while (range) {
- rp = range;
- range = rp->next;
- free(rp);
- }
+ while (range) {
+ rp = range;
+ range = rp->next;
+ free(rp);
+ }
}
static RangePtr
dupRangeList(RangePtr list)
{
- RangePtr new = NULL, rp, p;
-
- rp = list;
- while (rp) {
- p = xnfalloc(sizeof(RangeRec));
- *p = *rp;
- p->next = new;
- new = p;
- rp = rp->next;
- }
- return new;
+ RangePtr new = NULL, rp, p;
+
+ rp = list;
+ while (rp) {
+ p = xnfalloc(sizeof(RangeRec));
+ *p = *rp;
+ p->next = new;
+ new = p;
+ rp = rp->next;
+ }
+ return new;
}
static RangePtr
sortRangeList(RangePtr list)
{
- RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev;
- unsigned long minBase;
-
- /* Sort by base address */
- rp1 = copy = dupRangeList(list);
- while (rp1) {
- minBase = rp1->mrd.mr_base;
- minp = rp1;
- minprev = NULL;
- prev = rp1;
- rp2 = rp1->next;
- while (rp2) {
- if (rp2->mrd.mr_base < minBase) {
- minBase = rp2->mrd.mr_base;
- minp = rp2;
- minprev = prev;
- }
- prev = rp2;
- rp2 = rp2->next;
- }
- if (minprev) {
- minprev->next = minp->next;
- rp1 = copy;
- } else {
- rp1 = minp->next;
- }
- minp->next = sorted;
- sorted = minp;
- }
- return sorted;
+ RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev;
+ unsigned long minBase;
+
+ /* Sort by base address */
+ rp1 = copy = dupRangeList(list);
+ while (rp1) {
+ minBase = rp1->mrd.mr_base;
+ minp = rp1;
+ minprev = NULL;
+ prev = rp1;
+ rp2 = rp1->next;
+ while (rp2) {
+ if (rp2->mrd.mr_base < minBase) {
+ minBase = rp2->mrd.mr_base;
+ minp = rp2;
+ minprev = prev;
+ }
+ prev = rp2;
+ rp2 = rp2->next;
+ }
+ if (minprev) {
+ minprev->next = minp->next;
+ rp1 = copy;
+ }
+ else {
+ rp1 = minp->next;
+ }
+ minp->next = sorted;
+ sorted = minp;
+ }
+ return sorted;
}
/*
@@ -647,32 +628,33 @@ sortRangeList(RangePtr list)
*/
static void
-findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp)
+findRanges(unsigned long base, unsigned long size, RangePtr * ucp,
+ RangePtr * wcp)
{
- struct mem_range_desc *mrd;
- int nmr, i;
- RangePtr rp, *p;
-
- if (!(mrd = getAllRanges(&nmr)))
- return;
-
- for (i = 0; i < nmr; i++) {
- if ((mrd[i].mr_flags & MDF_ACTIVE) &&
- mrd[i].mr_base < base + size &&
- mrd[i].mr_base + mrd[i].mr_len > base) {
- if (mrd[i].mr_flags & MDF_WRITECOMBINE)
- p = wcp;
- else if (mrd[i].mr_flags & MDF_UNCACHEABLE)
- p = ucp;
- else
- continue;
- rp = xnfalloc(sizeof(RangeRec));
- rp->mrd = mrd[i];
- rp->next = *p;
- *p = rp;
- }
- }
- free(mrd);
+ struct mem_range_desc *mrd;
+ int nmr, i;
+ RangePtr rp, *p;
+
+ if (!(mrd = getAllRanges(&nmr)))
+ return;
+
+ for (i = 0; i < nmr; i++) {
+ if ((mrd[i].mr_flags & MDF_ACTIVE) &&
+ mrd[i].mr_base < base + size &&
+ mrd[i].mr_base + mrd[i].mr_len > base) {
+ if (mrd[i].mr_flags & MDF_WRITECOMBINE)
+ p = wcp;
+ else if (mrd[i].mr_flags & MDF_UNCACHEABLE)
+ p = ucp;
+ else
+ continue;
+ rp = xnfalloc(sizeof(RangeRec));
+ rp->mrd = mrd[i];
+ rp->next = *p;
+ *p = rp;
+ }
+ }
+ free(mrd);
}
/*
@@ -683,219 +665,222 @@ findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp)
static Bool
fullCoverage(unsigned long base, unsigned long size, RangePtr overlap)
{
- RangePtr rp1, sorted = NULL;
- unsigned long end;
-
- sorted = sortRangeList(overlap);
- /* Look for gaps */
- rp1 = sorted;
- end = base + size;
- while (rp1) {
- if (rp1->mrd.mr_base > base) {
- freeRangeList(sorted);
- return FALSE;
- } else {
- base = rp1->mrd.mr_base + rp1->mrd.mr_len;
- }
- if (base >= end) {
- freeRangeList(sorted);
- return TRUE;
- }
- rp1 = rp1->next;
- }
- freeRangeList(sorted);
- return FALSE;
+ RangePtr rp1, sorted = NULL;
+ unsigned long end;
+
+ sorted = sortRangeList(overlap);
+ /* Look for gaps */
+ rp1 = sorted;
+ end = base + size;
+ while (rp1) {
+ if (rp1->mrd.mr_base > base) {
+ freeRangeList(sorted);
+ return FALSE;
+ }
+ else {
+ base = rp1->mrd.mr_base + rp1->mrd.mr_len;
+ }
+ if (base >= end) {
+ freeRangeList(sorted);
+ return TRUE;
+ }
+ rp1 = rp1->next;
+ }
+ freeRangeList(sorted);
+ return FALSE;
}
static pointer
addWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
{
- RangePtr uc = NULL, wc = NULL, retlist = NULL;
- struct mem_range_desc mrd;
- struct mem_range_op mro;
-
- findRanges(base, size, &uc, &wc);
-
- /* See of the full range is already WC */
- if (!uc && fullCoverage(base, size, wc)) {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx) was already set\n",
- base, size);
- return NULL;
- }
-
- /* Otherwise, try to add the new range */
- mrd.mr_base = base;
- mrd.mr_len = size;
- strcpy(mrd.mr_owner, X_MTRR_ID);
- mrd.mr_flags = MDF_WRITECOMBINE;
- mro.mo_desc = &mrd;
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
- xf86DrvMsg(screenNum, X_WARNING,
- "Failed to set write-combining range "
- "(0x%lx,0x%lx)\n", base, size);
- return NULL;
- } else {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx)\n", base, size);
- retlist = xnfalloc(sizeof(RangeRec));
- retlist->mrd = mrd;
- retlist->wasWC = FALSE;
- retlist->next = NULL;
- return retlist;
- }
+ RangePtr uc = NULL, wc = NULL, retlist = NULL;
+ struct mem_range_desc mrd;
+ struct mem_range_op mro;
+
+ findRanges(base, size, &uc, &wc);
+
+ /* See of the full range is already WC */
+ if (!uc && fullCoverage(base, size, wc)) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx) was already set\n",
+ base, size);
+ return NULL;
+ }
+
+ /* Otherwise, try to add the new range */
+ mrd.mr_base = base;
+ mrd.mr_len = size;
+ strcpy(mrd.mr_owner, X_MTRR_ID);
+ mrd.mr_flags = MDF_WRITECOMBINE;
+ mro.mo_desc = &mrd;
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to set write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ return NULL;
+ }
+ else {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx)\n", base, size);
+ retlist = xnfalloc(sizeof(RangeRec));
+ retlist->mrd = mrd;
+ retlist->wasWC = FALSE;
+ retlist->next = NULL;
+ return retlist;
+ }
}
static pointer
delWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
{
- RangePtr uc = NULL, wc = NULL, retlist = NULL;
- struct mem_range_desc mrd;
- struct mem_range_op mro;
-
- findRanges(base, size, &uc, &wc);
-
- /*
- * See of the full range is already not WC, or if there is full
- * coverage from UC ranges.
- */
- if (!wc || fullCoverage(base, size, uc)) {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx) was already clear\n",
- base, size);
- return NULL;
- }
-
- /* Otherwise, try to add the new range */
- mrd.mr_base = base;
- mrd.mr_len = size;
- strcpy(mrd.mr_owner, X_MTRR_ID);
- mrd.mr_flags = MDF_UNCACHEABLE;
- mro.mo_desc = &mrd;
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
- xf86DrvMsg(screenNum, X_WARNING,
- "Failed to remove write-combining range "
- "(0x%lx,0x%lx)\n", base, size);
- /* XXX Should then remove all of the overlapping WC ranges */
- return NULL;
- } else {
- xf86DrvMsg(screenNum, from,
- "Removed Write-combining range (0x%lx,0x%lx)\n",
- base, size);
- retlist = xnfalloc(sizeof(RangeRec));
- retlist->mrd = mrd;
- retlist->wasWC = TRUE;
- retlist->next = NULL;
- return retlist;
- }
+ RangePtr uc = NULL, wc = NULL, retlist = NULL;
+ struct mem_range_desc mrd;
+ struct mem_range_op mro;
+
+ findRanges(base, size, &uc, &wc);
+
+ /*
+ * See of the full range is already not WC, or if there is full
+ * coverage from UC ranges.
+ */
+ if (!wc || fullCoverage(base, size, uc)) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx) was already clear\n",
+ base, size);
+ return NULL;
+ }
+
+ /* Otherwise, try to add the new range */
+ mrd.mr_base = base;
+ mrd.mr_len = size;
+ strcpy(mrd.mr_owner, X_MTRR_ID);
+ mrd.mr_flags = MDF_UNCACHEABLE;
+ mro.mo_desc = &mrd;
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to remove write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ /* XXX Should then remove all of the overlapping WC ranges */
+ return NULL;
+ }
+ else {
+ xf86DrvMsg(screenNum, from,
+ "Removed Write-combining range (0x%lx,0x%lx)\n", base, size);
+ retlist = xnfalloc(sizeof(RangeRec));
+ retlist->mrd = mrd;
+ retlist->wasWC = TRUE;
+ retlist->next = NULL;
+ return retlist;
+ }
}
static pointer
setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
- MessageType from)
+ MessageType from)
{
- if (enable)
- return addWC(screenNum, base, size, from);
- else
- return delWC(screenNum, base, size, from);
+ if (enable)
+ return addWC(screenNum, base, size, from);
+ else
+ return delWC(screenNum, base, size, from);
}
static void
undoWC(int screenNum, pointer list)
{
- RangePtr rp;
- struct mem_range_op mro;
- Bool failed;
+ RangePtr rp;
+ struct mem_range_op mro;
+ Bool failed;
- rp = list;
- while (rp) {
+ rp = list;
+ while (rp) {
#ifdef DEBUG
- ErrorF("Undo for (0x%lx,0x%lx), %d\n",
- (unsigned long)rp->mrd.mr_base,
- (unsigned long)rp->mrd.mr_len, rp->wasWC);
+ ErrorF("Undo for (0x%lx,0x%lx), %d\n",
+ (unsigned long) rp->mrd.mr_base,
+ (unsigned long) rp->mrd.mr_len, rp->wasWC);
#endif
- failed = FALSE;
- if (rp->wasWC) {
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- rp->mrd.mr_flags = MDF_WRITECOMBINE;
- strcpy(rp->mrd.mr_owner, "unknown");
- } else {
- mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
- }
- mro.mo_desc = &rp->mrd;
-
- if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
- if (!rp->wasWC) {
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- rp->mrd.mr_flags = MDF_UNCACHEABLE;
- strcpy(rp->mrd.mr_owner, "unknown");
- if (ioctl(devMemFd, MEMRANGE_SET, &mro))
- failed = TRUE;
- } else
- failed = TRUE;
- }
- if (failed) {
- xf86DrvMsg(screenNum, X_WARNING,
- "Failed to restore MTRR range (0x%lx,0x%lx)\n",
- (unsigned long)rp->mrd.mr_base,
- (unsigned long)rp->mrd.mr_len);
- }
- rp = rp->next;
- }
+ failed = FALSE;
+ if (rp->wasWC) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ rp->mrd.mr_flags = MDF_WRITECOMBINE;
+ strcpy(rp->mrd.mr_owner, "unknown");
+ }
+ else {
+ mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
+ }
+ mro.mo_desc = &rp->mrd;
+
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ if (!rp->wasWC) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ rp->mrd.mr_flags = MDF_UNCACHEABLE;
+ strcpy(rp->mrd.mr_owner, "unknown");
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro))
+ failed = TRUE;
+ }
+ else
+ failed = TRUE;
+ }
+ if (failed) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to restore MTRR range (0x%lx,0x%lx)\n",
+ (unsigned long) rp->mrd.mr_base,
+ (unsigned long) rp->mrd.mr_len);
+ }
+ rp = rp->next;
+ }
}
-#endif /* HAS_MTRR_SUPPORT */
-
+#endif /* HAS_MTRR_SUPPORT */
#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
static pointer
NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
- MessageType from)
+ MessageType from)
{
- struct mtrr *mtrrp;
- int n;
-
- xf86DrvMsg(screenNum, X_WARNING,
- "%s MTRR %lx - %lx\n", enable ? "set" : "remove",
- base, (base + size));
-
- mtrrp = xnfalloc(sizeof (struct mtrr));
- mtrrp->base = base;
- mtrrp->len = size;
- mtrrp->type = MTRR_TYPE_WC;
-
- /*
- * MTRR_PRIVATE will make this MTRR get reset automatically
- * if this process exits, so we have no need for an explicit
- * cleanup operation when starting a new server.
- */
-
- if (enable)
- mtrrp->flags = MTRR_VALID | MTRR_PRIVATE;
- else
- mtrrp->flags = 0;
- n = 1;
-
- if (i386_set_mtrr(mtrrp, &n) < 0) {
- free(mtrrp);
- return NULL;
- }
- return mtrrp;
+ struct mtrr *mtrrp;
+ int n;
+
+ xf86DrvMsg(screenNum, X_WARNING,
+ "%s MTRR %lx - %lx\n", enable ? "set" : "remove",
+ base, (base + size));
+
+ mtrrp = xnfalloc(sizeof(struct mtrr));
+ mtrrp->base = base;
+ mtrrp->len = size;
+ mtrrp->type = MTRR_TYPE_WC;
+
+ /*
+ * MTRR_PRIVATE will make this MTRR get reset automatically
+ * if this process exits, so we have no need for an explicit
+ * cleanup operation when starting a new server.
+ */
+
+ if (enable)
+ mtrrp->flags = MTRR_VALID | MTRR_PRIVATE;
+ else
+ mtrrp->flags = 0;
+ n = 1;
+
+ if (i386_set_mtrr(mtrrp, &n) < 0) {
+ free(mtrrp);
+ return NULL;
+ }
+ return mtrrp;
}
static void
NetBSDundoWC(int screenNum, pointer list)
{
- struct mtrr *mtrrp = (struct mtrr *)list;
- int n;
-
- if (mtrrp == NULL)
- return;
- n = 1;
- mtrrp->flags &= ~MTRR_VALID;
- i386_set_mtrr(mtrrp, &n);
- free(mtrrp);
+ struct mtrr *mtrrp = (struct mtrr *) list;
+ int n;
+
+ if (mtrrp == NULL)
+ return;
+ n = 1;
+ mtrrp->flags &= ~MTRR_VALID;
+ i386_set_mtrr(mtrrp, &n);
+ free(mtrrp);
}
#endif
diff --git a/xorg-server/hw/xfree86/os-support/bsd/memrange.h b/xorg-server/hw/xfree86/os-support/bsd/memrange.h
index 03c479144..bacd4aa0d 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/memrange.h
+++ b/xorg-server/hw/xfree86/os-support/bsd/memrange.h
@@ -10,36 +10,37 @@
#define _MEMRANGE_H
/* Memory range attributes */
-#define MDF_UNCACHEABLE (1<<0) /* region not cached */
-#define MDF_WRITECOMBINE (1<<1) /* region supports "write combine"
- * action */
-#define MDF_WRITETHROUGH (1<<2) /* write-through cached */
-#define MDF_WRITEBACK (1<<3) /* write-back cached */
-#define MDF_WRITEPROTECT (1<<4) /* read-only region */
+#define MDF_UNCACHEABLE (1<<0) /* region not cached */
+#define MDF_WRITECOMBINE (1<<1) /* region supports "write combine"
+ * action */
+#define MDF_WRITETHROUGH (1<<2) /* write-through cached */
+#define MDF_WRITEBACK (1<<3) /* write-back cached */
+#define MDF_WRITEPROTECT (1<<4) /* read-only region */
#define MDF_ATTRMASK (0x00ffffff)
-#define MDF_FIXBASE (1<<24) /* fixed base */
-#define MDF_FIXLEN (1<<25) /* fixed length */
-#define MDF_FIRMWARE (1<<26) /* set by firmware (XXX not useful?) */
-#define MDF_ACTIVE (1<<27) /* currently active */
-#define MDF_BOGUS (1<<28) /* we don't like it */
-#define MDF_FIXACTIVE (1<<29) /* can't be turned off */
-#define MDF_BUSY (1<<30) /* range is in use */
+#define MDF_FIXBASE (1<<24) /* fixed base */
+#define MDF_FIXLEN (1<<25) /* fixed length */
+#define MDF_FIRMWARE (1<<26) /* set by firmware (XXX not useful?) */
+#define MDF_ACTIVE (1<<27) /* currently active */
+#define MDF_BOGUS (1<<28) /* we don't like it */
+#define MDF_FIXACTIVE (1<<29) /* can't be turned off */
+#define MDF_BUSY (1<<30) /* range is in use */
struct mem_range_desc {
- u_int64_t mr_base;
- u_int64_t mr_len;
- int mr_flags;
- char mr_owner[8];
+ u_int64_t mr_base;
+ u_int64_t mr_len;
+ int mr_flags;
+ char mr_owner[8];
};
struct mem_range_op {
- struct mem_range_desc *mo_desc;
- int mo_arg[2];
+ struct mem_range_desc *mo_desc;
+ int mo_arg[2];
#define MEMRANGE_SET_UPDATE 0
#define MEMRANGE_SET_REMOVE 1
- /* XXX want a flag that says "set and undo when I exit" */
+ /* XXX want a flag that says "set and undo when I exit" */
};
+
#define MEMRANGE_GET _IOWR('m', 50, struct mem_range_op)
#define MEMRANGE_SET _IOW('m', 51, struct mem_range_op)
@@ -47,16 +48,18 @@ struct mem_range_op {
struct mem_range_softc;
struct mem_range_ops {
- void (*init) __P((struct mem_range_softc * sc));
- int (*set) __P((struct mem_range_softc * sc, struct mem_range_desc * mrd, int *arg));
- void (*initAP) __P((struct mem_range_softc * sc));
+ void (*init) __P((struct mem_range_softc * sc));
+ int (*set)
+ __P((struct mem_range_softc * sc, struct mem_range_desc * mrd,
+ int *arg));
+ void (*initAP) __P((struct mem_range_softc * sc));
};
struct mem_range_softc {
- struct mem_range_ops *mr_op;
- int mr_cap;
- int mr_ndesc;
- struct mem_range_desc *mr_desc;
+ struct mem_range_ops *mr_op;
+ int mr_cap;
+ int mr_ndesc;
+ struct mem_range_desc *mr_desc;
};
extern struct mem_range_softc mem_range_softc;
diff --git a/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c b/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
index e5d832eed..417adbf4b 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
@@ -53,94 +53,89 @@ void xf86DisableIO(void);
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
- pVidMem->mapMem = ppcMapVidMem;
- pVidMem->unmapMem = ppcUnmapVidMem;
- pVidMem->initialised = TRUE;
- xf86EnableIO();
+ pVidMem->linearSupported = TRUE;
+ pVidMem->mapMem = ppcMapVidMem;
+ pVidMem->unmapMem = ppcUnmapVidMem;
+ pVidMem->initialised = TRUE;
+ xf86EnableIO();
}
-
volatile unsigned char *ioBase = MAP_FAILED;
static pointer
ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- int fd = xf86Info.consoleFd;
- pointer base;
+ int fd = xf86Info.consoleFd;
+ pointer base;
+
#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d",
- Base, Size, fd);
+ xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd);
#endif
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_SHARED, fd, Base);
- if (base == MAP_FAILED)
- FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
- "xf86MapVidMem", Size, Base, strerror(errno));
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE), MAP_SHARED, fd, Base);
+ if (base == MAP_FAILED)
+ FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
+ "xf86MapVidMem", Size, Base, strerror(errno));
- return base;
+ return base;
}
static void
ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- munmap(Base, Size);
+ munmap(Base, Size);
}
int
xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
+ int Len)
{
- int rv;
- static int kmem = -1;
+ int rv;
+ static int kmem = -1;
- if (kmem == -1) {
- kmem = open(DEV_MEM, 2);
- if (kmem == -1) {
- FatalError("xf86ReadBIOS: open %s", DEV_MEM);
- }
- }
+ if (kmem == -1) {
+ kmem = open(DEV_MEM, 2);
+ if (kmem == -1) {
+ FatalError("xf86ReadBIOS: open %s", DEV_MEM);
+ }
+ }
#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n",
- Base, Offset, Len);
+ xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", Base, Offset, Len);
#endif
+ lseek(kmem, Base + Offset, 0);
+ rv = read(kmem, Buf, Len);
- lseek(kmem, Base + Offset, 0);
- rv = read(kmem, Buf, Len);
-
- return rv;
+ return rv;
}
-Bool xf86EnableIO()
+Bool
+xf86EnableIO()
{
- int fd = xf86Info.consoleFd;
-
- xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd);
- if (ioBase == MAP_FAILED)
- {
- ioBase=mmap(NULL, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
- 0xf2000000);
- xf86MsgVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase);
- if (ioBase == MAP_FAILED) {
- xf86MsgVerb(X_WARNING, 3, "Can't map IO space!\n");
- return FALSE;
- }
+ int fd = xf86Info.consoleFd;
+
+ xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd);
+ if (ioBase == MAP_FAILED) {
+ ioBase = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
+ 0xf2000000);
+ xf86MsgVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase);
+ if (ioBase == MAP_FAILED) {
+ xf86MsgVerb(X_WARNING, 3, "Can't map IO space!\n");
+ return FALSE;
}
- return TRUE;
+ }
+ return TRUE;
}
-void xf86DisableIO()
+void
+xf86DisableIO()
{
- if (ioBase != MAP_FAILED)
- {
- munmap(__UNVOLATILE(ioBase), 0x10000);
- ioBase = MAP_FAILED;
- }
+ if (ioBase != MAP_FAILED) {
+ munmap(__UNVOLATILE(ioBase), 0x10000);
+ ioBase = MAP_FAILED;
+ }
}
-
diff --git a/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c b/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
index 960c850a8..21c166105 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
@@ -44,44 +44,42 @@ static void sparc64UnmapVidMem(int, pointer, unsigned long);
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
- pVidMem->mapMem = sparc64MapVidMem;
- pVidMem->unmapMem = sparc64UnmapVidMem;
- pVidMem->initialised = TRUE;
+ pVidMem->linearSupported = TRUE;
+ pVidMem->mapMem = sparc64MapVidMem;
+ pVidMem->unmapMem = sparc64UnmapVidMem;
+ pVidMem->initialised = TRUE;
}
static pointer
-sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
- int flags)
+sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
+ int flags)
{
- int fd = xf86Info.consoleFd;
- pointer base;
+ int fd = xf86Info.consoleFd;
+ pointer base;
#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d",
- Base, Size, fd);
+ xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd);
#endif
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_SHARED, fd, Base);
- if (base == MAP_FAILED)
- FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
- "xf86MapVidMem", Size, Base, strerror(errno));
- return base;
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE), MAP_SHARED, fd, Base);
+ if (base == MAP_FAILED)
+ FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
+ "xf86MapVidMem", Size, Base, strerror(errno));
+ return base;
}
static void
sparc64UnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- munmap(Base, Size);
+ munmap(Base, Size);
}
int
xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
+ int Len)
{
- return 0;
+ return 0;
}
diff --git a/xorg-server/hw/xfree86/os-support/bus/Sbus.c b/xorg-server/hw/xfree86/os-support/bus/Sbus.c
index c02d2cd55..b75308aa1 100644
--- a/xorg-server/hw/xfree86/os-support/bus/Sbus.c
+++ b/xorg-server/hw/xfree86/os-support/bus/Sbus.c
@@ -47,6 +47,7 @@ static int promFd = -1;
static int promCurrentNode;
static int promOpenCount = 0;
static int promP1275 = -1;
+
#define MAX_PROP 128
#define MAX_VAL (4096-128-4)
static struct openpromio *promOpio;
@@ -54,21 +55,23 @@ static struct openpromio *promOpio;
sbusDevicePtr *xf86SbusInfo = NULL;
struct sbus_devtable sbusDeviceTable[] = {
- { SBUS_DEVICE_BW2, FBTYPE_SUN2BW, "bwtwo", "sunbw2", "Sun Monochrome (bwtwo)" },
- { SBUS_DEVICE_CG2, FBTYPE_SUN2COLOR, "cgtwo", NULL, "Sun Color2 (cgtwo)" },
- { SBUS_DEVICE_CG3, FBTYPE_SUN3COLOR, "cgthree", "suncg3", "Sun Color3 (cgthree)" },
- { SBUS_DEVICE_CG4, FBTYPE_SUN4COLOR, "cgfour", NULL, "Sun Color4 (cgfour)" },
- { SBUS_DEVICE_CG6, FBTYPE_SUNFAST_COLOR, "cgsix", "suncg6", "Sun GX" },
- { SBUS_DEVICE_CG8, FBTYPE_MEMCOLOR, "cgeight", NULL, "Sun CG8/RasterOps" },
- { SBUS_DEVICE_CG12, FBTYPE_SUNGP3, "cgtwelve", NULL, "Sun GS (cgtwelve)" },
- { SBUS_DEVICE_CG14, FBTYPE_MDICOLOR, "cgfourteen", "suncg14", "Sun SX" },
- { SBUS_DEVICE_GT, FBTYPE_SUNGT, "gt", NULL, "Sun Graphics Tower" },
- { SBUS_DEVICE_MGX, -1, "mgx", NULL, "Quantum 3D MGXplus" },
- { SBUS_DEVICE_LEO, FBTYPE_SUNLEO, "leo", "sunleo", "Sun ZX or Turbo ZX" },
- { SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "suntcx", "Sun TCX" },
- { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "sunffb", "Sun FFB" },
- { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "sunffb", "Sun Elite3D" },
- { 0, 0, NULL }
+ {SBUS_DEVICE_BW2, FBTYPE_SUN2BW, "bwtwo", "sunbw2",
+ "Sun Monochrome (bwtwo)"},
+ {SBUS_DEVICE_CG2, FBTYPE_SUN2COLOR, "cgtwo", NULL, "Sun Color2 (cgtwo)"},
+ {SBUS_DEVICE_CG3, FBTYPE_SUN3COLOR, "cgthree", "suncg3",
+ "Sun Color3 (cgthree)"},
+ {SBUS_DEVICE_CG4, FBTYPE_SUN4COLOR, "cgfour", NULL, "Sun Color4 (cgfour)"},
+ {SBUS_DEVICE_CG6, FBTYPE_SUNFAST_COLOR, "cgsix", "suncg6", "Sun GX"},
+ {SBUS_DEVICE_CG8, FBTYPE_MEMCOLOR, "cgeight", NULL, "Sun CG8/RasterOps"},
+ {SBUS_DEVICE_CG12, FBTYPE_SUNGP3, "cgtwelve", NULL, "Sun GS (cgtwelve)"},
+ {SBUS_DEVICE_CG14, FBTYPE_MDICOLOR, "cgfourteen", "suncg14", "Sun SX"},
+ {SBUS_DEVICE_GT, FBTYPE_SUNGT, "gt", NULL, "Sun Graphics Tower"},
+ {SBUS_DEVICE_MGX, -1, "mgx", NULL, "Quantum 3D MGXplus"},
+ {SBUS_DEVICE_LEO, FBTYPE_SUNLEO, "leo", "sunleo", "Sun ZX or Turbo ZX"},
+ {SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "suntcx", "Sun TCX"},
+ {SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "sunffb", "Sun FFB"},
+ {SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "sunffb", "Sun Elite3D"},
+ {0, 0, NULL}
};
int
@@ -76,12 +79,13 @@ promGetSibling(int node)
{
promOpio->oprom_size = sizeof(int);
- if (node == -1) return 0;
- *(int *)promOpio->oprom_array = node;
+ if (node == -1)
+ return 0;
+ *(int *) promOpio->oprom_array = node;
if (ioctl(promFd, OPROMNEXT, promOpio) < 0)
- return 0;
- promCurrentNode = *(int *)promOpio->oprom_array;
- return *(int *)promOpio->oprom_array;
+ return 0;
+ promCurrentNode = *(int *) promOpio->oprom_array;
+ return *(int *) promOpio->oprom_array;
}
int
@@ -89,12 +93,13 @@ promGetChild(int node)
{
promOpio->oprom_size = sizeof(int);
- if (!node || node == -1) return 0;
- *(int *)promOpio->oprom_array = node;
+ if (!node || node == -1)
+ return 0;
+ *(int *) promOpio->oprom_array = node;
if (ioctl(promFd, OPROMCHILD, promOpio) < 0)
- return 0;
- promCurrentNode = *(int *)promOpio->oprom_array;
- return *(int *)promOpio->oprom_array;
+ return 0;
+ promCurrentNode = *(int *) promOpio->oprom_array;
+ return *(int *) promOpio->oprom_array;
}
char *
@@ -104,8 +109,9 @@ promGetProperty(const char *prop, int *lenp)
strcpy(promOpio->oprom_array, prop);
if (ioctl(promFd, OPROMGETPROP, promOpio) < 0)
- return 0;
- if (lenp) *lenp = promOpio->oprom_size;
+ return 0;
+ if (lenp)
+ *lenp = promOpio->oprom_size;
return promOpio->oprom_array;
}
@@ -114,15 +120,15 @@ promGetBool(const char *prop)
{
promOpio->oprom_size = 0;
- *(int *)promOpio->oprom_array = 0;
+ *(int *) promOpio->oprom_array = 0;
for (;;) {
- promOpio->oprom_size = MAX_PROP;
- if (ioctl(promFd, OPROMNXTPROP, promOpio) < 0)
- return 0;
- if (!promOpio->oprom_size)
- return 0;
- if (!strcmp(promOpio->oprom_array, prop))
- return 1;
+ promOpio->oprom_size = MAX_PROP;
+ if (ioctl(promFd, OPROMNXTPROP, promOpio) < 0)
+ return 0;
+ if (!promOpio->oprom_size)
+ return 0;
+ if (!strcmp(promOpio->oprom_array, prop))
+ return 1;
}
}
@@ -138,13 +144,13 @@ promSetNode(sbusPromNodePtr pnode)
int node;
if (!pnode->node || pnode->node == -1)
- return -1;
+ return -1;
if (pnode->cookie[0] & PROM_NODE_SIBLING)
- node = promGetSibling(pnode->cookie[1]);
+ node = promGetSibling(pnode->cookie[1]);
else
- node = promGetChild(pnode->cookie[1]);
+ node = promGetChild(pnode->cookie[1]);
if (pnode->node != node)
- return -1;
+ return -1;
return 0;
}
@@ -156,23 +162,24 @@ promIsP1275(void)
char buffer[1024];
if (promP1275 != -1)
- return;
+ return;
promP1275 = 0;
- f = fopen("/proc/cpuinfo","r");
- if (!f) return;
+ f = fopen("/proc/cpuinfo", "r");
+ if (!f)
+ return;
while (fgets(buffer, 1024, f) != NULL)
- if (!strncmp (buffer, "type", 4) && strstr (buffer, "sun4u")) {
- promP1275 = 1;
- break;
- }
+ if (!strncmp(buffer, "type", 4) && strstr(buffer, "sun4u")) {
+ promP1275 = 1;
+ break;
+ }
fclose(f);
#elif defined(sun)
struct utsname buffer;
if ((uname(&buffer) >= 0) && !strcmp(buffer.machine, "sun4u"))
- promP1275 = TRUE;
+ promP1275 = TRUE;
else
- promP1275 = FALSE;
+ promP1275 = FALSE;
#elif defined(__FreeBSD__)
promP1275 = TRUE;
#else
@@ -184,12 +191,12 @@ void
sparcPromClose(void)
{
if (promOpenCount > 1) {
- promOpenCount--;
- return;
+ promOpenCount--;
+ return;
}
if (promFd != -1) {
- close(promFd);
- promFd = -1;
+ close(promFd);
+ promFd = -1;
}
free(promOpio);
promOpio = NULL;
@@ -200,21 +207,21 @@ int
sparcPromInit(void)
{
if (promOpenCount) {
- promOpenCount++;
- return 0;
+ promOpenCount++;
+ return 0;
}
promFd = open("/dev/openprom", O_RDONLY, 0);
if (promFd == -1)
- return -1;
- promOpio = (struct openpromio *)malloc(4096);
+ return -1;
+ promOpio = (struct openpromio *) malloc(4096);
if (!promOpio) {
- sparcPromClose();
- return -1;
+ sparcPromClose();
+ return -1;
}
promRootNode = promGetSibling(0);
if (!promRootNode) {
- sparcPromClose();
- return -1;
+ sparcPromClose();
+ return -1;
}
promIsP1275();
promOpenCount++;
@@ -226,7 +233,7 @@ char *
sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp)
{
if (promSetNode(pnode))
- return NULL;
+ return NULL;
return promGetProperty(prop, lenp);
}
@@ -234,7 +241,7 @@ int
sparcPromGetBool(sbusPromNodePtr pnode, const char *prop)
{
if (promSetNode(pnode))
- return 0;
+ return 0;
return promGetBool(prop);
}
@@ -247,35 +254,37 @@ promWalkGetDriverName(int node, int oldnode)
int devId, i;
prop = promGetProperty("device_type", &len);
- if (prop && (len > 0)) do {
- if (!strcmp(prop, "display")) {
- prop = promGetProperty("name", &len);
- if (!prop || len <= 0)
- break;
- while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',')
- prop++;
- for (i = 0; sbusDeviceTable[i].devId; i++)
- if (!strcmp(prop, sbusDeviceTable[i].promName))
- break;
- devId = sbusDeviceTable[i].devId;
- if (!devId)
- break;
- if (sbusDeviceTable[i].driverName)
- return sbusDeviceTable[i].driverName;
- }
- } while (0);
+ if (prop && (len > 0))
+ do {
+ if (!strcmp(prop, "display")) {
+ prop = promGetProperty("name", &len);
+ if (!prop || len <= 0)
+ break;
+ while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',')
+ prop++;
+ for (i = 0; sbusDeviceTable[i].devId; i++)
+ if (!strcmp(prop, sbusDeviceTable[i].promName))
+ break;
+ devId = sbusDeviceTable[i].devId;
+ if (!devId)
+ break;
+ if (sbusDeviceTable[i].driverName)
+ return sbusDeviceTable[i].driverName;
+ }
+ } while (0);
nextnode = promGetChild(node);
if (nextnode) {
- char *name;
- name = promWalkGetDriverName(nextnode, node);
- if (name)
- return name;
+ char *name;
+
+ name = promWalkGetDriverName(nextnode, node);
+ if (name)
+ return name;
}
nextnode = promGetSibling(node);
if (nextnode)
- return promWalkGetDriverName(nextnode, node);
+ return promWalkGetDriverName(nextnode, node);
return NULL;
}
@@ -285,7 +294,7 @@ sparcDriverName(void)
char *name;
if (sparcPromInit() < 0)
- return NULL;
+ return NULL;
promGetSibling(0);
name = promWalkGetDriverName(promRootNode, 0);
sparcPromClose();
@@ -293,7 +302,8 @@ sparcDriverName(void)
}
static void
-promWalkAssignNodes(int node, int oldnode, int flags, sbusDevicePtr *devicePtrs)
+promWalkAssignNodes(int node, int oldnode, int flags,
+ sbusDevicePtr * devicePtrs)
{
int nextnode;
int len, sbus = flags & PROM_NODE_SBUS;
@@ -302,67 +312,72 @@ promWalkAssignNodes(int node, int oldnode, int flags, sbusDevicePtr *devicePtrs)
sbusPromNode pNode, pNode2;
prop = promGetProperty("device_type", &len);
- if (prop && (len > 0)) do {
- if (!strcmp(prop, "display")) {
- prop = promGetProperty("name", &len);
- if (!prop || len <= 0)
- break;
- while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',')
- prop++;
- for (i = 0; sbusDeviceTable[i].devId; i++)
- if (!strcmp(prop, sbusDeviceTable[i].promName))
- break;
- devId = sbusDeviceTable[i].devId;
- if (!devId)
- break;
- if (!sbus) {
- if (devId == SBUS_DEVICE_FFB) {
- /*
- * All /SUNW,ffb outside of SBUS tree come before all
- * /SUNW,afb outside of SBUS tree in Linux.
- */
- if (!strcmp(prop, "afb"))
- flags |= PROM_NODE_PREF;
- } else if (devId != SBUS_DEVICE_CG14)
- break;
- }
- for (i = 0; i < 32; i++) {
- if (!devicePtrs[i] || devicePtrs[i]->devId != devId)
- continue;
- if (devicePtrs[i]->node.node) {
- if ((devicePtrs[i]->node.cookie[0] & ~PROM_NODE_SIBLING) <=
- (flags & ~PROM_NODE_SIBLING))
- continue;
- for (j = i + 1, pNode = devicePtrs[i]->node; j < 32; j++) {
- if (!devicePtrs[j] || devicePtrs[j]->devId != devId)
- continue;
- pNode2 = devicePtrs[j]->node;
- devicePtrs[j]->node = pNode;
- pNode = pNode2;
- }
- }
- devicePtrs[i]->node.node = node;
- devicePtrs[i]->node.cookie[0] = flags;
- devicePtrs[i]->node.cookie[1] = oldnode;
- break;
- }
- break;
- }
- } while (0);
+ if (prop && (len > 0))
+ do {
+ if (!strcmp(prop, "display")) {
+ prop = promGetProperty("name", &len);
+ if (!prop || len <= 0)
+ break;
+ while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',')
+ prop++;
+ for (i = 0; sbusDeviceTable[i].devId; i++)
+ if (!strcmp(prop, sbusDeviceTable[i].promName))
+ break;
+ devId = sbusDeviceTable[i].devId;
+ if (!devId)
+ break;
+ if (!sbus) {
+ if (devId == SBUS_DEVICE_FFB) {
+ /*
+ * All /SUNW,ffb outside of SBUS tree come before all
+ * /SUNW,afb outside of SBUS tree in Linux.
+ */
+ if (!strcmp(prop, "afb"))
+ flags |= PROM_NODE_PREF;
+ }
+ else if (devId != SBUS_DEVICE_CG14)
+ break;
+ }
+ for (i = 0; i < 32; i++) {
+ if (!devicePtrs[i] || devicePtrs[i]->devId != devId)
+ continue;
+ if (devicePtrs[i]->node.node) {
+ if ((devicePtrs[i]->node.
+ cookie[0] & ~PROM_NODE_SIBLING) <=
+ (flags & ~PROM_NODE_SIBLING))
+ continue;
+ for (j = i + 1, pNode = devicePtrs[i]->node; j < 32;
+ j++) {
+ if (!devicePtrs[j] || devicePtrs[j]->devId != devId)
+ continue;
+ pNode2 = devicePtrs[j]->node;
+ devicePtrs[j]->node = pNode;
+ pNode = pNode2;
+ }
+ }
+ devicePtrs[i]->node.node = node;
+ devicePtrs[i]->node.cookie[0] = flags;
+ devicePtrs[i]->node.cookie[1] = oldnode;
+ break;
+ }
+ break;
+ }
+ } while (0);
prop = promGetProperty("name", &len);
if (prop && len > 0) {
- if (!strcmp(prop, "sbus") || !strcmp(prop, "sbi"))
- sbus = PROM_NODE_SBUS;
+ if (!strcmp(prop, "sbus") || !strcmp(prop, "sbi"))
+ sbus = PROM_NODE_SBUS;
}
nextnode = promGetChild(node);
if (nextnode)
- promWalkAssignNodes(nextnode, node, sbus, devicePtrs);
+ promWalkAssignNodes(nextnode, node, sbus, devicePtrs);
nextnode = promGetSibling(node);
if (nextnode)
- promWalkAssignNodes(nextnode, node, PROM_NODE_SIBLING | sbus, devicePtrs);
+ promWalkAssignNodes(nextnode, node, PROM_NODE_SIBLING | sbus,
+ devicePtrs);
}
void
@@ -375,63 +390,66 @@ sparcPromAssignNodes(void)
memset(devicePtrs, 0, sizeof(devicePtrs));
for (psdpp = xf86SbusInfo, n = 0; (psdp = *psdpp); psdpp++, n++) {
- if (psdp->fbNum != n)
- holes = 1;
- devicePtrs[psdp->fbNum] = psdp;
+ if (psdp->fbNum != n)
+ holes = 1;
+ devicePtrs[psdp->fbNum] = psdp;
}
if (holes && (f = fopen("/proc/fb", "r")) != NULL) {
- /* We could not open one of fb devices, check /proc/fb to see what
- * were the types of the cards missed. */
- char buffer[64];
- int fbNum, devId;
- static struct {
- int devId;
- char *prefix;
- } procFbPrefixes[] = {
- { SBUS_DEVICE_BW2, "BWtwo" },
- { SBUS_DEVICE_CG14, "CGfourteen" },
- { SBUS_DEVICE_CG6, "CGsix" },
- { SBUS_DEVICE_CG3, "CGthree" },
- { SBUS_DEVICE_FFB, "Creator" },
- { SBUS_DEVICE_FFB, "Elite 3D" },
- { SBUS_DEVICE_LEO, "Leo" },
- { SBUS_DEVICE_TCX, "TCX" },
- { 0, NULL },
- };
-
- while (fscanf(f, "%d %63s\n", &fbNum, buffer) == 2) {
- for (i = 0; procFbPrefixes[i].devId; i++)
- if (! strncmp(procFbPrefixes[i].prefix, buffer,
- strlen(procFbPrefixes[i].prefix)))
- break;
- devId = procFbPrefixes[i].devId;
- if (! devId) continue;
- if (devicePtrs[fbNum]) {
- if (devicePtrs[fbNum]->devId != devId)
- xf86ErrorF("Inconsistent /proc/fb with FBIOGATTR\n");
- } else if (!devicePtrs[fbNum]) {
- devicePtrs[fbNum] = psdp = xnfcalloc(sizeof (sbusDevice), 1);
- psdp->devId = devId;
- psdp->fbNum = fbNum;
- psdp->fd = -2;
- }
- }
- fclose(f);
+ /* We could not open one of fb devices, check /proc/fb to see what
+ * were the types of the cards missed. */
+ char buffer[64];
+ int fbNum, devId;
+ static struct {
+ int devId;
+ char *prefix;
+ } procFbPrefixes[] = {
+ {
+ SBUS_DEVICE_BW2, "BWtwo"}, {
+ SBUS_DEVICE_CG14, "CGfourteen"}, {
+ SBUS_DEVICE_CG6, "CGsix"}, {
+ SBUS_DEVICE_CG3, "CGthree"}, {
+ SBUS_DEVICE_FFB, "Creator"}, {
+ SBUS_DEVICE_FFB, "Elite 3D"}, {
+ SBUS_DEVICE_LEO, "Leo"}, {
+ SBUS_DEVICE_TCX, "TCX"}, {
+ 0, NULL},};
+
+ while (fscanf(f, "%d %63s\n", &fbNum, buffer) == 2) {
+ for (i = 0; procFbPrefixes[i].devId; i++)
+ if (!strncmp(procFbPrefixes[i].prefix, buffer,
+ strlen(procFbPrefixes[i].prefix)))
+ break;
+ devId = procFbPrefixes[i].devId;
+ if (!devId)
+ continue;
+ if (devicePtrs[fbNum]) {
+ if (devicePtrs[fbNum]->devId != devId)
+ xf86ErrorF("Inconsistent /proc/fb with FBIOGATTR\n");
+ }
+ else if (!devicePtrs[fbNum]) {
+ devicePtrs[fbNum] = psdp = xnfcalloc(sizeof(sbusDevice), 1);
+ psdp->devId = devId;
+ psdp->fbNum = fbNum;
+ psdp->fd = -2;
+ }
+ }
+ fclose(f);
}
promGetSibling(0);
promWalkAssignNodes(promRootNode, 0, PROM_NODE_PREF, devicePtrs);
for (i = 0, j = 0; i < 32; i++)
- if (devicePtrs[i] && devicePtrs[i]->fbNum == -1)
- j++;
+ if (devicePtrs[i] && devicePtrs[i]->fbNum == -1)
+ j++;
xf86SbusInfo = xnfrealloc(xf86SbusInfo, sizeof(psdp) * (n + j + 1));
for (i = 0, psdpp = xf86SbusInfo; i < 32; i++)
- if (devicePtrs[i]) {
- if (devicePtrs[i]->fbNum == -1) {
- memmove(psdpp + 1, psdpp, sizeof(psdpp) * (n + 1));
- *psdpp = devicePtrs[i];
- } else
- n--;
- }
+ if (devicePtrs[i]) {
+ if (devicePtrs[i]->fbNum == -1) {
+ memmove(psdpp + 1, psdpp, sizeof(psdpp) * (n + 1));
+ *psdpp = devicePtrs[i];
+ }
+ else
+ n--;
+ }
}
static char *
@@ -444,37 +462,43 @@ promGetReg(int type)
regstr[0] = 0;
prop = promGetProperty("reg", &len);
if (prop && len >= 4) {
- unsigned int *reg = (unsigned int *)prop;
- if (!promP1275 || (type == PROM_NODE_SBUS) || (type == PROM_NODE_EBUS))
- snprintf (regstr, sizeof(regstr), "@%x,%x", reg[0], reg[1]);
- else if (type == PROM_NODE_PCI) {
- if ((reg[0] >> 8) & 7)
- snprintf (regstr, sizeof(regstr), "@%x,%x", (reg[0] >> 11) & 0x1f, (reg[0] >> 8) & 7);
- else
- snprintf (regstr, sizeof(regstr), "@%x", (reg[0] >> 11) & 0x1f);
- } else if (len == 4)
- snprintf (regstr, sizeof(regstr), "@%x", reg[0]);
- else {
- unsigned int regs[2];
-
- /* Things get more complicated on UPA. If upa-portid exists,
- then address is @upa-portid,second-int-in-reg, otherwise
- it is @first-int-in-reg/16,second-int-in-reg (well, probably
- upa-portid always exists, but just to be safe). */
- memcpy (regs, reg, sizeof(regs));
- prop = promGetProperty("upa-portid", &len);
- if (prop && len == 4) {
- reg = (unsigned int *)prop;
- snprintf (regstr, sizeof(regstr), "@%x,%x", reg[0], regs[1]);
- } else
- snprintf (regstr, sizeof(regstr), "@%x,%x", regs[0] >> 4, regs[1]);
- }
+ unsigned int *reg = (unsigned int *) prop;
+
+ if (!promP1275 || (type == PROM_NODE_SBUS) || (type == PROM_NODE_EBUS))
+ snprintf(regstr, sizeof(regstr), "@%x,%x", reg[0], reg[1]);
+ else if (type == PROM_NODE_PCI) {
+ if ((reg[0] >> 8) & 7)
+ snprintf(regstr, sizeof(regstr), "@%x,%x",
+ (reg[0] >> 11) & 0x1f, (reg[0] >> 8) & 7);
+ else
+ snprintf(regstr, sizeof(regstr), "@%x", (reg[0] >> 11) & 0x1f);
+ }
+ else if (len == 4)
+ snprintf(regstr, sizeof(regstr), "@%x", reg[0]);
+ else {
+ unsigned int regs[2];
+
+ /* Things get more complicated on UPA. If upa-portid exists,
+ then address is @upa-portid,second-int-in-reg, otherwise
+ it is @first-int-in-reg/16,second-int-in-reg (well, probably
+ upa-portid always exists, but just to be safe). */
+ memcpy(regs, reg, sizeof(regs));
+ prop = promGetProperty("upa-portid", &len);
+ if (prop && len == 4) {
+ reg = (unsigned int *) prop;
+ snprintf(regstr, sizeof(regstr), "@%x,%x", reg[0], regs[1]);
+ }
+ else
+ snprintf(regstr, sizeof(regstr), "@%x,%x", regs[0] >> 4,
+ regs[1]);
+ }
}
return regstr;
}
static int
-promWalkNode2Pathname(char *path, int parent, int node, int searchNode, int type)
+promWalkNode2Pathname(char *path, int parent, int node, int searchNode,
+ int type)
{
int nextnode;
int len, ntype = type;
@@ -483,27 +507,28 @@ promWalkNode2Pathname(char *path, int parent, int node, int searchNode, int type
prop = promGetProperty("name", &len);
*path = '/';
if (!prop || len <= 0)
- return 0;
+ return 0;
if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type)
- ntype = PROM_NODE_SBUS;
+ ntype = PROM_NODE_SBUS;
else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI)
- ntype = PROM_NODE_EBUS;
+ ntype = PROM_NODE_EBUS;
else if (!strcmp(prop, "pci") && !type)
- ntype = PROM_NODE_PCI;
- strcpy (path + 1, prop);
+ ntype = PROM_NODE_PCI;
+ strcpy(path + 1, prop);
p = promGetReg(type);
if (*p)
- strcat (path, p);
+ strcat(path, p);
if (node == searchNode)
- return 1;
+ return 1;
nextnode = promGetChild(node);
if (nextnode &&
- promWalkNode2Pathname(strchr(path, 0), node, nextnode, searchNode, ntype))
- return 1;
+ promWalkNode2Pathname(strchr(path, 0), node, nextnode, searchNode,
+ ntype))
+ return 1;
nextnode = promGetSibling(node);
if (nextnode &&
- promWalkNode2Pathname(path, parent, nextnode, searchNode, type))
- return 1;
+ promWalkNode2Pathname(path, parent, nextnode, searchNode, type))
+ return 1;
return 0;
}
@@ -512,11 +537,14 @@ sparcPromNode2Pathname(sbusPromNodePtr pnode)
{
char *ret;
- if (!pnode->node) return NULL;
+ if (!pnode->node)
+ return NULL;
ret = malloc(4096);
- if (!ret) return NULL;
- if (promWalkNode2Pathname(ret, promRootNode, promGetChild(promRootNode), pnode->node, 0))
- return ret;
+ if (!ret)
+ return NULL;
+ if (promWalkNode2Pathname
+ (ret, promRootNode, promGetChild(promRootNode), pnode->node, 0))
+ return ret;
free(ret);
return NULL;
}
@@ -528,51 +556,52 @@ promWalkPathname2Node(char *name, char *regstr, int parent, int type)
char *prop, *p;
for (;;) {
- prop = promGetProperty("name", &len);
- if (!prop || len <= 0)
- return 0;
- if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type)
- type = PROM_NODE_SBUS;
- else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI)
- type = PROM_NODE_EBUS;
- else if (!strcmp(prop, "pci") && !type)
- type = PROM_NODE_PCI;
- for (node = promGetChild(parent); node; node = promGetSibling(node)) {
- prop = promGetProperty("name", &len);
- if (!prop || len <= 0)
- continue;
- if (*name && strcmp(name, prop))
- continue;
- if (*regstr) {
- p = promGetReg(type);
- if (! *p || strcmp(p + 1, regstr))
- continue;
- }
- break;
- }
- if (!node) {
- for (node = promGetChild(parent); node; node = promGetSibling(node)) {
- ret = promWalkPathname2Node(name, regstr, node, type);
- if (ret) return ret;
- }
- return 0;
- }
- name = strchr(regstr, 0) + 1;
- if (! *name)
- return node;
- p = strchr(name, '/');
- if (p)
- *p = 0;
- else
- p = strchr(name, 0);
- regstr = strchr(name, '@');
- if (regstr)
- *regstr++ = 0;
- else
- regstr = p;
- if (name == regstr)
- return 0;
- parent = node;
+ prop = promGetProperty("name", &len);
+ if (!prop || len <= 0)
+ return 0;
+ if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type)
+ type = PROM_NODE_SBUS;
+ else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI)
+ type = PROM_NODE_EBUS;
+ else if (!strcmp(prop, "pci") && !type)
+ type = PROM_NODE_PCI;
+ for (node = promGetChild(parent); node; node = promGetSibling(node)) {
+ prop = promGetProperty("name", &len);
+ if (!prop || len <= 0)
+ continue;
+ if (*name && strcmp(name, prop))
+ continue;
+ if (*regstr) {
+ p = promGetReg(type);
+ if (!*p || strcmp(p + 1, regstr))
+ continue;
+ }
+ break;
+ }
+ if (!node) {
+ for (node = promGetChild(parent); node; node = promGetSibling(node)) {
+ ret = promWalkPathname2Node(name, regstr, node, type);
+ if (ret)
+ return ret;
+ }
+ return 0;
+ }
+ name = strchr(regstr, 0) + 1;
+ if (!*name)
+ return node;
+ p = strchr(name, '/');
+ if (p)
+ *p = 0;
+ else
+ p = strchr(name, 0);
+ regstr = strchr(name, '@');
+ if (regstr)
+ *regstr++ = 0;
+ else
+ regstr = p;
+ if (name == regstr)
+ return 0;
+ parent = node;
}
}
@@ -584,23 +613,24 @@ sparcPromPathname2Node(const char *pathName)
i = strlen(pathName);
name = malloc(i + 2);
- if (! name) return 0;
- strcpy (name, pathName);
- name [i + 1] = 0;
+ if (!name)
+ return 0;
+ strcpy(name, pathName);
+ name[i + 1] = 0;
if (name[0] != '/')
- return 0;
+ return 0;
p = strchr(name + 1, '/');
if (p)
- *p = 0;
+ *p = 0;
else
- p = strchr(name, 0);
+ p = strchr(name, 0);
regstr = strchr(name, '@');
if (regstr)
- *regstr++ = 0;
+ *regstr++ = 0;
else
- regstr = p;
+ regstr = p;
if (name + 1 == regstr)
- return 0;
+ return 0;
promGetSibling(0);
i = promWalkPathname2Node(name + 1, regstr, promRootNode, 0);
free(name);
@@ -616,32 +646,33 @@ xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size)
unsigned long len = ((offset + size + pagemask) & ~pagemask) - off;
if (psdp->fd == -1) {
- psdp->fd = open(psdp->device, O_RDWR);
- if (psdp->fd == -1)
- return NULL;
- } else if (psdp->fd < 0)
- return NULL;
-
- ret = (pointer) mmap (NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE,
- psdp->fd, off);
+ psdp->fd = open(psdp->device, O_RDWR);
+ if (psdp->fd == -1)
+ return NULL;
+ }
+ else if (psdp->fd < 0)
+ return NULL;
+
+ ret = (pointer) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE,
+ psdp->fd, off);
if (ret == (pointer) -1) {
- ret = (pointer) mmap (NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED,
- psdp->fd, off);
+ ret = (pointer) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED,
+ psdp->fd, off);
}
if (ret == (pointer) -1)
- return NULL;
+ return NULL;
- return (char *)ret + (offset - off);
+ return (char *) ret + (offset - off);
}
void
xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size)
{
unsigned long mask = getpagesize() - 1;
- unsigned long base = (unsigned long)addr & ~mask;
- unsigned long len = (((unsigned long)addr + size + mask) & ~mask) - base;
+ unsigned long base = (unsigned long) addr & ~mask;
+ unsigned long len = (((unsigned long) addr + size + mask) & ~mask) - base;
- munmap ((pointer)base, len);
+ munmap((pointer) base, len);
}
/* Tell OS that we are driving the HW cursor ourselves. */
@@ -657,8 +688,8 @@ xf86SbusHideOsHwCursor(sbusDevicePtr psdp)
fbcursor.cmap.red = zeros;
fbcursor.cmap.green = zeros;
fbcursor.cmap.blue = zeros;
- fbcursor.image = (char *)zeros;
- fbcursor.mask = (char *)zeros;
+ fbcursor.image = (char *) zeros;
+ fbcursor.mask = (char *) zeros;
fbcursor.size.x = 32;
fbcursor.size.y = 1;
fbcursor.set = FB_CUR_SETALL;
diff --git a/xorg-server/hw/xfree86/os-support/bus/nobus.c b/xorg-server/hw/xfree86/os-support/bus/nobus.c
index ad23f5288..dca58fee2 100644
--- a/xorg-server/hw/xfree86/os-support/bus/nobus.c
+++ b/xorg-server/hw/xfree86/os-support/bus/nobus.c
@@ -1 +1,5 @@
-static void __noop_to_appease_ar__() { return; }
+static void
+__noop_to_appease_ar__()
+{
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/bus/xf86Pci.h b/xorg-server/hw/xfree86/os-support/bus/xf86Pci.h
index 74ead201e..f69e55b39 100644
--- a/xorg-server/hw/xfree86/os-support/bus/xf86Pci.h
+++ b/xorg-server/hw/xfree86/os-support/bus/xf86Pci.h
@@ -95,7 +95,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/*
* This file contains just the public interface to the PCI code.
* Drivers should use this file rather than Pci.h.
@@ -234,8 +233,8 @@
*/
/* Primitive Types */
-typedef unsigned long ADDRESS; /* Memory/PCI address */
-typedef unsigned long IOADDRESS _X_DEPRECATED; /* Must be large enough for a pointer */
+typedef unsigned long ADDRESS; /* Memory/PCI address */
+typedef unsigned long IOADDRESS _X_DEPRECATED; /* Must be large enough for a pointer */
typedef CARD32 PCITAG _X_DEPRECATED;
typedef enum {
@@ -249,12 +248,12 @@ typedef enum {
PCI_IO_SPARSE_MASK
} PciAddrType;
-
/* Public PCI access functions */
extern _X_EXPORT Bool xf86scanpci(void);
/* Domain access functions. Some of these probably shouldn't be public */
extern _X_EXPORT struct pci_io_handle *xf86MapLegacyIO(struct pci_device *dev);
-extern _X_EXPORT void xf86UnmapLegacyIO(struct pci_device *, struct pci_io_handle *);
+extern _X_EXPORT void xf86UnmapLegacyIO(struct pci_device *,
+ struct pci_io_handle *);
-#endif /* _XF86PCI_H */
+#endif /* _XF86PCI_H */
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c
index 94e261553..185b2b951 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c
@@ -44,39 +44,38 @@
#include <mach.h>
int
-xf86ProcessArgument( int argc,char **argv, int i )
+xf86ProcessArgument(int argc, char **argv, int i)
{
return 0;
}
+
void
xf86UseMsg()
{
return;
}
-
void
xf86OpenConsole()
{
- if( serverGeneration == 1 )
- {
- kern_return_t err;
- mach_port_t device;
- int fd;
- err = get_privileged_ports( NULL, &device );
- if( err )
- {
- errno = err;
- FatalError( "xf86KbdInit can't get_privileged_ports. (%s)\n" , strerror(errno) );
- }
- mach_port_deallocate (mach_task_self (), device);
-
- if( ( fd = open( "/dev/kbd" , O_RDONLY|O_NONBLOCK ) ) < 0 )
- {
- fprintf( stderr , "Cannot open keyboard (%s)\n",strerror(errno) );
- exit(1);
- }
- xf86Info.consoleFd = fd;
+ if (serverGeneration == 1) {
+ kern_return_t err;
+ mach_port_t device;
+ int fd;
+
+ err = get_privileged_ports(NULL, &device);
+ if (err) {
+ errno = err;
+ FatalError("xf86KbdInit can't get_privileged_ports. (%s)\n",
+ strerror(errno));
+ }
+ mach_port_deallocate(mach_task_self(), device);
+
+ if ((fd = open("/dev/kbd", O_RDONLY | O_NONBLOCK)) < 0) {
+ fprintf(stderr, "Cannot open keyboard (%s)\n", strerror(errno));
+ exit(1);
+ }
+ xf86Info.consoleFd = fd;
}
return;
}
@@ -84,6 +83,6 @@ xf86OpenConsole()
void
xf86CloseConsole()
{
- close( xf86Info.consoleFd );
+ close(xf86Info.consoleFd);
return;
}
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c
index 9d9b84a28..6ac9efdfe 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c
@@ -1,95 +1,93 @@
-/*
- * Copyright 1997 by UCHIYAMA Yasushi
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of UCHIYAMA Yasushi not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. UCHIYAMA Yasushi makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include<mach.h>
-#include<device/device.h>
-#include<mach/machine/mach_i386.h>
-
-#include <X11/X.h>
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#define BIOS_SIZE 0x20000
-
-int
-xf86ReadBIOS(unsigned long Base,unsigned long Offset,unsigned char *Buf,int Len)
-{
- mach_port_t device,mem_dev;
- memory_object_t mem_obj;
- vm_address_t addr = (vm_address_t)0; /* serach starting address */
- kern_return_t err;
-
-
- err = get_privileged_ports (NULL, &device);
- if( err )
- {
- errno = err;
- FatalError("xf86ReadBIOS() can't get_privileged_ports. (%s)\n",strerror(errno));
- }
- err = device_open(device,D_READ|D_WRITE,"mem",&mem_dev);
- mach_port_deallocate (mach_task_self (), device);
- if( err )
- {
- errno = err;
- FatalError("xf86ReadBIOS() can't device_open. (%s)\n",strerror(errno));
- }
- err = device_map(mem_dev,VM_PROT_READ|VM_PROT_WRITE, Base , BIOS_SIZE ,&mem_obj,0);
- if( err )
- {
- errno = err;
- FatalError("xf86ReadBIOS() can't device_map. (%s)\n",strerror(errno));
- }
- err = vm_map(mach_task_self(),
- &addr,
- BIOS_SIZE,
- 0,
- TRUE,
- mem_obj,
- Base,
- FALSE,
- VM_PROT_READ|VM_PROT_WRITE,
- VM_PROT_READ|VM_PROT_WRITE,
- VM_INHERIT_SHARE);
- mach_port_deallocate(mach_task_self(),mem_obj);
- if( err )
- {
- errno = err;
- FatalError("xf86ReadBIOS() can't vm_map. (%s)\n",strerror(errno));
- }
-
- memcpy(Buf,(void*)((int)addr + Offset), Len);
-
- err = vm_deallocate(mach_task_self(), addr, BIOS_SIZE);
- if( err )
- {
- errno = err;
- FatalError("xf86ReadBIOS() can't vm_deallocate. (%s)\n",strerror(errno));
- }
-
- return Len;
-}
+/*
+ * Copyright 1997 by UCHIYAMA Yasushi
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of UCHIYAMA Yasushi not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. UCHIYAMA Yasushi makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include<mach.h>
+#include<device/device.h>
+#include<mach/machine/mach_i386.h>
+
+#include <X11/X.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#define BIOS_SIZE 0x20000
+
+int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ mach_port_t device, mem_dev;
+ memory_object_t mem_obj;
+ vm_address_t addr = (vm_address_t) 0; /* serach starting address */
+ kern_return_t err;
+
+ err = get_privileged_ports(NULL, &device);
+ if (err) {
+ errno = err;
+ FatalError("xf86ReadBIOS() can't get_privileged_ports. (%s)\n",
+ strerror(errno));
+ }
+ err = device_open(device, D_READ | D_WRITE, "mem", &mem_dev);
+ mach_port_deallocate(mach_task_self(), device);
+ if (err) {
+ errno = err;
+ FatalError("xf86ReadBIOS() can't device_open. (%s)\n", strerror(errno));
+ }
+ err =
+ device_map(mem_dev, VM_PROT_READ | VM_PROT_WRITE, Base, BIOS_SIZE,
+ &mem_obj, 0);
+ if (err) {
+ errno = err;
+ FatalError("xf86ReadBIOS() can't device_map. (%s)\n", strerror(errno));
+ }
+ err = vm_map(mach_task_self(),
+ &addr,
+ BIOS_SIZE,
+ 0,
+ TRUE,
+ mem_obj,
+ Base,
+ FALSE,
+ VM_PROT_READ | VM_PROT_WRITE,
+ VM_PROT_READ | VM_PROT_WRITE, VM_INHERIT_SHARE);
+ mach_port_deallocate(mach_task_self(), mem_obj);
+ if (err) {
+ errno = err;
+ FatalError("xf86ReadBIOS() can't vm_map. (%s)\n", strerror(errno));
+ }
+
+ memcpy(Buf, (void *) ((int) addr + Offset), Len);
+
+ err = vm_deallocate(mach_task_self(), addr, BIOS_SIZE);
+ if (err) {
+ errno = err;
+ FatalError("xf86ReadBIOS() can't vm_deallocate. (%s)\n",
+ strerror(errno));
+ }
+
+ return Len;
+}
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
index a0a3b2758..72474ba10 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
@@ -1,155 +1,152 @@
-/*
- * Copyright 1997, 1998 by UCHIYAMA Yasushi
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of UCHIYAMA Yasushi not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. UCHIYAMA Yasushi makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <mach.h>
-#include <device/device.h>
-#include <mach/machine/mach_i386.h>
-
-#include <X11/X.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86OSpriv.h"
-
-/**************************************************************************
- * Video Memory Mapping section
- ***************************************************************************/
-static pointer
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
-{
- mach_port_t device,mem_dev;
- memory_object_t mem_obj;
- kern_return_t err;
- vm_address_t addr=(vm_address_t)0;
-
- err = get_privileged_ports (NULL, &device);
- if( err )
- {
- errno = err;
- FatalError("xf86MapVidMem() can't get_privileged_ports. (%s)\n",strerror(errno));
- }
- err = device_open(device,D_READ|D_WRITE,"mem",&mem_dev);
- mach_port_deallocate (mach_task_self(), device);
- if( err )
- {
- errno = err;
- FatalError("xf86MapVidMem() can't device_open. (%s)\n",strerror(errno));
- }
-
- err = device_map(mem_dev,VM_PROT_READ|VM_PROT_WRITE, Base , Size ,&mem_obj,0);
- if( err )
- {
- errno = err;
- FatalError("xf86MapVidMem() can't device_map. (%s)\n",strerror(errno));
- }
- err = vm_map(mach_task_self(),
- &addr,
- Size,
- 0, /* mask */
- TRUE, /* anywhere */
- mem_obj,
- (vm_offset_t)Base,
- FALSE, /* copy on write */
- VM_PROT_READ|VM_PROT_WRITE,
- VM_PROT_READ|VM_PROT_WRITE,
- VM_INHERIT_SHARE);
- mach_port_deallocate(mach_task_self(),mem_obj);
- if( err )
- {
- errno = err;
- FatalError("xf86MapVidMem() can't vm_map.(mem_obj) (%s)\n",strerror(errno));
- }
- mach_port_deallocate(mach_task_self(),mem_dev);
- if( err )
- {
- errno = err;
- FatalError("xf86MapVidMem() can't mach_port_deallocate.(mem_dev) (%s)\n",strerror(errno));
- }
- return (pointer)addr;
-}
-
-static void
-unmapVidMem(int ScreenNum,pointer Base,unsigned long Size)
-{
- kern_return_t err = vm_deallocate(mach_task_self(), (int)Base, Size);
- if( err )
- {
- errno = err;
- ErrorF("xf86UnMapVidMem: can't dealloc framebuffer space (%s)\n",strerror(errno));
- }
- return;
-}
-
-/**************************************************************************
- * I/O Permissions section
- ***************************************************************************/
-
-/*
- * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
- * this.
- */
-extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on);
-
-Bool
-xf86EnableIO()
-{
- if (ioperm(0, 0x10000, 1)) {
- FatalError("xf86EnableIO: ioperm() failed (%s)\n", strerror(errno));
- return FALSE;
- }
-#if 0
- /*
- * Trapping disabled for now, as some VBIOSes (mga-g450 notably) use these
- * ports, and the int10 wrapper is not emulating them. (Note that it's
- * effectively what happens in the Linux variant too, as iopl() is used
- * there, making the ioperm() meaningless.)
- *
- * Reenable this when int10 gets fixed. */
- ioperm(0x40,4,0); /* trap access to the timer chip */
- ioperm(0x60,4,0); /* trap access to the keyboard controller */
-#endif
- return TRUE;
-}
-
-void
-xf86DisableIO()
-{
- ioperm(0,0x10000,0);
- return;
-}
-
-void
-xf86OSInitVidMem(VidMemInfoPtr pVidMem)
-{
- pVidMem->linearSupported = TRUE;
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
- pVidMem->initialised = TRUE;
-}
+/*
+ * Copyright 1997, 1998 by UCHIYAMA Yasushi
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of UCHIYAMA Yasushi not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. UCHIYAMA Yasushi makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <mach.h>
+#include <device/device.h>
+#include <mach/machine/mach_i386.h>
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+/**************************************************************************
+ * Video Memory Mapping section
+ ***************************************************************************/
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
+{
+ mach_port_t device, mem_dev;
+ memory_object_t mem_obj;
+ kern_return_t err;
+ vm_address_t addr = (vm_address_t) 0;
+
+ err = get_privileged_ports(NULL, &device);
+ if (err) {
+ errno = err;
+ FatalError("xf86MapVidMem() can't get_privileged_ports. (%s)\n",
+ strerror(errno));
+ }
+ err = device_open(device, D_READ | D_WRITE, "mem", &mem_dev);
+ mach_port_deallocate(mach_task_self(), device);
+ if (err) {
+ errno = err;
+ FatalError("xf86MapVidMem() can't device_open. (%s)\n",
+ strerror(errno));
+ }
+
+ err =
+ device_map(mem_dev, VM_PROT_READ | VM_PROT_WRITE, Base, Size, &mem_obj,
+ 0);
+ if (err) {
+ errno = err;
+ FatalError("xf86MapVidMem() can't device_map. (%s)\n", strerror(errno));
+ }
+ err = vm_map(mach_task_self(), &addr, Size, 0, /* mask */
+ TRUE, /* anywhere */
+ mem_obj, (vm_offset_t) Base, FALSE, /* copy on write */
+ VM_PROT_READ | VM_PROT_WRITE,
+ VM_PROT_READ | VM_PROT_WRITE, VM_INHERIT_SHARE);
+ mach_port_deallocate(mach_task_self(), mem_obj);
+ if (err) {
+ errno = err;
+ FatalError("xf86MapVidMem() can't vm_map.(mem_obj) (%s)\n",
+ strerror(errno));
+ }
+ mach_port_deallocate(mach_task_self(), mem_dev);
+ if (err) {
+ errno = err;
+ FatalError
+ ("xf86MapVidMem() can't mach_port_deallocate.(mem_dev) (%s)\n",
+ strerror(errno));
+ }
+ return (pointer) addr;
+}
+
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ kern_return_t err = vm_deallocate(mach_task_self(), (int) Base, Size);
+
+ if (err) {
+ errno = err;
+ ErrorF("xf86UnMapVidMem: can't dealloc framebuffer space (%s)\n",
+ strerror(errno));
+ }
+ return;
+}
+
+/**************************************************************************
+ * I/O Permissions section
+ ***************************************************************************/
+
+/*
+ * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
+ * this.
+ */
+extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on);
+
+Bool
+xf86EnableIO()
+{
+ if (ioperm(0, 0x10000, 1)) {
+ FatalError("xf86EnableIO: ioperm() failed (%s)\n", strerror(errno));
+ return FALSE;
+ }
+#if 0
+ /*
+ * Trapping disabled for now, as some VBIOSes (mga-g450 notably) use these
+ * ports, and the int10 wrapper is not emulating them. (Note that it's
+ * effectively what happens in the Linux variant too, as iopl() is used
+ * there, making the ioperm() meaningless.)
+ *
+ * Reenable this when int10 gets fixed. */
+ ioperm(0x40, 4, 0); /* trap access to the timer chip */
+ ioperm(0x60, 4, 0); /* trap access to the keyboard controller */
+#endif
+ return TRUE;
+}
+
+void
+xf86DisableIO()
+{
+ ioperm(0, 0x10000, 0);
+ return;
+}
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ pVidMem->linearSupported = TRUE;
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+ pVidMem->initialised = TRUE;
+}
diff --git a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
index 564447ff6..fa58a72b6 100644
--- a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
+++ b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
@@ -50,10 +50,10 @@ int10MemRec linuxMem = {
typedef struct {
int lowMem;
int highMem;
- char* base;
- char* base_high;
+ char *base;
+ char *base_high;
int screen;
- char* alloc;
+ char *alloc;
} linuxInt10Priv;
#if defined DoSubModules
@@ -69,7 +69,7 @@ static Int10LinuxSubModuleState loadedSubModule = INT10_NOT_LOADED;
static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn);
-#endif /* DoSubModules */
+#endif /* DoSubModules */
xf86Int10InfoPtr
xf86ExtendedInitInt10(int entityIndex, int Flags)
@@ -77,152 +77,155 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
xf86Int10InfoPtr pInt = NULL;
int screen;
int fd;
- static void* vidMem = NULL;
- static void* sysMem = NULL;
- void* vMem = NULL;
+ static void *vidMem = NULL;
+ static void *sysMem = NULL;
+ void *vMem = NULL;
void *options = NULL;
int low_mem;
int high_mem = -1;
char *base = SHMERRORPTR;
char *base_high = SHMERRORPTR;
- int pagesize;
+ int pagesize;
memType cs;
legacyVGARec vga;
Bool videoBiosMapped = FALSE;
-
+
if (int10Generation != serverGeneration) {
- counter = 0;
- int10Generation = serverGeneration;
+ counter = 0;
+ int10Generation = serverGeneration;
}
screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
- options = xf86HandleInt10Options(xf86Screens[screen],entityIndex);
+ options = xf86HandleInt10Options(xf86Screens[screen], entityIndex);
if (int10skip(options)) {
- free(options);
- return NULL;
+ free(options);
+ return NULL;
}
#if defined DoSubModules
- if (loadedSubModule == INT10_NOT_LOADED)
- loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]);
+ if (loadedSubModule == INT10_NOT_LOADED)
+ loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]);
if (loadedSubModule == INT10_LOAD_FAILED)
- return NULL;
+ return NULL;
#endif
if ((!vidMem) || (!sysMem)) {
- if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
- if (!sysMem) {
- DebugF("Mapping sys bios area\n");
- if ((sysMem = mmap((void *)(SYS_BIOS), BIOS_SIZE,
- PROT_READ | PROT_EXEC,
- MAP_SHARED | MAP_FIXED, fd, SYS_BIOS))
- == MAP_FAILED) {
- xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n");
- close(fd);
- goto error0;
- }
- }
- if (!vidMem) {
- DebugF("Mapping VRAM area\n");
- if ((vidMem = mmap((void *)(V_RAM), VRAM_SIZE,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_SHARED | MAP_FIXED, fd, V_RAM))
- == MAP_FAILED) {
- xf86DrvMsg(screen, X_ERROR, "Cannot map V_RAM\n");
- close(fd);
- goto error0;
- }
- }
- close(fd);
- } else {
- xf86DrvMsg(screen, X_ERROR, "Cannot open %s\n", DEV_MEM);
- goto error0;
- }
+ if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
+ if (!sysMem) {
+ DebugF("Mapping sys bios area\n");
+ if ((sysMem = mmap((void *) (SYS_BIOS), BIOS_SIZE,
+ PROT_READ | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, SYS_BIOS))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n");
+ close(fd);
+ goto error0;
+ }
+ }
+ if (!vidMem) {
+ DebugF("Mapping VRAM area\n");
+ if ((vidMem = mmap((void *) (V_RAM), VRAM_SIZE,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, V_RAM))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot map V_RAM\n");
+ close(fd);
+ goto error0;
+ }
+ }
+ close(fd);
+ }
+ else {
+ xf86DrvMsg(screen, X_ERROR, "Cannot open %s\n", DEV_MEM);
+ goto error0;
+ }
}
- pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec));
+ pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec));
pInt->scrnIndex = screen;
pInt->entityIndex = entityIndex;
pInt->dev = xf86GetPciInfoForEntity(entityIndex);
if (!xf86Int10ExecSetup(pInt))
- goto error0;
+ goto error0;
pInt->mem = &linuxMem;
pagesize = getpagesize();
- pInt->private = (pointer)xnfcalloc(1, sizeof(linuxInt10Priv));
- ((linuxInt10Priv*)pInt->private)->screen = screen;
- ((linuxInt10Priv*)pInt->private)->alloc =
- (pointer)xnfcalloc(1, ALLOC_ENTRIES(pagesize));
+ pInt->private = (pointer) xnfcalloc(1, sizeof(linuxInt10Priv));
+ ((linuxInt10Priv *) pInt->private)->screen = screen;
+ ((linuxInt10Priv *) pInt->private)->alloc =
+ (pointer) xnfcalloc(1, ALLOC_ENTRIES(pagesize));
if (!xf86IsEntityPrimary(entityIndex)) {
- DebugF("Mapping high memory area\n");
- if ((high_mem = shmget(counter++, HIGH_MEM_SIZE,
- IPC_CREAT | SHM_R | SHM_W)) == -1) {
- if (errno == ENOSYS)
- xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure"
- " your kernel to include System V IPC support\n");
- else
- xf86DrvMsg(screen, X_ERROR,
- "shmget(highmem) error: %s\n",strerror(errno));
- goto error1;
- }
- } else {
- DebugF("Mapping Video BIOS\n");
- videoBiosMapped = TRUE;
- if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
- if ((vMem = mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_SHARED | MAP_FIXED, fd, V_BIOS))
- == MAP_FAILED) {
- xf86DrvMsg(screen, X_ERROR, "Cannot map V_BIOS\n");
- close(fd);
- goto error1;
- }
- close (fd);
- } else
- goto error1;
+ DebugF("Mapping high memory area\n");
+ if ((high_mem = shmget(counter++, HIGH_MEM_SIZE,
+ IPC_CREAT | SHM_R | SHM_W)) == -1) {
+ if (errno == ENOSYS)
+ xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure"
+ " your kernel to include System V IPC support\n");
+ else
+ xf86DrvMsg(screen, X_ERROR,
+ "shmget(highmem) error: %s\n", strerror(errno));
+ goto error1;
+ }
+ }
+ else {
+ DebugF("Mapping Video BIOS\n");
+ videoBiosMapped = TRUE;
+ if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
+ if ((vMem = mmap((void *) (V_BIOS), SYS_BIOS - V_BIOS,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, V_BIOS))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot map V_BIOS\n");
+ close(fd);
+ goto error1;
+ }
+ close(fd);
+ }
+ else
+ goto error1;
}
- ((linuxInt10Priv*)pInt->private)->highMem = high_mem;
-
+ ((linuxInt10Priv *) pInt->private)->highMem = high_mem;
+
DebugF("Mapping 640kB area\n");
- if ((low_mem = shmget(counter++, V_RAM,
- IPC_CREAT | SHM_R | SHM_W)) == -1) {
- xf86DrvMsg(screen, X_ERROR,
- "shmget(lowmem) error: %s\n",strerror(errno));
- goto error2;
+ if ((low_mem = shmget(counter++, V_RAM, IPC_CREAT | SHM_R | SHM_W)) == -1) {
+ xf86DrvMsg(screen, X_ERROR,
+ "shmget(lowmem) error: %s\n", strerror(errno));
+ goto error2;
}
- ((linuxInt10Priv*)pInt->private)->lowMem = low_mem;
+ ((linuxInt10Priv *) pInt->private)->lowMem = low_mem;
base = shmat(low_mem, 0, 0);
if (base == SHMERRORPTR) {
- xf86DrvMsg(screen, X_ERROR,
- "shmat(low_mem) error: %s\n",strerror(errno));
- goto error3;
+ xf86DrvMsg(screen, X_ERROR,
+ "shmat(low_mem) error: %s\n", strerror(errno));
+ goto error3;
}
- ((linuxInt10Priv *)pInt->private)->base = base;
+ ((linuxInt10Priv *) pInt->private)->base = base;
if (high_mem > -1) {
- base_high = shmat(high_mem, 0, 0);
- if (base_high == SHMERRORPTR) {
- xf86DrvMsg(screen, X_ERROR,
- "shmat(high_mem) error: %s\n",strerror(errno));
- goto error3;
- }
- ((linuxInt10Priv*)pInt->private)->base_high = base_high;
- } else
- ((linuxInt10Priv*)pInt->private)->base_high = NULL;
+ base_high = shmat(high_mem, 0, 0);
+ if (base_high == SHMERRORPTR) {
+ xf86DrvMsg(screen, X_ERROR,
+ "shmat(high_mem) error: %s\n", strerror(errno));
+ goto error3;
+ }
+ ((linuxInt10Priv *) pInt->private)->base_high = base_high;
+ }
+ else
+ ((linuxInt10Priv *) pInt->private)->base_high = NULL;
if (!MapCurrentInt10(pInt))
- goto error3;
-
+ goto error3;
+
Int10Current = pInt;
DebugF("Mapping int area\n");
- if (xf86ReadBIOS(0, 0, (unsigned char *)0, LOW_PAGE_SIZE) < 0) {
- xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
- goto error3;
+ if (xf86ReadBIOS(0, 0, (unsigned char *) 0, LOW_PAGE_SIZE) < 0) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
+ goto error3;
}
DebugF("done\n");
/*
@@ -231,57 +234,58 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
* 64K bytes at a time.
*/
if (!videoBiosMapped) {
- memset((pointer)V_BIOS, 0, SYS_BIOS - V_BIOS);
- DebugF("Reading BIOS\n");
- for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
- if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE)
- xf86DrvMsg(screen, X_WARNING,
- "Unable to retrieve all of segment 0x%06lX.\n",
- (long)cs);
- DebugF("done\n");
+ memset((pointer) V_BIOS, 0, SYS_BIOS - V_BIOS);
+ DebugF("Reading BIOS\n");
+ for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
+ if (xf86ReadBIOS(cs, 0, (pointer) cs, V_BIOS_SIZE) < V_BIOS_SIZE)
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x%06lX.\n",
+ (long) cs);
+ DebugF("done\n");
}
if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) {
- if (!xf86int10GetBiosSegment(pInt, NULL))
- goto error3;
-
- set_return_trap(pInt);
-#ifdef _PC
- pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
- if (! (pInt->Flags & SET_BIOS_SCRATCH))
- pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
- xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
+ if (!xf86int10GetBiosSegment(pInt, NULL))
+ goto error3;
+
+ set_return_trap(pInt);
+#ifdef _PC
+ pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
+ if (!(pInt->Flags & SET_BIOS_SCRATCH))
+ pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
+ xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
#endif
- } else {
- const BusType location_type = xf86int10GetBiosLocationType(pInt);
-
- switch (location_type) {
- case BUS_PCI: {
- int err;
- struct pci_device *rom_device =
- xf86GetPciInfoForEntity(pInt->entityIndex);
-
- pci_device_enable(rom_device);
- err = pci_device_read_rom(rom_device, (unsigned char *)(V_BIOS));
- if (err) {
- xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (%s)\n",
- strerror(err));
- goto error3;
- }
-
- pInt->BIOSseg = V_BIOS >> 4;
- break;
- }
- default:
- goto error3;
- }
-
- pInt->num = 0xe6;
- reset_int_vect(pInt);
- set_return_trap(pInt);
- LockLegacyVGA(pInt, &vga);
- xf86ExecX86int10(pInt);
- UnlockLegacyVGA(pInt, &vga);
+ }
+ else {
+ const BusType location_type = xf86int10GetBiosLocationType(pInt);
+
+ switch (location_type) {
+ case BUS_PCI:{
+ int err;
+ struct pci_device *rom_device =
+ xf86GetPciInfoForEntity(pInt->entityIndex);
+
+ pci_device_enable(rom_device);
+ err = pci_device_read_rom(rom_device, (unsigned char *) (V_BIOS));
+ if (err) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (%s)\n",
+ strerror(err));
+ goto error3;
+ }
+
+ pInt->BIOSseg = V_BIOS >> 4;
+ break;
+ }
+ default:
+ goto error3;
+ }
+
+ pInt->num = 0xe6;
+ reset_int_vect(pInt);
+ set_return_trap(pInt);
+ LockLegacyVGA(pInt, &vga);
+ xf86ExecX86int10(pInt);
+ UnlockLegacyVGA(pInt, &vga);
}
#ifdef DEBUG
dprint(0xc0000, 0x20);
@@ -290,24 +294,24 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
free(options);
return pInt;
-error3:
+ error3:
if (base_high)
- shmdt(base_high);
+ shmdt(base_high);
shmdt(base);
shmdt(0);
if (base_high)
- shmdt((char*)HIGH_MEM);
+ shmdt((char *) HIGH_MEM);
shmctl(low_mem, IPC_RMID, NULL);
Int10Current = NULL;
-error2:
+ error2:
if (high_mem > -1)
- shmctl(high_mem, IPC_RMID,NULL);
-error1:
+ shmctl(high_mem, IPC_RMID, NULL);
+ error1:
if (vMem)
- munmap(vMem, SYS_BIOS - V_BIOS);
- free(((linuxInt10Priv*)pInt->private)->alloc);
+ munmap(vMem, SYS_BIOS - V_BIOS);
+ free(((linuxInt10Priv *) pInt->private)->alloc);
free(pInt->private);
-error0:
+ error0:
free(options);
free(pInt);
return NULL;
@@ -318,57 +322,60 @@ MapCurrentInt10(xf86Int10InfoPtr pInt)
{
pointer addr;
int fd = -1;
-
+
if (Int10Current) {
- shmdt(0);
- if (((linuxInt10Priv*)Int10Current->private)->highMem >= 0)
- shmdt((char*)HIGH_MEM);
- else
- munmap((pointer)V_BIOS, (SYS_BIOS - V_BIOS));
+ shmdt(0);
+ if (((linuxInt10Priv *) Int10Current->private)->highMem >= 0)
+ shmdt((char *) HIGH_MEM);
+ else
+ munmap((pointer) V_BIOS, (SYS_BIOS - V_BIOS));
}
- addr = shmat(((linuxInt10Priv*)pInt->private)->lowMem, (char*)1, SHM_RND);
+ addr =
+ shmat(((linuxInt10Priv *) pInt->private)->lowMem, (char *) 1, SHM_RND);
if (addr == SHMERRORPTR) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n");
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "shmat(low_mem) error: %s\n",strerror(errno));
- return FALSE;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n");
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "shmat(low_mem) error: %s\n", strerror(errno));
+ return FALSE;
}
- if (mprotect((void*)0, V_RAM, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
+ if (mprotect((void *) 0, V_RAM, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "Cannot set EXEC bit on low memory: %s\n", strerror(errno));
-
- if (((linuxInt10Priv*)pInt->private)->highMem >= 0) {
- addr = shmat(((linuxInt10Priv*)pInt->private)->highMem,
- (char*)HIGH_MEM, 0);
- if (addr == SHMERRORPTR) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "Cannot shmat() high memory\n");
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "shmget error: %s\n",strerror(errno));
- return FALSE;
- }
- if (mprotect((void*)HIGH_MEM, HIGH_MEM_SIZE,
- PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "Cannot set EXEC bit on high memory: %s\n",
- strerror(errno));
- } else {
- if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
- if (mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_SHARED | MAP_FIXED, fd, V_BIOS)
- == MAP_FAILED) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot map V_BIOS\n");
- close (fd);
- return FALSE;
- }
- } else {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot open %s\n",DEV_MEM);
- return FALSE;
- }
- close (fd);
+ "Cannot set EXEC bit on low memory: %s\n", strerror(errno));
+
+ if (((linuxInt10Priv *) pInt->private)->highMem >= 0) {
+ addr = shmat(((linuxInt10Priv *) pInt->private)->highMem,
+ (char *) HIGH_MEM, 0);
+ if (addr == SHMERRORPTR) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Cannot shmat() high memory\n");
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "shmget error: %s\n", strerror(errno));
+ return FALSE;
+ }
+ if (mprotect((void *) HIGH_MEM, HIGH_MEM_SIZE,
+ PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Cannot set EXEC bit on high memory: %s\n",
+ strerror(errno));
}
-
+ else {
+ if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
+ if (mmap((void *) (V_BIOS), SYS_BIOS - V_BIOS,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, V_BIOS)
+ == MAP_FAILED) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot map V_BIOS\n");
+ close(fd);
+ return FALSE;
+ }
+ }
+ else {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot open %s\n", DEV_MEM);
+ return FALSE;
+ }
+ close(fd);
+ }
+
return TRUE;
}
@@ -376,27 +383,27 @@ void
xf86FreeInt10(xf86Int10InfoPtr pInt)
{
if (!pInt)
- return;
+ return;
#ifdef _PC
- xf86Int10SaveRestoreBIOSVars(pInt, FALSE);
+ xf86Int10SaveRestoreBIOSVars(pInt, FALSE);
#endif
if (Int10Current == pInt) {
- shmdt(0);
- if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
- shmdt((char*)HIGH_MEM);
- else
- munmap((pointer)V_BIOS, (SYS_BIOS - V_BIOS));
- Int10Current = NULL;
+ shmdt(0);
+ if (((linuxInt10Priv *) pInt->private)->highMem >= 0)
+ shmdt((char *) HIGH_MEM);
+ else
+ munmap((pointer) V_BIOS, (SYS_BIOS - V_BIOS));
+ Int10Current = NULL;
}
-
- if (((linuxInt10Priv*)pInt->private)->base_high)
- shmdt(((linuxInt10Priv*)pInt->private)->base_high);
- shmdt(((linuxInt10Priv*)pInt->private)->base);
- shmctl(((linuxInt10Priv*)pInt->private)->lowMem, IPC_RMID, NULL);
- if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
- shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL);
- free(((linuxInt10Priv*)pInt->private)->alloc);
+
+ if (((linuxInt10Priv *) pInt->private)->base_high)
+ shmdt(((linuxInt10Priv *) pInt->private)->base_high);
+ shmdt(((linuxInt10Priv *) pInt->private)->base);
+ shmctl(((linuxInt10Priv *) pInt->private)->lowMem, IPC_RMID, NULL);
+ if (((linuxInt10Priv *) pInt->private)->highMem >= 0)
+ shmctl(((linuxInt10Priv *) pInt->private)->highMem, IPC_RMID, NULL);
+ free(((linuxInt10Priv *) pInt->private)->alloc);
free(pInt->private);
free(pInt);
}
@@ -409,91 +416,93 @@ xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off)
int i, j;
for (i = 0; i < (num_pages - num); i++) {
- if (((linuxInt10Priv*)pInt->private)->alloc[i] == 0) {
- for (j = i; j < (num + i); j++)
- if ((((linuxInt10Priv*)pInt->private)->alloc[j] != 0))
- break;
- if (j == (num + i))
- break;
- else
- i = i + num;
- }
+ if (((linuxInt10Priv *) pInt->private)->alloc[i] == 0) {
+ for (j = i; j < (num + i); j++)
+ if ((((linuxInt10Priv *) pInt->private)->alloc[j] != 0))
+ break;
+ if (j == (num + i))
+ break;
+ else
+ i = i + num;
+ }
}
if (i == (num_pages - num))
- return NULL;
+ return NULL;
for (j = i; j < (i + num); j++)
- ((linuxInt10Priv*)pInt->private)->alloc[j] = 1;
+ ((linuxInt10Priv *) pInt->private)->alloc[j] = 1;
*off = (i + 1) * pagesize;
- return ((linuxInt10Priv*)pInt->private)->base + ((i + 1) * pagesize);
+ return ((linuxInt10Priv *) pInt->private)->base + ((i + 1) * pagesize);
}
void
xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
{
int pagesize = getpagesize();
- int first = (((unsigned long)pbase
- - (unsigned long)((linuxInt10Priv*)pInt->private)->base)
- / pagesize) - 1;
+ int first = (((unsigned long) pbase
+ - (unsigned long) ((linuxInt10Priv *) pInt->private)->base)
+ / pagesize) - 1;
int i;
for (i = first; i < (first + num); i++)
- ((linuxInt10Priv*)pInt->private)->alloc[i] = 0;
+ ((linuxInt10Priv *) pInt->private)->alloc[i] = 0;
}
static CARD8
read_b(xf86Int10InfoPtr pInt, int addr)
{
- return *((CARD8 *)(memType)addr);
+ return *((CARD8 *) (memType) addr);
}
static CARD16
read_w(xf86Int10InfoPtr pInt, int addr)
{
- return *((CARD16 *)(memType)addr);
+ return *((CARD16 *) (memType) addr);
}
static CARD32
read_l(xf86Int10InfoPtr pInt, int addr)
{
- return *((CARD32 *)(memType)addr);
+ return *((CARD32 *) (memType) addr);
}
static void
write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val)
{
- *((CARD8 *)(memType)addr) = val;
+ *((CARD8 *) (memType) addr) = val;
}
static void
write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
{
- *((CARD16 *)(memType)addr) = val;
+ *((CARD16 *) (memType) addr) = val;
}
static
-void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
+ void
+write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
{
- *((CARD32 *)(memType) addr) = val;
+ *((CARD32 *) (memType) addr) = val;
}
pointer
xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
{
if (addr < V_RAM)
- return ((linuxInt10Priv*)pInt->private)->base + addr;
+ return ((linuxInt10Priv *) pInt->private)->base + addr;
else if (addr < V_BIOS)
- return (pointer)(memType)addr;
+ return (pointer) (memType) addr;
else if (addr < SYS_BIOS) {
- if (((linuxInt10Priv*)pInt->private)->base_high)
- return (pointer)(((linuxInt10Priv*)pInt->private)->base_high
- - V_BIOS + addr);
- else
- return (pointer) (memType)addr;
- } else
- return (pointer) (memType)addr;
+ if (((linuxInt10Priv *) pInt->private)->base_high)
+ return (pointer) (((linuxInt10Priv *) pInt->private)->base_high
+ - V_BIOS + addr);
+ else
+ return (pointer) (memType) addr;
+ }
+ else
+ return (pointer) (memType) addr;
}
#if defined DoSubModules
@@ -507,20 +516,17 @@ vm86_tst(void)
/* When compiling with -fPIC, we can't use asm constraint "b" because
%ebx is already taken by gcc. */
__asm__ __volatile__("pushl %%ebx\n\t"
- "movl %2,%%ebx\n\t"
- "movl %1,%%eax\n\t"
- "int $0x80\n\t"
- "popl %%ebx"
- :"=a" (__res)
- :"n" ((int)113), "r" (NULL));
+ "movl %2,%%ebx\n\t"
+ "movl %1,%%eax\n\t"
+ "int $0x80\n\t" "popl %%ebx":"=a"(__res)
+ :"n"((int) 113), "r"(NULL));
#else
- __asm__ __volatile__("int $0x80\n\t"
- :"=a" (__res):"a" ((int)113),
- "b" ((struct vm86_struct *)NULL));
+ __asm__ __volatile__("int $0x80\n\t":"=a"(__res):"a"((int) 113),
+ "b"((struct vm86_struct *) NULL));
#endif
- if (__res < 0 && __res == -ENOSYS)
- return FALSE;
+ if (__res < 0 && __res == -ENOSYS)
+ return FALSE;
return TRUE;
}
@@ -529,13 +535,13 @@ static Int10LinuxSubModuleState
int10LinuxLoadSubModule(ScrnInfoPtr pScrn)
{
if (vm86_tst()) {
- if (xf86LoadSubModule(pScrn,"vm86"))
- return INT10_LOADED_VM86;
- }
- if (xf86LoadSubModule(pScrn,"x86emu"))
- return INT10_LOADED_X86EMU;
+ if (xf86LoadSubModule(pScrn, "vm86"))
+ return INT10_LOADED_VM86;
+ }
+ if (xf86LoadSubModule(pScrn, "x86emu"))
+ return INT10_LOADED_X86EMU;
return INT10_LOAD_FAILED;
}
-#endif /* DoSubModules */
+#endif /* DoSubModules */
diff --git a/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c b/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
index 34afd9502..8502b21b7 100644
--- a/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
+++ b/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
@@ -25,7 +25,7 @@ xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
{
#define VM86S ((struct vm86_struct *)pInt->cpuRegs)
- pInt->cpuRegs = &vm86_s;
+ pInt->cpuRegs = &vm86_s;
VM86S->flags = 0;
VM86S->screen_bitmap = 0;
VM86S->cpu_type = CPU_586;
@@ -58,137 +58,172 @@ vm86_GP_fault(xf86Int10InfoPtr pInt)
/* eat up prefixes */
done = 0;
do {
- switch (MEM_RB(pInt, (int)csp++)) {
- case 0x66: /* operand prefix */ prefix66=1; break;
- case 0x67: /* address prefix */ prefix67=1; break;
- case 0x2e: /* CS */ pref_seg=X86_CS; break;
- case 0x3e: /* DS */ pref_seg=X86_DS; break;
- case 0x26: /* ES */ pref_seg=X86_ES; break;
- case 0x36: /* SS */ pref_seg=X86_SS; break;
- case 0x65: /* GS */ pref_seg=X86_GS; break;
- case 0x64: /* FS */ pref_seg=X86_FS; break;
- case 0xf0: /* lock */ break;
- case 0xf2: /* repnz */
- case 0xf3: /* rep */ is_rep=1; break;
- default: done=1;
- }
+ switch (MEM_RB(pInt, (int) csp++)) {
+ case 0x66: /* operand prefix */
+ prefix66 = 1;
+ break;
+ case 0x67: /* address prefix */
+ prefix67 = 1;
+ break;
+ case 0x2e: /* CS */
+ pref_seg = X86_CS;
+ break;
+ case 0x3e: /* DS */
+ pref_seg = X86_DS;
+ break;
+ case 0x26: /* ES */
+ pref_seg = X86_ES;
+ break;
+ case 0x36: /* SS */
+ pref_seg = X86_SS;
+ break;
+ case 0x65: /* GS */
+ pref_seg = X86_GS;
+ break;
+ case 0x64: /* FS */
+ pref_seg = X86_FS;
+ break;
+ case 0xf0: /* lock */
+ break;
+ case 0xf2: /* repnz */
+ case 0xf3: /* rep */
+ is_rep = 1;
+ break;
+ default:
+ done = 1;
+ }
} while (!done);
- csp--; /* oops one too many */
+ csp--; /* oops one too many */
org_eip = X86_EIP;
X86_IP += (csp - lina);
- switch (MEM_RB(pInt, (int)csp)) {
- case 0x6c: /* insb */
- /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
- * but is anyone using extended regs in real mode? */
- /* WARNING: no test for DI wrapping! */
- X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI),
- X86_FLAGS & DF, is_rep ? LWECX : 1);
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0x6d: /* (rep) insw / insd */
- /* NOTE: ES can't be overwritten */
- /* WARNING: no test for _DI wrapping! */
- if (prefix66) {
- X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
- X86_EFLAGS & DF, is_rep ? LWECX : 1);
- }
- else {
- X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
- X86_FLAGS & DF, is_rep ? LWECX : 1);
- }
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0x6e: /* (rep) outsb */
- if (pref_seg < 0) pref_seg = X86_DS;
- /* WARNING: no test for _SI wrapping! */
- X86_SI += port_rep_outb(pInt, X86_DX, (CARD32)LIN_PREF_SI,
- X86_FLAGS & DF, is_rep ? LWECX : 1);
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0x6f: /* (rep) outsw / outsd */
- if (pref_seg < 0) pref_seg = X86_DS;
- /* WARNING: no test for _SI wrapping! */
- if (prefix66) {
- X86_SI += port_rep_outl(pInt, X86_DX, (CARD32)LIN_PREF_SI,
- X86_EFLAGS & DF, is_rep ? LWECX : 1);
- }
- else {
- X86_SI += port_rep_outw(pInt, X86_DX, (CARD32)LIN_PREF_SI,
- X86_FLAGS & DF, is_rep ? LWECX : 1);
- }
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0xe5: /* inw xx, inl xx */
- if (prefix66) X86_EAX = x_inl(csp[1]);
- else X86_AX = x_inw(csp[1]);
- X86_IP += 2;
- break;
-
- case 0xe4: /* inb xx */
- X86_AL = x_inb(csp[1]);
- X86_IP += 2;
- break;
-
- case 0xed: /* inw dx, inl dx */
- if (prefix66) X86_EAX = x_inl(X86_DX);
- else X86_AX = x_inw(X86_DX);
- X86_IP += 1;
- break;
-
- case 0xec: /* inb dx */
- X86_AL = x_inb(X86_DX);
- X86_IP += 1;
- break;
-
- case 0xe7: /* outw xx */
- if (prefix66) x_outl(csp[1], X86_EAX);
- else x_outw(csp[1], X86_AX);
- X86_IP += 2;
- break;
-
- case 0xe6: /* outb xx */
- x_outb(csp[1], X86_AL);
- X86_IP += 2;
- break;
-
- case 0xef: /* outw dx */
- if (prefix66) x_outl(X86_DX, X86_EAX);
- else x_outw(X86_DX, X86_AX);
- X86_IP += 1;
- break;
-
- case 0xee: /* outb dx */
- x_outb(X86_DX, X86_AL);
- X86_IP += 1;
- break;
+ switch (MEM_RB(pInt, (int) csp)) {
+ case 0x6c: /* insb */
+ /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
+ * but is anyone using extended regs in real mode? */
+ /* WARNING: no test for DI wrapping! */
+ X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI),
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ if (is_rep)
+ LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0x6d: /* (rep) insw / insd */
+ /* NOTE: ES can't be overwritten */
+ /* WARNING: no test for _DI wrapping! */
+ if (prefix66) {
+ X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
+ X86_EFLAGS & DF, is_rep ? LWECX : 1);
+ }
+ else {
+ X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ }
+ if (is_rep)
+ LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0x6e: /* (rep) outsb */
+ if (pref_seg < 0)
+ pref_seg = X86_DS;
+ /* WARNING: no test for _SI wrapping! */
+ X86_SI += port_rep_outb(pInt, X86_DX, (CARD32) LIN_PREF_SI,
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ if (is_rep)
+ LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0x6f: /* (rep) outsw / outsd */
+ if (pref_seg < 0)
+ pref_seg = X86_DS;
+ /* WARNING: no test for _SI wrapping! */
+ if (prefix66) {
+ X86_SI += port_rep_outl(pInt, X86_DX, (CARD32) LIN_PREF_SI,
+ X86_EFLAGS & DF, is_rep ? LWECX : 1);
+ }
+ else {
+ X86_SI += port_rep_outw(pInt, X86_DX, (CARD32) LIN_PREF_SI,
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ }
+ if (is_rep)
+ LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0xe5: /* inw xx, inl xx */
+ if (prefix66)
+ X86_EAX = x_inl(csp[1]);
+ else
+ X86_AX = x_inw(csp[1]);
+ X86_IP += 2;
+ break;
+
+ case 0xe4: /* inb xx */
+ X86_AL = x_inb(csp[1]);
+ X86_IP += 2;
+ break;
+
+ case 0xed: /* inw dx, inl dx */
+ if (prefix66)
+ X86_EAX = x_inl(X86_DX);
+ else
+ X86_AX = x_inw(X86_DX);
+ X86_IP += 1;
+ break;
+
+ case 0xec: /* inb dx */
+ X86_AL = x_inb(X86_DX);
+ X86_IP += 1;
+ break;
+
+ case 0xe7: /* outw xx */
+ if (prefix66)
+ x_outl(csp[1], X86_EAX);
+ else
+ x_outw(csp[1], X86_AX);
+ X86_IP += 2;
+ break;
+
+ case 0xe6: /* outb xx */
+ x_outb(csp[1], X86_AL);
+ X86_IP += 2;
+ break;
+
+ case 0xef: /* outw dx */
+ if (prefix66)
+ x_outl(X86_DX, X86_EAX);
+ else
+ x_outw(X86_DX, X86_AX);
+ X86_IP += 1;
+ break;
+
+ case 0xee: /* outb dx */
+ x_outb(X86_DX, X86_AL);
+ X86_IP += 1;
+ break;
case 0xf4:
- DebugF("hlt at %p\n", lina);
- return FALSE;
+ DebugF("hlt at %p\n", lina);
+ return FALSE;
case 0x0f:
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS, X86_EIP);
- goto op0ferr;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS,
+ X86_EIP);
+ goto op0ferr;
default:
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n");
-
- op0ferr:
- dump_registers(pInt);
- stack_trace(pInt);
- dump_code(pInt);
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n");
- return FALSE;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n");
+
+ op0ferr:
+ dump_registers(pInt);
+ stack_trace(pInt);
+ dump_code(pInt);
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n");
+ return FALSE;
} /* end of switch() */
return TRUE;
}
@@ -203,51 +238,52 @@ do_vm86(xf86Int10InfoPtr pInt)
xf86InterceptSignals(NULL);
if (signo >= 0) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "vm86() syscall generated signal %d.\n", signo);
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
- return 0;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "vm86() syscall generated signal %d.\n", signo);
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
}
switch (VM86_TYPE(retval)) {
case VM86_UNKNOWN:
- if (!vm86_GP_fault(pInt)) return 0;
- break;
+ if (!vm86_GP_fault(pInt))
+ return 0;
+ break;
case VM86_STI:
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n");
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
- return 0;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n");
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
case VM86_INTx:
- pInt->num = VM86_ARG(retval);
- if (!int_handler(pInt)) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval));
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
- return 0;
- }
- /* I'm not sure yet what to do if we can handle ints */
- break;
+ pInt->num = VM86_ARG(retval);
+ if (!int_handler(pInt)) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval));
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
+ }
+ /* I'm not sure yet what to do if we can handle ints */
+ break;
case VM86_SIGNAL:
- return 1;
- /*
- * we used to warn here and bail out - but now the sigio stuff
- * always fires signals at us. So we just ignore them for now.
- */
- xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n");
- return 0;
+ return 1;
+ /*
+ * we used to warn here and bail out - but now the sigio stuff
+ * always fires signals at us. So we just ignore them for now.
+ */
+ xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n");
+ return 0;
default:
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n",
- VM86_ARG(retval), VM86_TYPE(retval));
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
- return 0;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n",
+ VM86_ARG(retval), VM86_TYPE(retval));
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
}
return 1;
@@ -259,7 +295,8 @@ xf86ExecX86int10(xf86Int10InfoPtr pInt)
int sig = setup_int(pInt);
if (int_handler(pInt))
- while(do_vm86(pInt)) {};
+ while (do_vm86(pInt)) {
+ };
finish_int(pInt, sig);
}
@@ -273,28 +310,25 @@ vm86_rep(struct vm86_struct *ptr)
/* When compiling with -fPIC, we can't use asm constraint "b" because
%ebx is already taken by gcc. */
__asm__ __volatile__("pushl %%ebx\n\t"
- "push %%gs\n\t"
- "movl %2,%%ebx\n\t"
- "movl %1,%%eax\n\t"
- "int $0x80\n\t"
- "pop %%gs\n\t"
- "popl %%ebx"
- :"=a" (__res)
- :"n" ((int)113), "r" ((struct vm86_struct *)ptr));
+ "push %%gs\n\t"
+ "movl %2,%%ebx\n\t"
+ "movl %1,%%eax\n\t"
+ "int $0x80\n\t" "pop %%gs\n\t" "popl %%ebx":"=a"(__res)
+ :"n"((int) 113), "r"((struct vm86_struct *) ptr));
#else
__asm__ __volatile__("push %%gs\n\t"
- "int $0x80\n\t"
- "pop %%gs"
- :"=a" (__res):"a" ((int)113),
- "b" ((struct vm86_struct *)ptr));
+ "int $0x80\n\t"
+ "pop %%gs":"=a"(__res):"a"((int) 113),
+ "b"((struct vm86_struct *) ptr));
#endif
- if (__res < 0) {
- errno = -__res;
- __res = -1;
- }
- else errno = 0;
- return __res;
+ if (__res < 0) {
+ errno = -__res;
+ __res = -1;
+ }
+ else
+ errno = 0;
+ return __res;
}
#endif
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c b/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c
index dcc878060..e1fa3f8a7 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c
@@ -1,374 +1,371 @@
-/*
- * Abstraction of the AGP GART interface.
- *
- * This version is for Linux and Free/Open/NetBSD.
- *
- * Copyright © 2000 VA Linux Systems, Inc.
- * Copyright © 2001 The XFree86 Project, Inc.
- */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86OSpriv.h"
-
-#if defined(linux)
-#include <asm/ioctl.h>
-#include <linux/agpgart.h>
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-#include <sys/ioctl.h>
-#include <sys/agpio.h>
-#endif
-
-#ifndef AGP_DEVICE
-#define AGP_DEVICE "/dev/agpgart"
-#endif
-/* AGP page size is independent of the host page size. */
-#ifndef AGP_PAGE_SIZE
-#define AGP_PAGE_SIZE 4096
-#endif
-#define AGPGART_MAJOR_VERSION 0
-#define AGPGART_MINOR_VERSION 99
-
-static int gartFd = -1;
-static int acquiredScreen = -1;
-static Bool initDone = FALSE;
-/*
- * Close /dev/agpgart. This frees all associated memory allocated during
- * this server generation.
- */
-Bool
-xf86GARTCloseScreen(int screenNum)
-{
- if(gartFd != -1) {
- close(gartFd);
- acquiredScreen = -1;
- gartFd = -1;
- initDone = FALSE;
- }
- return TRUE;
-}
-
-/*
- * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called.
- */
-static Bool
-GARTInit(int screenNum)
-{
- struct _agp_info agpinf;
-
- if (initDone)
- return gartFd != -1;
-
- initDone = TRUE;
-
- if (gartFd == -1)
- gartFd = open(AGP_DEVICE, O_RDWR, 0);
- else
- return FALSE;
-
- if (gartFd == -1) {
- xf86DrvMsg(screenNum, X_ERROR,
- "GARTInit: Unable to open " AGP_DEVICE " (%s)\n",
- strerror(errno));
- return FALSE;
- }
-
- xf86AcquireGART(-1);
- /* Check the kernel driver version. */
- if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
- xf86DrvMsg(screenNum, X_ERROR,
- "GARTInit: AGPIOC_INFO failed (%s)\n", strerror(errno));
- close(gartFd);
- gartFd = -1;
- return FALSE;
- }
- xf86ReleaseGART(-1);
-
-#if defined(linux)
- /* Per Dave Jones, every effort will be made to keep the
- * agpgart interface backwards compatible, so allow all
- * future versions.
- */
- if (
-#if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */
- agpinf.version.major < AGPGART_MAJOR_VERSION ||
-#endif
- (agpinf.version.major == AGPGART_MAJOR_VERSION &&
- agpinf.version.minor < AGPGART_MINOR_VERSION)) {
- xf86DrvMsg(screenNum, X_ERROR,
- "GARTInit: Kernel agpgart driver version is not current"
- " (%d.%d vs %d.%d)\n",
- agpinf.version.major, agpinf.version.minor,
- AGPGART_MAJOR_VERSION, AGPGART_MINOR_VERSION);
- close(gartFd);
- gartFd = -1;
- return FALSE;
- }
-#endif
-
- return TRUE;
-}
-
-Bool
-xf86AgpGARTSupported(void)
-{
- return GARTInit(-1);
-}
-
-AgpInfoPtr
-xf86GetAGPInfo(int screenNum)
-{
- struct _agp_info agpinf;
- AgpInfoPtr info;
-
- if (!GARTInit(screenNum))
- return NULL;
-
-
- if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) {
- xf86DrvMsg(screenNum, X_ERROR,
- "xf86GetAGPInfo: Failed to allocate AgpInfo\n");
- return NULL;
- }
-
- memset((char*)&agpinf, 0, sizeof(agpinf));
-
- if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
- xf86DrvMsg(screenNum, X_ERROR,
- "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n",
- strerror(errno));
- return NULL;
- }
-
- info->bridgeId = agpinf.bridge_id;
- info->agpMode = agpinf.agp_mode;
- info->base = agpinf.aper_base;
- info->size = agpinf.aper_size;
- info->totalPages = agpinf.pg_total;
- info->systemPages = agpinf.pg_system;
- info->usedPages = agpinf.pg_used;
-
- xf86DrvMsg(screenNum, X_INFO, "Kernel reported %zu total, %zu used\n", agpinf.pg_total, agpinf.pg_used);
-
- return info;
-}
-
-/*
- * XXX If multiple screens can acquire the GART, should we have a reference
- * count instead of using acquiredScreen?
- */
-
-Bool
-xf86AcquireGART(int screenNum)
-{
- if (screenNum != -1 && !GARTInit(screenNum))
- return FALSE;
-
- if (screenNum == -1 || acquiredScreen != screenNum) {
- if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) {
- xf86DrvMsg(screenNum, X_WARNING,
- "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n",
- strerror(errno));
- return FALSE;
- }
- acquiredScreen = screenNum;
- }
- return TRUE;
-}
-
-Bool
-xf86ReleaseGART(int screenNum)
-{
- if (screenNum != -1 && !GARTInit(screenNum))
- return FALSE;
-
- if (acquiredScreen == screenNum) {
- /*
- * The FreeBSD agp driver removes allocations on release.
- * The Linux driver doesn't. xf86ReleaseGART() is expected
- * to give up access to the GART, but not to remove any
- * allocations.
- */
-#if !defined(linux)
- if (screenNum == -1)
-#endif
- {
- if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) {
- xf86DrvMsg(screenNum, X_WARNING,
- "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n",
- strerror(errno));
- return FALSE;
- }
- acquiredScreen = -1;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-int
-xf86AllocateGARTMemory(int screenNum, unsigned long size, int type,
- unsigned long *physical)
-{
- struct _agp_allocate alloc;
- int pages;
-
- /*
- * Allocates "size" bytes of GART memory (rounds up to the next
- * page multiple) or type "type". A handle (key) for the allocated
- * memory is returned. On error, the return value is -1.
- */
-
- if (!GARTInit(screenNum) || acquiredScreen != screenNum)
- return -1;
-
- pages = (size / AGP_PAGE_SIZE);
- if (size % AGP_PAGE_SIZE != 0)
- pages++;
-
- /* XXX check for pages == 0? */
-
- alloc.pg_count = pages;
- alloc.type = type;
-
- if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) {
- xf86DrvMsg(screenNum, X_WARNING, "xf86AllocateGARTMemory: "
- "allocation of %d pages failed\n\t(%s)\n", pages,
- strerror(errno));
- return -1;
- }
-
- if (physical)
- *physical = alloc.physical;
-
- return alloc.key;
-}
-
-Bool
-xf86DeallocateGARTMemory(int screenNum, int key)
-{
- if (!GARTInit(screenNum) || acquiredScreen != screenNum)
- return FALSE;
-
- if (acquiredScreen != screenNum) {
- xf86DrvMsg(screenNum, X_ERROR,
- "xf86UnbindGARTMemory: AGP not acquired by this screen\n");
- return FALSE;
- }
-
-#ifdef __linux__
- if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)(uintptr_t)key) != 0) {
-#else
- if (ioctl(gartFd, AGPIOC_DEALLOCATE, &key) != 0) {
-#endif
- xf86DrvMsg(screenNum, X_WARNING,"xf86DeAllocateGARTMemory: "
- "deallocation gart memory with key %d failed\n\t(%s)\n",
- key, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Bind GART memory with "key" at "offset" */
-Bool
-xf86BindGARTMemory(int screenNum, int key, unsigned long offset)
-{
- struct _agp_bind bind;
- int pageOffset;
-
- if (!GARTInit(screenNum) || acquiredScreen != screenNum)
- return FALSE;
-
- if (acquiredScreen != screenNum) {
- xf86DrvMsg(screenNum, X_ERROR,
- "xf86BindGARTMemory: AGP not acquired by this screen\n");
- return FALSE;
- }
-
- if (offset % AGP_PAGE_SIZE != 0) {
- xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
- "offset (0x%lx) is not page-aligned (%d)\n",
- offset, AGP_PAGE_SIZE);
- return FALSE;
- }
- pageOffset = offset / AGP_PAGE_SIZE;
-
- xf86DrvMsgVerb(screenNum, X_INFO, 3,
- "xf86BindGARTMemory: bind key %d at 0x%08lx "
- "(pgoffset %d)\n", key, offset, pageOffset);
-
- bind.pg_start = pageOffset;
- bind.key = key;
-
- if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) {
- xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
- "binding of gart memory with key %d\n"
- "\tat offset 0x%lx failed (%s)\n",
- key, offset, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/* Unbind GART memory with "key" */
-Bool
-xf86UnbindGARTMemory(int screenNum, int key)
-{
- struct _agp_unbind unbind;
-
- if (!GARTInit(screenNum) || acquiredScreen != screenNum)
- return FALSE;
-
- if (acquiredScreen != screenNum) {
- xf86DrvMsg(screenNum, X_ERROR,
- "xf86UnbindGARTMemory: AGP not acquired by this screen\n");
- return FALSE;
- }
-
- unbind.priority = 0;
- unbind.key = key;
-
- if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) {
- xf86DrvMsg(screenNum, X_WARNING, "xf86UnbindGARTMemory: "
- "unbinding of gart memory with key %d "
- "failed (%s)\n", key, strerror(errno));
- return FALSE;
- }
-
- xf86DrvMsgVerb(screenNum, X_INFO, 3,
- "xf86UnbindGARTMemory: unbind key %d\n", key);
-
- return TRUE;
-}
-
-
-/* XXX Interface may change. */
-Bool
-xf86EnableAGP(int screenNum, CARD32 mode)
-{
- agp_setup setup;
-
- if (!GARTInit(screenNum) || acquiredScreen != screenNum)
- return FALSE;
-
- setup.agp_mode = mode;
- if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) {
- xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: "
- "AGPIOC_SETUP with mode %ld failed (%s)\n",
- (unsigned long)mode, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
+/*
+ * Abstraction of the AGP GART interface.
+ *
+ * This version is for Linux and Free/Open/NetBSD.
+ *
+ * Copyright © 2000 VA Linux Systems, Inc.
+ * Copyright © 2001 The XFree86 Project, Inc.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#if defined(linux)
+#include <asm/ioctl.h>
+#include <linux/agpgart.h>
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#include <sys/ioctl.h>
+#include <sys/agpio.h>
+#endif
+
+#ifndef AGP_DEVICE
+#define AGP_DEVICE "/dev/agpgart"
+#endif
+/* AGP page size is independent of the host page size. */
+#ifndef AGP_PAGE_SIZE
+#define AGP_PAGE_SIZE 4096
+#endif
+#define AGPGART_MAJOR_VERSION 0
+#define AGPGART_MINOR_VERSION 99
+
+static int gartFd = -1;
+static int acquiredScreen = -1;
+static Bool initDone = FALSE;
+
+/*
+ * Close /dev/agpgart. This frees all associated memory allocated during
+ * this server generation.
+ */
+Bool
+xf86GARTCloseScreen(int screenNum)
+{
+ if (gartFd != -1) {
+ close(gartFd);
+ acquiredScreen = -1;
+ gartFd = -1;
+ initDone = FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called.
+ */
+static Bool
+GARTInit(int screenNum)
+{
+ struct _agp_info agpinf;
+
+ if (initDone)
+ return gartFd != -1;
+
+ initDone = TRUE;
+
+ if (gartFd == -1)
+ gartFd = open(AGP_DEVICE, O_RDWR, 0);
+ else
+ return FALSE;
+
+ if (gartFd == -1) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "GARTInit: Unable to open " AGP_DEVICE " (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+
+ xf86AcquireGART(-1);
+ /* Check the kernel driver version. */
+ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "GARTInit: AGPIOC_INFO failed (%s)\n", strerror(errno));
+ close(gartFd);
+ gartFd = -1;
+ return FALSE;
+ }
+ xf86ReleaseGART(-1);
+
+#if defined(linux)
+ /* Per Dave Jones, every effort will be made to keep the
+ * agpgart interface backwards compatible, so allow all
+ * future versions.
+ */
+ if (
+#if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */
+ agpinf.version.major < AGPGART_MAJOR_VERSION ||
+#endif
+ (agpinf.version.major == AGPGART_MAJOR_VERSION &&
+ agpinf.version.minor < AGPGART_MINOR_VERSION)) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "GARTInit: Kernel agpgart driver version is not current"
+ " (%d.%d vs %d.%d)\n",
+ agpinf.version.major, agpinf.version.minor,
+ AGPGART_MAJOR_VERSION, AGPGART_MINOR_VERSION);
+ close(gartFd);
+ gartFd = -1;
+ return FALSE;
+ }
+#endif
+
+ return TRUE;
+}
+
+Bool
+xf86AgpGARTSupported(void)
+{
+ return GARTInit(-1);
+}
+
+AgpInfoPtr
+xf86GetAGPInfo(int screenNum)
+{
+ struct _agp_info agpinf;
+ AgpInfoPtr info;
+
+ if (!GARTInit(screenNum))
+ return NULL;
+
+ if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86GetAGPInfo: Failed to allocate AgpInfo\n");
+ return NULL;
+ }
+
+ memset((char *) &agpinf, 0, sizeof(agpinf));
+
+ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n",
+ strerror(errno));
+ return NULL;
+ }
+
+ info->bridgeId = agpinf.bridge_id;
+ info->agpMode = agpinf.agp_mode;
+ info->base = agpinf.aper_base;
+ info->size = agpinf.aper_size;
+ info->totalPages = agpinf.pg_total;
+ info->systemPages = agpinf.pg_system;
+ info->usedPages = agpinf.pg_used;
+
+ xf86DrvMsg(screenNum, X_INFO, "Kernel reported %zu total, %zu used\n",
+ agpinf.pg_total, agpinf.pg_used);
+
+ return info;
+}
+
+/*
+ * XXX If multiple screens can acquire the GART, should we have a reference
+ * count instead of using acquiredScreen?
+ */
+
+Bool
+xf86AcquireGART(int screenNum)
+{
+ if (screenNum != -1 && !GARTInit(screenNum))
+ return FALSE;
+
+ if (screenNum == -1 || acquiredScreen != screenNum) {
+ if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+ acquiredScreen = screenNum;
+ }
+ return TRUE;
+}
+
+Bool
+xf86ReleaseGART(int screenNum)
+{
+ if (screenNum != -1 && !GARTInit(screenNum))
+ return FALSE;
+
+ if (acquiredScreen == screenNum) {
+ /*
+ * The FreeBSD agp driver removes allocations on release.
+ * The Linux driver doesn't. xf86ReleaseGART() is expected
+ * to give up access to the GART, but not to remove any
+ * allocations.
+ */
+#if !defined(linux)
+ if (screenNum == -1)
+#endif
+ {
+ if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+ acquiredScreen = -1;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int
+xf86AllocateGARTMemory(int screenNum, unsigned long size, int type,
+ unsigned long *physical)
+{
+ struct _agp_allocate alloc;
+ int pages;
+
+ /*
+ * Allocates "size" bytes of GART memory (rounds up to the next
+ * page multiple) or type "type". A handle (key) for the allocated
+ * memory is returned. On error, the return value is -1.
+ */
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return -1;
+
+ pages = (size / AGP_PAGE_SIZE);
+ if (size % AGP_PAGE_SIZE != 0)
+ pages++;
+
+ /* XXX check for pages == 0? */
+
+ alloc.pg_count = pages;
+ alloc.type = type;
+
+ if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86AllocateGARTMemory: "
+ "allocation of %d pages failed\n\t(%s)\n", pages,
+ strerror(errno));
+ return -1;
+ }
+
+ if (physical)
+ *physical = alloc.physical;
+
+ return alloc.key;
+}
+
+Bool
+xf86DeallocateGARTMemory(int screenNum, int key)
+{
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86UnbindGARTMemory: AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+#ifdef __linux__
+ if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *) (uintptr_t) key) != 0) {
+#else
+ if (ioctl(gartFd, AGPIOC_DEALLOCATE, &key) != 0) {
+#endif
+ xf86DrvMsg(screenNum, X_WARNING, "xf86DeAllocateGARTMemory: "
+ "deallocation gart memory with key %d failed\n\t(%s)\n",
+ key, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Bind GART memory with "key" at "offset" */
+Bool
+xf86BindGARTMemory(int screenNum, int key, unsigned long offset)
+{
+ struct _agp_bind bind;
+ int pageOffset;
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86BindGARTMemory: AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+ if (offset % AGP_PAGE_SIZE != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
+ "offset (0x%lx) is not page-aligned (%d)\n",
+ offset, AGP_PAGE_SIZE);
+ return FALSE;
+ }
+ pageOffset = offset / AGP_PAGE_SIZE;
+
+ xf86DrvMsgVerb(screenNum, X_INFO, 3,
+ "xf86BindGARTMemory: bind key %d at 0x%08lx "
+ "(pgoffset %d)\n", key, offset, pageOffset);
+
+ bind.pg_start = pageOffset;
+ bind.key = key;
+
+ if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
+ "binding of gart memory with key %d\n"
+ "\tat offset 0x%lx failed (%s)\n",
+ key, offset, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Unbind GART memory with "key" */
+Bool
+xf86UnbindGARTMemory(int screenNum, int key)
+{
+ struct _agp_unbind unbind;
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86UnbindGARTMemory: AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+ unbind.priority = 0;
+ unbind.key = key;
+
+ if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86UnbindGARTMemory: "
+ "unbinding of gart memory with key %d "
+ "failed (%s)\n", key, strerror(errno));
+ return FALSE;
+ }
+
+ xf86DrvMsgVerb(screenNum, X_INFO, 3,
+ "xf86UnbindGARTMemory: unbind key %d\n", key);
+
+ return TRUE;
+}
+
+/* XXX Interface may change. */
+Bool
+xf86EnableAGP(int screenNum, CARD32 mode)
+{
+ agp_setup setup;
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ setup.agp_mode = mode;
+ if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: "
+ "AGPIOC_SETUP with mode %ld failed (%s)\n",
+ (unsigned long) mode, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c b/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c
index 54c698965..a37331e52 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c
@@ -23,15 +23,15 @@ extern PMClose lnxACPIOpen(void);
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
-
+
#define APM_PROC "/proc/apm"
#define APM_DEVICE "/dev/apm_bios"
#ifndef APM_STANDBY_FAILED
-# define APM_STANDBY_FAILED 0xf000
+#define APM_STANDBY_FAILED 0xf000
#endif
#ifndef APM_SUSPEND_FAILED
-# define APM_SUSPEND_FAILED 0xf001
+#define APM_SUSPEND_FAILED 0xf001
#endif
static PMClose lnxAPMOpen(void);
@@ -42,23 +42,26 @@ static struct {
apm_event_t apmLinux;
pmEvent xf86;
} LinuxToXF86[] = {
- { APM_SYS_STANDBY, XF86_APM_SYS_STANDBY },
- { APM_SYS_SUSPEND, XF86_APM_SYS_SUSPEND },
- { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
- { APM_CRITICAL_RESUME, XF86_APM_CRITICAL_RESUME },
- { APM_LOW_BATTERY, XF86_APM_LOW_BATTERY },
- { APM_POWER_STATUS_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
- { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
- { APM_CRITICAL_SUSPEND, XF86_APM_CRITICAL_SUSPEND },
- { APM_USER_STANDBY, XF86_APM_USER_STANDBY },
- { APM_USER_SUSPEND, XF86_APM_USER_SUSPEND },
- { APM_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+ {
+ APM_SYS_STANDBY, XF86_APM_SYS_STANDBY}, {
+ APM_SYS_SUSPEND, XF86_APM_SYS_SUSPEND}, {
+ APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {
+ APM_CRITICAL_RESUME, XF86_APM_CRITICAL_RESUME}, {
+ APM_LOW_BATTERY, XF86_APM_LOW_BATTERY}, {
+ APM_POWER_STATUS_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {
+ APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {
+ APM_CRITICAL_SUSPEND, XF86_APM_CRITICAL_SUSPEND}, {
+ APM_USER_STANDBY, XF86_APM_USER_STANDBY}, {
+ APM_USER_SUSPEND, XF86_APM_USER_SUSPEND}, {
+ APM_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
#if defined(APM_CAPABILITY_CHANGED)
- { APM_CAPABILITY_CHANGED, XF86_CAPABILITY_CHANGED },
+ {
+ APM_CAPABILITY_CHANGED, XF86_CAPABILITY_CHANGED},
#endif
#if 0
- { APM_STANDBY_FAILED, XF86_APM_STANDBY_FAILED },
- { APM_SUSPEND_FAILED, XF86_APM_SUSPEND_FAILED }
+ {
+ APM_STANDBY_FAILED, XF86_APM_STANDBY_FAILED}, {
+ APM_SUSPEND_FAILED, XF86_APM_SUSPEND_FAILED}
#endif
};
@@ -73,24 +76,24 @@ static struct {
* event is reasonable.
*/
static int
-lnxPMGetEventFromOs(int fd, pmEvent *events, int num)
+lnxPMGetEventFromOs(int fd, pmEvent * events, int num)
{
- int i,j,n;
+ int i, j, n;
apm_event_t linuxEvents[8];
- if ((n = read( fd, linuxEvents, num * sizeof(apm_event_t) )) == -1)
- return 0;
+ if ((n = read(fd, linuxEvents, num * sizeof(apm_event_t))) == -1)
+ return 0;
n /= sizeof(apm_event_t);
if (n > num)
- n = num;
+ n = num;
for (i = 0; i < n; i++) {
- for (j = 0; j < numApmEvents; j++)
- if (LinuxToXF86[j].apmLinux == linuxEvents[i]) {
- events[i] = LinuxToXF86[j].xf86;
- break;
- }
- if (j == numApmEvents)
- events[i] = XF86_APM_UNKNOWN;
+ for (j = 0; j < numApmEvents; j++)
+ if (LinuxToXF86[j].apmLinux == linuxEvents[i]) {
+ events[i] = LinuxToXF86[j].xf86;
+ break;
+ }
+ if (j == numApmEvents)
+ events[i] = XF86_APM_UNKNOWN;
}
return n;
}
@@ -101,55 +104,55 @@ lnxPMConfirmEventToOs(int fd, pmEvent event)
switch (event) {
case XF86_APM_SYS_STANDBY:
case XF86_APM_USER_STANDBY:
- if (ioctl( fd, APM_IOC_STANDBY, NULL ))
- return PM_FAILED;
- return PM_CONTINUE;
+ if (ioctl(fd, APM_IOC_STANDBY, NULL))
+ return PM_FAILED;
+ return PM_CONTINUE;
case XF86_APM_SYS_SUSPEND:
case XF86_APM_CRITICAL_SUSPEND:
case XF86_APM_USER_SUSPEND:
- if (ioctl( fd, APM_IOC_SUSPEND, NULL )) {
- /* I believe this is wrong (EE)
- EBUSY is sent when a device refuses to be suspended.
- In this case we still need to undo everything we have
- done to suspend ourselves or we will stay in suspended
- state forever. */
- if (errno == EBUSY)
- return PM_CONTINUE;
- else
- return PM_FAILED;
- }
- return PM_CONTINUE;
+ if (ioctl(fd, APM_IOC_SUSPEND, NULL)) {
+ /* I believe this is wrong (EE)
+ EBUSY is sent when a device refuses to be suspended.
+ In this case we still need to undo everything we have
+ done to suspend ourselves or we will stay in suspended
+ state forever. */
+ if (errno == EBUSY)
+ return PM_CONTINUE;
+ else
+ return PM_FAILED;
+ }
+ return PM_CONTINUE;
case XF86_APM_STANDBY_RESUME:
case XF86_APM_NORMAL_RESUME:
case XF86_APM_CRITICAL_RESUME:
case XF86_APM_STANDBY_FAILED:
case XF86_APM_SUSPEND_FAILED:
- return PM_CONTINUE;
+ return PM_CONTINUE;
default:
- return PM_NONE;
+ return PM_NONE;
}
}
-#endif // HAVE_APM
+#endif // HAVE_APM
PMClose
xf86OSPMOpen(void)
{
- PMClose ret = NULL;
+ PMClose ret = NULL;
#ifdef HAVE_ACPI
- /* Favour ACPI over APM, but only when enabled */
+ /* Favour ACPI over APM, but only when enabled */
- if (!xf86acpiDisableFlag)
- ret = lnxACPIOpen();
+ if (!xf86acpiDisableFlag)
+ ret = lnxACPIOpen();
- if (!ret)
+ if (!ret)
#endif
#ifdef HAVE_APM
- ret = lnxAPMOpen();
+ ret = lnxAPMOpen();
#endif
- return ret;
+ return ret;
}
#ifdef HAVE_APM
@@ -157,27 +160,27 @@ xf86OSPMOpen(void)
static PMClose
lnxAPMOpen(void)
{
- int fd, pfd;
+ int fd, pfd;
DebugF("APM: OSPMOpen called\n");
if (APMihPtr || !xf86Info.pmFlag)
- return NULL;
-
+ return NULL;
+
DebugF("APM: Opening device\n");
- if ((fd = open( APM_DEVICE, O_RDWR )) > -1) {
- if (access( APM_PROC, R_OK ) ||
- ((pfd = open( APM_PROC, O_RDONLY)) == -1)) {
- xf86MsgVerb(X_WARNING,3,"Cannot open APM (%s) (%s)\n",
- APM_PROC, strerror(errno));
- close(fd);
- return NULL;
- } else
- close(pfd);
- xf86PMGetEventFromOs = lnxPMGetEventFromOs;
- xf86PMConfirmEventToOs = lnxPMConfirmEventToOs;
- APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
- xf86MsgVerb(X_INFO,3,"Open APM successful\n");
- return lnxCloseAPM;
+ if ((fd = open(APM_DEVICE, O_RDWR)) > -1) {
+ if (access(APM_PROC, R_OK) || ((pfd = open(APM_PROC, O_RDONLY)) == -1)) {
+ xf86MsgVerb(X_WARNING, 3, "Cannot open APM (%s) (%s)\n",
+ APM_PROC, strerror(errno));
+ close(fd);
+ return NULL;
+ }
+ else
+ close(pfd);
+ xf86PMGetEventFromOs = lnxPMGetEventFromOs;
+ xf86PMConfirmEventToOs = lnxPMConfirmEventToOs;
+ APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
+ xf86MsgVerb(X_INFO, 3, "Open APM successful\n");
+ return lnxCloseAPM;
}
return NULL;
}
@@ -189,10 +192,10 @@ lnxCloseAPM(void)
DebugF("APM: Closing device\n");
if (APMihPtr) {
- fd = xf86RemoveGeneralHandler(APMihPtr);
- close(fd);
- APMihPtr = NULL;
+ fd = xf86RemoveGeneralHandler(APMihPtr);
+ close(fd);
+ APMihPtr = NULL;
}
}
-#endif // HAVE_APM
+#endif // HAVE_APM
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c b/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
index 10fd9e865..d65a3a487 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
@@ -9,93 +9,95 @@
axpDevice lnxGetAXP(void);
-typedef struct
- { char* sysName;
- char* sysVari;
- char* cpu;
- axpDevice sys; }
-AXP;
+typedef struct {
+ char *sysName;
+ char *sysVari;
+ char *cpu;
+ axpDevice sys;
+} AXP;
static AXP axpList[] = {
- { "Tsunami", NULL, NULL, TSUNAMI },
- { "Eiger", NULL, NULL, TSUNAMI },
- {"Noname", NULL, NULL, LCA },
- { "AlphaBook1", NULL, NULL, LCA },
- {"EB66", NULL, NULL, LCA},
- {"EB64+",NULL,NULL, APECS},
- {"Noritake",NULL,"EV5",CIA},
- {"Noritake",NULL,"EV56",CIA},
- {"Noritake",NULL,NULL,APECS},
- {"XL",NULL,NULL,APECS},
- {"Avanti",NULL,NULL,APECS},
- {"Mikasa",NULL,"EV5",CIA},
- {"Mikasa",NULL,"EV56",CIA},
- {"Mikasa",NULL,NULL,APECS},
- {"EB164","EB164",NULL,CIA},
- {"EB164","PC164", NULL,CIA},
- {"EB164","LX164",NULL, PYXIS},
- {"EB164","SX164",NULL, PYXIS},
- {"EB164","RX164",NULL, POLARIS},
- {"Alcor",NULL,NULL,CIA},
- {"Takara",NULL,NULL,CIA},
- {"Sable",NULL, "EV5",T2_GAMMA},
- {"Sable",NULL,"EV56",T2_GAMMA},
- {"Sable",NULL,NULL,T2},
- {"Rawhide",NULL,NULL,MCPCIA},
- {"Jensen",NULL,NULL,JENSEN},
- {"Miata",NULL,NULL,PYXIS_CIA},
- {"Ruffian",NULL,NULL,PYXIS_CIA},
- {"Nautilus",NULL,NULL,IRONGATE},
- {NULL,NULL,NULL,SYS_NONE}
+ {"Tsunami", NULL, NULL, TSUNAMI},
+ {"Eiger", NULL, NULL, TSUNAMI},
+ {"Noname", NULL, NULL, LCA},
+ {"AlphaBook1", NULL, NULL, LCA},
+ {"EB66", NULL, NULL, LCA},
+ {"EB64+", NULL, NULL, APECS},
+ {"Noritake", NULL, "EV5", CIA},
+ {"Noritake", NULL, "EV56", CIA},
+ {"Noritake", NULL, NULL, APECS},
+ {"XL", NULL, NULL, APECS},
+ {"Avanti", NULL, NULL, APECS},
+ {"Mikasa", NULL, "EV5", CIA},
+ {"Mikasa", NULL, "EV56", CIA},
+ {"Mikasa", NULL, NULL, APECS},
+ {"EB164", "EB164", NULL, CIA},
+ {"EB164", "PC164", NULL, CIA},
+ {"EB164", "LX164", NULL, PYXIS},
+ {"EB164", "SX164", NULL, PYXIS},
+ {"EB164", "RX164", NULL, POLARIS},
+ {"Alcor", NULL, NULL, CIA},
+ {"Takara", NULL, NULL, CIA},
+ {"Sable", NULL, "EV5", T2_GAMMA},
+ {"Sable", NULL, "EV56", T2_GAMMA},
+ {"Sable", NULL, NULL, T2},
+ {"Rawhide", NULL, NULL, MCPCIA},
+ {"Jensen", NULL, NULL, JENSEN},
+ {"Miata", NULL, NULL, PYXIS_CIA},
+ {"Ruffian", NULL, NULL, PYXIS_CIA},
+ {"Nautilus", NULL, NULL, IRONGATE},
+ {NULL, NULL, NULL, SYS_NONE}
};
-
axpDevice
lnxGetAXP(void)
{
- FILE *file;
- int count = 0;
- char res[256];
- char cpu[255];
- char systype[255];
- char sysvari[255];
- if (!(file = fopen("/proc/cpuinfo","r")))
- return SYS_NONE;
- do {
- if (!fgets(res,0xff,file)) return SYS_NONE;
- switch (count) {
- case 1:
- sscanf(res, "cpu model : %s",cpu);
- DebugF("CPU %s\n",cpu);
- break;
- case 5:
- sscanf(res, "system type : %s",systype);
- DebugF("system type : %s\n",systype);
- break;
- case 6:
- sscanf(res, "system variation : %s",sysvari);
- DebugF("system variation: %s\n",sysvari);
- break;
- }
- count++;
- } while (count < 8);
-
- fclose(file);
-
- count = 0;
-
- do {
- if (!axpList[count].sysName || !strcmp(axpList[count].sysName,systype)) {
- if (axpList[count].sysVari && strcmp(axpList[count].sysVari,sysvari)) {
- count++;
- continue;
- };
- if (axpList[count].cpu && strcmp(axpList[count].cpu,cpu)) {
- count++;
- continue;
- }
- return axpList[count].sys;
- }
- count++;
- } while (1);
+ FILE *file;
+ int count = 0;
+ char res[256];
+ char cpu[255];
+ char systype[255];
+ char sysvari[255];
+
+ if (!(file = fopen("/proc/cpuinfo", "r")))
+ return SYS_NONE;
+ do {
+ if (!fgets(res, 0xff, file))
+ return SYS_NONE;
+ switch (count) {
+ case 1:
+ sscanf(res, "cpu model : %s", cpu);
+ DebugF("CPU %s\n", cpu);
+ break;
+ case 5:
+ sscanf(res, "system type : %s", systype);
+ DebugF("system type : %s\n", systype);
+ break;
+ case 6:
+ sscanf(res, "system variation : %s", sysvari);
+ DebugF("system variation: %s\n", sysvari);
+ break;
+ }
+ count++;
+ } while (count < 8);
+
+ fclose(file);
+
+ count = 0;
+
+ do {
+ if (!axpList[count].sysName || !strcmp(axpList[count].sysName, systype)) {
+ if (axpList[count].sysVari &&
+ strcmp(axpList[count].sysVari, sysvari)) {
+ count++;
+ continue;
+ };
+ if (axpList[count].cpu && strcmp(axpList[count].cpu, cpu)) {
+ count++;
+ continue;
+ }
+ return axpList[count].sys;
+ }
+ count++;
+ } while (1);
}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
index 2176985f9..68c296b0f 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
@@ -43,7 +43,7 @@ static int activeVT = -1;
static char vtname[11];
static struct termios tty_attr; /* tty state to restore */
-static int tty_mode; /* kbd mode to restore */
+static int tty_mode; /* kbd mode to restore */
static void
drain_console(int fd, void *closure)
@@ -61,11 +61,11 @@ switch_to(int vt, const char *from)
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
if (ret < 0)
- FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
+ FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
if (ret < 0)
- FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
+ FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
}
void
@@ -80,171 +80,169 @@ xf86OpenConsole(void)
if (serverGeneration == 1) {
- /* when KeepTty check if we're run with euid==0 */
- if (KeepTty && geteuid() != 0)
- FatalError("xf86OpenConsole:"
- " Server must be suid root for option \"KeepTTY\"\n");
-
- /*
- * setup the virtual terminal manager
- */
- if (xf86Info.vtno != -1) {
- from = X_CMDLINE;
- } else {
-
- i=0;
- while (tty0[i] != NULL) {
- if ((fd = open(tty0[i],O_WRONLY,0)) >= 0)
- break;
- i++;
- }
-
- if (fd < 0)
- FatalError(
- "xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
- strerror(errno));
-
- if (xf86Info.ShareVTs)
- {
- SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
- if (ret < 0)
- FatalError("xf86OpenConsole: Cannot find the current"
- " VT (%s)\n", strerror(errno));
+ /* when KeepTty check if we're run with euid==0 */
+ if (KeepTty && geteuid() != 0)
+ FatalError("xf86OpenConsole:"
+ " Server must be suid root for option \"KeepTTY\"\n");
+
+ /*
+ * setup the virtual terminal manager
+ */
+ if (xf86Info.vtno != -1) {
+ from = X_CMDLINE;
+ }
+ else {
+
+ i = 0;
+ while (tty0[i] != NULL) {
+ if ((fd = open(tty0[i], O_WRONLY, 0)) >= 0)
+ break;
+ i++;
+ }
+
+ if (fd < 0)
+ FatalError("xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
+ strerror(errno));
+
+ if (xf86Info.ShareVTs) {
+ SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
+ if (ret < 0)
+ FatalError("xf86OpenConsole: Cannot find the current"
+ " VT (%s)\n", strerror(errno));
xf86Info.vtno = vts.v_active;
- } else {
- SYSCALL(ret = ioctl(fd, VT_OPENQRY, &xf86Info.vtno));
- if (ret < 0)
- FatalError("xf86OpenConsole: Cannot find a free VT: "
- "%s\n", strerror(errno));
- if (xf86Info.vtno == -1)
- FatalError("xf86OpenConsole: Cannot find a free VT\n");
- }
- close(fd);
- }
-
- xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
-
- if (!KeepTty) {
- pid_t ppid = getppid();
- pid_t ppgid;
- ppgid = getpgid(ppid);
-
- /*
- * change to parent process group that pgid != pid so
- * that setsid() doesn't fail and we become process
- * group leader
- */
- if (setpgid(0,ppgid) < 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
- strerror(errno));
-
- /* become process group leader */
- if ((setsid() < 0))
- xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
- strerror(errno));
- }
-
- i=0;
+ }
+ else {
+ SYSCALL(ret = ioctl(fd, VT_OPENQRY, &xf86Info.vtno));
+ if (ret < 0)
+ FatalError("xf86OpenConsole: Cannot find a free VT: "
+ "%s\n", strerror(errno));
+ if (xf86Info.vtno == -1)
+ FatalError("xf86OpenConsole: Cannot find a free VT\n");
+ }
+ close(fd);
+ }
+
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+
+ if (!KeepTty) {
+ pid_t ppid = getppid();
+ pid_t ppgid;
+
+ ppgid = getpgid(ppid);
+
+ /*
+ * change to parent process group that pgid != pid so
+ * that setsid() doesn't fail and we become process
+ * group leader
+ */
+ if (setpgid(0, ppgid) < 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
+ strerror(errno));
+
+ /* become process group leader */
+ if ((setsid() < 0))
+ xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
+ strerror(errno));
+ }
+
+ i = 0;
while (vcs[i] != NULL) {
- snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
- if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) >= 0)
- break;
+ snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
+ if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) >= 0)
+ break;
i++;
}
- if (xf86Info.consoleFd < 0)
- FatalError("xf86OpenConsole: Cannot open virtual console"
- " %d (%s)\n", xf86Info.vtno, strerror(errno));
-
- /*
- * Linux doesn't switch to an active vt after the last close of a vt,
- * so we do this ourselves by remembering which is active now.
- */
- SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts));
- if (ret < 0)
- xf86Msg(X_WARNING,"xf86OpenConsole: VT_GETSTATE failed: %s\n",
- strerror(errno));
- else
- activeVT = vts.v_active;
+ if (xf86Info.consoleFd < 0)
+ FatalError("xf86OpenConsole: Cannot open virtual console"
+ " %d (%s)\n", xf86Info.vtno, strerror(errno));
+
+ /*
+ * Linux doesn't switch to an active vt after the last close of a vt,
+ * so we do this ourselves by remembering which is active now.
+ */
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts));
+ if (ret < 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_GETSTATE failed: %s\n",
+ strerror(errno));
+ else
+ activeVT = vts.v_active;
#if 0
- if (!KeepTty) {
- /*
- * Detach from the controlling tty to avoid char loss
- */
- if ((i = open("/dev/tty",O_RDWR)) >= 0) {
- SYSCALL(ioctl(i, TIOCNOTTY, 0));
- close(i);
- }
- }
+ if (!KeepTty) {
+ /*
+ * Detach from the controlling tty to avoid char loss
+ */
+ if ((i = open("/dev/tty", O_RDWR)) >= 0) {
+ SYSCALL(ioctl(i, TIOCNOTTY, 0));
+ close(i);
+ }
+ }
#endif
- if (!xf86Info.ShareVTs)
- {
+ if (!xf86Info.ShareVTs) {
struct termios nTty;
- /*
- * now get the VT. This _must_ succeed, or else fail completely.
- */
+ /*
+ * now get the VT. This _must_ succeed, or else fail completely.
+ */
switch_to(xf86Info.vtno, "xf86OpenConsole");
- SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
- if (ret < 0)
- FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
- strerror(errno));
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
+ if (ret < 0)
+ FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
+ strerror(errno));
- signal(SIGUSR1, xf86VTRequest);
+ signal(SIGUSR1, xf86VTRequest);
- VT.mode = VT_PROCESS;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
+ VT.mode = VT_PROCESS;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
- SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
- if (ret < 0)
- FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
- strerror(errno));
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
+ if (ret < 0)
+ FatalError
+ ("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
+ strerror(errno));
- SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
- if (ret < 0)
- FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
- strerror(errno));
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
+ if (ret < 0)
+ FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
+ strerror(errno));
tcgetattr(xf86Info.consoleFd, &tty_attr);
- SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode));
+ SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode));
#ifdef K_OFF
- /* disable kernel special keys and buffering */
- SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF));
- if (ret < 0)
+ /* disable kernel special keys and buffering */
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF));
+ if (ret < 0)
#endif
- {
- SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
- if (ret < 0)
- FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
- strerror(errno));
+ {
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
+ if (ret < 0)
+ FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
+ strerror(errno));
- /* need to keep the buffer clean, else the kernel gets angry */
- xf86SetConsoleHandler(drain_console, NULL);
- }
+ /* need to keep the buffer clean, else the kernel gets angry */
+ xf86SetConsoleHandler(drain_console, NULL);
+ }
nTty = tty_attr;
nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
nTty.c_oflag = 0;
nTty.c_cflag = CREAD | CS8;
nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
+ nTty.c_cc[VTIME] = 0;
+ nTty.c_cc[VMIN] = 1;
cfsetispeed(&nTty, 9600);
cfsetospeed(&nTty, 9600);
tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
-
- /* we really should have a InitOSInputDevices() function instead
- * of Init?$#*&Device(). So I just place it here */
}
- } else { /* serverGeneration != 1 */
- if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch)
- {
- /* now get the VT */
+ }
+ else { /* serverGeneration != 1 */
+ if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch) {
+ /* now get the VT */
switch_to(xf86Info.vtno, "xf86OpenConsole");
}
}
@@ -253,7 +251,7 @@ xf86OpenConsole(void)
void
xf86CloseConsole(void)
{
- struct vt_mode VT;
+ struct vt_mode VT;
int ret;
if (xf86Info.ShareVTs) {
@@ -270,68 +268,64 @@ xf86CloseConsole(void)
/* Back to text mode ... */
SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT));
if (ret < 0)
- xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
- strerror(errno));
+ xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
+ strerror(errno));
SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode));
tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
if (ret < 0)
- xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
- strerror(errno));
+ xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
+ strerror(errno));
else {
- /* set dflt vt handling */
- VT.mode = VT_AUTO;
- SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
- if (ret < 0)
- xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
- strerror(errno));
+ /* set dflt vt handling */
+ VT.mode = VT_AUTO;
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
+ if (ret < 0)
+ xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
+ strerror(errno));
}
- if (xf86Info.autoVTSwitch)
- {
+ if (xf86Info.autoVTSwitch) {
/*
* Perform a switch back to the active VT when we were started
*/
if (activeVT >= 0) {
switch_to(activeVT, "xf86CloseConsole");
- activeVT = -1;
+ activeVT = -1;
}
}
- close(xf86Info.consoleFd); /* make the vt-manager happy */
+ close(xf86Info.consoleFd); /* make the vt-manager happy */
}
int
xf86ProcessArgument(int argc, char *argv[], int i)
{
- /*
- * Keep server from detaching from controlling tty. This is useful
- * when debugging (so the server can receive keyboard signals.
- */
- if (!strcmp(argv[i], "-keeptty"))
- {
- KeepTty = TRUE;
- return 1;
- }
-
- if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
- {
- if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0)
- {
- UseMsg();
- xf86Info.vtno = -1;
- return 0;
- }
- return 1;
- }
- return 0;
+ /*
+ * Keep server from detaching from controlling tty. This is useful
+ * when debugging (so the server can receive keyboard signals.
+ */
+ if (!strcmp(argv[i], "-keeptty")) {
+ KeepTty = TRUE;
+ return 1;
+ }
+
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
+ if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0) {
+ UseMsg();
+ xf86Info.vtno = -1;
+ return 0;
+ }
+ return 1;
+ }
+ return 0;
}
void
xf86UseMsg(void)
{
- ErrorF("vtXX use the specified VT number\n");
- ErrorF("-keeptty ");
- ErrorF("don't detach controlling tty (for debugging only)\n");
+ ErrorF("vtXX use the specified VT number\n");
+ ErrorF("-keeptty ");
+ ErrorF("don't detach controlling tty (for debugging only)\n");
}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
index 0d91f7a52..3526a21d4 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
@@ -70,10 +70,10 @@ extern int iopl(int __level);
#endif
#ifdef __alpha__
-# define BUS_BASE bus_base
-#else
+#define BUS_BASE bus_base
+#else
#define BUS_BASE (0)
-#endif /* __alpha__ */
+#endif /* __alpha__ */
/***************************************************************************/
/* Video Memory Mapping section */
@@ -81,10 +81,11 @@ extern int iopl(int __level);
static pointer mapVidMem(int, unsigned long, unsigned long, int);
static void unmapVidMem(int, pointer, unsigned long);
-#if defined (__alpha__)
+
+#if defined (__alpha__)
extern void sethae(unsigned long hae);
-extern unsigned long _bus_base __P ((void)) __attribute__ ((const));
-extern unsigned long _bus_base_sparse __P ((void)) __attribute__ ((const));
+extern unsigned long _bus_base __P((void)) __attribute__ ((const));
+extern unsigned long _bus_base_sparse __P((void)) __attribute__ ((const));
static pointer mapVidMemSparse(int, unsigned long, unsigned long, int);
extern axpDevice lnxGetAXP(void);
@@ -105,9 +106,9 @@ static void undoWC(int, pointer);
/* The file desc for /proc/mtrr. Once opened, left opened, and the mtrr
driver will clean up when we exit. */
-#define MTRR_FD_UNOPENED (-1) /* We have yet to open /proc/mtrr */
-#define MTRR_FD_PROBLEM (-2) /* We tried to open /proc/mtrr, but had
- a problem. */
+#define MTRR_FD_UNOPENED (-1) /* We have yet to open /proc/mtrr */
+#define MTRR_FD_PROBLEM (-2) /* We tried to open /proc/mtrr, but had
+ a problem. */
static int mtrr_fd = MTRR_FD_UNOPENED;
/* Open /proc/mtrr. FALSE on failure. Will always fail on Linux 2.0,
@@ -116,29 +117,29 @@ static int mtrr_fd = MTRR_FD_UNOPENED;
static Bool
mtrr_open(int verbosity)
{
- /* Only report absence of /proc/mtrr once. */
- static Bool warned = FALSE;
-
- if (mtrr_fd == MTRR_FD_UNOPENED) {
- mtrr_fd = open("/proc/mtrr", O_WRONLY);
-
- if (mtrr_fd < 0)
- mtrr_fd = MTRR_FD_PROBLEM;
- }
-
- if (mtrr_fd == MTRR_FD_PROBLEM) {
- /* To make sure we only ever warn once, need to check
- verbosity outside xf86MsgVerb */
- if (!warned && verbosity <= xf86GetVerbosity()) {
- xf86MsgVerb(X_WARNING, verbosity,
- "System lacks support for changing MTRRs\n");
- warned = TRUE;
- }
-
- return FALSE;
- }
- else
- return TRUE;
+ /* Only report absence of /proc/mtrr once. */
+ static Bool warned = FALSE;
+
+ if (mtrr_fd == MTRR_FD_UNOPENED) {
+ mtrr_fd = open("/proc/mtrr", O_WRONLY);
+
+ if (mtrr_fd < 0)
+ mtrr_fd = MTRR_FD_PROBLEM;
+ }
+
+ if (mtrr_fd == MTRR_FD_PROBLEM) {
+ /* To make sure we only ever warn once, need to check
+ verbosity outside xf86MsgVerb */
+ if (!warned && verbosity <= xf86GetVerbosity()) {
+ xf86MsgVerb(X_WARNING, verbosity,
+ "System lacks support for changing MTRRs\n");
+ warned = TRUE;
+ }
+
+ return FALSE;
+ }
+ else
+ return TRUE;
}
/*
@@ -147,260 +148,257 @@ mtrr_open(int verbosity)
*/
struct mtrr_wc_region {
- struct mtrr_sentry sentry;
- Bool added; /* added WC or removed it */
- struct mtrr_wc_region * next;
+ struct mtrr_sentry sentry;
+ Bool added; /* added WC or removed it */
+ struct mtrr_wc_region *next;
};
-
static struct mtrr_wc_region *
mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
+ MessageType from)
{
- /* Some BIOS writers thought that setting wc over the mmio
- region of a graphics devices was a good idea. Try to fix
- it. */
-
- struct mtrr_gentry gent;
- struct mtrr_wc_region *wcreturn = NULL, *wcr;
- int count, ret=0;
-
- /* Linux 2.0 users should not get a warning without -verbose */
- if (!mtrr_open(2))
- return NULL;
-
- for (gent.regnum = 0;
- ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0;
- gent.regnum++) {
- if (gent.type != MTRR_TYPE_WRCOMB
- || gent.base + gent.size <= base
- || base + size <= gent.base)
- continue;
-
- /* Found an overlapping region. Delete it. */
-
- wcr = malloc(sizeof(*wcr));
- if (!wcr)
- return NULL;
- wcr->sentry.base = gent.base;
- wcr->sentry.size = gent.size;
- wcr->sentry.type = MTRR_TYPE_WRCOMB;
- wcr->added = FALSE;
-
- count = 3;
- while (count-- &&
- (ret = ioctl(mtrr_fd, MTRRIOC_KILL_ENTRY, &(wcr->sentry))) < 0);
-
- if (ret >= 0) {
- xf86DrvMsg(screenNum, from,
- "Removed MMIO write-combining range "
- "(0x%lx,0x%lx)\n",
- (unsigned long) gent.base, (unsigned long) gent.size);
- wcr->next = wcreturn;
- wcreturn = wcr;
- gent.regnum--;
- } else {
- free(wcr);
- xf86DrvMsgVerb(screenNum, X_WARNING, 0,
- "Failed to remove MMIO "
- "write-combining range (0x%lx,0x%lx)\n",
- gent.base, (unsigned long) gent.size);
- }
- }
- return wcreturn;
-}
+ /* Some BIOS writers thought that setting wc over the mmio
+ region of a graphics devices was a good idea. Try to fix
+ it. */
+ struct mtrr_gentry gent;
+ struct mtrr_wc_region *wcreturn = NULL, *wcr;
+ int count, ret = 0;
+
+ /* Linux 2.0 users should not get a warning without -verbose */
+ if (!mtrr_open(2))
+ return NULL;
+
+ for (gent.regnum = 0;
+ ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++) {
+ if (gent.type != MTRR_TYPE_WRCOMB
+ || gent.base + gent.size <= base || base + size <= gent.base)
+ continue;
+
+ /* Found an overlapping region. Delete it. */
+
+ wcr = malloc(sizeof(*wcr));
+ if (!wcr)
+ return NULL;
+ wcr->sentry.base = gent.base;
+ wcr->sentry.size = gent.size;
+ wcr->sentry.type = MTRR_TYPE_WRCOMB;
+ wcr->added = FALSE;
+
+ count = 3;
+ while (count-- &&
+ (ret = ioctl(mtrr_fd, MTRRIOC_KILL_ENTRY, &(wcr->sentry))) < 0);
+
+ if (ret >= 0) {
+ xf86DrvMsg(screenNum, from,
+ "Removed MMIO write-combining range "
+ "(0x%lx,0x%lx)\n",
+ (unsigned long) gent.base, (unsigned long) gent.size);
+ wcr->next = wcreturn;
+ wcreturn = wcr;
+ gent.regnum--;
+ }
+ else {
+ free(wcr);
+ xf86DrvMsgVerb(screenNum, X_WARNING, 0,
+ "Failed to remove MMIO "
+ "write-combining range (0x%lx,0x%lx)\n",
+ gent.base, (unsigned long) gent.size);
+ }
+ }
+ return wcreturn;
+}
static struct mtrr_wc_region *
mtrr_remove_offending(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
+ MessageType from)
{
struct mtrr_gentry gent;
struct mtrr_wc_region *wcreturn = NULL, **wcr;
if (!mtrr_open(2))
- return NULL;
+ return NULL;
wcr = &wcreturn;
- for (gent.regnum = 0;
- ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++ ) {
- if (gent.type == MTRR_TYPE_WRCOMB
- && ((gent.base >= base && gent.base + gent.size < base + size) ||
- (gent.base > base && gent.base + gent.size <= base + size))) {
- *wcr = mtrr_cull_wc_region(screenNum, gent.base, gent.size, from);
- if (*wcr) gent.regnum--;
- while(*wcr) {
- wcr = &((*wcr)->next);
- }
- }
+ for (gent.regnum = 0;
+ ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++) {
+ if (gent.type == MTRR_TYPE_WRCOMB
+ && ((gent.base >= base && gent.base + gent.size < base + size) ||
+ (gent.base > base && gent.base + gent.size <= base + size))) {
+ *wcr = mtrr_cull_wc_region(screenNum, gent.base, gent.size, from);
+ if (*wcr)
+ gent.regnum--;
+ while (*wcr) {
+ wcr = &((*wcr)->next);
+ }
+ }
}
return wcreturn;
}
-
static struct mtrr_wc_region *
mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
+ MessageType from)
{
- struct mtrr_wc_region **wcr, *wcreturn, *curwcr;
+ struct mtrr_wc_region **wcr, *wcreturn, *curwcr;
- /*
- * There can be only one....
- */
+ /*
+ * There can be only one....
+ */
- wcreturn = mtrr_remove_offending(screenNum, base, size, from);
- wcr = &wcreturn;
- while (*wcr) {
- wcr = &((*wcr)->next);
- }
+ wcreturn = mtrr_remove_offending(screenNum, base, size, from);
+ wcr = &wcreturn;
+ while (*wcr) {
+ wcr = &((*wcr)->next);
+ }
- /* Linux 2.0 should not warn, unless the user explicitly asks for
- WC. */
+ /* Linux 2.0 should not warn, unless the user explicitly asks for
+ WC. */
- if (!mtrr_open(from == X_CONFIG ? 0 : 2))
- return wcreturn;
+ if (!mtrr_open(from == X_CONFIG ? 0 : 2))
+ return wcreturn;
- *wcr = curwcr = malloc(sizeof(**wcr));
- if (!curwcr)
- return wcreturn;
+ *wcr = curwcr = malloc(sizeof(**wcr));
+ if (!curwcr)
+ return wcreturn;
- curwcr->sentry.base = base;
- curwcr->sentry.size = size;
- curwcr->sentry.type = MTRR_TYPE_WRCOMB;
- curwcr->added = TRUE;
- curwcr->next = NULL;
+ curwcr->sentry.base = base;
+ curwcr->sentry.size = size;
+ curwcr->sentry.type = MTRR_TYPE_WRCOMB;
+ curwcr->added = TRUE;
+ curwcr->next = NULL;
#if SPLIT_WC_REGIONS
- /*
- * Splits up the write-combining region if it is not aligned on a
- * size boundary.
- */
-
- {
- unsigned long lbase, d_size = 1;
- unsigned long n_size = size;
- unsigned long n_base = base;
-
- for (lbase = n_base, d_size = 1; !(lbase & 1);
- lbase = lbase >> 1, d_size <<= 1);
- while (d_size > n_size)
- d_size = d_size >> 1;
- DebugF("WC_BASE: 0x%lx WC_END: 0x%lx\n",base,base+d_size-1);
- n_base += d_size;
- n_size -= d_size;
- if (n_size) {
- xf86DrvMsgVerb(screenNum,X_INFO,3,"Splitting WC range: "
- "base: 0x%lx, size: 0x%lx\n",base,size);
- curwcr->next = mtrr_add_wc_region(screenNum, n_base, n_size,from);
- }
- curwcr->sentry.size = d_size;
- }
-
- /*****************************************************************/
-#endif /* SPLIT_WC_REGIONS */
-
- if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &curwcr->sentry) >= 0) {
- /* Avoid printing on every VT switch */
- if (xf86ServerIsInitialising()) {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx)\n",
- base, size);
- }
- return wcreturn;
- }
- else {
- *wcr = curwcr->next;
- free(curwcr);
-
- /* Don't complain about the VGA region: MTRR fixed
- regions aren't currently supported, but might be in
- the future. */
- if ((unsigned long)base >= 0x100000) {
- xf86DrvMsgVerb(screenNum, X_WARNING, 0,
- "Failed to set up write-combining range "
- "(0x%lx,0x%lx)\n", base, size);
- }
- return wcreturn;
- }
+ /*
+ * Splits up the write-combining region if it is not aligned on a
+ * size boundary.
+ */
+
+ {
+ unsigned long lbase, d_size = 1;
+ unsigned long n_size = size;
+ unsigned long n_base = base;
+
+ for (lbase = n_base, d_size = 1; !(lbase & 1);
+ lbase = lbase >> 1, d_size <<= 1);
+ while (d_size > n_size)
+ d_size = d_size >> 1;
+ DebugF("WC_BASE: 0x%lx WC_END: 0x%lx\n", base, base + d_size - 1);
+ n_base += d_size;
+ n_size -= d_size;
+ if (n_size) {
+ xf86DrvMsgVerb(screenNum, X_INFO, 3, "Splitting WC range: "
+ "base: 0x%lx, size: 0x%lx\n", base, size);
+ curwcr->next = mtrr_add_wc_region(screenNum, n_base, n_size, from);
+ }
+ curwcr->sentry.size = d_size;
+ }
+
+ /*****************************************************************/
+#endif /* SPLIT_WC_REGIONS */
+
+ if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &curwcr->sentry) >= 0) {
+ /* Avoid printing on every VT switch */
+ if (xf86ServerIsInitialising()) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx)\n", base, size);
+ }
+ return wcreturn;
+ }
+ else {
+ *wcr = curwcr->next;
+ free(curwcr);
+
+ /* Don't complain about the VGA region: MTRR fixed
+ regions aren't currently supported, but might be in
+ the future. */
+ if ((unsigned long) base >= 0x100000) {
+ xf86DrvMsgVerb(screenNum, X_WARNING, 0,
+ "Failed to set up write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ }
+ return wcreturn;
+ }
}
static void
mtrr_undo_wc_region(int screenNum, struct mtrr_wc_region *wcr)
{
- struct mtrr_wc_region *p, *prev;
-
- if (mtrr_fd >= 0) {
- p = wcr;
- while (p) {
- if (p->added)
- ioctl(mtrr_fd, MTRRIOC_DEL_ENTRY, &p->sentry);
- prev = p;
- p = p->next;
- free(prev);
- }
- }
+ struct mtrr_wc_region *p, *prev;
+
+ if (mtrr_fd >= 0) {
+ p = wcr;
+ while (p) {
+ if (p->added)
+ ioctl(mtrr_fd, MTRRIOC_DEL_ENTRY, &p->sentry);
+ prev = p;
+ p = p->next;
+ free(prev);
+ }
+ }
}
static pointer
setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
MessageType from)
{
- if (enable)
- return mtrr_add_wc_region(screenNum, base, size, from);
- else
- return mtrr_cull_wc_region(screenNum, base, size, from);
+ if (enable)
+ return mtrr_add_wc_region(screenNum, base, size, from);
+ else
+ return mtrr_cull_wc_region(screenNum, base, size, from);
}
static void
undoWC(int screenNum, pointer regioninfo)
{
- mtrr_undo_wc_region(screenNum, regioninfo);
+ mtrr_undo_wc_region(screenNum, regioninfo);
}
-#endif /* HAS_MTRR_SUPPORT */
+#endif /* HAS_MTRR_SUPPORT */
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
+ pVidMem->linearSupported = TRUE;
#ifdef __alpha__
- if (axpSystem == -1) {
- axpSystem = lnxGetAXP();
- if ((needSparse = (_bus_base_sparse() > 0))) {
- hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
- hae_mask = xf86AXPParams[axpSystem].hae_mask;
- }
- bus_base = _bus_base();
- }
- if (needSparse) {
- xf86Msg(X_INFO,"Machine needs sparse mapping\n");
- pVidMem->mapMem = mapVidMemSparse;
- pVidMem->unmapMem = unmapVidMemSparse;
- } else {
- xf86Msg(X_INFO,"Machine type has 8/16 bit access\n");
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
- }
+ if (axpSystem == -1) {
+ axpSystem = lnxGetAXP();
+ if ((needSparse = (_bus_base_sparse() > 0))) {
+ hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
+ hae_mask = xf86AXPParams[axpSystem].hae_mask;
+ }
+ bus_base = _bus_base();
+ }
+ if (needSparse) {
+ xf86Msg(X_INFO, "Machine needs sparse mapping\n");
+ pVidMem->mapMem = mapVidMemSparse;
+ pVidMem->unmapMem = unmapVidMemSparse;
+ }
+ else {
+ xf86Msg(X_INFO, "Machine type has 8/16 bit access\n");
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+ }
#else
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
-#endif /* __alpha__ */
-
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+#endif /* __alpha__ */
#ifdef HAS_MTRR_SUPPORT
- pVidMem->setWC = setWC;
- pVidMem->undoWC = undoWC;
+ pVidMem->setWC = setWC;
+ pVidMem->undoWC = undoWC;
#endif
- pVidMem->initialised = TRUE;
+ pVidMem->initialised = TRUE;
}
#ifdef __sparc__
/* Basically, you simply cannot do this on Sparc. You have to do something portable
* like use /dev/fb* or mmap() on /proc/bus/pci/X/Y nodes. -DaveM
*/
-static pointer mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- return NULL;
+ return NULL;
}
#else
static pointer
@@ -408,14 +406,14 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
pointer base;
int fd;
- int mapflags = MAP_SHARED;
+ int mapflags = MAP_SHARED;
int prot;
memType realBase, alignOff;
realBase = Base & ~(getpagesize() - 1);
alignOff = Base - realBase;
DebugF("base: %lx, realBase: %lx, alignOff: %lx \n",
- Base,realBase,alignOff);
+ Base, realBase, alignOff);
#if defined(__ia64__) || defined(__arm__) || defined(__s390__)
#ifndef MAP_WRITECOMBINED
@@ -424,55 +422,52 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
#ifndef MAP_NONCACHED
#define MAP_NONCACHED 0x00020000
#endif
- if(flags & VIDMEM_FRAMEBUFFER)
- mapflags |= MAP_WRITECOMBINED;
+ if (flags & VIDMEM_FRAMEBUFFER)
+ mapflags |= MAP_WRITECOMBINED;
else
- mapflags |= MAP_NONCACHED;
+ mapflags |= MAP_NONCACHED;
#endif
#if 0
/* this will disappear when people upgrade their kernels */
fd = open(DEV_MEM,
- ((flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR) | O_SYNC);
+ ((flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR) | O_SYNC);
#else
fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
#endif
- if (fd < 0)
- {
- FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
- strerror(errno));
+ if (fd < 0) {
+ FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
+ strerror(errno));
}
if (flags & VIDMEM_READONLY)
- prot = PROT_READ;
+ prot = PROT_READ;
else
- prot = PROT_READ | PROT_WRITE;
+ prot = PROT_READ | PROT_WRITE;
/* This requires linux-0.99.pl10 or above */
- base = mmap((caddr_t)0, Size + alignOff, prot, mapflags, fd,
- (off_t)realBase + BUS_BASE);
+ base = mmap((caddr_t) 0, Size + alignOff, prot, mapflags, fd,
+ (off_t) realBase + BUS_BASE);
close(fd);
if (base == MAP_FAILED) {
FatalError("xf86MapVidMem: Could not mmap framebuffer"
- " (0x%08lx,0x%lx) (%s)\n", Base, Size,
- strerror(errno));
+ " (0x%08lx,0x%lx) (%s)\n", Base, Size, strerror(errno));
}
- DebugF("base: %lx aligned base: %lx\n",base, (char *)base + alignOff);
- return (char *)base + alignOff;
+ DebugF("base: %lx aligned base: %lx\n", base, (char *) base + alignOff);
+ return (char *) base + alignOff;
}
-#endif /* !(__sparc__) */
-
+#endif /* !(__sparc__) */
+
static void
unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- uintptr_t alignOff = (uintptr_t)Base
- - ((uintptr_t)Base & ~(getpagesize() - 1));
+ uintptr_t alignOff = (uintptr_t) Base
+ - ((uintptr_t) Base & ~(getpagesize() - 1));
- DebugF("alignment offset: %lx\n", (unsigned long)alignOff);
- munmap((void *)((uintptr_t)Base - alignOff), (Size + alignOff));
+ DebugF("alignment offset: %lx\n", (unsigned long) alignOff);
+ munmap((void *) ((uintptr_t) Base - alignOff), (Size + alignOff));
}
-
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
@@ -490,68 +485,68 @@ Bool
xf86EnableIO(void)
{
#if defined(__powerpc__)
- int fd;
- unsigned int ioBase_phys;
+ int fd;
+ unsigned int ioBase_phys;
#endif
- if (ExtendedEnabled)
- return TRUE;
+ if (ExtendedEnabled)
+ return TRUE;
#if defined(__powerpc__)
- ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
+ ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
- fd = open("/dev/mem", O_RDWR);
- if (ioBase == NULL) {
- ioBase = (volatile unsigned char *)mmap(0, 0x20000,
- PROT_READ | PROT_WRITE, MAP_SHARED, fd,
- ioBase_phys);
+ fd = open("/dev/mem", O_RDWR);
+ if (ioBase == NULL) {
+ ioBase = (volatile unsigned char *) mmap(0, 0x20000,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd, ioBase_phys);
/* Should this be fatal or just a warning? */
#if 0
- if (ioBase == MAP_FAILED) {
- xf86Msg(X_WARNING,
- "xf86EnableIOPorts: Failed to map iobase (%s)\n",
- strerror(errno));
- return FALSE;
- }
+ if (ioBase == MAP_FAILED) {
+ xf86Msg(X_WARNING,
+ "xf86EnableIOPorts: Failed to map iobase (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
#endif
- }
- close(fd);
+ }
+ close(fd);
#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__) && !defined(__nds32__)
- if (ioperm(0, 1024, 1) || iopl(3)) {
- if (errno == ENODEV)
- ErrorF("xf86EnableIOPorts: no I/O ports found\n");
- else
- FatalError("xf86EnableIOPorts: failed to set IOPL"
- " for I/O (%s)\n", strerror(errno));
- return FALSE;
- }
-# if !defined(__alpha__)
- /* XXX: this is actually not trapping anything because of iopl(3)
- * above */
- ioperm(0x40,4,0); /* trap access to the timer chip */
- ioperm(0x60,4,0); /* trap access to the keyboard controller */
-# endif
+ if (ioperm(0, 1024, 1) || iopl(3)) {
+ if (errno == ENODEV)
+ ErrorF("xf86EnableIOPorts: no I/O ports found\n");
+ else
+ FatalError("xf86EnableIOPorts: failed to set IOPL"
+ " for I/O (%s)\n", strerror(errno));
+ return FALSE;
+ }
+#if !defined(__alpha__)
+ /* XXX: this is actually not trapping anything because of iopl(3)
+ * above */
+ ioperm(0x40, 4, 0); /* trap access to the timer chip */
+ ioperm(0x60, 4, 0); /* trap access to the keyboard controller */
+#endif
#endif
- ExtendedEnabled = TRUE;
+ ExtendedEnabled = TRUE;
- return TRUE;
+ return TRUE;
}
void
xf86DisableIO(void)
{
- if (!ExtendedEnabled)
- return;
+ if (!ExtendedEnabled)
+ return;
#if defined(__powerpc__)
- munmap(ioBase, 0x20000);
- ioBase = NULL;
+ munmap(ioBase, 0x20000);
+ ioBase = NULL;
#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__) && !defined(__nds32__)
- iopl(0);
- ioperm(0, 1024, 0);
+ iopl(0);
+ ioperm(0, 1024, 0);
#endif
- ExtendedEnabled = FALSE;
+ ExtendedEnabled = FALSE;
- return;
+ return;
}
#if defined (__alpha__)
@@ -562,33 +557,33 @@ extern int readDense8(pointer Base, register unsigned long Offset);
extern int readDense16(pointer Base, register unsigned long Offset);
extern int readDense32(pointer Base, register unsigned long Offset);
extern void
-writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDense8(int Value, pointer Base, register unsigned long Offset);
+ writeDense8(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDense16(int Value, pointer Base, register unsigned long Offset);
+ writeDense16(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDense32(int Value, pointer Base, register unsigned long Offset);
+ writeDense32(int Value, pointer Base, register unsigned long Offset);
static int readSparse8(pointer Base, register unsigned long Offset);
static int readSparse16(pointer Base, register unsigned long Offset);
static int readSparse32(pointer Base, register unsigned long Offset);
static void
-writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparse8(int Value, pointer Base, register unsigned long Offset);
+ writeSparse8(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparse16(int Value, pointer Base, register unsigned long Offset);
+ writeSparse16(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparse32(int Value, pointer Base, register unsigned long Offset);
+ writeSparse32(int Value, pointer Base, register unsigned long Offset);
#define DENSE_BASE 0x2ff00000000UL
#define SPARSE_BASE 0x30000000000UL
@@ -596,7 +591,8 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset);
static unsigned long msb_set = 0;
static pointer
-mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
+ int flags)
{
int fd, prot;
unsigned long ret, rets = 0;
@@ -604,43 +600,42 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags
static Bool was_here = FALSE;
if (!was_here) {
- was_here = TRUE;
-
- xf86WriteMmio8 = writeSparse8;
- xf86WriteMmio16 = writeSparse16;
- xf86WriteMmio32 = writeSparse32;
- xf86WriteMmioNB8 = writeSparseNB8;
- xf86WriteMmioNB16 = writeSparseNB16;
- xf86WriteMmioNB32 = writeSparseNB32;
- xf86ReadMmio8 = readSparse8;
- xf86ReadMmio16 = readSparse16;
- xf86ReadMmio32 = readSparse32;
+ was_here = TRUE;
+
+ xf86WriteMmio8 = writeSparse8;
+ xf86WriteMmio16 = writeSparse16;
+ xf86WriteMmio32 = writeSparse32;
+ xf86WriteMmioNB8 = writeSparseNB8;
+ xf86WriteMmioNB16 = writeSparseNB16;
+ xf86WriteMmioNB32 = writeSparseNB32;
+ xf86ReadMmio8 = readSparse8;
+ xf86ReadMmio16 = readSparse16;
+ xf86ReadMmio32 = readSparse32;
}
-
+
fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
if (fd < 0) {
FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
- strerror(errno));
+ strerror(errno));
}
#if 0
- xf86Msg(X_INFO,"mapVidMemSparse: try Base 0x%lx size 0x%lx flags 0x%x\n",
- Base, Size, flags);
+ xf86Msg(X_INFO, "mapVidMemSparse: try Base 0x%lx size 0x%lx flags 0x%x\n",
+ Base, Size, flags);
#endif
if (flags & VIDMEM_READONLY)
- prot = PROT_READ;
+ prot = PROT_READ;
else
- prot = PROT_READ | PROT_WRITE;
+ prot = PROT_READ | PROT_WRITE;
/* This requirers linux-0.99.pl10 or above */
/*
* Always do DENSE mmap, since read32/write32 currently require it.
*/
- ret = (unsigned long)mmap((caddr_t)(DENSE_BASE + Base), Size,
- prot, MAP_SHARED, fd,
- (off_t) (bus_base + Base));
+ ret = (unsigned long) mmap((caddr_t) (DENSE_BASE + Base), Size,
+ prot, MAP_SHARED, fd, (off_t) (bus_base + Base));
/*
* Do SPARSE mmap only when MMIO and not MMIO_32BIT, or FRAMEBUFFER
@@ -650,40 +645,36 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags
* bytes worth of pagetable (32 pages).
*/
if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
- ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE)))
- {
- rets = (unsigned long)mmap((caddr_t)(SPARSE_BASE + (Base << 5)),
- Size << 5, prot, MAP_SHARED, fd,
- (off_t) _bus_base_sparse() + (Base << 5));
+ ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE))) {
+ rets = (unsigned long) mmap((caddr_t) (SPARSE_BASE + (Base << 5)),
+ Size << 5, prot, MAP_SHARED, fd,
+ (off_t) _bus_base_sparse() + (Base << 5));
}
close(fd);
-
- if (ret == (unsigned long)MAP_FAILED) {
+
+ if (ret == (unsigned long) MAP_FAILED) {
FatalError("xf86MapVidMemSparse: Could not (dense) mmap fb (%s)\n",
- strerror(errno));
+ strerror(errno));
}
if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
- ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE)))
- {
- if (rets == (unsigned long)MAP_FAILED ||
- rets != (SPARSE_BASE + (Base << 5)))
- {
- FatalError("mapVidMemSparse: Could not (sparse) mmap fb (%s)\n",
- strerror(errno));
- }
+ ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE))) {
+ if (rets == (unsigned long) MAP_FAILED ||
+ rets != (SPARSE_BASE + (Base << 5))) {
+ FatalError("mapVidMemSparse: Could not (sparse) mmap fb (%s)\n",
+ strerror(errno));
+ }
}
#if 1
if (rets)
- xf86Msg(X_INFO,"mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
- " to DENSE at 0x%lx and SPARSE at 0x%lx\n",
- Base, Size, ret, rets);
+ xf86Msg(X_INFO, "mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
+ " to DENSE at 0x%lx and SPARSE at 0x%lx\n",
+ Base, Size, ret, rets);
else
- xf86Msg(X_INFO,"mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
- " to DENSE only at 0x%lx\n",
- Base, Size, ret);
+ xf86Msg(X_INFO, "mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
+ " to DENSE only at 0x%lx\n", Base, Size, ret);
#endif
return (pointer) ret;
@@ -692,16 +683,17 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags
static void
unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size)
{
- unsigned long Offset = (unsigned long)Base - DENSE_BASE;
+ unsigned long Offset = (unsigned long) Base - DENSE_BASE;
+
#if 1
- xf86Msg(X_INFO,"unmapVidMemSparse: unmapping Base 0x%lx Size 0x%lx\n",
- Base, Size);
+ xf86Msg(X_INFO, "unmapVidMemSparse: unmapping Base 0x%lx Size 0x%lx\n",
+ Base, Size);
#endif
/* Unmap DENSE always. */
- munmap((caddr_t)Base, Size);
+ munmap((caddr_t) Base, Size);
/* Unmap SPARSE always, and ignore error in case we did not map it. */
- munmap((caddr_t)(SPARSE_BASE + (Offset << 5)), Size << 5);
+ munmap((caddr_t) (SPARSE_BASE + (Offset << 5)), Size << 5);
}
static int
@@ -711,15 +703,15 @@ readSparse8(pointer Base, register unsigned long Offset)
register unsigned long msb;
mem_barrier();
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
shift = (Offset & 0x3) << 3;
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
mem_barrier();
@@ -735,19 +727,19 @@ readSparse16(pointer Base, register unsigned long Offset)
register unsigned long msb;
mem_barrier();
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
shift = (Offset & 0x2) << 3;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
mem_barrier();
- result = *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2)));
+ result = *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2)));
result >>= shift;
return 0xffffUL & result;
}
@@ -757,7 +749,7 @@ readSparse32(pointer Base, register unsigned long Offset)
{
/* NOTE: this is really using DENSE. */
mem_barrier();
- return *(vuip)((unsigned long)Base+(Offset));
+ return *(vuip) ((unsigned long) Base + (Offset));
}
static void
@@ -767,14 +759,14 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
register unsigned int b = Value & 0xffU;
write_mem_barrier();
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
write_mem_barrier();
@@ -788,18 +780,18 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
register unsigned int w = Value & 0xffffU;
write_mem_barrier();
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
write_mem_barrier();
- *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2))) = w * 0x00010001;
+ *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001;
}
static void
@@ -807,7 +799,7 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset)
{
/* NOTE: this is really using DENSE. */
write_mem_barrier();
- *(vuip)((unsigned long)Base + (Offset)) = Value;
+ *(vuip) ((unsigned long) Base + (Offset)) = Value;
return;
}
@@ -817,14 +809,14 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
register unsigned long msb;
register unsigned int b = Value & 0xffU;
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
*(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101;
}
@@ -835,43 +827,43 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
register unsigned long msb;
register unsigned int w = Value & 0xffffU;
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
- *(vuip)(SPARSE_BASE+(Offset<<5)+(1<<(5-2))) = w * 0x00010001;
+ *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001;
}
static void
writeSparseNB32(int Value, pointer Base, register unsigned long Offset)
{
/* NOTE: this is really using DENSE. */
- *(vuip)((unsigned long)Base + (Offset)) = Value;
+ *(vuip) ((unsigned long) Base + (Offset)) = Value;
return;
}
-void (*xf86WriteMmio8)(int Value, pointer Base, unsigned long Offset)
- = writeDense8;
-void (*xf86WriteMmio16)(int Value, pointer Base, unsigned long Offset)
- = writeDense16;
-void (*xf86WriteMmio32)(int Value, pointer Base, unsigned long Offset)
- = writeDense32;
-void (*xf86WriteMmioNB8)(int Value, pointer Base, unsigned long Offset)
- = writeDenseNB8;
-void (*xf86WriteMmioNB16)(int Value, pointer Base, unsigned long Offset)
- = writeDenseNB16;
-void (*xf86WriteMmioNB32)(int Value, pointer Base, unsigned long Offset)
- = writeDenseNB32;
-int (*xf86ReadMmio8)(pointer Base, unsigned long Offset)
- = readDense8;
-int (*xf86ReadMmio16)(pointer Base, unsigned long Offset)
- = readDense16;
-int (*xf86ReadMmio32)(pointer Base, unsigned long Offset)
- = readDense32;
-
-#endif /* __alpha__ */
+void (*xf86WriteMmio8) (int Value, pointer Base, unsigned long Offset)
+ = writeDense8;
+void (*xf86WriteMmio16) (int Value, pointer Base, unsigned long Offset)
+ = writeDense16;
+void (*xf86WriteMmio32) (int Value, pointer Base, unsigned long Offset)
+ = writeDense32;
+void (*xf86WriteMmioNB8) (int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB8;
+void (*xf86WriteMmioNB16) (int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB16;
+void (*xf86WriteMmioNB32) (int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB32;
+int (*xf86ReadMmio8) (pointer Base, unsigned long Offset)
+ = readDense8;
+int (*xf86ReadMmio16) (pointer Base, unsigned long Offset)
+ = readDense16;
+int (*xf86ReadMmio32) (pointer Base, unsigned long Offset)
+ = readDense32;
+
+#endif /* __alpha__ */
diff --git a/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c b/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c
index 0021b5544..254748ff6 100644
--- a/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c
+++ b/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c
@@ -1,7 +1,7 @@
/*******************************************************************************
for Alpha Linux
*******************************************************************************/
-
+
/*
* Create a dependency that should be immune from the effect of register
* renaming as is commonly seen in superscalar processors. This should
@@ -10,7 +10,7 @@
*
* Slowbcopy(char *src, char *dst, int count)
*
- */
+ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
@@ -27,16 +27,16 @@ static int really_slow_bcopy;
void
xf86SetReallySlowBcopy(void)
{
- really_slow_bcopy = 1;
+ really_slow_bcopy = 1;
}
#if defined(__i386__) || defined(__amd64__)
-static void xf86_really_slow_bcopy(unsigned char *src, unsigned char *dst, int len)
+static void
+xf86_really_slow_bcopy(unsigned char *src, unsigned char *dst, int len)
{
- while(len--)
- {
- *dst++ = *src++;
- outb(0x80, 0x00);
+ while (len--) {
+ *dst++ = *src++;
+ outb(0x80, 0x00);
}
}
#endif
@@ -47,12 +47,12 @@ xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len)
{
#if defined(__i386__) || defined(__amd64__)
if (really_slow_bcopy) {
- xf86_really_slow_bcopy(src, dst, len);
- return;
+ xf86_really_slow_bcopy(src, dst, len);
+ return;
}
#endif
- while(len--)
- *dst++ = *src++;
+ while (len--)
+ *dst++ = *src++;
}
#ifdef __alpha__
@@ -76,42 +76,41 @@ unsigned long _bus_base(void);
void
xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count)
{
- if (useSparse())
- {
- unsigned long addr;
- long result;
-
- addr = (unsigned long) src;
- while (count) {
- result = *(volatile int *) addr;
- result >>= ((addr>>SPARSE) & 3) * 8;
- *dst++ = (unsigned char) (0xffUL & result);
- addr += 1<<SPARSE;
- count--;
- outb(0x80, 0x00);
- }
- }
- else
- xf86SlowBcopy(src, dst, count);
+ if (useSparse()) {
+ unsigned long addr;
+ long result;
+
+ addr = (unsigned long) src;
+ while (count) {
+ result = *(volatile int *) addr;
+ result >>= ((addr >> SPARSE) & 3) * 8;
+ *dst++ = (unsigned char) (0xffUL & result);
+ addr += 1 << SPARSE;
+ count--;
+ outb(0x80, 0x00);
+ }
+ }
+ else
+ xf86SlowBcopy(src, dst, count);
}
void
xf86SlowBCopyToBus(unsigned char *src, unsigned char *dst, int count)
{
- if (useSparse())
- {
- unsigned long addr;
-
- addr = (unsigned long) dst;
- while (count) {
- *(volatile unsigned int *) addr = (unsigned short)(*src) * 0x01010101;
- src++;
- addr += 1<<SPARSE;
- count--;
- outb(0x80, 0x00);
- }
- }
- else
- xf86SlowBcopy(src, dst, count);
+ if (useSparse()) {
+ unsigned long addr;
+
+ addr = (unsigned long) dst;
+ while (count) {
+ *(volatile unsigned int *) addr =
+ (unsigned short) (*src) * 0x01010101;
+ src++;
+ addr += 1 << SPARSE;
+ count--;
+ outb(0x80, 0x00);
+ }
+ }
+ else
+ xf86SlowBcopy(src, dst, count);
}
#endif
diff --git a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c
index b7b35d9db..e000dc9c8 100644
--- a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c
+++ b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c
@@ -38,41 +38,39 @@
#ifndef __alpha__
int
xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
+ int Len)
{
- int fd;
- unsigned char *ptr;
- int psize;
- int mlen;
-
- if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
- {
- xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- return -1;
- }
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
- MAP_SHARED, fd, (off_t)Base);
- if (ptr == MAP_FAILED)
- {
- xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed (%s)\n",
- DEV_MEM, strerror(errno));
- close(fd);
- return -1;
- }
- DebugF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
- Base, ptr[0] | (ptr[1] << 8));
- (void)memcpy(Buf, (void *)(ptr + Offset), Len);
- (void)munmap((caddr_t)ptr, mlen);
- (void)close(fd);
- return Len;
+ int fd;
+ unsigned char *ptr;
+ int psize;
+ int mlen;
+
+ if ((fd = open(DEV_MEM, O_RDONLY)) < 0) {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return -1;
+ }
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
+ MAP_SHARED, fd, (off_t) Base);
+ if (ptr == MAP_FAILED) {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed (%s)\n",
+ DEV_MEM, strerror(errno));
+ close(fd);
+ return -1;
+ }
+ DebugF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
+ Base, ptr[0] | (ptr[1] << 8));
+ (void) memcpy(Buf, (void *) (ptr + Offset), Len);
+ (void) munmap((caddr_t) ptr, mlen);
+ (void) close(fd);
+ return Len;
}
-#else /* __alpha__ */
+#else /* __alpha__ */
/*
* We trick "mmap" into mapping BUS memory for us via BUS_BASE,
@@ -88,50 +86,50 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
#ifdef linux
extern unsigned long _bus_base(void);
+
#define BUS_BASE _bus_base()
#else
extern u_int64_t dense_base(void);
+
#define BUS_BASE dense_base()
#endif
int
xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
+ int Len)
{
- caddr_t base;
- int fd;
- int psize;
- int mlen;
-
- if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
- {
- xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- base = mmap((caddr_t)0, mlen, PROT_READ,
- MAP_SHARED, fd, (off_t)(Base + BUS_BASE));
-
- if (base == MAP_FAILED)
- {
- xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to mmap %s (%s)\n",
- DEV_MEM, strerror(errno));
- return -1;
- }
-
- xf86SlowBCopyFromBus((unsigned char *)(base+Offset), Buf, Len);
-
- munmap((caddr_t)base, mlen);
- close(fd);
- return Len;
+ caddr_t base;
+ int fd;
+ int psize;
+ int mlen;
+
+ if ((fd = open(DEV_MEM, O_RDONLY)) < 0) {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return -1;
+ }
+
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ base = mmap((caddr_t) 0, mlen, PROT_READ,
+ MAP_SHARED, fd, (off_t) (Base + BUS_BASE));
+
+ if (base == MAP_FAILED) {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return -1;
+ }
+
+ xf86SlowBCopyFromBus((unsigned char *) (base + Offset), Buf, Len);
+
+ munmap((caddr_t) base, mlen);
+ close(fd);
+ return Len;
}
-#endif /* __alpha__ */
+#endif /* __alpha__ */
diff --git a/xorg-server/hw/xfree86/os-support/shared/kmod_noop.c b/xorg-server/hw/xfree86/os-support/shared/kmod_noop.c
index e86d7472f..0437bc564 100644
--- a/xorg-server/hw/xfree86/os-support/shared/kmod_noop.c
+++ b/xorg-server/hw/xfree86/os-support/shared/kmod_noop.c
@@ -31,8 +31,9 @@
#include "xf86_OSproc.h"
-int xf86LoadKernelModule(const char *pathname)
+int
+xf86LoadKernelModule(const char *pathname)
{
(void) pathname;
- return 0; /* failure */
+ return 0; /* failure */
}
diff --git a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
index cc12a31f2..ab3757a2a 100644
--- a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
+++ b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
@@ -61,458 +61,430 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
-static int
-GetBaud (int baudrate)
+static int
+GetBaud(int baudrate)
{
#ifdef B300
- if (baudrate == 300)
- return B300;
+ if (baudrate == 300)
+ return B300;
#endif
#ifdef B1200
- if (baudrate == 1200)
- return B1200;
+ if (baudrate == 1200)
+ return B1200;
#endif
#ifdef B2400
- if (baudrate == 2400)
- return B2400;
+ if (baudrate == 2400)
+ return B2400;
#endif
#ifdef B4800
- if (baudrate == 4800)
- return B4800;
+ if (baudrate == 4800)
+ return B4800;
#endif
#ifdef B9600
- if (baudrate == 9600)
- return B9600;
+ if (baudrate == 9600)
+ return B9600;
#endif
#ifdef B19200
- if (baudrate == 19200)
- return B19200;
+ if (baudrate == 19200)
+ return B19200;
#endif
#ifdef B38400
- if (baudrate == 38400)
- return B38400;
+ if (baudrate == 38400)
+ return B38400;
#endif
#ifdef B57600
- if (baudrate == 57600)
- return B57600;
+ if (baudrate == 57600)
+ return B57600;
#endif
#ifdef B115200
- if (baudrate == 115200)
- return B115200;
+ if (baudrate == 115200)
+ return B115200;
#endif
#ifdef B230400
- if (baudrate == 230400)
- return B230400;
+ if (baudrate == 230400)
+ return B230400;
#endif
#ifdef B460800
- if (baudrate == 460800)
- return B460800;
+ if (baudrate == 460800)
+ return B460800;
#endif
- return 0;
+ return 0;
}
int
-xf86OpenSerial (XF86OptionPtr options)
+xf86OpenSerial(XF86OptionPtr options)
{
- struct termios t;
- int fd, i;
- char *dev;
-
- dev = xf86SetStrOption (options, "Device", NULL);
- if (!dev)
- {
- xf86Msg (X_ERROR, "xf86OpenSerial: No Device specified.\n");
- return -1;
- }
-
- SYSCALL (fd = open (dev, O_RDWR | O_NONBLOCK));
- if (fd == -1)
- {
- xf86Msg (X_ERROR,
- "xf86OpenSerial: Cannot open device %s\n\t%s.\n",
- dev, strerror (errno));
- free(dev);
- return -1;
- }
-
- if (!isatty (fd))
- {
- /* Allow non-tty devices to be opened. */
- free(dev);
- return fd;
- }
-
- /* set up default port parameters */
- SYSCALL (tcgetattr (fd, &t));
- t.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR\
- |IGNCR|ICRNL|IXON);
- t.c_oflag &= ~OPOST;
- t.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
- t.c_cflag &= ~(CSIZE|PARENB);
- t.c_cflag |= CS8|CLOCAL;
-
- cfsetispeed (&t, B9600);
- cfsetospeed (&t, B9600);
- t.c_cc[VMIN] = 1;
- t.c_cc[VTIME] = 0;
-
- SYSCALL (tcsetattr (fd, TCSANOW, &t));
-
- if (xf86SetSerial (fd, options) == -1)
- {
- SYSCALL (close (fd));
- free(dev);
- return -1;
- }
-
- SYSCALL (i = fcntl (fd, F_GETFL, 0));
- if (i == -1)
- {
- SYSCALL (close (fd));
- free(dev);
- return -1;
- }
- i &= ~O_NONBLOCK;
- SYSCALL (i = fcntl (fd, F_SETFL, i));
- if (i == -1)
- {
- SYSCALL (close (fd));
- free(dev);
- return -1;
- }
- free(dev);
- return fd;
+ struct termios t;
+ int fd, i;
+ char *dev;
+
+ dev = xf86SetStrOption(options, "Device", NULL);
+ if (!dev) {
+ xf86Msg(X_ERROR, "xf86OpenSerial: No Device specified.\n");
+ return -1;
+ }
+
+ SYSCALL(fd = open(dev, O_RDWR | O_NONBLOCK));
+ if (fd == -1) {
+ xf86Msg(X_ERROR,
+ "xf86OpenSerial: Cannot open device %s\n\t%s.\n",
+ dev, strerror(errno));
+ free(dev);
+ return -1;
+ }
+
+ if (!isatty(fd)) {
+ /* Allow non-tty devices to be opened. */
+ free(dev);
+ return fd;
+ }
+
+ /* set up default port parameters */
+ SYSCALL(tcgetattr(fd, &t));
+ t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR
+ | IGNCR | ICRNL | IXON);
+ t.c_oflag &= ~OPOST;
+ t.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
+ t.c_cflag &= ~(CSIZE | PARENB);
+ t.c_cflag |= CS8 | CLOCAL;
+
+ cfsetispeed(&t, B9600);
+ cfsetospeed(&t, B9600);
+ t.c_cc[VMIN] = 1;
+ t.c_cc[VTIME] = 0;
+
+ SYSCALL(tcsetattr(fd, TCSANOW, &t));
+
+ if (xf86SetSerial(fd, options) == -1) {
+ SYSCALL(close(fd));
+ free(dev);
+ return -1;
+ }
+
+ SYSCALL(i = fcntl(fd, F_GETFL, 0));
+ if (i == -1) {
+ SYSCALL(close(fd));
+ free(dev);
+ return -1;
+ }
+ i &= ~O_NONBLOCK;
+ SYSCALL(i = fcntl(fd, F_SETFL, i));
+ if (i == -1) {
+ SYSCALL(close(fd));
+ free(dev);
+ return -1;
+ }
+ free(dev);
+ return fd;
}
int
-xf86SetSerial (int fd, XF86OptionPtr options)
+xf86SetSerial(int fd, XF86OptionPtr options)
{
- struct termios t;
- int val;
- const char *s;
- int baud, r;
-
- if (fd < 0)
- return -1;
-
- /* Don't try to set parameters for non-tty devices. */
- if (!isatty(fd))
- return 0;
-
- SYSCALL (tcgetattr (fd, &t));
-
- if ((val = xf86SetIntOption (options, "BaudRate", 0)))
- {
- if ((baud = GetBaud (val)))
- {
- cfsetispeed (&t, baud);
- cfsetospeed (&t, baud);
- }
- else
- {
- xf86Msg (X_ERROR,
- "Invalid Option BaudRate value: %d\n", val);
- return -1;
- }
- }
-
- if ((val = xf86SetIntOption (options, "StopBits", 0)))
- {
- switch (val)
- {
- case 1:
- t.c_cflag &= ~(CSTOPB);
- break;
- case 2:
- t.c_cflag |= CSTOPB;
- break;
- default:
- xf86Msg (X_ERROR,
- "Invalid Option StopBits value: %d\n", val);
- return -1;
- break;
- }
- }
-
- if ((val = xf86SetIntOption (options, "DataBits", 0)))
- {
- switch (val)
- {
- case 5:
- t.c_cflag &= ~(CSIZE);
- t.c_cflag |= CS5;
- break;
- case 6:
- t.c_cflag &= ~(CSIZE);
- t.c_cflag |= CS6;
- break;
- case 7:
- t.c_cflag &= ~(CSIZE);
- t.c_cflag |= CS7;
- break;
- case 8:
- t.c_cflag &= ~(CSIZE);
- t.c_cflag |= CS8;
- break;
- default:
- xf86Msg (X_ERROR,
- "Invalid Option DataBits value: %d\n", val);
- return -1;
- break;
- }
- }
-
- if ((s = xf86SetStrOption (options, "Parity", NULL)))
- {
- if (xf86NameCmp (s, "Odd") == 0)
- {
- t.c_cflag |= PARENB | PARODD;
- }
- else if (xf86NameCmp (s, "Even") == 0)
- {
- t.c_cflag |= PARENB;
- t.c_cflag &= ~(PARODD);
- }
- else if (xf86NameCmp (s, "None") == 0)
- {
- t.c_cflag &= ~(PARENB);
- }
- else
- {
- xf86Msg (X_ERROR, "Invalid Option Parity value: %s\n",
- s);
- return -1;
- }
- }
-
- if ((val = xf86SetIntOption (options, "Vmin", -1)) != -1)
- {
- t.c_cc[VMIN] = val;
- }
- if ((val = xf86SetIntOption (options, "Vtime", -1)) != -1)
- {
- t.c_cc[VTIME] = val;
- }
-
- if ((s = xf86SetStrOption (options, "FlowControl", NULL)))
- {
- xf86MarkOptionUsedByName (options, "FlowControl");
- if (xf86NameCmp (s, "Xoff") == 0)
- {
- t.c_iflag |= IXOFF;
- }
- else if (xf86NameCmp (s, "Xon") == 0)
- {
- t.c_iflag |= IXON;
- }
- else if (xf86NameCmp (s, "XonXoff") == 0)
- {
- t.c_iflag |= IXON|IXOFF;
- }
- else if (xf86NameCmp (s, "None") == 0)
- {
- t.c_iflag &= ~(IXON | IXOFF);
- }
- else
- {
- xf86Msg (X_ERROR,
- "Invalid Option FlowControl value: %s\n", s);
- return -1;
- }
- }
-
- if ((xf86SetBoolOption (options, "ClearDTR", FALSE)))
- {
+ struct termios t;
+ int val;
+ const char *s;
+ int baud, r;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+ SYSCALL(tcgetattr(fd, &t));
+
+ if ((val = xf86SetIntOption(options, "BaudRate", 0))) {
+ if ((baud = GetBaud(val))) {
+ cfsetispeed(&t, baud);
+ cfsetospeed(&t, baud);
+ }
+ else {
+ xf86Msg(X_ERROR, "Invalid Option BaudRate value: %d\n", val);
+ return -1;
+ }
+ }
+
+ if ((val = xf86SetIntOption(options, "StopBits", 0))) {
+ switch (val) {
+ case 1:
+ t.c_cflag &= ~(CSTOPB);
+ break;
+ case 2:
+ t.c_cflag |= CSTOPB;
+ break;
+ default:
+ xf86Msg(X_ERROR, "Invalid Option StopBits value: %d\n", val);
+ return -1;
+ break;
+ }
+ }
+
+ if ((val = xf86SetIntOption(options, "DataBits", 0))) {
+ switch (val) {
+ case 5:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS5;
+ break;
+ case 6:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS6;
+ break;
+ case 7:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS7;
+ break;
+ case 8:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS8;
+ break;
+ default:
+ xf86Msg(X_ERROR, "Invalid Option DataBits value: %d\n", val);
+ return -1;
+ break;
+ }
+ }
+
+ if ((s = xf86SetStrOption(options, "Parity", NULL))) {
+ if (xf86NameCmp(s, "Odd") == 0) {
+ t.c_cflag |= PARENB | PARODD;
+ }
+ else if (xf86NameCmp(s, "Even") == 0) {
+ t.c_cflag |= PARENB;
+ t.c_cflag &= ~(PARODD);
+ }
+ else if (xf86NameCmp(s, "None") == 0) {
+ t.c_cflag &= ~(PARENB);
+ }
+ else {
+ xf86Msg(X_ERROR, "Invalid Option Parity value: %s\n", s);
+ return -1;
+ }
+ }
+
+ if ((val = xf86SetIntOption(options, "Vmin", -1)) != -1) {
+ t.c_cc[VMIN] = val;
+ }
+ if ((val = xf86SetIntOption(options, "Vtime", -1)) != -1) {
+ t.c_cc[VTIME] = val;
+ }
+
+ if ((s = xf86SetStrOption(options, "FlowControl", NULL))) {
+ xf86MarkOptionUsedByName(options, "FlowControl");
+ if (xf86NameCmp(s, "Xoff") == 0) {
+ t.c_iflag |= IXOFF;
+ }
+ else if (xf86NameCmp(s, "Xon") == 0) {
+ t.c_iflag |= IXON;
+ }
+ else if (xf86NameCmp(s, "XonXoff") == 0) {
+ t.c_iflag |= IXON | IXOFF;
+ }
+ else if (xf86NameCmp(s, "None") == 0) {
+ t.c_iflag &= ~(IXON | IXOFF);
+ }
+ else {
+ xf86Msg(X_ERROR, "Invalid Option FlowControl value: %s\n", s);
+ return -1;
+ }
+ }
+
+ if ((xf86SetBoolOption(options, "ClearDTR", FALSE))) {
#ifdef CLEARDTR_SUPPORT
-# if defined(TIOCMBIC)
- val = TIOCM_DTR;
- SYSCALL (ioctl(fd, TIOCMBIC, &val));
-# else
- SYSCALL (ioctl(fd, TIOCCDTR, NULL));
-# endif
+#if defined(TIOCMBIC)
+ val = TIOCM_DTR;
+ SYSCALL(ioctl(fd, TIOCMBIC, &val));
+#else
+ SYSCALL(ioctl(fd, TIOCCDTR, NULL));
+#endif
#else
- xf86Msg (X_WARNING,
- "Option ClearDTR not supported on this OS\n");
- return -1;
+ xf86Msg(X_WARNING, "Option ClearDTR not supported on this OS\n");
+ return -1;
#endif
- xf86MarkOptionUsedByName (options, "ClearDTR");
- }
-
- if ((xf86SetBoolOption (options, "ClearRTS", FALSE)))
- {
- xf86Msg (X_WARNING,
- "Option ClearRTS not supported on this OS\n");
- return -1;
- xf86MarkOptionUsedByName (options, "ClearRTS");
- }
-
- SYSCALL (r = tcsetattr (fd, TCSANOW, &t));
- return r;
+ xf86MarkOptionUsedByName(options, "ClearDTR");
+ }
+
+ if ((xf86SetBoolOption(options, "ClearRTS", FALSE))) {
+ xf86Msg(X_WARNING, "Option ClearRTS not supported on this OS\n");
+ return -1;
+ xf86MarkOptionUsedByName(options, "ClearRTS");
+ }
+
+ SYSCALL(r = tcsetattr(fd, TCSANOW, &t));
+ return r;
}
int
-xf86SetSerialSpeed (int fd, int speed)
+xf86SetSerialSpeed(int fd, int speed)
{
- struct termios t;
- int baud, r;
-
- if (fd < 0)
- return -1;
-
- /* Don't try to set parameters for non-tty devices. */
- if (!isatty(fd))
- return 0;
-
- SYSCALL (tcgetattr (fd, &t));
-
- if ((baud = GetBaud (speed)))
- {
- cfsetispeed (&t, baud);
- cfsetospeed (&t, baud);
- }
- else
- {
- xf86Msg (X_ERROR,
- "Invalid Option BaudRate value: %d\n", speed);
- return -1;
- }
-
- SYSCALL (r = tcsetattr (fd, TCSANOW, &t));
- return r;
+ struct termios t;
+ int baud, r;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+ SYSCALL(tcgetattr(fd, &t));
+
+ if ((baud = GetBaud(speed))) {
+ cfsetispeed(&t, baud);
+ cfsetospeed(&t, baud);
+ }
+ else {
+ xf86Msg(X_ERROR, "Invalid Option BaudRate value: %d\n", speed);
+ return -1;
+ }
+
+ SYSCALL(r = tcsetattr(fd, TCSANOW, &t));
+ return r;
}
int
-xf86ReadSerial (int fd, void *buf, int count)
+xf86ReadSerial(int fd, void *buf, int count)
{
- int r;
- int i;
-
- SYSCALL (r = read (fd, buf, count));
- DebugF("ReadingSerial: 0x%x",
- (unsigned char)*(((unsigned char *)buf)));
- for (i = 1; i < r; i++)
- DebugF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i));
- DebugF("\n");
- return r;
+ int r;
+ int i;
+
+ SYSCALL(r = read(fd, buf, count));
+ DebugF("ReadingSerial: 0x%x", (unsigned char) *(((unsigned char *) buf)));
+ for (i = 1; i < r; i++)
+ DebugF(", 0x%x", (unsigned char) *(((unsigned char *) buf) + i));
+ DebugF("\n");
+ return r;
}
int
-xf86WriteSerial (int fd, const void *buf, int count)
+xf86WriteSerial(int fd, const void *buf, int count)
{
- int r;
- int i;
-
- DebugF("WritingSerial: 0x%x",(unsigned char)*(((unsigned char *)buf)));
- for (i = 1; i < count; i++)
- DebugF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i));
- DebugF("\n");
- SYSCALL (r = write (fd, buf, count));
- return r;
+ int r;
+ int i;
+
+ DebugF("WritingSerial: 0x%x", (unsigned char) *(((unsigned char *) buf)));
+ for (i = 1; i < count; i++)
+ DebugF(", 0x%x", (unsigned char) *(((unsigned char *) buf) + i));
+ DebugF("\n");
+ SYSCALL(r = write(fd, buf, count));
+ return r;
}
int
-xf86CloseSerial (int fd)
+xf86CloseSerial(int fd)
{
- int r;
+ int r;
- SYSCALL (r = close (fd));
- return r;
+ SYSCALL(r = close(fd));
+ return r;
}
int
-xf86WaitForInput (int fd, int timeout)
+xf86WaitForInput(int fd, int timeout)
{
- fd_set readfds;
- struct timeval to;
- int r;
-
- FD_ZERO(&readfds);
-
- if (fd >= 0) {
- FD_SET(fd, &readfds);
- }
-
- to.tv_sec = timeout / 1000000;
- to.tv_usec = timeout % 1000000;
-
- if (fd >= 0) {
- SYSCALL (r = select (FD_SETSIZE, &readfds, NULL, NULL, &to));
- }
- else {
- SYSCALL (r = select (FD_SETSIZE, NULL, NULL, NULL, &to));
- }
- xf86ErrorFVerb (9,"select returned %d\n", r);
- return r;
+ fd_set readfds;
+ struct timeval to;
+ int r;
+
+ FD_ZERO(&readfds);
+
+ if (fd >= 0) {
+ FD_SET(fd, &readfds);
+ }
+
+ to.tv_sec = timeout / 1000000;
+ to.tv_usec = timeout % 1000000;
+
+ if (fd >= 0) {
+ SYSCALL(r = select(FD_SETSIZE, &readfds, NULL, NULL, &to));
+ }
+ else {
+ SYSCALL(r = select(FD_SETSIZE, NULL, NULL, NULL, &to));
+ }
+ xf86ErrorFVerb(9, "select returned %d\n", r);
+ return r;
}
int
-xf86SerialSendBreak (int fd, int duration)
+xf86SerialSendBreak(int fd, int duration)
{
- int r;
+ int r;
+
+ SYSCALL(r = tcsendbreak(fd, duration));
+ return r;
- SYSCALL (r = tcsendbreak (fd, duration));
- return r;
-
}
int
xf86FlushInput(int fd)
{
- fd_set fds;
- struct timeval timeout;
- char c[4];
-
- DebugF("FlushingSerial\n");
- if (tcflush(fd, TCIFLUSH) == 0)
- return 0;
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
- while (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) > 0) {
- if (read(fd, &c, sizeof(c)) < 1)
- return 0;
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
- }
- return 0;
+ fd_set fds;
+ struct timeval timeout;
+ char c[4];
+
+ DebugF("FlushingSerial\n");
+ if (tcflush(fd, TCIFLUSH) == 0)
+ return 0;
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ while (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) > 0) {
+ if (read(fd, &c, sizeof(c)) < 1)
+ return 0;
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ }
+ return 0;
}
static struct states {
- int xf;
- int os;
+ int xf;
+ int os;
} modemStates[] = {
#ifdef TIOCM_LE
- { XF86_M_LE, TIOCM_LE },
+ {
+ XF86_M_LE, TIOCM_LE},
#endif
#ifdef TIOCM_DTR
- { XF86_M_DTR, TIOCM_DTR },
+ {
+ XF86_M_DTR, TIOCM_DTR},
#endif
#ifdef TIOCM_RTS
- { XF86_M_RTS, TIOCM_RTS },
+ {
+ XF86_M_RTS, TIOCM_RTS},
#endif
#ifdef TIOCM_ST
- { XF86_M_ST, TIOCM_ST },
+ {
+ XF86_M_ST, TIOCM_ST},
#endif
#ifdef TIOCM_SR
- { XF86_M_SR, TIOCM_SR },
+ {
+ XF86_M_SR, TIOCM_SR},
#endif
#ifdef TIOCM_CTS
- { XF86_M_CTS, TIOCM_CTS },
+ {
+ XF86_M_CTS, TIOCM_CTS},
#endif
#ifdef TIOCM_CAR
- { XF86_M_CAR, TIOCM_CAR },
+ {
+ XF86_M_CAR, TIOCM_CAR},
#elif defined(TIOCM_CD)
- { XF86_M_CAR, TIOCM_CD },
+ {
+ XF86_M_CAR, TIOCM_CD},
#endif
#ifdef TIOCM_RNG
- { XF86_M_RNG, TIOCM_RNG },
+ {
+ XF86_M_RNG, TIOCM_RNG},
#elif defined(TIOCM_RI)
- { XF86_M_CAR, TIOCM_RI },
+ {
+ XF86_M_CAR, TIOCM_RI},
#endif
#ifdef TIOCM_DSR
- { XF86_M_DSR, TIOCM_DSR },
+ {
+ XF86_M_DSR, TIOCM_DSR},
#endif
};
@@ -521,35 +493,36 @@ static int numStates = sizeof(modemStates) / sizeof(modemStates[0]);
static int
xf2osState(int state)
{
- int i;
- int ret = 0;
+ int i;
+ int ret = 0;
- for (i = 0; i < numStates; i++)
- if (state & modemStates[i].xf)
- ret |= modemStates[i].os;
- return ret;
+ for (i = 0; i < numStates; i++)
+ if (state & modemStates[i].xf)
+ ret |= modemStates[i].os;
+ return ret;
}
static int
os2xfState(int state)
{
- int i;
- int ret = 0;
+ int i;
+ int ret = 0;
- for (i = 0; i < numStates; i++)
- if (state & modemStates[i].os)
- ret |= modemStates[i].xf;
- return ret;
+ for (i = 0; i < numStates; i++)
+ if (state & modemStates[i].os)
+ ret |= modemStates[i].xf;
+ return ret;
}
static int
getOsStateMask(void)
{
- int i;
- int ret = 0;
- for (i = 0; i < numStates; i++)
- ret |= modemStates[i].os;
- return ret;
+ int i;
+ int ret = 0;
+
+ for (i = 0; i < numStates; i++)
+ ret |= modemStates[i].os;
+ return ret;
}
static int osStateMask = 0;
@@ -557,99 +530,99 @@ static int osStateMask = 0;
int
xf86SetSerialModemState(int fd, int state)
{
- int ret;
- int s;
+ int ret;
+ int s;
- if (fd < 0)
- return -1;
+ if (fd < 0)
+ return -1;
- /* Don't try to set parameters for non-tty devices. */
- if (!isatty(fd))
- return 0;
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
#ifndef TIOCMGET
- return -1;
+ return -1;
#else
- if (!osStateMask)
- osStateMask = getOsStateMask();
-
- state = xf2osState(state);
- SYSCALL((ret = ioctl(fd, TIOCMGET, &s)));
- if (ret < 0)
- return -1;
- s &= ~osStateMask;
- s |= state;
- SYSCALL((ret = ioctl(fd, TIOCMSET, &s)));
- if (ret < 0)
- return -1;
- else
- return 0;
+ if (!osStateMask)
+ osStateMask = getOsStateMask();
+
+ state = xf2osState(state);
+ SYSCALL((ret = ioctl(fd, TIOCMGET, &s)));
+ if (ret < 0)
+ return -1;
+ s &= ~osStateMask;
+ s |= state;
+ SYSCALL((ret = ioctl(fd, TIOCMSET, &s)));
+ if (ret < 0)
+ return -1;
+ else
+ return 0;
#endif
}
int
xf86GetSerialModemState(int fd)
{
- int ret;
- int s;
+ int ret;
+ int s;
- if (fd < 0)
- return -1;
+ if (fd < 0)
+ return -1;
- /* Don't try to set parameters for non-tty devices. */
- if (!isatty(fd))
- return 0;
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
#ifndef TIOCMGET
- return -1;
+ return -1;
#else
- SYSCALL((ret = ioctl(fd, TIOCMGET, &s)));
- if (ret < 0)
- return -1;
- return os2xfState(s);
+ SYSCALL((ret = ioctl(fd, TIOCMGET, &s)));
+ if (ret < 0)
+ return -1;
+ return os2xfState(s);
#endif
}
int
xf86SerialModemSetBits(int fd, int bits)
{
- int ret;
- int s;
+ int ret;
+ int s;
- if (fd < 0)
- return -1;
+ if (fd < 0)
+ return -1;
- /* Don't try to set parameters for non-tty devices. */
- if (!isatty(fd))
- return 0;
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
#ifndef TIOCMGET
- return -1;
+ return -1;
#else
- s = xf2osState(bits);
- SYSCALL((ret = ioctl(fd, TIOCMBIS, &s)));
- return ret;
+ s = xf2osState(bits);
+ SYSCALL((ret = ioctl(fd, TIOCMBIS, &s)));
+ return ret;
#endif
}
int
xf86SerialModemClearBits(int fd, int bits)
{
- int ret;
- int s;
+ int ret;
+ int s;
- if (fd < 0)
- return -1;
+ if (fd < 0)
+ return -1;
- /* Don't try to set parameters for non-tty devices. */
- if (!isatty(fd))
- return 0;
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
#ifndef TIOCMGET
- return -1;
+ return -1;
#else
- s = xf2osState(bits);
- SYSCALL((ret = ioctl(fd, TIOCMBIC, &s)));
- return ret;
+ s = xf2osState(bits);
+ SYSCALL((ret = ioctl(fd, TIOCMBIC, &s)));
+ return ret;
#endif
}
diff --git a/xorg-server/hw/xfree86/os-support/shared/sigio.c b/xorg-server/hw/xfree86/os-support/shared/sigio.c
index ef04c1140..12ae8a480 100644
--- a/xorg-server/hw/xfree86/os-support/shared/sigio.c
+++ b/xorg-server/hw/xfree86/os-support/shared/sigio.c
@@ -1,309 +1,301 @@
-/* sigio.c -- Support for SIGIO handler installation and removal
- * Created: Thu Jun 3 15:39:18 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
- */
-/*
- * Copyright (c) 2002 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-# include <X11/X.h>
-# include "xf86.h"
-# include "xf86Priv.h"
-# include "xf86_OSlib.h"
-# include "inputstr.h"
-
-#ifdef HAVE_STROPTS_H
-# include <stropts.h>
-#endif
-
-#ifdef MAXDEVICES
-/* MAXDEVICES represents the maximimum number of input devices usable
- * at the same time plus one entry for DRM support.
- */
-# define MAX_FUNCS (MAXDEVICES + 1)
-#else
-# define MAX_FUNCS 16
-#endif
-
-typedef struct _xf86SigIOFunc {
- void (*f) (int, void *);
- int fd;
- void *closure;
-} Xf86SigIOFunc;
-
-static Xf86SigIOFunc xf86SigIOFuncs[MAX_FUNCS];
-static int xf86SigIOMax;
-static int xf86SigIOMaxFd;
-static fd_set xf86SigIOMask;
-
-/*
- * SIGIO gives no way of discovering which fd signalled, select
- * to discover
- */
-static void
-xf86SIGIO (int sig)
-{
- int i;
- fd_set ready;
- struct timeval to;
- int save_errno = errno; /* do not clobber the global errno */
- int r;
-
- ready = xf86SigIOMask;
- to.tv_sec = 0;
- to.tv_usec = 0;
- SYSCALL (r = select (xf86SigIOMaxFd, &ready, 0, 0, &to));
- for (i = 0; r > 0 && i < xf86SigIOMax; i++)
- if (xf86SigIOFuncs[i].f && FD_ISSET (xf86SigIOFuncs[i].fd, &ready))
- {
- (*xf86SigIOFuncs[i].f)(xf86SigIOFuncs[i].fd,
- xf86SigIOFuncs[i].closure);
- r--;
- }
- if (r > 0) {
- xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
- }
- /* restore global errno */
- errno = save_errno;
-}
-
-static int
-xf86IsPipe (int fd)
-{
- struct stat buf;
-
- if (fstat (fd, &buf) < 0)
- return 0;
- return S_ISFIFO(buf.st_mode);
-}
-
-int
-xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
-{
- struct sigaction sa;
- struct sigaction osa;
- int i;
- int blocked;
- int installed = FALSE;
-
- if (!xf86Info.useSIGIO)
- return 0;
-
- for (i = 0; i < MAX_FUNCS; i++)
- {
- if (!xf86SigIOFuncs[i].f)
- {
- if (xf86IsPipe (fd))
- return 0;
- blocked = xf86BlockSIGIO();
-#ifdef O_ASYNC
- if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
- xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n",
- fd, strerror(errno));
- } else {
- if (fcntl(fd, F_SETOWN, getpid()) == -1) {
- xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n",
- fd, strerror(errno));
- } else {
- installed = TRUE;
- }
- }
-#endif
-#ifdef I_SETSIG /* System V Streams - used on Solaris for input devices */
- if (!installed && isastream(fd)) {
- if (ioctl(fd, I_SETSIG, S_INPUT | S_ERROR | S_HANGUP) == -1) {
- xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG): %s\n",
- fd, strerror(errno));
- } else {
- installed = TRUE;
- }
- }
-#endif
- if (!installed) {
- xf86UnblockSIGIO(blocked);
- return 0;
- }
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGIO);
- sa.sa_flags = 0;
- sa.sa_handler = xf86SIGIO;
- sigaction(SIGIO, &sa, &osa);
- xf86SigIOFuncs[i].fd = fd;
- xf86SigIOFuncs[i].closure = closure;
- xf86SigIOFuncs[i].f = f;
- if (i >= xf86SigIOMax)
- xf86SigIOMax = i+1;
- if (fd >= xf86SigIOMaxFd)
- xf86SigIOMaxFd = fd + 1;
- FD_SET (fd, &xf86SigIOMask);
- xf86UnblockSIGIO(blocked);
- return 1;
- }
- /* Allow overwriting of the closure and callback */
- else if (xf86SigIOFuncs[i].fd == fd)
- {
- xf86SigIOFuncs[i].closure = closure;
- xf86SigIOFuncs[i].f = f;
- return 1;
- }
- }
- return 0;
-}
-
-int
-xf86RemoveSIGIOHandler(int fd)
-{
- struct sigaction sa;
- struct sigaction osa;
- int i;
- int max;
- int maxfd;
- int ret;
-
- if (!xf86Info.useSIGIO)
- return 0;
-
- max = 0;
- maxfd = -1;
- ret = 0;
- for (i = 0; i < MAX_FUNCS; i++)
- {
- if (xf86SigIOFuncs[i].f)
- {
- if (xf86SigIOFuncs[i].fd == fd)
- {
- xf86SigIOFuncs[i].f = 0;
- xf86SigIOFuncs[i].fd = 0;
- xf86SigIOFuncs[i].closure = 0;
- FD_CLR (fd, &xf86SigIOMask);
- ret = 1;
- }
- else
- {
- max = i + 1;
- if (xf86SigIOFuncs[i].fd >= maxfd)
- maxfd = xf86SigIOFuncs[i].fd + 1;
- }
- }
- }
- if (ret)
- {
-#ifdef O_ASYNC
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC);
-#endif
-#ifdef I_SETSIG
- if (isastream(fd)) {
- if (ioctl(fd, I_SETSIG, 0) == -1) {
- xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG, 0): %s\n",
- fd, strerror(errno));
- }
- }
-#endif
- xf86SigIOMax = max;
- xf86SigIOMaxFd = maxfd;
- if (!max)
- {
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGIO);
- sa.sa_flags = 0;
- sa.sa_handler = SIG_IGN;
- sigaction(SIGIO, &sa, &osa);
- }
- }
- return ret;
-}
-
-int
-xf86BlockSIGIO (void)
-{
- sigset_t set, old;
- int ret;
-
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_BLOCK, &set, &old);
- ret = sigismember (&old, SIGIO);
- return ret;
-}
-
-void
-xf86UnblockSIGIO (int wasset)
-{
- sigset_t set;
-
- if (!wasset)
- {
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_UNBLOCK, &set, NULL);
- }
-}
-
-void
-xf86AssertBlockedSIGIO (char *where)
-{
- sigset_t set, old;
-
- sigemptyset (&set);
- sigprocmask (SIG_BLOCK, &set, &old);
- if (!sigismember (&old, SIGIO))
- xf86Msg (X_ERROR, "SIGIO not blocked at %s\n", where);
-}
-
-/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */
-
-int
-xf86SIGIOSupported (void)
-{
- return 1;
-}
+/* sigio.c -- Support for SIGIO handler installation and removal
+ * Created: Thu Jun 3 15:39:18 1999 by faith@precisioninsight.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ */
+/*
+ * Copyright (c) 2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "inputstr.h"
+
+#ifdef HAVE_STROPTS_H
+#include <stropts.h>
+#endif
+
+#ifdef MAXDEVICES
+/* MAXDEVICES represents the maximimum number of input devices usable
+ * at the same time plus one entry for DRM support.
+ */
+#define MAX_FUNCS (MAXDEVICES + 1)
+#else
+#define MAX_FUNCS 16
+#endif
+
+typedef struct _xf86SigIOFunc {
+ void (*f) (int, void *);
+ int fd;
+ void *closure;
+} Xf86SigIOFunc;
+
+static Xf86SigIOFunc xf86SigIOFuncs[MAX_FUNCS];
+static int xf86SigIOMax;
+static int xf86SigIOMaxFd;
+static fd_set xf86SigIOMask;
+
+/*
+ * SIGIO gives no way of discovering which fd signalled, select
+ * to discover
+ */
+static void
+xf86SIGIO(int sig)
+{
+ int i;
+ fd_set ready;
+ struct timeval to;
+ int save_errno = errno; /* do not clobber the global errno */
+ int r;
+
+ ready = xf86SigIOMask;
+ to.tv_sec = 0;
+ to.tv_usec = 0;
+ SYSCALL(r = select(xf86SigIOMaxFd, &ready, 0, 0, &to));
+ for (i = 0; r > 0 && i < xf86SigIOMax; i++)
+ if (xf86SigIOFuncs[i].f && FD_ISSET(xf86SigIOFuncs[i].fd, &ready)) {
+ (*xf86SigIOFuncs[i].f) (xf86SigIOFuncs[i].fd,
+ xf86SigIOFuncs[i].closure);
+ r--;
+ }
+ if (r > 0) {
+ xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
+ }
+ /* restore global errno */
+ errno = save_errno;
+}
+
+static int
+xf86IsPipe(int fd)
+{
+ struct stat buf;
+
+ if (fstat(fd, &buf) < 0)
+ return 0;
+ return S_ISFIFO(buf.st_mode);
+}
+
+int
+xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure)
+{
+ struct sigaction sa;
+ struct sigaction osa;
+ int i;
+ int blocked;
+ int installed = FALSE;
+
+ if (!xf86Info.useSIGIO)
+ return 0;
+
+ for (i = 0; i < MAX_FUNCS; i++) {
+ if (!xf86SigIOFuncs[i].f) {
+ if (xf86IsPipe(fd))
+ return 0;
+ blocked = xf86BlockSIGIO();
+#ifdef O_ASYNC
+ if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
+ xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n",
+ fd, strerror(errno));
+ }
+ else {
+ if (fcntl(fd, F_SETOWN, getpid()) == -1) {
+ xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n",
+ fd, strerror(errno));
+ }
+ else {
+ installed = TRUE;
+ }
+ }
+#endif
+#ifdef I_SETSIG /* System V Streams - used on Solaris for input devices */
+ if (!installed && isastream(fd)) {
+ if (ioctl(fd, I_SETSIG, S_INPUT | S_ERROR | S_HANGUP) == -1) {
+ xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG): %s\n",
+ fd, strerror(errno));
+ }
+ else {
+ installed = TRUE;
+ }
+ }
+#endif
+ if (!installed) {
+ xf86UnblockSIGIO(blocked);
+ return 0;
+ }
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, SIGIO);
+ sa.sa_flags = 0;
+ sa.sa_handler = xf86SIGIO;
+ sigaction(SIGIO, &sa, &osa);
+ xf86SigIOFuncs[i].fd = fd;
+ xf86SigIOFuncs[i].closure = closure;
+ xf86SigIOFuncs[i].f = f;
+ if (i >= xf86SigIOMax)
+ xf86SigIOMax = i + 1;
+ if (fd >= xf86SigIOMaxFd)
+ xf86SigIOMaxFd = fd + 1;
+ FD_SET(fd, &xf86SigIOMask);
+ xf86UnblockSIGIO(blocked);
+ return 1;
+ }
+ /* Allow overwriting of the closure and callback */
+ else if (xf86SigIOFuncs[i].fd == fd) {
+ xf86SigIOFuncs[i].closure = closure;
+ xf86SigIOFuncs[i].f = f;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int
+xf86RemoveSIGIOHandler(int fd)
+{
+ struct sigaction sa;
+ struct sigaction osa;
+ int i;
+ int max;
+ int maxfd;
+ int ret;
+
+ if (!xf86Info.useSIGIO)
+ return 0;
+
+ max = 0;
+ maxfd = -1;
+ ret = 0;
+ for (i = 0; i < MAX_FUNCS; i++) {
+ if (xf86SigIOFuncs[i].f) {
+ if (xf86SigIOFuncs[i].fd == fd) {
+ xf86SigIOFuncs[i].f = 0;
+ xf86SigIOFuncs[i].fd = 0;
+ xf86SigIOFuncs[i].closure = 0;
+ FD_CLR(fd, &xf86SigIOMask);
+ ret = 1;
+ }
+ else {
+ max = i + 1;
+ if (xf86SigIOFuncs[i].fd >= maxfd)
+ maxfd = xf86SigIOFuncs[i].fd + 1;
+ }
+ }
+ }
+ if (ret) {
+#ifdef O_ASYNC
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC);
+#endif
+#ifdef I_SETSIG
+ if (isastream(fd)) {
+ if (ioctl(fd, I_SETSIG, 0) == -1) {
+ xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG, 0): %s\n",
+ fd, strerror(errno));
+ }
+ }
+#endif
+ xf86SigIOMax = max;
+ xf86SigIOMaxFd = maxfd;
+ if (!max) {
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, SIGIO);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGIO, &sa, &osa);
+ }
+ }
+ return ret;
+}
+
+int
+xf86BlockSIGIO(void)
+{
+ sigset_t set, old;
+ int ret;
+
+ sigemptyset(&set);
+ sigaddset(&set, SIGIO);
+ sigprocmask(SIG_BLOCK, &set, &old);
+ ret = sigismember(&old, SIGIO);
+ return ret;
+}
+
+void
+xf86UnblockSIGIO(int wasset)
+{
+ sigset_t set;
+
+ if (!wasset) {
+ sigemptyset(&set);
+ sigaddset(&set, SIGIO);
+ sigprocmask(SIG_UNBLOCK, &set, NULL);
+ }
+}
+
+void
+xf86AssertBlockedSIGIO(char *where)
+{
+ sigset_t set, old;
+
+ sigemptyset(&set);
+ sigprocmask(SIG_BLOCK, &set, &old);
+ if (!sigismember(&old, SIGIO))
+ xf86Msg(X_ERROR, "SIGIO not blocked at %s\n", where);
+}
+
+/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */
+
+int
+xf86SIGIOSupported(void)
+{
+ return 1;
+}
diff --git a/xorg-server/hw/xfree86/os-support/shared/vidmem.c b/xorg-server/hw/xfree86/os-support/shared/vidmem.c
index 54f6c6497..a7717d8f6 100644
--- a/xorg-server/hw/xfree86/os-support/shared/vidmem.c
+++ b/xorg-server/hw/xfree86/os-support/shared/vidmem.c
@@ -25,7 +25,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@@ -51,240 +50,236 @@
*/
typedef struct {
- unsigned long size;
- pointer virtBase;
- pointer mtrrInfo;
+ unsigned long size;
+ pointer virtBase;
+ pointer mtrrInfo;
} MappingRec, *MappingPtr;
-
+
typedef struct {
- int numMappings;
- MappingPtr * mappings;
- Bool mtrrEnabled;
- MessageType mtrrFrom;
- Bool mtrrOptChecked;
- ScrnInfoPtr pScrn;
+ int numMappings;
+ MappingPtr *mappings;
+ Bool mtrrEnabled;
+ MessageType mtrrFrom;
+ Bool mtrrOptChecked;
+ ScrnInfoPtr pScrn;
} VidMapRec, *VidMapPtr;
static int vidMapIndex = -1;
#define VIDMAPPTR(p) ((VidMapPtr)((p)->privates[vidMapIndex].ptr))
-static VidMemInfo vidMemInfo = {FALSE, };
-static VidMapRec vidMapRec = {0, NULL, TRUE, X_DEFAULT, FALSE, NULL};
+static VidMemInfo vidMemInfo = { FALSE, };
+static VidMapRec vidMapRec = { 0, NULL, TRUE, X_DEFAULT, FALSE, NULL };
static VidMapPtr
getVidMapRec(int scrnIndex)
{
- VidMapPtr vp;
- ScrnInfoPtr pScrn;
+ VidMapPtr vp;
+ ScrnInfoPtr pScrn;
- if ((scrnIndex < 0) ||
- !(pScrn = xf86Screens[scrnIndex]))
- return &vidMapRec;
+ if ((scrnIndex < 0) || !(pScrn = xf86Screens[scrnIndex]))
+ return &vidMapRec;
- if (vidMapIndex < 0)
- vidMapIndex = xf86AllocateScrnInfoPrivateIndex();
+ if (vidMapIndex < 0)
+ vidMapIndex = xf86AllocateScrnInfoPrivateIndex();
- if (VIDMAPPTR(pScrn) != NULL)
- return VIDMAPPTR(pScrn);
+ if (VIDMAPPTR(pScrn) != NULL)
+ return VIDMAPPTR(pScrn);
- vp = pScrn->privates[vidMapIndex].ptr = xnfcalloc(sizeof(VidMapRec), 1);
- vp->mtrrEnabled = TRUE; /* default to enabled */
- vp->mtrrFrom = X_DEFAULT;
- vp->mtrrOptChecked = FALSE;
- vp->pScrn = pScrn;
- return vp;
+ vp = pScrn->privates[vidMapIndex].ptr = xnfcalloc(sizeof(VidMapRec), 1);
+ vp->mtrrEnabled = TRUE; /* default to enabled */
+ vp->mtrrFrom = X_DEFAULT;
+ vp->mtrrOptChecked = FALSE;
+ vp->pScrn = pScrn;
+ return vp;
}
static MappingPtr
newMapping(VidMapPtr vp)
{
- vp->mappings = xnfrealloc(vp->mappings, sizeof(MappingPtr) *
- (vp->numMappings + 1));
- vp->mappings[vp->numMappings] = xnfcalloc(sizeof(MappingRec), 1);
- return vp->mappings[vp->numMappings++];
+ vp->mappings = xnfrealloc(vp->mappings, sizeof(MappingPtr) *
+ (vp->numMappings + 1));
+ vp->mappings[vp->numMappings] = xnfcalloc(sizeof(MappingRec), 1);
+ return vp->mappings[vp->numMappings++];
}
static MappingPtr
findMapping(VidMapPtr vp, pointer vbase, unsigned long size)
{
- int i;
-
- for (i = 0; i < vp->numMappings; i++) {
- if (vp->mappings[i]->virtBase == vbase &&
- vp->mappings[i]->size == size)
- return vp->mappings[i];
- }
- return NULL;
+ int i;
+
+ for (i = 0; i < vp->numMappings; i++) {
+ if (vp->mappings[i]->virtBase == vbase && vp->mappings[i]->size == size)
+ return vp->mappings[i];
+ }
+ return NULL;
}
static void
removeMapping(VidMapPtr vp, MappingPtr mp)
{
- int i, found = 0;
-
- for (i = 0; i < vp->numMappings; i++) {
- if (vp->mappings[i] == mp) {
- found = 1;
- free(vp->mappings[i]);
- } else if (found) {
- vp->mappings[i - 1] = vp->mappings[i];
- }
- }
- vp->numMappings--;
- vp->mappings[vp->numMappings] = NULL;
+ int i, found = 0;
+
+ for (i = 0; i < vp->numMappings; i++) {
+ if (vp->mappings[i] == mp) {
+ found = 1;
+ free(vp->mappings[i]);
+ }
+ else if (found) {
+ vp->mappings[i - 1] = vp->mappings[i];
+ }
+ }
+ vp->numMappings--;
+ vp->mappings[vp->numMappings] = NULL;
}
enum { OPTION_MTRR };
-static const OptionInfoRec opts[] =
-{
- { OPTION_MTRR, "mtrr", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE }
+
+static const OptionInfoRec opts[] = {
+ {OPTION_MTRR, "mtrr", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE}
};
static void
checkMtrrOption(VidMapPtr vp)
{
- if (!vp->mtrrOptChecked && vp->pScrn && vp->pScrn->options != NULL) {
- OptionInfoPtr options;
-
- options = xnfalloc(sizeof(opts));
- (void)memcpy(options, opts, sizeof(opts));
- xf86ProcessOptions(vp->pScrn->scrnIndex, vp->pScrn->options,
- options);
- if (xf86GetOptValBool(options, OPTION_MTRR, &vp->mtrrEnabled))
- vp->mtrrFrom = X_CONFIG;
- free(options);
- vp->mtrrOptChecked = TRUE;
- }
+ if (!vp->mtrrOptChecked && vp->pScrn && vp->pScrn->options != NULL) {
+ OptionInfoPtr options;
+
+ options = xnfalloc(sizeof(opts));
+ (void) memcpy(options, opts, sizeof(opts));
+ xf86ProcessOptions(vp->pScrn->scrnIndex, vp->pScrn->options, options);
+ if (xf86GetOptValBool(options, OPTION_MTRR, &vp->mtrrEnabled))
+ vp->mtrrFrom = X_CONFIG;
+ free(options);
+ vp->mtrrOptChecked = TRUE;
+ }
}
void
-xf86MakeNewMapping(int ScreenNum, int Flags, unsigned long Base, unsigned long Size, pointer Vbase)
+xf86MakeNewMapping(int ScreenNum, int Flags, unsigned long Base,
+ unsigned long Size, pointer Vbase)
{
- VidMapPtr vp;
- MappingPtr mp;
+ VidMapPtr vp;
+ MappingPtr mp;
- vp = getVidMapRec(ScreenNum);
- mp = newMapping(vp);
- mp->size = Size;
- mp->virtBase = Vbase;
+ vp = getVidMapRec(ScreenNum);
+ mp = newMapping(vp);
+ mp->size = Size;
+ mp->virtBase = Vbase;
}
void
xf86InitVidMem(void)
{
- if (!vidMemInfo.initialised) {
- memset(&vidMemInfo, 0, sizeof(VidMemInfo));
- xf86OSInitVidMem(&vidMemInfo);
- }
+ if (!vidMemInfo.initialised) {
+ memset(&vidMemInfo, 0, sizeof(VidMemInfo));
+ xf86OSInitVidMem(&vidMemInfo);
+ }
}
pointer
xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
{
- pointer vbase = NULL;
- VidMapPtr vp;
- MappingPtr mp;
-
- if (((Flags & VIDMEM_FRAMEBUFFER) &&
- (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))))
- FatalError("Mapping memory with more than one type\n");
-
- xf86InitVidMem();
- if (!vidMemInfo.initialised || !vidMemInfo.mapMem)
- return NULL;
-
- vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags);
-
- if (!vbase || vbase == (pointer)-1)
- return NULL;
-
- vp = getVidMapRec(ScreenNum);
- mp = newMapping(vp);
- mp->size = Size;
- mp->virtBase = vbase;
-
- /*
- * Check the "mtrr" option even when MTRR isn't supported to avoid
- * warnings about unrecognised options.
- */
- checkMtrrOption(vp);
-
- if (vp->mtrrEnabled && vidMemInfo.setWC) {
- if (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))
- mp->mtrrInfo =
- vidMemInfo.setWC(ScreenNum, Base, Size, FALSE,
- vp->mtrrFrom);
- else if (Flags & VIDMEM_FRAMEBUFFER)
- mp->mtrrInfo =
- vidMemInfo.setWC(ScreenNum, Base, Size, TRUE,
- vp->mtrrFrom);
- }
- return vbase;
+ pointer vbase = NULL;
+ VidMapPtr vp;
+ MappingPtr mp;
+
+ if (((Flags & VIDMEM_FRAMEBUFFER) &&
+ (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))))
+ FatalError("Mapping memory with more than one type\n");
+
+ xf86InitVidMem();
+ if (!vidMemInfo.initialised || !vidMemInfo.mapMem)
+ return NULL;
+
+ vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags);
+
+ if (!vbase || vbase == (pointer) -1)
+ return NULL;
+
+ vp = getVidMapRec(ScreenNum);
+ mp = newMapping(vp);
+ mp->size = Size;
+ mp->virtBase = vbase;
+
+ /*
+ * Check the "mtrr" option even when MTRR isn't supported to avoid
+ * warnings about unrecognised options.
+ */
+ checkMtrrOption(vp);
+
+ if (vp->mtrrEnabled && vidMemInfo.setWC) {
+ if (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))
+ mp->mtrrInfo =
+ vidMemInfo.setWC(ScreenNum, Base, Size, FALSE, vp->mtrrFrom);
+ else if (Flags & VIDMEM_FRAMEBUFFER)
+ mp->mtrrInfo =
+ vidMemInfo.setWC(ScreenNum, Base, Size, TRUE, vp->mtrrFrom);
+ }
+ return vbase;
}
void
xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- VidMapPtr vp;
- MappingPtr mp;
-
- if (!vidMemInfo.initialised || !vidMemInfo.unmapMem) {
- xf86DrvMsg(ScreenNum, X_WARNING,
- "xf86UnMapVidMem() called before xf86MapVidMem()\n");
- return;
- }
-
- vp = getVidMapRec(ScreenNum);
- mp = findMapping(vp, Base, Size);
- if (!mp) {
- xf86DrvMsg(ScreenNum, X_WARNING,
- "xf86UnMapVidMem: cannot find region for [%p,0x%lx]\n",
- Base, Size);
- return;
- }
- if (vp->mtrrEnabled && vidMemInfo.undoWC && mp)
- vidMemInfo.undoWC(ScreenNum, mp->mtrrInfo);
-
- vidMemInfo.unmapMem(ScreenNum, Base, Size);
- removeMapping(vp, mp);
+ VidMapPtr vp;
+ MappingPtr mp;
+
+ if (!vidMemInfo.initialised || !vidMemInfo.unmapMem) {
+ xf86DrvMsg(ScreenNum, X_WARNING,
+ "xf86UnMapVidMem() called before xf86MapVidMem()\n");
+ return;
+ }
+
+ vp = getVidMapRec(ScreenNum);
+ mp = findMapping(vp, Base, Size);
+ if (!mp) {
+ xf86DrvMsg(ScreenNum, X_WARNING,
+ "xf86UnMapVidMem: cannot find region for [%p,0x%lx]\n",
+ Base, Size);
+ return;
+ }
+ if (vp->mtrrEnabled && vidMemInfo.undoWC && mp)
+ vidMemInfo.undoWC(ScreenNum, mp->mtrrInfo);
+
+ vidMemInfo.unmapMem(ScreenNum, Base, Size);
+ removeMapping(vp, mp);
}
Bool
xf86CheckMTRR(int ScreenNum)
{
- VidMapPtr vp = getVidMapRec(ScreenNum);
-
- /*
- * Check the "mtrr" option even when MTRR isn't supported to avoid
- * warnings about unrecognised options.
- */
- checkMtrrOption(vp);
-
- if (vp->mtrrEnabled && vidMemInfo.setWC)
- return TRUE;
-
- return FALSE;
+ VidMapPtr vp = getVidMapRec(ScreenNum);
+
+ /*
+ * Check the "mtrr" option even when MTRR isn't supported to avoid
+ * warnings about unrecognised options.
+ */
+ checkMtrrOption(vp);
+
+ if (vp->mtrrEnabled && vidMemInfo.setWC)
+ return TRUE;
+
+ return FALSE;
}
Bool
xf86LinearVidMem(void)
{
- xf86InitVidMem();
- return vidMemInfo.linearSupported;
+ xf86InitVidMem();
+ return vidMemInfo.linearSupported;
}
void
xf86MapReadSideEffects(int ScreenNum, int Flags, pointer base,
- unsigned long Size)
+ unsigned long Size)
{
- if (!(Flags & VIDMEM_READSIDEEFFECT))
- return;
+ if (!(Flags & VIDMEM_READSIDEEFFECT))
+ return;
- if (!vidMemInfo.initialised || !vidMemInfo.readSideEffects)
- return;
+ if (!vidMemInfo.initialised || !vidMemInfo.readSideEffects)
+ return;
- vidMemInfo.readSideEffects(ScreenNum, base, Size);
+ vidMemInfo.readSideEffects(ScreenNum, base, Size);
}
-
diff --git a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c
index e6511dd43..5f2f3985e 100644
--- a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c
+++ b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c
@@ -31,19 +31,30 @@
#include "xf86Axp.h"
-axpParams xf86AXPParams[] = {
- {SYS_NONE, 0, 0, 0},
- {TSUNAMI, 0, 0, 0},
- {LCA, 1<<24,0xf8000000, 1UL << 32},
- {APECS, 1<<24,0xf8000000, 1UL << 32},
- {T2, 0,0xFC000000, 1UL << 31},
- {T2_GAMMA, 0,0xFC000000, 1UL << 31},
- {CIA, 0,0xE0000000, 1UL << 34},
- {MCPCIA, 0,0xf8000000, 1UL << 31},
- {JENSEN, 0, 0xE000000, 1UL << 32},
- {POLARIS, 0, 0, 0},
- {PYXIS, 0, 0, 0},
- {PYXIS_CIA, 0,0xE0000000, 1UL << 34},
- {IRONGATE, 0, 0, 0}
+axpParams xf86AXPParams[] = {
+ {SYS_NONE, 0, 0, 0}
+ ,
+ {TSUNAMI, 0, 0, 0}
+ ,
+ {LCA, 1 << 24, 0xf8000000, 1UL << 32}
+ ,
+ {APECS, 1 << 24, 0xf8000000, 1UL << 32}
+ ,
+ {T2, 0, 0xFC000000, 1UL << 31}
+ ,
+ {T2_GAMMA, 0, 0xFC000000, 1UL << 31}
+ ,
+ {CIA, 0, 0xE0000000, 1UL << 34}
+ ,
+ {MCPCIA, 0, 0xf8000000, 1UL << 31}
+ ,
+ {JENSEN, 0, 0xE000000, 1UL << 32}
+ ,
+ {POLARIS, 0, 0, 0}
+ ,
+ {PYXIS, 0, 0, 0}
+ ,
+ {PYXIS_CIA, 0, 0xE0000000, 1UL << 34}
+ ,
+ {IRONGATE, 0, 0, 0}
};
-
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c b/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c
index d145ac77b..573358b43 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c
@@ -1,137 +1,134 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#include <door.h>
-#include <sys/vtdaemon.h>
-
-/*
- * Handle the VT-switching interface for Solaris/OpenSolaris
- */
-
-static int xf86VTPruneDoor = 0;
-
-void
-xf86VTRelease(int sig)
-{
- if (xf86Info.vtPendingNum == -1)
- {
- xf86VTPruneDoor = 1;
- xf86Info.vtRequestsPending = TRUE;
- return;
- }
-
- ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
- xf86Info.vtPendingNum = -1;
-
- return;
-}
-
-void
-xf86VTAcquire(int sig)
-{
- xf86Info.vtRequestsPending = TRUE;
- return;
-}
-
-Bool
-xf86VTSwitchPending(void)
-{
- return xf86Info.vtRequestsPending ? TRUE : FALSE;
-}
-
-Bool
-xf86VTSwitchAway(void)
-{
- int door_fd;
- vt_cmd_arg_t vt_door_arg;
- door_arg_t door_arg;
-
- xf86Info.vtRequestsPending = FALSE;
-
- if (xf86VTPruneDoor) {
- xf86VTPruneDoor = 0;
- ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
- return TRUE;
- }
-
- vt_door_arg.vt_ev = VT_EV_HOTKEYS;
- vt_door_arg.vt_num = xf86Info.vtPendingNum;
- door_arg.data_ptr = (char *)&vt_door_arg;
- door_arg.data_size = sizeof (vt_cmd_arg_t);
- door_arg.rbuf = NULL;
- door_arg.rsize = 0;
- door_arg.desc_ptr = NULL;
- door_arg.desc_num = 0;
-
- if ((door_fd = open(VT_DAEMON_DOOR_FILE, O_RDONLY)) < 0)
- return FALSE;
-
- if (door_call(door_fd, &door_arg) != 0) {
- close(door_fd);
- return FALSE;
- }
-
- close(door_fd);
- return TRUE;
-}
-
-Bool
-xf86VTSwitchTo(void)
-{
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
- {
- return FALSE;
- }
- else
- {
- return TRUE;
- }
-}
-
-Bool
-xf86VTActivate(int vtno)
-{
- struct vt_stat state;
-
- if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &state) < 0)
- return FALSE;
-
- if ((state.v_state & (1 << vtno)) == 0)
- return FALSE;
-
- xf86Info.vtRequestsPending = TRUE;
- xf86Info.vtPendingNum = vtno;
-
- return TRUE;
-}
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include <door.h>
+#include <sys/vtdaemon.h>
+
+/*
+ * Handle the VT-switching interface for Solaris/OpenSolaris
+ */
+
+static int xf86VTPruneDoor = 0;
+
+void
+xf86VTRelease(int sig)
+{
+ if (xf86Info.vtPendingNum == -1) {
+ xf86VTPruneDoor = 1;
+ xf86Info.vtRequestsPending = TRUE;
+ return;
+ }
+
+ ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
+ xf86Info.vtPendingNum = -1;
+
+ return;
+}
+
+void
+xf86VTAcquire(int sig)
+{
+ xf86Info.vtRequestsPending = TRUE;
+ return;
+}
+
+Bool
+xf86VTSwitchPending(void)
+{
+ return xf86Info.vtRequestsPending ? TRUE : FALSE;
+}
+
+Bool
+xf86VTSwitchAway(void)
+{
+ int door_fd;
+ vt_cmd_arg_t vt_door_arg;
+ door_arg_t door_arg;
+
+ xf86Info.vtRequestsPending = FALSE;
+
+ if (xf86VTPruneDoor) {
+ xf86VTPruneDoor = 0;
+ ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
+ return TRUE;
+ }
+
+ vt_door_arg.vt_ev = VT_EV_HOTKEYS;
+ vt_door_arg.vt_num = xf86Info.vtPendingNum;
+ door_arg.data_ptr = (char *) &vt_door_arg;
+ door_arg.data_size = sizeof(vt_cmd_arg_t);
+ door_arg.rbuf = NULL;
+ door_arg.rsize = 0;
+ door_arg.desc_ptr = NULL;
+ door_arg.desc_num = 0;
+
+ if ((door_fd = open(VT_DAEMON_DOOR_FILE, O_RDONLY)) < 0)
+ return FALSE;
+
+ if (door_call(door_fd, &door_arg) != 0) {
+ close(door_fd);
+ return FALSE;
+ }
+
+ close(door_fd);
+ return TRUE;
+}
+
+Bool
+xf86VTSwitchTo(void)
+{
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) {
+ return FALSE;
+ }
+ else {
+ return TRUE;
+ }
+}
+
+Bool
+xf86VTActivate(int vtno)
+{
+ struct vt_stat state;
+
+ if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &state) < 0)
+ return FALSE;
+
+ if ((state.v_state & (1 << vtno)) == 0)
+ return FALSE;
+
+ xf86Info.vtRequestsPending = TRUE;
+ xf86Info.vtPendingNum = vtno;
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c b/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
index 7a5128ffb..4ff64649a 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
@@ -1,226 +1,227 @@
-/* Based on hw/xfree86/os-support/bsd/bsd_apm.c which bore no explicit
- * copyright notice, so is covered by the following notice:
- *
- * Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the XFree86 Project shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from the
- * XFree86 Project.
- */
-
-/* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "os.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#define XF86_OS_PRIVS
-#include "xf86_OSproc.h"
-#include "xf86_OSlib.h"
-
-#ifndef PLEASE_FIX_THIS
-#define APM_STANDBY_REQ 0xa01
-#define APM_SUSPEND_REQ 0xa02
-#define APM_NORMAL_RESUME 0xa03
-#define APM_CRIT_RESUME 0xa04
-#define APM_BATTERY_LOW 0xa05
-#define APM_POWER_CHANGE 0xa06
-#define APM_UPDATE_TIME 0xa07
-#define APM_CRIT_SUSPEND_REQ 0xa08
-#define APM_USER_STANDBY_REQ 0xa09
-#define APM_USER_SUSPEND_REQ 0xa0a
-#define APM_SYS_STANDBY_RESUME 0xa0b
-#define APM_IOC_NEXTEVENT 0xa0c
-#define APM_IOC_RESUME 0xa0d
-#define APM_IOC_SUSPEND 0xa0e
-#define APM_IOC_STANDBY 0xa0f
-#endif
-
-typedef struct apm_event_info
-{
- int type;
-} apm_event_info;
-
-/*
- This may be replaced with a better device name
- very soon...
-*/
-#define APM_DEVICE "/dev/srn"
-#define APM_DEVICE1 "/dev/apm"
-
-static pointer APMihPtr = NULL;
-static void sunCloseAPM(void);
-
-static struct {
- u_int apmBsd;
- pmEvent xf86;
-} sunToXF86Array [] = {
- { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
- { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
- { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
- { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
- { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
- { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
- { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
- { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
- { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
- { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
- { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
-#ifdef APM_CAPABILITY_CHANGE
- { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
-#endif
-};
-
-#define numApmEvents (sizeof(sunToXF86Array) / sizeof(sunToXF86Array[0]))
-
-static pmEvent
-sunToXF86(int type)
-{
- int i;
-
- for (i = 0; i < numApmEvents; i++) {
- if (type == sunToXF86Array[i].apmBsd) {
- return sunToXF86Array[i].xf86;
- }
- }
- return XF86_APM_UNKNOWN;
-}
-
-/*
- * APM events can be requested direclty from /dev/apm
- */
-static int
-sunPMGetEventFromOS(int fd, pmEvent *events, int num)
-{
- struct apm_event_info sunEvent;
- int i;
-
- for (i = 0; i < num; i++) {
-
- if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) {
- if (errno != EAGAIN) {
- xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT"
- " %s\n", strerror(errno));
- }
- break;
- }
- events[i] = sunToXF86(sunEvent.type);
- }
- xf86Msg(X_WARNING, "Got some events\n");
- return i;
-}
-
-static pmWait
-sunPMConfirmEventToOs(int fd, pmEvent event)
-{
- switch (event) {
-/* XXX: NOT CURRENTLY RETURNED FROM OS */
- case XF86_APM_SYS_STANDBY:
- case XF86_APM_USER_STANDBY:
- if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0)
- return PM_WAIT; /* should we stop the Xserver in standby, too? */
- else
- return PM_NONE;
- case XF86_APM_SYS_SUSPEND:
- case XF86_APM_CRITICAL_SUSPEND:
- case XF86_APM_USER_SUSPEND:
- xf86Msg(X_WARNING, "Got SUSPENDED\n");
- if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0)
- return PM_CONTINUE;
- else {
- xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND"
- " %s\n", strerror(errno));
- return PM_FAILED;
- }
- case XF86_APM_STANDBY_RESUME:
- case XF86_APM_NORMAL_RESUME:
- case XF86_APM_CRITICAL_RESUME:
- case XF86_APM_STANDBY_FAILED:
- case XF86_APM_SUSPEND_FAILED:
- xf86Msg(X_WARNING, "Got RESUME\n");
- if (ioctl( fd, APM_IOC_RESUME, NULL ) == 0)
- return PM_CONTINUE;
- else {
- xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME"
- " %s\n", strerror(errno));
- return PM_FAILED;
- }
- default:
- return PM_NONE;
- }
-}
-
-PMClose
-xf86OSPMOpen(void)
-{
- int fd;
-
- if (APMihPtr || !xf86Info.pmFlag) {
- return NULL;
- }
-
- if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
- if ((fd = open(APM_DEVICE1, O_RDWR)) == -1) {
- return NULL;
- }
- }
- xf86PMGetEventFromOs = sunPMGetEventFromOS;
- xf86PMConfirmEventToOs = sunPMConfirmEventToOs;
- APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
- return sunCloseAPM;
-}
-
-static void
-sunCloseAPM(void)
-{
- int fd;
-
- if (APMihPtr) {
- fd = xf86RemoveGeneralHandler(APMihPtr);
- close(fd);
- APMihPtr = NULL;
- }
-}
+/* Based on hw/xfree86/os-support/bsd/bsd_apm.c which bore no explicit
+ * copyright notice, so is covered by the following notice:
+ *
+ * Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+/* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+#include "xf86_OSlib.h"
+
+#ifndef PLEASE_FIX_THIS
+#define APM_STANDBY_REQ 0xa01
+#define APM_SUSPEND_REQ 0xa02
+#define APM_NORMAL_RESUME 0xa03
+#define APM_CRIT_RESUME 0xa04
+#define APM_BATTERY_LOW 0xa05
+#define APM_POWER_CHANGE 0xa06
+#define APM_UPDATE_TIME 0xa07
+#define APM_CRIT_SUSPEND_REQ 0xa08
+#define APM_USER_STANDBY_REQ 0xa09
+#define APM_USER_SUSPEND_REQ 0xa0a
+#define APM_SYS_STANDBY_RESUME 0xa0b
+#define APM_IOC_NEXTEVENT 0xa0c
+#define APM_IOC_RESUME 0xa0d
+#define APM_IOC_SUSPEND 0xa0e
+#define APM_IOC_STANDBY 0xa0f
+#endif
+
+typedef struct apm_event_info {
+ int type;
+} apm_event_info;
+
+/*
+ This may be replaced with a better device name
+ very soon...
+*/
+#define APM_DEVICE "/dev/srn"
+#define APM_DEVICE1 "/dev/apm"
+
+static pointer APMihPtr = NULL;
+static void sunCloseAPM(void);
+
+static struct {
+ u_int apmBsd;
+ pmEvent xf86;
+} sunToXF86Array[] = {
+ {
+ APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, {
+ APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, {
+ APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {
+ APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, {
+ APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, {
+ APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {
+ APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {
+ APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, {
+ APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, {
+ APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, {
+ APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
+#ifdef APM_CAPABILITY_CHANGE
+ {
+ APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED},
+#endif
+};
+
+#define numApmEvents (sizeof(sunToXF86Array) / sizeof(sunToXF86Array[0]))
+
+static pmEvent
+sunToXF86(int type)
+{
+ int i;
+
+ for (i = 0; i < numApmEvents; i++) {
+ if (type == sunToXF86Array[i].apmBsd) {
+ return sunToXF86Array[i].xf86;
+ }
+ }
+ return XF86_APM_UNKNOWN;
+}
+
+/*
+ * APM events can be requested direclty from /dev/apm
+ */
+static int
+sunPMGetEventFromOS(int fd, pmEvent * events, int num)
+{
+ struct apm_event_info sunEvent;
+ int i;
+
+ for (i = 0; i < num; i++) {
+
+ if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT"
+ " %s\n", strerror(errno));
+ }
+ break;
+ }
+ events[i] = sunToXF86(sunEvent.type);
+ }
+ xf86Msg(X_WARNING, "Got some events\n");
+ return i;
+}
+
+static pmWait
+sunPMConfirmEventToOs(int fd, pmEvent event)
+{
+ switch (event) {
+/* XXX: NOT CURRENTLY RETURNED FROM OS */
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+ if (ioctl(fd, APM_IOC_STANDBY, NULL) == 0)
+ return PM_WAIT; /* should we stop the Xserver in standby, too? */
+ else
+ return PM_NONE;
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND:
+ case XF86_APM_USER_SUSPEND:
+ xf86Msg(X_WARNING, "Got SUSPENDED\n");
+ if (ioctl(fd, APM_IOC_SUSPEND, NULL) == 0)
+ return PM_CONTINUE;
+ else {
+ xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND"
+ " %s\n", strerror(errno));
+ return PM_FAILED;
+ }
+ case XF86_APM_STANDBY_RESUME:
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ case XF86_APM_STANDBY_FAILED:
+ case XF86_APM_SUSPEND_FAILED:
+ xf86Msg(X_WARNING, "Got RESUME\n");
+ if (ioctl(fd, APM_IOC_RESUME, NULL) == 0)
+ return PM_CONTINUE;
+ else {
+ xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME"
+ " %s\n", strerror(errno));
+ return PM_FAILED;
+ }
+ default:
+ return PM_NONE;
+ }
+}
+
+PMClose
+xf86OSPMOpen(void)
+{
+ int fd;
+
+ if (APMihPtr || !xf86Info.pmFlag) {
+ return NULL;
+ }
+
+ if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
+ if ((fd = open(APM_DEVICE1, O_RDWR)) == -1) {
+ return NULL;
+ }
+ }
+ xf86PMGetEventFromOs = sunPMGetEventFromOS;
+ xf86PMConfirmEventToOs = sunPMConfirmEventToOs;
+ APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
+ return sunCloseAPM;
+}
+
+static void
+sunCloseAPM(void)
+{
+ int fd;
+
+ if (APMihPtr) {
+ fd = xf86RemoveGeneralHandler(APMihPtr);
+ close(fd);
+ APMihPtr = NULL;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c b/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
index 8cd4de25b..beb13d2e9 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
@@ -1,180 +1,183 @@
-/* Copyright (c) 2004-2005, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <sys/audio.h>
-#include <sys/uio.h>
-#include <limits.h>
-#include <math.h>
-#include <poll.h>
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#define BELL_RATE 48000 /* Samples per second */
-#define BELL_HZ 50 /* Fraction of a second i.e. 1/x */
-#define BELL_MS (1000/BELL_HZ) /* MS */
-#define BELL_SAMPLES (BELL_RATE / BELL_HZ)
-#define BELL_MIN 3 /* Min # of repeats */
-
-#define AUDIO_DEVICE "/dev/audio"
-
-void
-xf86OSRingBell(int loudness, int pitch, int duration)
-{
- static short samples[BELL_SAMPLES];
- static short silence[BELL_SAMPLES]; /* "The Sound of Silence" */
- static int lastFreq;
- int cnt;
- int i;
- int written;
- int repeats;
- int freq;
- audio_info_t audioInfo;
- struct iovec iov[IOV_MAX];
- int iovcnt;
- double ampl, cyclen, phase;
- int audioFD;
-
- if ((loudness <= 0) || (pitch <= 0) || (duration <= 0)) {
- return;
- }
-
- lastFreq = 0;
- memset(silence, 0, sizeof(silence));
-
- audioFD = open(AUDIO_DEVICE, O_WRONLY | O_NONBLOCK);
- if (audioFD == -1) {
- xf86Msg(X_ERROR, "Bell: cannot open audio device \"%s\": %s\n",
- AUDIO_DEVICE, strerror(errno));
- return;
- }
-
- freq = pitch;
- freq = min(freq, (BELL_RATE / 2) - 1);
- freq = max(freq, 2 * BELL_HZ);
-
- /*
- * Ensure full waves per buffer
- */
- freq -= freq % BELL_HZ;
-
- if (freq != lastFreq) {
- lastFreq = freq;
- ampl = 16384.0;
-
- cyclen = (double) freq / (double) BELL_RATE;
- phase = 0.0;
-
- for (i = 0; i < BELL_SAMPLES; i++) {
- samples[i] = (short) (ampl * sin(2.0 * M_PI * phase));
- phase += cyclen;
- if (phase >= 1.0)
- phase -= 1.0;
- }
- }
-
- repeats = (duration + (BELL_MS / 2)) / BELL_MS;
- repeats = max(repeats, BELL_MIN);
-
- loudness = max(0, loudness);
- loudness = min(loudness, 100);
-
-#ifdef DEBUG
- ErrorF("BELL : freq %d volume %d duration %d repeats %d\n",
- freq, loudness, duration, repeats);
-#endif
-
- AUDIO_INITINFO(&audioInfo);
- audioInfo.play.encoding = AUDIO_ENCODING_LINEAR;
- audioInfo.play.sample_rate = BELL_RATE;
- audioInfo.play.channels = 2;
- audioInfo.play.precision = 16;
- audioInfo.play.gain = min(AUDIO_MAX_GAIN, AUDIO_MAX_GAIN * loudness / 100);
-
- if (ioctl(audioFD, AUDIO_SETINFO, &audioInfo) < 0){
- xf86Msg(X_ERROR,
- "Bell: AUDIO_SETINFO failed on audio device \"%s\": %s\n",
- AUDIO_DEVICE, strerror(errno));
- close(audioFD);
- return;
- }
-
- iovcnt = 0;
-
- for (cnt = 0; cnt <= repeats; cnt++) {
- if (cnt == repeats) {
- /* Insert a bit of silence so that multiple beeps are distinct and
- * not compressed into a single tone.
- */
- iov[iovcnt].iov_base = (char *) silence;
- iov[iovcnt++].iov_len = sizeof(silence);
- } else {
- iov[iovcnt].iov_base = (char *) samples;
- iov[iovcnt++].iov_len = sizeof(samples);
- }
- if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
- written = writev(audioFD, iov, iovcnt);
-
- if ((written < ((int)(sizeof(samples) * iovcnt)))) {
- /* audio buffer was full! */
-
- int naptime;
-
- if (written == -1) {
- if (errno != EAGAIN) {
- xf86Msg(X_ERROR,
- "Bell: writev failed on audio device \"%s\": %s\n",
- AUDIO_DEVICE, strerror(errno));
- close(audioFD);
- return;
- }
- i = iovcnt;
- } else {
- i = ((sizeof(samples) * iovcnt) - written)
- / sizeof(samples);
- }
- cnt -= i;
-
- /* sleep a little to allow audio buffer to drain */
- naptime = BELL_MS * i;
- poll(NULL, 0, naptime);
-
- i = ((sizeof(samples) * iovcnt) - written) % sizeof(samples);
- iovcnt = 0;
- if ((written != -1) && (i > 0)) {
- iov[iovcnt].iov_base = ((char *) samples) + i;
- iov[iovcnt++].iov_len = sizeof(samples) - i;
- }
- } else {
- iovcnt = 0;
- }
- }
- }
-
- close(audioFD);
- return;
-}
+/* Copyright (c) 2004-2005, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/audio.h>
+#include <sys/uio.h>
+#include <limits.h>
+#include <math.h>
+#include <poll.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#define BELL_RATE 48000 /* Samples per second */
+#define BELL_HZ 50 /* Fraction of a second i.e. 1/x */
+#define BELL_MS (1000/BELL_HZ) /* MS */
+#define BELL_SAMPLES (BELL_RATE / BELL_HZ)
+#define BELL_MIN 3 /* Min # of repeats */
+
+#define AUDIO_DEVICE "/dev/audio"
+
+void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ static short samples[BELL_SAMPLES];
+ static short silence[BELL_SAMPLES]; /* "The Sound of Silence" */
+ static int lastFreq;
+ int cnt;
+ int i;
+ int written;
+ int repeats;
+ int freq;
+ audio_info_t audioInfo;
+ struct iovec iov[IOV_MAX];
+ int iovcnt;
+ double ampl, cyclen, phase;
+ int audioFD;
+
+ if ((loudness <= 0) || (pitch <= 0) || (duration <= 0)) {
+ return;
+ }
+
+ lastFreq = 0;
+ memset(silence, 0, sizeof(silence));
+
+ audioFD = open(AUDIO_DEVICE, O_WRONLY | O_NONBLOCK);
+ if (audioFD == -1) {
+ xf86Msg(X_ERROR, "Bell: cannot open audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ return;
+ }
+
+ freq = pitch;
+ freq = min(freq, (BELL_RATE / 2) - 1);
+ freq = max(freq, 2 * BELL_HZ);
+
+ /*
+ * Ensure full waves per buffer
+ */
+ freq -= freq % BELL_HZ;
+
+ if (freq != lastFreq) {
+ lastFreq = freq;
+ ampl = 16384.0;
+
+ cyclen = (double) freq / (double) BELL_RATE;
+ phase = 0.0;
+
+ for (i = 0; i < BELL_SAMPLES; i++) {
+ samples[i] = (short) (ampl * sin(2.0 * M_PI * phase));
+ phase += cyclen;
+ if (phase >= 1.0)
+ phase -= 1.0;
+ }
+ }
+
+ repeats = (duration + (BELL_MS / 2)) / BELL_MS;
+ repeats = max(repeats, BELL_MIN);
+
+ loudness = max(0, loudness);
+ loudness = min(loudness, 100);
+
+#ifdef DEBUG
+ ErrorF("BELL : freq %d volume %d duration %d repeats %d\n",
+ freq, loudness, duration, repeats);
+#endif
+
+ AUDIO_INITINFO(&audioInfo);
+ audioInfo.play.encoding = AUDIO_ENCODING_LINEAR;
+ audioInfo.play.sample_rate = BELL_RATE;
+ audioInfo.play.channels = 2;
+ audioInfo.play.precision = 16;
+ audioInfo.play.gain = min(AUDIO_MAX_GAIN, AUDIO_MAX_GAIN * loudness / 100);
+
+ if (ioctl(audioFD, AUDIO_SETINFO, &audioInfo) < 0) {
+ xf86Msg(X_ERROR,
+ "Bell: AUDIO_SETINFO failed on audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ close(audioFD);
+ return;
+ }
+
+ iovcnt = 0;
+
+ for (cnt = 0; cnt <= repeats; cnt++) {
+ if (cnt == repeats) {
+ /* Insert a bit of silence so that multiple beeps are distinct and
+ * not compressed into a single tone.
+ */
+ iov[iovcnt].iov_base = (char *) silence;
+ iov[iovcnt++].iov_len = sizeof(silence);
+ }
+ else {
+ iov[iovcnt].iov_base = (char *) samples;
+ iov[iovcnt++].iov_len = sizeof(samples);
+ }
+ if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
+ written = writev(audioFD, iov, iovcnt);
+
+ if ((written < ((int) (sizeof(samples) * iovcnt)))) {
+ /* audio buffer was full! */
+
+ int naptime;
+
+ if (written == -1) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_ERROR,
+ "Bell: writev failed on audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ close(audioFD);
+ return;
+ }
+ i = iovcnt;
+ }
+ else {
+ i = ((sizeof(samples) * iovcnt) - written)
+ / sizeof(samples);
+ }
+ cnt -= i;
+
+ /* sleep a little to allow audio buffer to drain */
+ naptime = BELL_MS * i;
+ poll(NULL, 0, naptime);
+
+ i = ((sizeof(samples) * iovcnt) - written) % sizeof(samples);
+ iovcnt = 0;
+ if ((written != -1) && (i > 0)) {
+ iov[iovcnt].iov_base = ((char *) samples) + i;
+ iov[iovcnt++].iov_len = sizeof(samples) - i;
+ }
+ }
+ else {
+ iovcnt = 0;
+ }
+ }
+ }
+
+ close(audioFD);
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_init.c b/xorg-server/hw/xfree86/os-support/solaris/sun_init.c
index 800fc1c3d..4b75a98ac 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_init.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_init.c
@@ -30,7 +30,7 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#ifdef HAVE_SYS_KD_H
-# include <sys/kd.h>
+#include <sys/kd.h>
#endif
/*
@@ -48,6 +48,7 @@
static Bool KeepTty = FALSE;
static Bool Protect0 = FALSE;
static Bool UseConsole = FALSE;
+
#ifdef HAS_USL_VTS
static int VTnum = -1;
static int xf86StartVT = -1;
@@ -71,18 +72,19 @@ switch_to(int vt, const char *from)
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
if (ret != 0)
xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n",
- from, strerror(errno));
+ from, strerror(errno));
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
if (ret != 0)
xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n",
- from, strerror(errno));
+ from, strerror(errno));
}
void
xf86OpenConsole(void)
{
int i;
+
#ifdef HAS_USL_VTS
int fd;
struct vt_mode VT;
@@ -90,209 +92,192 @@ xf86OpenConsole(void)
MessageType from = X_PROBED;
#endif
- if (serverGeneration == 1)
- {
- /* Check if we're run with euid==0 */
- if (geteuid() != 0)
- FatalError("xf86OpenConsole: Server must be suid root\n");
-
- /* Protect page 0 to help find NULL dereferencing */
- /* mprotect() doesn't seem to work */
- if (Protect0)
- {
- int fd = -1;
-
- if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0)
- {
- xf86Msg(X_WARNING,
- "xf86OpenConsole: cannot open /dev/zero (%s)\n",
- strerror(errno));
- }
- else
- {
- if (mmap(0, 0x1000, PROT_NONE,
- MAP_FIXED | MAP_SHARED, fd, 0) == MAP_FAILED)
- xf86Msg(X_WARNING,
- "xf86OpenConsole: failed to protect page 0 (%s)\n",
- strerror(errno));
-
- close(fd);
- }
- }
+ if (serverGeneration == 1) {
+ /* Check if we're run with euid==0 */
+ if (geteuid() != 0)
+ FatalError("xf86OpenConsole: Server must be suid root\n");
+
+ /* Protect page 0 to help find NULL dereferencing */
+ /* mprotect() doesn't seem to work */
+ if (Protect0) {
+ int fd = -1;
+
+ if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: cannot open /dev/zero (%s)\n",
+ strerror(errno));
+ }
+ else {
+ if (mmap(0, 0x1000, PROT_NONE,
+ MAP_FIXED | MAP_SHARED, fd, 0) == MAP_FAILED)
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: failed to protect page 0 (%s)\n",
+ strerror(errno));
+
+ close(fd);
+ }
+ }
#ifdef HAS_USL_VTS
- /*
- * Setup the virtual terminal manager
- */
- if ((fd = open("/dev/vt/0",O_RDWR,0)) == -1)
- {
- xf86ErrorF("xf86OpenConsole: Cannot open /dev/vt/0 (%s)\n",
- strerror(errno));
- vtEnabled = 0;
- }
- else
- {
- if (ioctl(fd, VT_ENABLED, &vtEnabled) < 0)
- {
- xf86ErrorF("xf86OpenConsole: VT_ENABLED failed (%s)\n",
- strerror(errno));
- vtEnabled = 0;
- }
- }
-#endif /* HAS_USL_VTS */
-
- if (UseConsole)
- {
- strlcpy(consoleDev, SOL_CONSOLE_DEV, sizeof(consoleDev));
+ /*
+ * Setup the virtual terminal manager
+ */
+ if ((fd = open("/dev/vt/0", O_RDWR, 0)) == -1) {
+ xf86ErrorF("xf86OpenConsole: Cannot open /dev/vt/0 (%s)\n",
+ strerror(errno));
+ vtEnabled = 0;
+ }
+ else {
+ if (ioctl(fd, VT_ENABLED, &vtEnabled) < 0) {
+ xf86ErrorF("xf86OpenConsole: VT_ENABLED failed (%s)\n",
+ strerror(errno));
+ vtEnabled = 0;
+ }
+ }
+#endif /* HAS_USL_VTS */
+
+ if (UseConsole) {
+ strlcpy(consoleDev, SOL_CONSOLE_DEV, sizeof(consoleDev));
#ifdef HAS_USL_VTS
- xf86Info.vtno = CONSOLE_VTNO;
-
- if (vtEnabled == 0)
- {
- xf86StartVT = 0;
- }
- else
- {
- if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0)
- FatalError("xf86OpenConsole: Cannot determine current VT\n");
- xf86StartVT = vtinfo.v_active;
- }
-#endif /* HAS_USL_VTS */
- goto OPENCONSOLE;
- }
+ xf86Info.vtno = CONSOLE_VTNO;
+
+ if (vtEnabled == 0) {
+ xf86StartVT = 0;
+ }
+ else {
+ if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0)
+ FatalError
+ ("xf86OpenConsole: Cannot determine current VT\n");
+ xf86StartVT = vtinfo.v_active;
+ }
+#endif /* HAS_USL_VTS */
+ goto OPENCONSOLE;
+ }
#ifdef HAS_USL_VTS
- if (vtEnabled == 0)
- {
- /* VT not enabled - kernel too old or Sparc platforms
- without visual_io support */
- xf86Msg(from, "VT infrastructure is not available\n");
-
- xf86StartVT = 0;
- xf86Info.vtno = 0;
- strlcpy(consoleDev, xf86SolarisFbDev, sizeof(consoleDev));
- goto OPENCONSOLE;
- }
-
- if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0)
- FatalError("xf86OpenConsole: Cannot determine current VT\n");
-
- xf86StartVT = vtinfo.v_active;
-
- if (VTnum != -1)
- {
- xf86Info.vtno = VTnum;
- from = X_CMDLINE;
- }
- else if (xf86Info.ShareVTs)
- {
- xf86Info.vtno = vtinfo.v_active;
- from = X_CMDLINE;
- }
- else
- {
- if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
- (xf86Info.vtno == -1))
- {
- FatalError("xf86OpenConsole: Cannot find a free VT\n");
- }
- }
-
- xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
- snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno);
-
- if (fd != -1)
- {
- close(fd);
- }
-
-#endif /* HAS_USL_VTS */
-
-OPENCONSOLE:
- if (!KeepTty)
- setpgrp();
-
- if (((xf86Info.consoleFd = open(consoleDev, O_RDWR | O_NDELAY, 0)) < 0))
- FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
- consoleDev, strerror(errno));
-
- /* Change ownership of the vt or console */
- chown(consoleDev, getuid(), getgid());
+ if (vtEnabled == 0) {
+ /* VT not enabled - kernel too old or Sparc platforms
+ without visual_io support */
+ xf86Msg(from, "VT infrastructure is not available\n");
+
+ xf86StartVT = 0;
+ xf86Info.vtno = 0;
+ strlcpy(consoleDev, xf86SolarisFbDev, sizeof(consoleDev));
+ goto OPENCONSOLE;
+ }
+
+ if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0)
+ FatalError("xf86OpenConsole: Cannot determine current VT\n");
+
+ xf86StartVT = vtinfo.v_active;
+
+ if (VTnum != -1) {
+ xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
+ }
+ else if (xf86Info.ShareVTs) {
+ xf86Info.vtno = vtinfo.v_active;
+ from = X_CMDLINE;
+ }
+ else {
+ if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
+ (xf86Info.vtno == -1)) {
+ FatalError("xf86OpenConsole: Cannot find a free VT\n");
+ }
+ }
+
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+ snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno);
+
+ if (fd != -1) {
+ close(fd);
+ }
+
+#endif /* HAS_USL_VTS */
+
+ OPENCONSOLE:
+ if (!KeepTty)
+ setpgrp();
+
+ if (((xf86Info.consoleFd = open(consoleDev, O_RDWR | O_NDELAY, 0)) < 0))
+ FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
+ consoleDev, strerror(errno));
+
+ /* Change ownership of the vt or console */
+ chown(consoleDev, getuid(), getgid());
#ifdef HAS_USL_VTS
- if (xf86Info.ShareVTs)
- return;
-
- if (vtEnabled)
- {
- /*
- * Now get the VT
- */
- switch_to(xf86Info.vtno, "xf86OpenConsole");
-
-#ifdef VT_SET_CONSUSER /* added in snv_139 */
- if (strcmp(display, "0") == 0)
- if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0)
- xf86Msg(X_WARNING,
- "xf86OpenConsole: VT_SET_CONSUSER failed\n");
+ if (xf86Info.ShareVTs)
+ return;
+
+ if (vtEnabled) {
+ /*
+ * Now get the VT
+ */
+ switch_to(xf86Info.vtno, "xf86OpenConsole");
+
+#ifdef VT_SET_CONSUSER /* added in snv_139 */
+ if (strcmp(display, "0") == 0)
+ if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0)
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: VT_SET_CONSUSER failed\n");
#endif
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
- FatalError("xf86OpenConsole: VT_GETMODE failed\n");
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
+ FatalError("xf86OpenConsole: VT_GETMODE failed\n");
- OsSignal(SIGUSR1, xf86VTAcquire);
- OsSignal(SIGUSR2, xf86VTRelease);
+ OsSignal(SIGUSR1, xf86VTAcquire);
+ OsSignal(SIGUSR2, xf86VTRelease);
- VT.mode = VT_PROCESS;
- VT.acqsig = SIGUSR1;
- VT.relsig = SIGUSR2;
+ VT.mode = VT_PROCESS;
+ VT.acqsig = SIGUSR1;
+ VT.relsig = SIGUSR2;
- if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
- FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
+ if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
+ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
- if (ioctl(xf86Info.consoleFd, VT_SETDISPINFO, atoi(display)) < 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_SETDISPINFO failed\n");
- }
+ if (ioctl(xf86Info.consoleFd, VT_SETDISPINFO, atoi(display)) < 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_SETDISPINFO failed\n");
+ }
#endif
#ifdef KDSETMODE
- SYSCALL(i = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
- if (i < 0) {
- xf86Msg(X_WARNING,
- "xf86OpenConsole: KDSETMODE KD_GRAPHICS failed on %s (%s)\n",
- consoleDev, strerror(errno));
- }
+ SYSCALL(i = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
+ if (i < 0) {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: KDSETMODE KD_GRAPHICS failed on %s (%s)\n",
+ consoleDev, strerror(errno));
+ }
#endif
}
- else /* serverGeneration != 1 */
- {
+ else { /* serverGeneration != 1 */
+
#ifdef HAS_USL_VTS
- if (vtEnabled && !xf86Info.ShareVTs)
- {
- /*
- * Now re-get the VT
- */
- if (xf86Info.autoVTSwitch)
- switch_to(xf86Info.vtno, "xf86OpenConsole");
-
-#ifdef VT_SET_CONSUSER /* added in snv_139 */
- if (strcmp(display, "0") == 0)
- if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0)
- xf86Msg(X_WARNING,
- "xf86OpenConsole: VT_SET_CONSUSER failed\n");
+ if (vtEnabled && !xf86Info.ShareVTs) {
+ /*
+ * Now re-get the VT
+ */
+ if (xf86Info.autoVTSwitch)
+ switch_to(xf86Info.vtno, "xf86OpenConsole");
+
+#ifdef VT_SET_CONSUSER /* added in snv_139 */
+ if (strcmp(display, "0") == 0)
+ if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0)
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: VT_SET_CONSUSER failed\n");
#endif
- /*
- * If the server doesn't have the VT when the reset occurs,
- * this is to make sure we don't continue until the activate
- * signal is received.
- */
- if (!xf86Screens[0]->vtSema)
- sleep(5);
- }
-#endif /* HAS_USL_VTS */
+ /*
+ * If the server doesn't have the VT when the reset occurs,
+ * this is to make sure we don't continue until the activate
+ * signal is received.
+ */
+ if (!xf86Screens[0]->vtSema)
+ sleep(5);
+ }
+#endif /* HAS_USL_VTS */
}
}
@@ -307,44 +292,47 @@ xf86CloseConsole(void)
#if !defined(__i386__) && !defined(__i386) && !defined(__x86)
if (!xf86DoConfigure) {
- int fd;
-
- /*
- * Wipe out framebuffer just like the non-SI Xsun server does. This
- * could be improved by saving framebuffer contents in
- * xf86OpenConsole() above and restoring them here. Also, it's unclear
- * at this point whether this should be done for all framebuffers in
- * the system, rather than only the console.
- */
- if ((fd = open(xf86SolarisFbDev, O_RDWR, 0)) < 0) {
- xf86Msg(X_WARNING,
- "xf86CloseConsole(): unable to open framebuffer (%s)\n",
- strerror(errno));
- } else {
- struct fbgattr fbattr;
-
- if ((ioctl(fd, FBIOGATTR, &fbattr) < 0) &&
- (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0)) {
- xf86Msg(X_WARNING,
- "xf86CloseConsole(): unable to retrieve framebuffer"
- " attributes (%s)\n", strerror(errno));
- } else {
- pointer fbdata;
-
- fbdata = mmap(NULL, fbattr.fbtype.fb_size,
- PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- if (fbdata == MAP_FAILED) {
- xf86Msg(X_WARNING,
- "xf86CloseConsole(): unable to mmap framebuffer"
- " (%s)\n", strerror(errno));
- } else {
- memset(fbdata, 0, fbattr.fbtype.fb_size);
- munmap(fbdata, fbattr.fbtype.fb_size);
- }
- }
-
- close(fd);
- }
+ int fd;
+
+ /*
+ * Wipe out framebuffer just like the non-SI Xsun server does. This
+ * could be improved by saving framebuffer contents in
+ * xf86OpenConsole() above and restoring them here. Also, it's unclear
+ * at this point whether this should be done for all framebuffers in
+ * the system, rather than only the console.
+ */
+ if ((fd = open(xf86SolarisFbDev, O_RDWR, 0)) < 0) {
+ xf86Msg(X_WARNING,
+ "xf86CloseConsole(): unable to open framebuffer (%s)\n",
+ strerror(errno));
+ }
+ else {
+ struct fbgattr fbattr;
+
+ if ((ioctl(fd, FBIOGATTR, &fbattr) < 0) &&
+ (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0)) {
+ xf86Msg(X_WARNING,
+ "xf86CloseConsole(): unable to retrieve framebuffer"
+ " attributes (%s)\n", strerror(errno));
+ }
+ else {
+ pointer fbdata;
+
+ fbdata = mmap(NULL, fbattr.fbtype.fb_size,
+ PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (fbdata == MAP_FAILED) {
+ xf86Msg(X_WARNING,
+ "xf86CloseConsole(): unable to mmap framebuffer"
+ " (%s)\n", strerror(errno));
+ }
+ else {
+ memset(fbdata, 0, fbattr.fbtype.fb_size);
+ munmap(fbdata, fbattr.fbtype.fb_size);
+ }
+ }
+
+ close(fd);
+ }
}
#endif
@@ -355,19 +343,17 @@ xf86CloseConsole(void)
#endif
#ifdef HAS_USL_VTS
- if (vtEnabled)
- {
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
- {
- VT.mode = VT_AUTO; /* Set default vt handling */
- ioctl(xf86Info.consoleFd, VT_SETMODE, &VT);
- }
-
- /* Activate the VT that X was started on */
- if (xf86Info.autoVTSwitch)
- switch_to(xf86StartVT, "xf86CloseConsole");
+ if (vtEnabled) {
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) {
+ VT.mode = VT_AUTO; /* Set default vt handling */
+ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT);
+ }
+
+ /* Activate the VT that X was started on */
+ if (xf86Info.autoVTSwitch)
+ switch_to(xf86StartVT, "xf86CloseConsole");
}
-#endif /* HAS_USL_VTS */
+#endif /* HAS_USL_VTS */
close(xf86Info.consoleFd);
}
@@ -379,58 +365,54 @@ xf86ProcessArgument(int argc, char **argv, int i)
* Keep server from detaching from controlling tty. This is useful when
* debugging, so the server can receive keyboard signals.
*/
- if (!strcmp(argv[i], "-keeptty"))
- {
- KeepTty = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-keeptty")) {
+ KeepTty = TRUE;
+ return 1;
}
/*
* Undocumented flag to protect page 0 from read/write to help catch NULL
* pointer dereferences. This is purely a debugging flag.
*/
- if (!strcmp(argv[i], "-protect0"))
- {
- Protect0 = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-protect0")) {
+ Protect0 = TRUE;
+ return 1;
}
/*
* Use /dev/console as the console device.
*/
- if (!strcmp(argv[i], "-C"))
- {
- UseConsole = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-C")) {
+ UseConsole = TRUE;
+ return 1;
}
#ifdef HAS_USL_VTS
- if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
- {
- if (sscanf(argv[i], "vt%d", &VTnum) == 0)
- {
- UseMsg();
- VTnum = -1;
- return 0;
- }
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
+ if (sscanf(argv[i], "vt%d", &VTnum) == 0) {
+ UseMsg();
+ VTnum = -1;
+ return 0;
+ }
- return 1;
+ return 1;
}
-#endif /* HAS_USL_VTS */
+#endif /* HAS_USL_VTS */
if ((i + 1) < argc) {
- if (!strcmp(argv[i], "-dev")) {
- strlcpy(xf86SolarisFbDev, argv[i+1], sizeof(xf86SolarisFbDev));
- return 2;
- }
+ if (!strcmp(argv[i], "-dev")) {
+ strlcpy(xf86SolarisFbDev, argv[i + 1], sizeof(xf86SolarisFbDev));
+ return 2;
+ }
}
return 0;
}
-void xf86UseMsg(void)
+void
+xf86UseMsg(void)
{
#ifdef HAS_USL_VTS
ErrorF("vtX Use the specified VT number\n");
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
index b7b7c0ed7..67ef17689 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
@@ -1,258 +1,247 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- * Copyright 1999 by David Holland <davidh@iquest.net>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the names of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
- * SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- *
- */
-/* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <sys/types.h> /* get __x86 definition if not set by compiler */
-
-#if defined(__i386__) || defined(__i386) || defined(__x86)
-# define _NEED_SYSI86
-#endif
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86OSpriv.h"
-#include <sys/mman.h>
-
-/***************************************************************************/
-/* Video Memory Mapping section */
-/***************************************************************************/
-
-static char *apertureDevName = NULL;
-static int apertureDevFD_ro = -1;
-static int apertureDevFD_rw = -1;
-
-static Bool
-solOpenAperture(void)
-{
- if (apertureDevName == NULL)
- {
- apertureDevName = "/dev/xsvc";
- if ((apertureDevFD_rw = open(apertureDevName, O_RDWR)) < 0)
- {
- xf86MsgVerb(X_WARNING, 0,
- "solOpenAperture: failed to open %s (%s)\n",
- apertureDevName, strerror(errno));
- apertureDevName = "/dev/fbs/aperture";
- apertureDevFD_rw = open(apertureDevName, O_RDWR);
- }
- apertureDevFD_ro = open(apertureDevName, O_RDONLY);
-
- if ((apertureDevFD_rw < 0) || (apertureDevFD_ro < 0))
- {
- xf86MsgVerb(X_WARNING, 0,
- "solOpenAperture: failed to open %s (%s)\n",
- apertureDevName, strerror(errno));
- xf86MsgVerb(X_WARNING, 0,
- "solOpenAperture: either /dev/fbs/aperture"
- " or /dev/xsvc required\n");
-
- apertureDevName = NULL;
-
- if (apertureDevFD_rw >= 0)
- {
- close(apertureDevFD_rw);
- }
- apertureDevFD_rw = -1;
-
- if (apertureDevFD_ro >= 0)
- {
- close(apertureDevFD_ro);
- }
- apertureDevFD_ro = -1;
-
- return FALSE;
- }
- }
- return TRUE;
-}
-
-static pointer
-solMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
-{
- pointer base;
- int fd;
- int prot;
-
- if (Flags & VIDMEM_READONLY)
- {
- fd = apertureDevFD_ro;
- prot = PROT_READ;
- }
- else
- {
- fd = apertureDevFD_rw;
- prot = PROT_READ | PROT_WRITE;
- }
-
- if (fd < 0)
- {
- xf86DrvMsg(ScreenNum, X_ERROR,
- "solMapVidMem: failed to open %s (%s)\n",
- apertureDevName, strerror(errno));
- return NULL;
- }
-
- base = mmap(NULL, Size, prot, MAP_SHARED, fd, (off_t)Base);
-
- if (base == MAP_FAILED) {
- xf86DrvMsg(ScreenNum, X_ERROR,
- "solMapVidMem: failed to mmap %s (0x%08lx,0x%lx) (%s)\n",
- apertureDevName, Base, Size, strerror(errno));
- return NULL;
- }
-
- return base;
-}
-
-/* ARGSUSED */
-static void
-solUnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
-{
- if (munmap(Base, Size) != 0) {
- xf86DrvMsgVerb(ScreenNum, X_WARNING, 0,
- "solUnMapVidMem: failed to unmap %s"
- " (0x%p,0x%lx) (%s)\n",
- apertureDevName, Base, Size,
- strerror(errno));
- }
-}
-
-_X_HIDDEN void
-xf86OSInitVidMem(VidMemInfoPtr pVidMem)
-{
- pVidMem->linearSupported = solOpenAperture();
- if (pVidMem->linearSupported) {
- pVidMem->mapMem = solMapVidMem;
- pVidMem->unmapMem = solUnMapVidMem;
- } else {
- xf86MsgVerb(X_WARNING, 0,
- "xf86OSInitVidMem: linear memory access disabled\n");
- }
- pVidMem->initialised = TRUE;
-}
-
-/*
- * Read BIOS via mmap()ing physical memory.
- */
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
-
- if (solOpenAperture() == FALSE)
- {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: Failed to open aperture to read BIOS\n");
- return -1;
- }
-
- ptr = (unsigned char *)mmap(NULL, mlen, PROT_READ,
- MAP_SHARED, apertureDevFD_ro, (off_t)Base);
- if (ptr == MAP_FAILED)
- {
- xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed [0x%08lx, 0x%04x]\n",
- apertureDevName, Base, mlen);
- return -1;
- }
-
- (void)memcpy(Buf, (void *)(ptr + Offset), Len);
- if (munmap((caddr_t)ptr, mlen) != 0) {
- xf86MsgVerb(X_WARNING, 0,
- "xf86ReadBIOS: failed to unmap %s (0x%p,0x%x) (%s)\n",
- apertureDevName, ptr, mlen, strerror(errno));
- }
-
- return Len;
-}
-
-
-/***************************************************************************/
-/* I/O Permissions section */
-/***************************************************************************/
-
-#if defined(__i386__) || defined(__i386) || defined(__x86)
-static Bool ExtendedEnabled = FALSE;
-#endif
-
-Bool
-xf86EnableIO(void)
-{
-#if defined(__i386__) || defined(__i386) || defined(__x86)
- if (ExtendedEnabled)
- return TRUE;
-
- if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
- xf86Msg(X_WARNING, "xf86EnableIOPorts: Failed to set IOPL for I/O\n");
- return FALSE;
- }
- ExtendedEnabled = TRUE;
-#endif /* i386 */
- return TRUE;
-}
-
-void
-xf86DisableIO(void)
-{
-#if defined(__i386__) || defined(__i386) || defined(__x86)
- if(!ExtendedEnabled)
- return;
-
- sysi86(SI86V86, V86SC_IOPL, 0);
-
- ExtendedEnabled = FALSE;
-#endif /* i386 */
-}
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ * Copyright 1999 by David Holland <davidh@iquest.net>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the names of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ */
+/* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/types.h> /* get __x86 definition if not set by compiler */
+
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+#define _NEED_SYSI86
+#endif
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+#include <sys/mman.h>
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+static char *apertureDevName = NULL;
+static int apertureDevFD_ro = -1;
+static int apertureDevFD_rw = -1;
+
+static Bool
+solOpenAperture(void)
+{
+ if (apertureDevName == NULL) {
+ apertureDevName = "/dev/xsvc";
+ if ((apertureDevFD_rw = open(apertureDevName, O_RDWR)) < 0) {
+ xf86MsgVerb(X_WARNING, 0,
+ "solOpenAperture: failed to open %s (%s)\n",
+ apertureDevName, strerror(errno));
+ apertureDevName = "/dev/fbs/aperture";
+ apertureDevFD_rw = open(apertureDevName, O_RDWR);
+ }
+ apertureDevFD_ro = open(apertureDevName, O_RDONLY);
+
+ if ((apertureDevFD_rw < 0) || (apertureDevFD_ro < 0)) {
+ xf86MsgVerb(X_WARNING, 0,
+ "solOpenAperture: failed to open %s (%s)\n",
+ apertureDevName, strerror(errno));
+ xf86MsgVerb(X_WARNING, 0,
+ "solOpenAperture: either /dev/fbs/aperture"
+ " or /dev/xsvc required\n");
+
+ apertureDevName = NULL;
+
+ if (apertureDevFD_rw >= 0) {
+ close(apertureDevFD_rw);
+ }
+ apertureDevFD_rw = -1;
+
+ if (apertureDevFD_ro >= 0) {
+ close(apertureDevFD_ro);
+ }
+ apertureDevFD_ro = -1;
+
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static pointer
+solMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
+{
+ pointer base;
+ int fd;
+ int prot;
+
+ if (Flags & VIDMEM_READONLY) {
+ fd = apertureDevFD_ro;
+ prot = PROT_READ;
+ }
+ else {
+ fd = apertureDevFD_rw;
+ prot = PROT_READ | PROT_WRITE;
+ }
+
+ if (fd < 0) {
+ xf86DrvMsg(ScreenNum, X_ERROR,
+ "solMapVidMem: failed to open %s (%s)\n",
+ apertureDevName, strerror(errno));
+ return NULL;
+ }
+
+ base = mmap(NULL, Size, prot, MAP_SHARED, fd, (off_t) Base);
+
+ if (base == MAP_FAILED) {
+ xf86DrvMsg(ScreenNum, X_ERROR,
+ "solMapVidMem: failed to mmap %s (0x%08lx,0x%lx) (%s)\n",
+ apertureDevName, Base, Size, strerror(errno));
+ return NULL;
+ }
+
+ return base;
+}
+
+/* ARGSUSED */
+static void
+solUnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ if (munmap(Base, Size) != 0) {
+ xf86DrvMsgVerb(ScreenNum, X_WARNING, 0,
+ "solUnMapVidMem: failed to unmap %s"
+ " (0x%p,0x%lx) (%s)\n",
+ apertureDevName, Base, Size, strerror(errno));
+ }
+}
+
+_X_HIDDEN void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ pVidMem->linearSupported = solOpenAperture();
+ if (pVidMem->linearSupported) {
+ pVidMem->mapMem = solMapVidMem;
+ pVidMem->unmapMem = solUnMapVidMem;
+ }
+ else {
+ xf86MsgVerb(X_WARNING, 0,
+ "xf86OSInitVidMem: linear memory access disabled\n");
+ }
+ pVidMem->initialised = TRUE;
+}
+
+/*
+ * Read BIOS via mmap()ing physical memory.
+ */
+int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ unsigned char *ptr;
+ int psize;
+ int mlen;
+
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+
+ if (solOpenAperture() == FALSE) {
+ xf86Msg(X_WARNING,
+ "xf86ReadBIOS: Failed to open aperture to read BIOS\n");
+ return -1;
+ }
+
+ ptr = (unsigned char *) mmap(NULL, mlen, PROT_READ,
+ MAP_SHARED, apertureDevFD_ro, (off_t) Base);
+ if (ptr == MAP_FAILED) {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed [0x%08lx, 0x%04x]\n",
+ apertureDevName, Base, mlen);
+ return -1;
+ }
+
+ (void) memcpy(Buf, (void *) (ptr + Offset), Len);
+ if (munmap((caddr_t) ptr, mlen) != 0) {
+ xf86MsgVerb(X_WARNING, 0,
+ "xf86ReadBIOS: failed to unmap %s (0x%p,0x%x) (%s)\n",
+ apertureDevName, ptr, mlen, strerror(errno));
+ }
+
+ return Len;
+}
+
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+static Bool ExtendedEnabled = FALSE;
+#endif
+
+Bool
+xf86EnableIO(void)
+{
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+ if (ExtendedEnabled)
+ return TRUE;
+
+ if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
+ xf86Msg(X_WARNING, "xf86EnableIOPorts: Failed to set IOPL for I/O\n");
+ return FALSE;
+ }
+ ExtendedEnabled = TRUE;
+#endif /* i386 */
+ return TRUE;
+}
+
+void
+xf86DisableIO(void)
+{
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+ if (!ExtendedEnabled)
+ return;
+
+ sysi86(SI86V86, V86SC_IOPL, 0);
+
+ ExtendedEnabled = FALSE;
+#endif /* i386 */
+}
diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
index 78ea6e660..e171146dd 100644
--- a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
+++ b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
@@ -64,7 +64,6 @@
*
*/
-
#ifndef _XF86_OSPROC_H
#define _XF86_OSPROC_H
@@ -72,7 +71,7 @@
* The actual prototypes have been pulled into this seperate file so
* that they can can be used without pulling in all of the OS specific
* stuff like sys/stat.h, etc. This casues problem for loadable modules.
- */
+ */
/*
* Flags for xf86MapVidMem(). Multiple flags can be or'd together. The
@@ -80,31 +79,31 @@
* enable write combining for memory marked only for framebuffer use.
*/
-#define VIDMEM_FRAMEBUFFER 0x01 /* memory for framebuffer use */
-#define VIDMEM_MMIO 0x02 /* memory for I/O use */
-#define VIDMEM_MMIO_32BIT 0x04 /* memory accesses >= 32bit */
-#define VIDMEM_READSIDEEFFECT 0x08 /* reads can have side-effects */
-#define VIDMEM_SPARSE 0x10 /* sparse mapping required
- * assumed when VIDMEM_MMIO is
- * set. May be used with
- * VIDMEM_FRAMEBUFFER) */
-#define VIDMEM_READONLY 0x20 /* read-only mapping
- * used when reading BIOS images
- * through xf86MapVidMem() */
+#define VIDMEM_FRAMEBUFFER 0x01 /* memory for framebuffer use */
+#define VIDMEM_MMIO 0x02 /* memory for I/O use */
+#define VIDMEM_MMIO_32BIT 0x04 /* memory accesses >= 32bit */
+#define VIDMEM_READSIDEEFFECT 0x08 /* reads can have side-effects */
+#define VIDMEM_SPARSE 0x10 /* sparse mapping required
+ * assumed when VIDMEM_MMIO is
+ * set. May be used with
+ * VIDMEM_FRAMEBUFFER) */
+#define VIDMEM_READONLY 0x20 /* read-only mapping
+ * used when reading BIOS images
+ * through xf86MapVidMem() */
/*
* OS-independent modem state flags for xf86SetSerialModemState() and
* xf86GetSerialModemState().
*/
-#define XF86_M_LE 0x001 /* line enable */
-#define XF86_M_DTR 0x002 /* data terminal ready */
-#define XF86_M_RTS 0x004 /* request to send */
-#define XF86_M_ST 0x008 /* secondary transmit */
-#define XF86_M_SR 0x010 /* secondary receive */
-#define XF86_M_CTS 0x020 /* clear to send */
-#define XF86_M_CAR 0x040 /* carrier detect */
-#define XF86_M_RNG 0x080 /* ring */
-#define XF86_M_DSR 0x100 /* data set ready */
+#define XF86_M_LE 0x001 /* line enable */
+#define XF86_M_DTR 0x002 /* data terminal ready */
+#define XF86_M_RTS 0x004 /* request to send */
+#define XF86_M_ST 0x008 /* secondary transmit */
+#define XF86_M_SR 0x010 /* secondary receive */
+#define XF86_M_CTS 0x020 /* clear to send */
+#define XF86_M_CAR 0x040 /* carrier detect */
+#define XF86_M_RNG 0x080 /* ring */
+#define XF86_M_DSR 0x100 /* data set ready */
#ifndef NO_OSLIB_PROTOTYPES
/*
@@ -133,12 +132,17 @@ _XFUNCPROTOBEGIN
/* public functions */
extern _X_EXPORT Bool xf86LinearVidMem(void);
extern _X_EXPORT _X_DEPRECATED Bool xf86CheckMTRR(int);
-extern _X_EXPORT _X_DEPRECATED pointer xf86MapVidMem(int, int, unsigned long, unsigned long);
-extern _X_EXPORT _X_DEPRECATED void xf86UnMapVidMem(int, pointer, unsigned long);
-extern _X_EXPORT _X_DEPRECATED void xf86MapReadSideEffects(int, int, pointer, unsigned long);
-extern _X_EXPORT int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int);
+extern _X_EXPORT _X_DEPRECATED pointer xf86MapVidMem(int, int, unsigned long,
+ unsigned long);
+extern _X_EXPORT _X_DEPRECATED void xf86UnMapVidMem(int, pointer,
+ unsigned long);
+extern _X_EXPORT _X_DEPRECATED void xf86MapReadSideEffects(int, int, pointer,
+ unsigned long);
+extern _X_EXPORT int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *,
+ int);
extern _X_EXPORT Bool xf86EnableIO(void);
extern _X_EXPORT void xf86DisableIO(void);
+
#ifdef __NetBSD__
extern _X_EXPORT void xf86SetTVOut(int);
extern _X_EXPORT void xf86SetRGBOut(void);
@@ -164,23 +168,24 @@ extern _X_EXPORT int xf86LoadKernelModule(const char *pathname);
/* AGP GART interface */
typedef struct _AgpInfo {
- CARD32 bridgeId;
- CARD32 agpMode;
- unsigned long base;
- unsigned long size;
- unsigned long totalPages;
- unsigned long systemPages;
- unsigned long usedPages;
+ CARD32 bridgeId;
+ CARD32 agpMode;
+ unsigned long base;
+ unsigned long size;
+ unsigned long totalPages;
+ unsigned long systemPages;
+ unsigned long usedPages;
} AgpInfo, *AgpInfoPtr;
extern _X_EXPORT Bool xf86AgpGARTSupported(void);
extern _X_EXPORT AgpInfoPtr xf86GetAGPInfo(int screenNum);
extern _X_EXPORT Bool xf86AcquireGART(int screenNum);
extern _X_EXPORT Bool xf86ReleaseGART(int screenNum);
-extern _X_EXPORT int xf86AllocateGARTMemory(int screenNum, unsigned long size, int type,
- unsigned long *physical);
+extern _X_EXPORT int xf86AllocateGARTMemory(int screenNum, unsigned long size,
+ int type, unsigned long *physical);
extern _X_EXPORT Bool xf86DeallocateGARTMemory(int screenNum, int key);
-extern _X_EXPORT Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset);
+extern _X_EXPORT Bool xf86BindGARTMemory(int screenNum, int key,
+ unsigned long offset);
extern _X_EXPORT Bool xf86UnbindGARTMemory(int screenNum, int key);
extern _X_EXPORT Bool xf86EnableAGP(int screenNum, CARD32 mode);
extern _X_EXPORT Bool xf86GARTCloseScreen(int screenNum);
@@ -189,15 +194,16 @@ extern _X_EXPORT Bool xf86GARTCloseScreen(int screenNum);
module. These routines are small, and the code if very POSIX-signal (or
OS-signal) specific, so it seemed better to provide more complex
wrappers than to wrap each individual function called. */
-extern _X_EXPORT int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *);
+extern _X_EXPORT int xf86InstallSIGIOHandler(int fd, void (*f) (int, void *),
+ void *);
extern _X_EXPORT int xf86RemoveSIGIOHandler(int fd);
-extern _X_EXPORT int xf86BlockSIGIO (void);
-extern _X_EXPORT void xf86UnblockSIGIO (int);
-extern _X_EXPORT void xf86AssertBlockedSIGIO (char *);
-extern _X_EXPORT Bool xf86SIGIOSupported (void);
+extern _X_EXPORT int xf86BlockSIGIO(void);
+extern _X_EXPORT void xf86UnblockSIGIO(int);
+extern _X_EXPORT void xf86AssertBlockedSIGIO(char *);
+extern _X_EXPORT Bool xf86SIGIOSupported(void);
#ifdef XF86_OS_PRIVS
-typedef void (*PMClose)(void);
+typedef void (*PMClose) (void);
extern _X_EXPORT void xf86OpenConsole(void);
extern _X_EXPORT void xf86CloseConsole(void);
extern _X_HIDDEN Bool xf86VTActivate(int vtno);
@@ -209,13 +215,12 @@ extern _X_EXPORT int xf86ProcessArgument(int, char **, int);
extern _X_EXPORT void xf86UseMsg(void);
extern _X_EXPORT PMClose xf86OSPMOpen(void);
-extern _X_EXPORT _X_DEPRECATED void xf86MakeNewMapping(int, int, unsigned long, unsigned long, pointer);
+extern _X_EXPORT _X_DEPRECATED void xf86MakeNewMapping(int, int, unsigned long,
+ unsigned long, pointer);
extern _X_EXPORT void xf86InitVidMem(void);
-#endif /* XF86_OS_PRIVS */
-
+#endif /* XF86_OS_PRIVS */
_XFUNCPROTOEND
-#endif /* NO_OSLIB_PROTOTYPES */
-
-#endif /* _XF86_OSPROC_H */
+#endif /* NO_OSLIB_PROTOTYPES */
+#endif /* _XF86_OSPROC_H */
diff --git a/xorg-server/hw/xfree86/parser/Configint.h b/xorg-server/hw/xfree86/parser/Configint.h
index 3f84ff0fa..81cc1fc59 100644
--- a/xorg-server/hw/xfree86/parser/Configint.h
+++ b/xorg-server/hw/xfree86/parser/Configint.h
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/*
* These definitions are used through out the configuration file parser, but
* they should not be visible outside of the parser.
@@ -73,14 +72,12 @@
typedef enum { PARSE_DECIMAL, PARSE_OCTAL, PARSE_HEX } ParserNumType;
-typedef struct
-{
- int num; /* returned number */
- char *str; /* private copy of the return-string */
- double realnum; /* returned number as a real */
- ParserNumType numType; /* used to enforce correct number formatting */
-}
-LexRec, *LexPtr;
+typedef struct {
+ int num; /* returned number */
+ char *str; /* private copy of the return-string */
+ double realnum; /* returned number as a real */
+ ParserNumType numType; /* used to enforce correct number formatting */
+} LexRec, *LexPtr;
#ifndef TRUE
#define TRUE 1
@@ -210,4 +207,4 @@ else\
#define OBSOLETE_MSG \
"Ignoring obsolete keyword \"%s\"."
-#endif /* _Configint_h_ */
+#endif /* _Configint_h_ */
diff --git a/xorg-server/hw/xfree86/parser/DRI.c b/xorg-server/hw/xfree86/parser/DRI.c
index 77846da2b..e8d26255f 100644
--- a/xorg-server/hw/xfree86/parser/DRI.c
+++ b/xorg-server/hw/xfree86/parser/DRI.c
@@ -37,87 +37,86 @@
extern LexRec val;
-static xf86ConfigSymTabRec DRITab[] =
-{
+static xf86ConfigSymTabRec DRITab[] = {
{ENDSECTION, "endsection"},
- {GROUP, "group"},
- {MODE, "mode"},
- {-1, ""},
+ {GROUP, "group"},
+ {MODE, "mode"},
+ {-1, ""},
};
#define CLEANUP xf86freeDRI
XF86ConfDRIPtr
-xf86parseDRISection (void)
+xf86parseDRISection(void)
{
int token;
- parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec);
+
+ parsePrologue(XF86ConfDRIPtr, XF86ConfDRIRec);
/* Zero is a valid value for this. */
ptr->dri_group = -1;
- while ((token = xf86getToken (DRITab)) != ENDSECTION) {
- switch (token)
- {
- case GROUP:
- if ((token = xf86getSubToken (&(ptr->dri_comment))) == STRING)
- ptr->dri_group_name = val.str;
- else if (token == NUMBER)
- ptr->dri_group = val.num;
- else
- Error (GROUP_MSG);
- break;
- case MODE:
- if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER)
- Error (NUMBER_MSG, "Mode");
- if (val.numType != PARSE_OCTAL)
- Error (MUST_BE_OCTAL_MSG, val.num);
- ptr->dri_mode = val.num;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- case COMMENT:
- ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
+ while ((token = xf86getToken(DRITab)) != ENDSECTION) {
+ switch (token) {
+ case GROUP:
+ if ((token = xf86getSubToken(&(ptr->dri_comment))) == STRING)
+ ptr->dri_group_name = val.str;
+ else if (token == NUMBER)
+ ptr->dri_group = val.num;
+ else
+ Error(GROUP_MSG);
+ break;
+ case MODE:
+ if (xf86getSubToken(&(ptr->dri_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Mode");
+ if (val.numType != PARSE_OCTAL)
+ Error(MUST_BE_OCTAL_MSG, val.num);
+ ptr->dri_mode = val.num;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ case COMMENT:
+ ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
}
-
+
#ifdef DEBUG
ErrorF("DRI section parsed\n");
#endif
-
+
return ptr;
}
#undef CLEANUP
void
-xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr)
+xf86printDRISection(FILE * cf, XF86ConfDRIPtr ptr)
{
if (ptr == NULL)
- return;
-
- fprintf (cf, "Section \"DRI\"\n");
+ return;
+
+ fprintf(cf, "Section \"DRI\"\n");
if (ptr->dri_comment)
- fprintf (cf, "%s", ptr->dri_comment);
+ fprintf(cf, "%s", ptr->dri_comment);
if (ptr->dri_group_name)
- fprintf (cf, "\tGroup \"%s\"\n", ptr->dri_group_name);
+ fprintf(cf, "\tGroup \"%s\"\n", ptr->dri_group_name);
else if (ptr->dri_group >= 0)
- fprintf (cf, "\tGroup %d\n", ptr->dri_group);
+ fprintf(cf, "\tGroup %d\n", ptr->dri_group);
if (ptr->dri_mode)
- fprintf (cf, "\tMode 0%o\n", ptr->dri_mode);
- fprintf (cf, "EndSection\n\n");
+ fprintf(cf, "\tMode 0%o\n", ptr->dri_mode);
+ fprintf(cf, "EndSection\n\n");
}
void
-xf86freeDRI (XF86ConfDRIPtr ptr)
+xf86freeDRI(XF86ConfDRIPtr ptr)
{
if (ptr == NULL)
- return;
-
- TestFree (ptr->dri_comment);
- free (ptr);
+ return;
+
+ TestFree(ptr->dri_comment);
+ free(ptr);
}
diff --git a/xorg-server/hw/xfree86/parser/Device.c b/xorg-server/hw/xfree86/parser/Device.c
index d99dbf79d..f27b56fef 100644
--- a/xorg-server/hw/xfree86/parser/Device.c
+++ b/xorg-server/hw/xfree86/parser/Device.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -66,306 +65,296 @@
extern LexRec val;
static
-xf86ConfigSymTabRec DeviceTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {VENDOR, "vendorname"},
- {BOARD, "boardname"},
- {CHIPSET, "chipset"},
- {RAMDAC, "ramdac"},
- {DACSPEED, "dacspeed"},
- {CLOCKS, "clocks"},
- {OPTION, "option"},
- {VIDEORAM, "videoram"},
- {BIOSBASE, "biosbase"},
- {MEMBASE, "membase"},
- {IOBASE, "iobase"},
- {CLOCKCHIP, "clockchip"},
- {CHIPID, "chipid"},
- {CHIPREV, "chiprev"},
- {CARD, "card"},
- {DRIVER, "driver"},
- {BUSID, "busid"},
- {TEXTCLOCKFRQ, "textclockfreq"},
- {IRQ, "irq"},
- {SCREEN, "screen"},
- {-1, ""},
+xf86ConfigSymTabRec DeviceTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {VENDOR, "vendorname"},
+ {BOARD, "boardname"},
+ {CHIPSET, "chipset"},
+ {RAMDAC, "ramdac"},
+ {DACSPEED, "dacspeed"},
+ {CLOCKS, "clocks"},
+ {OPTION, "option"},
+ {VIDEORAM, "videoram"},
+ {BIOSBASE, "biosbase"},
+ {MEMBASE, "membase"},
+ {IOBASE, "iobase"},
+ {CLOCKCHIP, "clockchip"},
+ {CHIPID, "chipid"},
+ {CHIPREV, "chiprev"},
+ {CARD, "card"},
+ {DRIVER, "driver"},
+ {BUSID, "busid"},
+ {TEXTCLOCKFRQ, "textclockfreq"},
+ {IRQ, "irq"},
+ {SCREEN, "screen"},
+ {-1, ""},
};
#define CLEANUP xf86freeDeviceList
XF86ConfDevicePtr
-xf86parseDeviceSection (void)
+xf86parseDeviceSection(void)
{
- int i;
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
+ int i;
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec)
- /* Zero is a valid value for these */
- ptr->dev_chipid = -1;
- ptr->dev_chiprev = -1;
- ptr->dev_irq = -1;
- while ((token = xf86getToken (DeviceTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->dev_comment = xf86addComment(ptr->dev_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->dev_identifier = val.str;
- has_ident = TRUE;
- break;
- case VENDOR:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Vendor");
- ptr->dev_vendor = val.str;
- break;
- case BOARD:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Board");
- ptr->dev_board = val.str;
- break;
- case CHIPSET:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Chipset");
- ptr->dev_chipset = val.str;
- break;
- case CARD:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Card");
- ptr->dev_card = val.str;
- break;
- case DRIVER:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Driver");
- ptr->dev_driver = val.str;
- break;
- case RAMDAC:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Ramdac");
- ptr->dev_ramdac = val.str;
- break;
- case DACSPEED:
- for (i = 0; i < CONF_MAXDACSPEEDS; i++)
- ptr->dev_dacSpeeds[i] = 0;
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- {
- Error (DACSPEED_MSG, CONF_MAXDACSPEEDS);
- }
- else
- {
- ptr->dev_dacSpeeds[0] = (int) (val.realnum * 1000.0 + 0.5);
- for (i = 1; i < CONF_MAXDACSPEEDS; i++)
- {
- if (xf86getSubToken (&(ptr->dev_comment)) == NUMBER)
- ptr->dev_dacSpeeds[i] = (int)
- (val.realnum * 1000.0 + 0.5);
- else
- {
- xf86unGetToken (token);
- break;
- }
- }
- }
- break;
- case VIDEORAM:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "VideoRam");
- ptr->dev_videoram = val.num;
- break;
- case BIOSBASE:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "BIOSBase");
- ptr->dev_bios_base = val.num;
- break;
- case MEMBASE:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "MemBase");
- ptr->dev_mem_base = val.num;
- break;
- case IOBASE:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "IOBase");
- ptr->dev_io_base = val.num;
- break;
- case CLOCKCHIP:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "ClockChip");
- ptr->dev_clockchip = val.str;
- break;
- case CHIPID:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "ChipID");
- ptr->dev_chipid = val.num;
- break;
- case CHIPREV:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "ChipRev");
- ptr->dev_chiprev = val.num;
- break;
+ /* Zero is a valid value for these */
+ ptr->dev_chipid = -1;
+ ptr->dev_chiprev = -1;
+ ptr->dev_irq = -1;
+ while ((token = xf86getToken(DeviceTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->dev_comment = xf86addComment(ptr->dev_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->dev_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case VENDOR:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Vendor");
+ ptr->dev_vendor = val.str;
+ break;
+ case BOARD:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Board");
+ ptr->dev_board = val.str;
+ break;
+ case CHIPSET:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Chipset");
+ ptr->dev_chipset = val.str;
+ break;
+ case CARD:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Card");
+ ptr->dev_card = val.str;
+ break;
+ case DRIVER:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Driver");
+ ptr->dev_driver = val.str;
+ break;
+ case RAMDAC:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Ramdac");
+ ptr->dev_ramdac = val.str;
+ break;
+ case DACSPEED:
+ for (i = 0; i < CONF_MAXDACSPEEDS; i++)
+ ptr->dev_dacSpeeds[i] = 0;
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) {
+ Error(DACSPEED_MSG, CONF_MAXDACSPEEDS);
+ }
+ else {
+ ptr->dev_dacSpeeds[0] = (int) (val.realnum * 1000.0 + 0.5);
+ for (i = 1; i < CONF_MAXDACSPEEDS; i++) {
+ if (xf86getSubToken(&(ptr->dev_comment)) == NUMBER)
+ ptr->dev_dacSpeeds[i] = (int)
+ (val.realnum * 1000.0 + 0.5);
+ else {
+ xf86unGetToken(token);
+ break;
+ }
+ }
+ }
+ break;
+ case VIDEORAM:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "VideoRam");
+ ptr->dev_videoram = val.num;
+ break;
+ case BIOSBASE:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "BIOSBase");
+ ptr->dev_bios_base = val.num;
+ break;
+ case MEMBASE:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "MemBase");
+ ptr->dev_mem_base = val.num;
+ break;
+ case IOBASE:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "IOBase");
+ ptr->dev_io_base = val.num;
+ break;
+ case CLOCKCHIP:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "ClockChip");
+ ptr->dev_clockchip = val.str;
+ break;
+ case CHIPID:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "ChipID");
+ ptr->dev_chipid = val.num;
+ break;
+ case CHIPREV:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "ChipRev");
+ ptr->dev_chiprev = val.num;
+ break;
- case CLOCKS:
- token = xf86getSubToken(&(ptr->dev_comment));
- for( i = ptr->dev_clocks;
- token == NUMBER && i < CONF_MAXCLOCKS; i++ ) {
- ptr->dev_clock[i] = (int)(val.realnum * 1000.0 + 0.5);
- token = xf86getSubToken(&(ptr->dev_comment));
- }
- ptr->dev_clocks = i;
- xf86unGetToken (token);
- break;
- case TEXTCLOCKFRQ:
- if ((token = xf86getSubToken(&(ptr->dev_comment))) != NUMBER)
- Error (NUMBER_MSG, "TextClockFreq");
- ptr->dev_textclockfreq = (int)(val.realnum * 1000.0 + 0.5);
- break;
- case OPTION:
- ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst);
- break;
- case BUSID:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "BusID");
- ptr->dev_busid = val.str;
- break;
- case IRQ:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (QUOTE_MSG, "IRQ");
- ptr->dev_irq = val.num;
- break;
- case SCREEN:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "Screen");
- ptr->dev_screen = val.num;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ case CLOCKS:
+ token = xf86getSubToken(&(ptr->dev_comment));
+ for (i = ptr->dev_clocks;
+ token == NUMBER && i < CONF_MAXCLOCKS; i++) {
+ ptr->dev_clock[i] = (int) (val.realnum * 1000.0 + 0.5);
+ token = xf86getSubToken(&(ptr->dev_comment));
+ }
+ ptr->dev_clocks = i;
+ xf86unGetToken(token);
+ break;
+ case TEXTCLOCKFRQ:
+ if ((token = xf86getSubToken(&(ptr->dev_comment))) != NUMBER)
+ Error(NUMBER_MSG, "TextClockFreq");
+ ptr->dev_textclockfreq = (int) (val.realnum * 1000.0 + 0.5);
+ break;
+ case OPTION:
+ ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst);
+ break;
+ case BUSID:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "BusID");
+ ptr->dev_busid = val.str;
+ break;
+ case IRQ:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(QUOTE_MSG, "IRQ");
+ ptr->dev_irq = val.num;
+ break;
+ case SCREEN:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Screen");
+ ptr->dev_screen = val.num;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
- if (!has_ident)
- Error (NO_IDENT_MSG);
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Device section parsed\n");
+ printf("Device section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printDeviceSection (FILE * cf, XF86ConfDevicePtr ptr)
+xf86printDeviceSection(FILE * cf, XF86ConfDevicePtr ptr)
{
- int i;
+ int i;
- while (ptr)
- {
- fprintf (cf, "Section \"Device\"\n");
- if (ptr->dev_comment)
- fprintf (cf, "%s", ptr->dev_comment);
- if (ptr->dev_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->dev_identifier);
- if (ptr->dev_driver)
- fprintf (cf, "\tDriver \"%s\"\n", ptr->dev_driver);
- if (ptr->dev_vendor)
- fprintf (cf, "\tVendorName \"%s\"\n", ptr->dev_vendor);
- if (ptr->dev_board)
- fprintf (cf, "\tBoardName \"%s\"\n", ptr->dev_board);
- if (ptr->dev_chipset)
- fprintf (cf, "\tChipSet \"%s\"\n", ptr->dev_chipset);
- if (ptr->dev_card)
- fprintf (cf, "\tCard \"%s\"\n", ptr->dev_card);
- if (ptr->dev_ramdac)
- fprintf (cf, "\tRamDac \"%s\"\n", ptr->dev_ramdac);
- if (ptr->dev_dacSpeeds[0] > 0 ) {
- fprintf (cf, "\tDacSpeed ");
- for (i = 0; i < CONF_MAXDACSPEEDS
- && ptr->dev_dacSpeeds[i] > 0; i++ )
- fprintf (cf, "%g ", (double) (ptr->dev_dacSpeeds[i])/ 1000.0 );
- fprintf (cf, "\n");
- }
- if (ptr->dev_videoram)
- fprintf (cf, "\tVideoRam %d\n", ptr->dev_videoram);
- if (ptr->dev_bios_base)
- fprintf (cf, "\tBiosBase 0x%lx\n", ptr->dev_bios_base);
- if (ptr->dev_mem_base)
- fprintf (cf, "\tMemBase 0x%lx\n", ptr->dev_mem_base);
- if (ptr->dev_io_base)
- fprintf (cf, "\tIOBase 0x%lx\n", ptr->dev_io_base);
- if (ptr->dev_clockchip)
- fprintf (cf, "\tClockChip \"%s\"\n", ptr->dev_clockchip);
- if (ptr->dev_chipid != -1)
- fprintf (cf, "\tChipId 0x%x\n", ptr->dev_chipid);
- if (ptr->dev_chiprev != -1)
- fprintf (cf, "\tChipRev 0x%x\n", ptr->dev_chiprev);
+ while (ptr) {
+ fprintf(cf, "Section \"Device\"\n");
+ if (ptr->dev_comment)
+ fprintf(cf, "%s", ptr->dev_comment);
+ if (ptr->dev_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->dev_identifier);
+ if (ptr->dev_driver)
+ fprintf(cf, "\tDriver \"%s\"\n", ptr->dev_driver);
+ if (ptr->dev_vendor)
+ fprintf(cf, "\tVendorName \"%s\"\n", ptr->dev_vendor);
+ if (ptr->dev_board)
+ fprintf(cf, "\tBoardName \"%s\"\n", ptr->dev_board);
+ if (ptr->dev_chipset)
+ fprintf(cf, "\tChipSet \"%s\"\n", ptr->dev_chipset);
+ if (ptr->dev_card)
+ fprintf(cf, "\tCard \"%s\"\n", ptr->dev_card);
+ if (ptr->dev_ramdac)
+ fprintf(cf, "\tRamDac \"%s\"\n", ptr->dev_ramdac);
+ if (ptr->dev_dacSpeeds[0] > 0) {
+ fprintf(cf, "\tDacSpeed ");
+ for (i = 0; i < CONF_MAXDACSPEEDS && ptr->dev_dacSpeeds[i] > 0; i++)
+ fprintf(cf, "%g ", (double) (ptr->dev_dacSpeeds[i]) / 1000.0);
+ fprintf(cf, "\n");
+ }
+ if (ptr->dev_videoram)
+ fprintf(cf, "\tVideoRam %d\n", ptr->dev_videoram);
+ if (ptr->dev_bios_base)
+ fprintf(cf, "\tBiosBase 0x%lx\n", ptr->dev_bios_base);
+ if (ptr->dev_mem_base)
+ fprintf(cf, "\tMemBase 0x%lx\n", ptr->dev_mem_base);
+ if (ptr->dev_io_base)
+ fprintf(cf, "\tIOBase 0x%lx\n", ptr->dev_io_base);
+ if (ptr->dev_clockchip)
+ fprintf(cf, "\tClockChip \"%s\"\n", ptr->dev_clockchip);
+ if (ptr->dev_chipid != -1)
+ fprintf(cf, "\tChipId 0x%x\n", ptr->dev_chipid);
+ if (ptr->dev_chiprev != -1)
+ fprintf(cf, "\tChipRev 0x%x\n", ptr->dev_chiprev);
- xf86printOptionList(cf, ptr->dev_option_lst, 1);
- if (ptr->dev_clocks > 0 ) {
- fprintf (cf, "\tClocks ");
- for (i = 0; i < ptr->dev_clocks; i++ )
- fprintf (cf, "%.1f ", (double)ptr->dev_clock[i] / 1000.0 );
- fprintf (cf, "\n");
- }
- if (ptr->dev_textclockfreq) {
- fprintf (cf, "\tTextClockFreq %.1f\n",
- (double)ptr->dev_textclockfreq / 1000.0);
- }
- if (ptr->dev_busid)
- fprintf (cf, "\tBusID \"%s\"\n", ptr->dev_busid);
- if (ptr->dev_screen > 0)
- fprintf (cf, "\tScreen %d\n", ptr->dev_screen);
- if (ptr->dev_irq >= 0)
- fprintf (cf, "\tIRQ %d\n", ptr->dev_irq);
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ xf86printOptionList(cf, ptr->dev_option_lst, 1);
+ if (ptr->dev_clocks > 0) {
+ fprintf(cf, "\tClocks ");
+ for (i = 0; i < ptr->dev_clocks; i++)
+ fprintf(cf, "%.1f ", (double) ptr->dev_clock[i] / 1000.0);
+ fprintf(cf, "\n");
+ }
+ if (ptr->dev_textclockfreq) {
+ fprintf(cf, "\tTextClockFreq %.1f\n",
+ (double) ptr->dev_textclockfreq / 1000.0);
+ }
+ if (ptr->dev_busid)
+ fprintf(cf, "\tBusID \"%s\"\n", ptr->dev_busid);
+ if (ptr->dev_screen > 0)
+ fprintf(cf, "\tScreen %d\n", ptr->dev_screen);
+ if (ptr->dev_irq >= 0)
+ fprintf(cf, "\tIRQ %d\n", ptr->dev_irq);
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeDeviceList (XF86ConfDevicePtr ptr)
+xf86freeDeviceList(XF86ConfDevicePtr ptr)
{
- XF86ConfDevicePtr prev;
+ XF86ConfDevicePtr prev;
- while (ptr)
- {
- TestFree (ptr->dev_identifier);
- TestFree (ptr->dev_vendor);
- TestFree (ptr->dev_board);
- TestFree (ptr->dev_chipset);
- TestFree (ptr->dev_card);
- TestFree (ptr->dev_driver);
- TestFree (ptr->dev_ramdac);
- TestFree (ptr->dev_clockchip);
- TestFree (ptr->dev_comment);
- xf86optionListFree (ptr->dev_option_lst);
+ while (ptr) {
+ TestFree(ptr->dev_identifier);
+ TestFree(ptr->dev_vendor);
+ TestFree(ptr->dev_board);
+ TestFree(ptr->dev_chipset);
+ TestFree(ptr->dev_card);
+ TestFree(ptr->dev_driver);
+ TestFree(ptr->dev_ramdac);
+ TestFree(ptr->dev_clockchip);
+ TestFree(ptr->dev_comment);
+ xf86optionListFree(ptr->dev_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
XF86ConfDevicePtr
-xf86findDevice (const char *ident, XF86ConfDevicePtr p)
+xf86findDevice(const char *ident, XF86ConfDevicePtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->dev_identifier) == 0)
- return p;
+ while (p) {
+ if (xf86nameCompare(ident, p->dev_identifier) == 0)
+ return p;
- p = p->list.next;
- }
- return NULL;
+ p = p->list.next;
+ }
+ return NULL;
}
diff --git a/xorg-server/hw/xfree86/parser/Extensions.c b/xorg-server/hw/xfree86/parser/Extensions.c
index 662f5260c..ec0bda4c0 100644
--- a/xorg-server/hw/xfree86/parser/Extensions.c
+++ b/xorg-server/hw/xfree86/parser/Extensions.c
@@ -41,37 +41,37 @@
extern LexRec val;
-static xf86ConfigSymTabRec ExtensionsTab[] =
-{
+static xf86ConfigSymTabRec ExtensionsTab[] = {
{ENDSECTION, "endsection"},
- {OPTION, "option"},
- {-1, ""},
+ {OPTION, "option"},
+ {-1, ""},
};
#define CLEANUP xf86freeExtensions
XF86ConfExtensionsPtr
-xf86parseExtensionsSection (void)
+xf86parseExtensionsSection(void)
{
int token;
- parsePrologue (XF86ConfExtensionsPtr, XF86ConfExtensionsRec);
-
- while ((token = xf86getToken (ExtensionsTab)) != ENDSECTION) {
- switch (token) {
- case OPTION:
- ptr->ext_option_lst = xf86parseOption(ptr->ext_option_lst);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- case COMMENT:
- ptr->extensions_comment =
- xf86addComment(ptr->extensions_comment, val.str);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
+
+ parsePrologue(XF86ConfExtensionsPtr, XF86ConfExtensionsRec);
+
+ while ((token = xf86getToken(ExtensionsTab)) != ENDSECTION) {
+ switch (token) {
+ case OPTION:
+ ptr->ext_option_lst = xf86parseOption(ptr->ext_option_lst);
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ case COMMENT:
+ ptr->extensions_comment =
+ xf86addComment(ptr->extensions_comment, val.str);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
}
#ifdef DEBUG
@@ -84,28 +84,28 @@ xf86parseExtensionsSection (void)
#undef CLEANUP
void
-xf86printExtensionsSection (FILE * cf, XF86ConfExtensionsPtr ptr)
+xf86printExtensionsSection(FILE * cf, XF86ConfExtensionsPtr ptr)
{
XF86OptionPtr p;
if (ptr == NULL || ptr->ext_option_lst == NULL)
- return;
+ return;
p = ptr->ext_option_lst;
- fprintf (cf, "Section \"Extensions\"\n");
+ fprintf(cf, "Section \"Extensions\"\n");
if (ptr->extensions_comment)
- fprintf (cf, "%s", ptr->extensions_comment);
+ fprintf(cf, "%s", ptr->extensions_comment);
xf86printOptionList(cf, p, 1);
- fprintf (cf, "EndSection\n\n");
+ fprintf(cf, "EndSection\n\n");
}
void
-xf86freeExtensions (XF86ConfExtensionsPtr ptr)
+xf86freeExtensions(XF86ConfExtensionsPtr ptr)
{
if (ptr == NULL)
- return;
+ return;
- xf86optionListFree (ptr->ext_option_lst);
- TestFree (ptr->extensions_comment);
- free (ptr);
+ xf86optionListFree(ptr->ext_option_lst);
+ TestFree(ptr->extensions_comment);
+ free(ptr);
}
diff --git a/xorg-server/hw/xfree86/parser/Files.c b/xorg-server/hw/xfree86/parser/Files.c
index a95be9ee2..d8152c008 100644
--- a/xorg-server/hw/xfree86/parser/Files.c
+++ b/xorg-server/hw/xfree86/parser/Files.c
@@ -51,7 +51,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,181 +64,169 @@
extern LexRec val;
-static xf86ConfigSymTabRec FilesTab[] =
-{
- {ENDSECTION, "endsection"},
- {FONTPATH, "fontpath"},
- {MODULEPATH, "modulepath"},
- {LOGFILEPATH, "logfile"},
- {XKBDIR, "xkbdir"},
- /* Obsolete keywords that aren't used but shouldn't cause errors: */
- {OBSOLETE_TOKEN, "rgbpath"},
- {OBSOLETE_TOKEN, "inputdevices"},
- {-1, ""},
+static xf86ConfigSymTabRec FilesTab[] = {
+ {ENDSECTION, "endsection"},
+ {FONTPATH, "fontpath"},
+ {MODULEPATH, "modulepath"},
+ {LOGFILEPATH, "logfile"},
+ {XKBDIR, "xkbdir"},
+ /* Obsolete keywords that aren't used but shouldn't cause errors: */
+ {OBSOLETE_TOKEN, "rgbpath"},
+ {OBSOLETE_TOKEN, "inputdevices"},
+ {-1, ""},
};
#define CLEANUP xf86freeFiles
XF86ConfFilesPtr
-xf86parseFilesSection (void)
+xf86parseFilesSection(void)
{
- int i, j;
- int k, l;
- char *str;
- int token;
- parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec)
-
- while ((token = xf86getToken (FilesTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->file_comment = xf86addComment(ptr->file_comment, val.str);
- break;
- case FONTPATH:
- if (xf86getSubToken (&(ptr->file_comment)) != STRING)
- Error (QUOTE_MSG, "FontPath");
- j = FALSE;
- str = val.str;
- if (ptr->file_fontpath == NULL)
- {
- ptr->file_fontpath = malloc (1);
- ptr->file_fontpath[0] = '\0';
- i = strlen (str) + 1;
- }
- else
- {
- i = strlen (ptr->file_fontpath) + strlen (str) + 1;
- if (ptr->file_fontpath[strlen (ptr->file_fontpath) - 1] != ',')
- {
- i++;
- j = TRUE;
- }
- }
- ptr->file_fontpath =
- realloc (ptr->file_fontpath, i);
- if (j)
- strcat (ptr->file_fontpath, ",");
-
- strcat (ptr->file_fontpath, str);
- free (val.str);
- break;
- case MODULEPATH:
- if (xf86getSubToken (&(ptr->file_comment)) != STRING)
- Error (QUOTE_MSG, "ModulePath");
- l = FALSE;
- str = val.str;
- if (ptr->file_modulepath == NULL)
- {
- ptr->file_modulepath = malloc (1);
- ptr->file_modulepath[0] = '\0';
- k = strlen (str) + 1;
- }
- else
- {
- k = strlen (ptr->file_modulepath) + strlen (str) + 1;
- if (ptr->file_modulepath[strlen (ptr->file_modulepath) - 1] != ',')
- {
- k++;
- l = TRUE;
- }
- }
- ptr->file_modulepath = realloc (ptr->file_modulepath, k);
- if (l)
- strcat (ptr->file_modulepath, ",");
-
- strcat (ptr->file_modulepath, str);
- free (val.str);
- break;
- case LOGFILEPATH:
- if (xf86getSubToken (&(ptr->file_comment)) != STRING)
- Error (QUOTE_MSG, "LogFile");
- ptr->file_logfile = val.str;
- break;
- case XKBDIR:
- if (xf86getSubToken (&(ptr->file_xkbdir)) != STRING)
- Error (QUOTE_MSG, "XkbDir");
- ptr->file_xkbdir = val.str;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- case OBSOLETE_TOKEN:
- xf86parseError (OBSOLETE_MSG, xf86tokenString ());
- xf86getSubToken (&(ptr->file_comment));
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ int i, j;
+ int k, l;
+ char *str;
+ int token;
+
+ parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec)
+
+ while ((token = xf86getToken(FilesTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->file_comment = xf86addComment(ptr->file_comment, val.str);
+ break;
+ case FONTPATH:
+ if (xf86getSubToken(&(ptr->file_comment)) != STRING)
+ Error(QUOTE_MSG, "FontPath");
+ j = FALSE;
+ str = val.str;
+ if (ptr->file_fontpath == NULL) {
+ ptr->file_fontpath = malloc(1);
+ ptr->file_fontpath[0] = '\0';
+ i = strlen(str) + 1;
+ }
+ else {
+ i = strlen(ptr->file_fontpath) + strlen(str) + 1;
+ if (ptr->file_fontpath[strlen(ptr->file_fontpath) - 1] != ',') {
+ i++;
+ j = TRUE;
+ }
+ }
+ ptr->file_fontpath = realloc(ptr->file_fontpath, i);
+ if (j)
+ strcat(ptr->file_fontpath, ",");
+
+ strcat(ptr->file_fontpath, str);
+ free(val.str);
+ break;
+ case MODULEPATH:
+ if (xf86getSubToken(&(ptr->file_comment)) != STRING)
+ Error(QUOTE_MSG, "ModulePath");
+ l = FALSE;
+ str = val.str;
+ if (ptr->file_modulepath == NULL) {
+ ptr->file_modulepath = malloc(1);
+ ptr->file_modulepath[0] = '\0';
+ k = strlen(str) + 1;
+ }
+ else {
+ k = strlen(ptr->file_modulepath) + strlen(str) + 1;
+ if (ptr->file_modulepath[strlen(ptr->file_modulepath) - 1] !=
+ ',') {
+ k++;
+ l = TRUE;
+ }
+ }
+ ptr->file_modulepath = realloc(ptr->file_modulepath, k);
+ if (l)
+ strcat(ptr->file_modulepath, ",");
+
+ strcat(ptr->file_modulepath, str);
+ free(val.str);
+ break;
+ case LOGFILEPATH:
+ if (xf86getSubToken(&(ptr->file_comment)) != STRING)
+ Error(QUOTE_MSG, "LogFile");
+ ptr->file_logfile = val.str;
+ break;
+ case XKBDIR:
+ if (xf86getSubToken(&(ptr->file_xkbdir)) != STRING)
+ Error(QUOTE_MSG, "XkbDir");
+ ptr->file_xkbdir = val.str;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ case OBSOLETE_TOKEN:
+ xf86parseError(OBSOLETE_MSG, xf86tokenString());
+ xf86getSubToken(&(ptr->file_comment));
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("File section parsed\n");
+ printf("File section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printFileSection (FILE * cf, XF86ConfFilesPtr ptr)
+xf86printFileSection(FILE * cf, XF86ConfFilesPtr ptr)
{
- char *p, *s;
-
- if (ptr == NULL)
- return;
-
- if (ptr->file_comment)
- fprintf (cf, "%s", ptr->file_comment);
- if (ptr->file_logfile)
- fprintf (cf, "\tLogFile \"%s\"\n", ptr->file_logfile);
- if (ptr->file_modulepath)
- {
- s = ptr->file_modulepath;
- p = index (s, ',');
- while (p)
- {
- *p = '\000';
- fprintf (cf, "\tModulePath \"%s\"\n", s);
- *p = ',';
- s = p;
- s++;
- p = index (s, ',');
- }
- fprintf (cf, "\tModulePath \"%s\"\n", s);
- }
- if (ptr->file_fontpath)
- {
- s = ptr->file_fontpath;
- p = index (s, ',');
- while (p)
- {
- *p = '\000';
- fprintf (cf, "\tFontPath \"%s\"\n", s);
- *p = ',';
- s = p;
- s++;
- p = index (s, ',');
- }
- fprintf (cf, "\tFontPath \"%s\"\n", s);
- }
- if (ptr->file_xkbdir)
- fprintf (cf, "\tXkbDir \"%s\"\n", ptr->file_xkbdir);
+ char *p, *s;
+
+ if (ptr == NULL)
+ return;
+
+ if (ptr->file_comment)
+ fprintf(cf, "%s", ptr->file_comment);
+ if (ptr->file_logfile)
+ fprintf(cf, "\tLogFile \"%s\"\n", ptr->file_logfile);
+ if (ptr->file_modulepath) {
+ s = ptr->file_modulepath;
+ p = index(s, ',');
+ while (p) {
+ *p = '\000';
+ fprintf(cf, "\tModulePath \"%s\"\n", s);
+ *p = ',';
+ s = p;
+ s++;
+ p = index(s, ',');
+ }
+ fprintf(cf, "\tModulePath \"%s\"\n", s);
+ }
+ if (ptr->file_fontpath) {
+ s = ptr->file_fontpath;
+ p = index(s, ',');
+ while (p) {
+ *p = '\000';
+ fprintf(cf, "\tFontPath \"%s\"\n", s);
+ *p = ',';
+ s = p;
+ s++;
+ p = index(s, ',');
+ }
+ fprintf(cf, "\tFontPath \"%s\"\n", s);
+ }
+ if (ptr->file_xkbdir)
+ fprintf(cf, "\tXkbDir \"%s\"\n", ptr->file_xkbdir);
}
void
-xf86freeFiles (XF86ConfFilesPtr p)
+xf86freeFiles(XF86ConfFilesPtr p)
{
- if (p == NULL)
- return;
+ if (p == NULL)
+ return;
- TestFree (p->file_logfile);
- TestFree (p->file_modulepath);
- TestFree (p->file_fontpath);
- TestFree (p->file_comment);
- TestFree (p->file_xkbdir);
+ TestFree(p->file_logfile);
+ TestFree(p->file_modulepath);
+ TestFree(p->file_fontpath);
+ TestFree(p->file_comment);
+ TestFree(p->file_xkbdir);
- free (p);
+ free(p);
}
diff --git a/xorg-server/hw/xfree86/parser/Flags.c b/xorg-server/hw/xfree86/parser/Flags.c
index c2a04062c..29a60a2e1 100644
--- a/xorg-server/hw/xfree86/parser/Flags.c
+++ b/xorg-server/hw/xfree86/parser/Flags.c
@@ -51,7 +51,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -67,242 +66,239 @@
extern LexRec val;
-static xf86ConfigSymTabRec ServerFlagsTab[] =
-{
- {ENDSECTION, "endsection"},
- {NOTRAPSIGNALS, "notrapsignals"},
- {DONTZAP, "dontzap"},
- {DONTZOOM, "dontzoom"},
- {DISABLEVIDMODE, "disablevidmodeextension"},
- {ALLOWNONLOCAL, "allownonlocalxvidtune"},
- {DISABLEMODINDEV, "disablemodindev"},
- {MODINDEVALLOWNONLOCAL, "allownonlocalmodindev"},
- {ALLOWMOUSEOPENFAIL, "allowmouseopenfail"},
- {OPTION, "option"},
- {BLANKTIME, "blanktime"},
- {STANDBYTIME, "standbytime"},
- {SUSPENDTIME, "suspendtime"},
- {OFFTIME, "offtime"},
- {DEFAULTLAYOUT, "defaultserverlayout"},
- {-1, ""},
+static xf86ConfigSymTabRec ServerFlagsTab[] = {
+ {ENDSECTION, "endsection"},
+ {NOTRAPSIGNALS, "notrapsignals"},
+ {DONTZAP, "dontzap"},
+ {DONTZOOM, "dontzoom"},
+ {DISABLEVIDMODE, "disablevidmodeextension"},
+ {ALLOWNONLOCAL, "allownonlocalxvidtune"},
+ {DISABLEMODINDEV, "disablemodindev"},
+ {MODINDEVALLOWNONLOCAL, "allownonlocalmodindev"},
+ {ALLOWMOUSEOPENFAIL, "allowmouseopenfail"},
+ {OPTION, "option"},
+ {BLANKTIME, "blanktime"},
+ {STANDBYTIME, "standbytime"},
+ {SUSPENDTIME, "suspendtime"},
+ {OFFTIME, "offtime"},
+ {DEFAULTLAYOUT, "defaultserverlayout"},
+ {-1, ""},
};
#define CLEANUP xf86freeFlags
XF86ConfFlagsPtr
-xf86parseFlagsSection (void)
+xf86parseFlagsSection(void)
{
- int token;
- parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec)
-
- while ((token = xf86getToken (ServerFlagsTab)) != ENDSECTION)
- {
- int hasvalue = FALSE;
- int strvalue = FALSE;
- int tokentype;
- switch (token)
- {
- case COMMENT:
- ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str);
- break;
- /*
- * these old keywords are turned into standard generic options.
- * we fall through here on purpose
- */
- case DEFAULTLAYOUT:
- strvalue = TRUE;
- case BLANKTIME:
- case STANDBYTIME:
- case SUSPENDTIME:
- case OFFTIME:
- hasvalue = TRUE;
- case NOTRAPSIGNALS:
- case DONTZAP:
- case DONTZOOM:
- case DISABLEVIDMODE:
- case ALLOWNONLOCAL:
- case DISABLEMODINDEV:
- case MODINDEVALLOWNONLOCAL:
- case ALLOWMOUSEOPENFAIL:
- {
- int i = 0;
- while (ServerFlagsTab[i].token != -1)
- {
- char *tmp;
-
- if (ServerFlagsTab[i].token == token)
- {
- char *valstr = NULL;
- tmp = strdup (ServerFlagsTab[i].name);
- if (hasvalue)
- {
- tokentype = xf86getSubToken(&(ptr->flg_comment));
- if (strvalue) {
- if (tokentype != STRING)
- Error (QUOTE_MSG, tmp);
- valstr = val.str;
- } else {
- if (tokentype != NUMBER)
- Error (NUMBER_MSG, tmp);
- if (asprintf(&valstr, "%d", val.num) == -1)
- valstr = NULL;
- }
- }
- ptr->flg_option_lst = xf86addNewOption
- (ptr->flg_option_lst, tmp, valstr);
- }
- i++;
- }
- }
- break;
- case OPTION:
- ptr->flg_option_lst = xf86parseOption(ptr->flg_option_lst);
- break;
-
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ int token;
+
+ parsePrologue(XF86ConfFlagsPtr, XF86ConfFlagsRec)
+
+ while ((token = xf86getToken(ServerFlagsTab)) != ENDSECTION) {
+ int hasvalue = FALSE;
+ int strvalue = FALSE;
+ int tokentype;
+
+ switch (token) {
+ case COMMENT:
+ ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str);
+ break;
+ /*
+ * these old keywords are turned into standard generic options.
+ * we fall through here on purpose
+ */
+ case DEFAULTLAYOUT:
+ strvalue = TRUE;
+ case BLANKTIME:
+ case STANDBYTIME:
+ case SUSPENDTIME:
+ case OFFTIME:
+ hasvalue = TRUE;
+ case NOTRAPSIGNALS:
+ case DONTZAP:
+ case DONTZOOM:
+ case DISABLEVIDMODE:
+ case ALLOWNONLOCAL:
+ case DISABLEMODINDEV:
+ case MODINDEVALLOWNONLOCAL:
+ case ALLOWMOUSEOPENFAIL:
+ {
+ int i = 0;
+
+ while (ServerFlagsTab[i].token != -1) {
+ char *tmp;
+
+ if (ServerFlagsTab[i].token == token) {
+ char *valstr = NULL;
+
+ tmp = strdup(ServerFlagsTab[i].name);
+ if (hasvalue) {
+ tokentype = xf86getSubToken(&(ptr->flg_comment));
+ if (strvalue) {
+ if (tokentype != STRING)
+ Error(QUOTE_MSG, tmp);
+ valstr = val.str;
+ }
+ else {
+ if (tokentype != NUMBER)
+ Error(NUMBER_MSG, tmp);
+ if (asprintf(&valstr, "%d", val.num) == -1)
+ valstr = NULL;
+ }
+ }
+ ptr->flg_option_lst = xf86addNewOption
+ (ptr->flg_option_lst, tmp, valstr);
+ }
+ i++;
+ }
+ }
+ break;
+ case OPTION:
+ ptr->flg_option_lst = xf86parseOption(ptr->flg_option_lst);
+ break;
+
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("Flags section parsed\n");
+ printf("Flags section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printServerFlagsSection (FILE * f, XF86ConfFlagsPtr flags)
+xf86printServerFlagsSection(FILE * f, XF86ConfFlagsPtr flags)
{
- XF86OptionPtr p;
-
- if ((!flags) || (!flags->flg_option_lst))
- return;
- p = flags->flg_option_lst;
- fprintf (f, "Section \"ServerFlags\"\n");
- if (flags->flg_comment)
- fprintf (f, "%s", flags->flg_comment);
- xf86printOptionList(f, p, 1);
- fprintf (f, "EndSection\n\n");
+ XF86OptionPtr p;
+
+ if ((!flags) || (!flags->flg_option_lst))
+ return;
+ p = flags->flg_option_lst;
+ fprintf(f, "Section \"ServerFlags\"\n");
+ if (flags->flg_comment)
+ fprintf(f, "%s", flags->flg_comment);
+ xf86printOptionList(f, p, 1);
+ fprintf(f, "EndSection\n\n");
}
static XF86OptionPtr
-addNewOption2 (XF86OptionPtr head, char *name, char *val, int used)
+addNewOption2(XF86OptionPtr head, char *name, char *val, int used)
{
- XF86OptionPtr new, old = NULL;
-
- /* Don't allow duplicates, free old strings */
- if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
- new = old;
- free(new->opt_name);
- free(new->opt_val);
- }
- else
- new = calloc (1, sizeof (*new));
- new->opt_name = name;
- new->opt_val = val;
- new->opt_used = used;
-
- if (old)
- return head;
- return ((XF86OptionPtr) xf86addListItem ((glp) head, (glp) new));
+ XF86OptionPtr new, old = NULL;
+
+ /* Don't allow duplicates, free old strings */
+ if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
+ new = old;
+ free(new->opt_name);
+ free(new->opt_val);
+ }
+ else
+ new = calloc(1, sizeof(*new));
+ new->opt_name = name;
+ new->opt_val = val;
+ new->opt_used = used;
+
+ if (old)
+ return head;
+ return ((XF86OptionPtr) xf86addListItem((glp) head, (glp) new));
}
XF86OptionPtr
-xf86addNewOption (XF86OptionPtr head, char *name, char *val)
+xf86addNewOption(XF86OptionPtr head, char *name, char *val)
{
- return addNewOption2(head, name, val, 0);
+ return addNewOption2(head, name, val, 0);
}
void
-xf86freeFlags (XF86ConfFlagsPtr flags)
+xf86freeFlags(XF86ConfFlagsPtr flags)
{
- if (flags == NULL)
- return;
- xf86optionListFree (flags->flg_option_lst);
- TestFree(flags->flg_comment);
- free (flags);
+ if (flags == NULL)
+ return;
+ xf86optionListFree(flags->flg_option_lst);
+ TestFree(flags->flg_comment);
+ free(flags);
}
XF86OptionPtr
-xf86optionListDup (XF86OptionPtr opt)
+xf86optionListDup(XF86OptionPtr opt)
{
- XF86OptionPtr newopt = NULL;
- char *val;
-
- while (opt)
- {
- val = opt->opt_val ? strdup(opt->opt_val) : NULL;
- newopt = xf86addNewOption(newopt, strdup(opt->opt_name), val);
- newopt->opt_used = opt->opt_used;
- if (opt->opt_comment)
- newopt->opt_comment = strdup(opt->opt_comment);
- opt = opt->list.next;
- }
- return newopt;
+ XF86OptionPtr newopt = NULL;
+ char *val;
+
+ while (opt) {
+ val = opt->opt_val ? strdup(opt->opt_val) : NULL;
+ newopt = xf86addNewOption(newopt, strdup(opt->opt_name), val);
+ newopt->opt_used = opt->opt_used;
+ if (opt->opt_comment)
+ newopt->opt_comment = strdup(opt->opt_comment);
+ opt = opt->list.next;
+ }
+ return newopt;
}
void
-xf86optionListFree (XF86OptionPtr opt)
+xf86optionListFree(XF86OptionPtr opt)
{
- XF86OptionPtr prev;
-
- while (opt)
- {
- TestFree (opt->opt_name);
- TestFree (opt->opt_val);
- TestFree (opt->opt_comment);
- prev = opt;
- opt = opt->list.next;
- free (prev);
- }
+ XF86OptionPtr prev;
+
+ while (opt) {
+ TestFree(opt->opt_name);
+ TestFree(opt->opt_val);
+ TestFree(opt->opt_comment);
+ prev = opt;
+ opt = opt->list.next;
+ free(prev);
+ }
}
char *
xf86optionName(XF86OptionPtr opt)
{
- if (opt)
- return opt->opt_name;
- return 0;
+ if (opt)
+ return opt->opt_name;
+ return 0;
}
char *
xf86optionValue(XF86OptionPtr opt)
{
- if (opt)
- return opt->opt_val;
- return 0;
+ if (opt)
+ return opt->opt_val;
+ return 0;
}
XF86OptionPtr
xf86newOption(char *name, char *value)
{
- XF86OptionPtr opt;
+ XF86OptionPtr opt;
- opt = calloc(1, sizeof (*opt));
- if (!opt)
- return NULL;
+ opt = calloc(1, sizeof(*opt));
+ if (!opt)
+ return NULL;
- opt->opt_used = 0;
- opt->list.next = 0;
- opt->opt_name = name;
- opt->opt_val = value;
+ opt->opt_used = 0;
+ opt->list.next = 0;
+ opt->opt_name = name;
+ opt->opt_val = value;
- return opt;
+ return opt;
}
XF86OptionPtr
xf86nextOption(XF86OptionPtr list)
{
- if (!list)
- return NULL;
- return list->list.next;
+ if (!list)
+ return NULL;
+ return list->list.next;
}
/*
@@ -312,15 +308,14 @@ xf86nextOption(XF86OptionPtr list)
*/
XF86OptionPtr
-xf86findOption (XF86OptionPtr list, const char *name)
+xf86findOption(XF86OptionPtr list, const char *name)
{
- while (list)
- {
- if (xf86nameCompare (list->opt_name, name) == 0)
- return list;
- list = list->list.next;
- }
- return NULL;
+ while (list) {
+ if (xf86nameCompare(list->opt_name, name) == 0)
+ return list;
+ list = list->list.next;
+ }
+ return NULL;
}
/*
@@ -331,45 +326,41 @@ xf86findOption (XF86OptionPtr list, const char *name)
*/
const char *
-xf86findOptionValue (XF86OptionPtr list, const char *name)
+xf86findOptionValue(XF86OptionPtr list, const char *name)
{
- XF86OptionPtr p = xf86findOption (list, name);
-
- if (p)
- {
- if (p->opt_val)
- return p->opt_val;
- else
- return "";
- }
- return NULL;
+ XF86OptionPtr p = xf86findOption(list, name);
+
+ if (p) {
+ if (p->opt_val)
+ return p->opt_val;
+ else
+ return "";
+ }
+ return NULL;
}
XF86OptionPtr
-xf86optionListCreate( const char **options, int count, int used )
+xf86optionListCreate(const char **options, int count, int used)
{
- XF86OptionPtr p = NULL;
- char *t1, *t2;
- int i;
-
- if (count == -1)
- {
- for (count = 0; options[count]; count++)
- ;
- }
- if( (count % 2) != 0 )
- {
- fprintf( stderr, "xf86optionListCreate: count must be an even number.\n" );
- return NULL;
- }
- for (i = 0; i < count; i += 2)
- {
- t1 = strdup(options[i]);
- t2 = strdup(options[i + 1]);
- p = addNewOption2 (p, t1, t2, used);
- }
-
- return p;
+ XF86OptionPtr p = NULL;
+ char *t1, *t2;
+ int i;
+
+ if (count == -1) {
+ for (count = 0; options[count]; count++);
+ }
+ if ((count % 2) != 0) {
+ fprintf(stderr,
+ "xf86optionListCreate: count must be an even number.\n");
+ return NULL;
+ }
+ for (i = 0; i < count; i += 2) {
+ t1 = strdup(options[i]);
+ t2 = strdup(options[i + 1]);
+ p = addNewOption2(p, t1, t2, used);
+ }
+
+ return p;
}
/* the 2 given lists are merged. If an option with the same name is present in
@@ -378,128 +369,130 @@ xf86optionListCreate( const char **options, int count, int used )
* are freed, and the original lists are no longer guaranteed to be complete.
*/
XF86OptionPtr
-xf86optionListMerge (XF86OptionPtr head, XF86OptionPtr tail)
+xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail)
{
- XF86OptionPtr a, b, ap = NULL, bp = NULL;
-
- a = tail;
- b = head;
- while (tail && b) {
- if (xf86nameCompare (a->opt_name, b->opt_name) == 0) {
- if (b == head)
- head = a;
- else
- bp->list.next = a;
- if (a == tail)
- tail = a->list.next;
- else
- ap->list.next = a->list.next;
- a->list.next = b->list.next;
- b->list.next = NULL;
- xf86optionListFree (b);
- b = a->list.next;
- bp = a;
- a = tail;
- ap = NULL;
- } else {
- ap = a;
- if (!(a = a->list.next)) {
- a = tail;
- bp = b;
- b = b->list.next;
- ap = NULL;
- }
- }
- }
-
- if (head) {
- for (a = head; a->list.next; a = a->list.next)
- ;
- a->list.next = tail;
- } else
- head = tail;
-
- return head;
+ XF86OptionPtr a, b, ap = NULL, bp = NULL;
+
+ a = tail;
+ b = head;
+ while (tail && b) {
+ if (xf86nameCompare(a->opt_name, b->opt_name) == 0) {
+ if (b == head)
+ head = a;
+ else
+ bp->list.next = a;
+ if (a == tail)
+ tail = a->list.next;
+ else
+ ap->list.next = a->list.next;
+ a->list.next = b->list.next;
+ b->list.next = NULL;
+ xf86optionListFree(b);
+ b = a->list.next;
+ bp = a;
+ a = tail;
+ ap = NULL;
+ }
+ else {
+ ap = a;
+ if (!(a = a->list.next)) {
+ a = tail;
+ bp = b;
+ b = b->list.next;
+ ap = NULL;
+ }
+ }
+ }
+
+ if (head) {
+ for (a = head; a->list.next; a = a->list.next);
+ a->list.next = tail;
+ }
+ else
+ head = tail;
+
+ return head;
}
char *
xf86uLongToString(unsigned long i)
{
- char *s;
+ char *s;
- if (asprintf(&s, "%lu", i) == -1)
- return NULL;
- return s;
+ if (asprintf(&s, "%lu", i) == -1)
+ return NULL;
+ return s;
}
XF86OptionPtr
xf86parseOption(XF86OptionPtr head)
{
- XF86OptionPtr option, cnew, old;
- char *name, *comment = NULL;
- int token;
-
- if ((token = xf86getSubToken(&comment)) != STRING) {
- xf86parseError(BAD_OPTION_MSG);
- free(comment);
- return head;
- }
-
- name = val.str;
- if ((token = xf86getSubToken(&comment)) == STRING) {
- option = xf86newOption(name, val.str);
- option->opt_comment = comment;
- if ((token = xf86getToken(NULL)) == COMMENT)
- option->opt_comment = xf86addComment(option->opt_comment, val.str);
- else
- xf86unGetToken(token);
- }
- else {
- option = xf86newOption(name, NULL);
- option->opt_comment = comment;
- if (token == COMMENT)
- option->opt_comment = xf86addComment(option->opt_comment, val.str);
- else
- xf86unGetToken(token);
- }
-
- old = NULL;
-
- /* Don't allow duplicates */
- if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
- cnew = old;
- free(option->opt_name);
- TestFree(option->opt_val);
- TestFree(option->opt_comment);
- free(option);
- }
- else
- cnew = option;
-
- if (old == NULL)
- return ((XF86OptionPtr)xf86addListItem((glp)head, (glp)cnew));
-
- return head;
+ XF86OptionPtr option, cnew, old;
+ char *name, *comment = NULL;
+ int token;
+
+ if ((token = xf86getSubToken(&comment)) != STRING) {
+ xf86parseError(BAD_OPTION_MSG);
+ free(comment);
+ return head;
+ }
+
+ name = val.str;
+ if ((token = xf86getSubToken(&comment)) == STRING) {
+ option = xf86newOption(name, val.str);
+ option->opt_comment = comment;
+ if ((token = xf86getToken(NULL)) == COMMENT)
+ option->opt_comment = xf86addComment(option->opt_comment, val.str);
+ else
+ xf86unGetToken(token);
+ }
+ else {
+ option = xf86newOption(name, NULL);
+ option->opt_comment = comment;
+ if (token == COMMENT)
+ option->opt_comment = xf86addComment(option->opt_comment, val.str);
+ else
+ xf86unGetToken(token);
+ }
+
+ old = NULL;
+
+ /* Don't allow duplicates */
+ if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
+ cnew = old;
+ free(option->opt_name);
+ TestFree(option->opt_val);
+ TestFree(option->opt_comment);
+ free(option);
+ }
+ else
+ cnew = option;
+
+ if (old == NULL)
+ return ((XF86OptionPtr) xf86addListItem((glp) head, (glp) cnew));
+
+ return head;
}
void
-xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs)
+xf86printOptionList(FILE * fp, XF86OptionPtr list, int tabs)
{
- int i;
-
- if (!list)
- return;
- while (list) {
- for (i = 0; i < tabs; i++)
- fputc('\t', fp);
- if (list->opt_val)
- fprintf(fp, "Option \"%s\" \"%s\"", list->opt_name, list->opt_val);
- else
- fprintf(fp, "Option \"%s\"", list->opt_name);
- if (list->opt_comment)
- fprintf(fp, "%s", list->opt_comment);
- else
- fputc('\n', fp);
- list = list->list.next;
- }
+ int i;
+
+ if (!list)
+ return;
+ while (list) {
+ for (i = 0; i < tabs; i++)
+ fputc('\t', fp);
+ if (list->opt_val)
+ fprintf(fp, "Option \"%s\" \"%s\"", list->opt_name,
+ list->opt_val);
+ else
+ fprintf(fp, "Option \"%s\"", list->opt_name);
+ if (list->opt_comment)
+ fprintf(fp, "%s", list->opt_comment);
+ else
+ fputc('\n', fp);
+ list = list->list.next;
+ }
}
diff --git a/xorg-server/hw/xfree86/parser/Input.c b/xorg-server/hw/xfree86/parser/Input.c
index e6037732a..6e0073437 100644
--- a/xorg-server/hw/xfree86/parser/Input.c
+++ b/xorg-server/hw/xfree86/parser/Input.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -67,147 +66,141 @@
extern LexRec val;
static
-xf86ConfigSymTabRec InputTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {DRIVER, "driver"},
- {-1, ""},
+xf86ConfigSymTabRec InputTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {DRIVER, "driver"},
+ {-1, ""},
};
#define CLEANUP xf86freeInputList
XF86ConfInputPtr
-xf86parseInputSection (void)
+xf86parseInputSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
-
- while ((token = xf86getToken (InputTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->inp_identifier = val.str;
- has_ident = TRUE;
- break;
- case DRIVER:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Driver");
- if (strcmp(val.str, "keyboard") == 0) {
- ptr->inp_driver = strdup("kbd");
- free(val.str);
- }
- else
- ptr->inp_driver = val.str;
- break;
- case OPTION:
- ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG);
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfInputPtr, XF86ConfInputRec)
+
+ while ((token = xf86getToken(InputTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->inp_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case DRIVER:
+ if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
+ Error(QUOTE_MSG, "Driver");
+ if (strcmp(val.str, "keyboard") == 0) {
+ ptr->inp_driver = strdup("kbd");
+ free(val.str);
+ }
+ else
+ ptr->inp_driver = val.str;
+ break;
+ case OPTION:
+ ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst);
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("InputDevice section parsed\n");
+ printf("InputDevice section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printInputSection (FILE * cf, XF86ConfInputPtr ptr)
+xf86printInputSection(FILE * cf, XF86ConfInputPtr ptr)
{
- while (ptr)
- {
- fprintf (cf, "Section \"InputDevice\"\n");
- if (ptr->inp_comment)
- fprintf (cf, "%s", ptr->inp_comment);
- if (ptr->inp_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->inp_identifier);
- if (ptr->inp_driver)
- fprintf (cf, "\tDriver \"%s\"\n", ptr->inp_driver);
- xf86printOptionList(cf, ptr->inp_option_lst, 1);
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ while (ptr) {
+ fprintf(cf, "Section \"InputDevice\"\n");
+ if (ptr->inp_comment)
+ fprintf(cf, "%s", ptr->inp_comment);
+ if (ptr->inp_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->inp_identifier);
+ if (ptr->inp_driver)
+ fprintf(cf, "\tDriver \"%s\"\n", ptr->inp_driver);
+ xf86printOptionList(cf, ptr->inp_option_lst, 1);
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeInputList (XF86ConfInputPtr ptr)
+xf86freeInputList(XF86ConfInputPtr ptr)
{
- XF86ConfInputPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->inp_identifier);
- TestFree (ptr->inp_driver);
- TestFree (ptr->inp_comment);
- xf86optionListFree (ptr->inp_option_lst);
-
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfInputPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->inp_identifier);
+ TestFree(ptr->inp_driver);
+ TestFree(ptr->inp_comment);
+ xf86optionListFree(ptr->inp_option_lst);
+
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
int
-xf86validateInput (XF86ConfigPtr p)
+xf86validateInput(XF86ConfigPtr p)
{
- XF86ConfInputPtr input = p->conf_input_lst;
-
- while (input) {
- if (!input->inp_driver) {
- xf86validationError (UNDEFINED_INPUTDRIVER_MSG, input->inp_identifier);
- return FALSE;
- }
- input = input->list.next;
- }
- return TRUE;
+ XF86ConfInputPtr input = p->conf_input_lst;
+
+ while (input) {
+ if (!input->inp_driver) {
+ xf86validationError(UNDEFINED_INPUTDRIVER_MSG,
+ input->inp_identifier);
+ return FALSE;
+ }
+ input = input->list.next;
+ }
+ return TRUE;
}
XF86ConfInputPtr
-xf86findInput (const char *ident, XF86ConfInputPtr p)
+xf86findInput(const char *ident, XF86ConfInputPtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->inp_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
+ while (p) {
+ if (xf86nameCompare(ident, p->inp_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
}
XF86ConfInputPtr
-xf86findInputByDriver (const char *driver, XF86ConfInputPtr p)
+xf86findInputByDriver(const char *driver, XF86ConfInputPtr p)
{
- while (p)
- {
- if (xf86nameCompare (driver, p->inp_driver) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
+ while (p) {
+ if (xf86nameCompare(driver, p->inp_driver) == 0)
+ return p;
+ p = p->list.next;
+ }
+ return NULL;
+}
diff --git a/xorg-server/hw/xfree86/parser/InputClass.c b/xorg-server/hw/xfree86/parser/InputClass.c
index c25117c1a..8493685cd 100644
--- a/xorg-server/hw/xfree86/parser/InputClass.c
+++ b/xorg-server/hw/xfree86/parser/InputClass.c
@@ -38,8 +38,7 @@
extern LexRec val;
static
-xf86ConfigSymTabRec InputClassTab[] =
-{
+xf86ConfigSymTabRec InputClassTab[] = {
{ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"},
{OPTION, "option"},
@@ -86,8 +85,8 @@ xf86parseInputClassSection(void)
parsePrologue(XF86ConfInputClassPtr, XF86ConfInputClassRec)
- /* Initialize MatchGroup lists */
- xorg_list_init(&ptr->match_product);
+ /* Initialize MatchGroup lists */
+ xorg_list_init(&ptr->match_product);
xorg_list_init(&ptr->match_vendor);
xorg_list_init(&ptr->match_device);
xorg_list_init(&ptr->match_os);
@@ -147,8 +146,7 @@ xf86parseInputClassSection(void)
case MATCH_OS:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchOS");
- add_group_entry(&ptr->match_os,
- xstrtokenize(val.str, TOKEN_SEP));
+ add_group_entry(&ptr->match_os, xstrtokenize(val.str, TOKEN_SEP));
free(val.str);
break;
case MATCH_PNPID:
@@ -175,8 +173,7 @@ xf86parseInputClassSection(void)
case MATCH_TAG:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchTag");
- add_group_entry(&ptr->match_tag,
- xstrtokenize(val.str, TOKEN_SEP));
+ add_group_entry(&ptr->match_tag, xstrtokenize(val.str, TOKEN_SEP));
free(val.str);
break;
case MATCH_LAYOUT:
@@ -216,8 +213,7 @@ xf86parseInputClassSection(void)
case MATCH_IS_TABLET:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchIsTablet");
- ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val,
- val.str);
+ ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, val.str);
free(val.str);
if (!ptr->is_tablet.set)
Error(BOOL_MSG, "MatchIsTablet");
@@ -244,7 +240,7 @@ xf86parseInputClassSection(void)
Error(UNEXPECTED_EOF_MSG);
break;
default:
- Error(INVALID_KEYWORD_MSG, xf86tokenString ());
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
break;
}
}
@@ -260,10 +256,10 @@ xf86parseInputClassSection(void)
}
void
-xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
+xf86printInputClassSection(FILE * cf, XF86ConfInputClassPtr ptr)
{
const xf86MatchGroup *group;
- char * const *cur;
+ char *const *cur;
while (ptr) {
fprintf(cf, "Section \"InputClass\"\n");
@@ -363,7 +359,7 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
}
void
-xf86freeInputClassList (XF86ConfInputClassPtr ptr)
+xf86freeInputClassList(XF86ConfInputClassPtr ptr)
{
XF86ConfInputClassPtr prev;
diff --git a/xorg-server/hw/xfree86/parser/Layout.c b/xorg-server/hw/xfree86/parser/Layout.c
index 7dd4ebfc6..bd33d6dfc 100644
--- a/xorg-server/hw/xfree86/parser/Layout.c
+++ b/xorg-server/hw/xfree86/parser/Layout.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -66,377 +65,363 @@
#include "optionstr.h"
/* Needed for auto server layout */
-extern int xf86CheckBoolOption(void* optlist, const char *name, int deflt);
+extern int xf86CheckBoolOption(void *optlist, const char *name, int deflt);
extern LexRec val;
-static xf86ConfigSymTabRec LayoutTab[] =
-{
- {ENDSECTION, "endsection"},
- {SCREEN, "screen"},
- {IDENTIFIER, "identifier"},
- {INACTIVE, "inactive"},
- {INPUTDEVICE, "inputdevice"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec LayoutTab[] = {
+ {ENDSECTION, "endsection"},
+ {SCREEN, "screen"},
+ {IDENTIFIER, "identifier"},
+ {INACTIVE, "inactive"},
+ {INPUTDEVICE, "inputdevice"},
+ {OPTION, "option"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec AdjTab[] =
-{
- {RIGHTOF, "rightof"},
- {LEFTOF, "leftof"},
- {ABOVE, "above"},
- {BELOW, "below"},
- {RELATIVE, "relative"},
- {ABSOLUTE, "absolute"},
- {-1, ""},
+static xf86ConfigSymTabRec AdjTab[] = {
+ {RIGHTOF, "rightof"},
+ {LEFTOF, "leftof"},
+ {ABOVE, "above"},
+ {BELOW, "below"},
+ {RELATIVE, "relative"},
+ {ABSOLUTE, "absolute"},
+ {-1, ""},
};
#define CLEANUP xf86freeLayoutList
XF86ConfLayoutPtr
-xf86parseLayoutSection (void)
+xf86parseLayoutSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec)
-
- while ((token = xf86getToken (LayoutTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->lay_comment = xf86addComment(ptr->lay_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->lay_identifier = val.str;
- has_ident = TRUE;
- break;
- case INACTIVE:
- {
- XF86ConfInactivePtr iptr;
-
- iptr = calloc (1, sizeof (XF86ConfInactiveRec));
- iptr->list.next = NULL;
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
- free (iptr);
- Error (INACTIVE_MSG);
- }
- iptr->inactive_device_str = val.str;
- ptr->lay_inactive_lst = (XF86ConfInactivePtr)
- xf86addListItem ((glp) ptr->lay_inactive_lst, (glp) iptr);
- }
- break;
- case SCREEN:
- {
- XF86ConfAdjacencyPtr aptr;
- int absKeyword = 0;
-
- aptr = calloc (1, sizeof (XF86ConfAdjacencyRec));
- aptr->list.next = NULL;
- aptr->adj_scrnum = -1;
- aptr->adj_where = CONF_ADJ_OBSOLETE;
- aptr->adj_x = 0;
- aptr->adj_y = 0;
- aptr->adj_refscreen = NULL;
- if ((token = xf86getSubToken (&(ptr->lay_comment))) == NUMBER)
- aptr->adj_scrnum = val.num;
- else
- xf86unGetToken (token);
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token != STRING) {
- free(aptr);
- Error (SCREEN_MSG);
- }
- aptr->adj_screen_str = val.str;
-
- token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab);
- switch (token)
- {
- case RIGHTOF:
- aptr->adj_where = CONF_ADJ_RIGHTOF;
- break;
- case LEFTOF:
- aptr->adj_where = CONF_ADJ_LEFTOF;
- break;
- case ABOVE:
- aptr->adj_where = CONF_ADJ_ABOVE;
- break;
- case BELOW:
- aptr->adj_where = CONF_ADJ_BELOW;
- break;
- case RELATIVE:
- aptr->adj_where = CONF_ADJ_RELATIVE;
- break;
- case ABSOLUTE:
- aptr->adj_where = CONF_ADJ_ABSOLUTE;
- absKeyword = 1;
- break;
- case EOF_TOKEN:
- free(aptr);
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- xf86unGetToken (token);
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token == STRING)
- aptr->adj_where = CONF_ADJ_OBSOLETE;
- else
- aptr->adj_where = CONF_ADJ_ABSOLUTE;
- }
- switch (aptr->adj_where)
- {
- case CONF_ADJ_ABSOLUTE:
- if (absKeyword)
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token == NUMBER)
- {
- aptr->adj_x = val.num;
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token != NUMBER) {
- free(aptr);
- Error(INVALID_SCR_MSG);
- }
- aptr->adj_y = val.num;
- } else {
- if (absKeyword) {
- free(aptr);
- Error(INVALID_SCR_MSG);
- } else
- xf86unGetToken (token);
- }
- break;
- case CONF_ADJ_RIGHTOF:
- case CONF_ADJ_LEFTOF:
- case CONF_ADJ_ABOVE:
- case CONF_ADJ_BELOW:
- case CONF_ADJ_RELATIVE:
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token != STRING) {
- free(aptr);
- Error(INVALID_SCR_MSG);
- }
- aptr->adj_refscreen = val.str;
- if (aptr->adj_where == CONF_ADJ_RELATIVE)
- {
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token != NUMBER) {
- free(aptr);
- Error(INVALID_SCR_MSG);
- }
- aptr->adj_x = val.num;
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token != NUMBER) {
- free(aptr);
- Error(INVALID_SCR_MSG);
- }
- aptr->adj_y = val.num;
- }
- break;
- case CONF_ADJ_OBSOLETE:
- /* top */
- aptr->adj_top_str = val.str;
-
- /* bottom */
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
- free(aptr);
- Error (SCREEN_MSG);
- }
- aptr->adj_bottom_str = val.str;
-
- /* left */
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
- free(aptr);
- Error (SCREEN_MSG);
- }
- aptr->adj_left_str = val.str;
-
- /* right */
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
- free(aptr);
- Error (SCREEN_MSG);
- }
- aptr->adj_right_str = val.str;
-
- }
- ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
- xf86addListItem ((glp) ptr->lay_adjacency_lst, (glp) aptr);
- }
- break;
- case INPUTDEVICE:
- {
- XF86ConfInputrefPtr iptr;
-
- iptr = calloc (1, sizeof (XF86ConfInputrefRec));
- iptr->list.next = NULL;
- iptr->iref_option_lst = NULL;
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
- free(iptr);
- Error (INPUTDEV_MSG);
- }
- iptr->iref_inputdev_str = val.str;
- while ((token = xf86getSubToken (&(ptr->lay_comment))) == STRING)
- {
- iptr->iref_option_lst =
- xf86addNewOption (iptr->iref_option_lst, val.str, NULL);
- }
- xf86unGetToken (token);
- ptr->lay_input_lst = (XF86ConfInputrefPtr)
- xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
- }
- break;
- case OPTION:
- ptr->lay_option_lst = xf86parseOption(ptr->lay_option_lst);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG);
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfLayoutPtr, XF86ConfLayoutRec)
+
+ while ((token = xf86getToken(LayoutTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->lay_comment = xf86addComment(ptr->lay_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->lay_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case INACTIVE:
+ {
+ XF86ConfInactivePtr iptr;
+
+ iptr = calloc(1, sizeof(XF86ConfInactiveRec));
+ iptr->list.next = NULL;
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
+ free(iptr);
+ Error(INACTIVE_MSG);
+ }
+ iptr->inactive_device_str = val.str;
+ ptr->lay_inactive_lst = (XF86ConfInactivePtr)
+ xf86addListItem((glp) ptr->lay_inactive_lst, (glp) iptr);
+ }
+ break;
+ case SCREEN:
+ {
+ XF86ConfAdjacencyPtr aptr;
+ int absKeyword = 0;
+
+ aptr = calloc(1, sizeof(XF86ConfAdjacencyRec));
+ aptr->list.next = NULL;
+ aptr->adj_scrnum = -1;
+ aptr->adj_where = CONF_ADJ_OBSOLETE;
+ aptr->adj_x = 0;
+ aptr->adj_y = 0;
+ aptr->adj_refscreen = NULL;
+ if ((token = xf86getSubToken(&(ptr->lay_comment))) == NUMBER)
+ aptr->adj_scrnum = val.num;
+ else
+ xf86unGetToken(token);
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != STRING) {
+ free(aptr);
+ Error(SCREEN_MSG);
+ }
+ aptr->adj_screen_str = val.str;
+
+ token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab);
+ switch (token) {
+ case RIGHTOF:
+ aptr->adj_where = CONF_ADJ_RIGHTOF;
+ break;
+ case LEFTOF:
+ aptr->adj_where = CONF_ADJ_LEFTOF;
+ break;
+ case ABOVE:
+ aptr->adj_where = CONF_ADJ_ABOVE;
+ break;
+ case BELOW:
+ aptr->adj_where = CONF_ADJ_BELOW;
+ break;
+ case RELATIVE:
+ aptr->adj_where = CONF_ADJ_RELATIVE;
+ break;
+ case ABSOLUTE:
+ aptr->adj_where = CONF_ADJ_ABSOLUTE;
+ absKeyword = 1;
+ break;
+ case EOF_TOKEN:
+ free(aptr);
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ xf86unGetToken(token);
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token == STRING)
+ aptr->adj_where = CONF_ADJ_OBSOLETE;
+ else
+ aptr->adj_where = CONF_ADJ_ABSOLUTE;
+ }
+ switch (aptr->adj_where) {
+ case CONF_ADJ_ABSOLUTE:
+ if (absKeyword)
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token == NUMBER) {
+ aptr->adj_x = val.num;
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != NUMBER) {
+ free(aptr);
+ Error(INVALID_SCR_MSG);
+ }
+ aptr->adj_y = val.num;
+ }
+ else {
+ if (absKeyword) {
+ free(aptr);
+ Error(INVALID_SCR_MSG);
+ }
+ else
+ xf86unGetToken(token);
+ }
+ break;
+ case CONF_ADJ_RIGHTOF:
+ case CONF_ADJ_LEFTOF:
+ case CONF_ADJ_ABOVE:
+ case CONF_ADJ_BELOW:
+ case CONF_ADJ_RELATIVE:
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != STRING) {
+ free(aptr);
+ Error(INVALID_SCR_MSG);
+ }
+ aptr->adj_refscreen = val.str;
+ if (aptr->adj_where == CONF_ADJ_RELATIVE) {
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != NUMBER) {
+ free(aptr);
+ Error(INVALID_SCR_MSG);
+ }
+ aptr->adj_x = val.num;
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != NUMBER) {
+ free(aptr);
+ Error(INVALID_SCR_MSG);
+ }
+ aptr->adj_y = val.num;
+ }
+ break;
+ case CONF_ADJ_OBSOLETE:
+ /* top */
+ aptr->adj_top_str = val.str;
+
+ /* bottom */
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
+ free(aptr);
+ Error(SCREEN_MSG);
+ }
+ aptr->adj_bottom_str = val.str;
+
+ /* left */
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
+ free(aptr);
+ Error(SCREEN_MSG);
+ }
+ aptr->adj_left_str = val.str;
+
+ /* right */
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
+ free(aptr);
+ Error(SCREEN_MSG);
+ }
+ aptr->adj_right_str = val.str;
+
+ }
+ ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
+ xf86addListItem((glp) ptr->lay_adjacency_lst, (glp) aptr);
+ }
+ break;
+ case INPUTDEVICE:
+ {
+ XF86ConfInputrefPtr iptr;
+
+ iptr = calloc(1, sizeof(XF86ConfInputrefRec));
+ iptr->list.next = NULL;
+ iptr->iref_option_lst = NULL;
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
+ free(iptr);
+ Error(INPUTDEV_MSG);
+ }
+ iptr->iref_inputdev_str = val.str;
+ while ((token = xf86getSubToken(&(ptr->lay_comment))) == STRING) {
+ iptr->iref_option_lst =
+ xf86addNewOption(iptr->iref_option_lst, val.str, NULL);
+ }
+ xf86unGetToken(token);
+ ptr->lay_input_lst = (XF86ConfInputrefPtr)
+ xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr);
+ }
+ break;
+ case OPTION:
+ ptr->lay_option_lst = xf86parseOption(ptr->lay_option_lst);
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Layout section parsed\n");
+ printf("Layout section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printLayoutSection (FILE * cf, XF86ConfLayoutPtr ptr)
+xf86printLayoutSection(FILE * cf, XF86ConfLayoutPtr ptr)
{
- XF86ConfAdjacencyPtr aptr;
- XF86ConfInactivePtr iptr;
- XF86ConfInputrefPtr inptr;
- XF86OptionPtr optr;
-
- while (ptr)
- {
- fprintf (cf, "Section \"ServerLayout\"\n");
- if (ptr->lay_comment)
- fprintf (cf, "%s", ptr->lay_comment);
- if (ptr->lay_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->lay_identifier);
-
- for (aptr = ptr->lay_adjacency_lst; aptr; aptr = aptr->list.next)
- {
- fprintf (cf, "\tScreen ");
- if (aptr->adj_scrnum >= 0)
- fprintf (cf, "%2d", aptr->adj_scrnum);
- else
- fprintf (cf, " ");
- fprintf (cf, " \"%s\"", aptr->adj_screen_str);
- switch(aptr->adj_where)
- {
- case CONF_ADJ_OBSOLETE:
- fprintf (cf, " \"%s\"", aptr->adj_top_str);
- fprintf (cf, " \"%s\"", aptr->adj_bottom_str);
- fprintf (cf, " \"%s\"", aptr->adj_right_str);
- fprintf (cf, " \"%s\"\n", aptr->adj_left_str);
- break;
- case CONF_ADJ_ABSOLUTE:
- if (aptr->adj_x != -1)
- fprintf (cf, " %d %d\n", aptr->adj_x, aptr->adj_y);
- else
- fprintf (cf, "\n");
- break;
- case CONF_ADJ_RIGHTOF:
- fprintf (cf, " RightOf \"%s\"\n", aptr->adj_refscreen);
- break;
- case CONF_ADJ_LEFTOF:
- fprintf (cf, " LeftOf \"%s\"\n", aptr->adj_refscreen);
- break;
- case CONF_ADJ_ABOVE:
- fprintf (cf, " Above \"%s\"\n", aptr->adj_refscreen);
- break;
- case CONF_ADJ_BELOW:
- fprintf (cf, " Below \"%s\"\n", aptr->adj_refscreen);
- break;
- case CONF_ADJ_RELATIVE:
- fprintf (cf, " Relative \"%s\" %d %d\n", aptr->adj_refscreen,
- aptr->adj_x, aptr->adj_y);
- break;
- }
- }
- for (iptr = ptr->lay_inactive_lst; iptr; iptr = iptr->list.next)
- fprintf (cf, "\tInactive \"%s\"\n", iptr->inactive_device_str);
- for (inptr = ptr->lay_input_lst; inptr; inptr = inptr->list.next)
- {
- fprintf (cf, "\tInputDevice \"%s\"", inptr->iref_inputdev_str);
- for (optr = inptr->iref_option_lst; optr; optr = optr->list.next)
- {
- fprintf(cf, " \"%s\"", optr->opt_name);
- }
- fprintf(cf, "\n");
- }
- xf86printOptionList(cf, ptr->lay_option_lst, 1);
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ XF86ConfAdjacencyPtr aptr;
+ XF86ConfInactivePtr iptr;
+ XF86ConfInputrefPtr inptr;
+ XF86OptionPtr optr;
+
+ while (ptr) {
+ fprintf(cf, "Section \"ServerLayout\"\n");
+ if (ptr->lay_comment)
+ fprintf(cf, "%s", ptr->lay_comment);
+ if (ptr->lay_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->lay_identifier);
+
+ for (aptr = ptr->lay_adjacency_lst; aptr; aptr = aptr->list.next) {
+ fprintf(cf, "\tScreen ");
+ if (aptr->adj_scrnum >= 0)
+ fprintf(cf, "%2d", aptr->adj_scrnum);
+ else
+ fprintf(cf, " ");
+ fprintf(cf, " \"%s\"", aptr->adj_screen_str);
+ switch (aptr->adj_where) {
+ case CONF_ADJ_OBSOLETE:
+ fprintf(cf, " \"%s\"", aptr->adj_top_str);
+ fprintf(cf, " \"%s\"", aptr->adj_bottom_str);
+ fprintf(cf, " \"%s\"", aptr->adj_right_str);
+ fprintf(cf, " \"%s\"\n", aptr->adj_left_str);
+ break;
+ case CONF_ADJ_ABSOLUTE:
+ if (aptr->adj_x != -1)
+ fprintf(cf, " %d %d\n", aptr->adj_x, aptr->adj_y);
+ else
+ fprintf(cf, "\n");
+ break;
+ case CONF_ADJ_RIGHTOF:
+ fprintf(cf, " RightOf \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_LEFTOF:
+ fprintf(cf, " LeftOf \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_ABOVE:
+ fprintf(cf, " Above \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_BELOW:
+ fprintf(cf, " Below \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_RELATIVE:
+ fprintf(cf, " Relative \"%s\" %d %d\n", aptr->adj_refscreen,
+ aptr->adj_x, aptr->adj_y);
+ break;
+ }
+ }
+ for (iptr = ptr->lay_inactive_lst; iptr; iptr = iptr->list.next)
+ fprintf(cf, "\tInactive \"%s\"\n", iptr->inactive_device_str);
+ for (inptr = ptr->lay_input_lst; inptr; inptr = inptr->list.next) {
+ fprintf(cf, "\tInputDevice \"%s\"", inptr->iref_inputdev_str);
+ for (optr = inptr->iref_option_lst; optr; optr = optr->list.next) {
+ fprintf(cf, " \"%s\"", optr->opt_name);
+ }
+ fprintf(cf, "\n");
+ }
+ xf86printOptionList(cf, ptr->lay_option_lst, 1);
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
static void
-xf86freeAdjacencyList (XF86ConfAdjacencyPtr ptr)
+xf86freeAdjacencyList(XF86ConfAdjacencyPtr ptr)
{
- XF86ConfAdjacencyPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->adj_screen_str);
- TestFree (ptr->adj_top_str);
- TestFree (ptr->adj_bottom_str);
- TestFree (ptr->adj_left_str);
- TestFree (ptr->adj_right_str);
-
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfAdjacencyPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->adj_screen_str);
+ TestFree(ptr->adj_top_str);
+ TestFree(ptr->adj_bottom_str);
+ TestFree(ptr->adj_left_str);
+ TestFree(ptr->adj_right_str);
+
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
static void
-xf86freeInputrefList (XF86ConfInputrefPtr ptr)
+xf86freeInputrefList(XF86ConfInputrefPtr ptr)
{
- XF86ConfInputrefPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->iref_inputdev_str);
- xf86optionListFree (ptr->iref_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfInputrefPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->iref_inputdev_str);
+ xf86optionListFree(ptr->iref_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
void
-xf86freeLayoutList (XF86ConfLayoutPtr ptr)
+xf86freeLayoutList(XF86ConfLayoutPtr ptr)
{
- XF86ConfLayoutPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->lay_identifier);
- TestFree (ptr->lay_comment);
- xf86freeAdjacencyList (ptr->lay_adjacency_lst);
- xf86freeInputrefList (ptr->lay_input_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfLayoutPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->lay_identifier);
+ TestFree(ptr->lay_comment);
+ xf86freeAdjacencyList(ptr->lay_adjacency_lst);
+ xf86freeInputrefList(ptr->lay_input_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
int
@@ -447,112 +432,103 @@ xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout)
XF86ConfInputrefPtr inptr;
/* add all AutoServerLayout devices to the server layout */
- while (input)
- {
- if (xf86CheckBoolOption(input->inp_option_lst, "AutoServerLayout", FALSE))
- {
- XF86ConfInputrefPtr iref = layout->lay_input_lst;
-
- /* avoid duplicates if referenced but lists AutoServerLayout too */
- while (iref)
- {
- if (strcmp(iref->iref_inputdev_str, input->inp_identifier) == 0)
- break;
- iref = iref->list.next;
- }
-
- if (!iref)
- {
- XF86ConfInputrefPtr iptr;
- iptr = calloc(1, sizeof(XF86ConfInputrefRec));
- iptr->iref_inputdev_str = input->inp_identifier;
- layout->lay_input_lst = (XF86ConfInputrefPtr)
- xf86addListItem((glp)layout->lay_input_lst, (glp)iptr);
- count++;
- }
- }
- input = input->list.next;
+ while (input) {
+ if (xf86CheckBoolOption
+ (input->inp_option_lst, "AutoServerLayout", FALSE)) {
+ XF86ConfInputrefPtr iref = layout->lay_input_lst;
+
+ /* avoid duplicates if referenced but lists AutoServerLayout too */
+ while (iref) {
+ if (strcmp(iref->iref_inputdev_str, input->inp_identifier) == 0)
+ break;
+ iref = iref->list.next;
+ }
+
+ if (!iref) {
+ XF86ConfInputrefPtr iptr;
+
+ iptr = calloc(1, sizeof(XF86ConfInputrefRec));
+ iptr->iref_inputdev_str = input->inp_identifier;
+ layout->lay_input_lst = (XF86ConfInputrefPtr)
+ xf86addListItem((glp) layout->lay_input_lst, (glp) iptr);
+ count++;
+ }
+ }
+ input = input->list.next;
}
inptr = layout->lay_input_lst;
- while (inptr)
- {
- input = xf86findInput (inptr->iref_inputdev_str,
- config->conf_input_lst);
- if (!input)
- {
- xf86validationError (UNDEFINED_INPUT_MSG,
- inptr->iref_inputdev_str, layout->lay_identifier);
- return -1;
- }
- else
- inptr->iref_inputdev = input;
- inptr = inptr->list.next;
+ while (inptr) {
+ input = xf86findInput(inptr->iref_inputdev_str, config->conf_input_lst);
+ if (!input) {
+ xf86validationError(UNDEFINED_INPUT_MSG,
+ inptr->iref_inputdev_str,
+ layout->lay_identifier);
+ return -1;
+ }
+ else
+ inptr->iref_inputdev = input;
+ inptr = inptr->list.next;
}
return count;
}
int
-xf86validateLayout (XF86ConfigPtr p)
+xf86validateLayout(XF86ConfigPtr p)
{
- XF86ConfLayoutPtr layout = p->conf_layout_lst;
- XF86ConfAdjacencyPtr adj;
- XF86ConfInactivePtr iptr;
- XF86ConfScreenPtr screen;
- XF86ConfDevicePtr device;
-
- while (layout)
- {
- adj = layout->lay_adjacency_lst;
- while (adj)
- {
- /* the first one can't be "" but all others can */
- screen = xf86findScreen (adj->adj_screen_str, p->conf_screen_lst);
- if (!screen)
- {
- xf86validationError (UNDEFINED_SCREEN_MSG,
- adj->adj_screen_str, layout->lay_identifier);
- return FALSE;
- }
- else
- adj->adj_screen = screen;
-
- adj = adj->list.next;
- }
- iptr = layout->lay_inactive_lst;
- while (iptr)
- {
- device = xf86findDevice (iptr->inactive_device_str,
- p->conf_device_lst);
- if (!device)
- {
- xf86validationError (UNDEFINED_DEVICE_LAY_MSG,
- iptr->inactive_device_str, layout->lay_identifier);
- return FALSE;
- }
- else
- iptr->inactive_device = device;
- iptr = iptr->list.next;
- }
-
- if (xf86layoutAddInputDevices(p, layout) == -1)
- return FALSE;
-
- layout = layout->list.next;
- }
- return TRUE;
+ XF86ConfLayoutPtr layout = p->conf_layout_lst;
+ XF86ConfAdjacencyPtr adj;
+ XF86ConfInactivePtr iptr;
+ XF86ConfScreenPtr screen;
+ XF86ConfDevicePtr device;
+
+ while (layout) {
+ adj = layout->lay_adjacency_lst;
+ while (adj) {
+ /* the first one can't be "" but all others can */
+ screen = xf86findScreen(adj->adj_screen_str, p->conf_screen_lst);
+ if (!screen) {
+ xf86validationError(UNDEFINED_SCREEN_MSG,
+ adj->adj_screen_str,
+ layout->lay_identifier);
+ return FALSE;
+ }
+ else
+ adj->adj_screen = screen;
+
+ adj = adj->list.next;
+ }
+ iptr = layout->lay_inactive_lst;
+ while (iptr) {
+ device = xf86findDevice(iptr->inactive_device_str,
+ p->conf_device_lst);
+ if (!device) {
+ xf86validationError(UNDEFINED_DEVICE_LAY_MSG,
+ iptr->inactive_device_str,
+ layout->lay_identifier);
+ return FALSE;
+ }
+ else
+ iptr->inactive_device = device;
+ iptr = iptr->list.next;
+ }
+
+ if (xf86layoutAddInputDevices(p, layout) == -1)
+ return FALSE;
+
+ layout = layout->list.next;
+ }
+ return TRUE;
}
XF86ConfLayoutPtr
-xf86findLayout (const char *name, XF86ConfLayoutPtr list)
+xf86findLayout(const char *name, XF86ConfLayoutPtr list)
{
- while (list)
- {
- if (xf86nameCompare (list->lay_identifier, name) == 0)
- return list;
- list = list->list.next;
- }
- return NULL;
+ while (list) {
+ if (xf86nameCompare(list->lay_identifier, name) == 0)
+ return list;
+ list = list->list.next;
+ }
+ return NULL;
}
-
diff --git a/xorg-server/hw/xfree86/parser/Module.c b/xorg-server/hw/xfree86/parser/Module.c
index 3c4cefc18..1c458ae6c 100644
--- a/xorg-server/hw/xfree86/parser/Module.c
+++ b/xorg-server/hw/xfree86/parser/Module.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,215 +64,207 @@
extern LexRec val;
-static xf86ConfigSymTabRec SubModuleTab[] =
-{
- {ENDSUBSECTION, "endsubsection"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec SubModuleTab[] = {
+ {ENDSUBSECTION, "endsubsection"},
+ {OPTION, "option"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec ModuleTab[] =
-{
- {ENDSECTION, "endsection"},
- {LOAD, "load"},
- {DISABLE, "disable"},
- {LOAD_DRIVER, "loaddriver"},
- {SUBSECTION, "subsection"},
- {-1, ""},
+static xf86ConfigSymTabRec ModuleTab[] = {
+ {ENDSECTION, "endsection"},
+ {LOAD, "load"},
+ {DISABLE, "disable"},
+ {LOAD_DRIVER, "loaddriver"},
+ {SUBSECTION, "subsection"},
+ {-1, ""},
};
#define CLEANUP xf86freeModules
static XF86LoadPtr
-xf86parseModuleSubSection (XF86LoadPtr head, char *name)
+xf86parseModuleSubSection(XF86LoadPtr head, char *name)
{
- int token;
- parsePrologue (XF86LoadPtr, XF86LoadRec)
+ int token;
- ptr->load_name = name;
- ptr->load_type = XF86_LOAD_MODULE;
- ptr->ignore = 0;
- ptr->load_opt = NULL;
- ptr->list.next = NULL;
+ parsePrologue(XF86LoadPtr, XF86LoadRec)
- while ((token = xf86getToken (SubModuleTab)) != ENDSUBSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->load_comment = xf86addComment(ptr->load_comment, val.str);
- break;
- case OPTION:
- ptr->load_opt = xf86parseOption(ptr->load_opt);
- break;
- case EOF_TOKEN:
- xf86parseError (UNEXPECTED_EOF_MSG);
- free(ptr);
- return NULL;
- default:
- xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
- free(ptr);
- return NULL;
- break;
- }
+ ptr->load_name = name;
+ ptr->load_type = XF86_LOAD_MODULE;
+ ptr->ignore = 0;
+ ptr->load_opt = NULL;
+ ptr->list.next = NULL;
- }
+ while ((token = xf86getToken(SubModuleTab)) != ENDSUBSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->load_comment = xf86addComment(ptr->load_comment, val.str);
+ break;
+ case OPTION:
+ ptr->load_opt = xf86parseOption(ptr->load_opt);
+ break;
+ case EOF_TOKEN:
+ xf86parseError(UNEXPECTED_EOF_MSG);
+ free(ptr);
+ return NULL;
+ default:
+ xf86parseError(INVALID_KEYWORD_MSG, xf86tokenString());
+ free(ptr);
+ return NULL;
+ break;
+ }
- return ((XF86LoadPtr) xf86addListItem ((glp) head, (glp) ptr));
+ }
+
+ return ((XF86LoadPtr) xf86addListItem((glp) head, (glp) ptr));
}
XF86ConfModulePtr
-xf86parseModuleSection (void)
+xf86parseModuleSection(void)
{
- int token;
- parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec)
+ int token;
+
+ parsePrologue(XF86ConfModulePtr, XF86ConfModuleRec)
- while ((token = xf86getToken (ModuleTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->mod_comment = xf86addComment(ptr->mod_comment, val.str);
- break;
- case LOAD:
- if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
- Error (QUOTE_MSG, "Load");
- ptr->mod_load_lst =
- xf86addNewLoadDirective (ptr->mod_load_lst, val.str,
- XF86_LOAD_MODULE, NULL);
- break;
- case DISABLE:
- if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
- Error (QUOTE_MSG, "Disable");
- ptr->mod_disable_lst =
- xf86addNewLoadDirective (ptr->mod_disable_lst, val.str,
- XF86_DISABLE_MODULE, NULL);
- break;
- case LOAD_DRIVER:
- if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
- Error (QUOTE_MSG, "LoadDriver");
- ptr->mod_load_lst =
- xf86addNewLoadDirective (ptr->mod_load_lst, val.str,
- XF86_LOAD_DRIVER, NULL);
- break;
- case SUBSECTION:
- if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
- Error (QUOTE_MSG, "SubSection");
- ptr->mod_load_lst =
- xf86parseModuleSubSection (ptr->mod_load_lst, val.str);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ while ((token = xf86getToken(ModuleTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->mod_comment = xf86addComment(ptr->mod_comment, val.str);
+ break;
+ case LOAD:
+ if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
+ Error(QUOTE_MSG, "Load");
+ ptr->mod_load_lst =
+ xf86addNewLoadDirective(ptr->mod_load_lst, val.str,
+ XF86_LOAD_MODULE, NULL);
+ break;
+ case DISABLE:
+ if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
+ Error(QUOTE_MSG, "Disable");
+ ptr->mod_disable_lst =
+ xf86addNewLoadDirective(ptr->mod_disable_lst, val.str,
+ XF86_DISABLE_MODULE, NULL);
+ break;
+ case LOAD_DRIVER:
+ if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
+ Error(QUOTE_MSG, "LoadDriver");
+ ptr->mod_load_lst =
+ xf86addNewLoadDirective(ptr->mod_load_lst, val.str,
+ XF86_LOAD_DRIVER, NULL);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
+ Error(QUOTE_MSG, "SubSection");
+ ptr->mod_load_lst =
+ xf86parseModuleSubSection(ptr->mod_load_lst, val.str);
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("Module section parsed\n");
+ printf("Module section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printModuleSection (FILE * cf, XF86ConfModulePtr ptr)
+xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr)
{
- XF86LoadPtr lptr;
+ XF86LoadPtr lptr;
- if (ptr == NULL)
- return;
+ if (ptr == NULL)
+ return;
- if (ptr->mod_comment)
- fprintf(cf, "%s", ptr->mod_comment);
- for (lptr = ptr->mod_load_lst; lptr; lptr = lptr->list.next)
- {
- switch (lptr->load_type)
- {
- case XF86_LOAD_MODULE:
- if( lptr->load_opt == NULL ) {
- fprintf (cf, "\tLoad \"%s\"", lptr->load_name);
- if (lptr->load_comment)
- fprintf(cf, "%s", lptr->load_comment);
- else
- fputc('\n', cf);
- }
- else
- {
- fprintf (cf, "\tSubSection \"%s\"\n", lptr->load_name);
- if (lptr->load_comment)
- fprintf(cf, "%s", lptr->load_comment);
- xf86printOptionList(cf, lptr->load_opt, 2);
- fprintf (cf, "\tEndSubSection\n");
- }
- break;
- case XF86_LOAD_DRIVER:
- fprintf (cf, "\tLoadDriver \"%s\"", lptr->load_name);
- if (lptr->load_comment)
- fprintf(cf, "%s", lptr->load_comment);
- else
- fputc('\n', cf);
- break;
+ if (ptr->mod_comment)
+ fprintf(cf, "%s", ptr->mod_comment);
+ for (lptr = ptr->mod_load_lst; lptr; lptr = lptr->list.next) {
+ switch (lptr->load_type) {
+ case XF86_LOAD_MODULE:
+ if (lptr->load_opt == NULL) {
+ fprintf(cf, "\tLoad \"%s\"", lptr->load_name);
+ if (lptr->load_comment)
+ fprintf(cf, "%s", lptr->load_comment);
+ else
+ fputc('\n', cf);
+ }
+ else {
+ fprintf(cf, "\tSubSection \"%s\"\n", lptr->load_name);
+ if (lptr->load_comment)
+ fprintf(cf, "%s", lptr->load_comment);
+ xf86printOptionList(cf, lptr->load_opt, 2);
+ fprintf(cf, "\tEndSubSection\n");
+ }
+ break;
+ case XF86_LOAD_DRIVER:
+ fprintf(cf, "\tLoadDriver \"%s\"", lptr->load_name);
+ if (lptr->load_comment)
+ fprintf(cf, "%s", lptr->load_comment);
+ else
+ fputc('\n', cf);
+ break;
#if 0
- default:
- fprintf (cf, "#\tUnknown type \"%s\"\n", lptr->load_name);
- break;
+ default:
+ fprintf(cf, "#\tUnknown type \"%s\"\n", lptr->load_name);
+ break;
#endif
- }
- }
+ }
+ }
}
XF86LoadPtr
-xf86addNewLoadDirective (XF86LoadPtr head, char *name, int type, XF86OptionPtr opts)
+xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type,
+ XF86OptionPtr opts)
{
- XF86LoadPtr new;
- int token;
+ XF86LoadPtr new;
+ int token;
- new = calloc (1, sizeof (XF86LoadRec));
- new->load_name = name;
- new->load_type = type;
- new->load_opt = opts;
- new->ignore = 0;
- new->list.next = NULL;
+ new = calloc(1, sizeof(XF86LoadRec));
+ new->load_name = name;
+ new->load_type = type;
+ new->load_opt = opts;
+ new->ignore = 0;
+ new->list.next = NULL;
- if ((token = xf86getToken(NULL)) == COMMENT)
- new->load_comment = xf86addComment(new->load_comment, val.str);
- else
- xf86unGetToken(token);
+ if ((token = xf86getToken(NULL)) == COMMENT)
+ new->load_comment = xf86addComment(new->load_comment, val.str);
+ else
+ xf86unGetToken(token);
- return ((XF86LoadPtr) xf86addListItem ((glp) head, (glp) new));
+ return ((XF86LoadPtr) xf86addListItem((glp) head, (glp) new));
}
void
-xf86freeModules (XF86ConfModulePtr ptr)
+xf86freeModules(XF86ConfModulePtr ptr)
{
- XF86LoadPtr lptr;
- XF86LoadPtr prev;
+ XF86LoadPtr lptr;
+ XF86LoadPtr prev;
- if (ptr == NULL)
- return;
- lptr = ptr->mod_load_lst;
- while (lptr)
- {
- TestFree (lptr->load_name);
- TestFree (lptr->load_comment);
- prev = lptr;
- lptr = lptr->list.next;
- free (prev);
- }
- lptr = ptr->mod_disable_lst;
- while (lptr)
- {
- TestFree (lptr->load_name);
- TestFree (lptr->load_comment);
- prev = lptr;
- lptr = lptr->list.next;
- free (prev);
- }
- TestFree (ptr->mod_comment);
- free (ptr);
+ if (ptr == NULL)
+ return;
+ lptr = ptr->mod_load_lst;
+ while (lptr) {
+ TestFree(lptr->load_name);
+ TestFree(lptr->load_comment);
+ prev = lptr;
+ lptr = lptr->list.next;
+ free(prev);
+ }
+ lptr = ptr->mod_disable_lst;
+ while (lptr) {
+ TestFree(lptr->load_name);
+ TestFree(lptr->load_comment);
+ prev = lptr;
+ lptr = lptr->list.next;
+ free(prev);
+ }
+ TestFree(ptr->mod_comment);
+ free(ptr);
}
diff --git a/xorg-server/hw/xfree86/parser/Monitor.c b/xorg-server/hw/xfree86/parser/Monitor.c
index 52c55007e..b237dfb32 100644
--- a/xorg-server/hw/xfree86/parser/Monitor.c
+++ b/xorg-server/hw/xfree86/parser/Monitor.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,348 +64,340 @@
extern LexRec val;
-static xf86ConfigSymTabRec MonitorTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {VENDOR, "vendorname"},
- {MODEL, "modelname"},
- {USEMODES, "usemodes"},
- {MODELINE, "modeline"},
- {DISPLAYSIZE, "displaysize"},
- {HORIZSYNC, "horizsync"},
- {VERTREFRESH, "vertrefresh"},
- {MODE, "mode"},
- {GAMMA, "gamma"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec MonitorTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {VENDOR, "vendorname"},
+ {MODEL, "modelname"},
+ {USEMODES, "usemodes"},
+ {MODELINE, "modeline"},
+ {DISPLAYSIZE, "displaysize"},
+ {HORIZSYNC, "horizsync"},
+ {VERTREFRESH, "vertrefresh"},
+ {MODE, "mode"},
+ {GAMMA, "gamma"},
+ {OPTION, "option"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec ModesTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {MODELINE, "modeline"},
- {MODE, "mode"},
- {-1, ""},
+static xf86ConfigSymTabRec ModesTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {MODELINE, "modeline"},
+ {MODE, "mode"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec TimingTab[] =
-{
- {TT_INTERLACE, "interlace"},
- {TT_PHSYNC, "+hsync"},
- {TT_NHSYNC, "-hsync"},
- {TT_PVSYNC, "+vsync"},
- {TT_NVSYNC, "-vsync"},
- {TT_CSYNC, "composite"},
- {TT_PCSYNC, "+csync"},
- {TT_NCSYNC, "-csync"},
- {TT_DBLSCAN, "doublescan"},
- {TT_HSKEW, "hskew"},
- {TT_BCAST, "bcast"},
- {TT_VSCAN, "vscan"},
- {-1, ""},
+static xf86ConfigSymTabRec TimingTab[] = {
+ {TT_INTERLACE, "interlace"},
+ {TT_PHSYNC, "+hsync"},
+ {TT_NHSYNC, "-hsync"},
+ {TT_PVSYNC, "+vsync"},
+ {TT_NVSYNC, "-vsync"},
+ {TT_CSYNC, "composite"},
+ {TT_PCSYNC, "+csync"},
+ {TT_NCSYNC, "-csync"},
+ {TT_DBLSCAN, "doublescan"},
+ {TT_HSKEW, "hskew"},
+ {TT_BCAST, "bcast"},
+ {TT_VSCAN, "vscan"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec ModeTab[] =
-{
- {DOTCLOCK, "dotclock"},
- {HTIMINGS, "htimings"},
- {VTIMINGS, "vtimings"},
- {FLAGS, "flags"},
- {HSKEW, "hskew"},
- {BCAST, "bcast"},
- {VSCAN, "vscan"},
- {ENDMODE, "endmode"},
- {-1, ""},
+static xf86ConfigSymTabRec ModeTab[] = {
+ {DOTCLOCK, "dotclock"},
+ {HTIMINGS, "htimings"},
+ {VTIMINGS, "vtimings"},
+ {FLAGS, "flags"},
+ {HSKEW, "hskew"},
+ {BCAST, "bcast"},
+ {VSCAN, "vscan"},
+ {ENDMODE, "endmode"},
+ {-1, ""},
};
#define CLEANUP xf86freeModeLineList
static void
-xf86freeModeLineList (XF86ConfModeLinePtr ptr)
+xf86freeModeLineList(XF86ConfModeLinePtr ptr)
{
- XF86ConfModeLinePtr prev;
- while (ptr)
- {
- TestFree (ptr->ml_identifier);
- TestFree (ptr->ml_comment);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfModeLinePtr prev;
+
+ while (ptr) {
+ TestFree(ptr->ml_identifier);
+ TestFree(ptr->ml_comment);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
static XF86ConfModeLinePtr
-xf86parseModeLine (void)
+xf86parseModeLine(void)
{
- int token;
- parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)
-
- /* Identifier */
- if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
- Error ("ModeLine identifier expected");
- ptr->ml_identifier = val.str;
-
- /* DotClock */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine dotclock expected");
- ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
-
- /* HDisplay */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine Hdisplay expected");
- ptr->ml_hdisplay = val.num;
-
- /* HSyncStart */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine HSyncStart expected");
- ptr->ml_hsyncstart = val.num;
-
- /* HSyncEnd */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine HSyncEnd expected");
- ptr->ml_hsyncend = val.num;
-
- /* HTotal */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine HTotal expected");
- ptr->ml_htotal = val.num;
-
- /* VDisplay */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine Vdisplay expected");
- ptr->ml_vdisplay = val.num;
-
- /* VSyncStart */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine VSyncStart expected");
- ptr->ml_vsyncstart = val.num;
-
- /* VSyncEnd */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine VSyncEnd expected");
- ptr->ml_vsyncend = val.num;
-
- /* VTotal */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine VTotal expected");
- ptr->ml_vtotal = val.num;
-
- token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
- while ((token == TT_INTERLACE) || (token == TT_PHSYNC) ||
- (token == TT_NHSYNC) || (token == TT_PVSYNC) ||
- (token == TT_NVSYNC) || (token == TT_CSYNC) ||
- (token == TT_PCSYNC) || (token == TT_NCSYNC) ||
- (token == TT_DBLSCAN) || (token == TT_HSKEW) ||
- (token == TT_VSCAN) || (token == TT_BCAST))
- {
- switch (token)
- {
-
- case TT_INTERLACE:
- ptr->ml_flags |= XF86CONF_INTERLACE;
- break;
- case TT_PHSYNC:
- ptr->ml_flags |= XF86CONF_PHSYNC;
- break;
- case TT_NHSYNC:
- ptr->ml_flags |= XF86CONF_NHSYNC;
- break;
- case TT_PVSYNC:
- ptr->ml_flags |= XF86CONF_PVSYNC;
- break;
- case TT_NVSYNC:
- ptr->ml_flags |= XF86CONF_NVSYNC;
- break;
- case TT_CSYNC:
- ptr->ml_flags |= XF86CONF_CSYNC;
- break;
- case TT_PCSYNC:
- ptr->ml_flags |= XF86CONF_PCSYNC;
- break;
- case TT_NCSYNC:
- ptr->ml_flags |= XF86CONF_NCSYNC;
- break;
- case TT_DBLSCAN:
- ptr->ml_flags |= XF86CONF_DBLSCAN;
- break;
- case TT_HSKEW:
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error (NUMBER_MSG, "Hskew");
- ptr->ml_hskew = val.num;
- ptr->ml_flags |= XF86CONF_HSKEW;
- break;
- case TT_BCAST:
- ptr->ml_flags |= XF86CONF_BCAST;
- break;
- case TT_VSCAN:
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error (NUMBER_MSG, "Vscan");
- ptr->ml_vscan = val.num;
- ptr->ml_flags |= XF86CONF_VSCAN;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
- }
- xf86unGetToken (token);
+ int token;
+
+ parsePrologue(XF86ConfModeLinePtr, XF86ConfModeLineRec)
+
+ /* Identifier */
+ if (xf86getSubToken(&(ptr->ml_comment)) != STRING)
+ Error("ModeLine identifier expected");
+ ptr->ml_identifier = val.str;
+
+ /* DotClock */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine dotclock expected");
+ ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
+
+ /* HDisplay */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine Hdisplay expected");
+ ptr->ml_hdisplay = val.num;
+
+ /* HSyncStart */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine HSyncStart expected");
+ ptr->ml_hsyncstart = val.num;
+
+ /* HSyncEnd */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine HSyncEnd expected");
+ ptr->ml_hsyncend = val.num;
+
+ /* HTotal */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine HTotal expected");
+ ptr->ml_htotal = val.num;
+
+ /* VDisplay */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine Vdisplay expected");
+ ptr->ml_vdisplay = val.num;
+
+ /* VSyncStart */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine VSyncStart expected");
+ ptr->ml_vsyncstart = val.num;
+
+ /* VSyncEnd */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine VSyncEnd expected");
+ ptr->ml_vsyncend = val.num;
+
+ /* VTotal */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine VTotal expected");
+ ptr->ml_vtotal = val.num;
+
+ token = xf86getSubTokenWithTab(&(ptr->ml_comment), TimingTab);
+ while ((token == TT_INTERLACE) || (token == TT_PHSYNC) ||
+ (token == TT_NHSYNC) || (token == TT_PVSYNC) ||
+ (token == TT_NVSYNC) || (token == TT_CSYNC) ||
+ (token == TT_PCSYNC) || (token == TT_NCSYNC) ||
+ (token == TT_DBLSCAN) || (token == TT_HSKEW) ||
+ (token == TT_VSCAN) || (token == TT_BCAST)) {
+ switch (token) {
+
+ case TT_INTERLACE:
+ ptr->ml_flags |= XF86CONF_INTERLACE;
+ break;
+ case TT_PHSYNC:
+ ptr->ml_flags |= XF86CONF_PHSYNC;
+ break;
+ case TT_NHSYNC:
+ ptr->ml_flags |= XF86CONF_NHSYNC;
+ break;
+ case TT_PVSYNC:
+ ptr->ml_flags |= XF86CONF_PVSYNC;
+ break;
+ case TT_NVSYNC:
+ ptr->ml_flags |= XF86CONF_NVSYNC;
+ break;
+ case TT_CSYNC:
+ ptr->ml_flags |= XF86CONF_CSYNC;
+ break;
+ case TT_PCSYNC:
+ ptr->ml_flags |= XF86CONF_PCSYNC;
+ break;
+ case TT_NCSYNC:
+ ptr->ml_flags |= XF86CONF_NCSYNC;
+ break;
+ case TT_DBLSCAN:
+ ptr->ml_flags |= XF86CONF_DBLSCAN;
+ break;
+ case TT_HSKEW:
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Hskew");
+ ptr->ml_hskew = val.num;
+ ptr->ml_flags |= XF86CONF_HSKEW;
+ break;
+ case TT_BCAST:
+ ptr->ml_flags |= XF86CONF_BCAST;
+ break;
+ case TT_VSCAN:
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Vscan");
+ ptr->ml_vscan = val.num;
+ ptr->ml_flags |= XF86CONF_VSCAN;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ token = xf86getSubTokenWithTab(&(ptr->ml_comment), TimingTab);
+ }
+ xf86unGetToken(token);
#ifdef DEBUG
- printf ("ModeLine parsed\n");
+ printf("ModeLine parsed\n");
#endif
- return ptr;
+ return ptr;
}
static XF86ConfModeLinePtr
-xf86parseVerboseMode (void)
+xf86parseVerboseMode(void)
{
- int token, token2;
- int had_dotclock = 0, had_htimings = 0, had_vtimings = 0;
- parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)
-
- if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
- Error ("Mode name expected");
- ptr->ml_identifier = val.str;
- while ((token = xf86getToken (ModeTab)) != ENDMODE)
- {
- switch (token)
- {
- case COMMENT:
- ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str);
- break;
- case DOTCLOCK:
- if ((token = xf86getSubToken (&(ptr->ml_comment))) != NUMBER)
- Error (NUMBER_MSG, "DotClock");
- ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
- had_dotclock = 1;
- break;
- case HTIMINGS:
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_hdisplay = val.num;
- else
- Error ("Horizontal display expected");
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_hsyncstart = val.num;
- else
- Error ("Horizontal sync start expected");
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_hsyncend = val.num;
- else
- Error ("Horizontal sync end expected");
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_htotal = val.num;
- else
- Error ("Horizontal total expected");
- had_htimings = 1;
- break;
- case VTIMINGS:
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_vdisplay = val.num;
- else
- Error ("Vertical display expected");
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_vsyncstart = val.num;
- else
- Error ("Vertical sync start expected");
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_vsyncend = val.num;
- else
- Error ("Vertical sync end expected");
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_vtotal = val.num;
- else
- Error ("Vertical total expected");
- had_vtimings = 1;
- break;
- case FLAGS:
- token = xf86getSubToken (&(ptr->ml_comment));
- if (token != STRING)
- Error (QUOTE_MSG, "Flags");
- while (token == STRING)
- {
- token2 = xf86getStringToken (TimingTab);
- switch (token2)
- {
- case TT_INTERLACE:
- ptr->ml_flags |= XF86CONF_INTERLACE;
- break;
- case TT_PHSYNC:
- ptr->ml_flags |= XF86CONF_PHSYNC;
- break;
- case TT_NHSYNC:
- ptr->ml_flags |= XF86CONF_NHSYNC;
- break;
- case TT_PVSYNC:
- ptr->ml_flags |= XF86CONF_PVSYNC;
- break;
- case TT_NVSYNC:
- ptr->ml_flags |= XF86CONF_NVSYNC;
- break;
- case TT_CSYNC:
- ptr->ml_flags |= XF86CONF_CSYNC;
- break;
- case TT_PCSYNC:
- ptr->ml_flags |= XF86CONF_PCSYNC;
- break;
- case TT_NCSYNC:
- ptr->ml_flags |= XF86CONF_NCSYNC;
- break;
- case TT_DBLSCAN:
- ptr->ml_flags |= XF86CONF_DBLSCAN;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error ("Unknown flag string");
- break;
- }
- token = xf86getSubToken (&(ptr->ml_comment));
- }
- xf86unGetToken (token);
- break;
- case HSKEW:
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("Horizontal skew expected");
- ptr->ml_flags |= XF86CONF_HSKEW;
- ptr->ml_hskew = val.num;
- break;
- case VSCAN:
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("Vertical scan count expected");
- ptr->ml_flags |= XF86CONF_VSCAN;
- ptr->ml_vscan = val.num;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error ("Unexepcted token in verbose \"Mode\" entry\n");
- }
- }
- if (!had_dotclock)
- Error ("the dotclock is missing");
- if (!had_htimings)
- Error ("the horizontal timings are missing");
- if (!had_vtimings)
- Error ("the vertical timings are missing");
+ int token, token2;
+ int had_dotclock = 0, had_htimings = 0, had_vtimings = 0;
+
+ parsePrologue(XF86ConfModeLinePtr, XF86ConfModeLineRec)
+
+ if (xf86getSubToken(&(ptr->ml_comment)) != STRING)
+ Error("Mode name expected");
+ ptr->ml_identifier = val.str;
+ while ((token = xf86getToken(ModeTab)) != ENDMODE) {
+ switch (token) {
+ case COMMENT:
+ ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str);
+ break;
+ case DOTCLOCK:
+ if ((token = xf86getSubToken(&(ptr->ml_comment))) != NUMBER)
+ Error(NUMBER_MSG, "DotClock");
+ ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
+ had_dotclock = 1;
+ break;
+ case HTIMINGS:
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_hdisplay = val.num;
+ else
+ Error("Horizontal display expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_hsyncstart = val.num;
+ else
+ Error("Horizontal sync start expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_hsyncend = val.num;
+ else
+ Error("Horizontal sync end expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_htotal = val.num;
+ else
+ Error("Horizontal total expected");
+ had_htimings = 1;
+ break;
+ case VTIMINGS:
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vdisplay = val.num;
+ else
+ Error("Vertical display expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vsyncstart = val.num;
+ else
+ Error("Vertical sync start expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vsyncend = val.num;
+ else
+ Error("Vertical sync end expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vtotal = val.num;
+ else
+ Error("Vertical total expected");
+ had_vtimings = 1;
+ break;
+ case FLAGS:
+ token = xf86getSubToken(&(ptr->ml_comment));
+ if (token != STRING)
+ Error(QUOTE_MSG, "Flags");
+ while (token == STRING) {
+ token2 = xf86getStringToken(TimingTab);
+ switch (token2) {
+ case TT_INTERLACE:
+ ptr->ml_flags |= XF86CONF_INTERLACE;
+ break;
+ case TT_PHSYNC:
+ ptr->ml_flags |= XF86CONF_PHSYNC;
+ break;
+ case TT_NHSYNC:
+ ptr->ml_flags |= XF86CONF_NHSYNC;
+ break;
+ case TT_PVSYNC:
+ ptr->ml_flags |= XF86CONF_PVSYNC;
+ break;
+ case TT_NVSYNC:
+ ptr->ml_flags |= XF86CONF_NVSYNC;
+ break;
+ case TT_CSYNC:
+ ptr->ml_flags |= XF86CONF_CSYNC;
+ break;
+ case TT_PCSYNC:
+ ptr->ml_flags |= XF86CONF_PCSYNC;
+ break;
+ case TT_NCSYNC:
+ ptr->ml_flags |= XF86CONF_NCSYNC;
+ break;
+ case TT_DBLSCAN:
+ ptr->ml_flags |= XF86CONF_DBLSCAN;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error("Unknown flag string");
+ break;
+ }
+ token = xf86getSubToken(&(ptr->ml_comment));
+ }
+ xf86unGetToken(token);
+ break;
+ case HSKEW:
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("Horizontal skew expected");
+ ptr->ml_flags |= XF86CONF_HSKEW;
+ ptr->ml_hskew = val.num;
+ break;
+ case VSCAN:
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("Vertical scan count expected");
+ ptr->ml_flags |= XF86CONF_VSCAN;
+ ptr->ml_vscan = val.num;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error("Unexepcted token in verbose \"Mode\" entry\n");
+ }
+ }
+ if (!had_dotclock)
+ Error("the dotclock is missing");
+ if (!had_htimings)
+ Error("the horizontal timings are missing");
+ if (!had_vtimings)
+ Error("the vertical timings are missing");
#ifdef DEBUG
- printf ("Verbose Mode parsed\n");
+ printf("Verbose Mode parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
@@ -414,484 +405,460 @@ xf86parseVerboseMode (void)
#define CLEANUP xf86freeMonitorList
XF86ConfMonitorPtr
-xf86parseMonitorSection (void)
+xf86parseMonitorSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
-
- while ((token = xf86getToken (MonitorTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->mon_identifier = val.str;
- has_ident = TRUE;
- break;
- case VENDOR:
- if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
- Error (QUOTE_MSG, "Vendor");
- ptr->mon_vendor = val.str;
- break;
- case MODEL:
- if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
- Error (QUOTE_MSG, "ModelName");
- ptr->mon_modelname = val.str;
- break;
- case MODE:
- HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
- XF86ConfModeLinePtr);
- break;
- case MODELINE:
- HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
- XF86ConfModeLinePtr);
- break;
- case DISPLAYSIZE:
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
- Error (DISPLAYSIZE_MSG);
- ptr->mon_width = val.realnum;
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
- Error (DISPLAYSIZE_MSG);
- ptr->mon_height = val.realnum;
- break;
-
- case HORIZSYNC:
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
- Error (HORIZSYNC_MSG);
- do {
- if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
- Error ("Sorry. Too many horizontal sync intervals.");
- ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum;
- switch (token = xf86getSubToken (&(ptr->mon_comment)))
- {
- case COMMA:
- ptr->mon_hsync[ptr->mon_n_hsync].hi =
- ptr->mon_hsync[ptr->mon_n_hsync].lo;
- break;
- case DASH:
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
- (float)val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo)
- Error (HORIZSYNC_MSG);
- ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
- if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
- break;
- ptr->mon_n_hsync++;
- goto HorizDone;
- default:
- /* We cannot currently know if a '\n' was found,
- * or this is a real error
- */
- ptr->mon_hsync[ptr->mon_n_hsync].hi =
- ptr->mon_hsync[ptr->mon_n_hsync].lo;
- ptr->mon_n_hsync++;
- goto HorizDone;
- }
- ptr->mon_n_hsync++;
- } while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
-HorizDone:
- xf86unGetToken (token);
- break;
-
- case VERTREFRESH:
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
- Error (VERTREFRESH_MSG);
- do {
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum;
- switch (token = xf86getSubToken (&(ptr->mon_comment)))
- {
- case COMMA:
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
- break;
- case DASH:
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
- (float)val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
- Error (VERTREFRESH_MSG);
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
- if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
- break;
- ptr->mon_n_vrefresh++;
- goto VertDone;
- default:
- /* We cannot currently know if a '\n' was found,
- * or this is a real error
- */
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
- ptr->mon_n_vrefresh++;
- goto VertDone;
- }
- if (ptr->mon_n_vrefresh >= CONF_MAX_VREFRESH)
- Error ("Sorry. Too many vertical refresh intervals.");
- ptr->mon_n_vrefresh++;
- } while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
-VertDone:
- xf86unGetToken (token);
- break;
-
- case GAMMA:
- if( xf86getSubToken (&(ptr->mon_comment)) != NUMBER )
- {
- Error (INVALID_GAMMA_MSG);
- }
- else
- {
- ptr->mon_gamma_red = ptr->mon_gamma_green =
- ptr->mon_gamma_blue = val.realnum;
- if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER )
- {
- ptr->mon_gamma_green = val.realnum;
- if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER )
- {
- ptr->mon_gamma_blue = val.realnum;
- }
- else
- {
- Error (INVALID_GAMMA_MSG);
- }
- }
- else
- xf86unGetToken (token);
- }
- break;
- case OPTION:
- ptr->mon_option_lst = xf86parseOption(ptr->mon_option_lst);
- break;
- case USEMODES:
- {
- XF86ConfModesLinkPtr mptr;
-
- if ((token = xf86getSubToken (&(ptr->mon_comment))) != STRING)
- Error (QUOTE_MSG, "UseModes");
-
- /* add to the end of the list of modes sections
- referenced here */
- mptr = calloc (1, sizeof (XF86ConfModesLinkRec));
- mptr->list.next = NULL;
- mptr->ml_modes_str = val.str;
- mptr->ml_modes = NULL;
- ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr)
- xf86addListItem((GenericListPtr)ptr->mon_modes_sect_lst,
- (GenericListPtr)mptr);
- }
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
- CLEANUP (ptr);
- return NULL;
- break;
- }
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG);
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec)
+
+ while ((token = xf86getToken(MonitorTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->mon_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->mon_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case VENDOR:
+ if (xf86getSubToken(&(ptr->mon_comment)) != STRING)
+ Error(QUOTE_MSG, "Vendor");
+ ptr->mon_vendor = val.str;
+ break;
+ case MODEL:
+ if (xf86getSubToken(&(ptr->mon_comment)) != STRING)
+ Error(QUOTE_MSG, "ModelName");
+ ptr->mon_modelname = val.str;
+ break;
+ case MODE:
+ HANDLE_LIST(mon_modeline_lst, xf86parseVerboseMode,
+ XF86ConfModeLinePtr);
+ break;
+ case MODELINE:
+ HANDLE_LIST(mon_modeline_lst, xf86parseModeLine,
+ XF86ConfModeLinePtr);
+ break;
+ case DISPLAYSIZE:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
+ Error(DISPLAYSIZE_MSG);
+ ptr->mon_width = val.realnum;
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
+ Error(DISPLAYSIZE_MSG);
+ ptr->mon_height = val.realnum;
+ break;
+
+ case HORIZSYNC:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
+ Error(HORIZSYNC_MSG);
+ do {
+ if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
+ Error("Sorry. Too many horizontal sync intervals.");
+ ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum;
+ switch (token = xf86getSubToken(&(ptr->mon_comment))) {
+ case COMMA:
+ ptr->mon_hsync[ptr->mon_n_hsync].hi =
+ ptr->mon_hsync[ptr->mon_n_hsync].lo;
+ break;
+ case DASH:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER ||
+ (float) val.realnum <
+ ptr->mon_hsync[ptr->mon_n_hsync].lo)
+ Error(HORIZSYNC_MSG);
+ ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
+ if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA)
+ break;
+ ptr->mon_n_hsync++;
+ goto HorizDone;
+ default:
+ /* We cannot currently know if a '\n' was found,
+ * or this is a real error
+ */
+ ptr->mon_hsync[ptr->mon_n_hsync].hi =
+ ptr->mon_hsync[ptr->mon_n_hsync].lo;
+ ptr->mon_n_hsync++;
+ goto HorizDone;
+ }
+ ptr->mon_n_hsync++;
+ } while ((token = xf86getSubToken(&(ptr->mon_comment))) == NUMBER);
+ HorizDone:
+ xf86unGetToken(token);
+ break;
+
+ case VERTREFRESH:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
+ Error(VERTREFRESH_MSG);
+ do {
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum;
+ switch (token = xf86getSubToken(&(ptr->mon_comment))) {
+ case COMMA:
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
+ break;
+ case DASH:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER ||
+ (float) val.realnum <
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
+ Error(VERTREFRESH_MSG);
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
+ if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA)
+ break;
+ ptr->mon_n_vrefresh++;
+ goto VertDone;
+ default:
+ /* We cannot currently know if a '\n' was found,
+ * or this is a real error
+ */
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
+ ptr->mon_n_vrefresh++;
+ goto VertDone;
+ }
+ if (ptr->mon_n_vrefresh >= CONF_MAX_VREFRESH)
+ Error("Sorry. Too many vertical refresh intervals.");
+ ptr->mon_n_vrefresh++;
+ } while ((token = xf86getSubToken(&(ptr->mon_comment))) == NUMBER);
+ VertDone:
+ xf86unGetToken(token);
+ break;
+
+ case GAMMA:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) {
+ Error(INVALID_GAMMA_MSG);
+ }
+ else {
+ ptr->mon_gamma_red = ptr->mon_gamma_green =
+ ptr->mon_gamma_blue = val.realnum;
+ if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) {
+ ptr->mon_gamma_green = val.realnum;
+ if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) {
+ ptr->mon_gamma_blue = val.realnum;
+ }
+ else {
+ Error(INVALID_GAMMA_MSG);
+ }
+ }
+ else
+ xf86unGetToken(token);
+ }
+ break;
+ case OPTION:
+ ptr->mon_option_lst = xf86parseOption(ptr->mon_option_lst);
+ break;
+ case USEMODES:
+ {
+ XF86ConfModesLinkPtr mptr;
+
+ if ((token = xf86getSubToken(&(ptr->mon_comment))) != STRING)
+ Error(QUOTE_MSG, "UseModes");
+
+ /* add to the end of the list of modes sections
+ referenced here */
+ mptr = calloc(1, sizeof(XF86ConfModesLinkRec));
+ mptr->list.next = NULL;
+ mptr->ml_modes_str = val.str;
+ mptr->ml_modes = NULL;
+ ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr)
+ xf86addListItem((GenericListPtr) ptr->mon_modes_sect_lst,
+ (GenericListPtr) mptr);
+ }
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ xf86parseError(INVALID_KEYWORD_MSG, xf86tokenString());
+ CLEANUP(ptr);
+ return NULL;
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Monitor section parsed\n");
+ printf("Monitor section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
#define CLEANUP xf86freeModesList
XF86ConfModesPtr
-xf86parseModesSection (void)
+xf86parseModesSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfModesPtr, XF86ConfModesRec)
-
- while ((token = xf86getToken (ModesTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->modes_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->modes_identifier = val.str;
- has_ident = TRUE;
- break;
- case MODE:
- HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
- XF86ConfModeLinePtr);
- break;
- case MODELINE:
- HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
- XF86ConfModeLinePtr);
- break;
- default:
- xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
- CLEANUP (ptr);
- return NULL;
- break;
- }
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG);
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfModesPtr, XF86ConfModesRec)
+
+ while ((token = xf86getToken(ModesTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->modes_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->modes_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case MODE:
+ HANDLE_LIST(mon_modeline_lst, xf86parseVerboseMode,
+ XF86ConfModeLinePtr);
+ break;
+ case MODELINE:
+ HANDLE_LIST(mon_modeline_lst, xf86parseModeLine,
+ XF86ConfModeLinePtr);
+ break;
+ default:
+ xf86parseError(INVALID_KEYWORD_MSG, xf86tokenString());
+ CLEANUP(ptr);
+ return NULL;
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Modes section parsed\n");
+ printf("Modes section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printMonitorSection (FILE * cf, XF86ConfMonitorPtr ptr)
+xf86printMonitorSection(FILE * cf, XF86ConfMonitorPtr ptr)
{
- int i;
- XF86ConfModeLinePtr mlptr;
- XF86ConfModesLinkPtr mptr;
-
- while (ptr)
- {
- mptr = ptr->mon_modes_sect_lst;
- fprintf (cf, "Section \"Monitor\"\n");
- if (ptr->mon_comment)
- fprintf (cf, "%s", ptr->mon_comment);
- if (ptr->mon_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->mon_identifier);
- if (ptr->mon_vendor)
- fprintf (cf, "\tVendorName \"%s\"\n", ptr->mon_vendor);
- if (ptr->mon_modelname)
- fprintf (cf, "\tModelName \"%s\"\n", ptr->mon_modelname);
- while (mptr) {
- fprintf (cf, "\tUseModes \"%s\"\n", mptr->ml_modes_str);
- mptr = mptr->list.next;
- }
- if (ptr->mon_width)
- fprintf (cf, "\tDisplaySize %d\t%d\n",
- ptr->mon_width,
- ptr->mon_height);
- for (i = 0; i < ptr->mon_n_hsync; i++)
- {
- fprintf (cf, "\tHorizSync %2.1f - %2.1f\n",
- ptr->mon_hsync[i].lo,
- ptr->mon_hsync[i].hi);
- }
- for (i = 0; i < ptr->mon_n_vrefresh; i++)
- {
- fprintf (cf, "\tVertRefresh %2.1f - %2.1f\n",
- ptr->mon_vrefresh[i].lo,
- ptr->mon_vrefresh[i].hi);
- }
- if (ptr->mon_gamma_red) {
- if (ptr->mon_gamma_red == ptr->mon_gamma_green
- && ptr->mon_gamma_red == ptr->mon_gamma_blue)
- {
- fprintf (cf, "\tGamma %.4g\n",
- ptr->mon_gamma_red);
- } else {
- fprintf (cf, "\tGamma %.4g %.4g %.4g\n",
- ptr->mon_gamma_red,
- ptr->mon_gamma_green,
- ptr->mon_gamma_blue);
- }
- }
- for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next)
- {
- fprintf (cf, "\tModeLine \"%s\" %2.1f ",
- mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
- fprintf (cf, "%d %d %d %d %d %d %d %d",
- mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
- mlptr->ml_hsyncend, mlptr->ml_htotal,
- mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
- mlptr->ml_vsyncend, mlptr->ml_vtotal);
- if (mlptr->ml_flags & XF86CONF_PHSYNC)
- fprintf (cf, " +hsync");
- if (mlptr->ml_flags & XF86CONF_NHSYNC)
- fprintf (cf, " -hsync");
- if (mlptr->ml_flags & XF86CONF_PVSYNC)
- fprintf (cf, " +vsync");
- if (mlptr->ml_flags & XF86CONF_NVSYNC)
- fprintf (cf, " -vsync");
- if (mlptr->ml_flags & XF86CONF_INTERLACE)
- fprintf (cf, " interlace");
- if (mlptr->ml_flags & XF86CONF_CSYNC)
- fprintf (cf, " composite");
- if (mlptr->ml_flags & XF86CONF_PCSYNC)
- fprintf (cf, " +csync");
- if (mlptr->ml_flags & XF86CONF_NCSYNC)
- fprintf (cf, " -csync");
- if (mlptr->ml_flags & XF86CONF_DBLSCAN)
- fprintf (cf, " doublescan");
- if (mlptr->ml_flags & XF86CONF_HSKEW)
- fprintf (cf, " hskew %d", mlptr->ml_hskew);
- if (mlptr->ml_flags & XF86CONF_BCAST)
- fprintf (cf, " bcast");
- fprintf (cf, "\n");
- }
- xf86printOptionList(cf, ptr->mon_option_lst, 1);
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ int i;
+ XF86ConfModeLinePtr mlptr;
+ XF86ConfModesLinkPtr mptr;
+
+ while (ptr) {
+ mptr = ptr->mon_modes_sect_lst;
+ fprintf(cf, "Section \"Monitor\"\n");
+ if (ptr->mon_comment)
+ fprintf(cf, "%s", ptr->mon_comment);
+ if (ptr->mon_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->mon_identifier);
+ if (ptr->mon_vendor)
+ fprintf(cf, "\tVendorName \"%s\"\n", ptr->mon_vendor);
+ if (ptr->mon_modelname)
+ fprintf(cf, "\tModelName \"%s\"\n", ptr->mon_modelname);
+ while (mptr) {
+ fprintf(cf, "\tUseModes \"%s\"\n", mptr->ml_modes_str);
+ mptr = mptr->list.next;
+ }
+ if (ptr->mon_width)
+ fprintf(cf, "\tDisplaySize %d\t%d\n",
+ ptr->mon_width, ptr->mon_height);
+ for (i = 0; i < ptr->mon_n_hsync; i++) {
+ fprintf(cf, "\tHorizSync %2.1f - %2.1f\n",
+ ptr->mon_hsync[i].lo, ptr->mon_hsync[i].hi);
+ }
+ for (i = 0; i < ptr->mon_n_vrefresh; i++) {
+ fprintf(cf, "\tVertRefresh %2.1f - %2.1f\n",
+ ptr->mon_vrefresh[i].lo, ptr->mon_vrefresh[i].hi);
+ }
+ if (ptr->mon_gamma_red) {
+ if (ptr->mon_gamma_red == ptr->mon_gamma_green
+ && ptr->mon_gamma_red == ptr->mon_gamma_blue) {
+ fprintf(cf, "\tGamma %.4g\n", ptr->mon_gamma_red);
+ }
+ else {
+ fprintf(cf, "\tGamma %.4g %.4g %.4g\n",
+ ptr->mon_gamma_red,
+ ptr->mon_gamma_green, ptr->mon_gamma_blue);
+ }
+ }
+ for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next) {
+ fprintf(cf, "\tModeLine \"%s\" %2.1f ",
+ mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
+ fprintf(cf, "%d %d %d %d %d %d %d %d",
+ mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
+ mlptr->ml_hsyncend, mlptr->ml_htotal,
+ mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
+ mlptr->ml_vsyncend, mlptr->ml_vtotal);
+ if (mlptr->ml_flags & XF86CONF_PHSYNC)
+ fprintf(cf, " +hsync");
+ if (mlptr->ml_flags & XF86CONF_NHSYNC)
+ fprintf(cf, " -hsync");
+ if (mlptr->ml_flags & XF86CONF_PVSYNC)
+ fprintf(cf, " +vsync");
+ if (mlptr->ml_flags & XF86CONF_NVSYNC)
+ fprintf(cf, " -vsync");
+ if (mlptr->ml_flags & XF86CONF_INTERLACE)
+ fprintf(cf, " interlace");
+ if (mlptr->ml_flags & XF86CONF_CSYNC)
+ fprintf(cf, " composite");
+ if (mlptr->ml_flags & XF86CONF_PCSYNC)
+ fprintf(cf, " +csync");
+ if (mlptr->ml_flags & XF86CONF_NCSYNC)
+ fprintf(cf, " -csync");
+ if (mlptr->ml_flags & XF86CONF_DBLSCAN)
+ fprintf(cf, " doublescan");
+ if (mlptr->ml_flags & XF86CONF_HSKEW)
+ fprintf(cf, " hskew %d", mlptr->ml_hskew);
+ if (mlptr->ml_flags & XF86CONF_BCAST)
+ fprintf(cf, " bcast");
+ fprintf(cf, "\n");
+ }
+ xf86printOptionList(cf, ptr->mon_option_lst, 1);
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86printModesSection (FILE * cf, XF86ConfModesPtr ptr)
+xf86printModesSection(FILE * cf, XF86ConfModesPtr ptr)
{
- XF86ConfModeLinePtr mlptr;
-
- while (ptr)
- {
- fprintf (cf, "Section \"Modes\"\n");
- if (ptr->modes_comment)
- fprintf (cf, "%s", ptr->modes_comment);
- if (ptr->modes_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->modes_identifier);
- for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next)
- {
- fprintf (cf, "\tModeLine \"%s\" %2.1f ",
- mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
- fprintf (cf, "%d %d %d %d %d %d %d %d",
- mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
- mlptr->ml_hsyncend, mlptr->ml_htotal,
- mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
- mlptr->ml_vsyncend, mlptr->ml_vtotal);
- if (mlptr->ml_flags & XF86CONF_PHSYNC)
- fprintf (cf, " +hsync");
- if (mlptr->ml_flags & XF86CONF_NHSYNC)
- fprintf (cf, " -hsync");
- if (mlptr->ml_flags & XF86CONF_PVSYNC)
- fprintf (cf, " +vsync");
- if (mlptr->ml_flags & XF86CONF_NVSYNC)
- fprintf (cf, " -vsync");
- if (mlptr->ml_flags & XF86CONF_INTERLACE)
- fprintf (cf, " interlace");
- if (mlptr->ml_flags & XF86CONF_CSYNC)
- fprintf (cf, " composite");
- if (mlptr->ml_flags & XF86CONF_PCSYNC)
- fprintf (cf, " +csync");
- if (mlptr->ml_flags & XF86CONF_NCSYNC)
- fprintf (cf, " -csync");
- if (mlptr->ml_flags & XF86CONF_DBLSCAN)
- fprintf (cf, " doublescan");
- if (mlptr->ml_flags & XF86CONF_HSKEW)
- fprintf (cf, " hskew %d", mlptr->ml_hskew);
- if (mlptr->ml_flags & XF86CONF_VSCAN)
- fprintf (cf, " vscan %d", mlptr->ml_vscan);
- if (mlptr->ml_flags & XF86CONF_BCAST)
- fprintf (cf, " bcast");
- if (mlptr->ml_comment)
- fprintf (cf, "%s", mlptr->ml_comment);
- else
- fprintf (cf, "\n");
- }
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ XF86ConfModeLinePtr mlptr;
+
+ while (ptr) {
+ fprintf(cf, "Section \"Modes\"\n");
+ if (ptr->modes_comment)
+ fprintf(cf, "%s", ptr->modes_comment);
+ if (ptr->modes_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->modes_identifier);
+ for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next) {
+ fprintf(cf, "\tModeLine \"%s\" %2.1f ",
+ mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
+ fprintf(cf, "%d %d %d %d %d %d %d %d",
+ mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
+ mlptr->ml_hsyncend, mlptr->ml_htotal,
+ mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
+ mlptr->ml_vsyncend, mlptr->ml_vtotal);
+ if (mlptr->ml_flags & XF86CONF_PHSYNC)
+ fprintf(cf, " +hsync");
+ if (mlptr->ml_flags & XF86CONF_NHSYNC)
+ fprintf(cf, " -hsync");
+ if (mlptr->ml_flags & XF86CONF_PVSYNC)
+ fprintf(cf, " +vsync");
+ if (mlptr->ml_flags & XF86CONF_NVSYNC)
+ fprintf(cf, " -vsync");
+ if (mlptr->ml_flags & XF86CONF_INTERLACE)
+ fprintf(cf, " interlace");
+ if (mlptr->ml_flags & XF86CONF_CSYNC)
+ fprintf(cf, " composite");
+ if (mlptr->ml_flags & XF86CONF_PCSYNC)
+ fprintf(cf, " +csync");
+ if (mlptr->ml_flags & XF86CONF_NCSYNC)
+ fprintf(cf, " -csync");
+ if (mlptr->ml_flags & XF86CONF_DBLSCAN)
+ fprintf(cf, " doublescan");
+ if (mlptr->ml_flags & XF86CONF_HSKEW)
+ fprintf(cf, " hskew %d", mlptr->ml_hskew);
+ if (mlptr->ml_flags & XF86CONF_VSCAN)
+ fprintf(cf, " vscan %d", mlptr->ml_vscan);
+ if (mlptr->ml_flags & XF86CONF_BCAST)
+ fprintf(cf, " bcast");
+ if (mlptr->ml_comment)
+ fprintf(cf, "%s", mlptr->ml_comment);
+ else
+ fprintf(cf, "\n");
+ }
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeMonitorList (XF86ConfMonitorPtr ptr)
+xf86freeMonitorList(XF86ConfMonitorPtr ptr)
{
- XF86ConfMonitorPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->mon_identifier);
- TestFree (ptr->mon_vendor);
- TestFree (ptr->mon_modelname);
- TestFree (ptr->mon_comment);
- xf86optionListFree (ptr->mon_option_lst);
- xf86freeModeLineList (ptr->mon_modeline_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfMonitorPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->mon_identifier);
+ TestFree(ptr->mon_vendor);
+ TestFree(ptr->mon_modelname);
+ TestFree(ptr->mon_comment);
+ xf86optionListFree(ptr->mon_option_lst);
+ xf86freeModeLineList(ptr->mon_modeline_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
void
-xf86freeModesList (XF86ConfModesPtr ptr)
+xf86freeModesList(XF86ConfModesPtr ptr)
{
- XF86ConfModesPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->modes_identifier);
- TestFree (ptr->modes_comment);
- xf86freeModeLineList (ptr->mon_modeline_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfModesPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->modes_identifier);
+ TestFree(ptr->modes_comment);
+ xf86freeModeLineList(ptr->mon_modeline_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
XF86ConfMonitorPtr
-xf86findMonitor (const char *ident, XF86ConfMonitorPtr p)
+xf86findMonitor(const char *ident, XF86ConfMonitorPtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->mon_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
+ while (p) {
+ if (xf86nameCompare(ident, p->mon_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
}
XF86ConfModesPtr
-xf86findModes (const char *ident, XF86ConfModesPtr p)
+xf86findModes(const char *ident, XF86ConfModesPtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->modes_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
+ while (p) {
+ if (xf86nameCompare(ident, p->modes_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
}
XF86ConfModeLinePtr
-xf86findModeLine (const char *ident, XF86ConfModeLinePtr p)
+xf86findModeLine(const char *ident, XF86ConfModeLinePtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->ml_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
+ while (p) {
+ if (xf86nameCompare(ident, p->ml_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
}
int
-xf86validateMonitor (XF86ConfigPtr p, XF86ConfScreenPtr screen)
+xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen)
{
- XF86ConfMonitorPtr monitor = screen->scrn_monitor;
- XF86ConfModesLinkPtr modeslnk = monitor->mon_modes_sect_lst;
- XF86ConfModesPtr modes;
- while(modeslnk)
- {
- modes = xf86findModes (modeslnk->ml_modes_str, p->conf_modes_lst);
- if (!modes)
- {
- xf86validationError (UNDEFINED_MODES_MSG,
- modeslnk->ml_modes_str,
- screen->scrn_identifier);
- return FALSE;
- }
- modeslnk->ml_modes = modes;
- modeslnk = modeslnk->list.next;
- }
- return TRUE;
+ XF86ConfMonitorPtr monitor = screen->scrn_monitor;
+ XF86ConfModesLinkPtr modeslnk = monitor->mon_modes_sect_lst;
+ XF86ConfModesPtr modes;
+
+ while (modeslnk) {
+ modes = xf86findModes(modeslnk->ml_modes_str, p->conf_modes_lst);
+ if (!modes) {
+ xf86validationError(UNDEFINED_MODES_MSG,
+ modeslnk->ml_modes_str,
+ screen->scrn_identifier);
+ return FALSE;
+ }
+ modeslnk->ml_modes = modes;
+ modeslnk = modeslnk->list.next;
+ }
+ return TRUE;
}
diff --git a/xorg-server/hw/xfree86/parser/Pointer.c b/xorg-server/hw/xfree86/parser/Pointer.c
index 4edbf74d9..cdbc09c1a 100644
--- a/xorg-server/hw/xfree86/parser/Pointer.c
+++ b/xorg-server/hw/xfree86/parser/Pointer.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -66,168 +65,161 @@
extern LexRec val;
-static xf86ConfigSymTabRec PointerTab[] =
-{
- {PROTOCOL, "protocol"},
- {EMULATE3, "emulate3buttons"},
- {EM3TIMEOUT, "emulate3timeout"},
- {ENDSUBSECTION, "endsubsection"},
- {ENDSECTION, "endsection"},
- {PDEVICE, "device"},
- {PDEVICE, "port"},
- {BAUDRATE, "baudrate"},
- {SAMPLERATE, "samplerate"},
- {CLEARDTR, "cleardtr"},
- {CLEARRTS, "clearrts"},
- {CHORDMIDDLE, "chordmiddle"},
- {PRESOLUTION, "resolution"},
- {DEVICE_NAME, "devicename"},
- {ALWAYSCORE, "alwayscore"},
- {PBUTTONS, "buttons"},
- {ZAXISMAPPING, "zaxismapping"},
- {-1, ""},
+static xf86ConfigSymTabRec PointerTab[] = {
+ {PROTOCOL, "protocol"},
+ {EMULATE3, "emulate3buttons"},
+ {EM3TIMEOUT, "emulate3timeout"},
+ {ENDSUBSECTION, "endsubsection"},
+ {ENDSECTION, "endsection"},
+ {PDEVICE, "device"},
+ {PDEVICE, "port"},
+ {BAUDRATE, "baudrate"},
+ {SAMPLERATE, "samplerate"},
+ {CLEARDTR, "cleardtr"},
+ {CLEARRTS, "clearrts"},
+ {CHORDMIDDLE, "chordmiddle"},
+ {PRESOLUTION, "resolution"},
+ {DEVICE_NAME, "devicename"},
+ {ALWAYSCORE, "alwayscore"},
+ {PBUTTONS, "buttons"},
+ {ZAXISMAPPING, "zaxismapping"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec ZMapTab[] =
-{
- {XAXIS, "x"},
- {YAXIS, "y"},
- {-1, ""},
+static xf86ConfigSymTabRec ZMapTab[] = {
+ {XAXIS, "x"},
+ {YAXIS, "y"},
+ {-1, ""},
};
#define CLEANUP xf86freeInputList
XF86ConfInputPtr
-xf86parsePointerSection (void)
+xf86parsePointerSection(void)
{
- char *s;
- unsigned long val1;
- int token;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
+ char *s;
+ unsigned long val1;
+ int token;
- while ((token = xf86getToken (PointerTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
- break;
- case PROTOCOL:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Protocol");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Protocol"),
- val.str);
- break;
- case PDEVICE:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Device");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Device"),
- val.str);
- break;
- case EMULATE3:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Emulate3Buttons"),
- NULL);
- break;
- case EM3TIMEOUT:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Emulate3Timeout");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Emulate3Timeout"),
- s);
- break;
- case CHORDMIDDLE:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ChordMiddle"),
- NULL);
- break;
- case PBUTTONS:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Buttons");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Buttons"), s);
- break;
- case BAUDRATE:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "BaudRate");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("BaudRate"), s);
- break;
- case SAMPLERATE:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "SampleRate");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("SampleRate"), s);
- break;
- case PRESOLUTION:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Resolution");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Resolution"), s);
- break;
- case CLEARDTR:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ClearDTR"), NULL);
- break;
- case CLEARRTS:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ClearRTS"), NULL);
- break;
- case ZAXISMAPPING:
- switch (xf86getToken(ZMapTab)) {
- case NUMBER:
- if (val.num < 0)
- Error (ZAXISMAPPING_MSG);
- val1 = val.num;
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
- Error (ZAXISMAPPING_MSG);
- }
- if (asprintf(&s, "%lu %u", val1, val.num) == -1)
- s = NULL;
- break;
- case XAXIS:
- s = strdup("x");
- break;
- case YAXIS:
- s = strdup("y");
- break;
- default:
- Error (ZAXISMAPPING_MSG);
- break;
- }
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ZAxisMapping"),
- s);
- break;
- case ALWAYSCORE:
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ parsePrologue(XF86ConfInputPtr, XF86ConfInputRec)
- ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER);
- ptr->inp_driver = strdup("mouse");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("CorePointer"), NULL);
+ while ((token = xf86getToken(PointerTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
+ break;
+ case PROTOCOL:
+ if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
+ Error(QUOTE_MSG, "Protocol");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Protocol"), val.str);
+ break;
+ case PDEVICE:
+ if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
+ Error(QUOTE_MSG, "Device");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Device"), val.str);
+ break;
+ case EMULATE3:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Emulate3Buttons"),
+ NULL);
+ break;
+ case EM3TIMEOUT:
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error(POSITIVE_INT_MSG, "Emulate3Timeout");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Emulate3Timeout"),
+ s);
+ break;
+ case CHORDMIDDLE:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ChordMiddle"), NULL);
+ break;
+ case PBUTTONS:
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error(POSITIVE_INT_MSG, "Buttons");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Buttons"), s);
+ break;
+ case BAUDRATE:
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error(POSITIVE_INT_MSG, "BaudRate");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("BaudRate"), s);
+ break;
+ case SAMPLERATE:
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error(POSITIVE_INT_MSG, "SampleRate");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("SampleRate"), s);
+ break;
+ case PRESOLUTION:
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error(POSITIVE_INT_MSG, "Resolution");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Resolution"), s);
+ break;
+ case CLEARDTR:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ClearDTR"), NULL);
+ break;
+ case CLEARRTS:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ClearRTS"), NULL);
+ break;
+ case ZAXISMAPPING:
+ switch (xf86getToken(ZMapTab)) {
+ case NUMBER:
+ if (val.num < 0)
+ Error(ZAXISMAPPING_MSG);
+ val1 = val.num;
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER ||
+ val.num < 0) {
+ Error(ZAXISMAPPING_MSG);
+ }
+ if (asprintf(&s, "%lu %u", val1, val.num) == -1)
+ s = NULL;
+ break;
+ case XAXIS:
+ s = strdup("x");
+ break;
+ case YAXIS:
+ s = strdup("y");
+ break;
+ default:
+ Error(ZAXISMAPPING_MSG);
+ break;
+ }
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ZAxisMapping"), s);
+ break;
+ case ALWAYSCORE:
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
+
+ ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER);
+ ptr->inp_driver = strdup("mouse");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("CorePointer"), NULL);
#ifdef DEBUG
- printf ("Pointer section parsed\n");
+ printf("Pointer section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
-
diff --git a/xorg-server/hw/xfree86/parser/Screen.c b/xorg-server/hw/xfree86/parser/Screen.c
index 2ca2c570d..71778d88d 100644
--- a/xorg-server/hw/xfree86/parser/Screen.c
+++ b/xorg-server/hw/xfree86/parser/Screen.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,505 +64,480 @@
extern LexRec val;
-static xf86ConfigSymTabRec DisplayTab[] =
-{
- {ENDSUBSECTION, "endsubsection"},
- {MODES, "modes"},
- {VIEWPORT, "viewport"},
- {VIRTUAL, "virtual"},
- {VISUAL, "visual"},
- {BLACK_TOK, "black"},
- {WHITE_TOK, "white"},
- {DEPTH, "depth"},
- {BPP, "fbbpp"},
- {WEIGHT, "weight"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec DisplayTab[] = {
+ {ENDSUBSECTION, "endsubsection"},
+ {MODES, "modes"},
+ {VIEWPORT, "viewport"},
+ {VIRTUAL, "virtual"},
+ {VISUAL, "visual"},
+ {BLACK_TOK, "black"},
+ {WHITE_TOK, "white"},
+ {DEPTH, "depth"},
+ {BPP, "fbbpp"},
+ {WEIGHT, "weight"},
+ {OPTION, "option"},
+ {-1, ""},
};
#define CLEANUP xf86freeDisplayList
static XF86ConfDisplayPtr
-xf86parseDisplaySubSection (void)
+xf86parseDisplaySubSection(void)
{
- int token;
- parsePrologue (XF86ConfDisplayPtr, XF86ConfDisplayRec)
-
- ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1;
- ptr->disp_white.red = ptr->disp_white.green = ptr->disp_white.blue = -1;
- ptr->disp_frameX0 = ptr->disp_frameY0 = -1;
- while ((token = xf86getToken (DisplayTab)) != ENDSUBSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->disp_comment = xf86addComment(ptr->disp_comment, val.str);
- break;
- case VIEWPORT:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (VIEWPORT_MSG);
- ptr->disp_frameX0 = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (VIEWPORT_MSG);
- ptr->disp_frameY0 = val.num;
- break;
- case VIRTUAL:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (VIRTUAL_MSG);
- ptr->disp_virtualX = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (VIRTUAL_MSG);
- ptr->disp_virtualY = val.num;
- break;
- case DEPTH:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (NUMBER_MSG, "Display");
- ptr->disp_depth = val.num;
- break;
- case BPP:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (NUMBER_MSG, "Display");
- ptr->disp_bpp = val.num;
- break;
- case VISUAL:
- if (xf86getSubToken (&(ptr->disp_comment)) != STRING)
- Error (QUOTE_MSG, "Display");
- ptr->disp_visual = val.str;
- break;
- case WEIGHT:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WEIGHT_MSG);
- ptr->disp_weight.red = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WEIGHT_MSG);
- ptr->disp_weight.green = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WEIGHT_MSG);
- ptr->disp_weight.blue = val.num;
- break;
- case BLACK_TOK:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (BLACK_MSG);
- ptr->disp_black.red = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (BLACK_MSG);
- ptr->disp_black.green = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (BLACK_MSG);
- ptr->disp_black.blue = val.num;
- break;
- case WHITE_TOK:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WHITE_MSG);
- ptr->disp_white.red = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WHITE_MSG);
- ptr->disp_white.green = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WHITE_MSG);
- ptr->disp_white.blue = val.num;
- break;
- case MODES:
- {
- XF86ModePtr mptr;
-
- while ((token = xf86getSubTokenWithTab (&(ptr->disp_comment), DisplayTab)) == STRING)
- {
- mptr = calloc (1, sizeof (XF86ModeRec));
- mptr->mode_name = val.str;
- mptr->list.next = NULL;
- ptr->disp_mode_lst = (XF86ModePtr)
- xf86addListItem ((glp) ptr->disp_mode_lst, (glp) mptr);
- }
- xf86unGetToken (token);
- }
- break;
- case OPTION:
- ptr->disp_option_lst = xf86parseOption(ptr->disp_option_lst);
- break;
-
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ int token;
+
+ parsePrologue(XF86ConfDisplayPtr, XF86ConfDisplayRec)
+
+ ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1;
+ ptr->disp_white.red = ptr->disp_white.green = ptr->disp_white.blue = -1;
+ ptr->disp_frameX0 = ptr->disp_frameY0 = -1;
+ while ((token = xf86getToken(DisplayTab)) != ENDSUBSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->disp_comment = xf86addComment(ptr->disp_comment, val.str);
+ break;
+ case VIEWPORT:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(VIEWPORT_MSG);
+ ptr->disp_frameX0 = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(VIEWPORT_MSG);
+ ptr->disp_frameY0 = val.num;
+ break;
+ case VIRTUAL:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(VIRTUAL_MSG);
+ ptr->disp_virtualX = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(VIRTUAL_MSG);
+ ptr->disp_virtualY = val.num;
+ break;
+ case DEPTH:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Display");
+ ptr->disp_depth = val.num;
+ break;
+ case BPP:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Display");
+ ptr->disp_bpp = val.num;
+ break;
+ case VISUAL:
+ if (xf86getSubToken(&(ptr->disp_comment)) != STRING)
+ Error(QUOTE_MSG, "Display");
+ ptr->disp_visual = val.str;
+ break;
+ case WEIGHT:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WEIGHT_MSG);
+ ptr->disp_weight.red = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WEIGHT_MSG);
+ ptr->disp_weight.green = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WEIGHT_MSG);
+ ptr->disp_weight.blue = val.num;
+ break;
+ case BLACK_TOK:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(BLACK_MSG);
+ ptr->disp_black.red = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(BLACK_MSG);
+ ptr->disp_black.green = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(BLACK_MSG);
+ ptr->disp_black.blue = val.num;
+ break;
+ case WHITE_TOK:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WHITE_MSG);
+ ptr->disp_white.red = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WHITE_MSG);
+ ptr->disp_white.green = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WHITE_MSG);
+ ptr->disp_white.blue = val.num;
+ break;
+ case MODES:
+ {
+ XF86ModePtr mptr;
+
+ while ((token =
+ xf86getSubTokenWithTab(&(ptr->disp_comment),
+ DisplayTab)) == STRING) {
+ mptr = calloc(1, sizeof(XF86ModeRec));
+ mptr->mode_name = val.str;
+ mptr->list.next = NULL;
+ ptr->disp_mode_lst = (XF86ModePtr)
+ xf86addListItem((glp) ptr->disp_mode_lst, (glp) mptr);
+ }
+ xf86unGetToken(token);
+ }
+ break;
+ case OPTION:
+ ptr->disp_option_lst = xf86parseOption(ptr->disp_option_lst);
+ break;
+
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("Display subsection parsed\n");
+ printf("Display subsection parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
-static xf86ConfigSymTabRec ScreenTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {OBSDRIVER, "driver"},
- {MDEVICE, "device"},
- {MONITOR, "monitor"},
- {VIDEOADAPTOR, "videoadaptor"},
- {SCREENNO, "screenno"},
- {SUBSECTION, "subsection"},
- {DEFAULTDEPTH, "defaultcolordepth"},
- {DEFAULTDEPTH, "defaultdepth"},
- {DEFAULTBPP, "defaultbpp"},
- {DEFAULTFBBPP, "defaultfbbpp"},
- {VIRTUAL, "virtual"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec ScreenTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OBSDRIVER, "driver"},
+ {MDEVICE, "device"},
+ {MONITOR, "monitor"},
+ {VIDEOADAPTOR, "videoadaptor"},
+ {SCREENNO, "screenno"},
+ {SUBSECTION, "subsection"},
+ {DEFAULTDEPTH, "defaultcolordepth"},
+ {DEFAULTDEPTH, "defaultdepth"},
+ {DEFAULTBPP, "defaultbpp"},
+ {DEFAULTFBBPP, "defaultfbbpp"},
+ {VIRTUAL, "virtual"},
+ {OPTION, "option"},
+ {-1, ""},
};
#define CLEANUP xf86freeScreenList
XF86ConfScreenPtr
-xf86parseScreenSection (void)
+xf86parseScreenSection(void)
{
- int has_ident = FALSE;
- int has_driver= FALSE;
- int token;
-
- parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
-
- while ((token = xf86getToken (ScreenTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->scrn_comment = xf86addComment(ptr->scrn_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- ptr->scrn_identifier = val.str;
- if (has_ident || has_driver)
- Error (ONLY_ONE_MSG,"Identifier or Driver");
- has_ident = TRUE;
- break;
- case OBSDRIVER:
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "Driver");
- ptr->scrn_obso_driver = val.str;
- if (has_ident || has_driver)
- Error (ONLY_ONE_MSG,"Identifier or Driver");
- has_driver = TRUE;
- break;
- case DEFAULTDEPTH:
- if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
- Error (NUMBER_MSG, "DefaultDepth");
- ptr->scrn_defaultdepth = val.num;
- break;
- case DEFAULTBPP:
- if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
- Error (NUMBER_MSG, "DefaultBPP");
- ptr->scrn_defaultbpp = val.num;
- break;
- case DEFAULTFBBPP:
- if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
- Error (NUMBER_MSG, "DefaultFbBPP");
- ptr->scrn_defaultfbbpp = val.num;
- break;
- case MDEVICE:
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "Device");
- ptr->scrn_device_str = val.str;
- break;
- case MONITOR:
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "Monitor");
- ptr->scrn_monitor_str = val.str;
- break;
- case VIDEOADAPTOR:
- {
- XF86ConfAdaptorLinkPtr aptr;
-
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "VideoAdaptor");
-
- /* Don't allow duplicates */
- for (aptr = ptr->scrn_adaptor_lst; aptr;
- aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next)
- if (xf86nameCompare (val.str, aptr->al_adaptor_str) == 0)
- break;
-
- if (aptr == NULL)
- {
- aptr = calloc (1, sizeof (XF86ConfAdaptorLinkRec));
- aptr->list.next = NULL;
- aptr->al_adaptor_str = val.str;
- ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr)
- xf86addListItem ((glp) ptr->scrn_adaptor_lst, (glp) aptr);
- }
- }
- break;
- case VIRTUAL:
- if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
- Error (VIRTUAL_MSG);
- ptr->scrn_virtualX = val.num;
- if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
- Error (VIRTUAL_MSG);
- ptr->scrn_virtualY = val.num;
- break;
- case OPTION:
- ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst);
- break;
- case SUBSECTION:
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "SubSection");
- {
- free(val.str);
- HANDLE_LIST (scrn_display_lst, xf86parseDisplaySubSection,
- XF86ConfDisplayPtr);
- }
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- if (!has_ident && !has_driver)
- Error (NO_IDENT_MSG);
+ int has_ident = FALSE;
+ int has_driver = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec)
+
+ while ((token = xf86getToken(ScreenTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->scrn_comment = xf86addComment(ptr->scrn_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ ptr->scrn_identifier = val.str;
+ if (has_ident || has_driver)
+ Error(ONLY_ONE_MSG, "Identifier or Driver");
+ has_ident = TRUE;
+ break;
+ case OBSDRIVER:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "Driver");
+ ptr->scrn_obso_driver = val.str;
+ if (has_ident || has_driver)
+ Error(ONLY_ONE_MSG, "Identifier or Driver");
+ has_driver = TRUE;
+ break;
+ case DEFAULTDEPTH:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
+ Error(NUMBER_MSG, "DefaultDepth");
+ ptr->scrn_defaultdepth = val.num;
+ break;
+ case DEFAULTBPP:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
+ Error(NUMBER_MSG, "DefaultBPP");
+ ptr->scrn_defaultbpp = val.num;
+ break;
+ case DEFAULTFBBPP:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
+ Error(NUMBER_MSG, "DefaultFbBPP");
+ ptr->scrn_defaultfbbpp = val.num;
+ break;
+ case MDEVICE:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "Device");
+ ptr->scrn_device_str = val.str;
+ break;
+ case MONITOR:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "Monitor");
+ ptr->scrn_monitor_str = val.str;
+ break;
+ case VIDEOADAPTOR:
+ {
+ XF86ConfAdaptorLinkPtr aptr;
+
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "VideoAdaptor");
+
+ /* Don't allow duplicates */
+ for (aptr = ptr->scrn_adaptor_lst; aptr;
+ aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next)
+ if (xf86nameCompare(val.str, aptr->al_adaptor_str) == 0)
+ break;
+
+ if (aptr == NULL) {
+ aptr = calloc(1, sizeof(XF86ConfAdaptorLinkRec));
+ aptr->list.next = NULL;
+ aptr->al_adaptor_str = val.str;
+ ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr)
+ xf86addListItem((glp) ptr->scrn_adaptor_lst, (glp) aptr);
+ }
+ }
+ break;
+ case VIRTUAL:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
+ Error(VIRTUAL_MSG);
+ ptr->scrn_virtualX = val.num;
+ if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
+ Error(VIRTUAL_MSG);
+ ptr->scrn_virtualY = val.num;
+ break;
+ case OPTION:
+ ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "SubSection");
+ {
+ free(val.str);
+ HANDLE_LIST(scrn_display_lst, xf86parseDisplaySubSection,
+ XF86ConfDisplayPtr);
+ }
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
+
+ if (!has_ident && !has_driver)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Screen section parsed\n");
+ printf("Screen section parsed\n");
#endif
- return ptr;
+ return ptr;
}
void
-xf86printScreenSection (FILE * cf, XF86ConfScreenPtr ptr)
+xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr)
{
- XF86ConfAdaptorLinkPtr aptr;
- XF86ConfDisplayPtr dptr;
- XF86ModePtr mptr;
-
- while (ptr)
- {
- fprintf (cf, "Section \"Screen\"\n");
- if (ptr->scrn_comment)
- fprintf (cf, "%s", ptr->scrn_comment);
- if (ptr->scrn_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->scrn_identifier);
- if (ptr->scrn_obso_driver)
- fprintf (cf, "\tDriver \"%s\"\n", ptr->scrn_obso_driver);
- if (ptr->scrn_device_str)
- fprintf (cf, "\tDevice \"%s\"\n", ptr->scrn_device_str);
- if (ptr->scrn_monitor_str)
- fprintf (cf, "\tMonitor \"%s\"\n", ptr->scrn_monitor_str);
- if (ptr->scrn_defaultdepth)
- fprintf (cf, "\tDefaultDepth %d\n",
- ptr->scrn_defaultdepth);
- if (ptr->scrn_defaultbpp)
- fprintf (cf, "\tDefaultBPP %d\n",
- ptr->scrn_defaultbpp);
- if (ptr->scrn_defaultfbbpp)
- fprintf (cf, "\tDefaultFbBPP %d\n",
- ptr->scrn_defaultfbbpp);
- xf86printOptionList(cf, ptr->scrn_option_lst, 1);
- for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = aptr->list.next)
- {
- fprintf (cf, "\tVideoAdaptor \"%s\"\n", aptr->al_adaptor_str);
- }
- if (ptr->scrn_virtualX && ptr->scrn_virtualY)
- fprintf (cf, "\tVirtual %d %d\n",
- ptr->scrn_virtualX,
- ptr->scrn_virtualY);
- for (dptr = ptr->scrn_display_lst; dptr; dptr = dptr->list.next)
- {
- fprintf (cf, "\tSubSection \"Display\"\n");
- if (dptr->disp_comment)
- fprintf (cf, "%s", dptr->disp_comment);
- if (dptr->disp_frameX0 >= 0 || dptr->disp_frameY0 >= 0)
- {
- fprintf (cf, "\t\tViewport %d %d\n",
- dptr->disp_frameX0, dptr->disp_frameY0);
- }
- if (dptr->disp_virtualX != 0 || dptr->disp_virtualY != 0)
- {
- fprintf (cf, "\t\tVirtual %d %d\n",
- dptr->disp_virtualX, dptr->disp_virtualY);
- }
- if (dptr->disp_depth)
- {
- fprintf (cf, "\t\tDepth %d\n", dptr->disp_depth);
- }
- if (dptr->disp_bpp)
- {
- fprintf (cf, "\t\tFbBPP %d\n", dptr->disp_bpp);
- }
- if (dptr->disp_visual)
- {
- fprintf (cf, "\t\tVisual \"%s\"\n", dptr->disp_visual);
- }
- if (dptr->disp_weight.red != 0)
- {
- fprintf (cf, "\t\tWeight %d %d %d\n",
- dptr->disp_weight.red, dptr->disp_weight.green, dptr->disp_weight.blue);
- }
- if (dptr->disp_black.red != -1)
- {
- fprintf (cf, "\t\tBlack 0x%04x 0x%04x 0x%04x\n",
- dptr->disp_black.red, dptr->disp_black.green, dptr->disp_black.blue);
- }
- if (dptr->disp_white.red != -1)
- {
- fprintf (cf, "\t\tWhite 0x%04x 0x%04x 0x%04x\n",
- dptr->disp_white.red, dptr->disp_white.green, dptr->disp_white.blue);
- }
- if (dptr->disp_mode_lst)
- {
- fprintf (cf, "\t\tModes ");
- }
- for (mptr = dptr->disp_mode_lst; mptr; mptr = mptr->list.next)
- {
- fprintf (cf, " \"%s\"", mptr->mode_name);
- }
- if (dptr->disp_mode_lst)
- {
- fprintf (cf, "\n");
- }
- xf86printOptionList(cf, dptr->disp_option_lst, 2);
- fprintf (cf, "\tEndSubSection\n");
- }
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ XF86ConfAdaptorLinkPtr aptr;
+ XF86ConfDisplayPtr dptr;
+ XF86ModePtr mptr;
+
+ while (ptr) {
+ fprintf(cf, "Section \"Screen\"\n");
+ if (ptr->scrn_comment)
+ fprintf(cf, "%s", ptr->scrn_comment);
+ if (ptr->scrn_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->scrn_identifier);
+ if (ptr->scrn_obso_driver)
+ fprintf(cf, "\tDriver \"%s\"\n", ptr->scrn_obso_driver);
+ if (ptr->scrn_device_str)
+ fprintf(cf, "\tDevice \"%s\"\n", ptr->scrn_device_str);
+ if (ptr->scrn_monitor_str)
+ fprintf(cf, "\tMonitor \"%s\"\n", ptr->scrn_monitor_str);
+ if (ptr->scrn_defaultdepth)
+ fprintf(cf, "\tDefaultDepth %d\n", ptr->scrn_defaultdepth);
+ if (ptr->scrn_defaultbpp)
+ fprintf(cf, "\tDefaultBPP %d\n", ptr->scrn_defaultbpp);
+ if (ptr->scrn_defaultfbbpp)
+ fprintf(cf, "\tDefaultFbBPP %d\n", ptr->scrn_defaultfbbpp);
+ xf86printOptionList(cf, ptr->scrn_option_lst, 1);
+ for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = aptr->list.next) {
+ fprintf(cf, "\tVideoAdaptor \"%s\"\n", aptr->al_adaptor_str);
+ }
+ if (ptr->scrn_virtualX && ptr->scrn_virtualY)
+ fprintf(cf, "\tVirtual %d %d\n",
+ ptr->scrn_virtualX, ptr->scrn_virtualY);
+ for (dptr = ptr->scrn_display_lst; dptr; dptr = dptr->list.next) {
+ fprintf(cf, "\tSubSection \"Display\"\n");
+ if (dptr->disp_comment)
+ fprintf(cf, "%s", dptr->disp_comment);
+ if (dptr->disp_frameX0 >= 0 || dptr->disp_frameY0 >= 0) {
+ fprintf(cf, "\t\tViewport %d %d\n",
+ dptr->disp_frameX0, dptr->disp_frameY0);
+ }
+ if (dptr->disp_virtualX != 0 || dptr->disp_virtualY != 0) {
+ fprintf(cf, "\t\tVirtual %d %d\n",
+ dptr->disp_virtualX, dptr->disp_virtualY);
+ }
+ if (dptr->disp_depth) {
+ fprintf(cf, "\t\tDepth %d\n", dptr->disp_depth);
+ }
+ if (dptr->disp_bpp) {
+ fprintf(cf, "\t\tFbBPP %d\n", dptr->disp_bpp);
+ }
+ if (dptr->disp_visual) {
+ fprintf(cf, "\t\tVisual \"%s\"\n", dptr->disp_visual);
+ }
+ if (dptr->disp_weight.red != 0) {
+ fprintf(cf, "\t\tWeight %d %d %d\n",
+ dptr->disp_weight.red, dptr->disp_weight.green,
+ dptr->disp_weight.blue);
+ }
+ if (dptr->disp_black.red != -1) {
+ fprintf(cf, "\t\tBlack 0x%04x 0x%04x 0x%04x\n",
+ dptr->disp_black.red, dptr->disp_black.green,
+ dptr->disp_black.blue);
+ }
+ if (dptr->disp_white.red != -1) {
+ fprintf(cf, "\t\tWhite 0x%04x 0x%04x 0x%04x\n",
+ dptr->disp_white.red, dptr->disp_white.green,
+ dptr->disp_white.blue);
+ }
+ if (dptr->disp_mode_lst) {
+ fprintf(cf, "\t\tModes ");
+ }
+ for (mptr = dptr->disp_mode_lst; mptr; mptr = mptr->list.next) {
+ fprintf(cf, " \"%s\"", mptr->mode_name);
+ }
+ if (dptr->disp_mode_lst) {
+ fprintf(cf, "\n");
+ }
+ xf86printOptionList(cf, dptr->disp_option_lst, 2);
+ fprintf(cf, "\tEndSubSection\n");
+ }
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeScreenList (XF86ConfScreenPtr ptr)
+xf86freeScreenList(XF86ConfScreenPtr ptr)
{
- XF86ConfScreenPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->scrn_identifier);
- TestFree (ptr->scrn_monitor_str);
- TestFree (ptr->scrn_device_str);
- TestFree (ptr->scrn_comment);
- xf86optionListFree (ptr->scrn_option_lst);
- xf86freeAdaptorLinkList (ptr->scrn_adaptor_lst);
- xf86freeDisplayList (ptr->scrn_display_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfScreenPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->scrn_identifier);
+ TestFree(ptr->scrn_monitor_str);
+ TestFree(ptr->scrn_device_str);
+ TestFree(ptr->scrn_comment);
+ xf86optionListFree(ptr->scrn_option_lst);
+ xf86freeAdaptorLinkList(ptr->scrn_adaptor_lst);
+ xf86freeDisplayList(ptr->scrn_display_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
void
-xf86freeAdaptorLinkList (XF86ConfAdaptorLinkPtr ptr)
+xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr)
{
- XF86ConfAdaptorLinkPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->al_adaptor_str);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfAdaptorLinkPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->al_adaptor_str);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
void
-xf86freeDisplayList (XF86ConfDisplayPtr ptr)
+xf86freeDisplayList(XF86ConfDisplayPtr ptr)
{
- XF86ConfDisplayPtr prev;
-
- while (ptr)
- {
- xf86freeModeList (ptr->disp_mode_lst);
- xf86optionListFree (ptr->disp_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfDisplayPtr prev;
+
+ while (ptr) {
+ xf86freeModeList(ptr->disp_mode_lst);
+ xf86optionListFree(ptr->disp_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
void
-xf86freeModeList (XF86ModePtr ptr)
+xf86freeModeList(XF86ModePtr ptr)
{
- XF86ModePtr prev;
-
- while (ptr)
- {
- TestFree (ptr->mode_name);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ModePtr prev;
+
+ while (ptr) {
+ TestFree(ptr->mode_name);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
int
-xf86validateScreen (XF86ConfigPtr p)
+xf86validateScreen(XF86ConfigPtr p)
{
- XF86ConfScreenPtr screen = p->conf_screen_lst;
- XF86ConfMonitorPtr monitor;
- XF86ConfAdaptorLinkPtr adaptor;
-
- while (screen)
- {
- if (screen->scrn_obso_driver && !screen->scrn_identifier)
- screen->scrn_identifier = screen->scrn_obso_driver;
-
- monitor = xf86findMonitor (screen->scrn_monitor_str, p->conf_monitor_lst);
- if (screen->scrn_monitor_str)
- {
- if (monitor)
- {
- screen->scrn_monitor = monitor;
- if (!xf86validateMonitor(p, screen))
- return FALSE;
- }
- }
-
- screen->scrn_device= xf86findDevice (screen->scrn_device_str, p->conf_device_lst);
-
- adaptor = screen->scrn_adaptor_lst;
- while (adaptor)
- {
- adaptor->al_adaptor = xf86findVideoAdaptor (adaptor->al_adaptor_str, p->conf_videoadaptor_lst);
- if (!adaptor->al_adaptor)
- {
- xf86validationError (UNDEFINED_ADAPTOR_MSG, adaptor->al_adaptor_str, screen->scrn_identifier);
- return FALSE;
- }
- else if (adaptor->al_adaptor->va_fwdref)
- {
- xf86validationError (ADAPTOR_REF_TWICE_MSG, adaptor->al_adaptor_str,
- adaptor->al_adaptor->va_fwdref);
- return FALSE;
- }
-
- adaptor->al_adaptor->va_fwdref = strdup(screen->scrn_identifier);
- adaptor = adaptor->list.next;
- }
-
- screen = screen->list.next;
- }
-
- return TRUE;
+ XF86ConfScreenPtr screen = p->conf_screen_lst;
+ XF86ConfMonitorPtr monitor;
+ XF86ConfAdaptorLinkPtr adaptor;
+
+ while (screen) {
+ if (screen->scrn_obso_driver && !screen->scrn_identifier)
+ screen->scrn_identifier = screen->scrn_obso_driver;
+
+ monitor =
+ xf86findMonitor(screen->scrn_monitor_str, p->conf_monitor_lst);
+ if (screen->scrn_monitor_str) {
+ if (monitor) {
+ screen->scrn_monitor = monitor;
+ if (!xf86validateMonitor(p, screen))
+ return FALSE;
+ }
+ }
+
+ screen->scrn_device =
+ xf86findDevice(screen->scrn_device_str, p->conf_device_lst);
+
+ adaptor = screen->scrn_adaptor_lst;
+ while (adaptor) {
+ adaptor->al_adaptor =
+ xf86findVideoAdaptor(adaptor->al_adaptor_str,
+ p->conf_videoadaptor_lst);
+ if (!adaptor->al_adaptor) {
+ xf86validationError(UNDEFINED_ADAPTOR_MSG,
+ adaptor->al_adaptor_str,
+ screen->scrn_identifier);
+ return FALSE;
+ }
+ else if (adaptor->al_adaptor->va_fwdref) {
+ xf86validationError(ADAPTOR_REF_TWICE_MSG,
+ adaptor->al_adaptor_str,
+ adaptor->al_adaptor->va_fwdref);
+ return FALSE;
+ }
+
+ adaptor->al_adaptor->va_fwdref = strdup(screen->scrn_identifier);
+ adaptor = adaptor->list.next;
+ }
+
+ screen = screen->list.next;
+ }
+
+ return TRUE;
}
XF86ConfScreenPtr
-xf86findScreen (const char *ident, XF86ConfScreenPtr p)
+xf86findScreen(const char *ident, XF86ConfScreenPtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->scrn_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
+ while (p) {
+ if (xf86nameCompare(ident, p->scrn_identifier) == 0)
+ return p;
+ p = p->list.next;
+ }
+ return NULL;
+}
diff --git a/xorg-server/hw/xfree86/parser/Vendor.c b/xorg-server/hw/xfree86/parser/Vendor.c
index d61f0a052..b4e2165b0 100644
--- a/xorg-server/hw/xfree86/parser/Vendor.c
+++ b/xorg-server/hw/xfree86/parser/Vendor.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,180 +64,173 @@
extern LexRec val;
-static xf86ConfigSymTabRec VendorSubTab[] =
-{
- {ENDSUBSECTION, "endsubsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec VendorSubTab[] = {
+ {ENDSUBSECTION, "endsubsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {-1, ""},
};
#define CLEANUP xf86freeVendorSubList
static XF86ConfVendSubPtr
-xf86parseVendorSubSection (void)
+xf86parseVendorSubSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfVendSubPtr, XF86ConfVendSubRec)
-
- while ((token = xf86getToken (VendorSubTab)) != ENDSUBSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->vs_comment = xf86addComment(ptr->vs_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->vs_comment)))
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->vs_identifier = val.str;
- has_ident = TRUE;
- break;
- case OPTION:
- ptr->vs_option_lst = xf86parseOption(ptr->vs_option_lst);
- break;
-
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfVendSubPtr, XF86ConfVendSubRec)
+
+ while ((token = xf86getToken(VendorSubTab)) != ENDSUBSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->vs_comment = xf86addComment(ptr->vs_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->vs_comment)))
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->vs_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case OPTION:
+ ptr->vs_option_lst = xf86parseOption(ptr->vs_option_lst);
+ break;
+
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("Vendor subsection parsed\n");
+ printf("Vendor subsection parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
-static xf86ConfigSymTabRec VendorTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {SUBSECTION, "subsection"},
- {-1, ""},
+static xf86ConfigSymTabRec VendorTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {SUBSECTION, "subsection"},
+ {-1, ""},
};
#define CLEANUP xf86freeVendorList
XF86ConfVendorPtr
-xf86parseVendorSection (void)
+xf86parseVendorSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfVendorPtr, XF86ConfVendorRec)
-
- while ((token = xf86getToken (VendorTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->vnd_comment = xf86addComment(ptr->vnd_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->vnd_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->vnd_identifier = val.str;
- has_ident = TRUE;
- break;
- case OPTION:
- ptr->vnd_option_lst = xf86parseOption(ptr->vnd_option_lst);
- break;
- case SUBSECTION:
- if (xf86getSubToken (&(ptr->vnd_comment)) != STRING)
- Error (QUOTE_MSG, "SubSection");
- {
- HANDLE_LIST (vnd_sub_lst, xf86parseVendorSubSection,
- XF86ConfVendSubPtr);
- }
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
-
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG);
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfVendorPtr, XF86ConfVendorRec)
+
+ while ((token = xf86getToken(VendorTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->vnd_comment = xf86addComment(ptr->vnd_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->vnd_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->vnd_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case OPTION:
+ ptr->vnd_option_lst = xf86parseOption(ptr->vnd_option_lst);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken(&(ptr->vnd_comment)) != STRING)
+ Error(QUOTE_MSG, "SubSection");
+ {
+ HANDLE_LIST(vnd_sub_lst, xf86parseVendorSubSection,
+ XF86ConfVendSubPtr);
+ }
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Vendor section parsed\n");
+ printf("Vendor section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printVendorSection (FILE * cf, XF86ConfVendorPtr ptr)
+xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr)
{
- XF86ConfVendSubPtr pptr;
-
- while (ptr)
- {
- fprintf (cf, "Section \"Vendor\"\n");
- if (ptr->vnd_comment)
- fprintf (cf, "%s", ptr->vnd_comment);
- if (ptr->vnd_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->vnd_identifier);
-
- xf86printOptionList(cf, ptr->vnd_option_lst, 1);
- for (pptr = ptr->vnd_sub_lst; pptr; pptr = pptr->list.next)
- {
- fprintf (cf, "\tSubSection \"Vendor\"\n");
- if (pptr->vs_comment)
- fprintf (cf, "%s", pptr->vs_comment);
- if (pptr->vs_identifier)
- fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vs_identifier);
- xf86printOptionList(cf, pptr->vs_option_lst, 2);
- fprintf (cf, "\tEndSubSection\n");
- }
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ XF86ConfVendSubPtr pptr;
+
+ while (ptr) {
+ fprintf(cf, "Section \"Vendor\"\n");
+ if (ptr->vnd_comment)
+ fprintf(cf, "%s", ptr->vnd_comment);
+ if (ptr->vnd_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->vnd_identifier);
+
+ xf86printOptionList(cf, ptr->vnd_option_lst, 1);
+ for (pptr = ptr->vnd_sub_lst; pptr; pptr = pptr->list.next) {
+ fprintf(cf, "\tSubSection \"Vendor\"\n");
+ if (pptr->vs_comment)
+ fprintf(cf, "%s", pptr->vs_comment);
+ if (pptr->vs_identifier)
+ fprintf(cf, "\t\tIdentifier \"%s\"\n", pptr->vs_identifier);
+ xf86printOptionList(cf, pptr->vs_option_lst, 2);
+ fprintf(cf, "\tEndSubSection\n");
+ }
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeVendorList (XF86ConfVendorPtr p)
+xf86freeVendorList(XF86ConfVendorPtr p)
{
- if (p == NULL)
- return;
- xf86freeVendorSubList (p->vnd_sub_lst);
- TestFree (p->vnd_identifier);
- TestFree (p->vnd_comment);
- xf86optionListFree (p->vnd_option_lst);
- free (p);
+ if (p == NULL)
+ return;
+ xf86freeVendorSubList(p->vnd_sub_lst);
+ TestFree(p->vnd_identifier);
+ TestFree(p->vnd_comment);
+ xf86optionListFree(p->vnd_option_lst);
+ free(p);
}
void
-xf86freeVendorSubList (XF86ConfVendSubPtr ptr)
+xf86freeVendorSubList(XF86ConfVendSubPtr ptr)
{
- XF86ConfVendSubPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->vs_identifier);
- TestFree (ptr->vs_name);
- TestFree (ptr->vs_comment);
- xf86optionListFree (ptr->vs_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfVendSubPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->vs_identifier);
+ TestFree(ptr->vs_name);
+ TestFree(ptr->vs_comment);
+ xf86optionListFree(ptr->vs_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
diff --git a/xorg-server/hw/xfree86/parser/Video.c b/xorg-server/hw/xfree86/parser/Video.c
index 19a5418b1..fc1f1e544 100644
--- a/xorg-server/hw/xfree86/parser/Video.c
+++ b/xorg-server/hw/xfree86/parser/Video.c
@@ -64,233 +64,223 @@
extern LexRec val;
-static xf86ConfigSymTabRec VideoPortTab[] =
-{
- {ENDSUBSECTION, "endsubsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec VideoPortTab[] = {
+ {ENDSUBSECTION, "endsubsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {-1, ""},
};
#define CLEANUP xf86freeVideoPortList
static void
-xf86freeVideoPortList (XF86ConfVideoPortPtr ptr)
+xf86freeVideoPortList(XF86ConfVideoPortPtr ptr)
{
- XF86ConfVideoPortPtr prev;
+ XF86ConfVideoPortPtr prev;
- while (ptr)
- {
- TestFree (ptr->vp_identifier);
- TestFree (ptr->vp_comment);
- xf86optionListFree (ptr->vp_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ while (ptr) {
+ TestFree(ptr->vp_identifier);
+ TestFree(ptr->vp_comment);
+ xf86optionListFree(ptr->vp_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
static XF86ConfVideoPortPtr
-xf86parseVideoPortSubSection (void)
+xf86parseVideoPortSubSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfVideoPortPtr, XF86ConfVideoPortRec)
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfVideoPortPtr, XF86ConfVideoPortRec)
- while ((token = xf86getToken (VideoPortTab)) != ENDSUBSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->vp_comment = xf86addComment(ptr->vp_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->vp_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->vp_identifier = val.str;
- has_ident = TRUE;
- break;
- case OPTION:
- ptr->vp_option_lst = xf86parseOption(ptr->vp_option_lst);
- break;
+ while ((token = xf86getToken(VideoPortTab)) != ENDSUBSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->vp_comment = xf86addComment(ptr->vp_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->vp_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->vp_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case OPTION:
+ ptr->vp_option_lst = xf86parseOption(ptr->vp_option_lst);
+ break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("VideoPort subsection parsed\n");
+ printf("VideoPort subsection parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
-static xf86ConfigSymTabRec VideoAdaptorTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {VENDOR, "vendorname"},
- {BOARD, "boardname"},
- {BUSID, "busid"},
- {DRIVER, "driver"},
- {OPTION, "option"},
- {SUBSECTION, "subsection"},
- {-1, ""},
+static xf86ConfigSymTabRec VideoAdaptorTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {VENDOR, "vendorname"},
+ {BOARD, "boardname"},
+ {BUSID, "busid"},
+ {DRIVER, "driver"},
+ {OPTION, "option"},
+ {SUBSECTION, "subsection"},
+ {-1, ""},
};
#define CLEANUP xf86freeVideoAdaptorList
XF86ConfVideoAdaptorPtr
-xf86parseVideoAdaptorSection (void)
+xf86parseVideoAdaptorSection(void)
{
- int has_ident = FALSE;
- int token;
+ int has_ident = FALSE;
+ int token;
- parsePrologue (XF86ConfVideoAdaptorPtr, XF86ConfVideoAdaptorRec)
+ parsePrologue(XF86ConfVideoAdaptorPtr, XF86ConfVideoAdaptorRec)
- while ((token = xf86getToken (VideoAdaptorTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->va_comment = xf86addComment(ptr->va_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- ptr->va_identifier = val.str;
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- has_ident = TRUE;
- break;
- case VENDOR:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "Vendor");
- ptr->va_vendor = val.str;
- break;
- case BOARD:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "Board");
- ptr->va_board = val.str;
- break;
- case BUSID:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "BusID");
- ptr->va_busid = val.str;
- break;
- case DRIVER:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "Driver");
- ptr->va_driver = val.str;
- break;
- case OPTION:
- ptr->va_option_lst = xf86parseOption(ptr->va_option_lst);
- break;
- case SUBSECTION:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "SubSection");
- {
- HANDLE_LIST (va_port_lst, xf86parseVideoPortSubSection,
- XF86ConfVideoPortPtr);
- }
- break;
+ while ((token = xf86getToken(VideoAdaptorTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->va_comment = xf86addComment(ptr->va_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ ptr->va_identifier = val.str;
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ has_ident = TRUE;
+ break;
+ case VENDOR:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "Vendor");
+ ptr->va_vendor = val.str;
+ break;
+ case BOARD:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "Board");
+ ptr->va_board = val.str;
+ break;
+ case BUSID:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "BusID");
+ ptr->va_busid = val.str;
+ break;
+ case DRIVER:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "Driver");
+ ptr->va_driver = val.str;
+ break;
+ case OPTION:
+ ptr->va_option_lst = xf86parseOption(ptr->va_option_lst);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "SubSection");
+ {
+ HANDLE_LIST(va_port_lst, xf86parseVideoPortSubSection,
+ XF86ConfVideoPortPtr);
+ }
+ break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
- if (!has_ident)
- Error (NO_IDENT_MSG);
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("VideoAdaptor section parsed\n");
+ printf("VideoAdaptor section parsed\n");
#endif
- return ptr;
+ return ptr;
}
void
-xf86printVideoAdaptorSection (FILE * cf, XF86ConfVideoAdaptorPtr ptr)
+xf86printVideoAdaptorSection(FILE * cf, XF86ConfVideoAdaptorPtr ptr)
{
- XF86ConfVideoPortPtr pptr;
+ XF86ConfVideoPortPtr pptr;
- while (ptr)
- {
- fprintf (cf, "Section \"VideoAdaptor\"\n");
- if (ptr->va_comment)
- fprintf (cf, "%s", ptr->va_comment);
- if (ptr->va_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->va_identifier);
- if (ptr->va_vendor)
- fprintf (cf, "\tVendorName \"%s\"\n", ptr->va_vendor);
- if (ptr->va_board)
- fprintf (cf, "\tBoardName \"%s\"\n", ptr->va_board);
- if (ptr->va_busid)
- fprintf (cf, "\tBusID \"%s\"\n", ptr->va_busid);
- if (ptr->va_driver)
- fprintf (cf, "\tDriver \"%s\"\n", ptr->va_driver);
- xf86printOptionList(cf, ptr->va_option_lst, 1);
- for (pptr = ptr->va_port_lst; pptr; pptr = pptr->list.next)
- {
- fprintf (cf, "\tSubSection \"VideoPort\"\n");
- if (pptr->vp_comment)
- fprintf (cf, "%s", pptr->vp_comment);
- if (pptr->vp_identifier)
- fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vp_identifier);
- xf86printOptionList(cf, pptr->vp_option_lst, 2);
- fprintf (cf, "\tEndSubSection\n");
- }
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ while (ptr) {
+ fprintf(cf, "Section \"VideoAdaptor\"\n");
+ if (ptr->va_comment)
+ fprintf(cf, "%s", ptr->va_comment);
+ if (ptr->va_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->va_identifier);
+ if (ptr->va_vendor)
+ fprintf(cf, "\tVendorName \"%s\"\n", ptr->va_vendor);
+ if (ptr->va_board)
+ fprintf(cf, "\tBoardName \"%s\"\n", ptr->va_board);
+ if (ptr->va_busid)
+ fprintf(cf, "\tBusID \"%s\"\n", ptr->va_busid);
+ if (ptr->va_driver)
+ fprintf(cf, "\tDriver \"%s\"\n", ptr->va_driver);
+ xf86printOptionList(cf, ptr->va_option_lst, 1);
+ for (pptr = ptr->va_port_lst; pptr; pptr = pptr->list.next) {
+ fprintf(cf, "\tSubSection \"VideoPort\"\n");
+ if (pptr->vp_comment)
+ fprintf(cf, "%s", pptr->vp_comment);
+ if (pptr->vp_identifier)
+ fprintf(cf, "\t\tIdentifier \"%s\"\n", pptr->vp_identifier);
+ xf86printOptionList(cf, pptr->vp_option_lst, 2);
+ fprintf(cf, "\tEndSubSection\n");
+ }
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeVideoAdaptorList (XF86ConfVideoAdaptorPtr ptr)
+xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr)
{
- XF86ConfVideoAdaptorPtr prev;
+ XF86ConfVideoAdaptorPtr prev;
- while (ptr)
- {
- TestFree (ptr->va_identifier);
- TestFree (ptr->va_vendor);
- TestFree (ptr->va_board);
- TestFree (ptr->va_busid);
- TestFree (ptr->va_driver);
- TestFree (ptr->va_fwdref);
- TestFree (ptr->va_comment);
- xf86freeVideoPortList (ptr->va_port_lst);
- xf86optionListFree (ptr->va_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ while (ptr) {
+ TestFree(ptr->va_identifier);
+ TestFree(ptr->va_vendor);
+ TestFree(ptr->va_board);
+ TestFree(ptr->va_busid);
+ TestFree(ptr->va_driver);
+ TestFree(ptr->va_fwdref);
+ TestFree(ptr->va_comment);
+ xf86freeVideoPortList(ptr->va_port_lst);
+ xf86optionListFree(ptr->va_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
XF86ConfVideoAdaptorPtr
-xf86findVideoAdaptor (const char *ident, XF86ConfVideoAdaptorPtr p)
+xf86findVideoAdaptor(const char *ident, XF86ConfVideoAdaptorPtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->va_identifier) == 0)
- return p;
+ while (p) {
+ if (xf86nameCompare(ident, p->va_identifier) == 0)
+ return p;
- p = p->list.next;
- }
- return NULL;
+ p = p->list.next;
+ }
+ return NULL;
}
diff --git a/xorg-server/hw/xfree86/parser/configProcs.h b/xorg-server/hw/xfree86/parser/configProcs.h
index d67acc698..1250f3922 100644
--- a/xorg-server/hw/xfree86/parser/configProcs.h
+++ b/xorg-server/hw/xfree86/parser/configProcs.h
@@ -32,82 +32,110 @@
/* Device.c */
XF86ConfDevicePtr xf86parseDeviceSection(void);
-void xf86printDeviceSection(FILE *cf, XF86ConfDevicePtr ptr);
+void xf86printDeviceSection(FILE * cf, XF86ConfDevicePtr ptr);
void xf86freeDeviceList(XF86ConfDevicePtr ptr);
int xf86validateDevice(XF86ConfigPtr p);
+
/* Files.c */
XF86ConfFilesPtr xf86parseFilesSection(void);
-void xf86printFileSection(FILE *cf, XF86ConfFilesPtr ptr);
+void xf86printFileSection(FILE * cf, XF86ConfFilesPtr ptr);
void xf86freeFiles(XF86ConfFilesPtr p);
+
/* Flags.c */
XF86ConfFlagsPtr xf86parseFlagsSection(void);
-void xf86printServerFlagsSection(FILE *f, XF86ConfFlagsPtr flags);
+void xf86printServerFlagsSection(FILE * f, XF86ConfFlagsPtr flags);
void xf86freeFlags(XF86ConfFlagsPtr flags);
+
/* Input.c */
XF86ConfInputPtr xf86parseInputSection(void);
-void xf86printInputSection(FILE *f, XF86ConfInputPtr ptr);
+void xf86printInputSection(FILE * f, XF86ConfInputPtr ptr);
void xf86freeInputList(XF86ConfInputPtr ptr);
-int xf86validateInput (XF86ConfigPtr p);
+int xf86validateInput(XF86ConfigPtr p);
+
/* InputClass.c */
XF86ConfInputClassPtr xf86parseInputClassSection(void);
-void xf86printInputClassSection(FILE *f, XF86ConfInputClassPtr ptr);
+void xf86printInputClassSection(FILE * f, XF86ConfInputClassPtr ptr);
void xf86freeInputClassList(XF86ConfInputClassPtr ptr);
+
/* Layout.c */
XF86ConfLayoutPtr xf86parseLayoutSection(void);
-void xf86printLayoutSection(FILE *cf, XF86ConfLayoutPtr ptr);
+void xf86printLayoutSection(FILE * cf, XF86ConfLayoutPtr ptr);
void xf86freeLayoutList(XF86ConfLayoutPtr ptr);
int xf86validateLayout(XF86ConfigPtr p);
+
/* Module.c */
XF86ConfModulePtr xf86parseModuleSection(void);
-void xf86printModuleSection(FILE *cf, XF86ConfModulePtr ptr);
-extern _X_EXPORT XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type, XF86OptionPtr opts);
+void xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr);
+extern _X_EXPORT XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head,
+ char *name, int type,
+ XF86OptionPtr opts);
void xf86freeModules(XF86ConfModulePtr ptr);
+
/* Monitor.c */
XF86ConfMonitorPtr xf86parseMonitorSection(void);
XF86ConfModesPtr xf86parseModesSection(void);
-void xf86printMonitorSection(FILE *cf, XF86ConfMonitorPtr ptr);
-void xf86printModesSection(FILE *cf, XF86ConfModesPtr ptr);
+void xf86printMonitorSection(FILE * cf, XF86ConfMonitorPtr ptr);
+void xf86printModesSection(FILE * cf, XF86ConfModesPtr ptr);
extern _X_EXPORT void xf86freeMonitorList(XF86ConfMonitorPtr ptr);
void xf86freeModesList(XF86ConfModesPtr ptr);
int xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen);
+
/* Pointer.c */
XF86ConfInputPtr xf86parsePointerSection(void);
+
/* Screen.c */
XF86ConfScreenPtr xf86parseScreenSection(void);
-void xf86printScreenSection(FILE *cf, XF86ConfScreenPtr ptr);
+void xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr);
extern _X_EXPORT void xf86freeScreenList(XF86ConfScreenPtr ptr);
void xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr);
void xf86freeDisplayList(XF86ConfDisplayPtr ptr);
void xf86freeModeList(XF86ModePtr ptr);
int xf86validateScreen(XF86ConfigPtr p);
+
/* Vendor.c */
XF86ConfVendorPtr xf86parseVendorSection(void);
void xf86freeVendorList(XF86ConfVendorPtr p);
void xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr);
-void xf86freeVendorSubList (XF86ConfVendSubPtr ptr);
+void xf86freeVendorSubList(XF86ConfVendSubPtr ptr);
+
/* Video.c */
XF86ConfVideoAdaptorPtr xf86parseVideoAdaptorSection(void);
-void xf86printVideoAdaptorSection(FILE *cf, XF86ConfVideoAdaptorPtr ptr);
+void xf86printVideoAdaptorSection(FILE * cf, XF86ConfVideoAdaptorPtr ptr);
void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr);
+
/* scan.c */
-int xf86getToken(xf86ConfigSymTabRec *tab);
+int xf86getToken(xf86ConfigSymTabRec * tab);
int xf86getSubToken(char **comment);
-int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab);
+int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec * tab);
void xf86unGetToken(int token);
char *xf86tokenString(void);
-void xf86parseError(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,2);
-void xf86validationError(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,2);
-void xf86setSection(const char *section);
-int xf86getStringToken(xf86ConfigSymTabRec *tab);
+void
+xf86parseError(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+void
+xf86validationError(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+void
+xf86setSection(const char *section);
+int
+xf86getStringToken(xf86ConfigSymTabRec * tab);
+
/* write.c */
/* DRI.c */
-XF86ConfDRIPtr xf86parseDRISection (void);
-void xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr);
-void xf86freeDRI (XF86ConfDRIPtr ptr);
+XF86ConfDRIPtr
+xf86parseDRISection(void);
+void
+xf86printDRISection(FILE * cf, XF86ConfDRIPtr ptr);
+void
+xf86freeDRI(XF86ConfDRIPtr ptr);
+
/* Extensions.c */
-XF86ConfExtensionsPtr xf86parseExtensionsSection (void);
-void xf86printExtensionsSection (FILE * cf, XF86ConfExtensionsPtr ptr);
-void xf86freeExtensions (XF86ConfExtensionsPtr ptr);
+XF86ConfExtensionsPtr
+xf86parseExtensionsSection(void);
+void
+xf86printExtensionsSection(FILE * cf, XF86ConfExtensionsPtr ptr);
+void
+xf86freeExtensions(XF86ConfExtensionsPtr ptr);
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
@@ -115,6 +143,8 @@ void xf86freeExtensions (XF86ConfExtensionsPtr ptr);
#ifndef IN_XSERVER
/* Externally provided functions */
-void ErrorF(const char *f, ...);
-void VErrorF(const char *f, va_list args);
+void
+ErrorF(const char *f, ...);
+void
+VErrorF(const char *f, va_list args);
#endif
diff --git a/xorg-server/hw/xfree86/parser/read.c b/xorg-server/hw/xfree86/parser/read.c
index 715626c53..eef873e89 100644
--- a/xorg-server/hw/xfree86/parser/read.c
+++ b/xorg-server/hw/xfree86/parser/read.c
@@ -1,318 +1,292 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-extern LexRec val;
-
-static xf86ConfigSymTabRec TopLevelTab[] =
-{
- {SECTION, "section"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeConfig
-
-/*
- * This function resolves name references and reports errors if the named
- * objects cannot be found.
- */
-static int
-xf86validateConfig (XF86ConfigPtr p)
-{
- if (!xf86validateScreen (p))
- return FALSE;
- if (!xf86validateInput (p))
- return FALSE;
- if (!xf86validateLayout (p))
- return FALSE;
-
- return TRUE;
-}
-
-XF86ConfigPtr
-xf86readConfigFile (void)
-{
- int token;
- XF86ConfigPtr ptr = NULL;
-
- if ((ptr = calloc (1, sizeof (XF86ConfigRec))) == NULL)
- {
- return NULL;
- }
-
- while ((token = xf86getToken (TopLevelTab)) != EOF_TOKEN)
- {
- switch (token)
- {
- case COMMENT:
- ptr->conf_comment = xf86addComment(ptr->conf_comment, val.str);
- break;
- case SECTION:
- if (xf86getSubToken (&(ptr->conf_comment)) != STRING)
- {
- xf86parseError (QUOTE_MSG, "Section");
- CLEANUP (ptr);
- return NULL;
- }
- xf86setSection (val.str);
- if (xf86nameCompare (val.str, "files") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_RETURN (conf_files, xf86parseFilesSection ());
- }
- else if (xf86nameCompare (val.str, "serverflags") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_RETURN (conf_flags, xf86parseFlagsSection ());
- }
- else if (xf86nameCompare (val.str, "pointer") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_input_lst, xf86parsePointerSection,
- XF86ConfInputPtr);
- }
- else if (xf86nameCompare (val.str, "videoadaptor") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_videoadaptor_lst, xf86parseVideoAdaptorSection,
- XF86ConfVideoAdaptorPtr);
- }
- else if (xf86nameCompare (val.str, "device") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_device_lst, xf86parseDeviceSection,
- XF86ConfDevicePtr);
- }
- else if (xf86nameCompare (val.str, "monitor") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_monitor_lst, xf86parseMonitorSection,
- XF86ConfMonitorPtr);
- }
- else if (xf86nameCompare (val.str, "modes") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_modes_lst, xf86parseModesSection,
- XF86ConfModesPtr);
- }
- else if (xf86nameCompare (val.str, "screen") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_screen_lst, xf86parseScreenSection,
- XF86ConfScreenPtr);
- }
- else if (xf86nameCompare(val.str, "inputdevice") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_input_lst, xf86parseInputSection,
- XF86ConfInputPtr);
- }
- else if (xf86nameCompare(val.str, "inputclass") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_inputclass_lst,
- xf86parseInputClassSection,
- XF86ConfInputClassPtr);
- }
- else if (xf86nameCompare (val.str, "module") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_RETURN (conf_modules, xf86parseModuleSection ());
- }
- else if (xf86nameCompare (val.str, "serverlayout") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_layout_lst, xf86parseLayoutSection,
- XF86ConfLayoutPtr);
- }
- else if (xf86nameCompare (val.str, "vendor") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_vendor_lst, xf86parseVendorSection,
- XF86ConfVendorPtr);
- }
- else if (xf86nameCompare (val.str, "dri") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_RETURN (conf_dri, xf86parseDRISection ());
- }
- else if (xf86nameCompare (val.str, "extensions") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_RETURN (conf_extensions, xf86parseExtensionsSection ());
- }
- else
- {
- free(val.str);
- val.str = NULL;
- Error (INVALID_SECTION_MSG, xf86tokenString ());
- }
- break;
- default:
- free(val.str);
- val.str = NULL;
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- }
- }
-
- if (xf86validateConfig (ptr))
- return ptr;
- else
- {
- CLEANUP (ptr);
- return NULL;
- }
-}
-
-#undef CLEANUP
-
-/*
- * adds an item to the end of the linked list. Any record whose first field
- * is a GenericListRec can be cast to this type and used with this function.
- * A pointer to the head of the list is returned to handle the addition of
- * the first item.
- */
-GenericListPtr
-xf86addListItem (GenericListPtr head, GenericListPtr new)
-{
- GenericListPtr p = head;
- GenericListPtr last = NULL;
-
- while (p)
- {
- last = p;
- p = p->next;
- }
-
- if (last)
- {
- last->next = new;
- return head;
- }
- else
- return new;
-}
-
-/*
- * Test if one chained list contains the other.
- * In this case both list have the same endpoint (provided they don't loop)
- */
-int
-xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2)
-{
- GenericListPtr p = list_1;
- GenericListPtr last_1 = NULL, last_2 = NULL;
-
- while (p) {
- last_1 = p;
- p = p->next;
- }
-
- p = list_2;
- while (p) {
- last_2 = p;
- p = p->next;
- }
-
- return (!(last_1 == last_2));
-}
-
-void
-xf86freeConfig (XF86ConfigPtr p)
-{
- if (p == NULL)
- return;
-
- xf86freeFiles (p->conf_files);
- xf86freeModules (p->conf_modules);
- xf86freeFlags (p->conf_flags);
- xf86freeMonitorList (p->conf_monitor_lst);
- xf86freeModesList (p->conf_modes_lst);
- xf86freeVideoAdaptorList (p->conf_videoadaptor_lst);
- xf86freeDeviceList (p->conf_device_lst);
- xf86freeScreenList (p->conf_screen_lst);
- xf86freeLayoutList (p->conf_layout_lst);
- xf86freeInputList (p->conf_input_lst);
- xf86freeVendorList (p->conf_vendor_lst);
- xf86freeDRI (p->conf_dri);
- xf86freeExtensions (p->conf_extensions);
- TestFree(p->conf_comment);
-
- free (p);
-}
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec TopLevelTab[] = {
+ {SECTION, "section"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeConfig
+
+/*
+ * This function resolves name references and reports errors if the named
+ * objects cannot be found.
+ */
+static int
+xf86validateConfig(XF86ConfigPtr p)
+{
+ if (!xf86validateScreen(p))
+ return FALSE;
+ if (!xf86validateInput(p))
+ return FALSE;
+ if (!xf86validateLayout(p))
+ return FALSE;
+
+ return TRUE;
+}
+
+XF86ConfigPtr
+xf86readConfigFile(void)
+{
+ int token;
+ XF86ConfigPtr ptr = NULL;
+
+ if ((ptr = calloc(1, sizeof(XF86ConfigRec))) == NULL) {
+ return NULL;
+ }
+
+ while ((token = xf86getToken(TopLevelTab)) != EOF_TOKEN) {
+ switch (token) {
+ case COMMENT:
+ ptr->conf_comment = xf86addComment(ptr->conf_comment, val.str);
+ break;
+ case SECTION:
+ if (xf86getSubToken(&(ptr->conf_comment)) != STRING) {
+ xf86parseError(QUOTE_MSG, "Section");
+ CLEANUP(ptr);
+ return NULL;
+ }
+ xf86setSection(val.str);
+ if (xf86nameCompare(val.str, "files") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_RETURN(conf_files, xf86parseFilesSection());
+ }
+ else if (xf86nameCompare(val.str, "serverflags") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_RETURN(conf_flags, xf86parseFlagsSection());
+ }
+ else if (xf86nameCompare(val.str, "pointer") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_input_lst, xf86parsePointerSection,
+ XF86ConfInputPtr);
+ }
+ else if (xf86nameCompare(val.str, "videoadaptor") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_videoadaptor_lst, xf86parseVideoAdaptorSection,
+ XF86ConfVideoAdaptorPtr);
+ }
+ else if (xf86nameCompare(val.str, "device") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_device_lst, xf86parseDeviceSection,
+ XF86ConfDevicePtr);
+ }
+ else if (xf86nameCompare(val.str, "monitor") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_monitor_lst, xf86parseMonitorSection,
+ XF86ConfMonitorPtr);
+ }
+ else if (xf86nameCompare(val.str, "modes") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_modes_lst, xf86parseModesSection,
+ XF86ConfModesPtr);
+ }
+ else if (xf86nameCompare(val.str, "screen") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_screen_lst, xf86parseScreenSection,
+ XF86ConfScreenPtr);
+ }
+ else if (xf86nameCompare(val.str, "inputdevice") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_input_lst, xf86parseInputSection,
+ XF86ConfInputPtr);
+ }
+ else if (xf86nameCompare(val.str, "inputclass") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_inputclass_lst,
+ xf86parseInputClassSection, XF86ConfInputClassPtr);
+ }
+ else if (xf86nameCompare(val.str, "module") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_RETURN(conf_modules, xf86parseModuleSection());
+ }
+ else if (xf86nameCompare(val.str, "serverlayout") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_layout_lst, xf86parseLayoutSection,
+ XF86ConfLayoutPtr);
+ }
+ else if (xf86nameCompare(val.str, "vendor") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_vendor_lst, xf86parseVendorSection,
+ XF86ConfVendorPtr);
+ }
+ else if (xf86nameCompare(val.str, "dri") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_RETURN(conf_dri, xf86parseDRISection());
+ }
+ else if (xf86nameCompare(val.str, "extensions") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_RETURN(conf_extensions, xf86parseExtensionsSection());
+ }
+ else {
+ free(val.str);
+ val.str = NULL;
+ Error(INVALID_SECTION_MSG, xf86tokenString());
+ }
+ break;
+ default:
+ free(val.str);
+ val.str = NULL;
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ }
+ }
+
+ if (xf86validateConfig(ptr))
+ return ptr;
+ else {
+ CLEANUP(ptr);
+ return NULL;
+ }
+}
+
+#undef CLEANUP
+
+/*
+ * adds an item to the end of the linked list. Any record whose first field
+ * is a GenericListRec can be cast to this type and used with this function.
+ * A pointer to the head of the list is returned to handle the addition of
+ * the first item.
+ */
+GenericListPtr
+xf86addListItem(GenericListPtr head, GenericListPtr new)
+{
+ GenericListPtr p = head;
+ GenericListPtr last = NULL;
+
+ while (p) {
+ last = p;
+ p = p->next;
+ }
+
+ if (last) {
+ last->next = new;
+ return head;
+ }
+ else
+ return new;
+}
+
+/*
+ * Test if one chained list contains the other.
+ * In this case both list have the same endpoint (provided they don't loop)
+ */
+int
+xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2)
+{
+ GenericListPtr p = list_1;
+ GenericListPtr last_1 = NULL, last_2 = NULL;
+
+ while (p) {
+ last_1 = p;
+ p = p->next;
+ }
+
+ p = list_2;
+ while (p) {
+ last_2 = p;
+ p = p->next;
+ }
+
+ return (!(last_1 == last_2));
+}
+
+void
+xf86freeConfig(XF86ConfigPtr p)
+{
+ if (p == NULL)
+ return;
+
+ xf86freeFiles(p->conf_files);
+ xf86freeModules(p->conf_modules);
+ xf86freeFlags(p->conf_flags);
+ xf86freeMonitorList(p->conf_monitor_lst);
+ xf86freeModesList(p->conf_modes_lst);
+ xf86freeVideoAdaptorList(p->conf_videoadaptor_lst);
+ xf86freeDeviceList(p->conf_device_lst);
+ xf86freeScreenList(p->conf_screen_lst);
+ xf86freeLayoutList(p->conf_layout_lst);
+ xf86freeInputList(p->conf_input_lst);
+ xf86freeVendorList(p->conf_vendor_lst);
+ xf86freeDRI(p->conf_dri);
+ xf86freeExtensions(p->conf_extensions);
+ TestFree(p->conf_comment);
+
+ free(p);
+}
diff --git a/xorg-server/hw/xfree86/parser/scan.c b/xorg-server/hw/xfree86/parser/scan.c
index 156bc299a..795da615f 100644
--- a/xorg-server/hw/xfree86/parser/scan.c
+++ b/xorg-server/hw/xfree86/parser/scan.c
@@ -51,7 +51,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -75,11 +74,11 @@
#define _POSIX_SOURCE
#include <limits.h>
#undef _POSIX_SOURCE
-#endif /* _POSIX_SOURCE */
+#endif /* _POSIX_SOURCE */
#if !defined(MAXHOSTNAMELEN)
#define MAXHOSTNAMELEN 32
-#endif /* !MAXHOSTNAMELEN */
+#endif /* !MAXHOSTNAMELEN */
/* For PATH_MAX */
#include "misc.h"
@@ -90,22 +89,22 @@
#define CONFIG_BUF_LEN 1024
#define CONFIG_MAX_FILES 64
-static int StringToToken (const char *, xf86ConfigSymTabRec *);
+static int StringToToken(const char *, xf86ConfigSymTabRec *);
static struct {
- FILE *file;
- char *path;
+ FILE *file;
+ char *path;
} configFiles[CONFIG_MAX_FILES];
static const char **builtinConfig = NULL;
static int builtinIndex = 0;
-static int configPos = 0; /* current readers position */
-static int configLineNo = 0; /* linenumber */
-static char *configBuf, *configRBuf; /* buffer for lines */
-static char *configSection = NULL; /* name of current section being parsed */
-static int numFiles = 0; /* number of config files */
-static int curFileIndex = 0; /* index of current config file */
+static int configPos = 0; /* current readers position */
+static int configLineNo = 0; /* linenumber */
+static char *configBuf, *configRBuf; /* buffer for lines */
+static char *configSection = NULL; /* name of current section being parsed */
+static int numFiles = 0; /* number of config files */
+static int curFileIndex = 0; /* index of current config file */
static int pushToken = LOCK_TOKEN;
-static int eol_seen = 0; /* private state to handle comments */
+static int eol_seen = 0; /* private state to handle comments */
LexRec val;
/*
@@ -119,123 +118,129 @@ LexRec val;
* support that.
*/
-static char*
+static char *
xf86getNextLine(void)
{
- static int configBufLen = CONFIG_BUF_LEN;
- char *tmpConfigBuf, *tmpConfigRBuf;
- int c, i, pos = 0, eolFound = 0;
- char *ret = NULL;
+ static int configBufLen = CONFIG_BUF_LEN;
+ char *tmpConfigBuf, *tmpConfigRBuf;
+ int c, i, pos = 0, eolFound = 0;
+ char *ret = NULL;
- /*
- * reallocate the string if it was grown last time (i.e., is no
- * longer CONFIG_BUF_LEN); we malloc the new strings first, so
- * that if either of the mallocs fail, we can fall back on the
- * existing buffer allocations
- */
+ /*
+ * reallocate the string if it was grown last time (i.e., is no
+ * longer CONFIG_BUF_LEN); we malloc the new strings first, so
+ * that if either of the mallocs fail, we can fall back on the
+ * existing buffer allocations
+ */
- if (configBufLen != CONFIG_BUF_LEN) {
+ if (configBufLen != CONFIG_BUF_LEN) {
- tmpConfigBuf = malloc(CONFIG_BUF_LEN);
- tmpConfigRBuf = malloc(CONFIG_BUF_LEN);
+ tmpConfigBuf = malloc(CONFIG_BUF_LEN);
+ tmpConfigRBuf = malloc(CONFIG_BUF_LEN);
- if (!tmpConfigBuf || !tmpConfigRBuf) {
+ if (!tmpConfigBuf || !tmpConfigRBuf) {
- /*
- * at least one of the mallocs failed; keep the old buffers
- * and free any partial allocations
- */
+ /*
+ * at least one of the mallocs failed; keep the old buffers
+ * and free any partial allocations
+ */
- free(tmpConfigBuf);
- free(tmpConfigRBuf);
+ free(tmpConfigBuf);
+ free(tmpConfigRBuf);
- } else {
+ }
+ else {
- /*
- * malloc succeeded; free the old buffers and use the new
- * buffers
- */
+ /*
+ * malloc succeeded; free the old buffers and use the new
+ * buffers
+ */
- configBufLen = CONFIG_BUF_LEN;
+ configBufLen = CONFIG_BUF_LEN;
- free(configBuf);
- free(configRBuf);
+ free(configBuf);
+ free(configRBuf);
- configBuf = tmpConfigBuf;
- configRBuf = tmpConfigRBuf;
- }
- }
+ configBuf = tmpConfigBuf;
+ configRBuf = tmpConfigRBuf;
+ }
+ }
- /* read in another block of chars */
+ /* read in another block of chars */
- do {
- ret = fgets(configBuf + pos, configBufLen - pos - 1,
- configFiles[curFileIndex].file);
+ do {
+ ret = fgets(configBuf + pos, configBufLen - pos - 1,
+ configFiles[curFileIndex].file);
- if (!ret) {
- /*
- * if the file doesn't end in a newline, add one
- * and trigger another read
- */
- if (pos != 0) {
- strcpy(&configBuf[pos], "\n");
- ret = configBuf;
- } else
- break;
- }
+ if (!ret) {
+ /*
+ * if the file doesn't end in a newline, add one
+ * and trigger another read
+ */
+ if (pos != 0) {
+ strcpy(&configBuf[pos], "\n");
+ ret = configBuf;
+ }
+ else
+ break;
+ }
- /* search for EOL in the new block of chars */
+ /* search for EOL in the new block of chars */
- for (i = pos; i < (configBufLen - 1); i++) {
- c = configBuf[i];
+ for (i = pos; i < (configBufLen - 1); i++) {
+ c = configBuf[i];
- if (c == '\0') break;
+ if (c == '\0')
+ break;
- if ((c == '\n') || (c == '\r')) {
- eolFound = 1;
- break;
- }
- }
+ if ((c == '\n') || (c == '\r')) {
+ eolFound = 1;
+ break;
+ }
+ }
- /*
- * if we didn't find EOL, then grow the string and
- * read in more
- */
+ /*
+ * if we didn't find EOL, then grow the string and
+ * read in more
+ */
- if (!eolFound) {
+ if (!eolFound) {
- tmpConfigBuf = realloc(configBuf, configBufLen + CONFIG_BUF_LEN);
- tmpConfigRBuf = realloc(configRBuf, configBufLen + CONFIG_BUF_LEN);
+ tmpConfigBuf = realloc(configBuf, configBufLen + CONFIG_BUF_LEN);
+ tmpConfigRBuf = realloc(configRBuf, configBufLen + CONFIG_BUF_LEN);
- if (!tmpConfigBuf || !tmpConfigRBuf) {
+ if (!tmpConfigBuf || !tmpConfigRBuf) {
- /*
- * at least one of the reallocations failed; use the
- * new allocation that succeeded, but we have to
- * fallback to the previous configBufLen size and use
- * the string we have, even though we don't have an
- * EOL
- */
+ /*
+ * at least one of the reallocations failed; use the
+ * new allocation that succeeded, but we have to
+ * fallback to the previous configBufLen size and use
+ * the string we have, even though we don't have an
+ * EOL
+ */
- if (tmpConfigBuf) configBuf = tmpConfigBuf;
- if (tmpConfigRBuf) configRBuf = tmpConfigRBuf;
+ if (tmpConfigBuf)
+ configBuf = tmpConfigBuf;
+ if (tmpConfigRBuf)
+ configRBuf = tmpConfigRBuf;
- break;
+ break;
- } else {
+ }
+ else {
- /* reallocation succeeded */
+ /* reallocation succeeded */
- configBuf = tmpConfigBuf;
- configRBuf = tmpConfigRBuf;
- pos = i;
- configBufLen += CONFIG_BUF_LEN;
- }
- }
+ configBuf = tmpConfigBuf;
+ configRBuf = tmpConfigRBuf;
+ pos = i;
+ configBufLen += CONFIG_BUF_LEN;
+ }
+ }
- } while (!eolFound);
+ } while (!eolFound);
- return ret;
+ return ret;
}
/*
@@ -244,295 +249,278 @@ xf86getNextLine(void)
* pushToken.
*/
int
-xf86getToken (xf86ConfigSymTabRec * tab)
+xf86getToken(xf86ConfigSymTabRec * tab)
{
- int c, i;
-
- /*
- * First check whether pushToken has a different value than LOCK_TOKEN.
- * In this case rBuf[] contains a valid STRING/TOKEN/NUMBER. But in the
- * oth * case the next token must be read from the input.
- */
- if (pushToken == EOF_TOKEN)
- return EOF_TOKEN;
- else if (pushToken == LOCK_TOKEN)
- {
- /*
- * eol_seen is only set for the first token after a newline.
- */
- eol_seen = 0;
-
- c = configBuf[configPos];
-
- /*
- * Get start of next Token. EOF is handled,
- * whitespaces are skipped.
- */
-
-again:
- if (!c)
- {
- char *ret;
- if (numFiles > 0)
- ret = xf86getNextLine();
- else {
- if (builtinConfig[builtinIndex] == NULL)
- ret = NULL;
- else {
- strlcpy(configBuf,
- builtinConfig[builtinIndex],
- CONFIG_BUF_LEN);
- ret = configBuf;
- builtinIndex++;
- }
- }
- if (ret == NULL)
- {
- /*
- * if necessary, move to the next file and
- * read the first line
- */
- if (curFileIndex + 1 < numFiles) {
- curFileIndex++;
- configLineNo = 0;
- goto again;
- }
- else
- return pushToken = EOF_TOKEN;
- }
- configLineNo++;
- configPos = 0;
- eol_seen = 1;
- }
-
- i = 0;
- for (;;) {
- c = configBuf[configPos++];
- configRBuf[i++] = c;
- switch (c) {
- case ' ':
- case '\t':
- case '\r':
- continue;
- case '\n':
- i = 0;
- continue;
- }
- break;
- }
- if (c == '\0')
- goto again;
-
- if (c == '#')
- {
- do
- {
- configRBuf[i++] = (c = configBuf[configPos++]);
- }
- while ((c != '\n') && (c != '\r') && (c != '\0'));
- configRBuf[i] = '\0';
- /* XXX no private copy.
- * Use xf86addComment when setting a comment.
- */
- val.str = configRBuf;
- return COMMENT;
- }
-
- /* GJA -- handle '-' and ',' * Be careful: "-hsync" is a keyword. */
- else if ((c == ',') && !isalpha (configBuf[configPos]))
- {
- return COMMA;
- }
- else if ((c == '-') && !isalpha (configBuf[configPos]))
- {
- return DASH;
- }
-
- /*
- * Numbers are returned immediately ...
- */
- if (isdigit (c))
- {
- int base;
-
- if (c == '0')
- if ((configBuf[configPos] == 'x') ||
- (configBuf[configPos] == 'X'))
- {
- base = 16;
- val.numType = PARSE_HEX;
- }
- else
- {
- base = 8;
- val.numType = PARSE_OCTAL;
- }
- else
- {
- base = 10;
- val.numType = PARSE_DECIMAL;
- }
-
- configRBuf[0] = c;
- i = 1;
- while (isdigit (c = configBuf[configPos++]) ||
- (c == '.') || (c == 'x') || (c == 'X') ||
- ((base == 16) && (((c >= 'a') && (c <= 'f')) ||
- ((c >= 'A') && (c <= 'F')))))
- configRBuf[i++] = c;
- configPos--; /* GJA -- one too far */
- configRBuf[i] = '\0';
- val.num = strtoul (configRBuf, NULL, 0);
- val.realnum = atof (configRBuf);
- return NUMBER;
- }
-
- /*
- * All Strings START with a \" ...
- */
- else if (c == '\"')
- {
- i = -1;
- do
- {
- configRBuf[++i] = (c = configBuf[configPos++]);
- }
- while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0'));
- configRBuf[i] = '\0';
- val.str = malloc (strlen (configRBuf) + 1);
- strcpy (val.str, configRBuf); /* private copy ! */
- return STRING;
- }
-
- /*
- * ... and now we MUST have a valid token. The search is
- * handled later along with the pushed tokens.
- */
- else
- {
- configRBuf[0] = c;
- i = 0;
- do
- {
- configRBuf[++i] = (c = configBuf[configPos++]);
- }
- while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r') && (c != '\0') && (c != '#'));
- --configPos;
- configRBuf[i] = '\0';
- i = 0;
- }
-
- }
- else
- {
-
- /*
- * Here we deal with pushed tokens. Reinitialize pushToken again. If
- * the pushed token was NUMBER || STRING return them again ...
- */
- int temp = pushToken;
- pushToken = LOCK_TOKEN;
-
- if (temp == COMMA || temp == DASH)
- return temp;
- if (temp == NUMBER || temp == STRING)
- return temp;
- }
-
- /*
- * Joop, at last we have to lookup the token ...
- */
- if (tab)
- {
- i = 0;
- while (tab[i].token != -1)
- if (xf86nameCompare (configRBuf, tab[i].name) == 0)
- return tab[i].token;
- else
- i++;
- }
-
- return ERROR_TOKEN; /* Error catcher */
+ int c, i;
+
+ /*
+ * First check whether pushToken has a different value than LOCK_TOKEN.
+ * In this case rBuf[] contains a valid STRING/TOKEN/NUMBER. But in the
+ * oth * case the next token must be read from the input.
+ */
+ if (pushToken == EOF_TOKEN)
+ return EOF_TOKEN;
+ else if (pushToken == LOCK_TOKEN) {
+ /*
+ * eol_seen is only set for the first token after a newline.
+ */
+ eol_seen = 0;
+
+ c = configBuf[configPos];
+
+ /*
+ * Get start of next Token. EOF is handled,
+ * whitespaces are skipped.
+ */
+
+ again:
+ if (!c) {
+ char *ret;
+
+ if (numFiles > 0)
+ ret = xf86getNextLine();
+ else {
+ if (builtinConfig[builtinIndex] == NULL)
+ ret = NULL;
+ else {
+ strlcpy(configBuf,
+ builtinConfig[builtinIndex], CONFIG_BUF_LEN);
+ ret = configBuf;
+ builtinIndex++;
+ }
+ }
+ if (ret == NULL) {
+ /*
+ * if necessary, move to the next file and
+ * read the first line
+ */
+ if (curFileIndex + 1 < numFiles) {
+ curFileIndex++;
+ configLineNo = 0;
+ goto again;
+ }
+ else
+ return pushToken = EOF_TOKEN;
+ }
+ configLineNo++;
+ configPos = 0;
+ eol_seen = 1;
+ }
+
+ i = 0;
+ for (;;) {
+ c = configBuf[configPos++];
+ configRBuf[i++] = c;
+ switch (c) {
+ case ' ':
+ case '\t':
+ case '\r':
+ continue;
+ case '\n':
+ i = 0;
+ continue;
+ }
+ break;
+ }
+ if (c == '\0')
+ goto again;
+
+ if (c == '#') {
+ do {
+ configRBuf[i++] = (c = configBuf[configPos++]);
+ }
+ while ((c != '\n') && (c != '\r') && (c != '\0'));
+ configRBuf[i] = '\0';
+ /* XXX no private copy.
+ * Use xf86addComment when setting a comment.
+ */
+ val.str = configRBuf;
+ return COMMENT;
+ }
+
+ /* GJA -- handle '-' and ',' * Be careful: "-hsync" is a keyword. */
+ else if ((c == ',') && !isalpha(configBuf[configPos])) {
+ return COMMA;
+ }
+ else if ((c == '-') && !isalpha(configBuf[configPos])) {
+ return DASH;
+ }
+
+ /*
+ * Numbers are returned immediately ...
+ */
+ if (isdigit(c)) {
+ int base;
+
+ if (c == '0')
+ if ((configBuf[configPos] == 'x') ||
+ (configBuf[configPos] == 'X')) {
+ base = 16;
+ val.numType = PARSE_HEX;
+ }
+ else {
+ base = 8;
+ val.numType = PARSE_OCTAL;
+ }
+ else {
+ base = 10;
+ val.numType = PARSE_DECIMAL;
+ }
+
+ configRBuf[0] = c;
+ i = 1;
+ while (isdigit(c = configBuf[configPos++]) ||
+ (c == '.') || (c == 'x') || (c == 'X') ||
+ ((base == 16) && (((c >= 'a') && (c <= 'f')) ||
+ ((c >= 'A') && (c <= 'F')))))
+ configRBuf[i++] = c;
+ configPos--; /* GJA -- one too far */
+ configRBuf[i] = '\0';
+ val.num = strtoul(configRBuf, NULL, 0);
+ val.realnum = atof(configRBuf);
+ return NUMBER;
+ }
+
+ /*
+ * All Strings START with a \" ...
+ */
+ else if (c == '\"') {
+ i = -1;
+ do {
+ configRBuf[++i] = (c = configBuf[configPos++]);
+ }
+ while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0'));
+ configRBuf[i] = '\0';
+ val.str = malloc(strlen(configRBuf) + 1);
+ strcpy(val.str, configRBuf); /* private copy ! */
+ return STRING;
+ }
+
+ /*
+ * ... and now we MUST have a valid token. The search is
+ * handled later along with the pushed tokens.
+ */
+ else {
+ configRBuf[0] = c;
+ i = 0;
+ do {
+ configRBuf[++i] = (c = configBuf[configPos++]);
+ }
+ while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r') &&
+ (c != '\0') && (c != '#'));
+ --configPos;
+ configRBuf[i] = '\0';
+ i = 0;
+ }
+
+ }
+ else {
+
+ /*
+ * Here we deal with pushed tokens. Reinitialize pushToken again. If
+ * the pushed token was NUMBER || STRING return them again ...
+ */
+ int temp = pushToken;
+
+ pushToken = LOCK_TOKEN;
+
+ if (temp == COMMA || temp == DASH)
+ return temp;
+ if (temp == NUMBER || temp == STRING)
+ return temp;
+ }
+
+ /*
+ * Joop, at last we have to lookup the token ...
+ */
+ if (tab) {
+ i = 0;
+ while (tab[i].token != -1)
+ if (xf86nameCompare(configRBuf, tab[i].name) == 0)
+ return tab[i].token;
+ else
+ i++;
+ }
+
+ return ERROR_TOKEN; /* Error catcher */
}
int
-xf86getSubToken (char **comment)
+xf86getSubToken(char **comment)
{
- int token;
-
- for (;;) {
- token = xf86getToken(NULL);
- if (token == COMMENT) {
- if (comment)
- *comment = xf86addComment(*comment, val.str);
- }
- else
- return token;
- }
- /*NOTREACHED*/
-}
+ int token;
+
+ for (;;) {
+ token = xf86getToken(NULL);
+ if (token == COMMENT) {
+ if (comment)
+ *comment = xf86addComment(*comment, val.str);
+ }
+ else
+ return token;
+ }
+ /*NOTREACHED*/}
int
-xf86getSubTokenWithTab (char **comment, xf86ConfigSymTabRec *tab)
+xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec * tab)
{
- int token;
-
- for (;;) {
- token = xf86getToken(tab);
- if (token == COMMENT) {
- if (comment)
- *comment = xf86addComment(*comment, val.str);
- }
- else
- return token;
- }
- /*NOTREACHED*/
-}
+ int token;
+
+ for (;;) {
+ token = xf86getToken(tab);
+ if (token == COMMENT) {
+ if (comment)
+ *comment = xf86addComment(*comment, val.str);
+ }
+ else
+ return token;
+ }
+ /*NOTREACHED*/}
void
-xf86unGetToken (int token)
+xf86unGetToken(int token)
{
- pushToken = token;
+ pushToken = token;
}
char *
-xf86tokenString (void)
+xf86tokenString(void)
{
- return configRBuf;
+ return configRBuf;
}
int
xf86pathIsAbsolute(const char *path)
{
- if (path && path[0] == '/')
- return 1;
- return 0;
+ if (path && path[0] == '/')
+ return 1;
+ return 0;
}
/* A path is "safe" if it is relative and if it contains no ".." elements. */
int
xf86pathIsSafe(const char *path)
{
- if (xf86pathIsAbsolute(path))
- return 0;
+ if (xf86pathIsAbsolute(path))
+ return 0;
- /* Compare with ".." */
- if (!strcmp(path, ".."))
- return 0;
+ /* Compare with ".." */
+ if (!strcmp(path, ".."))
+ return 0;
- /* Look for leading "../" */
- if (!strncmp(path, "../", 3))
- return 0;
+ /* Look for leading "../" */
+ if (!strncmp(path, "../", 3))
+ return 0;
- /* Look for trailing "/.." */
- if ((strlen(path) > 3) && !strcmp(path + strlen(path) - 3, "/.."))
- return 0;
+ /* Look for trailing "/.." */
+ if ((strlen(path) > 3) && !strcmp(path + strlen(path) - 3, "/.."))
+ return 0;
- /* Look for "/../" */
- if (strstr(path, "/../"))
- return 0;
+ /* Look for "/../" */
+ if (strstr(path, "/../"))
+ return 0;
- return 1;
+ return 1;
}
/*
@@ -596,129 +584,136 @@ xf86pathIsSafe(const char *path)
static char *
DoSubstitution(const char *template, const char *cmdline, const char *projroot,
- int *cmdlineUsed, int *envUsed,
- const char *XConfigFile)
+ int *cmdlineUsed, int *envUsed, const char *XConfigFile)
{
- char *result;
- int i, l;
- static const char *env = NULL;
- static char *hostname = NULL;
-
- if (!template)
- return NULL;
-
- if (cmdlineUsed)
- *cmdlineUsed = 0;
- if (envUsed)
- *envUsed = 0;
-
- result = malloc(PATH_MAX + 1);
- l = 0;
- for (i = 0; template[i]; i++) {
- if (template[i] != '%') {
- result[l++] = template[i];
- CHECK_LENGTH;
- } else {
- switch (template[++i]) {
- case 'A':
- if (cmdline && xf86pathIsAbsolute(cmdline)) {
- APPEND_STR(cmdline);
- if (cmdlineUsed)
- *cmdlineUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'R':
- if (cmdline && !xf86pathIsAbsolute(cmdline)) {
- APPEND_STR(cmdline);
- if (cmdlineUsed)
- *cmdlineUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'S':
- if (cmdline && xf86pathIsSafe(cmdline)) {
- APPEND_STR(cmdline);
- if (cmdlineUsed)
- *cmdlineUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'X':
- APPEND_STR(XConfigFile);
- break;
- case 'H':
- if (!hostname) {
- if ((hostname = malloc(MAXHOSTNAMELEN + 1))) {
- if (gethostname(hostname, MAXHOSTNAMELEN) == 0) {
- hostname[MAXHOSTNAMELEN] = '\0';
- } else {
- free(hostname);
- hostname = NULL;
- }
- }
- }
- if (hostname)
- APPEND_STR(hostname);
- break;
- case 'E':
- if (!env)
- env = getenv(XCONFENV);
- if (env && xf86pathIsAbsolute(env)) {
- APPEND_STR(env);
- if (envUsed)
- *envUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'F':
- if (!env)
- env = getenv(XCONFENV);
- if (env && !xf86pathIsAbsolute(env)) {
- APPEND_STR(env);
- if (envUsed)
- *envUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'G':
- if (!env)
- env = getenv(XCONFENV);
- if (env && xf86pathIsSafe(env)) {
- APPEND_STR(env);
- if (envUsed)
- *envUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'P':
- if (projroot && xf86pathIsAbsolute(projroot))
- APPEND_STR(projroot);
- else
- BAIL_OUT;
- break;
- case 'C':
- APPEND_STR(SYSCONFDIR);
- break;
- case 'D':
- APPEND_STR(DATADIR);
- break;
- case '%':
- result[l++] = '%';
- CHECK_LENGTH;
- break;
- default:
- fprintf(stderr, "invalid escape %%%c found in path template\n",
- template[i]);
- BAIL_OUT;
- break;
- }
- }
- }
+ char *result;
+ int i, l;
+ static const char *env = NULL;
+ static char *hostname = NULL;
+
+ if (!template)
+ return NULL;
+
+ if (cmdlineUsed)
+ *cmdlineUsed = 0;
+ if (envUsed)
+ *envUsed = 0;
+
+ result = malloc(PATH_MAX + 1);
+ l = 0;
+ for (i = 0; template[i]; i++) {
+ if (template[i] != '%') {
+ result[l++] = template[i];
+ CHECK_LENGTH;
+ }
+ else {
+ switch (template[++i]) {
+ case 'A':
+ if (cmdline && xf86pathIsAbsolute(cmdline)) {
+ APPEND_STR(cmdline);
+ if (cmdlineUsed)
+ *cmdlineUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'R':
+ if (cmdline && !xf86pathIsAbsolute(cmdline)) {
+ APPEND_STR(cmdline);
+ if (cmdlineUsed)
+ *cmdlineUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'S':
+ if (cmdline && xf86pathIsSafe(cmdline)) {
+ APPEND_STR(cmdline);
+ if (cmdlineUsed)
+ *cmdlineUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'X':
+ APPEND_STR(XConfigFile);
+ break;
+ case 'H':
+ if (!hostname) {
+ if ((hostname = malloc(MAXHOSTNAMELEN + 1))) {
+ if (gethostname(hostname, MAXHOSTNAMELEN) == 0) {
+ hostname[MAXHOSTNAMELEN] = '\0';
+ }
+ else {
+ free(hostname);
+ hostname = NULL;
+ }
+ }
+ }
+ if (hostname)
+ APPEND_STR(hostname);
+ break;
+ case 'E':
+ if (!env)
+ env = getenv(XCONFENV);
+ if (env && xf86pathIsAbsolute(env)) {
+ APPEND_STR(env);
+ if (envUsed)
+ *envUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'F':
+ if (!env)
+ env = getenv(XCONFENV);
+ if (env && !xf86pathIsAbsolute(env)) {
+ APPEND_STR(env);
+ if (envUsed)
+ *envUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'G':
+ if (!env)
+ env = getenv(XCONFENV);
+ if (env && xf86pathIsSafe(env)) {
+ APPEND_STR(env);
+ if (envUsed)
+ *envUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'P':
+ if (projroot && xf86pathIsAbsolute(projroot))
+ APPEND_STR(projroot);
+ else
+ BAIL_OUT;
+ break;
+ case 'C':
+ APPEND_STR(SYSCONFDIR);
+ break;
+ case 'D':
+ APPEND_STR(DATADIR);
+ break;
+ case '%':
+ result[l++] = '%';
+ CHECK_LENGTH;
+ break;
+ default:
+ fprintf(stderr, "invalid escape %%%c found in path template\n",
+ template[i]);
+ BAIL_OUT;
+ break;
+ }
+ }
+ }
#ifdef DEBUG
- fprintf(stderr, "Converted `%s' to `%s'\n", template, result);
+ fprintf(stderr, "Converted `%s' to `%s'\n", template, result);
#endif
- return result;
+ return result;
}
/*
@@ -726,40 +721,40 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
*/
static char *
OpenConfigFile(const char *path, const char *cmdline, const char *projroot,
- const char *confname)
+ const char *confname)
{
- char *filepath = NULL;
- char *pathcopy;
- const char *template;
- int cmdlineUsed = 0;
- FILE *file = NULL;
-
- pathcopy = strdup(path);
- for (template = strtok(pathcopy, ","); template && !file;
- template = strtok(NULL, ",")) {
- filepath = DoSubstitution(template, cmdline, projroot,
- &cmdlineUsed, NULL, confname);
- if (!filepath)
- continue;
- if (cmdline && !cmdlineUsed) {
- free(filepath);
- filepath = NULL;
- continue;
- }
- file = fopen(filepath, "r");
- if (!file) {
- free(filepath);
- filepath = NULL;
- }
- }
-
- free(pathcopy);
- if (file) {
- configFiles[numFiles].file = file;
- configFiles[numFiles].path = strdup(filepath);
- numFiles++;
- }
- return filepath;
+ char *filepath = NULL;
+ char *pathcopy;
+ const char *template;
+ int cmdlineUsed = 0;
+ FILE *file = NULL;
+
+ pathcopy = strdup(path);
+ for (template = strtok(pathcopy, ","); template && !file;
+ template = strtok(NULL, ",")) {
+ filepath = DoSubstitution(template, cmdline, projroot,
+ &cmdlineUsed, NULL, confname);
+ if (!filepath)
+ continue;
+ if (cmdline && !cmdlineUsed) {
+ free(filepath);
+ filepath = NULL;
+ continue;
+ }
+ file = fopen(filepath, "r");
+ if (!file) {
+ free(filepath);
+ filepath = NULL;
+ }
+ }
+
+ free(pathcopy);
+ if (file) {
+ configFiles[numFiles].file = file;
+ configFiles[numFiles].path = strdup(filepath);
+ numFiles++;
+ }
+ return filepath;
}
/*
@@ -769,56 +764,54 @@ OpenConfigFile(const char *path, const char *cmdline, const char *projroot,
static int
ConfigFilter(const struct dirent *de)
{
- const char *name = de->d_name;
- size_t len;
- size_t suflen = strlen(XCONFIGSUFFIX);
-
- if (!name || name[0] == '.')
- return 0;
- len = strlen(name);
- if(len <= suflen)
- return 0;
- if (strcmp(&name[len-suflen], XCONFIGSUFFIX) != 0)
- return 0;
- return 1;
+ const char *name = de->d_name;
+ size_t len;
+ size_t suflen = strlen(XCONFIGSUFFIX);
+
+ if (!name || name[0] == '.')
+ return 0;
+ len = strlen(name);
+ if (len <= suflen)
+ return 0;
+ if (strcmp(&name[len - suflen], XCONFIGSUFFIX) != 0)
+ return 0;
+ return 1;
}
static Bool
AddConfigDirFiles(const char *dirpath, struct dirent **list, int num)
{
- int i;
- Bool openedFile = FALSE;
- Bool warnOnce = FALSE;
-
- for (i = 0; i < num; i++) {
- char *path;
- FILE *file;
-
- if (numFiles >= CONFIG_MAX_FILES) {
- if (!warnOnce) {
- ErrorF("Maximum number of configuration "
- "files opened\n");
- warnOnce = TRUE;
- }
- continue;
- }
-
- path = malloc(PATH_MAX + 1);
- snprintf(path, PATH_MAX + 1, "%s/%s", dirpath,
- list[i]->d_name);
- file = fopen(path, "r");
- if (!file) {
- free(path);
- continue;
- }
- openedFile = TRUE;
-
- configFiles[numFiles].file = file;
- configFiles[numFiles].path = path;
- numFiles++;
- }
-
- return openedFile;
+ int i;
+ Bool openedFile = FALSE;
+ Bool warnOnce = FALSE;
+
+ for (i = 0; i < num; i++) {
+ char *path;
+ FILE *file;
+
+ if (numFiles >= CONFIG_MAX_FILES) {
+ if (!warnOnce) {
+ ErrorF("Maximum number of configuration " "files opened\n");
+ warnOnce = TRUE;
+ }
+ continue;
+ }
+
+ path = malloc(PATH_MAX + 1);
+ snprintf(path, PATH_MAX + 1, "%s/%s", dirpath, list[i]->d_name);
+ file = fopen(path, "r");
+ if (!file) {
+ free(path);
+ continue;
+ }
+ openedFile = TRUE;
+
+ configFiles[numFiles].file = file;
+ configFiles[numFiles].path = path;
+ numFiles++;
+ }
+
+ return openedFile;
}
/*
@@ -827,47 +820,47 @@ AddConfigDirFiles(const char *dirpath, struct dirent **list, int num)
*/
static char *
OpenConfigDir(const char *path, const char *cmdline, const char *projroot,
- const char *confname)
+ const char *confname)
{
- char *dirpath, *pathcopy;
- const char *template;
- Bool found = FALSE;
- int cmdlineUsed = 0;
-
- pathcopy = strdup(path);
- for (template = strtok(pathcopy, ","); template && !found;
- template = strtok(NULL, ",")) {
- struct dirent **list = NULL;
- int num;
-
- dirpath = DoSubstitution(template, cmdline, projroot,
- &cmdlineUsed, NULL, confname);
- if (!dirpath)
- continue;
- if (cmdline && !cmdlineUsed) {
- free(dirpath);
- dirpath = NULL;
- continue;
- }
-
- /* match files named *.conf */
- num = scandir(dirpath, &list, ConfigFilter, alphasort);
- if (num < 0) {
- list = NULL;
- num = 0;
- }
- found = AddConfigDirFiles(dirpath, list, num);
- if (!found) {
- free(dirpath);
- dirpath = NULL;
- }
- while (num--)
- free(list[num]);
- free(list);
- }
-
- free(pathcopy);
- return dirpath;
+ char *dirpath, *pathcopy;
+ const char *template;
+ Bool found = FALSE;
+ int cmdlineUsed = 0;
+
+ pathcopy = strdup(path);
+ for (template = strtok(pathcopy, ","); template && !found;
+ template = strtok(NULL, ",")) {
+ struct dirent **list = NULL;
+ int num;
+
+ dirpath = DoSubstitution(template, cmdline, projroot,
+ &cmdlineUsed, NULL, confname);
+ if (!dirpath)
+ continue;
+ if (cmdline && !cmdlineUsed) {
+ free(dirpath);
+ dirpath = NULL;
+ continue;
+ }
+
+ /* match files named *.conf */
+ num = scandir(dirpath, &list, ConfigFilter, alphasort);
+ if (num < 0) {
+ list = NULL;
+ num = 0;
+ }
+ found = AddConfigDirFiles(dirpath, list, num);
+ if (!found) {
+ free(dirpath);
+ dirpath = NULL;
+ }
+ while (num--)
+ free(list[num]);
+ free(list);
+ }
+
+ free(pathcopy);
+ return dirpath;
}
/*
@@ -876,14 +869,14 @@ OpenConfigDir(const char *path, const char *cmdline, const char *projroot,
void
xf86initConfigFiles(void)
{
- curFileIndex = 0;
- configPos = 0;
- configLineNo = 0;
- pushToken = LOCK_TOKEN;
-
- configBuf = malloc(CONFIG_BUF_LEN);
- configRBuf = malloc(CONFIG_BUF_LEN);
- configBuf[0] = '\0'; /* sanity ... */
+ curFileIndex = 0;
+ configPos = 0;
+ configLineNo = 0;
+ pushToken = LOCK_TOKEN;
+
+ configBuf = malloc(CONFIG_BUF_LEN);
+ configRBuf = malloc(CONFIG_BUF_LEN);
+ configBuf[0] = '\0'; /* sanity ... */
}
/*
@@ -922,13 +915,13 @@ xf86initConfigFiles(void)
char *
xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
{
- if (!path || !path[0])
- path = DEFAULT_CONF_PATH;
- if (!projroot || !projroot[0])
- projroot = PROJECTROOT;
+ if (!path || !path[0])
+ path = DEFAULT_CONF_PATH;
+ if (!projroot || !projroot[0])
+ projroot = PROJECTROOT;
- /* Search for a config file */
- return OpenConfigFile(path, cmdline, projroot, XCONFIGFILE);
+ /* Search for a config file */
+ return OpenConfigFile(path, cmdline, projroot, XCONFIGFILE);
}
/*
@@ -949,82 +942,82 @@ xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
*/
char *
xf86openConfigDirFiles(const char *path, const char *cmdline,
- const char *projroot)
+ const char *projroot)
{
- if (!path || !path[0])
- path = DEFAULT_CONF_PATH;
- if (!projroot || !projroot[0])
- projroot = PROJECTROOT;
+ if (!path || !path[0])
+ path = DEFAULT_CONF_PATH;
+ if (!projroot || !projroot[0])
+ projroot = PROJECTROOT;
- /* Search for the multiconf directory */
- return OpenConfigDir(path, cmdline, projroot, XCONFIGDIR);
+ /* Search for the multiconf directory */
+ return OpenConfigDir(path, cmdline, projroot, XCONFIGDIR);
}
void
-xf86closeConfigFile (void)
+xf86closeConfigFile(void)
{
- int i;
-
- free (configRBuf);
- configRBuf = NULL;
- free (configBuf);
- configBuf = NULL;
-
- if (numFiles == 0) {
- builtinConfig = NULL;
- builtinIndex = 0;
- }
- for (i = 0; i < numFiles; i++) {
- fclose(configFiles[i].file);
- configFiles[i].file = NULL;
- free(configFiles[i].path);
- configFiles[i].path = NULL;
- }
- numFiles = 0;
+ int i;
+
+ free(configRBuf);
+ configRBuf = NULL;
+ free(configBuf);
+ configBuf = NULL;
+
+ if (numFiles == 0) {
+ builtinConfig = NULL;
+ builtinIndex = 0;
+ }
+ for (i = 0; i < numFiles; i++) {
+ fclose(configFiles[i].file);
+ configFiles[i].file = NULL;
+ free(configFiles[i].path);
+ configFiles[i].path = NULL;
+ }
+ numFiles = 0;
}
void
xf86setBuiltinConfig(const char *config[])
{
- builtinConfig = config;
+ builtinConfig = config;
}
void
-xf86parseError (const char *format,...)
+xf86parseError(const char *format, ...)
{
- va_list ap;
- const char *filename = numFiles ? configFiles[curFileIndex].path
- : "<builtin configuration>";
+ va_list ap;
+ const char *filename = numFiles ? configFiles[curFileIndex].path
+ : "<builtin configuration>";
- ErrorF ("Parse error on line %d of section %s in file %s\n\t",
- configLineNo, configSection, filename);
- va_start (ap, format);
- VErrorF (format, ap);
- va_end (ap);
+ ErrorF("Parse error on line %d of section %s in file %s\n\t",
+ configLineNo, configSection, filename);
+ va_start(ap, format);
+ VErrorF(format, ap);
+ va_end(ap);
- ErrorF ("\n");
+ ErrorF("\n");
}
void
-xf86validationError (const char *format,...)
+xf86validationError(const char *format, ...)
{
- va_list ap;
- const char *filename = numFiles ? configFiles[curFileIndex].path
- : "<builtin configuration>";
+ va_list ap;
+ const char *filename = numFiles ? configFiles[curFileIndex].path
+ : "<builtin configuration>";
- ErrorF ("Data incomplete in file %s\n\t", filename);
- va_start (ap, format);
- VErrorF (format, ap);
- va_end (ap);
+ ErrorF("Data incomplete in file %s\n\t", filename);
+ va_start(ap, format);
+ VErrorF(format, ap);
+ va_end(ap);
- ErrorF ("\n");
+ ErrorF("\n");
}
void
-xf86setSection (const char *section)
+xf86setSection(const char *section)
{
- free(configSection);
- configSection = strdup(section);
+ free(configSection);
+ configSection = strdup(section);
}
/*
@@ -1032,145 +1025,143 @@ xf86setSection (const char *section)
* Lookup a string if it is actually a token in disguise.
*/
int
-xf86getStringToken (xf86ConfigSymTabRec * tab)
+xf86getStringToken(xf86ConfigSymTabRec * tab)
{
- return StringToToken (val.str, tab);
+ return StringToToken(val.str, tab);
}
static int
-StringToToken (const char *str, xf86ConfigSymTabRec * tab)
+StringToToken(const char *str, xf86ConfigSymTabRec * tab)
{
- int i;
-
- for (i = 0; tab[i].token != -1; i++)
- {
- if (!xf86nameCompare (tab[i].name, str))
- return tab[i].token;
- }
- return ERROR_TOKEN;
-}
+ int i;
+ for (i = 0; tab[i].token != -1; i++) {
+ if (!xf86nameCompare(tab[i].name, str))
+ return tab[i].token;
+ }
+ return ERROR_TOKEN;
+}
/*
* Compare two names. The characters '_', ' ', and '\t' are ignored
* in the comparison.
*/
int
-xf86nameCompare (const char *s1, const char *s2)
+xf86nameCompare(const char *s1, const char *s2)
{
- char c1, c2;
-
- if (!s1 || *s1 == 0) {
- if (!s2 || *s2 == 0)
- return 0;
- else
- return 1;
- }
-
- while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
- s1++;
- while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
- s2++;
- c1 = (isupper (*s1) ? tolower (*s1) : *s1);
- c2 = (isupper (*s2) ? tolower (*s2) : *s2);
- while (c1 == c2)
- {
- if (c1 == '\0')
- return 0;
- s1++;
- s2++;
- while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
- s1++;
- while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
- s2++;
- c1 = (isupper (*s1) ? tolower (*s1) : *s1);
- c2 = (isupper (*s2) ? tolower (*s2) : *s2);
- }
- return c1 - c2;
+ char c1, c2;
+
+ if (!s1 || *s1 == 0) {
+ if (!s2 || *s2 == 0)
+ return 0;
+ else
+ return 1;
+ }
+
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+ c1 = (isupper(*s1) ? tolower(*s1) : *s1);
+ c2 = (isupper(*s2) ? tolower(*s2) : *s2);
+ while (c1 == c2) {
+ if (c1 == '\0')
+ return 0;
+ s1++;
+ s2++;
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+ c1 = (isupper(*s1) ? tolower(*s1) : *s1);
+ c2 = (isupper(*s2) ? tolower(*s2) : *s2);
+ }
+ return c1 - c2;
}
char *
xf86addComment(char *cur, char *add)
{
- char *str;
- int len, curlen, iscomment, hasnewline = 0, insnewline, endnewline;
-
- if (add == NULL || add[0] == '\0')
- return cur;
-
- if (cur) {
- curlen = strlen(cur);
- if (curlen)
- hasnewline = cur[curlen - 1] == '\n';
- eol_seen = 0;
- }
- else
- curlen = 0;
-
- str = add;
- iscomment = 0;
- while (*str) {
- if (*str != ' ' && *str != '\t')
- break;
- ++str;
- }
- iscomment = (*str == '#');
-
- len = strlen(add);
- endnewline = add[len - 1] == '\n';
-
- insnewline = eol_seen || (curlen && !hasnewline);
- if (insnewline)
- len++;
- if (!iscomment)
- len++;
- if (!endnewline)
- len++;
-
- /* Allocate + 1 char for '\0' terminator. */
- str = realloc(cur, curlen + len + 1);
- if (!str)
- return cur;
-
- cur = str;
-
- if (insnewline)
- cur[curlen++] = '\n';
- if (!iscomment)
- cur[curlen++] = '#';
- strcpy(cur + curlen, add);
- if (!endnewline)
- strcat(cur, "\n");
-
- return cur;
+ char *str;
+ int len, curlen, iscomment, hasnewline = 0, insnewline, endnewline;
+
+ if (add == NULL || add[0] == '\0')
+ return cur;
+
+ if (cur) {
+ curlen = strlen(cur);
+ if (curlen)
+ hasnewline = cur[curlen - 1] == '\n';
+ eol_seen = 0;
+ }
+ else
+ curlen = 0;
+
+ str = add;
+ iscomment = 0;
+ while (*str) {
+ if (*str != ' ' && *str != '\t')
+ break;
+ ++str;
+ }
+ iscomment = (*str == '#');
+
+ len = strlen(add);
+ endnewline = add[len - 1] == '\n';
+
+ insnewline = eol_seen || (curlen && !hasnewline);
+ if (insnewline)
+ len++;
+ if (!iscomment)
+ len++;
+ if (!endnewline)
+ len++;
+
+ /* Allocate + 1 char for '\0' terminator. */
+ str = realloc(cur, curlen + len + 1);
+ if (!str)
+ return cur;
+
+ cur = str;
+
+ if (insnewline)
+ cur[curlen++] = '\n';
+ if (!iscomment)
+ cur[curlen++] = '#';
+ strcpy(cur + curlen, add);
+ if (!endnewline)
+ strcat(cur, "\n");
+
+ return cur;
}
Bool
xf86getBoolValue(Bool *val, const char *str)
{
- if (!val || !str)
- return FALSE;
- if (*str == '\0') {
- *val = TRUE;
- } else {
- if (xf86nameCompare(str, "1") == 0)
- *val = TRUE;
- else if (xf86nameCompare(str, "on") == 0)
- *val = TRUE;
- else if (xf86nameCompare(str, "true") == 0)
- *val = TRUE;
- else if (xf86nameCompare(str, "yes") == 0)
- *val = TRUE;
- else if (xf86nameCompare(str, "0") == 0)
- *val = FALSE;
- else if (xf86nameCompare(str, "off") == 0)
- *val = FALSE;
- else if (xf86nameCompare(str, "false") == 0)
- *val = FALSE;
- else if (xf86nameCompare(str, "no") == 0)
- *val = FALSE;
- else
- return FALSE;
- }
- return TRUE;
+ if (!val || !str)
+ return FALSE;
+ if (*str == '\0') {
+ *val = TRUE;
+ }
+ else {
+ if (xf86nameCompare(str, "1") == 0)
+ *val = TRUE;
+ else if (xf86nameCompare(str, "on") == 0)
+ *val = TRUE;
+ else if (xf86nameCompare(str, "true") == 0)
+ *val = TRUE;
+ else if (xf86nameCompare(str, "yes") == 0)
+ *val = TRUE;
+ else if (xf86nameCompare(str, "0") == 0)
+ *val = FALSE;
+ else if (xf86nameCompare(str, "off") == 0)
+ *val = FALSE;
+ else if (xf86nameCompare(str, "false") == 0)
+ *val = FALSE;
+ else if (xf86nameCompare(str, "no") == 0)
+ *val = FALSE;
+ else
+ return FALSE;
+ }
+ return TRUE;
}
diff --git a/xorg-server/hw/xfree86/parser/write.c b/xorg-server/hw/xfree86/parser/write.c
index fe51ee7f5..c001c3d51 100644
--- a/xorg-server/hw/xfree86/parser/write.c
+++ b/xorg-server/hw/xfree86/parser/write.c
@@ -1,216 +1,205 @@
-/*
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-#include <errno.h>
-
-#if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED)
-#define HAS_SAVED_IDS_AND_SETEUID
-#endif
-#if defined(WIN32)
-#define HAS_NO_UIDS
-#endif
-
-#ifdef HAS_NO_UIDS
-#define doWriteConfigFile xf86writeConfigFile
-#define Local /**/
-#else
-#define Local static
-#endif
-
-Local int
-doWriteConfigFile (const char *filename, XF86ConfigPtr cptr)
-{
- FILE *cf;
-
- if ((cf = fopen (filename, "w")) == NULL)
- {
- return 0;
- }
-
- if (cptr->conf_comment)
- fprintf (cf, "%s\n", cptr->conf_comment);
-
- xf86printLayoutSection (cf, cptr->conf_layout_lst);
-
- if (cptr->conf_files != NULL)
- {
- fprintf (cf, "Section \"Files\"\n");
- xf86printFileSection (cf, cptr->conf_files);
- fprintf (cf, "EndSection\n\n");
- }
-
- if (cptr->conf_modules != NULL)
- {
- fprintf (cf, "Section \"Module\"\n");
- xf86printModuleSection (cf, cptr->conf_modules);
- fprintf (cf, "EndSection\n\n");
- }
-
- xf86printVendorSection (cf, cptr->conf_vendor_lst);
-
- xf86printServerFlagsSection (cf, cptr->conf_flags);
-
- xf86printInputSection (cf, cptr->conf_input_lst);
-
- xf86printInputClassSection (cf, cptr->conf_inputclass_lst);
-
- xf86printVideoAdaptorSection (cf, cptr->conf_videoadaptor_lst);
-
- xf86printModesSection (cf, cptr->conf_modes_lst);
-
- xf86printMonitorSection (cf, cptr->conf_monitor_lst);
-
- xf86printDeviceSection (cf, cptr->conf_device_lst);
-
- xf86printScreenSection (cf, cptr->conf_screen_lst);
-
- xf86printDRISection (cf, cptr->conf_dri);
-
- xf86printExtensionsSection (cf, cptr->conf_extensions);
-
- fclose(cf);
- return 1;
-}
-
-#ifndef HAS_NO_UIDS
-
-int
-xf86writeConfigFile (const char *filename, XF86ConfigPtr cptr)
-{
- int ret;
-
-#if !defined(HAS_SAVED_IDS_AND_SETEUID)
- int pid, p;
- int status;
- void (*csig)(int);
-#else
- int ruid, euid;
-#endif
-
- if (getuid() != geteuid())
- {
-
-#if !defined(HAS_SAVED_IDS_AND_SETEUID)
- /* Need to fork to change ruid without loosing euid */
- csig = signal(SIGCHLD, SIG_DFL);
- switch ((pid = fork()))
- {
- case -1:
- ErrorF("xf86writeConfigFile(): fork failed (%s)\n",
- strerror(errno));
- return 0;
- case 0: /* child */
- if (setuid(getuid()) == -1)
- FatalError("xf86writeConfigFile(): "
- "setuid failed(%s)\n",
- strerror(errno));
- ret = doWriteConfigFile(filename, cptr);
- exit(ret);
- break;
- default: /* parent */
- do
- {
- p = waitpid(pid, &status, 0);
- } while (p == -1 && errno == EINTR);
- }
- signal(SIGCHLD, csig);
- if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
- return 1; /* success */
- else
- return 0;
-
-#else /* HAS_SAVED_IDS_AND_SETEUID */
-
- ruid = getuid();
- euid = geteuid();
-
- if (seteuid(ruid) == -1)
- {
- ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
- ruid, strerror(errno));
- return 0;
- }
- ret = doWriteConfigFile(filename, cptr);
-
- if (seteuid(euid) == -1)
- {
- ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
- euid, strerror(errno));
- }
- return ret;
-
-#endif /* HAS_SAVED_IDS_AND_SETEUID */
-
- }
- else
- {
- return doWriteConfigFile(filename, cptr);
- }
-}
-
-#endif /* !HAS_NO_UIDS */
+/*
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <errno.h>
+
+#if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED)
+#define HAS_SAVED_IDS_AND_SETEUID
+#endif
+#if defined(WIN32)
+#define HAS_NO_UIDS
+#endif
+
+#ifdef HAS_NO_UIDS
+#define doWriteConfigFile xf86writeConfigFile
+#define Local /**/
+#else
+#define Local static
+#endif
+
+Local int
+doWriteConfigFile(const char *filename, XF86ConfigPtr cptr)
+{
+ FILE *cf;
+
+ if ((cf = fopen(filename, "w")) == NULL) {
+ return 0;
+ }
+
+ if (cptr->conf_comment)
+ fprintf(cf, "%s\n", cptr->conf_comment);
+
+ xf86printLayoutSection(cf, cptr->conf_layout_lst);
+
+ if (cptr->conf_files != NULL) {
+ fprintf(cf, "Section \"Files\"\n");
+ xf86printFileSection(cf, cptr->conf_files);
+ fprintf(cf, "EndSection\n\n");
+ }
+
+ if (cptr->conf_modules != NULL) {
+ fprintf(cf, "Section \"Module\"\n");
+ xf86printModuleSection(cf, cptr->conf_modules);
+ fprintf(cf, "EndSection\n\n");
+ }
+
+ xf86printVendorSection(cf, cptr->conf_vendor_lst);
+
+ xf86printServerFlagsSection(cf, cptr->conf_flags);
+
+ xf86printInputSection(cf, cptr->conf_input_lst);
+
+ xf86printInputClassSection(cf, cptr->conf_inputclass_lst);
+
+ xf86printVideoAdaptorSection(cf, cptr->conf_videoadaptor_lst);
+
+ xf86printModesSection(cf, cptr->conf_modes_lst);
+
+ xf86printMonitorSection(cf, cptr->conf_monitor_lst);
+
+ xf86printDeviceSection(cf, cptr->conf_device_lst);
+
+ xf86printScreenSection(cf, cptr->conf_screen_lst);
+
+ xf86printDRISection(cf, cptr->conf_dri);
+
+ xf86printExtensionsSection(cf, cptr->conf_extensions);
+
+ fclose(cf);
+ return 1;
+}
+
+#ifndef HAS_NO_UIDS
+
+int
+xf86writeConfigFile(const char *filename, XF86ConfigPtr cptr)
+{
+ int ret;
+
+#if !defined(HAS_SAVED_IDS_AND_SETEUID)
+ int pid, p;
+ int status;
+ void (*csig) (int);
+#else
+ int ruid, euid;
+#endif
+
+ if (getuid() != geteuid()) {
+
+#if !defined(HAS_SAVED_IDS_AND_SETEUID)
+ /* Need to fork to change ruid without loosing euid */
+ csig = signal(SIGCHLD, SIG_DFL);
+ switch ((pid = fork())) {
+ case -1:
+ ErrorF("xf86writeConfigFile(): fork failed (%s)\n",
+ strerror(errno));
+ return 0;
+ case 0: /* child */
+ if (setuid(getuid()) == -1)
+ FatalError("xf86writeConfigFile(): "
+ "setuid failed(%s)\n", strerror(errno));
+ ret = doWriteConfigFile(filename, cptr);
+ exit(ret);
+ break;
+ default: /* parent */
+ do {
+ p = waitpid(pid, &status, 0);
+ } while (p == -1 && errno == EINTR);
+ }
+ signal(SIGCHLD, csig);
+ if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
+ return 1; /* success */
+ else
+ return 0;
+
+#else /* HAS_SAVED_IDS_AND_SETEUID */
+
+ ruid = getuid();
+ euid = geteuid();
+
+ if (seteuid(ruid) == -1) {
+ ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
+ ruid, strerror(errno));
+ return 0;
+ }
+ ret = doWriteConfigFile(filename, cptr);
+
+ if (seteuid(euid) == -1) {
+ ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
+ euid, strerror(errno));
+ }
+ return ret;
+
+#endif /* HAS_SAVED_IDS_AND_SETEUID */
+
+ }
+ else {
+ return doWriteConfigFile(filename, cptr);
+ }
+}
+
+#endif /* !HAS_NO_UIDS */
diff --git a/xorg-server/hw/xfree86/parser/xf86Optrec.h b/xorg-server/hw/xfree86/parser/xf86Optrec.h
index b8e9d6192..ea0cb1329 100644
--- a/xorg-server/hw/xfree86/parser/xf86Optrec.h
+++ b/xorg-server/hw/xfree86/parser/xf86Optrec.h
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/*
* This file contains the Option Record that is passed between the Parser,
* and Module setup procs.
@@ -69,21 +68,26 @@
#include <X11/Xfuncproto.h>
-extern _X_EXPORT XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *val);
+extern _X_EXPORT XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name,
+ char *val);
extern _X_EXPORT XF86OptionPtr xf86optionListDup(XF86OptionPtr opt);
extern _X_EXPORT void xf86optionListFree(XF86OptionPtr opt);
extern _X_EXPORT char *xf86optionName(XF86OptionPtr opt);
extern _X_EXPORT char *xf86optionValue(XF86OptionPtr opt);
extern _X_EXPORT XF86OptionPtr xf86newOption(char *name, char *value);
extern _X_EXPORT XF86OptionPtr xf86nextOption(XF86OptionPtr list);
-extern _X_EXPORT XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *name);
-extern _X_EXPORT const char *xf86findOptionValue(XF86OptionPtr list, const char *name);
-extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options, int count, int used);
-extern _X_EXPORT XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
-extern _X_EXPORT int xf86nameCompare (const char *s1, const char *s2);
+extern _X_EXPORT XF86OptionPtr xf86findOption(XF86OptionPtr list,
+ const char *name);
+extern _X_EXPORT const char *xf86findOptionValue(XF86OptionPtr list,
+ const char *name);
+extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options,
+ int count, int used);
+extern _X_EXPORT XF86OptionPtr xf86optionListMerge(XF86OptionPtr head,
+ XF86OptionPtr tail);
+extern _X_EXPORT int xf86nameCompare(const char *s1, const char *s2);
extern _X_EXPORT char *xf86uLongToString(unsigned long i);
extern _X_EXPORT XF86OptionPtr xf86parseOption(XF86OptionPtr head);
-extern _X_EXPORT void xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs);
-
+extern _X_EXPORT void xf86printOptionList(FILE * fp, XF86OptionPtr list,
+ int tabs);
-#endif /* _xf86Optrec_h_ */
+#endif /* _xf86Optrec_h_ */
diff --git a/xorg-server/hw/xfree86/parser/xf86Parser.h b/xorg-server/hw/xfree86/parser/xf86Parser.h
index beac35404..e7210e811 100644
--- a/xorg-server/hw/xfree86/parser/xf86Parser.h
+++ b/xorg-server/hw/xfree86/parser/xf86Parser.h
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/*
* This file contains the external interfaces for the XFree86 configuration
* file parser.
@@ -70,39 +69,33 @@
#define HAVE_PARSER_DECLS
-typedef struct
-{
- char *file_logfile;
- char *file_modulepath;
- char *file_fontpath;
- char *file_comment;
- char *file_xkbdir;
-}
-XF86ConfFilesRec, *XF86ConfFilesPtr;
+typedef struct {
+ char *file_logfile;
+ char *file_modulepath;
+ char *file_fontpath;
+ char *file_comment;
+ char *file_xkbdir;
+} XF86ConfFilesRec, *XF86ConfFilesPtr;
/* Values for load_type */
#define XF86_LOAD_MODULE 0
#define XF86_LOAD_DRIVER 1
#define XF86_DISABLE_MODULE 2
-typedef struct
-{
- GenericListRec list;
- int load_type;
- char *load_name;
- XF86OptionPtr load_opt;
- char *load_comment;
- int ignore;
-}
-XF86LoadRec, *XF86LoadPtr;
-
-typedef struct
-{
- XF86LoadPtr mod_load_lst;
+typedef struct {
+ GenericListRec list;
+ int load_type;
+ char *load_name;
+ XF86OptionPtr load_opt;
+ char *load_comment;
+ int ignore;
+} XF86LoadRec, *XF86LoadPtr;
+
+typedef struct {
+ XF86LoadPtr mod_load_lst;
XF86LoadPtr mod_disable_lst;
- char *mod_comment;
-}
-XF86ConfModuleRec, *XF86ConfModulePtr;
+ char *mod_comment;
+} XF86ConfModuleRec, *XF86ConfModulePtr;
#define CONF_IMPLICIT_KEYBOARD "Implicit Core Keyboard"
@@ -117,258 +110,220 @@ XF86ConfModuleRec, *XF86ConfModulePtr;
#define XF86CONF_CSYNC 0x0040
#define XF86CONF_PCSYNC 0x0080
#define XF86CONF_NCSYNC 0x0100
-#define XF86CONF_HSKEW 0x0200 /* hskew provided */
+#define XF86CONF_HSKEW 0x0200 /* hskew provided */
#define XF86CONF_BCAST 0x0400
#define XF86CONF_VSCAN 0x1000
-typedef struct
-{
- GenericListRec list;
- char *ml_identifier;
- int ml_clock;
- int ml_hdisplay;
- int ml_hsyncstart;
- int ml_hsyncend;
- int ml_htotal;
- int ml_vdisplay;
- int ml_vsyncstart;
- int ml_vsyncend;
- int ml_vtotal;
- int ml_vscan;
- int ml_flags;
- int ml_hskew;
- char *ml_comment;
-}
-XF86ConfModeLineRec, *XF86ConfModeLinePtr;
-
-typedef struct
-{
- GenericListRec list;
- char *vp_identifier;
- XF86OptionPtr vp_option_lst;
- char *vp_comment;
-}
-XF86ConfVideoPortRec, *XF86ConfVideoPortPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *va_identifier;
- char *va_vendor;
- char *va_board;
- char *va_busid;
- char *va_driver;
- XF86OptionPtr va_option_lst;
- XF86ConfVideoPortPtr va_port_lst;
- char *va_fwdref;
- char *va_comment;
-}
-XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr;
+typedef struct {
+ GenericListRec list;
+ char *ml_identifier;
+ int ml_clock;
+ int ml_hdisplay;
+ int ml_hsyncstart;
+ int ml_hsyncend;
+ int ml_htotal;
+ int ml_vdisplay;
+ int ml_vsyncstart;
+ int ml_vsyncend;
+ int ml_vtotal;
+ int ml_vscan;
+ int ml_flags;
+ int ml_hskew;
+ char *ml_comment;
+} XF86ConfModeLineRec, *XF86ConfModeLinePtr;
+
+typedef struct {
+ GenericListRec list;
+ char *vp_identifier;
+ XF86OptionPtr vp_option_lst;
+ char *vp_comment;
+} XF86ConfVideoPortRec, *XF86ConfVideoPortPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *va_identifier;
+ char *va_vendor;
+ char *va_board;
+ char *va_busid;
+ char *va_driver;
+ XF86OptionPtr va_option_lst;
+ XF86ConfVideoPortPtr va_port_lst;
+ char *va_fwdref;
+ char *va_comment;
+} XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr;
#define CONF_MAX_HSYNC 8
#define CONF_MAX_VREFRESH 8
-typedef struct
-{
- float hi, lo;
-}
-parser_range;
-
-typedef struct
-{
- int red, green, blue;
-}
-parser_rgb;
-
-typedef struct
-{
- GenericListRec list;
- char *modes_identifier;
- XF86ConfModeLinePtr mon_modeline_lst;
- char *modes_comment;
-}
-XF86ConfModesRec, *XF86ConfModesPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *ml_modes_str;
- XF86ConfModesPtr ml_modes;
-}
-XF86ConfModesLinkRec, *XF86ConfModesLinkPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *mon_identifier;
- char *mon_vendor;
- char *mon_modelname;
- int mon_width; /* in mm */
- int mon_height; /* in mm */
- XF86ConfModeLinePtr mon_modeline_lst;
- int mon_n_hsync;
- parser_range mon_hsync[CONF_MAX_HSYNC];
- int mon_n_vrefresh;
- parser_range mon_vrefresh[CONF_MAX_VREFRESH];
- float mon_gamma_red;
- float mon_gamma_green;
- float mon_gamma_blue;
- XF86OptionPtr mon_option_lst;
- XF86ConfModesLinkPtr mon_modes_sect_lst;
- char *mon_comment;
-}
-XF86ConfMonitorRec, *XF86ConfMonitorPtr;
+typedef struct {
+ float hi, lo;
+} parser_range;
+
+typedef struct {
+ int red, green, blue;
+} parser_rgb;
+
+typedef struct {
+ GenericListRec list;
+ char *modes_identifier;
+ XF86ConfModeLinePtr mon_modeline_lst;
+ char *modes_comment;
+} XF86ConfModesRec, *XF86ConfModesPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *ml_modes_str;
+ XF86ConfModesPtr ml_modes;
+} XF86ConfModesLinkRec, *XF86ConfModesLinkPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *mon_identifier;
+ char *mon_vendor;
+ char *mon_modelname;
+ int mon_width; /* in mm */
+ int mon_height; /* in mm */
+ XF86ConfModeLinePtr mon_modeline_lst;
+ int mon_n_hsync;
+ parser_range mon_hsync[CONF_MAX_HSYNC];
+ int mon_n_vrefresh;
+ parser_range mon_vrefresh[CONF_MAX_VREFRESH];
+ float mon_gamma_red;
+ float mon_gamma_green;
+ float mon_gamma_blue;
+ XF86OptionPtr mon_option_lst;
+ XF86ConfModesLinkPtr mon_modes_sect_lst;
+ char *mon_comment;
+} XF86ConfMonitorRec, *XF86ConfMonitorPtr;
#define CONF_MAXDACSPEEDS 4
#define CONF_MAXCLOCKS 128
-typedef struct
-{
- GenericListRec list;
- char *dev_identifier;
- char *dev_vendor;
- char *dev_board;
- char *dev_chipset;
- char *dev_busid;
- char *dev_card;
- char *dev_driver;
- char *dev_ramdac;
- int dev_dacSpeeds[CONF_MAXDACSPEEDS];
- int dev_videoram;
- int dev_textclockfreq;
- unsigned long dev_bios_base;
- unsigned long dev_mem_base;
- unsigned long dev_io_base;
- char *dev_clockchip;
- int dev_clocks;
- int dev_clock[CONF_MAXCLOCKS];
- int dev_chipid;
- int dev_chiprev;
- int dev_irq;
- int dev_screen;
- XF86OptionPtr dev_option_lst;
- char *dev_comment;
-}
-XF86ConfDeviceRec, *XF86ConfDevicePtr;
-
-typedef struct
-{
- GenericListRec list;
- char *mode_name;
-}
-XF86ModeRec, *XF86ModePtr;
-
-typedef struct
-{
- GenericListRec list;
- int disp_frameX0;
- int disp_frameY0;
- int disp_virtualX;
- int disp_virtualY;
- int disp_depth;
- int disp_bpp;
- char *disp_visual;
- parser_rgb disp_weight;
- parser_rgb disp_black;
- parser_rgb disp_white;
- XF86ModePtr disp_mode_lst;
- XF86OptionPtr disp_option_lst;
- char *disp_comment;
-}
-XF86ConfDisplayRec, *XF86ConfDisplayPtr;
-
-typedef struct
-{
- XF86OptionPtr flg_option_lst;
- char *flg_comment;
-}
-XF86ConfFlagsRec, *XF86ConfFlagsPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *al_adaptor_str;
- XF86ConfVideoAdaptorPtr al_adaptor;
-}
-XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *scrn_identifier;
- char *scrn_obso_driver;
- int scrn_defaultdepth;
- int scrn_defaultbpp;
- int scrn_defaultfbbpp;
- char *scrn_monitor_str;
- XF86ConfMonitorPtr scrn_monitor;
- char *scrn_device_str;
- XF86ConfDevicePtr scrn_device;
- XF86ConfAdaptorLinkPtr scrn_adaptor_lst;
- XF86ConfDisplayPtr scrn_display_lst;
- XF86OptionPtr scrn_option_lst;
- char *scrn_comment;
- int scrn_virtualX, scrn_virtualY;
-}
-XF86ConfScreenRec, *XF86ConfScreenPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *inp_identifier;
- char *inp_driver;
- XF86OptionPtr inp_option_lst;
- char *inp_comment;
-}
-XF86ConfInputRec, *XF86ConfInputPtr;
-
-typedef struct
-{
- GenericListRec list;
- XF86ConfInputPtr iref_inputdev;
- char *iref_inputdev_str;
- XF86OptionPtr iref_option_lst;
-}
-XF86ConfInputrefRec, *XF86ConfInputrefPtr;
-
-typedef struct
-{
- Bool set;
- Bool val;
-}
-xf86TriState;
-
-typedef struct
-{
- struct xorg_list entry;
- char **values;
-}
-xf86MatchGroup;
-
-typedef struct
-{
- GenericListRec list;
- char *identifier;
- char *driver;
- struct xorg_list match_product;
- struct xorg_list match_vendor;
- struct xorg_list match_device;
- struct xorg_list match_os;
- struct xorg_list match_pnpid;
- struct xorg_list match_usbid;
- struct xorg_list match_driver;
- struct xorg_list match_tag;
- struct xorg_list match_layout;
- xf86TriState is_keyboard;
- xf86TriState is_pointer;
- xf86TriState is_joystick;
- xf86TriState is_tablet;
- xf86TriState is_touchpad;
- xf86TriState is_touchscreen;
- XF86OptionPtr option_lst;
- char *comment;
-}
-XF86ConfInputClassRec, *XF86ConfInputClassPtr;
+typedef struct {
+ GenericListRec list;
+ char *dev_identifier;
+ char *dev_vendor;
+ char *dev_board;
+ char *dev_chipset;
+ char *dev_busid;
+ char *dev_card;
+ char *dev_driver;
+ char *dev_ramdac;
+ int dev_dacSpeeds[CONF_MAXDACSPEEDS];
+ int dev_videoram;
+ int dev_textclockfreq;
+ unsigned long dev_bios_base;
+ unsigned long dev_mem_base;
+ unsigned long dev_io_base;
+ char *dev_clockchip;
+ int dev_clocks;
+ int dev_clock[CONF_MAXCLOCKS];
+ int dev_chipid;
+ int dev_chiprev;
+ int dev_irq;
+ int dev_screen;
+ XF86OptionPtr dev_option_lst;
+ char *dev_comment;
+} XF86ConfDeviceRec, *XF86ConfDevicePtr;
+
+typedef struct {
+ GenericListRec list;
+ char *mode_name;
+} XF86ModeRec, *XF86ModePtr;
+
+typedef struct {
+ GenericListRec list;
+ int disp_frameX0;
+ int disp_frameY0;
+ int disp_virtualX;
+ int disp_virtualY;
+ int disp_depth;
+ int disp_bpp;
+ char *disp_visual;
+ parser_rgb disp_weight;
+ parser_rgb disp_black;
+ parser_rgb disp_white;
+ XF86ModePtr disp_mode_lst;
+ XF86OptionPtr disp_option_lst;
+ char *disp_comment;
+} XF86ConfDisplayRec, *XF86ConfDisplayPtr;
+
+typedef struct {
+ XF86OptionPtr flg_option_lst;
+ char *flg_comment;
+} XF86ConfFlagsRec, *XF86ConfFlagsPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *al_adaptor_str;
+ XF86ConfVideoAdaptorPtr al_adaptor;
+} XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *scrn_identifier;
+ char *scrn_obso_driver;
+ int scrn_defaultdepth;
+ int scrn_defaultbpp;
+ int scrn_defaultfbbpp;
+ char *scrn_monitor_str;
+ XF86ConfMonitorPtr scrn_monitor;
+ char *scrn_device_str;
+ XF86ConfDevicePtr scrn_device;
+ XF86ConfAdaptorLinkPtr scrn_adaptor_lst;
+ XF86ConfDisplayPtr scrn_display_lst;
+ XF86OptionPtr scrn_option_lst;
+ char *scrn_comment;
+ int scrn_virtualX, scrn_virtualY;
+} XF86ConfScreenRec, *XF86ConfScreenPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *inp_identifier;
+ char *inp_driver;
+ XF86OptionPtr inp_option_lst;
+ char *inp_comment;
+} XF86ConfInputRec, *XF86ConfInputPtr;
+
+typedef struct {
+ GenericListRec list;
+ XF86ConfInputPtr iref_inputdev;
+ char *iref_inputdev_str;
+ XF86OptionPtr iref_option_lst;
+} XF86ConfInputrefRec, *XF86ConfInputrefPtr;
+
+typedef struct {
+ Bool set;
+ Bool val;
+} xf86TriState;
+
+typedef struct {
+ struct xorg_list entry;
+ char **values;
+} xf86MatchGroup;
+
+typedef struct {
+ GenericListRec list;
+ char *identifier;
+ char *driver;
+ struct xorg_list match_product;
+ struct xorg_list match_vendor;
+ struct xorg_list match_device;
+ struct xorg_list match_os;
+ struct xorg_list match_pnpid;
+ struct xorg_list match_usbid;
+ struct xorg_list match_driver;
+ struct xorg_list match_tag;
+ struct xorg_list match_layout;
+ xf86TriState is_keyboard;
+ xf86TriState is_pointer;
+ xf86TriState is_joystick;
+ xf86TriState is_tablet;
+ xf86TriState is_touchpad;
+ xf86TriState is_touchscreen;
+ XF86OptionPtr option_lst;
+ char *comment;
+} XF86ConfInputClassRec, *XF86ConfInputClassPtr;
/* Values for adj_where */
#define CONF_ADJ_OBSOLETE -1
@@ -379,141 +334,135 @@ XF86ConfInputClassRec, *XF86ConfInputClassPtr;
#define CONF_ADJ_BELOW 4
#define CONF_ADJ_RELATIVE 5
-typedef struct
-{
- GenericListRec list;
- int adj_scrnum;
- XF86ConfScreenPtr adj_screen;
- char *adj_screen_str;
- XF86ConfScreenPtr adj_top;
- char *adj_top_str;
- XF86ConfScreenPtr adj_bottom;
- char *adj_bottom_str;
- XF86ConfScreenPtr adj_left;
- char *adj_left_str;
- XF86ConfScreenPtr adj_right;
- char *adj_right_str;
- int adj_where;
- int adj_x;
- int adj_y;
- char *adj_refscreen;
-}
-XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *inactive_device_str;
- XF86ConfDevicePtr inactive_device;
-}
-XF86ConfInactiveRec, *XF86ConfInactivePtr;
-
-typedef struct
-{
- GenericListRec list;
- char *lay_identifier;
- XF86ConfAdjacencyPtr lay_adjacency_lst;
- XF86ConfInactivePtr lay_inactive_lst;
- XF86ConfInputrefPtr lay_input_lst;
- XF86OptionPtr lay_option_lst;
- char *lay_comment;
-}
-XF86ConfLayoutRec, *XF86ConfLayoutPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *vs_name;
- char *vs_identifier;
- XF86OptionPtr vs_option_lst;
- char *vs_comment;
-}
-XF86ConfVendSubRec, *XF86ConfVendSubPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *vnd_identifier;
- XF86OptionPtr vnd_option_lst;
- XF86ConfVendSubPtr vnd_sub_lst;
- char *vnd_comment;
-}
-XF86ConfVendorRec, *XF86ConfVendorPtr;
-
-typedef struct
-{
- char *dri_group_name;
- int dri_group;
- int dri_mode;
- char *dri_comment;
-}
-XF86ConfDRIRec, *XF86ConfDRIPtr;
-
-typedef struct
-{
- XF86OptionPtr ext_option_lst;
- char *extensions_comment;
-}
-XF86ConfExtensionsRec, *XF86ConfExtensionsPtr;
-
-typedef struct
-{
- XF86ConfFilesPtr conf_files;
- XF86ConfModulePtr conf_modules;
- XF86ConfFlagsPtr conf_flags;
- XF86ConfVideoAdaptorPtr conf_videoadaptor_lst;
- XF86ConfModesPtr conf_modes_lst;
- XF86ConfMonitorPtr conf_monitor_lst;
- XF86ConfDevicePtr conf_device_lst;
- XF86ConfScreenPtr conf_screen_lst;
- XF86ConfInputPtr conf_input_lst;
- XF86ConfInputClassPtr conf_inputclass_lst;
- XF86ConfLayoutPtr conf_layout_lst;
- XF86ConfVendorPtr conf_vendor_lst;
- XF86ConfDRIPtr conf_dri;
- XF86ConfExtensionsPtr conf_extensions;
- char *conf_comment;
-}
-XF86ConfigRec, *XF86ConfigPtr;
-
-typedef struct
-{
- int token; /* id of the token */
- const char *name; /* pointer to the LOWERCASED name */
-}
-xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
+typedef struct {
+ GenericListRec list;
+ int adj_scrnum;
+ XF86ConfScreenPtr adj_screen;
+ char *adj_screen_str;
+ XF86ConfScreenPtr adj_top;
+ char *adj_top_str;
+ XF86ConfScreenPtr adj_bottom;
+ char *adj_bottom_str;
+ XF86ConfScreenPtr adj_left;
+ char *adj_left_str;
+ XF86ConfScreenPtr adj_right;
+ char *adj_right_str;
+ int adj_where;
+ int adj_x;
+ int adj_y;
+ char *adj_refscreen;
+} XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *inactive_device_str;
+ XF86ConfDevicePtr inactive_device;
+} XF86ConfInactiveRec, *XF86ConfInactivePtr;
+
+typedef struct {
+ GenericListRec list;
+ char *lay_identifier;
+ XF86ConfAdjacencyPtr lay_adjacency_lst;
+ XF86ConfInactivePtr lay_inactive_lst;
+ XF86ConfInputrefPtr lay_input_lst;
+ XF86OptionPtr lay_option_lst;
+ char *lay_comment;
+} XF86ConfLayoutRec, *XF86ConfLayoutPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *vs_name;
+ char *vs_identifier;
+ XF86OptionPtr vs_option_lst;
+ char *vs_comment;
+} XF86ConfVendSubRec, *XF86ConfVendSubPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *vnd_identifier;
+ XF86OptionPtr vnd_option_lst;
+ XF86ConfVendSubPtr vnd_sub_lst;
+ char *vnd_comment;
+} XF86ConfVendorRec, *XF86ConfVendorPtr;
+
+typedef struct {
+ char *dri_group_name;
+ int dri_group;
+ int dri_mode;
+ char *dri_comment;
+} XF86ConfDRIRec, *XF86ConfDRIPtr;
+
+typedef struct {
+ XF86OptionPtr ext_option_lst;
+ char *extensions_comment;
+} XF86ConfExtensionsRec, *XF86ConfExtensionsPtr;
+
+typedef struct {
+ XF86ConfFilesPtr conf_files;
+ XF86ConfModulePtr conf_modules;
+ XF86ConfFlagsPtr conf_flags;
+ XF86ConfVideoAdaptorPtr conf_videoadaptor_lst;
+ XF86ConfModesPtr conf_modes_lst;
+ XF86ConfMonitorPtr conf_monitor_lst;
+ XF86ConfDevicePtr conf_device_lst;
+ XF86ConfScreenPtr conf_screen_lst;
+ XF86ConfInputPtr conf_input_lst;
+ XF86ConfInputClassPtr conf_inputclass_lst;
+ XF86ConfLayoutPtr conf_layout_lst;
+ XF86ConfVendorPtr conf_vendor_lst;
+ XF86ConfDRIPtr conf_dri;
+ XF86ConfExtensionsPtr conf_extensions;
+ char *conf_comment;
+} XF86ConfigRec, *XF86ConfigPtr;
+
+typedef struct {
+ int token; /* id of the token */
+ const char *name; /* pointer to the LOWERCASED name */
+} xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
/*
* prototypes for public functions
*/
extern void xf86initConfigFiles(void);
extern char *xf86openConfigFile(const char *path, const char *cmdline,
- const char *projroot);
+ const char *projroot);
extern char *xf86openConfigDirFiles(const char *path, const char *cmdline,
- const char *projroot);
+ const char *projroot);
extern void xf86setBuiltinConfig(const char *config[]);
extern XF86ConfigPtr xf86readConfigFile(void);
extern void xf86closeConfigFile(void);
extern void xf86freeConfig(XF86ConfigPtr p);
extern int xf86writeConfigFile(const char *, XF86ConfigPtr);
-extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p);
-extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list);
-extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p);
-extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p);
-extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p);
-extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p);
-extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p);
-extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p);
+extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident,
+ XF86ConfDevicePtr p);
+extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name,
+ XF86ConfLayoutPtr list);
+extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident,
+ XF86ConfMonitorPtr p);
+extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident,
+ XF86ConfModesPtr p);
+extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident,
+ XF86ConfModeLinePtr p);
+extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident,
+ XF86ConfScreenPtr p);
+extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident,
+ XF86ConfInputPtr p);
+extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver,
+ XF86ConfInputPtr p);
extern _X_EXPORT XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident,
- XF86ConfVideoAdaptorPtr p);
-extern int xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout);
+ XF86ConfVideoAdaptorPtr
+ p);
+extern int xf86layoutAddInputDevices(XF86ConfigPtr config,
+ XF86ConfLayoutPtr layout);
-extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new);
-extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2);
+extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head,
+ GenericListPtr c_new);
+extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1,
+ GenericListPtr list_2);
extern _X_EXPORT int xf86pathIsAbsolute(const char *path);
extern _X_EXPORT int xf86pathIsSafe(const char *path);
extern _X_EXPORT char *xf86addComment(char *cur, char *add);
extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str);
-#endif /* _xf86Parser_h_ */
+#endif /* _xf86Parser_h_ */
diff --git a/xorg-server/hw/xfree86/ramdac/BT.c b/xorg-server/hw/xfree86/ramdac/BT.c
index 5aa27a1f8..533344513 100644
--- a/xorg-server/hw/xfree86/ramdac/BT.c
+++ b/xorg-server/hw/xfree86/ramdac/BT.c
@@ -37,36 +37,37 @@
void
BTramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
- RamDacRegRecPtr ramdacReg)
+ RamDacRegRecPtr ramdacReg)
{
- int i;
-
- /* Here we pass a short, so that we can evaluate a mask too */
- /* So that the mask is the high byte and the data the low byte */
- /* Just the command/status registers */
- for (i=0x06;i<0x0A;i++)
- (*ramdacPtr->WriteDAC)
- (pScrn, i, (ramdacReg->DacRegs[i] & 0xFF00) >> 8,
- ramdacReg->DacRegs[i]);
+ int i;
+
+ /* Here we pass a short, so that we can evaluate a mask too */
+ /* So that the mask is the high byte and the data the low byte */
+ /* Just the command/status registers */
+ for (i = 0x06; i < 0x0A; i++)
+ (*ramdacPtr->WriteDAC)
+ (pScrn, i, (ramdacReg->DacRegs[i] & 0xFF00) >> 8,
+ ramdacReg->DacRegs[i]);
}
void
-BTramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
- RamDacRegRecPtr ramdacReg)
+BTramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
{
- int i;
-
- (*ramdacPtr->ReadAddress)(pScrn, 0); /* Start at index 0 */
- for (i=0;i<768;i++)
- ramdacReg->DAC[i] = (*ramdacPtr->ReadData)(pScrn);
-
- /* Just the command/status registers */
- for (i=0x06;i<0x0A;i++)
- ramdacReg->DacRegs[i] = (*ramdacPtr->ReadDAC)(pScrn, i);
+ int i;
+
+ (*ramdacPtr->ReadAddress) (pScrn, 0); /* Start at index 0 */
+ for (i = 0; i < 768; i++)
+ ramdacReg->DAC[i] = (*ramdacPtr->ReadData) (pScrn);
+
+ /* Just the command/status registers */
+ for (i = 0x06; i < 0x0A; i++)
+ ramdacReg->DacRegs[i] = (*ramdacPtr->ReadDAC) (pScrn, i);
}
RamDacHelperRecPtr
-BTramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs/*, RamDacRecPtr ramdacPtr*/)
+BTramdacProbe(ScrnInfoPtr pScrn,
+ RamDacSupportedInfoRecPtr ramdacs /*, RamDacRecPtr ramdacPtr */ )
{
RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
Bool RamDacIsSupported = FALSE;
@@ -75,65 +76,66 @@ BTramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs/*, RamDacRecP
int i, status, cmd0;
/* Save COMMAND Register 0 */
- cmd0 = (*ramdacPtr->ReadDAC)(pScrn, BT_COMMAND_REG_0);
+ cmd0 = (*ramdacPtr->ReadDAC) (pScrn, BT_COMMAND_REG_0);
/* Ensure were going to access the STATUS Register on next read */
- (*ramdacPtr->WriteDAC)(pScrn, BT_COMMAND_REG_0, 0x7F, 0x00);
+ (*ramdacPtr->WriteDAC) (pScrn, BT_COMMAND_REG_0, 0x7F, 0x00);
- status = (*ramdacPtr->ReadDAC)(pScrn, BT_STATUS_REG);
+ status = (*ramdacPtr->ReadDAC) (pScrn, BT_STATUS_REG);
switch (status) {
- case 0x40:
- BTramdac_ID = ATT20C504_RAMDAC;
- break;
- case 0xD0:
- BTramdac_ID = ATT20C505_RAMDAC;
- break;
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Unknown BT RAMDAC type (0x%x), assuming BT485\n",
- status);
- case 0x80:
- case 0x90:
- case 0xA0:
- case 0xB0:
- case 0x28: /* This is for the DEC TGA - Questionable ? */
- BTramdac_ID = BT485_RAMDAC;
- break;
+ case 0x40:
+ BTramdac_ID = ATT20C504_RAMDAC;
+ break;
+ case 0xD0:
+ BTramdac_ID = ATT20C505_RAMDAC;
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Unknown BT RAMDAC type (0x%x), assuming BT485\n", status);
+ case 0x80:
+ case 0x90:
+ case 0xA0:
+ case 0xB0:
+ case 0x28: /* This is for the DEC TGA - Questionable ? */
+ BTramdac_ID = BT485_RAMDAC;
+ break;
}
/* Restore COMMAND Register 0 */
- (*ramdacPtr->WriteDAC)(pScrn, BT_COMMAND_REG_0, 0x00, cmd0);
+ (*ramdacPtr->WriteDAC) (pScrn, BT_COMMAND_REG_0, 0x00, cmd0);
if (BTramdac_ID == -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Cannot determine BT RAMDAC type, aborting\n");
- return NULL;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Attached RAMDAC is %s\n", BTramdacDeviceInfo[BTramdac_ID&0xFFFF].DeviceName);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Cannot determine BT RAMDAC type, aborting\n");
+ return NULL;
+ }
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Attached RAMDAC is %s\n",
+ BTramdacDeviceInfo[BTramdac_ID & 0xFFFF].DeviceName);
}
- for (i=0;ramdacs[i].token != -1;i++) {
- if (ramdacs[i].token == BTramdac_ID)
- RamDacIsSupported = TRUE;
+ for (i = 0; ramdacs[i].token != -1; i++) {
+ if (ramdacs[i].token == BTramdac_ID)
+ RamDacIsSupported = TRUE;
}
if (!RamDacIsSupported) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "This BT RAMDAC is NOT supported by this driver, aborting\n");
- return NULL;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "This BT RAMDAC is NOT supported by this driver, aborting\n");
+ return NULL;
}
ramdacHelperPtr = RamDacHelperCreateInfoRec();
- switch(BTramdac_ID) {
- case BT485_RAMDAC:
- ramdacHelperPtr->SetBpp = BTramdacSetBpp;
- break;
+ switch (BTramdac_ID) {
+ case BT485_RAMDAC:
+ ramdacHelperPtr->SetBpp = BTramdacSetBpp;
+ break;
}
ramdacPtr->RamDacType = BTramdac_ID;
ramdacHelperPtr->RamDacType = BTramdac_ID;
ramdacHelperPtr->Save = BTramdacSave;
ramdacHelperPtr->Restore = BTramdacRestore;
-
+
return ramdacHelperPtr;
}
@@ -143,23 +145,23 @@ BTramdacSetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
/* We need to deal with Direct Colour visuals for 8bpp and other
* good stuff for colours */
switch (pScrn->bitsPerPixel) {
- case 32:
- ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x10;
- break;
- case 24:
- ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x10;
- break;
- case 16:
- ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x38;
- break;
- case 15:
- ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x30;
- break;
- case 8:
- ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x40;
- break;
- case 4:
- ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x60;
- break;
+ case 32:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x10;
+ break;
+ case 24:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x10;
+ break;
+ case 16:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x38;
+ break;
+ case 15:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x30;
+ break;
+ case 8:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x40;
+ break;
+ case 4:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x60;
+ break;
}
}
diff --git a/xorg-server/hw/xfree86/ramdac/BT.h b/xorg-server/hw/xfree86/ramdac/BT.h
index 35d0bdbd9..6eeaf5db7 100644
--- a/xorg-server/hw/xfree86/ramdac/BT.h
+++ b/xorg-server/hw/xfree86/ramdac/BT.h
@@ -1,10 +1,15 @@
#include "xf86RamDac.h"
-extern _X_EXPORT RamDacHelperRecPtr BTramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs);
-extern _X_EXPORT void BTramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
-extern _X_EXPORT void BTramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
-extern _X_EXPORT void BTramdacSetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT RamDacHelperRecPtr BTramdacProbe(ScrnInfoPtr pScrn,
+ RamDacSupportedInfoRecPtr
+ ramdacs);
+extern _X_EXPORT void BTramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec,
+ RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT void BTramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec,
+ RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT void BTramdacSetBpp(ScrnInfoPtr pScrn,
+ RamDacRegRecPtr RamDacRegRec);
#define ATT20C504_RAMDAC (VENDOR_BT << 16) | 0x00
#define ATT20C505_RAMDAC (VENDOR_BT << 16) | 0x01
@@ -15,7 +20,7 @@ extern _X_EXPORT void BTramdacSetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRe
*/
#define BT_WRITE_ADDR 0x00
-#define BT_RAMDAC_DATA 0x01
+#define BT_RAMDAC_DATA 0x01
#define BT_PIXEL_MASK 0x02
#define BT_READ_ADDR 0x03
#define BT_CURS_WR_ADDR 0x04
diff --git a/xorg-server/hw/xfree86/ramdac/IBM.c b/xorg-server/hw/xfree86/ramdac/IBM.c
index 3a477d7be..bc716231a 100644
--- a/xorg-server/hw/xfree86/ramdac/IBM.c
+++ b/xorg-server/hw/xfree86/ramdac/IBM.c
@@ -1,639 +1,643 @@
-/*
- * Copyright 1998 by Alan Hourihane, Wigan, England.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *
- * IBM RAMDAC routines.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include "xf86Cursor.h"
-
-#define INIT_IBM_RAMDAC_INFO
-#include "IBMPriv.h"
-#include "xf86RamDacPriv.h"
-
-#define INITIALFREQERR 100000
-
-unsigned long
-IBMramdac640CalculateMNPCForClock(
- unsigned long RefClock, /* In 100Hz units */
- unsigned long ReqClock, /* In 100Hz units */
- char IsPixClock, /* boolean, is this the pixel or the sys clock */
- unsigned long MinClock, /* Min VCO rating */
- unsigned long MaxClock, /* Max VCO rating */
- unsigned long *rM, /* M Out */
- unsigned long *rN, /* N Out */
- unsigned long *rP, /* Min P In, P Out */
- unsigned long *rC /* C Out */
-)
-{
- unsigned long M, N, P, iP = *rP;
- unsigned long IntRef, VCO, Clock;
- long freqErr, lowestFreqErr = INITIALFREQERR;
- unsigned long ActualClock = 0;
-
- for (N = 0; N <= 63; N++)
- {
- IntRef = RefClock / (N + 1);
- if (IntRef < 10000)
- break; /* IntRef needs to be >= 1MHz */
- for (M = 2; M <= 127; M++)
- {
- VCO = IntRef * (M + 1);
- if ((VCO < MinClock) || (VCO > MaxClock))
- continue;
- for (P = iP; P <= 4; P++)
- {
- if (P != 0)
- Clock = (RefClock * (M + 1)) / ((N + 1) * 2 * P);
- else
- Clock = (RefClock * (M + 1)) / (N + 1);
-
- freqErr = (Clock - ReqClock);
-
- if (freqErr < 0)
- {
- /* PixelClock gets rounded up always so monitor reports
- correct frequency. */
- if (IsPixClock)
- continue;
- freqErr = -freqErr;
- }
-
- if (freqErr < lowestFreqErr)
- {
- *rM = M;
- *rN = N;
- *rP = P;
- *rC = (VCO <= 1280000 ? 1 : 2);
- ActualClock = Clock;
-
- lowestFreqErr = freqErr;
- /* Return if we found an exact match */
- if (freqErr == 0)
- return ActualClock;
- }
- }
- }
- }
-
- return ActualClock;
-}
-
-unsigned long
-IBMramdac526CalculateMNPCForClock(
- unsigned long RefClock, /* In 100Hz units */
- unsigned long ReqClock, /* In 100Hz units */
- char IsPixClock, /* boolean, is this the pixel or the sys clock */
- unsigned long MinClock, /* Min VCO rating */
- unsigned long MaxClock, /* Max VCO rating */
- unsigned long *rM, /* M Out */
- unsigned long *rN, /* N Out */
- unsigned long *rP, /* Min P In, P Out */
- unsigned long *rC /* C Out */
-)
-{
- unsigned long M, N, P, iP = *rP;
- unsigned long IntRef, VCO, Clock;
- long freqErr, lowestFreqErr = INITIALFREQERR;
- unsigned long ActualClock = 0;
-
- for (N = 0; N <= 63; N++)
- {
- IntRef = RefClock / (N + 1);
- if (IntRef < 10000)
- break; /* IntRef needs to be >= 1MHz */
- for (M = 0; M <= 63; M++)
- {
- VCO = IntRef * (M + 1);
- if ((VCO < MinClock) || (VCO > MaxClock))
- continue;
- for (P = iP; P <= 4; P++)
- {
- if (P)
- Clock = (RefClock * (M + 1)) / ((N + 1) * 2 * P);
- else
- Clock = VCO;
-
- freqErr = (Clock - ReqClock);
-
- if (freqErr < 0)
- {
- /* PixelClock gets rounded up always so monitor reports
- correct frequency. */
- if (IsPixClock)
- continue;
- freqErr = -freqErr;
- }
-
- if (freqErr < lowestFreqErr)
- {
- *rM = M;
- *rN = N;
- *rP = P;
- *rC = (VCO <= 1280000 ? 1 : 2);
- ActualClock = Clock;
-
- lowestFreqErr = freqErr;
- /* Return if we found an exact match */
- if (freqErr == 0)
- return ActualClock;
- }
- }
- }
- }
-
- return ActualClock;
-}
-
-void
-IBMramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
- RamDacRegRecPtr ramdacReg)
-{
- int i, maxreg, dacreg;
-
- switch (ramdacPtr->RamDacType) {
- case IBM640_RAMDAC:
- maxreg = 0x300;
- dacreg = 1024;
- break;
- default:
- maxreg = 0x100;
- dacreg = 768;
- break;
- }
-
- /* Here we pass a short, so that we can evaluate a mask too */
- /* So that the mask is the high byte and the data the low byte */
- for (i=0;i<maxreg;i++)
- (*ramdacPtr->WriteDAC)
- (pScrn, i, (ramdacReg->DacRegs[i] & 0xFF00) >> 8,
- ramdacReg->DacRegs[i]);
-
- (*ramdacPtr->WriteAddress)(pScrn, 0);
- for (i=0;i<dacreg;i++)
- (*ramdacPtr->WriteData)(pScrn, ramdacReg->DAC[i]);
-}
-
-void
-IBMramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
- RamDacRegRecPtr ramdacReg)
-{
- int i, maxreg, dacreg;
-
- switch (ramdacPtr->RamDacType) {
- case IBM640_RAMDAC:
- maxreg = 0x300;
- dacreg = 1024;
- break;
- default:
- maxreg = 0x100;
- dacreg = 768;
- break;
- }
-
- (*ramdacPtr->ReadAddress)(pScrn, 0);
- for (i=0;i<dacreg;i++)
- ramdacReg->DAC[i] = (*ramdacPtr->ReadData)(pScrn);
-
- for (i=0;i<maxreg;i++)
- ramdacReg->DacRegs[i] = (*ramdacPtr->ReadDAC)(pScrn, i);
-}
-
-RamDacHelperRecPtr
-IBMramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs/* , RamDacRecPtr ramdacPtr*/)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
- RamDacHelperRecPtr ramdacHelperPtr = NULL;
- Bool RamDacIsSupported = FALSE;
- int IBMramdac_ID = -1;
- int i;
- unsigned char id, rev, id2, rev2;
-
- /* read ID and revision */
- rev = (*ramdacPtr->ReadDAC)(pScrn, IBMRGB_rev);
- id = (*ramdacPtr->ReadDAC)(pScrn, IBMRGB_id);
-
- /* check if ID and revision are read only */
- (*ramdacPtr->WriteDAC)(pScrn, ~rev, 0, IBMRGB_rev);
- (*ramdacPtr->WriteDAC)(pScrn, ~id, 0, IBMRGB_id);
- rev2 = (*ramdacPtr->ReadDAC)(pScrn, IBMRGB_rev);
- id2 = (*ramdacPtr->ReadDAC)(pScrn, IBMRGB_id);
-
- switch (id) {
- case 0x30:
- if (rev == 0xc0) IBMramdac_ID = IBM624_RAMDAC;
- if (rev == 0x80) IBMramdac_ID = IBM624DB_RAMDAC;
- break;
- case 0x12:
- if (rev == 0x1c) IBMramdac_ID = IBM640_RAMDAC;
- break;
- case 0x01:
- IBMramdac_ID = IBM525_RAMDAC;
- break;
- case 0x02:
- if (rev == 0xf0) IBMramdac_ID = IBM524_RAMDAC;
- if (rev == 0xe0) IBMramdac_ID = IBM524A_RAMDAC;
- if (rev == 0xc0) IBMramdac_ID = IBM526_RAMDAC;
- if (rev == 0x80) IBMramdac_ID = IBM526DB_RAMDAC;
- break;
- }
-
- if (id == 1 || id == 2) {
- if (id == id2 && rev == rev2) { /* IBM RGB52x found */
- /* check for 128bit VRAM -> RGB528 */
- if (((*ramdacPtr->ReadDAC)(pScrn, IBMRGB_misc1) & 0x03) == 0x03) {
- IBMramdac_ID = IBM528_RAMDAC; /* 128bit DAC found */
- if (rev == 0xe0)
- IBMramdac_ID = IBM528A_RAMDAC;
- }
- }
- }
-
- (*ramdacPtr->WriteDAC)(pScrn, rev, 0, IBMRGB_rev);
- (*ramdacPtr->WriteDAC)(pScrn, id, 0, IBMRGB_id);
-
- if (IBMramdac_ID == -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Cannot determine IBM RAMDAC type, aborting\n");
- return NULL;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Attached RAMDAC is %s\n", IBMramdacDeviceInfo[IBMramdac_ID&0xFFFF].DeviceName);
- }
-
- for (i=0;ramdacs[i].token != -1;i++) {
- if (ramdacs[i].token == IBMramdac_ID)
- RamDacIsSupported = TRUE;
- }
-
- if (!RamDacIsSupported) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "This IBM RAMDAC is NOT supported by this driver, aborting\n");
- return NULL;
- }
-
- ramdacHelperPtr = RamDacHelperCreateInfoRec();
- switch (IBMramdac_ID) {
- case IBM526_RAMDAC:
- case IBM526DB_RAMDAC:
- ramdacHelperPtr->SetBpp = IBMramdac526SetBpp;
- ramdacHelperPtr->HWCursorInit = IBMramdac526HWCursorInit;
- break;
- case IBM640_RAMDAC:
- ramdacHelperPtr->SetBpp = IBMramdac640SetBpp;
- ramdacHelperPtr->HWCursorInit = IBMramdac640HWCursorInit;
- break;
- }
- ramdacPtr->RamDacType = IBMramdac_ID;
- ramdacHelperPtr->RamDacType = IBMramdac_ID;
- ramdacHelperPtr->Save = IBMramdacSave;
- ramdacHelperPtr->Restore = IBMramdacRestore;
-
- return ramdacHelperPtr;
-}
-
-void
-IBMramdac526SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
-{
- ramdacReg->DacRegs[IBMRGB_key_control] = 0x00; /* Disable Chroma Key */
-
- switch (pScrn->bitsPerPixel) {
- case 32:
- ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_32BPP;
- ramdacReg->DacRegs[IBMRGB_32bpp] = B32_DCOL_DIRECT;
- ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
- if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
- ramdacReg->DacRegs[IBMRGB_key_control] = 0x01; /* Enable Key */
- ramdacReg->DacRegs[IBMRGB_key] = 0xFF;
- ramdacReg->DacRegs[IBMRGB_key_mask] = 0xFF;
- }
- break;
- case 24:
- ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_24BPP;
- ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_24bpp] = B24_DCOL_DIRECT;
- ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
- break;
- case 16:
- if (pScrn->depth == 16) {
- ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_16BPP;
- ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_16bpp] = B16_DCOL_DIRECT|B16_LINEAR |
- B16_CONTIGUOUS | B16_565;
- ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
- } else {
- ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_16BPP;
- ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_16bpp] = B16_DCOL_DIRECT|B16_LINEAR |
- B16_CONTIGUOUS | B16_555;
- ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
- }
- break;
- case 8:
- ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_8BPP;
- ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_8bpp] = B8_DCOL_INDIRECT;
- break;
- case 4:
- ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_4BPP;
- ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
- ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
- }
-}
-
-IBMramdac526SetBppProc *IBMramdac526SetBppWeak(void) {
- return IBMramdac526SetBpp;
-}
-
-void
-IBMramdac640SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
-{
- unsigned char bpp = 0x00;
- unsigned char overlaybpp = 0x00;
- unsigned char offset = 0x00;
- unsigned char dispcont = 0x44;
-
- ramdacReg->DacRegs[RGB640_SER_WID_03_00] = 0x00;
- ramdacReg->DacRegs[RGB640_SER_WID_07_04] = 0x00;
- ramdacReg->DacRegs[RGB640_DIAGS] = 0x07;
-
- switch (pScrn->depth) {
- case 8:
- ramdacReg->DacRegs[RGB640_SER_07_00] = 0x00;
- ramdacReg->DacRegs[RGB640_SER_15_08] = 0x00;
- ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00;
- ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00;
- ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_16_1; /*16:1 Mux*/
- ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
- bpp = 0x03;
- break;
- case 15:
- ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10;
- ramdacReg->DacRegs[RGB640_SER_15_08] = 0x11;
- ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00;
- ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00;
- ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_8_1; /* 8:1 Mux*/
- ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
- bpp = 0x0E;
- break;
- case 16:
- ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10;
- ramdacReg->DacRegs[RGB640_SER_15_08] = 0x11;
- ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00;
- ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00;
- ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_8_1; /* 8:1 Mux*/
- ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
- bpp = 0x05;
- break;
- case 24:
- ramdacReg->DacRegs[RGB640_SER_07_00] = 0x30;
- ramdacReg->DacRegs[RGB640_SER_15_08] = 0x31;
- ramdacReg->DacRegs[RGB640_SER_23_16] = 0x32;
- ramdacReg->DacRegs[RGB640_SER_31_24] = 0x33;
- ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_4_1; /* 4:1 Mux*/
- ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
- bpp = 0x09;
- if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
- ramdacReg->DacRegs[RGB640_SER_WID_07_04] = 0x04;
- ramdacReg->DacRegs[RGB640_CHROMA_KEY0] = 0xFF;
- ramdacReg->DacRegs[RGB640_CHROMA_MASK0] = 0xFF;
- offset = 0x04;
- overlaybpp = 0x04;
- dispcont = 0x48;
- }
- break;
- case 30: /* 10 bit dac */
- ramdacReg->DacRegs[RGB640_SER_07_00] = 0x30;
- ramdacReg->DacRegs[RGB640_SER_15_08] = 0x31;
- ramdacReg->DacRegs[RGB640_SER_23_16] = 0x32;
- ramdacReg->DacRegs[RGB640_SER_31_24] = 0x33;
- ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_4_1; /* 4:1 Mux*/
- ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PSIZE10 |
- IBM640_PCLK_8; /* pll / 8 */
- bpp = 0x0D;
- break;
- }
-
- {
- int i;
- for (i=0x100;i<0x140;i+=4) {
- /* Initialize FrameBuffer Window Attribute Table */
- ramdacReg->DacRegs[i+0] = bpp;
- ramdacReg->DacRegs[i+1] = offset;
- ramdacReg->DacRegs[i+2] = 0x00;
- ramdacReg->DacRegs[i+3] = 0x00;
- /* Initialize Overlay Window Attribute Table */
- ramdacReg->DacRegs[i+0x100] = overlaybpp;
- ramdacReg->DacRegs[i+0x101] = 0x00;
- ramdacReg->DacRegs[i+0x102] = 0x00;
- ramdacReg->DacRegs[i+0x103] = dispcont;
- }
- }
-}
-
-static void
-IBMramdac526ShowCursor(ScrnInfoPtr pScrn)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- /* Enable cursor - X11 mode */
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs, 0x00, 0x07);
-}
-
-static void
-IBMramdac640ShowCursor(ScrnInfoPtr pScrn)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- /* Enable cursor - mode2 (x11 mode) */
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURSOR_CONTROL, 0x00, 0x0B);
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CROSSHAIR_CONTROL, 0x00, 0x00);
-}
-
-static void
-IBMramdac526HideCursor(ScrnInfoPtr pScrn)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- /* Disable cursor - X11 mode */
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs, 0x00, 0x24);
-}
-
-static void
-IBMramdac640HideCursor(ScrnInfoPtr pScrn)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- /* Disable cursor - mode2 (x11 mode) */
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURSOR_CONTROL, 0x00, 0x08);
-}
-
-static void
-IBMramdac526SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- x += 64;
- y += 64;
-
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_hot_x, 0x00, 0x3f);
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_hot_y, 0x00, 0x3f);
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_xl, 0x00, x & 0xff);
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_xh, 0x00, (x>>8) & 0xf);
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_yl, 0x00, y & 0xff);
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_yh, 0x00, (y>>8) & 0xf);
-}
-
-static void
-IBMramdac640SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- x += 64;
- y += 64;
-
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_OFFSETX, 0x00, 0x3f);
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_OFFSETY, 0x00, 0x3f);
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_X_LOW, 0x00, x & 0xff);
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_X_HIGH, 0x00, (x>>8) & 0xf);
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_Y_LOW, 0x00, y & 0xff);
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_Y_HIGH, 0x00, (y>>8) & 0xf);
-}
-
-static void
-IBMramdac526SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col1_r, 0x00, bg >> 16);
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col1_g, 0x00, bg >> 8);
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col1_b, 0x00, bg);
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col2_r, 0x00, fg >> 16);
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col2_g, 0x00, fg >> 8);
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col2_b, 0x00, fg);
-}
-
-static void
-IBMramdac640SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_COL0, 0x00, 0);
- (*ramdacPtr->WriteData)(pScrn, fg>>16);
- (*ramdacPtr->WriteData)(pScrn, fg>>8);
- (*ramdacPtr->WriteData)(pScrn, fg);
- (*ramdacPtr->WriteData)(pScrn, bg>>16);
- (*ramdacPtr->WriteData)(pScrn, bg>>8);
- (*ramdacPtr->WriteData)(pScrn, bg);
- (*ramdacPtr->WriteData)(pScrn, fg>>16);
- (*ramdacPtr->WriteData)(pScrn, fg>>8);
- (*ramdacPtr->WriteData)(pScrn, fg);
- (*ramdacPtr->WriteData)(pScrn, bg>>16);
- (*ramdacPtr->WriteData)(pScrn, bg>>8);
- (*ramdacPtr->WriteData)(pScrn, bg);
-}
-
-static void
-IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
- int i;
- /*
- * Output the cursor data. The realize function has put the planes into
- * their correct order, so we can just blast this out.
- */
- for (i = 0; i < 1024; i++)
- (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_array + i, 0x00, (*src++));
-}
-
-static void
-IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
- int i;
- /*
- * Output the cursor data. The realize function has put the planes into
- * their correct order, so we can just blast this out.
- */
- for (i = 0; i < 1024; i++)
- (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_WRITE + i, 0x00, (*src++));
-}
-
-static Bool
-IBMramdac526UseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
-{
- return TRUE;
-}
-
-static Bool
-IBMramdac640UseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
-{
- return TRUE;
-}
-
-void
-IBMramdac526HWCursorInit(xf86CursorInfoPtr infoPtr)
-{
- infoPtr->MaxWidth = 64;
- infoPtr->MaxHeight = 64;
- infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
- HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
- infoPtr->SetCursorColors = IBMramdac526SetCursorColors;
- infoPtr->SetCursorPosition = IBMramdac526SetCursorPosition;
- infoPtr->LoadCursorImage = IBMramdac526LoadCursorImage;
- infoPtr->HideCursor = IBMramdac526HideCursor;
- infoPtr->ShowCursor = IBMramdac526ShowCursor;
- infoPtr->UseHWCursor = IBMramdac526UseHWCursor;
-}
-
-void
-IBMramdac640HWCursorInit(xf86CursorInfoPtr infoPtr)
-{
- infoPtr->MaxWidth = 64;
- infoPtr->MaxHeight = 64;
- infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
- HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
- infoPtr->SetCursorColors = IBMramdac640SetCursorColors;
- infoPtr->SetCursorPosition = IBMramdac640SetCursorPosition;
- infoPtr->LoadCursorImage = IBMramdac640LoadCursorImage;
- infoPtr->HideCursor = IBMramdac640HideCursor;
- infoPtr->ShowCursor = IBMramdac640ShowCursor;
- infoPtr->UseHWCursor = IBMramdac640UseHWCursor;
-}
+/*
+ * Copyright 1998 by Alan Hourihane, Wigan, England.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Alan Hourihane not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Alan Hourihane makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
+ *
+ * IBM RAMDAC routines.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "xf86Cursor.h"
+
+#define INIT_IBM_RAMDAC_INFO
+#include "IBMPriv.h"
+#include "xf86RamDacPriv.h"
+
+#define INITIALFREQERR 100000
+
+unsigned long
+IBMramdac640CalculateMNPCForClock(unsigned long RefClock, /* In 100Hz units */
+ unsigned long ReqClock, /* In 100Hz units */
+ char IsPixClock, /* boolean, is this the pixel or the sys clock */
+ unsigned long MinClock, /* Min VCO rating */
+ unsigned long MaxClock, /* Max VCO rating */
+ unsigned long *rM, /* M Out */
+ unsigned long *rN, /* N Out */
+ unsigned long *rP, /* Min P In, P Out */
+ unsigned long *rC /* C Out */
+ )
+{
+ unsigned long M, N, P, iP = *rP;
+ unsigned long IntRef, VCO, Clock;
+ long freqErr, lowestFreqErr = INITIALFREQERR;
+ unsigned long ActualClock = 0;
+
+ for (N = 0; N <= 63; N++) {
+ IntRef = RefClock / (N + 1);
+ if (IntRef < 10000)
+ break; /* IntRef needs to be >= 1MHz */
+ for (M = 2; M <= 127; M++) {
+ VCO = IntRef * (M + 1);
+ if ((VCO < MinClock) || (VCO > MaxClock))
+ continue;
+ for (P = iP; P <= 4; P++) {
+ if (P != 0)
+ Clock = (RefClock * (M + 1)) / ((N + 1) * 2 * P);
+ else
+ Clock = (RefClock * (M + 1)) / (N + 1);
+
+ freqErr = (Clock - ReqClock);
+
+ if (freqErr < 0) {
+ /* PixelClock gets rounded up always so monitor reports
+ correct frequency. */
+ if (IsPixClock)
+ continue;
+ freqErr = -freqErr;
+ }
+
+ if (freqErr < lowestFreqErr) {
+ *rM = M;
+ *rN = N;
+ *rP = P;
+ *rC = (VCO <= 1280000 ? 1 : 2);
+ ActualClock = Clock;
+
+ lowestFreqErr = freqErr;
+ /* Return if we found an exact match */
+ if (freqErr == 0)
+ return ActualClock;
+ }
+ }
+ }
+ }
+
+ return ActualClock;
+}
+
+unsigned long
+IBMramdac526CalculateMNPCForClock(unsigned long RefClock, /* In 100Hz units */
+ unsigned long ReqClock, /* In 100Hz units */
+ char IsPixClock, /* boolean, is this the pixel or the sys clock */
+ unsigned long MinClock, /* Min VCO rating */
+ unsigned long MaxClock, /* Max VCO rating */
+ unsigned long *rM, /* M Out */
+ unsigned long *rN, /* N Out */
+ unsigned long *rP, /* Min P In, P Out */
+ unsigned long *rC /* C Out */
+ )
+{
+ unsigned long M, N, P, iP = *rP;
+ unsigned long IntRef, VCO, Clock;
+ long freqErr, lowestFreqErr = INITIALFREQERR;
+ unsigned long ActualClock = 0;
+
+ for (N = 0; N <= 63; N++) {
+ IntRef = RefClock / (N + 1);
+ if (IntRef < 10000)
+ break; /* IntRef needs to be >= 1MHz */
+ for (M = 0; M <= 63; M++) {
+ VCO = IntRef * (M + 1);
+ if ((VCO < MinClock) || (VCO > MaxClock))
+ continue;
+ for (P = iP; P <= 4; P++) {
+ if (P)
+ Clock = (RefClock * (M + 1)) / ((N + 1) * 2 * P);
+ else
+ Clock = VCO;
+
+ freqErr = (Clock - ReqClock);
+
+ if (freqErr < 0) {
+ /* PixelClock gets rounded up always so monitor reports
+ correct frequency. */
+ if (IsPixClock)
+ continue;
+ freqErr = -freqErr;
+ }
+
+ if (freqErr < lowestFreqErr) {
+ *rM = M;
+ *rN = N;
+ *rP = P;
+ *rC = (VCO <= 1280000 ? 1 : 2);
+ ActualClock = Clock;
+
+ lowestFreqErr = freqErr;
+ /* Return if we found an exact match */
+ if (freqErr == 0)
+ return ActualClock;
+ }
+ }
+ }
+ }
+
+ return ActualClock;
+}
+
+void
+IBMramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
+{
+ int i, maxreg, dacreg;
+
+ switch (ramdacPtr->RamDacType) {
+ case IBM640_RAMDAC:
+ maxreg = 0x300;
+ dacreg = 1024;
+ break;
+ default:
+ maxreg = 0x100;
+ dacreg = 768;
+ break;
+ }
+
+ /* Here we pass a short, so that we can evaluate a mask too */
+ /* So that the mask is the high byte and the data the low byte */
+ for (i = 0; i < maxreg; i++)
+ (*ramdacPtr->WriteDAC)
+ (pScrn, i, (ramdacReg->DacRegs[i] & 0xFF00) >> 8,
+ ramdacReg->DacRegs[i]);
+
+ (*ramdacPtr->WriteAddress) (pScrn, 0);
+ for (i = 0; i < dacreg; i++)
+ (*ramdacPtr->WriteData) (pScrn, ramdacReg->DAC[i]);
+}
+
+void
+IBMramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
+{
+ int i, maxreg, dacreg;
+
+ switch (ramdacPtr->RamDacType) {
+ case IBM640_RAMDAC:
+ maxreg = 0x300;
+ dacreg = 1024;
+ break;
+ default:
+ maxreg = 0x100;
+ dacreg = 768;
+ break;
+ }
+
+ (*ramdacPtr->ReadAddress) (pScrn, 0);
+ for (i = 0; i < dacreg; i++)
+ ramdacReg->DAC[i] = (*ramdacPtr->ReadData) (pScrn);
+
+ for (i = 0; i < maxreg; i++)
+ ramdacReg->DacRegs[i] = (*ramdacPtr->ReadDAC) (pScrn, i);
+}
+
+RamDacHelperRecPtr
+IBMramdacProbe(ScrnInfoPtr pScrn,
+ RamDacSupportedInfoRecPtr ramdacs /* , RamDacRecPtr ramdacPtr */
+ )
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ RamDacHelperRecPtr ramdacHelperPtr = NULL;
+ Bool RamDacIsSupported = FALSE;
+ int IBMramdac_ID = -1;
+ int i;
+ unsigned char id, rev, id2, rev2;
+
+ /* read ID and revision */
+ rev = (*ramdacPtr->ReadDAC) (pScrn, IBMRGB_rev);
+ id = (*ramdacPtr->ReadDAC) (pScrn, IBMRGB_id);
+
+ /* check if ID and revision are read only */
+ (*ramdacPtr->WriteDAC) (pScrn, ~rev, 0, IBMRGB_rev);
+ (*ramdacPtr->WriteDAC) (pScrn, ~id, 0, IBMRGB_id);
+ rev2 = (*ramdacPtr->ReadDAC) (pScrn, IBMRGB_rev);
+ id2 = (*ramdacPtr->ReadDAC) (pScrn, IBMRGB_id);
+
+ switch (id) {
+ case 0x30:
+ if (rev == 0xc0)
+ IBMramdac_ID = IBM624_RAMDAC;
+ if (rev == 0x80)
+ IBMramdac_ID = IBM624DB_RAMDAC;
+ break;
+ case 0x12:
+ if (rev == 0x1c)
+ IBMramdac_ID = IBM640_RAMDAC;
+ break;
+ case 0x01:
+ IBMramdac_ID = IBM525_RAMDAC;
+ break;
+ case 0x02:
+ if (rev == 0xf0)
+ IBMramdac_ID = IBM524_RAMDAC;
+ if (rev == 0xe0)
+ IBMramdac_ID = IBM524A_RAMDAC;
+ if (rev == 0xc0)
+ IBMramdac_ID = IBM526_RAMDAC;
+ if (rev == 0x80)
+ IBMramdac_ID = IBM526DB_RAMDAC;
+ break;
+ }
+
+ if (id == 1 || id == 2) {
+ if (id == id2 && rev == rev2) { /* IBM RGB52x found */
+ /* check for 128bit VRAM -> RGB528 */
+ if (((*ramdacPtr->ReadDAC) (pScrn, IBMRGB_misc1) & 0x03) == 0x03) {
+ IBMramdac_ID = IBM528_RAMDAC; /* 128bit DAC found */
+ if (rev == 0xe0)
+ IBMramdac_ID = IBM528A_RAMDAC;
+ }
+ }
+ }
+
+ (*ramdacPtr->WriteDAC) (pScrn, rev, 0, IBMRGB_rev);
+ (*ramdacPtr->WriteDAC) (pScrn, id, 0, IBMRGB_id);
+
+ if (IBMramdac_ID == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Cannot determine IBM RAMDAC type, aborting\n");
+ return NULL;
+ }
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Attached RAMDAC is %s\n",
+ IBMramdacDeviceInfo[IBMramdac_ID & 0xFFFF].DeviceName);
+ }
+
+ for (i = 0; ramdacs[i].token != -1; i++) {
+ if (ramdacs[i].token == IBMramdac_ID)
+ RamDacIsSupported = TRUE;
+ }
+
+ if (!RamDacIsSupported) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "This IBM RAMDAC is NOT supported by this driver, aborting\n");
+ return NULL;
+ }
+
+ ramdacHelperPtr = RamDacHelperCreateInfoRec();
+ switch (IBMramdac_ID) {
+ case IBM526_RAMDAC:
+ case IBM526DB_RAMDAC:
+ ramdacHelperPtr->SetBpp = IBMramdac526SetBpp;
+ ramdacHelperPtr->HWCursorInit = IBMramdac526HWCursorInit;
+ break;
+ case IBM640_RAMDAC:
+ ramdacHelperPtr->SetBpp = IBMramdac640SetBpp;
+ ramdacHelperPtr->HWCursorInit = IBMramdac640HWCursorInit;
+ break;
+ }
+ ramdacPtr->RamDacType = IBMramdac_ID;
+ ramdacHelperPtr->RamDacType = IBMramdac_ID;
+ ramdacHelperPtr->Save = IBMramdacSave;
+ ramdacHelperPtr->Restore = IBMramdacRestore;
+
+ return ramdacHelperPtr;
+}
+
+void
+IBMramdac526SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
+{
+ ramdacReg->DacRegs[IBMRGB_key_control] = 0x00; /* Disable Chroma Key */
+
+ switch (pScrn->bitsPerPixel) {
+ case 32:
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_32BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = B32_DCOL_DIRECT;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
+ if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
+ ramdacReg->DacRegs[IBMRGB_key_control] = 0x01; /* Enable Key */
+ ramdacReg->DacRegs[IBMRGB_key] = 0xFF;
+ ramdacReg->DacRegs[IBMRGB_key_mask] = 0xFF;
+ }
+ break;
+ case 24:
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_24BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = B24_DCOL_DIRECT;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
+ break;
+ case 16:
+ if (pScrn->depth == 16) {
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_16BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = B16_DCOL_DIRECT | B16_LINEAR |
+ B16_CONTIGUOUS | B16_565;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
+ }
+ else {
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_16BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = B16_DCOL_DIRECT | B16_LINEAR |
+ B16_CONTIGUOUS | B16_555;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
+ }
+ break;
+ case 8:
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_8BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = B8_DCOL_INDIRECT;
+ break;
+ case 4:
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_4BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
+ }
+}
+
+IBMramdac526SetBppProc *
+IBMramdac526SetBppWeak(void)
+{
+ return IBMramdac526SetBpp;
+}
+
+void
+IBMramdac640SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
+{
+ unsigned char bpp = 0x00;
+ unsigned char overlaybpp = 0x00;
+ unsigned char offset = 0x00;
+ unsigned char dispcont = 0x44;
+
+ ramdacReg->DacRegs[RGB640_SER_WID_03_00] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_WID_07_04] = 0x00;
+ ramdacReg->DacRegs[RGB640_DIAGS] = 0x07;
+
+ switch (pScrn->depth) {
+ case 8:
+ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_15_08] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_16_1; /*16:1 Mux */
+ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
+ bpp = 0x03;
+ break;
+ case 15:
+ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10;
+ ramdacReg->DacRegs[RGB640_SER_15_08] = 0x11;
+ ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_8_1; /* 8:1 Mux */
+ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
+ bpp = 0x0E;
+ break;
+ case 16:
+ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10;
+ ramdacReg->DacRegs[RGB640_SER_15_08] = 0x11;
+ ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_8_1; /* 8:1 Mux */
+ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
+ bpp = 0x05;
+ break;
+ case 24:
+ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x30;
+ ramdacReg->DacRegs[RGB640_SER_15_08] = 0x31;
+ ramdacReg->DacRegs[RGB640_SER_23_16] = 0x32;
+ ramdacReg->DacRegs[RGB640_SER_31_24] = 0x33;
+ ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_4_1; /* 4:1 Mux */
+ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
+ bpp = 0x09;
+ if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
+ ramdacReg->DacRegs[RGB640_SER_WID_07_04] = 0x04;
+ ramdacReg->DacRegs[RGB640_CHROMA_KEY0] = 0xFF;
+ ramdacReg->DacRegs[RGB640_CHROMA_MASK0] = 0xFF;
+ offset = 0x04;
+ overlaybpp = 0x04;
+ dispcont = 0x48;
+ }
+ break;
+ case 30: /* 10 bit dac */
+ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x30;
+ ramdacReg->DacRegs[RGB640_SER_15_08] = 0x31;
+ ramdacReg->DacRegs[RGB640_SER_23_16] = 0x32;
+ ramdacReg->DacRegs[RGB640_SER_31_24] = 0x33;
+ ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_4_1; /* 4:1 Mux */
+ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PSIZE10 | IBM640_PCLK_8; /* pll / 8 */
+ bpp = 0x0D;
+ break;
+ }
+
+ {
+ int i;
+
+ for (i = 0x100; i < 0x140; i += 4) {
+ /* Initialize FrameBuffer Window Attribute Table */
+ ramdacReg->DacRegs[i + 0] = bpp;
+ ramdacReg->DacRegs[i + 1] = offset;
+ ramdacReg->DacRegs[i + 2] = 0x00;
+ ramdacReg->DacRegs[i + 3] = 0x00;
+ /* Initialize Overlay Window Attribute Table */
+ ramdacReg->DacRegs[i + 0x100] = overlaybpp;
+ ramdacReg->DacRegs[i + 0x101] = 0x00;
+ ramdacReg->DacRegs[i + 0x102] = 0x00;
+ ramdacReg->DacRegs[i + 0x103] = dispcont;
+ }
+ }
+}
+
+static void
+IBMramdac526ShowCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Enable cursor - X11 mode */
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs, 0x00, 0x07);
+}
+
+static void
+IBMramdac640ShowCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Enable cursor - mode2 (x11 mode) */
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURSOR_CONTROL, 0x00, 0x0B);
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CROSSHAIR_CONTROL, 0x00, 0x00);
+}
+
+static void
+IBMramdac526HideCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Disable cursor - X11 mode */
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs, 0x00, 0x24);
+}
+
+static void
+IBMramdac640HideCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Disable cursor - mode2 (x11 mode) */
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURSOR_CONTROL, 0x00, 0x08);
+}
+
+static void
+IBMramdac526SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ x += 64;
+ y += 64;
+
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_hot_x, 0x00, 0x3f);
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_hot_y, 0x00, 0x3f);
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_xl, 0x00, x & 0xff);
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_xh, 0x00, (x >> 8) & 0xf);
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_yl, 0x00, y & 0xff);
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_yh, 0x00, (y >> 8) & 0xf);
+}
+
+static void
+IBMramdac640SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ x += 64;
+ y += 64;
+
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_OFFSETX, 0x00, 0x3f);
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_OFFSETY, 0x00, 0x3f);
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_X_LOW, 0x00, x & 0xff);
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_X_HIGH, 0x00, (x >> 8) & 0xf);
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_Y_LOW, 0x00, y & 0xff);
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_Y_HIGH, 0x00, (y >> 8) & 0xf);
+}
+
+static void
+IBMramdac526SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col1_r, 0x00, bg >> 16);
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col1_g, 0x00, bg >> 8);
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col1_b, 0x00, bg);
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col2_r, 0x00, fg >> 16);
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col2_g, 0x00, fg >> 8);
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_col2_b, 0x00, fg);
+}
+
+static void
+IBMramdac640SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_COL0, 0x00, 0);
+ (*ramdacPtr->WriteData) (pScrn, fg >> 16);
+ (*ramdacPtr->WriteData) (pScrn, fg >> 8);
+ (*ramdacPtr->WriteData) (pScrn, fg);
+ (*ramdacPtr->WriteData) (pScrn, bg >> 16);
+ (*ramdacPtr->WriteData) (pScrn, bg >> 8);
+ (*ramdacPtr->WriteData) (pScrn, bg);
+ (*ramdacPtr->WriteData) (pScrn, fg >> 16);
+ (*ramdacPtr->WriteData) (pScrn, fg >> 8);
+ (*ramdacPtr->WriteData) (pScrn, fg);
+ (*ramdacPtr->WriteData) (pScrn, bg >> 16);
+ (*ramdacPtr->WriteData) (pScrn, bg >> 8);
+ (*ramdacPtr->WriteData) (pScrn, bg);
+}
+
+static void
+IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ int i;
+
+ /*
+ * Output the cursor data. The realize function has put the planes into
+ * their correct order, so we can just blast this out.
+ */
+ for (i = 0; i < 1024; i++)
+ (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_array + i, 0x00, (*src++));
+}
+
+static void
+IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ int i;
+
+ /*
+ * Output the cursor data. The realize function has put the planes into
+ * their correct order, so we can just blast this out.
+ */
+ for (i = 0; i < 1024; i++)
+ (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_WRITE + i, 0x00, (*src++));
+}
+
+static Bool
+IBMramdac526UseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
+{
+ return TRUE;
+}
+
+static Bool
+IBMramdac640UseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
+{
+ return TRUE;
+}
+
+void
+IBMramdac526HWCursorInit(xf86CursorInfoPtr infoPtr)
+{
+ infoPtr->MaxWidth = 64;
+ infoPtr->MaxHeight = 64;
+ infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
+ infoPtr->SetCursorColors = IBMramdac526SetCursorColors;
+ infoPtr->SetCursorPosition = IBMramdac526SetCursorPosition;
+ infoPtr->LoadCursorImage = IBMramdac526LoadCursorImage;
+ infoPtr->HideCursor = IBMramdac526HideCursor;
+ infoPtr->ShowCursor = IBMramdac526ShowCursor;
+ infoPtr->UseHWCursor = IBMramdac526UseHWCursor;
+}
+
+void
+IBMramdac640HWCursorInit(xf86CursorInfoPtr infoPtr)
+{
+ infoPtr->MaxWidth = 64;
+ infoPtr->MaxHeight = 64;
+ infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
+ infoPtr->SetCursorColors = IBMramdac640SetCursorColors;
+ infoPtr->SetCursorPosition = IBMramdac640SetCursorPosition;
+ infoPtr->LoadCursorImage = IBMramdac640LoadCursorImage;
+ infoPtr->HideCursor = IBMramdac640HideCursor;
+ infoPtr->ShowCursor = IBMramdac640ShowCursor;
+ infoPtr->UseHWCursor = IBMramdac640UseHWCursor;
+}
diff --git a/xorg-server/hw/xfree86/ramdac/IBM.h b/xorg-server/hw/xfree86/ramdac/IBM.h
index 6fa18b219..986be2f48 100644
--- a/xorg-server/hw/xfree86/ramdac/IBM.h
+++ b/xorg-server/hw/xfree86/ramdac/IBM.h
@@ -1,19 +1,54 @@
#include <xf86RamDac.h>
-extern _X_EXPORT RamDacHelperRecPtr IBMramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs);
-extern _X_EXPORT void IBMramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
-extern _X_EXPORT void IBMramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
-extern _X_EXPORT void IBMramdac526SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec);
-extern _X_EXPORT void IBMramdac640SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec);
-extern _X_EXPORT unsigned long IBMramdac526CalculateMNPCForClock(unsigned long RefClock,
- unsigned long ReqClock, char IsPixClock, unsigned long MinClock,
- unsigned long MaxClock, unsigned long *rM, unsigned long *rN,
- unsigned long *rP, unsigned long *rC);
-extern _X_EXPORT unsigned long IBMramdac640CalculateMNPCForClock(unsigned long RefClock,
- unsigned long ReqClock, char IsPixClock, unsigned long MinClock,
- unsigned long MaxClock, unsigned long *rM, unsigned long *rN,
- unsigned long *rP, unsigned long *rC);
+extern _X_EXPORT RamDacHelperRecPtr IBMramdacProbe(ScrnInfoPtr pScrn,
+ RamDacSupportedInfoRecPtr
+ ramdacs);
+extern _X_EXPORT void IBMramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec,
+ RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT void IBMramdacRestore(ScrnInfoPtr pScrn,
+ RamDacRecPtr RamDacRec,
+ RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT void IBMramdac526SetBpp(ScrnInfoPtr pScrn,
+ RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT void IBMramdac640SetBpp(ScrnInfoPtr pScrn,
+ RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT unsigned long IBMramdac526CalculateMNPCForClock(unsigned long
+ RefClock,
+ unsigned long
+ ReqClock,
+ char
+ IsPixClock,
+ unsigned long
+ MinClock,
+ unsigned long
+ MaxClock,
+ unsigned long
+ *rM,
+ unsigned long
+ *rN,
+ unsigned long
+ *rP,
+ unsigned long
+ *rC);
+extern _X_EXPORT unsigned long IBMramdac640CalculateMNPCForClock(unsigned long
+ RefClock,
+ unsigned long
+ ReqClock,
+ char
+ IsPixClock,
+ unsigned long
+ MinClock,
+ unsigned long
+ MaxClock,
+ unsigned long
+ *rM,
+ unsigned long
+ *rN,
+ unsigned long
+ *rP,
+ unsigned long
+ *rC);
extern _X_EXPORT void IBMramdac526HWCursorInit(xf86CursorInfoPtr infoPtr);
extern _X_EXPORT void IBMramdac640HWCursorInit(xf86CursorInfoPtr infoPtr);
@@ -46,7 +81,7 @@ extern _X_EXPORT IBMramdac526SetBppProc *IBMramdac526SetBppWeak(void);
#define IBMRGB_pwr_mgmt 0x05
#define IBMRGB_dac_op 0x06
#define IBMRGB_pal_ctrl 0x07
-#define IBMRGB_sysclk 0x08 /* not RGB525 */
+#define IBMRGB_sysclk 0x08 /* not RGB525 */
#define IBMRGB_pix_fmt 0x0a
#define IBMRGB_8bpp 0x0b
#define IBMRGB_16bpp 0x0c
@@ -55,8 +90,8 @@ extern _X_EXPORT IBMramdac526SetBppProc *IBMramdac526SetBppWeak(void);
#define IBMRGB_pll_ctrl1 0x10
#define IBMRGB_pll_ctrl2 0x11
#define IBMRGB_pll_ref_div_fix 0x14
-#define IBMRGB_sysclk_ref_div 0x15 /* not RGB525 */
-#define IBMRGB_sysclk_vco_div 0x16 /* not RGB525 */
+#define IBMRGB_sysclk_ref_div 0x15 /* not RGB525 */
+#define IBMRGB_sysclk_vco_div 0x16 /* not RGB525 */
/* #define IBMRGB_f0 0x20 */
#define IBMRGB_sysclk_n 0x15
@@ -105,7 +140,7 @@ extern _X_EXPORT IBMramdac526SetBppProc *IBMramdac526SetBppWeak(void);
#define IBMRGB_misc1 0x70
#define IBMRGB_misc2 0x71
#define IBMRGB_misc3 0x72
-#define IBMRGB_misc4 0x73 /* not RGB525 */
+#define IBMRGB_misc4 0x73 /* not RGB525 */
#define IBMRGB_key_control 0x78
#define IBMRGB_dac_sense 0x82
#define IBMRGB_misr_r 0x84
@@ -119,9 +154,7 @@ extern _X_EXPORT IBMramdac526SetBppProc *IBMramdac526SetBppWeak(void);
#define IBMRGB_vram_mask_3 0x93
#define IBMRGB_curs_array 0x100
-
-
-/* Constants rgb525.h */
+/* Constants rgb525.h */
/* RGB525_REVISION_LEVEL */
#define RGB525_PRODUCT_REV_LEVEL 0xf0
diff --git a/xorg-server/hw/xfree86/ramdac/TI.c b/xorg-server/hw/xfree86/ramdac/TI.c
index f189fed25..393b774d4 100644
--- a/xorg-server/hw/xfree86/ramdac/TI.c
+++ b/xorg-server/hw/xfree86/ramdac/TI.c
@@ -1,717 +1,725 @@
-/*
- * Copyright 1998 by Alan Hourihane, Wigan, England.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *
- * Modified from IBM.c to support TI RAMDAC routines
- * by Jens Owen, <jens@tungstengraphics.com>.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include "xf86Cursor.h"
-
-#define INIT_TI_RAMDAC_INFO
-#include "TIPriv.h"
-#include "xf86RamDacPriv.h"
-
-/* The following values are in kHz */
-#define TI_MIN_VCO_FREQ 110000
-#define TI_MAX_VCO_FREQ 220000
-
-unsigned long
-TIramdacCalculateMNPForClock(
- unsigned long RefClock, /* In 100Hz units */
- unsigned long ReqClock, /* In 100Hz units */
- char IsPixClock, /* boolean, is this the pixel or the sys clock */
- unsigned long MinClock, /* Min VCO rating */
- unsigned long MaxClock, /* Max VCO rating */
- unsigned long *rM, /* M Out */
- unsigned long *rN, /* N Out */
- unsigned long *rP /* Min P In, P Out */
-)
-{
- unsigned long n, p;
- unsigned long best_m = 0, best_n = 0;
- double VCO, IntRef = (double)RefClock;
- double m_err, inc_m, calc_m;
- unsigned long ActualClock;
-
- /* Make sure that MinClock <= ReqClock <= MaxClock */
- if ( ReqClock < MinClock)
- ReqClock = MinClock;
- if ( ReqClock > MaxClock )
- ReqClock = MaxClock;
-
- /*
- * ActualClock = VCO / 2 ^ p
- * Choose p so that TI_MIN_VCO_FREQ <= VCO <= TI_MAX_VCO_FREQ
- * Note that since TI_MAX_VCO_FREQ = 2 * TI_MIN_VCO_FREQ
- * we don't have to bother checking for this maximum limit.
- */
- VCO = (double)ReqClock;
- for ( p = 0; p < 3 && VCO < TI_MIN_VCO_FREQ; ( p )++ )
- VCO *= 2.0;
-
- /*
- * We avoid doing multiplications by ( 65 - n ),
- * and add an increment instead - this keeps any error small.
- */
- inc_m = VCO / ( IntRef * 8.0 );
-
- /* Initial value of calc_m for the loop */
- calc_m = inc_m + inc_m + inc_m;
-
- /* Initial amount of error for an integer - impossibly large */
- m_err = 2.0;
-
- /* Search for the closest INTEGER value of ( 65 - m ) */
- for ( n = 3; n <= 25; ( n )++, calc_m += inc_m ) {
-
- /* Ignore values of ( 65 - m ) which we can't use */
- if ( calc_m < 3.0 || calc_m > 64.0 )
- continue;
-
- /*
- * Pick the closest INTEGER (has smallest fractional part).
- * The optimizer should clean this up for us.
- */
- if (( calc_m - ( int ) calc_m ) < m_err ) {
- m_err = calc_m - ( int ) calc_m;
- best_m = ( int ) calc_m;
- best_n = n;
- }
- }
-
- /* 65 - ( 65 - x ) = x */
- *rM = 65 - best_m;
- *rN = 65 - best_n;
- *rP = p;
-
- /* Now all the calculations can be completed */
- VCO = 8.0 * IntRef * best_m / best_n;
- ActualClock = VCO / ( 1 << p );
-
- DebugF( "f_out=%ld f_vco=%.1f n=%d m=%d p=%d\n",
- ActualClock, VCO, *rN, *rM, *rP);
-
- return ActualClock;
-}
-
-void
-TIramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
- RamDacRegRecPtr ramdacReg)
-{
- int i;
- unsigned long status;
-
- /* Here we pass a short, so that we can evaluate a mask too
- * So that the mask is the high byte and the data the low byte
- * Order is important
- */
- TIRESTORE(TIDAC_latch_ctrl);
- TIRESTORE(TIDAC_true_color_ctrl);
- TIRESTORE(TIDAC_multiplex_ctrl);
- TIRESTORE(TIDAC_clock_select);
- TIRESTORE(TIDAC_palette_page);
- TIRESTORE(TIDAC_general_ctrl);
- TIRESTORE(TIDAC_misc_ctrl);
- /* 0x2A & 0x2B are reserved */
- TIRESTORE(TIDAC_key_over_low);
- TIRESTORE(TIDAC_key_over_high);
- TIRESTORE(TIDAC_key_red_low);
- TIRESTORE(TIDAC_key_red_high);
- TIRESTORE(TIDAC_key_green_low);
- TIRESTORE(TIDAC_key_green_high);
- TIRESTORE(TIDAC_key_blue_low);
- TIRESTORE(TIDAC_key_blue_high);
- TIRESTORE(TIDAC_key_ctrl);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_clock_ctrl, 0, 0x30);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_clock_ctrl, 0, 0x38);
- TIRESTORE(TIDAC_clock_ctrl);
- TIRESTORE(TIDAC_sense_test);
- TIRESTORE(TIDAC_ind_curs_ctrl);
-
- /* only restore clocks if they were valid to begin with */
-
- if (ramdacReg->DacRegs[TIDAC_PIXEL_VALID]) {
- /* Reset pixel clock */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x22);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_pixel_data, 0, 0x3c);
-
- /* Restore N, M & P values for pixel clocks */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_pixel_data, 0,
- ramdacReg->DacRegs[TIDAC_PIXEL_N]);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_pixel_data, 0,
- ramdacReg->DacRegs[TIDAC_PIXEL_M]);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_pixel_data, 0,
- ramdacReg->DacRegs[TIDAC_PIXEL_P]);
-
- /* wait for pixel clock to lock */
- i = 1000000;
- do {
- status = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_pixel_data);
- } while ((!(status & 0x40)) && (--i));
- if (!(status & 0x40)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Pixel clock setup timed out\n");
- return;
- }
- }
-
- if (ramdacReg->DacRegs[TIDAC_LOOP_VALID]) {
- /* Reset loop clock */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x22);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_loop_data, 0, 0x70);
-
- /* Restore N, M & P values for pixel clocks */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_loop_data, 0,
- ramdacReg->DacRegs[TIDAC_LOOP_N]);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_loop_data, 0,
- ramdacReg->DacRegs[TIDAC_LOOP_M]);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_loop_data, 0,
- ramdacReg->DacRegs[TIDAC_LOOP_P]);
-
- /* wait for loop clock to lock */
- i = 1000000;
- do {
- status = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_loop_data);
- } while ((!(status & 0x40)) && (--i));
- if (!(status & 0x40)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Loop clock setup timed out\n");
- return;
- }
- }
-
- /* restore palette */
- (*ramdacPtr->WriteAddress)(pScrn, 0);
-#ifndef NOT_DONE
- for (i=0;i<768;i++)
- (*ramdacPtr->WriteData)(pScrn, ramdacReg->DAC[i]);
-#else
- (*ramdacPtr->WriteData)(pScrn, 0);
- (*ramdacPtr->WriteData)(pScrn, 0);
- (*ramdacPtr->WriteData)(pScrn, 0);
- for (i=0;i<765;i++)
- (*ramdacPtr->WriteData)(pScrn, 0xff);
-#endif
-}
-
-void
-TIramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
- RamDacRegRecPtr ramdacReg)
-{
- int i;
-
- (*ramdacPtr->ReadAddress)(pScrn, 0);
- for (i=0;i<768;i++)
- ramdacReg->DAC[i] = (*ramdacPtr->ReadData)(pScrn);
-
- /* Read back N,M and P values for pixel clock */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0);
- ramdacReg->DacRegs[TIDAC_PIXEL_N] =
- (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_pixel_data);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x11);
- ramdacReg->DacRegs[TIDAC_PIXEL_M] =
- (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_pixel_data);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x22);
- ramdacReg->DacRegs[TIDAC_PIXEL_P] =
- (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_pixel_data);
-
- /* Read back N,M and P values for loop clock */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0);
- ramdacReg->DacRegs[TIDAC_LOOP_N] =
- (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_loop_data);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x11);
- ramdacReg->DacRegs[TIDAC_LOOP_M] =
- (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_loop_data);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x22);
- ramdacReg->DacRegs[TIDAC_LOOP_P] =
- (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_loop_data);
-
- /* Order is important */
- TISAVE(TIDAC_latch_ctrl);
- TISAVE(TIDAC_true_color_ctrl);
- TISAVE(TIDAC_multiplex_ctrl);
- TISAVE(TIDAC_clock_select);
- TISAVE(TIDAC_palette_page);
- TISAVE(TIDAC_general_ctrl);
- TISAVE(TIDAC_misc_ctrl);
- /* 0x2A & 0x2B are reserved */
- TISAVE(TIDAC_key_over_low);
- TISAVE(TIDAC_key_over_high);
- TISAVE(TIDAC_key_red_low);
- TISAVE(TIDAC_key_red_high);
- TISAVE(TIDAC_key_green_low);
- TISAVE(TIDAC_key_green_high);
- TISAVE(TIDAC_key_blue_low);
- TISAVE(TIDAC_key_blue_high);
- TISAVE(TIDAC_key_ctrl);
- TISAVE(TIDAC_clock_ctrl);
- TISAVE(TIDAC_sense_test);
- TISAVE(TIDAC_ind_curs_ctrl);
-}
-
-RamDacHelperRecPtr
-TIramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
- RamDacHelperRecPtr ramdacHelperPtr = NULL;
- Bool RamDacIsSupported = FALSE;
- int TIramdac_ID = -1;
- int i;
- unsigned char id, rev, rev2, id2;
-
- /* read ID and revision */
- rev = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_rev);
- id = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_id);
-
- /* check if ID and revision are read only */
- (*ramdacPtr->WriteDAC)(pScrn, ~rev, 0, TIDAC_rev);
- (*ramdacPtr->WriteDAC)(pScrn, ~id, 0, TIDAC_id);
- rev2 = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_rev);
- id2 = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_id);
-
- switch (id) {
- case TIDAC_TVP_3030_ID:
- if (id == id2 && rev == rev2) /* check for READ ONLY */
- TIramdac_ID = TI3030_RAMDAC;
- break;
- case TIDAC_TVP_3026_ID:
- if (id == id2 && rev == rev2) /* check for READ ONLY */
- TIramdac_ID = TI3026_RAMDAC;
- break;
- }
-
- (*ramdacPtr->WriteDAC)(pScrn, rev, 0, TIDAC_rev);
- (*ramdacPtr->WriteDAC)(pScrn, id, 0, TIDAC_id);
-
- if (TIramdac_ID == -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Cannot determine TI RAMDAC type, aborting\n");
- return NULL;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Attached RAMDAC is %s\n", TIramdacDeviceInfo[TIramdac_ID&0xFFFF].DeviceName);
- }
-
- for (i=0;ramdacs[i].token != -1;i++) {
- if (ramdacs[i].token == TIramdac_ID)
- RamDacIsSupported = TRUE;
- }
-
- if (!RamDacIsSupported) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "This TI RAMDAC is NOT supported by this driver, aborting\n");
- return NULL;
- }
-
- ramdacHelperPtr = RamDacHelperCreateInfoRec();
- switch (TIramdac_ID) {
- case TI3030_RAMDAC:
- ramdacHelperPtr->SetBpp = TIramdac3030SetBpp;
- ramdacHelperPtr->HWCursorInit = TIramdacHWCursorInit;
- break;
- case TI3026_RAMDAC:
- ramdacHelperPtr->SetBpp = TIramdac3026SetBpp;
- ramdacHelperPtr->HWCursorInit = TIramdacHWCursorInit;
- break;
- }
- ramdacPtr->RamDacType = TIramdac_ID;
- ramdacHelperPtr->RamDacType = TIramdac_ID;
- ramdacHelperPtr->Save = TIramdacSave;
- ramdacHelperPtr->Restore = TIramdacRestore;
-
- return ramdacHelperPtr;
-}
-
-void
-TIramdac3026SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
-{
- switch (pScrn->bitsPerPixel) {
- case 32:
- /* order is important */
- ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x46;
- ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x5c;
- ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
- ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
- ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
- ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
- /* 0x2A & 0x2B are reserved */
- ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
- ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
- ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
- if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x06;
- ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
- ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x01;
- }
- ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
- break;
- case 24:
- /* order is important */
- ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x56;
- ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x58;
- ramdacReg->DacRegs[TIDAC_clock_select] = 0x25;
- ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
- ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
- ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
- /* 0x2A & 0x2B are reserved */
- ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
- ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
- ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
- ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
- break;
- case 16:
- /* order is important */
-#if 0
- /* Matrox driver uses this */
- ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x07;
-#else
- ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
-#endif
- if (pScrn->depth == 16) {
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x45;
- } else {
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x44;
- }
-#if 0
- /* Matrox driver uses this */
- ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x50;
- ramdacReg->DacRegs[TIDAC_clock_select] = 0x15;
- ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
- ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
-#else
- ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x54;
- ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
- ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
- ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
-#endif
- ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
- /* 0x2A & 0x2B are reserved */
- ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
- ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
- ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
- ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
- break;
- case 8:
- /* order is important */
- ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x80;
- ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x4c;
- ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
- ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
- ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
- ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x1C;
- /* 0x2A & 0x2B are reserved */
- ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_low] = 0x00;
- ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
- ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x00;
- ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
- ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
- break;
- }
-}
-
-void
-TIramdac3030SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
-{
- switch (pScrn->bitsPerPixel) {
- case 32:
- /* order is important */
- ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x46;
- ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x5D;
- ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
- ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
- ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
- ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
- /* 0x2A & 0x2B are reserved */
- ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
- ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
- ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
- if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x06;
- ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
- ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x01;
- }
- ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
- break;
- case 24:
- /* order is important */
- ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x56;
- ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x58;
- ramdacReg->DacRegs[TIDAC_clock_select] = 0x25;
- ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
- ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
- ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
- /* 0x2A & 0x2B are reserved */
- ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
- ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
- ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
- ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
- break;
- case 16:
- /* order is important */
-#if 0
- /* Matrox driver uses this */
- ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x07;
-#else
- ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
-#endif
- if (pScrn->depth == 16) {
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x45;
- } else {
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x44;
- }
-#if 0
- /* Matrox driver uses this */
- ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x50;
- ramdacReg->DacRegs[TIDAC_clock_select] = 0x15;
- ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
- ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
-#else
- ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x55;
- ramdacReg->DacRegs[TIDAC_clock_select] = 0x85;
- ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
- ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
-#endif
- ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
- /* 0x2A & 0x2B are reserved */
- ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
- ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
- ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
- ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
- break;
- case 8:
- /* order is important */
- ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
- ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x80;
- ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x4d;
- ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
- ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
- ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
- ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x1C;
- /* 0x2A & 0x2B are reserved */
- ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
- ramdacReg->DacRegs[TIDAC_key_blue_low] = 0x00;
- ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
- ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x00;
- ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
- ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
- break;
- }
-}
-
-static void
-TIramdacShowCursor(ScrnInfoPtr pScrn)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- /* Enable cursor - X11 mode */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_ind_curs_ctrl, 0, 0x03);
-}
-
-static void
-TIramdacHideCursor(ScrnInfoPtr pScrn)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- /* Disable cursor - X11 mode */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_ind_curs_ctrl, 0, 0x00);
-}
-
-static void
-TIramdacSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- x += 64;
- y += 64;
-
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_XLOW, 0, x & 0xff);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_XHIGH, 0, (x >> 8) & 0x0f);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_YLOW, 0, y & 0xff);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_YHIGH, 0, (y >> 8) & 0x0f);
-}
-
-static void
-TIramdacSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
-
- /* Background color */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_WRITE_ADDR, 0, 1);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, ((bg&0x00ff0000) >> 16));
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, ((bg&0x0000ff00) >> 8));
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, (bg&0x000000ff) );
-
- /* Foreground color */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_WRITE_ADDR, 0, 2);
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, ((fg&0x00ff0000) >> 16));
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, ((fg&0x0000ff00) >> 8));
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, (fg&0x000000ff) );
-}
-
-static void
-TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
-{
- RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
- int i = 1024;
-
- /* reset A9,A8 */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_ind_curs_ctrl, 0, 0x00);
- /* reset cursor RAM load address A7..A0 */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_INDEX, 0x00, 0x00);
-
- while(i--) {
- /* NOT_DONE: might need a delay here */
- (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_RAM_DATA, 0, *(src++));
- }
-}
-
-static Bool
-TIramdacUseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
-{
- return TRUE;
-}
-
-void
-TIramdacHWCursorInit(xf86CursorInfoPtr infoPtr)
-{
- infoPtr->MaxWidth = 64;
- infoPtr->MaxHeight = 64;
- infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
- HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
- HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED;
- infoPtr->SetCursorColors = TIramdacSetCursorColors;
- infoPtr->SetCursorPosition = TIramdacSetCursorPosition;
- infoPtr->LoadCursorImage = TIramdacLoadCursorImage;
- infoPtr->HideCursor = TIramdacHideCursor;
- infoPtr->ShowCursor = TIramdacShowCursor;
- infoPtr->UseHWCursor = TIramdacUseHWCursor;
-}
-
-void TIramdacLoadPalette(
- ScrnInfoPtr pScrn,
- int numColors,
- int *indices,
- LOCO *colors,
- VisualPtr pVisual
-){
- RamDacRecPtr hwp = RAMDACSCRPTR(pScrn);
- int i, index, shift;
-
- if (pScrn->depth == 16) {
- for(i = 0; i < numColors; i++) {
- index = indices[i];
- (*hwp->WriteAddress)(pScrn, index << 2);
- (*hwp->WriteData)(pScrn, colors[index >> 1].red);
- (*hwp->WriteData)(pScrn, colors[index].green);
- (*hwp->WriteData)(pScrn, colors[index >> 1].blue);
-
- if(index <= 31) {
- (*hwp->WriteAddress)(pScrn, index << 3);
- (*hwp->WriteData)(pScrn, colors[index].red);
- (*hwp->WriteData)(pScrn, colors[(index << 1) + 1].green);
- (*hwp->WriteData)(pScrn, colors[index].blue);
- }
- }
-} else {
- shift = (pScrn->depth == 15) ? 3 : 0;
-
- for(i = 0; i < numColors; i++) {
- index = indices[i];
- (*hwp->WriteAddress)(pScrn, index << shift);
- (*hwp->WriteData)(pScrn, colors[index].red);
- (*hwp->WriteData)(pScrn, colors[index].green);
- (*hwp->WriteData)(pScrn, colors[index].blue);
- }
-}
-}
-
-TIramdacLoadPaletteProc *TIramdacLoadPaletteWeak(void) {
- return TIramdacLoadPalette;
-}
+/*
+ * Copyright 1998 by Alan Hourihane, Wigan, England.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Alan Hourihane not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Alan Hourihane makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
+ *
+ * Modified from IBM.c to support TI RAMDAC routines
+ * by Jens Owen, <jens@tungstengraphics.com>.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "xf86Cursor.h"
+
+#define INIT_TI_RAMDAC_INFO
+#include "TIPriv.h"
+#include "xf86RamDacPriv.h"
+
+/* The following values are in kHz */
+#define TI_MIN_VCO_FREQ 110000
+#define TI_MAX_VCO_FREQ 220000
+
+unsigned long
+TIramdacCalculateMNPForClock(unsigned long RefClock, /* In 100Hz units */
+ unsigned long ReqClock, /* In 100Hz units */
+ char IsPixClock, /* boolean, is this the pixel or the sys clock */
+ unsigned long MinClock, /* Min VCO rating */
+ unsigned long MaxClock, /* Max VCO rating */
+ unsigned long *rM, /* M Out */
+ unsigned long *rN, /* N Out */
+ unsigned long *rP /* Min P In, P Out */
+ )
+{
+ unsigned long n, p;
+ unsigned long best_m = 0, best_n = 0;
+ double VCO, IntRef = (double) RefClock;
+ double m_err, inc_m, calc_m;
+ unsigned long ActualClock;
+
+ /* Make sure that MinClock <= ReqClock <= MaxClock */
+ if (ReqClock < MinClock)
+ ReqClock = MinClock;
+ if (ReqClock > MaxClock)
+ ReqClock = MaxClock;
+
+ /*
+ * ActualClock = VCO / 2 ^ p
+ * Choose p so that TI_MIN_VCO_FREQ <= VCO <= TI_MAX_VCO_FREQ
+ * Note that since TI_MAX_VCO_FREQ = 2 * TI_MIN_VCO_FREQ
+ * we don't have to bother checking for this maximum limit.
+ */
+ VCO = (double) ReqClock;
+ for (p = 0; p < 3 && VCO < TI_MIN_VCO_FREQ; (p)++)
+ VCO *= 2.0;
+
+ /*
+ * We avoid doing multiplications by ( 65 - n ),
+ * and add an increment instead - this keeps any error small.
+ */
+ inc_m = VCO / (IntRef * 8.0);
+
+ /* Initial value of calc_m for the loop */
+ calc_m = inc_m + inc_m + inc_m;
+
+ /* Initial amount of error for an integer - impossibly large */
+ m_err = 2.0;
+
+ /* Search for the closest INTEGER value of ( 65 - m ) */
+ for (n = 3; n <= 25; (n)++, calc_m += inc_m) {
+
+ /* Ignore values of ( 65 - m ) which we can't use */
+ if (calc_m < 3.0 || calc_m > 64.0)
+ continue;
+
+ /*
+ * Pick the closest INTEGER (has smallest fractional part).
+ * The optimizer should clean this up for us.
+ */
+ if ((calc_m - (int) calc_m) < m_err) {
+ m_err = calc_m - (int) calc_m;
+ best_m = (int) calc_m;
+ best_n = n;
+ }
+ }
+
+ /* 65 - ( 65 - x ) = x */
+ *rM = 65 - best_m;
+ *rN = 65 - best_n;
+ *rP = p;
+
+ /* Now all the calculations can be completed */
+ VCO = 8.0 * IntRef * best_m / best_n;
+ ActualClock = VCO / (1 << p);
+
+ DebugF("f_out=%ld f_vco=%.1f n=%d m=%d p=%d\n",
+ ActualClock, VCO, *rN, *rM, *rP);
+
+ return ActualClock;
+}
+
+void
+TIramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
+{
+ int i;
+ unsigned long status;
+
+ /* Here we pass a short, so that we can evaluate a mask too
+ * So that the mask is the high byte and the data the low byte
+ * Order is important
+ */
+ TIRESTORE(TIDAC_latch_ctrl);
+ TIRESTORE(TIDAC_true_color_ctrl);
+ TIRESTORE(TIDAC_multiplex_ctrl);
+ TIRESTORE(TIDAC_clock_select);
+ TIRESTORE(TIDAC_palette_page);
+ TIRESTORE(TIDAC_general_ctrl);
+ TIRESTORE(TIDAC_misc_ctrl);
+ /* 0x2A & 0x2B are reserved */
+ TIRESTORE(TIDAC_key_over_low);
+ TIRESTORE(TIDAC_key_over_high);
+ TIRESTORE(TIDAC_key_red_low);
+ TIRESTORE(TIDAC_key_red_high);
+ TIRESTORE(TIDAC_key_green_low);
+ TIRESTORE(TIDAC_key_green_high);
+ TIRESTORE(TIDAC_key_blue_low);
+ TIRESTORE(TIDAC_key_blue_high);
+ TIRESTORE(TIDAC_key_ctrl);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_clock_ctrl, 0, 0x30);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_clock_ctrl, 0, 0x38);
+ TIRESTORE(TIDAC_clock_ctrl);
+ TIRESTORE(TIDAC_sense_test);
+ TIRESTORE(TIDAC_ind_curs_ctrl);
+
+ /* only restore clocks if they were valid to begin with */
+
+ if (ramdacReg->DacRegs[TIDAC_PIXEL_VALID]) {
+ /* Reset pixel clock */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x22);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_pixel_data, 0, 0x3c);
+
+ /* Restore N, M & P values for pixel clocks */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_pixel_data, 0,
+ ramdacReg->DacRegs[TIDAC_PIXEL_N]);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_pixel_data, 0,
+ ramdacReg->DacRegs[TIDAC_PIXEL_M]);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_pixel_data, 0,
+ ramdacReg->DacRegs[TIDAC_PIXEL_P]);
+
+ /* wait for pixel clock to lock */
+ i = 1000000;
+ do {
+ status = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_pixel_data);
+ } while ((!(status & 0x40)) && (--i));
+ if (!(status & 0x40)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Pixel clock setup timed out\n");
+ return;
+ }
+ }
+
+ if (ramdacReg->DacRegs[TIDAC_LOOP_VALID]) {
+ /* Reset loop clock */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x22);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_loop_data, 0, 0x70);
+
+ /* Restore N, M & P values for pixel clocks */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_loop_data, 0,
+ ramdacReg->DacRegs[TIDAC_LOOP_N]);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_loop_data, 0,
+ ramdacReg->DacRegs[TIDAC_LOOP_M]);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_loop_data, 0,
+ ramdacReg->DacRegs[TIDAC_LOOP_P]);
+
+ /* wait for loop clock to lock */
+ i = 1000000;
+ do {
+ status = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_loop_data);
+ } while ((!(status & 0x40)) && (--i));
+ if (!(status & 0x40)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Loop clock setup timed out\n");
+ return;
+ }
+ }
+
+ /* restore palette */
+ (*ramdacPtr->WriteAddress) (pScrn, 0);
+#ifndef NOT_DONE
+ for (i = 0; i < 768; i++)
+ (*ramdacPtr->WriteData) (pScrn, ramdacReg->DAC[i]);
+#else
+ (*ramdacPtr->WriteData) (pScrn, 0);
+ (*ramdacPtr->WriteData) (pScrn, 0);
+ (*ramdacPtr->WriteData) (pScrn, 0);
+ for (i = 0; i < 765; i++)
+ (*ramdacPtr->WriteData) (pScrn, 0xff);
+#endif
+}
+
+void
+TIramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
+{
+ int i;
+
+ (*ramdacPtr->ReadAddress) (pScrn, 0);
+ for (i = 0; i < 768; i++)
+ ramdacReg->DAC[i] = (*ramdacPtr->ReadData) (pScrn);
+
+ /* Read back N,M and P values for pixel clock */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0);
+ ramdacReg->DacRegs[TIDAC_PIXEL_N] =
+ (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_pixel_data);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x11);
+ ramdacReg->DacRegs[TIDAC_PIXEL_M] =
+ (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_pixel_data);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x22);
+ ramdacReg->DacRegs[TIDAC_PIXEL_P] =
+ (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_pixel_data);
+
+ /* Read back N,M and P values for loop clock */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0);
+ ramdacReg->DacRegs[TIDAC_LOOP_N] =
+ (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_loop_data);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x11);
+ ramdacReg->DacRegs[TIDAC_LOOP_M] =
+ (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_loop_data);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_pll_addr, 0, 0x22);
+ ramdacReg->DacRegs[TIDAC_LOOP_P] =
+ (*ramdacPtr->ReadDAC) (pScrn, TIDAC_pll_loop_data);
+
+ /* Order is important */
+ TISAVE(TIDAC_latch_ctrl);
+ TISAVE(TIDAC_true_color_ctrl);
+ TISAVE(TIDAC_multiplex_ctrl);
+ TISAVE(TIDAC_clock_select);
+ TISAVE(TIDAC_palette_page);
+ TISAVE(TIDAC_general_ctrl);
+ TISAVE(TIDAC_misc_ctrl);
+ /* 0x2A & 0x2B are reserved */
+ TISAVE(TIDAC_key_over_low);
+ TISAVE(TIDAC_key_over_high);
+ TISAVE(TIDAC_key_red_low);
+ TISAVE(TIDAC_key_red_high);
+ TISAVE(TIDAC_key_green_low);
+ TISAVE(TIDAC_key_green_high);
+ TISAVE(TIDAC_key_blue_low);
+ TISAVE(TIDAC_key_blue_high);
+ TISAVE(TIDAC_key_ctrl);
+ TISAVE(TIDAC_clock_ctrl);
+ TISAVE(TIDAC_sense_test);
+ TISAVE(TIDAC_ind_curs_ctrl);
+}
+
+RamDacHelperRecPtr
+TIramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ RamDacHelperRecPtr ramdacHelperPtr = NULL;
+ Bool RamDacIsSupported = FALSE;
+ int TIramdac_ID = -1;
+ int i;
+ unsigned char id, rev, rev2, id2;
+
+ /* read ID and revision */
+ rev = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_rev);
+ id = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_id);
+
+ /* check if ID and revision are read only */
+ (*ramdacPtr->WriteDAC) (pScrn, ~rev, 0, TIDAC_rev);
+ (*ramdacPtr->WriteDAC) (pScrn, ~id, 0, TIDAC_id);
+ rev2 = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_rev);
+ id2 = (*ramdacPtr->ReadDAC) (pScrn, TIDAC_id);
+
+ switch (id) {
+ case TIDAC_TVP_3030_ID:
+ if (id == id2 && rev == rev2) /* check for READ ONLY */
+ TIramdac_ID = TI3030_RAMDAC;
+ break;
+ case TIDAC_TVP_3026_ID:
+ if (id == id2 && rev == rev2) /* check for READ ONLY */
+ TIramdac_ID = TI3026_RAMDAC;
+ break;
+ }
+
+ (*ramdacPtr->WriteDAC) (pScrn, rev, 0, TIDAC_rev);
+ (*ramdacPtr->WriteDAC) (pScrn, id, 0, TIDAC_id);
+
+ if (TIramdac_ID == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Cannot determine TI RAMDAC type, aborting\n");
+ return NULL;
+ }
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Attached RAMDAC is %s\n",
+ TIramdacDeviceInfo[TIramdac_ID & 0xFFFF].DeviceName);
+ }
+
+ for (i = 0; ramdacs[i].token != -1; i++) {
+ if (ramdacs[i].token == TIramdac_ID)
+ RamDacIsSupported = TRUE;
+ }
+
+ if (!RamDacIsSupported) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "This TI RAMDAC is NOT supported by this driver, aborting\n");
+ return NULL;
+ }
+
+ ramdacHelperPtr = RamDacHelperCreateInfoRec();
+ switch (TIramdac_ID) {
+ case TI3030_RAMDAC:
+ ramdacHelperPtr->SetBpp = TIramdac3030SetBpp;
+ ramdacHelperPtr->HWCursorInit = TIramdacHWCursorInit;
+ break;
+ case TI3026_RAMDAC:
+ ramdacHelperPtr->SetBpp = TIramdac3026SetBpp;
+ ramdacHelperPtr->HWCursorInit = TIramdacHWCursorInit;
+ break;
+ }
+ ramdacPtr->RamDacType = TIramdac_ID;
+ ramdacHelperPtr->RamDacType = TIramdac_ID;
+ ramdacHelperPtr->Save = TIramdacSave;
+ ramdacHelperPtr->Restore = TIramdacRestore;
+
+ return ramdacHelperPtr;
+}
+
+void
+TIramdac3026SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
+{
+ switch (pScrn->bitsPerPixel) {
+ case 32:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x46;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x5c;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x01;
+ }
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 24:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x56;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x58;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x25;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 16:
+ /* order is important */
+#if 0
+ /* Matrox driver uses this */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x07;
+#else
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+#endif
+ if (pScrn->depth == 16) {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x45;
+ }
+ else {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x44;
+ }
+#if 0
+ /* Matrox driver uses this */
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x50;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x15;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
+#else
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x54;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+#endif
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 8:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x80;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x4c;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x1C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x00;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ }
+}
+
+void
+TIramdac3030SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
+{
+ switch (pScrn->bitsPerPixel) {
+ case 32:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x46;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x5D;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x01;
+ }
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 24:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x56;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x58;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x25;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 16:
+ /* order is important */
+#if 0
+ /* Matrox driver uses this */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x07;
+#else
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+#endif
+ if (pScrn->depth == 16) {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x45;
+ }
+ else {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x44;
+ }
+#if 0
+ /* Matrox driver uses this */
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x50;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x15;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
+#else
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x55;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x85;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+#endif
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 8:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x80;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x4d;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x1C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x00;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ }
+}
+
+static void
+TIramdacShowCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Enable cursor - X11 mode */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_ind_curs_ctrl, 0, 0x03);
+}
+
+static void
+TIramdacHideCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Disable cursor - X11 mode */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_ind_curs_ctrl, 0, 0x00);
+}
+
+static void
+TIramdacSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ x += 64;
+ y += 64;
+
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_XLOW, 0, x & 0xff);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_XHIGH, 0, (x >> 8) & 0x0f);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_YLOW, 0, y & 0xff);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_YHIGH, 0, (y >> 8) & 0x0f);
+}
+
+static void
+TIramdacSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Background color */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_WRITE_ADDR, 0, 1);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0,
+ ((bg & 0x00ff0000) >> 16));
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0,
+ ((bg & 0x0000ff00) >> 8));
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, (bg & 0x000000ff));
+
+ /* Foreground color */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_WRITE_ADDR, 0, 2);
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0,
+ ((fg & 0x00ff0000) >> 16));
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0,
+ ((fg & 0x0000ff00) >> 8));
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, (fg & 0x000000ff));
+}
+
+static void
+TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ int i = 1024;
+
+ /* reset A9,A8 */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_ind_curs_ctrl, 0, 0x00);
+ /* reset cursor RAM load address A7..A0 */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_INDEX, 0x00, 0x00);
+
+ while (i--) {
+ /* NOT_DONE: might need a delay here */
+ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_RAM_DATA, 0, *(src++));
+ }
+}
+
+static Bool
+TIramdacUseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
+{
+ return TRUE;
+}
+
+void
+TIramdacHWCursorInit(xf86CursorInfoPtr infoPtr)
+{
+ infoPtr->MaxWidth = 64;
+ infoPtr->MaxHeight = 64;
+ infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED;
+ infoPtr->SetCursorColors = TIramdacSetCursorColors;
+ infoPtr->SetCursorPosition = TIramdacSetCursorPosition;
+ infoPtr->LoadCursorImage = TIramdacLoadCursorImage;
+ infoPtr->HideCursor = TIramdacHideCursor;
+ infoPtr->ShowCursor = TIramdacShowCursor;
+ infoPtr->UseHWCursor = TIramdacUseHWCursor;
+}
+
+void
+TIramdacLoadPalette(ScrnInfoPtr pScrn,
+ int numColors,
+ int *indices, LOCO * colors, VisualPtr pVisual)
+{
+ RamDacRecPtr hwp = RAMDACSCRPTR(pScrn);
+ int i, index, shift;
+
+ if (pScrn->depth == 16) {
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ (*hwp->WriteAddress) (pScrn, index << 2);
+ (*hwp->WriteData) (pScrn, colors[index >> 1].red);
+ (*hwp->WriteData) (pScrn, colors[index].green);
+ (*hwp->WriteData) (pScrn, colors[index >> 1].blue);
+
+ if (index <= 31) {
+ (*hwp->WriteAddress) (pScrn, index << 3);
+ (*hwp->WriteData) (pScrn, colors[index].red);
+ (*hwp->WriteData) (pScrn, colors[(index << 1) + 1].green);
+ (*hwp->WriteData) (pScrn, colors[index].blue);
+ }
+ }
+ }
+ else {
+ shift = (pScrn->depth == 15) ? 3 : 0;
+
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ (*hwp->WriteAddress) (pScrn, index << shift);
+ (*hwp->WriteData) (pScrn, colors[index].red);
+ (*hwp->WriteData) (pScrn, colors[index].green);
+ (*hwp->WriteData) (pScrn, colors[index].blue);
+ }
+ }
+}
+
+TIramdacLoadPaletteProc *
+TIramdacLoadPaletteWeak(void)
+{
+ return TIramdacLoadPalette;
+}
diff --git a/xorg-server/hw/xfree86/ramdac/TI.h b/xorg-server/hw/xfree86/ramdac/TI.h
index f5499f903..3969ee71d 100644
--- a/xorg-server/hw/xfree86/ramdac/TI.h
+++ b/xorg-server/hw/xfree86/ramdac/TI.h
@@ -1,21 +1,36 @@
#include <xf86RamDac.h>
-extern _X_EXPORT unsigned long TIramdacCalculateMNPForClock(unsigned long RefClock,
- unsigned long ReqClock, char IsPixClock, unsigned long MinClock,
- unsigned long MaxClock, unsigned long *rM, unsigned long *rN,
- unsigned long *rP);
-extern _X_EXPORT RamDacHelperRecPtr TIramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs);
-extern _X_EXPORT void TIramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
-extern _X_EXPORT void TIramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
-extern _X_EXPORT void TIramdac3026SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec);
-extern _X_EXPORT void TIramdac3030SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT unsigned long TIramdacCalculateMNPForClock(unsigned long
+ RefClock,
+ unsigned long
+ ReqClock,
+ char IsPixClock,
+ unsigned long
+ MinClock,
+ unsigned long
+ MaxClock,
+ unsigned long *rM,
+ unsigned long *rN,
+ unsigned long *rP);
+extern _X_EXPORT RamDacHelperRecPtr TIramdacProbe(ScrnInfoPtr pScrn,
+ RamDacSupportedInfoRecPtr
+ ramdacs);
+extern _X_EXPORT void TIramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec,
+ RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT void TIramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec,
+ RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT void TIramdac3026SetBpp(ScrnInfoPtr pScrn,
+ RamDacRegRecPtr RamDacRegRec);
+extern _X_EXPORT void TIramdac3030SetBpp(ScrnInfoPtr pScrn,
+ RamDacRegRecPtr RamDacRegRec);
extern _X_EXPORT void TIramdacHWCursorInit(xf86CursorInfoPtr infoPtr);
-extern _X_EXPORT void TIramdacLoadPalette( ScrnInfoPtr pScrn, int numColors, int *indices,
- LOCO *colors, VisualPtr pVisual);
+extern _X_EXPORT void TIramdacLoadPalette(ScrnInfoPtr pScrn, int numColors,
+ int *indices, LOCO * colors,
+ VisualPtr pVisual);
typedef void TIramdacLoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *,
- VisualPtr);
+ VisualPtr);
extern _X_EXPORT TIramdacLoadPaletteProc *TIramdacLoadPaletteWeak(void);
#define TI3030_RAMDAC (VENDOR_TI << 16) | 0x00
@@ -86,6 +101,6 @@ extern _X_EXPORT TIramdacLoadPaletteProc *TIramdacLoadPaletteWeak(void);
#define TIDAC_sw_reset 0xff
-/* Constants */
+/* Constants */
#define TIDAC_TVP_3026_ID 0x26
#define TIDAC_TVP_3030_ID 0x30
diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
index 1e0f7e0b7..678d2be5c 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
+++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
@@ -30,46 +30,44 @@ static Bool xf86DeviceCursorInitialize(DeviceIntPtr, ScreenPtr);
static void xf86DeviceCursorCleanup(DeviceIntPtr, ScreenPtr);
static miPointerSpriteFuncRec xf86CursorSpriteFuncs = {
- xf86CursorRealizeCursor,
- xf86CursorUnrealizeCursor,
- xf86CursorSetCursor,
- xf86CursorMoveCursor,
- xf86DeviceCursorInitialize,
- xf86DeviceCursorCleanup
+ xf86CursorRealizeCursor,
+ xf86CursorUnrealizeCursor,
+ xf86CursorSetCursor,
+ xf86CursorMoveCursor,
+ xf86DeviceCursorInitialize,
+ xf86DeviceCursorCleanup
};
/* Screen functions */
static void xf86CursorInstallColormap(ColormapPtr);
-static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr, Bool);
+static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr,
+ Bool);
static Bool xf86CursorCloseScreen(int, ScreenPtr);
-static void xf86CursorQueryBestSize(int, unsigned short*, unsigned short*,
- ScreenPtr);
+static void xf86CursorQueryBestSize(int, unsigned short *, unsigned short *,
+ ScreenPtr);
/* ScrnInfoRec functions */
static void xf86CursorEnableDisableFBAccess(int, Bool);
-static Bool xf86CursorSwitchMode(int, DisplayModePtr,int);
+static Bool xf86CursorSwitchMode(int, DisplayModePtr, int);
Bool
-xf86InitCursor(
- ScreenPtr pScreen,
- xf86CursorInfoPtr infoPtr
-)
+xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
xf86CursorScreenPtr ScreenPriv;
miPointerScreenPtr PointPriv;
if (!xf86InitHardwareCursor(pScreen, infoPtr))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&xf86CursorScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
ScreenPriv = calloc(1, sizeof(xf86CursorScreenRec));
if (!ScreenPriv)
- return FALSE;
+ return FALSE;
dixSetPrivate(&pScreen->devPrivates, xf86CursorScreenKey, ScreenPriv);
@@ -88,31 +86,31 @@ xf86InitCursor(
pScreen->RecolorCursor = xf86CursorRecolorCursor;
if ((infoPtr->pScrn->bitsPerPixel == 8) &&
- !(infoPtr->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP)) {
- ScreenPriv->InstallColormap = pScreen->InstallColormap;
- pScreen->InstallColormap = xf86CursorInstallColormap;
- ScreenPriv->PalettedCursor = TRUE;
+ !(infoPtr->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP)) {
+ ScreenPriv->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = xf86CursorInstallColormap;
+ ScreenPriv->PalettedCursor = TRUE;
}
PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
ScreenPriv->showTransparent = PointPriv->showTransparent;
if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT)
- PointPriv->showTransparent = TRUE;
+ PointPriv->showTransparent = TRUE;
else
- PointPriv->showTransparent = FALSE;
+ PointPriv->showTransparent = FALSE;
ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
PointPriv->spriteFuncs = &xf86CursorSpriteFuncs;
ScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
ScreenPriv->SwitchMode = pScrn->SwitchMode;
-
+
ScreenPriv->ForceHWCursorCount = 0;
ScreenPriv->HWCursorForced = FALSE;
pScrn->EnableDisableFBAccess = xf86CursorEnableDisableFBAccess;
if (pScrn->SwitchMode)
- pScrn->SwitchMode = xf86CursorSwitchMode;
+ pScrn->SwitchMode = xf86CursorSwitchMode;
return TRUE;
}
@@ -123,22 +121,24 @@ static Bool
xf86CursorCloseScreen(int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, miPointerScreenKey);
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ miPointerScreenPtr PointPriv =
+ (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ miPointerScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
if (ScreenPriv->isUp && pScrn->vtSema)
- xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
+ xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
if (ScreenPriv->CurrentCursor)
- FreeCursor(ScreenPriv->CurrentCursor, None);
+ FreeCursor(ScreenPriv->CurrentCursor, None);
pScreen->CloseScreen = ScreenPriv->CloseScreen;
pScreen->QueryBestSize = ScreenPriv->QueryBestSize;
pScreen->RecolorCursor = ScreenPriv->RecolorCursor;
if (ScreenPriv->InstallColormap)
- pScreen->InstallColormap = ScreenPriv->InstallColormap;
+ pScreen->InstallColormap = ScreenPriv->InstallColormap;
PointPriv->spriteFuncs = ScreenPriv->spriteFuncs;
PointPriv->showTransparent = ScreenPriv->showTransparent;
@@ -149,92 +149,90 @@ xf86CursorCloseScreen(int i, ScreenPtr pScreen)
free(ScreenPriv->transparentData);
free(ScreenPriv);
- return (*pScreen->CloseScreen)(i, pScreen);
+ return (*pScreen->CloseScreen) (i, pScreen);
}
static void
-xf86CursorQueryBestSize(
- int class,
- unsigned short *width,
- unsigned short *height,
- ScreenPtr pScreen)
+xf86CursorQueryBestSize(int class,
+ unsigned short *width,
+ unsigned short *height, ScreenPtr pScreen)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
if (class == CursorShape) {
- if(*width > ScreenPriv->CursorInfoPtr->MaxWidth)
- *width = ScreenPriv->CursorInfoPtr->MaxWidth;
- if(*height > ScreenPriv->CursorInfoPtr->MaxHeight)
- *height = ScreenPriv->CursorInfoPtr->MaxHeight;
- } else
- (*ScreenPriv->QueryBestSize)(class, width, height, pScreen);
+ if (*width > ScreenPriv->CursorInfoPtr->MaxWidth)
+ *width = ScreenPriv->CursorInfoPtr->MaxWidth;
+ if (*height > ScreenPriv->CursorInfoPtr->MaxHeight)
+ *height = ScreenPriv->CursorInfoPtr->MaxHeight;
+ }
+ else
+ (*ScreenPriv->QueryBestSize) (class, width, height, pScreen);
}
static void
xf86CursorInstallColormap(ColormapPtr pMap)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pMap->pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pMap->pScreen->devPrivates,
+ xf86CursorScreenKey);
ScreenPriv->pInstalledMap = pMap;
- (*ScreenPriv->InstallColormap)(pMap);
+ (*ScreenPriv->InstallColormap) (pMap);
}
static void
-xf86CursorRecolorCursor(
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCurs,
- Bool displayed)
+xf86CursorRecolorCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
if (!displayed)
- return;
+ return;
if (ScreenPriv->SWCursor)
- (*ScreenPriv->RecolorCursor)(pDev, pScreen, pCurs, displayed);
+ (*ScreenPriv->RecolorCursor) (pDev, pScreen, pCurs, displayed);
else
- xf86RecolorCursor(pScreen, pCurs, displayed);
+ xf86RecolorCursor(pScreen, pCurs, displayed);
}
/***** ScrnInfoRec functions *********/
static void
-xf86CursorEnableDisableFBAccess(
- int index,
- Bool enable)
+xf86CursorEnableDisableFBAccess(int index, Bool enable)
{
DeviceIntPtr pDev = inputInfo.pointer;
ScreenPtr pScreen = screenInfo.screens[index];
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
if (!enable && ScreenPriv->CurrentCursor != NullCursor) {
CursorPtr currentCursor = ScreenPriv->CurrentCursor;
+
xf86CursorSetCursor(pDev, pScreen, NullCursor, ScreenPriv->x,
- ScreenPriv->y);
+ ScreenPriv->y);
ScreenPriv->isUp = FALSE;
- ScreenPriv->SWCursor = TRUE;
- ScreenPriv->SavedCursor = currentCursor;
+ ScreenPriv->SWCursor = TRUE;
+ ScreenPriv->SavedCursor = currentCursor;
}
if (ScreenPriv->EnableDisableFBAccess)
- (*ScreenPriv->EnableDisableFBAccess)(index, enable);
-
- if (enable && ScreenPriv->SavedCursor)
- {
- /*
- * Re-set current cursor so drivers can react to FB access having been
- * temporarily disabled.
- */
- xf86CursorSetCursor(pDev, pScreen, ScreenPriv->SavedCursor,
- ScreenPriv->x, ScreenPriv->y);
- ScreenPriv->SavedCursor = NULL;
+ (*ScreenPriv->EnableDisableFBAccess) (index, enable);
+
+ if (enable && ScreenPriv->SavedCursor) {
+ /*
+ * Re-set current cursor so drivers can react to FB access having been
+ * temporarily disabled.
+ */
+ xf86CursorSetCursor(pDev, pScreen, ScreenPriv->SavedCursor,
+ ScreenPriv->x, ScreenPriv->y);
+ ScreenPriv->SavedCursor = NULL;
}
}
@@ -243,15 +241,16 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
{
Bool ret;
ScreenPtr pScreen = screenInfo.screens[index];
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
if (ScreenPriv->isUp) {
- xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
- ScreenPriv->isUp = FALSE;
+ xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
+ ScreenPriv->isUp = FALSE;
}
- ret = (*ScreenPriv->SwitchMode)(index, mode, flags);
+ ret = (*ScreenPriv->SwitchMode) (index, mode, flags);
/*
* Cannot restore cursor here because the new frame[XY][01] haven't been
@@ -259,7 +258,7 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
* ensure the cursor is repainted by miPointerWarpCursor().
*/
ScreenPriv->CursorToRestore = ScreenPriv->CurrentCursor;
- miPointerSetWaitForUpdate(pScreen, FALSE); /* Force cursor repaint */
+ miPointerSetWaitForUpdate(pScreen, FALSE); /* Force cursor repaint */
return ret;
}
@@ -269,90 +268,107 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
static Bool
xf86CursorRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
if (pCurs->refcnt <= 1)
- dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, NULL);
+ dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen,
+ NULL);
- return (*ScreenPriv->spriteFuncs->RealizeCursor)(pDev, pScreen, pCurs);
+ return (*ScreenPriv->spriteFuncs->RealizeCursor) (pDev, pScreen, pCurs);
}
static Bool
-xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
- CursorPtr pCurs)
+xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
if (pCurs->refcnt <= 1) {
- free(dixLookupScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen));
- dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, NULL);
+ free(dixLookupScreenPrivate
+ (&pCurs->devPrivates, CursorScreenKey, pScreen));
+ dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen,
+ NULL);
}
- return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pDev, pScreen, pCurs);
+ return (*ScreenPriv->spriteFuncs->UnrealizeCursor) (pDev, pScreen, pCurs);
}
static void
-xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
+xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
int x, int y)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
- if (pCurs == NullCursor) { /* means we're supposed to remove the cursor */
+ if (pCurs == NullCursor) { /* means we're supposed to remove the cursor */
if (ScreenPriv->SWCursor ||
!(GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer))
- (*ScreenPriv->spriteFuncs->SetCursor)(pDev, pScreen, NullCursor, x, y);
+ (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, NullCursor, x,
+ y);
else if (ScreenPriv->isUp) {
xf86SetCursor(pScreen, NullCursor, x, y);
ScreenPriv->isUp = FALSE;
}
- if (ScreenPriv->CurrentCursor)
- FreeCursor(ScreenPriv->CurrentCursor, None);
+ if (ScreenPriv->CurrentCursor)
+ FreeCursor(ScreenPriv->CurrentCursor, None);
ScreenPriv->CurrentCursor = NullCursor;
return;
}
/* only update for VCP, otherwise we get cursor jumps when removing a
sprite. The second cursor is never HW rendered anyway. */
- if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)
- {
- pCurs->refcnt++;
- if (ScreenPriv->CurrentCursor)
- FreeCursor(ScreenPriv->CurrentCursor, None);
- ScreenPriv->CurrentCursor = pCurs;
- ScreenPriv->x = x;
- ScreenPriv->y = y;
- ScreenPriv->CursorToRestore = NULL;
- ScreenPriv->HotX = pCurs->bits->xhot;
- ScreenPriv->HotY = pCurs->bits->yhot;
+ if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer) {
+ pCurs->refcnt++;
+ if (ScreenPriv->CurrentCursor)
+ FreeCursor(ScreenPriv->CurrentCursor, None);
+ ScreenPriv->CurrentCursor = pCurs;
+ ScreenPriv->x = x;
+ ScreenPriv->y = y;
+ ScreenPriv->CursorToRestore = NULL;
+ ScreenPriv->HotX = pCurs->bits->xhot;
+ ScreenPriv->HotY = pCurs->bits->yhot;
if (!infoPtr->pScrn->vtSema)
ScreenPriv->SavedCursor = pCurs;
- if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || ((
+ if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || ((
#ifdef ARGB_CURSOR
- pCurs->bits->argb && infoPtr->UseHWCursorARGB &&
- (*infoPtr->UseHWCursorARGB) (pScreen, pCurs) ) || (
- pCurs->bits->argb == 0 &&
+ pCurs->
+ bits->
+ argb
+ &&
+ infoPtr->
+ UseHWCursorARGB
+ &&
+ (*infoPtr->
+ UseHWCursorARGB)
+ (pScreen,
+ pCurs))
+ ||
+ (pCurs->
+ bits->
+ argb
+ == 0
+ &&
#endif
- (pCurs->bits->height <= infoPtr->MaxHeight) &&
- (pCurs->bits->width <= infoPtr->MaxWidth) &&
- (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor)(pScreen, pCurs))))))
- {
+ (pCurs->bits->height <= infoPtr->MaxHeight) && (pCurs->bits->width <= infoPtr->MaxWidth) && (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, pCurs)))))) {
- if (ScreenPriv->SWCursor) /* remove the SW cursor */
- (*ScreenPriv->spriteFuncs->SetCursor)(pDev, pScreen, NullCursor, x, y);
+ if (ScreenPriv->SWCursor) /* remove the SW cursor */
+ (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen,
+ NullCursor, x, y);
- xf86SetCursor(pScreen, pCurs, x, y);
- ScreenPriv->SWCursor = FALSE;
- ScreenPriv->isUp = TRUE;
+ xf86SetCursor(pScreen, pCurs, x, y);
+ ScreenPriv->SWCursor = FALSE;
+ ScreenPriv->isUp = TRUE;
- miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse);
- return;
- }
+ miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse);
+ return;
+ }
miPointerSetWaitForUpdate(pScreen, TRUE);
@@ -360,7 +376,8 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
/* Remove the HW cursor, or make it transparent */
if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT) {
xf86SetTransparentCursor(pScreen);
- } else {
+ }
+ else {
xf86SetCursor(pScreen, NullCursor, x, y);
ScreenPriv->isUp = FALSE;
}
@@ -372,63 +389,61 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
}
if (pCurs->bits->emptyMask && !ScreenPriv->showTransparent)
- pCurs = NullCursor;
+ pCurs = NullCursor;
- (*ScreenPriv->spriteFuncs->SetCursor)(pDev, pScreen, pCurs, x, y);
+ (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, pCurs, x, y);
}
static void
xf86CursorMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
/* only update coordinate state for first sprite, otherwise we get jumps
when removing a sprite. The second sprite is never HW rendered anyway */
- if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)
- {
- ScreenPriv->x = x;
- ScreenPriv->y = y;
+ if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer) {
+ ScreenPriv->x = x;
+ ScreenPriv->y = y;
if (ScreenPriv->CursorToRestore)
- xf86CursorSetCursor(pDev, pScreen, ScreenPriv->CursorToRestore, x, y);
+ xf86CursorSetCursor(pDev, pScreen, ScreenPriv->CursorToRestore, x,
+ y);
else if (ScreenPriv->SWCursor)
- (*ScreenPriv->spriteFuncs->MoveCursor)(pDev, pScreen, x, y);
+ (*ScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
else if (ScreenPriv->isUp)
xf86MoveCursor(pScreen, x, y);
- } else
- (*ScreenPriv->spriteFuncs->MoveCursor)(pDev, pScreen, x, y);
+ }
+ else
+ (*ScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
}
void
-xf86ForceHWCursor (ScreenPtr pScreen, Bool on)
+xf86ForceHWCursor(ScreenPtr pScreen, Bool on)
{
DeviceIntPtr pDev = inputInfo.pointer;
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
-
- if (on)
- {
- if (ScreenPriv->ForceHWCursorCount++ == 0)
- {
- if (ScreenPriv->SWCursor && ScreenPriv->CurrentCursor)
- {
- ScreenPriv->HWCursorForced = TRUE;
- xf86CursorSetCursor (pDev, pScreen, ScreenPriv->CurrentCursor,
- ScreenPriv->x, ScreenPriv->y);
- }
- else
- ScreenPriv->HWCursorForced = FALSE;
- }
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
+
+ if (on) {
+ if (ScreenPriv->ForceHWCursorCount++ == 0) {
+ if (ScreenPriv->SWCursor && ScreenPriv->CurrentCursor) {
+ ScreenPriv->HWCursorForced = TRUE;
+ xf86CursorSetCursor(pDev, pScreen, ScreenPriv->CurrentCursor,
+ ScreenPriv->x, ScreenPriv->y);
+ }
+ else
+ ScreenPriv->HWCursorForced = FALSE;
+ }
}
- else
- {
- if (--ScreenPriv->ForceHWCursorCount == 0)
- {
- if (ScreenPriv->HWCursorForced && ScreenPriv->CurrentCursor)
- xf86CursorSetCursor (pDev, pScreen, ScreenPriv->CurrentCursor,
- ScreenPriv->x, ScreenPriv->y);
- }
+ else {
+ if (--ScreenPriv->ForceHWCursorCount == 0) {
+ if (ScreenPriv->HWCursorForced && ScreenPriv->CurrentCursor)
+ xf86CursorSetCursor(pDev, pScreen, ScreenPriv->CurrentCursor,
+ ScreenPriv->x, ScreenPriv->y);
+ }
}
}
@@ -451,11 +466,12 @@ static Bool
xf86DeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
int ret;
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
/* Init SW cursor */
- ret = (*ScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen);
+ ret = (*ScreenPriv->spriteFuncs->DeviceCursorInitialize) (pDev, pScreen);
return ret;
}
@@ -466,10 +482,10 @@ xf86DeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
static void
xf86DeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
- /* Clean up SW cursor */
- (*ScreenPriv->spriteFuncs->DeviceCursorCleanup)(pDev, pScreen);
+ /* Clean up SW cursor */
+ (*ScreenPriv->spriteFuncs->DeviceCursorCleanup) (pDev, pScreen);
}
-
diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.h b/xorg-server/hw/xfree86/ramdac/xf86Cursor.h
index 3f3618b59..5658e7b30 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86Cursor.h
+++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.h
@@ -10,13 +10,13 @@ typedef struct _xf86CursorInfoRec {
int Flags;
int MaxWidth;
int MaxHeight;
- void (*SetCursorColors)(ScrnInfoPtr pScrn, int bg, int fg);
- void (*SetCursorPosition)(ScrnInfoPtr pScrn, int x, int y);
- void (*LoadCursorImage)(ScrnInfoPtr pScrn, unsigned char *bits);
- void (*HideCursor)(ScrnInfoPtr pScrn);
- void (*ShowCursor)(ScrnInfoPtr pScrn);
- unsigned char* (*RealizeCursor)(struct _xf86CursorInfoRec *, CursorPtr);
- Bool (*UseHWCursor)(ScreenPtr, CursorPtr);
+ void (*SetCursorColors) (ScrnInfoPtr pScrn, int bg, int fg);
+ void (*SetCursorPosition) (ScrnInfoPtr pScrn, int x, int y);
+ void (*LoadCursorImage) (ScrnInfoPtr pScrn, unsigned char *bits);
+ void (*HideCursor) (ScrnInfoPtr pScrn);
+ void (*ShowCursor) (ScrnInfoPtr pScrn);
+ unsigned char *(*RealizeCursor) (struct _xf86CursorInfoRec *, CursorPtr);
+ Bool (*UseHWCursor) (ScreenPtr, CursorPtr);
#ifdef ARGB_CURSOR
Bool (*UseHWCursorARGB) (ScreenPtr, CursorPtr);
@@ -25,10 +25,11 @@ typedef struct _xf86CursorInfoRec {
} xf86CursorInfoRec, *xf86CursorInfoPtr;
-extern _X_EXPORT Bool xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr);
+extern _X_EXPORT Bool xf86InitCursor(ScreenPtr pScreen,
+ xf86CursorInfoPtr infoPtr);
extern _X_EXPORT xf86CursorInfoPtr xf86CreateCursorInfoRec(void);
extern _X_EXPORT void xf86DestroyCursorInfoRec(xf86CursorInfoPtr);
-extern _X_EXPORT void xf86ForceHWCursor (ScreenPtr pScreen, Bool on);
+extern _X_EXPORT void xf86ForceHWCursor(ScreenPtr pScreen, Bool on);
#define HARDWARE_CURSOR_INVERT_MASK 0x00000001
#define HARDWARE_CURSOR_AND_SOURCE_WITH_MASK 0x00000002
@@ -48,4 +49,4 @@ extern _X_EXPORT void xf86ForceHWCursor (ScreenPtr pScreen, Bool on);
#define HARDWARE_CURSOR_ARGB 0x00004000
#endif
-#endif /* _XF86CURSOR_H */
+#endif /* _XF86CURSOR_H */
diff --git a/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c b/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c
index f9b09fc9a..95721490a 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c
@@ -39,18 +39,18 @@ static CARD64 xf86CARD64ReverseBits(CARD64 w);
static CARD64
xf86CARD64ReverseBits(CARD64 w)
{
- unsigned char *p = (unsigned char *)&w;
-
- p[0] = byte_reversed[p[0]];
- p[1] = byte_reversed[p[1]];
- p[2] = byte_reversed[p[2]];
- p[3] = byte_reversed[p[3]];
- p[4] = byte_reversed[p[4]];
- p[5] = byte_reversed[p[5]];
- p[6] = byte_reversed[p[6]];
- p[7] = byte_reversed[p[7]];
-
- return w;
+ unsigned char *p = (unsigned char *) &w;
+
+ p[0] = byte_reversed[p[0]];
+ p[1] = byte_reversed[p[1]];
+ p[2] = byte_reversed[p[2]];
+ p[3] = byte_reversed[p[3]];
+ p[4] = byte_reversed[p[4]];
+ p[5] = byte_reversed[p[5]];
+ p[6] = byte_reversed[p[6]];
+ p[7] = byte_reversed[p[7]];
+
+ return w;
}
#endif
@@ -61,48 +61,48 @@ xf86CARD64ReverseBits(CARD64 w)
#define CUR_LOG2_BITMAP_PAD LOG2_BITMAP_PAD
#define REVERSE_BIT_ORDER(w) xf86ReverseBitOrder(w)
-#endif /* BITMAP_SCANLINE_PAD == 64 */
+#endif /* BITMAP_SCANLINE_PAD == 64 */
-static unsigned char* RealizeCursorInterleave0(xf86CursorInfoPtr, CursorPtr);
-static unsigned char* RealizeCursorInterleave1(xf86CursorInfoPtr, CursorPtr);
-static unsigned char* RealizeCursorInterleave8(xf86CursorInfoPtr, CursorPtr);
-static unsigned char* RealizeCursorInterleave16(xf86CursorInfoPtr, CursorPtr);
-static unsigned char* RealizeCursorInterleave32(xf86CursorInfoPtr, CursorPtr);
-static unsigned char* RealizeCursorInterleave64(xf86CursorInfoPtr, CursorPtr);
+static unsigned char *RealizeCursorInterleave0(xf86CursorInfoPtr, CursorPtr);
+static unsigned char *RealizeCursorInterleave1(xf86CursorInfoPtr, CursorPtr);
+static unsigned char *RealizeCursorInterleave8(xf86CursorInfoPtr, CursorPtr);
+static unsigned char *RealizeCursorInterleave16(xf86CursorInfoPtr, CursorPtr);
+static unsigned char *RealizeCursorInterleave32(xf86CursorInfoPtr, CursorPtr);
+static unsigned char *RealizeCursorInterleave64(xf86CursorInfoPtr, CursorPtr);
Bool
xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
{
if ((infoPtr->MaxWidth <= 0) || (infoPtr->MaxHeight <= 0))
- return FALSE;
+ return FALSE;
/* These are required for now */
if (!infoPtr->SetCursorPosition ||
- !infoPtr->LoadCursorImage ||
- !infoPtr->HideCursor ||
- !infoPtr->ShowCursor ||
- !infoPtr->SetCursorColors)
- return FALSE;
+ !infoPtr->LoadCursorImage ||
+ !infoPtr->HideCursor ||
+ !infoPtr->ShowCursor || !infoPtr->SetCursorColors)
+ return FALSE;
if (infoPtr->RealizeCursor) {
- /* Don't overwrite a driver provided Realize Cursor function */
- } else
- if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 & infoPtr->Flags) {
- infoPtr->RealizeCursor = RealizeCursorInterleave1;
- } else
- if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 & infoPtr->Flags) {
- infoPtr->RealizeCursor = RealizeCursorInterleave8;
- } else
- if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 & infoPtr->Flags) {
- infoPtr->RealizeCursor = RealizeCursorInterleave16;
- } else
- if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 & infoPtr->Flags) {
- infoPtr->RealizeCursor = RealizeCursorInterleave32;
- } else
- if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 & infoPtr->Flags) {
- infoPtr->RealizeCursor = RealizeCursorInterleave64;
- } else { /* not interleaved */
- infoPtr->RealizeCursor = RealizeCursorInterleave0;
+ /* Don't overwrite a driver provided Realize Cursor function */
+ }
+ else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 & infoPtr->Flags) {
+ infoPtr->RealizeCursor = RealizeCursorInterleave1;
+ }
+ else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 & infoPtr->Flags) {
+ infoPtr->RealizeCursor = RealizeCursorInterleave8;
+ }
+ else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 & infoPtr->Flags) {
+ infoPtr->RealizeCursor = RealizeCursorInterleave16;
+ }
+ else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 & infoPtr->Flags) {
+ infoPtr->RealizeCursor = RealizeCursorInterleave32;
+ }
+ else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 & infoPtr->Flags) {
+ infoPtr->RealizeCursor = RealizeCursorInterleave64;
+ }
+ else { /* not interleaved */
+ infoPtr->RealizeCursor = RealizeCursorInterleave0;
}
infoPtr->pScrn = xf86Screens[pScreen->myNum];
@@ -113,17 +113,19 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
void
xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
unsigned char *bits;
if (pCurs == NullCursor) {
- (*infoPtr->HideCursor)(infoPtr->pScrn);
- return;
+ (*infoPtr->HideCursor) (infoPtr->pScrn);
+ return;
}
- bits = dixLookupScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen);
+ bits =
+ dixLookupScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen);
x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
@@ -131,68 +133,72 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
#ifdef ARGB_CURSOR
if (!pCurs->bits->argb || !infoPtr->LoadCursorARGB)
#endif
- if (!bits) {
- bits = (*infoPtr->RealizeCursor)(infoPtr, pCurs);
- dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, bits);
- }
+ if (!bits) {
+ bits = (*infoPtr->RealizeCursor) (infoPtr, pCurs);
+ dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen,
+ bits);
+ }
if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
- (*infoPtr->HideCursor)(infoPtr->pScrn);
+ (*infoPtr->HideCursor) (infoPtr->pScrn);
#ifdef ARGB_CURSOR
if (pCurs->bits->argb && infoPtr->LoadCursorARGB)
- (*infoPtr->LoadCursorARGB) (infoPtr->pScrn, pCurs);
+ (*infoPtr->LoadCursorARGB) (infoPtr->pScrn, pCurs);
else
#endif
if (bits)
- (*infoPtr->LoadCursorImage)(infoPtr->pScrn, bits);
+ (*infoPtr->LoadCursorImage) (infoPtr->pScrn, bits);
xf86RecolorCursor(pScreen, pCurs, 1);
- (*infoPtr->SetCursorPosition)(infoPtr->pScrn, x, y);
+ (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y);
- (*infoPtr->ShowCursor)(infoPtr->pScrn);
+ (*infoPtr->ShowCursor) (infoPtr->pScrn);
}
void
xf86SetTransparentCursor(ScreenPtr pScreen)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
if (!ScreenPriv->transparentData)
- ScreenPriv->transparentData =
- (*infoPtr->RealizeCursor)(infoPtr, NullCursor);
+ ScreenPriv->transparentData =
+ (*infoPtr->RealizeCursor) (infoPtr, NullCursor);
if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
- (*infoPtr->HideCursor)(infoPtr->pScrn);
+ (*infoPtr->HideCursor) (infoPtr->pScrn);
if (ScreenPriv->transparentData)
- (*infoPtr->LoadCursorImage)(infoPtr->pScrn,
- ScreenPriv->transparentData);
+ (*infoPtr->LoadCursorImage) (infoPtr->pScrn,
+ ScreenPriv->transparentData);
- (*infoPtr->ShowCursor)(infoPtr->pScrn);
+ (*infoPtr->ShowCursor) (infoPtr->pScrn);
}
void
xf86MoveCursor(ScreenPtr pScreen, int x, int y)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
- (*infoPtr->SetCursorPosition)(infoPtr->pScrn, x, y);
+ (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y);
}
void
xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
{
- xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
#ifdef ARGB_CURSOR
@@ -203,38 +209,39 @@ xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
#endif
if (ScreenPriv->PalettedCursor) {
- xColorItem sourceColor, maskColor;
- ColormapPtr pmap = ScreenPriv->pInstalledMap;
-
- if (!pmap)
- return;
-
- sourceColor.red = pCurs->foreRed;
- sourceColor.green = pCurs->foreGreen;
- sourceColor.blue = pCurs->foreBlue;
- FakeAllocColor(pmap, &sourceColor);
- maskColor.red = pCurs->backRed;
- maskColor.green = pCurs->backGreen;
- maskColor.blue = pCurs->backBlue;
- FakeAllocColor(pmap, &maskColor);
- FakeFreeColor(pmap, sourceColor.pixel);
- FakeFreeColor(pmap, maskColor.pixel);
- (*infoPtr->SetCursorColors)(infoPtr->pScrn,
- maskColor.pixel, sourceColor.pixel);
- } else { /* Pass colors in 8-8-8 RGB format */
- (*infoPtr->SetCursorColors)(infoPtr->pScrn,
- (pCurs->backBlue >> 8) |
- ((pCurs->backGreen >> 8) << 8) |
- ((pCurs->backRed >> 8) << 16),
- (pCurs->foreBlue >> 8) |
- ((pCurs->foreGreen >> 8) << 8) |
- ((pCurs->foreRed >> 8) << 16)
- );
+ xColorItem sourceColor, maskColor;
+ ColormapPtr pmap = ScreenPriv->pInstalledMap;
+
+ if (!pmap)
+ return;
+
+ sourceColor.red = pCurs->foreRed;
+ sourceColor.green = pCurs->foreGreen;
+ sourceColor.blue = pCurs->foreBlue;
+ FakeAllocColor(pmap, &sourceColor);
+ maskColor.red = pCurs->backRed;
+ maskColor.green = pCurs->backGreen;
+ maskColor.blue = pCurs->backBlue;
+ FakeAllocColor(pmap, &maskColor);
+ FakeFreeColor(pmap, sourceColor.pixel);
+ FakeFreeColor(pmap, maskColor.pixel);
+ (*infoPtr->SetCursorColors) (infoPtr->pScrn,
+ maskColor.pixel, sourceColor.pixel);
+ }
+ else { /* Pass colors in 8-8-8 RGB format */
+ (*infoPtr->SetCursorColors) (infoPtr->pScrn,
+ (pCurs->backBlue >> 8) |
+ ((pCurs->backGreen >> 8) << 8) |
+ ((pCurs->backRed >> 8) << 16),
+ (pCurs->foreBlue >> 8) |
+ ((pCurs->foreGreen >> 8) << 8) |
+ ((pCurs->foreRed >> 8) << 16)
+ );
}
}
/* These functions assume that MaxWidth is a multiple of 32 */
-static unsigned char*
+static unsigned char *
RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
{
@@ -243,75 +250,83 @@ RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
unsigned char *mem;
int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2;
int SrcPitch, DstPitch, Pitch, y, x;
+
/* how many words are in the source or mask */
int words = size / (CUR_BITMAP_SCANLINE_PAD / 4);
-
if (!(mem = calloc(1, size)))
- return NULL;
+ return NULL;
if (pCurs == NullCursor) {
- if (infoPtr->Flags & HARDWARE_CURSOR_INVERT_MASK) {
- DstM = (SCANLINE*)mem;
- if (!(infoPtr->Flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK))
- DstM += words;
- memset(DstM, -1, words * sizeof(SCANLINE));
- }
- return mem;
+ if (infoPtr->Flags & HARDWARE_CURSOR_INVERT_MASK) {
+ DstM = (SCANLINE *) mem;
+ if (!(infoPtr->Flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK))
+ DstM += words;
+ memset(DstM, -1, words * sizeof(SCANLINE));
+ }
+ return mem;
}
/* SrcPitch == the number of scanlines wide the cursor image is */
SrcPitch = (pCurs->bits->width + (BITMAP_SCANLINE_PAD - 1)) >>
- CUR_LOG2_BITMAP_PAD;
+ CUR_LOG2_BITMAP_PAD;
/* DstPitch is the width of the hw cursor in scanlines */
DstPitch = infoPtr->MaxWidth >> CUR_LOG2_BITMAP_PAD;
Pitch = SrcPitch < DstPitch ? SrcPitch : DstPitch;
- SrcS = (SCANLINE*)pCurs->bits->source;
- SrcM = (SCANLINE*)pCurs->bits->mask;
- DstS = (SCANLINE*)mem;
+ SrcS = (SCANLINE *) pCurs->bits->source;
+ SrcM = (SCANLINE *) pCurs->bits->mask;
+ DstS = (SCANLINE *) mem;
DstM = DstS + words;
if (infoPtr->Flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK) {
- SCANLINE *tmp;
- tmp = DstS; DstS = DstM; DstM = tmp;
+ SCANLINE *tmp;
+
+ tmp = DstS;
+ DstS = DstM;
+ DstM = tmp;
}
if (infoPtr->Flags & HARDWARE_CURSOR_AND_SOURCE_WITH_MASK) {
- for(y = pCurs->bits->height, pSrc = DstS, pMsk = DstM;
- y--;
- pSrc+=DstPitch, pMsk+=DstPitch, SrcS+=SrcPitch, SrcM+=SrcPitch) {
- for(x = 0; x < Pitch; x++) {
- pSrc[x] = SrcS[x] & SrcM[x];
- pMsk[x] = SrcM[x];
- }
- }
- } else {
- for(y = pCurs->bits->height, pSrc = DstS, pMsk = DstM;
- y--;
- pSrc+=DstPitch, pMsk+=DstPitch, SrcS+=SrcPitch, SrcM+=SrcPitch) {
- for(x = 0; x < Pitch; x++) {
- pSrc[x] = SrcS[x];
- pMsk[x] = SrcM[x];
- }
- }
+ for (y = pCurs->bits->height, pSrc = DstS, pMsk = DstM;
+ y--;
+ pSrc += DstPitch, pMsk += DstPitch, SrcS += SrcPitch, SrcM +=
+ SrcPitch) {
+ for (x = 0; x < Pitch; x++) {
+ pSrc[x] = SrcS[x] & SrcM[x];
+ pMsk[x] = SrcM[x];
+ }
+ }
+ }
+ else {
+ for (y = pCurs->bits->height, pSrc = DstS, pMsk = DstM;
+ y--;
+ pSrc += DstPitch, pMsk += DstPitch, SrcS += SrcPitch, SrcM +=
+ SrcPitch) {
+ for (x = 0; x < Pitch; x++) {
+ pSrc[x] = SrcS[x];
+ pMsk[x] = SrcM[x];
+ }
+ }
}
if (infoPtr->Flags & HARDWARE_CURSOR_NIBBLE_SWAPPED) {
- int count = size;
- unsigned char* pntr1 = (unsigned char *)DstS;
- unsigned char* pntr2 = (unsigned char *)DstM;
- unsigned char a, b;
- while (count) {
-
- a = *pntr1;
- b = *pntr2;
- *pntr1 = ((a & 0xF0) >> 4) | ((a & 0x0F) << 4);
- *pntr2 = ((b & 0xF0) >> 4) | ((b & 0x0F) << 4);
- pntr1++; pntr2++;
- count-=2;
- }
+ int count = size;
+ unsigned char *pntr1 = (unsigned char *) DstS;
+ unsigned char *pntr2 = (unsigned char *) DstM;
+ unsigned char a, b;
+
+ while (count) {
+
+ a = *pntr1;
+ b = *pntr2;
+ *pntr1 = ((a & 0xF0) >> 4) | ((a & 0x0F) << 4);
+ *pntr2 = ((b & 0xF0) >> 4) | ((b & 0x0F) << 4);
+ pntr1++;
+ pntr2++;
+ count -= 2;
+ }
}
/*
@@ -319,29 +334,29 @@ RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
* out entire source mask.
*/
if (infoPtr->Flags & HARDWARE_CURSOR_INVERT_MASK) {
- int count = words;
- SCANLINE* pntr = DstM;
- while (count--) {
- *pntr = ~(*pntr);
- pntr++;
- }
+ int count = words;
+ SCANLINE *pntr = DstM;
+
+ while (count--) {
+ *pntr = ~(*pntr);
+ pntr++;
+ }
}
if (infoPtr->Flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) {
- for(y = pCurs->bits->height, pSrc = DstS, pMsk = DstM;
- y--;
- pSrc+=DstPitch, pMsk+=DstPitch) {
- for(x = 0; x < Pitch; x++) {
- pSrc[x] = REVERSE_BIT_ORDER(pSrc[x]);
- pMsk[x] = REVERSE_BIT_ORDER(pMsk[x]);
- }
- }
+ for (y = pCurs->bits->height, pSrc = DstS, pMsk = DstM;
+ y--; pSrc += DstPitch, pMsk += DstPitch) {
+ for (x = 0; x < Pitch; x++) {
+ pSrc[x] = REVERSE_BIT_ORDER(pSrc[x]);
+ pMsk[x] = REVERSE_BIT_ORDER(pMsk[x]);
+ }
+ }
}
return mem;
}
-static unsigned char*
+static unsigned char *
RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
{
unsigned char *DstS, *DstM;
@@ -352,30 +367,30 @@ RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
/* Realize the cursor without interleaving */
if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
- return NULL;
+ return NULL;
if (!(mem = calloc(1, size))) {
- free(mem2);
- return NULL;
+ free(mem2);
+ return NULL;
}
- /* 1 bit interleave */
+ /* 1 bit interleave */
DstS = mem2;
DstM = DstS + (size >> 1);
pntr = mem;
count = size;
while (count) {
- *pntr++ = ((*DstS&0x01) ) | ((*DstM&0x01) << 1) |
- ((*DstS&0x02) << 1) | ((*DstM&0x02) << 2) |
- ((*DstS&0x04) << 2) | ((*DstM&0x04) << 3) |
- ((*DstS&0x08) << 3) | ((*DstM&0x08) << 4);
- *pntr++ = ((*DstS&0x10) >> 4) | ((*DstM&0x10) >> 3) |
- ((*DstS&0x20) >> 3) | ((*DstM&0x20) >> 2) |
- ((*DstS&0x40) >> 2) | ((*DstM&0x40) >> 1) |
- ((*DstS&0x80) >> 1) | ((*DstM&0x80) );
- DstS++;
- DstM++;
- count-=2;
+ *pntr++ = ((*DstS & 0x01)) | ((*DstM & 0x01) << 1) |
+ ((*DstS & 0x02) << 1) | ((*DstM & 0x02) << 2) |
+ ((*DstS & 0x04) << 2) | ((*DstM & 0x04) << 3) |
+ ((*DstS & 0x08) << 3) | ((*DstM & 0x08) << 4);
+ *pntr++ = ((*DstS & 0x10) >> 4) | ((*DstM & 0x10) >> 3) |
+ ((*DstS & 0x20) >> 3) | ((*DstM & 0x20) >> 2) |
+ ((*DstS & 0x40) >> 2) | ((*DstM & 0x40) >> 1) |
+ ((*DstS & 0x80) >> 1) | ((*DstM & 0x80));
+ DstS++;
+ DstM++;
+ count -= 2;
}
/* Free the uninterleaved cursor */
@@ -384,7 +399,7 @@ RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
return mem;
}
-static unsigned char*
+static unsigned char *
RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
{
unsigned char *DstS, *DstM;
@@ -395,11 +410,11 @@ RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
/* Realize the cursor without interleaving */
if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
- return NULL;
+ return NULL;
if (!(mem = calloc(1, size))) {
- free(mem2);
- return NULL;
+ free(mem2);
+ return NULL;
}
/* 8 bit interleave */
@@ -408,9 +423,9 @@ RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
pntr = mem;
count = size;
while (count) {
- *pntr++ = *DstS++;
- *pntr++ = *DstM++;
- count-=2;
+ *pntr++ = *DstS++;
+ *pntr++ = *DstM++;
+ count -= 2;
}
/* Free the uninterleaved cursor */
@@ -419,7 +434,7 @@ RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
return mem;
}
-static unsigned char*
+static unsigned char *
RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
{
unsigned short *DstS, *DstM;
@@ -430,22 +445,22 @@ RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
/* Realize the cursor without interleaving */
if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
- return NULL;
+ return NULL;
if (!(mem = calloc(1, size))) {
- free(mem2);
- return NULL;
+ free(mem2);
+ return NULL;
}
/* 16 bit interleave */
- DstS = (pointer)mem2;
+ DstS = (pointer) mem2;
DstM = DstS + (size >> 2);
- pntr = (pointer)mem;
+ pntr = (pointer) mem;
count = (size >> 1);
while (count) {
- *pntr++ = *DstS++;
- *pntr++ = *DstM++;
- count-=2;
+ *pntr++ = *DstS++;
+ *pntr++ = *DstM++;
+ count -= 2;
}
/* Free the uninterleaved cursor */
@@ -454,7 +469,7 @@ RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
return mem;
}
-static unsigned char*
+static unsigned char *
RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
{
CARD32 *DstS, *DstM;
@@ -465,22 +480,22 @@ RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
/* Realize the cursor without interleaving */
if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
- return NULL;
+ return NULL;
if (!(mem = calloc(1, size))) {
- free(mem2);
- return NULL;
+ free(mem2);
+ return NULL;
}
/* 32 bit interleave */
- DstS = (pointer)mem2;
+ DstS = (pointer) mem2;
DstM = DstS + (size >> 3);
- pntr = (pointer)mem;
+ pntr = (pointer) mem;
count = (size >> 2);
while (count) {
- *pntr++ = *DstS++;
- *pntr++ = *DstM++;
- count-=2;
+ *pntr++ = *DstS++;
+ *pntr++ = *DstM++;
+ count -= 2;
}
/* Free the uninterleaved cursor */
@@ -489,7 +504,7 @@ RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
return mem;
}
-static unsigned char*
+static unsigned char *
RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
{
CARD32 *DstS, *DstM;
@@ -500,24 +515,24 @@ RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
/* Realize the cursor without interleaving */
if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
- return NULL;
+ return NULL;
if (!(mem = calloc(1, size))) {
- free(mem2);
- return NULL;
+ free(mem2);
+ return NULL;
}
/* 64 bit interleave */
- DstS = (pointer)mem2;
+ DstS = (pointer) mem2;
DstM = DstS + (size >> 3);
- pntr = (pointer)mem;
+ pntr = (pointer) mem;
count = (size >> 2);
while (count) {
- *pntr++ = *DstS++;
- *pntr++ = *DstS++;
- *pntr++ = *DstM++;
- *pntr++ = *DstM++;
- count-=4;
+ *pntr++ = *DstS++;
+ *pntr++ = *DstS++;
+ *pntr++ = *DstM++;
+ *pntr++ = *DstM++;
+ count -= 4;
}
/* Free the uninterleaved cursor */
diff --git a/xorg-server/hw/xfree86/ramdac/xf86RamDac.h b/xorg-server/hw/xfree86/ramdac/xf86RamDac.h
index 4a3900b93..50a659a22 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86RamDac.h
+++ b/xorg-server/hw/xfree86/ramdac/xf86RamDac.h
@@ -16,96 +16,63 @@ typedef struct _RamDacRegRec {
* and they seem o.k
* Then we allocate 768 entries for the DAC too. IBM640 needs 1024 -FIXME
*/
- unsigned short DacRegs[0x400]; /* register set */
- unsigned char DAC[0x300]; /* colour map */
+ unsigned short DacRegs[0x400]; /* register set */
+ unsigned char DAC[0x300]; /* colour map */
Bool Overlay;
} RamDacRegRec, *RamDacRegRecPtr;
typedef struct _RamDacHWRegRec {
- RamDacRegRec SavedReg;
- RamDacRegRec ModeReg;
+ RamDacRegRec SavedReg;
+ RamDacRegRec ModeReg;
} RamDacHWRec, *RamDacHWRecPtr;
typedef struct _RamDacRec {
CARD32 RamDacType;
- void (*LoadPalette)(
- ScrnInfoPtr pScrn,
- int numColors,
- int *indices,
- LOCO *colors,
- VisualPtr pVisual
- );
-
- unsigned char (*ReadDAC)(
- ScrnInfoPtr pScrn,
- CARD32
- );
-
- void (*WriteDAC)(
- ScrnInfoPtr pScrn,
- CARD32,
- unsigned char,
- unsigned char
- );
-
- void (*WriteAddress)(
- ScrnInfoPtr pScrn,
- CARD32
- );
-
- void (*WriteData)(
- ScrnInfoPtr pScrn,
- unsigned char
- );
-
- void (*ReadAddress)(
- ScrnInfoPtr pScrn,
- CARD32
- );
-
- unsigned char (*ReadData)(
- ScrnInfoPtr pScrn
- );
+ void (*LoadPalette) (ScrnInfoPtr pScrn,
+ int numColors,
+ int *indices, LOCO * colors, VisualPtr pVisual);
+
+ unsigned char (*ReadDAC) (ScrnInfoPtr pScrn, CARD32);
+
+ void (*WriteDAC) (ScrnInfoPtr pScrn, CARD32, unsigned char, unsigned char);
+
+ void (*WriteAddress) (ScrnInfoPtr pScrn, CARD32);
+
+ void (*WriteData) (ScrnInfoPtr pScrn, unsigned char);
+
+ void (*ReadAddress) (ScrnInfoPtr pScrn, CARD32);
+
+ unsigned char (*ReadData) (ScrnInfoPtr pScrn);
} RamDacRec, *RamDacRecPtr;
typedef struct _RamDacHelperRec {
CARD32 RamDacType;
- void (*Restore)(
- ScrnInfoPtr pScrn,
- RamDacRecPtr ramdacPtr,
- RamDacRegRecPtr ramdacReg
- );
-
- void (*Save)(
- ScrnInfoPtr pScrn,
- RamDacRecPtr ramdacPtr,
- RamDacRegRecPtr ramdacReg
- );
-
- void (*SetBpp)(
- ScrnInfoPtr pScrn,
- RamDacRegRecPtr ramdacReg
- );
-
- void (*HWCursorInit)(
- xf86CursorInfoPtr infoPtr
- );
+ void (*Restore) (ScrnInfoPtr pScrn,
+ RamDacRecPtr ramdacPtr, RamDacRegRecPtr ramdacReg);
+
+ void (*Save) (ScrnInfoPtr pScrn,
+ RamDacRecPtr ramdacPtr, RamDacRegRecPtr ramdacReg);
+
+ void (*SetBpp) (ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg);
+
+ void (*HWCursorInit) (xf86CursorInfoPtr infoPtr);
} RamDacHelperRec, *RamDacHelperRecPtr;
#define RAMDACHWPTR(p) ((RamDacHWRecPtr)((p)->privates[RamDacGetHWIndex()].ptr))
typedef struct _RamdacScreenRec {
- RamDacRecPtr RamDacRec;
+ RamDacRecPtr RamDacRec;
} RamDacScreenRec, *RamDacScreenRecPtr;
+
#define RAMDACSCRPTR(p) ((RamDacScreenRecPtr)((p)->privates[RamDacGetScreenIndex()].ptr))->RamDacRec
extern _X_EXPORT int RamDacHWPrivateIndex;
extern _X_EXPORT int RamDacScreenPrivateIndex;
typedef struct {
- int token;
+ int token;
} RamDacSupportedInfoRec, *RamDacSupportedInfoRecPtr;
extern _X_EXPORT RamDacRecPtr RamDacCreateInfoRec(void);
@@ -113,9 +80,9 @@ extern _X_EXPORT RamDacHelperRecPtr RamDacHelperCreateInfoRec(void);
extern _X_EXPORT void RamDacDestroyInfoRec(RamDacRecPtr RamDacRec);
extern _X_EXPORT void RamDacHelperDestroyInfoRec(RamDacHelperRecPtr RamDacRec);
extern _X_EXPORT Bool RamDacInit(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec);
-extern _X_EXPORT Bool RamDacHandleColormaps(ScreenPtr pScreen, int maxColors, int sigRGBbits,
- unsigned int flags);
+extern _X_EXPORT Bool RamDacHandleColormaps(ScreenPtr pScreen, int maxColors,
+ int sigRGBbits, unsigned int flags);
extern _X_EXPORT void RamDacFreeRec(ScrnInfoPtr pScrn);
-extern _X_EXPORT int RamDacGetHWIndex(void);
+extern _X_EXPORT int RamDacGetHWIndex(void);
-#endif /* _XF86RAMDAC_H */
+#endif /* _XF86RAMDAC_H */
diff --git a/xorg-server/hw/xfree86/sdksyms.sh b/xorg-server/hw/xfree86/sdksyms.sh
index 9034f3829..40ea7c8da 100644
--- a/xorg-server/hw/xfree86/sdksyms.sh
+++ b/xorg-server/hw/xfree86/sdksyms.sh
@@ -364,7 +364,7 @@ BEGIN {
# skip attribute, if any
while ($n ~ /^(__attribute__|__global)/ ||
# skip modifiers, if any
- $n ~ /^\*?(unsigned|const|volatile|struct)$/ ||
+ $n ~ /^\*?(unsigned|const|volatile|struct|_X_EXPORT)$/ ||
# skip pointer
$n ~ /^[a-zA-Z0-9_]*\*$/)
n++;
@@ -395,6 +395,9 @@ BEGIN {
if ($n == "" || $n ~ /^\*+$/) {
getline;
n = 1;
+ # indent may have inserted a blank link
+ if ($0 == "")
+ getline;
}
# dont modify $0 or $n
diff --git a/xorg-server/hw/xfree86/shadowfb/sfbmodule.c b/xorg-server/hw/xfree86/shadowfb/sfbmodule.c
index ec37a1f8f..c20efc071 100644
--- a/xorg-server/hw/xfree86/shadowfb/sfbmodule.c
+++ b/xorg-server/hw/xfree86/shadowfb/sfbmodule.c
@@ -4,18 +4,17 @@
#include "xf86Module.h"
-static XF86ModuleVersionInfo VersRec =
-{
- "shadowfb",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_ANSIC, /* Only need the ansic layer */
- ABI_ANSIC_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0} /* signature, to be patched into the file by a tool */
+static XF86ModuleVersionInfo VersRec = {
+ "shadowfb",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0} /* signature, to be patched into the file by a tool */
};
_X_EXPORT XF86ModuleData shadowfbModuleData = { &VersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/shadowfb/shadow.c b/xorg-server/hw/xfree86/shadowfb/shadow.c
index 26b92b5d6..714dd141a 100644
--- a/xorg-server/hw/xfree86/shadowfb/shadow.c
+++ b/xorg-server/hw/xfree86/shadowfb/shadow.c
@@ -1,1681 +1,1641 @@
-/*
- Copyright (C) 1999. The XFree86 Project Inc.
-
- Written by Mark Vojkovich (mvojkovi@ucsd.edu)
-
- Pre-fb-write callbacks and RENDER support - Nolan Leake (nolan@vmware.com)
-*/
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "pixmapstr.h"
-#include "input.h"
-#include <X11/fonts/font.h>
-#include "mi.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "gcstruct.h"
-#include "dixfontstr.h"
-#include <X11/fonts/fontstruct.h>
-#include "xf86.h"
-#include "xf86str.h"
-#include "shadowfb.h"
-
-# include "picturestr.h"
-
-static Bool ShadowCloseScreen (int i, ScreenPtr pScreen);
-static void ShadowCopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgn
-);
-static Bool ShadowCreateGC(GCPtr pGC);
-
-static Bool ShadowEnterVT(int index, int flags);
-static void ShadowLeaveVT(int index, int flags);
-
-static void ShadowComposite(
- CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height
-);
-
-
-typedef struct {
- ScrnInfoPtr pScrn;
- RefreshAreaFuncPtr preRefresh;
- RefreshAreaFuncPtr postRefresh;
- CloseScreenProcPtr CloseScreen;
- CopyWindowProcPtr CopyWindow;
- CreateGCProcPtr CreateGC;
- ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
- CompositeProcPtr Composite;
- Bool (*EnterVT)(int, int);
- void (*LeaveVT)(int, int);
- Bool vtSema;
-} ShadowScreenRec, *ShadowScreenPtr;
-
-typedef struct {
- GCOps *ops;
- GCFuncs *funcs;
-} ShadowGCRec, *ShadowGCPtr;
-
-static DevPrivateKeyRec ShadowScreenKeyRec;
-#define ShadowScreenKey (&ShadowScreenKeyRec)
-
-static DevPrivateKeyRec ShadowGCKeyRec;
-#define ShadowGCKey (&ShadowGCKeyRec)
-
-#define GET_SCREEN_PRIVATE(pScreen) \
- (ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey)
-#define GET_GC_PRIVATE(pGC) \
- (ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey)
-
-#define SHADOW_GC_FUNC_PROLOGUE(pGC)\
- ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
- (pGC)->funcs = pGCPriv->funcs;\
- if(pGCPriv->ops)\
- (pGC)->ops = pGCPriv->ops
-
-#define SHADOW_GC_FUNC_EPILOGUE(pGC)\
- pGCPriv->funcs = (pGC)->funcs;\
- (pGC)->funcs = &ShadowGCFuncs;\
- if(pGCPriv->ops) {\
- pGCPriv->ops = (pGC)->ops;\
- (pGC)->ops = &ShadowGCOps;\
- }
-
-#define SHADOW_GC_OP_PROLOGUE(pGC)\
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pGC->pScreen); \
- ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
- GCFuncs *oldFuncs = pGC->funcs;\
- pGC->funcs = pGCPriv->funcs;\
- pGC->ops = pGCPriv->ops
-
-
-#define SHADOW_GC_OP_EPILOGUE(pGC)\
- pGCPriv->ops = pGC->ops;\
- pGC->funcs = oldFuncs;\
- pGC->ops = &ShadowGCOps
-
-#define IS_VISIBLE(pWin) (pPriv->vtSema && \
- (((WindowPtr)pWin)->visibility != VisibilityFullyObscured))
-
-#define TRIM_BOX(box, pGC) { \
- BoxPtr extents = &pGC->pCompositeClip->extents;\
- if(box.x1 < extents->x1) box.x1 = extents->x1; \
- if(box.x2 > extents->x2) box.x2 = extents->x2; \
- if(box.y1 < extents->y1) box.y1 = extents->y1; \
- if(box.y2 > extents->y2) box.y2 = extents->y2; \
- }
-
-#define TRANSLATE_BOX(box, pDraw) { \
- box.x1 += pDraw->x; \
- box.x2 += pDraw->x; \
- box.y1 += pDraw->y; \
- box.y2 += pDraw->y; \
- }
-
-#define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \
- TRANSLATE_BOX(box, pDraw); \
- TRIM_BOX(box, pGC); \
- }
-
-#define BOX_NOT_EMPTY(box) \
- (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
-
-
-
-Bool
-ShadowFBInit2 (
- ScreenPtr pScreen,
- RefreshAreaFuncPtr preRefreshArea,
- RefreshAreaFuncPtr postRefreshArea
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ShadowScreenPtr pPriv;
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
- if(!preRefreshArea && !postRefreshArea) return FALSE;
-
- if (!dixRegisterPrivateKey(&ShadowScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- if(!dixRegisterPrivateKey(&ShadowGCKeyRec, PRIVATE_GC, sizeof(ShadowGCRec)))
- return FALSE;
-
- if(!(pPriv = (ShadowScreenPtr)malloc(sizeof(ShadowScreenRec))))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv);
-
- pPriv->pScrn = pScrn;
- pPriv->preRefresh = preRefreshArea;
- pPriv->postRefresh = postRefreshArea;
- pPriv->vtSema = TRUE;
-
- pPriv->CloseScreen = pScreen->CloseScreen;
- pPriv->CopyWindow = pScreen->CopyWindow;
- pPriv->CreateGC = pScreen->CreateGC;
- pPriv->ModifyPixmapHeader = pScreen->ModifyPixmapHeader;
-
- pPriv->EnterVT = pScrn->EnterVT;
- pPriv->LeaveVT = pScrn->LeaveVT;
-
- pScreen->CloseScreen = ShadowCloseScreen;
- pScreen->CopyWindow = ShadowCopyWindow;
- pScreen->CreateGC = ShadowCreateGC;
-
- pScrn->EnterVT = ShadowEnterVT;
- pScrn->LeaveVT = ShadowLeaveVT;
-
- if(ps) {
- pPriv->Composite = ps->Composite;
- ps->Composite = ShadowComposite;
- }
-
- return TRUE;
-}
-
-Bool
-ShadowFBInit (
- ScreenPtr pScreen,
- RefreshAreaFuncPtr refreshArea
-){
- return ShadowFBInit2(pScreen, NULL, refreshArea);
-}
-
-/**********************************************************/
-
-static Bool
-ShadowEnterVT(int index, int flags)
-{
- ScrnInfoPtr pScrn = xf86Screens[index];
- Bool ret;
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
-
- pScrn->EnterVT = pPriv->EnterVT;
- ret = (*pPriv->EnterVT)(index, flags);
- pPriv->EnterVT = pScrn->EnterVT;
- pScrn->EnterVT = ShadowEnterVT;
- if(ret) {
- pPriv->vtSema = TRUE;
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-ShadowLeaveVT(int index, int flags)
-{
- ScrnInfoPtr pScrn = xf86Screens[index];
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(xf86Screens[index]->pScreen);
-
- pPriv->vtSema = FALSE;
-
- pScrn->LeaveVT = pPriv->LeaveVT;
- (*pPriv->LeaveVT)(index, flags);
- pPriv->LeaveVT = pScrn->LeaveVT;
- pScrn->LeaveVT = ShadowLeaveVT;
-}
-
-/**********************************************************/
-
-
-static Bool
-ShadowCloseScreen (int i, ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
- pScreen->CloseScreen = pPriv->CloseScreen;
- pScreen->CopyWindow = pPriv->CopyWindow;
- pScreen->CreateGC = pPriv->CreateGC;
- pScreen->ModifyPixmapHeader = pPriv->ModifyPixmapHeader;
-
- pScrn->EnterVT = pPriv->EnterVT;
- pScrn->LeaveVT = pPriv->LeaveVT;
-
- if(ps) {
- ps->Composite = pPriv->Composite;
- }
-
- free((pointer)pPriv);
-
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-static void
-ShadowCopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgn
-){
- ScreenPtr pScreen = pWin->drawable.pScreen;
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
- int num = 0;
- RegionRec rgnDst;
-
- if (pPriv->vtSema) {
- RegionNull(&rgnDst);
- RegionCopy(&rgnDst, prgn);
-
- RegionTranslate(&rgnDst,
- pWin->drawable.x - ptOldOrg.x,
- pWin->drawable.y - ptOldOrg.y);
- RegionIntersect(&rgnDst, &pWin->borderClip, &rgnDst);
- if ((num = RegionNumRects(&rgnDst))) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, num, RegionRects(&rgnDst));
- } else {
- RegionUninit(&rgnDst);
- }
- }
-
- pScreen->CopyWindow = pPriv->CopyWindow;
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgn);
- pScreen->CopyWindow = ShadowCopyWindow;
-
- if (num) {
- if (pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, num, RegionRects(&rgnDst));
- RegionUninit(&rgnDst);
- }
-}
-
-static void
-ShadowComposite(
- CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height
-){
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- BoxRec box;
- BoxPtr extents;
- Bool boxNotEmpty = FALSE;
-
- if (pPriv->vtSema
- && pDst->pDrawable->type == DRAWABLE_WINDOW) {
-
- box.x1 = pDst->pDrawable->x + xDst;
- box.y1 = pDst->pDrawable->y + yDst;
- box.x2 = box.x1 + width;
- box.y2 = box.y1 + height;
-
- extents = &pDst->pCompositeClip->extents;
- if(box.x1 < extents->x1) box.x1 = extents->x1;
- if(box.x2 > extents->x2) box.x2 = extents->x2;
- if(box.y1 < extents->y1) box.y1 = extents->y1;
- if(box.y2 > extents->y2) box.y2 = extents->y2;
-
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- ps->Composite = pPriv->Composite;
- (*ps->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc,
- xMask, yMask, xDst, yDst, width, height);
- ps->Composite = ShadowComposite;
-
- if (pPriv->postRefresh && boxNotEmpty) {
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
- }
-}
-
-/**********************************************************/
-
-static void ShadowValidateGC(GCPtr, unsigned long, DrawablePtr);
-static void ShadowChangeGC(GCPtr, unsigned long);
-static void ShadowCopyGC(GCPtr, unsigned long, GCPtr);
-static void ShadowDestroyGC(GCPtr);
-static void ShadowChangeClip(GCPtr, int, pointer, int);
-static void ShadowDestroyClip(GCPtr);
-static void ShadowCopyClip(GCPtr, GCPtr);
-
-GCFuncs ShadowGCFuncs = {
- ShadowValidateGC, ShadowChangeGC, ShadowCopyGC, ShadowDestroyGC,
- ShadowChangeClip, ShadowDestroyClip, ShadowCopyClip
-};
-
-
-extern GCOps ShadowGCOps;
-
-static Bool
-ShadowCreateGC(GCPtr pGC)
-{
- ScreenPtr pScreen = pGC->pScreen;
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
- ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);
- Bool ret;
-
- pScreen->CreateGC = pPriv->CreateGC;
- if((ret = (*pScreen->CreateGC) (pGC))) {
- pGCPriv->ops = NULL;
- pGCPriv->funcs = pGC->funcs;
- pGC->funcs = &ShadowGCFuncs;
- }
- pScreen->CreateGC = ShadowCreateGC;
-
- return ret;
-}
-
-
-static void
-ShadowValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-){
- SHADOW_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
- if(pDraw->type == DRAWABLE_WINDOW)
- pGCPriv->ops = pGC->ops; /* just so it's not NULL */
- else
- pGCPriv->ops = NULL;
- SHADOW_GC_FUNC_EPILOGUE (pGC);
-}
-
-
-static void
-ShadowDestroyGC(GCPtr pGC)
-{
- SHADOW_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->DestroyGC)(pGC);
- SHADOW_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-ShadowChangeGC (
- GCPtr pGC,
- unsigned long mask
-){
- SHADOW_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeGC) (pGC, mask);
- SHADOW_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-ShadowCopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst
-){
- SHADOW_GC_FUNC_PROLOGUE (pGCDst);
- (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- SHADOW_GC_FUNC_EPILOGUE (pGCDst);
-}
-
-static void
-ShadowChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects
-){
- SHADOW_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- SHADOW_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-ShadowCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- SHADOW_GC_FUNC_PROLOGUE (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- SHADOW_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-ShadowDestroyClip(GCPtr pGC)
-{
- SHADOW_GC_FUNC_PROLOGUE (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- SHADOW_GC_FUNC_EPILOGUE (pGC);
-}
-
-
-
-
-/**********************************************************/
-
-
-static void
-ShadowFillSpans(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted
-){
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && nInit) {
- DDXPointPtr ppt = pptInit;
- int *pwidth = pwidthInit;
- int i = nInit;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- box.x1 = ppt->x;
- box.x2 = box.x1 + *pwidth;
- box.y2 = box.y1 = ppt->y;
-
- while(--i) {
- ppt++;
- pwidth++;
- if(box.x1 > ppt->x) box.x1 = ppt->x;
- if(box.x2 < (ppt->x + *pwidth))
- box.x2 = ppt->x + *pwidth;
- if(box.y1 > ppt->y) box.y1 = ppt->y;
- else if(box.y2 < ppt->y) box.y2 = ppt->y;
- }
-
- box.y2++;
-
- if(!pGC->miTranslate) {
- TRANSLATE_BOX(box, pDraw);
- }
- TRIM_BOX(box, pGC);
-
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
-
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
- } else
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowSetSpans(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int nspans,
- int fSorted
-){
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && nspans) {
- DDXPointPtr ppt = pptInit;
- int *pwidth = pwidthInit;
- int i = nspans;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- box.x1 = ppt->x;
- box.x2 = box.x1 + *pwidth;
- box.y2 = box.y1 = ppt->y;
-
- while(--i) {
- ppt++;
- pwidth++;
- if(box.x1 > ppt->x) box.x1 = ppt->x;
- if(box.x2 < (ppt->x + *pwidth))
- box.x2 = ppt->x + *pwidth;
- if(box.y1 > ppt->y) box.y1 = ppt->y;
- else if(box.y2 < ppt->y) box.y2 = ppt->y;
- }
-
- box.y2++;
-
- if(!pGC->miTranslate) {
- TRANSLATE_BOX(box, pDraw);
- }
- TRIM_BOX(box, pGC);
-
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
-
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit,
- pwidthInit, nspans, fSorted);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
- } else
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit,
- pwidthInit, nspans, fSorted);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw)) {
- box.x1 = x + pDraw->x;
- box.x2 = box.x1 + w;
- box.y1 = y + pDraw->y;
- box.y2 = box.y1 + h;
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
-}
-
-static RegionPtr
-ShadowCopyArea(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
- RegionPtr ret;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDst)) {
- box.x1 = dstx + pDst->x;
- box.x2 = box.x1 + width;
- box.y1 = dsty + pDst->y;
- box.y2 = box.y1 + height;
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
- return ret;
-}
-
-static RegionPtr
-ShadowCopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- RegionPtr ret;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDst)) {
- box.x1 = dstx + pDst->x;
- box.x2 = box.x1 + width;
- box.y1 = dsty + pDst->y;
- box.y2 = box.y1 + height;
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
- return ret;
-}
-
-static void
-ShadowPolyPoint(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int nptInit,
- xPoint *pptInit
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && nptInit) {
- xPoint *ppt = pptInit;
- int npt = nptInit;
-
- box.x2 = box.x1 = pptInit->x;
- box.y2 = box.y1 = pptInit->y;
-
- /* this could be slow if the points were spread out */
-
- while(--npt) {
- ppt++;
- if(box.x1 > ppt->x) box.x1 = ppt->x;
- else if(box.x2 < ppt->x) box.x2 = ppt->x;
- if(box.y1 > ppt->y) box.y1 = ppt->y;
- else if(box.y2 < ppt->y) box.y2 = ppt->y;
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, nptInit, pptInit);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolylines(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int nptInit,
- DDXPointPtr pptInit
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && nptInit) {
- DDXPointPtr ppt = pptInit;
- int npt = nptInit;
- int extra = pGC->lineWidth >> 1;
-
- box.x2 = box.x1 = pptInit->x;
- box.y2 = box.y1 = pptInit->y;
-
- if(npt > 1) {
- if(pGC->joinStyle == JoinMiter)
- extra = 6 * pGC->lineWidth;
- else if(pGC->capStyle == CapProjecting)
- extra = pGC->lineWidth;
- }
-
- if(mode == CoordModePrevious) {
- int x = box.x1;
- int y = box.y1;
- while(--npt) {
- ppt++;
- x += ppt->x;
- y += ppt->y;
- if(box.x1 > x) box.x1 = x;
- else if(box.x2 < x) box.x2 = x;
- if(box.y1 > y) box.y1 = y;
- else if(box.y2 < y) box.y2 = y;
- }
- } else {
- while(--npt) {
- ppt++;
- if(box.x1 > ppt->x) box.x1 = ppt->x;
- else if(box.x2 < ppt->x) box.x2 = ppt->x;
- if(box.y1 > ppt->y) box.y1 = ppt->y;
- else if(box.y2 < ppt->y) box.y2 = ppt->y;
- }
- }
-
- box.x2++;
- box.y2++;
-
- if(extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->Polylines)(pDraw, pGC, mode, nptInit, pptInit);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolySegment(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nsegInit,
- xSegment *pSegInit
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && nsegInit) {
- int extra = pGC->lineWidth;
- xSegment *pSeg = pSegInit;
- int nseg = nsegInit;
-
- if(pGC->capStyle != CapProjecting)
- extra >>= 1;
-
- if(pSeg->x2 > pSeg->x1) {
- box.x1 = pSeg->x1;
- box.x2 = pSeg->x2;
- } else {
- box.x2 = pSeg->x1;
- box.x1 = pSeg->x2;
- }
-
- if(pSeg->y2 > pSeg->y1) {
- box.y1 = pSeg->y1;
- box.y2 = pSeg->y2;
- } else {
- box.y2 = pSeg->y1;
- box.y1 = pSeg->y2;
- }
-
- while(--nseg) {
- pSeg++;
- if(pSeg->x2 > pSeg->x1) {
- if(pSeg->x1 < box.x1) box.x1 = pSeg->x1;
- if(pSeg->x2 > box.x2) box.x2 = pSeg->x2;
- } else {
- if(pSeg->x2 < box.x1) box.x1 = pSeg->x2;
- if(pSeg->x1 > box.x2) box.x2 = pSeg->x1;
- }
- if(pSeg->y2 > pSeg->y1) {
- if(pSeg->y1 < box.y1) box.y1 = pSeg->y1;
- if(pSeg->y2 > box.y2) box.y2 = pSeg->y2;
- } else {
- if(pSeg->y2 < box.y1) box.y1 = pSeg->y2;
- if(pSeg->y1 > box.y2) box.y2 = pSeg->y1;
- }
- }
-
- box.x2++;
- box.y2++;
-
- if(extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PolySegment)(pDraw, pGC, nsegInit, pSegInit);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolyRectangle(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
- BoxRec box;
- BoxPtr pBoxInit = NULL;
- Bool boxNotEmpty = FALSE;
- int num = 0;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && nRectsInit) {
- xRectangle *pRects = pRectsInit;
- int nRects = nRectsInit;
-
- if(nRects >= 32) {
- int extra = pGC->lineWidth >> 1;
-
- box.x1 = pRects->x;
- box.x2 = box.x1 + pRects->width;
- box.y1 = pRects->y;
- box.y2 = box.y1 + pRects->height;
-
- while(--nRects) {
- pRects++;
- if(box.x1 > pRects->x) box.x1 = pRects->x;
- if(box.x2 < (pRects->x + pRects->width))
- box.x2 = pRects->x + pRects->width;
- if(box.y1 > pRects->y) box.y1 = pRects->y;
- if(box.y2 < (pRects->y + pRects->height))
- box.y2 = pRects->y + pRects->height;
- }
-
- if(extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- } else {
- BoxPtr pbox;
- int offset1, offset2, offset3;
-
- offset2 = pGC->lineWidth;
- if(!offset2) offset2 = 1;
- offset1 = offset2 >> 1;
- offset3 = offset2 - offset1;
-
- pBoxInit = (BoxPtr)malloc(nRects * 4 * sizeof(BoxRec));
- pbox = pBoxInit;
-
- while(nRects--) {
- pbox->x1 = pRects->x - offset1;
- pbox->y1 = pRects->y - offset1;
- pbox->x2 = pbox->x1 + pRects->width + offset2;
- pbox->y2 = pbox->y1 + offset2;
- TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
- if(BOX_NOT_EMPTY((*pbox))) {
- num++;
- pbox++;
- }
-
- pbox->x1 = pRects->x - offset1;
- pbox->y1 = pRects->y + offset3;
- pbox->x2 = pbox->x1 + offset2;
- pbox->y2 = pbox->y1 + pRects->height - offset2;
- TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
- if(BOX_NOT_EMPTY((*pbox))) {
- num++;
- pbox++;
- }
-
- pbox->x1 = pRects->x + pRects->width - offset1;
- pbox->y1 = pRects->y + offset3;
- pbox->x2 = pbox->x1 + offset2;
- pbox->y2 = pbox->y1 + pRects->height - offset2;
- TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
- if(BOX_NOT_EMPTY((*pbox))) {
- num++;
- pbox++;
- }
-
- pbox->x1 = pRects->x - offset1;
- pbox->y1 = pRects->y + pRects->height - offset1;
- pbox->x2 = pbox->x1 + pRects->width + offset2;
- pbox->y2 = pbox->y1 + offset2;
- TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
- if(BOX_NOT_EMPTY((*pbox))) {
- num++;
- pbox++;
- }
-
- pRects++;
- }
-
- if(num) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, num, pBoxInit);
- } else {
- free(pBoxInit);
- }
- }
- }
-
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
-
- if(boxNotEmpty && pPriv->postRefresh) {
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
- } else if(num) {
- if(pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, num, pBoxInit);
- free(pBoxInit);
- }
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
-}
-
-static void
-ShadowPolyArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcsInit,
- xArc *parcsInit
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && narcsInit) {
- int narcs = narcsInit;
- xArc *parcs = parcsInit;
- int extra = pGC->lineWidth >> 1;
-
- box.x1 = parcs->x;
- box.x2 = box.x1 + parcs->width;
- box.y1 = parcs->y;
- box.y2 = box.y1 + parcs->height;
-
- /* should I break these up instead ? */
-
- while(--narcs) {
- parcs++;
- if(box.x1 > parcs->x) box.x1 = parcs->x;
- if(box.x2 < (parcs->x + parcs->width))
- box.x2 = parcs->x + parcs->width;
- if(box.y1 > parcs->y) box.y1 = parcs->y;
- if(box.y2 < (parcs->y + parcs->height))
- box.y2 = parcs->y + parcs->height;
- }
-
- if(extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PolyArc)(pDraw, pGC, narcsInit, parcsInit);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
-}
-
-static void
-ShadowFillPolygon(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr pptInit
-){
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && (count > 2)) {
- DDXPointPtr ppt = pptInit;
- int i = count;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- box.x2 = box.x1 = ppt->x;
- box.y2 = box.y1 = ppt->y;
-
- if(mode != CoordModeOrigin) {
- int x = box.x1;
- int y = box.y1;
- while(--i) {
- ppt++;
- x += ppt->x;
- y += ppt->y;
- if(box.x1 > x) box.x1 = x;
- else if(box.x2 < x) box.x2 = x;
- if(box.y1 > y) box.y1 = y;
- else if(box.y2 < y) box.y2 = y;
- }
- } else {
- while(--i) {
- ppt++;
- if(box.x1 > ppt->x) box.x1 = ppt->x;
- else if(box.x2 < ppt->x) box.x2 = ppt->x;
- if(box.y1 > ppt->y) box.y1 = ppt->y;
- else if(box.y2 < ppt->y) box.y2 = ppt->y;
- }
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
-
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
- } else
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-
-static void
-ShadowPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && nRectsInit) {
- BoxRec box;
- Bool boxNotEmpty = FALSE;
- xRectangle *pRects = pRectsInit;
- int nRects = nRectsInit;
-
- box.x1 = pRects->x;
- box.x2 = box.x1 + pRects->width;
- box.y1 = pRects->y;
- box.y2 = box.y1 + pRects->height;
-
- while(--nRects) {
- pRects++;
- if(box.x1 > pRects->x) box.x1 = pRects->x;
- if(box.x2 < (pRects->x + pRects->width))
- box.x2 = pRects->x + pRects->width;
- if(box.y1 > pRects->y) box.y1 = pRects->y;
- if(box.y2 < (pRects->y + pRects->height))
- box.y2 = pRects->y + pRects->height;
- }
-
- /* cfb messes with the pRectsInit so we have to do our
- calculations first */
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
-
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
- } else
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-
-static void
-ShadowPolyFillArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcsInit,
- xArc *parcsInit
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && narcsInit) {
- xArc *parcs = parcsInit;
- int narcs = narcsInit;
-
- box.x1 = parcs->x;
- box.x2 = box.x1 + parcs->width;
- box.y1 = parcs->y;
- box.y2 = box.y1 + parcs->height;
-
- /* should I break these up instead ? */
-
- while(--narcs) {
- parcs++;
- if(box.x1 > parcs->x) box.x1 = parcs->x;
- if(box.x2 < (parcs->x + parcs->width))
- box.x2 = parcs->x + parcs->width;
- if(box.y1 > parcs->y) box.y1 = parcs->y;
- if(box.y2 < (parcs->y + parcs->height))
- box.y2 = parcs->y + parcs->height;
- }
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcsInit, parcsInit);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowTextExtent(FontPtr pFont, int count, char* chars,
- FontEncoding fontEncoding, BoxPtr box)
-{
- unsigned long n, i;
- int w;
- CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
-
- GetGlyphs(pFont, (unsigned long)count, (unsigned char *)chars,
- fontEncoding, &n, charinfo);
- w = 0;
- for (i=0; i < n; i++) {
- w += charinfo[i]->metrics.characterWidth;
- }
- if (i) {
- w += charinfo[i - 1]->metrics.rightSideBearing;
- }
-
- box->x1 = 0;
- if (n) {
- if (charinfo[0]->metrics.leftSideBearing < 0) {
- box->x1 = charinfo[0]->metrics.leftSideBearing;
- }
- }
- box->x2 = w;
- box->y1 = -FONTMAXBOUNDS(pFont,ascent);
- box->y2 = FONTMAXBOUNDS(pFont,descent);
-}
-
-
-
-static void
-ShadowFontToBox(BoxPtr BB, DrawablePtr pDrawable, GCPtr pGC, int x, int y,
- int count, char *chars, int wide)
-{
- FontPtr pFont;
-
- pFont = pGC->font;
- if (pFont->info.constantWidth) {
- int ascent, descent, left, right = 0;
-
- ascent = max(pFont->info.fontAscent, pFont->info.maxbounds.ascent);
- descent = max(pFont->info.fontDescent, pFont->info.maxbounds.descent);
- left = pFont->info.maxbounds.leftSideBearing;
- if (count > 0) {
- right = (count - 1) * pFont->info.maxbounds.characterWidth;
- }
- right += pFont->info.maxbounds.rightSideBearing;
- BB->x1 =
- max(pDrawable->x + x - left,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1);
- BB->y1 =
- max(pDrawable->y + y - ascent,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1);
- BB->x2 =
- min(pDrawable->x + x + right,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2);
- BB->y2 =
- min(pDrawable->y + y + descent,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2);
- } else {
- ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0)
- ? Linear16Bit : TwoD16Bit : Linear8Bit, BB);
- BB->x1 =
- max(pDrawable->x + x + BB->x1,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1);
- BB->y1 =
- max(pDrawable->y + y + BB->y1,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1);
- BB->x2 =
- min(pDrawable->x + x + BB->x2,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2);
- BB->y2 =
- min(pDrawable->y + y + BB->y2,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2);
- }
-}
-
-static int
-ShadowPolyText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- int width;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw)) {
- ShadowFontToBox(&box, pDraw, pGC, x, y, count, chars, 0);
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- width = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
- return width;
-}
-
-static int
-ShadowPolyText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- int width;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw)) {
- ShadowFontToBox(&box, pDraw, pGC, x, y, count, (char*)chars, 1);
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- width = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
- return width;
-}
-
-static void
-ShadowImageText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && count) {
- int top, bot, Min, Max;
-
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
- if(Min > 0) Min = 0;
- Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
- if(Max < 0) Max = 0;
-
- /* ugh */
- box.x1 = pDraw->x + x + Min +
- FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = pDraw->x + x + Max +
- FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- box.y1 = pDraw->y + y - top;
- box.y2 = pDraw->y + y + bot;
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-static void
-ShadowImageText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && count) {
- int top, bot, Min, Max;
-
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
- if(Min > 0) Min = 0;
- Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
- if(Max < 0) Max = 0;
-
- /* ugh */
- box.x1 = pDraw->x + x + Min +
- FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = pDraw->x + x + Max +
- FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- box.y1 = pDraw->y + y - top;
- box.y2 = pDraw->y + y + bot;
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-
-static void
-ShadowImageGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyphInit,
- CharInfoPtr *ppciInit,
- pointer pglyphBase
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && nglyphInit) {
- CharInfoPtr *ppci = ppciInit;
- unsigned int nglyph = nglyphInit;
- int top, bot, width = 0;
-
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- box.x1 = ppci[0]->metrics.leftSideBearing;
- if(box.x1 > 0) box.x1 = 0;
- box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing -
- ppci[nglyph - 1]->metrics.characterWidth;
- if(box.x2 < 0) box.x2 = 0;
-
- box.x2 += pDraw->x + x;
- box.x1 += pDraw->x + x;
-
- while(nglyph--) {
- width += (*ppci)->metrics.characterWidth;
- ppci++;
- }
-
- if(width > 0)
- box.x2 += width;
- else
- box.x1 += width;
-
- box.y1 = pDraw->y + y - top;
- box.y2 = pDraw->y + y + bot;
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, nglyphInit,
- ppciInit, pglyphBase);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolyGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyphInit,
- CharInfoPtr *ppciInit,
- pointer pglyphBase
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw) && nglyphInit) {
- CharInfoPtr *ppci = ppciInit;
- unsigned int nglyph = nglyphInit;
-
- /* ugh */
- box.x1 = pDraw->x + x + ppci[0]->metrics.leftSideBearing;
- box.x2 = pDraw->x + x + ppci[nglyph - 1]->metrics.rightSideBearing;
-
- if(nglyph > 1) {
- int width = 0;
-
- while(--nglyph) {
- width += (*ppci)->metrics.characterWidth;
- ppci++;
- }
-
- if(width > 0) box.x2 += width;
- else box.x1 += width;
- }
-
- box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent);
- box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent);
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, nglyphInit,
- ppciInit, pglyphBase);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPushPixels(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg
-){
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if(IS_VISIBLE(pDraw)) {
- box.x1 = xOrg;
- box.y1 = yOrg;
-
- if(!pGC->miTranslate) {
- box.x1 += pDraw->x;
- box.y1 += pDraw->y;
- }
-
- box.x2 = box.x1 + dx;
- box.y2 = box.y1 + dy;
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box)) {
- if(pPriv->preRefresh)
- (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
-
- if(boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-
-GCOps ShadowGCOps = {
- ShadowFillSpans, ShadowSetSpans,
- ShadowPutImage, ShadowCopyArea,
- ShadowCopyPlane, ShadowPolyPoint,
- ShadowPolylines, ShadowPolySegment,
- ShadowPolyRectangle, ShadowPolyArc,
- ShadowFillPolygon, ShadowPolyFillRect,
- ShadowPolyFillArc, ShadowPolyText8,
- ShadowPolyText16, ShadowImageText8,
- ShadowImageText16, ShadowImageGlyphBlt,
- ShadowPolyGlyphBlt, ShadowPushPixels,
-};
-
+/*
+ Copyright (C) 1999. The XFree86 Project Inc.
+
+ Written by Mark Vojkovich (mvojkovi@ucsd.edu)
+
+ Pre-fb-write callbacks and RENDER support - Nolan Leake (nolan@vmware.com)
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "pixmapstr.h"
+#include "input.h"
+#include <X11/fonts/font.h>
+#include "mi.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "dixfontstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "xf86.h"
+#include "xf86str.h"
+#include "shadowfb.h"
+
+#include "picturestr.h"
+
+static Bool ShadowCloseScreen(int i, ScreenPtr pScreen);
+static void ShadowCopyWindow(WindowPtr pWin,
+ DDXPointRec ptOldOrg, RegionPtr prgn);
+static Bool ShadowCreateGC(GCPtr pGC);
+
+static Bool ShadowEnterVT(int index, int flags);
+static void ShadowLeaveVT(int index, int flags);
+
+static void ShadowComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height);
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ RefreshAreaFuncPtr preRefresh;
+ RefreshAreaFuncPtr postRefresh;
+ CloseScreenProcPtr CloseScreen;
+ CopyWindowProcPtr CopyWindow;
+ CreateGCProcPtr CreateGC;
+ ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
+ CompositeProcPtr Composite;
+ Bool (*EnterVT) (int, int);
+ void (*LeaveVT) (int, int);
+ Bool vtSema;
+} ShadowScreenRec, *ShadowScreenPtr;
+
+typedef struct {
+ GCOps *ops;
+ GCFuncs *funcs;
+} ShadowGCRec, *ShadowGCPtr;
+
+static DevPrivateKeyRec ShadowScreenKeyRec;
+
+#define ShadowScreenKey (&ShadowScreenKeyRec)
+
+static DevPrivateKeyRec ShadowGCKeyRec;
+
+#define ShadowGCKey (&ShadowGCKeyRec)
+
+#define GET_SCREEN_PRIVATE(pScreen) \
+ (ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey)
+#define GET_GC_PRIVATE(pGC) \
+ (ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey)
+
+#define SHADOW_GC_FUNC_PROLOGUE(pGC)\
+ ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
+ (pGC)->funcs = pGCPriv->funcs;\
+ if(pGCPriv->ops)\
+ (pGC)->ops = pGCPriv->ops
+
+#define SHADOW_GC_FUNC_EPILOGUE(pGC)\
+ pGCPriv->funcs = (pGC)->funcs;\
+ (pGC)->funcs = &ShadowGCFuncs;\
+ if(pGCPriv->ops) {\
+ pGCPriv->ops = (pGC)->ops;\
+ (pGC)->ops = &ShadowGCOps;\
+ }
+
+#define SHADOW_GC_OP_PROLOGUE(pGC)\
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pGC->pScreen); \
+ ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
+ GCFuncs *oldFuncs = pGC->funcs;\
+ pGC->funcs = pGCPriv->funcs;\
+ pGC->ops = pGCPriv->ops
+
+#define SHADOW_GC_OP_EPILOGUE(pGC)\
+ pGCPriv->ops = pGC->ops;\
+ pGC->funcs = oldFuncs;\
+ pGC->ops = &ShadowGCOps
+
+#define IS_VISIBLE(pWin) (pPriv->vtSema && \
+ (((WindowPtr)pWin)->visibility != VisibilityFullyObscured))
+
+#define TRIM_BOX(box, pGC) { \
+ BoxPtr extents = &pGC->pCompositeClip->extents;\
+ if(box.x1 < extents->x1) box.x1 = extents->x1; \
+ if(box.x2 > extents->x2) box.x2 = extents->x2; \
+ if(box.y1 < extents->y1) box.y1 = extents->y1; \
+ if(box.y2 > extents->y2) box.y2 = extents->y2; \
+ }
+
+#define TRANSLATE_BOX(box, pDraw) { \
+ box.x1 += pDraw->x; \
+ box.x2 += pDraw->x; \
+ box.y1 += pDraw->y; \
+ box.y2 += pDraw->y; \
+ }
+
+#define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \
+ TRANSLATE_BOX(box, pDraw); \
+ TRIM_BOX(box, pGC); \
+ }
+
+#define BOX_NOT_EMPTY(box) \
+ (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
+
+Bool
+ShadowFBInit2(ScreenPtr pScreen,
+ RefreshAreaFuncPtr preRefreshArea,
+ RefreshAreaFuncPtr postRefreshArea)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ShadowScreenPtr pPriv;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+
+ if (!preRefreshArea && !postRefreshArea)
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&ShadowScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey
+ (&ShadowGCKeyRec, PRIVATE_GC, sizeof(ShadowGCRec)))
+ return FALSE;
+
+ if (!(pPriv = (ShadowScreenPtr) malloc(sizeof(ShadowScreenRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv);
+
+ pPriv->pScrn = pScrn;
+ pPriv->preRefresh = preRefreshArea;
+ pPriv->postRefresh = postRefreshArea;
+ pPriv->vtSema = TRUE;
+
+ pPriv->CloseScreen = pScreen->CloseScreen;
+ pPriv->CopyWindow = pScreen->CopyWindow;
+ pPriv->CreateGC = pScreen->CreateGC;
+ pPriv->ModifyPixmapHeader = pScreen->ModifyPixmapHeader;
+
+ pPriv->EnterVT = pScrn->EnterVT;
+ pPriv->LeaveVT = pScrn->LeaveVT;
+
+ pScreen->CloseScreen = ShadowCloseScreen;
+ pScreen->CopyWindow = ShadowCopyWindow;
+ pScreen->CreateGC = ShadowCreateGC;
+
+ pScrn->EnterVT = ShadowEnterVT;
+ pScrn->LeaveVT = ShadowLeaveVT;
+
+ if (ps) {
+ pPriv->Composite = ps->Composite;
+ ps->Composite = ShadowComposite;
+ }
+
+ return TRUE;
+}
+
+Bool
+ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea)
+{
+ return ShadowFBInit2(pScreen, NULL, refreshArea);
+}
+
+/**********************************************************/
+
+static Bool
+ShadowEnterVT(int index, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ Bool ret;
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
+
+ pScrn->EnterVT = pPriv->EnterVT;
+ ret = (*pPriv->EnterVT) (index, flags);
+ pPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = ShadowEnterVT;
+ if (ret) {
+ pPriv->vtSema = TRUE;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+ShadowLeaveVT(int index, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(xf86Screens[index]->pScreen);
+
+ pPriv->vtSema = FALSE;
+
+ pScrn->LeaveVT = pPriv->LeaveVT;
+ (*pPriv->LeaveVT) (index, flags);
+ pPriv->LeaveVT = pScrn->LeaveVT;
+ pScrn->LeaveVT = ShadowLeaveVT;
+}
+
+/**********************************************************/
+
+static Bool
+ShadowCloseScreen(int i, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+
+ pScreen->CloseScreen = pPriv->CloseScreen;
+ pScreen->CopyWindow = pPriv->CopyWindow;
+ pScreen->CreateGC = pPriv->CreateGC;
+ pScreen->ModifyPixmapHeader = pPriv->ModifyPixmapHeader;
+
+ pScrn->EnterVT = pPriv->EnterVT;
+ pScrn->LeaveVT = pPriv->LeaveVT;
+
+ if (ps) {
+ ps->Composite = pPriv->Composite;
+ }
+
+ free((pointer) pPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static void
+ShadowCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgn)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
+ int num = 0;
+ RegionRec rgnDst;
+
+ if (pPriv->vtSema) {
+ RegionNull(&rgnDst);
+ RegionCopy(&rgnDst, prgn);
+
+ RegionTranslate(&rgnDst,
+ pWin->drawable.x - ptOldOrg.x,
+ pWin->drawable.y - ptOldOrg.y);
+ RegionIntersect(&rgnDst, &pWin->borderClip, &rgnDst);
+ if ((num = RegionNumRects(&rgnDst))) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, num, RegionRects(&rgnDst));
+ }
+ else {
+ RegionUninit(&rgnDst);
+ }
+ }
+
+ pScreen->CopyWindow = pPriv->CopyWindow;
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgn);
+ pScreen->CopyWindow = ShadowCopyWindow;
+
+ if (num) {
+ if (pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, num, RegionRects(&rgnDst));
+ RegionUninit(&rgnDst);
+ }
+}
+
+static void
+ShadowComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ BoxRec box;
+ BoxPtr extents;
+ Bool boxNotEmpty = FALSE;
+
+ if (pPriv->vtSema && pDst->pDrawable->type == DRAWABLE_WINDOW) {
+
+ box.x1 = pDst->pDrawable->x + xDst;
+ box.y1 = pDst->pDrawable->y + yDst;
+ box.x2 = box.x1 + width;
+ box.y2 = box.y1 + height;
+
+ extents = &pDst->pCompositeClip->extents;
+ if (box.x1 < extents->x1)
+ box.x1 = extents->x1;
+ if (box.x2 > extents->x2)
+ box.x2 = extents->x2;
+ if (box.y1 < extents->y1)
+ box.y1 = extents->y1;
+ if (box.y2 > extents->y2)
+ box.y2 = extents->y2;
+
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ ps->Composite = pPriv->Composite;
+ (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc,
+ xMask, yMask, xDst, yDst, width, height);
+ ps->Composite = ShadowComposite;
+
+ if (pPriv->postRefresh && boxNotEmpty) {
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+ }
+}
+
+/**********************************************************/
+
+static void ShadowValidateGC(GCPtr, unsigned long, DrawablePtr);
+static void ShadowChangeGC(GCPtr, unsigned long);
+static void ShadowCopyGC(GCPtr, unsigned long, GCPtr);
+static void ShadowDestroyGC(GCPtr);
+static void ShadowChangeClip(GCPtr, int, pointer, int);
+static void ShadowDestroyClip(GCPtr);
+static void ShadowCopyClip(GCPtr, GCPtr);
+
+GCFuncs ShadowGCFuncs = {
+ ShadowValidateGC, ShadowChangeGC, ShadowCopyGC, ShadowDestroyGC,
+ ShadowChangeClip, ShadowDestroyClip, ShadowCopyClip
+};
+
+extern GCOps ShadowGCOps;
+
+static Bool
+ShadowCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
+ ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);
+ Bool ret;
+
+ pScreen->CreateGC = pPriv->CreateGC;
+ if ((ret = (*pScreen->CreateGC) (pGC))) {
+ pGCPriv->ops = NULL;
+ pGCPriv->funcs = pGC->funcs;
+ pGC->funcs = &ShadowGCFuncs;
+ }
+ pScreen->CreateGC = ShadowCreateGC;
+
+ return ret;
+}
+
+static void
+ShadowValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
+{
+ SHADOW_GC_FUNC_PROLOGUE(pGC);
+ (*pGC->funcs->ValidateGC) (pGC, changes, pDraw);
+ if (pDraw->type == DRAWABLE_WINDOW)
+ pGCPriv->ops = pGC->ops; /* just so it's not NULL */
+ else
+ pGCPriv->ops = NULL;
+ SHADOW_GC_FUNC_EPILOGUE(pGC);
+}
+
+static void
+ShadowDestroyGC(GCPtr pGC)
+{
+ SHADOW_GC_FUNC_PROLOGUE(pGC);
+ (*pGC->funcs->DestroyGC) (pGC);
+ SHADOW_GC_FUNC_EPILOGUE(pGC);
+}
+
+static void
+ShadowChangeGC(GCPtr pGC, unsigned long mask)
+{
+ SHADOW_GC_FUNC_PROLOGUE(pGC);
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ SHADOW_GC_FUNC_EPILOGUE(pGC);
+}
+
+static void
+ShadowCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
+{
+ SHADOW_GC_FUNC_PROLOGUE(pGCDst);
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ SHADOW_GC_FUNC_EPILOGUE(pGCDst);
+}
+
+static void
+ShadowChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+{
+ SHADOW_GC_FUNC_PROLOGUE(pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ SHADOW_GC_FUNC_EPILOGUE(pGC);
+}
+
+static void
+ShadowCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ SHADOW_GC_FUNC_PROLOGUE(pgcDst);
+ (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
+ SHADOW_GC_FUNC_EPILOGUE(pgcDst);
+}
+
+static void
+ShadowDestroyClip(GCPtr pGC)
+{
+ SHADOW_GC_FUNC_PROLOGUE(pGC);
+ (*pGC->funcs->DestroyClip) (pGC);
+ SHADOW_GC_FUNC_EPILOGUE(pGC);
+}
+
+/**********************************************************/
+
+static void
+ShadowFillSpans(DrawablePtr pDraw,
+ GC * pGC,
+ int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)
+{
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && nInit) {
+ DDXPointPtr ppt = pptInit;
+ int *pwidth = pwidthInit;
+ int i = nInit;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ box.x1 = ppt->x;
+ box.x2 = box.x1 + *pwidth;
+ box.y2 = box.y1 = ppt->y;
+
+ while (--i) {
+ ppt++;
+ pwidth++;
+ if (box.x1 > ppt->x)
+ box.x1 = ppt->x;
+ if (box.x2 < (ppt->x + *pwidth))
+ box.x2 = ppt->x + *pwidth;
+ if (box.y1 > ppt->y)
+ box.y1 = ppt->y;
+ else if (box.y2 < ppt->y)
+ box.y2 = ppt->y;
+ }
+
+ box.y2++;
+
+ if (!pGC->miTranslate) {
+ TRANSLATE_BOX(box, pDraw);
+ }
+ TRIM_BOX(box, pGC);
+
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+
+ (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit,
+ fSorted);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+ }
+ else
+ (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit,
+ fSorted);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowSetSpans(DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ DDXPointPtr pptInit, int *pwidthInit, int nspans, int fSorted)
+{
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && nspans) {
+ DDXPointPtr ppt = pptInit;
+ int *pwidth = pwidthInit;
+ int i = nspans;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ box.x1 = ppt->x;
+ box.x2 = box.x1 + *pwidth;
+ box.y2 = box.y1 = ppt->y;
+
+ while (--i) {
+ ppt++;
+ pwidth++;
+ if (box.x1 > ppt->x)
+ box.x1 = ppt->x;
+ if (box.x2 < (ppt->x + *pwidth))
+ box.x2 = ppt->x + *pwidth;
+ if (box.y1 > ppt->y)
+ box.y1 = ppt->y;
+ else if (box.y2 < ppt->y)
+ box.y2 = ppt->y;
+ }
+
+ box.y2++;
+
+ if (!pGC->miTranslate) {
+ TRANSLATE_BOX(box, pDraw);
+ }
+ TRIM_BOX(box, pGC);
+
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+
+ (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, pptInit,
+ pwidthInit, nspans, fSorted);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+ }
+ else
+ (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, pptInit,
+ pwidthInit, nspans, fSorted);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPutImage(DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad, int format, char *pImage)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw)) {
+ box.x1 = x + pDraw->x;
+ box.x2 = box.x1 + w;
+ box.y1 = y + pDraw->y;
+ box.y2 = box.y1 + h;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+}
+
+static RegionPtr
+ShadowCopyArea(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC * pGC,
+ int srcx, int srcy, int width, int height, int dstx, int dsty)
+{
+ RegionPtr ret;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDst)) {
+ box.x1 = dstx + pDst->x;
+ box.x2 = box.x1 + width;
+ box.y1 = dsty + pDst->y;
+ box.y2 = box.y1 + height;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ ret = (*pGC->ops->CopyArea) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+ return ret;
+}
+
+static RegionPtr
+ShadowCopyPlane(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ RegionPtr ret;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDst)) {
+ box.x1 = dstx + pDst->x;
+ box.x2 = box.x1 + width;
+ box.y1 = dsty + pDst->y;
+ box.y2 = box.y1 + height;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ ret = (*pGC->ops->CopyPlane) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ bitPlane);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+ return ret;
+}
+
+static void
+ShadowPolyPoint(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int nptInit, xPoint * pptInit)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && nptInit) {
+ xPoint *ppt = pptInit;
+ int npt = nptInit;
+
+ box.x2 = box.x1 = pptInit->x;
+ box.y2 = box.y1 = pptInit->y;
+
+ /* this could be slow if the points were spread out */
+
+ while (--npt) {
+ ppt++;
+ if (box.x1 > ppt->x)
+ box.x1 = ppt->x;
+ else if (box.x2 < ppt->x)
+ box.x2 = ppt->x;
+ if (box.y1 > ppt->y)
+ box.y1 = ppt->y;
+ else if (box.y2 < ppt->y)
+ box.y2 = ppt->y;
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PolyPoint) (pDraw, pGC, mode, nptInit, pptInit);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPolylines(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int nptInit, DDXPointPtr pptInit)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && nptInit) {
+ DDXPointPtr ppt = pptInit;
+ int npt = nptInit;
+ int extra = pGC->lineWidth >> 1;
+
+ box.x2 = box.x1 = pptInit->x;
+ box.y2 = box.y1 = pptInit->y;
+
+ if (npt > 1) {
+ if (pGC->joinStyle == JoinMiter)
+ extra = 6 * pGC->lineWidth;
+ else if (pGC->capStyle == CapProjecting)
+ extra = pGC->lineWidth;
+ }
+
+ if (mode == CoordModePrevious) {
+ int x = box.x1;
+ int y = box.y1;
+
+ while (--npt) {
+ ppt++;
+ x += ppt->x;
+ y += ppt->y;
+ if (box.x1 > x)
+ box.x1 = x;
+ else if (box.x2 < x)
+ box.x2 = x;
+ if (box.y1 > y)
+ box.y1 = y;
+ else if (box.y2 < y)
+ box.y2 = y;
+ }
+ }
+ else {
+ while (--npt) {
+ ppt++;
+ if (box.x1 > ppt->x)
+ box.x1 = ppt->x;
+ else if (box.x2 < ppt->x)
+ box.x2 = ppt->x;
+ if (box.y1 > ppt->y)
+ box.y1 = ppt->y;
+ else if (box.y2 < ppt->y)
+ box.y2 = ppt->y;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->Polylines) (pDraw, pGC, mode, nptInit, pptInit);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPolySegment(DrawablePtr pDraw,
+ GCPtr pGC, int nsegInit, xSegment * pSegInit)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && nsegInit) {
+ int extra = pGC->lineWidth;
+ xSegment *pSeg = pSegInit;
+ int nseg = nsegInit;
+
+ if (pGC->capStyle != CapProjecting)
+ extra >>= 1;
+
+ if (pSeg->x2 > pSeg->x1) {
+ box.x1 = pSeg->x1;
+ box.x2 = pSeg->x2;
+ }
+ else {
+ box.x2 = pSeg->x1;
+ box.x1 = pSeg->x2;
+ }
+
+ if (pSeg->y2 > pSeg->y1) {
+ box.y1 = pSeg->y1;
+ box.y2 = pSeg->y2;
+ }
+ else {
+ box.y2 = pSeg->y1;
+ box.y1 = pSeg->y2;
+ }
+
+ while (--nseg) {
+ pSeg++;
+ if (pSeg->x2 > pSeg->x1) {
+ if (pSeg->x1 < box.x1)
+ box.x1 = pSeg->x1;
+ if (pSeg->x2 > box.x2)
+ box.x2 = pSeg->x2;
+ }
+ else {
+ if (pSeg->x2 < box.x1)
+ box.x1 = pSeg->x2;
+ if (pSeg->x1 > box.x2)
+ box.x2 = pSeg->x1;
+ }
+ if (pSeg->y2 > pSeg->y1) {
+ if (pSeg->y1 < box.y1)
+ box.y1 = pSeg->y1;
+ if (pSeg->y2 > box.y2)
+ box.y2 = pSeg->y2;
+ }
+ else {
+ if (pSeg->y2 < box.y1)
+ box.y1 = pSeg->y2;
+ if (pSeg->y1 > box.y2)
+ box.y2 = pSeg->y1;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PolySegment) (pDraw, pGC, nsegInit, pSegInit);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPolyRectangle(DrawablePtr pDraw,
+ GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
+{
+ BoxRec box;
+ BoxPtr pBoxInit = NULL;
+ Bool boxNotEmpty = FALSE;
+ int num = 0;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && nRectsInit) {
+ xRectangle *pRects = pRectsInit;
+ int nRects = nRectsInit;
+
+ if (nRects >= 32) {
+ int extra = pGC->lineWidth >> 1;
+
+ box.x1 = pRects->x;
+ box.x2 = box.x1 + pRects->width;
+ box.y1 = pRects->y;
+ box.y2 = box.y1 + pRects->height;
+
+ while (--nRects) {
+ pRects++;
+ if (box.x1 > pRects->x)
+ box.x1 = pRects->x;
+ if (box.x2 < (pRects->x + pRects->width))
+ box.x2 = pRects->x + pRects->width;
+ if (box.y1 > pRects->y)
+ box.y1 = pRects->y;
+ if (box.y2 < (pRects->y + pRects->height))
+ box.y2 = pRects->y + pRects->height;
+ }
+
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+ else {
+ BoxPtr pbox;
+ int offset1, offset2, offset3;
+
+ offset2 = pGC->lineWidth;
+ if (!offset2)
+ offset2 = 1;
+ offset1 = offset2 >> 1;
+ offset3 = offset2 - offset1;
+
+ pBoxInit = (BoxPtr) malloc(nRects * 4 * sizeof(BoxRec));
+ pbox = pBoxInit;
+
+ while (nRects--) {
+ pbox->x1 = pRects->x - offset1;
+ pbox->y1 = pRects->y - offset1;
+ pbox->x2 = pbox->x1 + pRects->width + offset2;
+ pbox->y2 = pbox->y1 + offset2;
+ TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
+ if (BOX_NOT_EMPTY((*pbox))) {
+ num++;
+ pbox++;
+ }
+
+ pbox->x1 = pRects->x - offset1;
+ pbox->y1 = pRects->y + offset3;
+ pbox->x2 = pbox->x1 + offset2;
+ pbox->y2 = pbox->y1 + pRects->height - offset2;
+ TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
+ if (BOX_NOT_EMPTY((*pbox))) {
+ num++;
+ pbox++;
+ }
+
+ pbox->x1 = pRects->x + pRects->width - offset1;
+ pbox->y1 = pRects->y + offset3;
+ pbox->x2 = pbox->x1 + offset2;
+ pbox->y2 = pbox->y1 + pRects->height - offset2;
+ TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
+ if (BOX_NOT_EMPTY((*pbox))) {
+ num++;
+ pbox++;
+ }
+
+ pbox->x1 = pRects->x - offset1;
+ pbox->y1 = pRects->y + pRects->height - offset1;
+ pbox->x2 = pbox->x1 + pRects->width + offset2;
+ pbox->y2 = pbox->y1 + offset2;
+ TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
+ if (BOX_NOT_EMPTY((*pbox))) {
+ num++;
+ pbox++;
+ }
+
+ pRects++;
+ }
+
+ if (num) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, num, pBoxInit);
+ }
+ else {
+ free(pBoxInit);
+ }
+ }
+ }
+
+ (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit);
+
+ if (boxNotEmpty && pPriv->postRefresh) {
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+ }
+ else if (num) {
+ if (pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, num, pBoxInit);
+ free(pBoxInit);
+ }
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+}
+
+static void
+ShadowPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcsInit, xArc * parcsInit)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && narcsInit) {
+ int narcs = narcsInit;
+ xArc *parcs = parcsInit;
+ int extra = pGC->lineWidth >> 1;
+
+ box.x1 = parcs->x;
+ box.x2 = box.x1 + parcs->width;
+ box.y1 = parcs->y;
+ box.y2 = box.y1 + parcs->height;
+
+ /* should I break these up instead ? */
+
+ while (--narcs) {
+ parcs++;
+ if (box.x1 > parcs->x)
+ box.x1 = parcs->x;
+ if (box.x2 < (parcs->x + parcs->width))
+ box.x2 = parcs->x + parcs->width;
+ if (box.y1 > parcs->y)
+ box.y1 = parcs->y;
+ if (box.y2 < (parcs->y + parcs->height))
+ box.y2 = parcs->y + parcs->height;
+ }
+
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PolyArc) (pDraw, pGC, narcsInit, parcsInit);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+}
+
+static void
+ShadowFillPolygon(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr pptInit)
+{
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && (count > 2)) {
+ DDXPointPtr ppt = pptInit;
+ int i = count;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ box.x2 = box.x1 = ppt->x;
+ box.y2 = box.y1 = ppt->y;
+
+ if (mode != CoordModeOrigin) {
+ int x = box.x1;
+ int y = box.y1;
+
+ while (--i) {
+ ppt++;
+ x += ppt->x;
+ y += ppt->y;
+ if (box.x1 > x)
+ box.x1 = x;
+ else if (box.x2 < x)
+ box.x2 = x;
+ if (box.y1 > y)
+ box.y1 = y;
+ else if (box.y2 < y)
+ box.y2 = y;
+ }
+ }
+ else {
+ while (--i) {
+ ppt++;
+ if (box.x1 > ppt->x)
+ box.x1 = ppt->x;
+ else if (box.x2 < ppt->x)
+ box.x2 = ppt->x;
+ if (box.y1 > ppt->y)
+ box.y1 = ppt->y;
+ else if (box.y2 < ppt->y)
+ box.y2 = ppt->y;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+
+ (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, pptInit);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+ }
+ else
+ (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, pptInit);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPolyFillRect(DrawablePtr pDraw,
+ GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
+{
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && nRectsInit) {
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+ xRectangle *pRects = pRectsInit;
+ int nRects = nRectsInit;
+
+ box.x1 = pRects->x;
+ box.x2 = box.x1 + pRects->width;
+ box.y1 = pRects->y;
+ box.y2 = box.y1 + pRects->height;
+
+ while (--nRects) {
+ pRects++;
+ if (box.x1 > pRects->x)
+ box.x1 = pRects->x;
+ if (box.x2 < (pRects->x + pRects->width))
+ box.x2 = pRects->x + pRects->width;
+ if (box.y1 > pRects->y)
+ box.y1 = pRects->y;
+ if (box.y2 < (pRects->y + pRects->height))
+ box.y2 = pRects->y + pRects->height;
+ }
+
+ /* cfb messes with the pRectsInit so we have to do our
+ calculations first */
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, nRectsInit, pRectsInit);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+ }
+ else
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, nRectsInit, pRectsInit);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcsInit, xArc * parcsInit)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && narcsInit) {
+ xArc *parcs = parcsInit;
+ int narcs = narcsInit;
+
+ box.x1 = parcs->x;
+ box.x2 = box.x1 + parcs->width;
+ box.y1 = parcs->y;
+ box.y2 = box.y1 + parcs->height;
+
+ /* should I break these up instead ? */
+
+ while (--narcs) {
+ parcs++;
+ if (box.x1 > parcs->x)
+ box.x1 = parcs->x;
+ if (box.x2 < (parcs->x + parcs->width))
+ box.x2 = parcs->x + parcs->width;
+ if (box.y1 > parcs->y)
+ box.y1 = parcs->y;
+ if (box.y2 < (parcs->y + parcs->height))
+ box.y2 = parcs->y + parcs->height;
+ }
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PolyFillArc) (pDraw, pGC, narcsInit, parcsInit);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowTextExtent(FontPtr pFont, int count, char *chars,
+ FontEncoding fontEncoding, BoxPtr box)
+{
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
+
+ GetGlyphs(pFont, (unsigned long) count, (unsigned char *) chars,
+ fontEncoding, &n, charinfo);
+ w = 0;
+ for (i = 0; i < n; i++) {
+ w += charinfo[i]->metrics.characterWidth;
+ }
+ if (i) {
+ w += charinfo[i - 1]->metrics.rightSideBearing;
+ }
+
+ box->x1 = 0;
+ if (n) {
+ if (charinfo[0]->metrics.leftSideBearing < 0) {
+ box->x1 = charinfo[0]->metrics.leftSideBearing;
+ }
+ }
+ box->x2 = w;
+ box->y1 = -FONTMAXBOUNDS(pFont, ascent);
+ box->y2 = FONTMAXBOUNDS(pFont, descent);
+}
+
+static void
+ShadowFontToBox(BoxPtr BB, DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ int count, char *chars, int wide)
+{
+ FontPtr pFont;
+
+ pFont = pGC->font;
+ if (pFont->info.constantWidth) {
+ int ascent, descent, left, right = 0;
+
+ ascent = max(pFont->info.fontAscent, pFont->info.maxbounds.ascent);
+ descent = max(pFont->info.fontDescent, pFont->info.maxbounds.descent);
+ left = pFont->info.maxbounds.leftSideBearing;
+ if (count > 0) {
+ right = (count - 1) * pFont->info.maxbounds.characterWidth;
+ }
+ right += pFont->info.maxbounds.rightSideBearing;
+ BB->x1 =
+ max(pDrawable->x + x - left,
+ RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1);
+ BB->y1 =
+ max(pDrawable->y + y - ascent,
+ RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1);
+ BB->x2 =
+ min(pDrawable->x + x + right,
+ RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2);
+ BB->y2 =
+ min(pDrawable->y + y + descent,
+ RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2);
+ }
+ else {
+ ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0)
+ ? Linear16Bit : TwoD16Bit : Linear8Bit, BB);
+ BB->x1 =
+ max(pDrawable->x + x + BB->x1,
+ RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1);
+ BB->y1 =
+ max(pDrawable->y + y + BB->y1,
+ RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1);
+ BB->x2 =
+ min(pDrawable->x + x + BB->x2,
+ RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2);
+ BB->y2 =
+ min(pDrawable->y + y + BB->y2,
+ RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2);
+ }
+}
+
+static int
+ShadowPolyText8(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ int width;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw)) {
+ ShadowFontToBox(&box, pDraw, pGC, x, y, count, chars, 0);
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ width = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+ return width;
+}
+
+static int
+ShadowPolyText16(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
+{
+ int width;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw)) {
+ ShadowFontToBox(&box, pDraw, pGC, x, y, count, (char *) chars, 1);
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ width = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+ return width;
+}
+
+static void
+ShadowImageText8(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && count) {
+ int top, bot, Min, Max;
+
+ top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
+ bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
+
+ Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
+ if (Min > 0)
+ Min = 0;
+ Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
+ if (Max < 0)
+ Max = 0;
+
+ /* ugh */
+ box.x1 = pDraw->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing);
+ box.x2 = pDraw->x + x + Max +
+ FONTMAXBOUNDS(pGC->font, rightSideBearing);
+
+ box.y1 = pDraw->y + y - top;
+ box.y2 = pDraw->y + y + bot;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowImageText16(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && count) {
+ int top, bot, Min, Max;
+
+ top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
+ bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
+
+ Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
+ if (Min > 0)
+ Min = 0;
+ Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
+ if (Max < 0)
+ Max = 0;
+
+ /* ugh */
+ box.x1 = pDraw->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing);
+ box.x2 = pDraw->x + x + Max +
+ FONTMAXBOUNDS(pGC->font, rightSideBearing);
+
+ box.y1 = pDraw->y + y - top;
+ box.y2 = pDraw->y + y + bot;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowImageGlyphBlt(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nglyphInit,
+ CharInfoPtr * ppciInit, pointer pglyphBase)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && nglyphInit) {
+ CharInfoPtr *ppci = ppciInit;
+ unsigned int nglyph = nglyphInit;
+ int top, bot, width = 0;
+
+ top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
+ bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
+
+ box.x1 = ppci[0]->metrics.leftSideBearing;
+ if (box.x1 > 0)
+ box.x1 = 0;
+ box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing -
+ ppci[nglyph - 1]->metrics.characterWidth;
+ if (box.x2 < 0)
+ box.x2 = 0;
+
+ box.x2 += pDraw->x + x;
+ box.x1 += pDraw->x + x;
+
+ while (nglyph--) {
+ width += (*ppci)->metrics.characterWidth;
+ ppci++;
+ }
+
+ if (width > 0)
+ box.x2 += width;
+ else
+ box.x1 += width;
+
+ box.y1 = pDraw->y + y - top;
+ box.y2 = pDraw->y + y + bot;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, x, y, nglyphInit,
+ ppciInit, pglyphBase);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPolyGlyphBlt(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nglyphInit,
+ CharInfoPtr * ppciInit, pointer pglyphBase)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw) && nglyphInit) {
+ CharInfoPtr *ppci = ppciInit;
+ unsigned int nglyph = nglyphInit;
+
+ /* ugh */
+ box.x1 = pDraw->x + x + ppci[0]->metrics.leftSideBearing;
+ box.x2 = pDraw->x + x + ppci[nglyph - 1]->metrics.rightSideBearing;
+
+ if (nglyph > 1) {
+ int width = 0;
+
+ while (--nglyph) {
+ width += (*ppci)->metrics.characterWidth;
+ ppci++;
+ }
+
+ if (width > 0)
+ box.x2 += width;
+ else
+ box.x1 += width;
+ }
+
+ box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent);
+ box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent);
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, x, y, nglyphInit,
+ ppciInit, pglyphBase);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPushPixels(GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg)
+{
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if (IS_VISIBLE(pDraw)) {
+ box.x1 = xOrg;
+ box.y1 = yOrg;
+
+ if (!pGC->miTranslate) {
+ box.x1 += pDraw->x;
+ box.y1 += pDraw->y;
+ }
+
+ box.x2 = box.x1 + dx;
+ box.y2 = box.y1 + dy;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+
+ if (boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+GCOps ShadowGCOps = {
+ ShadowFillSpans, ShadowSetSpans,
+ ShadowPutImage, ShadowCopyArea,
+ ShadowCopyPlane, ShadowPolyPoint,
+ ShadowPolylines, ShadowPolySegment,
+ ShadowPolyRectangle, ShadowPolyArc,
+ ShadowFillPolygon, ShadowPolyFillRect,
+ ShadowPolyFillArc, ShadowPolyText8,
+ ShadowPolyText16, ShadowImageText8,
+ ShadowImageText16, ShadowImageGlyphBlt,
+ ShadowPolyGlyphBlt, ShadowPushPixels,
+};
diff --git a/xorg-server/hw/xfree86/shadowfb/shadowfb.h b/xorg-server/hw/xfree86/shadowfb/shadowfb.h
index 56e0e86fe..bcf59f9b2 100644
--- a/xorg-server/hw/xfree86/shadowfb/shadowfb.h
+++ b/xorg-server/hw/xfree86/shadowfb/shadowfb.h
@@ -9,7 +9,7 @@
* the number of dirty rectangles, and a pointer to the first dirty rectangle
* in the array.
*/
-typedef void (*RefreshAreaFuncPtr)(ScrnInfoPtr, int, BoxPtr);
+typedef void (*RefreshAreaFuncPtr) (ScrnInfoPtr, int, BoxPtr);
/*
* ShadowFBInit initializes the shadowfb subsystem. refreshArea is a pointer
@@ -20,10 +20,7 @@ typedef void (*RefreshAreaFuncPtr)(ScrnInfoPtr, int, BoxPtr);
* Returns FALSE in the event of an error.
*/
extern _X_EXPORT Bool
-ShadowFBInit (
- ScreenPtr pScreen,
- RefreshAreaFuncPtr refreshArea
-);
+ ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea);
/*
* ShadowFBInit2 is a more featureful refinement of the original shadowfb.
@@ -34,10 +31,9 @@ ShadowFBInit (
* Returns FALSE in the event of an error
*/
extern _X_EXPORT Bool
-ShadowFBInit2 (
- ScreenPtr pScreen,
- RefreshAreaFuncPtr preRefreshArea,
- RefreshAreaFuncPtr postRefreshArea
-);
-#endif /* _SHADOWFB_H */
+ShadowFBInit2(ScreenPtr pScreen,
+ RefreshAreaFuncPtr preRefreshArea,
+ RefreshAreaFuncPtr postRefreshArea);
+
+#endif /* _SHADOWFB_H */
diff --git a/xorg-server/hw/xfree86/utils/cvt/cvt.c b/xorg-server/hw/xfree86/utils/cvt/cvt.c
index 0de5ffea4..9483964e0 100644
--- a/xorg-server/hw/xfree86/utils/cvt/cvt.c
+++ b/xorg-server/hw/xfree86/utils/cvt/cvt.c
@@ -30,6 +30,7 @@ void
FatalError(const char *f, ...)
{
va_list args;
+
va_start(args, f);
vfprintf(stderr, f, args);
va_end(args);
@@ -69,22 +70,21 @@ XNFcalloc(unsigned long n)
*/
static Bool
CVTCheckStandard(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
- Bool Verbose)
+ Bool Verbose)
{
- Bool IsCVT = TRUE;
+ Bool IsCVT = TRUE;
if ((!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) ||
(!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) ||
(!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) ||
(!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) ||
- (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)))
- ;
+ (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)));
else {
if (Verbose)
fprintf(stderr, "Warning: Aspect Ratio is not CVT standard.\n");
IsCVT = FALSE;
}
-
+
if ((VRefresh != 50.0) && (VRefresh != 60.0) &&
(VRefresh != 75.0) && (VRefresh != 85.0)) {
if (Verbose)
@@ -92,11 +92,10 @@ CVTCheckStandard(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
"(50, 60, 75 or 85Hz).\n");
IsCVT = FALSE;
}
-
+
return IsCVT;
}
-
/*
* I'm not documenting --interlaced for obvious reasons, even though I did
* implement it. I also can't deny having looked at gtf here.
@@ -113,20 +112,21 @@ PrintUsage(char *Name)
"(default: normal blanking).\n");
fprintf(stderr, " X : Desired horizontal resolution "
"(multiple of 8, required).\n");
- fprintf(stderr, " Y : Desired vertical resolution (required).\n");
- fprintf(stderr, " refresh : Desired refresh rate (default: 60.0Hz).\n");
+ fprintf(stderr,
+ " Y : Desired vertical resolution (required).\n");
+ fprintf(stderr,
+ " refresh : Desired refresh rate (default: 60.0Hz).\n");
fprintf(stderr, "\n");
fprintf(stderr, "Calculates VESA CVT (Coordinated Video Timing) modelines"
- " for use with X.\n");
+ " for use with X.\n");
}
-
/*
*
*/
static void
-PrintComment(DisplayModeRec *Mode, Bool CVT, Bool Reduced)
+PrintComment(DisplayModeRec * Mode, Bool CVT, Bool Reduced)
{
printf("# %dx%d %.2f Hz ", Mode->HDisplay, Mode->VDisplay, Mode->VRefresh);
@@ -154,16 +154,16 @@ PrintComment(DisplayModeRec *Mode, Bool CVT, Bool Reduced)
printf("-R");
printf(") ");
- } else
+ }
+ else
printf("(CVT) ");
printf("hsync: %.2f kHz; ", Mode->HSync);
- printf("pclk: %.2f MHz", ((float ) Mode->Clock) / 1000.0);
+ printf("pclk: %.2f MHz", ((float) Mode->Clock) / 1000.0);
printf("\n");
}
-
/*
* Originally grabbed from xf86Mode.c.
*
@@ -179,9 +179,9 @@ PrintModeline(DisplayModePtr Mode, int HDisplay, int VDisplay, float VRefresh,
else
printf("Modeline \"%dx%d_%.2f\" ", HDisplay, VDisplay, VRefresh);
- printf("%6.2f %i %i %i %i %i %i %i %i", Mode->Clock/1000., Mode->HDisplay,
- Mode->HSyncStart, Mode->HSyncEnd, Mode->HTotal, Mode->VDisplay,
- Mode->VSyncStart, Mode->VSyncEnd, Mode->VTotal);
+ printf("%6.2f %i %i %i %i %i %i %i %i", Mode->Clock / 1000.,
+ Mode->HDisplay, Mode->HSyncStart, Mode->HSyncEnd, Mode->HTotal,
+ Mode->VDisplay, Mode->VSyncStart, Mode->VSyncEnd, Mode->VTotal);
if (Mode->Flags & V_INTERLACE)
printf(" interlace");
@@ -197,19 +197,18 @@ PrintModeline(DisplayModePtr Mode, int HDisplay, int VDisplay, float VRefresh,
printf("\n");
}
-
/*
*
*/
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
- DisplayModeRec *Mode;
- int HDisplay = 0, VDisplay = 0;
- float VRefresh = 0.0;
- Bool Reduced = FALSE, Verbose = FALSE, IsCVT;
- Bool Interlaced = FALSE;
- int n;
+ DisplayModeRec *Mode;
+ int HDisplay = 0, VDisplay = 0;
+ float VRefresh = 0.0;
+ Bool Reduced = FALSE, Verbose = FALSE, IsCVT;
+ Bool Interlaced = FALSE;
+ int n;
if ((argc < 3) || (argc > 7)) {
PrintUsage(argv[0]);
@@ -230,27 +229,28 @@ main (int argc, char *argv[])
else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) {
PrintUsage(argv[0]);
return 0;
- } else if (!HDisplay) {
+ }
+ else if (!HDisplay) {
HDisplay = atoi(argv[n]);
- if (!HDisplay) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
+ if (!HDisplay) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
else if (!VDisplay) {
VDisplay = atoi(argv[n]);
- if (!VDisplay) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
+ if (!VDisplay) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
else if (!VRefresh) {
VRefresh = atof(argv[n]);
- if (!VRefresh) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
+ if (!VRefresh) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
else {
PrintUsage(argv[0]);
return 1;
@@ -273,13 +273,13 @@ main (int argc, char *argv[])
}
if (Reduced) {
- if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) {
- fprintf(stderr,
- "\nERROR: Multiple of 60Hz refresh rate required for "
- " reduced blanking.\n");
- PrintUsage(argv[0]);
- return 0;
- }
+ if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) {
+ fprintf(stderr,
+ "\nERROR: Multiple of 60Hz refresh rate required for "
+ " reduced blanking.\n");
+ PrintUsage(argv[0]);
+ return 0;
+ }
}
IsCVT = CVTCheckStandard(HDisplay, VDisplay, VRefresh, Reduced, Verbose);
@@ -288,6 +288,6 @@ main (int argc, char *argv[])
PrintComment(Mode, IsCVT, Reduced);
PrintModeline(Mode, HDisplay, VDisplay, VRefresh, Reduced);
-
+
return 0;
}
diff --git a/xorg-server/hw/xfree86/utils/gtf/gtf.c b/xorg-server/hw/xfree86/utils/gtf/gtf.c
index 87fcb3f0e..15503bb35 100644
--- a/xorg-server/hw/xfree86/utils/gtf/gtf.c
+++ b/xorg-server/hw/xfree86/utils/gtf/gtf.c
@@ -104,7 +104,7 @@
*/
#ifdef HAVE_XORG_CONFIG_H
-# include <xorg-config.h>
+#include <xorg-config.h>
#endif
#include <stdio.h>
@@ -128,38 +128,28 @@
#define C_PRIME (((C - J) * K/256.0) + J)
#define M_PRIME (K/256.0 * M)
-
/* struct definitions */
-typedef struct __mode
-{
+typedef struct __mode {
int hr, hss, hse, hfl;
int vr, vss, vse, vfl;
float pclk, h_freq, v_freq;
} mode;
-
-typedef struct __options
-{
+typedef struct __options {
int x, y;
int xorgmode, fbmode;
float v_freq;
} options;
-
-
-
/* prototypes */
void print_value(int n, const char *name, float val);
-void print_xf86_mode (mode *m);
-void print_fb_mode (mode *m);
-mode *vert_refresh (int h_pixels, int v_lines, float freq,
- int interlaced, int margins);
-options *parse_command_line (int argc, char *argv[]);
-
-
-
+void print_xf86_mode(mode * m);
+void print_fb_mode(mode * m);
+mode *vert_refresh(int h_pixels, int v_lines, float freq,
+ int interlaced, int margins);
+options *parse_command_line(int argc, char *argv[]);
/*
* print_value() - print the result of the named computation; this is
@@ -168,34 +158,31 @@ options *parse_command_line (int argc, char *argv[]);
int global_verbose = 0;
-void print_value(int n, const char *name, float val)
+void
+print_value(int n, const char *name, float val)
{
if (global_verbose) {
printf("%2d: %-27s: %15f\n", n, name, val);
}
}
-
-
/* print_xf86_mode() - print the XServer modeline, given mode timings. */
-void print_xf86_mode (mode *m)
+void
+print_xf86_mode(mode * m)
{
- printf ("\n");
- printf (" # %dx%d @ %.2f Hz (GTF) hsync: %.2f kHz; pclk: %.2f MHz\n",
- m->hr, m->vr, m->v_freq, m->h_freq, m->pclk);
-
- printf (" Modeline \"%dx%d_%.2f\" %.2f"
- " %d %d %d %d"
- " %d %d %d %d"
- " -HSync +Vsync\n\n",
- m->hr, m->vr, m->v_freq, m->pclk,
- m->hr, m->hss, m->hse, m->hfl,
- m->vr, m->vss, m->vse, m->vfl);
-
-}
+ printf("\n");
+ printf(" # %dx%d @ %.2f Hz (GTF) hsync: %.2f kHz; pclk: %.2f MHz\n",
+ m->hr, m->vr, m->v_freq, m->h_freq, m->pclk);
+ printf(" Modeline \"%dx%d_%.2f\" %.2f"
+ " %d %d %d %d"
+ " %d %d %d %d"
+ " -HSync +Vsync\n\n",
+ m->hr, m->vr, m->v_freq, m->pclk,
+ m->hr, m->hss, m->hse, m->hfl, m->vr, m->vss, m->vse, m->vfl);
+}
/*
* print_fb_mode() - print a mode description in fbset(8) format;
@@ -243,31 +230,26 @@ void print_xf86_mode (mode *m)
* to edit the mode description after it's generated.
*/
-void print_fb_mode (mode *m)
+void
+print_fb_mode(mode * m)
{
- printf ("\n");
- printf ("mode \"%dx%d %.2fHz 32bit (GTF)\"\n",
- m->hr, m->vr, m->v_freq);
- printf (" # PCLK: %.2f MHz, H: %.2f kHz, V: %.2f Hz\n",
- m->pclk, m->h_freq, m->v_freq);
- printf (" geometry %d %d %d %d 32\n",
- m->hr, m->vr, m->hr, m->vr);
- printf (" timings %d %d %d %d %d %d %d\n",
- (int) rint(1000000.0/m->pclk),/* pixclock in picoseconds */
- m->hfl - m->hse, /* left margin (in pixels) */
- m->hss - m->hr, /* right margin (in pixels) */
- m->vfl - m->vse, /* upper margin (in pixel lines) */
- m->vss - m->vr, /* lower margin (in pixel lines) */
- m->hse - m->hss, /* horizontal sync length (pixels) */
- m->vse - m->vss); /* vert sync length (pixel lines) */
- printf (" hsync low\n");
- printf (" vsync high\n");
- printf ("endmode\n\n");
-
-}
-
-
+ printf("\n");
+ printf("mode \"%dx%d %.2fHz 32bit (GTF)\"\n", m->hr, m->vr, m->v_freq);
+ printf(" # PCLK: %.2f MHz, H: %.2f kHz, V: %.2f Hz\n",
+ m->pclk, m->h_freq, m->v_freq);
+ printf(" geometry %d %d %d %d 32\n", m->hr, m->vr, m->hr, m->vr);
+ printf(" timings %d %d %d %d %d %d %d\n", (int) rint(1000000.0 / m->pclk), /* pixclock in picoseconds */
+ m->hfl - m->hse, /* left margin (in pixels) */
+ m->hss - m->hr, /* right margin (in pixels) */
+ m->vfl - m->vse, /* upper margin (in pixel lines) */
+ m->vss - m->vr, /* lower margin (in pixel lines) */
+ m->hse - m->hss, /* horizontal sync length (pixels) */
+ m->vse - m->vss); /* vert sync length (pixel lines) */
+ printf(" hsync low\n");
+ printf(" vsync high\n");
+ printf("endmode\n\n");
+}
/*
* vert_refresh() - as defined by the GTF Timing Standard, compute the
@@ -282,8 +264,8 @@ void print_fb_mode (mode *m)
* XServer of fbset mode descriptions, from what I can tell).
*/
-mode *vert_refresh (int h_pixels, int v_lines, float freq,
- int interlaced, int margins)
+mode *
+vert_refresh(int h_pixels, int v_lines, float freq, int interlaced, int margins)
{
float h_pixels_rnd;
float v_lines_rnd;
@@ -312,9 +294,8 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
float h_front_porch;
float v_odd_front_porch_lines;
- mode *m = (mode*) malloc (sizeof (mode));
-
-
+ mode *m = (mode *) malloc(sizeof(mode));
+
/* 1. In order to give correct results, the number of horizontal
* pixels requested is first processed to ensure that it is divisible
* by the character size, by rounding it to the nearest character
@@ -322,12 +303,11 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
*
* [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND])
*/
-
+
h_pixels_rnd = rint((float) h_pixels / CELL_GRAN) * CELL_GRAN;
-
+
print_value(1, "[H PIXELS RND]", h_pixels_rnd);
-
/* 2. If interlace is requested, the number of vertical lines assumed
* by the calculation must be halved, as the computation calculates
* the number of vertical lines per field. In either case, the
@@ -338,12 +318,10 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
*/
v_lines_rnd = interlaced ?
- rint((float) v_lines) / 2.0 :
- rint((float) v_lines);
-
+ rint((float) v_lines) / 2.0 : rint((float) v_lines);
+
print_value(2, "[V LINES RND]", v_lines_rnd);
-
-
+
/* 3. Find the frame rate required:
*
* [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2,
@@ -353,7 +331,6 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
v_field_rate_rqd = interlaced ? (freq * 2.0) : (freq);
print_value(3, "[V FIELD RATE RQD]", v_field_rate_rqd);
-
/* 4. Find number of lines in Top margin:
*
@@ -365,7 +342,6 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
top_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0);
print_value(4, "[TOP MARGIN (LINES)]", top_margin);
-
/* 5. Find number of lines in Bottom margin:
*
@@ -374,11 +350,11 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
* 0)
*/
- bottom_margin = margins ? rint(MARGIN_PERCENT/100.0 * v_lines_rnd) : (0.0);
+ bottom_margin =
+ margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0);
print_value(5, "[BOT MARGIN (LINES)]", bottom_margin);
-
/* 6. If interlace is required, then set variable [INTERLACE]=0.5:
*
* [INTERLACE]=(IF([INT RQD?]="y",0.5,0))
@@ -387,7 +363,6 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
interlace = interlaced ? 0.5 : 0.0;
print_value(6, "[INTERLACE]", interlace);
-
/* 7. Estimate the Horizontal period
*
@@ -396,34 +371,31 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
* [MIN PORCH RND]+[INTERLACE]) * 1000000
*/
- h_period_est = (((1.0/v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP/1000000.0))
- / (v_lines_rnd + (2*top_margin) + MIN_PORCH + interlace)
+ h_period_est = (((1.0 / v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP / 1000000.0))
+ / (v_lines_rnd + (2 * top_margin) + MIN_PORCH + interlace)
* 1000000.0);
print_value(7, "[H PERIOD EST]", h_period_est);
-
/* 8. Find the number of lines in V sync + back porch:
*
* [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0)
*/
- vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP/h_period_est);
+ vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP / h_period_est);
print_value(8, "[V SYNC+BP]", vsync_plus_bp);
-
-
+
/* 9. Find the number of lines in V back porch alone:
*
* [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND]
*
* XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]?
*/
-
+
v_back_porch = vsync_plus_bp - V_SYNC_RQD;
-
+
print_value(9, "[V BACK PORCH]", v_back_porch);
-
/* 10. Find the total number of lines in Vertical field period:
*
@@ -434,9 +406,8 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp +
interlace + MIN_PORCH;
-
+
print_value(10, "[TOTAL V LINES]", total_v_lines);
-
/* 11. Estimate the Vertical field frequency:
*
@@ -444,9 +415,8 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
*/
v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0;
-
+
print_value(11, "[V FIELD RATE EST]", v_field_rate_est);
-
/* 12. Find the actual horizontal period:
*
@@ -454,9 +424,8 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
*/
h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est);
-
+
print_value(12, "[H PERIOD]", h_period);
-
/* 13. Find the actual Vertical field frequency:
*
@@ -466,7 +435,6 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
v_field_rate = 1.0 / h_period / total_v_lines * 1000000.0;
print_value(13, "[V FIELD RATE]", v_field_rate);
-
/* 14. Find the Vertical frame frequency:
*
@@ -476,7 +444,6 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate;
print_value(14, "[V FRAME RATE]", v_frame_rate);
-
/* 15. Find number of pixels in left margin:
*
@@ -489,9 +456,8 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
left_margin = margins ?
rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
0.0;
-
+
print_value(15, "[LEFT MARGIN (PIXELS)]", left_margin);
-
/* 16. Find number of pixels in right margin:
*
@@ -500,13 +466,12 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
* [CELL GRAN RND]),0)) * [CELL GRAN RND],
* 0))
*/
-
+
right_margin = margins ?
rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
0.0;
-
+
print_value(16, "[RIGHT MARGIN (PIXELS)]", right_margin);
-
/* 17. Find total number of active pixels in image and left and right
* margins:
@@ -516,10 +481,9 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
*/
total_active_pixels = h_pixels_rnd + left_margin + right_margin;
-
+
print_value(17, "[TOTAL ACTIVE PIXELS]", total_active_pixels);
-
-
+
/* 18. Find the ideal blanking duty cycle from the blanking duty cycle
* equation:
*
@@ -527,9 +491,8 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
*/
ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0);
-
+
print_value(18, "[IDEAL DUTY CYCLE]", ideal_duty_cycle);
-
/* 19. Find the number of pixels in the blanking time to the nearest
* double character cell:
@@ -545,9 +508,8 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
ideal_duty_cycle /
(100.0 - ideal_duty_cycle) /
(2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN);
-
+
print_value(19, "[H BLANK (PIXELS)]", h_blank);
-
/* 20. Find total number of pixels:
*
@@ -555,19 +517,17 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
*/
total_pixels = total_active_pixels + h_blank;
-
+
print_value(20, "[TOTAL PIXELS]", total_pixels);
-
/* 21. Find pixel clock frequency:
*
* [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD]
*/
-
+
pixel_freq = total_pixels / h_period;
-
+
print_value(21, "[PIXEL FREQ]", pixel_freq);
-
/* 22. Find horizontal frequency:
*
@@ -575,28 +535,24 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
*/
h_freq = 1000.0 / h_period;
-
- print_value(22, "[H FREQ]", h_freq);
-
+ print_value(22, "[H FREQ]", h_freq);
/* Stage 1 computations are now complete; I should really pass
the results to another function and do the Stage 2
computations, but I only need a few more values so I'll just
append the computations here for now */
-
-
/* 17. Find the number of pixels in the horizontal sync period:
*
* [H SYNC (PIXELS)] =(ROUND(([H SYNC%] / 100 * [TOTAL PIXELS] /
* [CELL GRAN RND]),0))*[CELL GRAN RND]
*/
- h_sync = rint(H_SYNC_PERCENT/100.0 * total_pixels / CELL_GRAN) * CELL_GRAN;
+ h_sync =
+ rint(H_SYNC_PERCENT / 100.0 * total_pixels / CELL_GRAN) * CELL_GRAN;
print_value(17, "[H SYNC (PIXELS)]", h_sync);
-
/* 18. Find the number of pixels in the horizontal front porch period:
*
@@ -606,136 +562,136 @@ mode *vert_refresh (int h_pixels, int v_lines, float freq,
h_front_porch = (h_blank / 2.0) - h_sync;
print_value(18, "[H FRONT PORCH (PIXELS)]", h_front_porch);
-
-
+
/* 36. Find the number of lines in the odd front porch period:
*
* [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE])
*/
-
+
v_odd_front_porch_lines = MIN_PORCH + interlace;
-
+
print_value(36, "[V ODD FRONT PORCH(LINES)]", v_odd_front_porch_lines);
-
/* finally, pack the results in the mode struct */
-
- m->hr = (int) (h_pixels_rnd);
+
+ m->hr = (int) (h_pixels_rnd);
m->hss = (int) (h_pixels_rnd + h_front_porch);
m->hse = (int) (h_pixels_rnd + h_front_porch + h_sync);
m->hfl = (int) (total_pixels);
- m->vr = (int) (v_lines_rnd);
+ m->vr = (int) (v_lines_rnd);
m->vss = (int) (v_lines_rnd + v_odd_front_porch_lines);
m->vse = (int) (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD);
m->vfl = (int) (total_v_lines);
- m->pclk = pixel_freq;
+ m->pclk = pixel_freq;
m->h_freq = h_freq;
m->v_freq = freq;
return m;
-
-}
-
-
+}
/*
* parse_command_line() - parse the command line and return an
* alloced structure containing the results. On error print usage
* and return NULL.
- */
+ */
-options *parse_command_line (int argc, char *argv[])
+options *
+parse_command_line(int argc, char *argv[])
{
int n;
- options *o = (options *) calloc (1, sizeof (options));
+ options *o = (options *) calloc(1, sizeof(options));
- if (argc < 4) goto bad_option;
+ if (argc < 4)
+ goto bad_option;
- o->x = atoi (argv[1]);
- o->y = atoi (argv[2]);
- o->v_freq = atof (argv[3]);
+ o->x = atoi(argv[1]);
+ o->y = atoi(argv[2]);
+ o->v_freq = atof(argv[3]);
/* XXX should check for errors in the above */
-
+
n = 4;
while (n < argc) {
- if ((strcmp (argv[n], "-v") == 0) ||
- (strcmp (argv[n], "--verbose") == 0)) {
+ if ((strcmp(argv[n], "-v") == 0) || (strcmp(argv[n], "--verbose") == 0)) {
global_verbose = 1;
- } else if ((strcmp (argv[n], "-f") == 0) ||
- (strcmp (argv[n], "--fbmode") == 0)) {
+ }
+ else if ((strcmp(argv[n], "-f") == 0) ||
+ (strcmp(argv[n], "--fbmode") == 0)) {
o->fbmode = 1;
- } else if ((strcmp (argv[n], "-x") == 0) ||
- (strcmp (argv[n], "--xorgmode") == 0) ||
- (strcmp (argv[n], "--xf86mode") == 0)) {
+ }
+ else if ((strcmp(argv[n], "-x") == 0) ||
+ (strcmp(argv[n], "--xorgmode") == 0) ||
+ (strcmp(argv[n], "--xf86mode") == 0)) {
o->xorgmode = 1;
- } else {
+ }
+ else {
goto bad_option;
}
-
+
n++;
}
/* if neither xorgmode nor fbmode were requested, default to
xorgmode */
- if (!o->fbmode && !o->xorgmode) o->xorgmode = 1;
-
+ if (!o->fbmode && !o->xorgmode)
+ o->xorgmode = 1;
+
return o;
-
+
bad_option:
- fprintf (stderr, "\n");
- fprintf (stderr, "usage: %s x y refresh [-v|--verbose] "
- "[-f|--fbmode] [-x|--xorgmode]\n", argv[0]);
-
- fprintf (stderr, "\n");
-
- fprintf (stderr, " x : the desired horizontal "
- "resolution (required)\n");
- fprintf (stderr, " y : the desired vertical "
- "resolution (required)\n");
- fprintf (stderr, " refresh : the desired refresh "
- "rate (required)\n");
- fprintf (stderr, " -v|--verbose : enable verbose printouts "
- "(traces each step of the computation)\n");
- fprintf (stderr, " -f|--fbmode : output an fbset(8)-style mode "
- "description\n");
- fprintf (stderr, " -x|--xorgmode : output an "__XSERVERNAME__"-style mode "
- "description (this is the default\n"
- " if no mode description is requested)\n");
-
- fprintf (stderr, "\n");
-
- free (o);
- return NULL;
+ fprintf(stderr, "\n");
+ fprintf(stderr, "usage: %s x y refresh [-v|--verbose] "
+ "[-f|--fbmode] [-x|--xorgmode]\n", argv[0]);
-}
+ fprintf(stderr, "\n");
+ fprintf(stderr, " x : the desired horizontal "
+ "resolution (required)\n");
+ fprintf(stderr, " y : the desired vertical "
+ "resolution (required)\n");
+ fprintf(stderr, " refresh : the desired refresh " "rate (required)\n");
+ fprintf(stderr, " -v|--verbose : enable verbose printouts "
+ "(traces each step of the computation)\n");
+ fprintf(stderr, " -f|--fbmode : output an fbset(8)-style mode "
+ "description\n");
+ fprintf(stderr, " -x|--xorgmode : output an " __XSERVERNAME__ "-style mode "
+ "description (this is the default\n"
+ " if no mode description is requested)\n");
+ fprintf(stderr, "\n");
-int main (int argc, char *argv[])
+ free(o);
+ return NULL;
+
+}
+
+int
+main(int argc, char *argv[])
{
mode *m;
options *o;
- o = parse_command_line (argc, argv);
- if (!o) exit (1);
-
- m = vert_refresh (o->x, o->y, o->v_freq, 0, 0);
- if (!m) exit (1);
+ o = parse_command_line(argc, argv);
+ if (!o)
+ exit(1);
+
+ m = vert_refresh(o->x, o->y, o->v_freq, 0, 0);
+ if (!m)
+ exit(1);
if (o->xorgmode)
print_xf86_mode(m);
-
+
if (o->fbmode)
print_fb_mode(m);
-
+
return 0;
-
+
}
diff --git a/xorg-server/hw/xfree86/vbe/vbe.c b/xorg-server/hw/xfree86/vbe/vbe.c
index 6ecca6858..bbb60e3a1 100644
--- a/xorg-server/hw/xfree86/vbe/vbe.c
+++ b/xorg-server/hw/xfree86/vbe/vbe.c
@@ -22,7 +22,7 @@
#define VERSION(x) VBE_VERSION_MAJOR(x),VBE_VERSION_MINOR(x)
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
-#define B_O16(x) (x)
+#define B_O16(x) (x)
#define B_O32(x) (x)
#else
#define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8))
@@ -34,7 +34,7 @@
#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff))
#define R16(v) ((v) & 0xffff)
-static unsigned char * vbeReadEDID(vbeInfoPtr pVbe);
+static unsigned char *vbeReadEDID(vbeInfoPtr pVbe);
static Bool vbeProbeDDC(vbeInfoPtr pVbe);
static const char vbeVersionString[] = "VBE2";
@@ -56,85 +56,93 @@ VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags)
vbeInfoPtr vip = NULL;
int screen;
- if (!pScrn) return NULL;
+ if (!pScrn)
+ return NULL;
screen = pScrn->scrnIndex;
-
+
if (!pInt) {
- if (!xf86LoadSubModule(pScrn, "int10"))
- goto error;
-
- xf86DrvMsg(screen,X_INFO,"initializing int10\n");
- pInt = xf86ExtendedInitInt10(entityIndex,Flags);
- if (!pInt)
- goto error;
- init_int10 = TRUE;
+ if (!xf86LoadSubModule(pScrn, "int10"))
+ goto error;
+
+ xf86DrvMsg(screen, X_INFO, "initializing int10\n");
+ pInt = xf86ExtendedInitInt10(entityIndex, Flags);
+ if (!pInt)
+ goto error;
+ init_int10 = TRUE;
}
-
- page = xf86Int10AllocPages(pInt,1,&RealOff);
- if (!page) goto error;
- vbe = (vbeControllerInfoPtr) page;
- memcpy(vbe->VbeSignature,vbeVersionString,4);
+
+ page = xf86Int10AllocPages(pInt, 1, &RealOff);
+ if (!page)
+ goto error;
+ vbe = (vbeControllerInfoPtr) page;
+ memcpy(vbe->VbeSignature, vbeVersionString, 4);
pInt->ax = 0x4F00;
pInt->es = SEG_ADDR(RealOff);
pInt->di = SEG_OFF(RealOff);
pInt->num = 0x10;
-
+
xf86ExecX86int10(pInt);
if ((pInt->ax & 0xff) != 0x4f) {
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA BIOS not detected\n");
- goto error;
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA BIOS not detected\n");
+ goto error;
}
-
+
switch (pInt->ax & 0xff00) {
case 0:
- xf86DrvMsg(screen,X_INFO,"VESA BIOS detected\n");
- break;
+ xf86DrvMsg(screen, X_INFO, "VESA BIOS detected\n");
+ break;
case 0x100:
- xf86DrvMsg(screen,X_INFO,"VESA BIOS function failed\n");
- goto error;
+ xf86DrvMsg(screen, X_INFO, "VESA BIOS function failed\n");
+ goto error;
case 0x200:
- xf86DrvMsg(screen,X_INFO,"VESA BIOS not supported\n");
- goto error;
+ xf86DrvMsg(screen, X_INFO, "VESA BIOS not supported\n");
+ goto error;
case 0x300:
- xf86DrvMsg(screen,X_INFO,"VESA BIOS not supported in current mode\n");
- goto error;
+ xf86DrvMsg(screen, X_INFO, "VESA BIOS not supported in current mode\n");
+ goto error;
default:
- xf86DrvMsg(screen,X_INFO,"Invalid\n");
- goto error;
+ xf86DrvMsg(screen, X_INFO, "Invalid\n");
+ goto error;
}
-
+
xf86DrvMsgVerb(screen, X_INFO, 4,
- "VbeVersion is %d, OemStringPtr is 0x%08lx,\n"
- "\tOemVendorNamePtr is 0x%08lx, OemProductNamePtr is 0x%08lx,\n"
- "\tOemProductRevPtr is 0x%08lx\n",
- vbe->VbeVersion, (unsigned long)vbe->OemStringPtr,
- (unsigned long)vbe->OemVendorNamePtr,
- (unsigned long)vbe->OemProductNamePtr,
- (unsigned long)vbe->OemProductRevPtr);
-
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE Version %i.%i\n",
- VERSION(vbe->VbeVersion));
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE Total Mem: %i kB\n",
- vbe->TotalMem * 64);
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM: %s\n",
- (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemStringPtr)));
-
+ "VbeVersion is %d, OemStringPtr is 0x%08lx,\n"
+ "\tOemVendorNamePtr is 0x%08lx, OemProductNamePtr is 0x%08lx,\n"
+ "\tOemProductRevPtr is 0x%08lx\n",
+ vbe->VbeVersion, (unsigned long) vbe->OemStringPtr,
+ (unsigned long) vbe->OemVendorNamePtr,
+ (unsigned long) vbe->OemProductNamePtr,
+ (unsigned long) vbe->OemProductRevPtr);
+
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE Version %i.%i\n",
+ VERSION(vbe->VbeVersion));
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE Total Mem: %i kB\n",
+ vbe->TotalMem * 64);
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM: %s\n",
+ (CARD8 *) xf86int10Addr(pInt, L_ADD(vbe->OemStringPtr)));
+
if (B_O16(vbe->VbeVersion) >= 0x200) {
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Software Rev: %i.%i\n",
- VERSION(vbe->OemSoftwareRev));
- if (vbe->OemVendorNamePtr)
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Vendor: %s\n",
- (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemVendorNamePtr)));
- if (vbe->OemProductNamePtr)
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Product: %s\n",
- (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemProductNamePtr)));
- if (vbe->OemProductRevPtr)
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Product Rev: %s\n",
- (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemProductRevPtr)));
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Software Rev: %i.%i\n",
+ VERSION(vbe->OemSoftwareRev));
+ if (vbe->OemVendorNamePtr)
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Vendor: %s\n",
+ (CARD8 *) xf86int10Addr(pInt,
+ L_ADD(vbe->
+ OemVendorNamePtr)));
+ if (vbe->OemProductNamePtr)
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Product: %s\n",
+ (CARD8 *) xf86int10Addr(pInt,
+ L_ADD(vbe->
+ OemProductNamePtr)));
+ if (vbe->OemProductRevPtr)
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Product Rev: %s\n",
+ (CARD8 *) xf86int10Addr(pInt,
+ L_ADD(vbe->
+ OemProductRevPtr)));
}
- vip = (vbeInfoPtr)xnfalloc(sizeof(vbeInfoRec));
+ vip = (vbeInfoPtr) xnfalloc(sizeof(vbeInfoRec));
vip->version = B_O16(vbe->VbeVersion);
vip->pInt10 = pInt;
vip->ddc = DDC_UNCHECKED;
@@ -147,9 +155,9 @@ VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags)
error:
if (page)
- xf86Int10FreePages(pInt, page, 1);
+ xf86Int10FreePages(pInt, page, 1);
if (init_int10)
- xf86FreeInt10(pInt);
+ xf86FreeInt10(pInt);
return NULL;
}
@@ -157,12 +165,12 @@ void
vbeFree(vbeInfoPtr pVbe)
{
if (!pVbe)
- return;
+ return;
- xf86Int10FreePages(pVbe->pInt10,pVbe->memory,pVbe->num_pages);
+ xf86Int10FreePages(pVbe->pInt10, pVbe->memory, pVbe->num_pages);
/* If we have initalized int10 we ought to free it, too */
- if (pVbe->init_int10)
- xf86FreeInt10(pVbe->pInt10);
+ if (pVbe->init_int10)
+ xf86FreeInt10(pVbe->pInt10);
free(pVbe);
return;
}
@@ -172,11 +180,11 @@ vbeProbeDDC(vbeInfoPtr pVbe)
{
const char *ddc_level;
int screen = pVbe->pInt10->scrnIndex;
-
+
if (pVbe->ddc == DDC_NONE)
- return FALSE;
+ return FALSE;
if (pVbe->ddc != DDC_UNCHECKED)
- return TRUE;
+ return TRUE;
pVbe->pInt10->ax = 0x4F15;
pVbe->pInt10->bx = 0;
@@ -188,61 +196,62 @@ vbeProbeDDC(vbeInfoPtr pVbe)
xf86ExecX86int10(pVbe->pInt10);
if ((pVbe->pInt10->ax & 0xff) != 0x4f) {
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC not supported\n");
- pVbe->ddc = DDC_NONE;
- return FALSE;
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC not supported\n");
+ pVbe->ddc = DDC_NONE;
+ return FALSE;
}
switch ((pVbe->pInt10->ax >> 8) & 0xff) {
case 0:
- xf86DrvMsg(screen,X_INFO,"VESA VBE DDC supported\n");
- switch (pVbe->pInt10->bx & 0x3) {
- case 0:
- ddc_level = " none";
- pVbe->ddc = DDC_NONE;
- break;
- case 1:
- ddc_level = " 1";
- pVbe->ddc = DDC_1;
- break;
- case 2:
- ddc_level = " 2";
- pVbe->ddc = DDC_2;
- break;
- case 3:
- ddc_level = " 1 + 2";
- pVbe->ddc = DDC_1_2;
- break;
- default:
- ddc_level = "";
- pVbe->ddc = DDC_NONE;
- break;
- }
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Level%s\n",ddc_level);
- if (pVbe->pInt10->bx & 0x4) {
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Screen blanked"
- "for data transfer\n");
- pVbe->ddc_blank = TRUE;
- } else
- pVbe->ddc_blank = FALSE;
-
- xf86DrvMsgVerb(screen,X_INFO,3,
- "VESA VBE DDC transfer in appr. %x sec.\n",
- (pVbe->pInt10->bx >> 8) & 0xff);
+ xf86DrvMsg(screen, X_INFO, "VESA VBE DDC supported\n");
+ switch (pVbe->pInt10->bx & 0x3) {
+ case 0:
+ ddc_level = " none";
+ pVbe->ddc = DDC_NONE;
+ break;
+ case 1:
+ ddc_level = " 1";
+ pVbe->ddc = DDC_1;
+ break;
+ case 2:
+ ddc_level = " 2";
+ pVbe->ddc = DDC_2;
+ break;
+ case 3:
+ ddc_level = " 1 + 2";
+ pVbe->ddc = DDC_1_2;
+ break;
+ default:
+ ddc_level = "";
+ pVbe->ddc = DDC_NONE;
+ break;
+ }
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC Level%s\n", ddc_level);
+ if (pVbe->pInt10->bx & 0x4) {
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC Screen blanked"
+ "for data transfer\n");
+ pVbe->ddc_blank = TRUE;
+ }
+ else
+ pVbe->ddc_blank = FALSE;
+
+ xf86DrvMsgVerb(screen, X_INFO, 3,
+ "VESA VBE DDC transfer in appr. %x sec.\n",
+ (pVbe->pInt10->bx >> 8) & 0xff);
}
-
- return TRUE;
+
+ return TRUE;
}
typedef enum {
- VBEOPT_NOVBE,
+ VBEOPT_NOVBE,
VBEOPT_NODDC
} VBEOpts;
static const OptionInfoRec VBEOptions[] = {
- { VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE },
- { VBEOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE },
+ {VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE},
+ {VBEOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE},
};
static unsigned char *
@@ -256,20 +265,23 @@ vbeReadEDID(vbeInfoPtr pVbe)
int screen = pVbe->pInt10->scrnIndex;
OptionInfoPtr options;
- if (!page) return NULL;
+ if (!page)
+ return NULL;
options = xnfalloc(sizeof(VBEOptions));
- (void)memcpy(options, VBEOptions, sizeof(VBEOptions));
+ (void) memcpy(options, VBEOptions, sizeof(VBEOptions));
xf86ProcessOptions(screen, xf86Screens[screen]->options, options);
xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe);
xf86GetOptValBool(options, VBEOPT_NODDC, &noddc);
free(options);
- if (novbe || noddc) return NULL;
-
- if (!vbeProbeDDC(pVbe)) goto error;
+ if (novbe || noddc)
+ return NULL;
- memset(page,0,sizeof(vbeInfoPtr));
- strcpy(page,vbeVersionString);
+ if (!vbeProbeDDC(pVbe))
+ goto error;
+
+ memset(page, 0, sizeof(vbeInfoPtr));
+ strcpy(page, vbeVersionString);
pVbe->pInt10->ax = 0x4F15;
pVbe->pInt10->bx = 0x01;
@@ -282,24 +294,24 @@ vbeReadEDID(vbeInfoPtr pVbe)
xf86ExecX86int10(pVbe->pInt10);
if ((pVbe->pInt10->ax & 0xff) != 0x4f) {
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC invalid\n");
- goto error;
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC invalid\n");
+ goto error;
}
switch (pVbe->pInt10->ax & 0xff00) {
case 0x0:
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC read successfully\n");
- tmp = (unsigned char *)xnfalloc(128);
- memcpy(tmp,page,128);
- break;
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC read successfully\n");
+ tmp = (unsigned char *) xnfalloc(128);
+ memcpy(tmp, page, 128);
+ break;
case 0x100:
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC read failed\n");
- break;
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC read failed\n");
+ break;
default:
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC unkown failure %i\n",
- pVbe->pInt10->ax & 0xff00);
- break;
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC unkown failure %i\n",
+ pVbe->pInt10->ax & 0xff00);
+ break;
}
-
+
error:
return tmp;
}
@@ -307,26 +319,27 @@ vbeReadEDID(vbeInfoPtr pVbe)
xf86MonPtr
vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule)
{
- xf86MonPtr pMonitor;
- pointer pModule;
+ xf86MonPtr pMonitor;
+ pointer pModule;
unsigned char *DDC_data = NULL;
-
- if (!pVbe) return NULL;
+
+ if (!pVbe)
+ return NULL;
if (pVbe->version < 0x200)
- return NULL;
+ return NULL;
if (!(pModule = pDDCModule)) {
- pModule =
- xf86LoadSubModule(xf86Screens[pVbe->pInt10->scrnIndex], "ddc");
- if (!pModule)
- return NULL;
+ pModule =
+ xf86LoadSubModule(xf86Screens[pVbe->pInt10->scrnIndex], "ddc");
+ if (!pModule)
+ return NULL;
}
-
+
DDC_data = vbeReadEDID(pVbe);
- if (!DDC_data)
- return NULL;
-
+ if (!DDC_data)
+ return NULL;
+
pMonitor = xf86InterpretEDID(pVbe->pInt10->scrnIndex, DDC_data);
if (!pDDCModule)
@@ -348,20 +361,20 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
memset(pVbe->memory, 0, sizeof(VbeInfoBlock));
/*
- Input:
- AH := 4Fh Super VGA support
- AL := 00h Return Super VGA information
- ES:DI := Pointer to buffer
-
- Output:
- AX := status
- (All other registers are preserved)
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 00h Return Super VGA information
+ ES:DI := Pointer to buffer
+
+ Output:
+ AX := status
+ (All other registers are preserved)
*/
- ((char*)pVbe->memory)[0] = 'V';
- ((char*)pVbe->memory)[1] = 'B';
- ((char*)pVbe->memory)[2] = 'E';
- ((char*)pVbe->memory)[3] = '2';
+ ((char *) pVbe->memory)[0] = 'V';
+ ((char *) pVbe->memory)[1] = 'B';
+ ((char *) pVbe->memory)[2] = 'E';
+ ((char *) pVbe->memory)[3] = '2';
pVbe->pInt10->num = 0x10;
pVbe->pInt10->ax = 0x4f00;
@@ -370,102 +383,103 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) != 0x4f)
- return NULL;
+ return NULL;
block = calloc(sizeof(VbeInfoBlock), 1);
- block->VESASignature[0] = ((char*)pVbe->memory)[0];
- block->VESASignature[1] = ((char*)pVbe->memory)[1];
- block->VESASignature[2] = ((char*)pVbe->memory)[2];
- block->VESASignature[3] = ((char*)pVbe->memory)[3];
+ block->VESASignature[0] = ((char *) pVbe->memory)[0];
+ block->VESASignature[1] = ((char *) pVbe->memory)[1];
+ block->VESASignature[2] = ((char *) pVbe->memory)[2];
+ block->VESASignature[3] = ((char *) pVbe->memory)[3];
- block->VESAVersion = *(CARD16*)(((char*)pVbe->memory) + 4);
- major = (unsigned)block->VESAVersion >> 8;
+ block->VESAVersion = *(CARD16 *) (((char *) pVbe->memory) + 4);
+ major = (unsigned) block->VESAVersion >> 8;
- pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 6));
+ pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 6));
str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
block->OEMStringPtr = strdup(str);
- block->Capabilities[0] = ((char*)pVbe->memory)[10];
- block->Capabilities[1] = ((char*)pVbe->memory)[11];
- block->Capabilities[2] = ((char*)pVbe->memory)[12];
- block->Capabilities[3] = ((char*)pVbe->memory)[13];
+ block->Capabilities[0] = ((char *) pVbe->memory)[10];
+ block->Capabilities[1] = ((char *) pVbe->memory)[11];
+ block->Capabilities[2] = ((char *) pVbe->memory)[12];
+ block->Capabilities[3] = ((char *) pVbe->memory)[13];
- pModes = GET_UNALIGNED2((((char*)pVbe->memory) + 14));
+ pModes = GET_UNALIGNED2((((char *) pVbe->memory) + 14));
modes = xf86int10Addr(pVbe->pInt10, FARP(pModes));
i = 0;
while (modes[i] != 0xffff)
- i++;
+ i++;
block->VideoModePtr = malloc(sizeof(CARD16) * (i + 1));
memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i);
block->VideoModePtr[i] = 0xffff;
- block->TotalMemory = *(CARD16*)(((char*)pVbe->memory) + 18);
+ block->TotalMemory = *(CARD16 *) (((char *) pVbe->memory) + 18);
if (major < 2)
- memcpy(&block->OemSoftwareRev, ((char*)pVbe->memory) + 20, 236);
+ memcpy(&block->OemSoftwareRev, ((char *) pVbe->memory) + 20, 236);
else {
- block->OemSoftwareRev = *(CARD16*)(((char*)pVbe->memory) + 20);
- pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 22));
- str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
- block->OemVendorNamePtr = strdup(str);
- pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 26));
- str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
- block->OemProductNamePtr = strdup(str);
- pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 30));
- str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
- block->OemProductRevPtr = strdup(str);
- memcpy(&block->Reserved, ((char*)pVbe->memory) + 34, 222);
- memcpy(&block->OemData, ((char*)pVbe->memory) + 256, 256);
+ block->OemSoftwareRev = *(CARD16 *) (((char *) pVbe->memory) + 20);
+ pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 22));
+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
+ block->OemVendorNamePtr = strdup(str);
+ pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 26));
+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
+ block->OemProductNamePtr = strdup(str);
+ pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 30));
+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
+ block->OemProductRevPtr = strdup(str);
+ memcpy(&block->Reserved, ((char *) pVbe->memory) + 34, 222);
+ memcpy(&block->OemData, ((char *) pVbe->memory) + 256, 256);
}
return block;
}
void
-VBEFreeVBEInfo(VbeInfoBlock *block)
+VBEFreeVBEInfo(VbeInfoBlock * block)
{
free(block->OEMStringPtr);
free(block->VideoModePtr);
- if (((unsigned)block->VESAVersion >> 8) >= 2) {
- free(block->OemVendorNamePtr);
- free(block->OemProductNamePtr);
- free(block->OemProductRevPtr);
+ if (((unsigned) block->VESAVersion >> 8) >= 2) {
+ free(block->OemVendorNamePtr);
+ free(block->OemProductNamePtr);
+ free(block->OemProductRevPtr);
}
free(block);
}
Bool
-VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *block)
+VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock * block)
{
/*
- Input:
- AH := 4Fh Super VGA support
- AL := 02h Set Super VGA video mode
- BX := Video mode
- D0-D8 := Mode number
- D9-D10 := Reserved (must be 0)
- D11 := 0 Use current default refresh rate
- := 1 Use user specified CRTC values for refresh rate
- D12-13 Reserved for VBE/AF (must be 0)
- D14 := 0 Use windowed frame buffer model
- := 1 Use linear/flat frame buffer model
- D15 := 0 Clear video memory
- := 1 Don't clear video memory
- ES:DI := Pointer to VbeCRTCInfoBlock structure
-
- Output: AX = Status
- (All other registers are preserved)
- */
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 02h Set Super VGA video mode
+ BX := Video mode
+ D0-D8 := Mode number
+ D9-D10 := Reserved (must be 0)
+ D11 := 0 Use current default refresh rate
+ := 1 Use user specified CRTC values for refresh rate
+ D12-13 Reserved for VBE/AF (must be 0)
+ D14 := 0 Use windowed frame buffer model
+ := 1 Use linear/flat frame buffer model
+ D15 := 0 Clear video memory
+ := 1 Don't clear video memory
+ ES:DI := Pointer to VbeCRTCInfoBlock structure
+
+ Output: AX = Status
+ (All other registers are preserved)
+ */
pVbe->pInt10->num = 0x10;
pVbe->pInt10->ax = 0x4f02;
pVbe->pInt10->bx = mode;
if (block) {
- pVbe->pInt10->bx |= 1 << 11;
- memcpy(pVbe->memory, block, sizeof(VbeCRTCInfoBlock));
- pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base);
- pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base);
- } else
- pVbe->pInt10->bx &= ~(1 << 11);
+ pVbe->pInt10->bx |= 1 << 11;
+ memcpy(pVbe->memory, block, sizeof(VbeCRTCInfoBlock));
+ pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base);
+ pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base);
+ }
+ else
+ pVbe->pInt10->bx &= ~(1 << 11);
xf86ExecX86int10(pVbe->pInt10);
@@ -476,24 +490,24 @@ Bool
VBEGetVBEMode(vbeInfoPtr pVbe, int *mode)
{
/*
- Input:
- AH := 4Fh Super VGA support
- AL := 03h Return current video mode
-
- Output:
- AX := Status
- BX := Current video mode
- (All other registers are preserved)
- */
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 03h Return current video mode
+
+ Output:
+ AX := Status
+ BX := Current video mode
+ (All other registers are preserved)
+ */
pVbe->pInt10->num = 0x10;
pVbe->pInt10->ax = 0x4f03;
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) == 0x4f) {
- *mode = R16(pVbe->pInt10->bx);
+ *mode = R16(pVbe->pInt10->bx);
- return TRUE;
+ return TRUE;
}
return FALSE;
@@ -507,16 +521,16 @@ VBEGetModeInfo(vbeInfoPtr pVbe, int mode)
memset(pVbe->memory, 0, sizeof(VbeModeInfoBlock));
/*
- Input:
- AH := 4Fh Super VGA support
- AL := 01h Return Super VGA mode information
- CX := Super VGA video mode
- (mode number must be one of those returned by Function 0)
- ES:DI := Pointer to buffer
-
- Output:
- AX := status
- (All other registers are preserved)
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 01h Return Super VGA mode information
+ CX := Super VGA video mode
+ (mode number must be one of those returned by Function 0)
+ ES:DI := Pointer to buffer
+
+ Output:
+ AX := status
+ (All other registers are preserved)
*/
pVbe->pInt10->num = 0x10;
pVbe->pInt10->ax = 0x4f01;
@@ -525,116 +539,116 @@ VBEGetModeInfo(vbeInfoPtr pVbe, int mode)
pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base);
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) != 0x4f)
- return NULL;
+ return NULL;
block = malloc(sizeof(VbeModeInfoBlock));
if (block)
- memcpy(block, pVbe->memory, sizeof(*block));
+ memcpy(block, pVbe->memory, sizeof(*block));
return block;
}
void
-VBEFreeModeInfo(VbeModeInfoBlock *block)
+VBEFreeModeInfo(VbeModeInfoBlock * block)
{
free(block);
}
Bool
-VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function,
- pointer *memory, int *size, int *real_mode_pages)
+VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function,
+ pointer *memory, int *size, int *real_mode_pages)
{
/*
- Input:
- AH := 4Fh Super VGA support
- AL := 04h Save/restore Super VGA video state
- DL := 00h Return save/restore state buffer size
- CX := Requested states
- D0 = Save/restore video hardware state
- D1 = Save/restore video BIOS data state
- D2 = Save/restore video DAC state
- D3 = Save/restore Super VGA state
-
- Output:
- AX = Status
- BX = Number of 64-byte blocks to hold the state buffer
- (All other registers are preserved)
-
-
- Input:
- AH := 4Fh Super VGA support
- AL := 04h Save/restore Super VGA video state
- DL := 01h Save Super VGA video state
- CX := Requested states (see above)
- ES:BX := Pointer to buffer
-
- Output:
- AX := Status
- (All other registers are preserved)
-
-
- Input:
- AH := 4Fh Super VGA support
- AL := 04h Save/restore Super VGA video state
- DL := 02h Restore Super VGA video state
- CX := Requested states (see above)
- ES:BX := Pointer to buffer
-
- Output:
- AX := Status
- (All other registers are preserved)
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 04h Save/restore Super VGA video state
+ DL := 00h Return save/restore state buffer size
+ CX := Requested states
+ D0 = Save/restore video hardware state
+ D1 = Save/restore video BIOS data state
+ D2 = Save/restore video DAC state
+ D3 = Save/restore Super VGA state
+
+ Output:
+ AX = Status
+ BX = Number of 64-byte blocks to hold the state buffer
+ (All other registers are preserved)
+
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 04h Save/restore Super VGA video state
+ DL := 01h Save Super VGA video state
+ CX := Requested states (see above)
+ ES:BX := Pointer to buffer
+
+ Output:
+ AX := Status
+ (All other registers are preserved)
+
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 04h Save/restore Super VGA video state
+ DL := 02h Restore Super VGA video state
+ CX := Requested states (see above)
+ ES:BX := Pointer to buffer
+
+ Output:
+ AX := Status
+ (All other registers are preserved)
*/
if ((pVbe->version & 0xff00) > 0x100) {
int screen = pVbe->pInt10->scrnIndex;
- if (function == MODE_QUERY ||
- (function == MODE_SAVE && !*memory)) {
- /* Query amount of memory to save state */
-
- pVbe->pInt10->num = 0x10;
- pVbe->pInt10->ax = 0x4f04;
- pVbe->pInt10->dx = 0;
- pVbe->pInt10->cx = 0x000f;
- xf86ExecX86int10(pVbe->pInt10);
- if (R16(pVbe->pInt10->ax) != 0x4f)
- return FALSE;
-
- if (function == MODE_SAVE) {
- int npages = (R16(pVbe->pInt10->bx) * 64) / 4096 + 1;
- if ((*memory = xf86Int10AllocPages(pVbe->pInt10, npages,
- real_mode_pages)) == NULL) {
- xf86DrvMsg(screen, X_ERROR,
- "Cannot allocate memory to save SVGA state.\n");
- return FALSE;
- }
- }
- *size = pVbe->pInt10->bx * 64;
- }
-
- /* Save/Restore Super VGA state */
- if (function != MODE_QUERY) {
-
- if (!*memory) return FALSE;
- pVbe->pInt10->num = 0x10;
- pVbe->pInt10->ax = 0x4f04;
- switch (function) {
- case MODE_SAVE:
- pVbe->pInt10->dx = 1;
- break;
- case MODE_RESTORE:
- pVbe->pInt10->dx = 2;
- break;
- case MODE_QUERY:
- return FALSE;
- }
- pVbe->pInt10->cx = 0x000f;
-
- pVbe->pInt10->es = SEG_ADDR(*real_mode_pages);
- pVbe->pInt10->bx = SEG_OFF(*real_mode_pages);
- xf86ExecX86int10(pVbe->pInt10);
- return (R16(pVbe->pInt10->ax) == 0x4f);
-
- }
+
+ if (function == MODE_QUERY || (function == MODE_SAVE && !*memory)) {
+ /* Query amount of memory to save state */
+
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f04;
+ pVbe->pInt10->dx = 0;
+ pVbe->pInt10->cx = 0x000f;
+ xf86ExecX86int10(pVbe->pInt10);
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return FALSE;
+
+ if (function == MODE_SAVE) {
+ int npages = (R16(pVbe->pInt10->bx) * 64) / 4096 + 1;
+
+ if ((*memory = xf86Int10AllocPages(pVbe->pInt10, npages,
+ real_mode_pages)) == NULL) {
+ xf86DrvMsg(screen, X_ERROR,
+ "Cannot allocate memory to save SVGA state.\n");
+ return FALSE;
+ }
+ }
+ *size = pVbe->pInt10->bx * 64;
+ }
+
+ /* Save/Restore Super VGA state */
+ if (function != MODE_QUERY) {
+
+ if (!*memory)
+ return FALSE;
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f04;
+ switch (function) {
+ case MODE_SAVE:
+ pVbe->pInt10->dx = 1;
+ break;
+ case MODE_RESTORE:
+ pVbe->pInt10->dx = 2;
+ break;
+ case MODE_QUERY:
+ return FALSE;
+ }
+ pVbe->pInt10->cx = 0x000f;
+
+ pVbe->pInt10->es = SEG_ADDR(*real_mode_pages);
+ pVbe->pInt10->bx = SEG_OFF(*real_mode_pages);
+ xf86ExecX86int10(pVbe->pInt10);
+ return (R16(pVbe->pInt10->ax) == 0x4f);
+
+ }
}
return TRUE;
}
@@ -643,11 +657,11 @@ Bool
VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window)
{
/*
- Input:
- AH := 4Fh Super VGA support
- AL := 05h
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 05h
- Output:
+ Output:
*/
pVbe->pInt10->num = 0x10;
pVbe->pInt10->ax = 0x4f05;
@@ -656,54 +670,54 @@ VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window)
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) != 0x4f)
- return FALSE;
+ return FALSE;
return TRUE;
}
Bool
VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command,
- int width, int *pixels, int *bytes, int *max)
+ int width, int *pixels, int *bytes, int *max)
{
if (command < SCANWID_SET || command > SCANWID_GET_MAX)
- return FALSE;
+ return FALSE;
/*
- Input:
- AX := 4F06h VBE Set/Get Logical Scan Line Length
- BL := 00h Set Scan Line Length in Pixels
- := 01h Get Scan Line Length
- := 02h Set Scan Line Length in Bytes
- := 03h Get Maximum Scan Line Length
- CX := If BL=00h Desired Width in Pixels
- If BL=02h Desired Width in Bytes
- (Ignored for Get Functions)
-
- Output:
- AX := VBE Return Status
- BX := Bytes Per Scan Line
- CX := Actual Pixels Per Scan Line
- (truncated to nearest complete pixel)
- DX := Maximum Number of Scan Lines
+ Input:
+ AX := 4F06h VBE Set/Get Logical Scan Line Length
+ BL := 00h Set Scan Line Length in Pixels
+ := 01h Get Scan Line Length
+ := 02h Set Scan Line Length in Bytes
+ := 03h Get Maximum Scan Line Length
+ CX := If BL=00h Desired Width in Pixels
+ If BL=02h Desired Width in Bytes
+ (Ignored for Get Functions)
+
+ Output:
+ AX := VBE Return Status
+ BX := Bytes Per Scan Line
+ CX := Actual Pixels Per Scan Line
+ (truncated to nearest complete pixel)
+ DX := Maximum Number of Scan Lines
*/
pVbe->pInt10->num = 0x10;
pVbe->pInt10->ax = 0x4f06;
pVbe->pInt10->bx = command;
if (command == SCANWID_SET || command == SCANWID_SET_BYTES)
- pVbe->pInt10->cx = width;
+ pVbe->pInt10->cx = width;
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) != 0x4f)
- return FALSE;
+ return FALSE;
if (command == SCANWID_GET || command == SCANWID_GET_MAX) {
- if (pixels)
- *pixels = R16(pVbe->pInt10->cx);
- if (bytes)
- *bytes = R16(pVbe->pInt10->bx);
- if (max)
- *max = R16(pVbe->pInt10->dx);
+ if (pixels)
+ *pixels = R16(pVbe->pInt10->cx);
+ if (bytes)
+ *bytes = R16(pVbe->pInt10->bx);
+ if (max)
+ *max = R16(pVbe->pInt10->dx);
}
return TRUE;
@@ -720,7 +734,7 @@ VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace)
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) != 0x4f)
- return FALSE;
+ return FALSE;
return TRUE;
}
@@ -734,7 +748,7 @@ VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y)
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) != 0x4f)
- return FALSE;
+ return FALSE;
*x = pVbe->pInt10->cx;
*y = pVbe->pInt10->dx;
@@ -746,82 +760,81 @@ int
VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits)
{
/*
- Input:
- AX := 4F08h VBE Set/Get Palette Format
- BL := 00h Set DAC Palette Format
- := 01h Get DAC Palette Format
- BH := Desired bits of color per primary
- (Set DAC Palette Format only)
-
- Output:
- AX := VBE Return Status
- BH := Current number of bits of color per primary
+ Input:
+ AX := 4F08h VBE Set/Get Palette Format
+ BL := 00h Set DAC Palette Format
+ := 01h Get DAC Palette Format
+ BH := Desired bits of color per primary
+ (Set DAC Palette Format only)
+
+ Output:
+ AX := VBE Return Status
+ BH := Current number of bits of color per primary
*/
pVbe->pInt10->num = 0x10;
pVbe->pInt10->ax = 0x4f08;
if (!bits)
- pVbe->pInt10->bx = 0x01;
- else
- pVbe->pInt10->bx = (bits & 0x00ff) << 8;
+ pVbe->pInt10->bx = 0x01;
+ else
+ pVbe->pInt10->bx = (bits & 0x00ff) << 8;
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) != 0x4f)
- return 0;
+ return 0;
return (bits != 0 ? bits : (pVbe->pInt10->bx >> 8) & 0x00ff);
}
CARD32 *
VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num,
- CARD32 *data, Bool secondary, Bool wait_retrace)
+ CARD32 *data, Bool secondary, Bool wait_retrace)
{
/*
- Input:
- (16-bit)
- AX := 4F09h VBE Load/Unload Palette Data
- BL := 00h Set Palette Data
- := 01h Get Palette Data
- := 02h Set Secondary Palette Data
- := 03h Get Secondary Palette Data
- := 80h Set Palette Data during Vertical Retrace
- CX := Number of palette registers to update (to a maximum of 256)
- DX := First of the palette registers to update (start)
- ES:DI := Table of palette values (see below for format)
-
- Output:
- AX := VBE Return Status
-
-
- Input:
- (32-bit)
- BL := 00h Set Palette Data
- := 80h Set Palette Data during Vertical Retrace
- CX := Number of palette registers to update (to a maximum of 256)
- DX := First of the palette registers to update (start)
- ES:EDI := Table of palette values (see below for format)
- DS := Selector for memory mapped registers
+ Input:
+ (16-bit)
+ AX := 4F09h VBE Load/Unload Palette Data
+ BL := 00h Set Palette Data
+ := 01h Get Palette Data
+ := 02h Set Secondary Palette Data
+ := 03h Get Secondary Palette Data
+ := 80h Set Palette Data during Vertical Retrace
+ CX := Number of palette registers to update (to a maximum of 256)
+ DX := First of the palette registers to update (start)
+ ES:DI := Table of palette values (see below for format)
+
+ Output:
+ AX := VBE Return Status
+
+ Input:
+ (32-bit)
+ BL := 00h Set Palette Data
+ := 80h Set Palette Data during Vertical Retrace
+ CX := Number of palette registers to update (to a maximum of 256)
+ DX := First of the palette registers to update (start)
+ ES:EDI := Table of palette values (see below for format)
+ DS := Selector for memory mapped registers
*/
pVbe->pInt10->num = 0x10;
pVbe->pInt10->ax = 0x4f09;
if (!secondary)
- pVbe->pInt10->bx = set && wait_retrace ? 0x80 : set ? 0 : 1;
+ pVbe->pInt10->bx = set && wait_retrace ? 0x80 : set ? 0 : 1;
else
- pVbe->pInt10->bx = set ? 2 : 3;
+ pVbe->pInt10->bx = set ? 2 : 3;
pVbe->pInt10->cx = num;
pVbe->pInt10->dx = first;
pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base);
pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base);
if (set)
- memcpy(pVbe->memory, data, num * sizeof(CARD32));
+ memcpy(pVbe->memory, data, num * sizeof(CARD32));
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) != 0x4f)
- return NULL;
+ return NULL;
if (set)
- return data;
+ return data;
data = malloc(num * sizeof(CARD32));
memcpy(data, pVbe->memory, num * sizeof(CARD32));
@@ -835,17 +848,17 @@ VBEGetVBEpmi(vbeInfoPtr pVbe)
VBEpmi *pmi;
/*
- Input:
- AH := 4Fh Super VGA support
- AL := 0Ah Protected Mode Interface
- BL := 00h Return Protected Mode Table
-
- Output:
- AX := Status
- ES := Real Mode Segment of Table
- DI := Offset of Table
- CX := Lenght of Table including protected mode code in bytes (for copying purposes)
- (All other registers are preserved)
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 0Ah Protected Mode Interface
+ BL := 00h Return Protected Mode Table
+
+ Output:
+ AX := Status
+ ES := Real Mode Segment of Table
+ DI := Offset of Table
+ CX := Lenght of Table including protected mode code in bytes (for copying purposes)
+ (All other registers are preserved)
*/
pVbe->pInt10->num = 0x10;
@@ -855,7 +868,7 @@ VBEGetVBEpmi(vbeInfoPtr pVbe)
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) != 0x4f)
- return NULL;
+ return NULL;
pmi = malloc(sizeof(VBEpmi));
pmi->seg_tbl = R16(pVbe->pInt10->es);
@@ -867,49 +880,49 @@ VBEGetVBEpmi(vbeInfoPtr pVbe)
#if 0
vbeModeInfoPtr
-VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock *vbe)
+VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock * vbe)
{
vbeModeInfoPtr ModeList = NULL;
int i = 0;
+
while (vbe->VideoModePtr[i] != 0xffff) {
- vbeModeInfoPtr m;
- VbeModeInfoBlock *mode;
- int id = vbe->VideoModePtr[i++];
- int bpp;
+ vbeModeInfoPtr m;
+ VbeModeInfoBlock *mode;
+ int id = vbe->VideoModePtr[i++];
+ int bpp;
- if ((mode = VBEGetModeInfo(pVbe, id)) == NULL)
- continue;
+ if ((mode = VBEGetModeInfo(pVbe, id)) == NULL)
+ continue;
- bpp = mode->BitsPerPixel;
+ bpp = mode->BitsPerPixel;
- m = xnfcalloc(sizeof(vbeModeInfoRec),1);
- m->width = mode->XResolution;
- m->height = mode->YResolution;
- m->bpp = bpp;
- m->n = id;
- m->next = ModeList;
+ m = xnfcalloc(sizeof(vbeModeInfoRec), 1);
+ m->width = mode->XResolution;
+ m->height = mode->YResolution;
+ m->bpp = bpp;
+ m->n = id;
+ m->next = ModeList;
- xf86DrvMsgVerb(pVbe->pInt10->scrnIndex, X_PROBED, 3,
- "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n",
- m->n, m->width, m->height, m->bpp);
+ xf86DrvMsgVerb(pVbe->pInt10->scrnIndex, X_PROBED, 3,
+ "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n",
+ m->n, m->width, m->height, m->bpp);
- ModeList = m;
+ ModeList = m;
- VBEFreeModeInfo(mode);
+ VBEFreeModeInfo(mode);
}
return ModeList;
}
-unsigned short
+unsigned short
VBECalcVbeModeIndex(vbeModeInfoPtr m, DisplayModePtr mode, int bpp)
{
while (m) {
- if (bpp == m->bpp
- && mode->HDisplay == m->width
- && mode->VDisplay == m->height)
- return m->n;
- m = m->next;
+ if (bpp == m->bpp
+ && mode->HDisplay == m->width && mode->VDisplay == m->height)
+ return m->n;
+ m = m->next;
}
return 0;
}
@@ -917,37 +930,37 @@ VBECalcVbeModeIndex(vbeModeInfoPtr m, DisplayModePtr mode, int bpp)
void
VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr,
- vbeSaveRestoreFunction function)
+ vbeSaveRestoreFunction function)
{
Bool SaveSucc = FALSE;
if (VBE_VERSION_MAJOR(pVbe->version) > 1
- && (function == MODE_SAVE || vbe_sr->pstate)) {
- if (function == MODE_RESTORE)
- memcpy(vbe_sr->state, vbe_sr->pstate, vbe_sr->stateSize);
- ErrorF("VBESaveRestore\n");
- if ((VBESaveRestore(pVbe,function,
- (pointer)&vbe_sr->state,
- &vbe_sr->stateSize,&vbe_sr->statePage))) {
- if (function == MODE_SAVE) {
- SaveSucc = TRUE;
- vbe_sr->stateMode = -1; /* invalidate */
- /* don't rely on the memory not being touched */
- if (vbe_sr->pstate == NULL)
- vbe_sr->pstate = malloc(vbe_sr->stateSize);
- memcpy(vbe_sr->pstate, vbe_sr->state, vbe_sr->stateSize);
- }
- ErrorF("VBESaveRestore done with success\n");
- return;
- }
- ErrorF("VBESaveRestore done\n");
- }
-
+ && (function == MODE_SAVE || vbe_sr->pstate)) {
+ if (function == MODE_RESTORE)
+ memcpy(vbe_sr->state, vbe_sr->pstate, vbe_sr->stateSize);
+ ErrorF("VBESaveRestore\n");
+ if ((VBESaveRestore(pVbe, function,
+ (pointer) &vbe_sr->state,
+ &vbe_sr->stateSize, &vbe_sr->statePage))) {
+ if (function == MODE_SAVE) {
+ SaveSucc = TRUE;
+ vbe_sr->stateMode = -1; /* invalidate */
+ /* don't rely on the memory not being touched */
+ if (vbe_sr->pstate == NULL)
+ vbe_sr->pstate = malloc(vbe_sr->stateSize);
+ memcpy(vbe_sr->pstate, vbe_sr->state, vbe_sr->stateSize);
+ }
+ ErrorF("VBESaveRestore done with success\n");
+ return;
+ }
+ ErrorF("VBESaveRestore done\n");
+ }
+
if (function == MODE_SAVE && !SaveSucc)
- (void)VBEGetVBEMode(pVbe, &vbe_sr->stateMode);
-
+ (void) VBEGetVBEMode(pVbe, &vbe_sr->stateMode);
+
if (function == MODE_RESTORE && vbe_sr->stateMode != -1)
- VBESetVBEMode(pVbe, vbe_sr->stateMode, NULL);
+ VBESetVBEMode(pVbe, vbe_sr->stateMode, NULL);
}
@@ -955,15 +968,15 @@ int
VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int clock)
{
/*
- Input:
- AX := 4F0Bh VBE Get Pixel Clock
- BL := 00h Get Pixel Clock
- ECX := pixel clock in units of Hz
- DX := mode number
-
- Output:
- AX := VBE Return Status
- ECX := Closest pixel clock
+ Input:
+ AX := 4F0Bh VBE Get Pixel Clock
+ BL := 00h Get Pixel Clock
+ ECX := pixel clock in units of Hz
+ DX := mode number
+
+ Output:
+ AX := VBE Return Status
+ ECX := Closest pixel clock
*/
pVbe->pInt10->num = 0x10;
@@ -974,7 +987,7 @@ VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int clock)
xf86ExecX86int10(pVbe->pInt10);
if (R16(pVbe->pInt10->ax) != 0x4f)
- return 0;
+ return 0;
return pVbe->pInt10->cx;
}
@@ -983,13 +996,13 @@ Bool
VBEDPMSSet(vbeInfoPtr pVbe, int mode)
{
/*
- Input:
- AX := 4F10h DPMS
- BL := 01h Set Display Power State
- BH := requested power state
-
- Output:
- AX := VBE Return Status
+ Input:
+ AX := 4F10h DPMS
+ BL := 01h Set Display Power State
+ BH := requested power state
+
+ Output:
+ AX := VBE Return Status
*/
pVbe->pInt10->num = 0x10;
@@ -997,16 +1010,16 @@ VBEDPMSSet(vbeInfoPtr pVbe, int mode)
pVbe->pInt10->bx = 0x01;
switch (mode) {
case DPMSModeOn:
- break;
+ break;
case DPMSModeStandby:
- pVbe->pInt10->bx |= 0x100;
- break;
+ pVbe->pInt10->bx |= 0x100;
+ break;
case DPMSModeSuspend:
- pVbe->pInt10->bx |= 0x200;
- break;
+ pVbe->pInt10->bx |= 0x200;
+ break;
case DPMSModeOff:
- pVbe->pInt10->bx |= 0x400;
- break;
+ pVbe->pInt10->bx |= 0x400;
+ break;
}
xf86ExecX86int10(pVbe->pInt10);
return (R16(pVbe->pInt10->ax) == 0x4f);
@@ -1020,31 +1033,32 @@ VBEInterpretPanelID(int scrnIndex, struct vbePanelID *data)
const float PANEL_HZ = 60.0;
if (!data)
- return;
+ return;
xf86DrvMsg(scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n",
- data->hsize, data->vsize);
+ data->hsize, data->vsize);
if (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh)
- return;
+ return;
if (data->hsize < 320 || data->vsize < 240) {
- xf86DrvMsg(scrnIndex, X_INFO, "...which I refuse to believe\n");
- return;
+ xf86DrvMsg(scrnIndex, X_INFO, "...which I refuse to believe\n");
+ return;
}
mode = xf86CVTMode(data->hsize, data->vsize, PANEL_HZ, 1, 0);
pScrn->monitor->nHsync = 1;
pScrn->monitor->hsync[0].lo = 29.37;
- pScrn->monitor->hsync[0].hi = (float)mode->Clock / (float)mode->HTotal;
+ pScrn->monitor->hsync[0].hi = (float) mode->Clock / (float) mode->HTotal;
pScrn->monitor->nVrefresh = 1;
pScrn->monitor->vrefresh[0].lo = 56.0;
pScrn->monitor->vrefresh[0].hi =
- (float)mode->Clock*1000.0 / (float)mode->HTotal / (float)mode->VTotal;
+ (float) mode->Clock * 1000.0 / (float) mode->HTotal /
+ (float) mode->VTotal;
if (pScrn->monitor->vrefresh[0].hi < 59.47)
- pScrn->monitor->vrefresh[0].hi = 59.47;
+ pScrn->monitor->vrefresh[0].hi = 59.47;
free(mode);
}
@@ -1068,25 +1082,27 @@ VBEReadPanelID(vbeInfoPtr pVbe)
xf86ExecX86int10(pVbe->pInt10);
if ((pVbe->pInt10->ax & 0xff) != 0x4f) {
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID invalid\n");
- goto error;
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE PanelID invalid\n");
+ goto error;
}
switch (pVbe->pInt10->ax & 0xff00) {
case 0x0:
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read successfully\n");
- tmp = xnfalloc(32);
- memcpy(tmp, page, 32);
- break;
+ xf86DrvMsgVerb(screen, X_INFO, 3,
+ "VESA VBE PanelID read successfully\n");
+ tmp = xnfalloc(32);
+ memcpy(tmp, page, 32);
+ break;
case 0x100:
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read failed\n");
- break;
+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE PanelID read failed\n");
+ break;
default:
- xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID unknown failure %i\n",
- pVbe->pInt10->ax & 0xff00);
- break;
+ xf86DrvMsgVerb(screen, X_INFO, 3,
+ "VESA VBE PanelID unknown failure %i\n",
+ pVbe->pInt10->ax & 0xff00);
+ break;
}
-error:
+ error:
return tmp;
}
diff --git a/xorg-server/hw/xfree86/vbe/vbe.h b/xorg-server/hw/xfree86/vbe/vbe.h
index 5bb163df8..81be0ff40 100644
--- a/xorg-server/hw/xfree86/vbe/vbe.h
+++ b/xorg-server/hw/xfree86/vbe/vbe.h
@@ -1,341 +1,357 @@
-
-/*
- * XFree86 vbe module
- * Copyright 2000 Egbert Eich
- *
- * The mode query/save/set/restore functions from the vesa driver
- * have been moved here.
- * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
- * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
- */
-
-#ifndef _VBE_H
-#define _VBE_H
-#include "xf86int10.h"
-#include "xf86DDC.h"
-
-typedef enum {
- DDC_UNCHECKED,
- DDC_NONE,
- DDC_1,
- DDC_2,
- DDC_1_2
-}
-ddc_lvl;
-
-typedef struct {
- xf86Int10InfoPtr pInt10;
- int version;
- pointer memory;
- int real_mode_base;
- int num_pages;
- Bool init_int10;
- ddc_lvl ddc;
- Bool ddc_blank;
-} vbeInfoRec, *vbeInfoPtr;
-
-#define VBE_VERSION_MAJOR(x) *((CARD8*)(&x) + 1)
-#define VBE_VERSION_MINOR(x) (CARD8)(x)
-
-extern _X_EXPORT vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex);
-extern _X_EXPORT vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags);
-extern _X_EXPORT void vbeFree(vbeInfoPtr pVbe);
-extern _X_EXPORT xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule);
-
-#pragma pack(1)
-
-typedef struct vbeControllerInfoBlock {
- CARD8 VbeSignature[4];
- CARD16 VbeVersion;
- CARD32 OemStringPtr;
- CARD8 Capabilities[4];
- CARD32 VideoModePtr;
- CARD16 TotalMem;
- CARD16 OemSoftwareRev;
- CARD32 OemVendorNamePtr;
- CARD32 OemProductNamePtr;
- CARD32 OemProductRevPtr;
- CARD8 Scratch[222];
- CARD8 OemData[256];
-} vbeControllerInfoRec, *vbeControllerInfoPtr;
-
-#if defined(__GNUC__) || defined(__USLC__) || defined(__SUNPRO_C)
-#pragma pack() /* All GCC versions recognise this syntax */
-#else
-#pragma pack(0)
-#endif
-
-#if !( defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) )
-#define __attribute__(a)
-#endif
-
-typedef struct _VbeInfoBlock VbeInfoBlock;
-typedef struct _VbeModeInfoBlock VbeModeInfoBlock;
-typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock;
-
-/*
- * INT 0
- */
-
-struct _VbeInfoBlock {
- /* VESA 1.2 fields */
- CARD8 VESASignature[4]; /* VESA */
- CARD16 VESAVersion; /* Higher byte major, lower byte minor */
- /*CARD32*/char *OEMStringPtr; /* Pointer to OEM string */
- CARD8 Capabilities[4]; /* Capabilities of the video environment */
-
- /*CARD32*/CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */
-
- CARD16 TotalMemory; /* Number of 64kb memory blocks on board */
- /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */
-
- /* VESA 2 fields */
- CARD16 OemSoftwareRev; /* VBE implementation Software revision */
- /*CARD32*/char *OemVendorNamePtr; /* Pointer to Vendor Name String */
- /*CARD32*/char *OemProductNamePtr; /* Pointer to Product Name String */
- /*CARD32*/char *OemProductRevPtr; /* Pointer to Product Revision String */
- CARD8 Reserved[222]; /* Reserved for VBE implementation */
- CARD8 OemData[256]; /* Data Area for OEM Strings */
-} __attribute__((packed));
-
-/* Return Super VGA Information */
-extern _X_EXPORT VbeInfoBlock *VBEGetVBEInfo(vbeInfoPtr pVbe);
-extern _X_EXPORT void VBEFreeVBEInfo(VbeInfoBlock *block);
-
-/*
- * INT 1
- */
-
-struct _VbeModeInfoBlock {
- CARD16 ModeAttributes; /* mode attributes */
- CARD8 WinAAttributes; /* window A attributes */
- CARD8 WinBAttributes; /* window B attributes */
- CARD16 WinGranularity; /* window granularity */
- CARD16 WinSize; /* window size */
- CARD16 WinASegment; /* window A start segment */
- CARD16 WinBSegment; /* window B start segment */
- CARD32 WinFuncPtr; /* real mode pointer to window function */
- CARD16 BytesPerScanline; /* bytes per scanline */
-
- /* Mandatory information for VBE 1.2 and above */
- CARD16 XResolution; /* horizontal resolution in pixels or characters */
- CARD16 YResolution; /* vertical resolution in pixels or characters */
- CARD8 XCharSize; /* character cell width in pixels */
- CARD8 YCharSize; /* character cell height in pixels */
- CARD8 NumberOfPlanes; /* number of memory planes */
- CARD8 BitsPerPixel; /* bits per pixel */
- CARD8 NumberOfBanks; /* number of banks */
- CARD8 MemoryModel; /* memory model type */
- CARD8 BankSize; /* bank size in KB */
- CARD8 NumberOfImages; /* number of images */
- CARD8 Reserved; /* 1 */ /* reserved for page function */
-
- /* Direct color fields (required for direct/6 and YUV/7 memory models) */
- CARD8 RedMaskSize; /* size of direct color red mask in bits */
- CARD8 RedFieldPosition; /* bit position of lsb of red mask */
- CARD8 GreenMaskSize; /* size of direct color green mask in bits */
- CARD8 GreenFieldPosition; /* bit position of lsb of green mask */
- CARD8 BlueMaskSize; /* size of direct color blue mask in bits */
- CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */
- CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */
- CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */
- CARD8 DirectColorModeInfo; /* direct color mode attributes */
-
- /* Mandatory information for VBE 2.0 and above */
- CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */
- CARD32 Reserved32; /* 0 */ /* Reserved - always set to 0 */
- CARD16 Reserved16; /* 0 */ /* Reserved - always set to 0 */
-
- /* Mandatory information for VBE 3.0 and above */
- CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */
- CARD8 BnkNumberOfImagePages; /* number of images for banked modes */
- CARD8 LinNumberOfImagePages; /* number of images for linear modes */
- CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */
- CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */
- CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */
- CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */
- CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */
- CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */
- CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */
- CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */
- CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */
- CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */
-} __attribute__((packed));
-
-/* Return VBE Mode Information */
-extern _X_EXPORT VbeModeInfoBlock *VBEGetModeInfo(vbeInfoPtr pVbe, int mode);
-extern _X_EXPORT void VBEFreeModeInfo(VbeModeInfoBlock *block);
-
-/*
- * INT2
- */
-
-#define CRTC_DBLSCAN (1<<0)
-#define CRTC_INTERLACE (1<<1)
-#define CRTC_NHSYNC (1<<2)
-#define CRTC_NVSYNC (1<<3)
-
-struct _VbeCRTCInfoBlock {
- CARD16 HorizontalTotal; /* Horizontal total in pixels */
- CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */
- CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */
- CARD16 VerticalTotal; /* Vertical total in lines */
- CARD16 VerticalSyncStart; /* Vertical sync start in lines */
- CARD16 VerticalSyncEnd; /* Vertical sync end in lines */
- CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */
- CARD32 PixelClock; /* Pixel clock in units of Hz */
- CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */
- CARD8 Reserved[40]; /* remainder of ModeInfoBlock */
-} __attribute__((packed));
-/* VbeCRTCInfoBlock is in the VESA 3.0 specs */
-
-extern _X_EXPORT Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *crtc);
-
-/*
- * INT 3
- */
-
-extern _X_EXPORT Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode);
-
-/*
- * INT 4
- */
-
-/* Save/Restore Super VGA video state */
-/* function values are (values stored in VESAPtr):
- * 0 := query & allocate amount of memory to save state
- * 1 := save state
- * 2 := restore state
- *
- * function 0 called automatically if function 1 called without
- * a previous call to function 0.
- */
-
-typedef enum {
- MODE_QUERY,
- MODE_SAVE,
- MODE_RESTORE
-} vbeSaveRestoreFunction;
-
-extern _X_EXPORT Bool
-VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction,
- pointer *memory, int *size, int *real_mode_pages);
-
-/*
- * INT 5
- */
-
-extern _X_EXPORT Bool
-VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window);
-
-/*
- * INT 6
- */
-
-typedef enum {
- SCANWID_SET,
- SCANWID_GET,
- SCANWID_SET_BYTES,
- SCANWID_GET_MAX
-} vbeScanwidthCommand;
-
-#define VBESetLogicalScanline(pVbe, width) \
- VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET, width, \
- NULL, NULL, NULL)
-#define VBESetLogicalScanlineBytes(pVbe, width) \
- VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET_BYTES, width, \
- NULL, NULL, NULL)
-#define VBEGetLogicalScanline(pVbe, pixels, bytes, max) \
- VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET, 0, \
- pixels, bytes, max)
-#define VBEGetMaxLogicalScanline(pVbe, pixels, bytes, max) \
- VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET_MAX, 0, \
- pixels, bytes, max)
-extern _X_EXPORT Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe,
- vbeScanwidthCommand command, int width,
- int *pixels, int *bytes, int *max);
-
-/*
- * INT 7
- */
-
-/* 16 bit code */
-extern _X_EXPORT Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace);
-extern _X_EXPORT Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y);
-
-/*
- * INT 8
- */
-
-/* if bits is 0, then it is a GET */
-extern _X_EXPORT int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits);
-
-/*
- * INT 9
- */
-
-/*
- * If getting a palette, the data argument is not used. It will return
- * the data.
- * If setting a palette, it will return the pointer received on success,
- * NULL on failure.
- */
-extern _X_EXPORT CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num,
- CARD32 *data, Bool secondary, Bool wait_retrace);
-#define VBEFreePaletteData(data) free(data)
-
-/*
- * INT A
- */
-
-typedef struct _VBEpmi {
- int seg_tbl;
- int tbl_off;
- int tbl_len;
-} VBEpmi;
-
-extern _X_EXPORT VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe);
-#define VESAFreeVBEpmi(pmi) free(pmi)
-
-/* high level helper functions */
-
-typedef struct _vbeModeInfoRec {
- int width;
- int height;
- int bpp;
- int n;
- struct _vbeModeInfoRec *next;
-} vbeModeInfoRec, *vbeModeInfoPtr;
-
-typedef struct {
- CARD8 *state;
- CARD8 *pstate;
- int statePage;
- int stateSize;
- int stateMode;
-} vbeSaveRestoreRec, *vbeSaveRestorePtr;
-
-extern _X_EXPORT void
-VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr,
- vbeSaveRestoreFunction function);
-
-extern _X_EXPORT int VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int Clock);
-extern _X_EXPORT Bool VBEDPMSSet(vbeInfoPtr pVbe, int mode);
-
-struct vbePanelID {
- short hsize;
- short vsize;
- short fptype;
- char redbpp;
- char greenbpp;
- char bluebpp;
- char reservedbpp;
- int reserved_offscreen_mem_size;
- int reserved_offscreen_mem_pointer;
- char reserved[14];
-};
-
-extern _X_EXPORT void VBEInterpretPanelID(int scrnIndex, struct vbePanelID *data);
-extern _X_EXPORT struct vbePanelID *VBEReadPanelID(vbeInfoPtr pVbe);
-
-#endif
+
+/*
+ * XFree86 vbe module
+ * Copyright 2000 Egbert Eich
+ *
+ * The mode query/save/set/restore functions from the vesa driver
+ * have been moved here.
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ */
+
+#ifndef _VBE_H
+#define _VBE_H
+#include "xf86int10.h"
+#include "xf86DDC.h"
+
+typedef enum {
+ DDC_UNCHECKED,
+ DDC_NONE,
+ DDC_1,
+ DDC_2,
+ DDC_1_2
+} ddc_lvl;
+
+typedef struct {
+ xf86Int10InfoPtr pInt10;
+ int version;
+ pointer memory;
+ int real_mode_base;
+ int num_pages;
+ Bool init_int10;
+ ddc_lvl ddc;
+ Bool ddc_blank;
+} vbeInfoRec, *vbeInfoPtr;
+
+#define VBE_VERSION_MAJOR(x) *((CARD8*)(&x) + 1)
+#define VBE_VERSION_MINOR(x) (CARD8)(x)
+
+extern _X_EXPORT vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex);
+extern _X_EXPORT vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt,
+ int entityIndex, int Flags);
+extern _X_EXPORT void vbeFree(vbeInfoPtr pVbe);
+extern _X_EXPORT xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule);
+
+#pragma pack(1)
+
+typedef struct vbeControllerInfoBlock {
+ CARD8 VbeSignature[4];
+ CARD16 VbeVersion;
+ CARD32 OemStringPtr;
+ CARD8 Capabilities[4];
+ CARD32 VideoModePtr;
+ CARD16 TotalMem;
+ CARD16 OemSoftwareRev;
+ CARD32 OemVendorNamePtr;
+ CARD32 OemProductNamePtr;
+ CARD32 OemProductRevPtr;
+ CARD8 Scratch[222];
+ CARD8 OemData[256];
+} vbeControllerInfoRec, *vbeControllerInfoPtr;
+
+#if defined(__GNUC__) || defined(__USLC__) || defined(__SUNPRO_C)
+#pragma pack() /* All GCC versions recognise this syntax */
+#else
+#pragma pack(0)
+#endif
+
+#if !( defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) )
+#define __attribute__(a)
+#endif
+
+typedef struct _VbeInfoBlock VbeInfoBlock;
+typedef struct _VbeModeInfoBlock VbeModeInfoBlock;
+typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock;
+
+/*
+ * INT 0
+ */
+
+struct _VbeInfoBlock {
+ /* VESA 1.2 fields */
+ CARD8 VESASignature[4]; /* VESA */
+ CARD16 VESAVersion; /* Higher byte major, lower byte minor */
+ /*CARD32 */ char *OEMStringPtr;
+ /* Pointer to OEM string */
+ CARD8 Capabilities[4]; /* Capabilities of the video environment */
+
+ /*CARD32 */ CARD16 *VideoModePtr;
+ /* pointer to supported Super VGA modes */
+
+ CARD16 TotalMemory; /* Number of 64kb memory blocks on board */
+ /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */
+
+ /* VESA 2 fields */
+ CARD16 OemSoftwareRev; /* VBE implementation Software revision */
+ /*CARD32 */ char *OemVendorNamePtr;
+ /* Pointer to Vendor Name String */
+ /*CARD32 */ char *OemProductNamePtr;
+ /* Pointer to Product Name String */
+ /*CARD32 */ char *OemProductRevPtr;
+ /* Pointer to Product Revision String */
+ CARD8 Reserved[222]; /* Reserved for VBE implementation */
+ CARD8 OemData[256]; /* Data Area for OEM Strings */
+} __attribute__ ((packed));
+
+/* Return Super VGA Information */
+extern _X_EXPORT VbeInfoBlock *VBEGetVBEInfo(vbeInfoPtr pVbe);
+extern _X_EXPORT void VBEFreeVBEInfo(VbeInfoBlock * block);
+
+/*
+ * INT 1
+ */
+
+struct _VbeModeInfoBlock {
+ CARD16 ModeAttributes; /* mode attributes */
+ CARD8 WinAAttributes; /* window A attributes */
+ CARD8 WinBAttributes; /* window B attributes */
+ CARD16 WinGranularity; /* window granularity */
+ CARD16 WinSize; /* window size */
+ CARD16 WinASegment; /* window A start segment */
+ CARD16 WinBSegment; /* window B start segment */
+ CARD32 WinFuncPtr; /* real mode pointer to window function */
+ CARD16 BytesPerScanline; /* bytes per scanline */
+
+ /* Mandatory information for VBE 1.2 and above */
+ CARD16 XResolution; /* horizontal resolution in pixels or characters */
+ CARD16 YResolution; /* vertical resolution in pixels or characters */
+ CARD8 XCharSize; /* character cell width in pixels */
+ CARD8 YCharSize; /* character cell height in pixels */
+ CARD8 NumberOfPlanes; /* number of memory planes */
+ CARD8 BitsPerPixel; /* bits per pixel */
+ CARD8 NumberOfBanks; /* number of banks */
+ CARD8 MemoryModel; /* memory model type */
+ CARD8 BankSize; /* bank size in KB */
+ CARD8 NumberOfImages; /* number of images */
+ CARD8 Reserved; /* 1 *//* reserved for page function */
+
+ /* Direct color fields (required for direct/6 and YUV/7 memory models) */
+ CARD8 RedMaskSize; /* size of direct color red mask in bits */
+ CARD8 RedFieldPosition; /* bit position of lsb of red mask */
+ CARD8 GreenMaskSize; /* size of direct color green mask in bits */
+ CARD8 GreenFieldPosition; /* bit position of lsb of green mask */
+ CARD8 BlueMaskSize; /* size of direct color blue mask in bits */
+ CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */
+ CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */
+ CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */
+ CARD8 DirectColorModeInfo; /* direct color mode attributes */
+
+ /* Mandatory information for VBE 2.0 and above */
+ CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */
+ CARD32 Reserved32; /* 0 *//* Reserved - always set to 0 */
+ CARD16 Reserved16; /* 0 *//* Reserved - always set to 0 */
+
+ /* Mandatory information for VBE 3.0 and above */
+ CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */
+ CARD8 BnkNumberOfImagePages; /* number of images for banked modes */
+ CARD8 LinNumberOfImagePages; /* number of images for linear modes */
+ CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */
+ CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */
+ CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */
+ CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */
+ CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */
+ CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */
+ CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */
+ CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */
+ CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */
+ CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */
+} __attribute__ ((packed));
+
+/* Return VBE Mode Information */
+extern _X_EXPORT VbeModeInfoBlock *VBEGetModeInfo(vbeInfoPtr pVbe, int mode);
+extern _X_EXPORT void VBEFreeModeInfo(VbeModeInfoBlock * block);
+
+/*
+ * INT2
+ */
+
+#define CRTC_DBLSCAN (1<<0)
+#define CRTC_INTERLACE (1<<1)
+#define CRTC_NHSYNC (1<<2)
+#define CRTC_NVSYNC (1<<3)
+
+struct _VbeCRTCInfoBlock {
+ CARD16 HorizontalTotal; /* Horizontal total in pixels */
+ CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */
+ CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */
+ CARD16 VerticalTotal; /* Vertical total in lines */
+ CARD16 VerticalSyncStart; /* Vertical sync start in lines */
+ CARD16 VerticalSyncEnd; /* Vertical sync end in lines */
+ CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */
+ CARD32 PixelClock; /* Pixel clock in units of Hz */
+ CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */
+ CARD8 Reserved[40]; /* remainder of ModeInfoBlock */
+} __attribute__ ((packed));
+
+/* VbeCRTCInfoBlock is in the VESA 3.0 specs */
+
+extern _X_EXPORT Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode,
+ VbeCRTCInfoBlock * crtc);
+
+/*
+ * INT 3
+ */
+
+extern _X_EXPORT Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode);
+
+/*
+ * INT 4
+ */
+
+/* Save/Restore Super VGA video state */
+/* function values are (values stored in VESAPtr):
+ * 0 := query & allocate amount of memory to save state
+ * 1 := save state
+ * 2 := restore state
+ *
+ * function 0 called automatically if function 1 called without
+ * a previous call to function 0.
+ */
+
+typedef enum {
+ MODE_QUERY,
+ MODE_SAVE,
+ MODE_RESTORE
+} vbeSaveRestoreFunction;
+
+extern _X_EXPORT Bool
+
+VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction,
+ pointer *memory, int *size, int *real_mode_pages);
+
+/*
+ * INT 5
+ */
+
+extern _X_EXPORT Bool
+ VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window);
+
+/*
+ * INT 6
+ */
+
+typedef enum {
+ SCANWID_SET,
+ SCANWID_GET,
+ SCANWID_SET_BYTES,
+ SCANWID_GET_MAX
+} vbeScanwidthCommand;
+
+#define VBESetLogicalScanline(pVbe, width) \
+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET, width, \
+ NULL, NULL, NULL)
+#define VBESetLogicalScanlineBytes(pVbe, width) \
+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET_BYTES, width, \
+ NULL, NULL, NULL)
+#define VBEGetLogicalScanline(pVbe, pixels, bytes, max) \
+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET, 0, \
+ pixels, bytes, max)
+#define VBEGetMaxLogicalScanline(pVbe, pixels, bytes, max) \
+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET_MAX, 0, \
+ pixels, bytes, max)
+extern _X_EXPORT Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe,
+ vbeScanwidthCommand
+ command, int width,
+ int *pixels, int *bytes,
+ int *max);
+
+/*
+ * INT 7
+ */
+
+/* 16 bit code */
+extern _X_EXPORT Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y,
+ Bool wait_retrace);
+extern _X_EXPORT Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y);
+
+/*
+ * INT 8
+ */
+
+/* if bits is 0, then it is a GET */
+extern _X_EXPORT int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits);
+
+/*
+ * INT 9
+ */
+
+/*
+ * If getting a palette, the data argument is not used. It will return
+ * the data.
+ * If setting a palette, it will return the pointer received on success,
+ * NULL on failure.
+ */
+extern _X_EXPORT CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set,
+ int first, int num, CARD32 *data,
+ Bool secondary,
+ Bool wait_retrace);
+#define VBEFreePaletteData(data) free(data)
+
+/*
+ * INT A
+ */
+
+typedef struct _VBEpmi {
+ int seg_tbl;
+ int tbl_off;
+ int tbl_len;
+} VBEpmi;
+
+extern _X_EXPORT VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe);
+
+#define VESAFreeVBEpmi(pmi) free(pmi)
+
+/* high level helper functions */
+
+typedef struct _vbeModeInfoRec {
+ int width;
+ int height;
+ int bpp;
+ int n;
+ struct _vbeModeInfoRec *next;
+} vbeModeInfoRec, *vbeModeInfoPtr;
+
+typedef struct {
+ CARD8 *state;
+ CARD8 *pstate;
+ int statePage;
+ int stateSize;
+ int stateMode;
+} vbeSaveRestoreRec, *vbeSaveRestorePtr;
+
+extern _X_EXPORT void
+
+VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr,
+ vbeSaveRestoreFunction function);
+
+extern _X_EXPORT int VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int Clock);
+extern _X_EXPORT Bool VBEDPMSSet(vbeInfoPtr pVbe, int mode);
+
+struct vbePanelID {
+ short hsize;
+ short vsize;
+ short fptype;
+ char redbpp;
+ char greenbpp;
+ char bluebpp;
+ char reservedbpp;
+ int reserved_offscreen_mem_size;
+ int reserved_offscreen_mem_pointer;
+ char reserved[14];
+};
+
+extern _X_EXPORT void VBEInterpretPanelID(int scrnIndex,
+ struct vbePanelID *data);
+extern _X_EXPORT struct vbePanelID *VBEReadPanelID(vbeInfoPtr pVbe);
+
+#endif
diff --git a/xorg-server/hw/xfree86/vbe/vbeModes.c b/xorg-server/hw/xfree86/vbe/vbeModes.c
index 9ccbe6b51..415167d0e 100644
--- a/xorg-server/hw/xfree86/vbe/vbeModes.c
+++ b/xorg-server/hw/xfree86/vbe/vbeModes.c
@@ -1,451 +1,451 @@
-#define DEBUG_VERB 2
-/*
- * Copyright © 2002 David Dawes
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the author(s) shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from
- * the author(s).
- *
- * Authors: David Dawes <dawes@xfree86.org>
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdio.h>
-#include <string.h>
-
-#include "xf86.h"
-#include "vbe.h"
-#include "vbeModes.h"
-
-static int
-GetDepthFlag(vbeInfoPtr pVbe, int id)
-{
- VbeModeInfoBlock *mode;
- int bpp;
-
- if ((mode = VBEGetModeInfo(pVbe, id)) == NULL)
- return 0;
-
- if (VBE_MODE_USABLE(mode, 0)) {
- int depth;
-
- if (VBE_MODE_COLOR(mode)) {
- depth = mode->RedMaskSize + mode->GreenMaskSize +
- mode->BlueMaskSize;
- } else {
- depth = 1;
- }
- bpp = mode->BitsPerPixel;
- VBEFreeModeInfo(mode);
- mode = NULL;
- switch (depth) {
- case 1:
- return V_DEPTH_1;
- case 4:
- return V_DEPTH_4;
- case 8:
- return V_DEPTH_8;
- case 15:
- return V_DEPTH_15;
- case 16:
- return V_DEPTH_16;
- case 24:
- switch (bpp) {
- case 24:
- return V_DEPTH_24_24;
- case 32:
- return V_DEPTH_24_32;
- }
- }
- }
- if (mode)
- VBEFreeModeInfo(mode);
- return 0;
-}
-
-/*
- * Find supported mode depths.
- */
-int
-VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock *vbe, int *flags24,
- int modeTypes)
-{
- int i = 0;
- int depths = 0;
-
- if (modeTypes & V_MODETYPE_VBE) {
- while (vbe->VideoModePtr[i] != 0xffff) {
- depths |= GetDepthFlag(pVbe, vbe->VideoModePtr[i++]);
- }
- }
-
- /*
- * XXX This possibly only works with VBE 3.0 and later.
- */
- if (modeTypes & V_MODETYPE_VGA) {
- for (i = 0; i < 0x7F; i++) {
- depths |= GetDepthFlag(pVbe, i);
- }
- }
-
- if (flags24) {
- if (depths & V_DEPTH_24_24)
- *flags24 |= Support24bppFb;
- if (depths & V_DEPTH_24_32)
- *flags24 |= Support32bppFb;
- }
-
- return depths;
-}
-
-static DisplayModePtr
-CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe, int id,
- int flags)
-{
- CARD16 major;
- VbeModeInfoBlock *mode;
- DisplayModePtr pMode;
- VbeModeInfoData *data;
- Bool modeOK = FALSE;
-
- major = (unsigned)(vbe->VESAVersion >> 8);
-
- if ((mode = VBEGetModeInfo(pVbe, id)) == NULL)
- return NULL;
-
- /* Does the mode match the depth/bpp? */
- /* Some BIOS's set BitsPerPixel to 15 instead of 16 for 15/16 */
- if (VBE_MODE_USABLE(mode, flags) &&
- ((pScrn->bitsPerPixel == 1 && !VBE_MODE_COLOR(mode)) ||
- (mode->BitsPerPixel > 8 &&
- (mode->RedMaskSize + mode->GreenMaskSize +
- mode->BlueMaskSize) == pScrn->depth &&
- mode->BitsPerPixel == pScrn->bitsPerPixel) ||
- (mode->BitsPerPixel == 15 && pScrn->depth == 15) ||
- (mode->BitsPerPixel <= 8 &&
- mode->BitsPerPixel == pScrn->bitsPerPixel))) {
- modeOK = TRUE;
- xf86ErrorFVerb(DEBUG_VERB, "*");
- }
-
- xf86ErrorFVerb(DEBUG_VERB,
- "Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution);
- xf86ErrorFVerb(DEBUG_VERB,
- " ModeAttributes: 0x%x\n", mode->ModeAttributes);
- xf86ErrorFVerb(DEBUG_VERB,
- " WinAAttributes: 0x%x\n", mode->WinAAttributes);
- xf86ErrorFVerb(DEBUG_VERB,
- " WinBAttributes: 0x%x\n", mode->WinBAttributes);
- xf86ErrorFVerb(DEBUG_VERB,
- " WinGranularity: %d\n", mode->WinGranularity);
- xf86ErrorFVerb(DEBUG_VERB,
- " WinSize: %d\n", mode->WinSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " WinASegment: 0x%x\n", mode->WinASegment);
- xf86ErrorFVerb(DEBUG_VERB,
- " WinBSegment: 0x%x\n", mode->WinBSegment);
- xf86ErrorFVerb(DEBUG_VERB,
- " WinFuncPtr: 0x%lx\n", (unsigned long)mode->WinFuncPtr);
- xf86ErrorFVerb(DEBUG_VERB,
- " BytesPerScanline: %d\n", mode->BytesPerScanline);
- xf86ErrorFVerb(DEBUG_VERB,
- " XResolution: %d\n", mode->XResolution);
- xf86ErrorFVerb(DEBUG_VERB,
- " YResolution: %d\n", mode->YResolution);
- xf86ErrorFVerb(DEBUG_VERB,
- " XCharSize: %d\n", mode->XCharSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " YCharSize: %d\n", mode->YCharSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " NumberOfPlanes: %d\n", mode->NumberOfPlanes);
- xf86ErrorFVerb(DEBUG_VERB,
- " BitsPerPixel: %d\n", mode->BitsPerPixel);
- xf86ErrorFVerb(DEBUG_VERB,
- " NumberOfBanks: %d\n", mode->NumberOfBanks);
- xf86ErrorFVerb(DEBUG_VERB,
- " MemoryModel: %d\n", mode->MemoryModel);
- xf86ErrorFVerb(DEBUG_VERB,
- " BankSize: %d\n", mode->BankSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " NumberOfImages: %d\n", mode->NumberOfImages);
- xf86ErrorFVerb(DEBUG_VERB,
- " RedMaskSize: %d\n", mode->RedMaskSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " RedFieldPosition: %d\n", mode->RedFieldPosition);
- xf86ErrorFVerb(DEBUG_VERB,
- " GreenMaskSize: %d\n", mode->GreenMaskSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " GreenFieldPosition: %d\n", mode->GreenFieldPosition);
- xf86ErrorFVerb(DEBUG_VERB,
- " BlueMaskSize: %d\n", mode->BlueMaskSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " BlueFieldPosition: %d\n", mode->BlueFieldPosition);
- xf86ErrorFVerb(DEBUG_VERB,
- " RsvdMaskSize: %d\n", mode->RsvdMaskSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition);
- xf86ErrorFVerb(DEBUG_VERB,
- " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo);
- if (major >= 2) {
- xf86ErrorFVerb(DEBUG_VERB,
- " PhysBasePtr: 0x%lx\n",
- (unsigned long)mode->PhysBasePtr);
- if (major >= 3) {
- xf86ErrorFVerb(DEBUG_VERB,
- " LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine);
- xf86ErrorFVerb(DEBUG_VERB,
- " BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages);
- xf86ErrorFVerb(DEBUG_VERB,
- " LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages);
- xf86ErrorFVerb(DEBUG_VERB,
- " LinRedMaskSize: %d\n", mode->LinRedMaskSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " LinRedFieldPosition: %d\n", mode->LinRedFieldPosition);
- xf86ErrorFVerb(DEBUG_VERB,
- " LinGreenMaskSize: %d\n", mode->LinGreenMaskSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition);
- xf86ErrorFVerb(DEBUG_VERB,
- " LinBlueMaskSize: %d\n", mode->LinBlueMaskSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition);
- xf86ErrorFVerb(DEBUG_VERB,
- " LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize);
- xf86ErrorFVerb(DEBUG_VERB,
- " LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition);
- xf86ErrorFVerb(DEBUG_VERB,
- " MaxPixelClock: %ld\n", (unsigned long)mode->MaxPixelClock);
- }
- }
-
- if (!modeOK) {
- VBEFreeModeInfo(mode);
- return NULL;
- }
- pMode = xnfcalloc(sizeof(DisplayModeRec), 1);
-
- pMode->status = MODE_OK;
- pMode->type = M_T_BUILTIN;
-
- /* for adjust frame */
- pMode->HDisplay = mode->XResolution;
- pMode->VDisplay = mode->YResolution;
-
- data = xnfcalloc(sizeof(VbeModeInfoData), 1);
- data->mode = id;
- data->data = mode;
- pMode->PrivSize = sizeof(VbeModeInfoData);
- pMode->Private = (INT32*)data;
- pMode->next = NULL;
- return pMode;
-}
-
-/*
- * Check the available BIOS modes, and extract those that match the
- * requirements into the modePool. Note: modePool is a NULL-terminated
- * list.
- */
-
-DisplayModePtr
-VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe,
- int modeTypes)
-{
- DisplayModePtr pMode, p = NULL, modePool = NULL;
- int i = 0;
-
- if (modeTypes & V_MODETYPE_VBE) {
- while (vbe->VideoModePtr[i] != 0xffff) {
- int id = vbe->VideoModePtr[i++];
-
- if ((pMode = CheckMode(pScrn, pVbe, vbe, id, modeTypes)) != NULL) {
- ModeStatus status = MODE_OK;
-
- /* Check the mode against a specified virtual size (if any) */
- if (pScrn->display->virtualX > 0 &&
- pMode->HDisplay > pScrn->display->virtualX) {
- status = MODE_VIRTUAL_X;
- }
- if (pScrn->display->virtualY > 0 &&
- pMode->VDisplay > pScrn->display->virtualY) {
- status = MODE_VIRTUAL_Y;
- }
- if (status != MODE_OK) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Not using mode \"%dx%d\" (%s)\n",
- pMode->HDisplay, pMode->VDisplay,
- xf86ModeStatusToString(status));
- } else {
- if (p == NULL) {
- modePool = pMode;
- } else {
- p->next = pMode;
- }
- pMode->prev = NULL;
- p = pMode;
- }
- }
- }
- }
- if (modeTypes & V_MODETYPE_VGA) {
- for (i = 0; i < 0x7F; i++) {
- if ((pMode = CheckMode(pScrn, pVbe, vbe, i, modeTypes)) != NULL) {
- ModeStatus status = MODE_OK;
-
- /* Check the mode against a specified virtual size (if any) */
- if (pScrn->display->virtualX > 0 &&
- pMode->HDisplay > pScrn->display->virtualX) {
- status = MODE_VIRTUAL_X;
- }
- if (pScrn->display->virtualY > 0 &&
- pMode->VDisplay > pScrn->display->virtualY) {
- status = MODE_VIRTUAL_Y;
- }
- if (status != MODE_OK) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Not using mode \"%dx%d\" (%s)\n",
- pMode->HDisplay, pMode->VDisplay,
- xf86ModeStatusToString(status));
- } else {
- if (p == NULL) {
- modePool = pMode;
- } else {
- p->next = pMode;
- }
- pMode->prev = NULL;
- p = pMode;
- }
- }
- }
- }
- return modePool;
-}
-
-void
-VBESetModeNames(DisplayModePtr pMode)
-{
- if (!pMode)
- return;
-
- do {
- if (!pMode->name) {
- /* Catch "bad" modes. */
- if (pMode->HDisplay > 10000 || pMode->HDisplay < 0 ||
- pMode->VDisplay > 10000 || pMode->VDisplay < 0) {
- pMode->name = strdup("BADMODE");
- } else {
- XNFasprintf(&pMode->name, "%dx%d",
- pMode->HDisplay, pMode->VDisplay);
- }
- }
- pMode = pMode->next;
- } while (pMode);
-}
-
-/*
- * Go through the monitor modes and selecting the best set of
- * parameters for each BIOS mode. Note: This is only supported in
- * VBE version 3.0 or later.
- */
-void
-VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe)
-{
- DisplayModePtr pMode;
- VbeModeInfoData *data;
-
- pMode = pScrn->modes;
- do {
- DisplayModePtr p, best = NULL;
- ModeStatus status;
-
- for (p = pScrn->monitor->Modes; p != NULL; p = p->next) {
- if ((p->HDisplay != pMode->HDisplay) ||
- (p->VDisplay != pMode->VDisplay) ||
- (p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2)))
- continue;
- /* XXX could support the various V_ flags */
- status = xf86CheckModeForMonitor(p, pScrn->monitor);
- if (status != MODE_OK)
- continue;
- if (!best || (p->Clock > best->Clock))
- best = p;
- }
-
- if (best) {
- int clock;
-
- data = (VbeModeInfoData*)pMode->Private;
- pMode->HSync = (float)best->Clock * 1000.0 / best->HTotal + 0.5;
- pMode->VRefresh = pMode->HSync / best->VTotal + 0.5;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Attempting to use %dHz refresh for mode \"%s\" (%x)\n",
- (int)pMode->VRefresh, pMode->name, data->mode);
- data->block = calloc(sizeof(VbeCRTCInfoBlock), 1);
- data->block->HorizontalTotal = best->HTotal;
- data->block->HorizontalSyncStart = best->HSyncStart;
- data->block->HorizontalSyncEnd = best->HSyncEnd;
- data->block->VerticalTotal = best->VTotal;
- data->block->VerticalSyncStart = best->VSyncStart;
- data->block->VerticalSyncEnd = best->VSyncEnd;
- data->block->Flags = ((best->Flags & V_NHSYNC) ? CRTC_NHSYNC : 0) |
- ((best->Flags & V_NVSYNC) ? CRTC_NVSYNC : 0);
- data->block->PixelClock = best->Clock * 1000;
- /* XXX May not have this. */
- clock = VBEGetPixelClock(pVbe, data->mode, data->block->PixelClock);
- DebugF("Setting clock %.2fMHz, closest is %.2fMHz\n",
- (double)data->block->PixelClock / 1000000.0,
- (double)clock / 1000000.0);
- if (clock)
- data->block->PixelClock = clock;
- data->mode |= (1 << 11);
- data->block->RefreshRate = ((double)(data->block->PixelClock) /
- (double)(best->HTotal * best->VTotal)) * 100;
- }
- pMode = pMode->next;
- } while (pMode != pScrn->modes);
-}
-
-/*
- * These wrappers are to allow (temporary) funtionality divergences.
- */
-int
-VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
- char **modeNames, ClockRangePtr clockRanges,
- int *linePitches, int minPitch, int maxPitch, int pitchInc,
- int minHeight, int maxHeight, int virtualX, int virtualY,
- int apertureSize, LookupModeFlags strategy)
-{
- return xf86ValidateModes(scrp, availModes, modeNames, clockRanges,
- linePitches, minPitch, maxPitch, pitchInc,
- minHeight, maxHeight, virtualX, virtualY,
- apertureSize, strategy);
-}
-
-void
-VBEPrintModes(ScrnInfoPtr scrp)
-{
- xf86PrintModes(scrp);
-}
-
+#define DEBUG_VERB 2
+/*
+ * Copyright © 2002 David Dawes
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the author(s) shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * the author(s).
+ *
+ * Authors: David Dawes <dawes@xfree86.org>
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+#include "xf86.h"
+#include "vbe.h"
+#include "vbeModes.h"
+
+static int
+GetDepthFlag(vbeInfoPtr pVbe, int id)
+{
+ VbeModeInfoBlock *mode;
+ int bpp;
+
+ if ((mode = VBEGetModeInfo(pVbe, id)) == NULL)
+ return 0;
+
+ if (VBE_MODE_USABLE(mode, 0)) {
+ int depth;
+
+ if (VBE_MODE_COLOR(mode)) {
+ depth = mode->RedMaskSize + mode->GreenMaskSize +
+ mode->BlueMaskSize;
+ }
+ else {
+ depth = 1;
+ }
+ bpp = mode->BitsPerPixel;
+ VBEFreeModeInfo(mode);
+ mode = NULL;
+ switch (depth) {
+ case 1:
+ return V_DEPTH_1;
+ case 4:
+ return V_DEPTH_4;
+ case 8:
+ return V_DEPTH_8;
+ case 15:
+ return V_DEPTH_15;
+ case 16:
+ return V_DEPTH_16;
+ case 24:
+ switch (bpp) {
+ case 24:
+ return V_DEPTH_24_24;
+ case 32:
+ return V_DEPTH_24_32;
+ }
+ }
+ }
+ if (mode)
+ VBEFreeModeInfo(mode);
+ return 0;
+}
+
+/*
+ * Find supported mode depths.
+ */
+int
+VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock * vbe, int *flags24,
+ int modeTypes)
+{
+ int i = 0;
+ int depths = 0;
+
+ if (modeTypes & V_MODETYPE_VBE) {
+ while (vbe->VideoModePtr[i] != 0xffff) {
+ depths |= GetDepthFlag(pVbe, vbe->VideoModePtr[i++]);
+ }
+ }
+
+ /*
+ * XXX This possibly only works with VBE 3.0 and later.
+ */
+ if (modeTypes & V_MODETYPE_VGA) {
+ for (i = 0; i < 0x7F; i++) {
+ depths |= GetDepthFlag(pVbe, i);
+ }
+ }
+
+ if (flags24) {
+ if (depths & V_DEPTH_24_24)
+ *flags24 |= Support24bppFb;
+ if (depths & V_DEPTH_24_32)
+ *flags24 |= Support32bppFb;
+ }
+
+ return depths;
+}
+
+static DisplayModePtr
+CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe, int id,
+ int flags)
+{
+ CARD16 major;
+ VbeModeInfoBlock *mode;
+ DisplayModePtr pMode;
+ VbeModeInfoData *data;
+ Bool modeOK = FALSE;
+
+ major = (unsigned) (vbe->VESAVersion >> 8);
+
+ if ((mode = VBEGetModeInfo(pVbe, id)) == NULL)
+ return NULL;
+
+ /* Does the mode match the depth/bpp? */
+ /* Some BIOS's set BitsPerPixel to 15 instead of 16 for 15/16 */
+ if (VBE_MODE_USABLE(mode, flags) &&
+ ((pScrn->bitsPerPixel == 1 && !VBE_MODE_COLOR(mode)) ||
+ (mode->BitsPerPixel > 8 &&
+ (mode->RedMaskSize + mode->GreenMaskSize +
+ mode->BlueMaskSize) == pScrn->depth &&
+ mode->BitsPerPixel == pScrn->bitsPerPixel) ||
+ (mode->BitsPerPixel == 15 && pScrn->depth == 15) ||
+ (mode->BitsPerPixel <= 8 &&
+ mode->BitsPerPixel == pScrn->bitsPerPixel))) {
+ modeOK = TRUE;
+ xf86ErrorFVerb(DEBUG_VERB, "*");
+ }
+
+ xf86ErrorFVerb(DEBUG_VERB,
+ "Mode: %x (%dx%d)\n", id, mode->XResolution,
+ mode->YResolution);
+ xf86ErrorFVerb(DEBUG_VERB, " ModeAttributes: 0x%x\n",
+ mode->ModeAttributes);
+ xf86ErrorFVerb(DEBUG_VERB, " WinAAttributes: 0x%x\n",
+ mode->WinAAttributes);
+ xf86ErrorFVerb(DEBUG_VERB, " WinBAttributes: 0x%x\n",
+ mode->WinBAttributes);
+ xf86ErrorFVerb(DEBUG_VERB, " WinGranularity: %d\n",
+ mode->WinGranularity);
+ xf86ErrorFVerb(DEBUG_VERB, " WinSize: %d\n", mode->WinSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinASegment: 0x%x\n", mode->WinASegment);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinBSegment: 0x%x\n", mode->WinBSegment);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinFuncPtr: 0x%lx\n", (unsigned long) mode->WinFuncPtr);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BytesPerScanline: %d\n", mode->BytesPerScanline);
+ xf86ErrorFVerb(DEBUG_VERB, " XResolution: %d\n", mode->XResolution);
+ xf86ErrorFVerb(DEBUG_VERB, " YResolution: %d\n", mode->YResolution);
+ xf86ErrorFVerb(DEBUG_VERB, " XCharSize: %d\n", mode->XCharSize);
+ xf86ErrorFVerb(DEBUG_VERB, " YCharSize: %d\n", mode->YCharSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " NumberOfPlanes: %d\n", mode->NumberOfPlanes);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BitsPerPixel: %d\n", mode->BitsPerPixel);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " NumberOfBanks: %d\n", mode->NumberOfBanks);
+ xf86ErrorFVerb(DEBUG_VERB, " MemoryModel: %d\n", mode->MemoryModel);
+ xf86ErrorFVerb(DEBUG_VERB, " BankSize: %d\n", mode->BankSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " NumberOfImages: %d\n", mode->NumberOfImages);
+ xf86ErrorFVerb(DEBUG_VERB, " RedMaskSize: %d\n", mode->RedMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RedFieldPosition: %d\n", mode->RedFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " GreenMaskSize: %d\n", mode->GreenMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " GreenFieldPosition: %d\n", mode->GreenFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BlueMaskSize: %d\n", mode->BlueMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BlueFieldPosition: %d\n", mode->BlueFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RsvdMaskSize: %d\n", mode->RsvdMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo);
+ if (major >= 2) {
+ xf86ErrorFVerb(DEBUG_VERB,
+ " PhysBasePtr: 0x%lx\n",
+ (unsigned long) mode->PhysBasePtr);
+ if (major >= 3) {
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinBytesPerScanLine: %d\n",
+ mode->LinBytesPerScanLine);
+ xf86ErrorFVerb(DEBUG_VERB, " BnkNumberOfImagePages: %d\n",
+ mode->BnkNumberOfImagePages);
+ xf86ErrorFVerb(DEBUG_VERB, " LinNumberOfImagePages: %d\n",
+ mode->LinNumberOfImagePages);
+ xf86ErrorFVerb(DEBUG_VERB, " LinRedMaskSize: %d\n",
+ mode->LinRedMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB, " LinRedFieldPosition: %d\n",
+ mode->LinRedFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB, " LinGreenMaskSize: %d\n",
+ mode->LinGreenMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB, " LinGreenFieldPosition: %d\n",
+ mode->LinGreenFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB, " LinBlueMaskSize: %d\n",
+ mode->LinBlueMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB, " LinBlueFieldPosition: %d\n",
+ mode->LinBlueFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB, " LinRsvdMaskSize: %d\n",
+ mode->LinRsvdMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB, " LinRsvdFieldPosition: %d\n",
+ mode->LinRsvdFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB, " MaxPixelClock: %ld\n",
+ (unsigned long) mode->MaxPixelClock);
+ }
+ }
+
+ if (!modeOK) {
+ VBEFreeModeInfo(mode);
+ return NULL;
+ }
+ pMode = xnfcalloc(sizeof(DisplayModeRec), 1);
+
+ pMode->status = MODE_OK;
+ pMode->type = M_T_BUILTIN;
+
+ /* for adjust frame */
+ pMode->HDisplay = mode->XResolution;
+ pMode->VDisplay = mode->YResolution;
+
+ data = xnfcalloc(sizeof(VbeModeInfoData), 1);
+ data->mode = id;
+ data->data = mode;
+ pMode->PrivSize = sizeof(VbeModeInfoData);
+ pMode->Private = (INT32 *) data;
+ pMode->next = NULL;
+ return pMode;
+}
+
+/*
+ * Check the available BIOS modes, and extract those that match the
+ * requirements into the modePool. Note: modePool is a NULL-terminated
+ * list.
+ */
+
+DisplayModePtr
+VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe,
+ int modeTypes)
+{
+ DisplayModePtr pMode, p = NULL, modePool = NULL;
+ int i = 0;
+
+ if (modeTypes & V_MODETYPE_VBE) {
+ while (vbe->VideoModePtr[i] != 0xffff) {
+ int id = vbe->VideoModePtr[i++];
+
+ if ((pMode = CheckMode(pScrn, pVbe, vbe, id, modeTypes)) != NULL) {
+ ModeStatus status = MODE_OK;
+
+ /* Check the mode against a specified virtual size (if any) */
+ if (pScrn->display->virtualX > 0 &&
+ pMode->HDisplay > pScrn->display->virtualX) {
+ status = MODE_VIRTUAL_X;
+ }
+ if (pScrn->display->virtualY > 0 &&
+ pMode->VDisplay > pScrn->display->virtualY) {
+ status = MODE_VIRTUAL_Y;
+ }
+ if (status != MODE_OK) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Not using mode \"%dx%d\" (%s)\n",
+ pMode->HDisplay, pMode->VDisplay,
+ xf86ModeStatusToString(status));
+ }
+ else {
+ if (p == NULL) {
+ modePool = pMode;
+ }
+ else {
+ p->next = pMode;
+ }
+ pMode->prev = NULL;
+ p = pMode;
+ }
+ }
+ }
+ }
+ if (modeTypes & V_MODETYPE_VGA) {
+ for (i = 0; i < 0x7F; i++) {
+ if ((pMode = CheckMode(pScrn, pVbe, vbe, i, modeTypes)) != NULL) {
+ ModeStatus status = MODE_OK;
+
+ /* Check the mode against a specified virtual size (if any) */
+ if (pScrn->display->virtualX > 0 &&
+ pMode->HDisplay > pScrn->display->virtualX) {
+ status = MODE_VIRTUAL_X;
+ }
+ if (pScrn->display->virtualY > 0 &&
+ pMode->VDisplay > pScrn->display->virtualY) {
+ status = MODE_VIRTUAL_Y;
+ }
+ if (status != MODE_OK) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Not using mode \"%dx%d\" (%s)\n",
+ pMode->HDisplay, pMode->VDisplay,
+ xf86ModeStatusToString(status));
+ }
+ else {
+ if (p == NULL) {
+ modePool = pMode;
+ }
+ else {
+ p->next = pMode;
+ }
+ pMode->prev = NULL;
+ p = pMode;
+ }
+ }
+ }
+ }
+ return modePool;
+}
+
+void
+VBESetModeNames(DisplayModePtr pMode)
+{
+ if (!pMode)
+ return;
+
+ do {
+ if (!pMode->name) {
+ /* Catch "bad" modes. */
+ if (pMode->HDisplay > 10000 || pMode->HDisplay < 0 ||
+ pMode->VDisplay > 10000 || pMode->VDisplay < 0) {
+ pMode->name = strdup("BADMODE");
+ }
+ else {
+ XNFasprintf(&pMode->name, "%dx%d",
+ pMode->HDisplay, pMode->VDisplay);
+ }
+ }
+ pMode = pMode->next;
+ } while (pMode);
+}
+
+/*
+ * Go through the monitor modes and selecting the best set of
+ * parameters for each BIOS mode. Note: This is only supported in
+ * VBE version 3.0 or later.
+ */
+void
+VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe)
+{
+ DisplayModePtr pMode;
+ VbeModeInfoData *data;
+
+ pMode = pScrn->modes;
+ do {
+ DisplayModePtr p, best = NULL;
+ ModeStatus status;
+
+ for (p = pScrn->monitor->Modes; p != NULL; p = p->next) {
+ if ((p->HDisplay != pMode->HDisplay) ||
+ (p->VDisplay != pMode->VDisplay) ||
+ (p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2)))
+ continue;
+ /* XXX could support the various V_ flags */
+ status = xf86CheckModeForMonitor(p, pScrn->monitor);
+ if (status != MODE_OK)
+ continue;
+ if (!best || (p->Clock > best->Clock))
+ best = p;
+ }
+
+ if (best) {
+ int clock;
+
+ data = (VbeModeInfoData *) pMode->Private;
+ pMode->HSync = (float) best->Clock * 1000.0 / best->HTotal + 0.5;
+ pMode->VRefresh = pMode->HSync / best->VTotal + 0.5;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Attempting to use %dHz refresh for mode \"%s\" (%x)\n",
+ (int) pMode->VRefresh, pMode->name, data->mode);
+ data->block = calloc(sizeof(VbeCRTCInfoBlock), 1);
+ data->block->HorizontalTotal = best->HTotal;
+ data->block->HorizontalSyncStart = best->HSyncStart;
+ data->block->HorizontalSyncEnd = best->HSyncEnd;
+ data->block->VerticalTotal = best->VTotal;
+ data->block->VerticalSyncStart = best->VSyncStart;
+ data->block->VerticalSyncEnd = best->VSyncEnd;
+ data->block->Flags = ((best->Flags & V_NHSYNC) ? CRTC_NHSYNC : 0) |
+ ((best->Flags & V_NVSYNC) ? CRTC_NVSYNC : 0);
+ data->block->PixelClock = best->Clock * 1000;
+ /* XXX May not have this. */
+ clock = VBEGetPixelClock(pVbe, data->mode, data->block->PixelClock);
+ DebugF("Setting clock %.2fMHz, closest is %.2fMHz\n",
+ (double) data->block->PixelClock / 1000000.0,
+ (double) clock / 1000000.0);
+ if (clock)
+ data->block->PixelClock = clock;
+ data->mode |= (1 << 11);
+ data->block->RefreshRate = ((double) (data->block->PixelClock) /
+ (double) (best->HTotal *
+ best->VTotal)) * 100;
+ }
+ pMode = pMode->next;
+ } while (pMode != pScrn->modes);
+}
+
+/*
+ * These wrappers are to allow (temporary) funtionality divergences.
+ */
+int
+VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+ char **modeNames, ClockRangePtr clockRanges,
+ int *linePitches, int minPitch, int maxPitch, int pitchInc,
+ int minHeight, int maxHeight, int virtualX, int virtualY,
+ int apertureSize, LookupModeFlags strategy)
+{
+ return xf86ValidateModes(scrp, availModes, modeNames, clockRanges,
+ linePitches, minPitch, maxPitch, pitchInc,
+ minHeight, maxHeight, virtualX, virtualY,
+ apertureSize, strategy);
+}
+
+void
+VBEPrintModes(ScrnInfoPtr scrp)
+{
+ xf86PrintModes(scrp);
+}
diff --git a/xorg-server/hw/xfree86/vbe/vbeModes.h b/xorg-server/hw/xfree86/vbe/vbeModes.h
index 447798709..affd5b639 100644
--- a/xorg-server/hw/xfree86/vbe/vbeModes.h
+++ b/xorg-server/hw/xfree86/vbe/vbeModes.h
@@ -62,29 +62,33 @@ typedef struct _VbeModeInfoData {
(f & V_MODETYPE_BAD)) && \
VBE_MODE_GRAPHICS(m) && \
(VBE_MODE_VGA(m) || VBE_MODE_LINEAR(m))
-
+
#define V_MODETYPE_VBE 0x01
#define V_MODETYPE_VGA 0x02
#define V_MODETYPE_BAD 0x04
-extern _X_EXPORT int VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock *vbe,
- int *flags24, int modeTypes);
-extern _X_EXPORT DisplayModePtr VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe,
- VbeInfoBlock *vbe, int modeTypes);
+extern _X_EXPORT int VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock * vbe,
+ int *flags24, int modeTypes);
+extern _X_EXPORT DisplayModePtr VBEGetModePool(ScrnInfoPtr pScrn,
+ vbeInfoPtr pVbe,
+ VbeInfoBlock * vbe,
+ int modeTypes);
extern _X_EXPORT void VBESetModeNames(DisplayModePtr pMode);
extern _X_EXPORT void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe);
-
/*
* Note: These are alternatives to the standard helpers. They should
* usually just wrap the standard helpers.
*/
-extern _X_EXPORT int VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
- char **modeNames, ClockRangePtr clockRanges,
- int *linePitches, int minPitch, int maxPitch,
- int pitchInc, int minHeight, int maxHeight,
- int virtualX, int virtualY, int apertureSize,
- LookupModeFlags strategy);
+extern _X_EXPORT int VBEValidateModes(ScrnInfoPtr scrp,
+ DisplayModePtr availModes,
+ char **modeNames,
+ ClockRangePtr clockRanges,
+ int *linePitches, int minPitch,
+ int maxPitch, int pitchInc, int minHeight,
+ int maxHeight, int virtualX, int virtualY,
+ int apertureSize,
+ LookupModeFlags strategy);
extern _X_EXPORT void VBEPrintModes(ScrnInfoPtr scrp);
-#endif /* VBE_MODES_H */
+#endif /* VBE_MODES_H */
diff --git a/xorg-server/hw/xfree86/vbe/vbe_module.c b/xorg-server/hw/xfree86/vbe/vbe_module.c
index 5aba16f51..3fb86956e 100644
--- a/xorg-server/hw/xfree86/vbe/vbe_module.c
+++ b/xorg-server/hw/xfree86/vbe/vbe_module.c
@@ -1,23 +1,22 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86str.h"
-#include "vbe.h"
-
-static XF86ModuleVersionInfo vbeVersRec =
-{
- "vbe",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 1, 0,
- ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData vbeModuleData = { &vbeVersRec, NULL, NULL };
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86str.h"
+#include "vbe.h"
+
+static XF86ModuleVersionInfo vbeVersRec = {
+ "vbe",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 1, 0,
+ ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData vbeModuleData = { &vbeVersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/vgahw/vgaCmap.c b/xorg-server/hw/xfree86/vgahw/vgaCmap.c
index a65bb5e86..0cfabc5d6 100644
--- a/xorg-server/hw/xfree86/vgahw/vgaCmap.c
+++ b/xorg-server/hw/xfree86/vgahw/vgaCmap.c
@@ -1,301 +1,279 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "windowstr.h"
-#include "compiler.h"
-#include "mipointer.h"
-#include "micmap.h"
-
-#include "xf86.h"
-#include "vgaHW.h"
-
-#include <X11/extensions/xf86dgaproto.h>
-#include "dgaproc.h"
-
-
-#define NOMAPYET (ColormapPtr) 0
-
-int
-vgaListInstalledColormaps(pScreen, pmaps)
- ScreenPtr pScreen;
- Colormap *pmaps;
-{
- /* By the time we are processing requests, we can guarantee that there
- * is always a colormap installed */
-
- *pmaps = GetInstalledmiColormap(pScreen)->mid;
- return 1;
-}
-
-int
-vgaGetInstalledColormaps(pScreen, pmaps)
- ScreenPtr pScreen;
- ColormapPtr *pmaps;
-{
- /* By the time we are processing requests, we can guarantee that there
- * is always a colormap installed */
-
- *pmaps = GetInstalledmiColormap(pScreen);
- return 1;
-}
-
-int vgaCheckColorMap(ColormapPtr pmap)
-{
- return (pmap != GetInstalledmiColormap(pmap->pScreen));
-}
-
-
-void
-vgaStoreColors(pmap, ndef, pdefs)
- ColormapPtr pmap;
- int ndef;
- xColorItem *pdefs;
-{
- int i;
- unsigned char *cmap, *tmp = NULL;
- xColorItem directDefs[256];
- Bool new_overscan = FALSE;
- Bool writeColormap;
-
- /* This can get called before the ScrnInfoRec is installed so we
- can't rely on getting it with XF86SCRNINFO() */
- int scrnIndex = pmap->pScreen->myNum;
- ScrnInfoPtr scrninfp = xf86Screens[scrnIndex];
- vgaHWPtr hwp = VGAHWPTR(scrninfp);
-
- unsigned char overscan = hwp->ModeReg.Attribute[OVERSCAN];
- unsigned char tmp_overscan = 0;
-
- if (vgaCheckColorMap(pmap))
- return;
-
- if ((pmap->pVisual->class | DynamicClass) == DirectColor)
- {
- ndef = miExpandDirectColors (pmap, ndef, pdefs, directDefs);
- pdefs = directDefs;
- }
-
- writeColormap = scrninfp->vtSema;
- if (DGAAvailable(scrnIndex))
- {
- writeColormap = writeColormap ||
- (DGAGetDirectMode(scrnIndex) &&
- !(DGAGetFlags(scrnIndex) & XF86DGADirectColormap)) ||
- (DGAGetFlags(scrnIndex) & XF86DGAHasColormap);
- }
-
- if (writeColormap)
- hwp->enablePalette(hwp);
-
- for(i = 0; i < ndef; i++)
- {
- if (pdefs[i].pixel == overscan)
- {
- new_overscan = TRUE;
- }
- cmap = &(hwp->ModeReg.DAC[pdefs[i].pixel*3]);
- if (scrninfp->rgbBits == 8) {
- cmap[0] = pdefs[i].red >> 8;
- cmap[1] = pdefs[i].green >> 8;
- cmap[2] = pdefs[i].blue >> 8;
- }
- else {
- cmap[0] = pdefs[i].red >> 10;
- cmap[1] = pdefs[i].green >> 10;
- cmap[2] = pdefs[i].blue >> 10;
- }
-#if 0
- if (clgd6225Lcd)
- {
- /* The LCD doesn't like white */
- if (cmap[0] == 63) cmap[0]= 62;
- if (cmap[1] == 63) cmap[1]= 62;
- if (cmap[2] == 63) cmap[2]= 62;
- }
-#endif
-
- if (writeColormap)
- {
- if (hwp->ShowOverscan && i == 255)
- continue;
- hwp->writeDacWriteAddr(hwp, pdefs[i].pixel);
- DACDelay(hwp);
- hwp->writeDacData(hwp, cmap[0]);
- DACDelay(hwp);
- hwp->writeDacData(hwp, cmap[1]);
- DACDelay(hwp);
- hwp->writeDacData(hwp, cmap[2]);
- DACDelay(hwp);
- }
- }
- if (new_overscan && !hwp->ShowOverscan)
- {
- new_overscan = FALSE;
- for(i = 0; i < ndef; i++)
- {
- if (pdefs[i].pixel == overscan)
- {
- if ((pdefs[i].red != 0) ||
- (pdefs[i].green != 0) ||
- (pdefs[i].blue != 0))
- {
- new_overscan = TRUE;
- tmp_overscan = overscan;
- tmp = &(hwp->ModeReg.DAC[pdefs[i].pixel*3]);
- }
- break;
- }
- }
- if (new_overscan)
- {
- /*
- * Find a black pixel, or the nearest match.
- */
- for (i=255; i >= 0; i--)
- {
- cmap = &(hwp->ModeReg.DAC[i*3]);
- if ((cmap[0] == 0) && (cmap[1] == 0) && (cmap[2] == 0))
- {
- overscan = i;
- break;
- }
- else
- {
- if ((cmap[0] < tmp[0]) &&
- (cmap[1] < tmp[1]) && (cmap[2] < tmp[2]))
- {
- tmp = cmap;
- tmp_overscan = i;
- }
- }
- }
- if (i < 0)
- {
- overscan = tmp_overscan;
- }
- hwp->ModeReg.Attribute[OVERSCAN] = overscan;
- if (writeColormap)
- {
- hwp->writeAttr(hwp, OVERSCAN, overscan);
- }
- }
- }
-
- if (writeColormap)
- hwp->disablePalette(hwp);
-}
-
-
-void
-vgaInstallColormap(pmap)
- ColormapPtr pmap;
-{
- ColormapPtr oldmap = GetInstalledmiColormap(pmap->pScreen);
- int entries;
- Pixel * ppix;
- xrgb * prgb;
- xColorItem *defs;
- int i;
-
-
- if (pmap == oldmap)
- return;
-
- if ((pmap->pVisual->class | DynamicClass) == DirectColor)
- entries = (pmap->pVisual->redMask |
- pmap->pVisual->greenMask |
- pmap->pVisual->blueMask) + 1;
- else
- entries = pmap->pVisual->ColormapEntries;
-
- ppix = (Pixel *)malloc( entries * sizeof(Pixel));
- prgb = (xrgb *)malloc( entries * sizeof(xrgb));
- defs = (xColorItem *)malloc(entries * sizeof(xColorItem));
-
- if ( oldmap != NOMAPYET)
- WalkTree( pmap->pScreen, TellLostMap, &oldmap->mid);
-
- SetInstalledmiColormap(pmap->pScreen, pmap);
-
- for ( i=0; i<entries; i++) ppix[i] = i;
-
- QueryColors(pmap, entries, ppix, prgb, serverClient);
-
- for ( i=0; i<entries; i++) /* convert xrgbs to xColorItems */
- {
- defs[i].pixel = ppix[i];
- defs[i].red = prgb[i].red;
- defs[i].green = prgb[i].green;
- defs[i].blue = prgb[i].blue;
- defs[i].flags = DoRed|DoGreen|DoBlue;
- }
- pmap->pScreen->StoreColors(pmap, entries, defs);
-
- WalkTree(pmap->pScreen, TellGainedMap, &pmap->mid);
-
- free(ppix);
- free(prgb);
- free(defs);
-}
-
-
-void
-vgaUninstallColormap(pmap)
- ColormapPtr pmap;
-{
-
- ColormapPtr defColormap;
-
- if ( pmap != GetInstalledmiColormap(pmap->pScreen))
- return;
-
- dixLookupResourceByType((pointer *)&defColormap, pmap->pScreen->defColormap,
- RT_COLORMAP, serverClient, DixInstallAccess);
-
- if (defColormap == GetInstalledmiColormap(pmap->pScreen))
- return;
-
- (*pmap->pScreen->InstallColormap) (defColormap);
-}
-
-
-void
-vgaHandleColormaps(ScreenPtr pScreen, ScrnInfoPtr scrnp)
-{
- if (scrnp->bitsPerPixel > 1) {
- if (scrnp->bitsPerPixel <= 8) { /* For 8bpp SVGA and VGA16 */
- pScreen->InstallColormap = vgaInstallColormap;
- pScreen->UninstallColormap = vgaUninstallColormap;
- pScreen->ListInstalledColormaps = vgaListInstalledColormaps;
- pScreen->StoreColors = vgaStoreColors;
- }
- }
-}
-
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "windowstr.h"
+#include "compiler.h"
+#include "mipointer.h"
+#include "micmap.h"
+
+#include "xf86.h"
+#include "vgaHW.h"
+
+#include <X11/extensions/xf86dgaproto.h>
+#include "dgaproc.h"
+
+#define NOMAPYET (ColormapPtr) 0
+
+int
+vgaListInstalledColormaps(pScreen, pmaps)
+ScreenPtr pScreen;
+Colormap *pmaps;
+{
+ /* By the time we are processing requests, we can guarantee that there
+ * is always a colormap installed */
+
+ *pmaps = GetInstalledmiColormap(pScreen)->mid;
+ return 1;
+}
+
+int
+vgaGetInstalledColormaps(pScreen, pmaps)
+ScreenPtr pScreen;
+ColormapPtr *pmaps;
+{
+ /* By the time we are processing requests, we can guarantee that there
+ * is always a colormap installed */
+
+ *pmaps = GetInstalledmiColormap(pScreen);
+ return 1;
+}
+
+int
+vgaCheckColorMap(ColormapPtr pmap)
+{
+ return (pmap != GetInstalledmiColormap(pmap->pScreen));
+}
+
+void
+vgaStoreColors(pmap, ndef, pdefs)
+ColormapPtr pmap;
+int ndef;
+xColorItem *pdefs;
+{
+ int i;
+ unsigned char *cmap, *tmp = NULL;
+ xColorItem directDefs[256];
+ Bool new_overscan = FALSE;
+ Bool writeColormap;
+
+ /* This can get called before the ScrnInfoRec is installed so we
+ can't rely on getting it with XF86SCRNINFO() */
+ int scrnIndex = pmap->pScreen->myNum;
+ ScrnInfoPtr scrninfp = xf86Screens[scrnIndex];
+ vgaHWPtr hwp = VGAHWPTR(scrninfp);
+
+ unsigned char overscan = hwp->ModeReg.Attribute[OVERSCAN];
+ unsigned char tmp_overscan = 0;
+
+ if (vgaCheckColorMap(pmap))
+ return;
+
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor) {
+ ndef = miExpandDirectColors(pmap, ndef, pdefs, directDefs);
+ pdefs = directDefs;
+ }
+
+ writeColormap = scrninfp->vtSema;
+ if (DGAAvailable(scrnIndex)) {
+ writeColormap = writeColormap ||
+ (DGAGetDirectMode(scrnIndex) &&
+ !(DGAGetFlags(scrnIndex) & XF86DGADirectColormap)) ||
+ (DGAGetFlags(scrnIndex) & XF86DGAHasColormap);
+ }
+
+ if (writeColormap)
+ hwp->enablePalette(hwp);
+
+ for (i = 0; i < ndef; i++) {
+ if (pdefs[i].pixel == overscan) {
+ new_overscan = TRUE;
+ }
+ cmap = &(hwp->ModeReg.DAC[pdefs[i].pixel * 3]);
+ if (scrninfp->rgbBits == 8) {
+ cmap[0] = pdefs[i].red >> 8;
+ cmap[1] = pdefs[i].green >> 8;
+ cmap[2] = pdefs[i].blue >> 8;
+ }
+ else {
+ cmap[0] = pdefs[i].red >> 10;
+ cmap[1] = pdefs[i].green >> 10;
+ cmap[2] = pdefs[i].blue >> 10;
+ }
+#if 0
+ if (clgd6225Lcd) {
+ /* The LCD doesn't like white */
+ if (cmap[0] == 63)
+ cmap[0] = 62;
+ if (cmap[1] == 63)
+ cmap[1] = 62;
+ if (cmap[2] == 63)
+ cmap[2] = 62;
+ }
+#endif
+
+ if (writeColormap) {
+ if (hwp->ShowOverscan && i == 255)
+ continue;
+ hwp->writeDacWriteAddr(hwp, pdefs[i].pixel);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, cmap[0]);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, cmap[1]);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, cmap[2]);
+ DACDelay(hwp);
+ }
+ }
+ if (new_overscan && !hwp->ShowOverscan) {
+ new_overscan = FALSE;
+ for (i = 0; i < ndef; i++) {
+ if (pdefs[i].pixel == overscan) {
+ if ((pdefs[i].red != 0) ||
+ (pdefs[i].green != 0) || (pdefs[i].blue != 0)) {
+ new_overscan = TRUE;
+ tmp_overscan = overscan;
+ tmp = &(hwp->ModeReg.DAC[pdefs[i].pixel * 3]);
+ }
+ break;
+ }
+ }
+ if (new_overscan) {
+ /*
+ * Find a black pixel, or the nearest match.
+ */
+ for (i = 255; i >= 0; i--) {
+ cmap = &(hwp->ModeReg.DAC[i * 3]);
+ if ((cmap[0] == 0) && (cmap[1] == 0) && (cmap[2] == 0)) {
+ overscan = i;
+ break;
+ }
+ else {
+ if ((cmap[0] < tmp[0]) &&
+ (cmap[1] < tmp[1]) && (cmap[2] < tmp[2])) {
+ tmp = cmap;
+ tmp_overscan = i;
+ }
+ }
+ }
+ if (i < 0) {
+ overscan = tmp_overscan;
+ }
+ hwp->ModeReg.Attribute[OVERSCAN] = overscan;
+ if (writeColormap) {
+ hwp->writeAttr(hwp, OVERSCAN, overscan);
+ }
+ }
+ }
+
+ if (writeColormap)
+ hwp->disablePalette(hwp);
+}
+
+void
+vgaInstallColormap(pmap)
+ColormapPtr pmap;
+{
+ ColormapPtr oldmap = GetInstalledmiColormap(pmap->pScreen);
+ int entries;
+ Pixel *ppix;
+ xrgb *prgb;
+ xColorItem *defs;
+ int i;
+
+ if (pmap == oldmap)
+ return;
+
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor)
+ entries = (pmap->pVisual->redMask |
+ pmap->pVisual->greenMask | pmap->pVisual->blueMask) + 1;
+ else
+ entries = pmap->pVisual->ColormapEntries;
+
+ ppix = (Pixel *) malloc(entries * sizeof(Pixel));
+ prgb = (xrgb *) malloc(entries * sizeof(xrgb));
+ defs = (xColorItem *) malloc(entries * sizeof(xColorItem));
+
+ if (oldmap != NOMAPYET)
+ WalkTree(pmap->pScreen, TellLostMap, &oldmap->mid);
+
+ SetInstalledmiColormap(pmap->pScreen, pmap);
+
+ for (i = 0; i < entries; i++)
+ ppix[i] = i;
+
+ QueryColors(pmap, entries, ppix, prgb, serverClient);
+
+ for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
+ defs[i].pixel = ppix[i];
+ defs[i].red = prgb[i].red;
+ defs[i].green = prgb[i].green;
+ defs[i].blue = prgb[i].blue;
+ defs[i].flags = DoRed | DoGreen | DoBlue;
+ }
+ pmap->pScreen->StoreColors(pmap, entries, defs);
+
+ WalkTree(pmap->pScreen, TellGainedMap, &pmap->mid);
+
+ free(ppix);
+ free(prgb);
+ free(defs);
+}
+
+void
+vgaUninstallColormap(pmap)
+ColormapPtr pmap;
+{
+
+ ColormapPtr defColormap;
+
+ if (pmap != GetInstalledmiColormap(pmap->pScreen))
+ return;
+
+ dixLookupResourceByType((pointer *) &defColormap,
+ pmap->pScreen->defColormap, RT_COLORMAP,
+ serverClient, DixInstallAccess);
+
+ if (defColormap == GetInstalledmiColormap(pmap->pScreen))
+ return;
+
+ (*pmap->pScreen->InstallColormap) (defColormap);
+}
+
+void
+vgaHandleColormaps(ScreenPtr pScreen, ScrnInfoPtr scrnp)
+{
+ if (scrnp->bitsPerPixel > 1) {
+ if (scrnp->bitsPerPixel <= 8) { /* For 8bpp SVGA and VGA16 */
+ pScreen->InstallColormap = vgaInstallColormap;
+ pScreen->UninstallColormap = vgaUninstallColormap;
+ pScreen->ListInstalledColormaps = vgaListInstalledColormaps;
+ pScreen->StoreColors = vgaStoreColors;
+ }
+ }
+}
diff --git a/xorg-server/hw/xfree86/vgahw/vgaHW.c b/xorg-server/hw/xfree86/vgahw/vgaHW.c
index 4036a01f5..e044682c7 100644
--- a/xorg-server/hw/xfree86/vgahw/vgaHW.c
+++ b/xorg-server/hw/xfree86/vgahw/vgaHW.c
@@ -75,7 +75,6 @@
#define BLACK_VALUE 0x00
#define OVERSCAN_VALUE 0x01
-
/* Use a private definition of this here */
#undef VGAHWPTR
#define VGAHWPTRLVAL(p) (p)->privates[vgaHWPrivateIndex].ptr
@@ -88,74 +87,73 @@ static int vgaHWPrivateIndex = -1;
#ifdef NEED_SAVED_CMAP
/* This default colourmap is used only when it can't be read from the VGA */
-static CARD8 defaultDAC[768] =
-{
- 0, 0, 0, 0, 0, 42, 0, 42, 0, 0, 42, 42,
- 42, 0, 0, 42, 0, 42, 42, 21, 0, 42, 42, 42,
- 21, 21, 21, 21, 21, 63, 21, 63, 21, 21, 63, 63,
- 63, 21, 21, 63, 21, 63, 63, 63, 21, 63, 63, 63,
- 0, 0, 0, 5, 5, 5, 8, 8, 8, 11, 11, 11,
- 14, 14, 14, 17, 17, 17, 20, 20, 20, 24, 24, 24,
- 28, 28, 28, 32, 32, 32, 36, 36, 36, 40, 40, 40,
- 45, 45, 45, 50, 50, 50, 56, 56, 56, 63, 63, 63,
- 0, 0, 63, 16, 0, 63, 31, 0, 63, 47, 0, 63,
- 63, 0, 63, 63, 0, 47, 63, 0, 31, 63, 0, 16,
- 63, 0, 0, 63, 16, 0, 63, 31, 0, 63, 47, 0,
- 63, 63, 0, 47, 63, 0, 31, 63, 0, 16, 63, 0,
- 0, 63, 0, 0, 63, 16, 0, 63, 31, 0, 63, 47,
- 0, 63, 63, 0, 47, 63, 0, 31, 63, 0, 16, 63,
- 31, 31, 63, 39, 31, 63, 47, 31, 63, 55, 31, 63,
- 63, 31, 63, 63, 31, 55, 63, 31, 47, 63, 31, 39,
- 63, 31, 31, 63, 39, 31, 63, 47, 31, 63, 55, 31,
- 63, 63, 31, 55, 63, 31, 47, 63, 31, 39, 63, 31,
- 31, 63, 31, 31, 63, 39, 31, 63, 47, 31, 63, 55,
- 31, 63, 63, 31, 55, 63, 31, 47, 63, 31, 39, 63,
- 45, 45, 63, 49, 45, 63, 54, 45, 63, 58, 45, 63,
- 63, 45, 63, 63, 45, 58, 63, 45, 54, 63, 45, 49,
- 63, 45, 45, 63, 49, 45, 63, 54, 45, 63, 58, 45,
- 63, 63, 45, 58, 63, 45, 54, 63, 45, 49, 63, 45,
- 45, 63, 45, 45, 63, 49, 45, 63, 54, 45, 63, 58,
- 45, 63, 63, 45, 58, 63, 45, 54, 63, 45, 49, 63,
- 0, 0, 28, 7, 0, 28, 14, 0, 28, 21, 0, 28,
- 28, 0, 28, 28, 0, 21, 28, 0, 14, 28, 0, 7,
- 28, 0, 0, 28, 7, 0, 28, 14, 0, 28, 21, 0,
- 28, 28, 0, 21, 28, 0, 14, 28, 0, 7, 28, 0,
- 0, 28, 0, 0, 28, 7, 0, 28, 14, 0, 28, 21,
- 0, 28, 28, 0, 21, 28, 0, 14, 28, 0, 7, 28,
- 14, 14, 28, 17, 14, 28, 21, 14, 28, 24, 14, 28,
- 28, 14, 28, 28, 14, 24, 28, 14, 21, 28, 14, 17,
- 28, 14, 14, 28, 17, 14, 28, 21, 14, 28, 24, 14,
- 28, 28, 14, 24, 28, 14, 21, 28, 14, 17, 28, 14,
- 14, 28, 14, 14, 28, 17, 14, 28, 21, 14, 28, 24,
- 14, 28, 28, 14, 24, 28, 14, 21, 28, 14, 17, 28,
- 20, 20, 28, 22, 20, 28, 24, 20, 28, 26, 20, 28,
- 28, 20, 28, 28, 20, 26, 28, 20, 24, 28, 20, 22,
- 28, 20, 20, 28, 22, 20, 28, 24, 20, 28, 26, 20,
- 28, 28, 20, 26, 28, 20, 24, 28, 20, 22, 28, 20,
- 20, 28, 20, 20, 28, 22, 20, 28, 24, 20, 28, 26,
- 20, 28, 28, 20, 26, 28, 20, 24, 28, 20, 22, 28,
- 0, 0, 16, 4, 0, 16, 8, 0, 16, 12, 0, 16,
- 16, 0, 16, 16, 0, 12, 16, 0, 8, 16, 0, 4,
- 16, 0, 0, 16, 4, 0, 16, 8, 0, 16, 12, 0,
- 16, 16, 0, 12, 16, 0, 8, 16, 0, 4, 16, 0,
- 0, 16, 0, 0, 16, 4, 0, 16, 8, 0, 16, 12,
- 0, 16, 16, 0, 12, 16, 0, 8, 16, 0, 4, 16,
- 8, 8, 16, 10, 8, 16, 12, 8, 16, 14, 8, 16,
- 16, 8, 16, 16, 8, 14, 16, 8, 12, 16, 8, 10,
- 16, 8, 8, 16, 10, 8, 16, 12, 8, 16, 14, 8,
- 16, 16, 8, 14, 16, 8, 12, 16, 8, 10, 16, 8,
- 8, 16, 8, 8, 16, 10, 8, 16, 12, 8, 16, 14,
- 8, 16, 16, 8, 14, 16, 8, 12, 16, 8, 10, 16,
- 11, 11, 16, 12, 11, 16, 13, 11, 16, 15, 11, 16,
- 16, 11, 16, 16, 11, 15, 16, 11, 13, 16, 11, 12,
- 16, 11, 11, 16, 12, 11, 16, 13, 11, 16, 15, 11,
- 16, 16, 11, 15, 16, 11, 13, 16, 11, 12, 16, 11,
- 11, 16, 11, 11, 16, 12, 11, 16, 13, 11, 16, 15,
- 11, 16, 16, 11, 15, 16, 11, 13, 16, 11, 12, 16,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+static CARD8 defaultDAC[768] = {
+ 0, 0, 0, 0, 0, 42, 0, 42, 0, 0, 42, 42,
+ 42, 0, 0, 42, 0, 42, 42, 21, 0, 42, 42, 42,
+ 21, 21, 21, 21, 21, 63, 21, 63, 21, 21, 63, 63,
+ 63, 21, 21, 63, 21, 63, 63, 63, 21, 63, 63, 63,
+ 0, 0, 0, 5, 5, 5, 8, 8, 8, 11, 11, 11,
+ 14, 14, 14, 17, 17, 17, 20, 20, 20, 24, 24, 24,
+ 28, 28, 28, 32, 32, 32, 36, 36, 36, 40, 40, 40,
+ 45, 45, 45, 50, 50, 50, 56, 56, 56, 63, 63, 63,
+ 0, 0, 63, 16, 0, 63, 31, 0, 63, 47, 0, 63,
+ 63, 0, 63, 63, 0, 47, 63, 0, 31, 63, 0, 16,
+ 63, 0, 0, 63, 16, 0, 63, 31, 0, 63, 47, 0,
+ 63, 63, 0, 47, 63, 0, 31, 63, 0, 16, 63, 0,
+ 0, 63, 0, 0, 63, 16, 0, 63, 31, 0, 63, 47,
+ 0, 63, 63, 0, 47, 63, 0, 31, 63, 0, 16, 63,
+ 31, 31, 63, 39, 31, 63, 47, 31, 63, 55, 31, 63,
+ 63, 31, 63, 63, 31, 55, 63, 31, 47, 63, 31, 39,
+ 63, 31, 31, 63, 39, 31, 63, 47, 31, 63, 55, 31,
+ 63, 63, 31, 55, 63, 31, 47, 63, 31, 39, 63, 31,
+ 31, 63, 31, 31, 63, 39, 31, 63, 47, 31, 63, 55,
+ 31, 63, 63, 31, 55, 63, 31, 47, 63, 31, 39, 63,
+ 45, 45, 63, 49, 45, 63, 54, 45, 63, 58, 45, 63,
+ 63, 45, 63, 63, 45, 58, 63, 45, 54, 63, 45, 49,
+ 63, 45, 45, 63, 49, 45, 63, 54, 45, 63, 58, 45,
+ 63, 63, 45, 58, 63, 45, 54, 63, 45, 49, 63, 45,
+ 45, 63, 45, 45, 63, 49, 45, 63, 54, 45, 63, 58,
+ 45, 63, 63, 45, 58, 63, 45, 54, 63, 45, 49, 63,
+ 0, 0, 28, 7, 0, 28, 14, 0, 28, 21, 0, 28,
+ 28, 0, 28, 28, 0, 21, 28, 0, 14, 28, 0, 7,
+ 28, 0, 0, 28, 7, 0, 28, 14, 0, 28, 21, 0,
+ 28, 28, 0, 21, 28, 0, 14, 28, 0, 7, 28, 0,
+ 0, 28, 0, 0, 28, 7, 0, 28, 14, 0, 28, 21,
+ 0, 28, 28, 0, 21, 28, 0, 14, 28, 0, 7, 28,
+ 14, 14, 28, 17, 14, 28, 21, 14, 28, 24, 14, 28,
+ 28, 14, 28, 28, 14, 24, 28, 14, 21, 28, 14, 17,
+ 28, 14, 14, 28, 17, 14, 28, 21, 14, 28, 24, 14,
+ 28, 28, 14, 24, 28, 14, 21, 28, 14, 17, 28, 14,
+ 14, 28, 14, 14, 28, 17, 14, 28, 21, 14, 28, 24,
+ 14, 28, 28, 14, 24, 28, 14, 21, 28, 14, 17, 28,
+ 20, 20, 28, 22, 20, 28, 24, 20, 28, 26, 20, 28,
+ 28, 20, 28, 28, 20, 26, 28, 20, 24, 28, 20, 22,
+ 28, 20, 20, 28, 22, 20, 28, 24, 20, 28, 26, 20,
+ 28, 28, 20, 26, 28, 20, 24, 28, 20, 22, 28, 20,
+ 20, 28, 20, 20, 28, 22, 20, 28, 24, 20, 28, 26,
+ 20, 28, 28, 20, 26, 28, 20, 24, 28, 20, 22, 28,
+ 0, 0, 16, 4, 0, 16, 8, 0, 16, 12, 0, 16,
+ 16, 0, 16, 16, 0, 12, 16, 0, 8, 16, 0, 4,
+ 16, 0, 0, 16, 4, 0, 16, 8, 0, 16, 12, 0,
+ 16, 16, 0, 12, 16, 0, 8, 16, 0, 4, 16, 0,
+ 0, 16, 0, 0, 16, 4, 0, 16, 8, 0, 16, 12,
+ 0, 16, 16, 0, 12, 16, 0, 8, 16, 0, 4, 16,
+ 8, 8, 16, 10, 8, 16, 12, 8, 16, 14, 8, 16,
+ 16, 8, 16, 16, 8, 14, 16, 8, 12, 16, 8, 10,
+ 16, 8, 8, 16, 10, 8, 16, 12, 8, 16, 14, 8,
+ 16, 16, 8, 14, 16, 8, 12, 16, 8, 10, 16, 8,
+ 8, 16, 8, 8, 16, 10, 8, 16, 12, 8, 16, 14,
+ 8, 16, 16, 8, 14, 16, 8, 12, 16, 8, 10, 16,
+ 11, 11, 16, 12, 11, 16, 13, 11, 16, 15, 11, 16,
+ 16, 11, 16, 16, 11, 15, 16, 11, 13, 16, 11, 12,
+ 16, 11, 11, 16, 12, 11, 16, 13, 11, 16, 15, 11,
+ 16, 16, 11, 15, 16, 11, 13, 16, 11, 12, 16, 11,
+ 11, 16, 11, 11, 16, 12, 11, 16, 13, 11, 16, 15,
+ 11, 16, 16, 11, 15, 16, 11, 13, 16, 11, 12, 16,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-#endif /* NEED_SAVED_CMAP */
+#endif /* NEED_SAVED_CMAP */
/*
* Standard VGA versions of the register access functions.
@@ -223,16 +221,16 @@ stdReadFCR(vgaHWPtr hwp)
static void
stdWriteFCR(vgaHWPtr hwp, CARD8 value)
{
- pci_io_write8(hwp->io, hwp->IOBase + VGA_FEATURE_W_OFFSET,value);
+ pci_io_write8(hwp->io, hwp->IOBase + VGA_FEATURE_W_OFFSET, value);
}
static void
stdWriteAttr(vgaHWPtr hwp, CARD8 index, CARD8 value)
{
if (hwp->paletteEnabled)
- index &= ~0x20;
+ index &= ~0x20;
else
- index |= 0x20;
+ index |= 0x20;
(void) pci_io_read8(hwp->io, hwp->IOBase + VGA_IN_STAT_1_OFFSET);
pci_io_write8(hwp->io, VGA_ATTR_INDEX, index);
@@ -243,9 +241,9 @@ static CARD8
stdReadAttr(vgaHWPtr hwp, CARD8 index)
{
if (hwp->paletteEnabled)
- index &= ~0x20;
+ index &= ~0x20;
else
- index |= 0x20;
+ index |= 0x20;
(void) pci_io_read8(hwp->io, hwp->IOBase + VGA_IN_STAT_1_OFFSET);
pci_io_write8(hwp->io, VGA_ATTR_INDEX, index);
@@ -331,30 +329,30 @@ stdWriteEnable(vgaHWPtr hwp, CARD8 value)
void
vgaHWSetStdFuncs(vgaHWPtr hwp)
{
- hwp->writeCrtc = stdWriteCrtc;
- hwp->readCrtc = stdReadCrtc;
- hwp->writeGr = stdWriteGr;
- hwp->readGr = stdReadGr;
- hwp->readST00 = stdReadST00;
- hwp->readST01 = stdReadST01;
- hwp->readFCR = stdReadFCR;
- hwp->writeFCR = stdWriteFCR;
- hwp->writeAttr = stdWriteAttr;
- hwp->readAttr = stdReadAttr;
- hwp->writeSeq = stdWriteSeq;
- hwp->readSeq = stdReadSeq;
- hwp->writeMiscOut = stdWriteMiscOut;
- hwp->readMiscOut = stdReadMiscOut;
- hwp->enablePalette = stdEnablePalette;
- hwp->disablePalette = stdDisablePalette;
- hwp->writeDacMask = stdWriteDacMask;
- hwp->readDacMask = stdReadDacMask;
- hwp->writeDacWriteAddr = stdWriteDacWriteAddr;
- hwp->writeDacReadAddr = stdWriteDacReadAddr;
- hwp->writeDacData = stdWriteDacData;
- hwp->readDacData = stdReadDacData;
- hwp->readEnable = stdReadEnable;
- hwp->writeEnable = stdWriteEnable;
+ hwp->writeCrtc = stdWriteCrtc;
+ hwp->readCrtc = stdReadCrtc;
+ hwp->writeGr = stdWriteGr;
+ hwp->readGr = stdReadGr;
+ hwp->readST00 = stdReadST00;
+ hwp->readST01 = stdReadST01;
+ hwp->readFCR = stdReadFCR;
+ hwp->writeFCR = stdWriteFCR;
+ hwp->writeAttr = stdWriteAttr;
+ hwp->readAttr = stdReadAttr;
+ hwp->writeSeq = stdWriteSeq;
+ hwp->readSeq = stdReadSeq;
+ hwp->writeMiscOut = stdWriteMiscOut;
+ hwp->readMiscOut = stdReadMiscOut;
+ hwp->enablePalette = stdEnablePalette;
+ hwp->disablePalette = stdDisablePalette;
+ hwp->writeDacMask = stdWriteDacMask;
+ hwp->readDacMask = stdReadDacMask;
+ hwp->writeDacWriteAddr = stdWriteDacWriteAddr;
+ hwp->writeDacReadAddr = stdWriteDacReadAddr;
+ hwp->writeDacData = stdWriteDacData;
+ hwp->readDacData = stdReadDacData;
+ hwp->readEnable = stdReadEnable;
+ hwp->writeEnable = stdWriteEnable;
hwp->io = pci_legacy_open_io(hwp->dev, 0, 64 * 1024);
}
@@ -431,16 +429,16 @@ mmioReadFCR(vgaHWPtr hwp)
static void
mmioWriteFCR(vgaHWPtr hwp, CARD8 value)
{
- moutb(hwp->IOBase + VGA_FEATURE_W_OFFSET,value);
+ moutb(hwp->IOBase + VGA_FEATURE_W_OFFSET, value);
}
static void
mmioWriteAttr(vgaHWPtr hwp, CARD8 index, CARD8 value)
{
if (hwp->paletteEnabled)
- index &= ~0x20;
+ index &= ~0x20;
else
- index |= 0x20;
+ index |= 0x20;
(void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
moutb(VGA_ATTR_INDEX, index);
@@ -451,9 +449,9 @@ static CARD8
mmioReadAttr(vgaHWPtr hwp, CARD8 index)
{
if (hwp->paletteEnabled)
- index &= ~0x20;
+ index &= ~0x20;
else
- index |= 0x20;
+ index |= 0x20;
(void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
moutb(VGA_ATTR_INDEX, index);
@@ -539,32 +537,32 @@ mmioWriteEnable(vgaHWPtr hwp, CARD8 value)
void
vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset)
{
- hwp->writeCrtc = mmioWriteCrtc;
- hwp->readCrtc = mmioReadCrtc;
- hwp->writeGr = mmioWriteGr;
- hwp->readGr = mmioReadGr;
- hwp->readST00 = mmioReadST00;
- hwp->readST01 = mmioReadST01;
- hwp->readFCR = mmioReadFCR;
- hwp->writeFCR = mmioWriteFCR;
- hwp->writeAttr = mmioWriteAttr;
- hwp->readAttr = mmioReadAttr;
- hwp->writeSeq = mmioWriteSeq;
- hwp->readSeq = mmioReadSeq;
- hwp->writeMiscOut = mmioWriteMiscOut;
- hwp->readMiscOut = mmioReadMiscOut;
- hwp->enablePalette = mmioEnablePalette;
- hwp->disablePalette = mmioDisablePalette;
- hwp->writeDacMask = mmioWriteDacMask;
- hwp->readDacMask = mmioReadDacMask;
- hwp->writeDacWriteAddr = mmioWriteDacWriteAddr;
- hwp->writeDacReadAddr = mmioWriteDacReadAddr;
- hwp->writeDacData = mmioWriteDacData;
- hwp->readDacData = mmioReadDacData;
- hwp->MMIOBase = base;
- hwp->MMIOOffset = offset;
- hwp->readEnable = mmioReadEnable;
- hwp->writeEnable = mmioWriteEnable;
+ hwp->writeCrtc = mmioWriteCrtc;
+ hwp->readCrtc = mmioReadCrtc;
+ hwp->writeGr = mmioWriteGr;
+ hwp->readGr = mmioReadGr;
+ hwp->readST00 = mmioReadST00;
+ hwp->readST01 = mmioReadST01;
+ hwp->readFCR = mmioReadFCR;
+ hwp->writeFCR = mmioWriteFCR;
+ hwp->writeAttr = mmioWriteAttr;
+ hwp->readAttr = mmioReadAttr;
+ hwp->writeSeq = mmioWriteSeq;
+ hwp->readSeq = mmioReadSeq;
+ hwp->writeMiscOut = mmioWriteMiscOut;
+ hwp->readMiscOut = mmioReadMiscOut;
+ hwp->enablePalette = mmioEnablePalette;
+ hwp->disablePalette = mmioDisablePalette;
+ hwp->writeDacMask = mmioWriteDacMask;
+ hwp->readDacMask = mmioReadDacMask;
+ hwp->writeDacWriteAddr = mmioWriteDacWriteAddr;
+ hwp->writeDacReadAddr = mmioWriteDacReadAddr;
+ hwp->writeDacData = mmioWriteDacData;
+ hwp->readDacData = mmioReadDacData;
+ hwp->MMIOBase = base;
+ hwp->MMIOOffset = offset;
+ hwp->readEnable = mmioReadEnable;
+ hwp->writeEnable = mmioWriteEnable;
}
/*
@@ -575,38 +573,41 @@ vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset)
void
vgaHWProtect(ScrnInfoPtr pScrn, Bool on)
{
- vgaHWPtr hwp = VGAHWPTR(pScrn);
-
- unsigned char tmp;
-
- if (pScrn->vtSema) {
- if (on) {
- /*
- * Turn off screen and disable sequencer.
- */
- tmp = hwp->readSeq(hwp, 0x01);
-
- vgaHWSeqReset(hwp, TRUE); /* start synchronous reset */
- hwp->writeSeq(hwp, 0x01, tmp | 0x20); /* disable the display */
-
- hwp->enablePalette(hwp);
- } else {
- /*
- * Reenable sequencer, then turn on screen.
- */
-
- tmp = hwp->readSeq(hwp, 0x01);
-
- hwp->writeSeq(hwp, 0x01, tmp & ~0x20); /* reenable display */
- vgaHWSeqReset(hwp, FALSE); /* clear synchronousreset */
-
- hwp->disablePalette(hwp);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ unsigned char tmp;
+
+ if (pScrn->vtSema) {
+ if (on) {
+ /*
+ * Turn off screen and disable sequencer.
+ */
+ tmp = hwp->readSeq(hwp, 0x01);
+
+ vgaHWSeqReset(hwp, TRUE); /* start synchronous reset */
+ hwp->writeSeq(hwp, 0x01, tmp | 0x20); /* disable the display */
+
+ hwp->enablePalette(hwp);
+ }
+ else {
+ /*
+ * Reenable sequencer, then turn on screen.
+ */
+
+ tmp = hwp->readSeq(hwp, 0x01);
+
+ hwp->writeSeq(hwp, 0x01, tmp & ~0x20); /* reenable display */
+ vgaHWSeqReset(hwp, FALSE); /* clear synchronousreset */
+
+ hwp->disablePalette(hwp);
+ }
}
- }
}
-vgaHWProtectProc *vgaHWProtectWeak(void) {
- return vgaHWProtect;
+vgaHWProtectProc *
+vgaHWProtectWeak(void)
+{
+ return vgaHWProtect;
}
/*
@@ -616,25 +617,28 @@ vgaHWProtectProc *vgaHWProtectWeak(void) {
void
vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on)
{
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- unsigned char scrn;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ unsigned char scrn;
- scrn = hwp->readSeq(hwp, 0x01);
+ scrn = hwp->readSeq(hwp, 0x01);
- if (on) {
- scrn &= ~0x20; /* enable screen */
- } else {
- scrn |= 0x20; /* blank screen */
- }
+ if (on) {
+ scrn &= ~0x20; /* enable screen */
+ }
+ else {
+ scrn |= 0x20; /* blank screen */
+ }
- vgaHWSeqReset(hwp, TRUE);
- hwp->writeSeq(hwp, 0x01, scrn); /* change mode */
- vgaHWSeqReset(hwp, FALSE);
+ vgaHWSeqReset(hwp, TRUE);
+ hwp->writeSeq(hwp, 0x01, scrn); /* change mode */
+ vgaHWSeqReset(hwp, FALSE);
}
-vgaHWBlankScreenProc *vgaHWBlankScreenWeak(void) {
- return vgaHWBlankScreen;
-}
+vgaHWBlankScreenProc *
+vgaHWBlankScreenWeak(void)
+{
+ return vgaHWBlankScreen;
+}
/*
* vgaHWSaveScreen -- blank the screen.
@@ -643,26 +647,25 @@ vgaHWBlankScreenProc *vgaHWBlankScreenWeak(void) {
Bool
vgaHWSaveScreen(ScreenPtr pScreen, int mode)
{
- ScrnInfoPtr pScrn = NULL;
- Bool on;
+ ScrnInfoPtr pScrn = NULL;
+ Bool on;
- if (pScreen != NULL)
- pScrn = xf86Screens[pScreen->myNum];
+ if (pScreen != NULL)
+ pScrn = xf86Screens[pScreen->myNum];
- on = xf86IsUnblank(mode);
+ on = xf86IsUnblank(mode);
#if 0
- if (on)
- SetTimeSinceLastInputEvent();
+ if (on)
+ SetTimeSinceLastInputEvent();
#endif
- if ((pScrn != NULL) && pScrn->vtSema) {
- vgaHWBlankScreen(pScrn, on);
- }
- return TRUE;
+ if ((pScrn != NULL) && pScrn->vtSema) {
+ vgaHWBlankScreen(pScrn, on);
+ }
+ return TRUE;
}
-
/*
* vgaHWDPMSSet -- Sets VESA Display Power Management Signaling (DPMS) Mode
*
@@ -674,42 +677,42 @@ vgaHWSaveScreen(ScreenPtr pScreen, int mode)
void
vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
{
- unsigned char seq1 = 0, crtc17 = 0;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
-
- if (!pScrn->vtSema) return;
-
- switch (PowerManagementMode) {
- case DPMSModeOn:
- /* Screen: On; HSync: On, VSync: On */
- seq1 = 0x00;
- crtc17 = 0x80;
- break;
- case DPMSModeStandby:
- /* Screen: Off; HSync: Off, VSync: On -- Not Supported */
- seq1 = 0x20;
- crtc17 = 0x80;
- break;
- case DPMSModeSuspend:
- /* Screen: Off; HSync: On, VSync: Off -- Not Supported */
- seq1 = 0x20;
- crtc17 = 0x80;
- break;
- case DPMSModeOff:
- /* Screen: Off; HSync: Off, VSync: Off */
- seq1 = 0x20;
- crtc17 = 0x00;
- break;
- }
- hwp->writeSeq(hwp, 0x00, 0x01); /* Synchronous Reset */
- seq1 |= hwp->readSeq(hwp, 0x01) & ~0x20;
- hwp->writeSeq(hwp, 0x01, seq1);
- crtc17 |= hwp->readCrtc(hwp, 0x17) & ~0x80;
- usleep(10000);
- hwp->writeCrtc(hwp, 0x17, crtc17);
- hwp->writeSeq(hwp, 0x00, 0x03); /* End Reset */
-}
+ unsigned char seq1 = 0, crtc17 = 0;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ if (!pScrn->vtSema)
+ return;
+
+ switch (PowerManagementMode) {
+ case DPMSModeOn:
+ /* Screen: On; HSync: On, VSync: On */
+ seq1 = 0x00;
+ crtc17 = 0x80;
+ break;
+ case DPMSModeStandby:
+ /* Screen: Off; HSync: Off, VSync: On -- Not Supported */
+ seq1 = 0x20;
+ crtc17 = 0x80;
+ break;
+ case DPMSModeSuspend:
+ /* Screen: Off; HSync: On, VSync: Off -- Not Supported */
+ seq1 = 0x20;
+ crtc17 = 0x80;
+ break;
+ case DPMSModeOff:
+ /* Screen: Off; HSync: Off, VSync: Off */
+ seq1 = 0x20;
+ crtc17 = 0x00;
+ break;
+ }
+ hwp->writeSeq(hwp, 0x00, 0x01); /* Synchronous Reset */
+ seq1 |= hwp->readSeq(hwp, 0x01) & ~0x20;
+ hwp->writeSeq(hwp, 0x01, seq1);
+ crtc17 |= hwp->readCrtc(hwp, 0x17) & ~0x80;
+ usleep(10000);
+ hwp->writeCrtc(hwp, 0x17, crtc17);
+ hwp->writeSeq(hwp, 0x00, 0x03); /* End Reset */
+}
/*
* vgaHWSeqReset
@@ -719,13 +722,12 @@ vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
void
vgaHWSeqReset(vgaHWPtr hwp, Bool start)
{
- if (start)
- hwp->writeSeq(hwp, 0x00, 0x01); /* Synchronous Reset */
- else
- hwp->writeSeq(hwp, 0x00, 0x03); /* End Reset */
+ if (start)
+ hwp->writeSeq(hwp, 0x00, 0x01); /* Synchronous Reset */
+ else
+ hwp->writeSeq(hwp, 0x00, 0x03); /* End Reset */
}
-
void
vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
{
@@ -737,15 +739,15 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
/* If nothing to do, return now */
if (!hwp->FontInfo1 && !hwp->FontInfo2 && !hwp->TextInfo)
- return;
+ return;
if (hwp->Base == NULL) {
- doMap = TRUE;
- if (!vgaHWMapMem(scrninfp)) {
- xf86DrvMsg(scrninfp->scrnIndex, X_ERROR,
- "vgaHWRestoreFonts: vgaHWMapMem() failed\n");
- return;
- }
+ doMap = TRUE;
+ if (!vgaHWMapMem(scrninfp)) {
+ xf86DrvMsg(scrninfp->scrnIndex, X_ERROR,
+ "vgaHWRestoreFonts: vgaHWMapMem() failed\n");
+ return;
+ }
}
/* save the registers that are needed here */
@@ -776,45 +778,45 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
* BUG ALERT: The (S)VGA's segment-select register MUST be set correctly!
*/
#if 0
- hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */
+ hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */
#endif
- hwp->writeSeq(hwp, 0x04, 0x06); /* enable plane graphics */
- hwp->writeGr(hwp, 0x05, 0x00); /* write mode 0, read mode 0 */
- hwp->writeGr(hwp, 0x06, 0x05); /* set graphics */
+ hwp->writeSeq(hwp, 0x04, 0x06); /* enable plane graphics */
+ hwp->writeGr(hwp, 0x05, 0x00); /* write mode 0, read mode 0 */
+ hwp->writeGr(hwp, 0x06, 0x05); /* set graphics */
if (scrninfp->depth == 4) {
- /* GJA */
- hwp->writeGr(hwp, 0x03, 0x00); /* don't rotate, write unmodified */
- hwp->writeGr(hwp, 0x08, 0xFF); /* write all bits in a byte */
- hwp->writeGr(hwp, 0x01, 0x00); /* all planes come from CPU */
+ /* GJA */
+ hwp->writeGr(hwp, 0x03, 0x00); /* don't rotate, write unmodified */
+ hwp->writeGr(hwp, 0x08, 0xFF); /* write all bits in a byte */
+ hwp->writeGr(hwp, 0x01, 0x00); /* all planes come from CPU */
}
#if SAVE_FONT1
if (hwp->FontInfo1) {
- hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
- hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */
- slowbcopy_tobus(hwp->FontInfo1, hwp->Base, FONT_AMOUNT);
+ hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
+ hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */
+ slowbcopy_tobus(hwp->FontInfo1, hwp->Base, FONT_AMOUNT);
}
#endif
#if SAVE_FONT2
if (hwp->FontInfo2) {
- hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */
- hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */
- slowbcopy_tobus(hwp->FontInfo2, hwp->Base, FONT_AMOUNT);
+ hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */
+ hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */
+ slowbcopy_tobus(hwp->FontInfo2, hwp->Base, FONT_AMOUNT);
}
#endif
#if SAVE_TEXT
if (hwp->TextInfo) {
- hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */
- hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */
- slowbcopy_tobus(hwp->TextInfo, hwp->Base, TEXT_AMOUNT);
- hwp->writeSeq(hwp, 0x02, 0x02); /* write to plane 1 */
- hwp->writeGr(hwp, 0x04, 0x01); /* read plane 1 */
- slowbcopy_tobus((unsigned char *)hwp->TextInfo + TEXT_AMOUNT,
- hwp->Base, TEXT_AMOUNT);
+ hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */
+ hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */
+ slowbcopy_tobus(hwp->TextInfo, hwp->Base, TEXT_AMOUNT);
+ hwp->writeSeq(hwp, 0x02, 0x02); /* write to plane 1 */
+ hwp->writeGr(hwp, 0x04, 0x01); /* read plane 1 */
+ slowbcopy_tobus((unsigned char *) hwp->TextInfo + TEXT_AMOUNT,
+ hwp->Base, TEXT_AMOUNT);
}
#endif
@@ -834,12 +836,11 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
hwp->IOBase = savedIOBase;
if (doMap)
- vgaHWUnmapMem(scrninfp);
+ vgaHWUnmapMem(scrninfp);
-#endif /* SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 */
+#endif /* SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 */
}
-
void
vgaHWRestoreMode(ScrnInfoPtr scrninfp, vgaRegPtr restore)
{
@@ -847,31 +848,30 @@ vgaHWRestoreMode(ScrnInfoPtr scrninfp, vgaRegPtr restore)
int i;
if (restore->MiscOutReg & 0x01)
- hwp->IOBase = VGA_IOBASE_COLOR;
+ hwp->IOBase = VGA_IOBASE_COLOR;
else
- hwp->IOBase = VGA_IOBASE_MONO;
+ hwp->IOBase = VGA_IOBASE_MONO;
hwp->writeMiscOut(hwp, restore->MiscOutReg);
for (i = 1; i < restore->numSequencer; i++)
- hwp->writeSeq(hwp, i, restore->Sequencer[i]);
-
+ hwp->writeSeq(hwp, i, restore->Sequencer[i]);
+
/* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 of CRTC[17] */
hwp->writeCrtc(hwp, 17, restore->CRTC[17] & ~0x80);
for (i = 0; i < restore->numCRTC; i++)
- hwp->writeCrtc(hwp, i, restore->CRTC[i]);
+ hwp->writeCrtc(hwp, i, restore->CRTC[i]);
for (i = 0; i < restore->numGraphics; i++)
- hwp->writeGr(hwp, i, restore->Graphics[i]);
+ hwp->writeGr(hwp, i, restore->Graphics[i]);
hwp->enablePalette(hwp);
for (i = 0; i < restore->numAttribute; i++)
- hwp->writeAttr(hwp, i, restore->Attribute[i]);
+ hwp->writeAttr(hwp, i, restore->Attribute[i]);
hwp->disablePalette(hwp);
}
-
void
vgaHWRestoreColormap(ScrnInfoPtr scrninfp, vgaRegPtr restore)
{
@@ -885,14 +885,13 @@ vgaHWRestoreColormap(ScrnInfoPtr scrninfp, vgaRegPtr restore)
hwp->writeDacMask(hwp, 0xFF);
hwp->writeDacWriteAddr(hwp, 0x00);
for (i = 0; i < 768; i++) {
- hwp->writeDacData(hwp, restore->DAC[i]);
- DACDelay(hwp);
+ hwp->writeDacData(hwp, restore->DAC[i]);
+ DACDelay(hwp);
}
hwp->disablePalette(hwp);
}
-
/*
* vgaHWRestore --
* restore the VGA state
@@ -902,13 +901,13 @@ void
vgaHWRestore(ScrnInfoPtr scrninfp, vgaRegPtr restore, int flags)
{
if (flags & VGA_SR_MODE)
- vgaHWRestoreMode(scrninfp, restore);
+ vgaHWRestoreMode(scrninfp, restore);
if (flags & VGA_SR_FONTS)
- vgaHWRestoreFonts(scrninfp, restore);
+ vgaHWRestoreFonts(scrninfp, restore);
if (flags & VGA_SR_CMAP)
- vgaHWRestoreColormap(scrninfp, restore);
+ vgaHWRestoreColormap(scrninfp, restore);
}
void
@@ -921,18 +920,18 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
Bool doMap = FALSE;
if (hwp->Base == NULL) {
- doMap = TRUE;
- if (!vgaHWMapMem(scrninfp)) {
- xf86DrvMsg(scrninfp->scrnIndex, X_ERROR,
- "vgaHWSaveFonts: vgaHWMapMem() failed\n");
- return;
- }
+ doMap = TRUE;
+ if (!vgaHWMapMem(scrninfp)) {
+ xf86DrvMsg(scrninfp->scrnIndex, X_ERROR,
+ "vgaHWSaveFonts: vgaHWMapMem() failed\n");
+ return;
+ }
}
/* If in graphics mode, don't save anything */
attr10 = hwp->readAttr(hwp, 0x10);
if (attr10 & 0x01)
- return;
+ return;
/* save the registers that are needed here */
miscOut = hwp->readMiscOut(hwp);
@@ -950,7 +949,7 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
hwp->writeMiscOut(hwp, miscOut | 0x01);
vgaHWBlankScreen(scrninfp, FALSE);
-
+
/*
* get the character sets, and text screen if required
*/
@@ -961,38 +960,39 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
* BUG ALERT: The (S)VGA's segment-select register MUST be set correctly!
*/
#if 0
- hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */
+ hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */
#endif
- hwp->writeSeq(hwp, 0x04, 0x06); /* enable plane graphics */
- hwp->writeGr(hwp, 0x05, 0x00); /* write mode 0, read mode 0 */
- hwp->writeGr(hwp, 0x06, 0x05); /* set graphics */
+ hwp->writeSeq(hwp, 0x04, 0x06); /* enable plane graphics */
+ hwp->writeGr(hwp, 0x05, 0x00); /* write mode 0, read mode 0 */
+ hwp->writeGr(hwp, 0x06, 0x05); /* set graphics */
#if SAVE_FONT1
if (hwp->FontInfo1 || (hwp->FontInfo1 = malloc(FONT_AMOUNT))) {
- hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
- hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */
- slowbcopy_frombus(hwp->Base, hwp->FontInfo1, FONT_AMOUNT);
+ hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
+ hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */
+ slowbcopy_frombus(hwp->Base, hwp->FontInfo1, FONT_AMOUNT);
}
-#endif /* SAVE_FONT1 */
+#endif /* SAVE_FONT1 */
#if SAVE_FONT2
if (hwp->FontInfo2 || (hwp->FontInfo2 = malloc(FONT_AMOUNT))) {
- hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */
- hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */
- slowbcopy_frombus(hwp->Base, hwp->FontInfo2, FONT_AMOUNT);
+ hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */
+ hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */
+ slowbcopy_frombus(hwp->Base, hwp->FontInfo2, FONT_AMOUNT);
}
-#endif /* SAVE_FONT2 */
+#endif /* SAVE_FONT2 */
#if SAVE_TEXT
if (hwp->TextInfo || (hwp->TextInfo = malloc(2 * TEXT_AMOUNT))) {
- hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */
- hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */
- slowbcopy_frombus(hwp->Base, hwp->TextInfo, TEXT_AMOUNT);
- hwp->writeSeq(hwp, 0x02, 0x02); /* write to plane 1 */
- hwp->writeGr(hwp, 0x04, 0x01); /* read plane 1 */
- slowbcopy_frombus(hwp->Base,
- (unsigned char *)hwp->TextInfo + TEXT_AMOUNT, TEXT_AMOUNT);
+ hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */
+ hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */
+ slowbcopy_frombus(hwp->Base, hwp->TextInfo, TEXT_AMOUNT);
+ hwp->writeSeq(hwp, 0x02, 0x02); /* write to plane 1 */
+ hwp->writeGr(hwp, 0x04, 0x01); /* read plane 1 */
+ slowbcopy_frombus(hwp->Base,
+ (unsigned char *) hwp->TextInfo + TEXT_AMOUNT,
+ TEXT_AMOUNT);
}
-#endif /* SAVE_TEXT */
+#endif /* SAVE_TEXT */
/* Restore clobbered registers */
hwp->writeAttr(hwp, 0x10, attr10);
@@ -1007,9 +1007,9 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
vgaHWBlankScreen(scrninfp, TRUE);
if (doMap)
- vgaHWUnmapMem(scrninfp);
+ vgaHWUnmapMem(scrninfp);
-#endif /* SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 */
+#endif /* SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 */
}
void
@@ -1020,34 +1020,33 @@ vgaHWSaveMode(ScrnInfoPtr scrninfp, vgaRegPtr save)
save->MiscOutReg = hwp->readMiscOut(hwp);
if (save->MiscOutReg & 0x01)
- hwp->IOBase = VGA_IOBASE_COLOR;
+ hwp->IOBase = VGA_IOBASE_COLOR;
else
- hwp->IOBase = VGA_IOBASE_MONO;
+ hwp->IOBase = VGA_IOBASE_MONO;
for (i = 0; i < save->numCRTC; i++) {
- save->CRTC[i] = hwp->readCrtc(hwp, i);
- DebugF("CRTC[0x%02x] = 0x%02x\n", i, save->CRTC[i]);
+ save->CRTC[i] = hwp->readCrtc(hwp, i);
+ DebugF("CRTC[0x%02x] = 0x%02x\n", i, save->CRTC[i]);
}
hwp->enablePalette(hwp);
for (i = 0; i < save->numAttribute; i++) {
- save->Attribute[i] = hwp->readAttr(hwp, i);
- DebugF("Attribute[0x%02x] = 0x%02x\n", i, save->Attribute[i]);
+ save->Attribute[i] = hwp->readAttr(hwp, i);
+ DebugF("Attribute[0x%02x] = 0x%02x\n", i, save->Attribute[i]);
}
hwp->disablePalette(hwp);
for (i = 0; i < save->numGraphics; i++) {
- save->Graphics[i] = hwp->readGr(hwp, i);
- DebugF("Graphics[0x%02x] = 0x%02x\n", i, save->Graphics[i]);
+ save->Graphics[i] = hwp->readGr(hwp, i);
+ DebugF("Graphics[0x%02x] = 0x%02x\n", i, save->Graphics[i]);
}
for (i = 1; i < save->numSequencer; i++) {
- save->Sequencer[i] = hwp->readSeq(hwp, i);
- DebugF("Sequencer[0x%02x] = 0x%02x\n", i, save->Sequencer[i]);
+ save->Sequencer[i] = hwp->readSeq(hwp, i);
+ DebugF("Sequencer[0x%02x] = 0x%02x\n", i, save->Sequencer[i]);
}
}
-
void
vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save)
{
@@ -1067,7 +1066,7 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save)
/* Only save it once */
if (hwp->cmapSaved)
- return;
+ return;
#if 0
hwp->enablePalette(hwp);
@@ -1080,17 +1079,17 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save)
*/
hwp->writeDacReadAddr(hwp, 0x00);
for (i = 0; i < 6; i++) {
- save->DAC[i] = hwp->readDacData(hwp);
- switch (i % 3) {
- case 0:
- DebugF("DAC[0x%02x] = 0x%02x, ", i / 3, save->DAC[i]);
- break;
- case 1:
- DebugF("0x%02x, ", save->DAC[i]);
- break;
- case 2:
- DebugF("0x%02x\n", save->DAC[i]);
- }
+ save->DAC[i] = hwp->readDacData(hwp);
+ switch (i % 3) {
+ case 0:
+ DebugF("DAC[0x%02x] = 0x%02x, ", i / 3, save->DAC[i]);
+ break;
+ case 1:
+ DebugF("0x%02x, ", save->DAC[i]);
+ break;
+ case 2:
+ DebugF("0x%02x\n", save->DAC[i]);
+ }
}
/*
@@ -1099,40 +1098,41 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save)
*/
hwp->writeDacWriteAddr(hwp, 0x01);
for (i = 3; i < 6; i++)
- hwp->writeDacData(hwp, ~save->DAC[i] & DAC_TEST_MASK);
+ hwp->writeDacData(hwp, ~save->DAC[i] & DAC_TEST_MASK);
hwp->writeDacReadAddr(hwp, 0x01);
for (i = 3; i < 6; i++) {
- if (hwp->readDacData(hwp) != (~save->DAC[i] & DAC_TEST_MASK))
- readError = TRUE;
+ if (hwp->readDacData(hwp) != (~save->DAC[i] & DAC_TEST_MASK))
+ readError = TRUE;
}
hwp->writeDacWriteAddr(hwp, 0x01);
for (i = 3; i < 6; i++)
- hwp->writeDacData(hwp, save->DAC[i]);
+ hwp->writeDacData(hwp, save->DAC[i]);
if (readError) {
- /*
- * save the default lookup table
- */
- memmove(save->DAC, defaultDAC, 768);
- xf86DrvMsg(scrninfp->scrnIndex, X_WARNING,
- "Cannot read colourmap from VGA. Will restore with default\n");
- } else {
- /* save the colourmap */
- hwp->writeDacReadAddr(hwp, 0x02);
- for (i = 6; i < 768; i++) {
- save->DAC[i] = hwp->readDacData(hwp);
- DACDelay(hwp);
- switch (i % 3) {
- case 0:
- DebugF("DAC[0x%02x] = 0x%02x, ", i / 3, save->DAC[i]);
- break;
- case 1:
- DebugF("0x%02x, ", save->DAC[i]);
- break;
- case 2:
- DebugF("0x%02x\n", save->DAC[i]);
- }
- }
+ /*
+ * save the default lookup table
+ */
+ memmove(save->DAC, defaultDAC, 768);
+ xf86DrvMsg(scrninfp->scrnIndex, X_WARNING,
+ "Cannot read colourmap from VGA. Will restore with default\n");
+ }
+ else {
+ /* save the colourmap */
+ hwp->writeDacReadAddr(hwp, 0x02);
+ for (i = 6; i < 768; i++) {
+ save->DAC[i] = hwp->readDacData(hwp);
+ DACDelay(hwp);
+ switch (i % 3) {
+ case 0:
+ DebugF("DAC[0x%02x] = 0x%02x, ", i / 3, save->DAC[i]);
+ break;
+ case 1:
+ DebugF("0x%02x, ", save->DAC[i]);
+ break;
+ case 2:
+ DebugF("0x%02x\n", save->DAC[i]);
+ }
+ }
}
hwp->disablePalette(hwp);
@@ -1149,19 +1149,18 @@ void
vgaHWSave(ScrnInfoPtr scrninfp, vgaRegPtr save, int flags)
{
if (save == NULL)
- return;
+ return;
- if (flags & VGA_SR_CMAP)
- vgaHWSaveColormap(scrninfp, save);
+ if (flags & VGA_SR_CMAP)
+ vgaHWSaveColormap(scrninfp, save);
- if (flags & VGA_SR_MODE)
- vgaHWSaveMode(scrninfp, save);
+ if (flags & VGA_SR_MODE)
+ vgaHWSaveMode(scrninfp, save);
- if (flags & VGA_SR_FONTS)
- vgaHWSaveFonts(scrninfp, save);
+ if (flags & VGA_SR_FONTS)
+ vgaHWSaveFonts(scrninfp, save);
}
-
/*
* vgaHWInit --
* Handle the initialization, etc. of a screen.
@@ -1171,7 +1170,7 @@ vgaHWSave(ScrnInfoPtr scrninfp, vgaRegPtr save, int flags)
Bool
vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
{
- unsigned int i;
+ unsigned int i;
vgaHWPtr hwp;
vgaRegPtr regp;
int depth = scrninfp->depth;
@@ -1180,37 +1179,38 @@ vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
* make sure the vgaHWRec is allocated
*/
if (!vgaHWGetHWRec(scrninfp))
- return FALSE;
+ return FALSE;
hwp = VGAHWPTR(scrninfp);
regp = &hwp->ModeReg;
-
+
/*
* compute correct Hsync & Vsync polarity
*/
if ((mode->Flags & (V_PHSYNC | V_NHSYNC))
- && (mode->Flags & (V_PVSYNC | V_NVSYNC)))
- {
+ && (mode->Flags & (V_PVSYNC | V_NVSYNC))) {
regp->MiscOutReg = 0x23;
- if (mode->Flags & V_NHSYNC) regp->MiscOutReg |= 0x40;
- if (mode->Flags & V_NVSYNC) regp->MiscOutReg |= 0x80;
+ if (mode->Flags & V_NHSYNC)
+ regp->MiscOutReg |= 0x40;
+ if (mode->Flags & V_NVSYNC)
+ regp->MiscOutReg |= 0x80;
}
- else
- {
+ else {
int VDisplay = mode->VDisplay;
+
if (mode->Flags & V_DBLSCAN)
VDisplay *= 2;
if (mode->VScan > 1)
VDisplay *= mode->VScan;
- if (VDisplay < 400)
- regp->MiscOutReg = 0xA3; /* +hsync -vsync */
+ if (VDisplay < 400)
+ regp->MiscOutReg = 0xA3; /* +hsync -vsync */
else if (VDisplay < 480)
- regp->MiscOutReg = 0x63; /* -hsync +vsync */
+ regp->MiscOutReg = 0x63; /* -hsync +vsync */
else if (VDisplay < 768)
- regp->MiscOutReg = 0xE3; /* -hsync -vsync */
+ regp->MiscOutReg = 0xE3; /* -hsync -vsync */
else
- regp->MiscOutReg = 0x23; /* +hsync +vsync */
+ regp->MiscOutReg = 0x23; /* +hsync +vsync */
}
-
+
regp->MiscOutReg |= (mode->ClockIndex & 0x03) << 2;
/*
@@ -1220,7 +1220,7 @@ vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
regp->Sequencer[0] = 0x02;
else
regp->Sequencer[0] = 0x00;
- if (mode->Flags & V_CLKDIV2)
+ if (mode->Flags & V_CLKDIV2)
regp->Sequencer[1] = 0x09;
else
regp->Sequencer[1] = 0x01;
@@ -1228,42 +1228,41 @@ vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
regp->Sequencer[2] = 1 << BIT_PLANE;
else
regp->Sequencer[2] = 0x0F;
- regp->Sequencer[3] = 0x00; /* Font select */
+ regp->Sequencer[3] = 0x00; /* Font select */
if (depth < 8)
- regp->Sequencer[4] = 0x06; /* Misc */
+ regp->Sequencer[4] = 0x06; /* Misc */
else
- regp->Sequencer[4] = 0x0E; /* Misc */
+ regp->Sequencer[4] = 0x0E; /* Misc */
/*
* CRTC Controller
*/
- regp->CRTC[0] = (mode->CrtcHTotal >> 3) - 5;
- regp->CRTC[1] = (mode->CrtcHDisplay >> 3) - 1;
- regp->CRTC[2] = (mode->CrtcHBlankStart >> 3) - 1;
- regp->CRTC[3] = (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F) | 0x80;
+ regp->CRTC[0] = (mode->CrtcHTotal >> 3) - 5;
+ regp->CRTC[1] = (mode->CrtcHDisplay >> 3) - 1;
+ regp->CRTC[2] = (mode->CrtcHBlankStart >> 3) - 1;
+ regp->CRTC[3] = (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F) | 0x80;
i = (((mode->CrtcHSkew << 2) + 0x10) & ~0x1F);
if (i < 0x80)
- regp->CRTC[3] |= i;
- regp->CRTC[4] = (mode->CrtcHSyncStart >> 3);
- regp->CRTC[5] = ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2)
- | (((mode->CrtcHSyncEnd >> 3)) & 0x1F);
- regp->CRTC[6] = (mode->CrtcVTotal - 2) & 0xFF;
- regp->CRTC[7] = (((mode->CrtcVTotal - 2) & 0x100) >> 8)
- | (((mode->CrtcVDisplay - 1) & 0x100) >> 7)
- | ((mode->CrtcVSyncStart & 0x100) >> 6)
- | (((mode->CrtcVBlankStart - 1) & 0x100) >> 5)
- | 0x10
- | (((mode->CrtcVTotal - 2) & 0x200) >> 4)
- | (((mode->CrtcVDisplay - 1) & 0x200) >> 3)
- | ((mode->CrtcVSyncStart & 0x200) >> 2);
- regp->CRTC[8] = 0x00;
- regp->CRTC[9] = (((mode->CrtcVBlankStart - 1) & 0x200) >> 4) | 0x40;
+ regp->CRTC[3] |= i;
+ regp->CRTC[4] = (mode->CrtcHSyncStart >> 3);
+ regp->CRTC[5] = ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2)
+ | (((mode->CrtcHSyncEnd >> 3)) & 0x1F);
+ regp->CRTC[6] = (mode->CrtcVTotal - 2) & 0xFF;
+ regp->CRTC[7] = (((mode->CrtcVTotal - 2) & 0x100) >> 8)
+ | (((mode->CrtcVDisplay - 1) & 0x100) >> 7)
+ | ((mode->CrtcVSyncStart & 0x100) >> 6)
+ | (((mode->CrtcVBlankStart - 1) & 0x100) >> 5)
+ | 0x10 | (((mode->CrtcVTotal - 2) & 0x200) >> 4)
+ | (((mode->CrtcVDisplay - 1) & 0x200) >> 3)
+ | ((mode->CrtcVSyncStart & 0x200) >> 2);
+ regp->CRTC[8] = 0x00;
+ regp->CRTC[9] = (((mode->CrtcVBlankStart - 1) & 0x200) >> 4) | 0x40;
if (mode->Flags & V_DBLSCAN)
- regp->CRTC[9] |= 0x80;
+ regp->CRTC[9] |= 0x80;
if (mode->VScan >= 32)
- regp->CRTC[9] |= 0x1F;
+ regp->CRTC[9] |= 0x1F;
else if (mode->VScan > 1)
- regp->CRTC[9] |= mode->VScan - 1;
+ regp->CRTC[9] |= mode->VScan - 1;
regp->CRTC[10] = 0x00;
regp->CRTC[11] = 0x00;
regp->CRTC[12] = 0x00;
@@ -1273,14 +1272,14 @@ vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
regp->CRTC[16] = mode->CrtcVSyncStart & 0xFF;
regp->CRTC[17] = (mode->CrtcVSyncEnd & 0x0F) | 0x20;
regp->CRTC[18] = (mode->CrtcVDisplay - 1) & 0xFF;
- regp->CRTC[19] = scrninfp->displayWidth >> 4; /* just a guess */
+ regp->CRTC[19] = scrninfp->displayWidth >> 4; /* just a guess */
regp->CRTC[20] = 0x00;
- regp->CRTC[21] = (mode->CrtcVBlankStart - 1) & 0xFF;
+ regp->CRTC[21] = (mode->CrtcVBlankStart - 1) & 0xFF;
regp->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF;
if (depth < 8)
- regp->CRTC[23] = 0xE3;
+ regp->CRTC[23] = 0xE3;
else
- regp->CRTC[23] = 0xC3;
+ regp->CRTC[23] = 0xC3;
regp->CRTC[24] = 0xFF;
vgaHWHBlankKGA(mode, regp, 0, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO);
@@ -1300,7 +1299,8 @@ vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
if (depth == 1) {
regp->Graphics[4] = BIT_PLANE;
regp->Graphics[5] = 0x00;
- } else {
+ }
+ else {
regp->Graphics[4] = 0x00;
if (depth == 4)
regp->Graphics[5] = 0x02;
@@ -1310,32 +1310,33 @@ vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
regp->Graphics[6] = 0x05; /* only map 64k VGA memory !!!! */
regp->Graphics[7] = 0x0F;
regp->Graphics[8] = 0xFF;
-
+
if (depth == 1) {
/* Initialise the Mono map according to which bit-plane gets used */
- Bool flipPixels = xf86GetFlipPixels();
+ Bool flipPixels = xf86GetFlipPixels();
- for (i=0; i<16; i++)
+ for (i = 0; i < 16; i++)
if (((i & (1 << BIT_PLANE)) != 0) != flipPixels)
regp->Attribute[i] = WHITE_VALUE;
else
regp->Attribute[i] = BLACK_VALUE;
- regp->Attribute[16] = 0x01; /* -VGA2- */ /* wrong for the ET4000 */
- if (!hwp->ShowOverscan)
- regp->Attribute[OVERSCAN] = OVERSCAN_VALUE; /* -VGA2- */
- } else {
- regp->Attribute[0] = 0x00; /* standard colormap translation */
- regp->Attribute[1] = 0x01;
- regp->Attribute[2] = 0x02;
- regp->Attribute[3] = 0x03;
- regp->Attribute[4] = 0x04;
- regp->Attribute[5] = 0x05;
- regp->Attribute[6] = 0x06;
- regp->Attribute[7] = 0x07;
- regp->Attribute[8] = 0x08;
- regp->Attribute[9] = 0x09;
+ regp->Attribute[16] = 0x01; /* -VGA2- *//* wrong for the ET4000 */
+ if (!hwp->ShowOverscan)
+ regp->Attribute[OVERSCAN] = OVERSCAN_VALUE; /* -VGA2- */
+ }
+ else {
+ regp->Attribute[0] = 0x00; /* standard colormap translation */
+ regp->Attribute[1] = 0x01;
+ regp->Attribute[2] = 0x02;
+ regp->Attribute[3] = 0x03;
+ regp->Attribute[4] = 0x04;
+ regp->Attribute[5] = 0x05;
+ regp->Attribute[6] = 0x06;
+ regp->Attribute[7] = 0x07;
+ regp->Attribute[8] = 0x08;
+ regp->Attribute[9] = 0x09;
regp->Attribute[10] = 0x0A;
regp->Attribute[11] = 0x0B;
regp->Attribute[12] = 0x0C;
@@ -1389,36 +1390,37 @@ vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
*/
CARD32
-vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
- unsigned int Flags)
+vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
+ unsigned int Flags)
{
int nExtBits = (nBits < 6) ? 0 : nBits - 6;
CARD32 ExtBits;
CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 6;
- regp->CRTC[3] = (regp->CRTC[3] & ~0x1F)
- | (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F);
- regp->CRTC[5] = (regp->CRTC[5] & ~0x80)
- | ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2);
- ExtBits = ((mode->CrtcHBlankEnd >> 3) - 1) & ExtBitMask;
+ regp->CRTC[3] = (regp->CRTC[3] & ~0x1F)
+ | (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F);
+ regp->CRTC[5] = (regp->CRTC[5] & ~0x80)
+ | ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2);
+ ExtBits = ((mode->CrtcHBlankEnd >> 3) - 1) & ExtBitMask;
/* First the horizontal case */
if ((Flags & KGA_FIX_OVERSCAN)
- && ((mode->CrtcHBlankEnd >> 3) == (mode->CrtcHTotal >> 3)))
- {
- int i = (regp->CRTC[3] & 0x1F)
- | ((regp->CRTC[5] & 0x80) >> 2)
- | ExtBits;
- if (Flags & KGA_ENABLE_ON_ZERO) {
- if ((i-- > (((mode->CrtcHBlankStart >> 3) - 1)
- & (0x3F | ExtBitMask)))
- && (mode->CrtcHBlankEnd == mode->CrtcHTotal))
- i = 0;
- } else if (Flags & KGA_BE_TOT_DEC)
- i--;
- regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) | (i & 0x1F);
- regp->CRTC[5] = (regp->CRTC[5] & ~0x80) | ((i << 2) & 0x80);
- ExtBits = i & ExtBitMask;
+ && ((mode->CrtcHBlankEnd >> 3) == (mode->CrtcHTotal >> 3))) {
+ int i = (regp->CRTC[3] & 0x1F)
+ | ((regp->CRTC[5] & 0x80) >> 2)
+ | ExtBits;
+
+ if (Flags & KGA_ENABLE_ON_ZERO) {
+ if ((i-- > (((mode->CrtcHBlankStart >> 3) - 1)
+ & (0x3F | ExtBitMask)))
+ && (mode->CrtcHBlankEnd == mode->CrtcHTotal))
+ i = 0;
+ }
+ else if (Flags & KGA_BE_TOT_DEC)
+ i--;
+ regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) | (i & 0x1F);
+ regp->CRTC[5] = (regp->CRTC[5] & ~0x80) | ((i << 2) & 0x80);
+ ExtBits = i & ExtBitMask;
}
return ExtBits >> 6;
}
@@ -1430,37 +1432,41 @@ vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
* needs further investigation.
*/
CARD32
-vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
- unsigned int Flags)
+vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
+ unsigned int Flags)
{
CARD32 ExtBits;
CARD32 nExtBits = (nBits < 8) ? 0 : (nBits - 8);
CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 8;
+
/* If width is not known nBits should be 0. In this
* case BitMask is set to 0 so we can check for it. */
CARD32 BitMask = (nBits < 7) ? 0 : ((1 << nExtBits) - 1);
- int VBlankStart = (mode->CrtcVBlankStart - 1) & 0xFF;
+ int VBlankStart = (mode->CrtcVBlankStart - 1) & 0xFF;
+
regp->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF;
- ExtBits = (mode->CrtcVBlankEnd - 1) & ExtBitMask;
+ ExtBits = (mode->CrtcVBlankEnd - 1) & ExtBitMask;
- if ((Flags & KGA_FIX_OVERSCAN)
- && (mode->CrtcVBlankEnd == mode->CrtcVTotal))
- /* Null top overscan */
+ if ((Flags & KGA_FIX_OVERSCAN)
+ && (mode->CrtcVBlankEnd == mode->CrtcVTotal))
+ /* Null top overscan */
{
- int i = regp->CRTC[22] | ExtBits;
- if (Flags & KGA_ENABLE_ON_ZERO) {
- if (((BitMask && ((i & BitMask) > (VBlankStart & BitMask)))
- || ((i > VBlankStart) && /* 8-bit case */
- ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */
- !(regp->CRTC[9] & 0x9F)) /* 1 scanline/row */
- i = 0;
- else
- i = (i - 1);
- } else if (Flags & KGA_BE_TOT_DEC)
- i = (i - 1);
-
- regp->CRTC[22] = i & 0xFF;
- ExtBits = i & 0xFF00;
+ int i = regp->CRTC[22] | ExtBits;
+
+ if (Flags & KGA_ENABLE_ON_ZERO) {
+ if (((BitMask && ((i & BitMask) > (VBlankStart & BitMask)))
+ || ((i > VBlankStart) && /* 8-bit case */
+ ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */
+ !(regp->CRTC[9] & 0x9F)) /* 1 scanline/row */
+ i = 0;
+ else
+ i = (i - 1);
+ }
+ else if (Flags & KGA_BE_TOT_DEC)
+ i = (i - 1);
+
+ regp->CRTC[22] = i & 0xFF;
+ ExtBits = i & 0xFF00;
}
return ExtBits >> 8;
}
@@ -1472,29 +1478,21 @@ static void
vgaHWGetHWRecPrivate(void)
{
if (vgaHWPrivateIndex < 0)
- vgaHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+ vgaHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
return;
}
-
static void
vgaHWFreeRegs(vgaRegPtr regp)
{
free(regp->CRTC);
- regp->CRTC =
- regp->Sequencer =
- regp->Graphics =
- regp->Attribute = NULL;
+ regp->CRTC = regp->Sequencer = regp->Graphics = regp->Attribute = NULL;
regp->numCRTC =
- regp->numSequencer =
- regp->numGraphics =
- regp->numAttribute = 0;
+ regp->numSequencer = regp->numGraphics = regp->numAttribute = 0;
}
-
-
static Bool
vgaHWAllocRegs(vgaRegPtr regp)
{
@@ -1505,11 +1503,10 @@ vgaHWAllocRegs(vgaRegPtr regp)
return FALSE;
buf = calloc(regp->numCRTC +
- regp->numSequencer +
- regp->numGraphics +
- regp->numAttribute, 1);
+ regp->numSequencer +
+ regp->numGraphics + regp->numAttribute, 1);
if (!buf)
- return FALSE;
+ return FALSE;
regp->CRTC = buf;
regp->Sequencer = regp->CRTC + regp->numCRTC;
@@ -1519,7 +1516,6 @@ vgaHWAllocRegs(vgaRegPtr regp)
return TRUE;
}
-
Bool
vgaHWAllocDefaultRegs(vgaRegPtr regp)
{
@@ -1531,10 +1527,9 @@ vgaHWAllocDefaultRegs(vgaRegPtr regp)
return vgaHWAllocRegs(regp);
}
-
Bool
vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer,
- int numGraphics, int numAttribute)
+ int numGraphics, int numAttribute)
{
#define VGAHWMINNUM(regtype) \
((newMode.num##regtype < regp->num##regtype) ? \
@@ -1546,7 +1541,7 @@ vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer,
vgaRegPtr regp;
regp = &VGAHWPTR(scrp)->ModeReg;
- memcpy (&newMode, regp, sizeof(vgaRegRec));
+ memcpy(&newMode, regp, sizeof(vgaRegRec));
/* allocate space for new registers */
@@ -1556,10 +1551,10 @@ vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer,
regp->numGraphics = numGraphics;
regp->numAttribute = numAttribute;
if (!vgaHWAllocRegs(regp))
- return FALSE;
+ return FALSE;
regp = &VGAHWPTR(scrp)->SavedReg;
- memcpy (&newSaved, regp, sizeof(vgaRegRec));
+ memcpy(&newSaved, regp, sizeof(vgaRegRec));
regp = &newSaved;
regp->numCRTC = numCRTC;
@@ -1568,7 +1563,7 @@ vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer,
regp->numAttribute = numAttribute;
if (!vgaHWAllocRegs(regp)) {
vgaHWFreeRegs(&newMode);
- return FALSE;
+ return FALSE;
}
/* allocations succeeded, copy register data into new space */
@@ -1601,7 +1596,6 @@ vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer,
#undef VGAHWCOPYREGSET
}
-
Bool
vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src)
{
@@ -1610,7 +1604,7 @@ vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src)
memcpy(dst, src, sizeof(vgaRegRec));
if (!vgaHWAllocRegs(dst))
- return FALSE;
+ return FALSE;
memcpy(dst->CRTC, src->CRTC, src->numCRTC);
memcpy(dst->Sequencer, src->Sequencer, src->numSequencer);
@@ -1620,14 +1614,13 @@ vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src)
return TRUE;
}
-
Bool
vgaHWGetHWRec(ScrnInfoPtr scrp)
{
vgaRegPtr regp;
vgaHWPtr hwp;
int i;
-
+
/*
* Let's make sure that the private exists and allocate one.
*/
@@ -1637,41 +1630,49 @@ vgaHWGetHWRec(ScrnInfoPtr scrp)
* has already been done.
*/
if (VGAHWPTR(scrp))
- return TRUE;
+ return TRUE;
hwp = VGAHWPTRLVAL(scrp) = xnfcalloc(sizeof(vgaHWRec), 1);
regp = &VGAHWPTR(scrp)->ModeReg;
if ((!vgaHWAllocDefaultRegs(&VGAHWPTR(scrp)->SavedReg)) ||
- (!vgaHWAllocDefaultRegs(&VGAHWPTR(scrp)->ModeReg))) {
+ (!vgaHWAllocDefaultRegs(&VGAHWPTR(scrp)->ModeReg))) {
free(hwp);
- return FALSE;
+ return FALSE;
}
if (scrp->bitsPerPixel == 1) {
- rgb blackColour = scrp->display->blackColour,
- whiteColour = scrp->display->whiteColour;
-
- if (blackColour.red > 0x3F) blackColour.red = 0x3F;
- if (blackColour.green > 0x3F) blackColour.green = 0x3F;
- if (blackColour.blue > 0x3F) blackColour.blue = 0x3F;
-
- if (whiteColour.red > 0x3F) whiteColour.red = 0x3F;
- if (whiteColour.green > 0x3F) whiteColour.green = 0x3F;
- if (whiteColour.blue > 0x3F) whiteColour.blue = 0x3F;
-
- if ((blackColour.red == whiteColour.red ) &&
- (blackColour.green == whiteColour.green) &&
- (blackColour.blue == whiteColour.blue )) {
- blackColour.red ^= 0x3F;
- blackColour.green ^= 0x3F;
- blackColour.blue ^= 0x3F;
- }
+ rgb blackColour = scrp->display->blackColour,
+ whiteColour = scrp->display->whiteColour;
+
+ if (blackColour.red > 0x3F)
+ blackColour.red = 0x3F;
+ if (blackColour.green > 0x3F)
+ blackColour.green = 0x3F;
+ if (blackColour.blue > 0x3F)
+ blackColour.blue = 0x3F;
+
+ if (whiteColour.red > 0x3F)
+ whiteColour.red = 0x3F;
+ if (whiteColour.green > 0x3F)
+ whiteColour.green = 0x3F;
+ if (whiteColour.blue > 0x3F)
+ whiteColour.blue = 0x3F;
+
+ if ((blackColour.red == whiteColour.red) &&
+ (blackColour.green == whiteColour.green) &&
+ (blackColour.blue == whiteColour.blue)) {
+ blackColour.red ^= 0x3F;
+ blackColour.green ^= 0x3F;
+ blackColour.blue ^= 0x3F;
+ }
/*
* initialize default colormap for monochrome
*/
- for (i=0; i<3; i++) regp->DAC[i] = 0x00;
- for (i=3; i<768; i++) regp->DAC[i] = 0x3F;
+ for (i = 0; i < 3; i++)
+ regp->DAC[i] = 0x00;
+ for (i = 3; i < 768; i++)
+ regp->DAC[i] = 0x3F;
i = BLACK_VALUE * 3;
regp->DAC[i++] = blackColour.red;
regp->DAC[i++] = blackColour.green;
@@ -1684,23 +1685,26 @@ vgaHWGetHWRec(ScrnInfoPtr scrp)
regp->DAC[i++] = 0x00;
regp->DAC[i++] = 0x00;
regp->DAC[i] = 0x00;
- } else {
- /* Set all colours to black */
- for (i=0; i<768; i++) regp->DAC[i] = 0x00;
+ }
+ else {
+ /* Set all colours to black */
+ for (i = 0; i < 768; i++)
+ regp->DAC[i] = 0x00;
/* ... and the overscan */
if (scrp->depth >= 4)
regp->Attribute[OVERSCAN] = 0xFF;
}
if (xf86FindOption(scrp->confScreen->options, "ShowOverscan")) {
- xf86MarkOptionUsedByName(scrp->confScreen->options, "ShowOverscan");
- xf86DrvMsg(scrp->scrnIndex, X_CONFIG, "Showing overscan area\n");
- regp->DAC[765] = 0x3F;
- regp->DAC[766] = 0x00;
- regp->DAC[767] = 0x3F;
- regp->Attribute[OVERSCAN] = 0xFF;
- hwp->ShowOverscan = TRUE;
- } else
- hwp->ShowOverscan = FALSE;
+ xf86MarkOptionUsedByName(scrp->confScreen->options, "ShowOverscan");
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG, "Showing overscan area\n");
+ regp->DAC[765] = 0x3F;
+ regp->DAC[766] = 0x00;
+ regp->DAC[767] = 0x3F;
+ regp->Attribute[OVERSCAN] = 0xFF;
+ hwp->ShowOverscan = TRUE;
+ }
+ else
+ hwp->ShowOverscan = FALSE;
hwp->paletteEnabled = FALSE;
hwp->cmapSaved = FALSE;
@@ -1712,44 +1716,42 @@ vgaHWGetHWRec(ScrnInfoPtr scrp)
return TRUE;
}
-
void
vgaHWFreeHWRec(ScrnInfoPtr scrp)
{
if (vgaHWPrivateIndex >= 0) {
- vgaHWPtr hwp = VGAHWPTR(scrp);
+ vgaHWPtr hwp = VGAHWPTR(scrp);
- if (!hwp)
+ if (!hwp)
return;
pci_device_close_io(hwp->dev, hwp->io);
- free(hwp->FontInfo1);
- free(hwp->FontInfo2);
- free(hwp->TextInfo);
+ free(hwp->FontInfo1);
+ free(hwp->FontInfo2);
+ free(hwp->TextInfo);
- vgaHWFreeRegs (&hwp->ModeReg);
- vgaHWFreeRegs (&hwp->SavedReg);
+ vgaHWFreeRegs(&hwp->ModeReg);
+ vgaHWFreeRegs(&hwp->SavedReg);
- free(hwp);
- VGAHWPTRLVAL(scrp) = NULL;
+ free(hwp);
+ VGAHWPTRLVAL(scrp) = NULL;
}
}
-
Bool
vgaHWMapMem(ScrnInfoPtr scrp)
{
vgaHWPtr hwp = VGAHWPTR(scrp);
-
+
if (hwp->Base)
- return TRUE;
+ return TRUE;
/* If not set, initialise with the defaults */
if (hwp->MapSize == 0)
- hwp->MapSize = VGA_DEFAULT_MEM_SIZE;
+ hwp->MapSize = VGA_DEFAULT_MEM_SIZE;
if (hwp->MapPhys == 0)
- hwp->MapPhys = VGA_DEFAULT_PHYS_ADDR;
+ hwp->MapPhys = VGA_DEFAULT_PHYS_ADDR;
/*
* Map as VIDMEM_MMIO_32BIT because WC
@@ -1758,19 +1760,19 @@ vgaHWMapMem(ScrnInfoPtr scrp)
* for now.
*/
DebugF("Mapping VGAMem\n");
- pci_device_map_legacy(hwp->dev, hwp->MapPhys, hwp->MapSize, PCI_DEV_MAP_FLAG_WRITABLE, &hwp->Base);
+ pci_device_map_legacy(hwp->dev, hwp->MapPhys, hwp->MapSize,
+ PCI_DEV_MAP_FLAG_WRITABLE, &hwp->Base);
return hwp->Base != NULL;
}
-
void
vgaHWUnmapMem(ScrnInfoPtr scrp)
{
vgaHWPtr hwp = VGAHWPTR(scrp);
if (hwp->Base == NULL)
- return;
-
+ return;
+
DebugF("Unmapping VGAMem\n");
pci_device_unmap_legacy(hwp->dev, hwp->Base, hwp->MapSize);
hwp->Base = NULL;
@@ -1782,17 +1784,15 @@ vgaHWGetIndex(void)
return vgaHWPrivateIndex;
}
-
void
vgaHWGetIOBase(vgaHWPtr hwp)
{
hwp->IOBase = (hwp->readMiscOut(hwp) & 0x01) ?
- VGA_IOBASE_COLOR : VGA_IOBASE_MONO;
+ VGA_IOBASE_COLOR : VGA_IOBASE_MONO;
xf86DrvMsgVerb(hwp->pScrn->scrnIndex, X_INFO, 3,
- "vgaHWGetIOBase: hwp->IOBase is 0x%04x\n", hwp->IOBase);
+ "vgaHWGetIOBase: hwp->IOBase is 0x%04x\n", hwp->IOBase);
}
-
void
vgaHWLock(vgaHWPtr hwp)
{
@@ -1804,87 +1804,82 @@ void
vgaHWUnlock(vgaHWPtr hwp)
{
/* Unprotect CRTC[0-7] */
- hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) & ~0x80);
+ hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) & ~0x80);
}
-
void
vgaHWEnable(vgaHWPtr hwp)
{
hwp->writeEnable(hwp, hwp->readEnable(hwp) | 0x01);
}
-
void
vgaHWDisable(vgaHWPtr hwp)
{
hwp->writeEnable(hwp, hwp->readEnable(hwp) & ~0x01);
}
-
static void
-vgaHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
- VisualPtr pVisual)
+vgaHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors,
+ VisualPtr pVisual)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
int i, index;
for (i = 0; i < numColors; i++) {
- index = indices[i];
- hwp->writeDacWriteAddr(hwp, index);
- DACDelay(hwp);
- hwp->writeDacData(hwp, colors[index].red);
- DACDelay(hwp);
- hwp->writeDacData(hwp, colors[index].green);
- DACDelay(hwp);
- hwp->writeDacData(hwp, colors[index].blue);
- DACDelay(hwp);
+ index = indices[i];
+ hwp->writeDacWriteAddr(hwp, index);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, colors[index].red);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, colors[index].green);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, colors[index].blue);
+ DACDelay(hwp);
}
/* This shouldn't be necessary, but we'll play safe. */
hwp->disablePalette(hwp);
}
-
static void
vgaHWSetOverscan(ScrnInfoPtr pScrn, int overscan)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
if (overscan < 0 || overscan > 255)
- return;
+ return;
hwp->enablePalette(hwp);
hwp->writeAttr(hwp, OVERSCAN, overscan);
#ifdef DEBUGOVERSCAN
{
- int ov = hwp->readAttr(hwp, OVERSCAN);
- int red, green, blue;
-
- hwp->writeDacReadAddr(hwp, ov);
- red = hwp->readDacData(hwp);
- green = hwp->readDacData(hwp);
- blue = hwp->readDacData(hwp);
- ErrorF("Overscan index is 0x%02x, colours are #%02x%02x%02x\n",
- ov, red, green, blue);
+ int ov = hwp->readAttr(hwp, OVERSCAN);
+ int red, green, blue;
+
+ hwp->writeDacReadAddr(hwp, ov);
+ red = hwp->readDacData(hwp);
+ green = hwp->readDacData(hwp);
+ blue = hwp->readDacData(hwp);
+ ErrorF("Overscan index is 0x%02x, colours are #%02x%02x%02x\n",
+ ov, red, green, blue);
}
#endif
hwp->disablePalette(hwp);
}
-
Bool
vgaHWHandleColormaps(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
if (pScrn->depth > 1 && pScrn->depth <= 8) {
- return xf86HandleColormaps(pScreen, 1 << pScrn->depth,
- pScrn->rgbBits, vgaHWLoadPalette,
- pScrn->depth > 4 ? vgaHWSetOverscan : NULL,
- CMAP_RELOAD_ON_MODE_SWITCH);
+ return xf86HandleColormaps(pScreen, 1 << pScrn->depth,
+ pScrn->rgbBits, vgaHWLoadPalette,
+ pScrn->depth > 4 ? vgaHWSetOverscan : NULL,
+ CMAP_RELOAD_ON_MODE_SWITCH);
}
return TRUE;
}
@@ -1923,57 +1918,60 @@ vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
unsigned char tmp;
- struct _vgaDdcSave* save;
+ struct _vgaDdcSave *save;
+
switch (speed) {
case DDC_FAST:
-
- if (hwp->ddc != NULL) break;
- hwp->ddc = xnfcalloc(sizeof(struct _vgaDdcSave),1);
- save = (struct _vgaDdcSave *)hwp->ddc;
- /* Lightpen register disable - allow access to cr10 & 11; just in case */
- save->cr03 = hwp->readCrtc(hwp, 0x03);
- hwp->writeCrtc(hwp,0x03,(save->cr03 |0x80));
- save->cr12 = hwp->readCrtc(hwp, 0x12);
- hwp->writeCrtc(hwp,0x12,DISPLAY_END);
- save->cr15 = hwp->readCrtc(hwp, 0x15);
- hwp->writeCrtc(hwp,0x15,BLANK_START);
- save->cr10 = hwp->readCrtc(hwp, 0x10);
- hwp->writeCrtc(hwp,0x10,SYNC_START);
- save->cr11 = hwp->readCrtc(hwp, 0x11);
- /* unprotect group 1 registers; just in case ...*/
- hwp->writeCrtc(hwp,0x11,((save->cr11 & 0x70) | SYNC_END));
- save->cr16 = hwp->readCrtc(hwp, 0x16);
- hwp->writeCrtc(hwp,0x16,BLANK_END);
- save->cr06 = hwp->readCrtc(hwp, 0x06);
- hwp->writeCrtc(hwp,0x06,V_TOTAL);
- /* all values have less than 8 bit - mask out 9th and 10th bits */
- save->cr09 = hwp->readCrtc(hwp, 0x09);
- hwp->writeCrtc(hwp,0x09,(save->cr09 &0xDF));
- save->cr07 = hwp->readCrtc(hwp, 0x07);
- hwp->writeCrtc(hwp,0x07,(save->cr07 &0x10));
- /* vsync polarity negativ & ensure a 25MHz clock */
- save->msr = hwp->readMiscOut(hwp);
- hwp->writeMiscOut(hwp,((save->msr & 0xF3) | 0x80));
- break;
+
+ if (hwp->ddc != NULL)
+ break;
+ hwp->ddc = xnfcalloc(sizeof(struct _vgaDdcSave), 1);
+ save = (struct _vgaDdcSave *) hwp->ddc;
+ /* Lightpen register disable - allow access to cr10 & 11; just in case */
+ save->cr03 = hwp->readCrtc(hwp, 0x03);
+ hwp->writeCrtc(hwp, 0x03, (save->cr03 | 0x80));
+ save->cr12 = hwp->readCrtc(hwp, 0x12);
+ hwp->writeCrtc(hwp, 0x12, DISPLAY_END);
+ save->cr15 = hwp->readCrtc(hwp, 0x15);
+ hwp->writeCrtc(hwp, 0x15, BLANK_START);
+ save->cr10 = hwp->readCrtc(hwp, 0x10);
+ hwp->writeCrtc(hwp, 0x10, SYNC_START);
+ save->cr11 = hwp->readCrtc(hwp, 0x11);
+ /* unprotect group 1 registers; just in case ... */
+ hwp->writeCrtc(hwp, 0x11, ((save->cr11 & 0x70) | SYNC_END));
+ save->cr16 = hwp->readCrtc(hwp, 0x16);
+ hwp->writeCrtc(hwp, 0x16, BLANK_END);
+ save->cr06 = hwp->readCrtc(hwp, 0x06);
+ hwp->writeCrtc(hwp, 0x06, V_TOTAL);
+ /* all values have less than 8 bit - mask out 9th and 10th bits */
+ save->cr09 = hwp->readCrtc(hwp, 0x09);
+ hwp->writeCrtc(hwp, 0x09, (save->cr09 & 0xDF));
+ save->cr07 = hwp->readCrtc(hwp, 0x07);
+ hwp->writeCrtc(hwp, 0x07, (save->cr07 & 0x10));
+ /* vsync polarity negativ & ensure a 25MHz clock */
+ save->msr = hwp->readMiscOut(hwp);
+ hwp->writeMiscOut(hwp, ((save->msr & 0xF3) | 0x80));
+ break;
case DDC_SLOW:
- if (hwp->ddc == NULL) break;
- save = (struct _vgaDdcSave *)hwp->ddc;
- hwp->writeMiscOut(hwp,save->msr);
- hwp->writeCrtc(hwp,0x07,save->cr07);
- tmp = hwp->readCrtc(hwp, 0x09);
- hwp->writeCrtc(hwp,0x09,((save->cr09 & 0x20) | (tmp & 0xDF)));
- hwp->writeCrtc(hwp,0x06,save->cr06);
- hwp->writeCrtc(hwp,0x16,save->cr16);
- hwp->writeCrtc(hwp,0x11,save->cr11);
- hwp->writeCrtc(hwp,0x10,save->cr10);
- hwp->writeCrtc(hwp,0x15,save->cr15);
- hwp->writeCrtc(hwp,0x12,save->cr12);
- hwp->writeCrtc(hwp,0x03,save->cr03);
- free(save);
- hwp->ddc = NULL;
- break;
+ if (hwp->ddc == NULL)
+ break;
+ save = (struct _vgaDdcSave *) hwp->ddc;
+ hwp->writeMiscOut(hwp, save->msr);
+ hwp->writeCrtc(hwp, 0x07, save->cr07);
+ tmp = hwp->readCrtc(hwp, 0x09);
+ hwp->writeCrtc(hwp, 0x09, ((save->cr09 & 0x20) | (tmp & 0xDF)));
+ hwp->writeCrtc(hwp, 0x06, save->cr06);
+ hwp->writeCrtc(hwp, 0x16, save->cr16);
+ hwp->writeCrtc(hwp, 0x11, save->cr11);
+ hwp->writeCrtc(hwp, 0x10, save->cr10);
+ hwp->writeCrtc(hwp, 0x15, save->cr15);
+ hwp->writeCrtc(hwp, 0x12, save->cr12);
+ hwp->writeCrtc(hwp, 0x03, save->cr03);
+ free(save);
+ hwp->ddc = NULL;
+ break;
default:
- break;
+ break;
}
}
@@ -1983,7 +1981,8 @@ vgaHWddc1SetSpeedWeak(void)
return vgaHWddc1SetSpeed;
}
-SaveScreenProcPtr vgaHWSaveScreenWeak(void)
+SaveScreenProcPtr
+vgaHWSaveScreenWeak(void)
{
return vgaHWSaveScreen;
}
@@ -1992,89 +1991,87 @@ SaveScreenProcPtr vgaHWSaveScreenWeak(void)
* xf86GetClocks -- get the dot-clocks via a BIG BAD hack ...
*/
void
-xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int),
- void (*ProtectRegs)(ScrnInfoPtr, Bool),
- void (*BlankScreen)(ScrnInfoPtr, Bool), unsigned long vertsyncreg,
- int maskval, int knownclkindex, int knownclkvalue)
+xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc) (ScrnInfoPtr, int),
+ void (*ProtectRegs) (ScrnInfoPtr, Bool),
+ void (*BlankScreen) (ScrnInfoPtr, Bool),
+ unsigned long vertsyncreg, int maskval, int knownclkindex,
+ int knownclkvalue)
{
register int status = vertsyncreg;
unsigned long i, cnt, rcnt, sync;
vgaHWPtr hwp = VGAHWPTR(pScrn);
/* First save registers that get written on */
- (*ClockFunc)(pScrn, CLK_REG_SAVE);
+ (*ClockFunc) (pScrn, CLK_REG_SAVE);
if (num > MAXCLOCKS)
- num = MAXCLOCKS;
-
- for (i = 0; i < num; i++)
- {
- if (ProtectRegs)
- (*ProtectRegs)(pScrn, TRUE);
- if (!(*ClockFunc)(pScrn, i))
- {
- pScrn->clock[i] = -1;
- continue;
- }
- if (ProtectRegs)
- (*ProtectRegs)(pScrn, FALSE);
- if (BlankScreen)
- (*BlankScreen)(pScrn, FALSE);
-
- usleep(50000); /* let VCO stabilise */
-
- cnt = 0;
- sync = 200000;
-
- while ((pci_io_read8(hwp->io, status) & maskval) == 0x00)
- if (sync-- == 0) goto finish;
- /* Something appears to be happening, so reset sync count */
- sync = 200000;
- while ((pci_io_read8(hwp->io, status) & maskval) == maskval)
- if (sync-- == 0) goto finish;
- /* Something appears to be happening, so reset sync count */
- sync = 200000;
- while ((pci_io_read8(hwp->io, status) & maskval) == 0x00)
- if (sync-- == 0) goto finish;
-
- for (rcnt = 0; rcnt < 5; rcnt++)
- {
- while (!(pci_io_read8(hwp->io, status) & maskval))
- cnt++;
- while ((pci_io_read8(hwp->io, status) & maskval))
- cnt++;
- }
-
-finish:
- pScrn->clock[i] = cnt ? cnt : -1;
- if (BlankScreen)
- (*BlankScreen)(pScrn, TRUE);
+ num = MAXCLOCKS;
+
+ for (i = 0; i < num; i++) {
+ if (ProtectRegs)
+ (*ProtectRegs) (pScrn, TRUE);
+ if (!(*ClockFunc) (pScrn, i)) {
+ pScrn->clock[i] = -1;
+ continue;
+ }
+ if (ProtectRegs)
+ (*ProtectRegs) (pScrn, FALSE);
+ if (BlankScreen)
+ (*BlankScreen) (pScrn, FALSE);
+
+ usleep(50000); /* let VCO stabilise */
+
+ cnt = 0;
+ sync = 200000;
+
+ while ((pci_io_read8(hwp->io, status) & maskval) == 0x00)
+ if (sync-- == 0)
+ goto finish;
+ /* Something appears to be happening, so reset sync count */
+ sync = 200000;
+ while ((pci_io_read8(hwp->io, status) & maskval) == maskval)
+ if (sync-- == 0)
+ goto finish;
+ /* Something appears to be happening, so reset sync count */
+ sync = 200000;
+ while ((pci_io_read8(hwp->io, status) & maskval) == 0x00)
+ if (sync-- == 0)
+ goto finish;
+
+ for (rcnt = 0; rcnt < 5; rcnt++) {
+ while (!(pci_io_read8(hwp->io, status) & maskval))
+ cnt++;
+ while ((pci_io_read8(hwp->io, status) & maskval))
+ cnt++;
+ }
+
+ finish:
+ pScrn->clock[i] = cnt ? cnt : -1;
+ if (BlankScreen)
+ (*BlankScreen) (pScrn, TRUE);
}
- for (i = 0; i < num; i++)
- {
- if (i != knownclkindex)
- {
- if (pScrn->clock[i] == -1)
- {
- pScrn->clock[i] = 0;
- }
- else
- {
- pScrn->clock[i] = (int)(0.5 +
- (((float)knownclkvalue) * pScrn->clock[knownclkindex]) /
- (pScrn->clock[i]));
- /* Round to nearest 10KHz */
- pScrn->clock[i] += 5;
- pScrn->clock[i] /= 10;
- pScrn->clock[i] *= 10;
- }
- }
+ for (i = 0; i < num; i++) {
+ if (i != knownclkindex) {
+ if (pScrn->clock[i] == -1) {
+ pScrn->clock[i] = 0;
+ }
+ else {
+ pScrn->clock[i] = (int) (0.5 +
+ (((float) knownclkvalue) *
+ pScrn->clock[knownclkindex]) /
+ (pScrn->clock[i]));
+ /* Round to nearest 10KHz */
+ pScrn->clock[i] += 5;
+ pScrn->clock[i] /= 10;
+ pScrn->clock[i] *= 10;
+ }
+ }
}
pScrn->clock[knownclkindex] = knownclkvalue;
pScrn->numClocks = num;
/* Restore registers that were written on */
- (*ClockFunc)(pScrn, CLK_REG_RESTORE);
+ (*ClockFunc) (pScrn, CLK_REG_RESTORE);
}
diff --git a/xorg-server/hw/xfree86/vgahw/vgaHW.h b/xorg-server/hw/xfree86/vgahw/vgaHW.h
index d1ba9da89..937a8a507 100644
--- a/xorg-server/hw/xfree86/vgahw/vgaHW.h
+++ b/xorg-server/hw/xfree86/vgahw/vgaHW.h
@@ -1,5 +1,4 @@
-
/*
* Copyright (c) 1997,1998 The XFree86 Project, Inc.
*
@@ -38,8 +37,8 @@ extern _X_EXPORT int vgaHWGetIndex(void);
#define VGA_ATTR_INDEX 0x3C0
#define VGA_ATTR_DATA_W 0x3C0
#define VGA_ATTR_DATA_R 0x3C1
-#define VGA_IN_STAT_0 0x3C2 /* read */
-#define VGA_MISC_OUT_W 0x3C2 /* write */
+#define VGA_IN_STAT_0 0x3C2 /* read */
+#define VGA_MISC_OUT_W 0x3C2 /* write */
#define VGA_ENABLE 0x3C3
#define VGA_SEQ_INDEX 0x3C4
#define VGA_SEQ_DATA 0x3C5
@@ -47,8 +46,8 @@ extern _X_EXPORT int vgaHWGetIndex(void);
#define VGA_DAC_READ_ADDR 0x3C7
#define VGA_DAC_WRITE_ADDR 0x3C8
#define VGA_DAC_DATA 0x3C9
-#define VGA_FEATURE_R 0x3CA /* read */
-#define VGA_MISC_OUT_R 0x3CC /* read */
+#define VGA_FEATURE_R 0x3CA /* read */
+#define VGA_MISC_OUT_R 0x3CC /* read */
#define VGA_GRAPH_INDEX 0x3CE
#define VGA_GRAPH_DATA 0x3CF
@@ -57,8 +56,8 @@ extern _X_EXPORT int vgaHWGetIndex(void);
#define VGA_CRTC_INDEX_OFFSET 0x04
#define VGA_CRTC_DATA_OFFSET 0x05
-#define VGA_IN_STAT_1_OFFSET 0x0A /* read */
-#define VGA_FEATURE_W_OFFSET 0x0A /* write */
+#define VGA_IN_STAT_1_OFFSET 0x0A /* read */
+#define VGA_FEATURE_W_OFFSET 0x0A /* write */
/* default number of VGA registers stored internally */
#define VGA_NUM_CRTC 25
@@ -80,26 +79,25 @@ extern _X_EXPORT int vgaHWGetIndex(void);
* vgaRegRec contains settings of standard VGA registers.
*/
typedef struct {
- unsigned char MiscOutReg; /* */
- unsigned char *CRTC; /* Crtc Controller */
+ unsigned char MiscOutReg; /* */
+ unsigned char *CRTC; /* Crtc Controller */
unsigned char *Sequencer; /* Video Sequencer */
unsigned char *Graphics; /* Video Graphics */
- unsigned char *Attribute; /* Video Atribute */
- unsigned char DAC[768]; /* Internal Colorlookuptable */
- unsigned char numCRTC; /* number of CRTC registers, def=VGA_NUM_CRTC */
- unsigned char numSequencer; /* number of seq registers, def=VGA_NUM_SEQ */
- unsigned char numGraphics; /* number of gfx registers, def=VGA_NUM_GFX */
- unsigned char numAttribute; /* number of attr registers, def=VGA_NUM_ATTR */
+ unsigned char *Attribute; /* Video Atribute */
+ unsigned char DAC[768]; /* Internal Colorlookuptable */
+ unsigned char numCRTC; /* number of CRTC registers, def=VGA_NUM_CRTC */
+ unsigned char numSequencer; /* number of seq registers, def=VGA_NUM_SEQ */
+ unsigned char numGraphics; /* number of gfx registers, def=VGA_NUM_GFX */
+ unsigned char numAttribute; /* number of attr registers, def=VGA_NUM_ATTR */
} vgaRegRec, *vgaRegPtr;
typedef struct _vgaHWRec *vgaHWPtr;
-typedef void (*vgaHWWriteIndexProcPtr)(vgaHWPtr hwp, CARD8 indx, CARD8 value);
-typedef CARD8 (*vgaHWReadIndexProcPtr)(vgaHWPtr hwp, CARD8 indx);
-typedef void (*vgaHWWriteProcPtr)(vgaHWPtr hwp, CARD8 value);
-typedef CARD8 (*vgaHWReadProcPtr)(vgaHWPtr hwp);
-typedef void (*vgaHWMiscProcPtr)(vgaHWPtr hwp);
-
+typedef void (*vgaHWWriteIndexProcPtr) (vgaHWPtr hwp, CARD8 indx, CARD8 value);
+typedef CARD8 (*vgaHWReadIndexProcPtr) (vgaHWPtr hwp, CARD8 indx);
+typedef void (*vgaHWWriteProcPtr) (vgaHWPtr hwp, CARD8 value);
+typedef CARD8 (*vgaHWReadProcPtr) (vgaHWPtr hwp);
+typedef void (*vgaHWMiscProcPtr) (vgaHWPtr hwp);
/*
* vgaHWRec contains per-screen information required by the vgahw module.
@@ -109,64 +107,64 @@ typedef void (*vgaHWMiscProcPtr)(vgaHWPtr hwp);
* via the first 17 attribute registers and not the main 8-bit palette.
*/
typedef struct _vgaHWRec {
- pointer Base; /* Address of "VGA" memory */
- int MapSize; /* Size of "VGA" memory */
- unsigned long MapPhys; /* phys location of VGA mem */
- int IOBase; /* I/O Base address */
- CARD8 * MMIOBase; /* Pointer to MMIO start */
- int MMIOOffset; /* base + offset + vgareg
- = mmioreg */
- pointer FontInfo1; /* save area for fonts in
- plane 2 */
- pointer FontInfo2; /* save area for fonts in
- plane 3 */
- pointer TextInfo; /* save area for text */
- vgaRegRec SavedReg; /* saved registers */
- vgaRegRec ModeReg; /* register settings for
- current mode */
- Bool ShowOverscan;
- Bool paletteEnabled;
- Bool cmapSaved;
- ScrnInfoPtr pScrn;
- vgaHWWriteIndexProcPtr writeCrtc;
- vgaHWReadIndexProcPtr readCrtc;
- vgaHWWriteIndexProcPtr writeGr;
- vgaHWReadIndexProcPtr readGr;
- vgaHWReadProcPtr readST00;
- vgaHWReadProcPtr readST01;
- vgaHWReadProcPtr readFCR;
- vgaHWWriteProcPtr writeFCR;
- vgaHWWriteIndexProcPtr writeAttr;
- vgaHWReadIndexProcPtr readAttr;
- vgaHWWriteIndexProcPtr writeSeq;
- vgaHWReadIndexProcPtr readSeq;
- vgaHWWriteProcPtr writeMiscOut;
- vgaHWReadProcPtr readMiscOut;
- vgaHWMiscProcPtr enablePalette;
- vgaHWMiscProcPtr disablePalette;
- vgaHWWriteProcPtr writeDacMask;
- vgaHWReadProcPtr readDacMask;
- vgaHWWriteProcPtr writeDacWriteAddr;
- vgaHWWriteProcPtr writeDacReadAddr;
- vgaHWWriteProcPtr writeDacData;
- vgaHWReadProcPtr readDacData;
- pointer ddc;
- struct pci_io_handle *io;
- vgaHWReadProcPtr readEnable;
- vgaHWWriteProcPtr writeEnable;
- struct pci_device *dev;
+ pointer Base; /* Address of "VGA" memory */
+ int MapSize; /* Size of "VGA" memory */
+ unsigned long MapPhys; /* phys location of VGA mem */
+ int IOBase; /* I/O Base address */
+ CARD8 *MMIOBase; /* Pointer to MMIO start */
+ int MMIOOffset; /* base + offset + vgareg
+ = mmioreg */
+ pointer FontInfo1; /* save area for fonts in
+ plane 2 */
+ pointer FontInfo2; /* save area for fonts in
+ plane 3 */
+ pointer TextInfo; /* save area for text */
+ vgaRegRec SavedReg; /* saved registers */
+ vgaRegRec ModeReg; /* register settings for
+ current mode */
+ Bool ShowOverscan;
+ Bool paletteEnabled;
+ Bool cmapSaved;
+ ScrnInfoPtr pScrn;
+ vgaHWWriteIndexProcPtr writeCrtc;
+ vgaHWReadIndexProcPtr readCrtc;
+ vgaHWWriteIndexProcPtr writeGr;
+ vgaHWReadIndexProcPtr readGr;
+ vgaHWReadProcPtr readST00;
+ vgaHWReadProcPtr readST01;
+ vgaHWReadProcPtr readFCR;
+ vgaHWWriteProcPtr writeFCR;
+ vgaHWWriteIndexProcPtr writeAttr;
+ vgaHWReadIndexProcPtr readAttr;
+ vgaHWWriteIndexProcPtr writeSeq;
+ vgaHWReadIndexProcPtr readSeq;
+ vgaHWWriteProcPtr writeMiscOut;
+ vgaHWReadProcPtr readMiscOut;
+ vgaHWMiscProcPtr enablePalette;
+ vgaHWMiscProcPtr disablePalette;
+ vgaHWWriteProcPtr writeDacMask;
+ vgaHWReadProcPtr readDacMask;
+ vgaHWWriteProcPtr writeDacWriteAddr;
+ vgaHWWriteProcPtr writeDacReadAddr;
+ vgaHWWriteProcPtr writeDacData;
+ vgaHWReadProcPtr readDacData;
+ pointer ddc;
+ struct pci_io_handle *io;
+ vgaHWReadProcPtr readEnable;
+ vgaHWWriteProcPtr writeEnable;
+ struct pci_device *dev;
} vgaHWRec;
/* Some macros that VGA drivers can use in their ChipProbe() function */
-#define OVERSCAN 0x11 /* Index of OverScan register */
+#define OVERSCAN 0x11 /* Index of OverScan register */
/* Flags that define how overscan correction should take place */
-#define KGA_FIX_OVERSCAN 1 /* overcan correction required */
-#define KGA_ENABLE_ON_ZERO 2 /* if possible enable display at beginning */
+#define KGA_FIX_OVERSCAN 1 /* overcan correction required */
+#define KGA_ENABLE_ON_ZERO 2 /* if possible enable display at beginning */
/* of next scanline/frame */
-#define KGA_BE_TOT_DEC 4 /* always fix problem by setting blank end */
- /* to total - 1 */
-#define BIT_PLANE 3 /* Which plane we write to in mono mode */
+#define KGA_BE_TOT_DEC 4 /* always fix problem by setting blank end */
+ /* to total - 1 */
+#define BIT_PLANE 3 /* Which plane we write to in mono mode */
#define BITS_PER_GUN 6
#define COLORMAP_SIZE 256
@@ -191,17 +189,22 @@ extern _X_EXPORT Bool vgaHWSaveScreen(ScreenPtr pScreen, int mode);
extern _X_EXPORT void vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on);
extern _X_EXPORT vgaHWBlankScreenProc *vgaHWBlankScreenWeak(void);
extern _X_EXPORT void vgaHWSeqReset(vgaHWPtr hwp, Bool start);
-extern _X_EXPORT void vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore);
+extern _X_EXPORT void vgaHWRestoreFonts(ScrnInfoPtr scrninfp,
+ vgaRegPtr restore);
extern _X_EXPORT void vgaHWRestoreMode(ScrnInfoPtr scrninfp, vgaRegPtr restore);
-extern _X_EXPORT void vgaHWRestoreColormap(ScrnInfoPtr scrninfp, vgaRegPtr restore);
-extern _X_EXPORT void vgaHWRestore(ScrnInfoPtr scrninfp, vgaRegPtr restore, int flags);
+extern _X_EXPORT void vgaHWRestoreColormap(ScrnInfoPtr scrninfp,
+ vgaRegPtr restore);
+extern _X_EXPORT void vgaHWRestore(ScrnInfoPtr scrninfp, vgaRegPtr restore,
+ int flags);
extern _X_EXPORT void vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save);
extern _X_EXPORT void vgaHWSaveMode(ScrnInfoPtr scrninfp, vgaRegPtr save);
extern _X_EXPORT void vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save);
-extern _X_EXPORT void vgaHWSave(ScrnInfoPtr scrninfp, vgaRegPtr save, int flags);
+extern _X_EXPORT void vgaHWSave(ScrnInfoPtr scrninfp, vgaRegPtr save,
+ int flags);
extern _X_EXPORT Bool vgaHWInit(ScrnInfoPtr scrnp, DisplayModePtr mode);
-extern _X_EXPORT Bool vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer,
- int numGraphics, int numAttribute);
+extern _X_EXPORT Bool vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC,
+ int numSequencer, int numGraphics,
+ int numAttribute);
extern _X_EXPORT Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src);
extern _X_EXPORT Bool vgaHWGetHWRec(ScrnInfoPtr scrp);
extern _X_EXPORT void vgaHWFreeHWRec(ScrnInfoPtr scrp);
@@ -212,22 +215,23 @@ extern _X_EXPORT void vgaHWLock(vgaHWPtr hwp);
extern _X_EXPORT void vgaHWUnlock(vgaHWPtr hwp);
extern _X_EXPORT void vgaHWEnable(vgaHWPtr hwp);
extern _X_EXPORT void vgaHWDisable(vgaHWPtr hwp);
-extern _X_EXPORT void vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
+extern _X_EXPORT void vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode,
+ int flags);
extern _X_EXPORT Bool vgaHWHandleColormaps(ScreenPtr pScreen);
extern _X_EXPORT void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed);
-extern _X_EXPORT CARD32 vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
- unsigned int Flags);
-extern _X_EXPORT CARD32 vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
- unsigned int Flags);
+extern _X_EXPORT CARD32 vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp,
+ int nBits, unsigned int Flags);
+extern _X_EXPORT CARD32 vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp,
+ int nBits, unsigned int Flags);
extern _X_EXPORT Bool vgaHWAllocDefaultRegs(vgaRegPtr regp);
extern _X_EXPORT DDC1SetSpeedProc vgaHWddc1SetSpeedWeak(void);
extern _X_EXPORT SaveScreenProcPtr vgaHWSaveScreenWeak(void);
extern _X_EXPORT void xf86GetClocks(ScrnInfoPtr pScrn, int num,
- Bool (*ClockFunc)(ScrnInfoPtr, int),
- void (*ProtectRegs)(ScrnInfoPtr, Bool),
- void (*BlankScreen)(ScrnInfoPtr, Bool),
- unsigned long vertsyncreg, int maskval,
- int knownclkindex, int knownclkvalue);
+ Bool (*ClockFunc) (ScrnInfoPtr, int),
+ void (*ProtectRegs) (ScrnInfoPtr, Bool),
+ void (*BlankScreen) (ScrnInfoPtr, Bool),
+ unsigned long vertsyncreg, int maskval,
+ int knownclkindex, int knownclkvalue);
-#endif /* _VGAHW_H */
+#endif /* _VGAHW_H */
diff --git a/xorg-server/hw/xfree86/x86emu/debug.c b/xorg-server/hw/xfree86/x86emu/debug.c
index 6dea9c7bc..1a8d1d6c4 100644
--- a/xorg-server/hw/xfree86/x86emu/debug.c
+++ b/xorg-server/hw/xfree86/x86emu/debug.c
@@ -49,46 +49,51 @@
#ifdef DEBUG
-static void print_encoded_bytes (u16 s, u16 o);
-static void print_decoded_instruction (void);
-static int parse_line (char *s, int *ps, int *n);
-
+static void print_encoded_bytes(u16 s, u16 o);
+static void print_decoded_instruction(void);
+static int parse_line(char *s, int *ps, int *n);
+
/* should look something like debug's output. */
-void X86EMU_trace_regs (void)
+void
+X86EMU_trace_regs(void)
{
- if (DEBUG_TRACE()) {
- x86emu_dump_regs();
+ if (DEBUG_TRACE()) {
+ x86emu_dump_regs();
}
- if (DEBUG_DECODE() && ! DEBUG_DECODE_NOPRINT()) {
- printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
- print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
- print_decoded_instruction();
+ if (DEBUG_DECODE() && !DEBUG_DECODE_NOPRINT()) {
+ printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip);
+ print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip);
+ print_decoded_instruction();
}
}
-void X86EMU_trace_xregs (void)
+void
+X86EMU_trace_xregs(void)
{
- if (DEBUG_TRACE()) {
- x86emu_dump_xregs();
+ if (DEBUG_TRACE()) {
+ x86emu_dump_xregs();
}
}
-void x86emu_just_disassemble (void)
+void
+x86emu_just_disassemble(void)
{
/*
* This routine called if the flag DEBUG_DISASSEMBLE is set kind
* of a hack!
*/
- printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
- print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
- print_decoded_instruction();
+ printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip);
+ print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip);
+ print_decoded_instruction();
}
-static void disassemble_forward (u16 seg, u16 off, int n)
+static void
+disassemble_forward(u16 seg, u16 off, int n)
{
- X86EMU_sysEnv tregs;
- int i;
- u8 op1;
+ X86EMU_sysEnv tregs;
+ int i;
+ u8 op1;
+
/*
* hack, hack, hack. What we do is use the exact machinery set up
* for execution, except that now there is an additional state
@@ -113,17 +118,17 @@ static void disassemble_forward (u16 seg, u16 off, int n)
* This was done for an entirely different reason, but makes a
* nice way to get the system to help debug codes.
*/
- tregs = M;
+ tregs = M;
tregs.x86.R_IP = off;
tregs.x86.R_CS = seg;
-
+
/* reset the decoding buffers */
tregs.x86.enc_str_pos = 0;
tregs.x86.enc_pos = 0;
-
+
/* turn on the "disassemble only, no execute" flag */
tregs.x86.debug |= DEBUG_DISASSEMBLE_F;
-
+
/* DUMP NEXT n instructions to screen in straight_line fashion */
/*
* This looks like the regular instruction fetch stream, except
@@ -132,299 +137,359 @@ static void disassemble_forward (u16 seg, u16 off, int n)
* the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!!
* Note the use of a copy of the register structure...
*/
- for (i=0; i<n; i++) {
- op1 = (*sys_rdb)(((u32)M.x86.R_CS<<4) + (M.x86.R_IP++));
- (x86emu_optab[op1])(op1);
+ for (i = 0; i < n; i++) {
+ op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
+ (x86emu_optab[op1]) (op1);
}
/* end major hack mode. */
}
-void x86emu_check_ip_access (void)
+void
+x86emu_check_ip_access(void)
{
/* NULL as of now */
}
-void x86emu_check_sp_access (void)
+void
+x86emu_check_sp_access(void)
{
}
-void x86emu_check_mem_access (u32 dummy)
+void
+x86emu_check_mem_access(u32 dummy)
{
- /* check bounds, etc */
+ /* check bounds, etc */
}
-void x86emu_check_data_access (uint dummy1, uint dummy2)
+void
+x86emu_check_data_access(uint dummy1, uint dummy2)
{
- /* check bounds, etc */
+ /* check bounds, etc */
}
-void x86emu_inc_decoded_inst_len (int x)
+void
+x86emu_inc_decoded_inst_len(int x)
{
- M.x86.enc_pos += x;
+ M.x86.enc_pos += x;
}
-void x86emu_decode_printf (const char *x)
+void
+x86emu_decode_printf(const char *x)
{
- sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",x);
- M.x86.enc_str_pos += strlen(x);
+ sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", x);
+ M.x86.enc_str_pos += strlen(x);
}
-void x86emu_decode_printf2 (const char *x, int y)
+void
+x86emu_decode_printf2(const char *x, int y)
{
- char temp[100];
- snprintf(temp,sizeof(temp),x,y);
- sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",temp);
- M.x86.enc_str_pos += strlen(temp);
+ char temp[100];
+
+ snprintf(temp, sizeof(temp), x, y);
+ sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", temp);
+ M.x86.enc_str_pos += strlen(temp);
}
-void x86emu_end_instr (void)
+void
+x86emu_end_instr(void)
{
- M.x86.enc_str_pos = 0;
- M.x86.enc_pos = 0;
+ M.x86.enc_str_pos = 0;
+ M.x86.enc_pos = 0;
}
-static void print_encoded_bytes (u16 s, u16 o)
+static void
+print_encoded_bytes(u16 s, u16 o)
{
int i;
char buf1[64];
- for (i=0; i< M.x86.enc_pos; i++) {
- sprintf(buf1+2*i,"%02x", fetch_data_byte_abs(s,o+i));
+
+ for (i = 0; i < M.x86.enc_pos; i++) {
+ sprintf(buf1 + 2 * i, "%02x", fetch_data_byte_abs(s, o + i));
}
- printk("%-20s",buf1);
+ printk("%-20s", buf1);
}
-static void print_decoded_instruction (void)
+static void
+print_decoded_instruction(void)
{
- printk("%s", M.x86.decoded_buf);
+ printk("%s", M.x86.decoded_buf);
}
-void x86emu_print_int_vect (u16 iv)
+void
+x86emu_print_int_vect(u16 iv)
{
- u16 seg,off;
+ u16 seg, off;
- if (iv > 256) return;
- seg = fetch_data_word_abs(0,iv*4);
- off = fetch_data_word_abs(0,iv*4+2);
- printk("%04x:%04x ", seg, off);
+ if (iv > 256)
+ return;
+ seg = fetch_data_word_abs(0, iv * 4);
+ off = fetch_data_word_abs(0, iv * 4 + 2);
+ printk("%04x:%04x ", seg, off);
}
-void X86EMU_dump_memory (u16 seg, u16 off, u32 amt)
+void
+X86EMU_dump_memory(u16 seg, u16 off, u32 amt)
{
- u32 start = off & 0xfffffff0;
- u32 end = (off+16) & 0xfffffff0;
- u32 i;
- u32 current;
-
- current = start;
- while (end <= off + amt) {
- printk("%04x:%04x ", seg, start);
- for (i=start; i< off; i++)
- printk(" ");
- for ( ; i< end; i++)
- printk("%02x ", fetch_data_byte_abs(seg,i));
- printk("\n");
- start = end;
- end = start + 16;
- }
+ u32 start = off & 0xfffffff0;
+ u32 end = (off + 16) & 0xfffffff0;
+ u32 i;
+ u32 current;
+
+ current = start;
+ while (end <= off + amt) {
+ printk("%04x:%04x ", seg, start);
+ for (i = start; i < off; i++)
+ printk(" ");
+ for (; i < end; i++)
+ printk("%02x ", fetch_data_byte_abs(seg, i));
+ printk("\n");
+ start = end;
+ end = start + 16;
+ }
}
-void x86emu_single_step (void)
+void
+x86emu_single_step(void)
{
char s[1024];
int ps[10];
int ntok;
int cmd;
int done;
- int segment;
+ int segment;
int offset;
static int breakpoint;
static int noDecode = 1;
-
+
char *p;
- if (DEBUG_BREAK()) {
- if (M.x86.saved_ip != breakpoint) {
- return;
- } else {
- M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
- M.x86.debug |= DEBUG_TRACE_F;
- M.x86.debug &= ~DEBUG_BREAK_F;
- print_decoded_instruction ();
- X86EMU_trace_regs();
- }
- }
- done=0;
- offset = M.x86.saved_ip;
+ if (DEBUG_BREAK()) {
+ if (M.x86.saved_ip != breakpoint) {
+ return;
+ }
+ else {
+ M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
+ M.x86.debug |= DEBUG_TRACE_F;
+ M.x86.debug &= ~DEBUG_BREAK_F;
+ print_decoded_instruction();
+ X86EMU_trace_regs();
+ }
+ }
+ done = 0;
+ offset = M.x86.saved_ip;
while (!done) {
printk("-");
p = fgets(s, 1023, stdin);
cmd = parse_line(s, ps, &ntok);
- switch(cmd) {
- case 'u':
- disassemble_forward(M.x86.saved_cs,(u16)offset,10);
+ switch (cmd) {
+ case 'u':
+ disassemble_forward(M.x86.saved_cs, (u16) offset, 10);
break;
- case 'd':
- if (ntok == 2) {
- segment = M.x86.saved_cs;
- offset = ps[1];
- X86EMU_dump_memory(segment,(u16)offset,16);
- offset += 16;
- } else if (ntok == 3) {
- segment = ps[1];
- offset = ps[2];
- X86EMU_dump_memory(segment,(u16)offset,16);
- offset += 16;
- } else {
- segment = M.x86.saved_cs;
- X86EMU_dump_memory(segment,(u16)offset,16);
- offset += 16;
- }
+ case 'd':
+ if (ntok == 2) {
+ segment = M.x86.saved_cs;
+ offset = ps[1];
+ X86EMU_dump_memory(segment, (u16) offset, 16);
+ offset += 16;
+ }
+ else if (ntok == 3) {
+ segment = ps[1];
+ offset = ps[2];
+ X86EMU_dump_memory(segment, (u16) offset, 16);
+ offset += 16;
+ }
+ else {
+ segment = M.x86.saved_cs;
+ X86EMU_dump_memory(segment, (u16) offset, 16);
+ offset += 16;
+ }
break;
- case 'c':
- M.x86.debug ^= DEBUG_TRACECALL_F;
+ case 'c':
+ M.x86.debug ^= DEBUG_TRACECALL_F;
break;
- case 's':
- M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
+ case 's':
+ M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
break;
- case 'r':
- X86EMU_trace_regs();
+ case 'r':
+ X86EMU_trace_regs();
break;
- case 'x':
- X86EMU_trace_xregs();
+ case 'x':
+ X86EMU_trace_xregs();
break;
- case 'g':
+ case 'g':
if (ntok == 2) {
breakpoint = ps[1];
- if (noDecode) {
- M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
- } else {
- M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
- }
- M.x86.debug &= ~DEBUG_TRACE_F;
- M.x86.debug |= DEBUG_BREAK_F;
- done = 1;
+ if (noDecode) {
+ M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
+ }
+ else {
+ M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
+ }
+ M.x86.debug &= ~DEBUG_TRACE_F;
+ M.x86.debug |= DEBUG_BREAK_F;
+ done = 1;
}
break;
- case 'q':
- M.x86.debug |= DEBUG_EXIT;
- return;
- case 'P':
- noDecode = (noDecode)?0:1;
- printk("Toggled decoding to %s\n",(noDecode)?"FALSE":"TRUE");
- break;
- case 't':
- case 0:
+ case 'q':
+ M.x86.debug |= DEBUG_EXIT;
+ return;
+ case 'P':
+ noDecode = (noDecode) ? 0 : 1;
+ printk("Toggled decoding to %s\n", (noDecode) ? "FALSE" : "TRUE");
+ break;
+ case 't':
+ case 0:
done = 1;
break;
- }
+ }
}
}
-int X86EMU_trace_on(void)
+int
+X86EMU_trace_on(void)
{
- return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F;
+ return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F;
}
-int X86EMU_trace_off(void)
+int
+X86EMU_trace_off(void)
{
- return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F);
+ return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F);
}
-static int parse_line (char *s, int *ps, int *n)
+static int
+parse_line(char *s, int *ps, int *n)
{
int cmd;
*n = 0;
- while(*s == ' ' || *s == '\t') s++;
+ while (*s == ' ' || *s == '\t')
+ s++;
ps[*n] = *s;
switch (*s) {
- case '\n':
+ case '\n':
*n += 1;
return 0;
- default:
+ default:
cmd = *s;
*n += 1;
}
- while (1) {
- while (*s != ' ' && *s != '\t' && *s != '\n') s++;
-
- if (*s == '\n')
- return cmd;
-
- while(*s == ' ' || *s == '\t') s++;
-
- sscanf(s,"%x",&ps[*n]);
- *n += 1;
- }
+ while (1) {
+ while (*s != ' ' && *s != '\t' && *s != '\n')
+ s++;
+
+ if (*s == '\n')
+ return cmd;
+
+ while (*s == ' ' || *s == '\t')
+ s++;
+
+ sscanf(s, "%x", &ps[*n]);
+ *n += 1;
+ }
}
-#endif /* DEBUG */
+#endif /* DEBUG */
-void x86emu_dump_regs (void)
+void
+x86emu_dump_regs(void)
{
- printk("\tAX=%04x ", M.x86.R_AX );
- printk("BX=%04x ", M.x86.R_BX );
- printk("CX=%04x ", M.x86.R_CX );
- printk("DX=%04x ", M.x86.R_DX );
- printk("SP=%04x ", M.x86.R_SP );
- printk("BP=%04x ", M.x86.R_BP );
- printk("SI=%04x ", M.x86.R_SI );
- printk("DI=%04x\n", M.x86.R_DI );
- printk("\tDS=%04x ", M.x86.R_DS );
- printk("ES=%04x ", M.x86.R_ES );
- printk("SS=%04x ", M.x86.R_SS );
- printk("CS=%04x ", M.x86.R_CS );
- printk("IP=%04x ", M.x86.R_IP );
- if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
- else printk("NV ");
- if (ACCESS_FLAG(F_DF)) printk("DN ");
- else printk("UP ");
- if (ACCESS_FLAG(F_IF)) printk("EI ");
- else printk("DI ");
- if (ACCESS_FLAG(F_SF)) printk("NG ");
- else printk("PL ");
- if (ACCESS_FLAG(F_ZF)) printk("ZR ");
- else printk("NZ ");
- if (ACCESS_FLAG(F_AF)) printk("AC ");
- else printk("NA ");
- if (ACCESS_FLAG(F_PF)) printk("PE ");
- else printk("PO ");
- if (ACCESS_FLAG(F_CF)) printk("CY ");
- else printk("NC ");
- printk("\n");
+ printk("\tAX=%04x ", M.x86.R_AX);
+ printk("BX=%04x ", M.x86.R_BX);
+ printk("CX=%04x ", M.x86.R_CX);
+ printk("DX=%04x ", M.x86.R_DX);
+ printk("SP=%04x ", M.x86.R_SP);
+ printk("BP=%04x ", M.x86.R_BP);
+ printk("SI=%04x ", M.x86.R_SI);
+ printk("DI=%04x\n", M.x86.R_DI);
+ printk("\tDS=%04x ", M.x86.R_DS);
+ printk("ES=%04x ", M.x86.R_ES);
+ printk("SS=%04x ", M.x86.R_SS);
+ printk("CS=%04x ", M.x86.R_CS);
+ printk("IP=%04x ", M.x86.R_IP);
+ if (ACCESS_FLAG(F_OF))
+ printk("OV "); /* CHECKED... */
+ else
+ printk("NV ");
+ if (ACCESS_FLAG(F_DF))
+ printk("DN ");
+ else
+ printk("UP ");
+ if (ACCESS_FLAG(F_IF))
+ printk("EI ");
+ else
+ printk("DI ");
+ if (ACCESS_FLAG(F_SF))
+ printk("NG ");
+ else
+ printk("PL ");
+ if (ACCESS_FLAG(F_ZF))
+ printk("ZR ");
+ else
+ printk("NZ ");
+ if (ACCESS_FLAG(F_AF))
+ printk("AC ");
+ else
+ printk("NA ");
+ if (ACCESS_FLAG(F_PF))
+ printk("PE ");
+ else
+ printk("PO ");
+ if (ACCESS_FLAG(F_CF))
+ printk("CY ");
+ else
+ printk("NC ");
+ printk("\n");
}
-void x86emu_dump_xregs (void)
+void
+x86emu_dump_xregs(void)
{
- printk("\tEAX=%08x ", M.x86.R_EAX );
- printk("EBX=%08x ", M.x86.R_EBX );
- printk("ECX=%08x ", M.x86.R_ECX );
- printk("EDX=%08x \n", M.x86.R_EDX );
- printk("\tESP=%08x ", M.x86.R_ESP );
- printk("EBP=%08x ", M.x86.R_EBP );
- printk("ESI=%08x ", M.x86.R_ESI );
- printk("EDI=%08x\n", M.x86.R_EDI );
- printk("\tDS=%04x ", M.x86.R_DS );
- printk("ES=%04x ", M.x86.R_ES );
- printk("SS=%04x ", M.x86.R_SS );
- printk("CS=%04x ", M.x86.R_CS );
- printk("EIP=%08x\n\t", M.x86.R_EIP );
- if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
- else printk("NV ");
- if (ACCESS_FLAG(F_DF)) printk("DN ");
- else printk("UP ");
- if (ACCESS_FLAG(F_IF)) printk("EI ");
- else printk("DI ");
- if (ACCESS_FLAG(F_SF)) printk("NG ");
- else printk("PL ");
- if (ACCESS_FLAG(F_ZF)) printk("ZR ");
- else printk("NZ ");
- if (ACCESS_FLAG(F_AF)) printk("AC ");
- else printk("NA ");
- if (ACCESS_FLAG(F_PF)) printk("PE ");
- else printk("PO ");
- if (ACCESS_FLAG(F_CF)) printk("CY ");
- else printk("NC ");
- printk("\n");
+ printk("\tEAX=%08x ", M.x86.R_EAX);
+ printk("EBX=%08x ", M.x86.R_EBX);
+ printk("ECX=%08x ", M.x86.R_ECX);
+ printk("EDX=%08x \n", M.x86.R_EDX);
+ printk("\tESP=%08x ", M.x86.R_ESP);
+ printk("EBP=%08x ", M.x86.R_EBP);
+ printk("ESI=%08x ", M.x86.R_ESI);
+ printk("EDI=%08x\n", M.x86.R_EDI);
+ printk("\tDS=%04x ", M.x86.R_DS);
+ printk("ES=%04x ", M.x86.R_ES);
+ printk("SS=%04x ", M.x86.R_SS);
+ printk("CS=%04x ", M.x86.R_CS);
+ printk("EIP=%08x\n\t", M.x86.R_EIP);
+ if (ACCESS_FLAG(F_OF))
+ printk("OV "); /* CHECKED... */
+ else
+ printk("NV ");
+ if (ACCESS_FLAG(F_DF))
+ printk("DN ");
+ else
+ printk("UP ");
+ if (ACCESS_FLAG(F_IF))
+ printk("EI ");
+ else
+ printk("DI ");
+ if (ACCESS_FLAG(F_SF))
+ printk("NG ");
+ else
+ printk("PL ");
+ if (ACCESS_FLAG(F_ZF))
+ printk("ZR ");
+ else
+ printk("NZ ");
+ if (ACCESS_FLAG(F_AF))
+ printk("AC ");
+ else
+ printk("NA ");
+ if (ACCESS_FLAG(F_PF))
+ printk("PE ");
+ else
+ printk("PO ");
+ if (ACCESS_FLAG(F_CF))
+ printk("CY ");
+ else
+ printk("NC ");
+ printk("\n");
}
diff --git a/xorg-server/hw/xfree86/x86emu/decode.c b/xorg-server/hw/xfree86/x86emu/decode.c
index 9339f4c7f..12f8fb84b 100644
--- a/xorg-server/hw/xfree86/x86emu/decode.c
+++ b/xorg-server/hw/xfree86/x86emu/decode.c
@@ -46,25 +46,27 @@
REMARKS:
Handles any pending asychronous interrupts.
****************************************************************************/
-static void x86emu_intr_handle(void)
+static void
+x86emu_intr_handle(void)
{
- u8 intno;
-
- if (M.x86.intr & INTR_SYNCH) {
- intno = M.x86.intno;
- if (_X86EMU_intrTab[intno]) {
- (*_X86EMU_intrTab[intno])(intno);
- } else {
- push_word((u16)M.x86.R_FLG);
- CLEAR_FLAG(F_IF);
- CLEAR_FLAG(F_TF);
- push_word(M.x86.R_CS);
- M.x86.R_CS = mem_access_word(intno * 4 + 2);
- push_word(M.x86.R_IP);
- M.x86.R_IP = mem_access_word(intno * 4);
- M.x86.intr = 0;
- }
- }
+ u8 intno;
+
+ if (M.x86.intr & INTR_SYNCH) {
+ intno = M.x86.intno;
+ if (_X86EMU_intrTab[intno]) {
+ (*_X86EMU_intrTab[intno]) (intno);
+ }
+ else {
+ push_word((u16) M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(intno * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(intno * 4);
+ M.x86.intr = 0;
+ }
+ }
}
/****************************************************************************
@@ -75,11 +77,11 @@ REMARKS:
Raise the specified interrupt to be handled before the execution of the
next instruction.
****************************************************************************/
-void x86emu_intr_raise(
- u8 intrnum)
+void
+x86emu_intr_raise(u8 intrnum)
{
- M.x86.intno = intrnum;
- M.x86.intr |= INTR_SYNCH;
+ M.x86.intno = intrnum;
+ M.x86.intr |= INTR_SYNCH;
}
/****************************************************************************
@@ -88,38 +90,39 @@ Main execution loop for the emulator. We return from here when the system
halts, which is normally caused by a stack fault when we return from the
original real mode call.
****************************************************************************/
-void X86EMU_exec(void)
+void
+X86EMU_exec(void)
{
- u8 op1;
-
- M.x86.intr = 0;
- DB(x86emu_end_instr();)
-
- for (;;) {
-DB( if (CHECK_IP_FETCH())
- x86emu_check_ip_access();)
- /* If debugging, save the IP and CS values. */
- SAVE_IP_CS(M.x86.R_CS, M.x86.R_IP);
- INC_DECODED_INST_LEN(1);
- if (M.x86.intr) {
- if (M.x86.intr & INTR_HALTED) {
-DB( if (M.x86.R_SP != 0) {
- printk("halted\n");
- X86EMU_trace_regs();
- }
- else {
- if (M.x86.debug)
- printk("Service completed successfully\n");
- })
- return;
+ u8 op1;
+
+ M.x86.intr = 0;
+ DB(x86emu_end_instr();
+ )
+
+ for (;;) {
+ DB(if (CHECK_IP_FETCH())
+ x86emu_check_ip_access();)
+ /* If debugging, save the IP and CS values. */
+ SAVE_IP_CS(M.x86.R_CS, M.x86.R_IP);
+ INC_DECODED_INST_LEN(1);
+ if (M.x86.intr) {
+ if (M.x86.intr & INTR_HALTED) {
+ DB(if (M.x86.R_SP != 0) {
+ printk("halted\n"); X86EMU_trace_regs();}
+ else {
+ if (M.x86.debug)
+ printk("Service completed successfully\n");}
+ )
+ return;
}
- if (((M.x86.intr & INTR_SYNCH) && (M.x86.intno == 0 || M.x86.intno == 2)) ||
- !ACCESS_FLAG(F_IF)) {
- x86emu_intr_handle();
- }
- }
- op1 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
- (*x86emu_optab[op1])(op1);
+ if (((M.x86.intr & INTR_SYNCH) &&
+ (M.x86.intno == 0 || M.x86.intno == 2)) ||
+ !ACCESS_FLAG(F_IF)) {
+ x86emu_intr_handle();
+ }
+ }
+ op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
+ (*x86emu_optab[op1]) (op1);
if (M.x86.debug & DEBUG_EXIT) {
M.x86.debug &= ~DEBUG_EXIT;
return;
@@ -131,9 +134,10 @@ DB( if (M.x86.R_SP != 0) {
REMARKS:
Halts the system by setting the halted system flag.
****************************************************************************/
-void X86EMU_halt_sys(void)
+void
+X86EMU_halt_sys(void)
{
- M.x86.intr |= INTR_HALTED;
+ M.x86.intr |= INTR_HALTED;
}
/****************************************************************************
@@ -148,19 +152,17 @@ next instruction.
NOTE: Do not inline this function, as (*sys_rdb) is already inline!
****************************************************************************/
-void fetch_decode_modrm(
- int *mod,
- int *regh,
- int *regl)
+void
+fetch_decode_modrm(int *mod, int *regh, int *regl)
{
- int fetched;
-
-DB( if (CHECK_IP_FETCH())
- x86emu_check_ip_access();)
- fetched = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
- INC_DECODED_INST_LEN(1);
- *mod = (fetched >> 6) & 0x03;
- *regh = (fetched >> 3) & 0x07;
+ int fetched;
+
+ DB(if (CHECK_IP_FETCH())
+ x86emu_check_ip_access();)
+ fetched = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
+ INC_DECODED_INST_LEN(1);
+ *mod = (fetched >> 6) & 0x03;
+ *regh = (fetched >> 3) & 0x07;
*regl = (fetched >> 0) & 0x07;
}
@@ -174,15 +176,16 @@ moves the instruction pointer to the next value.
NOTE: Do not inline this function, as (*sys_rdb) is already inline!
****************************************************************************/
-u8 fetch_byte_imm(void)
+u8
+fetch_byte_imm(void)
{
- u8 fetched;
+ u8 fetched;
-DB( if (CHECK_IP_FETCH())
- x86emu_check_ip_access();)
- fetched = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
- INC_DECODED_INST_LEN(1);
- return fetched;
+ DB(if (CHECK_IP_FETCH())
+ x86emu_check_ip_access();)
+ fetched = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
+ INC_DECODED_INST_LEN(1);
+ return fetched;
}
/****************************************************************************
@@ -195,16 +198,17 @@ moves the instruction pointer to the next value.
NOTE: Do not inline this function, as (*sys_rdw) is already inline!
****************************************************************************/
-u16 fetch_word_imm(void)
+u16
+fetch_word_imm(void)
{
- u16 fetched;
-
-DB( if (CHECK_IP_FETCH())
- x86emu_check_ip_access();)
- fetched = (*sys_rdw)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP));
- M.x86.R_IP += 2;
- INC_DECODED_INST_LEN(2);
- return fetched;
+ u16 fetched;
+
+ DB(if (CHECK_IP_FETCH())
+ x86emu_check_ip_access();)
+ fetched = (*sys_rdw) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP));
+ M.x86.R_IP += 2;
+ INC_DECODED_INST_LEN(2);
+ return fetched;
}
/****************************************************************************
@@ -217,16 +221,17 @@ moves the instruction pointer to the next value.
NOTE: Do not inline this function, as (*sys_rdw) is already inline!
****************************************************************************/
-u32 fetch_long_imm(void)
+u32
+fetch_long_imm(void)
{
- u32 fetched;
-
-DB( if (CHECK_IP_FETCH())
- x86emu_check_ip_access();)
- fetched = (*sys_rdl)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP));
- M.x86.R_IP += 4;
- INC_DECODED_INST_LEN(4);
- return fetched;
+ u32 fetched;
+
+ DB(if (CHECK_IP_FETCH())
+ x86emu_check_ip_access();)
+ fetched = (*sys_rdl) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP));
+ M.x86.R_IP += 4;
+ INC_DECODED_INST_LEN(4);
+ return fetched;
}
/****************************************************************************
@@ -258,38 +263,39 @@ cpu-state-varible M.x86.mode. There are several potential states:
Each of the above 7 items are handled with a bit in the mode field.
****************************************************************************/
-_INLINE u32 get_data_segment(void)
+_INLINE u32
+get_data_segment(void)
{
#define GET_SEGMENT(segment)
- switch (M.x86.mode & SYSMODE_SEGMASK) {
- case 0: /* default case: use ds register */
- case SYSMODE_SEGOVR_DS:
- case SYSMODE_SEGOVR_DS | SYSMODE_SEG_DS_SS:
- return M.x86.R_DS;
- case SYSMODE_SEG_DS_SS: /* non-overridden, use ss register */
- return M.x86.R_SS;
- case SYSMODE_SEGOVR_CS:
- case SYSMODE_SEGOVR_CS | SYSMODE_SEG_DS_SS:
- return M.x86.R_CS;
- case SYSMODE_SEGOVR_ES:
- case SYSMODE_SEGOVR_ES | SYSMODE_SEG_DS_SS:
- return M.x86.R_ES;
- case SYSMODE_SEGOVR_FS:
- case SYSMODE_SEGOVR_FS | SYSMODE_SEG_DS_SS:
- return M.x86.R_FS;
- case SYSMODE_SEGOVR_GS:
- case SYSMODE_SEGOVR_GS | SYSMODE_SEG_DS_SS:
- return M.x86.R_GS;
- case SYSMODE_SEGOVR_SS:
- case SYSMODE_SEGOVR_SS | SYSMODE_SEG_DS_SS:
- return M.x86.R_SS;
- default:
+ switch (M.x86.mode & SYSMODE_SEGMASK) {
+ case 0: /* default case: use ds register */
+ case SYSMODE_SEGOVR_DS:
+ case SYSMODE_SEGOVR_DS | SYSMODE_SEG_DS_SS:
+ return M.x86.R_DS;
+ case SYSMODE_SEG_DS_SS: /* non-overridden, use ss register */
+ return M.x86.R_SS;
+ case SYSMODE_SEGOVR_CS:
+ case SYSMODE_SEGOVR_CS | SYSMODE_SEG_DS_SS:
+ return M.x86.R_CS;
+ case SYSMODE_SEGOVR_ES:
+ case SYSMODE_SEGOVR_ES | SYSMODE_SEG_DS_SS:
+ return M.x86.R_ES;
+ case SYSMODE_SEGOVR_FS:
+ case SYSMODE_SEGOVR_FS | SYSMODE_SEG_DS_SS:
+ return M.x86.R_FS;
+ case SYSMODE_SEGOVR_GS:
+ case SYSMODE_SEGOVR_GS | SYSMODE_SEG_DS_SS:
+ return M.x86.R_GS;
+ case SYSMODE_SEGOVR_SS:
+ case SYSMODE_SEGOVR_SS | SYSMODE_SEG_DS_SS:
+ return M.x86.R_SS;
+ default:
#ifdef DEBUG
- printk("error: should not happen: multiple overrides.\n");
+ printk("error: should not happen: multiple overrides.\n");
#endif
- HALT_SYS();
- return 0;
- }
+ HALT_SYS();
+ return 0;
+ }
}
/****************************************************************************
@@ -301,14 +307,14 @@ Byte value read from the absolute memory location.
NOTE: Do not inline this function as (*sys_rdX) is already inline!
****************************************************************************/
-u8 fetch_data_byte(
- uint offset)
+u8
+fetch_data_byte(uint offset)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access((u16)get_data_segment(), offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16) get_data_segment(), offset);
#endif
- return (*sys_rdb)((get_data_segment() << 4) + offset);
+ return (*sys_rdb) ((get_data_segment() << 4) + offset);
}
/****************************************************************************
@@ -320,14 +326,14 @@ Word value read from the absolute memory location.
NOTE: Do not inline this function as (*sys_rdX) is already inline!
****************************************************************************/
-u16 fetch_data_word(
- uint offset)
+u16
+fetch_data_word(uint offset)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access((u16)get_data_segment(), offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16) get_data_segment(), offset);
#endif
- return (*sys_rdw)((get_data_segment() << 4) + offset);
+ return (*sys_rdw) ((get_data_segment() << 4) + offset);
}
/****************************************************************************
@@ -339,14 +345,14 @@ Long value read from the absolute memory location.
NOTE: Do not inline this function as (*sys_rdX) is already inline!
****************************************************************************/
-u32 fetch_data_long(
- uint offset)
+u32
+fetch_data_long(uint offset)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access((u16)get_data_segment(), offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16) get_data_segment(), offset);
#endif
- return (*sys_rdl)((get_data_segment() << 4) + offset);
+ return (*sys_rdl) ((get_data_segment() << 4) + offset);
}
/****************************************************************************
@@ -359,15 +365,14 @@ Byte value read from the absolute memory location.
NOTE: Do not inline this function as (*sys_rdX) is already inline!
****************************************************************************/
-u8 fetch_data_byte_abs(
- uint segment,
- uint offset)
+u8
+fetch_data_byte_abs(uint segment, uint offset)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access(segment, offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
#endif
- return (*sys_rdb)(((u32)segment << 4) + offset);
+ return (*sys_rdb) (((u32) segment << 4) + offset);
}
/****************************************************************************
@@ -380,15 +385,14 @@ Word value read from the absolute memory location.
NOTE: Do not inline this function as (*sys_rdX) is already inline!
****************************************************************************/
-u16 fetch_data_word_abs(
- uint segment,
- uint offset)
+u16
+fetch_data_word_abs(uint segment, uint offset)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access(segment, offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
#endif
- return (*sys_rdw)(((u32)segment << 4) + offset);
+ return (*sys_rdw) (((u32) segment << 4) + offset);
}
/****************************************************************************
@@ -401,15 +405,14 @@ Long value read from the absolute memory location.
NOTE: Do not inline this function as (*sys_rdX) is already inline!
****************************************************************************/
-u32 fetch_data_long_abs(
- uint segment,
- uint offset)
+u32
+fetch_data_long_abs(uint segment, uint offset)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access(segment, offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
#endif
- return (*sys_rdl)(((u32)segment << 4) + offset);
+ return (*sys_rdl) (((u32) segment << 4) + offset);
}
/****************************************************************************
@@ -423,15 +426,14 @@ the current 'default' segment, which may have been overridden.
NOTE: Do not inline this function as (*sys_wrX) is already inline!
****************************************************************************/
-void store_data_byte(
- uint offset,
- u8 val)
+void
+store_data_byte(uint offset, u8 val)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access((u16)get_data_segment(), offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16) get_data_segment(), offset);
#endif
- (*sys_wrb)((get_data_segment() << 4) + offset, val);
+ (*sys_wrb) ((get_data_segment() << 4) + offset, val);
}
/****************************************************************************
@@ -445,15 +447,14 @@ the current 'default' segment, which may have been overridden.
NOTE: Do not inline this function as (*sys_wrX) is already inline!
****************************************************************************/
-void store_data_word(
- uint offset,
- u16 val)
+void
+store_data_word(uint offset, u16 val)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access((u16)get_data_segment(), offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16) get_data_segment(), offset);
#endif
- (*sys_wrw)((get_data_segment() << 4) + offset, val);
+ (*sys_wrw) ((get_data_segment() << 4) + offset, val);
}
/****************************************************************************
@@ -467,15 +468,14 @@ the current 'default' segment, which may have been overridden.
NOTE: Do not inline this function as (*sys_wrX) is already inline!
****************************************************************************/
-void store_data_long(
- uint offset,
- u32 val)
+void
+store_data_long(uint offset, u32 val)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access((u16)get_data_segment(), offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16) get_data_segment(), offset);
#endif
- (*sys_wrl)((get_data_segment() << 4) + offset, val);
+ (*sys_wrl) ((get_data_segment() << 4) + offset, val);
}
/****************************************************************************
@@ -489,16 +489,14 @@ Writes a byte value to an absolute memory location.
NOTE: Do not inline this function as (*sys_wrX) is already inline!
****************************************************************************/
-void store_data_byte_abs(
- uint segment,
- uint offset,
- u8 val)
+void
+store_data_byte_abs(uint segment, uint offset, u8 val)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access(segment, offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
#endif
- (*sys_wrb)(((u32)segment << 4) + offset, val);
+ (*sys_wrb) (((u32) segment << 4) + offset, val);
}
/****************************************************************************
@@ -512,16 +510,14 @@ Writes a word value to an absolute memory location.
NOTE: Do not inline this function as (*sys_wrX) is already inline!
****************************************************************************/
-void store_data_word_abs(
- uint segment,
- uint offset,
- u16 val)
+void
+store_data_word_abs(uint segment, uint offset, u16 val)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access(segment, offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
#endif
- (*sys_wrw)(((u32)segment << 4) + offset, val);
+ (*sys_wrw) (((u32) segment << 4) + offset, val);
}
/****************************************************************************
@@ -535,16 +531,14 @@ Writes a long value to an absolute memory location.
NOTE: Do not inline this function as (*sys_wrX) is already inline!
****************************************************************************/
-void store_data_long_abs(
- uint segment,
- uint offset,
- u32 val)
+void
+store_data_long_abs(uint segment, uint offset, u32 val)
{
#ifdef DEBUG
- if (CHECK_DATA_ACCESS())
- x86emu_check_data_access(segment, offset);
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
#endif
- (*sys_wrl)(((u32)segment << 4) + offset, val);
+ (*sys_wrl) (((u32) segment << 4) + offset, val);
}
/****************************************************************************
@@ -558,37 +552,37 @@ REMARKS:
Return a pointer to the register given by the R/RM field of the
modrm byte, for byte operands. Also enables the decoding of instructions.
****************************************************************************/
-u8* decode_rm_byte_register(
- int reg)
+u8 *
+decode_rm_byte_register(int reg)
{
- switch (reg) {
- case 0:
- DECODE_PRINTF("AL");
- return &M.x86.R_AL;
- case 1:
- DECODE_PRINTF("CL");
- return &M.x86.R_CL;
- case 2:
- DECODE_PRINTF("DL");
- return &M.x86.R_DL;
- case 3:
- DECODE_PRINTF("BL");
- return &M.x86.R_BL;
- case 4:
- DECODE_PRINTF("AH");
- return &M.x86.R_AH;
- case 5:
- DECODE_PRINTF("CH");
- return &M.x86.R_CH;
- case 6:
- DECODE_PRINTF("DH");
- return &M.x86.R_DH;
- case 7:
- DECODE_PRINTF("BH");
- return &M.x86.R_BH;
- }
- HALT_SYS();
- return NULL; /* NOT REACHED OR REACHED ON ERROR */
+ switch (reg) {
+ case 0:
+ DECODE_PRINTF("AL");
+ return &M.x86.R_AL;
+ case 1:
+ DECODE_PRINTF("CL");
+ return &M.x86.R_CL;
+ case 2:
+ DECODE_PRINTF("DL");
+ return &M.x86.R_DL;
+ case 3:
+ DECODE_PRINTF("BL");
+ return &M.x86.R_BL;
+ case 4:
+ DECODE_PRINTF("AH");
+ return &M.x86.R_AH;
+ case 5:
+ DECODE_PRINTF("CH");
+ return &M.x86.R_CH;
+ case 6:
+ DECODE_PRINTF("DH");
+ return &M.x86.R_DH;
+ case 7:
+ DECODE_PRINTF("BH");
+ return &M.x86.R_BH;
+ }
+ HALT_SYS();
+ return NULL; /* NOT REACHED OR REACHED ON ERROR */
}
/****************************************************************************
@@ -602,36 +596,36 @@ REMARKS:
Return a pointer to the register given by the R/RM field of the
modrm byte, for word operands. Also enables the decoding of instructions.
****************************************************************************/
-u16* decode_rm_word_register(
- int reg)
+u16 *
+decode_rm_word_register(int reg)
{
- switch (reg) {
- case 0:
- DECODE_PRINTF("AX");
- return &M.x86.R_AX;
- case 1:
- DECODE_PRINTF("CX");
- return &M.x86.R_CX;
- case 2:
- DECODE_PRINTF("DX");
- return &M.x86.R_DX;
- case 3:
- DECODE_PRINTF("BX");
- return &M.x86.R_BX;
- case 4:
- DECODE_PRINTF("SP");
- return &M.x86.R_SP;
- case 5:
- DECODE_PRINTF("BP");
- return &M.x86.R_BP;
- case 6:
- DECODE_PRINTF("SI");
- return &M.x86.R_SI;
- case 7:
- DECODE_PRINTF("DI");
- return &M.x86.R_DI;
- }
- HALT_SYS();
+ switch (reg) {
+ case 0:
+ DECODE_PRINTF("AX");
+ return &M.x86.R_AX;
+ case 1:
+ DECODE_PRINTF("CX");
+ return &M.x86.R_CX;
+ case 2:
+ DECODE_PRINTF("DX");
+ return &M.x86.R_DX;
+ case 3:
+ DECODE_PRINTF("BX");
+ return &M.x86.R_BX;
+ case 4:
+ DECODE_PRINTF("SP");
+ return &M.x86.R_SP;
+ case 5:
+ DECODE_PRINTF("BP");
+ return &M.x86.R_BP;
+ case 6:
+ DECODE_PRINTF("SI");
+ return &M.x86.R_SI;
+ case 7:
+ DECODE_PRINTF("DI");
+ return &M.x86.R_DI;
+ }
+ HALT_SYS();
return NULL; /* NOTREACHED OR REACHED ON ERROR */
}
@@ -646,36 +640,36 @@ REMARKS:
Return a pointer to the register given by the R/RM field of the
modrm byte, for dword operands. Also enables the decoding of instructions.
****************************************************************************/
-u32* decode_rm_long_register(
- int reg)
+u32 *
+decode_rm_long_register(int reg)
{
switch (reg) {
- case 0:
- DECODE_PRINTF("EAX");
- return &M.x86.R_EAX;
- case 1:
- DECODE_PRINTF("ECX");
- return &M.x86.R_ECX;
- case 2:
- DECODE_PRINTF("EDX");
- return &M.x86.R_EDX;
- case 3:
- DECODE_PRINTF("EBX");
- return &M.x86.R_EBX;
- case 4:
- DECODE_PRINTF("ESP");
- return &M.x86.R_ESP;
- case 5:
- DECODE_PRINTF("EBP");
- return &M.x86.R_EBP;
- case 6:
- DECODE_PRINTF("ESI");
- return &M.x86.R_ESI;
- case 7:
- DECODE_PRINTF("EDI");
- return &M.x86.R_EDI;
- }
- HALT_SYS();
+ case 0:
+ DECODE_PRINTF("EAX");
+ return &M.x86.R_EAX;
+ case 1:
+ DECODE_PRINTF("ECX");
+ return &M.x86.R_ECX;
+ case 2:
+ DECODE_PRINTF("EDX");
+ return &M.x86.R_EDX;
+ case 3:
+ DECODE_PRINTF("EBX");
+ return &M.x86.R_EBX;
+ case 4:
+ DECODE_PRINTF("ESP");
+ return &M.x86.R_ESP;
+ case 5:
+ DECODE_PRINTF("EBP");
+ return &M.x86.R_EBP;
+ case 6:
+ DECODE_PRINTF("ESI");
+ return &M.x86.R_ESI;
+ case 7:
+ DECODE_PRINTF("EDI");
+ return &M.x86.R_EDI;
+ }
+ HALT_SYS();
return NULL; /* NOTREACHED OR REACHED ON ERROR */
}
@@ -691,126 +685,129 @@ Return a pointer to the register given by the R/RM field of the
modrm byte, for word operands, modified from above for the weirdo
special case of segreg operands. Also enables the decoding of instructions.
****************************************************************************/
-u16* decode_rm_seg_register(
- int reg)
+u16 *
+decode_rm_seg_register(int reg)
{
- switch (reg) {
- case 0:
- DECODE_PRINTF("ES");
- return &M.x86.R_ES;
- case 1:
- DECODE_PRINTF("CS");
- return &M.x86.R_CS;
- case 2:
- DECODE_PRINTF("SS");
- return &M.x86.R_SS;
- case 3:
- DECODE_PRINTF("DS");
- return &M.x86.R_DS;
- case 4:
- DECODE_PRINTF("FS");
- return &M.x86.R_FS;
- case 5:
- DECODE_PRINTF("GS");
- return &M.x86.R_GS;
- case 6:
- case 7:
- DECODE_PRINTF("ILLEGAL SEGREG");
- break;
- }
- HALT_SYS();
- return NULL; /* NOT REACHED OR REACHED ON ERROR */
+ switch (reg) {
+ case 0:
+ DECODE_PRINTF("ES");
+ return &M.x86.R_ES;
+ case 1:
+ DECODE_PRINTF("CS");
+ return &M.x86.R_CS;
+ case 2:
+ DECODE_PRINTF("SS");
+ return &M.x86.R_SS;
+ case 3:
+ DECODE_PRINTF("DS");
+ return &M.x86.R_DS;
+ case 4:
+ DECODE_PRINTF("FS");
+ return &M.x86.R_FS;
+ case 5:
+ DECODE_PRINTF("GS");
+ return &M.x86.R_GS;
+ case 6:
+ case 7:
+ DECODE_PRINTF("ILLEGAL SEGREG");
+ break;
+ }
+ HALT_SYS();
+ return NULL; /* NOT REACHED OR REACHED ON ERROR */
}
/*
*
* return offset from the SIB Byte
*/
-u32 decode_sib_address(int sib, int mod)
+u32
+decode_sib_address(int sib, int mod)
{
u32 base = 0, i = 0, scale = 1;
- switch(sib & 0x07) {
+ switch (sib & 0x07) {
case 0:
- DECODE_PRINTF("[EAX]");
- base = M.x86.R_EAX;
- break;
+ DECODE_PRINTF("[EAX]");
+ base = M.x86.R_EAX;
+ break;
case 1:
- DECODE_PRINTF("[ECX]");
- base = M.x86.R_ECX;
- break;
+ DECODE_PRINTF("[ECX]");
+ base = M.x86.R_ECX;
+ break;
case 2:
- DECODE_PRINTF("[EDX]");
- base = M.x86.R_EDX;
- break;
+ DECODE_PRINTF("[EDX]");
+ base = M.x86.R_EDX;
+ break;
case 3:
- DECODE_PRINTF("[EBX]");
- base = M.x86.R_EBX;
- break;
+ DECODE_PRINTF("[EBX]");
+ base = M.x86.R_EBX;
+ break;
case 4:
- DECODE_PRINTF("[ESP]");
- base = M.x86.R_ESP;
- M.x86.mode |= SYSMODE_SEG_DS_SS;
- break;
+ DECODE_PRINTF("[ESP]");
+ base = M.x86.R_ESP;
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ break;
case 5:
- if (mod == 0) {
- base = fetch_long_imm();
- DECODE_PRINTF2("%08x", base);
- } else {
- DECODE_PRINTF("[EBP]");
- base = M.x86.R_ESP;
- M.x86.mode |= SYSMODE_SEG_DS_SS;
- }
- break;
+ if (mod == 0) {
+ base = fetch_long_imm();
+ DECODE_PRINTF2("%08x", base);
+ }
+ else {
+ DECODE_PRINTF("[EBP]");
+ base = M.x86.R_ESP;
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ }
+ break;
case 6:
- DECODE_PRINTF("[ESI]");
- base = M.x86.R_ESI;
- break;
+ DECODE_PRINTF("[ESI]");
+ base = M.x86.R_ESI;
+ break;
case 7:
- DECODE_PRINTF("[EDI]");
- base = M.x86.R_EDI;
- break;
+ DECODE_PRINTF("[EDI]");
+ base = M.x86.R_EDI;
+ break;
}
switch ((sib >> 3) & 0x07) {
case 0:
- DECODE_PRINTF("[EAX");
- i = M.x86.R_EAX;
- break;
+ DECODE_PRINTF("[EAX");
+ i = M.x86.R_EAX;
+ break;
case 1:
- DECODE_PRINTF("[ECX");
- i = M.x86.R_ECX;
- break;
+ DECODE_PRINTF("[ECX");
+ i = M.x86.R_ECX;
+ break;
case 2:
- DECODE_PRINTF("[EDX");
- i = M.x86.R_EDX;
- break;
+ DECODE_PRINTF("[EDX");
+ i = M.x86.R_EDX;
+ break;
case 3:
- DECODE_PRINTF("[EBX");
- i = M.x86.R_EBX;
- break;
+ DECODE_PRINTF("[EBX");
+ i = M.x86.R_EBX;
+ break;
case 4:
- i = 0;
- break;
+ i = 0;
+ break;
case 5:
- DECODE_PRINTF("[EBP");
- i = M.x86.R_EBP;
- break;
+ DECODE_PRINTF("[EBP");
+ i = M.x86.R_EBP;
+ break;
case 6:
- DECODE_PRINTF("[ESI");
- i = M.x86.R_ESI;
- break;
+ DECODE_PRINTF("[ESI");
+ i = M.x86.R_ESI;
+ break;
case 7:
- DECODE_PRINTF("[EDI");
- i = M.x86.R_EDI;
- break;
+ DECODE_PRINTF("[EDI");
+ i = M.x86.R_EDI;
+ break;
}
scale = 1 << ((sib >> 6) & 0x03);
if (((sib >> 3) & 0x07) != 4) {
- if (scale == 1) {
- DECODE_PRINTF("]");
- } else {
- DECODE_PRINTF2("*%d]", scale);
- }
+ if (scale == 1) {
+ DECODE_PRINTF("]");
+ }
+ else {
+ DECODE_PRINTF2("*%d]", scale);
+ }
}
return base + (i * scale);
}
@@ -835,74 +832,75 @@ NOTE: The code which specifies the corresponding segment (ds vs ss)
if a SS access is needed, set this bit. Otherwise, DS access
occurs (unless any of the segment override bits are set).
****************************************************************************/
-u32 decode_rm00_address(
- int rm)
+u32
+decode_rm00_address(int rm)
{
u32 offset;
int sib;
if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
/* 32-bit addressing */
- switch (rm) {
- case 0:
- DECODE_PRINTF("[EAX]");
- return M.x86.R_EAX;
- case 1:
- DECODE_PRINTF("[ECX]");
- return M.x86.R_ECX;
- case 2:
- DECODE_PRINTF("[EDX]");
- return M.x86.R_EDX;
- case 3:
- DECODE_PRINTF("[EBX]");
- return M.x86.R_EBX;
- case 4:
- sib = fetch_byte_imm();
- return decode_sib_address(sib, 0);
- case 5:
- offset = fetch_long_imm();
- DECODE_PRINTF2("[%08x]", offset);
- return offset;
- case 6:
- DECODE_PRINTF("[ESI]");
- return M.x86.R_ESI;
- case 7:
- DECODE_PRINTF("[EDI]");
- return M.x86.R_EDI;
- }
- HALT_SYS();
- } else {
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF("[EAX]");
+ return M.x86.R_EAX;
+ case 1:
+ DECODE_PRINTF("[ECX]");
+ return M.x86.R_ECX;
+ case 2:
+ DECODE_PRINTF("[EDX]");
+ return M.x86.R_EDX;
+ case 3:
+ DECODE_PRINTF("[EBX]");
+ return M.x86.R_EBX;
+ case 4:
+ sib = fetch_byte_imm();
+ return decode_sib_address(sib, 0);
+ case 5:
+ offset = fetch_long_imm();
+ DECODE_PRINTF2("[%08x]", offset);
+ return offset;
+ case 6:
+ DECODE_PRINTF("[ESI]");
+ return M.x86.R_ESI;
+ case 7:
+ DECODE_PRINTF("[EDI]");
+ return M.x86.R_EDI;
+ }
+ HALT_SYS();
+ }
+ else {
/* 16-bit addressing */
- switch (rm) {
- case 0:
- DECODE_PRINTF("[BX+SI]");
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF("[BX+SI]");
return (M.x86.R_BX + M.x86.R_SI) & 0xffff;
- case 1:
- DECODE_PRINTF("[BX+DI]");
+ case 1:
+ DECODE_PRINTF("[BX+DI]");
return (M.x86.R_BX + M.x86.R_DI) & 0xffff;
- case 2:
- DECODE_PRINTF("[BP+SI]");
- M.x86.mode |= SYSMODE_SEG_DS_SS;
+ case 2:
+ DECODE_PRINTF("[BP+SI]");
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
return (M.x86.R_BP + M.x86.R_SI) & 0xffff;
- case 3:
- DECODE_PRINTF("[BP+DI]");
- M.x86.mode |= SYSMODE_SEG_DS_SS;
+ case 3:
+ DECODE_PRINTF("[BP+DI]");
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
return (M.x86.R_BP + M.x86.R_DI) & 0xffff;
- case 4:
- DECODE_PRINTF("[SI]");
- return M.x86.R_SI;
- case 5:
- DECODE_PRINTF("[DI]");
- return M.x86.R_DI;
- case 6:
- offset = fetch_word_imm();
- DECODE_PRINTF2("[%04x]", offset);
- return offset;
- case 7:
- DECODE_PRINTF("[BX]");
- return M.x86.R_BX;
- }
- HALT_SYS();
+ case 4:
+ DECODE_PRINTF("[SI]");
+ return M.x86.R_SI;
+ case 5:
+ DECODE_PRINTF("[DI]");
+ return M.x86.R_DI;
+ case 6:
+ offset = fetch_word_imm();
+ DECODE_PRINTF2("[%04x]", offset);
+ return offset;
+ case 7:
+ DECODE_PRINTF("[BX]");
+ return M.x86.R_BX;
+ }
+ HALT_SYS();
}
return 0;
}
@@ -918,79 +916,80 @@ REMARKS:
Return the offset given by mod=01 addressing. Also enables the
decoding of instructions.
****************************************************************************/
-u32 decode_rm01_address(
- int rm)
+u32
+decode_rm01_address(int rm)
{
int displacement = 0;
int sib;
/* Fetch disp8 if no SIB byte */
if (!((M.x86.mode & SYSMODE_PREFIX_ADDR) && (rm == 4)))
- displacement = (s8)fetch_byte_imm();
+ displacement = (s8) fetch_byte_imm();
if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
/* 32-bit addressing */
- switch (rm) {
- case 0:
- DECODE_PRINTF2("%d[EAX]", displacement);
- return M.x86.R_EAX + displacement;
- case 1:
- DECODE_PRINTF2("%d[ECX]", displacement);
- return M.x86.R_ECX + displacement;
- case 2:
- DECODE_PRINTF2("%d[EDX]", displacement);
- return M.x86.R_EDX + displacement;
- case 3:
- DECODE_PRINTF2("%d[EBX]", displacement);
- return M.x86.R_EBX + displacement;
- case 4:
- sib = fetch_byte_imm();
- displacement = (s8)fetch_byte_imm();
- DECODE_PRINTF2("%d", displacement);
- return decode_sib_address(sib, 1) + displacement;
- case 5:
- DECODE_PRINTF2("%d[EBP]", displacement);
- return M.x86.R_EBP + displacement;
- case 6:
- DECODE_PRINTF2("%d[ESI]", displacement);
- return M.x86.R_ESI + displacement;
- case 7:
- DECODE_PRINTF2("%d[EDI]", displacement);
- return M.x86.R_EDI + displacement;
- }
- HALT_SYS();
- } else {
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF2("%d[EAX]", displacement);
+ return M.x86.R_EAX + displacement;
+ case 1:
+ DECODE_PRINTF2("%d[ECX]", displacement);
+ return M.x86.R_ECX + displacement;
+ case 2:
+ DECODE_PRINTF2("%d[EDX]", displacement);
+ return M.x86.R_EDX + displacement;
+ case 3:
+ DECODE_PRINTF2("%d[EBX]", displacement);
+ return M.x86.R_EBX + displacement;
+ case 4:
+ sib = fetch_byte_imm();
+ displacement = (s8) fetch_byte_imm();
+ DECODE_PRINTF2("%d", displacement);
+ return decode_sib_address(sib, 1) + displacement;
+ case 5:
+ DECODE_PRINTF2("%d[EBP]", displacement);
+ return M.x86.R_EBP + displacement;
+ case 6:
+ DECODE_PRINTF2("%d[ESI]", displacement);
+ return M.x86.R_ESI + displacement;
+ case 7:
+ DECODE_PRINTF2("%d[EDI]", displacement);
+ return M.x86.R_EDI + displacement;
+ }
+ HALT_SYS();
+ }
+ else {
/* 16-bit addressing */
- switch (rm) {
- case 0:
- DECODE_PRINTF2("%d[BX+SI]", displacement);
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF2("%d[BX+SI]", displacement);
return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff;
- case 1:
- DECODE_PRINTF2("%d[BX+DI]", displacement);
+ case 1:
+ DECODE_PRINTF2("%d[BX+DI]", displacement);
return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff;
- case 2:
- DECODE_PRINTF2("%d[BP+SI]", displacement);
- M.x86.mode |= SYSMODE_SEG_DS_SS;
+ case 2:
+ DECODE_PRINTF2("%d[BP+SI]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff;
- case 3:
- DECODE_PRINTF2("%d[BP+DI]", displacement);
- M.x86.mode |= SYSMODE_SEG_DS_SS;
+ case 3:
+ DECODE_PRINTF2("%d[BP+DI]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff;
- case 4:
- DECODE_PRINTF2("%d[SI]", displacement);
+ case 4:
+ DECODE_PRINTF2("%d[SI]", displacement);
return (M.x86.R_SI + displacement) & 0xffff;
- case 5:
- DECODE_PRINTF2("%d[DI]", displacement);
+ case 5:
+ DECODE_PRINTF2("%d[DI]", displacement);
return (M.x86.R_DI + displacement) & 0xffff;
- case 6:
- DECODE_PRINTF2("%d[BP]", displacement);
- M.x86.mode |= SYSMODE_SEG_DS_SS;
+ case 6:
+ DECODE_PRINTF2("%d[BP]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
return (M.x86.R_BP + displacement) & 0xffff;
- case 7:
- DECODE_PRINTF2("%d[BX]", displacement);
+ case 7:
+ DECODE_PRINTF2("%d[BX]", displacement);
return (M.x86.R_BX + displacement) & 0xffff;
- }
- HALT_SYS();
+ }
+ HALT_SYS();
}
return 0; /* SHOULD NOT HAPPEN */
}
@@ -1006,86 +1005,87 @@ REMARKS:
Return the offset given by mod=10 addressing. Also enables the
decoding of instructions.
****************************************************************************/
-u32 decode_rm10_address(
- int rm)
+u32
+decode_rm10_address(int rm)
{
u32 displacement = 0;
int sib;
/* Fetch disp16 if 16-bit addr mode */
if (!(M.x86.mode & SYSMODE_PREFIX_ADDR))
- displacement = (u16)fetch_word_imm();
+ displacement = (u16) fetch_word_imm();
else {
- /* Fetch disp32 if no SIB byte */
- if (rm != 4)
- displacement = (u32)fetch_long_imm();
+ /* Fetch disp32 if no SIB byte */
+ if (rm != 4)
+ displacement = (u32) fetch_long_imm();
}
if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
/* 32-bit addressing */
- switch (rm) {
- case 0:
- DECODE_PRINTF2("%08x[EAX]", displacement);
- return M.x86.R_EAX + displacement;
- case 1:
- DECODE_PRINTF2("%08x[ECX]", displacement);
- return M.x86.R_ECX + displacement;
- case 2:
- DECODE_PRINTF2("%08x[EDX]", displacement);
- M.x86.mode |= SYSMODE_SEG_DS_SS;
- return M.x86.R_EDX + displacement;
- case 3:
- DECODE_PRINTF2("%08x[EBX]", displacement);
- return M.x86.R_EBX + displacement;
- case 4:
- sib = fetch_byte_imm();
- displacement = (u32)fetch_long_imm();
- DECODE_PRINTF2("%08x", displacement);
- return decode_sib_address(sib, 2) + displacement;
- break;
- case 5:
- DECODE_PRINTF2("%08x[EBP]", displacement);
- return M.x86.R_EBP + displacement;
- case 6:
- DECODE_PRINTF2("%08x[ESI]", displacement);
- return M.x86.R_ESI + displacement;
- case 7:
- DECODE_PRINTF2("%08x[EDI]", displacement);
- return M.x86.R_EDI + displacement;
- }
- HALT_SYS();
- } else {
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF2("%08x[EAX]", displacement);
+ return M.x86.R_EAX + displacement;
+ case 1:
+ DECODE_PRINTF2("%08x[ECX]", displacement);
+ return M.x86.R_ECX + displacement;
+ case 2:
+ DECODE_PRINTF2("%08x[EDX]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return M.x86.R_EDX + displacement;
+ case 3:
+ DECODE_PRINTF2("%08x[EBX]", displacement);
+ return M.x86.R_EBX + displacement;
+ case 4:
+ sib = fetch_byte_imm();
+ displacement = (u32) fetch_long_imm();
+ DECODE_PRINTF2("%08x", displacement);
+ return decode_sib_address(sib, 2) + displacement;
+ break;
+ case 5:
+ DECODE_PRINTF2("%08x[EBP]", displacement);
+ return M.x86.R_EBP + displacement;
+ case 6:
+ DECODE_PRINTF2("%08x[ESI]", displacement);
+ return M.x86.R_ESI + displacement;
+ case 7:
+ DECODE_PRINTF2("%08x[EDI]", displacement);
+ return M.x86.R_EDI + displacement;
+ }
+ HALT_SYS();
+ }
+ else {
/* 16-bit addressing */
- switch (rm) {
- case 0:
+ switch (rm) {
+ case 0:
DECODE_PRINTF2("%04x[BX+SI]", displacement);
return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff;
- case 1:
+ case 1:
DECODE_PRINTF2("%04x[BX+DI]", displacement);
return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff;
- case 2:
- DECODE_PRINTF2("%04x[BP+SI]", displacement);
- M.x86.mode |= SYSMODE_SEG_DS_SS;
+ case 2:
+ DECODE_PRINTF2("%04x[BP+SI]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff;
- case 3:
- DECODE_PRINTF2("%04x[BP+DI]", displacement);
- M.x86.mode |= SYSMODE_SEG_DS_SS;
+ case 3:
+ DECODE_PRINTF2("%04x[BP+DI]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff;
- case 4:
+ case 4:
DECODE_PRINTF2("%04x[SI]", displacement);
return (M.x86.R_SI + displacement) & 0xffff;
- case 5:
+ case 5:
DECODE_PRINTF2("%04x[DI]", displacement);
return (M.x86.R_DI + displacement) & 0xffff;
- case 6:
- DECODE_PRINTF2("%04x[BP]", displacement);
- M.x86.mode |= SYSMODE_SEG_DS_SS;
+ case 6:
+ DECODE_PRINTF2("%04x[BP]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
return (M.x86.R_BP + displacement) & 0xffff;
- case 7:
+ case 7:
DECODE_PRINTF2("%04x[BX]", displacement);
return (M.x86.R_BX + displacement) & 0xffff;
- }
- HALT_SYS();
+ }
+ HALT_SYS();
}
return 0;
/*NOTREACHED */
diff --git a/xorg-server/hw/xfree86/x86emu/fpu.c b/xorg-server/hw/xfree86/x86emu/fpu.c
index fbc602da5..0dab05ce3 100644
--- a/xorg-server/hw/xfree86/x86emu/fpu.c
+++ b/xorg-server/hw/xfree86/x86emu/fpu.c
@@ -42,7 +42,8 @@
/*----------------------------- Implementation ----------------------------*/
/* opcode=0xd8 */
-void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
+void
+x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
{
START_OF_INSTR();
DECODE_PRINTF("ESC D8\n");
@@ -89,10 +90,11 @@ static const char *x86emu_fpu_op_d9_tab1[] = {
"FRNDINT", "FSCALE", "ESC_D9", "ESC_D9",
};
-#endif /* DEBUG */
+#endif /* DEBUG */
/* opcode=0xd9 */
-void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
+void
+x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset = 0;
@@ -103,56 +105,58 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
#ifdef DEBUG
if (mod != 3) {
DECODE_PRINTINSTR32(x86emu_fpu_op_d9_tab, mod, rh, rl);
- } else {
+ }
+ else {
DECODE_PRINTF(x86emu_fpu_op_d9_tab1[(rh << 3) + rl]);
}
#endif
switch (mod) {
- case 0:
+ case 0:
destoffset = decode_rm00_address(rl);
DECODE_PRINTF("\n");
break;
- case 1:
+ case 1:
destoffset = decode_rm01_address(rl);
DECODE_PRINTF("\n");
break;
- case 2:
+ case 2:
destoffset = decode_rm10_address(rl);
DECODE_PRINTF("\n");
break;
- case 3: /* register to register */
- stkelem = (u8)rl;
- if (rh < 4) {
- DECODE_PRINTF2("ST(%d)\n", stkelem);
- } else {
- DECODE_PRINTF("\n");
- }
+ case 3: /* register to register */
+ stkelem = (u8) rl;
+ if (rh < 4) {
+ DECODE_PRINTF2("ST(%d)\n", stkelem);
+ }
+ else {
+ DECODE_PRINTF("\n");
+ }
break;
}
#ifdef X86EMU_FPU_PRESENT
/* execute */
switch (mod) {
- case 3:
+ case 3:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_R_fld(X86EMU_FPU_STKTOP, stkelem);
break;
- case 1:
+ case 1:
x86emu_fpu_R_fxch(X86EMU_FPU_STKTOP, stkelem);
break;
- case 2:
+ case 2:
switch (rl) {
- case 0:
+ case 0:
x86emu_fpu_R_nop();
break;
- default:
+ default:
x86emu_fpu_illegal();
break;
}
- case 3:
+ case 3:
x86emu_fpu_R_fstp(X86EMU_FPU_STKTOP, stkelem);
break;
- case 4:
+ case 4:
switch (rl) {
case 0:
x86emu_fpu_R_fchs(X86EMU_FPU_STKTOP);
@@ -173,126 +177,126 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
}
break;
- case 5:
+ case 5:
switch (rl) {
- case 0:
+ case 0:
x86emu_fpu_R_fld1(X86EMU_FPU_STKTOP);
break;
- case 1:
+ case 1:
x86emu_fpu_R_fldl2t(X86EMU_FPU_STKTOP);
break;
- case 2:
+ case 2:
x86emu_fpu_R_fldl2e(X86EMU_FPU_STKTOP);
break;
- case 3:
+ case 3:
x86emu_fpu_R_fldpi(X86EMU_FPU_STKTOP);
break;
- case 4:
+ case 4:
x86emu_fpu_R_fldlg2(X86EMU_FPU_STKTOP);
break;
- case 5:
+ case 5:
x86emu_fpu_R_fldln2(X86EMU_FPU_STKTOP);
break;
- case 6:
+ case 6:
x86emu_fpu_R_fldz(X86EMU_FPU_STKTOP);
break;
- default:
+ default:
/* 7 */
x86emu_fpu_illegal();
break;
}
break;
- case 6:
+ case 6:
switch (rl) {
- case 0:
+ case 0:
x86emu_fpu_R_f2xm1(X86EMU_FPU_STKTOP);
break;
- case 1:
+ case 1:
x86emu_fpu_R_fyl2x(X86EMU_FPU_STKTOP);
break;
- case 2:
+ case 2:
x86emu_fpu_R_fptan(X86EMU_FPU_STKTOP);
break;
- case 3:
+ case 3:
x86emu_fpu_R_fpatan(X86EMU_FPU_STKTOP);
break;
- case 4:
+ case 4:
x86emu_fpu_R_fxtract(X86EMU_FPU_STKTOP);
break;
- case 5:
+ case 5:
x86emu_fpu_illegal();
break;
- case 6:
+ case 6:
x86emu_fpu_R_decstp();
break;
- case 7:
+ case 7:
x86emu_fpu_R_incstp();
break;
}
break;
- case 7:
+ case 7:
switch (rl) {
- case 0:
+ case 0:
x86emu_fpu_R_fprem(X86EMU_FPU_STKTOP);
break;
- case 1:
+ case 1:
x86emu_fpu_R_fyl2xp1(X86EMU_FPU_STKTOP);
break;
- case 2:
+ case 2:
x86emu_fpu_R_fsqrt(X86EMU_FPU_STKTOP);
break;
- case 3:
+ case 3:
x86emu_fpu_illegal();
break;
- case 4:
+ case 4:
x86emu_fpu_R_frndint(X86EMU_FPU_STKTOP);
break;
- case 5:
+ case 5:
x86emu_fpu_R_fscale(X86EMU_FPU_STKTOP);
break;
- case 6:
- case 7:
- default:
+ case 6:
+ case 7:
+ default:
x86emu_fpu_illegal();
break;
}
break;
- default:
+ default:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_M_fld(X86EMU_FPU_FLOAT, destoffset);
break;
- case 1:
+ case 1:
x86emu_fpu_illegal();
break;
- case 2:
+ case 2:
x86emu_fpu_M_fst(X86EMU_FPU_FLOAT, destoffset);
break;
- case 3:
+ case 3:
x86emu_fpu_M_fstp(X86EMU_FPU_FLOAT, destoffset);
break;
- case 4:
+ case 4:
x86emu_fpu_M_fldenv(X86EMU_FPU_WORD, destoffset);
break;
- case 5:
+ case 5:
x86emu_fpu_M_fldcw(X86EMU_FPU_WORD, destoffset);
break;
- case 6:
+ case 6:
x86emu_fpu_M_fstenv(X86EMU_FPU_WORD, destoffset);
break;
- case 7:
+ case 7:
x86emu_fpu_M_fstcw(X86EMU_FPU_WORD, destoffset);
break;
}
}
}
#else
- (void)destoffset;
- (void)stkelem;
-#endif /* X86EMU_FPU_PRESENT */
+ (void) destoffset;
+ (void) stkelem;
+#endif /* X86EMU_FPU_PRESENT */
DECODE_CLEAR_SEGOVR();
END_OF_INSTR_NO_TRACE();
}
@@ -309,7 +313,7 @@ static const char *x86emu_fpu_op_da_tab[] = {
"FICOMP\tDWORD PTR ",
"FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
"FIDIVR\tDWORD PTR ",
-
+
"FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
"FICOMP\tDWORD PTR ",
"FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
@@ -319,10 +323,11 @@ static const char *x86emu_fpu_op_da_tab[] = {
"ESC_DA ", "ESC_DA ", "ESC_DA ", "ESC_DA ",
};
-#endif /* DEBUG */
+#endif /* DEBUG */
/* opcode=0xda */
-void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
+void
+x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset = 0;
@@ -332,59 +337,59 @@ void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
DECODE_PRINTINSTR32(x86emu_fpu_op_da_tab, mod, rh, rl);
switch (mod) {
- case 0:
+ case 0:
destoffset = decode_rm00_address(rl);
DECODE_PRINTF("\n");
break;
- case 1:
+ case 1:
destoffset = decode_rm01_address(rl);
DECODE_PRINTF("\n");
break;
- case 2:
+ case 2:
destoffset = decode_rm10_address(rl);
DECODE_PRINTF("\n");
break;
- case 3: /* register to register */
- stkelem = (u8)rl;
+ case 3: /* register to register */
+ stkelem = (u8) rl;
DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
break;
}
#ifdef X86EMU_FPU_PRESENT
switch (mod) {
- case 3:
+ case 3:
x86emu_fpu_illegal();
break;
- default:
+ default:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_M_iadd(X86EMU_FPU_SHORT, destoffset);
break;
- case 1:
+ case 1:
x86emu_fpu_M_imul(X86EMU_FPU_SHORT, destoffset);
break;
- case 2:
+ case 2:
x86emu_fpu_M_icom(X86EMU_FPU_SHORT, destoffset);
break;
- case 3:
+ case 3:
x86emu_fpu_M_icomp(X86EMU_FPU_SHORT, destoffset);
break;
- case 4:
+ case 4:
x86emu_fpu_M_isub(X86EMU_FPU_SHORT, destoffset);
break;
- case 5:
+ case 5:
x86emu_fpu_M_isubr(X86EMU_FPU_SHORT, destoffset);
break;
- case 6:
+ case 6:
x86emu_fpu_M_idiv(X86EMU_FPU_SHORT, destoffset);
break;
- case 7:
+ case 7:
x86emu_fpu_M_idivr(X86EMU_FPU_SHORT, destoffset);
break;
}
}
#else
- (void)destoffset;
- (void)stkelem;
+ (void) destoffset;
+ (void) stkelem;
#endif
DECODE_CLEAR_SEGOVR();
END_OF_INSTR_NO_TRACE();
@@ -403,10 +408,11 @@ static const char *x86emu_fpu_op_db_tab[] = {
"ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
};
-#endif /* DEBUG */
+#endif /* DEBUG */
/* opcode=0xdb */
-void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
+void
+x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset = 0;
@@ -416,97 +422,99 @@ void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
#ifdef DEBUG
if (mod != 3) {
DECODE_PRINTINSTR32(x86emu_fpu_op_db_tab, mod, rh, rl);
- } else if (rh == 4) { /* === 11 10 0 nnn */
+ }
+ else if (rh == 4) { /* === 11 10 0 nnn */
switch (rl) {
- case 0:
+ case 0:
DECODE_PRINTF("FENI\n");
break;
- case 1:
+ case 1:
DECODE_PRINTF("FDISI\n");
break;
- case 2:
+ case 2:
DECODE_PRINTF("FCLEX\n");
break;
- case 3:
+ case 3:
DECODE_PRINTF("FINIT\n");
break;
}
- } else {
+ }
+ else {
DECODE_PRINTF2("ESC_DB %0x\n", (mod << 6) + (rh << 3) + (rl));
}
-#endif /* DEBUG */
+#endif /* DEBUG */
switch (mod) {
- case 0:
+ case 0:
destoffset = decode_rm00_address(rl);
break;
- case 1:
+ case 1:
destoffset = decode_rm01_address(rl);
break;
- case 2:
+ case 2:
destoffset = decode_rm10_address(rl);
break;
- case 3: /* register to register */
+ case 3: /* register to register */
break;
}
#ifdef X86EMU_FPU_PRESENT
/* execute */
switch (mod) {
- case 3:
+ case 3:
switch (rh) {
- case 4:
+ case 4:
switch (rl) {
- case 0:
+ case 0:
x86emu_fpu_R_feni();
break;
- case 1:
+ case 1:
x86emu_fpu_R_fdisi();
break;
- case 2:
+ case 2:
x86emu_fpu_R_fclex();
break;
- case 3:
+ case 3:
x86emu_fpu_R_finit();
break;
- default:
+ default:
x86emu_fpu_illegal();
break;
}
break;
- default:
+ default:
x86emu_fpu_illegal();
break;
}
break;
- default:
+ default:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_M_fild(X86EMU_FPU_SHORT, destoffset);
break;
- case 1:
+ case 1:
x86emu_fpu_illegal();
break;
- case 2:
+ case 2:
x86emu_fpu_M_fist(X86EMU_FPU_SHORT, destoffset);
break;
- case 3:
+ case 3:
x86emu_fpu_M_fistp(X86EMU_FPU_SHORT, destoffset);
break;
- case 4:
+ case 4:
x86emu_fpu_illegal();
break;
- case 5:
+ case 5:
x86emu_fpu_M_fld(X86EMU_FPU_LDBL, destoffset);
break;
- case 6:
+ case 6:
x86emu_fpu_illegal();
break;
- case 7:
+ case 7:
x86emu_fpu_M_fstp(X86EMU_FPU_LDBL, destoffset);
break;
}
}
#else
- (void)destoffset;
+ (void) destoffset;
#endif
DECODE_CLEAR_SEGOVR();
END_OF_INSTR_NO_TRACE();
@@ -532,10 +540,11 @@ static const char *x86emu_fpu_op_dc_tab[] = {
"FADD\t", "FMUL\t", "FCOM\t", "FCOMP\t",
"FSUBR\t", "FSUB\t", "FDIVR\t", "FDIV\t",
};
-#endif /* DEBUG */
+#endif /* DEBUG */
/* opcode=0xdc */
-void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
+void
+x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset = 0;
@@ -545,85 +554,85 @@ void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
DECODE_PRINTINSTR32(x86emu_fpu_op_dc_tab, mod, rh, rl);
switch (mod) {
- case 0:
+ case 0:
destoffset = decode_rm00_address(rl);
DECODE_PRINTF("\n");
break;
- case 1:
+ case 1:
destoffset = decode_rm01_address(rl);
DECODE_PRINTF("\n");
break;
- case 2:
+ case 2:
destoffset = decode_rm10_address(rl);
DECODE_PRINTF("\n");
break;
- case 3: /* register to register */
- stkelem = (u8)rl;
+ case 3: /* register to register */
+ stkelem = (u8) rl;
DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
break;
}
#ifdef X86EMU_FPU_PRESENT
/* execute */
switch (mod) {
- case 3:
+ case 3:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_R_fadd(stkelem, X86EMU_FPU_STKTOP);
break;
- case 1:
+ case 1:
x86emu_fpu_R_fmul(stkelem, X86EMU_FPU_STKTOP);
break;
- case 2:
+ case 2:
x86emu_fpu_R_fcom(stkelem, X86EMU_FPU_STKTOP);
break;
- case 3:
+ case 3:
x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
break;
- case 4:
+ case 4:
x86emu_fpu_R_fsubr(stkelem, X86EMU_FPU_STKTOP);
break;
- case 5:
+ case 5:
x86emu_fpu_R_fsub(stkelem, X86EMU_FPU_STKTOP);
break;
- case 6:
+ case 6:
x86emu_fpu_R_fdivr(stkelem, X86EMU_FPU_STKTOP);
break;
- case 7:
+ case 7:
x86emu_fpu_R_fdiv(stkelem, X86EMU_FPU_STKTOP);
break;
}
break;
- default:
+ default:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_M_fadd(X86EMU_FPU_DOUBLE, destoffset);
break;
- case 1:
+ case 1:
x86emu_fpu_M_fmul(X86EMU_FPU_DOUBLE, destoffset);
break;
- case 2:
+ case 2:
x86emu_fpu_M_fcom(X86EMU_FPU_DOUBLE, destoffset);
break;
- case 3:
+ case 3:
x86emu_fpu_M_fcomp(X86EMU_FPU_DOUBLE, destoffset);
break;
- case 4:
+ case 4:
x86emu_fpu_M_fsub(X86EMU_FPU_DOUBLE, destoffset);
break;
- case 5:
+ case 5:
x86emu_fpu_M_fsubr(X86EMU_FPU_DOUBLE, destoffset);
break;
- case 6:
+ case 6:
x86emu_fpu_M_fdiv(X86EMU_FPU_DOUBLE, destoffset);
break;
- case 7:
+ case 7:
x86emu_fpu_M_fdivr(X86EMU_FPU_DOUBLE, destoffset);
break;
}
}
#else
- (void)destoffset;
- (void)stkelem;
+ (void) destoffset;
+ (void) stkelem;
#endif
DECODE_CLEAR_SEGOVR();
END_OF_INSTR_NO_TRACE();
@@ -645,10 +654,11 @@ static const char *x86emu_fpu_op_dd_tab[] = {
"ESC_DD\t2C,", "ESC_DD\t2D,", "ESC_DD\t2E,", "ESC_DD\t2F,",
};
-#endif /* DEBUG */
+#endif /* DEBUG */
/* opcode=0xdd */
-void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
+void
+x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset = 0;
@@ -658,75 +668,75 @@ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
DECODE_PRINTINSTR32(x86emu_fpu_op_dd_tab, mod, rh, rl);
switch (mod) {
- case 0:
+ case 0:
destoffset = decode_rm00_address(rl);
DECODE_PRINTF("\n");
break;
- case 1:
+ case 1:
destoffset = decode_rm01_address(rl);
DECODE_PRINTF("\n");
break;
- case 2:
+ case 2:
destoffset = decode_rm10_address(rl);
DECODE_PRINTF("\n");
break;
- case 3: /* register to register */
- stkelem = (u8)rl;
+ case 3: /* register to register */
+ stkelem = (u8) rl;
DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
break;
}
#ifdef X86EMU_FPU_PRESENT
switch (mod) {
- case 3:
+ case 3:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_R_ffree(stkelem);
break;
- case 1:
+ case 1:
x86emu_fpu_R_fxch(stkelem);
break;
- case 2:
+ case 2:
x86emu_fpu_R_fst(stkelem); /* register version */
break;
- case 3:
+ case 3:
x86emu_fpu_R_fstp(stkelem); /* register version */
break;
- default:
+ default:
x86emu_fpu_illegal();
break;
}
break;
- default:
+ default:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_M_fld(X86EMU_FPU_DOUBLE, destoffset);
break;
- case 1:
+ case 1:
x86emu_fpu_illegal();
break;
- case 2:
+ case 2:
x86emu_fpu_M_fst(X86EMU_FPU_DOUBLE, destoffset);
break;
- case 3:
+ case 3:
x86emu_fpu_M_fstp(X86EMU_FPU_DOUBLE, destoffset);
break;
- case 4:
+ case 4:
x86emu_fpu_M_frstor(X86EMU_FPU_WORD, destoffset);
break;
- case 5:
+ case 5:
x86emu_fpu_illegal();
break;
- case 6:
+ case 6:
x86emu_fpu_M_fsave(X86EMU_FPU_WORD, destoffset);
break;
- case 7:
+ case 7:
x86emu_fpu_M_fstsw(X86EMU_FPU_WORD, destoffset);
break;
}
}
#else
- (void)destoffset;
- (void)stkelem;
+ (void) destoffset;
+ (void) stkelem;
#endif
DECODE_CLEAR_SEGOVR();
END_OF_INSTR_NO_TRACE();
@@ -734,8 +744,7 @@ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
#ifdef DEBUG
-static const char *x86emu_fpu_op_de_tab[] =
-{
+static const char *x86emu_fpu_op_de_tab[] = {
"FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ",
"FICOMP\tWORD PTR ",
"FISUB\tWORD PTR ", "FISUBR\tWORD PTR ", "FIDIV\tWORD PTR ",
@@ -755,10 +764,11 @@ static const char *x86emu_fpu_op_de_tab[] =
"FSUBRP\t", "FSUBP\t", "FDIVRP\t", "FDIVP\t",
};
-#endif /* DEBUG */
+#endif /* DEBUG */
/* opcode=0xde */
-void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
+void
+x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset = 0;
@@ -768,87 +778,87 @@ void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
DECODE_PRINTINSTR32(x86emu_fpu_op_de_tab, mod, rh, rl);
switch (mod) {
- case 0:
+ case 0:
destoffset = decode_rm00_address(rl);
DECODE_PRINTF("\n");
break;
- case 1:
+ case 1:
destoffset = decode_rm01_address(rl);
DECODE_PRINTF("\n");
break;
- case 2:
+ case 2:
destoffset = decode_rm10_address(rl);
DECODE_PRINTF("\n");
break;
- case 3: /* register to register */
- stkelem = (u8)rl;
+ case 3: /* register to register */
+ stkelem = (u8) rl;
DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
break;
}
#ifdef X86EMU_FPU_PRESENT
switch (mod) {
- case 3:
+ case 3:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_R_faddp(stkelem, X86EMU_FPU_STKTOP);
break;
- case 1:
+ case 1:
x86emu_fpu_R_fmulp(stkelem, X86EMU_FPU_STKTOP);
break;
- case 2:
+ case 2:
x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
break;
- case 3:
+ case 3:
if (stkelem == 1)
- x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP);
+ x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP);
else
- x86emu_fpu_illegal();
+ x86emu_fpu_illegal();
break;
- case 4:
+ case 4:
x86emu_fpu_R_fsubrp(stkelem, X86EMU_FPU_STKTOP);
break;
- case 5:
+ case 5:
x86emu_fpu_R_fsubp(stkelem, X86EMU_FPU_STKTOP);
break;
- case 6:
+ case 6:
x86emu_fpu_R_fdivrp(stkelem, X86EMU_FPU_STKTOP);
break;
- case 7:
+ case 7:
x86emu_fpu_R_fdivp(stkelem, X86EMU_FPU_STKTOP);
break;
}
break;
- default:
+ default:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_M_fiadd(X86EMU_FPU_WORD, destoffset);
break;
- case 1:
+ case 1:
x86emu_fpu_M_fimul(X86EMU_FPU_WORD, destoffset);
break;
- case 2:
+ case 2:
x86emu_fpu_M_ficom(X86EMU_FPU_WORD, destoffset);
break;
- case 3:
+ case 3:
x86emu_fpu_M_ficomp(X86EMU_FPU_WORD, destoffset);
break;
- case 4:
+ case 4:
x86emu_fpu_M_fisub(X86EMU_FPU_WORD, destoffset);
break;
- case 5:
+ case 5:
x86emu_fpu_M_fisubr(X86EMU_FPU_WORD, destoffset);
break;
- case 6:
+ case 6:
x86emu_fpu_M_fidiv(X86EMU_FPU_WORD, destoffset);
break;
- case 7:
+ case 7:
x86emu_fpu_M_fidivr(X86EMU_FPU_WORD, destoffset);
break;
}
}
#else
- (void)destoffset;
- (void)stkelem;
+ (void) destoffset;
+ (void) stkelem;
#endif
DECODE_CLEAR_SEGOVR();
END_OF_INSTR_NO_TRACE();
@@ -877,10 +887,11 @@ static const char *x86emu_fpu_op_df_tab[] = {
"ESC_DF\t3C,", "ESC_DF\t3D,", "ESC_DF\t3E,", "ESC_DF\t3F,"
};
-#endif /* DEBUG */
+#endif /* DEBUG */
/* opcode=0xdf */
-void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
+void
+x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
uint destoffset = 0;
@@ -890,75 +901,75 @@ void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
FETCH_DECODE_MODRM(mod, rh, rl);
DECODE_PRINTINSTR32(x86emu_fpu_op_df_tab, mod, rh, rl);
switch (mod) {
- case 0:
+ case 0:
destoffset = decode_rm00_address(rl);
DECODE_PRINTF("\n");
break;
- case 1:
+ case 1:
destoffset = decode_rm01_address(rl);
DECODE_PRINTF("\n");
break;
- case 2:
+ case 2:
destoffset = decode_rm10_address(rl);
DECODE_PRINTF("\n");
break;
- case 3: /* register to register */
- stkelem = (u8)rl;
+ case 3: /* register to register */
+ stkelem = (u8) rl;
DECODE_PRINTF2("\tST(%d)\n", stkelem);
break;
}
#ifdef X86EMU_FPU_PRESENT
switch (mod) {
- case 3:
+ case 3:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_R_ffree(stkelem);
break;
- case 1:
+ case 1:
x86emu_fpu_R_fxch(stkelem);
break;
- case 2:
+ case 2:
x86emu_fpu_R_fst(stkelem); /* register version */
break;
- case 3:
+ case 3:
x86emu_fpu_R_fstp(stkelem); /* register version */
break;
- default:
+ default:
x86emu_fpu_illegal();
break;
}
break;
- default:
+ default:
switch (rh) {
- case 0:
+ case 0:
x86emu_fpu_M_fild(X86EMU_FPU_WORD, destoffset);
break;
- case 1:
+ case 1:
x86emu_fpu_illegal();
break;
- case 2:
+ case 2:
x86emu_fpu_M_fist(X86EMU_FPU_WORD, destoffset);
break;
- case 3:
+ case 3:
x86emu_fpu_M_fistp(X86EMU_FPU_WORD, destoffset);
break;
- case 4:
+ case 4:
x86emu_fpu_M_fbld(X86EMU_FPU_BSD, destoffset);
break;
- case 5:
+ case 5:
x86emu_fpu_M_fild(X86EMU_FPU_LONG, destoffset);
break;
- case 6:
+ case 6:
x86emu_fpu_M_fbstp(X86EMU_FPU_BSD, destoffset);
break;
- case 7:
+ case 7:
x86emu_fpu_M_fistp(X86EMU_FPU_LONG, destoffset);
break;
}
}
#else
- (void)destoffset;
- (void)stkelem;
+ (void) destoffset;
+ (void) stkelem;
#endif
DECODE_CLEAR_SEGOVR();
END_OF_INSTR_NO_TRACE();
diff --git a/xorg-server/hw/xfree86/x86emu/ops.c b/xorg-server/hw/xfree86/x86emu/ops.c
index a55398275..76b83581f 100644
--- a/xorg-server/hw/xfree86/x86emu/ops.c
+++ b/xorg-server/hw/xfree86/x86emu/ops.c
@@ -1,11752 +1,12307 @@
-/****************************************************************************
-*
-* Realmode X86 Emulator Library
-*
-* Copyright (C) 1996-1999 SciTech Software, Inc.
-* Copyright (C) David Mosberger-Tang
-* Copyright (C) 1999 Egbert Eich
-*
-* ========================================================================
-*
-* Permission to use, copy, modify, distribute, and sell this software and
-* its documentation for any purpose is hereby granted without fee,
-* provided that the above copyright notice appear in all copies and that
-* both that copyright notice and this permission notice appear in
-* supporting documentation, and that the name of the authors not be used
-* in advertising or publicity pertaining to distribution of the software
-* without specific, written prior permission. The authors makes no
-* representations about the suitability of this software for any purpose.
-* It is provided "as is" without express or implied warranty.
-*
-* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
-* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-* PERFORMANCE OF THIS SOFTWARE.
-*
-* ========================================================================
-*
-* Language: ANSI C
-* Environment: Any
-* Developer: Kendall Bennett
-*
-* Description: This file includes subroutines to implement the decoding
-* and emulation of all the x86 processor instructions.
-*
-* There are approximately 250 subroutines in here, which correspond
-* to the 256 byte-"opcodes" found on the 8086. The table which
-* dispatches this is found in the files optab.[ch].
-*
-* Each opcode proc has a comment preceeding it which gives it's table
-* address. Several opcodes are missing (undefined) in the table.
-*
-* Each proc includes information for decoding (DECODE_PRINTF and
-* DECODE_PRINTF2), debugging (TRACE_REGS, SINGLE_STEP), and misc
-* functions (START_OF_INSTR, END_OF_INSTR).
-*
-* Many of the procedures are *VERY* similar in coding. This has
-* allowed for a very large amount of code to be generated in a fairly
-* short amount of time (i.e. cut, paste, and modify). The result is
-* that much of the code below could have been folded into subroutines
-* for a large reduction in size of this file. The downside would be
-* that there would be a penalty in execution speed. The file could
-* also have been *MUCH* larger by inlining certain functions which
-* were called. This could have resulted even faster execution. The
-* prime directive I used to decide whether to inline the code or to
-* modularize it, was basically: 1) no unnecessary subroutine calls,
-* 2) no routines more than about 200 lines in size, and 3) modularize
-* any code that I might not get right the first time. The fetch_*
-* subroutines fall into the latter category. The The decode_* fall
-* into the second category. The coding of the "switch(mod){ .... }"
-* in many of the subroutines below falls into the first category.
-* Especially, the coding of {add,and,or,sub,...}_{byte,word}
-* subroutines are an especially glaring case of the third guideline.
-* Since so much of the code is cloned from other modules (compare
-* opcode #00 to opcode #01), making the basic operations subroutine
-* calls is especially important; otherwise mistakes in coding an
-* "add" would represent a nightmare in maintenance.
-*
-****************************************************************************/
-
-#include "x86emu/x86emui.h"
-
-/*----------------------------- Implementation ----------------------------*/
-
-/****************************************************************************
-PARAMETERS:
-op1 - Instruction op code
-
-REMARKS:
-Handles illegal opcodes.
-****************************************************************************/
-static void x86emuOp_illegal_op(
- u8 op1)
-{
- START_OF_INSTR();
- if (M.x86.R_SP != 0) {
- DECODE_PRINTF("ILLEGAL X86 OPCODE\n");
- TRACE_REGS();
- DB( printk("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n",
- M.x86.R_CS, M.x86.R_IP-1,op1));
- HALT_SYS();
- }
- else {
- /* If we get here, it means the stack pointer is back to zero
- * so we are just returning from an emulator service call
- * so therte is no need to display an error message. We trap
- * the emulator with an 0xF1 opcode to finish the service
- * call.
- */
- X86EMU_halt_sys();
- }
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x00
-****************************************************************************/
-static void x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
- u8 *destreg, *srcreg;
- u8 destval;
-
- START_OF_INSTR();
- DECODE_PRINTF("ADD\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x01
-****************************************************************************/
-static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("ADD\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = add_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x02
-****************************************************************************/
-static void x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint srcoffset;
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("ADD\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_byte(*destreg, srcval);
- break;
- case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_byte(*destreg, srcval);
- break;
- case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_byte(*destreg, srcval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x03
-****************************************************************************/
-static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("ADD\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_word(*destreg, srcval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_word(*destreg, srcval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_word(*destreg, srcval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = add_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x04
-****************************************************************************/
-static void x86emuOp_add_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("ADD\tAL,");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- M.x86.R_AL = add_byte(M.x86.R_AL, srcval);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x05
-****************************************************************************/
-static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("ADD\tEAX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("ADD\tAX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = add_long(M.x86.R_EAX, srcval);
- } else {
- M.x86.R_AX = add_word(M.x86.R_AX, (u16)srcval);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x06
-****************************************************************************/
-static void x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("PUSH\tES\n");
- TRACE_AND_STEP();
- push_word(M.x86.R_ES);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x07
-****************************************************************************/
-static void x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("POP\tES\n");
- TRACE_AND_STEP();
- M.x86.R_ES = pop_word();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x08
-****************************************************************************/
-static void x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint destoffset;
- u8 destval;
-
- START_OF_INSTR();
- DECODE_PRINTF("OR\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x09
-****************************************************************************/
-static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("OR\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = or_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x0a
-****************************************************************************/
-static void x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint srcoffset;
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("OR\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_byte(*destreg, srcval);
- break;
- case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_byte(*destreg, srcval);
- break;
- case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_byte(*destreg, srcval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x0b
-****************************************************************************/
-static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("OR\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_word(*destreg, srcval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_word(*destreg, srcval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_word(*destreg, srcval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = or_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x0c
-****************************************************************************/
-static void x86emuOp_or_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("OR\tAL,");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- M.x86.R_AL = or_byte(M.x86.R_AL, srcval);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x0d
-****************************************************************************/
-static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("OR\tEAX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("OR\tAX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = or_long(M.x86.R_EAX, srcval);
- } else {
- M.x86.R_AX = or_word(M.x86.R_AX, (u16)srcval);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x0e
-****************************************************************************/
-static void x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("PUSH\tCS\n");
- TRACE_AND_STEP();
- push_word(M.x86.R_CS);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x0f. Escape for two-byte opcode (286 or better)
-****************************************************************************/
-static void x86emuOp_two_byte(u8 X86EMU_UNUSED(op1))
-{
- u8 op2 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
- INC_DECODED_INST_LEN(1);
- (*x86emu_optab2[op2])(op2);
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x10
-****************************************************************************/
-static void x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint destoffset;
- u8 destval;
-
- START_OF_INSTR();
- DECODE_PRINTF("ADC\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x11
-****************************************************************************/
-static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("ADC\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = adc_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x12
-****************************************************************************/
-static void x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint srcoffset;
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("ADC\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_byte(*destreg, srcval);
- break;
- case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_byte(*destreg, srcval);
- break;
- case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_byte(*destreg, srcval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x13
-****************************************************************************/
-static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("ADC\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_word(*destreg, srcval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_word(*destreg, srcval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_word(*destreg, srcval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = adc_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x14
-****************************************************************************/
-static void x86emuOp_adc_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("ADC\tAL,");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- M.x86.R_AL = adc_byte(M.x86.R_AL, srcval);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x15
-****************************************************************************/
-static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("ADC\tEAX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("ADC\tAX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = adc_long(M.x86.R_EAX, srcval);
- } else {
- M.x86.R_AX = adc_word(M.x86.R_AX, (u16)srcval);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x16
-****************************************************************************/
-static void x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("PUSH\tSS\n");
- TRACE_AND_STEP();
- push_word(M.x86.R_SS);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x17
-****************************************************************************/
-static void x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("POP\tSS\n");
- TRACE_AND_STEP();
- M.x86.R_SS = pop_word();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x18
-****************************************************************************/
-static void x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint destoffset;
- u8 destval;
-
- START_OF_INSTR();
- DECODE_PRINTF("SBB\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x19
-****************************************************************************/
-static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("SBB\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sbb_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x1a
-****************************************************************************/
-static void x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint srcoffset;
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("SBB\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_byte(*destreg, srcval);
- break;
- case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_byte(*destreg, srcval);
- break;
- case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_byte(*destreg, srcval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x1b
-****************************************************************************/
-static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("SBB\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_word(*destreg, srcval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_word(*destreg, srcval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_word(*destreg, srcval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sbb_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x1c
-****************************************************************************/
-static void x86emuOp_sbb_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("SBB\tAL,");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- M.x86.R_AL = sbb_byte(M.x86.R_AL, srcval);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x1d
-****************************************************************************/
-static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("SBB\tEAX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("SBB\tAX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = sbb_long(M.x86.R_EAX, srcval);
- } else {
- M.x86.R_AX = sbb_word(M.x86.R_AX, (u16)srcval);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x1e
-****************************************************************************/
-static void x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("PUSH\tDS\n");
- TRACE_AND_STEP();
- push_word(M.x86.R_DS);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x1f
-****************************************************************************/
-static void x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("POP\tDS\n");
- TRACE_AND_STEP();
- M.x86.R_DS = pop_word();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x20
-****************************************************************************/
-static void x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint destoffset;
- u8 destval;
-
- START_OF_INSTR();
- DECODE_PRINTF("AND\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
-
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
-
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
-
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
-
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x21
-****************************************************************************/
-static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("AND\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = and_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x22
-****************************************************************************/
-static void x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint srcoffset;
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("AND\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_byte(*destreg, srcval);
- break;
- case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_byte(*destreg, srcval);
- break;
- case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_byte(*destreg, srcval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x23
-****************************************************************************/
-static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("AND\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_word(*destreg, srcval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_long(*destreg, srcval);
- break;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_word(*destreg, srcval);
- break;
- }
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_word(*destreg, srcval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = and_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x24
-****************************************************************************/
-static void x86emuOp_and_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("AND\tAL,");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- M.x86.R_AL = and_byte(M.x86.R_AL, srcval);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x25
-****************************************************************************/
-static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("AND\tEAX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("AND\tAX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = and_long(M.x86.R_EAX, srcval);
- } else {
- M.x86.R_AX = and_word(M.x86.R_AX, (u16)srcval);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x26
-****************************************************************************/
-static void x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("ES:\n");
- TRACE_AND_STEP();
- M.x86.mode |= SYSMODE_SEGOVR_ES;
- /*
- * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4
- * opcode subroutines we do not want to do this.
- */
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x27
-****************************************************************************/
-static void x86emuOp_daa(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("DAA\n");
- TRACE_AND_STEP();
- M.x86.R_AL = daa_byte(M.x86.R_AL);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x28
-****************************************************************************/
-static void x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint destoffset;
- u8 destval;
-
- START_OF_INSTR();
- DECODE_PRINTF("SUB\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x29
-****************************************************************************/
-static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("SUB\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = sub_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x2a
-****************************************************************************/
-static void x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint srcoffset;
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("SUB\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_byte(*destreg, srcval);
- break;
- case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_byte(*destreg, srcval);
- break;
- case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_byte(*destreg, srcval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x2b
-****************************************************************************/
-static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("SUB\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_word(*destreg, srcval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_word(*destreg, srcval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_word(*destreg, srcval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = sub_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x2c
-****************************************************************************/
-static void x86emuOp_sub_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("SUB\tAL,");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- M.x86.R_AL = sub_byte(M.x86.R_AL, srcval);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x2d
-****************************************************************************/
-static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("SUB\tEAX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("SUB\tAX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = sub_long(M.x86.R_EAX, srcval);
- } else {
- M.x86.R_AX = sub_word(M.x86.R_AX, (u16)srcval);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x2e
-****************************************************************************/
-static void x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("CS:\n");
- TRACE_AND_STEP();
- M.x86.mode |= SYSMODE_SEGOVR_CS;
- /* note no DECODE_CLEAR_SEGOVR here. */
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x2f
-****************************************************************************/
-static void x86emuOp_das(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("DAS\n");
- TRACE_AND_STEP();
- M.x86.R_AL = das_byte(M.x86.R_AL);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x30
-****************************************************************************/
-static void x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint destoffset;
- u8 destval;
-
- START_OF_INSTR();
- DECODE_PRINTF("XOR\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_byte(destval, *srcreg);
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x31
-****************************************************************************/
-static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("XOR\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_long(destval, *srcreg);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = xor_word(destval, *srcreg);
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x32
-****************************************************************************/
-static void x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint srcoffset;
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("XOR\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_byte(*destreg, srcval);
- break;
- case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_byte(*destreg, srcval);
- break;
- case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_byte(*destreg, srcval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x33
-****************************************************************************/
-static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("XOR\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_word(*destreg, srcval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_word(*destreg, srcval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_word(*destreg, srcval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = xor_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x34
-****************************************************************************/
-static void x86emuOp_xor_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("XOR\tAL,");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- M.x86.R_AL = xor_byte(M.x86.R_AL, srcval);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x35
-****************************************************************************/
-static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XOR\tEAX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("XOR\tAX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = xor_long(M.x86.R_EAX, srcval);
- } else {
- M.x86.R_AX = xor_word(M.x86.R_AX, (u16)srcval);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x36
-****************************************************************************/
-static void x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("SS:\n");
- TRACE_AND_STEP();
- M.x86.mode |= SYSMODE_SEGOVR_SS;
- /* no DECODE_CLEAR_SEGOVR ! */
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x37
-****************************************************************************/
-static void x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("AAA\n");
- TRACE_AND_STEP();
- M.x86.R_AX = aaa_word(M.x86.R_AX);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x38
-****************************************************************************/
-static void x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
- u8 *destreg, *srcreg;
- u8 destval;
-
- START_OF_INSTR();
- DECODE_PRINTF("CMP\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(destval, *srcreg);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(destval, *srcreg);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(destval, *srcreg);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x39
-****************************************************************************/
-static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("CMP\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(destval, *srcreg);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(destval, *srcreg);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(destval, *srcreg);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x3a
-****************************************************************************/
-static void x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint srcoffset;
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("CMP\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(*destreg, srcval);
- break;
- case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(*destreg, srcval);
- break;
- case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(*destreg, srcval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x3b
-****************************************************************************/
-static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("CMP\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(*destreg, srcval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(*destreg, srcval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(*destreg, srcval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- cmp_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x3c
-****************************************************************************/
-static void x86emuOp_cmp_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("CMP\tAL,");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- cmp_byte(M.x86.R_AL, srcval);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x3d
-****************************************************************************/
-static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("CMP\tEAX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("CMP\tAX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- cmp_long(M.x86.R_EAX, srcval);
- } else {
- cmp_word(M.x86.R_AX, (u16)srcval);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x3e
-****************************************************************************/
-static void x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("DS:\n");
- TRACE_AND_STEP();
- M.x86.mode |= SYSMODE_SEGOVR_DS;
- /* NO DECODE_CLEAR_SEGOVR! */
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x3f
-****************************************************************************/
-static void x86emuOp_aas(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("AAS\n");
- TRACE_AND_STEP();
- M.x86.R_AX = aas_word(M.x86.R_AX);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x40
-****************************************************************************/
-static void x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tEAX\n");
- } else {
- DECODE_PRINTF("INC\tAX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = inc_long(M.x86.R_EAX);
- } else {
- M.x86.R_AX = inc_word(M.x86.R_AX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x41
-****************************************************************************/
-static void x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tECX\n");
- } else {
- DECODE_PRINTF("INC\tCX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ECX = inc_long(M.x86.R_ECX);
- } else {
- M.x86.R_CX = inc_word(M.x86.R_CX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x42
-****************************************************************************/
-static void x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tEDX\n");
- } else {
- DECODE_PRINTF("INC\tDX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDX = inc_long(M.x86.R_EDX);
- } else {
- M.x86.R_DX = inc_word(M.x86.R_DX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x43
-****************************************************************************/
-static void x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tEBX\n");
- } else {
- DECODE_PRINTF("INC\tBX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBX = inc_long(M.x86.R_EBX);
- } else {
- M.x86.R_BX = inc_word(M.x86.R_BX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x44
-****************************************************************************/
-static void x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tESP\n");
- } else {
- DECODE_PRINTF("INC\tSP\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESP = inc_long(M.x86.R_ESP);
- } else {
- M.x86.R_SP = inc_word(M.x86.R_SP);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x45
-****************************************************************************/
-static void x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tEBP\n");
- } else {
- DECODE_PRINTF("INC\tBP\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBP = inc_long(M.x86.R_EBP);
- } else {
- M.x86.R_BP = inc_word(M.x86.R_BP);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x46
-****************************************************************************/
-static void x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tESI\n");
- } else {
- DECODE_PRINTF("INC\tSI\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESI = inc_long(M.x86.R_ESI);
- } else {
- M.x86.R_SI = inc_word(M.x86.R_SI);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x47
-****************************************************************************/
-static void x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tEDI\n");
- } else {
- DECODE_PRINTF("INC\tDI\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDI = inc_long(M.x86.R_EDI);
- } else {
- M.x86.R_DI = inc_word(M.x86.R_DI);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x48
-****************************************************************************/
-static void x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tEAX\n");
- } else {
- DECODE_PRINTF("DEC\tAX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = dec_long(M.x86.R_EAX);
- } else {
- M.x86.R_AX = dec_word(M.x86.R_AX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x49
-****************************************************************************/
-static void x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tECX\n");
- } else {
- DECODE_PRINTF("DEC\tCX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ECX = dec_long(M.x86.R_ECX);
- } else {
- M.x86.R_CX = dec_word(M.x86.R_CX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x4a
-****************************************************************************/
-static void x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tEDX\n");
- } else {
- DECODE_PRINTF("DEC\tDX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDX = dec_long(M.x86.R_EDX);
- } else {
- M.x86.R_DX = dec_word(M.x86.R_DX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x4b
-****************************************************************************/
-static void x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tEBX\n");
- } else {
- DECODE_PRINTF("DEC\tBX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBX = dec_long(M.x86.R_EBX);
- } else {
- M.x86.R_BX = dec_word(M.x86.R_BX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x4c
-****************************************************************************/
-static void x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tESP\n");
- } else {
- DECODE_PRINTF("DEC\tSP\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESP = dec_long(M.x86.R_ESP);
- } else {
- M.x86.R_SP = dec_word(M.x86.R_SP);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x4d
-****************************************************************************/
-static void x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tEBP\n");
- } else {
- DECODE_PRINTF("DEC\tBP\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBP = dec_long(M.x86.R_EBP);
- } else {
- M.x86.R_BP = dec_word(M.x86.R_BP);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x4e
-****************************************************************************/
-static void x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tESI\n");
- } else {
- DECODE_PRINTF("DEC\tSI\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESI = dec_long(M.x86.R_ESI);
- } else {
- M.x86.R_SI = dec_word(M.x86.R_SI);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x4f
-****************************************************************************/
-static void x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tEDI\n");
- } else {
- DECODE_PRINTF("DEC\tDI\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDI = dec_long(M.x86.R_EDI);
- } else {
- M.x86.R_DI = dec_word(M.x86.R_DI);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x50
-****************************************************************************/
-static void x86emuOp_push_AX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tEAX\n");
- } else {
- DECODE_PRINTF("PUSH\tAX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EAX);
- } else {
- push_word(M.x86.R_AX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x51
-****************************************************************************/
-static void x86emuOp_push_CX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tECX\n");
- } else {
- DECODE_PRINTF("PUSH\tCX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_ECX);
- } else {
- push_word(M.x86.R_CX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x52
-****************************************************************************/
-static void x86emuOp_push_DX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tEDX\n");
- } else {
- DECODE_PRINTF("PUSH\tDX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EDX);
- } else {
- push_word(M.x86.R_DX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x53
-****************************************************************************/
-static void x86emuOp_push_BX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tEBX\n");
- } else {
- DECODE_PRINTF("PUSH\tBX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EBX);
- } else {
- push_word(M.x86.R_BX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x54
-****************************************************************************/
-static void x86emuOp_push_SP(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tESP\n");
- } else {
- DECODE_PRINTF("PUSH\tSP\n");
- }
- TRACE_AND_STEP();
- /* Always push (E)SP, since we are emulating an i386 and above
- * processor. This is necessary as some BIOS'es use this to check
- * what type of processor is in the system.
- */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_ESP);
- } else {
- push_word((u16)(M.x86.R_SP));
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x55
-****************************************************************************/
-static void x86emuOp_push_BP(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tEBP\n");
- } else {
- DECODE_PRINTF("PUSH\tBP\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EBP);
- } else {
- push_word(M.x86.R_BP);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x56
-****************************************************************************/
-static void x86emuOp_push_SI(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tESI\n");
- } else {
- DECODE_PRINTF("PUSH\tSI\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_ESI);
- } else {
- push_word(M.x86.R_SI);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x57
-****************************************************************************/
-static void x86emuOp_push_DI(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSH\tEDI\n");
- } else {
- DECODE_PRINTF("PUSH\tDI\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EDI);
- } else {
- push_word(M.x86.R_DI);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x58
-****************************************************************************/
-static void x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tEAX\n");
- } else {
- DECODE_PRINTF("POP\tAX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = pop_long();
- } else {
- M.x86.R_AX = pop_word();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x59
-****************************************************************************/
-static void x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tECX\n");
- } else {
- DECODE_PRINTF("POP\tCX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ECX = pop_long();
- } else {
- M.x86.R_CX = pop_word();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x5a
-****************************************************************************/
-static void x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tEDX\n");
- } else {
- DECODE_PRINTF("POP\tDX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDX = pop_long();
- } else {
- M.x86.R_DX = pop_word();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x5b
-****************************************************************************/
-static void x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tEBX\n");
- } else {
- DECODE_PRINTF("POP\tBX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBX = pop_long();
- } else {
- M.x86.R_BX = pop_word();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x5c
-****************************************************************************/
-static void x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tESP\n");
- } else {
- DECODE_PRINTF("POP\tSP\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESP = pop_long();
- } else {
- M.x86.R_SP = pop_word();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x5d
-****************************************************************************/
-static void x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tEBP\n");
- } else {
- DECODE_PRINTF("POP\tBP\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBP = pop_long();
- } else {
- M.x86.R_BP = pop_word();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x5e
-****************************************************************************/
-static void x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tESI\n");
- } else {
- DECODE_PRINTF("POP\tSI\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESI = pop_long();
- } else {
- M.x86.R_SI = pop_word();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x5f
-****************************************************************************/
-static void x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POP\tEDI\n");
- } else {
- DECODE_PRINTF("POP\tDI\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDI = pop_long();
- } else {
- M.x86.R_DI = pop_word();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x60
-****************************************************************************/
-static void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSHAD\n");
- } else {
- DECODE_PRINTF("PUSHA\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 old_sp = M.x86.R_ESP;
-
- push_long(M.x86.R_EAX);
- push_long(M.x86.R_ECX);
- push_long(M.x86.R_EDX);
- push_long(M.x86.R_EBX);
- push_long(old_sp);
- push_long(M.x86.R_EBP);
- push_long(M.x86.R_ESI);
- push_long(M.x86.R_EDI);
- } else {
- u16 old_sp = M.x86.R_SP;
-
- push_word(M.x86.R_AX);
- push_word(M.x86.R_CX);
- push_word(M.x86.R_DX);
- push_word(M.x86.R_BX);
- push_word(old_sp);
- push_word(M.x86.R_BP);
- push_word(M.x86.R_SI);
- push_word(M.x86.R_DI);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x61
-****************************************************************************/
-static void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POPAD\n");
- } else {
- DECODE_PRINTF("POPA\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDI = pop_long();
- M.x86.R_ESI = pop_long();
- M.x86.R_EBP = pop_long();
- M.x86.R_ESP += 4; /* skip ESP */
- M.x86.R_EBX = pop_long();
- M.x86.R_EDX = pop_long();
- M.x86.R_ECX = pop_long();
- M.x86.R_EAX = pop_long();
- } else {
- M.x86.R_DI = pop_word();
- M.x86.R_SI = pop_word();
- M.x86.R_BP = pop_word();
- M.x86.R_SP += 2; /* skip SP */
- M.x86.R_BX = pop_word();
- M.x86.R_DX = pop_word();
- M.x86.R_CX = pop_word();
- M.x86.R_AX = pop_word();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/*opcode 0x62 ILLEGAL OP, calls x86emuOp_illegal_op() */
-/*opcode 0x63 ILLEGAL OP, calls x86emuOp_illegal_op() */
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x64
-****************************************************************************/
-static void x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("FS:\n");
- TRACE_AND_STEP();
- M.x86.mode |= SYSMODE_SEGOVR_FS;
- /*
- * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4
- * opcode subroutines we do not want to do this.
- */
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x65
-****************************************************************************/
-static void x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("GS:\n");
- TRACE_AND_STEP();
- M.x86.mode |= SYSMODE_SEGOVR_GS;
- /*
- * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4
- * opcode subroutines we do not want to do this.
- */
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x66 - prefix for 32-bit register
-****************************************************************************/
-static void x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("DATA:\n");
- TRACE_AND_STEP();
- M.x86.mode |= SYSMODE_PREFIX_DATA;
- /* note no DECODE_CLEAR_SEGOVR here. */
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x67 - prefix for 32-bit address
-****************************************************************************/
-static void x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("ADDR:\n");
- TRACE_AND_STEP();
- M.x86.mode |= SYSMODE_PREFIX_ADDR;
- /* note no DECODE_CLEAR_SEGOVR here. */
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x68
-****************************************************************************/
-static void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 imm;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- imm = fetch_long_imm();
- } else {
- imm = fetch_word_imm();
- }
- DECODE_PRINTF2("PUSH\t%x\n", imm);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(imm);
- } else {
- push_word((u16)imm);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x69
-****************************************************************************/
-static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("IMUL\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
- s32 imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
- s16 imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
- s32 imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
- s16 imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
- s32 imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
- s16 imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
- u32 res_lo,res_hi;
- s32 imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg,*srcreg;
- u32 res;
- s16 imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- res = (s16)*srcreg * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x6a
-****************************************************************************/
-static void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
-{
- s16 imm;
-
- START_OF_INSTR();
- imm = (s8)fetch_byte_imm();
- DECODE_PRINTF2("PUSH\t%d\n", imm);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long((s32)imm);
- } else {
- push_word(imm);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x6b
-****************************************************************************/
-static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
- s8 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("IMUL\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg;
- u16 srcval;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- res = (s16)srcval * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
- u32 res_lo,res_hi;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
- if (res_hi != 0) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg,*srcreg;
- u32 res;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%d\n", (s32)imm);
- res = (s16)*srcreg * (s16)imm;
- if (res > 0xFFFF) {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- }
- *destreg = (u16)res;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x6c
-****************************************************************************/
-static void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("INSB\n");
- ins(1);
- TRACE_AND_STEP();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x6d
-****************************************************************************/
-static void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INSD\n");
- ins(4);
- } else {
- DECODE_PRINTF("INSW\n");
- ins(2);
- }
- TRACE_AND_STEP();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x6e
-****************************************************************************/
-static void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("OUTSB\n");
- outs(1);
- TRACE_AND_STEP();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x6f
-****************************************************************************/
-static void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("OUTSD\n");
- outs(4);
- } else {
- DECODE_PRINTF("OUTSW\n");
- outs(2);
- }
- TRACE_AND_STEP();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x70
-****************************************************************************/
-static void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if overflow flag is set */
- START_OF_INSTR();
- DECODE_PRINTF("JO\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (ACCESS_FLAG(F_OF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x71
-****************************************************************************/
-static void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if overflow is not set */
- START_OF_INSTR();
- DECODE_PRINTF("JNO\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (!ACCESS_FLAG(F_OF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x72
-****************************************************************************/
-static void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if carry flag is set. */
- START_OF_INSTR();
- DECODE_PRINTF("JB\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (ACCESS_FLAG(F_CF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x73
-****************************************************************************/
-static void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if carry flag is clear. */
- START_OF_INSTR();
- DECODE_PRINTF("JNB\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (!ACCESS_FLAG(F_CF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x74
-****************************************************************************/
-static void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if zero flag is set. */
- START_OF_INSTR();
- DECODE_PRINTF("JZ\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (ACCESS_FLAG(F_ZF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x75
-****************************************************************************/
-static void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if zero flag is clear. */
- START_OF_INSTR();
- DECODE_PRINTF("JNZ\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (!ACCESS_FLAG(F_ZF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x76
-****************************************************************************/
-static void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if carry flag is set or if the zero
- flag is set. */
- START_OF_INSTR();
- DECODE_PRINTF("JBE\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x77
-****************************************************************************/
-static void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if carry flag is clear and if the zero
- flag is clear */
- START_OF_INSTR();
- DECODE_PRINTF("JNBE\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (!(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x78
-****************************************************************************/
-static void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if sign flag is set */
- START_OF_INSTR();
- DECODE_PRINTF("JS\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (ACCESS_FLAG(F_SF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x79
-****************************************************************************/
-static void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if sign flag is clear */
- START_OF_INSTR();
- DECODE_PRINTF("JNS\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (!ACCESS_FLAG(F_SF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x7a
-****************************************************************************/
-static void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if parity flag is set (even parity) */
- START_OF_INSTR();
- DECODE_PRINTF("JP\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (ACCESS_FLAG(F_PF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x7b
-****************************************************************************/
-static void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
-
- /* jump to byte offset if parity flag is clear (odd parity) */
- START_OF_INSTR();
- DECODE_PRINTF("JNP\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (!ACCESS_FLAG(F_PF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x7c
-****************************************************************************/
-static void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
- int sf, of;
-
- /* jump to byte offset if sign flag not equal to overflow flag. */
- START_OF_INSTR();
- DECODE_PRINTF("JL\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- sf = ACCESS_FLAG(F_SF) != 0;
- of = ACCESS_FLAG(F_OF) != 0;
- if (sf ^ of)
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x7d
-****************************************************************************/
-static void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
- int sf, of;
-
- /* jump to byte offset if sign flag not equal to overflow flag. */
- START_OF_INSTR();
- DECODE_PRINTF("JNL\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- sf = ACCESS_FLAG(F_SF) != 0;
- of = ACCESS_FLAG(F_OF) != 0;
- /* note: inverse of above, but using == instead of xor. */
- if (sf == of)
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x7e
-****************************************************************************/
-static void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
- int sf, of;
-
- /* jump to byte offset if sign flag not equal to overflow flag
- or the zero flag is set */
- START_OF_INSTR();
- DECODE_PRINTF("JLE\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- sf = ACCESS_FLAG(F_SF) != 0;
- of = ACCESS_FLAG(F_OF) != 0;
- if ((sf ^ of) || ACCESS_FLAG(F_ZF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x7f
-****************************************************************************/
-static void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
-{
- s8 offset;
- u16 target;
- int sf, of;
-
- /* jump to byte offset if sign flag equal to overflow flag.
- and the zero flag is clear */
- START_OF_INSTR();
- DECODE_PRINTF("JNLE\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + (s16)offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- sf = ACCESS_FLAG(F_SF) != 0;
- of = ACCESS_FLAG(F_OF) != 0;
- if ((sf == of) && !ACCESS_FLAG(F_ZF))
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-static u8 (*opc80_byte_operation[])(u8 d, u8 s) =
-{
- add_byte, /* 00 */
- or_byte, /* 01 */
- adc_byte, /* 02 */
- sbb_byte, /* 03 */
- and_byte, /* 04 */
- sub_byte, /* 05 */
- xor_byte, /* 06 */
- cmp_byte, /* 07 */
-};
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x80
-****************************************************************************/
-static void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg;
- uint destoffset;
- u8 imm;
- u8 destval;
-
- /*
- * Weirdo special case instruction format. Part of the opcode
- * held below in "RH". Doubly nested case would result, except
- * that the decoded instruction
- */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- DECODE_PRINTF("ADD\t");
- break;
- case 1:
- DECODE_PRINTF("OR\t");
- break;
- case 2:
- DECODE_PRINTF("ADC\t");
- break;
- case 3:
- DECODE_PRINTF("SBB\t");
- break;
- case 4:
- DECODE_PRINTF("AND\t");
- break;
- case 5:
- DECODE_PRINTF("SUB\t");
- break;
- case 6:
- DECODE_PRINTF("XOR\t");
- break;
- case 7:
- DECODE_PRINTF("CMP\t");
- break;
- }
- }
-#endif
- /* know operation, decode the mod byte to find the addressing
- mode. */
- switch (mod) {
- case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc80_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
- case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc80_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
- case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc80_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc80_byte_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-static u16 (*opc81_word_operation[])(u16 d, u16 s) =
-{
- add_word, /*00 */
- or_word, /*01 */
- adc_word, /*02 */
- sbb_word, /*03 */
- and_word, /*04 */
- sub_word, /*05 */
- xor_word, /*06 */
- cmp_word, /*07 */
-};
-
-static u32 (*opc81_long_operation[])(u32 d, u32 s) =
-{
- add_long, /*00 */
- or_long, /*01 */
- adc_long, /*02 */
- sbb_long, /*03 */
- and_long, /*04 */
- sub_long, /*05 */
- xor_long, /*06 */
- cmp_long, /*07 */
-};
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x81
-****************************************************************************/
-static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- /*
- * Weirdo special case instruction format. Part of the opcode
- * held below in "RH". Doubly nested case would result, except
- * that the decoded instruction
- */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- DECODE_PRINTF("ADD\t");
- break;
- case 1:
- DECODE_PRINTF("OR\t");
- break;
- case 2:
- DECODE_PRINTF("ADC\t");
- break;
- case 3:
- DECODE_PRINTF("SBB\t");
- break;
- case 4:
- DECODE_PRINTF("AND\t");
- break;
- case 5:
- DECODE_PRINTF("SUB\t");
- break;
- case 6:
- DECODE_PRINTF("XOR\t");
- break;
- case 7:
- DECODE_PRINTF("CMP\t");
- break;
- }
- }
-#endif
- /*
- * Know operation, decode the mod byte to find the addressing
- * mode.
- */
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- imm = fetch_long_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- imm = fetch_word_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 destval,imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- imm = fetch_long_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_long_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- } else {
- u16 *destreg;
- u16 destval,imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- imm = fetch_word_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc81_word_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-static u8 (*opc82_byte_operation[])(u8 s, u8 d) =
-{
- add_byte, /*00 */
- or_byte, /*01 *//*YYY UNUSED ???? */
- adc_byte, /*02 */
- sbb_byte, /*03 */
- and_byte, /*04 *//*YYY UNUSED ???? */
- sub_byte, /*05 */
- xor_byte, /*06 *//*YYY UNUSED ???? */
- cmp_byte, /*07 */
-};
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x82
-****************************************************************************/
-static void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg;
- uint destoffset;
- u8 imm;
- u8 destval;
-
- /*
- * Weirdo special case instruction format. Part of the opcode
- * held below in "RH". Doubly nested case would result, except
- * that the decoded instruction Similar to opcode 81, except that
- * the immediate byte is sign extended to a word length.
- */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ADD\t");
- break;
- case 1:
- DECODE_PRINTF("OR\t");
- break;
- case 2:
- DECODE_PRINTF("ADC\t");
- break;
- case 3:
- DECODE_PRINTF("SBB\t");
- break;
- case 4:
- DECODE_PRINTF("AND\t");
- break;
- case 5:
- DECODE_PRINTF("SUB\t");
- break;
- case 6:
- DECODE_PRINTF("XOR\t");
- break;
- case 7:
- DECODE_PRINTF("CMP\t");
- break;
- }
- }
-#endif
- /* know operation, decode the mod byte to find the addressing
- mode. */
- switch (mod) {
- case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc82_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
- case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc82_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
- case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- destval = fetch_data_byte(destoffset);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc82_byte_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc82_byte_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-static u16 (*opc83_word_operation[])(u16 s, u16 d) =
-{
- add_word, /*00 */
- or_word, /*01 *//*YYY UNUSED ???? */
- adc_word, /*02 */
- sbb_word, /*03 */
- and_word, /*04 *//*YYY UNUSED ???? */
- sub_word, /*05 */
- xor_word, /*06 *//*YYY UNUSED ???? */
- cmp_word, /*07 */
-};
-
-static u32 (*opc83_long_operation[])(u32 s, u32 d) =
-{
- add_long, /*00 */
- or_long, /*01 *//*YYY UNUSED ???? */
- adc_long, /*02 */
- sbb_long, /*03 */
- and_long, /*04 *//*YYY UNUSED ???? */
- sub_long, /*05 */
- xor_long, /*06 *//*YYY UNUSED ???? */
- cmp_long, /*07 */
-};
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x83
-****************************************************************************/
-static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- /*
- * Weirdo special case instruction format. Part of the opcode
- * held below in "RH". Doubly nested case would result, except
- * that the decoded instruction Similar to opcode 81, except that
- * the immediate byte is sign extended to a word length.
- */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ADD\t");
- break;
- case 1:
- DECODE_PRINTF("OR\t");
- break;
- case 2:
- DECODE_PRINTF("ADC\t");
- break;
- case 3:
- DECODE_PRINTF("SBB\t");
- break;
- case 4:
- DECODE_PRINTF("AND\t");
- break;
- case 5:
- DECODE_PRINTF("SUB\t");
- break;
- case 6:
- DECODE_PRINTF("XOR\t");
- break;
- case 7:
- DECODE_PRINTF("CMP\t");
- break;
- }
- }
-#endif
- /* know operation, decode the mod byte to find the addressing
- mode. */
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- destval = fetch_data_long(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- destval = fetch_data_word(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- destval = fetch_data_long(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- destval = fetch_data_word(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- destval = fetch_data_long(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_long_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_long(destoffset, destval);
- } else {
- u16 destval,imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm10_address(rl);
- destval = fetch_data_word(destoffset);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_word_operation[rh]) (destval, imm);
- if (rh != 7)
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 destval,imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_long_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- } else {
- u16 *destreg;
- u16 destval,imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- imm = (s8) fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- destval = (*opc83_word_operation[rh]) (*destreg, imm);
- if (rh != 7)
- *destreg = destval;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x84
-****************************************************************************/
-static void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint destoffset;
- u8 destval;
-
- START_OF_INSTR();
- DECODE_PRINTF("TEST\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_byte(destval, *srcreg);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_byte(destval, *srcreg);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_byte(destval, *srcreg);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_byte(*destreg, *srcreg);
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x85
-****************************************************************************/
-static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("TEST\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_word(destval, *srcreg);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_word(destval, *srcreg);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_long(destval, *srcreg);
- } else {
- u16 destval;
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_word(destval, *srcreg);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_long(*destreg, *srcreg);
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- test_word(*destreg, *srcreg);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x86
-****************************************************************************/
-static void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint destoffset;
- u8 destval;
- u8 tmp;
-
- START_OF_INSTR();
- DECODE_PRINTF("XCHG\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_byte(destoffset, destval);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_byte(destoffset);
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = *destreg;
- *destreg = tmp;
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x87
-****************************************************************************/
-static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("XCHG\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
- u32 destval,tmp;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_long(destoffset, destval);
- } else {
- u16 *srcreg;
- u16 destval,tmp;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
- u32 destval,tmp;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_long(destoffset, destval);
- } else {
- u16 *srcreg;
- u16 destval,tmp;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
- u32 destval,tmp;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_long(destoffset);
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_long(destoffset, destval);
- } else {
- u16 *srcreg;
- u16 destval,tmp;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- destval = fetch_data_word(destoffset);
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = destval;
- destval = tmp;
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
- u32 tmp;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = *destreg;
- *destreg = tmp;
- } else {
- u16 *destreg,*srcreg;
- u16 tmp;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- tmp = *srcreg;
- *srcreg = *destreg;
- *destreg = tmp;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x88
-****************************************************************************/
-static void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_byte(destoffset, *srcreg);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_byte(destoffset, *srcreg);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_byte(destoffset, *srcreg);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x89
-****************************************************************************/
-static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u32 destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_long(destoffset, *srcreg);
- } else {
- u16 *srcreg;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_word(destoffset, *srcreg);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_long(destoffset, *srcreg);
- } else {
- u16 *srcreg;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_word(destoffset, *srcreg);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_long(destoffset, *srcreg);
- } else {
- u16 *srcreg;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- store_data_word(destoffset, *srcreg);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- } else {
- u16 *destreg,*srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x8a
-****************************************************************************/
-static void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg, *srcreg;
- uint srcoffset;
- u8 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
- case 1:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
- case 2:
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_byte(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x8b
-****************************************************************************/
-static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_long(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- } else {
- u16 *destreg;
- u16 srcval;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg, *srcreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- } else {
- u16 *destreg, *srcreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x8c
-****************************************************************************/
-static void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u16 *destreg, *srcreg;
- uint destoffset;
- u16 destval;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcreg = decode_rm_seg_register(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = *srcreg;
- store_data_word(destoffset, destval);
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcreg = decode_rm_seg_register(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = *srcreg;
- store_data_word(destoffset, destval);
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcreg = decode_rm_seg_register(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = *srcreg;
- store_data_word(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcreg = decode_rm_seg_register(rh);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x8d
-****************************************************************************/
-static void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("LEA\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
- u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *srcreg = (u32)destoffset;
- } else {
- u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *srcreg = (u16)destoffset;
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
- u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *srcreg = (u32)destoffset;
- } else {
- u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *srcreg = (u16)destoffset;
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
- u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
- DECODE_PRINTF(",");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *srcreg = (u32)destoffset;
- } else {
- u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *srcreg = (u16)destoffset;
- }
- break;
- case 3: /* register to register */
- /* undefined. Do nothing. */
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x8e
-****************************************************************************/
-static void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u16 *destreg, *srcreg;
- uint srcoffset;
- u16 srcval;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- destreg = decode_rm_seg_register(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
- case 1:
- destreg = decode_rm_seg_register(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
- case 2:
- destreg = decode_rm_seg_register(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- srcval = fetch_data_word(srcoffset);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = srcval;
- break;
- case 3: /* register to register */
- destreg = decode_rm_seg_register(rh);
- DECODE_PRINTF(",");
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = *srcreg;
- break;
- }
- /*
- * Clean up, and reset all the R_xSP pointers to the correct
- * locations. This is about 3x too much overhead (doing all the
- * segreg ptrs when only one is needed, but this instruction
- * *cannot* be that common, and this isn't too much work anyway.
- */
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x8f
-****************************************************************************/
-static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("POP\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- if (rh != 0) {
- DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n");
- HALT_SYS();
- }
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_long();
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_word();
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_long();
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_word();
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_long();
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- destval = pop_word();
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = pop_long();
- } else {
- u16 *destreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = pop_word();
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x90
-****************************************************************************/
-static void x86emuOp_nop(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("NOP\n");
- TRACE_AND_STEP();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x91
-****************************************************************************/
-static void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
-{
- u32 tmp;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,ECX\n");
- } else {
- DECODE_PRINTF("XCHG\tAX,CX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_ECX;
- M.x86.R_ECX = tmp;
- } else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_CX;
- M.x86.R_CX = (u16)tmp;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x92
-****************************************************************************/
-static void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
-{
- u32 tmp;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,EDX\n");
- } else {
- DECODE_PRINTF("XCHG\tAX,DX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_EDX;
- M.x86.R_EDX = tmp;
- } else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_DX;
- M.x86.R_DX = (u16)tmp;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x93
-****************************************************************************/
-static void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
-{
- u32 tmp;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,EBX\n");
- } else {
- DECODE_PRINTF("XCHG\tAX,BX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_EBX;
- M.x86.R_EBX = tmp;
- } else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_BX;
- M.x86.R_BX = (u16)tmp;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x94
-****************************************************************************/
-static void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
-{
- u32 tmp;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,ESP\n");
- } else {
- DECODE_PRINTF("XCHG\tAX,SP\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_ESP;
- M.x86.R_ESP = tmp;
- } else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_SP;
- M.x86.R_SP = (u16)tmp;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x95
-****************************************************************************/
-static void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
-{
- u32 tmp;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,EBP\n");
- } else {
- DECODE_PRINTF("XCHG\tAX,BP\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_EBP;
- M.x86.R_EBP = tmp;
- } else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_BP;
- M.x86.R_BP = (u16)tmp;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x96
-****************************************************************************/
-static void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
-{
- u32 tmp;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,ESI\n");
- } else {
- DECODE_PRINTF("XCHG\tAX,SI\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_ESI;
- M.x86.R_ESI = tmp;
- } else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_SI;
- M.x86.R_SI = (u16)tmp;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x97
-****************************************************************************/
-static void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
-{
- u32 tmp;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("XCHG\tEAX,EDI\n");
- } else {
- DECODE_PRINTF("XCHG\tAX,DI\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- tmp = M.x86.R_EAX;
- M.x86.R_EAX = M.x86.R_EDI;
- M.x86.R_EDI = tmp;
- } else {
- tmp = M.x86.R_AX;
- M.x86.R_AX = M.x86.R_DI;
- M.x86.R_DI = (u16)tmp;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x98
-****************************************************************************/
-static void x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("CWDE\n");
- } else {
- DECODE_PRINTF("CBW\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- if (M.x86.R_AX & 0x8000) {
- M.x86.R_EAX |= 0xffff0000;
- } else {
- M.x86.R_EAX &= 0x0000ffff;
- }
- } else {
- if (M.x86.R_AL & 0x80) {
- M.x86.R_AH = 0xff;
- } else {
- M.x86.R_AH = 0x0;
- }
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x99
-****************************************************************************/
-static void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("CDQ\n");
- } else {
- DECODE_PRINTF("CWD\n");
- }
- DECODE_PRINTF("CWD\n");
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- if (M.x86.R_EAX & 0x80000000) {
- M.x86.R_EDX = 0xffffffff;
- } else {
- M.x86.R_EDX = 0x0;
- }
- } else {
- if (M.x86.R_AX & 0x8000) {
- M.x86.R_DX = 0xffff;
- } else {
- M.x86.R_DX = 0x0;
- }
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x9a
-****************************************************************************/
-static void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 farseg, faroff;
-
- START_OF_INSTR();
- DECODE_PRINTF("CALL\t");
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- faroff = fetch_long_imm();
- farseg = fetch_word_imm();
- } else {
- faroff = fetch_word_imm();
- farseg = fetch_word_imm();
- }
- DECODE_PRINTF2("%04x:", farseg);
- DECODE_PRINTF2("%04x\n", faroff);
- CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, farseg, faroff, "FAR ");
-
- /* XXX
- *
- * Hooked interrupt vectors calling into our "BIOS" will cause
- * problems unless all intersegment stuff is checked for BIOS
- * access. Check needed here. For moment, let it alone.
- */
- TRACE_AND_STEP();
- push_word(M.x86.R_CS);
- M.x86.R_CS = farseg;
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EIP);
- } else {
- push_word(M.x86.R_IP);
- }
- M.x86.R_EIP = faroff & 0xffff;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x9b
-****************************************************************************/
-static void x86emuOp_wait(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("WAIT");
- TRACE_AND_STEP();
- /* NADA. */
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x9c
-****************************************************************************/
-static void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
-{
- u32 flags;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("PUSHFD\n");
- } else {
- DECODE_PRINTF("PUSHF\n");
- }
- TRACE_AND_STEP();
-
- /* clear out *all* bits not representing flags, and turn on real bits */
- flags = (M.x86.R_EFLG & F_MSK) | F_ALWAYS_ON;
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(flags);
- } else {
- push_word((u16)flags);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x9d
-****************************************************************************/
-static void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("POPFD\n");
- } else {
- DECODE_PRINTF("POPF\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EFLG = pop_long();
- } else {
- M.x86.R_FLG = pop_word();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x9e
-****************************************************************************/
-static void x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("SAHF\n");
- TRACE_AND_STEP();
- /* clear the lower bits of the flag register */
- M.x86.R_FLG &= 0xffffff00;
- /* or in the AH register into the flags register */
- M.x86.R_FLG |= M.x86.R_AH;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0x9f
-****************************************************************************/
-static void x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("LAHF\n");
- TRACE_AND_STEP();
- M.x86.R_AH = (u8)(M.x86.R_FLG & 0xff);
- /*undocumented TC++ behavior??? Nope. It's documented, but
- you have too look real hard to notice it. */
- M.x86.R_AH |= 0x2;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xa0
-****************************************************************************/
-static void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
-{
- u16 offset;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\tAL,");
- offset = fetch_word_imm();
- DECODE_PRINTF2("[%04x]\n", offset);
- TRACE_AND_STEP();
- M.x86.R_AL = fetch_data_byte(offset);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xa1
-****************************************************************************/
-static void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
-{
- u16 offset;
-
- START_OF_INSTR();
- offset = fetch_word_imm();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF2("MOV\tEAX,[%04x]\n", offset);
- } else {
- DECODE_PRINTF2("MOV\tAX,[%04x]\n", offset);
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = fetch_data_long(offset);
- } else {
- M.x86.R_AX = fetch_data_word(offset);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xa2
-****************************************************************************/
-static void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u16 offset;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\t");
- offset = fetch_word_imm();
- DECODE_PRINTF2("[%04x],AL\n", offset);
- TRACE_AND_STEP();
- store_data_byte(offset, M.x86.R_AL);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xa3
-****************************************************************************/
-static void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u16 offset;
-
- START_OF_INSTR();
- offset = fetch_word_imm();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF2("MOV\t[%04x],EAX\n", offset);
- } else {
- DECODE_PRINTF2("MOV\t[%04x],AX\n", offset);
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- store_data_long(offset, M.x86.R_EAX);
- } else {
- store_data_word(offset, M.x86.R_AX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xa4
-****************************************************************************/
-static void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
-{
- u8 val;
- u32 count;
- int inc;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOVS\tBYTE\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -1;
- else
- inc = 1;
- TRACE_AND_STEP();
- count = 1;
- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- count = M.x86.R_CX;
- M.x86.R_CX = 0;
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
- }
- while (count--) {
- val = fetch_data_byte(M.x86.R_SI);
- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, val);
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xa5
-****************************************************************************/
-static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
-{
- u32 val;
- int inc;
- u32 count;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOVS\tDWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -4;
- else
- inc = 4;
- } else {
- DECODE_PRINTF("MOVS\tWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -2;
- else
- inc = 2;
- }
- TRACE_AND_STEP();
- count = 1;
- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- count = M.x86.R_CX;
- M.x86.R_CX = 0;
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
- }
- while (count--) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val = fetch_data_long(M.x86.R_SI);
- store_data_long_abs(M.x86.R_ES, M.x86.R_DI, val);
- } else {
- val = fetch_data_word(M.x86.R_SI);
- store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16)val);
- }
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xa6
-****************************************************************************/
-static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
-{
- s8 val1, val2;
- int inc;
-
- START_OF_INSTR();
- DECODE_PRINTF("CMPS\tBYTE\n");
- TRACE_AND_STEP();
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -1;
- else
- inc = 1;
-
- if (M.x86.mode & SYSMODE_PREFIX_REPE) {
- /* REPE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- val1 = fetch_data_byte(M.x86.R_SI);
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(val1, val2);
- M.x86.R_CX -= 1;
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF) == 0)
- break;
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPE;
- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
- /* REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- val1 = fetch_data_byte(M.x86.R_SI);
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(val1, val2);
- M.x86.R_CX -= 1;
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF))
- break; /* zero flag set means equal */
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
- } else {
- val1 = fetch_data_byte(M.x86.R_SI);
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(val1, val2);
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xa7
-****************************************************************************/
-static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
-{
- u32 val1,val2;
- int inc;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("CMPS\tDWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -4;
- else
- inc = 4;
- } else {
- DECODE_PRINTF("CMPS\tWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -2;
- else
- inc = 2;
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_REPE) {
- /* REPE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val1 = fetch_data_long(M.x86.R_SI);
- val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(val1, val2);
- } else {
- val1 = fetch_data_word(M.x86.R_SI);
- val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word((u16)val1, (u16)val2);
- }
- M.x86.R_CX -= 1;
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF) == 0)
- break;
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPE;
- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
- /* REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val1 = fetch_data_long(M.x86.R_SI);
- val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(val1, val2);
- } else {
- val1 = fetch_data_word(M.x86.R_SI);
- val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word((u16)val1, (u16)val2);
- }
- M.x86.R_CX -= 1;
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF))
- break; /* zero flag set means equal */
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
- } else {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val1 = fetch_data_long(M.x86.R_SI);
- val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(val1, val2);
- } else {
- val1 = fetch_data_word(M.x86.R_SI);
- val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word((u16)val1, (u16)val2);
- }
- M.x86.R_SI += inc;
- M.x86.R_DI += inc;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xa8
-****************************************************************************/
-static void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- int imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("TEST\tAL,");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%04x\n", imm);
- TRACE_AND_STEP();
- test_byte(M.x86.R_AL, (u8)imm);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xa9
-****************************************************************************/
-static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("TEST\tEAX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("TEST\tAX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- test_long(M.x86.R_EAX, srcval);
- } else {
- test_word(M.x86.R_AX, (u16)srcval);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xaa
-****************************************************************************/
-static void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
-{
- int inc;
-
- START_OF_INSTR();
- DECODE_PRINTF("STOS\tBYTE\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -1;
- else
- inc = 1;
- TRACE_AND_STEP();
- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
- M.x86.R_CX -= 1;
- M.x86.R_DI += inc;
- }
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
- } else {
- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
- M.x86.R_DI += inc;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xab
-****************************************************************************/
-static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
-{
- int inc;
- u32 count;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("STOS\tDWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -4;
- else
- inc = 4;
- } else {
- DECODE_PRINTF("STOS\tWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -2;
- else
- inc = 2;
- }
- TRACE_AND_STEP();
- count = 1;
- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- count = M.x86.R_CX;
- M.x86.R_CX = 0;
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
- }
- while (count--) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- store_data_long_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_EAX);
- } else {
- store_data_word_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AX);
- }
- M.x86.R_DI += inc;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xac
-****************************************************************************/
-static void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
-{
- int inc;
-
- START_OF_INSTR();
- DECODE_PRINTF("LODS\tBYTE\n");
- TRACE_AND_STEP();
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -1;
- else
- inc = 1;
- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
- M.x86.R_CX -= 1;
- M.x86.R_SI += inc;
- }
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
- } else {
- M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
- M.x86.R_SI += inc;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xad
-****************************************************************************/
-static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
-{
- int inc;
- u32 count;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("LODS\tDWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -4;
- else
- inc = 4;
- } else {
- DECODE_PRINTF("LODS\tWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -2;
- else
- inc = 2;
- }
- TRACE_AND_STEP();
- count = 1;
- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
- /* dont care whether REPE or REPNE */
- /* move them until CX is ZERO. */
- count = M.x86.R_CX;
- M.x86.R_CX = 0;
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
- }
- while (count--) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = fetch_data_long(M.x86.R_SI);
- } else {
- M.x86.R_AX = fetch_data_word(M.x86.R_SI);
- }
- M.x86.R_SI += inc;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xae
-****************************************************************************/
-static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
-{
- s8 val2;
- int inc;
-
- START_OF_INSTR();
- DECODE_PRINTF("SCAS\tBYTE\n");
- TRACE_AND_STEP();
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -1;
- else
- inc = 1;
- if (M.x86.mode & SYSMODE_PREFIX_REPE) {
- /* REPE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(M.x86.R_AL, val2);
- M.x86.R_CX -= 1;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF) == 0)
- break;
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPE;
- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
- /* REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(M.x86.R_AL, val2);
- M.x86.R_CX -= 1;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF))
- break; /* zero flag set means equal */
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
- } else {
- val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_byte(M.x86.R_AL, val2);
- M.x86.R_DI += inc;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xaf
-****************************************************************************/
-static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
-{
- int inc;
- u32 val;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("SCAS\tDWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -4;
- else
- inc = 4;
- } else {
- DECODE_PRINTF("SCAS\tWORD\n");
- if (ACCESS_FLAG(F_DF)) /* down */
- inc = -2;
- else
- inc = 2;
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_REPE) {
- /* REPE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(M.x86.R_EAX, val);
- } else {
- val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word(M.x86.R_AX, (u16)val);
- }
- M.x86.R_CX -= 1;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF) == 0)
- break;
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPE;
- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
- /* REPNE */
- /* move them until CX is ZERO. */
- while (M.x86.R_CX != 0) {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(M.x86.R_EAX, val);
- } else {
- val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word(M.x86.R_AX, (u16)val);
- }
- M.x86.R_CX -= 1;
- M.x86.R_DI += inc;
- if (ACCESS_FLAG(F_ZF))
- break; /* zero flag set means equal */
- }
- M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
- } else {
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_long(M.x86.R_EAX, val);
- } else {
- val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
- cmp_word(M.x86.R_AX, (u16)val);
- }
- M.x86.R_DI += inc;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xb0
-****************************************************************************/
-static void x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\tAL,");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- M.x86.R_AL = imm;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xb1
-****************************************************************************/
-static void x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\tCL,");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- M.x86.R_CL = imm;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xb2
-****************************************************************************/
-static void x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\tDL,");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- M.x86.R_DL = imm;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xb3
-****************************************************************************/
-static void x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\tBL,");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- M.x86.R_BL = imm;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xb4
-****************************************************************************/
-static void x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\tAH,");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- M.x86.R_AH = imm;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xb5
-****************************************************************************/
-static void x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\tCH,");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- M.x86.R_CH = imm;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xb6
-****************************************************************************/
-static void x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\tDH,");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- M.x86.R_DH = imm;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xb7
-****************************************************************************/
-static void x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\tBH,");
- imm = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", imm);
- TRACE_AND_STEP();
- M.x86.R_BH = imm;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xb8
-****************************************************************************/
-static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tEAX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("MOV\tAX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = srcval;
- } else {
- M.x86.R_AX = (u16)srcval;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xb9
-****************************************************************************/
-static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tECX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("MOV\tCX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ECX = srcval;
- } else {
- M.x86.R_CX = (u16)srcval;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xba
-****************************************************************************/
-static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tEDX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("MOV\tDX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDX = srcval;
- } else {
- M.x86.R_DX = (u16)srcval;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xbb
-****************************************************************************/
-static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tEBX,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("MOV\tBX,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBX = srcval;
- } else {
- M.x86.R_BX = (u16)srcval;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xbc
-****************************************************************************/
-static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tESP,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("MOV\tSP,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESP = srcval;
- } else {
- M.x86.R_SP = (u16)srcval;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xbd
-****************************************************************************/
-static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tEBP,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("MOV\tBP,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EBP = srcval;
- } else {
- M.x86.R_BP = (u16)srcval;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xbe
-****************************************************************************/
-static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tESI,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("MOV\tSI,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ESI = srcval;
- } else {
- M.x86.R_SI = (u16)srcval;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xbf
-****************************************************************************/
-static void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 srcval;
-
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("MOV\tEDI,");
- srcval = fetch_long_imm();
- } else {
- DECODE_PRINTF("MOV\tDI,");
- srcval = fetch_word_imm();
- }
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EDI = srcval;
- } else {
- M.x86.R_DI = (u16)srcval;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/* used by opcodes c0, d0, and d2. */
-static u8(*opcD0_byte_operation[])(u8 d, u8 s) =
-{
- rol_byte,
- ror_byte,
- rcl_byte,
- rcr_byte,
- shl_byte,
- shr_byte,
- shl_byte, /* sal_byte === shl_byte by definition */
- sar_byte,
-};
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xc0
-****************************************************************************/
-static void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg;
- uint destoffset;
- u8 destval;
- u8 amt;
-
- /*
- * Yet another weirdo special case instruction format. Part of
- * the opcode held below in "RH". Doubly nested case would
- * result, except that the decoded instruction
- */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
- }
-#endif
- /* know operation, decode the mod byte to find the addressing
- mode. */
- switch (mod) {
- case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
- case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (*destreg, amt);
- *destreg = destval;
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/* used by opcodes c1, d1, and d3. */
-static u16(*opcD1_word_operation[])(u16 s, u8 d) =
-{
- rol_word,
- ror_word,
- rcl_word,
- rcr_word,
- shl_word,
- shr_word,
- shl_word, /* sal_byte === shl_byte by definition */
- sar_word,
-};
-
-/* used by opcodes c1, d1, and d3. */
-static u32 (*opcD1_long_operation[])(u32 s, u8 d) =
-{
- rol_long,
- ror_long,
- rcl_long,
- rcr_long,
- shl_long,
- shr_long,
- shl_long, /* sal_byte === shl_byte by definition */
- sar_long,
-};
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xc1
-****************************************************************************/
-static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
- u8 amt;
-
- /*
- * Yet another weirdo special case instruction format. Part of
- * the opcode held below in "RH". Doubly nested case would
- * result, except that the decoded instruction
- */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
- }
-#endif
- /* know operation, decode the mod byte to find the addressing
- mode. */
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm10_address(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- TRACE_AND_STEP();
- *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
- } else {
- u16 *destreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- amt = fetch_byte_imm();
- DECODE_PRINTF2(",%x\n", amt);
- TRACE_AND_STEP();
- *destreg = (*opcD1_word_operation[rh]) (*destreg, amt);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xc2
-****************************************************************************/
-static void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
-{
- u16 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("RET\t");
- imm = fetch_word_imm();
- DECODE_PRINTF2("%x\n", imm);
- RETURN_TRACE("RET",M.x86.saved_cs,M.x86.saved_ip);
- TRACE_AND_STEP();
- M.x86.R_IP = pop_word();
- M.x86.R_SP += imm;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xc3
-****************************************************************************/
-static void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("RET\n");
- RETURN_TRACE("RET",M.x86.saved_cs,M.x86.saved_ip);
- TRACE_AND_STEP();
- M.x86.R_IP = pop_word();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xc4
-****************************************************************************/
-static void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rh, rl;
- u16 *dstreg;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("LES\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_ES = fetch_data_word(srcoffset + 2);
- break;
- case 1:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_ES = fetch_data_word(srcoffset + 2);
- break;
- case 2:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_ES = fetch_data_word(srcoffset + 2);
- break;
- case 3: /* register to register */
- /* UNDEFINED! */
- TRACE_AND_STEP();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xc5
-****************************************************************************/
-static void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rh, rl;
- u16 *dstreg;
- uint srcoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("LDS\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_DS = fetch_data_word(srcoffset + 2);
- break;
- case 1:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_DS = fetch_data_word(srcoffset + 2);
- break;
- case 2:
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *dstreg = fetch_data_word(srcoffset);
- M.x86.R_DS = fetch_data_word(srcoffset + 2);
- break;
- case 3: /* register to register */
- /* UNDEFINED! */
- TRACE_AND_STEP();
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xc6
-****************************************************************************/
-static void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg;
- uint destoffset;
- u8 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- if (rh != 0) {
- DECODE_PRINTF("ILLEGAL DECODE OF OPCODE c6\n");
- HALT_SYS();
- }
- switch (mod) {
- case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%2x\n", imm);
- TRACE_AND_STEP();
- store_data_byte(destoffset, imm);
- break;
- case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%2x\n", imm);
- TRACE_AND_STEP();
- store_data_byte(destoffset, imm);
- break;
- case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%2x\n", imm);
- TRACE_AND_STEP();
- store_data_byte(destoffset, imm);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- imm = fetch_byte_imm();
- DECODE_PRINTF2(",%2x\n", imm);
- TRACE_AND_STEP();
- *destreg = imm;
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xc7
-****************************************************************************/
-static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- START_OF_INSTR();
- DECODE_PRINTF("MOV\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- if (rh != 0) {
- DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n");
- HALT_SYS();
- }
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_long(destoffset, imm);
- } else {
- u16 imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_word(destoffset, imm);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_long(destoffset, imm);
- } else {
- u16 imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_word(destoffset, imm);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 imm;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_long(destoffset, imm);
- } else {
- u16 imm;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm10_address(rl);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- store_data_word(destoffset, imm);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 imm;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- imm = fetch_long_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- *destreg = imm;
- } else {
- u16 *destreg;
- u16 imm;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- imm = fetch_word_imm();
- DECODE_PRINTF2(",%x\n", imm);
- TRACE_AND_STEP();
- *destreg = imm;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xc8
-****************************************************************************/
-static void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
-{
- u16 local,frame_pointer;
- u8 nesting;
- int i;
-
- START_OF_INSTR();
- local = fetch_word_imm();
- nesting = fetch_byte_imm();
- DECODE_PRINTF2("ENTER %x\n", local);
- DECODE_PRINTF2(",%x\n", nesting);
- TRACE_AND_STEP();
- push_word(M.x86.R_BP);
- frame_pointer = M.x86.R_SP;
- if (nesting > 0) {
- for (i = 1; i < nesting; i++) {
- M.x86.R_BP -= 2;
- push_word(fetch_data_word_abs(M.x86.R_SS, M.x86.R_BP));
- }
- push_word(frame_pointer);
- }
- M.x86.R_BP = frame_pointer;
- M.x86.R_SP = (u16)(M.x86.R_SP - local);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xc9
-****************************************************************************/
-static void x86emuOp_leave(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("LEAVE\n");
- TRACE_AND_STEP();
- M.x86.R_SP = M.x86.R_BP;
- M.x86.R_BP = pop_word();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xca
-****************************************************************************/
-static void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
-{
- u16 imm;
-
- START_OF_INSTR();
- DECODE_PRINTF("RETF\t");
- imm = fetch_word_imm();
- DECODE_PRINTF2("%x\n", imm);
- RETURN_TRACE("RETF",M.x86.saved_cs,M.x86.saved_ip);
- TRACE_AND_STEP();
- M.x86.R_IP = pop_word();
- M.x86.R_CS = pop_word();
- M.x86.R_SP += imm;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xcb
-****************************************************************************/
-static void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("RETF\n");
- RETURN_TRACE("RETF",M.x86.saved_cs,M.x86.saved_ip);
- TRACE_AND_STEP();
- M.x86.R_IP = pop_word();
- M.x86.R_CS = pop_word();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xcc
-****************************************************************************/
-static void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("INT 3\n");
- TRACE_AND_STEP();
- if (_X86EMU_intrTab[3]) {
- (*_X86EMU_intrTab[3])(3);
- } else {
- push_word((u16)M.x86.R_FLG);
- CLEAR_FLAG(F_IF);
- CLEAR_FLAG(F_TF);
- push_word(M.x86.R_CS);
- M.x86.R_CS = mem_access_word(3 * 4 + 2);
- push_word(M.x86.R_IP);
- M.x86.R_IP = mem_access_word(3 * 4);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xcd
-****************************************************************************/
-static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 intnum;
-
- START_OF_INSTR();
- DECODE_PRINTF("INT\t");
- intnum = fetch_byte_imm();
- DECODE_PRINTF2("%x\n", intnum);
- TRACE_AND_STEP();
- if (_X86EMU_intrTab[intnum]) {
- (*_X86EMU_intrTab[intnum])(intnum);
- } else {
- push_word((u16)M.x86.R_FLG);
- CLEAR_FLAG(F_IF);
- CLEAR_FLAG(F_TF);
- push_word(M.x86.R_CS);
- M.x86.R_CS = mem_access_word(intnum * 4 + 2);
- push_word(M.x86.R_IP);
- M.x86.R_IP = mem_access_word(intnum * 4);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xce
-****************************************************************************/
-static void x86emuOp_into(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("INTO\n");
- TRACE_AND_STEP();
- if (ACCESS_FLAG(F_OF)) {
- if (_X86EMU_intrTab[4]) {
- (*_X86EMU_intrTab[4])(4);
- } else {
- push_word((u16)M.x86.R_FLG);
- CLEAR_FLAG(F_IF);
- CLEAR_FLAG(F_TF);
- push_word(M.x86.R_CS);
- M.x86.R_CS = mem_access_word(4 * 4 + 2);
- push_word(M.x86.R_IP);
- M.x86.R_IP = mem_access_word(4 * 4);
- }
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xcf
-****************************************************************************/
-static void x86emuOp_iret(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("IRET\n");
-
- TRACE_AND_STEP();
-
- M.x86.R_IP = pop_word();
- M.x86.R_CS = pop_word();
- M.x86.R_FLG = pop_word();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xd0
-****************************************************************************/
-static void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg;
- uint destoffset;
- u8 destval;
-
- /*
- * Yet another weirdo special case instruction format. Part of
- * the opcode held below in "RH". Doubly nested case would
- * result, except that the decoded instruction
- */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
- }
-#endif
- /* know operation, decode the mod byte to find the addressing
- mode. */
- switch (mod) {
- case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, 1);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, 1);
- store_data_byte(destoffset, destval);
- break;
- case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, 1);
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",1\n");
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (*destreg, 1);
- *destreg = destval;
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xd1
-****************************************************************************/
-static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- /*
- * Yet another weirdo special case instruction format. Part of
- * the opcode held below in "RH". Doubly nested case would
- * result, except that the decoded instruction
- */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
- }
-#endif
- /* know operation, decode the mod byte to find the addressing
- mode. */
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, 1);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, 1);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, 1);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, 1);
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, 1);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",1\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, 1);
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
- u32 *destreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",1\n");
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (*destreg, 1);
- *destreg = destval;
- } else {
- u16 destval;
- u16 *destreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",1\n");
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (*destreg, 1);
- *destreg = destval;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xd2
-****************************************************************************/
-static void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg;
- uint destoffset;
- u8 destval;
- u8 amt;
-
- /*
- * Yet another weirdo special case instruction format. Part of
- * the opcode held below in "RH". Doubly nested case would
- * result, except that the decoded instruction
- */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
- }
-#endif
- /* know operation, decode the mod byte to find the addressing
- mode. */
- amt = M.x86.R_CL;
- switch (mod) {
- case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
- case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (destval, amt);
- store_data_byte(destoffset, destval);
- break;
- case 3: /* register to register */
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- destval = (*opcD0_byte_operation[rh]) (*destreg, amt);
- *destreg = destval;
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xd3
-****************************************************************************/
-static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
- u8 amt;
-
- /*
- * Yet another weirdo special case instruction format. Part of
- * the opcode held below in "RH". Doubly nested case would
- * result, except that the decoded instruction
- */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
- switch (rh) {
- case 0:
- DECODE_PRINTF("ROL\t");
- break;
- case 1:
- DECODE_PRINTF("ROR\t");
- break;
- case 2:
- DECODE_PRINTF("RCL\t");
- break;
- case 3:
- DECODE_PRINTF("RCR\t");
- break;
- case 4:
- DECODE_PRINTF("SHL\t");
- break;
- case 5:
- DECODE_PRINTF("SHR\t");
- break;
- case 6:
- DECODE_PRINTF("SAL\t");
- break;
- case 7:
- DECODE_PRINTF("SAR\t");
- break;
- }
- }
-#endif
- /* know operation, decode the mod byte to find the addressing
- mode. */
- amt = M.x86.R_CL;
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_long_operation[rh]) (destval, amt);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("WORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",CL\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = (*opcD1_word_operation[rh]) (destval, amt);
- store_data_word(destoffset, destval);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
- } else {
- u16 *destreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",CL\n");
- TRACE_AND_STEP();
- *destreg = (*opcD1_word_operation[rh]) (*destreg, amt);
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xd4
-****************************************************************************/
-static void x86emuOp_aam(u8 X86EMU_UNUSED(op1))
-{
- u8 a;
-
- START_OF_INSTR();
- DECODE_PRINTF("AAM\n");
- a = fetch_byte_imm(); /* this is a stupid encoding. */
- if (a != 10) {
- /* fix: add base decoding
- aam_word(u8 val, int base a) */
- DECODE_PRINTF("ERROR DECODING AAM\n");
- TRACE_REGS();
- HALT_SYS();
- }
- TRACE_AND_STEP();
- /* note the type change here --- returning AL and AH in AX. */
- M.x86.R_AX = aam_word(M.x86.R_AL);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xd5
-****************************************************************************/
-static void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
-{
- u8 a;
-
- START_OF_INSTR();
- DECODE_PRINTF("AAD\n");
- a = fetch_byte_imm();
- if (a != 10) {
- /* fix: add base decoding
- aad_word(u16 val, int base a) */
- DECODE_PRINTF("ERROR DECODING AAM\n");
- TRACE_REGS();
- HALT_SYS();
- }
- TRACE_AND_STEP();
- M.x86.R_AX = aad_word(M.x86.R_AX);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/* opcode 0xd6 ILLEGAL OPCODE */
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xd7
-****************************************************************************/
-static void x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
-{
- u16 addr;
-
- START_OF_INSTR();
- DECODE_PRINTF("XLAT\n");
- TRACE_AND_STEP();
- addr = (u16)(M.x86.R_BX + (u8)M.x86.R_AL);
- M.x86.R_AL = fetch_data_byte(addr);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/* instuctions D8 .. DF are in i87_ops.c */
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xe0
-****************************************************************************/
-static void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
-{
- s16 ip;
-
- START_OF_INSTR();
- DECODE_PRINTF("LOOPNE\t");
- ip = (s8) fetch_byte_imm();
- ip += (s16) M.x86.R_IP;
- DECODE_PRINTF2("%04x\n", ip);
- TRACE_AND_STEP();
- M.x86.R_CX -= 1;
- if (M.x86.R_CX != 0 && !ACCESS_FLAG(F_ZF)) /* CX != 0 and !ZF */
- M.x86.R_IP = ip;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xe1
-****************************************************************************/
-static void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
-{
- s16 ip;
-
- START_OF_INSTR();
- DECODE_PRINTF("LOOPE\t");
- ip = (s8) fetch_byte_imm();
- ip += (s16) M.x86.R_IP;
- DECODE_PRINTF2("%04x\n", ip);
- TRACE_AND_STEP();
- M.x86.R_CX -= 1;
- if (M.x86.R_CX != 0 && ACCESS_FLAG(F_ZF)) /* CX != 0 and ZF */
- M.x86.R_IP = ip;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xe2
-****************************************************************************/
-static void x86emuOp_loop(u8 X86EMU_UNUSED(op1))
-{
- s16 ip;
-
- START_OF_INSTR();
- DECODE_PRINTF("LOOP\t");
- ip = (s8) fetch_byte_imm();
- ip += (s16) M.x86.R_IP;
- DECODE_PRINTF2("%04x\n", ip);
- TRACE_AND_STEP();
- M.x86.R_CX -= 1;
- if (M.x86.R_CX != 0)
- M.x86.R_IP = ip;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xe3
-****************************************************************************/
-static void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
-{
- u16 target;
- s8 offset;
-
- /* jump to byte offset if overflow flag is set */
- START_OF_INSTR();
- DECODE_PRINTF("JCXZ\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- if (M.x86.R_CX == 0)
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xe4
-****************************************************************************/
-static void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 port;
-
- START_OF_INSTR();
- DECODE_PRINTF("IN\t");
- port = (u8) fetch_byte_imm();
- DECODE_PRINTF2("%x,AL\n", port);
- TRACE_AND_STEP();
- M.x86.R_AL = (*sys_inb)(port);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xe5
-****************************************************************************/
-static void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
-{
- u8 port;
-
- START_OF_INSTR();
- DECODE_PRINTF("IN\t");
- port = (u8) fetch_byte_imm();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF2("EAX,%x\n", port);
- } else {
- DECODE_PRINTF2("AX,%x\n", port);
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = (*sys_inl)(port);
- } else {
- M.x86.R_AX = (*sys_inw)(port);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xe6
-****************************************************************************/
-static void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
-{
- u8 port;
-
- START_OF_INSTR();
- DECODE_PRINTF("OUT\t");
- port = (u8) fetch_byte_imm();
- DECODE_PRINTF2("%x,AL\n", port);
- TRACE_AND_STEP();
- (*sys_outb)(port, M.x86.R_AL);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xe7
-****************************************************************************/
-static void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
-{
- u8 port;
-
- START_OF_INSTR();
- DECODE_PRINTF("OUT\t");
- port = (u8) fetch_byte_imm();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF2("%x,EAX\n", port);
- } else {
- DECODE_PRINTF2("%x,AX\n", port);
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- (*sys_outl)(port, M.x86.R_EAX);
- } else {
- (*sys_outw)(port, M.x86.R_AX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xe8
-****************************************************************************/
-static void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
-{
- s16 ip16;
- s32 ip32;
-
- START_OF_INSTR();
- DECODE_PRINTF("CALL\t");
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- ip32 = (s32) fetch_long_imm();
- ip32 += (s16) M.x86.R_IP; /* CHECK SIGN */
- DECODE_PRINTF2("%04x\n", (u16)ip32);
- CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip32, "");
- } else {
- ip16 = (s16) fetch_word_imm();
- ip16 += (s16) M.x86.R_IP; /* CHECK SIGN */
- DECODE_PRINTF2("%04x\n", (u16)ip16);
- CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip16, "");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- push_long(M.x86.R_EIP);
- M.x86.R_EIP = ip32 & 0xffff;
- } else {
- push_word(M.x86.R_IP);
- M.x86.R_EIP = ip16;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xe9
-****************************************************************************/
-static void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
-{
- u32 ip;
-
- START_OF_INSTR();
- DECODE_PRINTF("JMP\t");
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- ip = (u32)fetch_long_imm();
- ip += (u32)M.x86.R_EIP;
- DECODE_PRINTF2("%08x\n", (u32)ip);
- TRACE_AND_STEP();
- M.x86.R_EIP = (u32)ip;
- } else {
- ip = (s16)fetch_word_imm();
- ip += (s16)M.x86.R_IP;
- DECODE_PRINTF2("%04x\n", (u16)ip);
- TRACE_AND_STEP();
- M.x86.R_IP = (u16)ip;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xea
-****************************************************************************/
-static void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
-{
- u16 cs;
- u32 ip;
-
- START_OF_INSTR();
- DECODE_PRINTF("JMP\tFAR ");
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- ip = fetch_long_imm();
- } else {
- ip = fetch_word_imm();
- }
- cs = fetch_word_imm();
- DECODE_PRINTF2("%04x:", cs);
- DECODE_PRINTF2("%04x\n", ip);
- TRACE_AND_STEP();
- M.x86.R_EIP = ip & 0xffff;
- M.x86.R_CS = cs;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xeb
-****************************************************************************/
-static void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
-{
- u16 target;
- s8 offset;
-
- START_OF_INSTR();
- DECODE_PRINTF("JMP\t");
- offset = (s8)fetch_byte_imm();
- target = (u16)(M.x86.R_IP + offset);
- DECODE_PRINTF2("%x\n", target);
- TRACE_AND_STEP();
- M.x86.R_IP = target;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xec
-****************************************************************************/
-static void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("IN\tAL,DX\n");
- TRACE_AND_STEP();
- M.x86.R_AL = (*sys_inb)(M.x86.R_DX);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xed
-****************************************************************************/
-static void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("IN\tEAX,DX\n");
- } else {
- DECODE_PRINTF("IN\tAX,DX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_EAX = (*sys_inl)(M.x86.R_DX);
- } else {
- M.x86.R_AX = (*sys_inw)(M.x86.R_DX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xee
-****************************************************************************/
-static void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("OUT\tDX,AL\n");
- TRACE_AND_STEP();
- (*sys_outb)(M.x86.R_DX, M.x86.R_AL);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xef
-****************************************************************************/
-static void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("OUT\tDX,EAX\n");
- } else {
- DECODE_PRINTF("OUT\tDX,AX\n");
- }
- TRACE_AND_STEP();
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- (*sys_outl)(M.x86.R_DX, M.x86.R_EAX);
- } else {
- (*sys_outw)(M.x86.R_DX, M.x86.R_AX);
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xf0
-****************************************************************************/
-static void x86emuOp_lock(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("LOCK:\n");
- TRACE_AND_STEP();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/*opcode 0xf1 ILLEGAL OPERATION */
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xf2
-****************************************************************************/
-static void x86emuOp_repne(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("REPNE\n");
- TRACE_AND_STEP();
- M.x86.mode |= SYSMODE_PREFIX_REPNE;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xf3
-****************************************************************************/
-static void x86emuOp_repe(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("REPE\n");
- TRACE_AND_STEP();
- M.x86.mode |= SYSMODE_PREFIX_REPE;
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xf4
-****************************************************************************/
-static void x86emuOp_halt(u8 X86EMU_UNUSED(op1))
-{
- START_OF_INSTR();
- DECODE_PRINTF("HALT\n");
- TRACE_AND_STEP();
- HALT_SYS();
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xf5
-****************************************************************************/
-static void x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
-{
- /* complement the carry flag. */
- START_OF_INSTR();
- DECODE_PRINTF("CMC\n");
- TRACE_AND_STEP();
- TOGGLE_FLAG(F_CF);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xf6
-****************************************************************************/
-static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- u8 *destreg;
- uint destoffset;
- u8 destval, srcval;
-
- /* long, drawn out code follows. Double switch for a total
- of 32 cases. */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0: /* mod=00 */
- switch (rh) {
- case 0: /* test byte imm */
- DECODE_PRINTF("TEST\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%02x\n", srcval);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- test_byte(destval, srcval);
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- DECODE_PRINTF("NOT\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = not_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 3:
- DECODE_PRINTF("NEG\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = neg_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 4:
- DECODE_PRINTF("MUL\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- mul_byte(destval);
- break;
- case 5:
- DECODE_PRINTF("IMUL\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- imul_byte(destval);
- break;
- case 6:
- DECODE_PRINTF("DIV\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- div_byte(destval);
- break;
- case 7:
- DECODE_PRINTF("IDIV\tBYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- idiv_byte(destval);
- break;
- }
- break; /* end mod==00 */
- case 1: /* mod=01 */
- switch (rh) {
- case 0: /* test byte imm */
- DECODE_PRINTF("TEST\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%02x\n", srcval);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- test_byte(destval, srcval);
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- DECODE_PRINTF("NOT\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = not_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 3:
- DECODE_PRINTF("NEG\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = neg_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 4:
- DECODE_PRINTF("MUL\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- mul_byte(destval);
- break;
- case 5:
- DECODE_PRINTF("IMUL\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- imul_byte(destval);
- break;
- case 6:
- DECODE_PRINTF("DIV\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- div_byte(destval);
- break;
- case 7:
- DECODE_PRINTF("IDIV\tBYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- idiv_byte(destval);
- break;
- }
- break; /* end mod==01 */
- case 2: /* mod=10 */
- switch (rh) {
- case 0: /* test byte imm */
- DECODE_PRINTF("TEST\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%02x\n", srcval);
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- test_byte(destval, srcval);
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- DECODE_PRINTF("NOT\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = not_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 3:
- DECODE_PRINTF("NEG\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = neg_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 4:
- DECODE_PRINTF("MUL\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- mul_byte(destval);
- break;
- case 5:
- DECODE_PRINTF("IMUL\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- imul_byte(destval);
- break;
- case 6:
- DECODE_PRINTF("DIV\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- div_byte(destval);
- break;
- case 7:
- DECODE_PRINTF("IDIV\tBYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- idiv_byte(destval);
- break;
- }
- break; /* end mod==10 */
- case 3: /* mod=11 */
- switch (rh) {
- case 0: /* test byte imm */
- DECODE_PRINTF("TEST\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF(",");
- srcval = fetch_byte_imm();
- DECODE_PRINTF2("%02x\n", srcval);
- TRACE_AND_STEP();
- test_byte(*destreg, srcval);
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- DECODE_PRINTF("NOT\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = not_byte(*destreg);
- break;
- case 3:
- DECODE_PRINTF("NEG\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = neg_byte(*destreg);
- break;
- case 4:
- DECODE_PRINTF("MUL\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- mul_byte(*destreg); /*!!! */
- break;
- case 5:
- DECODE_PRINTF("IMUL\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- imul_byte(*destreg);
- break;
- case 6:
- DECODE_PRINTF("DIV\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- div_byte(*destreg);
- break;
- case 7:
- DECODE_PRINTF("IDIV\t");
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- idiv_byte(*destreg);
- break;
- }
- break; /* end mod==11 */
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xf7
-****************************************************************************/
-static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rl, rh;
- uint destoffset;
-
- /* long, drawn out code follows. Double switch for a total
- of 32 cases. */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0: /* mod=00 */
- switch (rh) {
- case 0: /* test word imm */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,srcval;
-
- DECODE_PRINTF("TEST\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_long_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- test_long(destval, srcval);
- } else {
- u16 destval,srcval;
-
- DECODE_PRINTF("TEST\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_word_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- test_word(destval, srcval);
- }
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F7\n");
- HALT_SYS();
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NOT\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = not_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NOT\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = not_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 3:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NEG\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = neg_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NEG\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = neg_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 4:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("MUL\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- mul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("MUL\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- mul_word(destval);
- }
- break;
- case 5:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IMUL\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- imul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IMUL\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- imul_word(destval);
- }
- break;
- case 6:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DIV\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- div_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("DIV\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- div_word(destval);
- }
- break;
- case 7:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IDIV\tDWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- idiv_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IDIV\tWORD PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- idiv_word(destval);
- }
- break;
- }
- break; /* end mod==00 */
- case 1: /* mod=01 */
- switch (rh) {
- case 0: /* test word imm */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,srcval;
-
- DECODE_PRINTF("TEST\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_long_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- test_long(destval, srcval);
- } else {
- u16 destval,srcval;
-
- DECODE_PRINTF("TEST\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_word_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- test_word(destval, srcval);
- }
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NOT\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = not_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NOT\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = not_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 3:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NEG\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = neg_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NEG\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = neg_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 4:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("MUL\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- mul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("MUL\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- mul_word(destval);
- }
- break;
- case 5:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IMUL\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- imul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IMUL\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- imul_word(destval);
- }
- break;
- case 6:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DIV\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- div_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("DIV\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- div_word(destval);
- }
- break;
- case 7:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IDIV\tDWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- idiv_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IDIV\tWORD PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- idiv_word(destval);
- }
- break;
- }
- break; /* end mod==01 */
- case 2: /* mod=10 */
- switch (rh) {
- case 0: /* test word imm */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval,srcval;
-
- DECODE_PRINTF("TEST\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_long_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- test_long(destval, srcval);
- } else {
- u16 destval,srcval;
-
- DECODE_PRINTF("TEST\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- srcval = fetch_word_imm();
- DECODE_PRINTF2("%x\n", srcval);
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- test_word(destval, srcval);
- }
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NOT\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = not_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NOT\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = not_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 3:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("NEG\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = neg_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("NEG\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = neg_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 4:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("MUL\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- mul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("MUL\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- mul_word(destval);
- }
- break;
- case 5:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IMUL\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- imul_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IMUL\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- imul_word(destval);
- }
- break;
- case 6:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("DIV\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- div_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("DIV\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- div_word(destval);
- }
- break;
- case 7:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- DECODE_PRINTF("IDIV\tDWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- idiv_long(destval);
- } else {
- u16 destval;
-
- DECODE_PRINTF("IDIV\tWORD PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- idiv_word(destval);
- }
- break;
- }
- break; /* end mod==10 */
- case 3: /* mod=11 */
- switch (rh) {
- case 0: /* test word imm */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
- u32 srcval;
-
- DECODE_PRINTF("TEST\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- srcval = fetch_long_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- test_long(*destreg, srcval);
- } else {
- u16 *destreg;
- u16 srcval;
-
- DECODE_PRINTF("TEST\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- srcval = fetch_word_imm();
- DECODE_PRINTF2("%x\n", srcval);
- TRACE_AND_STEP();
- test_word(*destreg, srcval);
- }
- break;
- case 1:
- DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
- HALT_SYS();
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("NOT\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = not_long(*destreg);
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("NOT\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = not_word(*destreg);
- }
- break;
- case 3:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("NEG\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = neg_long(*destreg);
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("NEG\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = neg_word(*destreg);
- }
- break;
- case 4:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("MUL\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- mul_long(*destreg); /*!!! */
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("MUL\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- mul_word(*destreg); /*!!! */
- }
- break;
- case 5:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("IMUL\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- imul_long(*destreg);
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("IMUL\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- imul_word(*destreg);
- }
- break;
- case 6:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("DIV\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- div_long(*destreg);
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("DIV\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- div_word(*destreg);
- }
- break;
- case 7:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- DECODE_PRINTF("IDIV\t");
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- idiv_long(*destreg);
- } else {
- u16 *destreg;
-
- DECODE_PRINTF("IDIV\t");
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- idiv_word(*destreg);
- }
- break;
- }
- break; /* end mod==11 */
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xf8
-****************************************************************************/
-static void x86emuOp_clc(u8 X86EMU_UNUSED(op1))
-{
- /* clear the carry flag. */
- START_OF_INSTR();
- DECODE_PRINTF("CLC\n");
- TRACE_AND_STEP();
- CLEAR_FLAG(F_CF);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xf9
-****************************************************************************/
-static void x86emuOp_stc(u8 X86EMU_UNUSED(op1))
-{
- /* set the carry flag. */
- START_OF_INSTR();
- DECODE_PRINTF("STC\n");
- TRACE_AND_STEP();
- SET_FLAG(F_CF);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xfa
-****************************************************************************/
-static void x86emuOp_cli(u8 X86EMU_UNUSED(op1))
-{
- /* clear interrupts. */
- START_OF_INSTR();
- DECODE_PRINTF("CLI\n");
- TRACE_AND_STEP();
- CLEAR_FLAG(F_IF);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xfb
-****************************************************************************/
-static void x86emuOp_sti(u8 X86EMU_UNUSED(op1))
-{
- /* enable interrupts. */
- START_OF_INSTR();
- DECODE_PRINTF("STI\n");
- TRACE_AND_STEP();
- SET_FLAG(F_IF);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xfc
-****************************************************************************/
-static void x86emuOp_cld(u8 X86EMU_UNUSED(op1))
-{
- /* clear interrupts. */
- START_OF_INSTR();
- DECODE_PRINTF("CLD\n");
- TRACE_AND_STEP();
- CLEAR_FLAG(F_DF);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xfd
-****************************************************************************/
-static void x86emuOp_std(u8 X86EMU_UNUSED(op1))
-{
- /* clear interrupts. */
- START_OF_INSTR();
- DECODE_PRINTF("STD\n");
- TRACE_AND_STEP();
- SET_FLAG(F_DF);
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xfe
-****************************************************************************/
-static void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rh, rl;
- u8 destval;
- uint destoffset;
- u8 *destreg;
-
- /* Yet another special case instruction. */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- DECODE_PRINTF("INC\t");
- break;
- case 1:
- DECODE_PRINTF("DEC\t");
- break;
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- DECODE_PRINTF2("ILLEGAL OP MAJOR OP 0xFE MINOR OP %x \n", mod);
- HALT_SYS();
- break;
- }
- }
-#endif
- switch (mod) {
- case 0:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0: /* inc word ptr ... */
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = inc_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 1: /* dec word ptr ... */
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = dec_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- }
- break;
- case 1:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0:
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = inc_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = dec_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- }
- break;
- case 2:
- DECODE_PRINTF("BYTE PTR ");
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0:
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = inc_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- case 1:
- destval = fetch_data_byte(destoffset);
- TRACE_AND_STEP();
- destval = dec_byte(destval);
- store_data_byte(destoffset, destval);
- break;
- }
- break;
- case 3:
- destreg = DECODE_RM_BYTE_REGISTER(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0:
- TRACE_AND_STEP();
- *destreg = inc_byte(*destreg);
- break;
- case 1:
- TRACE_AND_STEP();
- *destreg = dec_byte(*destreg);
- break;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/****************************************************************************
-REMARKS:
-Handles opcode 0xff
-****************************************************************************/
-static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
-{
- int mod, rh, rl;
- uint destoffset = 0;
- u16 *destreg;
- u16 destval,destval2;
-
- /* Yet another special case instruction. */
- START_OF_INSTR();
- FETCH_DECODE_MODRM(mod, rh, rl);
-#ifdef DEBUG
- if (DEBUG_DECODE()) {
- /* XXX DECODE_PRINTF may be changed to something more
- general, so that it is important to leave the strings
- in the same format, even though the result is that the
- above test is done twice. */
-
- switch (rh) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("INC\tDWORD PTR ");
- } else {
- DECODE_PRINTF("INC\tWORD PTR ");
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- DECODE_PRINTF("DEC\tDWORD PTR ");
- } else {
- DECODE_PRINTF("DEC\tWORD PTR ");
- }
- break;
- case 2:
- DECODE_PRINTF("CALL\t");
- break;
- case 3:
- DECODE_PRINTF("CALL\tFAR ");
- break;
- case 4:
- DECODE_PRINTF("JMP\t");
- break;
- case 5:
- DECODE_PRINTF("JMP\tFAR ");
- break;
- case 6:
- DECODE_PRINTF("PUSH\t");
- break;
- case 7:
- DECODE_PRINTF("ILLEGAL DECODING OF OPCODE FF\t");
- HALT_SYS();
- break;
- }
- }
-#endif
- switch (mod) {
- case 0:
- destoffset = decode_rm00_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0: /* inc word ptr ... */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = inc_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = inc_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 1: /* dec word ptr ... */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = dec_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = dec_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 2: /* call word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 3: /* call far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- push_word(M.x86.R_CS);
- M.x86.R_CS = destval2;
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 4: /* jmp word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- break;
- case 5: /* jmp far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- M.x86.R_CS = destval2;
- break;
- case 6: /* push word ptr ... */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- push_long(destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(destval);
- }
- break;
- }
- break;
- case 1:
- destoffset = decode_rm01_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = inc_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = inc_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = dec_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = dec_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 2: /* call word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 3: /* call far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- push_word(M.x86.R_CS);
- M.x86.R_CS = destval2;
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 4: /* jmp word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- break;
- case 5: /* jmp far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- M.x86.R_CS = destval2;
- break;
- case 6: /* push word ptr ... */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- push_long(destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(destval);
- }
- break;
- }
- break;
- case 2:
- destoffset = decode_rm10_address(rl);
- DECODE_PRINTF("\n");
- switch (rh) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = inc_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = inc_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- destval = dec_long(destval);
- store_data_long(destoffset, destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- destval = dec_word(destval);
- store_data_word(destoffset, destval);
- }
- break;
- case 2: /* call word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 3: /* call far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- push_word(M.x86.R_CS);
- M.x86.R_CS = destval2;
- push_word(M.x86.R_IP);
- M.x86.R_IP = destval;
- break;
- case 4: /* jmp word ptr ... */
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- break;
- case 5: /* jmp far ptr ... */
- destval = fetch_data_word(destoffset);
- destval2 = fetch_data_word(destoffset + 2);
- TRACE_AND_STEP();
- M.x86.R_IP = destval;
- M.x86.R_CS = destval2;
- break;
- case 6: /* push word ptr ... */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 destval;
-
- destval = fetch_data_long(destoffset);
- TRACE_AND_STEP();
- push_long(destval);
- } else {
- u16 destval;
-
- destval = fetch_data_word(destoffset);
- TRACE_AND_STEP();
- push_word(destval);
- }
- break;
- }
- break;
- case 3:
- switch (rh) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = inc_long(*destreg);
- } else {
- u16 *destreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = inc_word(*destreg);
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = dec_long(*destreg);
- } else {
- u16 *destreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *destreg = dec_word(*destreg);
- }
- break;
- case 2: /* call word ptr ... */
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- push_word(M.x86.R_IP);
- M.x86.R_IP = *destreg;
- break;
- case 3: /* jmp far ptr ... */
- DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
- TRACE_AND_STEP();
- HALT_SYS();
- break;
-
- case 4: /* jmp ... */
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- M.x86.R_IP = (u16) (*destreg);
- break;
- case 5: /* jmp far ptr ... */
- DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
- TRACE_AND_STEP();
- HALT_SYS();
- break;
- case 6:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg;
-
- destreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- push_long(*destreg);
- } else {
- u16 *destreg;
-
- destreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- push_word(*destreg);
- }
- break;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
-}
-
-/***************************************************************************
- * Single byte operation code table:
- **************************************************************************/
-void (*x86emu_optab[256])(u8) =
-{
-/* 0x00 */ x86emuOp_add_byte_RM_R,
-/* 0x01 */ x86emuOp_add_word_RM_R,
-/* 0x02 */ x86emuOp_add_byte_R_RM,
-/* 0x03 */ x86emuOp_add_word_R_RM,
-/* 0x04 */ x86emuOp_add_byte_AL_IMM,
-/* 0x05 */ x86emuOp_add_word_AX_IMM,
-/* 0x06 */ x86emuOp_push_ES,
-/* 0x07 */ x86emuOp_pop_ES,
-
-/* 0x08 */ x86emuOp_or_byte_RM_R,
-/* 0x09 */ x86emuOp_or_word_RM_R,
-/* 0x0a */ x86emuOp_or_byte_R_RM,
-/* 0x0b */ x86emuOp_or_word_R_RM,
-/* 0x0c */ x86emuOp_or_byte_AL_IMM,
-/* 0x0d */ x86emuOp_or_word_AX_IMM,
-/* 0x0e */ x86emuOp_push_CS,
-/* 0x0f */ x86emuOp_two_byte,
-
-/* 0x10 */ x86emuOp_adc_byte_RM_R,
-/* 0x11 */ x86emuOp_adc_word_RM_R,
-/* 0x12 */ x86emuOp_adc_byte_R_RM,
-/* 0x13 */ x86emuOp_adc_word_R_RM,
-/* 0x14 */ x86emuOp_adc_byte_AL_IMM,
-/* 0x15 */ x86emuOp_adc_word_AX_IMM,
-/* 0x16 */ x86emuOp_push_SS,
-/* 0x17 */ x86emuOp_pop_SS,
-
-/* 0x18 */ x86emuOp_sbb_byte_RM_R,
-/* 0x19 */ x86emuOp_sbb_word_RM_R,
-/* 0x1a */ x86emuOp_sbb_byte_R_RM,
-/* 0x1b */ x86emuOp_sbb_word_R_RM,
-/* 0x1c */ x86emuOp_sbb_byte_AL_IMM,
-/* 0x1d */ x86emuOp_sbb_word_AX_IMM,
-/* 0x1e */ x86emuOp_push_DS,
-/* 0x1f */ x86emuOp_pop_DS,
-
-/* 0x20 */ x86emuOp_and_byte_RM_R,
-/* 0x21 */ x86emuOp_and_word_RM_R,
-/* 0x22 */ x86emuOp_and_byte_R_RM,
-/* 0x23 */ x86emuOp_and_word_R_RM,
-/* 0x24 */ x86emuOp_and_byte_AL_IMM,
-/* 0x25 */ x86emuOp_and_word_AX_IMM,
-/* 0x26 */ x86emuOp_segovr_ES,
-/* 0x27 */ x86emuOp_daa,
-
-/* 0x28 */ x86emuOp_sub_byte_RM_R,
-/* 0x29 */ x86emuOp_sub_word_RM_R,
-/* 0x2a */ x86emuOp_sub_byte_R_RM,
-/* 0x2b */ x86emuOp_sub_word_R_RM,
-/* 0x2c */ x86emuOp_sub_byte_AL_IMM,
-/* 0x2d */ x86emuOp_sub_word_AX_IMM,
-/* 0x2e */ x86emuOp_segovr_CS,
-/* 0x2f */ x86emuOp_das,
-
-/* 0x30 */ x86emuOp_xor_byte_RM_R,
-/* 0x31 */ x86emuOp_xor_word_RM_R,
-/* 0x32 */ x86emuOp_xor_byte_R_RM,
-/* 0x33 */ x86emuOp_xor_word_R_RM,
-/* 0x34 */ x86emuOp_xor_byte_AL_IMM,
-/* 0x35 */ x86emuOp_xor_word_AX_IMM,
-/* 0x36 */ x86emuOp_segovr_SS,
-/* 0x37 */ x86emuOp_aaa,
-
-/* 0x38 */ x86emuOp_cmp_byte_RM_R,
-/* 0x39 */ x86emuOp_cmp_word_RM_R,
-/* 0x3a */ x86emuOp_cmp_byte_R_RM,
-/* 0x3b */ x86emuOp_cmp_word_R_RM,
-/* 0x3c */ x86emuOp_cmp_byte_AL_IMM,
-/* 0x3d */ x86emuOp_cmp_word_AX_IMM,
-/* 0x3e */ x86emuOp_segovr_DS,
-/* 0x3f */ x86emuOp_aas,
-
-/* 0x40 */ x86emuOp_inc_AX,
-/* 0x41 */ x86emuOp_inc_CX,
-/* 0x42 */ x86emuOp_inc_DX,
-/* 0x43 */ x86emuOp_inc_BX,
-/* 0x44 */ x86emuOp_inc_SP,
-/* 0x45 */ x86emuOp_inc_BP,
-/* 0x46 */ x86emuOp_inc_SI,
-/* 0x47 */ x86emuOp_inc_DI,
-
-/* 0x48 */ x86emuOp_dec_AX,
-/* 0x49 */ x86emuOp_dec_CX,
-/* 0x4a */ x86emuOp_dec_DX,
-/* 0x4b */ x86emuOp_dec_BX,
-/* 0x4c */ x86emuOp_dec_SP,
-/* 0x4d */ x86emuOp_dec_BP,
-/* 0x4e */ x86emuOp_dec_SI,
-/* 0x4f */ x86emuOp_dec_DI,
-
-/* 0x50 */ x86emuOp_push_AX,
-/* 0x51 */ x86emuOp_push_CX,
-/* 0x52 */ x86emuOp_push_DX,
-/* 0x53 */ x86emuOp_push_BX,
-/* 0x54 */ x86emuOp_push_SP,
-/* 0x55 */ x86emuOp_push_BP,
-/* 0x56 */ x86emuOp_push_SI,
-/* 0x57 */ x86emuOp_push_DI,
-
-/* 0x58 */ x86emuOp_pop_AX,
-/* 0x59 */ x86emuOp_pop_CX,
-/* 0x5a */ x86emuOp_pop_DX,
-/* 0x5b */ x86emuOp_pop_BX,
-/* 0x5c */ x86emuOp_pop_SP,
-/* 0x5d */ x86emuOp_pop_BP,
-/* 0x5e */ x86emuOp_pop_SI,
-/* 0x5f */ x86emuOp_pop_DI,
-
-/* 0x60 */ x86emuOp_push_all,
-/* 0x61 */ x86emuOp_pop_all,
-/* 0x62 */ x86emuOp_illegal_op, /* bound */
-/* 0x63 */ x86emuOp_illegal_op, /* arpl */
-/* 0x64 */ x86emuOp_segovr_FS,
-/* 0x65 */ x86emuOp_segovr_GS,
-/* 0x66 */ x86emuOp_prefix_data,
-/* 0x67 */ x86emuOp_prefix_addr,
-
-/* 0x68 */ x86emuOp_push_word_IMM,
-/* 0x69 */ x86emuOp_imul_word_IMM,
-/* 0x6a */ x86emuOp_push_byte_IMM,
-/* 0x6b */ x86emuOp_imul_byte_IMM,
-/* 0x6c */ x86emuOp_ins_byte,
-/* 0x6d */ x86emuOp_ins_word,
-/* 0x6e */ x86emuOp_outs_byte,
-/* 0x6f */ x86emuOp_outs_word,
-
-/* 0x70 */ x86emuOp_jump_near_O,
-/* 0x71 */ x86emuOp_jump_near_NO,
-/* 0x72 */ x86emuOp_jump_near_B,
-/* 0x73 */ x86emuOp_jump_near_NB,
-/* 0x74 */ x86emuOp_jump_near_Z,
-/* 0x75 */ x86emuOp_jump_near_NZ,
-/* 0x76 */ x86emuOp_jump_near_BE,
-/* 0x77 */ x86emuOp_jump_near_NBE,
-
-/* 0x78 */ x86emuOp_jump_near_S,
-/* 0x79 */ x86emuOp_jump_near_NS,
-/* 0x7a */ x86emuOp_jump_near_P,
-/* 0x7b */ x86emuOp_jump_near_NP,
-/* 0x7c */ x86emuOp_jump_near_L,
-/* 0x7d */ x86emuOp_jump_near_NL,
-/* 0x7e */ x86emuOp_jump_near_LE,
-/* 0x7f */ x86emuOp_jump_near_NLE,
-
-/* 0x80 */ x86emuOp_opc80_byte_RM_IMM,
-/* 0x81 */ x86emuOp_opc81_word_RM_IMM,
-/* 0x82 */ x86emuOp_opc82_byte_RM_IMM,
-/* 0x83 */ x86emuOp_opc83_word_RM_IMM,
-/* 0x84 */ x86emuOp_test_byte_RM_R,
-/* 0x85 */ x86emuOp_test_word_RM_R,
-/* 0x86 */ x86emuOp_xchg_byte_RM_R,
-/* 0x87 */ x86emuOp_xchg_word_RM_R,
-
-/* 0x88 */ x86emuOp_mov_byte_RM_R,
-/* 0x89 */ x86emuOp_mov_word_RM_R,
-/* 0x8a */ x86emuOp_mov_byte_R_RM,
-/* 0x8b */ x86emuOp_mov_word_R_RM,
-/* 0x8c */ x86emuOp_mov_word_RM_SR,
-/* 0x8d */ x86emuOp_lea_word_R_M,
-/* 0x8e */ x86emuOp_mov_word_SR_RM,
-/* 0x8f */ x86emuOp_pop_RM,
-
-/* 0x90 */ x86emuOp_nop,
-/* 0x91 */ x86emuOp_xchg_word_AX_CX,
-/* 0x92 */ x86emuOp_xchg_word_AX_DX,
-/* 0x93 */ x86emuOp_xchg_word_AX_BX,
-/* 0x94 */ x86emuOp_xchg_word_AX_SP,
-/* 0x95 */ x86emuOp_xchg_word_AX_BP,
-/* 0x96 */ x86emuOp_xchg_word_AX_SI,
-/* 0x97 */ x86emuOp_xchg_word_AX_DI,
-
-/* 0x98 */ x86emuOp_cbw,
-/* 0x99 */ x86emuOp_cwd,
-/* 0x9a */ x86emuOp_call_far_IMM,
-/* 0x9b */ x86emuOp_wait,
-/* 0x9c */ x86emuOp_pushf_word,
-/* 0x9d */ x86emuOp_popf_word,
-/* 0x9e */ x86emuOp_sahf,
-/* 0x9f */ x86emuOp_lahf,
-
-/* 0xa0 */ x86emuOp_mov_AL_M_IMM,
-/* 0xa1 */ x86emuOp_mov_AX_M_IMM,
-/* 0xa2 */ x86emuOp_mov_M_AL_IMM,
-/* 0xa3 */ x86emuOp_mov_M_AX_IMM,
-/* 0xa4 */ x86emuOp_movs_byte,
-/* 0xa5 */ x86emuOp_movs_word,
-/* 0xa6 */ x86emuOp_cmps_byte,
-/* 0xa7 */ x86emuOp_cmps_word,
-/* 0xa8 */ x86emuOp_test_AL_IMM,
-/* 0xa9 */ x86emuOp_test_AX_IMM,
-/* 0xaa */ x86emuOp_stos_byte,
-/* 0xab */ x86emuOp_stos_word,
-/* 0xac */ x86emuOp_lods_byte,
-/* 0xad */ x86emuOp_lods_word,
-/* 0xac */ x86emuOp_scas_byte,
-/* 0xad */ x86emuOp_scas_word,
-
-
-/* 0xb0 */ x86emuOp_mov_byte_AL_IMM,
-/* 0xb1 */ x86emuOp_mov_byte_CL_IMM,
-/* 0xb2 */ x86emuOp_mov_byte_DL_IMM,
-/* 0xb3 */ x86emuOp_mov_byte_BL_IMM,
-/* 0xb4 */ x86emuOp_mov_byte_AH_IMM,
-/* 0xb5 */ x86emuOp_mov_byte_CH_IMM,
-/* 0xb6 */ x86emuOp_mov_byte_DH_IMM,
-/* 0xb7 */ x86emuOp_mov_byte_BH_IMM,
-
-/* 0xb8 */ x86emuOp_mov_word_AX_IMM,
-/* 0xb9 */ x86emuOp_mov_word_CX_IMM,
-/* 0xba */ x86emuOp_mov_word_DX_IMM,
-/* 0xbb */ x86emuOp_mov_word_BX_IMM,
-/* 0xbc */ x86emuOp_mov_word_SP_IMM,
-/* 0xbd */ x86emuOp_mov_word_BP_IMM,
-/* 0xbe */ x86emuOp_mov_word_SI_IMM,
-/* 0xbf */ x86emuOp_mov_word_DI_IMM,
-
-/* 0xc0 */ x86emuOp_opcC0_byte_RM_MEM,
-/* 0xc1 */ x86emuOp_opcC1_word_RM_MEM,
-/* 0xc2 */ x86emuOp_ret_near_IMM,
-/* 0xc3 */ x86emuOp_ret_near,
-/* 0xc4 */ x86emuOp_les_R_IMM,
-/* 0xc5 */ x86emuOp_lds_R_IMM,
-/* 0xc6 */ x86emuOp_mov_byte_RM_IMM,
-/* 0xc7 */ x86emuOp_mov_word_RM_IMM,
-/* 0xc8 */ x86emuOp_enter,
-/* 0xc9 */ x86emuOp_leave,
-/* 0xca */ x86emuOp_ret_far_IMM,
-/* 0xcb */ x86emuOp_ret_far,
-/* 0xcc */ x86emuOp_int3,
-/* 0xcd */ x86emuOp_int_IMM,
-/* 0xce */ x86emuOp_into,
-/* 0xcf */ x86emuOp_iret,
-
-/* 0xd0 */ x86emuOp_opcD0_byte_RM_1,
-/* 0xd1 */ x86emuOp_opcD1_word_RM_1,
-/* 0xd2 */ x86emuOp_opcD2_byte_RM_CL,
-/* 0xd3 */ x86emuOp_opcD3_word_RM_CL,
-/* 0xd4 */ x86emuOp_aam,
-/* 0xd5 */ x86emuOp_aad,
-/* 0xd6 */ x86emuOp_illegal_op, /* Undocumented SETALC instruction */
-/* 0xd7 */ x86emuOp_xlat,
-/* 0xd8 */ x86emuOp_esc_coprocess_d8,
-/* 0xd9 */ x86emuOp_esc_coprocess_d9,
-/* 0xda */ x86emuOp_esc_coprocess_da,
-/* 0xdb */ x86emuOp_esc_coprocess_db,
-/* 0xdc */ x86emuOp_esc_coprocess_dc,
-/* 0xdd */ x86emuOp_esc_coprocess_dd,
-/* 0xde */ x86emuOp_esc_coprocess_de,
-/* 0xdf */ x86emuOp_esc_coprocess_df,
-
-/* 0xe0 */ x86emuOp_loopne,
-/* 0xe1 */ x86emuOp_loope,
-/* 0xe2 */ x86emuOp_loop,
-/* 0xe3 */ x86emuOp_jcxz,
-/* 0xe4 */ x86emuOp_in_byte_AL_IMM,
-/* 0xe5 */ x86emuOp_in_word_AX_IMM,
-/* 0xe6 */ x86emuOp_out_byte_IMM_AL,
-/* 0xe7 */ x86emuOp_out_word_IMM_AX,
-
-/* 0xe8 */ x86emuOp_call_near_IMM,
-/* 0xe9 */ x86emuOp_jump_near_IMM,
-/* 0xea */ x86emuOp_jump_far_IMM,
-/* 0xeb */ x86emuOp_jump_byte_IMM,
-/* 0xec */ x86emuOp_in_byte_AL_DX,
-/* 0xed */ x86emuOp_in_word_AX_DX,
-/* 0xee */ x86emuOp_out_byte_DX_AL,
-/* 0xef */ x86emuOp_out_word_DX_AX,
-
-/* 0xf0 */ x86emuOp_lock,
-/* 0xf1 */ x86emuOp_illegal_op,
-/* 0xf2 */ x86emuOp_repne,
-/* 0xf3 */ x86emuOp_repe,
-/* 0xf4 */ x86emuOp_halt,
-/* 0xf5 */ x86emuOp_cmc,
-/* 0xf6 */ x86emuOp_opcF6_byte_RM,
-/* 0xf7 */ x86emuOp_opcF7_word_RM,
-
-/* 0xf8 */ x86emuOp_clc,
-/* 0xf9 */ x86emuOp_stc,
-/* 0xfa */ x86emuOp_cli,
-/* 0xfb */ x86emuOp_sti,
-/* 0xfc */ x86emuOp_cld,
-/* 0xfd */ x86emuOp_std,
-/* 0xfe */ x86emuOp_opcFE_byte_RM,
-/* 0xff */ x86emuOp_opcFF_word_RM,
-};
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: This file includes subroutines to implement the decoding
+* and emulation of all the x86 processor instructions.
+*
+* There are approximately 250 subroutines in here, which correspond
+* to the 256 byte-"opcodes" found on the 8086. The table which
+* dispatches this is found in the files optab.[ch].
+*
+* Each opcode proc has a comment preceeding it which gives it's table
+* address. Several opcodes are missing (undefined) in the table.
+*
+* Each proc includes information for decoding (DECODE_PRINTF and
+* DECODE_PRINTF2), debugging (TRACE_REGS, SINGLE_STEP), and misc
+* functions (START_OF_INSTR, END_OF_INSTR).
+*
+* Many of the procedures are *VERY* similar in coding. This has
+* allowed for a very large amount of code to be generated in a fairly
+* short amount of time (i.e. cut, paste, and modify). The result is
+* that much of the code below could have been folded into subroutines
+* for a large reduction in size of this file. The downside would be
+* that there would be a penalty in execution speed. The file could
+* also have been *MUCH* larger by inlining certain functions which
+* were called. This could have resulted even faster execution. The
+* prime directive I used to decide whether to inline the code or to
+* modularize it, was basically: 1) no unnecessary subroutine calls,
+* 2) no routines more than about 200 lines in size, and 3) modularize
+* any code that I might not get right the first time. The fetch_*
+* subroutines fall into the latter category. The The decode_* fall
+* into the second category. The coding of the "switch(mod){ .... }"
+* in many of the subroutines below falls into the first category.
+* Especially, the coding of {add,and,or,sub,...}_{byte,word}
+* subroutines are an especially glaring case of the third guideline.
+* Since so much of the code is cloned from other modules (compare
+* opcode #00 to opcode #01), making the basic operations subroutine
+* calls is especially important; otherwise mistakes in coding an
+* "add" would represent a nightmare in maintenance.
+*
+****************************************************************************/
+
+#include "x86emu/x86emui.h"
+
+/*----------------------------- Implementation ----------------------------*/
+
+/****************************************************************************
+PARAMETERS:
+op1 - Instruction op code
+
+REMARKS:
+Handles illegal opcodes.
+****************************************************************************/
+static void
+x86emuOp_illegal_op(u8 op1)
+{
+ START_OF_INSTR();
+ if (M.x86.R_SP != 0) {
+ DECODE_PRINTF("ILLEGAL X86 OPCODE\n");
+ TRACE_REGS();
+ DB(printk("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n",
+ M.x86.R_CS, M.x86.R_IP - 1, op1));
+ HALT_SYS();
+ }
+ else {
+ /* If we get here, it means the stack pointer is back to zero
+ * so we are just returning from an emulator service call
+ * so therte is no need to display an error message. We trap
+ * the emulator with an 0xF1 opcode to finish the service
+ * call.
+ */
+ X86EMU_halt_sys();
+ }
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x00
+****************************************************************************/
+static void
+x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 *destreg, *srcreg;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x01
+****************************************************************************/
+static void
+x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x02
+****************************************************************************/
+static void
+x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x03
+****************************************************************************/
+static void
+x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x04
+****************************************************************************/
+static void
+x86emuOp_add_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADD\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = add_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x05
+****************************************************************************/
+static void
+x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("ADD\tEAX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("ADD\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = add_long(M.x86.R_EAX, srcval);
+ }
+ else {
+ M.x86.R_AX = add_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x06
+****************************************************************************/
+static void
+x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tES\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_ES);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x07
+****************************************************************************/
+static void
+x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tES\n");
+ TRACE_AND_STEP();
+ M.x86.R_ES = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x08
+****************************************************************************/
+static void
+x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x09
+****************************************************************************/
+static void
+x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0a
+****************************************************************************/
+static void
+x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0b
+****************************************************************************/
+static void
+x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0c
+****************************************************************************/
+static void
+x86emuOp_or_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OR\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = or_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0d
+****************************************************************************/
+static void
+x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("OR\tEAX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("OR\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = or_long(M.x86.R_EAX, srcval);
+ }
+ else {
+ M.x86.R_AX = or_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0e
+****************************************************************************/
+static void
+x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tCS\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f. Escape for two-byte opcode (286 or better)
+****************************************************************************/
+static void
+x86emuOp_two_byte(u8 X86EMU_UNUSED(op1))
+{
+ u8 op2 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
+
+ INC_DECODED_INST_LEN(1);
+ (*x86emu_optab2[op2]) (op2);
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x10
+****************************************************************************/
+static void
+x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADC\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x11
+****************************************************************************/
+static void
+x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADC\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x12
+****************************************************************************/
+static void
+x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADC\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x13
+****************************************************************************/
+static void
+x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADC\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x14
+****************************************************************************/
+static void
+x86emuOp_adc_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADC\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = adc_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x15
+****************************************************************************/
+static void
+x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("ADC\tEAX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("ADC\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = adc_long(M.x86.R_EAX, srcval);
+ }
+ else {
+ M.x86.R_AX = adc_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x16
+****************************************************************************/
+static void
+x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tSS\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_SS);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x17
+****************************************************************************/
+static void
+x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tSS\n");
+ TRACE_AND_STEP();
+ M.x86.R_SS = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x18
+****************************************************************************/
+static void
+x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SBB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x19
+****************************************************************************/
+static void
+x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SBB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1a
+****************************************************************************/
+static void
+x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SBB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1b
+****************************************************************************/
+static void
+x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SBB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1c
+****************************************************************************/
+static void
+x86emuOp_sbb_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SBB\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = sbb_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1d
+****************************************************************************/
+static void
+x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("SBB\tEAX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("SBB\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = sbb_long(M.x86.R_EAX, srcval);
+ }
+ else {
+ M.x86.R_AX = sbb_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1e
+****************************************************************************/
+static void
+x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tDS\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_DS);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1f
+****************************************************************************/
+static void
+x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tDS\n");
+ TRACE_AND_STEP();
+ M.x86.R_DS = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x20
+****************************************************************************/
+static void
+x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AND\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x21
+****************************************************************************/
+static void
+x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AND\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x22
+****************************************************************************/
+static void
+x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AND\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x23
+****************************************************************************/
+static void
+x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AND\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+ break;
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, srcval);
+ break;
+ }
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x24
+****************************************************************************/
+static void
+x86emuOp_and_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AND\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = and_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x25
+****************************************************************************/
+static void
+x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("AND\tEAX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("AND\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = and_long(M.x86.R_EAX, srcval);
+ }
+ else {
+ M.x86.R_AX = and_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x26
+****************************************************************************/
+static void
+x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("ES:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_ES;
+ /*
+ * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4
+ * opcode subroutines we do not want to do this.
+ */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x27
+****************************************************************************/
+static void
+x86emuOp_daa(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("DAA\n");
+ TRACE_AND_STEP();
+ M.x86.R_AL = daa_byte(M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x28
+****************************************************************************/
+static void
+x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SUB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x29
+****************************************************************************/
+static void
+x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SUB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2a
+****************************************************************************/
+static void
+x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SUB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2b
+****************************************************************************/
+static void
+x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SUB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2c
+****************************************************************************/
+static void
+x86emuOp_sub_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SUB\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = sub_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2d
+****************************************************************************/
+static void
+x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("SUB\tEAX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("SUB\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = sub_long(M.x86.R_EAX, srcval);
+ }
+ else {
+ M.x86.R_AX = sub_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2e
+****************************************************************************/
+static void
+x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("CS:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_CS;
+ /* note no DECODE_CLEAR_SEGOVR here. */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2f
+****************************************************************************/
+static void
+x86emuOp_das(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("DAS\n");
+ TRACE_AND_STEP();
+ M.x86.R_AL = das_byte(M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x30
+****************************************************************************/
+static void
+x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XOR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x31
+****************************************************************************/
+static void
+x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XOR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x32
+****************************************************************************/
+static void
+x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XOR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x33
+****************************************************************************/
+static void
+x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XOR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x34
+****************************************************************************/
+static void
+x86emuOp_xor_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XOR\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = xor_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x35
+****************************************************************************/
+static void
+x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XOR\tEAX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("XOR\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = xor_long(M.x86.R_EAX, srcval);
+ }
+ else {
+ M.x86.R_AX = xor_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x36
+****************************************************************************/
+static void
+x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("SS:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_SS;
+ /* no DECODE_CLEAR_SEGOVR ! */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x37
+****************************************************************************/
+static void
+x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("AAA\n");
+ TRACE_AND_STEP();
+ M.x86.R_AX = aaa_word(M.x86.R_AX);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x38
+****************************************************************************/
+static void
+x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 *destreg, *srcreg;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMP\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(destval, *srcreg);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(destval, *srcreg);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(destval, *srcreg);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x39
+****************************************************************************/
+static void
+x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMP\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(destval, *srcreg);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(destval, *srcreg);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(destval, *srcreg);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3a
+****************************************************************************/
+static void
+x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMP\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3b
+****************************************************************************/
+static void
+x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMP\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3c
+****************************************************************************/
+static void
+x86emuOp_cmp_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMP\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ cmp_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3d
+****************************************************************************/
+static void
+x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CMP\tEAX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("CMP\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ cmp_long(M.x86.R_EAX, srcval);
+ }
+ else {
+ cmp_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3e
+****************************************************************************/
+static void
+x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("DS:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_DS;
+ /* NO DECODE_CLEAR_SEGOVR! */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3f
+****************************************************************************/
+static void
+x86emuOp_aas(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("AAS\n");
+ TRACE_AND_STEP();
+ M.x86.R_AX = aas_word(M.x86.R_AX);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x40
+****************************************************************************/
+static void
+x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEAX\n");
+ }
+ else {
+ DECODE_PRINTF("INC\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = inc_long(M.x86.R_EAX);
+ }
+ else {
+ M.x86.R_AX = inc_word(M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x41
+****************************************************************************/
+static void
+x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tECX\n");
+ }
+ else {
+ DECODE_PRINTF("INC\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = inc_long(M.x86.R_ECX);
+ }
+ else {
+ M.x86.R_CX = inc_word(M.x86.R_CX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x42
+****************************************************************************/
+static void
+x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEDX\n");
+ }
+ else {
+ DECODE_PRINTF("INC\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = inc_long(M.x86.R_EDX);
+ }
+ else {
+ M.x86.R_DX = inc_word(M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x43
+****************************************************************************/
+static void
+x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEBX\n");
+ }
+ else {
+ DECODE_PRINTF("INC\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = inc_long(M.x86.R_EBX);
+ }
+ else {
+ M.x86.R_BX = inc_word(M.x86.R_BX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x44
+****************************************************************************/
+static void
+x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tESP\n");
+ }
+ else {
+ DECODE_PRINTF("INC\tSP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = inc_long(M.x86.R_ESP);
+ }
+ else {
+ M.x86.R_SP = inc_word(M.x86.R_SP);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x45
+****************************************************************************/
+static void
+x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEBP\n");
+ }
+ else {
+ DECODE_PRINTF("INC\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = inc_long(M.x86.R_EBP);
+ }
+ else {
+ M.x86.R_BP = inc_word(M.x86.R_BP);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x46
+****************************************************************************/
+static void
+x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tESI\n");
+ }
+ else {
+ DECODE_PRINTF("INC\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = inc_long(M.x86.R_ESI);
+ }
+ else {
+ M.x86.R_SI = inc_word(M.x86.R_SI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x47
+****************************************************************************/
+static void
+x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEDI\n");
+ }
+ else {
+ DECODE_PRINTF("INC\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = inc_long(M.x86.R_EDI);
+ }
+ else {
+ M.x86.R_DI = inc_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x48
+****************************************************************************/
+static void
+x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEAX\n");
+ }
+ else {
+ DECODE_PRINTF("DEC\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = dec_long(M.x86.R_EAX);
+ }
+ else {
+ M.x86.R_AX = dec_word(M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x49
+****************************************************************************/
+static void
+x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tECX\n");
+ }
+ else {
+ DECODE_PRINTF("DEC\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = dec_long(M.x86.R_ECX);
+ }
+ else {
+ M.x86.R_CX = dec_word(M.x86.R_CX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4a
+****************************************************************************/
+static void
+x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEDX\n");
+ }
+ else {
+ DECODE_PRINTF("DEC\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = dec_long(M.x86.R_EDX);
+ }
+ else {
+ M.x86.R_DX = dec_word(M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4b
+****************************************************************************/
+static void
+x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEBX\n");
+ }
+ else {
+ DECODE_PRINTF("DEC\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = dec_long(M.x86.R_EBX);
+ }
+ else {
+ M.x86.R_BX = dec_word(M.x86.R_BX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4c
+****************************************************************************/
+static void
+x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tESP\n");
+ }
+ else {
+ DECODE_PRINTF("DEC\tSP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = dec_long(M.x86.R_ESP);
+ }
+ else {
+ M.x86.R_SP = dec_word(M.x86.R_SP);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4d
+****************************************************************************/
+static void
+x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEBP\n");
+ }
+ else {
+ DECODE_PRINTF("DEC\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = dec_long(M.x86.R_EBP);
+ }
+ else {
+ M.x86.R_BP = dec_word(M.x86.R_BP);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4e
+****************************************************************************/
+static void
+x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tESI\n");
+ }
+ else {
+ DECODE_PRINTF("DEC\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = dec_long(M.x86.R_ESI);
+ }
+ else {
+ M.x86.R_SI = dec_word(M.x86.R_SI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4f
+****************************************************************************/
+static void
+x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEDI\n");
+ }
+ else {
+ DECODE_PRINTF("DEC\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = dec_long(M.x86.R_EDI);
+ }
+ else {
+ M.x86.R_DI = dec_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x50
+****************************************************************************/
+static void
+x86emuOp_push_AX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEAX\n");
+ }
+ else {
+ DECODE_PRINTF("PUSH\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EAX);
+ }
+ else {
+ push_word(M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x51
+****************************************************************************/
+static void
+x86emuOp_push_CX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tECX\n");
+ }
+ else {
+ DECODE_PRINTF("PUSH\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_ECX);
+ }
+ else {
+ push_word(M.x86.R_CX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x52
+****************************************************************************/
+static void
+x86emuOp_push_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEDX\n");
+ }
+ else {
+ DECODE_PRINTF("PUSH\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EDX);
+ }
+ else {
+ push_word(M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x53
+****************************************************************************/
+static void
+x86emuOp_push_BX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEBX\n");
+ }
+ else {
+ DECODE_PRINTF("PUSH\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EBX);
+ }
+ else {
+ push_word(M.x86.R_BX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x54
+****************************************************************************/
+static void
+x86emuOp_push_SP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tESP\n");
+ }
+ else {
+ DECODE_PRINTF("PUSH\tSP\n");
+ }
+ TRACE_AND_STEP();
+ /* Always push (E)SP, since we are emulating an i386 and above
+ * processor. This is necessary as some BIOS'es use this to check
+ * what type of processor is in the system.
+ */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_ESP);
+ }
+ else {
+ push_word((u16) (M.x86.R_SP));
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x55
+****************************************************************************/
+static void
+x86emuOp_push_BP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEBP\n");
+ }
+ else {
+ DECODE_PRINTF("PUSH\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EBP);
+ }
+ else {
+ push_word(M.x86.R_BP);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x56
+****************************************************************************/
+static void
+x86emuOp_push_SI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tESI\n");
+ }
+ else {
+ DECODE_PRINTF("PUSH\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_ESI);
+ }
+ else {
+ push_word(M.x86.R_SI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x57
+****************************************************************************/
+static void
+x86emuOp_push_DI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEDI\n");
+ }
+ else {
+ DECODE_PRINTF("PUSH\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EDI);
+ }
+ else {
+ push_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x58
+****************************************************************************/
+static void
+x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEAX\n");
+ }
+ else {
+ DECODE_PRINTF("POP\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = pop_long();
+ }
+ else {
+ M.x86.R_AX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x59
+****************************************************************************/
+static void
+x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tECX\n");
+ }
+ else {
+ DECODE_PRINTF("POP\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = pop_long();
+ }
+ else {
+ M.x86.R_CX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5a
+****************************************************************************/
+static void
+x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEDX\n");
+ }
+ else {
+ DECODE_PRINTF("POP\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = pop_long();
+ }
+ else {
+ M.x86.R_DX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5b
+****************************************************************************/
+static void
+x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEBX\n");
+ }
+ else {
+ DECODE_PRINTF("POP\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = pop_long();
+ }
+ else {
+ M.x86.R_BX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5c
+****************************************************************************/
+static void
+x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tESP\n");
+ }
+ else {
+ DECODE_PRINTF("POP\tSP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = pop_long();
+ }
+ else {
+ M.x86.R_SP = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5d
+****************************************************************************/
+static void
+x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEBP\n");
+ }
+ else {
+ DECODE_PRINTF("POP\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = pop_long();
+ }
+ else {
+ M.x86.R_BP = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5e
+****************************************************************************/
+static void
+x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tESI\n");
+ }
+ else {
+ DECODE_PRINTF("POP\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = pop_long();
+ }
+ else {
+ M.x86.R_SI = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5f
+****************************************************************************/
+static void
+x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEDI\n");
+ }
+ else {
+ DECODE_PRINTF("POP\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = pop_long();
+ }
+ else {
+ M.x86.R_DI = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x60
+****************************************************************************/
+static void
+x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSHAD\n");
+ }
+ else {
+ DECODE_PRINTF("PUSHA\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 old_sp = M.x86.R_ESP;
+
+ push_long(M.x86.R_EAX);
+ push_long(M.x86.R_ECX);
+ push_long(M.x86.R_EDX);
+ push_long(M.x86.R_EBX);
+ push_long(old_sp);
+ push_long(M.x86.R_EBP);
+ push_long(M.x86.R_ESI);
+ push_long(M.x86.R_EDI);
+ }
+ else {
+ u16 old_sp = M.x86.R_SP;
+
+ push_word(M.x86.R_AX);
+ push_word(M.x86.R_CX);
+ push_word(M.x86.R_DX);
+ push_word(M.x86.R_BX);
+ push_word(old_sp);
+ push_word(M.x86.R_BP);
+ push_word(M.x86.R_SI);
+ push_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x61
+****************************************************************************/
+static void
+x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POPAD\n");
+ }
+ else {
+ DECODE_PRINTF("POPA\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = pop_long();
+ M.x86.R_ESI = pop_long();
+ M.x86.R_EBP = pop_long();
+ M.x86.R_ESP += 4; /* skip ESP */
+ M.x86.R_EBX = pop_long();
+ M.x86.R_EDX = pop_long();
+ M.x86.R_ECX = pop_long();
+ M.x86.R_EAX = pop_long();
+ }
+ else {
+ M.x86.R_DI = pop_word();
+ M.x86.R_SI = pop_word();
+ M.x86.R_BP = pop_word();
+ M.x86.R_SP += 2; /* skip SP */
+ M.x86.R_BX = pop_word();
+ M.x86.R_DX = pop_word();
+ M.x86.R_CX = pop_word();
+ M.x86.R_AX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/*opcode 0x62 ILLEGAL OP, calls x86emuOp_illegal_op() */
+/*opcode 0x63 ILLEGAL OP, calls x86emuOp_illegal_op() */
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x64
+****************************************************************************/
+static void
+x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("FS:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_FS;
+ /*
+ * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4
+ * opcode subroutines we do not want to do this.
+ */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x65
+****************************************************************************/
+static void
+x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("GS:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_GS;
+ /*
+ * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4
+ * opcode subroutines we do not want to do this.
+ */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x66 - prefix for 32-bit register
+****************************************************************************/
+static void
+x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("DATA:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_PREFIX_DATA;
+ /* note no DECODE_CLEAR_SEGOVR here. */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x67 - prefix for 32-bit address
+****************************************************************************/
+static void
+x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("ADDR:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_PREFIX_ADDR;
+ /* note no DECODE_CLEAR_SEGOVR here. */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x68
+****************************************************************************/
+static void
+x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 imm;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ imm = fetch_long_imm();
+ }
+ else {
+ imm = fetch_word_imm();
+ }
+ DECODE_PRINTF2("PUSH\t%x\n", imm);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(imm);
+ }
+ else {
+ push_word((u16) imm);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x69
+****************************************************************************/
+static void
+x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IMUL\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo, res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32) res_lo;
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ res = (s16) srcval *(s16) imm;
+
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16) res;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo, res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32) res_lo;
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ res = (s16) srcval *(s16) imm;
+
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16) res;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo, res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32) res_lo;
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ res = (s16) srcval *(s16) imm;
+
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16) res;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+ u32 res_lo, res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo, &res_hi, (s32) * srcreg, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32) res_lo;
+ }
+ else {
+ u16 *destreg, *srcreg;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ res = (s16) * srcreg * (s16) imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16) res;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6a
+****************************************************************************/
+static void
+x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
+{
+ s16 imm;
+
+ START_OF_INSTR();
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2("PUSH\t%d\n", imm);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long((s32) imm);
+ }
+ else {
+ push_word(imm);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6b
+****************************************************************************/
+static void
+x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+ s8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IMUL\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32) res_lo;
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ res = (s16) srcval *(s16) imm;
+
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16) res;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32) res_lo;
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ res = (s16) srcval *(s16) imm;
+
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16) res;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32) res_lo;
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ res = (s16) srcval *(s16) imm;
+
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16) res;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo, &res_hi, (s32) * srcreg, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32) res_lo;
+ }
+ else {
+ u16 *destreg, *srcreg;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32) imm);
+ res = (s16) * srcreg * (s16) imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16) res;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6c
+****************************************************************************/
+static void
+x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("INSB\n");
+ ins(1);
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6d
+****************************************************************************/
+static void
+x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INSD\n");
+ ins(4);
+ }
+ else {
+ DECODE_PRINTF("INSW\n");
+ ins(2);
+ }
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6e
+****************************************************************************/
+static void
+x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("OUTSB\n");
+ outs(1);
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6f
+****************************************************************************/
+static void
+x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("OUTSD\n");
+ outs(4);
+ }
+ else {
+ DECODE_PRINTF("OUTSW\n");
+ outs(2);
+ }
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x70
+****************************************************************************/
+static void
+x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if overflow flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JO\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_OF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x71
+****************************************************************************/
+static void
+x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if overflow is not set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNO\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_OF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x72
+****************************************************************************/
+static void
+x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if carry flag is set. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JB\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_CF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x73
+****************************************************************************/
+static void
+x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if carry flag is clear. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNB\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_CF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x74
+****************************************************************************/
+static void
+x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if zero flag is set. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JZ\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_ZF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x75
+****************************************************************************/
+static void
+x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if zero flag is clear. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNZ\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_ZF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x76
+****************************************************************************/
+static void
+x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if carry flag is set or if the zero
+ flag is set. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JBE\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x77
+****************************************************************************/
+static void
+x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if carry flag is clear and if the zero
+ flag is clear */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNBE\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x78
+****************************************************************************/
+static void
+x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if sign flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JS\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_SF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x79
+****************************************************************************/
+static void
+x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if sign flag is clear */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNS\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_SF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7a
+****************************************************************************/
+static void
+x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if parity flag is set (even parity) */
+ START_OF_INSTR();
+ DECODE_PRINTF("JP\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_PF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7b
+****************************************************************************/
+static void
+x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if parity flag is clear (odd parity) */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNP\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_PF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7c
+****************************************************************************/
+static void
+x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+ int sf, of;
+
+ /* jump to byte offset if sign flag not equal to overflow flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JL\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+ of = ACCESS_FLAG(F_OF) != 0;
+ if (sf ^ of)
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7d
+****************************************************************************/
+static void
+x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+ int sf, of;
+
+ /* jump to byte offset if sign flag not equal to overflow flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNL\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+ of = ACCESS_FLAG(F_OF) != 0;
+ /* note: inverse of above, but using == instead of xor. */
+ if (sf == of)
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7e
+****************************************************************************/
+static void
+x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+ int sf, of;
+
+ /* jump to byte offset if sign flag not equal to overflow flag
+ or the zero flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JLE\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+ of = ACCESS_FLAG(F_OF) != 0;
+ if ((sf ^ of) || ACCESS_FLAG(F_ZF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7f
+****************************************************************************/
+static void
+x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+ int sf, of;
+
+ /* jump to byte offset if sign flag equal to overflow flag.
+ and the zero flag is clear */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNLE\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+ of = ACCESS_FLAG(F_OF) != 0;
+ if ((sf == of) && !ACCESS_FLAG(F_ZF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+static u8(*opc80_byte_operation[]) (u8 d, u8 s) = {
+ add_byte, /* 00 */
+ or_byte, /* 01 */
+ adc_byte, /* 02 */
+ sbb_byte, /* 03 */
+ and_byte, /* 04 */
+ sub_byte, /* 05 */
+ xor_byte, /* 06 */
+ cmp_byte, /* 07 */
+};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x80
+****************************************************************************/
+static void
+x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 imm;
+ u8 destval;
+
+ /*
+ * Weirdo special case instruction format. Part of the opcode
+ * held below in "RH". Doubly nested case would result, except
+ * that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+static u16(*opc81_word_operation[]) (u16 d, u16 s) = {
+ add_word, /*00 */
+ or_word, /*01 */
+ adc_word, /*02 */
+ sbb_word, /*03 */
+ and_word, /*04 */
+ sub_word, /*05 */
+ xor_word, /*06 */
+ cmp_word, /*07 */
+};
+
+static u32(*opc81_long_operation[]) (u32 d, u32 s) = {
+ add_long, /*00 */
+ or_long, /*01 */
+ adc_long, /*02 */
+ sbb_long, /*03 */
+ and_long, /*04 */
+ sub_long, /*05 */
+ xor_long, /*06 */
+ cmp_long, /*07 */
+};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x81
+****************************************************************************/
+static void
+x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ /*
+ * Weirdo special case instruction format. Part of the opcode
+ * held below in "RH". Doubly nested case would result, except
+ * that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
+ }
+#endif
+ /*
+ * Know operation, decode the mod byte to find the addressing
+ * mode.
+ */
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 destval, imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ }
+ else {
+ u16 *destreg;
+ u16 destval, imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+static u8(*opc82_byte_operation[]) (u8 s, u8 d) = {
+ add_byte, /*00 */
+ or_byte, /*01 *//*YYY UNUSED ???? */
+ adc_byte, /*02 */
+ sbb_byte, /*03 */
+ and_byte, /*04 *//*YYY UNUSED ???? */
+ sub_byte, /*05 */
+ xor_byte, /*06 *//*YYY UNUSED ???? */
+ cmp_byte, /*07 */
+};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x82
+****************************************************************************/
+static void
+x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 imm;
+ u8 destval;
+
+ /*
+ * Weirdo special case instruction format. Part of the opcode
+ * held below in "RH". Doubly nested case would result, except
+ * that the decoded instruction Similar to opcode 81, except that
+ * the immediate byte is sign extended to a word length.
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+static u16(*opc83_word_operation[]) (u16 s, u16 d) = {
+ add_word, /*00 */
+ or_word, /*01 *//*YYY UNUSED ???? */
+ adc_word, /*02 */
+ sbb_word, /*03 */
+ and_word, /*04 *//*YYY UNUSED ???? */
+ sub_word, /*05 */
+ xor_word, /*06 *//*YYY UNUSED ???? */
+ cmp_word, /*07 */
+};
+
+static u32(*opc83_long_operation[]) (u32 s, u32 d) = {
+ add_long, /*00 */
+ or_long, /*01 *//*YYY UNUSED ???? */
+ adc_long, /*02 */
+ sbb_long, /*03 */
+ and_long, /*04 *//*YYY UNUSED ???? */
+ sub_long, /*05 */
+ xor_long, /*06 *//*YYY UNUSED ???? */
+ cmp_long, /*07 */
+};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x83
+****************************************************************************/
+static void
+x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ /*
+ * Weirdo special case instruction format. Part of the opcode
+ * held below in "RH". Doubly nested case would result, except
+ * that the decoded instruction Similar to opcode 81, except that
+ * the immediate byte is sign extended to a word length.
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ destval = fetch_data_long(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ destval = fetch_data_word(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ destval = fetch_data_long(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ destval = fetch_data_word(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ destval = fetch_data_long(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ destval = fetch_data_word(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 destval, imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ }
+ else {
+ u16 *destreg;
+ u16 destval, imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x84
+****************************************************************************/
+static void
+x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("TEST\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(destval, *srcreg);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(destval, *srcreg);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(destval, *srcreg);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x85
+****************************************************************************/
+static void
+x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("TEST\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(destval, *srcreg);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(destval, *srcreg);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+ }
+ else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(destval, *srcreg);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(*destreg, *srcreg);
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x86
+****************************************************************************/
+static void
+x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+ u8 tmp;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XCHG\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = *destreg;
+ *destreg = tmp;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x87
+****************************************************************************/
+static void
+x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XCHG\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 destval, tmp;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 *srcreg;
+ u16 destval, tmp;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 destval, tmp;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 *srcreg;
+ u16 destval, tmp;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 destval, tmp;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 *srcreg;
+ u16 destval, tmp;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+ u32 tmp;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = *destreg;
+ *destreg = tmp;
+ }
+ else {
+ u16 *destreg, *srcreg;
+ u16 tmp;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = *destreg;
+ *destreg = tmp;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x88
+****************************************************************************/
+static void
+x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, *srcreg);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, *srcreg);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, *srcreg);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x89
+****************************************************************************/
+static void
+x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u32 destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+ }
+ else {
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_word(destoffset, *srcreg);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+ }
+ else {
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_word(destoffset, *srcreg);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+ }
+ else {
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_word(destoffset, *srcreg);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8a
+****************************************************************************/
+static void
+x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8b
+****************************************************************************/
+static void
+x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ }
+ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8c
+****************************************************************************/
+static void
+x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u16 *destreg, *srcreg;
+ uint destoffset;
+ u16 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = *srcreg;
+ store_data_word(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = *srcreg;
+ store_data_word(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = *srcreg;
+ store_data_word(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8d
+****************************************************************************/
+static void
+x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LEA\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
+ u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
+
+ DECODE_PRINTF(",");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u32) destoffset;
+ }
+ else {
+ u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
+
+ DECODE_PRINTF(",");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u16) destoffset;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
+ u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
+
+ DECODE_PRINTF(",");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u32) destoffset;
+ }
+ else {
+ u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
+
+ DECODE_PRINTF(",");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u16) destoffset;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
+ u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
+
+ DECODE_PRINTF(",");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u32) destoffset;
+ }
+ else {
+ u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
+
+ DECODE_PRINTF(",");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u16) destoffset;
+ }
+ break;
+ case 3: /* register to register */
+ /* undefined. Do nothing. */
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8e
+****************************************************************************/
+static void
+x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u16 *destreg, *srcreg;
+ uint srcoffset;
+ u16 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 1:
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 2:
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 3: /* register to register */
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
+ }
+ /*
+ * Clean up, and reset all the R_xSP pointers to the correct
+ * locations. This is about 3x too much overhead (doing all the
+ * segreg ptrs when only one is needed, but this instruction
+ * *cannot* be that common, and this isn't too much work anyway.
+ */
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8f
+****************************************************************************/
+static void
+x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ if (rh != 0) {
+ DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n");
+ HALT_SYS();
+ }
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_word();
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_word();
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_word();
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = pop_long();
+ }
+ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = pop_word();
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x90
+****************************************************************************/
+static void
+x86emuOp_nop(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("NOP\n");
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x91
+****************************************************************************/
+static void
+x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,ECX\n");
+ }
+ else {
+ DECODE_PRINTF("XCHG\tAX,CX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ECX;
+ M.x86.R_ECX = tmp;
+ }
+ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_CX;
+ M.x86.R_CX = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x92
+****************************************************************************/
+static void
+x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EDX\n");
+ }
+ else {
+ DECODE_PRINTF("XCHG\tAX,DX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EDX;
+ M.x86.R_EDX = tmp;
+ }
+ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_DX;
+ M.x86.R_DX = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x93
+****************************************************************************/
+static void
+x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EBX\n");
+ }
+ else {
+ DECODE_PRINTF("XCHG\tAX,BX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EBX;
+ M.x86.R_EBX = tmp;
+ }
+ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_BX;
+ M.x86.R_BX = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x94
+****************************************************************************/
+static void
+x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,ESP\n");
+ }
+ else {
+ DECODE_PRINTF("XCHG\tAX,SP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ESP;
+ M.x86.R_ESP = tmp;
+ }
+ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_SP;
+ M.x86.R_SP = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x95
+****************************************************************************/
+static void
+x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EBP\n");
+ }
+ else {
+ DECODE_PRINTF("XCHG\tAX,BP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EBP;
+ M.x86.R_EBP = tmp;
+ }
+ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_BP;
+ M.x86.R_BP = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x96
+****************************************************************************/
+static void
+x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,ESI\n");
+ }
+ else {
+ DECODE_PRINTF("XCHG\tAX,SI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ESI;
+ M.x86.R_ESI = tmp;
+ }
+ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_SI;
+ M.x86.R_SI = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x97
+****************************************************************************/
+static void
+x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EDI\n");
+ }
+ else {
+ DECODE_PRINTF("XCHG\tAX,DI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EDI;
+ M.x86.R_EDI = tmp;
+ }
+ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_DI;
+ M.x86.R_DI = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x98
+****************************************************************************/
+static void
+x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CWDE\n");
+ }
+ else {
+ DECODE_PRINTF("CBW\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ if (M.x86.R_AX & 0x8000) {
+ M.x86.R_EAX |= 0xffff0000;
+ }
+ else {
+ M.x86.R_EAX &= 0x0000ffff;
+ }
+ }
+ else {
+ if (M.x86.R_AL & 0x80) {
+ M.x86.R_AH = 0xff;
+ }
+ else {
+ M.x86.R_AH = 0x0;
+ }
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x99
+****************************************************************************/
+static void
+x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CDQ\n");
+ }
+ else {
+ DECODE_PRINTF("CWD\n");
+ }
+ DECODE_PRINTF("CWD\n");
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ if (M.x86.R_EAX & 0x80000000) {
+ M.x86.R_EDX = 0xffffffff;
+ }
+ else {
+ M.x86.R_EDX = 0x0;
+ }
+ }
+ else {
+ if (M.x86.R_AX & 0x8000) {
+ M.x86.R_DX = 0xffff;
+ }
+ else {
+ M.x86.R_DX = 0x0;
+ }
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9a
+****************************************************************************/
+static void
+x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 farseg, faroff;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CALL\t");
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ faroff = fetch_long_imm();
+ farseg = fetch_word_imm();
+ }
+ else {
+ faroff = fetch_word_imm();
+ farseg = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%04x:", farseg);
+ DECODE_PRINTF2("%04x\n", faroff);
+ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, farseg, faroff, "FAR ");
+
+ /* XXX
+ *
+ * Hooked interrupt vectors calling into our "BIOS" will cause
+ * problems unless all intersegment stuff is checked for BIOS
+ * access. Check needed here. For moment, let it alone.
+ */
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = farseg;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EIP);
+ }
+ else {
+ push_word(M.x86.R_IP);
+ }
+ M.x86.R_EIP = faroff & 0xffff;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9b
+****************************************************************************/
+static void
+x86emuOp_wait(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("WAIT");
+ TRACE_AND_STEP();
+ /* NADA. */
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9c
+****************************************************************************/
+static void
+x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
+{
+ u32 flags;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSHFD\n");
+ }
+ else {
+ DECODE_PRINTF("PUSHF\n");
+ }
+ TRACE_AND_STEP();
+
+ /* clear out *all* bits not representing flags, and turn on real bits */
+ flags = (M.x86.R_EFLG & F_MSK) | F_ALWAYS_ON;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(flags);
+ }
+ else {
+ push_word((u16) flags);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9d
+****************************************************************************/
+static void
+x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POPFD\n");
+ }
+ else {
+ DECODE_PRINTF("POPF\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EFLG = pop_long();
+ }
+ else {
+ M.x86.R_FLG = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9e
+****************************************************************************/
+static void
+x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("SAHF\n");
+ TRACE_AND_STEP();
+ /* clear the lower bits of the flag register */
+ M.x86.R_FLG &= 0xffffff00;
+ /* or in the AH register into the flags register */
+ M.x86.R_FLG |= M.x86.R_AH;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9f
+****************************************************************************/
+static void
+x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("LAHF\n");
+ TRACE_AND_STEP();
+ M.x86.R_AH = (u8) (M.x86.R_FLG & 0xff);
+ /*undocumented TC++ behavior??? Nope. It's documented, but
+ you have too look real hard to notice it. */
+ M.x86.R_AH |= 0x2;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa0
+****************************************************************************/
+static void
+x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 offset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tAL,");
+ offset = fetch_word_imm();
+ DECODE_PRINTF2("[%04x]\n", offset);
+ TRACE_AND_STEP();
+ M.x86.R_AL = fetch_data_byte(offset);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa1
+****************************************************************************/
+static void
+x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 offset;
+
+ START_OF_INSTR();
+ offset = fetch_word_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("MOV\tEAX,[%04x]\n", offset);
+ }
+ else {
+ DECODE_PRINTF2("MOV\tAX,[%04x]\n", offset);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = fetch_data_long(offset);
+ }
+ else {
+ M.x86.R_AX = fetch_data_word(offset);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa2
+****************************************************************************/
+static void
+x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 offset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ offset = fetch_word_imm();
+ DECODE_PRINTF2("[%04x],AL\n", offset);
+ TRACE_AND_STEP();
+ store_data_byte(offset, M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa3
+****************************************************************************/
+static void
+x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 offset;
+
+ START_OF_INSTR();
+ offset = fetch_word_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("MOV\t[%04x],EAX\n", offset);
+ }
+ else {
+ DECODE_PRINTF2("MOV\t[%04x],AX\n", offset);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ store_data_long(offset, M.x86.R_EAX);
+ }
+ else {
+ store_data_word(offset, M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa4
+****************************************************************************/
+static void
+x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
+{
+ u8 val;
+ u32 count;
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOVS\tBYTE\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+ TRACE_AND_STEP();
+ count = 1;
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ while (count--) {
+ val = fetch_data_byte(M.x86.R_SI);
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, val);
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa5
+****************************************************************************/
+static void
+x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
+{
+ u32 val;
+ int inc;
+ u32 count;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOVS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+ }
+ else {
+ DECODE_PRINTF("MOVS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+ }
+ TRACE_AND_STEP();
+ count = 1;
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ while (count--) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long(M.x86.R_SI);
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI, val);
+ }
+ else {
+ val = fetch_data_word(M.x86.R_SI);
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16) val);
+ }
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa6
+****************************************************************************/
+static void
+x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
+{
+ s8 val1, val2;
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMPS\tBYTE\n");
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+
+ if (M.x86.mode & SYSMODE_PREFIX_REPE) {
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(val1, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ }
+ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(val1, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ }
+ else {
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(val1, val2);
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa7
+****************************************************************************/
+static void
+x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
+{
+ u32 val1, val2;
+ int inc;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CMPS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+ }
+ else {
+ DECODE_PRINTF("CMPS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_REPE) {
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+ }
+ else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word((u16) val1, (u16) val2);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ }
+ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+ }
+ else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word((u16) val1, (u16) val2);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ }
+ else {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+ }
+ else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word((u16) val1, (u16) val2);
+ }
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa8
+****************************************************************************/
+static void
+x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("TEST\tAL,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%04x\n", imm);
+ TRACE_AND_STEP();
+ test_byte(M.x86.R_AL, (u8) imm);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa9
+****************************************************************************/
+static void
+x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("TEST\tEAX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("TEST\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ test_long(M.x86.R_EAX, srcval);
+ }
+ else {
+ test_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xaa
+****************************************************************************/
+static void
+x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
+{
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("STOS\tBYTE\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+ TRACE_AND_STEP();
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ }
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ else {
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xab
+****************************************************************************/
+static void
+x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
+{
+ int inc;
+ u32 count;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("STOS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+ }
+ else {
+ DECODE_PRINTF("STOS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+ }
+ TRACE_AND_STEP();
+ count = 1;
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ while (count--) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_EAX);
+ }
+ else {
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AX);
+ }
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xac
+****************************************************************************/
+static void
+x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
+{
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LODS\tBYTE\n");
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ }
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ else {
+ M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
+ M.x86.R_SI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xad
+****************************************************************************/
+static void
+x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
+{
+ int inc;
+ u32 count;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("LODS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+ }
+ else {
+ DECODE_PRINTF("LODS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+ }
+ TRACE_AND_STEP();
+ count = 1;
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ while (count--) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = fetch_data_long(M.x86.R_SI);
+ }
+ else {
+ M.x86.R_AX = fetch_data_word(M.x86.R_SI);
+ }
+ M.x86.R_SI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xae
+****************************************************************************/
+static void
+x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
+{
+ s8 val2;
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SCAS\tBYTE\n");
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+ if (M.x86.mode & SYSMODE_PREFIX_REPE) {
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(M.x86.R_AL, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ }
+ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(M.x86.R_AL, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ }
+ else {
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(M.x86.R_AL, val2);
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xaf
+****************************************************************************/
+static void
+x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
+{
+ int inc;
+ u32 val;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("SCAS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+ }
+ else {
+ DECODE_PRINTF("SCAS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_REPE) {
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+ }
+ else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word(M.x86.R_AX, (u16) val);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ }
+ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+ }
+ else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word(M.x86.R_AX, (u16) val);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ }
+ else {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+ }
+ else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word(M.x86.R_AX, (u16) val);
+ }
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb0
+****************************************************************************/
+static void
+x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tAL,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_AL = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb1
+****************************************************************************/
+static void
+x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tCL,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_CL = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb2
+****************************************************************************/
+static void
+x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tDL,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_DL = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb3
+****************************************************************************/
+static void
+x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tBL,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_BL = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb4
+****************************************************************************/
+static void
+x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tAH,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_AH = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb5
+****************************************************************************/
+static void
+x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tCH,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_CH = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb6
+****************************************************************************/
+static void
+x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tDH,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_DH = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb7
+****************************************************************************/
+static void
+x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tBH,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_BH = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb8
+****************************************************************************/
+static void
+x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEAX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("MOV\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = srcval;
+ }
+ else {
+ M.x86.R_AX = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb9
+****************************************************************************/
+static void
+x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tECX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("MOV\tCX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = srcval;
+ }
+ else {
+ M.x86.R_CX = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xba
+****************************************************************************/
+static void
+x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEDX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("MOV\tDX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = srcval;
+ }
+ else {
+ M.x86.R_DX = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xbb
+****************************************************************************/
+static void
+x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEBX,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("MOV\tBX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = srcval;
+ }
+ else {
+ M.x86.R_BX = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xbc
+****************************************************************************/
+static void
+x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tESP,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("MOV\tSP,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = srcval;
+ }
+ else {
+ M.x86.R_SP = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xbd
+****************************************************************************/
+static void
+x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEBP,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("MOV\tBP,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = srcval;
+ }
+ else {
+ M.x86.R_BP = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xbe
+****************************************************************************/
+static void
+x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tESI,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("MOV\tSI,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = srcval;
+ }
+ else {
+ M.x86.R_SI = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xbf
+****************************************************************************/
+static void
+x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEDI,");
+ srcval = fetch_long_imm();
+ }
+ else {
+ DECODE_PRINTF("MOV\tDI,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = srcval;
+ }
+ else {
+ M.x86.R_DI = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/* used by opcodes c0, d0, and d2. */
+static u8(*opcD0_byte_operation[]) (u8 d, u8 s) = {
+ rol_byte, ror_byte, rcl_byte, rcr_byte, shl_byte, shr_byte, shl_byte, /* sal_byte === shl_byte by definition */
+sar_byte,};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc0
+****************************************************************************/
+static void
+x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 destval;
+ u8 amt;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (*destreg, amt);
+ *destreg = destval;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/* used by opcodes c1, d1, and d3. */
+static u16(*opcD1_word_operation[]) (u16 s, u8 d) = {
+ rol_word, ror_word, rcl_word, rcr_word, shl_word, shr_word, shl_word, /* sal_byte === shl_byte by definition */
+sar_word,};
+
+/* used by opcodes c1, d1, and d3. */
+static u32(*opcD1_long_operation[]) (u32 s, u8 d) = {
+ rol_long, ror_long, rcl_long, rcr_long, shl_long, shr_long, shl_long, /* sal_byte === shl_byte by definition */
+sar_long,};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc1
+****************************************************************************/
+static void
+x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 amt;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
+ }
+ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_word_operation[rh]) (*destreg, amt);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc2
+****************************************************************************/
+static void
+x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("RET\t");
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ RETURN_TRACE("RET", M.x86.saved_cs, M.x86.saved_ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ M.x86.R_SP += imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc3
+****************************************************************************/
+static void
+x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("RET\n");
+ RETURN_TRACE("RET", M.x86.saved_cs, M.x86.saved_ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc4
+****************************************************************************/
+static void
+x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rh, rl;
+ u16 *dstreg;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LES\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_ES = fetch_data_word(srcoffset + 2);
+ break;
+ case 1:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_ES = fetch_data_word(srcoffset + 2);
+ break;
+ case 2:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_ES = fetch_data_word(srcoffset + 2);
+ break;
+ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc5
+****************************************************************************/
+static void
+x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rh, rl;
+ u16 *dstreg;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LDS\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_DS = fetch_data_word(srcoffset + 2);
+ break;
+ case 1:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_DS = fetch_data_word(srcoffset + 2);
+ break;
+ case 2:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_DS = fetch_data_word(srcoffset + 2);
+ break;
+ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc6
+****************************************************************************/
+static void
+x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ if (rh != 0) {
+ DECODE_PRINTF("ILLEGAL DECODE OF OPCODE c6\n");
+ HALT_SYS();
+ }
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, imm);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, imm);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, imm);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ *destreg = imm;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc7
+****************************************************************************/
+static void
+x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ if (rh != 0) {
+ DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n");
+ HALT_SYS();
+ }
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+ }
+ else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_word(destoffset, imm);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+ }
+ else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_word(destoffset, imm);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+ }
+ else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_word(destoffset, imm);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ *destreg = imm;
+ }
+ else {
+ u16 *destreg;
+ u16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ *destreg = imm;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc8
+****************************************************************************/
+static void
+x86emuOp_enter(u8 X86EMU_UNUSED(op1))
+{
+ u16 local, frame_pointer;
+ u8 nesting;
+ int i;
+
+ START_OF_INSTR();
+ local = fetch_word_imm();
+ nesting = fetch_byte_imm();
+ DECODE_PRINTF2("ENTER %x\n", local);
+ DECODE_PRINTF2(",%x\n", nesting);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_BP);
+ frame_pointer = M.x86.R_SP;
+ if (nesting > 0) {
+ for (i = 1; i < nesting; i++) {
+ M.x86.R_BP -= 2;
+ push_word(fetch_data_word_abs(M.x86.R_SS, M.x86.R_BP));
+ }
+ push_word(frame_pointer);
+ }
+ M.x86.R_BP = frame_pointer;
+ M.x86.R_SP = (u16) (M.x86.R_SP - local);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc9
+****************************************************************************/
+static void
+x86emuOp_leave(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("LEAVE\n");
+ TRACE_AND_STEP();
+ M.x86.R_SP = M.x86.R_BP;
+ M.x86.R_BP = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xca
+****************************************************************************/
+static void
+x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("RETF\t");
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ RETURN_TRACE("RETF", M.x86.saved_cs, M.x86.saved_ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ M.x86.R_CS = pop_word();
+ M.x86.R_SP += imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xcb
+****************************************************************************/
+static void
+x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("RETF\n");
+ RETURN_TRACE("RETF", M.x86.saved_cs, M.x86.saved_ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ M.x86.R_CS = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xcc
+****************************************************************************/
+static void
+x86emuOp_int3(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("INT 3\n");
+ TRACE_AND_STEP();
+ if (_X86EMU_intrTab[3]) {
+ (*_X86EMU_intrTab[3]) (3);
+ }
+ else {
+ push_word((u16) M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(3 * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(3 * 4);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xcd
+****************************************************************************/
+static void
+x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 intnum;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("INT\t");
+ intnum = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", intnum);
+ TRACE_AND_STEP();
+ if (_X86EMU_intrTab[intnum]) {
+ (*_X86EMU_intrTab[intnum]) (intnum);
+ }
+ else {
+ push_word((u16) M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(intnum * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(intnum * 4);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xce
+****************************************************************************/
+static void
+x86emuOp_into(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("INTO\n");
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_OF)) {
+ if (_X86EMU_intrTab[4]) {
+ (*_X86EMU_intrTab[4]) (4);
+ }
+ else {
+ push_word((u16) M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(4 * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(4 * 4);
+ }
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xcf
+****************************************************************************/
+static void
+x86emuOp_iret(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("IRET\n");
+
+ TRACE_AND_STEP();
+
+ M.x86.R_IP = pop_word();
+ M.x86.R_CS = pop_word();
+ M.x86.R_FLG = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd0
+****************************************************************************/
+static void
+x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 destval;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, 1);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, 1);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, 1);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (*destreg, 1);
+ *destreg = destval;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd1
+****************************************************************************/
+static void
+x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, 1);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, 1);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, 1);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (*destreg, 1);
+ *destreg = destval;
+ }
+ else {
+ u16 destval;
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (*destreg, 1);
+ *destreg = destval;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd2
+****************************************************************************/
+static void
+x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 destval;
+ u8 amt;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ amt = M.x86.R_CL;
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (*destreg, amt);
+ *destreg = destval;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd3
+****************************************************************************/
+static void
+x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 amt;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ amt = M.x86.R_CL;
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
+ }
+ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_word_operation[rh]) (*destreg, amt);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd4
+****************************************************************************/
+static void
+x86emuOp_aam(u8 X86EMU_UNUSED(op1))
+{
+ u8 a;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AAM\n");
+ a = fetch_byte_imm(); /* this is a stupid encoding. */
+ if (a != 10) {
+ /* fix: add base decoding
+ aam_word(u8 val, int base a) */
+ DECODE_PRINTF("ERROR DECODING AAM\n");
+ TRACE_REGS();
+ HALT_SYS();
+ }
+ TRACE_AND_STEP();
+ /* note the type change here --- returning AL and AH in AX. */
+ M.x86.R_AX = aam_word(M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd5
+****************************************************************************/
+static void
+x86emuOp_aad(u8 X86EMU_UNUSED(op1))
+{
+ u8 a;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AAD\n");
+ a = fetch_byte_imm();
+ if (a != 10) {
+ /* fix: add base decoding
+ aad_word(u16 val, int base a) */
+ DECODE_PRINTF("ERROR DECODING AAM\n");
+ TRACE_REGS();
+ HALT_SYS();
+ }
+ TRACE_AND_STEP();
+ M.x86.R_AX = aad_word(M.x86.R_AX);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/* opcode 0xd6 ILLEGAL OPCODE */
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd7
+****************************************************************************/
+static void
+x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
+{
+ u16 addr;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XLAT\n");
+ TRACE_AND_STEP();
+ addr = (u16) (M.x86.R_BX + (u8) M.x86.R_AL);
+ M.x86.R_AL = fetch_data_byte(addr);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/* instuctions D8 .. DF are in i87_ops.c */
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe0
+****************************************************************************/
+static void
+x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
+{
+ s16 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LOOPNE\t");
+ ip = (s8) fetch_byte_imm();
+ ip += (s16) M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+ M.x86.R_CX -= 1;
+ if (M.x86.R_CX != 0 && !ACCESS_FLAG(F_ZF)) /* CX != 0 and !ZF */
+ M.x86.R_IP = ip;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe1
+****************************************************************************/
+static void
+x86emuOp_loope(u8 X86EMU_UNUSED(op1))
+{
+ s16 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LOOPE\t");
+ ip = (s8) fetch_byte_imm();
+ ip += (s16) M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+ M.x86.R_CX -= 1;
+ if (M.x86.R_CX != 0 && ACCESS_FLAG(F_ZF)) /* CX != 0 and ZF */
+ M.x86.R_IP = ip;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe2
+****************************************************************************/
+static void
+x86emuOp_loop(u8 X86EMU_UNUSED(op1))
+{
+ s16 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LOOP\t");
+ ip = (s8) fetch_byte_imm();
+ ip += (s16) M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+ M.x86.R_CX -= 1;
+ if (M.x86.R_CX != 0)
+ M.x86.R_IP = ip;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe3
+****************************************************************************/
+static void
+x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
+{
+ u16 target;
+ s8 offset;
+
+ /* jump to byte offset if overflow flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JCXZ\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (M.x86.R_CX == 0)
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe4
+****************************************************************************/
+static void
+x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IN\t");
+ port = (u8) fetch_byte_imm();
+ DECODE_PRINTF2("%x,AL\n", port);
+ TRACE_AND_STEP();
+ M.x86.R_AL = (*sys_inb) (port);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe5
+****************************************************************************/
+static void
+x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IN\t");
+ port = (u8) fetch_byte_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("EAX,%x\n", port);
+ }
+ else {
+ DECODE_PRINTF2("AX,%x\n", port);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = (*sys_inl) (port);
+ }
+ else {
+ M.x86.R_AX = (*sys_inw) (port);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe6
+****************************************************************************/
+static void
+x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
+{
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OUT\t");
+ port = (u8) fetch_byte_imm();
+ DECODE_PRINTF2("%x,AL\n", port);
+ TRACE_AND_STEP();
+ (*sys_outb) (port, M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe7
+****************************************************************************/
+static void
+x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
+{
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OUT\t");
+ port = (u8) fetch_byte_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("%x,EAX\n", port);
+ }
+ else {
+ DECODE_PRINTF2("%x,AX\n", port);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ (*sys_outl) (port, M.x86.R_EAX);
+ }
+ else {
+ (*sys_outw) (port, M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe8
+****************************************************************************/
+static void
+x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
+{
+ s16 ip16;
+ s32 ip32;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CALL\t");
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ ip32 = (s32) fetch_long_imm();
+ ip32 += (s16) M.x86.R_IP; /* CHECK SIGN */
+ DECODE_PRINTF2("%04x\n", (u16) ip32);
+ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip32, "");
+ }
+ else {
+ ip16 = (s16) fetch_word_imm();
+ ip16 += (s16) M.x86.R_IP; /* CHECK SIGN */
+ DECODE_PRINTF2("%04x\n", (u16) ip16);
+ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip16, "");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EIP);
+ M.x86.R_EIP = ip32 & 0xffff;
+ }
+ else {
+ push_word(M.x86.R_IP);
+ M.x86.R_EIP = ip16;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe9
+****************************************************************************/
+static void
+x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("JMP\t");
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ ip = (u32) fetch_long_imm();
+ ip += (u32) M.x86.R_EIP;
+ DECODE_PRINTF2("%08x\n", (u32) ip);
+ TRACE_AND_STEP();
+ M.x86.R_EIP = (u32) ip;
+ }
+ else {
+ ip = (s16) fetch_word_imm();
+ ip += (s16) M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", (u16) ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = (u16) ip;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xea
+****************************************************************************/
+static void
+x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 cs;
+ u32 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("JMP\tFAR ");
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ ip = fetch_long_imm();
+ }
+ else {
+ ip = fetch_word_imm();
+ }
+ cs = fetch_word_imm();
+ DECODE_PRINTF2("%04x:", cs);
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+ M.x86.R_EIP = ip & 0xffff;
+ M.x86.R_CS = cs;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xeb
+****************************************************************************/
+static void
+x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 target;
+ s8 offset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("JMP\t");
+ offset = (s8) fetch_byte_imm();
+ target = (u16) (M.x86.R_IP + offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xec
+****************************************************************************/
+static void
+x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("IN\tAL,DX\n");
+ TRACE_AND_STEP();
+ M.x86.R_AL = (*sys_inb) (M.x86.R_DX);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xed
+****************************************************************************/
+static void
+x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("IN\tEAX,DX\n");
+ }
+ else {
+ DECODE_PRINTF("IN\tAX,DX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = (*sys_inl) (M.x86.R_DX);
+ }
+ else {
+ M.x86.R_AX = (*sys_inw) (M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xee
+****************************************************************************/
+static void
+x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("OUT\tDX,AL\n");
+ TRACE_AND_STEP();
+ (*sys_outb) (M.x86.R_DX, M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xef
+****************************************************************************/
+static void
+x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("OUT\tDX,EAX\n");
+ }
+ else {
+ DECODE_PRINTF("OUT\tDX,AX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ (*sys_outl) (M.x86.R_DX, M.x86.R_EAX);
+ }
+ else {
+ (*sys_outw) (M.x86.R_DX, M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf0
+****************************************************************************/
+static void
+x86emuOp_lock(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("LOCK:\n");
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/*opcode 0xf1 ILLEGAL OPERATION */
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf2
+****************************************************************************/
+static void
+x86emuOp_repne(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("REPNE\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_PREFIX_REPNE;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf3
+****************************************************************************/
+static void
+x86emuOp_repe(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("REPE\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_PREFIX_REPE;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf4
+****************************************************************************/
+static void
+x86emuOp_halt(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("HALT\n");
+ TRACE_AND_STEP();
+ HALT_SYS();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf5
+****************************************************************************/
+static void
+x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
+{
+ /* complement the carry flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("CMC\n");
+ TRACE_AND_STEP();
+ TOGGLE_FLAG(F_CF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf6
+****************************************************************************/
+static void
+x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 destval, srcval;
+
+ /* long, drawn out code follows. Double switch for a total
+ of 32 cases. */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0: /* mod=00 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ test_byte(destval, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = not_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ mul_byte(destval);
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ imul_byte(destval);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ div_byte(destval);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ idiv_byte(destval);
+ break;
+ }
+ break; /* end mod==00 */
+ case 1: /* mod=01 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ test_byte(destval, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = not_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ mul_byte(destval);
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ imul_byte(destval);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ div_byte(destval);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ idiv_byte(destval);
+ break;
+ }
+ break; /* end mod==01 */
+ case 2: /* mod=10 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ test_byte(destval, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = not_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ mul_byte(destval);
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ imul_byte(destval);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ div_byte(destval);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ idiv_byte(destval);
+ break;
+ }
+ break; /* end mod==10 */
+ case 3: /* mod=11 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ TRACE_AND_STEP();
+ test_byte(*destreg, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = not_byte(*destreg);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = neg_byte(*destreg);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ mul_byte(*destreg); /*!!! */
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ imul_byte(*destreg);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ div_byte(*destreg);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ idiv_byte(*destreg);
+ break;
+ }
+ break; /* end mod==11 */
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf7
+****************************************************************************/
+static void
+x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ /* long, drawn out code follows. Double switch for a total
+ of 32 cases. */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0: /* mod=00 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval, srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+ }
+ else {
+ u16 destval, srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ test_word(destval, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F7\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NOT\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = not_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NEG\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("MUL\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ mul_word(destval);
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IMUL\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ imul_word(destval);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DIV\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ div_word(destval);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IDIV\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ idiv_word(destval);
+ }
+ break;
+ }
+ break; /* end mod==00 */
+ case 1: /* mod=01 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval, srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+ }
+ else {
+ u16 destval, srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ test_word(destval, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NOT\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = not_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NEG\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("MUL\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ mul_word(destval);
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IMUL\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ imul_word(destval);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DIV\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ div_word(destval);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IDIV\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ idiv_word(destval);
+ }
+ break;
+ }
+ break; /* end mod==01 */
+ case 2: /* mod=10 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval, srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+ }
+ else {
+ u16 destval, srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ test_word(destval, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NOT\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = not_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NEG\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("MUL\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ mul_word(destval);
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IMUL\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ imul_word(destval);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DIV\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ div_word(destval);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IDIV\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+ }
+ else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ idiv_word(destval);
+ }
+ break;
+ }
+ break; /* end mod==10 */
+ case 3: /* mod=11 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ DECODE_PRINTF("TEST\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ test_long(*destreg, srcval);
+ }
+ else {
+ u16 *destreg;
+ u16 srcval;
+
+ DECODE_PRINTF("TEST\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ test_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("NOT\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = not_long(*destreg);
+ }
+ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("NOT\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = not_word(*destreg);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("NEG\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = neg_long(*destreg);
+ }
+ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("NEG\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = neg_word(*destreg);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("MUL\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ mul_long(*destreg); /*!!! */
+ }
+ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("MUL\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ mul_word(*destreg); /*!!! */
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("IMUL\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ imul_long(*destreg);
+ }
+ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("IMUL\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ imul_word(*destreg);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("DIV\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ div_long(*destreg);
+ }
+ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("DIV\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ div_word(*destreg);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("IDIV\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ idiv_long(*destreg);
+ }
+ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("IDIV\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ idiv_word(*destreg);
+ }
+ break;
+ }
+ break; /* end mod==11 */
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf8
+****************************************************************************/
+static void
+x86emuOp_clc(u8 X86EMU_UNUSED(op1))
+{
+ /* clear the carry flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("CLC\n");
+ TRACE_AND_STEP();
+ CLEAR_FLAG(F_CF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf9
+****************************************************************************/
+static void
+x86emuOp_stc(u8 X86EMU_UNUSED(op1))
+{
+ /* set the carry flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("STC\n");
+ TRACE_AND_STEP();
+ SET_FLAG(F_CF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xfa
+****************************************************************************/
+static void
+x86emuOp_cli(u8 X86EMU_UNUSED(op1))
+{
+ /* clear interrupts. */
+ START_OF_INSTR();
+ DECODE_PRINTF("CLI\n");
+ TRACE_AND_STEP();
+ CLEAR_FLAG(F_IF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xfb
+****************************************************************************/
+static void
+x86emuOp_sti(u8 X86EMU_UNUSED(op1))
+{
+ /* enable interrupts. */
+ START_OF_INSTR();
+ DECODE_PRINTF("STI\n");
+ TRACE_AND_STEP();
+ SET_FLAG(F_IF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xfc
+****************************************************************************/
+static void
+x86emuOp_cld(u8 X86EMU_UNUSED(op1))
+{
+ /* clear interrupts. */
+ START_OF_INSTR();
+ DECODE_PRINTF("CLD\n");
+ TRACE_AND_STEP();
+ CLEAR_FLAG(F_DF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xfd
+****************************************************************************/
+static void
+x86emuOp_std(u8 X86EMU_UNUSED(op1))
+{
+ /* clear interrupts. */
+ START_OF_INSTR();
+ DECODE_PRINTF("STD\n");
+ TRACE_AND_STEP();
+ SET_FLAG(F_DF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xfe
+****************************************************************************/
+static void
+x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rh, rl;
+ u8 destval;
+ uint destoffset;
+ u8 *destreg;
+
+ /* Yet another special case instruction. */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("INC\t");
+ break;
+ case 1:
+ DECODE_PRINTF("DEC\t");
+ break;
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ DECODE_PRINTF2("ILLEGAL OP MAJOR OP 0xFE MINOR OP %x \n", mod);
+ HALT_SYS();
+ break;
+ }
+ }
+#endif
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0: /* inc word ptr ... */
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1: /* dec word ptr ... */
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ }
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ }
+ break;
+ case 3:
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ TRACE_AND_STEP();
+ *destreg = inc_byte(*destreg);
+ break;
+ case 1:
+ TRACE_AND_STEP();
+ *destreg = dec_byte(*destreg);
+ break;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xff
+****************************************************************************/
+static void
+x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rh, rl;
+ uint destoffset = 0;
+ u16 *destreg;
+ u16 destval, destval2;
+
+ /* Yet another special case instruction. */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tDWORD PTR ");
+ }
+ else {
+ DECODE_PRINTF("INC\tWORD PTR ");
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tDWORD PTR ");
+ }
+ else {
+ DECODE_PRINTF("DEC\tWORD PTR ");
+ }
+ break;
+ case 2:
+ DECODE_PRINTF("CALL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("CALL\tFAR ");
+ break;
+ case 4:
+ DECODE_PRINTF("JMP\t");
+ break;
+ case 5:
+ DECODE_PRINTF("JMP\tFAR ");
+ break;
+ case 6:
+ DECODE_PRINTF("PUSH\t");
+ break;
+ case 7:
+ DECODE_PRINTF("ILLEGAL DECODING OF OPCODE FF\t");
+ HALT_SYS();
+ break;
+ }
+ }
+#endif
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0: /* inc word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1: /* dec word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = destval2;
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+ }
+ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(destval);
+ }
+ break;
+ }
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = destval2;
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+ }
+ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(destval);
+ }
+ break;
+ }
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+ }
+ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = destval2;
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+ }
+ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(destval);
+ }
+ break;
+ }
+ break;
+ case 3:
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = inc_long(*destreg);
+ }
+ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = inc_word(*destreg);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = dec_long(*destreg);
+ }
+ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = dec_word(*destreg);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = *destreg;
+ break;
+ case 3: /* jmp far ptr ... */
+ DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
+ TRACE_AND_STEP();
+ HALT_SYS();
+ break;
+
+ case 4: /* jmp ... */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ M.x86.R_IP = (u16) (*destreg);
+ break;
+ case 5: /* jmp far ptr ... */
+ DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
+ TRACE_AND_STEP();
+ HALT_SYS();
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_long(*destreg);
+ }
+ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_word(*destreg);
+ }
+ break;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/***************************************************************************
+ * Single byte operation code table:
+ **************************************************************************/
+void (*x86emu_optab[256]) (u8) = {
+/* 0x00 */ x86emuOp_add_byte_RM_R,
+/* 0x01 */ x86emuOp_add_word_RM_R,
+/* 0x02 */ x86emuOp_add_byte_R_RM,
+/* 0x03 */ x86emuOp_add_word_R_RM,
+/* 0x04 */ x86emuOp_add_byte_AL_IMM,
+/* 0x05 */ x86emuOp_add_word_AX_IMM,
+/* 0x06 */ x86emuOp_push_ES,
+/* 0x07 */ x86emuOp_pop_ES,
+/* 0x08 */ x86emuOp_or_byte_RM_R,
+/* 0x09 */ x86emuOp_or_word_RM_R,
+/* 0x0a */ x86emuOp_or_byte_R_RM,
+/* 0x0b */ x86emuOp_or_word_R_RM,
+/* 0x0c */ x86emuOp_or_byte_AL_IMM,
+/* 0x0d */ x86emuOp_or_word_AX_IMM,
+/* 0x0e */ x86emuOp_push_CS,
+/* 0x0f */ x86emuOp_two_byte,
+/* 0x10 */ x86emuOp_adc_byte_RM_R,
+/* 0x11 */ x86emuOp_adc_word_RM_R,
+/* 0x12 */ x86emuOp_adc_byte_R_RM,
+/* 0x13 */ x86emuOp_adc_word_R_RM,
+/* 0x14 */ x86emuOp_adc_byte_AL_IMM,
+/* 0x15 */ x86emuOp_adc_word_AX_IMM,
+/* 0x16 */ x86emuOp_push_SS,
+/* 0x17 */ x86emuOp_pop_SS,
+/* 0x18 */ x86emuOp_sbb_byte_RM_R,
+/* 0x19 */ x86emuOp_sbb_word_RM_R,
+/* 0x1a */ x86emuOp_sbb_byte_R_RM,
+/* 0x1b */ x86emuOp_sbb_word_R_RM,
+/* 0x1c */ x86emuOp_sbb_byte_AL_IMM,
+/* 0x1d */ x86emuOp_sbb_word_AX_IMM,
+/* 0x1e */ x86emuOp_push_DS,
+/* 0x1f */ x86emuOp_pop_DS,
+/* 0x20 */ x86emuOp_and_byte_RM_R,
+/* 0x21 */ x86emuOp_and_word_RM_R,
+/* 0x22 */ x86emuOp_and_byte_R_RM,
+/* 0x23 */ x86emuOp_and_word_R_RM,
+/* 0x24 */ x86emuOp_and_byte_AL_IMM,
+/* 0x25 */ x86emuOp_and_word_AX_IMM,
+/* 0x26 */ x86emuOp_segovr_ES,
+/* 0x27 */ x86emuOp_daa,
+/* 0x28 */ x86emuOp_sub_byte_RM_R,
+/* 0x29 */ x86emuOp_sub_word_RM_R,
+/* 0x2a */ x86emuOp_sub_byte_R_RM,
+/* 0x2b */ x86emuOp_sub_word_R_RM,
+/* 0x2c */ x86emuOp_sub_byte_AL_IMM,
+/* 0x2d */ x86emuOp_sub_word_AX_IMM,
+/* 0x2e */ x86emuOp_segovr_CS,
+/* 0x2f */ x86emuOp_das,
+/* 0x30 */ x86emuOp_xor_byte_RM_R,
+/* 0x31 */ x86emuOp_xor_word_RM_R,
+/* 0x32 */ x86emuOp_xor_byte_R_RM,
+/* 0x33 */ x86emuOp_xor_word_R_RM,
+/* 0x34 */ x86emuOp_xor_byte_AL_IMM,
+/* 0x35 */ x86emuOp_xor_word_AX_IMM,
+/* 0x36 */ x86emuOp_segovr_SS,
+/* 0x37 */ x86emuOp_aaa,
+/* 0x38 */ x86emuOp_cmp_byte_RM_R,
+/* 0x39 */ x86emuOp_cmp_word_RM_R,
+/* 0x3a */ x86emuOp_cmp_byte_R_RM,
+/* 0x3b */ x86emuOp_cmp_word_R_RM,
+/* 0x3c */ x86emuOp_cmp_byte_AL_IMM,
+/* 0x3d */ x86emuOp_cmp_word_AX_IMM,
+/* 0x3e */ x86emuOp_segovr_DS,
+/* 0x3f */ x86emuOp_aas,
+/* 0x40 */ x86emuOp_inc_AX,
+/* 0x41 */ x86emuOp_inc_CX,
+/* 0x42 */ x86emuOp_inc_DX,
+/* 0x43 */ x86emuOp_inc_BX,
+/* 0x44 */ x86emuOp_inc_SP,
+/* 0x45 */ x86emuOp_inc_BP,
+/* 0x46 */ x86emuOp_inc_SI,
+/* 0x47 */ x86emuOp_inc_DI,
+/* 0x48 */ x86emuOp_dec_AX,
+/* 0x49 */ x86emuOp_dec_CX,
+/* 0x4a */ x86emuOp_dec_DX,
+/* 0x4b */ x86emuOp_dec_BX,
+/* 0x4c */ x86emuOp_dec_SP,
+/* 0x4d */ x86emuOp_dec_BP,
+/* 0x4e */ x86emuOp_dec_SI,
+/* 0x4f */ x86emuOp_dec_DI,
+/* 0x50 */ x86emuOp_push_AX,
+/* 0x51 */ x86emuOp_push_CX,
+/* 0x52 */ x86emuOp_push_DX,
+/* 0x53 */ x86emuOp_push_BX,
+/* 0x54 */ x86emuOp_push_SP,
+/* 0x55 */ x86emuOp_push_BP,
+/* 0x56 */ x86emuOp_push_SI,
+/* 0x57 */ x86emuOp_push_DI,
+/* 0x58 */ x86emuOp_pop_AX,
+/* 0x59 */ x86emuOp_pop_CX,
+/* 0x5a */ x86emuOp_pop_DX,
+/* 0x5b */ x86emuOp_pop_BX,
+/* 0x5c */ x86emuOp_pop_SP,
+/* 0x5d */ x86emuOp_pop_BP,
+/* 0x5e */ x86emuOp_pop_SI,
+/* 0x5f */ x86emuOp_pop_DI,
+/* 0x60 */ x86emuOp_push_all,
+/* 0x61 */ x86emuOp_pop_all,
+ /* 0x62 */ x86emuOp_illegal_op,
+ /* bound */
+ /* 0x63 */ x86emuOp_illegal_op,
+ /* arpl */
+/* 0x64 */ x86emuOp_segovr_FS,
+/* 0x65 */ x86emuOp_segovr_GS,
+/* 0x66 */ x86emuOp_prefix_data,
+/* 0x67 */ x86emuOp_prefix_addr,
+/* 0x68 */ x86emuOp_push_word_IMM,
+/* 0x69 */ x86emuOp_imul_word_IMM,
+/* 0x6a */ x86emuOp_push_byte_IMM,
+/* 0x6b */ x86emuOp_imul_byte_IMM,
+/* 0x6c */ x86emuOp_ins_byte,
+/* 0x6d */ x86emuOp_ins_word,
+/* 0x6e */ x86emuOp_outs_byte,
+/* 0x6f */ x86emuOp_outs_word,
+/* 0x70 */ x86emuOp_jump_near_O,
+/* 0x71 */ x86emuOp_jump_near_NO,
+/* 0x72 */ x86emuOp_jump_near_B,
+/* 0x73 */ x86emuOp_jump_near_NB,
+/* 0x74 */ x86emuOp_jump_near_Z,
+/* 0x75 */ x86emuOp_jump_near_NZ,
+/* 0x76 */ x86emuOp_jump_near_BE,
+/* 0x77 */ x86emuOp_jump_near_NBE,
+/* 0x78 */ x86emuOp_jump_near_S,
+/* 0x79 */ x86emuOp_jump_near_NS,
+/* 0x7a */ x86emuOp_jump_near_P,
+/* 0x7b */ x86emuOp_jump_near_NP,
+/* 0x7c */ x86emuOp_jump_near_L,
+/* 0x7d */ x86emuOp_jump_near_NL,
+/* 0x7e */ x86emuOp_jump_near_LE,
+/* 0x7f */ x86emuOp_jump_near_NLE,
+/* 0x80 */ x86emuOp_opc80_byte_RM_IMM,
+/* 0x81 */ x86emuOp_opc81_word_RM_IMM,
+/* 0x82 */ x86emuOp_opc82_byte_RM_IMM,
+/* 0x83 */ x86emuOp_opc83_word_RM_IMM,
+/* 0x84 */ x86emuOp_test_byte_RM_R,
+/* 0x85 */ x86emuOp_test_word_RM_R,
+/* 0x86 */ x86emuOp_xchg_byte_RM_R,
+/* 0x87 */ x86emuOp_xchg_word_RM_R,
+/* 0x88 */ x86emuOp_mov_byte_RM_R,
+/* 0x89 */ x86emuOp_mov_word_RM_R,
+/* 0x8a */ x86emuOp_mov_byte_R_RM,
+/* 0x8b */ x86emuOp_mov_word_R_RM,
+/* 0x8c */ x86emuOp_mov_word_RM_SR,
+/* 0x8d */ x86emuOp_lea_word_R_M,
+/* 0x8e */ x86emuOp_mov_word_SR_RM,
+/* 0x8f */ x86emuOp_pop_RM,
+/* 0x90 */ x86emuOp_nop,
+/* 0x91 */ x86emuOp_xchg_word_AX_CX,
+/* 0x92 */ x86emuOp_xchg_word_AX_DX,
+/* 0x93 */ x86emuOp_xchg_word_AX_BX,
+/* 0x94 */ x86emuOp_xchg_word_AX_SP,
+/* 0x95 */ x86emuOp_xchg_word_AX_BP,
+/* 0x96 */ x86emuOp_xchg_word_AX_SI,
+/* 0x97 */ x86emuOp_xchg_word_AX_DI,
+/* 0x98 */ x86emuOp_cbw,
+/* 0x99 */ x86emuOp_cwd,
+/* 0x9a */ x86emuOp_call_far_IMM,
+/* 0x9b */ x86emuOp_wait,
+/* 0x9c */ x86emuOp_pushf_word,
+/* 0x9d */ x86emuOp_popf_word,
+/* 0x9e */ x86emuOp_sahf,
+/* 0x9f */ x86emuOp_lahf,
+/* 0xa0 */ x86emuOp_mov_AL_M_IMM,
+/* 0xa1 */ x86emuOp_mov_AX_M_IMM,
+/* 0xa2 */ x86emuOp_mov_M_AL_IMM,
+/* 0xa3 */ x86emuOp_mov_M_AX_IMM,
+/* 0xa4 */ x86emuOp_movs_byte,
+/* 0xa5 */ x86emuOp_movs_word,
+/* 0xa6 */ x86emuOp_cmps_byte,
+/* 0xa7 */ x86emuOp_cmps_word,
+/* 0xa8 */ x86emuOp_test_AL_IMM,
+/* 0xa9 */ x86emuOp_test_AX_IMM,
+/* 0xaa */ x86emuOp_stos_byte,
+/* 0xab */ x86emuOp_stos_word,
+/* 0xac */ x86emuOp_lods_byte,
+/* 0xad */ x86emuOp_lods_word,
+/* 0xac */ x86emuOp_scas_byte,
+/* 0xad */ x86emuOp_scas_word,
+/* 0xb0 */ x86emuOp_mov_byte_AL_IMM,
+/* 0xb1 */ x86emuOp_mov_byte_CL_IMM,
+/* 0xb2 */ x86emuOp_mov_byte_DL_IMM,
+/* 0xb3 */ x86emuOp_mov_byte_BL_IMM,
+/* 0xb4 */ x86emuOp_mov_byte_AH_IMM,
+/* 0xb5 */ x86emuOp_mov_byte_CH_IMM,
+/* 0xb6 */ x86emuOp_mov_byte_DH_IMM,
+/* 0xb7 */ x86emuOp_mov_byte_BH_IMM,
+/* 0xb8 */ x86emuOp_mov_word_AX_IMM,
+/* 0xb9 */ x86emuOp_mov_word_CX_IMM,
+/* 0xba */ x86emuOp_mov_word_DX_IMM,
+/* 0xbb */ x86emuOp_mov_word_BX_IMM,
+/* 0xbc */ x86emuOp_mov_word_SP_IMM,
+/* 0xbd */ x86emuOp_mov_word_BP_IMM,
+/* 0xbe */ x86emuOp_mov_word_SI_IMM,
+/* 0xbf */ x86emuOp_mov_word_DI_IMM,
+/* 0xc0 */ x86emuOp_opcC0_byte_RM_MEM,
+/* 0xc1 */ x86emuOp_opcC1_word_RM_MEM,
+/* 0xc2 */ x86emuOp_ret_near_IMM,
+/* 0xc3 */ x86emuOp_ret_near,
+/* 0xc4 */ x86emuOp_les_R_IMM,
+/* 0xc5 */ x86emuOp_lds_R_IMM,
+/* 0xc6 */ x86emuOp_mov_byte_RM_IMM,
+/* 0xc7 */ x86emuOp_mov_word_RM_IMM,
+/* 0xc8 */ x86emuOp_enter,
+/* 0xc9 */ x86emuOp_leave,
+/* 0xca */ x86emuOp_ret_far_IMM,
+/* 0xcb */ x86emuOp_ret_far,
+/* 0xcc */ x86emuOp_int3,
+/* 0xcd */ x86emuOp_int_IMM,
+/* 0xce */ x86emuOp_into,
+/* 0xcf */ x86emuOp_iret,
+/* 0xd0 */ x86emuOp_opcD0_byte_RM_1,
+/* 0xd1 */ x86emuOp_opcD1_word_RM_1,
+/* 0xd2 */ x86emuOp_opcD2_byte_RM_CL,
+/* 0xd3 */ x86emuOp_opcD3_word_RM_CL,
+/* 0xd4 */ x86emuOp_aam,
+/* 0xd5 */ x86emuOp_aad,
+ /* 0xd6 */ x86emuOp_illegal_op,
+ /* Undocumented SETALC instruction */
+/* 0xd7 */ x86emuOp_xlat,
+/* 0xd8 */ x86emuOp_esc_coprocess_d8,
+/* 0xd9 */ x86emuOp_esc_coprocess_d9,
+/* 0xda */ x86emuOp_esc_coprocess_da,
+/* 0xdb */ x86emuOp_esc_coprocess_db,
+/* 0xdc */ x86emuOp_esc_coprocess_dc,
+/* 0xdd */ x86emuOp_esc_coprocess_dd,
+/* 0xde */ x86emuOp_esc_coprocess_de,
+/* 0xdf */ x86emuOp_esc_coprocess_df,
+/* 0xe0 */ x86emuOp_loopne,
+/* 0xe1 */ x86emuOp_loope,
+/* 0xe2 */ x86emuOp_loop,
+/* 0xe3 */ x86emuOp_jcxz,
+/* 0xe4 */ x86emuOp_in_byte_AL_IMM,
+/* 0xe5 */ x86emuOp_in_word_AX_IMM,
+/* 0xe6 */ x86emuOp_out_byte_IMM_AL,
+/* 0xe7 */ x86emuOp_out_word_IMM_AX,
+/* 0xe8 */ x86emuOp_call_near_IMM,
+/* 0xe9 */ x86emuOp_jump_near_IMM,
+/* 0xea */ x86emuOp_jump_far_IMM,
+/* 0xeb */ x86emuOp_jump_byte_IMM,
+/* 0xec */ x86emuOp_in_byte_AL_DX,
+/* 0xed */ x86emuOp_in_word_AX_DX,
+/* 0xee */ x86emuOp_out_byte_DX_AL,
+/* 0xef */ x86emuOp_out_word_DX_AX,
+/* 0xf0 */ x86emuOp_lock,
+/* 0xf1 */ x86emuOp_illegal_op,
+/* 0xf2 */ x86emuOp_repne,
+/* 0xf3 */ x86emuOp_repe,
+/* 0xf4 */ x86emuOp_halt,
+/* 0xf5 */ x86emuOp_cmc,
+/* 0xf6 */ x86emuOp_opcF6_byte_RM,
+/* 0xf7 */ x86emuOp_opcF7_word_RM,
+/* 0xf8 */ x86emuOp_clc,
+/* 0xf9 */ x86emuOp_stc,
+/* 0xfa */ x86emuOp_cli,
+/* 0xfb */ x86emuOp_sti,
+/* 0xfc */ x86emuOp_cld,
+/* 0xfd */ x86emuOp_std,
+/* 0xfe */ x86emuOp_opcFE_byte_RM,
+/* 0xff */ x86emuOp_opcFF_word_RM,
+};
diff --git a/xorg-server/hw/xfree86/x86emu/ops2.c b/xorg-server/hw/xfree86/x86emu/ops2.c
index 501d5fcb2..5ed2bf68d 100644
--- a/xorg-server/hw/xfree86/x86emu/ops2.c
+++ b/xorg-server/hw/xfree86/x86emu/ops2.c
@@ -55,14 +55,14 @@ op1 - Instruction op code
REMARKS:
Handles illegal opcodes.
****************************************************************************/
-static void x86emuOp2_illegal_op(
- u8 op2)
+static void
+x86emuOp2_illegal_op(u8 op2)
{
- START_OF_INSTR();
- DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
- TRACE_REGS();
- printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
- M.x86.R_CS, M.x86.R_IP-2,op2);
+ START_OF_INSTR();
+ DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
+ TRACE_REGS();
+ printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
+ M.x86.R_CS, M.x86.R_IP - 2, op2);
HALT_SYS();
END_OF_INSTR();
}
@@ -73,7 +73,8 @@ static void x86emuOp2_illegal_op(
REMARKS:
Handles opcode 0x0f,0x31
****************************************************************************/
-static void x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2))
{
#ifdef __HAS_LONG_LONG__
static u64 counter = 0;
@@ -107,7 +108,8 @@ static void x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0x80-0x8F
****************************************************************************/
-static void x86emuOp2_long_jump(u8 op2)
+static void
+x86emuOp2_long_jump(u8 op2)
{
s32 target;
const char *name = NULL;
@@ -116,81 +118,81 @@ static void x86emuOp2_long_jump(u8 op2)
/* conditional jump to word offset. */
START_OF_INSTR();
switch (op2) {
- case 0x80:
+ case 0x80:
name = "JO\t";
- cond = ACCESS_FLAG(F_OF);
+ cond = ACCESS_FLAG(F_OF);
break;
- case 0x81:
+ case 0x81:
name = "JNO\t";
cond = !ACCESS_FLAG(F_OF);
break;
- case 0x82:
+ case 0x82:
name = "JB\t";
cond = ACCESS_FLAG(F_CF);
break;
- case 0x83:
+ case 0x83:
name = "JNB\t";
cond = !ACCESS_FLAG(F_CF);
break;
- case 0x84:
+ case 0x84:
name = "JZ\t";
cond = ACCESS_FLAG(F_ZF);
break;
- case 0x85:
+ case 0x85:
name = "JNZ\t";
cond = !ACCESS_FLAG(F_ZF);
break;
- case 0x86:
+ case 0x86:
name = "JBE\t";
cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
break;
- case 0x87:
+ case 0x87:
name = "JNBE\t";
cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
break;
- case 0x88:
+ case 0x88:
name = "JS\t";
cond = ACCESS_FLAG(F_SF);
break;
- case 0x89:
+ case 0x89:
name = "JNS\t";
cond = !ACCESS_FLAG(F_SF);
break;
- case 0x8a:
+ case 0x8a:
name = "JP\t";
cond = ACCESS_FLAG(F_PF);
break;
- case 0x8b:
+ case 0x8b:
name = "JNP\t";
cond = !ACCESS_FLAG(F_PF);
break;
- case 0x8c:
+ case 0x8c:
name = "JL\t";
cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
break;
- case 0x8d:
+ case 0x8d:
name = "JNL\t";
cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)));
break;
- case 0x8e:
+ case 0x8e:
name = "JLE\t";
cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
ACCESS_FLAG(F_ZF));
break;
- case 0x8f:
+ case 0x8f:
name = "JNLE\t";
cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
ACCESS_FLAG(F_ZF));
break;
}
DECODE_PRINTF(name);
- (void)name;
+ (void) name;
target = (s16) fetch_word_imm();
target += (s16) M.x86.R_IP;
DECODE_PRINTF2("%04x\n", target);
TRACE_AND_STEP();
if (cond)
- M.x86.R_IP = (u16)target;
+ M.x86.R_IP = (u16) target;
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
@@ -199,85 +201,86 @@ static void x86emuOp2_long_jump(u8 op2)
REMARKS:
Handles opcode 0x0f,0x90-0x9F
****************************************************************************/
-static void x86emuOp2_set_byte(u8 op2)
+static void
+x86emuOp2_set_byte(u8 op2)
{
int mod, rl, rh;
uint destoffset;
- u8 *destreg;
+ u8 *destreg;
const char *name = NULL;
int cond = 0;
START_OF_INSTR();
switch (op2) {
- case 0x90:
+ case 0x90:
name = "SETO\t";
- cond = ACCESS_FLAG(F_OF);
+ cond = ACCESS_FLAG(F_OF);
break;
- case 0x91:
+ case 0x91:
name = "SETNO\t";
cond = !ACCESS_FLAG(F_OF);
break;
- case 0x92:
+ case 0x92:
name = "SETB\t";
cond = ACCESS_FLAG(F_CF);
break;
- case 0x93:
+ case 0x93:
name = "SETNB\t";
cond = !ACCESS_FLAG(F_CF);
break;
- case 0x94:
+ case 0x94:
name = "SETZ\t";
cond = ACCESS_FLAG(F_ZF);
break;
- case 0x95:
+ case 0x95:
name = "SETNZ\t";
cond = !ACCESS_FLAG(F_ZF);
break;
- case 0x96:
+ case 0x96:
name = "SETBE\t";
cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
break;
- case 0x97:
+ case 0x97:
name = "SETNBE\t";
cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
break;
- case 0x98:
+ case 0x98:
name = "SETS\t";
cond = ACCESS_FLAG(F_SF);
break;
- case 0x99:
+ case 0x99:
name = "SETNS\t";
cond = !ACCESS_FLAG(F_SF);
break;
- case 0x9a:
+ case 0x9a:
name = "SETP\t";
cond = ACCESS_FLAG(F_PF);
break;
- case 0x9b:
+ case 0x9b:
name = "SETNP\t";
cond = !ACCESS_FLAG(F_PF);
break;
- case 0x9c:
+ case 0x9c:
name = "SETL\t";
cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
break;
- case 0x9d:
+ case 0x9d:
name = "SETNL\t";
cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
break;
- case 0x9e:
+ case 0x9e:
name = "SETLE\t";
cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
ACCESS_FLAG(F_ZF));
break;
- case 0x9f:
+ case 0x9f:
name = "SETNLE\t";
cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
ACCESS_FLAG(F_ZF));
break;
}
DECODE_PRINTF(name);
- (void)name;
+ (void) name;
FETCH_DECODE_MODRM(mod, rh, rl);
switch (mod) {
case 0:
@@ -295,7 +298,7 @@ static void x86emuOp2_set_byte(u8 op2)
TRACE_AND_STEP();
store_data_byte(destoffset, cond ? 0x01 : 0x00);
break;
- case 3: /* register to register */
+ case 3: /* register to register */
destreg = DECODE_RM_BYTE_REGISTER(rl);
TRACE_AND_STEP();
*destreg = cond ? 0x01 : 0x00;
@@ -309,7 +312,8 @@ static void x86emuOp2_set_byte(u8 op2)
REMARKS:
Handles opcode 0x0f,0xa0
****************************************************************************/
-static void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
{
START_OF_INSTR();
DECODE_PRINTF("PUSH\tFS\n");
@@ -323,7 +327,8 @@ static void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa1
****************************************************************************/
-static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
{
START_OF_INSTR();
DECODE_PRINTF("POP\tFS\n");
@@ -337,7 +342,8 @@ static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
REMARKS: CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output
Handles opcode 0x0f,0xa2
****************************************************************************/
-static void x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
{
START_OF_INSTR();
DECODE_PRINTF("CPUID\n");
@@ -351,11 +357,12 @@ static void x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa3
****************************************************************************/
-static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
- int bit,disp;
+ int bit, disp;
START_OF_INSTR();
DECODE_PRINTF("BT\t");
@@ -371,10 +378,11 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
- } else {
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
+ }
+ else {
u16 srcval;
u16 *shiftreg;
@@ -383,9 +391,9 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
}
break;
case 1:
@@ -398,10 +406,11 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
- } else {
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
+ }
+ else {
u16 srcval;
u16 *shiftreg;
@@ -410,9 +419,9 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
}
break;
case 2:
@@ -425,10 +434,11 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
- } else {
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
+ }
+ else {
u16 srcval;
u16 *shiftreg;
@@ -437,30 +447,31 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
}
break;
- case 3: /* register to register */
+ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg,*shiftreg;
+ u32 *srcreg, *shiftreg;
srcreg = DECODE_RM_LONG_REGISTER(rl);
DECODE_PRINTF(",");
shiftreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
- CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
- } else {
- u16 *srcreg,*shiftreg;
+ CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit), F_CF);
+ }
+ else {
+ u16 *srcreg, *shiftreg;
srcreg = DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF(",");
shiftreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
- CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
+ CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit), F_CF);
}
break;
}
@@ -472,11 +483,12 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa4
****************************************************************************/
-static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint destoffset;
- u8 shift;
+ u8 shift;
START_OF_INSTR();
DECODE_PRINTF("SHLD\t");
@@ -495,9 +507,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,shift);
+ destval = shld_long(destval, *shiftreg, shift);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -509,7 +522,7 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,shift);
+ destval = shld_word(destval, *shiftreg, shift);
store_data_word(destoffset, destval);
}
break;
@@ -526,9 +539,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,shift);
+ destval = shld_long(destval, *shiftreg, shift);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -540,7 +554,7 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,shift);
+ destval = shld_word(destval, *shiftreg, shift);
store_data_word(destoffset, destval);
}
break;
@@ -557,9 +571,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,shift);
+ destval = shld_long(destval, *shiftreg, shift);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -571,13 +586,13 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,shift);
+ destval = shld_word(destval, *shiftreg, shift);
store_data_word(destoffset, destval);
}
break;
- case 3: /* register to register */
+ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*shiftreg;
+ u32 *destreg, *shiftreg;
destreg = DECODE_RM_LONG_REGISTER(rl);
DECODE_PRINTF(",");
@@ -586,9 +601,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
shift = fetch_byte_imm();
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
- *destreg = shld_long(*destreg,*shiftreg,shift);
- } else {
- u16 *destreg,*shiftreg;
+ *destreg = shld_long(*destreg, *shiftreg, shift);
+ }
+ else {
+ u16 *destreg, *shiftreg;
destreg = DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF(",");
@@ -597,7 +613,7 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
shift = fetch_byte_imm();
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
- *destreg = shld_word(*destreg,*shiftreg,shift);
+ *destreg = shld_word(*destreg, *shiftreg, shift);
}
break;
}
@@ -609,7 +625,8 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa5
****************************************************************************/
-static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint destoffset;
@@ -629,9 +646,10 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
+ destval = shld_long(destval, *shiftreg, M.x86.R_CL);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -641,7 +659,7 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
+ destval = shld_word(destval, *shiftreg, M.x86.R_CL);
store_data_word(destoffset, destval);
}
break;
@@ -656,9 +674,10 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
+ destval = shld_long(destval, *shiftreg, M.x86.R_CL);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -668,7 +687,7 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
+ destval = shld_word(destval, *shiftreg, M.x86.R_CL);
store_data_word(destoffset, destval);
}
break;
@@ -683,9 +702,10 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
+ destval = shld_long(destval, *shiftreg, M.x86.R_CL);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -695,29 +715,30 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
+ destval = shld_word(destval, *shiftreg, M.x86.R_CL);
store_data_word(destoffset, destval);
}
break;
- case 3: /* register to register */
+ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*shiftreg;
+ u32 *destreg, *shiftreg;
destreg = DECODE_RM_LONG_REGISTER(rl);
DECODE_PRINTF(",");
shiftreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
- *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL);
- } else {
- u16 *destreg,*shiftreg;
+ *destreg = shld_long(*destreg, *shiftreg, M.x86.R_CL);
+ }
+ else {
+ u16 *destreg, *shiftreg;
destreg = DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF(",");
shiftreg = DECODE_RM_WORD_REGISTER(rh);
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
- *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL);
+ *destreg = shld_word(*destreg, *shiftreg, M.x86.R_CL);
}
break;
}
@@ -729,7 +750,8 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa8
****************************************************************************/
-static void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
{
START_OF_INSTR();
DECODE_PRINTF("PUSH\tGS\n");
@@ -743,7 +765,8 @@ static void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xa9
****************************************************************************/
-static void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
{
START_OF_INSTR();
DECODE_PRINTF("POP\tGS\n");
@@ -757,11 +780,12 @@ static void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xab
****************************************************************************/
-static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
- int bit,disp;
+ int bit, disp;
START_OF_INSTR();
DECODE_PRINTF("BTS\t");
@@ -769,7 +793,7 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
switch (mod) {
case 0:
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
+ u32 srcval, mask;
u32 *shiftreg;
srcoffset = decode_rm00_address(rl);
@@ -777,13 +801,14 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval | mask);
- } else {
- u16 srcval,mask;
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_long(srcoffset + disp, srcval | mask);
+ }
+ else {
+ u16 srcval, mask;
u16 *shiftreg;
srcoffset = decode_rm00_address(rl);
@@ -791,16 +816,16 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, srcval | mask);
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_word(srcoffset + disp, srcval | mask);
}
break;
case 1:
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
+ u32 srcval, mask;
u32 *shiftreg;
srcoffset = decode_rm01_address(rl);
@@ -808,13 +833,14 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval | mask);
- } else {
- u16 srcval,mask;
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_long(srcoffset + disp, srcval | mask);
+ }
+ else {
+ u16 srcval, mask;
u16 *shiftreg;
srcoffset = decode_rm01_address(rl);
@@ -822,16 +848,16 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, srcval | mask);
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_word(srcoffset + disp, srcval | mask);
}
break;
case 2:
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
+ u32 srcval, mask;
u32 *shiftreg;
srcoffset = decode_rm10_address(rl);
@@ -839,51 +865,53 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval | mask);
- } else {
- u16 srcval,mask;
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_long(srcoffset + disp, srcval | mask);
+ }
+ else {
+ u16 srcval, mask;
u16 *shiftreg;
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, srcval | mask);
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg,*shiftreg;
- u32 mask;
-
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
- *srcreg |= mask;
- } else {
- u16 *srcreg,*shiftreg;
- u16 mask;
-
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_word(srcoffset + disp, srcval | mask);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg, *shiftreg;
+ u32 mask;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
+ *srcreg |= mask;
+ }
+ else {
+ u16 *srcreg, *shiftreg;
+ u16 mask;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
*srcreg |= mask;
}
break;
@@ -896,11 +924,12 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xac
****************************************************************************/
-static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint destoffset;
- u8 shift;
+ u8 shift;
START_OF_INSTR();
DECODE_PRINTF("SHLD\t");
@@ -919,9 +948,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,shift);
+ destval = shrd_long(destval, *shiftreg, shift);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -933,7 +963,7 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,shift);
+ destval = shrd_word(destval, *shiftreg, shift);
store_data_word(destoffset, destval);
}
break;
@@ -950,9 +980,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,shift);
+ destval = shrd_long(destval, *shiftreg, shift);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -964,7 +995,7 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,shift);
+ destval = shrd_word(destval, *shiftreg, shift);
store_data_word(destoffset, destval);
}
break;
@@ -981,9 +1012,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,shift);
+ destval = shrd_long(destval, *shiftreg, shift);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -995,13 +1027,13 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,shift);
+ destval = shrd_word(destval, *shiftreg, shift);
store_data_word(destoffset, destval);
}
break;
- case 3: /* register to register */
+ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*shiftreg;
+ u32 *destreg, *shiftreg;
destreg = DECODE_RM_LONG_REGISTER(rl);
DECODE_PRINTF(",");
@@ -1010,9 +1042,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
shift = fetch_byte_imm();
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
- *destreg = shrd_long(*destreg,*shiftreg,shift);
- } else {
- u16 *destreg,*shiftreg;
+ *destreg = shrd_long(*destreg, *shiftreg, shift);
+ }
+ else {
+ u16 *destreg, *shiftreg;
destreg = DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF(",");
@@ -1021,7 +1054,7 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
shift = fetch_byte_imm();
DECODE_PRINTF2("%d\n", shift);
TRACE_AND_STEP();
- *destreg = shrd_word(*destreg,*shiftreg,shift);
+ *destreg = shrd_word(*destreg, *shiftreg, shift);
}
break;
}
@@ -1033,7 +1066,8 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xad
****************************************************************************/
-static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint destoffset;
@@ -1053,9 +1087,10 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
+ destval = shrd_long(destval, *shiftreg, M.x86.R_CL);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -1065,7 +1100,7 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
+ destval = shrd_word(destval, *shiftreg, M.x86.R_CL);
store_data_word(destoffset, destval);
}
break;
@@ -1080,9 +1115,10 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
+ destval = shrd_long(destval, *shiftreg, M.x86.R_CL);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -1092,7 +1128,7 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
+ destval = shrd_word(destval, *shiftreg, M.x86.R_CL);
store_data_word(destoffset, destval);
}
break;
@@ -1107,9 +1143,10 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_long(destoffset);
- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
+ destval = shrd_long(destval, *shiftreg, M.x86.R_CL);
store_data_long(destoffset, destval);
- } else {
+ }
+ else {
u16 destval;
u16 *shiftreg;
@@ -1119,29 +1156,30 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
destval = fetch_data_word(destoffset);
- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
+ destval = shrd_word(destval, *shiftreg, M.x86.R_CL);
store_data_word(destoffset, destval);
}
break;
- case 3: /* register to register */
+ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*shiftreg;
+ u32 *destreg, *shiftreg;
destreg = DECODE_RM_LONG_REGISTER(rl);
DECODE_PRINTF(",");
shiftreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
- *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL);
- } else {
- u16 *destreg,*shiftreg;
+ *destreg = shrd_long(*destreg, *shiftreg, M.x86.R_CL);
+ }
+ else {
+ u16 *destreg, *shiftreg;
destreg = DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF(",");
shiftreg = DECODE_RM_WORD_REGISTER(rh);
DECODE_PRINTF(",CL\n");
TRACE_AND_STEP();
- *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL);
+ *destreg = shrd_word(*destreg, *shiftreg, M.x86.R_CL);
}
break;
}
@@ -1153,7 +1191,8 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xaf
****************************************************************************/
-static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1166,23 +1205,25 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 *destreg;
u32 srcval;
- u32 res_lo,res_hi;
+ u32 res_lo, res_hi;
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm00_address(rl);
srcval = fetch_data_long(srcoffset);
TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
+ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval);
if (res_hi != 0) {
SET_FLAG(F_CF);
SET_FLAG(F_OF);
- } else {
+ }
+ else {
CLEAR_FLAG(F_CF);
CLEAR_FLAG(F_OF);
}
- *destreg = (u32)res_lo;
- } else {
+ *destreg = (u32) res_lo;
+ }
+ else {
u16 *destreg;
u16 srcval;
u32 res;
@@ -1192,38 +1233,41 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
srcoffset = decode_rm00_address(rl);
srcval = fetch_data_word(srcoffset);
TRACE_AND_STEP();
- res = (s16)*destreg * (s16)srcval;
+ res = (s16) * destreg * (s16) srcval;
if (res > 0xFFFF) {
SET_FLAG(F_CF);
SET_FLAG(F_OF);
- } else {
+ }
+ else {
CLEAR_FLAG(F_CF);
CLEAR_FLAG(F_OF);
}
- *destreg = (u16)res;
+ *destreg = (u16) res;
}
break;
case 1:
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 *destreg;
u32 srcval;
- u32 res_lo,res_hi;
+ u32 res_lo, res_hi;
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm01_address(rl);
srcval = fetch_data_long(srcoffset);
TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
+ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval);
if (res_hi != 0) {
SET_FLAG(F_CF);
SET_FLAG(F_OF);
- } else {
+ }
+ else {
CLEAR_FLAG(F_CF);
CLEAR_FLAG(F_OF);
}
- *destreg = (u32)res_lo;
- } else {
+ *destreg = (u32) res_lo;
+ }
+ else {
u16 *destreg;
u16 srcval;
u32 res;
@@ -1233,38 +1277,41 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
srcoffset = decode_rm01_address(rl);
srcval = fetch_data_word(srcoffset);
TRACE_AND_STEP();
- res = (s16)*destreg * (s16)srcval;
+ res = (s16) * destreg * (s16) srcval;
if (res > 0xFFFF) {
SET_FLAG(F_CF);
SET_FLAG(F_OF);
- } else {
+ }
+ else {
CLEAR_FLAG(F_CF);
CLEAR_FLAG(F_OF);
}
- *destreg = (u16)res;
+ *destreg = (u16) res;
}
break;
case 2:
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 *destreg;
u32 srcval;
- u32 res_lo,res_hi;
+ u32 res_lo, res_hi;
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm10_address(rl);
srcval = fetch_data_long(srcoffset);
TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
+ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval);
if (res_hi != 0) {
SET_FLAG(F_CF);
SET_FLAG(F_OF);
- } else {
+ }
+ else {
CLEAR_FLAG(F_CF);
CLEAR_FLAG(F_OF);
}
- *destreg = (u32)res_lo;
- } else {
+ *destreg = (u32) res_lo;
+ }
+ else {
u16 *destreg;
u16 srcval;
u32 res;
@@ -1274,51 +1321,55 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
srcoffset = decode_rm10_address(rl);
srcval = fetch_data_word(srcoffset);
TRACE_AND_STEP();
- res = (s16)*destreg * (s16)srcval;
+ res = (s16) * destreg * (s16) srcval;
if (res > 0xFFFF) {
SET_FLAG(F_CF);
SET_FLAG(F_OF);
- } else {
+ }
+ else {
CLEAR_FLAG(F_CF);
CLEAR_FLAG(F_OF);
}
- *destreg = (u16)res;
+ *destreg = (u16) res;
}
break;
- case 3: /* register to register */
+ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *destreg,*srcreg;
- u32 res_lo,res_hi;
+ u32 *destreg, *srcreg;
+ u32 res_lo, res_hi;
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcreg = DECODE_RM_LONG_REGISTER(rl);
TRACE_AND_STEP();
- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg);
+ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) * srcreg);
if (res_hi != 0) {
SET_FLAG(F_CF);
SET_FLAG(F_OF);
- } else {
+ }
+ else {
CLEAR_FLAG(F_CF);
CLEAR_FLAG(F_OF);
}
- *destreg = (u32)res_lo;
- } else {
- u16 *destreg,*srcreg;
+ *destreg = (u32) res_lo;
+ }
+ else {
+ u16 *destreg, *srcreg;
u32 res;
destreg = DECODE_RM_WORD_REGISTER(rh);
DECODE_PRINTF(",");
srcreg = DECODE_RM_WORD_REGISTER(rl);
- res = (s16)*destreg * (s16)*srcreg;
+ res = (s16) * destreg * (s16) * srcreg;
if (res > 0xFFFF) {
SET_FLAG(F_CF);
SET_FLAG(F_OF);
- } else {
+ }
+ else {
CLEAR_FLAG(F_CF);
CLEAR_FLAG(F_OF);
}
- *destreg = (u16)res;
+ *destreg = (u16) res;
}
break;
}
@@ -1330,9 +1381,10 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb2
****************************************************************************/
-static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
{
- int mod, rh, rl;
+ int mod, rh, rl;
u16 *dstreg;
uint srcoffset;
@@ -1367,7 +1419,7 @@ static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
*dstreg = fetch_data_word(srcoffset);
M.x86.R_SS = fetch_data_word(srcoffset + 2);
break;
- case 3: /* register to register */
+ case 3: /* register to register */
/* UNDEFINED! */
TRACE_AND_STEP();
}
@@ -1379,148 +1431,154 @@ static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb3
****************************************************************************/
-static void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
{
- int mod, rl, rh;
- uint srcoffset;
- int bit,disp;
-
- START_OF_INSTR();
- DECODE_PRINTF("BTR\t");
- FETCH_DECODE_MODRM(mod, rh, rl);
- switch (mod) {
- case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
- u32 *shiftreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval & ~mask);
- } else {
- u16 srcval,mask;
- u16 *shiftreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
- }
- break;
- case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
- u32 *shiftreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval & ~mask);
- } else {
- u16 srcval,mask;
- u16 *shiftreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
- }
- break;
- case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
- u32 *shiftreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval & ~mask);
- } else {
- u16 srcval,mask;
- u16 *shiftreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg,*shiftreg;
- u32 mask;
-
- srcreg = DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0x1F;
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
- *srcreg &= ~mask;
- } else {
- u16 *srcreg,*shiftreg;
- u16 mask;
-
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
- *srcreg &= ~mask;
- }
- break;
- }
- DECODE_CLEAR_SEGOVR();
- END_OF_INSTR();
+ int mod, rl, rh;
+ uint srcoffset;
+ int bit, disp;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("BTR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_long(srcoffset + disp, srcval & ~mask);
+ }
+ else {
+ u16 srcval, mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_word(srcoffset + disp, (u16) (srcval & ~mask));
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_long(srcoffset + disp, srcval & ~mask);
+ }
+ else {
+ u16 srcval, mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_word(srcoffset + disp, (u16) (srcval & ~mask));
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_long(srcoffset + disp, srcval & ~mask);
+ }
+ else {
+ u16 srcval, mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_word(srcoffset + disp, (u16) (srcval & ~mask));
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg, *shiftreg;
+ u32 mask;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
+ *srcreg &= ~mask;
+ }
+ else {
+ u16 *srcreg, *shiftreg;
+ u16 mask;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
+ *srcreg &= ~mask;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
}
/****************************************************************************
REMARKS:
Handles opcode 0x0f,0xb4
****************************************************************************/
-static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
{
- int mod, rh, rl;
+ int mod, rh, rl;
u16 *dstreg;
uint srcoffset;
@@ -1555,7 +1613,7 @@ static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
*dstreg = fetch_data_word(srcoffset);
M.x86.R_FS = fetch_data_word(srcoffset + 2);
break;
- case 3: /* register to register */
+ case 3: /* register to register */
/* UNDEFINED! */
TRACE_AND_STEP();
}
@@ -1567,9 +1625,10 @@ static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb5
****************************************************************************/
-static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
{
- int mod, rh, rl;
+ int mod, rh, rl;
u16 *dstreg;
uint srcoffset;
@@ -1604,7 +1663,7 @@ static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
*dstreg = fetch_data_word(srcoffset);
M.x86.R_GS = fetch_data_word(srcoffset + 2);
break;
- case 3: /* register to register */
+ case 3: /* register to register */
/* UNDEFINED! */
TRACE_AND_STEP();
}
@@ -1616,7 +1675,8 @@ static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb6
****************************************************************************/
-static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1637,7 +1697,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
- } else {
+ }
+ else {
u16 *destreg;
u16 srcval;
@@ -1662,7 +1723,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
- } else {
+ }
+ else {
u16 *destreg;
u16 srcval;
@@ -1687,7 +1749,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
- } else {
+ }
+ else {
u16 *destreg;
u16 srcval;
@@ -1700,10 +1763,10 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
*destreg = srcval;
}
break;
- case 3: /* register to register */
+ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 *destreg;
- u8 *srcreg;
+ u8 *srcreg;
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
@@ -1711,9 +1774,10 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = *srcreg;
- } else {
+ }
+ else {
u16 *destreg;
- u8 *srcreg;
+ u8 *srcreg;
destreg = DECODE_RM_WORD_REGISTER(rh);
DECODE_PRINTF(",");
@@ -1732,7 +1796,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xb7
****************************************************************************/
-static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1771,7 +1836,7 @@ static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
TRACE_AND_STEP();
*destreg = srcval;
break;
- case 3: /* register to register */
+ case 3: /* register to register */
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcreg = DECODE_RM_WORD_REGISTER(rl);
@@ -1788,7 +1853,8 @@ static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xba
****************************************************************************/
-static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -1798,23 +1864,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
FETCH_DECODE_MODRM(mod, rh, rl);
switch (rh) {
case 4:
- DECODE_PRINTF("BT\t");
- break;
+ DECODE_PRINTF("BT\t");
+ break;
case 5:
- DECODE_PRINTF("BTS\t");
- break;
+ DECODE_PRINTF("BTS\t");
+ break;
case 6:
- DECODE_PRINTF("BTR\t");
- break;
+ DECODE_PRINTF("BTR\t");
+ break;
case 7:
- DECODE_PRINTF("BTC\t");
- break;
+ DECODE_PRINTF("BTC\t");
+ break;
default:
- DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
- TRACE_REGS();
- printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
- M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
- HALT_SYS();
+ DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
+ TRACE_REGS();
+ printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
+ M.x86.R_CS, M.x86.R_IP - 3, op2, (mod << 6) | (rh << 3) | rl);
+ HALT_SYS();
}
switch (mod) {
case 0:
@@ -1828,22 +1894,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
TRACE_AND_STEP();
bit = shift & 0x1F;
srcval = fetch_data_long(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 5:
- store_data_long(srcoffset, srcval | mask);
- break;
- case 6:
- store_data_long(srcoffset, srcval & ~mask);
- break;
- case 7:
- store_data_long(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
- } else {
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ switch (rh) {
+ case 5:
+ store_data_long(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_long(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_long(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ }
+ else {
u16 srcval, mask;
u8 shift;
@@ -1853,21 +1920,21 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
TRACE_AND_STEP();
bit = shift & 0xF;
srcval = fetch_data_word(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 5:
- store_data_word(srcoffset, srcval | mask);
- break;
- case 6:
- store_data_word(srcoffset, srcval & ~mask);
- break;
- case 7:
- store_data_word(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ switch (rh) {
+ case 5:
+ store_data_word(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_word(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_word(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
}
break;
case 1:
@@ -1881,22 +1948,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
TRACE_AND_STEP();
bit = shift & 0x1F;
srcval = fetch_data_long(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 5:
- store_data_long(srcoffset, srcval | mask);
- break;
- case 6:
- store_data_long(srcoffset, srcval & ~mask);
- break;
- case 7:
- store_data_long(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
- } else {
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ switch (rh) {
+ case 5:
+ store_data_long(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_long(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_long(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ }
+ else {
u16 srcval, mask;
u8 shift;
@@ -1906,21 +1974,21 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
TRACE_AND_STEP();
bit = shift & 0xF;
srcval = fetch_data_word(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 5:
- store_data_word(srcoffset, srcval | mask);
- break;
- case 6:
- store_data_word(srcoffset, srcval & ~mask);
- break;
- case 7:
- store_data_word(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ switch (rh) {
+ case 5:
+ store_data_word(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_word(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_word(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
}
break;
case 2:
@@ -1934,22 +2002,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
TRACE_AND_STEP();
bit = shift & 0x1F;
srcval = fetch_data_long(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 5:
- store_data_long(srcoffset, srcval | mask);
- break;
- case 6:
- store_data_long(srcoffset, srcval & ~mask);
- break;
- case 7:
- store_data_long(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
- } else {
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ switch (rh) {
+ case 5:
+ store_data_long(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_long(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_long(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ }
+ else {
u16 srcval, mask;
u8 shift;
@@ -1959,74 +2028,75 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
TRACE_AND_STEP();
bit = shift & 0xF;
srcval = fetch_data_word(srcoffset);
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- switch (rh) {
- case 5:
- store_data_word(srcoffset, srcval | mask);
- break;
- case 6:
- store_data_word(srcoffset, srcval & ~mask);
- break;
- case 7:
- store_data_word(srcoffset, srcval ^ mask);
- break;
- default:
- break;
- }
- }
- break;
- case 3: /* register to register */
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ switch (rh) {
+ case 5:
+ store_data_word(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_word(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_word(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 *srcreg;
- u32 mask;
- u8 shift;
+ u32 mask;
+ u8 shift;
srcreg = DECODE_RM_LONG_REGISTER(rl);
DECODE_PRINTF(",");
shift = fetch_byte_imm();
TRACE_AND_STEP();
bit = shift & 0x1F;
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
- switch (rh) {
- case 5:
- *srcreg |= mask;
- break;
- case 6:
- *srcreg &= ~mask;
- break;
- case 7:
- *srcreg ^= mask;
- break;
- default:
- break;
- }
- } else {
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
+ switch (rh) {
+ case 5:
+ *srcreg |= mask;
+ break;
+ case 6:
+ *srcreg &= ~mask;
+ break;
+ case 7:
+ *srcreg ^= mask;
+ break;
+ default:
+ break;
+ }
+ }
+ else {
u16 *srcreg;
- u16 mask;
- u8 shift;
+ u16 mask;
+ u8 shift;
srcreg = DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF(",");
shift = fetch_byte_imm();
TRACE_AND_STEP();
bit = shift & 0xF;
- mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
- switch (rh) {
- case 5:
- *srcreg |= mask;
- break;
- case 6:
- *srcreg &= ~mask;
- break;
- case 7:
- *srcreg ^= mask;
- break;
- default:
- break;
- }
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
+ switch (rh) {
+ case 5:
+ *srcreg |= mask;
+ break;
+ case 6:
+ *srcreg &= ~mask;
+ break;
+ case 7:
+ *srcreg ^= mask;
+ break;
+ default:
+ break;
+ }
}
break;
}
@@ -2038,11 +2108,12 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xbb
****************************************************************************/
-static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
- int bit,disp;
+ int bit, disp;
START_OF_INSTR();
DECODE_PRINTF("BTC\t");
@@ -2050,7 +2121,7 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
switch (mod) {
case 0:
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
+ u32 srcval, mask;
u32 *shiftreg;
srcoffset = decode_rm00_address(rl);
@@ -2058,13 +2129,14 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval ^ mask);
- } else {
- u16 srcval,mask;
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_long(srcoffset + disp, srcval ^ mask);
+ }
+ else {
+ u16 srcval, mask;
u16 *shiftreg;
srcoffset = decode_rm00_address(rl);
@@ -2072,16 +2144,16 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_word(srcoffset + disp, (u16) (srcval ^ mask));
}
break;
case 1:
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
+ u32 srcval, mask;
u32 *shiftreg;
srcoffset = decode_rm01_address(rl);
@@ -2089,13 +2161,14 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval ^ mask);
- } else {
- u16 srcval,mask;
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_long(srcoffset + disp, srcval ^ mask);
+ }
+ else {
+ u16 srcval, mask;
u16 *shiftreg;
srcoffset = decode_rm01_address(rl);
@@ -2103,16 +2176,16 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_word(srcoffset + disp, (u16) (srcval ^ mask));
}
break;
case 2:
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval,mask;
+ u32 srcval, mask;
u32 *shiftreg;
srcoffset = decode_rm10_address(rl);
@@ -2120,13 +2193,14 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_LONG_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
- disp = (s16)*shiftreg >> 5;
- srcval = fetch_data_long(srcoffset+disp);
+ disp = (s16) * shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset + disp);
mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_long(srcoffset+disp, srcval ^ mask);
- } else {
- u16 srcval,mask;
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_long(srcoffset + disp, srcval ^ mask);
+ }
+ else {
+ u16 srcval, mask;
u16 *shiftreg;
srcoffset = decode_rm10_address(rl);
@@ -2134,16 +2208,16 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
shiftreg = DECODE_RM_WORD_REGISTER(rh);
TRACE_AND_STEP();
bit = *shiftreg & 0xF;
- disp = (s16)*shiftreg >> 4;
- srcval = fetch_data_word(srcoffset+disp);
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
- store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
+ disp = (s16) * shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset + disp);
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
+ store_data_word(srcoffset + disp, (u16) (srcval ^ mask));
}
break;
- case 3: /* register to register */
+ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 *srcreg,*shiftreg;
+ u32 *srcreg, *shiftreg;
u32 mask;
srcreg = DECODE_RM_LONG_REGISTER(rl);
@@ -2152,19 +2226,20 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
TRACE_AND_STEP();
bit = *shiftreg & 0x1F;
mask = (0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
- *srcreg ^= mask;
- } else {
- u16 *srcreg,*shiftreg;
- u16 mask;
-
- srcreg = DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- shiftreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- bit = *shiftreg & 0xF;
- mask = (u16)(0x1 << bit);
- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
+ *srcreg ^= mask;
+ }
+ else {
+ u16 *srcreg, *shiftreg;
+ u16 mask;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ mask = (u16) (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
*srcreg ^= mask;
}
break;
@@ -2177,7 +2252,8 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xbc
****************************************************************************/
-static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -2185,105 +2261,117 @@ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
START_OF_INSTR();
DECODE_PRINTF("BSF\t");
FETCH_DECODE_MODRM(mod, rh, rl);
- switch(mod) {
+ switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, *dstreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_long(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
- if ((srcval >> *dstreg) & 1) break;
- } else {
- u16 srcval, *dstreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_word(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
- if ((srcval >> *dstreg) & 1) break;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, *dstreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_long(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
- if ((srcval >> *dstreg) & 1) break;
- } else {
- u16 srcval, *dstreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_word(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
- if ((srcval >> *dstreg) & 1) break;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, *dstreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_long(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
- if ((srcval >> *dstreg) & 1) break;
- } else {
- u16 srcval, *dstreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_word(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
- if ((srcval >> *dstreg) & 1) break;
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, *dstreg;
-
- srcval = *DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
- if ((srcval >> *dstreg) & 1) break;
- } else {
- u16 srcval, *dstreg;
-
- srcval = *DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
- if ((srcval >> *dstreg) & 1) break;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcval = *DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ else {
+ u16 srcval, *dstreg;
+
+ srcval = *DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2293,7 +2381,8 @@ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xbd
****************************************************************************/
-static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -2301,105 +2390,117 @@ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
START_OF_INSTR();
DECODE_PRINTF("BSR\t");
FETCH_DECODE_MODRM(mod, rh, rl);
- switch(mod) {
+ switch (mod) {
case 0:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, *dstreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_long(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
- if ((srcval >> *dstreg) & 1) break;
- } else {
- u16 srcval, *dstreg;
-
- srcoffset = decode_rm00_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_word(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
- if ((srcval >> *dstreg) & 1) break;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ break;
case 1:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, *dstreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_long(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
- if ((srcval >> *dstreg) & 1) break;
- } else {
- u16 srcval, *dstreg;
-
- srcoffset = decode_rm01_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_word(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
- if ((srcval >> *dstreg) & 1) break;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ break;
case 2:
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, *dstreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_long(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
- if ((srcval >> *dstreg) & 1) break;
- } else {
- u16 srcval, *dstreg;
-
- srcoffset = decode_rm10_address(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- srcval = fetch_data_word(srcoffset);
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
- if ((srcval >> *dstreg) & 1) break;
- }
- break;
- case 3: /* register to register */
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- u32 srcval, *dstreg;
-
- srcval = *DECODE_RM_LONG_REGISTER(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_LONG_REGISTER(rh);
- TRACE_AND_STEP();
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
- if ((srcval >> *dstreg) & 1) break;
- } else {
- u16 srcval, *dstreg;
-
- srcval = *DECODE_RM_WORD_REGISTER(rl);
- DECODE_PRINTF(",");
- dstreg = DECODE_RM_WORD_REGISTER(rh);
- TRACE_AND_STEP();
- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
- if ((srcval >> *dstreg) & 1) break;
- }
- break;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcval = *DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ else {
+ u16 srcval, *dstreg;
+
+ srcval = *DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1)
+ break;
+ }
+ break;
}
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
@@ -2409,7 +2510,8 @@ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xbe
****************************************************************************/
-static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -2426,18 +2528,19 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm00_address(rl);
- srcval = (s32)((s8)fetch_data_byte(srcoffset));
+ srcval = (s32) ((s8) fetch_data_byte(srcoffset));
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
- } else {
+ }
+ else {
u16 *destreg;
u16 srcval;
destreg = DECODE_RM_WORD_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm00_address(rl);
- srcval = (s16)((s8)fetch_data_byte(srcoffset));
+ srcval = (s16) ((s8) fetch_data_byte(srcoffset));
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
@@ -2451,18 +2554,19 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm01_address(rl);
- srcval = (s32)((s8)fetch_data_byte(srcoffset));
+ srcval = (s32) ((s8) fetch_data_byte(srcoffset));
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
- } else {
+ }
+ else {
u16 *destreg;
u16 srcval;
destreg = DECODE_RM_WORD_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm01_address(rl);
- srcval = (s16)((s8)fetch_data_byte(srcoffset));
+ srcval = (s16) ((s8) fetch_data_byte(srcoffset));
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
@@ -2476,44 +2580,46 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm10_address(rl);
- srcval = (s32)((s8)fetch_data_byte(srcoffset));
+ srcval = (s32) ((s8) fetch_data_byte(srcoffset));
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
- } else {
+ }
+ else {
u16 *destreg;
u16 srcval;
destreg = DECODE_RM_WORD_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm10_address(rl);
- srcval = (s16)((s8)fetch_data_byte(srcoffset));
+ srcval = (s16) ((s8) fetch_data_byte(srcoffset));
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
}
break;
- case 3: /* register to register */
+ case 3: /* register to register */
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
u32 *destreg;
- u8 *srcreg;
+ u8 *srcreg;
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcreg = DECODE_RM_BYTE_REGISTER(rl);
DECODE_PRINTF("\n");
TRACE_AND_STEP();
- *destreg = (s32)((s8)*srcreg);
- } else {
+ *destreg = (s32) ((s8) * srcreg);
+ }
+ else {
u16 *destreg;
- u8 *srcreg;
+ u8 *srcreg;
destreg = DECODE_RM_WORD_REGISTER(rh);
DECODE_PRINTF(",");
srcreg = DECODE_RM_BYTE_REGISTER(rl);
DECODE_PRINTF("\n");
TRACE_AND_STEP();
- *destreg = (s16)((s8)*srcreg);
+ *destreg = (s16) ((s8) * srcreg);
}
break;
}
@@ -2525,7 +2631,8 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
REMARKS:
Handles opcode 0x0f,0xbf
****************************************************************************/
-static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
{
int mod, rl, rh;
uint srcoffset;
@@ -2541,7 +2648,7 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm00_address(rl);
- srcval = (s32)((s16)fetch_data_word(srcoffset));
+ srcval = (s32) ((s16) fetch_data_word(srcoffset));
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
@@ -2550,7 +2657,7 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm01_address(rl);
- srcval = (s32)((s16)fetch_data_word(srcoffset));
+ srcval = (s32) ((s16) fetch_data_word(srcoffset));
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
@@ -2559,18 +2666,18 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcoffset = decode_rm10_address(rl);
- srcval = (s32)((s16)fetch_data_word(srcoffset));
+ srcval = (s32) ((s16) fetch_data_word(srcoffset));
DECODE_PRINTF("\n");
TRACE_AND_STEP();
*destreg = srcval;
break;
- case 3: /* register to register */
+ case 3: /* register to register */
destreg = DECODE_RM_LONG_REGISTER(rh);
DECODE_PRINTF(",");
srcreg = DECODE_RM_WORD_REGISTER(rl);
DECODE_PRINTF("\n");
TRACE_AND_STEP();
- *destreg = (s32)((s16)*srcreg);
+ *destreg = (s32) ((s16) * srcreg);
break;
}
DECODE_CLEAR_SEGOVR();
@@ -2578,40 +2685,41 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
}
/* Handles opcodes 0xc8-0xcf */
-static void x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
+static void
+x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
{
START_OF_INSTR();
DECODE_PRINTF("BSWAP\n");
TRACE_AND_STEP();
switch (op2) {
- case 0xc8:
- M.x86.R_EAX = bswap_32(M.x86.R_EAX);
- break;
- case 0xc9:
- M.x86.R_ECX = bswap_32(M.x86.R_ECX);
- break;
- case 0xca:
- M.x86.R_EDX = bswap_32(M.x86.R_EDX);
- break;
- case 0xcb:
- M.x86.R_EBX = bswap_32(M.x86.R_EBX);
- break;
- case 0xcc:
- M.x86.R_ESP = bswap_32(M.x86.R_ESP);
- break;
- case 0xcd:
- M.x86.R_EBP = bswap_32(M.x86.R_EBP);
- break;
- case 0xce:
- M.x86.R_ESI = bswap_32(M.x86.R_ESI);
- break;
- case 0xcf:
- M.x86.R_EDI = bswap_32(M.x86.R_EDI);
- break;
- default:
- /* can't happen */
- break;
+ case 0xc8:
+ M.x86.R_EAX = bswap_32(M.x86.R_EAX);
+ break;
+ case 0xc9:
+ M.x86.R_ECX = bswap_32(M.x86.R_ECX);
+ break;
+ case 0xca:
+ M.x86.R_EDX = bswap_32(M.x86.R_EDX);
+ break;
+ case 0xcb:
+ M.x86.R_EBX = bswap_32(M.x86.R_EBX);
+ break;
+ case 0xcc:
+ M.x86.R_ESP = bswap_32(M.x86.R_ESP);
+ break;
+ case 0xcd:
+ M.x86.R_EBP = bswap_32(M.x86.R_EBP);
+ break;
+ case 0xce:
+ M.x86.R_ESI = bswap_32(M.x86.R_ESI);
+ break;
+ case 0xcf:
+ M.x86.R_EDI = bswap_32(M.x86.R_EDI);
+ break;
+ default:
+ /* can't happen */
+ break;
}
DECODE_CLEAR_SEGOVR();
@@ -2621,25 +2729,32 @@ static void x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
/***************************************************************************
* Double byte operation code table:
**************************************************************************/
-void (*x86emu_optab2[256])(u8) =
-{
-/* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */
-/* 0x01 */ x86emuOp2_illegal_op, /* Group G (ring 0 PM) */
-/* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */
-/* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */
+void (*x86emu_optab2[256]) (u8) = {
+ /* 0x00 */ x86emuOp2_illegal_op,
+ /* Group F (ring 0 PM) */
+ /* 0x01 */ x86emuOp2_illegal_op,
+ /* Group G (ring 0 PM) */
+ /* 0x02 */ x86emuOp2_illegal_op,
+ /* lar (ring 0 PM) */
+ /* 0x03 */ x86emuOp2_illegal_op,
+ /* lsl (ring 0 PM) */
/* 0x04 */ x86emuOp2_illegal_op,
-/* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
-/* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */
-/* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
-/* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */
-/* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */
+ /* 0x05 */ x86emuOp2_illegal_op,
+ /* loadall (undocumented) */
+ /* 0x06 */ x86emuOp2_illegal_op,
+ /* clts (ring 0 PM) */
+ /* 0x07 */ x86emuOp2_illegal_op,
+ /* loadall (undocumented) */
+ /* 0x08 */ x86emuOp2_illegal_op,
+ /* invd (ring 0 PM) */
+ /* 0x09 */ x86emuOp2_illegal_op,
+ /* wbinvd (ring 0 PM) */
/* 0x0a */ x86emuOp2_illegal_op,
/* 0x0b */ x86emuOp2_illegal_op,
/* 0x0c */ x86emuOp2_illegal_op,
/* 0x0d */ x86emuOp2_illegal_op,
/* 0x0e */ x86emuOp2_illegal_op,
/* 0x0f */ x86emuOp2_illegal_op,
-
/* 0x10 */ x86emuOp2_illegal_op,
/* 0x11 */ x86emuOp2_illegal_op,
/* 0x12 */ x86emuOp2_illegal_op,
@@ -2656,14 +2771,19 @@ void (*x86emu_optab2[256])(u8) =
/* 0x1d */ x86emuOp2_illegal_op,
/* 0x1e */ x86emuOp2_illegal_op,
/* 0x1f */ x86emuOp2_illegal_op,
-
-/* 0x20 */ x86emuOp2_illegal_op, /* mov reg32,creg (ring 0 PM) */
-/* 0x21 */ x86emuOp2_illegal_op, /* mov reg32,dreg (ring 0 PM) */
-/* 0x22 */ x86emuOp2_illegal_op, /* mov creg,reg32 (ring 0 PM) */
-/* 0x23 */ x86emuOp2_illegal_op, /* mov dreg,reg32 (ring 0 PM) */
-/* 0x24 */ x86emuOp2_illegal_op, /* mov reg32,treg (ring 0 PM) */
+ /* 0x20 */ x86emuOp2_illegal_op,
+ /* mov reg32,creg (ring 0 PM) */
+ /* 0x21 */ x86emuOp2_illegal_op,
+ /* mov reg32,dreg (ring 0 PM) */
+ /* 0x22 */ x86emuOp2_illegal_op,
+ /* mov creg,reg32 (ring 0 PM) */
+ /* 0x23 */ x86emuOp2_illegal_op,
+ /* mov dreg,reg32 (ring 0 PM) */
+ /* 0x24 */ x86emuOp2_illegal_op,
+ /* mov reg32,treg (ring 0 PM) */
/* 0x25 */ x86emuOp2_illegal_op,
-/* 0x26 */ x86emuOp2_illegal_op, /* mov treg,reg32 (ring 0 PM) */
+ /* 0x26 */ x86emuOp2_illegal_op,
+ /* mov treg,reg32 (ring 0 PM) */
/* 0x27 */ x86emuOp2_illegal_op,
/* 0x28 */ x86emuOp2_illegal_op,
/* 0x29 */ x86emuOp2_illegal_op,
@@ -2673,7 +2793,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0x2d */ x86emuOp2_illegal_op,
/* 0x2e */ x86emuOp2_illegal_op,
/* 0x2f */ x86emuOp2_illegal_op,
-
/* 0x30 */ x86emuOp2_illegal_op,
/* 0x31 */ x86emuOp2_rdtsc,
/* 0x32 */ x86emuOp2_illegal_op,
@@ -2690,7 +2809,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0x3d */ x86emuOp2_illegal_op,
/* 0x3e */ x86emuOp2_illegal_op,
/* 0x3f */ x86emuOp2_illegal_op,
-
/* 0x40 */ x86emuOp2_illegal_op,
/* 0x41 */ x86emuOp2_illegal_op,
/* 0x42 */ x86emuOp2_illegal_op,
@@ -2707,7 +2825,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0x4d */ x86emuOp2_illegal_op,
/* 0x4e */ x86emuOp2_illegal_op,
/* 0x4f */ x86emuOp2_illegal_op,
-
/* 0x50 */ x86emuOp2_illegal_op,
/* 0x51 */ x86emuOp2_illegal_op,
/* 0x52 */ x86emuOp2_illegal_op,
@@ -2724,7 +2841,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0x5d */ x86emuOp2_illegal_op,
/* 0x5e */ x86emuOp2_illegal_op,
/* 0x5f */ x86emuOp2_illegal_op,
-
/* 0x60 */ x86emuOp2_illegal_op,
/* 0x61 */ x86emuOp2_illegal_op,
/* 0x62 */ x86emuOp2_illegal_op,
@@ -2741,7 +2857,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0x6d */ x86emuOp2_illegal_op,
/* 0x6e */ x86emuOp2_illegal_op,
/* 0x6f */ x86emuOp2_illegal_op,
-
/* 0x70 */ x86emuOp2_illegal_op,
/* 0x71 */ x86emuOp2_illegal_op,
/* 0x72 */ x86emuOp2_illegal_op,
@@ -2758,7 +2873,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0x7d */ x86emuOp2_illegal_op,
/* 0x7e */ x86emuOp2_illegal_op,
/* 0x7f */ x86emuOp2_illegal_op,
-
/* 0x80 */ x86emuOp2_long_jump,
/* 0x81 */ x86emuOp2_long_jump,
/* 0x82 */ x86emuOp2_long_jump,
@@ -2775,7 +2889,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0x8d */ x86emuOp2_long_jump,
/* 0x8e */ x86emuOp2_long_jump,
/* 0x8f */ x86emuOp2_long_jump,
-
/* 0x90 */ x86emuOp2_set_byte,
/* 0x91 */ x86emuOp2_set_byte,
/* 0x92 */ x86emuOp2_set_byte,
@@ -2792,7 +2905,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0x9d */ x86emuOp2_set_byte,
/* 0x9e */ x86emuOp2_set_byte,
/* 0x9f */ x86emuOp2_set_byte,
-
/* 0xa0 */ x86emuOp2_push_FS,
/* 0xa1 */ x86emuOp2_pop_FS,
/* 0xa2 */ x86emuOp2_cpuid,
@@ -2809,9 +2921,10 @@ void (*x86emu_optab2[256])(u8) =
/* 0xad */ x86emuOp2_shrd_CL,
/* 0xae */ x86emuOp2_illegal_op,
/* 0xaf */ x86emuOp2_imul_R_RM,
-
-/* 0xb0 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
-/* 0xb1 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
+ /* 0xb0 */ x86emuOp2_illegal_op,
+ /* TODO: cmpxchg */
+ /* 0xb1 */ x86emuOp2_illegal_op,
+ /* TODO: cmpxchg */
/* 0xb2 */ x86emuOp2_lss_R_IMM,
/* 0xb3 */ x86emuOp2_btr_R,
/* 0xb4 */ x86emuOp2_lfs_R_IMM,
@@ -2826,9 +2939,10 @@ void (*x86emu_optab2[256])(u8) =
/* 0xbd */ x86emuOp2_bsr,
/* 0xbe */ x86emuOp2_movsx_byte_R_RM,
/* 0xbf */ x86emuOp2_movsx_word_R_RM,
-
-/* 0xc0 */ x86emuOp2_illegal_op, /* TODO: xadd */
-/* 0xc1 */ x86emuOp2_illegal_op, /* TODO: xadd */
+ /* 0xc0 */ x86emuOp2_illegal_op,
+ /* TODO: xadd */
+ /* 0xc1 */ x86emuOp2_illegal_op,
+ /* TODO: xadd */
/* 0xc2 */ x86emuOp2_illegal_op,
/* 0xc3 */ x86emuOp2_illegal_op,
/* 0xc4 */ x86emuOp2_illegal_op,
@@ -2843,7 +2957,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0xcd */ x86emuOp2_bswap,
/* 0xce */ x86emuOp2_bswap,
/* 0xcf */ x86emuOp2_bswap,
-
/* 0xd0 */ x86emuOp2_illegal_op,
/* 0xd1 */ x86emuOp2_illegal_op,
/* 0xd2 */ x86emuOp2_illegal_op,
@@ -2860,7 +2973,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0xdd */ x86emuOp2_illegal_op,
/* 0xde */ x86emuOp2_illegal_op,
/* 0xdf */ x86emuOp2_illegal_op,
-
/* 0xe0 */ x86emuOp2_illegal_op,
/* 0xe1 */ x86emuOp2_illegal_op,
/* 0xe2 */ x86emuOp2_illegal_op,
@@ -2877,7 +2989,6 @@ void (*x86emu_optab2[256])(u8) =
/* 0xed */ x86emuOp2_illegal_op,
/* 0xee */ x86emuOp2_illegal_op,
/* 0xef */ x86emuOp2_illegal_op,
-
/* 0xf0 */ x86emuOp2_illegal_op,
/* 0xf1 */ x86emuOp2_illegal_op,
/* 0xf2 */ x86emuOp2_illegal_op,
diff --git a/xorg-server/hw/xfree86/x86emu/prim_ops.c b/xorg-server/hw/xfree86/x86emu/prim_ops.c
index 4a6ac5deb..24f76b47f 100644
--- a/xorg-server/hw/xfree86/x86emu/prim_ops.c
+++ b/xorg-server/hw/xfree86/x86emu/prim_ops.c
@@ -103,23 +103,22 @@
#include "x86emu/x86emui.h"
#if defined(__GNUC__)
-# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__)
-# include "x86emu/prim_x86_gcc.h"
-# endif
+#if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__)
+#include "x86emu/prim_x86_gcc.h"
+#endif
#endif
/*------------------------- Global Variables ------------------------------*/
-static u32 x86emu_parity_tab[8] =
-{
- 0x96696996,
- 0x69969669,
- 0x69969669,
- 0x96696996,
- 0x69969669,
- 0x96696996,
- 0x96696996,
- 0x69969669,
+static u32 x86emu_parity_tab[8] = {
+ 0x96696996,
+ 0x69969669,
+ 0x69969669,
+ 0x96696996,
+ 0x69969669,
+ 0x96696996,
+ 0x96696996,
+ 0x69969669,
};
#define PARITY(x) (((x86emu_parity_tab[(x) / 32] >> ((x) % 32)) & 1) == 0)
@@ -131,88 +130,96 @@ static u32 x86emu_parity_tab[8] =
REMARKS:
Implements the AAA instruction and side effects.
****************************************************************************/
-u16 aaa_word(u16 d)
+u16
+aaa_word(u16 d)
{
- u16 res;
- if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
- d += 0x6;
- d += 0x100;
- SET_FLAG(F_AF);
- SET_FLAG(F_CF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- }
- res = (u16)(d & 0xFF0F);
- CLEAR_FLAG(F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- return res;
+ u16 res;
+
+ if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
+ d += 0x6;
+ d += 0x100;
+ SET_FLAG(F_AF);
+ SET_FLAG(F_CF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ }
+ res = (u16) (d & 0xFF0F);
+ CLEAR_FLAG(F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the AAA instruction and side effects.
****************************************************************************/
-u16 aas_word(u16 d)
+u16
+aas_word(u16 d)
{
- u16 res;
- if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
- d -= 0x6;
- d -= 0x100;
- SET_FLAG(F_AF);
- SET_FLAG(F_CF);
- } else {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- }
- res = (u16)(d & 0xFF0F);
- CLEAR_FLAG(F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- return res;
+ u16 res;
+
+ if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
+ d -= 0x6;
+ d -= 0x100;
+ SET_FLAG(F_AF);
+ SET_FLAG(F_CF);
+ }
+ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ }
+ res = (u16) (d & 0xFF0F);
+ CLEAR_FLAG(F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the AAD instruction and side effects.
****************************************************************************/
-u16 aad_word(u16 d)
+u16
+aad_word(u16 d)
{
- u16 l;
- u8 hb, lb;
+ u16 l;
+ u8 hb, lb;
- hb = (u8)((d >> 8) & 0xff);
- lb = (u8)((d & 0xff));
- l = (u16)((lb + 10 * hb) & 0xFF);
+ hb = (u8) ((d >> 8) & 0xff);
+ lb = (u8) ((d & 0xff));
+ l = (u16) ((lb + 10 * hb) & 0xFF);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- CLEAR_FLAG(F_OF);
- CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(l == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
- return l;
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(l == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
+ return l;
}
/****************************************************************************
REMARKS:
Implements the AAM instruction and side effects.
****************************************************************************/
-u16 aam_word(u8 d)
+u16
+aam_word(u8 d)
{
u16 h, l;
- h = (u16)(d / 10);
- l = (u16)(d % 10);
- l |= (u16)(h << 8);
+ h = (u16) (d / 10);
+ l = (u16) (d % 10);
+ l |= (u16) (h << 8);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- CLEAR_FLAG(F_OF);
- CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(l == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(l == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
return l;
}
@@ -220,155 +227,161 @@ u16 aam_word(u8 d)
REMARKS:
Implements the ADC instruction and side effects.
****************************************************************************/
-u8 adc_byte(u8 d, u8 s)
+u8
+adc_byte(u8 d, u8 s)
{
- register u32 res; /* all operands in native machine order */
- register u32 cc;
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
- if (ACCESS_FLAG(F_CF))
- res = 1 + d + s;
- else
- res = d + s;
+ if (ACCESS_FLAG(F_CF))
+ res = 1 + d + s;
+ else
+ res = d + s;
- CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the carry chain SEE NOTE AT TOP. */
- cc = (s & d) | ((~res) & (s | d));
- CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
- return (u8)res;
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the ADC instruction and side effects.
****************************************************************************/
-u16 adc_word(u16 d, u16 s)
+u16
+adc_word(u16 d, u16 s)
{
- register u32 res; /* all operands in native machine order */
- register u32 cc;
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
- if (ACCESS_FLAG(F_CF))
- res = 1 + d + s;
- else
- res = d + s;
+ if (ACCESS_FLAG(F_CF))
+ res = 1 + d + s;
+ else
+ res = d + s;
- CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the carry chain SEE NOTE AT TOP. */
- cc = (s & d) | ((~res) & (s | d));
- CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
- return (u16)res;
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the ADC instruction and side effects.
****************************************************************************/
-u32 adc_long(u32 d, u32 s)
+u32
+adc_long(u32 d, u32 s)
{
- register u32 lo; /* all operands in native machine order */
- register u32 hi;
- register u32 res;
- register u32 cc;
+ register u32 lo; /* all operands in native machine order */
+ register u32 hi;
+ register u32 res;
+ register u32 cc;
- if (ACCESS_FLAG(F_CF)) {
- lo = 1 + (d & 0xFFFF) + (s & 0xFFFF);
- res = 1 + d + s;
- }
- else {
- lo = (d & 0xFFFF) + (s & 0xFFFF);
- res = d + s;
- }
- hi = (lo >> 16) + (d >> 16) + (s >> 16);
+ if (ACCESS_FLAG(F_CF)) {
+ lo = 1 + (d & 0xFFFF) + (s & 0xFFFF);
+ res = 1 + d + s;
+ }
+ else {
+ lo = (d & 0xFFFF) + (s & 0xFFFF);
+ res = d + s;
+ }
+ hi = (lo >> 16) + (d >> 16) + (s >> 16);
- CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the carry chain SEE NOTE AT TOP. */
- cc = (s & d) | ((~res) & (s | d));
- CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
- return res;
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the ADD instruction and side effects.
****************************************************************************/
-u8 add_byte(u8 d, u8 s)
+u8
+add_byte(u8 d, u8 s)
{
- register u32 res; /* all operands in native machine order */
- register u32 cc;
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
- res = d + s;
- CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ res = d + s;
+ CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the carry chain SEE NOTE AT TOP. */
- cc = (s & d) | ((~res) & (s | d));
- CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
- return (u8)res;
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the ADD instruction and side effects.
****************************************************************************/
-u16 add_word(u16 d, u16 s)
+u16
+add_word(u16 d, u16 s)
{
- register u32 res; /* all operands in native machine order */
- register u32 cc;
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
- res = d + s;
- CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ res = d + s;
+ CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the carry chain SEE NOTE AT TOP. */
- cc = (s & d) | ((~res) & (s | d));
- CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
- return (u16)res;
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the ADD instruction and side effects.
****************************************************************************/
-u32 add_long(u32 d, u32 s)
+u32
+add_long(u32 d, u32 s)
{
- register u32 lo; /* all operands in native machine order */
- register u32 hi;
- register u32 res;
- register u32 cc;
+ register u32 lo; /* all operands in native machine order */
+ register u32 hi;
+ register u32 res;
+ register u32 cc;
- lo = (d & 0xFFFF) + (s & 0xFFFF);
- res = d + s;
- hi = (lo >> 16) + (d >> 16) + (s >> 16);
+ lo = (d & 0xFFFF) + (s & 0xFFFF);
+ res = d + s;
+ hi = (lo >> 16) + (d >> 16) + (s >> 16);
- CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
/* calculate the carry chain SEE NOTE AT TOP. */
cc = (s & d) | ((~res) & (s | d));
- CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
return res;
}
@@ -377,39 +390,41 @@ u32 add_long(u32 d, u32 s)
REMARKS:
Implements the AND instruction and side effects.
****************************************************************************/
-u8 and_byte(u8 d, u8 s)
+u8
+and_byte(u8 d, u8 s)
{
- register u8 res; /* all operands in native machine order */
+ register u8 res; /* all operands in native machine order */
- res = d & s;
+ res = d & s;
- /* set the flags */
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
- return res;
+ /* set the flags */
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the AND instruction and side effects.
****************************************************************************/
-u16 and_word(u16 d, u16 s)
+u16
+and_word(u16 d, u16 s)
{
- register u16 res; /* all operands in native machine order */
+ register u16 res; /* all operands in native machine order */
res = d & s;
/* set the flags */
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
return res;
}
@@ -417,433 +432,456 @@ u16 and_word(u16 d, u16 s)
REMARKS:
Implements the AND instruction and side effects.
****************************************************************************/
-u32 and_long(u32 d, u32 s)
+u32
+and_long(u32 d, u32 s)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
- res = d & s;
+ res = d & s;
- /* set the flags */
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- return res;
+ /* set the flags */
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the CMP instruction and side effects.
****************************************************************************/
-u8 cmp_byte(u8 d, u8 s)
+u8
+cmp_byte(u8 d, u8 s)
{
- register u32 res; /* all operands in native machine order */
- register u32 bc;
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
- res = d - s;
- CLEAR_FLAG(F_CF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ res = d - s;
+ CLEAR_FLAG(F_CF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the borrow chain. See note at top */
- bc = (res & (~d | s)) | (~d & s);
- CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return d;
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return d;
}
/****************************************************************************
REMARKS:
Implements the CMP instruction and side effects.
****************************************************************************/
-u16 cmp_word(u16 d, u16 s)
+u16
+cmp_word(u16 d, u16 s)
{
- register u32 res; /* all operands in native machine order */
- register u32 bc;
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
- res = d - s;
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the borrow chain. See note at top */
+ /* calculate the borrow chain. See note at top */
bc = (res & (~d | s)) | (~d & s);
- CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return d;
+ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return d;
}
/****************************************************************************
REMARKS:
Implements the CMP instruction and side effects.
****************************************************************************/
-u32 cmp_long(u32 d, u32 s)
+u32
+cmp_long(u32 d, u32 s)
{
- register u32 res; /* all operands in native machine order */
- register u32 bc;
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
- res = d - s;
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the borrow chain. See note at top */
- bc = (res & (~d | s)) | (~d & s);
- CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return d;
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return d;
}
/****************************************************************************
REMARKS:
Implements the DAA instruction and side effects.
****************************************************************************/
-u8 daa_byte(u8 d)
+u8
+daa_byte(u8 d)
{
- u32 res = d;
- if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
- res += 6;
- SET_FLAG(F_AF);
- }
- if (res > 0x9F || ACCESS_FLAG(F_CF)) {
- res += 0x60;
- SET_FLAG(F_CF);
- }
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xFF) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- return (u8)res;
+ u32 res = d;
+
+ if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
+ res += 6;
+ SET_FLAG(F_AF);
+ }
+ if (res > 0x9F || ACCESS_FLAG(F_CF)) {
+ res += 0x60;
+ SET_FLAG(F_CF);
+ }
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xFF) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the DAS instruction and side effects.
****************************************************************************/
-u8 das_byte(u8 d)
+u8
+das_byte(u8 d)
{
- if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
- d -= 6;
- SET_FLAG(F_AF);
- }
- if (d > 0x9F || ACCESS_FLAG(F_CF)) {
- d -= 0x60;
- SET_FLAG(F_CF);
- }
- CONDITIONAL_SET_FLAG(d & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(d == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(d & 0xff), F_PF);
- return d;
+ if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
+ d -= 6;
+ SET_FLAG(F_AF);
+ }
+ if (d > 0x9F || ACCESS_FLAG(F_CF)) {
+ d -= 0x60;
+ SET_FLAG(F_CF);
+ }
+ CONDITIONAL_SET_FLAG(d & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(d == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(d & 0xff), F_PF);
+ return d;
}
/****************************************************************************
REMARKS:
Implements the DEC instruction and side effects.
****************************************************************************/
-u8 dec_byte(u8 d)
+u8
+dec_byte(u8 d)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
register u32 bc;
res = d - 1;
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the borrow chain. See note at top */
- /* based on sub_byte, uses s==1. */
- bc = (res & (~d | 1)) | (~d & 1);
- /* carry flag unchanged */
- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return (u8)res;
+ /* calculate the borrow chain. See note at top */
+ /* based on sub_byte, uses s==1. */
+ bc = (res & (~d | 1)) | (~d & 1);
+ /* carry flag unchanged */
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the DEC instruction and side effects.
****************************************************************************/
-u16 dec_word(u16 d)
+u16
+dec_word(u16 d)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
register u32 bc;
res = d - 1;
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
/* calculate the borrow chain. See note at top */
/* based on the sub_byte routine, with s==1 */
bc = (res & (~d | 1)) | (~d & 1);
/* carry flag unchanged */
- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return (u16)res;
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the DEC instruction and side effects.
****************************************************************************/
-u32 dec_long(u32 d)
+u32
+dec_long(u32 d)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
register u32 bc;
res = d - 1;
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
/* calculate the borrow chain. See note at top */
- bc = (res & (~d | 1)) | (~d & 1);
- /* carry flag unchanged */
- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return res;
+ bc = (res & (~d | 1)) | (~d & 1);
+ /* carry flag unchanged */
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the INC instruction and side effects.
****************************************************************************/
-u8 inc_byte(u8 d)
+u8
+inc_byte(u8 d)
{
- register u32 res; /* all operands in native machine order */
- register u32 cc;
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
- res = d + 1;
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ res = d + 1;
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the carry chain SEE NOTE AT TOP. */
- cc = ((1 & d) | (~res)) & (1 | d);
- CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
- return (u8)res;
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = ((1 & d) | (~res)) & (1 | d);
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the INC instruction and side effects.
****************************************************************************/
-u16 inc_word(u16 d)
+u16
+inc_word(u16 d)
{
- register u32 res; /* all operands in native machine order */
- register u32 cc;
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
- res = d + 1;
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ res = d + 1;
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the carry chain SEE NOTE AT TOP. */
- cc = (1 & d) | ((~res) & (1 | d));
- CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
- return (u16)res;
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (1 & d) | ((~res) & (1 | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the INC instruction and side effects.
****************************************************************************/
-u32 inc_long(u32 d)
+u32
+inc_long(u32 d)
{
- register u32 res; /* all operands in native machine order */
- register u32 cc;
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
- res = d + 1;
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ res = d + 1;
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the carry chain SEE NOTE AT TOP. */
- cc = (1 & d) | ((~res) & (1 | d));
- CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
- return res;
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (1 & d) | ((~res) & (1 | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the OR instruction and side effects.
****************************************************************************/
-u8 or_byte(u8 d, u8 s)
+u8
+or_byte(u8 d, u8 s)
{
- register u8 res; /* all operands in native machine order */
+ register u8 res; /* all operands in native machine order */
- res = d | s;
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
- return res;
+ res = d | s;
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the OR instruction and side effects.
****************************************************************************/
-u16 or_word(u16 d, u16 s)
+u16
+or_word(u16 d, u16 s)
{
- register u16 res; /* all operands in native machine order */
+ register u16 res; /* all operands in native machine order */
- res = d | s;
- /* set the carry flag to be bit 8 */
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- return res;
+ res = d | s;
+ /* set the carry flag to be bit 8 */
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the OR instruction and side effects.
****************************************************************************/
-u32 or_long(u32 d, u32 s)
+u32
+or_long(u32 d, u32 s)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
- res = d | s;
+ res = d | s;
- /* set the carry flag to be bit 8 */
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- return res;
+ /* set the carry flag to be bit 8 */
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the OR instruction and side effects.
****************************************************************************/
-u8 neg_byte(u8 s)
+u8
+neg_byte(u8 s)
{
register u8 res;
register u8 bc;
- CONDITIONAL_SET_FLAG(s != 0, F_CF);
- res = (u8)-s;
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
- /* calculate the borrow chain --- modified such that d=0.
- substitutiing d=0 into bc= res&(~d|s)|(~d&s);
- (the one used for sub) and simplifying, since ~d=0xff...,
- ~d|s == 0xffff..., and res&0xfff... == res. Similarly
- ~d&s == s. So the simplified result is: */
- bc = res | s;
- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return res;
+ CONDITIONAL_SET_FLAG(s != 0, F_CF);
+ res = (u8) - s;
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+ /* calculate the borrow chain --- modified such that d=0.
+ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
+ (the one used for sub) and simplifying, since ~d=0xff...,
+ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
+ ~d&s == s. So the simplified result is: */
+ bc = res | s;
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the OR instruction and side effects.
****************************************************************************/
-u16 neg_word(u16 s)
-{
- register u16 res;
- register u16 bc;
-
- CONDITIONAL_SET_FLAG(s != 0, F_CF);
- res = (u16)-s;
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
-
- /* calculate the borrow chain --- modified such that d=0.
- substitutiing d=0 into bc= res&(~d|s)|(~d&s);
- (the one used for sub) and simplifying, since ~d=0xff...,
- ~d|s == 0xffff..., and res&0xfff... == res. Similarly
- ~d&s == s. So the simplified result is: */
- bc = res | s;
- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return res;
+u16
+neg_word(u16 s)
+{
+ register u16 res;
+ register u16 bc;
+
+ CONDITIONAL_SET_FLAG(s != 0, F_CF);
+ res = (u16) - s;
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain --- modified such that d=0.
+ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
+ (the one used for sub) and simplifying, since ~d=0xff...,
+ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
+ ~d&s == s. So the simplified result is: */
+ bc = res | s;
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the OR instruction and side effects.
****************************************************************************/
-u32 neg_long(u32 s)
+u32
+neg_long(u32 s)
{
- register u32 res;
- register u32 bc;
-
- CONDITIONAL_SET_FLAG(s != 0, F_CF);
- res = (u32)-s;
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ register u32 res;
+ register u32 bc;
- /* calculate the borrow chain --- modified such that d=0.
- substitutiing d=0 into bc= res&(~d|s)|(~d&s);
- (the one used for sub) and simplifying, since ~d=0xff...,
- ~d|s == 0xffff..., and res&0xfff... == res. Similarly
- ~d&s == s. So the simplified result is: */
- bc = res | s;
- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return res;
+ CONDITIONAL_SET_FLAG(s != 0, F_CF);
+ res = (u32) - s;
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain --- modified such that d=0.
+ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
+ (the one used for sub) and simplifying, since ~d=0xff...,
+ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
+ ~d&s == s. So the simplified result is: */
+ bc = res | s;
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the NOT instruction and side effects.
****************************************************************************/
-u8 not_byte(u8 s)
+u8
+not_byte(u8 s)
{
- return ~s;
+ return ~s;
}
/****************************************************************************
REMARKS:
Implements the NOT instruction and side effects.
****************************************************************************/
-u16 not_word(u16 s)
+u16
+not_word(u16 s)
{
- return ~s;
+ return ~s;
}
/****************************************************************************
REMARKS:
Implements the NOT instruction and side effects.
****************************************************************************/
-u32 not_long(u32 s)
+u32
+not_long(u32 s)
{
- return ~s;
+ return ~s;
}
/****************************************************************************
REMARKS:
Implements the RCL instruction and side effects.
****************************************************************************/
-u8 rcl_byte(u8 d, u8 s)
+u8
+rcl_byte(u8 d, u8 s)
{
register unsigned int res, cnt, mask, cf;
/* s is the rotate distance. It varies from 0 - 8. */
- /* have
+ /* have
CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0
@@ -867,9 +905,9 @@ u8 rcl_byte(u8 d, u8 s)
2) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0
3) B_(n-1) <- cf
4) B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1))
- */
- res = d;
- if ((cnt = s % 9) != 0) {
+ */
+ res = d;
+ if ((cnt = s % 9) != 0) {
/* extract the new CARRY FLAG. */
/* CF <- b_(8-n) */
cf = (d >> (8 - cnt)) & 0x1;
@@ -878,7 +916,7 @@ u8 rcl_byte(u8 d, u8 s)
into the range B_7 .. B_cnt */
/* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0 */
/* note that the right hand side done by the mask */
- res = (d << cnt) & 0xff;
+ res = (d << cnt) & 0xff;
/* now the high stuff which rotated around
into the positions B_cnt-2 .. B_0 */
@@ -890,81 +928,81 @@ u8 rcl_byte(u8 d, u8 s)
res |= (d >> (9 - cnt)) & mask;
/* if the carry flag was set, or it in. */
- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
/* B_(n-1) <- cf */
res |= 1 << (cnt - 1);
}
/* set the new carry flag, based on the variable "cf" */
- CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG(cf, F_CF);
/* OVERFLOW is set *IFF* cnt==1, then it is the
xor of CF and the most significant bit. Blecck. */
/* parenthesized this expression since it appears to
be causing OF to be misset */
- CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)),
- F_OF);
+ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)), F_OF);
}
- return (u8)res;
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the RCL instruction and side effects.
****************************************************************************/
-u16 rcl_word(u16 d, u8 s)
+u16
+rcl_word(u16 d, u8 s)
{
- register unsigned int res, cnt, mask, cf;
+ register unsigned int res, cnt, mask, cf;
- res = d;
- if ((cnt = s % 17) != 0) {
- cf = (d >> (16 - cnt)) & 0x1;
- res = (d << cnt) & 0xffff;
- mask = (1 << (cnt - 1)) - 1;
- res |= (d >> (17 - cnt)) & mask;
- if (ACCESS_FLAG(F_CF)) {
- res |= 1 << (cnt - 1);
- }
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 14) & 0x2)),
- F_OF);
- }
- return (u16)res;
+ res = d;
+ if ((cnt = s % 17) != 0) {
+ cf = (d >> (16 - cnt)) & 0x1;
+ res = (d << cnt) & 0xffff;
+ mask = (1 << (cnt - 1)) - 1;
+ res |= (d >> (17 - cnt)) & mask;
+ if (ACCESS_FLAG(F_CF)) {
+ res |= 1 << (cnt - 1);
+ }
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 14) & 0x2)), F_OF);
+ }
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the RCL instruction and side effects.
****************************************************************************/
-u32 rcl_long(u32 d, u8 s)
+u32
+rcl_long(u32 d, u8 s)
{
- register u32 res, cnt, mask, cf;
+ register u32 res, cnt, mask, cf;
- res = d;
- if ((cnt = s % 33) != 0) {
- cf = (d >> (32 - cnt)) & 0x1;
- res = (d << cnt) & 0xffffffff;
- mask = (1 << (cnt - 1)) - 1;
- res |= (d >> (33 - cnt)) & mask;
- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
- res |= 1 << (cnt - 1);
- }
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 30) & 0x2)),
- F_OF);
- }
- return res;
+ res = d;
+ if ((cnt = s % 33) != 0) {
+ cf = (d >> (32 - cnt)) & 0x1;
+ res = (d << cnt) & 0xffffffff;
+ mask = (1 << (cnt - 1)) - 1;
+ res |= (d >> (33 - cnt)) & mask;
+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+ res |= 1 << (cnt - 1);
+ }
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 30) & 0x2)), F_OF);
+ }
+ return res;
}
/****************************************************************************
REMARKS:
Implements the RCR instruction and side effects.
****************************************************************************/
-u8 rcr_byte(u8 d, u8 s)
+u8
+rcr_byte(u8 d, u8 s)
{
- u32 res, cnt;
- u32 mask, cf, ocf = 0;
+ u32 res, cnt;
+ u32 mask, cf, ocf = 0;
- /* rotate right through carry */
+ /* rotate right through carry */
/*
s is the rotate distance. It varies from 0 - 8.
d is the byte object rotated.
@@ -985,9 +1023,9 @@ u8 rcr_byte(u8 d, u8 s)
2) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n)
3) B_(8-n) <- cf
4) B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0)
- */
- res = d;
- if ((cnt = s % 9) != 0) {
+ */
+ res = d;
+ if ((cnt = s % 9) != 0) {
/* extract the new CARRY FLAG. */
/* CF <- b_(n-1) */
if (cnt == 1) {
@@ -996,11 +1034,12 @@ u8 rcr_byte(u8 d, u8 s)
0 if flag not set
non-zero if flag is set.
doing access_flag(..) != 0 casts that into either
- 0..1 in any representation of the flags register
+ 0..1 in any representation of the flags register
(i.e. packed bit array or unpacked.)
*/
- ocf = ACCESS_FLAG(F_CF) != 0;
- } else
+ ocf = ACCESS_FLAG(F_CF) != 0;
+ }
+ else
cf = (d >> (cnt - 1)) & 0x1;
/* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_n */
@@ -1022,93 +1061,95 @@ u8 rcr_byte(u8 d, u8 s)
res |= (d << (9 - cnt));
/* if the carry flag was set, or it in. */
- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
/* B_(8-n) <- cf */
res |= 1 << (8 - cnt);
}
/* set the new carry flag, based on the variable "cf" */
- CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG(cf, F_CF);
/* OVERFLOW is set *IFF* cnt==1, then it is the
xor of CF and the most significant bit. Blecck. */
/* parenthesized... */
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 6) & 0x2)),
- F_OF);
- }
- }
- return (u8)res;
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 6) & 0x2)), F_OF);
+ }
+ }
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the RCR instruction and side effects.
****************************************************************************/
-u16 rcr_word(u16 d, u8 s)
+u16
+rcr_word(u16 d, u8 s)
{
- u32 res, cnt;
- u32 mask, cf, ocf = 0;
+ u32 res, cnt;
+ u32 mask, cf, ocf = 0;
- /* rotate right through carry */
- res = d;
- if ((cnt = s % 17) != 0) {
- if (cnt == 1) {
- cf = d & 0x1;
- ocf = ACCESS_FLAG(F_CF) != 0;
- } else
- cf = (d >> (cnt - 1)) & 0x1;
- mask = (1 << (16 - cnt)) - 1;
- res = (d >> cnt) & mask;
- res |= (d << (17 - cnt));
- if (ACCESS_FLAG(F_CF)) {
- res |= 1 << (16 - cnt);
- }
- CONDITIONAL_SET_FLAG(cf, F_CF);
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 14) & 0x2)),
- F_OF);
- }
- }
- return (u16)res;
+ /* rotate right through carry */
+ res = d;
+ if ((cnt = s % 17) != 0) {
+ if (cnt == 1) {
+ cf = d & 0x1;
+ ocf = ACCESS_FLAG(F_CF) != 0;
+ }
+ else
+ cf = (d >> (cnt - 1)) & 0x1;
+ mask = (1 << (16 - cnt)) - 1;
+ res = (d >> cnt) & mask;
+ res |= (d << (17 - cnt));
+ if (ACCESS_FLAG(F_CF)) {
+ res |= 1 << (16 - cnt);
+ }
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 14) & 0x2)), F_OF);
+ }
+ }
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the RCR instruction and side effects.
****************************************************************************/
-u32 rcr_long(u32 d, u8 s)
-{
- u32 res, cnt;
- u32 mask, cf, ocf = 0;
-
- /* rotate right through carry */
- res = d;
- if ((cnt = s % 33) != 0) {
- if (cnt == 1) {
- cf = d & 0x1;
- ocf = ACCESS_FLAG(F_CF) != 0;
- } else
- cf = (d >> (cnt - 1)) & 0x1;
- mask = (1 << (32 - cnt)) - 1;
- res = (d >> cnt) & mask;
- if (cnt != 1)
- res |= (d << (33 - cnt));
- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
- res |= 1 << (32 - cnt);
- }
- CONDITIONAL_SET_FLAG(cf, F_CF);
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 30) & 0x2)),
- F_OF);
- }
- }
- return res;
+u32
+rcr_long(u32 d, u8 s)
+{
+ u32 res, cnt;
+ u32 mask, cf, ocf = 0;
+
+ /* rotate right through carry */
+ res = d;
+ if ((cnt = s % 33) != 0) {
+ if (cnt == 1) {
+ cf = d & 0x1;
+ ocf = ACCESS_FLAG(F_CF) != 0;
+ }
+ else
+ cf = (d >> (cnt - 1)) & 0x1;
+ mask = (1 << (32 - cnt)) - 1;
+ res = (d >> cnt) & mask;
+ if (cnt != 1)
+ res |= (d << (33 - cnt));
+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+ res |= 1 << (32 - cnt);
+ }
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 30) & 0x2)), F_OF);
+ }
+ }
+ return res;
}
/****************************************************************************
REMARKS:
Implements the ROL instruction and side effects.
****************************************************************************/
-u8 rol_byte(u8 d, u8 s)
+u8
+rol_byte(u8 d, u8 s)
{
register unsigned int res, cnt, mask;
@@ -1127,87 +1168,90 @@ u8 rol_byte(u8 d, u8 s)
IF n > 0
1) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0)
2) B_(n-1) .. B_(0) <- b_(7) .. b_(8-n)
- */
+ */
res = d;
- if ((cnt = s % 8) != 0) {
- /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) */
- res = (d << cnt);
+ if ((cnt = s % 8) != 0) {
+ /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) */
+ res = (d << cnt);
- /* B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) */
- mask = (1 << cnt) - 1;
- res |= (d >> (8 - cnt)) & mask;
+ /* B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) */
+ mask = (1 << cnt) - 1;
+ res |= (d >> (8 - cnt)) & mask;
- /* set the new carry flag, Note that it is the low order
- bit of the result!!! */
- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
- /* OVERFLOW is set *IFF* s==1, then it is the
- xor of CF and the most significant bit. Blecck. */
- CONDITIONAL_SET_FLAG(s == 1 &&
- XOR2((res & 0x1) + ((res >> 6) & 0x2)),
- F_OF);
- } if (s != 0) {
- /* set the new carry flag, Note that it is the low order
- bit of the result!!! */
- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
- }
- return (u8)res;
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ /* OVERFLOW is set *IFF* s==1, then it is the
+ xor of CF and the most significant bit. Blecck. */
+ CONDITIONAL_SET_FLAG(s == 1 &&
+ XOR2((res & 0x1) + ((res >> 6) & 0x2)), F_OF);
+ }
+ if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ }
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the ROL instruction and side effects.
****************************************************************************/
-u16 rol_word(u16 d, u8 s)
+u16
+rol_word(u16 d, u8 s)
{
register unsigned int res, cnt, mask;
- res = d;
- if ((cnt = s % 16) != 0) {
- res = (d << cnt);
- mask = (1 << cnt) - 1;
- res |= (d >> (16 - cnt)) & mask;
- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
- CONDITIONAL_SET_FLAG(s == 1 &&
- XOR2((res & 0x1) + ((res >> 14) & 0x2)),
- F_OF);
- } if (s != 0) {
- /* set the new carry flag, Note that it is the low order
- bit of the result!!! */
- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
- }
- return (u16)res;
+ res = d;
+ if ((cnt = s % 16) != 0) {
+ res = (d << cnt);
+ mask = (1 << cnt) - 1;
+ res |= (d >> (16 - cnt)) & mask;
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ CONDITIONAL_SET_FLAG(s == 1 &&
+ XOR2((res & 0x1) + ((res >> 14) & 0x2)), F_OF);
+ }
+ if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ }
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the ROL instruction and side effects.
****************************************************************************/
-u32 rol_long(u32 d, u8 s)
+u32
+rol_long(u32 d, u8 s)
{
register u32 res, cnt, mask;
- res = d;
- if ((cnt = s % 32) != 0) {
- res = (d << cnt);
- mask = (1 << cnt) - 1;
- res |= (d >> (32 - cnt)) & mask;
- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
- CONDITIONAL_SET_FLAG(s == 1 &&
- XOR2((res & 0x1) + ((res >> 30) & 0x2)),
- F_OF);
- } if (s != 0) {
- /* set the new carry flag, Note that it is the low order
- bit of the result!!! */
- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
- }
- return res;
+ res = d;
+ if ((cnt = s % 32) != 0) {
+ res = (d << cnt);
+ mask = (1 << cnt) - 1;
+ res |= (d >> (32 - cnt)) & mask;
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ CONDITIONAL_SET_FLAG(s == 1 &&
+ XOR2((res & 0x1) + ((res >> 30) & 0x2)), F_OF);
+ }
+ if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ }
+ return res;
}
/****************************************************************************
REMARKS:
Implements the ROR instruction and side effects.
****************************************************************************/
-u8 ror_byte(u8 d, u8 s)
+u8
+ror_byte(u8 d, u8 s)
{
register unsigned int res, cnt, mask;
@@ -1225,9 +1269,9 @@ u8 ror_byte(u8 d, u8 s)
IF n > 0
1) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n)
2) B_(7) .. B_(8-n) <- b_(n-1) .. b_(0)
- */
- res = d;
- if ((cnt = s % 8) != 0) { /* not a typo, do nada if cnt==0 */
+ */
+ res = d;
+ if ((cnt = s % 8) != 0) { /* not a typo, do nada if cnt==0 */
/* B_(7) .. B_(8-n) <- b_(n-1) .. b_(0) */
res = (d << (8 - cnt));
@@ -1237,291 +1281,317 @@ u8 ror_byte(u8 d, u8 s)
/* set the new carry flag, Note that it is the low order
bit of the result!!! */
- CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
- /* OVERFLOW is set *IFF* s==1, then it is the
+ CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
+ /* OVERFLOW is set *IFF* s==1, then it is the
xor of the two most significant bits. Blecck. */
- CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF);
- } else if (s != 0) {
- /* set the new carry flag, Note that it is the low order
- bit of the result!!! */
- CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
- }
- return (u8)res;
+ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF);
+ }
+ else if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
+ }
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the ROR instruction and side effects.
****************************************************************************/
-u16 ror_word(u16 d, u8 s)
+u16
+ror_word(u16 d, u8 s)
{
register unsigned int res, cnt, mask;
- res = d;
- if ((cnt = s % 16) != 0) {
- res = (d << (16 - cnt));
- mask = (1 << (16 - cnt)) - 1;
- res |= (d >> (cnt)) & mask;
- CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
- CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF);
- } else if (s != 0) {
- /* set the new carry flag, Note that it is the low order
- bit of the result!!! */
- CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
- }
- return (u16)res;
+ res = d;
+ if ((cnt = s % 16) != 0) {
+ res = (d << (16 - cnt));
+ mask = (1 << (16 - cnt)) - 1;
+ res |= (d >> (cnt)) & mask;
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
+ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF);
+ }
+ else if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
+ }
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the ROR instruction and side effects.
****************************************************************************/
-u32 ror_long(u32 d, u8 s)
+u32
+ror_long(u32 d, u8 s)
{
- register u32 res, cnt, mask;
+ register u32 res, cnt, mask;
- res = d;
- if ((cnt = s % 32) != 0) {
- res = (d << (32 - cnt));
- mask = (1 << (32 - cnt)) - 1;
- res |= (d >> (cnt)) & mask;
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
- CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF);
- } else if (s != 0) {
- /* set the new carry flag, Note that it is the low order
- bit of the result!!! */
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
- }
- return res;
+ res = d;
+ if ((cnt = s % 32) != 0) {
+ res = (d << (32 - cnt));
+ mask = (1 << (32 - cnt)) - 1;
+ res |= (d >> (cnt)) & mask;
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
+ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF);
+ }
+ else if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
+ }
+ return res;
}
/****************************************************************************
REMARKS:
Implements the SHL instruction and side effects.
****************************************************************************/
-u8 shl_byte(u8 d, u8 s)
+u8
+shl_byte(u8 d, u8 s)
{
- unsigned int cnt, res, cf;
-
- if (s < 8) {
- cnt = s % 8;
+ unsigned int cnt, res, cf;
- /* last bit shifted out goes into carry flag */
- if (cnt > 0) {
- res = d << cnt;
- cf = d & (1 << (8 - cnt));
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
- res = (u8) d;
- }
+ if (s < 8) {
+ cnt = s % 8;
+
+ /* last bit shifted out goes into carry flag */
+ if (cnt > 0) {
+ res = d << cnt;
+ cf = d & (1 << (8 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else {
+ res = (u8) d;
+ }
- if (cnt == 1) {
- /* Needs simplification. */
- CONDITIONAL_SET_FLAG(
- (((res & 0x80) == 0x80) ^
- (ACCESS_FLAG(F_CF) != 0)),
- /* was (M.x86.R_FLG&F_CF)==F_CF)), */
- F_OF);
- } else {
- CLEAR_FLAG(F_OF);
- }
- } else {
- res = 0;
- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80, F_CF);
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_SF);
- SET_FLAG(F_PF);
- SET_FLAG(F_ZF);
+ if (cnt == 1) {
+ /* Needs simplification. */
+ CONDITIONAL_SET_FLAG((((res & 0x80) == 0x80) ^
+ (ACCESS_FLAG(F_CF) != 0)),
+ /* was (M.x86.R_FLG&F_CF)==F_CF)), */
+ F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_OF);
+ }
}
- return (u8)res;
+ else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the SHL instruction and side effects.
****************************************************************************/
-u16 shl_word(u16 d, u8 s)
+u16
+shl_word(u16 d, u8 s)
{
unsigned int cnt, res, cf;
- if (s < 16) {
- cnt = s % 16;
- if (cnt > 0) {
- res = d << cnt;
- cf = d & (1 << (16 - cnt));
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
- res = (u16) d;
- }
-
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG(
- (((res & 0x8000) == 0x8000) ^
- (ACCESS_FLAG(F_CF) != 0)),
- F_OF);
- } else {
- CLEAR_FLAG(F_OF);
- }
- } else {
- res = 0;
- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF);
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_SF);
- SET_FLAG(F_PF);
- SET_FLAG(F_ZF);
- }
- return (u16)res;
+ if (s < 16) {
+ cnt = s % 16;
+ if (cnt > 0) {
+ res = d << cnt;
+ cf = d & (1 << (16 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else {
+ res = (u16) d;
+ }
+
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^
+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_OF);
+ }
+ }
+ else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x8000, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the SHL instruction and side effects.
****************************************************************************/
-u32 shl_long(u32 d, u8 s)
-{
- unsigned int cnt, res, cf;
-
- if (s < 32) {
- cnt = s % 32;
- if (cnt > 0) {
- res = d << cnt;
- cf = d & (1 << (32 - cnt));
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
- res = d;
- }
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
- (ACCESS_FLAG(F_CF) != 0)), F_OF);
- } else {
- CLEAR_FLAG(F_OF);
- }
- } else {
- res = 0;
- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80000000, F_CF);
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_SF);
- SET_FLAG(F_PF);
- SET_FLAG(F_ZF);
- }
- return res;
+u32
+shl_long(u32 d, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 32) {
+ cnt = s % 32;
+ if (cnt > 0) {
+ res = d << cnt;
+ cf = d & (1 << (32 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else {
+ res = d;
+ }
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_OF);
+ }
+ }
+ else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80000000, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return res;
}
/****************************************************************************
REMARKS:
Implements the SHR instruction and side effects.
****************************************************************************/
-u8 shr_byte(u8 d, u8 s)
-{
- unsigned int cnt, res, cf;
-
- if (s < 8) {
- cnt = s % 8;
- if (cnt > 0) {
- cf = d & (1 << (cnt - 1));
- res = d >> cnt;
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
- res = (u8) d;
- }
-
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG(XOR2(res >> 6), F_OF);
- } else {
- CLEAR_FLAG(F_OF);
- }
- } else {
- res = 0;
- CONDITIONAL_SET_FLAG((d >> (s-1)) & 0x1, F_CF);
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_SF);
- SET_FLAG(F_PF);
- SET_FLAG(F_ZF);
- }
- return (u8)res;
+u8
+shr_byte(u8 d, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 8) {
+ cnt = s % 8;
+ if (cnt > 0) {
+ cf = d & (1 << (cnt - 1));
+ res = d >> cnt;
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else {
+ res = (u8) d;
+ }
+
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(res >> 6), F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_OF);
+ }
+ }
+ else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d >> (s - 1)) & 0x1, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the SHR instruction and side effects.
****************************************************************************/
-u16 shr_word(u16 d, u8 s)
+u16
+shr_word(u16 d, u8 s)
{
- unsigned int cnt, res, cf;
+ unsigned int cnt, res, cf;
- if (s < 16) {
- cnt = s % 16;
- if (cnt > 0) {
- cf = d & (1 << (cnt - 1));
- res = d >> cnt;
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
- res = d;
- }
+ if (s < 16) {
+ cnt = s % 16;
+ if (cnt > 0) {
+ cf = d & (1 << (cnt - 1));
+ res = d >> cnt;
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else {
+ res = d;
+ }
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
- } else {
- CLEAR_FLAG(F_OF);
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
}
- } else {
- res = 0;
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- SET_FLAG(F_ZF);
- CLEAR_FLAG(F_SF);
- CLEAR_FLAG(F_PF);
+ else {
+ CLEAR_FLAG(F_OF);
+ }
+ }
+ else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
}
- return (u16)res;
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the SHR instruction and side effects.
****************************************************************************/
-u32 shr_long(u32 d, u8 s)
+u32
+shr_long(u32 d, u8 s)
{
- unsigned int cnt, res, cf;
+ unsigned int cnt, res, cf;
- if (s < 32) {
- cnt = s % 32;
- if (cnt > 0) {
- cf = d & (1 << (cnt - 1));
- res = d >> cnt;
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
+ if (s < 32) {
+ cnt = s % 32;
+ if (cnt > 0) {
+ cf = d & (1 << (cnt - 1));
+ res = d >> cnt;
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else {
res = d;
}
if (cnt == 1) {
- CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
- } else {
- CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_OF);
}
- } else {
+ }
+ else {
res = 0;
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- SET_FLAG(F_ZF);
- CLEAR_FLAG(F_SF);
- CLEAR_FLAG(F_PF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
}
return res;
}
@@ -1530,592 +1600,634 @@ u32 shr_long(u32 d, u8 s)
REMARKS:
Implements the SAR instruction and side effects.
****************************************************************************/
-u8 sar_byte(u8 d, u8 s)
+u8
+sar_byte(u8 d, u8 s)
{
- unsigned int cnt, res, cf, mask, sf;
+ unsigned int cnt, res, cf, mask, sf;
- res = d;
- sf = d & 0x80;
+ res = d;
+ sf = d & 0x80;
cnt = s % 8;
- if (cnt > 0 && cnt < 8) {
- mask = (1 << (8 - cnt)) - 1;
- cf = d & (1 << (cnt - 1));
- res = (d >> cnt) & mask;
- CONDITIONAL_SET_FLAG(cf, F_CF);
- if (sf) {
- res |= ~mask;
- }
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- } else if (cnt >= 8) {
+ if (cnt > 0 && cnt < 8) {
+ mask = (1 << (8 - cnt)) - 1;
+ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) & mask;
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ if (sf) {
+ res |= ~mask;
+ }
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ }
+ else if (cnt >= 8) {
if (sf) {
res = 0xff;
- SET_FLAG(F_CF);
- CLEAR_FLAG(F_ZF);
- SET_FLAG(F_SF);
- SET_FLAG(F_PF);
- } else {
- res = 0;
- CLEAR_FLAG(F_CF);
- SET_FLAG(F_ZF);
- CLEAR_FLAG(F_SF);
- CLEAR_FLAG(F_PF);
- }
- }
- return (u8)res;
+ SET_FLAG(F_CF);
+ CLEAR_FLAG(F_ZF);
+ SET_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ }
+ else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
+ }
+ }
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the SAR instruction and side effects.
****************************************************************************/
-u16 sar_word(u16 d, u8 s)
+u16
+sar_word(u16 d, u8 s)
{
unsigned int cnt, res, cf, mask, sf;
sf = d & 0x8000;
cnt = s % 16;
- res = d;
- if (cnt > 0 && cnt < 16) {
+ res = d;
+ if (cnt > 0 && cnt < 16) {
mask = (1 << (16 - cnt)) - 1;
cf = d & (1 << (cnt - 1));
res = (d >> cnt) & mask;
- CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG(cf, F_CF);
if (sf) {
res |= ~mask;
}
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else if (cnt >= 16) {
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else if (cnt >= 16) {
if (sf) {
res = 0xffff;
- SET_FLAG(F_CF);
- CLEAR_FLAG(F_ZF);
- SET_FLAG(F_SF);
- SET_FLAG(F_PF);
- } else {
+ SET_FLAG(F_CF);
+ CLEAR_FLAG(F_ZF);
+ SET_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ }
+ else {
res = 0;
- CLEAR_FLAG(F_CF);
- SET_FLAG(F_ZF);
- CLEAR_FLAG(F_SF);
- CLEAR_FLAG(F_PF);
+ CLEAR_FLAG(F_CF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
}
}
- return (u16)res;
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the SAR instruction and side effects.
****************************************************************************/
-u32 sar_long(u32 d, u8 s)
+u32
+sar_long(u32 d, u8 s)
{
u32 cnt, res, cf, mask, sf;
sf = d & 0x80000000;
cnt = s % 32;
- res = d;
- if (cnt > 0 && cnt < 32) {
+ res = d;
+ if (cnt > 0 && cnt < 32) {
mask = (1 << (32 - cnt)) - 1;
- cf = d & (1 << (cnt - 1));
+ cf = d & (1 << (cnt - 1));
res = (d >> cnt) & mask;
- CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG(cf, F_CF);
if (sf) {
res |= ~mask;
}
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else if (cnt >= 32) {
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else if (cnt >= 32) {
if (sf) {
res = 0xffffffff;
- SET_FLAG(F_CF);
- CLEAR_FLAG(F_ZF);
- SET_FLAG(F_SF);
- SET_FLAG(F_PF);
- } else {
- res = 0;
- CLEAR_FLAG(F_CF);
- SET_FLAG(F_ZF);
- CLEAR_FLAG(F_SF);
- CLEAR_FLAG(F_PF);
- }
- }
- return res;
+ SET_FLAG(F_CF);
+ CLEAR_FLAG(F_ZF);
+ SET_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ }
+ else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
+ }
+ }
+ return res;
}
/****************************************************************************
REMARKS:
Implements the SHLD instruction and side effects.
****************************************************************************/
-u16 shld_word (u16 d, u16 fill, u8 s)
-{
- unsigned int cnt, res, cf;
-
- if (s < 16) {
- cnt = s % 16;
- if (cnt > 0) {
- res = (d << cnt) | (fill >> (16-cnt));
- cf = d & (1 << (16 - cnt));
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
- res = d;
- }
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^
- (ACCESS_FLAG(F_CF) != 0)), F_OF);
- } else {
- CLEAR_FLAG(F_OF);
- }
- } else {
- res = 0;
- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF);
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_SF);
- SET_FLAG(F_PF);
- SET_FLAG(F_ZF);
- }
- return (u16)res;
+u16
+shld_word(u16 d, u16 fill, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 16) {
+ cnt = s % 16;
+ if (cnt > 0) {
+ res = (d << cnt) | (fill >> (16 - cnt));
+ cf = d & (1 << (16 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else {
+ res = d;
+ }
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^
+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_OF);
+ }
+ }
+ else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x8000, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the SHLD instruction and side effects.
****************************************************************************/
-u32 shld_long (u32 d, u32 fill, u8 s)
-{
- unsigned int cnt, res, cf;
-
- if (s < 32) {
- cnt = s % 32;
- if (cnt > 0) {
- res = (d << cnt) | (fill >> (32-cnt));
- cf = d & (1 << (32 - cnt));
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
- res = d;
- }
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
- (ACCESS_FLAG(F_CF) != 0)), F_OF);
- } else {
- CLEAR_FLAG(F_OF);
- }
- } else {
- res = 0;
- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80000000, F_CF);
- CLEAR_FLAG(F_OF);
- CLEAR_FLAG(F_SF);
- SET_FLAG(F_PF);
- SET_FLAG(F_ZF);
- }
- return res;
+u32
+shld_long(u32 d, u32 fill, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 32) {
+ cnt = s % 32;
+ if (cnt > 0) {
+ res = (d << cnt) | (fill >> (32 - cnt));
+ cf = d & (1 << (32 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else {
+ res = d;
+ }
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_OF);
+ }
+ }
+ else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80000000, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return res;
}
/****************************************************************************
REMARKS:
Implements the SHRD instruction and side effects.
****************************************************************************/
-u16 shrd_word (u16 d, u16 fill, u8 s)
+u16
+shrd_word(u16 d, u16 fill, u8 s)
{
- unsigned int cnt, res, cf;
+ unsigned int cnt, res, cf;
- if (s < 16) {
- cnt = s % 16;
- if (cnt > 0) {
- cf = d & (1 << (cnt - 1));
- res = (d >> cnt) | (fill << (16 - cnt));
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
- res = d;
- }
+ if (s < 16) {
+ cnt = s % 16;
+ if (cnt > 0) {
+ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) | (fill << (16 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ }
+ else {
+ res = d;
+ }
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
- } else {
- CLEAR_FLAG(F_OF);
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_OF);
}
- } else {
- res = 0;
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- SET_FLAG(F_ZF);
- CLEAR_FLAG(F_SF);
- CLEAR_FLAG(F_PF);
}
- return (u16)res;
+ else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
+ }
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the SHRD instruction and side effects.
****************************************************************************/
-u32 shrd_long (u32 d, u32 fill, u8 s)
+u32
+shrd_long(u32 d, u32 fill, u8 s)
{
- unsigned int cnt, res, cf;
+ unsigned int cnt, res, cf;
- if (s < 32) {
- cnt = s % 32;
- if (cnt > 0) {
- cf = d & (1 << (cnt - 1));
- res = (d >> cnt) | (fill << (32 - cnt));
- CONDITIONAL_SET_FLAG(cf, F_CF);
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- } else {
- res = d;
- }
- if (cnt == 1) {
- CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
- } else {
- CLEAR_FLAG(F_OF);
+ if (s < 32) {
+ cnt = s % 32;
+ if (cnt > 0) {
+ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) | (fill << (32 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
}
- } else {
- res = 0;
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- SET_FLAG(F_ZF);
- CLEAR_FLAG(F_SF);
- CLEAR_FLAG(F_PF);
+ else {
+ res = d;
+ }
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
+ }
+ else {
+ CLEAR_FLAG(F_OF);
+ }
+ }
+ else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
}
- return res;
+ return res;
}
/****************************************************************************
REMARKS:
Implements the SBB instruction and side effects.
****************************************************************************/
-u8 sbb_byte(u8 d, u8 s)
+u8
+sbb_byte(u8 d, u8 s)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
register u32 bc;
- if (ACCESS_FLAG(F_CF))
- res = d - s - 1;
- else
- res = d - s;
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ if (ACCESS_FLAG(F_CF))
+ res = d - s - 1;
+ else
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the borrow chain. See note at top */
- bc = (res & (~d | s)) | (~d & s);
- CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return (u8)res;
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the SBB instruction and side effects.
****************************************************************************/
-u16 sbb_word(u16 d, u16 s)
+u16
+sbb_word(u16 d, u16 s)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
register u32 bc;
- if (ACCESS_FLAG(F_CF))
+ if (ACCESS_FLAG(F_CF))
res = d - s - 1;
else
res = d - s;
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the borrow chain. See note at top */
- bc = (res & (~d | s)) | (~d & s);
- CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return (u16)res;
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the SBB instruction and side effects.
****************************************************************************/
-u32 sbb_long(u32 d, u32 s)
+u32
+sbb_long(u32 d, u32 s)
{
- register u32 res; /* all operands in native machine order */
- register u32 bc;
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
- if (ACCESS_FLAG(F_CF))
+ if (ACCESS_FLAG(F_CF))
res = d - s - 1;
else
res = d - s;
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the borrow chain. See note at top */
- bc = (res & (~d | s)) | (~d & s);
- CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return res;
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the SUB instruction and side effects.
****************************************************************************/
-u8 sub_byte(u8 d, u8 s)
+u8
+sub_byte(u8 d, u8 s)
{
- register u32 res; /* all operands in native machine order */
- register u32 bc;
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
- res = d - s;
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the borrow chain. See note at top */
- bc = (res & (~d | s)) | (~d & s);
- CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return (u8)res;
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u8) res;
}
/****************************************************************************
REMARKS:
Implements the SUB instruction and side effects.
****************************************************************************/
-u16 sub_word(u16 d, u16 s)
+u16
+sub_word(u16 d, u16 s)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
register u32 bc;
res = d - s;
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the borrow chain. See note at top */
- bc = (res & (~d | s)) | (~d & s);
- CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return (u16)res;
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u16) res;
}
/****************************************************************************
REMARKS:
Implements the SUB instruction and side effects.
****************************************************************************/
-u32 sub_long(u32 d, u32 s)
+u32
+sub_long(u32 d, u32 s)
{
- register u32 res; /* all operands in native machine order */
- register u32 bc;
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
- res = d - s;
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* calculate the borrow chain. See note at top */
- bc = (res & (~d | s)) | (~d & s);
- CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
- return res;
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the TEST instruction and side effects.
****************************************************************************/
-void test_byte(u8 d, u8 s)
+void
+test_byte(u8 d, u8 s)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
res = d & s;
- CLEAR_FLAG(F_OF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
/* AF == dont care */
- CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_CF);
}
/****************************************************************************
REMARKS:
Implements the TEST instruction and side effects.
****************************************************************************/
-void test_word(u16 d, u16 s)
+void
+test_word(u16 d, u16 s)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
- res = d & s;
+ res = d & s;
- CLEAR_FLAG(F_OF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* AF == dont care */
- CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ /* AF == dont care */
+ CLEAR_FLAG(F_CF);
}
/****************************************************************************
REMARKS:
Implements the TEST instruction and side effects.
****************************************************************************/
-void test_long(u32 d, u32 s)
+void
+test_long(u32 d, u32 s)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
- res = d & s;
+ res = d & s;
- CLEAR_FLAG(F_OF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- /* AF == dont care */
- CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ /* AF == dont care */
+ CLEAR_FLAG(F_CF);
}
/****************************************************************************
REMARKS:
Implements the XOR instruction and side effects.
****************************************************************************/
-u8 xor_byte(u8 d, u8 s)
+u8
+xor_byte(u8 d, u8 s)
{
- register u8 res; /* all operands in native machine order */
+ register u8 res; /* all operands in native machine order */
- res = d ^ s;
- CLEAR_FLAG(F_OF);
- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- return res;
+ res = d ^ s;
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the XOR instruction and side effects.
****************************************************************************/
-u16 xor_word(u16 d, u16 s)
+u16
+xor_word(u16 d, u16 s)
{
- register u16 res; /* all operands in native machine order */
+ register u16 res; /* all operands in native machine order */
- res = d ^ s;
- CLEAR_FLAG(F_OF);
- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- return res;
+ res = d ^ s;
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the XOR instruction and side effects.
****************************************************************************/
-u32 xor_long(u32 d, u32 s)
+u32
+xor_long(u32 d, u32 s)
{
- register u32 res; /* all operands in native machine order */
+ register u32 res; /* all operands in native machine order */
- res = d ^ s;
- CLEAR_FLAG(F_OF);
- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- return res;
+ res = d ^ s;
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ return res;
}
/****************************************************************************
REMARKS:
Implements the IMUL instruction and side effects.
****************************************************************************/
-void imul_byte(u8 s)
+void
+imul_byte(u8 s)
{
- s16 res = (s16)((s8)M.x86.R_AL * (s8)s);
+ s16 res = (s16) ((s8) M.x86.R_AL * (s8) s);
- M.x86.R_AX = res;
- if (((M.x86.R_AL & 0x80) == 0 && M.x86.R_AH == 0x00) ||
- ((M.x86.R_AL & 0x80) != 0 && M.x86.R_AH == 0xFF)) {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- } else {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- }
+ M.x86.R_AX = res;
+ if (((M.x86.R_AL & 0x80) == 0 && M.x86.R_AH == 0x00) ||
+ ((M.x86.R_AL & 0x80) != 0 && M.x86.R_AH == 0xFF)) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
}
/****************************************************************************
REMARKS:
Implements the IMUL instruction and side effects.
****************************************************************************/
-void imul_word(u16 s)
+void
+imul_word(u16 s)
{
- s32 res = (s16)M.x86.R_AX * (s16)s;
+ s32 res = (s16) M.x86.R_AX * (s16) s;
- M.x86.R_AX = (u16)res;
- M.x86.R_DX = (u16)(res >> 16);
- if (((M.x86.R_AX & 0x8000) == 0 && M.x86.R_DX == 0x00) ||
- ((M.x86.R_AX & 0x8000) != 0 && M.x86.R_DX == 0xFF)) {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- } else {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- }
+ M.x86.R_AX = (u16) res;
+ M.x86.R_DX = (u16) (res >> 16);
+ if (((M.x86.R_AX & 0x8000) == 0 && M.x86.R_DX == 0x00) ||
+ ((M.x86.R_AX & 0x8000) != 0 && M.x86.R_DX == 0xFF)) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
}
/****************************************************************************
REMARKS:
Implements the IMUL instruction and side effects.
****************************************************************************/
-void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s)
+void
+imul_long_direct(u32 * res_lo, u32 * res_hi, u32 d, u32 s)
{
#ifdef __HAS_LONG_LONG__
- s64 res = (s64)(s32)d * (s32)s;
+ s64 res = (s64) (s32) d * (s32) s;
- *res_lo = (u32)res;
- *res_hi = (u32)(res >> 32);
+ *res_lo = (u32) res;
+ *res_hi = (u32) (res >> 32);
#else
- u32 d_lo,d_hi,d_sign;
- u32 s_lo,s_hi,s_sign;
- u32 rlo_lo,rlo_hi,rhi_lo;
-
- if ((d_sign = d & 0x80000000) != 0)
- d = -d;
- d_lo = d & 0xFFFF;
- d_hi = d >> 16;
- if ((s_sign = s & 0x80000000) != 0)
- s = -s;
- s_lo = s & 0xFFFF;
- s_hi = s >> 16;
- rlo_lo = d_lo * s_lo;
- rlo_hi = (d_hi * s_lo + d_lo * s_hi) + (rlo_lo >> 16);
- rhi_lo = d_hi * s_hi + (rlo_hi >> 16);
- *res_lo = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
- *res_hi = rhi_lo;
- if (d_sign != s_sign) {
- d = ~*res_lo;
- s = (((d & 0xFFFF) + 1) >> 16) + (d >> 16);
- *res_lo = ~*res_lo+1;
- *res_hi = ~*res_hi+(s >> 16);
- }
+ u32 d_lo, d_hi, d_sign;
+ u32 s_lo, s_hi, s_sign;
+ u32 rlo_lo, rlo_hi, rhi_lo;
+
+ if ((d_sign = d & 0x80000000) != 0)
+ d = -d;
+ d_lo = d & 0xFFFF;
+ d_hi = d >> 16;
+ if ((s_sign = s & 0x80000000) != 0)
+ s = -s;
+ s_lo = s & 0xFFFF;
+ s_hi = s >> 16;
+ rlo_lo = d_lo * s_lo;
+ rlo_hi = (d_hi * s_lo + d_lo * s_hi) + (rlo_lo >> 16);
+ rhi_lo = d_hi * s_hi + (rlo_hi >> 16);
+ *res_lo = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
+ *res_hi = rhi_lo;
+ if (d_sign != s_sign) {
+ d = ~*res_lo;
+ s = (((d & 0xFFFF) + 1) >> 16) + (d >> 16);
+ *res_lo = ~*res_lo + 1;
+ *res_hi = ~*res_hi + (s >> 16);
+ }
#endif
}
@@ -2123,53 +2235,59 @@ void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s)
REMARKS:
Implements the IMUL instruction and side effects.
****************************************************************************/
-void imul_long(u32 s)
+void
+imul_long(u32 s)
{
- imul_long_direct(&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s);
- if (((M.x86.R_EAX & 0x80000000) == 0 && M.x86.R_EDX == 0x00) ||
- ((M.x86.R_EAX & 0x80000000) != 0 && M.x86.R_EDX == 0xFF)) {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- } else {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- }
+ imul_long_direct(&M.x86.R_EAX, &M.x86.R_EDX, M.x86.R_EAX, s);
+ if (((M.x86.R_EAX & 0x80000000) == 0 && M.x86.R_EDX == 0x00) ||
+ ((M.x86.R_EAX & 0x80000000) != 0 && M.x86.R_EDX == 0xFF)) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
}
/****************************************************************************
REMARKS:
Implements the MUL instruction and side effects.
****************************************************************************/
-void mul_byte(u8 s)
+void
+mul_byte(u8 s)
{
- u16 res = (u16)(M.x86.R_AL * s);
+ u16 res = (u16) (M.x86.R_AL * s);
- M.x86.R_AX = res;
- if (M.x86.R_AH == 0) {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- } else {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
- }
+ M.x86.R_AX = res;
+ if (M.x86.R_AH == 0) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
}
/****************************************************************************
REMARKS:
Implements the MUL instruction and side effects.
****************************************************************************/
-void mul_word(u16 s)
+void
+mul_word(u16 s)
{
- u32 res = M.x86.R_AX * s;
+ u32 res = M.x86.R_AX * s;
- M.x86.R_AX = (u16)res;
- M.x86.R_DX = (u16)(res >> 16);
- if (M.x86.R_DX == 0) {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- } else {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
+ M.x86.R_AX = (u16) res;
+ M.x86.R_DX = (u16) (res >> 16);
+ if (M.x86.R_DX == 0) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
}
}
@@ -2177,36 +2295,38 @@ void mul_word(u16 s)
REMARKS:
Implements the MUL instruction and side effects.
****************************************************************************/
-void mul_long(u32 s)
+void
+mul_long(u32 s)
{
#ifdef __HAS_LONG_LONG__
- u64 res = (u64)M.x86.R_EAX * s;
+ u64 res = (u64) M.x86.R_EAX * s;
- M.x86.R_EAX = (u32)res;
- M.x86.R_EDX = (u32)(res >> 32);
+ M.x86.R_EAX = (u32) res;
+ M.x86.R_EDX = (u32) (res >> 32);
#else
- u32 a,a_lo,a_hi;
- u32 s_lo,s_hi;
- u32 rlo_lo,rlo_hi,rhi_lo;
-
- a = M.x86.R_EAX;
- a_lo = a & 0xFFFF;
- a_hi = a >> 16;
- s_lo = s & 0xFFFF;
- s_hi = s >> 16;
- rlo_lo = a_lo * s_lo;
- rlo_hi = (a_hi * s_lo + a_lo * s_hi) + (rlo_lo >> 16);
- rhi_lo = a_hi * s_hi + (rlo_hi >> 16);
- M.x86.R_EAX = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
- M.x86.R_EDX = rhi_lo;
+ u32 a, a_lo, a_hi;
+ u32 s_lo, s_hi;
+ u32 rlo_lo, rlo_hi, rhi_lo;
+
+ a = M.x86.R_EAX;
+ a_lo = a & 0xFFFF;
+ a_hi = a >> 16;
+ s_lo = s & 0xFFFF;
+ s_hi = s >> 16;
+ rlo_lo = a_lo * s_lo;
+ rlo_hi = (a_hi * s_lo + a_lo * s_hi) + (rlo_lo >> 16);
+ rhi_lo = a_hi * s_hi + (rlo_hi >> 16);
+ M.x86.R_EAX = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
+ M.x86.R_EDX = rhi_lo;
#endif
- if (M.x86.R_EDX == 0) {
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_OF);
- } else {
- SET_FLAG(F_CF);
- SET_FLAG(F_OF);
+ if (M.x86.R_EDX == 0) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
}
}
@@ -2214,309 +2334,319 @@ void mul_long(u32 s)
REMARKS:
Implements the IDIV instruction and side effects.
****************************************************************************/
-void idiv_byte(u8 s)
+void
+idiv_byte(u8 s)
{
s32 dvd, div, mod;
- dvd = (s16)M.x86.R_AX;
- if (s == 0) {
- x86emu_intr_raise(0);
+ dvd = (s16) M.x86.R_AX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ div = dvd / (s8) s;
+ mod = dvd % (s8) s;
+ if (abs(div) > 0x7f) {
+ x86emu_intr_raise(0);
return;
- }
- div = dvd / (s8)s;
- mod = dvd % (s8)s;
- if (abs(div) > 0x7f) {
- x86emu_intr_raise(0);
- return;
- }
- M.x86.R_AL = (s8) div;
- M.x86.R_AH = (s8) mod;
+ }
+ M.x86.R_AL = (s8) div;
+ M.x86.R_AH = (s8) mod;
}
/****************************************************************************
REMARKS:
Implements the IDIV instruction and side effects.
****************************************************************************/
-void idiv_word(u16 s)
+void
+idiv_word(u16 s)
{
- s32 dvd, div, mod;
+ s32 dvd, div, mod;
- dvd = (((s32)M.x86.R_DX) << 16) | M.x86.R_AX;
- if (s == 0) {
- x86emu_intr_raise(0);
- return;
- }
- div = dvd / (s16)s;
- mod = dvd % (s16)s;
- if (abs(div) > 0x7fff) {
- x86emu_intr_raise(0);
- return;
- }
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_SF);
- CONDITIONAL_SET_FLAG(div == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+ dvd = (((s32) M.x86.R_DX) << 16) | M.x86.R_AX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ div = dvd / (s16) s;
+ mod = dvd % (s16) s;
+ if (abs(div) > 0x7fff) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_SF);
+ CONDITIONAL_SET_FLAG(div == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
- M.x86.R_AX = (u16)div;
- M.x86.R_DX = (u16)mod;
+ M.x86.R_AX = (u16) div;
+ M.x86.R_DX = (u16) mod;
}
/****************************************************************************
REMARKS:
Implements the IDIV instruction and side effects.
****************************************************************************/
-void idiv_long(u32 s)
+void
+idiv_long(u32 s)
{
#ifdef __HAS_LONG_LONG__
- s64 dvd, div, mod;
-
- dvd = (((s64)M.x86.R_EDX) << 32) | M.x86.R_EAX;
- if (s == 0) {
- x86emu_intr_raise(0);
- return;
- }
- div = dvd / (s32)s;
- mod = dvd % (s32)s;
- if (abs(div) > 0x7fffffff) {
- x86emu_intr_raise(0);
- return;
- }
+ s64 dvd, div, mod;
+
+ dvd = (((s64) M.x86.R_EDX) << 32) | M.x86.R_EAX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ div = dvd / (s32) s;
+ mod = dvd % (s32) s;
+ if (abs(div) > 0x7fffffff) {
+ x86emu_intr_raise(0);
+ return;
+ }
#else
- s32 div = 0, mod;
- s32 h_dvd = M.x86.R_EDX;
- u32 l_dvd = M.x86.R_EAX;
- u32 abs_s = s & 0x7FFFFFFF;
- u32 abs_h_dvd = h_dvd & 0x7FFFFFFF;
- u32 h_s = abs_s >> 1;
- u32 l_s = abs_s << 31;
- int counter = 31;
- int carry;
-
- if (s == 0) {
- x86emu_intr_raise(0);
- return;
- }
- do {
- div <<= 1;
- carry = (l_dvd >= l_s) ? 0 : 1;
-
- if (abs_h_dvd < (h_s + carry)) {
- h_s >>= 1;
- l_s = abs_s << (--counter);
- continue;
- } else {
- abs_h_dvd -= (h_s + carry);
- l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
- : (l_dvd - l_s);
- h_s >>= 1;
- l_s = abs_s << (--counter);
- div |= 1;
- continue;
- }
-
- } while (counter > -1);
- /* overflow */
- if (abs_h_dvd || (l_dvd > abs_s)) {
- x86emu_intr_raise(0);
- return;
- }
- /* sign */
- div |= ((h_dvd & 0x10000000) ^ (s & 0x10000000));
- mod = l_dvd;
+ s32 div = 0, mod;
+ s32 h_dvd = M.x86.R_EDX;
+ u32 l_dvd = M.x86.R_EAX;
+ u32 abs_s = s & 0x7FFFFFFF;
+ u32 abs_h_dvd = h_dvd & 0x7FFFFFFF;
+ u32 h_s = abs_s >> 1;
+ u32 l_s = abs_s << 31;
+ int counter = 31;
+ int carry;
+
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ do {
+ div <<= 1;
+ carry = (l_dvd >= l_s) ? 0 : 1;
+
+ if (abs_h_dvd < (h_s + carry)) {
+ h_s >>= 1;
+ l_s = abs_s << (--counter);
+ continue;
+ }
+ else {
+ abs_h_dvd -= (h_s + carry);
+ l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
+ : (l_dvd - l_s);
+ h_s >>= 1;
+ l_s = abs_s << (--counter);
+ div |= 1;
+ continue;
+ }
+
+ } while (counter > -1);
+ /* overflow */
+ if (abs_h_dvd || (l_dvd > abs_s)) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ /* sign */
+ div |= ((h_dvd & 0x10000000) ^ (s & 0x10000000));
+ mod = l_dvd;
#endif
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- CLEAR_FLAG(F_SF);
- SET_FLAG(F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
- M.x86.R_EAX = (u32)div;
- M.x86.R_EDX = (u32)mod;
+ M.x86.R_EAX = (u32) div;
+ M.x86.R_EDX = (u32) mod;
}
/****************************************************************************
REMARKS:
Implements the DIV instruction and side effects.
****************************************************************************/
-void div_byte(u8 s)
+void
+div_byte(u8 s)
{
- u32 dvd, div, mod;
+ u32 dvd, div, mod;
- dvd = M.x86.R_AX;
+ dvd = M.x86.R_AX;
if (s == 0) {
- x86emu_intr_raise(0);
+ x86emu_intr_raise(0);
return;
}
- div = dvd / (u8)s;
- mod = dvd % (u8)s;
- if (abs(div) > 0xff) {
- x86emu_intr_raise(0);
+ div = dvd / (u8) s;
+ mod = dvd % (u8) s;
+ if (abs(div) > 0xff) {
+ x86emu_intr_raise(0);
return;
- }
- M.x86.R_AL = (u8)div;
- M.x86.R_AH = (u8)mod;
+ }
+ M.x86.R_AL = (u8) div;
+ M.x86.R_AH = (u8) mod;
}
/****************************************************************************
REMARKS:
Implements the DIV instruction and side effects.
****************************************************************************/
-void div_word(u16 s)
+void
+div_word(u16 s)
{
- u32 dvd, div, mod;
+ u32 dvd, div, mod;
- dvd = (((u32)M.x86.R_DX) << 16) | M.x86.R_AX;
- if (s == 0) {
- x86emu_intr_raise(0);
+ dvd = (((u32) M.x86.R_DX) << 16) | M.x86.R_AX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
return;
}
- div = dvd / (u16)s;
- mod = dvd % (u16)s;
- if (abs(div) > 0xffff) {
- x86emu_intr_raise(0);
- return;
- }
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_SF);
- CONDITIONAL_SET_FLAG(div == 0, F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+ div = dvd / (u16) s;
+ mod = dvd % (u16) s;
+ if (abs(div) > 0xffff) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_SF);
+ CONDITIONAL_SET_FLAG(div == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
- M.x86.R_AX = (u16)div;
- M.x86.R_DX = (u16)mod;
+ M.x86.R_AX = (u16) div;
+ M.x86.R_DX = (u16) mod;
}
/****************************************************************************
REMARKS:
Implements the DIV instruction and side effects.
****************************************************************************/
-void div_long(u32 s)
+void
+div_long(u32 s)
{
#ifdef __HAS_LONG_LONG__
- u64 dvd, div, mod;
-
- dvd = (((u64)M.x86.R_EDX) << 32) | M.x86.R_EAX;
- if (s == 0) {
- x86emu_intr_raise(0);
- return;
- }
- div = dvd / (u32)s;
- mod = dvd % (u32)s;
- if (abs(div) > 0xffffffff) {
- x86emu_intr_raise(0);
- return;
- }
+ u64 dvd, div, mod;
+
+ dvd = (((u64) M.x86.R_EDX) << 32) | M.x86.R_EAX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ div = dvd / (u32) s;
+ mod = dvd % (u32) s;
+ if (abs(div) > 0xffffffff) {
+ x86emu_intr_raise(0);
+ return;
+ }
#else
- s32 div = 0, mod;
- s32 h_dvd = M.x86.R_EDX;
- u32 l_dvd = M.x86.R_EAX;
-
- u32 h_s = s;
- u32 l_s = 0;
- int counter = 32;
- int carry;
-
- if (s == 0) {
- x86emu_intr_raise(0);
- return;
- }
- do {
- div <<= 1;
- carry = (l_dvd >= l_s) ? 0 : 1;
-
- if (h_dvd < (h_s + carry)) {
- h_s >>= 1;
- l_s = s << (--counter);
- continue;
- } else {
- h_dvd -= (h_s + carry);
- l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
- : (l_dvd - l_s);
- h_s >>= 1;
- l_s = s << (--counter);
- div |= 1;
- continue;
- }
-
- } while (counter > -1);
- /* overflow */
- if (h_dvd || (l_dvd > s)) {
- x86emu_intr_raise(0);
- return;
- }
- mod = l_dvd;
+ s32 div = 0, mod;
+ s32 h_dvd = M.x86.R_EDX;
+ u32 l_dvd = M.x86.R_EAX;
+
+ u32 h_s = s;
+ u32 l_s = 0;
+ int counter = 32;
+ int carry;
+
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ do {
+ div <<= 1;
+ carry = (l_dvd >= l_s) ? 0 : 1;
+
+ if (h_dvd < (h_s + carry)) {
+ h_s >>= 1;
+ l_s = s << (--counter);
+ continue;
+ }
+ else {
+ h_dvd -= (h_s + carry);
+ l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
+ : (l_dvd - l_s);
+ h_s >>= 1;
+ l_s = s << (--counter);
+ div |= 1;
+ continue;
+ }
+
+ } while (counter > -1);
+ /* overflow */
+ if (h_dvd || (l_dvd > s)) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ mod = l_dvd;
#endif
- CLEAR_FLAG(F_CF);
- CLEAR_FLAG(F_AF);
- CLEAR_FLAG(F_SF);
- SET_FLAG(F_ZF);
- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
- M.x86.R_EAX = (u32)div;
- M.x86.R_EDX = (u32)mod;
+ M.x86.R_EAX = (u32) div;
+ M.x86.R_EDX = (u32) mod;
}
/****************************************************************************
REMARKS:
Implements the IN string instruction and side effects.
****************************************************************************/
-void ins(int size)
+void
+ins(int size)
{
- int inc = size;
+ int inc = size;
- if (ACCESS_FLAG(F_DF)) {
- inc = -size;
- }
- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ if (ACCESS_FLAG(F_DF)) {
+ inc = -size;
+ }
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
/* dont care whether REPE or REPNE */
/* in until CX is ZERO. */
- u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
- M.x86.R_ECX : M.x86.R_CX);
+ u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
+ M.x86.R_ECX : M.x86.R_CX);
switch (size) {
- case 1:
+ case 1:
while (count--) {
- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
- (*sys_inb)(M.x86.R_DX));
- M.x86.R_DI += inc;
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inb) (M.x86.R_DX));
+ M.x86.R_DI += inc;
}
break;
- case 2:
+ case 2:
while (count--) {
- store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
- (*sys_inw)(M.x86.R_DX));
- M.x86.R_DI += inc;
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inw) (M.x86.R_DX));
+ M.x86.R_DI += inc;
}
break;
- case 4:
+ case 4:
while (count--) {
- store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
- (*sys_inl)(M.x86.R_DX));
- M.x86.R_DI += inc;
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inl) (M.x86.R_DX));
+ M.x86.R_DI += inc;
break;
}
}
- M.x86.R_CX = 0;
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ECX = 0;
+ M.x86.R_CX = 0;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = 0;
}
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
- } else {
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ else {
switch (size) {
- case 1:
- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
- (*sys_inb)(M.x86.R_DX));
+ case 1:
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inb) (M.x86.R_DX));
break;
- case 2:
- store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
- (*sys_inw)(M.x86.R_DX));
+ case 2:
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inw) (M.x86.R_DX));
break;
- case 4:
- store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
- (*sys_inl)(M.x86.R_DX));
+ case 4:
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inl) (M.x86.R_DX));
break;
}
- M.x86.R_DI += inc;
+ M.x86.R_DI += inc;
}
}
@@ -2524,63 +2654,65 @@ void ins(int size)
REMARKS:
Implements the OUT string instruction and side effects.
****************************************************************************/
-void outs(int size)
+void
+outs(int size)
{
int inc = size;
- if (ACCESS_FLAG(F_DF)) {
+ if (ACCESS_FLAG(F_DF)) {
inc = -size;
}
- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
/* dont care whether REPE or REPNE */
/* out until CX is ZERO. */
- u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
- M.x86.R_ECX : M.x86.R_CX);
+ u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
+ M.x86.R_ECX : M.x86.R_CX);
switch (size) {
- case 1:
+ case 1:
while (count--) {
- (*sys_outb)(M.x86.R_DX,
- fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
- M.x86.R_SI += inc;
+ (*sys_outb) (M.x86.R_DX,
+ fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
+ M.x86.R_SI += inc;
}
break;
- case 2:
+ case 2:
while (count--) {
- (*sys_outw)(M.x86.R_DX,
- fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
- M.x86.R_SI += inc;
+ (*sys_outw) (M.x86.R_DX,
+ fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
+ M.x86.R_SI += inc;
}
break;
- case 4:
+ case 4:
while (count--) {
- (*sys_outl)(M.x86.R_DX,
- fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
- M.x86.R_SI += inc;
+ (*sys_outl) (M.x86.R_DX,
+ fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
+ M.x86.R_SI += inc;
break;
}
}
- M.x86.R_CX = 0;
- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
- M.x86.R_ECX = 0;
+ M.x86.R_CX = 0;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = 0;
}
- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
- } else {
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ else {
switch (size) {
- case 1:
- (*sys_outb)(M.x86.R_DX,
- fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
+ case 1:
+ (*sys_outb) (M.x86.R_DX,
+ fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
break;
- case 2:
- (*sys_outw)(M.x86.R_DX,
- fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
+ case 2:
+ (*sys_outw) (M.x86.R_DX,
+ fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
break;
- case 4:
- (*sys_outl)(M.x86.R_DX,
- fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
+ case 4:
+ (*sys_outl) (M.x86.R_DX,
+ fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
break;
}
- M.x86.R_SI += inc;
+ M.x86.R_SI += inc;
}
}
@@ -2591,11 +2723,12 @@ addr - Address to fetch word from
REMARKS:
Fetches a word from emulator memory using an absolute address.
****************************************************************************/
-u16 mem_access_word(int addr)
+u16
+mem_access_word(int addr)
{
-DB( if (CHECK_MEM_ACCESS())
- x86emu_check_mem_access(addr);)
- return (*sys_rdw)(addr);
+ DB(if (CHECK_MEM_ACCESS())
+ x86emu_check_mem_access(addr);)
+ return (*sys_rdw) (addr);
}
/****************************************************************************
@@ -2604,12 +2737,13 @@ Pushes a word onto the stack.
NOTE: Do not inline this, as (*sys_wrX) is already inline!
****************************************************************************/
-void push_word(u16 w)
+void
+push_word(u16 w)
{
-DB( if (CHECK_SP_ACCESS())
- x86emu_check_sp_access();)
- M.x86.R_SP -= 2;
- (*sys_wrw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP, w);
+ DB(if (CHECK_SP_ACCESS())
+ x86emu_check_sp_access();)
+ M.x86.R_SP -= 2;
+ (*sys_wrw) (((u32) M.x86.R_SS << 4) + M.x86.R_SP, w);
}
/****************************************************************************
@@ -2618,12 +2752,13 @@ Pushes a long onto the stack.
NOTE: Do not inline this, as (*sys_wrX) is already inline!
****************************************************************************/
-void push_long(u32 w)
+void
+push_long(u32 w)
{
-DB( if (CHECK_SP_ACCESS())
- x86emu_check_sp_access();)
- M.x86.R_SP -= 4;
- (*sys_wrl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP, w);
+ DB(if (CHECK_SP_ACCESS())
+ x86emu_check_sp_access();)
+ M.x86.R_SP -= 4;
+ (*sys_wrl) (((u32) M.x86.R_SS << 4) + M.x86.R_SP, w);
}
/****************************************************************************
@@ -2632,15 +2767,16 @@ Pops a word from the stack.
NOTE: Do not inline this, as (*sys_rdX) is already inline!
****************************************************************************/
-u16 pop_word(void)
+u16
+pop_word(void)
{
- register u16 res;
+ register u16 res;
-DB( if (CHECK_SP_ACCESS())
- x86emu_check_sp_access();)
- res = (*sys_rdw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP);
- M.x86.R_SP += 2;
- return res;
+ DB(if (CHECK_SP_ACCESS())
+ x86emu_check_sp_access();)
+ res = (*sys_rdw) (((u32) M.x86.R_SS << 4) + M.x86.R_SP);
+ M.x86.R_SP += 2;
+ return res;
}
/****************************************************************************
@@ -2649,14 +2785,15 @@ Pops a long from the stack.
NOTE: Do not inline this, as (*sys_rdX) is already inline!
****************************************************************************/
-u32 pop_long(void)
+u32
+pop_long(void)
{
register u32 res;
-DB( if (CHECK_SP_ACCESS())
- x86emu_check_sp_access();)
- res = (*sys_rdl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP);
- M.x86.R_SP += 4;
+ DB(if (CHECK_SP_ACCESS())
+ x86emu_check_sp_access();)
+ res = (*sys_rdl) (((u32) M.x86.R_SS << 4) + M.x86.R_SP);
+ M.x86.R_SP += 4;
return res;
}
@@ -2664,7 +2801,8 @@ DB( if (CHECK_SP_ACCESS())
REMARKS:
CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output
****************************************************************************/
-void cpuid (void)
+void
+cpuid(void)
{
u32 feature = M.x86.R_EAX;
@@ -2674,15 +2812,15 @@ void cpuid (void)
* first two features, and the results of those are sanitized.
*/
if (feature <= 1)
- hw_cpuid(&M.x86.R_EAX, &M.x86.R_EBX, &M.x86.R_ECX, &M.x86.R_EDX);
+ hw_cpuid(&M.x86.R_EAX, &M.x86.R_EBX, &M.x86.R_ECX, &M.x86.R_EDX);
#endif
switch (feature) {
case 0:
/* Regardless if we have real data from the hardware, the emulator
- * will only support upto feature 1, which we set in register EAX.
- * Registers EBX:EDX:ECX contain a string identifying the CPU.
- */
+ * will only support upto feature 1, which we set in register EAX.
+ * Registers EBX:EDX:ECX contain a string identifying the CPU.
+ */
M.x86.R_EAX = 1;
#ifndef X86EMU_HAS_HW_CPUID
/* EBX:EDX:ECX = "GenuineIntel" */
@@ -2694,24 +2832,24 @@ void cpuid (void)
case 1:
#ifndef X86EMU_HAS_HW_CPUID
/* If we don't have x86 compatible hardware, we return values from an
- * Intel 486dx4; which was one of the first processors to have CPUID.
- */
+ * Intel 486dx4; which was one of the first processors to have CPUID.
+ */
M.x86.R_EAX = 0x00000480;
M.x86.R_EBX = 0x00000000;
M.x86.R_ECX = 0x00000000;
- M.x86.R_EDX = 0x00000002; /* VME */
+ M.x86.R_EDX = 0x00000002; /* VME */
#else
/* In the case that we have hardware CPUID instruction, we make sure
- * that the features reported are limited to TSC and VME.
- */
+ * that the features reported are limited to TSC and VME.
+ */
M.x86.R_EDX &= 0x00000012;
#endif
break;
default:
/* Finally, we don't support any additional features. Most CPUs
- * return all zeros when queried for invalid or unsupported feature
- * numbers.
- */
+ * return all zeros when queried for invalid or unsupported feature
+ * numbers.
+ */
M.x86.R_EAX = 0;
M.x86.R_EBX = 0;
M.x86.R_ECX = 0;
@@ -2719,4 +2857,3 @@ void cpuid (void)
break;
}
}
-
diff --git a/xorg-server/hw/xfree86/x86emu/sys.c b/xorg-server/hw/xfree86/x86emu/sys.c
index f389767f1..c514ddeea 100644
--- a/xorg-server/hw/xfree86/x86emu/sys.c
+++ b/xorg-server/hw/xfree86/x86emu/sys.c
@@ -47,101 +47,131 @@
#include "x86emu/prim_ops.h"
#ifndef NO_SYS_HEADERS
#include <string.h>
-#endif
+#endif
-# ifdef __GNUC__
+#ifdef __GNUC__
/* Define some packed structures to use with unaligned accesses */
-struct __una_u64 { u64 x __attribute__((packed)); };
-struct __una_u32 { u32 x __attribute__((packed)); };
-struct __una_u16 { u16 x __attribute__((packed)); };
+struct __una_u64 {
+ u64 x __attribute__ ((packed));
+};
+struct __una_u32 {
+ u32 x __attribute__ ((packed));
+};
+struct __una_u16 {
+ u16 x __attribute__ ((packed));
+};
/* Elemental unaligned loads */
-static __inline__ u64 ldq_u(u64 *p)
+static __inline__ u64
+ldq_u(u64 * p)
{
- const struct __una_u64 *ptr = (const struct __una_u64 *) p;
- return ptr->x;
+ const struct __una_u64 *ptr = (const struct __una_u64 *) p;
+
+ return ptr->x;
}
-static __inline__ u32 ldl_u(u32 *p)
+static __inline__ u32
+ldl_u(u32 * p)
{
- const struct __una_u32 *ptr = (const struct __una_u32 *) p;
- return ptr->x;
+ const struct __una_u32 *ptr = (const struct __una_u32 *) p;
+
+ return ptr->x;
}
-static __inline__ u16 ldw_u(u16 *p)
+static __inline__ u16
+ldw_u(u16 * p)
{
- const struct __una_u16 *ptr = (const struct __una_u16 *) p;
- return ptr->x;
+ const struct __una_u16 *ptr = (const struct __una_u16 *) p;
+
+ return ptr->x;
}
/* Elemental unaligned stores */
-static __inline__ void stq_u(u64 val, u64 *p)
+static __inline__ void
+stq_u(u64 val, u64 * p)
{
- struct __una_u64 *ptr = (struct __una_u64 *) p;
- ptr->x = val;
+ struct __una_u64 *ptr = (struct __una_u64 *) p;
+
+ ptr->x = val;
}
-static __inline__ void stl_u(u32 val, u32 *p)
+static __inline__ void
+stl_u(u32 val, u32 * p)
{
- struct __una_u32 *ptr = (struct __una_u32 *) p;
- ptr->x = val;
+ struct __una_u32 *ptr = (struct __una_u32 *) p;
+
+ ptr->x = val;
}
-static __inline__ void stw_u(u16 val, u16 *p)
+static __inline__ void
+stw_u(u16 val, u16 * p)
{
- struct __una_u16 *ptr = (struct __una_u16 *) p;
- ptr->x = val;
+ struct __una_u16 *ptr = (struct __una_u16 *) p;
+
+ ptr->x = val;
}
-# else /* !__GNUC__ */
+#else /* !__GNUC__ */
-static __inline__ u64 ldq_u(u64 *p)
+static __inline__ u64
+ldq_u(u64 * p)
{
- u64 ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
+ u64 ret;
+
+ memmove(&ret, p, sizeof(*p));
+ return ret;
}
-static __inline__ u32 ldl_u(u32 *p)
+static __inline__ u32
+ldl_u(u32 * p)
{
- u32 ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
+ u32 ret;
+
+ memmove(&ret, p, sizeof(*p));
+ return ret;
}
-static __inline__ u16 ldw_u(u16 *p)
+static __inline__ u16
+ldw_u(u16 * p)
{
- u16 ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
+ u16 ret;
+
+ memmove(&ret, p, sizeof(*p));
+ return ret;
}
-static __inline__ void stq_u(u64 val, u64 *p)
+static __inline__ void
+stq_u(u64 val, u64 * p)
{
- u64 tmp = val;
- memmove(p, &tmp, sizeof(*p));
+ u64 tmp = val;
+
+ memmove(p, &tmp, sizeof(*p));
}
-static __inline__ void stl_u(u32 val, u32 *p)
+static __inline__ void
+stl_u(u32 val, u32 * p)
{
- u32 tmp = val;
- memmove(p, &tmp, sizeof(*p));
+ u32 tmp = val;
+
+ memmove(p, &tmp, sizeof(*p));
}
-static __inline__ void stw_u(u16 val, u16 *p)
+static __inline__ void
+stw_u(u16 val, u16 * p)
{
- u16 tmp = val;
- memmove(p, &tmp, sizeof(*p));
+ u16 tmp = val;
+
+ memmove(p, &tmp, sizeof(*p));
}
-# endif /* __GNUC__ */
+#endif /* __GNUC__ */
/*------------------------- Global Variables ------------------------------*/
-X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */
-X86EMU_intrFuncs _X86EMU_intrTab[256];
+X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */
+X86EMU_intrFuncs _X86EMU_intrTab[256];
/*----------------------------- Implementation ----------------------------*/
@@ -155,19 +185,20 @@ Byte value read from emulator memory.
REMARKS:
Reads a byte value from the emulator memory.
****************************************************************************/
-u8 X86API rdb(
- u32 addr)
+u8 X86API
+rdb(u32 addr)
{
- u8 val;
-
- if (addr > M.mem_size - 1) {
- DB(printk("mem_read: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
- val = *(u8*)(M.mem_base + addr);
-DB( if (DEBUG_MEM_TRACE())
- printk("%#08x 1 -> %#x\n", addr, val);)
- return val;
+ u8 val;
+
+ if (addr > M.mem_size - 1) {
+ DB(printk("mem_read: address %#lx out of range!\n", addr);
+ )
+ HALT_SYS();
+ }
+ val = *(u8 *) (M.mem_base + addr);
+ DB(if (DEBUG_MEM_TRACE())
+ printk("%#08x 1 -> %#x\n", addr, val);)
+ return val;
}
/****************************************************************************
@@ -180,26 +211,27 @@ Word value read from emulator memory.
REMARKS:
Reads a word value from the emulator memory.
****************************************************************************/
-u16 X86API rdw(
- u32 addr)
+u16 X86API
+rdw(u32 addr)
{
- u16 val = 0;
+ u16 val = 0;
- if (addr > M.mem_size - 2) {
- DB(printk("mem_read: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
+ if (addr > M.mem_size - 2) {
+ DB(printk("mem_read: address %#lx out of range!\n", addr);
+ )
+ HALT_SYS();
+ }
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- val = (*(u8*)(M.mem_base + addr) |
- (*(u8*)(M.mem_base + addr + 1) << 8));
- }
- else
+ if (addr & 0x1) {
+ val = (*(u8 *) (M.mem_base + addr) |
+ (*(u8 *) (M.mem_base + addr + 1) << 8));
+ }
+ else
#endif
- val = ldw_u((u16*)(M.mem_base + addr));
- DB( if (DEBUG_MEM_TRACE())
- printk("%#08x 2 -> %#x\n", addr, val);)
- return val;
+ val = ldw_u((u16 *) (M.mem_base + addr));
+ DB(if (DEBUG_MEM_TRACE())
+ printk("%#08x 2 -> %#x\n", addr, val);)
+ return val;
}
/****************************************************************************
@@ -211,28 +243,29 @@ Long value read from emulator memory.
REMARKS:
Reads a long value from the emulator memory.
****************************************************************************/
-u32 X86API rdl(
- u32 addr)
+u32 X86API
+rdl(u32 addr)
{
- u32 val = 0;
+ u32 val = 0;
- if (addr > M.mem_size - 4) {
- DB(printk("mem_read: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
+ if (addr > M.mem_size - 4) {
+ DB(printk("mem_read: address %#lx out of range!\n", addr);
+ )
+ HALT_SYS();
+ }
#ifdef __BIG_ENDIAN__
- if (addr & 0x3) {
- val = (*(u8*)(M.mem_base + addr + 0) |
- (*(u8*)(M.mem_base + addr + 1) << 8) |
- (*(u8*)(M.mem_base + addr + 2) << 16) |
- (*(u8*)(M.mem_base + addr + 3) << 24));
- }
- else
+ if (addr & 0x3) {
+ val = (*(u8 *) (M.mem_base + addr + 0) |
+ (*(u8 *) (M.mem_base + addr + 1) << 8) |
+ (*(u8 *) (M.mem_base + addr + 2) << 16) |
+ (*(u8 *) (M.mem_base + addr + 3) << 24));
+ }
+ else
#endif
- val = ldl_u((u32*)(M.mem_base + addr));
-DB( if (DEBUG_MEM_TRACE())
- printk("%#08x 4 -> %#x\n", addr, val);)
- return val;
+ val = ldl_u((u32 *) (M.mem_base + addr));
+ DB(if (DEBUG_MEM_TRACE())
+ printk("%#08x 4 -> %#x\n", addr, val);)
+ return val;
}
/****************************************************************************
@@ -243,17 +276,17 @@ val - Value to store
REMARKS:
Writes a byte value to emulator memory.
****************************************************************************/
-void X86API wrb(
- u32 addr,
- u8 val)
+void X86API
+wrb(u32 addr, u8 val)
{
-DB( if (DEBUG_MEM_TRACE())
- printk("%#08x 1 <- %#x\n", addr, val);)
- if (addr > M.mem_size - 1) {
- DB(printk("mem_write: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
- *(u8*)(M.mem_base + addr) = val;
+ DB(if (DEBUG_MEM_TRACE())
+ printk("%#08x 1 <- %#x\n", addr, val);)
+ if (addr > M.mem_size - 1) {
+ DB(printk("mem_write: address %#lx out of range!\n", addr);
+ )
+ HALT_SYS();
+ }
+ *(u8 *) (M.mem_base + addr) = val;
}
/****************************************************************************
@@ -264,24 +297,24 @@ val - Value to store
REMARKS:
Writes a word value to emulator memory.
****************************************************************************/
-void X86API wrw(
- u32 addr,
- u16 val)
+void X86API
+wrw(u32 addr, u16 val)
{
-DB( if (DEBUG_MEM_TRACE())
- printk("%#08x 2 <- %#x\n", addr, val);)
- if (addr > M.mem_size - 2) {
- DB(printk("mem_write: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
+ DB(if (DEBUG_MEM_TRACE())
+ printk("%#08x 2 <- %#x\n", addr, val);)
+ if (addr > M.mem_size - 2) {
+ DB(printk("mem_write: address %#lx out of range!\n", addr);
+ )
+ HALT_SYS();
+ }
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
- *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
- }
- else
+ if (addr & 0x1) {
+ *(u8 *) (M.mem_base + addr + 0) = (val >> 0) & 0xff;
+ *(u8 *) (M.mem_base + addr + 1) = (val >> 8) & 0xff;
+ }
+ else
#endif
- stw_u(val,(u16*)(M.mem_base + addr));
+ stw_u(val, (u16 *) (M.mem_base + addr));
}
/****************************************************************************
@@ -292,26 +325,26 @@ val - Value to store
REMARKS:
Writes a long value to emulator memory.
****************************************************************************/
-void X86API wrl(
- u32 addr,
- u32 val)
+void X86API
+wrl(u32 addr, u32 val)
{
-DB( if (DEBUG_MEM_TRACE())
- printk("%#08x 4 <- %#x\n", addr, val);)
- if (addr > M.mem_size - 4) {
- DB(printk("mem_write: address %#lx out of range!\n", addr);)
- HALT_SYS();
- }
+ DB(if (DEBUG_MEM_TRACE())
+ printk("%#08x 4 <- %#x\n", addr, val);)
+ if (addr > M.mem_size - 4) {
+ DB(printk("mem_write: address %#lx out of range!\n", addr);
+ )
+ HALT_SYS();
+ }
#ifdef __BIG_ENDIAN__
- if (addr & 0x1) {
- *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
- *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
- *(u8*)(M.mem_base + addr + 2) = (val >> 16) & 0xff;
- *(u8*)(M.mem_base + addr + 3) = (val >> 24) & 0xff;
- }
- else
+ if (addr & 0x1) {
+ *(u8 *) (M.mem_base + addr + 0) = (val >> 0) & 0xff;
+ *(u8 *) (M.mem_base + addr + 1) = (val >> 8) & 0xff;
+ *(u8 *) (M.mem_base + addr + 2) = (val >> 16) & 0xff;
+ *(u8 *) (M.mem_base + addr + 3) = (val >> 24) & 0xff;
+ }
+ else
#endif
- stl_u(val,(u32*)(M.mem_base + addr));
+ stl_u(val, (u32 *) (M.mem_base + addr));
}
/****************************************************************************
@@ -322,12 +355,12 @@ RETURN:
REMARKS:
Default PIO byte read function. Doesn't perform real inb.
****************************************************************************/
-static u8 X86API p_inb(
- X86EMU_pioAddr addr)
+static u8 X86API
+p_inb(X86EMU_pioAddr addr)
{
-DB( if (DEBUG_IO_TRACE())
- printk("inb %#04x \n", addr);)
- return 0;
+ DB(if (DEBUG_IO_TRACE())
+ printk("inb %#04x \n", addr);)
+ return 0;
}
/****************************************************************************
@@ -338,12 +371,12 @@ RETURN:
REMARKS:
Default PIO word read function. Doesn't perform real inw.
****************************************************************************/
-static u16 X86API p_inw(
- X86EMU_pioAddr addr)
+static u16 X86API
+p_inw(X86EMU_pioAddr addr)
{
-DB( if (DEBUG_IO_TRACE())
- printk("inw %#04x \n", addr);)
- return 0;
+ DB(if (DEBUG_IO_TRACE())
+ printk("inw %#04x \n", addr);)
+ return 0;
}
/****************************************************************************
@@ -354,12 +387,12 @@ RETURN:
REMARKS:
Default PIO long read function. Doesn't perform real inl.
****************************************************************************/
-static u32 X86API p_inl(
- X86EMU_pioAddr addr)
+static u32 X86API
+p_inl(X86EMU_pioAddr addr)
{
-DB( if (DEBUG_IO_TRACE())
- printk("inl %#04x \n", addr);)
- return 0;
+ DB(if (DEBUG_IO_TRACE())
+ printk("inl %#04x \n", addr);)
+ return 0;
}
/****************************************************************************
@@ -369,13 +402,12 @@ val - Value to store
REMARKS:
Default PIO byte write function. Doesn't perform real outb.
****************************************************************************/
-static void X86API p_outb(
- X86EMU_pioAddr addr,
- u8 val)
+static void X86API
+p_outb(X86EMU_pioAddr addr, u8 val)
{
-DB( if (DEBUG_IO_TRACE())
- printk("outb %#02x -> %#04x \n", val, addr);)
- return;
+ DB(if (DEBUG_IO_TRACE())
+ printk("outb %#02x -> %#04x \n", val, addr);)
+ return;
}
/****************************************************************************
@@ -385,13 +417,12 @@ val - Value to store
REMARKS:
Default PIO word write function. Doesn't perform real outw.
****************************************************************************/
-static void X86API p_outw(
- X86EMU_pioAddr addr,
- u16 val)
+static void X86API
+p_outw(X86EMU_pioAddr addr, u16 val)
{
-DB( if (DEBUG_IO_TRACE())
- printk("outw %#04x -> %#04x \n", val, addr);)
- return;
+ DB(if (DEBUG_IO_TRACE())
+ printk("outw %#04x -> %#04x \n", val, addr);)
+ return;
}
/****************************************************************************
@@ -401,29 +432,29 @@ val - Value to store
REMARKS:
Default PIO ;ong write function. Doesn't perform real outl.
****************************************************************************/
-static void X86API p_outl(
- X86EMU_pioAddr addr,
- u32 val)
+static void X86API
+p_outl(X86EMU_pioAddr addr, u32 val)
{
-DB( if (DEBUG_IO_TRACE())
- printk("outl %#08x -> %#04x \n", val, addr);)
- return;
+ DB(if (DEBUG_IO_TRACE())
+ printk("outl %#08x -> %#04x \n", val, addr);)
+ return;
}
/*------------------------- Global Variables ------------------------------*/
-u8 (X86APIP sys_rdb)(u32 addr) = rdb;
-u16 (X86APIP sys_rdw)(u32 addr) = rdw;
-u32 (X86APIP sys_rdl)(u32 addr) = rdl;
-void (X86APIP sys_wrb)(u32 addr,u8 val) = wrb;
-void (X86APIP sys_wrw)(u32 addr,u16 val) = wrw;
-void (X86APIP sys_wrl)(u32 addr,u32 val) = wrl;
-u8 (X86APIP sys_inb)(X86EMU_pioAddr addr) = p_inb;
-u16 (X86APIP sys_inw)(X86EMU_pioAddr addr) = p_inw;
-u32 (X86APIP sys_inl)(X86EMU_pioAddr addr) = p_inl;
-void (X86APIP sys_outb)(X86EMU_pioAddr addr, u8 val) = p_outb;
-void (X86APIP sys_outw)(X86EMU_pioAddr addr, u16 val) = p_outw;
-void (X86APIP sys_outl)(X86EMU_pioAddr addr, u32 val) = p_outl;
+u8(X86APIP sys_rdb) (u32 addr) = rdb;
+u16(X86APIP sys_rdw) (u32 addr) = rdw;
+u32(X86APIP sys_rdl) (u32 addr) = rdl;
+void (X86APIP sys_wrb) (u32 addr, u8 val) = wrb;
+void (X86APIP sys_wrw) (u32 addr, u16 val) = wrw;
+void (X86APIP sys_wrl) (u32 addr, u32 val) = wrl;
+
+u8(X86APIP sys_inb) (X86EMU_pioAddr addr) = p_inb;
+u16(X86APIP sys_inw) (X86EMU_pioAddr addr) = p_inw;
+u32(X86APIP sys_inl) (X86EMU_pioAddr addr) = p_inl;
+void (X86APIP sys_outb) (X86EMU_pioAddr addr, u8 val) = p_outb;
+void (X86APIP sys_outw) (X86EMU_pioAddr addr, u16 val) = p_outw;
+void (X86APIP sys_outl) (X86EMU_pioAddr addr, u32 val) = p_outl;
/*----------------------------- Setup -------------------------------------*/
@@ -436,8 +467,8 @@ This function is used to set the pointers to functions which access
memory space, allowing the user application to override these functions
and hook them out as necessary for their application.
****************************************************************************/
-void X86EMU_setupMemFuncs(
- X86EMU_memFuncs *funcs)
+void
+X86EMU_setupMemFuncs(X86EMU_memFuncs * funcs)
{
sys_rdb = funcs->rdb;
sys_rdw = funcs->rdw;
@@ -456,8 +487,8 @@ This function is used to set the pointers to functions which access
I/O space, allowing the user application to override these functions
and hook them out as necessary for their application.
****************************************************************************/
-void X86EMU_setupPioFuncs(
- X86EMU_pioFuncs *funcs)
+void
+X86EMU_setupPioFuncs(X86EMU_pioFuncs * funcs)
{
sys_inb = funcs->inb;
sys_inw = funcs->inw;
@@ -480,17 +511,17 @@ in the emulator via the interrupt vector table. This allows the application
to get control when the code being emulated executes specific software
interrupts.
****************************************************************************/
-void X86EMU_setupIntrFuncs(
- X86EMU_intrFuncs funcs[])
+void
+X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[])
{
int i;
-
- for (i=0; i < 256; i++)
- _X86EMU_intrTab[i] = NULL;
- if (funcs) {
- for (i = 0; i < 256; i++)
- _X86EMU_intrTab[i] = funcs[i];
- }
+
+ for (i = 0; i < 256; i++)
+ _X86EMU_intrTab[i] = NULL;
+ if (funcs) {
+ for (i = 0; i < 256; i++)
+ _X86EMU_intrTab[i] = funcs[i];
+ }
}
/****************************************************************************
@@ -505,15 +536,15 @@ so that the code in the emulator will continue processing the software
interrupt as per normal. This essentially allows system code to actively
hook and handle certain software interrupts as necessary.
****************************************************************************/
-void X86EMU_prepareForInt(
- int num)
+void
+X86EMU_prepareForInt(int num)
{
- push_word((u16)M.x86.R_FLG);
+ push_word((u16) M.x86.R_FLG);
CLEAR_FLAG(F_IF);
CLEAR_FLAG(F_TF);
push_word(M.x86.R_CS);
M.x86.R_CS = mem_access_word(num * 4 + 2);
push_word(M.x86.R_IP);
M.x86.R_IP = mem_access_word(num * 4);
- M.x86.intr = 0;
+ M.x86.intr = 0;
}
diff --git a/xorg-server/hw/xfree86/x86emu/validate.c b/xorg-server/hw/xfree86/x86emu/validate.c
index b8c4d12d1..4c36e1df5 100644
--- a/xorg-server/hw/xfree86/x86emu/validate.c
+++ b/xorg-server/hw/xfree86/x86emu/validate.c
@@ -591,58 +591,62 @@
printk("passed\n"); \
}
-void printk(const char *fmt, ...)
+void
+printk(const char *fmt, ...)
{
va_list argptr;
+
va_start(argptr, fmt);
vfprintf(stdout, fmt, argptr);
fflush(stdout);
va_end(argptr);
}
-char * print_flags(char *buf,ulong flags)
+char *
+print_flags(char *buf, ulong flags)
{
char *separator = "";
buf[0] = 0;
if (flags & F_CF) {
- strcat(buf,separator);
- strcat(buf,"CF");
+ strcat(buf, separator);
+ strcat(buf, "CF");
separator = ",";
- }
+ }
if (flags & F_PF) {
- strcat(buf,separator);
- strcat(buf,"PF");
+ strcat(buf, separator);
+ strcat(buf, "PF");
separator = ",";
- }
+ }
if (flags & F_AF) {
- strcat(buf,separator);
- strcat(buf,"AF");
+ strcat(buf, separator);
+ strcat(buf, "AF");
separator = ",";
- }
+ }
if (flags & F_ZF) {
- strcat(buf,separator);
- strcat(buf,"ZF");
+ strcat(buf, separator);
+ strcat(buf, "ZF");
separator = ",";
- }
+ }
if (flags & F_SF) {
- strcat(buf,separator);
- strcat(buf,"SF");
+ strcat(buf, separator);
+ strcat(buf, "SF");
separator = ",";
- }
+ }
if (flags & F_OF) {
- strcat(buf,separator);
- strcat(buf,"OF");
+ strcat(buf, separator);
+ strcat(buf, "OF");
separator = ",";
- }
+ }
if (separator[0] == 0)
- strcpy(buf,"None");
+ strcpy(buf, "None");
return buf;
}
-int main(int argc)
+int
+main(int argc)
{
- ulong def_flags;
+ ulong def_flags;
int trace = false;
if (argc > 1)
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h b/xorg-server/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
index 4c850a1bd..646ec9def 100644
--- a/xorg-server/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
@@ -49,31 +49,29 @@
#if defined(__PIC__) && defined(__i386__)
#define X86EMU_HAS_HW_CPUID 1
-static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d)
+static inline void
+hw_cpuid(u32 * a, u32 * b, u32 * c, u32 * d)
{
- __asm__ __volatile__ ("pushl %%ebx \n\t"
- "cpuid \n\t"
- "movl %%ebx, %1 \n\t"
- "popl %%ebx \n\t"
- : "=a" (*a), "=r" (*b),
- "=c" (*c), "=d" (*d)
- : "a" (*a), "c" (*c)
- : "cc");
+ __asm__ __volatile__("pushl %%ebx \n\t"
+ "cpuid \n\t"
+ "movl %%ebx, %1 \n\t"
+ "popl %%ebx \n\t":"=a"(*a), "=r"(*b),
+ "=c"(*c), "=d"(*d)
+ :"a"(*a), "c"(*c)
+ :"cc");
}
-#else /* ! (__PIC__ && __i386__) */
+#else /* ! (__PIC__ && __i386__) */
#define x86EMU_HAS_HW_CPUID 1
-static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d)
+static inline void
+hw_cpuid(u32 * a, u32 * b, u32 * c, u32 * d)
{
- __asm__ __volatile__ ("cpuid"
- : "=a" (*a), "=b" (*b),
- "=c" (*c), "=d" (*d)
- : "a" (*a), "c" (*c)
- : "cc");
+ __asm__ __volatile__("cpuid":"=a"(*a), "=b"(*b), "=c"(*c), "=d"(*d)
+ :"a"(*a), "c"(*c)
+ :"cc");
}
-#endif /* __PIC__ && __i386__ */
+#endif /* __PIC__ && __i386__ */
-
-#endif /* __X86EMU_PRIM_X86_GCC_H */
+#endif /* __X86EMU_PRIM_X86_GCC_H */
diff --git a/xorg-server/hw/xfree86/xaa/xaa.h b/xorg-server/hw/xfree86/xaa/xaa.h
index 6e5a2389a..b530037c9 100644
--- a/xorg-server/hw/xfree86/xaa/xaa.h
+++ b/xorg-server/hw/xfree86/xaa/xaa.h
@@ -1,1394 +1,1038 @@
-
-#ifndef _XAA_H
-#define _XAA_H
-
-#define XAA_VERSION_MAJOR 1
-#define XAA_VERSION_MINOR 2
-#define XAA_VERSION_RELEASE 1
-
-/*
-
- ******** OPERATION SPECIFIC FLAGS *********
-
- **** solid/dashed line flags ****
-
---------- --------
-23 LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
-22 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
-21 LINE_PATTERN_MSBFIRST_MSBJUSTIFIED
-20 LINE_PATTERN_MSBFIRST_LSBJUSTIFIED
-19 LINE_PATTERN_POWER_OF_2_ONLY
-18 LINE_LIMIT_COORDS
-17 .
-16 .
---------- -------
-
- **** screen to screen copy flags ****
-
---------- --------
-23 ONLY_LEFT_TO_RIGHT_BITBLT
-22 ONLY_TWO_BITBLT_DIRECTIONS
-21 .
-20 .
-19 .
-18 .
-17 .
-16 .
---------- -------
-
- **** clipping flags ****
-
---------- --------
-23 .
-22 HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND
-21 HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
-20 HARDWARE_CLIP_MONO_8x8_FILL
-19 HARDWARE_CLIP_COLOR_8x8_FILL
-18 HARDWARE_CLIP_SOLID_FILL
-17 HARDWARE_CLIP_DASHED_LINE
-16 HARDWARE_CLIP_SOLID_LINE
---------- -------
-
-
- **** hardware pattern flags ****
-
---------- --------
-23 .
-22 .
-21 HARDWARE_PATTERN_SCREEN_ORIGIN
-20 .
-19 .
-18 .
-17 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
-16 HARDWARE_PATTERN_PROGRAMMED_BITS
---------- -------
-
- **** write pixmap flags ****
-
---------- --------
-23 .
-22 .
-21 .
-20 .
-19 .
-18 .
-17 .
-16 CONVERT_32BPP_TO_24BPP
---------- -------
-
-
- ******** GENERIC FLAGS *********
-
---------- -------
-15 SYNC_AFTER_COLOR_EXPAND
-14 CPU_TRANSFER_PAD_QWORD
-13 .
-12 LEFT_EDGE_CLIPPING_NEGATIVE_X
-11 LEFT_EDGE_CLIPPING
-10 CPU_TRANSFER_BASE_FIXED
- 9 BIT_ORDER_IN_BYTE_MSBFIRST
- 8 TRANSPARENCY_GXCOPY_ONLY
---------- -------
- 7 NO_TRANSPARENCY
- 6 TRANSPARENCY_ONLY
- 5 ROP_NEEDS_SOURCE
- 4 TRIPLE_BITS_24BPP
- 3 RGB_EQUAL
- 2 NO_PLANEMASK
- 1 NO_GXCOPY
- 0 GXCOPY_ONLY
---------- -------
-
-
-*/
-
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "xf86str.h"
-#include "regionstr.h"
-#include "xf86fbman.h"
-
-#include "picturestr.h"
-
-/* Flags */
-#define PIXMAP_CACHE 0x00000001
-#define MICROSOFT_ZERO_LINE_BIAS 0x00000002
-#define OFFSCREEN_PIXMAPS 0x00000004
-#define LINEAR_FRAMEBUFFER 0x00000008
-
-
-/* GC fg, bg, and planemask restrictions */
-#define GXCOPY_ONLY 0x00000001
-#define NO_GXCOPY 0x00000002
-#define NO_PLANEMASK 0x00000004
-#define RGB_EQUAL 0x00000008
-#define TRIPLE_BITS_24BPP 0x00000010
-#define ROP_NEEDS_SOURCE 0x00000020
-
-/* transparency restrictions */
-#define TRANSPARENCY_ONLY 0x00000040
-#define NO_TRANSPARENCY 0x00000080
-#define TRANSPARENCY_GXCOPY_ONLY 0x00000100
-
-/* bit order restrictions */
-#define BIT_ORDER_IN_BYTE_MSBFIRST 0x00000200
-#define BIT_ORDER_IN_BYTE_LSBFIRST 0x00000000
-
-/* transfer base restriction */
-#define CPU_TRANSFER_BASE_FIXED 0x00000400
-
-/* skipleft restrictions */
-#define LEFT_EDGE_CLIPPING 0x00000800
-#define LEFT_EDGE_CLIPPING_NEGATIVE_X 0x00001000
-
-/* data padding */
-#define CPU_TRANSFER_PAD_DWORD 0x00000000
-#define CPU_TRANSFER_PAD_QWORD 0x00004000
-#define SCANLINE_PAD_DWORD 0x00000000
-
-#define SYNC_AFTER_COLOR_EXPAND 0x00008000
-#define SYNC_AFTER_IMAGE_WRITE SYNC_AFTER_COLOR_EXPAND
-
-/* hardware pattern */
-#define HARDWARE_PATTERN_PROGRAMMED_BITS 0x00010000
-#define HARDWARE_PATTERN_PROGRAMMED_ORIGIN 0x00020000
-#define HARDWARE_PATTERN_SCREEN_ORIGIN 0x00200000
-
-/* copyarea flags */
-#define ONLY_TWO_BITBLT_DIRECTIONS 0x00400000
-#define ONLY_LEFT_TO_RIGHT_BITBLT 0x00800000
-
-/* line flags */
-#define LINE_PATTERN_LSBFIRST_MSBJUSTIFIED 0x00800000
-#define LINE_PATTERN_LSBFIRST_LSBJUSTIFIED 0x00400000
-#define LINE_PATTERN_MSBFIRST_MSBJUSTIFIED 0x00200000
-#define LINE_PATTERN_MSBFIRST_LSBJUSTIFIED 0x00100000
-#define LINE_PATTERN_POWER_OF_2_ONLY 0x00080000
-#define LINE_LIMIT_COORDS 0x00040000
-
-/* clipping flags */
-#define HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND 0x00400000
-#define HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY 0x00200000
-#define HARDWARE_CLIP_MONO_8x8_FILL 0x00100000
-#define HARDWARE_CLIP_COLOR_8x8_FILL 0x00080000
-#define HARDWARE_CLIP_SOLID_FILL 0x00040000
-#define HARDWARE_CLIP_DASHED_LINE 0x00020000
-#define HARDWARE_CLIP_SOLID_LINE 0x00010000
-
-#define HARDWARE_CLIP_LINE 0x00000000
-
-
-/* image write flags */
-#define CONVERT_32BPP_TO_24BPP 0x00010000
-
-/* pixmap cache flags */
-#define CACHE_MONO_8x8 0x00000001
-#define CACHE_COLOR_8x8 0x00000002
-#define DO_NOT_BLIT_STIPPLES 0x00000004
-#define DO_NOT_TILE_MONO_DATA 0x00000008
-#define DO_NOT_TILE_COLOR_DATA 0x00000010
-
-
-#define DEGREES_0 0
-#define DEGREES_90 1
-#define DEGREES_180 2
-#define DEGREES_270 3
-
-#define OMIT_LAST 1
-
-/* render flags */
-
-#define XAA_RENDER_POWER_OF_2_TILE_ONLY 0x00000008
-#define XAA_RENDER_NO_SRC_ALPHA 0x00000004
-#define XAA_RENDER_IMPRECISE_ONLY 0x00000002
-#define XAA_RENDER_NO_TILE 0x00000001
-
-#define XAA_RENDER_REPEAT 0x00000001
-
-typedef void (* ValidateGCProcPtr)(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
-
-typedef struct {
- unsigned char *bits;
- int width;
- int height;
- int yoff;
- int srcwidth;
- int start;
- int end;
-} NonTEGlyphInfo, *NonTEGlyphPtr;
-
-
-typedef struct {
- int x;
- int y;
- int w;
- int h;
- int orig_w;
- int orig_h;
- unsigned long serialNumber;
- int pat0;
- int pat1;
- int fg;
- int bg;
- int trans_color;
- DDXPointPtr offsets;
- DevUnion devPrivate;
-} XAACacheInfoRec, *XAACacheInfoPtr;
-
-
-typedef struct _PixmapLink {
- PixmapPtr pPix;
- struct _PixmapLink *next;
- FBAreaPtr area;
-} PixmapLink, *PixmapLinkPtr;
-
-typedef struct _XAAInfoRec {
- ScrnInfoPtr pScrn;
- int Flags;
-
- void (*Sync)(
- ScrnInfoPtr pScrn
- );
-
- /* Restore Accel State is a driver callback that is used
- * when another screen on the same device has been active.
- * This allows multihead on a single device to work.
- * If The entityProp has IS_SHARED_ACCEL defined then this
- * function is required.
- */
-
- void (*RestoreAccelState)(
- ScrnInfoPtr pScrn
- );
-
- /***************** Low Level *****************/
-
-/* Blits */
- void (*SetupForScreenToScreenCopy)(
- ScrnInfoPtr pScrn,
- int xdir, int ydir,
- int rop,
- unsigned int planemask,
- int trans_color
- );
- int ScreenToScreenCopyFlags;
-
- void (*SubsequentScreenToScreenCopy)(
- ScrnInfoPtr pScrn,
- int xsrc, int ysrc,
- int xdst, int ydst,
- int w, int h
- );
-
-
-/* Solid fills */
- void (*SetupForSolidFill)(
- ScrnInfoPtr pScrn,
- int color,
- int rop,
- unsigned int planemask
- );
- int SolidFillFlags;
-
- void (*SubsequentSolidFillRect)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h
- );
-
- void (*SubsequentSolidFillTrap)(
- ScrnInfoPtr pScrn,
- int y, int h,
- int left, int dxL, int dyL, int eL,
- int right, int dxR, int dyR, int eR
- );
-
-
-/* Solid lines */
-
- void (*SetupForSolidLine)(
- ScrnInfoPtr pScrn,
- int color,
- int rop,
- unsigned int planemask
- );
- int SolidLineFlags;
-
- void (*SubsequentSolidTwoPointLine)(
- ScrnInfoPtr pScrn,
- int xa, int ya, int xb, int yb, int flags
- );
-
- void (*SubsequentSolidBresenhamLine)(
- ScrnInfoPtr pScrn,
- int x, int y, int absmaj, int absmin, int err, int len, int octant
- );
- int SolidBresenhamLineErrorTermBits;
-
- void (*SubsequentSolidHorVertLine)(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
- );
-
-/* Dashed lines */
-
- void (*SetupForDashedLine)(
- ScrnInfoPtr pScrn,
- int fg, int bg,
- int rop,
- unsigned int planemask,
- int length,
- unsigned char *pattern
- );
- int DashedLineFlags;
- int DashPatternMaxLength;
-
- void (*SubsequentDashedTwoPointLine)(
- ScrnInfoPtr pScrn,
- int xa, int ya, int xb, int yb, int flags, int phase
- );
-
- void (*SubsequentDashedBresenhamLine)(
- ScrnInfoPtr pScrn,
- int x, int y, int absmaj, int absmin, int err, int len, int flags,
- int phase
- );
- int DashedBresenhamLineErrorTermBits;
-
-/* Clipper */
-
- void (*SetClippingRectangle) (
- ScrnInfoPtr pScrn,
- int left, int top, int right, int bottom
- );
- int ClippingFlags;
-
- void (*DisableClipping)(ScrnInfoPtr pScrn);
-
-/* 8x8 mono pattern fills */
- void (*SetupForMono8x8PatternFill)(
- ScrnInfoPtr pScrn,
- int patx, int paty,
- int fg, int bg,
- int rop,
- unsigned int planemask
- );
- int Mono8x8PatternFillFlags;
-
- void (*SubsequentMono8x8PatternFillRect)(
- ScrnInfoPtr pScrn,
- int patx, int paty,
- int x, int y, int w, int h
- );
-
- void (*SubsequentMono8x8PatternFillTrap)(
- ScrnInfoPtr pScrn,
- int patx, int paty,
- int y, int h,
- int left, int dxL, int dyL, int eL,
- int right, int dxR, int dyR, int eR
- );
-
-/* 8x8 color pattern fills */
-
- void (*SetupForColor8x8PatternFill)(
- ScrnInfoPtr pScrn,
- int patx, int paty,
- int rop,
- unsigned int planemask,
- int transparency_color
- );
- int Color8x8PatternFillFlags;
-
- void (*SubsequentColor8x8PatternFillRect)(
- ScrnInfoPtr pScrn,
- int patx, int paty,
- int x, int y, int w, int h
- );
-
- void (*SubsequentColor8x8PatternFillTrap)(
- ScrnInfoPtr pScrn,
- int patx, int paty,
- int y, int h,
- int left, int dxL, int dyL, int eL,
- int right, int dxR, int dyR, int eR
- );
-
-
-/* Color expansion */
-
- void (*SetupForCPUToScreenColorExpandFill)(
- ScrnInfoPtr pScrn,
- int fg, int bg,
- int rop,
- unsigned int planemask
- );
- int CPUToScreenColorExpandFillFlags;
-
- void (*SubsequentCPUToScreenColorExpandFill)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int skipleft
- );
-
- unsigned char *ColorExpandBase;
- int ColorExpandRange;
-
-
-/* Scanline color expansion */
-
- void (*SetupForScanlineCPUToScreenColorExpandFill)(
- ScrnInfoPtr pScrn,
- int fg, int bg,
- int rop,
- unsigned int planemask
- );
- int ScanlineCPUToScreenColorExpandFillFlags;
-
- void (*SubsequentScanlineCPUToScreenColorExpandFill)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int skipleft
- );
-
- void (*SubsequentColorExpandScanline)(
- ScrnInfoPtr pScrn,
- int bufno
- );
-
- int NumScanlineColorExpandBuffers;
- unsigned char **ScanlineColorExpandBuffers;
-
-/* Screen to screen color expansion */
-
- void (*SetupForScreenToScreenColorExpandFill) (
- ScrnInfoPtr pScrn,
- int fg, int bg,
- int rop,
- unsigned int planemask
- );
- int ScreenToScreenColorExpandFillFlags;
-
- void (*SubsequentScreenToScreenColorExpandFill)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int srcx, int srcy, int skipleft
- );
-
-
-/* Image transfers */
-
- void (*SetupForImageWrite)(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
- );
- int ImageWriteFlags;
-
- void (*SubsequentImageWriteRect)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int skipleft
- );
- unsigned char *ImageWriteBase;
- int ImageWriteRange;
-
-/* Scanline Image transfers */
-
- void (*SetupForScanlineImageWrite)(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
- );
- int ScanlineImageWriteFlags;
-
- void (*SubsequentScanlineImageWriteRect)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int skipleft
- );
-
- void (*SubsequentImageWriteScanline) (
- ScrnInfoPtr pScrn,
- int bufno
- );
-
- int NumScanlineImageWriteBuffers;
- unsigned char **ScanlineImageWriteBuffers;
-
- /* Image Reads - OBSOLETE AND NOT USED */
-
- void (*SetupForImageRead) (
- ScrnInfoPtr pScrn,
- int bpp, int depth
- );
- int ImageReadFlags;
-
- unsigned char *ImageReadBase;
- int ImageReadRange;
-
- void (*SubsequentImageReadRect)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h
- );
-
-
- /***************** Mid Level *****************/
- void (*ScreenToScreenBitBlt)(
- ScrnInfoPtr pScrn,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir, int ydir,
- int alu,
- unsigned int planmask
- );
- int ScreenToScreenBitBltFlags;
-
- void (*WriteBitmap) (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
- );
- int WriteBitmapFlags;
-
- void (*FillSolidRects)(
- ScrnInfoPtr pScrn,
- int fg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox
- );
- int FillSolidRectsFlags;
-
- void (*FillMono8x8PatternRects)(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int pat0, int pat1,
- int xorg, int yorg
- );
- int FillMono8x8PatternRectsFlags;
-
- void (*FillColor8x8PatternRects)(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
- );
- int FillColor8x8PatternRectsFlags;
-
- void (*FillCacheBltRects)(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
- );
- int FillCacheBltRectsFlags;
-
- void (*FillColorExpandRects)(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
- );
- int FillColorExpandRectsFlags;
-
- void (*FillCacheExpandRects)(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
- );
- int FillCacheExpandRectsFlags;
-
- void (*FillImageWriteRects)(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
- );
- int FillImageWriteRectsFlags;
-
-
- void (*FillSolidSpans)(
- ScrnInfoPtr pScrn,
- int fg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr points,
- int *widths,
- int fSorted
- );
- int FillSolidSpansFlags;
-
- void (*FillMono8x8PatternSpans)(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr points,
- int *widths,
- int fSorted,
- int pat0, int pat1,
- int xorg, int yorg
- );
- int FillMono8x8PatternSpansFlags;
-
- void (*FillColor8x8PatternSpans)(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr points,
- int *widths,
- int fSorted,
- XAACacheInfoPtr pCache,
- int xorg, int yorg
- );
- int FillColor8x8PatternSpansFlags;
-
- void (*FillCacheBltSpans)(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr points,
- int *widths,
- int fSorted,
- XAACacheInfoPtr pCache,
- int xorg, int yorg
- );
- int FillCacheBltSpansFlags;
-
- void (*FillColorExpandSpans)(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr points,
- int *widths,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
- );
- int FillColorExpandSpansFlags;
-
- void (*FillCacheExpandSpans)(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
- );
- int FillCacheExpandSpansFlags;
-
- void (*TEGlyphRenderer)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
- );
- int TEGlyphRendererFlags;
-
- void (*NonTEGlyphRenderer)(
- ScrnInfoPtr pScrn,
- int x, int y, int n,
- NonTEGlyphPtr glyphs,
- BoxPtr pbox,
- int fg, int rop,
- unsigned int planemask
- );
- int NonTEGlyphRendererFlags;
-
- void (*WritePixmap) (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
- );
- int WritePixmapFlags;
-
- void (*ReadPixmap) (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *dst,
- int dstwidth,
- int bpp, int depth
- );
- int ReadPixmapFlags;
-
- /***************** GC Level *****************/
- RegionPtr (*CopyArea)(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
- );
- int CopyAreaFlags;
-
- RegionPtr (*CopyPlane)(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
- );
- int CopyPlaneFlags;
-
- void (*PushPixelsSolid) (
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDrawable,
- int dx, int dy,
- int xOrg, int yOrg
- );
- int PushPixelsFlags;
-
- /** PolyFillRect **/
-
- void (*PolyFillRectSolid)(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
- );
- int PolyFillRectSolidFlags;
-
- void (*PolyFillRectStippled)(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
- );
- int PolyFillRectStippledFlags;
-
- void (*PolyFillRectOpaqueStippled)(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
- );
- int PolyFillRectOpaqueStippledFlags;
-
- void (*PolyFillRectTiled)(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
- );
- int PolyFillRectTiledFlags;
-
- /** FillSpans **/
-
- void (*FillSpansSolid)(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
- );
- int FillSpansSolidFlags;
-
- void (*FillSpansStippled)(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
- );
- int FillSpansStippledFlags;
-
- void (*FillSpansOpaqueStippled)(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
- );
- int FillSpansOpaqueStippledFlags;
-
- void (*FillSpansTiled)(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
- );
- int FillSpansTiledFlags;
-
- int (*PolyText8TE) (
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
- );
- int PolyText8TEFlags;
-
- int (*PolyText16TE) (
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
- );
- int PolyText16TEFlags;
-
- void (*ImageText8TE) (
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
- );
- int ImageText8TEFlags;
-
- void (*ImageText16TE) (
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
- );
- int ImageText16TEFlags;
-
- void (*ImageGlyphBltTE) (
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
- );
- int ImageGlyphBltTEFlags;
-
- void (*PolyGlyphBltTE) (
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
- );
- int PolyGlyphBltTEFlags;
-
- int (*PolyText8NonTE) (
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
- );
- int PolyText8NonTEFlags;
-
- int (*PolyText16NonTE) (
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
- );
- int PolyText16NonTEFlags;
-
- void (*ImageText8NonTE) (
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
- );
- int ImageText8NonTEFlags;
-
- void (*ImageText16NonTE) (
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
- );
- int ImageText16NonTEFlags;
-
- void (*ImageGlyphBltNonTE) (
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
- );
- int ImageGlyphBltNonTEFlags;
-
- void (*PolyGlyphBltNonTE) (
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
- );
- int PolyGlyphBltNonTEFlags;
-
- void (*PolyRectangleThinSolid)(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
- );
- int PolyRectangleThinSolidFlags;
-
- void (*PolylinesWideSolid)(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
- );
- int PolylinesWideSolidFlags;
-
- void (*PolylinesThinSolid)(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
- );
- int PolylinesThinSolidFlags;
-
- void (*PolySegmentThinSolid)(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
- );
- int PolySegmentThinSolidFlags;
-
- void (*PolylinesThinDashed)(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
- );
- int PolylinesThinDashedFlags;
-
- void (*PolySegmentThinDashed)(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
- );
- int PolySegmentThinDashedFlags;
-
- void (*FillPolygonSolid)(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
- );
- int FillPolygonSolidFlags;
-
- void (*FillPolygonStippled)(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
- );
- int FillPolygonStippledFlags;
-
- void (*FillPolygonOpaqueStippled)(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
- );
- int FillPolygonOpaqueStippledFlags;
-
- void (*FillPolygonTiled)(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
- );
- int FillPolygonTiledFlags;
-
- void (*PolyFillArcSolid)(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
- );
- int PolyFillArcSolidFlags;
-
- void (*PutImage)(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage
- );
- int PutImageFlags;
-
- /* Validation masks */
-
- unsigned long FillSpansMask;
- ValidateGCProcPtr ValidateFillSpans;
- unsigned long SetSpansMask;
- ValidateGCProcPtr ValidateSetSpans;
- unsigned long PutImageMask;
- ValidateGCProcPtr ValidatePutImage;
- unsigned long CopyAreaMask;
- ValidateGCProcPtr ValidateCopyArea;
- unsigned long CopyPlaneMask;
- ValidateGCProcPtr ValidateCopyPlane;
- unsigned long PolyPointMask;
- ValidateGCProcPtr ValidatePolyPoint;
- unsigned long PolylinesMask;
- ValidateGCProcPtr ValidatePolylines;
- unsigned long PolySegmentMask;
- ValidateGCProcPtr ValidatePolySegment;
- unsigned long PolyRectangleMask;
- ValidateGCProcPtr ValidatePolyRectangle;
- unsigned long PolyArcMask;
- ValidateGCProcPtr ValidatePolyArc;
- unsigned long FillPolygonMask;
- ValidateGCProcPtr ValidateFillPolygon;
- unsigned long PolyFillRectMask;
- ValidateGCProcPtr ValidatePolyFillRect;
- unsigned long PolyFillArcMask;
- ValidateGCProcPtr ValidatePolyFillArc;
- unsigned long PolyText8Mask;
- ValidateGCProcPtr ValidatePolyText8;
- unsigned long PolyText16Mask;
- ValidateGCProcPtr ValidatePolyText16;
- unsigned long ImageText8Mask;
- ValidateGCProcPtr ValidateImageText8;
- unsigned long ImageText16Mask;
- ValidateGCProcPtr ValidateImageText16;
- unsigned long PolyGlyphBltMask;
- ValidateGCProcPtr ValidatePolyGlyphBlt;
- unsigned long ImageGlyphBltMask;
- ValidateGCProcPtr ValidateImageGlyphBlt;
- unsigned long PushPixelsMask;
- ValidateGCProcPtr ValidatePushPixels;
-
- void (*ComputeDash)(GCPtr pGC);
-
- /* Pixmap Cache */
-
- int PixmapCacheFlags;
- Bool UsingPixmapCache;
- Bool CanDoMono8x8;
- Bool CanDoColor8x8;
-
- void (*InitPixmapCache)(
- ScreenPtr pScreen,
- RegionPtr areas,
- pointer data
- );
- void (*ClosePixmapCache)(
- ScreenPtr pScreen
- );
-
- int (*StippledFillChooser)(GCPtr pGC);
- int (*OpaqueStippledFillChooser)(GCPtr pGC);
- int (*TiledFillChooser)(GCPtr pGC);
-
- int CachePixelGranularity;
- int MaxCacheableTileWidth;
- int MaxCacheableTileHeight;
- int MaxCacheableStippleWidth;
- int MaxCacheableStippleHeight;
-
- XAACacheInfoPtr (*CacheTile)(
- ScrnInfoPtr Scrn, PixmapPtr pPix
- );
- XAACacheInfoPtr (*CacheStipple)(
- ScrnInfoPtr Scrn, PixmapPtr pPix,
- int fg, int bg
- );
- XAACacheInfoPtr (*CacheMonoStipple)(
- ScrnInfoPtr Scrn, PixmapPtr pPix
- );
- XAACacheInfoPtr (*CacheMono8x8Pattern)(
- ScrnInfoPtr Scrn, int pat0, int pat1
- );
- XAACacheInfoPtr (*CacheColor8x8Pattern)(
- ScrnInfoPtr Scrn, PixmapPtr pPix,
- int fg, int bg
- );
-
-
- int MonoPatternPitch;
- int CacheWidthMono8x8Pattern;
- int CacheHeightMono8x8Pattern;
-
- int ColorPatternPitch;
- int CacheWidthColor8x8Pattern;
- int CacheHeightColor8x8Pattern;
-
- int CacheColorExpandDensity;
-
- void (*WriteBitmapToCache) (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int fg, int bg
- );
- void (*WritePixmapToCache) (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int bpp, int depth
- );
- void (*WriteMono8x8PatternToCache)(
- ScrnInfoPtr pScrn,
- XAACacheInfoPtr pCache
- );
- void (*WriteColor8x8PatternToCache)(
- ScrnInfoPtr pScrn,
- PixmapPtr pPix,
- XAACacheInfoPtr pCache
- );
-
- char* PixmapCachePrivate;
-
- /* Miscellaneous */
-
- GC ScratchGC;
- int PreAllocSize;
- unsigned char *PreAllocMem;
-
- CharInfoPtr CharInfo[255];
- NonTEGlyphInfo GlyphInfo[255];
-
- unsigned int FullPlanemask; /* deprecated */
-
- PixmapLinkPtr OffscreenPixmaps;
- int maxOffPixWidth;
- int maxOffPixHeight;
-
- XAACacheInfoRec ScratchCacheInfoRec;
-
- BoxPtr ClipBox;
-
- Bool NeedToSync;
-
- char *dgaSaves;
-
- /* These can be supplied to override the defaults */
-
- GetImageProcPtr GetImage;
- GetSpansProcPtr GetSpans;
- CopyWindowProcPtr CopyWindow;
-
- unsigned int offscreenDepths;
- Bool offscreenDepthsInitialized;
-
- CARD32 FullPlanemasks[32];
-
- Bool (*Composite) (
- CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height
- );
-
- Bool (*Glyphs) (
- CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs
- );
-
- /* The old SetupForCPUToScreenAlphaTexture function is no longer used because
- * it doesn't pass in enough information to write a conforming
- * implementation. See SetupForCPUToScreenAlphaTexture2.
- */
- Bool (*SetupForCPUToScreenAlphaTexture) (
- ScrnInfoPtr pScrn,
- int op,
- CARD16 red,
- CARD16 green,
- CARD16 blue,
- CARD16 alpha,
- int alphaType,
- CARD8 *alphaPtr,
- int alphaPitch,
- int width,
- int height,
- int flags
- );
- void (*SubsequentCPUToScreenAlphaTexture) (
- ScrnInfoPtr pScrn,
- int dstx,
- int dsty,
- int srcx,
- int srcy,
- int width,
- int height
- );
- int CPUToScreenAlphaTextureFlags;
- CARD32 * CPUToScreenAlphaTextureFormats;
-
- /* The old SetupForCPUToScreenTexture function is no longer used because
- * it doesn't pass in enough information to write a conforming
- * implementation. See SetupForCPUToScreenTexture2.
- */
- Bool (*SetupForCPUToScreenTexture) (
- ScrnInfoPtr pScrn,
- int op,
- int texType,
- CARD8 *texPtr,
- int texPitch,
- int width,
- int height,
- int flags
- );
- void (*SubsequentCPUToScreenTexture) (
- ScrnInfoPtr pScrn,
- int dstx,
- int dsty,
- int srcx,
- int srcy,
- int width,
- int height
- );
- int CPUToScreenTextureFlags;
- CARD32 * CPUToScreenTextureFormats;
-
-
- /* these were added for 4.3.0 */
- BoxRec SolidLineLimits;
- BoxRec DashedLineLimits;
-
- /* These were added for X.Org 6.8.0 */
- Bool (*SetupForCPUToScreenAlphaTexture2) (
- ScrnInfoPtr pScrn,
- int op,
- CARD16 red,
- CARD16 green,
- CARD16 blue,
- CARD16 alpha,
- CARD32 maskFormat,
- CARD32 dstFormat,
- CARD8 *alphaPtr,
- int alphaPitch,
- int width,
- int height,
- int flags
- );
- CARD32 *CPUToScreenAlphaTextureDstFormats;
-
- Bool (*SetupForCPUToScreenTexture2) (
- ScrnInfoPtr pScrn,
- int op,
- CARD32 srcFormat,
- CARD32 dstFormat,
- CARD8 *texPtr,
- int texPitch,
- int width,
- int height,
- int flags
- );
- CARD32 *CPUToScreenTextureDstFormats;
-} XAAInfoRec, *XAAInfoRecPtr;
-
-#define SET_SYNC_FLAG(infoRec) (infoRec)->NeedToSync = TRUE
-
-
-extern _X_EXPORT Bool
-XAAInit(
- ScreenPtr pScreen,
- XAAInfoRecPtr infoRec
-);
-
-extern _X_EXPORT XAAInfoRecPtr XAACreateInfoRec(void);
-
-extern _X_EXPORT void
-XAADestroyInfoRec(
- XAAInfoRecPtr infoRec
-);
-
-typedef void (*DepthChangeFuncPtr) (ScrnInfoPtr pScrn, int depth);
-
-extern _X_EXPORT Bool
-XAAInitDualFramebufferOverlay(
- ScreenPtr pScreen,
- DepthChangeFuncPtr callback
-);
-
-#endif /* _XAA_H */
+
+#ifndef _XAA_H
+#define _XAA_H
+
+#define XAA_VERSION_MAJOR 1
+#define XAA_VERSION_MINOR 2
+#define XAA_VERSION_RELEASE 1
+
+/*
+
+ ******** OPERATION SPECIFIC FLAGS *********
+
+ **** solid/dashed line flags ****
+
+--------- --------
+23 LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
+22 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
+21 LINE_PATTERN_MSBFIRST_MSBJUSTIFIED
+20 LINE_PATTERN_MSBFIRST_LSBJUSTIFIED
+19 LINE_PATTERN_POWER_OF_2_ONLY
+18 LINE_LIMIT_COORDS
+17 .
+16 .
+--------- -------
+
+ **** screen to screen copy flags ****
+
+--------- --------
+23 ONLY_LEFT_TO_RIGHT_BITBLT
+22 ONLY_TWO_BITBLT_DIRECTIONS
+21 .
+20 .
+19 .
+18 .
+17 .
+16 .
+--------- -------
+
+ **** clipping flags ****
+
+--------- --------
+23 .
+22 HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND
+21 HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
+20 HARDWARE_CLIP_MONO_8x8_FILL
+19 HARDWARE_CLIP_COLOR_8x8_FILL
+18 HARDWARE_CLIP_SOLID_FILL
+17 HARDWARE_CLIP_DASHED_LINE
+16 HARDWARE_CLIP_SOLID_LINE
+--------- -------
+
+ **** hardware pattern flags ****
+
+--------- --------
+23 .
+22 .
+21 HARDWARE_PATTERN_SCREEN_ORIGIN
+20 .
+19 .
+18 .
+17 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+16 HARDWARE_PATTERN_PROGRAMMED_BITS
+--------- -------
+
+ **** write pixmap flags ****
+
+--------- --------
+23 .
+22 .
+21 .
+20 .
+19 .
+18 .
+17 .
+16 CONVERT_32BPP_TO_24BPP
+--------- -------
+
+ ******** GENERIC FLAGS *********
+
+--------- -------
+15 SYNC_AFTER_COLOR_EXPAND
+14 CPU_TRANSFER_PAD_QWORD
+13 .
+12 LEFT_EDGE_CLIPPING_NEGATIVE_X
+11 LEFT_EDGE_CLIPPING
+10 CPU_TRANSFER_BASE_FIXED
+ 9 BIT_ORDER_IN_BYTE_MSBFIRST
+ 8 TRANSPARENCY_GXCOPY_ONLY
+--------- -------
+ 7 NO_TRANSPARENCY
+ 6 TRANSPARENCY_ONLY
+ 5 ROP_NEEDS_SOURCE
+ 4 TRIPLE_BITS_24BPP
+ 3 RGB_EQUAL
+ 2 NO_PLANEMASK
+ 1 NO_GXCOPY
+ 0 GXCOPY_ONLY
+--------- -------
+
+
+*/
+
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "regionstr.h"
+#include "xf86fbman.h"
+
+#include "picturestr.h"
+
+/* Flags */
+#define PIXMAP_CACHE 0x00000001
+#define MICROSOFT_ZERO_LINE_BIAS 0x00000002
+#define OFFSCREEN_PIXMAPS 0x00000004
+#define LINEAR_FRAMEBUFFER 0x00000008
+
+/* GC fg, bg, and planemask restrictions */
+#define GXCOPY_ONLY 0x00000001
+#define NO_GXCOPY 0x00000002
+#define NO_PLANEMASK 0x00000004
+#define RGB_EQUAL 0x00000008
+#define TRIPLE_BITS_24BPP 0x00000010
+#define ROP_NEEDS_SOURCE 0x00000020
+
+/* transparency restrictions */
+#define TRANSPARENCY_ONLY 0x00000040
+#define NO_TRANSPARENCY 0x00000080
+#define TRANSPARENCY_GXCOPY_ONLY 0x00000100
+
+/* bit order restrictions */
+#define BIT_ORDER_IN_BYTE_MSBFIRST 0x00000200
+#define BIT_ORDER_IN_BYTE_LSBFIRST 0x00000000
+
+/* transfer base restriction */
+#define CPU_TRANSFER_BASE_FIXED 0x00000400
+
+/* skipleft restrictions */
+#define LEFT_EDGE_CLIPPING 0x00000800
+#define LEFT_EDGE_CLIPPING_NEGATIVE_X 0x00001000
+
+/* data padding */
+#define CPU_TRANSFER_PAD_DWORD 0x00000000
+#define CPU_TRANSFER_PAD_QWORD 0x00004000
+#define SCANLINE_PAD_DWORD 0x00000000
+
+#define SYNC_AFTER_COLOR_EXPAND 0x00008000
+#define SYNC_AFTER_IMAGE_WRITE SYNC_AFTER_COLOR_EXPAND
+
+/* hardware pattern */
+#define HARDWARE_PATTERN_PROGRAMMED_BITS 0x00010000
+#define HARDWARE_PATTERN_PROGRAMMED_ORIGIN 0x00020000
+#define HARDWARE_PATTERN_SCREEN_ORIGIN 0x00200000
+
+/* copyarea flags */
+#define ONLY_TWO_BITBLT_DIRECTIONS 0x00400000
+#define ONLY_LEFT_TO_RIGHT_BITBLT 0x00800000
+
+/* line flags */
+#define LINE_PATTERN_LSBFIRST_MSBJUSTIFIED 0x00800000
+#define LINE_PATTERN_LSBFIRST_LSBJUSTIFIED 0x00400000
+#define LINE_PATTERN_MSBFIRST_MSBJUSTIFIED 0x00200000
+#define LINE_PATTERN_MSBFIRST_LSBJUSTIFIED 0x00100000
+#define LINE_PATTERN_POWER_OF_2_ONLY 0x00080000
+#define LINE_LIMIT_COORDS 0x00040000
+
+/* clipping flags */
+#define HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND 0x00400000
+#define HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY 0x00200000
+#define HARDWARE_CLIP_MONO_8x8_FILL 0x00100000
+#define HARDWARE_CLIP_COLOR_8x8_FILL 0x00080000
+#define HARDWARE_CLIP_SOLID_FILL 0x00040000
+#define HARDWARE_CLIP_DASHED_LINE 0x00020000
+#define HARDWARE_CLIP_SOLID_LINE 0x00010000
+
+#define HARDWARE_CLIP_LINE 0x00000000
+
+/* image write flags */
+#define CONVERT_32BPP_TO_24BPP 0x00010000
+
+/* pixmap cache flags */
+#define CACHE_MONO_8x8 0x00000001
+#define CACHE_COLOR_8x8 0x00000002
+#define DO_NOT_BLIT_STIPPLES 0x00000004
+#define DO_NOT_TILE_MONO_DATA 0x00000008
+#define DO_NOT_TILE_COLOR_DATA 0x00000010
+
+#define DEGREES_0 0
+#define DEGREES_90 1
+#define DEGREES_180 2
+#define DEGREES_270 3
+
+#define OMIT_LAST 1
+
+/* render flags */
+
+#define XAA_RENDER_POWER_OF_2_TILE_ONLY 0x00000008
+#define XAA_RENDER_NO_SRC_ALPHA 0x00000004
+#define XAA_RENDER_IMPRECISE_ONLY 0x00000002
+#define XAA_RENDER_NO_TILE 0x00000001
+
+#define XAA_RENDER_REPEAT 0x00000001
+
+typedef void (*ValidateGCProcPtr) (GCPtr pGC,
+ unsigned long changes, DrawablePtr pDraw);
+
+typedef struct {
+ unsigned char *bits;
+ int width;
+ int height;
+ int yoff;
+ int srcwidth;
+ int start;
+ int end;
+} NonTEGlyphInfo, *NonTEGlyphPtr;
+
+typedef struct {
+ int x;
+ int y;
+ int w;
+ int h;
+ int orig_w;
+ int orig_h;
+ unsigned long serialNumber;
+ int pat0;
+ int pat1;
+ int fg;
+ int bg;
+ int trans_color;
+ DDXPointPtr offsets;
+ DevUnion devPrivate;
+} XAACacheInfoRec, *XAACacheInfoPtr;
+
+typedef struct _PixmapLink {
+ PixmapPtr pPix;
+ struct _PixmapLink *next;
+ FBAreaPtr area;
+} PixmapLink, *PixmapLinkPtr;
+
+typedef struct _XAAInfoRec {
+ ScrnInfoPtr pScrn;
+ int Flags;
+
+ void (*Sync) (ScrnInfoPtr pScrn);
+
+ /* Restore Accel State is a driver callback that is used
+ * when another screen on the same device has been active.
+ * This allows multihead on a single device to work.
+ * If The entityProp has IS_SHARED_ACCEL defined then this
+ * function is required.
+ */
+
+ void (*RestoreAccelState) (ScrnInfoPtr pScrn);
+
+ /***************** Low Level *****************/
+
+/* Blits */
+ void (*SetupForScreenToScreenCopy) (ScrnInfoPtr pScrn,
+ int xdir, int ydir,
+ int rop,
+ unsigned int planemask,
+ int trans_color);
+ int ScreenToScreenCopyFlags;
+
+ void (*SubsequentScreenToScreenCopy) (ScrnInfoPtr pScrn,
+ int xsrc, int ysrc,
+ int xdst, int ydst, int w, int h);
+
+/* Solid fills */
+ void (*SetupForSolidFill) (ScrnInfoPtr pScrn,
+ int color, int rop, unsigned int planemask);
+ int SolidFillFlags;
+
+ void (*SubsequentSolidFillRect) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h);
+
+ void (*SubsequentSolidFillTrap) (ScrnInfoPtr pScrn,
+ int y, int h,
+ int left, int dxL, int dyL, int eL,
+ int right, int dxR, int dyR, int eR);
+
+/* Solid lines */
+
+ void (*SetupForSolidLine) (ScrnInfoPtr pScrn,
+ int color, int rop, unsigned int planemask);
+ int SolidLineFlags;
+
+ void (*SubsequentSolidTwoPointLine) (ScrnInfoPtr pScrn,
+ int xa, int ya, int xb, int yb,
+ int flags);
+
+ void (*SubsequentSolidBresenhamLine) (ScrnInfoPtr pScrn,
+ int x, int y, int absmaj, int absmin,
+ int err, int len, int octant);
+ int SolidBresenhamLineErrorTermBits;
+
+ void (*SubsequentSolidHorVertLine) (ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir);
+
+/* Dashed lines */
+
+ void (*SetupForDashedLine) (ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask,
+ int length, unsigned char *pattern);
+ int DashedLineFlags;
+ int DashPatternMaxLength;
+
+ void (*SubsequentDashedTwoPointLine) (ScrnInfoPtr pScrn,
+ int xa, int ya, int xb, int yb,
+ int flags, int phase);
+
+ void (*SubsequentDashedBresenhamLine) (ScrnInfoPtr pScrn,
+ int x, int y, int absmaj, int absmin,
+ int err, int len, int flags,
+ int phase);
+ int DashedBresenhamLineErrorTermBits;
+
+/* Clipper */
+
+ void (*SetClippingRectangle) (ScrnInfoPtr pScrn,
+ int left, int top, int right, int bottom);
+ int ClippingFlags;
+
+ void (*DisableClipping) (ScrnInfoPtr pScrn);
+
+/* 8x8 mono pattern fills */
+ void (*SetupForMono8x8PatternFill) (ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+ int Mono8x8PatternFillFlags;
+
+ void (*SubsequentMono8x8PatternFillRect) (ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int x, int y, int w, int h);
+
+ void (*SubsequentMono8x8PatternFillTrap) (ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int y, int h,
+ int left, int dxL, int dyL,
+ int eL, int right, int dxR,
+ int dyR, int eR);
+
+/* 8x8 color pattern fills */
+
+ void (*SetupForColor8x8PatternFill) (ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int rop,
+ unsigned int planemask,
+ int transparency_color);
+ int Color8x8PatternFillFlags;
+
+ void (*SubsequentColor8x8PatternFillRect) (ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int x, int y, int w, int h);
+
+ void (*SubsequentColor8x8PatternFillTrap) (ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int y, int h,
+ int left, int dxL, int dyL,
+ int eL, int right, int dxR,
+ int dyR, int eR);
+
+/* Color expansion */
+
+ void (*SetupForCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask);
+ int CPUToScreenColorExpandFillFlags;
+
+ void (*SubsequentCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int skipleft);
+
+ unsigned char *ColorExpandBase;
+ int ColorExpandRange;
+
+/* Scanline color expansion */
+
+ void (*SetupForScanlineCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask);
+ int ScanlineCPUToScreenColorExpandFillFlags;
+
+ void (*SubsequentScanlineCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn,
+ int x, int y, int w,
+ int h, int skipleft);
+
+ void (*SubsequentColorExpandScanline) (ScrnInfoPtr pScrn, int bufno);
+
+ int NumScanlineColorExpandBuffers;
+ unsigned char **ScanlineColorExpandBuffers;
+
+/* Screen to screen color expansion */
+
+ void (*SetupForScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask);
+ int ScreenToScreenColorExpandFillFlags;
+
+ void (*SubsequentScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int srcx, int srcy,
+ int skipleft);
+
+/* Image transfers */
+
+ void (*SetupForImageWrite) (ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int transparency_color, int bpp, int depth);
+ int ImageWriteFlags;
+
+ void (*SubsequentImageWriteRect) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft);
+ unsigned char *ImageWriteBase;
+ int ImageWriteRange;
+
+/* Scanline Image transfers */
+
+ void (*SetupForScanlineImageWrite) (ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth);
+ int ScanlineImageWriteFlags;
+
+ void (*SubsequentScanlineImageWriteRect) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int skipleft);
+
+ void (*SubsequentImageWriteScanline) (ScrnInfoPtr pScrn, int bufno);
+
+ int NumScanlineImageWriteBuffers;
+ unsigned char **ScanlineImageWriteBuffers;
+
+ /* Image Reads - OBSOLETE AND NOT USED */
+
+ void (*SetupForImageRead) (ScrnInfoPtr pScrn, int bpp, int depth);
+ int ImageReadFlags;
+
+ unsigned char *ImageReadBase;
+ int ImageReadRange;
+
+ void (*SubsequentImageReadRect) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h);
+
+ /***************** Mid Level *****************/
+ void (*ScreenToScreenBitBlt) (ScrnInfoPtr pScrn,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir, int ydir,
+ int alu, unsigned int planmask);
+ int ScreenToScreenBitBltFlags;
+
+ void (*WriteBitmap) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg, int rop, unsigned int planemask);
+ int WriteBitmapFlags;
+
+ void (*FillSolidRects) (ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox);
+ int FillSolidRectsFlags;
+
+ void (*FillMono8x8PatternRects) (ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pat0, int pat1, int xorg, int yorg);
+ int FillMono8x8PatternRectsFlags;
+
+ void (*FillColor8x8PatternRects) (ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache);
+ int FillColor8x8PatternRectsFlags;
+
+ void (*FillCacheBltRects) (ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, XAACacheInfoPtr pCache);
+ int FillCacheBltRectsFlags;
+
+ void (*FillColorExpandRects) (ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+ int FillColorExpandRectsFlags;
+
+ void (*FillCacheExpandRects) (ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+ int FillCacheExpandRectsFlags;
+
+ void (*FillImageWriteRects) (ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+ int FillImageWriteRectsFlags;
+
+ void (*FillSolidSpans) (ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points, int *widths, int fSorted);
+ int FillSolidSpansFlags;
+
+ void (*FillMono8x8PatternSpans) (ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted,
+ int pat0, int pat1, int xorg, int yorg);
+ int FillMono8x8PatternSpansFlags;
+
+ void (*FillColor8x8PatternSpans) (ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted,
+ XAACacheInfoPtr pCache,
+ int xorg, int yorg);
+ int FillColor8x8PatternSpansFlags;
+
+ void (*FillCacheBltSpans) (ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted,
+ XAACacheInfoPtr pCache, int xorg, int yorg);
+ int FillCacheBltSpansFlags;
+
+ void (*FillColorExpandSpans) (ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+ int FillColorExpandSpansFlags;
+
+ void (*FillCacheExpandSpans) (ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+ int FillCacheExpandSpansFlags;
+
+ void (*TEGlyphRenderer) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+ int TEGlyphRendererFlags;
+
+ void (*NonTEGlyphRenderer) (ScrnInfoPtr pScrn,
+ int x, int y, int n,
+ NonTEGlyphPtr glyphs,
+ BoxPtr pbox,
+ int fg, int rop, unsigned int planemask);
+ int NonTEGlyphRendererFlags;
+
+ void (*WritePixmap) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int rop,
+ unsigned int planemask,
+ int transparency_color, int bpp, int depth);
+ int WritePixmapFlags;
+
+ void (*ReadPixmap) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *dst, int dstwidth, int bpp, int depth);
+ int ReadPixmapFlags;
+
+ /***************** GC Level *****************/
+ RegionPtr (*CopyArea) (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC * pGC,
+ int srcx, int srcy,
+ int width, int height, int dstx, int dsty);
+ int CopyAreaFlags;
+
+ RegionPtr (*CopyPlane) (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty, unsigned long bitPlane);
+ int CopyPlaneFlags;
+
+ void (*PushPixelsSolid) (GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg);
+ int PushPixelsFlags;
+
+ /** PolyFillRect **/
+
+ void (*PolyFillRectSolid) (DrawablePtr pDraw,
+ GCPtr pGC, int nrectFill, xRectangle *prectInit);
+ int PolyFillRectSolidFlags;
+
+ void (*PolyFillRectStippled) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+ int PolyFillRectStippledFlags;
+
+ void (*PolyFillRectOpaqueStippled) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+ int PolyFillRectOpaqueStippledFlags;
+
+ void (*PolyFillRectTiled) (DrawablePtr pDraw,
+ GCPtr pGC, int nrectFill, xRectangle *prectInit);
+ int PolyFillRectTiledFlags;
+
+ /** FillSpans **/
+
+ void (*FillSpansSolid) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ int FillSpansSolidFlags;
+
+ void (*FillSpansStippled) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ int FillSpansStippledFlags;
+
+ void (*FillSpansOpaqueStippled) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ int FillSpansOpaqueStippledFlags;
+
+ void (*FillSpansTiled) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ int FillSpansTiledFlags;
+
+ int (*PolyText8TE) (DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars);
+ int PolyText8TEFlags;
+
+ int (*PolyText16TE) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars);
+ int PolyText16TEFlags;
+
+ void (*ImageText8TE) (DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars);
+ int ImageText8TEFlags;
+
+ void (*ImageText16TE) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars);
+ int ImageText16TEFlags;
+
+ void (*ImageGlyphBltTE) (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+ int ImageGlyphBltTEFlags;
+
+ void (*PolyGlyphBltTE) (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+ int PolyGlyphBltTEFlags;
+
+ int (*PolyText8NonTE) (DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars);
+ int PolyText8NonTEFlags;
+
+ int (*PolyText16NonTE) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars);
+ int PolyText16NonTEFlags;
+
+ void (*ImageText8NonTE) (DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars);
+ int ImageText8NonTEFlags;
+
+ void (*ImageText16NonTE) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars);
+ int ImageText16NonTEFlags;
+
+ void (*ImageGlyphBltNonTE) (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+ int ImageGlyphBltNonTEFlags;
+
+ void (*PolyGlyphBltNonTE) (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+ int PolyGlyphBltNonTEFlags;
+
+ void (*PolyRectangleThinSolid) (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit);
+ int PolyRectangleThinSolidFlags;
+
+ void (*PolylinesWideSolid) (DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pPts);
+ int PolylinesWideSolidFlags;
+
+ void (*PolylinesThinSolid) (DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pPts);
+ int PolylinesThinSolidFlags;
+
+ void (*PolySegmentThinSolid) (DrawablePtr pDrawable,
+ GCPtr pGC, int nseg, xSegment * pSeg);
+ int PolySegmentThinSolidFlags;
+
+ void (*PolylinesThinDashed) (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode, int npt, DDXPointPtr pPts);
+ int PolylinesThinDashedFlags;
+
+ void (*PolySegmentThinDashed) (DrawablePtr pDrawable,
+ GCPtr pGC, int nseg, xSegment * pSeg);
+ int PolySegmentThinDashedFlags;
+
+ void (*FillPolygonSolid) (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ int FillPolygonSolidFlags;
+
+ void (*FillPolygonStippled) (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ int FillPolygonStippledFlags;
+
+ void (*FillPolygonOpaqueStippled) (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ int FillPolygonOpaqueStippledFlags;
+
+ void (*FillPolygonTiled) (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ int FillPolygonTiledFlags;
+
+ void (*PolyFillArcSolid) (DrawablePtr pDraw,
+ GCPtr pGC, int narcs, xArc * parcs);
+ int PolyFillArcSolidFlags;
+
+ void (*PutImage) (DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w, int h, int leftPad, int format, char *pImage);
+ int PutImageFlags;
+
+ /* Validation masks */
+
+ unsigned long FillSpansMask;
+ ValidateGCProcPtr ValidateFillSpans;
+ unsigned long SetSpansMask;
+ ValidateGCProcPtr ValidateSetSpans;
+ unsigned long PutImageMask;
+ ValidateGCProcPtr ValidatePutImage;
+ unsigned long CopyAreaMask;
+ ValidateGCProcPtr ValidateCopyArea;
+ unsigned long CopyPlaneMask;
+ ValidateGCProcPtr ValidateCopyPlane;
+ unsigned long PolyPointMask;
+ ValidateGCProcPtr ValidatePolyPoint;
+ unsigned long PolylinesMask;
+ ValidateGCProcPtr ValidatePolylines;
+ unsigned long PolySegmentMask;
+ ValidateGCProcPtr ValidatePolySegment;
+ unsigned long PolyRectangleMask;
+ ValidateGCProcPtr ValidatePolyRectangle;
+ unsigned long PolyArcMask;
+ ValidateGCProcPtr ValidatePolyArc;
+ unsigned long FillPolygonMask;
+ ValidateGCProcPtr ValidateFillPolygon;
+ unsigned long PolyFillRectMask;
+ ValidateGCProcPtr ValidatePolyFillRect;
+ unsigned long PolyFillArcMask;
+ ValidateGCProcPtr ValidatePolyFillArc;
+ unsigned long PolyText8Mask;
+ ValidateGCProcPtr ValidatePolyText8;
+ unsigned long PolyText16Mask;
+ ValidateGCProcPtr ValidatePolyText16;
+ unsigned long ImageText8Mask;
+ ValidateGCProcPtr ValidateImageText8;
+ unsigned long ImageText16Mask;
+ ValidateGCProcPtr ValidateImageText16;
+ unsigned long PolyGlyphBltMask;
+ ValidateGCProcPtr ValidatePolyGlyphBlt;
+ unsigned long ImageGlyphBltMask;
+ ValidateGCProcPtr ValidateImageGlyphBlt;
+ unsigned long PushPixelsMask;
+ ValidateGCProcPtr ValidatePushPixels;
+
+ void (*ComputeDash) (GCPtr pGC);
+
+ /* Pixmap Cache */
+
+ int PixmapCacheFlags;
+ Bool UsingPixmapCache;
+ Bool CanDoMono8x8;
+ Bool CanDoColor8x8;
+
+ void (*InitPixmapCache) (ScreenPtr pScreen, RegionPtr areas, pointer data);
+ void (*ClosePixmapCache) (ScreenPtr pScreen);
+
+ int (*StippledFillChooser) (GCPtr pGC);
+ int (*OpaqueStippledFillChooser) (GCPtr pGC);
+ int (*TiledFillChooser) (GCPtr pGC);
+
+ int CachePixelGranularity;
+ int MaxCacheableTileWidth;
+ int MaxCacheableTileHeight;
+ int MaxCacheableStippleWidth;
+ int MaxCacheableStippleHeight;
+
+ XAACacheInfoPtr(*CacheTile) (ScrnInfoPtr Scrn, PixmapPtr pPix);
+ XAACacheInfoPtr(*CacheStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix,
+ int fg, int bg);
+ XAACacheInfoPtr(*CacheMonoStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix);
+ XAACacheInfoPtr(*CacheMono8x8Pattern) (ScrnInfoPtr Scrn, int pat0,
+ int pat1);
+ XAACacheInfoPtr(*CacheColor8x8Pattern) (ScrnInfoPtr Scrn, PixmapPtr pPix,
+ int fg, int bg);
+
+ int MonoPatternPitch;
+ int CacheWidthMono8x8Pattern;
+ int CacheHeightMono8x8Pattern;
+
+ int ColorPatternPitch;
+ int CacheWidthColor8x8Pattern;
+ int CacheHeightColor8x8Pattern;
+
+ int CacheColorExpandDensity;
+
+ void (*WriteBitmapToCache) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth, int fg, int bg);
+ void (*WritePixmapToCache) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth, int bpp, int depth);
+ void (*WriteMono8x8PatternToCache) (ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache);
+ void (*WriteColor8x8PatternToCache) (ScrnInfoPtr pScrn,
+ PixmapPtr pPix,
+ XAACacheInfoPtr pCache);
+
+ char *PixmapCachePrivate;
+
+ /* Miscellaneous */
+
+ GC ScratchGC;
+ int PreAllocSize;
+ unsigned char *PreAllocMem;
+
+ CharInfoPtr CharInfo[255];
+ NonTEGlyphInfo GlyphInfo[255];
+
+ unsigned int FullPlanemask; /* deprecated */
+
+ PixmapLinkPtr OffscreenPixmaps;
+ int maxOffPixWidth;
+ int maxOffPixHeight;
+
+ XAACacheInfoRec ScratchCacheInfoRec;
+
+ BoxPtr ClipBox;
+
+ Bool NeedToSync;
+
+ char *dgaSaves;
+
+ /* These can be supplied to override the defaults */
+
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ CopyWindowProcPtr CopyWindow;
+
+ unsigned int offscreenDepths;
+ Bool offscreenDepthsInitialized;
+
+ CARD32 FullPlanemasks[32];
+
+ Bool (*Composite) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
+
+ Bool (*Glyphs) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist, GlyphListPtr list, GlyphPtr * glyphs);
+
+ /* The old SetupForCPUToScreenAlphaTexture function is no longer used because
+ * it doesn't pass in enough information to write a conforming
+ * implementation. See SetupForCPUToScreenAlphaTexture2.
+ */
+ Bool (*SetupForCPUToScreenAlphaTexture) (ScrnInfoPtr pScrn,
+ int op,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ int alphaType,
+ CARD8 *alphaPtr,
+ int alphaPitch,
+ int width, int height, int flags);
+ void (*SubsequentCPUToScreenAlphaTexture) (ScrnInfoPtr pScrn,
+ int dstx,
+ int dsty,
+ int srcx,
+ int srcy, int width, int height);
+ int CPUToScreenAlphaTextureFlags;
+ CARD32 *CPUToScreenAlphaTextureFormats;
+
+ /* The old SetupForCPUToScreenTexture function is no longer used because
+ * it doesn't pass in enough information to write a conforming
+ * implementation. See SetupForCPUToScreenTexture2.
+ */
+ Bool (*SetupForCPUToScreenTexture) (ScrnInfoPtr pScrn,
+ int op,
+ int texType,
+ CARD8 *texPtr,
+ int texPitch,
+ int width, int height, int flags);
+ void (*SubsequentCPUToScreenTexture) (ScrnInfoPtr pScrn,
+ int dstx,
+ int dsty,
+ int srcx,
+ int srcy, int width, int height);
+ int CPUToScreenTextureFlags;
+ CARD32 *CPUToScreenTextureFormats;
+
+ /* these were added for 4.3.0 */
+ BoxRec SolidLineLimits;
+ BoxRec DashedLineLimits;
+
+ /* These were added for X.Org 6.8.0 */
+ Bool (*SetupForCPUToScreenAlphaTexture2) (ScrnInfoPtr pScrn,
+ int op,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 maskFormat,
+ CARD32 dstFormat,
+ CARD8 *alphaPtr,
+ int alphaPitch,
+ int width, int height, int flags);
+ CARD32 *CPUToScreenAlphaTextureDstFormats;
+
+ Bool (*SetupForCPUToScreenTexture2) (ScrnInfoPtr pScrn,
+ int op,
+ CARD32 srcFormat,
+ CARD32 dstFormat,
+ CARD8 *texPtr,
+ int texPitch,
+ int width, int height, int flags);
+ CARD32 *CPUToScreenTextureDstFormats;
+} XAAInfoRec, *XAAInfoRecPtr;
+
+#define SET_SYNC_FLAG(infoRec) (infoRec)->NeedToSync = TRUE
+
+extern _X_EXPORT Bool
+ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec);
+
+extern _X_EXPORT XAAInfoRecPtr XAACreateInfoRec(void);
+
+extern _X_EXPORT void
+ XAADestroyInfoRec(XAAInfoRecPtr infoRec);
+
+typedef void (*DepthChangeFuncPtr) (ScrnInfoPtr pScrn, int depth);
+
+extern _X_EXPORT Bool
+ XAAInitDualFramebufferOverlay(ScreenPtr pScreen, DepthChangeFuncPtr callback);
+
+#endif /* _XAA_H */
diff --git a/xorg-server/hw/xfree86/xaa/xaaBitBlt.c b/xorg-server/hw/xfree86/xaa/xaaBitBlt.c
index 126a4ee65..c1595c497 100644
--- a/xorg-server/hw/xfree86/xaa/xaaBitBlt.c
+++ b/xorg-server/hw/xfree86/xaa/xaaBitBlt.c
@@ -1,221 +1,229 @@
-
-/*
- This is a lighter version of cfbBitBlt. We calculate the boxes
- when accelerating pixmap->screen and screen->screen copies.
- We also pass the GC to the doBitBlt function so that it has access
- to the fg and bg so CopyPlane can use this.
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "mi.h"
-#include "pixmapstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "xaalocal.h"
-
-
-RegionPtr
-XAABitBlt(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- void (*doBitBlt)(DrawablePtr, DrawablePtr, GCPtr, RegionPtr, DDXPointPtr),
- unsigned long bitPlane )
-{
-
- RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
- RegionPtr prgnExposed;
- Bool freeSrcClip = FALSE;
- RegionRec rgnDst;
- DDXPointPtr pptSrc, ppt;
- DDXPointRec origDest;
- BoxPtr pbox;
- BoxRec fastBox;
- int i, dx, dy, numRects;
- xRectangle origSource;
- int fastClip = 0; /* for fast clipping with pixmap source */
- int fastExpose = 0; /* for fast exposures with pixmap source */
-
- origSource.x = srcx;
- origSource.y = srcy;
- origSource.width = width;
- origSource.height = height;
- origDest.x = dstx;
- origDest.y = dsty;
-
- if (pSrcDrawable->pScreen->SourceValidate) {
- (*pSrcDrawable->pScreen->SourceValidate) (
- pSrcDrawable, srcx, srcy, width, height,
- pGC->subWindowMode);
- }
-
- srcx += pSrcDrawable->x;
- srcy += pSrcDrawable->y;
-
- /* clip the source */
- if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
- if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
- prgnSrcClip = pGC->pCompositeClip;
- else
- fastClip = 1;
- } else { /* Window */
- if (pGC->subWindowMode == IncludeInferiors) {
- if (!((WindowPtr) pSrcDrawable)->parent) {
- /*
- * special case bitblt from root window in
- * IncludeInferiors mode; just like from a pixmap
- */
- fastClip = 1;
- } else if ((pSrcDrawable == pDstDrawable) &&
- (pGC->clientClipType == CT_NONE)) {
- prgnSrcClip = pGC->pCompositeClip;
- } else {
- prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
- freeSrcClip = TRUE;
- }
- } else {
- prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
- }
- }
-
- fastBox.x1 = srcx;
- fastBox.y1 = srcy;
- fastBox.x2 = srcx + width;
- fastBox.y2 = srcy + height;
-
- /* Don't create a source region if we are doing a fast clip */
- if (fastClip) {
- fastExpose = 1;
- /*
- * clip the source; if regions extend beyond the source size,
- * make sure exposure events get sent
- */
- if (fastBox.x1 < pSrcDrawable->x) {
- fastBox.x1 = pSrcDrawable->x;
- fastExpose = 0;
- }
- if (fastBox.y1 < pSrcDrawable->y) {
- fastBox.y1 = pSrcDrawable->y;
- fastExpose = 0;
- }
- if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) {
- fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
- fastExpose = 0;
- }
- if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) {
- fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
- fastExpose = 0;
- }
- } else {
- RegionInit(&rgnDst, &fastBox, 1);
- RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip);
- }
-
- dstx += pDstDrawable->x;
- dsty += pDstDrawable->y;
-
- if (pDstDrawable->type == DRAWABLE_WINDOW) {
- if (!((WindowPtr)pDstDrawable)->realized) {
- if (!fastClip)
- RegionUninit(&rgnDst);
- if (freeSrcClip)
- RegionDestroy(prgnSrcClip);
- return NULL;
- }
- }
-
- dx = srcx - dstx;
- dy = srcy - dsty;
-
- /* Translate and clip the dst to the destination composite clip */
- if (fastClip) {
- RegionPtr cclip;
-
- /* Translate the region directly */
- fastBox.x1 -= dx;
- fastBox.x2 -= dx;
- fastBox.y1 -= dy;
- fastBox.y2 -= dy;
-
- /* If the destination composite clip is one rectangle we can
- do the clip directly. Otherwise we have to create a full
- blown region and call intersect */
-
- cclip = pGC->pCompositeClip;
- if (RegionNumRects(cclip) == 1) {
- BoxPtr pBox = RegionRects(cclip);
-
- if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
- if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
- if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
- if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
-
- /* Check to see if the region is empty */
- if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) {
- RegionNull(&rgnDst);
- } else {
- RegionInit(&rgnDst, &fastBox, 1);
- }
- } else {
- /* We must turn off fastClip now, since we must create
- a full blown region. It is intersected with the
- composite clip below. */
- fastClip = 0;
- RegionInit(&rgnDst, &fastBox,1);
- }
- } else {
- RegionTranslate(&rgnDst, -dx, -dy);
- }
-
- if (!fastClip) {
- RegionIntersect(&rgnDst, &rgnDst,
- pGC->pCompositeClip);
- }
-
- /* Do bit blitting */
- numRects = RegionNumRects(&rgnDst);
- if (numRects && width && height) {
- if(!(pptSrc = (DDXPointPtr)malloc(numRects *
- sizeof(DDXPointRec)))) {
- RegionUninit(&rgnDst);
- if (freeSrcClip)
- RegionDestroy(prgnSrcClip);
- return NULL;
- }
- pbox = RegionRects(&rgnDst);
- ppt = pptSrc;
- for (i = numRects; --i >= 0; pbox++, ppt++) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc);
- free(pptSrc);
- }
-
- prgnExposed = NULL;
- if (pGC->fExpose) {
- /* Pixmap sources generate a NoExposed (we return NULL to do this) */
- if (!fastExpose)
- prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
- origSource.x, origSource.y,
- (int)origSource.width,
- (int)origSource.height,
- origDest.x, origDest.y, bitPlane);
- }
- RegionUninit(&rgnDst);
- if (freeSrcClip)
- RegionDestroy(prgnSrcClip);
- return prgnExposed;
-}
+
+/*
+ This is a lighter version of cfbBitBlt. We calculate the boxes
+ when accelerating pixmap->screen and screen->screen copies.
+ We also pass the GC to the doBitBlt function so that it has access
+ to the fg and bg so CopyPlane can use this.
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "mi.h"
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "xaalocal.h"
+
+RegionPtr
+XAABitBlt(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC * pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ void (*doBitBlt) (DrawablePtr, DrawablePtr, GCPtr, RegionPtr,
+ DDXPointPtr), unsigned long bitPlane)
+{
+
+ RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
+ RegionPtr prgnExposed;
+ Bool freeSrcClip = FALSE;
+ RegionRec rgnDst;
+ DDXPointPtr pptSrc, ppt;
+ DDXPointRec origDest;
+ BoxPtr pbox;
+ BoxRec fastBox;
+ int i, dx, dy, numRects;
+ xRectangle origSource;
+ int fastClip = 0; /* for fast clipping with pixmap source */
+ int fastExpose = 0; /* for fast exposures with pixmap source */
+
+ origSource.x = srcx;
+ origSource.y = srcy;
+ origSource.width = width;
+ origSource.height = height;
+ origDest.x = dstx;
+ origDest.y = dsty;
+
+ if (pSrcDrawable->pScreen->SourceValidate) {
+ (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy,
+ width, height,
+ pGC->subWindowMode);
+ }
+
+ srcx += pSrcDrawable->x;
+ srcy += pSrcDrawable->y;
+
+ /* clip the source */
+ if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
+ if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
+ prgnSrcClip = pGC->pCompositeClip;
+ else
+ fastClip = 1;
+ }
+ else { /* Window */
+ if (pGC->subWindowMode == IncludeInferiors) {
+ if (!((WindowPtr) pSrcDrawable)->parent) {
+ /*
+ * special case bitblt from root window in
+ * IncludeInferiors mode; just like from a pixmap
+ */
+ fastClip = 1;
+ }
+ else if ((pSrcDrawable == pDstDrawable) &&
+ (pGC->clientClipType == CT_NONE)) {
+ prgnSrcClip = pGC->pCompositeClip;
+ }
+ else {
+ prgnSrcClip = NotClippedByChildren((WindowPtr) pSrcDrawable);
+ freeSrcClip = TRUE;
+ }
+ }
+ else {
+ prgnSrcClip = &((WindowPtr) pSrcDrawable)->clipList;
+ }
+ }
+
+ fastBox.x1 = srcx;
+ fastBox.y1 = srcy;
+ fastBox.x2 = srcx + width;
+ fastBox.y2 = srcy + height;
+
+ /* Don't create a source region if we are doing a fast clip */
+ if (fastClip) {
+ fastExpose = 1;
+ /*
+ * clip the source; if regions extend beyond the source size,
+ * make sure exposure events get sent
+ */
+ if (fastBox.x1 < pSrcDrawable->x) {
+ fastBox.x1 = pSrcDrawable->x;
+ fastExpose = 0;
+ }
+ if (fastBox.y1 < pSrcDrawable->y) {
+ fastBox.y1 = pSrcDrawable->y;
+ fastExpose = 0;
+ }
+ if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) {
+ fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
+ fastExpose = 0;
+ }
+ if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) {
+ fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
+ fastExpose = 0;
+ }
+ }
+ else {
+ RegionInit(&rgnDst, &fastBox, 1);
+ RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip);
+ }
+
+ dstx += pDstDrawable->x;
+ dsty += pDstDrawable->y;
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW) {
+ if (!((WindowPtr) pDstDrawable)->realized) {
+ if (!fastClip)
+ RegionUninit(&rgnDst);
+ if (freeSrcClip)
+ RegionDestroy(prgnSrcClip);
+ return NULL;
+ }
+ }
+
+ dx = srcx - dstx;
+ dy = srcy - dsty;
+
+ /* Translate and clip the dst to the destination composite clip */
+ if (fastClip) {
+ RegionPtr cclip;
+
+ /* Translate the region directly */
+ fastBox.x1 -= dx;
+ fastBox.x2 -= dx;
+ fastBox.y1 -= dy;
+ fastBox.y2 -= dy;
+
+ /* If the destination composite clip is one rectangle we can
+ do the clip directly. Otherwise we have to create a full
+ blown region and call intersect */
+
+ cclip = pGC->pCompositeClip;
+ if (RegionNumRects(cclip) == 1) {
+ BoxPtr pBox = RegionRects(cclip);
+
+ if (fastBox.x1 < pBox->x1)
+ fastBox.x1 = pBox->x1;
+ if (fastBox.x2 > pBox->x2)
+ fastBox.x2 = pBox->x2;
+ if (fastBox.y1 < pBox->y1)
+ fastBox.y1 = pBox->y1;
+ if (fastBox.y2 > pBox->y2)
+ fastBox.y2 = pBox->y2;
+
+ /* Check to see if the region is empty */
+ if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) {
+ RegionNull(&rgnDst);
+ }
+ else {
+ RegionInit(&rgnDst, &fastBox, 1);
+ }
+ }
+ else {
+ /* We must turn off fastClip now, since we must create
+ a full blown region. It is intersected with the
+ composite clip below. */
+ fastClip = 0;
+ RegionInit(&rgnDst, &fastBox, 1);
+ }
+ }
+ else {
+ RegionTranslate(&rgnDst, -dx, -dy);
+ }
+
+ if (!fastClip) {
+ RegionIntersect(&rgnDst, &rgnDst, pGC->pCompositeClip);
+ }
+
+ /* Do bit blitting */
+ numRects = RegionNumRects(&rgnDst);
+ if (numRects && width && height) {
+ if (!(pptSrc = (DDXPointPtr) malloc(numRects * sizeof(DDXPointRec)))) {
+ RegionUninit(&rgnDst);
+ if (freeSrcClip)
+ RegionDestroy(prgnSrcClip);
+ return NULL;
+ }
+ pbox = RegionRects(&rgnDst);
+ ppt = pptSrc;
+ for (i = numRects; --i >= 0; pbox++, ppt++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc);
+ free(pptSrc);
+ }
+
+ prgnExposed = NULL;
+ if (pGC->fExpose) {
+ /* Pixmap sources generate a NoExposed (we return NULL to do this) */
+ if (!fastExpose)
+ prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
+ origSource.x, origSource.y,
+ (int) origSource.width,
+ (int) origSource.height,
+ origDest.x, origDest.y, bitPlane);
+ }
+ RegionUninit(&rgnDst);
+ if (freeSrcClip)
+ RegionDestroy(prgnSrcClip);
+ return prgnExposed;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaBitmap.c b/xorg-server/hw/xfree86/xaa/xaaBitmap.c
index f7ae78d3f..45d5a09be 100644
--- a/xorg-server/hw/xfree86/xaa/xaaBitmap.c
+++ b/xorg-server/hw/xfree86/xaa/xaaBitmap.c
@@ -1,5 +1,4 @@
-
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@@ -9,241 +8,236 @@
#include "xaacexp.h"
#include "xf86.h"
-
/********** byte swapping ***************/
-
#ifdef FIXEDBASE
-# define DEST(i) *dest
-# define RETURN(i) return(dest)
+#define DEST(i) *dest
+#define RETURN(i) return(dest)
#else
-# define DEST(i) dest[i]
-# define RETURN(i) return(dest + i)
+#define DEST(i) dest[i]
+#define RETURN(i) return(dest + i)
#endif
#ifdef MSBFIRST
-# define SOURCE(i) SWAP_BITS_IN_BYTES(src[i])
+#define SOURCE(i) SWAP_BITS_IN_BYTES(src[i])
#else
-# define SOURCE(i) src[i]
+#define SOURCE(i) src[i]
#endif
-
-typedef CARD32 *(* BitmapScanlineProcPtr)(CARD32 *, CARD32 *, int, int);
+typedef CARD32 *(*BitmapScanlineProcPtr) (CARD32 *, CARD32 *, int, int);
#ifdef TRIPLE_BITS
-static CARD32*
-BitmapScanline(
- CARD32 *src, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline(CARD32 *src, CARD32 *base, int count, int skipleft)
{
- CARD32 bits;
-
- while(count >= 3) {
- bits = *src;
- WRITE_BITS3(bits);
- src++;
- count -= 3;
- }
- if (count == 2) {
- bits = *src;
- WRITE_BITS2(bits);
- } else if (count == 1) {
- bits = *src;
- WRITE_BITS1(bits);
- }
-
- return base;
+ CARD32 bits;
+
+ while (count >= 3) {
+ bits = *src;
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits = *src;
+ WRITE_BITS2(bits);
+ }
+ else if (count == 1) {
+ bits = *src;
+ WRITE_BITS1(bits);
+ }
+
+ return base;
}
-static CARD32*
-BitmapScanline_Inverted(
- CARD32 *src, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Inverted(CARD32 *src, CARD32 *base, int count, int skipleft)
{
- CARD32 bits;
-
- while(count >= 3) {
- bits = ~(*src);
- WRITE_BITS3(bits);
- src++;
- count -= 3;
- }
- if (count == 2) {
- bits = ~(*src);
- WRITE_BITS2(bits);
- } else if (count == 1) {
- bits = ~(*src);
- WRITE_BITS1(bits);
- }
-
- return base;
-}
+ CARD32 bits;
+ while (count >= 3) {
+ bits = ~(*src);
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits = ~(*src);
+ WRITE_BITS2(bits);
+ }
+ else if (count == 1) {
+ bits = ~(*src);
+ WRITE_BITS1(bits);
+ }
-static CARD32*
-BitmapScanline_Shifted(
- CARD32 *src, CARD32 *base,
- int count, int skipleft )
+ return base;
+}
+
+static CARD32 *
+BitmapScanline_Shifted(CARD32 *src, CARD32 *base, int count, int skipleft)
{
- CARD32 bits;
-
- while(count >= 3) {
- bits = SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft));
- WRITE_BITS3(bits);
- src++;
- count -= 3;
- }
- if (count == 2) {
- bits = SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft));
- WRITE_BITS2(bits);
- } else if (count == 1) {
- bits = SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft));
- WRITE_BITS1(bits);
- }
-
- return base;
+ CARD32 bits;
+
+ while (count >= 3) {
+ bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft));
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft));
+ WRITE_BITS2(bits);
+ }
+ else if (count == 1) {
+ bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft));
+ WRITE_BITS1(bits);
+ }
+
+ return base;
}
-static CARD32*
-BitmapScanline_Shifted_Inverted(
- CARD32 *src, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Shifted_Inverted(CARD32 *src, CARD32 *base,
+ int count, int skipleft)
{
- CARD32 bits;
-
- while(count >= 3) {
- bits = ~(SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft)));
- WRITE_BITS3(bits);
- src++;
- count -= 3;
- }
- if (count == 2) {
- bits = ~(SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft)));
- WRITE_BITS2(bits);
- } else if (count == 1) {
- bits = ~(SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft)));
- WRITE_BITS1(bits);
- }
-
- return base;
+ CARD32 bits;
+
+ while (count >= 3) {
+ bits =
+ ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)));
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits =
+ ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)));
+ WRITE_BITS2(bits);
+ }
+ else if (count == 1) {
+ bits =
+ ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)));
+ WRITE_BITS1(bits);
+ }
+
+ return base;
}
#define BitmapScanline_Shifted_Careful BitmapScanline_Shifted
#define BitmapScanline_Shifted_Inverted_Careful BitmapScanline_Shifted_Inverted
#else
-static CARD32*
-BitmapScanline(
- CARD32 *src, CARD32 *dest,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline(CARD32 *src, CARD32 *dest, int count, int skipleft)
{
- while(count >= 4) {
- DEST(0) = SOURCE(0);
- DEST(1) = SOURCE(1);
- DEST(2) = SOURCE(2);
- DEST(3) = SOURCE(3);
- count -= 4;
- src += 4;
+ while (count >= 4) {
+ DEST(0) = SOURCE(0);
+ DEST(1) = SOURCE(1);
+ DEST(2) = SOURCE(2);
+ DEST(3) = SOURCE(3);
+ count -= 4;
+ src += 4;
#ifndef FIXEDBASE
- dest += 4;
+ dest += 4;
#endif
- }
-
- if(!count) return dest;
- DEST(0) = SOURCE(0);
- if(count == 1) RETURN(1);
- DEST(1) = SOURCE(1);
- if(count == 2) RETURN(2);
- DEST(2) = SOURCE(2);
- RETURN(3);
+ }
+
+ if (!count)
+ return dest;
+ DEST(0) = SOURCE(0);
+ if (count == 1)
+ RETURN(1);
+ DEST(1) = SOURCE(1);
+ if (count == 2)
+ RETURN(2);
+ DEST(2) = SOURCE(2);
+ RETURN(3);
}
-static CARD32*
-BitmapScanline_Inverted(
- CARD32 *src, CARD32 *dest,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Inverted(CARD32 *src, CARD32 *dest, int count, int skipleft)
{
- while(count >= 4) {
- DEST(0) = ~SOURCE(0);
- DEST(1) = ~SOURCE(1);
- DEST(2) = ~SOURCE(2);
- DEST(3) = ~SOURCE(3);
- count -= 4;
- src += 4;
+ while (count >= 4) {
+ DEST(0) = ~SOURCE(0);
+ DEST(1) = ~SOURCE(1);
+ DEST(2) = ~SOURCE(2);
+ DEST(3) = ~SOURCE(3);
+ count -= 4;
+ src += 4;
#ifndef FIXEDBASE
- dest += 4;
+ dest += 4;
#endif
- }
-
- if(!count) return dest;
- DEST(0) = ~SOURCE(0);
- if(count == 1) RETURN(1);
- DEST(1) = ~SOURCE(1);
- if(count == 2) RETURN(2);
- DEST(2) = ~SOURCE(2);
- RETURN(3);
-}
+ }
+ if (!count)
+ return dest;
+ DEST(0) = ~SOURCE(0);
+ if (count == 1)
+ RETURN(1);
+ DEST(1) = ~SOURCE(1);
+ if (count == 2)
+ RETURN(2);
+ DEST(2) = ~SOURCE(2);
+ RETURN(3);
+}
-static CARD32*
-BitmapScanline_Shifted(
- CARD32 *bits, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Shifted(CARD32 *bits, CARD32 *base, int count, int skipleft)
{
- while(count--) {
- register CARD32 tmp = SHIFT_R(*bits,skipleft) |
- SHIFT_L(*(bits + 1),(32 - skipleft));
- WRITE_BITS(tmp);
- bits++;
- }
- return base;
+ while (count--) {
+ register CARD32 tmp = SHIFT_R(*bits, skipleft) |
+ SHIFT_L(*(bits + 1), (32 - skipleft));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ return base;
}
-static CARD32*
-BitmapScanline_Shifted_Inverted(
- CARD32 *bits, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Shifted_Inverted(CARD32 *bits, CARD32 *base,
+ int count, int skipleft)
{
- while(count--) {
- register CARD32 tmp = ~(SHIFT_R(*bits,skipleft) |
- SHIFT_L(*(bits + 1),(32 - skipleft)));
- WRITE_BITS(tmp);
- bits++;
- }
- return base;
+ while (count--) {
+ register CARD32 tmp = ~(SHIFT_R(*bits, skipleft) |
+ SHIFT_L(*(bits + 1), (32 - skipleft)));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ return base;
}
-static CARD32*
-BitmapScanline_Shifted_Careful(
- CARD32 *bits, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Shifted_Careful(CARD32 *bits, CARD32 *base,
+ int count, int skipleft)
{
- register CARD32 tmp;
- while(--count) {
- tmp = SHIFT_R(*bits,skipleft) | SHIFT_L(*(bits + 1),(32 - skipleft));
- WRITE_BITS(tmp);
- bits++;
- }
- tmp = SHIFT_R(*bits,skipleft);
- WRITE_BITS(tmp);
-
- return base;
+ register CARD32 tmp;
+
+ while (--count) {
+ tmp = SHIFT_R(*bits, skipleft) | SHIFT_L(*(bits + 1), (32 - skipleft));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ tmp = SHIFT_R(*bits, skipleft);
+ WRITE_BITS(tmp);
+
+ return base;
}
-static CARD32*
-BitmapScanline_Shifted_Inverted_Careful(
- CARD32 *bits, CARD32 *base,
- int count, int skipleft )
+static CARD32 *
+BitmapScanline_Shifted_Inverted_Careful(CARD32 *bits, CARD32 *base,
+ int count, int skipleft)
{
- register CARD32 tmp;
- while(--count) {
- tmp = ~(SHIFT_R(*bits,skipleft) | SHIFT_L(*(bits + 1),(32 - skipleft)));
- WRITE_BITS(tmp);
- bits++;
- }
- tmp = ~(SHIFT_R(*bits,skipleft));
- WRITE_BITS(tmp);
- return base;
+ register CARD32 tmp;
+
+ while (--count) {
+ tmp =
+ ~(SHIFT_R(*bits, skipleft) | SHIFT_L(*(bits + 1), (32 - skipleft)));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ tmp = ~(SHIFT_R(*bits, skipleft));
+ WRITE_BITS(tmp);
+ return base;
}
#endif
@@ -253,26 +247,23 @@ BitmapScanline_Shifted_Inverted_Careful(
the fill in two passes, inverting the source on the second pass.
For GXcopy we can fill the backing rectangle as a solid rect and
avoid the invert.
-*/
+*/
void
#ifdef TRIPLE_BITS
-EXPNAME(XAAWriteBitmapColorExpand3)(
+ EXPNAME(XAAWriteBitmapColorExpand3) (
#else
-EXPNAME(XAAWriteBitmapColorExpand)(
+ EXPNAME(XAAWriteBitmapColorExpand) (
#endif
- ScrnInfoPtr pScrn,
- int x, int y, int w, int H,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-)
-{
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int H,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask) {
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32* base;
+ CARD32 *base;
unsigned char *srcp = src;
int SecondPassColor = -1;
int shift = 0, dwords;
@@ -282,44 +273,49 @@ EXPNAME(XAAWriteBitmapColorExpand)(
int h = H;
#ifdef TRIPLE_BITS
- if((bg != -1) &&
- ((infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) ||
- ((infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
- (!CHECK_RGB_EQUAL(bg))))) {
+ if ((bg != -1) &&
+ ((infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) ||
+ ((infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
#else
- if((bg != -1) &&
- (infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+ if ((bg != -1) &&
+ (infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
#endif
- if((rop == GXcopy) && infoRec->SetupForSolidFill) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- } else SecondPassColor = bg;
- bg = -1;
+ if ((rop == GXcopy) && infoRec->SetupForSolidFill) {
+ (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
+ }
+ else
+ SecondPassColor = bg;
+ bg = -1;
}
#ifdef TRIPLE_BITS
- if(skipleft) {
+ if (skipleft) {
#else
- if(skipleft &&
- (!(infoRec->CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING) ||
- (!(infoRec->CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
- (skipleft > x)))) {
+ if (skipleft &&
+ (!(infoRec->CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->
+ CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (skipleft > x)))) {
#endif
- if((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
- /* don't read past the end */
- firstFunc = BitmapScanline_Shifted_Careful;
- secondFunc = BitmapScanline_Shifted_Inverted_Careful;
- } else {
- firstFunc = BitmapScanline_Shifted;
- secondFunc = BitmapScanline_Shifted_Inverted;
- }
- shift = skipleft;
- skipleft = 0;
- } else {
- firstFunc = BitmapScanline;
- secondFunc = BitmapScanline_Inverted;
- w += skipleft;
- x -= skipleft;
+ if ((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
+ /* don't read past the end */
+ firstFunc = BitmapScanline_Shifted_Careful;
+ secondFunc = BitmapScanline_Shifted_Inverted_Careful;
+ }
+ else {
+ firstFunc = BitmapScanline_Shifted;
+ secondFunc = BitmapScanline_Shifted_Inverted;
+ }
+ shift = skipleft;
+ skipleft = 0;
+ }
+ else {
+ firstFunc = BitmapScanline;
+ secondFunc = BitmapScanline_Inverted;
+ w += skipleft;
+ x -= skipleft;
}
#ifdef TRIPLE_BITS
@@ -328,69 +324,68 @@ EXPNAME(XAAWriteBitmapColorExpand)(
dwords = (w + 31) >> 5;
#endif
-SECOND_PASS:
+ SECOND_PASS:
- flag = (infoRec->CPUToScreenColorExpandFillFlags
- & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01);
- (*infoRec->SetupForCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(
- pScrn, x, y, w, h, skipleft);
+ flag = (infoRec->CPUToScreenColorExpandFillFlags
+ & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01);
+ (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+ (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
+ skipleft);
- base = (CARD32*)infoRec->ColorExpandBase;
+ base = (CARD32 *) infoRec->ColorExpandBase;
#ifndef FIXEDBASE
- if((dwords * h) <= infoRec->ColorExpandRange)
- while(h--) {
- base = (*firstFunc)((CARD32*)srcp, base, dwords, shift);
- srcp += srcwidth;
- }
+ if ((dwords * h) <= infoRec->ColorExpandRange)
+ while (h--) {
+ base = (*firstFunc) ((CARD32 *) srcp, base, dwords, shift);
+ srcp += srcwidth;
+ }
else
#endif
- while(h--) {
- (*firstFunc)((CARD32*)srcp, base, dwords, shift);
- srcp += srcwidth;
- }
-
- if(flag){
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
+ while (h--) {
+ (*firstFunc) ((CARD32 *) srcp, base, dwords, shift);
+ srcp += srcwidth;
+ }
+
+ if (flag) {
+ base = (CARD32 *) infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
}
- if(SecondPassColor != -1) {
- h = H; /* Reset height */
- fg = SecondPassColor;
- SecondPassColor = -1;
- firstFunc = secondFunc;
- srcp = src;
- goto SECOND_PASS;
+ if (SecondPassColor != -1) {
+ h = H; /* Reset height */
+ fg = SecondPassColor;
+ SecondPassColor = -1;
+ firstFunc = secondFunc;
+ srcp = src;
+ goto SECOND_PASS;
}
- if(infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
+ if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync) (pScrn);
+ else
+ SET_SYNC_FLAG(infoRec);
}
#ifndef FIXEDBASE
void
#ifdef TRIPLE_BITS
-EXPNAME(XAAWriteBitmapScanlineColorExpand3)(
+ EXPNAME(XAAWriteBitmapScanlineColorExpand3) (
#else
-EXPNAME(XAAWriteBitmapScanlineColorExpand)(
+ EXPNAME(XAAWriteBitmapScanlineColorExpand) (
#endif
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-)
-{
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask) {
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32* base;
+ CARD32 *base;
unsigned char *srcp = src;
int SecondPassColor = -1;
int shift = 0, dwords, bufferNo;
@@ -398,45 +393,50 @@ EXPNAME(XAAWriteBitmapScanlineColorExpand)(
BitmapScanlineProcPtr secondFunc;
#ifdef TRIPLE_BITS
- if((bg != -1) &&
- ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)
- || ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
- (!CHECK_RGB_EQUAL(bg))))) {
+ if ((bg != -1) &&
+ ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)
+ || ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
#else
- if((bg != -1) &&
- (infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)){
+ if ((bg != -1) &&
+ (infoRec->
+ ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
#endif
- if((rop == GXcopy) && infoRec->SetupForSolidFill) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- } else SecondPassColor = bg;
- bg = -1;
+ if ((rop == GXcopy) && infoRec->SetupForSolidFill) {
+ (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
+ }
+ else
+ SecondPassColor = bg;
+ bg = -1;
}
#ifdef TRIPLE_BITS
- if(skipleft) {
+ if (skipleft) {
#else
- if(skipleft &&
- (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- LEFT_EDGE_CLIPPING) ||
- (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- LEFT_EDGE_CLIPPING_NEGATIVE_X) && (skipleft > x)))) {
+ if (skipleft &&
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X) && (skipleft > x)))) {
#endif
- if((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
- /* don't read past the end */
- firstFunc = BitmapScanline_Shifted_Careful;
- secondFunc = BitmapScanline_Shifted_Inverted_Careful;
- } else {
- firstFunc = BitmapScanline_Shifted;
- secondFunc = BitmapScanline_Shifted_Inverted;
- }
- shift = skipleft;
- skipleft = 0;
- } else {
- firstFunc = BitmapScanline;
- secondFunc = BitmapScanline_Inverted;
- w += skipleft;
- x -= skipleft;
+ if ((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
+ /* don't read past the end */
+ firstFunc = BitmapScanline_Shifted_Careful;
+ secondFunc = BitmapScanline_Shifted_Inverted_Careful;
+ }
+ else {
+ firstFunc = BitmapScanline_Shifted;
+ secondFunc = BitmapScanline_Shifted_Inverted;
+ }
+ shift = skipleft;
+ skipleft = 0;
+ }
+ else {
+ firstFunc = BitmapScanline;
+ secondFunc = BitmapScanline_Inverted;
+ w += skipleft;
+ x -= skipleft;
}
#ifdef TRIPLE_BITS
@@ -445,29 +445,30 @@ EXPNAME(XAAWriteBitmapScanlineColorExpand)(
dwords = (w + 31) >> 5;
#endif
-SECOND_PASS:
+ SECOND_PASS:
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, x, y, w, h, skipleft);
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
+ skipleft);
bufferNo = 0;
- while(h--) {
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- (*firstFunc)((CARD32*)srcp, base, dwords, shift);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- srcp += srcwidth;
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
+ while (h--) {
+ base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*firstFunc) ((CARD32 *) srcp, base, dwords, shift);
+ (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
+ srcp += srcwidth;
+ if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
}
- if(SecondPassColor != -1) {
- fg = SecondPassColor;
- SecondPassColor = -1;
- firstFunc = secondFunc;
- srcp = src;
- goto SECOND_PASS;
+ if (SecondPassColor != -1) {
+ fg = SecondPassColor;
+ SecondPassColor = -1;
+ firstFunc = secondFunc;
+ srcp = src;
+ goto SECOND_PASS;
}
SET_SYNC_FLAG(infoRec);
diff --git a/xorg-server/hw/xfree86/xaa/xaaCpyArea.c b/xorg-server/hw/xfree86/xaa/xaaCpyArea.c
index 5e594633d..0b11b810e 100644
--- a/xorg-server/hw/xfree86/xaa/xaaCpyArea.c
+++ b/xorg-server/hw/xfree86/xaa/xaaCpyArea.c
@@ -1,387 +1,409 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "migc.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-
-/*
- Written mostly by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
- */
-
-
-RegionPtr
-XAACopyArea(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(pDstDrawable->type == DRAWABLE_WINDOW) {
- if((pSrcDrawable->type == DRAWABLE_WINDOW) ||
- IS_OFFSCREEN_PIXMAP(pSrcDrawable)){
- if(infoRec->ScreenToScreenBitBlt &&
- CHECK_ROP(pGC,infoRec->ScreenToScreenBitBltFlags) &&
- CHECK_ROPSRC(pGC,infoRec->ScreenToScreenBitBltFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->ScreenToScreenBitBltFlags))
- return (XAABitBlt( pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty,
- XAADoBitBlt, 0L));
- } else {
- if(infoRec->WritePixmap &&
- ((pDstDrawable->bitsPerPixel == pSrcDrawable->bitsPerPixel) ||
- ((pDstDrawable->bitsPerPixel == 24) &&
- (pSrcDrawable->bitsPerPixel == 32) &&
- (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
- CHECK_ROP(pGC,infoRec->WritePixmapFlags) &&
- CHECK_ROPSRC(pGC,infoRec->WritePixmapFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->WritePixmapFlags) &&
- CHECK_NO_GXCOPY(pGC,infoRec->WritePixmapFlags))
- return (XAABitBlt( pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty,
- XAADoImageWrite, 0L));
- }
- } else if(IS_OFFSCREEN_PIXMAP(pDstDrawable)){
- if((pSrcDrawable->type == DRAWABLE_WINDOW) ||
- IS_OFFSCREEN_PIXMAP(pSrcDrawable)){
- if(infoRec->ScreenToScreenBitBlt &&
- CHECK_ROP(pGC,infoRec->ScreenToScreenBitBltFlags) &&
- CHECK_ROPSRC(pGC,infoRec->ScreenToScreenBitBltFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->ScreenToScreenBitBltFlags))
- return (XAABitBlt( pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty,
- XAADoBitBlt, 0L));
- }
- }
-
- return (XAAFallbackOps.CopyArea(pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height, dstx, dsty));
-}
-
-
-void
-XAADoBitBlt(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc )
-{
- int nbox, careful;
- BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
- DDXPointPtr pptTmp, pptNew1, pptNew2;
- int xdir, ydir;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- /* XXX we have to err on the side of safety when both are windows,
- * because we don't know if IncludeInferiors is being used.
- */
- careful = ((pSrc == pDst) ||
- ((pSrc->type == DRAWABLE_WINDOW) &&
- (pDst->type == DRAWABLE_WINDOW)));
-
- pbox = RegionRects(prgnDst);
- nbox = RegionNumRects(prgnDst);
-
- pboxNew1 = NULL;
- pptNew1 = NULL;
- pboxNew2 = NULL;
- pptNew2 = NULL;
- if (careful && (pptSrc->y < pbox->y1)) {
- /* walk source botttom to top */
- ydir = -1;
-
- if (nbox > 1) {
- /* keep ordering in each band, reverse order of bands */
- pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
- if(!pboxNew1)
- return;
- pptNew1 = (DDXPointPtr)malloc(sizeof(DDXPointRec) * nbox);
- if(!pptNew1) {
- free(pboxNew1);
- return;
- }
- pboxBase = pboxNext = pbox+nbox-1;
- while (pboxBase >= pbox) {
- while ((pboxNext >= pbox) &&
- (pboxBase->y1 == pboxNext->y1))
- pboxNext--;
- pboxTmp = pboxNext+1;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp <= pboxBase) {
- *pboxNew1++ = *pboxTmp++;
- *pptNew1++ = *pptTmp++;
- }
- pboxBase = pboxNext;
- }
- pboxNew1 -= nbox;
- pbox = pboxNew1;
- pptNew1 -= nbox;
- pptSrc = pptNew1;
- }
- } else {
- /* walk source top to bottom */
- ydir = 1;
- }
-
- if (careful && (pptSrc->x < pbox->x1)) {
- /* walk source right to left */
- xdir = -1;
-
- if (nbox > 1) {
- /* reverse order of rects in each band */
- pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
- pptNew2 = (DDXPointPtr)malloc(sizeof(DDXPointRec) * nbox);
- if(!pboxNew2 || !pptNew2) {
- free(pptNew2);
- free(pboxNew2);
- if (pboxNew1) {
- free(pptNew1);
- free(pboxNew1);
- }
- return;
- }
- pboxBase = pboxNext = pbox;
- while (pboxBase < pbox+nbox) {
- while ((pboxNext < pbox+nbox) &&
- (pboxNext->y1 == pboxBase->y1))
- pboxNext++;
- pboxTmp = pboxNext;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp != pboxBase) {
- *pboxNew2++ = *--pboxTmp;
- *pptNew2++ = *--pptTmp;
- }
- pboxBase = pboxNext;
- }
- pboxNew2 -= nbox;
- pbox = pboxNew2;
- pptNew2 -= nbox;
- pptSrc = pptNew2;
- }
- } else {
- /* walk source left to right */
- xdir = 1;
- }
-
- (*infoRec->ScreenToScreenBitBlt)(infoRec->pScrn, nbox, pptSrc, pbox,
- xdir, ydir, pGC->alu, pGC->planemask);
-
- if (pboxNew2) {
- free(pptNew2);
- free(pboxNew2);
- }
- if (pboxNew1) {
- free(pptNew1);
- free(pboxNew1);
- }
-
-}
-
-void
-XAADoImageWrite(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc )
-{
- int srcwidth;
- unsigned char* psrcBase; /* start of image */
- unsigned char* srcPntr; /* index into the image */
- BoxPtr pbox = RegionRects(prgnDst);
- int nbox = RegionNumRects(prgnDst);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int Bpp = pSrc->bitsPerPixel >> 3;
-
- psrcBase = (unsigned char *)((PixmapPtr)pSrc)->devPrivate.ptr;
- srcwidth = (int)((PixmapPtr)pSrc)->devKind;
-
- for(; nbox; pbox++, pptSrc++, nbox--) {
- srcPntr = psrcBase + (pptSrc->y * srcwidth) + (pptSrc->x * Bpp);
-
- (*infoRec->WritePixmap)(infoRec->pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, srcPntr, srcwidth,
- pGC->alu, pGC->planemask, -1, pSrc->bitsPerPixel, pSrc->depth);
- }
-}
-
-
-void
-XAADoImageRead(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc )
-{
- int dstwidth;
- unsigned char* pdstBase; /* start of image */
- unsigned char* dstPntr; /* index into the image */
- BoxPtr pbox = RegionRects(prgnDst);
- int nbox = RegionNumRects(prgnDst);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int Bpp = pSrc->bitsPerPixel >> 3; /* wouldn't get here unless both
- src and dst have same bpp */
-
- pdstBase = (unsigned char *)((PixmapPtr)pDst)->devPrivate.ptr;
- dstwidth = (int)((PixmapPtr)pDst)->devKind;
-
- for(; nbox; pbox++, pptSrc++, nbox--) {
- dstPntr = pdstBase + (pbox->y1 * dstwidth) + (pbox->x1 * Bpp);
-
- (*infoRec->ReadPixmap)(infoRec->pScrn, pptSrc->x, pptSrc->y,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, dstPntr, dstwidth,
- pSrc->bitsPerPixel, pSrc->depth);
- }
-}
-
-
-void
-XAAScreenToScreenBitBlt(
- ScrnInfoPtr pScrn,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir, int ydir,
- int alu,
- unsigned int planemask )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int dirsetup;
-
- if ((!(infoRec->CopyAreaFlags & ONLY_TWO_BITBLT_DIRECTIONS)
- || (xdir == ydir)) &&
- (!(infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT)
- || (xdir == 1))) {
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- xdir, ydir, alu, planemask, -1);
- for (; nbox; pbox++, pptSrc++, nbox--)
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
- pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- SET_SYNC_FLAG(infoRec);
- return;
- }
-
- if (infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT) {
- /*
- * This is the case of a chip that only supports xdir = 1,
- * with ydir = 1 or ydir = -1, but we have xdir = -1.
- */
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- 1, ydir, alu, planemask, -1);
- for (; nbox; pbox++, pptSrc++, nbox--)
- if (pptSrc->y != pbox->y1 || pptSrc->x >= pbox->x1)
- /* No problem. Do a xdir = 1 blit instead. */
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pptSrc->x, pptSrc->y, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- else
- {
- /*
- * This is the difficult case. Needs striping into
- * non-overlapping horizontal chunks.
- */
- int stripeWidth, w, fullStripes, extra, i;
- stripeWidth = 16;
- w = pbox->x2 - pbox->x1;
- if (pbox->x1 - pptSrc->x < stripeWidth)
- stripeWidth = pbox->x1 - pptSrc->x;
- fullStripes = w / stripeWidth;
- extra = w % stripeWidth;
-
- /* First, take care of the little bit on the far right */
- if (extra)
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pptSrc->x + fullStripes * stripeWidth, pptSrc->y,
- pbox->x1 + fullStripes * stripeWidth, pbox->y1,
- extra, pbox->y2 - pbox->y1);
-
- /* Now, take care of the rest of the blit */
- for (i = fullStripes - 1; i >= 0; i--)
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pptSrc->x + i * stripeWidth, pptSrc->y,
- pbox->x1 + i * stripeWidth, pbox->y1,
- stripeWidth, pbox->y2 - pbox->y1);
- }
- SET_SYNC_FLAG(infoRec);
- return;
- }
-
- /*
- * Now the case of a chip that only supports xdir = ydir = 1 or
- * xdir = ydir = -1, but we have xdir != ydir.
- */
- dirsetup = 0; /* No direction set up yet. */
- for (; nbox; pbox++, pptSrc++, nbox--) {
- if (xdir == 1 && pptSrc->y != pbox->y1) {
- /* Do a xdir = ydir = -1 blit instead. */
- if (dirsetup != -1) {
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- -1, -1, alu, planemask, -1);
- dirsetup = -1;
- }
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
- pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- }
- else if (xdir == -1 && pptSrc->y != pbox->y1) {
- /* Do a xdir = ydir = 1 blit instead. */
- if (dirsetup != 1) {
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- 1, 1, alu, planemask, -1);
- dirsetup = 1;
- }
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
- pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- }
- else
- if (xdir == 1) {
- /*
- * xdir = 1, ydir = -1.
- * Perform line-by-line xdir = ydir = 1 blits, going up.
- */
- int i;
- if (dirsetup != 1) {
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- 1, 1, alu, planemask, -1);
- dirsetup = 1;
- }
- for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pptSrc->x, pptSrc->y + i, pbox->x1, pbox->y1 + i,
- pbox->x2 - pbox->x1, 1);
- }
- else {
- /*
- * xdir = -1, ydir = 1.
- * Perform line-by-line xdir = ydir = -1 blits, going down.
- */
- int i;
- if (dirsetup != -1) {
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- -1, -1, alu, planemask, -1);
- dirsetup = -1;
- }
- for (i = 0; i < pbox->y2 - pbox->y1; i++)
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pptSrc->x, pptSrc->y + i, pbox->x1, pbox->y1 + i,
- pbox->x2 - pbox->x1, 1);
- }
- } /* next box */
- SET_SYNC_FLAG(infoRec);
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "migc.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+
+/*
+ Written mostly by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+ */
+
+RegionPtr
+XAACopyArea(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC * pGC,
+ int srcx, int srcy, int width, int height, int dstx, int dsty)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW) {
+ if ((pSrcDrawable->type == DRAWABLE_WINDOW) ||
+ IS_OFFSCREEN_PIXMAP(pSrcDrawable)) {
+ if (infoRec->ScreenToScreenBitBlt &&
+ CHECK_ROP(pGC, infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->ScreenToScreenBitBltFlags))
+ return (XAABitBlt(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ XAADoBitBlt, 0L));
+ }
+ else {
+ if (infoRec->WritePixmap &&
+ ((pDstDrawable->bitsPerPixel == pSrcDrawable->bitsPerPixel) ||
+ ((pDstDrawable->bitsPerPixel == 24) &&
+ (pSrcDrawable->bitsPerPixel == 32) &&
+ (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
+ CHECK_ROP(pGC, infoRec->WritePixmapFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->WritePixmapFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->WritePixmapFlags) &&
+ CHECK_NO_GXCOPY(pGC, infoRec->WritePixmapFlags))
+ return (XAABitBlt(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ XAADoImageWrite, 0L));
+ }
+ }
+ else if (IS_OFFSCREEN_PIXMAP(pDstDrawable)) {
+ if ((pSrcDrawable->type == DRAWABLE_WINDOW) ||
+ IS_OFFSCREEN_PIXMAP(pSrcDrawable)) {
+ if (infoRec->ScreenToScreenBitBlt &&
+ CHECK_ROP(pGC, infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->ScreenToScreenBitBltFlags))
+ return (XAABitBlt(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ XAADoBitBlt, 0L));
+ }
+ }
+
+ return (XAAFallbackOps.CopyArea(pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height, dstx, dsty));
+}
+
+void
+XAADoBitBlt(DrawablePtr pSrc,
+ DrawablePtr pDst, GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc)
+{
+ int nbox, careful;
+ BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
+ DDXPointPtr pptTmp, pptNew1, pptNew2;
+ int xdir, ydir;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ /* XXX we have to err on the side of safety when both are windows,
+ * because we don't know if IncludeInferiors is being used.
+ */
+ careful = ((pSrc == pDst) ||
+ ((pSrc->type == DRAWABLE_WINDOW) &&
+ (pDst->type == DRAWABLE_WINDOW)));
+
+ pbox = RegionRects(prgnDst);
+ nbox = RegionNumRects(prgnDst);
+
+ pboxNew1 = NULL;
+ pptNew1 = NULL;
+ pboxNew2 = NULL;
+ pptNew2 = NULL;
+ if (careful && (pptSrc->y < pbox->y1)) {
+ /* walk source botttom to top */
+ ydir = -1;
+
+ if (nbox > 1) {
+ /* keep ordering in each band, reverse order of bands */
+ pboxNew1 = (BoxPtr) malloc(sizeof(BoxRec) * nbox);
+ if (!pboxNew1)
+ return;
+ pptNew1 = (DDXPointPtr) malloc(sizeof(DDXPointRec) * nbox);
+ if (!pptNew1) {
+ free(pboxNew1);
+ return;
+ }
+ pboxBase = pboxNext = pbox + nbox - 1;
+ while (pboxBase >= pbox) {
+ while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1))
+ pboxNext--;
+ pboxTmp = pboxNext + 1;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp <= pboxBase) {
+ *pboxNew1++ = *pboxTmp++;
+ *pptNew1++ = *pptTmp++;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew1 -= nbox;
+ pbox = pboxNew1;
+ pptNew1 -= nbox;
+ pptSrc = pptNew1;
+ }
+ }
+ else {
+ /* walk source top to bottom */
+ ydir = 1;
+ }
+
+ if (careful && (pptSrc->x < pbox->x1)) {
+ /* walk source right to left */
+ xdir = -1;
+
+ if (nbox > 1) {
+ /* reverse order of rects in each band */
+ pboxNew2 = (BoxPtr) malloc(sizeof(BoxRec) * nbox);
+ pptNew2 = (DDXPointPtr) malloc(sizeof(DDXPointRec) * nbox);
+ if (!pboxNew2 || !pptNew2) {
+ free(pptNew2);
+ free(pboxNew2);
+ if (pboxNew1) {
+ free(pptNew1);
+ free(pboxNew1);
+ }
+ return;
+ }
+ pboxBase = pboxNext = pbox;
+ while (pboxBase < pbox + nbox) {
+ while ((pboxNext < pbox + nbox) &&
+ (pboxNext->y1 == pboxBase->y1))
+ pboxNext++;
+ pboxTmp = pboxNext;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp != pboxBase) {
+ *pboxNew2++ = *--pboxTmp;
+ *pptNew2++ = *--pptTmp;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew2 -= nbox;
+ pbox = pboxNew2;
+ pptNew2 -= nbox;
+ pptSrc = pptNew2;
+ }
+ }
+ else {
+ /* walk source left to right */
+ xdir = 1;
+ }
+
+ (*infoRec->ScreenToScreenBitBlt) (infoRec->pScrn, nbox, pptSrc, pbox,
+ xdir, ydir, pGC->alu, pGC->planemask);
+
+ if (pboxNew2) {
+ free(pptNew2);
+ free(pboxNew2);
+ }
+ if (pboxNew1) {
+ free(pptNew1);
+ free(pboxNew1);
+ }
+
+}
+
+void
+XAADoImageWrite(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc)
+{
+ int srcwidth;
+ unsigned char *psrcBase; /* start of image */
+ unsigned char *srcPntr; /* index into the image */
+ BoxPtr pbox = RegionRects(prgnDst);
+ int nbox = RegionNumRects(prgnDst);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int Bpp = pSrc->bitsPerPixel >> 3;
+
+ psrcBase = (unsigned char *) ((PixmapPtr) pSrc)->devPrivate.ptr;
+ srcwidth = (int) ((PixmapPtr) pSrc)->devKind;
+
+ for (; nbox; pbox++, pptSrc++, nbox--) {
+ srcPntr = psrcBase + (pptSrc->y * srcwidth) + (pptSrc->x * Bpp);
+
+ (*infoRec->WritePixmap) (infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ srcPntr, srcwidth, pGC->alu, pGC->planemask,
+ -1, pSrc->bitsPerPixel, pSrc->depth);
+ }
+}
+
+void
+XAADoImageRead(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc)
+{
+ int dstwidth;
+ unsigned char *pdstBase; /* start of image */
+ unsigned char *dstPntr; /* index into the image */
+ BoxPtr pbox = RegionRects(prgnDst);
+ int nbox = RegionNumRects(prgnDst);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int Bpp = pSrc->bitsPerPixel >> 3; /* wouldn't get here unless both
+ src and dst have same bpp */
+
+ pdstBase = (unsigned char *) ((PixmapPtr) pDst)->devPrivate.ptr;
+ dstwidth = (int) ((PixmapPtr) pDst)->devKind;
+
+ for (; nbox; pbox++, pptSrc++, nbox--) {
+ dstPntr = pdstBase + (pbox->y1 * dstwidth) + (pbox->x1 * Bpp);
+
+ (*infoRec->ReadPixmap) (infoRec->pScrn, pptSrc->x, pptSrc->y,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ dstPntr, dstwidth, pSrc->bitsPerPixel,
+ pSrc->depth);
+ }
+}
+
+void
+XAAScreenToScreenBitBlt(ScrnInfoPtr pScrn,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir, int ydir, int alu, unsigned int planemask)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int dirsetup;
+
+ if ((!(infoRec->CopyAreaFlags & ONLY_TWO_BITBLT_DIRECTIONS)
+ || (xdir == ydir)) &&
+ (!(infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT)
+ || (xdir == 1))) {
+ (*infoRec->SetupForScreenToScreenCopy) (pScrn,
+ xdir, ydir, alu, planemask, -1);
+ for (; nbox; pbox++, pptSrc++, nbox--)
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pptSrc->x,
+ pptSrc->y, pbox->x1,
+ pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ SET_SYNC_FLAG(infoRec);
+ return;
+ }
+
+ if (infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT) {
+ /*
+ * This is the case of a chip that only supports xdir = 1,
+ * with ydir = 1 or ydir = -1, but we have xdir = -1.
+ */
+ (*infoRec->SetupForScreenToScreenCopy) (pScrn,
+ 1, ydir, alu, planemask, -1);
+ for (; nbox; pbox++, pptSrc++, nbox--)
+ if (pptSrc->y != pbox->y1 || pptSrc->x >= pbox->x1)
+ /* No problem. Do a xdir = 1 blit instead. */
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
+ pptSrc->x, pptSrc->y,
+ pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ else {
+ /*
+ * This is the difficult case. Needs striping into
+ * non-overlapping horizontal chunks.
+ */
+ int stripeWidth, w, fullStripes, extra, i;
+
+ stripeWidth = 16;
+ w = pbox->x2 - pbox->x1;
+ if (pbox->x1 - pptSrc->x < stripeWidth)
+ stripeWidth = pbox->x1 - pptSrc->x;
+ fullStripes = w / stripeWidth;
+ extra = w % stripeWidth;
+
+ /* First, take care of the little bit on the far right */
+ if (extra)
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
+ pptSrc->x +
+ fullStripes *
+ stripeWidth,
+ pptSrc->y,
+ pbox->x1 +
+ fullStripes *
+ stripeWidth,
+ pbox->y1, extra,
+ pbox->y2 -
+ pbox->y1);
+
+ /* Now, take care of the rest of the blit */
+ for (i = fullStripes - 1; i >= 0; i--)
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
+ pptSrc->x +
+ i * stripeWidth,
+ pptSrc->y,
+ pbox->x1 +
+ i * stripeWidth,
+ pbox->y1,
+ stripeWidth,
+ pbox->y2 -
+ pbox->y1);
+ }
+ SET_SYNC_FLAG(infoRec);
+ return;
+ }
+
+ /*
+ * Now the case of a chip that only supports xdir = ydir = 1 or
+ * xdir = ydir = -1, but we have xdir != ydir.
+ */
+ dirsetup = 0; /* No direction set up yet. */
+ for (; nbox; pbox++, pptSrc++, nbox--) {
+ if (xdir == 1 && pptSrc->y != pbox->y1) {
+ /* Do a xdir = ydir = -1 blit instead. */
+ if (dirsetup != -1) {
+ (*infoRec->SetupForScreenToScreenCopy) (pScrn,
+ -1, -1, alu, planemask,
+ -1);
+ dirsetup = -1;
+ }
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pptSrc->x,
+ pptSrc->y, pbox->x1,
+ pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ }
+ else if (xdir == -1 && pptSrc->y != pbox->y1) {
+ /* Do a xdir = ydir = 1 blit instead. */
+ if (dirsetup != 1) {
+ (*infoRec->SetupForScreenToScreenCopy) (pScrn,
+ 1, 1, alu, planemask,
+ -1);
+ dirsetup = 1;
+ }
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pptSrc->x,
+ pptSrc->y, pbox->x1,
+ pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ }
+ else if (xdir == 1) {
+ /*
+ * xdir = 1, ydir = -1.
+ * Perform line-by-line xdir = ydir = 1 blits, going up.
+ */
+ int i;
+
+ if (dirsetup != 1) {
+ (*infoRec->SetupForScreenToScreenCopy) (pScrn,
+ 1, 1, alu, planemask,
+ -1);
+ dirsetup = 1;
+ }
+ for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
+ pptSrc->x,
+ pptSrc->y + i,
+ pbox->x1,
+ pbox->y1 + i,
+ pbox->x2 - pbox->x1,
+ 1);
+ }
+ else {
+ /*
+ * xdir = -1, ydir = 1.
+ * Perform line-by-line xdir = ydir = -1 blits, going down.
+ */
+ int i;
+
+ if (dirsetup != -1) {
+ (*infoRec->SetupForScreenToScreenCopy) (pScrn,
+ -1, -1, alu, planemask,
+ -1);
+ dirsetup = -1;
+ }
+ for (i = 0; i < pbox->y2 - pbox->y1; i++)
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
+ pptSrc->x,
+ pptSrc->y + i,
+ pbox->x1,
+ pbox->y1 + i,
+ pbox->x2 - pbox->x1,
+ 1);
+ }
+ } /* next box */
+ SET_SYNC_FLAG(infoRec);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c b/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c
index 2d036c936..b9197e41f 100644
--- a/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c
+++ b/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c
@@ -1,208 +1,204 @@
-
-/*
- A CopyPlane function that handles bitmap->screen copies and
- sends anything else to the Fallback.
-
- Also, a PushPixels for solid fill styles.
-
- Written by Mark Vojkovich (markv@valinux.com)
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "servermd.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "mi.h"
-#include "pixmapstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-
-static void XAACopyPlane1toNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
- GCPtr pGC, RegionPtr rgnDst,
- DDXPointPtr pptSrc);
-static void XAACopyPlaneNtoNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
- GCPtr pGC, RegionPtr rgnDst,
- DDXPointPtr pptSrc);
-
-
-static unsigned long TmpBitPlane;
-
-RegionPtr
-XAACopyPlaneColorExpansion(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- if((pSrc->type == DRAWABLE_PIXMAP) && !XAA_DEPTH_BUG(pGC)) {
- if(pSrc->bitsPerPixel == 1) {
- return(XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
- width, height, dstx, dsty,
- XAACopyPlane1toNColorExpand, bitPlane));
- } else if(bitPlane < (1 << pDst->depth)){
- TmpBitPlane = bitPlane;
- return(XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
- width, height, dstx, dsty,
- XAACopyPlaneNtoNColorExpand, bitPlane));
- }
- }
-
- return (XAAFallbackOps.CopyPlane(pSrc, pDst, pGC, srcx, srcy,
- width, height, dstx, dsty, bitPlane));
-}
-
-
-static void
-XAACopyPlane1toNColorExpand(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- RegionPtr rgnDst,
- DDXPointPtr pptSrc )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- BoxPtr pbox = RegionRects(rgnDst);
- int numrects = RegionNumRects(rgnDst);
- unsigned char *src = ((PixmapPtr)pSrc)->devPrivate.ptr;
- int srcwidth = ((PixmapPtr)pSrc)->devKind;
-
- while(numrects--) {
- (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- src + (srcwidth * pptSrc->y) + ((pptSrc->x >> 5) << 2),
- srcwidth, pptSrc->x & 31,
- pGC->fgPixel, pGC->bgPixel, pGC->alu, pGC->planemask);
- pbox++; pptSrc++;
- }
-}
-
-
-static void
-XAACopyPlaneNtoNColorExpand(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- RegionPtr rgnDst,
- DDXPointPtr pptSrc
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- BoxPtr pbox = RegionRects(rgnDst);
- int numrects = RegionNumRects(rgnDst);
- unsigned char *src = ((PixmapPtr)pSrc)->devPrivate.ptr;
- unsigned char *data, *srcPtr, *dataPtr;
- int srcwidth = ((PixmapPtr)pSrc)->devKind;
- int pitch, width, height, h, i, index, offset;
- int Bpp = pSrc->bitsPerPixel >> 3;
- unsigned long mask = TmpBitPlane;
-
- if(TmpBitPlane < (1 << 8)) {
- offset = 0;
- } else if(TmpBitPlane < (1 << 16)) {
- offset = 1;
- mask >>= 8;
- } else if(TmpBitPlane < (1 << 24)) {
- offset = 2;
- mask >>= 16;
- } else {
- offset = 3;
- mask >>= 24;
- }
-
- if(IS_OFFSCREEN_PIXMAP(pSrc))
- SYNC_CHECK(pSrc);
-
- while(numrects--) {
- width = pbox->x2 - pbox->x1;
- h = height = pbox->y2 - pbox->y1;
- pitch = BitmapBytePad(width);
-
- if(!(data = calloc(height, pitch)))
- goto ALLOC_FAILED;
-
- dataPtr = data;
- srcPtr = ((pptSrc->y) * srcwidth) + src +
- ((pptSrc->x) * Bpp) + offset;
-
- while(h--) {
- for(i = index = 0; i < width; i++, index += Bpp) {
- if(mask & srcPtr[index])
- dataPtr[i >> 3] |= (1 << (i & 7));
- }
- dataPtr += pitch;
- srcPtr += srcwidth;
- }
-
- (*infoRec->WriteBitmap)(infoRec->pScrn,
- pbox->x1, pbox->y1, width, height, data, pitch, 0,
- pGC->fgPixel, pGC->bgPixel, pGC->alu, pGC->planemask);
-
- free(data);
-
-ALLOC_FAILED:
-
- pbox++; pptSrc++;
- }
-}
-
-void
-XAAPushPixelsSolidColorExpansion(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy,
- int xOrg, int yOrg )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int MaxBoxes = RegionNumRects(pGC->pCompositeClip);
- BoxPtr pbox, pClipBoxes;
- int nboxes, srcx, srcy;
- xRectangle TheRect;
- unsigned char *src = pBitMap->devPrivate.ptr;
- int srcwidth = pBitMap->devKind;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- TheRect.x = xOrg;
- TheRect.y = yOrg;
- TheRect.width = dx;
- TheRect.height = dy;
-
- if(MaxBoxes > (infoRec->PreAllocSize/sizeof(BoxRec))) {
- pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec));
- if(!pClipBoxes) return;
- } else pClipBoxes = (BoxPtr)infoRec->PreAllocMem;
-
- nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
- pbox = pClipBoxes;
-
- while(nboxes--) {
- srcx = pbox->x1 - xOrg;
- srcy = pbox->y1 - yOrg;
- (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- src + (srcwidth * srcy) + ((srcx >> 5) << 2),
- srcwidth, srcx & 31,
- pGC->fgPixel, -1, pGC->alu, pGC->planemask);
- pbox++;
- }
-
- if(pClipBoxes != (BoxPtr)infoRec->PreAllocMem)
- free(pClipBoxes);
-}
-
+
+/*
+ A CopyPlane function that handles bitmap->screen copies and
+ sends anything else to the Fallback.
+
+ Also, a PushPixels for solid fill styles.
+
+ Written by Mark Vojkovich (markv@valinux.com)
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "servermd.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "mi.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+
+static void XAACopyPlane1toNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, RegionPtr rgnDst,
+ DDXPointPtr pptSrc);
+static void XAACopyPlaneNtoNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, RegionPtr rgnDst,
+ DDXPointPtr pptSrc);
+
+static unsigned long TmpBitPlane;
+
+RegionPtr
+XAACopyPlaneColorExpansion(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ if ((pSrc->type == DRAWABLE_PIXMAP) && !XAA_DEPTH_BUG(pGC)) {
+ if (pSrc->bitsPerPixel == 1) {
+ return (XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty,
+ XAACopyPlane1toNColorExpand, bitPlane));
+ }
+ else if (bitPlane < (1 << pDst->depth)) {
+ TmpBitPlane = bitPlane;
+ return (XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty,
+ XAACopyPlaneNtoNColorExpand, bitPlane));
+ }
+ }
+
+ return (XAAFallbackOps.CopyPlane(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty, bitPlane));
+}
+
+static void
+XAACopyPlane1toNColorExpand(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC, RegionPtr rgnDst, DDXPointPtr pptSrc)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ BoxPtr pbox = RegionRects(rgnDst);
+ int numrects = RegionNumRects(rgnDst);
+ unsigned char *src = ((PixmapPtr) pSrc)->devPrivate.ptr;
+ int srcwidth = ((PixmapPtr) pSrc)->devKind;
+
+ while (numrects--) {
+ (*infoRec->WriteBitmap) (infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ src + (srcwidth * pptSrc->y) +
+ ((pptSrc->x >> 5) << 2), srcwidth,
+ pptSrc->x & 31, pGC->fgPixel, pGC->bgPixel,
+ pGC->alu, pGC->planemask);
+ pbox++;
+ pptSrc++;
+ }
+}
+
+static void
+XAACopyPlaneNtoNColorExpand(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC, RegionPtr rgnDst, DDXPointPtr pptSrc)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ BoxPtr pbox = RegionRects(rgnDst);
+ int numrects = RegionNumRects(rgnDst);
+ unsigned char *src = ((PixmapPtr) pSrc)->devPrivate.ptr;
+ unsigned char *data, *srcPtr, *dataPtr;
+ int srcwidth = ((PixmapPtr) pSrc)->devKind;
+ int pitch, width, height, h, i, index, offset;
+ int Bpp = pSrc->bitsPerPixel >> 3;
+ unsigned long mask = TmpBitPlane;
+
+ if (TmpBitPlane < (1 << 8)) {
+ offset = 0;
+ }
+ else if (TmpBitPlane < (1 << 16)) {
+ offset = 1;
+ mask >>= 8;
+ }
+ else if (TmpBitPlane < (1 << 24)) {
+ offset = 2;
+ mask >>= 16;
+ }
+ else {
+ offset = 3;
+ mask >>= 24;
+ }
+
+ if (IS_OFFSCREEN_PIXMAP(pSrc))
+ SYNC_CHECK(pSrc);
+
+ while (numrects--) {
+ width = pbox->x2 - pbox->x1;
+ h = height = pbox->y2 - pbox->y1;
+ pitch = BitmapBytePad(width);
+
+ if (!(data = calloc(height, pitch)))
+ goto ALLOC_FAILED;
+
+ dataPtr = data;
+ srcPtr = ((pptSrc->y) * srcwidth) + src + ((pptSrc->x) * Bpp) + offset;
+
+ while (h--) {
+ for (i = index = 0; i < width; i++, index += Bpp) {
+ if (mask & srcPtr[index])
+ dataPtr[i >> 3] |= (1 << (i & 7));
+ }
+ dataPtr += pitch;
+ srcPtr += srcwidth;
+ }
+
+ (*infoRec->WriteBitmap) (infoRec->pScrn,
+ pbox->x1, pbox->y1, width, height, data, pitch,
+ 0, pGC->fgPixel, pGC->bgPixel, pGC->alu,
+ pGC->planemask);
+
+ free(data);
+
+ ALLOC_FAILED:
+
+ pbox++;
+ pptSrc++;
+ }
+}
+
+void
+XAAPushPixelsSolidColorExpansion(GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int MaxBoxes = RegionNumRects(pGC->pCompositeClip);
+ BoxPtr pbox, pClipBoxes;
+ int nboxes, srcx, srcy;
+ xRectangle TheRect;
+ unsigned char *src = pBitMap->devPrivate.ptr;
+ int srcwidth = pBitMap->devKind;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ TheRect.x = xOrg;
+ TheRect.y = yOrg;
+ TheRect.width = dx;
+ TheRect.height = dy;
+
+ if (MaxBoxes > (infoRec->PreAllocSize / sizeof(BoxRec))) {
+ pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec));
+ if (!pClipBoxes)
+ return;
+ }
+ else
+ pClipBoxes = (BoxPtr) infoRec->PreAllocMem;
+
+ nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
+ pbox = pClipBoxes;
+
+ while (nboxes--) {
+ srcx = pbox->x1 - xOrg;
+ srcy = pbox->y1 - yOrg;
+ (*infoRec->WriteBitmap) (infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ src + (srcwidth * srcy) + ((srcx >> 5) << 2),
+ srcwidth, srcx & 31,
+ pGC->fgPixel, -1, pGC->alu, pGC->planemask);
+ pbox++;
+ }
+
+ if (pClipBoxes != (BoxPtr) infoRec->PreAllocMem)
+ free(pClipBoxes);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaCpyWin.c b/xorg-server/hw/xfree86/xaa/xaaCpyWin.c
index d8608b095..e851f4a37 100644
--- a/xorg-server/hw/xfree86/xaa/xaaCpyWin.c
+++ b/xorg-server/hw/xfree86/xaa/xaaCpyWin.c
@@ -1,82 +1,78 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "xaawrap.h"
-
-/*
- Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
-*/
-
-void
-XAACopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc )
-{
- DDXPointPtr pptSrc, ppt;
- RegionRec rgnDst;
- BoxPtr pbox;
- int dx, dy, nbox;
- WindowPtr pwinRoot;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XAAInfoRecPtr infoRec =
- GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
-
- if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
- XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
- if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow);
- return;
- }
-
- pwinRoot = pScreen->root;
-
- RegionNull(&rgnDst);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- RegionTranslate(prgnSrc, -dx, -dy);
- RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
-
- pbox = RegionRects(&rgnDst);
- nbox = RegionNumRects(&rgnDst);
- if(!nbox ||
- !(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
- RegionUninit(&rgnDst);
- return;
- }
- ppt = pptSrc;
-
- while(nbox--) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- ppt++; pbox++;
- }
-
- infoRec->ScratchGC.planemask = ~0L;
- infoRec->ScratchGC.alu = GXcopy;
-
- XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
-
- free(pptSrc);
- RegionUninit(&rgnDst);
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "xaawrap.h"
+
+/*
+ Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+*/
+
+void
+XAACopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ DDXPointPtr pptSrc, ppt;
+ RegionRec rgnDst;
+ BoxPtr pbox;
+ int dx, dy, nbox;
+ WindowPtr pwinRoot;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
+
+ if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
+ XAA_SCREEN_PROLOGUE(pScreen, CopyWindow);
+ if (infoRec->pScrn->vtSema && infoRec->NeedToSync) {
+ (*infoRec->Sync) (infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAACopyWindow);
+ return;
+ }
+
+ pwinRoot = pScreen->root;
+
+ RegionNull(&rgnDst);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ RegionTranslate(prgnSrc, -dx, -dy);
+ RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
+
+ pbox = RegionRects(&rgnDst);
+ nbox = RegionNumRects(&rgnDst);
+ if (!nbox || !(pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {
+ RegionUninit(&rgnDst);
+ return;
+ }
+ ppt = pptSrc;
+
+ while (nbox--) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ ppt++;
+ pbox++;
+ }
+
+ infoRec->ScratchGC.planemask = ~0L;
+ infoRec->ScratchGC.alu = GXcopy;
+
+ XAADoBitBlt((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+
+ free(pptSrc);
+ RegionUninit(&rgnDst);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaDashLine.c b/xorg-server/hw/xfree86/xaa/xaaDashLine.c
index adae2e583..c7e52cd0b 100644
--- a/xorg-server/hw/xfree86/xaa/xaaDashLine.c
+++ b/xorg-server/hw/xfree86/xaa/xaaDashLine.c
@@ -1,334 +1,353 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "miline.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-
-
-void
-#ifdef POLYSEGMENT
-XAAPolySegmentDashed(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-#else
-XAAPolyLinesDashed(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode, /* Origin or Previous */
- int npt, /* number of points */
- DDXPointPtr pptInit
-#endif
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
- XAAGetGCKey());
- BoxPtr pboxInit = RegionRects(pGC->pCompositeClip);
- int nboxInit = RegionNumRects(pGC->pCompositeClip);
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
- int xorg = pDrawable->x;
- int yorg = pDrawable->y;
- int nbox;
- BoxPtr pbox;
-#ifndef POLYSEGMENT
- DDXPointPtr ppt;
-#endif
- unsigned int oc1, oc2;
- int dmin, dmaj, e, octant;
- int x1, x2, y1, y2, tmp, len, offset;
- int PatternLength, PatternOffset;
-
- if(!nboxInit)
- return;
-
- if (infoRec->DashedLineFlags & LINE_LIMIT_COORDS) {
- int minValX = infoRec->DashedLineLimits.x1;
- int maxValX = infoRec->DashedLineLimits.x2;
- int minValY = infoRec->DashedLineLimits.y1;
- int maxValY = infoRec->DashedLineLimits.y2;
-#ifdef POLYSEGMENT
- int n = nseg;
- xSegment *s = pSeg;
-
- while (n--)
-#else
- int n = npt;
- int xorgtmp = xorg;
- int yorgtmp = yorg;
-
- ppt = pptInit;
- x2 = ppt->x + xorgtmp;
- y2 = ppt->y + yorgtmp;
- while (--n)
-#endif
- {
-#ifdef POLYSEGMENT
- x1 = s->x1 + xorg;
- y1 = s->y1 + yorg;
- x2 = s->x2 + xorg;
- y2 = s->y2 + yorg;
- s++;
-#else
- x1 = x2;
- y1 = y2;
- ++ppt;
- if (mode == CoordModePrevious) {
- xorgtmp = x1;
- yorgtmp = y1;
- }
- x2 = ppt->x + xorgtmp;
- y2 = ppt->y + yorgtmp;
-#endif
- if (x1 > maxValX || x1 < minValX ||
- x2 > maxValX || x2 < minValX ||
- y1 > maxValY || y1 < minValY ||
- y2 > maxValY || y2 < minValY) {
-#ifdef POLYSEGMENT
- XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg);
-#else
- XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit);
-#endif
- return;
- }
- }
- }
-
- PatternLength = pGCPriv->DashLength;
- PatternOffset = pGC->dashOffset % PatternLength;
-
- (*infoRec->SetupForDashedLine)(infoRec->pScrn, pGC->fgPixel,
- (pGC->lineStyle == LineDoubleDash) ? pGC->bgPixel : -1,
- pGC->alu, pGC->planemask, PatternLength, pGCPriv->DashPattern);
-
-
-#ifdef POLYSEGMENT
- while (nseg--)
-#else
- ppt = pptInit;
- x2 = ppt->x + xorg;
- y2 = ppt->y + yorg;
- while(--npt)
-#endif
- {
- nbox = nboxInit;
- pbox = pboxInit;
-
-#ifdef POLYSEGMENT
- x1 = pSeg->x1 + xorg;
- y1 = pSeg->y1 + yorg;
- x2 = pSeg->x2 + xorg;
- y2 = pSeg->y2 + yorg;
- pSeg++;
-#else
- x1 = x2;
- y1 = y2;
- ++ppt;
- if (mode == CoordModePrevious) {
- xorg = x1;
- yorg = y1;
- }
- x2 = ppt->x + xorg;
- y2 = ppt->y + yorg;
-#endif
-
-
- if (infoRec->SubsequentDashedBresenhamLine) {
- if((dmaj = x2 - x1) < 0) {
- dmaj = -dmaj;
- octant = XDECREASING;
- } else octant = 0;
-
- if((dmin = y2 - y1) < 0) {
- dmin = -dmin;
- octant |= YDECREASING;
- }
-
- if(dmin >= dmaj){
- tmp = dmin; dmin = dmaj; dmaj = tmp;
- octant |= YMAJOR;
- }
-
- e = -dmaj - ((bias >> octant) & 1);
- len = dmaj;
- dmin <<= 1;
- dmaj <<= 1;
- } else { /* Muffle compiler */
- dmin = dmaj = e = octant = len = 0;
- }
-
- while(nbox--) {
- oc1 = oc2 = 0;
- OUTCODES(oc1, x1, y1, pbox);
- OUTCODES(oc2, x2, y2, pbox);
- if (!(oc1 | oc2)) { /* uncliped */
- if(infoRec->SubsequentDashedTwoPointLine) {
- (*infoRec->SubsequentDashedTwoPointLine)(
- infoRec->pScrn, x1, y1, x2, y2,
-#ifdef POLYSEGMENT
- (pGC->capStyle != CapNotLast) ? 0 :
-#endif
- OMIT_LAST, PatternOffset);
- } else {
- (*infoRec->SubsequentDashedBresenhamLine)(
- infoRec->pScrn, x1, y1, dmaj, dmin, e,
-#ifdef POLYSEGMENT
- (pGC->capStyle != CapNotLast) ? (len+1) :
-#endif
- len, octant, PatternOffset);
- }
- break;
- } else if (oc1 & oc2) { /* completely clipped */
- pbox++;
- } else if (infoRec->ClippingFlags & HARDWARE_CLIP_DASHED_LINE) {
- (*infoRec->SetClippingRectangle)(infoRec->pScrn,
- pbox->x1, pbox->y1, pbox->x2 - 1, pbox->y2 - 1);
-
- if(infoRec->SubsequentDashedBresenhamLine) {
- (*infoRec->SubsequentDashedBresenhamLine)(
- infoRec->pScrn, x1, y1, dmaj, dmin, e,
-#ifdef POLYSEGMENT
- (pGC->capStyle != CapNotLast) ? (len+1) :
-#endif
- len, octant, PatternOffset);
- } else {
- (*infoRec->SubsequentDashedTwoPointLine)(
- infoRec->pScrn, x1, y1, x2, y2,
-#ifdef POLYSEGMENT
- (pGC->capStyle != CapNotLast) ? 0 :
-#endif
- OMIT_LAST, PatternOffset
- );
- }
- (*infoRec->DisableClipping)(infoRec->pScrn);
- pbox++;
- } else {
- int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
- int clip1 = 0, clip2 = 0;
- int err, adx, ady;
-
- if(octant & YMAJOR) {
- ady = dmaj >> 1;
- adx = dmin >> 1;
- } else {
- ady = dmin >> 1;
- adx = dmaj >> 1;
- }
-
- if (miZeroClipLine(pbox->x1, pbox->y1,
- pbox->x2 - 1, pbox->y2 - 1,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady, &clip1, &clip2,
- octant, bias, oc1, oc2) == -1)
- {
- pbox++;
- continue;
- }
-
- if (octant & YMAJOR)
- len = abs(new_y2 - new_y1);
- else
- len = abs(new_x2 - new_x1);
-#ifdef POLYSEGMENT
- if (clip2 != 0 || pGC->capStyle != CapNotLast)
- len++;
-#else
- len += (clip2 != 0);
-#endif
- if (len) {
- int abserr, clipdx, clipdy;
- /* unwind bresenham error term to first point */
- if (clip1) {
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
-
- if (octant & YMAJOR)
- err = e + clipdy*dmin - clipdx*dmaj;
- else
- err = e + clipdx*dmin - clipdy*dmaj;
- } else
- err = e;
-
-#define range infoRec->DashedBresenhamLineErrorTermBits
- abserr = abs(err);
- while((abserr & range) ||
- (dmaj & range) ||
- (dmin & range)) {
- dmin >>= 1;
- dmaj >>= 1;
- abserr >>= 1;
- err /= 2;
- }
-
- if(octant & YMAJOR)
- offset = abs(new_y1 - y1);
- else
- offset = abs(new_x1 - x1);
-
- offset += PatternOffset;
- offset %= PatternLength;
-
- (*infoRec->SubsequentDashedBresenhamLine)(
- infoRec->pScrn, new_x1, new_y1,
- dmaj, dmin, err, len, octant, offset);
- }
- pbox++;
- }
- } /* while (nbox--) */
-#ifndef POLYSEGMENT
- len = abs(y2 - y1);
- tmp = abs(x2 - x1);
- PatternOffset += (len > tmp) ? len : tmp;
- PatternOffset %= PatternLength;
-#endif
- } /* while (nline--) */
-
-#ifndef POLYSEGMENT
- /* paint the last point if the end style isn't CapNotLast.
- (Assume that a projecting, butt, or round cap that is one
- pixel wide is the same as the single pixel of the endpoint.)
- */
-
- if ((pGC->capStyle != CapNotLast) &&
- ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
- (ppt->y + yorg != pptInit->y + pDrawable->y) ||
- (ppt == pptInit + 1)))
- {
- nbox = nboxInit;
- pbox = pboxInit;
- while (nbox--) {
- if ((x2 >= pbox->x1) && (y2 >= pbox->y1) &&
- (x2 < pbox->x2) && (y2 < pbox->y2))
- {
- if(infoRec->SubsequentDashedTwoPointLine) {
- (*infoRec->SubsequentDashedTwoPointLine)(
- infoRec->pScrn, x2, y2, x2, y2, 0,
- PatternOffset);
- } else {
- (*infoRec->SubsequentDashedBresenhamLine)(
- infoRec->pScrn, x2, y2, 2, 0, -1,
- 1, 0, PatternOffset);
- }
- break;
- } else
- pbox++;
- }
- }
-#endif
-
- SET_SYNC_FLAG(infoRec);
-}
-
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include <X11/X.h>
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "miline.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+void
+#ifdef POLYSEGMENT
+ XAAPolySegmentDashed(DrawablePtr pDrawable,
+ GCPtr pGC, int nseg, xSegment * pSeg
+#else
+XAAPolyLinesDashed(DrawablePtr pDrawable, GCPtr pGC, int mode, /* Origin or Previous */
+ int npt, /* number of points */
+ DDXPointPtr pptInit
+#endif
+ )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
+ BoxPtr pboxInit = RegionRects(pGC->pCompositeClip);
+ int nboxInit = RegionNumRects(pGC->pCompositeClip);
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ int xorg = pDrawable->x;
+ int yorg = pDrawable->y;
+ int nbox;
+ BoxPtr pbox;
+
+#ifndef POLYSEGMENT
+ DDXPointPtr ppt;
+#endif
+ unsigned int oc1, oc2;
+ int dmin, dmaj, e, octant;
+ int x1, x2, y1, y2, tmp, len, offset;
+ int PatternLength, PatternOffset;
+
+ if (!nboxInit)
+ return;
+
+ if (infoRec->DashedLineFlags & LINE_LIMIT_COORDS) {
+ int minValX = infoRec->DashedLineLimits.x1;
+ int maxValX = infoRec->DashedLineLimits.x2;
+ int minValY = infoRec->DashedLineLimits.y1;
+ int maxValY = infoRec->DashedLineLimits.y2;
+
+#ifdef POLYSEGMENT
+ int n = nseg;
+ xSegment *s = pSeg;
+
+ while (n--)
+#else
+ int n = npt;
+ int xorgtmp = xorg;
+ int yorgtmp = yorg;
+
+ ppt = pptInit;
+ x2 = ppt->x + xorgtmp;
+ y2 = ppt->y + yorgtmp;
+ while (--n)
+#endif
+ {
+#ifdef POLYSEGMENT
+ x1 = s->x1 + xorg;
+ y1 = s->y1 + yorg;
+ x2 = s->x2 + xorg;
+ y2 = s->y2 + yorg;
+ s++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious) {
+ xorgtmp = x1;
+ yorgtmp = y1;
+ }
+ x2 = ppt->x + xorgtmp;
+ y2 = ppt->y + yorgtmp;
+#endif
+ if (x1 > maxValX || x1 < minValX ||
+ x2 > maxValX || x2 < minValX ||
+ y1 > maxValY || y1 < minValY || y2 > maxValY || y2 < minValY) {
+#ifdef POLYSEGMENT
+ XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg);
+#else
+ XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit);
+#endif
+ return;
+ }
+ }
+ }
+
+ PatternLength = pGCPriv->DashLength;
+ PatternOffset = pGC->dashOffset % PatternLength;
+
+ (*infoRec->SetupForDashedLine) (infoRec->pScrn, pGC->fgPixel,
+ (pGC->lineStyle ==
+ LineDoubleDash) ? pGC->bgPixel : -1,
+ pGC->alu, pGC->planemask, PatternLength,
+ pGCPriv->DashPattern);
+
+#ifdef POLYSEGMENT
+ while (nseg--)
+#else
+ ppt = pptInit;
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+ while (--npt)
+#endif
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+
+#ifdef POLYSEGMENT
+ x1 = pSeg->x1 + xorg;
+ y1 = pSeg->y1 + yorg;
+ x2 = pSeg->x2 + xorg;
+ y2 = pSeg->y2 + yorg;
+ pSeg++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious) {
+ xorg = x1;
+ yorg = y1;
+ }
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+#endif
+
+ if (infoRec->SubsequentDashedBresenhamLine) {
+ if ((dmaj = x2 - x1) < 0) {
+ dmaj = -dmaj;
+ octant = XDECREASING;
+ }
+ else
+ octant = 0;
+
+ if ((dmin = y2 - y1) < 0) {
+ dmin = -dmin;
+ octant |= YDECREASING;
+ }
+
+ if (dmin >= dmaj) {
+ tmp = dmin;
+ dmin = dmaj;
+ dmaj = tmp;
+ octant |= YMAJOR;
+ }
+
+ e = -dmaj - ((bias >> octant) & 1);
+ len = dmaj;
+ dmin <<= 1;
+ dmaj <<= 1;
+ }
+ else { /* Muffle compiler */
+ dmin = dmaj = e = octant = len = 0;
+ }
+
+ while (nbox--) {
+ oc1 = oc2 = 0;
+ OUTCODES(oc1, x1, y1, pbox);
+ OUTCODES(oc2, x2, y2, pbox);
+ if (!(oc1 | oc2)) { /* uncliped */
+ if (infoRec->SubsequentDashedTwoPointLine) {
+ (*infoRec->SubsequentDashedTwoPointLine) (infoRec->pScrn,
+ x1, y1, x2, y2,
+#ifdef POLYSEGMENT
+ (pGC->capStyle !=
+ CapNotLast) ? 0 :
+#endif
+ OMIT_LAST,
+ PatternOffset);
+ }
+ else {
+ (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn,
+ x1, y1, dmaj,
+ dmin, e,
+#ifdef POLYSEGMENT
+ (pGC->capStyle !=
+ CapNotLast)
+ ? (len + 1) :
+#endif
+ len, octant,
+ PatternOffset);
+ }
+ break;
+ }
+ else if (oc1 & oc2) { /* completely clipped */
+ pbox++;
+ }
+ else if (infoRec->ClippingFlags & HARDWARE_CLIP_DASHED_LINE) {
+ (*infoRec->SetClippingRectangle) (infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x2 - 1, pbox->y2 - 1);
+
+ if (infoRec->SubsequentDashedBresenhamLine) {
+ (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn,
+ x1, y1, dmaj,
+ dmin, e,
+#ifdef POLYSEGMENT
+ (pGC->capStyle !=
+ CapNotLast)
+ ? (len + 1) :
+#endif
+ len, octant,
+ PatternOffset);
+ }
+ else {
+ (*infoRec->SubsequentDashedTwoPointLine) (infoRec->pScrn,
+ x1, y1, x2, y2,
+#ifdef POLYSEGMENT
+ (pGC->capStyle !=
+ CapNotLast) ? 0 :
+#endif
+ OMIT_LAST,
+ PatternOffset);
+ }
+ (*infoRec->DisableClipping) (infoRec->pScrn);
+ pbox++;
+ }
+ else {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int err, adx, ady;
+
+ if (octant & YMAJOR) {
+ ady = dmaj >> 1;
+ adx = dmin >> 1;
+ }
+ else {
+ ady = dmin >> 1;
+ adx = dmaj >> 1;
+ }
+
+ if (miZeroClipLine(pbox->x1, pbox->y1,
+ pbox->x2 - 1, pbox->y2 - 1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1) {
+ pbox++;
+ continue;
+ }
+
+ if (octant & YMAJOR)
+ len = abs(new_y2 - new_y1);
+ else
+ len = abs(new_x2 - new_x1);
+#ifdef POLYSEGMENT
+ if (clip2 != 0 || pGC->capStyle != CapNotLast)
+ len++;
+#else
+ len += (clip2 != 0);
+#endif
+ if (len) {
+ int abserr, clipdx, clipdy;
+
+ /* unwind bresenham error term to first point */
+ if (clip1) {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+
+ if (octant & YMAJOR)
+ err = e + clipdy * dmin - clipdx * dmaj;
+ else
+ err = e + clipdx * dmin - clipdy * dmaj;
+ }
+ else
+ err = e;
+
+#define range infoRec->DashedBresenhamLineErrorTermBits
+ abserr = abs(err);
+ while ((abserr & range) || (dmaj & range) || (dmin & range)) {
+ dmin >>= 1;
+ dmaj >>= 1;
+ abserr >>= 1;
+ err /= 2;
+ }
+
+ if (octant & YMAJOR)
+ offset = abs(new_y1 - y1);
+ else
+ offset = abs(new_x1 - x1);
+
+ offset += PatternOffset;
+ offset %= PatternLength;
+
+ (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn,
+ new_x1, new_y1,
+ dmaj, dmin, err,
+ len, octant,
+ offset);
+ }
+ pbox++;
+ }
+ } /* while (nbox--) */
+#ifndef POLYSEGMENT
+ len = abs(y2 - y1);
+ tmp = abs(x2 - x1);
+ PatternOffset += (len > tmp) ? len : tmp;
+ PatternOffset %= PatternLength;
+#endif
+ } /* while (nline--) */
+
+#ifndef POLYSEGMENT
+ /* paint the last point if the end style isn't CapNotLast.
+ (Assume that a projecting, butt, or round cap that is one
+ pixel wide is the same as the single pixel of the endpoint.)
+ */
+
+ if ((pGC->capStyle != CapNotLast) &&
+ ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
+ (ppt->y + yorg != pptInit->y + pDrawable->y) ||
+ (ppt == pptInit + 1))) {
+ nbox = nboxInit;
+ pbox = pboxInit;
+ while (nbox--) {
+ if ((x2 >= pbox->x1) && (y2 >= pbox->y1) &&
+ (x2 < pbox->x2) && (y2 < pbox->y2)) {
+ if (infoRec->SubsequentDashedTwoPointLine) {
+ (*infoRec->SubsequentDashedTwoPointLine) (infoRec->pScrn,
+ x2, y2, x2, y2, 0,
+ PatternOffset);
+ }
+ else {
+ (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn,
+ x2, y2, 2, 0, -1,
+ 1, 0,
+ PatternOffset);
+ }
+ break;
+ }
+ else
+ pbox++;
+ }
+ }
+#endif
+
+ SET_SYNC_FLAG(infoRec);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaFallback.c b/xorg-server/hw/xfree86/xaa/xaaFallback.c
index 744fd0a21..f7604ef90 100644
--- a/xorg-server/hw/xfree86/xaa/xaaFallback.c
+++ b/xorg-server/hw/xfree86/xaa/xaaFallback.c
@@ -1,351 +1,281 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "xaawrap.h"
-
-
-
-static void
-XAAFillSpansFallback(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-XAASetSpansFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- register DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPutImageFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static RegionPtr
-XAACopyAreaFallback(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty )
-{
- RegionPtr ret;
-
- XAA_GC_OP_PROLOGUE(pGC);
- if((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) ||
- IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) {
- SYNC_CHECK(pGC);
- }
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
- XAA_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static RegionPtr
-XAACopyPlaneFallback(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane )
-{
- RegionPtr ret;
-
- XAA_GC_OP_PROLOGUE(pGC);
- if((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) ||
- IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) {
- SYNC_CHECK(pGC);
- }
- ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
- XAA_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-XAAPolyPointFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-
-static void
-XAAPolylinesFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPolySegmentFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPolyRectangleFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPolyArcFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAFillPolygonFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-
-static void
-XAAPolyFillRectFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-
-static void
-XAAPolyFillArcFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static int
-XAAPolyText8Fallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars )
-{
- int ret;
-
- XAA_GC_OP_PROLOGUE(pGC);
- SYNC_CHECK(pGC);
- ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
- XAA_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static int
-XAAPolyText16Fallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars )
-{
- int ret;
-
- XAA_GC_OP_PROLOGUE(pGC);
- SYNC_CHECK(pGC);
- ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
- XAA_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-XAAImageText8Fallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAImageText16Fallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-
-static void
-XAAImageGlyphBltFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPolyGlyphBltFallback(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPushPixelsFallback(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg )
-{
- XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
- SYNC_CHECK(pGC);
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
- XAA_GC_OP_EPILOGUE(pGC);
-}
-
-GCOps XAAFallbackOps = {
- XAAFillSpansFallback, XAASetSpansFallback,
- XAAPutImageFallback, XAACopyAreaFallback,
- XAACopyPlaneFallback, XAAPolyPointFallback,
- XAAPolylinesFallback, XAAPolySegmentFallback,
- XAAPolyRectangleFallback, XAAPolyArcFallback,
- XAAFillPolygonFallback, XAAPolyFillRectFallback,
- XAAPolyFillArcFallback, XAAPolyText8Fallback,
- XAAPolyText16Fallback, XAAImageText8Fallback,
- XAAImageText16Fallback, XAAImageGlyphBltFallback,
- XAAPolyGlyphBltFallback, XAAPushPixelsFallback,
-};
-
-GCOps *XAAGetFallbackOps(void)
-{
- return &XAAFallbackOps;
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "xaawrap.h"
+
+static void
+XAAFillSpansFallback(DrawablePtr pDraw,
+ GC * pGC,
+ int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAASetSpansFallback(DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth, int nspans, int fSorted)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPutImageFallback(DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad, int format, char *pImage)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static RegionPtr
+XAACopyAreaFallback(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC * pGC,
+ int srcx, int srcy,
+ int width, int height, int dstx, int dsty)
+{
+ RegionPtr ret;
+
+ XAA_GC_OP_PROLOGUE(pGC);
+ if ((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) ||
+ IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) {
+ SYNC_CHECK(pGC);
+ }
+ ret = (*pGC->ops->CopyArea) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ XAA_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static RegionPtr
+XAACopyPlaneFallback(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ RegionPtr ret;
+
+ XAA_GC_OP_PROLOGUE(pGC);
+ if ((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) ||
+ IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) {
+ SYNC_CHECK(pGC);
+ }
+ ret = (*pGC->ops->CopyPlane) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ bitPlane);
+ XAA_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+XAAPolyPointFallback(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int npt, xPoint * pptInit)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyPoint) (pDraw, pGC, mode, npt, pptInit);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolylinesFallback(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->Polylines) (pDraw, pGC, mode, npt, pptInit);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolySegmentFallback(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSeg)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolySegment) (pDraw, pGC, nseg, pSeg);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyRectangleFallback(DrawablePtr pDraw,
+ GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyArcFallback(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyArc) (pDraw, pGC, narcs, parcs);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAFillPolygonFallback(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyFillRectFallback(DrawablePtr pDraw,
+ GCPtr pGC, int nrectFill, xRectangle *prectInit)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, nrectFill, prectInit);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyFillArcFallback(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, parcs);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static int
+XAAPolyText8Fallback(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ int ret;
+
+ XAA_GC_OP_PROLOGUE(pGC);
+ SYNC_CHECK(pGC);
+ ret = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars);
+ XAA_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static int
+XAAPolyText16Fallback(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
+{
+ int ret;
+
+ XAA_GC_OP_PROLOGUE(pGC);
+ SYNC_CHECK(pGC);
+ ret = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars);
+ XAA_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+XAAImageText8Fallback(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAImageText16Fallback(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAImageGlyphBltFallback(DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph, ppci,
+ pglyphBase);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyGlyphBltFallback(DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph, ppci,
+ pglyphBase);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPushPixelsFallback(GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg)
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+GCOps XAAFallbackOps = {
+ XAAFillSpansFallback, XAASetSpansFallback,
+ XAAPutImageFallback, XAACopyAreaFallback,
+ XAACopyPlaneFallback, XAAPolyPointFallback,
+ XAAPolylinesFallback, XAAPolySegmentFallback,
+ XAAPolyRectangleFallback, XAAPolyArcFallback,
+ XAAFillPolygonFallback, XAAPolyFillRectFallback,
+ XAAPolyFillArcFallback, XAAPolyText8Fallback,
+ XAAPolyText16Fallback, XAAImageText8Fallback,
+ XAAImageText16Fallback, XAAImageGlyphBltFallback,
+ XAAPolyGlyphBltFallback, XAAPushPixelsFallback,
+};
+
+GCOps *
+XAAGetFallbackOps(void)
+{
+ return &XAAFallbackOps;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaFillArc.c b/xorg-server/hw/xfree86/xaa/xaaFillArc.c
index 824d2af1d..fb7e7201f 100644
--- a/xorg-server/hw/xfree86/xaa/xaaFillArc.c
+++ b/xorg-server/hw/xfree86/xaa/xaaFillArc.c
@@ -1,213 +1,202 @@
-/*
- * Copyright 1996 The XFree86 Project
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
- */
-
-/*
- * Filled solid arcs, based on cfbfillarc.c.
- *
- * Fill arc using calls to low-level span fill. Because the math for
- * each span can be done concurrently with the drawing of the span
- * with a graphics coprocessor operation, this is faster than just
- * using miPolyFillArc, which first calculates all the spans and then
- * calls FillSpans.
- *
- * Clipped arcs are dispatched to FillSpans.
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <limits.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "mifillarc.h"
-#include "mi.h"
-
-/*
- * This is based on the integer-math versions from mi. Perhaps on a
- * Pentium, the floating-point (double)-math version is faster.
- */
-
-static void
-XAAFillEllipseSolid(DrawablePtr pDraw, GCPtr pGC, xArc *arc)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- register int x, y, e;
- int yk, xk, ym, xm, dx, dy, xorg, yorg;
- int slw;
- miFillArcRec info;
-
- (*infoRec->SetupForSolidFill)(infoRec->pScrn, pGC->fgPixel, pGC->alu,
- pGC->planemask);
-
- miFillArcSetup(arc, &info);
- MIFILLARCSETUP();
- if (pGC->miTranslate)
- {
- xorg += pDraw->x;
- yorg += pDraw->y;
- }
- while (y > 0)
- {
- MIFILLARCSTEP(slw);
- if (slw > 0) {
- (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn, xorg - x,
- yorg - y, slw, 1);
- if (miFillArcLower(slw))
- (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
- xorg - x, yorg + y + dy, slw, 1);
- }
- }
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-#define ADDSPAN(l,r) \
- if (r >= l) \
- (*infoRec->SubsequentSolidFillRect)( \
- infoRec->pScrn, l, ya, r - l + 1, 1);
-
-#define ADDSLICESPANS(flip) \
- if (!flip) \
- { \
- ADDSPAN(xl, xr); \
- } \
- else \
- { \
- xc = xorg - x; \
- ADDSPAN(xc, xr); \
- xc += slw - 1; \
- ADDSPAN(xl, xc); \
- }
-
-static void
-XAAFillArcSliceSolid(DrawablePtr pDraw, GCPtr pGC, xArc *arc)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
- register int x, y, e;
- miFillArcRec info;
- miArcSliceRec slice;
- int ya, xl, xr, xc;
-
- (*infoRec->SetupForSolidFill)(infoRec->pScrn, pGC->fgPixel, pGC->alu,
- pGC->planemask);
-
- miFillArcSetup(arc, &info);
- miFillArcSliceSetup(arc, &slice, pGC);
- MIFILLARCSETUP();
- slw = arc->height;
- if (slice.flip_top || slice.flip_bot)
- slw += (arc->height >> 1) + 1;
- if (pGC->miTranslate)
- {
- xorg += pDraw->x;
- yorg += pDraw->y;
- slice.edge1.x += pDraw->x;
- slice.edge2.x += pDraw->x;
- }
- while (y > 0)
- {
- MIFILLARCSTEP(slw);
- MIARCSLICESTEP(slice.edge1);
- MIARCSLICESTEP(slice.edge2);
- if (miFillSliceUpper(slice))
- {
- ya = yorg - y;
- MIARCSLICEUPPER(xl, xr, slice, slw);
-
- ADDSLICESPANS(slice.flip_top);
- }
- if (miFillSliceLower(slice))
- {
- ya = yorg + y + dy;
- MIARCSLICELOWER(xl, xr, slice, slw);
- ADDSLICESPANS(slice.flip_bot);
- }
- }
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-void
-XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
-{
- register xArc *arc;
- register int i;
- int x2, y2;
- BoxRec box;
- RegionPtr cclip;
-
- cclip = pGC->pCompositeClip;
-
- if(!RegionNumRects(cclip))
- return;
-
- for (arc = parcs, i = narcs; --i >= 0; arc++)
- {
- if (miFillArcEmpty(arc))
- continue;
- if (miCanFillArc(arc))
- {
- box.x1 = arc->x + pDraw->x;
- box.y1 = arc->y + pDraw->y;
- /*
- * Because box.x2 and box.y2 get truncated to 16 bits, and the
- * RECT_IN_REGION test treats the resulting number as a signed
- * integer, the RECT_IN_REGION test alone can go the wrong way.
- * This can result in a server crash because the rendering
- * routines in this file deal directly with cpu addresses
- * of pixels to be stored, and do not clip or otherwise check
- * that all such addresses are within their respective pixmaps.
- * So we only allow the RECT_IN_REGION test to be used for
- * values that can be expressed correctly in a signed short.
- */
- x2 = box.x1 + (int)arc->width + 1;
- box.x2 = x2;
- y2 = box.y1 + (int)arc->height + 1;
- box.y2 = y2;
- if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
- (RegionContainsRect(cclip, &box) == rgnIN) )
- {
- if ((arc->angle2 >= FULLCIRCLE) ||
- (arc->angle2 <= -FULLCIRCLE))
- XAAFillEllipseSolid(pDraw, pGC, arc);
- else
- XAAFillArcSliceSolid(pDraw, pGC, arc);
- continue;
- }
- }
- miPolyFillArc(pDraw, pGC, 1, arc);
- }
-}
+/*
+ * Copyright 1996 The XFree86 Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+ */
+
+/*
+ * Filled solid arcs, based on cfbfillarc.c.
+ *
+ * Fill arc using calls to low-level span fill. Because the math for
+ * each span can be done concurrently with the drawing of the span
+ * with a graphics coprocessor operation, this is faster than just
+ * using miPolyFillArc, which first calculates all the spans and then
+ * calls FillSpans.
+ *
+ * Clipped arcs are dispatched to FillSpans.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <limits.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "mifillarc.h"
+#include "mi.h"
+
+/*
+ * This is based on the integer-math versions from mi. Perhaps on a
+ * Pentium, the floating-point (double)-math version is faster.
+ */
+
+static void
+XAAFillEllipseSolid(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ register int x, y, e;
+ int yk, xk, ym, xm, dx, dy, xorg, yorg;
+ int slw;
+ miFillArcRec info;
+
+ (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu,
+ pGC->planemask);
+
+ miFillArcSetup(arc, &info);
+ MIFILLARCSETUP();
+ if (pGC->miTranslate) {
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ }
+ while (y > 0) {
+ MIFILLARCSTEP(slw);
+ if (slw > 0) {
+ (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn, xorg - x,
+ yorg - y, slw, 1);
+ if (miFillArcLower(slw))
+ (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn,
+ xorg - x, yorg + y + dy,
+ slw, 1);
+ }
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+#define ADDSPAN(l,r) \
+ if (r >= l) \
+ (*infoRec->SubsequentSolidFillRect)( \
+ infoRec->pScrn, l, ya, r - l + 1, 1);
+
+#define ADDSLICESPANS(flip) \
+ if (!flip) \
+ { \
+ ADDSPAN(xl, xr); \
+ } \
+ else \
+ { \
+ xc = xorg - x; \
+ ADDSPAN(xc, xr); \
+ xc += slw - 1; \
+ ADDSPAN(xl, xc); \
+ }
+
+static void
+XAAFillArcSliceSolid(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
+ register int x, y, e;
+ miFillArcRec info;
+ miArcSliceRec slice;
+ int ya, xl, xr, xc;
+
+ (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu,
+ pGC->planemask);
+
+ miFillArcSetup(arc, &info);
+ miFillArcSliceSetup(arc, &slice, pGC);
+ MIFILLARCSETUP();
+ slw = arc->height;
+ if (slice.flip_top || slice.flip_bot)
+ slw += (arc->height >> 1) + 1;
+ if (pGC->miTranslate) {
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ slice.edge1.x += pDraw->x;
+ slice.edge2.x += pDraw->x;
+ }
+ while (y > 0) {
+ MIFILLARCSTEP(slw);
+ MIARCSLICESTEP(slice.edge1);
+ MIARCSLICESTEP(slice.edge2);
+ if (miFillSliceUpper(slice)) {
+ ya = yorg - y;
+ MIARCSLICEUPPER(xl, xr, slice, slw);
+
+ ADDSLICESPANS(slice.flip_top);
+ }
+ if (miFillSliceLower(slice)) {
+ ya = yorg + y + dy;
+ MIARCSLICELOWER(xl, xr, slice, slw);
+ ADDSLICESPANS(slice.flip_bot);
+ }
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+{
+ register xArc *arc;
+ register int i;
+ int x2, y2;
+ BoxRec box;
+ RegionPtr cclip;
+
+ cclip = pGC->pCompositeClip;
+
+ if (!RegionNumRects(cclip))
+ return;
+
+ for (arc = parcs, i = narcs; --i >= 0; arc++) {
+ if (miFillArcEmpty(arc))
+ continue;
+ if (miCanFillArc(arc)) {
+ box.x1 = arc->x + pDraw->x;
+ box.y1 = arc->y + pDraw->y;
+ /*
+ * Because box.x2 and box.y2 get truncated to 16 bits, and the
+ * RECT_IN_REGION test treats the resulting number as a signed
+ * integer, the RECT_IN_REGION test alone can go the wrong way.
+ * This can result in a server crash because the rendering
+ * routines in this file deal directly with cpu addresses
+ * of pixels to be stored, and do not clip or otherwise check
+ * that all such addresses are within their respective pixmaps.
+ * So we only allow the RECT_IN_REGION test to be used for
+ * values that can be expressed correctly in a signed short.
+ */
+ x2 = box.x1 + (int) arc->width + 1;
+ box.x2 = x2;
+ y2 = box.y1 + (int) arc->height + 1;
+ box.y2 = y2;
+ if ((x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
+ (RegionContainsRect(cclip, &box) == rgnIN)) {
+ if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE))
+ XAAFillEllipseSolid(pDraw, pGC, arc);
+ else
+ XAAFillArcSliceSolid(pDraw, pGC, arc);
+ continue;
+ }
+ }
+ miPolyFillArc(pDraw, pGC, 1, arc);
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaFillPoly.c b/xorg-server/hw/xfree86/xaa/xaaFillPoly.c
index b8347b336..0cdedf57e 100644
--- a/xorg-server/hw/xfree86/xaa/xaaFillPoly.c
+++ b/xorg-server/hw/xfree86/xaa/xaaFillPoly.c
@@ -1,962 +1,991 @@
-
-/*
- * Copyright 1996 The XFree86 Project
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-/*
- * Written by Mark Vojkovich. Loosly based on an original version
- * written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net) which
- * only did solid rectangles and didn't have trapezoid support.
- *
- */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "micoord.h"
-
-#include "xaa.h"
-#include "xaalocal.h"
-
-#define POLY_USE_MI 0
-#define POLY_FULLY_CLIPPED 1
-#define POLY_IS_EASY 2
-
-
-#define Setup(c,x,vertex,dx,dy,e,sign,step,DX) {\
- x = intToX(vertex); \
- if ((dy = intToY(c) - y)) { \
- DX = dx = intToX(c) - x; \
- step = 0; \
- if (dx >= 0) \
- { \
- e = 0; \
- sign = 1; \
- if (dx >= dy) {\
- step = dx / dy; \
- dx %= dy; \
- } \
- } \
- else \
- { \
- e = 1 - dy; \
- sign = -1; \
- dx = -dx; \
- if (dx >= dy) { \
- step = - (dx / dy); \
- dx %= dy; \
- } \
- } \
- } \
- x += origin; \
- vertex = c; \
-}
-
-#define Step(x,dx,dy,e,sign,step) {\
- x += step; \
- if ((e += dx) > 0) \
- { \
- x += sign; \
- e -= dy; \
- } \
-}
-
-#define FixError(x, dx, dy, e, sign, step, h) { \
- e += (h) * dx; \
- x += (h) * step; \
- if(e > 0) { \
- x += e * sign/dy; \
- e %= dy; \
- if(e) { \
- x += sign; \
- e -= dy; \
- } \
- } \
-}
-
-
-/*
- XAAIsEasyPoly -
-
- Checks CoordModeOrigin one rect polygons to see if we need
- to use Mi.
- Returns: POLY_USE_MI, POLY_FULLY_CLIPPED or POLY_IS_EASY
- as well as the pointer to the "top" point and the y
- extents.
-*/
-
-int
-XAAIsEasyPolygon(
- DDXPointPtr ptsIn,
- int count,
- BoxPtr extents,
- int origin,
- DDXPointPtr *topPoint, /* return */
- int *topY, int *bottomY, /* return */
- int shape
-){
- int c = 0, vertex1, vertex2;
-
- *topY = 32767;
- *bottomY = 0;
-
- origin -= (origin & 0x8000) << 1;
- vertex1 = extents->x1 - origin;
- vertex2 = extents->x2 - origin /* - 0x00010001 */;
- /* I think this was an error in cfb ^ */
-
- if (shape == Convex) {
- while (count--) {
- c = *((int*)ptsIn);
- if (((c - vertex1) | (vertex2 - c)) & 0x80008000)
- return POLY_USE_MI;
-
- c = intToY(c);
- if (c < *topY) {
- *topY = c;
- *topPoint = ptsIn;
- }
- ptsIn++;
- if (c > *bottomY) *bottomY = c;
- }
- } else {
- int yFlip = 0;
- int dx2, dx1, x1, x2;
-
- x2 = x1 = -1;
- dx2 = dx1 = 1;
-
- while (count--) {
- c = *((int*)ptsIn);
- if (((c - vertex1) | (vertex2 - c)) & 0x80008000)
- return POLY_USE_MI;
- c = intToY(c);
- if (c < *topY) {
- *topY = c;
- *topPoint = ptsIn;
- }
- ptsIn++;
- if (c > *bottomY) *bottomY = c;
- if (c == x1)
- continue;
- if (dx1 > 0) {
- if (x2 < 0) x2 = c;
- else dx2 = dx1 = (c - x1) >> 31;
- } else if ((c - x1) >> 31 != dx1) {
- dx1 = ~dx1;
- yFlip++;
- }
- x1 = c;
- }
- x1 = (x2 - c) >> 31;
- if (x1 != dx1) yFlip++;
- if (x1 != dx2) yFlip++;
- if (yFlip != 2) {
- if(*topY == *bottomY)
- return POLY_FULLY_CLIPPED;
- else
- return POLY_USE_MI;
- }
- }
- if (*topY == *bottomY)
- return POLY_FULLY_CLIPPED;
-
- return POLY_IS_EASY;
-}
-
-void
-XAAFillPolygonSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int origin, vertex1, vertex2;
- int *vertex1p, *vertex2p, *endp;
- int x1 = 0, x2 = 0;
- int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0;
- int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0;
- int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0;
- int c, y, maxy, h, yoffset;
- DDXPointPtr topPoint;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- if (mode == CoordModePrevious) {
- register DDXPointPtr ppt = ptsIn + 1;
-
- for (origin = 1; origin < count; origin++, ppt++) {
- ppt->x += (ppt-1)->x;
- ppt->y += (ppt-1)->y;
- }
- mode = CoordModeOrigin;
- }
-
- if (RegionNumRects(pGC->pCompositeClip) != 1) {
- miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
- return;
- }
-
- origin = coordToInt(pDraw->x, pDraw->y);
-
- switch( XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
- origin, &topPoint, &y, &maxy, shape) ) {
- case POLY_USE_MI:
- miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
- case POLY_FULLY_CLIPPED:
- return;
- }
-
- endp = (int*)ptsIn + count;
- vertex2p = vertex1p = (int *)topPoint;
- origin = pDraw->x;
- yoffset = pDraw->y;
- vertex2 = vertex1 = *vertex2p++;
- if (vertex2p == endp)
- vertex2p = (int *) ptsIn;
-
- (*infoRec->SetupForSolidFill)(infoRec->pScrn, pGC->fgPixel, pGC->alu,
- pGC->planemask);
-
- while(1) {
- if (y == intToY(vertex1)) {
- do {
- if (vertex1p == (int *) ptsIn)
- vertex1p = endp;
- c = *--vertex1p;
- Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1,DX1)
- } while (y >= intToY(vertex1));
- h = dy1;
- } else {
- Step(x1,dx1,dy1,e1,sign1,step1)
- h = intToY(vertex1) - y;
- }
- if (y == intToY(vertex2)) {
- do {
- c = *vertex2p++;
- if (vertex2p == endp)
- vertex2p = (int *) ptsIn;
- Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2,DX2)
- } while (y >= intToY(vertex2));
- if (dy2 < h)
- h = dy2;
- } else {
- Step(x2,dx2,dy2,e2,sign2,step2)
- if ((c = (intToY(vertex2) - y)) < h)
- h = c;
- }
-
- /* fill spans for this segment */
- if(DX1 | DX2) {
- if(infoRec->SubsequentSolidFillTrap && (h > 6)) {
- if(x1 == x2) {
- while(x1 == x2) {
- y++;
- if (!--h) break;
- Step(x1,dx1,dy1,e1,sign1,step1)
- Step(x2,dx2,dy2,e2,sign2,step2)
- }
- if(y == maxy) break;
- if(!h) continue;
- }
-
- if(x1 < x2)
- (*infoRec->SubsequentSolidFillTrap)(infoRec->pScrn,
- y + yoffset, h,
- x1, DX1, dy1, e1,
- x2 - 1, DX2, dy2, e2);
- else
- (*infoRec->SubsequentSolidFillTrap)(infoRec->pScrn,
- y + yoffset, h,
- x2, DX2, dy2, e2,
- x1 - 1, DX1, dy1, e1);
- y += h;
- if(--h) {
- FixError(x1,dx1,dy1,e1,sign1,step1,h);
- FixError(x2,dx2,dy2,e2,sign2,step2,h);
- h = 0;
- }
- } else {
- while(1) {
- if (x2 > x1)
- (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
- x1, y + yoffset, x2 - x1, 1);
- else if (x1 > x2)
- (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
- x2, y + yoffset, x1 - x2, 1);
- y++;
- if (!--h) break;
- Step(x1,dx1,dy1,e1,sign1,step1)
- Step(x2,dx2,dy2,e2,sign2,step2)
- }
- }
- } else {
- if (x2 > x1)
- (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
- x1, y + yoffset, x2 - x1, h);
- else if (x1 > x2)
- (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
- x2, y + yoffset, x1 - x2, h);
-
- y += h;
- h = 0;
- }
- if (y == maxy) break;
- }
- SET_SYNC_FLAG(infoRec);
-}
-
-
-
-
-void
-XAAFillPolygonHelper(
- ScrnInfoPtr pScrn,
- DDXPointPtr ptsIn,
- int count,
- DDXPointPtr topPoint,
- int y,
- int maxy,
- int origin,
- RectFuncPtr RectFunc,
- TrapFuncPtr TrapFunc,
- int xorg,
- int yorg,
- XAACacheInfoPtr pCache
-){
- int *vertex1p, *vertex2p, *endp;
- int vertex1, vertex2;
- int x1 = 0, x2 = 0;
- int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0;
- int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0;
- int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0;
- int c, h, yoffset;
-
-
- endp = (int*)ptsIn + count;
- vertex2p = vertex1p = (int *)topPoint;
- yoffset = intToY(origin);
- origin = intToX(origin);
- vertex2 = vertex1 = *vertex2p++;
- if (vertex2p == endp)
- vertex2p = (int *)ptsIn;
-
- while(1) {
- if (y == intToY(vertex1)) {
- do {
- if (vertex1p == (int *) ptsIn)
- vertex1p = endp;
- c = *--vertex1p;
- Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1,DX1)
- } while (y >= intToY(vertex1));
- h = dy1;
- } else {
- Step(x1,dx1,dy1,e1,sign1,step1)
- h = intToY(vertex1) - y;
- }
- if (y == intToY(vertex2)) {
- do {
- c = *vertex2p++;
- if (vertex2p == endp)
- vertex2p = (int *) ptsIn;
- Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2,DX2)
- } while (y >= intToY(vertex2));
- if (dy2 < h)
- h = dy2;
- } else {
- Step(x2,dx2,dy2,e2,sign2,step2)
- if ((c = (intToY(vertex2) - y)) < h)
- h = c;
- }
-
- /* fill spans for this segment */
- if(DX1 | DX2) {
- if(TrapFunc && (h > 6)) {
- if(x1 == x2) {
- while(x1 == x2) {
- y++;
- if (!--h) break;
- Step(x1,dx1,dy1,e1,sign1,step1)
- Step(x2,dx2,dy2,e2,sign2,step2)
- }
- if(y == maxy) break;
- if(!h) continue;
- }
-
- if(x1 < x2)
- (*TrapFunc)(pScrn, y + yoffset, h,
- x1, DX1, dy1, e1,
- x2 - 1, DX2, dy2, e2, xorg, yorg, pCache);
- else
- (*TrapFunc)(pScrn, y + yoffset, h,
- x2, DX2, dy2, e2,
- x1 - 1, DX1, dy1, e1, xorg, yorg, pCache);
- y += h;
- if(--h) {
- FixError(x1,dx1,dy1,e1,sign1,step1,h);
- FixError(x2,dx2,dy2,e2,sign2,step2,h);
- h = 0;
- }
- } else {
- while(1) {
- if (x2 > x1)
- (*RectFunc)(pScrn,
- x1, y + yoffset, x2 - x1, 1, xorg, yorg, pCache);
- else if (x1 > x2)
- (*RectFunc)(pScrn,
- x2, y + yoffset, x1 - x2, 1, xorg, yorg, pCache);
- y++;
- if (!--h) break;
- Step(x1,dx1,dy1,e1,sign1,step1)
- Step(x2,dx2,dy2,e2,sign2,step2)
- }
- }
- } else {
- if (x2 > x1)
- (*RectFunc)(pScrn,
- x1, y + yoffset, x2 - x1, h, xorg, yorg, pCache);
- else if (x1 > x2)
- (*RectFunc)(pScrn,
- x2, y + yoffset, x1 - x2, h, xorg, yorg, pCache);
-
- y += h;
- h = 0;
- }
- if (y == maxy) break;
- }
-}
-
- /*****************\
- | Solid Helpers |
- \*****************/
-
-static void
-SolidTrapHelper(
- ScrnInfoPtr pScrn,
- int y, int h,
- int x1, int dx1, int dy1, int e1,
- int x2, int dx2, int dy2, int e2,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->SubsequentSolidFillTrap) (pScrn,
- y, h, x1, dx1, dy1, e1, x2, dx2, dy2, e2);
-}
-
-static void
-SolidRectHelper (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
-}
-
-
- /*********************\
- | Mono 8x8 Patterns |
- \*********************/
-
-static void
-Mono8x8PatternTrapHelper_ScreenOrigin(
- ScrnInfoPtr pScrn,
- int y, int h,
- int x1, int dx1, int dy1, int e1,
- int x2, int dx2, int dy2, int e2,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->SubsequentMono8x8PatternFillTrap) (pScrn, xorg, yorg,
- y, h, x1, dx1, dy1, e1, x2, dx2, dy2, e2);
-}
-
-static void
-Mono8x8PatternRectHelper_ScreenOrigin (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, xorg, yorg,
- x, y, w, h);
-}
-
-static void
-Mono8x8PatternRectHelper (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- xorg = (x - xorg) & 0x07;
- yorg = (y - yorg) & 0x07;
-
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_BITS) {
- int patx = pCache->pat0;
- int paty = pCache->pat1;
- XAARotateMonoPattern(&patx, &paty, xorg, yorg,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- xorg = patx; yorg = paty;
- } else {
- int slot = (yorg << 3) + xorg;
- xorg = pCache->x + pCache->offsets[slot].x;
- yorg = pCache->y + pCache->offsets[slot].y;
- }
- }
-
-
- (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, xorg, yorg,
- x, y, w, h);
-}
-
-
-
- /****************\
- | Cache Expand |
- \****************/
-
-
-static void
-CacheExpandRectHelper (
- ScrnInfoPtr pScrn,
- int X, int Y, int Width, int Height,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int x, phaseY, phaseX, skipleft, w, blit_w, blit_h;
- int cacheWidth;
-
- cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
- infoRec->CacheColorExpandDensity;
-
- phaseY = (Y - yorg) % pCache->orig_h;
- if(phaseY < 0) phaseY += pCache->orig_h;
- phaseX = (X - xorg) % pCache->orig_w;
- if(phaseX < 0) phaseX += pCache->orig_w;
-
- while(1) {
- w = Width; skipleft = phaseX; x = X;
- blit_h = pCache->h - phaseY;
- if(blit_h > Height) blit_h = Height;
-
- while(1) {
- blit_w = cacheWidth - skipleft;
- if(blit_w > w) blit_w = w;
- (*infoRec->SubsequentScreenToScreenColorExpandFill)(
- pScrn, x, Y, blit_w, blit_h,
- pCache->x, pCache->y + phaseY, skipleft);
- w -= blit_w;
- if(!w) break;
- x += blit_w;
- skipleft = (skipleft + blit_w) % pCache->orig_w;
- }
- Height -= blit_h;
- if(!Height) break;
- Y += blit_h;
- phaseY = (phaseY + blit_h) % pCache->orig_h;
- }
-}
-
-
-
- /**************\
- | Cache Blit |
- \**************/
-
-
-static void
-CacheBltRectHelper (
- ScrnInfoPtr pScrn,
- int X, int Y, int Width, int Height,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int x, phaseY, phaseX, skipleft, w, blit_w, blit_h;
-
- phaseY = (Y - yorg) % pCache->orig_h;
- if(phaseY < 0) phaseY += pCache->orig_h;
- phaseX = (X - xorg) % pCache->orig_w;
- if(phaseX < 0) phaseX += pCache->orig_w;
-
- while(1) {
- w = Width; skipleft = phaseX; x = X;
- blit_h = pCache->h - phaseY;
- if(blit_h > Height) blit_h = Height;
-
- while(1) {
- blit_w = pCache->w - skipleft;
- if(blit_w > w) blit_w = w;
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pCache->x + skipleft, pCache->y + phaseY,
- x, Y, blit_w, blit_h);
- w -= blit_w;
- if(!w) break;
- x += blit_w;
- skipleft = (skipleft + blit_w) % pCache->orig_w;
- }
- Height -= blit_h;
- if(!Height) break;
- Y += blit_h;
- phaseY = (phaseY + blit_h) % pCache->orig_h;
- }
-}
-
-
- /**********************\
- | Stippled Polygons |
- \**********************/
-
-
-void
-XAAFillPolygonStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
- int origin, type, patx, paty, fg, bg;
- int y, maxy, xorg, yorg;
- DDXPointPtr topPoint;
- XAACacheInfoPtr pCache = NULL;
- RectFuncPtr RectFunc = NULL;
- TrapFuncPtr TrapFunc = NULL;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- if (mode == CoordModePrevious) {
- register DDXPointPtr ppt = ptsIn + 1;
-
- for (origin = 1; origin < count; origin++, ppt++) {
- ppt->x += (ppt-1)->x;
- ppt->y += (ppt-1)->y;
- }
- mode = CoordModeOrigin;
- }
-
- if (RegionNumRects(pGC->pCompositeClip) != 1) {
- miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
- return;
- }
-
-
- if(pGC->fillStyle == FillStippled) {
- type = (*infoRec->StippledFillChooser)(pGC);
- fg = pGC->fgPixel; bg = -1;
- } else {
- type = (*infoRec->OpaqueStippledFillChooser)(pGC);
- fg = pGC->fgPixel; bg = pGC->bgPixel;
- }
-
-
- if(!type) {
- (*XAAFallbackOps.FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
- return;
- }
-
- if((type == DO_COLOR_EXPAND) || (type == DO_COLOR_8x8)) {
- miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
- return;
- }
-
- origin = pDraw->x;
-
- switch( XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
- origin, &topPoint, &y, &maxy, shape) ) {
- case POLY_USE_MI:
- miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
- case POLY_FULLY_CLIPPED:
- return;
- }
-
- xorg = (pDraw->x + pGC->patOrg.x);
- yorg = (pDraw->y + pGC->patOrg.y);
-
-
- if((fg == bg) && (bg != -1) && infoRec->SetupForSolidFill) {
-
- (*infoRec->SetupForSolidFill)(infoRec->pScrn, fg,
- pGC->alu, pGC->planemask);
-
- RectFunc = SolidRectHelper;
- TrapFunc = infoRec->SubsequentSolidFillTrap ? SolidTrapHelper : NULL;
- } else
- switch(type) {
- case DO_MONO_8x8:
- patx = pPriv->pattern0; paty = pPriv->pattern1;
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_SCREEN_ORIGIN) {
- xorg = (-xorg) & 0x07; yorg = (-yorg) & 0x07;
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_BITS) {
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
- XAARotateMonoPattern(&patx, &paty, xorg, yorg,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- xorg = patx; yorg = paty;
- }
- } else {
- XAACacheInfoPtr pCache = (*infoRec->CacheMono8x8Pattern)(
- infoRec->pScrn, patx, paty);
- patx = pCache->x; paty = pCache->y;
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- int slot = (yorg << 3) + xorg;
- patx += pCache->offsets[slot].x;
- paty += pCache->offsets[slot].y;
- xorg = patx; yorg = paty;
- }
- }
- RectFunc = Mono8x8PatternRectHelper_ScreenOrigin;
- if(infoRec->SubsequentMono8x8PatternFillTrap)
- TrapFunc = Mono8x8PatternTrapHelper_ScreenOrigin;
- } else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_BITS)){
- pCache = (*infoRec->CacheMono8x8Pattern)(
- infoRec->pScrn, patx, paty);
- patx = pCache->x; paty = pCache->y;
- } else {
- pCache = &(infoRec->ScratchCacheInfoRec);
- pCache->pat0 = patx;
- pCache->pat1 = paty;
- }
- RectFunc = Mono8x8PatternRectHelper;
- }
-
- (*infoRec->SetupForMono8x8PatternFill)(infoRec->pScrn,
- patx, paty, fg, bg, pGC->alu, pGC->planemask);
- break;
- case DO_CACHE_EXPAND:
- pCache = (*infoRec->CacheMonoStipple)(infoRec->pScrn, pGC->stipple);
-
- (*infoRec->SetupForScreenToScreenColorExpandFill)(
- infoRec->pScrn, fg, bg, pGC->alu, pGC->planemask);
-
- RectFunc = CacheExpandRectHelper;
- break;
- case DO_CACHE_BLT:
- pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple,
- fg, bg);
- (*infoRec->SetupForScreenToScreenCopy)(infoRec->pScrn, 1, 1,
- pGC->alu, pGC->planemask, pCache->trans_color);
-
- RectFunc = CacheBltRectHelper;
- break;
- default:
- return;
- }
-
-
- XAAFillPolygonHelper(infoRec->pScrn, ptsIn, count, topPoint,
- y, maxy, origin, RectFunc, TrapFunc, xorg, yorg, pCache);
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-
-
- /*******************\
- | Tiled Polygons |
- \*******************/
-
-
-void
-XAAFillPolygonTiled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
- int origin, type, patx, paty;
- int y, maxy, xorg, yorg;
- DDXPointPtr topPoint;
- XAACacheInfoPtr pCache = NULL;
- RectFuncPtr RectFunc = NULL;
- TrapFuncPtr TrapFunc = NULL;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- if (mode == CoordModePrevious) {
- register DDXPointPtr ppt = ptsIn + 1;
-
- for (origin = 1; origin < count; origin++, ppt++) {
- ppt->x += (ppt-1)->x;
- ppt->y += (ppt-1)->y;
- }
- mode = CoordModeOrigin;
- }
-
- if (RegionNumRects(pGC->pCompositeClip) != 1) {
- miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
- return;
- }
-
-
- type = (*infoRec->TiledFillChooser)(pGC);
-
- if(!type || (type == DO_IMAGE_WRITE)) {
- (*XAAFallbackOps.FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
- return;
- }
-
- if(type == DO_COLOR_8x8) {
- miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
- return;
- }
-
- origin = pDraw->x;
-
- switch( XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
- origin, &topPoint, &y, &maxy, shape) ) {
- case POLY_USE_MI:
- miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
- case POLY_FULLY_CLIPPED:
- return;
- }
-
- xorg = (pDraw->x + pGC->patOrg.x);
- yorg = (pDraw->y + pGC->patOrg.y);
-
- switch(type) {
- case DO_MONO_8x8:
- patx = pPriv->pattern0; paty = pPriv->pattern1;
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_SCREEN_ORIGIN) {
- xorg = (-xorg) & 0x07; yorg = (-yorg) & 0x07;
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_BITS) {
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
- XAARotateMonoPattern(&patx, &paty, xorg, yorg,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- xorg = patx; yorg = paty;
- }
- } else {
- XAACacheInfoPtr pCache = (*infoRec->CacheMono8x8Pattern)(
- infoRec->pScrn, patx, paty);
- patx = pCache->x; paty = pCache->y;
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- int slot = (yorg << 3) + xorg;
- patx += pCache->offsets[slot].x;
- paty += pCache->offsets[slot].y;
- xorg = patx; yorg = paty;
- }
- }
- RectFunc = Mono8x8PatternRectHelper_ScreenOrigin;
- if(infoRec->SubsequentMono8x8PatternFillTrap)
- TrapFunc = Mono8x8PatternTrapHelper_ScreenOrigin;
- } else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_BITS)){
- pCache = (*infoRec->CacheMono8x8Pattern)(
- infoRec->pScrn, patx, paty);
- patx = pCache->x; paty = pCache->y;
- }
- else {
- pCache = &(infoRec->ScratchCacheInfoRec);
- pCache->pat0 = patx;
- pCache->pat1 = paty;
- }
- RectFunc = Mono8x8PatternRectHelper;
- }
-
- (*infoRec->SetupForMono8x8PatternFill)(infoRec->pScrn,
- patx, paty, pPriv->fg, pPriv->bg, pGC->alu, pGC->planemask);
- break;
- case DO_CACHE_BLT:
- pCache = (*infoRec->CacheTile)(infoRec->pScrn, pGC->tile.pixmap);
- (*infoRec->SetupForScreenToScreenCopy)(infoRec->pScrn, 1, 1,
- pGC->alu, pGC->planemask, -1);
-
- RectFunc = CacheBltRectHelper;
- break;
- case DO_PIXMAP_COPY:
- pCache = &(infoRec->ScratchCacheInfoRec);
- pCache->x = pPriv->offscreenArea->box.x1;
- pCache->y = pPriv->offscreenArea->box.y1;
- pCache->w = pCache->orig_w =
- pPriv->offscreenArea->box.x2 - pCache->x;
- pCache->h = pCache->orig_h =
- pPriv->offscreenArea->box.y2 - pCache->y;
-
- (*infoRec->SetupForScreenToScreenCopy)(infoRec->pScrn, 1, 1,
- pGC->alu, pGC->planemask, -1);
-
- RectFunc = CacheBltRectHelper;
- break;
- default:
- return;
- }
-
- XAAFillPolygonHelper(infoRec->pScrn, ptsIn, count, topPoint,
- y, maxy, origin, RectFunc, TrapFunc, xorg, yorg, pCache);
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
+
+/*
+ * Copyright 1996 The XFree86 Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Written by Mark Vojkovich. Loosly based on an original version
+ * written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net) which
+ * only did solid rectangles and didn't have trapezoid support.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "micoord.h"
+
+#include "xaa.h"
+#include "xaalocal.h"
+
+#define POLY_USE_MI 0
+#define POLY_FULLY_CLIPPED 1
+#define POLY_IS_EASY 2
+
+#define Setup(c,x,vertex,dx,dy,e,sign,step,DX) {\
+ x = intToX(vertex); \
+ if ((dy = intToY(c) - y)) { \
+ DX = dx = intToX(c) - x; \
+ step = 0; \
+ if (dx >= 0) \
+ { \
+ e = 0; \
+ sign = 1; \
+ if (dx >= dy) {\
+ step = dx / dy; \
+ dx %= dy; \
+ } \
+ } \
+ else \
+ { \
+ e = 1 - dy; \
+ sign = -1; \
+ dx = -dx; \
+ if (dx >= dy) { \
+ step = - (dx / dy); \
+ dx %= dy; \
+ } \
+ } \
+ } \
+ x += origin; \
+ vertex = c; \
+}
+
+#define Step(x,dx,dy,e,sign,step) {\
+ x += step; \
+ if ((e += dx) > 0) \
+ { \
+ x += sign; \
+ e -= dy; \
+ } \
+}
+
+#define FixError(x, dx, dy, e, sign, step, h) { \
+ e += (h) * dx; \
+ x += (h) * step; \
+ if(e > 0) { \
+ x += e * sign/dy; \
+ e %= dy; \
+ if(e) { \
+ x += sign; \
+ e -= dy; \
+ } \
+ } \
+}
+
+/*
+ XAAIsEasyPoly -
+
+ Checks CoordModeOrigin one rect polygons to see if we need
+ to use Mi.
+ Returns: POLY_USE_MI, POLY_FULLY_CLIPPED or POLY_IS_EASY
+ as well as the pointer to the "top" point and the y
+ extents.
+*/
+
+int
+XAAIsEasyPolygon(DDXPointPtr ptsIn, int count, BoxPtr extents, int origin, DDXPointPtr * topPoint, /* return */
+ int *topY, int *bottomY, /* return */
+ int shape)
+{
+ int c = 0, vertex1, vertex2;
+
+ *topY = 32767;
+ *bottomY = 0;
+
+ origin -= (origin & 0x8000) << 1;
+ vertex1 = extents->x1 - origin;
+ vertex2 = extents->x2 - origin /* - 0x00010001 */ ;
+ /* I think this was an error in cfb ^ */
+
+ if (shape == Convex) {
+ while (count--) {
+ c = *((int *) ptsIn);
+ if (((c - vertex1) | (vertex2 - c)) & 0x80008000)
+ return POLY_USE_MI;
+
+ c = intToY(c);
+ if (c < *topY) {
+ *topY = c;
+ *topPoint = ptsIn;
+ }
+ ptsIn++;
+ if (c > *bottomY)
+ *bottomY = c;
+ }
+ }
+ else {
+ int yFlip = 0;
+ int dx2, dx1, x1, x2;
+
+ x2 = x1 = -1;
+ dx2 = dx1 = 1;
+
+ while (count--) {
+ c = *((int *) ptsIn);
+ if (((c - vertex1) | (vertex2 - c)) & 0x80008000)
+ return POLY_USE_MI;
+ c = intToY(c);
+ if (c < *topY) {
+ *topY = c;
+ *topPoint = ptsIn;
+ }
+ ptsIn++;
+ if (c > *bottomY)
+ *bottomY = c;
+ if (c == x1)
+ continue;
+ if (dx1 > 0) {
+ if (x2 < 0)
+ x2 = c;
+ else
+ dx2 = dx1 = (c - x1) >> 31;
+ }
+ else if ((c - x1) >> 31 != dx1) {
+ dx1 = ~dx1;
+ yFlip++;
+ }
+ x1 = c;
+ }
+ x1 = (x2 - c) >> 31;
+ if (x1 != dx1)
+ yFlip++;
+ if (x1 != dx2)
+ yFlip++;
+ if (yFlip != 2) {
+ if (*topY == *bottomY)
+ return POLY_FULLY_CLIPPED;
+ else
+ return POLY_USE_MI;
+ }
+ }
+ if (*topY == *bottomY)
+ return POLY_FULLY_CLIPPED;
+
+ return POLY_IS_EASY;
+}
+
+void
+XAAFillPolygonSolid(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int origin, vertex1, vertex2;
+ int *vertex1p, *vertex2p, *endp;
+ int x1 = 0, x2 = 0;
+ int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0;
+ int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0;
+ int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0;
+ int c, y, maxy, h, yoffset;
+ DDXPointPtr topPoint;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ if (mode == CoordModePrevious) {
+ register DDXPointPtr ppt = ptsIn + 1;
+
+ for (origin = 1; origin < count; origin++, ppt++) {
+ ppt->x += (ppt - 1)->x;
+ ppt->y += (ppt - 1)->y;
+ }
+ mode = CoordModeOrigin;
+ }
+
+ if (RegionNumRects(pGC->pCompositeClip) != 1) {
+ miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ origin = coordToInt(pDraw->x, pDraw->y);
+
+ switch (XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
+ origin, &topPoint, &y, &maxy, shape)) {
+ case POLY_USE_MI:
+ miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
+ case POLY_FULLY_CLIPPED:
+ return;
+ }
+
+ endp = (int *) ptsIn + count;
+ vertex2p = vertex1p = (int *) topPoint;
+ origin = pDraw->x;
+ yoffset = pDraw->y;
+ vertex2 = vertex1 = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+
+ (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu,
+ pGC->planemask);
+
+ while (1) {
+ if (y == intToY(vertex1)) {
+ do {
+ if (vertex1p == (int *) ptsIn)
+ vertex1p = endp;
+ c = *--vertex1p;
+ Setup(c, x1, vertex1, dx1, dy1, e1, sign1, step1, DX1)
+ } while (y >= intToY(vertex1));
+ h = dy1;
+ }
+ else {
+ Step(x1, dx1, dy1, e1, sign1, step1)
+ h = intToY(vertex1) - y;
+ }
+ if (y == intToY(vertex2)) {
+ do {
+ c = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+ Setup(c, x2, vertex2, dx2, dy2, e2, sign2, step2, DX2)
+ } while (y >= intToY(vertex2));
+ if (dy2 < h)
+ h = dy2;
+ }
+ else {
+ Step(x2, dx2, dy2, e2, sign2, step2)
+ if ((c = (intToY(vertex2) - y)) < h)
+ h = c;
+ }
+
+ /* fill spans for this segment */
+ if (DX1 | DX2) {
+ if (infoRec->SubsequentSolidFillTrap && (h > 6)) {
+ if (x1 == x2) {
+ while (x1 == x2) {
+ y++;
+ if (!--h)
+ break;
+ Step(x1, dx1, dy1, e1, sign1, step1)
+ Step(x2, dx2, dy2, e2, sign2, step2)
+ }
+ if (y == maxy)
+ break;
+ if (!h)
+ continue;
+ }
+
+ if (x1 < x2)
+ (*infoRec->SubsequentSolidFillTrap) (infoRec->pScrn,
+ y + yoffset, h,
+ x1, DX1, dy1, e1,
+ x2 - 1, DX2, dy2, e2);
+ else
+ (*infoRec->SubsequentSolidFillTrap) (infoRec->pScrn,
+ y + yoffset, h,
+ x2, DX2, dy2, e2,
+ x1 - 1, DX1, dy1, e1);
+ y += h;
+ if (--h) {
+ FixError(x1, dx1, dy1, e1, sign1, step1, h);
+ FixError(x2, dx2, dy2, e2, sign2, step2, h);
+ h = 0;
+ }
+ }
+ else {
+ while (1) {
+ if (x2 > x1)
+ (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn,
+ x1, y + yoffset,
+ x2 - x1, 1);
+ else if (x1 > x2)
+ (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn,
+ x2, y + yoffset,
+ x1 - x2, 1);
+ y++;
+ if (!--h)
+ break;
+ Step(x1, dx1, dy1, e1, sign1, step1)
+ Step(x2, dx2, dy2, e2, sign2, step2)
+ }
+ }
+ }
+ else {
+ if (x2 > x1)
+ (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn,
+ x1, y + yoffset, x2 - x1,
+ h);
+ else if (x1 > x2)
+ (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn,
+ x2, y + yoffset, x1 - x2,
+ h);
+
+ y += h;
+ h = 0;
+ }
+ if (y == maxy)
+ break;
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAFillPolygonHelper(ScrnInfoPtr pScrn,
+ DDXPointPtr ptsIn,
+ int count,
+ DDXPointPtr topPoint,
+ int y,
+ int maxy,
+ int origin,
+ RectFuncPtr RectFunc,
+ TrapFuncPtr TrapFunc,
+ int xorg, int yorg, XAACacheInfoPtr pCache)
+{
+ int *vertex1p, *vertex2p, *endp;
+ int vertex1, vertex2;
+ int x1 = 0, x2 = 0;
+ int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0;
+ int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0;
+ int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0;
+ int c, h, yoffset;
+
+ endp = (int *) ptsIn + count;
+ vertex2p = vertex1p = (int *) topPoint;
+ yoffset = intToY(origin);
+ origin = intToX(origin);
+ vertex2 = vertex1 = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+
+ while (1) {
+ if (y == intToY(vertex1)) {
+ do {
+ if (vertex1p == (int *) ptsIn)
+ vertex1p = endp;
+ c = *--vertex1p;
+ Setup(c, x1, vertex1, dx1, dy1, e1, sign1, step1, DX1)
+ } while (y >= intToY(vertex1));
+ h = dy1;
+ }
+ else {
+ Step(x1, dx1, dy1, e1, sign1, step1)
+ h = intToY(vertex1) - y;
+ }
+ if (y == intToY(vertex2)) {
+ do {
+ c = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+ Setup(c, x2, vertex2, dx2, dy2, e2, sign2, step2, DX2)
+ } while (y >= intToY(vertex2));
+ if (dy2 < h)
+ h = dy2;
+ }
+ else {
+ Step(x2, dx2, dy2, e2, sign2, step2)
+ if ((c = (intToY(vertex2) - y)) < h)
+ h = c;
+ }
+
+ /* fill spans for this segment */
+ if (DX1 | DX2) {
+ if (TrapFunc && (h > 6)) {
+ if (x1 == x2) {
+ while (x1 == x2) {
+ y++;
+ if (!--h)
+ break;
+ Step(x1, dx1, dy1, e1, sign1, step1)
+ Step(x2, dx2, dy2, e2, sign2, step2)
+ }
+ if (y == maxy)
+ break;
+ if (!h)
+ continue;
+ }
+
+ if (x1 < x2)
+ (*TrapFunc) (pScrn, y + yoffset, h,
+ x1, DX1, dy1, e1,
+ x2 - 1, DX2, dy2, e2, xorg, yorg, pCache);
+ else
+ (*TrapFunc) (pScrn, y + yoffset, h,
+ x2, DX2, dy2, e2,
+ x1 - 1, DX1, dy1, e1, xorg, yorg, pCache);
+ y += h;
+ if (--h) {
+ FixError(x1, dx1, dy1, e1, sign1, step1, h);
+ FixError(x2, dx2, dy2, e2, sign2, step2, h);
+ h = 0;
+ }
+ }
+ else {
+ while (1) {
+ if (x2 > x1)
+ (*RectFunc) (pScrn,
+ x1, y + yoffset, x2 - x1, 1, xorg, yorg,
+ pCache);
+ else if (x1 > x2)
+ (*RectFunc) (pScrn,
+ x2, y + yoffset, x1 - x2, 1, xorg, yorg,
+ pCache);
+ y++;
+ if (!--h)
+ break;
+ Step(x1, dx1, dy1, e1, sign1, step1)
+ Step(x2, dx2, dy2, e2, sign2, step2)
+ }
+ }
+ }
+ else {
+ if (x2 > x1)
+ (*RectFunc) (pScrn,
+ x1, y + yoffset, x2 - x1, h, xorg, yorg, pCache);
+ else if (x1 > x2)
+ (*RectFunc) (pScrn,
+ x2, y + yoffset, x1 - x2, h, xorg, yorg, pCache);
+
+ y += h;
+ h = 0;
+ }
+ if (y == maxy)
+ break;
+ }
+}
+
+ /*****************\
+ | Solid Helpers |
+ \*****************/
+
+static void
+SolidTrapHelper(ScrnInfoPtr pScrn,
+ int y, int h,
+ int x1, int dx1, int dy1, int e1,
+ int x2, int dx2, int dy2, int e2,
+ int xorg, int yorg, XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SubsequentSolidFillTrap) (pScrn,
+ y, h, x1, dx1, dy1, e1, x2, dx2, dy2,
+ e2);
+}
+
+static void
+SolidRectHelper(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int xorg, int yorg, XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
+}
+
+ /*********************\
+ | Mono 8x8 Patterns |
+ \*********************/
+
+static void
+Mono8x8PatternTrapHelper_ScreenOrigin(ScrnInfoPtr pScrn,
+ int y, int h,
+ int x1, int dx1, int dy1, int e1,
+ int x2, int dx2, int dy2, int e2,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SubsequentMono8x8PatternFillTrap) (pScrn, xorg, yorg,
+ y, h, x1, dx1, dy1, e1, x2,
+ dx2, dy2, e2);
+}
+
+static void
+Mono8x8PatternRectHelper_ScreenOrigin(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, xorg, yorg,
+ x, y, w, h);
+}
+
+static void
+Mono8x8PatternRectHelper(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int xorg, int yorg, XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ xorg = (x - xorg) & 0x07;
+ yorg = (y - yorg) & 0x07;
+
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ int patx = pCache->pat0;
+ int paty = pCache->pat1;
+
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx;
+ yorg = paty;
+ }
+ else {
+ int slot = (yorg << 3) + xorg;
+
+ xorg = pCache->x + pCache->offsets[slot].x;
+ yorg = pCache->y + pCache->offsets[slot].y;
+ }
+ }
+
+ (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, xorg, yorg,
+ x, y, w, h);
+}
+
+ /****************\
+ | Cache Expand |
+ \****************/
+
+static void
+CacheExpandRectHelper(ScrnInfoPtr pScrn,
+ int X, int Y, int Width, int Height,
+ int xorg, int yorg, XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, phaseY, phaseX, skipleft, w, blit_w, blit_h;
+ int cacheWidth;
+
+ cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
+ infoRec->CacheColorExpandDensity;
+
+ phaseY = (Y - yorg) % pCache->orig_h;
+ if (phaseY < 0)
+ phaseY += pCache->orig_h;
+ phaseX = (X - xorg) % pCache->orig_w;
+ if (phaseX < 0)
+ phaseX += pCache->orig_w;
+
+ while (1) {
+ w = Width;
+ skipleft = phaseX;
+ x = X;
+ blit_h = pCache->h - phaseY;
+ if (blit_h > Height)
+ blit_h = Height;
+
+ while (1) {
+ blit_w = cacheWidth - skipleft;
+ if (blit_w > w)
+ blit_w = w;
+ (*infoRec->SubsequentScreenToScreenColorExpandFill) (pScrn, x, Y,
+ blit_w, blit_h,
+ pCache->x,
+ pCache->y +
+ phaseY,
+ skipleft);
+ w -= blit_w;
+ if (!w)
+ break;
+ x += blit_w;
+ skipleft = (skipleft + blit_w) % pCache->orig_w;
+ }
+ Height -= blit_h;
+ if (!Height)
+ break;
+ Y += blit_h;
+ phaseY = (phaseY + blit_h) % pCache->orig_h;
+ }
+}
+
+ /**************\
+ | Cache Blit |
+ \**************/
+
+static void
+CacheBltRectHelper(ScrnInfoPtr pScrn,
+ int X, int Y, int Width, int Height,
+ int xorg, int yorg, XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, phaseY, phaseX, skipleft, w, blit_w, blit_h;
+
+ phaseY = (Y - yorg) % pCache->orig_h;
+ if (phaseY < 0)
+ phaseY += pCache->orig_h;
+ phaseX = (X - xorg) % pCache->orig_w;
+ if (phaseX < 0)
+ phaseX += pCache->orig_w;
+
+ while (1) {
+ w = Width;
+ skipleft = phaseX;
+ x = X;
+ blit_h = pCache->h - phaseY;
+ if (blit_h > Height)
+ blit_h = Height;
+
+ while (1) {
+ blit_w = pCache->w - skipleft;
+ if (blit_w > w)
+ blit_w = w;
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
+ pCache->x + skipleft,
+ pCache->y + phaseY, x, Y,
+ blit_w, blit_h);
+ w -= blit_w;
+ if (!w)
+ break;
+ x += blit_w;
+ skipleft = (skipleft + blit_w) % pCache->orig_w;
+ }
+ Height -= blit_h;
+ if (!Height)
+ break;
+ Y += blit_h;
+ phaseY = (phaseY + blit_h) % pCache->orig_h;
+ }
+}
+
+ /**********************\
+ | Stippled Polygons |
+ \**********************/
+
+void
+XAAFillPolygonStippled(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ int origin, type, patx, paty, fg, bg;
+ int y, maxy, xorg, yorg;
+ DDXPointPtr topPoint;
+ XAACacheInfoPtr pCache = NULL;
+ RectFuncPtr RectFunc = NULL;
+ TrapFuncPtr TrapFunc = NULL;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ if (mode == CoordModePrevious) {
+ register DDXPointPtr ppt = ptsIn + 1;
+
+ for (origin = 1; origin < count; origin++, ppt++) {
+ ppt->x += (ppt - 1)->x;
+ ppt->y += (ppt - 1)->y;
+ }
+ mode = CoordModeOrigin;
+ }
+
+ if (RegionNumRects(pGC->pCompositeClip) != 1) {
+ miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ if (pGC->fillStyle == FillStippled) {
+ type = (*infoRec->StippledFillChooser) (pGC);
+ fg = pGC->fgPixel;
+ bg = -1;
+ }
+ else {
+ type = (*infoRec->OpaqueStippledFillChooser) (pGC);
+ fg = pGC->fgPixel;
+ bg = pGC->bgPixel;
+ }
+
+ if (!type) {
+ (*XAAFallbackOps.FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ if ((type == DO_COLOR_EXPAND) || (type == DO_COLOR_8x8)) {
+ miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ origin = pDraw->x;
+
+ switch (XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
+ origin, &topPoint, &y, &maxy, shape)) {
+ case POLY_USE_MI:
+ miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
+ case POLY_FULLY_CLIPPED:
+ return;
+ }
+
+ xorg = (pDraw->x + pGC->patOrg.x);
+ yorg = (pDraw->y + pGC->patOrg.y);
+
+ if ((fg == bg) && (bg != -1) && infoRec->SetupForSolidFill) {
+
+ (*infoRec->SetupForSolidFill) (infoRec->pScrn, fg,
+ pGC->alu, pGC->planemask);
+
+ RectFunc = SolidRectHelper;
+ TrapFunc = infoRec->SubsequentSolidFillTrap ? SolidTrapHelper : NULL;
+ }
+ else
+ switch (type) {
+ case DO_MONO_8x8:
+ patx = pPriv->pattern0;
+ paty = pPriv->pattern1;
+ if (infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_SCREEN_ORIGIN) {
+ xorg = (-xorg) & 0x07;
+ yorg = (-yorg) & 0x07;
+ if (infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx;
+ yorg = paty;
+ }
+ }
+ else {
+ XAACacheInfoPtr pCache =
+ (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx,
+ paty);
+ patx = pCache->x;
+ paty = pCache->y;
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ int slot = (yorg << 3) + xorg;
+
+ patx += pCache->offsets[slot].x;
+ paty += pCache->offsets[slot].y;
+ xorg = patx;
+ yorg = paty;
+ }
+ }
+ RectFunc = Mono8x8PatternRectHelper_ScreenOrigin;
+ if (infoRec->SubsequentMono8x8PatternFillTrap)
+ TrapFunc = Mono8x8PatternTrapHelper_ScreenOrigin;
+ }
+ else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS)) {
+ pCache =
+ (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx,
+ paty);
+ patx = pCache->x;
+ paty = pCache->y;
+ }
+ else {
+ pCache = &(infoRec->ScratchCacheInfoRec);
+ pCache->pat0 = patx;
+ pCache->pat1 = paty;
+ }
+ RectFunc = Mono8x8PatternRectHelper;
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill) (infoRec->pScrn,
+ patx, paty, fg, bg,
+ pGC->alu, pGC->planemask);
+ break;
+ case DO_CACHE_EXPAND:
+ pCache =
+ (*infoRec->CacheMonoStipple) (infoRec->pScrn, pGC->stipple);
+
+ (*infoRec->SetupForScreenToScreenColorExpandFill) (infoRec->pScrn,
+ fg, bg, pGC->alu,
+ pGC->planemask);
+
+ RectFunc = CacheExpandRectHelper;
+ break;
+ case DO_CACHE_BLT:
+ pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
+ fg, bg);
+ (*infoRec->SetupForScreenToScreenCopy) (infoRec->pScrn, 1, 1,
+ pGC->alu, pGC->planemask,
+ pCache->trans_color);
+
+ RectFunc = CacheBltRectHelper;
+ break;
+ default:
+ return;
+ }
+
+ XAAFillPolygonHelper(infoRec->pScrn, ptsIn, count, topPoint,
+ y, maxy, origin, RectFunc, TrapFunc, xorg, yorg,
+ pCache);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /*******************\
+ | Tiled Polygons |
+ \*******************/
+
+void
+XAAFillPolygonTiled(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ int origin, type, patx, paty;
+ int y, maxy, xorg, yorg;
+ DDXPointPtr topPoint;
+ XAACacheInfoPtr pCache = NULL;
+ RectFuncPtr RectFunc = NULL;
+ TrapFuncPtr TrapFunc = NULL;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ if (mode == CoordModePrevious) {
+ register DDXPointPtr ppt = ptsIn + 1;
+
+ for (origin = 1; origin < count; origin++, ppt++) {
+ ppt->x += (ppt - 1)->x;
+ ppt->y += (ppt - 1)->y;
+ }
+ mode = CoordModeOrigin;
+ }
+
+ if (RegionNumRects(pGC->pCompositeClip) != 1) {
+ miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ type = (*infoRec->TiledFillChooser) (pGC);
+
+ if (!type || (type == DO_IMAGE_WRITE)) {
+ (*XAAFallbackOps.FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ if (type == DO_COLOR_8x8) {
+ miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ origin = pDraw->x;
+
+ switch (XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
+ origin, &topPoint, &y, &maxy, shape)) {
+ case POLY_USE_MI:
+ miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
+ case POLY_FULLY_CLIPPED:
+ return;
+ }
+
+ xorg = (pDraw->x + pGC->patOrg.x);
+ yorg = (pDraw->y + pGC->patOrg.y);
+
+ switch (type) {
+ case DO_MONO_8x8:
+ patx = pPriv->pattern0;
+ paty = pPriv->pattern1;
+ if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) {
+ xorg = (-xorg) & 0x07;
+ yorg = (-yorg) & 0x07;
+ if (infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx;
+ yorg = paty;
+ }
+ }
+ else {
+ XAACacheInfoPtr pCache =
+ (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx,
+ paty);
+ patx = pCache->x;
+ paty = pCache->y;
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ int slot = (yorg << 3) + xorg;
+
+ patx += pCache->offsets[slot].x;
+ paty += pCache->offsets[slot].y;
+ xorg = patx;
+ yorg = paty;
+ }
+ }
+ RectFunc = Mono8x8PatternRectHelper_ScreenOrigin;
+ if (infoRec->SubsequentMono8x8PatternFillTrap)
+ TrapFunc = Mono8x8PatternTrapHelper_ScreenOrigin;
+ }
+ else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS)) {
+ pCache =
+ (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx,
+ paty);
+ patx = pCache->x;
+ paty = pCache->y;
+ }
+ else {
+ pCache = &(infoRec->ScratchCacheInfoRec);
+ pCache->pat0 = patx;
+ pCache->pat1 = paty;
+ }
+ RectFunc = Mono8x8PatternRectHelper;
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill) (infoRec->pScrn,
+ patx, paty, pPriv->fg,
+ pPriv->bg, pGC->alu,
+ pGC->planemask);
+ break;
+ case DO_CACHE_BLT:
+ pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap);
+ (*infoRec->SetupForScreenToScreenCopy) (infoRec->pScrn, 1, 1,
+ pGC->alu, pGC->planemask, -1);
+
+ RectFunc = CacheBltRectHelper;
+ break;
+ case DO_PIXMAP_COPY:
+ pCache = &(infoRec->ScratchCacheInfoRec);
+ pCache->x = pPriv->offscreenArea->box.x1;
+ pCache->y = pPriv->offscreenArea->box.y1;
+ pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x;
+ pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y;
+
+ (*infoRec->SetupForScreenToScreenCopy) (infoRec->pScrn, 1, 1,
+ pGC->alu, pGC->planemask, -1);
+
+ RectFunc = CacheBltRectHelper;
+ break;
+ default:
+ return;
+ }
+
+ XAAFillPolygonHelper(infoRec->pScrn, ptsIn, count, topPoint,
+ y, maxy, origin, RectFunc, TrapFunc, xorg, yorg,
+ pCache);
+
+ SET_SYNC_FLAG(infoRec);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaFillRect.c b/xorg-server/hw/xfree86/xaa/xaaFillRect.c
index 724ff37a2..ec0fb9df7 100644
--- a/xorg-server/hw/xfree86/xaa/xaaFillRect.c
+++ b/xorg-server/hw/xfree86/xaa/xaaFillRect.c
@@ -1,1095 +1,1101 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-
-
-static void XAARenderSolidRects(GCPtr, int, BoxPtr, int, int);
-static void XAARenderColor8x8Rects(GCPtr, int, BoxPtr, int, int);
-static void XAARenderMono8x8Rects(GCPtr, int, BoxPtr, int, int);
-static void XAARenderColorExpandRects(GCPtr, int, BoxPtr, int, int);
-static void XAARenderCacheExpandRects(GCPtr, int, BoxPtr, int, int);
-static void XAARenderCacheBltRects(GCPtr, int, BoxPtr, int, int);
-static void XAARenderImageWriteRects(GCPtr, int, BoxPtr, int, int);
-static void XAARenderPixmapCopyRects(GCPtr, int, BoxPtr, int, int);
-
-void
-XAAPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill, /* number of rectangles to fill */
- xRectangle *prectInit /* Pointer to first rectangle to fill */
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int xorg = pDraw->x;
- int yorg = pDraw->y;
- int type = 0;
- ClipAndRenderRectsFunc function;
-
- if((nrectFill <= 0) || !pGC->planemask)
- return;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- switch(pGC->fillStyle) {
- case FillSolid:
- type = DO_SOLID;
- break;
- case FillStippled:
- type = (*infoRec->StippledFillChooser)(pGC);
- break;
- case FillOpaqueStippled:
- if((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSolidRects &&
- CHECK_PLANEMASK(pGC,infoRec->FillSolidRectsFlags) &&
- CHECK_ROP(pGC,infoRec->FillSolidRectsFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillSolidRectsFlags) &&
- CHECK_FG(pGC,infoRec->FillSolidRectsFlags))
- type = DO_SOLID;
- else
- type = (*infoRec->OpaqueStippledFillChooser)(pGC);
- break;
- case FillTiled:
- type = (*infoRec->TiledFillChooser)(pGC);
- break;
- }
-
- switch(type) {
- case DO_SOLID:
- function = XAARenderSolidRects;
- break;
- case DO_COLOR_8x8:
- function = XAARenderColor8x8Rects;
- break;
- case DO_MONO_8x8:
- function = XAARenderMono8x8Rects;
- break;
- case DO_CACHE_BLT:
- function = XAARenderCacheBltRects;
- break;
- case DO_COLOR_EXPAND:
- function = XAARenderColorExpandRects;
- break;
- case DO_CACHE_EXPAND:
- function = XAARenderCacheExpandRects;
- break;
- case DO_IMAGE_WRITE:
- function = XAARenderImageWriteRects;
- break;
- case DO_PIXMAP_COPY:
- function = XAARenderPixmapCopyRects;
- break;
- default:
- (*XAAFallbackOps.PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
- return;
- }
-
- if(xorg | yorg) {
- int n = nrectFill;
- xRectangle *prect = prectInit;
-
- while(n--) {
- prect->x += xorg;
- prect->y += yorg;
- prect++;
- }
- }
-
-
- XAAClipAndRenderRects(pGC, function, nrectFill, prectInit, xorg, yorg);
-}
-
-
-
- /*********************\
- | Solid Rects |
- \*********************/
-
-static void
-XAARenderSolidRects(
- GCPtr pGC,
- int nboxes,
- BoxPtr pClipBoxes,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- (*infoRec->FillSolidRects) (infoRec->pScrn,
- pGC->fgPixel, pGC->alu, pGC->planemask, nboxes, pClipBoxes);
-}
-
-
- /************************\
- | Mono 8x8 Rects |
- \************************/
-
-static void
-XAARenderMono8x8Rects(
- GCPtr pGC,
- int nboxes,
- BoxPtr pClipBoxes,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAPixmapPtr pPriv;
- int fg, bg;
-
- switch(pGC->fillStyle) {
- case FillStippled:
- pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
- fg = pGC->fgPixel; bg = -1;
- break;
- case FillOpaqueStippled:
- pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
- fg = pGC->fgPixel; bg = pGC->bgPixel;
- break;
- case FillTiled:
- pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
- fg = pPriv->fg; bg = pPriv->bg;
- break;
- default: /* Muffle compiler */
- pPriv = NULL; /* Kaboom */
- fg = -1; bg = -1;
- break;
- }
-
- (*infoRec->FillMono8x8PatternRects) (infoRec->pScrn,
- fg, bg, pGC->alu, pGC->planemask,
- nboxes, pClipBoxes, pPriv->pattern0, pPriv->pattern1,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));
-}
-
- /*************************\
- | Color 8x8 Rects |
- \*************************/
-
-static void
-XAARenderColor8x8Rects(
- GCPtr pGC,
- int nboxes,
- BoxPtr pClipBoxes,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAACacheInfoPtr pCache;
- PixmapPtr pPix;
- int fg, bg;
-
- switch(pGC->fillStyle) {
- case FillStippled:
- pPix = pGC->stipple;
- fg = pGC->fgPixel; bg = -1;
- break;
- case FillOpaqueStippled:
- pPix = pGC->stipple;
- fg = pGC->fgPixel; bg = pGC->bgPixel;
- break;
- case FillTiled:
- pPix = pGC->tile.pixmap;
- fg = -1; bg = -1;
- break;
- default: /* Muffle compiler */
- pPix = NULL;
- fg = -1; bg = -1;
- break;
- }
-
- pCache = (*infoRec->CacheColor8x8Pattern)(infoRec->pScrn, pPix, fg, bg);
- (*infoRec->FillColor8x8PatternRects) (infoRec->pScrn,
- pGC->alu, pGC->planemask, nboxes, pClipBoxes,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y), pCache);
-}
-
-
- /****************************\
- | Color Expand Rects |
- \****************************/
-
-static void
-XAARenderColorExpandRects(
- GCPtr pGC,
- int nboxes,
- BoxPtr pClipBoxes,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int fg, bg;
-
- switch(pGC->fillStyle) {
- case FillStippled:
- fg = pGC->fgPixel; bg = -1;
- break;
- case FillOpaqueStippled:
- fg = pGC->fgPixel; bg = pGC->bgPixel;
- break;
- default: /* Muffle compiler */
- fg = -1; bg = -1;
- break;
- }
-
- (*infoRec->FillColorExpandRects) (infoRec->pScrn, fg, bg,
- pGC->alu, pGC->planemask, nboxes, pClipBoxes,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
- pGC->stipple);
-}
-
-
- /*************************\
- | Cache Blt Rects |
- \*************************/
-
-static void
-XAARenderCacheBltRects(
- GCPtr pGC,
- int nboxes,
- BoxPtr pClipBoxes,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAACacheInfoPtr pCache;
-
- switch(pGC->fillStyle) {
- case FillStippled:
- pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple,
- pGC->fgPixel, -1);
- break;
- case FillOpaqueStippled:
- pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple,
- pGC->fgPixel, pGC->bgPixel);
- break;
- case FillTiled:
- pCache = (*infoRec->CacheTile)(infoRec->pScrn, pGC->tile.pixmap);
- break;
- default: /* Muffle compiler */
- pCache = NULL;
- break;
- }
-
- (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu,
- pGC->planemask, nboxes, pClipBoxes,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y), pCache);
-}
-
-
- /****************************\
- | Cache Expand Rects |
- \****************************/
-
-static void
-XAARenderCacheExpandRects(
- GCPtr pGC,
- int nboxes,
- BoxPtr pClipBoxes,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int fg, bg;
-
- switch(pGC->fillStyle) {
- case FillStippled:
- fg = pGC->fgPixel; bg = -1;
- break;
- case FillOpaqueStippled:
- fg = pGC->fgPixel; bg = pGC->bgPixel;
- break;
- default: /* Muffle compiler */
- fg = -1; bg = -1;
- break;
- }
-
- (*infoRec->FillCacheExpandRects) (infoRec->pScrn, fg, bg,
- pGC->alu, pGC->planemask, nboxes, pClipBoxes,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
- pGC->stipple);
-}
-
-
-
- /***************************\
- | Image Write Rects |
- \***************************/
-
-static void
-XAARenderImageWriteRects(
- GCPtr pGC,
- int nboxes,
- BoxPtr pClipBoxes,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- (*infoRec->FillImageWriteRects) (infoRec->pScrn, pGC->alu,
- pGC->planemask, nboxes, pClipBoxes,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
- pGC->tile.pixmap);
-}
-
-
-
- /***************************\
- | Pixmap Copy Rects |
- \***************************/
-
-static void
-XAARenderPixmapCopyRects(
- GCPtr pGC,
- int nboxes,
- BoxPtr pClipBoxes,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
-
- pCache->x = pPriv->offscreenArea->box.x1;
- pCache->y = pPriv->offscreenArea->box.y1;
- pCache->w = pCache->orig_w =
- pPriv->offscreenArea->box.x2 - pCache->x;
- pCache->h = pCache->orig_h =
- pPriv->offscreenArea->box.y2 - pCache->y;
- pCache->trans_color = -1;
-
- (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu,
- pGC->planemask, nboxes, pClipBoxes,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
- pCache);
-}
-
-
-
- /************\
- | Solid |
- \************/
-
-void
-XAAFillSolidRects(
- ScrnInfoPtr pScrn,
- int fg, int rop,
- unsigned int planemask,
- int nBox, /* number of rectangles to fill */
- BoxPtr pBox /* Pointer to first rectangle to fill */
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->SetupForSolidFill)(pScrn, fg, rop, planemask);
- while(nBox--) {
- (*infoRec->SubsequentSolidFillRect)(pScrn, pBox->x1, pBox->y1,
- pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
- pBox++;
- }
- SET_SYNC_FLAG(infoRec);
-}
-
-
-
-
- /*********************\
- | 8x8 Mono Patterns |
- \*********************/
-
-
-void
-XAAFillMono8x8PatternRectsScreenOrigin(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int pattern0, int pattern1,
- int xorigin, int yorigin
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int patx = pattern0, paty = pattern1;
- int xorg = (-xorigin) & 0x07;
- int yorg = (-yorigin) & 0x07;
-
-
- if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- XAARotateMonoPattern(&patx, &paty, xorg, yorg,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- xorg = patx; yorg = paty;
- }
- } else {
- XAACacheInfoPtr pCache =
- (*infoRec->CacheMono8x8Pattern)(pScrn, pattern0, pattern1);
- patx = pCache->x; paty = pCache->y;
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- int slot = (yorg << 3) + xorg;
- patx += pCache->offsets[slot].x;
- paty += pCache->offsets[slot].y;
- xorg = patx; yorg = paty;
- }
- }
-
- (*infoRec->SetupForMono8x8PatternFill)(pScrn, patx, paty,
- fg, bg, rop, planemask);
-
- while(nBox--) {
- (*infoRec->SubsequentMono8x8PatternFillRect)(pScrn,
- xorg, yorg, pBox->x1, pBox->y1,
- pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
- pBox++;
- }
- SET_SYNC_FLAG(infoRec);
-}
-
-void
-XAAFillMono8x8PatternRects(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int pattern0, int pattern1,
- int xorigin, int yorigin
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int patx = pattern0, paty = pattern1;
- int xorg, yorg;
- XAACacheInfoPtr pCache = NULL;
-
-
- if(!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)){
- pCache = (*infoRec->CacheMono8x8Pattern)(pScrn, pattern0, pattern1);
- patx = pCache->x; paty = pCache->y;
- }
-
-
- (*infoRec->SetupForMono8x8PatternFill)(pScrn, patx, paty,
- fg, bg, rop, planemask);
-
-
- while(nBox--) {
- xorg = (pBox->x1 - xorigin) & 0x07;
- yorg = (pBox->y1 - yorigin) & 0x07;
-
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_BITS) {
- patx = pattern0; paty = pattern1;
- XAARotateMonoPattern(&patx, &paty, xorg, yorg,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- xorg = patx; yorg = paty;
- } else {
- int slot = (yorg << 3) + xorg;
- xorg = patx + pCache->offsets[slot].x;
- yorg = paty + pCache->offsets[slot].y;
- }
- }
-
- (*infoRec->SubsequentMono8x8PatternFillRect)(pScrn,
- xorg, yorg, pBox->x1, pBox->y1,
- pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
- pBox++;
- }
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
- /**********************\
- | 8x8 Color Patterns |
- \**********************/
-
-
-void
-XAAFillColor8x8PatternRectsScreenOrigin(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorigin, int yorigin,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int patx = pCache->x, paty = pCache->y;
- int xorg = (-xorigin) & 0x07;
- int yorg = (-yorigin) & 0x07;
-
- if(!(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- int slot = (yorg << 3) + xorg;
- paty += pCache->offsets[slot].y;
- patx += pCache->offsets[slot].x;
- xorg = patx; yorg = paty;
- }
-
- (*infoRec->SetupForColor8x8PatternFill)(pScrn, patx, paty,
- rop, planemask, pCache->trans_color);
-
- while(nBox--) {
- (*infoRec->SubsequentColor8x8PatternFillRect)(pScrn,
- xorg, yorg, pBox->x1, pBox->y1,
- pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
- pBox++;
- }
- SET_SYNC_FLAG(infoRec);
-}
-
-void
-XAAFillColor8x8PatternRects(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorigin, int yorigin,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int xorg, yorg;
-
- (*infoRec->SetupForColor8x8PatternFill)(pScrn, pCache->x, pCache->y,
- rop, planemask, pCache->trans_color);
-
- while(nBox--) {
- xorg = (pBox->x1 - xorigin) & 0x07;
- yorg = (pBox->y1 - yorigin) & 0x07;
-
- if(!(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- int slot = (yorg << 3) + xorg;
- yorg = pCache->y + pCache->offsets[slot].y;
- xorg = pCache->x + pCache->offsets[slot].x;
- }
-
- (*infoRec->SubsequentColor8x8PatternFillRect)(pScrn,
- xorg, yorg, pBox->x1, pBox->y1,
- pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
- pBox++;
- }
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
- /***************\
- | Cache Blits |
- \***************/
-
-void
-XAAFillCacheBltRects(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int x, y, phaseY, phaseX, skipleft, height, width, w, blit_w, blit_h;
-
- (*infoRec->SetupForScreenToScreenCopy)(pScrn, 1, 1, rop, planemask,
- pCache->trans_color);
-
- while(nBox--) {
- y = pBox->y1;
- phaseY = (y - yorg) % pCache->orig_h;
- if(phaseY < 0) phaseY += pCache->orig_h;
- phaseX = (pBox->x1 - xorg) % pCache->orig_w;
- if(phaseX < 0) phaseX += pCache->orig_w;
- height = pBox->y2 - y;
- width = pBox->x2 - pBox->x1;
-
-#if 0
- if (rop == GXcopy) {
- while(1) {
- w = width; skipleft = phaseX; x = pBox->x1;
- blit_h = pCache->h - phaseY;
- if(blit_h > height) blit_h = height;
-
- while(1) {
- blit_w = pCache->w - skipleft;
- if(blit_w > w) blit_w = w;
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pCache->x + skipleft, pCache->y + phaseY,
- x, y, blit_w, blit_h);
- w -= blit_w;
- if(!w) break;
- x += blit_w;
- skipleft = (skipleft + blit_w) % pCache->orig_w;
- if(blit_w >= pCache->orig_w) break;
- }
-
- /* Expand horizontally */
- if (w) {
- skipleft -= phaseX;
- if (skipleft < 0) skipleft += pCache->orig_w;
- blit_w = x - pBox->x1 - skipleft;
- while(w) {
- if (blit_w > w) blit_w = w;
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pBox->x1 + skipleft, y, x, y, blit_w, blit_h);
- w -= blit_w;
- x += blit_w;
- blit_w <<= 1;
- }
- }
-
- height -= blit_h;
- if(!height) break;
- y += blit_h;
- phaseY = (phaseY + blit_h) % pCache->orig_h;
- if(blit_h >= pCache->orig_h) break;
- }
-
- /* Expand vertically */
- if (height) {
- blit_w = pBox->x2 - pBox->x1;
- phaseY -= (pBox->y1 - yorg) % pCache->orig_h;
- if (phaseY < 0) phaseY += pCache->orig_h;
- blit_h = y - pBox->y1 - phaseY;
- while(height) {
- if (blit_h > height) blit_h = height;
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pBox->x1,
- pBox->y1 + phaseY, pBox->x1, y, blit_w, blit_h);
- height -= blit_h;
- y += blit_h;
- blit_h <<= 1;
- }
- }
- } else
-#endif
- {
- while(1) {
- w = width; skipleft = phaseX; x = pBox->x1;
- blit_h = pCache->h - phaseY;
- if(blit_h > height) blit_h = height;
-
- while(1) {
- blit_w = pCache->w - skipleft;
- if(blit_w > w) blit_w = w;
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pCache->x + skipleft, pCache->y + phaseY,
- x, y, blit_w, blit_h);
- w -= blit_w;
- if(!w) break;
- x += blit_w;
- skipleft = (skipleft + blit_w) % pCache->orig_w;
- }
- height -= blit_h;
- if(!height) break;
- y += blit_h;
- phaseY = (phaseY + blit_h) % pCache->orig_h;
- }
- }
- pBox++;
- }
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-
-
- /*******************\
- | Cache Expansion |
- \*******************/
-
-
-
-void
-XAAFillCacheExpandRects(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int x, y, phaseY, phaseX, skipleft, height, width, w, blit_w, blit_h;
- int cacheWidth;
- XAACacheInfoPtr pCache;
-
- pCache = (*infoRec->CacheMonoStipple)(pScrn, pPix);
-
- cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
- infoRec->CacheColorExpandDensity;
-
- (*infoRec->SetupForScreenToScreenColorExpandFill)(pScrn, fg, bg, rop,
- planemask);
-
- while(nBox--) {
- y = pBox->y1;
- phaseY = (y - yorg) % pCache->orig_h;
- if(phaseY < 0) phaseY += pCache->orig_h;
- phaseX = (pBox->x1 - xorg) % pCache->orig_w;
- if(phaseX < 0) phaseX += pCache->orig_w;
- height = pBox->y2 - y;
- width = pBox->x2 - pBox->x1;
-
- while(1) {
- w = width; skipleft = phaseX; x = pBox->x1;
- blit_h = pCache->h - phaseY;
- if(blit_h > height) blit_h = height;
-
- while(1) {
- blit_w = cacheWidth - skipleft;
- if(blit_w > w) blit_w = w;
- (*infoRec->SubsequentScreenToScreenColorExpandFill)(
- pScrn, x, y, blit_w, blit_h,
- pCache->x, pCache->y + phaseY, skipleft);
- w -= blit_w;
- if(!w) break;
- x += blit_w;
- skipleft = (skipleft + blit_w) % pCache->orig_w;
- }
- height -= blit_h;
- if(!height) break;
- y += blit_h;
- phaseY = (phaseY + blit_h) % pCache->orig_h;
- }
- pBox++;
- }
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
- /******************\
- | Image Writes |
- \******************/
-
-
-
-/* This requires all LEFT_EDGE clipping. You get too many problems
- with reading past the edge of the pattern otherwise */
-
-static void
-WriteColumn(
- ScrnInfoPtr pScrn,
- unsigned char *pSrc,
- int x, int y, int w, int h,
- int xoff, int yoff,
- int pHeight,
- int srcwidth,
- int Bpp
-) {
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- unsigned char *src;
- Bool PlusOne = FALSE;
- int skipleft, dwords;
-
- pSrc += (Bpp * xoff);
-
- if((skipleft = (long)pSrc & 0x03L)) {
- if(Bpp == 3)
- skipleft = 4 - skipleft;
- else
- skipleft /= Bpp;
-
- x -= skipleft;
- w += skipleft;
-
- if(Bpp == 3)
- pSrc -= 3 * skipleft;
- else /* is this Alpha friendly ? */
- pSrc = (unsigned char*)((long)pSrc & ~0x03L);
- }
-
- src = pSrc + (yoff * srcwidth);
-
- dwords = bytes_to_int32(w * Bpp);
-
- if((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
- ((dwords * h) & 0x01)) {
- PlusOne = TRUE;
- }
-
- (*infoRec->SubsequentImageWriteRect)(pScrn, x, y, w, h, skipleft);
-
- if(dwords > infoRec->ImageWriteRange) {
- while(h--) {
- XAAMoveDWORDS_FixedBase((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords);
- src += srcwidth;
- yoff++;
- if(yoff >= pHeight) {
- yoff = 0;
- src = pSrc;
- }
- }
- } else {
- if(srcwidth == (dwords << 2)) {
- int maxLines = infoRec->ImageWriteRange/dwords;
- int step;
-
- while(h) {
- step = pHeight - yoff;
- if(step > maxLines) step = maxLines;
- if(step > h) step = h;
-
- XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords * step);
-
- src += (srcwidth * step);
- yoff += step;
- if(yoff >= pHeight) {
- yoff = 0;
- src = pSrc;
- }
- h -= step;
- }
- } else {
- while(h--) {
- XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords);
- src += srcwidth;
- yoff++;
- if(yoff >= pHeight) {
- yoff = 0;
- src = pSrc;
- }
- }
- }
- }
-
- if(PlusOne) {
- CARD32* base = (CARD32*)infoRec->ImageWriteBase;
- *base = 0x00000000;
- }
-}
-
-void
-XAAFillImageWriteRects(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int x, phaseY, phaseX, height, width, blit_w;
- int pHeight = pPix->drawable.height;
- int pWidth = pPix->drawable.width;
- int Bpp = pPix->drawable.bitsPerPixel >> 3;
- int srcwidth = pPix->devKind;
-
- (*infoRec->SetupForImageWrite)(pScrn, rop, planemask, -1,
- pPix->drawable.bitsPerPixel, pPix->drawable.depth);
-
- while(nBox--) {
- x = pBox->x1;
- phaseY = (pBox->y1 - yorg) % pHeight;
- if(phaseY < 0) phaseY += pHeight;
- phaseX = (x - xorg) % pWidth;
- if(phaseX < 0) phaseX += pWidth;
- height = pBox->y2 - pBox->y1;
- width = pBox->x2 - x;
-
- while(1) {
- blit_w = pWidth - phaseX;
- if(blit_w > width) blit_w = width;
-
- WriteColumn(pScrn, pPix->devPrivate.ptr, x, pBox->y1,
- blit_w, height, phaseX, phaseY, pHeight, srcwidth, Bpp);
-
- width -= blit_w;
- if(!width) break;
- x += blit_w;
- phaseX = (phaseX + blit_w) % pWidth;
- }
- pBox++;
- }
-
- if(infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-}
-
-
- /*************\
- | Utilities |
- \*************/
-
-
-void
-XAAClipAndRenderRects(
- GCPtr pGC,
- ClipAndRenderRectsFunc BoxFunc,
- int nrectFill,
- xRectangle *prect,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int Right, Bottom, MaxBoxes;
- BoxPtr pextent, pboxClipped, pboxClippedBase;
-
- MaxBoxes = infoRec->PreAllocSize/sizeof(BoxRec);
- pboxClippedBase = (BoxPtr)infoRec->PreAllocMem;
- pboxClipped = pboxClippedBase;
-
- if (RegionNumRects(pGC->pCompositeClip) == 1) {
- pextent = RegionRects(pGC->pCompositeClip);
- while (nrectFill--) {
- pboxClipped->x1 = max(pextent->x1, prect->x);
- pboxClipped->y1 = max(pextent->y1, prect->y);
-
- Right = (int)prect->x + (int)prect->width;
- pboxClipped->x2 = min(pextent->x2, Right);
-
- Bottom = (int)prect->y + (int)prect->height;
- pboxClipped->y2 = min(pextent->y2, Bottom);
-
- prect++;
- if ((pboxClipped->x1 < pboxClipped->x2) &&
- (pboxClipped->y1 < pboxClipped->y2)) {
- pboxClipped++;
- if(pboxClipped >= (pboxClippedBase + MaxBoxes)) {
- (*BoxFunc)(pGC, MaxBoxes, pboxClippedBase, xorg, yorg);
- pboxClipped = pboxClippedBase;
- }
- }
- }
- } else {
- pextent = RegionExtents(pGC->pCompositeClip);
- while (nrectFill--) {
- int n;
- BoxRec box, *pbox;
-
- box.x1 = max(pextent->x1, prect->x);
- box.y1 = max(pextent->y1, prect->y);
-
- Right = (int)prect->x + (int)prect->width;
- box.x2 = min(pextent->x2, Right);
-
- Bottom = (int)prect->y + (int)prect->height;
- box.y2 = min(pextent->y2, Bottom);
-
- prect++;
-
- if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
- continue;
-
- n = RegionNumRects (pGC->pCompositeClip);
- pbox = RegionRects(pGC->pCompositeClip);
-
- /* clip the rectangle to each box in the clip region
- this is logically equivalent to calling Intersect()
- */
- while(n--) {
- pboxClipped->x1 = max(box.x1, pbox->x1);
- pboxClipped->y1 = max(box.y1, pbox->y1);
- pboxClipped->x2 = min(box.x2, pbox->x2);
- pboxClipped->y2 = min(box.y2, pbox->y2);
- pbox++;
-
- /* see if clipping left anything */
- if(pboxClipped->x1 < pboxClipped->x2 &&
- pboxClipped->y1 < pboxClipped->y2) {
- pboxClipped++;
- if(pboxClipped >= (pboxClippedBase + MaxBoxes)) {
- (*BoxFunc)(pGC, MaxBoxes, pboxClippedBase, xorg, yorg);
- pboxClipped = pboxClippedBase;
- }
- }
- }
- }
- }
-
- if(pboxClipped != pboxClippedBase)
- (*BoxFunc)(pGC, pboxClipped - pboxClippedBase, pboxClippedBase,
- xorg, yorg);
-}
-
-
-int
-XAAGetRectClipBoxes(
- GCPtr pGC,
- BoxPtr pboxClippedBase,
- int nrectFill,
- xRectangle *prectInit
-){
- int Right, Bottom;
- BoxPtr pextent, pboxClipped = pboxClippedBase;
- xRectangle *prect = prectInit;
- RegionPtr prgnClip = pGC->pCompositeClip;
-
- if (RegionNumRects(prgnClip) == 1) {
- pextent = RegionRects(prgnClip);
- while (nrectFill--) {
- pboxClipped->x1 = max(pextent->x1, prect->x);
- pboxClipped->y1 = max(pextent->y1, prect->y);
-
- Right = (int)prect->x + (int)prect->width;
- pboxClipped->x2 = min(pextent->x2, Right);
-
- Bottom = (int)prect->y + (int)prect->height;
- pboxClipped->y2 = min(pextent->y2, Bottom);
-
- prect++;
- if ((pboxClipped->x1 < pboxClipped->x2) &&
- (pboxClipped->y1 < pboxClipped->y2)) {
- pboxClipped++;
- }
- }
- } else {
- pextent = RegionExtents(prgnClip);
- while (nrectFill--) {
- int n;
- BoxRec box, *pbox;
-
- box.x1 = max(pextent->x1, prect->x);
- box.y1 = max(pextent->y1, prect->y);
-
- Right = (int)prect->x + (int)prect->width;
- box.x2 = min(pextent->x2, Right);
-
- Bottom = (int)prect->y + (int)prect->height;
- box.y2 = min(pextent->y2, Bottom);
-
- prect++;
-
- if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
- continue;
-
- n = RegionNumRects (prgnClip);
- pbox = RegionRects(prgnClip);
-
- /* clip the rectangle to each box in the clip region
- this is logically equivalent to calling Intersect()
- */
- while(n--) {
- pboxClipped->x1 = max(box.x1, pbox->x1);
- pboxClipped->y1 = max(box.y1, pbox->y1);
- pboxClipped->x2 = min(box.x2, pbox->x2);
- pboxClipped->y2 = min(box.y2, pbox->y2);
- pbox++;
-
- /* see if clipping left anything */
- if(pboxClipped->x1 < pboxClipped->x2 &&
- pboxClipped->y1 < pboxClipped->y2) {
- pboxClipped++;
- }
- }
- }
- }
-
- return pboxClipped - pboxClippedBase;
-}
-
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+static void XAARenderSolidRects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderColor8x8Rects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderMono8x8Rects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderColorExpandRects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderCacheExpandRects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderCacheBltRects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderImageWriteRects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderPixmapCopyRects(GCPtr, int, BoxPtr, int, int);
+
+void
+XAAPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nrectFill, /* number of rectangles to fill */
+ xRectangle *prectInit /* Pointer to first rectangle to fill */
+ )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int xorg = pDraw->x;
+ int yorg = pDraw->y;
+ int type = 0;
+ ClipAndRenderRectsFunc function;
+
+ if ((nrectFill <= 0) || !pGC->planemask)
+ return;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ switch (pGC->fillStyle) {
+ case FillSolid:
+ type = DO_SOLID;
+ break;
+ case FillStippled:
+ type = (*infoRec->StippledFillChooser) (pGC);
+ break;
+ case FillOpaqueStippled:
+ if ((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSolidRects &&
+ CHECK_PLANEMASK(pGC, infoRec->FillSolidRectsFlags) &&
+ CHECK_ROP(pGC, infoRec->FillSolidRectsFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillSolidRectsFlags) &&
+ CHECK_FG(pGC, infoRec->FillSolidRectsFlags))
+ type = DO_SOLID;
+ else
+ type = (*infoRec->OpaqueStippledFillChooser) (pGC);
+ break;
+ case FillTiled:
+ type = (*infoRec->TiledFillChooser) (pGC);
+ break;
+ }
+
+ switch (type) {
+ case DO_SOLID:
+ function = XAARenderSolidRects;
+ break;
+ case DO_COLOR_8x8:
+ function = XAARenderColor8x8Rects;
+ break;
+ case DO_MONO_8x8:
+ function = XAARenderMono8x8Rects;
+ break;
+ case DO_CACHE_BLT:
+ function = XAARenderCacheBltRects;
+ break;
+ case DO_COLOR_EXPAND:
+ function = XAARenderColorExpandRects;
+ break;
+ case DO_CACHE_EXPAND:
+ function = XAARenderCacheExpandRects;
+ break;
+ case DO_IMAGE_WRITE:
+ function = XAARenderImageWriteRects;
+ break;
+ case DO_PIXMAP_COPY:
+ function = XAARenderPixmapCopyRects;
+ break;
+ default:
+ (*XAAFallbackOps.PolyFillRect) (pDraw, pGC, nrectFill, prectInit);
+ return;
+ }
+
+ if (xorg | yorg) {
+ int n = nrectFill;
+ xRectangle *prect = prectInit;
+
+ while (n--) {
+ prect->x += xorg;
+ prect->y += yorg;
+ prect++;
+ }
+ }
+
+ XAAClipAndRenderRects(pGC, function, nrectFill, prectInit, xorg, yorg);
+}
+
+ /*********************\
+ | Solid Rects |
+ \*********************/
+
+static void
+XAARenderSolidRects(GCPtr pGC,
+ int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ (*infoRec->FillSolidRects) (infoRec->pScrn,
+ pGC->fgPixel, pGC->alu, pGC->planemask, nboxes,
+ pClipBoxes);
+}
+
+ /************************\
+ | Mono 8x8 Rects |
+ \************************/
+
+static void
+XAARenderMono8x8Rects(GCPtr pGC,
+ int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAPixmapPtr pPriv;
+ int fg, bg;
+
+ switch (pGC->fillStyle) {
+ case FillStippled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ fg = pGC->fgPixel;
+ bg = -1;
+ break;
+ case FillOpaqueStippled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ fg = pGC->fgPixel;
+ bg = pGC->bgPixel;
+ break;
+ case FillTiled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ fg = pPriv->fg;
+ bg = pPriv->bg;
+ break;
+ default: /* Muffle compiler */
+ pPriv = NULL; /* Kaboom */
+ fg = -1;
+ bg = -1;
+ break;
+ }
+
+ (*infoRec->FillMono8x8PatternRects) (infoRec->pScrn,
+ fg, bg, pGC->alu, pGC->planemask,
+ nboxes, pClipBoxes, pPriv->pattern0,
+ pPriv->pattern1,
+ (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y));
+}
+
+ /*************************\
+ | Color 8x8 Rects |
+ \*************************/
+
+static void
+XAARenderColor8x8Rects(GCPtr pGC,
+ int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache;
+ PixmapPtr pPix;
+ int fg, bg;
+
+ switch (pGC->fillStyle) {
+ case FillStippled:
+ pPix = pGC->stipple;
+ fg = pGC->fgPixel;
+ bg = -1;
+ break;
+ case FillOpaqueStippled:
+ pPix = pGC->stipple;
+ fg = pGC->fgPixel;
+ bg = pGC->bgPixel;
+ break;
+ case FillTiled:
+ pPix = pGC->tile.pixmap;
+ fg = -1;
+ bg = -1;
+ break;
+ default: /* Muffle compiler */
+ pPix = NULL;
+ fg = -1;
+ bg = -1;
+ break;
+ }
+
+ pCache = (*infoRec->CacheColor8x8Pattern) (infoRec->pScrn, pPix, fg, bg);
+ (*infoRec->FillColor8x8PatternRects) (infoRec->pScrn,
+ pGC->alu, pGC->planemask, nboxes,
+ pClipBoxes, (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y), pCache);
+}
+
+ /****************************\
+ | Color Expand Rects |
+ \****************************/
+
+static void
+XAARenderColorExpandRects(GCPtr pGC,
+ int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int fg, bg;
+
+ switch (pGC->fillStyle) {
+ case FillStippled:
+ fg = pGC->fgPixel;
+ bg = -1;
+ break;
+ case FillOpaqueStippled:
+ fg = pGC->fgPixel;
+ bg = pGC->bgPixel;
+ break;
+ default: /* Muffle compiler */
+ fg = -1;
+ bg = -1;
+ break;
+ }
+
+ (*infoRec->FillColorExpandRects) (infoRec->pScrn, fg, bg,
+ pGC->alu, pGC->planemask, nboxes,
+ pClipBoxes, (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y), pGC->stipple);
+}
+
+ /*************************\
+ | Cache Blt Rects |
+ \*************************/
+
+static void
+XAARenderCacheBltRects(GCPtr pGC,
+ int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache;
+
+ switch (pGC->fillStyle) {
+ case FillStippled:
+ pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
+ pGC->fgPixel, -1);
+ break;
+ case FillOpaqueStippled:
+ pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
+ pGC->fgPixel, pGC->bgPixel);
+ break;
+ case FillTiled:
+ pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap);
+ break;
+ default: /* Muffle compiler */
+ pCache = NULL;
+ break;
+ }
+
+ (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu,
+ pGC->planemask, nboxes, pClipBoxes,
+ (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y), pCache);
+}
+
+ /****************************\
+ | Cache Expand Rects |
+ \****************************/
+
+static void
+XAARenderCacheExpandRects(GCPtr pGC,
+ int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int fg, bg;
+
+ switch (pGC->fillStyle) {
+ case FillStippled:
+ fg = pGC->fgPixel;
+ bg = -1;
+ break;
+ case FillOpaqueStippled:
+ fg = pGC->fgPixel;
+ bg = pGC->bgPixel;
+ break;
+ default: /* Muffle compiler */
+ fg = -1;
+ bg = -1;
+ break;
+ }
+
+ (*infoRec->FillCacheExpandRects) (infoRec->pScrn, fg, bg,
+ pGC->alu, pGC->planemask, nboxes,
+ pClipBoxes, (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y), pGC->stipple);
+}
+
+ /***************************\
+ | Image Write Rects |
+ \***************************/
+
+static void
+XAARenderImageWriteRects(GCPtr pGC,
+ int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ (*infoRec->FillImageWriteRects) (infoRec->pScrn, pGC->alu,
+ pGC->planemask, nboxes, pClipBoxes,
+ (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y), pGC->tile.pixmap);
+}
+
+ /***************************\
+ | Pixmap Copy Rects |
+ \***************************/
+
+static void
+XAARenderPixmapCopyRects(GCPtr pGC,
+ int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+
+ pCache->x = pPriv->offscreenArea->box.x1;
+ pCache->y = pPriv->offscreenArea->box.y1;
+ pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x;
+ pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y;
+ pCache->trans_color = -1;
+
+ (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu,
+ pGC->planemask, nboxes, pClipBoxes,
+ (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y), pCache);
+}
+
+ /************\
+ | Solid |
+ \************/
+
+void
+XAAFillSolidRects(ScrnInfoPtr pScrn, int fg, int rop, unsigned int planemask, int nBox, /* number of rectangles to fill */
+ BoxPtr pBox /* Pointer to first rectangle to fill */
+ )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SetupForSolidFill) (pScrn, fg, rop, planemask);
+ while (nBox--) {
+ (*infoRec->SubsequentSolidFillRect) (pScrn, pBox->x1, pBox->y1,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1);
+ pBox++;
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /*********************\
+ | 8x8 Mono Patterns |
+ \*********************/
+
+void
+XAAFillMono8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pattern0, int pattern1,
+ int xorigin, int yorigin)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pattern0, paty = pattern1;
+ int xorg = (-xorigin) & 0x07;
+ int yorg = (-yorigin) & 0x07;
+
+ if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx;
+ yorg = paty;
+ }
+ }
+ else {
+ XAACacheInfoPtr pCache =
+ (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1);
+ patx = pCache->x;
+ paty = pCache->y;
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ int slot = (yorg << 3) + xorg;
+
+ patx += pCache->offsets[slot].x;
+ paty += pCache->offsets[slot].y;
+ xorg = patx;
+ yorg = paty;
+ }
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty,
+ fg, bg, rop, planemask);
+
+ while (nBox--) {
+ (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn,
+ xorg, yorg, pBox->x1,
+ pBox->y1,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1);
+ pBox++;
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAFillMono8x8PatternRects(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pattern0, int pattern1, int xorigin, int yorigin)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pattern0, paty = pattern1;
+ int xorg, yorg;
+ XAACacheInfoPtr pCache = NULL;
+
+ if (!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)) {
+ pCache = (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1);
+ patx = pCache->x;
+ paty = pCache->y;
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty,
+ fg, bg, rop, planemask);
+
+ while (nBox--) {
+ xorg = (pBox->x1 - xorigin) & 0x07;
+ yorg = (pBox->y1 - yorigin) & 0x07;
+
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ if (infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ patx = pattern0;
+ paty = pattern1;
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx;
+ yorg = paty;
+ }
+ else {
+ int slot = (yorg << 3) + xorg;
+
+ xorg = patx + pCache->offsets[slot].x;
+ yorg = paty + pCache->offsets[slot].y;
+ }
+ }
+
+ (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn,
+ xorg, yorg, pBox->x1,
+ pBox->y1,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1);
+ pBox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /**********************\
+ | 8x8 Color Patterns |
+ \**********************/
+
+void
+XAAFillColor8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorigin, int yorigin,
+ XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pCache->x, paty = pCache->y;
+ int xorg = (-xorigin) & 0x07;
+ int yorg = (-yorigin) & 0x07;
+
+ if (!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ int slot = (yorg << 3) + xorg;
+
+ paty += pCache->offsets[slot].y;
+ patx += pCache->offsets[slot].x;
+ xorg = patx;
+ yorg = paty;
+ }
+
+ (*infoRec->SetupForColor8x8PatternFill) (pScrn, patx, paty,
+ rop, planemask,
+ pCache->trans_color);
+
+ while (nBox--) {
+ (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn,
+ xorg, yorg, pBox->x1,
+ pBox->y1,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1);
+ pBox++;
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAFillColor8x8PatternRects(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorigin, int yorigin, XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int xorg, yorg;
+
+ (*infoRec->SetupForColor8x8PatternFill) (pScrn, pCache->x, pCache->y,
+ rop, planemask,
+ pCache->trans_color);
+
+ while (nBox--) {
+ xorg = (pBox->x1 - xorigin) & 0x07;
+ yorg = (pBox->y1 - yorigin) & 0x07;
+
+ if (!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ int slot = (yorg << 3) + xorg;
+
+ yorg = pCache->y + pCache->offsets[slot].y;
+ xorg = pCache->x + pCache->offsets[slot].x;
+ }
+
+ (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn,
+ xorg, yorg, pBox->x1,
+ pBox->y1,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1);
+ pBox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /***************\
+ | Cache Blits |
+ \***************/
+
+void
+XAAFillCacheBltRects(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox, int xorg, int yorg, XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, y, phaseY, phaseX, skipleft, height, width, w, blit_w, blit_h;
+
+ (*infoRec->SetupForScreenToScreenCopy) (pScrn, 1, 1, rop, planemask,
+ pCache->trans_color);
+
+ while (nBox--) {
+ y = pBox->y1;
+ phaseY = (y - yorg) % pCache->orig_h;
+ if (phaseY < 0)
+ phaseY += pCache->orig_h;
+ phaseX = (pBox->x1 - xorg) % pCache->orig_w;
+ if (phaseX < 0)
+ phaseX += pCache->orig_w;
+ height = pBox->y2 - y;
+ width = pBox->x2 - pBox->x1;
+
+#if 0
+ if (rop == GXcopy) {
+ while (1) {
+ w = width;
+ skipleft = phaseX;
+ x = pBox->x1;
+ blit_h = pCache->h - phaseY;
+ if (blit_h > height)
+ blit_h = height;
+
+ while (1) {
+ blit_w = pCache->w - skipleft;
+ if (blit_w > w)
+ blit_w = w;
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
+ pCache->x +
+ skipleft,
+ pCache->y +
+ phaseY, x, y,
+ blit_w, blit_h);
+ w -= blit_w;
+ if (!w)
+ break;
+ x += blit_w;
+ skipleft = (skipleft + blit_w) % pCache->orig_w;
+ if (blit_w >= pCache->orig_w)
+ break;
+ }
+
+ /* Expand horizontally */
+ if (w) {
+ skipleft -= phaseX;
+ if (skipleft < 0)
+ skipleft += pCache->orig_w;
+ blit_w = x - pBox->x1 - skipleft;
+ while (w) {
+ if (blit_w > w)
+ blit_w = w;
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
+ pBox->x1 +
+ skipleft, y,
+ x, y, blit_w,
+ blit_h);
+ w -= blit_w;
+ x += blit_w;
+ blit_w <<= 1;
+ }
+ }
+
+ height -= blit_h;
+ if (!height)
+ break;
+ y += blit_h;
+ phaseY = (phaseY + blit_h) % pCache->orig_h;
+ if (blit_h >= pCache->orig_h)
+ break;
+ }
+
+ /* Expand vertically */
+ if (height) {
+ blit_w = pBox->x2 - pBox->x1;
+ phaseY -= (pBox->y1 - yorg) % pCache->orig_h;
+ if (phaseY < 0)
+ phaseY += pCache->orig_h;
+ blit_h = y - pBox->y1 - phaseY;
+ while (height) {
+ if (blit_h > height)
+ blit_h = height;
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pBox->x1,
+ pBox->y1 + phaseY,
+ pBox->x1, y,
+ blit_w, blit_h);
+ height -= blit_h;
+ y += blit_h;
+ blit_h <<= 1;
+ }
+ }
+ }
+ else
+#endif
+ {
+ while (1) {
+ w = width;
+ skipleft = phaseX;
+ x = pBox->x1;
+ blit_h = pCache->h - phaseY;
+ if (blit_h > height)
+ blit_h = height;
+
+ while (1) {
+ blit_w = pCache->w - skipleft;
+ if (blit_w > w)
+ blit_w = w;
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
+ pCache->x +
+ skipleft,
+ pCache->y +
+ phaseY, x, y,
+ blit_w, blit_h);
+ w -= blit_w;
+ if (!w)
+ break;
+ x += blit_w;
+ skipleft = (skipleft + blit_w) % pCache->orig_w;
+ }
+ height -= blit_h;
+ if (!height)
+ break;
+ y += blit_h;
+ phaseY = (phaseY + blit_h) % pCache->orig_h;
+ }
+ }
+ pBox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /*******************\
+ | Cache Expansion |
+ \*******************/
+
+void
+XAAFillCacheExpandRects(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, y, phaseY, phaseX, skipleft, height, width, w, blit_w, blit_h;
+ int cacheWidth;
+ XAACacheInfoPtr pCache;
+
+ pCache = (*infoRec->CacheMonoStipple) (pScrn, pPix);
+
+ cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
+ infoRec->CacheColorExpandDensity;
+
+ (*infoRec->SetupForScreenToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+
+ while (nBox--) {
+ y = pBox->y1;
+ phaseY = (y - yorg) % pCache->orig_h;
+ if (phaseY < 0)
+ phaseY += pCache->orig_h;
+ phaseX = (pBox->x1 - xorg) % pCache->orig_w;
+ if (phaseX < 0)
+ phaseX += pCache->orig_w;
+ height = pBox->y2 - y;
+ width = pBox->x2 - pBox->x1;
+
+ while (1) {
+ w = width;
+ skipleft = phaseX;
+ x = pBox->x1;
+ blit_h = pCache->h - phaseY;
+ if (blit_h > height)
+ blit_h = height;
+
+ while (1) {
+ blit_w = cacheWidth - skipleft;
+ if (blit_w > w)
+ blit_w = w;
+ (*infoRec->SubsequentScreenToScreenColorExpandFill) (pScrn, x,
+ y, blit_w,
+ blit_h,
+ pCache->x,
+ pCache->y +
+ phaseY,
+ skipleft);
+ w -= blit_w;
+ if (!w)
+ break;
+ x += blit_w;
+ skipleft = (skipleft + blit_w) % pCache->orig_w;
+ }
+ height -= blit_h;
+ if (!height)
+ break;
+ y += blit_h;
+ phaseY = (phaseY + blit_h) % pCache->orig_h;
+ }
+ pBox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /******************\
+ | Image Writes |
+ \******************/
+
+/* This requires all LEFT_EDGE clipping. You get too many problems
+ with reading past the edge of the pattern otherwise */
+
+static void
+WriteColumn(ScrnInfoPtr pScrn,
+ unsigned char *pSrc,
+ int x, int y, int w, int h,
+ int xoff, int yoff, int pHeight, int srcwidth, int Bpp)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ unsigned char *src;
+ Bool PlusOne = FALSE;
+ int skipleft, dwords;
+
+ pSrc += (Bpp * xoff);
+
+ if ((skipleft = (long) pSrc & 0x03L)) {
+ if (Bpp == 3)
+ skipleft = 4 - skipleft;
+ else
+ skipleft /= Bpp;
+
+ x -= skipleft;
+ w += skipleft;
+
+ if (Bpp == 3)
+ pSrc -= 3 * skipleft;
+ else /* is this Alpha friendly ? */
+ pSrc = (unsigned char *) ((long) pSrc & ~0x03L);
+ }
+
+ src = pSrc + (yoff * srcwidth);
+
+ dwords = bytes_to_int32(w * Bpp);
+
+ if ((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((dwords * h) & 0x01)) {
+ PlusOne = TRUE;
+ }
+
+ (*infoRec->SubsequentImageWriteRect) (pScrn, x, y, w, h, skipleft);
+
+ if (dwords > infoRec->ImageWriteRange) {
+ while (h--) {
+ XAAMoveDWORDS_FixedBase((CARD32 *) infoRec->ImageWriteBase,
+ (CARD32 *) src, dwords);
+ src += srcwidth;
+ yoff++;
+ if (yoff >= pHeight) {
+ yoff = 0;
+ src = pSrc;
+ }
+ }
+ }
+ else {
+ if (srcwidth == (dwords << 2)) {
+ int maxLines = infoRec->ImageWriteRange / dwords;
+ int step;
+
+ while (h) {
+ step = pHeight - yoff;
+ if (step > maxLines)
+ step = maxLines;
+ if (step > h)
+ step = h;
+
+ XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
+ (CARD32 *) src, dwords * step);
+
+ src += (srcwidth * step);
+ yoff += step;
+ if (yoff >= pHeight) {
+ yoff = 0;
+ src = pSrc;
+ }
+ h -= step;
+ }
+ }
+ else {
+ while (h--) {
+ XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
+ (CARD32 *) src, dwords);
+ src += srcwidth;
+ yoff++;
+ if (yoff >= pHeight) {
+ yoff = 0;
+ src = pSrc;
+ }
+ }
+ }
+ }
+
+ if (PlusOne) {
+ CARD32 *base = (CARD32 *) infoRec->ImageWriteBase;
+
+ *base = 0x00000000;
+ }
+}
+
+void
+XAAFillImageWriteRects(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, phaseY, phaseX, height, width, blit_w;
+ int pHeight = pPix->drawable.height;
+ int pWidth = pPix->drawable.width;
+ int Bpp = pPix->drawable.bitsPerPixel >> 3;
+ int srcwidth = pPix->devKind;
+
+ (*infoRec->SetupForImageWrite) (pScrn, rop, planemask, -1,
+ pPix->drawable.bitsPerPixel,
+ pPix->drawable.depth);
+
+ while (nBox--) {
+ x = pBox->x1;
+ phaseY = (pBox->y1 - yorg) % pHeight;
+ if (phaseY < 0)
+ phaseY += pHeight;
+ phaseX = (x - xorg) % pWidth;
+ if (phaseX < 0)
+ phaseX += pWidth;
+ height = pBox->y2 - pBox->y1;
+ width = pBox->x2 - x;
+
+ while (1) {
+ blit_w = pWidth - phaseX;
+ if (blit_w > width)
+ blit_w = width;
+
+ WriteColumn(pScrn, pPix->devPrivate.ptr, x, pBox->y1,
+ blit_w, height, phaseX, phaseY, pHeight, srcwidth, Bpp);
+
+ width -= blit_w;
+ if (!width)
+ break;
+ x += blit_w;
+ phaseX = (phaseX + blit_w) % pWidth;
+ }
+ pBox++;
+ }
+
+ if (infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
+ (*infoRec->Sync) (pScrn);
+ else
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /*************\
+ | Utilities |
+ \*************/
+
+void
+XAAClipAndRenderRects(GCPtr pGC,
+ ClipAndRenderRectsFunc BoxFunc,
+ int nrectFill, xRectangle *prect, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int Right, Bottom, MaxBoxes;
+ BoxPtr pextent, pboxClipped, pboxClippedBase;
+
+ MaxBoxes = infoRec->PreAllocSize / sizeof(BoxRec);
+ pboxClippedBase = (BoxPtr) infoRec->PreAllocMem;
+ pboxClipped = pboxClippedBase;
+
+ if (RegionNumRects(pGC->pCompositeClip) == 1) {
+ pextent = RegionRects(pGC->pCompositeClip);
+ while (nrectFill--) {
+ pboxClipped->x1 = max(pextent->x1, prect->x);
+ pboxClipped->y1 = max(pextent->y1, prect->y);
+
+ Right = (int) prect->x + (int) prect->width;
+ pboxClipped->x2 = min(pextent->x2, Right);
+
+ Bottom = (int) prect->y + (int) prect->height;
+ pboxClipped->y2 = min(pextent->y2, Bottom);
+
+ prect++;
+ if ((pboxClipped->x1 < pboxClipped->x2) &&
+ (pboxClipped->y1 < pboxClipped->y2)) {
+ pboxClipped++;
+ if (pboxClipped >= (pboxClippedBase + MaxBoxes)) {
+ (*BoxFunc) (pGC, MaxBoxes, pboxClippedBase, xorg, yorg);
+ pboxClipped = pboxClippedBase;
+ }
+ }
+ }
+ }
+ else {
+ pextent = RegionExtents(pGC->pCompositeClip);
+ while (nrectFill--) {
+ int n;
+ BoxRec box, *pbox;
+
+ box.x1 = max(pextent->x1, prect->x);
+ box.y1 = max(pextent->y1, prect->y);
+
+ Right = (int) prect->x + (int) prect->width;
+ box.x2 = min(pextent->x2, Right);
+
+ Bottom = (int) prect->y + (int) prect->height;
+ box.y2 = min(pextent->y2, Bottom);
+
+ prect++;
+
+ if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
+ continue;
+
+ n = RegionNumRects(pGC->pCompositeClip);
+ pbox = RegionRects(pGC->pCompositeClip);
+
+ /* clip the rectangle to each box in the clip region
+ this is logically equivalent to calling Intersect()
+ */
+ while (n--) {
+ pboxClipped->x1 = max(box.x1, pbox->x1);
+ pboxClipped->y1 = max(box.y1, pbox->y1);
+ pboxClipped->x2 = min(box.x2, pbox->x2);
+ pboxClipped->y2 = min(box.y2, pbox->y2);
+ pbox++;
+
+ /* see if clipping left anything */
+ if (pboxClipped->x1 < pboxClipped->x2 &&
+ pboxClipped->y1 < pboxClipped->y2) {
+ pboxClipped++;
+ if (pboxClipped >= (pboxClippedBase + MaxBoxes)) {
+ (*BoxFunc) (pGC, MaxBoxes, pboxClippedBase, xorg, yorg);
+ pboxClipped = pboxClippedBase;
+ }
+ }
+ }
+ }
+ }
+
+ if (pboxClipped != pboxClippedBase)
+ (*BoxFunc) (pGC, pboxClipped - pboxClippedBase, pboxClippedBase,
+ xorg, yorg);
+}
+
+int
+XAAGetRectClipBoxes(GCPtr pGC,
+ BoxPtr pboxClippedBase,
+ int nrectFill, xRectangle *prectInit)
+{
+ int Right, Bottom;
+ BoxPtr pextent, pboxClipped = pboxClippedBase;
+ xRectangle *prect = prectInit;
+ RegionPtr prgnClip = pGC->pCompositeClip;
+
+ if (RegionNumRects(prgnClip) == 1) {
+ pextent = RegionRects(prgnClip);
+ while (nrectFill--) {
+ pboxClipped->x1 = max(pextent->x1, prect->x);
+ pboxClipped->y1 = max(pextent->y1, prect->y);
+
+ Right = (int) prect->x + (int) prect->width;
+ pboxClipped->x2 = min(pextent->x2, Right);
+
+ Bottom = (int) prect->y + (int) prect->height;
+ pboxClipped->y2 = min(pextent->y2, Bottom);
+
+ prect++;
+ if ((pboxClipped->x1 < pboxClipped->x2) &&
+ (pboxClipped->y1 < pboxClipped->y2)) {
+ pboxClipped++;
+ }
+ }
+ }
+ else {
+ pextent = RegionExtents(prgnClip);
+ while (nrectFill--) {
+ int n;
+ BoxRec box, *pbox;
+
+ box.x1 = max(pextent->x1, prect->x);
+ box.y1 = max(pextent->y1, prect->y);
+
+ Right = (int) prect->x + (int) prect->width;
+ box.x2 = min(pextent->x2, Right);
+
+ Bottom = (int) prect->y + (int) prect->height;
+ box.y2 = min(pextent->y2, Bottom);
+
+ prect++;
+
+ if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
+ continue;
+
+ n = RegionNumRects(prgnClip);
+ pbox = RegionRects(prgnClip);
+
+ /* clip the rectangle to each box in the clip region
+ this is logically equivalent to calling Intersect()
+ */
+ while (n--) {
+ pboxClipped->x1 = max(box.x1, pbox->x1);
+ pboxClipped->y1 = max(box.y1, pbox->y1);
+ pboxClipped->x2 = min(box.x2, pbox->x2);
+ pboxClipped->y2 = min(box.y2, pbox->y2);
+ pbox++;
+
+ /* see if clipping left anything */
+ if (pboxClipped->x1 < pboxClipped->x2 &&
+ pboxClipped->y1 < pboxClipped->y2) {
+ pboxClipped++;
+ }
+ }
+ }
+ }
+
+ return pboxClipped - pboxClippedBase;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaGC.c b/xorg-server/hw/xfree86/xaa/xaaGC.c
index 1bc35d9f3..d55f1e445 100644
--- a/xorg-server/hw/xfree86/xaa/xaaGC.c
+++ b/xorg-server/hw/xfree86/xaa/xaaGC.c
@@ -37,614 +37,528 @@ extern GCOps XAAPixmapOps;
Bool
XAACreateGC(GCPtr pGC)
{
- ScreenPtr pScreen = pGC->pScreen;
- XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
- XAAGetGCKey());
- Bool ret;
-
- XAA_SCREEN_PROLOGUE(pScreen,CreateGC);
-
- if((ret = (*pScreen->CreateGC)(pGC))) {
- pGCPriv->wrapOps = NULL;
- pGCPriv->wrapFuncs = pGC->funcs;
- pGCPriv->XAAOps = &XAAFallbackOps;
- pGC->funcs = &XAAGCFuncs;
+ ScreenPtr pScreen = pGC->pScreen;
+ XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
+ Bool ret;
+
+ XAA_SCREEN_PROLOGUE(pScreen, CreateGC);
+
+ if ((ret = (*pScreen->CreateGC) (pGC))) {
+ pGCPriv->wrapOps = NULL;
+ pGCPriv->wrapFuncs = pGC->funcs;
+ pGCPriv->XAAOps = &XAAFallbackOps;
+ pGC->funcs = &XAAGCFuncs;
}
-
- XAA_SCREEN_EPILOGUE(pScreen,CreateGC,XAACreateGC);
+
+ XAA_SCREEN_EPILOGUE(pScreen, CreateGC, XAACreateGC);
return ret;
}
-
static void
-XAAValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-){
+XAAValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
+{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
XAA_GC_FUNC_PROLOGUE(pGC);
- (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+ (*pGC->funcs->ValidateGC) (pGC, changes, pDraw);
- if((changes & GCPlaneMask) &&
- ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) ==
- infoRec->FullPlanemasks[pGC->depth - 1]))
- {
- pGC->planemask = ~0;
+ if ((changes & GCPlaneMask) &&
+ ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) ==
+ infoRec->FullPlanemasks[pGC->depth - 1])) {
+ pGC->planemask = ~0;
}
- if(pGC->depth != 32) {
- /* 0xffffffff is reserved for transparency */
- if(pGC->bgPixel == 0xffffffff)
- pGC->bgPixel = 0x7fffffff;
- if(pGC->fgPixel == 0xffffffff)
- pGC->fgPixel = 0x7fffffff;
+ if (pGC->depth != 32) {
+ /* 0xffffffff is reserved for transparency */
+ if (pGC->bgPixel == 0xffffffff)
+ pGC->bgPixel = 0x7fffffff;
+ if (pGC->fgPixel == 0xffffffff)
+ pGC->fgPixel = 0x7fffffff;
}
- if((pDraw->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDraw)){
- pGCPriv->flags = OPS_ARE_PIXMAP;
+ if ((pDraw->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDraw)) {
+ pGCPriv->flags = OPS_ARE_PIXMAP;
pGCPriv->changes |= changes;
- /* make sure we're not using videomemory pixmaps to render
- onto system memory drawables */
+ /* make sure we're not using videomemory pixmaps to render
+ onto system memory drawables */
- if((pGC->fillStyle == FillTiled) &&
- IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
- !OFFSCREEN_PIXMAP_LOCKED(pGC->tile.pixmap)) {
+ if ((pGC->fillStyle == FillTiled) &&
+ IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
+ !OFFSCREEN_PIXMAP_LOCKED(pGC->tile.pixmap)) {
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
- FBAreaPtr area = pPriv->offscreenArea;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ FBAreaPtr area = pPriv->offscreenArea;
- XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
- xf86FreeOffscreenArea(area);
- }
- }
- else if(!infoRec->pScrn->vtSema && (pDraw->type == DRAWABLE_WINDOW)) {
- pGCPriv->flags = 0;
+ XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
+ xf86FreeOffscreenArea(area);
+ }
+ }
+ else if (!infoRec->pScrn->vtSema && (pDraw->type == DRAWABLE_WINDOW)) {
+ pGCPriv->flags = 0;
pGCPriv->changes |= changes;
}
else {
- if(!(pGCPriv->flags & OPS_ARE_ACCEL)) {
- changes |= pGCPriv->changes;
- pGCPriv->changes = 0;
- }
- pGCPriv->flags = OPS_ARE_ACCEL;
+ if (!(pGCPriv->flags & OPS_ARE_ACCEL)) {
+ changes |= pGCPriv->changes;
+ pGCPriv->changes = 0;
+ }
+ pGCPriv->flags = OPS_ARE_ACCEL;
#if 1
- /* Ugh. If we can't use the blitter on offscreen pixmaps used
- as tiles, then we need to move them out as cfb can't handle
- tiles with non-zero origins */
+ /* Ugh. If we can't use the blitter on offscreen pixmaps used
+ as tiles, then we need to move them out as cfb can't handle
+ tiles with non-zero origins */
- if((pGC->fillStyle == FillTiled) &&
- IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
- (DO_PIXMAP_COPY != (*infoRec->TiledFillChooser)(pGC))) {
+ if ((pGC->fillStyle == FillTiled) &&
+ IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
+ (DO_PIXMAP_COPY != (*infoRec->TiledFillChooser) (pGC))) {
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
- FBAreaPtr area = pPriv->offscreenArea;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ FBAreaPtr area = pPriv->offscreenArea;
- XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
- xf86FreeOffscreenArea(area);
- }
+ XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
+ xf86FreeOffscreenArea(area);
+ }
#endif
}
XAA_GC_FUNC_EPILOGUE(pGC);
- if(!(pGCPriv->flags & OPS_ARE_ACCEL)) return;
+ if (!(pGCPriv->flags & OPS_ARE_ACCEL))
+ return;
+
+ if ((changes & GCTile) && !pGC->tileIsPixel && pGC->tile.pixmap) {
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
- if((changes & GCTile) && !pGC->tileIsPixel && pGC->tile.pixmap){
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
-
- if(pixPriv->flags & DIRTY) {
- pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
- pGC->tile.pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
+ if (pixPriv->flags & DIRTY) {
+ pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
+ pGC->tile.pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
}
- if((changes & GCStipple) && pGC->stipple){
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
-
- if(pixPriv->flags & DIRTY) {
- pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
- pGC->stipple->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
+ if ((changes & GCStipple) && pGC->stipple) {
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+
+ if (pixPriv->flags & DIRTY) {
+ pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
+ pGC->stipple->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
}
/* If our Ops are still the default ones we need to allocate new ones */
- if(pGC->ops == &XAAFallbackOps) {
- if(!(pGCPriv->XAAOps = malloc(sizeof(GCOps)))) {
- pGCPriv->XAAOps = &XAAFallbackOps;
- return;
- }
- /* make a modifiable copy of the default ops */
- memcpy(pGCPriv->XAAOps, &XAAFallbackOps, sizeof(GCOps));
- pGC->ops = pGCPriv->XAAOps;
- changes = ~0;
+ if (pGC->ops == &XAAFallbackOps) {
+ if (!(pGCPriv->XAAOps = malloc(sizeof(GCOps)))) {
+ pGCPriv->XAAOps = &XAAFallbackOps;
+ return;
+ }
+ /* make a modifiable copy of the default ops */
+ memcpy(pGCPriv->XAAOps, &XAAFallbackOps, sizeof(GCOps));
+ pGC->ops = pGCPriv->XAAOps;
+ changes = ~0;
}
- if(!changes) return;
+ if (!changes)
+ return;
- if((changes & GCDashList) && infoRec->ComputeDash)
- infoRec->ComputeDash(pGC);
+ if ((changes & GCDashList) && infoRec->ComputeDash)
+ infoRec->ComputeDash(pGC);
- if(changes & infoRec->FillSpansMask)
- (*infoRec->ValidateFillSpans)(pGC, changes, pDraw);
+ if (changes & infoRec->FillSpansMask)
+ (*infoRec->ValidateFillSpans) (pGC, changes, pDraw);
- if(changes & infoRec->SetSpansMask)
- (*infoRec->ValidateSetSpans)(pGC, changes, pDraw);
+ if (changes & infoRec->SetSpansMask)
+ (*infoRec->ValidateSetSpans) (pGC, changes, pDraw);
- if(changes & infoRec->PutImageMask)
- (*infoRec->ValidatePutImage)(pGC, changes, pDraw);
+ if (changes & infoRec->PutImageMask)
+ (*infoRec->ValidatePutImage) (pGC, changes, pDraw);
- if(changes & infoRec->CopyAreaMask)
- (*infoRec->ValidateCopyArea)(pGC, changes, pDraw);
+ if (changes & infoRec->CopyAreaMask)
+ (*infoRec->ValidateCopyArea) (pGC, changes, pDraw);
- if(changes & infoRec->CopyPlaneMask)
- (*infoRec->ValidateCopyPlane)(pGC, changes, pDraw);
+ if (changes & infoRec->CopyPlaneMask)
+ (*infoRec->ValidateCopyPlane) (pGC, changes, pDraw);
- if(changes & infoRec->PolyPointMask)
- (*infoRec->ValidatePolyPoint)(pGC, changes, pDraw);
+ if (changes & infoRec->PolyPointMask)
+ (*infoRec->ValidatePolyPoint) (pGC, changes, pDraw);
- if(changes & infoRec->PolylinesMask)
- (*infoRec->ValidatePolylines)(pGC, changes, pDraw);
+ if (changes & infoRec->PolylinesMask)
+ (*infoRec->ValidatePolylines) (pGC, changes, pDraw);
- if(changes & infoRec->PolySegmentMask)
- (*infoRec->ValidatePolySegment)(pGC, changes, pDraw);
+ if (changes & infoRec->PolySegmentMask)
+ (*infoRec->ValidatePolySegment) (pGC, changes, pDraw);
- if(changes & infoRec->PolyRectangleMask)
- (*infoRec->ValidatePolyRectangle)(pGC, changes, pDraw);
+ if (changes & infoRec->PolyRectangleMask)
+ (*infoRec->ValidatePolyRectangle) (pGC, changes, pDraw);
- if(changes & infoRec->PolyArcMask)
- (*infoRec->ValidatePolyArc)(pGC, changes, pDraw);
+ if (changes & infoRec->PolyArcMask)
+ (*infoRec->ValidatePolyArc) (pGC, changes, pDraw);
- if(changes & infoRec->FillPolygonMask)
- (*infoRec->ValidateFillPolygon)(pGC, changes, pDraw);
+ if (changes & infoRec->FillPolygonMask)
+ (*infoRec->ValidateFillPolygon) (pGC, changes, pDraw);
- if(changes & infoRec->PolyFillRectMask)
- (*infoRec->ValidatePolyFillRect)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolyFillArcMask)
- (*infoRec->ValidatePolyFillArc)(pGC, changes, pDraw);
+ if (changes & infoRec->PolyFillRectMask)
+ (*infoRec->ValidatePolyFillRect) (pGC, changes, pDraw);
- if(changes & infoRec->PolyGlyphBltMask)
- (*infoRec->ValidatePolyGlyphBlt)(pGC, changes, pDraw);
+ if (changes & infoRec->PolyFillArcMask)
+ (*infoRec->ValidatePolyFillArc) (pGC, changes, pDraw);
- if(changes & infoRec->ImageGlyphBltMask)
- (*infoRec->ValidateImageGlyphBlt)(pGC, changes, pDraw);
+ if (changes & infoRec->PolyGlyphBltMask)
+ (*infoRec->ValidatePolyGlyphBlt) (pGC, changes, pDraw);
- if(changes & infoRec->PolyText8Mask)
- (*infoRec->ValidatePolyText8)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolyText16Mask)
- (*infoRec->ValidatePolyText16)(pGC, changes, pDraw);
+ if (changes & infoRec->ImageGlyphBltMask)
+ (*infoRec->ValidateImageGlyphBlt) (pGC, changes, pDraw);
- if(changes & infoRec->ImageText8Mask)
- (*infoRec->ValidateImageText8)(pGC, changes, pDraw);
-
- if(changes & infoRec->ImageText16Mask)
- (*infoRec->ValidateImageText16)(pGC, changes, pDraw);
-
- if(changes & infoRec->PushPixelsMask)
- (*infoRec->ValidatePushPixels)(pGC, changes, pDraw);
-}
+ if (changes & infoRec->PolyText8Mask)
+ (*infoRec->ValidatePolyText8) (pGC, changes, pDraw);
+ if (changes & infoRec->PolyText16Mask)
+ (*infoRec->ValidatePolyText16) (pGC, changes, pDraw);
+
+ if (changes & infoRec->ImageText8Mask)
+ (*infoRec->ValidateImageText8) (pGC, changes, pDraw);
+
+ if (changes & infoRec->ImageText16Mask)
+ (*infoRec->ValidateImageText16) (pGC, changes, pDraw);
+
+ if (changes & infoRec->PushPixelsMask)
+ (*infoRec->ValidatePushPixels) (pGC, changes, pDraw);
+}
static void
XAADestroyGC(GCPtr pGC)
{
- XAA_GC_FUNC_PROLOGUE (pGC);
-
- if(pGCPriv->XAAOps != &XAAFallbackOps)
- free(pGCPriv->XAAOps);
+ XAA_GC_FUNC_PROLOGUE(pGC);
+
+ if (pGCPriv->XAAOps != &XAAFallbackOps)
+ free(pGCPriv->XAAOps);
free(pGCPriv->DashPattern);
pGCPriv->flags = 0;
- (*pGC->funcs->DestroyGC)(pGC);
- XAA_GC_FUNC_EPILOGUE (pGC);
+ (*pGC->funcs->DestroyGC) (pGC);
+ XAA_GC_FUNC_EPILOGUE(pGC);
}
static void
-XAAChangeGC (
- GCPtr pGC,
- unsigned long mask
-)
+XAAChangeGC(GCPtr pGC, unsigned long mask)
{
- XAA_GC_FUNC_PROLOGUE (pGC);
+ XAA_GC_FUNC_PROLOGUE(pGC);
(*pGC->funcs->ChangeGC) (pGC, mask);
- XAA_GC_FUNC_EPILOGUE (pGC);
+ XAA_GC_FUNC_EPILOGUE(pGC);
- /* we have to assume that shared memory pixmaps are dirty
- because we can't wrap all operations on them */
+ /* we have to assume that shared memory pixmaps are dirty
+ because we can't wrap all operations on them */
- if((mask & GCTile) && !pGC->tileIsPixel &&
- PIXMAP_IS_SHARED(pGC->tile.pixmap))
- {
- XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
- pPixPriv->flags |= DIRTY;
+ if ((mask & GCTile) && !pGC->tileIsPixel &&
+ PIXMAP_IS_SHARED(pGC->tile.pixmap)) {
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+
+ pPixPriv->flags |= DIRTY;
}
- if((mask & GCStipple) && PIXMAP_IS_SHARED(pGC->stipple)){
- XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
- pPixPriv->flags |= DIRTY;
+ if ((mask & GCStipple) && PIXMAP_IS_SHARED(pGC->stipple)) {
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+
+ pPixPriv->flags |= DIRTY;
}
}
static void
-XAACopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst)
+XAACopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
{
- XAA_GC_FUNC_PROLOGUE (pGCDst);
+ XAA_GC_FUNC_PROLOGUE(pGCDst);
(*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- XAA_GC_FUNC_EPILOGUE (pGCDst);
+ XAA_GC_FUNC_EPILOGUE(pGCDst);
}
+
static void
-XAAChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects )
+XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
{
- XAA_GC_FUNC_PROLOGUE (pGC);
+ XAA_GC_FUNC_PROLOGUE(pGC);
(*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- XAA_GC_FUNC_EPILOGUE (pGC);
+ XAA_GC_FUNC_EPILOGUE(pGC);
}
static void
XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc)
{
- XAA_GC_FUNC_PROLOGUE (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- XAA_GC_FUNC_EPILOGUE (pgcDst);
+ XAA_GC_FUNC_PROLOGUE(pgcDst);
+ (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
+ XAA_GC_FUNC_EPILOGUE(pgcDst);
}
static void
XAADestroyClip(GCPtr pGC)
{
- XAA_GC_FUNC_PROLOGUE (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- XAA_GC_FUNC_EPILOGUE (pGC);
+ XAA_GC_FUNC_PROLOGUE(pGC);
+ (*pGC->funcs->DestroyClip) (pGC);
+ XAA_GC_FUNC_EPILOGUE(pGC);
}
-
-/**** Pixmap Wrappers ****/
-
+/**** Pixmap Wrappers ****/
static void
-XAAFillSpansPixmap(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+XAAFillSpansPixmap(DrawablePtr pDraw,
+ GC * pGC,
+ int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)
+{
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
static void
-XAASetSpansPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- register DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted
-){
+XAASetSpansPixmap(DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth, int nspans, int fSorted)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
static void
-XAAPutImagePixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-){
+XAAPutImagePixmap(DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad, int format, char *pImage)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
+ (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
static RegionPtr
-XAACopyAreaPixmap(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
+XAACopyAreaPixmap(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC * pGC,
+ int srcx, int srcy, int width, int height, int dstx, int dsty)
+{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
RegionPtr ret;
- if(infoRec->pScrn->vtSema &&
- ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc)))
- {
- if(infoRec->ReadPixmap && (pGC->alu == GXcopy) &&
- (pSrc->bitsPerPixel == pDst->bitsPerPixel) &&
- ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1])
- == infoRec->FullPlanemasks[pSrc->depth - 1]))
- {
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst));
- pixPriv->flags |= DIRTY;
-
- return (XAABitBlt( pSrc, pDst, pGC,
- srcx, srcy, width, height, dstx, dsty,
- XAADoImageRead, 0L));
- } else
- if(infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- }
+ if (infoRec->pScrn->vtSema &&
+ ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) {
+ if (infoRec->ReadPixmap && (pGC->alu == GXcopy) &&
+ (pSrc->bitsPerPixel == pDst->bitsPerPixel) &&
+ ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1])
+ == infoRec->FullPlanemasks[pSrc->depth - 1])) {
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr) (pDst));
+
+ pixPriv->flags |= DIRTY;
+
+ return (XAABitBlt(pSrc, pDst, pGC,
+ srcx, srcy, width, height, dstx, dsty,
+ XAADoImageRead, 0L));
+ }
+ else if (infoRec->NeedToSync) {
+ (*infoRec->Sync) (infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ }
{
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
+ ret = (*pGC->ops->CopyArea) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx,
+ dsty);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
}
return ret;
}
static RegionPtr
-XAACopyPlanePixmap(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
+XAACopyPlanePixmap(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
+{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
RegionPtr ret;
XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
- if(infoRec->pScrn->vtSema &&
- ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))){
- if(infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- }
+ if (infoRec->pScrn->vtSema &&
+ ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) {
+ if (infoRec->NeedToSync) {
+ (*infoRec->Sync) (infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ }
- ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ ret = (*pGC->ops->CopyPlane) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ bitPlane);
XAA_PIXMAP_OP_EPILOGUE(pGC);
return ret;
}
static void
-XAAPolyPointPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit
-){
+XAAPolyPointPixmap(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int npt, xPoint * pptInit)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
+ (*pGC->ops->PolyPoint) (pDraw, pGC, mode, npt, pptInit);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
-
static void
-XAAPolylinesPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-){
+XAAPolylinesPixmap(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
+ (*pGC->ops->Polylines) (pDraw, pGC, mode, npt, pptInit);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
-static void
-XAAPolySegmentPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
+static void
+XAAPolySegmentPixmap(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSeg)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
+ (*pGC->ops->PolySegment) (pDraw, pGC, nseg, pSeg);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
static void
-XAAPolyRectanglePixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
+XAAPolyRectanglePixmap(DrawablePtr pDraw,
+ GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+ (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
static void
-XAAPolyArcPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
+XAAPolyArcPixmap(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
+ (*pGC->ops->PolyArc) (pDraw, pGC, narcs, parcs);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
static void
-XAAFillPolygonPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
+XAAFillPolygonPixmap(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
-
-static void
-XAAPolyFillRectPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
+static void
+XAAPolyFillRectPixmap(DrawablePtr pDraw,
+ GCPtr pGC, int nrectFill, xRectangle *prectInit)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, nrectFill, prectInit);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
-
static void
-XAAPolyFillArcPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
+XAAPolyFillArcPixmap(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
+ (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, parcs);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
static int
-XAAPolyText8Pixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
+XAAPolyText8Pixmap(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
int ret;
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+ ret = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars);
XAA_PIXMAP_OP_EPILOGUE(pGC);
return ret;
}
static int
-XAAPolyText16Pixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
+XAAPolyText16Pixmap(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
+{
int ret;
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+ ret = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars);
XAA_PIXMAP_OP_EPILOGUE(pGC);
return ret;
}
static void
-XAAImageText8Pixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
+XAAImageText8Pixmap(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+ (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
+
static void
-XAAImageText16Pixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
+XAAImageText16Pixmap(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+ (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
-
static void
-XAAImageGlyphBltPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
+XAAImageGlyphBltPixmap(DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
+ (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph,
+ ppci, pglyphBase);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
static void
-XAAPolyGlyphBltPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
+XAAPolyGlyphBltPixmap(DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
+ (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph,
+ ppci, pglyphBase);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
static void
-XAAPushPixelsPixmap(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg
-){
+XAAPushPixelsPixmap(GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg)
+{
XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
XAA_PIXMAP_OP_EPILOGUE(pGC);
}
GCOps XAAPixmapOps = {
- XAAFillSpansPixmap, XAASetSpansPixmap,
- XAAPutImagePixmap, XAACopyAreaPixmap,
- XAACopyPlanePixmap, XAAPolyPointPixmap,
- XAAPolylinesPixmap, XAAPolySegmentPixmap,
- XAAPolyRectanglePixmap, XAAPolyArcPixmap,
- XAAFillPolygonPixmap, XAAPolyFillRectPixmap,
- XAAPolyFillArcPixmap, XAAPolyText8Pixmap,
- XAAPolyText16Pixmap, XAAImageText8Pixmap,
- XAAImageText16Pixmap, XAAImageGlyphBltPixmap,
+ XAAFillSpansPixmap, XAASetSpansPixmap,
+ XAAPutImagePixmap, XAACopyAreaPixmap,
+ XAACopyPlanePixmap, XAAPolyPointPixmap,
+ XAAPolylinesPixmap, XAAPolySegmentPixmap,
+ XAAPolyRectanglePixmap, XAAPolyArcPixmap,
+ XAAFillPolygonPixmap, XAAPolyFillRectPixmap,
+ XAAPolyFillArcPixmap, XAAPolyText8Pixmap,
+ XAAPolyText16Pixmap, XAAImageText8Pixmap,
+ XAAImageText16Pixmap, XAAImageGlyphBltPixmap,
XAAPolyGlyphBltPixmap, XAAPushPixelsPixmap,
};
diff --git a/xorg-server/hw/xfree86/xaa/xaaGCmisc.c b/xorg-server/hw/xfree86/xaa/xaaGCmisc.c
index 5823cc064..ca69aae74 100644
--- a/xorg-server/hw/xfree86/xaa/xaaGCmisc.c
+++ b/xorg-server/hw/xfree86/xaa/xaaGCmisc.c
@@ -20,162 +20,149 @@
#include "pixmapstr.h"
void
-XAAValidateCopyArea(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw )
+XAAValidateCopyArea(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(infoRec->CopyArea &&
- CHECK_PLANEMASK(pGC,infoRec->CopyAreaFlags) &&
- CHECK_ROP(pGC,infoRec->CopyAreaFlags) &&
- CHECK_ROPSRC(pGC,infoRec->CopyAreaFlags)
- )
- pGC->ops->CopyArea = infoRec->CopyArea;
- else
- pGC->ops->CopyArea = XAAFallbackOps.CopyArea;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if (infoRec->CopyArea &&
+ CHECK_PLANEMASK(pGC, infoRec->CopyAreaFlags) &&
+ CHECK_ROP(pGC, infoRec->CopyAreaFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->CopyAreaFlags)
+ )
+ pGC->ops->CopyArea = infoRec->CopyArea;
+ else
+ pGC->ops->CopyArea = XAAFallbackOps.CopyArea;
}
void
-XAAValidatePutImage(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw )
+XAAValidatePutImage(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(infoRec->PutImage &&
- CHECK_PLANEMASK(pGC,infoRec->PutImageFlags) &&
- CHECK_ROP(pGC,infoRec->PutImageFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PutImageFlags) &&
- CHECK_COLORS(pGC,infoRec->PutImageFlags)
- )
- pGC->ops->PutImage = infoRec->PutImage;
- else
- pGC->ops->PutImage = XAAFallbackOps.PutImage;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if (infoRec->PutImage &&
+ CHECK_PLANEMASK(pGC, infoRec->PutImageFlags) &&
+ CHECK_ROP(pGC, infoRec->PutImageFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PutImageFlags) &&
+ CHECK_COLORS(pGC, infoRec->PutImageFlags)
+ )
+ pGC->ops->PutImage = infoRec->PutImage;
+ else
+ pGC->ops->PutImage = XAAFallbackOps.PutImage;
}
void
-XAAValidateCopyPlane(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw )
+XAAValidateCopyPlane(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(infoRec->CopyPlane &&
- CHECK_PLANEMASK(pGC,infoRec->CopyPlaneFlags) &&
- CHECK_ROP(pGC,infoRec->CopyPlaneFlags) &&
- CHECK_ROPSRC(pGC,infoRec->CopyPlaneFlags) &&
- CHECK_COLORS(pGC,infoRec->CopyPlaneFlags)
- )
- pGC->ops->CopyPlane = infoRec->CopyPlane;
- else
- pGC->ops->CopyPlane = XAAFallbackOps.CopyPlane;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if (infoRec->CopyPlane &&
+ CHECK_PLANEMASK(pGC, infoRec->CopyPlaneFlags) &&
+ CHECK_ROP(pGC, infoRec->CopyPlaneFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->CopyPlaneFlags) &&
+ CHECK_COLORS(pGC, infoRec->CopyPlaneFlags)
+ )
+ pGC->ops->CopyPlane = infoRec->CopyPlane;
+ else
+ pGC->ops->CopyPlane = XAAFallbackOps.CopyPlane;
}
void
-XAAValidatePushPixels(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw )
+XAAValidatePushPixels(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(infoRec->PushPixelsSolid &&
- (pGC->fillStyle == FillSolid) &&
- CHECK_PLANEMASK(pGC,infoRec->PushPixelsFlags) &&
- CHECK_ROP(pGC,infoRec->PushPixelsFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PushPixelsFlags) &&
- CHECK_FG(pGC,infoRec->PushPixelsFlags) &&
- (!(infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY) ||
- (pGC->alu == GXcopy))
- )
- pGC->ops->PushPixels = infoRec->PushPixelsSolid;
- else
- pGC->ops->PushPixels = XAAFallbackOps.PushPixels;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if (infoRec->PushPixelsSolid &&
+ (pGC->fillStyle == FillSolid) &&
+ CHECK_PLANEMASK(pGC, infoRec->PushPixelsFlags) &&
+ CHECK_ROP(pGC, infoRec->PushPixelsFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PushPixelsFlags) &&
+ CHECK_FG(pGC, infoRec->PushPixelsFlags) &&
+ (!(infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY) ||
+ (pGC->alu == GXcopy))
+ )
+ pGC->ops->PushPixels = infoRec->PushPixelsSolid;
+ else
+ pGC->ops->PushPixels = XAAFallbackOps.PushPixels;
}
-
/* We make the assumption that the FillSpans, PolyFillRect, FillPolygon
and PolyFillArc functions are linked in a way that they all have
the same rop/color/planemask restrictions. If the driver provides
a GC level replacement for these, it will need to supply a new
Validate functions if it breaks this assumption */
-
void
-XAAValidateFillSpans(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw )
+XAAValidateFillSpans(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(pGC->fillStyle != FillTiled) changes &= ~GCTile;
- if((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillSolid))
- changes &= ~GCStipple;
- if(!changes) return;
-
-
- pGC->ops->FillSpans = XAAFallbackOps.FillSpans;
- pGC->ops->PolyFillRect = XAAFallbackOps.PolyFillRect;
- pGC->ops->FillPolygon = XAAFallbackOps.FillPolygon;
- pGC->ops->PolyFillArc = XAAFallbackOps.PolyFillArc;
-
- switch(pGC->fillStyle){
- case FillSolid:
- if(infoRec->FillSpansSolid &&
- CHECK_PLANEMASK(pGC,infoRec->FillSpansSolidFlags) &&
- CHECK_ROP(pGC,infoRec->FillSpansSolidFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillSpansSolidFlags) &&
- CHECK_FG(pGC,infoRec->FillSpansSolidFlags)
- ) {
- pGC->ops->FillSpans = infoRec->FillSpansSolid;
- pGC->ops->PolyFillRect = infoRec->PolyFillRectSolid;
- pGC->ops->FillPolygon = infoRec->FillPolygonSolid;
- pGC->ops->PolyFillArc = infoRec->PolyFillArcSolid;
- }
- break;
- /* The [Stippled/OpaqueStippled/Tiled]FillChooser
- functions do the validating */
- case FillStippled:
- if(infoRec->FillSpansStippled) {
- pGC->ops->FillSpans = infoRec->FillSpansStippled;
- pGC->ops->PolyFillRect = infoRec->PolyFillRectStippled;
- if(infoRec->FillPolygonStippled)
- pGC->ops->FillPolygon = infoRec->FillPolygonStippled;
- else pGC->ops->FillPolygon = miFillPolygon;
- pGC->ops->PolyFillArc = miPolyFillArc;
- }
- break;
- case FillOpaqueStippled:
- if(infoRec->FillSpansOpaqueStippled) {
- pGC->ops->FillSpans = infoRec->FillSpansOpaqueStippled;
- pGC->ops->PolyFillRect = infoRec->PolyFillRectOpaqueStippled;
- if(infoRec->FillPolygonOpaqueStippled)
- pGC->ops->FillPolygon = infoRec->FillPolygonOpaqueStippled;
- else pGC->ops->FillPolygon = miFillPolygon;
- pGC->ops->PolyFillArc = miPolyFillArc;
- }
- break;
- case FillTiled:
- if(infoRec->FillSpansTiled) {
- pGC->ops->FillSpans = infoRec->FillSpansTiled;
- pGC->ops->PolyFillRect = infoRec->PolyFillRectTiled;
- if(infoRec->FillPolygonTiled)
- pGC->ops->FillPolygon = infoRec->FillPolygonTiled;
- else pGC->ops->FillPolygon = miFillPolygon;
- pGC->ops->PolyFillArc = miPolyFillArc;
- }
- break;
- default: return;
- }
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if (pGC->fillStyle != FillTiled)
+ changes &= ~GCTile;
+ if ((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillSolid))
+ changes &= ~GCStipple;
+ if (!changes)
+ return;
+
+ pGC->ops->FillSpans = XAAFallbackOps.FillSpans;
+ pGC->ops->PolyFillRect = XAAFallbackOps.PolyFillRect;
+ pGC->ops->FillPolygon = XAAFallbackOps.FillPolygon;
+ pGC->ops->PolyFillArc = XAAFallbackOps.PolyFillArc;
+
+ switch (pGC->fillStyle) {
+ case FillSolid:
+ if (infoRec->FillSpansSolid &&
+ CHECK_PLANEMASK(pGC, infoRec->FillSpansSolidFlags) &&
+ CHECK_ROP(pGC, infoRec->FillSpansSolidFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillSpansSolidFlags) &&
+ CHECK_FG(pGC, infoRec->FillSpansSolidFlags)
+ ) {
+ pGC->ops->FillSpans = infoRec->FillSpansSolid;
+ pGC->ops->PolyFillRect = infoRec->PolyFillRectSolid;
+ pGC->ops->FillPolygon = infoRec->FillPolygonSolid;
+ pGC->ops->PolyFillArc = infoRec->PolyFillArcSolid;
+ }
+ break;
+ /* The [Stippled/OpaqueStippled/Tiled]FillChooser
+ functions do the validating */
+ case FillStippled:
+ if (infoRec->FillSpansStippled) {
+ pGC->ops->FillSpans = infoRec->FillSpansStippled;
+ pGC->ops->PolyFillRect = infoRec->PolyFillRectStippled;
+ if (infoRec->FillPolygonStippled)
+ pGC->ops->FillPolygon = infoRec->FillPolygonStippled;
+ else
+ pGC->ops->FillPolygon = miFillPolygon;
+ pGC->ops->PolyFillArc = miPolyFillArc;
+ }
+ break;
+ case FillOpaqueStippled:
+ if (infoRec->FillSpansOpaqueStippled) {
+ pGC->ops->FillSpans = infoRec->FillSpansOpaqueStippled;
+ pGC->ops->PolyFillRect = infoRec->PolyFillRectOpaqueStippled;
+ if (infoRec->FillPolygonOpaqueStippled)
+ pGC->ops->FillPolygon = infoRec->FillPolygonOpaqueStippled;
+ else
+ pGC->ops->FillPolygon = miFillPolygon;
+ pGC->ops->PolyFillArc = miPolyFillArc;
+ }
+ break;
+ case FillTiled:
+ if (infoRec->FillSpansTiled) {
+ pGC->ops->FillSpans = infoRec->FillSpansTiled;
+ pGC->ops->PolyFillRect = infoRec->PolyFillRectTiled;
+ if (infoRec->FillPolygonTiled)
+ pGC->ops->FillPolygon = infoRec->FillPolygonTiled;
+ else
+ pGC->ops->FillPolygon = miFillPolygon;
+ pGC->ops->PolyFillArc = miPolyFillArc;
+ }
+ break;
+ default:
+ return;
+ }
}
-
/* We make the assumption that these Text8/16 and GlyphBlt functions
are linked in a way that they all have the same rop/color/planemask
restrictions. If the driver provides a GC level replacement for
@@ -183,247 +170,243 @@ XAAValidateFillSpans(
this assumption */
void
-XAAValidatePolyGlyphBlt(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw )
+XAAValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- Bool BigFont = FALSE;
-
- pGC->ops->PolyText8 = XAAFallbackOps.PolyText8;
- pGC->ops->PolyText16 = XAAFallbackOps.PolyText16;
- pGC->ops->PolyGlyphBlt = XAAFallbackOps.PolyGlyphBlt;
-
- if(!pGC->font) return;
- if(pGC->fillStyle != FillSolid) return;
-
- if((FONTMAXBOUNDS(pGC->font, rightSideBearing) -
- FONTMINBOUNDS(pGC->font, leftSideBearing) > 32))
- BigFont = TRUE;
-
- /* no funny business */
- if((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) ||
- ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0))
- return;
-
- /* Check for TE Fonts */
- if(!TERMINALFONT(pGC->font) || BigFont) {
- if(infoRec->PolyGlyphBltNonTE &&
- CHECK_PLANEMASK(pGC,infoRec->PolyGlyphBltNonTEFlags) &&
- CHECK_ROP(pGC,infoRec->PolyGlyphBltNonTEFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PolyGlyphBltNonTEFlags) &&
- CHECK_FG(pGC,infoRec->PolyGlyphBltNonTEFlags) &&
- (!(infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY) ||
- (pGC->alu == GXcopy))
- ) {
- pGC->ops->PolyText8 = infoRec->PolyText8NonTE;
- pGC->ops->PolyText16 = infoRec->PolyText16NonTE;
- pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltNonTE;
- }
- } else {
- if(infoRec->PolyGlyphBltTE &&
- CHECK_PLANEMASK(pGC,infoRec->PolyGlyphBltTEFlags) &&
- CHECK_ROP(pGC,infoRec->PolyGlyphBltTEFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PolyGlyphBltNonTEFlags) &&
- CHECK_FG(pGC,infoRec->PolyGlyphBltTEFlags) &&
- (!(infoRec->PolyGlyphBltTEFlags & TRANSPARENCY_GXCOPY_ONLY) ||
- (pGC->alu == GXcopy))
- ) {
- pGC->ops->PolyText8 = infoRec->PolyText8TE;
- pGC->ops->PolyText16 = infoRec->PolyText16TE;
- pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltTE;
- }
- }
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ Bool BigFont = FALSE;
+
+ pGC->ops->PolyText8 = XAAFallbackOps.PolyText8;
+ pGC->ops->PolyText16 = XAAFallbackOps.PolyText16;
+ pGC->ops->PolyGlyphBlt = XAAFallbackOps.PolyGlyphBlt;
+
+ if (!pGC->font)
+ return;
+ if (pGC->fillStyle != FillSolid)
+ return;
+
+ if ((FONTMAXBOUNDS(pGC->font, rightSideBearing) -
+ FONTMINBOUNDS(pGC->font, leftSideBearing) > 32))
+ BigFont = TRUE;
+
+ /* no funny business */
+ if ((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) ||
+ ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0))
+ return;
+
+ /* Check for TE Fonts */
+ if (!TERMINALFONT(pGC->font) || BigFont) {
+ if (infoRec->PolyGlyphBltNonTE &&
+ CHECK_PLANEMASK(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
+ CHECK_ROP(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
+ CHECK_FG(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
+ (!(infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY) ||
+ (pGC->alu == GXcopy))
+ ) {
+ pGC->ops->PolyText8 = infoRec->PolyText8NonTE;
+ pGC->ops->PolyText16 = infoRec->PolyText16NonTE;
+ pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltNonTE;
+ }
+ }
+ else {
+ if (infoRec->PolyGlyphBltTE &&
+ CHECK_PLANEMASK(pGC, infoRec->PolyGlyphBltTEFlags) &&
+ CHECK_ROP(pGC, infoRec->PolyGlyphBltTEFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
+ CHECK_FG(pGC, infoRec->PolyGlyphBltTEFlags) &&
+ (!(infoRec->PolyGlyphBltTEFlags & TRANSPARENCY_GXCOPY_ONLY) ||
+ (pGC->alu == GXcopy))
+ ) {
+ pGC->ops->PolyText8 = infoRec->PolyText8TE;
+ pGC->ops->PolyText16 = infoRec->PolyText16TE;
+ pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltTE;
+ }
+ }
}
void
-XAAValidateImageGlyphBlt(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw )
+XAAValidateImageGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- Bool BigFont = FALSE;
-
- pGC->ops->ImageText8 = XAAFallbackOps.ImageText8;
- pGC->ops->ImageText16 = XAAFallbackOps.ImageText16;
- pGC->ops->ImageGlyphBlt = XAAFallbackOps.ImageGlyphBlt;
-
- if(!pGC->font) return;
-
- if((FONTMAXBOUNDS(pGC->font, rightSideBearing) -
- FONTMINBOUNDS(pGC->font, leftSideBearing) > 32))
- BigFont = TRUE;
-
- /* no funny business */
- if((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) ||
- ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0))
- return;
-
-
- /* Check for TE Fonts */
- if(!TERMINALFONT(pGC->font) || BigFont || (pGC->depth == 32)) {
- if(infoRec->ImageGlyphBltNonTE &&
- CHECK_PLANEMASK(pGC,infoRec->ImageGlyphBltNonTEFlags) &&
- CHECK_FG(pGC,infoRec->ImageGlyphBltNonTEFlags) &&
- infoRec->SetupForSolidFill &&
- CHECK_PLANEMASK(pGC,infoRec->SolidFillFlags) &&
- CHECK_BG(pGC,infoRec->SolidFillFlags))
- {
- pGC->ops->ImageText8 = infoRec->ImageText8NonTE;
- pGC->ops->ImageText16 = infoRec->ImageText16NonTE;
- pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltNonTE;
- }
- } else if(infoRec->ImageGlyphBltTE &&
- CHECK_PLANEMASK(pGC,infoRec->ImageGlyphBltTEFlags)){
- if(!(infoRec->ImageGlyphBltTEFlags & TRANSPARENCY_ONLY) &&
- CHECK_COLORS(pGC,infoRec->ImageGlyphBltTEFlags))
- {
- pGC->ops->ImageText8 = infoRec->ImageText8TE;
- pGC->ops->ImageText16 = infoRec->ImageText16TE;
- pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE;
- } else {
- if(CHECK_FG(pGC,infoRec->ImageGlyphBltTEFlags) &&
- infoRec->SetupForSolidFill &&
- CHECK_PLANEMASK(pGC,infoRec->SolidFillFlags) &&
- CHECK_BG(pGC,infoRec->SolidFillFlags))
- {
- pGC->ops->ImageText8 = infoRec->ImageText8TE;
- pGC->ops->ImageText16 = infoRec->ImageText16TE;
- pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE;
- }
- }
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ Bool BigFont = FALSE;
+
+ pGC->ops->ImageText8 = XAAFallbackOps.ImageText8;
+ pGC->ops->ImageText16 = XAAFallbackOps.ImageText16;
+ pGC->ops->ImageGlyphBlt = XAAFallbackOps.ImageGlyphBlt;
+
+ if (!pGC->font)
+ return;
+
+ if ((FONTMAXBOUNDS(pGC->font, rightSideBearing) -
+ FONTMINBOUNDS(pGC->font, leftSideBearing) > 32))
+ BigFont = TRUE;
+
+ /* no funny business */
+ if ((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) ||
+ ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0))
+ return;
+
+ /* Check for TE Fonts */
+ if (!TERMINALFONT(pGC->font) || BigFont || (pGC->depth == 32)) {
+ if (infoRec->ImageGlyphBltNonTE &&
+ CHECK_PLANEMASK(pGC, infoRec->ImageGlyphBltNonTEFlags) &&
+ CHECK_FG(pGC, infoRec->ImageGlyphBltNonTEFlags) &&
+ infoRec->SetupForSolidFill &&
+ CHECK_PLANEMASK(pGC, infoRec->SolidFillFlags) &&
+ CHECK_BG(pGC, infoRec->SolidFillFlags)) {
+ pGC->ops->ImageText8 = infoRec->ImageText8NonTE;
+ pGC->ops->ImageText16 = infoRec->ImageText16NonTE;
+ pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltNonTE;
+ }
+ }
+ else if (infoRec->ImageGlyphBltTE &&
+ CHECK_PLANEMASK(pGC, infoRec->ImageGlyphBltTEFlags)) {
+ if (!(infoRec->ImageGlyphBltTEFlags & TRANSPARENCY_ONLY) &&
+ CHECK_COLORS(pGC, infoRec->ImageGlyphBltTEFlags)) {
+ pGC->ops->ImageText8 = infoRec->ImageText8TE;
+ pGC->ops->ImageText16 = infoRec->ImageText16TE;
+ pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE;
+ }
+ else {
+ if (CHECK_FG(pGC, infoRec->ImageGlyphBltTEFlags) &&
+ infoRec->SetupForSolidFill &&
+ CHECK_PLANEMASK(pGC, infoRec->SolidFillFlags) &&
+ CHECK_BG(pGC, infoRec->SolidFillFlags)) {
+ pGC->ops->ImageText8 = infoRec->ImageText8TE;
+ pGC->ops->ImageText16 = infoRec->ImageText16TE;
+ pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE;
+ }
+ }
}
}
-
void
-XAAValidatePolylines(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw )
+XAAValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
- XAAGetGCKey());
-
- if(pGC->lineStyle == LineSolid) changes &= ~GCDashList;
- if(!changes) return;
-
- pGC->ops->PolySegment = XAAFallbackOps.PolySegment;
- pGC->ops->Polylines = XAAFallbackOps.Polylines;
- pGC->ops->PolyRectangle = XAAFallbackOps.PolyRectangle;
- pGC->ops->PolyArc = XAAFallbackOps.PolyArc;
-
- if((pGC->ops->FillSpans != XAAFallbackOps.FillSpans) &&
- (pGC->lineWidth > 0)){
-
- pGC->ops->PolyArc = miPolyArc;
- pGC->ops->PolySegment = miPolySegment;
- pGC->ops->PolyRectangle = miPolyRectangle;
- if(pGC->lineStyle == LineSolid)
- pGC->ops->Polylines = miWideLine;
- else
- pGC->ops->Polylines = miWideDash;
- }
-
- if((pGC->lineWidth == 0) && (pGC->fillStyle == FillSolid)) {
-
- if(pGC->lineStyle == LineSolid) {
-
- if(infoRec->PolyRectangleThinSolid &&
- CHECK_PLANEMASK(pGC,infoRec->PolyRectangleThinSolidFlags) &&
- CHECK_ROP(pGC,infoRec->PolyRectangleThinSolidFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PolyRectangleThinSolidFlags) &&
- CHECK_FG(pGC,infoRec->PolyRectangleThinSolidFlags)) {
-
- pGC->ops->PolyRectangle = infoRec->PolyRectangleThinSolid;
- }
-
- if(infoRec->PolySegmentThinSolid &&
- CHECK_PLANEMASK(pGC,infoRec->PolySegmentThinSolidFlags) &&
- CHECK_ROP(pGC,infoRec->PolySegmentThinSolidFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PolySegmentThinSolidFlags) &&
- CHECK_FG(pGC,infoRec->PolySegmentThinSolidFlags)) {
-
- pGC->ops->PolySegment = infoRec->PolySegmentThinSolid;
- }
-
- if(infoRec->PolylinesThinSolid &&
- CHECK_PLANEMASK(pGC,infoRec->PolylinesThinSolidFlags) &&
- CHECK_ROP(pGC,infoRec->PolylinesThinSolidFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PolylinesThinSolidFlags) &&
- CHECK_FG(pGC,infoRec->PolylinesThinSolidFlags)) {
-
- pGC->ops->Polylines = infoRec->PolylinesThinSolid;
- }
- } else if((pGC->lineStyle == LineOnOffDash) && pGCPriv->DashPattern){
-
- if(infoRec->PolySegmentThinDashed &&
- !(infoRec->PolySegmentThinDashedFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->PolySegmentThinDashedFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_PLANEMASK(pGC,infoRec->PolySegmentThinDashedFlags) &&
- CHECK_ROP(pGC,infoRec->PolySegmentThinDashedFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PolySegmentThinDashedFlags) &&
- CHECK_FG(pGC,infoRec->PolySegmentThinDashedFlags)) {
-
- pGC->ops->PolySegment = infoRec->PolySegmentThinDashed;
- }
-
- if(infoRec->PolylinesThinDashed &&
- !(infoRec->PolylinesThinDashedFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->PolylinesThinDashedFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_PLANEMASK(pGC,infoRec->PolylinesThinDashedFlags) &&
- CHECK_ROP(pGC,infoRec->PolylinesThinDashedFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PolylinesThinDashedFlags) &&
- CHECK_FG(pGC,infoRec->PolylinesThinDashedFlags)) {
-
- pGC->ops->Polylines = infoRec->PolylinesThinDashed;
- }
-
- if(pGC->ops->Polylines != XAAFallbackOps.Polylines)
- pGC->ops->PolyRectangle = miPolyRectangle;
-
- } else if(pGCPriv->DashPattern && (pGC->depth != 32)) {
- /* LineDoubleDash */
- if(infoRec->PolySegmentThinDashed &&
- !(infoRec->PolySegmentThinDashedFlags & TRANSPARENCY_ONLY) &&
- CHECK_PLANEMASK(pGC,infoRec->PolySegmentThinDashedFlags) &&
- CHECK_ROP(pGC,infoRec->PolySegmentThinDashedFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PolySegmentThinDashedFlags) &&
- CHECK_COLORS(pGC,infoRec->PolySegmentThinDashedFlags)) {
-
- pGC->ops->PolySegment = infoRec->PolySegmentThinDashed;
- }
-
- if(infoRec->PolylinesThinDashed &&
- !(infoRec->PolylinesThinDashedFlags & TRANSPARENCY_ONLY) &&
- CHECK_PLANEMASK(pGC,infoRec->PolylinesThinDashedFlags) &&
- CHECK_ROP(pGC,infoRec->PolylinesThinDashedFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PolylinesThinDashedFlags) &&
- CHECK_COLORS(pGC,infoRec->PolylinesThinDashedFlags)) {
-
- pGC->ops->Polylines = infoRec->PolylinesThinDashed;
- }
-
- if(pGC->ops->Polylines != XAAFallbackOps.Polylines)
- pGC->ops->PolyRectangle = miPolyRectangle;
-
- }
- }
-
- if(infoRec->PolylinesWideSolid &&
- (pGC->lineWidth > 0) &&
- (pGC->fillStyle == FillSolid) &&
- (pGC->lineStyle == LineSolid) &&
- CHECK_PLANEMASK(pGC,infoRec->PolylinesWideSolidFlags) &&
- CHECK_ROP(pGC,infoRec->PolylinesWideSolidFlags) &&
- CHECK_ROPSRC(pGC,infoRec->PolylinesWideSolidFlags) &&
- CHECK_FG(pGC,infoRec->PolylinesWideSolidFlags)) {
-
- pGC->ops->Polylines = infoRec->PolylinesWideSolid;
- }
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
+
+ if (pGC->lineStyle == LineSolid)
+ changes &= ~GCDashList;
+ if (!changes)
+ return;
+
+ pGC->ops->PolySegment = XAAFallbackOps.PolySegment;
+ pGC->ops->Polylines = XAAFallbackOps.Polylines;
+ pGC->ops->PolyRectangle = XAAFallbackOps.PolyRectangle;
+ pGC->ops->PolyArc = XAAFallbackOps.PolyArc;
+
+ if ((pGC->ops->FillSpans != XAAFallbackOps.FillSpans) &&
+ (pGC->lineWidth > 0)) {
+
+ pGC->ops->PolyArc = miPolyArc;
+ pGC->ops->PolySegment = miPolySegment;
+ pGC->ops->PolyRectangle = miPolyRectangle;
+ if (pGC->lineStyle == LineSolid)
+ pGC->ops->Polylines = miWideLine;
+ else
+ pGC->ops->Polylines = miWideDash;
+ }
+
+ if ((pGC->lineWidth == 0) && (pGC->fillStyle == FillSolid)) {
+
+ if (pGC->lineStyle == LineSolid) {
+
+ if (infoRec->PolyRectangleThinSolid &&
+ CHECK_PLANEMASK(pGC, infoRec->PolyRectangleThinSolidFlags) &&
+ CHECK_ROP(pGC, infoRec->PolyRectangleThinSolidFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PolyRectangleThinSolidFlags) &&
+ CHECK_FG(pGC, infoRec->PolyRectangleThinSolidFlags)) {
+
+ pGC->ops->PolyRectangle = infoRec->PolyRectangleThinSolid;
+ }
+
+ if (infoRec->PolySegmentThinSolid &&
+ CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinSolidFlags) &&
+ CHECK_ROP(pGC, infoRec->PolySegmentThinSolidFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PolySegmentThinSolidFlags) &&
+ CHECK_FG(pGC, infoRec->PolySegmentThinSolidFlags)) {
+
+ pGC->ops->PolySegment = infoRec->PolySegmentThinSolid;
+ }
+
+ if (infoRec->PolylinesThinSolid &&
+ CHECK_PLANEMASK(pGC, infoRec->PolylinesThinSolidFlags) &&
+ CHECK_ROP(pGC, infoRec->PolylinesThinSolidFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PolylinesThinSolidFlags) &&
+ CHECK_FG(pGC, infoRec->PolylinesThinSolidFlags)) {
+
+ pGC->ops->Polylines = infoRec->PolylinesThinSolid;
+ }
+ }
+ else if ((pGC->lineStyle == LineOnOffDash) && pGCPriv->DashPattern) {
+
+ if (infoRec->PolySegmentThinDashed &&
+ !(infoRec->PolySegmentThinDashedFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->PolySegmentThinDashedFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_ROP(pGC, infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_FG(pGC, infoRec->PolySegmentThinDashedFlags)) {
+
+ pGC->ops->PolySegment = infoRec->PolySegmentThinDashed;
+ }
+
+ if (infoRec->PolylinesThinDashed &&
+ !(infoRec->PolylinesThinDashedFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->PolylinesThinDashedFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_PLANEMASK(pGC, infoRec->PolylinesThinDashedFlags) &&
+ CHECK_ROP(pGC, infoRec->PolylinesThinDashedFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PolylinesThinDashedFlags) &&
+ CHECK_FG(pGC, infoRec->PolylinesThinDashedFlags)) {
+
+ pGC->ops->Polylines = infoRec->PolylinesThinDashed;
+ }
+
+ if (pGC->ops->Polylines != XAAFallbackOps.Polylines)
+ pGC->ops->PolyRectangle = miPolyRectangle;
+
+ }
+ else if (pGCPriv->DashPattern && (pGC->depth != 32)) {
+ /* LineDoubleDash */
+ if (infoRec->PolySegmentThinDashed &&
+ !(infoRec->PolySegmentThinDashedFlags & TRANSPARENCY_ONLY) &&
+ CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_ROP(pGC, infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_COLORS(pGC, infoRec->PolySegmentThinDashedFlags)) {
+
+ pGC->ops->PolySegment = infoRec->PolySegmentThinDashed;
+ }
+
+ if (infoRec->PolylinesThinDashed &&
+ !(infoRec->PolylinesThinDashedFlags & TRANSPARENCY_ONLY) &&
+ CHECK_PLANEMASK(pGC, infoRec->PolylinesThinDashedFlags) &&
+ CHECK_ROP(pGC, infoRec->PolylinesThinDashedFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PolylinesThinDashedFlags) &&
+ CHECK_COLORS(pGC, infoRec->PolylinesThinDashedFlags)) {
+
+ pGC->ops->Polylines = infoRec->PolylinesThinDashed;
+ }
+
+ if (pGC->ops->Polylines != XAAFallbackOps.Polylines)
+ pGC->ops->PolyRectangle = miPolyRectangle;
+
+ }
+ }
+
+ if (infoRec->PolylinesWideSolid &&
+ (pGC->lineWidth > 0) &&
+ (pGC->fillStyle == FillSolid) &&
+ (pGC->lineStyle == LineSolid) &&
+ CHECK_PLANEMASK(pGC, infoRec->PolylinesWideSolidFlags) &&
+ CHECK_ROP(pGC, infoRec->PolylinesWideSolidFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->PolylinesWideSolidFlags) &&
+ CHECK_FG(pGC, infoRec->PolylinesWideSolidFlags)) {
+
+ pGC->ops->Polylines = infoRec->PolylinesWideSolid;
+ }
}
diff --git a/xorg-server/hw/xfree86/xaa/xaaImage.c b/xorg-server/hw/xfree86/xaa/xaaImage.c
index 1967c5e0e..4457c9efa 100644
--- a/xorg-server/hw/xfree86/xaa/xaaImage.c
+++ b/xorg-server/hw/xfree86/xaa/xaaImage.c
@@ -1,521 +1,534 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "servermd.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "mi.h"
-#include "pixmapstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-
-void XAAMoveDWORDS_FixedBase(
- register CARD32* dest,
- register CARD32* src,
- register int dwords )
-{
- while(dwords & ~0x03) {
- *dest = *src;
- *dest = *(src + 1);
- *dest = *(src + 2);
- *dest = *(src + 3);
- dwords -= 4;
- src += 4;
- }
-
- if(!dwords) return;
- *dest = *src;
- if(dwords == 1) return;
- *dest = *(src + 1);
- if(dwords == 2) return;
- *dest = *(src + 2);
-}
-
-void XAAMoveDWORDS(
- register CARD32* dest,
- register CARD32* src,
- register int dwords )
-{
- while(dwords & ~0x03) {
- *dest = *src;
- *(dest + 1) = *(src + 1);
- *(dest + 2) = *(src + 2);
- *(dest + 3) = *(src + 3);
- src += 4;
- dest += 4;
- dwords -= 4;
- }
- if(!dwords) return;
- *dest = *src;
- if(dwords == 1) return;
- *(dest + 1) = *(src + 1);
- if(dwords == 2) return;
- *(dest + 2) = *(src + 2);
-}
-
-void XAAMoveDWORDS_FixedSrc(
- register CARD32* dest,
- register CARD32* src,
- register int dwords )
-{
- while(dwords & ~0x03) {
- *dest = *src;
- *(dest + 1) = *src;
- *(dest + 2) = *src;
- *(dest + 3) = *src;
- dest += 4;
- dwords -= 4;
- }
- if(!dwords) return;
- *dest = *src;
- if(dwords == 1) return;
- *(dest + 1) = *src;
- if(dwords == 2) return;
- *(dest + 2) = *src;
-}
-
-static void
-XAAWritePixmap32To24(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *srcInit,
- int srcwidth, /* bytes */
- int rop,
- unsigned int planemask,
- int trans
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int count, dwords = bytes_to_int32(w * 3);
- CARD32 *src, *dst;
- Bool PlusOne = FALSE;
-
- if((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
- ((dwords * h) & 0x01)) {
- PlusOne = TRUE;
- }
-
- (*infoRec->SetupForImageWrite)(pScrn, rop, planemask, trans, 24, 24);
- (*infoRec->SubsequentImageWriteRect)(pScrn, x, y, w, h, 0);
-
- if(dwords > infoRec->ImageWriteRange) {
- dst = (CARD32*)infoRec->ImageWriteBase;
- while(h--) {
- src = (CARD32*)srcInit;
- count = w;
-
- while(count >= 4) {
- *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
- *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
- *dst = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
- src += 4;
- count -= 4;
- }
- switch(count) {
- case 0: break;
- case 1: *dst = src[0];
- break;
- case 2: *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
- *dst = src[1] >> 8;
- break;
- default: *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
- *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
- *dst = src[2] >> 16;
- break;
- }
- srcInit += srcwidth;
- }
- } else {
- while(h--) {
- dst = (CARD32*)infoRec->ImageWriteBase;
- src = (CARD32*)srcInit;
- count = w;
-
- while(count >= 4) {
- dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
- dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
- dst[2] = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
- dst += 3;
- src += 4;
- count -= 4;
- }
- switch(count) {
- case 0: break;
- case 1: dst[0] = src[0];
- break;
- case 2: dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
- dst[1] = src[1] >> 8;
- break;
- default: dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
- dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
- dst[2] = src[2] >> 16;
- break;
- }
- srcInit += srcwidth;
- }
- }
-
- if(PlusOne) {
- CARD32* base = (CARD32*)infoRec->ImageWriteBase;
- *base = 0x00000000;
- }
-
- if(infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-
-}
-
-void
-XAAWritePixmap (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth, /* bytes */
- int rop,
- unsigned int planemask,
- int trans,
- int bpp, int depth
-){
- XAAInfoRecPtr infoRec;
- int dwords, skipleft, Bpp;
- Bool beCareful, PlusOne;
-
- if((bpp == 32) && (pScrn->bitsPerPixel == 24)) {
- XAAWritePixmap32To24(pScrn, x, y, w, h, src, srcwidth,
- rop, planemask, trans);
- return;
- }
-
- infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- beCareful = PlusOne = FALSE;
- Bpp = bpp >> 3;
-
- if((skipleft = (long)src & 0x03L)) {
- if(!(infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
- skipleft = 0;
- beCareful = TRUE;
- goto BAD_ALIGNMENT;
- }
-
- if(Bpp == 3)
- skipleft = 4 - skipleft;
- else
- skipleft /= Bpp;
-
- if((x < skipleft) && !(infoRec->ImageWriteFlags &
- LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
- skipleft = 0;
- beCareful = TRUE;
- goto BAD_ALIGNMENT;
- }
-
- x -= skipleft;
- w += skipleft;
-
- if(Bpp == 3)
- src -= 3 * skipleft;
- else /* is this Alpha friendly ? */
- src = (unsigned char*)((long)src & ~0x03L);
- }
-
-BAD_ALIGNMENT:
-
- dwords = bytes_to_int32(w * Bpp);
-
- if((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
- ((dwords * h) & 0x01)) {
- PlusOne = TRUE;
- }
-
-
- (*infoRec->SetupForImageWrite)(pScrn, rop, planemask, trans, bpp, depth);
- (*infoRec->SubsequentImageWriteRect)(pScrn, x, y, w, h, skipleft);
-
- if(beCareful) {
- /* in cases with bad alignment we have to be careful not
- to read beyond the end of the source */
- if(((x * Bpp) + (dwords << 2)) > srcwidth) h--;
- else beCareful = FALSE;
- }
-
- if(dwords > infoRec->ImageWriteRange) {
- while(h--) {
- XAAMoveDWORDS_FixedBase((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords);
- src += srcwidth;
- }
- if(beCareful) {
- int shift = ((long)src & 0x03L) << 3;
- if(--dwords)
- XAAMoveDWORDS_FixedBase((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords);
- src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
- *((CARD32*)infoRec->ImageWriteBase) = *((CARD32*)src) >> shift;
- }
- } else {
- if(srcwidth == (dwords << 2)) {
- int decrement = infoRec->ImageWriteRange/dwords;
-
- while(h > decrement) {
- XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords * decrement);
- src += (srcwidth * decrement);
- h -= decrement;
- }
- if(h) {
- XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords * h);
- if(beCareful) src += (srcwidth * h);
- }
- } else {
- while(h--) {
- XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords);
- src += srcwidth;
- }
- }
-
- if(beCareful) {
- int shift = ((long)src & 0x03L) << 3;
- if(--dwords)
- XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords);
- src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
-
- ((CARD32*)infoRec->ImageWriteBase)[dwords] =
- *((CARD32*)src) >> shift;
- }
- }
-
- if(PlusOne) {
- CARD32* base = (CARD32*)infoRec->ImageWriteBase;
- *base = 0x00000000;
- }
-
- if(infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-}
-
-
-void
-XAAWritePixmapScanline (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth, /* bytes */
- int rop,
- unsigned int planemask,
- int trans,
- int bpp, int depth
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int dwords, skipleft, bufferNo = 0, Bpp = bpp >> 3;
- Bool beCareful = FALSE;
- CARD32* base;
-
- if((skipleft = (long)src & 0x03L)) {
- if(!(infoRec->ScanlineImageWriteFlags & LEFT_EDGE_CLIPPING)) {
- skipleft = 0;
- beCareful = TRUE;
- goto BAD_ALIGNMENT;
- }
-
- if(Bpp == 3)
- skipleft = 4 - skipleft;
- else
- skipleft /= Bpp;
-
- if((x < skipleft) && !(infoRec->ScanlineImageWriteFlags &
- LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
- skipleft = 0;
- beCareful = TRUE;
- goto BAD_ALIGNMENT;
- }
-
- x -= skipleft;
- w += skipleft;
-
- if(Bpp == 3)
- src -= 3 * skipleft;
- else
- src = (unsigned char*)((long)src & ~0x03L);
- }
-
-BAD_ALIGNMENT:
-
- dwords = bytes_to_int32(w * Bpp);
-
- (*infoRec->SetupForScanlineImageWrite)(
- pScrn, rop, planemask, trans, bpp, depth);
- (*infoRec->SubsequentScanlineImageWriteRect)(pScrn, x, y, w, h, skipleft);
-
- if(beCareful) {
- /* in cases with bad alignment we have to be careful not
- to read beyond the end of the source */
- if(((x * Bpp) + (dwords << 2)) > srcwidth) h--;
- else beCareful = FALSE;
- }
-
- while(h--) {
- base = (CARD32*)infoRec->ScanlineImageWriteBuffers[bufferNo];
- XAAMoveDWORDS(base, (CARD32*)src, dwords);
- (*infoRec->SubsequentImageWriteScanline)(pScrn, bufferNo++);
- src += srcwidth;
- if(bufferNo >= infoRec->NumScanlineImageWriteBuffers)
- bufferNo = 0;
- }
-
- if(beCareful) {
- int shift = ((long)src & 0x03L) << 3;
- base = (CARD32*)infoRec->ScanlineImageWriteBuffers[bufferNo];
- if(--dwords)
- XAAMoveDWORDS(base,(CARD32*)src, dwords);
- src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
-
- base[dwords] = *((CARD32*)src) >> shift;
- (*infoRec->SubsequentImageWriteScanline)(pScrn, bufferNo);
- }
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-void
-XAAPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int bpp = BitsPerPixel(depth);
- Bool depthBug = FALSE;
- if(!w || !h) return;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- depthBug = XAA_DEPTH_BUG(pGC);
-
- if(((format == ZPixmap) && infoRec->WritePixmap &&
- ((pDraw->bitsPerPixel == bpp) ||
- ((pDraw->bitsPerPixel == 24) && (bpp == 32) &&
- (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
- CHECK_ROP(pGC,infoRec->WritePixmapFlags) &&
- CHECK_ROPSRC(pGC,infoRec->WritePixmapFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->WritePixmapFlags) &&
- CHECK_NO_GXCOPY(pGC,infoRec->WritePixmapFlags)) ||
- ((format == XYBitmap) && !depthBug && infoRec->WriteBitmap &&
- CHECK_ROP(pGC,infoRec->WriteBitmapFlags) &&
- CHECK_ROPSRC(pGC,infoRec->WriteBitmapFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->WriteBitmapFlags) &&
- CHECK_COLORS(pGC,infoRec->WriteBitmapFlags) &&
- !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) ||
- ((format == XYPixmap) && !depthBug && infoRec->WriteBitmap &&
- CHECK_ROP(pGC,infoRec->WriteBitmapFlags) &&
- CHECK_ROPSRC(pGC,infoRec->WriteBitmapFlags) &&
- !(infoRec->WriteBitmapFlags & NO_PLANEMASK) &&
- !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))){
-
- int MaxBoxes = RegionNumRects(pGC->pCompositeClip);
- BoxPtr pbox, pClipBoxes;
- int nboxes, srcx, srcy, srcwidth;
- xRectangle TheRect;
-
- TheRect.x = pDraw->x + x;
- TheRect.y = pDraw->y + y;
- TheRect.width = w;
- TheRect.height = h;
-
- if(MaxBoxes > (infoRec->PreAllocSize/sizeof(BoxRec))) {
- pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec));
- if(!pClipBoxes) return;
- } else pClipBoxes = (BoxPtr)infoRec->PreAllocMem;
-
- nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
- pbox = pClipBoxes;
-
- if(format == XYBitmap) {
- srcwidth = BitmapBytePad(leftPad + w);
- while(nboxes--) {
- srcx = pbox->x1 - TheRect.x + leftPad;
- srcy = pbox->y1 - TheRect.y;
- (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- (unsigned char*)pImage +
- (srcwidth * srcy) + ((srcx >> 5) << 2),
- srcwidth, srcx & 31, pGC->fgPixel, pGC->bgPixel,
- pGC->alu, pGC->planemask);
- pbox++;
- }
- } else if(format == ZPixmap) {
- int Bpp = bpp >> 3;
- srcwidth = PixmapBytePad(leftPad + w, depth);
- while(nboxes--) {
- srcx = pbox->x1 - TheRect.x + leftPad;
- srcy = pbox->y1 - TheRect.y;
- (*infoRec->WritePixmap)(infoRec->pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- (unsigned char*)pImage +
- (srcwidth * srcy) + (srcx * Bpp),
- srcwidth, pGC->alu, pGC->planemask, -1,
- Bpp << 3, depth);
- pbox++;
- }
- } else { /* XYPixmap */
- int depth = pGC->depth;
- int numBox, increment;
- unsigned long i, mask;
- BoxPtr pntBox;
-
- srcwidth = BitmapBytePad(w + leftPad);
- increment = h * srcwidth;
- i = 1 << (depth - 1);
- mask = ~0;
-
- if((infoRec->pScrn->overlayFlags & OVERLAY_8_32_PLANAR) &&
- (pGC->depth == 8)){
- i = 0x80000000; mask = 0xff000000;
- }
-
- for(; i & mask; i >>= 1, pImage += increment) {
- if(i & pGC->planemask) {
- pntBox = pbox;
- numBox = nboxes;
- while(numBox--) {
- srcx = pntBox->x1 - TheRect.x + leftPad;
- srcy = pntBox->y1 - TheRect.y;
- (*infoRec->WriteBitmap)(infoRec->pScrn,
- pntBox->x1, pntBox->y1,
- pntBox->x2 - pntBox->x1,
- pntBox->y2 - pntBox->y1,
- (unsigned char*)pImage +
- (srcwidth * srcy) + ((srcx >> 5) << 2),
- srcwidth, srcx & 31, ~0, 0, pGC->alu, i);
- pntBox++;
- }
- }
- }
-
- }
-
- if(pClipBoxes != (BoxPtr)infoRec->PreAllocMem)
- free(pClipBoxes);
- } else
- XAAFallbackOps.PutImage(pDraw, pGC, depth, x, y, w, h, leftPad,
- format, pImage);
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "servermd.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "mi.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+void
+XAAMoveDWORDS_FixedBase(register CARD32 *dest,
+ register CARD32 *src, register int dwords)
+{
+ while (dwords & ~0x03) {
+ *dest = *src;
+ *dest = *(src + 1);
+ *dest = *(src + 2);
+ *dest = *(src + 3);
+ dwords -= 4;
+ src += 4;
+ }
+
+ if (!dwords)
+ return;
+ *dest = *src;
+ if (dwords == 1)
+ return;
+ *dest = *(src + 1);
+ if (dwords == 2)
+ return;
+ *dest = *(src + 2);
+}
+
+void
+XAAMoveDWORDS(register CARD32 *dest, register CARD32 *src, register int dwords)
+{
+ while (dwords & ~0x03) {
+ *dest = *src;
+ *(dest + 1) = *(src + 1);
+ *(dest + 2) = *(src + 2);
+ *(dest + 3) = *(src + 3);
+ src += 4;
+ dest += 4;
+ dwords -= 4;
+ }
+ if (!dwords)
+ return;
+ *dest = *src;
+ if (dwords == 1)
+ return;
+ *(dest + 1) = *(src + 1);
+ if (dwords == 2)
+ return;
+ *(dest + 2) = *(src + 2);
+}
+
+void
+XAAMoveDWORDS_FixedSrc(register CARD32 *dest,
+ register CARD32 *src, register int dwords)
+{
+ while (dwords & ~0x03) {
+ *dest = *src;
+ *(dest + 1) = *src;
+ *(dest + 2) = *src;
+ *(dest + 3) = *src;
+ dest += 4;
+ dwords -= 4;
+ }
+ if (!dwords)
+ return;
+ *dest = *src;
+ if (dwords == 1)
+ return;
+ *(dest + 1) = *src;
+ if (dwords == 2)
+ return;
+ *(dest + 2) = *src;
+}
+
+static void
+XAAWritePixmap32To24(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *srcInit, int srcwidth, /* bytes */
+ int rop, unsigned int planemask, int trans)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int count, dwords = bytes_to_int32(w * 3);
+ CARD32 *src, *dst;
+ Bool PlusOne = FALSE;
+
+ if ((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((dwords * h) & 0x01)) {
+ PlusOne = TRUE;
+ }
+
+ (*infoRec->SetupForImageWrite) (pScrn, rop, planemask, trans, 24, 24);
+ (*infoRec->SubsequentImageWriteRect) (pScrn, x, y, w, h, 0);
+
+ if (dwords > infoRec->ImageWriteRange) {
+ dst = (CARD32 *) infoRec->ImageWriteBase;
+ while (h--) {
+ src = (CARD32 *) srcInit;
+ count = w;
+
+ while (count >= 4) {
+ *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
+ *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ *dst = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
+ src += 4;
+ count -= 4;
+ }
+ switch (count) {
+ case 0:
+ break;
+ case 1:
+ *dst = src[0];
+ break;
+ case 2:
+ *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
+ *dst = src[1] >> 8;
+ break;
+ default:
+ *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
+ *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ *dst = src[2] >> 16;
+ break;
+ }
+ srcInit += srcwidth;
+ }
+ }
+ else {
+ while (h--) {
+ dst = (CARD32 *) infoRec->ImageWriteBase;
+ src = (CARD32 *) srcInit;
+ count = w;
+
+ while (count >= 4) {
+ dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
+ dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ dst[2] = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
+ dst += 3;
+ src += 4;
+ count -= 4;
+ }
+ switch (count) {
+ case 0:
+ break;
+ case 1:
+ dst[0] = src[0];
+ break;
+ case 2:
+ dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
+ dst[1] = src[1] >> 8;
+ break;
+ default:
+ dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
+ dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ dst[2] = src[2] >> 16;
+ break;
+ }
+ srcInit += srcwidth;
+ }
+ }
+
+ if (PlusOne) {
+ CARD32 *base = (CARD32 *) infoRec->ImageWriteBase;
+
+ *base = 0x00000000;
+ }
+
+ if (infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
+ (*infoRec->Sync) (pScrn);
+ else
+ SET_SYNC_FLAG(infoRec);
+
+}
+
+void
+XAAWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, /* bytes */
+ int rop, unsigned int planemask, int trans, int bpp, int depth)
+{
+ XAAInfoRecPtr infoRec;
+ int dwords, skipleft, Bpp;
+ Bool beCareful, PlusOne;
+
+ if ((bpp == 32) && (pScrn->bitsPerPixel == 24)) {
+ XAAWritePixmap32To24(pScrn, x, y, w, h, src, srcwidth,
+ rop, planemask, trans);
+ return;
+ }
+
+ infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ beCareful = PlusOne = FALSE;
+ Bpp = bpp >> 3;
+
+ if ((skipleft = (long) src & 0x03L)) {
+ if (!(infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ if (Bpp == 3)
+ skipleft = 4 - skipleft;
+ else
+ skipleft /= Bpp;
+
+ if ((x < skipleft) && !(infoRec->ImageWriteFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ x -= skipleft;
+ w += skipleft;
+
+ if (Bpp == 3)
+ src -= 3 * skipleft;
+ else /* is this Alpha friendly ? */
+ src = (unsigned char *) ((long) src & ~0x03L);
+ }
+
+ BAD_ALIGNMENT:
+
+ dwords = bytes_to_int32(w * Bpp);
+
+ if ((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((dwords * h) & 0x01)) {
+ PlusOne = TRUE;
+ }
+
+ (*infoRec->SetupForImageWrite) (pScrn, rop, planemask, trans, bpp, depth);
+ (*infoRec->SubsequentImageWriteRect) (pScrn, x, y, w, h, skipleft);
+
+ if (beCareful) {
+ /* in cases with bad alignment we have to be careful not
+ to read beyond the end of the source */
+ if (((x * Bpp) + (dwords << 2)) > srcwidth)
+ h--;
+ else
+ beCareful = FALSE;
+ }
+
+ if (dwords > infoRec->ImageWriteRange) {
+ while (h--) {
+ XAAMoveDWORDS_FixedBase((CARD32 *) infoRec->ImageWriteBase,
+ (CARD32 *) src, dwords);
+ src += srcwidth;
+ }
+ if (beCareful) {
+ int shift = ((long) src & 0x03L) << 3;
+
+ if (--dwords)
+ XAAMoveDWORDS_FixedBase((CARD32 *) infoRec->ImageWriteBase,
+ (CARD32 *) src, dwords);
+ src = (unsigned char *) ((long) (src + (dwords << 2)) & ~0x03L);
+ *((CARD32 *) infoRec->ImageWriteBase) = *((CARD32 *) src) >> shift;
+ }
+ }
+ else {
+ if (srcwidth == (dwords << 2)) {
+ int decrement = infoRec->ImageWriteRange / dwords;
+
+ while (h > decrement) {
+ XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
+ (CARD32 *) src, dwords * decrement);
+ src += (srcwidth * decrement);
+ h -= decrement;
+ }
+ if (h) {
+ XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
+ (CARD32 *) src, dwords * h);
+ if (beCareful)
+ src += (srcwidth * h);
+ }
+ }
+ else {
+ while (h--) {
+ XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
+ (CARD32 *) src, dwords);
+ src += srcwidth;
+ }
+ }
+
+ if (beCareful) {
+ int shift = ((long) src & 0x03L) << 3;
+
+ if (--dwords)
+ XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
+ (CARD32 *) src, dwords);
+ src = (unsigned char *) ((long) (src + (dwords << 2)) & ~0x03L);
+
+ ((CARD32 *) infoRec->ImageWriteBase)[dwords] =
+ *((CARD32 *) src) >> shift;
+ }
+ }
+
+ if (PlusOne) {
+ CARD32 *base = (CARD32 *) infoRec->ImageWriteBase;
+
+ *base = 0x00000000;
+ }
+
+ if (infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
+ (*infoRec->Sync) (pScrn);
+ else
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAWritePixmapScanline(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, /* bytes */
+ int rop,
+ unsigned int planemask, int trans, int bpp, int depth)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int dwords, skipleft, bufferNo = 0, Bpp = bpp >> 3;
+ Bool beCareful = FALSE;
+ CARD32 *base;
+
+ if ((skipleft = (long) src & 0x03L)) {
+ if (!(infoRec->ScanlineImageWriteFlags & LEFT_EDGE_CLIPPING)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ if (Bpp == 3)
+ skipleft = 4 - skipleft;
+ else
+ skipleft /= Bpp;
+
+ if ((x < skipleft) && !(infoRec->ScanlineImageWriteFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ x -= skipleft;
+ w += skipleft;
+
+ if (Bpp == 3)
+ src -= 3 * skipleft;
+ else
+ src = (unsigned char *) ((long) src & ~0x03L);
+ }
+
+ BAD_ALIGNMENT:
+
+ dwords = bytes_to_int32(w * Bpp);
+
+ (*infoRec->SetupForScanlineImageWrite) (pScrn, rop, planemask, trans, bpp,
+ depth);
+ (*infoRec->SubsequentScanlineImageWriteRect) (pScrn, x, y, w, h, skipleft);
+
+ if (beCareful) {
+ /* in cases with bad alignment we have to be careful not
+ to read beyond the end of the source */
+ if (((x * Bpp) + (dwords << 2)) > srcwidth)
+ h--;
+ else
+ beCareful = FALSE;
+ }
+
+ while (h--) {
+ base = (CARD32 *) infoRec->ScanlineImageWriteBuffers[bufferNo];
+ XAAMoveDWORDS(base, (CARD32 *) src, dwords);
+ (*infoRec->SubsequentImageWriteScanline) (pScrn, bufferNo++);
+ src += srcwidth;
+ if (bufferNo >= infoRec->NumScanlineImageWriteBuffers)
+ bufferNo = 0;
+ }
+
+ if (beCareful) {
+ int shift = ((long) src & 0x03L) << 3;
+
+ base = (CARD32 *) infoRec->ScanlineImageWriteBuffers[bufferNo];
+ if (--dwords)
+ XAAMoveDWORDS(base, (CARD32 *) src, dwords);
+ src = (unsigned char *) ((long) (src + (dwords << 2)) & ~0x03L);
+
+ base[dwords] = *((CARD32 *) src) >> shift;
+ (*infoRec->SubsequentImageWriteScanline) (pScrn, bufferNo);
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAPutImage(DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h, int leftPad, int format, char *pImage)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int bpp = BitsPerPixel(depth);
+ Bool depthBug = FALSE;
+
+ if (!w || !h)
+ return;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ depthBug = XAA_DEPTH_BUG(pGC);
+
+ if (((format == ZPixmap) && infoRec->WritePixmap &&
+ ((pDraw->bitsPerPixel == bpp) ||
+ ((pDraw->bitsPerPixel == 24) && (bpp == 32) &&
+ (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
+ CHECK_ROP(pGC, infoRec->WritePixmapFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->WritePixmapFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->WritePixmapFlags) &&
+ CHECK_NO_GXCOPY(pGC, infoRec->WritePixmapFlags)) ||
+ ((format == XYBitmap) && !depthBug && infoRec->WriteBitmap &&
+ CHECK_ROP(pGC, infoRec->WriteBitmapFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->WriteBitmapFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->WriteBitmapFlags) &&
+ CHECK_COLORS(pGC, infoRec->WriteBitmapFlags) &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) ||
+ ((format == XYPixmap) && !depthBug && infoRec->WriteBitmap &&
+ CHECK_ROP(pGC, infoRec->WriteBitmapFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->WriteBitmapFlags) &&
+ !(infoRec->WriteBitmapFlags & NO_PLANEMASK) &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))) {
+
+ int MaxBoxes = RegionNumRects(pGC->pCompositeClip);
+ BoxPtr pbox, pClipBoxes;
+ int nboxes, srcx, srcy, srcwidth;
+ xRectangle TheRect;
+
+ TheRect.x = pDraw->x + x;
+ TheRect.y = pDraw->y + y;
+ TheRect.width = w;
+ TheRect.height = h;
+
+ if (MaxBoxes > (infoRec->PreAllocSize / sizeof(BoxRec))) {
+ pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec));
+ if (!pClipBoxes)
+ return;
+ }
+ else
+ pClipBoxes = (BoxPtr) infoRec->PreAllocMem;
+
+ nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
+ pbox = pClipBoxes;
+
+ if (format == XYBitmap) {
+ srcwidth = BitmapBytePad(leftPad + w);
+ while (nboxes--) {
+ srcx = pbox->x1 - TheRect.x + leftPad;
+ srcy = pbox->y1 - TheRect.y;
+ (*infoRec->WriteBitmap) (infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1,
+ (unsigned char *) pImage +
+ (srcwidth * srcy) + ((srcx >> 5) << 2),
+ srcwidth, srcx & 31, pGC->fgPixel,
+ pGC->bgPixel, pGC->alu,
+ pGC->planemask);
+ pbox++;
+ }
+ }
+ else if (format == ZPixmap) {
+ int Bpp = bpp >> 3;
+
+ srcwidth = PixmapBytePad(leftPad + w, depth);
+ while (nboxes--) {
+ srcx = pbox->x1 - TheRect.x + leftPad;
+ srcy = pbox->y1 - TheRect.y;
+ (*infoRec->WritePixmap) (infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1,
+ (unsigned char *) pImage +
+ (srcwidth * srcy) + (srcx * Bpp),
+ srcwidth, pGC->alu, pGC->planemask, -1,
+ Bpp << 3, depth);
+ pbox++;
+ }
+ }
+ else { /* XYPixmap */
+ int depth = pGC->depth;
+ int numBox, increment;
+ unsigned long i, mask;
+ BoxPtr pntBox;
+
+ srcwidth = BitmapBytePad(w + leftPad);
+ increment = h * srcwidth;
+ i = 1 << (depth - 1);
+ mask = ~0;
+
+ if ((infoRec->pScrn->overlayFlags & OVERLAY_8_32_PLANAR) &&
+ (pGC->depth == 8)) {
+ i = 0x80000000;
+ mask = 0xff000000;
+ }
+
+ for (; i & mask; i >>= 1, pImage += increment) {
+ if (i & pGC->planemask) {
+ pntBox = pbox;
+ numBox = nboxes;
+ while (numBox--) {
+ srcx = pntBox->x1 - TheRect.x + leftPad;
+ srcy = pntBox->y1 - TheRect.y;
+ (*infoRec->WriteBitmap) (infoRec->pScrn,
+ pntBox->x1, pntBox->y1,
+ pntBox->x2 - pntBox->x1,
+ pntBox->y2 - pntBox->y1,
+ (unsigned char *) pImage +
+ (srcwidth * srcy) +
+ ((srcx >> 5) << 2), srcwidth,
+ srcx & 31, ~0, 0, pGC->alu, i);
+ pntBox++;
+ }
+ }
+ }
+
+ }
+
+ if (pClipBoxes != (BoxPtr) infoRec->PreAllocMem)
+ free(pClipBoxes);
+ }
+ else
+ XAAFallbackOps.PutImage(pDraw, pGC, depth, x, y, w, h, leftPad,
+ format, pImage);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaInit.c b/xorg-server/hw/xfree86/xaa/xaaInit.c
index ff1dd3d8b..661fa90ab 100644
--- a/xorg-server/hw/xfree86/xaa/xaaInit.c
+++ b/xorg-server/hw/xfree86/xaa/xaaInit.c
@@ -1,635 +1,637 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "miline.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "xf86fbman.h"
-#include "servermd.h"
-#ifdef COMPOSITE
-#include "cw.h"
-#endif
-
-#define MAX_PREALLOC_MEM 65536 /* MUST be >= 1024 */
-
-#define MIN_OFFPIX_SIZE (320*200)
-
-static Bool XAACloseScreen(int i, ScreenPtr pScreen);
-static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
- unsigned int format, unsigned long planemask,
- char *pdstLine);
-static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
- int *pwidth, int nspans, char *pdstStart);
-static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
-static Bool XAADestroyPixmap(PixmapPtr pPixmap);
-static Bool XAAEnterVT (int index, int flags);
-static void XAALeaveVT (int index, int flags);
-static int XAASetDGAMode(int index, int num, DGADevicePtr devRet);
-static void XAAEnableDisableFBAccess (int index, Bool enable);
-static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask);
-
-static DevPrivateKeyRec XAAScreenKeyRec;
-#define XAAScreenKey (&XAAScreenKeyRec)
-static DevPrivateKeyRec XAAGCKeyRec;
-#define XAAGCKey (&XAAGCKeyRec)
-static DevPrivateKeyRec XAAPixmapKeyRec;
-#define XAAPixmapKey (&XAAPixmapKeyRec)
-
-DevPrivateKey XAAGetScreenKey(void) {
- return XAAScreenKey;
-}
-
-DevPrivateKey XAAGetGCKey(void) {
- return XAAGCKey;
-}
-
-DevPrivateKey XAAGetPixmapKey(void) {
- return XAAPixmapKey;
-}
-
-/* temp kludge */
-static Bool SwitchedOut = FALSE;
-
-XAAInfoRecPtr
-XAACreateInfoRec(void)
-{
- XAAInfoRecPtr infoRec;
-
- infoRec = calloc(1, sizeof(XAAInfoRec));
- if(infoRec)
- infoRec->CachePixelGranularity = -1;
-
- return infoRec;
-}
-
-void
-XAADestroyInfoRec(XAAInfoRecPtr infoRec)
-{
- if(!infoRec) return;
-
- if(infoRec->ClosePixmapCache)
- (*infoRec->ClosePixmapCache)(infoRec->pScrn->pScreen);
-
- free(infoRec->PreAllocMem);
-
- free(infoRec->PixmapCachePrivate);
-
- free(infoRec);
-}
-
-
-Bool
-XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAScreenPtr pScreenPriv;
- int i;
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
- /* Return successfully if no acceleration wanted */
- if (!infoRec)
- return TRUE;
-
- if (!dixRegisterPrivateKey(&XAAGCKeyRec, PRIVATE_GC, sizeof(XAAGCRec)))
- return FALSE;
-
- if (!dixRegisterPrivateKey(&XAAPixmapKeyRec, PRIVATE_PIXMAP, sizeof(XAAPixmapRec)))
- return FALSE;
-
- if (!dixRegisterPrivateKey(&XAAScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- if (!(pScreenPriv = malloc(sizeof(XAAScreenRec))))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv);
-
- if(!xf86FBManagerRunning(pScreen))
- infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS);
- if(!(infoRec->Flags & LINEAR_FRAMEBUFFER))
- infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
-
- if(!infoRec->FullPlanemask) { /* for backwards compatibility */
- infoRec->FullPlanemask = (1 << pScrn->depth) - 1;
- infoRec->FullPlanemasks[pScrn->depth - 1] = infoRec->FullPlanemask;
- }
-
- for(i = 0; i < 32; i++) {
- if(!infoRec->FullPlanemasks[i]) /* keep any set by caller */
- infoRec->FullPlanemasks[i] = (1 << (i+1)) - 1;
- }
-
- if(!XAAInitAccel(pScreen, infoRec)) return FALSE;
- pScreenPriv->AccelInfoRec = infoRec;
- infoRec->ScratchGC.pScreen = pScreen;
-
-
- if(!infoRec->GetImage)
- infoRec->GetImage = XAAGetImage;
- if(!infoRec->GetSpans)
- infoRec->GetSpans = XAAGetSpans;
- if(!infoRec->CopyWindow)
- infoRec->CopyWindow = XAACopyWindow;
-
- pScreenPriv->CreateGC = pScreen->CreateGC;
- pScreen->CreateGC = XAACreateGC;
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = XAACloseScreen;
- pScreenPriv->GetImage = pScreen->GetImage;
- pScreen->GetImage = infoRec->GetImage;
- pScreenPriv->GetSpans = pScreen->GetSpans;
- pScreen->GetSpans = infoRec->GetSpans;
- pScreenPriv->CopyWindow = pScreen->CopyWindow;
- pScreen->CopyWindow = infoRec->CopyWindow;
- pScreenPriv->CreatePixmap = pScreen->CreatePixmap;
- pScreen->CreatePixmap = XAACreatePixmap;
- pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap;
- pScreen->DestroyPixmap = XAADestroyPixmap;
- pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
- pScreen->ChangeWindowAttributes = XAAChangeWindowAttributes;
-
- pScreenPriv->EnterVT = pScrn->EnterVT;
- pScrn->EnterVT = XAAEnterVT;
- pScreenPriv->LeaveVT = pScrn->LeaveVT;
- pScrn->LeaveVT = XAALeaveVT;
- pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
- pScrn->SetDGAMode = XAASetDGAMode;
- pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
- pScrn->EnableDisableFBAccess = XAAEnableDisableFBAccess;
-
- pScreenPriv->WindowExposures = pScreen->WindowExposures;
- if (ps)
- {
- pScreenPriv->Composite = ps->Composite;
- ps->Composite = XAAComposite;
- pScreenPriv->Glyphs = ps->Glyphs;
- ps->Glyphs = XAAGlyphs;
- }
- if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR)
- XAASetupOverlay8_32Planar(pScreen);
-
- infoRec->PreAllocMem = malloc(MAX_PREALLOC_MEM);
- if(infoRec->PreAllocMem)
- infoRec->PreAllocSize = MAX_PREALLOC_MEM;
-
- if(infoRec->Flags & PIXMAP_CACHE)
- xf86RegisterFreeBoxCallback(pScreen, infoRec->InitPixmapCache,
- (pointer)infoRec);
-
- if(infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS)
- miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4);
-
-#ifdef COMPOSITE
- /* Initialize the composite wrapper. This needs to happen after the
- * wrapping above (so it comes before us), but before all other extensions,
- * so it doesn't confuse them. (particularly damage).
- */
- miInitializeCompositeWrapper(pScreen);
-#endif
-
- return TRUE;
-}
-
-
-
-static Bool
-XAACloseScreen (int i, ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
-
- pScrn->EnterVT = pScreenPriv->EnterVT;
- pScrn->LeaveVT = pScreenPriv->LeaveVT;
- pScrn->EnableDisableFBAccess = pScreenPriv->EnableDisableFBAccess;
-
- pScreen->CreateGC = pScreenPriv->CreateGC;
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- pScreen->GetImage = pScreenPriv->GetImage;
- pScreen->GetSpans = pScreenPriv->GetSpans;
- pScreen->CopyWindow = pScreenPriv->CopyWindow;
- pScreen->WindowExposures = pScreenPriv->WindowExposures;
- pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
- pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
- pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
-
- /* We leave it up to the client to free the XAAInfoRec */
-
- free((pointer) pScreenPriv);
-
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-static void
-XAAGetImage (
- DrawablePtr pDraw,
- int sx, int sy, int w, int h,
- unsigned int format,
- unsigned long planemask,
- char *pdstLine
-)
-{
- ScreenPtr pScreen = pDraw->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- ScrnInfoPtr pScrn = infoRec->pScrn;
-
- if(pScrn->vtSema &&
- ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw)))
- {
- if(infoRec->ReadPixmap && (format == ZPixmap) &&
- ((planemask & infoRec->FullPlanemasks[pDraw->depth - 1]) ==
- infoRec->FullPlanemasks[pDraw->depth - 1]) &&
- (pDraw->bitsPerPixel == BitsPerPixel(pDraw->depth)))
- {
- (*infoRec->ReadPixmap)(pScrn,
- sx + pDraw->x, sy + pDraw->y, w, h,
- (unsigned char *)pdstLine,
- PixmapBytePad(w, pDraw->depth),
- pDraw->bitsPerPixel, pDraw->depth);
- return;
- }
- SYNC_CHECK(pDraw);
- }
-
- XAA_SCREEN_PROLOGUE (pScreen, GetImage);
- (*pScreen->GetImage) (pDraw, sx, sy, w, h, format, planemask, pdstLine);
- XAA_SCREEN_EPILOGUE (pScreen, GetImage, XAAGetImage);
-}
-
-static void
-XAAGetSpans (
- DrawablePtr pDraw,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pdstStart
-)
-{
- ScreenPtr pScreen = pDraw->pScreen;
- XAA_SCREEN_PROLOGUE (pScreen, GetSpans);
- if(xf86Screens[pScreen->myNum]->vtSema &&
- ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) {
- SYNC_CHECK(pDraw);
- }
- (*pScreen->GetSpans) (pDraw, wMax, ppt, pwidth, nspans, pdstStart);
- XAA_SCREEN_EPILOGUE (pScreen, GetSpans, XAAGetSpans);
-}
-
-
-static int
-XAAPixmapBPP (ScreenPtr pScreen, int depth)
-{
- PixmapPtr pPix;
- int bpp;
- DestroyPixmapProcPtr destroyPixmap;
-
- XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPix = (*pScreen->CreatePixmap) (pScreen, 1, 1, depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
- if (!pPix)
- return 0;
- bpp = pPix->drawable.bitsPerPixel;
- destroyPixmap = pScreen->DestroyPixmap;
- XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
- (*pScreen->DestroyPixmap) (pPix);
- XAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, destroyPixmap);
- return bpp;
-}
-
-static void
-XAAInitializeOffscreenDepths (ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- int d, dep;
-
- infoRec->offscreenDepthsInitialized = TRUE;
- infoRec->offscreenDepths = 0;
- if (infoRec->Flags & OFFSCREEN_PIXMAPS) {
- for (d = 0; d < pScreen->numDepths; d++) {
- dep = pScreen->allowedDepths[d].depth;
- if (XAAPixmapBPP (pScreen, dep) == pScrn->bitsPerPixel)
- infoRec->offscreenDepths |= (1 << (dep - 1));
- }
- }
-}
-
-static PixmapPtr
-XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAPixmapPtr pPriv;
- PixmapPtr pPix = NULL;
- int size = w * h;
-
- if (w > 32767 || h > 32767)
- return NullPixmap;
-
- if (!infoRec->offscreenDepthsInitialized)
- XAAInitializeOffscreenDepths (pScreen);
-
- if(pScrn->vtSema &&
- (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) &&
- (infoRec->offscreenDepths & (1 << (depth - 1))) &&
- (size >= MIN_OFFPIX_SIZE) && !SwitchedOut &&
- (!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) &&
- (!infoRec->maxOffPixHeight || (h <= infoRec->maxOffPixHeight)) )
- {
- PixmapLinkPtr pLink;
- PixmapPtr pScreenPix;
- FBAreaPtr area;
- int gran = 0;
-
- switch(pScrn->bitsPerPixel) {
- case 24:
- case 8: gran = 4; break;
- case 16: gran = 2; break;
- case 32: gran = 1; break;
- default: break;
- }
-
- if(BITMAP_SCANLINE_PAD == 64)
- gran *= 2;
-
- if(!(area = xf86AllocateOffscreenArea(pScreen, w, h, gran, 0,
- XAARemoveAreaCallback, NULL))) {
- goto BAILOUT;
- }
-
- if(!(pLink = malloc(sizeof(PixmapLink)))) {
- xf86FreeOffscreenArea(area);
- goto BAILOUT;
- }
-
- XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, usage_hint);
- XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
-
- if (!pPix) {
- free(pLink);
- xf86FreeOffscreenArea(area);
- goto BAILOUT;
- }
-
- pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
-
- pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- pPix->drawable.x = area->box.x1;
- pPix->drawable.y = area->box.y1;
- pPix->drawable.width = w;
- pPix->drawable.height = h;
- pPix->drawable.bitsPerPixel = pScrn->bitsPerPixel;
- pPix->devKind = pScreenPix->devKind;
- pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
- area->devPrivate.ptr = pPix;
-
- pPriv->flags = OFFSCREEN;
- pPriv->offscreenArea = area;
- pPriv->freeData = FALSE;
-
- pLink->next = infoRec->OffscreenPixmaps;
- pLink->pPix = pPix;
- infoRec->OffscreenPixmaps = pLink;
- return pPix;
- }
-BAILOUT:
- XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
- XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
-
- if(pPix) {
- pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- pPriv->flags = 0;
- pPriv->offscreenArea = NULL;
- pPriv->freeData = FALSE;
- if(!w || !h) /* either scratch or shared memory */
- pPriv->flags |= SHARED_PIXMAP;
- }
-
- return pPix;
-}
-
-static Bool
-XAADestroyPixmap(PixmapPtr pPix)
-{
- ScreenPtr pScreen = pPix->drawable.pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- Bool ret;
-
- if(pPix->refcnt == 1) {
- if(pPriv->flags & OFFSCREEN) {
- if(pPriv->flags & DGA_PIXMAP)
- free(pPriv->offscreenArea);
- else {
- FBAreaPtr area = pPriv->offscreenArea;
- PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
- PixmapLinkPtr prev = NULL;
-
- while(pLink->pPix != pPix) {
- prev = pLink;
- pLink = pLink->next;
- }
-
- if(prev) prev->next = pLink->next;
- else infoRec->OffscreenPixmaps = pLink->next;
-
- if(!area) area = pLink->area;
-
- xf86FreeOffscreenArea(area);
- pPriv->offscreenArea = NULL;
- free(pLink);
- }
- }
-
- if(pPriv->freeData) { /* pixmaps that were once in video ram */
- free(pPix->devPrivate.ptr);
- pPix->devPrivate.ptr = NULL;
- }
- }
-
- XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
- ret = (*pScreen->DestroyPixmap) (pPix);
- XAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, XAADestroyPixmap);
-
- return ret;
-}
-
-static Bool
-XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- Bool ret;
-
- XAA_SCREEN_PROLOGUE (pScreen, ChangeWindowAttributes);
- ret = (*pScreen->ChangeWindowAttributes) (pWin, mask);
- XAA_SCREEN_EPILOGUE (pScreen, ChangeWindowAttributes, XAAChangeWindowAttributes);
-
- /* we have to assume that shared memory pixmaps are dirty
- because we can't wrap operations on them */
-
- if((mask & CWBackPixmap) && (pWin->backgroundState == BackgroundPixmap) &&
- PIXMAP_IS_SHARED(pWin->background.pixmap))
- {
- XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->background.pixmap);
- pPixPriv->flags |= DIRTY;
- }
- if((mask & CWBorderPixmap) && !(pWin->borderIsPixel) &&
- PIXMAP_IS_SHARED(pWin->border.pixmap))
- {
- XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->border.pixmap);
- pPixPriv->flags |= DIRTY;
- }
-
- return ret;
-}
-
-
-
-/* These two aren't really needed for anything */
-
-static Bool
-XAAEnterVT(int index, int flags)
-{
- ScrnInfoPtr pScrn = xf86Screens[index];
- Bool ret;
- ScreenPtr pScreen = screenInfo.screens[index];
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
-
- pScrn->EnterVT = pScreenPriv->EnterVT;
- ret = ((*pScreenPriv->EnterVT)(index, flags));
- pScreenPriv->EnterVT = pScrn->EnterVT;
- pScrn->EnterVT = XAAEnterVT;
- return ret;
-}
-
-static void
-XAALeaveVT(int index, int flags)
-{
- ScrnInfoPtr pScrn = xf86Screens[index];
- ScreenPtr pScreen = screenInfo.screens[index];
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
- XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
-
- if(infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
-
- pScrn->LeaveVT = pScreenPriv->LeaveVT;
- (*pScreenPriv->LeaveVT)(index, flags);
- pScreenPriv->LeaveVT = pScrn->LeaveVT;
- pScrn->LeaveVT = XAALeaveVT;
-}
-
-typedef struct {
- Bool UsingPixmapCache;
- Bool CanDoColor8x8;
- Bool CanDoMono8x8;
-} SavedCacheState, *SavedCacheStatePtr;
-
-static int
-XAASetDGAMode(int index, int num, DGADevicePtr devRet)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
- int ret;
-
- if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */
- SavedCacheStatePtr state = (SavedCacheStatePtr)infoRec->dgaSaves;
-
- infoRec->UsingPixmapCache = state->UsingPixmapCache;
- infoRec->CanDoColor8x8 = state->CanDoColor8x8;
- infoRec->CanDoMono8x8 = state->CanDoMono8x8;
- free(infoRec->dgaSaves);
- infoRec->dgaSaves = NULL;
- }
-
- ret = (*pScreenPriv->SetDGAMode)(index, num, devRet);
- if(ret != Success) return ret;
-
- if(num && devRet->pPix) { /* accelerate this pixmap */
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(devRet->pPix);
- FBAreaPtr area;
-
- if((area = malloc(sizeof(FBArea)))) {
- area->pScreen = pScreen;
- area->box.x1 = 0;
- area->box.x2 = 0;
- area->box.y1 = devRet->mode->pixmapWidth;
- area->box.y2 = devRet->mode->pixmapHeight;
- area->granularity = 0;
- area->MoveAreaCallback = 0;
- area->RemoveAreaCallback = 0;
- area->devPrivate.ptr = 0;
-
- pixPriv->flags |= OFFSCREEN | DGA_PIXMAP;
- pixPriv->offscreenArea = area;
-
- if(!infoRec->dgaSaves) { /* save pixmap cache state */
- SavedCacheStatePtr state = malloc(sizeof(SavedCacheState));
-
- state->UsingPixmapCache = infoRec->UsingPixmapCache;
- state->CanDoColor8x8 = infoRec->CanDoColor8x8;
- state->CanDoMono8x8 = infoRec->CanDoMono8x8;
- infoRec->dgaSaves = (char*)state;
-
- infoRec->UsingPixmapCache = FALSE;
- if(infoRec->PixmapCacheFlags & CACHE_MONO_8x8)
- infoRec->CanDoMono8x8 = FALSE;
- if(infoRec->PixmapCacheFlags & CACHE_COLOR_8x8)
- infoRec->CanDoColor8x8 = FALSE;
- }
- }
- }
-
- return ret;
-}
-
-
-
-static void
-XAAEnableDisableFBAccess (int index, Bool enable)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
-
- if(!enable) {
- if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
- XAAMoveOutOffscreenPixmaps(pScreen);
- if(infoRec->Flags & PIXMAP_CACHE)
- XAAInvalidatePixmapCache(pScreen);
- SwitchedOut = TRUE;
- }
-
- (*pScreenPriv->EnableDisableFBAccess)(index, enable);
-
- if(enable) {
- if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
- XAAMoveInOffscreenPixmaps(pScreen);
- SwitchedOut = FALSE;
- }
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+#ifdef COMPOSITE
+#include "cw.h"
+#endif
+
+#define MAX_PREALLOC_MEM 65536 /* MUST be >= 1024 */
+
+#define MIN_OFFPIX_SIZE (320*200)
+
+static Bool XAACloseScreen(int i, ScreenPtr pScreen);
+static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planemask,
+ char *pdstLine);
+static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart);
+static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
+ unsigned usage_hint);
+static Bool XAADestroyPixmap(PixmapPtr pPixmap);
+static Bool XAAEnterVT(int index, int flags);
+static void XAALeaveVT(int index, int flags);
+static int XAASetDGAMode(int index, int num, DGADevicePtr devRet);
+static void XAAEnableDisableFBAccess(int index, Bool enable);
+static Bool XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
+
+static DevPrivateKeyRec XAAScreenKeyRec;
+
+#define XAAScreenKey (&XAAScreenKeyRec)
+static DevPrivateKeyRec XAAGCKeyRec;
+
+#define XAAGCKey (&XAAGCKeyRec)
+static DevPrivateKeyRec XAAPixmapKeyRec;
+
+#define XAAPixmapKey (&XAAPixmapKeyRec)
+
+DevPrivateKey
+XAAGetScreenKey(void)
+{
+ return XAAScreenKey;
+}
+
+DevPrivateKey
+XAAGetGCKey(void)
+{
+ return XAAGCKey;
+}
+
+DevPrivateKey
+XAAGetPixmapKey(void)
+{
+ return XAAPixmapKey;
+}
+
+/* temp kludge */
+static Bool SwitchedOut = FALSE;
+
+XAAInfoRecPtr
+XAACreateInfoRec(void)
+{
+ XAAInfoRecPtr infoRec;
+
+ infoRec = calloc(1, sizeof(XAAInfoRec));
+ if (infoRec)
+ infoRec->CachePixelGranularity = -1;
+
+ return infoRec;
+}
+
+void
+XAADestroyInfoRec(XAAInfoRecPtr infoRec)
+{
+ if (!infoRec)
+ return;
+
+ if (infoRec->ClosePixmapCache)
+ (*infoRec->ClosePixmapCache) (infoRec->pScrn->pScreen);
+
+ free(infoRec->PreAllocMem);
+
+ free(infoRec->PixmapCachePrivate);
+
+ free(infoRec);
+}
+
+Bool
+XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAScreenPtr pScreenPriv;
+ int i;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+
+ /* Return successfully if no acceleration wanted */
+ if (!infoRec)
+ return TRUE;
+
+ if (!dixRegisterPrivateKey(&XAAGCKeyRec, PRIVATE_GC, sizeof(XAAGCRec)))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey
+ (&XAAPixmapKeyRec, PRIVATE_PIXMAP, sizeof(XAAPixmapRec)))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&XAAScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ if (!(pScreenPriv = malloc(sizeof(XAAScreenRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv);
+
+ if (!xf86FBManagerRunning(pScreen))
+ infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS);
+ if (!(infoRec->Flags & LINEAR_FRAMEBUFFER))
+ infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
+
+ if (!infoRec->FullPlanemask) { /* for backwards compatibility */
+ infoRec->FullPlanemask = (1 << pScrn->depth) - 1;
+ infoRec->FullPlanemasks[pScrn->depth - 1] = infoRec->FullPlanemask;
+ }
+
+ for (i = 0; i < 32; i++) {
+ if (!infoRec->FullPlanemasks[i]) /* keep any set by caller */
+ infoRec->FullPlanemasks[i] = (1 << (i + 1)) - 1;
+ }
+
+ if (!XAAInitAccel(pScreen, infoRec))
+ return FALSE;
+ pScreenPriv->AccelInfoRec = infoRec;
+ infoRec->ScratchGC.pScreen = pScreen;
+
+ if (!infoRec->GetImage)
+ infoRec->GetImage = XAAGetImage;
+ if (!infoRec->GetSpans)
+ infoRec->GetSpans = XAAGetSpans;
+ if (!infoRec->CopyWindow)
+ infoRec->CopyWindow = XAACopyWindow;
+
+ pScreenPriv->CreateGC = pScreen->CreateGC;
+ pScreen->CreateGC = XAACreateGC;
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = XAACloseScreen;
+ pScreenPriv->GetImage = pScreen->GetImage;
+ pScreen->GetImage = infoRec->GetImage;
+ pScreenPriv->GetSpans = pScreen->GetSpans;
+ pScreen->GetSpans = infoRec->GetSpans;
+ pScreenPriv->CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = infoRec->CopyWindow;
+ pScreenPriv->CreatePixmap = pScreen->CreatePixmap;
+ pScreen->CreatePixmap = XAACreatePixmap;
+ pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap;
+ pScreen->DestroyPixmap = XAADestroyPixmap;
+ pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+ pScreen->ChangeWindowAttributes = XAAChangeWindowAttributes;
+
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = XAAEnterVT;
+ pScreenPriv->LeaveVT = pScrn->LeaveVT;
+ pScrn->LeaveVT = XAALeaveVT;
+ pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
+ pScrn->SetDGAMode = XAASetDGAMode;
+ pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
+ pScrn->EnableDisableFBAccess = XAAEnableDisableFBAccess;
+
+ pScreenPriv->WindowExposures = pScreen->WindowExposures;
+ if (ps) {
+ pScreenPriv->Composite = ps->Composite;
+ ps->Composite = XAAComposite;
+ pScreenPriv->Glyphs = ps->Glyphs;
+ ps->Glyphs = XAAGlyphs;
+ }
+ if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR)
+ XAASetupOverlay8_32Planar(pScreen);
+
+ infoRec->PreAllocMem = malloc(MAX_PREALLOC_MEM);
+ if (infoRec->PreAllocMem)
+ infoRec->PreAllocSize = MAX_PREALLOC_MEM;
+
+ if (infoRec->Flags & PIXMAP_CACHE)
+ xf86RegisterFreeBoxCallback(pScreen, infoRec->InitPixmapCache,
+ (pointer) infoRec);
+
+ if (infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS)
+ miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4);
+
+#ifdef COMPOSITE
+ /* Initialize the composite wrapper. This needs to happen after the
+ * wrapping above (so it comes before us), but before all other extensions,
+ * so it doesn't confuse them. (particularly damage).
+ */
+ miInitializeCompositeWrapper(pScreen);
+#endif
+
+ return TRUE;
+}
+
+static Bool
+XAACloseScreen(int i, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ pScrn->LeaveVT = pScreenPriv->LeaveVT;
+ pScrn->EnableDisableFBAccess = pScreenPriv->EnableDisableFBAccess;
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->GetImage = pScreenPriv->GetImage;
+ pScreen->GetSpans = pScreenPriv->GetSpans;
+ pScreen->CopyWindow = pScreenPriv->CopyWindow;
+ pScreen->WindowExposures = pScreenPriv->WindowExposures;
+ pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
+ pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
+ pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
+
+ /* We leave it up to the client to free the XAAInfoRec */
+
+ free((pointer) pScreenPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static void
+XAAGetImage(DrawablePtr pDraw,
+ int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planemask, char *pdstLine)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = infoRec->pScrn;
+
+ if (pScrn->vtSema &&
+ ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) {
+ if (infoRec->ReadPixmap && (format == ZPixmap) &&
+ ((planemask & infoRec->FullPlanemasks[pDraw->depth - 1]) ==
+ infoRec->FullPlanemasks[pDraw->depth - 1]) &&
+ (pDraw->bitsPerPixel == BitsPerPixel(pDraw->depth))) {
+ (*infoRec->ReadPixmap) (pScrn,
+ sx + pDraw->x, sy + pDraw->y, w, h,
+ (unsigned char *) pdstLine,
+ PixmapBytePad(w, pDraw->depth),
+ pDraw->bitsPerPixel, pDraw->depth);
+ return;
+ }
+ SYNC_CHECK(pDraw);
+ }
+
+ XAA_SCREEN_PROLOGUE(pScreen, GetImage);
+ (*pScreen->GetImage) (pDraw, sx, sy, w, h, format, planemask, pdstLine);
+ XAA_SCREEN_EPILOGUE(pScreen, GetImage, XAAGetImage);
+}
+
+static void
+XAAGetSpans(DrawablePtr pDraw,
+ int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+
+ XAA_SCREEN_PROLOGUE(pScreen, GetSpans);
+ if (xf86Screens[pScreen->myNum]->vtSema &&
+ ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) {
+ SYNC_CHECK(pDraw);
+ }
+ (*pScreen->GetSpans) (pDraw, wMax, ppt, pwidth, nspans, pdstStart);
+ XAA_SCREEN_EPILOGUE(pScreen, GetSpans, XAAGetSpans);
+}
+
+static int
+XAAPixmapBPP(ScreenPtr pScreen, int depth)
+{
+ PixmapPtr pPix;
+ int bpp;
+ DestroyPixmapProcPtr destroyPixmap;
+
+ XAA_SCREEN_PROLOGUE(pScreen, CreatePixmap);
+ pPix = (*pScreen->CreatePixmap) (pScreen, 1, 1, depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ XAA_SCREEN_EPILOGUE(pScreen, CreatePixmap, XAACreatePixmap);
+ if (!pPix)
+ return 0;
+ bpp = pPix->drawable.bitsPerPixel;
+ destroyPixmap = pScreen->DestroyPixmap;
+ XAA_SCREEN_PROLOGUE(pScreen, DestroyPixmap);
+ (*pScreen->DestroyPixmap) (pPix);
+ XAA_SCREEN_EPILOGUE(pScreen, DestroyPixmap, destroyPixmap);
+ return bpp;
+}
+
+static void
+XAAInitializeOffscreenDepths(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int d, dep;
+
+ infoRec->offscreenDepthsInitialized = TRUE;
+ infoRec->offscreenDepths = 0;
+ if (infoRec->Flags & OFFSCREEN_PIXMAPS) {
+ for (d = 0; d < pScreen->numDepths; d++) {
+ dep = pScreen->allowedDepths[d].depth;
+ if (XAAPixmapBPP(pScreen, dep) == pScrn->bitsPerPixel)
+ infoRec->offscreenDepths |= (1 << (dep - 1));
+ }
+ }
+}
+
+static PixmapPtr
+XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAPixmapPtr pPriv;
+ PixmapPtr pPix = NULL;
+ int size = w * h;
+
+ if (w > 32767 || h > 32767)
+ return NullPixmap;
+
+ if (!infoRec->offscreenDepthsInitialized)
+ XAAInitializeOffscreenDepths(pScreen);
+
+ if (pScrn->vtSema &&
+ (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) &&
+ (infoRec->offscreenDepths & (1 << (depth - 1))) &&
+ (size >= MIN_OFFPIX_SIZE) && !SwitchedOut &&
+ (!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) &&
+ (!infoRec->maxOffPixHeight || (h <= infoRec->maxOffPixHeight))) {
+ PixmapLinkPtr pLink;
+ PixmapPtr pScreenPix;
+ FBAreaPtr area;
+ int gran = 0;
+
+ switch (pScrn->bitsPerPixel) {
+ case 24:
+ case 8:
+ gran = 4;
+ break;
+ case 16:
+ gran = 2;
+ break;
+ case 32:
+ gran = 1;
+ break;
+ default:
+ break;
+ }
+
+ if (BITMAP_SCANLINE_PAD == 64)
+ gran *= 2;
+
+ if (!(area = xf86AllocateOffscreenArea(pScreen, w, h, gran, 0,
+ XAARemoveAreaCallback, NULL))) {
+ goto BAILOUT;
+ }
+
+ if (!(pLink = malloc(sizeof(PixmapLink)))) {
+ xf86FreeOffscreenArea(area);
+ goto BAILOUT;
+ }
+
+ XAA_SCREEN_PROLOGUE(pScreen, CreatePixmap);
+ pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, usage_hint);
+ XAA_SCREEN_EPILOGUE(pScreen, CreatePixmap, XAACreatePixmap);
+
+ if (!pPix) {
+ free(pLink);
+ xf86FreeOffscreenArea(area);
+ goto BAILOUT;
+ }
+
+ pScreenPix = (*pScreen->GetScreenPixmap) (pScreen);
+
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ pPix->drawable.x = area->box.x1;
+ pPix->drawable.y = area->box.y1;
+ pPix->drawable.width = w;
+ pPix->drawable.height = h;
+ pPix->drawable.bitsPerPixel = pScrn->bitsPerPixel;
+ pPix->devKind = pScreenPix->devKind;
+ pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
+ area->devPrivate.ptr = pPix;
+
+ pPriv->flags = OFFSCREEN;
+ pPriv->offscreenArea = area;
+ pPriv->freeData = FALSE;
+
+ pLink->next = infoRec->OffscreenPixmaps;
+ pLink->pPix = pPix;
+ infoRec->OffscreenPixmaps = pLink;
+ return pPix;
+ }
+ BAILOUT:
+ XAA_SCREEN_PROLOGUE(pScreen, CreatePixmap);
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ XAA_SCREEN_EPILOGUE(pScreen, CreatePixmap, XAACreatePixmap);
+
+ if (pPix) {
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ pPriv->flags = 0;
+ pPriv->offscreenArea = NULL;
+ pPriv->freeData = FALSE;
+ if (!w || !h) /* either scratch or shared memory */
+ pPriv->flags |= SHARED_PIXMAP;
+ }
+
+ return pPix;
+}
+
+static Bool
+XAADestroyPixmap(PixmapPtr pPix)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ Bool ret;
+
+ if (pPix->refcnt == 1) {
+ if (pPriv->flags & OFFSCREEN) {
+ if (pPriv->flags & DGA_PIXMAP)
+ free(pPriv->offscreenArea);
+ else {
+ FBAreaPtr area = pPriv->offscreenArea;
+ PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
+ PixmapLinkPtr prev = NULL;
+
+ while (pLink->pPix != pPix) {
+ prev = pLink;
+ pLink = pLink->next;
+ }
+
+ if (prev)
+ prev->next = pLink->next;
+ else
+ infoRec->OffscreenPixmaps = pLink->next;
+
+ if (!area)
+ area = pLink->area;
+
+ xf86FreeOffscreenArea(area);
+ pPriv->offscreenArea = NULL;
+ free(pLink);
+ }
+ }
+
+ if (pPriv->freeData) { /* pixmaps that were once in video ram */
+ free(pPix->devPrivate.ptr);
+ pPix->devPrivate.ptr = NULL;
+ }
+ }
+
+ XAA_SCREEN_PROLOGUE(pScreen, DestroyPixmap);
+ ret = (*pScreen->DestroyPixmap) (pPix);
+ XAA_SCREEN_EPILOGUE(pScreen, DestroyPixmap, XAADestroyPixmap);
+
+ return ret;
+}
+
+static Bool
+XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool ret;
+
+ XAA_SCREEN_PROLOGUE(pScreen, ChangeWindowAttributes);
+ ret = (*pScreen->ChangeWindowAttributes) (pWin, mask);
+ XAA_SCREEN_EPILOGUE(pScreen, ChangeWindowAttributes,
+ XAAChangeWindowAttributes);
+
+ /* we have to assume that shared memory pixmaps are dirty
+ because we can't wrap operations on them */
+
+ if ((mask & CWBackPixmap) && (pWin->backgroundState == BackgroundPixmap) &&
+ PIXMAP_IS_SHARED(pWin->background.pixmap)) {
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->background.pixmap);
+
+ pPixPriv->flags |= DIRTY;
+ }
+ if ((mask & CWBorderPixmap) && !(pWin->borderIsPixel) &&
+ PIXMAP_IS_SHARED(pWin->border.pixmap)) {
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->border.pixmap);
+
+ pPixPriv->flags |= DIRTY;
+ }
+
+ return ret;
+}
+
+/* These two aren't really needed for anything */
+
+static Bool
+XAAEnterVT(int index, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ Bool ret;
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ ret = ((*pScreenPriv->EnterVT) (index, flags));
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = XAAEnterVT;
+ return ret;
+}
+
+static void
+XAALeaveVT(int index, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+ XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
+
+ if (infoRec->NeedToSync) {
+ (*infoRec->Sync) (infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+
+ pScrn->LeaveVT = pScreenPriv->LeaveVT;
+ (*pScreenPriv->LeaveVT) (index, flags);
+ pScreenPriv->LeaveVT = pScrn->LeaveVT;
+ pScrn->LeaveVT = XAALeaveVT;
+}
+
+typedef struct {
+ Bool UsingPixmapCache;
+ Bool CanDoColor8x8;
+ Bool CanDoMono8x8;
+} SavedCacheState, *SavedCacheStatePtr;
+
+static int
+XAASetDGAMode(int index, int num, DGADevicePtr devRet)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+ int ret;
+
+ if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */
+ SavedCacheStatePtr state = (SavedCacheStatePtr) infoRec->dgaSaves;
+
+ infoRec->UsingPixmapCache = state->UsingPixmapCache;
+ infoRec->CanDoColor8x8 = state->CanDoColor8x8;
+ infoRec->CanDoMono8x8 = state->CanDoMono8x8;
+ free(infoRec->dgaSaves);
+ infoRec->dgaSaves = NULL;
+ }
+
+ ret = (*pScreenPriv->SetDGAMode) (index, num, devRet);
+ if (ret != Success)
+ return ret;
+
+ if (num && devRet->pPix) { /* accelerate this pixmap */
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(devRet->pPix);
+ FBAreaPtr area;
+
+ if ((area = malloc(sizeof(FBArea)))) {
+ area->pScreen = pScreen;
+ area->box.x1 = 0;
+ area->box.x2 = 0;
+ area->box.y1 = devRet->mode->pixmapWidth;
+ area->box.y2 = devRet->mode->pixmapHeight;
+ area->granularity = 0;
+ area->MoveAreaCallback = 0;
+ area->RemoveAreaCallback = 0;
+ area->devPrivate.ptr = 0;
+
+ pixPriv->flags |= OFFSCREEN | DGA_PIXMAP;
+ pixPriv->offscreenArea = area;
+
+ if (!infoRec->dgaSaves) { /* save pixmap cache state */
+ SavedCacheStatePtr state = malloc(sizeof(SavedCacheState));
+
+ state->UsingPixmapCache = infoRec->UsingPixmapCache;
+ state->CanDoColor8x8 = infoRec->CanDoColor8x8;
+ state->CanDoMono8x8 = infoRec->CanDoMono8x8;
+ infoRec->dgaSaves = (char *) state;
+
+ infoRec->UsingPixmapCache = FALSE;
+ if (infoRec->PixmapCacheFlags & CACHE_MONO_8x8)
+ infoRec->CanDoMono8x8 = FALSE;
+ if (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8)
+ infoRec->CanDoColor8x8 = FALSE;
+ }
+ }
+ }
+
+ return ret;
+}
+
+static void
+XAAEnableDisableFBAccess(int index, Bool enable)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+
+ if (!enable) {
+ if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
+ XAAMoveOutOffscreenPixmaps(pScreen);
+ if (infoRec->Flags & PIXMAP_CACHE)
+ XAAInvalidatePixmapCache(pScreen);
+ SwitchedOut = TRUE;
+ }
+
+ (*pScreenPriv->EnableDisableFBAccess) (index, enable);
+
+ if (enable) {
+ if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
+ XAAMoveInOffscreenPixmaps(pScreen);
+ SwitchedOut = FALSE;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaInitAccel.c b/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
index d24599d48..2a85a1996 100644
--- a/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
+++ b/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
@@ -1,1498 +1,1571 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xf86fbman.h"
-#include "servermd.h"
-
-/*
- * XAA Config options
- */
-
-typedef enum {
- XAAOPT_SCREEN_TO_SCREEN_COPY,
- XAAOPT_SOLID_FILL_RECT,
- XAAOPT_SOLID_FILL_TRAP,
- XAAOPT_SOLID_TWO_POINT_LINE,
- XAAOPT_SOLID_BRESENHAM_LINE,
- XAAOPT_SOLID_HORVERT_LINE,
- XAAOPT_DASHED_TWO_POINT_LINE,
- XAAOPT_DASHED_BRESENHAM_LINE,
- XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
- XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
- XAAOPT_COL_8x8_PATTERN_FILL_RECT,
- XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
- XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
- XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
- XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
- XAAOPT_IMAGE_WRITE_RECT,
- XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
- XAAOPT_WRITE_BITMAP,
- XAAOPT_WRITE_PIXMAP,
- XAAOPT_PIXMAP_CACHE,
- XAAOPT_OFFSCREEN_PIXMAPS,
- XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE
-} XAAOpts;
-
-static const OptionInfoRec XAAOptions[] = {
- {XAAOPT_SCREEN_TO_SCREEN_COPY, "XaaNoScreenToScreenCopy",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SOLID_FILL_RECT, "XaaNoSolidFillRect",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SOLID_FILL_TRAP, "XaaNoSolidFillTrap",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SOLID_TWO_POINT_LINE, "XaaNoSolidTwoPointLine",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SOLID_BRESENHAM_LINE, "XaaNoSolidBresenhamLine",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SOLID_HORVERT_LINE, "XaaNoSolidHorVertLine",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_DASHED_TWO_POINT_LINE, "XaaNoDashedTwoPointLine",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_DASHED_BRESENHAM_LINE, "XaaNoDashedBresenhamLine",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_MONO_8x8_PATTERN_FILL_RECT, "XaaNoMono8x8PatternFillRect",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, "XaaNoMono8x8PatternFillTrap",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_COL_8x8_PATTERN_FILL_RECT, "XaaNoColor8x8PatternFillRect",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_COL_8x8_PATTERN_FILL_TRAP, "XaaNoColor8x8PatternFillTrap",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL, "XaaNoCPUToScreenColorExpandFill",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,"XaaNoScanlineCPUToScreenColorExpandFill",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, "XaaNoScreenToScreenColorExpandFill",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_IMAGE_WRITE_RECT, "XaaNoImageWriteRect",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SCANLINE_IMAGE_WRITE_RECT, "XaaNoScanlineImageWriteRect",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_WRITE_BITMAP, "XaaNoWriteBitmap",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_WRITE_PIXMAP, "XaaNoWritePixmap",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_PIXMAP_CACHE, "XaaNoPixmapCache",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_OFFSCREEN_PIXMAPS, "XaaNoOffscreenPixmaps",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE, "XaaOffscreenPixmaps",
- OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL,
- OPTV_NONE, {0}, FALSE }
-};
-
-static XF86ModuleVersionInfo xaaVersRec =
-{
- "xaa",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- XAA_VERSION_MAJOR,
- XAA_VERSION_MINOR,
- XAA_VERSION_RELEASE,
- ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL };
-
-Bool
-XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
-{
- int index = pScreen->myNum;
- ScrnInfoPtr pScrn = xf86Screens[index];
- Bool HaveScreenToScreenCopy = FALSE;
- Bool HaveColorExpansion = FALSE;
- Bool HaveScanlineColorExpansion = FALSE;
- Bool HaveSolidFillRect = FALSE;
- Bool HaveMono8x8PatternFillRect = FALSE;
- Bool HaveColor8x8PatternFillRect = FALSE;
- Bool HaveSolidFillTrap = FALSE;
- Bool HaveMono8x8PatternFillTrap = FALSE;
- Bool HaveColor8x8PatternFillTrap = FALSE;
- Bool HaveSolidTwoPointLine = FALSE;
- Bool HaveSolidBresenhamLine = FALSE;
- Bool HaveSolidHorVertLine = FALSE;
- Bool HaveDashedTwoPointLine = FALSE;
- Bool HaveDashedBresenhamLine = FALSE;
- Bool HaveImageWriteRect = FALSE;
- Bool HaveScanlineImageWriteRect = FALSE;
- Bool HaveScreenToScreenColorExpandFill = FALSE;
- OptionInfoPtr options;
- int is_shared = 0;
- int i;
-
- options = xnfalloc(sizeof(XAAOptions));
- (void)memcpy(options, XAAOptions, sizeof(XAAOptions));
- xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
-
- infoRec->pScrn = pScrn;
- infoRec->NeedToSync = FALSE;
-
- /* must have a Sync function */
- if(!infoRec->Sync) return FALSE;
- for(i = 0; i < pScrn->numEntities; i++) {
- if(xf86IsEntityShared(pScrn->entityList[i])) is_shared = 1;
- }
-
- /* If this PCI entity has IS_SHARED_ACCEL set in entityProp
- * then a RestoreAccelState function is required
- */
- if(!infoRec->RestoreAccelState && is_shared) return FALSE;
-
- if(infoRec->RestoreAccelState) {
- if(!XAAInitStateWrap(pScreen, infoRec)) return FALSE;
- }
-
- if (serverGeneration == 1)
- xf86DrvMsg(index, X_INFO,
- "Using XFree86 Acceleration Architecture (XAA)\n");
-
-
- /************** Low Level *************/
-
- if(!infoRec->SetClippingRectangle || !infoRec->DisableClipping) {
- infoRec->ClippingFlags = 0;
- infoRec->SetClippingRectangle = NULL;
- infoRec->DisableClipping = NULL;
- }
-
- /**** CopyArea ****/
-
- if(infoRec->SetupForScreenToScreenCopy &&
- infoRec->SubsequentScreenToScreenCopy &&
- !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COPY, FALSE)) {
- HaveScreenToScreenCopy = TRUE;
- } else {
- infoRec->ScreenToScreenCopyFlags = 0;
- infoRec->SetupForScreenToScreenCopy = NULL;
- infoRec->SubsequentScreenToScreenCopy = NULL;
- }
-
- /**** Solid Filled Rects ****/
-
- if(infoRec->SetupForSolidFill && infoRec->SubsequentSolidFillRect &&
- !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_RECT, FALSE)) {
- HaveSolidFillRect = TRUE;
- if(infoRec->SubsequentSolidFillTrap &&
- !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_TRAP, FALSE))
- HaveSolidFillTrap = TRUE;
- else
- infoRec->SubsequentSolidFillTrap = NULL;
- } else {
- infoRec->SolidFillFlags = 0;
- infoRec->SetupForSolidFill = NULL;
- infoRec->SubsequentSolidFillRect = NULL;
- infoRec->SubsequentSolidFillTrap = NULL;
- }
-
- /**** Solid lines ****/
-
- if(infoRec->SetupForSolidLine) {
- if(infoRec->SubsequentSolidTwoPointLine &&
- !xf86ReturnOptValBool(options,
- XAAOPT_SOLID_TWO_POINT_LINE, FALSE))
- HaveSolidTwoPointLine = TRUE;
- if(infoRec->SubsequentSolidBresenhamLine &&
- !xf86ReturnOptValBool(options, XAAOPT_SOLID_BRESENHAM_LINE, FALSE)) {
- HaveSolidBresenhamLine = TRUE;
-
- if(infoRec->SolidBresenhamLineErrorTermBits)
- infoRec->SolidBresenhamLineErrorTermBits =
- ~((1 << infoRec->SolidBresenhamLineErrorTermBits) - 1);
- }
-
- if(infoRec->SubsequentSolidHorVertLine &&
- !xf86ReturnOptValBool(options,
- XAAOPT_SOLID_HORVERT_LINE, FALSE))
- HaveSolidHorVertLine = TRUE;
- else if(HaveSolidTwoPointLine) {
- infoRec->SubsequentSolidHorVertLine =
- XAASolidHorVertLineAsTwoPoint;
- HaveSolidHorVertLine = TRUE;
- } else if(HaveSolidBresenhamLine) {
- infoRec->SubsequentSolidHorVertLine =
- XAASolidHorVertLineAsBresenham;
- HaveSolidHorVertLine = TRUE;
- }
- }
-
- /* XXX Should this also check for XAAOPT_SOLID_HORVERT_LINE? */
- if (!HaveSolidTwoPointLine &&
- !HaveSolidBresenhamLine &&
- !HaveSolidHorVertLine &&
- HaveSolidFillRect) {
- infoRec->SetupForSolidLine = infoRec->SetupForSolidFill;
- infoRec->SubsequentSolidHorVertLine = XAASolidHorVertLineAsRects;
- infoRec->SolidLineFlags = infoRec->SolidFillFlags;
- HaveSolidHorVertLine = TRUE;
- }
-
- if (!HaveSolidTwoPointLine)
- infoRec->SubsequentSolidTwoPointLine = NULL;
- if (!HaveSolidBresenhamLine)
- infoRec->SubsequentSolidBresenhamLine = NULL;
- if (!HaveSolidHorVertLine)
- infoRec->SubsequentSolidHorVertLine = NULL;
-
- /* Disable all if nothing left over */
- if (!HaveSolidTwoPointLine &&
- !HaveSolidBresenhamLine &&
- !HaveSolidHorVertLine) {
- infoRec->SolidLineFlags = 0;
- infoRec->SetupForSolidLine = NULL;
- }
-
- /**** 8x8 Mono Pattern Filled Rects ****/
-
- if(infoRec->SetupForMono8x8PatternFill &&
- infoRec->SubsequentMono8x8PatternFillRect &&
- !xf86ReturnOptValBool(options,
- XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
- FALSE)) {
- HaveMono8x8PatternFillRect = TRUE;
- if(infoRec->SubsequentMono8x8PatternFillTrap &&
- !xf86ReturnOptValBool(options,
- XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
- FALSE))
- HaveMono8x8PatternFillTrap = TRUE;
-
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_BITS) {
- infoRec->CanDoMono8x8 = TRUE;
- } else { /* others require caching */
- int min_pitch;
- infoRec->PixmapCacheFlags |= CACHE_MONO_8x8;
-
- switch(pScrn->bitsPerPixel) {
- case 32: min_pitch = 2; break;
- case 24: min_pitch = 3; break;
- case 16: min_pitch = 4; break;
- default: min_pitch = 8; break;
- }
-
- if(min_pitch > infoRec->MonoPatternPitch)
- infoRec->MonoPatternPitch = min_pitch;
-
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
- if(!infoRec->CacheWidthMono8x8Pattern ||
- !infoRec->CacheHeightMono8x8Pattern) {
- infoRec->CacheWidthMono8x8Pattern =
- infoRec->MonoPatternPitch;
- infoRec->CacheHeightMono8x8Pattern = 1;
- }
- } else {
- int numPerLine = 128/infoRec->MonoPatternPitch;
-
- if(!infoRec->CacheWidthMono8x8Pattern ||
- !infoRec->CacheHeightMono8x8Pattern) {
- infoRec->CacheWidthMono8x8Pattern =
- numPerLine * infoRec->MonoPatternPitch;
- infoRec->CacheHeightMono8x8Pattern =
- (64 + numPerLine - 1)/numPerLine;
- }
- }
- }
- } else {
- infoRec->Mono8x8PatternFillFlags = 0;
- infoRec->SetupForMono8x8PatternFill = NULL;
- infoRec->SubsequentMono8x8PatternFillRect = NULL;
- }
-
- /**** Dashed lines ****/
-
- if(infoRec->SetupForDashedLine && infoRec->DashPatternMaxLength) {
- if(infoRec->SubsequentDashedTwoPointLine &&
- !xf86ReturnOptValBool(options, XAAOPT_DASHED_TWO_POINT_LINE,
- FALSE))
- HaveDashedTwoPointLine = TRUE;
- if(infoRec->SubsequentDashedBresenhamLine &&
- !xf86ReturnOptValBool(options, XAAOPT_DASHED_BRESENHAM_LINE,
- FALSE)) {
- HaveDashedBresenhamLine = TRUE;
-
- if(infoRec->DashedBresenhamLineErrorTermBits)
- infoRec->DashedBresenhamLineErrorTermBits =
- ~((1 << infoRec->DashedBresenhamLineErrorTermBits) - 1);
- }
- }
-
- if (!HaveDashedTwoPointLine)
- infoRec->SubsequentDashedTwoPointLine = NULL;
- if (!HaveDashedBresenhamLine)
- infoRec->SubsequentDashedBresenhamLine = NULL;
-
- /* Disable all if nothing left over */
- if (!HaveDashedTwoPointLine && !HaveDashedBresenhamLine) {
- infoRec->DashedLineFlags = 0;
- infoRec->SetupForDashedLine = NULL;
- }
-
- /**** 8x8 Color Pattern Filled Rects ****/
-
- if(infoRec->SetupForColor8x8PatternFill &&
- infoRec->SubsequentColor8x8PatternFillRect &&
- !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT, FALSE)) {
- HaveColor8x8PatternFillRect = TRUE;
- if(infoRec->SubsequentColor8x8PatternFillTrap &&
- !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
- FALSE))
- HaveColor8x8PatternFillTrap = TRUE;
- else
- infoRec->SubsequentColor8x8PatternFillTrap = NULL;
-
- infoRec->PixmapCacheFlags |= CACHE_COLOR_8x8;
-
- if(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
- if(!infoRec->CacheWidthColor8x8Pattern ||
- !infoRec->CacheHeightColor8x8Pattern) {
- infoRec->CacheWidthColor8x8Pattern = 64;
- infoRec->CacheHeightColor8x8Pattern = 1;
- }
- } else {
- if(!infoRec->CacheWidthColor8x8Pattern ||
- !infoRec->CacheHeightColor8x8Pattern) {
- infoRec->CacheWidthColor8x8Pattern = 128;
- infoRec->CacheHeightColor8x8Pattern = 8;
- }
- }
- } else {
- infoRec->Color8x8PatternFillFlags = 0;
- infoRec->SetupForColor8x8PatternFill = NULL;
- infoRec->SubsequentColor8x8PatternFillRect = NULL;
- infoRec->SubsequentColor8x8PatternFillTrap = NULL;
- }
-
- /**** Color Expansion ****/
-
- if(infoRec->SetupForCPUToScreenColorExpandFill &&
- infoRec->ColorExpandBase &&
- infoRec->SubsequentCPUToScreenColorExpandFill &&
- !xf86ReturnOptValBool(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
- FALSE)) {
- int dwordsNeeded = pScrn->virtualX;
-
- infoRec->ColorExpandRange >>= 2; /* convert to DWORDS */
- HaveColorExpansion = TRUE;
-
- if(infoRec->CPUToScreenColorExpandFillFlags &
- LEFT_EDGE_CLIPPING_NEGATIVE_X)
- dwordsNeeded += 31;
- dwordsNeeded = (dwordsNeeded + 31) >> 5;
- if(dwordsNeeded > infoRec->ColorExpandRange)
- infoRec->CPUToScreenColorExpandFillFlags |= CPU_TRANSFER_BASE_FIXED;
- } else {
- infoRec->CPUToScreenColorExpandFillFlags = 0;
- infoRec->SetupForCPUToScreenColorExpandFill = NULL;
- infoRec->SubsequentCPUToScreenColorExpandFill = NULL;
- }
-
- /**** Scanline Color Expansion ****/
-
- if(infoRec->SetupForScanlineCPUToScreenColorExpandFill &&
- infoRec->SubsequentScanlineCPUToScreenColorExpandFill &&
- infoRec->SubsequentColorExpandScanline &&
- infoRec->ScanlineColorExpandBuffers &&
- (infoRec->NumScanlineColorExpandBuffers > 0) &&
- !xf86ReturnOptValBool(options,
- XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
- FALSE)) {
- HaveScanlineColorExpansion = TRUE;
- } else {
- infoRec->ScanlineCPUToScreenColorExpandFillFlags = 0;
- infoRec->SetupForScanlineCPUToScreenColorExpandFill = NULL;
- infoRec->SubsequentScanlineCPUToScreenColorExpandFill = NULL;
- infoRec->SubsequentColorExpandScanline = NULL;
- }
-
- /**** Screen to Screen Color Expansion ****/
-
- if(infoRec->SetupForScreenToScreenColorExpandFill &&
- infoRec->SubsequentScreenToScreenColorExpandFill &&
- !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
- FALSE)) {
- HaveScreenToScreenColorExpandFill = TRUE;
- if (!infoRec->CacheColorExpandDensity)
- infoRec->CacheColorExpandDensity = 1;
- } else {
- infoRec->ScreenToScreenColorExpandFillFlags = 0;
- infoRec->SetupForScreenToScreenColorExpandFill = NULL;
- infoRec->SubsequentScreenToScreenColorExpandFill = NULL;
- }
-
- /**** Image Writes ****/
-
- if(infoRec->SetupForImageWrite && infoRec->ImageWriteBase &&
- infoRec->SubsequentImageWriteRect &&
- !xf86ReturnOptValBool(options, XAAOPT_IMAGE_WRITE_RECT, FALSE)) {
-
- infoRec->ImageWriteRange >>= 2; /* convert to DWORDS */
- if(infoRec->ImageWriteFlags & CPU_TRANSFER_BASE_FIXED)
- infoRec->ImageWriteRange = 0;
- HaveImageWriteRect = TRUE;
- } else {
- infoRec->ImageWriteFlags = 0;
- infoRec->SetupForImageWrite = NULL;
- infoRec->SubsequentImageWriteRect = NULL;
- }
-
- /**** Scanline Image Writes ****/
-
- if(infoRec->SetupForScanlineImageWrite &&
- infoRec->SubsequentScanlineImageWriteRect &&
- infoRec->SubsequentImageWriteScanline &&
- infoRec->ScanlineImageWriteBuffers &&
- (infoRec->NumScanlineImageWriteBuffers > 0) &&
- !xf86ReturnOptValBool(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
- FALSE)) {
- HaveScanlineImageWriteRect = TRUE;
- } else {
- infoRec->ScanlineImageWriteFlags = 0;
- infoRec->SetupForScanlineImageWrite = NULL;
- infoRec->SubsequentScanlineImageWriteRect = NULL;
- infoRec->SubsequentImageWriteScanline = NULL;
- }
-
-#ifndef __i386__
- /* XAA makes some unaligned accesses when clipping is not available */
-# define CLIP_FLAGS (LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X)
- if(HaveImageWriteRect &&
- ((infoRec->ImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS))
- {
- HaveImageWriteRect = FALSE;
- }
- if(HaveScanlineImageWriteRect &&
- ((infoRec->ScanlineImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS))
- {
- HaveScanlineImageWriteRect = FALSE;
- }
-#endif
-
- if (serverGeneration == 1) {
- if(HaveScreenToScreenCopy)
- xf86ErrorF("\tScreen to screen bit blits\n");
- if(HaveSolidFillRect)
- xf86ErrorF("\tSolid filled rectangles\n");
- if(HaveSolidFillTrap)
- xf86ErrorF("\tSolid filled trapezoids\n");
- if(HaveMono8x8PatternFillRect)
- xf86ErrorF("\t8x8 mono pattern filled rectangles\n");
- if(HaveMono8x8PatternFillTrap)
- xf86ErrorF("\t8x8 mono pattern filled trapezoids\n");
- if(HaveColor8x8PatternFillRect)
- xf86ErrorF("\t8x8 color pattern filled rectangles\n");
- if(HaveColor8x8PatternFillTrap)
- xf86ErrorF("\t8x8 color pattern filled trapezoids\n");
-
- if(HaveColorExpansion)
- xf86ErrorF("\tCPU to Screen color expansion\n");
- else if(HaveScanlineColorExpansion)
- xf86ErrorF("\tIndirect CPU to Screen color expansion\n");
-
- if(HaveScreenToScreenColorExpandFill)
- xf86ErrorF("\tScreen to Screen color expansion\n");
-
- if(HaveSolidTwoPointLine || HaveSolidBresenhamLine)
- xf86ErrorF("\tSolid Lines\n");
- else if(HaveSolidHorVertLine)
- xf86ErrorF("\tSolid Horizontal and Vertical Lines\n");
-
- if(HaveDashedTwoPointLine || HaveDashedBresenhamLine)
- xf86ErrorF("\tDashed Lines\n");
-
- if(HaveImageWriteRect)
- xf86ErrorF("\tImage Writes\n");
- else if(HaveScanlineImageWriteRect)
- xf86ErrorF("\tScanline Image Writes\n");
-
- }
-
-#define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0)
-
- if((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy &&
- xf86ReturnOptValBool(options,
- XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE,
- FALSE))
- {
- XAAMSG("\tOffscreen Pixmaps\n");
- } else {
- infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
- }
-
-
- /************** Mid Level *************/
-
- /**** ScreenToScreenBitBlt ****/
-
- if(infoRec->ScreenToScreenBitBlt) {
- XAAMSG("\tDriver provided ScreenToScreenBitBlt replacement\n");
- } else if(HaveScreenToScreenCopy) {
- infoRec->ScreenToScreenBitBlt = XAAScreenToScreenBitBlt;
- infoRec->ScreenToScreenBitBltFlags = infoRec->ScreenToScreenCopyFlags;
- }
-
- /**** FillSolidRects ****/
-
- if(infoRec->FillSolidRects) {
- XAAMSG("\tDriver provided FillSolidRects replacement\n");
- } else if(HaveSolidFillRect) {
- infoRec->FillSolidRects = XAAFillSolidRects;
- infoRec->FillSolidRectsFlags = infoRec->SolidFillFlags;
- }
-
- /**** FillSolidSpans ****/
-
- if(infoRec->FillSolidSpans) {
- XAAMSG("\tDriver provided FillSolidSpans replacement\n");
- } else if(HaveSolidFillRect) {
- infoRec->FillSolidSpans = XAAFillSolidSpans;
- infoRec->FillSolidSpansFlags = infoRec->SolidFillFlags;
- }
-
- /**** FillMono8x8PatternRects ****/
-
- if(infoRec->FillMono8x8PatternRects) {
- XAAMSG("\tDriver provided FillMono8x8PatternRects replacement\n");
- } else if(HaveMono8x8PatternFillRect) {
- infoRec->FillMono8x8PatternRects =
- (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
- XAAFillMono8x8PatternRectsScreenOrigin :
- XAAFillMono8x8PatternRects;
-
- infoRec->FillMono8x8PatternRectsFlags =
- infoRec->Mono8x8PatternFillFlags;
- }
-
- /**** FillMono8x8PatternSpans ****/
-
- if(infoRec->FillMono8x8PatternSpans) {
- XAAMSG("\tDriver provided FillMono8x8PatternSpans replacement\n");
- } else if(HaveMono8x8PatternFillRect) {
- infoRec->FillMono8x8PatternSpans =
- (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
- XAAFillMono8x8PatternSpansScreenOrigin:
- XAAFillMono8x8PatternSpans;
-
- infoRec->FillMono8x8PatternSpansFlags =
- infoRec->Mono8x8PatternFillFlags;
- }
-
- /**** FillColor8x8Rects ****/
-
- if(infoRec->FillColor8x8PatternRects) {
- XAAMSG("\tDriver provided FillColor8x8PatternRects replacement\n");
- } else if(HaveColor8x8PatternFillRect) {
- infoRec->FillColor8x8PatternRects =
- (infoRec->Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
- XAAFillColor8x8PatternRectsScreenOrigin :
- XAAFillColor8x8PatternRects;
-
- infoRec->FillColor8x8PatternRectsFlags =
- infoRec->Color8x8PatternFillFlags;
- }
-
- /**** FillColor8x8Spans ****/
-
- if(infoRec->FillColor8x8PatternSpans) {
- XAAMSG("\tDriver provided FillColor8x8PatternSpans replacement\n");
- } else if(HaveColor8x8PatternFillRect) {
- infoRec->FillColor8x8PatternSpans =
- (infoRec->Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
- XAAFillColor8x8PatternSpansScreenOrigin:
- XAAFillColor8x8PatternSpans;
-
- infoRec->FillColor8x8PatternSpansFlags =
- infoRec->Color8x8PatternFillFlags;
- }
-
- /**** FillCacheBltRects ****/
-
- if(infoRec->FillCacheBltRects) {
- XAAMSG("\tDriver provided FillCacheBltRects replacement\n");
- } else if(HaveScreenToScreenCopy) {
- infoRec->FillCacheBltRects = XAAFillCacheBltRects;
- infoRec->FillCacheBltRectsFlags = infoRec->ScreenToScreenCopyFlags;
- }
-
- /**** FillCacheBltSpans ****/
-
- if(infoRec->FillCacheBltSpans) {
- XAAMSG("\tDriver provided FillCacheBltSpans replacement\n");
- } else if(HaveScreenToScreenCopy) {
- infoRec->FillCacheBltSpans = XAAFillCacheBltSpans;
- infoRec->FillCacheBltSpansFlags = infoRec->ScreenToScreenCopyFlags;
- }
-
- /**** FillCacheExpandRects ****/
-
- if(infoRec->FillCacheExpandRects) {
- XAAMSG("\tDriver provided FillCacheExpandRects replacement\n");
- } else if(HaveScreenToScreenColorExpandFill) {
- infoRec->FillCacheExpandRects = XAAFillCacheExpandRects;
- infoRec->FillCacheExpandRectsFlags =
- infoRec->ScreenToScreenColorExpandFillFlags;
- }
-
- /**** FillCacheExpandSpans ****/
-
- if(infoRec->FillCacheExpandSpans) {
- XAAMSG("\tDriver provided FillCacheExpandSpans replacement\n");
- } else if(HaveScreenToScreenColorExpandFill) {
- infoRec->FillCacheExpandSpans = XAAFillCacheExpandSpans;
- infoRec->FillCacheExpandSpansFlags =
- infoRec->ScreenToScreenColorExpandFillFlags;
- }
-
- /**** FillColorExpandRects ****/
-
- if(infoRec->FillColorExpandRects) {
- XAAMSG("\tDriver provided FillColorExpandRects replacement\n");
- } else if(HaveColorExpansion) {
- if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRects3MSBFirstFixedBase;
- else
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRects3MSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRects3LSBFirstFixedBase;
- else
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRects3LSBFirst;
- }
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRectsMSBFirstFixedBase;
- else
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRectsMSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRectsLSBFirstFixedBase;
- else
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRectsLSBFirst;
- }
- }
- infoRec->FillColorExpandRectsFlags =
- infoRec->CPUToScreenColorExpandFillFlags;
- } else if(HaveScanlineColorExpansion) {
- if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- TRIPLE_BITS_24BPP) {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->FillColorExpandRects =
- XAAFillScanlineColorExpandRects3MSBFirst;
- else
- infoRec->FillColorExpandRects =
- XAAFillScanlineColorExpandRects3LSBFirst;
- } else {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->FillColorExpandRects =
- XAAFillScanlineColorExpandRectsMSBFirst;
- else
- infoRec->FillColorExpandRects =
- XAAFillScanlineColorExpandRectsLSBFirst;
- }
- infoRec->FillColorExpandRectsFlags =
- infoRec->ScanlineCPUToScreenColorExpandFillFlags;
- }
-
- /**** FillColorExpandSpans ****/
-
- if(infoRec->FillColorExpandSpans) {
- XAAMSG("\tDriver provided FillColorExpandSpans replacement\n");
- } else if(HaveColorExpansion) {
- if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpans3MSBFirstFixedBase;
- else
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpans3MSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpans3LSBFirstFixedBase;
- else
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpans3LSBFirst;
- }
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpansMSBFirstFixedBase;
- else
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpansMSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpansLSBFirstFixedBase;
- else
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpansLSBFirst;
- }
- }
- infoRec->FillColorExpandSpansFlags =
- infoRec->CPUToScreenColorExpandFillFlags;
- } else if(HaveScanlineColorExpansion) {
- if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- TRIPLE_BITS_24BPP) {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->FillColorExpandSpans =
- XAAFillScanlineColorExpandSpans3MSBFirst;
- else
- infoRec->FillColorExpandSpans =
- XAAFillScanlineColorExpandSpans3LSBFirst;
- } else {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->FillColorExpandSpans =
- XAAFillScanlineColorExpandSpansMSBFirst;
- else
- infoRec->FillColorExpandSpans =
- XAAFillScanlineColorExpandSpansLSBFirst;
- }
- infoRec->FillColorExpandSpansFlags =
- infoRec->ScanlineCPUToScreenColorExpandFillFlags;
- }
-
- /**** FillImageWriteRects ****/
-
- if(infoRec->FillImageWriteRects) {
- XAAMSG("\tDriver provided FillImageWriteRects replacement\n");
- } else if(HaveImageWriteRect &&
- (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
- (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
- infoRec->FillImageWriteRects = XAAFillImageWriteRects;
- infoRec->FillImageWriteRectsFlags = infoRec->ImageWriteFlags;
- }
-
- /**** WriteBitmap ****/
-
- if(infoRec->WriteBitmap &&
- !xf86ReturnOptValBool(options, XAAOPT_WRITE_BITMAP, FALSE)) {
- XAAMSG("\tDriver provided WriteBitmap replacement\n");
- } else if(HaveColorExpansion) {
- if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->WriteBitmap =
- XAAWriteBitmapColorExpand3MSBFirstFixedBase;
- else
- infoRec->WriteBitmap = XAAWriteBitmapColorExpand3MSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->WriteBitmap =
- XAAWriteBitmapColorExpand3LSBFirstFixedBase;
- else
- infoRec->WriteBitmap = XAAWriteBitmapColorExpand3LSBFirst;
- }
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->WriteBitmap =
- XAAWriteBitmapColorExpandMSBFirstFixedBase;
- else
- infoRec->WriteBitmap = XAAWriteBitmapColorExpandMSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->WriteBitmap =
- XAAWriteBitmapColorExpandLSBFirstFixedBase;
- else
- infoRec->WriteBitmap = XAAWriteBitmapColorExpandLSBFirst;
- }
- }
- infoRec->WriteBitmapFlags = infoRec->CPUToScreenColorExpandFillFlags;
- } else if(HaveScanlineColorExpansion) {
- if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- TRIPLE_BITS_24BPP) {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->WriteBitmap =
- XAAWriteBitmapScanlineColorExpand3MSBFirst;
- else
- infoRec->WriteBitmap =
- XAAWriteBitmapScanlineColorExpand3LSBFirst;
- } else {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->WriteBitmap =
- XAAWriteBitmapScanlineColorExpandMSBFirst;
- else
- infoRec->WriteBitmap =
- XAAWriteBitmapScanlineColorExpandLSBFirst;
- }
- infoRec->WriteBitmapFlags =
- infoRec->ScanlineCPUToScreenColorExpandFillFlags;
- } else
- infoRec->WriteBitmap = NULL;
-
- /**** TE Glyphs ****/
-
- if (infoRec->TEGlyphRenderer) {
- XAAMSG("\tDriver provided TEGlyphRenderer replacement\n");
- } else if (HaveColorExpansion) {
- infoRec->TEGlyphRendererFlags =
- infoRec->CPUToScreenColorExpandFillFlags;
-
- if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
- if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
- if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
- infoRec->TEGlyphRenderer =
- XAATEGlyphRenderer3MSBFirstFixedBase;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRenderer3MSBFirst;
- } else {
- if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
- infoRec->TEGlyphRenderer =
- XAATEGlyphRenderer3LSBFirstFixedBase;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRenderer3LSBFirst;
- }
-
- if (!HaveSolidFillRect &&
- (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
- infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
- XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
- " without solid fills\n");
- }
- } else {
- if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
- if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
- infoRec->TEGlyphRenderer =
- XAATEGlyphRendererMSBFirstFixedBase;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRendererMSBFirst;
- } else {
- if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
- infoRec->TEGlyphRenderer =
- XAATEGlyphRendererLSBFirstFixedBase;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRendererLSBFirst;
- }
- }
-
- if (!HaveSolidFillRect &&
- (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
- infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
- XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
- " without solid fills\n");
- }
-
- } else if (HaveScanlineColorExpansion) {
- infoRec->TEGlyphRendererFlags =
- infoRec->ScanlineCPUToScreenColorExpandFillFlags;
-
- if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
- if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3MSBFirst;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3LSBFirst;
-
- if (!HaveSolidFillRect &&
- (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
- infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
- XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
- " without solid fills\n");
- }
- } else {
- if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineMSBFirst;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineLSBFirst;
- }
-
- if (!HaveSolidFillRect &&
- (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
- infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
- XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
- " without solid fills\n");
- }
- }
-
- /**** NonTE Glyphs ****/
-
- if(infoRec->NonTEGlyphRenderer) {
- XAAMSG("\tDriver provided NonTEGlyphRenderer replacement\n");
- } else if(infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
- infoRec->NonTEGlyphRenderer = XAANonTEGlyphRenderer;
- infoRec->NonTEGlyphRendererFlags = infoRec->WriteBitmapFlags;
- }
-
- /**** WritePixmap ****/
-
- if(infoRec->WritePixmap &&
- !xf86ReturnOptValBool(options, XAAOPT_WRITE_PIXMAP, FALSE)) {
- XAAMSG("\tDriver provided WritePixmap replacement\n");
- } else if(HaveImageWriteRect) {
- infoRec->WritePixmap = XAAWritePixmap;
- infoRec->WritePixmapFlags =
- infoRec->ImageWriteFlags | CONVERT_32BPP_TO_24BPP;
- } else if(HaveScanlineImageWriteRect) {
- infoRec->WritePixmap = XAAWritePixmapScanline;
- infoRec->WritePixmapFlags = infoRec->ScanlineImageWriteFlags;
- } else
- infoRec->WritePixmap = NULL;
-
- /**** ReadPixmap ****/
-
- if(infoRec->ReadPixmap) {
- XAAMSG("\tDriver provided ReadPixmap replacement\n");
- }
-
-
- /************** GC Level *************/
-
- /**** CopyArea ****/
-
- if(infoRec->CopyArea) {
- XAAMSG("\tDriver provided GC level CopyArea replacement\n");
- } else if(infoRec->ScreenToScreenBitBlt) {
- infoRec->CopyArea = XAACopyArea;
- infoRec->CopyAreaFlags = infoRec->ScreenToScreenBitBltFlags;
-
- /* most GC level primitives use one mid-level primitive so
- the GC level primitive gets the mid-level primitive flag
- and we use that at GC validation time. But CopyArea uses
- more than one mid-level primitive so we have to essentially
- do a GC validation every time that primitive is used.
- The CopyAreaFlags would only be used for filtering out the
- common denominators. Here we assume that if you don't do
- ScreenToScreenBitBlt you aren't going to do the others.
- We also assume that ScreenToScreenBitBlt has the least
- restrictions. */
- }
-
- if(infoRec->CopyPlane) {
- XAAMSG("\tDriver provided GC level CopyPlane replacement\n");
- } else if(infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) {
- infoRec->CopyPlane = XAACopyPlaneColorExpansion;
- infoRec->CopyPlaneFlags = infoRec->WriteBitmapFlags;
- }
-
- if(infoRec->PushPixelsSolid) {
- XAAMSG("\tDriver provided GC level PushPixelsSolid replacement\n");
- } else if(infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
- infoRec->PushPixelsSolid = XAAPushPixelsSolidColorExpansion;
- infoRec->PushPixelsFlags = infoRec->WriteBitmapFlags;
- }
-
- if(infoRec->FillSolidRects) {
- if(!infoRec->PolyFillRectSolid) {
- infoRec->PolyFillRectSolid = XAAPolyFillRect;
- infoRec->PolyFillRectSolidFlags = infoRec->FillSolidRectsFlags;
- }
- }
- if(infoRec->FillSolidSpans) {
- if(!infoRec->FillSpansSolid) {
- infoRec->FillSpansSolid = XAAFillSpans;
- infoRec->FillSpansSolidFlags = infoRec->FillSolidSpansFlags;
- }
- }
-
- if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
- infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
- infoRec->FillCacheExpandRects) {
- if(!infoRec->PolyFillRectStippled) {
-
- infoRec->PolyFillRectStippled = XAAPolyFillRect;
- infoRec->PolyFillRectStippledFlags = 0;
- }
- }
-
- if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
- infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
- infoRec->FillCacheExpandSpans) {
- if(!infoRec->FillSpansStippled) {
-
- infoRec->FillSpansStippled = XAAFillSpans;
- infoRec->FillSpansStippledFlags = 0;
- }
- }
-
- if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
- infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
- infoRec->FillCacheExpandRects) {
- if(!infoRec->PolyFillRectOpaqueStippled) {
-
- infoRec->PolyFillRectOpaqueStippled = XAAPolyFillRect;
- infoRec->PolyFillRectOpaqueStippledFlags = 0;
- }
- }
-
- if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
- infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
- infoRec->FillCacheExpandSpans) {
- if(!infoRec->FillSpansOpaqueStippled) {
-
- infoRec->FillSpansOpaqueStippled = XAAFillSpans;
- infoRec->FillSpansOpaqueStippledFlags = 0;
- }
- }
-
- if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
- infoRec->FillCacheBltRects || infoRec->FillImageWriteRects) {
- if(!infoRec->PolyFillRectTiled) {
-
- infoRec->PolyFillRectTiled = XAAPolyFillRect;
- infoRec->PolyFillRectTiledFlags = 0;
- }
- }
-
- if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
- infoRec->FillCacheBltSpans) {
- if(!infoRec->FillSpansTiled) {
-
- infoRec->FillSpansTiled = XAAFillSpans;
- infoRec->FillSpansTiledFlags = 0;
- }
- }
-
- if(infoRec->TEGlyphRenderer &&
- !(infoRec->TEGlyphRendererFlags & NO_TRANSPARENCY)) {
-
- if(!infoRec->PolyText8TE) {
- infoRec->PolyText8TE = XAAPolyText8TEColorExpansion;
- infoRec->PolyText8TEFlags = infoRec->TEGlyphRendererFlags;
- }
-
- if(!infoRec->PolyText16TE) {
- infoRec->PolyText16TE = XAAPolyText16TEColorExpansion;
- infoRec->PolyText16TEFlags = infoRec->TEGlyphRendererFlags;
- }
-
- if(!infoRec->PolyGlyphBltTE) {
- infoRec->PolyGlyphBltTE = XAAPolyGlyphBltTEColorExpansion;
- infoRec->PolyGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
- }
- }
-
- if(infoRec->TEGlyphRenderer &&
- !(infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
-
- if(!infoRec->ImageText8TE) {
- infoRec->ImageText8TE = XAAImageText8TEColorExpansion;
- infoRec->ImageText8TEFlags = infoRec->TEGlyphRendererFlags;
- }
-
- if(!infoRec->ImageText16TE) {
- infoRec->ImageText16TE = XAAImageText16TEColorExpansion;
- infoRec->ImageText16TEFlags = infoRec->TEGlyphRendererFlags;
- }
-
- if(!infoRec->ImageGlyphBltTE) {
- infoRec->ImageGlyphBltTE = XAAImageGlyphBltTEColorExpansion;
- infoRec->ImageGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
- }
- }
-
- if(infoRec->NonTEGlyphRenderer) {
- if(!infoRec->PolyText8NonTE) {
- infoRec->PolyText8NonTE = XAAPolyText8NonTEColorExpansion;
- infoRec->PolyText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
-
- if(!infoRec->PolyText16NonTE) {
- infoRec->PolyText16NonTE = XAAPolyText16NonTEColorExpansion;
- infoRec->PolyText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
- if(!infoRec->PolyGlyphBltNonTE) {
- infoRec->PolyGlyphBltNonTE = XAAPolyGlyphBltNonTEColorExpansion;
- infoRec->PolyGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
- }
-
- if(infoRec->NonTEGlyphRenderer && HaveSolidFillRect) {
- if(!infoRec->ImageText8NonTE) {
- infoRec->ImageText8NonTE = XAAImageText8NonTEColorExpansion;
- infoRec->ImageText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
-
- if(!infoRec->ImageText16NonTE) {
- infoRec->ImageText16NonTE = XAAImageText16NonTEColorExpansion;
- infoRec->ImageText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
-
- if(!infoRec->ImageGlyphBltNonTE) {
- infoRec->ImageGlyphBltNonTE = XAAImageGlyphBltNonTEColorExpansion;
- infoRec->ImageGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
- }
-
- if(!infoRec->PolyRectangleThinSolid && HaveSolidHorVertLine) {
- infoRec->PolyRectangleThinSolid = XAAPolyRectangleThinSolid;
- infoRec->PolyRectangleThinSolidFlags = infoRec->SolidLineFlags;
- }
-
- if(!infoRec->FillPolygonSolid && HaveSolidFillRect) {
- infoRec->FillPolygonSolid = XAAFillPolygonSolid;
- infoRec->FillPolygonSolidFlags = infoRec->SolidFillFlags;
- }
-
- if(!infoRec->FillPolygonStippled && (HaveMono8x8PatternFillRect ||
- HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
- infoRec->FillPolygonStippled = XAAFillPolygonStippled;
- infoRec->FillPolygonStippledFlags = infoRec->SolidFillFlags;
- }
-
- if(!infoRec->FillPolygonOpaqueStippled && (HaveMono8x8PatternFillRect ||
- HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
- infoRec->FillPolygonOpaqueStippled = XAAFillPolygonStippled;
- infoRec->FillPolygonOpaqueStippledFlags = infoRec->SolidFillFlags;
- }
-
- if(!infoRec->FillPolygonTiled && (HaveMono8x8PatternFillRect ||
- HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
- infoRec->FillPolygonTiled = XAAFillPolygonTiled;
- infoRec->FillPolygonTiledFlags = infoRec->SolidFillFlags;
- }
-
-
- if(!infoRec->PolyFillArcSolid && HaveSolidFillRect) {
- infoRec->PolyFillArcSolid = XAAPolyFillArcSolid;
- infoRec->PolyFillArcSolidFlags = infoRec->SolidFillFlags;
- }
-
- if(!infoRec->PolylinesWideSolid && HaveSolidFillRect) {
- infoRec->PolylinesWideSolid = XAAPolylinesWideSolid;
- infoRec->PolylinesWideSolidFlags =
- infoRec->SolidFillFlags | GXCOPY_ONLY;
- }
-
- if(!infoRec->PutImage && (infoRec->WritePixmap ||
- (infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)))) {
- infoRec->PutImage = XAAPutImage;
-
- /* See comment for CopyArea above. But here we make fewer
- assumptions. The driver can provide the PutImageFlags if
- it wants too */
- }
-
- if(HaveSolidHorVertLine &&
- (HaveSolidBresenhamLine || (HaveSolidTwoPointLine &&
- (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_LINE)))){
- if(!infoRec->PolylinesThinSolid) {
- infoRec->PolylinesThinSolid = XAAPolyLines;
- infoRec->PolylinesThinSolidFlags = infoRec->SolidLineFlags;
- }
- if(!infoRec->PolySegmentThinSolid) {
- infoRec->PolySegmentThinSolid = XAAPolySegment;
- infoRec->PolySegmentThinSolidFlags = infoRec->SolidLineFlags;
- }
- }
-
- if(HaveDashedBresenhamLine || (HaveDashedTwoPointLine &&
- (infoRec->ClippingFlags & HARDWARE_CLIP_DASHED_LINE))){
- if(!infoRec->PolylinesThinDashed) {
- infoRec->PolylinesThinDashed = XAAPolyLinesDashed;
- infoRec->PolylinesThinDashedFlags = infoRec->DashedLineFlags;
- }
- if(!infoRec->PolySegmentThinDashed) {
- infoRec->PolySegmentThinDashed = XAAPolySegmentDashed;
- infoRec->PolySegmentThinDashedFlags = infoRec->DashedLineFlags;
- }
- }
-
- if(infoRec->PolylinesThinDashed || infoRec->PolySegmentThinDashed) {
- if(!infoRec->ComputeDash)
- infoRec->ComputeDash = XAAComputeDash;
- }
-
- {
- Bool haveTexture = infoRec->CPUToScreenTextureFormats &&
- infoRec->CPUToScreenTextureDstFormats &&
- infoRec->SetupForCPUToScreenTexture2 &&
- infoRec->SubsequentCPUToScreenTexture;
- Bool haveAlphaTexture = infoRec->CPUToScreenAlphaTextureFormats &&
- infoRec->CPUToScreenAlphaTextureDstFormats &&
- infoRec->SetupForCPUToScreenAlphaTexture2 &&
- infoRec->SubsequentCPUToScreenAlphaTexture;
-
- if(!infoRec->Composite && (haveTexture || haveAlphaTexture))
- infoRec->Composite = XAADoComposite;
-
- if(!infoRec->Glyphs && infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY))
- {
- infoRec->Glyphs = XAADoGlyphs;
- }
- }
-
- /************ Validation Functions **************/
-
- if(!infoRec->ValidateCopyArea && infoRec->CopyArea) {
- infoRec->CopyAreaMask = GCWhenForced;
- if((infoRec->CopyAreaFlags & GXCOPY_ONLY) ||
- (infoRec->CopyAreaFlags & ROP_NEEDS_SOURCE))
- infoRec->CopyAreaMask |= GCFunction;
- if(infoRec->CopyAreaFlags & NO_PLANEMASK)
- infoRec->CopyAreaMask |= GCPlaneMask;
- infoRec->ValidateCopyArea = XAAValidateCopyArea;
- }
-
- if(!infoRec->ValidateCopyPlane && infoRec->CopyPlane) {
- infoRec->CopyPlaneMask = GCWhenForced;
- if((infoRec->CopyPlaneFlags & GXCOPY_ONLY) ||
- (infoRec->CopyPlaneFlags & ROP_NEEDS_SOURCE))
- infoRec->CopyPlaneMask |= GCFunction;
- if(infoRec->CopyPlaneFlags & NO_PLANEMASK)
- infoRec->CopyPlaneMask |= GCPlaneMask;
- if(infoRec->CopyPlaneFlags & RGB_EQUAL)
- infoRec->CopyPlaneMask |= GCForeground | GCBackground;
- infoRec->ValidateCopyPlane = XAAValidateCopyPlane;
- }
-
- if(!infoRec->ValidatePutImage && infoRec->PutImage) {
- infoRec->PutImageMask = GCWhenForced;
- if((infoRec->PutImageFlags & GXCOPY_ONLY) ||
- (infoRec->PutImageFlags & ROP_NEEDS_SOURCE))
- infoRec->PutImageMask |= GCFunction;
- if(infoRec->PutImageFlags & NO_PLANEMASK)
- infoRec->PutImageMask |= GCPlaneMask;
- if(infoRec->PutImageFlags & RGB_EQUAL)
- infoRec->PutImageMask |= GCForeground | GCBackground;
- infoRec->ValidatePutImage = XAAValidatePutImage;
- }
-
-
- if(!infoRec->ValidatePushPixels && infoRec->PushPixelsSolid) {
- infoRec->PushPixelsMask = GCFillStyle;
- if((infoRec->PushPixelsFlags & GXCOPY_ONLY) ||
- (infoRec->PushPixelsFlags & ROP_NEEDS_SOURCE) ||
- (infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY))
- infoRec->PushPixelsMask |= GCFunction;
- if(infoRec->PushPixelsFlags & NO_PLANEMASK)
- infoRec->PushPixelsMask |= GCPlaneMask;
- if(infoRec->PushPixelsFlags & RGB_EQUAL)
- infoRec->PushPixelsMask |= GCForeground;
- infoRec->ValidatePushPixels = XAAValidatePushPixels;
- }
-
- /* By default XAA assumes the FillSpans, PolyFillRects, FillPolygon
- and PolyFillArcs have the same restrictions. If you supply GC
- level replacements for any of these and alter this relationship
- you may need to supply replacement validation routines */
-
- if(!infoRec->ValidateFillSpans &&
- (infoRec->FillSpansSolid || infoRec->FillSpansStippled ||
- infoRec->FillSpansOpaqueStippled || infoRec->FillSpansTiled)) {
-
- int compositeFlags = infoRec->FillSpansSolidFlags |
- infoRec->FillSpansStippledFlags |
- infoRec->FillSpansOpaqueStippledFlags |
- infoRec->FillSpansTiledFlags;
-
- infoRec->FillSpansMask = GCFillStyle | GCTile | GCStipple;
-
- if((compositeFlags & GXCOPY_ONLY) ||
- (compositeFlags & ROP_NEEDS_SOURCE))
- infoRec->FillSpansMask |= GCFunction;
- if(compositeFlags & NO_PLANEMASK)
- infoRec->FillSpansMask |= GCPlaneMask;
- if(compositeFlags & RGB_EQUAL)
- infoRec->FillSpansMask |= GCForeground;
- infoRec->ValidateFillSpans = XAAValidateFillSpans;
- }
-
- /* By default XAA only provides Validations for the GlyphBlt
- functions and not the text higher up. This is because the
- Text8/16 and GlyphBlt are linked. If you break this linkage,
- you may need to have the driver supply its own Validation
- routines */
-
- if(!infoRec->ValidatePolyGlyphBlt &&
- (infoRec->PolyGlyphBltTE || infoRec->PolyGlyphBltNonTE)) {
- int compositeFlags = infoRec->PolyGlyphBltTEFlags |
- infoRec->PolyGlyphBltNonTEFlags;
-
- infoRec->PolyGlyphBltMask = GCFillStyle | GCFont;
- if((compositeFlags & GXCOPY_ONLY) ||
- (compositeFlags & ROP_NEEDS_SOURCE) ||
- (infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY))
- infoRec->PolyGlyphBltMask |= GCFunction;
- if(compositeFlags & NO_PLANEMASK)
- infoRec->PolyGlyphBltMask |= GCPlaneMask;
- if(compositeFlags & RGB_EQUAL)
- infoRec->PolyGlyphBltMask |= GCForeground;
- infoRec->ValidatePolyGlyphBlt = XAAValidatePolyGlyphBlt;
- }
-
- if(!infoRec->ValidateImageGlyphBlt &&
- (infoRec->ImageGlyphBltTE || infoRec->ImageGlyphBltNonTE)) {
- int compositeFlags = infoRec->ImageGlyphBltTEFlags |
- infoRec->ImageGlyphBltNonTEFlags;
-
- if(infoRec->ImageGlyphBltNonTE)
- compositeFlags |= infoRec->SolidFillFlags;
-
- infoRec->ImageGlyphBltMask = GCFont;
- if(compositeFlags & NO_PLANEMASK)
- infoRec->ImageGlyphBltMask |= GCPlaneMask;
- if(compositeFlags & RGB_EQUAL)
- infoRec->ImageGlyphBltMask |= GCForeground | GCBackground;
- infoRec->ValidateImageGlyphBlt = XAAValidateImageGlyphBlt;
- }
-
- /* By default XAA only provides a Validation function for the
- Polylines and does segments and polylines at the same time */
-
- if(!infoRec->ValidatePolylines && infoRec->ValidateFillSpans) {
- int compositeFlags = infoRec->PolyRectangleThinSolidFlags |
- infoRec->PolylinesWideSolidFlags |
- infoRec->PolylinesThinSolidFlags |
- infoRec->PolySegmentThinSolidFlags |
- infoRec->PolySegmentThinDashedFlags |
- infoRec->PolylinesThinDashedFlags;
-
- infoRec->ValidatePolylines = XAAValidatePolylines;
- infoRec->PolylinesMask =
- infoRec->FillSpansMask | GCLineStyle | GCLineWidth;
-
- if(infoRec->PolySegmentThinDashed || infoRec->PolylinesThinDashed)
- infoRec->PolylinesMask |= GCDashList;
- if(compositeFlags & NO_PLANEMASK)
- infoRec->PolylinesMask |= GCPlaneMask;
- if((compositeFlags & GXCOPY_ONLY) ||
- (compositeFlags & ROP_NEEDS_SOURCE))
- infoRec->PolylinesMask |= GCFunction;
- if(compositeFlags & RGB_EQUAL)
- infoRec->PolylinesMask |= GCForeground;
- }
-
-
- /**** Fill choosers ****/
-
- if(!infoRec->StippledFillChooser)
- infoRec->StippledFillChooser = XAAStippledFillChooser;
-
- if(!infoRec->OpaqueStippledFillChooser)
- infoRec->OpaqueStippledFillChooser = XAAOpaqueStippledFillChooser;
-
- if(!infoRec->TiledFillChooser)
- infoRec->TiledFillChooser = XAATiledFillChooser;
-
-
- /**** Setup the pixmap cache ****/
-
- if(infoRec->WriteBitmapToCache) {}
- else if(infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))
- infoRec->WriteBitmapToCache = XAAWriteBitmapToCache;
- else if(infoRec->Flags & LINEAR_FRAMEBUFFER)
- infoRec->WriteBitmapToCache = XAAWriteBitmapToCacheLinear;
- else
- infoRec->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES;
-
- if(infoRec->WritePixmapToCache) {}
- else if(infoRec->WritePixmap && !(infoRec->WritePixmapFlags & NO_GXCOPY))
- infoRec->WritePixmapToCache = XAAWritePixmapToCache;
- else if(infoRec->Flags & LINEAR_FRAMEBUFFER)
- infoRec->WritePixmapToCache = XAAWritePixmapToCacheLinear;
- else
- infoRec->Flags &= ~PIXMAP_CACHE;
-
- if (xf86ReturnOptValBool(options, XAAOPT_PIXMAP_CACHE, FALSE))
- infoRec->Flags &= ~PIXMAP_CACHE;
-
- if(infoRec->WriteMono8x8PatternToCache) {}
- else if(infoRec->PixmapCacheFlags & CACHE_MONO_8x8) {
- if(infoRec->WritePixmapToCache)
- infoRec->WriteMono8x8PatternToCache = XAAWriteMono8x8PatternToCache;
- else
- infoRec->PixmapCacheFlags &= ~CACHE_MONO_8x8;
- }
-
- if(infoRec->WriteColor8x8PatternToCache) {}
- else if(infoRec->PixmapCacheFlags & CACHE_COLOR_8x8) {
- if(infoRec->WritePixmapToCache && infoRec->WriteBitmapToCache)
- infoRec->WriteColor8x8PatternToCache = XAAWriteColor8x8PatternToCache;
- else
- infoRec->PixmapCacheFlags &= ~CACHE_COLOR_8x8;
- }
-
- if(infoRec->CachePixelGranularity < 0) {
- switch(pScrn->bitsPerPixel) {
- case 24:
- case 8: infoRec->CachePixelGranularity = 4; break;
- case 16: infoRec->CachePixelGranularity = 2; break;
- case 32: infoRec->CachePixelGranularity = 1; break;
- default: break;
- }
-
- if(BITMAP_SCANLINE_PAD == 64)
- infoRec->CachePixelGranularity *= 2;
- }
-
- free(options);
-
- if(!infoRec->CacheTile && infoRec->WritePixmapToCache)
- infoRec->CacheTile = XAACacheTile;
- if(!infoRec->CacheMonoStipple && infoRec->WritePixmapToCache)
- infoRec->CacheMonoStipple = XAACacheMonoStipple;
- if(!infoRec->CacheStipple && infoRec->WriteBitmapToCache)
- infoRec->CacheStipple = XAACacheStipple;
- if(!infoRec->CacheMono8x8Pattern && infoRec->WriteMono8x8PatternToCache)
- infoRec->CacheMono8x8Pattern = XAACacheMono8x8Pattern;
- if(!infoRec->CacheColor8x8Pattern && infoRec->WriteColor8x8PatternToCache)
- infoRec->CacheColor8x8Pattern = XAACacheColor8x8Pattern;
-
- if((infoRec->Flags & PIXMAP_CACHE) && !infoRec->InitPixmapCache) {
- infoRec->InitPixmapCache = XAAInitPixmapCache;
- infoRec->ClosePixmapCache = XAAClosePixmapCache;
- }
-
- return TRUE;
-}
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+
+/*
+ * XAA Config options
+ */
+
+typedef enum {
+ XAAOPT_SCREEN_TO_SCREEN_COPY,
+ XAAOPT_SOLID_FILL_RECT,
+ XAAOPT_SOLID_FILL_TRAP,
+ XAAOPT_SOLID_TWO_POINT_LINE,
+ XAAOPT_SOLID_BRESENHAM_LINE,
+ XAAOPT_SOLID_HORVERT_LINE,
+ XAAOPT_DASHED_TWO_POINT_LINE,
+ XAAOPT_DASHED_BRESENHAM_LINE,
+ XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
+ XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
+ XAAOPT_COL_8x8_PATTERN_FILL_RECT,
+ XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
+ XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
+ XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
+ XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
+ XAAOPT_IMAGE_WRITE_RECT,
+ XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
+ XAAOPT_WRITE_BITMAP,
+ XAAOPT_WRITE_PIXMAP,
+ XAAOPT_PIXMAP_CACHE,
+ XAAOPT_OFFSCREEN_PIXMAPS,
+ XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE
+} XAAOpts;
+
+static const OptionInfoRec XAAOptions[] = {
+ {XAAOPT_SCREEN_TO_SCREEN_COPY, "XaaNoScreenToScreenCopy",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_SOLID_FILL_RECT, "XaaNoSolidFillRect",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_SOLID_FILL_TRAP, "XaaNoSolidFillTrap",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_SOLID_TWO_POINT_LINE, "XaaNoSolidTwoPointLine",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_SOLID_BRESENHAM_LINE, "XaaNoSolidBresenhamLine",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_SOLID_HORVERT_LINE, "XaaNoSolidHorVertLine",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_DASHED_TWO_POINT_LINE, "XaaNoDashedTwoPointLine",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_DASHED_BRESENHAM_LINE, "XaaNoDashedBresenhamLine",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_MONO_8x8_PATTERN_FILL_RECT, "XaaNoMono8x8PatternFillRect",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, "XaaNoMono8x8PatternFillTrap",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_COL_8x8_PATTERN_FILL_RECT, "XaaNoColor8x8PatternFillRect",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_COL_8x8_PATTERN_FILL_TRAP, "XaaNoColor8x8PatternFillTrap",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL, "XaaNoCPUToScreenColorExpandFill",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
+ "XaaNoScanlineCPUToScreenColorExpandFill",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, "XaaNoScreenToScreenColorExpandFill",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_IMAGE_WRITE_RECT, "XaaNoImageWriteRect",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_SCANLINE_IMAGE_WRITE_RECT, "XaaNoScanlineImageWriteRect",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_WRITE_BITMAP, "XaaNoWriteBitmap",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_WRITE_PIXMAP, "XaaNoWritePixmap",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_PIXMAP_CACHE, "XaaNoPixmapCache",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_OFFSCREEN_PIXMAPS, "XaaNoOffscreenPixmaps",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE, "XaaOffscreenPixmaps",
+ OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL,
+ OPTV_NONE, {0}, FALSE}
+};
+
+static XF86ModuleVersionInfo xaaVersRec = {
+ "xaa",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ XAA_VERSION_MAJOR,
+ XAA_VERSION_MINOR,
+ XAA_VERSION_RELEASE,
+ ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL };
+
+Bool
+XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
+{
+ int index = pScreen->myNum;
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ Bool HaveScreenToScreenCopy = FALSE;
+ Bool HaveColorExpansion = FALSE;
+ Bool HaveScanlineColorExpansion = FALSE;
+ Bool HaveSolidFillRect = FALSE;
+ Bool HaveMono8x8PatternFillRect = FALSE;
+ Bool HaveColor8x8PatternFillRect = FALSE;
+ Bool HaveSolidFillTrap = FALSE;
+ Bool HaveMono8x8PatternFillTrap = FALSE;
+ Bool HaveColor8x8PatternFillTrap = FALSE;
+ Bool HaveSolidTwoPointLine = FALSE;
+ Bool HaveSolidBresenhamLine = FALSE;
+ Bool HaveSolidHorVertLine = FALSE;
+ Bool HaveDashedTwoPointLine = FALSE;
+ Bool HaveDashedBresenhamLine = FALSE;
+ Bool HaveImageWriteRect = FALSE;
+ Bool HaveScanlineImageWriteRect = FALSE;
+ Bool HaveScreenToScreenColorExpandFill = FALSE;
+ OptionInfoPtr options;
+ int is_shared = 0;
+ int i;
+
+ options = xnfalloc(sizeof(XAAOptions));
+ (void) memcpy(options, XAAOptions, sizeof(XAAOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+ infoRec->pScrn = pScrn;
+ infoRec->NeedToSync = FALSE;
+
+ /* must have a Sync function */
+ if (!infoRec->Sync)
+ return FALSE;
+ for (i = 0; i < pScrn->numEntities; i++) {
+ if (xf86IsEntityShared(pScrn->entityList[i]))
+ is_shared = 1;
+ }
+
+ /* If this PCI entity has IS_SHARED_ACCEL set in entityProp
+ * then a RestoreAccelState function is required
+ */
+ if (!infoRec->RestoreAccelState && is_shared)
+ return FALSE;
+
+ if (infoRec->RestoreAccelState) {
+ if (!XAAInitStateWrap(pScreen, infoRec))
+ return FALSE;
+ }
+
+ if (serverGeneration == 1)
+ xf86DrvMsg(index, X_INFO,
+ "Using XFree86 Acceleration Architecture (XAA)\n");
+
+ /************** Low Level *************/
+
+ if (!infoRec->SetClippingRectangle || !infoRec->DisableClipping) {
+ infoRec->ClippingFlags = 0;
+ infoRec->SetClippingRectangle = NULL;
+ infoRec->DisableClipping = NULL;
+ }
+
+ /**** CopyArea ****/
+
+ if (infoRec->SetupForScreenToScreenCopy &&
+ infoRec->SubsequentScreenToScreenCopy &&
+ !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COPY, FALSE)) {
+ HaveScreenToScreenCopy = TRUE;
+ }
+ else {
+ infoRec->ScreenToScreenCopyFlags = 0;
+ infoRec->SetupForScreenToScreenCopy = NULL;
+ infoRec->SubsequentScreenToScreenCopy = NULL;
+ }
+
+ /**** Solid Filled Rects ****/
+
+ if (infoRec->SetupForSolidFill && infoRec->SubsequentSolidFillRect &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_RECT, FALSE)) {
+ HaveSolidFillRect = TRUE;
+ if (infoRec->SubsequentSolidFillTrap &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_TRAP, FALSE))
+ HaveSolidFillTrap = TRUE;
+ else
+ infoRec->SubsequentSolidFillTrap = NULL;
+ }
+ else {
+ infoRec->SolidFillFlags = 0;
+ infoRec->SetupForSolidFill = NULL;
+ infoRec->SubsequentSolidFillRect = NULL;
+ infoRec->SubsequentSolidFillTrap = NULL;
+ }
+
+ /**** Solid lines ****/
+
+ if (infoRec->SetupForSolidLine) {
+ if (infoRec->SubsequentSolidTwoPointLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_TWO_POINT_LINE, FALSE))
+ HaveSolidTwoPointLine = TRUE;
+ if (infoRec->SubsequentSolidBresenhamLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_BRESENHAM_LINE,
+ FALSE)) {
+ HaveSolidBresenhamLine = TRUE;
+
+ if (infoRec->SolidBresenhamLineErrorTermBits)
+ infoRec->SolidBresenhamLineErrorTermBits =
+ ~((1 << infoRec->SolidBresenhamLineErrorTermBits) - 1);
+ }
+
+ if (infoRec->SubsequentSolidHorVertLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_HORVERT_LINE, FALSE))
+ HaveSolidHorVertLine = TRUE;
+ else if (HaveSolidTwoPointLine) {
+ infoRec->SubsequentSolidHorVertLine = XAASolidHorVertLineAsTwoPoint;
+ HaveSolidHorVertLine = TRUE;
+ }
+ else if (HaveSolidBresenhamLine) {
+ infoRec->SubsequentSolidHorVertLine =
+ XAASolidHorVertLineAsBresenham;
+ HaveSolidHorVertLine = TRUE;
+ }
+ }
+
+ /* XXX Should this also check for XAAOPT_SOLID_HORVERT_LINE? */
+ if (!HaveSolidTwoPointLine &&
+ !HaveSolidBresenhamLine && !HaveSolidHorVertLine && HaveSolidFillRect) {
+ infoRec->SetupForSolidLine = infoRec->SetupForSolidFill;
+ infoRec->SubsequentSolidHorVertLine = XAASolidHorVertLineAsRects;
+ infoRec->SolidLineFlags = infoRec->SolidFillFlags;
+ HaveSolidHorVertLine = TRUE;
+ }
+
+ if (!HaveSolidTwoPointLine)
+ infoRec->SubsequentSolidTwoPointLine = NULL;
+ if (!HaveSolidBresenhamLine)
+ infoRec->SubsequentSolidBresenhamLine = NULL;
+ if (!HaveSolidHorVertLine)
+ infoRec->SubsequentSolidHorVertLine = NULL;
+
+ /* Disable all if nothing left over */
+ if (!HaveSolidTwoPointLine &&
+ !HaveSolidBresenhamLine && !HaveSolidHorVertLine) {
+ infoRec->SolidLineFlags = 0;
+ infoRec->SetupForSolidLine = NULL;
+ }
+
+ /**** 8x8 Mono Pattern Filled Rects ****/
+
+ if (infoRec->SetupForMono8x8PatternFill &&
+ infoRec->SubsequentMono8x8PatternFillRect &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_MONO_8x8_PATTERN_FILL_RECT, FALSE)) {
+ HaveMono8x8PatternFillRect = TRUE;
+ if (infoRec->SubsequentMono8x8PatternFillTrap &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, FALSE))
+ HaveMono8x8PatternFillTrap = TRUE;
+
+ if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ infoRec->CanDoMono8x8 = TRUE;
+ }
+ else { /* others require caching */
+ int min_pitch;
+
+ infoRec->PixmapCacheFlags |= CACHE_MONO_8x8;
+
+ switch (pScrn->bitsPerPixel) {
+ case 32:
+ min_pitch = 2;
+ break;
+ case 24:
+ min_pitch = 3;
+ break;
+ case 16:
+ min_pitch = 4;
+ break;
+ default:
+ min_pitch = 8;
+ break;
+ }
+
+ if (min_pitch > infoRec->MonoPatternPitch)
+ infoRec->MonoPatternPitch = min_pitch;
+
+ if (infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ if (!infoRec->CacheWidthMono8x8Pattern ||
+ !infoRec->CacheHeightMono8x8Pattern) {
+ infoRec->CacheWidthMono8x8Pattern =
+ infoRec->MonoPatternPitch;
+ infoRec->CacheHeightMono8x8Pattern = 1;
+ }
+ }
+ else {
+ int numPerLine = 128 / infoRec->MonoPatternPitch;
+
+ if (!infoRec->CacheWidthMono8x8Pattern ||
+ !infoRec->CacheHeightMono8x8Pattern) {
+ infoRec->CacheWidthMono8x8Pattern =
+ numPerLine * infoRec->MonoPatternPitch;
+ infoRec->CacheHeightMono8x8Pattern =
+ (64 + numPerLine - 1) / numPerLine;
+ }
+ }
+ }
+ }
+ else {
+ infoRec->Mono8x8PatternFillFlags = 0;
+ infoRec->SetupForMono8x8PatternFill = NULL;
+ infoRec->SubsequentMono8x8PatternFillRect = NULL;
+ }
+
+ /**** Dashed lines ****/
+
+ if (infoRec->SetupForDashedLine && infoRec->DashPatternMaxLength) {
+ if (infoRec->SubsequentDashedTwoPointLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_DASHED_TWO_POINT_LINE, FALSE))
+ HaveDashedTwoPointLine = TRUE;
+ if (infoRec->SubsequentDashedBresenhamLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_DASHED_BRESENHAM_LINE,
+ FALSE)) {
+ HaveDashedBresenhamLine = TRUE;
+
+ if (infoRec->DashedBresenhamLineErrorTermBits)
+ infoRec->DashedBresenhamLineErrorTermBits =
+ ~((1 << infoRec->DashedBresenhamLineErrorTermBits) - 1);
+ }
+ }
+
+ if (!HaveDashedTwoPointLine)
+ infoRec->SubsequentDashedTwoPointLine = NULL;
+ if (!HaveDashedBresenhamLine)
+ infoRec->SubsequentDashedBresenhamLine = NULL;
+
+ /* Disable all if nothing left over */
+ if (!HaveDashedTwoPointLine && !HaveDashedBresenhamLine) {
+ infoRec->DashedLineFlags = 0;
+ infoRec->SetupForDashedLine = NULL;
+ }
+
+ /**** 8x8 Color Pattern Filled Rects ****/
+
+ if (infoRec->SetupForColor8x8PatternFill &&
+ infoRec->SubsequentColor8x8PatternFillRect &&
+ !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT,
+ FALSE)) {
+ HaveColor8x8PatternFillRect = TRUE;
+ if (infoRec->SubsequentColor8x8PatternFillTrap &&
+ !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
+ FALSE))
+ HaveColor8x8PatternFillTrap = TRUE;
+ else
+ infoRec->SubsequentColor8x8PatternFillTrap = NULL;
+
+ infoRec->PixmapCacheFlags |= CACHE_COLOR_8x8;
+
+ if (infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ if (!infoRec->CacheWidthColor8x8Pattern ||
+ !infoRec->CacheHeightColor8x8Pattern) {
+ infoRec->CacheWidthColor8x8Pattern = 64;
+ infoRec->CacheHeightColor8x8Pattern = 1;
+ }
+ }
+ else {
+ if (!infoRec->CacheWidthColor8x8Pattern ||
+ !infoRec->CacheHeightColor8x8Pattern) {
+ infoRec->CacheWidthColor8x8Pattern = 128;
+ infoRec->CacheHeightColor8x8Pattern = 8;
+ }
+ }
+ }
+ else {
+ infoRec->Color8x8PatternFillFlags = 0;
+ infoRec->SetupForColor8x8PatternFill = NULL;
+ infoRec->SubsequentColor8x8PatternFillRect = NULL;
+ infoRec->SubsequentColor8x8PatternFillTrap = NULL;
+ }
+
+ /**** Color Expansion ****/
+
+ if (infoRec->SetupForCPUToScreenColorExpandFill &&
+ infoRec->ColorExpandBase &&
+ infoRec->SubsequentCPUToScreenColorExpandFill &&
+ !xf86ReturnOptValBool(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
+ int dwordsNeeded = pScrn->virtualX;
+
+ infoRec->ColorExpandRange >>= 2; /* convert to DWORDS */
+ HaveColorExpansion = TRUE;
+
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X)
+ dwordsNeeded += 31;
+ dwordsNeeded = (dwordsNeeded + 31) >> 5;
+ if (dwordsNeeded > infoRec->ColorExpandRange)
+ infoRec->CPUToScreenColorExpandFillFlags |= CPU_TRANSFER_BASE_FIXED;
+ }
+ else {
+ infoRec->CPUToScreenColorExpandFillFlags = 0;
+ infoRec->SetupForCPUToScreenColorExpandFill = NULL;
+ infoRec->SubsequentCPUToScreenColorExpandFill = NULL;
+ }
+
+ /**** Scanline Color Expansion ****/
+
+ if (infoRec->SetupForScanlineCPUToScreenColorExpandFill &&
+ infoRec->SubsequentScanlineCPUToScreenColorExpandFill &&
+ infoRec->SubsequentColorExpandScanline &&
+ infoRec->ScanlineColorExpandBuffers &&
+ (infoRec->NumScanlineColorExpandBuffers > 0) &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
+ HaveScanlineColorExpansion = TRUE;
+ }
+ else {
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags = 0;
+ infoRec->SetupForScanlineCPUToScreenColorExpandFill = NULL;
+ infoRec->SubsequentScanlineCPUToScreenColorExpandFill = NULL;
+ infoRec->SubsequentColorExpandScanline = NULL;
+ }
+
+ /**** Screen to Screen Color Expansion ****/
+
+ if (infoRec->SetupForScreenToScreenColorExpandFill &&
+ infoRec->SubsequentScreenToScreenColorExpandFill &&
+ !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
+ HaveScreenToScreenColorExpandFill = TRUE;
+ if (!infoRec->CacheColorExpandDensity)
+ infoRec->CacheColorExpandDensity = 1;
+ }
+ else {
+ infoRec->ScreenToScreenColorExpandFillFlags = 0;
+ infoRec->SetupForScreenToScreenColorExpandFill = NULL;
+ infoRec->SubsequentScreenToScreenColorExpandFill = NULL;
+ }
+
+ /**** Image Writes ****/
+
+ if (infoRec->SetupForImageWrite && infoRec->ImageWriteBase &&
+ infoRec->SubsequentImageWriteRect &&
+ !xf86ReturnOptValBool(options, XAAOPT_IMAGE_WRITE_RECT, FALSE)) {
+
+ infoRec->ImageWriteRange >>= 2; /* convert to DWORDS */
+ if (infoRec->ImageWriteFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->ImageWriteRange = 0;
+ HaveImageWriteRect = TRUE;
+ }
+ else {
+ infoRec->ImageWriteFlags = 0;
+ infoRec->SetupForImageWrite = NULL;
+ infoRec->SubsequentImageWriteRect = NULL;
+ }
+
+ /**** Scanline Image Writes ****/
+
+ if (infoRec->SetupForScanlineImageWrite &&
+ infoRec->SubsequentScanlineImageWriteRect &&
+ infoRec->SubsequentImageWriteScanline &&
+ infoRec->ScanlineImageWriteBuffers &&
+ (infoRec->NumScanlineImageWriteBuffers > 0) &&
+ !xf86ReturnOptValBool(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
+ FALSE)) {
+ HaveScanlineImageWriteRect = TRUE;
+ }
+ else {
+ infoRec->ScanlineImageWriteFlags = 0;
+ infoRec->SetupForScanlineImageWrite = NULL;
+ infoRec->SubsequentScanlineImageWriteRect = NULL;
+ infoRec->SubsequentImageWriteScanline = NULL;
+ }
+
+#ifndef __i386__
+ /* XAA makes some unaligned accesses when clipping is not available */
+#define CLIP_FLAGS (LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X)
+ if (HaveImageWriteRect &&
+ ((infoRec->ImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS)) {
+ HaveImageWriteRect = FALSE;
+ }
+ if (HaveScanlineImageWriteRect &&
+ ((infoRec->ScanlineImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS)) {
+ HaveScanlineImageWriteRect = FALSE;
+ }
+#endif
+
+ if (serverGeneration == 1) {
+ if (HaveScreenToScreenCopy)
+ xf86ErrorF("\tScreen to screen bit blits\n");
+ if (HaveSolidFillRect)
+ xf86ErrorF("\tSolid filled rectangles\n");
+ if (HaveSolidFillTrap)
+ xf86ErrorF("\tSolid filled trapezoids\n");
+ if (HaveMono8x8PatternFillRect)
+ xf86ErrorF("\t8x8 mono pattern filled rectangles\n");
+ if (HaveMono8x8PatternFillTrap)
+ xf86ErrorF("\t8x8 mono pattern filled trapezoids\n");
+ if (HaveColor8x8PatternFillRect)
+ xf86ErrorF("\t8x8 color pattern filled rectangles\n");
+ if (HaveColor8x8PatternFillTrap)
+ xf86ErrorF("\t8x8 color pattern filled trapezoids\n");
+
+ if (HaveColorExpansion)
+ xf86ErrorF("\tCPU to Screen color expansion\n");
+ else if (HaveScanlineColorExpansion)
+ xf86ErrorF("\tIndirect CPU to Screen color expansion\n");
+
+ if (HaveScreenToScreenColorExpandFill)
+ xf86ErrorF("\tScreen to Screen color expansion\n");
+
+ if (HaveSolidTwoPointLine || HaveSolidBresenhamLine)
+ xf86ErrorF("\tSolid Lines\n");
+ else if (HaveSolidHorVertLine)
+ xf86ErrorF("\tSolid Horizontal and Vertical Lines\n");
+
+ if (HaveDashedTwoPointLine || HaveDashedBresenhamLine)
+ xf86ErrorF("\tDashed Lines\n");
+
+ if (HaveImageWriteRect)
+ xf86ErrorF("\tImage Writes\n");
+ else if (HaveScanlineImageWriteRect)
+ xf86ErrorF("\tScanline Image Writes\n");
+
+ }
+
+#define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0)
+
+ if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy &&
+ xf86ReturnOptValBool(options,
+ XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE, FALSE)) {
+ XAAMSG("\tOffscreen Pixmaps\n");
+ }
+ else {
+ infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
+ }
+
+ /************** Mid Level *************/
+
+ /**** ScreenToScreenBitBlt ****/
+
+ if (infoRec->ScreenToScreenBitBlt) {
+ XAAMSG("\tDriver provided ScreenToScreenBitBlt replacement\n");
+ }
+ else if (HaveScreenToScreenCopy) {
+ infoRec->ScreenToScreenBitBlt = XAAScreenToScreenBitBlt;
+ infoRec->ScreenToScreenBitBltFlags = infoRec->ScreenToScreenCopyFlags;
+ }
+
+ /**** FillSolidRects ****/
+
+ if (infoRec->FillSolidRects) {
+ XAAMSG("\tDriver provided FillSolidRects replacement\n");
+ }
+ else if (HaveSolidFillRect) {
+ infoRec->FillSolidRects = XAAFillSolidRects;
+ infoRec->FillSolidRectsFlags = infoRec->SolidFillFlags;
+ }
+
+ /**** FillSolidSpans ****/
+
+ if (infoRec->FillSolidSpans) {
+ XAAMSG("\tDriver provided FillSolidSpans replacement\n");
+ }
+ else if (HaveSolidFillRect) {
+ infoRec->FillSolidSpans = XAAFillSolidSpans;
+ infoRec->FillSolidSpansFlags = infoRec->SolidFillFlags;
+ }
+
+ /**** FillMono8x8PatternRects ****/
+
+ if (infoRec->FillMono8x8PatternRects) {
+ XAAMSG("\tDriver provided FillMono8x8PatternRects replacement\n");
+ }
+ else if (HaveMono8x8PatternFillRect) {
+ infoRec->FillMono8x8PatternRects =
+ (infoRec->
+ Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillMono8x8PatternRectsScreenOrigin : XAAFillMono8x8PatternRects;
+
+ infoRec->FillMono8x8PatternRectsFlags =
+ infoRec->Mono8x8PatternFillFlags;
+ }
+
+ /**** FillMono8x8PatternSpans ****/
+
+ if (infoRec->FillMono8x8PatternSpans) {
+ XAAMSG("\tDriver provided FillMono8x8PatternSpans replacement\n");
+ }
+ else if (HaveMono8x8PatternFillRect) {
+ infoRec->FillMono8x8PatternSpans =
+ (infoRec->
+ Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillMono8x8PatternSpansScreenOrigin : XAAFillMono8x8PatternSpans;
+
+ infoRec->FillMono8x8PatternSpansFlags =
+ infoRec->Mono8x8PatternFillFlags;
+ }
+
+ /**** FillColor8x8Rects ****/
+
+ if (infoRec->FillColor8x8PatternRects) {
+ XAAMSG("\tDriver provided FillColor8x8PatternRects replacement\n");
+ }
+ else if (HaveColor8x8PatternFillRect) {
+ infoRec->FillColor8x8PatternRects =
+ (infoRec->
+ Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillColor8x8PatternRectsScreenOrigin :
+ XAAFillColor8x8PatternRects;
+
+ infoRec->FillColor8x8PatternRectsFlags =
+ infoRec->Color8x8PatternFillFlags;
+ }
+
+ /**** FillColor8x8Spans ****/
+
+ if (infoRec->FillColor8x8PatternSpans) {
+ XAAMSG("\tDriver provided FillColor8x8PatternSpans replacement\n");
+ }
+ else if (HaveColor8x8PatternFillRect) {
+ infoRec->FillColor8x8PatternSpans =
+ (infoRec->
+ Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillColor8x8PatternSpansScreenOrigin :
+ XAAFillColor8x8PatternSpans;
+
+ infoRec->FillColor8x8PatternSpansFlags =
+ infoRec->Color8x8PatternFillFlags;
+ }
+
+ /**** FillCacheBltRects ****/
+
+ if (infoRec->FillCacheBltRects) {
+ XAAMSG("\tDriver provided FillCacheBltRects replacement\n");
+ }
+ else if (HaveScreenToScreenCopy) {
+ infoRec->FillCacheBltRects = XAAFillCacheBltRects;
+ infoRec->FillCacheBltRectsFlags = infoRec->ScreenToScreenCopyFlags;
+ }
+
+ /**** FillCacheBltSpans ****/
+
+ if (infoRec->FillCacheBltSpans) {
+ XAAMSG("\tDriver provided FillCacheBltSpans replacement\n");
+ }
+ else if (HaveScreenToScreenCopy) {
+ infoRec->FillCacheBltSpans = XAAFillCacheBltSpans;
+ infoRec->FillCacheBltSpansFlags = infoRec->ScreenToScreenCopyFlags;
+ }
+
+ /**** FillCacheExpandRects ****/
+
+ if (infoRec->FillCacheExpandRects) {
+ XAAMSG("\tDriver provided FillCacheExpandRects replacement\n");
+ }
+ else if (HaveScreenToScreenColorExpandFill) {
+ infoRec->FillCacheExpandRects = XAAFillCacheExpandRects;
+ infoRec->FillCacheExpandRectsFlags =
+ infoRec->ScreenToScreenColorExpandFillFlags;
+ }
+
+ /**** FillCacheExpandSpans ****/
+
+ if (infoRec->FillCacheExpandSpans) {
+ XAAMSG("\tDriver provided FillCacheExpandSpans replacement\n");
+ }
+ else if (HaveScreenToScreenColorExpandFill) {
+ infoRec->FillCacheExpandSpans = XAAFillCacheExpandSpans;
+ infoRec->FillCacheExpandSpansFlags =
+ infoRec->ScreenToScreenColorExpandFillFlags;
+ }
+
+ /**** FillColorExpandRects ****/
+
+ if (infoRec->FillColorExpandRects) {
+ XAAMSG("\tDriver provided FillColorExpandRects replacement\n");
+ }
+ else if (HaveColorExpansion) {
+ if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3MSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3MSBFirst;
+ }
+ else {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3LSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3LSBFirst;
+ }
+ }
+ else {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsMSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsMSBFirst;
+ }
+ else {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsLSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsLSBFirst;
+ }
+ }
+ infoRec->FillColorExpandRectsFlags =
+ infoRec->CPUToScreenColorExpandFillFlags;
+ }
+ else if (HaveScanlineColorExpansion) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ TRIPLE_BITS_24BPP) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRects3MSBFirst;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRects3LSBFirst;
+ }
+ else {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRectsMSBFirst;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRectsLSBFirst;
+ }
+ infoRec->FillColorExpandRectsFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+ }
+
+ /**** FillColorExpandSpans ****/
+
+ if (infoRec->FillColorExpandSpans) {
+ XAAMSG("\tDriver provided FillColorExpandSpans replacement\n");
+ }
+ else if (HaveColorExpansion) {
+ if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3MSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3MSBFirst;
+ }
+ else {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3LSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3LSBFirst;
+ }
+ }
+ else {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansMSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansMSBFirst;
+ }
+ else {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansLSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansLSBFirst;
+ }
+ }
+ infoRec->FillColorExpandSpansFlags =
+ infoRec->CPUToScreenColorExpandFillFlags;
+ }
+ else if (HaveScanlineColorExpansion) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ TRIPLE_BITS_24BPP) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpans3MSBFirst;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpans3LSBFirst;
+ }
+ else {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpansMSBFirst;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpansLSBFirst;
+ }
+ infoRec->FillColorExpandSpansFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+ }
+
+ /**** FillImageWriteRects ****/
+
+ if (infoRec->FillImageWriteRects) {
+ XAAMSG("\tDriver provided FillImageWriteRects replacement\n");
+ }
+ else if (HaveImageWriteRect &&
+ (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
+ infoRec->FillImageWriteRects = XAAFillImageWriteRects;
+ infoRec->FillImageWriteRectsFlags = infoRec->ImageWriteFlags;
+ }
+
+ /**** WriteBitmap ****/
+
+ if (infoRec->WriteBitmap &&
+ !xf86ReturnOptValBool(options, XAAOPT_WRITE_BITMAP, FALSE)) {
+ XAAMSG("\tDriver provided WriteBitmap replacement\n");
+ }
+ else if (HaveColorExpansion) {
+ if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpand3MSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpand3MSBFirst;
+ }
+ else {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpand3LSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpand3LSBFirst;
+ }
+ }
+ else {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpandMSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpandMSBFirst;
+ }
+ else {
+ if (infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpandLSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpandLSBFirst;
+ }
+ }
+ infoRec->WriteBitmapFlags = infoRec->CPUToScreenColorExpandFillFlags;
+ }
+ else if (HaveScanlineColorExpansion) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ TRIPLE_BITS_24BPP) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpand3MSBFirst;
+ else
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpand3LSBFirst;
+ }
+ else {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpandMSBFirst;
+ else
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpandLSBFirst;
+ }
+ infoRec->WriteBitmapFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+ }
+ else
+ infoRec->WriteBitmap = NULL;
+
+ /**** TE Glyphs ****/
+
+ if (infoRec->TEGlyphRenderer) {
+ XAAMSG("\tDriver provided TEGlyphRenderer replacement\n");
+ }
+ else if (HaveColorExpansion) {
+ infoRec->TEGlyphRendererFlags =
+ infoRec->CPUToScreenColorExpandFillFlags;
+
+ if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRenderer3MSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRenderer3MSBFirst;
+ }
+ else {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRenderer3LSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRenderer3LSBFirst;
+ }
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
+ infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
+ " without solid fills\n");
+ }
+ }
+ else {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRendererMSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererMSBFirst;
+ }
+ else {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRendererLSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererLSBFirst;
+ }
+ }
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
+ " without solid fills\n");
+ }
+
+ }
+ else if (HaveScanlineColorExpansion) {
+ infoRec->TEGlyphRendererFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+
+ if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3MSBFirst;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3LSBFirst;
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
+ infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
+ " without solid fills\n");
+ }
+ }
+ else {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineMSBFirst;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineLSBFirst;
+ }
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
+ " without solid fills\n");
+ }
+ }
+
+ /**** NonTE Glyphs ****/
+
+ if (infoRec->NonTEGlyphRenderer) {
+ XAAMSG("\tDriver provided NonTEGlyphRenderer replacement\n");
+ }
+ else if (infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
+ infoRec->NonTEGlyphRenderer = XAANonTEGlyphRenderer;
+ infoRec->NonTEGlyphRendererFlags = infoRec->WriteBitmapFlags;
+ }
+
+ /**** WritePixmap ****/
+
+ if (infoRec->WritePixmap &&
+ !xf86ReturnOptValBool(options, XAAOPT_WRITE_PIXMAP, FALSE)) {
+ XAAMSG("\tDriver provided WritePixmap replacement\n");
+ }
+ else if (HaveImageWriteRect) {
+ infoRec->WritePixmap = XAAWritePixmap;
+ infoRec->WritePixmapFlags =
+ infoRec->ImageWriteFlags | CONVERT_32BPP_TO_24BPP;
+ }
+ else if (HaveScanlineImageWriteRect) {
+ infoRec->WritePixmap = XAAWritePixmapScanline;
+ infoRec->WritePixmapFlags = infoRec->ScanlineImageWriteFlags;
+ }
+ else
+ infoRec->WritePixmap = NULL;
+
+ /**** ReadPixmap ****/
+
+ if (infoRec->ReadPixmap) {
+ XAAMSG("\tDriver provided ReadPixmap replacement\n");
+ }
+
+ /************** GC Level *************/
+
+ /**** CopyArea ****/
+
+ if (infoRec->CopyArea) {
+ XAAMSG("\tDriver provided GC level CopyArea replacement\n");
+ }
+ else if (infoRec->ScreenToScreenBitBlt) {
+ infoRec->CopyArea = XAACopyArea;
+ infoRec->CopyAreaFlags = infoRec->ScreenToScreenBitBltFlags;
+
+ /* most GC level primitives use one mid-level primitive so
+ the GC level primitive gets the mid-level primitive flag
+ and we use that at GC validation time. But CopyArea uses
+ more than one mid-level primitive so we have to essentially
+ do a GC validation every time that primitive is used.
+ The CopyAreaFlags would only be used for filtering out the
+ common denominators. Here we assume that if you don't do
+ ScreenToScreenBitBlt you aren't going to do the others.
+ We also assume that ScreenToScreenBitBlt has the least
+ restrictions. */
+ }
+
+ if (infoRec->CopyPlane) {
+ XAAMSG("\tDriver provided GC level CopyPlane replacement\n");
+ }
+ else if (infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) {
+ infoRec->CopyPlane = XAACopyPlaneColorExpansion;
+ infoRec->CopyPlaneFlags = infoRec->WriteBitmapFlags;
+ }
+
+ if (infoRec->PushPixelsSolid) {
+ XAAMSG("\tDriver provided GC level PushPixelsSolid replacement\n");
+ }
+ else if (infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
+ infoRec->PushPixelsSolid = XAAPushPixelsSolidColorExpansion;
+ infoRec->PushPixelsFlags = infoRec->WriteBitmapFlags;
+ }
+
+ if (infoRec->FillSolidRects) {
+ if (!infoRec->PolyFillRectSolid) {
+ infoRec->PolyFillRectSolid = XAAPolyFillRect;
+ infoRec->PolyFillRectSolidFlags = infoRec->FillSolidRectsFlags;
+ }
+ }
+ if (infoRec->FillSolidSpans) {
+ if (!infoRec->FillSpansSolid) {
+ infoRec->FillSpansSolid = XAAFillSpans;
+ infoRec->FillSpansSolidFlags = infoRec->FillSolidSpansFlags;
+ }
+ }
+
+ if (infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
+ infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
+ infoRec->FillCacheExpandRects) {
+ if (!infoRec->PolyFillRectStippled) {
+
+ infoRec->PolyFillRectStippled = XAAPolyFillRect;
+ infoRec->PolyFillRectStippledFlags = 0;
+ }
+ }
+
+ if (infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
+ infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
+ infoRec->FillCacheExpandSpans) {
+ if (!infoRec->FillSpansStippled) {
+
+ infoRec->FillSpansStippled = XAAFillSpans;
+ infoRec->FillSpansStippledFlags = 0;
+ }
+ }
+
+ if (infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
+ infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
+ infoRec->FillCacheExpandRects) {
+ if (!infoRec->PolyFillRectOpaqueStippled) {
+
+ infoRec->PolyFillRectOpaqueStippled = XAAPolyFillRect;
+ infoRec->PolyFillRectOpaqueStippledFlags = 0;
+ }
+ }
+
+ if (infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
+ infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
+ infoRec->FillCacheExpandSpans) {
+ if (!infoRec->FillSpansOpaqueStippled) {
+
+ infoRec->FillSpansOpaqueStippled = XAAFillSpans;
+ infoRec->FillSpansOpaqueStippledFlags = 0;
+ }
+ }
+
+ if (infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
+ infoRec->FillCacheBltRects || infoRec->FillImageWriteRects) {
+ if (!infoRec->PolyFillRectTiled) {
+
+ infoRec->PolyFillRectTiled = XAAPolyFillRect;
+ infoRec->PolyFillRectTiledFlags = 0;
+ }
+ }
+
+ if (infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
+ infoRec->FillCacheBltSpans) {
+ if (!infoRec->FillSpansTiled) {
+
+ infoRec->FillSpansTiled = XAAFillSpans;
+ infoRec->FillSpansTiledFlags = 0;
+ }
+ }
+
+ if (infoRec->TEGlyphRenderer &&
+ !(infoRec->TEGlyphRendererFlags & NO_TRANSPARENCY)) {
+
+ if (!infoRec->PolyText8TE) {
+ infoRec->PolyText8TE = XAAPolyText8TEColorExpansion;
+ infoRec->PolyText8TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if (!infoRec->PolyText16TE) {
+ infoRec->PolyText16TE = XAAPolyText16TEColorExpansion;
+ infoRec->PolyText16TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if (!infoRec->PolyGlyphBltTE) {
+ infoRec->PolyGlyphBltTE = XAAPolyGlyphBltTEColorExpansion;
+ infoRec->PolyGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
+ }
+ }
+
+ if (infoRec->TEGlyphRenderer &&
+ !(infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+
+ if (!infoRec->ImageText8TE) {
+ infoRec->ImageText8TE = XAAImageText8TEColorExpansion;
+ infoRec->ImageText8TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if (!infoRec->ImageText16TE) {
+ infoRec->ImageText16TE = XAAImageText16TEColorExpansion;
+ infoRec->ImageText16TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if (!infoRec->ImageGlyphBltTE) {
+ infoRec->ImageGlyphBltTE = XAAImageGlyphBltTEColorExpansion;
+ infoRec->ImageGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
+ }
+ }
+
+ if (infoRec->NonTEGlyphRenderer) {
+ if (!infoRec->PolyText8NonTE) {
+ infoRec->PolyText8NonTE = XAAPolyText8NonTEColorExpansion;
+ infoRec->PolyText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+
+ if (!infoRec->PolyText16NonTE) {
+ infoRec->PolyText16NonTE = XAAPolyText16NonTEColorExpansion;
+ infoRec->PolyText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+ if (!infoRec->PolyGlyphBltNonTE) {
+ infoRec->PolyGlyphBltNonTE = XAAPolyGlyphBltNonTEColorExpansion;
+ infoRec->PolyGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+ }
+
+ if (infoRec->NonTEGlyphRenderer && HaveSolidFillRect) {
+ if (!infoRec->ImageText8NonTE) {
+ infoRec->ImageText8NonTE = XAAImageText8NonTEColorExpansion;
+ infoRec->ImageText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+
+ if (!infoRec->ImageText16NonTE) {
+ infoRec->ImageText16NonTE = XAAImageText16NonTEColorExpansion;
+ infoRec->ImageText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+
+ if (!infoRec->ImageGlyphBltNonTE) {
+ infoRec->ImageGlyphBltNonTE = XAAImageGlyphBltNonTEColorExpansion;
+ infoRec->ImageGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+ }
+
+ if (!infoRec->PolyRectangleThinSolid && HaveSolidHorVertLine) {
+ infoRec->PolyRectangleThinSolid = XAAPolyRectangleThinSolid;
+ infoRec->PolyRectangleThinSolidFlags = infoRec->SolidLineFlags;
+ }
+
+ if (!infoRec->FillPolygonSolid && HaveSolidFillRect) {
+ infoRec->FillPolygonSolid = XAAFillPolygonSolid;
+ infoRec->FillPolygonSolidFlags = infoRec->SolidFillFlags;
+ }
+
+ if (!infoRec->FillPolygonStippled && (HaveMono8x8PatternFillRect ||
+ HaveScreenToScreenColorExpandFill ||
+ HaveScreenToScreenCopy)) {
+ infoRec->FillPolygonStippled = XAAFillPolygonStippled;
+ infoRec->FillPolygonStippledFlags = infoRec->SolidFillFlags;
+ }
+
+ if (!infoRec->FillPolygonOpaqueStippled && (HaveMono8x8PatternFillRect ||
+ HaveScreenToScreenColorExpandFill
+ || HaveScreenToScreenCopy)) {
+ infoRec->FillPolygonOpaqueStippled = XAAFillPolygonStippled;
+ infoRec->FillPolygonOpaqueStippledFlags = infoRec->SolidFillFlags;
+ }
+
+ if (!infoRec->FillPolygonTiled && (HaveMono8x8PatternFillRect ||
+ HaveScreenToScreenColorExpandFill ||
+ HaveScreenToScreenCopy)) {
+ infoRec->FillPolygonTiled = XAAFillPolygonTiled;
+ infoRec->FillPolygonTiledFlags = infoRec->SolidFillFlags;
+ }
+
+ if (!infoRec->PolyFillArcSolid && HaveSolidFillRect) {
+ infoRec->PolyFillArcSolid = XAAPolyFillArcSolid;
+ infoRec->PolyFillArcSolidFlags = infoRec->SolidFillFlags;
+ }
+
+ if (!infoRec->PolylinesWideSolid && HaveSolidFillRect) {
+ infoRec->PolylinesWideSolid = XAAPolylinesWideSolid;
+ infoRec->PolylinesWideSolidFlags =
+ infoRec->SolidFillFlags | GXCOPY_ONLY;
+ }
+
+ if (!infoRec->PutImage && (infoRec->WritePixmap ||
+ (infoRec->WriteBitmap &&
+ !(infoRec->
+ WriteBitmapFlags & TRANSPARENCY_ONLY)))) {
+ infoRec->PutImage = XAAPutImage;
+
+ /* See comment for CopyArea above. But here we make fewer
+ assumptions. The driver can provide the PutImageFlags if
+ it wants too */
+ }
+
+ if (HaveSolidHorVertLine &&
+ (HaveSolidBresenhamLine || (HaveSolidTwoPointLine &&
+ (infoRec->
+ ClippingFlags &
+ HARDWARE_CLIP_SOLID_LINE)))) {
+ if (!infoRec->PolylinesThinSolid) {
+ infoRec->PolylinesThinSolid = XAAPolyLines;
+ infoRec->PolylinesThinSolidFlags = infoRec->SolidLineFlags;
+ }
+ if (!infoRec->PolySegmentThinSolid) {
+ infoRec->PolySegmentThinSolid = XAAPolySegment;
+ infoRec->PolySegmentThinSolidFlags = infoRec->SolidLineFlags;
+ }
+ }
+
+ if (HaveDashedBresenhamLine || (HaveDashedTwoPointLine &&
+ (infoRec->
+ ClippingFlags &
+ HARDWARE_CLIP_DASHED_LINE))) {
+ if (!infoRec->PolylinesThinDashed) {
+ infoRec->PolylinesThinDashed = XAAPolyLinesDashed;
+ infoRec->PolylinesThinDashedFlags = infoRec->DashedLineFlags;
+ }
+ if (!infoRec->PolySegmentThinDashed) {
+ infoRec->PolySegmentThinDashed = XAAPolySegmentDashed;
+ infoRec->PolySegmentThinDashedFlags = infoRec->DashedLineFlags;
+ }
+ }
+
+ if (infoRec->PolylinesThinDashed || infoRec->PolySegmentThinDashed) {
+ if (!infoRec->ComputeDash)
+ infoRec->ComputeDash = XAAComputeDash;
+ }
+
+ {
+ Bool haveTexture = infoRec->CPUToScreenTextureFormats &&
+ infoRec->CPUToScreenTextureDstFormats &&
+ infoRec->SetupForCPUToScreenTexture2 &&
+ infoRec->SubsequentCPUToScreenTexture;
+ Bool haveAlphaTexture = infoRec->CPUToScreenAlphaTextureFormats &&
+ infoRec->CPUToScreenAlphaTextureDstFormats &&
+ infoRec->SetupForCPUToScreenAlphaTexture2 &&
+ infoRec->SubsequentCPUToScreenAlphaTexture;
+
+ if (!infoRec->Composite && (haveTexture || haveAlphaTexture))
+ infoRec->Composite = XAADoComposite;
+
+ if (!infoRec->Glyphs && infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
+ infoRec->Glyphs = XAADoGlyphs;
+ }
+ }
+
+ /************ Validation Functions **************/
+
+ if (!infoRec->ValidateCopyArea && infoRec->CopyArea) {
+ infoRec->CopyAreaMask = GCWhenForced;
+ if ((infoRec->CopyAreaFlags & GXCOPY_ONLY) ||
+ (infoRec->CopyAreaFlags & ROP_NEEDS_SOURCE))
+ infoRec->CopyAreaMask |= GCFunction;
+ if (infoRec->CopyAreaFlags & NO_PLANEMASK)
+ infoRec->CopyAreaMask |= GCPlaneMask;
+ infoRec->ValidateCopyArea = XAAValidateCopyArea;
+ }
+
+ if (!infoRec->ValidateCopyPlane && infoRec->CopyPlane) {
+ infoRec->CopyPlaneMask = GCWhenForced;
+ if ((infoRec->CopyPlaneFlags & GXCOPY_ONLY) ||
+ (infoRec->CopyPlaneFlags & ROP_NEEDS_SOURCE))
+ infoRec->CopyPlaneMask |= GCFunction;
+ if (infoRec->CopyPlaneFlags & NO_PLANEMASK)
+ infoRec->CopyPlaneMask |= GCPlaneMask;
+ if (infoRec->CopyPlaneFlags & RGB_EQUAL)
+ infoRec->CopyPlaneMask |= GCForeground | GCBackground;
+ infoRec->ValidateCopyPlane = XAAValidateCopyPlane;
+ }
+
+ if (!infoRec->ValidatePutImage && infoRec->PutImage) {
+ infoRec->PutImageMask = GCWhenForced;
+ if ((infoRec->PutImageFlags & GXCOPY_ONLY) ||
+ (infoRec->PutImageFlags & ROP_NEEDS_SOURCE))
+ infoRec->PutImageMask |= GCFunction;
+ if (infoRec->PutImageFlags & NO_PLANEMASK)
+ infoRec->PutImageMask |= GCPlaneMask;
+ if (infoRec->PutImageFlags & RGB_EQUAL)
+ infoRec->PutImageMask |= GCForeground | GCBackground;
+ infoRec->ValidatePutImage = XAAValidatePutImage;
+ }
+
+ if (!infoRec->ValidatePushPixels && infoRec->PushPixelsSolid) {
+ infoRec->PushPixelsMask = GCFillStyle;
+ if ((infoRec->PushPixelsFlags & GXCOPY_ONLY) ||
+ (infoRec->PushPixelsFlags & ROP_NEEDS_SOURCE) ||
+ (infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY))
+ infoRec->PushPixelsMask |= GCFunction;
+ if (infoRec->PushPixelsFlags & NO_PLANEMASK)
+ infoRec->PushPixelsMask |= GCPlaneMask;
+ if (infoRec->PushPixelsFlags & RGB_EQUAL)
+ infoRec->PushPixelsMask |= GCForeground;
+ infoRec->ValidatePushPixels = XAAValidatePushPixels;
+ }
+
+ /* By default XAA assumes the FillSpans, PolyFillRects, FillPolygon
+ and PolyFillArcs have the same restrictions. If you supply GC
+ level replacements for any of these and alter this relationship
+ you may need to supply replacement validation routines */
+
+ if (!infoRec->ValidateFillSpans &&
+ (infoRec->FillSpansSolid || infoRec->FillSpansStippled ||
+ infoRec->FillSpansOpaqueStippled || infoRec->FillSpansTiled)) {
+
+ int compositeFlags = infoRec->FillSpansSolidFlags |
+ infoRec->FillSpansStippledFlags |
+ infoRec->FillSpansOpaqueStippledFlags |
+ infoRec->FillSpansTiledFlags;
+
+ infoRec->FillSpansMask = GCFillStyle | GCTile | GCStipple;
+
+ if ((compositeFlags & GXCOPY_ONLY) ||
+ (compositeFlags & ROP_NEEDS_SOURCE))
+ infoRec->FillSpansMask |= GCFunction;
+ if (compositeFlags & NO_PLANEMASK)
+ infoRec->FillSpansMask |= GCPlaneMask;
+ if (compositeFlags & RGB_EQUAL)
+ infoRec->FillSpansMask |= GCForeground;
+ infoRec->ValidateFillSpans = XAAValidateFillSpans;
+ }
+
+ /* By default XAA only provides Validations for the GlyphBlt
+ functions and not the text higher up. This is because the
+ Text8/16 and GlyphBlt are linked. If you break this linkage,
+ you may need to have the driver supply its own Validation
+ routines */
+
+ if (!infoRec->ValidatePolyGlyphBlt &&
+ (infoRec->PolyGlyphBltTE || infoRec->PolyGlyphBltNonTE)) {
+ int compositeFlags = infoRec->PolyGlyphBltTEFlags |
+ infoRec->PolyGlyphBltNonTEFlags;
+
+ infoRec->PolyGlyphBltMask = GCFillStyle | GCFont;
+ if ((compositeFlags & GXCOPY_ONLY) ||
+ (compositeFlags & ROP_NEEDS_SOURCE) ||
+ (infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY))
+ infoRec->PolyGlyphBltMask |= GCFunction;
+ if (compositeFlags & NO_PLANEMASK)
+ infoRec->PolyGlyphBltMask |= GCPlaneMask;
+ if (compositeFlags & RGB_EQUAL)
+ infoRec->PolyGlyphBltMask |= GCForeground;
+ infoRec->ValidatePolyGlyphBlt = XAAValidatePolyGlyphBlt;
+ }
+
+ if (!infoRec->ValidateImageGlyphBlt &&
+ (infoRec->ImageGlyphBltTE || infoRec->ImageGlyphBltNonTE)) {
+ int compositeFlags = infoRec->ImageGlyphBltTEFlags |
+ infoRec->ImageGlyphBltNonTEFlags;
+
+ if (infoRec->ImageGlyphBltNonTE)
+ compositeFlags |= infoRec->SolidFillFlags;
+
+ infoRec->ImageGlyphBltMask = GCFont;
+ if (compositeFlags & NO_PLANEMASK)
+ infoRec->ImageGlyphBltMask |= GCPlaneMask;
+ if (compositeFlags & RGB_EQUAL)
+ infoRec->ImageGlyphBltMask |= GCForeground | GCBackground;
+ infoRec->ValidateImageGlyphBlt = XAAValidateImageGlyphBlt;
+ }
+
+ /* By default XAA only provides a Validation function for the
+ Polylines and does segments and polylines at the same time */
+
+ if (!infoRec->ValidatePolylines && infoRec->ValidateFillSpans) {
+ int compositeFlags = infoRec->PolyRectangleThinSolidFlags |
+ infoRec->PolylinesWideSolidFlags |
+ infoRec->PolylinesThinSolidFlags |
+ infoRec->PolySegmentThinSolidFlags |
+ infoRec->PolySegmentThinDashedFlags |
+ infoRec->PolylinesThinDashedFlags;
+
+ infoRec->ValidatePolylines = XAAValidatePolylines;
+ infoRec->PolylinesMask =
+ infoRec->FillSpansMask | GCLineStyle | GCLineWidth;
+
+ if (infoRec->PolySegmentThinDashed || infoRec->PolylinesThinDashed)
+ infoRec->PolylinesMask |= GCDashList;
+ if (compositeFlags & NO_PLANEMASK)
+ infoRec->PolylinesMask |= GCPlaneMask;
+ if ((compositeFlags & GXCOPY_ONLY) ||
+ (compositeFlags & ROP_NEEDS_SOURCE))
+ infoRec->PolylinesMask |= GCFunction;
+ if (compositeFlags & RGB_EQUAL)
+ infoRec->PolylinesMask |= GCForeground;
+ }
+
+ /**** Fill choosers ****/
+
+ if (!infoRec->StippledFillChooser)
+ infoRec->StippledFillChooser = XAAStippledFillChooser;
+
+ if (!infoRec->OpaqueStippledFillChooser)
+ infoRec->OpaqueStippledFillChooser = XAAOpaqueStippledFillChooser;
+
+ if (!infoRec->TiledFillChooser)
+ infoRec->TiledFillChooser = XAATiledFillChooser;
+
+ /**** Setup the pixmap cache ****/
+
+ if (infoRec->WriteBitmapToCache) {
+ }
+ else if (infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))
+ infoRec->WriteBitmapToCache = XAAWriteBitmapToCache;
+ else if (infoRec->Flags & LINEAR_FRAMEBUFFER)
+ infoRec->WriteBitmapToCache = XAAWriteBitmapToCacheLinear;
+ else
+ infoRec->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES;
+
+ if (infoRec->WritePixmapToCache) {
+ }
+ else if (infoRec->WritePixmap && !(infoRec->WritePixmapFlags & NO_GXCOPY))
+ infoRec->WritePixmapToCache = XAAWritePixmapToCache;
+ else if (infoRec->Flags & LINEAR_FRAMEBUFFER)
+ infoRec->WritePixmapToCache = XAAWritePixmapToCacheLinear;
+ else
+ infoRec->Flags &= ~PIXMAP_CACHE;
+
+ if (xf86ReturnOptValBool(options, XAAOPT_PIXMAP_CACHE, FALSE))
+ infoRec->Flags &= ~PIXMAP_CACHE;
+
+ if (infoRec->WriteMono8x8PatternToCache) {
+ }
+ else if (infoRec->PixmapCacheFlags & CACHE_MONO_8x8) {
+ if (infoRec->WritePixmapToCache)
+ infoRec->WriteMono8x8PatternToCache = XAAWriteMono8x8PatternToCache;
+ else
+ infoRec->PixmapCacheFlags &= ~CACHE_MONO_8x8;
+ }
+
+ if (infoRec->WriteColor8x8PatternToCache) {
+ }
+ else if (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8) {
+ if (infoRec->WritePixmapToCache && infoRec->WriteBitmapToCache)
+ infoRec->WriteColor8x8PatternToCache =
+ XAAWriteColor8x8PatternToCache;
+ else
+ infoRec->PixmapCacheFlags &= ~CACHE_COLOR_8x8;
+ }
+
+ if (infoRec->CachePixelGranularity < 0) {
+ switch (pScrn->bitsPerPixel) {
+ case 24:
+ case 8:
+ infoRec->CachePixelGranularity = 4;
+ break;
+ case 16:
+ infoRec->CachePixelGranularity = 2;
+ break;
+ case 32:
+ infoRec->CachePixelGranularity = 1;
+ break;
+ default:
+ break;
+ }
+
+ if (BITMAP_SCANLINE_PAD == 64)
+ infoRec->CachePixelGranularity *= 2;
+ }
+
+ free(options);
+
+ if (!infoRec->CacheTile && infoRec->WritePixmapToCache)
+ infoRec->CacheTile = XAACacheTile;
+ if (!infoRec->CacheMonoStipple && infoRec->WritePixmapToCache)
+ infoRec->CacheMonoStipple = XAACacheMonoStipple;
+ if (!infoRec->CacheStipple && infoRec->WriteBitmapToCache)
+ infoRec->CacheStipple = XAACacheStipple;
+ if (!infoRec->CacheMono8x8Pattern && infoRec->WriteMono8x8PatternToCache)
+ infoRec->CacheMono8x8Pattern = XAACacheMono8x8Pattern;
+ if (!infoRec->CacheColor8x8Pattern && infoRec->WriteColor8x8PatternToCache)
+ infoRec->CacheColor8x8Pattern = XAACacheColor8x8Pattern;
+
+ if ((infoRec->Flags & PIXMAP_CACHE) && !infoRec->InitPixmapCache) {
+ infoRec->InitPixmapCache = XAAInitPixmapCache;
+ infoRec->ClosePixmapCache = XAAClosePixmapCache;
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaLine.c b/xorg-server/hw/xfree86/xaa/xaaLine.c
index d94f1f4e0..d7c60975e 100644
--- a/xorg-server/hw/xfree86/xaa/xaaLine.c
+++ b/xorg-server/hw/xfree86/xaa/xaaLine.c
@@ -1,394 +1,422 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "miline.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-
-
-void
-#ifdef POLYSEGMENT
-XAAPolySegment(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-#else
-XAAPolyLines(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode, /* Origin or Previous */
- int npt, /* number of points */
- DDXPointPtr pptInit
-#endif
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- BoxPtr pboxInit = RegionRects(pGC->pCompositeClip);
- int nboxInit = RegionNumRects(pGC->pCompositeClip);
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
- int xorg = pDrawable->x;
- int yorg = pDrawable->y;
- int nbox;
- BoxPtr pbox;
-#ifndef POLYSEGMENT
- DDXPointPtr ppt;
-#endif
- int x1, x2, y1, y2, tmp, len;
-
- if(!nboxInit)
- return;
-
- if (infoRec->SolidLineFlags & LINE_LIMIT_COORDS) {
- int minValX = infoRec->SolidLineLimits.x1;
- int maxValX = infoRec->SolidLineLimits.x2;
- int minValY = infoRec->SolidLineLimits.y1;
- int maxValY = infoRec->SolidLineLimits.y2;
-#ifdef POLYSEGMENT
- int n = nseg;
- xSegment *s = pSeg;
-
- while (n--)
-#else
- int n = npt;
- int xorgtmp = xorg;
- int yorgtmp = yorg;
-
- ppt = pptInit;
- x2 = ppt->x + xorgtmp;
- y2 = ppt->y + yorgtmp;
- while (--n)
-#endif
- {
-#ifdef POLYSEGMENT
- x1 = s->x1 + xorg;
- y1 = s->y1 + yorg;
- x2 = s->x2 + xorg;
- y2 = s->y2 + yorg;
- s++;
-#else
- x1 = x2;
- y1 = y2;
- ++ppt;
- if (mode == CoordModePrevious) {
- xorgtmp = x1;
- yorgtmp = y1;
- }
- x2 = ppt->x + xorgtmp;
- y2 = ppt->y + yorgtmp;
-#endif
- if (x1 > maxValX || x1 < minValX ||
- x2 > maxValX || x2 < minValX ||
- y1 > maxValY || y1 < minValY ||
- y2 > maxValY || y2 < minValY) {
-#ifdef POLYSEGMENT
- XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg);
-#else
- XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit);
-#endif
- return;
- }
- }
- }
-
- (*infoRec->SetupForSolidLine)(infoRec->pScrn, pGC->fgPixel,
- pGC->alu, pGC->planemask);
-
-#ifdef POLYSEGMENT
- while (nseg--)
-#else
- ppt = pptInit;
- x2 = ppt->x + xorg;
- y2 = ppt->y + yorg;
- while(--npt)
-#endif
- {
- nbox = nboxInit;
- pbox = pboxInit;
-
-#ifdef POLYSEGMENT
- x1 = pSeg->x1 + xorg;
- y1 = pSeg->y1 + yorg;
- x2 = pSeg->x2 + xorg;
- y2 = pSeg->y2 + yorg;
- pSeg++;
-#else
- x1 = x2;
- y1 = y2;
- ++ppt;
- if (mode == CoordModePrevious) {
- xorg = x1;
- yorg = y1;
- }
- x2 = ppt->x + xorg;
- y2 = ppt->y + yorg;
-#endif
-
- if (x1 == x2) { /* vertical line */
- /* make the line go top to bottom of screen, keeping
- endpoint semantics
- */
- if (y1 > y2) {
- tmp = y2;
- y2 = y1 + 1;
- y1 = tmp + 1;
-#ifdef POLYSEGMENT
- if (pGC->capStyle != CapNotLast) y1--;
-#endif
- }
-#ifdef POLYSEGMENT
- else if (pGC->capStyle != CapNotLast) y2++;
-#endif
- /* get to first band that might contain part of line */
- while(nbox && (pbox->y2 <= y1)) {
- pbox++;
- nbox--;
- }
-
- /* stop when lower edge of box is beyond end of line */
- while(nbox && (y2 >= pbox->y1)) {
- if ((x1 >= pbox->x1) && (x1 < pbox->x2)) {
- tmp = max(y1, pbox->y1);
- len = min(y2, pbox->y2) - tmp;
- if (len) (*infoRec->SubsequentSolidHorVertLine)(
- infoRec->pScrn, x1, tmp, len, DEGREES_270);
- }
- nbox--;
- pbox++;
- }
-#ifndef POLYSEGMENT
- y2 = ppt->y + yorg;
-#endif
- } else if (y1 == y2) { /* horizontal line */
- /* force line from left to right, keeping endpoint semantics */
- if (x1 > x2) {
- tmp = x2;
- x2 = x1 + 1;
- x1 = tmp + 1;
-#ifdef POLYSEGMENT
- if (pGC->capStyle != CapNotLast) x1--;
-#endif
- }
-#ifdef POLYSEGMENT
- else if (pGC->capStyle != CapNotLast) x2++;
-#endif
-
- /* find the correct band */
- while(nbox && (pbox->y2 <= y1)) {
- pbox++;
- nbox--;
- }
-
- /* try to draw the line, if we haven't gone beyond it */
- if (nbox && (pbox->y1 <= y1)) {
- int orig_y = pbox->y1;
- /* when we leave this band, we're done */
- while(nbox && (orig_y == pbox->y1)) {
- if (pbox->x2 <= x1) {
- /* skip boxes until one might contain start point */
- nbox--;
- pbox++;
- continue;
- }
-
- /* stop if left of box is beyond right of line */
- if (pbox->x1 >= x2) {
- nbox = 0;
- break;
- }
-
- tmp = max(x1, pbox->x1);
- len = min(x2, pbox->x2) - tmp;
- if (len) (*infoRec->SubsequentSolidHorVertLine)(
- infoRec->pScrn, tmp, y1, len, DEGREES_0);
- nbox--;
- pbox++;
- }
- }
-#ifndef POLYSEGMENT
- x2 = ppt->x + xorg;
-#endif
- } else{ /* sloped line */
- unsigned int oc1, oc2;
- int dmin, dmaj, e, octant;
-
- if (infoRec->SubsequentSolidBresenhamLine) {
- if((dmaj = x2 - x1) < 0) {
- dmaj = -dmaj;
- octant = XDECREASING;
- } else octant = 0;
-
- if((dmin = y2 - y1) < 0) {
- dmin = -dmin;
- octant |= YDECREASING;
- }
-
- if(dmin >= dmaj){
- tmp = dmin; dmin = dmaj; dmaj = tmp;
- octant |= YMAJOR;
- }
-
- e = -dmaj - ((bias >> octant) & 1);
- len = dmaj;
- dmin <<= 1;
- dmaj <<= 1;
- } else { /* Muffle compiler */
- dmin = dmaj = e = octant = len = 0;
- }
-
- while(nbox--) {
- oc1 = oc2 = 0;
- OUTCODES(oc1, x1, y1, pbox);
- OUTCODES(oc2, x2, y2, pbox);
- if (!(oc1 | oc2)) { /* unclipped */
- if(infoRec->SubsequentSolidTwoPointLine) {
- (*infoRec->SubsequentSolidTwoPointLine)(
- infoRec->pScrn, x1, y1, x2, y2,
-#ifdef POLYSEGMENT
- (pGC->capStyle != CapNotLast) ? 0 :
-#endif
- OMIT_LAST
- );
- } else {
- (*infoRec->SubsequentSolidBresenhamLine)(
- infoRec->pScrn, x1, y1, dmaj, dmin, e,
-#ifdef POLYSEGMENT
- (pGC->capStyle != CapNotLast) ? (len+1) :
-#endif
- len, octant);
- }
- break;
- } else if (oc1 & oc2) { /* completely clipped */
- pbox++;
- } else if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_LINE) {
- (*infoRec->SetClippingRectangle)(infoRec->pScrn,
- pbox->x1, pbox->y1, pbox->x2 - 1, pbox->y2 - 1);
-
- if(infoRec->SubsequentSolidBresenhamLine) {
- (*infoRec->SubsequentSolidBresenhamLine)(
- infoRec->pScrn, x1, y1, dmaj, dmin, e,
-#ifdef POLYSEGMENT
- (pGC->capStyle != CapNotLast) ? (len+1) :
-#endif
- len, octant);
- } else {
- (*infoRec->SubsequentSolidTwoPointLine)(
- infoRec->pScrn, x1, y1, x2, y2,
-#ifdef POLYSEGMENT
- (pGC->capStyle != CapNotLast) ? 0 :
-#endif
- OMIT_LAST
- );
- }
- (*infoRec->DisableClipping)(infoRec->pScrn);
- pbox++;
- } else {
- int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
- int clip1 = 0, clip2 = 0;
- int err, adx, ady;
-
- if(octant & YMAJOR) {
- ady = dmaj >> 1;
- adx = dmin >> 1;
- } else {
- ady = dmin >> 1;
- adx = dmaj >> 1;
- }
-
- if (miZeroClipLine(pbox->x1, pbox->y1,
- pbox->x2 - 1, pbox->y2 - 1,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady, &clip1, &clip2,
- octant, bias, oc1, oc2) == -1)
- {
- pbox++;
- continue;
- }
-
- if (octant & YMAJOR)
- len = abs(new_y2 - new_y1);
- else
- len = abs(new_x2 - new_x1);
-#ifdef POLYSEGMENT
- if (clip2 != 0 || pGC->capStyle != CapNotLast)
- len++;
-#else
- len += (clip2 != 0);
-#endif
- if (len) {
- int abserr, clipdx, clipdy;
- /* unwind bresenham error term to first point */
- if (clip1) {
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
-
- if (octant & YMAJOR)
- err = e + clipdy*dmin - clipdx*dmaj;
- else
- err = e + clipdx*dmin - clipdy*dmaj;
- } else
- err = e;
-
-#define range infoRec->SolidBresenhamLineErrorTermBits
- abserr = abs(err);
- while((abserr & range) ||
- (dmaj & range) ||
- (dmin & range)) {
- dmin >>= 1;
- dmaj >>= 1;
- abserr >>= 1;
- err /= 2;
- }
-
- (*infoRec->SubsequentSolidBresenhamLine)(
- infoRec->pScrn, new_x1, new_y1,
- dmaj, dmin, err, len, octant);
- }
- pbox++;
- }
- } /* while (nbox--) */
- } /* sloped line */
- } /* while (nline--) */
-
-#ifndef POLYSEGMENT
- /* paint the last point if the end style isn't CapNotLast.
- (Assume that a projecting, butt, or round cap that is one
- pixel wide is the same as the single pixel of the endpoint.)
- */
-
- if ((pGC->capStyle != CapNotLast) &&
- ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
- (ppt->y + yorg != pptInit->y + pDrawable->y) ||
- (ppt == pptInit + 1)))
- {
- nbox = nboxInit;
- pbox = pboxInit;
- while (nbox--)
- {
- if ((x2 >= pbox->x1) && (y2 >= pbox->y1) &&
- (x2 < pbox->x2) && (y2 < pbox->y2))
- {
- (*infoRec->SubsequentSolidHorVertLine)(
- infoRec->pScrn, x2, y2, 1, DEGREES_0);
- break;
- }
- else
- pbox++;
- }
- }
-#endif
-
- SET_SYNC_FLAG(infoRec);
-}
-
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include <X11/X.h>
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "miline.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+void
+#ifdef POLYSEGMENT
+ XAAPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg
+#else
+XAAPolyLines(DrawablePtr pDrawable, GCPtr pGC, int mode, /* Origin or Previous */
+ int npt, /* number of points */
+ DDXPointPtr pptInit
+#endif
+ )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ BoxPtr pboxInit = RegionRects(pGC->pCompositeClip);
+ int nboxInit = RegionNumRects(pGC->pCompositeClip);
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ int xorg = pDrawable->x;
+ int yorg = pDrawable->y;
+ int nbox;
+ BoxPtr pbox;
+
+#ifndef POLYSEGMENT
+ DDXPointPtr ppt;
+#endif
+ int x1, x2, y1, y2, tmp, len;
+
+ if (!nboxInit)
+ return;
+
+ if (infoRec->SolidLineFlags & LINE_LIMIT_COORDS) {
+ int minValX = infoRec->SolidLineLimits.x1;
+ int maxValX = infoRec->SolidLineLimits.x2;
+ int minValY = infoRec->SolidLineLimits.y1;
+ int maxValY = infoRec->SolidLineLimits.y2;
+
+#ifdef POLYSEGMENT
+ int n = nseg;
+ xSegment *s = pSeg;
+
+ while (n--)
+#else
+ int n = npt;
+ int xorgtmp = xorg;
+ int yorgtmp = yorg;
+
+ ppt = pptInit;
+ x2 = ppt->x + xorgtmp;
+ y2 = ppt->y + yorgtmp;
+ while (--n)
+#endif
+ {
+#ifdef POLYSEGMENT
+ x1 = s->x1 + xorg;
+ y1 = s->y1 + yorg;
+ x2 = s->x2 + xorg;
+ y2 = s->y2 + yorg;
+ s++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious) {
+ xorgtmp = x1;
+ yorgtmp = y1;
+ }
+ x2 = ppt->x + xorgtmp;
+ y2 = ppt->y + yorgtmp;
+#endif
+ if (x1 > maxValX || x1 < minValX ||
+ x2 > maxValX || x2 < minValX ||
+ y1 > maxValY || y1 < minValY || y2 > maxValY || y2 < minValY) {
+#ifdef POLYSEGMENT
+ XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg);
+#else
+ XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit);
+#endif
+ return;
+ }
+ }
+ }
+
+ (*infoRec->SetupForSolidLine) (infoRec->pScrn, pGC->fgPixel,
+ pGC->alu, pGC->planemask);
+
+#ifdef POLYSEGMENT
+ while (nseg--)
+#else
+ ppt = pptInit;
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+ while (--npt)
+#endif
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+
+#ifdef POLYSEGMENT
+ x1 = pSeg->x1 + xorg;
+ y1 = pSeg->y1 + yorg;
+ x2 = pSeg->x2 + xorg;
+ y2 = pSeg->y2 + yorg;
+ pSeg++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious) {
+ xorg = x1;
+ yorg = y1;
+ }
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+#endif
+
+ if (x1 == x2) { /* vertical line */
+ /* make the line go top to bottom of screen, keeping
+ endpoint semantics
+ */
+ if (y1 > y2) {
+ tmp = y2;
+ y2 = y1 + 1;
+ y1 = tmp + 1;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ y1--;
+#endif
+ }
+#ifdef POLYSEGMENT
+ else if (pGC->capStyle != CapNotLast)
+ y2++;
+#endif
+ /* get to first band that might contain part of line */
+ while (nbox && (pbox->y2 <= y1)) {
+ pbox++;
+ nbox--;
+ }
+
+ /* stop when lower edge of box is beyond end of line */
+ while (nbox && (y2 >= pbox->y1)) {
+ if ((x1 >= pbox->x1) && (x1 < pbox->x2)) {
+ tmp = max(y1, pbox->y1);
+ len = min(y2, pbox->y2) - tmp;
+ if (len)
+ (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
+ x1, tmp, len,
+ DEGREES_270);
+ }
+ nbox--;
+ pbox++;
+ }
+#ifndef POLYSEGMENT
+ y2 = ppt->y + yorg;
+#endif
+ }
+ else if (y1 == y2) { /* horizontal line */
+ /* force line from left to right, keeping endpoint semantics */
+ if (x1 > x2) {
+ tmp = x2;
+ x2 = x1 + 1;
+ x1 = tmp + 1;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ x1--;
+#endif
+ }
+#ifdef POLYSEGMENT
+ else if (pGC->capStyle != CapNotLast)
+ x2++;
+#endif
+
+ /* find the correct band */
+ while (nbox && (pbox->y2 <= y1)) {
+ pbox++;
+ nbox--;
+ }
+
+ /* try to draw the line, if we haven't gone beyond it */
+ if (nbox && (pbox->y1 <= y1)) {
+ int orig_y = pbox->y1;
+
+ /* when we leave this band, we're done */
+ while (nbox && (orig_y == pbox->y1)) {
+ if (pbox->x2 <= x1) {
+ /* skip boxes until one might contain start point */
+ nbox--;
+ pbox++;
+ continue;
+ }
+
+ /* stop if left of box is beyond right of line */
+ if (pbox->x1 >= x2) {
+ nbox = 0;
+ break;
+ }
+
+ tmp = max(x1, pbox->x1);
+ len = min(x2, pbox->x2) - tmp;
+ if (len)
+ (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
+ tmp, y1, len,
+ DEGREES_0);
+ nbox--;
+ pbox++;
+ }
+ }
+#ifndef POLYSEGMENT
+ x2 = ppt->x + xorg;
+#endif
+ }
+ else { /* sloped line */
+ unsigned int oc1, oc2;
+ int dmin, dmaj, e, octant;
+
+ if (infoRec->SubsequentSolidBresenhamLine) {
+ if ((dmaj = x2 - x1) < 0) {
+ dmaj = -dmaj;
+ octant = XDECREASING;
+ }
+ else
+ octant = 0;
+
+ if ((dmin = y2 - y1) < 0) {
+ dmin = -dmin;
+ octant |= YDECREASING;
+ }
+
+ if (dmin >= dmaj) {
+ tmp = dmin;
+ dmin = dmaj;
+ dmaj = tmp;
+ octant |= YMAJOR;
+ }
+
+ e = -dmaj - ((bias >> octant) & 1);
+ len = dmaj;
+ dmin <<= 1;
+ dmaj <<= 1;
+ }
+ else { /* Muffle compiler */
+ dmin = dmaj = e = octant = len = 0;
+ }
+
+ while (nbox--) {
+ oc1 = oc2 = 0;
+ OUTCODES(oc1, x1, y1, pbox);
+ OUTCODES(oc2, x2, y2, pbox);
+ if (!(oc1 | oc2)) { /* unclipped */
+ if (infoRec->SubsequentSolidTwoPointLine) {
+ (*infoRec->SubsequentSolidTwoPointLine) (infoRec->pScrn,
+ x1, y1, x2, y2,
+#ifdef POLYSEGMENT
+ (pGC->
+ capStyle !=
+ CapNotLast) ?
+ 0 :
+#endif
+ OMIT_LAST);
+ }
+ else {
+ (*infoRec->SubsequentSolidBresenhamLine) (infoRec->
+ pScrn, x1, y1,
+ dmaj, dmin, e,
+#ifdef POLYSEGMENT
+ (pGC->
+ capStyle !=
+ CapNotLast)
+ ? (len + 1) :
+#endif
+ len, octant);
+ }
+ break;
+ }
+ else if (oc1 & oc2) { /* completely clipped */
+ pbox++;
+ }
+ else if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_LINE) {
+ (*infoRec->SetClippingRectangle) (infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x2 - 1,
+ pbox->y2 - 1);
+
+ if (infoRec->SubsequentSolidBresenhamLine) {
+ (*infoRec->SubsequentSolidBresenhamLine) (infoRec->
+ pScrn, x1, y1,
+ dmaj, dmin, e,
+#ifdef POLYSEGMENT
+ (pGC->
+ capStyle !=
+ CapNotLast)
+ ? (len + 1) :
+#endif
+ len, octant);
+ }
+ else {
+ (*infoRec->SubsequentSolidTwoPointLine) (infoRec->pScrn,
+ x1, y1, x2, y2,
+#ifdef POLYSEGMENT
+ (pGC->
+ capStyle !=
+ CapNotLast) ?
+ 0 :
+#endif
+ OMIT_LAST);
+ }
+ (*infoRec->DisableClipping) (infoRec->pScrn);
+ pbox++;
+ }
+ else {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int err, adx, ady;
+
+ if (octant & YMAJOR) {
+ ady = dmaj >> 1;
+ adx = dmin >> 1;
+ }
+ else {
+ ady = dmin >> 1;
+ adx = dmaj >> 1;
+ }
+
+ if (miZeroClipLine(pbox->x1, pbox->y1,
+ pbox->x2 - 1, pbox->y2 - 1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1) {
+ pbox++;
+ continue;
+ }
+
+ if (octant & YMAJOR)
+ len = abs(new_y2 - new_y1);
+ else
+ len = abs(new_x2 - new_x1);
+#ifdef POLYSEGMENT
+ if (clip2 != 0 || pGC->capStyle != CapNotLast)
+ len++;
+#else
+ len += (clip2 != 0);
+#endif
+ if (len) {
+ int abserr, clipdx, clipdy;
+
+ /* unwind bresenham error term to first point */
+ if (clip1) {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+
+ if (octant & YMAJOR)
+ err = e + clipdy * dmin - clipdx * dmaj;
+ else
+ err = e + clipdx * dmin - clipdy * dmaj;
+ }
+ else
+ err = e;
+
+#define range infoRec->SolidBresenhamLineErrorTermBits
+ abserr = abs(err);
+ while ((abserr & range) ||
+ (dmaj & range) || (dmin & range)) {
+ dmin >>= 1;
+ dmaj >>= 1;
+ abserr >>= 1;
+ err /= 2;
+ }
+
+ (*infoRec->SubsequentSolidBresenhamLine) (infoRec->
+ pScrn, new_x1,
+ new_y1, dmaj,
+ dmin, err,
+ len, octant);
+ }
+ pbox++;
+ }
+ } /* while (nbox--) */
+ } /* sloped line */
+ } /* while (nline--) */
+
+#ifndef POLYSEGMENT
+ /* paint the last point if the end style isn't CapNotLast.
+ (Assume that a projecting, butt, or round cap that is one
+ pixel wide is the same as the single pixel of the endpoint.)
+ */
+
+ if ((pGC->capStyle != CapNotLast) &&
+ ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
+ (ppt->y + yorg != pptInit->y + pDrawable->y) ||
+ (ppt == pptInit + 1))) {
+ nbox = nboxInit;
+ pbox = pboxInit;
+ while (nbox--) {
+ if ((x2 >= pbox->x1) && (y2 >= pbox->y1) &&
+ (x2 < pbox->x2) && (y2 < pbox->y2)) {
+ (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn, x2, y2,
+ 1, DEGREES_0);
+ break;
+ }
+ else
+ pbox++;
+ }
+ }
+#endif
+
+ SET_SYNC_FLAG(infoRec);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaLineMisc.c b/xorg-server/hw/xfree86/xaa/xaaLineMisc.c
index 44048674e..4379778f6 100644
--- a/xorg-server/hw/xfree86/xaa/xaaLineMisc.c
+++ b/xorg-server/hw/xfree86/xaa/xaaLineMisc.c
@@ -1,150 +1,149 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "miline.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-
-
-void
-XAASolidHorVertLineAsRects(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- if(dir == DEGREES_0)
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, len, 1);
- else
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, len);
-}
-
-
-void
-XAASolidHorVertLineAsTwoPoint(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- len--;
-
- if(dir == DEGREES_0)
- (*infoRec->SubsequentSolidTwoPointLine)(pScrn, x, y, x + len, y, 0);
- else
- (*infoRec->SubsequentSolidTwoPointLine)(pScrn, x, y, x, y + len, 0);
-}
-
-void
-XAASolidHorVertLineAsBresenham(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- if(dir == DEGREES_0)
- (*infoRec->SubsequentSolidBresenhamLine)(
- pScrn, x, y, len << 1, 0, -len, len, 0);
- else
- (*infoRec->SubsequentSolidBresenhamLine)(
- pScrn, x, y, len << 1, 0, -len, len, YMAJOR);
-}
-
-
-void
-XAAComputeDash(GCPtr pGC)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
- XAAGetGCKey());
- Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE;
- int PatternLength = 0;
- unsigned char* DashPtr = (unsigned char*)pGC->dash;
- CARD32 *ptr;
- int count = pGC->numInDashList;
- int shift, value, direction;
- Bool set;
-
- free(pGCPriv->DashPattern);
-
- pGCPriv->DashPattern = NULL;
- pGCPriv->DashLength = 0;
-
- while(count--)
- PatternLength += *(DashPtr++);
-
- if(!EvenDash)
- PatternLength <<= 1;
-
- if(PatternLength > infoRec->DashPatternMaxLength)
- return;
-
- if((infoRec->DashedLineFlags & LINE_PATTERN_POWER_OF_2_ONLY) &&
- (PatternLength & (PatternLength - 1)))
- return;
-
- pGCPriv->DashPattern = calloc((PatternLength + 31) >> 5, 4);
- if(!pGCPriv->DashPattern) return;
- pGCPriv->DashLength = PatternLength;
-
- if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
- LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) {
- direction = 1;
- set = TRUE;
- DashPtr = (unsigned char*)pGC->dash;
- } else {
- direction = -1;
- set = FALSE;
- DashPtr = (unsigned char*)pGC->dash + pGC->numInDashList - 1;
- }
-
- if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
- LINE_PATTERN_MSBFIRST_MSBJUSTIFIED))
- shift = 32 - (PatternLength & 31);
- else
- shift = 0;
-
- ptr = (CARD32*)(pGCPriv->DashPattern);
-
-CONCATENATE:
-
- count = pGC->numInDashList;
-
- while(count--) {
- value = *DashPtr;
- DashPtr += direction;
- while(value) {
- if(value < (32 - shift)) {
- if(set) *ptr |= XAAShiftMasks[value] << shift;
- shift += value;
- break;
- } else {
- if(set) *ptr |= ~0L << shift;
- value -= (32 - shift);
- shift = 0;
- ptr++;
- }
- }
- if(set) set = FALSE;
- else set = TRUE;
- }
-
- if(!EvenDash) {
- EvenDash = TRUE;
- if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
- LINE_PATTERN_LSBFIRST_LSBJUSTIFIED))
- DashPtr = (unsigned char*)pGC->dash;
- else
- DashPtr = (unsigned char*)pGC->dash + pGC->numInDashList;
- goto CONCATENATE;
- }
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "miline.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+void
+XAASolidHorVertLineAsRects(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ if (dir == DEGREES_0)
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, len, 1);
+ else
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, 1, len);
+}
+
+void
+XAASolidHorVertLineAsTwoPoint(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ len--;
+
+ if (dir == DEGREES_0)
+ (*infoRec->SubsequentSolidTwoPointLine) (pScrn, x, y, x + len, y, 0);
+ else
+ (*infoRec->SubsequentSolidTwoPointLine) (pScrn, x, y, x, y + len, 0);
+}
+
+void
+XAASolidHorVertLineAsBresenham(ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ if (dir == DEGREES_0)
+ (*infoRec->SubsequentSolidBresenhamLine) (pScrn, x, y, len << 1, 0,
+ -len, len, 0);
+ else
+ (*infoRec->SubsequentSolidBresenhamLine) (pScrn, x, y, len << 1, 0,
+ -len, len, YMAJOR);
+}
+
+void
+XAAComputeDash(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
+ Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE;
+ int PatternLength = 0;
+ unsigned char *DashPtr = (unsigned char *) pGC->dash;
+ CARD32 *ptr;
+ int count = pGC->numInDashList;
+ int shift, value, direction;
+ Bool set;
+
+ free(pGCPriv->DashPattern);
+
+ pGCPriv->DashPattern = NULL;
+ pGCPriv->DashLength = 0;
+
+ while (count--)
+ PatternLength += *(DashPtr++);
+
+ if (!EvenDash)
+ PatternLength <<= 1;
+
+ if (PatternLength > infoRec->DashPatternMaxLength)
+ return;
+
+ if ((infoRec->DashedLineFlags & LINE_PATTERN_POWER_OF_2_ONLY) &&
+ (PatternLength & (PatternLength - 1)))
+ return;
+
+ pGCPriv->DashPattern = calloc((PatternLength + 31) >> 5, 4);
+ if (!pGCPriv->DashPattern)
+ return;
+ pGCPriv->DashLength = PatternLength;
+
+ if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
+ LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) {
+ direction = 1;
+ set = TRUE;
+ DashPtr = (unsigned char *) pGC->dash;
+ }
+ else {
+ direction = -1;
+ set = FALSE;
+ DashPtr = (unsigned char *) pGC->dash + pGC->numInDashList - 1;
+ }
+
+ if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
+ LINE_PATTERN_MSBFIRST_MSBJUSTIFIED))
+ shift = 32 - (PatternLength & 31);
+ else
+ shift = 0;
+
+ ptr = (CARD32 *) (pGCPriv->DashPattern);
+
+ CONCATENATE:
+
+ count = pGC->numInDashList;
+
+ while (count--) {
+ value = *DashPtr;
+ DashPtr += direction;
+ while (value) {
+ if (value < (32 - shift)) {
+ if (set)
+ *ptr |= XAAShiftMasks[value] << shift;
+ shift += value;
+ break;
+ }
+ else {
+ if (set)
+ *ptr |= ~0L << shift;
+ value -= (32 - shift);
+ shift = 0;
+ ptr++;
+ }
+ }
+ if (set)
+ set = FALSE;
+ else
+ set = TRUE;
+ }
+
+ if (!EvenDash) {
+ EvenDash = TRUE;
+ if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
+ LINE_PATTERN_LSBFIRST_LSBJUSTIFIED))
+ DashPtr = (unsigned char *) pGC->dash;
+ else
+ DashPtr = (unsigned char *) pGC->dash + pGC->numInDashList;
+ goto CONCATENATE;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c b/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c
index 7431ba2a0..bfe7f9a09 100644
--- a/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c
+++ b/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c
@@ -1,5 +1,4 @@
-
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@@ -39,52 +38,52 @@
void
#ifdef TRIPLE_BITS
-EXPNAME(XAANonTEGlyphRenderer3)(
+ EXPNAME(XAANonTEGlyphRenderer3) (
#else
-EXPNAME(XAANonTEGlyphRenderer)(
+ EXPNAME(XAANonTEGlyphRenderer) (
#endif
- ScrnInfoPtr pScrn,
- int xText, int wText,
- int y, int h, int skipleft, int startline,
- NonTEGlyphInfo *glyphp,
- int fg, int rop,
- unsigned int planemask )
-{
+ ScrnInfoPtr pScrn,
+ int xText, int wText,
+ int y, int h, int skipleft, int startline,
+ NonTEGlyphInfo * glyphp,
+ int fg, int rop, unsigned int planemask) {
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32* base = (CARD32*)infoRec->ColorExpandBase;
+ CARD32 *base = (CARD32 *) infoRec->ColorExpandBase;
+
#ifdef TRIPLE_BITS
int dwords = ((3 * wText + 31) >> 5) * h;
#else
int dwords = ((wText + 31) >> 5) * h;
#endif
- (*infoRec->SetupForCPUToScreenColorExpandFill)(
- pScrn, fg, -1, rop, planemask);
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(
- pScrn, xText, y, wText, h, 0);
+ (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, -1, rop,
+ planemask);
+ (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, xText, y, wText, h,
+ 0);
#ifndef FIXEDBASE
#ifdef TRIPLE_BITS
- if((((3 * wText + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+ if ((((3 * wText + 31) >> 5) * h) <= infoRec->ColorExpandRange)
#else
- if((((wText + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+ if ((((wText + 31) >> 5) * h) <= infoRec->ColorExpandRange)
#endif
- while(h--)
- base = NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
+ while (h--)
+ base = NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
else
#endif
- while(h--)
- NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
+ while (h--)
+ NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
- if((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD) &&
- (dwords & 1)) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
+ if ((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD) &&
+ (dwords & 1)) {
+ base = (CARD32 *) infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
}
- if(infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
+ if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync) (pScrn);
+ else
+ SET_SYNC_FLAG(infoRec);
}
#ifndef FIXEDBASE
@@ -92,32 +91,31 @@ EXPNAME(XAANonTEGlyphRenderer)(
void
#ifdef TRIPLE_BITS
-EXPNAME(XAANonTEGlyphRendererScanline3)(
+ EXPNAME(XAANonTEGlyphRendererScanline3) (
#else
-EXPNAME(XAANonTEGlyphRendererScanline)(
+ EXPNAME(XAANonTEGlyphRendererScanline) (
#endif
- ScrnInfoPtr pScrn,
- int xText, int wText,
- int y, int h, int skipleft, int startline,
- NonTEGlyphInfo *glyphp,
- int fg, int rop,
- unsigned int planemask )
-{
+ ScrnInfoPtr pScrn,
+ int xText, int wText,
+ int y, int h, int skipleft,
+ int startline,
+ NonTEGlyphInfo * glyphp, int fg,
+ int rop, unsigned int planemask) {
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
int bufferNo = 0;
- CARD32* base;
-
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
- pScrn, fg, -1, rop, planemask);
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, xText, y, wText, h, 0);
-
- while(h--) {
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
+ CARD32 *base;
+
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, -1, rop,
+ planemask);
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, xText, y,
+ wText, h, 0);
+
+ while (h--) {
+ base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
+ NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
+ (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
+ if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
}
SET_SYNC_FLAG(infoRec);
@@ -131,70 +129,64 @@ EXPNAME(XAANonTEGlyphRendererScanline)(
********************************************************************/
-
-CARD32*
-NonTEGlyphFunc(
- CARD32 *base,
- NonTEGlyphInfo *glyphp,
- int line, int TotalWidth, int skipleft )
+CARD32 *
+NonTEGlyphFunc(CARD32 *base,
+ NonTEGlyphInfo * glyphp, int line, int TotalWidth, int skipleft)
{
CARD32 bits = 0;
- int shift = glyphp->width;
+ int shift = glyphp->width;
- if(skipleft) {
- if((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ if (skipleft) {
+ if ((line >= glyphp->firstline) && (line <= glyphp->lastline))
bits = SHIFT_R(glyphp->bitsp[line], skipleft);
- shift -= skipleft;
- } else if((line >= glyphp->firstline) && (line <= glyphp->lastline))
- bits = glyphp->bitsp[line];
-
-
- while(TotalWidth > 32) {
- while(shift < 32) {
- glyphp++;
- if((line >= glyphp->firstline) && (line <= glyphp->lastline))
- bits |= SHIFT_L(glyphp->bitsp[line],shift);
- shift += glyphp->width;
- }
+ shift -= skipleft;
+ }
+ else if ((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits = glyphp->bitsp[line];
+
+ while (TotalWidth > 32) {
+ while (shift < 32) {
+ glyphp++;
+ if ((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits |= SHIFT_L(glyphp->bitsp[line], shift);
+ shift += glyphp->width;
+ }
#ifdef TRIPLE_BITS
- WRITE_BITS3(bits);
+ WRITE_BITS3(bits);
#else
- WRITE_BITS(bits);
+ WRITE_BITS(bits);
#endif
- shift &= 31;
- if(shift &&
- (line >= glyphp->firstline) && (line <= glyphp->lastline))
- bits = SHIFT_R(glyphp->bitsp[line], glyphp->width - shift);
- else bits = 0;
- TotalWidth -= 32;
+ shift &= 31;
+ if (shift && (line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits = SHIFT_R(glyphp->bitsp[line], glyphp->width - shift);
+ else
+ bits = 0;
+ TotalWidth -= 32;
}
- if(TotalWidth) {
- TotalWidth -= shift;
- while(TotalWidth > 0) {
- glyphp++;
- if((line >= glyphp->firstline) && (line <= glyphp->lastline))
- bits |= SHIFT_L(glyphp->bitsp[line], shift);
- shift += glyphp->width;
- TotalWidth -= glyphp->width;
- }
+ if (TotalWidth) {
+ TotalWidth -= shift;
+ while (TotalWidth > 0) {
+ glyphp++;
+ if ((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits |= SHIFT_L(glyphp->bitsp[line], shift);
+ shift += glyphp->width;
+ TotalWidth -= glyphp->width;
+ }
#ifdef TRIPLE_BITS
- if (shift >= 22) {
- WRITE_BITS3(bits);
- } else if (shift >= 11) {
- WRITE_BITS2(bits);
- } else {
- WRITE_BITS1(bits);
- }
+ if (shift >= 22) {
+ WRITE_BITS3(bits);
+ }
+ else if (shift >= 11) {
+ WRITE_BITS2(bits);
+ }
+ else {
+ WRITE_BITS1(bits);
+ }
#else
- WRITE_BITS(bits);
+ WRITE_BITS(bits);
#endif
}
-
return base;
}
-
-
-
-
diff --git a/xorg-server/hw/xfree86/xaa/xaaNonTEText.c b/xorg-server/hw/xfree86/xaa/xaaNonTEText.c
index 519bda0e7..35b43912b 100644
--- a/xorg-server/hw/xfree86/xaa/xaaNonTEText.c
+++ b/xorg-server/hw/xfree86/xaa/xaaNonTEText.c
@@ -1,591 +1,591 @@
-
-/********************************************************************
-
- In this file we have GC level replacements for PolyText8/16,
- ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for NonTE (proportional)
- fonts. The idea is that everything in this file is device independent.
- The mentioned GCOps are merely wrappers for the
- PolyGlyphBltNonTEColorExpansion and ImageGlyphBltNonTEColorExpansion
- functions which calculate the boxes containing arbitrarily clipped
- text and passes them to the NonTEGlyphRenderer which will usually
- be a lower level XAA function which renders these clipped glyphs using
- the basic color expansion functions exported by the chipset driver.
- The NonTEGlyphRenderer itself may optionally be driver supplied to
- facilitate work-arounds/optimizations at a higher level than usual.
-
- Written by Mark Vojkovich (mvojkovi@ucsd.edu)
-
-********************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include <X11/fonts/font.h>
-#include "scrnintstr.h"
-#include "dixfontstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaacexp.h"
-#include "xaalocal.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-
-
-static void ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
- int xInit, int yInit, FontPtr font,
- int fg, int bg, unsigned planemask,
- RegionPtr cclip, int nglyph,
- unsigned char* gBase, CharInfoPtr *ppci);
-static int PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
- int xInit, int yInit, FontPtr font,
- int fg, int rop, unsigned planemask,
- RegionPtr cclip, int nglyph,
- unsigned char* gBase, CharInfoPtr *ppci);
-
-/********************************************************************
-
- GC level replacements for PolyText8/16 and ImageText8/16
- for NonTE fonts when using color expansion.
-
-********************************************************************/
-
-
-int
-XAAPolyText8NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
- int width = 0;
-
- (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
- (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
-
- if(n) {
- width = PolyGlyphBltNonTEColorExpansion( infoRec->pScrn,
- x + pDraw->x, y + pDraw->y, pGC->font,
- pGC->fgPixel, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font),
- infoRec->CharInfo);
- }
-
- return x + width;
-}
-
-
-int
-XAAPolyText16NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
- int width = 0;
-
- (*pGC->font->get_glyphs)(
- pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, infoRec->CharInfo);
-
- if(n) {
- width = PolyGlyphBltNonTEColorExpansion( infoRec->pScrn,
- x + pDraw->x, y + pDraw->y, pGC->font,
- pGC->fgPixel, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font),
- infoRec->CharInfo);
- }
-
- return x + width;
-}
-
-
-void
-XAAImageText8NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
- (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
-
- if(n) ImageGlyphBltNonTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-}
-
-
-void
-XAAImageText16NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- (*pGC->font->get_glyphs)(
- pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, infoRec->CharInfo);
-
- if(n) ImageGlyphBltNonTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-}
-
-
-
-/********************************************************************
-
- GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
- NonTE fonts when using color expansion.
-
-********************************************************************/
-
-
-void
-XAAImageGlyphBltNonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci, /* array of character info */
- pointer pglyphBase /* start of array of glyphs */
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- ImageGlyphBltNonTEColorExpansion(
- infoRec->pScrn, xInit + pDraw->x, yInit + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
- pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
-}
-
-void
-XAAPolyGlyphBltNonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci, /* array of character info */
- pointer pglyphBase /* start of array of glyphs */
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- PolyGlyphBltNonTEColorExpansion(
- infoRec->pScrn, xInit + pDraw->x, yInit + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
-}
-
-
-
-
-/********************************************************************
-
- ImageGlyphBltNonTEColorExpansion -
- PolyGlyphBltNonTEColorExpansion -
-
- These guys compute the clipped pieces of text and send it to
- the lower-level function which will handle acceleration of
- arbitrarily clipped text.
-
-********************************************************************/
-
-
-
-static int
-CollectCharacterInfo(
- NonTEGlyphPtr glyphs,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- FontPtr pfont
-){
- int i, w = 0;
-
- for(i = 0; i < nglyph; i++, ppci++, glyphs++) {
- glyphs->bits = (unsigned char*)((*ppci)->bits);
- glyphs->start = w + (*ppci)->metrics.leftSideBearing;
- glyphs->end = w + (*ppci)->metrics.rightSideBearing;
- glyphs->yoff = (*ppci)->metrics.ascent;
- glyphs->height = glyphs->yoff + (*ppci)->metrics.descent;
- glyphs->srcwidth = PADGLYPHWIDTHBYTES(glyphs->end - glyphs->start);
- w += (*ppci)->metrics.characterWidth;
- }
- return w;
-}
-
-
-static void
-PolyGlyphBltAsSingleBitmap (
- ScrnInfoPtr pScrn,
- int nglyph,
- FontPtr font,
- int xInit,
- int yInit,
- int nbox,
- BoxPtr pbox,
- int fg,
- int rop,
- unsigned planemask
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32 *block, *pntr, *bits;
- int pitch, topLine, botLine, top, bot, height;
- int Left, Right, Top, Bottom;
- int LeftEdge, RightEdge;
- int bitPitch, shift, size, i, skippix;
- NonTEGlyphPtr glyphs = infoRec->GlyphInfo;
- Bool extra;
-
- Left = xInit + infoRec->GlyphInfo[0].start;
- Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
- Top = yInit - FONTMAXBOUNDS(font,ascent);
- Bottom = yInit + FONTMAXBOUNDS(font,descent);
-
- /* get into the first band that may contain part of our string */
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- if(!nbox) return;
-
- pitch = (Right - Left + 31) >> 5;
- size = (pitch << 2) * (Bottom - Top);
- block = calloc(1, size);
-
- topLine = 10000; botLine = -10000;
-
- while(nglyph--) {
- top = -glyphs->yoff;
- bot = top + glyphs->height;
- if(top < topLine) topLine = top;
- if(bot > botLine) botLine = bot;
- skippix = glyphs->start - infoRec->GlyphInfo[0].start;
- bits = (CARD32*)glyphs->bits;
- bitPitch = glyphs->srcwidth >> 2;
- pntr = block + ((FONTMAXBOUNDS(font,ascent) + top) * pitch) +
- (skippix >> 5);
- shift = skippix & 31;
- extra = ((shift + glyphs->end - glyphs->start) > 32);
-
- for(i = top; i < bot; i++) {
- *pntr |= SHIFT_L(*bits, shift);
- if(extra)
- *(pntr + 1) |= SHIFT_R(*bits,32 - shift);
- pntr += pitch;
- bits += bitPitch;
- }
-
- glyphs++;
- }
-
- pntr = block + ((FONTMAXBOUNDS(font,ascent) + topLine) * pitch);
-
- Top = yInit + topLine;
- Bottom = yInit + botLine;
-
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- while(nbox && (Bottom > pbox->y1)) {
- LeftEdge = max(Left, pbox->x1);
- RightEdge = min(Right, pbox->x2);
-
- if(RightEdge > LeftEdge) {
- skippix = LeftEdge - Left;
- topLine = max(Top, pbox->y1);
- botLine = min(Bottom, pbox->y2);
- height = botLine - topLine;
-
- if(height > 0)
- (*infoRec->WriteBitmap)(pScrn, LeftEdge, topLine,
- RightEdge - LeftEdge, height,
- (unsigned char*)(pntr + ((topLine - Top) * pitch) +
- (skippix >> 5)),
- pitch << 2, skippix & 31, fg, -1, rop, planemask);
- }
-
- nbox--; pbox++;
- }
-
- free(block);
-}
-
-static void
-ImageGlyphBltNonTEColorExpansion(
- ScrnInfoPtr pScrn,
- int xInit, int yInit,
- FontPtr font,
- int fg, int bg,
- unsigned planemask,
- RegionPtr cclip,
- int nglyph,
- unsigned char* gBase,
- CharInfoPtr *ppci
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int skippix, skipglyph, width, n, i;
- int Left, Right, Top, Bottom;
- int LeftEdge, RightEdge, ytop, ybot;
- int nbox = RegionNumRects(cclip);
- BoxPtr pbox = RegionRects(cclip);
- Bool AlreadySetup = FALSE;
-
- width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
-
- /* find our backing rectangle dimensions */
- Left = xInit;
- Right = Left + width;
- Top = yInit - FONTASCENT(font);
- Bottom = yInit + FONTDESCENT(font);
-
- /* get into the first band that may contain part of our box */
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- while(nbox && (Bottom >= pbox->y1)) {
- /* handle backing rect first */
- LeftEdge = max(Left, pbox->x1);
- RightEdge = min(Right, pbox->x2);
- if(RightEdge > LeftEdge) {
- ytop = max(Top, pbox->y1);
- ybot = min(Bottom, pbox->y2);
-
- if(ybot > ytop) {
- if(!AlreadySetup) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, GXcopy, planemask);
- AlreadySetup = TRUE;
- }
- (*infoRec->SubsequentSolidFillRect)(pScrn,
- LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop);
- }
- }
- nbox--; pbox++;
- }
-
- nbox = RegionNumRects(cclip);
- pbox = RegionRects(cclip);
-
- if(infoRec->WriteBitmap && (nglyph > 1) &&
- ((FONTMAXBOUNDS(font, rightSideBearing) -
- FONTMINBOUNDS(font, leftSideBearing)) <= 32))
- {
- PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
- xInit, yInit, nbox, pbox,
- fg, GXcopy, planemask);
-
- return;
- }
-
- /* compute an approximate but covering bounding box */
- Left = xInit + infoRec->GlyphInfo[0].start;
- Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
- Top = yInit - FONTMAXBOUNDS(font,ascent);
- Bottom = yInit + FONTMAXBOUNDS(font,descent);
-
- /* get into the first band that may contain part of our box */
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- /* stop when the lower edge of the box is beyond our string */
- while(nbox && (Bottom >= pbox->y1)) {
- LeftEdge = max(Left, pbox->x1);
- RightEdge = min(Right, pbox->x2);
-
- if(RightEdge > LeftEdge) { /* we're possibly drawing something */
- ytop = max(Top, pbox->y1);
- ybot = min(Bottom, pbox->y2);
- if(ybot > ytop) {
- skippix = LeftEdge - xInit;
- skipglyph = 0;
- while(skippix >= infoRec->GlyphInfo[skipglyph].end)
- skipglyph++;
-
- skippix = RightEdge - xInit;
- n = 0; i = skipglyph;
- while((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
- i++; n++;
- }
-
- if(n) (*infoRec->NonTEGlyphRenderer)(pScrn,
- xInit, yInit, n, infoRec->GlyphInfo + skipglyph,
- pbox, fg, GXcopy, planemask);
- }
- }
-
- nbox--; pbox++;
- }
-}
-
-
-static int
-PolyGlyphBltNonTEColorExpansion(
- ScrnInfoPtr pScrn,
- int xInit, int yInit,
- FontPtr font,
- int fg, int rop,
- unsigned planemask,
- RegionPtr cclip,
- int nglyph,
- unsigned char* gBase,
- CharInfoPtr *ppci
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int skippix, skipglyph, width, n, i;
- int Left, Right, Top, Bottom;
- int LeftEdge, RightEdge;
- int nbox = RegionNumRects(cclip);
- BoxPtr pbox = RegionRects(cclip);
-
- width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
-
- if(!nbox)
- return width;
-
- if((infoRec->WriteBitmap) && (rop == GXcopy) && (nglyph > 1) &&
- ((FONTMAXBOUNDS(font, rightSideBearing) -
- FONTMINBOUNDS(font, leftSideBearing)) <= 32)) {
-
- PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
- xInit, yInit, nbox, pbox,
- fg, rop, planemask);
-
- return width;
- }
-
- /* compute an approximate but covering bounding box */
- Left = xInit + infoRec->GlyphInfo[0].start;
- Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
- Top = yInit - FONTMAXBOUNDS(font,ascent);
- Bottom = yInit + FONTMAXBOUNDS(font,descent);
-
- /* get into the first band that may contain part of our string */
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- /* stop when the lower edge of the box is beyond our string */
- while(nbox && (Bottom >= pbox->y1)) {
- LeftEdge = max(Left, pbox->x1);
- RightEdge = min(Right, pbox->x2);
-
- if(RightEdge > LeftEdge) { /* we're possibly drawing something */
-
- skippix = LeftEdge - xInit;
- skipglyph = 0;
- while(skippix >= infoRec->GlyphInfo[skipglyph].end)
- skipglyph++;
-
- skippix = RightEdge - xInit;
- n = 0; i = skipglyph;
- while((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
- i++; n++;
- }
-
- if(n) (*infoRec->NonTEGlyphRenderer)(pScrn,
- xInit, yInit, n, infoRec->GlyphInfo + skipglyph,
- pbox, fg, rop, planemask);
- }
-
- nbox--; pbox++;
- }
- return width;
-}
-
-
-/* It is possible that the none of the glyphs passed to the
- NonTEGlyphRenderer will be drawn. This function being called
- indicates that part of the text string's bounding box is visible
- but not necessarily that any of the characters are visible */
-
-void XAANonTEGlyphRenderer(
- ScrnInfoPtr pScrn,
- int x, int y, int n,
- NonTEGlyphPtr glyphs,
- BoxPtr pbox,
- int fg, int rop,
- unsigned int planemask
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int x1, x2, y1, y2, i, w, h, skipleft, skiptop;
- unsigned char *src;
-
- for(i = 0; i < n; i++, glyphs++) {
- x1 = x + glyphs->start;
- x2 = x + glyphs->end;
- y1 = y - glyphs->yoff;
- y2 = y1 + glyphs->height;
-
- if(y1 < pbox->y1) {
- skiptop = pbox->y1 - y1;
- y1 = pbox->y1;
- } else skiptop = 0;
- if(y2 > pbox->y2) y2 = pbox->y2;
- h = y2 - y1;
- if(h <= 0) continue;
-
- if(x1 < pbox->x1) {
- skipleft = pbox->x1 - x1;
- x1 = pbox->x1;
- } else skipleft = 0;
- if(x2 > pbox->x2) x2 = pbox->x2;
-
- w = x2 - x1;
-
- if(w > 0) {
- src = glyphs->bits + (skiptop * glyphs->srcwidth);
-
- if(skipleft) {
- src += (skipleft >> 5) << 2;
- skipleft &= 31;
- }
-
- (*infoRec->WriteBitmap)(pScrn, x1, y1, w, h, src,
- glyphs->srcwidth, skipleft, fg, -1, rop, planemask);
- }
- }
-
-}
+
+/********************************************************************
+
+ In this file we have GC level replacements for PolyText8/16,
+ ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for NonTE (proportional)
+ fonts. The idea is that everything in this file is device independent.
+ The mentioned GCOps are merely wrappers for the
+ PolyGlyphBltNonTEColorExpansion and ImageGlyphBltNonTEColorExpansion
+ functions which calculate the boxes containing arbitrarily clipped
+ text and passes them to the NonTEGlyphRenderer which will usually
+ be a lower level XAA function which renders these clipped glyphs using
+ the basic color expansion functions exported by the chipset driver.
+ The NonTEGlyphRenderer itself may optionally be driver supplied to
+ facilitate work-arounds/optimizations at a higher level than usual.
+
+ Written by Mark Vojkovich (mvojkovi@ucsd.edu)
+
+********************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/fonts/font.h>
+#include "scrnintstr.h"
+#include "dixfontstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaacexp.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+
+static void ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
+ int xInit, int yInit, FontPtr font,
+ int fg, int bg, unsigned planemask,
+ RegionPtr cclip, int nglyph,
+ unsigned char *gBase,
+ CharInfoPtr * ppci);
+static int PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn, int xInit,
+ int yInit, FontPtr font, int fg,
+ int rop, unsigned planemask,
+ RegionPtr cclip, int nglyph,
+ unsigned char *gBase,
+ CharInfoPtr * ppci);
+
+/********************************************************************
+
+ GC level replacements for PolyText8/16 and ImageText8/16
+ for NonTE fonts when using color expansion.
+
+********************************************************************/
+
+int
+XAAPolyText8NonTEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+ int width = 0;
+
+ (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
+ (unsigned char *) chars, Linear8Bit, &n,
+ infoRec->CharInfo);
+
+ if (n) {
+ width = PolyGlyphBltNonTEColorExpansion(infoRec->pScrn,
+ x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel,
+ pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, n,
+ FONTGLYPHS(pGC->font),
+ infoRec->CharInfo);
+ }
+
+ return x + width;
+}
+
+int
+XAAPolyText16NonTEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+ int width = 0;
+
+ (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
+ (unsigned char *) chars,
+ (FONTLASTROW(pGC->font) ==
+ 0) ? Linear16Bit : TwoD16Bit, &n,
+ infoRec->CharInfo);
+
+ if (n) {
+ width = PolyGlyphBltNonTEColorExpansion(infoRec->pScrn,
+ x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel,
+ pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, n,
+ FONTGLYPHS(pGC->font),
+ infoRec->CharInfo);
+ }
+
+ return x + width;
+}
+
+void
+XAAImageText8NonTEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
+ (unsigned char *) chars, Linear8Bit, &n,
+ infoRec->CharInfo);
+
+ if (n)
+ ImageGlyphBltNonTEColorExpansion(infoRec->pScrn, x + pDraw->x,
+ y + pDraw->y, pGC->font, pGC->fgPixel,
+ pGC->bgPixel, pGC->planemask,
+ pGC->pCompositeClip, n,
+ FONTGLYPHS(pGC->font),
+ infoRec->CharInfo);
+}
+
+void
+XAAImageText16NonTEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y, int count, unsigned short *chars)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
+ (unsigned char *) chars,
+ (FONTLASTROW(pGC->font) ==
+ 0) ? Linear16Bit : TwoD16Bit, &n,
+ infoRec->CharInfo);
+
+ if (n)
+ ImageGlyphBltNonTEColorExpansion(infoRec->pScrn, x + pDraw->x,
+ y + pDraw->y, pGC->font, pGC->fgPixel,
+ pGC->bgPixel, pGC->planemask,
+ pGC->pCompositeClip, n,
+ FONTGLYPHS(pGC->font),
+ infoRec->CharInfo);
+}
+
+/********************************************************************
+
+ GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
+ NonTE fonts when using color expansion.
+
+********************************************************************/
+
+void
+XAAImageGlyphBltNonTEColorExpansion(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */
+ pointer pglyphBase /* start of array of glyphs */
+ )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ ImageGlyphBltNonTEColorExpansion(infoRec->pScrn, xInit + pDraw->x,
+ yInit + pDraw->y, pGC->font, pGC->fgPixel,
+ pGC->bgPixel, pGC->planemask,
+ pGC->pCompositeClip, nglyph,
+ (unsigned char *) pglyphBase, ppci);
+}
+
+void
+XAAPolyGlyphBltNonTEColorExpansion(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */
+ pointer pglyphBase /* start of array of glyphs */
+ )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ PolyGlyphBltNonTEColorExpansion(infoRec->pScrn, xInit + pDraw->x,
+ yInit + pDraw->y, pGC->font, pGC->fgPixel,
+ pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, nglyph,
+ (unsigned char *) pglyphBase, ppci);
+}
+
+/********************************************************************
+
+ ImageGlyphBltNonTEColorExpansion -
+ PolyGlyphBltNonTEColorExpansion -
+
+ These guys compute the clipped pieces of text and send it to
+ the lower-level function which will handle acceleration of
+ arbitrarily clipped text.
+
+********************************************************************/
+
+static int
+CollectCharacterInfo(NonTEGlyphPtr glyphs,
+ unsigned int nglyph, CharInfoPtr * ppci, FontPtr pfont)
+{
+ int i, w = 0;
+
+ for (i = 0; i < nglyph; i++, ppci++, glyphs++) {
+ glyphs->bits = (unsigned char *) ((*ppci)->bits);
+ glyphs->start = w + (*ppci)->metrics.leftSideBearing;
+ glyphs->end = w + (*ppci)->metrics.rightSideBearing;
+ glyphs->yoff = (*ppci)->metrics.ascent;
+ glyphs->height = glyphs->yoff + (*ppci)->metrics.descent;
+ glyphs->srcwidth = PADGLYPHWIDTHBYTES(glyphs->end - glyphs->start);
+ w += (*ppci)->metrics.characterWidth;
+ }
+ return w;
+}
+
+static void
+PolyGlyphBltAsSingleBitmap(ScrnInfoPtr pScrn,
+ int nglyph,
+ FontPtr font,
+ int xInit,
+ int yInit,
+ int nbox,
+ BoxPtr pbox, int fg, int rop, unsigned planemask)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *block, *pntr, *bits;
+ int pitch, topLine, botLine, top, bot, height;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge;
+ int bitPitch, shift, size, i, skippix;
+ NonTEGlyphPtr glyphs = infoRec->GlyphInfo;
+ Bool extra;
+
+ Left = xInit + infoRec->GlyphInfo[0].start;
+ Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
+ Top = yInit - FONTMAXBOUNDS(font, ascent);
+ Bottom = yInit + FONTMAXBOUNDS(font, descent);
+
+ /* get into the first band that may contain part of our string */
+ while (nbox && (Top >= pbox->y2)) {
+ pbox++;
+ nbox--;
+ }
+
+ if (!nbox)
+ return;
+
+ pitch = (Right - Left + 31) >> 5;
+ size = (pitch << 2) * (Bottom - Top);
+ block = calloc(1, size);
+
+ topLine = 10000;
+ botLine = -10000;
+
+ while (nglyph--) {
+ top = -glyphs->yoff;
+ bot = top + glyphs->height;
+ if (top < topLine)
+ topLine = top;
+ if (bot > botLine)
+ botLine = bot;
+ skippix = glyphs->start - infoRec->GlyphInfo[0].start;
+ bits = (CARD32 *) glyphs->bits;
+ bitPitch = glyphs->srcwidth >> 2;
+ pntr = block + ((FONTMAXBOUNDS(font, ascent) + top) * pitch) +
+ (skippix >> 5);
+ shift = skippix & 31;
+ extra = ((shift + glyphs->end - glyphs->start) > 32);
+
+ for (i = top; i < bot; i++) {
+ *pntr |= SHIFT_L(*bits, shift);
+ if (extra)
+ *(pntr + 1) |= SHIFT_R(*bits, 32 - shift);
+ pntr += pitch;
+ bits += bitPitch;
+ }
+
+ glyphs++;
+ }
+
+ pntr = block + ((FONTMAXBOUNDS(font, ascent) + topLine) * pitch);
+
+ Top = yInit + topLine;
+ Bottom = yInit + botLine;
+
+ while (nbox && (Top >= pbox->y2)) {
+ pbox++;
+ nbox--;
+ }
+
+ while (nbox && (Bottom > pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if (RightEdge > LeftEdge) {
+ skippix = LeftEdge - Left;
+ topLine = max(Top, pbox->y1);
+ botLine = min(Bottom, pbox->y2);
+ height = botLine - topLine;
+
+ if (height > 0)
+ (*infoRec->WriteBitmap) (pScrn, LeftEdge, topLine,
+ RightEdge - LeftEdge, height,
+ (unsigned char *) (pntr +
+ ((topLine -
+ Top) * pitch) +
+ (skippix >> 5)),
+ pitch << 2, skippix & 31, fg, -1, rop,
+ planemask);
+ }
+
+ nbox--;
+ pbox++;
+ }
+
+ free(block);
+}
+
+static void
+ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
+ int xInit, int yInit,
+ FontPtr font,
+ int fg, int bg,
+ unsigned planemask,
+ RegionPtr cclip,
+ int nglyph,
+ unsigned char *gBase, CharInfoPtr * ppci)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int skippix, skipglyph, width, n, i;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge, ytop, ybot;
+ int nbox = RegionNumRects(cclip);
+ BoxPtr pbox = RegionRects(cclip);
+ Bool AlreadySetup = FALSE;
+
+ width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
+
+ /* find our backing rectangle dimensions */
+ Left = xInit;
+ Right = Left + width;
+ Top = yInit - FONTASCENT(font);
+ Bottom = yInit + FONTDESCENT(font);
+
+ /* get into the first band that may contain part of our box */
+ while (nbox && (Top >= pbox->y2)) {
+ pbox++;
+ nbox--;
+ }
+
+ while (nbox && (Bottom >= pbox->y1)) {
+ /* handle backing rect first */
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+ if (RightEdge > LeftEdge) {
+ ytop = max(Top, pbox->y1);
+ ybot = min(Bottom, pbox->y2);
+
+ if (ybot > ytop) {
+ if (!AlreadySetup) {
+ (*infoRec->SetupForSolidFill) (pScrn, bg, GXcopy,
+ planemask);
+ AlreadySetup = TRUE;
+ }
+ (*infoRec->SubsequentSolidFillRect) (pScrn,
+ LeftEdge, ytop,
+ RightEdge - LeftEdge,
+ ybot - ytop);
+ }
+ }
+ nbox--;
+ pbox++;
+ }
+
+ nbox = RegionNumRects(cclip);
+ pbox = RegionRects(cclip);
+
+ if (infoRec->WriteBitmap && (nglyph > 1) &&
+ ((FONTMAXBOUNDS(font, rightSideBearing) -
+ FONTMINBOUNDS(font, leftSideBearing)) <= 32)) {
+ PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
+ xInit, yInit, nbox, pbox,
+ fg, GXcopy, planemask);
+
+ return;
+ }
+
+ /* compute an approximate but covering bounding box */
+ Left = xInit + infoRec->GlyphInfo[0].start;
+ Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
+ Top = yInit - FONTMAXBOUNDS(font, ascent);
+ Bottom = yInit + FONTMAXBOUNDS(font, descent);
+
+ /* get into the first band that may contain part of our box */
+ while (nbox && (Top >= pbox->y2)) {
+ pbox++;
+ nbox--;
+ }
+
+ /* stop when the lower edge of the box is beyond our string */
+ while (nbox && (Bottom >= pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if (RightEdge > LeftEdge) { /* we're possibly drawing something */
+ ytop = max(Top, pbox->y1);
+ ybot = min(Bottom, pbox->y2);
+ if (ybot > ytop) {
+ skippix = LeftEdge - xInit;
+ skipglyph = 0;
+ while (skippix >= infoRec->GlyphInfo[skipglyph].end)
+ skipglyph++;
+
+ skippix = RightEdge - xInit;
+ n = 0;
+ i = skipglyph;
+ while ((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
+ i++;
+ n++;
+ }
+
+ if (n)
+ (*infoRec->NonTEGlyphRenderer) (pScrn,
+ xInit, yInit, n,
+ infoRec->GlyphInfo +
+ skipglyph, pbox, fg, GXcopy,
+ planemask);
+ }
+ }
+
+ nbox--;
+ pbox++;
+ }
+}
+
+static int
+PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
+ int xInit, int yInit,
+ FontPtr font,
+ int fg, int rop,
+ unsigned planemask,
+ RegionPtr cclip,
+ int nglyph,
+ unsigned char *gBase, CharInfoPtr * ppci)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int skippix, skipglyph, width, n, i;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge;
+ int nbox = RegionNumRects(cclip);
+ BoxPtr pbox = RegionRects(cclip);
+
+ width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
+
+ if (!nbox)
+ return width;
+
+ if ((infoRec->WriteBitmap) && (rop == GXcopy) && (nglyph > 1) &&
+ ((FONTMAXBOUNDS(font, rightSideBearing) -
+ FONTMINBOUNDS(font, leftSideBearing)) <= 32)) {
+
+ PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
+ xInit, yInit, nbox, pbox,
+ fg, rop, planemask);
+
+ return width;
+ }
+
+ /* compute an approximate but covering bounding box */
+ Left = xInit + infoRec->GlyphInfo[0].start;
+ Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
+ Top = yInit - FONTMAXBOUNDS(font, ascent);
+ Bottom = yInit + FONTMAXBOUNDS(font, descent);
+
+ /* get into the first band that may contain part of our string */
+ while (nbox && (Top >= pbox->y2)) {
+ pbox++;
+ nbox--;
+ }
+
+ /* stop when the lower edge of the box is beyond our string */
+ while (nbox && (Bottom >= pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if (RightEdge > LeftEdge) { /* we're possibly drawing something */
+
+ skippix = LeftEdge - xInit;
+ skipglyph = 0;
+ while (skippix >= infoRec->GlyphInfo[skipglyph].end)
+ skipglyph++;
+
+ skippix = RightEdge - xInit;
+ n = 0;
+ i = skipglyph;
+ while ((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
+ i++;
+ n++;
+ }
+
+ if (n)
+ (*infoRec->NonTEGlyphRenderer) (pScrn,
+ xInit, yInit, n,
+ infoRec->GlyphInfo + skipglyph,
+ pbox, fg, rop, planemask);
+ }
+
+ nbox--;
+ pbox++;
+ }
+ return width;
+}
+
+/* It is possible that the none of the glyphs passed to the
+ NonTEGlyphRenderer will be drawn. This function being called
+ indicates that part of the text string's bounding box is visible
+ but not necessarily that any of the characters are visible */
+
+void
+XAANonTEGlyphRenderer(ScrnInfoPtr pScrn,
+ int x, int y, int n,
+ NonTEGlyphPtr glyphs,
+ BoxPtr pbox, int fg, int rop, unsigned int planemask)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x1, x2, y1, y2, i, w, h, skipleft, skiptop;
+ unsigned char *src;
+
+ for (i = 0; i < n; i++, glyphs++) {
+ x1 = x + glyphs->start;
+ x2 = x + glyphs->end;
+ y1 = y - glyphs->yoff;
+ y2 = y1 + glyphs->height;
+
+ if (y1 < pbox->y1) {
+ skiptop = pbox->y1 - y1;
+ y1 = pbox->y1;
+ }
+ else
+ skiptop = 0;
+ if (y2 > pbox->y2)
+ y2 = pbox->y2;
+ h = y2 - y1;
+ if (h <= 0)
+ continue;
+
+ if (x1 < pbox->x1) {
+ skipleft = pbox->x1 - x1;
+ x1 = pbox->x1;
+ }
+ else
+ skipleft = 0;
+ if (x2 > pbox->x2)
+ x2 = pbox->x2;
+
+ w = x2 - x1;
+
+ if (w > 0) {
+ src = glyphs->bits + (skiptop * glyphs->srcwidth);
+
+ if (skipleft) {
+ src += (skipleft >> 5) << 2;
+ skipleft &= 31;
+ }
+
+ (*infoRec->WriteBitmap) (pScrn, x1, y1, w, h, src,
+ glyphs->srcwidth, skipleft, fg, -1, rop,
+ planemask);
+ }
+ }
+
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaOffscreen.c b/xorg-server/hw/xfree86/xaa/xaaOffscreen.c
index 41be2b491..7d89fc17a 100644
--- a/xorg-server/hw/xfree86/xaa/xaaOffscreen.c
+++ b/xorg-server/hw/xfree86/xaa/xaaOffscreen.c
@@ -1,162 +1,163 @@
-
-/*
- Copyright (c) 1999 - The XFree86 Project Inc.
-
- Written by Mark Vojkovich
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "miline.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "xf86fbman.h"
-#include "servermd.h"
-
-void
-XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
- XAAPixmapPtr pPriv;
-
- while(pLink) {
- pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix);
- pLink->area = pPriv->offscreenArea;
- XAAMoveOutOffscreenPixmap(pLink->pPix);
- pLink = pLink->next;
- }
-}
-
-
-
-void
-XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
- PixmapPtr pPix, pScreenPix, tmpPix;
- pointer data;
- XAAPixmapPtr pPriv;
- GCPtr pGC;
- FBAreaPtr area;
-
- pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
-
- while(pLink) {
- pPix = pLink->pPix;
- pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- area = pLink->area;
-
- data = pPix->devPrivate.ptr;
- tmpPix = GetScratchPixmapHeader(pScreen,
- pPix->drawable.width, pPix->drawable.height,
- pPix->drawable.depth, pPix->drawable.bitsPerPixel,
- pPix->devKind, data);
-
- pPriv->freeData = FALSE;
-
- pPix->drawable.x = area->box.x1;
- pPix->drawable.y = area->box.y1;
- pPix->devKind = pScreenPix->devKind;
- pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
- pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel;
- pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- if(!tmpPix) {
- pPriv->offscreenArea = area;
- free(data);
- pLink = pLink->next;
- continue;
- }
-
- pGC = GetScratchGC(pPix->drawable.depth, pScreen);
- ValidateGC((DrawablePtr)pPix, pGC);
-
- (*pGC->ops->CopyArea)((DrawablePtr)tmpPix, (DrawablePtr)pPix, pGC,
- 0, 0, pPix->drawable.width, pPix->drawable.height, 0, 0);
-
- free(data);
- tmpPix->devPrivate.ptr = NULL;
-
- FreeScratchGC(pGC);
- FreeScratchPixmapHeader(tmpPix);
-
- pPriv->offscreenArea = area;
- pLink->area = NULL;
- pLink = pLink->next;
- }
-}
-
-
-void
-XAARemoveAreaCallback(FBAreaPtr area)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen);
- PixmapPtr pPix = (PixmapPtr)area->devPrivate.ptr;
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
-
- XAAMoveOutOffscreenPixmap(pPix);
-
- pPriv->flags &= ~OFFSCREEN;
-
- DELIST_OFFSCREEN_PIXMAP(pPix);
-}
-
-void
-XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
-{
- ScreenPtr pScreen = pPix->drawable.pScreen;
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- int width, height, devKind, bitsPerPixel;
- PixmapPtr tmpPix;
- unsigned char *data;
- GCPtr pGC;
-
- width = pPix->drawable.width;
- height = pPix->drawable.height;
- bitsPerPixel = pPix->drawable.bitsPerPixel;
-
- devKind = BitmapBytePad(width * bitsPerPixel);
- if(!(data = malloc(devKind * height)))
- FatalError("Out of memory\n");
-
- tmpPix = GetScratchPixmapHeader(pScreen, width, height,
- pPix->drawable.depth, bitsPerPixel, devKind, data);
- if(!tmpPix) {
- free(data);
- FatalError("Out of memory\n");
- }
-
- pGC = GetScratchGC(pPix->drawable.depth, pScreen);
- ValidateGC((DrawablePtr)tmpPix, pGC);
-
- (*pGC->ops->CopyArea)((DrawablePtr)pPix, (DrawablePtr)tmpPix,
- pGC, 0, 0, width, height, 0, 0);
-
- FreeScratchGC(pGC);
- FreeScratchPixmapHeader(tmpPix);
-
- pPix->drawable.x = 0;
- pPix->drawable.y = 0;
- pPix->devKind = devKind;
- pPix->devPrivate.ptr = data;
- pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- pPriv->offscreenArea = NULL;
- pPriv->freeData = TRUE;
-}
+
+/*
+ Copyright (c) 1999 - The XFree86 Project Inc.
+
+ Written by Mark Vojkovich
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+
+void
+XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
+ XAAPixmapPtr pPriv;
+
+ while (pLink) {
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix);
+ pLink->area = pPriv->offscreenArea;
+ XAAMoveOutOffscreenPixmap(pLink->pPix);
+ pLink = pLink->next;
+ }
+}
+
+void
+XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
+ PixmapPtr pPix, pScreenPix, tmpPix;
+ pointer data;
+ XAAPixmapPtr pPriv;
+ GCPtr pGC;
+ FBAreaPtr area;
+
+ pScreenPix = (*pScreen->GetScreenPixmap) (pScreen);
+
+ while (pLink) {
+ pPix = pLink->pPix;
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ area = pLink->area;
+
+ data = pPix->devPrivate.ptr;
+ tmpPix = GetScratchPixmapHeader(pScreen,
+ pPix->drawable.width,
+ pPix->drawable.height,
+ pPix->drawable.depth,
+ pPix->drawable.bitsPerPixel,
+ pPix->devKind, data);
+
+ pPriv->freeData = FALSE;
+
+ pPix->drawable.x = area->box.x1;
+ pPix->drawable.y = area->box.y1;
+ pPix->devKind = pScreenPix->devKind;
+ pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
+ pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel;
+ pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ if (!tmpPix) {
+ pPriv->offscreenArea = area;
+ free(data);
+ pLink = pLink->next;
+ continue;
+ }
+
+ pGC = GetScratchGC(pPix->drawable.depth, pScreen);
+ ValidateGC((DrawablePtr) pPix, pGC);
+
+ (*pGC->ops->CopyArea) ((DrawablePtr) tmpPix, (DrawablePtr) pPix, pGC,
+ 0, 0, pPix->drawable.width,
+ pPix->drawable.height, 0, 0);
+
+ free(data);
+ tmpPix->devPrivate.ptr = NULL;
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(tmpPix);
+
+ pPriv->offscreenArea = area;
+ pLink->area = NULL;
+ pLink = pLink->next;
+ }
+}
+
+void
+XAARemoveAreaCallback(FBAreaPtr area)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen);
+ PixmapPtr pPix = (PixmapPtr) area->devPrivate.ptr;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+
+ XAAMoveOutOffscreenPixmap(pPix);
+
+ pPriv->flags &= ~OFFSCREEN;
+
+ DELIST_OFFSCREEN_PIXMAP(pPix);
+}
+
+void
+XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ int width, height, devKind, bitsPerPixel;
+ PixmapPtr tmpPix;
+ unsigned char *data;
+ GCPtr pGC;
+
+ width = pPix->drawable.width;
+ height = pPix->drawable.height;
+ bitsPerPixel = pPix->drawable.bitsPerPixel;
+
+ devKind = BitmapBytePad(width * bitsPerPixel);
+ if (!(data = malloc(devKind * height)))
+ FatalError("Out of memory\n");
+
+ tmpPix = GetScratchPixmapHeader(pScreen, width, height,
+ pPix->drawable.depth, bitsPerPixel, devKind,
+ data);
+ if (!tmpPix) {
+ free(data);
+ FatalError("Out of memory\n");
+ }
+
+ pGC = GetScratchGC(pPix->drawable.depth, pScreen);
+ ValidateGC((DrawablePtr) tmpPix, pGC);
+
+ (*pGC->ops->CopyArea) ((DrawablePtr) pPix, (DrawablePtr) tmpPix,
+ pGC, 0, 0, width, height, 0, 0);
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(tmpPix);
+
+ pPix->drawable.x = 0;
+ pPix->drawable.y = 0;
+ pPix->devKind = devKind;
+ pPix->devPrivate.ptr = data;
+ pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ pPriv->offscreenArea = NULL;
+ pPriv->freeData = TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaOverlay.c b/xorg-server/hw/xfree86/xaa/xaaOverlay.c
index 176a2d891..25d18da96 100644
--- a/xorg-server/hw/xfree86/xaa/xaaOverlay.c
+++ b/xorg-server/hw/xfree86/xaa/xaaOverlay.c
@@ -1,129 +1,122 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "mioverlay.h"
-
-#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#endif
-
-static void
-XAACopyWindow8_32(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc
-){
- DDXPointPtr pptSrc, ppt;
- RegionRec rgnDst;
- BoxPtr pbox;
- int dx, dy, nbox;
- WindowPtr pwinRoot;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XAAInfoRecPtr infoRec =
- GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
- Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
- RegionPtr borderClip = &pWin->borderClip;
- Bool freeReg = FALSE;
-
- if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt ||
- (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK))
- {
- XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
- if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow8_32);
- return;
- }
-
- pwinRoot = pScreen->root;
-
- if(doUnderlay)
- freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
-
- RegionNull(&rgnDst);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- RegionTranslate(prgnSrc, -dx, -dy);
- RegionIntersect(&rgnDst, borderClip, prgnSrc);
-
- pbox = RegionRects(&rgnDst);
- nbox = RegionNumRects(&rgnDst);
- if(!nbox ||
- !(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
- RegionUninit(&rgnDst);
- return;
- }
- ppt = pptSrc;
-
- while(nbox--) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- ppt++; pbox++;
- }
-
- infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000;
- infoRec->ScratchGC.alu = GXcopy;
-
- XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
-
- free(pptSrc);
- RegionUninit(&rgnDst);
- if(freeReg)
- RegionDestroy(borderClip);
-}
-
-static void
-XAASetColorKey8_32(
- ScreenPtr pScreen,
- int nbox,
- BoxPtr pbox
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- ScrnInfoPtr pScrn = infoRec->pScrn;
-
- /* I'm counting on writes being clipped away while switched away.
- If this isn't going to be true then I need to be wrapping instead. */
- if(!infoRec->pScrn->vtSema) return;
-
- (*infoRec->FillSolidRects)(pScrn, pScrn->colorKey << 24, GXcopy,
- 0xff000000, nbox, pbox);
-
- SET_SYNC_FLAG(infoRec);
-}
-
-void
-XAASetupOverlay8_32Planar(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- int i;
-
- pScreen->CopyWindow = XAACopyWindow8_32;
-
- if(!(infoRec->FillSolidRectsFlags & NO_PLANEMASK))
- miOverlaySetTransFunction(pScreen, XAASetColorKey8_32);
-
- infoRec->FullPlanemask = ~0;
- for(i = 0; i < 32; i++) /* haven't thought about this much */
- infoRec->FullPlanemasks[i] = ~0;
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "mioverlay.h"
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
+static void
+XAACopyWindow8_32(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ DDXPointPtr pptSrc, ppt;
+ RegionRec rgnDst;
+ BoxPtr pbox;
+ int dx, dy, nbox;
+ WindowPtr pwinRoot;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
+ Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
+ RegionPtr borderClip = &pWin->borderClip;
+ Bool freeReg = FALSE;
+
+ if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt ||
+ (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK)) {
+ XAA_SCREEN_PROLOGUE(pScreen, CopyWindow);
+ if (infoRec->pScrn->vtSema && infoRec->NeedToSync) {
+ (*infoRec->Sync) (infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAACopyWindow8_32);
+ return;
+ }
+
+ pwinRoot = pScreen->root;
+
+ if (doUnderlay)
+ freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
+
+ RegionNull(&rgnDst);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ RegionTranslate(prgnSrc, -dx, -dy);
+ RegionIntersect(&rgnDst, borderClip, prgnSrc);
+
+ pbox = RegionRects(&rgnDst);
+ nbox = RegionNumRects(&rgnDst);
+ if (!nbox || !(pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {
+ RegionUninit(&rgnDst);
+ return;
+ }
+ ppt = pptSrc;
+
+ while (nbox--) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ ppt++;
+ pbox++;
+ }
+
+ infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000;
+ infoRec->ScratchGC.alu = GXcopy;
+
+ XAADoBitBlt((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+
+ free(pptSrc);
+ RegionUninit(&rgnDst);
+ if (freeReg)
+ RegionDestroy(borderClip);
+}
+
+static void
+XAASetColorKey8_32(ScreenPtr pScreen, int nbox, BoxPtr pbox)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = infoRec->pScrn;
+
+ /* I'm counting on writes being clipped away while switched away.
+ If this isn't going to be true then I need to be wrapping instead. */
+ if (!infoRec->pScrn->vtSema)
+ return;
+
+ (*infoRec->FillSolidRects) (pScrn, pScrn->colorKey << 24, GXcopy,
+ 0xff000000, nbox, pbox);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAASetupOverlay8_32Planar(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ int i;
+
+ pScreen->CopyWindow = XAACopyWindow8_32;
+
+ if (!(infoRec->FillSolidRectsFlags & NO_PLANEMASK))
+ miOverlaySetTransFunction(pScreen, XAASetColorKey8_32);
+
+ infoRec->FullPlanemask = ~0;
+ for (i = 0; i < 32; i++) /* haven't thought about this much */
+ infoRec->FullPlanemasks[i] = ~0;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c b/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c
index 309ec9fa4..5918f65a3 100644
--- a/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c
+++ b/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c
@@ -1,1053 +1,906 @@
-/*
- Copyright (c) 1999 - The XFree86 Project Inc.
-
- Written by Mark Vojkovich
-*/
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "miline.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "servermd.h"
-
-/* Screen funcs */
-
-static void XAAOverCopyWindow(WindowPtr, DDXPointRec, RegionPtr);
-static void XAAOverWindowExposures(WindowPtr, RegionPtr, RegionPtr);
-
-static int XAAOverStippledFillChooser(GCPtr);
-static int XAAOverOpaqueStippledFillChooser(GCPtr);
-static int XAAOverTiledFillChooser(GCPtr);
-
-/* GC funcs */
-
-static RegionPtr XAAOverCopyArea(DrawablePtr, DrawablePtr, GC *,
- int, int, int, int, int, int);
-static RegionPtr XAAOverCopyPlane(DrawablePtr, DrawablePtr, GCPtr,
- int, int, int, int, int, int, unsigned long);
-static void XAAOverPushPixelsSolid(GCPtr, PixmapPtr, DrawablePtr, int,
- int, int, int);
-static void XAAOverPolyFillRectSolid(DrawablePtr, GCPtr, int, xRectangle*);
-static void XAAOverPolyFillRectStippled(DrawablePtr, GCPtr, int, xRectangle*);
-static void XAAOverPolyFillRectOpaqueStippled(DrawablePtr, GCPtr,
- int, xRectangle*);
-static void XAAOverPolyFillRectTiled(DrawablePtr, GCPtr, int, xRectangle*);
-static void XAAOverFillSpansSolid(DrawablePtr, GCPtr, int, DDXPointPtr,
- int*, int);
-static void XAAOverFillSpansStippled(DrawablePtr, GCPtr, int, DDXPointPtr,
- int*, int);
-static void XAAOverFillSpansOpaqueStippled(DrawablePtr, GCPtr, int,
- DDXPointPtr, int*, int);
-static void XAAOverFillSpansTiled(DrawablePtr, GCPtr, int, DDXPointPtr,
- int*, int);
-static int XAAOverPolyText8TE(DrawablePtr, GCPtr, int, int, int, char *);
-static int XAAOverPolyText16TE(DrawablePtr, GCPtr, int, int, int,
- unsigned short*);
-static void XAAOverImageText8TE(DrawablePtr, GCPtr, int, int, int, char*);
-static void XAAOverImageText16TE(DrawablePtr, GCPtr, int, int, int,
- unsigned short*);
-static void XAAOverImageGlyphBltTE(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr*, pointer);
-static void XAAOverPolyGlyphBltTE(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr*, pointer);
-static int XAAOverPolyText8NonTE(DrawablePtr, GCPtr, int, int, int, char*);
-static int XAAOverPolyText16NonTE(DrawablePtr, GCPtr, int, int, int,
- unsigned short*);
-static void XAAOverImageText8NonTE(DrawablePtr, GCPtr, int, int, int, char*);
-static void XAAOverImageText16NonTE(DrawablePtr, GCPtr, int, int, int,
- unsigned short*);
-static void XAAOverImageGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-static void XAAOverPolyGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-static void XAAOverPolyRectangleThinSolid(DrawablePtr, GCPtr, int, xRectangle*);
-static void XAAOverPolylinesWideSolid(DrawablePtr, GCPtr, int, int,
- DDXPointPtr);
-static void XAAOverPolylinesThinSolid(DrawablePtr, GCPtr, int, int,
- DDXPointPtr);
-static void XAAOverPolySegmentThinSolid(DrawablePtr, GCPtr, int, xSegment*);
-static void XAAOverPolylinesThinDashed(DrawablePtr, GCPtr, int, int,
- DDXPointPtr);
-static void XAAOverPolySegmentThinDashed(DrawablePtr, GCPtr, int, xSegment*);
-static void XAAOverFillPolygonSolid(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void XAAOverFillPolygonStippled(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void XAAOverFillPolygonOpaqueStippled(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void XAAOverFillPolygonTiled(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void XAAOverPolyFillArcSolid(DrawablePtr, GCPtr, int, xArc*);
-static void XAAOverPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
- int, int, char*);
-
-
-typedef struct {
- ScrnInfoPtr pScrn;
- DepthChangeFuncPtr callback;
- int currentDepth;
-/* GC funcs */
- RegionPtr (*CopyArea)(DrawablePtr, DrawablePtr, GC *,
- int, int, int, int, int, int);
- RegionPtr (*CopyPlane)(DrawablePtr, DrawablePtr, GCPtr,
- int, int, int, int, int, int, unsigned long);
- void (*PushPixelsSolid)(GCPtr, PixmapPtr, DrawablePtr, int, int, int, int);
- void (*PolyFillRectSolid)(DrawablePtr, GCPtr, int, xRectangle*);
- void (*PolyFillRectStippled)(DrawablePtr, GCPtr, int, xRectangle*);
- void (*PolyFillRectOpaqueStippled)(DrawablePtr, GCPtr, int, xRectangle*);
- void (*PolyFillRectTiled)(DrawablePtr, GCPtr, int, xRectangle*);
- void (*FillSpansSolid)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
- void (*FillSpansStippled)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
- void (*FillSpansOpaqueStippled)(DrawablePtr,GCPtr,int,DDXPointPtr,int*,int);
- void (*FillSpansTiled)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
- int (*PolyText8TE)(DrawablePtr, GCPtr, int, int, int, char *);
- int (*PolyText16TE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
- void (*ImageText8TE)(DrawablePtr, GCPtr, int, int, int, char*);
- void (*ImageText16TE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
- void (*ImageGlyphBltTE)(DrawablePtr, GCPtr, int, int, unsigned int,
- CharInfoPtr*, pointer);
- void (*PolyGlyphBltTE)(DrawablePtr, GCPtr, int, int, unsigned int,
- CharInfoPtr*, pointer);
- int (*PolyText8NonTE)(DrawablePtr, GCPtr, int, int, int, char*);
- int (*PolyText16NonTE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
- void (*ImageText8NonTE)(DrawablePtr, GCPtr, int, int, int, char*);
- void (*ImageText16NonTE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
- void (*ImageGlyphBltNonTE)(DrawablePtr, GCPtr, int, int, unsigned int,
- CharInfoPtr *, pointer);
- void (*PolyGlyphBltNonTE)(DrawablePtr, GCPtr, int, int, unsigned int,
- CharInfoPtr *, pointer);
- void (*PolyRectangleThinSolid)(DrawablePtr, GCPtr, int, xRectangle*);
- void (*PolylinesWideSolid)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
-
- void (*PolylinesThinSolid)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
- void (*PolySegmentThinSolid)(DrawablePtr, GCPtr, int, xSegment*);
- void (*PolylinesThinDashed)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
- void (*PolySegmentThinDashed)(DrawablePtr, GCPtr, int, xSegment*);
- void (*FillPolygonSolid)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
- void (*FillPolygonStippled)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
- void (*FillPolygonOpaqueStippled)(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
- void (*FillPolygonTiled)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
- void (*PolyFillArcSolid)(DrawablePtr, GCPtr, int, xArc*);
- void (*PutImage)(DrawablePtr, GCPtr, int, int, int, int, int, int,
- int, char*);
- int (*StippledFillChooser)(GCPtr);
- int (*OpaqueStippledFillChooser)(GCPtr);
- int (*TiledFillChooser)(GCPtr);
-} XAAOverlayRec, *XAAOverlayPtr;
-
-static DevPrivateKeyRec XAAOverlayKeyRec;
-#define XAAOverlayKey (&XAAOverlayKeyRec)
-
-#define GET_OVERLAY_PRIV(pScreen) \
- (XAAOverlayPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAOverlayKey)
-
-#define SWITCH_DEPTH(d) \
- if(pOverPriv->currentDepth != d) { \
- (*pOverPriv->callback)(pOverPriv->pScrn, d); \
- pOverPriv->currentDepth = d; \
- }
-
-
-Bool
-XAAInitDualFramebufferOverlay(
- ScreenPtr pScreen,
- DepthChangeFuncPtr callback
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAOverlayPtr pOverPriv;
-
- if (!dixRegisterPrivateKey(&XAAOverlayKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- if(!(pOverPriv = malloc(sizeof(XAAOverlayRec))))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv);
-
- pOverPriv->pScrn = pScrn;
- pOverPriv->callback = callback;
- pOverPriv->currentDepth = -1;
-
- /* Overwrite key screen functions. The XAA core will clean up */
-
- pScreen->CopyWindow = XAAOverCopyWindow;
- pScreen->WindowExposures = XAAOverWindowExposures;
-
- pOverPriv->StippledFillChooser = infoRec->StippledFillChooser;
- pOverPriv->OpaqueStippledFillChooser = infoRec->OpaqueStippledFillChooser;
- pOverPriv->TiledFillChooser = infoRec->TiledFillChooser;
-
- infoRec->StippledFillChooser = XAAOverStippledFillChooser;
- infoRec->OpaqueStippledFillChooser = XAAOverOpaqueStippledFillChooser;
- infoRec->TiledFillChooser = XAAOverTiledFillChooser;
-
- /* wrap all XAA GC rendering */
-
- pOverPriv->CopyArea = infoRec->CopyArea;
- pOverPriv->CopyPlane = infoRec->CopyPlane;
- pOverPriv->PushPixelsSolid = infoRec->PushPixelsSolid;
- pOverPriv->PolyFillRectSolid = infoRec->PolyFillRectSolid;
- pOverPriv->PolyFillRectStippled = infoRec->PolyFillRectStippled;
- pOverPriv->PolyFillRectOpaqueStippled = infoRec->PolyFillRectOpaqueStippled;
- pOverPriv->PolyFillRectTiled = infoRec->PolyFillRectTiled;
- pOverPriv->FillSpansSolid = infoRec->FillSpansSolid;
- pOverPriv->FillSpansStippled = infoRec->FillSpansStippled;
- pOverPriv->FillSpansOpaqueStippled = infoRec->FillSpansOpaqueStippled;
- pOverPriv->FillSpansTiled = infoRec->FillSpansTiled;
- pOverPriv->PolyText8TE = infoRec->PolyText8TE;
- pOverPriv->PolyText16TE = infoRec->PolyText16TE;
- pOverPriv->ImageText8TE = infoRec->ImageText8TE;
- pOverPriv->ImageText16TE = infoRec->ImageText16TE;
- pOverPriv->ImageGlyphBltTE = infoRec->ImageGlyphBltTE;
- pOverPriv->PolyGlyphBltTE = infoRec->PolyGlyphBltTE;
- pOverPriv->PolyText8NonTE = infoRec->PolyText8NonTE;
- pOverPriv->PolyText16NonTE = infoRec->PolyText16NonTE;
- pOverPriv->ImageText8NonTE = infoRec->ImageText8NonTE;
- pOverPriv->ImageText16NonTE = infoRec->ImageText16NonTE;
- pOverPriv->ImageGlyphBltNonTE = infoRec->ImageGlyphBltNonTE;
- pOverPriv->PolyGlyphBltNonTE = infoRec->PolyGlyphBltNonTE;
- pOverPriv->PolyRectangleThinSolid = infoRec->PolyRectangleThinSolid;
- pOverPriv->PolylinesWideSolid = infoRec->PolylinesWideSolid;
- pOverPriv->PolylinesThinSolid = infoRec->PolylinesThinSolid;
- pOverPriv->PolySegmentThinSolid = infoRec->PolySegmentThinSolid;
- pOverPriv->PolylinesThinDashed = infoRec->PolylinesThinDashed;
- pOverPriv->PolySegmentThinDashed = infoRec->PolySegmentThinDashed;
- pOverPriv->FillPolygonSolid = infoRec->FillPolygonSolid;
- pOverPriv->FillPolygonStippled = infoRec->FillPolygonStippled;
- pOverPriv->FillPolygonOpaqueStippled = infoRec->FillPolygonOpaqueStippled;
- pOverPriv->FillPolygonTiled = infoRec->FillPolygonTiled;
- pOverPriv->PolyFillArcSolid = infoRec->PolyFillArcSolid;
- pOverPriv->PutImage = infoRec->PutImage;
-
-
- if(infoRec->CopyArea)
- infoRec->CopyArea = XAAOverCopyArea;
- if(infoRec->CopyPlane)
- infoRec->CopyPlane = XAAOverCopyPlane;
- if(infoRec->PushPixelsSolid)
- infoRec->PushPixelsSolid = XAAOverPushPixelsSolid;
- if(infoRec->PolyFillRectSolid)
- infoRec->PolyFillRectSolid = XAAOverPolyFillRectSolid;
- if(infoRec->PolyFillRectStippled)
- infoRec->PolyFillRectStippled = XAAOverPolyFillRectStippled;
- if(infoRec->PolyFillRectOpaqueStippled)
- infoRec->PolyFillRectOpaqueStippled = XAAOverPolyFillRectOpaqueStippled;
- if(infoRec->PolyFillRectTiled)
- infoRec->PolyFillRectTiled = XAAOverPolyFillRectTiled;
- if(infoRec->FillSpansSolid)
- infoRec->FillSpansSolid = XAAOverFillSpansSolid;
- if(infoRec->FillSpansStippled)
- infoRec->FillSpansStippled = XAAOverFillSpansStippled;
- if(infoRec->FillSpansOpaqueStippled)
- infoRec->FillSpansOpaqueStippled = XAAOverFillSpansOpaqueStippled;
- if(infoRec->FillSpansTiled)
- infoRec->FillSpansTiled = XAAOverFillSpansTiled;
- if(infoRec->PolyText8TE)
- infoRec->PolyText8TE = XAAOverPolyText8TE;
- if(infoRec->PolyText16TE)
- infoRec->PolyText16TE = XAAOverPolyText16TE;
- if(infoRec->ImageText8TE)
- infoRec->ImageText8TE = XAAOverImageText8TE;
- if(infoRec->ImageText16TE)
- infoRec->ImageText16TE = XAAOverImageText16TE;
- if(infoRec->ImageGlyphBltTE)
- infoRec->ImageGlyphBltTE = XAAOverImageGlyphBltTE;
- if(infoRec->PolyGlyphBltTE)
- infoRec->PolyGlyphBltTE = XAAOverPolyGlyphBltTE;
- if(infoRec->PolyText8NonTE)
- infoRec->PolyText8NonTE = XAAOverPolyText8NonTE;
- if(infoRec->PolyText16NonTE)
- infoRec->PolyText16NonTE = XAAOverPolyText16NonTE;
- if(infoRec->ImageText8NonTE)
- infoRec->ImageText8NonTE = XAAOverImageText8NonTE;
- if(infoRec->ImageText16NonTE)
- infoRec->ImageText16NonTE = XAAOverImageText16NonTE;
- if(infoRec->ImageGlyphBltNonTE)
- infoRec->ImageGlyphBltNonTE = XAAOverImageGlyphBltNonTE;
- if(infoRec->PolyGlyphBltNonTE)
- infoRec->PolyGlyphBltNonTE = XAAOverPolyGlyphBltNonTE;
- if(infoRec->PolyRectangleThinSolid)
- infoRec->PolyRectangleThinSolid = XAAOverPolyRectangleThinSolid;
- if(infoRec->PolylinesWideSolid)
- infoRec->PolylinesWideSolid = XAAOverPolylinesWideSolid;
- if(infoRec->PolylinesThinSolid)
- infoRec->PolylinesThinSolid = XAAOverPolylinesThinSolid;
- if(infoRec->PolySegmentThinSolid)
- infoRec->PolySegmentThinSolid = XAAOverPolySegmentThinSolid;
- if(infoRec->PolylinesThinDashed)
- infoRec->PolylinesThinDashed = XAAOverPolylinesThinDashed;
- if(infoRec->PolySegmentThinDashed)
- infoRec->PolySegmentThinDashed = XAAOverPolySegmentThinDashed;
- if(infoRec->FillPolygonSolid)
- infoRec->FillPolygonSolid = XAAOverFillPolygonSolid;
- if(infoRec->FillPolygonStippled)
- infoRec->FillPolygonStippled = XAAOverFillPolygonStippled;
- if(infoRec->FillPolygonOpaqueStippled)
- infoRec->FillPolygonOpaqueStippled = XAAOverFillPolygonOpaqueStippled;
- if(infoRec->FillPolygonTiled)
- infoRec->FillPolygonTiled = XAAOverFillPolygonTiled;
- if(infoRec->PolyFillArcSolid)
- infoRec->PolyFillArcSolid = XAAOverPolyFillArcSolid;
- if(infoRec->PutImage)
- infoRec->PutImage = XAAOverPutImage;
-
- return TRUE;
-}
-
-/*********************** Screen functions ************************/
-
-void
-XAAOverCopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc
-){
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
- ScrnInfoPtr pScrn = infoRec->pScrn;
- DDXPointPtr ppt, pptSrc;
- RegionRec rgnDst;
- BoxPtr pbox;
- int i, nbox, dx, dy;
- WindowPtr pRoot = pScreen->root;
-
-
- if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
- XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
- if(pScrn->vtSema && infoRec->NeedToSync) {
- (*infoRec->Sync)(pScrn);
- infoRec->NeedToSync = FALSE;
- }
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAAOverCopyWindow);
- return;
- }
-
- infoRec->ScratchGC.alu = GXcopy;
- infoRec->ScratchGC.planemask = ~0;
-
- RegionNull(&rgnDst);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- RegionTranslate(prgnSrc, -dx, -dy);
- RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
-
- nbox = RegionNumRects(&rgnDst);
- if(nbox &&
- (pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
-
- pbox = RegionRects(&rgnDst);
- for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- SWITCH_DEPTH(8);
- XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
-
- if(pWin->drawable.bitsPerPixel != 8) {
- SWITCH_DEPTH(pScrn->depth);
- XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
- }
-
- free(pptSrc);
- }
-
- RegionUninit(&rgnDst);
-
- if(pWin->drawable.depth == 8) {
- RegionNull(&rgnDst);
- miSegregateChildren(pWin, &rgnDst, pScrn->depth);
- if(RegionNotEmpty(&rgnDst)) {
- RegionIntersect(&rgnDst, &rgnDst, prgnSrc);
- nbox = RegionNumRects(&rgnDst);
- if(nbox &&
- (pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))){
-
- pbox = RegionRects(&rgnDst);
- for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- SWITCH_DEPTH(pScrn->depth);
- XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
- free(pptSrc);
- }
- }
- RegionUninit(&rgnDst);
- }
-}
-
-
-void
-XAAOverWindowExposures(
- WindowPtr pWin,
- RegionPtr pReg,
- RegionPtr pOtherReg
-){
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
-
- if((pWin->drawable.bitsPerPixel != 8) && infoRec->pScrn->vtSema) {
- if(RegionNumRects(pReg) && infoRec->FillSolidRects) {
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
-
- SWITCH_DEPTH(8);
- (*infoRec->FillSolidRects)(infoRec->pScrn,
- infoRec->pScrn->colorKey, GXcopy, ~0,
- RegionNumRects(pReg), RegionRects(pReg));
- miWindowExposures(pWin, pReg, pOtherReg);
- return;
- } else if(infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- }
-
- XAA_SCREEN_PROLOGUE (pScreen, WindowExposures);
- (*pScreen->WindowExposures) (pWin, pReg, pOtherReg);
- XAA_SCREEN_EPILOGUE(pScreen, WindowExposures, XAAOverWindowExposures);
-}
-
-/********************* Choosers *************************/
-
-static int
-XAAOverStippledFillChooser(GCPtr pGC)
-{
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
- int ret;
-
- ret = (*pOverPriv->StippledFillChooser)(pGC);
-
- if((pGC->depth == 8) &&
- ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
- ret = 0;
- }
-
- return ret;
-}
-
-static int
-XAAOverOpaqueStippledFillChooser(GCPtr pGC)
-{
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
- int ret;
-
- ret = (*pOverPriv->OpaqueStippledFillChooser)(pGC);
-
- if((pGC->depth == 8) &&
- ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
- ret = 0;
- }
-
- return ret;
-}
-
-static int
-XAAOverTiledFillChooser(GCPtr pGC)
-{
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
- int ret;
-
- ret = (*pOverPriv->TiledFillChooser)(pGC);
-
- if((pGC->depth == 8) &&
- ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
- ret = 0;
- }
-
- return ret;
-}
-
-
-/**************************** GC Functions **************************/
-
-static RegionPtr
-XAAOverCopyArea(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
-}
-
-static RegionPtr
-XAAOverCopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->CopyPlane)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
-
-}
-
-static void
-XAAOverPushPixelsSolid(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy,
- int xOrg, int yOrg
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PushPixelsSolid)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
-}
-
-
-
-static void
-XAAOverPolyFillRectSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyFillRectSolid)(pDraw, pGC, nrectFill, prectInit);
-}
-
-static void
-XAAOverPolyFillRectStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyFillRectStippled)(pDraw, pGC, nrectFill, prectInit);
-}
-
-
-static void
-XAAOverPolyFillRectOpaqueStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyFillRectOpaqueStippled)(pDraw, pGC, nrectFill, prectInit);
-}
-
-static void
-XAAOverPolyFillRectTiled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyFillRectTiled)(pDraw, pGC, nrectFill, prectInit);
-}
-
-
-static void
-XAAOverFillSpansSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillSpansSolid)(
- pDraw, pGC, nInit, ppt, pwidth, fSorted);
-}
-
-
-static void
-XAAOverFillSpansStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillSpansStippled)(pDraw, pGC, nInit, ppt, pwidth, fSorted);
-}
-
-static void
-XAAOverFillSpansOpaqueStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillSpansOpaqueStippled)(
- pDraw, pGC, nInit, ppt, pwidth, fSorted);
-}
-
-
-static void
-XAAOverFillSpansTiled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillSpansTiled)(pDraw, pGC, nInit, ppt, pwidth, fSorted);
-}
-
-static int
-XAAOverPolyText8TE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->PolyText8TE)(pDraw, pGC, x, y, count, chars);
-}
-
-
-static int
-XAAOverPolyText16TE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->PolyText16TE)(pDraw, pGC, x, y, count, chars);
-}
-
-
-static void
-XAAOverImageText8TE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageText8TE)(pDraw, pGC, x, y, count, chars);
-}
-
-
-static void
-XAAOverImageText16TE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageText16TE)(pDraw, pGC, x, y, count, chars);
-}
-
-static void
-XAAOverImageGlyphBltTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageGlyphBltTE)(
- pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
-}
-
-static void
-XAAOverPolyGlyphBltTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyGlyphBltTE)(
- pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
-}
-
-static int
-XAAOverPolyText8NonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->PolyText8NonTE)(pDraw, pGC, x, y, count, chars);
-}
-
-
-static int
-XAAOverPolyText16NonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->PolyText16NonTE)(pDraw, pGC, x, y, count, chars);
-}
-
-static void
-XAAOverImageText8NonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageText8NonTE)(pDraw, pGC, x, y, count, chars);
-}
-
-static void
-XAAOverImageText16NonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageText16NonTE)(pDraw, pGC, x, y, count, chars);
-}
-
-
-static void
-XAAOverImageGlyphBltNonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageGlyphBltNonTE)(
- pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
-}
-
-static void
-XAAOverPolyGlyphBltNonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyGlyphBltNonTE)(
- pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
-}
-
-static void
-XAAOverPolyRectangleThinSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyRectangleThinSolid)(pDraw, pGC, nRectsInit, pRectsInit);
-}
-
-
-
-static void
-XAAOverPolylinesWideSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolylinesWideSolid)(pDraw, pGC, mode, npt, pPts);
-}
-
-
-static void
-XAAOverPolylinesThinSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolylinesThinSolid)(pDraw, pGC, mode, npt, pPts);
-}
-
-static void
-XAAOverPolySegmentThinSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolySegmentThinSolid)(pDraw, pGC, nseg, pSeg);
-}
-
-static void
-XAAOverPolylinesThinDashed(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolylinesThinDashed)(pDraw, pGC, mode, npt, pPts);
-}
-
-static void
-XAAOverPolySegmentThinDashed(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolySegmentThinDashed)(pDraw, pGC, nseg, pSeg);
-}
-
-
-static void
-XAAOverFillPolygonSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillPolygonSolid)(pDraw, pGC, shape, mode, count, ptsIn);
-}
-
-static void
-XAAOverFillPolygonStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillPolygonStippled)(pDraw, pGC, shape, mode, count, ptsIn);
-}
-
-
-static void
-XAAOverFillPolygonOpaqueStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillPolygonOpaqueStippled)(
- pDraw, pGC, shape, mode, count, ptsIn);
-}
-
-static void
-XAAOverFillPolygonTiled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillPolygonTiled)(pDraw, pGC, shape, mode, count, ptsIn);
-}
-
-
-static void
-XAAOverPolyFillArcSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyFillArcSolid)(pDraw, pGC, narcs, parcs);
-}
-
-
-static void
-XAAOverPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
-}
-
+/*
+ Copyright (c) 1999 - The XFree86 Project Inc.
+
+ Written by Mark Vojkovich
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "servermd.h"
+
+/* Screen funcs */
+
+static void XAAOverCopyWindow(WindowPtr, DDXPointRec, RegionPtr);
+static void XAAOverWindowExposures(WindowPtr, RegionPtr, RegionPtr);
+
+static int XAAOverStippledFillChooser(GCPtr);
+static int XAAOverOpaqueStippledFillChooser(GCPtr);
+static int XAAOverTiledFillChooser(GCPtr);
+
+/* GC funcs */
+
+static RegionPtr XAAOverCopyArea(DrawablePtr, DrawablePtr, GC *,
+ int, int, int, int, int, int);
+static RegionPtr XAAOverCopyPlane(DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int, unsigned long);
+static void XAAOverPushPixelsSolid(GCPtr, PixmapPtr, DrawablePtr, int,
+ int, int, int);
+static void XAAOverPolyFillRectSolid(DrawablePtr, GCPtr, int, xRectangle *);
+static void XAAOverPolyFillRectStippled(DrawablePtr, GCPtr, int, xRectangle *);
+static void XAAOverPolyFillRectOpaqueStippled(DrawablePtr, GCPtr,
+ int, xRectangle *);
+static void XAAOverPolyFillRectTiled(DrawablePtr, GCPtr, int, xRectangle *);
+static void XAAOverFillSpansSolid(DrawablePtr, GCPtr, int, DDXPointPtr,
+ int *, int);
+static void XAAOverFillSpansStippled(DrawablePtr, GCPtr, int, DDXPointPtr,
+ int *, int);
+static void XAAOverFillSpansOpaqueStippled(DrawablePtr, GCPtr, int,
+ DDXPointPtr, int *, int);
+static void XAAOverFillSpansTiled(DrawablePtr, GCPtr, int, DDXPointPtr,
+ int *, int);
+static int XAAOverPolyText8TE(DrawablePtr, GCPtr, int, int, int, char *);
+static int XAAOverPolyText16TE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short *);
+static void XAAOverImageText8TE(DrawablePtr, GCPtr, int, int, int, char *);
+static void XAAOverImageText16TE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short *);
+static void XAAOverImageGlyphBltTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+static void XAAOverPolyGlyphBltTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+static int XAAOverPolyText8NonTE(DrawablePtr, GCPtr, int, int, int, char *);
+static int XAAOverPolyText16NonTE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short *);
+static void XAAOverImageText8NonTE(DrawablePtr, GCPtr, int, int, int, char *);
+static void XAAOverImageText16NonTE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short *);
+static void XAAOverImageGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+static void XAAOverPolyGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+static void XAAOverPolyRectangleThinSolid(DrawablePtr, GCPtr, int,
+ xRectangle *);
+static void XAAOverPolylinesWideSolid(DrawablePtr, GCPtr, int, int,
+ DDXPointPtr);
+static void XAAOverPolylinesThinSolid(DrawablePtr, GCPtr, int, int,
+ DDXPointPtr);
+static void XAAOverPolySegmentThinSolid(DrawablePtr, GCPtr, int, xSegment *);
+static void XAAOverPolylinesThinDashed(DrawablePtr, GCPtr, int, int,
+ DDXPointPtr);
+static void XAAOverPolySegmentThinDashed(DrawablePtr, GCPtr, int, xSegment *);
+static void XAAOverFillPolygonSolid(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverFillPolygonStippled(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverFillPolygonOpaqueStippled(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverFillPolygonTiled(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverPolyFillArcSolid(DrawablePtr, GCPtr, int, xArc *);
+static void XAAOverPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
+ int, int, char *);
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ DepthChangeFuncPtr callback;
+ int currentDepth;
+/* GC funcs */
+ RegionPtr (*CopyArea) (DrawablePtr, DrawablePtr, GC *,
+ int, int, int, int, int, int);
+ RegionPtr (*CopyPlane) (DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int, unsigned long);
+ void (*PushPixelsSolid) (GCPtr, PixmapPtr, DrawablePtr, int, int, int, int);
+ void (*PolyFillRectSolid) (DrawablePtr, GCPtr, int, xRectangle *);
+ void (*PolyFillRectStippled) (DrawablePtr, GCPtr, int, xRectangle *);
+ void (*PolyFillRectOpaqueStippled) (DrawablePtr, GCPtr, int, xRectangle *);
+ void (*PolyFillRectTiled) (DrawablePtr, GCPtr, int, xRectangle *);
+ void (*FillSpansSolid) (DrawablePtr, GCPtr, int, DDXPointPtr, int *, int);
+ void (*FillSpansStippled) (DrawablePtr, GCPtr, int, DDXPointPtr, int *,
+ int);
+ void (*FillSpansOpaqueStippled) (DrawablePtr, GCPtr, int, DDXPointPtr,
+ int *, int);
+ void (*FillSpansTiled) (DrawablePtr, GCPtr, int, DDXPointPtr, int *, int);
+ int (*PolyText8TE) (DrawablePtr, GCPtr, int, int, int, char *);
+ int (*PolyText16TE) (DrawablePtr, GCPtr, int, int, int, unsigned short *);
+ void (*ImageText8TE) (DrawablePtr, GCPtr, int, int, int, char *);
+ void (*ImageText16TE) (DrawablePtr, GCPtr, int, int, int, unsigned short *);
+ void (*ImageGlyphBltTE) (DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr *, pointer);
+ void (*PolyGlyphBltTE) (DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr *, pointer);
+ int (*PolyText8NonTE) (DrawablePtr, GCPtr, int, int, int, char *);
+ int (*PolyText16NonTE) (DrawablePtr, GCPtr, int, int, int,
+ unsigned short *);
+ void (*ImageText8NonTE) (DrawablePtr, GCPtr, int, int, int, char *);
+ void (*ImageText16NonTE) (DrawablePtr, GCPtr, int, int, int,
+ unsigned short *);
+ void (*ImageGlyphBltNonTE) (DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr *, pointer);
+ void (*PolyGlyphBltNonTE) (DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr *, pointer);
+ void (*PolyRectangleThinSolid) (DrawablePtr, GCPtr, int, xRectangle *);
+ void (*PolylinesWideSolid) (DrawablePtr, GCPtr, int, int, DDXPointPtr);
+
+ void (*PolylinesThinSolid) (DrawablePtr, GCPtr, int, int, DDXPointPtr);
+ void (*PolySegmentThinSolid) (DrawablePtr, GCPtr, int, xSegment *);
+ void (*PolylinesThinDashed) (DrawablePtr, GCPtr, int, int, DDXPointPtr);
+ void (*PolySegmentThinDashed) (DrawablePtr, GCPtr, int, xSegment *);
+ void (*FillPolygonSolid) (DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
+ void (*FillPolygonStippled) (DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+ void (*FillPolygonOpaqueStippled) (DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+ void (*FillPolygonTiled) (DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
+ void (*PolyFillArcSolid) (DrawablePtr, GCPtr, int, xArc *);
+ void (*PutImage) (DrawablePtr, GCPtr, int, int, int, int, int, int,
+ int, char *);
+ int (*StippledFillChooser) (GCPtr);
+ int (*OpaqueStippledFillChooser) (GCPtr);
+ int (*TiledFillChooser) (GCPtr);
+} XAAOverlayRec, *XAAOverlayPtr;
+
+static DevPrivateKeyRec XAAOverlayKeyRec;
+
+#define XAAOverlayKey (&XAAOverlayKeyRec)
+
+#define GET_OVERLAY_PRIV(pScreen) \
+ (XAAOverlayPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAOverlayKey)
+
+#define SWITCH_DEPTH(d) \
+ if(pOverPriv->currentDepth != d) { \
+ (*pOverPriv->callback)(pOverPriv->pScrn, d); \
+ pOverPriv->currentDepth = d; \
+ }
+
+Bool
+XAAInitDualFramebufferOverlay(ScreenPtr pScreen, DepthChangeFuncPtr callback)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAOverlayPtr pOverPriv;
+
+ if (!dixRegisterPrivateKey(&XAAOverlayKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ if (!(pOverPriv = malloc(sizeof(XAAOverlayRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv);
+
+ pOverPriv->pScrn = pScrn;
+ pOverPriv->callback = callback;
+ pOverPriv->currentDepth = -1;
+
+ /* Overwrite key screen functions. The XAA core will clean up */
+
+ pScreen->CopyWindow = XAAOverCopyWindow;
+ pScreen->WindowExposures = XAAOverWindowExposures;
+
+ pOverPriv->StippledFillChooser = infoRec->StippledFillChooser;
+ pOverPriv->OpaqueStippledFillChooser = infoRec->OpaqueStippledFillChooser;
+ pOverPriv->TiledFillChooser = infoRec->TiledFillChooser;
+
+ infoRec->StippledFillChooser = XAAOverStippledFillChooser;
+ infoRec->OpaqueStippledFillChooser = XAAOverOpaqueStippledFillChooser;
+ infoRec->TiledFillChooser = XAAOverTiledFillChooser;
+
+ /* wrap all XAA GC rendering */
+
+ pOverPriv->CopyArea = infoRec->CopyArea;
+ pOverPriv->CopyPlane = infoRec->CopyPlane;
+ pOverPriv->PushPixelsSolid = infoRec->PushPixelsSolid;
+ pOverPriv->PolyFillRectSolid = infoRec->PolyFillRectSolid;
+ pOverPriv->PolyFillRectStippled = infoRec->PolyFillRectStippled;
+ pOverPriv->PolyFillRectOpaqueStippled = infoRec->PolyFillRectOpaqueStippled;
+ pOverPriv->PolyFillRectTiled = infoRec->PolyFillRectTiled;
+ pOverPriv->FillSpansSolid = infoRec->FillSpansSolid;
+ pOverPriv->FillSpansStippled = infoRec->FillSpansStippled;
+ pOverPriv->FillSpansOpaqueStippled = infoRec->FillSpansOpaqueStippled;
+ pOverPriv->FillSpansTiled = infoRec->FillSpansTiled;
+ pOverPriv->PolyText8TE = infoRec->PolyText8TE;
+ pOverPriv->PolyText16TE = infoRec->PolyText16TE;
+ pOverPriv->ImageText8TE = infoRec->ImageText8TE;
+ pOverPriv->ImageText16TE = infoRec->ImageText16TE;
+ pOverPriv->ImageGlyphBltTE = infoRec->ImageGlyphBltTE;
+ pOverPriv->PolyGlyphBltTE = infoRec->PolyGlyphBltTE;
+ pOverPriv->PolyText8NonTE = infoRec->PolyText8NonTE;
+ pOverPriv->PolyText16NonTE = infoRec->PolyText16NonTE;
+ pOverPriv->ImageText8NonTE = infoRec->ImageText8NonTE;
+ pOverPriv->ImageText16NonTE = infoRec->ImageText16NonTE;
+ pOverPriv->ImageGlyphBltNonTE = infoRec->ImageGlyphBltNonTE;
+ pOverPriv->PolyGlyphBltNonTE = infoRec->PolyGlyphBltNonTE;
+ pOverPriv->PolyRectangleThinSolid = infoRec->PolyRectangleThinSolid;
+ pOverPriv->PolylinesWideSolid = infoRec->PolylinesWideSolid;
+ pOverPriv->PolylinesThinSolid = infoRec->PolylinesThinSolid;
+ pOverPriv->PolySegmentThinSolid = infoRec->PolySegmentThinSolid;
+ pOverPriv->PolylinesThinDashed = infoRec->PolylinesThinDashed;
+ pOverPriv->PolySegmentThinDashed = infoRec->PolySegmentThinDashed;
+ pOverPriv->FillPolygonSolid = infoRec->FillPolygonSolid;
+ pOverPriv->FillPolygonStippled = infoRec->FillPolygonStippled;
+ pOverPriv->FillPolygonOpaqueStippled = infoRec->FillPolygonOpaqueStippled;
+ pOverPriv->FillPolygonTiled = infoRec->FillPolygonTiled;
+ pOverPriv->PolyFillArcSolid = infoRec->PolyFillArcSolid;
+ pOverPriv->PutImage = infoRec->PutImage;
+
+ if (infoRec->CopyArea)
+ infoRec->CopyArea = XAAOverCopyArea;
+ if (infoRec->CopyPlane)
+ infoRec->CopyPlane = XAAOverCopyPlane;
+ if (infoRec->PushPixelsSolid)
+ infoRec->PushPixelsSolid = XAAOverPushPixelsSolid;
+ if (infoRec->PolyFillRectSolid)
+ infoRec->PolyFillRectSolid = XAAOverPolyFillRectSolid;
+ if (infoRec->PolyFillRectStippled)
+ infoRec->PolyFillRectStippled = XAAOverPolyFillRectStippled;
+ if (infoRec->PolyFillRectOpaqueStippled)
+ infoRec->PolyFillRectOpaqueStippled = XAAOverPolyFillRectOpaqueStippled;
+ if (infoRec->PolyFillRectTiled)
+ infoRec->PolyFillRectTiled = XAAOverPolyFillRectTiled;
+ if (infoRec->FillSpansSolid)
+ infoRec->FillSpansSolid = XAAOverFillSpansSolid;
+ if (infoRec->FillSpansStippled)
+ infoRec->FillSpansStippled = XAAOverFillSpansStippled;
+ if (infoRec->FillSpansOpaqueStippled)
+ infoRec->FillSpansOpaqueStippled = XAAOverFillSpansOpaqueStippled;
+ if (infoRec->FillSpansTiled)
+ infoRec->FillSpansTiled = XAAOverFillSpansTiled;
+ if (infoRec->PolyText8TE)
+ infoRec->PolyText8TE = XAAOverPolyText8TE;
+ if (infoRec->PolyText16TE)
+ infoRec->PolyText16TE = XAAOverPolyText16TE;
+ if (infoRec->ImageText8TE)
+ infoRec->ImageText8TE = XAAOverImageText8TE;
+ if (infoRec->ImageText16TE)
+ infoRec->ImageText16TE = XAAOverImageText16TE;
+ if (infoRec->ImageGlyphBltTE)
+ infoRec->ImageGlyphBltTE = XAAOverImageGlyphBltTE;
+ if (infoRec->PolyGlyphBltTE)
+ infoRec->PolyGlyphBltTE = XAAOverPolyGlyphBltTE;
+ if (infoRec->PolyText8NonTE)
+ infoRec->PolyText8NonTE = XAAOverPolyText8NonTE;
+ if (infoRec->PolyText16NonTE)
+ infoRec->PolyText16NonTE = XAAOverPolyText16NonTE;
+ if (infoRec->ImageText8NonTE)
+ infoRec->ImageText8NonTE = XAAOverImageText8NonTE;
+ if (infoRec->ImageText16NonTE)
+ infoRec->ImageText16NonTE = XAAOverImageText16NonTE;
+ if (infoRec->ImageGlyphBltNonTE)
+ infoRec->ImageGlyphBltNonTE = XAAOverImageGlyphBltNonTE;
+ if (infoRec->PolyGlyphBltNonTE)
+ infoRec->PolyGlyphBltNonTE = XAAOverPolyGlyphBltNonTE;
+ if (infoRec->PolyRectangleThinSolid)
+ infoRec->PolyRectangleThinSolid = XAAOverPolyRectangleThinSolid;
+ if (infoRec->PolylinesWideSolid)
+ infoRec->PolylinesWideSolid = XAAOverPolylinesWideSolid;
+ if (infoRec->PolylinesThinSolid)
+ infoRec->PolylinesThinSolid = XAAOverPolylinesThinSolid;
+ if (infoRec->PolySegmentThinSolid)
+ infoRec->PolySegmentThinSolid = XAAOverPolySegmentThinSolid;
+ if (infoRec->PolylinesThinDashed)
+ infoRec->PolylinesThinDashed = XAAOverPolylinesThinDashed;
+ if (infoRec->PolySegmentThinDashed)
+ infoRec->PolySegmentThinDashed = XAAOverPolySegmentThinDashed;
+ if (infoRec->FillPolygonSolid)
+ infoRec->FillPolygonSolid = XAAOverFillPolygonSolid;
+ if (infoRec->FillPolygonStippled)
+ infoRec->FillPolygonStippled = XAAOverFillPolygonStippled;
+ if (infoRec->FillPolygonOpaqueStippled)
+ infoRec->FillPolygonOpaqueStippled = XAAOverFillPolygonOpaqueStippled;
+ if (infoRec->FillPolygonTiled)
+ infoRec->FillPolygonTiled = XAAOverFillPolygonTiled;
+ if (infoRec->PolyFillArcSolid)
+ infoRec->PolyFillArcSolid = XAAOverPolyFillArcSolid;
+ if (infoRec->PutImage)
+ infoRec->PutImage = XAAOverPutImage;
+
+ return TRUE;
+}
+
+/*********************** Screen functions ************************/
+
+void
+XAAOverCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
+ ScrnInfoPtr pScrn = infoRec->pScrn;
+ DDXPointPtr ppt, pptSrc;
+ RegionRec rgnDst;
+ BoxPtr pbox;
+ int i, nbox, dx, dy;
+ WindowPtr pRoot = pScreen->root;
+
+ if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
+ XAA_SCREEN_PROLOGUE(pScreen, CopyWindow);
+ if (pScrn->vtSema && infoRec->NeedToSync) {
+ (*infoRec->Sync) (pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAAOverCopyWindow);
+ return;
+ }
+
+ infoRec->ScratchGC.alu = GXcopy;
+ infoRec->ScratchGC.planemask = ~0;
+
+ RegionNull(&rgnDst);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ RegionTranslate(prgnSrc, -dx, -dy);
+ RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
+
+ nbox = RegionNumRects(&rgnDst);
+ if (nbox && (pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {
+
+ pbox = RegionRects(&rgnDst);
+ for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ SWITCH_DEPTH(8);
+ XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+
+ if (pWin->drawable.bitsPerPixel != 8) {
+ SWITCH_DEPTH(pScrn->depth);
+ XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+ }
+
+ free(pptSrc);
+ }
+
+ RegionUninit(&rgnDst);
+
+ if (pWin->drawable.depth == 8) {
+ RegionNull(&rgnDst);
+ miSegregateChildren(pWin, &rgnDst, pScrn->depth);
+ if (RegionNotEmpty(&rgnDst)) {
+ RegionIntersect(&rgnDst, &rgnDst, prgnSrc);
+ nbox = RegionNumRects(&rgnDst);
+ if (nbox &&
+ (pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {
+
+ pbox = RegionRects(&rgnDst);
+ for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ SWITCH_DEPTH(pScrn->depth);
+ XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+ free(pptSrc);
+ }
+ }
+ RegionUninit(&rgnDst);
+ }
+}
+
+void
+XAAOverWindowExposures(WindowPtr pWin, RegionPtr pReg, RegionPtr pOtherReg)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ if ((pWin->drawable.bitsPerPixel != 8) && infoRec->pScrn->vtSema) {
+ if (RegionNumRects(pReg) && infoRec->FillSolidRects) {
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
+
+ SWITCH_DEPTH(8);
+ (*infoRec->FillSolidRects) (infoRec->pScrn,
+ infoRec->pScrn->colorKey, GXcopy, ~0,
+ RegionNumRects(pReg),
+ RegionRects(pReg));
+ miWindowExposures(pWin, pReg, pOtherReg);
+ return;
+ }
+ else if (infoRec->NeedToSync) {
+ (*infoRec->Sync) (infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ }
+
+ XAA_SCREEN_PROLOGUE(pScreen, WindowExposures);
+ (*pScreen->WindowExposures) (pWin, pReg, pOtherReg);
+ XAA_SCREEN_EPILOGUE(pScreen, WindowExposures, XAAOverWindowExposures);
+}
+
+/********************* Choosers *************************/
+
+static int
+XAAOverStippledFillChooser(GCPtr pGC)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+ int ret;
+
+ ret = (*pOverPriv->StippledFillChooser) (pGC);
+
+ if ((pGC->depth == 8) && ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
+ ret = 0;
+ }
+
+ return ret;
+}
+
+static int
+XAAOverOpaqueStippledFillChooser(GCPtr pGC)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+ int ret;
+
+ ret = (*pOverPriv->OpaqueStippledFillChooser) (pGC);
+
+ if ((pGC->depth == 8) && ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
+ ret = 0;
+ }
+
+ return ret;
+}
+
+static int
+XAAOverTiledFillChooser(GCPtr pGC)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+ int ret;
+
+ ret = (*pOverPriv->TiledFillChooser) (pGC);
+
+ if ((pGC->depth == 8) && ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
+ ret = 0;
+ }
+
+ return ret;
+}
+
+/**************************** GC Functions **************************/
+
+static RegionPtr
+XAAOverCopyArea(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC * pGC,
+ int srcx, int srcy, int width, int height, int dstx, int dsty)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->CopyArea) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+}
+
+static RegionPtr
+XAAOverCopyPlane(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->CopyPlane) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ bitPlane);
+
+}
+
+static void
+XAAOverPushPixelsSolid(GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PushPixelsSolid) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+}
+
+static void
+XAAOverPolyFillRectSolid(DrawablePtr pDraw,
+ GCPtr pGC, int nrectFill, xRectangle *prectInit)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectSolid) (pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAOverPolyFillRectStippled(DrawablePtr pDraw,
+ GCPtr pGC, int nrectFill, xRectangle *prectInit)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectStippled) (pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAOverPolyFillRectOpaqueStippled(DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill, xRectangle *prectInit)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectOpaqueStippled) (pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAOverPolyFillRectTiled(DrawablePtr pDraw,
+ GCPtr pGC, int nrectFill, xRectangle *prectInit)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectTiled) (pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAOverFillSpansSolid(DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit, DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansSolid) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+static void
+XAAOverFillSpansStippled(DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit, DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansStippled) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+static void
+XAAOverFillSpansOpaqueStippled(DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansOpaqueStippled) (pDraw, pGC, nInit, ppt, pwidth,
+ fSorted);
+}
+
+static void
+XAAOverFillSpansTiled(DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit, DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansTiled) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+static int
+XAAOverPolyText8TE(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText8TE) (pDraw, pGC, x, y, count, chars);
+}
+
+static int
+XAAOverPolyText16TE(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText16TE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageText8TE(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText8TE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageText16TE(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText16TE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageGlyphBltTE(DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageGlyphBltTE) (pDraw, pGC, xInit, yInit, nglyph, ppci,
+ pglyphBase);
+}
+
+static void
+XAAOverPolyGlyphBltTE(DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyGlyphBltTE) (pDraw, pGC, xInit, yInit, nglyph, ppci,
+ pglyphBase);
+}
+
+static int
+XAAOverPolyText8NonTE(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText8NonTE) (pDraw, pGC, x, y, count, chars);
+}
+
+static int
+XAAOverPolyText16NonTE(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText16NonTE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageText8NonTE(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText8NonTE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageText16NonTE(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText16NonTE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageGlyphBltNonTE(DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageGlyphBltNonTE) (pDraw, pGC, xInit, yInit, nglyph, ppci,
+ pglyphBase);
+}
+
+static void
+XAAOverPolyGlyphBltNonTE(DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyGlyphBltNonTE) (pDraw, pGC, xInit, yInit, nglyph, ppci,
+ pglyphBase);
+}
+
+static void
+XAAOverPolyRectangleThinSolid(DrawablePtr pDraw,
+ GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyRectangleThinSolid) (pDraw, pGC, nRectsInit, pRectsInit);
+}
+
+static void
+XAAOverPolylinesWideSolid(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pPts)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolylinesWideSolid) (pDraw, pGC, mode, npt, pPts);
+}
+
+static void
+XAAOverPolylinesThinSolid(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pPts)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolylinesThinSolid) (pDraw, pGC, mode, npt, pPts);
+}
+
+static void
+XAAOverPolySegmentThinSolid(DrawablePtr pDraw,
+ GCPtr pGC, int nseg, xSegment * pSeg)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolySegmentThinSolid) (pDraw, pGC, nseg, pSeg);
+}
+
+static void
+XAAOverPolylinesThinDashed(DrawablePtr pDraw,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pPts)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolylinesThinDashed) (pDraw, pGC, mode, npt, pPts);
+}
+
+static void
+XAAOverPolySegmentThinDashed(DrawablePtr pDraw,
+ GCPtr pGC, int nseg, xSegment * pSeg)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolySegmentThinDashed) (pDraw, pGC, nseg, pSeg);
+}
+
+static void
+XAAOverFillPolygonSolid(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonSolid) (pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+static void
+XAAOverFillPolygonStippled(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonStippled) (pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+static void
+XAAOverFillPolygonOpaqueStippled(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode, int count, DDXPointPtr ptsIn)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonOpaqueStippled) (pDraw, pGC, shape, mode, count,
+ ptsIn);
+}
+
+static void
+XAAOverFillPolygonTiled(DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonTiled) (pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+static void
+XAAOverPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillArcSolid) (pDraw, pGC, narcs, parcs);
+}
+
+static void
+XAAOverPutImage(DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y, int w, int h, int leftPad, int format, char *pImage)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PutImage) (pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaPCache.c b/xorg-server/hw/xfree86/xaa/xaaPCache.c
index ff3f9ef56..02c0cd498 100644
--- a/xorg-server/hw/xfree86/xaa/xaaPCache.c
+++ b/xorg-server/hw/xfree86/xaa/xaaPCache.c
@@ -1,2374 +1,2527 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "gc.h"
-#include "mi.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "regionstr.h"
-#include "servermd.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaacexp.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-
-#define MAX_COLOR 32
-#define MAX_MONO 32
-#define MAX_8 32
-#define MAX_128 32
-#define MAX_256 32
-#define MAX_512 16
-
-static int CacheInitIndex = -1;
-#define CACHEINIT(p) ((p)->privates[CacheInitIndex].val)
-
-
-typedef struct _CacheLink {
- int x;
- int y;
- int w;
- int h;
- struct _CacheLink *next;
-} CacheLink, *CacheLinkPtr;
-
-
-static void
-TransferList(CacheLinkPtr list, XAACacheInfoPtr array, int num)
-{
- while(num--) {
- array->x = list->x;
- array->y = list->y;
- array->w = list->w;
- array->h = list->h;
- array->serialNumber = 0;
- array->fg = array->bg = -1;
- list = list->next;
- array++;
- }
-}
-
-
-
-static CacheLinkPtr
-Enlist(CacheLinkPtr link, int x, int y, int w, int h)
-{
- CacheLinkPtr newLink;
-
- newLink = malloc(sizeof(CacheLink));
- newLink->next = link;
- newLink->x = x; newLink->y = y;
- newLink->w = w; newLink->h = h;
- return newLink;
-}
-
-
-
-static CacheLinkPtr
-Delist(CacheLinkPtr link) {
- CacheLinkPtr ret = NULL;
-
- if(link) {
- ret = link->next;
- free(link);
- }
- return ret;
-}
-
-
-
-static void
-FreeList(CacheLinkPtr link) {
- CacheLinkPtr tmp;
-
- while(link) {
- tmp = link;
- link = link->next;
- free(tmp);
- }
-}
-
-
-
-static CacheLinkPtr
-QuadLinks(CacheLinkPtr big, CacheLinkPtr little)
-{
- /* CAUTION: This doesn't free big */
- int w1, w2, h1, h2;
-
- while(big) {
- w1 = big->w >> 1;
- w2 = big->w - w1;
- h1 = big->h >> 1;
- h2 = big->h - h1;
-
- little = Enlist(little, big->x, big->y, w1, h1);
- little = Enlist(little, big->x + w1, big->y, w2, h1);
- little = Enlist(little, big->x, big->y + h1, w1, h2);
- little = Enlist(little, big->x + w1, big->y + h1, w2, h2);
-
- big = big->next;
- }
- return little;
-}
-
-
-static void
-SubdivideList(CacheLinkPtr *large, CacheLinkPtr *small)
-{
- CacheLinkPtr big = *large;
- CacheLinkPtr little = *small;
- int size = big->w >> 1;
-
- little = Enlist(little, big->x, big->y, size, size);
- little = Enlist(little, big->x + size, big->y, size, size);
- little = Enlist(little, big->x, big->y + size, size, size);
- little = Enlist(little, big->x + size, big->y + size, size, size);
- *small = little;
- big = Delist(big);
- *large = big;
-}
-
-static void
-FreePixmapCachePrivate(XAAPixmapCachePrivatePtr pPriv)
-{
- if(!pPriv) return;
-
- free(pPriv->Info512);
- free(pPriv->Info256);
- free(pPriv->Info128);
- free(pPriv->InfoColor);
- free(pPriv->InfoMono);
- free(pPriv->InfoPartial);
-
- free(pPriv);
-}
-
-void
-XAAClosePixmapCache(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
-
- if(infoRec->PixmapCachePrivate)
- FreePixmapCachePrivate(
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate);
-
- infoRec->PixmapCachePrivate = NULL;
-}
-
-
-
-static CacheLinkPtr
-ThinOutPartials(
- CacheLinkPtr ListPartial,
- int *num, int *maxw, int *maxh
-) {
-/* This guy's job is to get at least 4 big slots out of a list of fragments */
-
- CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
- int Num64, Num32, Num16, Num8, NumKeepers;
- int w, h;
-
- List64 = List32 = List16 = List8 = ListKeepers = NULL;
- Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
- w = h = 0;
-
- /* We sort partials by how large a square tile they can cache.
- If a partial can't store a 64x64, 32x32, 16x16 or 8x8 tile,
- we free it. */
-
- pCur = ListPartial;
- while(pCur) {
- next = pCur->next;
- if((pCur->w >= 64) && (pCur->h >= 64)) {
- pCur->next = List64; List64 = pCur;
- Num64++;
- } else
- if((pCur->w >= 32) && (pCur->h >= 32)) {
- pCur->next = List32; List32 = pCur;
- Num32++;
- } else
- if((pCur->w >= 16) && (pCur->h >= 16)) {
- pCur->next = List16; List16 = pCur;
- Num16++;
- } else
- if((pCur->w >= 8) && (pCur->h >= 8)) {
- pCur->next = List8; List8 = pCur;
- Num8++;
- } else {
- free(pCur);
- }
-
- pCur = next;
- }
-
- /* We save all the tiles from the largest bin that we can get
- at least 4 of. If there are too few of a bigger slot, we
- cut it in fourths to make smaller slots. */
-
- if(Num64 >= 4) {
- ListKeepers = List64; List64 = NULL;
- NumKeepers = Num64;
- goto GOT_EM;
- } else if(Num64) {
- List32 = QuadLinks(List64, List32);
- Num32 += Num64 * 4;
- Num64 = 0;
- }
-
- if(Num32 >= 4) {
- ListKeepers = List32; List32 = NULL;
- NumKeepers = Num32;
- goto GOT_EM;
- } else if(Num32) {
- List16 = QuadLinks(List32, List16);
- Num16 += Num32 * 4;
- Num32 = 0;
- }
-
- if(Num16 >= 4) {
- ListKeepers = List16; List16 = NULL;
- NumKeepers = Num16;
- goto GOT_EM;
- } else if(Num16) {
- List8 = QuadLinks(List16, List8);
- Num8 += Num16 * 4;
- Num16 = 0;
- }
-
- if(Num8 >= 4) {
- ListKeepers = List8; List8 = NULL;
- NumKeepers = Num8;
- goto GOT_EM;
- }
-
-GOT_EM:
-
- /* Free the ones we aren't using */
-
- if(List64) FreeList(List64);
- if(List32) FreeList(List32);
- if(List16) FreeList(List16);
- if(List8) FreeList(List8);
-
-
- /* Enlarge the slots if we can */
-
- if(ListKeepers) {
- CacheLinkPtr pLink = ListKeepers;
- w = h = 128;
-
- while(pLink) {
- if(pLink->w < w) w = pLink->w;
- if(pLink->h < h) h = pLink->h;
- pLink = pLink->next;
- }
- }
-
- *maxw = w;
- *maxh = h;
- *num = NumKeepers;
- return ListKeepers;
-}
-
-static void
-ConvertColorToMono(
- CacheLinkPtr *ColorList,
- int ColorW, int ColorH,
- CacheLinkPtr *MonoList,
- int MonoW, int MonoH
-){
- int x, y, w;
-
- x = (*ColorList)->x; y = (*ColorList)->y;
- *ColorList = Delist(*ColorList);
-
- while(ColorH) {
- ColorH -= MonoH;
- for(w = 0; w <= (ColorW - MonoW); w += MonoW)
- *MonoList = Enlist(*MonoList, x + w, y + ColorH, MonoW, MonoH);
- }
-}
-
-static void
-ConvertAllPartialsTo8x8(
- int *NumMono, int *NumColor,
- CacheLinkPtr ListPartial,
- CacheLinkPtr *ListMono,
- CacheLinkPtr *ListColor,
- XAAInfoRecPtr infoRec
-){
-/* This guy extracts as many 8x8 slots as it can out of fragments */
-
- int ColorH = infoRec->CacheHeightColor8x8Pattern;
- int ColorW = infoRec->CacheWidthColor8x8Pattern;
- int MonoH = infoRec->CacheHeightMono8x8Pattern;
- int MonoW = infoRec->CacheWidthMono8x8Pattern;
- int x, y, w, Height, Width;
- Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
- Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
- CacheLinkPtr pLink = ListPartial;
- CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
-
- if(DoColor && DoMono) {
- /* we assume color patterns take more space than color ones */
- if(MonoH > ColorH) ColorH = MonoH;
- if(MonoW > ColorW) ColorW = MonoW;
- }
-
- /* Break up the area into as many Color and Mono slots as we can */
-
- while(pLink) {
- Height = pLink->h;
- Width = pLink->w;
- x = pLink->x;
- y = pLink->y;
-
- if(DoColor) {
- while(Height >= ColorH) {
- Height -= ColorH;
- for(w = 0; w <= (Width - ColorW); w += ColorW) {
- ColorList = Enlist(
- ColorList, x + w, y + Height, ColorW, ColorH);
- (*NumColor)++;
- }
- }
- }
-
- if(DoMono && (Height >= MonoH)) {
- while(Height >= MonoH) {
- Height -= MonoH;
- for(w = 0; w <= (Width - MonoW); w += MonoW) {
- MonoList = Enlist(
- MonoList, x + w, y + Height, MonoW, MonoH);
- (*NumMono)++;
- }
- }
- }
-
- pLink = pLink->next;
- }
-
-
- *ListMono = MonoList;
- *ListColor = ColorList;
- FreeList(ListPartial);
-}
-
-
-static CacheLinkPtr
-ExtractOneThatFits(CacheLinkPtr *initList, int w, int h)
-{
- CacheLinkPtr list = *initList;
- CacheLinkPtr prev = NULL;
-
- while(list) {
- if((list->w >= w) && (list->h >= h))
- break;
- prev = list;
- list = list->next;
- }
-
- if(list) {
- if(prev)
- prev->next = list->next;
- else
- *initList = list->next;
-
- list->next = NULL;
- }
-
- return list;
-}
-
-
-static CacheLinkPtr
-ConvertSomePartialsTo8x8(
- int *NumMono, int *NumColor, int *NumPartial,
- CacheLinkPtr ListPartial,
- CacheLinkPtr *ListMono,
- CacheLinkPtr *ListColor,
- int *maxw, int *maxh,
- XAAInfoRecPtr infoRec
-){
-/* This guy tries to get 4 of each type of 8x8 slot requested out of
- a list of fragments all while trying to retain some big fragments
- for the cache blits */
-
- int ColorH = infoRec->CacheHeightColor8x8Pattern;
- int ColorW = infoRec->CacheWidthColor8x8Pattern;
- int MonoH = infoRec->CacheHeightMono8x8Pattern;
- int MonoW = infoRec->CacheWidthMono8x8Pattern;
- Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
- Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
- CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
- CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
- int Num64, Num32, Num16, Num8, NumKeepers;
- int w, h, Width, Height;
- int MonosPerColor = 1;
-
- if(DoColor && DoMono) {
- /* we assume color patterns take more space than color ones */
- if(MonoH > ColorH) ColorH = MonoH;
- if(MonoW > ColorW) ColorW = MonoW;
- MonosPerColor = (ColorH/MonoH) * (ColorW/MonoW);
- }
-
- List64 = List32 = List16 = List8 = ListKeepers = MonoList = ColorList = NULL;
- Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
- Width = Height = 0;
-
- /* We sort partials by how large a square tile they can cache.
- We make 8x8 patterns from the leftovers if we can. */
-
- pCur = ListPartial;
- while(pCur) {
- next = pCur->next;
- if((pCur->w >= 64) && (pCur->h >= 64)) {
- pCur->next = List64; List64 = pCur;
- Num64++;
- } else
- if((pCur->w >= 32) && (pCur->h >= 32)) {
- pCur->next = List32; List32 = pCur;
- Num32++;
- } else
- if((pCur->w >= 16) && (pCur->h >= 16)) {
- pCur->next = List16; List16 = pCur;
- Num16++;
- } else
- if((pCur->w >= 8) && (pCur->h >= 8)) {
- pCur->next = List8; List8 = pCur;
- Num8++;
- } else {
- h = pCur->h;
- if(DoColor && (pCur->w >= ColorW) && (h >= ColorH)) {
- while(h >= ColorH) {
- h -= ColorH;
- for(w = 0; w <= (pCur->w - ColorW); w += ColorW) {
- ColorList = Enlist( ColorList,
- pCur->x + w, pCur->y + h, ColorW, ColorH);
- (*NumColor)++;
- }
- }
- }
- if(DoMono && (pCur->w >= MonoW) && (h >= MonoH)) {
- while(h >= MonoH) {
- h -= MonoH;
- for(w = 0; w <= (pCur->w - MonoW); w += MonoW) {
- MonoList = Enlist( MonoList,
- pCur->x + w, pCur->y + h, MonoW, MonoH);
- (*NumMono)++;
- }
- }
- }
- free(pCur);
- }
-
- pCur = next;
- }
-
- /* Try to extract at least 4 of each type of 8x8 slot that we need */
-
- if(DoColor) {
- CacheLinkPtr theOne;
- while(*NumColor < 4) {
- theOne = NULL;
- if(Num8) {
- if((theOne = ExtractOneThatFits(&List8, ColorW, ColorH)))
- Num8--;
- }
- if(Num16 && !theOne) {
- if((theOne = ExtractOneThatFits(&List16, ColorW, ColorH)))
- Num16--;
- }
- if(Num32 && !theOne) {
- if((theOne = ExtractOneThatFits(&List32, ColorW, ColorH)))
- Num32--;
- }
- if(Num64 && !theOne) {
- if((theOne = ExtractOneThatFits(&List64, ColorW, ColorH)))
- Num64--;
- }
-
- if(!theOne) break;
-
-
- ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
- &MonoList, &ColorList, infoRec);
-
- if(DoMono) {
- while(*NumColor && (*NumMono < 4)) {
- ConvertColorToMono(&ColorList, ColorW, ColorH,
- &MonoList, MonoW, MonoH);
- (*NumColor)--; *NumMono += MonosPerColor;
- }
- }
- }
- }
-
- if(DoMono) {
- CacheLinkPtr theOne;
- while(*NumMono < 4) {
- theOne = NULL;
- if(Num8) {
- if((theOne = ExtractOneThatFits(&List8, MonoW, MonoH)))
- Num8--;
- }
- if(Num16 && !theOne) {
- if((theOne = ExtractOneThatFits(&List16, MonoW, MonoH)))
- Num16--;
- }
- if(Num32 && !theOne) {
- if((theOne = ExtractOneThatFits(&List32, MonoW, MonoH)))
- Num32--;
- }
- if(Num64 && !theOne) {
- if((theOne = ExtractOneThatFits(&List64, MonoW, MonoH)))
- Num64--;
- }
-
- if(!theOne) break;
-
- ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
- &MonoList, &ColorList, infoRec);
- }
- }
-
- /* We save all the tiles from the largest bin that we can get
- at least 4 of. If there are too few of a bigger slot, we
- cut it in fourths to make smaller slots. */
-
- if(Num64 >= 4) {
- ListKeepers = List64; List64 = NULL;
- NumKeepers = Num64;
- goto GOT_EM;
- } else if(Num64) {
- List32 = QuadLinks(List64, List32);
- Num32 += Num64 * 4;
- Num64 = 0;
- }
-
- if(Num32 >= 4) {
- ListKeepers = List32; List32 = NULL;
- NumKeepers = Num32;
- goto GOT_EM;
- } else if(Num32) {
- List16 = QuadLinks(List32, List16);
- Num16 += Num32 * 4;
- Num32 = 0;
- }
-
- if(Num16 >= 4) {
- ListKeepers = List16; List16 = NULL;
- NumKeepers = Num16;
- goto GOT_EM;
- } else if(Num16) {
- List8 = QuadLinks(List16, List8);
- Num8 += Num16 * 4;
- Num16 = 0;
- }
-
- if(Num8 >= 4) {
- ListKeepers = List8; List8 = NULL;
- NumKeepers = Num8;
- goto GOT_EM;
- }
-
-GOT_EM:
-
- /* Free the ones we aren't using */
-
- if(List64)
- ConvertAllPartialsTo8x8(NumMono, NumColor, List64,
- &MonoList, &ColorList, infoRec);
- if(List32)
- ConvertAllPartialsTo8x8(NumMono, NumColor, List32,
- &MonoList, &ColorList, infoRec);
- if(List16)
- ConvertAllPartialsTo8x8(NumMono, NumColor, List16,
- &MonoList, &ColorList, infoRec);
- if(List8)
- ConvertAllPartialsTo8x8(NumMono, NumColor, List8,
- &MonoList, &ColorList, infoRec);
-
-
- /* Enlarge the slots if we can */
-
- if(ListKeepers) {
- CacheLinkPtr pLink = ListKeepers;
- Width = Height = 128;
-
- while(pLink) {
- if(pLink->w < Width) Width = pLink->w;
- if(pLink->h < Height) Height = pLink->h;
- pLink = pLink->next;
- }
- }
-
- *ListMono = MonoList;
- *ListColor = ColorList;
- *maxw = Width;
- *maxh = Height;
- *NumPartial = NumKeepers;
- return ListKeepers;
-}
-
-
-void
-XAAInitPixmapCache(
- ScreenPtr pScreen,
- RegionPtr areas,
- pointer data
-) {
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAInfoRecPtr infoRec = (XAAInfoRecPtr)data;
- XAAPixmapCachePrivatePtr pCachePriv;
- BoxPtr pBox = RegionRects(areas);
- int nBox = RegionNumRects(areas);
- int Num512, Num256, Num128, NumPartial, NumColor, NumMono;
- int Target512, Target256;
- CacheLinkPtr List512, List256, List128, ListPartial, ListColor, ListMono;
- int x, y, w, h, ntotal, granularity, width, height, i;
- int MaxPartialWidth, MaxPartialHeight;
-
- infoRec->MaxCacheableTileWidth = 0;
- infoRec->MaxCacheableTileHeight = 0;
- infoRec->MaxCacheableStippleHeight = 0;
- infoRec->MaxCacheableStippleWidth = 0;
- infoRec->UsingPixmapCache = FALSE;
-
-
- if(!nBox || !pBox || !(infoRec->Flags & PIXMAP_CACHE))
- return;
-
- /* Allocate a persistent per-screen init flag to control messages */
- if (CacheInitIndex < 0)
- CacheInitIndex = xf86AllocateScrnInfoPrivateIndex();
-
- /* free the old private data if it exists */
- if(infoRec->PixmapCachePrivate) {
- FreePixmapCachePrivate(
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate);
- infoRec->PixmapCachePrivate = NULL;
- }
-
- Num512 = Num256 = Num128 = NumPartial = NumMono = NumColor = 0;
- List512 = List256 = List128 = ListPartial = ListMono = ListColor = NULL;
- granularity = infoRec->CachePixelGranularity;
- if(granularity <= 1) granularity = 0;
-
- /* go through the boxes and break it into as many pieces as we can fit */
-
- while(nBox--) {
- x = pBox->x1;
- if(granularity) {
- int tmp = x % granularity;
- if(tmp) x += (granularity - tmp);
- }
- width = pBox->x2 - x;
- if(width <= 0) {pBox++; continue;}
-
- y = pBox->y1;
- height = pBox->y2 - y;
-
- for(h = 0; h <= (height - 512); h += 512) {
- for(w = 0; w <= (width - 512); w += 512) {
- List512 = Enlist(List512, x + w, y + h, 512, 512);
- Num512++;
- }
- for(; w <= (width - 256); w += 256) {
- List256 = Enlist(List256, x + w, y + h, 256, 256);
- List256 = Enlist(List256, x + w, y + h + 256, 256, 256);
- Num256 += 2;
- }
- for(; w <= (width - 128); w += 128) {
- List128 = Enlist(List128, x + w, y + h, 128, 128);
- List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
- List128 = Enlist(List128, x + w, y + h + 256, 128, 128);
- List128 = Enlist(List128, x + w, y + h + 384, 128, 128);
- Num128 += 4;
- }
- if(w < width) {
- int d = width - w;
- ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
- ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
- ListPartial = Enlist(ListPartial, x + w, y + h + 256, d, 128);
- ListPartial = Enlist(ListPartial, x + w, y + h + 384, d, 128);
- NumPartial += 4;
- }
- }
- for(; h <= (height - 256); h += 256) {
- for(w = 0; w <= (width - 256); w += 256) {
- List256 = Enlist(List256, x + w, y + h, 256, 256);
- Num256++;
- }
- for(; w <= (width - 128); w += 128) {
- List128 = Enlist(List128, x + w, y + h, 128, 128);
- List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
- Num128 += 2;
- }
- if(w < width) {
- int d = width - w;
- ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
- ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
- NumPartial += 2;
- }
- }
- for(; h <= (height - 128); h += 128) {
- for(w = 0; w <= (width - 128); w += 128) {
- List128 = Enlist(List128, x + w, y + h, 128, 128);
- Num128++;
- }
- if(w < width) {
- ListPartial = Enlist(
- ListPartial, x + w, y + h, width - w, 128);
- NumPartial++;
- }
- }
- if(h < height) {
- int d = height - h;
- for(w = 0; w <= (width - 128); w += 128) {
- ListPartial = Enlist(ListPartial, x + w, y + h, 128, d);
- NumPartial++;
- }
- if(w < width) {
- ListPartial = Enlist(ListPartial, x + w, y + h, width - w, d);
- NumPartial++;
- }
- }
- pBox++;
- }
-
-
-/*
- by this point we've carved the space into as many 512x512, 256x256
- and 128x128 blocks as we could fit. We will then break larger
- blocks into smaller ones if we need to. The rules are as follows:
-
- 512x512 -
- 1) Don't take up more than half the memory.
- 2) Don't bother if you can't get at least four.
- 3) Don't make more than MAX_512.
- 4) Don't have any of there are no 256x256s.
-
- 256x256 -
- 1) Don't take up more than a quarter of the memory enless there
- aren't any 512x512s. Then we can take up to half.
- 2) Don't bother if you can't get at least four.
- 3) Don't make more than MAX_256.
-
- 128x128 -
- 1) Don't make more than MAX_128.
-
- We don't bother with the partial blocks unless we can use them
- for 8x8 pattern fills or we are short on larger blocks.
-
-*/
-
- ntotal = Num128 + (Num256<<2) + (Num512<<4);
-
- Target512 = ntotal >> 5;
- if(Target512 < 4) Target512 = 0;
- if(!Target512) Target256 = ntotal >> 3;
- else Target256 = ntotal >> 4;
- if(Target256 < 4) Target256 = 0;
-
- if(Num512 && Num256 < 4) {
- while(Num512 && Num256 < Target256) {
- SubdivideList(&List512, &List256);
- Num256 += 4; Num512--;
- }
- }
-
- if(!Num512) { /* no room */
- } else if((Num512 < 4) || (!Target512)) {
- while(Num512) {
- SubdivideList(&List512, &List256);
- Num256 += 4; Num512--;
- }
- } else if((Num512 > MAX_512) || (Num512 > Target512)){
- while(Num512 > MAX_512) {
- SubdivideList(&List512, &List256);
- Num256 += 4; Num512--;
- }
- while(Num512 > Target512) {
- if(Num256 < MAX_256) {
- SubdivideList(&List512, &List256);
- Num256 += 4; Num512--;
- } else break;
- }
- }
-
- if(!Num256) { /* no room */
- } else if((Num256 < 4) || (!Target256)) {
- while(Num256) {
- SubdivideList(&List256, &List128);
- Num128 += 4; Num256--;
- }
- } else if((Num256 > MAX_256) || (Num256 > Target256)) {
- while(Num256 > MAX_256) {
- SubdivideList(&List256, &List128);
- Num128 += 4; Num256--;
- }
- while(Num256 > Target256) {
- if(Num128 < MAX_128) {
- SubdivideList(&List256, &List128);
- Num128 += 4; Num256--;
- } else break;
- }
- }
-
- if(Num128 && ((Num128 < 4) || (Num128 > MAX_128))) {
- CacheLinkPtr next;
- int max = (Num128 > MAX_128) ? MAX_128 : 0;
-
- /*
- * Note: next is set in this way to work around a code generation
- * bug in gcc 2.7.2.3.
- */
- next = List128->next;
- while(Num128 > max) {
- List128->next = ListPartial;
- ListPartial = List128;
- if((List128 = next))
- next = List128->next;
- NumPartial++; Num128--;
- }
- }
-
- MaxPartialHeight = MaxPartialWidth = 0;
-
- /* at this point we have as many 512x512 and 256x256 slots as we
- want but may have an excess of 128x128 slots. We still need
- to find out if we need 8x8 slots. We take these from the
- partials if we have them. Otherwise, we break some 128x128's */
-
- if(!(infoRec->PixmapCacheFlags & (CACHE_MONO_8x8 | CACHE_COLOR_8x8))) {
- if(NumPartial) {
- if(Num128) { /* don't bother with partials */
- FreeList(ListPartial);
- NumPartial = 0; ListPartial = NULL;
- } else {
- /* We have no big slots. Weed out the unusable partials */
- ListPartial = ThinOutPartials(ListPartial, &NumPartial,
- &MaxPartialWidth, &MaxPartialHeight);
- }
- }
- } else {
- int MonosPerColor = 1;
- int ColorH = infoRec->CacheHeightColor8x8Pattern;
- int ColorW = infoRec->CacheWidthColor8x8Pattern;
- int MonoH = infoRec->CacheHeightMono8x8Pattern;
- int MonoW = infoRec->CacheWidthMono8x8Pattern;
- Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
- Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
-
- if(DoColor) infoRec->CanDoColor8x8 = FALSE;
- if(DoMono) infoRec->CanDoMono8x8 = FALSE;
-
- if(DoColor && DoMono) {
- /* we assume color patterns take more space than color ones */
- if(MonoH > ColorH) ColorH = MonoH;
- if(MonoW > ColorW) ColorW = MonoW;
- MonosPerColor = (ColorH/MonoH) * (ColorW/MonoW);
- }
-
- if(Num128) {
- if(NumPartial) { /* use all for 8x8 slots */
- ConvertAllPartialsTo8x8(&NumMono, &NumColor,
- ListPartial, &ListMono, &ListColor, infoRec);
- NumPartial = 0; ListPartial = NULL;
- }
-
- /* Get some 8x8 slots from the 128 slots */
- while((Num128 > 4) &&
- ((NumMono < MAX_MONO) && (NumColor < MAX_COLOR))) {
- CacheLinkPtr tmp = NULL;
-
- tmp = Enlist(tmp, List128->x, List128->y,
- List128->w, List128->h);
- List128 = Delist(List128);
- Num128--;
-
- ConvertAllPartialsTo8x8(&NumMono, &NumColor,
- tmp, &ListMono, &ListColor, infoRec);
- }
- } else if(NumPartial) {
- /* We have share partials between 8x8 slots and tiles. */
- ListPartial = ConvertSomePartialsTo8x8(&NumMono, &NumColor,
- &NumPartial, ListPartial, &ListMono, &ListColor,
- &MaxPartialWidth, &MaxPartialHeight, infoRec);
- }
-
-
- if(DoMono && DoColor) {
- if(NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
- int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
-
- while(NumColor > max) {
- ConvertColorToMono(&ListColor, ColorW, ColorH,
- &ListMono, MonoW, MonoH);
- NumColor--; NumMono += MonosPerColor;
- }
- }
-
- /* favor Mono slots over Color ones */
- while((NumColor > 4) && (NumMono < MAX_MONO)) {
- ConvertColorToMono(&ListColor, ColorW, ColorH,
- &ListMono, MonoW, MonoH);
- NumColor--; NumMono += MonosPerColor;
- }
- }
-
- if(NumMono && ((NumMono > MAX_MONO) || (NumMono < 4))) {
- int max = (NumMono > MAX_MONO) ? MAX_MONO : 0;
-
- while(NumMono > max) {
- ListMono = Delist(ListMono);
- NumMono--;
- }
- }
- if(NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
- int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
-
- while(NumColor > max) {
- ListColor = Delist(ListColor);
- NumColor--;
- }
- }
- }
-
-
- pCachePriv = calloc(1,sizeof(XAAPixmapCachePrivate));
- if(!pCachePriv) {
- if(Num512) FreeList(List512);
- if(Num256) FreeList(List256);
- if(Num128) FreeList(List128);
- if(NumPartial) FreeList(ListPartial);
- if(NumColor) FreeList(ListColor);
- if(NumMono) FreeList(ListMono);
- return;
- }
-
- infoRec->PixmapCachePrivate = (char*)pCachePriv;
-
- if(Num512) {
- pCachePriv->Info512 = calloc(Num512,sizeof(XAACacheInfoRec));
- if(!pCachePriv->Info512) Num512 = 0;
- if(Num512) TransferList(List512, pCachePriv->Info512, Num512);
- FreeList(List512);
- pCachePriv->Num512x512 = Num512;
- }
- if(Num256) {
- pCachePriv->Info256 = calloc(Num256, sizeof(XAACacheInfoRec));
- if(!pCachePriv->Info256) Num256 = 0;
- if(Num256) TransferList(List256, pCachePriv->Info256, Num256);
- FreeList(List256);
- pCachePriv->Num256x256 = Num256;
- }
- if(Num128) {
- pCachePriv->Info128 = calloc(Num128, sizeof(XAACacheInfoRec));
- if(!pCachePriv->Info128) Num128 = 0;
- if(Num128) TransferList(List128, pCachePriv->Info128, Num128);
- FreeList(List128);
- pCachePriv->Num128x128 = Num128;
- }
-
- if(NumPartial) {
- pCachePriv->InfoPartial = calloc(NumPartial, sizeof(XAACacheInfoRec));
- if(!pCachePriv->InfoPartial) NumPartial = 0;
- if(NumPartial)
- TransferList(ListPartial, pCachePriv->InfoPartial, NumPartial);
- FreeList(ListPartial);
- pCachePriv->NumPartial = NumPartial;
- }
-
- if(NumColor) {
- pCachePriv->InfoColor = calloc(NumColor, sizeof(XAACacheInfoRec));
- if(!pCachePriv->InfoColor) NumColor = 0;
- if(NumColor) TransferList(ListColor, pCachePriv->InfoColor, NumColor);
- FreeList(ListColor);
- pCachePriv->NumColor = NumColor;
- }
-
- if(NumMono) {
- pCachePriv->InfoMono = calloc(NumMono, sizeof(XAACacheInfoRec));
- if(!pCachePriv->InfoMono) NumMono = 0;
- if(NumMono) TransferList(ListMono, pCachePriv->InfoMono, NumMono);
- FreeList(ListMono);
- pCachePriv->NumMono = NumMono;
- }
-
-
- if(NumPartial) {
- infoRec->MaxCacheableTileWidth = MaxPartialWidth;
- infoRec->MaxCacheableTileHeight = MaxPartialHeight;
- }
- if(Num128)
- infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 128;
- if(Num256)
- infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 256;
- if(Num512)
- infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 512;
-
-
- infoRec->MaxCacheableStippleHeight = infoRec->MaxCacheableTileHeight;
- infoRec->MaxCacheableStippleWidth =
- infoRec->MaxCacheableTileWidth * pScrn->bitsPerPixel;
- if(infoRec->ScreenToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP)
- infoRec->MaxCacheableStippleWidth /= 3;
-
- if(NumMono) {
- if(!(infoRec->Mono8x8PatternFillFlags &
- (HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
- HARDWARE_PATTERN_PROGRAMMED_BITS))) {
- int numPerLine =
- infoRec->CacheWidthMono8x8Pattern/infoRec->MonoPatternPitch;
-
- for(i = 0; i < 64; i++) {
- pCachePriv->MonoOffsets[i].y = i/numPerLine;
- pCachePriv->MonoOffsets[i].x = (i % numPerLine) *
- infoRec->MonoPatternPitch;
- }
- }
- infoRec->CanDoMono8x8 = TRUE;
- }
- if(NumColor) {
- if(!(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
-
- for(i = 0; i < 64; i++) {
- pCachePriv->ColorOffsets[i].y = i & 0x07;
- pCachePriv->ColorOffsets[i].x = i & ~0x07;
- }
- }
- infoRec->CanDoColor8x8 = TRUE;
- }
-
- if(!CACHEINIT(pScrn)) {
- xf86ErrorF("\tSetting up tile and stipple cache:\n");
- if(NumPartial)
- xf86ErrorF("\t\t%i %ix%i slots\n",
- NumPartial, MaxPartialWidth, MaxPartialHeight);
- if(Num128) xf86ErrorF("\t\t%i 128x128 slots\n", Num128);
- if(Num256) xf86ErrorF("\t\t%i 256x256 slots\n", Num256);
- if(Num512) xf86ErrorF("\t\t%i 512x512 slots\n", Num512);
- if(NumColor) xf86ErrorF("\t\t%i 8x8 color pattern slots\n", NumColor);
- if(NumMono) xf86ErrorF("\t\t%i 8x8 color expansion slots\n", NumMono);
- }
-
- if(!(NumPartial | Num128 | Num256 | Num512 | NumColor | NumMono)) {
- if(!CACHEINIT(pScrn))
- xf86ErrorF("\t\tNot enough video memory for pixmap cache\n");
- } else infoRec->UsingPixmapCache = TRUE;
-
- CACHEINIT(pScrn) = 1;
-}
-
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-static CARD32 StippleMasks[4] = {
- 0x80808080,
- 0xC0C0C0C0,
- 0x00000000,
- 0xF0F0F0F0
-};
-#else
-static CARD32 StippleMasks[4] = {
- 0x01010101,
- 0x03030303,
- 0x00000000,
- 0x0F0F0F0F
-};
-#endif
-
-Bool
-XAACheckStippleReducibility(PixmapPtr pPixmap)
-{
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
- CARD32 *IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
- int w = pPixmap->drawable.width;
- int h = pPixmap->drawable.height;
- int i;
- CARD32 bits[8];
- CARD32 mask = SHIFT_R(0xFFFFFFFF,24);
-
- pPriv->flags |= REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR;
- pPriv->flags &= ~REDUCIBLE_TO_8x8;
-
- if((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
- return FALSE;
-
- i = (h > 8) ? 8 : h;
-
- switch(w) {
- case 32:
- while(i--) {
- bits[i] = IntPtr[i] & mask;
- if( (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 8)), 8)) ||
- (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask,16)),16)) ||
- (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask,24)),24)))
- return FALSE;
- }
- break;
- case 16:
- while(i--) {
- bits[i] = IntPtr[i] & mask;
- if(bits[i] != ((IntPtr[i] & SHIFT_R(SHIFT_L(mask,8),8))))
- return FALSE;
- }
- break;
- default:
- while(i--)
- bits[i] = IntPtr[i] & mask;
- break;
- }
-
- switch(h) {
- case 32:
- if( (IntPtr[8] != IntPtr[16]) || (IntPtr[9] != IntPtr[17]) ||
- (IntPtr[10] != IntPtr[18]) || (IntPtr[11] != IntPtr[19]) ||
- (IntPtr[12] != IntPtr[20]) || (IntPtr[13] != IntPtr[21]) ||
- (IntPtr[14] != IntPtr[22]) || (IntPtr[15] != IntPtr[23]) ||
- (IntPtr[16] != IntPtr[24]) || (IntPtr[17] != IntPtr[25]) ||
- (IntPtr[18] != IntPtr[26]) || (IntPtr[19] != IntPtr[27]) ||
- (IntPtr[20] != IntPtr[28]) || (IntPtr[21] != IntPtr[29]) ||
- (IntPtr[22] != IntPtr[30]) || (IntPtr[23] != IntPtr[31]))
- return FALSE;
- /* fall through */
- case 16:
- if( (IntPtr[0] != IntPtr[8]) || (IntPtr[1] != IntPtr[9]) ||
- (IntPtr[2] != IntPtr[10]) || (IntPtr[3] != IntPtr[11]) ||
- (IntPtr[4] != IntPtr[12]) || (IntPtr[5] != IntPtr[13]) ||
- (IntPtr[6] != IntPtr[14]) || (IntPtr[7] != IntPtr[15]))
- return FALSE;
- case 8: break;
- case 1: bits[1] = bits[0];
- case 2: bits[2] = bits[0]; bits[3] = bits[1];
- case 4: bits[4] = bits[0]; bits[5] = bits[1];
- bits[6] = bits[2]; bits[7] = bits[3];
- break;
- }
-
- pPriv->flags |= REDUCIBLE_TO_8x8;
-
- pPriv->pattern0 = bits[0] | SHIFT_L(bits[1],8) | SHIFT_L(bits[2],16) | SHIFT_L(bits[3],24);
- pPriv->pattern1 = bits[4] | SHIFT_L(bits[5],8) | SHIFT_L(bits[6],16) | SHIFT_L(bits[7],24);
-
- if(w < 8) {
- pPriv->pattern0 &= StippleMasks[w - 1];
- pPriv->pattern1 &= StippleMasks[w - 1];
-
- switch(w) {
- case 1: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,1);
- pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,1);
- case 2: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,2);
- pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,2);
- case 4: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,4);
- pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,4);
- }
- }
-
- if(infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
- pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
- pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
- }
-
-
- return TRUE;
-}
-
-
-Bool
-XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono)
-{
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
- CARD32 *IntPtr;
- int w = pPixmap->drawable.width;
- int h = pPixmap->drawable.height;
- int pitch = pPixmap->devKind >> 2;
- int dwords, i, j;
-
- pPriv->flags |= REDUCIBILITY_CHECKED;
- pPriv->flags &= ~(REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR);
-
- if((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
- return FALSE;
-
- dwords = ((w * pPixmap->drawable.bitsPerPixel) + 31) >> 5;
- i = (h > 8) ? 8 : h;
-
-
- if(w > 8) {
- IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
- switch(pPixmap->drawable.bitsPerPixel) {
- case 8:
- while(i--) {
- for(j = 2; j < dwords; j++)
- if(IntPtr[j] != IntPtr[j & 0x01])
- return FALSE;
- IntPtr += pitch;
- }
- break;
- case 16:
- while(i--) {
- for(j = 4; j < dwords; j++)
- if(IntPtr[j] != IntPtr[j & 0x03])
- return FALSE;
- IntPtr += pitch;
- }
- break;
- case 24:
- while(i--) {
- for(j = 6; j < dwords; j++)
- if(IntPtr[j] != IntPtr[j % 6])
- return FALSE;
- IntPtr += pitch;
- }
- break;
- case 32:
- while(i--) {
- for(j = 8; j < dwords; j++)
- if(IntPtr[j] != IntPtr[j & 0x07])
- return FALSE;
- IntPtr += pitch;
- }
- break;
- default: return FALSE;
- }
-
- }
-
-
- if(h == 32) {
- CARD32 *IntPtr2, *IntPtr3, *IntPtr4;
- i = 8;
- IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
- IntPtr2 = IntPtr + (pitch << 3);
- IntPtr3 = IntPtr2 + (pitch << 3);
- IntPtr4 = IntPtr3 + (pitch << 3);
- while(i--) {
- for(j = 0; j < dwords; j++)
- if((IntPtr[j] != IntPtr2[j]) || (IntPtr[j] != IntPtr3[j]) ||
- (IntPtr[j] != IntPtr4[j]))
- return FALSE;
- IntPtr += pitch;
- IntPtr2 += pitch;
- IntPtr3 += pitch;
- IntPtr4 += pitch;
- }
- } else if (h == 16) {
- CARD32 *IntPtr2;
- i = 8;
- IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
- IntPtr2 = IntPtr + (pitch << 3);
- while(i--) {
- for(j = 0; j < dwords; j++)
- if(IntPtr[j] != IntPtr2[j])
- return FALSE;
- IntPtr += pitch;
- IntPtr2 += pitch;
- }
- }
-
- pPriv->flags |= REDUCIBLE_TO_8x8;
-
- if(checkMono) {
- XAAInfoRecPtr infoRec =
- GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
- unsigned char bits[8];
- int fg, bg = -1, x, y;
-
- i = (h > 8) ? 8 : h;
- j = (w > 8) ? 8 : w;
-
- if(pPixmap->drawable.bitsPerPixel == 8) {
- unsigned char *srcp = pPixmap->devPrivate.ptr;
- fg = srcp[0];
- pitch = pPixmap->devKind;
- for(y = 0; y < i; y++) {
- bits[y] = 0;
- for(x = 0; x < j; x++) {
- if(srcp[x] != fg) {
- if(bg == -1) bg = srcp[x];
- else if(bg != srcp[x]) return TRUE;
- } else bits[y] |= 1 << x;
- }
- srcp += pitch;
- }
- } else if(pPixmap->drawable.bitsPerPixel == 16) {
- unsigned short *srcp = (unsigned short*)pPixmap->devPrivate.ptr;
- fg = srcp[0];
- pitch = pPixmap->devKind >> 1;
- for(y = 0; y < i; y++) {
- bits[y] = 0;
- for(x = 0; x < j; x++) {
- if(srcp[x] != fg) {
- if(bg == -1) bg = srcp[x];
- else if(bg != srcp[x]) return TRUE;
- } else bits[y] |= 1 << x;
- }
- srcp += pitch;
- }
- } else if(pPixmap->drawable.bitsPerPixel == 24) {
- CARD32 val;
- unsigned char *srcp = pPixmap->devPrivate.ptr;
- fg = *((CARD32*)srcp) & 0x00FFFFFF;
- pitch = pPixmap->devKind;
- j *= 3;
- for(y = 0; y < i; y++) {
- bits[y] = 0;
- for(x = 0; x < j; x+=3) {
- val = *((CARD32*)(srcp+x)) & 0x00FFFFFF;
- if(val != fg) {
- if(bg == -1) bg = val;
- else if(bg != val)
- return TRUE;
- } else bits[y] |= 1 << (x/3);
- }
- srcp += pitch;
- }
- } else if(pPixmap->drawable.bitsPerPixel == 32) {
- IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
- fg = IntPtr[0];
- for(y = 0; y < i; y++) {
- bits[y] = 0;
- for(x = 0; x < j; x++) {
- if(IntPtr[x] != fg) {
- if(bg == -1) bg = IntPtr[x];
- else if(bg != IntPtr[x]) return TRUE;
- } else bits[y] |= 1 << x;
- }
- IntPtr += pitch;
- }
- } else return TRUE;
-
- pPriv->fg = fg;
- if(bg == -1) pPriv->bg = fg;
- else pPriv->bg = bg;
-
- if(h < 8) {
- switch(h) {
- case 1: bits[1] = bits[0];
- case 2: bits[2] = bits[0]; bits[3] = bits[1];
- case 4: bits[4] = bits[0]; bits[5] = bits[1];
- bits[6] = bits[2]; bits[7] = bits[3];
- break;
- }
- }
-
- pPriv->pattern0 =
- bits[0] | (bits[1]<<8) | (bits[2]<<16) | (bits[3]<<24);
- pPriv->pattern1 =
- bits[4] | (bits[5]<<8) | (bits[6]<<16) | (bits[7]<<24);
-
- if(w < 8) {
- switch(w) {
- case 1: pPriv->pattern0 |= (pPriv->pattern0 << 1);
- pPriv->pattern1 |= (pPriv->pattern1 << 1);
- case 2: pPriv->pattern0 |= (pPriv->pattern0 << 2);
- pPriv->pattern1 |= (pPriv->pattern1 << 2);
- case 4: pPriv->pattern0 |= (pPriv->pattern0 << 4);
- pPriv->pattern1 |= (pPriv->pattern1 << 4);
- }
- }
- pPriv->flags |= REDUCIBLE_TO_2_COLOR;
-
- if(infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
- pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
- pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
- }
-
- }
-
- return TRUE;
-}
-
-
-void XAATileCache(
- ScrnInfoPtr pScrn,
- XAACacheInfoPtr pCache,
- int w, int h
-) {
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->SetupForScreenToScreenCopy)(pScrn, 1, 1, GXcopy, ~0, -1);
-
- while((w << 1) <= pCache->w) {
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
- pCache->x + w, pCache->y, w, h);
- w <<= 1;
- }
- if(w != pCache->w) {
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
- pCache->x + w, pCache->y, pCache->w - w, h);
- w = pCache->w;
- }
-
- while((h << 1) <= pCache->h) {
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
- pCache->x, pCache->y + h, w, h);
- h <<= 1;
- }
- if(h != pCache->h) {
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
- pCache->x, pCache->y + h, w, pCache->h - h);
- }
- SET_SYNC_FLAG(infoRec);
-}
-
-XAACacheInfoPtr
-XAACacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
-{
- int w = pPix->drawable.width;
- int h = pPix->drawable.height;
- int size = max(w, h);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache, cacheRoot = NULL;
- int i, max = 0;
- int *current;
-
- if(size <= 128) {
- if(pCachePriv->Info128) {
- cacheRoot = pCachePriv->Info128;
- max = pCachePriv->Num128x128;
- current = &pCachePriv->Current128;
- } else {
- cacheRoot = pCachePriv->InfoPartial;
- max = pCachePriv->NumPartial;
- current = &pCachePriv->CurrentPartial;
- }
- } else if(size <= 256) {
- cacheRoot = pCachePriv->Info256;
- max = pCachePriv->Num256x256;
- current = &pCachePriv->Current256;
- } else if(size <= 512) {
- cacheRoot = pCachePriv->Info512;
- max = pCachePriv->Num512x512;
- current = &pCachePriv->Current512;
- } else { /* something's wrong */
- ErrorF("Something's wrong in XAACacheTile()\n");
- return pCachePriv->Info128;
- }
-
- pCache = cacheRoot;
-
- /* lets look for it */
- for(i = 0; i < max; i++, pCache++) {
- if(pCache->serialNumber == pPix->drawable.serialNumber) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
-
- pCache = &cacheRoot[(*current)++];
- if(*current >= max) *current = 0;
-
- pCache->serialNumber = pPix->drawable.serialNumber;
- pCache->trans_color = pCache->bg = pCache->fg = -1;
- pCache->orig_w = w; pCache->orig_h = h;
- (*infoRec->WritePixmapToCache)(
- pScrn, pCache->x, pCache->y, w, h, pPix->devPrivate.ptr,
- pPix->devKind, pPix->drawable.bitsPerPixel, pPix->drawable.depth);
- if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
- ((w != pCache->w) || (h != pCache->h)))
- XAATileCache(pScrn, pCache, w, h);
-
- return pCache;
-}
-
-XAACacheInfoPtr
-XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
-{
- int w = pPix->drawable.width;
- int h = pPix->drawable.height;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache, cacheRoot = NULL;
- int i, max = 0, funcNo, pad, dwords, bpp = pScrn->bitsPerPixel;
- int *current;
- StippleScanlineProcPtr StippleFunc;
- unsigned char *data, *srcPtr, *dstPtr;
-
- if((h <= 128) && (w <= 128 * bpp)) {
- if(pCachePriv->Info128) {
- cacheRoot = pCachePriv->Info128;
- max = pCachePriv->Num128x128;
- current = &pCachePriv->Current128;
- } else {
- cacheRoot = pCachePriv->InfoPartial;
- max = pCachePriv->NumPartial;
- current = &pCachePriv->CurrentPartial;
- }
- } else if((h <= 256) && (w <= 256 * bpp)){
- cacheRoot = pCachePriv->Info256;
- max = pCachePriv->Num256x256;
- current = &pCachePriv->Current256;
- } else if((h <= 512) && (w <= 526 * bpp)){
- cacheRoot = pCachePriv->Info512;
- max = pCachePriv->Num512x512;
- current = &pCachePriv->Current512;
- } else { /* something's wrong */
- ErrorF("Something's wrong in XAACacheMonoStipple()\n");
- return pCachePriv->Info128;
- }
-
- pCache = cacheRoot;
-
- /* lets look for it */
- for(i = 0; i < max; i++, pCache++) {
- if((pCache->serialNumber == pPix->drawable.serialNumber) &&
- (pCache->fg == -1) && (pCache->bg == -1)) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
-
- pCache = &cacheRoot[(*current)++];
- if(*current >= max) *current = 0;
-
- pCache->serialNumber = pPix->drawable.serialNumber;
- pCache->trans_color = pCache->bg = pCache->fg = -1;
- pCache->orig_w = w; pCache->orig_h = h;
-
- if(w <= 32) {
- if(w & (w - 1)) funcNo = 1;
- else funcNo = 0;
- } else funcNo = 2;
-
- pad = BitmapBytePad(pCache->w * bpp);
- dwords = bytes_to_int32(pad);
- dstPtr = data = (unsigned char*)malloc(pad * pCache->h);
- srcPtr = (unsigned char*)pPix->devPrivate.ptr;
-
- if(infoRec->ScreenToScreenColorExpandFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
- StippleFunc = XAAStippleScanlineFuncMSBFirst[funcNo];
- else
- StippleFunc = XAAStippleScanlineFuncLSBFirst[funcNo];
-
- /* don't bother generating more than we'll ever use */
- max = ((pScrn->displayWidth + w - 1) + 31) >> 5;
- if(dwords > max)
- dwords = max;
-
- for(i = 0; i < h; i++) {
- (*StippleFunc)((CARD32*)dstPtr, (CARD32*)srcPtr, 0, w, dwords);
- srcPtr += pPix->devKind;
- dstPtr += pad;
- }
-
- while((h<<1) <= pCache->h) {
- memcpy(data + (pad * h), data, pad * h);
- h <<= 1;
- }
-
- if(h < pCache->h)
- memcpy(data + (pad * h), data, pad * (pCache->h - h));
-
- (*infoRec->WritePixmapToCache)(
- pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data,
- pad, bpp, pScrn->depth);
-
- free(data);
-
- return pCache;
-}
-
-XAACacheInfoPtr
-XAACachePlanarMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
-{
- int w = pPix->drawable.width;
- int h = pPix->drawable.height;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache, cacheRoot = NULL;
- int i, max = 0;
- int *current;
-
- if((h <= 128) && (w <= 128)) {
- if(pCachePriv->Info128) {
- cacheRoot = pCachePriv->Info128;
- max = pCachePriv->Num128x128;
- current = &pCachePriv->Current128;
- } else {
- cacheRoot = pCachePriv->InfoPartial;
- max = pCachePriv->NumPartial;
- current = &pCachePriv->CurrentPartial;
- }
- } else if((h <= 256) && (w <= 256)){
- cacheRoot = pCachePriv->Info256;
- max = pCachePriv->Num256x256;
- current = &pCachePriv->Current256;
- } else if((h <= 512) && (w <= 526)){
- cacheRoot = pCachePriv->Info512;
- max = pCachePriv->Num512x512;
- current = &pCachePriv->Current512;
- } else { /* something's wrong */
- ErrorF("Something's wrong in XAACachePlanarMonoStipple()\n");
- return pCachePriv->Info128;
- }
-
- pCache = cacheRoot;
-
- /* lets look for it */
- for(i = 0; i < max; i++, pCache++) {
- if((pCache->serialNumber == pPix->drawable.serialNumber) &&
- (pCache->fg == -1) && (pCache->bg == -1)) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
-
- pCache = &cacheRoot[(*current)++];
- if(*current >= max) *current = 0;
-
- pCache->serialNumber = pPix->drawable.serialNumber;
- pCache->trans_color = pCache->bg = pCache->fg = -1;
- pCache->orig_w = w; pCache->orig_h = h;
-
- /* Plane 0 holds the stipple. Plane 1 holds the inverted stipple */
- (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
- pPix->drawable.width, pPix->drawable.height, pPix->devPrivate.ptr,
- pPix->devKind, 1, 2);
- if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_MONO_DATA) &&
- ((w != pCache->w) || (h != pCache->h)))
- XAATileCache(pScrn, pCache, w, h);
-
- return pCache;
-}
-
-XAACachePlanarMonoStippleProc
-XAAGetCachePlanarMonoStipple(void)
-{
- return XAACachePlanarMonoStipple;
-}
-
-XAACacheInfoPtr
-XAACacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
-{
- int w = pPix->drawable.width;
- int h = pPix->drawable.height;
- int size = max(w, h);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache, cacheRoot = NULL;
- int i, max = 0;
- int *current;
-
- if(size <= 128) {
- if(pCachePriv->Info128) {
- cacheRoot = pCachePriv->Info128;
- max = pCachePriv->Num128x128;
- current = &pCachePriv->Current128;
- } else {
- cacheRoot = pCachePriv->InfoPartial;
- max = pCachePriv->NumPartial;
- current = &pCachePriv->CurrentPartial;
- }
- } else if(size <= 256) {
- cacheRoot = pCachePriv->Info256;
- max = pCachePriv->Num256x256;
- current = &pCachePriv->Current256;
- } else if(size <= 512) {
- cacheRoot = pCachePriv->Info512;
- max = pCachePriv->Num512x512;
- current = &pCachePriv->Current512;
- } else { /* something's wrong */
- ErrorF("Something's wrong in XAACacheStipple()\n");
- return pCachePriv->Info128;
- }
-
- pCache = cacheRoot;
- /* lets look for it */
- if(bg == -1)
- for(i = 0; i < max; i++, pCache++) {
- if((pCache->serialNumber == pPix->drawable.serialNumber) &&
- (fg == pCache->fg) && (pCache->fg != pCache->bg)) {
- pCache->trans_color = pCache->bg;
- return pCache;
- }
- }
- else
- for(i = 0; i < max; i++, pCache++) {
- if((pCache->serialNumber == pPix->drawable.serialNumber) &&
- (fg == pCache->fg) && (bg == pCache->bg)) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
-
- pCache = &cacheRoot[(*current)++];
- if(*current >= max) *current = 0;
-
- pCache->serialNumber = pPix->drawable.serialNumber;
- pCache->fg = fg;
- if(bg == -1)
- pCache->trans_color = bg = fg ^ 1;
- else
- pCache->trans_color = -1;
- pCache->bg = bg;
-
- pCache->orig_w = w; pCache->orig_h = h;
- (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
- pPix->drawable.width, pPix->drawable.height, pPix->devPrivate.ptr,
- pPix->devKind, fg, bg);
- if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
- ((w != pCache->w) || (h != pCache->h)))
- XAATileCache(pScrn, pCache, w, h);
-
- return pCache;
-}
-
-
-
-XAACacheInfoPtr
-XAACacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0, int pat1)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache = pCachePriv->InfoMono;
- int i;
-
- for(i = 0; i < pCachePriv->NumMono; i++, pCache++) {
- if(pCache->serialNumber &&
- (pCache->pat0 == pat0) && (pCache->pat1 == pat1))
- return pCache;
- }
-
- /* OK, let's cache it */
- pCache = &pCachePriv->InfoMono[pCachePriv->CurrentMono++];
- if(pCachePriv->CurrentMono >= pCachePriv->NumMono)
- pCachePriv->CurrentMono = 0;
-
- pCache->serialNumber = 1; /* we don't care since we do lookups by pattern */
- pCache->pat0 = pat0;
- pCache->pat1 = pat1;
-
- (*infoRec->WriteMono8x8PatternToCache)(pScrn, pCache);
-
- return pCache;
-}
-
-
-
-XAACacheInfoPtr
-XAACacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache = pCachePriv->InfoColor;
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- int i;
-
- if(!(pixPriv->flags & REDUCIBLE_TO_2_COLOR)) {
- for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
- if(pCache->serialNumber == pPix->drawable.serialNumber) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
- pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
- if(pCachePriv->CurrentColor >= pCachePriv->NumColor)
- pCachePriv->CurrentColor = 0;
-
- pCache->serialNumber = pPix->drawable.serialNumber;
- pCache->trans_color = pCache->fg = pCache->bg = -1;
- } else {
- int pat0 = pixPriv->pattern0;
- int pat1 = pixPriv->pattern1;
-
- if(fg == -1) { /* it's a tile */
- fg = pixPriv->fg; bg = pixPriv->bg;
- }
-
- if(bg == -1) { /* stipple */
- for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
- if(pCache->serialNumber &&
- (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
- (pCache->fg == fg) && (pCache->bg != fg)) {
- pCache->trans_color = pCache->bg;
- return pCache;
- }
- }
- } else { /* opaque stipple */
- for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
- if(pCache->serialNumber &&
- (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
- (pCache->fg == fg) && (pCache->bg == bg)) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
- }
- pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
- if(pCachePriv->CurrentColor >= pCachePriv->NumColor)
- pCachePriv->CurrentColor = 0;
-
- if(bg == -1)
- pCache->trans_color = bg = fg ^ 1;
- else
- pCache->trans_color = -1;
-
- pCache->pat0 = pat0; pCache->pat1 = pat1;
- pCache->fg = fg; pCache->bg = bg;
- pCache->serialNumber = 1;
- }
-
- (*infoRec->WriteColor8x8PatternToCache)(pScrn, pPix, pCache);
-
- return pCache;
-}
-
-
-void
-XAAWriteBitmapToCache(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int fg, int bg
-) {
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->WriteBitmap)(pScrn, x, y, w, h, src, srcwidth,
- 0, fg, bg, GXcopy, ~0);
-}
-
-void
-XAAWriteBitmapToCacheLinear(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int fg, int bg
-){
- ScreenPtr pScreen = pScrn->pScreen;
- PixmapPtr pScreenPix, pDstPix;
- ChangeGCVal gcvals[2];
- GCPtr pGC;
-
- pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
-
- pDstPix = GetScratchPixmapHeader(pScreen, pScreenPix->drawable.width,
- y + h, pScreenPix->drawable.depth,
- pScreenPix->drawable.bitsPerPixel,
- pScreenPix->devKind,
- pScreenPix->devPrivate.ptr);
-
- pGC = GetScratchGC(pScreenPix->drawable.depth, pScreen);
- gcvals[0].val = fg;
- gcvals[1].val = bg;
- ChangeGC(NullClient, pGC, GCForeground | GCBackground, gcvals);
- ValidateGC((DrawablePtr)pDstPix, pGC);
-
- /* We've unwrapped already so these ops miss a sync */
- SYNC_CHECK(pScrn);
-
- (*pGC->ops->PutImage)((DrawablePtr)pDstPix, pGC, 1, x, y, w, h, 0,
- XYBitmap, (pointer)src);
-
- FreeScratchGC(pGC);
- FreeScratchPixmapHeader(pDstPix);
-}
-
-
-void
-XAAWritePixmapToCache(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int bpp, int depth
-) {
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->WritePixmap)(pScrn, x, y, w, h, src, srcwidth,
- GXcopy, ~0, -1, bpp, depth);
-}
-
-
-
-void
-XAAWritePixmapToCacheLinear(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int bpp, int depth
-){
- ScreenPtr pScreen = pScrn->pScreen;
- PixmapPtr pScreenPix, pDstPix;
- GCPtr pGC;
-
- pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
-
- pDstPix = GetScratchPixmapHeader(pScreen, x + w, y + h,
- depth, bpp, pScreenPix->devKind,
- pScreenPix->devPrivate.ptr);
-
- pGC = GetScratchGC(depth, pScreen);
- ValidateGC((DrawablePtr)pDstPix, pGC);
-
- /* We've unwrapped already so these ops miss a sync */
- SYNC_CHECK(pScrn);
-
- if(bpp == BitsPerPixel(depth))
- (*pGC->ops->PutImage)((DrawablePtr)pDstPix, pGC, depth, x, y, w,
- h, 0, ZPixmap, (pointer)src);
- else {
- PixmapPtr pSrcPix;
-
- pSrcPix = GetScratchPixmapHeader(pScreen, w, h, depth, bpp,
- srcwidth, (pointer)src);
-
- (*pGC->ops->CopyArea)((DrawablePtr)pSrcPix, (DrawablePtr)pDstPix,
- pGC, 0, 0, w, h, x, y);
-
- FreeScratchPixmapHeader(pSrcPix);
- }
-
- FreeScratchGC(pGC);
- FreeScratchPixmapHeader(pDstPix);
-}
-
-
-void
-XAAWriteMono8x8PatternToCache(
- ScrnInfoPtr pScrn,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- unsigned char *data;
- int pad, Bpp = (pScrn->bitsPerPixel >> 3);
-
- pCache->offsets = pCachePriv->MonoOffsets;
-
- pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
-
- data = (unsigned char*)malloc(pad * pCache->h);
- if(!data) return;
-
- if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
- CARD32* ptr = (CARD32*)data;
- ptr[0] = pCache->pat0; ptr[1] = pCache->pat1;
- } else {
- CARD32 *ptr;
- DDXPointPtr pPoint = pCache->offsets;
- int patx, paty, i;
-
- for(i = 0; i < 64; i++, pPoint++) {
- patx = pCache->pat0; paty = pCache->pat1;
- XAARotateMonoPattern(&patx, &paty, i & 0x07, i >> 3,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- ptr = (CARD32*)(data + (pad * pPoint->y) + (Bpp * pPoint->x));
- ptr[0] = patx; ptr[1] = paty;
- }
- }
-
- (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y,
- pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
-
- free(data);
-}
-
-void
-XAAWriteColor8x8PatternToCache(
- ScrnInfoPtr pScrn,
- PixmapPtr pPix,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- int pad, i, w, h, nw, nh, Bpp;
- unsigned char *data, *srcPtr, *dstPtr;
-
- pCache->offsets = pCachePriv->ColorOffsets;
-
- if(pixPriv->flags & REDUCIBLE_TO_2_COLOR) {
- CARD32* ptr;
- pad = BitmapBytePad(pCache->w);
- data = (unsigned char*)malloc(pad * pCache->h);
- if(!data) return;
-
- if(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
- ptr = (CARD32*)data;
- ptr[0] = pCache->pat0; ptr[1] = pCache->pat1;
- } else {
- int patx, paty;
-
- ptr = (CARD32*)data;
- ptr[0] = ptr[2] = pCache->pat0; ptr[1] = ptr[3] = pCache->pat1;
- for(i = 1; i < 8; i++) {
- patx = pCache->pat0; paty = pCache->pat1;
- XAARotateMonoPattern(&patx, &paty, i, 0,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- ptr = (CARD32*)(data + (pad * i));
- ptr[0] = ptr[2] = patx; ptr[1] = ptr[3] = paty;
- }
- }
-
- (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
- pCache->w, pCache->h, data, pad, pCache->fg, pCache->bg);
-
- free(data);
- return;
- }
-
- Bpp = pScrn->bitsPerPixel >> 3;
- h = min(8,pPix->drawable.height);
- w = min(8,pPix->drawable.width);
- pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
-
- data = (unsigned char*)malloc(pad * pCache->h);
- if(!data) return;
-
- /* Write and expand horizontally. */
- for (i = h, dstPtr = data, srcPtr = pPix->devPrivate.ptr; i--;
- srcPtr += pPix->devKind, dstPtr += pScrn->bitsPerPixel) {
- nw = w;
- memcpy(dstPtr, srcPtr, w * Bpp);
- while (nw != 8) {
- memcpy(dstPtr + (nw * Bpp), dstPtr, nw * Bpp);
- nw <<= 1;
- }
- }
- nh = h;
- /* Expand vertically. */
- while (nh != 8) {
- memcpy(data + (nh*pScrn->bitsPerPixel), data, nh*pScrn->bitsPerPixel);
- nh <<= 1;
- }
-
- if(!(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- int j;
- unsigned char *ptr = data + (128 * Bpp);
-
- memcpy(data + (64 * Bpp), data, 64 * Bpp);
- for(i = 1; i < 8; i++, ptr += (128 * Bpp)) {
- for(j = 0; j < 8; j++) {
- memcpy(ptr + (j * 8) * Bpp, data + (j * 8 + i) * Bpp,
- (8 - i) * Bpp);
- memcpy(ptr + (j * 8 + 8 - i) * Bpp, data + j * 8 * Bpp, i*Bpp);
- }
- memcpy(ptr + (64 * Bpp), ptr, 64 * Bpp);
- }
- }
-
- (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y,
- pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
-
- free(data);
-}
-
-
-
-int
-XAAStippledFillChooser(GCPtr pGC)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- PixmapPtr pPixmap = pGC->stipple;
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
-
- if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
- (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
- XAACheckStippleReducibility(pPixmap);
- }
-
-
- if(pPriv->flags & REDUCIBLE_TO_8x8) {
- if(infoRec->CanDoMono8x8 &&
- !(infoRec->FillMono8x8PatternSpansFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->FillMono8x8PatternSpansFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_FG(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
-
- return DO_MONO_8x8;
- }
-
- if(infoRec->CanDoColor8x8 &&
- !(infoRec->FillColor8x8PatternSpansFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->FillColor8x8PatternSpansFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
-
- return DO_COLOR_8x8;
- }
- }
-
- if(infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
- (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
- (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
- infoRec->CacheColorExpandDensity) &&
- !(infoRec->FillCacheExpandSpansFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->FillCacheExpandSpansFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_ROP(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_FG(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheExpandSpansFlags)) {
-
- return DO_CACHE_EXPAND;
- }
-
-
- if(infoRec->UsingPixmapCache &&
- !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
- infoRec->FillCacheBltSpans &&
- (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
- (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
- !(infoRec->FillCacheBltSpansFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->FillCacheBltSpansFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
-
- return DO_CACHE_BLT;
- }
-
- if(infoRec->FillColorExpandSpans &&
- !(infoRec->FillColorExpandSpansFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->FillColorExpandSpansFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_ROP(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_FG(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillColorExpandSpansFlags)) {
-
- return DO_COLOR_EXPAND;
- }
-
- return 0;
-}
-
-
-int
-XAAOpaqueStippledFillChooser(GCPtr pGC)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- PixmapPtr pPixmap = pGC->stipple;
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
-
- if(XAA_DEPTH_BUG(pGC))
- return 0;
-
- if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
- (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
- XAACheckStippleReducibility(pPixmap);
- }
-
- if(pPriv->flags & REDUCIBLE_TO_8x8) {
- if(infoRec->CanDoMono8x8 &&
- !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
- CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_COLORS(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
-
- return DO_MONO_8x8;
- }
-
- if(infoRec->CanDoColor8x8 &&
- CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
-
- return DO_COLOR_8x8;
- }
- }
-
- if(infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
- (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
- (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
- infoRec->CacheColorExpandDensity) &&
- !(infoRec->FillCacheExpandSpansFlags & TRANSPARENCY_ONLY) &&
- CHECK_ROP(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_COLORS(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheExpandSpansFlags)) {
-
- return DO_CACHE_EXPAND;
- }
-
- if(infoRec->UsingPixmapCache &&
- !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
- infoRec->FillCacheBltSpans &&
- (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
- (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
- CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
-
- return DO_CACHE_BLT;
- }
-
- if(infoRec->FillColorExpandSpans &&
- !(infoRec->FillColorExpandSpansFlags & TRANSPARENCY_ONLY) &&
- CHECK_ROP(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_COLORS(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillColorExpandSpansFlags)) {
-
- return DO_COLOR_EXPAND;
- }
-
- return 0;
-}
-
-
-
-int
-XAATiledFillChooser(GCPtr pGC)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- PixmapPtr pPixmap = pGC->tile.pixmap;
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
-
- if(IS_OFFSCREEN_PIXMAP(pPixmap) && infoRec->FillCacheBltSpans &&
- CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
-
- return DO_PIXMAP_COPY;
- }
-
- if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
- (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
- XAACheckTileReducibility(pPixmap,infoRec->CanDoMono8x8);
- }
-
- if(pPriv->flags & REDUCIBLE_TO_8x8) {
- if((pPriv->flags & REDUCIBLE_TO_2_COLOR) && infoRec->CanDoMono8x8 &&
- !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
- CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- (!(infoRec->FillMono8x8PatternSpansFlags & RGB_EQUAL) ||
- (CHECK_RGB_EQUAL(pPriv->fg) && CHECK_RGB_EQUAL(pPriv->bg))) &&
- CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
-
- return DO_MONO_8x8;
- }
-
- if(infoRec->CanDoColor8x8 &&
- CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
-
- return DO_COLOR_8x8;
- }
- }
-
- if(infoRec->UsingPixmapCache && infoRec->FillCacheBltSpans &&
- (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
- (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
- CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
-
- return DO_CACHE_BLT;
- }
-
- if(infoRec->FillImageWriteRects &&
- CHECK_NO_GXCOPY(pGC,infoRec->FillImageWriteRectsFlags) &&
- CHECK_ROP(pGC,infoRec->FillImageWriteRectsFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillImageWriteRectsFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillImageWriteRectsFlags)) {
-
- return DO_IMAGE_WRITE;
- }
-
- return 0;
-}
-
-
-static int RotateMasksX[8] = {
- 0xFFFFFFFF, 0x7F7F7F7F, 0x3F3F3F3F, 0x1F1F1F1F,
- 0x0F0F0F0F, 0x07070707, 0x03030303, 0x01010101
-};
-
-static int RotateMasksY[4] = {
- 0xFFFFFFFF, 0x00FFFFFF, 0x0000FFFF, 0x000000FF
-};
-
-void
-XAARotateMonoPattern(
- int *pat0, int *pat1,
- int xorg, int yorg,
- Bool msbfirst
-){
- int tmp, mask;
-
- if(xorg) {
- if(msbfirst) xorg = 8 - xorg;
- mask = RotateMasksX[xorg];
- *pat0 = ((*pat0 >> xorg) & mask) | ((*pat0 << (8 - xorg)) & ~mask);
- *pat1 = ((*pat1 >> xorg) & mask) | ((*pat1 << (8 - xorg)) & ~mask);
- }
- if(yorg >= 4) {
- tmp = *pat0; *pat0 = *pat1; *pat1 = tmp;
- yorg -= 4;
- }
- if(yorg) {
- mask = RotateMasksY[yorg];
- yorg <<= 3;
- tmp = *pat0;
- *pat0 = ((*pat0 >> yorg) & mask) | ((*pat1 << (32 - yorg)) & ~mask);
- *pat1 = ((*pat1 >> yorg) & mask) | ((tmp << (32 - yorg)) & ~mask);
- }
-}
-
-
-
-void
-XAAInvalidatePixmapCache(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- int i;
-
- if(!pCachePriv) return;
-
- for(i = 0; i < pCachePriv->Num512x512; i++)
- (pCachePriv->Info512)[i].serialNumber = 0;
- for(i = 0; i < pCachePriv->Num256x256; i++)
- (pCachePriv->Info256)[i].serialNumber = 0;
- for(i = 0; i < pCachePriv->Num128x128; i++)
- (pCachePriv->Info128)[i].serialNumber = 0;
- for(i = 0; i < pCachePriv->NumPartial; i++)
- (pCachePriv->InfoPartial)[i].serialNumber = 0;
- for(i = 0; i < pCachePriv->NumMono; i++)
- (pCachePriv->InfoMono)[i].serialNumber = 0;
- for(i = 0; i < pCachePriv->NumColor; i++)
- (pCachePriv->InfoColor)[i].serialNumber = 0;
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "gc.h"
+#include "mi.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "regionstr.h"
+#include "servermd.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaacexp.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+
+#define MAX_COLOR 32
+#define MAX_MONO 32
+#define MAX_8 32
+#define MAX_128 32
+#define MAX_256 32
+#define MAX_512 16
+
+static int CacheInitIndex = -1;
+
+#define CACHEINIT(p) ((p)->privates[CacheInitIndex].val)
+
+typedef struct _CacheLink {
+ int x;
+ int y;
+ int w;
+ int h;
+ struct _CacheLink *next;
+} CacheLink, *CacheLinkPtr;
+
+static void
+TransferList(CacheLinkPtr list, XAACacheInfoPtr array, int num)
+{
+ while (num--) {
+ array->x = list->x;
+ array->y = list->y;
+ array->w = list->w;
+ array->h = list->h;
+ array->serialNumber = 0;
+ array->fg = array->bg = -1;
+ list = list->next;
+ array++;
+ }
+}
+
+static CacheLinkPtr
+Enlist(CacheLinkPtr link, int x, int y, int w, int h)
+{
+ CacheLinkPtr newLink;
+
+ newLink = malloc(sizeof(CacheLink));
+ newLink->next = link;
+ newLink->x = x;
+ newLink->y = y;
+ newLink->w = w;
+ newLink->h = h;
+ return newLink;
+}
+
+static CacheLinkPtr
+Delist(CacheLinkPtr link)
+{
+ CacheLinkPtr ret = NULL;
+
+ if (link) {
+ ret = link->next;
+ free(link);
+ }
+ return ret;
+}
+
+static void
+FreeList(CacheLinkPtr link)
+{
+ CacheLinkPtr tmp;
+
+ while (link) {
+ tmp = link;
+ link = link->next;
+ free(tmp);
+ }
+}
+
+static CacheLinkPtr
+QuadLinks(CacheLinkPtr big, CacheLinkPtr little)
+{
+ /* CAUTION: This doesn't free big */
+ int w1, w2, h1, h2;
+
+ while (big) {
+ w1 = big->w >> 1;
+ w2 = big->w - w1;
+ h1 = big->h >> 1;
+ h2 = big->h - h1;
+
+ little = Enlist(little, big->x, big->y, w1, h1);
+ little = Enlist(little, big->x + w1, big->y, w2, h1);
+ little = Enlist(little, big->x, big->y + h1, w1, h2);
+ little = Enlist(little, big->x + w1, big->y + h1, w2, h2);
+
+ big = big->next;
+ }
+ return little;
+}
+
+static void
+SubdivideList(CacheLinkPtr * large, CacheLinkPtr * small)
+{
+ CacheLinkPtr big = *large;
+ CacheLinkPtr little = *small;
+ int size = big->w >> 1;
+
+ little = Enlist(little, big->x, big->y, size, size);
+ little = Enlist(little, big->x + size, big->y, size, size);
+ little = Enlist(little, big->x, big->y + size, size, size);
+ little = Enlist(little, big->x + size, big->y + size, size, size);
+ *small = little;
+ big = Delist(big);
+ *large = big;
+}
+
+static void
+FreePixmapCachePrivate(XAAPixmapCachePrivatePtr pPriv)
+{
+ if (!pPriv)
+ return;
+
+ free(pPriv->Info512);
+ free(pPriv->Info256);
+ free(pPriv->Info128);
+ free(pPriv->InfoColor);
+ free(pPriv->InfoMono);
+ free(pPriv->InfoPartial);
+
+ free(pPriv);
+}
+
+void
+XAAClosePixmapCache(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ if (infoRec->PixmapCachePrivate)
+ FreePixmapCachePrivate((XAAPixmapCachePrivatePtr) infoRec->
+ PixmapCachePrivate);
+
+ infoRec->PixmapCachePrivate = NULL;
+}
+
+static CacheLinkPtr
+ThinOutPartials(CacheLinkPtr ListPartial, int *num, int *maxw, int *maxh)
+{
+/* This guy's job is to get at least 4 big slots out of a list of fragments */
+
+ CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
+ int Num64, Num32, Num16, Num8, NumKeepers;
+ int w, h;
+
+ List64 = List32 = List16 = List8 = ListKeepers = NULL;
+ Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
+ w = h = 0;
+
+ /* We sort partials by how large a square tile they can cache.
+ If a partial can't store a 64x64, 32x32, 16x16 or 8x8 tile,
+ we free it. */
+
+ pCur = ListPartial;
+ while (pCur) {
+ next = pCur->next;
+ if ((pCur->w >= 64) && (pCur->h >= 64)) {
+ pCur->next = List64;
+ List64 = pCur;
+ Num64++;
+ }
+ else if ((pCur->w >= 32) && (pCur->h >= 32)) {
+ pCur->next = List32;
+ List32 = pCur;
+ Num32++;
+ }
+ else if ((pCur->w >= 16) && (pCur->h >= 16)) {
+ pCur->next = List16;
+ List16 = pCur;
+ Num16++;
+ }
+ else if ((pCur->w >= 8) && (pCur->h >= 8)) {
+ pCur->next = List8;
+ List8 = pCur;
+ Num8++;
+ }
+ else {
+ free(pCur);
+ }
+
+ pCur = next;
+ }
+
+ /* We save all the tiles from the largest bin that we can get
+ at least 4 of. If there are too few of a bigger slot, we
+ cut it in fourths to make smaller slots. */
+
+ if (Num64 >= 4) {
+ ListKeepers = List64;
+ List64 = NULL;
+ NumKeepers = Num64;
+ goto GOT_EM;
+ }
+ else if (Num64) {
+ List32 = QuadLinks(List64, List32);
+ Num32 += Num64 * 4;
+ Num64 = 0;
+ }
+
+ if (Num32 >= 4) {
+ ListKeepers = List32;
+ List32 = NULL;
+ NumKeepers = Num32;
+ goto GOT_EM;
+ }
+ else if (Num32) {
+ List16 = QuadLinks(List32, List16);
+ Num16 += Num32 * 4;
+ Num32 = 0;
+ }
+
+ if (Num16 >= 4) {
+ ListKeepers = List16;
+ List16 = NULL;
+ NumKeepers = Num16;
+ goto GOT_EM;
+ }
+ else if (Num16) {
+ List8 = QuadLinks(List16, List8);
+ Num8 += Num16 * 4;
+ Num16 = 0;
+ }
+
+ if (Num8 >= 4) {
+ ListKeepers = List8;
+ List8 = NULL;
+ NumKeepers = Num8;
+ goto GOT_EM;
+ }
+
+ GOT_EM:
+
+ /* Free the ones we aren't using */
+
+ if (List64)
+ FreeList(List64);
+ if (List32)
+ FreeList(List32);
+ if (List16)
+ FreeList(List16);
+ if (List8)
+ FreeList(List8);
+
+ /* Enlarge the slots if we can */
+
+ if (ListKeepers) {
+ CacheLinkPtr pLink = ListKeepers;
+
+ w = h = 128;
+
+ while (pLink) {
+ if (pLink->w < w)
+ w = pLink->w;
+ if (pLink->h < h)
+ h = pLink->h;
+ pLink = pLink->next;
+ }
+ }
+
+ *maxw = w;
+ *maxh = h;
+ *num = NumKeepers;
+ return ListKeepers;
+}
+
+static void
+ConvertColorToMono(CacheLinkPtr * ColorList,
+ int ColorW, int ColorH,
+ CacheLinkPtr * MonoList, int MonoW, int MonoH)
+{
+ int x, y, w;
+
+ x = (*ColorList)->x;
+ y = (*ColorList)->y;
+ *ColorList = Delist(*ColorList);
+
+ while (ColorH) {
+ ColorH -= MonoH;
+ for (w = 0; w <= (ColorW - MonoW); w += MonoW)
+ *MonoList = Enlist(*MonoList, x + w, y + ColorH, MonoW, MonoH);
+ }
+}
+
+static void
+ConvertAllPartialsTo8x8(int *NumMono, int *NumColor,
+ CacheLinkPtr ListPartial,
+ CacheLinkPtr * ListMono,
+ CacheLinkPtr * ListColor, XAAInfoRecPtr infoRec)
+{
+/* This guy extracts as many 8x8 slots as it can out of fragments */
+
+ int ColorH = infoRec->CacheHeightColor8x8Pattern;
+ int ColorW = infoRec->CacheWidthColor8x8Pattern;
+ int MonoH = infoRec->CacheHeightMono8x8Pattern;
+ int MonoW = infoRec->CacheWidthMono8x8Pattern;
+ int x, y, w, Height, Width;
+ Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
+ Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
+ CacheLinkPtr pLink = ListPartial;
+ CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
+
+ if (DoColor && DoMono) {
+ /* we assume color patterns take more space than color ones */
+ if (MonoH > ColorH)
+ ColorH = MonoH;
+ if (MonoW > ColorW)
+ ColorW = MonoW;
+ }
+
+ /* Break up the area into as many Color and Mono slots as we can */
+
+ while (pLink) {
+ Height = pLink->h;
+ Width = pLink->w;
+ x = pLink->x;
+ y = pLink->y;
+
+ if (DoColor) {
+ while (Height >= ColorH) {
+ Height -= ColorH;
+ for (w = 0; w <= (Width - ColorW); w += ColorW) {
+ ColorList =
+ Enlist(ColorList, x + w, y + Height, ColorW, ColorH);
+ (*NumColor)++;
+ }
+ }
+ }
+
+ if (DoMono && (Height >= MonoH)) {
+ while (Height >= MonoH) {
+ Height -= MonoH;
+ for (w = 0; w <= (Width - MonoW); w += MonoW) {
+ MonoList =
+ Enlist(MonoList, x + w, y + Height, MonoW, MonoH);
+ (*NumMono)++;
+ }
+ }
+ }
+
+ pLink = pLink->next;
+ }
+
+ *ListMono = MonoList;
+ *ListColor = ColorList;
+ FreeList(ListPartial);
+}
+
+static CacheLinkPtr
+ExtractOneThatFits(CacheLinkPtr * initList, int w, int h)
+{
+ CacheLinkPtr list = *initList;
+ CacheLinkPtr prev = NULL;
+
+ while (list) {
+ if ((list->w >= w) && (list->h >= h))
+ break;
+ prev = list;
+ list = list->next;
+ }
+
+ if (list) {
+ if (prev)
+ prev->next = list->next;
+ else
+ *initList = list->next;
+
+ list->next = NULL;
+ }
+
+ return list;
+}
+
+static CacheLinkPtr
+ConvertSomePartialsTo8x8(int *NumMono, int *NumColor, int *NumPartial,
+ CacheLinkPtr ListPartial,
+ CacheLinkPtr * ListMono,
+ CacheLinkPtr * ListColor,
+ int *maxw, int *maxh, XAAInfoRecPtr infoRec)
+{
+/* This guy tries to get 4 of each type of 8x8 slot requested out of
+ a list of fragments all while trying to retain some big fragments
+ for the cache blits */
+
+ int ColorH = infoRec->CacheHeightColor8x8Pattern;
+ int ColorW = infoRec->CacheWidthColor8x8Pattern;
+ int MonoH = infoRec->CacheHeightMono8x8Pattern;
+ int MonoW = infoRec->CacheWidthMono8x8Pattern;
+ Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
+ Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
+ CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
+ CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
+ int Num64, Num32, Num16, Num8, NumKeepers;
+ int w, h, Width, Height;
+ int MonosPerColor = 1;
+
+ if (DoColor && DoMono) {
+ /* we assume color patterns take more space than color ones */
+ if (MonoH > ColorH)
+ ColorH = MonoH;
+ if (MonoW > ColorW)
+ ColorW = MonoW;
+ MonosPerColor = (ColorH / MonoH) * (ColorW / MonoW);
+ }
+
+ List64 = List32 = List16 = List8 = ListKeepers = MonoList = ColorList =
+ NULL;
+ Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
+ Width = Height = 0;
+
+ /* We sort partials by how large a square tile they can cache.
+ We make 8x8 patterns from the leftovers if we can. */
+
+ pCur = ListPartial;
+ while (pCur) {
+ next = pCur->next;
+ if ((pCur->w >= 64) && (pCur->h >= 64)) {
+ pCur->next = List64;
+ List64 = pCur;
+ Num64++;
+ }
+ else if ((pCur->w >= 32) && (pCur->h >= 32)) {
+ pCur->next = List32;
+ List32 = pCur;
+ Num32++;
+ }
+ else if ((pCur->w >= 16) && (pCur->h >= 16)) {
+ pCur->next = List16;
+ List16 = pCur;
+ Num16++;
+ }
+ else if ((pCur->w >= 8) && (pCur->h >= 8)) {
+ pCur->next = List8;
+ List8 = pCur;
+ Num8++;
+ }
+ else {
+ h = pCur->h;
+ if (DoColor && (pCur->w >= ColorW) && (h >= ColorH)) {
+ while (h >= ColorH) {
+ h -= ColorH;
+ for (w = 0; w <= (pCur->w - ColorW); w += ColorW) {
+ ColorList = Enlist(ColorList,
+ pCur->x + w, pCur->y + h, ColorW,
+ ColorH);
+ (*NumColor)++;
+ }
+ }
+ }
+ if (DoMono && (pCur->w >= MonoW) && (h >= MonoH)) {
+ while (h >= MonoH) {
+ h -= MonoH;
+ for (w = 0; w <= (pCur->w - MonoW); w += MonoW) {
+ MonoList = Enlist(MonoList,
+ pCur->x + w, pCur->y + h, MonoW,
+ MonoH);
+ (*NumMono)++;
+ }
+ }
+ }
+ free(pCur);
+ }
+
+ pCur = next;
+ }
+
+ /* Try to extract at least 4 of each type of 8x8 slot that we need */
+
+ if (DoColor) {
+ CacheLinkPtr theOne;
+
+ while (*NumColor < 4) {
+ theOne = NULL;
+ if (Num8) {
+ if ((theOne = ExtractOneThatFits(&List8, ColorW, ColorH)))
+ Num8--;
+ }
+ if (Num16 && !theOne) {
+ if ((theOne = ExtractOneThatFits(&List16, ColorW, ColorH)))
+ Num16--;
+ }
+ if (Num32 && !theOne) {
+ if ((theOne = ExtractOneThatFits(&List32, ColorW, ColorH)))
+ Num32--;
+ }
+ if (Num64 && !theOne) {
+ if ((theOne = ExtractOneThatFits(&List64, ColorW, ColorH)))
+ Num64--;
+ }
+
+ if (!theOne)
+ break;
+
+ ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
+ &MonoList, &ColorList, infoRec);
+
+ if (DoMono) {
+ while (*NumColor && (*NumMono < 4)) {
+ ConvertColorToMono(&ColorList, ColorW, ColorH,
+ &MonoList, MonoW, MonoH);
+ (*NumColor)--;
+ *NumMono += MonosPerColor;
+ }
+ }
+ }
+ }
+
+ if (DoMono) {
+ CacheLinkPtr theOne;
+
+ while (*NumMono < 4) {
+ theOne = NULL;
+ if (Num8) {
+ if ((theOne = ExtractOneThatFits(&List8, MonoW, MonoH)))
+ Num8--;
+ }
+ if (Num16 && !theOne) {
+ if ((theOne = ExtractOneThatFits(&List16, MonoW, MonoH)))
+ Num16--;
+ }
+ if (Num32 && !theOne) {
+ if ((theOne = ExtractOneThatFits(&List32, MonoW, MonoH)))
+ Num32--;
+ }
+ if (Num64 && !theOne) {
+ if ((theOne = ExtractOneThatFits(&List64, MonoW, MonoH)))
+ Num64--;
+ }
+
+ if (!theOne)
+ break;
+
+ ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
+ &MonoList, &ColorList, infoRec);
+ }
+ }
+
+ /* We save all the tiles from the largest bin that we can get
+ at least 4 of. If there are too few of a bigger slot, we
+ cut it in fourths to make smaller slots. */
+
+ if (Num64 >= 4) {
+ ListKeepers = List64;
+ List64 = NULL;
+ NumKeepers = Num64;
+ goto GOT_EM;
+ }
+ else if (Num64) {
+ List32 = QuadLinks(List64, List32);
+ Num32 += Num64 * 4;
+ Num64 = 0;
+ }
+
+ if (Num32 >= 4) {
+ ListKeepers = List32;
+ List32 = NULL;
+ NumKeepers = Num32;
+ goto GOT_EM;
+ }
+ else if (Num32) {
+ List16 = QuadLinks(List32, List16);
+ Num16 += Num32 * 4;
+ Num32 = 0;
+ }
+
+ if (Num16 >= 4) {
+ ListKeepers = List16;
+ List16 = NULL;
+ NumKeepers = Num16;
+ goto GOT_EM;
+ }
+ else if (Num16) {
+ List8 = QuadLinks(List16, List8);
+ Num8 += Num16 * 4;
+ Num16 = 0;
+ }
+
+ if (Num8 >= 4) {
+ ListKeepers = List8;
+ List8 = NULL;
+ NumKeepers = Num8;
+ goto GOT_EM;
+ }
+
+ GOT_EM:
+
+ /* Free the ones we aren't using */
+
+ if (List64)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List64,
+ &MonoList, &ColorList, infoRec);
+ if (List32)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List32,
+ &MonoList, &ColorList, infoRec);
+ if (List16)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List16,
+ &MonoList, &ColorList, infoRec);
+ if (List8)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List8,
+ &MonoList, &ColorList, infoRec);
+
+ /* Enlarge the slots if we can */
+
+ if (ListKeepers) {
+ CacheLinkPtr pLink = ListKeepers;
+
+ Width = Height = 128;
+
+ while (pLink) {
+ if (pLink->w < Width)
+ Width = pLink->w;
+ if (pLink->h < Height)
+ Height = pLink->h;
+ pLink = pLink->next;
+ }
+ }
+
+ *ListMono = MonoList;
+ *ListColor = ColorList;
+ *maxw = Width;
+ *maxh = Height;
+ *NumPartial = NumKeepers;
+ return ListKeepers;
+}
+
+void
+XAAInitPixmapCache(ScreenPtr pScreen, RegionPtr areas, pointer data)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAInfoRecPtr infoRec = (XAAInfoRecPtr) data;
+ XAAPixmapCachePrivatePtr pCachePriv;
+ BoxPtr pBox = RegionRects(areas);
+ int nBox = RegionNumRects(areas);
+ int Num512, Num256, Num128, NumPartial, NumColor, NumMono;
+ int Target512, Target256;
+ CacheLinkPtr List512, List256, List128, ListPartial, ListColor, ListMono;
+ int x, y, w, h, ntotal, granularity, width, height, i;
+ int MaxPartialWidth, MaxPartialHeight;
+
+ infoRec->MaxCacheableTileWidth = 0;
+ infoRec->MaxCacheableTileHeight = 0;
+ infoRec->MaxCacheableStippleHeight = 0;
+ infoRec->MaxCacheableStippleWidth = 0;
+ infoRec->UsingPixmapCache = FALSE;
+
+ if (!nBox || !pBox || !(infoRec->Flags & PIXMAP_CACHE))
+ return;
+
+ /* Allocate a persistent per-screen init flag to control messages */
+ if (CacheInitIndex < 0)
+ CacheInitIndex = xf86AllocateScrnInfoPrivateIndex();
+
+ /* free the old private data if it exists */
+ if (infoRec->PixmapCachePrivate) {
+ FreePixmapCachePrivate((XAAPixmapCachePrivatePtr) infoRec->
+ PixmapCachePrivate);
+ infoRec->PixmapCachePrivate = NULL;
+ }
+
+ Num512 = Num256 = Num128 = NumPartial = NumMono = NumColor = 0;
+ List512 = List256 = List128 = ListPartial = ListMono = ListColor = NULL;
+ granularity = infoRec->CachePixelGranularity;
+ if (granularity <= 1)
+ granularity = 0;
+
+ /* go through the boxes and break it into as many pieces as we can fit */
+
+ while (nBox--) {
+ x = pBox->x1;
+ if (granularity) {
+ int tmp = x % granularity;
+
+ if (tmp)
+ x += (granularity - tmp);
+ }
+ width = pBox->x2 - x;
+ if (width <= 0) {
+ pBox++;
+ continue;
+ }
+
+ y = pBox->y1;
+ height = pBox->y2 - y;
+
+ for (h = 0; h <= (height - 512); h += 512) {
+ for (w = 0; w <= (width - 512); w += 512) {
+ List512 = Enlist(List512, x + w, y + h, 512, 512);
+ Num512++;
+ }
+ for (; w <= (width - 256); w += 256) {
+ List256 = Enlist(List256, x + w, y + h, 256, 256);
+ List256 = Enlist(List256, x + w, y + h + 256, 256, 256);
+ Num256 += 2;
+ }
+ for (; w <= (width - 128); w += 128) {
+ List128 = Enlist(List128, x + w, y + h, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 256, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 384, 128, 128);
+ Num128 += 4;
+ }
+ if (w < width) {
+ int d = width - w;
+
+ ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 256, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 384, d, 128);
+ NumPartial += 4;
+ }
+ }
+ for (; h <= (height - 256); h += 256) {
+ for (w = 0; w <= (width - 256); w += 256) {
+ List256 = Enlist(List256, x + w, y + h, 256, 256);
+ Num256++;
+ }
+ for (; w <= (width - 128); w += 128) {
+ List128 = Enlist(List128, x + w, y + h, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
+ Num128 += 2;
+ }
+ if (w < width) {
+ int d = width - w;
+
+ ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
+ NumPartial += 2;
+ }
+ }
+ for (; h <= (height - 128); h += 128) {
+ for (w = 0; w <= (width - 128); w += 128) {
+ List128 = Enlist(List128, x + w, y + h, 128, 128);
+ Num128++;
+ }
+ if (w < width) {
+ ListPartial = Enlist(ListPartial, x + w, y + h, width - w, 128);
+ NumPartial++;
+ }
+ }
+ if (h < height) {
+ int d = height - h;
+
+ for (w = 0; w <= (width - 128); w += 128) {
+ ListPartial = Enlist(ListPartial, x + w, y + h, 128, d);
+ NumPartial++;
+ }
+ if (w < width) {
+ ListPartial = Enlist(ListPartial, x + w, y + h, width - w, d);
+ NumPartial++;
+ }
+ }
+ pBox++;
+ }
+
+/*
+ by this point we've carved the space into as many 512x512, 256x256
+ and 128x128 blocks as we could fit. We will then break larger
+ blocks into smaller ones if we need to. The rules are as follows:
+
+ 512x512 -
+ 1) Don't take up more than half the memory.
+ 2) Don't bother if you can't get at least four.
+ 3) Don't make more than MAX_512.
+ 4) Don't have any of there are no 256x256s.
+
+ 256x256 -
+ 1) Don't take up more than a quarter of the memory enless there
+ aren't any 512x512s. Then we can take up to half.
+ 2) Don't bother if you can't get at least four.
+ 3) Don't make more than MAX_256.
+
+ 128x128 -
+ 1) Don't make more than MAX_128.
+
+ We don't bother with the partial blocks unless we can use them
+ for 8x8 pattern fills or we are short on larger blocks.
+
+*/
+
+ ntotal = Num128 + (Num256 << 2) + (Num512 << 4);
+
+ Target512 = ntotal >> 5;
+ if (Target512 < 4)
+ Target512 = 0;
+ if (!Target512)
+ Target256 = ntotal >> 3;
+ else
+ Target256 = ntotal >> 4;
+ if (Target256 < 4)
+ Target256 = 0;
+
+ if (Num512 && Num256 < 4) {
+ while (Num512 && Num256 < Target256) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4;
+ Num512--;
+ }
+ }
+
+ if (!Num512) { /* no room */
+ }
+ else if ((Num512 < 4) || (!Target512)) {
+ while (Num512) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4;
+ Num512--;
+ }
+ }
+ else if ((Num512 > MAX_512) || (Num512 > Target512)) {
+ while (Num512 > MAX_512) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4;
+ Num512--;
+ }
+ while (Num512 > Target512) {
+ if (Num256 < MAX_256) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4;
+ Num512--;
+ }
+ else
+ break;
+ }
+ }
+
+ if (!Num256) { /* no room */
+ }
+ else if ((Num256 < 4) || (!Target256)) {
+ while (Num256) {
+ SubdivideList(&List256, &List128);
+ Num128 += 4;
+ Num256--;
+ }
+ }
+ else if ((Num256 > MAX_256) || (Num256 > Target256)) {
+ while (Num256 > MAX_256) {
+ SubdivideList(&List256, &List128);
+ Num128 += 4;
+ Num256--;
+ }
+ while (Num256 > Target256) {
+ if (Num128 < MAX_128) {
+ SubdivideList(&List256, &List128);
+ Num128 += 4;
+ Num256--;
+ }
+ else
+ break;
+ }
+ }
+
+ if (Num128 && ((Num128 < 4) || (Num128 > MAX_128))) {
+ CacheLinkPtr next;
+ int max = (Num128 > MAX_128) ? MAX_128 : 0;
+
+ /*
+ * Note: next is set in this way to work around a code generation
+ * bug in gcc 2.7.2.3.
+ */
+ next = List128->next;
+ while (Num128 > max) {
+ List128->next = ListPartial;
+ ListPartial = List128;
+ if ((List128 = next))
+ next = List128->next;
+ NumPartial++;
+ Num128--;
+ }
+ }
+
+ MaxPartialHeight = MaxPartialWidth = 0;
+
+ /* at this point we have as many 512x512 and 256x256 slots as we
+ want but may have an excess of 128x128 slots. We still need
+ to find out if we need 8x8 slots. We take these from the
+ partials if we have them. Otherwise, we break some 128x128's */
+
+ if (!(infoRec->PixmapCacheFlags & (CACHE_MONO_8x8 | CACHE_COLOR_8x8))) {
+ if (NumPartial) {
+ if (Num128) { /* don't bother with partials */
+ FreeList(ListPartial);
+ NumPartial = 0;
+ ListPartial = NULL;
+ }
+ else {
+ /* We have no big slots. Weed out the unusable partials */
+ ListPartial = ThinOutPartials(ListPartial, &NumPartial,
+ &MaxPartialWidth,
+ &MaxPartialHeight);
+ }
+ }
+ }
+ else {
+ int MonosPerColor = 1;
+ int ColorH = infoRec->CacheHeightColor8x8Pattern;
+ int ColorW = infoRec->CacheWidthColor8x8Pattern;
+ int MonoH = infoRec->CacheHeightMono8x8Pattern;
+ int MonoW = infoRec->CacheWidthMono8x8Pattern;
+ Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
+ Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
+
+ if (DoColor)
+ infoRec->CanDoColor8x8 = FALSE;
+ if (DoMono)
+ infoRec->CanDoMono8x8 = FALSE;
+
+ if (DoColor && DoMono) {
+ /* we assume color patterns take more space than color ones */
+ if (MonoH > ColorH)
+ ColorH = MonoH;
+ if (MonoW > ColorW)
+ ColorW = MonoW;
+ MonosPerColor = (ColorH / MonoH) * (ColorW / MonoW);
+ }
+
+ if (Num128) {
+ if (NumPartial) { /* use all for 8x8 slots */
+ ConvertAllPartialsTo8x8(&NumMono, &NumColor,
+ ListPartial, &ListMono, &ListColor,
+ infoRec);
+ NumPartial = 0;
+ ListPartial = NULL;
+ }
+
+ /* Get some 8x8 slots from the 128 slots */
+ while ((Num128 > 4) &&
+ ((NumMono < MAX_MONO) && (NumColor < MAX_COLOR))) {
+ CacheLinkPtr tmp = NULL;
+
+ tmp = Enlist(tmp, List128->x, List128->y,
+ List128->w, List128->h);
+ List128 = Delist(List128);
+ Num128--;
+
+ ConvertAllPartialsTo8x8(&NumMono, &NumColor,
+ tmp, &ListMono, &ListColor, infoRec);
+ }
+ }
+ else if (NumPartial) {
+ /* We have share partials between 8x8 slots and tiles. */
+ ListPartial = ConvertSomePartialsTo8x8(&NumMono, &NumColor,
+ &NumPartial, ListPartial,
+ &ListMono, &ListColor,
+ &MaxPartialWidth,
+ &MaxPartialHeight, infoRec);
+ }
+
+ if (DoMono && DoColor) {
+ if (NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
+ int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
+
+ while (NumColor > max) {
+ ConvertColorToMono(&ListColor, ColorW, ColorH,
+ &ListMono, MonoW, MonoH);
+ NumColor--;
+ NumMono += MonosPerColor;
+ }
+ }
+
+ /* favor Mono slots over Color ones */
+ while ((NumColor > 4) && (NumMono < MAX_MONO)) {
+ ConvertColorToMono(&ListColor, ColorW, ColorH,
+ &ListMono, MonoW, MonoH);
+ NumColor--;
+ NumMono += MonosPerColor;
+ }
+ }
+
+ if (NumMono && ((NumMono > MAX_MONO) || (NumMono < 4))) {
+ int max = (NumMono > MAX_MONO) ? MAX_MONO : 0;
+
+ while (NumMono > max) {
+ ListMono = Delist(ListMono);
+ NumMono--;
+ }
+ }
+ if (NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
+ int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
+
+ while (NumColor > max) {
+ ListColor = Delist(ListColor);
+ NumColor--;
+ }
+ }
+ }
+
+ pCachePriv = calloc(1, sizeof(XAAPixmapCachePrivate));
+ if (!pCachePriv) {
+ if (Num512)
+ FreeList(List512);
+ if (Num256)
+ FreeList(List256);
+ if (Num128)
+ FreeList(List128);
+ if (NumPartial)
+ FreeList(ListPartial);
+ if (NumColor)
+ FreeList(ListColor);
+ if (NumMono)
+ FreeList(ListMono);
+ return;
+ }
+
+ infoRec->PixmapCachePrivate = (char *) pCachePriv;
+
+ if (Num512) {
+ pCachePriv->Info512 = calloc(Num512, sizeof(XAACacheInfoRec));
+ if (!pCachePriv->Info512)
+ Num512 = 0;
+ if (Num512)
+ TransferList(List512, pCachePriv->Info512, Num512);
+ FreeList(List512);
+ pCachePriv->Num512x512 = Num512;
+ }
+ if (Num256) {
+ pCachePriv->Info256 = calloc(Num256, sizeof(XAACacheInfoRec));
+ if (!pCachePriv->Info256)
+ Num256 = 0;
+ if (Num256)
+ TransferList(List256, pCachePriv->Info256, Num256);
+ FreeList(List256);
+ pCachePriv->Num256x256 = Num256;
+ }
+ if (Num128) {
+ pCachePriv->Info128 = calloc(Num128, sizeof(XAACacheInfoRec));
+ if (!pCachePriv->Info128)
+ Num128 = 0;
+ if (Num128)
+ TransferList(List128, pCachePriv->Info128, Num128);
+ FreeList(List128);
+ pCachePriv->Num128x128 = Num128;
+ }
+
+ if (NumPartial) {
+ pCachePriv->InfoPartial = calloc(NumPartial, sizeof(XAACacheInfoRec));
+ if (!pCachePriv->InfoPartial)
+ NumPartial = 0;
+ if (NumPartial)
+ TransferList(ListPartial, pCachePriv->InfoPartial, NumPartial);
+ FreeList(ListPartial);
+ pCachePriv->NumPartial = NumPartial;
+ }
+
+ if (NumColor) {
+ pCachePriv->InfoColor = calloc(NumColor, sizeof(XAACacheInfoRec));
+ if (!pCachePriv->InfoColor)
+ NumColor = 0;
+ if (NumColor)
+ TransferList(ListColor, pCachePriv->InfoColor, NumColor);
+ FreeList(ListColor);
+ pCachePriv->NumColor = NumColor;
+ }
+
+ if (NumMono) {
+ pCachePriv->InfoMono = calloc(NumMono, sizeof(XAACacheInfoRec));
+ if (!pCachePriv->InfoMono)
+ NumMono = 0;
+ if (NumMono)
+ TransferList(ListMono, pCachePriv->InfoMono, NumMono);
+ FreeList(ListMono);
+ pCachePriv->NumMono = NumMono;
+ }
+
+ if (NumPartial) {
+ infoRec->MaxCacheableTileWidth = MaxPartialWidth;
+ infoRec->MaxCacheableTileHeight = MaxPartialHeight;
+ }
+ if (Num128)
+ infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 128;
+ if (Num256)
+ infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 256;
+ if (Num512)
+ infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 512;
+
+ infoRec->MaxCacheableStippleHeight = infoRec->MaxCacheableTileHeight;
+ infoRec->MaxCacheableStippleWidth =
+ infoRec->MaxCacheableTileWidth * pScrn->bitsPerPixel;
+ if (infoRec->ScreenToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP)
+ infoRec->MaxCacheableStippleWidth /= 3;
+
+ if (NumMono) {
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ (HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
+ HARDWARE_PATTERN_PROGRAMMED_BITS))) {
+ int numPerLine =
+ infoRec->CacheWidthMono8x8Pattern / infoRec->MonoPatternPitch;
+
+ for (i = 0; i < 64; i++) {
+ pCachePriv->MonoOffsets[i].y = i / numPerLine;
+ pCachePriv->MonoOffsets[i].x = (i % numPerLine) *
+ infoRec->MonoPatternPitch;
+ }
+ }
+ infoRec->CanDoMono8x8 = TRUE;
+ }
+ if (NumColor) {
+ if (!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+
+ for (i = 0; i < 64; i++) {
+ pCachePriv->ColorOffsets[i].y = i & 0x07;
+ pCachePriv->ColorOffsets[i].x = i & ~0x07;
+ }
+ }
+ infoRec->CanDoColor8x8 = TRUE;
+ }
+
+ if (!CACHEINIT(pScrn)) {
+ xf86ErrorF("\tSetting up tile and stipple cache:\n");
+ if (NumPartial)
+ xf86ErrorF("\t\t%i %ix%i slots\n",
+ NumPartial, MaxPartialWidth, MaxPartialHeight);
+ if (Num128)
+ xf86ErrorF("\t\t%i 128x128 slots\n", Num128);
+ if (Num256)
+ xf86ErrorF("\t\t%i 256x256 slots\n", Num256);
+ if (Num512)
+ xf86ErrorF("\t\t%i 512x512 slots\n", Num512);
+ if (NumColor)
+ xf86ErrorF("\t\t%i 8x8 color pattern slots\n", NumColor);
+ if (NumMono)
+ xf86ErrorF("\t\t%i 8x8 color expansion slots\n", NumMono);
+ }
+
+ if (!(NumPartial | Num128 | Num256 | Num512 | NumColor | NumMono)) {
+ if (!CACHEINIT(pScrn))
+ xf86ErrorF("\t\tNot enough video memory for pixmap cache\n");
+ }
+ else
+ infoRec->UsingPixmapCache = TRUE;
+
+ CACHEINIT(pScrn) = 1;
+}
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+static CARD32 StippleMasks[4] = {
+ 0x80808080,
+ 0xC0C0C0C0,
+ 0x00000000,
+ 0xF0F0F0F0
+};
+#else
+static CARD32 StippleMasks[4] = {
+ 0x01010101,
+ 0x03030303,
+ 0x00000000,
+ 0x0F0F0F0F
+};
+#endif
+
+Bool
+XAACheckStippleReducibility(PixmapPtr pPixmap)
+{
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
+ CARD32 *IntPtr = (CARD32 *) pPixmap->devPrivate.ptr;
+ int w = pPixmap->drawable.width;
+ int h = pPixmap->drawable.height;
+ int i;
+ CARD32 bits[8];
+ CARD32 mask = SHIFT_R(0xFFFFFFFF, 24);
+
+ pPriv->flags |= REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR;
+ pPriv->flags &= ~REDUCIBLE_TO_8x8;
+
+ if ((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
+ return FALSE;
+
+ i = (h > 8) ? 8 : h;
+
+ switch (w) {
+ case 32:
+ while (i--) {
+ bits[i] = IntPtr[i] & mask;
+ if ((bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 8)), 8)) ||
+ (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 16)), 16)) ||
+ (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 24)), 24)))
+ return FALSE;
+ }
+ break;
+ case 16:
+ while (i--) {
+ bits[i] = IntPtr[i] & mask;
+ if (bits[i] != ((IntPtr[i] & SHIFT_R(SHIFT_L(mask, 8), 8))))
+ return FALSE;
+ }
+ break;
+ default:
+ while (i--)
+ bits[i] = IntPtr[i] & mask;
+ break;
+ }
+
+ switch (h) {
+ case 32:
+ if ((IntPtr[8] != IntPtr[16]) || (IntPtr[9] != IntPtr[17]) ||
+ (IntPtr[10] != IntPtr[18]) || (IntPtr[11] != IntPtr[19]) ||
+ (IntPtr[12] != IntPtr[20]) || (IntPtr[13] != IntPtr[21]) ||
+ (IntPtr[14] != IntPtr[22]) || (IntPtr[15] != IntPtr[23]) ||
+ (IntPtr[16] != IntPtr[24]) || (IntPtr[17] != IntPtr[25]) ||
+ (IntPtr[18] != IntPtr[26]) || (IntPtr[19] != IntPtr[27]) ||
+ (IntPtr[20] != IntPtr[28]) || (IntPtr[21] != IntPtr[29]) ||
+ (IntPtr[22] != IntPtr[30]) || (IntPtr[23] != IntPtr[31]))
+ return FALSE;
+ /* fall through */
+ case 16:
+ if ((IntPtr[0] != IntPtr[8]) || (IntPtr[1] != IntPtr[9]) ||
+ (IntPtr[2] != IntPtr[10]) || (IntPtr[3] != IntPtr[11]) ||
+ (IntPtr[4] != IntPtr[12]) || (IntPtr[5] != IntPtr[13]) ||
+ (IntPtr[6] != IntPtr[14]) || (IntPtr[7] != IntPtr[15]))
+ return FALSE;
+ case 8:
+ break;
+ case 1:
+ bits[1] = bits[0];
+ case 2:
+ bits[2] = bits[0];
+ bits[3] = bits[1];
+ case 4:
+ bits[4] = bits[0];
+ bits[5] = bits[1];
+ bits[6] = bits[2];
+ bits[7] = bits[3];
+ break;
+ }
+
+ pPriv->flags |= REDUCIBLE_TO_8x8;
+
+ pPriv->pattern0 =
+ bits[0] | SHIFT_L(bits[1], 8) | SHIFT_L(bits[2], 16) | SHIFT_L(bits[3],
+ 24);
+ pPriv->pattern1 =
+ bits[4] | SHIFT_L(bits[5], 8) | SHIFT_L(bits[6], 16) | SHIFT_L(bits[7],
+ 24);
+
+ if (w < 8) {
+ pPriv->pattern0 &= StippleMasks[w - 1];
+ pPriv->pattern1 &= StippleMasks[w - 1];
+
+ switch (w) {
+ case 1:
+ pPriv->pattern0 |= SHIFT_L(pPriv->pattern0, 1);
+ pPriv->pattern1 |= SHIFT_L(pPriv->pattern1, 1);
+ case 2:
+ pPriv->pattern0 |= SHIFT_L(pPriv->pattern0, 2);
+ pPriv->pattern1 |= SHIFT_L(pPriv->pattern1, 2);
+ case 4:
+ pPriv->pattern0 |= SHIFT_L(pPriv->pattern0, 4);
+ pPriv->pattern1 |= SHIFT_L(pPriv->pattern1, 4);
+ }
+ }
+
+ if (infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
+ pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
+ }
+
+ return TRUE;
+}
+
+Bool
+XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono)
+{
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+ CARD32 *IntPtr;
+ int w = pPixmap->drawable.width;
+ int h = pPixmap->drawable.height;
+ int pitch = pPixmap->devKind >> 2;
+ int dwords, i, j;
+
+ pPriv->flags |= REDUCIBILITY_CHECKED;
+ pPriv->flags &= ~(REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR);
+
+ if ((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
+ return FALSE;
+
+ dwords = ((w * pPixmap->drawable.bitsPerPixel) + 31) >> 5;
+ i = (h > 8) ? 8 : h;
+
+ if (w > 8) {
+ IntPtr = (CARD32 *) pPixmap->devPrivate.ptr;
+ switch (pPixmap->drawable.bitsPerPixel) {
+ case 8:
+ while (i--) {
+ for (j = 2; j < dwords; j++)
+ if (IntPtr[j] != IntPtr[j & 0x01])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ case 16:
+ while (i--) {
+ for (j = 4; j < dwords; j++)
+ if (IntPtr[j] != IntPtr[j & 0x03])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ case 24:
+ while (i--) {
+ for (j = 6; j < dwords; j++)
+ if (IntPtr[j] != IntPtr[j % 6])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ case 32:
+ while (i--) {
+ for (j = 8; j < dwords; j++)
+ if (IntPtr[j] != IntPtr[j & 0x07])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ default:
+ return FALSE;
+ }
+
+ }
+
+ if (h == 32) {
+ CARD32 *IntPtr2, *IntPtr3, *IntPtr4;
+
+ i = 8;
+ IntPtr = (CARD32 *) pPixmap->devPrivate.ptr;
+ IntPtr2 = IntPtr + (pitch << 3);
+ IntPtr3 = IntPtr2 + (pitch << 3);
+ IntPtr4 = IntPtr3 + (pitch << 3);
+ while (i--) {
+ for (j = 0; j < dwords; j++)
+ if ((IntPtr[j] != IntPtr2[j]) || (IntPtr[j] != IntPtr3[j]) ||
+ (IntPtr[j] != IntPtr4[j]))
+ return FALSE;
+ IntPtr += pitch;
+ IntPtr2 += pitch;
+ IntPtr3 += pitch;
+ IntPtr4 += pitch;
+ }
+ }
+ else if (h == 16) {
+ CARD32 *IntPtr2;
+
+ i = 8;
+ IntPtr = (CARD32 *) pPixmap->devPrivate.ptr;
+ IntPtr2 = IntPtr + (pitch << 3);
+ while (i--) {
+ for (j = 0; j < dwords; j++)
+ if (IntPtr[j] != IntPtr2[j])
+ return FALSE;
+ IntPtr += pitch;
+ IntPtr2 += pitch;
+ }
+ }
+
+ pPriv->flags |= REDUCIBLE_TO_8x8;
+
+ if (checkMono) {
+ XAAInfoRecPtr infoRec =
+ GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
+ unsigned char bits[8];
+ int fg, bg = -1, x, y;
+
+ i = (h > 8) ? 8 : h;
+ j = (w > 8) ? 8 : w;
+
+ if (pPixmap->drawable.bitsPerPixel == 8) {
+ unsigned char *srcp = pPixmap->devPrivate.ptr;
+
+ fg = srcp[0];
+ pitch = pPixmap->devKind;
+ for (y = 0; y < i; y++) {
+ bits[y] = 0;
+ for (x = 0; x < j; x++) {
+ if (srcp[x] != fg) {
+ if (bg == -1)
+ bg = srcp[x];
+ else if (bg != srcp[x])
+ return TRUE;
+ }
+ else
+ bits[y] |= 1 << x;
+ }
+ srcp += pitch;
+ }
+ }
+ else if (pPixmap->drawable.bitsPerPixel == 16) {
+ unsigned short *srcp = (unsigned short *) pPixmap->devPrivate.ptr;
+
+ fg = srcp[0];
+ pitch = pPixmap->devKind >> 1;
+ for (y = 0; y < i; y++) {
+ bits[y] = 0;
+ for (x = 0; x < j; x++) {
+ if (srcp[x] != fg) {
+ if (bg == -1)
+ bg = srcp[x];
+ else if (bg != srcp[x])
+ return TRUE;
+ }
+ else
+ bits[y] |= 1 << x;
+ }
+ srcp += pitch;
+ }
+ }
+ else if (pPixmap->drawable.bitsPerPixel == 24) {
+ CARD32 val;
+ unsigned char *srcp = pPixmap->devPrivate.ptr;
+
+ fg = *((CARD32 *) srcp) & 0x00FFFFFF;
+ pitch = pPixmap->devKind;
+ j *= 3;
+ for (y = 0; y < i; y++) {
+ bits[y] = 0;
+ for (x = 0; x < j; x += 3) {
+ val = *((CARD32 *) (srcp + x)) & 0x00FFFFFF;
+ if (val != fg) {
+ if (bg == -1)
+ bg = val;
+ else if (bg != val)
+ return TRUE;
+ }
+ else
+ bits[y] |= 1 << (x / 3);
+ }
+ srcp += pitch;
+ }
+ }
+ else if (pPixmap->drawable.bitsPerPixel == 32) {
+ IntPtr = (CARD32 *) pPixmap->devPrivate.ptr;
+ fg = IntPtr[0];
+ for (y = 0; y < i; y++) {
+ bits[y] = 0;
+ for (x = 0; x < j; x++) {
+ if (IntPtr[x] != fg) {
+ if (bg == -1)
+ bg = IntPtr[x];
+ else if (bg != IntPtr[x])
+ return TRUE;
+ }
+ else
+ bits[y] |= 1 << x;
+ }
+ IntPtr += pitch;
+ }
+ }
+ else
+ return TRUE;
+
+ pPriv->fg = fg;
+ if (bg == -1)
+ pPriv->bg = fg;
+ else
+ pPriv->bg = bg;
+
+ if (h < 8) {
+ switch (h) {
+ case 1:
+ bits[1] = bits[0];
+ case 2:
+ bits[2] = bits[0];
+ bits[3] = bits[1];
+ case 4:
+ bits[4] = bits[0];
+ bits[5] = bits[1];
+ bits[6] = bits[2];
+ bits[7] = bits[3];
+ break;
+ }
+ }
+
+ pPriv->pattern0 =
+ bits[0] | (bits[1] << 8) | (bits[2] << 16) | (bits[3] << 24);
+ pPriv->pattern1 =
+ bits[4] | (bits[5] << 8) | (bits[6] << 16) | (bits[7] << 24);
+
+ if (w < 8) {
+ switch (w) {
+ case 1:
+ pPriv->pattern0 |= (pPriv->pattern0 << 1);
+ pPriv->pattern1 |= (pPriv->pattern1 << 1);
+ case 2:
+ pPriv->pattern0 |= (pPriv->pattern0 << 2);
+ pPriv->pattern1 |= (pPriv->pattern1 << 2);
+ case 4:
+ pPriv->pattern0 |= (pPriv->pattern0 << 4);
+ pPriv->pattern1 |= (pPriv->pattern1 << 4);
+ }
+ }
+ pPriv->flags |= REDUCIBLE_TO_2_COLOR;
+
+ if (infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
+ pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
+ }
+
+ }
+
+ return TRUE;
+}
+
+void
+XAATileCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache, int w, int h)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SetupForScreenToScreenCopy) (pScrn, 1, 1, GXcopy, ~0, -1);
+
+ while ((w << 1) <= pCache->w) {
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y,
+ pCache->x + w, pCache->y, w,
+ h);
+ w <<= 1;
+ }
+ if (w != pCache->w) {
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y,
+ pCache->x + w, pCache->y,
+ pCache->w - w, h);
+ w = pCache->w;
+ }
+
+ while ((h << 1) <= pCache->h) {
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y,
+ pCache->x, pCache->y + h, w,
+ h);
+ h <<= 1;
+ }
+ if (h != pCache->h) {
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y,
+ pCache->x, pCache->y + h, w,
+ pCache->h - h);
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+XAACacheInfoPtr
+XAACacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ int size = max(w, h);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0;
+ int *current;
+
+ if (size <= 128) {
+ if (pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ }
+ else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ }
+ else if (size <= 256) {
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ }
+ else if (size <= 512) {
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ }
+ else { /* something's wrong */
+ ErrorF("Something's wrong in XAACacheTile()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+
+ /* lets look for it */
+ for (i = 0; i < max; i++, pCache++) {
+ if (pCache->serialNumber == pPix->drawable.serialNumber) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if (*current >= max)
+ *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->bg = pCache->fg = -1;
+ pCache->orig_w = w;
+ pCache->orig_h = h;
+ (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y, w, h,
+ pPix->devPrivate.ptr, pPix->devKind,
+ pPix->drawable.bitsPerPixel,
+ pPix->drawable.depth);
+ if (!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
+ ((w != pCache->w) || (h != pCache->h)))
+ XAATileCache(pScrn, pCache, w, h);
+
+ return pCache;
+}
+
+XAACacheInfoPtr
+XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0, funcNo, pad, dwords, bpp = pScrn->bitsPerPixel;
+ int *current;
+ StippleScanlineProcPtr StippleFunc;
+ unsigned char *data, *srcPtr, *dstPtr;
+
+ if ((h <= 128) && (w <= 128 * bpp)) {
+ if (pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ }
+ else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ }
+ else if ((h <= 256) && (w <= 256 * bpp)) {
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ }
+ else if ((h <= 512) && (w <= 526 * bpp)) {
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ }
+ else { /* something's wrong */
+ ErrorF("Something's wrong in XAACacheMonoStipple()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+
+ /* lets look for it */
+ for (i = 0; i < max; i++, pCache++) {
+ if ((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (pCache->fg == -1) && (pCache->bg == -1)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if (*current >= max)
+ *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->bg = pCache->fg = -1;
+ pCache->orig_w = w;
+ pCache->orig_h = h;
+
+ if (w <= 32) {
+ if (w & (w - 1))
+ funcNo = 1;
+ else
+ funcNo = 0;
+ }
+ else
+ funcNo = 2;
+
+ pad = BitmapBytePad(pCache->w * bpp);
+ dwords = bytes_to_int32(pad);
+ dstPtr = data = (unsigned char *) malloc(pad * pCache->h);
+ srcPtr = (unsigned char *) pPix->devPrivate.ptr;
+
+ if (infoRec->
+ ScreenToScreenColorExpandFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
+ StippleFunc = XAAStippleScanlineFuncMSBFirst[funcNo];
+ else
+ StippleFunc = XAAStippleScanlineFuncLSBFirst[funcNo];
+
+ /* don't bother generating more than we'll ever use */
+ max = ((pScrn->displayWidth + w - 1) + 31) >> 5;
+ if (dwords > max)
+ dwords = max;
+
+ for (i = 0; i < h; i++) {
+ (*StippleFunc) ((CARD32 *) dstPtr, (CARD32 *) srcPtr, 0, w, dwords);
+ srcPtr += pPix->devKind;
+ dstPtr += pad;
+ }
+
+ while ((h << 1) <= pCache->h) {
+ memcpy(data + (pad * h), data, pad * h);
+ h <<= 1;
+ }
+
+ if (h < pCache->h)
+ memcpy(data + (pad * h), data, pad * (pCache->h - h));
+
+ (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y, pCache->w,
+ pCache->h, data, pad, bpp, pScrn->depth);
+
+ free(data);
+
+ return pCache;
+}
+
+XAACacheInfoPtr
+XAACachePlanarMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0;
+ int *current;
+
+ if ((h <= 128) && (w <= 128)) {
+ if (pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ }
+ else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ }
+ else if ((h <= 256) && (w <= 256)) {
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ }
+ else if ((h <= 512) && (w <= 526)) {
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ }
+ else { /* something's wrong */
+ ErrorF("Something's wrong in XAACachePlanarMonoStipple()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+
+ /* lets look for it */
+ for (i = 0; i < max; i++, pCache++) {
+ if ((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (pCache->fg == -1) && (pCache->bg == -1)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if (*current >= max)
+ *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->bg = pCache->fg = -1;
+ pCache->orig_w = w;
+ pCache->orig_h = h;
+
+ /* Plane 0 holds the stipple. Plane 1 holds the inverted stipple */
+ (*infoRec->WriteBitmapToCache) (pScrn, pCache->x, pCache->y,
+ pPix->drawable.width, pPix->drawable.height,
+ pPix->devPrivate.ptr, pPix->devKind, 1, 2);
+ if (!(infoRec->PixmapCacheFlags & DO_NOT_TILE_MONO_DATA) &&
+ ((w != pCache->w) || (h != pCache->h)))
+ XAATileCache(pScrn, pCache, w, h);
+
+ return pCache;
+}
+
+XAACachePlanarMonoStippleProc
+XAAGetCachePlanarMonoStipple(void)
+{
+ return XAACachePlanarMonoStipple;
+}
+
+XAACacheInfoPtr
+XAACacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ int size = max(w, h);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0;
+ int *current;
+
+ if (size <= 128) {
+ if (pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ }
+ else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ }
+ else if (size <= 256) {
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ }
+ else if (size <= 512) {
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ }
+ else { /* something's wrong */
+ ErrorF("Something's wrong in XAACacheStipple()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+ /* lets look for it */
+ if (bg == -1)
+ for (i = 0; i < max; i++, pCache++) {
+ if ((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (fg == pCache->fg) && (pCache->fg != pCache->bg)) {
+ pCache->trans_color = pCache->bg;
+ return pCache;
+ }
+ }
+ else
+ for (i = 0; i < max; i++, pCache++) {
+ if ((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (fg == pCache->fg) && (bg == pCache->bg)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if (*current >= max)
+ *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->fg = fg;
+ if (bg == -1)
+ pCache->trans_color = bg = fg ^ 1;
+ else
+ pCache->trans_color = -1;
+ pCache->bg = bg;
+
+ pCache->orig_w = w;
+ pCache->orig_h = h;
+ (*infoRec->WriteBitmapToCache) (pScrn, pCache->x, pCache->y,
+ pPix->drawable.width, pPix->drawable.height,
+ pPix->devPrivate.ptr, pPix->devKind, fg,
+ bg);
+ if (!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
+ ((w != pCache->w) || (h != pCache->h)))
+ XAATileCache(pScrn, pCache, w, h);
+
+ return pCache;
+}
+
+XAACacheInfoPtr
+XAACacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0, int pat1)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache = pCachePriv->InfoMono;
+ int i;
+
+ for (i = 0; i < pCachePriv->NumMono; i++, pCache++) {
+ if (pCache->serialNumber &&
+ (pCache->pat0 == pat0) && (pCache->pat1 == pat1))
+ return pCache;
+ }
+
+ /* OK, let's cache it */
+ pCache = &pCachePriv->InfoMono[pCachePriv->CurrentMono++];
+ if (pCachePriv->CurrentMono >= pCachePriv->NumMono)
+ pCachePriv->CurrentMono = 0;
+
+ pCache->serialNumber = 1; /* we don't care since we do lookups by pattern */
+ pCache->pat0 = pat0;
+ pCache->pat1 = pat1;
+
+ (*infoRec->WriteMono8x8PatternToCache) (pScrn, pCache);
+
+ return pCache;
+}
+
+XAACacheInfoPtr
+XAACacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache = pCachePriv->InfoColor;
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ int i;
+
+ if (!(pixPriv->flags & REDUCIBLE_TO_2_COLOR)) {
+ for (i = 0; i < pCachePriv->NumColor; i++, pCache++) {
+ if (pCache->serialNumber == pPix->drawable.serialNumber) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+ pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
+ if (pCachePriv->CurrentColor >= pCachePriv->NumColor)
+ pCachePriv->CurrentColor = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->fg = pCache->bg = -1;
+ }
+ else {
+ int pat0 = pixPriv->pattern0;
+ int pat1 = pixPriv->pattern1;
+
+ if (fg == -1) { /* it's a tile */
+ fg = pixPriv->fg;
+ bg = pixPriv->bg;
+ }
+
+ if (bg == -1) { /* stipple */
+ for (i = 0; i < pCachePriv->NumColor; i++, pCache++) {
+ if (pCache->serialNumber &&
+ (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
+ (pCache->fg == fg) && (pCache->bg != fg)) {
+ pCache->trans_color = pCache->bg;
+ return pCache;
+ }
+ }
+ }
+ else { /* opaque stipple */
+ for (i = 0; i < pCachePriv->NumColor; i++, pCache++) {
+ if (pCache->serialNumber &&
+ (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
+ (pCache->fg == fg) && (pCache->bg == bg)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+ }
+ pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
+ if (pCachePriv->CurrentColor >= pCachePriv->NumColor)
+ pCachePriv->CurrentColor = 0;
+
+ if (bg == -1)
+ pCache->trans_color = bg = fg ^ 1;
+ else
+ pCache->trans_color = -1;
+
+ pCache->pat0 = pat0;
+ pCache->pat1 = pat1;
+ pCache->fg = fg;
+ pCache->bg = bg;
+ pCache->serialNumber = 1;
+ }
+
+ (*infoRec->WriteColor8x8PatternToCache) (pScrn, pPix, pCache);
+
+ return pCache;
+}
+
+void
+XAAWriteBitmapToCache(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int fg, int bg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->WriteBitmap) (pScrn, x, y, w, h, src, srcwidth,
+ 0, fg, bg, GXcopy, ~0);
+}
+
+void
+XAAWriteBitmapToCacheLinear(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int fg, int bg)
+{
+ ScreenPtr pScreen = pScrn->pScreen;
+ PixmapPtr pScreenPix, pDstPix;
+ ChangeGCVal gcvals[2];
+ GCPtr pGC;
+
+ pScreenPix = (*pScreen->GetScreenPixmap) (pScreen);
+
+ pDstPix = GetScratchPixmapHeader(pScreen, pScreenPix->drawable.width,
+ y + h, pScreenPix->drawable.depth,
+ pScreenPix->drawable.bitsPerPixel,
+ pScreenPix->devKind,
+ pScreenPix->devPrivate.ptr);
+
+ pGC = GetScratchGC(pScreenPix->drawable.depth, pScreen);
+ gcvals[0].val = fg;
+ gcvals[1].val = bg;
+ ChangeGC(NullClient, pGC, GCForeground | GCBackground, gcvals);
+ ValidateGC((DrawablePtr) pDstPix, pGC);
+
+ /* We've unwrapped already so these ops miss a sync */
+ SYNC_CHECK(pScrn);
+
+ (*pGC->ops->PutImage) ((DrawablePtr) pDstPix, pGC, 1, x, y, w, h, 0,
+ XYBitmap, (pointer) src);
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(pDstPix);
+}
+
+void
+XAAWritePixmapToCache(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int bpp, int depth)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->WritePixmap) (pScrn, x, y, w, h, src, srcwidth,
+ GXcopy, ~0, -1, bpp, depth);
+}
+
+void
+XAAWritePixmapToCacheLinear(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth, int bpp, int depth)
+{
+ ScreenPtr pScreen = pScrn->pScreen;
+ PixmapPtr pScreenPix, pDstPix;
+ GCPtr pGC;
+
+ pScreenPix = (*pScreen->GetScreenPixmap) (pScreen);
+
+ pDstPix = GetScratchPixmapHeader(pScreen, x + w, y + h,
+ depth, bpp, pScreenPix->devKind,
+ pScreenPix->devPrivate.ptr);
+
+ pGC = GetScratchGC(depth, pScreen);
+ ValidateGC((DrawablePtr) pDstPix, pGC);
+
+ /* We've unwrapped already so these ops miss a sync */
+ SYNC_CHECK(pScrn);
+
+ if (bpp == BitsPerPixel(depth))
+ (*pGC->ops->PutImage) ((DrawablePtr) pDstPix, pGC, depth, x, y, w,
+ h, 0, ZPixmap, (pointer) src);
+ else {
+ PixmapPtr pSrcPix;
+
+ pSrcPix = GetScratchPixmapHeader(pScreen, w, h, depth, bpp,
+ srcwidth, (pointer) src);
+
+ (*pGC->ops->CopyArea) ((DrawablePtr) pSrcPix, (DrawablePtr) pDstPix,
+ pGC, 0, 0, w, h, x, y);
+
+ FreeScratchPixmapHeader(pSrcPix);
+ }
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(pDstPix);
+}
+
+void
+XAAWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
+ unsigned char *data;
+ int pad, Bpp = (pScrn->bitsPerPixel >> 3);
+
+ pCache->offsets = pCachePriv->MonoOffsets;
+
+ pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
+
+ data = (unsigned char *) malloc(pad * pCache->h);
+ if (!data)
+ return;
+
+ if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ CARD32 *ptr = (CARD32 *) data;
+
+ ptr[0] = pCache->pat0;
+ ptr[1] = pCache->pat1;
+ }
+ else {
+ CARD32 *ptr;
+ DDXPointPtr pPoint = pCache->offsets;
+ int patx, paty, i;
+
+ for (i = 0; i < 64; i++, pPoint++) {
+ patx = pCache->pat0;
+ paty = pCache->pat1;
+ XAARotateMonoPattern(&patx, &paty, i & 0x07, i >> 3,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ ptr = (CARD32 *) (data + (pad * pPoint->y) + (Bpp * pPoint->x));
+ ptr[0] = patx;
+ ptr[1] = paty;
+ }
+ }
+
+ (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y,
+ pCache->w, pCache->h, data, pad,
+ pScrn->bitsPerPixel, pScrn->depth);
+
+ free(data);
+}
+
+void
+XAAWriteColor8x8PatternToCache(ScrnInfoPtr pScrn,
+ PixmapPtr pPix, XAACacheInfoPtr pCache)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
+ int pad, i, w, h, nw, nh, Bpp;
+ unsigned char *data, *srcPtr, *dstPtr;
+
+ pCache->offsets = pCachePriv->ColorOffsets;
+
+ if (pixPriv->flags & REDUCIBLE_TO_2_COLOR) {
+ CARD32 *ptr;
+
+ pad = BitmapBytePad(pCache->w);
+ data = (unsigned char *) malloc(pad * pCache->h);
+ if (!data)
+ return;
+
+ if (infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ ptr = (CARD32 *) data;
+ ptr[0] = pCache->pat0;
+ ptr[1] = pCache->pat1;
+ }
+ else {
+ int patx, paty;
+
+ ptr = (CARD32 *) data;
+ ptr[0] = ptr[2] = pCache->pat0;
+ ptr[1] = ptr[3] = pCache->pat1;
+ for (i = 1; i < 8; i++) {
+ patx = pCache->pat0;
+ paty = pCache->pat1;
+ XAARotateMonoPattern(&patx, &paty, i, 0,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ ptr = (CARD32 *) (data + (pad * i));
+ ptr[0] = ptr[2] = patx;
+ ptr[1] = ptr[3] = paty;
+ }
+ }
+
+ (*infoRec->WriteBitmapToCache) (pScrn, pCache->x, pCache->y,
+ pCache->w, pCache->h, data, pad,
+ pCache->fg, pCache->bg);
+
+ free(data);
+ return;
+ }
+
+ Bpp = pScrn->bitsPerPixel >> 3;
+ h = min(8, pPix->drawable.height);
+ w = min(8, pPix->drawable.width);
+ pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
+
+ data = (unsigned char *) malloc(pad * pCache->h);
+ if (!data)
+ return;
+
+ /* Write and expand horizontally. */
+ for (i = h, dstPtr = data, srcPtr = pPix->devPrivate.ptr; i--;
+ srcPtr += pPix->devKind, dstPtr += pScrn->bitsPerPixel) {
+ nw = w;
+ memcpy(dstPtr, srcPtr, w * Bpp);
+ while (nw != 8) {
+ memcpy(dstPtr + (nw * Bpp), dstPtr, nw * Bpp);
+ nw <<= 1;
+ }
+ }
+ nh = h;
+ /* Expand vertically. */
+ while (nh != 8) {
+ memcpy(data + (nh * pScrn->bitsPerPixel), data,
+ nh * pScrn->bitsPerPixel);
+ nh <<= 1;
+ }
+
+ if (!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ int j;
+ unsigned char *ptr = data + (128 * Bpp);
+
+ memcpy(data + (64 * Bpp), data, 64 * Bpp);
+ for (i = 1; i < 8; i++, ptr += (128 * Bpp)) {
+ for (j = 0; j < 8; j++) {
+ memcpy(ptr + (j * 8) * Bpp, data + (j * 8 + i) * Bpp,
+ (8 - i) * Bpp);
+ memcpy(ptr + (j * 8 + 8 - i) * Bpp, data + j * 8 * Bpp,
+ i * Bpp);
+ }
+ memcpy(ptr + (64 * Bpp), ptr, 64 * Bpp);
+ }
+ }
+
+ (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y,
+ pCache->w, pCache->h, data, pad,
+ pScrn->bitsPerPixel, pScrn->depth);
+
+ free(data);
+}
+
+int
+XAAStippledFillChooser(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ PixmapPtr pPixmap = pGC->stipple;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+
+ if (!(pPriv->flags & REDUCIBILITY_CHECKED) &&
+ (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
+ XAACheckStippleReducibility(pPixmap);
+ }
+
+ if (pPriv->flags & REDUCIBLE_TO_8x8) {
+ if (infoRec->CanDoMono8x8 &&
+ !(infoRec->FillMono8x8PatternSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillMono8x8PatternSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_FG(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillMono8x8PatternSpansFlags)) {
+
+ return DO_MONO_8x8;
+ }
+
+ if (infoRec->CanDoColor8x8 &&
+ !(infoRec->FillColor8x8PatternSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillColor8x8PatternSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillColor8x8PatternSpansFlags)) {
+
+ return DO_COLOR_8x8;
+ }
+ }
+
+ if (infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
+ infoRec->CacheColorExpandDensity) &&
+ !(infoRec->FillCacheExpandSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillCacheExpandSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC, infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_FG(pGC, infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillCacheExpandSpansFlags)) {
+
+ return DO_CACHE_EXPAND;
+ }
+
+ if (infoRec->UsingPixmapCache &&
+ !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
+ infoRec->FillCacheBltSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
+ !(infoRec->FillCacheBltSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillCacheBltSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_CACHE_BLT;
+ }
+
+ if (infoRec->FillColorExpandSpans &&
+ !(infoRec->FillColorExpandSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillColorExpandSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC, infoRec->FillColorExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillColorExpandSpansFlags) &&
+ CHECK_FG(pGC, infoRec->FillColorExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillColorExpandSpansFlags)) {
+
+ return DO_COLOR_EXPAND;
+ }
+
+ return 0;
+}
+
+int
+XAAOpaqueStippledFillChooser(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ PixmapPtr pPixmap = pGC->stipple;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+
+ if (XAA_DEPTH_BUG(pGC))
+ return 0;
+
+ if (!(pPriv->flags & REDUCIBILITY_CHECKED) &&
+ (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
+ XAACheckStippleReducibility(pPixmap);
+ }
+
+ if (pPriv->flags & REDUCIBLE_TO_8x8) {
+ if (infoRec->CanDoMono8x8 &&
+ !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_COLORS(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillMono8x8PatternSpansFlags)) {
+
+ return DO_MONO_8x8;
+ }
+
+ if (infoRec->CanDoColor8x8 &&
+ CHECK_ROP(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillColor8x8PatternSpansFlags)) {
+
+ return DO_COLOR_8x8;
+ }
+ }
+
+ if (infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
+ infoRec->CacheColorExpandDensity) &&
+ !(infoRec->FillCacheExpandSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC, infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_COLORS(pGC, infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillCacheExpandSpansFlags)) {
+
+ return DO_CACHE_EXPAND;
+ }
+
+ if (infoRec->UsingPixmapCache &&
+ !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
+ infoRec->FillCacheBltSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
+ CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_CACHE_BLT;
+ }
+
+ if (infoRec->FillColorExpandSpans &&
+ !(infoRec->FillColorExpandSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC, infoRec->FillColorExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillColorExpandSpansFlags) &&
+ CHECK_COLORS(pGC, infoRec->FillColorExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillColorExpandSpansFlags)) {
+
+ return DO_COLOR_EXPAND;
+ }
+
+ return 0;
+}
+
+int
+XAATiledFillChooser(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ PixmapPtr pPixmap = pGC->tile.pixmap;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+
+ if (IS_OFFSCREEN_PIXMAP(pPixmap) && infoRec->FillCacheBltSpans &&
+ CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_PIXMAP_COPY;
+ }
+
+ if (!(pPriv->flags & REDUCIBILITY_CHECKED) &&
+ (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
+ XAACheckTileReducibility(pPixmap, infoRec->CanDoMono8x8);
+ }
+
+ if (pPriv->flags & REDUCIBLE_TO_8x8) {
+ if ((pPriv->flags & REDUCIBLE_TO_2_COLOR) && infoRec->CanDoMono8x8 &&
+ !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
+ (!(infoRec->FillMono8x8PatternSpansFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(pPriv->fg) && CHECK_RGB_EQUAL(pPriv->bg))) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillMono8x8PatternSpansFlags)) {
+
+ return DO_MONO_8x8;
+ }
+
+ if (infoRec->CanDoColor8x8 &&
+ CHECK_ROP(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillColor8x8PatternSpansFlags)) {
+
+ return DO_COLOR_8x8;
+ }
+ }
+
+ if (infoRec->UsingPixmapCache && infoRec->FillCacheBltSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
+ CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_CACHE_BLT;
+ }
+
+ if (infoRec->FillImageWriteRects &&
+ CHECK_NO_GXCOPY(pGC, infoRec->FillImageWriteRectsFlags) &&
+ CHECK_ROP(pGC, infoRec->FillImageWriteRectsFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillImageWriteRectsFlags) &&
+ CHECK_PLANEMASK(pGC, infoRec->FillImageWriteRectsFlags)) {
+
+ return DO_IMAGE_WRITE;
+ }
+
+ return 0;
+}
+
+static int RotateMasksX[8] = {
+ 0xFFFFFFFF, 0x7F7F7F7F, 0x3F3F3F3F, 0x1F1F1F1F,
+ 0x0F0F0F0F, 0x07070707, 0x03030303, 0x01010101
+};
+
+static int RotateMasksY[4] = {
+ 0xFFFFFFFF, 0x00FFFFFF, 0x0000FFFF, 0x000000FF
+};
+
+void
+XAARotateMonoPattern(int *pat0, int *pat1, int xorg, int yorg, Bool msbfirst)
+{
+ int tmp, mask;
+
+ if (xorg) {
+ if (msbfirst)
+ xorg = 8 - xorg;
+ mask = RotateMasksX[xorg];
+ *pat0 = ((*pat0 >> xorg) & mask) | ((*pat0 << (8 - xorg)) & ~mask);
+ *pat1 = ((*pat1 >> xorg) & mask) | ((*pat1 << (8 - xorg)) & ~mask);
+ }
+ if (yorg >= 4) {
+ tmp = *pat0;
+ *pat0 = *pat1;
+ *pat1 = tmp;
+ yorg -= 4;
+ }
+ if (yorg) {
+ mask = RotateMasksY[yorg];
+ yorg <<= 3;
+ tmp = *pat0;
+ *pat0 = ((*pat0 >> yorg) & mask) | ((*pat1 << (32 - yorg)) & ~mask);
+ *pat1 = ((*pat1 >> yorg) & mask) | ((tmp << (32 - yorg)) & ~mask);
+ }
+}
+
+void
+XAAInvalidatePixmapCache(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
+ int i;
+
+ if (!pCachePriv)
+ return;
+
+ for (i = 0; i < pCachePriv->Num512x512; i++)
+ (pCachePriv->Info512)[i].serialNumber = 0;
+ for (i = 0; i < pCachePriv->Num256x256; i++)
+ (pCachePriv->Info256)[i].serialNumber = 0;
+ for (i = 0; i < pCachePriv->Num128x128; i++)
+ (pCachePriv->Info128)[i].serialNumber = 0;
+ for (i = 0; i < pCachePriv->NumPartial; i++)
+ (pCachePriv->InfoPartial)[i].serialNumber = 0;
+ for (i = 0; i < pCachePriv->NumMono; i++)
+ (pCachePriv->InfoMono)[i].serialNumber = 0;
+ for (i = 0; i < pCachePriv->NumColor; i++)
+ (pCachePriv->InfoColor)[i].serialNumber = 0;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaPict.c b/xorg-server/hw/xfree86/xaa/xaaPict.c
index 1ad75835b..0721768ed 100644
--- a/xorg-server/hw/xfree86/xaa/xaaPict.c
+++ b/xorg-server/hw/xfree86/xaa/xaaPict.c
@@ -1,655 +1,654 @@
-/*
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "picturestr.h"
-#include "glyphstr.h"
-#include "picture.h"
-#include "mipict.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "xaacexp.h"
-#include "xf86fbman.h"
-#include "servermd.h"
-
-Bool
-XAAGetPixelFromRGBA (
- CARD32 *pixel,
- CARD16 red,
- CARD16 green,
- CARD16 blue,
- CARD16 alpha,
- CARD32 format
-){
- int rbits, bbits, gbits, abits;
- int rshift, bshift, gshift, ashift;
-
- *pixel = 0;
-
- if(!PICT_FORMAT_COLOR(format))
- return FALSE;
-
- rbits = PICT_FORMAT_R(format);
- gbits = PICT_FORMAT_G(format);
- bbits = PICT_FORMAT_B(format);
- abits = PICT_FORMAT_A(format);
-
- if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
- bshift = 0;
- gshift = bbits;
- rshift = gshift + gbits;
- ashift = rshift + rbits;
- } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
- rshift = 0;
- gshift = rbits;
- bshift = gshift + gbits;
- ashift = bshift + bbits;
- } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
- bshift = PICT_FORMAT_BPP(format) - bbits;
- gshift = bshift - gbits;
- rshift = gshift - rbits;
- ashift = 0;
- } else
- return FALSE;
-
- *pixel |= ( blue >> (16 - bbits)) << bshift;
- *pixel |= ( red >> (16 - rbits)) << rshift;
- *pixel |= (green >> (16 - gbits)) << gshift;
- *pixel |= (alpha >> (16 - abits)) << ashift;
-
- return TRUE;
-}
-
-
-Bool
-XAAGetRGBAFromPixel(
- CARD32 pixel,
- CARD16 *red,
- CARD16 *green,
- CARD16 *blue,
- CARD16 *alpha,
- CARD32 format
-){
- int rbits, bbits, gbits, abits;
- int rshift, bshift, gshift, ashift;
-
- if(!PICT_FORMAT_COLOR(format))
- return FALSE;
-
- rbits = PICT_FORMAT_R(format);
- gbits = PICT_FORMAT_G(format);
- bbits = PICT_FORMAT_B(format);
- abits = PICT_FORMAT_A(format);
-
- if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
- bshift = 0;
- gshift = bbits;
- rshift = gshift + gbits;
- ashift = rshift + rbits;
- } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
- rshift = 0;
- gshift = rbits;
- bshift = gshift + gbits;
- ashift = bshift + bbits;
- } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
- bshift = PICT_FORMAT_BPP(format) - bbits;
- gshift = bshift - gbits;
- rshift = gshift - rbits;
- ashift = 0;
- } else
- return FALSE;
-
- *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
- while(rbits < 16) {
- *red |= *red >> rbits;
- rbits <<= 1;
- }
-
- *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
- while(gbits < 16) {
- *green |= *green >> gbits;
- gbits <<= 1;
- }
-
- *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
- while(bbits < 16) {
- *blue |= *blue >> bbits;
- bbits <<= 1;
- }
-
- if(abits) {
- *alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits);
- while(abits < 16) {
- *alpha |= *alpha >> abits;
- abits <<= 1;
- }
- } else *alpha = 0xffff;
-
- return TRUE;
-}
-
-/* 8:8:8 + PICT_a8 -> 8:8:8:8 texture */
-
-void
-XAA_888_plus_PICT_a8_to_8888 (
- CARD32 color,
- CARD8 *alphaPtr, /* in bytes */
- int alphaPitch,
- CARD32 *dstPtr,
- int dstPitch, /* in dwords */
- int width,
- int height
-){
- int x;
-
- color &= 0x00ffffff;
-
- while(height--) {
- for(x = 0; x < width; x++)
- dstPtr[x] = color | (alphaPtr[x] << 24);
- dstPtr += dstPitch;
- alphaPtr += alphaPitch;
- }
-}
-
-#define DRAWABLE_IS_ON_CARD(pDraw) \
- (pDraw->type == DRAWABLE_WINDOW || \
- (pDraw->type == DRAWABLE_PIXMAP && IS_OFFSCREEN_PIXMAP(pDraw)))
-
-Bool
-XAADoComposite (
- CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height
-){
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- RegionRec region;
- CARD32 *formats, *dstformats;
- int flags = 0;
- BoxPtr pbox;
- int nbox, w, h;
-
- if(!RegionNumRects(pDst->pCompositeClip))
- return TRUE;
-
- if(!infoRec->pScrn->vtSema || !DRAWABLE_IS_ON_CARD(pDst->pDrawable))
- return FALSE;
-
- if(DRAWABLE_IS_ON_CARD(pSrc->pDrawable))
- return FALSE;
-
- if (pSrc->transform || (pMask && pMask->transform))
- return FALSE;
-
- if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
- return FALSE;
-
- if ((pSrc->repeat && pSrc->repeatType != RepeatNormal) ||
- (pMask && pMask->repeat && pMask->repeatType != RepeatNormal))
- {
- return FALSE;
- }
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if(pMask) {
- if(pMask->componentAlpha)
- return FALSE;
-
- /* for now we only do it if there is a 1x1 (solid) source */
-
- if((pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1)) {
- CARD16 red, green, blue, alpha;
- CARD32 pixel =
- *((CARD32*)(((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr));
-
- if(!XAAGetRGBAFromPixel(pixel,&red,&green,&blue,&alpha,pSrc->format))
- return FALSE;
-
- xMask += pMask->pDrawable->x;
- yMask += pMask->pDrawable->y;
-
- /* pull out color expandable operations here */
- if((pMask->format == PICT_a1) && (alpha == 0xffff) &&
- (op == PictOpOver) && infoRec->WriteBitmap && !pMask->repeat &&
- !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) &&
- (!(infoRec->WriteBitmapFlags & RGB_EQUAL) ||
- ((red == green) && (green == blue))))
- {
- PixmapPtr pPix = (PixmapPtr)(pMask->pDrawable);
- int skipleft;
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- return TRUE;
-
- nbox = RegionNumRects(&region);
- pbox = RegionRects(&region);
-
- if(!nbox)
- return TRUE;
-
- XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format);
-
- xMask -= xDst;
- yMask -= yDst;
-
- while(nbox--) {
- skipleft = pbox->x1 + xMask;
-
- (*infoRec->WriteBitmap)(infoRec->pScrn,
- pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- (unsigned char*)(pPix->devPrivate.ptr) +
- (pPix->devKind * (pbox->y1 + yMask)) +
- ((skipleft >> 3) & ~3), pPix->devKind,
- skipleft & 31, pixel, -1, GXcopy, ~0);
- pbox++;
- }
-
- /* WriteBitmap sets the Sync flag */
- RegionUninit(&region);
- return TRUE;
- }
-
- formats = infoRec->CPUToScreenAlphaTextureFormats;
- dstformats = infoRec->CPUToScreenAlphaTextureDstFormats;
- if(!formats || !dstformats)
- return FALSE;
-
- w = pMask->pDrawable->width;
- h = pMask->pDrawable->height;
-
- if(pMask->repeat) {
- if((infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_TILE) ||
- ((infoRec->CPUToScreenAlphaTextureFlags &
- XAA_RENDER_POWER_OF_2_TILE_ONLY) &&
- ((h & (h - 1)) || (w & (w - 1)))))
- {
- return FALSE;
- }
- flags |= XAA_RENDER_REPEAT;
- }
-
- if((alpha != 0xffff) &&
- (infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA))
- return FALSE;
-
- while(*formats != pMask->format) {
- if(!(*formats)) return FALSE;
- formats++;
- }
- while(*dstformats != pDst->format) {
- if(!(*dstformats))
- return FALSE;
- dstformats++;
- }
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- return TRUE;
-
- nbox = RegionNumRects(&region);
- pbox = RegionRects(&region);
-
- if(!nbox) {
- RegionUninit(&region);
- return TRUE;
- }
-
- if(!(infoRec->SetupForCPUToScreenAlphaTexture2)(infoRec->pScrn,
- op, red, green, blue, alpha, pMask->format,
- pDst->format,
- ((PixmapPtr)(pMask->pDrawable))->devPrivate.ptr,
- ((PixmapPtr)(pMask->pDrawable))->devKind,
- w, h, flags))
- {
- RegionUninit(&region);
- return FALSE;
- }
-
- xMask -= xDst;
- yMask -= yDst;
-
- while(nbox--) {
- (*infoRec->SubsequentCPUToScreenAlphaTexture)(infoRec->pScrn,
- pbox->x1, pbox->y1,
- pbox->x1 + xMask, pbox->y1 + yMask,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- pbox++;
- }
-
- SET_SYNC_FLAG(infoRec);
- RegionUninit(&region);
- return TRUE;
- }
- } else {
- formats = infoRec->CPUToScreenTextureFormats;
- dstformats = infoRec->CPUToScreenTextureDstFormats;
- if(!formats || !dstformats)
- return FALSE;
-
- w = pSrc->pDrawable->width;
- h = pSrc->pDrawable->height;
-
- if(pSrc->repeat) {
- if((infoRec->CPUToScreenTextureFlags & XAA_RENDER_NO_TILE) ||
- ((infoRec->CPUToScreenTextureFlags &
- XAA_RENDER_POWER_OF_2_TILE_ONLY) &&
- ((h & (h - 1)) || (w & (w - 1)))))
- {
- return FALSE;
- }
- flags |= XAA_RENDER_REPEAT;
- }
-
- while(*formats != pSrc->format) {
- if(!(*formats)) return FALSE;
- formats++;
- }
- while(*dstformats != pDst->format) {
- if(!(*dstformats))
- return FALSE;
- dstformats++;
- }
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- return TRUE;
-
- nbox = RegionNumRects(&region);
- pbox = RegionRects(&region);
-
- if(!nbox) {
- RegionUninit(&region);
- return TRUE;
- }
-
- if(!(infoRec->SetupForCPUToScreenTexture2)(infoRec->pScrn,
- op, pSrc->format, pDst->format,
- ((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr,
- ((PixmapPtr)(pSrc->pDrawable))->devKind,
- w, h, flags))
- {
- RegionUninit(&region);
- return FALSE;
- }
-
-
- xSrc -= xDst;
- ySrc -= yDst;
-
- while(nbox--) {
- (*infoRec->SubsequentCPUToScreenTexture)(infoRec->pScrn,
- pbox->x1, pbox->y1,
- pbox->x1 + xSrc, pbox->y1 + ySrc,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- pbox++;
- }
-
- SET_SYNC_FLAG(infoRec);
- RegionUninit(&region);
- return TRUE;
- }
-
-
- return FALSE;
-}
-
-static void
-XAACompositeSrcCopy (PicturePtr pSrc,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- int i, nbox;
- int xoff, yoff;
- BoxPtr pbox;
- DDXPointPtr pptSrc;
- RegionRec region;
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
- xSrc, ySrc, 0, 0, xDst, yDst,
- width, height))
- return;
-
- nbox = RegionNumRects(&region);
- pbox = RegionRects(&region);
-
- if(!nbox) {
- RegionUninit(&region);
- return;
- }
- pptSrc = malloc(sizeof(DDXPointRec) * nbox);
- if (!pptSrc) {
- RegionUninit(&region);
- return;
- }
- xoff = xSrc - xDst;
- yoff = ySrc - yDst;
- for (i = 0; i < nbox; i++) {
- pptSrc[i].x = pbox[i].x1 + xoff;
- pptSrc[i].y = pbox[i].y1 + yoff;
- }
-
- infoRec->ScratchGC.planemask = ~0L;
- infoRec->ScratchGC.alu = GXcopy;
-
- XAADoBitBlt(pSrc->pDrawable, pDst->pDrawable, &infoRec->ScratchGC, &region,
- pptSrc);
-
- free(pptSrc);
- RegionUninit(&region);
- return;
-}
-
-void
-XAAComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAA_RENDER_PROLOGUE(pScreen, Composite);
-
- if(!pMask && infoRec->pScrn->vtSema &&
- infoRec->ScreenToScreenBitBlt &&
- pSrc->pDrawable &&
- DRAWABLE_IS_ON_CARD(pSrc->pDrawable) &&
- DRAWABLE_IS_ON_CARD(pDst->pDrawable) &&
- !pSrc->transform &&
- (!pSrc->repeat || (xSrc >= 0 && ySrc >= 0 &&
- xSrc+width<=pSrc->pDrawable->width &&
- ySrc+height<=pSrc->pDrawable->height)) &&
- ((op == PictOpSrc &&
- ((pSrc->format==pDst->format) ||
- (pSrc->format==PICT_a8r8g8b8 && pDst->format==PICT_x8r8g8b8) ||
- (pSrc->format==PICT_a8b8g8r8 && pDst->format==PICT_x8b8g8r8))) ||
- (op == PictOpOver && !pSrc->alphaMap && !pDst->alphaMap &&
- pSrc->format==pDst->format &&
- (pSrc->format==PICT_x8r8g8b8 || pSrc->format==PICT_x8b8g8r8))))
- {
- XAACompositeSrcCopy(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height);
- } else if(!pSrc->pDrawable || (pMask && !pMask->pDrawable) ||
- !infoRec->Composite ||
- !(*infoRec->Composite)(op, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- {
- if(infoRec->pScrn->vtSema &&
- ((pSrc->pDrawable &&
- (pSrc->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
- pDst->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
- SYNC_CHECK(pDst->pDrawable);
- }
- (*GetPictureScreen(pScreen)->Composite) (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
- }
-
- if(pDst->pDrawable->type == DRAWABLE_PIXMAP)
- (XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst->pDrawable)))->flags |= DIRTY;
-
- XAA_RENDER_EPILOGUE(pScreen, Composite, XAAComposite);
-}
-
-Bool
-XAADoGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
-
- if(!RegionNumRects(pDst->pCompositeClip))
- return TRUE;
-
- if(!infoRec->pScrn->vtSema ||
- ((pDst->pDrawable->type != DRAWABLE_WINDOW) &&
- !IS_OFFSCREEN_PIXMAP(pDst->pDrawable)))
- return FALSE;
-
- if((pSrc->pDrawable->type != DRAWABLE_PIXMAP) ||
- IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))
- return FALSE;
-
- /*
- * If it looks like we have a chance of being able to draw these
- * glyphs with an accelerated Composite, do that now to avoid
- * unneeded and costly syncs.
- */
- if(maskFormat) {
- if(!infoRec->CPUToScreenAlphaTextureFormats)
- return FALSE;
- } else {
- if(!infoRec->CPUToScreenTextureFormats)
- return FALSE;
- }
-
- miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
-
- return TRUE;
-}
-
-
-void
-XAAGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAA_RENDER_PROLOGUE(pScreen, Glyphs);
-
- if(!pSrc->pDrawable || !infoRec->Glyphs ||
- !(*infoRec->Glyphs)(op, pSrc, pDst, maskFormat,
- xSrc, ySrc, nlist, list, glyphs))
- {
- if(infoRec->pScrn->vtSema &&
- ((pSrc->pDrawable &&
- (pSrc->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
- pDst->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
- SYNC_CHECK(pDst->pDrawable);
- }
- (*GetPictureScreen(pScreen)->Glyphs) (op, pSrc, pDst, maskFormat,
- xSrc, ySrc, nlist, list, glyphs);
- }
-
- if(pDst->pDrawable->type == DRAWABLE_PIXMAP)
- (XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst->pDrawable)))->flags |= DIRTY;
-
- XAA_RENDER_EPILOGUE(pScreen, Glyphs, XAAGlyphs);
-}
+/*
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "picturestr.h"
+#include "glyphstr.h"
+#include "picture.h"
+#include "mipict.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "xaacexp.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+
+Bool
+XAAGetPixelFromRGBA(CARD32 *pixel,
+ CARD16 red,
+ CARD16 green, CARD16 blue, CARD16 alpha, CARD32 format)
+{
+ int rbits, bbits, gbits, abits;
+ int rshift, bshift, gshift, ashift;
+
+ *pixel = 0;
+
+ if (!PICT_FORMAT_COLOR(format))
+ return FALSE;
+
+ rbits = PICT_FORMAT_R(format);
+ gbits = PICT_FORMAT_G(format);
+ bbits = PICT_FORMAT_B(format);
+ abits = PICT_FORMAT_A(format);
+
+ if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
+ bshift = 0;
+ gshift = bbits;
+ rshift = gshift + gbits;
+ ashift = rshift + rbits;
+ }
+ else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
+ rshift = 0;
+ gshift = rbits;
+ bshift = gshift + gbits;
+ ashift = bshift + bbits;
+ }
+ else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
+ bshift = PICT_FORMAT_BPP(format) - bbits;
+ gshift = bshift - gbits;
+ rshift = gshift - rbits;
+ ashift = 0;
+ }
+ else
+ return FALSE;
+
+ *pixel |= (blue >> (16 - bbits)) << bshift;
+ *pixel |= (red >> (16 - rbits)) << rshift;
+ *pixel |= (green >> (16 - gbits)) << gshift;
+ *pixel |= (alpha >> (16 - abits)) << ashift;
+
+ return TRUE;
+}
+
+Bool
+XAAGetRGBAFromPixel(CARD32 pixel,
+ CARD16 *red,
+ CARD16 *green, CARD16 *blue, CARD16 *alpha, CARD32 format)
+{
+ int rbits, bbits, gbits, abits;
+ int rshift, bshift, gshift, ashift;
+
+ if (!PICT_FORMAT_COLOR(format))
+ return FALSE;
+
+ rbits = PICT_FORMAT_R(format);
+ gbits = PICT_FORMAT_G(format);
+ bbits = PICT_FORMAT_B(format);
+ abits = PICT_FORMAT_A(format);
+
+ if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
+ bshift = 0;
+ gshift = bbits;
+ rshift = gshift + gbits;
+ ashift = rshift + rbits;
+ }
+ else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
+ rshift = 0;
+ gshift = rbits;
+ bshift = gshift + gbits;
+ ashift = bshift + bbits;
+ }
+ else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
+ bshift = PICT_FORMAT_BPP(format) - bbits;
+ gshift = bshift - gbits;
+ rshift = gshift - rbits;
+ ashift = 0;
+ }
+ else
+ return FALSE;
+
+ *red = ((pixel >> rshift) & ((1 << rbits) - 1)) << (16 - rbits);
+ while (rbits < 16) {
+ *red |= *red >> rbits;
+ rbits <<= 1;
+ }
+
+ *green = ((pixel >> gshift) & ((1 << gbits) - 1)) << (16 - gbits);
+ while (gbits < 16) {
+ *green |= *green >> gbits;
+ gbits <<= 1;
+ }
+
+ *blue = ((pixel >> bshift) & ((1 << bbits) - 1)) << (16 - bbits);
+ while (bbits < 16) {
+ *blue |= *blue >> bbits;
+ bbits <<= 1;
+ }
+
+ if (abits) {
+ *alpha = ((pixel >> ashift) & ((1 << abits) - 1)) << (16 - abits);
+ while (abits < 16) {
+ *alpha |= *alpha >> abits;
+ abits <<= 1;
+ }
+ }
+ else
+ *alpha = 0xffff;
+
+ return TRUE;
+}
+
+/* 8:8:8 + PICT_a8 -> 8:8:8:8 texture */
+
+void
+XAA_888_plus_PICT_a8_to_8888(CARD32 color, CARD8 *alphaPtr, /* in bytes */
+ int alphaPitch, CARD32 *dstPtr, int dstPitch, /* in dwords */
+ int width, int height)
+{
+ int x;
+
+ color &= 0x00ffffff;
+
+ while (height--) {
+ for (x = 0; x < width; x++)
+ dstPtr[x] = color | (alphaPtr[x] << 24);
+ dstPtr += dstPitch;
+ alphaPtr += alphaPitch;
+ }
+}
+
+#define DRAWABLE_IS_ON_CARD(pDraw) \
+ (pDraw->type == DRAWABLE_WINDOW || \
+ (pDraw->type == DRAWABLE_PIXMAP && IS_OFFSCREEN_PIXMAP(pDraw)))
+
+Bool
+XAADoComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ RegionRec region;
+ CARD32 *formats, *dstformats;
+ int flags = 0;
+ BoxPtr pbox;
+ int nbox, w, h;
+
+ if (!RegionNumRects(pDst->pCompositeClip))
+ return TRUE;
+
+ if (!infoRec->pScrn->vtSema || !DRAWABLE_IS_ON_CARD(pDst->pDrawable))
+ return FALSE;
+
+ if (DRAWABLE_IS_ON_CARD(pSrc->pDrawable))
+ return FALSE;
+
+ if (pSrc->transform || (pMask && pMask->transform))
+ return FALSE;
+
+ if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
+ return FALSE;
+
+ if ((pSrc->repeat && pSrc->repeatType != RepeatNormal) ||
+ (pMask && pMask->repeat && pMask->repeatType != RepeatNormal)) {
+ return FALSE;
+ }
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if (pMask) {
+ if (pMask->componentAlpha)
+ return FALSE;
+
+ /* for now we only do it if there is a 1x1 (solid) source */
+
+ if ((pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1)) {
+ CARD16 red, green, blue, alpha;
+ CARD32 pixel =
+ *((CARD32 *) (((PixmapPtr) (pSrc->pDrawable))->devPrivate.ptr));
+
+ if (!XAAGetRGBAFromPixel
+ (pixel, &red, &green, &blue, &alpha, pSrc->format))
+ return FALSE;
+
+ xMask += pMask->pDrawable->x;
+ yMask += pMask->pDrawable->y;
+
+ /* pull out color expandable operations here */
+ if ((pMask->format == PICT_a1) && (alpha == 0xffff) &&
+ (op == PictOpOver) && infoRec->WriteBitmap && !pMask->repeat &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) &&
+ (!(infoRec->WriteBitmapFlags & RGB_EQUAL) ||
+ ((red == green) && (green == blue)))) {
+ PixmapPtr pPix = (PixmapPtr) (pMask->pDrawable);
+ int skipleft;
+
+ if (!miComputeCompositeRegion(&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst,
+ yDst, width, height))
+ return TRUE;
+
+ nbox = RegionNumRects(&region);
+ pbox = RegionRects(&region);
+
+ if (!nbox)
+ return TRUE;
+
+ XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format);
+
+ xMask -= xDst;
+ yMask -= yDst;
+
+ while (nbox--) {
+ skipleft = pbox->x1 + xMask;
+
+ (*infoRec->WriteBitmap) (infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1,
+ (unsigned char *) (pPix->
+ devPrivate.
+ ptr) +
+ (pPix->devKind *
+ (pbox->y1 + yMask)) +
+ ((skipleft >> 3) & ~3),
+ pPix->devKind, skipleft & 31,
+ pixel, -1, GXcopy, ~0);
+ pbox++;
+ }
+
+ /* WriteBitmap sets the Sync flag */
+ RegionUninit(&region);
+ return TRUE;
+ }
+
+ formats = infoRec->CPUToScreenAlphaTextureFormats;
+ dstformats = infoRec->CPUToScreenAlphaTextureDstFormats;
+ if (!formats || !dstformats)
+ return FALSE;
+
+ w = pMask->pDrawable->width;
+ h = pMask->pDrawable->height;
+
+ if (pMask->repeat) {
+ if ((infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_TILE)
+ ||
+ ((infoRec->
+ CPUToScreenAlphaTextureFlags &
+ XAA_RENDER_POWER_OF_2_TILE_ONLY) && ((h & (h - 1)) ||
+ (w & (w - 1))))) {
+ return FALSE;
+ }
+ flags |= XAA_RENDER_REPEAT;
+ }
+
+ if ((alpha != 0xffff) &&
+ (infoRec->
+ CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA))
+ return FALSE;
+
+ while (*formats != pMask->format) {
+ if (!(*formats))
+ return FALSE;
+ formats++;
+ }
+ while (*dstformats != pDst->format) {
+ if (!(*dstformats))
+ return FALSE;
+ dstformats++;
+ }
+
+ if (!miComputeCompositeRegion(&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return TRUE;
+
+ nbox = RegionNumRects(&region);
+ pbox = RegionRects(&region);
+
+ if (!nbox) {
+ RegionUninit(&region);
+ return TRUE;
+ }
+
+ if (!(infoRec->SetupForCPUToScreenAlphaTexture2) (infoRec->pScrn,
+ op, red, green,
+ blue, alpha,
+ pMask->format,
+ pDst->format,
+ ((PixmapPtr)
+ (pMask->
+ pDrawable))->
+ devPrivate.ptr,
+ ((PixmapPtr)
+ (pMask->
+ pDrawable))->
+ devKind, w, h,
+ flags)) {
+ RegionUninit(&region);
+ return FALSE;
+ }
+
+ xMask -= xDst;
+ yMask -= yDst;
+
+ while (nbox--) {
+ (*infoRec->SubsequentCPUToScreenAlphaTexture) (infoRec->pScrn,
+ pbox->x1,
+ pbox->y1,
+ pbox->x1 + xMask,
+ pbox->y1 + yMask,
+ pbox->x2 -
+ pbox->x1,
+ pbox->y2 -
+ pbox->y1);
+ pbox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+ RegionUninit(&region);
+ return TRUE;
+ }
+ }
+ else {
+ formats = infoRec->CPUToScreenTextureFormats;
+ dstformats = infoRec->CPUToScreenTextureDstFormats;
+ if (!formats || !dstformats)
+ return FALSE;
+
+ w = pSrc->pDrawable->width;
+ h = pSrc->pDrawable->height;
+
+ if (pSrc->repeat) {
+ if ((infoRec->CPUToScreenTextureFlags & XAA_RENDER_NO_TILE) ||
+ ((infoRec->CPUToScreenTextureFlags &
+ XAA_RENDER_POWER_OF_2_TILE_ONLY) &&
+ ((h & (h - 1)) || (w & (w - 1))))) {
+ return FALSE;
+ }
+ flags |= XAA_RENDER_REPEAT;
+ }
+
+ while (*formats != pSrc->format) {
+ if (!(*formats))
+ return FALSE;
+ formats++;
+ }
+ while (*dstformats != pDst->format) {
+ if (!(*dstformats))
+ return FALSE;
+ dstformats++;
+ }
+
+ if (!miComputeCompositeRegion(&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return TRUE;
+
+ nbox = RegionNumRects(&region);
+ pbox = RegionRects(&region);
+
+ if (!nbox) {
+ RegionUninit(&region);
+ return TRUE;
+ }
+
+ if (!(infoRec->SetupForCPUToScreenTexture2) (infoRec->pScrn,
+ op, pSrc->format,
+ pDst->format,
+ ((PixmapPtr)
+ (pSrc->pDrawable))->
+ devPrivate.ptr,
+ ((PixmapPtr)
+ (pSrc->pDrawable))->
+ devKind, w, h, flags)) {
+ RegionUninit(&region);
+ return FALSE;
+ }
+
+ xSrc -= xDst;
+ ySrc -= yDst;
+
+ while (nbox--) {
+ (*infoRec->SubsequentCPUToScreenTexture) (infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x1 + xSrc,
+ pbox->y1 + ySrc,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+ RegionUninit(&region);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+XAACompositeSrcCopy(PicturePtr pSrc,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ int i, nbox;
+ int xoff, yoff;
+ BoxPtr pbox;
+ DDXPointPtr pptSrc;
+ RegionRec region;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if (!miComputeCompositeRegion(&region, pSrc, NULL, pDst,
+ xSrc, ySrc, 0, 0, xDst, yDst, width, height))
+ return;
+
+ nbox = RegionNumRects(&region);
+ pbox = RegionRects(&region);
+
+ if (!nbox) {
+ RegionUninit(&region);
+ return;
+ }
+ pptSrc = malloc(sizeof(DDXPointRec) * nbox);
+ if (!pptSrc) {
+ RegionUninit(&region);
+ return;
+ }
+ xoff = xSrc - xDst;
+ yoff = ySrc - yDst;
+ for (i = 0; i < nbox; i++) {
+ pptSrc[i].x = pbox[i].x1 + xoff;
+ pptSrc[i].y = pbox[i].y1 + yoff;
+ }
+
+ infoRec->ScratchGC.planemask = ~0L;
+ infoRec->ScratchGC.alu = GXcopy;
+
+ XAADoBitBlt(pSrc->pDrawable, pDst->pDrawable, &infoRec->ScratchGC, &region,
+ pptSrc);
+
+ free(pptSrc);
+ RegionUninit(&region);
+ return;
+}
+
+void
+XAAComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ XAA_RENDER_PROLOGUE(pScreen, Composite);
+
+ if (!pMask && infoRec->pScrn->vtSema &&
+ infoRec->ScreenToScreenBitBlt &&
+ pSrc->pDrawable &&
+ DRAWABLE_IS_ON_CARD(pSrc->pDrawable) &&
+ DRAWABLE_IS_ON_CARD(pDst->pDrawable) &&
+ !pSrc->transform &&
+ (!pSrc->repeat || (xSrc >= 0 && ySrc >= 0 &&
+ xSrc + width <= pSrc->pDrawable->width &&
+ ySrc + height <= pSrc->pDrawable->height)) &&
+ ((op == PictOpSrc &&
+ ((pSrc->format == pDst->format) ||
+ (pSrc->format == PICT_a8r8g8b8 && pDst->format == PICT_x8r8g8b8) ||
+ (pSrc->format == PICT_a8b8g8r8 && pDst->format == PICT_x8b8g8r8))) ||
+ (op == PictOpOver && !pSrc->alphaMap && !pDst->alphaMap &&
+ pSrc->format == pDst->format &&
+ (pSrc->format == PICT_x8r8g8b8 || pSrc->format == PICT_x8b8g8r8)))) {
+ XAACompositeSrcCopy(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height);
+ }
+ else if (!pSrc->pDrawable || (pMask && !pMask->pDrawable) ||
+ !infoRec->Composite ||
+ !(*infoRec->Composite) (op, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height)) {
+ if (infoRec->pScrn->vtSema &&
+ ((pSrc->pDrawable &&
+ (pSrc->pDrawable->type == DRAWABLE_WINDOW ||
+ IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
+ pDst->pDrawable->type == DRAWABLE_WINDOW ||
+ IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
+ SYNC_CHECK(pDst->pDrawable);
+ }
+ (*GetPictureScreen(pScreen)->Composite) (op,
+ pSrc,
+ pMask,
+ pDst,
+ xSrc,
+ ySrc,
+ xMask,
+ yMask,
+ xDst, yDst, width, height);
+ }
+
+ if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ (XAA_GET_PIXMAP_PRIVATE((PixmapPtr) (pDst->pDrawable)))->flags |= DIRTY;
+
+ XAA_RENDER_EPILOGUE(pScreen, Composite, XAAComposite);
+}
+
+Bool
+XAADoGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ if (!RegionNumRects(pDst->pCompositeClip))
+ return TRUE;
+
+ if (!infoRec->pScrn->vtSema ||
+ ((pDst->pDrawable->type != DRAWABLE_WINDOW) &&
+ !IS_OFFSCREEN_PIXMAP(pDst->pDrawable)))
+ return FALSE;
+
+ if ((pSrc->pDrawable->type != DRAWABLE_PIXMAP) ||
+ IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))
+ return FALSE;
+
+ /*
+ * If it looks like we have a chance of being able to draw these
+ * glyphs with an accelerated Composite, do that now to avoid
+ * unneeded and costly syncs.
+ */
+ if (maskFormat) {
+ if (!infoRec->CPUToScreenAlphaTextureFormats)
+ return FALSE;
+ }
+ else {
+ if (!infoRec->CPUToScreenTextureFormats)
+ return FALSE;
+ }
+
+ miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
+
+ return TRUE;
+}
+
+void
+XAAGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ XAA_RENDER_PROLOGUE(pScreen, Glyphs);
+
+ if (!pSrc->pDrawable || !infoRec->Glyphs ||
+ !(*infoRec->Glyphs) (op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, nlist, list, glyphs)) {
+ if (infoRec->pScrn->vtSema &&
+ ((pSrc->pDrawable &&
+ (pSrc->pDrawable->type == DRAWABLE_WINDOW ||
+ IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
+ pDst->pDrawable->type == DRAWABLE_WINDOW ||
+ IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
+ SYNC_CHECK(pDst->pDrawable);
+ }
+ (*GetPictureScreen(pScreen)->Glyphs) (op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, nlist, list, glyphs);
+ }
+
+ if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ (XAA_GET_PIXMAP_PRIVATE((PixmapPtr) (pDst->pDrawable)))->flags |= DIRTY;
+
+ XAA_RENDER_EPILOGUE(pScreen, Glyphs, XAAGlyphs);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaROP.c b/xorg-server/hw/xfree86/xaa/xaaROP.c
index 155daa4ee..3b6ec9385 100644
--- a/xorg-server/hw/xfree86/xaa/xaaROP.c
+++ b/xorg-server/hw/xfree86/xaa/xaaROP.c
@@ -13,104 +13,102 @@
#include "xaa.h"
#include "xaalocal.h"
-
-int XAACopyROP[16] =
-{
- ROP_0, /* GXclear */
- ROP_DSa, /* GXand */
- ROP_SDna, /* GXandReverse */
- ROP_S, /* GXcopy */
- ROP_DSna, /* GXandInverted */
- ROP_D, /* GXnoop */
- ROP_DSx, /* GXxor */
- ROP_DSo, /* GXor */
- ROP_DSon, /* GXnor */
- ROP_DSxn, /* GXequiv */
- ROP_Dn, /* GXinvert*/
- ROP_SDno, /* GXorReverse */
- ROP_Sn, /* GXcopyInverted */
- ROP_DSno, /* GXorInverted */
- ROP_DSan, /* GXnand */
- ROP_1 /* GXset */
+int XAACopyROP[16] = {
+ ROP_0, /* GXclear */
+ ROP_DSa, /* GXand */
+ ROP_SDna, /* GXandReverse */
+ ROP_S, /* GXcopy */
+ ROP_DSna, /* GXandInverted */
+ ROP_D, /* GXnoop */
+ ROP_DSx, /* GXxor */
+ ROP_DSo, /* GXor */
+ ROP_DSon, /* GXnor */
+ ROP_DSxn, /* GXequiv */
+ ROP_Dn, /* GXinvert */
+ ROP_SDno, /* GXorReverse */
+ ROP_Sn, /* GXcopyInverted */
+ ROP_DSno, /* GXorInverted */
+ ROP_DSan, /* GXnand */
+ ROP_1 /* GXset */
};
-int XAACopyROP_PM[16] =
-{
- ROP_0, /* not used */
- ROP_DSPnoa,
- ROP_DPSnaon,
- ROP_DPSDxax,
- ROP_DPSana,
- ROP_D, /* not used */
- ROP_DPSax,
- ROP_DPSao,
- ROP_DPSaon,
- ROP_DPSaxn,
- ROP_Dn, /* not used */
- ROP_DPSanan,
- ROP_PSDPxox, /* is that correct ? */
- ROP_DPSnao,
- ROP_DSPnoan,
- ROP_1 /* not used */
+int XAACopyROP_PM[16] = {
+ ROP_0, /* not used */
+ ROP_DSPnoa,
+ ROP_DPSnaon,
+ ROP_DPSDxax,
+ ROP_DPSana,
+ ROP_D, /* not used */
+ ROP_DPSax,
+ ROP_DPSao,
+ ROP_DPSaon,
+ ROP_DPSaxn,
+ ROP_Dn, /* not used */
+ ROP_DPSanan,
+ ROP_PSDPxox, /* is that correct ? */
+ ROP_DPSnao,
+ ROP_DSPnoan,
+ ROP_1 /* not used */
};
-
-int XAAPatternROP[16]=
-{
- ROP_0,
- ROP_DPa,
- ROP_PDna,
- ROP_P,
- ROP_DPna,
- ROP_D,
- ROP_DPx,
- ROP_DPo,
- ROP_DPon,
- ROP_PDxn,
- ROP_Dn,
- ROP_PDno,
- ROP_Pn,
- ROP_DPno,
- ROP_DPan,
- ROP_1
+int XAAPatternROP[16] = {
+ ROP_0,
+ ROP_DPa,
+ ROP_PDna,
+ ROP_P,
+ ROP_DPna,
+ ROP_D,
+ ROP_DPx,
+ ROP_DPo,
+ ROP_DPon,
+ ROP_PDxn,
+ ROP_Dn,
+ ROP_PDno,
+ ROP_Pn,
+ ROP_DPno,
+ ROP_DPan,
+ ROP_1
};
-int XAAPatternROP_PM[16] =
-{
- ROP_DPna,
- ROP_DPSnoa,
- ROP_DSPnaon,
- ROP_DSPDxax,
- ROP_DPSana,
- ROP_D,
- ROP_DPSax,
- ROP_DPSao,
- ROP_DPSaon,
- ROP_DPSaxn,
- ROP_DPx,
- ROP_DPSanan,
- ROP_SPDSxox, /* is that correct ? */
- ROP_DSPnao,
- ROP_DPSnoan,
- ROP_DPo
+int XAAPatternROP_PM[16] = {
+ ROP_DPna,
+ ROP_DPSnoa,
+ ROP_DSPnaon,
+ ROP_DSPDxax,
+ ROP_DPSana,
+ ROP_D,
+ ROP_DPSax,
+ ROP_DPSao,
+ ROP_DPSaon,
+ ROP_DPSaxn,
+ ROP_DPx,
+ ROP_DPSanan,
+ ROP_SPDSxox, /* is that correct ? */
+ ROP_DSPnao,
+ ROP_DPSnoan,
+ ROP_DPo
};
-int XAAGetCopyROP(int i)
+int
+XAAGetCopyROP(int i)
{
return XAACopyROP[i];
}
-int XAAGetCopyROP_PM(int i)
+int
+XAAGetCopyROP_PM(int i)
{
return XAACopyROP_PM[i];
}
-int XAAGetPatternROP(int i)
+int
+XAAGetPatternROP(int i)
{
return XAAPatternROP[i];
}
-int XAAGetPatternROP_PM(int i)
+int
+XAAGetPatternROP_PM(int i)
{
return XAAPatternROP_PM[i];
}
@@ -120,65 +118,65 @@ XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
int ret = 0;
-
+
pm &= infoRec->FullPlanemasks[pScrn->depth - 1];
- if(pm == infoRec->FullPlanemasks[pScrn->depth - 1]) {
- if(!NO_SRC_ROP(*rop))
- ret |= ROP_PAT;
- *rop = XAAPatternROP[*rop];
- } else {
- switch(*rop) {
- case GXnoop:
- break;
- case GXset:
- case GXclear:
- case GXinvert:
- ret |= ROP_PAT;
- *fg = pm;
- if(*bg != -1)
- *bg = pm;
- break;
- default:
- ret |= ROP_PAT | ROP_SRC;
- break;
- }
- *rop = XAAPatternROP_PM[*rop];
+ if (pm == infoRec->FullPlanemasks[pScrn->depth - 1]) {
+ if (!NO_SRC_ROP(*rop))
+ ret |= ROP_PAT;
+ *rop = XAAPatternROP[*rop];
+ }
+ else {
+ switch (*rop) {
+ case GXnoop:
+ break;
+ case GXset:
+ case GXclear:
+ case GXinvert:
+ ret |= ROP_PAT;
+ *fg = pm;
+ if (*bg != -1)
+ *bg = pm;
+ break;
+ default:
+ ret |= ROP_PAT | ROP_SRC;
+ break;
+ }
+ *rop = XAAPatternROP_PM[*rop];
}
return ret;
}
-
int
XAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
int ret = 0;
-
+
pm &= infoRec->FullPlanemasks[pScrn->depth - 1];
- if(pm == infoRec->FullPlanemasks[pScrn->depth - 1]) {
- if(!NO_SRC_ROP(*rop))
- ret |= ROP_PAT;
- *rop = XAAPatternROP[*rop];
- } else {
- switch(*rop) {
- case GXnoop:
- break;
- case GXset:
- case GXclear:
- case GXinvert:
- ret |= ROP_PAT;
- *fg = pm;
- break;
- default:
- ret |= ROP_PAT | ROP_SRC;
- break;
- }
- *rop = XAAPatternROP_PM[*rop];
+ if (pm == infoRec->FullPlanemasks[pScrn->depth - 1]) {
+ if (!NO_SRC_ROP(*rop))
+ ret |= ROP_PAT;
+ *rop = XAAPatternROP[*rop];
+ }
+ else {
+ switch (*rop) {
+ case GXnoop:
+ break;
+ case GXset:
+ case GXclear:
+ case GXinvert:
+ ret |= ROP_PAT;
+ *fg = pm;
+ break;
+ default:
+ ret |= ROP_PAT | ROP_SRC;
+ break;
+ }
+ *rop = XAAPatternROP_PM[*rop];
}
return ret;
}
-
diff --git a/xorg-server/hw/xfree86/xaa/xaaRect.c b/xorg-server/hw/xfree86/xaa/xaaRect.c
index 988dbf608..002090085 100644
--- a/xorg-server/hw/xfree86/xaa/xaaRect.c
+++ b/xorg-server/hw/xfree86/xaa/xaaRect.c
@@ -1,136 +1,121 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-
-/*
- Much of this file based on code by
- Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
-*/
-
-
-void
-XAAPolyRectangleThinSolid(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int nClipRects; /* number of clip rectangles */
- BoxPtr pClipRects; /* points to the list of clip rects */
- int xOrigin; /* Drawables x origin */
- int yOrigin; /* Drawables x origin */
- xRectangle *pRect; /* list of rects */
- int nRects; /* running count of number of rects */
- int origX1, origY1; /* original rectangle's U/L corner */
- int origX2, origY2; /* original rectangle's L/R corner */
- int clippedX1; /* clipped rectangle's left x */
- int clippedY1; /* clipped rectangle's top y */
- int clippedX2; /* clipped rectangle's right x */
- int clippedY2; /* clipped rectangle's bottom y */
- int clipXMin; /* upper left corner of clip rect */
- int clipYMin; /* upper left corner of clip rect */
- int clipXMax; /* lower right corner of clip rect */
- int clipYMax; /* lower right corner of clip rect */
- int width, height; /* width and height of rect */
-
- nClipRects = RegionNumRects(pGC->pCompositeClip);
- pClipRects = RegionRects(pGC->pCompositeClip);
-
- if(!nClipRects) return;
-
- xOrigin = pDrawable->x;
- yOrigin = pDrawable->y;
-
-
- (*infoRec->SetupForSolidLine)(infoRec->pScrn,
- pGC->fgPixel, pGC->alu, pGC->planemask);
-
-
- for ( ; nClipRects > 0;
- nClipRects--, pClipRects++ )
- {
- clipYMin = pClipRects->y1;
- clipYMax = pClipRects->y2 - 1;
- clipXMin = pClipRects->x1;
- clipXMax = pClipRects->x2 - 1;
-
- for (pRect = pRectsInit, nRects = nRectsInit;
- nRects > 0;
- nRects--, pRect++ )
- {
- /* translate rectangle data over to the drawable */
- origX1 = pRect->x + xOrigin;
- origY1 = pRect->y + yOrigin;
- origX2 = origX1 + pRect->width;
- origY2 = origY1 + pRect->height;
-
- /* reject entire rectangle if completely outside clip rect */
- if ((origX1 > clipXMax) || (origX2 < clipXMin) ||
- (origY1 > clipYMax) || (origY2 < clipYMin))
- continue;
-
- /* clip the rectangle */
- clippedX1 = max (origX1, clipXMin);
- clippedX2 = min (origX2, clipXMax);
- clippedY1 = max (origY1, clipYMin);
- clippedY2 = min (origY2, clipYMax);
-
- width = clippedX2 - clippedX1 + 1;
-
- if (origY1 >= clipYMin) {
- (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn,
- clippedX1, clippedY1, width, DEGREES_0);
-
- /* don't overwrite corner */
- clippedY1++;
- }
-
- if ((origY2 <= clipYMax) && (origY1 != origY2)) {
- (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn,
- clippedX1, clippedY2, width, DEGREES_0);
-
- /* don't overwrite corner */
- clippedY2--;
- }
-
- if (clippedY2 < clippedY1) continue;
-
- height = clippedY2 - clippedY1 + 1;
-
- /* draw vertical edges using lines if not clipped out */
- if (origX1 >= clipXMin)
- (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn,
- clippedX1, clippedY1, height, DEGREES_270);
-
- if ((origX2 <= clipXMax) && (origX2 != origX1))
- (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn,
- clippedX2, clippedY1, height, DEGREES_270);
- }
- }
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-
-
-
-
-
-
-
-
-
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+/*
+ Much of this file based on code by
+ Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+*/
+
+void
+XAAPolyRectangleThinSolid(DrawablePtr pDrawable,
+ GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int nClipRects; /* number of clip rectangles */
+ BoxPtr pClipRects; /* points to the list of clip rects */
+ int xOrigin; /* Drawables x origin */
+ int yOrigin; /* Drawables x origin */
+ xRectangle *pRect; /* list of rects */
+ int nRects; /* running count of number of rects */
+ int origX1, origY1; /* original rectangle's U/L corner */
+ int origX2, origY2; /* original rectangle's L/R corner */
+ int clippedX1; /* clipped rectangle's left x */
+ int clippedY1; /* clipped rectangle's top y */
+ int clippedX2; /* clipped rectangle's right x */
+ int clippedY2; /* clipped rectangle's bottom y */
+ int clipXMin; /* upper left corner of clip rect */
+ int clipYMin; /* upper left corner of clip rect */
+ int clipXMax; /* lower right corner of clip rect */
+ int clipYMax; /* lower right corner of clip rect */
+ int width, height; /* width and height of rect */
+
+ nClipRects = RegionNumRects(pGC->pCompositeClip);
+ pClipRects = RegionRects(pGC->pCompositeClip);
+
+ if (!nClipRects)
+ return;
+
+ xOrigin = pDrawable->x;
+ yOrigin = pDrawable->y;
+
+ (*infoRec->SetupForSolidLine) (infoRec->pScrn,
+ pGC->fgPixel, pGC->alu, pGC->planemask);
+
+ for (; nClipRects > 0; nClipRects--, pClipRects++) {
+ clipYMin = pClipRects->y1;
+ clipYMax = pClipRects->y2 - 1;
+ clipXMin = pClipRects->x1;
+ clipXMax = pClipRects->x2 - 1;
+
+ for (pRect = pRectsInit, nRects = nRectsInit;
+ nRects > 0; nRects--, pRect++) {
+ /* translate rectangle data over to the drawable */
+ origX1 = pRect->x + xOrigin;
+ origY1 = pRect->y + yOrigin;
+ origX2 = origX1 + pRect->width;
+ origY2 = origY1 + pRect->height;
+
+ /* reject entire rectangle if completely outside clip rect */
+ if ((origX1 > clipXMax) || (origX2 < clipXMin) ||
+ (origY1 > clipYMax) || (origY2 < clipYMin))
+ continue;
+
+ /* clip the rectangle */
+ clippedX1 = max(origX1, clipXMin);
+ clippedX2 = min(origX2, clipXMax);
+ clippedY1 = max(origY1, clipYMin);
+ clippedY2 = min(origY2, clipYMax);
+
+ width = clippedX2 - clippedX1 + 1;
+
+ if (origY1 >= clipYMin) {
+ (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
+ clippedX1, clippedY1,
+ width, DEGREES_0);
+
+ /* don't overwrite corner */
+ clippedY1++;
+ }
+
+ if ((origY2 <= clipYMax) && (origY1 != origY2)) {
+ (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
+ clippedX1, clippedY2,
+ width, DEGREES_0);
+
+ /* don't overwrite corner */
+ clippedY2--;
+ }
+
+ if (clippedY2 < clippedY1)
+ continue;
+
+ height = clippedY2 - clippedY1 + 1;
+
+ /* draw vertical edges using lines if not clipped out */
+ if (origX1 >= clipXMin)
+ (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
+ clippedX1, clippedY1,
+ height, DEGREES_270);
+
+ if ((origX2 <= clipXMax) && (origX2 != origX1))
+ (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
+ clippedX2, clippedY1,
+ height, DEGREES_270);
+ }
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaSpans.c b/xorg-server/hw/xfree86/xaa/xaaSpans.c
index 1e6ef3a18..f03452a46 100644
--- a/xorg-server/hw/xfree86/xaa/xaaSpans.c
+++ b/xorg-server/hw/xfree86/xaa/xaaSpans.c
@@ -1,882 +1,876 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "mispans.h"
-#include "xaa.h"
-#include "xaalocal.h"
-
-
-static void XAARenderSolidSpans(
- GCPtr, int, DDXPointPtr, int*, int, int, int);
-static void XAARenderColor8x8Spans(
- GCPtr, int, DDXPointPtr, int*, int, int, int);
-static void XAARenderMono8x8Spans(
- GCPtr, int, DDXPointPtr, int*, int, int, int);
-static void XAARenderCacheBltSpans(
- GCPtr, int, DDXPointPtr, int*, int, int, int);
-static void XAARenderColorExpandSpans(
- GCPtr, int, DDXPointPtr, int*, int, int, int);
-static void XAARenderCacheExpandSpans(
- GCPtr, int, DDXPointPtr, int*, int, int, int);
-static void XAARenderPixmapCopySpans(
- GCPtr, int, DDXPointPtr, int*, int, int, int);
-
-void
-XAAFillSpans(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit, /* number of spans to fill */
- DDXPointPtr pptInit, /* pointer to list of start points */
- int *pwidthInit, /* pointer to list of n widths */
- int fSorted
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int type = 0;
- ClipAndRenderSpansFunc function;
- Bool fastClip = FALSE;
-
- if((nInit <= 0) || !pGC->planemask)
- return;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- switch(pGC->fillStyle) {
- case FillSolid:
- type = DO_SOLID;
- break;
- case FillStippled:
- type = (*infoRec->StippledFillChooser)(pGC);
- break;
- case FillOpaqueStippled:
- if((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSpansSolid &&
- CHECK_PLANEMASK(pGC,infoRec->FillSpansSolidFlags) &&
- CHECK_ROP(pGC,infoRec->FillSpansSolidFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillSpansSolidFlags) &&
- CHECK_FG(pGC,infoRec->FillSpansSolidFlags))
- type = DO_SOLID;
- else
- type = (*infoRec->OpaqueStippledFillChooser)(pGC);
- break;
- case FillTiled:
- type = (*infoRec->TiledFillChooser)(pGC);
- break;
- }
-
- switch(type) {
- case DO_SOLID:
- function = XAARenderSolidSpans;
- if(infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL)
- fastClip = TRUE;
- break;
- case DO_COLOR_8x8:
- function = XAARenderColor8x8Spans;
- if(infoRec->ClippingFlags & HARDWARE_CLIP_COLOR_8x8_FILL)
- fastClip = TRUE;
- break;
- case DO_MONO_8x8:
- function = XAARenderMono8x8Spans;
- if(infoRec->ClippingFlags & HARDWARE_CLIP_MONO_8x8_FILL)
- fastClip = TRUE;
- break;
- case DO_CACHE_BLT:
- function = XAARenderCacheBltSpans;
- if(infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY)
- fastClip = TRUE;
- break;
- case DO_COLOR_EXPAND:
- function = XAARenderColorExpandSpans;
- break;
- case DO_CACHE_EXPAND:
- function = XAARenderCacheExpandSpans;
- if(infoRec->ClippingFlags &
- HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND)
- fastClip = TRUE;
- break;
- case DO_PIXMAP_COPY:
- function = XAARenderPixmapCopySpans;
- if(infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY)
- fastClip = TRUE;
- break;
- case DO_IMAGE_WRITE:
- default:
- (*XAAFallbackOps.FillSpans)(pDraw, pGC, nInit, pptInit,
- pwidthInit, fSorted);
- return;
- }
-
-
- if((nInit < 10) || (RegionNumRects(pGC->pCompositeClip) != 1))
- fastClip = FALSE;
-
- if(fastClip) {
- infoRec->ClipBox = &pGC->pCompositeClip->extents;
- (*function)(pGC, nInit, pptInit, pwidthInit, fSorted,
- pDraw->x, pDraw->y);
- infoRec->ClipBox = NULL;
- } else
- XAAClipAndRenderSpans(pGC, pptInit, pwidthInit, nInit, fSorted,
- function, pDraw->x, pDraw->y);
-}
-
-
- /*********************\
- | Solid Spans |
- \*********************/
-
-
-static void
-XAARenderSolidSpans(
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- (*infoRec->FillSolidSpans) (infoRec->pScrn, pGC->fgPixel,
- pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted);
-}
-
-
- /************************\
- | Mono 8x8 Spans |
- \************************/
-
-
-static void
-XAARenderMono8x8Spans(
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAPixmapPtr pPriv;
- int fg, bg;
-
- switch(pGC->fillStyle) {
- case FillStippled:
- pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
- fg = pGC->fgPixel; bg = -1;
- break;
- case FillOpaqueStippled:
- pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
- fg = pGC->fgPixel; bg = pGC->bgPixel;
- break;
- case FillTiled:
- pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
- fg = pPriv->fg; bg = pPriv->bg;
- break;
- default: /* Muffle compiler */
- pPriv = NULL; /* Kaboom */
- fg = -1; bg = -1;
- break;
- }
-
- (*infoRec->FillMono8x8PatternSpans) (infoRec->pScrn,
- fg, bg, pGC->alu, pGC->planemask,
- n, ppt, pwidth, fSorted, pPriv->pattern0, pPriv->pattern1,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));
-}
-
-
- /*************************\
- | Color 8x8 Spans |
- \*************************/
-
-
-static void
-XAARenderColor8x8Spans(
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAACacheInfoPtr pCache;
- PixmapPtr pPix;
- int fg, bg;
-
- switch(pGC->fillStyle) {
- case FillStippled:
- pPix = pGC->stipple;
- fg = pGC->fgPixel; bg = -1;
- break;
- case FillOpaqueStippled:
- pPix = pGC->stipple;
- fg = pGC->fgPixel; bg = pGC->bgPixel;
- break;
- case FillTiled:
- pPix = pGC->tile.pixmap;
- fg = -1; bg = -1;
- break;
- default: /* Muffle compiler */
- pPix = NULL;
- fg = -1; bg = -1;
- break;
- }
-
- pCache = (*infoRec->CacheColor8x8Pattern)(infoRec->pScrn, pPix, fg, bg);
-
- (*infoRec->FillColor8x8PatternSpans) (infoRec->pScrn,
- pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted, pCache,
- (yorg + pGC->patOrg.x), (xorg + pGC->patOrg.y));
-}
-
-
- /****************************\
- | Color Expand Spans |
- \****************************/
-
-
-static void
-XAARenderColorExpandSpans(
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int fg, bg;
-
- switch(pGC->fillStyle) {
- case FillStippled:
- fg = pGC->fgPixel; bg = -1;
- break;
- case FillOpaqueStippled:
- fg = pGC->fgPixel; bg = pGC->bgPixel;
- break;
- default: /* Muffle compiler */
- fg = -1; bg = -1;
- break;
- }
-
- (*infoRec->FillColorExpandSpans) (infoRec->pScrn, fg, bg,
- pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
- pGC->stipple);
-
-}
-
-
- /*************************\
- | Cache Blt Spans |
- \*************************/
-
-
-static void
-XAARenderCacheBltSpans(
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAACacheInfoPtr pCache;
-
- switch(pGC->fillStyle) {
- case FillStippled:
- pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple,
- pGC->fgPixel, -1);
- break;
- case FillOpaqueStippled:
- pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple,
- pGC->fgPixel, pGC->bgPixel);
- break;
- case FillTiled:
- pCache = (*infoRec->CacheTile)(infoRec->pScrn, pGC->tile.pixmap);
- break;
- default: /* Muffle compiler */
- pCache = NULL;
- break;
- }
-
- (*infoRec->FillCacheBltSpans) (infoRec->pScrn,
- pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted, pCache,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));
-
-}
-
-
- /****************************\
- | Cache Expand Spans |
- \****************************/
-
-
-static void
-XAARenderCacheExpandSpans(
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int fg, bg;
-
- switch(pGC->fillStyle) {
- case FillStippled:
- fg = pGC->fgPixel; bg = -1;
- break;
- case FillOpaqueStippled:
- fg = pGC->fgPixel; bg = pGC->bgPixel;
- break;
- default: /* Muffle compiler */
- fg = -1; bg = -1;
- break;
- }
-
- (*infoRec->FillCacheExpandSpans) (infoRec->pScrn, fg, bg,
- pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
- pGC->stipple);
-}
-
-
- /***************************\
- | Pixmap Copy Spans |
- \***************************/
-
-
-static void
-XAARenderPixmapCopySpans(
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
-
- pCache->x = pPriv->offscreenArea->box.x1;
- pCache->y = pPriv->offscreenArea->box.y1;
- pCache->w = pCache->orig_w =
- pPriv->offscreenArea->box.x2 - pCache->x;
- pCache->h = pCache->orig_h =
- pPriv->offscreenArea->box.y2 - pCache->y;
- pCache->trans_color = -1;
-
- (*infoRec->FillCacheBltSpans) (infoRec->pScrn,
- pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted, pCache,
- (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));
-}
-
-
-
-
-
- /****************\
- | Solid |
- \****************/
-
-
-void
-XAAFillSolidSpans(
- ScrnInfoPtr pScrn,
- int fg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->SetupForSolidFill)(pScrn, fg, rop, planemask);
-
- if(infoRec->ClipBox)
- (*infoRec->SetClippingRectangle)(infoRec->pScrn,
- infoRec->ClipBox->x1, infoRec->ClipBox->y1,
- infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
-
- while(n--) {
- if (*pwidth > 0)
- (*infoRec->SubsequentSolidFillRect)(pScrn, ppt->x, ppt->y,
- *pwidth, 1);
- ppt++; pwidth++;
- }
-
- if(infoRec->ClipBox)
- (*infoRec->DisableClipping)(infoRec->pScrn);
-
- SET_SYNC_FLAG(infoRec);
-}
-
- /***************\
- | Mono 8x8 |
- \***************/
-
-
-void
-XAAFillMono8x8PatternSpansScreenOrigin(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- int pattern0, int pattern1,
- int xorigin, int yorigin
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int patx = pattern0, paty = pattern1;
- int xorg = (-xorigin) & 0x07;
- int yorg = (-yorigin) & 0x07;
-
-
- if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- XAARotateMonoPattern(&patx, &paty, xorg, yorg,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- xorg = patx; yorg = paty;
- }
- } else {
- XAACacheInfoPtr pCache =
- (*infoRec->CacheMono8x8Pattern)(pScrn, pattern0, pattern1);
- patx = pCache->x; paty = pCache->y;
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- int slot = (yorg << 3) + xorg;
- patx += pCache->offsets[slot].x;
- paty += pCache->offsets[slot].y;
- xorg = patx; yorg = paty;
- }
- }
-
- (*infoRec->SetupForMono8x8PatternFill)(pScrn, patx, paty,
- fg, bg, rop, planemask);
-
- if(infoRec->ClipBox)
- (*infoRec->SetClippingRectangle)(infoRec->pScrn,
- infoRec->ClipBox->x1, infoRec->ClipBox->y1,
- infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
-
- while(n--) {
- (*infoRec->SubsequentMono8x8PatternFillRect)(pScrn,
- xorg, yorg, ppt->x, ppt->y, *pwidth, 1);
- ppt++; pwidth++;
- }
-
- if(infoRec->ClipBox)
- (*infoRec->DisableClipping)(infoRec->pScrn);
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-void
-XAAFillMono8x8PatternSpans(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- int pattern0, int pattern1,
- int xorigin, int yorigin
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int patx = pattern0, paty = pattern1;
- int xorg, yorg, slot;
- XAACacheInfoPtr pCache = NULL;
-
-
- if(!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)){
- pCache = (*infoRec->CacheMono8x8Pattern)(pScrn, pattern0, pattern1);
- patx = pCache->x; paty = pCache->y;
- }
-
- (*infoRec->SetupForMono8x8PatternFill)(pScrn, patx, paty,
- fg, bg, rop, planemask);
-
- if(infoRec->ClipBox)
- (*infoRec->SetClippingRectangle)(infoRec->pScrn,
- infoRec->ClipBox->x1, infoRec->ClipBox->y1,
- infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
-
- while(n--) {
- xorg = (ppt->x - xorigin) & 0x07;
- yorg = (ppt->y - yorigin) & 0x07;
-
- if(!(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_BITS) {
- patx = pattern0; paty = pattern1;
- XAARotateMonoPattern(&patx, &paty, xorg, yorg,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- xorg = patx; yorg = paty;
- } else {
- slot = (yorg << 3) + xorg;
- xorg = patx + pCache->offsets[slot].x;
- yorg = paty + pCache->offsets[slot].y;
- }
- }
-
- (*infoRec->SubsequentMono8x8PatternFillRect)(pScrn,
- xorg, yorg, ppt->x, ppt->y, *pwidth, 1);
- ppt++; pwidth++;
- }
-
- if(infoRec->ClipBox)
- (*infoRec->DisableClipping)(infoRec->pScrn);
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-
- /****************\
- | Color 8x8 |
- \****************/
-
-
-void
-XAAFillColor8x8PatternSpansScreenOrigin(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- XAACacheInfoPtr pCache,
- int xorigin, int yorigin
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int patx = pCache->x, paty = pCache->y;
- int xorg = (-xorigin) & 0x07;
- int yorg = (-yorigin) & 0x07;
-
-
- if(!(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- int slot = (yorg << 3) + xorg;
- paty += pCache->offsets[slot].y;
- patx += pCache->offsets[slot].x;
- xorg = patx; yorg = paty;
- }
-
- (*infoRec->SetupForColor8x8PatternFill)(pScrn, patx, paty,
- rop, planemask, pCache->trans_color);
-
- if(infoRec->ClipBox)
- (*infoRec->SetClippingRectangle)(infoRec->pScrn,
- infoRec->ClipBox->x1, infoRec->ClipBox->y1,
- infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
-
- while(n--) {
- (*infoRec->SubsequentColor8x8PatternFillRect)(pScrn,
- xorg, yorg, ppt->x, ppt->y, *pwidth, 1);
- ppt++; pwidth++;
- }
-
- if(infoRec->ClipBox)
- (*infoRec->DisableClipping)(infoRec->pScrn);
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-void
-XAAFillColor8x8PatternSpans(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- XAACacheInfoPtr pCache,
- int xorigin, int yorigin
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int xorg, yorg, slot;
-
- (*infoRec->SetupForColor8x8PatternFill)(pScrn, pCache->x, pCache->y,
- rop, planemask, pCache->trans_color);
-
- if(infoRec->ClipBox)
- (*infoRec->SetClippingRectangle)(infoRec->pScrn,
- infoRec->ClipBox->x1, infoRec->ClipBox->y1,
- infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
-
- while(n--) {
- xorg = (ppt->x - xorigin) & 0x07;
- yorg = (ppt->y - yorigin) & 0x07;
-
- if(!(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- slot = (yorg << 3) + xorg;
- yorg = pCache->y + pCache->offsets[slot].y;
- xorg = pCache->x + pCache->offsets[slot].x;
- }
-
- (*infoRec->SubsequentColor8x8PatternFillRect)(pScrn,
- xorg, yorg, ppt->x, ppt->y, *pwidth, 1);
- ppt++; pwidth++;
- }
-
- if(infoRec->ClipBox)
- (*infoRec->DisableClipping)(infoRec->pScrn);
-
- SET_SYNC_FLAG(infoRec);
-}
-
- /*****************\
- | Cache Blit |
- \*****************/
-
-
-void
-XAAFillCacheBltSpans(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- XAACacheInfoPtr pCache,
- int xorg, int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int x, w, phaseX, phaseY, blit_w;
-
- (*infoRec->SetupForScreenToScreenCopy)(pScrn, 1, 1, rop, planemask,
- pCache->trans_color);
-
- if(infoRec->ClipBox)
- (*infoRec->SetClippingRectangle)(infoRec->pScrn,
- infoRec->ClipBox->x1, infoRec->ClipBox->y1,
- infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
-
- while(n--) {
- x = ppt->x;
- w = *pwidth;
- phaseX = (x - xorg) % pCache->orig_w;
- if(phaseX < 0) phaseX += pCache->orig_w;
- phaseY = (ppt->y - yorg) % pCache->orig_h;
- if(phaseY < 0) phaseY += pCache->orig_h;
-
- while(1) {
- blit_w = pCache->w - phaseX;
- if(blit_w > w) blit_w = w;
-
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pCache->x + phaseX, pCache->y + phaseY,
- x, ppt->y, blit_w, 1);
-
- w -= blit_w;
- if(!w) break;
- x += blit_w;
- phaseX = (phaseX + blit_w) % pCache->orig_w;
- }
- ppt++; pwidth++;
- }
-
- if(infoRec->ClipBox)
- (*infoRec->DisableClipping)(infoRec->pScrn);
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
- /****************\
- | Cache Expand |
- \****************/
-
-
-void
-XAAFillCacheExpandSpans(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int x, w, phaseX, phaseY, blit_w, cacheWidth;
- XAACacheInfoPtr pCache;
-
- pCache = (*infoRec->CacheMonoStipple)(pScrn, pPix);
-
- cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
- infoRec->CacheColorExpandDensity;
-
- (*infoRec->SetupForScreenToScreenColorExpandFill)(pScrn, fg, bg, rop,
- planemask);
-
- if(infoRec->ClipBox)
- (*infoRec->SetClippingRectangle)(infoRec->pScrn,
- infoRec->ClipBox->x1, infoRec->ClipBox->y1,
- infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
-
- while(n--) {
- x = ppt->x;
- w = *pwidth;
- phaseX = (x - xorg) % pCache->orig_w;
- if(phaseX < 0) phaseX += pCache->orig_w;
- phaseY = (ppt->y - yorg) % pCache->orig_h;
- if(phaseY < 0) phaseY += pCache->orig_h;
-
- while(1) {
- blit_w = cacheWidth - phaseX;
- if(blit_w > w) blit_w = w;
-
- (*infoRec->SubsequentScreenToScreenColorExpandFill)(
- pScrn, x, ppt->y, blit_w, 1,
- pCache->x, pCache->y + phaseY, phaseX);
-
- w -= blit_w;
- if(!w) break;
- x += blit_w;
- phaseX = (phaseX + blit_w) % pCache->orig_w;
- }
- ppt++; pwidth++;
- }
-
- if(infoRec->ClipBox)
- (*infoRec->DisableClipping)(infoRec->pScrn);
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-
-void
-XAAClipAndRenderSpans(
- GCPtr pGC,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted,
- ClipAndRenderSpansFunc func,
- int xorg,
- int yorg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- DDXPointPtr pptNew, pptBase;
- int *pwidthBase, *pwidthNew;
- int Right, numRects, MaxBoxes;
-
- MaxBoxes = infoRec->PreAllocSize/(sizeof(DDXPointRec) + sizeof(int));
- pptBase = (DDXPointRec*)infoRec->PreAllocMem;
- pwidthBase = (int*)(&pptBase[MaxBoxes]);
-
- pptNew = pptBase;
- pwidthNew = pwidthBase;
-
- numRects = RegionNumRects(pGC->pCompositeClip);
-
- if(numRects == 1) {
- BoxPtr pextent = RegionRects(pGC->pCompositeClip);
-
- while(nspans--) {
- if ((pextent->y1 <= ppt->y) && (ppt->y < pextent->y2)) {
- pptNew->x = max(pextent->x1, ppt->x);
- Right = ppt->x + *pwidth;
- *pwidthNew = min(pextent->x2, Right) - pptNew->x;
-
- if (*pwidthNew > 0) {
- pptNew->y = ppt->y;
- pptNew++;
- pwidthNew++;
-
- if(pptNew >= (pptBase + MaxBoxes)) {
- (*func)(pGC, MaxBoxes, pptBase, pwidthBase, fSorted,
- xorg, yorg);
- pptNew = pptBase;
- pwidthNew = pwidthBase;
- }
- }
- }
- ppt++;
- pwidth++;
- }
- } else if (numRects) {
- BoxPtr pbox;
- int nbox;
-
- while(nspans--) {
- nbox = numRects;
- pbox = RegionRects(pGC->pCompositeClip);
-
- /* find the first band */
- while(nbox && (pbox->y2 <= ppt->y)) {
- pbox++;
- nbox--;
- }
-
- if(nbox && (pbox->y1 <= ppt->y)) {
- int orig_y = pbox->y1;
- Right = ppt->x + *pwidth;
- while(nbox && (orig_y == pbox->y1)) {
- if(pbox->x2 <= ppt->x) {
- nbox--;
- pbox++;
- continue;
- }
-
- if(pbox->x1 >= Right) {
- nbox = 0;
- break;
- }
-
- pptNew->x = max(pbox->x1, ppt->x);
- *pwidthNew = min(pbox->x2, Right) - pptNew->x;
- if(*pwidthNew > 0) {
- pptNew->y = ppt->y;
- pptNew++;
- pwidthNew++;
-
- if(pptNew >= (pptBase + MaxBoxes)) {
- (*func)(pGC, MaxBoxes, pptBase, pwidthBase,
- fSorted, xorg, yorg);
- pptNew = pptBase;
- pwidthNew = pwidthBase;
- }
- }
- pbox++;
- nbox--;
- }
- }
- ppt++;
- pwidth++;
- }
- }
-
- if(pptNew != pptBase)
- (*func)(pGC, pptNew - pptBase, pptBase, pwidthBase, fSorted,
- xorg, yorg);
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "mispans.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+static void XAARenderSolidSpans(GCPtr, int, DDXPointPtr, int *, int, int, int);
+static void XAARenderColor8x8Spans(GCPtr, int, DDXPointPtr, int *, int, int,
+ int);
+static void XAARenderMono8x8Spans(GCPtr, int, DDXPointPtr, int *, int, int,
+ int);
+static void XAARenderCacheBltSpans(GCPtr, int, DDXPointPtr, int *, int, int,
+ int);
+static void XAARenderColorExpandSpans(GCPtr, int, DDXPointPtr, int *, int, int,
+ int);
+static void XAARenderCacheExpandSpans(GCPtr, int, DDXPointPtr, int *, int, int,
+ int);
+static void XAARenderPixmapCopySpans(GCPtr, int, DDXPointPtr, int *, int, int,
+ int);
+
+void
+XAAFillSpans(DrawablePtr pDraw, GC * pGC, int nInit, /* number of spans to fill */
+ DDXPointPtr pptInit, /* pointer to list of start points */
+ int *pwidthInit, /* pointer to list of n widths */
+ int fSorted)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int type = 0;
+ ClipAndRenderSpansFunc function;
+ Bool fastClip = FALSE;
+
+ if ((nInit <= 0) || !pGC->planemask)
+ return;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ switch (pGC->fillStyle) {
+ case FillSolid:
+ type = DO_SOLID;
+ break;
+ case FillStippled:
+ type = (*infoRec->StippledFillChooser) (pGC);
+ break;
+ case FillOpaqueStippled:
+ if ((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSpansSolid &&
+ CHECK_PLANEMASK(pGC, infoRec->FillSpansSolidFlags) &&
+ CHECK_ROP(pGC, infoRec->FillSpansSolidFlags) &&
+ CHECK_ROPSRC(pGC, infoRec->FillSpansSolidFlags) &&
+ CHECK_FG(pGC, infoRec->FillSpansSolidFlags))
+ type = DO_SOLID;
+ else
+ type = (*infoRec->OpaqueStippledFillChooser) (pGC);
+ break;
+ case FillTiled:
+ type = (*infoRec->TiledFillChooser) (pGC);
+ break;
+ }
+
+ switch (type) {
+ case DO_SOLID:
+ function = XAARenderSolidSpans;
+ if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL)
+ fastClip = TRUE;
+ break;
+ case DO_COLOR_8x8:
+ function = XAARenderColor8x8Spans;
+ if (infoRec->ClippingFlags & HARDWARE_CLIP_COLOR_8x8_FILL)
+ fastClip = TRUE;
+ break;
+ case DO_MONO_8x8:
+ function = XAARenderMono8x8Spans;
+ if (infoRec->ClippingFlags & HARDWARE_CLIP_MONO_8x8_FILL)
+ fastClip = TRUE;
+ break;
+ case DO_CACHE_BLT:
+ function = XAARenderCacheBltSpans;
+ if (infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY)
+ fastClip = TRUE;
+ break;
+ case DO_COLOR_EXPAND:
+ function = XAARenderColorExpandSpans;
+ break;
+ case DO_CACHE_EXPAND:
+ function = XAARenderCacheExpandSpans;
+ if (infoRec->ClippingFlags &
+ HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND)
+ fastClip = TRUE;
+ break;
+ case DO_PIXMAP_COPY:
+ function = XAARenderPixmapCopySpans;
+ if (infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY)
+ fastClip = TRUE;
+ break;
+ case DO_IMAGE_WRITE:
+ default:
+ (*XAAFallbackOps.FillSpans) (pDraw, pGC, nInit, pptInit,
+ pwidthInit, fSorted);
+ return;
+ }
+
+ if ((nInit < 10) || (RegionNumRects(pGC->pCompositeClip) != 1))
+ fastClip = FALSE;
+
+ if (fastClip) {
+ infoRec->ClipBox = &pGC->pCompositeClip->extents;
+ (*function) (pGC, nInit, pptInit, pwidthInit, fSorted,
+ pDraw->x, pDraw->y);
+ infoRec->ClipBox = NULL;
+ }
+ else
+ XAAClipAndRenderSpans(pGC, pptInit, pwidthInit, nInit, fSorted,
+ function, pDraw->x, pDraw->y);
+}
+
+ /*********************\
+ | Solid Spans |
+ \*********************/
+
+static void
+XAARenderSolidSpans(GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ (*infoRec->FillSolidSpans) (infoRec->pScrn, pGC->fgPixel,
+ pGC->alu, pGC->planemask, n, ppt, pwidth,
+ fSorted);
+}
+
+ /************************\
+ | Mono 8x8 Spans |
+ \************************/
+
+static void
+XAARenderMono8x8Spans(GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAPixmapPtr pPriv;
+ int fg, bg;
+
+ switch (pGC->fillStyle) {
+ case FillStippled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ fg = pGC->fgPixel;
+ bg = -1;
+ break;
+ case FillOpaqueStippled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ fg = pGC->fgPixel;
+ bg = pGC->bgPixel;
+ break;
+ case FillTiled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ fg = pPriv->fg;
+ bg = pPriv->bg;
+ break;
+ default: /* Muffle compiler */
+ pPriv = NULL; /* Kaboom */
+ fg = -1;
+ bg = -1;
+ break;
+ }
+
+ (*infoRec->FillMono8x8PatternSpans) (infoRec->pScrn,
+ fg, bg, pGC->alu, pGC->planemask,
+ n, ppt, pwidth, fSorted,
+ pPriv->pattern0, pPriv->pattern1,
+ (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y));
+}
+
+ /*************************\
+ | Color 8x8 Spans |
+ \*************************/
+
+static void
+XAARenderColor8x8Spans(GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache;
+ PixmapPtr pPix;
+ int fg, bg;
+
+ switch (pGC->fillStyle) {
+ case FillStippled:
+ pPix = pGC->stipple;
+ fg = pGC->fgPixel;
+ bg = -1;
+ break;
+ case FillOpaqueStippled:
+ pPix = pGC->stipple;
+ fg = pGC->fgPixel;
+ bg = pGC->bgPixel;
+ break;
+ case FillTiled:
+ pPix = pGC->tile.pixmap;
+ fg = -1;
+ bg = -1;
+ break;
+ default: /* Muffle compiler */
+ pPix = NULL;
+ fg = -1;
+ bg = -1;
+ break;
+ }
+
+ pCache = (*infoRec->CacheColor8x8Pattern) (infoRec->pScrn, pPix, fg, bg);
+
+ (*infoRec->FillColor8x8PatternSpans) (infoRec->pScrn,
+ pGC->alu, pGC->planemask, n, ppt,
+ pwidth, fSorted, pCache,
+ (yorg + pGC->patOrg.x),
+ (xorg + pGC->patOrg.y));
+}
+
+ /****************************\
+ | Color Expand Spans |
+ \****************************/
+
+static void
+XAARenderColorExpandSpans(GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int fg, bg;
+
+ switch (pGC->fillStyle) {
+ case FillStippled:
+ fg = pGC->fgPixel;
+ bg = -1;
+ break;
+ case FillOpaqueStippled:
+ fg = pGC->fgPixel;
+ bg = pGC->bgPixel;
+ break;
+ default: /* Muffle compiler */
+ fg = -1;
+ bg = -1;
+ break;
+ }
+
+ (*infoRec->FillColorExpandSpans) (infoRec->pScrn, fg, bg,
+ pGC->alu, pGC->planemask, n, ppt, pwidth,
+ fSorted, (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y), pGC->stipple);
+
+}
+
+ /*************************\
+ | Cache Blt Spans |
+ \*************************/
+
+static void
+XAARenderCacheBltSpans(GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache;
+
+ switch (pGC->fillStyle) {
+ case FillStippled:
+ pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
+ pGC->fgPixel, -1);
+ break;
+ case FillOpaqueStippled:
+ pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
+ pGC->fgPixel, pGC->bgPixel);
+ break;
+ case FillTiled:
+ pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap);
+ break;
+ default: /* Muffle compiler */
+ pCache = NULL;
+ break;
+ }
+
+ (*infoRec->FillCacheBltSpans) (infoRec->pScrn,
+ pGC->alu, pGC->planemask, n, ppt, pwidth,
+ fSorted, pCache, (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y));
+
+}
+
+ /****************************\
+ | Cache Expand Spans |
+ \****************************/
+
+static void
+XAARenderCacheExpandSpans(GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int fg, bg;
+
+ switch (pGC->fillStyle) {
+ case FillStippled:
+ fg = pGC->fgPixel;
+ bg = -1;
+ break;
+ case FillOpaqueStippled:
+ fg = pGC->fgPixel;
+ bg = pGC->bgPixel;
+ break;
+ default: /* Muffle compiler */
+ fg = -1;
+ bg = -1;
+ break;
+ }
+
+ (*infoRec->FillCacheExpandSpans) (infoRec->pScrn, fg, bg,
+ pGC->alu, pGC->planemask, n, ppt, pwidth,
+ fSorted, (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y), pGC->stipple);
+}
+
+ /***************************\
+ | Pixmap Copy Spans |
+ \***************************/
+
+static void
+XAARenderPixmapCopySpans(GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+
+ pCache->x = pPriv->offscreenArea->box.x1;
+ pCache->y = pPriv->offscreenArea->box.y1;
+ pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x;
+ pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y;
+ pCache->trans_color = -1;
+
+ (*infoRec->FillCacheBltSpans) (infoRec->pScrn,
+ pGC->alu, pGC->planemask, n, ppt, pwidth,
+ fSorted, pCache, (xorg + pGC->patOrg.x),
+ (yorg + pGC->patOrg.y));
+}
+
+ /****************\
+ | Solid |
+ \****************/
+
+void
+XAAFillSolidSpans(ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int n, DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SetupForSolidFill) (pScrn, fg, rop, planemask);
+
+ if (infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle) (infoRec->pScrn,
+ infoRec->ClipBox->x1,
+ infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1,
+ infoRec->ClipBox->y2 - 1);
+
+ while (n--) {
+ if (*pwidth > 0)
+ (*infoRec->SubsequentSolidFillRect) (pScrn, ppt->x, ppt->y,
+ *pwidth, 1);
+ ppt++;
+ pwidth++;
+ }
+
+ if (infoRec->ClipBox)
+ (*infoRec->DisableClipping) (infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /***************\
+ | Mono 8x8 |
+ \***************/
+
+void
+XAAFillMono8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ int pattern0, int pattern1,
+ int xorigin, int yorigin)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pattern0, paty = pattern1;
+ int xorg = (-xorigin) & 0x07;
+ int yorg = (-yorigin) & 0x07;
+
+ if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx;
+ yorg = paty;
+ }
+ }
+ else {
+ XAACacheInfoPtr pCache =
+ (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1);
+ patx = pCache->x;
+ paty = pCache->y;
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ int slot = (yorg << 3) + xorg;
+
+ patx += pCache->offsets[slot].x;
+ paty += pCache->offsets[slot].y;
+ xorg = patx;
+ yorg = paty;
+ }
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty,
+ fg, bg, rop, planemask);
+
+ if (infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle) (infoRec->pScrn,
+ infoRec->ClipBox->x1,
+ infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1,
+ infoRec->ClipBox->y2 - 1);
+
+ while (n--) {
+ (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn,
+ xorg, yorg, ppt->x,
+ ppt->y, *pwidth, 1);
+ ppt++;
+ pwidth++;
+ }
+
+ if (infoRec->ClipBox)
+ (*infoRec->DisableClipping) (infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAFillMono8x8PatternSpans(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ int pattern0, int pattern1, int xorigin, int yorigin)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pattern0, paty = pattern1;
+ int xorg, yorg, slot;
+ XAACacheInfoPtr pCache = NULL;
+
+ if (!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)) {
+ pCache = (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1);
+ patx = pCache->x;
+ paty = pCache->y;
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty,
+ fg, bg, rop, planemask);
+
+ if (infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle) (infoRec->pScrn,
+ infoRec->ClipBox->x1,
+ infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1,
+ infoRec->ClipBox->y2 - 1);
+
+ while (n--) {
+ xorg = (ppt->x - xorigin) & 0x07;
+ yorg = (ppt->y - yorigin) & 0x07;
+
+ if (!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ if (infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ patx = pattern0;
+ paty = pattern1;
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx;
+ yorg = paty;
+ }
+ else {
+ slot = (yorg << 3) + xorg;
+ xorg = patx + pCache->offsets[slot].x;
+ yorg = paty + pCache->offsets[slot].y;
+ }
+ }
+
+ (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn,
+ xorg, yorg, ppt->x,
+ ppt->y, *pwidth, 1);
+ ppt++;
+ pwidth++;
+ }
+
+ if (infoRec->ClipBox)
+ (*infoRec->DisableClipping) (infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /****************\
+ | Color 8x8 |
+ \****************/
+
+void
+XAAFillColor8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ XAACacheInfoPtr pCache,
+ int xorigin, int yorigin)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pCache->x, paty = pCache->y;
+ int xorg = (-xorigin) & 0x07;
+ int yorg = (-yorigin) & 0x07;
+
+ if (!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ int slot = (yorg << 3) + xorg;
+
+ paty += pCache->offsets[slot].y;
+ patx += pCache->offsets[slot].x;
+ xorg = patx;
+ yorg = paty;
+ }
+
+ (*infoRec->SetupForColor8x8PatternFill) (pScrn, patx, paty,
+ rop, planemask,
+ pCache->trans_color);
+
+ if (infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle) (infoRec->pScrn,
+ infoRec->ClipBox->x1,
+ infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1,
+ infoRec->ClipBox->y2 - 1);
+
+ while (n--) {
+ (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn,
+ xorg, yorg, ppt->x,
+ ppt->y, *pwidth, 1);
+ ppt++;
+ pwidth++;
+ }
+
+ if (infoRec->ClipBox)
+ (*infoRec->DisableClipping) (infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAFillColor8x8PatternSpans(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ XAACacheInfoPtr pCache, int xorigin, int yorigin)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int xorg, yorg, slot;
+
+ (*infoRec->SetupForColor8x8PatternFill) (pScrn, pCache->x, pCache->y,
+ rop, planemask,
+ pCache->trans_color);
+
+ if (infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle) (infoRec->pScrn,
+ infoRec->ClipBox->x1,
+ infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1,
+ infoRec->ClipBox->y2 - 1);
+
+ while (n--) {
+ xorg = (ppt->x - xorigin) & 0x07;
+ yorg = (ppt->y - yorigin) & 0x07;
+
+ if (!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ slot = (yorg << 3) + xorg;
+ yorg = pCache->y + pCache->offsets[slot].y;
+ xorg = pCache->x + pCache->offsets[slot].x;
+ }
+
+ (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn,
+ xorg, yorg, ppt->x,
+ ppt->y, *pwidth, 1);
+ ppt++;
+ pwidth++;
+ }
+
+ if (infoRec->ClipBox)
+ (*infoRec->DisableClipping) (infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /*****************\
+ | Cache Blit |
+ \*****************/
+
+void
+XAAFillCacheBltSpans(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted, XAACacheInfoPtr pCache, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, w, phaseX, phaseY, blit_w;
+
+ (*infoRec->SetupForScreenToScreenCopy) (pScrn, 1, 1, rop, planemask,
+ pCache->trans_color);
+
+ if (infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle) (infoRec->pScrn,
+ infoRec->ClipBox->x1,
+ infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1,
+ infoRec->ClipBox->y2 - 1);
+
+ while (n--) {
+ x = ppt->x;
+ w = *pwidth;
+ phaseX = (x - xorg) % pCache->orig_w;
+ if (phaseX < 0)
+ phaseX += pCache->orig_w;
+ phaseY = (ppt->y - yorg) % pCache->orig_h;
+ if (phaseY < 0)
+ phaseY += pCache->orig_h;
+
+ while (1) {
+ blit_w = pCache->w - phaseX;
+ if (blit_w > w)
+ blit_w = w;
+
+ (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
+ pCache->x + phaseX,
+ pCache->y + phaseY, x,
+ ppt->y, blit_w, 1);
+
+ w -= blit_w;
+ if (!w)
+ break;
+ x += blit_w;
+ phaseX = (phaseX + blit_w) % pCache->orig_w;
+ }
+ ppt++;
+ pwidth++;
+ }
+
+ if (infoRec->ClipBox)
+ (*infoRec->DisableClipping) (infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /****************\
+ | Cache Expand |
+ \****************/
+
+void
+XAAFillCacheExpandSpans(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted, int xorg, int yorg, PixmapPtr pPix)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, w, phaseX, phaseY, blit_w, cacheWidth;
+ XAACacheInfoPtr pCache;
+
+ pCache = (*infoRec->CacheMonoStipple) (pScrn, pPix);
+
+ cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
+ infoRec->CacheColorExpandDensity;
+
+ (*infoRec->SetupForScreenToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+
+ if (infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle) (infoRec->pScrn,
+ infoRec->ClipBox->x1,
+ infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1,
+ infoRec->ClipBox->y2 - 1);
+
+ while (n--) {
+ x = ppt->x;
+ w = *pwidth;
+ phaseX = (x - xorg) % pCache->orig_w;
+ if (phaseX < 0)
+ phaseX += pCache->orig_w;
+ phaseY = (ppt->y - yorg) % pCache->orig_h;
+ if (phaseY < 0)
+ phaseY += pCache->orig_h;
+
+ while (1) {
+ blit_w = cacheWidth - phaseX;
+ if (blit_w > w)
+ blit_w = w;
+
+ (*infoRec->SubsequentScreenToScreenColorExpandFill) (pScrn, x,
+ ppt->y, blit_w,
+ 1, pCache->x,
+ pCache->y +
+ phaseY,
+ phaseX);
+
+ w -= blit_w;
+ if (!w)
+ break;
+ x += blit_w;
+ phaseX = (phaseX + blit_w) % pCache->orig_w;
+ }
+ ppt++;
+ pwidth++;
+ }
+
+ if (infoRec->ClipBox)
+ (*infoRec->DisableClipping) (infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAClipAndRenderSpans(GCPtr pGC,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted,
+ ClipAndRenderSpansFunc func, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ DDXPointPtr pptNew, pptBase;
+ int *pwidthBase, *pwidthNew;
+ int Right, numRects, MaxBoxes;
+
+ MaxBoxes = infoRec->PreAllocSize / (sizeof(DDXPointRec) + sizeof(int));
+ pptBase = (DDXPointRec *) infoRec->PreAllocMem;
+ pwidthBase = (int *) (&pptBase[MaxBoxes]);
+
+ pptNew = pptBase;
+ pwidthNew = pwidthBase;
+
+ numRects = RegionNumRects(pGC->pCompositeClip);
+
+ if (numRects == 1) {
+ BoxPtr pextent = RegionRects(pGC->pCompositeClip);
+
+ while (nspans--) {
+ if ((pextent->y1 <= ppt->y) && (ppt->y < pextent->y2)) {
+ pptNew->x = max(pextent->x1, ppt->x);
+ Right = ppt->x + *pwidth;
+ *pwidthNew = min(pextent->x2, Right) - pptNew->x;
+
+ if (*pwidthNew > 0) {
+ pptNew->y = ppt->y;
+ pptNew++;
+ pwidthNew++;
+
+ if (pptNew >= (pptBase + MaxBoxes)) {
+ (*func) (pGC, MaxBoxes, pptBase, pwidthBase, fSorted,
+ xorg, yorg);
+ pptNew = pptBase;
+ pwidthNew = pwidthBase;
+ }
+ }
+ }
+ ppt++;
+ pwidth++;
+ }
+ }
+ else if (numRects) {
+ BoxPtr pbox;
+ int nbox;
+
+ while (nspans--) {
+ nbox = numRects;
+ pbox = RegionRects(pGC->pCompositeClip);
+
+ /* find the first band */
+ while (nbox && (pbox->y2 <= ppt->y)) {
+ pbox++;
+ nbox--;
+ }
+
+ if (nbox && (pbox->y1 <= ppt->y)) {
+ int orig_y = pbox->y1;
+
+ Right = ppt->x + *pwidth;
+ while (nbox && (orig_y == pbox->y1)) {
+ if (pbox->x2 <= ppt->x) {
+ nbox--;
+ pbox++;
+ continue;
+ }
+
+ if (pbox->x1 >= Right) {
+ nbox = 0;
+ break;
+ }
+
+ pptNew->x = max(pbox->x1, ppt->x);
+ *pwidthNew = min(pbox->x2, Right) - pptNew->x;
+ if (*pwidthNew > 0) {
+ pptNew->y = ppt->y;
+ pptNew++;
+ pwidthNew++;
+
+ if (pptNew >= (pptBase + MaxBoxes)) {
+ (*func) (pGC, MaxBoxes, pptBase, pwidthBase,
+ fSorted, xorg, yorg);
+ pptNew = pptBase;
+ pwidthNew = pwidthBase;
+ }
+ }
+ pbox++;
+ nbox--;
+ }
+ }
+ ppt++;
+ pwidth++;
+ }
+ }
+
+ if (pptNew != pptBase)
+ (*func) (pGC, pptNew - pptBase, pptBase, pwidthBase, fSorted,
+ xorg, yorg);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaStateChange.c b/xorg-server/hw/xfree86/xaa/xaaStateChange.c
index 4eb15125b..0218cb57c 100644
--- a/xorg-server/hw/xfree86/xaa/xaaStateChange.c
+++ b/xorg-server/hw/xfree86/xaa/xaaStateChange.c
@@ -1,1627 +1,1665 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "miline.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "servermd.h"
-
-#define XAA_STATE_WRAP(func) do {\
-if(infoRec->func) { \
- pStatePriv->func = infoRec->func;\
- infoRec->func = XAAStateWrap##func;\
-}} while(0)
-
-/* Wrap all XAA functions and allocate our private structure.
- */
-
-typedef struct _XAAStateWrapRec {
- ScrnInfoPtr pScrn;
- void (*RestoreAccelState)(ScrnInfoPtr pScrn);
- void (*Sync)(ScrnInfoPtr pScrn);
- void (*SetupForScreenToScreenCopy)(ScrnInfoPtr pScrn, int xdir, int ydir,
- int rop, unsigned int planemask,
- int trans_color);
- void (*SetupForSolidFill)(ScrnInfoPtr pScrn, int color, int rop,
- unsigned int planemask);
- void (*SetupForSolidLine)(ScrnInfoPtr pScrn,int color,int rop,
- unsigned int planemask);
- void (*SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int length,
- unsigned char *pattern);
- void (*SetClippingRectangle) (ScrnInfoPtr pScrn, int left, int top,
- int right, int bottom);
- void (*DisableClipping)(ScrnInfoPtr pScrn);
- void (*SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
- int fg, int bg, int rop,
- unsigned int planemask);
- void (*SetupForColor8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
- int rop, unsigned int planemask,
- int transparency_color);
- void (*SetupForCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, int fg,
- int bg, int rop,
- unsigned int planemask);
- void (*SetupForScanlineCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask);
- void (*SetupForScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask);
- void (*SetupForImageWrite)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth);
- void (*SetupForScanlineImageWrite)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth);
- void (*SetupForImageRead) (ScrnInfoPtr pScrn, int bpp, int depth);
- void (*ScreenToScreenBitBlt)(ScrnInfoPtr pScrn, int nbox,
- DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
- int ydir, int alu, unsigned int planmask);
- void (*WriteBitmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int skipleft,
- int fg, int bg, int rop, unsigned int planemask);
- void (*FillSolidRects)(ScrnInfoPtr pScrn, int fg, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox);
- void (*FillMono8x8PatternRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int pat0, int pat1,
- int xorg, int yorg);
- void (*FillColor8x8PatternRects)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int xorg, int yorg,
- XAACacheInfoPtr pCache);
- void (*FillCacheBltRects)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox,
- int xorg, int yorg, XAACacheInfoPtr pCache);
- void (*FillColorExpandRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int xorg, int yorg,
- PixmapPtr pPix);
- void (*FillCacheExpandRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox,
- int xorg, int yorg, PixmapPtr pPix);
- void (*FillImageWriteRects)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox,
- int xorg, int yorg, PixmapPtr pPix);
- void (*FillSolidSpans)(ScrnInfoPtr pScrn, int fg, int rop,
- unsigned int planemask, int n, DDXPointPtr points,
- int *widths, int fSorted);
- void (*FillMono8x8PatternSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths,
- int fSorted, int pat0, int pat1,
- int xorg, int yorg);
- void (*FillColor8x8PatternSpans)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths,
- int fSorted, XAACacheInfoPtr pCache,
- int xorg, int yorg);
- void (*FillCacheBltSpans)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int n, DDXPointPtr points,
- int *widths, int fSorted, XAACacheInfoPtr pCache,
- int xorg, int yorg);
- void (*FillColorExpandSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths, int fSorted,
- int xorg, int yorg, PixmapPtr pPix);
- void (*FillCacheExpandSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int n, DDXPointPtr ppt,
- int *pwidth, int fSorted, int xorg, int yorg,
- PixmapPtr pPix);
- void (*TEGlyphRenderer)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- int skipleft, int startline, unsigned int **glyphs,
- int glyphWidth, int fg, int bg, int rop,
- unsigned planemask);
- void (*NonTEGlyphRenderer)(ScrnInfoPtr pScrn, int x, int y, int n,
- NonTEGlyphPtr glyphs, BoxPtr pbox,
- int fg, int rop, unsigned int planemask);
- void (*WritePixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth);
- void (*ReadPixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *dst, int dstwidth, int bpp, int depth);
- RegionPtr (*CopyArea)(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GC *pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty);
- RegionPtr (*CopyPlane)(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx,
- int dsty, unsigned long bitPlane);
- void (*PushPixelsSolid) (GCPtr pGC, PixmapPtr pBitMap,
- DrawablePtr pDrawable, int dx, int dy, int xOrg,
- int yOrg);
- void (*PolyFillRectSolid)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit);
- void (*PolyFillRectStippled)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit);
- void (*PolyFillRectOpaqueStippled)(DrawablePtr pDraw, GCPtr pGC,
- int nrectFill, xRectangle *prectInit);
- void (*PolyFillRectTiled)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit);
- void (*FillSpansSolid)(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted);
- void (*FillSpansStippled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted);
- void (*FillSpansOpaqueStippled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted);
- void (*FillSpansTiled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted);
- int (*PolyText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- char *chars);
- int (*PolyText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- unsigned short *chars);
- void (*ImageText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- char *chars);
- void (*ImageText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
- void (*ImageGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase);
- void (*PolyGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase);
- int (*PolyText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars);
- int (*PolyText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
- void (*ImageText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars);
- void (*ImageText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
- void (*ImageGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
- void (*PolyGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
- void (*PolyRectangleThinSolid)(DrawablePtr pDrawable,GCPtr pGC,
- int nRectsInit, xRectangle *pRectsInit);
- void (*PolylinesWideSolid)(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts);
- void (*PolylinesThinSolid)(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts);
- void (*PolySegmentThinSolid)(DrawablePtr pDrawable, GCPtr pGC, int nseg,
- xSegment *pSeg);
- void (*PolylinesThinDashed)(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts);
- void (*PolySegmentThinDashed)(DrawablePtr pDrawable, GCPtr pGC, int nseg,
- xSegment *pSeg);
- void (*FillPolygonSolid)(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn);
- void (*FillPolygonStippled)(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn);
- void (*FillPolygonOpaqueStippled)(DrawablePtr pDrawable, GCPtr pGC,
- int shape, int mode, int count,
- DDXPointPtr ptsIn);
- void (*FillPolygonTiled)(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn);
- void (*PolyFillArcSolid)(DrawablePtr pDraw, GCPtr pGC, int narcs,
- xArc *parcs);
- void (*PutImage)(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *pImage);
- ValidateGCProcPtr ValidateFillSpans;
- ValidateGCProcPtr ValidateSetSpans;
- ValidateGCProcPtr ValidatePutImage;
- ValidateGCProcPtr ValidateCopyArea;
- ValidateGCProcPtr ValidateCopyPlane;
- ValidateGCProcPtr ValidatePolyPoint;
- ValidateGCProcPtr ValidatePolylines;
- ValidateGCProcPtr ValidatePolySegment;
- ValidateGCProcPtr ValidatePolyRectangle;
- ValidateGCProcPtr ValidatePolyArc;
- ValidateGCProcPtr ValidateFillPolygon;
- ValidateGCProcPtr ValidatePolyFillRect;
- ValidateGCProcPtr ValidatePolyFillArc;
- ValidateGCProcPtr ValidatePolyText8;
- ValidateGCProcPtr ValidatePolyText16;
- ValidateGCProcPtr ValidateImageText8;
- ValidateGCProcPtr ValidateImageText16;
- ValidateGCProcPtr ValidatePolyGlyphBlt;
- ValidateGCProcPtr ValidateImageGlyphBlt;
- ValidateGCProcPtr ValidatePushPixels;
- void (*ComputeDash)(GCPtr pGC);
- void (*InitPixmapCache)(ScreenPtr pScreen, RegionPtr areas, pointer data);
- void (*ClosePixmapCache)(ScreenPtr pScreen);
- int (*StippledFillChooser)(GCPtr pGC);
- int (*OpaqueStippledFillChooser)(GCPtr pGC);
- int (*TiledFillChooser)(GCPtr pGC);
- XAACacheInfoPtr (*CacheTile)(ScrnInfoPtr Scrn, PixmapPtr pPix);
- XAACacheInfoPtr (*CacheStipple)(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg,
- int bg);
- XAACacheInfoPtr (*CacheMonoStipple)(ScrnInfoPtr Scrn, PixmapPtr pPix);
- XAACacheInfoPtr (*CacheMono8x8Pattern)(ScrnInfoPtr Scrn, int pat0,
- int pat1);
- XAACacheInfoPtr (*CacheColor8x8Pattern)(ScrnInfoPtr Scrn, PixmapPtr pPix,
- int fg, int bg);
- void (*WriteBitmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int fg,
- int bg);
- void (*WritePixmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int bpp,
- int depth);
- void (*WriteMono8x8PatternToCache)(ScrnInfoPtr pScrn,
- XAACacheInfoPtr pCache);
- void (*WriteColor8x8PatternToCache)(ScrnInfoPtr pScrn, PixmapPtr pPix,
- XAACacheInfoPtr pCache);
- GetImageProcPtr GetImage;
- GetSpansProcPtr GetSpans;
- CopyWindowProcPtr CopyWindow;
- Bool (*SetupForCPUToScreenAlphaTexture2)(ScrnInfoPtr pScrn, int op,
- CARD16 red, CARD16 green,
- CARD16 blue, CARD16 alpha,
- CARD32 maskFormat, CARD32 dstFormat,
- CARD8 *alphaPtr, int alphaPitch,
- int width, int height, int flags);
- Bool (*SetupForCPUToScreenTexture2)(ScrnInfoPtr pScrn, int op,
- CARD32 srcFormat, CARD32 dstFormat,
- CARD8 *texPtr, int texPitch,
- int width, int height, int flags);
-} XAAStateWrapRec, *XAAStateWrapPtr;
-
-static DevPrivateKeyRec XAAStateKeyRec;
-#define XAAStateKey (&XAAStateKeyRec)
-
-/* Wrap functions start here */
-#define GET_STATEPRIV_GC(pGC) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAStateKey)
-
-#define GET_STATEPRIV_SCREEN(pScreen) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAStateKey)
-
-#define GET_STATEPRIV_PSCRN(pScrn) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAStateKey)
-
-#define STATE_CHECK_SP(pStatePriv) {\
- ScrnInfoPtr pScrn = pStatePriv->pScrn;\
- int i = 0;\
- int need_change = 0;\
- while(i < pScrn->numEntities) {\
- if(xf86IsEntityShared(pScrn->entityList[i]) &&\
- xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
- need_change = 1;\
- xf86SetLastScrnFlag(pScrn->entityList[i],\
- pScrn->scrnIndex);\
- }\
- i++;\
- }\
- if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
-}
-
-#define STATE_CHECK_PSCRN(pScrn) {\
- int i = 0;\
- int need_change = 0;\
- while(i < pScrn->numEntities) {\
- if(xf86IsEntityShared(pScrn->entityList[i]) &&\
- xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
- need_change = 1;\
- xf86SetLastScrnFlag(pScrn->entityList[i],\
- pScrn->scrnIndex);\
- }\
- i++;\
- }\
- if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
-}
-
-static void XAAStateWrapSync(ScrnInfoPtr pScrn)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->Sync)(pScrn);
-}
-
-static void XAAStateWrapSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
- int rop, unsigned int planemask,
- int trans_color)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, rop, planemask,
- trans_color);
-}
-
-static void XAAStateWrapSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForSolidFill)(pScrn, color, rop, planemask);
-}
-
-static void XAAStateWrapSetupForSolidLine(ScrnInfoPtr pScrn,int color,int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForSolidLine)(pScrn, color, rop, planemask);
-}
-
-static void XAAStateWrapSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int length,
- unsigned char *pattern)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForDashedLine)(pScrn, fg, bg, rop, planemask, length, pattern);
-}
-
-static void XAAStateWrapSetClippingRectangle(ScrnInfoPtr pScrn, int left, int top,
- int right, int bottom)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetClippingRectangle)(pScrn, left, top, right, bottom);
-}
-
-static void XAAStateWrapDisableClipping(ScrnInfoPtr pScrn)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->DisableClipping)(pScrn);
-}
-
-static void XAAStateWrapSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
- int fg, int bg, int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForMono8x8PatternFill)(pScrn, patx, paty, fg, bg, rop, planemask);
-}
-
-static void XAAStateWrapSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
- int rop, unsigned int planemask,
- int transparency_color)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForColor8x8PatternFill)(pScrn, patx, paty, rop, planemask,
- transparency_color);
-}
-
-static void XAAStateWrapSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg,
- int bg, int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForCPUToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
-}
-
-static void XAAStateWrapSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int fg, int bg,
- int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForScanlineCPUToScreenColorExpandFill)(pScrn, fg, bg, rop,
- planemask);
-}
-
-static void XAAStateWrapSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForScreenToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
-}
-
-static void XAAStateWrapSetupForImageWrite(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForImageWrite)(pScrn, rop, planemask, transparency_color, bpp,
- depth);
-}
-
-static void XAAStateWrapSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForScanlineImageWrite)(pScrn, rop, planemask, transparency_color,
- bpp, depth);
-}
-
-static void XAAStateWrapSetupForImageRead(ScrnInfoPtr pScrn, int bpp, int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForImageRead)(pScrn, bpp, depth);
-}
-
-static void XAAStateWrapScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox,
- DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
- int ydir, int alu, unsigned int planmask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->ScreenToScreenBitBlt)(pScrn, nbox,
- pptSrc, pbox, xdir,
- ydir, alu, planmask);
-}
-
-static void XAAStateWrapWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int skipleft,
- int fg, int bg, int rop, unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WriteBitmap)(pScrn, x, y, w, h,
- src, srcwidth, skipleft,
- fg, bg, rop, planemask);
-}
-
-static void XAAStateWrapFillSolidRects(ScrnInfoPtr pScrn, int fg, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillSolidRects)(pScrn, fg, rop,
- planemask, nBox, pBox);
-}
-
-static void XAAStateWrapFillMono8x8PatternRects(ScrnInfoPtr pScrn, int fg, int bg,
- int rop, unsigned int planemask, int nBox,
- BoxPtr pBox, int pat0, int pat1,
- int xorg, int yorg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillMono8x8PatternRects)(pScrn, fg, bg,
- rop, planemask, nBox,
- pBox, pat0, pat1,
- xorg, yorg);
-}
-
-static void XAAStateWrapFillColor8x8PatternRects(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int xorg, int yorg,
- XAACacheInfoPtr pCache)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillColor8x8PatternRects)(pScrn, rop,
- planemask, nBox,
- pBox, xorg, yorg,
- pCache);
-}
-
-static void XAAStateWrapFillCacheBltRects(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox,
- int xorg, int yorg, XAACacheInfoPtr pCache)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillCacheBltRects)(pScrn, rop,
- planemask, nBox, pBox,
- xorg, yorg, pCache);
-}
-
-static void XAAStateWrapFillColorExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int xorg, int yorg,
- PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillColorExpandRects)(pScrn, fg, bg, rop,
- planemask, nBox,
- pBox, xorg, yorg,
- pPix);
-}
-
-static void XAAStateWrapFillCacheExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int xorg, int yorg,
- PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillCacheExpandRects)(pScrn, fg, bg, rop,
- planemask, nBox,
- pBox, xorg, yorg,
- pPix);
-}
-
-static void XAAStateWrapFillImageWriteRects(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox,
- int xorg, int yorg, PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillImageWriteRects)(pScrn, rop,
- planemask, nBox, pBox,
- xorg, yorg, pPix);
-}
-
-static void XAAStateWrapFillSolidSpans(ScrnInfoPtr pScrn, int fg, int rop,
- unsigned int planemask, int n, DDXPointPtr points,
- int *widths, int fSorted)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillSolidSpans)(pScrn, fg, rop,
- planemask, n, points,
- widths, fSorted);
-}
-
-static void XAAStateWrapFillMono8x8PatternSpans(ScrnInfoPtr pScrn, int fg, int bg,
- int rop, unsigned int planemask, int n,
- DDXPointPtr points, int *widths,
- int fSorted, int pat0, int pat1,
- int xorg, int yorg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillMono8x8PatternSpans)(pScrn, fg, bg,
- rop, planemask, n,
- points, widths,
- fSorted, pat0, pat1,
- xorg, yorg);
-}
-
-static void XAAStateWrapFillColor8x8PatternSpans(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths,
- int fSorted, XAACacheInfoPtr pCache,
- int xorg, int yorg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillColor8x8PatternSpans)(pScrn, rop,
- planemask, n,
- points, widths,
- fSorted, pCache,
- xorg, yorg);
-}
-
-static void XAAStateWrapFillCacheBltSpans(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths,
- int fSorted, XAACacheInfoPtr pCache,
- int xorg, int yorg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillCacheBltSpans)(pScrn, rop,
- planemask, n,
- points, widths,
- fSorted, pCache,
- xorg, yorg);
-}
-
-static void XAAStateWrapFillColorExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths, int fSorted,
- int xorg, int yorg, PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillColorExpandSpans)(pScrn, fg, bg, rop,
- planemask, n,
- points, widths, fSorted,
- xorg, yorg, pPix);
-}
-
-static void XAAStateWrapFillCacheExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int n,
- DDXPointPtr ppt, int *pwidth, int fSorted,
- int xorg, int yorg, PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillCacheExpandSpans)(pScrn, fg, bg, rop,
- planemask, n,
- ppt, pwidth, fSorted,
- xorg, yorg, pPix);
-}
-
-static void XAAStateWrapTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- int skipleft, int startline,
- unsigned int **glyphs,
- int glyphWidth, int fg, int bg, int rop,
- unsigned planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->TEGlyphRenderer)(pScrn, x, y, w, h,
- skipleft, startline,
- glyphs,
- glyphWidth, fg, bg, rop,
- planemask);
-}
-
-static void XAAStateWrapNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n,
- NonTEGlyphPtr glyphs, BoxPtr pbox,
- int fg, int rop, unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->NonTEGlyphRenderer)(pScrn, x, y, n,
- glyphs, pbox,
- fg, rop, planemask);
-}
-
-static void XAAStateWrapWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WritePixmap)(pScrn, x, y, w, h,
- src, srcwidth, rop,
- planemask, transparency_color,
- bpp, depth);
-}
-
-static void XAAStateWrapReadPixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *dst, int dstwidth, int bpp, int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->ReadPixmap)(pScrn, x, y, w, h,
- dst, dstwidth, bpp, depth);
-}
-
-static RegionPtr XAAStateWrapCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GC *pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->CopyArea)(pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height,
- dstx, dsty);
-}
-
-static RegionPtr XAAStateWrapCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long bitPlane)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->CopyPlane)(pSrc, pDst, pGC,
- srcx, srcy, width, height,
- dstx, dsty, bitPlane);
-}
-
-static void XAAStateWrapPushPixelsSolid(GCPtr pGC, PixmapPtr pBitMap,
- DrawablePtr pDrawable, int dx, int dy, int xOrg,
- int yOrg)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PushPixelsSolid)(pGC, pBitMap,
- pDrawable, dx, dy, xOrg,
- yOrg);
-}
-
-static void XAAStateWrapPolyFillRectSolid(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyFillRectSolid)(pDraw, pGC, nrectFill,
- prectInit);
-}
-
-static void XAAStateWrapPolyFillRectStippled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyFillRectStippled)(pDraw, pGC, nrectFill,
- prectInit);
-}
-
-static void XAAStateWrapPolyFillRectOpaqueStippled(DrawablePtr pDraw, GCPtr pGC,
- int nrectFill, xRectangle *prectInit)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyFillRectOpaqueStippled)(pDraw, pGC,
- nrectFill, prectInit);
-}
-
-static void XAAStateWrapPolyFillRectTiled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyFillRectTiled)(pDraw, pGC, nrectFill,
- prectInit);
-}
-
-static void XAAStateWrapFillSpansSolid(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillSpansSolid)(pDraw, pGC, nInit,
- ppt, pwidth, fSorted);
-}
-
-static void XAAStateWrapFillSpansStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillSpansStippled)(pDraw, pGC, nInit,
- ppt, pwidth, fSorted);
-}
-
-static void XAAStateWrapFillSpansOpaqueStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillSpansOpaqueStippled)(pDraw, pGC, nInit,
- ppt, pwidth, fSorted);
-}
-
-static void XAAStateWrapFillSpansTiled(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillSpansTiled)(pDraw, pGC, nInit,
- ppt, pwidth, fSorted);
-}
-
-static int XAAStateWrapPolyText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- char *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->PolyText8TE)(pDraw, pGC, x, y, count,
- chars);
-}
-
-static int XAAStateWrapPolyText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- unsigned short *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->PolyText16TE)(pDraw, pGC, x, y, count,
- chars);
-}
-
-static void XAAStateWrapImageText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageText8TE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static void XAAStateWrapImageText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageText16TE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static void XAAStateWrapImageGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageGlyphBltTE)(pDrawable, pGC, xInit,
- yInit, nglyph, ppci,
- pglyphBase);
-}
-
-static void XAAStateWrapPolyGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyGlyphBltTE)(pDrawable, pGC, xInit,
- yInit, nglyph, ppci,
- pglyphBase);
-}
-
-static int XAAStateWrapPolyText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->PolyText8NonTE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static int XAAStateWrapPolyText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->PolyText16NonTE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static void XAAStateWrapImageText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageText8NonTE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static void XAAStateWrapImageText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageText16NonTE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static void XAAStateWrapImageGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageGlyphBltNonTE)(pDrawable, pGC, xInit,
- yInit, nglyph,
- ppci, pglyphBase);
-}
-
-static void XAAStateWrapPolyGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyGlyphBltNonTE)(pDrawable, pGC, xInit,
- yInit, nglyph,
- ppci, pglyphBase);
-}
-
-static void XAAStateWrapPolyRectangleThinSolid(DrawablePtr pDrawable,GCPtr pGC,
- int nRectsInit, xRectangle *pRectsInit)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyRectangleThinSolid)(pDrawable, pGC,
- nRectsInit, pRectsInit);
-}
-
-static void XAAStateWrapPolylinesWideSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolylinesWideSolid)(pDrawable, pGC, mode,
- npt, pPts);
-}
-
-static void XAAStateWrapPolylinesThinSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolylinesThinSolid)(pDrawable, pGC, mode,
- npt, pPts);
-}
-
-static void XAAStateWrapPolySegmentThinSolid(DrawablePtr pDrawable, GCPtr pGC, int nseg,
- xSegment *pSeg)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolySegmentThinSolid)(pDrawable, pGC, nseg,
- pSeg);
-}
-
-static void XAAStateWrapPolylinesThinDashed(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolylinesThinDashed)(pDrawable, pGC, mode,
- npt, pPts);
-}
-
-static void XAAStateWrapPolySegmentThinDashed(DrawablePtr pDrawable, GCPtr pGC, int nseg,
- xSegment *pSeg)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolySegmentThinDashed)(pDrawable, pGC, nseg,
- pSeg);
-}
-
-static void XAAStateWrapFillPolygonSolid(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillPolygonSolid)(pDrawable, pGC, shape,
- mode, count, ptsIn);
-}
-
-static void XAAStateWrapFillPolygonStippled(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillPolygonStippled)(pDrawable, pGC, shape,
- mode, count, ptsIn);
-}
-
-static void XAAStateWrapFillPolygonOpaqueStippled(DrawablePtr pDrawable, GCPtr pGC,
- int shape, int mode, int count,
- DDXPointPtr ptsIn)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillPolygonOpaqueStippled)(pDrawable, pGC,
- shape, mode, count,
- ptsIn);
-}
-
-static void XAAStateWrapFillPolygonTiled(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillPolygonTiled)(pDrawable, pGC, shape,
- mode, count, ptsIn);
-}
-
-static void XAAStateWrapPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs,
- xArc *parcs)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyFillArcSolid)(pDraw, pGC, narcs,
- parcs);
-}
-
-static void XAAStateWrapPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *pImage)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PutImage)(pDraw, pGC, depth, x, y,
- w, h, leftPad, format, pImage);
-}
-
-static void XAAStateWrapValidateFillSpans(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateFillSpans)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateSetSpans(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateSetSpans)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePutImage(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePutImage)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateCopyArea(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateCopyArea)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateCopyPlane(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateCopyPlane)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyPoint(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyPoint)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolylines(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolylines)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolySegment(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolySegment)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyRectangle(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyRectangle)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyArc(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyArc)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateFillPolygon(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateFillPolygon)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyFillRect(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyFillRect)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyFillArc(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyFillArc)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyText8(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyText8)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyText16(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyText16)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateImageText8(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateImageText8)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateImageText16(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateImageText16)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyGlyphBlt)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateImageGlyphBlt(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
- (*pStatePriv->ValidateImageGlyphBlt)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePushPixels(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePushPixels)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapComputeDash(GCPtr pGC)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ComputeDash)(pGC);
-}
-
-static void XAAStateWrapInitPixmapCache(ScreenPtr pScreen, RegionPtr areas,
- pointer data)
-{
- GET_STATEPRIV_SCREEN(pScreen);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->InitPixmapCache)(pScreen, areas,
- data);
-}
-
-static void XAAStateWrapClosePixmapCache(ScreenPtr pScreen)
-{
- GET_STATEPRIV_SCREEN(pScreen);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ClosePixmapCache)(pScreen);
-}
-
-static int XAAStateWrapStippledFillChooser(GCPtr pGC)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->StippledFillChooser)(pGC);
-}
-
-static int XAAStateWrapOpaqueStippledFillChooser(GCPtr pGC)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->OpaqueStippledFillChooser)(pGC);
-}
-
-static int XAAStateWrapTiledFillChooser(GCPtr pGC)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->TiledFillChooser)(pGC);
-}
-
-static XAACacheInfoPtr XAAStateWrapCacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->CacheTile)(pScrn, pPix);
-}
-
-static XAACacheInfoPtr XAAStateWrapCacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg,
- int bg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->CacheStipple)(pScrn, pPix, fg,
- bg);
-}
-
-static XAACacheInfoPtr XAAStateWrapCacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->CacheMonoStipple)(pScrn, pPix);
-}
-
-static XAACacheInfoPtr XAAStateWrapCacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0,
- int pat1)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->CacheMono8x8Pattern)(pScrn, pat0,
- pat1);
-}
-
-static XAACacheInfoPtr XAAStateWrapCacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix,
- int fg, int bg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->CacheColor8x8Pattern)(pScrn, pPix,
- fg, bg);
-}
-
-static void XAAStateWrapWriteBitmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int fg,
- int bg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WriteBitmapToCache)(pScrn, x, y, w, h,
- src, srcwidth, fg,
- bg);
-}
-
-static void XAAStateWrapWritePixmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int bpp,
- int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WritePixmapToCache)(pScrn, x, y, w, h,
- src, srcwidth, bpp,
- depth);
-}
-
-static void XAAStateWrapWriteMono8x8PatternToCache(ScrnInfoPtr pScrn,
- XAACacheInfoPtr pCache)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WriteMono8x8PatternToCache)(pScrn,
- pCache);
-}
-
-static void XAAStateWrapWriteColor8x8PatternToCache(ScrnInfoPtr pScrn, PixmapPtr pPix,
- XAACacheInfoPtr pCache)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WriteColor8x8PatternToCache)(pScrn, pPix,
- pCache);
-}
-
-static void XAAStateWrapGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
- unsigned int format,unsigned long planeMask,
- char *pdstLine)
-{
- GET_STATEPRIV_SCREEN(pDrawable->pScreen);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->GetImage)(pDrawable, sx, sy, w, h,
- format, planeMask,
- pdstLine);
-}
-
-static void XAAStateWrapGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
- int *pwidth, int nspans, char *pdstStart)
-{
- GET_STATEPRIV_SCREEN(pDrawable->pScreen);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->GetSpans)(pDrawable, wMax, ppt,
- pwidth, nspans, pdstStart);
-}
-
-static void XAAStateWrapCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
-{
- GET_STATEPRIV_SCREEN(pWindow->drawable.pScreen);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->CopyWindow)(pWindow, ptOldOrg,
- prgnSrc);
-}
-
-static Bool XAAStateWrapSetupForCPUToScreenAlphaTexture2(ScrnInfoPtr pScrn,
- int op, CARD16 red,
- CARD16 green,
- CARD16 blue,
- CARD16 alpha,
- CARD32 srcFormat,
- CARD32 dstFormat,
- CARD8 *alphaPtr,
- int alphaPitch,
- int width, int height,
- int flags)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->SetupForCPUToScreenAlphaTexture2)(pScrn, op, red, green,
- blue, alpha, srcFormat,
- dstFormat, alphaPtr,
- alphaPitch, width,
- height, flags);
-}
-
-static Bool XAAStateWrapSetupForCPUToScreenTexture2(ScrnInfoPtr pScrn, int op,
- CARD32 srcFormat,
- CARD32 dstFormat,
- CARD8 *texPtr, int texPitch,
- int width, int height,
- int flags)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->SetupForCPUToScreenTexture2)(pScrn, op, srcFormat,
- dstFormat, texPtr, texPitch,
- width, height, flags);
-}
-
-/* Setup Function */
-Bool
-XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAStateWrapPtr pStatePriv;
- int i = 0;
-
- if (!dixRegisterPrivateKey(&XAAStateKeyRec, PRIVATE_SCREEN, 0)) return FALSE;
- if(!(pStatePriv = malloc(sizeof(XAAStateWrapRec)))) return FALSE;
- dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv);
- pStatePriv->RestoreAccelState = infoRec->RestoreAccelState;
- pStatePriv->pScrn = pScrn;
-
- /* Initialize the last screen to -1 so whenever an accel function
- * is called the proper state is setup
- */
- while(i < pScrn->numEntities) {
- xf86SetLastScrnFlag(pScrn->entityList[i], -1);
- i++;
- }
-/* Do the wrapping */
- XAA_STATE_WRAP(Sync);
- XAA_STATE_WRAP(SetupForScreenToScreenCopy);
- XAA_STATE_WRAP(SetupForSolidFill);
- XAA_STATE_WRAP(SetupForSolidLine);
- XAA_STATE_WRAP(SetupForDashedLine);
- XAA_STATE_WRAP(SetClippingRectangle);
- XAA_STATE_WRAP(DisableClipping);
- XAA_STATE_WRAP(SetupForMono8x8PatternFill);
- XAA_STATE_WRAP(SetupForColor8x8PatternFill);
- XAA_STATE_WRAP(SetupForCPUToScreenColorExpandFill);
- XAA_STATE_WRAP(SetupForScanlineCPUToScreenColorExpandFill);
- XAA_STATE_WRAP(SetupForScreenToScreenColorExpandFill);
- XAA_STATE_WRAP(SetupForImageWrite);
- XAA_STATE_WRAP(SetupForScanlineImageWrite);
- XAA_STATE_WRAP(SetupForImageRead);
- XAA_STATE_WRAP(ScreenToScreenBitBlt);
- XAA_STATE_WRAP(WriteBitmap);
- XAA_STATE_WRAP(FillSolidRects);
- XAA_STATE_WRAP(FillMono8x8PatternRects);
- XAA_STATE_WRAP(FillColor8x8PatternRects);
- XAA_STATE_WRAP(FillCacheBltRects);
- XAA_STATE_WRAP(FillColorExpandRects);
- XAA_STATE_WRAP(FillCacheExpandRects);
- XAA_STATE_WRAP(FillImageWriteRects);
- XAA_STATE_WRAP(FillSolidSpans);
- XAA_STATE_WRAP(FillMono8x8PatternSpans);
- XAA_STATE_WRAP(FillColor8x8PatternSpans);
- XAA_STATE_WRAP(FillCacheBltSpans);
- XAA_STATE_WRAP(FillColorExpandSpans);
- XAA_STATE_WRAP(FillCacheExpandSpans);
- XAA_STATE_WRAP(TEGlyphRenderer);
- XAA_STATE_WRAP(NonTEGlyphRenderer);
- XAA_STATE_WRAP(WritePixmap);
- XAA_STATE_WRAP(ReadPixmap);
- XAA_STATE_WRAP(CopyArea);
- XAA_STATE_WRAP(CopyPlane);
- XAA_STATE_WRAP(PushPixelsSolid);
- XAA_STATE_WRAP(PolyFillRectSolid);
- XAA_STATE_WRAP(PolyFillRectStippled);
- XAA_STATE_WRAP(PolyFillRectOpaqueStippled);
- XAA_STATE_WRAP(PolyFillRectTiled);
- XAA_STATE_WRAP(FillSpansSolid);
- XAA_STATE_WRAP(FillSpansStippled);
- XAA_STATE_WRAP(FillSpansOpaqueStippled);
- XAA_STATE_WRAP(FillSpansTiled);
- XAA_STATE_WRAP(PolyText8TE);
- XAA_STATE_WRAP(PolyText16TE);
- XAA_STATE_WRAP(ImageText8TE);
- XAA_STATE_WRAP(ImageText16TE);
- XAA_STATE_WRAP(ImageGlyphBltTE);
- XAA_STATE_WRAP(PolyGlyphBltTE);
- XAA_STATE_WRAP(PolyText8NonTE);
- XAA_STATE_WRAP(PolyText16NonTE);
- XAA_STATE_WRAP(ImageText8NonTE);
- XAA_STATE_WRAP(ImageText16NonTE);
- XAA_STATE_WRAP(ImageGlyphBltNonTE);
- XAA_STATE_WRAP(PolyGlyphBltNonTE);
- XAA_STATE_WRAP(PolyRectangleThinSolid);
- XAA_STATE_WRAP(PolylinesWideSolid);
- XAA_STATE_WRAP(PolylinesThinSolid);
- XAA_STATE_WRAP(PolySegmentThinSolid);
- XAA_STATE_WRAP(PolylinesThinDashed);
- XAA_STATE_WRAP(PolySegmentThinDashed);
- XAA_STATE_WRAP(FillPolygonSolid);
- XAA_STATE_WRAP(FillPolygonStippled);
- XAA_STATE_WRAP(FillPolygonOpaqueStippled);
- XAA_STATE_WRAP(FillPolygonTiled);
- XAA_STATE_WRAP(PolyFillArcSolid);
- XAA_STATE_WRAP(PutImage);
- XAA_STATE_WRAP(ValidateFillSpans);
- XAA_STATE_WRAP(ValidateSetSpans);
- XAA_STATE_WRAP(ValidatePutImage);
- XAA_STATE_WRAP(ValidateCopyArea);
- XAA_STATE_WRAP(ValidateCopyPlane);
- XAA_STATE_WRAP(ValidatePolyPoint);
- XAA_STATE_WRAP(ValidatePolylines);
- XAA_STATE_WRAP(ValidatePolySegment);
- XAA_STATE_WRAP(ValidatePolyRectangle);
- XAA_STATE_WRAP(ValidatePolyArc);
- XAA_STATE_WRAP(ValidateFillPolygon);
- XAA_STATE_WRAP(ValidatePolyFillRect);
- XAA_STATE_WRAP(ValidatePolyFillArc);
- XAA_STATE_WRAP(ValidatePolyText8);
- XAA_STATE_WRAP(ValidatePolyText16);
- XAA_STATE_WRAP(ValidateImageText8);
- XAA_STATE_WRAP(ValidateImageText16);
- XAA_STATE_WRAP(ValidatePolyGlyphBlt);
- XAA_STATE_WRAP(ValidateImageGlyphBlt);
- XAA_STATE_WRAP(ValidatePushPixels);
- XAA_STATE_WRAP(ComputeDash);
- XAA_STATE_WRAP(InitPixmapCache);
- XAA_STATE_WRAP(ClosePixmapCache);
- XAA_STATE_WRAP(StippledFillChooser);
- XAA_STATE_WRAP(OpaqueStippledFillChooser);
- XAA_STATE_WRAP(TiledFillChooser);
- XAA_STATE_WRAP(CacheTile);
- XAA_STATE_WRAP(CacheStipple);
- XAA_STATE_WRAP(CacheMonoStipple);
- XAA_STATE_WRAP(CacheMono8x8Pattern);
- XAA_STATE_WRAP(CacheColor8x8Pattern);
- XAA_STATE_WRAP(WriteBitmapToCache);
- XAA_STATE_WRAP(WritePixmapToCache);
- XAA_STATE_WRAP(WriteMono8x8PatternToCache);
- XAA_STATE_WRAP(WriteColor8x8PatternToCache);
- XAA_STATE_WRAP(GetImage);
- XAA_STATE_WRAP(GetSpans);
- XAA_STATE_WRAP(CopyWindow);
- XAA_STATE_WRAP(SetupForCPUToScreenAlphaTexture2);
- XAA_STATE_WRAP(SetupForCPUToScreenTexture2);
- return TRUE;
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "servermd.h"
+
+#define XAA_STATE_WRAP(func) do {\
+if(infoRec->func) { \
+ pStatePriv->func = infoRec->func;\
+ infoRec->func = XAAStateWrap##func;\
+}} while(0)
+
+/* Wrap all XAA functions and allocate our private structure.
+ */
+
+typedef struct _XAAStateWrapRec {
+ ScrnInfoPtr pScrn;
+ void (*RestoreAccelState) (ScrnInfoPtr pScrn);
+ void (*Sync) (ScrnInfoPtr pScrn);
+ void (*SetupForScreenToScreenCopy) (ScrnInfoPtr pScrn, int xdir, int ydir,
+ int rop, unsigned int planemask,
+ int trans_color);
+ void (*SetupForSolidFill) (ScrnInfoPtr pScrn, int color, int rop,
+ unsigned int planemask);
+ void (*SetupForSolidLine) (ScrnInfoPtr pScrn, int color, int rop,
+ unsigned int planemask);
+ void (*SetupForDashedLine) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int length,
+ unsigned char *pattern);
+ void (*SetClippingRectangle) (ScrnInfoPtr pScrn, int left, int top,
+ int right, int bottom);
+ void (*DisableClipping) (ScrnInfoPtr pScrn);
+ void (*SetupForMono8x8PatternFill) (ScrnInfoPtr pScrn, int patx, int paty,
+ int fg, int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForColor8x8PatternFill) (ScrnInfoPtr pScrn, int patx, int paty,
+ int rop, unsigned int planemask,
+ int transparency_color);
+ void (*SetupForCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn, int fg,
+ int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForScanlineCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForImageWrite) (ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth);
+ void (*SetupForScanlineImageWrite) (ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth);
+ void (*SetupForImageRead) (ScrnInfoPtr pScrn, int bpp, int depth);
+ void (*ScreenToScreenBitBlt) (ScrnInfoPtr pScrn, int nbox,
+ DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
+ int ydir, int alu, unsigned int planmask);
+ void (*WriteBitmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int skipleft,
+ int fg, int bg, int rop, unsigned int planemask);
+ void (*FillSolidRects) (ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox);
+ void (*FillMono8x8PatternRects) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int pat0, int pat1,
+ int xorg, int yorg);
+ void (*FillColor8x8PatternRects) (ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ XAACacheInfoPtr pCache);
+ void (*FillCacheBltRects) (ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, XAACacheInfoPtr pCache);
+ void (*FillColorExpandRects) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ PixmapPtr pPix);
+ void (*FillCacheExpandRects) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+ void (*FillImageWriteRects) (ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+ void (*FillSolidSpans) (ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int n, DDXPointPtr points,
+ int *widths, int fSorted);
+ void (*FillMono8x8PatternSpans) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, int pat0, int pat1,
+ int xorg, int yorg);
+ void (*FillColor8x8PatternSpans) (ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg);
+ void (*FillCacheBltSpans) (ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths, int fSorted,
+ XAACacheInfoPtr pCache, int xorg, int yorg);
+ void (*FillColorExpandSpans) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths, int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+ void (*FillCacheExpandSpans) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr ppt, int *pwidth, int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+ void (*TEGlyphRenderer) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ int skipleft, int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+ void (*NonTEGlyphRenderer) (ScrnInfoPtr pScrn, int x, int y, int n,
+ NonTEGlyphPtr glyphs, BoxPtr pbox, int fg,
+ int rop, unsigned int planemask);
+ void (*WritePixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth);
+ void (*ReadPixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *dst, int dstwidth, int bpp, int depth);
+ RegionPtr (*CopyArea) (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GC * pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty);
+ RegionPtr (*CopyPlane) (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height, int dstx,
+ int dsty, unsigned long bitPlane);
+ void (*PushPixelsSolid) (GCPtr pGC, PixmapPtr pBitMap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg,
+ int yOrg);
+ void (*PolyFillRectSolid) (DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit);
+ void (*PolyFillRectStippled) (DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit);
+ void (*PolyFillRectOpaqueStippled) (DrawablePtr pDraw, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+ void (*PolyFillRectTiled) (DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit);
+ void (*FillSpansSolid) (DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ void (*FillSpansStippled) (DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ void (*FillSpansOpaqueStippled) (DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ void (*FillSpansTiled) (DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ int (*PolyText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ char *chars);
+ int (*PolyText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ unsigned short *chars);
+ void (*ImageText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ char *chars);
+ void (*ImageText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+ void (*ImageGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr * ppci,
+ pointer pglyphBase);
+ void (*PolyGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr * ppci,
+ pointer pglyphBase);
+ int (*PolyText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars);
+ int (*PolyText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+ void (*ImageText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars);
+ void (*ImageText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+ void (*ImageGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+ void (*PolyGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+ void (*PolyRectangleThinSolid) (DrawablePtr pDrawable, GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit);
+ void (*PolylinesWideSolid) (DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts);
+ void (*PolylinesThinSolid) (DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts);
+ void (*PolySegmentThinSolid) (DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment * pSeg);
+ void (*PolylinesThinDashed) (DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts);
+ void (*PolySegmentThinDashed) (DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment * pSeg);
+ void (*FillPolygonSolid) (DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ void (*FillPolygonStippled) (DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ void (*FillPolygonOpaqueStippled) (DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr ptsIn);
+ void (*FillPolygonTiled) (DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ void (*PolyFillArcSolid) (DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc * parcs);
+ void (*PutImage) (DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage);
+ ValidateGCProcPtr ValidateFillSpans;
+ ValidateGCProcPtr ValidateSetSpans;
+ ValidateGCProcPtr ValidatePutImage;
+ ValidateGCProcPtr ValidateCopyArea;
+ ValidateGCProcPtr ValidateCopyPlane;
+ ValidateGCProcPtr ValidatePolyPoint;
+ ValidateGCProcPtr ValidatePolylines;
+ ValidateGCProcPtr ValidatePolySegment;
+ ValidateGCProcPtr ValidatePolyRectangle;
+ ValidateGCProcPtr ValidatePolyArc;
+ ValidateGCProcPtr ValidateFillPolygon;
+ ValidateGCProcPtr ValidatePolyFillRect;
+ ValidateGCProcPtr ValidatePolyFillArc;
+ ValidateGCProcPtr ValidatePolyText8;
+ ValidateGCProcPtr ValidatePolyText16;
+ ValidateGCProcPtr ValidateImageText8;
+ ValidateGCProcPtr ValidateImageText16;
+ ValidateGCProcPtr ValidatePolyGlyphBlt;
+ ValidateGCProcPtr ValidateImageGlyphBlt;
+ ValidateGCProcPtr ValidatePushPixels;
+ void (*ComputeDash) (GCPtr pGC);
+ void (*InitPixmapCache) (ScreenPtr pScreen, RegionPtr areas, pointer data);
+ void (*ClosePixmapCache) (ScreenPtr pScreen);
+ int (*StippledFillChooser) (GCPtr pGC);
+ int (*OpaqueStippledFillChooser) (GCPtr pGC);
+ int (*TiledFillChooser) (GCPtr pGC);
+ XAACacheInfoPtr(*CacheTile) (ScrnInfoPtr Scrn, PixmapPtr pPix);
+ XAACacheInfoPtr(*CacheStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix, int fg,
+ int bg);
+ XAACacheInfoPtr(*CacheMonoStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix);
+ XAACacheInfoPtr(*CacheMono8x8Pattern) (ScrnInfoPtr Scrn, int pat0,
+ int pat1);
+ XAACacheInfoPtr(*CacheColor8x8Pattern) (ScrnInfoPtr Scrn, PixmapPtr pPix,
+ int fg, int bg);
+ void (*WriteBitmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int fg,
+ int bg);
+ void (*WritePixmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int bpp,
+ int depth);
+ void (*WriteMono8x8PatternToCache) (ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache);
+ void (*WriteColor8x8PatternToCache) (ScrnInfoPtr pScrn, PixmapPtr pPix,
+ XAACacheInfoPtr pCache);
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ CopyWindowProcPtr CopyWindow;
+ Bool (*SetupForCPUToScreenAlphaTexture2) (ScrnInfoPtr pScrn, int op,
+ CARD16 red, CARD16 green,
+ CARD16 blue, CARD16 alpha,
+ CARD32 maskFormat,
+ CARD32 dstFormat, CARD8 *alphaPtr,
+ int alphaPitch, int width,
+ int height, int flags);
+ Bool (*SetupForCPUToScreenTexture2) (ScrnInfoPtr pScrn, int op,
+ CARD32 srcFormat, CARD32 dstFormat,
+ CARD8 *texPtr, int texPitch, int width,
+ int height, int flags);
+} XAAStateWrapRec, *XAAStateWrapPtr;
+
+static DevPrivateKeyRec XAAStateKeyRec;
+
+#define XAAStateKey (&XAAStateKeyRec)
+
+/* Wrap functions start here */
+#define GET_STATEPRIV_GC(pGC) XAAStateWrapPtr pStatePriv =\
+(XAAStateWrapPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAStateKey)
+
+#define GET_STATEPRIV_SCREEN(pScreen) XAAStateWrapPtr pStatePriv =\
+(XAAStateWrapPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAStateKey)
+
+#define GET_STATEPRIV_PSCRN(pScrn) XAAStateWrapPtr pStatePriv =\
+(XAAStateWrapPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAStateKey)
+
+#define STATE_CHECK_SP(pStatePriv) {\
+ ScrnInfoPtr pScrn = pStatePriv->pScrn;\
+ int i = 0;\
+ int need_change = 0;\
+ while(i < pScrn->numEntities) {\
+ if(xf86IsEntityShared(pScrn->entityList[i]) &&\
+ xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
+ need_change = 1;\
+ xf86SetLastScrnFlag(pScrn->entityList[i],\
+ pScrn->scrnIndex);\
+ }\
+ i++;\
+ }\
+ if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
+}
+
+#define STATE_CHECK_PSCRN(pScrn) {\
+ int i = 0;\
+ int need_change = 0;\
+ while(i < pScrn->numEntities) {\
+ if(xf86IsEntityShared(pScrn->entityList[i]) &&\
+ xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
+ need_change = 1;\
+ xf86SetLastScrnFlag(pScrn->entityList[i],\
+ pScrn->scrnIndex);\
+ }\
+ i++;\
+ }\
+ if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
+}
+
+static void
+XAAStateWrapSync(ScrnInfoPtr pScrn)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->Sync) (pScrn);
+}
+
+static void
+XAAStateWrapSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
+ int rop, unsigned int planemask,
+ int trans_color)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScreenToScreenCopy) (pScrn, xdir, ydir, rop,
+ planemask, trans_color);
+}
+
+static void
+XAAStateWrapSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForSolidFill) (pScrn, color, rop, planemask);
+}
+
+static void
+XAAStateWrapSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForSolidLine) (pScrn, color, rop, planemask);
+}
+
+static void
+XAAStateWrapSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int length,
+ unsigned char *pattern)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForDashedLine) (pScrn, fg, bg, rop, planemask, length,
+ pattern);
+}
+
+static void
+XAAStateWrapSetClippingRectangle(ScrnInfoPtr pScrn, int left, int top,
+ int right, int bottom)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetClippingRectangle) (pScrn, left, top, right, bottom);
+}
+
+static void
+XAAStateWrapDisableClipping(ScrnInfoPtr pScrn)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->DisableClipping) (pScrn);
+}
+
+static void
+XAAStateWrapSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
+ int fg, int bg, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForMono8x8PatternFill) (pScrn, patx, paty, fg, bg, rop,
+ planemask);
+}
+
+static void
+XAAStateWrapSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
+ int rop, unsigned int planemask,
+ int transparency_color)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForColor8x8PatternFill) (pScrn, patx, paty, rop,
+ planemask, transparency_color);
+}
+
+static void
+XAAStateWrapSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg,
+ int bg, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+}
+
+static void
+XAAStateWrapSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg,
+ rop, planemask);
+}
+
+static void
+XAAStateWrapSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScreenToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+}
+
+static void
+XAAStateWrapSetupForImageWrite(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForImageWrite) (pScrn, rop, planemask,
+ transparency_color, bpp, depth);
+}
+
+static void
+XAAStateWrapSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScanlineImageWrite) (pScrn, rop, planemask,
+ transparency_color, bpp, depth);
+}
+
+static void
+XAAStateWrapSetupForImageRead(ScrnInfoPtr pScrn, int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForImageRead) (pScrn, bpp, depth);
+}
+
+static void
+XAAStateWrapScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox,
+ DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
+ int ydir, int alu, unsigned int planmask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->ScreenToScreenBitBlt) (pScrn, nbox,
+ pptSrc, pbox, xdir,
+ ydir, alu, planmask);
+}
+
+static void
+XAAStateWrapWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int skipleft,
+ int fg, int bg, int rop, unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteBitmap) (pScrn, x, y, w, h,
+ src, srcwidth, skipleft,
+ fg, bg, rop, planemask);
+}
+
+static void
+XAAStateWrapFillSolidRects(ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillSolidRects) (pScrn, fg, rop, planemask, nBox, pBox);
+}
+
+static void
+XAAStateWrapFillMono8x8PatternRects(ScrnInfoPtr pScrn, int fg, int bg,
+ int rop, unsigned int planemask, int nBox,
+ BoxPtr pBox, int pat0, int pat1,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillMono8x8PatternRects) (pScrn, fg, bg,
+ rop, planemask, nBox,
+ pBox, pat0, pat1, xorg, yorg);
+}
+
+static void
+XAAStateWrapFillColor8x8PatternRects(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColor8x8PatternRects) (pScrn, rop,
+ planemask, nBox,
+ pBox, xorg, yorg, pCache);
+}
+
+static void
+XAAStateWrapFillCacheBltRects(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheBltRects) (pScrn, rop,
+ planemask, nBox, pBox,
+ xorg, yorg, pCache);
+}
+
+static void
+XAAStateWrapFillColorExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColorExpandRects) (pScrn, fg, bg, rop,
+ planemask, nBox,
+ pBox, xorg, yorg, pPix);
+}
+
+static void
+XAAStateWrapFillCacheExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheExpandRects) (pScrn, fg, bg, rop,
+ planemask, nBox,
+ pBox, xorg, yorg, pPix);
+}
+
+static void
+XAAStateWrapFillImageWriteRects(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillImageWriteRects) (pScrn, rop,
+ planemask, nBox, pBox,
+ xorg, yorg, pPix);
+}
+
+static void
+XAAStateWrapFillSolidSpans(ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int n, DDXPointPtr points,
+ int *widths, int fSorted)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillSolidSpans) (pScrn, fg, rop,
+ planemask, n, points, widths, fSorted);
+}
+
+static void
+XAAStateWrapFillMono8x8PatternSpans(ScrnInfoPtr pScrn, int fg, int bg,
+ int rop, unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, int pat0, int pat1,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillMono8x8PatternSpans) (pScrn, fg, bg,
+ rop, planemask, n,
+ points, widths,
+ fSorted, pat0, pat1, xorg, yorg);
+}
+
+static void
+XAAStateWrapFillColor8x8PatternSpans(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColor8x8PatternSpans) (pScrn, rop,
+ planemask, n,
+ points, widths,
+ fSorted, pCache, xorg, yorg);
+}
+
+static void
+XAAStateWrapFillCacheBltSpans(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheBltSpans) (pScrn, rop,
+ planemask, n,
+ points, widths,
+ fSorted, pCache, xorg, yorg);
+}
+
+static void
+XAAStateWrapFillColorExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths, int fSorted,
+ int xorg, int yorg, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColorExpandSpans) (pScrn, fg, bg, rop,
+ planemask, n,
+ points, widths, fSorted,
+ xorg, yorg, pPix);
+}
+
+static void
+XAAStateWrapFillCacheExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr ppt, int *pwidth, int fSorted,
+ int xorg, int yorg, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheExpandSpans) (pScrn, fg, bg, rop,
+ planemask, n,
+ ppt, pwidth, fSorted,
+ xorg, yorg, pPix);
+}
+
+static void
+XAAStateWrapTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ int skipleft, int startline,
+ unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->TEGlyphRenderer) (pScrn, x, y, w, h,
+ skipleft, startline,
+ glyphs, glyphWidth, fg, bg, rop, planemask);
+}
+
+static void
+XAAStateWrapNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n,
+ NonTEGlyphPtr glyphs, BoxPtr pbox,
+ int fg, int rop, unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->NonTEGlyphRenderer) (pScrn, x, y, n,
+ glyphs, pbox, fg, rop, planemask);
+}
+
+static void
+XAAStateWrapWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WritePixmap) (pScrn, x, y, w, h,
+ src, srcwidth, rop,
+ planemask, transparency_color, bpp, depth);
+}
+
+static void
+XAAStateWrapReadPixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *dst, int dstwidth, int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->ReadPixmap) (pScrn, x, y, w, h, dst, dstwidth, bpp, depth);
+}
+
+static RegionPtr
+XAAStateWrapCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GC * pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->CopyArea) (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+}
+
+static RegionPtr
+XAAStateWrapCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->CopyPlane) (pSrc, pDst, pGC,
+ srcx, srcy, width, height,
+ dstx, dsty, bitPlane);
+}
+
+static void
+XAAStateWrapPushPixelsSolid(GCPtr pGC, PixmapPtr pBitMap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg,
+ int yOrg)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PushPixelsSolid) (pGC, pBitMap,
+ pDrawable, dx, dy, xOrg, yOrg);
+}
+
+static void
+XAAStateWrapPolyFillRectSolid(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectSolid) (pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAStateWrapPolyFillRectStippled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectStippled) (pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAStateWrapPolyFillRectOpaqueStippled(DrawablePtr pDraw, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectOpaqueStippled) (pDraw, pGC,
+ nrectFill, prectInit);
+}
+
+static void
+XAAStateWrapPolyFillRectTiled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectTiled) (pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAStateWrapFillSpansSolid(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansSolid) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+static void
+XAAStateWrapFillSpansStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansStippled) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+static void
+XAAStateWrapFillSpansOpaqueStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansOpaqueStippled) (pDraw, pGC, nInit,
+ ppt, pwidth, fSorted);
+}
+
+static void
+XAAStateWrapFillSpansTiled(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansTiled) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+static int
+XAAStateWrapPolyText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText8TE) (pDraw, pGC, x, y, count, chars);
+}
+
+static int
+XAAStateWrapPolyText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText16TE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAStateWrapImageText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText8TE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAStateWrapImageText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText16TE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAStateWrapImageGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr * ppci,
+ pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageGlyphBltTE) (pDrawable, pGC, xInit,
+ yInit, nglyph, ppci, pglyphBase);
+}
+
+static void
+XAAStateWrapPolyGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr * ppci,
+ pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyGlyphBltTE) (pDrawable, pGC, xInit,
+ yInit, nglyph, ppci, pglyphBase);
+}
+
+static int
+XAAStateWrapPolyText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText8NonTE) (pDraw, pGC, x, y, count, chars);
+}
+
+static int
+XAAStateWrapPolyText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText16NonTE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAStateWrapImageText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText8NonTE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAStateWrapImageText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText16NonTE) (pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAStateWrapImageGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageGlyphBltNonTE) (pDrawable, pGC, xInit,
+ yInit, nglyph, ppci, pglyphBase);
+}
+
+static void
+XAAStateWrapPolyGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyGlyphBltNonTE) (pDrawable, pGC, xInit,
+ yInit, nglyph, ppci, pglyphBase);
+}
+
+static void
+XAAStateWrapPolyRectangleThinSolid(DrawablePtr pDrawable, GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyRectangleThinSolid) (pDrawable, pGC,
+ nRectsInit, pRectsInit);
+}
+
+static void
+XAAStateWrapPolylinesWideSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolylinesWideSolid) (pDrawable, pGC, mode, npt, pPts);
+}
+
+static void
+XAAStateWrapPolylinesThinSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolylinesThinSolid) (pDrawable, pGC, mode, npt, pPts);
+}
+
+static void
+XAAStateWrapPolySegmentThinSolid(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment * pSeg)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolySegmentThinSolid) (pDrawable, pGC, nseg, pSeg);
+}
+
+static void
+XAAStateWrapPolylinesThinDashed(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolylinesThinDashed) (pDrawable, pGC, mode, npt, pPts);
+}
+
+static void
+XAAStateWrapPolySegmentThinDashed(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment * pSeg)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolySegmentThinDashed) (pDrawable, pGC, nseg, pSeg);
+}
+
+static void
+XAAStateWrapFillPolygonSolid(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonSolid) (pDrawable, pGC, shape, mode, count, ptsIn);
+}
+
+static void
+XAAStateWrapFillPolygonStippled(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonStippled) (pDrawable, pGC, shape,
+ mode, count, ptsIn);
+}
+
+static void
+XAAStateWrapFillPolygonOpaqueStippled(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonOpaqueStippled) (pDrawable, pGC,
+ shape, mode, count, ptsIn);
+}
+
+static void
+XAAStateWrapFillPolygonTiled(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonTiled) (pDrawable, pGC, shape, mode, count, ptsIn);
+}
+
+static void
+XAAStateWrapPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc * parcs)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillArcSolid) (pDraw, pGC, narcs, parcs);
+}
+
+static void
+XAAStateWrapPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PutImage) (pDraw, pGC, depth, x, y,
+ w, h, leftPad, format, pImage);
+}
+
+static void
+XAAStateWrapValidateFillSpans(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateFillSpans) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidateSetSpans(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateSetSpans) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePutImage(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePutImage) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidateCopyArea(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateCopyArea) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidateCopyPlane(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateCopyPlane) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePolyPoint(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyPoint) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePolylines(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolylines) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePolySegment(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolySegment) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePolyRectangle(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyRectangle) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePolyArc(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyArc) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidateFillPolygon(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateFillPolygon) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePolyFillRect(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyFillRect) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePolyFillArc(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyFillArc) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePolyText8(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyText8) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePolyText16(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyText16) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidateImageText8(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateImageText8) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidateImageText16(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateImageText16) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyGlyphBlt) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidateImageGlyphBlt(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+ (*pStatePriv->ValidateImageGlyphBlt) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapValidatePushPixels(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePushPixels) (pGC, changes, pDraw);
+}
+
+static void
+XAAStateWrapComputeDash(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ComputeDash) (pGC);
+}
+
+static void
+XAAStateWrapInitPixmapCache(ScreenPtr pScreen, RegionPtr areas, pointer data)
+{
+ GET_STATEPRIV_SCREEN(pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->InitPixmapCache) (pScreen, areas, data);
+}
+
+static void
+XAAStateWrapClosePixmapCache(ScreenPtr pScreen)
+{
+ GET_STATEPRIV_SCREEN(pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ClosePixmapCache) (pScreen);
+}
+
+static int
+XAAStateWrapStippledFillChooser(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->StippledFillChooser) (pGC);
+}
+
+static int
+XAAStateWrapOpaqueStippledFillChooser(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->OpaqueStippledFillChooser) (pGC);
+}
+
+static int
+XAAStateWrapTiledFillChooser(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->TiledFillChooser) (pGC);
+}
+
+static XAACacheInfoPtr
+XAAStateWrapCacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheTile) (pScrn, pPix);
+}
+
+static XAACacheInfoPtr
+XAAStateWrapCacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheStipple) (pScrn, pPix, fg, bg);
+}
+
+static XAACacheInfoPtr
+XAAStateWrapCacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheMonoStipple) (pScrn, pPix);
+}
+
+static XAACacheInfoPtr
+XAAStateWrapCacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0, int pat1)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheMono8x8Pattern) (pScrn, pat0, pat1);
+}
+
+static XAACacheInfoPtr
+XAAStateWrapCacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix,
+ int fg, int bg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheColor8x8Pattern) (pScrn, pPix, fg, bg);
+}
+
+static void
+XAAStateWrapWriteBitmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int fg, int bg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteBitmapToCache) (pScrn, x, y, w, h,
+ src, srcwidth, fg, bg);
+}
+
+static void
+XAAStateWrapWritePixmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int bpp,
+ int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WritePixmapToCache) (pScrn, x, y, w, h,
+ src, srcwidth, bpp, depth);
+}
+
+static void
+XAAStateWrapWriteMono8x8PatternToCache(ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteMono8x8PatternToCache) (pScrn, pCache);
+}
+
+static void
+XAAStateWrapWriteColor8x8PatternToCache(ScrnInfoPtr pScrn, PixmapPtr pPix,
+ XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteColor8x8PatternToCache) (pScrn, pPix, pCache);
+}
+
+static void
+XAAStateWrapGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planeMask,
+ char *pdstLine)
+{
+ GET_STATEPRIV_SCREEN(pDrawable->pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->GetImage) (pDrawable, sx, sy, w, h,
+ format, planeMask, pdstLine);
+}
+
+static void
+XAAStateWrapGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart)
+{
+ GET_STATEPRIV_SCREEN(pDrawable->pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+}
+
+static void
+XAAStateWrapCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+ GET_STATEPRIV_SCREEN(pWindow->drawable.pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->CopyWindow) (pWindow, ptOldOrg, prgnSrc);
+}
+
+static Bool
+XAAStateWrapSetupForCPUToScreenAlphaTexture2(ScrnInfoPtr pScrn,
+ int op, CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 srcFormat,
+ CARD32 dstFormat,
+ CARD8 *alphaPtr,
+ int alphaPitch,
+ int width, int height, int flags)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->SetupForCPUToScreenAlphaTexture2) (pScrn, op, red,
+ green, blue, alpha,
+ srcFormat,
+ dstFormat, alphaPtr,
+ alphaPitch, width,
+ height, flags);
+}
+
+static Bool
+XAAStateWrapSetupForCPUToScreenTexture2(ScrnInfoPtr pScrn, int op,
+ CARD32 srcFormat,
+ CARD32 dstFormat,
+ CARD8 *texPtr, int texPitch,
+ int width, int height, int flags)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->SetupForCPUToScreenTexture2) (pScrn, op, srcFormat,
+ dstFormat, texPtr,
+ texPitch, width, height,
+ flags);
+}
+
+/* Setup Function */
+Bool
+XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAStateWrapPtr pStatePriv;
+ int i = 0;
+
+ if (!dixRegisterPrivateKey(&XAAStateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+ if (!(pStatePriv = malloc(sizeof(XAAStateWrapRec))))
+ return FALSE;
+ dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv);
+ pStatePriv->RestoreAccelState = infoRec->RestoreAccelState;
+ pStatePriv->pScrn = pScrn;
+
+ /* Initialize the last screen to -1 so whenever an accel function
+ * is called the proper state is setup
+ */
+ while (i < pScrn->numEntities) {
+ xf86SetLastScrnFlag(pScrn->entityList[i], -1);
+ i++;
+ }
+/* Do the wrapping */
+ XAA_STATE_WRAP(Sync);
+ XAA_STATE_WRAP(SetupForScreenToScreenCopy);
+ XAA_STATE_WRAP(SetupForSolidFill);
+ XAA_STATE_WRAP(SetupForSolidLine);
+ XAA_STATE_WRAP(SetupForDashedLine);
+ XAA_STATE_WRAP(SetClippingRectangle);
+ XAA_STATE_WRAP(DisableClipping);
+ XAA_STATE_WRAP(SetupForMono8x8PatternFill);
+ XAA_STATE_WRAP(SetupForColor8x8PatternFill);
+ XAA_STATE_WRAP(SetupForCPUToScreenColorExpandFill);
+ XAA_STATE_WRAP(SetupForScanlineCPUToScreenColorExpandFill);
+ XAA_STATE_WRAP(SetupForScreenToScreenColorExpandFill);
+ XAA_STATE_WRAP(SetupForImageWrite);
+ XAA_STATE_WRAP(SetupForScanlineImageWrite);
+ XAA_STATE_WRAP(SetupForImageRead);
+ XAA_STATE_WRAP(ScreenToScreenBitBlt);
+ XAA_STATE_WRAP(WriteBitmap);
+ XAA_STATE_WRAP(FillSolidRects);
+ XAA_STATE_WRAP(FillMono8x8PatternRects);
+ XAA_STATE_WRAP(FillColor8x8PatternRects);
+ XAA_STATE_WRAP(FillCacheBltRects);
+ XAA_STATE_WRAP(FillColorExpandRects);
+ XAA_STATE_WRAP(FillCacheExpandRects);
+ XAA_STATE_WRAP(FillImageWriteRects);
+ XAA_STATE_WRAP(FillSolidSpans);
+ XAA_STATE_WRAP(FillMono8x8PatternSpans);
+ XAA_STATE_WRAP(FillColor8x8PatternSpans);
+ XAA_STATE_WRAP(FillCacheBltSpans);
+ XAA_STATE_WRAP(FillColorExpandSpans);
+ XAA_STATE_WRAP(FillCacheExpandSpans);
+ XAA_STATE_WRAP(TEGlyphRenderer);
+ XAA_STATE_WRAP(NonTEGlyphRenderer);
+ XAA_STATE_WRAP(WritePixmap);
+ XAA_STATE_WRAP(ReadPixmap);
+ XAA_STATE_WRAP(CopyArea);
+ XAA_STATE_WRAP(CopyPlane);
+ XAA_STATE_WRAP(PushPixelsSolid);
+ XAA_STATE_WRAP(PolyFillRectSolid);
+ XAA_STATE_WRAP(PolyFillRectStippled);
+ XAA_STATE_WRAP(PolyFillRectOpaqueStippled);
+ XAA_STATE_WRAP(PolyFillRectTiled);
+ XAA_STATE_WRAP(FillSpansSolid);
+ XAA_STATE_WRAP(FillSpansStippled);
+ XAA_STATE_WRAP(FillSpansOpaqueStippled);
+ XAA_STATE_WRAP(FillSpansTiled);
+ XAA_STATE_WRAP(PolyText8TE);
+ XAA_STATE_WRAP(PolyText16TE);
+ XAA_STATE_WRAP(ImageText8TE);
+ XAA_STATE_WRAP(ImageText16TE);
+ XAA_STATE_WRAP(ImageGlyphBltTE);
+ XAA_STATE_WRAP(PolyGlyphBltTE);
+ XAA_STATE_WRAP(PolyText8NonTE);
+ XAA_STATE_WRAP(PolyText16NonTE);
+ XAA_STATE_WRAP(ImageText8NonTE);
+ XAA_STATE_WRAP(ImageText16NonTE);
+ XAA_STATE_WRAP(ImageGlyphBltNonTE);
+ XAA_STATE_WRAP(PolyGlyphBltNonTE);
+ XAA_STATE_WRAP(PolyRectangleThinSolid);
+ XAA_STATE_WRAP(PolylinesWideSolid);
+ XAA_STATE_WRAP(PolylinesThinSolid);
+ XAA_STATE_WRAP(PolySegmentThinSolid);
+ XAA_STATE_WRAP(PolylinesThinDashed);
+ XAA_STATE_WRAP(PolySegmentThinDashed);
+ XAA_STATE_WRAP(FillPolygonSolid);
+ XAA_STATE_WRAP(FillPolygonStippled);
+ XAA_STATE_WRAP(FillPolygonOpaqueStippled);
+ XAA_STATE_WRAP(FillPolygonTiled);
+ XAA_STATE_WRAP(PolyFillArcSolid);
+ XAA_STATE_WRAP(PutImage);
+ XAA_STATE_WRAP(ValidateFillSpans);
+ XAA_STATE_WRAP(ValidateSetSpans);
+ XAA_STATE_WRAP(ValidatePutImage);
+ XAA_STATE_WRAP(ValidateCopyArea);
+ XAA_STATE_WRAP(ValidateCopyPlane);
+ XAA_STATE_WRAP(ValidatePolyPoint);
+ XAA_STATE_WRAP(ValidatePolylines);
+ XAA_STATE_WRAP(ValidatePolySegment);
+ XAA_STATE_WRAP(ValidatePolyRectangle);
+ XAA_STATE_WRAP(ValidatePolyArc);
+ XAA_STATE_WRAP(ValidateFillPolygon);
+ XAA_STATE_WRAP(ValidatePolyFillRect);
+ XAA_STATE_WRAP(ValidatePolyFillArc);
+ XAA_STATE_WRAP(ValidatePolyText8);
+ XAA_STATE_WRAP(ValidatePolyText16);
+ XAA_STATE_WRAP(ValidateImageText8);
+ XAA_STATE_WRAP(ValidateImageText16);
+ XAA_STATE_WRAP(ValidatePolyGlyphBlt);
+ XAA_STATE_WRAP(ValidateImageGlyphBlt);
+ XAA_STATE_WRAP(ValidatePushPixels);
+ XAA_STATE_WRAP(ComputeDash);
+ XAA_STATE_WRAP(InitPixmapCache);
+ XAA_STATE_WRAP(ClosePixmapCache);
+ XAA_STATE_WRAP(StippledFillChooser);
+ XAA_STATE_WRAP(OpaqueStippledFillChooser);
+ XAA_STATE_WRAP(TiledFillChooser);
+ XAA_STATE_WRAP(CacheTile);
+ XAA_STATE_WRAP(CacheStipple);
+ XAA_STATE_WRAP(CacheMonoStipple);
+ XAA_STATE_WRAP(CacheMono8x8Pattern);
+ XAA_STATE_WRAP(CacheColor8x8Pattern);
+ XAA_STATE_WRAP(WriteBitmapToCache);
+ XAA_STATE_WRAP(WritePixmapToCache);
+ XAA_STATE_WRAP(WriteMono8x8PatternToCache);
+ XAA_STATE_WRAP(WriteColor8x8PatternToCache);
+ XAA_STATE_WRAP(GetImage);
+ XAA_STATE_WRAP(GetSpans);
+ XAA_STATE_WRAP(CopyWindow);
+ XAA_STATE_WRAP(SetupForCPUToScreenAlphaTexture2);
+ XAA_STATE_WRAP(SetupForCPUToScreenTexture2);
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaStipple.c b/xorg-server/hw/xfree86/xaa/xaaStipple.c
index c1d6f8ab4..fc74e3988 100644
--- a/xorg-server/hw/xfree86/xaa/xaaStipple.c
+++ b/xorg-server/hw/xfree86/xaa/xaaStipple.c
@@ -8,12 +8,12 @@
#include "xaacexp.h"
#include "xf86.h"
-static CARD32* StipplePowerOfTwo(CARD32*, CARD32*, int, int, int);
-static CARD32* StipplePowerOfTwo_Inverted(CARD32*, CARD32*, int, int, int);
-static CARD32* StippleUpTo32(CARD32*, CARD32*, int, int, int);
-static CARD32* StippleUpTo32_Inverted(CARD32*, CARD32*, int, int, int);
-static CARD32* StippleOver32(CARD32*, CARD32*, int, int, int);
-static CARD32* StippleOver32_Inverted(CARD32*, CARD32*, int, int, int);
+static CARD32 *StipplePowerOfTwo(CARD32 *, CARD32 *, int, int, int);
+static CARD32 *StipplePowerOfTwo_Inverted(CARD32 *, CARD32 *, int, int, int);
+static CARD32 *StippleUpTo32(CARD32 *, CARD32 *, int, int, int);
+static CARD32 *StippleUpTo32_Inverted(CARD32 *, CARD32 *, int, int, int);
+static CARD32 *StippleOver32(CARD32 *, CARD32 *, int, int, int);
+static CARD32 *StippleOver32_Inverted(CARD32 *, CARD32 *, int, int, int);
#ifdef TRIPLE_BITS
#define stipple_scanline_func EXPNAME(XAAStippleScanlineFunc3)
@@ -24,27 +24,28 @@ static CARD32* StippleOver32_Inverted(CARD32*, CARD32*, int, int, int);
#endif
StippleScanlineProcPtr stipple_scanline_func[6] = {
- StipplePowerOfTwo,
- StippleUpTo32,
- StippleOver32,
- StipplePowerOfTwo_Inverted,
- StippleUpTo32_Inverted,
- StippleOver32_Inverted
+ StipplePowerOfTwo,
+ StippleUpTo32,
+ StippleOver32,
+ StipplePowerOfTwo_Inverted,
+ StippleUpTo32_Inverted,
+ StippleOver32_Inverted
};
-StippleScanlineProcPtr *stipple_get_scanline_func(void) {
- return stipple_scanline_func;
+StippleScanlineProcPtr *
+stipple_get_scanline_func(void)
+{
+ return stipple_scanline_func;
}
#ifdef FIXEDBASE
-# define DEST(i) *dest
-# define RETURN(i) return(dest)
+#define DEST(i) *dest
+#define RETURN(i) return(dest)
#else
-# define DEST(i) dest[i]
-# define RETURN(i) return(dest + i)
+#define DEST(i) dest[i]
+#define RETURN(i) return(dest + i)
#endif
-
/* TRIPLE_BITS pattern expansion */
#ifdef TRIPLE_BITS
#define EXPAND_PAT \
@@ -80,45 +81,42 @@ StippleScanlineProcPtr *stipple_get_scanline_func(void) {
#endif
#endif
-
#if !defined(FIXEDBASE) && !defined(MSBFIRST) && !defined(TRIPLE_BITS)
unsigned int XAAShiftMasks[32] = {
- /* gcc is rather pedantic about SHIFT_R(0xFFFFFFFF,32) */
- 0x00000000 , SHIFT_R(0xFFFFFFFF,31),
- SHIFT_R(0xFFFFFFFF,30), SHIFT_R(0xFFFFFFFF,29),
- SHIFT_R(0xFFFFFFFF,28), SHIFT_R(0xFFFFFFFF,27),
- SHIFT_R(0xFFFFFFFF,26), SHIFT_R(0xFFFFFFFF,25),
- SHIFT_R(0xFFFFFFFF,24), SHIFT_R(0xFFFFFFFF,23),
- SHIFT_R(0xFFFFFFFF,22), SHIFT_R(0xFFFFFFFF,21),
- SHIFT_R(0xFFFFFFFF,20), SHIFT_R(0xFFFFFFFF,19),
- SHIFT_R(0xFFFFFFFF,18), SHIFT_R(0xFFFFFFFF,17),
- SHIFT_R(0xFFFFFFFF,16), SHIFT_R(0xFFFFFFFF,15),
- SHIFT_R(0xFFFFFFFF,14), SHIFT_R(0xFFFFFFFF,13),
- SHIFT_R(0xFFFFFFFF,12), SHIFT_R(0xFFFFFFFF,11),
- SHIFT_R(0xFFFFFFFF,10), SHIFT_R(0xFFFFFFFF,9),
- SHIFT_R(0xFFFFFFFF,8), SHIFT_R(0xFFFFFFFF,7),
- SHIFT_R(0xFFFFFFFF,6), SHIFT_R(0xFFFFFFFF,5),
- SHIFT_R(0xFFFFFFFF,4), SHIFT_R(0xFFFFFFFF,3),
- SHIFT_R(0xFFFFFFFF,2), SHIFT_R(0xFFFFFFFF,1)
+ /* gcc is rather pedantic about SHIFT_R(0xFFFFFFFF,32) */
+ 0x00000000, SHIFT_R(0xFFFFFFFF, 31),
+ SHIFT_R(0xFFFFFFFF, 30), SHIFT_R(0xFFFFFFFF, 29),
+ SHIFT_R(0xFFFFFFFF, 28), SHIFT_R(0xFFFFFFFF, 27),
+ SHIFT_R(0xFFFFFFFF, 26), SHIFT_R(0xFFFFFFFF, 25),
+ SHIFT_R(0xFFFFFFFF, 24), SHIFT_R(0xFFFFFFFF, 23),
+ SHIFT_R(0xFFFFFFFF, 22), SHIFT_R(0xFFFFFFFF, 21),
+ SHIFT_R(0xFFFFFFFF, 20), SHIFT_R(0xFFFFFFFF, 19),
+ SHIFT_R(0xFFFFFFFF, 18), SHIFT_R(0xFFFFFFFF, 17),
+ SHIFT_R(0xFFFFFFFF, 16), SHIFT_R(0xFFFFFFFF, 15),
+ SHIFT_R(0xFFFFFFFF, 14), SHIFT_R(0xFFFFFFFF, 13),
+ SHIFT_R(0xFFFFFFFF, 12), SHIFT_R(0xFFFFFFFF, 11),
+ SHIFT_R(0xFFFFFFFF, 10), SHIFT_R(0xFFFFFFFF, 9),
+ SHIFT_R(0xFFFFFFFF, 8), SHIFT_R(0xFFFFFFFF, 7),
+ SHIFT_R(0xFFFFFFFF, 6), SHIFT_R(0xFFFFFFFF, 5),
+ SHIFT_R(0xFFFFFFFF, 4), SHIFT_R(0xFFFFFFFF, 3),
+ SHIFT_R(0xFFFFFFFF, 2), SHIFT_R(0xFFFFFFFF, 1)
};
#endif
void
#ifdef TRIPLE_BITS
-EXPNAME(XAAFillColorExpandRects3)(
+ EXPNAME(XAAFillColorExpandRects3) (
#else
-EXPNAME(XAAFillColorExpandRects)(
+ EXPNAME(XAAFillColorExpandRects) (
#endif
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-){
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix) {
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
CARD32 *base;
Bool TwoPass = FALSE, FirstPass = TRUE;
@@ -127,136 +125,145 @@ EXPNAME(XAAFillColorExpandRects)(
int stippleheight = pPix->drawable.height;
int srcwidth = pPix->devKind;
int dwords, srcy, srcx, funcNo = 2, h;
- unsigned char *src = (unsigned char*)pPix->devPrivate.ptr;
+ unsigned char *src = (unsigned char *) pPix->devPrivate.ptr;
unsigned char *srcp;
int flag;
- if(stipplewidth <= 32) {
- if(stipplewidth & (stipplewidth - 1))
- funcNo = 1;
- else
- funcNo = 0;
- }
+ if (stipplewidth <= 32) {
+ if (stipplewidth & (stipplewidth - 1))
+ funcNo = 1;
+ else
+ funcNo = 0;
+ }
StippleFunc = stipple_scanline_func[funcNo];
SecondFunc = stipple_scanline_func[funcNo];
FirstFunc = stipple_scanline_func[funcNo + 3];
#ifdef TRIPLE_BITS
- if((bg == -1) ||
- (!(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
- (!(infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
- (CHECK_RGB_EQUAL(bg))))) {
+ if ((bg == -1) ||
+ (!(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
+ (!(infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(bg))))) {
#else
- if((bg == -1) ||
- !(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+ if ((bg == -1) ||
+ !(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
#endif
- /* one pass */
- } else if((rop == GXcopy) && infoRec->FillSolidRects) {
- /* one pass but we fill background rects first */
- (*infoRec->FillSolidRects)(pScrn, bg, rop, planemask, nBox, pBox);
- bg = -1;
- } else {
- /* gotta do two passes */
- TwoPass = TRUE;
+ /* one pass */
+ }
+ else if ((rop == GXcopy) && infoRec->FillSolidRects) {
+ /* one pass but we fill background rects first */
+ (*infoRec->FillSolidRects) (pScrn, bg, rop, planemask, nBox, pBox);
+ bg = -1;
+ }
+ else {
+ /* gotta do two passes */
+ TwoPass = TRUE;
}
- if(!TwoPass)
- (*infoRec->SetupForCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
+ if (!TwoPass)
+ (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
- while(nBox--) {
+ while (nBox--) {
#ifdef TRIPLE_BITS
- dwords = (3 * (pBox->x2 - pBox->x1) + 31) >> 5;
+ dwords = (3 * (pBox->x2 - pBox->x1) + 31) >> 5;
#else
- dwords = (pBox->x2 - pBox->x1 + 31) >> 5;
+ dwords = (pBox->x2 - pBox->x1 + 31) >> 5;
#endif
-SECOND_PASS:
- if(TwoPass) {
- (*infoRec->SetupForCPUToScreenColorExpandFill)(pScrn,
- (FirstPass) ? bg : fg, -1, rop, planemask);
- StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
- }
+ SECOND_PASS:
+ if (TwoPass) {
+ (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn,
+ (FirstPass) ? bg :
+ fg, -1, rop,
+ planemask);
+ StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
+ }
+
+ h = pBox->y2 - pBox->y1;
+ flag = (infoRec->CPUToScreenColorExpandFillFlags
+ & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01);
- h = pBox->y2 - pBox->y1;
- flag = (infoRec->CPUToScreenColorExpandFillFlags
- & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01);
+ (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, pBox->x1,
+ pBox->y1,
+ pBox->x2 - pBox->x1,
+ h, 0);
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(
- pScrn, pBox->x1, pBox->y1,
- pBox->x2 - pBox->x1, h, 0);
+ base = (CARD32 *) infoRec->ColorExpandBase;
- base = (CARD32*)infoRec->ColorExpandBase;
+ srcy = (pBox->y1 - yorg) % stippleheight;
+ if (srcy < 0)
+ srcy += stippleheight;
+ srcx = (pBox->x1 - xorg) % stipplewidth;
+ if (srcx < 0)
+ srcx += stipplewidth;
- srcy = (pBox->y1 - yorg) % stippleheight;
- if(srcy < 0) srcy += stippleheight;
- srcx = (pBox->x1 - xorg) % stipplewidth;
- if(srcx < 0) srcx += stipplewidth;
+ srcp = (srcwidth * srcy) + src;
- srcp = (srcwidth * srcy) + src;
-
#ifndef FIXEDBASE
- if((dwords * h) <= infoRec->ColorExpandRange) {
- while(h--) {
- base = (*StippleFunc)(
- base, (CARD32*)srcp, srcx, stipplewidth, dwords);
- srcy++;
- srcp += srcwidth;
- if (srcy >= stippleheight) {
- srcy = 0;
- srcp = src;
- }
- }
- } else
+ if ((dwords * h) <= infoRec->ColorExpandRange) {
+ while (h--) {
+ base =
+ (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth,
+ dwords);
+ srcy++;
+ srcp += srcwidth;
+ if (srcy >= stippleheight) {
+ srcy = 0;
+ srcp = src;
+ }
+ }
+ }
+ else
#endif
- while(h--) {
- (*StippleFunc)(base, (CARD32*)srcp, srcx, stipplewidth, dwords);
- srcy++;
- srcp += srcwidth;
- if (srcy >= stippleheight) {
- srcy = 0;
- srcp = src;
- }
- }
-
- if (flag) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
- }
-
- if(TwoPass) {
- if(FirstPass) {
- FirstPass = FALSE;
- goto SECOND_PASS;
- } else FirstPass = TRUE;
- }
-
- pBox++;
- }
-
- if(infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-}
+ while (h--) {
+ (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth,
+ dwords);
+ srcy++;
+ srcp += srcwidth;
+ if (srcy >= stippleheight) {
+ srcy = 0;
+ srcp = src;
+ }
+ }
+
+ if (flag) {
+ base = (CARD32 *) infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+ if (TwoPass) {
+ if (FirstPass) {
+ FirstPass = FALSE;
+ goto SECOND_PASS;
+ }
+ else
+ FirstPass = TRUE;
+ }
+ pBox++;
+ }
+
+ if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync) (pScrn);
+ else
+ SET_SYNC_FLAG(infoRec);
+}
void
#ifdef TRIPLE_BITS
-EXPNAME(XAAFillColorExpandSpans3)(
+ EXPNAME(XAAFillColorExpandSpans3) (
#else
-EXPNAME(XAAFillColorExpandSpans)(
+ EXPNAME(XAAFillColorExpandSpans) (
#endif
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-){
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix) {
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
CARD32 *base;
Bool TwoPass = FALSE, FirstPass = TRUE;
@@ -266,106 +273,114 @@ EXPNAME(XAAFillColorExpandSpans)(
int dwords, srcy, srcx, funcNo = 2;
unsigned char *srcp;
- if(stipplewidth <= 32) {
- if(stipplewidth & (stipplewidth - 1))
- funcNo = 1;
- else
- funcNo = 0;
- }
+ if (stipplewidth <= 32) {
+ if (stipplewidth & (stipplewidth - 1))
+ funcNo = 1;
+ else
+ funcNo = 0;
+ }
StippleFunc = stipple_scanline_func[funcNo];
SecondFunc = stipple_scanline_func[funcNo];
FirstFunc = stipple_scanline_func[funcNo + 3];
#ifdef TRIPLE_BITS
- if((bg == -1) ||
- (!(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
- (!(infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
- (CHECK_RGB_EQUAL(bg))))) {
+ if ((bg == -1) ||
+ (!(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
+ (!(infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(bg))))) {
#else
- if((bg == -1) ||
- !(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+ if ((bg == -1) ||
+ !(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
#endif
- /* one pass */
- } else if((rop == GXcopy) && infoRec->FillSolidSpans) {
- /* one pass but we fill background rects first */
- (*infoRec->FillSolidSpans)(
- pScrn, bg, rop, planemask, n, ppt, pwidth, fSorted);
- bg = -1;
- } else {
- /* gotta do two passes */
- TwoPass = TRUE;
- }
-
- if(!TwoPass)
- (*infoRec->SetupForCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
-
- while(n--) {
+ /* one pass */
+ }
+ else if ((rop == GXcopy) && infoRec->FillSolidSpans) {
+ /* one pass but we fill background rects first */
+ (*infoRec->FillSolidSpans) (pScrn, bg, rop, planemask, n, ppt, pwidth,
+ fSorted);
+ bg = -1;
+ }
+ else {
+ /* gotta do two passes */
+ TwoPass = TRUE;
+ }
+
+ if (!TwoPass)
+ (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+
+ while (n--) {
#ifdef TRIPLE_BITS
- dwords = (3 * *pwidth + 31) >> 5;
+ dwords = (3 * *pwidth + 31) >> 5;
#else
- dwords = (*pwidth + 31) >> 5;
+ dwords = (*pwidth + 31) >> 5;
#endif
- srcy = (ppt->y - yorg) % stippleheight;
- if(srcy < 0) srcy += stippleheight;
- srcx = (ppt->x - xorg) % stipplewidth;
- if(srcx < 0) srcx += stipplewidth;
-
- srcp = (pPix->devKind * srcy) + (unsigned char*)pPix->devPrivate.ptr;
-
-SECOND_PASS:
- if(TwoPass) {
- (*infoRec->SetupForCPUToScreenColorExpandFill)(pScrn,
- (FirstPass) ? bg : fg, -1, rop, planemask);
- StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
- }
-
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, ppt->x, ppt->y,
- *pwidth, 1, 0);
-
- base = (CARD32*)infoRec->ColorExpandBase;
-
- (*StippleFunc)(base, (CARD32*)srcp, srcx, stipplewidth, dwords);
-
- if((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD)
- && (dwords & 0x01)) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
- }
-
- if(TwoPass) {
- if(FirstPass) {
- FirstPass = FALSE;
- goto SECOND_PASS;
- } else FirstPass = TRUE;
- }
-
- ppt++; pwidth++;
- }
-
- if(infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-}
+ srcy = (ppt->y - yorg) % stippleheight;
+ if (srcy < 0)
+ srcy += stippleheight;
+ srcx = (ppt->x - xorg) % stipplewidth;
+ if (srcx < 0)
+ srcx += stipplewidth;
+
+ srcp = (pPix->devKind * srcy) + (unsigned char *) pPix->devPrivate.ptr;
+
+ SECOND_PASS:
+ if (TwoPass) {
+ (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn,
+ (FirstPass) ? bg :
+ fg, -1, rop,
+ planemask);
+ StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
+ }
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, ppt->x, ppt->y,
+ *pwidth, 1, 0);
+
+ base = (CARD32 *) infoRec->ColorExpandBase;
+
+ (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, dwords);
+
+ if ((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD)
+ && (dwords & 0x01)) {
+ base = (CARD32 *) infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+ if (TwoPass) {
+ if (FirstPass) {
+ FirstPass = FALSE;
+ goto SECOND_PASS;
+ }
+ else
+ FirstPass = TRUE;
+ }
+ ppt++;
+ pwidth++;
+ }
+
+ if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync) (pScrn);
+ else
+ SET_SYNC_FLAG(infoRec);
+}
#ifndef FIXEDBASE
void
#ifdef TRIPLE_BITS
-EXPNAME(XAAFillScanlineColorExpandRects3)(
+ EXPNAME(XAAFillScanlineColorExpandRects3) (
#else
-EXPNAME(XAAFillScanlineColorExpandRects)(
+ EXPNAME(XAAFillScanlineColorExpandRects) (
#endif
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-){
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix) {
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
CARD32 *base;
Bool TwoPass = FALSE, FirstPass = TRUE;
@@ -377,110 +392,123 @@ EXPNAME(XAAFillScanlineColorExpandRects)(
unsigned char *src = pPix->devPrivate.ptr;
unsigned char *srcp;
- if(stipplewidth <= 32) {
- if(stipplewidth & (stipplewidth - 1))
- funcNo = 1;
- else
- funcNo = 0;
- }
+ if (stipplewidth <= 32) {
+ if (stipplewidth & (stipplewidth - 1))
+ funcNo = 1;
+ else
+ funcNo = 0;
+ }
StippleFunc = stipple_scanline_func[funcNo];
SecondFunc = stipple_scanline_func[funcNo];
FirstFunc = stipple_scanline_func[funcNo + 3];
#ifdef TRIPLE_BITS
- if((bg == -1) ||
- (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
- (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
- (CHECK_RGB_EQUAL(bg))))) {
+ if ((bg == -1) ||
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)
+ && (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(bg))))) {
#else
- if((bg == -1) ||
- !(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+ if ((bg == -1) ||
+ !(infoRec->
+ ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
#endif
- /* one pass */
- } else if((rop == GXcopy) && infoRec->FillSolidRects) {
- /* one pass but we fill background rects first */
- (*infoRec->FillSolidRects)(pScrn, bg, rop, planemask, nBox, pBox);
- bg = -1;
- } else {
- /* gotta do two passes */
- TwoPass = TRUE;
+ /* one pass */
+ }
+ else if ((rop == GXcopy) && infoRec->FillSolidRects) {
+ /* one pass but we fill background rects first */
+ (*infoRec->FillSolidRects) (pScrn, bg, rop, planemask, nBox, pBox);
+ bg = -1;
+ }
+ else {
+ /* gotta do two passes */
+ TwoPass = TRUE;
}
- if(!TwoPass)
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
+ if (!TwoPass)
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg,
+ rop, planemask);
- while(nBox--) {
+ while (nBox--) {
#ifdef TRIPLE_BITS
- dwords = (3 * (pBox->x2 - pBox->x1) + 31) >> 5;
+ dwords = (3 * (pBox->x2 - pBox->x1) + 31) >> 5;
#else
- dwords = (pBox->x2 - pBox->x1 + 31) >> 5;
+ dwords = (pBox->x2 - pBox->x1 + 31) >> 5;
#endif
-SECOND_PASS:
- if(TwoPass) {
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(pScrn,
- (FirstPass) ? bg : fg, -1, rop, planemask);
- StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
- }
-
- h = pBox->y2 - pBox->y1;
-
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, h, 0);
-
- bufferNo = 0;
-
- srcy = (pBox->y1 - yorg) % stippleheight;
- if(srcy < 0) srcy += stippleheight;
- srcx = (pBox->x1 - xorg) % stipplewidth;
- if(srcx < 0) srcx += stipplewidth;
-
- srcp = (srcwidth * srcy) + src;
-
- while(h--) {
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- (*StippleFunc)(base, (CARD32*)srcp, srcx, stipplewidth, dwords);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
- srcy++;
- srcp += srcwidth;
- if (srcy >= stippleheight) {
- srcy = 0;
- srcp = src;
- }
- }
-
- if(TwoPass) {
- if(FirstPass) {
- FirstPass = FALSE;
- goto SECOND_PASS;
- } else FirstPass = TRUE;
- }
-
- pBox++;
- }
-
- SET_SYNC_FLAG(infoRec);
+ SECOND_PASS:
+ if (TwoPass) {
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn,
+ (FirstPass)
+ ? bg : fg,
+ -1, rop,
+ planemask);
+ StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
+ }
+
+ h = pBox->y2 - pBox->y1;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn,
+ pBox->x1,
+ pBox->y1,
+ pBox->x2 -
+ pBox->x1, h,
+ 0);
+
+ bufferNo = 0;
+
+ srcy = (pBox->y1 - yorg) % stippleheight;
+ if (srcy < 0)
+ srcy += stippleheight;
+ srcx = (pBox->x1 - xorg) % stipplewidth;
+ if (srcx < 0)
+ srcx += stipplewidth;
+
+ srcp = (srcwidth * srcy) + src;
+
+ while (h--) {
+ base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, dwords);
+ (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
+ if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ srcy++;
+ srcp += srcwidth;
+ if (srcy >= stippleheight) {
+ srcy = 0;
+ srcp = src;
+ }
+ }
+
+ if (TwoPass) {
+ if (FirstPass) {
+ FirstPass = FALSE;
+ goto SECOND_PASS;
+ }
+ else
+ FirstPass = TRUE;
+ }
+
+ pBox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
}
void
#ifdef TRIPLE_BITS
-EXPNAME(XAAFillScanlineColorExpandSpans3)(
+ EXPNAME(XAAFillScanlineColorExpandSpans3) (
#else
-EXPNAME(XAAFillScanlineColorExpandSpans)(
+ EXPNAME(XAAFillScanlineColorExpandSpans) (
#endif
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-){
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix) {
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
CARD32 *base;
Bool TwoPass = FALSE, FirstPass = TRUE;
@@ -490,377 +518,398 @@ EXPNAME(XAAFillScanlineColorExpandSpans)(
int dwords, srcy, srcx, funcNo = 2;
unsigned char *srcp;
- if(stipplewidth <= 32) {
- if(stipplewidth & (stipplewidth - 1))
- funcNo = 1;
- else
- funcNo = 0;
- }
+ if (stipplewidth <= 32) {
+ if (stipplewidth & (stipplewidth - 1))
+ funcNo = 1;
+ else
+ funcNo = 0;
+ }
StippleFunc = stipple_scanline_func[funcNo];
SecondFunc = stipple_scanline_func[funcNo];
FirstFunc = stipple_scanline_func[funcNo + 3];
#ifdef TRIPLE_BITS
- if((bg == -1) ||
- (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
- (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
- (CHECK_RGB_EQUAL(bg))))) {
+ if ((bg == -1) ||
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)
+ && (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(bg))))) {
#else
- if((bg == -1) ||
- !(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+ if ((bg == -1) ||
+ !(infoRec->
+ ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
#endif
- /* one pass */
- } else if((rop == GXcopy) && infoRec->FillSolidSpans) {
- /* one pass but we fill background rects first */
- (*infoRec->FillSolidSpans)(
- pScrn, bg, rop, planemask, n, ppt, pwidth, fSorted);
- bg = -1;
- } else {
- /* gotta do two passes */
- TwoPass = TRUE;
+ /* one pass */
+ }
+ else if ((rop == GXcopy) && infoRec->FillSolidSpans) {
+ /* one pass but we fill background rects first */
+ (*infoRec->FillSolidSpans) (pScrn, bg, rop, planemask, n, ppt, pwidth,
+ fSorted);
+ bg = -1;
+ }
+ else {
+ /* gotta do two passes */
+ TwoPass = TRUE;
}
- if(!TwoPass)
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
-
+ if (!TwoPass)
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg,
+ rop, planemask);
- while(n--) {
+ while (n--) {
#ifdef TRIPLE_BITS
- dwords = (3 * *pwidth + 31) >> 5;
+ dwords = (3 * *pwidth + 31) >> 5;
#else
- dwords = (*pwidth + 31) >> 5;
+ dwords = (*pwidth + 31) >> 5;
#endif
- srcy = (ppt->y - yorg) % stippleheight;
- if(srcy < 0) srcy += stippleheight;
- srcx = (ppt->x - xorg) % stipplewidth;
- if(srcx < 0) srcx += stipplewidth;
-
- srcp = (pPix->devKind * srcy) + (unsigned char*)pPix->devPrivate.ptr;
+ srcy = (ppt->y - yorg) % stippleheight;
+ if (srcy < 0)
+ srcy += stippleheight;
+ srcx = (ppt->x - xorg) % stipplewidth;
+ if (srcx < 0)
+ srcx += stipplewidth;
+
+ srcp = (pPix->devKind * srcy) + (unsigned char *) pPix->devPrivate.ptr;
+
+ SECOND_PASS:
+ if (TwoPass) {
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn,
+ (FirstPass)
+ ? bg : fg,
+ -1, rop,
+ planemask);
+ StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
+ }
-SECOND_PASS:
- if(TwoPass) {
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(pScrn,
- (FirstPass) ? bg : fg, -1, rop, planemask);
- StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
- }
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, ppt->x,
+ ppt->y,
+ *pwidth, 1,
+ 0);
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, ppt->x, ppt->y, *pwidth, 1, 0);
+ base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[0];
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[0];
+ (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, dwords);
+ (*infoRec->SubsequentColorExpandScanline) (pScrn, 0);
- (*StippleFunc)(base, (CARD32*)srcp, srcx, stipplewidth, dwords);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, 0);
-
- if(TwoPass) {
- if(FirstPass) {
- FirstPass = FALSE;
- goto SECOND_PASS;
- } else FirstPass = TRUE;
- }
+ if (TwoPass) {
+ if (FirstPass) {
+ FirstPass = FALSE;
+ goto SECOND_PASS;
+ }
+ else
+ FirstPass = TRUE;
+ }
- ppt++; pwidth++;
- }
+ ppt++;
+ pwidth++;
+ }
- SET_SYNC_FLAG(infoRec);
+ SET_SYNC_FLAG(infoRec);
}
#endif
static CARD32 *
-StipplePowerOfTwo(
- CARD32* dest, CARD32* src,
- int shift, int width, int dwords
-){
+StipplePowerOfTwo(CARD32 *dest, CARD32 *src, int shift, int width, int dwords)
+{
CARD32 pat = *src;
- if(width < 32) {
- pat &= XAAShiftMasks[width];
- while(width < 32) {
- pat |= SHIFT_L(pat,width);
- width <<= 1;
- }
+
+ if (width < 32) {
+ pat &= XAAShiftMasks[width];
+ while (width < 32) {
+ pat |= SHIFT_L(pat, width);
+ width <<= 1;
+ }
}
-
- if(shift)
- pat = SHIFT_R(pat,shift) | SHIFT_L(pat,32 - shift);
+
+ if (shift)
+ pat = SHIFT_R(pat, shift) | SHIFT_L(pat, 32 - shift);
#ifdef MSBFIRST
- pat = SWAP_BITS_IN_BYTES(pat);
+ pat = SWAP_BITS_IN_BYTES(pat);
#endif
#ifdef TRIPLE_BITS
{
- EXPAND_PAT;
-
- while(dwords >= 3) {
- WRITE_PAT3;
- dwords -= 3;
- }
- if (dwords == 2) {
- WRITE_PAT2;
- } else if (dwords == 1) {
- WRITE_PAT1;
- }
-
- return dest;
- }
-#else /* TRIPLE_BITS */
- while(dwords >= 4) {
- DEST(0) = pat;
- DEST(1) = pat;
- DEST(2) = pat;
- DEST(3) = pat;
- dwords -= 4;
+ EXPAND_PAT;
+
+ while (dwords >= 3) {
+ WRITE_PAT3;
+ dwords -= 3;
+ }
+ if (dwords == 2) {
+ WRITE_PAT2;
+ }
+ else if (dwords == 1) {
+ WRITE_PAT1;
+ }
+
+ return dest;
+ }
+#else /* TRIPLE_BITS */
+ while (dwords >= 4) {
+ DEST(0) = pat;
+ DEST(1) = pat;
+ DEST(2) = pat;
+ DEST(3) = pat;
+ dwords -= 4;
#ifndef FIXEDBASE
- dest += 4;
+ dest += 4;
#endif
- }
-
- if(!dwords) return dest;
- DEST(0) = pat;
- if(dwords == 1) RETURN(1);
- DEST(1) = pat;
- if(dwords == 2) RETURN(2);
- DEST(2) = pat;
- RETURN(3);
-#endif /* TRIPLE_BITS */
+ }
+
+ if (!dwords)
+ return dest;
+ DEST(0) = pat;
+ if (dwords == 1)
+ RETURN(1);
+ DEST(1) = pat;
+ if (dwords == 2)
+ RETURN(2);
+ DEST(2) = pat;
+ RETURN(3);
+#endif /* TRIPLE_BITS */
}
static CARD32 *
-StipplePowerOfTwo_Inverted(
- CARD32* dest, CARD32* src,
- int shift, int width, int dwords
-){
+StipplePowerOfTwo_Inverted(CARD32 *dest, CARD32 *src,
+ int shift, int width, int dwords)
+{
CARD32 pat = *src;
- if(width < 32) {
- pat &= XAAShiftMasks[width];
- while(width < 32) {
- pat |= SHIFT_L(pat,width);
- width <<= 1;
- }
+
+ if (width < 32) {
+ pat &= XAAShiftMasks[width];
+ while (width < 32) {
+ pat |= SHIFT_L(pat, width);
+ width <<= 1;
+ }
}
-
- if(shift)
- pat = SHIFT_R(pat,shift) | SHIFT_L(pat,32 - shift);
+
+ if (shift)
+ pat = SHIFT_R(pat, shift) | SHIFT_L(pat, 32 - shift);
#ifdef MSBFIRST
- pat = SWAP_BITS_IN_BYTES(pat);
+ pat = SWAP_BITS_IN_BYTES(pat);
#endif
- pat = ~pat;
+ pat = ~pat;
#ifdef TRIPLE_BITS
{
- EXPAND_PAT;
-
- while(dwords >= 3) {
- WRITE_PAT3;
- dwords -= 3;
- }
- if (dwords == 2) {
- WRITE_PAT2;
- } else if (dwords == 1) {
- WRITE_PAT1;
- }
-
- return dest;
- }
-#else /* TRIPLE_BITS */
- while(dwords >= 4) {
- DEST(0) = pat;
- DEST(1) = pat;
- DEST(2) = pat;
- DEST(3) = pat;
- dwords -= 4;
+ EXPAND_PAT;
+
+ while (dwords >= 3) {
+ WRITE_PAT3;
+ dwords -= 3;
+ }
+ if (dwords == 2) {
+ WRITE_PAT2;
+ }
+ else if (dwords == 1) {
+ WRITE_PAT1;
+ }
+
+ return dest;
+ }
+#else /* TRIPLE_BITS */
+ while (dwords >= 4) {
+ DEST(0) = pat;
+ DEST(1) = pat;
+ DEST(2) = pat;
+ DEST(3) = pat;
+ dwords -= 4;
#ifndef FIXEDBASE
- dest += 4;
+ dest += 4;
#endif
- }
-
- if(!dwords) return dest;
- DEST(0) = pat;
- if(dwords == 1) RETURN(1);
- DEST(1) = pat;
- if(dwords == 2) RETURN(2);
- DEST(2) = pat;
- RETURN(3);
-#endif /* TRIPLE_BITS */
-}
+ }
+ if (!dwords)
+ return dest;
+ DEST(0) = pat;
+ if (dwords == 1)
+ RETURN(1);
+ DEST(1) = pat;
+ if (dwords == 2)
+ RETURN(2);
+ DEST(2) = pat;
+ RETURN(3);
+#endif /* TRIPLE_BITS */
+}
static CARD32 *
-StippleUpTo32(
- CARD32* base, CARD32* src,
- int shift, int width, int dwords
-){
+StippleUpTo32(CARD32 *base, CARD32 *src, int shift, int width, int dwords)
+{
CARD32 pat = *src & XAAShiftMasks[width];
- while(width <= 15) {
- pat |= SHIFT_L(pat,width);
- width <<= 1;
+ while (width <= 15) {
+ pat |= SHIFT_L(pat, width);
+ width <<= 1;
}
- pat |= SHIFT_L(pat,width);
+ pat |= SHIFT_L(pat, width);
+
+ while (dwords--) {
+ CARD32 bits = SHIFT_R(pat, shift) | SHIFT_L(pat, width - shift);
- while(dwords--) {
- CARD32 bits = SHIFT_R(pat,shift) | SHIFT_L(pat,width-shift);
#ifdef TRIPLE_BITS
- if(dwords >= 2) {
- WRITE_BITS3(bits);
- dwords -= 2;
- } else if(dwords > 0) {
- WRITE_BITS2(bits);
- dwords--;
- } else {
- WRITE_BITS1(bits);
- }
+ if (dwords >= 2) {
+ WRITE_BITS3(bits);
+ dwords -= 2;
+ }
+ else if (dwords > 0) {
+ WRITE_BITS2(bits);
+ dwords--;
+ }
+ else {
+ WRITE_BITS1(bits);
+ }
#else
- WRITE_BITS(bits);
+ WRITE_BITS(bits);
#endif
- shift += 32;
- shift %= width;
+ shift += 32;
+ shift %= width;
}
return base;
}
-
static CARD32 *
-StippleUpTo32_Inverted(
- CARD32* base, CARD32* src,
- int shift, int width, int dwords
-){
+StippleUpTo32_Inverted(CARD32 *base, CARD32 *src,
+ int shift, int width, int dwords)
+{
CARD32 pat = *src & XAAShiftMasks[width];
- while(width <= 15) {
- pat |= SHIFT_L(pat,width);
- width <<= 1;
+ while (width <= 15) {
+ pat |= SHIFT_L(pat, width);
+ width <<= 1;
}
- pat |= SHIFT_L(pat,width);
+ pat |= SHIFT_L(pat, width);
+
+ while (dwords--) {
+ CARD32 bits = ~(SHIFT_R(pat, shift) | SHIFT_L(pat, width - shift));
- while(dwords--) {
- CARD32 bits = ~(SHIFT_R(pat,shift) | SHIFT_L(pat,width-shift));
#ifdef TRIPLE_BITS
- if(dwords >= 2) {
- WRITE_BITS3(bits);
- dwords -= 2;
- } else if(dwords > 0) {
- WRITE_BITS2(bits);
- dwords--;
- } else {
- WRITE_BITS1(bits);
- }
+ if (dwords >= 2) {
+ WRITE_BITS3(bits);
+ dwords -= 2;
+ }
+ else if (dwords > 0) {
+ WRITE_BITS2(bits);
+ dwords--;
+ }
+ else {
+ WRITE_BITS1(bits);
+ }
#else
- WRITE_BITS(bits);
+ WRITE_BITS(bits);
#endif
- shift += 32;
- shift %= width;
+ shift += 32;
+ shift %= width;
}
return base;
}
-
static CARD32 *
-StippleOver32(
- CARD32* base, CARD32* src,
- int offset, int width, int dwords
-){
- CARD32* srcp;
- CARD32 bits;
- int bitsleft, shift, usable;
-
- while(dwords--) {
+StippleOver32(CARD32 *base, CARD32 *src, int offset, int width, int dwords)
+{
+ CARD32 *srcp;
+ CARD32 bits;
+ int bitsleft, shift, usable;
+
+ while (dwords--) {
bitsleft = width - offset;
srcp = src + (offset >> 5);
shift = offset & 31;
usable = 32 - shift;
- if(bitsleft < 32) {
- if(bitsleft <= usable) {
- bits = SHIFT_L(*src,bitsleft) |
- (SHIFT_R(*srcp,shift) & XAAShiftMasks[bitsleft]);
- } else {
- bits = SHIFT_L(*src,bitsleft) |
- (SHIFT_L(srcp[1],usable) & XAAShiftMasks[bitsleft]) |
- (SHIFT_R(*srcp,shift) & XAAShiftMasks[usable]);
+ if (bitsleft < 32) {
+ if (bitsleft <= usable) {
+ bits = SHIFT_L(*src, bitsleft) |
+ (SHIFT_R(*srcp, shift) & XAAShiftMasks[bitsleft]);
+ }
+ else {
+ bits = SHIFT_L(*src, bitsleft) |
+ (SHIFT_L(srcp[1], usable) & XAAShiftMasks[bitsleft]) |
+ (SHIFT_R(*srcp, shift) & XAAShiftMasks[usable]);
}
}
- else if(shift)
- bits = SHIFT_R(*srcp,shift) | SHIFT_L(srcp[1],usable);
+ else if (shift)
+ bits = SHIFT_R(*srcp, shift) | SHIFT_L(srcp[1], usable);
else
bits = *srcp;
#ifdef TRIPLE_BITS
- if(dwords >= 2) {
- WRITE_BITS3(bits);
- dwords -= 2;
- } else if(dwords > 0) {
- WRITE_BITS2(bits);
- dwords--;
- } else {
- WRITE_BITS1(bits);
- }
+ if (dwords >= 2) {
+ WRITE_BITS3(bits);
+ dwords -= 2;
+ }
+ else if (dwords > 0) {
+ WRITE_BITS2(bits);
+ dwords--;
+ }
+ else {
+ WRITE_BITS1(bits);
+ }
#else
- WRITE_BITS(bits);
+ WRITE_BITS(bits);
#endif
- offset += 32;
- offset %= width;
- }
- return base;
+ offset += 32;
+ offset %= width;
+ }
+ return base;
}
-
static CARD32 *
-StippleOver32_Inverted(
- CARD32* base, CARD32* src,
- int offset, int width, int dwords
-){
- CARD32* srcp;
- CARD32 bits;
- int bitsleft, shift, usable;
-
- while(dwords--) {
+StippleOver32_Inverted(CARD32 *base, CARD32 *src,
+ int offset, int width, int dwords)
+{
+ CARD32 *srcp;
+ CARD32 bits;
+ int bitsleft, shift, usable;
+
+ while (dwords--) {
bitsleft = width - offset;
srcp = src + (offset >> 5);
shift = offset & 31;
usable = 32 - shift;
- if(bitsleft < 32) {
- if(bitsleft <= usable) {
- bits = SHIFT_L(*src,bitsleft) |
- (SHIFT_R(*srcp,shift) & XAAShiftMasks[bitsleft]);
- } else {
- bits = SHIFT_L(*src,bitsleft) |
- (SHIFT_L(srcp[1],usable) & XAAShiftMasks[bitsleft]) |
- (SHIFT_R(*srcp,shift) & XAAShiftMasks[usable]);
+ if (bitsleft < 32) {
+ if (bitsleft <= usable) {
+ bits = SHIFT_L(*src, bitsleft) |
+ (SHIFT_R(*srcp, shift) & XAAShiftMasks[bitsleft]);
+ }
+ else {
+ bits = SHIFT_L(*src, bitsleft) |
+ (SHIFT_L(srcp[1], usable) & XAAShiftMasks[bitsleft]) |
+ (SHIFT_R(*srcp, shift) & XAAShiftMasks[usable]);
}
}
- else if(shift)
- bits = SHIFT_R(*srcp,shift) | SHIFT_L(srcp[1],usable);
+ else if (shift)
+ bits = SHIFT_R(*srcp, shift) | SHIFT_L(srcp[1], usable);
else
bits = *srcp;
- bits = ~bits;
+ bits = ~bits;
#ifdef TRIPLE_BITS
- if(dwords >= 2) {
- WRITE_BITS3(bits);
- dwords -= 2;
- } else if(dwords > 0) {
- WRITE_BITS2(bits);
- dwords--;
- } else {
- WRITE_BITS1(bits);
- }
+ if (dwords >= 2) {
+ WRITE_BITS3(bits);
+ dwords -= 2;
+ }
+ else if (dwords > 0) {
+ WRITE_BITS2(bits);
+ dwords--;
+ }
+ else {
+ WRITE_BITS1(bits);
+ }
#else
- WRITE_BITS(bits);
+ WRITE_BITS(bits);
#endif
- offset += 32;
- offset %= width;
- }
- return base;
+ offset += 32;
+ offset %= width;
+ }
+ return base;
}
diff --git a/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c b/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c
index 049bb2cb3..2926c1df2 100644
--- a/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c
+++ b/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c
@@ -1,1077 +1,1083 @@
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaacexp.h"
-#include "xf86.h"
-
-/* scanline function for TRIPLE_BITS_24BPP */
-static CARD32 *DrawTextScanline3(CARD32 *base, CARD32 *mem, int width);
-
-/* Loop unrolled functions for common font widths */
-static CARD32 *DrawTETextScanlineGeneric(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth7(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth10(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth12(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth14(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth16(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth18(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth24(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-
-
-#ifdef USEASSEMBLER
-# ifdef FIXEDBASE
-# ifdef MSBFIRST
-CARD32 *DrawTETextScanlineWidth6PMSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth8PMSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth9PMSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-# else
-CARD32 *DrawTETextScanlineWidth6PLSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth8PLSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth9PLSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-# endif
-# else
-# ifdef MSBFIRST
-CARD32 *DrawTETextScanlineWidth6PMSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth8PMSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth9PMSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-# else
-CARD32 *DrawTETextScanlineWidth6PLSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth8PLSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth9PLSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-# endif
-# endif
-#else
-static CARD32 *DrawTETextScanlineWidth6(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth8(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth9(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-#endif
-
-#define glyph_scanline_func EXPNAME(XAAGlyphScanlineFunc)
-#define glyph_get_scanline_func EXPNAME(XAAGetGlyphScanlineFunc)
-
-
-GlyphScanlineFuncPtr glyph_scanline_func[32] = {
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric,
-#ifdef USEASSEMBLER
-# ifdef FIXEDBASE
-# ifdef MSBFIRST
- DrawTETextScanlineWidth6PMSBFirstFixedBase,
- DrawTETextScanlineWidth7,
- DrawTETextScanlineWidth8PMSBFirstFixedBase,
- DrawTETextScanlineWidth9PMSBFirstFixedBase,
-# else
- DrawTETextScanlineWidth6PLSBFirstFixedBase,
- DrawTETextScanlineWidth7,
- DrawTETextScanlineWidth8PLSBFirstFixedBase,
- DrawTETextScanlineWidth9PLSBFirstFixedBase,
-# endif
-# else
-# ifdef MSBFIRST
- DrawTETextScanlineWidth6PMSBFirst,
- DrawTETextScanlineWidth7,
- DrawTETextScanlineWidth8PMSBFirst,
- DrawTETextScanlineWidth9PMSBFirst,
-# else
- DrawTETextScanlineWidth6PLSBFirst,
- DrawTETextScanlineWidth7,
- DrawTETextScanlineWidth8PLSBFirst,
- DrawTETextScanlineWidth9PLSBFirst,
-# endif
-# endif
-#else
- DrawTETextScanlineWidth6, DrawTETextScanlineWidth7,
- DrawTETextScanlineWidth8, DrawTETextScanlineWidth9,
-#endif
- DrawTETextScanlineWidth10,
- DrawTETextScanlineGeneric, DrawTETextScanlineWidth12,
- DrawTETextScanlineGeneric, DrawTETextScanlineWidth14,
- DrawTETextScanlineGeneric, DrawTETextScanlineWidth16,
- DrawTETextScanlineGeneric, DrawTETextScanlineWidth18,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineWidth24,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric
-};
-
-GlyphScanlineFuncPtr *glyph_get_scanline_func(void) {
- return glyph_scanline_func;
-}
-
-
-/********************************************************************
-
- Here we have TEGlyphRenders for a bunch of different color
- expansion types. The driver may provide its own renderer, but
- this is the default one which renders using lower-level primitives
- exported by the chipset driver.
-
-********************************************************************/
-
-/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not.
- A total of 4 versions */
-
-void
-EXPNAME(XAATEGlyphRenderer)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32* base;
- GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
- int dwords = 0;
-
- if((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- bg = -1;
- }
-
- (*infoRec->SetupForCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
-
- if(skipleft &&
- (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
- (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
- (skipleft > x)))) {
- /* draw the first character only */
-
- int count = h, line = startline;
- int width = glyphWidth - skipleft;
-
- if(width > w) width = w;
-
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(
- pScrn, x, y, width, h, 0);
-
- base = (CARD32*)infoRec->ColorExpandBase;
-
- while(count--) {
- register CARD32 tmp = SHIFT_R(glyphs[0][line++],skipleft);
- WRITE_BITS(tmp);
- }
-
- w -= width;
- if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
- ((((width + 31) >> 5) * h) & 1)) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
- }
- if(!w) goto THE_END;
- glyphs++;
- x += width;
- skipleft = 0; /* nicely aligned again */
- }
-
- w += skipleft;
- x -= skipleft;
- dwords = ((w + 31) >> 5) * h;
-
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(
- pScrn, x, y, w, h, skipleft);
-
- base = (CARD32*)infoRec->ColorExpandBase;
-
-#ifndef FIXEDBASE
- if((((w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
- while(h--) {
- base = (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
- }
- else
-#endif
- while(h--) {
- (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
- }
-
- if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
- (dwords & 1)) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
- }
-
-THE_END:
-
- if(infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-}
-
-/********************************************************************
-
- This is the GlyphRenderer for TRIPLE_BITS_24BPP. It renders to a buffer
- with the non FIXEDBASE LSB_FIRST code before tripling, and possibly
- reversing the bits and sending them to the screen
-
-********************************************************************/
-
-void
-EXPNAME(XAATEGlyphRenderer3)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32 *base, *mem;
- GlyphScanlineFuncPtr GlyphFunc = XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
- int dwords = 0;
-
- if((bg != -1) &&
- ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
- ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
- (!CHECK_RGB_EQUAL(bg))))) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- bg = -1;
- }
-
- (*infoRec->SetupForCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
-
- if(skipleft) {
- /* draw the first character only */
-
- int count = h, line = startline;
- int width = glyphWidth - skipleft;
- CARD32 bits;
-
- if(width > w) width = w;
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(
- pScrn, x, y, width, h, 0);
-
- base = (CARD32*)infoRec->ColorExpandBase;
-
- while(count--) {
- bits = SHIFT_R(glyphs[0][line++],skipleft);
- if (width >= 22) {
- WRITE_BITS3(bits);
- } else if (width >= 11) {
- WRITE_BITS2(bits);
- } else {
- WRITE_BITS1(bits);
- }
- }
-
- w -= width;
- if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
- ((((3 * width + 31) >> 5) * h) & 1)) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
- }
- if(!w) goto THE_END;
- glyphs++;
- x += width;
- skipleft = 0; /* nicely aligned again */
- }
-
- dwords = ((3 * w + 31) >> 5) * h;
- mem = (CARD32*)malloc(((w + 31) >> 3) * sizeof(char));
- if (!mem) return;
-
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, x, y, w, h, 0);
-
- base = (CARD32*)infoRec->ColorExpandBase;
-
-# ifndef FIXEDBASE
- if((((3 * w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
- while(h--) {
- (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
- base = DrawTextScanline3(base, mem, w);
- }
- else
-# endif
- while(h--) {
- (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
- DrawTextScanline3(base, mem, w);
- }
-
- free(mem);
-
- if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
- (dwords & 1)) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
- }
-
-THE_END:
-
- if(infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-}
-
-
-#ifndef FIXEDBASE
-/* Scanline version of above gets built for LSBFIRST and MSBFIRST */
-
-void
-EXPNAME(XAATEGlyphRendererScanline)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int bufferNo;
- CARD32* base;
- GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
-
- if((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- bg = -1;
- }
-
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
-
- if(skipleft &&
- (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
- (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
- (skipleft > x)))) {
- /* draw the first character only */
-
- int count = h, line = startline;
- int width = glyphWidth - skipleft;
-
- if(width > w) width = w;
-
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, x, y, width, h, 0);
-
- bufferNo = 0;
-
- while(count--) {
- register CARD32 tmp = SHIFT_R(glyphs[0][line++],skipleft);
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- WRITE_BITS(tmp);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
- }
-
- w -= width;
- if(!w) goto THE_END;
- glyphs++;
- x += width;
- skipleft = 0; /* nicely aligned again */
- }
-
- w += skipleft;
- x -= skipleft;
-
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, x, y, w, h, skipleft);
-
- bufferNo = 0;
-
- while(h--) {
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
- }
-
-THE_END:
-
- SET_SYNC_FLAG(infoRec);
-}
-
-void
-EXPNAME(XAATEGlyphRendererScanline3)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int bufferNo;
- CARD32 *base, *mem;
- GlyphScanlineFuncPtr GlyphFunc = XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
-
- if((bg != -1) &&
- ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
- ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
- (!CHECK_RGB_EQUAL(bg))))) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- bg = -1;
- }
-
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
-
- if(skipleft) {
- /* draw the first character only */
-
- int count = h, line = startline;
- int width = glyphWidth - skipleft;
- CARD32 bits;
-
- if(width > w) width = w;
-
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, x, y, width, h, 0);
-
- bufferNo = 0;
-
- while(count--) {
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- bits = SHIFT_R(glyphs[0][line++],skipleft);
- if (width >= 22) {
- WRITE_BITS3(bits);
- } else if (width >= 11) {
- WRITE_BITS2(bits);
- } else {
- WRITE_BITS1(bits);
- }
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
- }
-
- w -= width;
- if(!w) goto THE_END;
- glyphs++;
- x += width;
- skipleft = 0; /* nicely aligned again */
- }
-
- w += skipleft;
- x -= skipleft;
- mem = (CARD32*)malloc(((w + 31) >> 3) * sizeof(char));
- if (!mem) return;
-
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, x, y, w, h, skipleft);
-
- bufferNo = 0;
-
- while(h--) {
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
- DrawTextScanline3(base, mem, w);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
- }
-
- free(mem);
-
-THE_END:
-
- SET_SYNC_FLAG(infoRec);
-}
-
-#endif
-
-
-
-/********************************************************************
-
- TRIPLE_BITS_24BPP scanline rendering code.
-
-********************************************************************/
-
-
-
-static CARD32*
-DrawTextScanline3(
- CARD32 *base,
- CARD32 *mem,
- int width )
-{
-
- while(width > 32) {
- WRITE_BITS3(*mem);
- mem++;
- width -= 32;
- }
- if(width) {
- if (width >= 22) {
- WRITE_BITS3(*mem);
- } else if (width >= 11) {
- WRITE_BITS2(*mem);
- } else {
- WRITE_BITS1(*mem);
- }
- }
-
- return base;
-}
-
-
-/********************************************************************
-
- Generic TE scanline rendering code.
-
-********************************************************************/
-
-
-
-static CARD32*
-DrawTETextScanlineGeneric(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- CARD32 bits = (*glyphp)[line];
- int shift = glyphwidth;
-
- while(width > 32) {
- while(shift < 32) {
- glyphp++;
- bits |= SHIFT_L((*glyphp)[line], shift);
- shift += glyphwidth;
- }
- WRITE_BITS(bits);
- shift &= 31;
- if(shift)
- bits = SHIFT_R((*glyphp)[line],(glyphwidth - shift));
- else bits = 0;
- width -= 32;
- }
-
- if(width) {
- width -= shift;
- while(width > 0) {
- glyphp++;
- bits |= SHIFT_L((*glyphp)[line],shift);
- shift += glyphwidth;
- width -= glyphwidth;
- }
- WRITE_BITS(bits);
- }
-
- return base;
-}
-
-
-/********************************************************************
-
- Loop unrolled TE font scanline rendering code
-
-********************************************************************/
-
-
-#ifndef USEASSEMBLER
-static CARD32*
-DrawTETextScanlineWidth6(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],6);
- bits |= SHIFT_L(glyphp[2][line],12);
- bits |= SHIFT_L(glyphp[3][line],18);
- bits |= SHIFT_L(glyphp[4][line],24);
- bits |= SHIFT_L(glyphp[5][line],30);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[5][line],2);
- bits |= SHIFT_L(glyphp[6][line],4);
- bits |= SHIFT_L(glyphp[7][line],10);
- bits |= SHIFT_L(glyphp[8][line],16);
- bits |= SHIFT_L(glyphp[9][line],22);
- bits |= SHIFT_L(glyphp[10][line],28);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[10][line],4);
- bits |= SHIFT_L(glyphp[11][line],2);
- bits |= SHIFT_L(glyphp[12][line],8);
- bits |= SHIFT_L(glyphp[13][line],14);
- bits |= SHIFT_L(glyphp[14][line],20);
- bits |= SHIFT_L(glyphp[15][line],26);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
-#ifndef FIXEDBASE
- base += 3;
-#endif
- width -= 96;
- glyphp += 16;
- }
- return base;
-}
-#endif
-
-static CARD32*
-DrawTETextScanlineWidth7(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],7);
- bits |= SHIFT_L(glyphp[2][line],14);
- bits |= SHIFT_L(glyphp[3][line],21);
- bits |= SHIFT_L(glyphp[4][line],28);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[4][line],4);
- bits |= SHIFT_L(glyphp[5][line],3);
- bits |= SHIFT_L(glyphp[6][line],10);
- bits |= SHIFT_L(glyphp[7][line],17);
- bits |= SHIFT_L(glyphp[8][line],24);
- bits |= SHIFT_L(glyphp[9][line],31);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[9][line],1);
- bits |= SHIFT_L(glyphp[10][line],6);
- bits |= SHIFT_L(glyphp[11][line],13);
- bits |= SHIFT_L(glyphp[12][line],20);
- bits |= SHIFT_L(glyphp[13][line],27);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = SHIFT_R(glyphp[13][line],5);
- bits |= SHIFT_L(glyphp[14][line],2);
- bits |= SHIFT_L(glyphp[15][line],9);
- bits |= SHIFT_L(glyphp[16][line],16);
- bits |= SHIFT_L(glyphp[17][line],23);
- bits |= SHIFT_L(glyphp[18][line],30);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
- bits = SHIFT_R(glyphp[18][line],2);
- bits |= SHIFT_L(glyphp[19][line],5);
- bits |= SHIFT_L(glyphp[20][line],12);
- bits |= SHIFT_L(glyphp[21][line],19);
- bits |= SHIFT_L(glyphp[22][line],26);
- WRITE_IN_BITORDER(base, 4, bits);
- CHECKRETURN(5);
- bits = SHIFT_R(glyphp[22][line],6);
- bits |= SHIFT_L(glyphp[23][line],1);
- bits |= SHIFT_L(glyphp[24][line],8);
- bits |= SHIFT_L(glyphp[25][line],15);
- bits |= SHIFT_L(glyphp[26][line],22);
- bits |= SHIFT_L(glyphp[27][line],29);
- WRITE_IN_BITORDER(base, 5, bits);
- CHECKRETURN(6);
- bits = SHIFT_R(glyphp[27][line],3);
- bits |= SHIFT_L(glyphp[28][line],4);
- bits |= SHIFT_L(glyphp[29][line],11);
- bits |= SHIFT_L(glyphp[30][line],18);
- bits |= SHIFT_L(glyphp[31][line],25);
- WRITE_IN_BITORDER(base, 6, bits);
- CHECKRETURN(7);
-#ifndef FIXEDBASE
- base += 7;
-#endif
- width -= 224;
- glyphp += 32;
- }
- return base;
-}
-
-
-#ifndef USEASSEMBLER
-static CARD32*
-DrawTETextScanlineWidth8(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],8);
- bits |= SHIFT_L(glyphp[2][line],16);
- bits |= SHIFT_L(glyphp[3][line],24);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = glyphp[4][line];
- bits |= SHIFT_L(glyphp[5][line],8);
- bits |= SHIFT_L(glyphp[6][line],16);
- bits |= SHIFT_L(glyphp[7][line],24);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
-#ifndef FIXEDBASE
- base += 2;
-#endif
- width -= 64;
- glyphp += 8;
- }
- return base;
-}
-#endif
-
-#ifndef USEASSEMBLER
-static CARD32*
-DrawTETextScanlineWidth9(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],9);
- bits |= SHIFT_L(glyphp[2][line],18);
- bits |= SHIFT_L(glyphp[3][line],27);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[3][line],5);
- bits |= SHIFT_L(glyphp[4][line],4);
- bits |= SHIFT_L(glyphp[5][line],13);
- bits |= SHIFT_L(glyphp[6][line],22);
- bits |= SHIFT_L(glyphp[7][line],31);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[7][line],1);
- bits |= SHIFT_L(glyphp[8][line],8);
- bits |= SHIFT_L(glyphp[9][line],17);
- bits |= SHIFT_L(glyphp[10][line],26);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = SHIFT_R(glyphp[10][line],6);
- bits |= SHIFT_L(glyphp[11][line],3);
- bits |= SHIFT_L(glyphp[12][line],12);
- bits |= SHIFT_L(glyphp[13][line],21);
- bits |= SHIFT_L(glyphp[14][line],30);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
- bits = SHIFT_R(glyphp[14][line],2);
- bits |= SHIFT_L(glyphp[15][line],7);
- bits |= SHIFT_L(glyphp[16][line],16);
- bits |= SHIFT_L(glyphp[17][line],25);
- WRITE_IN_BITORDER(base, 4, bits);
- CHECKRETURN(5);
- bits = SHIFT_R(glyphp[17][line],7);
- bits |= SHIFT_L(glyphp[18][line],2);
- bits |= SHIFT_L(glyphp[19][line],11);
- bits |= SHIFT_L(glyphp[20][line],20);
- bits |= SHIFT_L(glyphp[21][line],29);
- WRITE_IN_BITORDER(base, 5, bits);
- CHECKRETURN(6);
- bits = SHIFT_R(glyphp[21][line],3);
- bits |= SHIFT_L(glyphp[22][line],6);
- bits |= SHIFT_L(glyphp[23][line],15);
- bits |= SHIFT_L(glyphp[24][line],24);
- WRITE_IN_BITORDER(base, 6, bits);
- CHECKRETURN(7);
- bits = SHIFT_R(glyphp[24][line],8);
- bits |= SHIFT_L(glyphp[25][line],1);
- bits |= SHIFT_L(glyphp[26][line],10);
- bits |= SHIFT_L(glyphp[27][line],19);
- bits |= SHIFT_L(glyphp[28][line],28);
- WRITE_IN_BITORDER(base, 7, bits);
- CHECKRETURN(8);
- bits = SHIFT_R(glyphp[28][line],4);
- bits |= SHIFT_L(glyphp[29][line],5);
- bits |= SHIFT_L(glyphp[30][line],14);
- bits |= SHIFT_L(glyphp[31][line],23);
- WRITE_IN_BITORDER(base, 8, bits);
- CHECKRETURN(9);
-#ifndef FIXEDBASE
- base += 9;
-#endif
- width -= 288;
- glyphp += 32;
- }
- return base;
-}
-#endif
-
-static CARD32*
-DrawTETextScanlineWidth10(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],10);
- bits |= SHIFT_L(glyphp[2][line],20);
- bits |= SHIFT_L(glyphp[3][line],30);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[3][line],2);
- bits |= SHIFT_L(glyphp[4][line],8);
- bits |= SHIFT_L(glyphp[5][line],18);
- bits |= SHIFT_L(glyphp[6][line],28);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[6][line],4);
- bits |= SHIFT_L(glyphp[7][line],6);
- bits |= SHIFT_L(glyphp[8][line],16);
- bits |= SHIFT_L(glyphp[9][line],26);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = SHIFT_R(glyphp[9][line],6);
- bits |= SHIFT_L(glyphp[10][line],4);
- bits |= SHIFT_L(glyphp[11][line],14);
- bits |= SHIFT_L(glyphp[12][line],24);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
- bits = SHIFT_R(glyphp[12][line],8);
- bits |= SHIFT_L(glyphp[13][line],2);
- bits |= SHIFT_L(glyphp[14][line],12);
- bits |= SHIFT_L(glyphp[15][line],22);
- WRITE_IN_BITORDER(base, 4, bits);
- CHECKRETURN(5);
-#ifndef FIXEDBASE
- base += 5;
-#endif
- width -= 160;
- glyphp += 16;
- }
- return base;
-}
-
-static CARD32*
-DrawTETextScanlineWidth12(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],12);
- bits |= SHIFT_L(glyphp[2][line],24);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[2][line],8);
- bits |= SHIFT_L(glyphp[3][line],4);
- bits |= SHIFT_L(glyphp[4][line],16);
- bits |= SHIFT_L(glyphp[5][line],28);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[5][line],4);
- bits |= SHIFT_L(glyphp[6][line],8);
- bits |= SHIFT_L(glyphp[7][line],20);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
-#ifndef FIXEDBASE
- base += 3;
-#endif
- width -= 96;
- glyphp += 8;
- }
- return base;
-}
-
-
-
-static CARD32*
-DrawTETextScanlineWidth14(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],14);
- bits |= SHIFT_L(glyphp[2][line],28);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[2][line],4);
- bits |= SHIFT_L(glyphp[3][line],10);
- bits |= SHIFT_L(glyphp[4][line],24);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[4][line],8);
- bits |= SHIFT_L(glyphp[5][line],6);
- bits |= SHIFT_L(glyphp[6][line],20);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = SHIFT_R(glyphp[6][line],12);
- bits |= SHIFT_L(glyphp[7][line],2);
- bits |= SHIFT_L(glyphp[8][line],16);
- bits |= SHIFT_L(glyphp[9][line],30);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
- bits = SHIFT_R(glyphp[9][line],2);
- bits |= SHIFT_L(glyphp[10][line],12);
- bits |= SHIFT_L(glyphp[11][line],26);
- WRITE_IN_BITORDER(base, 4, bits);
- CHECKRETURN(5);
- bits = SHIFT_R(glyphp[11][line],6);
- bits |= SHIFT_L(glyphp[12][line],8);
- bits |= SHIFT_L(glyphp[13][line],22);
- WRITE_IN_BITORDER(base, 5, bits);
- CHECKRETURN(6);
- bits = SHIFT_R(glyphp[13][line],10);
- bits |= SHIFT_L(glyphp[14][line],4);
- bits |= SHIFT_L(glyphp[15][line],18);
- WRITE_IN_BITORDER(base, 6, bits);
- CHECKRETURN(7);
-#ifndef FIXEDBASE
- base += 7;
-#endif
- width -= 224;
- glyphp += 16;
- }
- return base;
-}
-
-
-static CARD32*
-DrawTETextScanlineWidth16(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],16);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = glyphp[2][line];
- bits |= SHIFT_L(glyphp[3][line],16);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = glyphp[4][line];
- bits |= SHIFT_L(glyphp[5][line],16);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = glyphp[6][line];
- bits |= SHIFT_L(glyphp[7][line],16);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
-#ifndef FIXEDBASE
- base += 4;
-#endif
- width -= 128;
- glyphp += 8;
- }
- return base;
-}
-
-
-
-static CARD32*
-DrawTETextScanlineWidth18(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],18);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[1][line],14);
- bits |= SHIFT_L(glyphp[2][line],4);
- bits |= SHIFT_L(glyphp[3][line],22);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[3][line],10);
- bits |= SHIFT_L(glyphp[4][line],8);
- bits |= SHIFT_L(glyphp[5][line],26);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = SHIFT_R(glyphp[5][line],6);
- bits |= SHIFT_L(glyphp[6][line],12);
- bits |= SHIFT_L(glyphp[7][line],30);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
- bits = SHIFT_R(glyphp[7][line],2);
- bits |= SHIFT_L(glyphp[8][line],16);
- WRITE_IN_BITORDER(base, 4, bits);
- CHECKRETURN(5);
- bits = SHIFT_R(glyphp[8][line],16);
- bits |= SHIFT_L(glyphp[9][line],2);
- bits |= SHIFT_L(glyphp[10][line],20);
- WRITE_IN_BITORDER(base, 5, bits);
- CHECKRETURN(6);
- bits = SHIFT_R(glyphp[10][line],12);
- bits |= SHIFT_L(glyphp[11][line],6);
- bits |= SHIFT_L(glyphp[12][line],24);
- WRITE_IN_BITORDER(base, 6, bits);
- CHECKRETURN(7);
- bits = SHIFT_R(glyphp[12][line],8);
- bits |= SHIFT_L(glyphp[13][line],10);
- bits |= SHIFT_L(glyphp[14][line],28);
- WRITE_IN_BITORDER(base, 7, bits);
- CHECKRETURN(8);
- bits = SHIFT_R(glyphp[14][line],4);
- bits |= SHIFT_L(glyphp[15][line],14);
- WRITE_IN_BITORDER(base, 8, bits);
- CHECKRETURN(9);
-#ifndef FIXEDBASE
- base += 9;
-#endif
- width -= 288;
- glyphp += 16;
- }
- return base;
-}
-
-
-static CARD32*
-DrawTETextScanlineWidth24(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],24);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[1][line],8);
- bits |= SHIFT_L(glyphp[2][line],16);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[2][line],16);
- bits |= SHIFT_L(glyphp[3][line],8);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
-#ifndef FIXEDBASE
- base += 3;
-#endif
- width -= 96;
- glyphp += 4;
- }
- return base;
-}
-
-
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaacexp.h"
+#include "xf86.h"
+
+/* scanline function for TRIPLE_BITS_24BPP */
+static CARD32 *DrawTextScanline3(CARD32 *base, CARD32 *mem, int width);
+
+/* Loop unrolled functions for common font widths */
+static CARD32 *DrawTETextScanlineGeneric(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth7(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth10(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth12(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth14(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth16(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth18(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth24(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+
+#ifdef USEASSEMBLER
+#ifdef FIXEDBASE
+#ifdef MSBFIRST
+CARD32 *DrawTETextScanlineWidth6PMSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width,
+ int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PMSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width,
+ int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PMSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width,
+ int glyphwidth);
+#else
+CARD32 *DrawTETextScanlineWidth6PLSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width,
+ int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PLSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width,
+ int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PLSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width,
+ int glyphwidth);
+#endif
+#else
+#ifdef MSBFIRST
+CARD32 *DrawTETextScanlineWidth6PMSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PMSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PMSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+#else
+CARD32 *DrawTETextScanlineWidth6PLSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PLSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PLSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+#endif
+#endif
+#else
+static CARD32 *DrawTETextScanlineWidth6(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth8(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth9(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+#endif
+
+#define glyph_scanline_func EXPNAME(XAAGlyphScanlineFunc)
+#define glyph_get_scanline_func EXPNAME(XAAGetGlyphScanlineFunc)
+
+GlyphScanlineFuncPtr glyph_scanline_func[32] = {
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric,
+#ifdef USEASSEMBLER
+#ifdef FIXEDBASE
+#ifdef MSBFIRST
+ DrawTETextScanlineWidth6PMSBFirstFixedBase,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PMSBFirstFixedBase,
+ DrawTETextScanlineWidth9PMSBFirstFixedBase,
+#else
+ DrawTETextScanlineWidth6PLSBFirstFixedBase,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PLSBFirstFixedBase,
+ DrawTETextScanlineWidth9PLSBFirstFixedBase,
+#endif
+#else
+#ifdef MSBFIRST
+ DrawTETextScanlineWidth6PMSBFirst,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PMSBFirst,
+ DrawTETextScanlineWidth9PMSBFirst,
+#else
+ DrawTETextScanlineWidth6PLSBFirst,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PLSBFirst,
+ DrawTETextScanlineWidth9PLSBFirst,
+#endif
+#endif
+#else
+ DrawTETextScanlineWidth6, DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8, DrawTETextScanlineWidth9,
+#endif
+ DrawTETextScanlineWidth10,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth12,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth14,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth16,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth18,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth24,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric
+};
+
+GlyphScanlineFuncPtr *
+glyph_get_scanline_func(void)
+{
+ return glyph_scanline_func;
+}
+
+/********************************************************************
+
+ Here we have TEGlyphRenders for a bunch of different color
+ expansion types. The driver may provide its own renderer, but
+ this is the default one which renders using lower-level primitives
+ exported by the chipset driver.
+
+********************************************************************/
+
+/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not.
+ A total of 4 versions */
+
+void
+
+EXPNAME(XAATEGlyphRenderer) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *base;
+ GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
+ int dwords = 0;
+
+ if ((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+
+ if (skipleft &&
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (skipleft > x)))) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+
+ if (width > w)
+ width = w;
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, width, h,
+ 0);
+
+ base = (CARD32 *) infoRec->ColorExpandBase;
+
+ while (count--) {
+ register CARD32 tmp = SHIFT_R(glyphs[0][line++], skipleft);
+
+ WRITE_BITS(tmp);
+ }
+
+ w -= width;
+ if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((((width + 31) >> 5) * h) & 1)) {
+ base = (CARD32 *) infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+ if (!w)
+ goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ w += skipleft;
+ x -= skipleft;
+ dwords = ((w + 31) >> 5) * h;
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
+ skipleft);
+
+ base = (CARD32 *) infoRec->ColorExpandBase;
+
+#ifndef FIXEDBASE
+ if ((((w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+ while (h--) {
+ base = (*GlyphFunc) (base, glyphs, startline++, w, glyphWidth);
+ }
+ else
+#endif
+ while (h--) {
+ (*GlyphFunc) (base, glyphs, startline++, w, glyphWidth);
+ }
+
+ if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ (dwords & 1)) {
+ base = (CARD32 *) infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+ THE_END:
+
+ if (infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync) (pScrn);
+ else
+ SET_SYNC_FLAG(infoRec);
+}
+
+/********************************************************************
+
+ This is the GlyphRenderer for TRIPLE_BITS_24BPP. It renders to a buffer
+ with the non FIXEDBASE LSB_FIRST code before tripling, and possibly
+ reversing the bits and sending them to the screen
+
+********************************************************************/
+
+void
+
+EXPNAME(XAATEGlyphRenderer3) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *base, *mem;
+ GlyphScanlineFuncPtr GlyphFunc =
+ XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
+ int dwords = 0;
+
+ if ((bg != -1) &&
+ ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
+ ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
+ (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+
+ if (skipleft) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+ CARD32 bits;
+
+ if (width > w)
+ width = w;
+ (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, width, h,
+ 0);
+
+ base = (CARD32 *) infoRec->ColorExpandBase;
+
+ while (count--) {
+ bits = SHIFT_R(glyphs[0][line++], skipleft);
+ if (width >= 22) {
+ WRITE_BITS3(bits);
+ }
+ else if (width >= 11) {
+ WRITE_BITS2(bits);
+ }
+ else {
+ WRITE_BITS1(bits);
+ }
+ }
+
+ w -= width;
+ if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((((3 * width + 31) >> 5) * h) & 1)) {
+ base = (CARD32 *) infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+ if (!w)
+ goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ dwords = ((3 * w + 31) >> 5) * h;
+ mem = (CARD32 *) malloc(((w + 31) >> 3) * sizeof(char));
+ if (!mem)
+ return;
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, w, h, 0);
+
+ base = (CARD32 *) infoRec->ColorExpandBase;
+
+#ifndef FIXEDBASE
+ if ((((3 * w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+ while (h--) {
+ (*GlyphFunc) (mem, glyphs, startline++, w, glyphWidth);
+ base = DrawTextScanline3(base, mem, w);
+ }
+ else
+#endif
+ while (h--) {
+ (*GlyphFunc) (mem, glyphs, startline++, w, glyphWidth);
+ DrawTextScanline3(base, mem, w);
+ }
+
+ free(mem);
+
+ if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ (dwords & 1)) {
+ base = (CARD32 *) infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+ THE_END:
+
+ if (infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync) (pScrn);
+ else
+ SET_SYNC_FLAG(infoRec);
+}
+
+#ifndef FIXEDBASE
+/* Scanline version of above gets built for LSBFIRST and MSBFIRST */
+
+void
+
+EXPNAME(XAATEGlyphRendererScanline) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int bufferNo;
+ CARD32 *base;
+ GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
+
+ if ((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+
+ if (skipleft &&
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (skipleft > x)))) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+
+ if (width > w)
+ width = w;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y,
+ width, h, 0);
+
+ bufferNo = 0;
+
+ while (count--) {
+ register CARD32 tmp = SHIFT_R(glyphs[0][line++], skipleft);
+
+ base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
+ WRITE_BITS(tmp);
+ (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
+ if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ w -= width;
+ if (!w)
+ goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ w += skipleft;
+ x -= skipleft;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
+ skipleft);
+
+ bufferNo = 0;
+
+ while (h--) {
+ base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*GlyphFunc) (base, glyphs, startline++, w, glyphWidth);
+ (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
+ if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ THE_END:
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+
+EXPNAME(XAATEGlyphRendererScanline3) (ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int bufferNo;
+ CARD32 *base, *mem;
+ GlyphScanlineFuncPtr GlyphFunc =
+ XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
+
+ if ((bg != -1) &&
+ ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
+ ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
+ (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
+ planemask);
+
+ if (skipleft) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+ CARD32 bits;
+
+ if (width > w)
+ width = w;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y,
+ width, h, 0);
+
+ bufferNo = 0;
+
+ while (count--) {
+ base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
+ bits = SHIFT_R(glyphs[0][line++], skipleft);
+ if (width >= 22) {
+ WRITE_BITS3(bits);
+ }
+ else if (width >= 11) {
+ WRITE_BITS2(bits);
+ }
+ else {
+ WRITE_BITS1(bits);
+ }
+ (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
+ if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ w -= width;
+ if (!w)
+ goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ w += skipleft;
+ x -= skipleft;
+ mem = (CARD32 *) malloc(((w + 31) >> 3) * sizeof(char));
+ if (!mem)
+ return;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
+ skipleft);
+
+ bufferNo = 0;
+
+ while (h--) {
+ base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*GlyphFunc) (mem, glyphs, startline++, w, glyphWidth);
+ DrawTextScanline3(base, mem, w);
+ (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
+ if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ free(mem);
+
+ THE_END:
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+#endif
+
+/********************************************************************
+
+ TRIPLE_BITS_24BPP scanline rendering code.
+
+********************************************************************/
+
+static CARD32 *
+DrawTextScanline3(CARD32 *base, CARD32 *mem, int width)
+{
+
+ while (width > 32) {
+ WRITE_BITS3(*mem);
+ mem++;
+ width -= 32;
+ }
+ if (width) {
+ if (width >= 22) {
+ WRITE_BITS3(*mem);
+ }
+ else if (width >= 11) {
+ WRITE_BITS2(*mem);
+ }
+ else {
+ WRITE_BITS1(*mem);
+ }
+ }
+
+ return base;
+}
+
+/********************************************************************
+
+ Generic TE scanline rendering code.
+
+********************************************************************/
+
+static CARD32 *
+DrawTETextScanlineGeneric(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ CARD32 bits = (*glyphp)[line];
+ int shift = glyphwidth;
+
+ while (width > 32) {
+ while (shift < 32) {
+ glyphp++;
+ bits |= SHIFT_L((*glyphp)[line], shift);
+ shift += glyphwidth;
+ }
+ WRITE_BITS(bits);
+ shift &= 31;
+ if (shift)
+ bits = SHIFT_R((*glyphp)[line], (glyphwidth - shift));
+ else
+ bits = 0;
+ width -= 32;
+ }
+
+ if (width) {
+ width -= shift;
+ while (width > 0) {
+ glyphp++;
+ bits |= SHIFT_L((*glyphp)[line], shift);
+ shift += glyphwidth;
+ width -= glyphwidth;
+ }
+ WRITE_BITS(bits);
+ }
+
+ return base;
+}
+
+/********************************************************************
+
+ Loop unrolled TE font scanline rendering code
+
+********************************************************************/
+
+#ifndef USEASSEMBLER
+static CARD32 *
+DrawTETextScanlineWidth6(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ while (1) {
+ unsigned int bits;
+
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line], 6);
+ bits |= SHIFT_L(glyphp[2][line], 12);
+ bits |= SHIFT_L(glyphp[3][line], 18);
+ bits |= SHIFT_L(glyphp[4][line], 24);
+ bits |= SHIFT_L(glyphp[5][line], 30);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[5][line], 2);
+ bits |= SHIFT_L(glyphp[6][line], 4);
+ bits |= SHIFT_L(glyphp[7][line], 10);
+ bits |= SHIFT_L(glyphp[8][line], 16);
+ bits |= SHIFT_L(glyphp[9][line], 22);
+ bits |= SHIFT_L(glyphp[10][line], 28);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[10][line], 4);
+ bits |= SHIFT_L(glyphp[11][line], 2);
+ bits |= SHIFT_L(glyphp[12][line], 8);
+ bits |= SHIFT_L(glyphp[13][line], 14);
+ bits |= SHIFT_L(glyphp[14][line], 20);
+ bits |= SHIFT_L(glyphp[15][line], 26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+#ifndef FIXEDBASE
+ base += 3;
+#endif
+ width -= 96;
+ glyphp += 16;
+ }
+ return base;
+}
+#endif
+
+static CARD32 *
+DrawTETextScanlineWidth7(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ while (1) {
+ unsigned int bits;
+
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line], 7);
+ bits |= SHIFT_L(glyphp[2][line], 14);
+ bits |= SHIFT_L(glyphp[3][line], 21);
+ bits |= SHIFT_L(glyphp[4][line], 28);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[4][line], 4);
+ bits |= SHIFT_L(glyphp[5][line], 3);
+ bits |= SHIFT_L(glyphp[6][line], 10);
+ bits |= SHIFT_L(glyphp[7][line], 17);
+ bits |= SHIFT_L(glyphp[8][line], 24);
+ bits |= SHIFT_L(glyphp[9][line], 31);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[9][line], 1);
+ bits |= SHIFT_L(glyphp[10][line], 6);
+ bits |= SHIFT_L(glyphp[11][line], 13);
+ bits |= SHIFT_L(glyphp[12][line], 20);
+ bits |= SHIFT_L(glyphp[13][line], 27);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[13][line], 5);
+ bits |= SHIFT_L(glyphp[14][line], 2);
+ bits |= SHIFT_L(glyphp[15][line], 9);
+ bits |= SHIFT_L(glyphp[16][line], 16);
+ bits |= SHIFT_L(glyphp[17][line], 23);
+ bits |= SHIFT_L(glyphp[18][line], 30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[18][line], 2);
+ bits |= SHIFT_L(glyphp[19][line], 5);
+ bits |= SHIFT_L(glyphp[20][line], 12);
+ bits |= SHIFT_L(glyphp[21][line], 19);
+ bits |= SHIFT_L(glyphp[22][line], 26);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[22][line], 6);
+ bits |= SHIFT_L(glyphp[23][line], 1);
+ bits |= SHIFT_L(glyphp[24][line], 8);
+ bits |= SHIFT_L(glyphp[25][line], 15);
+ bits |= SHIFT_L(glyphp[26][line], 22);
+ bits |= SHIFT_L(glyphp[27][line], 29);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[27][line], 3);
+ bits |= SHIFT_L(glyphp[28][line], 4);
+ bits |= SHIFT_L(glyphp[29][line], 11);
+ bits |= SHIFT_L(glyphp[30][line], 18);
+ bits |= SHIFT_L(glyphp[31][line], 25);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+#ifndef FIXEDBASE
+ base += 7;
+#endif
+ width -= 224;
+ glyphp += 32;
+ }
+ return base;
+}
+
+#ifndef USEASSEMBLER
+static CARD32 *
+DrawTETextScanlineWidth8(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ while (1) {
+ unsigned int bits;
+
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line], 8);
+ bits |= SHIFT_L(glyphp[2][line], 16);
+ bits |= SHIFT_L(glyphp[3][line], 24);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = glyphp[4][line];
+ bits |= SHIFT_L(glyphp[5][line], 8);
+ bits |= SHIFT_L(glyphp[6][line], 16);
+ bits |= SHIFT_L(glyphp[7][line], 24);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+#ifndef FIXEDBASE
+ base += 2;
+#endif
+ width -= 64;
+ glyphp += 8;
+ }
+ return base;
+}
+#endif
+
+#ifndef USEASSEMBLER
+static CARD32 *
+DrawTETextScanlineWidth9(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ while (1) {
+ unsigned int bits;
+
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line], 9);
+ bits |= SHIFT_L(glyphp[2][line], 18);
+ bits |= SHIFT_L(glyphp[3][line], 27);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[3][line], 5);
+ bits |= SHIFT_L(glyphp[4][line], 4);
+ bits |= SHIFT_L(glyphp[5][line], 13);
+ bits |= SHIFT_L(glyphp[6][line], 22);
+ bits |= SHIFT_L(glyphp[7][line], 31);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[7][line], 1);
+ bits |= SHIFT_L(glyphp[8][line], 8);
+ bits |= SHIFT_L(glyphp[9][line], 17);
+ bits |= SHIFT_L(glyphp[10][line], 26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[10][line], 6);
+ bits |= SHIFT_L(glyphp[11][line], 3);
+ bits |= SHIFT_L(glyphp[12][line], 12);
+ bits |= SHIFT_L(glyphp[13][line], 21);
+ bits |= SHIFT_L(glyphp[14][line], 30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[14][line], 2);
+ bits |= SHIFT_L(glyphp[15][line], 7);
+ bits |= SHIFT_L(glyphp[16][line], 16);
+ bits |= SHIFT_L(glyphp[17][line], 25);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[17][line], 7);
+ bits |= SHIFT_L(glyphp[18][line], 2);
+ bits |= SHIFT_L(glyphp[19][line], 11);
+ bits |= SHIFT_L(glyphp[20][line], 20);
+ bits |= SHIFT_L(glyphp[21][line], 29);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[21][line], 3);
+ bits |= SHIFT_L(glyphp[22][line], 6);
+ bits |= SHIFT_L(glyphp[23][line], 15);
+ bits |= SHIFT_L(glyphp[24][line], 24);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+ bits = SHIFT_R(glyphp[24][line], 8);
+ bits |= SHIFT_L(glyphp[25][line], 1);
+ bits |= SHIFT_L(glyphp[26][line], 10);
+ bits |= SHIFT_L(glyphp[27][line], 19);
+ bits |= SHIFT_L(glyphp[28][line], 28);
+ WRITE_IN_BITORDER(base, 7, bits);
+ CHECKRETURN(8);
+ bits = SHIFT_R(glyphp[28][line], 4);
+ bits |= SHIFT_L(glyphp[29][line], 5);
+ bits |= SHIFT_L(glyphp[30][line], 14);
+ bits |= SHIFT_L(glyphp[31][line], 23);
+ WRITE_IN_BITORDER(base, 8, bits);
+ CHECKRETURN(9);
+#ifndef FIXEDBASE
+ base += 9;
+#endif
+ width -= 288;
+ glyphp += 32;
+ }
+ return base;
+}
+#endif
+
+static CARD32 *
+DrawTETextScanlineWidth10(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ while (1) {
+ unsigned int bits;
+
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line], 10);
+ bits |= SHIFT_L(glyphp[2][line], 20);
+ bits |= SHIFT_L(glyphp[3][line], 30);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[3][line], 2);
+ bits |= SHIFT_L(glyphp[4][line], 8);
+ bits |= SHIFT_L(glyphp[5][line], 18);
+ bits |= SHIFT_L(glyphp[6][line], 28);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[6][line], 4);
+ bits |= SHIFT_L(glyphp[7][line], 6);
+ bits |= SHIFT_L(glyphp[8][line], 16);
+ bits |= SHIFT_L(glyphp[9][line], 26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[9][line], 6);
+ bits |= SHIFT_L(glyphp[10][line], 4);
+ bits |= SHIFT_L(glyphp[11][line], 14);
+ bits |= SHIFT_L(glyphp[12][line], 24);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[12][line], 8);
+ bits |= SHIFT_L(glyphp[13][line], 2);
+ bits |= SHIFT_L(glyphp[14][line], 12);
+ bits |= SHIFT_L(glyphp[15][line], 22);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+#ifndef FIXEDBASE
+ base += 5;
+#endif
+ width -= 160;
+ glyphp += 16;
+ }
+ return base;
+}
+
+static CARD32 *
+DrawTETextScanlineWidth12(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ while (1) {
+ unsigned int bits;
+
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line], 12);
+ bits |= SHIFT_L(glyphp[2][line], 24);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[2][line], 8);
+ bits |= SHIFT_L(glyphp[3][line], 4);
+ bits |= SHIFT_L(glyphp[4][line], 16);
+ bits |= SHIFT_L(glyphp[5][line], 28);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[5][line], 4);
+ bits |= SHIFT_L(glyphp[6][line], 8);
+ bits |= SHIFT_L(glyphp[7][line], 20);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+#ifndef FIXEDBASE
+ base += 3;
+#endif
+ width -= 96;
+ glyphp += 8;
+ }
+ return base;
+}
+
+static CARD32 *
+DrawTETextScanlineWidth14(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ while (1) {
+ unsigned int bits;
+
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line], 14);
+ bits |= SHIFT_L(glyphp[2][line], 28);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[2][line], 4);
+ bits |= SHIFT_L(glyphp[3][line], 10);
+ bits |= SHIFT_L(glyphp[4][line], 24);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[4][line], 8);
+ bits |= SHIFT_L(glyphp[5][line], 6);
+ bits |= SHIFT_L(glyphp[6][line], 20);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[6][line], 12);
+ bits |= SHIFT_L(glyphp[7][line], 2);
+ bits |= SHIFT_L(glyphp[8][line], 16);
+ bits |= SHIFT_L(glyphp[9][line], 30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[9][line], 2);
+ bits |= SHIFT_L(glyphp[10][line], 12);
+ bits |= SHIFT_L(glyphp[11][line], 26);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[11][line], 6);
+ bits |= SHIFT_L(glyphp[12][line], 8);
+ bits |= SHIFT_L(glyphp[13][line], 22);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[13][line], 10);
+ bits |= SHIFT_L(glyphp[14][line], 4);
+ bits |= SHIFT_L(glyphp[15][line], 18);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+#ifndef FIXEDBASE
+ base += 7;
+#endif
+ width -= 224;
+ glyphp += 16;
+ }
+ return base;
+}
+
+static CARD32 *
+DrawTETextScanlineWidth16(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ while (1) {
+ unsigned int bits;
+
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line], 16);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = glyphp[2][line];
+ bits |= SHIFT_L(glyphp[3][line], 16);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = glyphp[4][line];
+ bits |= SHIFT_L(glyphp[5][line], 16);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = glyphp[6][line];
+ bits |= SHIFT_L(glyphp[7][line], 16);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+#ifndef FIXEDBASE
+ base += 4;
+#endif
+ width -= 128;
+ glyphp += 8;
+ }
+ return base;
+}
+
+static CARD32 *
+DrawTETextScanlineWidth18(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ while (1) {
+ unsigned int bits;
+
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line], 18);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[1][line], 14);
+ bits |= SHIFT_L(glyphp[2][line], 4);
+ bits |= SHIFT_L(glyphp[3][line], 22);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[3][line], 10);
+ bits |= SHIFT_L(glyphp[4][line], 8);
+ bits |= SHIFT_L(glyphp[5][line], 26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[5][line], 6);
+ bits |= SHIFT_L(glyphp[6][line], 12);
+ bits |= SHIFT_L(glyphp[7][line], 30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[7][line], 2);
+ bits |= SHIFT_L(glyphp[8][line], 16);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[8][line], 16);
+ bits |= SHIFT_L(glyphp[9][line], 2);
+ bits |= SHIFT_L(glyphp[10][line], 20);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[10][line], 12);
+ bits |= SHIFT_L(glyphp[11][line], 6);
+ bits |= SHIFT_L(glyphp[12][line], 24);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+ bits = SHIFT_R(glyphp[12][line], 8);
+ bits |= SHIFT_L(glyphp[13][line], 10);
+ bits |= SHIFT_L(glyphp[14][line], 28);
+ WRITE_IN_BITORDER(base, 7, bits);
+ CHECKRETURN(8);
+ bits = SHIFT_R(glyphp[14][line], 4);
+ bits |= SHIFT_L(glyphp[15][line], 14);
+ WRITE_IN_BITORDER(base, 8, bits);
+ CHECKRETURN(9);
+#ifndef FIXEDBASE
+ base += 9;
+#endif
+ width -= 288;
+ glyphp += 16;
+ }
+ return base;
+}
+
+static CARD32 *
+DrawTETextScanlineWidth24(CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth)
+{
+ while (1) {
+ unsigned int bits;
+
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line], 24);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[1][line], 8);
+ bits |= SHIFT_L(glyphp[2][line], 16);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[2][line], 16);
+ bits |= SHIFT_L(glyphp[3][line], 8);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+#ifndef FIXEDBASE
+ base += 3;
+#endif
+ width -= 96;
+ glyphp += 4;
+ }
+ return base;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaTEText.c b/xorg-server/hw/xfree86/xaa/xaaTEText.c
index 2cc5fc1e6..a5ef44768 100644
--- a/xorg-server/hw/xfree86/xaa/xaaTEText.c
+++ b/xorg-server/hw/xfree86/xaa/xaaTEText.c
@@ -1,311 +1,295 @@
-
-/********************************************************************
-
- In this file we have GC level replacements for PolyText8/16,
- ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for TE (fixed) fonts.
- The idea is that everything in this file is device independent.
- The mentioned GCOps are merely wrappers for XAAGlyphBltTEColorExpansion
- which calculates the boxes containing arbitrarily clipped text
- and passes them to the TEGlyphRenderer which will usually be a lower
- level XAA function which renders these clipped glyphs using
- the basic color expansion functions exported by the chipset driver.
- The TEGlyphRenderer itself may optionally be driver supplied to
- facilitate work-arounds/optimizations at a higher level than usual.
-
- v1.0 - Mark Vojkovich (mvojkovi@ucsd.edu)
-
-
-********************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include <X11/fonts/font.h>
-#include "scrnintstr.h"
-#include "dixfontstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-
-
-static void XAAGlyphBltTEColorExpansion(ScrnInfoPtr pScrn, int xInit,
- int yInit, FontPtr font, int fg, int bg, int rop,
- unsigned int planemask, RegionPtr cclip, int nglyph,
- unsigned char* gBase, CharInfoPtr *ppci);
-
-
-/********************************************************************
-
- GC level replacements for PolyText8/16 and ImageText8/16
- for TE fonts when using color expansion.
-
-********************************************************************/
-
-
-int
-XAAPolyText8TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
- (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
-
- /* we have divorced XAAGlyphBltTEColorExpansion from the drawable */
- if(n) XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-
- return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
-}
-
-
-int
-XAAPolyText16TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- (*pGC->font->get_glyphs)(
- pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, infoRec->CharInfo);
-
- if(n) XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-
- return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
-}
-
-
-void
-XAAImageText8TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
- (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
-
- if(n) XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-}
-
-
-void
-XAAImageText16TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- (*pGC->font->get_glyphs)(
- pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, infoRec->CharInfo);
-
- if(n) XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-}
-
-
-
-/********************************************************************
-
- GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
- TE fonts when using color expansion.
-
-********************************************************************/
-
-
-void
-XAAImageGlyphBltTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, xInit + pDrawable->x, yInit + pDrawable->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
- pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
-}
-
-void
-XAAPolyGlyphBltTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, xInit + pDrawable->x, yInit + pDrawable->y,
- pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
-}
-
-
-
-
-/********************************************************************
-
- XAAGlyphBltTEColorExpansion -
-
- This guy computes the clipped pieces of text and sends it to
- the lower-level function which will handle acceleration of
- arbitrarily clipped text.
-
-********************************************************************/
-
-
-static void
-XAAGlyphBltTEColorExpansion(
- ScrnInfoPtr pScrn,
- int xInit, int yInit,
- FontPtr font,
- int fg, int bg,
- int rop,
- unsigned int planemask,
- RegionPtr cclip,
- int nglyph,
- unsigned char* gBase,
- CharInfoPtr *ppci )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int skippix, skipglyphs;
- int Left, Right, Top, Bottom;
- int LeftEdge, RightEdge, ytop, ybot;
- int nbox = RegionNumRects(cclip);
- BoxPtr pbox = RegionRects(cclip);
- unsigned int **glyphs = NULL;
- int glyphWidth = FONTMAXBOUNDS(font, characterWidth);
-
- /* find the size of the box */
- Left = xInit;
- Right = Left + (glyphWidth * nglyph);
- Top = yInit - FONTASCENT(font);
- Bottom = yInit + FONTDESCENT(font);
-
- /* get into the first band that may contain part of our string */
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- /* stop when the lower edge of the box is beyond our string */
- while(nbox && (Bottom > pbox->y1)) {
- LeftEdge = max(Left, pbox->x1);
- RightEdge = min(Right, pbox->x2);
-
- if(RightEdge > LeftEdge) { /* we have something to draw */
- unsigned int *fallbackBits = NULL;
- ytop = max(Top, pbox->y1);
- ybot = min(Bottom, pbox->y2);
-
- if((skippix = LeftEdge - Left)) {
- skipglyphs = skippix/glyphWidth;
- skippix %= glyphWidth;
- } else skipglyphs = 0;
-
- if(!glyphs) {
- int count;
- glyphs = (unsigned int**)(infoRec->PreAllocMem);
-
- for(count = 0; count < nglyph; count++) {
- glyphs[count] = (unsigned int*)
- FONTGLYPHBITS(gBase,*ppci++);
- if (!glyphs[count]) {
- /* Glyphs with NULL bits do exist in the wild.
- Replace with blank bits in that case */
-
- if (!fallbackBits) {
- int fontHeight = Bottom - Top + 1;
- fallbackBits = calloc(glyphWidth * fontHeight, 1);
- if (!fallbackBits)
- return;
- }
- glyphs[count] = fallbackBits;
- }
- }
-
- /* our new unrolled TE code only writes DWORDS at a time
- so it can read up to 6 characters past the last one
- we're displaying */
- glyphs[count + 0] = glyphs[0];
- glyphs[count + 1] = glyphs[0];
- glyphs[count + 2] = glyphs[0];
- glyphs[count + 3] = glyphs[0];
- glyphs[count + 4] = glyphs[0];
- glyphs[count + 5] = glyphs[0];
- }
-
- /* x, y, w, h, skipleft, skiptop, glyphp, glyphWidth, fg, bg, rop, pm */
-
- (*infoRec->TEGlyphRenderer)( pScrn,
- LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop,
- skippix, ytop - Top, glyphs + skipglyphs, glyphWidth,
- fg, bg, rop, planemask);
-
- free(fallbackBits);
- }
-
- nbox--; pbox++;
- }
-}
-
-
-
-
+
+/********************************************************************
+
+ In this file we have GC level replacements for PolyText8/16,
+ ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for TE (fixed) fonts.
+ The idea is that everything in this file is device independent.
+ The mentioned GCOps are merely wrappers for XAAGlyphBltTEColorExpansion
+ which calculates the boxes containing arbitrarily clipped text
+ and passes them to the TEGlyphRenderer which will usually be a lower
+ level XAA function which renders these clipped glyphs using
+ the basic color expansion functions exported by the chipset driver.
+ The TEGlyphRenderer itself may optionally be driver supplied to
+ facilitate work-arounds/optimizations at a higher level than usual.
+
+ v1.0 - Mark Vojkovich (mvojkovi@ucsd.edu)
+
+********************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/fonts/font.h>
+#include "scrnintstr.h"
+#include "dixfontstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+
+static void XAAGlyphBltTEColorExpansion(ScrnInfoPtr pScrn, int xInit,
+ int yInit, FontPtr font, int fg, int bg,
+ int rop, unsigned int planemask,
+ RegionPtr cclip, int nglyph,
+ unsigned char *gBase,
+ CharInfoPtr * ppci);
+
+/********************************************************************
+
+ GC level replacements for PolyText8/16 and ImageText8/16
+ for TE fonts when using color expansion.
+
+********************************************************************/
+
+int
+XAAPolyText8TEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
+ (unsigned char *) chars, Linear8Bit, &n,
+ infoRec->CharInfo);
+
+ /* we have divorced XAAGlyphBltTEColorExpansion from the drawable */
+ if (n)
+ XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, -1, pGC->alu,
+ pGC->planemask, pGC->pCompositeClip, n,
+ FONTGLYPHS(pGC->font), infoRec->CharInfo);
+
+ return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
+}
+
+int
+XAAPolyText16TEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
+ (unsigned char *) chars,
+ (FONTLASTROW(pGC->font) ==
+ 0) ? Linear16Bit : TwoD16Bit, &n,
+ infoRec->CharInfo);
+
+ if (n)
+ XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, -1, pGC->alu,
+ pGC->planemask, pGC->pCompositeClip, n,
+ FONTGLYPHS(pGC->font), infoRec->CharInfo);
+
+ return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
+}
+
+void
+XAAImageText8TEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
+ (unsigned char *) chars, Linear8Bit, &n,
+ infoRec->CharInfo);
+
+ if (n)
+ XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel,
+ GXcopy, pGC->planemask, pGC->pCompositeClip,
+ n, FONTGLYPHS(pGC->font),
+ infoRec->CharInfo);
+}
+
+void
+XAAImageText16TEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
+ (unsigned char *) chars,
+ (FONTLASTROW(pGC->font) ==
+ 0) ? Linear16Bit : TwoD16Bit, &n,
+ infoRec->CharInfo);
+
+ if (n)
+ XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel,
+ GXcopy, pGC->planemask, pGC->pCompositeClip,
+ n, FONTGLYPHS(pGC->font),
+ infoRec->CharInfo);
+}
+
+/********************************************************************
+
+ GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
+ TE fonts when using color expansion.
+
+********************************************************************/
+
+void
+XAAImageGlyphBltTEColorExpansion(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ XAAGlyphBltTEColorExpansion(infoRec->pScrn, xInit + pDrawable->x,
+ yInit + pDrawable->y, pGC->font, pGC->fgPixel,
+ pGC->bgPixel, GXcopy, pGC->planemask,
+ pGC->pCompositeClip, nglyph,
+ (unsigned char *) pglyphBase, ppci);
+}
+
+void
+XAAPolyGlyphBltTEColorExpansion(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ XAAGlyphBltTEColorExpansion(infoRec->pScrn, xInit + pDrawable->x,
+ yInit + pDrawable->y, pGC->font, pGC->fgPixel,
+ -1, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, nglyph,
+ (unsigned char *) pglyphBase, ppci);
+}
+
+/********************************************************************
+
+ XAAGlyphBltTEColorExpansion -
+
+ This guy computes the clipped pieces of text and sends it to
+ the lower-level function which will handle acceleration of
+ arbitrarily clipped text.
+
+********************************************************************/
+
+static void
+XAAGlyphBltTEColorExpansion(ScrnInfoPtr pScrn,
+ int xInit, int yInit,
+ FontPtr font,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask,
+ RegionPtr cclip,
+ int nglyph,
+ unsigned char *gBase, CharInfoPtr * ppci)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int skippix, skipglyphs;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge, ytop, ybot;
+ int nbox = RegionNumRects(cclip);
+ BoxPtr pbox = RegionRects(cclip);
+ unsigned int **glyphs = NULL;
+ int glyphWidth = FONTMAXBOUNDS(font, characterWidth);
+
+ /* find the size of the box */
+ Left = xInit;
+ Right = Left + (glyphWidth * nglyph);
+ Top = yInit - FONTASCENT(font);
+ Bottom = yInit + FONTDESCENT(font);
+
+ /* get into the first band that may contain part of our string */
+ while (nbox && (Top >= pbox->y2)) {
+ pbox++;
+ nbox--;
+ }
+
+ /* stop when the lower edge of the box is beyond our string */
+ while (nbox && (Bottom > pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if (RightEdge > LeftEdge) { /* we have something to draw */
+ unsigned int *fallbackBits = NULL;
+
+ ytop = max(Top, pbox->y1);
+ ybot = min(Bottom, pbox->y2);
+
+ if ((skippix = LeftEdge - Left)) {
+ skipglyphs = skippix / glyphWidth;
+ skippix %= glyphWidth;
+ }
+ else
+ skipglyphs = 0;
+
+ if (!glyphs) {
+ int count;
+
+ glyphs = (unsigned int **) (infoRec->PreAllocMem);
+
+ for (count = 0; count < nglyph; count++) {
+ glyphs[count] = (unsigned int *)
+ FONTGLYPHBITS(gBase, *ppci++);
+ if (!glyphs[count]) {
+ /* Glyphs with NULL bits do exist in the wild.
+ Replace with blank bits in that case */
+
+ if (!fallbackBits) {
+ int fontHeight = Bottom - Top + 1;
+
+ fallbackBits = calloc(glyphWidth * fontHeight, 1);
+ if (!fallbackBits)
+ return;
+ }
+ glyphs[count] = fallbackBits;
+ }
+ }
+
+ /* our new unrolled TE code only writes DWORDS at a time
+ so it can read up to 6 characters past the last one
+ we're displaying */
+ glyphs[count + 0] = glyphs[0];
+ glyphs[count + 1] = glyphs[0];
+ glyphs[count + 2] = glyphs[0];
+ glyphs[count + 3] = glyphs[0];
+ glyphs[count + 4] = glyphs[0];
+ glyphs[count + 5] = glyphs[0];
+ }
+
+ /* x, y, w, h, skipleft, skiptop, glyphp, glyphWidth, fg, bg, rop, pm */
+
+ (*infoRec->TEGlyphRenderer) (pScrn,
+ LeftEdge, ytop, RightEdge - LeftEdge,
+ ybot - ytop, skippix, ytop - Top,
+ glyphs + skipglyphs, glyphWidth, fg,
+ bg, rop, planemask);
+
+ free(fallbackBits);
+ }
+
+ nbox--;
+ pbox++;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaTables.c b/xorg-server/hw/xfree86/xaa/xaaTables.c
index dbeb4a269..35641da59 100644
--- a/xorg-server/hw/xfree86/xaa/xaaTables.c
+++ b/xorg-server/hw/xfree86/xaa/xaaTables.c
@@ -9,40 +9,71 @@
* bit order within a byte.
*/
-unsigned int byte_expand3[256] =
-{
- 0x000000, 0x000007, 0x000038, 0x00003F, 0x0001C0, 0x0001C7, 0x0001F8, 0x0001FF,
- 0x000E00, 0x000E07, 0x000E38, 0x000E3F, 0x000FC0, 0x000FC7, 0x000FF8, 0x000FFF,
- 0x007000, 0x007007, 0x007038, 0x00703F, 0x0071C0, 0x0071C7, 0x0071F8, 0x0071FF,
- 0x007E00, 0x007E07, 0x007E38, 0x007E3F, 0x007FC0, 0x007FC7, 0x007FF8, 0x007FFF,
- 0x038000, 0x038007, 0x038038, 0x03803F, 0x0381C0, 0x0381C7, 0x0381F8, 0x0381FF,
- 0x038E00, 0x038E07, 0x038E38, 0x038E3F, 0x038FC0, 0x038FC7, 0x038FF8, 0x038FFF,
- 0x03F000, 0x03F007, 0x03F038, 0x03F03F, 0x03F1C0, 0x03F1C7, 0x03F1F8, 0x03F1FF,
- 0x03FE00, 0x03FE07, 0x03FE38, 0x03FE3F, 0x03FFC0, 0x03FFC7, 0x03FFF8, 0x03FFFF,
- 0x1C0000, 0x1C0007, 0x1C0038, 0x1C003F, 0x1C01C0, 0x1C01C7, 0x1C01F8, 0x1C01FF,
- 0x1C0E00, 0x1C0E07, 0x1C0E38, 0x1C0E3F, 0x1C0FC0, 0x1C0FC7, 0x1C0FF8, 0x1C0FFF,
- 0x1C7000, 0x1C7007, 0x1C7038, 0x1C703F, 0x1C71C0, 0x1C71C7, 0x1C71F8, 0x1C71FF,
- 0x1C7E00, 0x1C7E07, 0x1C7E38, 0x1C7E3F, 0x1C7FC0, 0x1C7FC7, 0x1C7FF8, 0x1C7FFF,
- 0x1F8000, 0x1F8007, 0x1F8038, 0x1F803F, 0x1F81C0, 0x1F81C7, 0x1F81F8, 0x1F81FF,
- 0x1F8E00, 0x1F8E07, 0x1F8E38, 0x1F8E3F, 0x1F8FC0, 0x1F8FC7, 0x1F8FF8, 0x1F8FFF,
- 0x1FF000, 0x1FF007, 0x1FF038, 0x1FF03F, 0x1FF1C0, 0x1FF1C7, 0x1FF1F8, 0x1FF1FF,
- 0x1FFE00, 0x1FFE07, 0x1FFE38, 0x1FFE3F, 0x1FFFC0, 0x1FFFC7, 0x1FFFF8, 0x1FFFFF,
- 0xE00000, 0xE00007, 0xE00038, 0xE0003F, 0xE001C0, 0xE001C7, 0xE001F8, 0xE001FF,
- 0xE00E00, 0xE00E07, 0xE00E38, 0xE00E3F, 0xE00FC0, 0xE00FC7, 0xE00FF8, 0xE00FFF,
- 0xE07000, 0xE07007, 0xE07038, 0xE0703F, 0xE071C0, 0xE071C7, 0xE071F8, 0xE071FF,
- 0xE07E00, 0xE07E07, 0xE07E38, 0xE07E3F, 0xE07FC0, 0xE07FC7, 0xE07FF8, 0xE07FFF,
- 0xE38000, 0xE38007, 0xE38038, 0xE3803F, 0xE381C0, 0xE381C7, 0xE381F8, 0xE381FF,
- 0xE38E00, 0xE38E07, 0xE38E38, 0xE38E3F, 0xE38FC0, 0xE38FC7, 0xE38FF8, 0xE38FFF,
- 0xE3F000, 0xE3F007, 0xE3F038, 0xE3F03F, 0xE3F1C0, 0xE3F1C7, 0xE3F1F8, 0xE3F1FF,
- 0xE3FE00, 0xE3FE07, 0xE3FE38, 0xE3FE3F, 0xE3FFC0, 0xE3FFC7, 0xE3FFF8, 0xE3FFFF,
- 0xFC0000, 0xFC0007, 0xFC0038, 0xFC003F, 0xFC01C0, 0xFC01C7, 0xFC01F8, 0xFC01FF,
- 0xFC0E00, 0xFC0E07, 0xFC0E38, 0xFC0E3F, 0xFC0FC0, 0xFC0FC7, 0xFC0FF8, 0xFC0FFF,
- 0xFC7000, 0xFC7007, 0xFC7038, 0xFC703F, 0xFC71C0, 0xFC71C7, 0xFC71F8, 0xFC71FF,
- 0xFC7E00, 0xFC7E07, 0xFC7E38, 0xFC7E3F, 0xFC7FC0, 0xFC7FC7, 0xFC7FF8, 0xFC7FFF,
- 0xFF8000, 0xFF8007, 0xFF8038, 0xFF803F, 0xFF81C0, 0xFF81C7, 0xFF81F8, 0xFF81FF,
- 0xFF8E00, 0xFF8E07, 0xFF8E38, 0xFF8E3F, 0xFF8FC0, 0xFF8FC7, 0xFF8FF8, 0xFF8FFF,
- 0xFFF000, 0xFFF007, 0xFFF038, 0xFFF03F, 0xFFF1C0, 0xFFF1C7, 0xFFF1F8, 0xFFF1FF,
- 0xFFFE00, 0xFFFE07, 0xFFFE38, 0xFFFE3F, 0xFFFFC0, 0xFFFFC7, 0xFFFFF8, 0xFFFFFF
+unsigned int byte_expand3[256] = {
+ 0x000000, 0x000007, 0x000038, 0x00003F, 0x0001C0, 0x0001C7, 0x0001F8,
+ 0x0001FF,
+ 0x000E00, 0x000E07, 0x000E38, 0x000E3F, 0x000FC0, 0x000FC7, 0x000FF8,
+ 0x000FFF,
+ 0x007000, 0x007007, 0x007038, 0x00703F, 0x0071C0, 0x0071C7, 0x0071F8,
+ 0x0071FF,
+ 0x007E00, 0x007E07, 0x007E38, 0x007E3F, 0x007FC0, 0x007FC7, 0x007FF8,
+ 0x007FFF,
+ 0x038000, 0x038007, 0x038038, 0x03803F, 0x0381C0, 0x0381C7, 0x0381F8,
+ 0x0381FF,
+ 0x038E00, 0x038E07, 0x038E38, 0x038E3F, 0x038FC0, 0x038FC7, 0x038FF8,
+ 0x038FFF,
+ 0x03F000, 0x03F007, 0x03F038, 0x03F03F, 0x03F1C0, 0x03F1C7, 0x03F1F8,
+ 0x03F1FF,
+ 0x03FE00, 0x03FE07, 0x03FE38, 0x03FE3F, 0x03FFC0, 0x03FFC7, 0x03FFF8,
+ 0x03FFFF,
+ 0x1C0000, 0x1C0007, 0x1C0038, 0x1C003F, 0x1C01C0, 0x1C01C7, 0x1C01F8,
+ 0x1C01FF,
+ 0x1C0E00, 0x1C0E07, 0x1C0E38, 0x1C0E3F, 0x1C0FC0, 0x1C0FC7, 0x1C0FF8,
+ 0x1C0FFF,
+ 0x1C7000, 0x1C7007, 0x1C7038, 0x1C703F, 0x1C71C0, 0x1C71C7, 0x1C71F8,
+ 0x1C71FF,
+ 0x1C7E00, 0x1C7E07, 0x1C7E38, 0x1C7E3F, 0x1C7FC0, 0x1C7FC7, 0x1C7FF8,
+ 0x1C7FFF,
+ 0x1F8000, 0x1F8007, 0x1F8038, 0x1F803F, 0x1F81C0, 0x1F81C7, 0x1F81F8,
+ 0x1F81FF,
+ 0x1F8E00, 0x1F8E07, 0x1F8E38, 0x1F8E3F, 0x1F8FC0, 0x1F8FC7, 0x1F8FF8,
+ 0x1F8FFF,
+ 0x1FF000, 0x1FF007, 0x1FF038, 0x1FF03F, 0x1FF1C0, 0x1FF1C7, 0x1FF1F8,
+ 0x1FF1FF,
+ 0x1FFE00, 0x1FFE07, 0x1FFE38, 0x1FFE3F, 0x1FFFC0, 0x1FFFC7, 0x1FFFF8,
+ 0x1FFFFF,
+ 0xE00000, 0xE00007, 0xE00038, 0xE0003F, 0xE001C0, 0xE001C7, 0xE001F8,
+ 0xE001FF,
+ 0xE00E00, 0xE00E07, 0xE00E38, 0xE00E3F, 0xE00FC0, 0xE00FC7, 0xE00FF8,
+ 0xE00FFF,
+ 0xE07000, 0xE07007, 0xE07038, 0xE0703F, 0xE071C0, 0xE071C7, 0xE071F8,
+ 0xE071FF,
+ 0xE07E00, 0xE07E07, 0xE07E38, 0xE07E3F, 0xE07FC0, 0xE07FC7, 0xE07FF8,
+ 0xE07FFF,
+ 0xE38000, 0xE38007, 0xE38038, 0xE3803F, 0xE381C0, 0xE381C7, 0xE381F8,
+ 0xE381FF,
+ 0xE38E00, 0xE38E07, 0xE38E38, 0xE38E3F, 0xE38FC0, 0xE38FC7, 0xE38FF8,
+ 0xE38FFF,
+ 0xE3F000, 0xE3F007, 0xE3F038, 0xE3F03F, 0xE3F1C0, 0xE3F1C7, 0xE3F1F8,
+ 0xE3F1FF,
+ 0xE3FE00, 0xE3FE07, 0xE3FE38, 0xE3FE3F, 0xE3FFC0, 0xE3FFC7, 0xE3FFF8,
+ 0xE3FFFF,
+ 0xFC0000, 0xFC0007, 0xFC0038, 0xFC003F, 0xFC01C0, 0xFC01C7, 0xFC01F8,
+ 0xFC01FF,
+ 0xFC0E00, 0xFC0E07, 0xFC0E38, 0xFC0E3F, 0xFC0FC0, 0xFC0FC7, 0xFC0FF8,
+ 0xFC0FFF,
+ 0xFC7000, 0xFC7007, 0xFC7038, 0xFC703F, 0xFC71C0, 0xFC71C7, 0xFC71F8,
+ 0xFC71FF,
+ 0xFC7E00, 0xFC7E07, 0xFC7E38, 0xFC7E3F, 0xFC7FC0, 0xFC7FC7, 0xFC7FF8,
+ 0xFC7FFF,
+ 0xFF8000, 0xFF8007, 0xFF8038, 0xFF803F, 0xFF81C0, 0xFF81C7, 0xFF81F8,
+ 0xFF81FF,
+ 0xFF8E00, 0xFF8E07, 0xFF8E38, 0xFF8E3F, 0xFF8FC0, 0xFF8FC7, 0xFF8FF8,
+ 0xFF8FFF,
+ 0xFFF000, 0xFFF007, 0xFFF038, 0xFFF03F, 0xFFF1C0, 0xFFF1C7, 0xFFF1F8,
+ 0xFFF1FF,
+ 0xFFFE00, 0xFFFE07, 0xFFFE38, 0xFFFE3F, 0xFFFFC0, 0xFFFFC7, 0xFFFFF8,
+ 0xFFFFFF
};
/*
@@ -53,38 +84,69 @@ unsigned int byte_expand3[256] =
* byte.
*/
-unsigned int byte_reversed_expand3[256] =
-{
- 0x000000, 0x0000E0, 0x00001C, 0x0000FC, 0x008003, 0x0080E3, 0x00801F, 0x0080FF,
- 0x007000, 0x0070E0, 0x00701C, 0x0070FC, 0x00F003, 0x00F0E3, 0x00F01F, 0x00F0FF,
- 0x000E00, 0x000EE0, 0x000E1C, 0x000EFC, 0x008E03, 0x008EE3, 0x008E1F, 0x008EFF,
- 0x007E00, 0x007EE0, 0x007E1C, 0x007EFC, 0x00FE03, 0x00FEE3, 0x00FE1F, 0x00FEFF,
- 0xC00100, 0xC001E0, 0xC0011C, 0xC001FC, 0xC08103, 0xC081E3, 0xC0811F, 0xC081FF,
- 0xC07100, 0xC071E0, 0xC0711C, 0xC071FC, 0xC0F103, 0xC0F1E3, 0xC0F11F, 0xC0F1FF,
- 0xC00F00, 0xC00FE0, 0xC00F1C, 0xC00FFC, 0xC08F03, 0xC08FE3, 0xC08F1F, 0xC08FFF,
- 0xC07F00, 0xC07FE0, 0xC07F1C, 0xC07FFC, 0xC0FF03, 0xC0FFE3, 0xC0FF1F, 0xC0FFFF,
- 0x380000, 0x3800E0, 0x38001C, 0x3800FC, 0x388003, 0x3880E3, 0x38801F, 0x3880FF,
- 0x387000, 0x3870E0, 0x38701C, 0x3870FC, 0x38F003, 0x38F0E3, 0x38F01F, 0x38F0FF,
- 0x380E00, 0x380EE0, 0x380E1C, 0x380EFC, 0x388E03, 0x388EE3, 0x388E1F, 0x388EFF,
- 0x387E00, 0x387EE0, 0x387E1C, 0x387EFC, 0x38FE03, 0x38FEE3, 0x38FE1F, 0x38FEFF,
- 0xF80100, 0xF801E0, 0xF8011C, 0xF801FC, 0xF88103, 0xF881E3, 0xF8811F, 0xF881FF,
- 0xF87100, 0xF871E0, 0xF8711C, 0xF871FC, 0xF8F103, 0xF8F1E3, 0xF8F11F, 0xF8F1FF,
- 0xF80F00, 0xF80FE0, 0xF80F1C, 0xF80FFC, 0xF88F03, 0xF88FE3, 0xF88F1F, 0xF88FFF,
- 0xF87F00, 0xF87FE0, 0xF87F1C, 0xF87FFC, 0xF8FF03, 0xF8FFE3, 0xF8FF1F, 0xF8FFFF,
- 0x070000, 0x0700E0, 0x07001C, 0x0700FC, 0x078003, 0x0780E3, 0x07801F, 0x0780FF,
- 0x077000, 0x0770E0, 0x07701C, 0x0770FC, 0x07F003, 0x07F0E3, 0x07F01F, 0x07F0FF,
- 0x070E00, 0x070EE0, 0x070E1C, 0x070EFC, 0x078E03, 0x078EE3, 0x078E1F, 0x078EFF,
- 0x077E00, 0x077EE0, 0x077E1C, 0x077EFC, 0x07FE03, 0x07FEE3, 0x07FE1F, 0x07FEFF,
- 0xC70100, 0xC701E0, 0xC7011C, 0xC701FC, 0xC78103, 0xC781E3, 0xC7811F, 0xC781FF,
- 0xC77100, 0xC771E0, 0xC7711C, 0xC771FC, 0xC7F103, 0xC7F1E3, 0xC7F11F, 0xC7F1FF,
- 0xC70F00, 0xC70FE0, 0xC70F1C, 0xC70FFC, 0xC78F03, 0xC78FE3, 0xC78F1F, 0xC78FFF,
- 0xC77F00, 0xC77FE0, 0xC77F1C, 0xC77FFC, 0xC7FF03, 0xC7FFE3, 0xC7FF1F, 0xC7FFFF,
- 0x3F0000, 0x3F00E0, 0x3F001C, 0x3F00FC, 0x3F8003, 0x3F80E3, 0x3F801F, 0x3F80FF,
- 0x3F7000, 0x3F70E0, 0x3F701C, 0x3F70FC, 0x3FF003, 0x3FF0E3, 0x3FF01F, 0x3FF0FF,
- 0x3F0E00, 0x3F0EE0, 0x3F0E1C, 0x3F0EFC, 0x3F8E03, 0x3F8EE3, 0x3F8E1F, 0x3F8EFF,
- 0x3F7E00, 0x3F7EE0, 0x3F7E1C, 0x3F7EFC, 0x3FFE03, 0x3FFEE3, 0x3FFE1F, 0x3FFEFF,
- 0xFF0100, 0xFF01E0, 0xFF011C, 0xFF01FC, 0xFF8103, 0xFF81E3, 0xFF811F, 0xFF81FF,
- 0xFF7100, 0xFF71E0, 0xFF711C, 0xFF71FC, 0xFFF103, 0xFFF1E3, 0xFFF11F, 0xFFF1FF,
- 0xFF0F00, 0xFF0FE0, 0xFF0F1C, 0xFF0FFC, 0xFF8F03, 0xFF8FE3, 0xFF8F1F, 0xFF8FFF,
- 0xFF7F00, 0xFF7FE0, 0xFF7F1C, 0xFF7FFC, 0xFFFF03, 0xFFFFE3, 0xFFFF1F, 0xFFFFFF,
+unsigned int byte_reversed_expand3[256] = {
+ 0x000000, 0x0000E0, 0x00001C, 0x0000FC, 0x008003, 0x0080E3, 0x00801F,
+ 0x0080FF,
+ 0x007000, 0x0070E0, 0x00701C, 0x0070FC, 0x00F003, 0x00F0E3, 0x00F01F,
+ 0x00F0FF,
+ 0x000E00, 0x000EE0, 0x000E1C, 0x000EFC, 0x008E03, 0x008EE3, 0x008E1F,
+ 0x008EFF,
+ 0x007E00, 0x007EE0, 0x007E1C, 0x007EFC, 0x00FE03, 0x00FEE3, 0x00FE1F,
+ 0x00FEFF,
+ 0xC00100, 0xC001E0, 0xC0011C, 0xC001FC, 0xC08103, 0xC081E3, 0xC0811F,
+ 0xC081FF,
+ 0xC07100, 0xC071E0, 0xC0711C, 0xC071FC, 0xC0F103, 0xC0F1E3, 0xC0F11F,
+ 0xC0F1FF,
+ 0xC00F00, 0xC00FE0, 0xC00F1C, 0xC00FFC, 0xC08F03, 0xC08FE3, 0xC08F1F,
+ 0xC08FFF,
+ 0xC07F00, 0xC07FE0, 0xC07F1C, 0xC07FFC, 0xC0FF03, 0xC0FFE3, 0xC0FF1F,
+ 0xC0FFFF,
+ 0x380000, 0x3800E0, 0x38001C, 0x3800FC, 0x388003, 0x3880E3, 0x38801F,
+ 0x3880FF,
+ 0x387000, 0x3870E0, 0x38701C, 0x3870FC, 0x38F003, 0x38F0E3, 0x38F01F,
+ 0x38F0FF,
+ 0x380E00, 0x380EE0, 0x380E1C, 0x380EFC, 0x388E03, 0x388EE3, 0x388E1F,
+ 0x388EFF,
+ 0x387E00, 0x387EE0, 0x387E1C, 0x387EFC, 0x38FE03, 0x38FEE3, 0x38FE1F,
+ 0x38FEFF,
+ 0xF80100, 0xF801E0, 0xF8011C, 0xF801FC, 0xF88103, 0xF881E3, 0xF8811F,
+ 0xF881FF,
+ 0xF87100, 0xF871E0, 0xF8711C, 0xF871FC, 0xF8F103, 0xF8F1E3, 0xF8F11F,
+ 0xF8F1FF,
+ 0xF80F00, 0xF80FE0, 0xF80F1C, 0xF80FFC, 0xF88F03, 0xF88FE3, 0xF88F1F,
+ 0xF88FFF,
+ 0xF87F00, 0xF87FE0, 0xF87F1C, 0xF87FFC, 0xF8FF03, 0xF8FFE3, 0xF8FF1F,
+ 0xF8FFFF,
+ 0x070000, 0x0700E0, 0x07001C, 0x0700FC, 0x078003, 0x0780E3, 0x07801F,
+ 0x0780FF,
+ 0x077000, 0x0770E0, 0x07701C, 0x0770FC, 0x07F003, 0x07F0E3, 0x07F01F,
+ 0x07F0FF,
+ 0x070E00, 0x070EE0, 0x070E1C, 0x070EFC, 0x078E03, 0x078EE3, 0x078E1F,
+ 0x078EFF,
+ 0x077E00, 0x077EE0, 0x077E1C, 0x077EFC, 0x07FE03, 0x07FEE3, 0x07FE1F,
+ 0x07FEFF,
+ 0xC70100, 0xC701E0, 0xC7011C, 0xC701FC, 0xC78103, 0xC781E3, 0xC7811F,
+ 0xC781FF,
+ 0xC77100, 0xC771E0, 0xC7711C, 0xC771FC, 0xC7F103, 0xC7F1E3, 0xC7F11F,
+ 0xC7F1FF,
+ 0xC70F00, 0xC70FE0, 0xC70F1C, 0xC70FFC, 0xC78F03, 0xC78FE3, 0xC78F1F,
+ 0xC78FFF,
+ 0xC77F00, 0xC77FE0, 0xC77F1C, 0xC77FFC, 0xC7FF03, 0xC7FFE3, 0xC7FF1F,
+ 0xC7FFFF,
+ 0x3F0000, 0x3F00E0, 0x3F001C, 0x3F00FC, 0x3F8003, 0x3F80E3, 0x3F801F,
+ 0x3F80FF,
+ 0x3F7000, 0x3F70E0, 0x3F701C, 0x3F70FC, 0x3FF003, 0x3FF0E3, 0x3FF01F,
+ 0x3FF0FF,
+ 0x3F0E00, 0x3F0EE0, 0x3F0E1C, 0x3F0EFC, 0x3F8E03, 0x3F8EE3, 0x3F8E1F,
+ 0x3F8EFF,
+ 0x3F7E00, 0x3F7EE0, 0x3F7E1C, 0x3F7EFC, 0x3FFE03, 0x3FFEE3, 0x3FFE1F,
+ 0x3FFEFF,
+ 0xFF0100, 0xFF01E0, 0xFF011C, 0xFF01FC, 0xFF8103, 0xFF81E3, 0xFF811F,
+ 0xFF81FF,
+ 0xFF7100, 0xFF71E0, 0xFF711C, 0xFF71FC, 0xFFF103, 0xFFF1E3, 0xFFF11F,
+ 0xFFF1FF,
+ 0xFF0F00, 0xFF0FE0, 0xFF0F1C, 0xFF0FFC, 0xFF8F03, 0xFF8FE3, 0xFF8F1F,
+ 0xFF8FFF,
+ 0xFF7F00, 0xFF7FE0, 0xFF7F1C, 0xFF7FFC, 0xFFFF03, 0xFFFFE3, 0xFFFF1F,
+ 0xFFFFFF,
};
diff --git a/xorg-server/hw/xfree86/xaa/xaaWideLine.c b/xorg-server/hw/xfree86/xaa/xaaWideLine.c
index f73e04f17..b8a53c1c8 100644
--- a/xorg-server/hw/xfree86/xaa/xaaWideLine.c
+++ b/xorg-server/hw/xfree86/xaa/xaaWideLine.c
@@ -1,921 +1,924 @@
-/*
-
-XAAPolylinesWideSolid does not maintain a span list and subsequently does
-not follow the "touch-each-pixel-once" rules for wide lines and arcs.
-This means it can only be used in the case where we have
-miSpansEasyRop(pGC->alu). Since we clip spans on the fly, we
-limited usage of this function to one rect situations. This
-function is used only for solid lines.
-
- Adapted from miWideLine by Mark Vojkovich (mvojkovi@ucsd.edu)
-Original mi code written by Keith Packard.
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <math.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "windowstr.h"
-#include "gcstruct.h"
-#include "regionstr.h"
-#include "miwideline.h"
-#include "mi.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-
-#define DRAW_POINT(pScrn, x, y) \
- if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, 1); \
- else XAAPointHelper(pScrn, x, y)
-
-#define FILL_RECT(pScrn, x, y, w, h) \
- if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); \
- else XAAFillRectHelper(pScrn, x, y, w, h)
-
-#define FILL_SPAN(pScrn, x, y, w) \
- if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, 1); \
- else XAASpanHelper(pScrn, x, y, w)
-
-
-#define CLIPSTEPEDGE(edgey,edge,edgeleft) \
- if (ybase == edgey) { \
- if (edgeleft) { \
- if (edge->x > xcl) \
- xcl = edge->x; \
- } else { \
- if (edge->x < xcr) \
- xcr = edge->x; \
- } \
- edgey++; \
- edge->x += edge->stepx; \
- edge->e += edge->dx; \
- if (edge->e > 0) { \
- edge->x += edge->signdx; \
- edge->e -= edge->dy; \
- } \
- }
-
-static void
-XAAPointHelper(ScrnInfoPtr pScrn, int x, int y)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- BoxPtr extents = infoRec->ClipBox;
-
- if((x >= extents->x1) && (x < extents->x2) &&
- (y >= extents->y1) && (y < extents->y2))
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, 1);
-}
-
-static void
-XAAFillRectHelper(ScrnInfoPtr pScrn, int x1, int y1, int dx, int dy)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- BoxPtr extents = infoRec->ClipBox;
- int x2 = x1 + dx;
- int y2 = y1 + dy;
-
- if(x1 < extents->x1) x1 = extents->x1;
- if(x2 >= extents->x2) x2 = extents->x2;
- if((dx = x2 - x1)<1) return;
- if(y1 < extents->y1) y1 = extents->y1;
- if(y2 >= extents->y2) y2 = extents->y2;
- if((dy = y2 - y1)<1) return;
-
- (*infoRec->SubsequentSolidFillRect)(pScrn, x1, y1, dx, dy);
-}
-
-
-static void
-XAASpanHelper(ScrnInfoPtr pScrn, int x1, int y, int width)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- BoxPtr extents = infoRec->ClipBox;
- int x2;
-
- if((y < extents->y1) || (y >= extents->y2)) return;
-
- x2 = x1 + width;
- if(x1 < extents->x1) x1 = extents->x1;
- if(x2 > extents->x2) x2 = extents->x2;
- width = x2 - x1;
-
- if(width > 0)
- (*infoRec->SubsequentSolidFillRect)(pScrn, x1, y, width, 1);
-
-}
-
-#define FixError(x, dx, dy, e, sign, step, h) { \
- e += (h) * dx; \
- x += (h) * step; \
- if(e > 0) { \
- x += e * sign/dy; \
- e %= dy; \
- if(e) { \
- x += sign; \
- e -= dy; \
- } \
- } \
-}
-
-
-static void
-XAAFillPolyHelper (
- GCPtr pGC,
- int y, /* start y coordinate */
- int overall_height, /* height of entire segment */
- PolyEdgePtr left, PolyEdgePtr right,
- int left_count, int right_count )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- BoxPtr extents = infoRec->ClipBox;
- int left_x, left_e, left_stepx, left_signdx, left_dy, left_dx;
- int right_x, right_e, right_stepx, right_signdx, right_dy, right_dx;
- int height, left_height, right_height;
- int xorg;
- Bool hardClip;
-
- if((y >= extents->y2) || ((y + overall_height) <= extents->y1))
- return;
-
- /* Muffle compiler */
- left_x = left_e = left_stepx = left_signdx = left_dy = left_dx = 0;
- right_x = right_e = right_stepx = right_signdx = right_dy = right_dx = 0;
-
- left_height = right_height = 0;
- xorg = 0;
-
- hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
-
- while ((left_count || left_height) && (right_count || right_height)) {
- if (!left_height && left_count) {
- left_height = left->height;
- left_x = left->x + xorg;
- left_stepx = left->stepx;
- left_signdx = left->signdx;
- left_e = left->e;
- left_dy = left->dy;
- left_dx = left->dx;
- left_count--;
- left++;
- }
- if (!right_height && right_count) {
- right_height = right->height;
- right_x = right->x + xorg + 1;
- right_stepx = right->stepx;
- right_signdx = right->signdx;
- right_e = right->e;
- right_dy = right->dy;
- right_dx = right->dx;
- right_count--;
- right++;
- }
-
- height = (left_height > right_height) ? right_height : left_height;
-
- left_height -= height;
- right_height -= height;
-
- if(hardClip && infoRec->SubsequentSolidFillTrap && (height > 6)) {
- int right_DX, left_DX;
-
- right_DX = (right_dx * right_signdx) + (right_stepx * right_dy);
- left_DX = (left_dx * left_signdx) + (left_stepx * left_dy);
-
- (*infoRec->SubsequentSolidFillTrap)(infoRec->pScrn, y, height,
- left_x, left_DX, left_dy, left_e,
- right_x - 1, right_DX, right_dy, right_e);
-
- FixError(left_x, left_dx, left_dy, left_e, left_signdx,
- left_stepx, height);
- FixError(right_x, right_dx, right_dy, right_e, right_signdx,
- right_stepx, height);
- y += height;
- continue;
- }
-
- while (height--) {
- if(right_x > left_x) {
- FILL_SPAN(infoRec->pScrn, left_x, y, right_x - left_x);
- }
- y++;
-
- left_x += left_stepx;
- left_e += left_dx;
- if (left_e > 0) {
- left_x += left_signdx;
- left_e -= left_dy;
- }
- right_x += right_stepx;
- right_e += right_dx;
- if (right_e > 0) {
- right_x += right_signdx;
- right_e -= right_dy;
- }
-
- }
- }
-}
-
-
-
-static void
-XAAWideSegment (
- GCPtr pGC,
- int x1, int y1, int x2, int y2,
- Bool projectLeft, Bool projectRight,
- LineFacePtr leftFace, LineFacePtr rightFace )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- double l, L, r;
- double xa, ya;
- double projectXoff, projectYoff;
- double k;
- double maxy;
- int x, y;
- int dx, dy;
- int finaly;
- PolyEdgePtr left, right;
- PolyEdgePtr top, bottom;
- int lefty, righty, topy, bottomy;
- int signdx;
- PolyEdgeRec lefts[2], rights[2];
- LineFacePtr tface;
- int lw = pGC->lineWidth;
- Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
-
- /* draw top-to-bottom always */
- if ((y2 < y1) || ((y2 == y1) && (x2 < x1))) {
- x = x1;
- x1 = x2;
- x2 = x;
-
- y = y1;
- y1 = y2;
- y2 = y;
-
- x = projectLeft;
- projectLeft = projectRight;
- projectRight = x;
-
- tface = leftFace;
- leftFace = rightFace;
- rightFace = tface;
- }
-
- dy = y2 - y1;
- signdx = 1;
- dx = x2 - x1;
- if (dx < 0)
- signdx = -1;
-
- leftFace->x = x1;
- leftFace->y = y1;
- leftFace->dx = dx;
- leftFace->dy = dy;
-
- rightFace->x = x2;
- rightFace->y = y2;
- rightFace->dx = -dx;
- rightFace->dy = -dy;
-
- if (!dy) {
- rightFace->xa = 0;
- rightFace->ya = (double) lw / 2.0;
- rightFace->k = -(double) (lw * dx) / 2.0;
- leftFace->xa = 0;
- leftFace->ya = -rightFace->ya;
- leftFace->k = rightFace->k;
- x = x1;
- if (projectLeft)
- x -= (lw >> 1);
- y = y1 - (lw >> 1);
- dx = x2 - x;
- if (projectRight)
- dx += ((lw + 1) >> 1);
- dy = lw;
- FILL_RECT(infoRec->pScrn, x, y, dx, dy);
- } else if (!dx) {
- leftFace->xa = (double) lw / 2.0;
- leftFace->ya = 0;
- leftFace->k = (double) (lw * dy) / 2.0;
- rightFace->xa = -leftFace->xa;
- rightFace->ya = 0;
- rightFace->k = leftFace->k;
- y = y1;
- if (projectLeft)
- y -= lw >> 1;
- x = x1 - (lw >> 1);
- dy = y2 - y;
- if (projectRight)
- dy += ((lw + 1) >> 1);
- dx = lw;
- FILL_RECT(infoRec->pScrn, x, y, dx, dy);
- } else {
- l = ((double) lw) / 2.0;
- L = sqrt((double)(dx*dx + dy*dy));
-
- if (dx < 0) {
- right = &rights[1];
- left = &lefts[0];
- top = &rights[0];
- bottom = &lefts[1];
- } else {
- right = &rights[0];
- left = &lefts[1];
- top = &lefts[0];
- bottom = &rights[1];
- }
- r = l / L;
-
- /* coord of upper bound at integral y */
- ya = -r * dx;
- xa = r * dy;
-
- projectXoff = -ya;
- projectYoff = xa;
-
- /* xa * dy - ya * dx */
- k = l * L;
-
- leftFace->xa = xa;
- leftFace->ya = ya;
- leftFace->k = k;
- rightFace->xa = -xa;
- rightFace->ya = -ya;
- rightFace->k = k;
-
- if (projectLeft)
- righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
- k, dx, dy, x1, y1, 0, right);
- else
- righty = miPolyBuildEdge (xa, ya,
- k, dx, dy, x1, y1, 0, right);
-
- /* coord of lower bound at integral y */
- ya = -ya;
- xa = -xa;
-
- /* xa * dy - ya * dx */
- k = - k;
-
- if (projectLeft)
- lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
- k, dx, dy, x1, y1, 1, left);
- else
- lefty = miPolyBuildEdge (xa, ya,
- k, dx, dy, x1, y1, 1, left);
-
- /* coord of top face at integral y */
-
- if (signdx > 0) {
- ya = -ya;
- xa = -xa;
- }
-
- if (projectLeft) {
- double xap = xa - projectXoff;
- double yap = ya - projectYoff;
- topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
- -dy, dx, x1, y1, dx > 0, top);
- }
- else
- topy = miPolyBuildEdge(xa, ya, 0.0,
- -dy, dx, x1, y1, dx > 0, top);
-
- /* coord of bottom face at integral y */
-
- if (projectRight) {
- double xap = xa + projectXoff;
- double yap = ya + projectYoff;
- bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
- -dy, dx, x2, y2, dx < 0, bottom);
- maxy = -ya + projectYoff;
- } else {
- bottomy = miPolyBuildEdge (xa, ya, 0.0,
- -dy, dx, x2, y2, dx < 0, bottom);
- maxy = -ya;
- }
-
- finaly = ICEIL (maxy) + y2;
-
- if (dx < 0) {
- left->height = bottomy - lefty;
- right->height = finaly - righty;
- top->height = righty - topy;
- } else {
- right->height = bottomy - righty;
- left->height = finaly - lefty;
- top->height = lefty - topy;
- }
- bottom->height = finaly - bottomy;
- XAAFillPolyHelper (pGC, topy,
- bottom->height + bottomy - topy, lefts, rights, 2, 2);
- }
-}
-
-
-static void
-XAALineArcI (GCPtr pGC, int xorg, int yorg)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int x, y, e, ex;
- int slw = pGC->lineWidth;
- Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
-
- y = (slw >> 1) + 1;
- if (slw & 1)
- e = - ((y << 2) + 3);
- else
- e = - (y << 3);
- ex = -4;
- x = 0;
- while (y) {
- e += (y << 3) - 4;
- while (e >= 0) {
- x++;
- e += (ex = -((x << 3) + 4));
- }
- y--;
- slw = (x << 1) + 1;
- if ((e == ex) && (slw > 1))
- slw--;
-
- FILL_SPAN(infoRec->pScrn, xorg - x, yorg - y, slw);
-
- if ((y != 0) && ((slw > 1) || (e != ex))) {
- FILL_SPAN(infoRec->pScrn, xorg - x, yorg + y, slw);
- }
- }
-}
-
-
-static void
-XAALineArcD (
- GCPtr pGC,
- double xorg,
- double yorg,
- PolyEdgePtr edge1,
- int edgey1,
- Bool edgeleft1,
- PolyEdgePtr edge2,
- int edgey2,
- Bool edgeleft2 )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- double radius, x0, y0, el, er, yk, xlk, xrk, k;
- int xbase, ybase, y, boty, xl, xr, xcl, xcr;
- int ymin, ymax;
- Bool edge1IsMin, edge2IsMin;
- int ymin1, ymin2;
- Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
-
-
- xbase = floor(xorg);
- x0 = xorg - xbase;
- ybase = ICEIL (yorg);
- y0 = yorg - ybase;
-
- xlk = x0 + x0 + 1.0;
- xrk = x0 + x0 - 1.0;
- yk = y0 + y0 - 1.0;
- radius = ((double)pGC->lineWidth) / 2.0;
- y = floor(radius - y0 + 1.0);
- ybase -= y;
- ymin = ybase;
- ymax = 65536;
- edge1IsMin = FALSE;
- ymin1 = edgey1;
- if (edge1->dy >= 0) {
- if (!edge1->dy) {
- if (edgeleft1)
- edge1IsMin = TRUE;
- else
- ymax = edgey1;
- edgey1 = 65536;
- } else if ((edge1->signdx < 0) == edgeleft1)
- edge1IsMin = TRUE;
- }
- edge2IsMin = FALSE;
- ymin2 = edgey2;
- if (edge2->dy >= 0) {
- if (!edge2->dy) {
- if (edgeleft2)
- edge2IsMin = TRUE;
- else
- ymax = edgey2;
- edgey2 = 65536;
- } else if ((edge2->signdx < 0) == edgeleft2)
- edge2IsMin = TRUE;
- }
- if (edge1IsMin) {
- ymin = ymin1;
- if (edge2IsMin && (ymin1 > ymin2))
- ymin = ymin2;
- } else if (edge2IsMin)
- ymin = ymin2;
- el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0);
- er = el + xrk;
- xl = 1;
- xr = 0;
- if (x0 < 0.5) {
- xl = 0;
- el -= xlk;
- }
- boty = (y0 < -0.5) ? 1 : 0;
- if (ybase + y - boty > ymax)
- boty = ymax - ybase - y;
- while (y > boty) {
- k = (y << 1) + yk;
- er += k;
- while (er > 0.0) {
- xr++;
- er += xrk - (xr << 1);
- }
- el += k;
- while (el >= 0.0) {
- xl--;
- el += (xl << 1) - xlk;
- }
- y--;
- ybase++;
- if (ybase < ymin)
- continue;
- xcl = xl + xbase;
- xcr = xr + xbase;
- CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
- CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
- if(xcr >= xcl) {
- FILL_SPAN(infoRec->pScrn, xcl, ybase, xcr - xcl + 1);
- }
- }
- er = xrk - (xr << 1) - er;
- el = (xl << 1) - xlk - el;
- boty = floor(-y0 - radius + 1.0);
- if (ybase + y - boty > ymax)
- boty = ymax - ybase - y;
- while (y > boty) {
- k = (y << 1) + yk;
- er -= k;
- while ((er >= 0.0) && (xr >= 0)) {
- xr--;
- er += xrk - (xr << 1);
- }
- el -= k;
- while ((el > 0.0) && (xl <= 0)) {
- xl++;
- el += (xl << 1) - xlk;
- }
- y--;
- ybase++;
- if (ybase < ymin)
- continue;
- xcl = xl + xbase;
- xcr = xr + xbase;
- CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
- CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
- if(xcr >= xcl) {
- FILL_SPAN(infoRec->pScrn, xcl, ybase, xcr - xcl + 1);
- }
- }
-}
-
-
-static void
-XAALineArc (
- GCPtr pGC,
- LineFacePtr leftFace,
- LineFacePtr rightFace,
- double xorg,
- double yorg,
- Bool isInt )
-{
- int xorgi, yorgi;
- PolyEdgeRec edge1, edge2;
- int edgey1, edgey2;
- Bool edgeleft1, edgeleft2;
-
- if (isInt) {
- xorgi = leftFace ? leftFace->x : rightFace->x;
- yorgi = leftFace ? leftFace->y : rightFace->y;
- } else { /* Muffle compiler */
- xorgi = yorgi = 0;
- }
- edgey1 = 65536;
- edgey2 = 65536;
- edge1.x = 0; /* not used, keep memory checkers happy */
- edge1.dy = -1;
- edge2.x = 0; /* not used, keep memory checkers happy */
- edge2.dy = -1;
- edgeleft1 = FALSE;
- edgeleft2 = FALSE;
-
- if ((pGC->lineWidth > 2) &&
- ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) ||
- (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) {
- if (isInt) {
- xorg = (double) xorgi;
- yorg = (double) yorgi;
- }
-
- if (leftFace && rightFace)
- miRoundJoinClip (leftFace, rightFace, &edge1, &edge2,
- &edgey1, &edgey2, &edgeleft1, &edgeleft2);
- else if (leftFace)
- edgey1 = miRoundCapClip (leftFace, isInt, &edge1, &edgeleft1);
- else if (rightFace)
- edgey2 = miRoundCapClip (rightFace, isInt, &edge2, &edgeleft2);
-
- isInt = FALSE;
- }
-
- if (isInt) {
- if(pGC->lineWidth == 1) {
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
- DRAW_POINT(infoRec->pScrn, xorgi, yorgi);
- } else
- XAALineArcI(pGC, xorgi, yorgi);
- } else
- XAALineArcD(pGC, xorg, yorg, &edge1, edgey1, edgeleft1,
- &edge2, edgey2, edgeleft2);
-
-}
-
-
-static void
-XAALineJoin (
- GCPtr pGC,
- LineFacePtr pLeft,
- LineFacePtr pRight )
-{
- double mx = 0, my = 0;
- double denom = 0;
- PolyVertexRec vertices[4];
- PolySlopeRec slopes[4];
- int edgecount;
- PolyEdgeRec left[4], right[4];
- int nleft, nright;
- int y, height;
- int swapslopes;
- int joinStyle = pGC->joinStyle;
- int lw = pGC->lineWidth;
-
- if (lw == 1) {
- /* Lines going in the same direction have no join */
- if ((pLeft->dx >= 0) == (pRight->dx <= 0))
- return;
- if (joinStyle != JoinRound) {
- denom = - pLeft->dx * (double)pRight->dy + pRight->dx *
- (double)pLeft->dy;
- if (denom == 0.0)
- return; /* no join to draw */
- }
- if (joinStyle != JoinMiter) {
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
- DRAW_POINT(infoRec->pScrn, pLeft->x, pLeft->y);
- return;
- }
- } else {
- if (joinStyle == JoinRound) {
- XAALineArc(pGC, pLeft, pRight,(double)0.0, (double)0.0, TRUE);
- return;
- }
- denom = - pLeft->dx * (double)pRight->dy + pRight->dx *
- (double)pLeft->dy;
- if (denom == 0.0)
- return; /* no join to draw */
- }
-
- swapslopes = 0;
- if (denom > 0) {
- pLeft->xa = -pLeft->xa;
- pLeft->ya = -pLeft->ya;
- pLeft->dx = -pLeft->dx;
- pLeft->dy = -pLeft->dy;
- } else {
- swapslopes = 1;
- pRight->xa = -pRight->xa;
- pRight->ya = -pRight->ya;
- pRight->dx = -pRight->dx;
- pRight->dy = -pRight->dy;
- }
-
- vertices[0].x = pRight->xa;
- vertices[0].y = pRight->ya;
- slopes[0].dx = -pRight->dy;
- slopes[0].dy = pRight->dx;
- slopes[0].k = 0;
-
- vertices[1].x = 0;
- vertices[1].y = 0;
- slopes[1].dx = pLeft->dy;
- slopes[1].dy = -pLeft->dx;
- slopes[1].k = 0;
-
- vertices[2].x = pLeft->xa;
- vertices[2].y = pLeft->ya;
-
- if (joinStyle == JoinMiter) {
- my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) -
- pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx ))/
- denom;
- if (pLeft->dy != 0)
- mx = pLeft->xa + (my - pLeft->ya) *
- (double) pLeft->dx / (double) pLeft->dy;
- else
- mx = pRight->xa + (my - pRight->ya) *
- (double) pRight->dx / (double) pRight->dy;
-
- /* check miter limit */
- if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw)
- joinStyle = JoinBevel;
- }
-
- if (joinStyle == JoinMiter) {
- slopes[2].dx = pLeft->dx;
- slopes[2].dy = pLeft->dy;
- slopes[2].k = pLeft->k;
- if (swapslopes) {
- slopes[2].dx = -slopes[2].dx;
- slopes[2].dy = -slopes[2].dy;
- slopes[2].k = -slopes[2].k;
- }
- vertices[3].x = mx;
- vertices[3].y = my;
- slopes[3].dx = pRight->dx;
- slopes[3].dy = pRight->dy;
- slopes[3].k = pRight->k;
- if (swapslopes) {
- slopes[3].dx = -slopes[3].dx;
- slopes[3].dy = -slopes[3].dy;
- slopes[3].k = -slopes[3].k;
- }
- edgecount = 4;
- } else {
- double scale, dx, dy, adx, ady;
-
- adx = dx = pRight->xa - pLeft->xa;
- ady = dy = pRight->ya - pLeft->ya;
- if (adx < 0)
- adx = -adx;
- if (ady < 0)
- ady = -ady;
- scale = ady;
- if (adx > ady)
- scale = adx;
- slopes[2].dx = (dx * 65536) / scale;
- slopes[2].dy = (dy * 65536) / scale;
- slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy -
- (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0;
- edgecount = 3;
- }
-
- y = miPolyBuildPoly (vertices, slopes, edgecount, pLeft->x, pLeft->y,
- left, right, &nleft, &nright, &height);
- XAAFillPolyHelper(pGC, y, height, left, right, nleft, nright);
-}
-
-
-void
-XAAPolylinesWideSolid (
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int x1, y1, x2, y2;
- Bool projectLeft, projectRight;
- LineFaceRec leftFace, rightFace, prevRightFace, firstFace;
- int first = TRUE;
- Bool somethingDrawn = FALSE;
- Bool selfJoin = FALSE;
- int xorg = pDrawable->x;
- int yorg = pDrawable->y;
- Bool hardClip = FALSE;
-
- if(!RegionNumRects(pGC->pCompositeClip))
- return;
-
- if(RegionNumRects(pGC->pCompositeClip) != 1) {
- miWideLine(pDrawable, pGC, mode, npt, pPts);
- return;
- }
-
- x2 = pPts->x;
- y2 = pPts->y;
- if (npt > 1) {
- if (mode == CoordModePrevious) {
- int nptTmp;
- register DDXPointPtr pPtsTmp;
-
- x1 = x2;
- y1 = y2;
- nptTmp = npt;
- pPtsTmp = pPts + 1;
- while (--nptTmp) {
- x1 += pPtsTmp->x;
- y1 += pPtsTmp->y;
- ++pPtsTmp;
- }
- if ((x2 == x1) && (y2 == y1))
- selfJoin = TRUE;
- } else if ((x2 == pPts[npt-1].x) && (y2 == pPts[npt-1].y))
- selfJoin = TRUE;
- }
-
- projectLeft = ((pGC->capStyle == CapProjecting) && !selfJoin);
- projectRight = FALSE;
-
- (*infoRec->SetupForSolidFill)(infoRec->pScrn, pGC->fgPixel, pGC->alu,
- pGC->planemask);
-
- infoRec->ClipBox = &pGC->pCompositeClip->extents;
-
- if(infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL) {
- hardClip = TRUE;
- (*infoRec->SetClippingRectangle)(infoRec->pScrn,
- infoRec->ClipBox->x1, infoRec->ClipBox->y1,
- infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
- }
-
- x2 += xorg;
- y2 += yorg;
- while (--npt) {
- x1 = x2;
- y1 = y2;
- ++pPts;
- x2 = pPts->x;
- y2 = pPts->y;
- if (mode == CoordModePrevious) {
- x2 += x1;
- y2 += y1;
- } else {
- x2 += xorg;
- y2 += yorg;
- }
- if ((x1 != x2) || (y1 != y2)) {
- somethingDrawn = TRUE;
- if ((npt == 1) && (pGC->capStyle == CapProjecting) && !selfJoin)
- projectRight = TRUE;
- XAAWideSegment(pGC, x1, y1, x2, y2,
- projectLeft, projectRight, &leftFace, &rightFace);
- if (first) {
- if (selfJoin)
- firstFace = leftFace;
- else if (pGC->capStyle == CapRound) {
- if (pGC->lineWidth == 1) {
- DRAW_POINT(infoRec->pScrn, x1, y1);
- } else
- XAALineArc(pGC,&leftFace, (LineFacePtr) NULL,
- (double)0.0, (double)0.0,TRUE);
- }
- } else
- XAALineJoin (pGC, &leftFace, &prevRightFace);
-
- prevRightFace = rightFace;
- first = FALSE;
- projectLeft = FALSE;
- }
- if (npt == 1 && somethingDrawn) {
- if (selfJoin)
- XAALineJoin (pGC, &firstFace, &rightFace);
- else if (pGC->capStyle == CapRound) {
- if (pGC->lineWidth == 1) {
- DRAW_POINT(infoRec->pScrn, x2, y2);
- } else
- XAALineArc (pGC, (LineFacePtr) NULL, &rightFace,
- (double)0.0, (double)0.0,TRUE);
- }
- }
- }
- /* handle crock where all points are coincedent */
- if (!somethingDrawn) {
- projectLeft = (pGC->capStyle == CapProjecting);
- XAAWideSegment (pGC, x2, y2, x2, y2, projectLeft, projectLeft,
- &leftFace, &rightFace);
- if (pGC->capStyle == CapRound) {
- XAALineArc (pGC, &leftFace, (LineFacePtr) NULL,
- (double)0.0, (double)0.0, TRUE);
- rightFace.dx = -1; /* sleezy hack to make it work */
- XAALineArc (pGC, (LineFacePtr) NULL, &rightFace,
- (double)0.0, (double)0.0, TRUE);
- }
- }
-
- infoRec->ClipBox = NULL;
- if(hardClip)
- (*infoRec->DisableClipping)(infoRec->pScrn);
-
- SET_SYNC_FLAG(infoRec);
-}
+/*
+
+XAAPolylinesWideSolid does not maintain a span list and subsequently does
+not follow the "touch-each-pixel-once" rules for wide lines and arcs.
+This means it can only be used in the case where we have
+miSpansEasyRop(pGC->alu). Since we clip spans on the fly, we
+limited usage of this function to one rect situations. This
+function is used only for solid lines.
+
+ Adapted from miWideLine by Mark Vojkovich (mvojkovi@ucsd.edu)
+Original mi code written by Keith Packard.
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <math.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "regionstr.h"
+#include "miwideline.h"
+#include "mi.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+#define DRAW_POINT(pScrn, x, y) \
+ if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, 1); \
+ else XAAPointHelper(pScrn, x, y)
+
+#define FILL_RECT(pScrn, x, y, w, h) \
+ if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); \
+ else XAAFillRectHelper(pScrn, x, y, w, h)
+
+#define FILL_SPAN(pScrn, x, y, w) \
+ if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, 1); \
+ else XAASpanHelper(pScrn, x, y, w)
+
+#define CLIPSTEPEDGE(edgey,edge,edgeleft) \
+ if (ybase == edgey) { \
+ if (edgeleft) { \
+ if (edge->x > xcl) \
+ xcl = edge->x; \
+ } else { \
+ if (edge->x < xcr) \
+ xcr = edge->x; \
+ } \
+ edgey++; \
+ edge->x += edge->stepx; \
+ edge->e += edge->dx; \
+ if (edge->e > 0) { \
+ edge->x += edge->signdx; \
+ edge->e -= edge->dy; \
+ } \
+ }
+
+static void
+XAAPointHelper(ScrnInfoPtr pScrn, int x, int y)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ BoxPtr extents = infoRec->ClipBox;
+
+ if ((x >= extents->x1) && (x < extents->x2) &&
+ (y >= extents->y1) && (y < extents->y2))
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, 1, 1);
+}
+
+static void
+XAAFillRectHelper(ScrnInfoPtr pScrn, int x1, int y1, int dx, int dy)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ BoxPtr extents = infoRec->ClipBox;
+ int x2 = x1 + dx;
+ int y2 = y1 + dy;
+
+ if (x1 < extents->x1)
+ x1 = extents->x1;
+ if (x2 >= extents->x2)
+ x2 = extents->x2;
+ if ((dx = x2 - x1) < 1)
+ return;
+ if (y1 < extents->y1)
+ y1 = extents->y1;
+ if (y2 >= extents->y2)
+ y2 = extents->y2;
+ if ((dy = y2 - y1) < 1)
+ return;
+
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x1, y1, dx, dy);
+}
+
+static void
+XAASpanHelper(ScrnInfoPtr pScrn, int x1, int y, int width)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ BoxPtr extents = infoRec->ClipBox;
+ int x2;
+
+ if ((y < extents->y1) || (y >= extents->y2))
+ return;
+
+ x2 = x1 + width;
+ if (x1 < extents->x1)
+ x1 = extents->x1;
+ if (x2 > extents->x2)
+ x2 = extents->x2;
+ width = x2 - x1;
+
+ if (width > 0)
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x1, y, width, 1);
+
+}
+
+#define FixError(x, dx, dy, e, sign, step, h) { \
+ e += (h) * dx; \
+ x += (h) * step; \
+ if(e > 0) { \
+ x += e * sign/dy; \
+ e %= dy; \
+ if(e) { \
+ x += sign; \
+ e -= dy; \
+ } \
+ } \
+}
+
+static void
+XAAFillPolyHelper(GCPtr pGC, int y, /* start y coordinate */
+ int overall_height, /* height of entire segment */
+ PolyEdgePtr left, PolyEdgePtr right,
+ int left_count, int right_count)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ BoxPtr extents = infoRec->ClipBox;
+ int left_x, left_e, left_stepx, left_signdx, left_dy, left_dx;
+ int right_x, right_e, right_stepx, right_signdx, right_dy, right_dx;
+ int height, left_height, right_height;
+ int xorg;
+ Bool hardClip;
+
+ if ((y >= extents->y2) || ((y + overall_height) <= extents->y1))
+ return;
+
+ /* Muffle compiler */
+ left_x = left_e = left_stepx = left_signdx = left_dy = left_dx = 0;
+ right_x = right_e = right_stepx = right_signdx = right_dy = right_dx = 0;
+
+ left_height = right_height = 0;
+ xorg = 0;
+
+ hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+
+ while ((left_count || left_height) && (right_count || right_height)) {
+ if (!left_height && left_count) {
+ left_height = left->height;
+ left_x = left->x + xorg;
+ left_stepx = left->stepx;
+ left_signdx = left->signdx;
+ left_e = left->e;
+ left_dy = left->dy;
+ left_dx = left->dx;
+ left_count--;
+ left++;
+ }
+ if (!right_height && right_count) {
+ right_height = right->height;
+ right_x = right->x + xorg + 1;
+ right_stepx = right->stepx;
+ right_signdx = right->signdx;
+ right_e = right->e;
+ right_dy = right->dy;
+ right_dx = right->dx;
+ right_count--;
+ right++;
+ }
+
+ height = (left_height > right_height) ? right_height : left_height;
+
+ left_height -= height;
+ right_height -= height;
+
+ if (hardClip && infoRec->SubsequentSolidFillTrap && (height > 6)) {
+ int right_DX, left_DX;
+
+ right_DX = (right_dx * right_signdx) + (right_stepx * right_dy);
+ left_DX = (left_dx * left_signdx) + (left_stepx * left_dy);
+
+ (*infoRec->SubsequentSolidFillTrap) (infoRec->pScrn, y, height,
+ left_x, left_DX, left_dy,
+ left_e, right_x - 1, right_DX,
+ right_dy, right_e);
+
+ FixError(left_x, left_dx, left_dy, left_e, left_signdx,
+ left_stepx, height);
+ FixError(right_x, right_dx, right_dy, right_e, right_signdx,
+ right_stepx, height);
+ y += height;
+ continue;
+ }
+
+ while (height--) {
+ if (right_x > left_x) {
+ FILL_SPAN(infoRec->pScrn, left_x, y, right_x - left_x);
+ }
+ y++;
+
+ left_x += left_stepx;
+ left_e += left_dx;
+ if (left_e > 0) {
+ left_x += left_signdx;
+ left_e -= left_dy;
+ }
+ right_x += right_stepx;
+ right_e += right_dx;
+ if (right_e > 0) {
+ right_x += right_signdx;
+ right_e -= right_dy;
+ }
+
+ }
+ }
+}
+
+static void
+XAAWideSegment(GCPtr pGC,
+ int x1, int y1, int x2, int y2,
+ Bool projectLeft, Bool projectRight,
+ LineFacePtr leftFace, LineFacePtr rightFace)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ double l, L, r;
+ double xa, ya;
+ double projectXoff, projectYoff;
+ double k;
+ double maxy;
+ int x, y;
+ int dx, dy;
+ int finaly;
+ PolyEdgePtr left, right;
+ PolyEdgePtr top, bottom;
+ int lefty, righty, topy, bottomy;
+ int signdx;
+ PolyEdgeRec lefts[2], rights[2];
+ LineFacePtr tface;
+ int lw = pGC->lineWidth;
+ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+
+ /* draw top-to-bottom always */
+ if ((y2 < y1) || ((y2 == y1) && (x2 < x1))) {
+ x = x1;
+ x1 = x2;
+ x2 = x;
+
+ y = y1;
+ y1 = y2;
+ y2 = y;
+
+ x = projectLeft;
+ projectLeft = projectRight;
+ projectRight = x;
+
+ tface = leftFace;
+ leftFace = rightFace;
+ rightFace = tface;
+ }
+
+ dy = y2 - y1;
+ signdx = 1;
+ dx = x2 - x1;
+ if (dx < 0)
+ signdx = -1;
+
+ leftFace->x = x1;
+ leftFace->y = y1;
+ leftFace->dx = dx;
+ leftFace->dy = dy;
+
+ rightFace->x = x2;
+ rightFace->y = y2;
+ rightFace->dx = -dx;
+ rightFace->dy = -dy;
+
+ if (!dy) {
+ rightFace->xa = 0;
+ rightFace->ya = (double) lw / 2.0;
+ rightFace->k = -(double) (lw * dx) / 2.0;
+ leftFace->xa = 0;
+ leftFace->ya = -rightFace->ya;
+ leftFace->k = rightFace->k;
+ x = x1;
+ if (projectLeft)
+ x -= (lw >> 1);
+ y = y1 - (lw >> 1);
+ dx = x2 - x;
+ if (projectRight)
+ dx += ((lw + 1) >> 1);
+ dy = lw;
+ FILL_RECT(infoRec->pScrn, x, y, dx, dy);
+ }
+ else if (!dx) {
+ leftFace->xa = (double) lw / 2.0;
+ leftFace->ya = 0;
+ leftFace->k = (double) (lw * dy) / 2.0;
+ rightFace->xa = -leftFace->xa;
+ rightFace->ya = 0;
+ rightFace->k = leftFace->k;
+ y = y1;
+ if (projectLeft)
+ y -= lw >> 1;
+ x = x1 - (lw >> 1);
+ dy = y2 - y;
+ if (projectRight)
+ dy += ((lw + 1) >> 1);
+ dx = lw;
+ FILL_RECT(infoRec->pScrn, x, y, dx, dy);
+ }
+ else {
+ l = ((double) lw) / 2.0;
+ L = sqrt((double) (dx * dx + dy * dy));
+
+ if (dx < 0) {
+ right = &rights[1];
+ left = &lefts[0];
+ top = &rights[0];
+ bottom = &lefts[1];
+ }
+ else {
+ right = &rights[0];
+ left = &lefts[1];
+ top = &lefts[0];
+ bottom = &rights[1];
+ }
+ r = l / L;
+
+ /* coord of upper bound at integral y */
+ ya = -r * dx;
+ xa = r * dy;
+
+ projectXoff = -ya;
+ projectYoff = xa;
+
+ /* xa * dy - ya * dx */
+ k = l * L;
+
+ leftFace->xa = xa;
+ leftFace->ya = ya;
+ leftFace->k = k;
+ rightFace->xa = -xa;
+ rightFace->ya = -ya;
+ rightFace->k = k;
+
+ if (projectLeft)
+ righty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff,
+ k, dx, dy, x1, y1, 0, right);
+ else
+ righty = miPolyBuildEdge(xa, ya, k, dx, dy, x1, y1, 0, right);
+
+ /* coord of lower bound at integral y */
+ ya = -ya;
+ xa = -xa;
+
+ /* xa * dy - ya * dx */
+ k = -k;
+
+ if (projectLeft)
+ lefty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff,
+ k, dx, dy, x1, y1, 1, left);
+ else
+ lefty = miPolyBuildEdge(xa, ya, k, dx, dy, x1, y1, 1, left);
+
+ /* coord of top face at integral y */
+
+ if (signdx > 0) {
+ ya = -ya;
+ xa = -xa;
+ }
+
+ if (projectLeft) {
+ double xap = xa - projectXoff;
+ double yap = ya - projectYoff;
+
+ topy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy,
+ -dy, dx, x1, y1, dx > 0, top);
+ }
+ else
+ topy = miPolyBuildEdge(xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top);
+
+ /* coord of bottom face at integral y */
+
+ if (projectRight) {
+ double xap = xa + projectXoff;
+ double yap = ya + projectYoff;
+
+ bottomy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy,
+ -dy, dx, x2, y2, dx < 0, bottom);
+ maxy = -ya + projectYoff;
+ }
+ else {
+ bottomy = miPolyBuildEdge(xa, ya, 0.0,
+ -dy, dx, x2, y2, dx < 0, bottom);
+ maxy = -ya;
+ }
+
+ finaly = ICEIL(maxy) + y2;
+
+ if (dx < 0) {
+ left->height = bottomy - lefty;
+ right->height = finaly - righty;
+ top->height = righty - topy;
+ }
+ else {
+ right->height = bottomy - righty;
+ left->height = finaly - lefty;
+ top->height = lefty - topy;
+ }
+ bottom->height = finaly - bottomy;
+ XAAFillPolyHelper(pGC, topy,
+ bottom->height + bottomy - topy, lefts, rights, 2, 2);
+ }
+}
+
+static void
+XAALineArcI(GCPtr pGC, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int x, y, e, ex;
+ int slw = pGC->lineWidth;
+ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+
+ y = (slw >> 1) + 1;
+ if (slw & 1)
+ e = -((y << 2) + 3);
+ else
+ e = -(y << 3);
+ ex = -4;
+ x = 0;
+ while (y) {
+ e += (y << 3) - 4;
+ while (e >= 0) {
+ x++;
+ e += (ex = -((x << 3) + 4));
+ }
+ y--;
+ slw = (x << 1) + 1;
+ if ((e == ex) && (slw > 1))
+ slw--;
+
+ FILL_SPAN(infoRec->pScrn, xorg - x, yorg - y, slw);
+
+ if ((y != 0) && ((slw > 1) || (e != ex))) {
+ FILL_SPAN(infoRec->pScrn, xorg - x, yorg + y, slw);
+ }
+ }
+}
+
+static void
+XAALineArcD(GCPtr pGC,
+ double xorg,
+ double yorg,
+ PolyEdgePtr edge1,
+ int edgey1,
+ Bool edgeleft1, PolyEdgePtr edge2, int edgey2, Bool edgeleft2)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ double radius, x0, y0, el, er, yk, xlk, xrk, k;
+ int xbase, ybase, y, boty, xl, xr, xcl, xcr;
+ int ymin, ymax;
+ Bool edge1IsMin, edge2IsMin;
+ int ymin1, ymin2;
+ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+
+ xbase = floor(xorg);
+ x0 = xorg - xbase;
+ ybase = ICEIL(yorg);
+ y0 = yorg - ybase;
+
+ xlk = x0 + x0 + 1.0;
+ xrk = x0 + x0 - 1.0;
+ yk = y0 + y0 - 1.0;
+ radius = ((double) pGC->lineWidth) / 2.0;
+ y = floor(radius - y0 + 1.0);
+ ybase -= y;
+ ymin = ybase;
+ ymax = 65536;
+ edge1IsMin = FALSE;
+ ymin1 = edgey1;
+ if (edge1->dy >= 0) {
+ if (!edge1->dy) {
+ if (edgeleft1)
+ edge1IsMin = TRUE;
+ else
+ ymax = edgey1;
+ edgey1 = 65536;
+ }
+ else if ((edge1->signdx < 0) == edgeleft1)
+ edge1IsMin = TRUE;
+ }
+ edge2IsMin = FALSE;
+ ymin2 = edgey2;
+ if (edge2->dy >= 0) {
+ if (!edge2->dy) {
+ if (edgeleft2)
+ edge2IsMin = TRUE;
+ else
+ ymax = edgey2;
+ edgey2 = 65536;
+ }
+ else if ((edge2->signdx < 0) == edgeleft2)
+ edge2IsMin = TRUE;
+ }
+ if (edge1IsMin) {
+ ymin = ymin1;
+ if (edge2IsMin && (ymin1 > ymin2))
+ ymin = ymin2;
+ }
+ else if (edge2IsMin)
+ ymin = ymin2;
+ el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0);
+ er = el + xrk;
+ xl = 1;
+ xr = 0;
+ if (x0 < 0.5) {
+ xl = 0;
+ el -= xlk;
+ }
+ boty = (y0 < -0.5) ? 1 : 0;
+ if (ybase + y - boty > ymax)
+ boty = ymax - ybase - y;
+ while (y > boty) {
+ k = (y << 1) + yk;
+ er += k;
+ while (er > 0.0) {
+ xr++;
+ er += xrk - (xr << 1);
+ }
+ el += k;
+ while (el >= 0.0) {
+ xl--;
+ el += (xl << 1) - xlk;
+ }
+ y--;
+ ybase++;
+ if (ybase < ymin)
+ continue;
+ xcl = xl + xbase;
+ xcr = xr + xbase;
+ CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
+ CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
+ if (xcr >= xcl) {
+ FILL_SPAN(infoRec->pScrn, xcl, ybase, xcr - xcl + 1);
+ }
+ }
+ er = xrk - (xr << 1) - er;
+ el = (xl << 1) - xlk - el;
+ boty = floor(-y0 - radius + 1.0);
+ if (ybase + y - boty > ymax)
+ boty = ymax - ybase - y;
+ while (y > boty) {
+ k = (y << 1) + yk;
+ er -= k;
+ while ((er >= 0.0) && (xr >= 0)) {
+ xr--;
+ er += xrk - (xr << 1);
+ }
+ el -= k;
+ while ((el > 0.0) && (xl <= 0)) {
+ xl++;
+ el += (xl << 1) - xlk;
+ }
+ y--;
+ ybase++;
+ if (ybase < ymin)
+ continue;
+ xcl = xl + xbase;
+ xcr = xr + xbase;
+ CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
+ CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
+ if (xcr >= xcl) {
+ FILL_SPAN(infoRec->pScrn, xcl, ybase, xcr - xcl + 1);
+ }
+ }
+}
+
+static void
+XAALineArc(GCPtr pGC,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace, double xorg, double yorg, Bool isInt)
+{
+ int xorgi, yorgi;
+ PolyEdgeRec edge1, edge2;
+ int edgey1, edgey2;
+ Bool edgeleft1, edgeleft2;
+
+ if (isInt) {
+ xorgi = leftFace ? leftFace->x : rightFace->x;
+ yorgi = leftFace ? leftFace->y : rightFace->y;
+ }
+ else { /* Muffle compiler */
+ xorgi = yorgi = 0;
+ }
+ edgey1 = 65536;
+ edgey2 = 65536;
+ edge1.x = 0; /* not used, keep memory checkers happy */
+ edge1.dy = -1;
+ edge2.x = 0; /* not used, keep memory checkers happy */
+ edge2.dy = -1;
+ edgeleft1 = FALSE;
+ edgeleft2 = FALSE;
+
+ if ((pGC->lineWidth > 2) &&
+ ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) ||
+ (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) {
+ if (isInt) {
+ xorg = (double) xorgi;
+ yorg = (double) yorgi;
+ }
+
+ if (leftFace && rightFace)
+ miRoundJoinClip(leftFace, rightFace, &edge1, &edge2,
+ &edgey1, &edgey2, &edgeleft1, &edgeleft2);
+ else if (leftFace)
+ edgey1 = miRoundCapClip(leftFace, isInt, &edge1, &edgeleft1);
+ else if (rightFace)
+ edgey2 = miRoundCapClip(rightFace, isInt, &edge2, &edgeleft2);
+
+ isInt = FALSE;
+ }
+
+ if (isInt) {
+ if (pGC->lineWidth == 1) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+
+ DRAW_POINT(infoRec->pScrn, xorgi, yorgi);
+ }
+ else
+ XAALineArcI(pGC, xorgi, yorgi);
+ }
+ else
+ XAALineArcD(pGC, xorg, yorg, &edge1, edgey1, edgeleft1,
+ &edge2, edgey2, edgeleft2);
+
+}
+
+static void
+XAALineJoin(GCPtr pGC, LineFacePtr pLeft, LineFacePtr pRight)
+{
+ double mx = 0, my = 0;
+ double denom = 0;
+ PolyVertexRec vertices[4];
+ PolySlopeRec slopes[4];
+ int edgecount;
+ PolyEdgeRec left[4], right[4];
+ int nleft, nright;
+ int y, height;
+ int swapslopes;
+ int joinStyle = pGC->joinStyle;
+ int lw = pGC->lineWidth;
+
+ if (lw == 1) {
+ /* Lines going in the same direction have no join */
+ if ((pLeft->dx >= 0) == (pRight->dx <= 0))
+ return;
+ if (joinStyle != JoinRound) {
+ denom = -pLeft->dx * (double) pRight->dy + pRight->dx *
+ (double) pLeft->dy;
+ if (denom == 0.0)
+ return; /* no join to draw */
+ }
+ if (joinStyle != JoinMiter) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+
+ DRAW_POINT(infoRec->pScrn, pLeft->x, pLeft->y);
+ return;
+ }
+ }
+ else {
+ if (joinStyle == JoinRound) {
+ XAALineArc(pGC, pLeft, pRight, (double) 0.0, (double) 0.0, TRUE);
+ return;
+ }
+ denom = -pLeft->dx * (double) pRight->dy + pRight->dx *
+ (double) pLeft->dy;
+ if (denom == 0.0)
+ return; /* no join to draw */
+ }
+
+ swapslopes = 0;
+ if (denom > 0) {
+ pLeft->xa = -pLeft->xa;
+ pLeft->ya = -pLeft->ya;
+ pLeft->dx = -pLeft->dx;
+ pLeft->dy = -pLeft->dy;
+ }
+ else {
+ swapslopes = 1;
+ pRight->xa = -pRight->xa;
+ pRight->ya = -pRight->ya;
+ pRight->dx = -pRight->dx;
+ pRight->dy = -pRight->dy;
+ }
+
+ vertices[0].x = pRight->xa;
+ vertices[0].y = pRight->ya;
+ slopes[0].dx = -pRight->dy;
+ slopes[0].dy = pRight->dx;
+ slopes[0].k = 0;
+
+ vertices[1].x = 0;
+ vertices[1].y = 0;
+ slopes[1].dx = pLeft->dy;
+ slopes[1].dy = -pLeft->dx;
+ slopes[1].k = 0;
+
+ vertices[2].x = pLeft->xa;
+ vertices[2].y = pLeft->ya;
+
+ if (joinStyle == JoinMiter) {
+ my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) -
+ pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx)) /
+ denom;
+ if (pLeft->dy != 0)
+ mx = pLeft->xa + (my - pLeft->ya) *
+ (double) pLeft->dx / (double) pLeft->dy;
+ else
+ mx = pRight->xa + (my - pRight->ya) *
+ (double) pRight->dx / (double) pRight->dy;
+
+ /* check miter limit */
+ if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw)
+ joinStyle = JoinBevel;
+ }
+
+ if (joinStyle == JoinMiter) {
+ slopes[2].dx = pLeft->dx;
+ slopes[2].dy = pLeft->dy;
+ slopes[2].k = pLeft->k;
+ if (swapslopes) {
+ slopes[2].dx = -slopes[2].dx;
+ slopes[2].dy = -slopes[2].dy;
+ slopes[2].k = -slopes[2].k;
+ }
+ vertices[3].x = mx;
+ vertices[3].y = my;
+ slopes[3].dx = pRight->dx;
+ slopes[3].dy = pRight->dy;
+ slopes[3].k = pRight->k;
+ if (swapslopes) {
+ slopes[3].dx = -slopes[3].dx;
+ slopes[3].dy = -slopes[3].dy;
+ slopes[3].k = -slopes[3].k;
+ }
+ edgecount = 4;
+ }
+ else {
+ double scale, dx, dy, adx, ady;
+
+ adx = dx = pRight->xa - pLeft->xa;
+ ady = dy = pRight->ya - pLeft->ya;
+ if (adx < 0)
+ adx = -adx;
+ if (ady < 0)
+ ady = -ady;
+ scale = ady;
+ if (adx > ady)
+ scale = adx;
+ slopes[2].dx = (dx * 65536) / scale;
+ slopes[2].dy = (dy * 65536) / scale;
+ slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy -
+ (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0;
+ edgecount = 3;
+ }
+
+ y = miPolyBuildPoly(vertices, slopes, edgecount, pLeft->x, pLeft->y,
+ left, right, &nleft, &nright, &height);
+ XAAFillPolyHelper(pGC, y, height, left, right, nleft, nright);
+}
+
+void
+XAAPolylinesWideSolid(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pPts)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int x1, y1, x2, y2;
+ Bool projectLeft, projectRight;
+ LineFaceRec leftFace, rightFace, prevRightFace, firstFace;
+ int first = TRUE;
+ Bool somethingDrawn = FALSE;
+ Bool selfJoin = FALSE;
+ int xorg = pDrawable->x;
+ int yorg = pDrawable->y;
+ Bool hardClip = FALSE;
+
+ if (!RegionNumRects(pGC->pCompositeClip))
+ return;
+
+ if (RegionNumRects(pGC->pCompositeClip) != 1) {
+ miWideLine(pDrawable, pGC, mode, npt, pPts);
+ return;
+ }
+
+ x2 = pPts->x;
+ y2 = pPts->y;
+ if (npt > 1) {
+ if (mode == CoordModePrevious) {
+ int nptTmp;
+ register DDXPointPtr pPtsTmp;
+
+ x1 = x2;
+ y1 = y2;
+ nptTmp = npt;
+ pPtsTmp = pPts + 1;
+ while (--nptTmp) {
+ x1 += pPtsTmp->x;
+ y1 += pPtsTmp->y;
+ ++pPtsTmp;
+ }
+ if ((x2 == x1) && (y2 == y1))
+ selfJoin = TRUE;
+ }
+ else if ((x2 == pPts[npt - 1].x) && (y2 == pPts[npt - 1].y))
+ selfJoin = TRUE;
+ }
+
+ projectLeft = ((pGC->capStyle == CapProjecting) && !selfJoin);
+ projectRight = FALSE;
+
+ (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu,
+ pGC->planemask);
+
+ infoRec->ClipBox = &pGC->pCompositeClip->extents;
+
+ if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL) {
+ hardClip = TRUE;
+ (*infoRec->SetClippingRectangle) (infoRec->pScrn,
+ infoRec->ClipBox->x1,
+ infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1,
+ infoRec->ClipBox->y2 - 1);
+ }
+
+ x2 += xorg;
+ y2 += yorg;
+ while (--npt) {
+ x1 = x2;
+ y1 = y2;
+ ++pPts;
+ x2 = pPts->x;
+ y2 = pPts->y;
+ if (mode == CoordModePrevious) {
+ x2 += x1;
+ y2 += y1;
+ }
+ else {
+ x2 += xorg;
+ y2 += yorg;
+ }
+ if ((x1 != x2) || (y1 != y2)) {
+ somethingDrawn = TRUE;
+ if ((npt == 1) && (pGC->capStyle == CapProjecting) && !selfJoin)
+ projectRight = TRUE;
+ XAAWideSegment(pGC, x1, y1, x2, y2,
+ projectLeft, projectRight, &leftFace, &rightFace);
+ if (first) {
+ if (selfJoin)
+ firstFace = leftFace;
+ else if (pGC->capStyle == CapRound) {
+ if (pGC->lineWidth == 1) {
+ DRAW_POINT(infoRec->pScrn, x1, y1);
+ }
+ else
+ XAALineArc(pGC, &leftFace, (LineFacePtr) NULL,
+ (double) 0.0, (double) 0.0, TRUE);
+ }
+ }
+ else
+ XAALineJoin(pGC, &leftFace, &prevRightFace);
+
+ prevRightFace = rightFace;
+ first = FALSE;
+ projectLeft = FALSE;
+ }
+ if (npt == 1 && somethingDrawn) {
+ if (selfJoin)
+ XAALineJoin(pGC, &firstFace, &rightFace);
+ else if (pGC->capStyle == CapRound) {
+ if (pGC->lineWidth == 1) {
+ DRAW_POINT(infoRec->pScrn, x2, y2);
+ }
+ else
+ XAALineArc(pGC, (LineFacePtr) NULL, &rightFace,
+ (double) 0.0, (double) 0.0, TRUE);
+ }
+ }
+ }
+ /* handle crock where all points are coincedent */
+ if (!somethingDrawn) {
+ projectLeft = (pGC->capStyle == CapProjecting);
+ XAAWideSegment(pGC, x2, y2, x2, y2, projectLeft, projectLeft,
+ &leftFace, &rightFace);
+ if (pGC->capStyle == CapRound) {
+ XAALineArc(pGC, &leftFace, (LineFacePtr) NULL,
+ (double) 0.0, (double) 0.0, TRUE);
+ rightFace.dx = -1; /* sleezy hack to make it work */
+ XAALineArc(pGC, (LineFacePtr) NULL, &rightFace,
+ (double) 0.0, (double) 0.0, TRUE);
+ }
+ }
+
+ infoRec->ClipBox = NULL;
+ if (hardClip)
+ (*infoRec->DisableClipping) (infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaalocal.h b/xorg-server/hw/xfree86/xaa/xaalocal.h
index 0780fb133..c028ef033 100644
--- a/xorg-server/hw/xfree86/xaa/xaalocal.h
+++ b/xorg-server/hw/xfree86/xaa/xaalocal.h
@@ -8,7 +8,6 @@
/* This file is very unorganized ! */
-
#include "gcstruct.h"
#include "regionstr.h"
#include "xf86fbman.h"
@@ -27,49 +26,44 @@
#define DO_PIXMAP_COPY 0x00000007
#define DO_SOLID 0x00000008
+typedef CARD32 *(*GlyphScanlineFuncPtr) (CARD32 *base, unsigned int **glyphp,
+ int line, int nglyph, int width);
-typedef CARD32 * (*GlyphScanlineFuncPtr)(
- CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
-);
-
-typedef CARD32 *(*StippleScanlineProcPtr)(CARD32*, CARD32*, int, int, int);
+typedef CARD32 *(*StippleScanlineProcPtr) (CARD32 *, CARD32 *, int, int, int);
typedef void (*RectFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int,
- XAACacheInfoPtr);
+ XAACacheInfoPtr);
typedef void (*TrapFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int,
- int, int, int, int, int, int,
- XAACacheInfoPtr);
-
-
+ int, int, int, int, int, int, XAACacheInfoPtr);
typedef struct _XAAScreen {
- CreateGCProcPtr CreateGC;
- CloseScreenProcPtr CloseScreen;
- GetImageProcPtr GetImage;
- GetSpansProcPtr GetSpans;
- CopyWindowProcPtr CopyWindow;
- WindowExposuresProcPtr WindowExposures;
- CreatePixmapProcPtr CreatePixmap;
- DestroyPixmapProcPtr DestroyPixmap;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- XAAInfoRecPtr AccelInfoRec;
- Bool (*EnterVT)(int, int);
- void (*LeaveVT)(int, int);
- int (*SetDGAMode)(int, int, DGADevicePtr);
- void (*EnableDisableFBAccess)(int, Bool);
- CompositeProcPtr Composite;
- GlyphsProcPtr Glyphs;
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ CopyWindowProcPtr CopyWindow;
+ WindowExposuresProcPtr WindowExposures;
+ CreatePixmapProcPtr CreatePixmap;
+ DestroyPixmapProcPtr DestroyPixmap;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ XAAInfoRecPtr AccelInfoRec;
+ Bool (*EnterVT) (int, int);
+ void (*LeaveVT) (int, int);
+ int (*SetDGAMode) (int, int, DGADevicePtr);
+ void (*EnableDisableFBAccess) (int, Bool);
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
} XAAScreenRec, *XAAScreenPtr;
#define OPS_ARE_PIXMAP 0x00000001
#define OPS_ARE_ACCEL 0x00000002
typedef struct _XAAGC {
- GCOps *wrapOps;
- GCFuncs *wrapFuncs;
- GCOps *XAAOps;
- int DashLength;
- unsigned char* DashPattern;
+ GCOps *wrapOps;
+ GCFuncs *wrapFuncs;
+ GCOps *XAAOps;
+ int DashLength;
+ unsigned char *DashPattern;
unsigned long changes;
unsigned long flags;
} XAAGCRec, *XAAGCPtr;
@@ -91,1416 +85,1126 @@ typedef struct _XAAPixmap {
CARD32 pattern0;
CARD32 pattern1;
int fg;
- int bg;
+ int bg;
FBAreaPtr offscreenArea;
Bool freeData;
} XAAPixmapRec, *XAAPixmapPtr;
-
extern _X_EXPORT Bool
-XAACreateGC(
- GCPtr pGC
-);
+ XAACreateGC(GCPtr pGC);
extern _X_EXPORT Bool
-XAAInitAccel(
- ScreenPtr pScreen,
- XAAInfoRecPtr infoRec
-);
+ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec);
extern _X_EXPORT RegionPtr
-XAABitBlt(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx,
- int srcy,
- int width,
- int height,
- int dstx,
- int dsty,
- void (*doBitBlt)(DrawablePtr, DrawablePtr, GCPtr, RegionPtr, DDXPointPtr),
- unsigned long bitPlane
-);
-
-extern _X_EXPORT void
-XAAScreenToScreenBitBlt(
- ScrnInfoPtr pScrn,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir,
- int ydir,
- int alu,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAADoBitBlt(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc
-);
-
-extern _X_EXPORT void
-XAADoImageWrite(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc
-);
-
-extern _X_EXPORT void
-XAADoImageRead(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc
-);
-
-extern _X_EXPORT void
-XAACopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc
-);
+XAABitBlt(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC * pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ void (*doBitBlt) (DrawablePtr, DrawablePtr, GCPtr, RegionPtr,
+ DDXPointPtr), unsigned long bitPlane);
-extern _X_EXPORT RegionPtr
-XAACopyArea(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx,
- int srcy,
- int width,
- int height,
- int dstx,
- int dsty
-);
+extern _X_EXPORT void
+
+XAAScreenToScreenBitBlt(ScrnInfoPtr pScrn,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir, int ydir, int alu, unsigned int planemask);
extern _X_EXPORT void
-XAAValidateCopyArea(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
+
+XAADoBitBlt(DrawablePtr pSrc,
+ DrawablePtr pDst, GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc);
+
+extern _X_EXPORT void
+
+XAADoImageWrite(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc);
+
+extern _X_EXPORT void
+
+XAADoImageRead(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc);
+
+extern _X_EXPORT void
+ XAACopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+
+extern _X_EXPORT RegionPtr
+
+XAACopyArea(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC * pGC,
+ int srcx, int srcy, int width, int height, int dstx, int dsty);
extern _X_EXPORT void
-XAAValidatePutImage(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
+ XAAValidateCopyArea(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
extern _X_EXPORT void
-XAAValidateCopyPlane(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
+ XAAValidatePutImage(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
extern _X_EXPORT void
-XAAValidatePushPixels(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
+ XAAValidateCopyPlane(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
extern _X_EXPORT void
-XAAValidateFillSpans(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
+ XAAValidatePushPixels(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
extern _X_EXPORT void
-XAAValidatePolyGlyphBlt(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
+ XAAValidateFillSpans(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
extern _X_EXPORT void
-XAAValidateImageGlyphBlt(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
+ XAAValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
extern _X_EXPORT void
-XAAValidatePolylines(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
+ XAAValidateImageGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
+extern _X_EXPORT void
+ XAAValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
extern _X_EXPORT RegionPtr
-XAACopyPlaneColorExpansion(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx,
- int srcy,
- int width,
- int height,
- int dstx,
- int dsty,
- unsigned long bitPlane
-);
-
-
-extern _X_EXPORT void
-XAAPushPixelsSolidColorExpansion(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDrawable,
- int dx,
- int dy,
- int xOrg,
- int yOrg
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpandMSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpand3MSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpandMSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpand3MSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpandLSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpand3LSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpandLSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpand3LSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpandMSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpand3MSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpandMSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpand3MSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpandLSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpand3LSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpandLSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpand3LSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWritePixmap (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
-);
-
-extern _X_EXPORT void
-XAAWritePixmapScanline (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
-);
-
-typedef void (*ClipAndRenderRectsFunc)(GCPtr, int, BoxPtr, int, int);
-
-
-extern _X_EXPORT void
-XAAClipAndRenderRects(
- GCPtr pGC,
- ClipAndRenderRectsFunc func,
- int nrectFill,
- xRectangle *prectInit,
- int xorg, int yorg
-);
-
-
-typedef void (*ClipAndRenderSpansFunc)(GCPtr, int, DDXPointPtr, int*,
- int, int, int);
-
-extern _X_EXPORT void
-XAAClipAndRenderSpans(
- GCPtr pGC,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted,
- ClipAndRenderSpansFunc func,
- int xorg,
- int yorg
-);
-
-
-extern _X_EXPORT void
-XAAFillSolidRects(
- ScrnInfoPtr pScrn,
- int fg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox
-);
-
-extern _X_EXPORT void
-XAAFillMono8x8PatternRects(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int pat0, int pat1,
- int xorg, int yorg
-);
-
-extern _X_EXPORT void
-XAAFillMono8x8PatternRectsScreenOrigin(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int pat0, int pat1,
- int xorg, int yorg
-);
-
-
-extern _X_EXPORT void
-XAAFillColor8x8PatternRectsScreenOrigin(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorigin, int yorigin,
- XAACacheInfoPtr pCache
-);
-
-extern _X_EXPORT void
-XAAFillColor8x8PatternRects(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorigin, int yorigin,
- XAACacheInfoPtr pCache
-);
-
-extern _X_EXPORT void
-XAAFillCacheBltRects(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
-);
-
-extern _X_EXPORT void
-XAAFillCacheExpandRects(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillImageWriteRects(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-);
-
-
-extern _X_EXPORT void
-XAATEGlyphRendererMSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRenderer3MSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRendererMSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-extern _X_EXPORT void
-XAATEGlyphRenderer3MSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
+XAACopyPlaneColorExpansion(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx, int dsty, unsigned long bitPlane);
+
+extern _X_EXPORT void
+
+XAAPushPixelsSolidColorExpansion(GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapColorExpandMSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapColorExpand3MSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapColorExpandMSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapColorExpand3MSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapColorExpandLSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapColorExpand3LSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapColorExpandLSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapColorExpand3LSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapScanlineColorExpandMSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapScanlineColorExpand3MSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAWriteBitmapScanlineColorExpandMSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask);
extern _X_EXPORT void
-XAATEGlyphRendererLSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-
+
+XAAWriteBitmapScanlineColorExpand3MSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask);
+
extern _X_EXPORT void
-XAATEGlyphRenderer3LSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
+
+XAAWriteBitmapScanlineColorExpandLSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
+
extern _X_EXPORT void
-XAATEGlyphRendererLSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
+
+XAAWriteBitmapScanlineColorExpand3LSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop, unsigned int planemask);
extern _X_EXPORT void
-XAATEGlyphRenderer3LSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
+XAAWriteBitmapScanlineColorExpandLSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask);
extern _X_EXPORT void
-XAATEGlyphRendererScanlineMSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
+
+XAAWriteBitmapScanlineColorExpand3LSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask);
extern _X_EXPORT void
-XAATEGlyphRendererScanline3MSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
+
+XAAWritePixmap(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int rop,
+ unsigned int planemask,
+ int transparency_color, int bpp, int depth);
extern _X_EXPORT void
-XAATEGlyphRendererScanlineLSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
+
+XAAWritePixmapScanline(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int rop,
+ unsigned int planemask,
+ int transparency_color, int bpp, int depth);
+
+typedef void (*ClipAndRenderRectsFunc) (GCPtr, int, BoxPtr, int, int);
extern _X_EXPORT void
-XAATEGlyphRendererScanline3LSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
+XAAClipAndRenderRects(GCPtr pGC,
+ ClipAndRenderRectsFunc func,
+ int nrectFill, xRectangle *prectInit, int xorg, int yorg);
-extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirstFixedBase[32])(
- CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
-);
+typedef void (*ClipAndRenderSpansFunc) (GCPtr, int, DDXPointPtr, int *,
+ int, int, int);
-extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirst[32])(
- CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
-);
+extern _X_EXPORT void
-extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirstFixedBase[32])(
- CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
-);
+XAAClipAndRenderSpans(GCPtr pGC,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted,
+ ClipAndRenderSpansFunc func, int xorg, int yorg);
-extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirst[32])(
- CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
-);
+extern _X_EXPORT void
+
+XAAFillSolidRects(ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox);
+
+extern _X_EXPORT void
+
+XAAFillMono8x8PatternRects(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox, int pat0, int pat1, int xorg, int yorg);
-extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncMSBFirstFixedBase(void);
+extern _X_EXPORT void
+
+XAAFillMono8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pat0, int pat1, int xorg, int yorg);
+
+extern _X_EXPORT void
+
+XAAFillColor8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorigin, int yorigin,
+ XAACacheInfoPtr pCache);
+
+extern _X_EXPORT void
+
+XAAFillColor8x8PatternRects(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorigin, int yorigin, XAACacheInfoPtr pCache);
+
+extern _X_EXPORT void
+
+XAAFillCacheBltRects(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox, int xorg, int yorg, XAACacheInfoPtr pCache);
+
+extern _X_EXPORT void
+
+XAAFillCacheExpandRects(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillImageWriteRects(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAPolyFillRect(DrawablePtr pDraw,
+ GCPtr pGC, int nrectFill, xRectangle *prectInit);
+
+extern _X_EXPORT void
+
+XAATEGlyphRendererMSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRenderer3MSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRendererMSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRenderer3MSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRendererLSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRenderer3LSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRendererLSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRenderer3LSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRendererScanlineMSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRendererScanline3MSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRendererScanlineLSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+
+extern _X_EXPORT void
+
+XAATEGlyphRendererScanline3LSBFirst(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft,
+ int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+
+extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirstFixedBase[32]) (CARD32
+ *base,
+ unsigned
+ int
+ **glyphp,
+ int line,
+ int
+ nglyph,
+ int
+ width);
+
+extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirst[32]) (CARD32 *base,
+ unsigned int
+ **glyphp,
+ int line,
+ int nglyph,
+ int width);
+
+extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirstFixedBase[32]) (CARD32
+ *base,
+ unsigned
+ int
+ **glyphp,
+ int line,
+ int
+ nglyph,
+ int
+ width);
+
+extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirst[32]) (CARD32 *base,
+ unsigned int
+ **glyphp,
+ int line,
+ int nglyph,
+ int width);
+
+extern _X_EXPORT GlyphScanlineFuncPtr
+ *XAAGetGlyphScanlineFuncMSBFirstFixedBase(void);
extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncMSBFirst(void);
-extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncLSBFirstFixedBase(void);
+extern _X_EXPORT GlyphScanlineFuncPtr
+ *XAAGetGlyphScanlineFuncLSBFirstFixedBase(void);
extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncLSBFirst(void);
extern _X_EXPORT void
-XAAFillColorExpandRectsLSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRects3LSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRectsLSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRects3LSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRectsMSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRects3MSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRectsMSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRects3MSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandRectsLSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandRects3LSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandRectsMSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandRects3MSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpansLSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpans3LSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpansLSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpans3LSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpansMSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpans3MSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpansMSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpans3MSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandSpansLSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandSpans3LSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandSpansMSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandSpans3MSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-
-extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirstFixedBase[6])(
- CARD32* base, CARD32* src, int offset, int width, int dwords
-);
-
-extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirst[6])(
- CARD32* base, CARD32* src, int offset, int width, int dwords
-);
-
-extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirstFixedBase[6])(
- CARD32* base, CARD32* src, int offset, int width, int dwords
-);
-
-extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirst[6])(
- CARD32* base, CARD32* src, int offset, int width, int dwords
-);
-
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirstFixedBase(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirst(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirstFixedBase(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirst(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirstFixedBase(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirst(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirstFixedBase(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirst(void);
+
+XAAFillColorExpandRectsLSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandRects3LSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandRectsLSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandRects3LSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandRectsMSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandRects3MSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandRectsMSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandRects3MSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillScanlineColorExpandRectsLSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillScanlineColorExpandRects3LSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillScanlineColorExpandRectsMSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillScanlineColorExpandRects3MSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandSpansLSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandSpans3LSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandSpansLSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandSpans3LSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandSpansMSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandSpans3MSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandSpansMSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillColorExpandSpans3MSBFirstFixedBase(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillScanlineColorExpandSpansLSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillScanlineColorExpandSpans3LSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAPutImage(DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h, int leftPad, int format, char *pImage);
+
+extern _X_EXPORT void
+
+XAAFillScanlineColorExpandSpansMSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillScanlineColorExpandSpans3MSBFirst(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirstFixedBase[6]) (CARD32
+ *base,
+ CARD32
+ *src,
+ int
+ offset,
+ int
+ width,
+ int
+ dwords);
+
+extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirst[6]) (CARD32 *base,
+ CARD32 *src,
+ int offset,
+ int width,
+ int dwords);
+
+extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirstFixedBase[6]) (CARD32
+ *base,
+ CARD32
+ *src,
+ int
+ offset,
+ int
+ width,
+ int
+ dwords);
+
+extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirst[6]) (CARD32 *base,
+ CARD32 *src,
+ int offset,
+ int width,
+ int dwords);
+
+extern _X_EXPORT StippleScanlineProcPtr
+ *XAAGetStippleScanlineFuncMSBFirstFixedBase(void);
+extern _X_EXPORT StippleScanlineProcPtr
+ *XAAGetStippleScanlineFuncMSBFirst(void);
+extern _X_EXPORT StippleScanlineProcPtr
+ *XAAGetStippleScanlineFuncLSBFirstFixedBase(void);
+extern _X_EXPORT StippleScanlineProcPtr
+ *XAAGetStippleScanlineFuncLSBFirst(void);
+extern _X_EXPORT StippleScanlineProcPtr
+ *XAAGetStippleScanlineFunc3MSBFirstFixedBase(void);
+extern _X_EXPORT StippleScanlineProcPtr
+ *XAAGetStippleScanlineFunc3MSBFirst(void);
+extern _X_EXPORT StippleScanlineProcPtr
+ *XAAGetStippleScanlineFunc3LSBFirstFixedBase(void);
+extern _X_EXPORT StippleScanlineProcPtr
+ *XAAGetStippleScanlineFunc3LSBFirst(void);
extern _X_EXPORT int
-XAAPolyText8TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-);
+
+XAAPolyText8TEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars);
extern _X_EXPORT int
-XAAPolyText16TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-);
-
-extern _X_EXPORT void
-XAAImageText8TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-);
-
-extern _X_EXPORT void
-XAAImageText16TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-);
-
-extern _X_EXPORT void
-XAAImageGlyphBltTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-);
-
-extern _X_EXPORT void
-XAAPolyGlyphBltTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-);
+XAAPolyText16TEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars);
+
+extern _X_EXPORT void
+
+XAAImageText8TEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC, int x, int y, int count, char *chars);
+
+extern _X_EXPORT void
+
+XAAImageText16TEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, unsigned short *chars);
+
+extern _X_EXPORT void
+
+XAAImageGlyphBltTEColorExpansion(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+
+extern _X_EXPORT void
+
+XAAPolyGlyphBltTEColorExpansion(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
extern _X_EXPORT int
-XAAPolyText8NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-);
+
+XAAPolyText8NonTEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, char *chars);
extern _X_EXPORT int
-XAAPolyText16NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-);
-
-extern _X_EXPORT void
-XAAImageText8NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-);
-
-extern _X_EXPORT void
-XAAImageText16NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-);
-
-extern _X_EXPORT void
-XAAImageGlyphBltNonTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-);
-
-extern _X_EXPORT void
-XAAPolyGlyphBltNonTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-);
-
-
-extern _X_EXPORT void XAANonTEGlyphRenderer(
- ScrnInfoPtr pScrn,
- int x, int y, int n,
- NonTEGlyphPtr glyphs,
- BoxPtr pbox,
- int fg, int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAFillSolidSpans(
- ScrnInfoPtr pScrn,
- int fg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted
-);
-
-extern _X_EXPORT void
-XAAFillMono8x8PatternSpans(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- int patx, int paty,
- int xorg, int yorg
-);
-
-extern _X_EXPORT void
-XAAFillMono8x8PatternSpansScreenOrigin(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- int patx, int paty,
- int xorg, int yorg
-);
-
-extern _X_EXPORT void
-XAAFillColor8x8PatternSpansScreenOrigin(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- XAACacheInfoPtr,
- int xorigin, int yorigin
-);
-
-extern _X_EXPORT void
-XAAFillColor8x8PatternSpans(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- XAACacheInfoPtr,
- int xorigin, int yorigin
-);
-
-extern _X_EXPORT void
-XAAFillCacheBltSpans(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr points,
- int *widths,
- int fSorted,
- XAACacheInfoPtr pCache,
- int xorg, int yorg
-);
-
-extern _X_EXPORT void
-XAAFillCacheExpandSpans(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillSpans(
- DrawablePtr pDrawable,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidth,
- int fSorted
-);
-
-
-extern _X_EXPORT void
-XAAInitPixmapCache(
- ScreenPtr pScreen,
- RegionPtr areas,
- pointer data
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapToCache(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int fg, int bg
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapToCacheLinear(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int fg, int bg
-);
-
-extern _X_EXPORT void
-XAAWritePixmapToCache(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int bpp, int depth
-);
-
-extern _X_EXPORT void
-XAAWritePixmapToCacheLinear(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int bpp, int depth
-);
-
-extern _X_EXPORT void
-XAASolidHorVertLineAsRects(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-);
-
-extern _X_EXPORT void
-XAASolidHorVertLineAsTwoPoint(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-);
-
-extern _X_EXPORT void
-XAASolidHorVertLineAsBresenham(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-);
-
+
+XAAPolyText16NonTEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count, unsigned short *chars);
+
+extern _X_EXPORT void
+
+XAAImageText8NonTEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y, int count, char *chars);
+
+extern _X_EXPORT void
+
+XAAImageText16NonTEColorExpansion(DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count, unsigned short *chars);
+
+extern _X_EXPORT void
+
+XAAImageGlyphBltNonTEColorExpansion(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+
+extern _X_EXPORT void
+
+XAAPolyGlyphBltNonTEColorExpansion(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase);
+
+extern _X_EXPORT void XAANonTEGlyphRenderer(ScrnInfoPtr pScrn,
+ int x, int y, int n,
+ NonTEGlyphPtr glyphs,
+ BoxPtr pbox,
+ int fg, int rop,
+ unsigned int planemask);
+
+extern _X_EXPORT void
+
+XAAFillSolidSpans(ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int n, DDXPointPtr ppt, int *pwidth, int fSorted);
+
+extern _X_EXPORT void
+
+XAAFillMono8x8PatternSpans(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ int patx, int paty, int xorg, int yorg);
+
+extern _X_EXPORT void
+
+XAAFillMono8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ int patx, int paty, int xorg, int yorg);
+
+extern _X_EXPORT void
+
+XAAFillColor8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ XAACacheInfoPtr,
+ int xorigin, int yorigin);
+
+extern _X_EXPORT void
+
+XAAFillColor8x8PatternSpans(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ XAACacheInfoPtr, int xorigin, int yorigin);
+
+extern _X_EXPORT void
+
+XAAFillCacheBltSpans(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted, XAACacheInfoPtr pCache, int xorg, int yorg);
+
+extern _X_EXPORT void
+
+XAAFillCacheExpandSpans(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted, int xorg, int yorg, PixmapPtr pPix);
+
+extern _X_EXPORT void
+
+XAAFillSpans(DrawablePtr pDrawable,
+ GC * pGC,
+ int nInit, DDXPointPtr pptInit, int *pwidth, int fSorted);
+
+extern _X_EXPORT void
+ XAAInitPixmapCache(ScreenPtr pScreen, RegionPtr areas, pointer data);
extern _X_EXPORT void
-XAAPolyRectangleThinSolid(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-);
+XAAWriteBitmapToCache(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int fg, int bg);
extern _X_EXPORT void
-XAAPolylinesWideSolid (
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
-);
+
+XAAWriteBitmapToCacheLinear(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int fg, int bg);
+
+extern _X_EXPORT void
+
+XAAWritePixmapToCache(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int bpp, int depth);
+
+extern _X_EXPORT void
+
+XAAWritePixmapToCacheLinear(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth, int bpp, int depth);
extern _X_EXPORT void
-XAAFillPolygonSolid(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-);
+ XAASolidHorVertLineAsRects(ScrnInfoPtr pScrn, int x, int y, int len, int dir);
+
+extern _X_EXPORT void
+
+XAASolidHorVertLineAsTwoPoint(ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir);
+
+extern _X_EXPORT void
+
+XAASolidHorVertLineAsBresenham(ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir);
+
+extern _X_EXPORT void
+
+XAAPolyRectangleThinSolid(DrawablePtr pDrawable,
+ GCPtr pGC, int nRectsInit, xRectangle *pRectsInit);
+
+extern _X_EXPORT void
+
+XAAPolylinesWideSolid(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pPts);
extern _X_EXPORT void
-XAAFillPolygonStippled(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-);
+XAAFillPolygonSolid(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn);
extern _X_EXPORT void
-XAAFillPolygonTiled(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-);
+XAAFillPolygonStippled(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn);
+
+extern _X_EXPORT void
+
+XAAFillPolygonTiled(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr ptsIn);
extern _X_EXPORT int
-XAAIsEasyPolygon(
- DDXPointPtr ptsIn,
- int count,
- BoxPtr extents,
- int origin,
- DDXPointPtr *topPoint,
- int *topY, int *bottomY,
- int shape
-);
-
-extern _X_EXPORT void
-XAAFillPolygonHelper(
- ScrnInfoPtr pScrn,
- DDXPointPtr ptsIn,
- int count,
- DDXPointPtr topPoint,
- int y,
- int maxy,
- int origin,
- RectFuncPtr RectFunc,
- TrapFuncPtr TrapFunc,
- int xorg,
- int yorg,
- XAACacheInfoPtr pCache
-);
-
-extern _X_EXPORT void
-XAAPolySegment(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-);
-
-extern _X_EXPORT void
-XAAPolyLines(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-);
-
-extern _X_EXPORT void
-XAAPolySegmentDashed(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-);
-
-extern _X_EXPORT void
-XAAPolyLinesDashed(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-);
-
-
-extern _X_EXPORT void
-XAAWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache);
-
-extern _X_EXPORT void
-XAAWriteColor8x8PatternToCache(
- ScrnInfoPtr pScrn,
- PixmapPtr pPix,
- XAACacheInfoPtr pCache
-);
-
-extern _X_EXPORT void
-XAARotateMonoPattern(
- int *pat0, int *pat1,
- int xoffset, int yoffset,
- Bool msbfirst
-);
+
+XAAIsEasyPolygon(DDXPointPtr ptsIn,
+ int count,
+ BoxPtr extents,
+ int origin,
+ DDXPointPtr * topPoint, int *topY, int *bottomY, int shape);
+
+extern _X_EXPORT void
+
+XAAFillPolygonHelper(ScrnInfoPtr pScrn,
+ DDXPointPtr ptsIn,
+ int count,
+ DDXPointPtr topPoint,
+ int y,
+ int maxy,
+ int origin,
+ RectFuncPtr RectFunc,
+ TrapFuncPtr TrapFunc,
+ int xorg, int yorg, XAACacheInfoPtr pCache);
+
+extern _X_EXPORT void
+ XAAPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg);
+
+extern _X_EXPORT void
+
+XAAPolyLines(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pptInit);
+
+extern _X_EXPORT void
+
+XAAPolySegmentDashed(DrawablePtr pDrawable,
+ GCPtr pGC, int nseg, xSegment * pSeg);
+
+extern _X_EXPORT void
+
+XAAPolyLinesDashed(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr pptInit);
+
+extern _X_EXPORT void
+ XAAWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache);
+
+extern _X_EXPORT void
+
+XAAWriteColor8x8PatternToCache(ScrnInfoPtr pScrn,
+ PixmapPtr pPix, XAACacheInfoPtr pCache);
+
+extern _X_EXPORT void
+
+XAARotateMonoPattern(int *pat0, int *pat1,
+ int xoffset, int yoffset, Bool msbfirst);
extern _X_EXPORT void XAAComputeDash(GCPtr pGC);
-extern _X_EXPORT void XAAMoveDWORDS_FixedBase(
- register CARD32* dest,
- register CARD32* src,
- register int dwords
-);
+extern _X_EXPORT void XAAMoveDWORDS_FixedBase(register CARD32 *dest,
+ register CARD32 *src,
+ register int dwords);
-extern _X_EXPORT void XAAMoveDWORDS_FixedSrc(
- register CARD32* dest,
- register CARD32* src,
- register int dwords
-);
+extern _X_EXPORT void XAAMoveDWORDS_FixedSrc(register CARD32 *dest,
+ register CARD32 *src,
+ register int dwords);
-extern _X_EXPORT void XAAMoveDWORDS(
- register CARD32* dest,
- register CARD32* src,
- register int dwords
-);
+extern _X_EXPORT void XAAMoveDWORDS(register CARD32 *dest,
+ register CARD32 *src, register int dwords);
extern _X_EXPORT int
-XAAGetRectClipBoxes(
- GCPtr pGC,
- BoxPtr pboxClippedBase,
- int nrectFill,
- xRectangle *prectInit
-);
+
+XAAGetRectClipBoxes(GCPtr pGC,
+ BoxPtr pboxClippedBase,
+ int nrectFill, xRectangle *prectInit);
extern _X_EXPORT void
-XAASetupOverlay8_32Planar(ScreenPtr);
+ XAASetupOverlay8_32Planar(ScreenPtr);
extern _X_EXPORT void
-XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs);
-
-extern _X_EXPORT XAACacheInfoPtr
-XAACacheTile(ScrnInfoPtr Scrn, PixmapPtr pPix);
+ XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs);
+
+extern _X_EXPORT XAACacheInfoPtr XAACacheTile(ScrnInfoPtr Scrn, PixmapPtr pPix);
extern _X_EXPORT XAACacheInfoPtr
XAACacheMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
@@ -1508,8 +1212,10 @@ XAACacheMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
extern _X_EXPORT XAACacheInfoPtr
XAACachePlanarMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
-typedef XAACacheInfoPtr (*XAACachePlanarMonoStippleProc)(ScrnInfoPtr, PixmapPtr);
-extern _X_EXPORT XAACachePlanarMonoStippleProc XAAGetCachePlanarMonoStipple(void);
+typedef XAACacheInfoPtr(*XAACachePlanarMonoStippleProc) (ScrnInfoPtr,
+ PixmapPtr);
+extern _X_EXPORT XAACachePlanarMonoStippleProc
+XAAGetCachePlanarMonoStipple(void);
extern _X_EXPORT XAACacheInfoPtr
XAACacheStipple(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg);
@@ -1521,13 +1227,14 @@ extern _X_EXPORT XAACacheInfoPtr
XAACacheColor8x8Pattern(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg);
extern _X_EXPORT void
-XAATileCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache, int w, int h);
-
+ XAATileCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache, int w, int h);
+
extern _X_EXPORT void XAAClosePixmapCache(ScreenPtr pScreen);
void XAAInvalidatePixmapCache(ScreenPtr pScreen);
extern _X_EXPORT Bool XAACheckStippleReducibility(PixmapPtr pPixmap);
-extern _X_EXPORT Bool XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono);
+extern _X_EXPORT Bool XAACheckTileReducibility(PixmapPtr pPixmap,
+ Bool checkMono);
extern _X_EXPORT int XAAStippledFillChooser(GCPtr pGC);
extern _X_EXPORT int XAAOpaqueStippledFillChooser(GCPtr pGC);
@@ -1537,94 +1244,67 @@ extern _X_EXPORT void XAAMoveInOffscreenPixmaps(ScreenPtr pScreen);
extern _X_EXPORT void XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen);
extern _X_EXPORT void XAARemoveAreaCallback(FBAreaPtr area);
extern _X_EXPORT void XAAMoveOutOffscreenPixmap(PixmapPtr pPix);
-extern _X_EXPORT Bool XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec);
+extern _X_EXPORT Bool XAAInitStateWrap(ScreenPtr pScreen,
+ XAAInfoRecPtr infoRec);
extern _X_EXPORT void
-XAAComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
+XAAComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
extern _X_EXPORT Bool
-XAADoComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-
-extern _X_EXPORT void
-XAAGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
-extern _X_EXPORT Bool
-XAADoGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
+XAADoComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
+extern _X_EXPORT void
+XAAGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
+
+extern _X_EXPORT Bool
+
+XAADoGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
/* helpers */
extern _X_EXPORT void
-XAA_888_plus_PICT_a8_to_8888 (
- CARD32 color,
- CARD8 *alphaPtr, /* in bytes */
- int alphaPitch,
- CARD32 *dstPtr,
- int dstPitch, /* in dwords */
- int width,
- int height
-);
+ XAA_888_plus_PICT_a8_to_8888(CARD32 color, CARD8 *alphaPtr, /* in bytes */
+ int alphaPitch, CARD32 *dstPtr, int dstPitch, /* in dwords */
+ int width, int height);
extern _X_EXPORT Bool
-XAAGetRGBAFromPixel(
- CARD32 pixel,
- CARD16 *red,
- CARD16 *green,
- CARD16 *blue,
- CARD16 *alpha,
- CARD32 format
-);
+XAAGetRGBAFromPixel(CARD32 pixel,
+ CARD16 *red,
+ CARD16 *green, CARD16 *blue, CARD16 *alpha, CARD32 format);
extern _X_EXPORT Bool
-XAAGetPixelFromRGBA (
- CARD32 *pixel,
- CARD16 red,
- CARD16 green,
- CARD16 blue,
- CARD16 alpha,
- CARD32 format
-);
+
+XAAGetPixelFromRGBA(CARD32 *pixel,
+ CARD16 red,
+ CARD16 green, CARD16 blue, CARD16 alpha, CARD32 format);
/* XXX should be static */
extern _X_EXPORT GCOps XAAFallbackOps;
@@ -1694,7 +1374,7 @@ extern _X_EXPORT CARD32 XAAReverseBitOrder(CARD32 data);
((pGC->planemask & infoRec->FullPlanemask) != infoRec->FullPlanemask))
#define IS_OFFSCREEN_PIXMAP(pPix)\
- ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->offscreenArea)
+ ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->offscreenArea)
#define PIXMAP_IS_SHARED(pPix)\
((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & SHARED_PIXMAP)
@@ -1719,7 +1399,6 @@ extern _X_EXPORT CARD32 XAAReverseBitOrder(CARD32 data);
_prev = _pLink; \
_pLink = _pLink->next; \
}}
-
#define SWAP_BITS_IN_BYTES(v) \
(((0x01010101 & (v)) << 7) | ((0x02020202 & (v)) << 5) | \
@@ -1733,27 +1412,26 @@ extern _X_EXPORT CARD32 XAAReverseBitOrder(CARD32 data);
*/
typedef struct {
- int Num512x512;
- int Current512;
- XAACacheInfoPtr Info512;
- int Num256x256;
- int Current256;
- XAACacheInfoPtr Info256;
- int Num128x128;
- int Current128;
- XAACacheInfoPtr Info128;
- int NumMono;
- int CurrentMono;
- XAACacheInfoPtr InfoMono;
- int NumColor;
- int CurrentColor;
- XAACacheInfoPtr InfoColor;
- int NumPartial;
- int CurrentPartial;
- XAACacheInfoPtr InfoPartial;
- DDXPointRec MonoOffsets[64];
- DDXPointRec ColorOffsets[64];
+ int Num512x512;
+ int Current512;
+ XAACacheInfoPtr Info512;
+ int Num256x256;
+ int Current256;
+ XAACacheInfoPtr Info256;
+ int Num128x128;
+ int Current128;
+ XAACacheInfoPtr Info128;
+ int NumMono;
+ int CurrentMono;
+ XAACacheInfoPtr InfoMono;
+ int NumColor;
+ int CurrentColor;
+ XAACacheInfoPtr InfoColor;
+ int NumPartial;
+ int CurrentPartial;
+ XAACacheInfoPtr InfoPartial;
+ DDXPointRec MonoOffsets[64];
+ DDXPointRec ColorOffsets[64];
} XAAPixmapCachePrivate, *XAAPixmapCachePrivatePtr;
-
-#endif /* _XAALOCAL_H */
+#endif /* _XAALOCAL_H */
diff --git a/xorg-server/hw/xfree86/xaa/xaarop.h b/xorg-server/hw/xfree86/xaa/xaarop.h
index edfd75aec..f2acde075 100644
--- a/xorg-server/hw/xfree86/xaa/xaarop.h
+++ b/xorg-server/hw/xfree86/xaa/xaarop.h
@@ -8,7 +8,6 @@
MS triadic raster op. The function will return which components
(S-P) need to be enabled.
-
int XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop)
For use with 8x8 opaque pattern fills. You give it the foreground,
@@ -17,7 +16,6 @@
appropriate MS triadic raster op. The function will return which
components (S-P) need to be enabled.
-
ROP_PAT - Means to enable 8x8 mono patterns (all bits
set for solid patterns). Set the foreground and
background as returned by the function.
@@ -294,8 +292,10 @@
#define NO_SRC_ROP(rop) \
((rop == GXnoop) || (rop == GXset) || (rop == GXclear) || (rop == GXinvert))
-extern _X_EXPORT int XAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop);
-extern _X_EXPORT int XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop);
+extern _X_EXPORT int XAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm,
+ int *rop);
+extern _X_EXPORT int XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg,
+ int pm, int *rop);
/* XXX These four should be static, but it breaks the 6.7.0 ABI. */
extern _X_EXPORT int XAACopyROP[16];
@@ -308,4 +308,4 @@ extern _X_EXPORT int XAAGetCopyROP_PM(int i);
extern _X_EXPORT int XAAGetPatternROP(int i);
extern _X_EXPORT int XAAGetPatternROP_PM(int i);
-#endif /* _XAAROP_H */
+#endif /* _XAAROP_H */
diff --git a/xorg-server/hw/xnest/Args.c b/xorg-server/hw/xnest/Args.c
index cdc831133..21faf2e3a 100644
--- a/xorg-server/hw/xnest/Args.c
+++ b/xorg-server/hw/xnest/Args.c
@@ -29,162 +29,164 @@ is" without express or implied warranty.
#include "Display.h"
#include "Args.h"
-char *xnestDisplayName = NULL;
+char *xnestDisplayName = NULL;
Bool xnestSynchronize = False;
Bool xnestFullGeneration = False;
-int xnestDefaultClass;
+int xnestDefaultClass;
Bool xnestUserDefaultClass = False;
int xnestDefaultDepth;
Bool xnestUserDefaultDepth = False;
Bool xnestSoftwareScreenSaver = False;
-int xnestX;
-int xnestY;
+int xnestX;
+int xnestY;
unsigned int xnestWidth;
unsigned int xnestHeight;
int xnestUserGeometry = 0;
-int xnestBorderWidth;
+int xnestBorderWidth;
Bool xnestUserBorderWidth = False;
-char *xnestWindowName = NULL;
+char *xnestWindowName = NULL;
int xnestNumScreens = 0;
Bool xnestDoDirectColormaps = False;
Window xnestParentWindow = 0;
int
-ddxProcessArgument (int argc, char *argv[], int i)
+ddxProcessArgument(int argc, char *argv[], int i)
{
- if (!strcmp(argv[i], "-display")) {
- if (++i < argc) {
- xnestDisplayName = argv[i];
- return 2;
+ if (!strcmp(argv[i], "-display")) {
+ if (++i < argc) {
+ xnestDisplayName = argv[i];
+ return 2;
+ }
+ return 0;
}
- return 0;
- }
- if (!strcmp(argv[i], "-sync")) {
- xnestSynchronize = True;
- return 1;
- }
- if (!strcmp(argv[i], "-full")) {
- xnestFullGeneration = True;
- return 1;
- }
- if (!strcmp(argv[i], "-class")) {
- if (++i < argc) {
- if (!strcmp(argv[i], "StaticGray")) {
- xnestDefaultClass = StaticGray;
- xnestUserDefaultClass = True;
- return 2;
- }
- else if (!strcmp(argv[i], "GrayScale")) {
- xnestDefaultClass = GrayScale;
- xnestUserDefaultClass = True;
- return 2;
- }
- else if (!strcmp(argv[i], "StaticColor")) {
- xnestDefaultClass = StaticColor;
- xnestUserDefaultClass = True;
- return 2;
- }
- else if (!strcmp(argv[i], "PseudoColor")) {
- xnestDefaultClass = PseudoColor;
- xnestUserDefaultClass = True;
- return 2;
- }
- else if (!strcmp(argv[i], "TrueColor")) {
- xnestDefaultClass = TrueColor;
- xnestUserDefaultClass = True;
- return 2;
- }
- else if (!strcmp(argv[i], "DirectColor")) {
- xnestDefaultClass = DirectColor;
- xnestUserDefaultClass = True;
- return 2;
- }
+ if (!strcmp(argv[i], "-sync")) {
+ xnestSynchronize = True;
+ return 1;
}
- return 0;
- }
- if (!strcmp(argv[i], "-cc")) {
- if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultClass) == 1) {
- if (xnestDefaultClass >= 0 && xnestDefaultClass <= 5) {
- xnestUserDefaultClass = True;
- /* lex the OS layer process it as well, so return 0 */
- }
+ if (!strcmp(argv[i], "-full")) {
+ xnestFullGeneration = True;
+ return 1;
}
- return 0;
- }
- if (!strcmp(argv[i], "-depth")) {
- if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultDepth) == 1) {
- if (xnestDefaultDepth > 0) {
- xnestUserDefaultDepth = True;
- return 2;
- }
+ if (!strcmp(argv[i], "-class")) {
+ if (++i < argc) {
+ if (!strcmp(argv[i], "StaticGray")) {
+ xnestDefaultClass = StaticGray;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "GrayScale")) {
+ xnestDefaultClass = GrayScale;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "StaticColor")) {
+ xnestDefaultClass = StaticColor;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "PseudoColor")) {
+ xnestDefaultClass = PseudoColor;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "TrueColor")) {
+ xnestDefaultClass = TrueColor;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "DirectColor")) {
+ xnestDefaultClass = DirectColor;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ }
+ return 0;
}
- return 0;
- }
- if (!strcmp(argv[i], "-sss")) {
- xnestSoftwareScreenSaver = True;
- return 1;
- }
- if (!strcmp(argv[i], "-geometry")) {
- if (++i < argc) {
- xnestUserGeometry = XParseGeometry(argv[i],
- &xnestX, &xnestY,
- &xnestWidth, &xnestHeight);
- if (xnestUserGeometry) return 2;
+ if (!strcmp(argv[i], "-cc")) {
+ if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultClass) == 1) {
+ if (xnestDefaultClass >= 0 && xnestDefaultClass <= 5) {
+ xnestUserDefaultClass = True;
+ /* lex the OS layer process it as well, so return 0 */
+ }
+ }
+ return 0;
}
- return 0;
- }
- if (!strcmp(argv[i], "-bw")) {
- if (++i < argc && sscanf(argv[i], "%i", &xnestBorderWidth) == 1) {
- if (xnestBorderWidth >= 0) {
- xnestUserBorderWidth = True;
- return 2;
- }
+ if (!strcmp(argv[i], "-depth")) {
+ if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultDepth) == 1) {
+ if (xnestDefaultDepth > 0) {
+ xnestUserDefaultDepth = True;
+ return 2;
+ }
+ }
+ return 0;
}
- return 0;
- }
- if (!strcmp(argv[i], "-name")) {
- if (++i < argc) {
- xnestWindowName = argv[i];
- return 2;
+ if (!strcmp(argv[i], "-sss")) {
+ xnestSoftwareScreenSaver = True;
+ return 1;
}
- return 0;
- }
- if (!strcmp(argv[i], "-scrns")) {
- if (++i < argc && sscanf(argv[i], "%i", &xnestNumScreens) == 1) {
- if (xnestNumScreens > 0) {
- if (xnestNumScreens > MAXSCREENS) {
- ErrorF("Maximum number of screens is %d.\n", MAXSCREENS);
- xnestNumScreens = MAXSCREENS;
- }
- return 2;
- }
+ if (!strcmp(argv[i], "-geometry")) {
+ if (++i < argc) {
+ xnestUserGeometry = XParseGeometry(argv[i],
+ &xnestX, &xnestY,
+ &xnestWidth, &xnestHeight);
+ if (xnestUserGeometry)
+ return 2;
+ }
+ return 0;
}
- return 0;
- }
- if (!strcmp(argv[i], "-install")) {
- xnestDoDirectColormaps = True;
- return 1;
- }
- if (!strcmp(argv[i], "-parent")) {
- if (++i < argc) {
- xnestParentWindow = (XID) strtol (argv[i], (char**)NULL, 0);
- return 2;
+ if (!strcmp(argv[i], "-bw")) {
+ if (++i < argc && sscanf(argv[i], "%i", &xnestBorderWidth) == 1) {
+ if (xnestBorderWidth >= 0) {
+ xnestUserBorderWidth = True;
+ return 2;
+ }
+ }
+ return 0;
+ }
+ if (!strcmp(argv[i], "-name")) {
+ if (++i < argc) {
+ xnestWindowName = argv[i];
+ return 2;
+ }
+ return 0;
+ }
+ if (!strcmp(argv[i], "-scrns")) {
+ if (++i < argc && sscanf(argv[i], "%i", &xnestNumScreens) == 1) {
+ if (xnestNumScreens > 0) {
+ if (xnestNumScreens > MAXSCREENS) {
+ ErrorF("Maximum number of screens is %d.\n", MAXSCREENS);
+ xnestNumScreens = MAXSCREENS;
+ }
+ return 2;
+ }
+ }
+ return 0;
}
- }
- return 0;
+ if (!strcmp(argv[i], "-install")) {
+ xnestDoDirectColormaps = True;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-parent")) {
+ if (++i < argc) {
+ xnestParentWindow = (XID) strtol(argv[i], (char **) NULL, 0);
+ return 2;
+ }
+ }
+ return 0;
}
-void ddxUseMsg(void)
+void
+ddxUseMsg(void)
{
- ErrorF("-display string display name of the real server\n");
- ErrorF("-sync sinchronize with the real server\n");
- ErrorF("-full utilize full regeneration\n");
- ErrorF("-class string default visual class\n");
- ErrorF("-depth int default depth\n");
- ErrorF("-sss use software screen saver\n");
- ErrorF("-geometry WxH+X+Y window size and position\n");
- ErrorF("-bw int window border width\n");
- ErrorF("-name string window name\n");
- ErrorF("-scrns int number of screens to generate\n");
- ErrorF("-install instal colormaps directly\n");
+ ErrorF("-display string display name of the real server\n");
+ ErrorF("-sync sinchronize with the real server\n");
+ ErrorF("-full utilize full regeneration\n");
+ ErrorF("-class string default visual class\n");
+ ErrorF("-depth int default depth\n");
+ ErrorF("-sss use software screen saver\n");
+ ErrorF("-geometry WxH+X+Y window size and position\n");
+ ErrorF("-bw int window border width\n");
+ ErrorF("-name string window name\n");
+ ErrorF("-scrns int number of screens to generate\n");
+ ErrorF("-install instal colormaps directly\n");
}
diff --git a/xorg-server/hw/xnest/Color.c b/xorg-server/hw/xnest/Color.c
index 2548f9495..7ef137d59 100644
--- a/xorg-server/hw/xnest/Color.c
+++ b/xorg-server/hw/xnest/Color.c
@@ -1,495 +1,493 @@
-/*
-
-Copyright 1993 by Davor Matic
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#ifdef HAVE_XNEST_CONFIG_H
-#include <xnest-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "scrnintstr.h"
-#include "window.h"
-#include "windowstr.h"
-#include "colormapst.h"
-#include "resource.h"
-
-#include "Xnest.h"
-
-
-#include "Display.h"
-#include "Screen.h"
-#include "Color.h"
-#include "Visual.h"
-#include "XNWindow.h"
-#include "Args.h"
-
-DevPrivateKeyRec xnestColormapPrivateKeyRec;
-
-static DevPrivateKeyRec cmapScrPrivateKeyRec;
-#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
-
-#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
-#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
-
-Bool
-xnestCreateColormap(ColormapPtr pCmap)
-{
- VisualPtr pVisual;
- XColor *colors;
- int i, ncolors;
- Pixel red, green, blue;
- Pixel redInc, greenInc, blueInc;
-
- pVisual = pCmap->pVisual;
- ncolors = pVisual->ColormapEntries;
-
- xnestColormapPriv(pCmap)->colormap =
- XCreateColormap(xnestDisplay,
- xnestDefaultWindows[pCmap->pScreen->myNum],
- xnestVisual(pVisual),
- (pVisual->class & DynamicClass) ?
- AllocAll : AllocNone);
-
-
- switch (pVisual->class) {
- case StaticGray: /* read only */
- colors = (XColor *)malloc(ncolors * sizeof(XColor));
- for (i = 0; i < ncolors; i++)
- colors[i].pixel = i;
- XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
- for (i = 0; i < ncolors; i++) {
- pCmap->red[i].co.local.red = colors[i].red;
- pCmap->red[i].co.local.green = colors[i].red;
- pCmap->red[i].co.local.blue = colors[i].red;
- }
- free(colors);
- break;
-
- case StaticColor: /* read only */
- colors = (XColor *)malloc(ncolors * sizeof(XColor));
- for (i = 0; i < ncolors; i++)
- colors[i].pixel = i;
- XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
- for (i = 0; i < ncolors; i++) {
- pCmap->red[i].co.local.red = colors[i].red;
- pCmap->red[i].co.local.green = colors[i].green;
- pCmap->red[i].co.local.blue = colors[i].blue;
- }
- free(colors);
- break;
-
- case TrueColor: /* read only */
- colors = (XColor *)malloc(ncolors * sizeof(XColor));
- red = green = blue = 0L;
- redInc = lowbit(pVisual->redMask);
- greenInc = lowbit(pVisual->greenMask);
- blueInc = lowbit(pVisual->blueMask);
- for (i = 0; i < ncolors; i++) {
- colors[i].pixel = red | green | blue;
- red += redInc;
- if (red > pVisual->redMask) red = 0L;
- green += greenInc;
- if (green > pVisual->greenMask) green = 0L;
- blue += blueInc;
- if (blue > pVisual->blueMask) blue = 0L;
- }
- XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
- for (i = 0; i < ncolors; i++) {
- pCmap->red[i].co.local.red = colors[i].red;
- pCmap->green[i].co.local.green = colors[i].green;
- pCmap->blue[i].co.local.blue = colors[i].blue;
- }
- free(colors);
- break;
-
- case GrayScale: /* read and write */
- break;
-
- case PseudoColor: /* read and write */
- break;
-
- case DirectColor: /* read and write */
- break;
- }
-
- return True;
-}
-
-void
-xnestDestroyColormap(ColormapPtr pCmap)
-{
- XFreeColormap(xnestDisplay, xnestColormap(pCmap));
-}
-
-#define SEARCH_PREDICATE \
- (xnestWindow(pWin) != None && wColormap(pWin) == icws->cmapIDs[i])
-
-static int
-xnestCountInstalledColormapWindows(WindowPtr pWin, pointer ptr)
-{
- xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *)ptr;
- int i;
-
- for (i = 0; i < icws->numCmapIDs; i++)
- if (SEARCH_PREDICATE) {
- icws->numWindows++;
- return WT_DONTWALKCHILDREN;
- }
-
- return WT_WALKCHILDREN;
-}
-
-static int
-xnestGetInstalledColormapWindows(WindowPtr pWin, pointer ptr)
-{
- xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *)ptr;
- int i;
-
- for (i = 0; i < icws->numCmapIDs; i++)
- if (SEARCH_PREDICATE) {
- icws->windows[icws->index++] = xnestWindow(pWin);
- return WT_DONTWALKCHILDREN;
- }
-
- return WT_WALKCHILDREN;
-}
-
-static Window *xnestOldInstalledColormapWindows = NULL;
-static int xnestNumOldInstalledColormapWindows = 0;
-
-static Bool
-xnestSameInstalledColormapWindows(Window *windows, int numWindows)
-{
- if (xnestNumOldInstalledColormapWindows != numWindows)
- return False;
-
- if (xnestOldInstalledColormapWindows == windows)
- return True;
-
- if (xnestOldInstalledColormapWindows == NULL || windows == NULL)
- return False;
-
- if (memcmp(xnestOldInstalledColormapWindows, windows,
- numWindows * sizeof(Window)))
- return False;
-
- return True;
-}
-
-void
-xnestSetInstalledColormapWindows(ScreenPtr pScreen)
-{
- xnestInstalledColormapWindows icws;
- int numWindows;
-
- icws.cmapIDs = (Colormap *)malloc(pScreen->maxInstalledCmaps *
- sizeof(Colormap));
- icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
- icws.numWindows = 0;
- WalkTree(pScreen, xnestCountInstalledColormapWindows, (pointer)&icws);
- if (icws.numWindows) {
- icws.windows = (Window *)malloc((icws.numWindows + 1) * sizeof(Window));
- icws.index = 0;
- WalkTree(pScreen, xnestGetInstalledColormapWindows, (pointer)&icws);
- icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
- numWindows = icws.numWindows + 1;
- }
- else {
- icws.windows = NULL;
- numWindows = 0;
- }
-
- free(icws.cmapIDs);
-
- if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
- free(xnestOldInstalledColormapWindows);
-
-#ifdef _XSERVER64
- {
- int i;
- Window64 *windows = (Window64 *)malloc(numWindows * sizeof(Window64));
-
- for(i = 0; i < numWindows; ++i)
- windows[i] = icws.windows[i];
- XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
- windows, numWindows);
- free(windows);
- }
-#else
- XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
- icws.windows, numWindows);
-#endif
-
- xnestOldInstalledColormapWindows = icws.windows;
- xnestNumOldInstalledColormapWindows = icws.numWindows;
-
-#ifdef DUMB_WINDOW_MANAGERS
- /*
- This code is for dumb window managers.
- This will only work with default local visual colormaps.
- */
- if (icws.numWindows)
- {
- WindowPtr pWin;
- Visual *visual;
- ColormapPtr pCmap;
-
- pWin = xnestWindowPtr(icws.windows[0]);
- visual = xnestVisualFromID(pScreen, wVisual(pWin));
-
- if (visual == xnestDefaultVisual(pScreen))
- dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin),
- RT_COLORMAP, serverClient, DixUseAccess);
- else
- dixLookupResourceByType((pointer *)&pCmap, pScreen->defColormap,
- RT_COLORMAP, serverClient, DixUseAccess);
-
- XSetWindowColormap(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- xnestColormap(pCmap));
- }
-#endif /* DUMB_WINDOW_MANAGERS */
- }
- else
- free(icws.windows);
-}
-
-void
-xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
-{
- free(xnestOldInstalledColormapWindows);
-
-#ifdef _XSERVER64
- {
- Window64 window;
-
- window = xnestScreenSaverWindows[pScreen->myNum];
- XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
- &window, 1);
- xnestScreenSaverWindows[pScreen->myNum] = window;
- }
-#else
- XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
- &xnestScreenSaverWindows[pScreen->myNum], 1);
-#endif /* _XSERVER64 */
-
- xnestOldInstalledColormapWindows = NULL;
- xnestNumOldInstalledColormapWindows = 0;
-
- xnestDirectUninstallColormaps(pScreen);
-}
-
-void
-xnestDirectInstallColormaps(ScreenPtr pScreen)
-{
- int i, n;
- Colormap pCmapIDs[MAXCMAPS];
-
- if (!xnestDoDirectColormaps) return;
-
- n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs);
-
- for (i = 0; i < n; i++) {
- ColormapPtr pCmap;
-
- dixLookupResourceByType((pointer *)&pCmap, pCmapIDs[i], RT_COLORMAP,
- serverClient, DixInstallAccess);
- if (pCmap)
- XInstallColormap(xnestDisplay, xnestColormap(pCmap));
- }
-}
-
-void
-xnestDirectUninstallColormaps(ScreenPtr pScreen)
-{
- int i, n;
- Colormap pCmapIDs[MAXCMAPS];
-
- if (!xnestDoDirectColormaps) return;
-
- n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs);
-
- for (i = 0; i < n; i++) {
- ColormapPtr pCmap;
-
- dixLookupResourceByType((pointer *)&pCmap, pCmapIDs[i], RT_COLORMAP,
- serverClient, DixUninstallAccess);
- if (pCmap)
- XUninstallColormap(xnestDisplay, xnestColormap(pCmap));
- }
-}
-
-void
-xnestInstallColormap(ColormapPtr pCmap)
-{
- ColormapPtr pOldCmap = GetInstalledColormap(pCmap->pScreen);
-
- if(pCmap != pOldCmap)
- {
- xnestDirectUninstallColormaps(pCmap->pScreen);
-
- /* Uninstall pInstalledMap. Notify all interested parties. */
- if(pOldCmap != (ColormapPtr)None)
- WalkTree(pCmap->pScreen, TellLostMap, (pointer)&pOldCmap->mid);
-
- SetInstalledColormap(pCmap->pScreen, pCmap);
- WalkTree(pCmap->pScreen, TellGainedMap, (pointer)&pCmap->mid);
-
- xnestSetInstalledColormapWindows(pCmap->pScreen);
- xnestDirectInstallColormaps(pCmap->pScreen);
- }
-}
-
-void
-xnestUninstallColormap(ColormapPtr pCmap)
-{
- ColormapPtr pCurCmap = GetInstalledColormap(pCmap->pScreen);
-
- if(pCmap == pCurCmap)
- {
- if (pCmap->mid != pCmap->pScreen->defColormap)
- {
- dixLookupResourceByType((pointer *)&pCurCmap,
- pCmap->pScreen->defColormap,
- RT_COLORMAP,
- serverClient, DixInstallAccess);
- (*pCmap->pScreen->InstallColormap)(pCurCmap);
- }
- }
-}
-
-static Bool xnestInstalledDefaultColormap = False;
-
-int
-xnestListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIDs)
-{
- if (xnestInstalledDefaultColormap) {
- *pCmapIDs = GetInstalledColormap(pScreen)->mid;
- return 1;
- }
- else
- return 0;
-}
-
-void
-xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors)
-{
- if (pCmap->pVisual->class & DynamicClass)
-#ifdef _XSERVER64
- {
- int i;
- XColor *pColors64 = (XColor *)malloc(nColors * sizeof(XColor) );
-
- for(i = 0; i < nColors; ++i)
- {
- pColors64[i].pixel = pColors[i].pixel;
- pColors64[i].red = pColors[i].red;
- pColors64[i].green = pColors[i].green;
- pColors64[i].blue = pColors[i].blue;
- pColors64[i].flags = pColors[i].flags;
- }
- XStoreColors(xnestDisplay, xnestColormap(pCmap), pColors64, nColors);
- free(pColors64);
- }
-#else
- XStoreColors(xnestDisplay, xnestColormap(pCmap),
- (XColor *)pColors, nColors);
-#endif
-}
-
-void
-xnestResolveColor(unsigned short *pRed, unsigned short *pGreen,
- unsigned short *pBlue, VisualPtr pVisual)
-{
- int shift;
- unsigned int lim;
-
- shift = 16 - pVisual->bitsPerRGBValue;
- lim = (1 << pVisual->bitsPerRGBValue) - 1;
-
- if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor))
- {
- /* rescale to rgb bits */
- *pRed = ((*pRed >> shift) * 65535) / lim;
- *pGreen = ((*pGreen >> shift) * 65535) / lim;
- *pBlue = ((*pBlue >> shift) * 65535) / lim;
- }
- else if (pVisual->class == GrayScale)
- {
- /* rescale to gray then rgb bits */
- *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
- *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
- }
- else if (pVisual->class == StaticGray)
- {
- unsigned int limg;
-
- limg = pVisual->ColormapEntries - 1;
- /* rescale to gray then [0..limg] then [0..65535] then rgb bits */
- *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
- *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg;
- *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
- }
- else
- {
- unsigned limr, limg, limb;
-
- limr = pVisual->redMask >> pVisual->offsetRed;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- /* rescale to [0..limN] then [0..65535] then rgb bits */
- *pRed = ((((((*pRed * (limr + 1)) >> 16) *
- 65535) / limr) >> shift) * 65535) / lim;
- *pGreen = ((((((*pGreen * (limg + 1)) >> 16) *
- 65535) / limg) >> shift) * 65535) / lim;
- *pBlue = ((((((*pBlue * (limb + 1)) >> 16) *
- 65535) / limb) >> shift) * 65535) / lim;
- }
-}
-
-Bool
-xnestCreateDefaultColormap(ScreenPtr pScreen)
-{
- VisualPtr pVisual;
- ColormapPtr pCmap;
- unsigned short zero = 0, ones = 0xFFFF;
- Pixel wp, bp;
-
- if (!dixRegisterPrivateKey(&cmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- for (pVisual = pScreen->visuals;
- pVisual->vid != pScreen->rootVisual;
- pVisual++);
-
- if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pCmap,
- (pVisual->class & DynamicClass) ? AllocNone : AllocAll, 0)
- != Success)
- return False;
-
- wp = pScreen->whitePixel;
- bp = pScreen->blackPixel;
- if ((AllocColor(pCmap, &ones, &ones, &ones, &wp, 0) !=
- Success) ||
- (AllocColor(pCmap, &zero, &zero, &zero, &bp, 0) !=
- Success))
- return FALSE;
- pScreen->whitePixel = wp;
- pScreen->blackPixel = bp;
- (*pScreen->InstallColormap)(pCmap);
-
- xnestInstalledDefaultColormap = True;
-
- return True;
-}
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "window.h"
+#include "windowstr.h"
+#include "colormapst.h"
+#include "resource.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "Color.h"
+#include "Visual.h"
+#include "XNWindow.h"
+#include "Args.h"
+
+DevPrivateKeyRec xnestColormapPrivateKeyRec;
+
+static DevPrivateKeyRec cmapScrPrivateKeyRec;
+
+#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
+
+#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
+#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
+
+Bool
+xnestCreateColormap(ColormapPtr pCmap)
+{
+ VisualPtr pVisual;
+ XColor *colors;
+ int i, ncolors;
+ Pixel red, green, blue;
+ Pixel redInc, greenInc, blueInc;
+
+ pVisual = pCmap->pVisual;
+ ncolors = pVisual->ColormapEntries;
+
+ xnestColormapPriv(pCmap)->colormap =
+ XCreateColormap(xnestDisplay,
+ xnestDefaultWindows[pCmap->pScreen->myNum],
+ xnestVisual(pVisual),
+ (pVisual->class & DynamicClass) ? AllocAll : AllocNone);
+
+ switch (pVisual->class) {
+ case StaticGray: /* read only */
+ colors = (XColor *) malloc(ncolors * sizeof(XColor));
+ for (i = 0; i < ncolors; i++)
+ colors[i].pixel = i;
+ XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
+ for (i = 0; i < ncolors; i++) {
+ pCmap->red[i].co.local.red = colors[i].red;
+ pCmap->red[i].co.local.green = colors[i].red;
+ pCmap->red[i].co.local.blue = colors[i].red;
+ }
+ free(colors);
+ break;
+
+ case StaticColor: /* read only */
+ colors = (XColor *) malloc(ncolors * sizeof(XColor));
+ for (i = 0; i < ncolors; i++)
+ colors[i].pixel = i;
+ XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
+ for (i = 0; i < ncolors; i++) {
+ pCmap->red[i].co.local.red = colors[i].red;
+ pCmap->red[i].co.local.green = colors[i].green;
+ pCmap->red[i].co.local.blue = colors[i].blue;
+ }
+ free(colors);
+ break;
+
+ case TrueColor: /* read only */
+ colors = (XColor *) malloc(ncolors * sizeof(XColor));
+ red = green = blue = 0L;
+ redInc = lowbit(pVisual->redMask);
+ greenInc = lowbit(pVisual->greenMask);
+ blueInc = lowbit(pVisual->blueMask);
+ for (i = 0; i < ncolors; i++) {
+ colors[i].pixel = red | green | blue;
+ red += redInc;
+ if (red > pVisual->redMask)
+ red = 0L;
+ green += greenInc;
+ if (green > pVisual->greenMask)
+ green = 0L;
+ blue += blueInc;
+ if (blue > pVisual->blueMask)
+ blue = 0L;
+ }
+ XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
+ for (i = 0; i < ncolors; i++) {
+ pCmap->red[i].co.local.red = colors[i].red;
+ pCmap->green[i].co.local.green = colors[i].green;
+ pCmap->blue[i].co.local.blue = colors[i].blue;
+ }
+ free(colors);
+ break;
+
+ case GrayScale: /* read and write */
+ break;
+
+ case PseudoColor: /* read and write */
+ break;
+
+ case DirectColor: /* read and write */
+ break;
+ }
+
+ return True;
+}
+
+void
+xnestDestroyColormap(ColormapPtr pCmap)
+{
+ XFreeColormap(xnestDisplay, xnestColormap(pCmap));
+}
+
+#define SEARCH_PREDICATE \
+ (xnestWindow(pWin) != None && wColormap(pWin) == icws->cmapIDs[i])
+
+static int
+xnestCountInstalledColormapWindows(WindowPtr pWin, pointer ptr)
+{
+ xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *) ptr;
+ int i;
+
+ for (i = 0; i < icws->numCmapIDs; i++)
+ if (SEARCH_PREDICATE) {
+ icws->numWindows++;
+ return WT_DONTWALKCHILDREN;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static int
+xnestGetInstalledColormapWindows(WindowPtr pWin, pointer ptr)
+{
+ xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *) ptr;
+ int i;
+
+ for (i = 0; i < icws->numCmapIDs; i++)
+ if (SEARCH_PREDICATE) {
+ icws->windows[icws->index++] = xnestWindow(pWin);
+ return WT_DONTWALKCHILDREN;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static Window *xnestOldInstalledColormapWindows = NULL;
+static int xnestNumOldInstalledColormapWindows = 0;
+
+static Bool
+xnestSameInstalledColormapWindows(Window *windows, int numWindows)
+{
+ if (xnestNumOldInstalledColormapWindows != numWindows)
+ return False;
+
+ if (xnestOldInstalledColormapWindows == windows)
+ return True;
+
+ if (xnestOldInstalledColormapWindows == NULL || windows == NULL)
+ return False;
+
+ if (memcmp(xnestOldInstalledColormapWindows, windows,
+ numWindows * sizeof(Window)))
+ return False;
+
+ return True;
+}
+
+void
+xnestSetInstalledColormapWindows(ScreenPtr pScreen)
+{
+ xnestInstalledColormapWindows icws;
+ int numWindows;
+
+ icws.cmapIDs = (Colormap *) malloc(pScreen->maxInstalledCmaps *
+ sizeof(Colormap));
+ icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
+ icws.numWindows = 0;
+ WalkTree(pScreen, xnestCountInstalledColormapWindows, (pointer) &icws);
+ if (icws.numWindows) {
+ icws.windows =
+ (Window *) malloc((icws.numWindows + 1) * sizeof(Window));
+ icws.index = 0;
+ WalkTree(pScreen, xnestGetInstalledColormapWindows, (pointer) &icws);
+ icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
+ numWindows = icws.numWindows + 1;
+ }
+ else {
+ icws.windows = NULL;
+ numWindows = 0;
+ }
+
+ free(icws.cmapIDs);
+
+ if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
+ free(xnestOldInstalledColormapWindows);
+
+#ifdef _XSERVER64
+ {
+ int i;
+ Window64 *windows =
+ (Window64 *) malloc(numWindows * sizeof(Window64));
+
+ for (i = 0; i < numWindows; ++i)
+ windows[i] = icws.windows[i];
+ XSetWMColormapWindows(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum], windows,
+ numWindows);
+ free(windows);
+ }
+#else
+ XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
+ icws.windows, numWindows);
+#endif
+
+ xnestOldInstalledColormapWindows = icws.windows;
+ xnestNumOldInstalledColormapWindows = icws.numWindows;
+
+#ifdef DUMB_WINDOW_MANAGERS
+ /*
+ This code is for dumb window managers.
+ This will only work with default local visual colormaps.
+ */
+ if (icws.numWindows) {
+ WindowPtr pWin;
+ Visual *visual;
+ ColormapPtr pCmap;
+
+ pWin = xnestWindowPtr(icws.windows[0]);
+ visual = xnestVisualFromID(pScreen, wVisual(pWin));
+
+ if (visual == xnestDefaultVisual(pScreen))
+ dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin),
+ RT_COLORMAP, serverClient,
+ DixUseAccess);
+ else
+ dixLookupResourceByType((pointer *) &pCmap,
+ pScreen->defColormap, RT_COLORMAP,
+ serverClient, DixUseAccess);
+
+ XSetWindowColormap(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ xnestColormap(pCmap));
+ }
+#endif /* DUMB_WINDOW_MANAGERS */
+ }
+ else
+ free(icws.windows);
+}
+
+void
+xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
+{
+ free(xnestOldInstalledColormapWindows);
+
+#ifdef _XSERVER64
+ {
+ Window64 window;
+
+ window = xnestScreenSaverWindows[pScreen->myNum];
+ XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
+ &window, 1);
+ xnestScreenSaverWindows[pScreen->myNum] = window;
+ }
+#else
+ XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
+ &xnestScreenSaverWindows[pScreen->myNum], 1);
+#endif /* _XSERVER64 */
+
+ xnestOldInstalledColormapWindows = NULL;
+ xnestNumOldInstalledColormapWindows = 0;
+
+ xnestDirectUninstallColormaps(pScreen);
+}
+
+void
+xnestDirectInstallColormaps(ScreenPtr pScreen)
+{
+ int i, n;
+ Colormap pCmapIDs[MAXCMAPS];
+
+ if (!xnestDoDirectColormaps)
+ return;
+
+ n = (*pScreen->ListInstalledColormaps) (pScreen, pCmapIDs);
+
+ for (i = 0; i < n; i++) {
+ ColormapPtr pCmap;
+
+ dixLookupResourceByType((pointer *) &pCmap, pCmapIDs[i], RT_COLORMAP,
+ serverClient, DixInstallAccess);
+ if (pCmap)
+ XInstallColormap(xnestDisplay, xnestColormap(pCmap));
+ }
+}
+
+void
+xnestDirectUninstallColormaps(ScreenPtr pScreen)
+{
+ int i, n;
+ Colormap pCmapIDs[MAXCMAPS];
+
+ if (!xnestDoDirectColormaps)
+ return;
+
+ n = (*pScreen->ListInstalledColormaps) (pScreen, pCmapIDs);
+
+ for (i = 0; i < n; i++) {
+ ColormapPtr pCmap;
+
+ dixLookupResourceByType((pointer *) &pCmap, pCmapIDs[i], RT_COLORMAP,
+ serverClient, DixUninstallAccess);
+ if (pCmap)
+ XUninstallColormap(xnestDisplay, xnestColormap(pCmap));
+ }
+}
+
+void
+xnestInstallColormap(ColormapPtr pCmap)
+{
+ ColormapPtr pOldCmap = GetInstalledColormap(pCmap->pScreen);
+
+ if (pCmap != pOldCmap) {
+ xnestDirectUninstallColormaps(pCmap->pScreen);
+
+ /* Uninstall pInstalledMap. Notify all interested parties. */
+ if (pOldCmap != (ColormapPtr) None)
+ WalkTree(pCmap->pScreen, TellLostMap, (pointer) &pOldCmap->mid);
+
+ SetInstalledColormap(pCmap->pScreen, pCmap);
+ WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &pCmap->mid);
+
+ xnestSetInstalledColormapWindows(pCmap->pScreen);
+ xnestDirectInstallColormaps(pCmap->pScreen);
+ }
+}
+
+void
+xnestUninstallColormap(ColormapPtr pCmap)
+{
+ ColormapPtr pCurCmap = GetInstalledColormap(pCmap->pScreen);
+
+ if (pCmap == pCurCmap) {
+ if (pCmap->mid != pCmap->pScreen->defColormap) {
+ dixLookupResourceByType((pointer *) &pCurCmap,
+ pCmap->pScreen->defColormap,
+ RT_COLORMAP,
+ serverClient, DixInstallAccess);
+ (*pCmap->pScreen->InstallColormap) (pCurCmap);
+ }
+ }
+}
+
+static Bool xnestInstalledDefaultColormap = False;
+
+int
+xnestListInstalledColormaps(ScreenPtr pScreen, Colormap * pCmapIDs)
+{
+ if (xnestInstalledDefaultColormap) {
+ *pCmapIDs = GetInstalledColormap(pScreen)->mid;
+ return 1;
+ }
+ else
+ return 0;
+}
+
+void
+xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem * pColors)
+{
+ if (pCmap->pVisual->class & DynamicClass)
+#ifdef _XSERVER64
+ {
+ int i;
+ XColor *pColors64 = (XColor *) malloc(nColors * sizeof(XColor));
+
+ for (i = 0; i < nColors; ++i) {
+ pColors64[i].pixel = pColors[i].pixel;
+ pColors64[i].red = pColors[i].red;
+ pColors64[i].green = pColors[i].green;
+ pColors64[i].blue = pColors[i].blue;
+ pColors64[i].flags = pColors[i].flags;
+ }
+ XStoreColors(xnestDisplay, xnestColormap(pCmap), pColors64, nColors);
+ free(pColors64);
+ }
+#else
+ XStoreColors(xnestDisplay, xnestColormap(pCmap),
+ (XColor *) pColors, nColors);
+#endif
+}
+
+void
+xnestResolveColor(unsigned short *pRed, unsigned short *pGreen,
+ unsigned short *pBlue, VisualPtr pVisual)
+{
+ int shift;
+ unsigned int lim;
+
+ shift = 16 - pVisual->bitsPerRGBValue;
+ lim = (1 << pVisual->bitsPerRGBValue) - 1;
+
+ if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor)) {
+ /* rescale to rgb bits */
+ *pRed = ((*pRed >> shift) * 65535) / lim;
+ *pGreen = ((*pGreen >> shift) * 65535) / lim;
+ *pBlue = ((*pBlue >> shift) * 65535) / lim;
+ }
+ else if (pVisual->class == GrayScale) {
+ /* rescale to gray then rgb bits */
+ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
+ *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
+ }
+ else if (pVisual->class == StaticGray) {
+ unsigned int limg;
+
+ limg = pVisual->ColormapEntries - 1;
+ /* rescale to gray then [0..limg] then [0..65535] then rgb bits */
+ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
+ *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg;
+ *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
+ }
+ else {
+ unsigned limr, limg, limb;
+
+ limr = pVisual->redMask >> pVisual->offsetRed;
+ limg = pVisual->greenMask >> pVisual->offsetGreen;
+ limb = pVisual->blueMask >> pVisual->offsetBlue;
+ /* rescale to [0..limN] then [0..65535] then rgb bits */
+ *pRed = ((((((*pRed * (limr + 1)) >> 16) *
+ 65535) / limr) >> shift) * 65535) / lim;
+ *pGreen = ((((((*pGreen * (limg + 1)) >> 16) *
+ 65535) / limg) >> shift) * 65535) / lim;
+ *pBlue = ((((((*pBlue * (limb + 1)) >> 16) *
+ 65535) / limb) >> shift) * 65535) / lim;
+ }
+}
+
+Bool
+xnestCreateDefaultColormap(ScreenPtr pScreen)
+{
+ VisualPtr pVisual;
+ ColormapPtr pCmap;
+ unsigned short zero = 0, ones = 0xFFFF;
+ Pixel wp, bp;
+
+ if (!dixRegisterPrivateKey(&cmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual; pVisual++);
+
+ if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pCmap,
+ (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
+ 0)
+ != Success)
+ return False;
+
+ wp = pScreen->whitePixel;
+ bp = pScreen->blackPixel;
+ if ((AllocColor(pCmap, &ones, &ones, &ones, &wp, 0) !=
+ Success) ||
+ (AllocColor(pCmap, &zero, &zero, &zero, &bp, 0) != Success))
+ return FALSE;
+ pScreen->whitePixel = wp;
+ pScreen->blackPixel = bp;
+ (*pScreen->InstallColormap) (pCmap);
+
+ xnestInstalledDefaultColormap = True;
+
+ return True;
+}
diff --git a/xorg-server/hw/xnest/Cursor.c b/xorg-server/hw/xnest/Cursor.c
index f35517abb..285e10ebf 100644
--- a/xorg-server/hw/xnest/Cursor.c
+++ b/xorg-server/hw/xnest/Cursor.c
@@ -1,182 +1,173 @@
-/*
-
-Copyright 1993 by Davor Matic
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#ifdef HAVE_XNEST_CONFIG_H
-#include <xnest-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "screenint.h"
-#include "input.h"
-#include "misc.h"
-#include "cursor.h"
-#include "cursorstr.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#include "mipointrst.h"
-
-#include "Xnest.h"
-
-#include "Display.h"
-#include "Screen.h"
-#include "XNCursor.h"
-#include "Visual.h"
-#include "Keyboard.h"
-#include "Args.h"
-
-xnestCursorFuncRec xnestCursorFuncs = {NULL};
-
-Bool
-xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- XImage *ximage;
- Pixmap source, mask;
- XColor fg_color, bg_color;
- unsigned long valuemask;
- XGCValues values;
-
- valuemask = GCFunction |
- GCPlaneMask |
- GCForeground |
- GCBackground |
- GCClipMask;
-
- values.function = GXcopy;
- values.plane_mask = AllPlanes;
- values.foreground = 1L;
- values.background = 0L;
- values.clip_mask = None;
-
- XChangeGC(xnestDisplay, xnestBitmapGC, valuemask, &values);
-
- source = XCreatePixmap(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- pCursor->bits->width,
- pCursor->bits->height,
- 1);
-
- mask = XCreatePixmap(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- pCursor->bits->width,
- pCursor->bits->height,
- 1);
-
- ximage = XCreateImage(xnestDisplay,
- xnestDefaultVisual(pScreen),
- 1, XYBitmap, 0,
- (char *)pCursor->bits->source,
- pCursor->bits->width,
- pCursor->bits->height,
- BitmapPad(xnestDisplay), 0);
-
- XPutImage(xnestDisplay, source, xnestBitmapGC, ximage,
- 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
- XFree(ximage);
-
- ximage = XCreateImage(xnestDisplay,
- xnestDefaultVisual(pScreen),
- 1, XYBitmap, 0,
- (char *)pCursor->bits->mask,
- pCursor->bits->width,
- pCursor->bits->height,
- BitmapPad(xnestDisplay), 0);
-
- XPutImage(xnestDisplay, mask, xnestBitmapGC, ximage,
- 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
- XFree(ximage);
-
- fg_color.red = pCursor->foreRed;
- fg_color.green = pCursor->foreGreen;
- fg_color.blue = pCursor->foreBlue;
-
- bg_color.red = pCursor->backRed;
- bg_color.green = pCursor->backGreen;
- bg_color.blue = pCursor->backBlue;
-
- xnestSetCursorPriv(pCursor, pScreen, malloc(sizeof(xnestPrivCursor)));
- xnestCursor(pCursor, pScreen) =
- XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color,
- pCursor->bits->xhot, pCursor->bits->yhot);
-
- XFreePixmap(xnestDisplay, source);
- XFreePixmap(xnestDisplay, mask);
-
- return True;
-}
-
-Bool
-xnestUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- XFreeCursor(xnestDisplay, xnestCursor(pCursor, pScreen));
- free(xnestGetCursorPriv(pCursor, pScreen));
- return True;
-}
-
-void
-xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed)
-{
- XColor fg_color, bg_color;
-
- fg_color.red = pCursor->foreRed;
- fg_color.green = pCursor->foreGreen;
- fg_color.blue = pCursor->foreBlue;
-
- bg_color.red = pCursor->backRed;
- bg_color.green = pCursor->backGreen;
- bg_color.blue = pCursor->backBlue;
-
- XRecolorCursor(xnestDisplay,
- xnestCursor(pCursor, pScreen),
- &fg_color, &bg_color);
-}
-
-void xnestSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- if (pCursor)
- {
- XDefineCursor(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- xnestCursor(pCursor, pScreen));
- }
-}
-
-void
-xnestMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
-}
-
-Bool
-xnestDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
-{
- xnestCursorFuncPtr pScreenPriv;
-
- pScreenPriv = (xnestCursorFuncPtr)
- dixLookupPrivate(&pScreen->devPrivates, xnestCursorScreenKey);
-
- return pScreenPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen);
-}
-
-void
-xnestDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
-{
- xnestCursorFuncPtr pScreenPriv;
-
- pScreenPriv = (xnestCursorFuncPtr)
- dixLookupPrivate(&pScreen->devPrivates, xnestCursorScreenKey);
-
- pScreenPriv->spriteFuncs->DeviceCursorCleanup(pDev, pScreen);
-}
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "input.h"
+#include "misc.h"
+#include "cursor.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#include "mipointrst.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNCursor.h"
+#include "Visual.h"
+#include "Keyboard.h"
+#include "Args.h"
+
+xnestCursorFuncRec xnestCursorFuncs = { NULL };
+
+Bool
+xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+{
+ XImage *ximage;
+ Pixmap source, mask;
+ XColor fg_color, bg_color;
+ unsigned long valuemask;
+ XGCValues values;
+
+ valuemask = GCFunction |
+ GCPlaneMask | GCForeground | GCBackground | GCClipMask;
+
+ values.function = GXcopy;
+ values.plane_mask = AllPlanes;
+ values.foreground = 1L;
+ values.background = 0L;
+ values.clip_mask = None;
+
+ XChangeGC(xnestDisplay, xnestBitmapGC, valuemask, &values);
+
+ source = XCreatePixmap(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ pCursor->bits->width, pCursor->bits->height, 1);
+
+ mask = XCreatePixmap(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ pCursor->bits->width, pCursor->bits->height, 1);
+
+ ximage = XCreateImage(xnestDisplay,
+ xnestDefaultVisual(pScreen),
+ 1, XYBitmap, 0,
+ (char *) pCursor->bits->source,
+ pCursor->bits->width,
+ pCursor->bits->height, BitmapPad(xnestDisplay), 0);
+
+ XPutImage(xnestDisplay, source, xnestBitmapGC, ximage,
+ 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
+
+ XFree(ximage);
+
+ ximage = XCreateImage(xnestDisplay,
+ xnestDefaultVisual(pScreen),
+ 1, XYBitmap, 0,
+ (char *) pCursor->bits->mask,
+ pCursor->bits->width,
+ pCursor->bits->height, BitmapPad(xnestDisplay), 0);
+
+ XPutImage(xnestDisplay, mask, xnestBitmapGC, ximage,
+ 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
+
+ XFree(ximage);
+
+ fg_color.red = pCursor->foreRed;
+ fg_color.green = pCursor->foreGreen;
+ fg_color.blue = pCursor->foreBlue;
+
+ bg_color.red = pCursor->backRed;
+ bg_color.green = pCursor->backGreen;
+ bg_color.blue = pCursor->backBlue;
+
+ xnestSetCursorPriv(pCursor, pScreen, malloc(sizeof(xnestPrivCursor)));
+ xnestCursor(pCursor, pScreen) =
+ XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color,
+ pCursor->bits->xhot, pCursor->bits->yhot);
+
+ XFreePixmap(xnestDisplay, source);
+ XFreePixmap(xnestDisplay, mask);
+
+ return True;
+}
+
+Bool
+xnestUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+{
+ XFreeCursor(xnestDisplay, xnestCursor(pCursor, pScreen));
+ free(xnestGetCursorPriv(pCursor, pScreen));
+ return True;
+}
+
+void
+xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed)
+{
+ XColor fg_color, bg_color;
+
+ fg_color.red = pCursor->foreRed;
+ fg_color.green = pCursor->foreGreen;
+ fg_color.blue = pCursor->foreBlue;
+
+ bg_color.red = pCursor->backRed;
+ bg_color.green = pCursor->backGreen;
+ bg_color.blue = pCursor->backBlue;
+
+ XRecolorCursor(xnestDisplay,
+ xnestCursor(pCursor, pScreen), &fg_color, &bg_color);
+}
+
+void
+xnestSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
+ int y)
+{
+ if (pCursor) {
+ XDefineCursor(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ xnestCursor(pCursor, pScreen));
+ }
+}
+
+void
+xnestMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+}
+
+Bool
+xnestDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ xnestCursorFuncPtr pScreenPriv;
+
+ pScreenPriv = (xnestCursorFuncPtr)
+ dixLookupPrivate(&pScreen->devPrivates, xnestCursorScreenKey);
+
+ return pScreenPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen);
+}
+
+void
+xnestDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ xnestCursorFuncPtr pScreenPriv;
+
+ pScreenPriv = (xnestCursorFuncPtr)
+ dixLookupPrivate(&pScreen->devPrivates, xnestCursorScreenKey);
+
+ pScreenPriv->spriteFuncs->DeviceCursorCleanup(pDev, pScreen);
+}
diff --git a/xorg-server/hw/xnest/Display.c b/xorg-server/hw/xnest/Display.c
index 3176b60d7..a2f8acbaa 100644
--- a/xorg-server/hw/xnest/Display.c
+++ b/xorg-server/hw/xnest/Display.c
@@ -12,7 +12,6 @@ is" without express or implied warranty.
*/
-
#ifdef HAVE_XNEST_CONFIG_H
#include <xnest-config.h>
#endif
@@ -47,8 +46,8 @@ int *xnestDepths;
int xnestNumDepths;
XPixmapFormatValues *xnestPixmapFormats;
int xnestNumPixmapFormats;
-Pixel xnestBlackPixel;
-Pixel xnestWhitePixel;
+Pixel xnestBlackPixel;
+Pixel xnestWhitePixel;
Drawable xnestDefaultDrawables[MAXDEPTH + 1];
Pixmap xnestIconBitmap;
Pixmap xnestScreenSaverPixmap;
@@ -61,7 +60,8 @@ unsigned long xnestEventMask;
#endif
static int _X_NORETURN
-x_io_error_handler (Display *dpy) {
+x_io_error_handler(Display * dpy)
+{
ErrorF("Lost connection to X server: %s\n", strerror(errno));
CloseWellKnownConnections();
OsCleanup(1);
@@ -71,141 +71,143 @@ x_io_error_handler (Display *dpy) {
void
xnestOpenDisplay(int argc, char *argv[])
{
- XVisualInfo vi;
- long mask;
- int i, j;
-
- if (!xnestDoFullGeneration) return;
-
- XSetIOErrorHandler(x_io_error_handler);
-
- xnestCloseDisplay();
-
- xnestDisplay = XOpenDisplay(xnestDisplayName);
- if (xnestDisplay == NULL)
- FatalError("Unable to open display \"%s\".\n",
- XDisplayName(xnestDisplayName));
-
- if (xnestSynchronize)
- XSynchronize(xnestDisplay, True);
-
- mask = VisualScreenMask;
- vi.screen = DefaultScreen(xnestDisplay);
- xnestVisuals = XGetVisualInfo(xnestDisplay, mask, &vi, &xnestNumVisuals);
- if (xnestNumVisuals == 0 || xnestVisuals == NULL)
- FatalError("Unable to find any visuals.\n");
-
- if (xnestUserDefaultClass || xnestUserDefaultDepth) {
- xnestDefaultVisualIndex = UNDEFINED;
- for (i = 0; i < xnestNumVisuals; i++)
- if ((!xnestUserDefaultClass ||
- xnestVisuals[i].class == xnestDefaultClass)
- &&
- (!xnestUserDefaultDepth ||
- xnestVisuals[i].depth == xnestDefaultDepth)) {
- xnestDefaultVisualIndex = i;
- break;
- }
- if (xnestDefaultVisualIndex == UNDEFINED)
- FatalError("Unable to find desired default visual.\n");
- }
- else {
- vi.visualid = XVisualIDFromVisual(DefaultVisual(xnestDisplay,
- DefaultScreen(xnestDisplay)));
- xnestDefaultVisualIndex = 0;
- for (i = 0; i < xnestNumVisuals; i++)
- if (vi.visualid == xnestVisuals[i].visualid)
- xnestDefaultVisualIndex = i;
- }
-
- xnestNumDefaultColormaps = xnestNumVisuals;
- xnestDefaultColormaps = (Colormap *)malloc(xnestNumDefaultColormaps *
- sizeof(Colormap));
- for (i = 0; i < xnestNumDefaultColormaps; i++)
- xnestDefaultColormaps[i] = XCreateColormap(xnestDisplay,
- DefaultRootWindow(xnestDisplay),
- xnestVisuals[i].visual,
- AllocNone);
-
- xnestDepths = XListDepths(xnestDisplay, DefaultScreen(xnestDisplay),
- &xnestNumDepths);
-
- xnestPixmapFormats = XListPixmapFormats(xnestDisplay,
- &xnestNumPixmapFormats);
-
- xnestBlackPixel = BlackPixel(xnestDisplay, DefaultScreen(xnestDisplay));
- xnestWhitePixel = WhitePixel(xnestDisplay, DefaultScreen(xnestDisplay));
-
- if (xnestParentWindow != (Window) 0)
- xnestEventMask = StructureNotifyMask;
- else
- xnestEventMask = 0L;
-
- for (i = 0; i <= MAXDEPTH; i++)
- xnestDefaultDrawables[i] = None;
-
- for (i = 0; i < xnestNumPixmapFormats; i++)
- for (j = 0; j < xnestNumDepths; j++)
- if (xnestPixmapFormats[i].depth == 1 ||
- xnestPixmapFormats[i].depth == xnestDepths[j]) {
- xnestDefaultDrawables[xnestPixmapFormats[i].depth] =
- XCreatePixmap(xnestDisplay, DefaultRootWindow(xnestDisplay),
- 1, 1, xnestPixmapFormats[i].depth);
- }
-
- xnestBitmapGC = XCreateGC(xnestDisplay, xnestDefaultDrawables[1], 0L, NULL);
-
- if (!(xnestUserGeometry & XValue))
- xnestX = 0;
-
- if (!(xnestUserGeometry & YValue))
- xnestY = 0;
-
- if (xnestParentWindow == 0) {
- if (!(xnestUserGeometry & WidthValue))
- xnestWidth = 3 * DisplayWidth(xnestDisplay,
- DefaultScreen(xnestDisplay)) / 4;
-
- if (!(xnestUserGeometry & HeightValue))
- xnestHeight = 3 * DisplayHeight(xnestDisplay,
- DefaultScreen(xnestDisplay)) / 4;
- }
-
- if (!xnestUserBorderWidth)
- xnestBorderWidth = 1;
-
- xnestIconBitmap =
- XCreateBitmapFromData(xnestDisplay,
- DefaultRootWindow(xnestDisplay),
- (char *)icon_bits,
- icon_width,
- icon_height);
-
- xnestScreenSaverPixmap =
- XCreatePixmapFromBitmapData(xnestDisplay,
- DefaultRootWindow(xnestDisplay),
- (char *)screensaver_bits,
- screensaver_width,
- screensaver_height,
- xnestWhitePixel,
- xnestBlackPixel,
- DefaultDepth(xnestDisplay,
- DefaultScreen(xnestDisplay)));
+ XVisualInfo vi;
+ long mask;
+ int i, j;
+
+ if (!xnestDoFullGeneration)
+ return;
+
+ XSetIOErrorHandler(x_io_error_handler);
+
+ xnestCloseDisplay();
+
+ xnestDisplay = XOpenDisplay(xnestDisplayName);
+ if (xnestDisplay == NULL)
+ FatalError("Unable to open display \"%s\".\n",
+ XDisplayName(xnestDisplayName));
+
+ if (xnestSynchronize)
+ XSynchronize(xnestDisplay, True);
+
+ mask = VisualScreenMask;
+ vi.screen = DefaultScreen(xnestDisplay);
+ xnestVisuals = XGetVisualInfo(xnestDisplay, mask, &vi, &xnestNumVisuals);
+ if (xnestNumVisuals == 0 || xnestVisuals == NULL)
+ FatalError("Unable to find any visuals.\n");
+
+ if (xnestUserDefaultClass || xnestUserDefaultDepth) {
+ xnestDefaultVisualIndex = UNDEFINED;
+ for (i = 0; i < xnestNumVisuals; i++)
+ if ((!xnestUserDefaultClass ||
+ xnestVisuals[i].class == xnestDefaultClass)
+ &&
+ (!xnestUserDefaultDepth ||
+ xnestVisuals[i].depth == xnestDefaultDepth)) {
+ xnestDefaultVisualIndex = i;
+ break;
+ }
+ if (xnestDefaultVisualIndex == UNDEFINED)
+ FatalError("Unable to find desired default visual.\n");
+ }
+ else {
+ vi.visualid = XVisualIDFromVisual(DefaultVisual(xnestDisplay,
+ DefaultScreen
+ (xnestDisplay)));
+ xnestDefaultVisualIndex = 0;
+ for (i = 0; i < xnestNumVisuals; i++)
+ if (vi.visualid == xnestVisuals[i].visualid)
+ xnestDefaultVisualIndex = i;
+ }
+
+ xnestNumDefaultColormaps = xnestNumVisuals;
+ xnestDefaultColormaps = (Colormap *) malloc(xnestNumDefaultColormaps *
+ sizeof(Colormap));
+ for (i = 0; i < xnestNumDefaultColormaps; i++)
+ xnestDefaultColormaps[i] = XCreateColormap(xnestDisplay,
+ DefaultRootWindow
+ (xnestDisplay),
+ xnestVisuals[i].visual,
+ AllocNone);
+
+ xnestDepths = XListDepths(xnestDisplay, DefaultScreen(xnestDisplay),
+ &xnestNumDepths);
+
+ xnestPixmapFormats = XListPixmapFormats(xnestDisplay,
+ &xnestNumPixmapFormats);
+
+ xnestBlackPixel = BlackPixel(xnestDisplay, DefaultScreen(xnestDisplay));
+ xnestWhitePixel = WhitePixel(xnestDisplay, DefaultScreen(xnestDisplay));
+
+ if (xnestParentWindow != (Window) 0)
+ xnestEventMask = StructureNotifyMask;
+ else
+ xnestEventMask = 0L;
+
+ for (i = 0; i <= MAXDEPTH; i++)
+ xnestDefaultDrawables[i] = None;
+
+ for (i = 0; i < xnestNumPixmapFormats; i++)
+ for (j = 0; j < xnestNumDepths; j++)
+ if (xnestPixmapFormats[i].depth == 1 ||
+ xnestPixmapFormats[i].depth == xnestDepths[j]) {
+ xnestDefaultDrawables[xnestPixmapFormats[i].depth] =
+ XCreatePixmap(xnestDisplay, DefaultRootWindow(xnestDisplay),
+ 1, 1, xnestPixmapFormats[i].depth);
+ }
+
+ xnestBitmapGC = XCreateGC(xnestDisplay, xnestDefaultDrawables[1], 0L, NULL);
+
+ if (!(xnestUserGeometry & XValue))
+ xnestX = 0;
+
+ if (!(xnestUserGeometry & YValue))
+ xnestY = 0;
+
+ if (xnestParentWindow == 0) {
+ if (!(xnestUserGeometry & WidthValue))
+ xnestWidth = 3 * DisplayWidth(xnestDisplay,
+ DefaultScreen(xnestDisplay)) / 4;
+
+ if (!(xnestUserGeometry & HeightValue))
+ xnestHeight = 3 * DisplayHeight(xnestDisplay,
+ DefaultScreen(xnestDisplay)) / 4;
+ }
+
+ if (!xnestUserBorderWidth)
+ xnestBorderWidth = 1;
+
+ xnestIconBitmap =
+ XCreateBitmapFromData(xnestDisplay,
+ DefaultRootWindow(xnestDisplay),
+ (char *) icon_bits, icon_width, icon_height);
+
+ xnestScreenSaverPixmap =
+ XCreatePixmapFromBitmapData(xnestDisplay,
+ DefaultRootWindow(xnestDisplay),
+ (char *) screensaver_bits,
+ screensaver_width,
+ screensaver_height,
+ xnestWhitePixel,
+ xnestBlackPixel,
+ DefaultDepth(xnestDisplay,
+ DefaultScreen(xnestDisplay)));
}
void
xnestCloseDisplay(void)
{
- if (!xnestDoFullGeneration || !xnestDisplay) return;
-
- /*
- If xnestDoFullGeneration all x resources will be destroyed upon closing
- the display connection. There is no need to generate extra protocol.
- */
-
- free(xnestDefaultColormaps);
- XFree(xnestVisuals);
- XFree(xnestDepths);
- XFree(xnestPixmapFormats);
- XCloseDisplay(xnestDisplay);
+ if (!xnestDoFullGeneration || !xnestDisplay)
+ return;
+
+ /*
+ If xnestDoFullGeneration all x resources will be destroyed upon closing
+ the display connection. There is no need to generate extra protocol.
+ */
+
+ free(xnestDefaultColormaps);
+ XFree(xnestVisuals);
+ XFree(xnestDepths);
+ XFree(xnestPixmapFormats);
+ XCloseDisplay(xnestDisplay);
}
diff --git a/xorg-server/hw/xnest/Events.c b/xorg-server/hw/xnest/Events.c
index 619427ded..447d5a72b 100644
--- a/xorg-server/hw/xnest/Events.c
+++ b/xorg-server/hw/xnest/Events.c
@@ -46,7 +46,7 @@ CARD32 lastEventTime = 0;
void
ProcessInputEvents(void)
{
- mieqProcessInputEvents();
+ mieqProcessInputEvents();
}
int
@@ -60,158 +60,159 @@ TimeSinceLastInputEvent(void)
void
SetTimeSinceLastInputEvent(void)
{
- lastEventTime = GetTimeInMillis();
+ lastEventTime = GetTimeInMillis();
}
static Bool
-xnestExposurePredicate(Display *display, XEvent *event, char *args)
+xnestExposurePredicate(Display * display, XEvent * event, char *args)
{
- return event->type == Expose || event->type == ProcessedExpose;
+ return event->type == Expose || event->type == ProcessedExpose;
}
static Bool
-xnestNotExposurePredicate(Display *display, XEvent *event, char *args)
+xnestNotExposurePredicate(Display * display, XEvent * event, char *args)
{
- return !xnestExposurePredicate(display, event, args);
+ return !xnestExposurePredicate(display, event, args);
}
void
xnestCollectExposures(void)
{
- XEvent X;
- WindowPtr pWin;
- RegionRec Rgn;
- BoxRec Box;
-
- while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) {
- pWin = xnestWindowPtr(X.xexpose.window);
-
- if (pWin && X.xexpose.width && X.xexpose.height) {
- Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x;
- Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y;
- Box.x2 = Box.x1 + X.xexpose.width;
- Box.y2 = Box.y1 + X.xexpose.height;
-
- RegionInit(&Rgn, &Box, 1);
-
- miSendExposures(pWin, &Rgn, Box.x2, Box.y2);
+ XEvent X;
+ WindowPtr pWin;
+ RegionRec Rgn;
+ BoxRec Box;
+
+ while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) {
+ pWin = xnestWindowPtr(X.xexpose.window);
+
+ if (pWin && X.xexpose.width && X.xexpose.height) {
+ Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x;
+ Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y;
+ Box.x2 = Box.x1 + X.xexpose.width;
+ Box.y2 = Box.y1 + X.xexpose.height;
+
+ RegionInit(&Rgn, &Box, 1);
+
+ miSendExposures(pWin, &Rgn, Box.x2, Box.y2);
+ }
}
- }
}
void
xnestQueueKeyEvent(int type, unsigned int keycode)
{
- lastEventTime = GetTimeInMillis();
- QueueKeyboardEvents(xnestKeyboardDevice, type, keycode, NULL);
+ lastEventTime = GetTimeInMillis();
+ QueueKeyboardEvents(xnestKeyboardDevice, type, keycode, NULL);
}
void
xnestCollectEvents(void)
{
- XEvent X;
- int valuators[2];
- ValuatorMask mask;
- ScreenPtr pScreen;
-
- while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
- switch (X.type) {
- case KeyPress:
- xnestUpdateModifierState(X.xkey.state);
- xnestQueueKeyEvent(KeyPress, X.xkey.keycode);
- break;
-
- case KeyRelease:
- xnestUpdateModifierState(X.xkey.state);
- xnestQueueKeyEvent(KeyRelease, X.xkey.keycode);
- break;
-
- case ButtonPress:
- valuator_mask_set_range(&mask, 0, 0, NULL);
- xnestUpdateModifierState(X.xkey.state);
- lastEventTime = GetTimeInMillis();
- QueuePointerEvents(xnestPointerDevice, ButtonPress,
- X.xbutton.button, POINTER_RELATIVE, &mask);
- break;
-
- case ButtonRelease:
- valuator_mask_set_range(&mask, 0, 0, NULL);
- xnestUpdateModifierState(X.xkey.state);
- lastEventTime = GetTimeInMillis();
- QueuePointerEvents(xnestPointerDevice, ButtonRelease,
- X.xbutton.button, POINTER_RELATIVE, &mask);
- break;
-
- case MotionNotify:
- valuators[0] = X.xmotion.x;
- valuators[1] = X.xmotion.y;
- valuator_mask_set_range(&mask, 0, 2, valuators);
- lastEventTime = GetTimeInMillis();
- QueuePointerEvents(xnestPointerDevice, MotionNotify,
- 0, POINTER_ABSOLUTE, &mask);
- break;
-
- case FocusIn:
- if (X.xfocus.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xfocus.window);
- if (pScreen)
- xnestDirectInstallColormaps(pScreen);
- }
- break;
-
- case FocusOut:
- if (X.xfocus.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xfocus.window);
- if (pScreen)
- xnestDirectUninstallColormaps(pScreen);
- }
- break;
-
- case KeymapNotify:
- break;
-
- case EnterNotify:
- if (X.xcrossing.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xcrossing.window);
- if (pScreen) {
- NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x, X.xcrossing.y);
- valuators[0] = X.xcrossing.x;
- valuators[1] = X.xcrossing.y;
- valuator_mask_set_range(&mask, 0, 2, valuators);
- lastEventTime = GetTimeInMillis();
- QueuePointerEvents(xnestPointerDevice, MotionNotify,
- 0, POINTER_ABSOLUTE, &mask);
- xnestDirectInstallColormaps(pScreen);
- }
- }
- break;
-
- case LeaveNotify:
- if (X.xcrossing.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xcrossing.window);
- if (pScreen) {
- xnestDirectUninstallColormaps(pScreen);
- }
- }
- break;
-
- case DestroyNotify:
- if (xnestParentWindow != (Window) 0 &&
- X.xdestroywindow.window == xnestParentWindow)
- exit (0);
- break;
-
- case CirculateNotify:
- case ConfigureNotify:
- case GravityNotify:
- case MapNotify:
- case ReparentNotify:
- case UnmapNotify:
- break;
-
- default:
- ErrorF("xnest warning: unhandled event\n");
- break;
+ XEvent X;
+ int valuators[2];
+ ValuatorMask mask;
+ ScreenPtr pScreen;
+
+ while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
+ switch (X.type) {
+ case KeyPress:
+ xnestUpdateModifierState(X.xkey.state);
+ xnestQueueKeyEvent(KeyPress, X.xkey.keycode);
+ break;
+
+ case KeyRelease:
+ xnestUpdateModifierState(X.xkey.state);
+ xnestQueueKeyEvent(KeyRelease, X.xkey.keycode);
+ break;
+
+ case ButtonPress:
+ valuator_mask_set_range(&mask, 0, 0, NULL);
+ xnestUpdateModifierState(X.xkey.state);
+ lastEventTime = GetTimeInMillis();
+ QueuePointerEvents(xnestPointerDevice, ButtonPress,
+ X.xbutton.button, POINTER_RELATIVE, &mask);
+ break;
+
+ case ButtonRelease:
+ valuator_mask_set_range(&mask, 0, 0, NULL);
+ xnestUpdateModifierState(X.xkey.state);
+ lastEventTime = GetTimeInMillis();
+ QueuePointerEvents(xnestPointerDevice, ButtonRelease,
+ X.xbutton.button, POINTER_RELATIVE, &mask);
+ break;
+
+ case MotionNotify:
+ valuators[0] = X.xmotion.x;
+ valuators[1] = X.xmotion.y;
+ valuator_mask_set_range(&mask, 0, 2, valuators);
+ lastEventTime = GetTimeInMillis();
+ QueuePointerEvents(xnestPointerDevice, MotionNotify,
+ 0, POINTER_ABSOLUTE, &mask);
+ break;
+
+ case FocusIn:
+ if (X.xfocus.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xfocus.window);
+ if (pScreen)
+ xnestDirectInstallColormaps(pScreen);
+ }
+ break;
+
+ case FocusOut:
+ if (X.xfocus.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xfocus.window);
+ if (pScreen)
+ xnestDirectUninstallColormaps(pScreen);
+ }
+ break;
+
+ case KeymapNotify:
+ break;
+
+ case EnterNotify:
+ if (X.xcrossing.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xcrossing.window);
+ if (pScreen) {
+ NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x,
+ X.xcrossing.y);
+ valuators[0] = X.xcrossing.x;
+ valuators[1] = X.xcrossing.y;
+ valuator_mask_set_range(&mask, 0, 2, valuators);
+ lastEventTime = GetTimeInMillis();
+ QueuePointerEvents(xnestPointerDevice, MotionNotify,
+ 0, POINTER_ABSOLUTE, &mask);
+ xnestDirectInstallColormaps(pScreen);
+ }
+ }
+ break;
+
+ case LeaveNotify:
+ if (X.xcrossing.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xcrossing.window);
+ if (pScreen) {
+ xnestDirectUninstallColormaps(pScreen);
+ }
+ }
+ break;
+
+ case DestroyNotify:
+ if (xnestParentWindow != (Window) 0 &&
+ X.xdestroywindow.window == xnestParentWindow)
+ exit(0);
+ break;
+
+ case CirculateNotify:
+ case ConfigureNotify:
+ case GravityNotify:
+ case MapNotify:
+ case ReparentNotify:
+ case UnmapNotify:
+ break;
+
+ default:
+ ErrorF("xnest warning: unhandled event\n");
+ break;
+ }
}
- }
}
diff --git a/xorg-server/hw/xnest/Font.c b/xorg-server/hw/xnest/Font.c
index 87e622680..1e95588ef 100644
--- a/xorg-server/hw/xnest/Font.c
+++ b/xorg-server/hw/xnest/Font.c
@@ -1,86 +1,88 @@
-/*
-
-Copyright 1993 by Davor Matic
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#ifdef HAVE_XNEST_CONFIG_H
-#include <xnest-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xatom.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "regionstr.h"
-#include <X11/fonts/font.h>
-#include <X11/fonts/fontstruct.h>
-#include "scrnintstr.h"
-
-#include "Xnest.h"
-
-#include "Display.h"
-#include "XNFont.h"
-
-int xnestFontPrivateIndex;
-
-Bool
-xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
-{
- pointer priv;
- Atom name_atom, value_atom;
- int nprops;
- FontPropPtr props;
- int i;
- const char *name;
-
- FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
-
- name_atom = MakeAtom("FONT", 4, True);
- value_atom = 0L;
-
- nprops = pFont->info.nprops;
- props = pFont->info.props;
-
- for (i = 0; i < nprops; i++)
- if (props[i].name == name_atom) {
- value_atom = props[i].value;
- break;
- }
-
- if (!value_atom) return False;
-
- name = NameForAtom(value_atom);
-
- if (!name) return False;
-
- priv = (pointer)malloc(sizeof(xnestPrivFont));
- FontSetPrivate(pFont, xnestFontPrivateIndex, priv);
-
- xnestFontPriv(pFont)->font_struct = XLoadQueryFont(xnestDisplay, name);
-
- if (!xnestFontStruct(pFont)) return False;
-
- return True;
-}
-
-
-Bool
-xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
-{
- if (xnestFontPriv(pFont)) {
- if (xnestFontStruct(pFont))
- XFreeFont(xnestDisplay, xnestFontStruct(pFont));
- free(xnestFontPriv(pFont));
- FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
- }
- return True;
-}
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xatom.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "regionstr.h"
+#include <X11/fonts/font.h>
+#include <X11/fonts/fontstruct.h>
+#include "scrnintstr.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "XNFont.h"
+
+int xnestFontPrivateIndex;
+
+Bool
+xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ pointer priv;
+ Atom name_atom, value_atom;
+ int nprops;
+ FontPropPtr props;
+ int i;
+ const char *name;
+
+ FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
+
+ name_atom = MakeAtom("FONT", 4, True);
+ value_atom = 0L;
+
+ nprops = pFont->info.nprops;
+ props = pFont->info.props;
+
+ for (i = 0; i < nprops; i++)
+ if (props[i].name == name_atom) {
+ value_atom = props[i].value;
+ break;
+ }
+
+ if (!value_atom)
+ return False;
+
+ name = NameForAtom(value_atom);
+
+ if (!name)
+ return False;
+
+ priv = (pointer) malloc(sizeof(xnestPrivFont));
+ FontSetPrivate(pFont, xnestFontPrivateIndex, priv);
+
+ xnestFontPriv(pFont)->font_struct = XLoadQueryFont(xnestDisplay, name);
+
+ if (!xnestFontStruct(pFont))
+ return False;
+
+ return True;
+}
+
+Bool
+xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ if (xnestFontPriv(pFont)) {
+ if (xnestFontStruct(pFont))
+ XFreeFont(xnestDisplay, xnestFontStruct(pFont));
+ free(xnestFontPriv(pFont));
+ FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
+ }
+ return True;
+}
diff --git a/xorg-server/hw/xnest/GC.c b/xorg-server/hw/xnest/GC.c
index 48fe4dcbc..cfaf71475 100644
--- a/xorg-server/hw/xnest/GC.c
+++ b/xorg-server/hw/xnest/GC.c
@@ -29,7 +29,7 @@ is" without express or implied warranty.
#include "Xnest.h"
#include "Display.h"
-#include "XNGC.h"
+#include "XNGC.h"
#include "GCOps.h"
#include "Drawable.h"
#include "XNFont.h"
@@ -38,51 +38,51 @@ is" without express or implied warranty.
DevPrivateKeyRec xnestGCPrivateKeyRec;
static GCFuncs xnestFuncs = {
- xnestValidateGC,
- xnestChangeGC,
- xnestCopyGC,
- xnestDestroyGC,
- xnestChangeClip,
- xnestDestroyClip,
- xnestCopyClip,
+ xnestValidateGC,
+ xnestChangeGC,
+ xnestCopyGC,
+ xnestDestroyGC,
+ xnestChangeClip,
+ xnestDestroyClip,
+ xnestCopyClip,
};
static GCOps xnestOps = {
- xnestFillSpans,
- xnestSetSpans,
- xnestPutImage,
- xnestCopyArea,
- xnestCopyPlane,
- xnestPolyPoint,
- xnestPolylines,
- xnestPolySegment,
- xnestPolyRectangle,
- xnestPolyArc,
- xnestFillPolygon,
- xnestPolyFillRect,
- xnestPolyFillArc,
- xnestPolyText8,
- xnestPolyText16,
- xnestImageText8,
- xnestImageText16,
- xnestImageGlyphBlt,
- xnestPolyGlyphBlt,
- xnestPushPixels
+ xnestFillSpans,
+ xnestSetSpans,
+ xnestPutImage,
+ xnestCopyArea,
+ xnestCopyPlane,
+ xnestPolyPoint,
+ xnestPolylines,
+ xnestPolySegment,
+ xnestPolyRectangle,
+ xnestPolyArc,
+ xnestFillPolygon,
+ xnestPolyFillRect,
+ xnestPolyFillArc,
+ xnestPolyText8,
+ xnestPolyText16,
+ xnestImageText8,
+ xnestImageText16,
+ xnestImageGlyphBlt,
+ xnestPolyGlyphBlt,
+ xnestPushPixels
};
Bool
xnestCreateGC(GCPtr pGC)
{
- pGC->funcs = &xnestFuncs;
- pGC->ops = &xnestOps;
-
- pGC->miTranslate = 1;
-
- xnestGCPriv(pGC)->gc = XCreateGC(xnestDisplay,
- xnestDefaultDrawables[pGC->depth],
- 0L, NULL);
-
- return True;
+ pGC->funcs = &xnestFuncs;
+ pGC->ops = &xnestOps;
+
+ pGC->miTranslate = 1;
+
+ xnestGCPriv(pGC)->gc = XCreateGC(xnestDisplay,
+ xnestDefaultDrawables[pGC->depth],
+ 0L, NULL);
+
+ return True;
}
void
@@ -93,238 +93,236 @@ xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
void
xnestChangeGC(GCPtr pGC, unsigned long mask)
{
- XGCValues values;
-
- if (mask & GCFunction)
- values.function = pGC->alu;
-
- if (mask & GCPlaneMask)
- values.plane_mask = pGC->planemask;
-
- if (mask & GCForeground)
- values.foreground = xnestPixel(pGC->fgPixel);
-
- if (mask & GCBackground)
- values.background = xnestPixel(pGC->bgPixel);
-
- if (mask & GCLineWidth)
- values.line_width = pGC->lineWidth;
-
- if (mask & GCLineStyle)
- values.line_style = pGC->lineStyle;
-
- if (mask & GCCapStyle)
- values.cap_style = pGC->capStyle;
-
- if (mask & GCJoinStyle)
- values.join_style = pGC->joinStyle;
-
- if (mask & GCFillStyle)
- values.fill_style = pGC->fillStyle;
-
- if (mask & GCFillRule)
- values.fill_rule = pGC->fillRule;
-
- if (mask & GCTile) {
- if (pGC->tileIsPixel)
- mask &= ~GCTile;
- else
- values.tile = xnestPixmap(pGC->tile.pixmap);
- }
-
- if (mask & GCStipple)
- values.stipple = xnestPixmap(pGC->stipple);
-
- if (mask & GCTileStipXOrigin)
- values.ts_x_origin = pGC->patOrg.x;
-
- if (mask & GCTileStipYOrigin)
- values.ts_y_origin = pGC->patOrg.y;
-
- if (mask & GCFont)
- values.font = xnestFont(pGC->font);
-
- if (mask & GCSubwindowMode)
- values.subwindow_mode = pGC->subWindowMode;
-
- if (mask & GCGraphicsExposures)
- values.graphics_exposures = pGC->graphicsExposures;
-
- if (mask & GCClipXOrigin)
- values.clip_x_origin = pGC->clipOrg.x;
-
- if (mask & GCClipYOrigin)
- values.clip_y_origin = pGC->clipOrg.y;
-
- if (mask & GCClipMask) /* this is handled in change clip */
- mask &= ~GCClipMask;
-
- if (mask & GCDashOffset)
- values.dash_offset = pGC->dashOffset;
-
- if (mask & GCDashList) {
- mask &= ~GCDashList;
- XSetDashes(xnestDisplay, xnestGC(pGC),
- pGC->dashOffset, (char *)pGC->dash, pGC->numInDashList);
- }
-
- if (mask & GCArcMode)
- values.arc_mode = pGC->arcMode;
-
- if (mask)
- XChangeGC(xnestDisplay, xnestGC(pGC), mask, &values);
+ XGCValues values;
+
+ if (mask & GCFunction)
+ values.function = pGC->alu;
+
+ if (mask & GCPlaneMask)
+ values.plane_mask = pGC->planemask;
+
+ if (mask & GCForeground)
+ values.foreground = xnestPixel(pGC->fgPixel);
+
+ if (mask & GCBackground)
+ values.background = xnestPixel(pGC->bgPixel);
+
+ if (mask & GCLineWidth)
+ values.line_width = pGC->lineWidth;
+
+ if (mask & GCLineStyle)
+ values.line_style = pGC->lineStyle;
+
+ if (mask & GCCapStyle)
+ values.cap_style = pGC->capStyle;
+
+ if (mask & GCJoinStyle)
+ values.join_style = pGC->joinStyle;
+
+ if (mask & GCFillStyle)
+ values.fill_style = pGC->fillStyle;
+
+ if (mask & GCFillRule)
+ values.fill_rule = pGC->fillRule;
+
+ if (mask & GCTile) {
+ if (pGC->tileIsPixel)
+ mask &= ~GCTile;
+ else
+ values.tile = xnestPixmap(pGC->tile.pixmap);
+ }
+
+ if (mask & GCStipple)
+ values.stipple = xnestPixmap(pGC->stipple);
+
+ if (mask & GCTileStipXOrigin)
+ values.ts_x_origin = pGC->patOrg.x;
+
+ if (mask & GCTileStipYOrigin)
+ values.ts_y_origin = pGC->patOrg.y;
+
+ if (mask & GCFont)
+ values.font = xnestFont(pGC->font);
+
+ if (mask & GCSubwindowMode)
+ values.subwindow_mode = pGC->subWindowMode;
+
+ if (mask & GCGraphicsExposures)
+ values.graphics_exposures = pGC->graphicsExposures;
+
+ if (mask & GCClipXOrigin)
+ values.clip_x_origin = pGC->clipOrg.x;
+
+ if (mask & GCClipYOrigin)
+ values.clip_y_origin = pGC->clipOrg.y;
+
+ if (mask & GCClipMask) /* this is handled in change clip */
+ mask &= ~GCClipMask;
+
+ if (mask & GCDashOffset)
+ values.dash_offset = pGC->dashOffset;
+
+ if (mask & GCDashList) {
+ mask &= ~GCDashList;
+ XSetDashes(xnestDisplay, xnestGC(pGC),
+ pGC->dashOffset, (char *) pGC->dash, pGC->numInDashList);
+ }
+
+ if (mask & GCArcMode)
+ values.arc_mode = pGC->arcMode;
+
+ if (mask)
+ XChangeGC(xnestDisplay, xnestGC(pGC), mask, &values);
}
void
xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
{
- XCopyGC(xnestDisplay, xnestGC(pGCSrc), mask, xnestGC(pGCDst));
+ XCopyGC(xnestDisplay, xnestGC(pGCSrc), mask, xnestGC(pGCDst));
}
void
xnestDestroyGC(GCPtr pGC)
{
- XFreeGC(xnestDisplay, xnestGC(pGC));
+ XFreeGC(xnestDisplay, xnestGC(pGC));
}
void
xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
{
- int i, size;
- BoxPtr pBox;
- XRectangle *pRects;
+ int i, size;
+ BoxPtr pBox;
+ XRectangle *pRects;
- xnestDestroyClipHelper(pGC);
+ xnestDestroyClipHelper(pGC);
- switch(type)
- {
+ switch (type) {
case CT_NONE:
- XSetClipMask(xnestDisplay, xnestGC(pGC), None);
- break;
-
+ XSetClipMask(xnestDisplay, xnestGC(pGC), None);
+ break;
+
case CT_REGION:
- nRects = RegionNumRects((RegionPtr)pValue);
- size = nRects * sizeof(*pRects);
- pRects = (XRectangle *) malloc(size);
- pBox = RegionRects((RegionPtr)pValue);
- for (i = nRects; i-- > 0; ) {
- pRects[i].x = pBox[i].x1;
- pRects[i].y = pBox[i].y1;
- pRects[i].width = pBox[i].x2 - pBox[i].x1;
- pRects[i].height = pBox[i].y2 - pBox[i].y1;
- }
- XSetClipRectangles(xnestDisplay, xnestGC(pGC), 0, 0,
- pRects, nRects, Unsorted);
- free((char *) pRects);
- break;
+ nRects = RegionNumRects((RegionPtr) pValue);
+ size = nRects * sizeof(*pRects);
+ pRects = (XRectangle *) malloc(size);
+ pBox = RegionRects((RegionPtr) pValue);
+ for (i = nRects; i-- > 0;) {
+ pRects[i].x = pBox[i].x1;
+ pRects[i].y = pBox[i].y1;
+ pRects[i].width = pBox[i].x2 - pBox[i].x1;
+ pRects[i].height = pBox[i].y2 - pBox[i].y1;
+ }
+ XSetClipRectangles(xnestDisplay, xnestGC(pGC), 0, 0,
+ pRects, nRects, Unsorted);
+ free((char *) pRects);
+ break;
case CT_PIXMAP:
- XSetClipMask(xnestDisplay, xnestGC(pGC),
- xnestPixmap((PixmapPtr)pValue));
- /*
- * Need to change into region, so subsequent uses are with
- * current pixmap contents.
- */
- pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pValue);
- (*pGC->pScreen->DestroyPixmap)((PixmapPtr)pValue);
- pValue = pGC->clientClip;
- type = CT_REGION;
- break;
+ XSetClipMask(xnestDisplay, xnestGC(pGC),
+ xnestPixmap((PixmapPtr) pValue));
+ /*
+ * Need to change into region, so subsequent uses are with
+ * current pixmap contents.
+ */
+ pGC->clientClip =
+ (pointer) (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue);
+ (*pGC->pScreen->DestroyPixmap) ((PixmapPtr) pValue);
+ pValue = pGC->clientClip;
+ type = CT_REGION;
+ break;
case CT_UNSORTED:
- XSetClipRectangles(xnestDisplay, xnestGC(pGC),
- pGC->clipOrg.x, pGC->clipOrg.y,
- (XRectangle *)pValue, nRects, Unsorted);
- break;
+ XSetClipRectangles(xnestDisplay, xnestGC(pGC),
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ (XRectangle *) pValue, nRects, Unsorted);
+ break;
case CT_YSORTED:
- XSetClipRectangles(xnestDisplay, xnestGC(pGC),
- pGC->clipOrg.x, pGC->clipOrg.y,
- (XRectangle *)pValue, nRects, YSorted);
- break;
+ XSetClipRectangles(xnestDisplay, xnestGC(pGC),
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ (XRectangle *) pValue, nRects, YSorted);
+ break;
case CT_YXSORTED:
- XSetClipRectangles(xnestDisplay, xnestGC(pGC),
- pGC->clipOrg.x, pGC->clipOrg.y,
- (XRectangle *)pValue, nRects, YXSorted);
- break;
+ XSetClipRectangles(xnestDisplay, xnestGC(pGC),
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ (XRectangle *) pValue, nRects, YXSorted);
+ break;
case CT_YXBANDED:
- XSetClipRectangles(xnestDisplay, xnestGC(pGC),
- pGC->clipOrg.x, pGC->clipOrg.y,
- (XRectangle *)pValue, nRects, YXBanded);
- break;
+ XSetClipRectangles(xnestDisplay, xnestGC(pGC),
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ (XRectangle *) pValue, nRects, YXBanded);
+ break;
}
- switch(type)
- {
+ switch (type) {
default:
- break;
+ break;
case CT_UNSORTED:
case CT_YSORTED:
case CT_YXSORTED:
case CT_YXBANDED:
-
- /*
- * other parts of server can only deal with CT_NONE,
- * CT_PIXMAP and CT_REGION client clips.
- */
- pGC->clientClip = (pointer) RegionFromRects(nRects,
- (xRectangle *)pValue, type);
- free(pValue);
- pValue = pGC->clientClip;
- type = CT_REGION;
-
- break;
+
+ /*
+ * other parts of server can only deal with CT_NONE,
+ * CT_PIXMAP and CT_REGION client clips.
+ */
+ pGC->clientClip = (pointer) RegionFromRects(nRects,
+ (xRectangle *) pValue,
+ type);
+ free(pValue);
+ pValue = pGC->clientClip;
+ type = CT_REGION;
+
+ break;
}
- pGC->clientClipType = type;
- pGC->clientClip = pValue;
+ pGC->clientClipType = type;
+ pGC->clientClip = pValue;
}
void
xnestDestroyClip(GCPtr pGC)
{
- xnestDestroyClipHelper(pGC);
+ xnestDestroyClipHelper(pGC);
- XSetClipMask(xnestDisplay, xnestGC(pGC), None);
-
- pGC->clientClipType = CT_NONE;
- pGC->clientClip = NULL;
+ XSetClipMask(xnestDisplay, xnestGC(pGC), None);
+
+ pGC->clientClipType = CT_NONE;
+ pGC->clientClip = NULL;
}
void
xnestDestroyClipHelper(GCPtr pGC)
{
- switch (pGC->clientClipType)
- {
+ switch (pGC->clientClipType) {
default:
case CT_NONE:
- break;
-
+ break;
+
case CT_REGION:
- RegionDestroy(pGC->clientClip);
- break;
+ RegionDestroy(pGC->clientClip);
+ break;
}
}
void
xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
{
- RegionPtr pRgn;
+ RegionPtr pRgn;
- switch (pGCSrc->clientClipType)
- {
+ switch (pGCSrc->clientClipType) {
default:
case CT_NONE:
- xnestDestroyClip(pGCDst);
- break;
+ xnestDestroyClip(pGCDst);
+ break;
case CT_REGION:
- pRgn = RegionCreate(NULL, 1);
- RegionCopy(pRgn, pGCSrc->clientClip);
- xnestChangeClip(pGCDst, CT_REGION, pRgn, 0);
- break;
+ pRgn = RegionCreate(NULL, 1);
+ RegionCopy(pRgn, pGCSrc->clientClip);
+ xnestChangeClip(pGCDst, CT_REGION, pRgn, 0);
+ break;
}
}
diff --git a/xorg-server/hw/xnest/GCOps.c b/xorg-server/hw/xnest/GCOps.c
index d19ec6710..e26a1363b 100644
--- a/xorg-server/hw/xnest/GCOps.c
+++ b/xorg-server/hw/xnest/GCOps.c
@@ -1,327 +1,326 @@
-/*
-
-Copyright 1993 by Davor Matic
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#ifdef HAVE_XNEST_CONFIG_H
-#include <xnest-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "regionstr.h"
-#include <X11/fonts/fontstruct.h>
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "region.h"
-#include "servermd.h"
-
-#include "Xnest.h"
-
-#include "Display.h"
-#include "Screen.h"
-#include "XNGC.h"
-#include "XNFont.h"
-#include "GCOps.h"
-#include "Drawable.h"
-#include "Visual.h"
-
-void
-xnestFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, xPoint *pPoints,
- int *pWidths, int fSorted)
-{
- ErrorF("xnest warning: function xnestFillSpans not implemented\n");
-}
-
-void
-xnestSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
- xPoint *pPoints, int *pWidths, int nSpans, int fSorted)
-{
- ErrorF("xnest warning: function xnestSetSpans not implemented\n");
-}
-
-void
-xnestGetSpans(DrawablePtr pDrawable, int maxWidth, DDXPointPtr pPoints,
- int *pWidths, int nSpans, char *pBuffer)
-{
- ErrorF("xnest warning: function xnestGetSpans not implemented\n");
-}
-
-void
-xnestQueryBestSize(int class, unsigned short *pWidth, unsigned short *pHeight,
- ScreenPtr pScreen)
-{
- unsigned int width, height;
-
- width = *pWidth;
- height = *pHeight;
-
- XQueryBestSize(xnestDisplay, class,
- xnestDefaultWindows[pScreen->myNum],
- width, height, &width, &height);
-
- *pWidth = width;
- *pHeight = height;
-}
-
-void
-xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *pImage)
-{
- XImage *ximage;
-
- ximage = XCreateImage(xnestDisplay, xnestDefaultVisual(pDrawable->pScreen),
- depth, format, leftPad, (char *)pImage,
- w, h, BitmapPad(xnestDisplay),
- (format == ZPixmap) ?
- PixmapBytePad(w, depth) : BitmapBytePad(w+leftPad));
-
- if (ximage) {
- XPutImage(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- ximage, 0, 0, x, y, w, h);
- XFree(ximage);
- }
-}
-
-void
-xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask,
- char *pImage)
-{
- XImage *ximage;
- int length;
-
- ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
- x, y, w, h, planeMask, format);
-
- if (ximage) {
- length = ximage->bytes_per_line * ximage->height;
-
- memmove(pImage, ximage->data, length);
-
- XDestroyImage(ximage);
- }
-}
-
-static Bool
-xnestBitBlitPredicate(Display *display, XEvent *event, char *args)
-{
- return event->type == GraphicsExpose || event->type == NoExpose;
-}
-
-static RegionPtr
-xnestBitBlitHelper(GCPtr pGC)
-{
- if (!pGC->graphicsExposures)
- return NullRegion;
- else {
- XEvent event;
- RegionPtr pReg, pTmpReg;
- BoxRec Box;
- Bool pending, overlap;
-
- pReg = RegionCreate(NULL, 1);
- pTmpReg = RegionCreate(NULL, 1);
- if(!pReg || !pTmpReg) return NullRegion;
-
- pending = True;
- while (pending) {
- XIfEvent(xnestDisplay, &event, xnestBitBlitPredicate, NULL);
-
- switch (event.type) {
- case NoExpose:
- pending = False;
- break;
-
- case GraphicsExpose:
- Box.x1 = event.xgraphicsexpose.x;
- Box.y1 = event.xgraphicsexpose.y;
- Box.x2 = event.xgraphicsexpose.x + event.xgraphicsexpose.width;
- Box.y2 = event.xgraphicsexpose.y + event.xgraphicsexpose.height;
- RegionReset(pTmpReg, &Box);
- RegionAppend(pReg, pTmpReg);
- pending = event.xgraphicsexpose.count;
- break;
- }
- }
-
- RegionDestroy(pTmpReg);
- RegionValidate(pReg, &overlap);
- return pReg;
- }
-}
-
-RegionPtr
-xnestCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GCPtr pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty)
-{
- XCopyArea(xnestDisplay,
- xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable),
- xnestGC(pGC), srcx, srcy, width, height, dstx, dsty);
-
- return xnestBitBlitHelper(pGC);
-}
-
-RegionPtr
-xnestCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GCPtr pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long plane)
-{
- XCopyPlane(xnestDisplay,
- xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable),
- xnestGC(pGC), srcx, srcy, width, height, dstx, dsty, plane);
-
- return xnestBitBlitHelper(pGC);
-}
-
-void
-xnestPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
- DDXPointPtr pPoints)
-{
- XDrawPoints(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XPoint *)pPoints, nPoints, mode);
-}
-
-void
-xnestPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
- DDXPointPtr pPoints)
-{
- XDrawLines(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XPoint *)pPoints, nPoints, mode);
-}
-
-void
-xnestPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
- xSegment *pSegments)
-{
- XDrawSegments(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XSegment *)pSegments, nSegments);
-}
-
-void
-xnestPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
- xRectangle *pRectangles)
-{
- XDrawRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XRectangle *)pRectangles, nRectangles);
-}
-
-void
-xnestPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
-{
- XDrawArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XArc *)pArcs, nArcs);
-}
-
-void
-xnestFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode,
- int nPoints, DDXPointPtr pPoints)
-{
- XFillPolygon(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XPoint *)pPoints, nPoints, shape, mode);
-}
-
-void
-xnestPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
- xRectangle *pRectangles)
-{
- XFillRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XRectangle *)pRectangles, nRectangles);
-}
-
-void
-xnestPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
-{
- XFillArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- (XArc *)pArcs, nArcs);
-}
-
-int
-xnestPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- char *string)
-{
- int width;
-
- XDrawString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- x, y, string, count);
-
- width = XTextWidth(xnestFontStruct(pGC->font), string, count);
-
- return width + x;
-}
-
-int
-xnestPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- unsigned short *string)
-{
- int width;
-
- XDrawString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- x, y, (XChar2b *)string, count);
-
- width = XTextWidth16(xnestFontStruct(pGC->font), (XChar2b *)string, count);
-
- return width + x;
-}
-
-void
-xnestImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- char *string)
-{
- XDrawImageString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- x, y, string, count);
-}
-
-void
-xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- unsigned short *string)
-{
- XDrawImageString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
- x, y, (XChar2b *)string, count);
-}
-
-void
-xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
- unsigned int nGlyphs, CharInfoPtr *pCharInfo,
- pointer pGlyphBase)
-{
- ErrorF("xnest warning: function xnestImageGlyphBlt not implemented\n");
-}
-
-void
-xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
- unsigned int nGlyphs, CharInfoPtr *pCharInfo,
- pointer pGlyphBase)
-{
- ErrorF("xnest warning: function xnestPolyGlyphBlt not implemented\n");
-}
-
-void
-xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDst,
- int width, int height, int x, int y)
-{
- /* only works for solid bitmaps */
- if (pGC->fillStyle == FillSolid)
- {
- XSetStipple (xnestDisplay, xnestGC(pGC), xnestPixmap(pBitmap));
- XSetTSOrigin (xnestDisplay, xnestGC(pGC), x, y);
- XSetFillStyle (xnestDisplay, xnestGC(pGC), FillStippled);
- XFillRectangle (xnestDisplay, xnestDrawable(pDst),
- xnestGC(pGC), x, y, width, height);
- XSetFillStyle (xnestDisplay, xnestGC(pGC), FillSolid);
- }
- else
- ErrorF("xnest warning: function xnestPushPixels not implemented\n");
-}
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "regionstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "region.h"
+#include "servermd.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNGC.h"
+#include "XNFont.h"
+#include "GCOps.h"
+#include "Drawable.h"
+#include "Visual.h"
+
+void
+xnestFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, xPoint * pPoints,
+ int *pWidths, int fSorted)
+{
+ ErrorF("xnest warning: function xnestFillSpans not implemented\n");
+}
+
+void
+xnestSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
+ xPoint * pPoints, int *pWidths, int nSpans, int fSorted)
+{
+ ErrorF("xnest warning: function xnestSetSpans not implemented\n");
+}
+
+void
+xnestGetSpans(DrawablePtr pDrawable, int maxWidth, DDXPointPtr pPoints,
+ int *pWidths, int nSpans, char *pBuffer)
+{
+ ErrorF("xnest warning: function xnestGetSpans not implemented\n");
+}
+
+void
+xnestQueryBestSize(int class, unsigned short *pWidth, unsigned short *pHeight,
+ ScreenPtr pScreen)
+{
+ unsigned int width, height;
+
+ width = *pWidth;
+ height = *pHeight;
+
+ XQueryBestSize(xnestDisplay, class,
+ xnestDefaultWindows[pScreen->myNum],
+ width, height, &width, &height);
+
+ *pWidth = width;
+ *pHeight = height;
+}
+
+void
+xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage)
+{
+ XImage *ximage;
+
+ ximage = XCreateImage(xnestDisplay, xnestDefaultVisual(pDrawable->pScreen),
+ depth, format, leftPad, (char *) pImage,
+ w, h, BitmapPad(xnestDisplay),
+ (format == ZPixmap) ?
+ PixmapBytePad(w, depth) : BitmapBytePad(w + leftPad));
+
+ if (ximage) {
+ XPutImage(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ ximage, 0, 0, x, y, w, h);
+ XFree(ximage);
+ }
+}
+
+void
+xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long planeMask, char *pImage)
+{
+ XImage *ximage;
+ int length;
+
+ ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
+ x, y, w, h, planeMask, format);
+
+ if (ximage) {
+ length = ximage->bytes_per_line * ximage->height;
+
+ memmove(pImage, ximage->data, length);
+
+ XDestroyImage(ximage);
+ }
+}
+
+static Bool
+xnestBitBlitPredicate(Display * display, XEvent * event, char *args)
+{
+ return event->type == GraphicsExpose || event->type == NoExpose;
+}
+
+static RegionPtr
+xnestBitBlitHelper(GCPtr pGC)
+{
+ if (!pGC->graphicsExposures)
+ return NullRegion;
+ else {
+ XEvent event;
+ RegionPtr pReg, pTmpReg;
+ BoxRec Box;
+ Bool pending, overlap;
+
+ pReg = RegionCreate(NULL, 1);
+ pTmpReg = RegionCreate(NULL, 1);
+ if (!pReg || !pTmpReg)
+ return NullRegion;
+
+ pending = True;
+ while (pending) {
+ XIfEvent(xnestDisplay, &event, xnestBitBlitPredicate, NULL);
+
+ switch (event.type) {
+ case NoExpose:
+ pending = False;
+ break;
+
+ case GraphicsExpose:
+ Box.x1 = event.xgraphicsexpose.x;
+ Box.y1 = event.xgraphicsexpose.y;
+ Box.x2 = event.xgraphicsexpose.x + event.xgraphicsexpose.width;
+ Box.y2 = event.xgraphicsexpose.y + event.xgraphicsexpose.height;
+ RegionReset(pTmpReg, &Box);
+ RegionAppend(pReg, pTmpReg);
+ pending = event.xgraphicsexpose.count;
+ break;
+ }
+ }
+
+ RegionDestroy(pTmpReg);
+ RegionValidate(pReg, &overlap);
+ return pReg;
+ }
+}
+
+RegionPtr
+xnestCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty)
+{
+ XCopyArea(xnestDisplay,
+ xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable),
+ xnestGC(pGC), srcx, srcy, width, height, dstx, dsty);
+
+ return xnestBitBlitHelper(pGC);
+}
+
+RegionPtr
+xnestCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long plane)
+{
+ XCopyPlane(xnestDisplay,
+ xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable),
+ xnestGC(pGC), srcx, srcy, width, height, dstx, dsty, plane);
+
+ return xnestBitBlitHelper(pGC);
+}
+
+void
+xnestPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
+ DDXPointPtr pPoints)
+{
+ XDrawPoints(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XPoint *) pPoints, nPoints, mode);
+}
+
+void
+xnestPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
+ DDXPointPtr pPoints)
+{
+ XDrawLines(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XPoint *) pPoints, nPoints, mode);
+}
+
+void
+xnestPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
+ xSegment * pSegments)
+{
+ XDrawSegments(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XSegment *) pSegments, nSegments);
+}
+
+void
+xnestPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
+ xRectangle *pRectangles)
+{
+ XDrawRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XRectangle *) pRectangles, nRectangles);
+}
+
+void
+xnestPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc * pArcs)
+{
+ XDrawArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XArc *) pArcs, nArcs);
+}
+
+void
+xnestFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode,
+ int nPoints, DDXPointPtr pPoints)
+{
+ XFillPolygon(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XPoint *) pPoints, nPoints, shape, mode);
+}
+
+void
+xnestPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
+ xRectangle *pRectangles)
+{
+ XFillRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XRectangle *) pRectangles, nRectangles);
+}
+
+void
+xnestPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc * pArcs)
+{
+ XFillArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XArc *) pArcs, nArcs);
+}
+
+int
+xnestPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ char *string)
+{
+ int width;
+
+ XDrawString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, string, count);
+
+ width = XTextWidth(xnestFontStruct(pGC->font), string, count);
+
+ return width + x;
+}
+
+int
+xnestPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ unsigned short *string)
+{
+ int width;
+
+ XDrawString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, (XChar2b *) string, count);
+
+ width = XTextWidth16(xnestFontStruct(pGC->font), (XChar2b *) string, count);
+
+ return width + x;
+}
+
+void
+xnestImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ char *string)
+{
+ XDrawImageString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, string, count);
+}
+
+void
+xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ unsigned short *string)
+{
+ XDrawImageString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, (XChar2b *) string, count);
+}
+
+void
+xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr * pCharInfo,
+ pointer pGlyphBase)
+{
+ ErrorF("xnest warning: function xnestImageGlyphBlt not implemented\n");
+}
+
+void
+xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr * pCharInfo,
+ pointer pGlyphBase)
+{
+ ErrorF("xnest warning: function xnestPolyGlyphBlt not implemented\n");
+}
+
+void
+xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDst,
+ int width, int height, int x, int y)
+{
+ /* only works for solid bitmaps */
+ if (pGC->fillStyle == FillSolid) {
+ XSetStipple(xnestDisplay, xnestGC(pGC), xnestPixmap(pBitmap));
+ XSetTSOrigin(xnestDisplay, xnestGC(pGC), x, y);
+ XSetFillStyle(xnestDisplay, xnestGC(pGC), FillStippled);
+ XFillRectangle(xnestDisplay, xnestDrawable(pDst),
+ xnestGC(pGC), x, y, width, height);
+ XSetFillStyle(xnestDisplay, xnestGC(pGC), FillSolid);
+ }
+ else
+ ErrorF("xnest warning: function xnestPushPixels not implemented\n");
+}
diff --git a/xorg-server/hw/xnest/GCOps.h b/xorg-server/hw/xnest/GCOps.h
index ca4cf33f7..b1cad110c 100644
--- a/xorg-server/hw/xnest/GCOps.h
+++ b/xorg-server/hw/xnest/GCOps.h
@@ -16,53 +16,53 @@ is" without express or implied warranty.
#define XNESTGCOPS_H
void xnestFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans,
- xPoint *pPoints, int *pWidths, int fSorted);
+ xPoint * pPoints, int *pWidths, int fSorted);
void xnestSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
- xPoint *pPoints, int *pWidths, int nSpans, int fSorted);
+ xPoint * pPoints, int *pWidths, int nSpans, int fSorted);
void xnestGetSpans(DrawablePtr pDrawable, int maxWidth, DDXPointPtr pPoints,
- int *pWidths, int nSpans, char *pBuffer);
+ int *pWidths, int nSpans, char *pBuffer);
void xnestQueryBestSize(int class, unsigned short *pWidth,
- unsigned short *pHeight, ScreenPtr pScreen);
+ unsigned short *pHeight, ScreenPtr pScreen);
void xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *pImage);
+ int w, int h, int leftPad, int format, char *pImage);
void xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask,
- char *pImage);
+ unsigned int format, unsigned long planeMask, char *pImage);
RegionPtr xnestCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GCPtr pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty);
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty);
RegionPtr xnestCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GCPtr pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long plane);
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long plane);
void xnestPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
- DDXPointPtr pPoints);
+ DDXPointPtr pPoints);
void xnestPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
- DDXPointPtr pPoints);
+ DDXPointPtr pPoints);
void xnestPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
- xSegment *pSegments);
+ xSegment * pSegments);
void xnestPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
- xRectangle *pRectangles);
-void xnestPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs);
+ xRectangle *pRectangles);
+void xnestPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc * pArcs);
void xnestFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode,
- int nPoints, DDXPointPtr pPoints);
+ int nPoints, DDXPointPtr pPoints);
void xnestPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
- xRectangle *pRectangles);
-void xnestPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs);
+ xRectangle *pRectangles);
+void xnestPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs,
+ xArc * pArcs);
int xnestPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- char *string);
+ char *string);
int xnestPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- unsigned short *string);
+ unsigned short *string);
void xnestImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- char *string);
+ char *string);
void xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
- unsigned short *string);
+ unsigned short *string);
void xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
- unsigned int nGlyphs, CharInfoPtr *pCharInfo,
- pointer pGlyphBase);
+ unsigned int nGlyphs, CharInfoPtr * pCharInfo,
+ pointer pGlyphBase);
void xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
- unsigned int nGlyphs, CharInfoPtr *pCharInfo,
- pointer pGlyphBase);
+ unsigned int nGlyphs, CharInfoPtr * pCharInfo,
+ pointer pGlyphBase);
void xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable,
- int width, int height, int x, int y);
+ int width, int height, int x, int y);
-#endif /* XNESTGCOPS_H */
+#endif /* XNESTGCOPS_H */
diff --git a/xorg-server/hw/xnest/Init.c b/xorg-server/hw/xnest/Init.c
index af57518ba..0909826d9 100644
--- a/xorg-server/hw/xnest/Init.c
+++ b/xorg-server/hw/xnest/Init.c
@@ -46,84 +46,86 @@ is" without express or implied warranty.
Bool xnestDoFullGeneration = True;
void
-InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
+InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
{
- int i, j;
-
- xnestOpenDisplay(argc, argv);
-
- screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
- screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
- screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay);
- screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
-
- screenInfo->numPixmapFormats = 0;
- for (i = 0; i < xnestNumPixmapFormats; i++)
- for (j = 0; j < xnestNumDepths; j++)
- if ((xnestPixmapFormats[i].depth == 1) ||
- (xnestPixmapFormats[i].depth == xnestDepths[j])) {
- screenInfo->formats[screenInfo->numPixmapFormats].depth =
- xnestPixmapFormats[i].depth;
- screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
- xnestPixmapFormats[i].bits_per_pixel;
- screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
- xnestPixmapFormats[i].scanline_pad;
- screenInfo->numPixmapFormats++;
- break;
- }
-
- xnestFontPrivateIndex = AllocateFontPrivateIndex();
-
- if (!xnestNumScreens) xnestNumScreens = 1;
-
- for (i = 0; i < xnestNumScreens; i++)
- AddScreen(xnestOpenScreen, argc, argv);
-
- xnestNumScreens = screenInfo->numScreens;
-
- xnestDoFullGeneration = xnestFullGeneration;
+ int i, j;
+
+ xnestOpenDisplay(argc, argv);
+
+ screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
+ screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
+ screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay);
+ screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
+
+ screenInfo->numPixmapFormats = 0;
+ for (i = 0; i < xnestNumPixmapFormats; i++)
+ for (j = 0; j < xnestNumDepths; j++)
+ if ((xnestPixmapFormats[i].depth == 1) ||
+ (xnestPixmapFormats[i].depth == xnestDepths[j])) {
+ screenInfo->formats[screenInfo->numPixmapFormats].depth =
+ xnestPixmapFormats[i].depth;
+ screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
+ xnestPixmapFormats[i].bits_per_pixel;
+ screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
+ xnestPixmapFormats[i].scanline_pad;
+ screenInfo->numPixmapFormats++;
+ break;
+ }
+
+ xnestFontPrivateIndex = AllocateFontPrivateIndex();
+
+ if (!xnestNumScreens)
+ xnestNumScreens = 1;
+
+ for (i = 0; i < xnestNumScreens; i++)
+ AddScreen(xnestOpenScreen, argc, argv);
+
+ xnestNumScreens = screenInfo->numScreens;
+
+ xnestDoFullGeneration = xnestFullGeneration;
}
void
InitInput(int argc, char *argv[])
{
- int rc;
- rc = AllocDevicePair(serverClient, "Xnest",
- &xnestPointerDevice,
- &xnestKeyboardDevice,
- xnestPointerProc,
- xnestKeyboardProc,
- FALSE);
+ int rc;
+
+ rc = AllocDevicePair(serverClient, "Xnest",
+ &xnestPointerDevice,
+ &xnestKeyboardDevice,
+ xnestPointerProc, xnestKeyboardProc, FALSE);
- if (rc != Success)
- FatalError("Failed to init Xnest default devices.\n");
+ if (rc != Success)
+ FatalError("Failed to init Xnest default devices.\n");
- mieqInit();
+ mieqInit();
- AddEnabledDevice(XConnectionNumber(xnestDisplay));
+ AddEnabledDevice(XConnectionNumber(xnestDisplay));
- RegisterBlockAndWakeupHandlers(xnestBlockHandler, xnestWakeupHandler, NULL);
+ RegisterBlockAndWakeupHandlers(xnestBlockHandler, xnestWakeupHandler, NULL);
}
void
CloseInput(void)
{
- mieqFini();
+ mieqFini();
}
/*
* DDX - specific abort routine. Called by AbortServer().
*/
-void AbortDDX(enum ExitCode error)
+void
+AbortDDX(enum ExitCode error)
{
- xnestDoFullGeneration = True;
- xnestCloseDisplay();
+ xnestDoFullGeneration = True;
+ xnestCloseDisplay();
}
/* Called by GiveUp(). */
-void ddxGiveUp(enum ExitCode error)
+void
+ddxGiveUp(enum ExitCode error)
{
- AbortDDX(error);
+ AbortDDX(error);
}
#ifdef __APPLE__
@@ -133,18 +135,21 @@ DarwinHandleGUI(int argc, char *argv[])
}
#endif
-void OsVendorInit(void)
+void
+OsVendorInit(void)
{
return;
}
-void OsVendorFatalError(void)
+void
+OsVendorFatalError(void)
{
return;
}
#if defined(DDXBEFORERESET)
-void ddxBeforeReset(void)
+void
+ddxBeforeReset(void)
{
return;
}
diff --git a/xorg-server/hw/xnest/Keyboard.c b/xorg-server/hw/xnest/Keyboard.c
index 5ef376b91..d013dc91e 100644
--- a/xorg-server/hw/xnest/Keyboard.c
+++ b/xorg-server/hw/xnest/Keyboard.c
@@ -38,231 +38,230 @@ is" without express or implied warranty.
#include <X11/extensions/XKBconfig.h>
extern Bool
-XkbQueryExtension(
- Display * /* dpy */,
- int * /* opcodeReturn */,
- int * /* eventBaseReturn */,
- int * /* errorBaseReturn */,
- int * /* majorRtrn */,
- int * /* minorRtrn */
-);
-
-extern XkbDescPtr XkbGetKeyboard(
- Display * /* dpy */,
- unsigned int /* which */,
- unsigned int /* deviceSpec */
-);
-
-extern Status XkbGetControls(
- Display * /* dpy */,
- unsigned long /* which */,
- XkbDescPtr /* desc */
-);
+ XkbQueryExtension(Display * /* dpy */ ,
+ int * /* opcodeReturn */ ,
+ int * /* eventBaseReturn */ ,
+ int * /* errorBaseReturn */ ,
+ int * /* majorRtrn */ ,
+ int * /* minorRtrn */
+ );
+
+extern XkbDescPtr XkbGetKeyboard(Display * /* dpy */ ,
+ unsigned int /* which */ ,
+ unsigned int /* deviceSpec */
+ );
+
+extern Status XkbGetControls(Display * /* dpy */ ,
+ unsigned long /* which */ ,
+ XkbDescPtr /* desc */
+ );
DeviceIntPtr xnestKeyboardDevice = NULL;
void
xnestBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls)
{
- XBell(xnestDisplay, volume);
+ XBell(xnestDisplay, volume);
}
void
DDXRingBell(int volume, int pitch, int duration)
{
- XBell(xnestDisplay, volume);
+ XBell(xnestDisplay, volume);
}
void
-xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
+xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl * ctrl)
{
#if 0
- unsigned long value_mask;
- XKeyboardControl values;
- int i;
-
- value_mask = KBKeyClickPercent |
- KBBellPercent |
- KBBellPitch |
- KBBellDuration |
- KBAutoRepeatMode;
-
- values.key_click_percent = ctrl->click;
- values.bell_percent = ctrl->bell;
- values.bell_pitch = ctrl->bell_pitch;
- values.bell_duration = ctrl->bell_duration;
- values.auto_repeat_mode = ctrl->autoRepeat ?
- AutoRepeatModeOn : AutoRepeatModeOff;
-
- XChangeKeyboardControl(xnestDisplay, value_mask, &values);
-
- /*
- value_mask = KBKey | KBAutoRepeatMode;
- At this point, we need to walk through the vector and compare it
- to the current server vector. If there are differences, report them.
- */
-
- value_mask = KBLed | KBLedMode;
- for (i = 1; i <= 32; i++) {
- values.led = i;
- values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn : LedModeOff;
+ unsigned long value_mask;
+ XKeyboardControl values;
+ int i;
+
+ value_mask = KBKeyClickPercent |
+ KBBellPercent | KBBellPitch | KBBellDuration | KBAutoRepeatMode;
+
+ values.key_click_percent = ctrl->click;
+ values.bell_percent = ctrl->bell;
+ values.bell_pitch = ctrl->bell_pitch;
+ values.bell_duration = ctrl->bell_duration;
+ values.auto_repeat_mode = ctrl->autoRepeat ?
+ AutoRepeatModeOn : AutoRepeatModeOff;
+
XChangeKeyboardControl(xnestDisplay, value_mask, &values);
- }
+
+ /*
+ value_mask = KBKey | KBAutoRepeatMode;
+ At this point, we need to walk through the vector and compare it
+ to the current server vector. If there are differences, report them.
+ */
+
+ value_mask = KBLed | KBLedMode;
+ for (i = 1; i <= 32; i++) {
+ values.led = i;
+ values.led_mode =
+ (ctrl->leds & (1 << (i - 1))) ? LedModeOn : LedModeOff;
+ XChangeKeyboardControl(xnestDisplay, value_mask, &values);
+ }
#endif
}
int
xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
{
- XModifierKeymap *modifier_keymap;
- KeySym *keymap;
- int mapWidth;
- int min_keycode, max_keycode;
- KeySymsRec keySyms;
- CARD8 modmap[MAP_LENGTH];
- int i, j;
- XKeyboardState values;
- XkbDescPtr xkb;
- int op, event, error, major, minor;
-
- switch (onoff)
- {
- case DEVICE_INIT:
- XDisplayKeycodes(xnestDisplay, &min_keycode, &max_keycode);
+ XModifierKeymap *modifier_keymap;
+ KeySym *keymap;
+ int mapWidth;
+ int min_keycode, max_keycode;
+ KeySymsRec keySyms;
+ CARD8 modmap[MAP_LENGTH];
+ int i, j;
+ XKeyboardState values;
+ XkbDescPtr xkb;
+ int op, event, error, major, minor;
+
+ switch (onoff) {
+ case DEVICE_INIT:
+ XDisplayKeycodes(xnestDisplay, &min_keycode, &max_keycode);
#ifdef _XSERVER64
- {
- KeySym64 *keymap64;
- int len;
- keymap64 = XGetKeyboardMapping(xnestDisplay,
- min_keycode,
- max_keycode - min_keycode + 1,
- &mapWidth);
- len = (max_keycode - min_keycode + 1) * mapWidth;
- keymap = (KeySym *)malloc(len * sizeof(KeySym));
- for(i = 0; i < len; ++i)
- keymap[i] = keymap64[i];
- XFree(keymap64);
- }
+ {
+ KeySym64 *keymap64;
+ int len;
+
+ keymap64 = XGetKeyboardMapping(xnestDisplay,
+ min_keycode,
+ max_keycode - min_keycode + 1,
+ &mapWidth);
+ len = (max_keycode - min_keycode + 1) * mapWidth;
+ keymap = (KeySym *) malloc(len * sizeof(KeySym));
+ for (i = 0; i < len; ++i)
+ keymap[i] = keymap64[i];
+ XFree(keymap64);
+ }
#else
- keymap = XGetKeyboardMapping(xnestDisplay,
- min_keycode,
- max_keycode - min_keycode + 1,
- &mapWidth);
+ keymap = XGetKeyboardMapping(xnestDisplay,
+ min_keycode,
+ max_keycode - min_keycode + 1, &mapWidth);
#endif
- memset(modmap, 0, sizeof(modmap));
- modifier_keymap = XGetModifierMapping(xnestDisplay);
- for (j = 0; j < 8; j++)
- for(i = 0; i < modifier_keymap->max_keypermod; i++) {
- CARD8 keycode;
- if ((keycode = modifier_keymap->modifiermap[j * modifier_keymap->max_keypermod + i]))
- modmap[keycode] |= 1<<j;
- }
- XFreeModifiermap(modifier_keymap);
-
- keySyms.minKeyCode = min_keycode;
- keySyms.maxKeyCode = max_keycode;
- keySyms.mapWidth = mapWidth;
- keySyms.map = keymap;
-
- if (XkbQueryExtension(xnestDisplay, &op, &event, &error, &major, &minor) == 0) {
- ErrorF("Unable to initialize XKEYBOARD extension.\n");
- goto XkbError;
- }
- xkb = XkbGetKeyboard(xnestDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd);
- if (xkb == NULL || xkb->geom == NULL) {
- ErrorF("Couldn't get keyboard.\n");
- goto XkbError;
- }
- XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
-
- InitKeyboardDeviceStruct(pDev, NULL,
- xnestBell, xnestChangeKeyboardControl);
-
- XkbApplyMappingChange(pDev, &keySyms, keySyms.minKeyCode,
- keySyms.maxKeyCode - keySyms.minKeyCode + 1,
- modmap, serverClient);
-
- XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
- XkbFreeKeyboard(xkb, 0, False);
- free(keymap);
- break;
- case DEVICE_ON:
- xnestEventMask |= XNEST_KEYBOARD_EVENT_MASK;
- for (i = 0; i < xnestNumScreens; i++)
- XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
- break;
- case DEVICE_OFF:
- xnestEventMask &= ~XNEST_KEYBOARD_EVENT_MASK;
- for (i = 0; i < xnestNumScreens; i++)
- XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
- break;
- case DEVICE_CLOSE:
- break;
+ memset(modmap, 0, sizeof(modmap));
+ modifier_keymap = XGetModifierMapping(xnestDisplay);
+ for (j = 0; j < 8; j++)
+ for (i = 0; i < modifier_keymap->max_keypermod; i++) {
+ CARD8 keycode;
+
+ if ((keycode =
+ modifier_keymap->modifiermap[j *
+ modifier_keymap->
+ max_keypermod + i]))
+ modmap[keycode] |= 1 << j;
+ }
+ XFreeModifiermap(modifier_keymap);
+
+ keySyms.minKeyCode = min_keycode;
+ keySyms.maxKeyCode = max_keycode;
+ keySyms.mapWidth = mapWidth;
+ keySyms.map = keymap;
+
+ if (XkbQueryExtension(xnestDisplay, &op, &event, &error, &major, &minor)
+ == 0) {
+ ErrorF("Unable to initialize XKEYBOARD extension.\n");
+ goto XkbError;
+ }
+ xkb =
+ XkbGetKeyboard(xnestDisplay, XkbGBN_AllComponentsMask,
+ XkbUseCoreKbd);
+ if (xkb == NULL || xkb->geom == NULL) {
+ ErrorF("Couldn't get keyboard.\n");
+ goto XkbError;
+ }
+ XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
+
+ InitKeyboardDeviceStruct(pDev, NULL,
+ xnestBell, xnestChangeKeyboardControl);
+
+ XkbApplyMappingChange(pDev, &keySyms, keySyms.minKeyCode,
+ keySyms.maxKeyCode - keySyms.minKeyCode + 1,
+ modmap, serverClient);
+
+ XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
+ XkbFreeKeyboard(xkb, 0, False);
+ free(keymap);
+ break;
+ case DEVICE_ON:
+ xnestEventMask |= XNEST_KEYBOARD_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
+ break;
+ case DEVICE_OFF:
+ xnestEventMask &= ~XNEST_KEYBOARD_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
+ break;
+ case DEVICE_CLOSE:
+ break;
}
- return Success;
-
-XkbError:
- XGetKeyboardControl(xnestDisplay, &values);
- memmove((char *)defaultKeyboardControl.autoRepeats,
- (char *)values.auto_repeats,
- sizeof(values.auto_repeats));
-
- InitKeyboardDeviceStruct(pDev, NULL,
- xnestBell, xnestChangeKeyboardControl);
- free(keymap);
- return Success;
+ return Success;
+
+ XkbError:
+ XGetKeyboardControl(xnestDisplay, &values);
+ memmove((char *) defaultKeyboardControl.autoRepeats,
+ (char *) values.auto_repeats, sizeof(values.auto_repeats));
+
+ InitKeyboardDeviceStruct(pDev, NULL, xnestBell, xnestChangeKeyboardControl);
+ free(keymap);
+ return Success;
}
Bool
LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
- return TRUE;
+ return TRUE;
}
void
xnestUpdateModifierState(unsigned int state)
{
- DeviceIntPtr pDev = xnestKeyboardDevice;
- KeyClassPtr keyc = pDev->key;
- int i;
- CARD8 mask;
- int xkb_state;
-
- if (!pDev)
- return;
-
- xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state);
- state = state & 0xff;
-
- if (xkb_state == state)
- return;
-
- for (i = 0, mask = 1; i < 8; i++, mask <<= 1) {
- int key;
-
- /* Modifier is down, but shouldn't be
- */
- if ((xkb_state & mask) && !(state & mask)) {
- int count = keyc->modifierKeyCount[i];
-
- for (key = 0; key < MAP_LENGTH; key++)
- if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
- if (key_is_down(pDev, key, KEY_PROCESSED))
- xnestQueueKeyEvent(KeyRelease, key);
-
- if (--count == 0)
- break;
- }
+ DeviceIntPtr pDev = xnestKeyboardDevice;
+ KeyClassPtr keyc = pDev->key;
+ int i;
+ CARD8 mask;
+ int xkb_state;
+
+ if (!pDev)
+ return;
+
+ xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state);
+ state = state & 0xff;
+
+ if (xkb_state == state)
+ return;
+
+ for (i = 0, mask = 1; i < 8; i++, mask <<= 1) {
+ int key;
+
+ /* Modifier is down, but shouldn't be
+ */
+ if ((xkb_state & mask) && !(state & mask)) {
+ int count = keyc->modifierKeyCount[i];
+
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
+ if (key_is_down(pDev, key, KEY_PROCESSED))
+ xnestQueueKeyEvent(KeyRelease, key);
+
+ if (--count == 0)
+ break;
+ }
+ }
+
+ /* Modifier shoud be down, but isn't
+ */
+ if (!(xkb_state & mask) && (state & mask))
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
+ xnestQueueKeyEvent(KeyPress, key);
+ break;
+ }
}
-
- /* Modifier shoud be down, but isn't
- */
- if (!(xkb_state & mask) && (state & mask))
- for (key = 0; key < MAP_LENGTH; key++)
- if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
- xnestQueueKeyEvent(KeyPress, key);
- break;
- }
- }
}
diff --git a/xorg-server/hw/xnest/Pointer.c b/xorg-server/hw/xnest/Pointer.c
index fdc6181e9..a2ee90064 100644
--- a/xorg-server/hw/xnest/Pointer.c
+++ b/xorg-server/hw/xnest/Pointer.c
@@ -34,64 +34,63 @@ is" without express or implied warranty.
#include "Args.h"
#include "xserver-properties.h"
-#include "exevents.h" /* For XIGetKnownProperty */
+#include "exevents.h" /* For XIGetKnownProperty */
DeviceIntPtr xnestPointerDevice = NULL;
void
-xnestChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl)
+xnestChangePointerControl(DeviceIntPtr pDev, PtrCtrl * ctrl)
{
- XChangePointerControl(xnestDisplay, True, True,
- ctrl->num, ctrl->den, ctrl->threshold);
+ XChangePointerControl(xnestDisplay, True, True,
+ ctrl->num, ctrl->den, ctrl->threshold);
}
int
xnestPointerProc(DeviceIntPtr pDev, int onoff)
{
- CARD8 map[MAXBUTTONS];
- Atom btn_labels[MAXBUTTONS] = {0};
- Atom axes_labels[2] = {0};
- int nmap;
- int i;
+ CARD8 map[MAXBUTTONS];
+ Atom btn_labels[MAXBUTTONS] = { 0 };
+ Atom axes_labels[2] = { 0 };
+ int nmap;
+ int i;
- switch (onoff)
- {
- case DEVICE_INIT:
- nmap = XGetPointerMapping(xnestDisplay, map, MAXBUTTONS);
- for (i = 0; i <= nmap; i++)
- map[i] = i; /* buttons are already mapped */
+ switch (onoff) {
+ case DEVICE_INIT:
+ nmap = XGetPointerMapping(xnestDisplay, map, MAXBUTTONS);
+ for (i = 0; i <= nmap; i++)
+ map[i] = i; /* buttons are already mapped */
- btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
- btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
- btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
- btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
- btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
- btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
- btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
- XGetPointerControl(xnestDisplay,
- &defaultPointerControl.num,
- &defaultPointerControl.den,
- &defaultPointerControl.threshold);
- InitPointerDeviceStruct(&pDev->public, map, nmap, btn_labels,
- xnestChangePointerControl,
- GetMotionHistorySize(), 2, axes_labels);
- break;
- case DEVICE_ON:
- xnestEventMask |= XNEST_POINTER_EVENT_MASK;
- for (i = 0; i < xnestNumScreens; i++)
- XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
- break;
- case DEVICE_OFF:
- xnestEventMask &= ~XNEST_POINTER_EVENT_MASK;
- for (i = 0; i < xnestNumScreens; i++)
- XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
- break;
- case DEVICE_CLOSE:
- break;
+ XGetPointerControl(xnestDisplay,
+ &defaultPointerControl.num,
+ &defaultPointerControl.den,
+ &defaultPointerControl.threshold);
+ InitPointerDeviceStruct(&pDev->public, map, nmap, btn_labels,
+ xnestChangePointerControl,
+ GetMotionHistorySize(), 2, axes_labels);
+ break;
+ case DEVICE_ON:
+ xnestEventMask |= XNEST_POINTER_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
+ break;
+ case DEVICE_OFF:
+ xnestEventMask &= ~XNEST_POINTER_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
+ break;
+ case DEVICE_CLOSE:
+ break;
}
- return Success;
+ return Success;
}
diff --git a/xorg-server/hw/xnest/Screen.c b/xorg-server/hw/xnest/Screen.c
index c4ab464cb..dd76cb801 100644
--- a/xorg-server/hw/xnest/Screen.c
+++ b/xorg-server/hw/xnest/Screen.c
@@ -1,422 +1,428 @@
-/*
-
-Copyright 1993 by Davor Matic
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#ifdef HAVE_XNEST_CONFIG_H
-#include <xnest-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "scrnintstr.h"
-#include "dix.h"
-#include "mi.h"
-#include "mibstore.h"
-#include "micmap.h"
-#include "colormapst.h"
-#include "resource.h"
-
-#include "Xnest.h"
-
-#include "Display.h"
-#include "Screen.h"
-#include "XNGC.h"
-#include "GCOps.h"
-#include "Drawable.h"
-#include "XNFont.h"
-#include "Color.h"
-#include "XNCursor.h"
-#include "Visual.h"
-#include "Events.h"
-#include "Init.h"
-#include "mipointer.h"
-#include "Args.h"
-#include "mipointrst.h"
-
-Window xnestDefaultWindows[MAXSCREENS];
-Window xnestScreenSaverWindows[MAXSCREENS];
-DevPrivateKeyRec xnestCursorScreenKeyRec;
-
-ScreenPtr
-xnestScreen(Window window)
-{
- int i;
-
- for (i = 0; i < xnestNumScreens; i++)
- if (xnestDefaultWindows[i] == window)
- return screenInfo.screens[i];
-
- return NULL;
-}
-
-static int
-offset(unsigned long mask)
-{
- int count;
-
- for (count = 0; !(mask & 1) && count < 32; count++)
- mask >>= 1;
-
- return count;
-}
-
-static Bool
-xnestSaveScreen(ScreenPtr pScreen, int what)
-{
- if (xnestSoftwareScreenSaver)
- return False;
- else {
- switch (what) {
- case SCREEN_SAVER_ON:
- XMapRaised(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
- xnestSetScreenSaverColormapWindow(pScreen);
- break;
-
- case SCREEN_SAVER_OFF:
- XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
- xnestSetInstalledColormapWindows(pScreen);
- break;
-
- case SCREEN_SAVER_FORCER:
- lastEventTime = GetTimeInMillis();
- XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
- xnestSetInstalledColormapWindows(pScreen);
- break;
-
- case SCREEN_SAVER_CYCLE:
- XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
- xnestSetInstalledColormapWindows(pScreen);
- break;
- }
- return True;
- }
-}
-
-static Bool
-xnestCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
-{
- return FALSE;
-}
-
-static void
-xnestCrossScreen(ScreenPtr pScreen, Bool entering)
-{
-}
-
-static miPointerScreenFuncRec xnestPointerCursorFuncs =
-{
- xnestCursorOffScreen,
- xnestCrossScreen,
- miPointerWarpCursor
-};
-
-static miPointerSpriteFuncRec xnestPointerSpriteFuncs =
-{
- xnestRealizeCursor,
- xnestUnrealizeCursor,
- xnestSetCursor,
- xnestMoveCursor,
- xnestDeviceCursorInitialize,
- xnestDeviceCursorCleanup
-};
-
-Bool
-xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
-{
- VisualPtr visuals;
- DepthPtr depths;
- int numVisuals, numDepths;
- int i, j, depthIndex;
- unsigned long valuemask;
- XSetWindowAttributes attributes;
- XWindowAttributes gattributes;
- XSizeHints sizeHints;
- VisualID defaultVisual;
- int rootDepth;
- miPointerScreenPtr PointPriv;
-
- if (!dixRegisterPrivateKey(&xnestWindowPrivateKeyRec, PRIVATE_WINDOW, sizeof(xnestPrivWin)))
- return FALSE;
- if (!dixRegisterPrivateKey(&xnestGCPrivateKeyRec, PRIVATE_GC, sizeof(xnestPrivGC)))
- return FALSE;
- if (!dixRegisterPrivateKey(&xnestPixmapPrivateKeyRec, PRIVATE_PIXMAP, sizeof (xnestPrivPixmap)))
- return FALSE;
- if (!dixRegisterPrivateKey(&xnestColormapPrivateKeyRec, PRIVATE_COLORMAP, sizeof (xnestPrivColormap)))
- return FALSE;
- if (!dixRegisterPrivateKey(&xnestCursorScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- visuals = (VisualPtr)malloc(xnestNumVisuals * sizeof(VisualRec));
- numVisuals = 0;
-
- depths = (DepthPtr)malloc(MAXDEPTH * sizeof(DepthRec));
- depths[0].depth = 1;
- depths[0].numVids = 0;
- depths[0].vids = (VisualID *)malloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
- numDepths = 1;
-
- for (i = 0; i < xnestNumVisuals; i++) {
- visuals[numVisuals].class = xnestVisuals[i].class;
- visuals[numVisuals].bitsPerRGBValue = xnestVisuals[i].bits_per_rgb;
- visuals[numVisuals].ColormapEntries = xnestVisuals[i].colormap_size;
- visuals[numVisuals].nplanes = xnestVisuals[i].depth;
- visuals[numVisuals].redMask = xnestVisuals[i].red_mask;
- visuals[numVisuals].greenMask = xnestVisuals[i].green_mask;
- visuals[numVisuals].blueMask = xnestVisuals[i].blue_mask;
- visuals[numVisuals].offsetRed = offset(xnestVisuals[i].red_mask);
- visuals[numVisuals].offsetGreen = offset(xnestVisuals[i].green_mask);
- visuals[numVisuals].offsetBlue = offset(xnestVisuals[i].blue_mask);
-
- /* Check for and remove duplicates. */
- for (j = 0; j < numVisuals; j++) {
- if (visuals[numVisuals].class == visuals[j].class &&
- visuals[numVisuals].bitsPerRGBValue == visuals[j].bitsPerRGBValue &&
- visuals[numVisuals].ColormapEntries == visuals[j].ColormapEntries &&
- visuals[numVisuals].nplanes == visuals[j].nplanes &&
- visuals[numVisuals].redMask == visuals[j].redMask &&
- visuals[numVisuals].greenMask == visuals[j].greenMask &&
- visuals[numVisuals].blueMask == visuals[j].blueMask &&
- visuals[numVisuals].offsetRed == visuals[j].offsetRed &&
- visuals[numVisuals].offsetGreen == visuals[j].offsetGreen &&
- visuals[numVisuals].offsetBlue == visuals[j].offsetBlue)
- break;
- }
- if (j < numVisuals)
- break;
-
- visuals[numVisuals].vid = FakeClientID(0);
-
- depthIndex = UNDEFINED;
- for (j = 0; j < numDepths; j++)
- if (depths[j].depth == xnestVisuals[i].depth) {
- depthIndex = j;
- break;
- }
-
- if (depthIndex == UNDEFINED) {
- depthIndex = numDepths;
- depths[depthIndex].depth = xnestVisuals[i].depth;
- depths[depthIndex].numVids = 0;
- depths[depthIndex].vids =
- (VisualID *)malloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
- numDepths++;
- }
- if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) {
- FatalError("Visual table overflow");
- }
- depths[depthIndex].vids[depths[depthIndex].numVids] =
- visuals[numVisuals].vid;
- depths[depthIndex].numVids++;
-
- numVisuals++;
- }
- visuals = (VisualPtr)realloc(visuals, numVisuals * sizeof(VisualRec));
-
- defaultVisual = visuals[xnestDefaultVisualIndex].vid;
- rootDepth = visuals[xnestDefaultVisualIndex].nplanes;
-
- if (xnestParentWindow != 0) {
- XGetWindowAttributes(xnestDisplay, xnestParentWindow, &gattributes);
- xnestWidth = gattributes.width;
- xnestHeight = gattributes.height;
- }
-
- /* myNum */
- /* id */
- miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth,
- rootDepth,
- numDepths, depths,
- defaultVisual, /* root visual */
- numVisuals, visuals);
-
- pScreen->defColormap = (Colormap) FakeClientID(0);
- pScreen->minInstalledCmaps = MINCMAPS;
- pScreen->maxInstalledCmaps = MAXCMAPS;
- pScreen->backingStoreSupport = NotUseful;
- pScreen->saveUnderSupport = NotUseful;
- pScreen->whitePixel = xnestWhitePixel;
- pScreen->blackPixel = xnestBlackPixel;
- /* GCperDepth */
- /* PixmapPerDepth */
- pScreen->devPrivate = NULL;
- /* WindowPrivateLen */
- /* WindowPrivateSizes */
- /* totalWindowSize */
- /* GCPrivateLen */
- /* GCPrivateSizes */
- /* totalGCSize */
-
- /* Random screen procedures */
-
- pScreen->QueryBestSize = xnestQueryBestSize;
- pScreen->SaveScreen = xnestSaveScreen;
- pScreen->GetImage = xnestGetImage;
- pScreen->GetSpans = xnestGetSpans;
- pScreen->SourceValidate = NULL;
-
- /* Window Procedures */
-
- pScreen->CreateWindow = xnestCreateWindow;
- pScreen->DestroyWindow = xnestDestroyWindow;
- pScreen->PositionWindow = xnestPositionWindow;
- pScreen->ChangeWindowAttributes = xnestChangeWindowAttributes;
- pScreen->RealizeWindow = xnestRealizeWindow;
- pScreen->UnrealizeWindow = xnestUnrealizeWindow;
- pScreen->PostValidateTree = NULL;
- pScreen->WindowExposures = xnestWindowExposures;
- pScreen->CopyWindow = xnestCopyWindow;
- pScreen->ClipNotify = xnestClipNotify;
-
- /* Pixmap procedures */
-
- pScreen->CreatePixmap = xnestCreatePixmap;
- pScreen->DestroyPixmap = xnestDestroyPixmap;
-
- /* Font procedures */
-
- pScreen->RealizeFont = xnestRealizeFont;
- pScreen->UnrealizeFont = xnestUnrealizeFont;
-
- /* GC procedures */
-
- pScreen->CreateGC = xnestCreateGC;
-
- /* Colormap procedures */
-
- pScreen->CreateColormap = xnestCreateColormap;
- pScreen->DestroyColormap = xnestDestroyColormap;
- pScreen->InstallColormap = xnestInstallColormap;
- pScreen->UninstallColormap = xnestUninstallColormap;
- pScreen->ListInstalledColormaps = xnestListInstalledColormaps;
- pScreen->StoreColors = xnestStoreColors;
- pScreen->ResolveColor = xnestResolveColor;
-
- pScreen->BitmapToRegion = xnestPixmapToRegion;
-
- /* OS layer procedures */
-
- pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
- pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA;
- pScreen->blockData = NULL;
- pScreen->wakeupData = NULL;
-
- miDCInitialize(pScreen, &xnestPointerCursorFuncs); /* init SW rendering */
- PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
- xnestCursorFuncs.spriteFuncs = PointPriv->spriteFuncs;
- dixSetPrivate(&pScreen->devPrivates, xnestCursorScreenKey, &xnestCursorFuncs);
- PointPriv->spriteFuncs = &xnestPointerSpriteFuncs;
-
- pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay,
- DefaultScreen(xnestDisplay)) /
- DisplayWidth(xnestDisplay,
- DefaultScreen(xnestDisplay));
- pScreen->mmHeight = xnestHeight * DisplayHeightMM(xnestDisplay,
- DefaultScreen(xnestDisplay)) /
- DisplayHeight(xnestDisplay,
- DefaultScreen(xnestDisplay));
-
- /* overwrite miCloseScreen with our own */
- pScreen->CloseScreen = xnestCloseScreen;
-
- if (!miScreenDevPrivateInit(pScreen, xnestWidth, NULL))
- return FALSE;
-
- /* overwrite miSetShape with our own */
- pScreen->SetShape = xnestSetShape;
-
- /* devPrivates */
-
-#define POSITION_OFFSET (pScreen->myNum * (xnestWidth + xnestHeight) / 32)
-
- if (xnestDoFullGeneration) {
-
- valuemask = CWBackPixel | CWEventMask | CWColormap;
- attributes.background_pixel = xnestWhitePixel;
- attributes.event_mask = xnestEventMask;
- attributes.colormap = xnestDefaultVisualColormap(xnestDefaultVisual(pScreen));
-
- if (xnestParentWindow != 0) {
- xnestDefaultWindows[pScreen->myNum] = xnestParentWindow;
- XSelectInput (xnestDisplay, xnestDefaultWindows[pScreen->myNum],
- xnestEventMask);
- } else
- xnestDefaultWindows[pScreen->myNum] =
- XCreateWindow(xnestDisplay,
- DefaultRootWindow(xnestDisplay),
- xnestX + POSITION_OFFSET,
- xnestY + POSITION_OFFSET,
- xnestWidth, xnestHeight,
- xnestBorderWidth,
- pScreen->rootDepth,
- InputOutput,
- xnestDefaultVisual(pScreen),
- valuemask, &attributes);
-
- if (!xnestWindowName)
- xnestWindowName = argv[0];
-
- sizeHints.flags = PPosition | PSize | PMaxSize;
- sizeHints.x = xnestX + POSITION_OFFSET;
- sizeHints.y = xnestY + POSITION_OFFSET;
- sizeHints.width = sizeHints.max_width = xnestWidth;
- sizeHints.height = sizeHints.max_height = xnestHeight;
- if (xnestUserGeometry & XValue || xnestUserGeometry & YValue)
- sizeHints.flags |= USPosition;
- if (xnestUserGeometry & WidthValue || xnestUserGeometry & HeightValue)
- sizeHints.flags |= USSize;
- XSetStandardProperties(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- xnestWindowName,
- xnestWindowName,
- xnestIconBitmap,
- argv, argc, &sizeHints);
-
- XMapWindow(xnestDisplay, xnestDefaultWindows[pScreen->myNum]);
-
- valuemask = CWBackPixmap | CWColormap;
- attributes.background_pixmap = xnestScreenSaverPixmap;
- attributes.colormap =
- DefaultColormap(xnestDisplay, DefaultScreen(xnestDisplay));
- xnestScreenSaverWindows[pScreen->myNum] =
- XCreateWindow(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- 0, 0, xnestWidth, xnestHeight, 0,
- DefaultDepth(xnestDisplay, DefaultScreen(xnestDisplay)),
- InputOutput,
- DefaultVisual(xnestDisplay, DefaultScreen(xnestDisplay)),
- valuemask, &attributes);
- }
-
- if (!xnestCreateDefaultColormap(pScreen)) return False;
-
- return True;
-}
-
-Bool
-xnestCloseScreen(int index, ScreenPtr pScreen)
-{
- int i;
-
- for (i = 0; i < pScreen->numDepths; i++)
- free(pScreen->allowedDepths[i].vids);
- free(pScreen->allowedDepths);
- free(pScreen->visuals);
- free(pScreen->devPrivate);
-
- /*
- If xnestDoFullGeneration all x resources will be destroyed upon closing
- the display connection. There is no need to generate extra protocol.
- */
-
- return True;
-}
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "dix.h"
+#include "mi.h"
+#include "mibstore.h"
+#include "micmap.h"
+#include "colormapst.h"
+#include "resource.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNGC.h"
+#include "GCOps.h"
+#include "Drawable.h"
+#include "XNFont.h"
+#include "Color.h"
+#include "XNCursor.h"
+#include "Visual.h"
+#include "Events.h"
+#include "Init.h"
+#include "mipointer.h"
+#include "Args.h"
+#include "mipointrst.h"
+
+Window xnestDefaultWindows[MAXSCREENS];
+Window xnestScreenSaverWindows[MAXSCREENS];
+DevPrivateKeyRec xnestCursorScreenKeyRec;
+
+ScreenPtr
+xnestScreen(Window window)
+{
+ int i;
+
+ for (i = 0; i < xnestNumScreens; i++)
+ if (xnestDefaultWindows[i] == window)
+ return screenInfo.screens[i];
+
+ return NULL;
+}
+
+static int
+offset(unsigned long mask)
+{
+ int count;
+
+ for (count = 0; !(mask & 1) && count < 32; count++)
+ mask >>= 1;
+
+ return count;
+}
+
+static Bool
+xnestSaveScreen(ScreenPtr pScreen, int what)
+{
+ if (xnestSoftwareScreenSaver)
+ return False;
+ else {
+ switch (what) {
+ case SCREEN_SAVER_ON:
+ XMapRaised(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetScreenSaverColormapWindow(pScreen);
+ break;
+
+ case SCREEN_SAVER_OFF:
+ XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetInstalledColormapWindows(pScreen);
+ break;
+
+ case SCREEN_SAVER_FORCER:
+ lastEventTime = GetTimeInMillis();
+ XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetInstalledColormapWindows(pScreen);
+ break;
+
+ case SCREEN_SAVER_CYCLE:
+ XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetInstalledColormapWindows(pScreen);
+ break;
+ }
+ return True;
+ }
+}
+
+static Bool
+xnestCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+static void
+xnestCrossScreen(ScreenPtr pScreen, Bool entering)
+{
+}
+
+static miPointerScreenFuncRec xnestPointerCursorFuncs = {
+ xnestCursorOffScreen,
+ xnestCrossScreen,
+ miPointerWarpCursor
+};
+
+static miPointerSpriteFuncRec xnestPointerSpriteFuncs = {
+ xnestRealizeCursor,
+ xnestUnrealizeCursor,
+ xnestSetCursor,
+ xnestMoveCursor,
+ xnestDeviceCursorInitialize,
+ xnestDeviceCursorCleanup
+};
+
+Bool
+xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
+{
+ VisualPtr visuals;
+ DepthPtr depths;
+ int numVisuals, numDepths;
+ int i, j, depthIndex;
+ unsigned long valuemask;
+ XSetWindowAttributes attributes;
+ XWindowAttributes gattributes;
+ XSizeHints sizeHints;
+ VisualID defaultVisual;
+ int rootDepth;
+ miPointerScreenPtr PointPriv;
+
+ if (!dixRegisterPrivateKey
+ (&xnestWindowPrivateKeyRec, PRIVATE_WINDOW, sizeof(xnestPrivWin)))
+ return FALSE;
+ if (!dixRegisterPrivateKey
+ (&xnestGCPrivateKeyRec, PRIVATE_GC, sizeof(xnestPrivGC)))
+ return FALSE;
+ if (!dixRegisterPrivateKey
+ (&xnestPixmapPrivateKeyRec, PRIVATE_PIXMAP, sizeof(xnestPrivPixmap)))
+ return FALSE;
+ if (!dixRegisterPrivateKey
+ (&xnestColormapPrivateKeyRec, PRIVATE_COLORMAP,
+ sizeof(xnestPrivColormap)))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&xnestCursorScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ visuals = (VisualPtr) malloc(xnestNumVisuals * sizeof(VisualRec));
+ numVisuals = 0;
+
+ depths = (DepthPtr) malloc(MAXDEPTH * sizeof(DepthRec));
+ depths[0].depth = 1;
+ depths[0].numVids = 0;
+ depths[0].vids = (VisualID *) malloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
+ numDepths = 1;
+
+ for (i = 0; i < xnestNumVisuals; i++) {
+ visuals[numVisuals].class = xnestVisuals[i].class;
+ visuals[numVisuals].bitsPerRGBValue = xnestVisuals[i].bits_per_rgb;
+ visuals[numVisuals].ColormapEntries = xnestVisuals[i].colormap_size;
+ visuals[numVisuals].nplanes = xnestVisuals[i].depth;
+ visuals[numVisuals].redMask = xnestVisuals[i].red_mask;
+ visuals[numVisuals].greenMask = xnestVisuals[i].green_mask;
+ visuals[numVisuals].blueMask = xnestVisuals[i].blue_mask;
+ visuals[numVisuals].offsetRed = offset(xnestVisuals[i].red_mask);
+ visuals[numVisuals].offsetGreen = offset(xnestVisuals[i].green_mask);
+ visuals[numVisuals].offsetBlue = offset(xnestVisuals[i].blue_mask);
+
+ /* Check for and remove duplicates. */
+ for (j = 0; j < numVisuals; j++) {
+ if (visuals[numVisuals].class == visuals[j].class &&
+ visuals[numVisuals].bitsPerRGBValue ==
+ visuals[j].bitsPerRGBValue &&
+ visuals[numVisuals].ColormapEntries ==
+ visuals[j].ColormapEntries &&
+ visuals[numVisuals].nplanes == visuals[j].nplanes &&
+ visuals[numVisuals].redMask == visuals[j].redMask &&
+ visuals[numVisuals].greenMask == visuals[j].greenMask &&
+ visuals[numVisuals].blueMask == visuals[j].blueMask &&
+ visuals[numVisuals].offsetRed == visuals[j].offsetRed &&
+ visuals[numVisuals].offsetGreen == visuals[j].offsetGreen &&
+ visuals[numVisuals].offsetBlue == visuals[j].offsetBlue)
+ break;
+ }
+ if (j < numVisuals)
+ break;
+
+ visuals[numVisuals].vid = FakeClientID(0);
+
+ depthIndex = UNDEFINED;
+ for (j = 0; j < numDepths; j++)
+ if (depths[j].depth == xnestVisuals[i].depth) {
+ depthIndex = j;
+ break;
+ }
+
+ if (depthIndex == UNDEFINED) {
+ depthIndex = numDepths;
+ depths[depthIndex].depth = xnestVisuals[i].depth;
+ depths[depthIndex].numVids = 0;
+ depths[depthIndex].vids =
+ (VisualID *) malloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
+ numDepths++;
+ }
+ if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) {
+ FatalError("Visual table overflow");
+ }
+ depths[depthIndex].vids[depths[depthIndex].numVids] =
+ visuals[numVisuals].vid;
+ depths[depthIndex].numVids++;
+
+ numVisuals++;
+ }
+ visuals = (VisualPtr) realloc(visuals, numVisuals * sizeof(VisualRec));
+
+ defaultVisual = visuals[xnestDefaultVisualIndex].vid;
+ rootDepth = visuals[xnestDefaultVisualIndex].nplanes;
+
+ if (xnestParentWindow != 0) {
+ XGetWindowAttributes(xnestDisplay, xnestParentWindow, &gattributes);
+ xnestWidth = gattributes.width;
+ xnestHeight = gattributes.height;
+ }
+
+ /* myNum */
+ /* id */
+ miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth, rootDepth, numDepths, depths, defaultVisual, /* root visual */
+ numVisuals, visuals);
+
+ pScreen->defColormap = (Colormap) FakeClientID(0);
+ pScreen->minInstalledCmaps = MINCMAPS;
+ pScreen->maxInstalledCmaps = MAXCMAPS;
+ pScreen->backingStoreSupport = NotUseful;
+ pScreen->saveUnderSupport = NotUseful;
+ pScreen->whitePixel = xnestWhitePixel;
+ pScreen->blackPixel = xnestBlackPixel;
+ /* GCperDepth */
+ /* PixmapPerDepth */
+ pScreen->devPrivate = NULL;
+ /* WindowPrivateLen */
+ /* WindowPrivateSizes */
+ /* totalWindowSize */
+ /* GCPrivateLen */
+ /* GCPrivateSizes */
+ /* totalGCSize */
+
+ /* Random screen procedures */
+
+ pScreen->QueryBestSize = xnestQueryBestSize;
+ pScreen->SaveScreen = xnestSaveScreen;
+ pScreen->GetImage = xnestGetImage;
+ pScreen->GetSpans = xnestGetSpans;
+ pScreen->SourceValidate = NULL;
+
+ /* Window Procedures */
+
+ pScreen->CreateWindow = xnestCreateWindow;
+ pScreen->DestroyWindow = xnestDestroyWindow;
+ pScreen->PositionWindow = xnestPositionWindow;
+ pScreen->ChangeWindowAttributes = xnestChangeWindowAttributes;
+ pScreen->RealizeWindow = xnestRealizeWindow;
+ pScreen->UnrealizeWindow = xnestUnrealizeWindow;
+ pScreen->PostValidateTree = NULL;
+ pScreen->WindowExposures = xnestWindowExposures;
+ pScreen->CopyWindow = xnestCopyWindow;
+ pScreen->ClipNotify = xnestClipNotify;
+
+ /* Pixmap procedures */
+
+ pScreen->CreatePixmap = xnestCreatePixmap;
+ pScreen->DestroyPixmap = xnestDestroyPixmap;
+
+ /* Font procedures */
+
+ pScreen->RealizeFont = xnestRealizeFont;
+ pScreen->UnrealizeFont = xnestUnrealizeFont;
+
+ /* GC procedures */
+
+ pScreen->CreateGC = xnestCreateGC;
+
+ /* Colormap procedures */
+
+ pScreen->CreateColormap = xnestCreateColormap;
+ pScreen->DestroyColormap = xnestDestroyColormap;
+ pScreen->InstallColormap = xnestInstallColormap;
+ pScreen->UninstallColormap = xnestUninstallColormap;
+ pScreen->ListInstalledColormaps = xnestListInstalledColormaps;
+ pScreen->StoreColors = xnestStoreColors;
+ pScreen->ResolveColor = xnestResolveColor;
+
+ pScreen->BitmapToRegion = xnestPixmapToRegion;
+
+ /* OS layer procedures */
+
+ pScreen->BlockHandler = (ScreenBlockHandlerProcPtr) NoopDDA;
+ pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr) NoopDDA;
+ pScreen->blockData = NULL;
+ pScreen->wakeupData = NULL;
+
+ miDCInitialize(pScreen, &xnestPointerCursorFuncs); /* init SW rendering */
+ PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+ xnestCursorFuncs.spriteFuncs = PointPriv->spriteFuncs;
+ dixSetPrivate(&pScreen->devPrivates, xnestCursorScreenKey,
+ &xnestCursorFuncs);
+ PointPriv->spriteFuncs = &xnestPointerSpriteFuncs;
+
+ pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay,
+ DefaultScreen(xnestDisplay))
+ / DisplayWidth(xnestDisplay, DefaultScreen(xnestDisplay));
+ pScreen->mmHeight =
+ xnestHeight * DisplayHeightMM(xnestDisplay,
+ DefaultScreen(xnestDisplay)) /
+ DisplayHeight(xnestDisplay, DefaultScreen(xnestDisplay));
+
+ /* overwrite miCloseScreen with our own */
+ pScreen->CloseScreen = xnestCloseScreen;
+
+ if (!miScreenDevPrivateInit(pScreen, xnestWidth, NULL))
+ return FALSE;
+
+ /* overwrite miSetShape with our own */
+ pScreen->SetShape = xnestSetShape;
+
+ /* devPrivates */
+
+#define POSITION_OFFSET (pScreen->myNum * (xnestWidth + xnestHeight) / 32)
+
+ if (xnestDoFullGeneration) {
+
+ valuemask = CWBackPixel | CWEventMask | CWColormap;
+ attributes.background_pixel = xnestWhitePixel;
+ attributes.event_mask = xnestEventMask;
+ attributes.colormap =
+ xnestDefaultVisualColormap(xnestDefaultVisual(pScreen));
+
+ if (xnestParentWindow != 0) {
+ xnestDefaultWindows[pScreen->myNum] = xnestParentWindow;
+ XSelectInput(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
+ xnestEventMask);
+ }
+ else
+ xnestDefaultWindows[pScreen->myNum] =
+ XCreateWindow(xnestDisplay,
+ DefaultRootWindow(xnestDisplay),
+ xnestX + POSITION_OFFSET,
+ xnestY + POSITION_OFFSET,
+ xnestWidth, xnestHeight,
+ xnestBorderWidth,
+ pScreen->rootDepth,
+ InputOutput,
+ xnestDefaultVisual(pScreen),
+ valuemask, &attributes);
+
+ if (!xnestWindowName)
+ xnestWindowName = argv[0];
+
+ sizeHints.flags = PPosition | PSize | PMaxSize;
+ sizeHints.x = xnestX + POSITION_OFFSET;
+ sizeHints.y = xnestY + POSITION_OFFSET;
+ sizeHints.width = sizeHints.max_width = xnestWidth;
+ sizeHints.height = sizeHints.max_height = xnestHeight;
+ if (xnestUserGeometry & XValue || xnestUserGeometry & YValue)
+ sizeHints.flags |= USPosition;
+ if (xnestUserGeometry & WidthValue || xnestUserGeometry & HeightValue)
+ sizeHints.flags |= USSize;
+ XSetStandardProperties(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ xnestWindowName,
+ xnestWindowName,
+ xnestIconBitmap, argv, argc, &sizeHints);
+
+ XMapWindow(xnestDisplay, xnestDefaultWindows[pScreen->myNum]);
+
+ valuemask = CWBackPixmap | CWColormap;
+ attributes.background_pixmap = xnestScreenSaverPixmap;
+ attributes.colormap =
+ DefaultColormap(xnestDisplay, DefaultScreen(xnestDisplay));
+ xnestScreenSaverWindows[pScreen->myNum] =
+ XCreateWindow(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ 0, 0, xnestWidth, xnestHeight, 0,
+ DefaultDepth(xnestDisplay,
+ DefaultScreen(xnestDisplay)),
+ InputOutput, DefaultVisual(xnestDisplay,
+ DefaultScreen
+ (xnestDisplay)), valuemask,
+ &attributes);
+ }
+
+ if (!xnestCreateDefaultColormap(pScreen))
+ return False;
+
+ return True;
+}
+
+Bool
+xnestCloseScreen(int index, ScreenPtr pScreen)
+{
+ int i;
+
+ for (i = 0; i < pScreen->numDepths; i++)
+ free(pScreen->allowedDepths[i].vids);
+ free(pScreen->allowedDepths);
+ free(pScreen->visuals);
+ free(pScreen->devPrivate);
+
+ /*
+ If xnestDoFullGeneration all x resources will be destroyed upon closing
+ the display connection. There is no need to generate extra protocol.
+ */
+
+ return True;
+}
diff --git a/xorg-server/hw/xnest/Window.c b/xorg-server/hw/xnest/Window.c
index 7ef3d8b96..e2b21b58e 100644
--- a/xorg-server/hw/xnest/Window.c
+++ b/xorg-server/hw/xnest/Window.c
@@ -1,519 +1,517 @@
-/*
-
-Copyright 1993 by Davor Matic
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#ifdef HAVE_XNEST_CONFIG_H
-#include <xnest-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "gcstruct.h"
-#include "window.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "colormapst.h"
-#include "scrnintstr.h"
-#include "region.h"
-
-#include "mi.h"
-
-#include "Xnest.h"
-
-#include "Display.h"
-#include "Screen.h"
-#include "XNGC.h"
-#include "Drawable.h"
-#include "Color.h"
-#include "Visual.h"
-#include "Events.h"
-#include "Args.h"
-
-DevPrivateKeyRec xnestWindowPrivateKeyRec;
-
-static int
-xnestFindWindowMatch(WindowPtr pWin, pointer ptr)
-{
- xnestWindowMatch *wm = (xnestWindowMatch *)ptr;
- if (wm->window == xnestWindow(pWin)) {
- wm->pWin = pWin;
- return WT_STOPWALKING;
- }
- else
- return WT_WALKCHILDREN;
-}
-
-WindowPtr
-xnestWindowPtr(Window window)
-{
- xnestWindowMatch wm;
- int i;
-
- wm.pWin = NullWindow;
- wm.window = window;
-
- for (i = 0; i < xnestNumScreens; i++) {
- WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (pointer) &wm);
- if (wm.pWin) break;
- }
-
- return wm.pWin;
-}
-
-Bool
-xnestCreateWindow(WindowPtr pWin)
-{
- unsigned long mask;
- XSetWindowAttributes attributes;
- Visual *visual;
- ColormapPtr pCmap;
-
- if (pWin->drawable.class == InputOnly) {
- mask = 0L;
- visual = CopyFromParent;
- }
- else {
- mask = CWEventMask | CWBackingStore;
- attributes.event_mask = ExposureMask;
- attributes.backing_store = NotUseful;
-
- if (pWin->parent) {
- if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) {
- visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
- mask |= CWColormap;
- if (pWin->optional->colormap) {
- dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin),
- RT_COLORMAP, serverClient, DixUseAccess);
- attributes.colormap = xnestColormap(pCmap);
- }
- else
- attributes.colormap = xnestDefaultVisualColormap(visual);
- }
- else
- visual = CopyFromParent;
- }
- else { /* root windows have their own colormaps at creation time */
- visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
- dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin),
- RT_COLORMAP, serverClient, DixUseAccess);
- mask |= CWColormap;
- attributes.colormap = xnestColormap(pCmap);
- }
- }
-
- xnestWindowPriv(pWin)->window = XCreateWindow(xnestDisplay,
- xnestWindowParent(pWin),
- pWin->origin.x -
- wBorderWidth(pWin),
- pWin->origin.y -
- wBorderWidth(pWin),
- pWin->drawable.width,
- pWin->drawable.height,
- pWin->borderWidth,
- pWin->drawable.depth,
- pWin->drawable.class,
- visual,
- mask, &attributes);
- xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
- xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
- xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
- xnestWindowPriv(pWin)->width = pWin->drawable.width;
- xnestWindowPriv(pWin)->height = pWin->drawable.height;
- xnestWindowPriv(pWin)->border_width = pWin->borderWidth;
- xnestWindowPriv(pWin)->sibling_above = None;
- if (pWin->nextSib)
- xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
- xnestWindowPriv(pWin)->bounding_shape =
- RegionCreate(NULL, 1);
- xnestWindowPriv(pWin)->clip_shape =
- RegionCreate(NULL, 1);
-
- if (!pWin->parent) /* only the root window will have the right colormap */
- xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
-
- return True;
-}
-
-Bool
-xnestDestroyWindow(WindowPtr pWin)
-{
- if (pWin->nextSib)
- xnestWindowPriv(pWin->nextSib)->sibling_above =
- xnestWindowPriv(pWin)->sibling_above;
- RegionDestroy(xnestWindowPriv(pWin)->bounding_shape);
- RegionDestroy(xnestWindowPriv(pWin)->clip_shape);
- XDestroyWindow(xnestDisplay, xnestWindow(pWin));
- xnestWindowPriv(pWin)->window = None;
-
- if (pWin->optional && pWin->optional->colormap && pWin->parent)
- xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
-
- return True;
-}
-
-Bool
-xnestPositionWindow(WindowPtr pWin, int x, int y)
-{
- xnestConfigureWindow(pWin,
- CWParent |
- CWX | CWY |
- CWWidth | CWHeight |
- CWBorderWidth);
-
- return True;
-}
-
-void
-xnestConfigureWindow(WindowPtr pWin, unsigned int mask)
-{
- unsigned int valuemask;
- XWindowChanges values;
-
- if (mask & CWParent &&
- xnestWindowPriv(pWin)->parent != xnestWindowParent(pWin)) {
- XReparentWindow(xnestDisplay, xnestWindow(pWin),
- xnestWindowParent(pWin),
- pWin->origin.x - wBorderWidth(pWin),
- pWin->origin.y - wBorderWidth(pWin));
- xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
- xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
- xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
- xnestWindowPriv(pWin)->sibling_above = None;
- if (pWin->nextSib)
- xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
- }
-
- valuemask = 0;
-
- if (mask & CWX &&
- xnestWindowPriv(pWin)->x != pWin->origin.x - wBorderWidth(pWin)) {
- valuemask |= CWX;
- values.x =
- xnestWindowPriv(pWin)->x =
- pWin->origin.x - wBorderWidth(pWin);
- }
-
- if (mask & CWY &&
- xnestWindowPriv(pWin)->y != pWin->origin.y - wBorderWidth(pWin)) {
- valuemask |= CWY;
- values.y =
- xnestWindowPriv(pWin)->y =
- pWin->origin.y - wBorderWidth(pWin);
- }
-
- if (mask & CWWidth &&
- xnestWindowPriv(pWin)->width != pWin->drawable.width) {
- valuemask |= CWWidth;
- values.width =
- xnestWindowPriv(pWin)->width =
- pWin->drawable.width;
- }
-
- if (mask & CWHeight &&
- xnestWindowPriv(pWin)->height != pWin->drawable.height) {
- valuemask |= CWHeight;
- values.height =
- xnestWindowPriv(pWin)->height =
- pWin->drawable.height;
- }
-
- if (mask & CWBorderWidth &&
- xnestWindowPriv(pWin)->border_width != pWin->borderWidth) {
- valuemask |= CWBorderWidth;
- values.border_width =
- xnestWindowPriv(pWin)->border_width =
- pWin->borderWidth;
- }
-
- if (valuemask)
- XConfigureWindow(xnestDisplay, xnestWindow(pWin), valuemask, &values);
-
- if (mask & CWStackingOrder &&
- xnestWindowPriv(pWin)->sibling_above != xnestWindowSiblingAbove(pWin)) {
- WindowPtr pSib;
-
- /* find the top sibling */
- for (pSib = pWin; pSib->prevSib != NullWindow; pSib = pSib->prevSib);
-
- /* the top sibling */
- valuemask = CWStackMode;
- values.stack_mode = Above;
- XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values);
- xnestWindowPriv(pSib)->sibling_above = None;
-
- /* the rest of siblings */
- for (pSib = pSib->nextSib; pSib != NullWindow; pSib = pSib->nextSib) {
- valuemask = CWSibling | CWStackMode;
- values.sibling = xnestWindowSiblingAbove(pSib);
- values.stack_mode = Below;
- XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values);
- xnestWindowPriv(pSib)->sibling_above = xnestWindowSiblingAbove(pSib);
- }
- }
-}
-
-Bool
-xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
-{
- XSetWindowAttributes attributes;
-
- if (mask & CWBackPixmap)
- switch (pWin->backgroundState) {
- case None:
- attributes.background_pixmap = None;
- break;
-
- case ParentRelative:
- attributes.background_pixmap = ParentRelative;
- break;
-
- case BackgroundPixmap:
- attributes.background_pixmap = xnestPixmap(pWin->background.pixmap);
- break;
-
- case BackgroundPixel:
- mask &= ~CWBackPixmap;
- break;
- }
-
- if (mask & CWBackPixel) {
- if (pWin->backgroundState == BackgroundPixel)
- attributes.background_pixel = xnestPixel(pWin->background.pixel);
- else
- mask &= ~CWBackPixel;
- }
-
- if (mask & CWBorderPixmap) {
- if (pWin->borderIsPixel)
- mask &= ~CWBorderPixmap;
- else
- attributes.border_pixmap = xnestPixmap(pWin->border.pixmap);
- }
-
- if (mask & CWBorderPixel) {
- if (pWin->borderIsPixel)
- attributes.border_pixel = xnestPixel(pWin->border.pixel);
- else
- mask &= ~CWBorderPixel;
- }
-
- if (mask & CWBitGravity)
- attributes.bit_gravity = pWin->bitGravity;
-
- if (mask & CWWinGravity) /* dix does this for us */
- mask &= ~CWWinGravity;
-
- if (mask & CWBackingStore) /* this is really not useful */
- mask &= ~CWBackingStore;
-
- if (mask & CWBackingPlanes) /* this is really not useful */
- mask &= ~CWBackingPlanes;
-
- if (mask & CWBackingPixel) /* this is really not useful */
- mask &= ~CWBackingPixel;
-
- if (mask & CWOverrideRedirect)
- attributes.override_redirect = pWin->overrideRedirect;
-
- if (mask & CWSaveUnder) /* this is really not useful */
- mask &= ~CWSaveUnder;
-
- if (mask & CWEventMask) /* events are handled elsewhere */
- mask &= ~CWEventMask;
-
- if (mask & CWDontPropagate) /* events are handled elsewhere */
- mask &= ~CWDontPropagate;
-
- if (mask & CWColormap) {
- ColormapPtr pCmap;
-
- dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin), RT_COLORMAP,
- serverClient, DixUseAccess);
-
- attributes.colormap = xnestColormap(pCmap);
-
- xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
- }
-
- if (mask & CWCursor) /* this is handeled in cursor code */
- mask &= ~CWCursor;
-
- if (mask)
- XChangeWindowAttributes(xnestDisplay, xnestWindow(pWin),
- mask, &attributes);
-
- return True;
-}
-
-Bool
-xnestRealizeWindow(WindowPtr pWin)
-{
- xnestConfigureWindow(pWin, CWStackingOrder);
- xnestShapeWindow(pWin);
- XMapWindow(xnestDisplay, xnestWindow(pWin));
-
- return True;
-}
-
-Bool
-xnestUnrealizeWindow(WindowPtr pWin)
-{
- XUnmapWindow(xnestDisplay, xnestWindow(pWin));
-
- return True;
-}
-
-void
-xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion)
-{
-}
-
-void
-xnestClipNotify(WindowPtr pWin, int dx, int dy)
-{
- xnestConfigureWindow(pWin, CWStackingOrder);
- xnestShapeWindow(pWin);
-}
-
-static Bool
-xnestWindowExposurePredicate(Display *display, XEvent *event, XPointer ptr)
-{
- return (event->type == Expose && event->xexpose.window == *(Window *)ptr);
-}
-
-void
-xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed)
-{
- XEvent event;
- Window window;
- BoxRec Box;
-
- XSync(xnestDisplay, False);
-
- window = xnestWindow(pWin);
-
- while (XCheckIfEvent(xnestDisplay, &event,
- xnestWindowExposurePredicate, (char *)&window)) {
-
- Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + event.xexpose.x;
- Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + event.xexpose.y;
- Box.x2 = Box.x1 + event.xexpose.width;
- Box.y2 = Box.y1 + event.xexpose.height;
-
- event.xexpose.type = ProcessedExpose;
-
- if (RegionContainsRect(pRgn, &Box) != rgnIN)
- XPutBackEvent(xnestDisplay, &event);
- }
-
- miWindowExposures(pWin, pRgn, other_exposed);
-}
-
-void
-xnestSetShape(WindowPtr pWin, int kind)
-{
- xnestShapeWindow(pWin);
- miSetShape(pWin, kind);
-}
-
-static Bool
-xnestRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
-{
- BoxPtr pBox1, pBox2;
- unsigned int n1, n2;
-
- if (pReg1 == pReg2) return True;
-
- if (pReg1 == NullRegion || pReg2 == NullRegion) return False;
-
- pBox1 = RegionRects(pReg1);
- n1 = RegionNumRects(pReg1);
-
- pBox2 = RegionRects(pReg2);
- n2 = RegionNumRects(pReg2);
-
- if (n1 != n2) return False;
-
- if (pBox1 == pBox2) return True;
-
- if (memcmp(pBox1, pBox2, n1 * sizeof(BoxRec))) return False;
-
- return True;
-}
-
-void
-xnestShapeWindow(WindowPtr pWin)
-{
- Region reg;
- BoxPtr pBox;
- XRectangle rect;
- int i;
-
- if (!xnestRegionEqual(xnestWindowPriv(pWin)->bounding_shape,
- wBoundingShape(pWin))) {
-
- if (wBoundingShape(pWin)) {
- RegionCopy(xnestWindowPriv(pWin)->bounding_shape, wBoundingShape(pWin));
-
- reg = XCreateRegion();
- pBox = RegionRects(xnestWindowPriv(pWin)->bounding_shape);
- for (i = 0;
- i < RegionNumRects(xnestWindowPriv(pWin)->bounding_shape);
- i++) {
- rect.x = pBox[i].x1;
- rect.y = pBox[i].y1;
- rect.width = pBox[i].x2 - pBox[i].x1;
- rect.height = pBox[i].y2 - pBox[i].y1;
- XUnionRectWithRegion(&rect, reg, reg);
- }
- XShapeCombineRegion(xnestDisplay, xnestWindow(pWin),
- ShapeBounding, 0, 0, reg, ShapeSet);
- XDestroyRegion(reg);
- }
- else {
- RegionEmpty(xnestWindowPriv(pWin)->bounding_shape);
-
- XShapeCombineMask(xnestDisplay, xnestWindow(pWin),
- ShapeBounding, 0, 0, None, ShapeSet);
- }
- }
-
- if (!xnestRegionEqual(xnestWindowPriv(pWin)->clip_shape,
- wClipShape(pWin))) {
-
- if (wClipShape(pWin)) {
- RegionCopy(xnestWindowPriv(pWin)->clip_shape, wClipShape(pWin));
-
- reg = XCreateRegion();
- pBox = RegionRects(xnestWindowPriv(pWin)->clip_shape);
- for (i = 0;
- i < RegionNumRects(xnestWindowPriv(pWin)->clip_shape);
- i++) {
- rect.x = pBox[i].x1;
- rect.y = pBox[i].y1;
- rect.width = pBox[i].x2 - pBox[i].x1;
- rect.height = pBox[i].y2 - pBox[i].y1;
- XUnionRectWithRegion(&rect, reg, reg);
- }
- XShapeCombineRegion(xnestDisplay, xnestWindow(pWin),
- ShapeClip, 0, 0, reg, ShapeSet);
- XDestroyRegion(reg);
- }
- else {
- RegionEmpty(xnestWindowPriv(pWin)->clip_shape);
-
- XShapeCombineMask(xnestDisplay, xnestWindow(pWin),
- ShapeClip, 0, 0, None, ShapeSet);
- }
- }
-}
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "gcstruct.h"
+#include "window.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "mi.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNGC.h"
+#include "Drawable.h"
+#include "Color.h"
+#include "Visual.h"
+#include "Events.h"
+#include "Args.h"
+
+DevPrivateKeyRec xnestWindowPrivateKeyRec;
+
+static int
+xnestFindWindowMatch(WindowPtr pWin, pointer ptr)
+{
+ xnestWindowMatch *wm = (xnestWindowMatch *) ptr;
+
+ if (wm->window == xnestWindow(pWin)) {
+ wm->pWin = pWin;
+ return WT_STOPWALKING;
+ }
+ else
+ return WT_WALKCHILDREN;
+}
+
+WindowPtr
+xnestWindowPtr(Window window)
+{
+ xnestWindowMatch wm;
+ int i;
+
+ wm.pWin = NullWindow;
+ wm.window = window;
+
+ for (i = 0; i < xnestNumScreens; i++) {
+ WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (pointer) &wm);
+ if (wm.pWin)
+ break;
+ }
+
+ return wm.pWin;
+}
+
+Bool
+xnestCreateWindow(WindowPtr pWin)
+{
+ unsigned long mask;
+ XSetWindowAttributes attributes;
+ Visual *visual;
+ ColormapPtr pCmap;
+
+ if (pWin->drawable.class == InputOnly) {
+ mask = 0L;
+ visual = CopyFromParent;
+ }
+ else {
+ mask = CWEventMask | CWBackingStore;
+ attributes.event_mask = ExposureMask;
+ attributes.backing_store = NotUseful;
+
+ if (pWin->parent) {
+ if (pWin->optional &&
+ pWin->optional->visual != wVisual(pWin->parent)) {
+ visual =
+ xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
+ mask |= CWColormap;
+ if (pWin->optional->colormap) {
+ dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin),
+ RT_COLORMAP, serverClient,
+ DixUseAccess);
+ attributes.colormap = xnestColormap(pCmap);
+ }
+ else
+ attributes.colormap = xnestDefaultVisualColormap(visual);
+ }
+ else
+ visual = CopyFromParent;
+ }
+ else { /* root windows have their own colormaps at creation time */
+ visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
+ dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin),
+ RT_COLORMAP, serverClient, DixUseAccess);
+ mask |= CWColormap;
+ attributes.colormap = xnestColormap(pCmap);
+ }
+ }
+
+ xnestWindowPriv(pWin)->window = XCreateWindow(xnestDisplay,
+ xnestWindowParent(pWin),
+ pWin->origin.x -
+ wBorderWidth(pWin),
+ pWin->origin.y -
+ wBorderWidth(pWin),
+ pWin->drawable.width,
+ pWin->drawable.height,
+ pWin->borderWidth,
+ pWin->drawable.depth,
+ pWin->drawable.class,
+ visual, mask, &attributes);
+ xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
+ xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->width = pWin->drawable.width;
+ xnestWindowPriv(pWin)->height = pWin->drawable.height;
+ xnestWindowPriv(pWin)->border_width = pWin->borderWidth;
+ xnestWindowPriv(pWin)->sibling_above = None;
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
+ xnestWindowPriv(pWin)->bounding_shape = RegionCreate(NULL, 1);
+ xnestWindowPriv(pWin)->clip_shape = RegionCreate(NULL, 1);
+
+ if (!pWin->parent) /* only the root window will have the right colormap */
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+
+ return True;
+}
+
+Bool
+xnestDestroyWindow(WindowPtr pWin)
+{
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above =
+ xnestWindowPriv(pWin)->sibling_above;
+ RegionDestroy(xnestWindowPriv(pWin)->bounding_shape);
+ RegionDestroy(xnestWindowPriv(pWin)->clip_shape);
+ XDestroyWindow(xnestDisplay, xnestWindow(pWin));
+ xnestWindowPriv(pWin)->window = None;
+
+ if (pWin->optional && pWin->optional->colormap && pWin->parent)
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+
+ return True;
+}
+
+Bool
+xnestPositionWindow(WindowPtr pWin, int x, int y)
+{
+ xnestConfigureWindow(pWin,
+ CWParent |
+ CWX | CWY | CWWidth | CWHeight | CWBorderWidth);
+
+ return True;
+}
+
+void
+xnestConfigureWindow(WindowPtr pWin, unsigned int mask)
+{
+ unsigned int valuemask;
+ XWindowChanges values;
+
+ if (mask & CWParent &&
+ xnestWindowPriv(pWin)->parent != xnestWindowParent(pWin)) {
+ XReparentWindow(xnestDisplay, xnestWindow(pWin),
+ xnestWindowParent(pWin),
+ pWin->origin.x - wBorderWidth(pWin),
+ pWin->origin.y - wBorderWidth(pWin));
+ xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
+ xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->sibling_above = None;
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
+ }
+
+ valuemask = 0;
+
+ if (mask & CWX &&
+ xnestWindowPriv(pWin)->x != pWin->origin.x - wBorderWidth(pWin)) {
+ valuemask |= CWX;
+ values.x =
+ xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
+ }
+
+ if (mask & CWY &&
+ xnestWindowPriv(pWin)->y != pWin->origin.y - wBorderWidth(pWin)) {
+ valuemask |= CWY;
+ values.y =
+ xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
+ }
+
+ if (mask & CWWidth && xnestWindowPriv(pWin)->width != pWin->drawable.width) {
+ valuemask |= CWWidth;
+ values.width = xnestWindowPriv(pWin)->width = pWin->drawable.width;
+ }
+
+ if (mask & CWHeight &&
+ xnestWindowPriv(pWin)->height != pWin->drawable.height) {
+ valuemask |= CWHeight;
+ values.height = xnestWindowPriv(pWin)->height = pWin->drawable.height;
+ }
+
+ if (mask & CWBorderWidth &&
+ xnestWindowPriv(pWin)->border_width != pWin->borderWidth) {
+ valuemask |= CWBorderWidth;
+ values.border_width =
+ xnestWindowPriv(pWin)->border_width = pWin->borderWidth;
+ }
+
+ if (valuemask)
+ XConfigureWindow(xnestDisplay, xnestWindow(pWin), valuemask, &values);
+
+ if (mask & CWStackingOrder &&
+ xnestWindowPriv(pWin)->sibling_above != xnestWindowSiblingAbove(pWin)) {
+ WindowPtr pSib;
+
+ /* find the top sibling */
+ for (pSib = pWin; pSib->prevSib != NullWindow; pSib = pSib->prevSib);
+
+ /* the top sibling */
+ valuemask = CWStackMode;
+ values.stack_mode = Above;
+ XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values);
+ xnestWindowPriv(pSib)->sibling_above = None;
+
+ /* the rest of siblings */
+ for (pSib = pSib->nextSib; pSib != NullWindow; pSib = pSib->nextSib) {
+ valuemask = CWSibling | CWStackMode;
+ values.sibling = xnestWindowSiblingAbove(pSib);
+ values.stack_mode = Below;
+ XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask,
+ &values);
+ xnestWindowPriv(pSib)->sibling_above =
+ xnestWindowSiblingAbove(pSib);
+ }
+ }
+}
+
+Bool
+xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+ XSetWindowAttributes attributes;
+
+ if (mask & CWBackPixmap)
+ switch (pWin->backgroundState) {
+ case None:
+ attributes.background_pixmap = None;
+ break;
+
+ case ParentRelative:
+ attributes.background_pixmap = ParentRelative;
+ break;
+
+ case BackgroundPixmap:
+ attributes.background_pixmap = xnestPixmap(pWin->background.pixmap);
+ break;
+
+ case BackgroundPixel:
+ mask &= ~CWBackPixmap;
+ break;
+ }
+
+ if (mask & CWBackPixel) {
+ if (pWin->backgroundState == BackgroundPixel)
+ attributes.background_pixel = xnestPixel(pWin->background.pixel);
+ else
+ mask &= ~CWBackPixel;
+ }
+
+ if (mask & CWBorderPixmap) {
+ if (pWin->borderIsPixel)
+ mask &= ~CWBorderPixmap;
+ else
+ attributes.border_pixmap = xnestPixmap(pWin->border.pixmap);
+ }
+
+ if (mask & CWBorderPixel) {
+ if (pWin->borderIsPixel)
+ attributes.border_pixel = xnestPixel(pWin->border.pixel);
+ else
+ mask &= ~CWBorderPixel;
+ }
+
+ if (mask & CWBitGravity)
+ attributes.bit_gravity = pWin->bitGravity;
+
+ if (mask & CWWinGravity) /* dix does this for us */
+ mask &= ~CWWinGravity;
+
+ if (mask & CWBackingStore) /* this is really not useful */
+ mask &= ~CWBackingStore;
+
+ if (mask & CWBackingPlanes) /* this is really not useful */
+ mask &= ~CWBackingPlanes;
+
+ if (mask & CWBackingPixel) /* this is really not useful */
+ mask &= ~CWBackingPixel;
+
+ if (mask & CWOverrideRedirect)
+ attributes.override_redirect = pWin->overrideRedirect;
+
+ if (mask & CWSaveUnder) /* this is really not useful */
+ mask &= ~CWSaveUnder;
+
+ if (mask & CWEventMask) /* events are handled elsewhere */
+ mask &= ~CWEventMask;
+
+ if (mask & CWDontPropagate) /* events are handled elsewhere */
+ mask &= ~CWDontPropagate;
+
+ if (mask & CWColormap) {
+ ColormapPtr pCmap;
+
+ dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin),
+ RT_COLORMAP, serverClient, DixUseAccess);
+
+ attributes.colormap = xnestColormap(pCmap);
+
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+ }
+
+ if (mask & CWCursor) /* this is handeled in cursor code */
+ mask &= ~CWCursor;
+
+ if (mask)
+ XChangeWindowAttributes(xnestDisplay, xnestWindow(pWin),
+ mask, &attributes);
+
+ return True;
+}
+
+Bool
+xnestRealizeWindow(WindowPtr pWin)
+{
+ xnestConfigureWindow(pWin, CWStackingOrder);
+ xnestShapeWindow(pWin);
+ XMapWindow(xnestDisplay, xnestWindow(pWin));
+
+ return True;
+}
+
+Bool
+xnestUnrealizeWindow(WindowPtr pWin)
+{
+ XUnmapWindow(xnestDisplay, xnestWindow(pWin));
+
+ return True;
+}
+
+void
+xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion)
+{
+}
+
+void
+xnestClipNotify(WindowPtr pWin, int dx, int dy)
+{
+ xnestConfigureWindow(pWin, CWStackingOrder);
+ xnestShapeWindow(pWin);
+}
+
+static Bool
+xnestWindowExposurePredicate(Display * display, XEvent * event, XPointer ptr)
+{
+ return (event->type == Expose && event->xexpose.window == *(Window *) ptr);
+}
+
+void
+xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed)
+{
+ XEvent event;
+ Window window;
+ BoxRec Box;
+
+ XSync(xnestDisplay, False);
+
+ window = xnestWindow(pWin);
+
+ while (XCheckIfEvent(xnestDisplay, &event,
+ xnestWindowExposurePredicate, (char *) &window)) {
+
+ Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + event.xexpose.x;
+ Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + event.xexpose.y;
+ Box.x2 = Box.x1 + event.xexpose.width;
+ Box.y2 = Box.y1 + event.xexpose.height;
+
+ event.xexpose.type = ProcessedExpose;
+
+ if (RegionContainsRect(pRgn, &Box) != rgnIN)
+ XPutBackEvent(xnestDisplay, &event);
+ }
+
+ miWindowExposures(pWin, pRgn, other_exposed);
+}
+
+void
+xnestSetShape(WindowPtr pWin, int kind)
+{
+ xnestShapeWindow(pWin);
+ miSetShape(pWin, kind);
+}
+
+static Bool
+xnestRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
+{
+ BoxPtr pBox1, pBox2;
+ unsigned int n1, n2;
+
+ if (pReg1 == pReg2)
+ return True;
+
+ if (pReg1 == NullRegion || pReg2 == NullRegion)
+ return False;
+
+ pBox1 = RegionRects(pReg1);
+ n1 = RegionNumRects(pReg1);
+
+ pBox2 = RegionRects(pReg2);
+ n2 = RegionNumRects(pReg2);
+
+ if (n1 != n2)
+ return False;
+
+ if (pBox1 == pBox2)
+ return True;
+
+ if (memcmp(pBox1, pBox2, n1 * sizeof(BoxRec)))
+ return False;
+
+ return True;
+}
+
+void
+xnestShapeWindow(WindowPtr pWin)
+{
+ Region reg;
+ BoxPtr pBox;
+ XRectangle rect;
+ int i;
+
+ if (!xnestRegionEqual(xnestWindowPriv(pWin)->bounding_shape,
+ wBoundingShape(pWin))) {
+
+ if (wBoundingShape(pWin)) {
+ RegionCopy(xnestWindowPriv(pWin)->bounding_shape,
+ wBoundingShape(pWin));
+
+ reg = XCreateRegion();
+ pBox = RegionRects(xnestWindowPriv(pWin)->bounding_shape);
+ for (i = 0;
+ i < RegionNumRects(xnestWindowPriv(pWin)->bounding_shape);
+ i++) {
+ rect.x = pBox[i].x1;
+ rect.y = pBox[i].y1;
+ rect.width = pBox[i].x2 - pBox[i].x1;
+ rect.height = pBox[i].y2 - pBox[i].y1;
+ XUnionRectWithRegion(&rect, reg, reg);
+ }
+ XShapeCombineRegion(xnestDisplay, xnestWindow(pWin),
+ ShapeBounding, 0, 0, reg, ShapeSet);
+ XDestroyRegion(reg);
+ }
+ else {
+ RegionEmpty(xnestWindowPriv(pWin)->bounding_shape);
+
+ XShapeCombineMask(xnestDisplay, xnestWindow(pWin),
+ ShapeBounding, 0, 0, None, ShapeSet);
+ }
+ }
+
+ if (!xnestRegionEqual(xnestWindowPriv(pWin)->clip_shape, wClipShape(pWin))) {
+
+ if (wClipShape(pWin)) {
+ RegionCopy(xnestWindowPriv(pWin)->clip_shape, wClipShape(pWin));
+
+ reg = XCreateRegion();
+ pBox = RegionRects(xnestWindowPriv(pWin)->clip_shape);
+ for (i = 0;
+ i < RegionNumRects(xnestWindowPriv(pWin)->clip_shape); i++) {
+ rect.x = pBox[i].x1;
+ rect.y = pBox[i].y1;
+ rect.width = pBox[i].x2 - pBox[i].x1;
+ rect.height = pBox[i].y2 - pBox[i].y1;
+ XUnionRectWithRegion(&rect, reg, reg);
+ }
+ XShapeCombineRegion(xnestDisplay, xnestWindow(pWin),
+ ShapeClip, 0, 0, reg, ShapeSet);
+ XDestroyRegion(reg);
+ }
+ else {
+ RegionEmpty(xnestWindowPriv(pWin)->clip_shape);
+
+ XShapeCombineMask(xnestDisplay, xnestWindow(pWin),
+ ShapeClip, 0, 0, None, ShapeSet);
+ }
+ }
+}
diff --git a/xorg-server/hw/xnest/XNCursor.h b/xorg-server/hw/xnest/XNCursor.h
index 473b2017f..1a3c6f44e 100644
--- a/xorg-server/hw/xnest/XNCursor.h
+++ b/xorg-server/hw/xnest/XNCursor.h
@@ -22,11 +22,12 @@ typedef struct {
} xnestCursorFuncRec, *xnestCursorFuncPtr;
extern DevPrivateKeyRec xnestCursorScreenKeyRec;
+
#define xnestCursorScreenKey (&xnestCursorScreenKeyRec)
extern xnestCursorFuncRec xnestCursorFuncs;
typedef struct {
- Cursor cursor;
+ Cursor cursor;
} xnestPrivCursor;
#define xnestGetCursorPriv(pCursor, pScreen) ((xnestPrivCursor *) \
@@ -39,21 +40,13 @@ typedef struct {
(xnestGetCursorPriv(pCursor, pScreen)->cursor)
Bool xnestRealizeCursor(DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor);
+ ScreenPtr pScreen, CursorPtr pCursor);
Bool xnestUnrealizeCursor(DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor);
-void xnestRecolorCursor(ScreenPtr pScreen,
- CursorPtr pCursor,
- Bool displayed);
-void xnestSetCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor,
- int x, int y);
-void xnestMoveCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- int x, int y);
+ ScreenPtr pScreen, CursorPtr pCursor);
+void xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed);
+void xnestSetCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen, CursorPtr pCursor, int x, int y);
+void xnestMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
Bool xnestDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
void xnestDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
-#endif /* XNESTCURSOR_H */
+#endif /* XNESTCURSOR_H */
diff --git a/xorg-server/hw/xquartz/GL/capabilities.c b/xorg-server/hw/xquartz/GL/capabilities.c
index b718a4156..4624fd4db 100644
--- a/xorg-server/hw/xquartz/GL/capabilities.c
+++ b/xorg-server/hw/xquartz/GL/capabilities.c
@@ -38,313 +38,326 @@
#include "os.h"
-static void handleBufferModes(struct glCapabilitiesConfig *c, GLint bufferModes) {
- if(bufferModes & kCGLStereoscopicBit) {
- c->stereo = true;
+static void
+handleBufferModes(struct glCapabilitiesConfig *c, GLint bufferModes)
+{
+ if (bufferModes & kCGLStereoscopicBit) {
+ c->stereo = true;
}
- if(bufferModes & kCGLDoubleBufferBit) {
- c->buffers = 2;
- } else {
- c->buffers = 1;
+ if (bufferModes & kCGLDoubleBufferBit) {
+ c->buffers = 2;
+ }
+ else {
+ c->buffers = 1;
}
}
-static void handleStencilModes(struct glCapabilitiesConfig *c, GLint smodes) {
+static void
+handleStencilModes(struct glCapabilitiesConfig *c, GLint smodes)
+{
int offset = 0;
-
- if(kCGL0Bit & smodes)
- c->stencil_bit_depths[offset++] = 0;
-
- if(kCGL1Bit & smodes)
- c->stencil_bit_depths[offset++] = 1;
-
- if(kCGL2Bit & smodes)
- c->stencil_bit_depths[offset++] = 2;
-
- if(kCGL3Bit & smodes)
- c->stencil_bit_depths[offset++] = 3;
-
- if(kCGL4Bit & smodes)
- c->stencil_bit_depths[offset++] = 4;
-
- if(kCGL5Bit & smodes)
- c->stencil_bit_depths[offset++] = 5;
-
- if(kCGL6Bit & smodes)
- c->stencil_bit_depths[offset++] = 6;
-
- if(kCGL8Bit & smodes)
- c->stencil_bit_depths[offset++] = 8;
-
- if(kCGL10Bit & smodes)
- c->stencil_bit_depths[offset++] = 10;
-
- if(kCGL12Bit & smodes)
- c->stencil_bit_depths[offset++] = 12;
-
- if(kCGL16Bit & smodes)
- c->stencil_bit_depths[offset++] = 16;
-
- if(kCGL24Bit & smodes)
- c->stencil_bit_depths[offset++] = 24;
-
- if(kCGL32Bit & smodes)
- c->stencil_bit_depths[offset++] = 32;
-
- if(kCGL48Bit & smodes)
- c->stencil_bit_depths[offset++] = 48;
-
- if(kCGL64Bit & smodes)
- c->stencil_bit_depths[offset++] = 64;
-
- if(kCGL96Bit & smodes)
- c->stencil_bit_depths[offset++] = 96;
-
- if(kCGL128Bit & smodes)
- c->stencil_bit_depths[offset++] = 128;
+
+ if (kCGL0Bit & smodes)
+ c->stencil_bit_depths[offset++] = 0;
+
+ if (kCGL1Bit & smodes)
+ c->stencil_bit_depths[offset++] = 1;
+
+ if (kCGL2Bit & smodes)
+ c->stencil_bit_depths[offset++] = 2;
+
+ if (kCGL3Bit & smodes)
+ c->stencil_bit_depths[offset++] = 3;
+
+ if (kCGL4Bit & smodes)
+ c->stencil_bit_depths[offset++] = 4;
+
+ if (kCGL5Bit & smodes)
+ c->stencil_bit_depths[offset++] = 5;
+
+ if (kCGL6Bit & smodes)
+ c->stencil_bit_depths[offset++] = 6;
+
+ if (kCGL8Bit & smodes)
+ c->stencil_bit_depths[offset++] = 8;
+
+ if (kCGL10Bit & smodes)
+ c->stencil_bit_depths[offset++] = 10;
+
+ if (kCGL12Bit & smodes)
+ c->stencil_bit_depths[offset++] = 12;
+
+ if (kCGL16Bit & smodes)
+ c->stencil_bit_depths[offset++] = 16;
+
+ if (kCGL24Bit & smodes)
+ c->stencil_bit_depths[offset++] = 24;
+
+ if (kCGL32Bit & smodes)
+ c->stencil_bit_depths[offset++] = 32;
+
+ if (kCGL48Bit & smodes)
+ c->stencil_bit_depths[offset++] = 48;
+
+ if (kCGL64Bit & smodes)
+ c->stencil_bit_depths[offset++] = 64;
+
+ if (kCGL96Bit & smodes)
+ c->stencil_bit_depths[offset++] = 96;
+
+ if (kCGL128Bit & smodes)
+ c->stencil_bit_depths[offset++] = 128;
assert(offset < GLCAPS_STENCIL_BIT_DEPTH_BUFFERS);
c->total_stencil_bit_depths = offset;
}
-static int handleColorAndAccumulation(struct glColorBufCapabilities *c,
- GLint cmodes, int forAccum) {
+static int
+handleColorAndAccumulation(struct glColorBufCapabilities *c,
+ GLint cmodes, int forAccum)
+{
int offset = 0;
-
- /*1*/
- if(kCGLRGB444Bit & cmodes) {
- c[offset].r = 4;
- c[offset].g = 4;
- c[offset].b = 4;
- ++offset;
- }
-
- /*2*/
- if(kCGLARGB4444Bit & cmodes) {
- c[offset].a = 4;
- c[offset].r = 4;
- c[offset].g = 4;
- c[offset].b = 4;
- c[offset].is_argb = true;
- ++offset;
- }
-
- /*3*/
- if(kCGLRGB444A8Bit & cmodes) {
- c[offset].r = 4;
- c[offset].g = 4;
- c[offset].b = 4;
- c[offset].a = 8;
- ++offset;
- }
- /*4*/
- if(kCGLRGB555Bit & cmodes) {
- c[offset].r = 5;
- c[offset].g = 5;
- c[offset].b = 5;
- ++offset;
+ /*1 */
+ if (kCGLRGB444Bit & cmodes) {
+ c[offset].r = 4;
+ c[offset].g = 4;
+ c[offset].b = 4;
+ ++offset;
}
- /*5*/
- if(kCGLARGB1555Bit & cmodes) {
- c[offset].a = 1;
- c[offset].r = 5;
- c[offset].g = 5;
- c[offset].b = 5;
- c[offset].is_argb = true;
- ++offset;
+ /*2 */
+ if (kCGLARGB4444Bit & cmodes) {
+ c[offset].a = 4;
+ c[offset].r = 4;
+ c[offset].g = 4;
+ c[offset].b = 4;
+ c[offset].is_argb = true;
+ ++offset;
}
- /*6*/
- if(kCGLRGB555A8Bit & cmodes) {
- c[offset].r = 5;
- c[offset].g = 5;
- c[offset].b = 5;
- c[offset].a = 8;
- ++offset;
+ /*3 */
+ if (kCGLRGB444A8Bit & cmodes) {
+ c[offset].r = 4;
+ c[offset].g = 4;
+ c[offset].b = 4;
+ c[offset].a = 8;
+ ++offset;
}
- /*7*/
- if(kCGLRGB565Bit & cmodes) {
- c[offset].r = 5;
- c[offset].g = 6;
- c[offset].b = 5;
- ++offset;
+ /*4 */
+ if (kCGLRGB555Bit & cmodes) {
+ c[offset].r = 5;
+ c[offset].g = 5;
+ c[offset].b = 5;
+ ++offset;
}
- /*8*/
- if(kCGLRGB565A8Bit & cmodes) {
- c[offset].r = 5;
- c[offset].g = 6;
- c[offset].b = 5;
- c[offset].a = 8;
- ++offset;
+ /*5 */
+ if (kCGLARGB1555Bit & cmodes) {
+ c[offset].a = 1;
+ c[offset].r = 5;
+ c[offset].g = 5;
+ c[offset].b = 5;
+ c[offset].is_argb = true;
+ ++offset;
}
- /*9*/
- if(kCGLRGB888Bit & cmodes) {
- c[offset].r = 8;
- c[offset].g = 8;
- c[offset].b = 8;
- ++offset;
+ /*6 */
+ if (kCGLRGB555A8Bit & cmodes) {
+ c[offset].r = 5;
+ c[offset].g = 5;
+ c[offset].b = 5;
+ c[offset].a = 8;
+ ++offset;
}
- /*10*/
- if(kCGLARGB8888Bit & cmodes) {
- c[offset].a = 8;
- c[offset].r = 8;
- c[offset].g = 8;
- c[offset].b = 8;
- c[offset].is_argb = true;
- ++offset;
+ /*7 */
+ if (kCGLRGB565Bit & cmodes) {
+ c[offset].r = 5;
+ c[offset].g = 6;
+ c[offset].b = 5;
+ ++offset;
}
- /*11*/
- if(kCGLRGB888A8Bit & cmodes) {
- c[offset].r = 8;
- c[offset].g = 8;
- c[offset].b = 8;
- c[offset].a = 8;
- ++offset;
+ /*8 */
+ if (kCGLRGB565A8Bit & cmodes) {
+ c[offset].r = 5;
+ c[offset].g = 6;
+ c[offset].b = 5;
+ c[offset].a = 8;
+ ++offset;
}
- if(forAccum) {
-//#if 0
- /* FIXME
- * Disable this path, because some part of libGL, X, or Xplugin
- * doesn't work with sizes greater than 8.
- * When this is enabled and visuals are chosen using depths
- * such as 16, the result is that the windows don't redraw
- * and are often white, until a resize.
- */
-
- /*12*/
- if(kCGLRGB101010Bit & cmodes) {
- c[offset].r = 10;
- c[offset].g = 10;
- c[offset].b = 10;
- ++offset;
+ /*9 */
+ if (kCGLRGB888Bit & cmodes) {
+ c[offset].r = 8;
+ c[offset].g = 8;
+ c[offset].b = 8;
+ ++offset;
}
- /*13*/
- if(kCGLARGB2101010Bit & cmodes) {
- c[offset].a = 2;
- c[offset].r = 10;
- c[offset].g = 10;
- c[offset].b = 10;
- c[offset].is_argb = true;
- ++offset;
+ /*10 */
+ if (kCGLARGB8888Bit & cmodes) {
+ c[offset].a = 8;
+ c[offset].r = 8;
+ c[offset].g = 8;
+ c[offset].b = 8;
+ c[offset].is_argb = true;
+ ++offset;
}
- /*14*/
- if(kCGLRGB101010_A8Bit & cmodes) {
- c[offset].r = 10;
- c[offset].g = 10;
- c[offset].b = 10;
- c[offset].a = 8;
- ++offset;
+ /*11 */
+ if (kCGLRGB888A8Bit & cmodes) {
+ c[offset].r = 8;
+ c[offset].g = 8;
+ c[offset].b = 8;
+ c[offset].a = 8;
+ ++offset;
}
- /*15*/
- if(kCGLRGB121212Bit & cmodes) {
- c[offset].r = 12;
- c[offset].g = 12;
- c[offset].b = 12;
- ++offset;
- }
-
- /*16*/
- if(kCGLARGB12121212Bit & cmodes) {
- c[offset].a = 12;
- c[offset].r = 12;
- c[offset].g = 12;
- c[offset].b = 12;
- c[offset].is_argb = true;
- ++offset;
- }
-
- /*17*/
- if(kCGLRGB161616Bit & cmodes) {
- c[offset].r = 16;
- c[offset].g = 16;
- c[offset].b = 16;
- ++offset;
- }
-
- /*18*/
- if(kCGLRGBA16161616Bit & cmodes) {
- c[offset].r = 16;
- c[offset].g = 16;
- c[offset].b = 16;
- c[offset].a = 16;
- ++offset;
- }
+ if (forAccum) {
+//#if 0
+ /* FIXME
+ * Disable this path, because some part of libGL, X, or Xplugin
+ * doesn't work with sizes greater than 8.
+ * When this is enabled and visuals are chosen using depths
+ * such as 16, the result is that the windows don't redraw
+ * and are often white, until a resize.
+ */
+
+ /*12 */
+ if (kCGLRGB101010Bit & cmodes) {
+ c[offset].r = 10;
+ c[offset].g = 10;
+ c[offset].b = 10;
+ ++offset;
+ }
+
+ /*13 */
+ if (kCGLARGB2101010Bit & cmodes) {
+ c[offset].a = 2;
+ c[offset].r = 10;
+ c[offset].g = 10;
+ c[offset].b = 10;
+ c[offset].is_argb = true;
+ ++offset;
+ }
+
+ /*14 */
+ if (kCGLRGB101010_A8Bit & cmodes) {
+ c[offset].r = 10;
+ c[offset].g = 10;
+ c[offset].b = 10;
+ c[offset].a = 8;
+ ++offset;
+ }
+
+ /*15 */
+ if (kCGLRGB121212Bit & cmodes) {
+ c[offset].r = 12;
+ c[offset].g = 12;
+ c[offset].b = 12;
+ ++offset;
+ }
+
+ /*16 */
+ if (kCGLARGB12121212Bit & cmodes) {
+ c[offset].a = 12;
+ c[offset].r = 12;
+ c[offset].g = 12;
+ c[offset].b = 12;
+ c[offset].is_argb = true;
+ ++offset;
+ }
+
+ /*17 */
+ if (kCGLRGB161616Bit & cmodes) {
+ c[offset].r = 16;
+ c[offset].g = 16;
+ c[offset].b = 16;
+ ++offset;
+ }
+
+ /*18 */
+ if (kCGLRGBA16161616Bit & cmodes) {
+ c[offset].r = 16;
+ c[offset].g = 16;
+ c[offset].b = 16;
+ c[offset].a = 16;
+ ++offset;
+ }
}
//#endif
/* FIXME should we handle the floating point color modes, and if so, how? */
-
+
return offset;
}
-
-static void handleColorModes(struct glCapabilitiesConfig *c, GLint cmodes) {
+static void
+handleColorModes(struct glCapabilitiesConfig *c, GLint cmodes)
+{
c->total_color_buffers = handleColorAndAccumulation(c->color_buffers,
- cmodes, 0);
-
+ cmodes, 0);
+
assert(c->total_color_buffers < GLCAPS_COLOR_BUFFERS);
}
-static void handleAccumulationModes(struct glCapabilitiesConfig *c, GLint cmodes) {
+static void
+handleAccumulationModes(struct glCapabilitiesConfig *c, GLint cmodes)
+{
c->total_accum_buffers = handleColorAndAccumulation(c->accum_buffers,
- cmodes, 1);
+ cmodes, 1);
assert(c->total_accum_buffers < GLCAPS_COLOR_BUFFERS);
}
-static void handleDepthModes(struct glCapabilitiesConfig *c, GLint dmodes) {
+static void
+handleDepthModes(struct glCapabilitiesConfig *c, GLint dmodes)
+{
int offset = 0;
+
#define DEPTH(flag,value) do { \
if(dmodes & flag) { \
c->depth_buffers[offset++] = value; \
} \
} while(0)
- /*1*/
+ /*1 */
DEPTH(kCGL0Bit, 0);
- /*2*/
+ /*2 */
DEPTH(kCGL1Bit, 1);
- /*3*/
+ /*3 */
DEPTH(kCGL2Bit, 2);
- /*4*/
+ /*4 */
DEPTH(kCGL3Bit, 3);
- /*5*/
+ /*5 */
DEPTH(kCGL4Bit, 4);
- /*6*/
+ /*6 */
DEPTH(kCGL5Bit, 5);
- /*7*/
+ /*7 */
DEPTH(kCGL6Bit, 6);
- /*8*/
+ /*8 */
DEPTH(kCGL8Bit, 8);
- /*9*/
+ /*9 */
DEPTH(kCGL10Bit, 10);
- /*10*/
+ /*10 */
DEPTH(kCGL12Bit, 12);
- /*11*/
+ /*11 */
DEPTH(kCGL16Bit, 16);
- /*12*/
+ /*12 */
DEPTH(kCGL24Bit, 24);
- /*13*/
+ /*13 */
DEPTH(kCGL32Bit, 32);
- /*14*/
+ /*14 */
DEPTH(kCGL48Bit, 48);
- /*15*/
+ /*15 */
DEPTH(kCGL64Bit, 64);
- /*16*/
+ /*16 */
DEPTH(kCGL96Bit, 96);
- /*17*/
+ /*17 */
DEPTH(kCGL128Bit, 128);
#undef DEPTH
@@ -354,95 +367,96 @@ static void handleDepthModes(struct glCapabilitiesConfig *c, GLint dmodes) {
}
/* Return non-zero if an error occured. */
-static CGLError handleRendererDescriptions(CGLRendererInfoObj info, GLint r,
- struct glCapabilitiesConfig *c) {
+static CGLError
+handleRendererDescriptions(CGLRendererInfoObj info, GLint r,
+ struct glCapabilitiesConfig *c)
+{
CGLError err;
GLint accelerated = 0, flags = 0, aux = 0, samplebufs = 0, samples = 0;
- err = CGLDescribeRenderer (info, r, kCGLRPAccelerated, &accelerated);
+ err = CGLDescribeRenderer(info, r, kCGLRPAccelerated, &accelerated);
+
+ if (err)
+ return err;
- if(err)
- return err;
-
c->accelerated = accelerated;
/* Buffering modes: single/double, stereo */
err = CGLDescribeRenderer(info, r, kCGLRPBufferModes, &flags);
- if(err)
- return err;
-
+ if (err)
+ return err;
+
handleBufferModes(c, flags);
-
+
/* AUX buffers */
err = CGLDescribeRenderer(info, r, kCGLRPMaxAuxBuffers, &aux);
- if(err)
- return err;
-
+ if (err)
+ return err;
+
c->aux_buffers = aux;
-
/* Depth buffer size */
err = CGLDescribeRenderer(info, r, kCGLRPDepthModes, &flags);
-
- if(err)
- return err;
- handleDepthModes(c, flags);
+ if (err)
+ return err;
+ handleDepthModes(c, flags);
/* Multisample buffers */
err = CGLDescribeRenderer(info, r, kCGLRPMaxSampleBuffers, &samplebufs);
- if(err)
- return err;
+ if (err)
+ return err;
c->multisample_buffers = samplebufs;
-
/* Multisample samples per multisample buffer */
err = CGLDescribeRenderer(info, r, kCGLRPMaxSamples, &samples);
- if(err)
- return err;
+ if (err)
+ return err;
c->multisample_samples = samples;
-
/* Stencil bit depths */
err = CGLDescribeRenderer(info, r, kCGLRPStencilModes, &flags);
- if(err)
- return err;
-
- handleStencilModes(c, flags);
+ if (err)
+ return err;
+ handleStencilModes(c, flags);
/* Color modes (RGB/RGBA depths supported */
err = CGLDescribeRenderer(info, r, kCGLRPColorModes, &flags);
- if(err)
- return err;
-
+ if (err)
+ return err;
+
handleColorModes(c, flags);
err = CGLDescribeRenderer(info, r, kCGLRPAccumModes, &flags);
- if(err)
- return err;
+ if (err)
+ return err;
handleAccumulationModes(c, flags);
-
+
return kCGLNoError;
}
-static void initCapabilities(struct glCapabilities *cap) {
+static void
+initCapabilities(struct glCapabilities *cap)
+{
cap->configurations = NULL;
cap->total_configurations = 0;
}
-static void initConfig(struct glCapabilitiesConfig *c) {
+static void
+initConfig(struct glCapabilitiesConfig *c)
+{
int i;
c->accelerated = false;
@@ -452,8 +466,8 @@ static void initConfig(struct glCapabilitiesConfig *c) {
c->total_depth_buffer_depths = 0;
- for(i = 0; i < GLCAPS_DEPTH_BUFFERS; ++i) {
- c->depth_buffers[i] = GLCAPS_INVALID_DEPTH_VALUE;
+ for (i = 0; i < GLCAPS_DEPTH_BUFFERS; ++i) {
+ c->depth_buffers[i] = GLCAPS_INVALID_DEPTH_VALUE;
}
c->multisample_buffers = 0;
@@ -461,83 +475,88 @@ static void initConfig(struct glCapabilitiesConfig *c) {
c->total_stencil_bit_depths = 0;
- for(i = 0; i < GLCAPS_STENCIL_BIT_DEPTH_BUFFERS; ++i) {
- c->stencil_bit_depths[i] = GLCAPS_INVALID_STENCIL_DEPTH;
+ for (i = 0; i < GLCAPS_STENCIL_BIT_DEPTH_BUFFERS; ++i) {
+ c->stencil_bit_depths[i] = GLCAPS_INVALID_STENCIL_DEPTH;
}
-
+
c->total_color_buffers = 0;
- for(i = 0; i < GLCAPS_COLOR_BUFFERS; ++i) {
- c->color_buffers[i].r = c->color_buffers[i].g =
- c->color_buffers[i].b = c->color_buffers[i].a =
- GLCAPS_COLOR_BUF_INVALID_VALUE;
- c->color_buffers[i].is_argb = false;
- }
+ for (i = 0; i < GLCAPS_COLOR_BUFFERS; ++i) {
+ c->color_buffers[i].r = c->color_buffers[i].g =
+ c->color_buffers[i].b = c->color_buffers[i].a =
+ GLCAPS_COLOR_BUF_INVALID_VALUE;
+ c->color_buffers[i].is_argb = false;
+ }
c->total_accum_buffers = 0;
- for(i = 0; i < GLCAPS_COLOR_BUFFERS; ++i) {
- c->accum_buffers[i].r = c->accum_buffers[i].g =
- c->accum_buffers[i].b = c->accum_buffers[i].a =
- GLCAPS_COLOR_BUF_INVALID_VALUE;
- c->accum_buffers[i].is_argb = false;
+ for (i = 0; i < GLCAPS_COLOR_BUFFERS; ++i) {
+ c->accum_buffers[i].r = c->accum_buffers[i].g =
+ c->accum_buffers[i].b = c->accum_buffers[i].a =
+ GLCAPS_COLOR_BUF_INVALID_VALUE;
+ c->accum_buffers[i].is_argb = false;
}
c->next = NULL;
}
-void freeGlCapabilities(struct glCapabilities *cap) {
+void
+freeGlCapabilities(struct glCapabilities *cap)
+{
struct glCapabilitiesConfig *conf, *next;
-
+
conf = cap->configurations;
- while(conf) {
- next = conf->next;
- free(conf);
- conf = next;
+ while (conf) {
+ next = conf->next;
+ free(conf);
+ conf = next;
}
- cap->configurations = NULL;
+ cap->configurations = NULL;
}
/*Return true if an error occured. */
-bool getGlCapabilities(struct glCapabilities *cap) {
- CGLRendererInfoObj info;
+bool
+getGlCapabilities(struct glCapabilities *cap)
+{
+ CGLRendererInfoObj info;
CGLError err;
- GLint numRenderers = 0, r;
+ GLint numRenderers = 0, r;
initCapabilities(cap);
- err = CGLQueryRendererInfo((GLuint)-1, &info, &numRenderers);
- if(err) {
- ErrorF("CGLQueryRendererInfo error: %s\n", CGLErrorString(err));
+ err = CGLQueryRendererInfo((GLuint) - 1, &info, &numRenderers);
+ if (err) {
+ ErrorF("CGLQueryRendererInfo error: %s\n", CGLErrorString(err));
return err;
- }
+ }
- for(r = 0; r < numRenderers; r++) {
- struct glCapabilitiesConfig tmpconf, *conf;
+ for (r = 0; r < numRenderers; r++) {
+ struct glCapabilitiesConfig tmpconf, *conf;
- initConfig(&tmpconf);
+ initConfig(&tmpconf);
- err = handleRendererDescriptions(info, r, &tmpconf);
- if(err) {
- ErrorF("handleRendererDescriptions returned error: %s\n", CGLErrorString(err));
+ err = handleRendererDescriptions(info, r, &tmpconf);
+ if (err) {
+ ErrorF("handleRendererDescriptions returned error: %s\n",
+ CGLErrorString(err));
ErrorF("trying to continue...\n");
continue;
- }
+ }
- conf = malloc(sizeof(*conf));
- if(NULL == conf) {
- FatalError("Unable to allocate memory for OpenGL capabilities\n");
- }
+ conf = malloc(sizeof(*conf));
+ if (NULL == conf) {
+ FatalError("Unable to allocate memory for OpenGL capabilities\n");
+ }
- /* Copy the struct. */
- *conf = tmpconf;
+ /* Copy the struct. */
+ *conf = tmpconf;
- /* Now link the configuration into the list. */
- conf->next = cap->configurations;
- cap->configurations = conf;
- }
+ /* Now link the configuration into the list. */
+ conf->next = cap->configurations;
+ cap->configurations = conf;
+ }
CGLDestroyRendererInfo(info);
diff --git a/xorg-server/hw/xquartz/GL/glcontextmodes.c b/xorg-server/hw/xquartz/GL/glcontextmodes.c
index 52a9ca440..79fadf876 100644
--- a/xorg-server/hw/xquartz/GL/glcontextmodes.c
+++ b/xorg-server/hw/xquartz/GL/glcontextmodes.c
@@ -1,550 +1,538 @@
-/*
- * (C) Copyright IBM Corporation 2003
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file glcontextmodes.c
- * Utility routines for working with \c __GLcontextModes structures. At
- * some point most or all of these functions will be moved to the Mesa
- * code base.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#if defined(IN_MINI_GLX)
-#include <GL/gl.h>
-#else
-#if defined(HAVE_DIX_CONFIG_H)
-# include <dix-config.h>
-#endif
-#include <X11/X.h>
-#include <GL/glx.h>
-#include "GL/glxint.h"
-#endif
-
-/* Memory macros */
-#if defined(IN_MINI_GLX)
-# include <stdlib.h>
-# include <string.h>
-# define _mesa_malloc(b) malloc(b)
-# define _mesa_free(m) free(m)
-# define _mesa_memset memset
-#else
-# ifdef XFree86Server
-# include <os.h>
-# include <string.h>
-# define _mesa_malloc(b) malloc(b)
-# define _mesa_free(m) free(m)
-# define _mesa_memset memset
-# else
-# include <X11/Xlibint.h>
-# define _mesa_memset memset
-# define _mesa_malloc(b) Xmalloc(b)
-# define _mesa_free(m) free(m)
-# endif /* XFree86Server */
-#endif /* !defined(IN_MINI_GLX) */
-
-#include "glcontextmodes.h"
-
-#if !defined(IN_MINI_GLX)
-#define NUM_VISUAL_TYPES 6
-
-/**
- * Convert an X visual type to a GLX visual type.
- *
- * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.)
- * to be converted.
- * \return If \c visualType is a valid X visual type, a GLX visual type will
- * be returned. Otherwise \c GLX_NONE will be returned.
- */
-GLint
-_gl_convert_from_x_visual_type( int visualType )
-{
- static const int glx_visual_types[ NUM_VISUAL_TYPES ] = {
- GLX_STATIC_GRAY, GLX_GRAY_SCALE,
- GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
- GLX_TRUE_COLOR, GLX_DIRECT_COLOR
- };
-
- return ( (unsigned) visualType < NUM_VISUAL_TYPES )
- ? glx_visual_types[ visualType ] : GLX_NONE;
-}
-
-
-/**
- * Convert a GLX visual type to an X visual type.
- *
- * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR,
- * \c GLX_STATIC_GRAY, etc.) to be converted.
- * \return If \c visualType is a valid GLX visual type, an X visual type will
- * be returned. Otherwise -1 will be returned.
- */
-GLint
-_gl_convert_to_x_visual_type( int visualType )
-{
- static const int x_visual_types[ NUM_VISUAL_TYPES ] = {
- TrueColor, DirectColor,
- PseudoColor, StaticColor,
- GrayScale, StaticGray
- };
-
- return ( (unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES )
- ? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1;
-}
-
-
-/**
- * Copy a GLX visual config structure to a GL context mode structure. All
- * of the fields in \c config are copied to \c mode. Additional fields in
- * \c mode that can be derrived from the fields of \c config (i.e.,
- * \c haveDepthBuffer) are also filled in. The remaining fields in \c mode
- * that cannot be derived are set to default values.
- *
- * \param mode Destination GL context mode.
- * \param config Source GLX visual config.
- *
- * \note
- * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes
- * structure will be set to the \c vid of the \c __GLXvisualConfig structure.
- */
-void
-_gl_copy_visual_to_context_mode( __GLcontextModes * mode,
- const __GLXvisualConfig * config )
-{
- __GLcontextModes * const next = mode->next;
-
- (void) _mesa_memset( mode, 0, sizeof( __GLcontextModes ) );
- mode->next = next;
-
- mode->visualID = config->vid;
- mode->visualType = _gl_convert_from_x_visual_type( config->class );
- mode->xRenderable = GL_TRUE;
- mode->fbconfigID = config->vid;
- mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
-
- mode->rgbMode = (config->rgba != 0);
- mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
-
- mode->colorIndexMode = !(mode->rgbMode);
- mode->doubleBufferMode = (config->doubleBuffer != 0);
- mode->stereoMode = (config->stereo != 0);
-
- mode->haveAccumBuffer = ((config->accumRedSize +
- config->accumGreenSize +
- config->accumBlueSize +
- config->accumAlphaSize) > 0);
- mode->haveDepthBuffer = (config->depthSize > 0);
- mode->haveStencilBuffer = (config->stencilSize > 0);
-
- mode->redBits = config->redSize;
- mode->greenBits = config->greenSize;
- mode->blueBits = config->blueSize;
- mode->alphaBits = config->alphaSize;
- mode->redMask = config->redMask;
- mode->greenMask = config->greenMask;
- mode->blueMask = config->blueMask;
- mode->alphaMask = config->alphaMask;
- mode->rgbBits = mode->rgbMode ? config->bufferSize : 0;
- mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0;
-
- mode->accumRedBits = config->accumRedSize;
- mode->accumGreenBits = config->accumGreenSize;
- mode->accumBlueBits = config->accumBlueSize;
- mode->accumAlphaBits = config->accumAlphaSize;
- mode->depthBits = config->depthSize;
- mode->stencilBits = config->stencilSize;
-
- mode->numAuxBuffers = config->auxBuffers;
- mode->level = config->level;
-
- mode->visualRating = config->visualRating;
- mode->transparentPixel = config->transparentPixel;
- mode->transparentRed = config->transparentRed;
- mode->transparentGreen = config->transparentGreen;
- mode->transparentBlue = config->transparentBlue;
- mode->transparentAlpha = config->transparentAlpha;
- mode->transparentIndex = config->transparentIndex;
- mode->samples = config->multiSampleSize;
- mode->sampleBuffers = config->nMultiSampleBuffers;
- /* mode->visualSelectGroup = config->visualSelectGroup; ? */
-
- mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
-
- mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE;
- mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ?
- GL_TRUE : GL_FALSE;
- mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE;
- mode->bindToTextureTargets = mode->rgbMode ?
- GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
- GLX_TEXTURE_RECTANGLE_BIT_EXT : 0;
- mode->yInverted = GL_FALSE;
-}
-
-
-/**
- * Get data from a GL context mode.
- *
- * \param mode GL context mode whose data is to be returned.
- * \param attribute Attribute of \c mode that is to be returned.
- * \param value_return Location to store the data member of \c mode.
- * \return If \c attribute is a valid attribute of \c mode, zero is
- * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned.
- */
-int
-_gl_get_context_mode_data(const __GLcontextModes *mode, int attribute,
- int *value_return)
-{
- switch (attribute) {
- case GLX_USE_GL:
- *value_return = GL_TRUE;
- return 0;
- case GLX_BUFFER_SIZE:
- *value_return = mode->rgbBits;
- return 0;
- case GLX_RGBA:
- *value_return = mode->rgbMode;
- return 0;
- case GLX_RED_SIZE:
- *value_return = mode->redBits;
- return 0;
- case GLX_GREEN_SIZE:
- *value_return = mode->greenBits;
- return 0;
- case GLX_BLUE_SIZE:
- *value_return = mode->blueBits;
- return 0;
- case GLX_ALPHA_SIZE:
- *value_return = mode->alphaBits;
- return 0;
- case GLX_DOUBLEBUFFER:
- *value_return = mode->doubleBufferMode;
- return 0;
- case GLX_STEREO:
- *value_return = mode->stereoMode;
- return 0;
- case GLX_AUX_BUFFERS:
- *value_return = mode->numAuxBuffers;
- return 0;
- case GLX_DEPTH_SIZE:
- *value_return = mode->depthBits;
- return 0;
- case GLX_STENCIL_SIZE:
- *value_return = mode->stencilBits;
- return 0;
- case GLX_ACCUM_RED_SIZE:
- *value_return = mode->accumRedBits;
- return 0;
- case GLX_ACCUM_GREEN_SIZE:
- *value_return = mode->accumGreenBits;
- return 0;
- case GLX_ACCUM_BLUE_SIZE:
- *value_return = mode->accumBlueBits;
- return 0;
- case GLX_ACCUM_ALPHA_SIZE:
- *value_return = mode->accumAlphaBits;
- return 0;
- case GLX_LEVEL:
- *value_return = mode->level;
- return 0;
- case GLX_TRANSPARENT_TYPE_EXT:
- *value_return = mode->transparentPixel;
- return 0;
- case GLX_TRANSPARENT_RED_VALUE:
- *value_return = mode->transparentRed;
- return 0;
- case GLX_TRANSPARENT_GREEN_VALUE:
- *value_return = mode->transparentGreen;
- return 0;
- case GLX_TRANSPARENT_BLUE_VALUE:
- *value_return = mode->transparentBlue;
- return 0;
- case GLX_TRANSPARENT_ALPHA_VALUE:
- *value_return = mode->transparentAlpha;
- return 0;
- case GLX_TRANSPARENT_INDEX_VALUE:
- *value_return = mode->transparentIndex;
- return 0;
- case GLX_X_VISUAL_TYPE:
- *value_return = mode->visualType;
- return 0;
- case GLX_CONFIG_CAVEAT:
- *value_return = mode->visualRating;
- return 0;
- case GLX_VISUAL_ID:
- *value_return = mode->visualID;
- return 0;
- case GLX_DRAWABLE_TYPE:
- *value_return = mode->drawableType;
- return 0;
- case GLX_RENDER_TYPE:
- *value_return = mode->renderType;
- return 0;
- case GLX_X_RENDERABLE:
- *value_return = mode->xRenderable;
- return 0;
- case GLX_FBCONFIG_ID:
- *value_return = mode->fbconfigID;
- return 0;
- case GLX_MAX_PBUFFER_WIDTH:
- *value_return = mode->maxPbufferWidth;
- return 0;
- case GLX_MAX_PBUFFER_HEIGHT:
- *value_return = mode->maxPbufferHeight;
- return 0;
- case GLX_MAX_PBUFFER_PIXELS:
- *value_return = mode->maxPbufferPixels;
- return 0;
- case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
- *value_return = mode->optimalPbufferWidth;
- return 0;
- case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
- *value_return = mode->optimalPbufferHeight;
- return 0;
- case GLX_SWAP_METHOD_OML:
- *value_return = mode->swapMethod;
- return 0;
- case GLX_SAMPLE_BUFFERS_SGIS:
- *value_return = mode->sampleBuffers;
- return 0;
- case GLX_SAMPLES_SGIS:
- *value_return = mode->samples;
- return 0;
- case GLX_BIND_TO_TEXTURE_RGB_EXT:
- *value_return = mode->bindToTextureRgb;
- return 0;
- case GLX_BIND_TO_TEXTURE_RGBA_EXT:
- *value_return = mode->bindToTextureRgba;
- return 0;
- case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
- *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE :
- GL_FALSE;
- return 0;
- case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
- *value_return = mode->bindToTextureTargets;
- return 0;
- case GLX_Y_INVERTED_EXT:
- *value_return = mode->yInverted;
- return 0;
-
- /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX.
- * It is ONLY for communication between the GLX client and the GLX
- * server.
- */
- case GLX_VISUAL_SELECT_GROUP_SGIX:
- default:
- return GLX_BAD_ATTRIBUTE;
- }
-}
-#endif /* !defined(IN_MINI_GLX) */
-
-
-/**
- * Allocate a linked list of \c __GLcontextModes structures. The fields of
- * each structure will be initialized to "reasonable" default values. In
- * most cases this is the default value defined by table 3.4 of the GLX
- * 1.3 specification. This means that most values are either initialized to
- * zero or \c GLX_DONT_CARE (which is -1). As support for additional
- * extensions is added, the new values will be initialized to appropriate
- * values from the extension specification.
- *
- * \param count Number of structures to allocate.
- * \param minimum_size Minimum size of a structure to allocate. This allows
- * for differences in the version of the
- * \c __GLcontextModes stucture used in libGL and in a
- * DRI-based driver.
- * \returns A pointer to the first element in a linked list of \c count
- * stuctures on success, or \c NULL on failure.
- *
- * \warning Use of \c minimum_size does \b not guarantee binary compatibility.
- * The fundamental assumption is that if the \c minimum_size
- * specified by the driver and the size of the \c __GLcontextModes
- * structure in libGL is the same, then the meaning of each byte in
- * the structure is the same in both places. \b Be \b careful!
- * Basically this means that fields have to be added in libGL and
- * then propagated to drivers. Drivers should \b never arbitrarilly
- * extend the \c __GLcontextModes data-structure.
- */
-__GLcontextModes *
-_gl_context_modes_create( unsigned count, size_t minimum_size )
-{
- const size_t size = (minimum_size > sizeof( __GLcontextModes ))
- ? minimum_size : sizeof( __GLcontextModes );
- __GLcontextModes * base = NULL;
- __GLcontextModes ** next;
- unsigned i;
-
- next = & base;
- for ( i = 0 ; i < count ; i++ ) {
- *next = (__GLcontextModes *) _mesa_malloc( size );
- if ( *next == NULL ) {
- _gl_context_modes_destroy( base );
- base = NULL;
- break;
- }
-
- (void) _mesa_memset( *next, 0, size );
- (*next)->visualID = GLX_DONT_CARE;
- (*next)->visualType = GLX_DONT_CARE;
- (*next)->visualRating = GLX_NONE;
- (*next)->transparentPixel = GLX_NONE;
- (*next)->transparentRed = GLX_DONT_CARE;
- (*next)->transparentGreen = GLX_DONT_CARE;
- (*next)->transparentBlue = GLX_DONT_CARE;
- (*next)->transparentAlpha = GLX_DONT_CARE;
- (*next)->transparentIndex = GLX_DONT_CARE;
- (*next)->xRenderable = GLX_DONT_CARE;
- (*next)->fbconfigID = GLX_DONT_CARE;
- (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
- (*next)->bindToTextureRgb = GLX_DONT_CARE;
- (*next)->bindToTextureRgba = GLX_DONT_CARE;
- (*next)->bindToMipmapTexture = GLX_DONT_CARE;
- (*next)->bindToTextureTargets = GLX_DONT_CARE;
- (*next)->yInverted = GLX_DONT_CARE;
-
- next = & ((*next)->next);
- }
-
- return base;
-}
-
-
-/**
- * Destroy a linked list of \c __GLcontextModes structures created by
- * \c _gl_context_modes_create.
- *
- * \param modes Linked list of structures to be destroyed. All structres
- * in the list will be freed.
- */
-void
-_gl_context_modes_destroy( __GLcontextModes * modes )
-{
- while ( modes != NULL ) {
- __GLcontextModes * const next = modes->next;
-
- _mesa_free( modes );
- modes = next;
- }
-}
-
-
-/**
- * Find a context mode matching a Visual ID.
- *
- * \param modes List list of context-mode structures to be searched.
- * \param vid Visual ID to be found.
- * \returns A pointer to a context-mode in \c modes if \c vid was found in
- * the list, or \c NULL if it was not.
- */
-
-__GLcontextModes *
-_gl_context_modes_find_visual(__GLcontextModes *modes, int vid)
-{
- __GLcontextModes *m;
-
- for (m = modes; m != NULL; m = m->next)
- if (m->visualID == vid)
- return m;
-
- return NULL;
-}
-
-__GLcontextModes *
-_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid)
-{
- __GLcontextModes *m;
-
- for (m = modes; m != NULL; m = m->next)
- if (m->fbconfigID == fbid)
- return m;
-
- return NULL;
-}
-
-/**
- * Determine if two context-modes are the same. This is intended to be used
- * by libGL implementations to compare to sets of driver generated FBconfigs.
- *
- * \param a Context-mode to be compared.
- * \param b Context-mode to be compared.
- * \returns \c GL_TRUE if the two context-modes are the same. \c GL_FALSE is
- * returned otherwise.
- */
-GLboolean
-_gl_context_modes_are_same( const __GLcontextModes * a,
- const __GLcontextModes * b )
-{
- return( (a->rgbMode == b->rgbMode) &&
- (a->floatMode == b->floatMode) &&
- (a->colorIndexMode == b->colorIndexMode) &&
- (a->doubleBufferMode == b->doubleBufferMode) &&
- (a->stereoMode == b->stereoMode) &&
- (a->redBits == b->redBits) &&
- (a->greenBits == b->greenBits) &&
- (a->blueBits == b->blueBits) &&
- (a->alphaBits == b->alphaBits) &&
-#if 0 /* For some reason these don't get set on the client-side in libGL. */
- (a->redMask == b->redMask) &&
- (a->greenMask == b->greenMask) &&
- (a->blueMask == b->blueMask) &&
- (a->alphaMask == b->alphaMask) &&
-#endif
- (a->rgbBits == b->rgbBits) &&
- (a->indexBits == b->indexBits) &&
- (a->accumRedBits == b->accumRedBits) &&
- (a->accumGreenBits == b->accumGreenBits) &&
- (a->accumBlueBits == b->accumBlueBits) &&
- (a->accumAlphaBits == b->accumAlphaBits) &&
- (a->depthBits == b->depthBits) &&
- (a->stencilBits == b->stencilBits) &&
- (a->numAuxBuffers == b->numAuxBuffers) &&
- (a->level == b->level) &&
- (a->pixmapMode == b->pixmapMode) &&
- (a->visualRating == b->visualRating) &&
-
- (a->transparentPixel == b->transparentPixel) &&
-
- ((a->transparentPixel != GLX_TRANSPARENT_RGB) ||
- ((a->transparentRed == b->transparentRed) &&
- (a->transparentGreen == b->transparentGreen) &&
- (a->transparentBlue == b->transparentBlue) &&
- (a->transparentAlpha == b->transparentAlpha))) &&
-
- ((a->transparentPixel != GLX_TRANSPARENT_INDEX) ||
- (a->transparentIndex == b->transparentIndex)) &&
-
- (a->sampleBuffers == b->sampleBuffers) &&
- (a->samples == b->samples) &&
- ((a->drawableType & b->drawableType) != 0) &&
- (a->renderType == b->renderType) &&
- (a->maxPbufferWidth == b->maxPbufferWidth) &&
- (a->maxPbufferHeight == b->maxPbufferHeight) &&
- (a->maxPbufferPixels == b->maxPbufferPixels) &&
- (a->optimalPbufferWidth == b->optimalPbufferWidth) &&
- (a->optimalPbufferHeight == b->optimalPbufferHeight) &&
- (a->swapMethod == b->swapMethod) &&
- (a->bindToTextureRgb == b->bindToTextureRgb) &&
- (a->bindToTextureRgba == b->bindToTextureRgba) &&
- (a->bindToMipmapTexture == b->bindToMipmapTexture) &&
- (a->bindToTextureTargets == b->bindToTextureTargets) &&
- (a->yInverted == b->yInverted) );
-}
+/*
+ * (C) Copyright IBM Corporation 2003
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file glcontextmodes.c
+ * Utility routines for working with \c __GLcontextModes structures. At
+ * some point most or all of these functions will be moved to the Mesa
+ * code base.
+ *
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#if defined(IN_MINI_GLX)
+#include <GL/gl.h>
+#else
+#if defined(HAVE_DIX_CONFIG_H)
+#include <dix-config.h>
+#endif
+#include <X11/X.h>
+#include <GL/glx.h>
+#include "GL/glxint.h"
+#endif
+
+/* Memory macros */
+#if defined(IN_MINI_GLX)
+#include <stdlib.h>
+#include <string.h>
+#define _mesa_malloc(b) malloc(b)
+#define _mesa_free(m) free(m)
+#define _mesa_memset memset
+#else
+#ifdef XFree86Server
+#include <os.h>
+#include <string.h>
+#define _mesa_malloc(b) malloc(b)
+#define _mesa_free(m) free(m)
+#define _mesa_memset memset
+#else
+#include <X11/Xlibint.h>
+#define _mesa_memset memset
+#define _mesa_malloc(b) Xmalloc(b)
+#define _mesa_free(m) free(m)
+#endif /* XFree86Server */
+#endif /* !defined(IN_MINI_GLX) */
+
+#include "glcontextmodes.h"
+
+#if !defined(IN_MINI_GLX)
+#define NUM_VISUAL_TYPES 6
+
+/**
+ * Convert an X visual type to a GLX visual type.
+ *
+ * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.)
+ * to be converted.
+ * \return If \c visualType is a valid X visual type, a GLX visual type will
+ * be returned. Otherwise \c GLX_NONE will be returned.
+ */
+GLint
+_gl_convert_from_x_visual_type(int visualType)
+{
+ static const int glx_visual_types[NUM_VISUAL_TYPES] = {
+ GLX_STATIC_GRAY, GLX_GRAY_SCALE,
+ GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
+ GLX_TRUE_COLOR, GLX_DIRECT_COLOR
+ };
+
+ return ((unsigned) visualType < NUM_VISUAL_TYPES)
+ ? glx_visual_types[visualType] : GLX_NONE;
+}
+
+/**
+ * Convert a GLX visual type to an X visual type.
+ *
+ * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR,
+ * \c GLX_STATIC_GRAY, etc.) to be converted.
+ * \return If \c visualType is a valid GLX visual type, an X visual type will
+ * be returned. Otherwise -1 will be returned.
+ */
+GLint
+_gl_convert_to_x_visual_type(int visualType)
+{
+ static const int x_visual_types[NUM_VISUAL_TYPES] = {
+ TrueColor, DirectColor,
+ PseudoColor, StaticColor,
+ GrayScale, StaticGray
+ };
+
+ return ((unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES)
+ ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1;
+}
+
+/**
+ * Copy a GLX visual config structure to a GL context mode structure. All
+ * of the fields in \c config are copied to \c mode. Additional fields in
+ * \c mode that can be derrived from the fields of \c config (i.e.,
+ * \c haveDepthBuffer) are also filled in. The remaining fields in \c mode
+ * that cannot be derived are set to default values.
+ *
+ * \param mode Destination GL context mode.
+ * \param config Source GLX visual config.
+ *
+ * \note
+ * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes
+ * structure will be set to the \c vid of the \c __GLXvisualConfig structure.
+ */
+void
+_gl_copy_visual_to_context_mode(__GLcontextModes * mode,
+ const __GLXvisualConfig * config)
+{
+ __GLcontextModes *const next = mode->next;
+
+ (void) _mesa_memset(mode, 0, sizeof(__GLcontextModes));
+ mode->next = next;
+
+ mode->visualID = config->vid;
+ mode->visualType = _gl_convert_from_x_visual_type(config->class);
+ mode->xRenderable = GL_TRUE;
+ mode->fbconfigID = config->vid;
+ mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
+
+ mode->rgbMode = (config->rgba != 0);
+ mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
+
+ mode->colorIndexMode = !(mode->rgbMode);
+ mode->doubleBufferMode = (config->doubleBuffer != 0);
+ mode->stereoMode = (config->stereo != 0);
+
+ mode->haveAccumBuffer = ((config->accumRedSize +
+ config->accumGreenSize +
+ config->accumBlueSize +
+ config->accumAlphaSize) > 0);
+ mode->haveDepthBuffer = (config->depthSize > 0);
+ mode->haveStencilBuffer = (config->stencilSize > 0);
+
+ mode->redBits = config->redSize;
+ mode->greenBits = config->greenSize;
+ mode->blueBits = config->blueSize;
+ mode->alphaBits = config->alphaSize;
+ mode->redMask = config->redMask;
+ mode->greenMask = config->greenMask;
+ mode->blueMask = config->blueMask;
+ mode->alphaMask = config->alphaMask;
+ mode->rgbBits = mode->rgbMode ? config->bufferSize : 0;
+ mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0;
+
+ mode->accumRedBits = config->accumRedSize;
+ mode->accumGreenBits = config->accumGreenSize;
+ mode->accumBlueBits = config->accumBlueSize;
+ mode->accumAlphaBits = config->accumAlphaSize;
+ mode->depthBits = config->depthSize;
+ mode->stencilBits = config->stencilSize;
+
+ mode->numAuxBuffers = config->auxBuffers;
+ mode->level = config->level;
+
+ mode->visualRating = config->visualRating;
+ mode->transparentPixel = config->transparentPixel;
+ mode->transparentRed = config->transparentRed;
+ mode->transparentGreen = config->transparentGreen;
+ mode->transparentBlue = config->transparentBlue;
+ mode->transparentAlpha = config->transparentAlpha;
+ mode->transparentIndex = config->transparentIndex;
+ mode->samples = config->multiSampleSize;
+ mode->sampleBuffers = config->nMultiSampleBuffers;
+ /* mode->visualSelectGroup = config->visualSelectGroup; ? */
+
+ mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
+
+ mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE;
+ mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ?
+ GL_TRUE : GL_FALSE;
+ mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE;
+ mode->bindToTextureTargets = mode->rgbMode ?
+ GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
+ GLX_TEXTURE_RECTANGLE_BIT_EXT : 0;
+ mode->yInverted = GL_FALSE;
+}
+
+/**
+ * Get data from a GL context mode.
+ *
+ * \param mode GL context mode whose data is to be returned.
+ * \param attribute Attribute of \c mode that is to be returned.
+ * \param value_return Location to store the data member of \c mode.
+ * \return If \c attribute is a valid attribute of \c mode, zero is
+ * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned.
+ */
+int
+_gl_get_context_mode_data(const __GLcontextModes * mode, int attribute,
+ int *value_return)
+{
+ switch (attribute) {
+ case GLX_USE_GL:
+ *value_return = GL_TRUE;
+ return 0;
+ case GLX_BUFFER_SIZE:
+ *value_return = mode->rgbBits;
+ return 0;
+ case GLX_RGBA:
+ *value_return = mode->rgbMode;
+ return 0;
+ case GLX_RED_SIZE:
+ *value_return = mode->redBits;
+ return 0;
+ case GLX_GREEN_SIZE:
+ *value_return = mode->greenBits;
+ return 0;
+ case GLX_BLUE_SIZE:
+ *value_return = mode->blueBits;
+ return 0;
+ case GLX_ALPHA_SIZE:
+ *value_return = mode->alphaBits;
+ return 0;
+ case GLX_DOUBLEBUFFER:
+ *value_return = mode->doubleBufferMode;
+ return 0;
+ case GLX_STEREO:
+ *value_return = mode->stereoMode;
+ return 0;
+ case GLX_AUX_BUFFERS:
+ *value_return = mode->numAuxBuffers;
+ return 0;
+ case GLX_DEPTH_SIZE:
+ *value_return = mode->depthBits;
+ return 0;
+ case GLX_STENCIL_SIZE:
+ *value_return = mode->stencilBits;
+ return 0;
+ case GLX_ACCUM_RED_SIZE:
+ *value_return = mode->accumRedBits;
+ return 0;
+ case GLX_ACCUM_GREEN_SIZE:
+ *value_return = mode->accumGreenBits;
+ return 0;
+ case GLX_ACCUM_BLUE_SIZE:
+ *value_return = mode->accumBlueBits;
+ return 0;
+ case GLX_ACCUM_ALPHA_SIZE:
+ *value_return = mode->accumAlphaBits;
+ return 0;
+ case GLX_LEVEL:
+ *value_return = mode->level;
+ return 0;
+ case GLX_TRANSPARENT_TYPE_EXT:
+ *value_return = mode->transparentPixel;
+ return 0;
+ case GLX_TRANSPARENT_RED_VALUE:
+ *value_return = mode->transparentRed;
+ return 0;
+ case GLX_TRANSPARENT_GREEN_VALUE:
+ *value_return = mode->transparentGreen;
+ return 0;
+ case GLX_TRANSPARENT_BLUE_VALUE:
+ *value_return = mode->transparentBlue;
+ return 0;
+ case GLX_TRANSPARENT_ALPHA_VALUE:
+ *value_return = mode->transparentAlpha;
+ return 0;
+ case GLX_TRANSPARENT_INDEX_VALUE:
+ *value_return = mode->transparentIndex;
+ return 0;
+ case GLX_X_VISUAL_TYPE:
+ *value_return = mode->visualType;
+ return 0;
+ case GLX_CONFIG_CAVEAT:
+ *value_return = mode->visualRating;
+ return 0;
+ case GLX_VISUAL_ID:
+ *value_return = mode->visualID;
+ return 0;
+ case GLX_DRAWABLE_TYPE:
+ *value_return = mode->drawableType;
+ return 0;
+ case GLX_RENDER_TYPE:
+ *value_return = mode->renderType;
+ return 0;
+ case GLX_X_RENDERABLE:
+ *value_return = mode->xRenderable;
+ return 0;
+ case GLX_FBCONFIG_ID:
+ *value_return = mode->fbconfigID;
+ return 0;
+ case GLX_MAX_PBUFFER_WIDTH:
+ *value_return = mode->maxPbufferWidth;
+ return 0;
+ case GLX_MAX_PBUFFER_HEIGHT:
+ *value_return = mode->maxPbufferHeight;
+ return 0;
+ case GLX_MAX_PBUFFER_PIXELS:
+ *value_return = mode->maxPbufferPixels;
+ return 0;
+ case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
+ *value_return = mode->optimalPbufferWidth;
+ return 0;
+ case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
+ *value_return = mode->optimalPbufferHeight;
+ return 0;
+ case GLX_SWAP_METHOD_OML:
+ *value_return = mode->swapMethod;
+ return 0;
+ case GLX_SAMPLE_BUFFERS_SGIS:
+ *value_return = mode->sampleBuffers;
+ return 0;
+ case GLX_SAMPLES_SGIS:
+ *value_return = mode->samples;
+ return 0;
+ case GLX_BIND_TO_TEXTURE_RGB_EXT:
+ *value_return = mode->bindToTextureRgb;
+ return 0;
+ case GLX_BIND_TO_TEXTURE_RGBA_EXT:
+ *value_return = mode->bindToTextureRgba;
+ return 0;
+ case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
+ *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE :
+ GL_FALSE;
+ return 0;
+ case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
+ *value_return = mode->bindToTextureTargets;
+ return 0;
+ case GLX_Y_INVERTED_EXT:
+ *value_return = mode->yInverted;
+ return 0;
+
+ /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX.
+ * It is ONLY for communication between the GLX client and the GLX
+ * server.
+ */
+ case GLX_VISUAL_SELECT_GROUP_SGIX:
+ default:
+ return GLX_BAD_ATTRIBUTE;
+ }
+}
+#endif /* !defined(IN_MINI_GLX) */
+
+/**
+ * Allocate a linked list of \c __GLcontextModes structures. The fields of
+ * each structure will be initialized to "reasonable" default values. In
+ * most cases this is the default value defined by table 3.4 of the GLX
+ * 1.3 specification. This means that most values are either initialized to
+ * zero or \c GLX_DONT_CARE (which is -1). As support for additional
+ * extensions is added, the new values will be initialized to appropriate
+ * values from the extension specification.
+ *
+ * \param count Number of structures to allocate.
+ * \param minimum_size Minimum size of a structure to allocate. This allows
+ * for differences in the version of the
+ * \c __GLcontextModes stucture used in libGL and in a
+ * DRI-based driver.
+ * \returns A pointer to the first element in a linked list of \c count
+ * stuctures on success, or \c NULL on failure.
+ *
+ * \warning Use of \c minimum_size does \b not guarantee binary compatibility.
+ * The fundamental assumption is that if the \c minimum_size
+ * specified by the driver and the size of the \c __GLcontextModes
+ * structure in libGL is the same, then the meaning of each byte in
+ * the structure is the same in both places. \b Be \b careful!
+ * Basically this means that fields have to be added in libGL and
+ * then propagated to drivers. Drivers should \b never arbitrarilly
+ * extend the \c __GLcontextModes data-structure.
+ */
+__GLcontextModes *
+_gl_context_modes_create(unsigned count, size_t minimum_size)
+{
+ const size_t size = (minimum_size > sizeof(__GLcontextModes))
+ ? minimum_size : sizeof(__GLcontextModes);
+ __GLcontextModes *base = NULL;
+ __GLcontextModes **next;
+ unsigned i;
+
+ next = &base;
+ for (i = 0; i < count; i++) {
+ *next = (__GLcontextModes *) _mesa_malloc(size);
+ if (*next == NULL) {
+ _gl_context_modes_destroy(base);
+ base = NULL;
+ break;
+ }
+
+ (void) _mesa_memset(*next, 0, size);
+ (*next)->visualID = GLX_DONT_CARE;
+ (*next)->visualType = GLX_DONT_CARE;
+ (*next)->visualRating = GLX_NONE;
+ (*next)->transparentPixel = GLX_NONE;
+ (*next)->transparentRed = GLX_DONT_CARE;
+ (*next)->transparentGreen = GLX_DONT_CARE;
+ (*next)->transparentBlue = GLX_DONT_CARE;
+ (*next)->transparentAlpha = GLX_DONT_CARE;
+ (*next)->transparentIndex = GLX_DONT_CARE;
+ (*next)->xRenderable = GLX_DONT_CARE;
+ (*next)->fbconfigID = GLX_DONT_CARE;
+ (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
+ (*next)->bindToTextureRgb = GLX_DONT_CARE;
+ (*next)->bindToTextureRgba = GLX_DONT_CARE;
+ (*next)->bindToMipmapTexture = GLX_DONT_CARE;
+ (*next)->bindToTextureTargets = GLX_DONT_CARE;
+ (*next)->yInverted = GLX_DONT_CARE;
+
+ next = &((*next)->next);
+ }
+
+ return base;
+}
+
+/**
+ * Destroy a linked list of \c __GLcontextModes structures created by
+ * \c _gl_context_modes_create.
+ *
+ * \param modes Linked list of structures to be destroyed. All structres
+ * in the list will be freed.
+ */
+void
+_gl_context_modes_destroy(__GLcontextModes * modes)
+{
+ while (modes != NULL) {
+ __GLcontextModes *const next = modes->next;
+
+ _mesa_free(modes);
+ modes = next;
+ }
+}
+
+/**
+ * Find a context mode matching a Visual ID.
+ *
+ * \param modes List list of context-mode structures to be searched.
+ * \param vid Visual ID to be found.
+ * \returns A pointer to a context-mode in \c modes if \c vid was found in
+ * the list, or \c NULL if it was not.
+ */
+
+__GLcontextModes *
+_gl_context_modes_find_visual(__GLcontextModes * modes, int vid)
+{
+ __GLcontextModes *m;
+
+ for (m = modes; m != NULL; m = m->next)
+ if (m->visualID == vid)
+ return m;
+
+ return NULL;
+}
+
+__GLcontextModes *
+_gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid)
+{
+ __GLcontextModes *m;
+
+ for (m = modes; m != NULL; m = m->next)
+ if (m->fbconfigID == fbid)
+ return m;
+
+ return NULL;
+}
+
+/**
+ * Determine if two context-modes are the same. This is intended to be used
+ * by libGL implementations to compare to sets of driver generated FBconfigs.
+ *
+ * \param a Context-mode to be compared.
+ * \param b Context-mode to be compared.
+ * \returns \c GL_TRUE if the two context-modes are the same. \c GL_FALSE is
+ * returned otherwise.
+ */
+GLboolean
+_gl_context_modes_are_same(const __GLcontextModes * a,
+ const __GLcontextModes * b)
+{
+ return ((a->rgbMode == b->rgbMode) &&
+ (a->floatMode == b->floatMode) &&
+ (a->colorIndexMode == b->colorIndexMode) &&
+ (a->doubleBufferMode == b->doubleBufferMode) &&
+ (a->stereoMode == b->stereoMode) &&
+ (a->redBits == b->redBits) &&
+ (a->greenBits == b->greenBits) &&
+ (a->blueBits == b->blueBits) && (a->alphaBits == b->alphaBits) &&
+#if 0 /* For some reason these don't get set on the client-side in libGL. */
+ (a->redMask == b->redMask) &&
+ (a->greenMask == b->greenMask) &&
+ (a->blueMask == b->blueMask) && (a->alphaMask == b->alphaMask) &&
+#endif
+ (a->rgbBits == b->rgbBits) &&
+ (a->indexBits == b->indexBits) &&
+ (a->accumRedBits == b->accumRedBits) &&
+ (a->accumGreenBits == b->accumGreenBits) &&
+ (a->accumBlueBits == b->accumBlueBits) &&
+ (a->accumAlphaBits == b->accumAlphaBits) &&
+ (a->depthBits == b->depthBits) &&
+ (a->stencilBits == b->stencilBits) &&
+ (a->numAuxBuffers == b->numAuxBuffers) &&
+ (a->level == b->level) &&
+ (a->pixmapMode == b->pixmapMode) &&
+ (a->visualRating == b->visualRating) &&
+ (a->transparentPixel == b->transparentPixel) &&
+ ((a->transparentPixel != GLX_TRANSPARENT_RGB) ||
+ ((a->transparentRed == b->transparentRed) &&
+ (a->transparentGreen == b->transparentGreen) &&
+ (a->transparentBlue == b->transparentBlue) &&
+ (a->transparentAlpha == b->transparentAlpha))) &&
+ ((a->transparentPixel != GLX_TRANSPARENT_INDEX) ||
+ (a->transparentIndex == b->transparentIndex)) &&
+ (a->sampleBuffers == b->sampleBuffers) &&
+ (a->samples == b->samples) &&
+ ((a->drawableType & b->drawableType) != 0) &&
+ (a->renderType == b->renderType) &&
+ (a->maxPbufferWidth == b->maxPbufferWidth) &&
+ (a->maxPbufferHeight == b->maxPbufferHeight) &&
+ (a->maxPbufferPixels == b->maxPbufferPixels) &&
+ (a->optimalPbufferWidth == b->optimalPbufferWidth) &&
+ (a->optimalPbufferHeight == b->optimalPbufferHeight) &&
+ (a->swapMethod == b->swapMethod) &&
+ (a->bindToTextureRgb == b->bindToTextureRgb) &&
+ (a->bindToTextureRgba == b->bindToTextureRgba) &&
+ (a->bindToMipmapTexture == b->bindToMipmapTexture) &&
+ (a->bindToTextureTargets == b->bindToTextureTargets) &&
+ (a->yInverted == b->yInverted));
+}
diff --git a/xorg-server/hw/xquartz/GL/glcontextmodes.h b/xorg-server/hw/xquartz/GL/glcontextmodes.h
index afd09cd7f..871c2e1b3 100644
--- a/xorg-server/hw/xquartz/GL/glcontextmodes.h
+++ b/xorg-server/hw/xquartz/GL/glcontextmodes.h
@@ -33,22 +33,22 @@
#include "GL/internal/glcore.h"
#if !defined(IN_MINI_GLX)
-extern GLint _gl_convert_from_x_visual_type( int visualType );
-extern GLint _gl_convert_to_x_visual_type( int visualType );
-extern void _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
- const __GLXvisualConfig * config );
-extern int _gl_get_context_mode_data( const __GLcontextModes *mode,
- int attribute, int *value_return );
-#endif /* !defined(IN_MINI_GLX) */
+extern GLint _gl_convert_from_x_visual_type(int visualType);
+extern GLint _gl_convert_to_x_visual_type(int visualType);
+extern void _gl_copy_visual_to_context_mode(__GLcontextModes * mode,
+ const __GLXvisualConfig * config);
+extern int _gl_get_context_mode_data(const __GLcontextModes * mode,
+ int attribute, int *value_return);
+#endif /* !defined(IN_MINI_GLX) */
-extern __GLcontextModes * _gl_context_modes_create( unsigned count,
- size_t minimum_size );
-extern void _gl_context_modes_destroy( __GLcontextModes * modes );
-extern __GLcontextModes *
- _gl_context_modes_find_visual(__GLcontextModes *modes, int vid);
-extern __GLcontextModes *
- _gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid);
-extern GLboolean _gl_context_modes_are_same( const __GLcontextModes * a,
- const __GLcontextModes * b );
+extern __GLcontextModes *_gl_context_modes_create(unsigned count,
+ size_t minimum_size);
+extern void _gl_context_modes_destroy(__GLcontextModes * modes);
+extern __GLcontextModes *_gl_context_modes_find_visual(__GLcontextModes * modes,
+ int vid);
+extern __GLcontextModes *_gl_context_modes_find_fbconfig(__GLcontextModes *
+ modes, int fbid);
+extern GLboolean _gl_context_modes_are_same(const __GLcontextModes * a,
+ const __GLcontextModes * b);
-#endif /* GLCONTEXTMODES_H */
+#endif /* GLCONTEXTMODES_H */
diff --git a/xorg-server/hw/xquartz/GL/indirect.c b/xorg-server/hw/xquartz/GL/indirect.c
index e6ff37668..1f4f79c4b 100644
--- a/xorg-server/hw/xquartz/GL/indirect.c
+++ b/xorg-server/hw/xquartz/GL/indirect.c
@@ -40,7 +40,7 @@
#include <dlfcn.h>
#include <OpenGL/OpenGL.h>
-#include <OpenGL/gl.h> /* Just to prevent glxserver.h from loading mesa's and colliding with OpenGL.h */
+#include <OpenGL/gl.h> /* Just to prevent glxserver.h from loading mesa's and colliding with OpenGL.h */
#include <X11/Xproto.h>
#include <GL/glxproto.h>
@@ -58,22 +58,28 @@
#include "darwin.h"
#define GLAQUA_DEBUG_MSG(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "GLXAqua", msg, ##args)
-__GLXprovider * GlxGetDRISWrastProvider (void);
+__GLXprovider *GlxGetDRISWrastProvider(void);
static void setup_dispatch_table(void);
GLuint __glFloorLog2(GLuint val);
-void warn_func(void * p1, char *format, ...);
+void warn_func(void *p1, char *format, ...);
// some prototypes
-static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen);
-static __GLXdrawable * __glXAquaScreenCreateDrawable(ClientPtr client, __GLXscreen *screen, DrawablePtr pDraw, XID drawId, int type, XID glxDrawId, __GLXconfig *conf);
-
-static void __glXAquaContextDestroy(__GLXcontext *baseContext);
-static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext);
-static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext);
-static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask);
-
-static CGLPixelFormatObj makeFormat(__GLXconfig *conf);
+static __GLXscreen *__glXAquaScreenProbe(ScreenPtr pScreen);
+static __GLXdrawable *__glXAquaScreenCreateDrawable(ClientPtr client,
+ __GLXscreen * screen,
+ DrawablePtr pDraw,
+ XID drawId, int type,
+ XID glxDrawId,
+ __GLXconfig * conf);
+
+static void __glXAquaContextDestroy(__GLXcontext * baseContext);
+static int __glXAquaContextMakeCurrent(__GLXcontext * baseContext);
+static int __glXAquaContextLoseCurrent(__GLXcontext * baseContext);
+static int __glXAquaContextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc,
+ unsigned long mask);
+
+static CGLPixelFormatObj makeFormat(__GLXconfig * conf);
__GLXprovider __glXDRISWRastProvider = {
__glXAquaScreenProbe,
@@ -81,8 +87,8 @@ __GLXprovider __glXDRISWRastProvider = {
NULL
};
-typedef struct __GLXAquaScreen __GLXAquaScreen;
-typedef struct __GLXAquaContext __GLXAquaContext;
+typedef struct __GLXAquaScreen __GLXAquaScreen;
+typedef struct __GLXAquaContext __GLXAquaContext;
typedef struct __GLXAquaDrawable __GLXAquaDrawable;
/*
@@ -105,7 +111,7 @@ struct __GLXAquaContext {
CGLContextObj ctx;
CGLPixelFormatObj pixelFormat;
xp_surface_id sid;
- unsigned isAttached :1;
+ unsigned isAttached:1;
};
struct __GLXAquaDrawable {
@@ -115,35 +121,34 @@ struct __GLXAquaDrawable {
__GLXAquaContext *context;
};
-
static __GLXcontext *
-__glXAquaScreenCreateContext(__GLXscreen *screen,
- __GLXconfig *conf,
- __GLXcontext *baseShareContext)
+__glXAquaScreenCreateContext(__GLXscreen * screen,
+ __GLXconfig * conf,
+ __GLXcontext * baseShareContext)
{
__GLXAquaContext *context;
__GLXAquaContext *shareContext = (__GLXAquaContext *) baseShareContext;
CGLError gl_err;
-
+
GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n");
-
- context = calloc(1, sizeof (__GLXAquaContext));
-
+
+ context = calloc(1, sizeof(__GLXAquaContext));
+
if (context == NULL)
- return NULL;
+ return NULL;
memset(context, 0, sizeof *context);
-
+
context->base.pGlxScreen = screen;
-
- context->base.destroy = __glXAquaContextDestroy;
- context->base.makeCurrent = __glXAquaContextMakeCurrent;
- context->base.loseCurrent = __glXAquaContextLoseCurrent;
- context->base.copy = __glXAquaContextCopy;
+
+ context->base.destroy = __glXAquaContextDestroy;
+ context->base.makeCurrent = __glXAquaContextMakeCurrent;
+ context->base.loseCurrent = __glXAquaContextLoseCurrent;
+ context->base.copy = __glXAquaContextCopy;
/*FIXME verify that the context->base is fully initialized. */
-
+
context->pixelFormat = makeFormat(conf);
-
+
if (!context->pixelFormat) {
free(context);
return NULL;
@@ -151,56 +156,63 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
context->ctx = NULL;
gl_err = CGLCreateContext(context->pixelFormat,
- shareContext ? shareContext->ctx : NULL,
- &context->ctx);
-
+ shareContext ? shareContext->ctx : NULL,
+ &context->ctx);
+
if (gl_err != 0) {
- ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err));
- CGLDestroyPixelFormat(context->pixelFormat);
- free(context);
- return NULL;
+ ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err));
+ CGLDestroyPixelFormat(context->pixelFormat);
+ free(context);
+ return NULL;
}
-
+
setup_dispatch_table();
GLAQUA_DEBUG_MSG("glAquaCreateContext done\n");
-
+
return &context->base;
}
/* maps from surface id -> list of __GLcontext */
static x_hash_table *surface_hash;
-static void __glXAquaContextDestroy(__GLXcontext *baseContext) {
+static void
+__glXAquaContextDestroy(__GLXcontext * baseContext)
+{
x_list *lst;
__GLXAquaContext *context = (__GLXAquaContext *) baseContext;
-
+
GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx %p)\n", baseContext);
if (context != NULL) {
- if (context->sid != 0 && surface_hash != NULL) {
- lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(context->sid), NULL);
- lst = x_list_remove(lst, context);
- x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid), lst);
- }
-
- if (context->ctx != NULL)
- CGLDestroyContext(context->ctx);
-
- if (context->pixelFormat != NULL)
- CGLDestroyPixelFormat(context->pixelFormat);
-
- free(context);
+ if (context->sid != 0 && surface_hash != NULL) {
+ lst =
+ x_hash_table_lookup(surface_hash,
+ x_cvt_uint_to_vptr(context->sid), NULL);
+ lst = x_list_remove(lst, context);
+ x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid),
+ lst);
+ }
+
+ if (context->ctx != NULL)
+ CGLDestroyContext(context->ctx);
+
+ if (context->pixelFormat != NULL)
+ CGLDestroyPixelFormat(context->pixelFormat);
+
+ free(context);
}
}
-static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext) {
+static int
+__glXAquaContextLoseCurrent(__GLXcontext * baseContext)
+{
CGLError gl_err;
GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%p)\n", baseContext);
gl_err = CGLSetCurrentContext(NULL);
if (gl_err != 0)
- ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
+ ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
/*
* There should be no need to set __glXLastContext to NULL here, because
@@ -213,115 +225,126 @@ static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext) {
/* Called when a surface is destroyed as a side effect of destroying
the window it's attached to. */
-static void surface_notify(void *_arg, void *data) {
- DRISurfaceNotifyArg *arg = (DRISurfaceNotifyArg *)_arg;
- __GLXAquaDrawable *draw = (__GLXAquaDrawable *)data;
+static void
+surface_notify(void *_arg, void *data)
+{
+ DRISurfaceNotifyArg *arg = (DRISurfaceNotifyArg *) _arg;
+ __GLXAquaDrawable *draw = (__GLXAquaDrawable *) data;
__GLXAquaContext *context;
x_list *lst;
- if(_arg == NULL || data == NULL) {
- ErrorF("surface_notify called with bad params");
- return;
+
+ if (_arg == NULL || data == NULL) {
+ ErrorF("surface_notify called with bad params");
+ return;
}
-
+
GLAQUA_DEBUG_MSG("surface_notify(%p, %p)\n", _arg, data);
switch (arg->kind) {
case AppleDRISurfaceNotifyDestroyed:
if (surface_hash != NULL)
x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(arg->id));
- draw->pDraw = NULL;
- draw->sid = 0;
+ draw->pDraw = NULL;
+ draw->sid = 0;
break;
case AppleDRISurfaceNotifyChanged:
if (surface_hash != NULL) {
- lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(arg->id), NULL);
- for (; lst != NULL; lst = lst->next)
- {
+ lst =
+ x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(arg->id),
+ NULL);
+ for (; lst != NULL; lst = lst->next) {
context = lst->data;
xp_update_gl_context(context->ctx);
}
}
break;
default:
- ErrorF("surface_notify: unknown kind %d\n", arg->kind);
- break;
+ ErrorF("surface_notify: unknown kind %d\n", arg->kind);
+ break;
}
}
-static BOOL attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) {
+static BOOL
+attach(__GLXAquaContext * context, __GLXAquaDrawable * draw)
+{
DrawablePtr pDraw;
-
+
GLAQUA_DEBUG_MSG("attach(%p, %p)\n", context, draw);
-
- if(NULL == context || NULL == draw)
- return TRUE;
+
+ if (NULL == context || NULL == draw)
+ return TRUE;
pDraw = draw->base.pDraw;
- if(NULL == pDraw) {
- ErrorF("%s:%s() pDraw is NULL!\n", __FILE__, __func__);
- return TRUE;
+ if (NULL == pDraw) {
+ ErrorF("%s:%s() pDraw is NULL!\n", __FILE__, __func__);
+ return TRUE;
}
if (draw->sid == 0) {
- //if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw,
+ //if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw,
if (!DRICreateSurface(pDraw->pScreen, pDraw->id, pDraw,
- 0, &draw->sid, NULL,
- surface_notify, draw))
+ 0, &draw->sid, NULL, surface_notify, draw))
return TRUE;
draw->pDraw = pDraw;
- }
-
+ }
+
if (!context->isAttached || context->sid != draw->sid) {
x_list *lst;
-
+
if (xp_attach_gl_context(context->ctx, draw->sid) != Success) {
- //quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw,
+ //quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw,
DRIDestroySurface(pDraw->pScreen, pDraw->id, pDraw,
- surface_notify, draw);
+ surface_notify, draw);
if (surface_hash != NULL)
- x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(draw->sid));
-
+ x_hash_table_remove(surface_hash,
+ x_cvt_uint_to_vptr(draw->sid));
+
draw->sid = 0;
return TRUE;
}
-
+
context->isAttached = TRUE;
context->sid = draw->sid;
-
+
if (surface_hash == NULL)
surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL);
-
- lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(context->sid), NULL);
+
+ lst =
+ x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(context->sid),
+ NULL);
if (x_list_find(lst, context) == NULL) {
lst = x_list_prepend(lst, context);
- x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid), lst);
+ x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid),
+ lst);
}
-
-
GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id,
(unsigned int) draw->sid);
- }
+ }
draw->context = context;
return FALSE;
}
-#if 0 // unused
-static void unattach(__GLXAquaContext *context) {
- x_list *lst;
- GLAQUA_DEBUG_MSG("unattach\n");
- if (context == NULL) {
- ErrorF("Tried to unattach a null context\n");
- return;
- }
+#if 0 // unused
+static void
+unattach(__GLXAquaContext * context)
+{
+ x_list *lst;
+
+ GLAQUA_DEBUG_MSG("unattach\n");
+ if (context == NULL) {
+ ErrorF("Tried to unattach a null context\n");
+ return;
+ }
if (context->isAttached) {
GLAQUA_DEBUG_MSG("unattaching\n");
if (surface_hash != NULL) {
- lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL);
+ lst =
+ x_hash_table_lookup(surface_hash, (void *) context->sid, NULL);
lst = x_list_remove(lst, context);
x_hash_table_insert(surface_hash, (void *) context->sid, lst);
}
@@ -333,24 +356,28 @@ static void unattach(__GLXAquaContext *context) {
}
#endif
-static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext) {
+static int
+__glXAquaContextMakeCurrent(__GLXcontext * baseContext)
+{
CGLError gl_err;
__GLXAquaContext *context = (__GLXAquaContext *) baseContext;
__GLXAquaDrawable *drawPriv = (__GLXAquaDrawable *) context->base.drawPriv;
-
+
GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%p)\n", baseContext);
-
- if(attach(context, drawPriv))
- return /*error*/ 0;
+
+ if (attach(context, drawPriv))
+ return /*error */ 0;
gl_err = CGLSetCurrentContext(context->ctx);
if (gl_err != 0)
ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
-
+
return gl_err == 0;
}
-static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask)
+static int
+__glXAquaContextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc,
+ unsigned long mask)
{
CGLError gl_err;
@@ -367,95 +394,100 @@ static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, un
}
/* Drawing surface notification callbacks */
-static GLboolean __glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable *base) {
+static GLboolean
+__glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base)
+{
CGLError err;
__GLXAquaDrawable *drawable;
-
+
// GLAQUA_DEBUG_MSG("glAquaDrawableSwapBuffers(%p)\n",base);
-
- if(!base) {
- ErrorF("%s passed NULL\n", __func__);
- return GL_FALSE;
+
+ if (!base) {
+ ErrorF("%s passed NULL\n", __func__);
+ return GL_FALSE;
}
- drawable = (__GLXAquaDrawable *)base;
+ drawable = (__GLXAquaDrawable *) base;
- if(NULL == drawable->context) {
- ErrorF("%s called with a NULL->context for drawable %p!\n",
- __func__, (void *)drawable);
- return GL_FALSE;
+ if (NULL == drawable->context) {
+ ErrorF("%s called with a NULL->context for drawable %p!\n",
+ __func__, (void *) drawable);
+ return GL_FALSE;
}
err = CGLFlushDrawable(drawable->context->ctx);
- if(kCGLNoError != err) {
- ErrorF("CGLFlushDrawable error: %s in %s\n", CGLErrorString(err),
- __func__);
- return GL_FALSE;
+ if (kCGLNoError != err) {
+ ErrorF("CGLFlushDrawable error: %s in %s\n", CGLErrorString(err),
+ __func__);
+ return GL_FALSE;
}
return GL_TRUE;
}
-
-static CGLPixelFormatObj makeFormat(__GLXconfig *conf) {
+static CGLPixelFormatObj
+makeFormat(__GLXconfig * conf)
+{
CGLPixelFormatAttribute attr[64];
CGLPixelFormatObj fobj;
GLint formats;
CGLError error;
int i = 0;
-
- if(conf->doubleBufferMode)
- attr[i++] = kCGLPFADoubleBuffer;
- if(conf->stereoMode)
- attr[i++] = kCGLPFAStereo;
+ if (conf->doubleBufferMode)
+ attr[i++] = kCGLPFADoubleBuffer;
+
+ if (conf->stereoMode)
+ attr[i++] = kCGLPFAStereo;
attr[i++] = kCGLPFAColorSize;
attr[i++] = conf->redBits + conf->greenBits + conf->blueBits;
attr[i++] = kCGLPFAAlphaSize;
attr[i++] = conf->alphaBits;
- if((conf->accumRedBits + conf->accumGreenBits + conf->accumBlueBits +
- conf->accumAlphaBits) > 0) {
+ if ((conf->accumRedBits + conf->accumGreenBits + conf->accumBlueBits +
+ conf->accumAlphaBits) > 0) {
- attr[i++] = kCGLPFAAccumSize;
+ attr[i++] = kCGLPFAAccumSize;
attr[i++] = conf->accumRedBits + conf->accumGreenBits
- + conf->accumBlueBits + conf->accumAlphaBits;
+ + conf->accumBlueBits + conf->accumAlphaBits;
}
-
+
attr[i++] = kCGLPFADepthSize;
attr[i++] = conf->depthBits;
- if(conf->stencilBits) {
- attr[i++] = kCGLPFAStencilSize;
- attr[i++] = conf->stencilBits;
+ if (conf->stencilBits) {
+ attr[i++] = kCGLPFAStencilSize;
+ attr[i++] = conf->stencilBits;
}
-
- if(conf->numAuxBuffers > 0) {
- attr[i++] = kCGLPFAAuxBuffers;
- attr[i++] = conf->numAuxBuffers;
+
+ if (conf->numAuxBuffers > 0) {
+ attr[i++] = kCGLPFAAuxBuffers;
+ attr[i++] = conf->numAuxBuffers;
}
- if(conf->sampleBuffers > 0) {
- attr[i++] = kCGLPFASampleBuffers;
- attr[i++] = conf->sampleBuffers;
- attr[i++] = kCGLPFASamples;
- attr[i++] = conf->samples;
+ if (conf->sampleBuffers > 0) {
+ attr[i++] = kCGLPFASampleBuffers;
+ attr[i++] = conf->sampleBuffers;
+ attr[i++] = kCGLPFASamples;
+ attr[i++] = conf->samples;
}
-
+
attr[i] = 0;
error = CGLChoosePixelFormat(attr, &fobj, &formats);
- if(error) {
- ErrorF("error: creating pixel format %s\n", CGLErrorString(error));
- return NULL;
+ if (error) {
+ ErrorF("error: creating pixel format %s\n", CGLErrorString(error));
+ return NULL;
}
return fobj;
}
-static void __glXAquaScreenDestroy(__GLXscreen *screen) {
+static void
+__glXAquaScreenDestroy(__GLXscreen * screen)
+{
GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen);
__glXScreenDestroy(screen);
@@ -464,26 +496,30 @@ static void __glXAquaScreenDestroy(__GLXscreen *screen) {
}
/* This is called by __glXInitScreens(). */
-static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
+static __GLXscreen *
+__glXAquaScreenProbe(ScreenPtr pScreen)
+{
__GLXAquaScreen *screen;
GLAQUA_DEBUG_MSG("glXAquaScreenProbe\n");
- if (pScreen == NULL)
- return NULL;
+ if (pScreen == NULL)
+ return NULL;
screen = calloc(1, sizeof *screen);
- if(NULL == screen)
- return NULL;
-
- screen->base.destroy = __glXAquaScreenDestroy;
- screen->base.createContext = __glXAquaScreenCreateContext;
+ if (NULL == screen)
+ return NULL;
+
+ screen->base.destroy = __glXAquaScreenDestroy;
+ screen->base.createContext = __glXAquaScreenCreateContext;
screen->base.createDrawable = __glXAquaScreenCreateDrawable;
screen->base.swapInterval = /*FIXME*/ NULL;
- screen->base.pScreen = pScreen;
-
- screen->base.fbconfigs = __glXAquaCreateVisualConfigs(&screen->base.numFBConfigs, pScreen->myNum);
+ screen->base.pScreen = pScreen;
+
+ screen->base.fbconfigs =
+ __glXAquaCreateVisualConfigs(&screen->base.numFBConfigs,
+ pScreen->myNum);
__glXScreenInit(&screen->base, pScreen);
@@ -494,29 +530,33 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
"GLX_ARB_multisample "
"GLX_EXT_visual_info "
"GLX_EXT_import_context ");
-
+
/*We may be able to add more GLXextensions at a later time. */
-
+
return &screen->base;
}
-#if 0 // unused
-static void __glXAquaDrawableCopySubBuffer (__GLXdrawable *drawable,
- int x, int y, int w, int h) {
- /*TODO finish me*/
+#if 0 // unused
+static void
+__glXAquaDrawableCopySubBuffer(__GLXdrawable * drawable,
+ int x, int y, int w, int h)
+{
+ /*TODO finish me */
}
#endif
-static void __glXAquaDrawableDestroy(__GLXdrawable *base) {
+static void
+__glXAquaDrawableDestroy(__GLXdrawable * base)
+{
/* gstaplin: base is the head of the structure, so it's at the same
* offset in memory.
* Is this safe with strict aliasing? I noticed that the other dri code
* does this too...
*/
- __GLXAquaDrawable *glxPriv = (__GLXAquaDrawable *)base;
+ __GLXAquaDrawable *glxPriv = (__GLXAquaDrawable *) base;
GLAQUA_DEBUG_MSG("TRACE");
-
+
/* It doesn't work to call DRIDestroySurface here, the drawable's
already gone.. But dri.c notices the window destruction and
frees the surface itself. */
@@ -533,40 +573,41 @@ static void __glXAquaDrawableDestroy(__GLXdrawable *base) {
static __GLXdrawable *
__glXAquaScreenCreateDrawable(ClientPtr client,
- __GLXscreen *screen,
- DrawablePtr pDraw,
- XID drawId,
- int type,
- XID glxDrawId,
- __GLXconfig *conf) {
- __GLXAquaDrawable *glxPriv;
+ __GLXscreen * screen,
+ DrawablePtr pDraw,
+ XID drawId,
+ int type, XID glxDrawId, __GLXconfig * conf)
+{
+ __GLXAquaDrawable *glxPriv;
- glxPriv = malloc(sizeof *glxPriv);
+ glxPriv = malloc(sizeof *glxPriv);
- if(glxPriv == NULL)
- return NULL;
+ if (glxPriv == NULL)
+ return NULL;
- memset(glxPriv, 0, sizeof *glxPriv);
+ memset(glxPriv, 0, sizeof *glxPriv);
- if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
- free(glxPriv);
- return NULL;
- }
-
- glxPriv->base.destroy = __glXAquaDrawableDestroy;
- glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers;
- glxPriv->base.copySubBuffer = NULL; /* __glXAquaDrawableCopySubBuffer; */
-
- glxPriv->pDraw = pDraw;
- glxPriv->sid = 0;
- glxPriv->context = NULL;
-
- return &glxPriv->base;
+ if (!__glXDrawableInit
+ (&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
+ free(glxPriv);
+ return NULL;
+ }
+
+ glxPriv->base.destroy = __glXAquaDrawableDestroy;
+ glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers;
+ glxPriv->base.copySubBuffer = NULL; /* __glXAquaDrawableCopySubBuffer; */
+
+ glxPriv->pDraw = pDraw;
+ glxPriv->sid = 0;
+ glxPriv->context = NULL;
+
+ return &glxPriv->base;
}
// Extra goodies for glx
-GLuint __glFloorLog2(GLuint val)
+GLuint
+__glFloorLog2(GLuint val)
{
int c = 0;
@@ -581,12 +622,14 @@ GLuint __glFloorLog2(GLuint val)
#define OPENGL_FRAMEWORK_PATH "/System/Library/Frameworks/OpenGL.framework/OpenGL"
#endif
-static void setup_dispatch_table(void) {
+static void
+setup_dispatch_table(void)
+{
static struct _glapi_table *disp = NULL;
static void *handle;
const char *opengl_framework_path;
- if(disp) {
+ if (disp) {
_glapi_set_dispatch(disp);
return;
}
@@ -596,12 +639,12 @@ static void setup_dispatch_table(void) {
opengl_framework_path = OPENGL_FRAMEWORK_PATH;
}
- (void) dlerror(); /*drain dlerror */
+ (void) dlerror(); /*drain dlerror */
handle = dlopen(opengl_framework_path, RTLD_LOCAL);
if (!handle) {
ErrorF("unable to dlopen %s : %s, using RTLD_DEFAULT\n",
- opengl_framework_path, dlerror());
+ opengl_framework_path, dlerror());
handle = RTLD_DEFAULT;
}
diff --git a/xorg-server/hw/xquartz/GL/visualConfigs.c b/xorg-server/hw/xquartz/GL/visualConfigs.c
index 2c2a9a29e..c02427c99 100644
--- a/xorg-server/hw/xquartz/GL/visualConfigs.c
+++ b/xorg-server/hw/xquartz/GL/visualConfigs.c
@@ -58,83 +58,98 @@
#include "darwinfb.h"
/* Based originally on code from indirect.c which was based on code from i830_dri.c. */
-__GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) {
+__GLXconfig *
+__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
+{
int numConfigs = 0;
__GLXconfig *visualConfigs, *c;
struct glCapabilities caps;
struct glCapabilitiesConfig *conf;
int stereo, depth, aux, buffers, stencil, accum, color, msample;
-
- if(getGlCapabilities(&caps)) {
+
+ if (getGlCapabilities(&caps)) {
ErrorF("error from getGlCapabilities()!\n");
return NULL;
}
-
+
/*
- conf->stereo is 0 or 1, but we need at least 1 iteration of the loop,
- so we treat a true conf->stereo as 2.
-
- The depth size is 0 or 24. Thus we do 2 iterations for that.
-
- conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1.
-
- conf->buffers indicates whether we have single or double buffering.
-
- conf->total_stencil_bit_depths
-
- conf->total_color_buffers indicates the RGB/RGBA color depths.
-
- conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0)
-
- conf->total_depth_buffer_depths
-
- conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1
- for the 0 multisampling config.
-
+ conf->stereo is 0 or 1, but we need at least 1 iteration of the loop,
+ so we treat a true conf->stereo as 2.
+
+ The depth size is 0 or 24. Thus we do 2 iterations for that.
+
+ conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1.
+
+ conf->buffers indicates whether we have single or double buffering.
+
+ conf->total_stencil_bit_depths
+
+ conf->total_color_buffers indicates the RGB/RGBA color depths.
+
+ conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0)
+
+ conf->total_depth_buffer_depths
+
+ conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1
+ for the 0 multisampling config.
+
*/
-
+
assert(NULL != caps.configurations);
-
+
numConfigs = 0;
-
- for(conf = caps.configurations; conf; conf = conf->next) {
- if(conf->total_color_buffers <= 0)
+
+ for (conf = caps.configurations; conf; conf = conf->next) {
+ if (conf->total_color_buffers <= 0)
continue;
-
- numConfigs += (conf->stereo ? 2 : 1)
- * (conf->aux_buffers ? 2 : 1)
- * conf->buffers
- * ((conf->total_stencil_bit_depths > 0) ? conf->total_stencil_bit_depths : 1)
- * conf->total_color_buffers
- * ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1)
- * conf->total_depth_buffer_depths
- * (conf->multisample_buffers + 1);
+
+ numConfigs += (conf->stereo ? 2 : 1)
+ * (conf->aux_buffers ? 2 : 1)
+ * conf->buffers
+ *
+ ((conf->total_stencil_bit_depths >
+ 0) ? conf->total_stencil_bit_depths : 1)
+ * conf->total_color_buffers *
+ ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1)
+ * conf->total_depth_buffer_depths * (conf->multisample_buffers + 1);
}
-
- if(numConfigsPtr)
- *numConfigsPtr = numConfigs;
-
+
+ if (numConfigsPtr)
+ *numConfigsPtr = numConfigs;
+
visualConfigs = calloc(sizeof(*visualConfigs), numConfigs);
-
- if(NULL == visualConfigs) {
+
+ if (NULL == visualConfigs) {
ErrorF("xcalloc failure when allocating visualConfigs\n");
freeGlCapabilities(&caps);
return NULL;
}
-
- c = visualConfigs; /* current buffer */
- for(conf = caps.configurations; conf; conf = conf->next) {
- for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
- for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
- for(buffers = 0; buffers < conf->buffers; ++buffers) {
- for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ?
- conf->total_stencil_bit_depths : 1); ++stencil) {
- for(color = 0; color < conf->total_color_buffers; ++color) {
- for(accum = 0; accum < ((conf->total_accum_buffers > 0) ?
- conf->total_accum_buffers : 1); ++accum) {
- for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) {
- for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) {
-
+
+ c = visualConfigs; /* current buffer */
+ for (conf = caps.configurations; conf; conf = conf->next) {
+ for (stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
+ for (aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
+ for (buffers = 0; buffers < conf->buffers; ++buffers) {
+ for (stencil = 0;
+ stencil <
+ ((conf->total_stencil_bit_depths >
+ 0) ? conf->total_stencil_bit_depths : 1);
+ ++stencil) {
+ for (color = 0; color < conf->total_color_buffers;
+ ++color) {
+ for (accum = 0;
+ accum <
+ ((conf->total_accum_buffers >
+ 0) ? conf->total_accum_buffers : 1);
+ ++accum) {
+ for (depth = 0;
+ depth < conf->total_depth_buffer_depths;
+ ++depth) {
+ for (msample = 0;
+ msample <
+ (conf->multisample_buffers + 1);
+ ++msample) {
+
// Global
c->visualID = -1;
c->visualType = GLX_TRUE_COLOR;
@@ -144,99 +159,137 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
c->level = 0;
c->indexBits = 0;
- c->pixmapMode = 0; // TODO: What should this be?
-
- if(conf->accelerated) {
+ c->pixmapMode = 0; // TODO: What should this be?
+
+ if (conf->accelerated) {
c->visualRating = GLX_NONE;
- } else {
- c->visualRating = GLX_SLOW_VISUAL_EXT;
}
-
+ else {
+ c->visualRating =
+ GLX_SLOW_VISUAL_EXT;
+ }
+
c->transparentPixel = GLX_NONE;
c->transparentRed = GLX_NONE;
c->transparentGreen = GLX_NONE;
c->transparentBlue = GLX_NONE;
c->transparentAlpha = GLX_NONE;
c->transparentIndex = GLX_NONE;
-
+
c->visualSelectGroup = 0;
-
+
c->swapMethod = GLX_SWAP_UNDEFINED_OML;
-
+
// Stereo
c->stereoMode = stereo ? TRUE : FALSE;
// Aux buffers
- c->numAuxBuffers = aux ? conf->aux_buffers : 0;
-
+ c->numAuxBuffers =
+ aux ? conf->aux_buffers : 0;
+
// Double Buffered
- c->doubleBufferMode = buffers ? TRUE : FALSE;
+ c->doubleBufferMode =
+ buffers ? TRUE : FALSE;
// Stencil Buffer
- if(conf->total_stencil_bit_depths > 0) {
- c->stencilBits = conf->stencil_bit_depths[stencil];
- } else {
+ if (conf->total_stencil_bit_depths > 0) {
+ c->stencilBits =
+ conf->
+ stencil_bit_depths[stencil];
+ }
+ else {
c->stencilBits = 0;
}
-
+
// Color
- if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) {
- c->alphaBits = conf->color_buffers[color].a;
- } else {
+ if (GLCAPS_COLOR_BUF_INVALID_VALUE !=
+ conf->color_buffers[color].a) {
+ c->alphaBits =
+ conf->color_buffers[color].a;
+ }
+ else {
c->alphaBits = 0;
}
- c->redBits = conf->color_buffers[color].r;
- c->greenBits = conf->color_buffers[color].g;
- c->blueBits = conf->color_buffers[color].b;
-
- c->rgbBits = c->alphaBits + c->redBits + c->greenBits + c->blueBits;
-
- c->alphaMask = AM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
- c->redMask = RM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
- c->greenMask = GM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
- c->blueMask = BM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
-
+ c->redBits =
+ conf->color_buffers[color].r;
+ c->greenBits =
+ conf->color_buffers[color].g;
+ c->blueBits =
+ conf->color_buffers[color].b;
+
+ c->rgbBits =
+ c->alphaBits + c->redBits +
+ c->greenBits + c->blueBits;
+
+ c->alphaMask =
+ AM_ARGB(c->alphaBits, c->redBits,
+ c->greenBits, c->blueBits);
+ c->redMask =
+ RM_ARGB(c->alphaBits, c->redBits,
+ c->greenBits, c->blueBits);
+ c->greenMask =
+ GM_ARGB(c->alphaBits, c->redBits,
+ c->greenBits, c->blueBits);
+ c->blueMask =
+ BM_ARGB(c->alphaBits, c->redBits,
+ c->greenBits, c->blueBits);
+
// Accumulation Buffers
- if(conf->total_accum_buffers > 0) {
- c->accumRedBits = conf->accum_buffers[accum].r;
- c->accumGreenBits = conf->accum_buffers[accum].g;
- c->accumBlueBits = conf->accum_buffers[accum].b;
- if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
- c->accumAlphaBits = conf->accum_buffers[accum].a;
- } else {
+ if (conf->total_accum_buffers > 0) {
+ c->accumRedBits =
+ conf->accum_buffers[accum].r;
+ c->accumGreenBits =
+ conf->accum_buffers[accum].g;
+ c->accumBlueBits =
+ conf->accum_buffers[accum].b;
+ if (GLCAPS_COLOR_BUF_INVALID_VALUE
+ !=
+ conf->accum_buffers[accum].a) {
+ c->accumAlphaBits =
+ conf->accum_buffers[accum].
+ a;
+ }
+ else {
c->accumAlphaBits = 0;
}
- } else {
+ }
+ else {
c->accumRedBits = 0;
c->accumGreenBits = 0;
c->accumBlueBits = 0;
c->accumAlphaBits = 0;
- }
+ }
// Depth
- c->depthBits = conf->depth_buffers[depth];
-
+ c->depthBits =
+ conf->depth_buffers[depth];
+
// MultiSample
- if(msample > 0) {
- c->samples = conf->multisample_samples;
- c->sampleBuffers = conf->multisample_buffers;
- } else {
+ if (msample > 0) {
+ c->samples =
+ conf->multisample_samples;
+ c->sampleBuffers =
+ conf->multisample_buffers;
+ }
+ else {
c->samples = 0;
c->sampleBuffers = 0;
}
-
+
/*
* The Apple libGL supports GLXPixmaps and
* GLXPbuffers in direct mode.
*/
/* SGIX_fbconfig / GLX 1.3 */
- c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
+ c->drawableType =
+ GLX_WINDOW_BIT | GLX_PIXMAP_BIT |
+ GLX_PBUFFER_BIT;
c->renderType = GLX_RGBA_BIT;
c->xRenderable = GL_TRUE;
c->fbconfigID = -1;
-
+
/* SGIX_pbuffer / GLX 1.3 */
-
+
/*
* The CGL layer provides a way of retrieving
* the maximum pbuffer width/height, but only
@@ -247,21 +300,22 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
*/
c->maxPbufferWidth = 8192;
c->maxPbufferHeight = 8192;
- c->maxPbufferPixels = /*Do we need this?*/ 0;
+ c->maxPbufferPixels =
+ /*Do we need this? */ 0;
/*
* There is no introspection for this sort of thing
* with CGL. What should we do realistically?
*/
c->optimalPbufferWidth = 0;
c->optimalPbufferHeight = 0;
-
+
/* EXT_texture_from_pixmap */
c->bindToTextureRgb = 0;
c->bindToTextureRgba = 0;
c->bindToMipmapTexture = 0;
c->bindToTextureTargets = 0;
c->yInverted = 0;
-
+
c = c->next;
}
}
@@ -273,12 +327,14 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
}
}
- (c-1)->next = NULL;
+ (c - 1)->next = NULL;
if (c - visualConfigs != numConfigs) {
- FatalError("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, (int)(c - visualConfigs));
+ FatalError
+ ("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n",
+ numConfigs, (int) (c - visualConfigs));
}
-
+
freeGlCapabilities(&caps);
return visualConfigs;
}
diff --git a/xorg-server/hw/xquartz/X11Application.h b/xorg-server/hw/xquartz/X11Application.h
index baee29d4c..bdbe6ac1f 100644
--- a/xorg-server/hw/xquartz/X11Application.h
+++ b/xorg-server/hw/xquartz/X11Application.h
@@ -34,49 +34,79 @@
#import "X11Controller.h"
-@interface X11Application : NSApplication {
+ @ interface X11Application:NSApplication {
X11Controller *_controller;
- unsigned int _x_active :1;
+ unsigned int _x_active:1;
}
-- (void) set_controller:controller;
-- (void) set_window_menu:(NSArray *)list;
+ -(void) set_controller:controller;
+ -(void) set_window_menu:(NSArray *) list;
-- (CFPropertyListRef) prefs_get_copy:(NSString *)key CF_RETURNS_RETAINED;
-- (int) prefs_get_integer:(NSString *)key default:(int)def;
-- (const char *) prefs_get_string:(NSString *)key default:(const char *)def;
-- (float) prefs_get_float:(NSString *)key default:(float)def;
-- (int) prefs_get_boolean:(NSString *)key default:(int)def;
-- (NSURL *) prefs_copy_url:(NSString *)key default:(NSURL *)def NS_RETURNS_RETAINED;
-- (NSArray *) prefs_get_array:(NSString *)key;
-- (void) prefs_set_integer:(NSString *)key value:(int)value;
-- (void) prefs_set_float:(NSString *)key value:(float)value;
-- (void) prefs_set_boolean:(NSString *)key value:(int)value;
-- (void) prefs_set_array:(NSString *)key value:(NSArray *)value;
-- (void) prefs_set_string:(NSString *)key value:(NSString *)value;
-- (void) prefs_synchronize;
+ -(CFPropertyListRef) prefs_get_copy:(NSString *)
+key CF_RETURNS_RETAINED;
-- (X11Controller *) controller;
-- (OSX_BOOL) x_active;
-@end
+ -(int) prefs_get_integer:(NSString *)
+key default:(int) def;
-extern X11Application *X11App;
+ -(const char *) prefs_get_string:(NSString *)
+key default:(const char *) def;
-#endif /* __OBJC__ */
+ -(float) prefs_get_float:(NSString *)
+key default:(float) def;
-void X11ApplicationSetWindowMenu (int nitems, const char **items,
- const char *shortcuts);
-void X11ApplicationSetWindowMenuCheck (int idx);
-void X11ApplicationSetFrontProcess (void);
-void X11ApplicationSetCanQuit (int state);
-void X11ApplicationServerReady (void);
-void X11ApplicationShowHideMenubar (int state);
-void X11ApplicationLaunchClient (const char *cmd);
+ -(int) prefs_get_boolean:(NSString *)
+key default:(int) def;
-Bool X11ApplicationCanEnterRandR (void);
+ -(NSURL *) prefs_copy_url:(NSString *)
+key default:(NSURL *)
+def NS_RETURNS_RETAINED;
-void X11ApplicationMain(int argc, char **argv, char **envp);
+ -(NSArray *) prefs_get_array:(NSString *) key;
+ -(void) prefs_set_integer:(NSString *)
+key value:(int) value;
+
+ -(void) prefs_set_float:(NSString *)
+key value:(float) value;
+
+ -(void) prefs_set_boolean:(NSString *)
+key value:(int) value;
+
+ -(void) prefs_set_array:(NSString *)
+key value:(NSArray *) value;
+
+ -(void) prefs_set_string:(NSString *)
+key value:(NSString *) value;
+
+-(void) prefs_synchronize;
+
+-(X11Controller *) controller;
+-(OSX_BOOL) x_active;
+@end extern X11Application *X11App;
+
+#endif /* __OBJC__ */
+
+void
+X11ApplicationSetWindowMenu(int nitems, const char **items,
+ const char *shortcuts);
+void
+X11ApplicationSetWindowMenuCheck(int idx);
+void
+X11ApplicationSetFrontProcess(void);
+void
+X11ApplicationSetCanQuit(int state);
+void
+X11ApplicationServerReady(void);
+void
+X11ApplicationShowHideMenubar(int state);
+void
+X11ApplicationLaunchClient(const char *cmd);
+
+Bool
+X11ApplicationCanEnterRandR(void);
+
+void
+X11ApplicationMain(int argc, char **argv, char **envp);
#define PREFS_APPSMENU "apps_menu"
#define PREFS_FAKEBUTTONS "enable_fake_buttons"
@@ -113,4 +143,4 @@ extern Bool XQuartzScrollInDeviceDirection;
#define PREFS_SYNC_CLIPBOARD_TO_PB "sync_clipboard_to_pasteboard"
#define PREFS_SYNC_PRIMARY_ON_SELECT "sync_primary_on_select"
-#endif /* X11APPLICATION_H */
+#endif /* X11APPLICATION_H */
diff --git a/xorg-server/hw/xquartz/X11Application.m b/xorg-server/hw/xquartz/X11Application.m
index 048e7875b..e091fbb3d 100644
--- a/xorg-server/hw/xquartz/X11Application.m
+++ b/xorg-server/hw/xquartz/X11Application.m
@@ -54,7 +54,7 @@
#include <Xplugin.h>
// pbproxy/pbproxy.h
-extern int xpbproxy_run (void);
+extern int xpbproxy_run(void);
#define DEFAULTS_FILE X11LIBDIR"/X11/xserver/Xquartz.plist"
@@ -95,115 +95,129 @@ CFStringRef app_prefs_domain_cfstr = NULL;
#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
-@interface X11Application (Private)
-- (void) sendX11NSEvent:(NSEvent *)e;
-@end
-
-@implementation X11Application
-
-typedef struct message_struct message;
+@interface X11Application(Private)
+ - (void) sendX11NSEvent:(NSEvent *) e;
+@end @ implementation X11Application typedef struct message_struct
+ message;
struct message_struct {
- mach_msg_header_t hdr;
- SEL selector;
- NSObject *arg;
+ mach_msg_header_t
+ hdr;
+ SEL
+ selector;
+ NSObject *
+ arg;
};
-static mach_port_t _port;
+static mach_port_t
+ _port;
/* Quartz mode initialization routine. This is often dynamically loaded
but is statically linked into this X server. */
-Bool QuartzModeBundleInit(void);
+Bool
+QuartzModeBundleInit(void);
-static void init_ports (void) {
+static void
+init_ports(void)
+{
kern_return_t r;
NSPort *p;
-
- if (_port != MACH_PORT_NULL) return;
-
- r = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &_port);
- if (r != KERN_SUCCESS) return;
-
- p = [NSMachPort portWithMachPort:_port];
- [p setDelegate:NSApp];
- [p scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+
+ if (_port != MACH_PORT_NULL)
+ return;
+
+ r = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &_port);
+ if (r != KERN_SUCCESS)
+ return;
+
+ p =[NSMachPort portWithMachPort:_port];
+ [p setDelegate:NSApp];
+ [p scheduleInRunLoop: [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}
-static void message_kit_thread (SEL selector, NSObject *arg) {
+static void
+message_kit_thread(SEL selector, NSObject * arg)
+{
message msg;
kern_return_t r;
-
- msg.hdr.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_MAKE_SEND, 0);
- msg.hdr.msgh_size = sizeof (msg);
+
+ msg.hdr.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0);
+ msg.hdr.msgh_size = sizeof(msg);
msg.hdr.msgh_remote_port = _port;
msg.hdr.msgh_local_port = MACH_PORT_NULL;
msg.hdr.msgh_reserved = 0;
msg.hdr.msgh_id = 0;
-
+
msg.selector = selector;
- msg.arg = [arg retain];
-
- r = mach_msg (&msg.hdr, MACH_SEND_MSG, msg.hdr.msgh_size,
- 0, MACH_PORT_NULL, 0, MACH_PORT_NULL);
+ msg.arg =[arg retain];
+
+ r = mach_msg(&msg.hdr, MACH_SEND_MSG, msg.hdr.msgh_size,
+ 0, MACH_PORT_NULL, 0, MACH_PORT_NULL);
if (r != KERN_SUCCESS)
- ErrorF("%s: mach_msg failed: %x\n", __FUNCTION__, r);
+ ErrorF("%s: mach_msg failed: %x\n", __FUNCTION__, r);
}
-- (void) handleMachMessage:(void *)_msg {
+ -(void) handleMachMessage:(void *) _msg {
message *msg = _msg;
-
- [self performSelector:msg->selector withObject:msg->arg];
+
+ [self performSelector: msg->selector withObject:msg->arg];
[msg->arg release];
}
-- (void) set_controller:obj {
- if (_controller == nil) _controller = [obj retain];
+ -(void) set_controller:obj {
+ if (_controller == nil)
+ _controller =[obj retain];
}
-- (void) dealloc {
- if (_controller != nil) [_controller release];
-
+-(void) dealloc {
+ if (_controller != nil)
+ [_controller release];
+
if (_port != MACH_PORT_NULL)
- mach_port_deallocate (mach_task_self (), _port);
-
+ mach_port_deallocate(mach_task_self(), _port);
+
[super dealloc];
}
-- (void) orderFrontStandardAboutPanel: (id) sender {
+ -(void) orderFrontStandardAboutPanel:(id) sender {
NSMutableDictionary *dict;
NSDictionary *infoDict;
NSString *tem;
-
- dict = [NSMutableDictionary dictionaryWithCapacity:3];
- infoDict = [[NSBundle mainBundle] infoDictionary];
-
- [dict setObject: NSLocalizedString (@"The X Window System", @"About panel")
- forKey:@"ApplicationName"];
-
- tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
-
- [dict setObject:[NSString stringWithFormat:@"XQuartz %@", tem]
- forKey:@"ApplicationVersion"];
-
- [dict setObject:[NSString stringWithFormat:@"xorg-server %s", XSERVER_VERSION]
- forKey:@"Version"];
-
- [self orderFrontStandardAboutPanelWithOptions: dict];
+
+ dict =[NSMutableDictionary dictionaryWithCapacity:3];
+ infoDict =[[NSBundle mainBundle] infoDictionary];
+
+ [dict setObject:NSLocalizedString(@"The X Window System", @"About panel")
+ forKey:@"ApplicationName"];
+
+ tem =[infoDict objectForKey:@"CFBundleShortVersionString"];
+
+ [dict setObject: [NSString stringWithFormat:@"XQuartz %@", tem]
+ forKey:@"ApplicationVersion"];
+
+ [dict setObject: [NSString stringWithFormat:@"xorg-server %s",
+ XSERVER_VERSION]
+ forKey:@"Version"];
+
+ [self orderFrontStandardAboutPanelWithOptions:dict];
}
-- (void) activateX:(OSX_BOOL)state {
+ -(void) activateX:(OSX_BOOL) state {
if (_x_active == state)
return;
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active);
if (state) {
- if(bgMouseLocationUpdated) {
- DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, bgMouseLocation.x, bgMouseLocation.y, 0.0, 0.0, 0.0);
+ if (bgMouseLocationUpdated) {
+ DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
+ bgMouseLocation.x, bgMouseLocation.y, 0.0,
+ 0.0, 0.0);
bgMouseLocationUpdated = FALSE;
}
DarwinSendDDXEvent(kXquartzActivate, 0);
- } else {
+ }
+ else {
- if(darwin_all_modifier_flags)
+ if (darwin_all_modifier_flags)
DarwinUpdateModKeys(0);
DarwinInputReleaseButtonsAndKeys(darwinKeyboard);
@@ -218,238 +232,270 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
_x_active = state;
}
-- (void) became_key:(NSWindow *)win {
- [self activateX:NO];
+ -(void) became_key:(NSWindow *) win {
+ [self activateX:NO];
}
-- (void) sendEvent:(NSEvent *)e {
+ -(void) sendEvent:(NSEvent *) e {
OSX_BOOL for_appkit, for_x;
-
+
/* By default pass down the responder chain and to X. */
for_appkit = YES;
for_x = YES;
-
+
switch ([e type]) {
- case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
- case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
- if ([e window] != nil) {
- /* Pointer event has an (AppKit) window. Probably something for the kit. */
- for_x = NO;
- if (_x_active) [self activateX:NO];
- } else if ([self modalWindow] == nil) {
- /* Must be an X window. Tell appkit it doesn't have focus. */
- for_appkit = NO;
-
- if ([self isActive]) {
- [self deactivate];
- if (!_x_active && quartzProcs->IsX11Window([e windowNumber]))
- [self activateX:YES];
- }
+ case NSLeftMouseDown:
+ case NSRightMouseDown:
+ case NSOtherMouseDown:
+ case NSLeftMouseUp:
+ case NSRightMouseUp:
+ case NSOtherMouseUp:
+ if ([e window] != nil) {
+ /* Pointer event has an (AppKit) window. Probably something for the kit. */
+ for_x = NO;
+ if (_x_active)
+ [self activateX:NO];
+ }
+ else if ([self modalWindow] == nil) {
+ /* Must be an X window. Tell appkit it doesn't have focus. */
+ for_appkit = NO;
+
+ if ([self isActive]) {
+ [self deactivate];
+ if (!_x_active && quartzProcs->IsX11Window([e windowNumber]))
+ [self activateX: YES];
}
+ }
- /* We want to force sending to appkit if we're over the menu bar */
- if(!for_appkit) {
- NSPoint NSlocation = [e locationInWindow];
- NSWindow *window = [e window];
- NSRect NSframe, NSvisibleFrame;
- CGRect CGframe, CGvisibleFrame;
- CGPoint CGlocation;
-
- if (window != nil) {
- NSRect frame = [window frame];
- NSlocation.x += frame.origin.x;
- NSlocation.y += frame.origin.y;
- }
+ /* We want to force sending to appkit if we're over the menu bar */
+ if (!for_appkit) {
+ NSPoint NSlocation =[e locationInWindow];
+ NSWindow *window =[e window];
+ NSRect NSframe, NSvisibleFrame;
+ CGRect CGframe, CGvisibleFrame;
+ CGPoint CGlocation;
+
+ if (window != nil) {
+ NSRect frame =[window frame];
- NSframe = [[NSScreen mainScreen] frame];
- NSvisibleFrame = [[NSScreen mainScreen] visibleFrame];
-
- CGframe = CGRectMake(NSframe.origin.x, NSframe.origin.y,
- NSframe.size.width, NSframe.size.height);
- CGvisibleFrame = CGRectMake(NSvisibleFrame.origin.x,
- NSvisibleFrame.origin.y,
- NSvisibleFrame.size.width,
- NSvisibleFrame.size.height);
- CGlocation = CGPointMake(NSlocation.x, NSlocation.y);
-
- if(CGRectContainsPoint(CGframe, CGlocation) &&
- !CGRectContainsPoint(CGvisibleFrame, CGlocation))
- for_appkit = YES;
+ NSlocation.x += frame.origin.x;
+ NSlocation.y += frame.origin.y;
}
-
- break;
-
- case NSKeyDown: case NSKeyUp:
-
- if(_x_active) {
- static BOOL do_swallow = NO;
- static int swallow_keycode;
-
- if([e type] == NSKeyDown) {
- /* Before that though, see if there are any global
- * shortcuts bound to it. */
-
- if(darwinAppKitModMask & [e modifierFlags]) {
- /* Override to force sending to Appkit */
- swallow_keycode = [e keyCode];
- do_swallow = YES;
- for_x = NO;
+
+ NSframe =[[NSScreen mainScreen] frame];
+ NSvisibleFrame =[[NSScreen mainScreen] visibleFrame];
+
+ CGframe = CGRectMake(NSframe.origin.x, NSframe.origin.y,
+ NSframe.size.width, NSframe.size.height);
+ CGvisibleFrame = CGRectMake(NSvisibleFrame.origin.x,
+ NSvisibleFrame.origin.y,
+ NSvisibleFrame.size.width,
+ NSvisibleFrame.size.height);
+ CGlocation = CGPointMake(NSlocation.x, NSlocation.y);
+
+ if (CGRectContainsPoint(CGframe, CGlocation) &&
+ !CGRectContainsPoint(CGvisibleFrame, CGlocation))
+ for_appkit = YES;
+ }
+
+ break;
+
+ case NSKeyDown:
+ case NSKeyUp:
+
+ if (_x_active) {
+ static BOOL do_swallow = NO;
+ static int swallow_keycode;
+
+ if ([e type] == NSKeyDown) {
+ /* Before that though, see if there are any global
+ * shortcuts bound to it. */
+
+ if (darwinAppKitModMask &[e modifierFlags]) {
+ /* Override to force sending to Appkit */
+ swallow_keycode =[e keyCode];
+ do_swallow = YES;
+ for_x = NO;
#if XPLUGIN_VERSION >= 1
- } else if(XQuartzEnableKeyEquivalents &&
- xp_is_symbolic_hotkey_event([e eventRef])) {
- swallow_keycode = [e keyCode];
- do_swallow = YES;
- for_x = NO;
+ }
+ else if (XQuartzEnableKeyEquivalents &&
+ xp_is_symbolic_hotkey_event([e eventRef])) {
+ swallow_keycode =[e keyCode];
+ do_swallow = YES;
+ for_x = NO;
#endif
- } else if(XQuartzEnableKeyEquivalents &&
- [[self mainMenu] performKeyEquivalent:e]) {
- swallow_keycode = [e keyCode];
- do_swallow = YES;
- for_appkit = NO;
- for_x = NO;
- } else if(!XQuartzIsRootless
- && ([e modifierFlags] & ALL_KEY_MASKS) == (NSCommandKeyMask | NSAlternateKeyMask)
- && ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) {
- /* We have this here to force processing fullscreen
- * toggle even if XQuartzEnableKeyEquivalents is disabled */
- swallow_keycode = [e keyCode];
- do_swallow = YES;
- for_x = NO;
- for_appkit = NO;
- DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
- } else {
- /* No kit window is focused, so send it to X. */
- for_appkit = NO;
- }
- } else { /* KeyUp */
- /* If we saw a key equivalent on the down, don't pass
- * the up through to X. */
- if (do_swallow && [e keyCode] == swallow_keycode) {
- do_swallow = NO;
- for_x = NO;
- }
}
- } else { /* !_x_active */
- for_x = NO;
+ else if (XQuartzEnableKeyEquivalents &&[[self mainMenu] performKeyEquivalent:e])
+ {
+ swallow_keycode =[e keyCode];
+ do_swallow = YES;
+ for_appkit = NO;
+ for_x = NO;
+ }
+ else if (!XQuartzIsRootless
+ && ([e modifierFlags] & ALL_KEY_MASKS) ==
+ (NSCommandKeyMask | NSAlternateKeyMask)
+ && ([e keyCode] == 0 /*a */ ||
+ [e keyCode] == 53 /*Esc */ )) {
+ /* We have this here to force processing fullscreen
+ * toggle even if XQuartzEnableKeyEquivalents is disabled */
+ swallow_keycode =[e keyCode];
+ do_swallow = YES;
+ for_x = NO;
+ for_appkit = NO;
+ DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
+ }
+ else {
+ /* No kit window is focused, so send it to X. */
+ for_appkit = NO;
+ }
+ }
+ else { /* KeyUp */
+ /* If we saw a key equivalent on the down, don't pass
+ * the up through to X. */
+ if (do_swallow &&[e keyCode] == swallow_keycode) {
+ do_swallow = NO;
+ for_x = NO;
+ }
+ }
+ }
+ else { /* !_x_active */
+ for_x = NO;
+ }
+ break;
+
+ case NSFlagsChanged:
+ /* Don't tell X11 about modifiers changing while it's not active */
+ if (!_x_active)
+ for_x = NO;
+ break;
+
+ case NSAppKitDefined:
+ switch ([e subtype]) {
+ static BOOL x_was_active = NO;
+
+ case NSApplicationActivatedEventType:
+ for_x = NO;
+ if ([e window] == nil && x_was_active) {
+ BOOL order_all_windows = YES, workspaces, ok;
+
+ for_appkit = NO;
+
+ /* FIXME: This is a hack to avoid passing the event to AppKit which
+ * would result in it raising one of its windows.
+ */
+ _appFlags._active = YES;
+
+ [self set_front_process:nil];
+
+ /* Get the Spaces preference for SwitchOnActivate */
+ (void) CFPreferencesAppSynchronize(CFSTR("com.apple.dock"));
+ workspaces =
+ CFPreferencesGetAppBooleanValue(CFSTR("workspaces"),
+ CFSTR("com.apple.dock"),
+ &ok);
+ if (!ok)
+ workspaces = NO;
+
+ if (workspaces) {
+ (void)
+ CFPreferencesAppSynchronize(CFSTR
+ (".GlobalPreferences"));
+ order_all_windows =
+ CFPreferencesGetAppBooleanValue(CFSTR
+ ("AppleSpacesSwitchOnActivate"),
+ CFSTR
+ (".GlobalPreferences"),
+ &ok);
+ if (!ok)
+ order_all_windows = YES;
+ }
+
+ /* TODO: In the workspaces && !AppleSpacesSwitchOnActivate case, the windows are ordered
+ * correctly, but we need to activate the top window on this space if there is
+ * none active.
+ *
+ * If there are no active windows, and there are minimized windows, we should
+ * be restoring one of them.
+ */
+ if ([e data2] & 0x10) { // 0x10 (bfCPSOrderAllWindowsForward) is set when we use cmd-tab or the dock icon
+ DarwinSendDDXEvent(kXquartzBringAllToFront, 1,
+ order_all_windows);
+ }
}
break;
-
- case NSFlagsChanged:
- /* Don't tell X11 about modifiers changing while it's not active */
- if (!_x_active)
- for_x = NO;
+
+ case 18: /* ApplicationDidReactivate */
+ if (XQuartzFullscreenVisible)
+ for_appkit = NO;
break;
-
- case NSAppKitDefined:
- switch ([e subtype]) {
- static BOOL x_was_active = NO;
- case NSApplicationActivatedEventType:
- for_x = NO;
- if ([e window] == nil && x_was_active) {
- BOOL order_all_windows = YES, workspaces, ok;
- for_appkit = NO;
-
- /* FIXME: This is a hack to avoid passing the event to AppKit which
- * would result in it raising one of its windows.
- */
- _appFlags._active = YES;
-
- [self set_front_process:nil];
-
- /* Get the Spaces preference for SwitchOnActivate */
- (void)CFPreferencesAppSynchronize(CFSTR("com.apple.dock"));
- workspaces = CFPreferencesGetAppBooleanValue(CFSTR("workspaces"), CFSTR("com.apple.dock"), &ok);
- if (!ok)
- workspaces = NO;
-
- if (workspaces) {
- (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences"));
- order_all_windows = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok);
- if (!ok)
- order_all_windows = YES;
- }
-
- /* TODO: In the workspaces && !AppleSpacesSwitchOnActivate case, the windows are ordered
- * correctly, but we need to activate the top window on this space if there is
- * none active.
- *
- * If there are no active windows, and there are minimized windows, we should
- * be restoring one of them.
- */
- if ([e data2] & 0x10) { // 0x10 (bfCPSOrderAllWindowsForward) is set when we use cmd-tab or the dock icon
- DarwinSendDDXEvent(kXquartzBringAllToFront, 1, order_all_windows);
- }
- }
- break;
-
- case 18: /* ApplicationDidReactivate */
- if (XQuartzFullscreenVisible) for_appkit = NO;
- break;
-
- case NSApplicationDeactivatedEventType:
- for_x = NO;
+ case NSApplicationDeactivatedEventType:
+ for_x = NO;
- x_was_active = _x_active;
- if(_x_active)
- [self activateX:NO];
- break;
- }
+ x_was_active = _x_active;
+ if (_x_active)
+ [self activateX:NO];
break;
-
- default: break; /* for gcc */
+ }
+ break;
+
+ default:
+ break; /* for gcc */
}
-
- if (for_appkit) [super sendEvent:e];
-
+
+ if (for_appkit)
+ [super sendEvent:e];
+
if (for_x) {
#ifdef HAVE_LIBDISPATCH
- dispatch_async(eventTranslationQueue, ^{
+ dispatch_async(eventTranslationQueue, ^ {
#endif
- [self sendX11NSEvent:e];
+ [self sendX11NSEvent:e];
#ifdef HAVE_LIBDISPATCH
- });
+ }
+ );
#endif
}
}
-- (void) set_window_menu:(NSArray *)list {
- [_controller set_window_menu:list];
+ -(void) set_window_menu:(NSArray *) list {
+ [_controller set_window_menu:list];
}
-- (void) set_window_menu_check:(NSNumber *)n {
- [_controller set_window_menu_check:n];
+ -(void) set_window_menu_check:(NSNumber *) n {
+ [_controller set_window_menu_check:n];
}
-- (void) set_apps_menu:(NSArray *)list {
- [_controller set_apps_menu:list];
+ -(void) set_apps_menu:(NSArray *) list {
+ [_controller set_apps_menu:list];
}
-- (void) set_front_process:unused {
- [NSApp activateIgnoringOtherApps:YES];
+ -(void) set_front_process:unused {
+ [NSApp activateIgnoringOtherApps:YES];
- if ([self modalWindow] == nil)
- [self activateX:YES];
+ if ([self modalWindow] == nil)
+ [self activateX:YES];
}
-- (void) set_can_quit:(NSNumber *)state {
- [_controller set_can_quit:[state boolValue]];
+ -(void) set_can_quit:(NSNumber *) state {
+ [_controller set_can_quit:[state boolValue]];
}
-- (void) server_ready:unused {
- [_controller server_ready];
+ -(void) server_ready:unused {
+ [_controller server_ready];
}
-- (void) show_hide_menubar:(NSNumber *)state {
+ -(void) show_hide_menubar:(NSNumber *) state {
/* Also shows/hides the dock */
if ([state boolValue])
- SetSystemUIMode(kUIModeNormal, 0);
+ SetSystemUIMode(kUIModeNormal, 0);
else
- SetSystemUIMode(kUIModeAllHidden, XQuartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation"
+ SetSystemUIMode(kUIModeAllHidden, XQuartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation"
}
-- (void) launch_client:(NSString *)cmd {
- (void)[_controller application:self openFile:cmd];
+ -(void) launch_client:(NSString *) cmd {
+ (void)[_controller application: self openFile:cmd];
}
/* user preferences */
@@ -457,457 +503,524 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
/* Note that these functions only work for arrays whose elements
can be toll-free-bridged between NS and CF worlds. */
-static const void *cfretain (CFAllocatorRef a, const void *b) {
- return CFRetain (b);
+static const void *
+cfretain(CFAllocatorRef a, const void *b)
+{
+ return CFRetain(b);
}
-static void cfrelease (CFAllocatorRef a, const void *b) {
- CFRelease (b);
+static void
+cfrelease(CFAllocatorRef a, const void *b)
+{
+ CFRelease(b);
}
-static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) {
- CFMutableArrayRef out;
- CFArrayCallBacks cb;
- NSObject *ns;
- const CFTypeRef *cf;
- int i, count;
+static CFMutableArrayRef
+nsarray_to_cfarray(NSArray * in)
+{
+ CFMutableArrayRef out;
+ CFArrayCallBacks cb;
+ NSObject *ns;
+ const CFTypeRef *cf;
+ int i, count;
+
+ memset(&cb, 0, sizeof(cb));
+ cb.version = 0;
+ cb.retain = cfretain;
+ cb.release = cfrelease;
+
+ count =[in count];
+ out = CFArrayCreateMutable(NULL, count, &cb);
+
+ for (i = 0; i < count; i++) {
+ ns =[in objectAtIndex:i];
+
+ if ([ns isKindOfClass:[NSArray class]])
+ cf = (CFTypeRef) nsarray_to_cfarray((NSArray *) ns);
+ else
+ cf = CFRetain((CFTypeRef) ns);
+
+ CFArrayAppendValue(out, cf);
+ CFRelease(cf);
+ }
+
+ return out;
+}
- memset (&cb, 0, sizeof (cb));
- cb.version = 0;
- cb.retain = cfretain;
- cb.release = cfrelease;
+static NSMutableArray *
+cfarray_to_nsarray(CFArrayRef in)
+{
+ NSMutableArray *out;
+ const CFTypeRef *cf;
+ NSObject *ns;
+ int i, count;
- count = [in count];
- out = CFArrayCreateMutable (NULL, count, &cb);
+ count = CFArrayGetCount(in);
+ out =[[NSMutableArray alloc] initWithCapacity:count];
- for (i = 0; i < count; i++) {
- ns = [in objectAtIndex:i];
+ for (i = 0; i < count; i++) {
+ cf = CFArrayGetValueAtIndex(in, i);
- if ([ns isKindOfClass:[NSArray class]])
- cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns);
- else
- cf = CFRetain ((CFTypeRef) ns);
+ if (CFGetTypeID(cf) == CFArrayGetTypeID())
+ ns = cfarray_to_nsarray((CFArrayRef) cf);
+ else
+ ns =[(id) cf retain];
- CFArrayAppendValue (out, cf);
- CFRelease (cf);
- }
+ [out addObject:ns];
+ [ns release];
+ }
- return out;
+ return out;
}
-static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
- NSMutableArray *out;
- const CFTypeRef *cf;
- NSObject *ns;
- int i, count;
+ -(CFPropertyListRef) prefs_get_copy:(NSString *) key {
+ CFPropertyListRef value;
- count = CFArrayGetCount (in);
- out = [[NSMutableArray alloc] initWithCapacity:count];
+ value =
+ CFPreferencesCopyAppValue((CFStringRef) key, app_prefs_domain_cfstr);
- for (i = 0; i < count; i++) {
- cf = CFArrayGetValueAtIndex (in, i);
+ if (value == NULL) {
+ static CFDictionaryRef defaults;
+
+ if (defaults == NULL) {
+ CFStringRef error = NULL;
+ CFDataRef data;
+ CFURLRef url;
+ SInt32 error_code;
+
+ url = (CFURLCreateFromFileSystemRepresentation
+ (NULL, (unsigned char *) DEFAULTS_FILE,
+ strlen(DEFAULTS_FILE), false));
+ if (CFURLCreateDataAndPropertiesFromResource
+ (NULL, url, &data, NULL, NULL, &error_code)) {
+ defaults =
+ (CFPropertyListCreateFromXMLData
+ (NULL, data, kCFPropertyListMutableContainersAndLeaves,
+ &error));
+ if (error != NULL)
+ CFRelease(error);
+ CFRelease(data);
+ }
+ CFRelease(url);
+
+ if (defaults != NULL) {
+ NSMutableArray *apps, *elt;
+ int count, i;
+ NSString *name, *nname;
+
+ /* Localize the names in the default apps menu. */
+
+ apps =[(NSDictionary *) defaults objectForKey:@PREFS_APPSMENU];
+ if (apps != nil) {
+ count =[apps count];
+ for (i = 0; i < count; i++) {
+ elt =[apps objectAtIndex:i];
+ if (elt != nil &&[elt isKindOfClass:[NSArray class]]) {
+ name =[elt objectAtIndex: 0];
+ if (name != nil) {
+ nname = NSLocalizedString(name, nil);
+ if (nname != nil && nname != name)
+ [elt replaceObjectAtIndex: 0 withObject:nname];
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (defaults != NULL)
+ value = CFDictionaryGetValue(defaults, key);
+ if (value != NULL)
+ CFRetain(value);
+ }
+
+ return value;
+}
- if (CFGetTypeID (cf) == CFArrayGetTypeID ())
- ns = cfarray_to_nsarray ((CFArrayRef) cf);
- else
- ns = [(id)cf retain];
+ -(int) prefs_get_integer:(NSString *)
+key default:(int) def
+{
+ CFPropertyListRef value;
+ int ret;
- [out addObject:ns];
- [ns release];
- }
+ value =[self prefs_get_copy:key];
+
+ if (value != NULL && CFGetTypeID(value) == CFNumberGetTypeID())
+ CFNumberGetValue(value, kCFNumberIntType, &ret);
+ else if (value != NULL && CFGetTypeID(value) == CFStringGetTypeID())
+ ret = CFStringGetIntValue(value);
+ else
+ ret = def;
- return out;
+ if (value != NULL)
+ CFRelease(value);
+
+ return ret;
}
-- (CFPropertyListRef) prefs_get_copy:(NSString *)key {
+ -(const char *) prefs_get_string:(NSString *)
+key default:(const char *) def
+{
CFPropertyListRef value;
-
- value = CFPreferencesCopyAppValue ((CFStringRef) key, app_prefs_domain_cfstr);
-
- if (value == NULL) {
- static CFDictionaryRef defaults;
-
- if (defaults == NULL) {
- CFStringRef error = NULL;
- CFDataRef data;
- CFURLRef url;
- SInt32 error_code;
-
- url = (CFURLCreateFromFileSystemRepresentation
- (NULL, (unsigned char *)DEFAULTS_FILE, strlen (DEFAULTS_FILE), false));
- if (CFURLCreateDataAndPropertiesFromResource (NULL, url, &data,
- NULL, NULL, &error_code)) {
- defaults = (CFPropertyListCreateFromXMLData
- (NULL, data, kCFPropertyListMutableContainersAndLeaves, &error));
- if (error != NULL) CFRelease (error);
- CFRelease (data);
- }
- CFRelease (url);
-
- if (defaults != NULL) {
- NSMutableArray *apps, *elt;
- int count, i;
- NSString *name, *nname;
-
- /* Localize the names in the default apps menu. */
-
- apps = [(NSDictionary *)defaults objectForKey:@PREFS_APPSMENU];
- if (apps != nil) {
- count = [apps count];
- for (i = 0; i < count; i++) {
- elt = [apps objectAtIndex:i];
- if (elt != nil && [elt isKindOfClass:[NSArray class]]) {
- name = [elt objectAtIndex:0];
- if (name != nil) {
- nname = NSLocalizedString (name, nil);
- if (nname != nil && nname != name)
- [elt replaceObjectAtIndex:0 withObject:nname];
- }
- }
- }
- }
- }
- }
-
- if (defaults != NULL) value = CFDictionaryGetValue (defaults, key);
- if (value != NULL) CFRetain (value);
+ const char *ret = NULL;
+
+ value =[self prefs_get_copy:key];
+
+ if (value != NULL && CFGetTypeID(value) == CFStringGetTypeID()) {
+ NSString *s = (NSString *) value;
+
+ ret =[s UTF8String];
}
-
- return value;
-}
-- (int) prefs_get_integer:(NSString *)key default:(int)def {
- CFPropertyListRef value;
- int ret;
-
- value = [self prefs_get_copy:key];
-
- if (value != NULL && CFGetTypeID (value) == CFNumberGetTypeID ())
- CFNumberGetValue (value, kCFNumberIntType, &ret);
- else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
- ret = CFStringGetIntValue (value);
- else
- ret = def;
-
- if (value != NULL) CFRelease (value);
-
- return ret;
-}
+ if (value != NULL)
+ CFRelease(value);
-- (const char *) prefs_get_string:(NSString *)key default:(const char *)def {
- CFPropertyListRef value;
- const char *ret = NULL;
-
- value = [self prefs_get_copy:key];
-
- if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) {
- NSString *s = (NSString *) value;
-
- ret = [s UTF8String];
- }
-
- if (value != NULL) CFRelease (value);
-
- return ret != NULL ? ret : def;
+ return ret != NULL ? ret : def;
}
-- (NSURL *) prefs_copy_url:(NSString *)key default:(NSURL *)def {
+ -(NSURL *) prefs_copy_url:(NSString *)
+key default:(NSURL *) def
+{
CFPropertyListRef value;
NSURL *ret = NULL;
-
- value = [self prefs_get_copy:key];
-
- if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) {
+
+ value =[self prefs_get_copy:key];
+
+ if (value != NULL && CFGetTypeID(value) == CFStringGetTypeID()) {
NSString *s = (NSString *) value;
- ret = [NSURL URLWithString:s];
+ ret =[NSURL URLWithString:s];
[ret retain];
}
-
- if (value != NULL) CFRelease (value);
-
+
+ if (value != NULL)
+ CFRelease(value);
+
return ret != NULL ? ret : def;
}
-- (float) prefs_get_float:(NSString *)key default:(float)def {
- CFPropertyListRef value;
- float ret = def;
-
- value = [self prefs_get_copy:key];
-
- if (value != NULL
- && CFGetTypeID (value) == CFNumberGetTypeID ()
- && CFNumberIsFloatType (value))
- CFNumberGetValue (value, kCFNumberFloatType, &ret);
- else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
- ret = CFStringGetDoubleValue (value);
-
- if (value != NULL) CFRelease (value);
-
- return ret;
+ -(float) prefs_get_float:(NSString *)
+key default:(float) def
+{
+ CFPropertyListRef value;
+ float ret = def;
+
+ value =[self prefs_get_copy:key];
+
+ if (value != NULL && CFGetTypeID(value) == CFNumberGetTypeID()
+ && CFNumberIsFloatType(value))
+ CFNumberGetValue(value, kCFNumberFloatType, &ret);
+ else if (value != NULL && CFGetTypeID(value) == CFStringGetTypeID())
+ ret = CFStringGetDoubleValue(value);
+
+ if (value != NULL)
+ CFRelease(value);
+
+ return ret;
}
-- (int) prefs_get_boolean:(NSString *)key default:(int)def {
- CFPropertyListRef value;
- int ret = def;
-
- value = [self prefs_get_copy:key];
-
- if (value != NULL) {
- if (CFGetTypeID (value) == CFNumberGetTypeID ())
- CFNumberGetValue (value, kCFNumberIntType, &ret);
- else if (CFGetTypeID (value) == CFBooleanGetTypeID ())
- ret = CFBooleanGetValue (value);
- else if (CFGetTypeID (value) == CFStringGetTypeID ()) {
- const char *tem = [(NSString *) value UTF8String];
- if (strcasecmp (tem, "true") == 0 || strcasecmp (tem, "yes") == 0)
- ret = YES;
- else
- ret = NO;
+ -(int) prefs_get_boolean:(NSString *)
+key default:(int) def
+{
+ CFPropertyListRef value;
+ int ret = def;
+
+ value =[self prefs_get_copy:key];
+
+ if (value != NULL) {
+ if (CFGetTypeID(value) == CFNumberGetTypeID())
+ CFNumberGetValue(value, kCFNumberIntType, &ret);
+ else if (CFGetTypeID(value) == CFBooleanGetTypeID())
+ ret = CFBooleanGetValue(value);
+ else if (CFGetTypeID(value) == CFStringGetTypeID()) {
+ const char *tem =[(NSString *) value UTF8String];
+
+ if (strcasecmp(tem, "true") == 0 || strcasecmp(tem, "yes") == 0)
+ ret = YES;
+ else
+ ret = NO;
+ }
+
+ CFRelease(value);
}
-
- CFRelease (value);
- }
- return ret;
+ return ret;
}
-- (NSArray *) prefs_get_array:(NSString *)key {
- NSArray *ret = nil;
- CFPropertyListRef value;
-
- value = [self prefs_get_copy:key];
-
- if (value != NULL) {
- if (CFGetTypeID (value) == CFArrayGetTypeID ())
- ret = [cfarray_to_nsarray (value) autorelease];
-
- CFRelease (value);
- }
-
- return ret;
+ -(NSArray *) prefs_get_array:(NSString *) key {
+ NSArray *ret = nil;
+ CFPropertyListRef value;
+
+ value =[self prefs_get_copy:key];
+
+ if (value != NULL) {
+ if (CFGetTypeID(value) == CFArrayGetTypeID())
+ ret =[cfarray_to_nsarray(value) autorelease];
+
+ CFRelease(value);
+ }
+
+ return ret;
}
-- (void) prefs_set_integer:(NSString *)key value:(int)value {
+ -(void) prefs_set_integer:(NSString *)
+key value:(int) value
+{
CFNumberRef x;
-
- x = CFNumberCreate (NULL, kCFNumberIntType, &value);
-
- CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr,
- kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
-
- CFRelease (x);
+
+ x = CFNumberCreate(NULL, kCFNumberIntType, &value);
+
+ CFPreferencesSetValue((CFStringRef) key, (CFTypeRef) x,
+ app_prefs_domain_cfstr, kCFPreferencesCurrentUser,
+ kCFPreferencesAnyHost);
+
+ CFRelease(x);
}
-- (void) prefs_set_float:(NSString *)key value:(float)value {
+ -(void) prefs_set_float:(NSString *)
+key value:(float) value
+{
CFNumberRef x;
-
- x = CFNumberCreate (NULL, kCFNumberFloatType, &value);
-
- CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr,
- kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
-
- CFRelease (x);
+
+ x = CFNumberCreate(NULL, kCFNumberFloatType, &value);
+
+ CFPreferencesSetValue((CFStringRef) key, (CFTypeRef) x,
+ app_prefs_domain_cfstr, kCFPreferencesCurrentUser,
+ kCFPreferencesAnyHost);
+
+ CFRelease(x);
}
-- (void) prefs_set_boolean:(NSString *)key value:(int)value {
- CFPreferencesSetValue ((CFStringRef) key,
- (CFTypeRef) (value ? kCFBooleanTrue
- : kCFBooleanFalse), app_prefs_domain_cfstr,
- kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
-
+ -(void) prefs_set_boolean:(NSString *)
+key value:(int) value
+{
+ CFPreferencesSetValue((CFStringRef) key,
+ (CFTypeRef) (value ? kCFBooleanTrue
+ : kCFBooleanFalse),
+ app_prefs_domain_cfstr, kCFPreferencesCurrentUser,
+ kCFPreferencesAnyHost);
+
}
-- (void) prefs_set_array:(NSString *)key value:(NSArray *)value {
- CFArrayRef cfarray;
-
- cfarray = nsarray_to_cfarray (value);
- CFPreferencesSetValue ((CFStringRef) key,
- (CFTypeRef) cfarray,
- app_prefs_domain_cfstr,
- kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
- CFRelease (cfarray);
+ -(void) prefs_set_array:(NSString *)
+key value:(NSArray *) value
+{
+ CFArrayRef cfarray;
+
+ cfarray = nsarray_to_cfarray(value);
+ CFPreferencesSetValue((CFStringRef) key,
+ (CFTypeRef) cfarray,
+ app_prefs_domain_cfstr,
+ kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+ CFRelease(cfarray);
}
-- (void) prefs_set_string:(NSString *)key value:(NSString *)value {
- CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value,
- app_prefs_domain_cfstr, kCFPreferencesCurrentUser,
- kCFPreferencesAnyHost);
+ -(void) prefs_set_string:(NSString *)
+key value:(NSString *) value
+{
+ CFPreferencesSetValue((CFStringRef) key, (CFTypeRef) value,
+ app_prefs_domain_cfstr, kCFPreferencesCurrentUser,
+ kCFPreferencesAnyHost);
}
-- (void) prefs_synchronize {
- CFPreferencesAppSynchronize (kCFPreferencesCurrentApplication);
+-(void) prefs_synchronize {
+ CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
}
-- (void) read_defaults
-{
+-(void) read_defaults {
NSString *nsstr;
const char *tem;
-
- XQuartzRootlessDefault = [self prefs_get_boolean:@PREFS_ROOTLESS
- default:XQuartzRootlessDefault];
- XQuartzFullscreenMenu = [self prefs_get_boolean:@PREFS_FULLSCREEN_MENU
- default:XQuartzFullscreenMenu];
- XQuartzFullscreenDisableHotkeys = ![self prefs_get_boolean:@PREFS_FULLSCREEN_HOTKEYS
- default:!XQuartzFullscreenDisableHotkeys];
- darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
- default:darwinFakeButtons];
- XQuartzOptionSendsAlt = [self prefs_get_boolean:@PREFS_OPTION_SENDS_ALT
- default:XQuartzOptionSendsAlt];
+
+XQuartzRootlessDefault =[self prefs_get_boolean: @PREFS_ROOTLESS default:
+XQuartzRootlessDefault];
+XQuartzFullscreenMenu =[self prefs_get_boolean: @PREFS_FULLSCREEN_MENU default:
+XQuartzFullscreenMenu];
+XQuartzFullscreenDisableHotkeys = ![self prefs_get_boolean: @PREFS_FULLSCREEN_HOTKEYS default:
+!XQuartzFullscreenDisableHotkeys];
+darwinFakeButtons =[self prefs_get_boolean: @PREFS_FAKEBUTTONS default:
+darwinFakeButtons];
+XQuartzOptionSendsAlt =[self prefs_get_boolean: @PREFS_OPTION_SENDS_ALT default:
+XQuartzOptionSendsAlt];
if (darwinFakeButtons) {
const char *fake2, *fake3;
- fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL];
- fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL];
+fake2 =[self prefs_get_string: @PREFS_FAKE_BUTTON2 default:
+NULL];
+fake3 =[self prefs_get_string: @PREFS_FAKE_BUTTON3 default:
+NULL];
- if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2, TRUE);
- if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3, TRUE);
+ if (fake2 != NULL)
+ darwinFakeMouse2Mask = DarwinParseModifierList(fake2, TRUE);
+ if (fake3 != NULL)
+ darwinFakeMouse3Mask = DarwinParseModifierList(fake3, TRUE);
}
- tem = [self prefs_get_string:@PREFS_APPKIT_MODIFIERS default:NULL];
- if (tem != NULL) darwinAppKitModMask = DarwinParseModifierList(tem, TRUE);
-
- tem = [self prefs_get_string:@PREFS_WINDOW_ITEM_MODIFIERS default:NULL];
+tem =[self prefs_get_string: @PREFS_APPKIT_MODIFIERS default:
+NULL];
+ if (tem != NULL)
+ darwinAppKitModMask = DarwinParseModifierList(tem, TRUE);
+
+tem =[self prefs_get_string: @PREFS_WINDOW_ITEM_MODIFIERS default:
+NULL];
if (tem != NULL) {
windowItemModMask = DarwinParseModifierList(tem, FALSE);
- } else {
- nsstr = NSLocalizedString (@"window item modifiers", @"window item modifiers");
- if(nsstr != NULL) {
- tem = [nsstr UTF8String];
- if((tem != NULL) && strcmp(tem, "window item modifiers")) {
+ }
+ else {
+ nsstr =
+ NSLocalizedString(@"window item modifiers",
+ @"window item modifiers");
+ if (nsstr != NULL) {
+ tem =[nsstr UTF8String];
+ if ((tem != NULL) && strcmp(tem, "window item modifiers")) {
windowItemModMask = DarwinParseModifierList(tem, FALSE);
}
}
}
- XQuartzEnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
- default:XQuartzEnableKeyEquivalents];
-
- darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP
- default:darwinSyncKeymap];
-
- darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH
- default:darwinDesiredDepth];
-
- noTestExtensions = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS
- default:FALSE];
-
- XQuartzScrollInDeviceDirection = [self prefs_get_boolean:@PREFS_SCROLL_IN_DEV_DIRECTION
- default:XQuartzScrollInDeviceDirection];
+XQuartzEnableKeyEquivalents =[self prefs_get_boolean: @PREFS_KEYEQUIVS default:
+XQuartzEnableKeyEquivalents];
+
+darwinSyncKeymap =[self prefs_get_boolean: @PREFS_SYNC_KEYMAP default:
+darwinSyncKeymap];
+
+darwinDesiredDepth =[self prefs_get_integer: @PREFS_DEPTH default:
+darwinDesiredDepth];
+
+noTestExtensions = ![self prefs_get_boolean: @PREFS_TEST_EXTENSIONS default:
+FALSE];
+
+XQuartzScrollInDeviceDirection =[self prefs_get_boolean: @PREFS_SCROLL_IN_DEV_DIRECTION default:
+XQuartzScrollInDeviceDirection];
#if XQUARTZ_SPARKLE
- NSURL *url = [self prefs_copy_url:@PREFS_UPDATE_FEED default:nil];
- if(url) {
- [[SUUpdater sharedUpdater] setFeedURL:url];
+NSURL *url =[self prefs_copy_url: @PREFS_UPDATE_FEED default:
+nil];
+
+ if (url) {
+ [[SUUpdater sharedUpdater] setFeedURL:url];
[url release];
}
#endif
}
/* This will end up at the end of the responder chain. */
-- (void) copy:sender {
- DarwinSendDDXEvent(kXquartzPasteboardNotify, 1,
- AppleWMCopyToPasteboard);
+ -(void) copy:sender {
+ DarwinSendDDXEvent(kXquartzPasteboardNotify, 1, AppleWMCopyToPasteboard);
}
-- (X11Controller *) controller {
+-(X11Controller *) controller {
return _controller;
}
-- (OSX_BOOL) x_active {
+-(OSX_BOOL) x_active {
return _x_active;
}
-@end
+@end static NSArray *
+array_with_strings_and_numbers(int nitems, const char **items,
+ const char *numbers)
+{
+ NSMutableArray *array, *subarray;
+ NSString *string, *number;
+ int i;
-static NSArray *
-array_with_strings_and_numbers (int nitems, const char **items,
- const char *numbers) {
- NSMutableArray *array, *subarray;
- NSString *string, *number;
- int i;
-
- /* (Can't autorelease on the X server thread) */
-
- array = [[NSMutableArray alloc] initWithCapacity:nitems];
-
- for (i = 0; i < nitems; i++) {
- subarray = [[NSMutableArray alloc] initWithCapacity:2];
-
- string = [[NSString alloc] initWithUTF8String:items[i]];
- [subarray addObject:string];
- [string release];
-
- if (numbers[i] != 0) {
- number = [[NSString alloc] initWithFormat:@"%d", numbers[i]];
- [subarray addObject:number];
- [number release];
- } else
- [subarray addObject:@""];
-
- [array addObject:subarray];
- [subarray release];
- }
-
- return array;
+ /* (Can't autorelease on the X server thread) */
+
+ array =[[NSMutableArray alloc] initWithCapacity:nitems];
+
+ for (i = 0; i < nitems; i++) {
+ subarray =[[NSMutableArray alloc] initWithCapacity:2];
+
+ string =[[NSString alloc] initWithUTF8String:items[i]];
+ [subarray addObject:string];
+ [string release];
+
+ if (numbers[i] != 0) {
+ number =[[NSString alloc] initWithFormat:@"%d", numbers[i]];
+ [subarray addObject:number];
+ [number release];
+ }
+ else
+ [subarray addObject:@""];
+
+ [array addObject:subarray];
+ [subarray release];
+ }
+
+ return array;
}
-void X11ApplicationSetWindowMenu (int nitems, const char **items,
- const char *shortcuts) {
- NSArray *array;
- array = array_with_strings_and_numbers (nitems, items, shortcuts);
-
- /* Send the array of strings over to the appkit thread */
-
- message_kit_thread (@selector (set_window_menu:), array);
- [array release];
+void
+X11ApplicationSetWindowMenu(int nitems, const char **items,
+ const char *shortcuts)
+{
+ NSArray *array;
+
+ array = array_with_strings_and_numbers(nitems, items, shortcuts);
+
+ /* Send the array of strings over to the appkit thread */
+
+ message_kit_thread(@selector(set_window_menu:), array);
+ [array release];
}
-void X11ApplicationSetWindowMenuCheck (int idx) {
- NSNumber *n;
-
- n = [[NSNumber alloc] initWithInt:idx];
-
- message_kit_thread (@selector (set_window_menu_check:), n);
-
- [n release];
+void
+X11ApplicationSetWindowMenuCheck(int idx)
+{
+ NSNumber *n;
+
+ n =[[NSNumber alloc] initWithInt:idx];
+
+ message_kit_thread(@selector(set_window_menu_check:), n);
+
+ [n release];
}
-void X11ApplicationSetFrontProcess (void) {
- message_kit_thread (@selector (set_front_process:), nil);
+void
+X11ApplicationSetFrontProcess(void)
+{
+ message_kit_thread(@selector(set_front_process:), nil);
}
-void X11ApplicationSetCanQuit (int state) {
+void
+X11ApplicationSetCanQuit(int state)
+{
NSNumber *n;
-
- n = [[NSNumber alloc] initWithBool:state];
-
- message_kit_thread (@selector (set_can_quit:), n);
-
+
+ n =[[NSNumber alloc] initWithBool:state];
+
+ message_kit_thread(@selector(set_can_quit:), n);
+
[n release];
}
-void X11ApplicationServerReady (void) {
- message_kit_thread (@selector (server_ready:), nil);
+void
+X11ApplicationServerReady(void)
+{
+ message_kit_thread(@selector(server_ready:), nil);
}
-void X11ApplicationShowHideMenubar (int state) {
+void
+X11ApplicationShowHideMenubar(int state)
+{
NSNumber *n;
-
- n = [[NSNumber alloc] initWithBool:state];
-
- message_kit_thread (@selector (show_hide_menubar:), n);
-
+
+ n =[[NSNumber alloc] initWithBool:state];
+
+ message_kit_thread(@selector(show_hide_menubar:), n);
+
[n release];
}
-void X11ApplicationLaunchClient (const char *cmd) {
+void
+X11ApplicationLaunchClient(const char *cmd)
+{
NSString *string;
-
- string = [[NSString alloc] initWithUTF8String:cmd];
-
- message_kit_thread (@selector (launch_client:), string);
-
+
+ string =[[NSString alloc] initWithUTF8String:cmd];
+
+ message_kit_thread(@selector(launch_client:), string);
+
[string release];
}
@@ -915,112 +1028,135 @@ void X11ApplicationLaunchClient (const char *cmd) {
* not the AppKit thread. We want to block entering a screen-capturing RandR
* mode until we notify the user about how to get out if the X11 client crashes.
*/
-Bool X11ApplicationCanEnterRandR(void) {
+Bool
+X11ApplicationCanEnterRandR(void)
+{
NSString *title, *msg;
-
- if([X11App prefs_get_boolean:@PREFS_NO_RANDR_ALERT default:NO] || XQuartzShieldingWindowLevel != 0)
+
+if ([X11App prefs_get_boolean: @PREFS_NO_RANDR_ALERT default:
+NO] || XQuartzShieldingWindowLevel != 0)
return TRUE;
-
- title = NSLocalizedString(@"Enter RandR mode?", @"Dialog title when switching to RandR");
- msg = NSLocalizedString(@"An application has requested X11 to change the resolution of your display. X11 will restore the display to its previous state when the requesting application requests to return to the previous state. Alternatively, you can use the ⌥⌘A key sequence to force X11 to return to the previous state.",
- @"Dialog when switching to RandR");
- if(!XQuartzIsRootless)
+ title =
+ NSLocalizedString(@"Enter RandR mode?",
+ @"Dialog title when switching to RandR");
+ msg =
+ NSLocalizedString
+ (@"An application has requested X11 to change the resolution of your display. X11 will restore the display to its previous state when the requesting application requests to return to the previous state. Alternatively, you can use the ⌥⌘A key sequence to force X11 to return to the previous state.",
+ @"Dialog when switching to RandR");
+
+ if (!XQuartzIsRootless)
QuartzShowFullscreen(FALSE);
-
- switch(NSRunAlertPanel(title, msg, NSLocalizedString(@"Allow", @""), NSLocalizedString (@"Cancel", @""), NSLocalizedString (@"Always Allow", @""))) {
- case NSAlertOtherReturn:
- [X11App prefs_set_boolean:@PREFS_NO_RANDR_ALERT value:YES];
- [X11App prefs_synchronize];
- case NSAlertDefaultReturn:
- return YES;
- default:
- return NO;
+ switch (NSRunAlertPanel
+ (title, msg, NSLocalizedString(@"Allow", @""),
+ NSLocalizedString(@"Cancel", @""),
+ NSLocalizedString(@"Always Allow", @""))) {
+ case NSAlertOtherReturn:
+ [X11App prefs_set_boolean: @PREFS_NO_RANDR_ALERT value:YES];
+ [X11App prefs_synchronize];
+ case NSAlertDefaultReturn:
+ return YES;
+
+ default:
+ return NO;
}
}
-static void check_xinitrc (void) {
+static void
+check_xinitrc(void)
+{
char *tem, buf[1024];
NSString *msg;
-
- if ([X11App prefs_get_boolean:@PREFS_DONE_XINIT_CHECK default:NO])
- return;
-
- tem = getenv ("HOME");
- if (tem == NULL) goto done;
-
- snprintf (buf, sizeof (buf), "%s/.xinitrc", tem);
- if (access (buf, F_OK) != 0)
- goto done;
-
- msg = NSLocalizedString (@"You have an existing ~/.xinitrc file.\n\n\
+
+if ([X11App prefs_get_boolean: @PREFS_DONE_XINIT_CHECK default:
+NO])
+ return;
+
+ tem = getenv("HOME");
+ if (tem == NULL)
+ goto done;
+
+ snprintf(buf, sizeof(buf), "%s/.xinitrc", tem);
+ if (access(buf, F_OK) != 0)
+ goto done;
+
+ msg = NSLocalizedString(@"You have an existing ~/.xinitrc file.\n\n\
Windows displayed by X11 applications may not have titlebars, or may look \
different to windows displayed by native applications.\n\n\
Would you like to move aside the existing file and use the standard X11 \
environment the next time you start X11?", @"Startup xinitrc dialog");
- if(NSAlertDefaultReturn == NSRunAlertPanel (nil, msg, NSLocalizedString (@"Yes", @""),
- NSLocalizedString (@"No", @""), nil)) {
+ if (NSAlertDefaultReturn ==
+ NSRunAlertPanel(nil, msg, NSLocalizedString(@"Yes", @""),
+ NSLocalizedString(@"No", @""), nil)) {
char buf2[1024];
int i = -1;
-
- snprintf (buf2, sizeof (buf2), "%s.old", buf);
-
- for(i = 1; access (buf2, F_OK) == 0; i++)
- snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i);
- rename (buf, buf2);
+ snprintf(buf2, sizeof(buf2), "%s.old", buf);
+
+ for (i = 1; access(buf2, F_OK) == 0; i++)
+ snprintf(buf2, sizeof(buf2), "%s.old.%d", buf, i);
+
+ rename(buf, buf2);
}
-
+
done:
- [X11App prefs_set_boolean:@PREFS_DONE_XINIT_CHECK value:YES];
+ [X11App prefs_set_boolean: @PREFS_DONE_XINIT_CHECK value:YES];
[X11App prefs_synchronize];
}
-static inline pthread_t create_thread(void *(*func)(void *), void *arg) {
+static inline pthread_t
+create_thread(void *(*func) (void *), void *arg)
+{
pthread_attr_t attr;
pthread_t tid;
-
+
pthread_attr_init(&attr);
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_create(&tid, &attr, func, arg);
pthread_attr_destroy(&attr);
-
+
return tid;
}
-static void *xpbproxy_x_thread(void *args) {
+static void *
+xpbproxy_x_thread(void *args)
+{
xpbproxy_run();
ErrorF("xpbproxy thread is terminating unexpectedly.\n");
return NULL;
}
-void X11ApplicationMain (int argc, char **argv, char **envp) {
+void
+X11ApplicationMain(int argc, char **argv, char **envp)
+{
NSAutoreleasePool *pool;
#ifdef DEBUG
- while (access ("/tmp/x11-block", F_OK) == 0) sleep (1);
+ while (access("/tmp/x11-block", F_OK) == 0)
+ sleep(1);
#endif
-
- pool = [[NSAutoreleasePool alloc] init];
- X11App = (X11Application *) [X11Application sharedApplication];
- init_ports ();
-
- app_prefs_domain_cfstr = (CFStringRef)[[NSBundle mainBundle] bundleIdentifier];
+
+ pool =[[NSAutoreleasePool alloc] init];
+ X11App = (X11Application *)[X11Application sharedApplication];
+ init_ports();
+
+ app_prefs_domain_cfstr =
+ (CFStringRef)[[NSBundle mainBundle] bundleIdentifier];
if (app_prefs_domain_cfstr == NULL) {
- ErrorF("X11ApplicationMain: Unable to determine bundle identifier. Your installation of XQuartz may be broken.\n");
- app_prefs_domain_cfstr = CFSTR(BUNDLE_ID_PREFIX".X11");
+ ErrorF
+ ("X11ApplicationMain: Unable to determine bundle identifier. Your installation of XQuartz may be broken.\n");
+ app_prefs_domain_cfstr = CFSTR(BUNDLE_ID_PREFIX ".X11");
}
[NSApp read_defaults];
- [NSBundle loadNibNamed:@"main" owner:NSApp];
- [[NSNotificationCenter defaultCenter] addObserver:NSApp
- selector:@selector (became_key:)
- name:NSWindowDidBecomeKeyNotification object:nil];
+ [NSBundle loadNibNamed: @"main" owner:NSApp];
+ [[NSNotificationCenter defaultCenter] addObserver: NSApp selector: @selector(became_key:)
+ name: NSWindowDidBecomeKeyNotification object:nil];
/*
* The xpr Quartz mode is statically linked into this server.
@@ -1030,23 +1166,27 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
/* Calculate the height of the menubar so we can avoid it. */
aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) -
- NSMaxY([[NSScreen mainScreen] visibleFrame]);
+ NSMaxY([[NSScreen mainScreen] visibleFrame]);
#ifdef HAVE_LIBDISPATCH
- eventTranslationQueue = dispatch_queue_create(BUNDLE_ID_PREFIX".X11.NSEventsToX11EventsQueue", NULL);
+ eventTranslationQueue =
+ dispatch_queue_create(BUNDLE_ID_PREFIX ".X11.NSEventsToX11EventsQueue",
+ NULL);
assert(eventTranslationQueue != NULL);
#endif
-
+
/* Set the key layout seed before we start the server */
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- last_key_layout = TISCopyCurrentKeyboardLayoutInputSource();
+ last_key_layout = TISCopyCurrentKeyboardLayoutInputSource();
- if(!last_key_layout)
- ErrorF("X11ApplicationMain: Unable to determine TISCopyCurrentKeyboardLayoutInputSource() at startup.\n");
+ if (!last_key_layout)
+ ErrorF
+ ("X11ApplicationMain: Unable to determine TISCopyCurrentKeyboardLayoutInputSource() at startup.\n");
#else
KLGetCurrentKeyboardLayout(&last_key_layout);
- if(!last_key_layout)
- ErrorF("X11ApplicationMain: Unable to determine KLGetCurrentKeyboardLayout() at startup.\n");
+ if (!last_key_layout)
+ ErrorF
+ ("X11ApplicationMain: Unable to determine KLGetCurrentKeyboardLayout() at startup.\n");
#endif
if (!QuartsResyncKeymap(FALSE)) {
@@ -1055,12 +1195,12 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
/* Tell the server thread that it can proceed */
QuartzInitServer(argc, argv, envp);
-
+
/* This must be done after QuartzInitServer because it can result in
* an mieqEnqueue() - <rdar://problem/6300249>
*/
check_xinitrc();
-
+
create_thread(xpbproxy_x_thread, NULL);
#if XQUARTZ_SPARKLE
@@ -1074,149 +1214,177 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
/* not reached */
}
-@implementation X11Application (Private)
-
+@implementation X11Application(Private)
#ifdef NX_DEVICELCMDKEYMASK
/* This is to workaround a bug in the VNC server where we sometimes see the L
* modifier and sometimes see no "side"
*/
-static inline int ensure_flag(int flags, int device_independent, int device_dependents, int device_dependent_default) {
- if( (flags & device_independent) &&
- !(flags & device_dependents))
+static inline int
+ensure_flag(int flags, int device_independent, int device_dependents,
+ int device_dependent_default)
+{
+ if ((flags & device_independent) && !(flags & device_dependents))
flags |= device_dependent_default;
return flags;
}
#endif
#ifdef DEBUG_UNTRUSTED_POINTER_DELTA
-static const char *untrusted_str(NSEvent *e) {
- switch([e type]) {
- case NSScrollWheel:
- return "NSScrollWheel";
- case NSTabletPoint:
- return "NSTabletPoint";
- case NSOtherMouseDown:
- return "NSOtherMouseDown";
- case NSOtherMouseUp:
- return "NSOtherMouseUp";
- case NSLeftMouseDown:
- return "NSLeftMouseDown";
- case NSLeftMouseUp:
- return "NSLeftMouseUp";
+static const char *
+untrusted_str(NSEvent * e)
+{
+ switch ([e type]) {
+ case NSScrollWheel:
+ return "NSScrollWheel";
+ case NSTabletPoint:
+ return "NSTabletPoint";
+ case NSOtherMouseDown:
+ return "NSOtherMouseDown";
+ case NSOtherMouseUp:
+ return "NSOtherMouseUp";
+ case NSLeftMouseDown:
+ return "NSLeftMouseDown";
+ case NSLeftMouseUp:
+ return "NSLeftMouseUp";
+ default:
+ switch ([e subtype]) {
+ case NSTabletPointEventSubtype:
+ return "NSTabletPointEventSubtype";
+ case NSTabletProximityEventSubtype:
+ return "NSTabletProximityEventSubtype";
default:
- switch([e subtype]) {
- case NSTabletPointEventSubtype:
- return "NSTabletPointEventSubtype";
- case NSTabletProximityEventSubtype:
- return "NSTabletProximityEventSubtype";
- default:
- return "Other";
- }
+ return "Other";
+ }
}
}
#endif
-- (void) sendX11NSEvent:(NSEvent *)e {
+ -(void) sendX11NSEvent:(NSEvent *) e {
NSPoint location = NSZeroPoint;
int ev_button, ev_type;
- static float pressure = 0.0; // static so ProximityOut will have the value from the previous tablet event
- static NSPoint tilt; // static so ProximityOut will have the value from the previous tablet event
+ static float pressure = 0.0; // static so ProximityOut will have the value from the previous tablet event
+ static NSPoint tilt; // static so ProximityOut will have the value from the previous tablet event
static DeviceIntPtr darwinTabletCurrent = NULL;
- static BOOL needsProximityIn = NO; // Do we do need to handle a pending ProximityIn once we have pressure/tilt?
+ static BOOL needsProximityIn = NO; // Do we do need to handle a pending ProximityIn once we have pressure/tilt?
DeviceIntPtr pDev;
int modifierFlags;
BOOL isMouseOrTabletEvent, isTabletEvent;
#ifdef HAVE_LIBDISPATCH
static dispatch_once_t once_pred;
- dispatch_once(&once_pred, ^{
- tilt = NSZeroPoint;
- darwinTabletCurrent = darwinTabletStylus;
- });
+
+ dispatch_once(&once_pred, ^ {
+ tilt = NSZeroPoint;
+ darwinTabletCurrent = darwinTabletStylus;});
#else
- if(!darwinTabletCurrent) {
+ if (!darwinTabletCurrent) {
tilt = NSZeroPoint;
darwinTabletCurrent = darwinTabletStylus;
}
#endif
-
- isMouseOrTabletEvent = [e type] == NSLeftMouseDown || [e type] == NSOtherMouseDown || [e type] == NSRightMouseDown ||
- [e type] == NSLeftMouseUp || [e type] == NSOtherMouseUp || [e type] == NSRightMouseUp ||
- [e type] == NSLeftMouseDragged || [e type] == NSOtherMouseDragged || [e type] == NSRightMouseDragged ||
- [e type] == NSMouseMoved || [e type] == NSTabletPoint || [e type] == NSScrollWheel;
+
+ isMouseOrTabletEvent =[e type] == NSLeftMouseDown ||
+ [e type] == NSOtherMouseDown ||[e type] == NSRightMouseDown ||
+ [e type] == NSLeftMouseUp ||[e type] == NSOtherMouseUp ||
+ [e type] == NSRightMouseUp ||[e type] == NSLeftMouseDragged ||
+ [e type] == NSOtherMouseDragged ||[e type] == NSRightMouseDragged ||
+ [e type] == NSMouseMoved ||[e type] == NSTabletPoint ||
+ [e type] == NSScrollWheel;
isTabletEvent = ([e type] == NSTabletPoint) ||
- (isMouseOrTabletEvent && ([e subtype] == NSTabletPointEventSubtype || [e subtype] == NSTabletProximityEventSubtype));
+ (isMouseOrTabletEvent &&
+ ([e subtype] == NSTabletPointEventSubtype ||
+ [e subtype] == NSTabletProximityEventSubtype));
- if(isMouseOrTabletEvent) {
+ if (isMouseOrTabletEvent) {
static NSPoint lastpt;
- NSWindow *window = [e window];
- NSRect screen = [[[NSScreen screens] objectAtIndex:0] frame];
- BOOL hasUntrustedPointerDelta;
-
+ NSWindow *window =[e window];
+ NSRect screen =[[[NSScreen screens] objectAtIndex:0] frame];
+ BOOL hasUntrustedPointerDelta;
+
// NSEvents for tablets are not consistent wrt deltaXY between events, so we cannot rely on that
// Thus tablets will be subject to the warp-pointer bug worked around by the delta, but tablets
// are not normally used in cases where that bug would present itself, so this is a fair tradeoff
// <rdar://problem/7111003> deltaX and deltaY are incorrect for NSMouseMoved, NSTabletPointEventSubtype
// http://xquartz.macosforge.org/trac/ticket/288
hasUntrustedPointerDelta = isTabletEvent;
-
+
// The deltaXY for middle click events also appear erroneous after fast user switching
// <rdar://problem/7979468> deltaX and deltaY are incorrect for NSOtherMouseDown and NSOtherMouseUp after FUS
// http://xquartz.macosforge.org/trac/ticket/389
- hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == NSOtherMouseDown || [e type] == NSOtherMouseUp;
+ hasUntrustedPointerDelta = hasUntrustedPointerDelta ||
+ [e type] == NSOtherMouseDown ||[e type] == NSOtherMouseUp;
// The deltaXY for scroll events correspond to the scroll delta, not the pointer delta
// <rdar://problem/7989690> deltaXY for wheel events are being sent as mouse movement
- hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == NSScrollWheel;
+ hasUntrustedPointerDelta = hasUntrustedPointerDelta ||
+ [e type] == NSScrollWheel;
#ifdef DEBUG_UNTRUSTED_POINTER_DELTA
- hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == NSLeftMouseDown || [e type] == NSLeftMouseUp;
+ hasUntrustedPointerDelta = hasUntrustedPointerDelta ||
+ [e type] == NSLeftMouseDown ||[e type] == NSLeftMouseUp;
#endif
-
- if (window != nil) {
- NSRect frame = [window frame];
- location = [e locationInWindow];
+
+ if (window != nil) {
+ NSRect frame =[window frame];
+
+ location =[e locationInWindow];
location.x += frame.origin.x;
location.y += frame.origin.y;
lastpt = location;
- } else if(hasUntrustedPointerDelta) {
+ }
+ else if (hasUntrustedPointerDelta) {
#ifdef DEBUG_UNTRUSTED_POINTER_DELTA
ErrorF("--- Begin Event Debug ---\n");
ErrorF("Event type: %s\n", untrusted_str(e));
ErrorF("old lastpt: (%0.2f, %0.2f)\n", lastpt.x, lastpt.y);
- ErrorF(" delta: (%0.2f, %0.2f)\n", [e deltaX], -[e deltaY]);
- ErrorF(" location: (%0.2f, %0.2f)\n", lastpt.x + [e deltaX], lastpt.y - [e deltaY]);
- ErrorF("workaround: (%0.2f, %0.2f)\n", [e locationInWindow].x, [e locationInWindow].y);
+ ErrorF(" delta: (%0.2f, %0.2f)\n",[e deltaX], -[e deltaY]);
+ ErrorF(" location: (%0.2f, %0.2f)\n", lastpt.x +[e deltaX],
+ lastpt.y -[e deltaY]);
+ ErrorF("workaround: (%0.2f, %0.2f)\n",[e locationInWindow].x,
+ [e locationInWindow].y);
ErrorF("--- End Event Debug ---\n");
- location.x = lastpt.x + [e deltaX];
- location.y = lastpt.y - [e deltaY];
- lastpt = [e locationInWindow];
+ location.x = lastpt.x +[e deltaX];
+ location.y = lastpt.y -[e deltaY];
+ lastpt =[e locationInWindow];
#else
- location = [e locationInWindow];
+ location =[e locationInWindow];
lastpt = location;
#endif
- } else {
- location.x = lastpt.x + [e deltaX];
- location.y = lastpt.y - [e deltaY];
- lastpt = [e locationInWindow];
}
-
+ else {
+ location.x = lastpt.x +[e deltaX];
+ location.y = lastpt.y -[e deltaY];
+ lastpt =[e locationInWindow];
+ }
+
/* Convert coordinate system */
location.y = (screen.origin.y + screen.size.height) - location.y;
}
-
- modifierFlags = [e modifierFlags];
-
+
+ modifierFlags =[e modifierFlags];
+
#ifdef NX_DEVICELCMDKEYMASK
/* This is to workaround a bug in the VNC server where we sometimes see the L
* modifier and sometimes see no "side"
*/
- modifierFlags = ensure_flag(modifierFlags, NX_CONTROLMASK, NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK, NX_DEVICELCTLKEYMASK);
- modifierFlags = ensure_flag(modifierFlags, NX_SHIFTMASK, NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK, NX_DEVICELSHIFTKEYMASK);
- modifierFlags = ensure_flag(modifierFlags, NX_COMMANDMASK, NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK, NX_DEVICELCMDKEYMASK);
- modifierFlags = ensure_flag(modifierFlags, NX_ALTERNATEMASK, NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK, NX_DEVICELALTKEYMASK);
+ modifierFlags =
+ ensure_flag(modifierFlags, NX_CONTROLMASK,
+ NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK,
+ NX_DEVICELCTLKEYMASK);
+ modifierFlags =
+ ensure_flag(modifierFlags, NX_SHIFTMASK,
+ NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK,
+ NX_DEVICELSHIFTKEYMASK);
+ modifierFlags =
+ ensure_flag(modifierFlags, NX_COMMANDMASK,
+ NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK,
+ NX_DEVICELCMDKEYMASK);
+ modifierFlags =
+ ensure_flag(modifierFlags, NX_ALTERNATEMASK,
+ NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK,
+ NX_DEVICELALTKEYMASK);
#endif
modifierFlags &= darwin_all_modifier_mask;
@@ -1225,192 +1393,236 @@ static const char *untrusted_str(NSEvent *e) {
* emulation mucks this up, so we need to check our modifier flag state
* on every event... ugg
*/
-
- if(darwin_all_modifier_flags != modifierFlags)
+
+ if (darwin_all_modifier_flags != modifierFlags)
DarwinUpdateModKeys(modifierFlags);
-
- switch ([e type]) {
- case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
- case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse;
- case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse;
- case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse;
- case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse;
- case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse;
- case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse;
- case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse;
- case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse;
- case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
- case NSTabletPoint: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
-
- handle_mouse:
- pDev = darwinPointer;
-
- /* NSTabletPoint can have no subtype */
- if([e type] != NSTabletPoint &&
- [e subtype] == NSTabletProximityEventSubtype) {
- switch([e pointingDeviceType]) {
- case NSEraserPointingDevice:
- darwinTabletCurrent=darwinTabletEraser;
- break;
- case NSPenPointingDevice:
- darwinTabletCurrent=darwinTabletStylus;
- break;
- case NSCursorPointingDevice:
- case NSUnknownPointingDevice:
- default:
- darwinTabletCurrent=darwinTabletCursor;
- break;
- }
- if([e isEnteringProximity])
- needsProximityIn = YES;
- else
- DarwinSendProximityEvents(darwinTabletCurrent, ProximityOut,
- location.x, location.y, pressure,
- tilt.x, tilt.y);
- return;
+ switch ([e type]) {
+ case NSLeftMouseDown:
+ ev_button = 1;
+ ev_type = ButtonPress;
+ goto handle_mouse;
+ case NSOtherMouseDown:
+ ev_button = 2;
+ ev_type = ButtonPress;
+ goto handle_mouse;
+ case NSRightMouseDown:
+ ev_button = 3;
+ ev_type = ButtonPress;
+ goto handle_mouse;
+ case NSLeftMouseUp:
+ ev_button = 1;
+ ev_type = ButtonRelease;
+ goto handle_mouse;
+ case NSOtherMouseUp:
+ ev_button = 2;
+ ev_type = ButtonRelease;
+ goto handle_mouse;
+ case NSRightMouseUp:
+ ev_button = 3;
+ ev_type = ButtonRelease;
+ goto handle_mouse;
+ case NSLeftMouseDragged:
+ ev_button = 1;
+ ev_type = MotionNotify;
+ goto handle_mouse;
+ case NSOtherMouseDragged:
+ ev_button = 2;
+ ev_type = MotionNotify;
+ goto handle_mouse;
+ case NSRightMouseDragged:
+ ev_button = 3;
+ ev_type = MotionNotify;
+ goto handle_mouse;
+ case NSMouseMoved:
+ ev_button = 0;
+ ev_type = MotionNotify;
+ goto handle_mouse;
+ case NSTabletPoint:
+ ev_button = 0;
+ ev_type = MotionNotify;
+ goto handle_mouse;
+
+ handle_mouse:
+ pDev = darwinPointer;
+
+ /* NSTabletPoint can have no subtype */
+ if ([e type] != NSTabletPoint &&
+ [e subtype] == NSTabletProximityEventSubtype) {
+ switch ([e pointingDeviceType]) {
+ case NSEraserPointingDevice:
+ darwinTabletCurrent = darwinTabletEraser;
+ break;
+ case NSPenPointingDevice:
+ darwinTabletCurrent = darwinTabletStylus;
+ break;
+ case NSCursorPointingDevice:
+ case NSUnknownPointingDevice:
+ default:
+ darwinTabletCurrent = darwinTabletCursor;
+ break;
}
- if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
- pressure = [e pressure];
- tilt = [e tilt];
-
- pDev = darwinTabletCurrent;
-
- if(needsProximityIn) {
- DarwinSendProximityEvents(darwinTabletCurrent, ProximityIn,
- location.x, location.y, pressure,
- tilt.x, tilt.y);
-
- needsProximityIn = NO;
- }
+ if ([e isEnteringProximity])
+ needsProximityIn = YES;
+ else
+ DarwinSendProximityEvents(darwinTabletCurrent, ProximityOut,
+ location.x, location.y, pressure,
+ tilt.x, tilt.y);
+ return;
+ }
+
+ if ([e type] == NSTabletPoint ||
+ [e subtype] == NSTabletPointEventSubtype) {
+ pressure =[e pressure];
+ tilt =[e tilt];
+
+ pDev = darwinTabletCurrent;
+
+ if (needsProximityIn) {
+ DarwinSendProximityEvents(darwinTabletCurrent, ProximityIn,
+ location.x, location.y, pressure,
+ tilt.x, tilt.y);
+
+ needsProximityIn = NO;
}
+ }
- if(!XQuartzServerVisible && noTestExtensions) {
+ if (!XQuartzServerVisible && noTestExtensions) {
#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
/* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, so we can't call xp_find_window from the Appkit thread */
- xp_window_id wid = 0;
- xp_error err;
+ xp_window_id wid = 0;
+ xp_error err;
- /* Sigh. Need to check that we're really over one of
- * our windows. (We need to receive pointer events while
- * not in the foreground, but we don't want to receive them
- * when another window is over us or we might show a tooltip)
- */
+ /* Sigh. Need to check that we're really over one of
+ * our windows. (We need to receive pointer events while
+ * not in the foreground, but we don't want to receive them
+ * when another window is over us or we might show a tooltip)
+ */
- err = xp_find_window(location.x, location.y, 0, &wid);
+ err = xp_find_window(location.x, location.y, 0, &wid);
- if (err != XP_Success || (err == XP_Success && wid == 0))
+ if (err != XP_Success || (err == XP_Success && wid == 0))
#endif
- {
- bgMouseLocation = location;
- bgMouseLocationUpdated = TRUE;
- return;
- }
+ {
+ bgMouseLocation = location;
+ bgMouseLocationUpdated = TRUE;
+ return;
}
-
- if(bgMouseLocationUpdated) {
- if(!(ev_type == MotionNotify && ev_button == 0)) {
- DarwinSendPointerEvents(pDev, MotionNotify, 0, location.x,
- location.y, pressure, tilt.x, tilt.y);
- }
- bgMouseLocationUpdated = FALSE;
+ }
+
+ if (bgMouseLocationUpdated) {
+ if (!(ev_type == MotionNotify && ev_button == 0)) {
+ DarwinSendPointerEvents(pDev, MotionNotify, 0, location.x,
+ location.y, pressure, tilt.x, tilt.y);
}
+ bgMouseLocationUpdated = FALSE;
+ }
- DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x, location.y,
- pressure, tilt.x, tilt.y);
-
+ DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x,
+ location.y, pressure, tilt.x, tilt.y);
+
+ break;
+
+ case NSTabletProximity:
+ switch ([e pointingDeviceType]) {
+ case NSEraserPointingDevice:
+ darwinTabletCurrent = darwinTabletEraser;
break;
-
- case NSTabletProximity:
- switch([e pointingDeviceType]) {
- case NSEraserPointingDevice:
- darwinTabletCurrent=darwinTabletEraser;
- break;
- case NSPenPointingDevice:
- darwinTabletCurrent=darwinTabletStylus;
- break;
- case NSCursorPointingDevice:
- case NSUnknownPointingDevice:
- default:
- darwinTabletCurrent=darwinTabletCursor;
- break;
- }
-
- if([e isEnteringProximity])
- needsProximityIn = YES;
- else
- DarwinSendProximityEvents(darwinTabletCurrent, ProximityOut,
- location.x, location.y, pressure,
- tilt.x, tilt.y);
+ case NSPenPointingDevice:
+ darwinTabletCurrent = darwinTabletStylus;
break;
-
- case NSScrollWheel:
- {
- float deltaX = [e deltaX];
- float deltaY = [e deltaY];
+ case NSCursorPointingDevice:
+ case NSUnknownPointingDevice:
+ default:
+ darwinTabletCurrent = darwinTabletCursor;
+ break;
+ }
+
+ if ([e isEnteringProximity])
+ needsProximityIn = YES;
+ else
+ DarwinSendProximityEvents(darwinTabletCurrent, ProximityOut,
+ location.x, location.y, pressure,
+ tilt.x, tilt.y);
+ break;
+
+ case NSScrollWheel:
+ {
+ float deltaX =[e deltaX];
+ float deltaY =[e deltaY];
+
#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0
- /* If we're in the background, we need to send a MotionNotify event
- * first, since we aren't getting them on background mouse motion
- */
- if(!XQuartzServerVisible && noTestExtensions) {
- bgMouseLocationUpdated = FALSE;
- DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x,
- location.y, pressure, tilt.x, tilt.y);
- }
+ /* If we're in the background, we need to send a MotionNotify event
+ * first, since we aren't getting them on background mouse motion
+ */
+ if (!XQuartzServerVisible && noTestExtensions) {
+ bgMouseLocationUpdated = FALSE;
+ DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x,
+ location.y, pressure, tilt.x, tilt.y);
+ }
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- // TODO: Change 1117 to NSAppKitVersionNumber10_7 when it is defined
- if(NSAppKitVersionNumber >= 1117 && XQuartzScrollInDeviceDirection && [e isDirectionInvertedFromDevice]) {
- deltaX *= -1;
- deltaY *= -1;
- }
+ // TODO: Change 1117 to NSAppKitVersionNumber10_7 when it is defined
+ if (NSAppKitVersionNumber >= 1117 && XQuartzScrollInDeviceDirection &&
+ [e isDirectionInvertedFromDevice]) {
+ deltaX *= -1;
+ deltaY *= -1;
+ }
#endif
- DarwinSendScrollEvents(deltaX, deltaY, location.x, location.y,
- pressure, tilt.x, tilt.y);
- break;
- }
- case NSKeyDown: case NSKeyUp:
- {
- /* XKB clobbers our keymap at startup, so we need to force it on the first keypress.
- * TODO: Make this less of a kludge.
- */
- static int force_resync_keymap = YES;
- if(force_resync_keymap) {
- DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
- force_resync_keymap = NO;
- }
- }
+ DarwinSendScrollEvents(deltaX, deltaY, location.x, location.y,
+ pressure, tilt.x, tilt.y);
+ break;
+ }
+ case NSKeyDown:
+ case NSKeyUp:
+ {
+ /* XKB clobbers our keymap at startup, so we need to force it on the first keypress.
+ * TODO: Make this less of a kludge.
+ */
+ static int force_resync_keymap = YES;
+
+ if (force_resync_keymap) {
+ DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
+ force_resync_keymap = NO;
+ }
+ }
- if(darwinSyncKeymap) {
+ if (darwinSyncKeymap) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- TISInputSourceRef key_layout = TISCopyCurrentKeyboardLayoutInputSource();
- TISInputSourceRef clear;
- if (CFEqual(key_layout, last_key_layout)) {
- CFRelease(key_layout);
- } else {
- /* Swap/free thread-safely */
- clear = last_key_layout;
- last_key_layout = key_layout;
- CFRelease(clear);
+ TISInputSourceRef key_layout =
+ TISCopyCurrentKeyboardLayoutInputSource();
+ TISInputSourceRef clear;
+
+ if (CFEqual(key_layout, last_key_layout)) {
+ CFRelease(key_layout);
+ }
+ else {
+ /* Swap/free thread-safely */
+ clear = last_key_layout;
+ last_key_layout = key_layout;
+ CFRelease(clear);
#else
- KeyboardLayoutRef key_layout;
- KLGetCurrentKeyboardLayout(&key_layout);
- if(key_layout != last_key_layout) {
- last_key_layout = key_layout;
+ KeyboardLayoutRef key_layout;
+
+ KLGetCurrentKeyboardLayout(&key_layout);
+ if (key_layout != last_key_layout) {
+ last_key_layout = key_layout;
#endif
- /* Update keyInfo */
- if (!QuartsResyncKeymap(TRUE)) {
- ErrorF("sendX11NSEvent: Could not build a valid keymap.\n");
- }
+ /* Update keyInfo */
+ if (!QuartsResyncKeymap(TRUE)) {
+ ErrorF("sendX11NSEvent: Could not build a valid keymap.\n");
}
}
+ }
- ev_type = ([e type] == NSKeyDown) ? KeyPress : KeyRelease;
- DarwinSendKeyboardEvents(ev_type, [e keyCode]);
- break;
-
- default: break; /* for gcc */
- }
+ ev_type = ([e type] == NSKeyDown) ? KeyPress : KeyRelease;
+ DarwinSendKeyboardEvents(ev_type,[e keyCode]);
+ break;
+
+ default:
+ break; /* for gcc */
+ }
}
+
@end
diff --git a/xorg-server/hw/xquartz/X11Controller.h b/xorg-server/hw/xquartz/X11Controller.h
index b9b1d4473..e7fcd453f 100644
--- a/xorg-server/hw/xquartz/X11Controller.h
+++ b/xorg-server/hw/xquartz/X11Controller.h
@@ -55,9 +55,9 @@ typedef unsigned int NSUInteger;
#endif
#endif
-@interface X11Controller : NSObject
+ @interface X11Controller:NSObject
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
-<NSTableViewDataSource>
+ < NSTableViewDataSource >
#endif
{
IBOutlet NSPanel *prefs_panel;
@@ -85,6 +85,7 @@ typedef unsigned int NSUInteger;
IBOutlet NSPopUpButton *depth;
IBOutlet NSMenuItem *window_separator;
+
// window_separator is DEPRECATED due to this radar:
// <rdar://problem/7088335> NSApplication releases the separator in the Windows menu even though it's an IBOutlet
// It is kept around for localization compatability and is subject to removal "eventually"
@@ -94,6 +95,7 @@ typedef unsigned int NSUInteger;
IBOutlet NSMenuItem *dock_window_separator;
IBOutlet NSMenuItem *apps_separator;
IBOutlet NSMenuItem *toggle_fullscreen_item;
+
#ifdef XQUARTZ_SPARKLE
NSMenuItem *check_for_updates_item; // Programatically enabled
#endif
@@ -105,7 +107,7 @@ typedef unsigned int NSUInteger;
NSMutableArray *table_apps;
IBOutlet NSMenu *dock_menu;
-
+
// This is where in the Windows menu we'll start (this will be the index of the separator)
NSInteger windows_menu_start;
@@ -116,39 +118,40 @@ typedef unsigned int NSUInteger;
OSX_BOOL can_quit;
}
-- (void) set_window_menu:(NSArray *)list;
-- (void) set_window_menu_check:(NSNumber *)n;
-- (void) set_apps_menu:(NSArray *)list;
+ -(void) set_window_menu:(NSArray *) list;
+ -(void) set_window_menu_check:(NSNumber *) n;
+ -(void) set_apps_menu:(NSArray *) list;
#ifdef XQUARTZ_SPARKLE
-- (void) setup_sparkle;
-- (void) updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update;
+-(void) setup_sparkle;
+ -(void) updater:(SUUpdater *)
+updater willInstallUpdate:(SUAppcastItem *) update;
#endif
-- (void) set_can_quit:(OSX_BOOL)state;
-- (void) server_ready;
-- (OSX_BOOL) application:(NSApplication *)app openFile:(NSString *)filename;
-
-- (IBAction) apps_table_show:(id)sender;
-- (IBAction) apps_table_done:(id)sender;
-- (IBAction) apps_table_new:(id)sender;
-- (IBAction) apps_table_duplicate:(id)sender;
-- (IBAction) apps_table_delete:(id)sender;
-- (IBAction) bring_to_front:(id)sender;
-- (IBAction) close_window:(id)sender;
-- (IBAction) minimize_window:(id)sender;
-- (IBAction) zoom_window:(id)sender;
-- (IBAction) next_window:(id)sender;
-- (IBAction) previous_window:(id)sender;
-- (IBAction) enable_fullscreen_changed:(id)sender;
-- (IBAction) toggle_fullscreen:(id)sender;
-- (IBAction) prefs_changed:(id)sender;
-- (IBAction) prefs_show:(id)sender;
-- (IBAction) quit:(id)sender;
-- (IBAction) x11_help:(id)sender;
+ -(void) set_can_quit:(OSX_BOOL) state;
+-(void) server_ready;
+ -(OSX_BOOL) application:(NSApplication *)
+app openFile:(NSString *) filename;
+
+ -(IBAction) apps_table_show:(id) sender;
+ -(IBAction) apps_table_done:(id) sender;
+ -(IBAction) apps_table_new:(id) sender;
+ -(IBAction) apps_table_duplicate:(id) sender;
+ -(IBAction) apps_table_delete:(id) sender;
+ -(IBAction) bring_to_front:(id) sender;
+ -(IBAction) close_window:(id) sender;
+ -(IBAction) minimize_window:(id) sender;
+ -(IBAction) zoom_window:(id) sender;
+ -(IBAction) next_window:(id) sender;
+ -(IBAction) previous_window:(id) sender;
+ -(IBAction) enable_fullscreen_changed:(id) sender;
+ -(IBAction) toggle_fullscreen:(id) sender;
+ -(IBAction) prefs_changed:(id) sender;
+ -(IBAction) prefs_show:(id) sender;
+ -(IBAction) quit:(id) sender;
+ -(IBAction) x11_help:(id) sender;
@end
+#endif /* __OBJC__ */
+void
+X11ControllerMain(int argc, char **argv, char **envp);
-#endif /* __OBJC__ */
-
-void X11ControllerMain(int argc, char **argv, char **envp);
-
-#endif /* X11CONTROLLER_H */
+#endif /* X11CONTROLLER_H */
diff --git a/xorg-server/hw/xquartz/X11Controller.m b/xorg-server/hw/xquartz/X11Controller.m
index 3de4e139d..b0bfc5858 100644
--- a/xorg-server/hw/xquartz/X11Controller.m
+++ b/xorg-server/hw/xquartz/X11Controller.m
@@ -53,304 +53,277 @@
#include <sys/types.h>
#include <sys/wait.h>
-@implementation X11Controller
+@ implementation X11Controller - (void) awakeFromNib {
+ X11Application *xapp = NSApp;
+ NSArray *array;
+
+ /* Point X11Application at ourself. */
+ [xapp set_controller:self];
+
+ array =[xapp prefs_get_array:@PREFS_APPSMENU];
+ if (array != nil) {
+ int count;
+
+ /* convert from [TITLE1 COMMAND1 TITLE2 COMMAND2 ...]
+ to [[TITLE1 COMMAND1] [TITLE2 COMMAND2] ...] format. */
+
+ count =[array count];
+ if (count > 0 && ![[array objectAtIndex: 0] isKindOfClass:[NSArray class]])
+ {
+ int i;
+ NSMutableArray *copy, *sub;
+
+ copy =[NSMutableArray arrayWithCapacity:(count / 2)];
+
+ for (i = 0; i < count / 2; i++) {
+ sub =[[NSMutableArray alloc] initWithCapacity:3];
+ [sub addObject: [array objectAtIndex:i * 2]];
+ [sub addObject: [array objectAtIndex:i * 2 + 1]];
+ [sub addObject:@""];
+ [copy addObject:sub];
+ [sub release];
+ }
+
+ array = copy;
+ }
+
+ [self set_apps_menu:array];
+ }
-- (void) awakeFromNib
-{
- X11Application *xapp = NSApp;
- NSArray *array;
-
- /* Point X11Application at ourself. */
- [xapp set_controller:self];
-
- array = [xapp prefs_get_array:@PREFS_APPSMENU];
- if (array != nil)
- {
- int count;
-
- /* convert from [TITLE1 COMMAND1 TITLE2 COMMAND2 ...]
- to [[TITLE1 COMMAND1] [TITLE2 COMMAND2] ...] format. */
-
- count = [array count];
- if (count > 0
- && ![[array objectAtIndex:0] isKindOfClass:[NSArray class]])
- {
- int i;
- NSMutableArray *copy, *sub;
-
- copy = [NSMutableArray arrayWithCapacity:(count / 2)];
-
- for (i = 0; i < count / 2; i++)
- {
- sub = [[NSMutableArray alloc] initWithCapacity:3];
- [sub addObject:[array objectAtIndex:i*2]];
- [sub addObject:[array objectAtIndex:i*2+1]];
- [sub addObject:@""];
- [copy addObject:sub];
- [sub release];
- }
-
- array = copy;
- }
-
- [self set_apps_menu:array];
- }
-
[[NSNotificationCenter defaultCenter]
- addObserver: self
- selector: @selector(apps_table_done:)
- name: NSWindowWillCloseNotification
- object: [apps_table window]];
+ addObserver: self selector: @selector(apps_table_done:)
+ name: NSWindowWillCloseNotification object:[apps_table window]];
// Setup data about our Windows menu
- if(window_separator) {
- [[window_separator menu] removeItem:window_separator];
+ if (window_separator) {
+ [[window_separator menu] removeItem:window_separator];
window_separator = nil;
}
-
- windows_menu_start = [[X11App windowsMenu] numberOfItems];
+
+ windows_menu_start =[[X11App windowsMenu] numberOfItems];
}
-- (void) item_selected:sender
-{
- [NSApp activateIgnoringOtherApps:YES];
-
- DarwinSendDDXEvent(kXquartzControllerNotify, 2,
- AppleWMWindowMenuItem, [sender tag]);
+ -(void) item_selected:sender {
+ [NSApp activateIgnoringOtherApps:YES];
+
+ DarwinSendDDXEvent(kXquartzControllerNotify, 2,
+ AppleWMWindowMenuItem,[sender tag]);
}
-- (void) remove_window_menu
-{
- NSMenu *menu;
- int count, i;
+-(void) remove_window_menu {
+ NSMenu *menu;
+ int count, i;
+
+ /* Work backwards so we don't mess up the indices */
+ menu =[X11App windowsMenu];
+ count =[menu numberOfItems];
+ for (i = count - 1; i >= windows_menu_start; i--)
+ [menu removeItemAtIndex:i];
- /* Work backwards so we don't mess up the indices */
- menu = [X11App windowsMenu];
- count = [menu numberOfItems];
- for (i = count - 1; i >= windows_menu_start; i--)
- [menu removeItemAtIndex:i];
-
- count = [dock_menu indexOfItem:dock_window_separator];
- for (i = 0; i < count; i++)
- [dock_menu removeItemAtIndex:0];
+ count =[dock_menu indexOfItem:dock_window_separator];
+ for (i = 0; i < count; i++)
+ [dock_menu removeItemAtIndex:0];
}
-- (void) install_window_menu:(NSArray *)list
-{
- NSMenu *menu;
- NSMenuItem *item;
- int first, count, i;
-
- menu = [X11App windowsMenu];
- first = windows_menu_start + 1;
- count = [list count];
-
- // Push a Separator
- if(count) {
- [menu addItem:[NSMenuItem separatorItem]];
- }
-
- for (i = 0; i < count; i++)
- {
- NSString *name, *shortcut;
-
- name = [[list objectAtIndex:i] objectAtIndex:0];
- shortcut = [[list objectAtIndex:i] objectAtIndex:1];
-
- if(windowItemModMask == 0 || windowItemModMask == -1)
- shortcut = @"";
-
- item = (NSMenuItem *) [menu addItemWithTitle:name action:@selector
- (item_selected:) keyEquivalent:shortcut];
- [item setKeyEquivalentModifierMask:(NSUInteger) windowItemModMask];
- [item setTarget:self];
- [item setTag:i];
- [item setEnabled:YES];
-
- item = (NSMenuItem *) [dock_menu insertItemWithTitle:name
- action:@selector
- (item_selected:) keyEquivalent:shortcut
- atIndex:i];
- [item setKeyEquivalentModifierMask:(NSUInteger) windowItemModMask];
- [item setTarget:self];
- [item setTag:i];
- [item setEnabled:YES];
- }
-
- if (checked_window_item >= 0 && checked_window_item < count)
- {
- item = (NSMenuItem *) [menu itemAtIndex:first + checked_window_item];
- [item setState:NSOnState];
- item = (NSMenuItem *) [dock_menu itemAtIndex:checked_window_item];
- [item setState:NSOnState];
- }
-}
-
-- (void) remove_apps_menu
-{
- NSMenu *menu;
- NSMenuItem *item;
- int i;
-
- if (apps == nil || apps_separator == nil) return;
-
- menu = [apps_separator menu];
-
- if (menu != nil)
- {
- for (i = [menu numberOfItems] - 1; i >= 0; i--)
- {
- item = (NSMenuItem *) [menu itemAtIndex:i];
- if ([item tag] != 0)
- [menu removeItemAtIndex:i];
- }
- }
-
- if (dock_apps_menu != nil)
- {
- for (i = [dock_apps_menu numberOfItems] - 1; i >= 0; i--)
- {
- item = (NSMenuItem *) [dock_apps_menu itemAtIndex:i];
- if ([item tag] != 0)
- [dock_apps_menu removeItemAtIndex:i];
- }
- }
-
- [apps release];
- apps = nil;
-}
-
-- (void) prepend_apps_item:(NSArray *)list index:(int)i menu:(NSMenu *)menu
-{
- NSString *title, *shortcut = @"";
- NSArray *group;
- NSMenuItem *item;
-
- group = [list objectAtIndex:i];
- title = [group objectAtIndex:0];
- if ([group count] >= 3)
- shortcut = [group objectAtIndex:2];
-
- if ([title length] != 0)
- {
- item = (NSMenuItem *) [menu insertItemWithTitle:title
- action:@selector (app_selected:)
- keyEquivalent:shortcut atIndex:0];
- [item setTarget:self];
- [item setEnabled:YES];
- }
- else
- {
- item = (NSMenuItem *) [NSMenuItem separatorItem];
- [menu insertItem:item atIndex:0];
- }
-
- [item setTag:i+1]; /* can't be zero, so add one */
-}
-
-- (void) install_apps_menu:(NSArray *)list
-{
- NSMenu *menu;
- int i, count;
-
- count = [list count];
-
- if (count == 0 || apps_separator == nil) return;
-
- menu = [apps_separator menu];
-
- for (i = count - 1; i >= 0; i--)
- {
- if (menu != nil)
- [self prepend_apps_item:list index:i menu:menu];
- if (dock_apps_menu != nil)
- [self prepend_apps_item:list index:i menu:dock_apps_menu];
- }
-
- apps = [list retain];
-}
-
-- (void) set_window_menu:(NSArray *)list
-{
- [self remove_window_menu];
- [self install_window_menu:list];
-
- DarwinSendDDXEvent(kXquartzControllerNotify, 1,
- AppleWMWindowMenuNotify);
+ -(void) install_window_menu:(NSArray *) list {
+ NSMenu *menu;
+ NSMenuItem *item;
+ int first, count, i;
+
+ menu =[X11App windowsMenu];
+ first = windows_menu_start + 1;
+ count =[list count];
+
+ // Push a Separator
+ if (count) {
+ [menu addItem:[NSMenuItem separatorItem]];
+ }
+
+ for (i = 0; i < count; i++) {
+ NSString *name, *shortcut;
+
+ name =[[list objectAtIndex: i] objectAtIndex:0];
+ shortcut =[[list objectAtIndex: i] objectAtIndex:1];
+
+ if (windowItemModMask == 0 || windowItemModMask == -1)
+ shortcut = @"";
+
+ item = (NSMenuItem *)[menu addItemWithTitle: name action: @selector(item_selected: )keyEquivalent:shortcut];
+ [item setKeyEquivalentModifierMask:(NSUInteger) windowItemModMask];
+ [item setTarget:self];
+ [item setTag:i];
+ [item setEnabled:YES];
+
+ item = (NSMenuItem *)[dock_menu insertItemWithTitle: name action: @selector(item_selected: )keyEquivalent: shortcut atIndex:i];
+ [item setKeyEquivalentModifierMask:(NSUInteger) windowItemModMask];
+ [item setTarget:self];
+ [item setTag:i];
+ [item setEnabled:YES];
+ }
+
+ if (checked_window_item >= 0 && checked_window_item < count) {
+ item = (NSMenuItem *)[menu itemAtIndex:first + checked_window_item];
+ [item setState:NSOnState];
+ item = (NSMenuItem *)[dock_menu itemAtIndex:checked_window_item];
+ [item setState:NSOnState];
+ }
}
-- (void) set_window_menu_check:(NSNumber *)nn
-{
- NSMenu *menu;
- NSMenuItem *item;
- int first, count;
- int n = [nn intValue];
-
- menu = [X11App windowsMenu];
- first = windows_menu_start + 1;
- count = [menu numberOfItems] - first;
-
- if (checked_window_item >= 0 && checked_window_item < count)
- {
- item = (NSMenuItem *) [menu itemAtIndex:first + checked_window_item];
- [item setState:NSOffState];
- item = (NSMenuItem *) [dock_menu itemAtIndex:checked_window_item];
- [item setState:NSOffState];
- }
- if (n >= 0 && n < count)
- {
- item = (NSMenuItem *) [menu itemAtIndex:first + n];
- [item setState:NSOnState];
- item = (NSMenuItem *) [dock_menu itemAtIndex:n];
- [item setState:NSOnState];
- }
- checked_window_item = n;
-}
-
-- (void) set_apps_menu:(NSArray *)list
+-(void) remove_apps_menu {
+ NSMenu *menu;
+ NSMenuItem *item;
+ int i;
+
+ if (apps == nil || apps_separator == nil)
+ return;
+
+ menu =[apps_separator menu];
+
+ if (menu != nil) {
+ for (i =[menu numberOfItems] - 1; i >= 0; i--) {
+ item = (NSMenuItem *)[menu itemAtIndex:i];
+ if ([item tag] != 0)
+ [menu removeItemAtIndex:i];
+ }
+ }
+
+ if (dock_apps_menu != nil) {
+ for (i =[dock_apps_menu numberOfItems] - 1; i >= 0; i--) {
+ item = (NSMenuItem *)[dock_apps_menu itemAtIndex:i];
+ if ([item tag] != 0)
+ [dock_apps_menu removeItemAtIndex:i];
+ }
+ }
+
+ [apps release];
+ apps = nil;
+}
+
+ -(void) prepend_apps_item:(NSArray *)
+list index:(int)
+i menu:(NSMenu *) menu
{
- [self remove_apps_menu];
- [self install_apps_menu:list];
+ NSString *title, *shortcut = @"";
+ NSArray *group;
+ NSMenuItem *item;
+
+ group =[list objectAtIndex:i];
+ title =[group objectAtIndex:0];
+ if ([group count] >= 3)
+ shortcut =[group objectAtIndex:2];
+
+ if ([title length] != 0) {
+ item = (NSMenuItem *)[menu insertItemWithTitle: title action: @selector(app_selected:)
+ keyEquivalent: shortcut atIndex:0];
+ [item setTarget:self];
+ [item setEnabled:YES];
+ }
+ else {
+ item = (NSMenuItem *)[NSMenuItem separatorItem];
+ [menu insertItem: item atIndex:0];
+ }
+
+ [item setTag:i + 1]; /* can't be zero, so add one */
+}
+
+ -(void) install_apps_menu:(NSArray *) list {
+ NSMenu *menu;
+ int i, count;
+
+ count =[list count];
+
+ if (count == 0 || apps_separator == nil)
+ return;
+
+ menu =[apps_separator menu];
+
+ for (i = count - 1; i >= 0; i--) {
+ if (menu != nil)
+ [self prepend_apps_item: list index: i menu:menu];
+ if (dock_apps_menu != nil)
+ [self prepend_apps_item: list index: i menu:dock_apps_menu];
+ }
+
+ apps =[list retain];
+}
+
+ -(void) set_window_menu:(NSArray *) list {
+ [self remove_window_menu];
+ [self install_window_menu:list];
+
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMWindowMenuNotify);
+}
+
+ -(void) set_window_menu_check:(NSNumber *) nn {
+ NSMenu *menu;
+ NSMenuItem *item;
+ int first, count;
+ int n =[nn intValue];
+
+ menu =[X11App windowsMenu];
+ first = windows_menu_start + 1;
+ count =[menu numberOfItems] - first;
+
+ if (checked_window_item >= 0 && checked_window_item < count) {
+ item = (NSMenuItem *)[menu itemAtIndex:first + checked_window_item];
+ [item setState:NSOffState];
+ item = (NSMenuItem *)[dock_menu itemAtIndex:checked_window_item];
+ [item setState:NSOffState];
+ }
+ if (n >= 0 && n < count) {
+ item = (NSMenuItem *)[menu itemAtIndex:first + n];
+ [item setState:NSOnState];
+ item = (NSMenuItem *)[dock_menu itemAtIndex:n];
+ [item setState:NSOnState];
+ }
+ checked_window_item = n;
+}
+
+ -(void) set_apps_menu:(NSArray *) list {
+ [self remove_apps_menu];
+ [self install_apps_menu:list];
}
#ifdef XQUARTZ_SPARKLE
-- (void) setup_sparkle {
- if(check_for_updates_item)
- return; // already did it...
+-(void) setup_sparkle {
+ if (check_for_updates_item)
+ return; // already did it...
- NSMenu *menu = [x11_about_item menu];
+ NSMenu *menu =[x11_about_item menu];
- check_for_updates_item = [menu insertItemWithTitle:NSLocalizedString(@"Check for X11 Updates...", @"Check for X11 Updates...")
- action:@selector (checkForUpdates:)
- keyEquivalent:@""
- atIndex:1];
- [check_for_updates_item setTarget:[SUUpdater sharedUpdater]];
- [check_for_updates_item setEnabled:YES];
+ check_for_updates_item =[menu insertItemWithTitle:NSLocalizedString(@"Check for X11 Updates...",
+ @"Check for X11 Updates...")
+ action: @selector(checkForUpdates:)
+ keyEquivalent: @"" atIndex:1];
+ [check_for_updates_item setTarget:[SUUpdater sharedUpdater]];
+ [check_for_updates_item setEnabled:YES];
// Set X11Controller as the delegate for the updater.
- [[SUUpdater sharedUpdater] setDelegate:self];
+ [[SUUpdater sharedUpdater] setDelegate:self];
}
// Sent immediately before installing the specified update.
-- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update {
+ -(void) updater:(SUUpdater *)
+updater willInstallUpdate:(SUAppcastItem *) update
+{
//[self set_can_quit:YES];
}
#endif
-- (void) launch_client:(NSString *)filename
-{
+ -(void) launch_client:(NSString *) filename {
int child1, child2 = 0;
int status;
const char *newargv[4];
char buf[128];
char *s;
-
- newargv[0] = [X11App prefs_get_string:@PREFS_LOGIN_SHELL default:"/bin/sh"];
+
+newargv[0] =[X11App prefs_get_string: @PREFS_LOGIN_SHELL default:
+"/bin/sh"];
newargv[1] = "-c";
- newargv[2] = [filename UTF8String];
+ newargv[2] =[filename UTF8String];
newargv[3] = NULL;
-
+
s = getenv("DISPLAY");
if (s == NULL || s[0] == 0) {
snprintf(buf, sizeof(buf), ":%s", display);
@@ -360,502 +333,541 @@
/* Do the fork-twice trick to avoid having to reap zombies */
child1 = fork();
switch (child1) {
- case -1: /* error */
- break;
-
- case 0: /* child1 */
- child2 = fork();
-
- switch (child2) {
- int max_files, i;
-
- case -1: /* error */
- _exit(1);
-
- case 0: /* child2 */
- /* close all open files except for standard streams */
- max_files = sysconf(_SC_OPEN_MAX);
- for(i = 3; i < max_files; i++)
- close(i);
-
- /* ensure stdin is on /dev/null */
- close(0);
- open("/dev/null", O_RDONLY);
-
- execvp(newargv[0], (char **const) newargv);
- _exit(2);
-
- default: /* parent (child1) */
- _exit(0);
- }
- break;
-
- default: /* parent */
- waitpid(child1, &status, 0);
+ case -1: /* error */
+ break;
+
+ case 0: /* child1 */
+ child2 = fork();
+
+ switch (child2) {
+ int max_files, i;
+
+ case -1: /* error */
+ _exit(1);
+
+ case 0: /* child2 */
+ /* close all open files except for standard streams */
+ max_files = sysconf(_SC_OPEN_MAX);
+ for (i = 3; i < max_files; i++)
+ close(i);
+
+ /* ensure stdin is on /dev/null */
+ close(0);
+ open("/dev/null", O_RDONLY);
+
+ execvp(newargv[0], (char **const) newargv);
+ _exit(2);
+
+ default: /* parent (child1) */
+ _exit(0);
+ }
+ break;
+
+ default: /* parent */
+ waitpid(child1, &status, 0);
}
}
-- (void) app_selected:sender
-{
- int tag;
- NSString *item;
-
- tag = [sender tag] - 1;
- if (apps == nil || tag < 0 || tag >= [apps count])
- return;
-
- item = [[apps objectAtIndex:tag] objectAtIndex:1];
-
- [self launch_client:item];
-}
-
-- (IBAction) apps_table_show:sender
-{
- NSArray *columns;
- NSMutableArray *oldapps = nil;
-
- if (table_apps != nil)
- oldapps = table_apps;
-
- table_apps = [[NSMutableArray alloc] initWithCapacity:1];
- if(apps != nil)
- [table_apps addObjectsFromArray:apps];
-
- columns = [apps_table tableColumns];
- [[columns objectAtIndex:0] setIdentifier:@"0"];
- [[columns objectAtIndex:1] setIdentifier:@"1"];
- [[columns objectAtIndex:2] setIdentifier:@"2"];
-
- [apps_table setDataSource:self];
- [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
-
- [[apps_table window] makeKeyAndOrderFront:sender];
- [apps_table reloadData];
- if(oldapps != nil)
- [oldapps release];
-}
-
-- (IBAction) apps_table_done:sender
-{
- [apps_table deselectAll:sender]; /* flush edits? */
-
- [self remove_apps_menu];
- [self install_apps_menu:table_apps];
-
- [NSApp prefs_set_array:@PREFS_APPSMENU value:table_apps];
- [NSApp prefs_synchronize];
-
- [[apps_table window] orderOut:sender];
-
- [table_apps release];
- table_apps = nil;
-}
-
-- (IBAction) apps_table_new:sender
-{
- NSMutableArray *item;
-
- int row = [apps_table selectedRow], i;
-
- if (row < 0) row = 0;
- else row = row + 1;
-
- i = row;
- if (i > [table_apps count])
- return; /* avoid exceptions */
-
- [apps_table deselectAll:sender];
-
- item = [[NSMutableArray alloc] initWithCapacity:3];
- [item addObject:@""];
- [item addObject:@""];
- [item addObject:@""];
-
- [table_apps insertObject:item atIndex:i];
- [item release];
-
- [apps_table reloadData];
- [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
-}
-
-- (IBAction) apps_table_duplicate:sender
-{
- int row = [apps_table selectedRow], i;
- NSObject *item;
-
- if (row < 0) {
- [self apps_table_new:sender];
- return;
- }
-
- i = row;
- if (i > [table_apps count] - 1) return; /* avoid exceptions */
-
- [apps_table deselectAll:sender];
-
- item = [[table_apps objectAtIndex:i] mutableCopy];
- [table_apps insertObject:item atIndex:i];
- [item release];
-
- [apps_table reloadData];
- [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row+1] byExtendingSelection:NO];
-}
-
-- (IBAction) apps_table_delete:sender
-{
- int row = [apps_table selectedRow];
-
- if (row >= 0)
- {
- int i = row;
-
- if (i > [table_apps count] - 1) return; /* avoid exceptions */
-
- [apps_table deselectAll:sender];
-
- [table_apps removeObjectAtIndex:i];
- }
-
- [apps_table reloadData];
-
- row = MIN (row, [table_apps count] - 1);
- if (row >= 0)
- [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
-}
-
-- (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView
-{
- if (table_apps == nil) return 0;
-
- return [table_apps count];
+ -(void) app_selected:sender {
+ int tag;
+ NSString *item;
+
+ tag =[sender tag] - 1;
+ if (apps == nil || tag < 0 || tag >=[apps count])
+ return;
+
+ item =[[apps objectAtIndex: tag] objectAtIndex:1];
+
+ [self launch_client:item];
}
-- (id) tableView:(NSTableView *)tableView
-objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
-{
- NSArray *item;
- int col;
-
- if (table_apps == nil) return nil;
-
- col = [[tableColumn identifier] intValue];
-
- item = [table_apps objectAtIndex:row];
- if ([item count] > col)
- return [item objectAtIndex:col];
- else
- return @"";
-}
-
-- (void) tableView:(NSTableView *)tableView setObjectValue:(id)object
- forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
-{
- NSMutableArray *item;
- int col;
-
- if (table_apps == nil) return;
-
- col = [[tableColumn identifier] intValue];
-
- item = [table_apps objectAtIndex:row];
- [item replaceObjectAtIndex:col withObject:object];
-}
-
-- (void) hide_window:sender
-{
- if ([X11App x_active])
- DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideWindow);
- else
- NSBeep (); /* FIXME: something here */
+ -(IBAction) apps_table_show:sender {
+ NSArray *columns;
+ NSMutableArray *oldapps = nil;
+
+ if (table_apps != nil)
+ oldapps = table_apps;
+
+ table_apps =[[NSMutableArray alloc] initWithCapacity:1];
+ if (apps != nil)
+ [table_apps addObjectsFromArray:apps];
+
+ columns =[apps_table tableColumns];
+ [[columns objectAtIndex: 0] setIdentifier:@"0"];
+ [[columns objectAtIndex: 1] setIdentifier:@"1"];
+ [[columns objectAtIndex: 2] setIdentifier:@"2"];
+
+ [apps_table setDataSource:self];
+ [apps_table selectRowIndexes: [NSIndexSet indexSetWithIndex: 0] byExtendingSelection:NO];
+
+ [[apps_table window] makeKeyAndOrderFront:sender];
+ [apps_table reloadData];
+ if (oldapps != nil)
+ [oldapps release];
}
-- (IBAction)bring_to_front:sender
-{
- DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMBringAllToFront);
+ -(IBAction) apps_table_done:sender {
+ [apps_table deselectAll:sender];
+ /* flush edits? */
+
+ [self remove_apps_menu];
+ [self install_apps_menu:table_apps];
+
+ [NSApp prefs_set_array: @PREFS_APPSMENU value:table_apps];
+ [NSApp prefs_synchronize];
+
+ [[apps_table window] orderOut:sender];
+
+ [table_apps release];
+ table_apps = nil;
}
-- (IBAction)close_window:sender
-{
- if ([X11App x_active])
- DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMCloseWindow);
- else
- [[NSApp keyWindow] performClose:sender];
+ -(IBAction) apps_table_new:sender {
+ NSMutableArray *item;
+
+ int row =[apps_table selectedRow], i;
+
+ if (row < 0)
+ row = 0;
+ else
+ row = row + 1;
+
+ i = row;
+ if (i >[table_apps count])
+ return; /* avoid exceptions */
+
+ [apps_table deselectAll:sender];
+
+ item =[[NSMutableArray alloc] initWithCapacity:3];
+ [item addObject:@""];
+ [item addObject:@""];
+ [item addObject:@""];
+
+ [table_apps insertObject: item atIndex:i];
+ [item release];
+
+ [apps_table reloadData];
+ [apps_table selectRowIndexes: [NSIndexSet indexSetWithIndex: row] byExtendingSelection:NO];
}
-- (IBAction)minimize_window:sender
-{
- if ([X11App x_active])
- DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMMinimizeWindow);
- else
- [[NSApp keyWindow] performMiniaturize:sender];
+ -(IBAction) apps_table_duplicate:sender {
+ int row =[apps_table selectedRow], i;
+ NSObject *item;
+
+ if (row < 0) {
+ [self apps_table_new:sender];
+ return;
+ }
+
+ i = row;
+ if (i >[table_apps count] - 1)
+ return; /* avoid exceptions */
+
+ [apps_table deselectAll:sender];
+
+ item =[[table_apps objectAtIndex:i] mutableCopy];
+ [table_apps insertObject: item atIndex:i];
+ [item release];
+
+ [apps_table reloadData];
+ [apps_table selectRowIndexes: [NSIndexSet indexSetWithIndex: row + 1] byExtendingSelection:NO];
}
-- (IBAction)zoom_window:sender
-{
- if ([X11App x_active])
- DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMZoomWindow);
- else
- [[NSApp keyWindow] performZoom:sender];
+ -(IBAction) apps_table_delete:sender {
+ int row =[apps_table selectedRow];
+
+ if (row >= 0) {
+ int i = row;
+
+ if (i >[table_apps count] - 1)
+ return; /* avoid exceptions */
+
+ [apps_table deselectAll:sender];
+
+ [table_apps removeObjectAtIndex:i];
+ }
+
+ [apps_table reloadData];
+
+ row = MIN(row,[table_apps count] - 1);
+ if (row >= 0)
+ [apps_table selectRowIndexes: [NSIndexSet indexSetWithIndex: row] byExtendingSelection:NO];
+}
+
+ -(NSInteger) numberOfRowsInTableView:(NSTableView *) tableView {
+ if (table_apps == nil)
+ return 0;
+
+ return[table_apps count];
}
-- (IBAction) next_window:sender
+ -(id) tableView: (NSTableView *) tableView objectValueForTableColumn:(NSTableColumn
+ *)
+tableColumn row:(NSInteger) row
{
- DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMNextWindow);
+ NSArray *item;
+ int col;
+
+ if (table_apps == nil)
+ return nil;
+
+ col =[[tableColumn identifier] intValue];
+
+ item =[table_apps objectAtIndex:row];
+ if ([item count] > col)
+ return[item objectAtIndex:col];
+ else
+ return @"";
}
-- (IBAction) previous_window:sender
+ -(void) tableView:(NSTableView *)
+tableView setObjectValue:(id) object forTableColumn:(NSTableColumn *)
+tableColumn row:(NSInteger) row
{
- DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMPreviousWindow);
+ NSMutableArray *item;
+ int col;
+
+ if (table_apps == nil)
+ return;
+
+ col =[[tableColumn identifier] intValue];
+
+ item =[table_apps objectAtIndex:row];
+ [item replaceObjectAtIndex: col withObject:object];
+}
+
+ -(void) hide_window:sender {
+ if ([X11App x_active])
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideWindow);
+ else
+ NSBeep(); /* FIXME: something here */
+}
+
+ -(IBAction) bring_to_front:sender {
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMBringAllToFront);
+}
+
+ -(IBAction) close_window:sender {
+ if ([X11App x_active])
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMCloseWindow);
+ else
+ [[NSApp keyWindow] performClose:sender];
+}
+
+ -(IBAction) minimize_window:sender {
+ if ([X11App x_active])
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMMinimizeWindow);
+ else
+ [[NSApp keyWindow] performMiniaturize:sender];
}
-- (IBAction) enable_fullscreen_changed:sender {
+ -(IBAction) zoom_window:sender {
+ if ([X11App x_active])
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMZoomWindow);
+ else
+ [[NSApp keyWindow] performZoom:sender];
+}
+
+ -(IBAction) next_window:sender {
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMNextWindow);
+}
+
+ -(IBAction) previous_window:sender {
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMPreviousWindow);
+}
+
+ -(IBAction) enable_fullscreen_changed:sender {
XQuartzRootlessDefault = ![enable_fullscreen intValue];
- [enable_fullscreen_menu setEnabled:!XQuartzRootlessDefault];
- [enable_fullscreen_menu_text setTextColor:XQuartzRootlessDefault ? [NSColor disabledControlTextColor] : [NSColor controlTextColor]];
+ [enable_fullscreen_menu setEnabled:!XQuartzRootlessDefault];
+ [enable_fullscreen_menu_text setTextColor:XQuartzRootlessDefault ?[NSColor disabledControlTextColor] :[NSColor
+ controlTextColor]];
DarwinSendDDXEvent(kXquartzSetRootless, 1, XQuartzRootlessDefault);
- [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:XQuartzRootlessDefault];
+ [NSApp prefs_set_boolean: @PREFS_ROOTLESS value:XQuartzRootlessDefault];
[NSApp prefs_synchronize];
}
-- (IBAction) toggle_fullscreen:sender
-{
- DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
+ -(IBAction) toggle_fullscreen:sender {
+ DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
}
-- (void) set_can_quit:(OSX_BOOL)state
-{
- can_quit = state;
+ -(void) set_can_quit:(OSX_BOOL) state {
+ can_quit = state;
}
-- (IBAction)prefs_changed:sender
-{
- if(!sender)
+ -(IBAction) prefs_changed:sender {
+ if (!sender)
return;
-
- if(sender == fake_buttons) {
- darwinFakeButtons = [fake_buttons intValue];
- [NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
- } else if(sender == enable_keyequivs) {
- XQuartzEnableKeyEquivalents = [enable_keyequivs intValue];
- [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:XQuartzEnableKeyEquivalents];
- } else if(sender == sync_keymap) {
- darwinSyncKeymap = [sync_keymap intValue];
- [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
- } else if(sender == enable_fullscreen_menu) {
- XQuartzFullscreenMenu = [enable_fullscreen_menu intValue];
- [NSApp prefs_set_boolean:@PREFS_FULLSCREEN_MENU value:XQuartzFullscreenMenu];
- } else if(sender == option_sends_alt) {
+
+ if (sender == fake_buttons) {
+ darwinFakeButtons =[fake_buttons intValue];
+ [NSApp prefs_set_boolean: @PREFS_FAKEBUTTONS value:darwinFakeButtons];
+ }
+ else if (sender == enable_keyequivs) {
+ XQuartzEnableKeyEquivalents =[enable_keyequivs intValue];
+ [NSApp prefs_set_boolean: @PREFS_KEYEQUIVS value:XQuartzEnableKeyEquivalents];
+ }
+ else if (sender == sync_keymap) {
+ darwinSyncKeymap =[sync_keymap intValue];
+ [NSApp prefs_set_boolean: @PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
+ }
+ else if (sender == enable_fullscreen_menu) {
+ XQuartzFullscreenMenu =[enable_fullscreen_menu intValue];
+ [NSApp prefs_set_boolean: @PREFS_FULLSCREEN_MENU value:XQuartzFullscreenMenu];
+ }
+ else if (sender == option_sends_alt) {
BOOL prev_opt_sends_alt = XQuartzOptionSendsAlt;
-
- XQuartzOptionSendsAlt = [option_sends_alt intValue];
- [NSApp prefs_set_boolean:@PREFS_OPTION_SENDS_ALT value:XQuartzOptionSendsAlt];
- if(prev_opt_sends_alt != XQuartzOptionSendsAlt)
+ XQuartzOptionSendsAlt =[option_sends_alt intValue];
+ [NSApp prefs_set_boolean: @PREFS_OPTION_SENDS_ALT value:XQuartzOptionSendsAlt];
+
+ if (prev_opt_sends_alt != XQuartzOptionSendsAlt)
QuartsResyncKeymap(TRUE);
- } else if(sender == click_through) {
- [NSApp prefs_set_boolean:@PREFS_CLICK_THROUGH value:[click_through intValue]];
- } else if(sender == focus_follows_mouse) {
- [NSApp prefs_set_boolean:@PREFS_FFM value:[focus_follows_mouse intValue]];
- } else if(sender == focus_on_new_window) {
- [NSApp prefs_set_boolean:@PREFS_FOCUS_ON_NEW_WINDOW value:[focus_on_new_window intValue]];
- } else if(sender == enable_auth) {
- [NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]];
- } else if(sender == enable_tcp) {
- [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]];
- } else if(sender == depth) {
- [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]];
- } else if(sender == sync_pasteboard) {
- BOOL pbproxy_active = [sync_pasteboard intValue];
- [NSApp prefs_set_boolean:@PREFS_SYNC_PB value:pbproxy_active];
-
- [sync_pasteboard_to_clipboard setEnabled:pbproxy_active];
- [sync_pasteboard_to_primary setEnabled:pbproxy_active];
- [sync_clipboard_to_pasteboard setEnabled:pbproxy_active];
- [sync_primary_immediately setEnabled:pbproxy_active];
+ }
+ else if (sender == click_through) {
+ [NSApp prefs_set_boolean: @PREFS_CLICK_THROUGH value:[click_through
+ intValue]];
+ }
+ else if (sender == focus_follows_mouse) {
+ [NSApp prefs_set_boolean: @PREFS_FFM value:[focus_follows_mouse
+ intValue]];
+ }
+ else if (sender == focus_on_new_window) {
+ [NSApp prefs_set_boolean: @PREFS_FOCUS_ON_NEW_WINDOW value:[focus_on_new_window
+ intValue]];
+ }
+ else if (sender == enable_auth) {
+ [NSApp prefs_set_boolean: @PREFS_NO_AUTH value:![enable_auth
+ intValue]];
+ }
+ else if (sender == enable_tcp) {
+ [NSApp prefs_set_boolean: @PREFS_NO_TCP value:![enable_tcp intValue]];
+ }
+ else if (sender == depth) {
+ [NSApp prefs_set_integer: @PREFS_DEPTH value:[depth selectedTag]];
+ }
+ else if (sender == sync_pasteboard) {
+ BOOL pbproxy_active =[sync_pasteboard intValue];
+
+ [NSApp prefs_set_boolean: @PREFS_SYNC_PB value:pbproxy_active];
+
+ [sync_pasteboard_to_clipboard setEnabled:pbproxy_active];
+ [sync_pasteboard_to_primary setEnabled:pbproxy_active];
+ [sync_clipboard_to_pasteboard setEnabled:pbproxy_active];
+ [sync_primary_immediately setEnabled:pbproxy_active];
// setEnabled doesn't do this...
- [sync_text1 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
- [sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
- } else if(sender == sync_pasteboard_to_clipboard) {
- [NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD value:[sync_pasteboard_to_clipboard intValue]];
- } else if(sender == sync_pasteboard_to_primary) {
- [NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_PRIMARY value:[sync_pasteboard_to_primary intValue]];
- } else if(sender == sync_clipboard_to_pasteboard) {
- [NSApp prefs_set_boolean:@PREFS_SYNC_CLIPBOARD_TO_PB value:[sync_clipboard_to_pasteboard intValue]];
- } else if(sender == sync_primary_immediately) {
- [NSApp prefs_set_boolean:@PREFS_SYNC_PRIMARY_ON_SELECT value:[sync_primary_immediately intValue]];
- } else if(sender == scroll_in_device_direction) {
- XQuartzScrollInDeviceDirection = [scroll_in_device_direction intValue];
- [NSApp prefs_set_boolean:@PREFS_SCROLL_IN_DEV_DIRECTION value:XQuartzScrollInDeviceDirection];
+ [sync_text1 setTextColor:pbproxy_active ?[NSColor controlTextColor] :[NSColor
+ disabledControlTextColor]];
+ [sync_text2 setTextColor:pbproxy_active ?[NSColor controlTextColor] :[NSColor
+ disabledControlTextColor]];
+ }
+ else if (sender == sync_pasteboard_to_clipboard) {
+ [NSApp prefs_set_boolean: @PREFS_SYNC_PB_TO_CLIPBOARD value:[sync_pasteboard_to_clipboard
+ intValue]];
+ }
+ else if (sender == sync_pasteboard_to_primary) {
+ [NSApp prefs_set_boolean: @PREFS_SYNC_PB_TO_PRIMARY value:[sync_pasteboard_to_primary
+ intValue]];
+ }
+ else if (sender == sync_clipboard_to_pasteboard) {
+ [NSApp prefs_set_boolean: @PREFS_SYNC_CLIPBOARD_TO_PB value:[sync_clipboard_to_pasteboard
+ intValue]];
+ }
+ else if (sender == sync_primary_immediately) {
+ [NSApp prefs_set_boolean: @PREFS_SYNC_PRIMARY_ON_SELECT value:[sync_primary_immediately
+ intValue]];
+ }
+ else if (sender == scroll_in_device_direction) {
+ XQuartzScrollInDeviceDirection =[scroll_in_device_direction intValue];
+ [NSApp prefs_set_boolean: @PREFS_SCROLL_IN_DEV_DIRECTION value:XQuartzScrollInDeviceDirection];
}
[NSApp prefs_synchronize];
-
+
DarwinSendDDXEvent(kXquartzReloadPreferences, 0);
}
-- (IBAction) prefs_show:sender
-{
- BOOL pbproxy_active = [NSApp prefs_get_boolean:@PREFS_SYNC_PB default:YES];
+ -(IBAction) prefs_show:sender {
+BOOL pbproxy_active =[NSApp prefs_get_boolean: @PREFS_SYNC_PB default:
+YES];
// Remove preferences from the GUI which are not supported
// TODO: Change 1117 to NSAppKitVersionNumber10_7 when it is defined
- if(scroll_in_device_direction && NSAppKitVersionNumber < 1117) {
+ if (scroll_in_device_direction && NSAppKitVersionNumber < 1117) {
[scroll_in_device_direction removeFromSuperview];
scroll_in_device_direction = nil;
- } else {
- [scroll_in_device_direction setIntValue:XQuartzScrollInDeviceDirection];
- }
-
- [fake_buttons setIntValue:darwinFakeButtons];
- [enable_keyequivs setIntValue:XQuartzEnableKeyEquivalents];
- [sync_keymap setIntValue:darwinSyncKeymap];
- [option_sends_alt setIntValue:XQuartzOptionSendsAlt];
- [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_CLICK_THROUGH default:NO]];
- [focus_follows_mouse setIntValue:[NSApp prefs_get_boolean:@PREFS_FFM default:NO]];
- [focus_on_new_window setIntValue:[NSApp prefs_get_boolean:@PREFS_FOCUS_ON_NEW_WINDOW default:YES]];
-
- [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]];
- [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]];
-
- [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]];
-
- [sync_pasteboard setIntValue:pbproxy_active];
- [sync_pasteboard_to_clipboard setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD default:YES]];
- [sync_pasteboard_to_primary setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_PB_TO_PRIMARY default:YES]];
- [sync_clipboard_to_pasteboard setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_CLIPBOARD_TO_PB default:YES]];
- [sync_primary_immediately setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_PRIMARY_ON_SELECT default:NO]];
-
- [sync_pasteboard_to_clipboard setEnabled:pbproxy_active];
- [sync_pasteboard_to_primary setEnabled:pbproxy_active];
- [sync_clipboard_to_pasteboard setEnabled:pbproxy_active];
- [sync_primary_immediately setEnabled:pbproxy_active];
+ }
+ else {
+ [scroll_in_device_direction setIntValue:XQuartzScrollInDeviceDirection];
+ }
+
+ [fake_buttons setIntValue:darwinFakeButtons];
+ [enable_keyequivs setIntValue:XQuartzEnableKeyEquivalents];
+ [sync_keymap setIntValue:darwinSyncKeymap];
+ [option_sends_alt setIntValue:XQuartzOptionSendsAlt];
+[click_through setIntValue: [NSApp prefs_get_boolean: @PREFS_CLICK_THROUGH default:
+NO]];
+[focus_follows_mouse setIntValue: [NSApp prefs_get_boolean: @PREFS_FFM default:
+NO]];
+[focus_on_new_window setIntValue: [NSApp prefs_get_boolean: @PREFS_FOCUS_ON_NEW_WINDOW default:
+YES]];
+
+[enable_auth setIntValue: ![NSApp prefs_get_boolean: @PREFS_NO_AUTH default:
+NO]];
+[enable_tcp setIntValue: ![NSApp prefs_get_boolean: @PREFS_NO_TCP default:
+NO]];
+
+[depth selectItemAtIndex: [depth indexOfItemWithTag: [NSApp prefs_get_integer: @PREFS_DEPTH default:
+-1]]];
+
+ [sync_pasteboard setIntValue:pbproxy_active];
+[sync_pasteboard_to_clipboard setIntValue: [NSApp prefs_get_boolean: @PREFS_SYNC_PB_TO_CLIPBOARD default:
+YES]];
+[sync_pasteboard_to_primary setIntValue: [NSApp prefs_get_boolean: @PREFS_SYNC_PB_TO_PRIMARY default:
+YES]];
+[sync_clipboard_to_pasteboard setIntValue: [NSApp prefs_get_boolean: @PREFS_SYNC_CLIPBOARD_TO_PB default:
+YES]];
+[sync_primary_immediately setIntValue: [NSApp prefs_get_boolean: @PREFS_SYNC_PRIMARY_ON_SELECT default:
+NO]];
+
+ [sync_pasteboard_to_clipboard setEnabled:pbproxy_active];
+ [sync_pasteboard_to_primary setEnabled:pbproxy_active];
+ [sync_clipboard_to_pasteboard setEnabled:pbproxy_active];
+ [sync_primary_immediately setEnabled:pbproxy_active];
// setEnabled doesn't do this...
- [sync_text1 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
- [sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
-
- [enable_fullscreen setIntValue:!XQuartzRootlessDefault];
- [enable_fullscreen_menu setIntValue:XQuartzFullscreenMenu];
- [enable_fullscreen_menu setEnabled:!XQuartzRootlessDefault];
- [enable_fullscreen_menu_text setTextColor:XQuartzRootlessDefault ? [NSColor disabledControlTextColor] : [NSColor controlTextColor]];
+ [sync_text1 setTextColor:pbproxy_active ?[NSColor controlTextColor] :[NSColor
+ disabledControlTextColor]];
+ [sync_text2 setTextColor:pbproxy_active ?[NSColor controlTextColor] :[NSColor
+ disabledControlTextColor]];
- [prefs_panel makeKeyAndOrderFront:sender];
+ [enable_fullscreen setIntValue:!XQuartzRootlessDefault];
+ [enable_fullscreen_menu setIntValue:XQuartzFullscreenMenu];
+ [enable_fullscreen_menu setEnabled:!XQuartzRootlessDefault];
+ [enable_fullscreen_menu_text setTextColor:XQuartzRootlessDefault ?[NSColor disabledControlTextColor] :[NSColor
+ controlTextColor]];
+
+ [prefs_panel makeKeyAndOrderFront:sender];
}
-- (IBAction) quit:sender {
+ -(IBAction) quit:sender {
DarwinSendDDXEvent(kXquartzQuit, 0);
}
-- (IBAction) x11_help:sender {
+ -(IBAction) x11_help:sender {
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
- AHLookupAnchor((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR("mchlp2276"));
+ AHLookupAnchor((CFStringRef) NSLocalizedString(@"Mac Help", no comment),
+ CFSTR("mchlp2276"));
#else
AHLookupAnchor(CFSTR("com.apple.machelp"), CFSTR("mchlp2276"));
#endif
}
-- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item {
- NSMenu *menu = [item menu];
-
- if (item == toggle_fullscreen_item)
- return !XQuartzIsRootless;
- else if (menu == [X11App windowsMenu] || menu == dock_menu
- || (menu == [x11_about_item menu] && [item tag] == 42))
- return (AppleWMSelectedEvents () & AppleWMControllerNotifyMask) != 0;
- else
- return TRUE;
+ -(OSX_BOOL) validateMenuItem:(NSMenuItem *) item {
+ NSMenu *menu =[item menu];
+
+ if (item == toggle_fullscreen_item)
+ return !XQuartzIsRootless;
+ else if (menu ==[X11App windowsMenu] || menu == dock_menu
+ || (menu ==[x11_about_item menu] &&[item tag] == 42))
+ return (AppleWMSelectedEvents() & AppleWMControllerNotifyMask) != 0;
+ else
+ return TRUE;
}
-- (void) applicationDidHide:(NSNotification *)notify
-{
- DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideAll);
+ -(void) applicationDidHide:(NSNotification *) notify {
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideAll);
- /* Toggle off fullscreen mode to leave our non-default video
- * mode and hide our guard window.
- */
- if (!XQuartzIsRootless && XQuartzFullscreenVisible) {
- DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
- }
+ /* Toggle off fullscreen mode to leave our non-default video
+ * mode and hide our guard window.
+ */
+ if (!XQuartzIsRootless && XQuartzFullscreenVisible) {
+ DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
+ }
}
-- (void) applicationDidUnhide:(NSNotification *)notify
-{
- DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMShowAll);
+ -(void) applicationDidUnhide:(NSNotification *) notify {
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMShowAll);
}
-- (NSApplicationTerminateReply) applicationShouldTerminate:sender {
+ -(NSApplicationTerminateReply) applicationShouldTerminate:sender {
NSString *msg;
NSString *title;
-
- if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
+
+if (can_quit ||[X11App prefs_get_boolean: @PREFS_NO_QUIT_ALERT default:
+NO])
return NSTerminateNow;
-
+
/* Make sure we're frontmost. */
- [NSApp activateIgnoringOtherApps:YES];
-
- title = NSLocalizedString(@"Do you really want to quit X11?", @"Dialog title when quitting");
- msg = NSLocalizedString(@"Any open X11 applications will stop immediately, and you will lose any unsaved changes.", @"Dialog when quitting");
+ [NSApp activateIgnoringOtherApps:YES];
+
+ title =
+ NSLocalizedString(@"Do you really want to quit X11?",
+ @"Dialog title when quitting");
+ msg =
+ NSLocalizedString
+ (@"Any open X11 applications will stop immediately, and you will lose any unsaved changes.",
+ @"Dialog when quitting");
/* FIXME: safe to run the alert in here? Or should we return Later
* and then run the alert on a timer? It seems to work here, so..
*/
-
- return (NSRunAlertPanel (title, msg, NSLocalizedString (@"Quit", @""),
- NSLocalizedString (@"Cancel", @""), nil)
+
+ return (NSRunAlertPanel(title, msg, NSLocalizedString(@"Quit", @""),
+ NSLocalizedString(@"Cancel", @""), nil)
== NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel;
}
-- (void) applicationWillTerminate:(NSNotification *)aNotification
-{
- unsigned remain;
- [X11App prefs_synchronize];
-
- /* shutdown the X server, it will exit () for us. */
- DarwinSendDDXEvent(kXquartzQuit, 0);
-
- /* In case it doesn't, exit anyway after a while. */
- remain = 10000000;
- while((remain = usleep(remain)) > 0);
+ -(void) applicationWillTerminate:(NSNotification *) aNotification {
+ unsigned remain;
+
+ [X11App prefs_synchronize];
+
+ /* shutdown the X server, it will exit () for us. */
+ DarwinSendDDXEvent(kXquartzQuit, 0);
+
+ /* In case it doesn't, exit anyway after a while. */
+ remain = 10000000;
+ while ((remain = usleep(remain)) > 0);
- exit (1);
+ exit(1);
}
-- (void) server_ready
-{
- x_list *node;
-
- finished_launching = YES;
-
- for (node = pending_apps; node != NULL; node = node->next)
- {
- NSString *filename = node->data;
- [self launch_client:filename];
- [filename release];
- }
-
- x_list_free (pending_apps);
- pending_apps = NULL;
-}
-
-- (OSX_BOOL) application:(NSApplication *)app openFile:(NSString *)filename
+-(void) server_ready {
+ x_list *node;
+
+ finished_launching = YES;
+
+ for (node = pending_apps; node != NULL; node = node->next) {
+ NSString *filename = node->data;
+
+ [self launch_client:filename];
+ [filename release];
+ }
+
+ x_list_free(pending_apps);
+ pending_apps = NULL;
+}
+
+ -(OSX_BOOL) application:(NSApplication *)
+app openFile:(NSString *) filename
{
- const char *name = [filename UTF8String];
-
+ const char *name =[filename UTF8String];
+
if (finished_launching)
- [self launch_client:filename];
- else if (name[0] != ':') /* ignore display names */
- pending_apps = x_list_prepend (pending_apps, [filename retain]);
-
+ [self launch_client:filename];
+ else if (name[0] != ':') /* ignore display names */
+ pending_apps = x_list_prepend(pending_apps,[filename retain]);
+
/* FIXME: report failures. */
return YES;
}
-@end
-
-void X11ControllerMain(int argc, char **argv, char **envp) {
- X11ApplicationMain (argc, argv, envp);
+@end void
+X11ControllerMain(int argc, char **argv, char **envp)
+{
+ X11ApplicationMain(argc, argv, envp);
}
diff --git a/xorg-server/hw/xquartz/applewm.c b/xorg-server/hw/xquartz/applewm.c
index 55976c454..70fb60a18 100644
--- a/xorg-server/hw/xquartz/applewm.c
+++ b/xorg-server/hw/xquartz/applewm.c
@@ -64,38 +64,41 @@ static Atom func (void) { \
}
DEFINE_ATOM_HELPER(xa_native_screen_origin, "_NATIVE_SCREEN_ORIGIN")
-DEFINE_ATOM_HELPER (xa_apple_no_order_in, "_APPLE_NO_ORDER_IN")
+ DEFINE_ATOM_HELPER(xa_apple_no_order_in, "_APPLE_NO_ORDER_IN")
static AppleWMProcsPtr appleWMProcs;
static int WMErrorBase;
-
static unsigned char WMReqCode = 0;
static int WMEventBase = 0;
-static RESTYPE ClientType, EventType; /* resource types for event masks */
+static RESTYPE ClientType, EventType; /* resource types for event masks */
static XID eventResource;
/* Currently selected events */
static unsigned int eventMask = 0;
-static int WMFreeClient (pointer data, XID id);
-static int WMFreeEvents (pointer data, XID id);
-static void SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to);
+static int
+WMFreeClient(pointer data, XID id);
+static int
+WMFreeEvents(pointer data, XID id);
+static void
+SNotifyEvent(xAppleWMNotifyEvent * from, xAppleWMNotifyEvent * to);
typedef struct _WMEvent *WMEventPtr;
typedef struct _WMEvent {
- WMEventPtr next;
- ClientPtr client;
- XID clientResource;
- unsigned int mask;
+ WMEventPtr next;
+ ClientPtr client;
+ XID clientResource;
+ unsigned int mask;
} WMEventRec;
static inline BoxRec
-make_box (int x, int y, int w, int h)
+make_box(int x, int y, int w, int h)
{
BoxRec r;
+
r.x1 = x;
r.y1 = y;
r.x2 = x + w;
@@ -105,9 +108,7 @@ make_box (int x, int y, int w, int h)
/* Updates the _NATIVE_SCREEN_ORIGIN property on the given root window. */
void
-AppleWMSetScreenOrigin(
- WindowPtr pWin
-)
+AppleWMSetScreenOrigin(WindowPtr pWin)
{
int32_t data[2];
@@ -115,7 +116,7 @@ AppleWMSetScreenOrigin(
data[1] = pWin->drawable.pScreen->y + darwinMainScreenY;
dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(),
- XA_INTEGER, 32, PropModeReplace, 2, data, TRUE);
+ XA_INTEGER, 32, PropModeReplace, 2, data, TRUE);
}
/* Window managers can set the _APPLE_NO_ORDER_IN property on windows
@@ -123,9 +124,7 @@ AppleWMSetScreenOrigin(
be mapped but remain ordered-out until the animation
completes (when the Dock will order them in). */
Bool
-AppleWMDoReorderWindow(
- WindowPtr pWin
-)
+AppleWMDoReorderWindow(WindowPtr pWin)
{
Atom atom;
PropertyPtr prop;
@@ -133,18 +132,15 @@ AppleWMDoReorderWindow(
atom = xa_apple_no_order_in();
rc = dixLookupProperty(&prop, pWin, atom, serverClient, DixReadAccess);
-
- if(Success == rc && prop->type == atom)
- return 0;
-
+
+ if (Success == rc && prop->type == atom)
+ return 0;
+
return 1;
}
-
static int
-ProcAppleWMQueryVersion(
- register ClientPtr client
-)
+ProcAppleWMQueryVersion(register ClientPtr client)
{
xAppleWMQueryVersionReply rep;
@@ -159,15 +155,14 @@ ProcAppleWMQueryVersion(
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
- WriteToClient(client, sizeof(xAppleWMQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xAppleWMQueryVersionReply), (char *) &rep);
return Success;
}
-
/* events */
static inline void
-updateEventMask (WMEventPtr *pHead)
+updateEventMask(WMEventPtr * pHead)
{
WMEventPtr pCur;
@@ -176,18 +171,21 @@ updateEventMask (WMEventPtr *pHead)
eventMask |= pCur->mask;
}
-/*ARGSUSED*/
-static int
-WMFreeClient (pointer data, XID id) {
- WMEventPtr pEvent;
- WMEventPtr *pHead, pCur, pPrev;
+ /*ARGSUSED*/ static int
+WMFreeClient(pointer data, XID id)
+{
+ WMEventPtr pEvent;
+ WMEventPtr *pHead, pCur, pPrev;
int i;
pEvent = (WMEventPtr) data;
- i = dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, serverClient, DixReadAccess | DixWriteAccess | DixDestroyAccess);
+ i = dixLookupResourceByType((pointer *) &pHead, eventResource, EventType,
+ serverClient,
+ DixReadAccess | DixWriteAccess |
+ DixDestroyAccess);
if (i == Success && pHead) {
pPrev = 0;
- for (pCur = *pHead; pCur && pCur != pEvent; pCur=pCur->next)
+ for (pCur = *pHead; pCur && pCur != pEvent; pCur = pCur->next)
pPrev = pCur;
if (pCur) {
if (pPrev)
@@ -195,21 +193,21 @@ WMFreeClient (pointer data, XID id) {
else
*pHead = pEvent->next;
}
- updateEventMask (pHead);
+ updateEventMask(pHead);
}
free((pointer) pEvent);
return 1;
}
-/*ARGSUSED*/
-static int
-WMFreeEvents (pointer data, XID id) {
- WMEventPtr *pHead, pCur, pNext;
+ /*ARGSUSED*/ static int
+WMFreeEvents(pointer data, XID id)
+{
+ WMEventPtr *pHead, pCur, pNext;
pHead = (WMEventPtr *) data;
for (pCur = *pHead; pCur; pCur = pNext) {
pNext = pCur->next;
- FreeResource (pCur->clientResource, ClientType);
+ FreeResource(pCur->clientResource, ClientType);
free((pointer) pCur);
}
free((pointer) pHead);
@@ -218,31 +216,30 @@ WMFreeEvents (pointer data, XID id) {
}
static int
-ProcAppleWMSelectInput (register ClientPtr client)
+ProcAppleWMSelectInput(register ClientPtr client)
{
REQUEST(xAppleWMSelectInputReq);
- WMEventPtr pEvent, pNewEvent, *pHead;
- XID clientResource;
- int i;
+ WMEventPtr pEvent, pNewEvent, *pHead;
+ XID clientResource;
+ int i;
- REQUEST_SIZE_MATCH (xAppleWMSelectInputReq);
- i = dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, client, DixWriteAccess);
+ REQUEST_SIZE_MATCH(xAppleWMSelectInputReq);
+ i = dixLookupResourceByType((pointer *) &pHead, eventResource, EventType,
+ client, DixWriteAccess);
if (stuff->mask != 0) {
if (i == Success && pHead) {
/* check for existing entry. */
- for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
- {
- if (pEvent->client == client)
- {
+ for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
+ if (pEvent->client == client) {
pEvent->mask = stuff->mask;
- updateEventMask (pHead);
+ updateEventMask(pHead);
return Success;
}
}
}
/* build the entry */
- pNewEvent = (WMEventPtr) malloc(sizeof (WMEventRec));
+ pNewEvent = (WMEventPtr) malloc(sizeof(WMEventRec));
if (!pNewEvent)
return BadAlloc;
pNewEvent->next = 0;
@@ -252,9 +249,9 @@ ProcAppleWMSelectInput (register ClientPtr client)
* add a resource that will be deleted when
* the client goes away
*/
- clientResource = FakeClientID (client->index);
+ clientResource = FakeClientID(client->index);
pNewEvent->clientResource = clientResource;
- if (!AddResource (clientResource, ClientType, (pointer)pNewEvent))
+ if (!AddResource(clientResource, ClientType, (pointer) pNewEvent))
return BadAlloc;
/*
* create a resource to contain a pointer to the list
@@ -262,21 +259,20 @@ ProcAppleWMSelectInput (register ClientPtr client)
* the list may be arbitrarily rearranged which cannot be
* done through the resource database.
*/
- if (i != Success || !pHead)
- {
- pHead = (WMEventPtr *) malloc(sizeof (WMEventPtr));
+ if (i != Success || !pHead) {
+ pHead = (WMEventPtr *) malloc(sizeof(WMEventPtr));
if (!pHead ||
- !AddResource (eventResource, EventType, (pointer)pHead))
- {
- FreeResource (clientResource, RT_NONE);
+ !AddResource(eventResource, EventType, (pointer) pHead)) {
+ FreeResource(clientResource, RT_NONE);
return BadAlloc;
}
*pHead = 0;
}
pNewEvent->next = *pHead;
*pHead = pNewEvent;
- updateEventMask (pHead);
- } else if (stuff->mask == 0) {
+ updateEventMask(pHead);
+ }
+ else if (stuff->mask == 0) {
/* delete the interest */
if (i == Success && pHead) {
pNewEvent = 0;
@@ -286,16 +282,17 @@ ProcAppleWMSelectInput (register ClientPtr client)
pNewEvent = pEvent;
}
if (pEvent) {
- FreeResource (pEvent->clientResource, ClientType);
+ FreeResource(pEvent->clientResource, ClientType);
if (pNewEvent)
pNewEvent->next = pEvent->next;
else
*pHead = pEvent->next;
free(pEvent);
- updateEventMask (pHead);
+ updateEventMask(pHead);
}
}
- } else {
+ }
+ else {
client->errorValue = stuff->mask;
return BadValue;
}
@@ -307,12 +304,14 @@ ProcAppleWMSelectInput (register ClientPtr client)
*/
void
-AppleWMSendEvent (int type, unsigned int mask, int which, int arg) {
- WMEventPtr *pHead, pEvent;
+AppleWMSendEvent(int type, unsigned int mask, int which, int arg)
+{
+ WMEventPtr *pHead, pEvent;
xAppleWMNotifyEvent se;
- int i;
+ int i;
- i = dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, serverClient, DixReadAccess);
+ i = dixLookupResourceByType((pointer *) &pHead, eventResource, EventType,
+ serverClient, DixReadAccess);
if (i != Success || !pHead)
return;
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
@@ -322,24 +321,21 @@ AppleWMSendEvent (int type, unsigned int mask, int which, int arg) {
se.kind = which;
se.arg = arg;
se.time = currentTime.milliseconds;
- WriteEventsToClient (pEvent->client, 1, (xEvent *) &se);
+ WriteEventsToClient(pEvent->client, 1, (xEvent *) &se);
}
}
/* Safe to call from any thread. */
unsigned int
-AppleWMSelectedEvents (void)
+AppleWMSelectedEvents(void)
{
return eventMask;
}
-
/* general utility functions */
static int
-ProcAppleWMDisableUpdate(
- register ClientPtr client
-)
+ProcAppleWMDisableUpdate(register ClientPtr client)
{
REQUEST_SIZE_MATCH(xAppleWMDisableUpdateReq);
@@ -349,9 +345,7 @@ ProcAppleWMDisableUpdate(
}
static int
-ProcAppleWMReenableUpdate(
- register ClientPtr client
-)
+ProcAppleWMReenableUpdate(register ClientPtr client)
{
REQUEST_SIZE_MATCH(xAppleWMReenableUpdateReq);
@@ -359,41 +353,37 @@ ProcAppleWMReenableUpdate(
return Success;
}
-
/* window functions */
static int
-ProcAppleWMSetWindowMenu(
- register ClientPtr client
-)
+ProcAppleWMSetWindowMenu(register ClientPtr client)
{
const char *bytes, **items;
char *shortcuts;
int max_len, nitems, i, j;
+
REQUEST(xAppleWMSetWindowMenuReq);
REQUEST_AT_LEAST_SIZE(xAppleWMSetWindowMenuReq);
nitems = stuff->nitems;
- items = malloc(sizeof (char *) * nitems);
- shortcuts = malloc(sizeof (char) * nitems);
+ items = malloc(sizeof(char *) * nitems);
+ shortcuts = malloc(sizeof(char) * nitems);
max_len = (stuff->length << 2) - sizeof(xAppleWMSetWindowMenuReq);
bytes = (char *) &stuff[1];
- for (i = j = 0; i < max_len && j < nitems;)
- {
+ for (i = j = 0; i < max_len && j < nitems;) {
shortcuts[j] = bytes[i++];
items[j++] = bytes + i;
- while (i < max_len)
- {
+ while (i < max_len) {
if (bytes[i++] == 0)
break;
}
}
- X11ApplicationSetWindowMenu (nitems, items, shortcuts);
+ X11ApplicationSetWindowMenu(nitems, items, shortcuts);
free(items);
free(shortcuts);
@@ -401,9 +391,7 @@ ProcAppleWMSetWindowMenu(
}
static int
-ProcAppleWMSetWindowMenuCheck(
- register ClientPtr client
-)
+ProcAppleWMSetWindowMenuCheck(register ClientPtr client)
{
REQUEST(xAppleWMSetWindowMenuCheckReq);
@@ -413,9 +401,7 @@ ProcAppleWMSetWindowMenuCheck(
}
static int
-ProcAppleWMSetFrontProcess(
- register ClientPtr client
-)
+ProcAppleWMSetFrontProcess(register ClientPtr client)
{
REQUEST_SIZE_MATCH(xAppleWMSetFrontProcessReq);
@@ -432,16 +418,15 @@ ProcAppleWMSetWindowLevel(register ClientPtr client)
REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq);
- if (Success != dixLookupWindow(&pWin, stuff->window, client,
- DixReadAccess))
+ if (Success != dixLookupWindow(&pWin, stuff->window, client, DixReadAccess))
return BadValue;
if (stuff->level >= AppleWMNumWindowLevels) {
return BadValue;
}
- err = appleWMProcs->SetWindowLevel(pWin, stuff->level);
- if (err != Success) {
+ err = appleWMProcs->SetWindowLevel(pWin, stuff->level);
+ if (err != Success) {
return err;
}
@@ -453,10 +438,10 @@ ProcAppleWMSendPSN(register ClientPtr client)
{
REQUEST(xAppleWMSendPSNReq);
int err;
-
+
REQUEST_SIZE_MATCH(xAppleWMSendPSNReq);
-
- if(!appleWMProcs->SendPSN)
+
+ if (!appleWMProcs->SendPSN)
return BadRequest;
err = appleWMProcs->SendPSN(stuff->psn_hi, stuff->psn_lo);
@@ -471,21 +456,25 @@ static int
ProcAppleWMAttachTransient(register ClientPtr client)
{
WindowPtr pWinChild, pWinParent;
+
REQUEST(xAppleWMAttachTransientReq);
int err;
-
+
REQUEST_SIZE_MATCH(xAppleWMAttachTransientReq);
-
- if(!appleWMProcs->AttachTransient)
+
+ if (!appleWMProcs->AttachTransient)
return BadRequest;
- if (Success != dixLookupWindow(&pWinChild, stuff->child, client, DixReadAccess))
+ if (Success !=
+ dixLookupWindow(&pWinChild, stuff->child, client, DixReadAccess))
return BadValue;
- if(stuff->parent) {
- if(Success != dixLookupWindow(&pWinParent, stuff->parent, client, DixReadAccess))
+ if (stuff->parent) {
+ if (Success !=
+ dixLookupWindow(&pWinParent, stuff->parent, client, DixReadAccess))
return BadValue;
- } else {
+ }
+ else {
pWinParent = NULL;
}
@@ -498,9 +487,7 @@ ProcAppleWMAttachTransient(register ClientPtr client)
}
static int
-ProcAppleWMSetCanQuit(
- register ClientPtr client
-)
+ProcAppleWMSetCanQuit(register ClientPtr client)
{
REQUEST(xAppleWMSetCanQuitReq);
@@ -509,17 +496,15 @@ ProcAppleWMSetCanQuit(
X11ApplicationSetCanQuit(stuff->state);
return Success;
}
-
/* frame functions */
static int
-ProcAppleWMFrameGetRect(
- register ClientPtr client
-)
+ProcAppleWMFrameGetRect(register ClientPtr client)
{
xAppleWMFrameGetRectReply rep;
BoxRec ir, or, rr;
+
REQUEST(xAppleWMFrameGetRectReq);
REQUEST_SIZE_MATCH(xAppleWMFrameGetRectReq);
@@ -527,13 +512,12 @@ ProcAppleWMFrameGetRect(
rep.length = 0;
rep.sequenceNumber = client->sequence;
- ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
- or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh);
+ ir = make_box(stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+ or = make_box(stuff->ox, stuff->oy, stuff->ow, stuff->oh);
if (appleWMProcs->FrameGetRect(stuff->frame_rect,
stuff->frame_class,
- &or, &ir, &rr) != Success)
- {
+ &or, &ir, &rr) != Success) {
return BadValue;
}
@@ -542,18 +526,17 @@ ProcAppleWMFrameGetRect(
rep.w = rr.x2 - rr.x1;
rep.h = rr.y2 - rr.y1;
- WriteToClient(client, sizeof(xAppleWMFrameGetRectReply), (char *)&rep);
+ WriteToClient(client, sizeof(xAppleWMFrameGetRectReply), (char *) &rep);
return Success;
}
static int
-ProcAppleWMFrameHitTest(
- register ClientPtr client
-)
+ProcAppleWMFrameHitTest(register ClientPtr client)
{
xAppleWMFrameHitTestReply rep;
BoxRec ir, or;
int ret;
+
REQUEST(xAppleWMFrameHitTestReq);
REQUEST_SIZE_MATCH(xAppleWMFrameHitTestReq);
@@ -561,40 +544,37 @@ ProcAppleWMFrameHitTest(
rep.length = 0;
rep.sequenceNumber = client->sequence;
- ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
- or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh);
+ ir = make_box(stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+ or = make_box(stuff->ox, stuff->oy, stuff->ow, stuff->oh);
if (appleWMProcs->FrameHitTest(stuff->frame_class, stuff->px,
- stuff->py, &or, &ir, &ret) != Success)
- {
+ stuff->py, &or, &ir, &ret) != Success) {
return BadValue;
}
rep.ret = ret;
- WriteToClient(client, sizeof(xAppleWMFrameHitTestReply), (char *)&rep);
+ WriteToClient(client, sizeof(xAppleWMFrameHitTestReply), (char *) &rep);
return Success;
}
static int
-ProcAppleWMFrameDraw(
- register ClientPtr client
-)
+ProcAppleWMFrameDraw(register ClientPtr client)
{
BoxRec ir, or;
unsigned int title_length, title_max;
unsigned char *title_bytes;
+
REQUEST(xAppleWMFrameDrawReq);
WindowPtr pWin;
REQUEST_AT_LEAST_SIZE(xAppleWMFrameDrawReq);
- if (Success != dixLookupWindow(&pWin, stuff->window, client,
- DixReadAccess))
+ if (Success != dixLookupWindow(&pWin, stuff->window, client, DixReadAccess))
return BadValue;
- ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
- or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh);
+ ir = make_box(stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+ or = make_box(stuff->ox, stuff->oy, stuff->ow, stuff->oh);
title_length = stuff->title_length;
title_max = (stuff->length << 2) - sizeof(xAppleWMFrameDrawReq);
@@ -613,19 +593,15 @@ ProcAppleWMFrameDraw(
return Success;
}
-
/* dispatch */
static int
-ProcAppleWMDispatch (
- register ClientPtr client
-)
+ProcAppleWMDispatch(register ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_AppleWMQueryVersion:
return ProcAppleWMQueryVersion(client);
}
@@ -633,8 +609,7 @@ ProcAppleWMDispatch (
if (!LocalClient(client))
return WMErrorBase + AppleWMClientNotLocal;
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_AppleWMSelectInput:
return ProcAppleWMSelectInput(client);
case X_AppleWMDisableUpdate:
@@ -667,18 +642,17 @@ ProcAppleWMDispatch (
}
static void
-SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to) {
+SNotifyEvent(xAppleWMNotifyEvent * from, xAppleWMNotifyEvent * to)
+{
to->type = from->type;
to->kind = from->kind;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->time, to->time);
- cpswapl (from->arg, to->arg);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->time, to->time);
+ cpswapl(from->arg, to->arg);
}
static int
-SProcAppleWMQueryVersion(
- register ClientPtr client
-)
+SProcAppleWMQueryVersion(register ClientPtr client)
{
REQUEST(xAppleWMQueryVersionReq);
swaps(&stuff->length);
@@ -686,9 +660,7 @@ SProcAppleWMQueryVersion(
}
static int
-SProcAppleWMDispatch (
- register ClientPtr client
-)
+SProcAppleWMDispatch(register ClientPtr client)
{
REQUEST(xReq);
@@ -697,8 +669,7 @@ SProcAppleWMDispatch (
return WMErrorBase + AppleWMClientNotLocal;
/* only local clients are allowed WM access */
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_AppleWMQueryVersion:
return SProcAppleWMQueryVersion(client);
default:
@@ -707,10 +678,9 @@ SProcAppleWMDispatch (
}
void
-AppleWMExtensionInit(
- AppleWMProcsPtr procsPtr)
+AppleWMExtensionInit(AppleWMProcsPtr procsPtr)
{
- ExtensionEntry* extEntry;
+ ExtensionEntry *extEntry;
ClientType = CreateNewResourceType(WMFreeClient, "WMClient");
EventType = CreateNewResourceType(WMFreeEvents, "WMEvent");
@@ -722,14 +692,13 @@ AppleWMExtensionInit(
AppleWMNumberErrors,
ProcAppleWMDispatch,
SProcAppleWMDispatch,
- NULL,
- StandardMinorOpcode)))
- {
+ NULL, StandardMinorOpcode))) {
size_t i;
- WMReqCode = (unsigned char)extEntry->base;
+
+ WMReqCode = (unsigned char) extEntry->base;
WMErrorBase = extEntry->errorBase;
WMEventBase = extEntry->eventBase;
- for (i=0; i < AppleWMNumberEvents; i++)
+ for (i = 0; i < AppleWMNumberEvents; i++)
EventSwapVector[WMEventBase + i] = (EventSwapPtr) SNotifyEvent;
appleWMProcs = procsPtr;
}
diff --git a/xorg-server/hw/xquartz/applewmExt.h b/xorg-server/hw/xquartz/applewmExt.h
index c46a7bde4..2ad9f45b9 100644
--- a/xorg-server/hw/xquartz/applewmExt.h
+++ b/xorg-server/hw/xquartz/applewmExt.h
@@ -40,20 +40,21 @@ typedef int xp_frame_class;
typedef int xp_frame_rect;
#endif
-typedef int (*DisableUpdateProc)(void);
-typedef int (*EnableUpdateProc)(void);
-typedef int (*SetWindowLevelProc)(WindowPtr pWin, int level);
-typedef int (*FrameGetRectProc)(xp_frame_rect type, xp_frame_class class, const BoxRec *outer,
- const BoxRec *inner, BoxRec *ret);
-typedef int (*FrameHitTestProc)(xp_frame_class class, int x, int y,
- const BoxRec *outer,
- const BoxRec *inner, int *ret);
-typedef int (*FrameDrawProc)(WindowPtr pWin, xp_frame_class class, xp_frame_attr attr,
- const BoxRec *outer, const BoxRec *inner,
- unsigned int title_len,
- const unsigned char *title_bytes);
-typedef int (*SendPSNProc)(uint32_t hi, uint32_t lo);
-typedef int (*AttachTransientProc)(WindowPtr pWinChild, WindowPtr pWinParent);
+typedef int (*DisableUpdateProc) (void);
+typedef int (*EnableUpdateProc) (void);
+typedef int (*SetWindowLevelProc) (WindowPtr pWin, int level);
+typedef int (*FrameGetRectProc) (xp_frame_rect type, xp_frame_class class,
+ const BoxRec * outer, const BoxRec * inner,
+ BoxRec * ret);
+typedef int (*FrameHitTestProc) (xp_frame_class class, int x, int y,
+ const BoxRec * outer, const BoxRec * inner,
+ int *ret);
+typedef int (*FrameDrawProc) (WindowPtr pWin, xp_frame_class class,
+ xp_frame_attr attr, const BoxRec * outer,
+ const BoxRec * inner, unsigned int title_len,
+ const unsigned char *title_bytes);
+typedef int (*SendPSNProc) (uint32_t hi, uint32_t lo);
+typedef int (*AttachTransientProc) (WindowPtr pWinChild, WindowPtr pWinParent);
/*
* AppleWM implementation function list
@@ -69,27 +70,19 @@ typedef struct _AppleWMProcs {
AttachTransientProc AttachTransient;
} AppleWMProcsRec, *AppleWMProcsPtr;
-void AppleWMExtensionInit(
- AppleWMProcsPtr procsPtr
-);
+void AppleWMExtensionInit(AppleWMProcsPtr procsPtr);
-void AppleWMSetScreenOrigin(
- WindowPtr pWin
-);
+void AppleWMSetScreenOrigin(WindowPtr pWin);
-Bool AppleWMDoReorderWindow(
- WindowPtr pWin
-);
+Bool AppleWMDoReorderWindow(WindowPtr pWin);
-void AppleWMSendEvent(
- int /* type */,
- unsigned int /* mask */,
- int /* which */,
- int /* arg */
-);
+void AppleWMSendEvent(int /* type */ ,
+ unsigned int /* mask */ ,
+ int /* which */ ,
+ int /* arg */
+ );
-unsigned int AppleWMSelectedEvents(
- void
-);
+unsigned int AppleWMSelectedEvents(void
+ );
-#endif /* _APPLEWMEXT_H_ */
+#endif /* _APPLEWMEXT_H_ */
diff --git a/xorg-server/hw/xquartz/console_redirect.c b/xorg-server/hw/xquartz/console_redirect.c
index 70a819e42..0f96a9512 100644
--- a/xorg-server/hw/xquartz/console_redirect.c
+++ b/xorg-server/hw/xquartz/console_redirect.c
@@ -94,12 +94,15 @@ static int n_redirect_fds = 0;
* were processed. If the pipe is still open, the number of read bytes
* is returned.
*/
-static inline int _read_redirect(int fd, int flush) {
+static inline int
+_read_redirect(int fd, int flush)
+{
int total_read = 0;
int nbytes;
asl_redirect *aslr = &redirect_fds[fd];
- while((nbytes = read(fd, aslr->w, BUF_SIZE - (aslr->w - aslr->buf) - 1)) > 0) {
+ while ((nbytes =
+ read(fd, aslr->w, BUF_SIZE - (aslr->w - aslr->buf) - 1)) > 0) {
char *s, *p;
/* Increment our returned number read */
@@ -109,17 +112,19 @@ static inline int _read_redirect(int fd, int flush) {
aslr->buf[nbytes] = '\0';
/* One line at a time */
- for(p=aslr->buf; *p && (p - aslr->buf) < nbytes; p = s + 1) {
+ for (p = aslr->buf; *p && (p - aslr->buf) < nbytes; p = s + 1) {
// Find null or \n
- for(s=p; *s && *s != '\n'; s++);
- if(*s == '\n') {
- *s='\0';
+ for (s = p; *s && *s != '\n'; s++);
+ if (*s == '\n') {
+ *s = '\0';
asl_log(aslr->asl, aslr->msg, aslr->level, "%s", p);
- } else if(aslr->buf != p) {
+ }
+ else if (aslr->buf != p) {
memmove(aslr->buf, p, BUF_SIZE - (p - aslr->buf));
aslr->w = aslr->buf + (s - p);
break;
- } else if(nbytes == BUF_SIZE - 1) {
+ }
+ else if (nbytes == BUF_SIZE - 1) {
asl_log(aslr->asl, aslr->msg, aslr->level, "%s", p);
aslr->w = aslr->buf;
break;
@@ -128,29 +133,34 @@ static inline int _read_redirect(int fd, int flush) {
}
/* Flush if requested or we're at EOF */
- if(flush || nbytes == 0) {
- if(aslr->w > aslr->buf) {
+ if (flush || nbytes == 0) {
+ if (aslr->w > aslr->buf) {
*aslr->w = '\0';
asl_log(aslr->asl, aslr->msg, aslr->level, "%s", aslr->buf);
}
}
- if(nbytes == 0)
+ if (nbytes == 0)
return EOF;
return total_read;
}
#ifdef HAVE_LIBDISPATCH
-static void read_from_source(void *_source) {
- dispatch_source_t source = (dispatch_source_t)_source;
+static void
+read_from_source(void *_source)
+{
+ dispatch_source_t source = (dispatch_source_t) _source;
int fd = dispatch_source_get_handle(source);
- if(_read_redirect(fd, 0) == EOF) {
+
+ if (_read_redirect(fd, 0) == EOF) {
dispatch_source_cancel(source);
}
}
-static void cancel_source(void *_source) {
- dispatch_source_t source = (dispatch_source_t)_source;
+static void
+cancel_source(void *_source)
+{
+ dispatch_source_t source = (dispatch_source_t) _source;
int fd = dispatch_source_get_handle(source);
asl_redirect *aslr = &redirect_fds[fd];
@@ -164,63 +174,70 @@ static void cancel_source(void *_source) {
dispatch_group_leave(read_source_group);
}
-#else /* !HAVE_LIBDISPATCH */
-static void *redirect_thread(void *ctx __unused) {
+#else /* !HAVE_LIBDISPATCH */
+static void *
+redirect_thread(void *ctx __unused)
+{
struct kevent ev;
int n;
- while(1) {
+ while (1) {
n = kevent(kq, NULL, 0, &ev, 1, NULL);
/* Bail on errors */
- if(n < 0) {
- asl_log(NULL, NULL, ASL_LEVEL_ERR, "kevent failure: %s", strerror(errno));
+ if (n < 0) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "kevent failure: %s",
+ strerror(errno));
break;
}
-
+
/* This should not happen */
- if(n == 0)
+ if (n == 0)
continue;
- switch(ev.filter) {
- case EVFILT_READ:
- pthread_mutex_lock(&redirect_fds_lock);
- {
- int fd = ev.ident;
- int close_fd = 0;
- asl_redirect *aslr = &redirect_fds[fd];
-
- if(fd < 0 || fd >= n_redirect_fds || aslr->buf == NULL) {
- asl_log(NULL, NULL, ASL_LEVEL_ERR, "Unexpected file descriptor: %d", fd);
- goto next;
- }
+ switch (ev.filter) {
+ case EVFILT_READ:
+ pthread_mutex_lock(&redirect_fds_lock);
+ {
+ int fd = ev.ident;
+ int close_fd = 0;
+ asl_redirect *aslr = &redirect_fds[fd];
+
+ if (fd < 0 || fd >= n_redirect_fds || aslr->buf == NULL) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR,
+ "Unexpected file descriptor: %d", fd);
+ goto next;
+ }
- if(ev.flags & EV_EOF) {
- close_fd = 1;
- if(EOF != _read_redirect(fd, 1)) {
- asl_log(NULL, NULL, ASL_LEVEL_ERR, "kevent reported EOF on %d, but read doesn't concur.", fd);
- }
- } else {
- close_fd = (EOF == _read_redirect(fd, 0));
- }
-
- if(close_fd) {
- EV_SET(&ev, fd, EVFILT_READ, EV_DELETE, 0, 0, 0);
- kevent(kq, &ev, 1, NULL, 0, NULL);
- close(fd);
- free(aslr->buf);
- memset(aslr, 0, sizeof(*aslr));
+ if (ev.flags & EV_EOF) {
+ close_fd = 1;
+ if (EOF != _read_redirect(fd, 1)) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR,
+ "kevent reported EOF on %d, but read doesn't concur.",
+ fd);
}
}
- next:
- pthread_mutex_unlock(&redirect_fds_lock);
+ else {
+ close_fd = (EOF == _read_redirect(fd, 0));
+ }
+
+ if (close_fd) {
+ EV_SET(&ev, fd, EVFILT_READ, EV_DELETE, 0, 0, 0);
+ kevent(kq, &ev, 1, NULL, 0, NULL);
+ close(fd);
+ free(aslr->buf);
+ memset(aslr, 0, sizeof(*aslr));
+ }
+ }
+ next:
+ pthread_mutex_unlock(&redirect_fds_lock);
- case EVFILT_TIMER:
- if(ev.udata == ASL_REDIRECT_TERMINATE)
- return NULL;
+ case EVFILT_TIMER:
+ if (ev.udata == ASL_REDIRECT_TERMINATE)
+ return NULL;
- default:
- ;;
+ default:
+ ;;
}
}
@@ -228,9 +245,11 @@ static void *redirect_thread(void *ctx __unused) {
}
#endif
-static void redirect_atexit(void) {
+static void
+redirect_atexit(void)
+{
/* stdout is linebuffered, so flush the buffer */
- if(redirect_fds[STDOUT_FILENO].buf)
+ if (redirect_fds[STDOUT_FILENO].buf)
fflush(stdout);
#ifdef HAVE_LIBDISPATCH
@@ -238,30 +257,35 @@ static void redirect_atexit(void) {
int i;
/* Cancel all of our dispatch sources, so they flush to ASL */
- for(i=0; i < n_redirect_fds; i++)
- if(redirect_fds[i].read_source)
+ for (i = 0; i < n_redirect_fds; i++)
+ if (redirect_fds[i].read_source)
dispatch_source_cancel(redirect_fds[i].read_source);
/* Wait at least three seconds for our sources to flush to ASL */
- dispatch_group_wait(read_source_group, dispatch_time(DISPATCH_TIME_NOW, 3LL * NSEC_PER_SEC));
+ dispatch_group_wait(read_source_group,
+ dispatch_time(DISPATCH_TIME_NOW,
+ 3LL * NSEC_PER_SEC));
}
#else
{
struct kevent ev;
/* Tell our reader thread it is time to pack up and go home */
- EV_SET(&ev, 0, EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0, 0, ASL_REDIRECT_TERMINATE);
+ EV_SET(&ev, 0, EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0, 0,
+ ASL_REDIRECT_TERMINATE);
kevent(kq, &ev, 1, NULL, 0, NULL);
-
+
pthread_join(redirect_pthread, NULL);
}
#endif
}
#ifdef HAVE_LIBDISPATCH
-static void xq_asl_init(void *ctx __unused)
+static void
+xq_asl_init(void *ctx __unused)
#else
-static void xq_asl_init(void)
+static void
+xq_asl_init(void)
#endif
{
assert((redirect_fds = calloc(16, sizeof(*redirect_fds))) != NULL);
@@ -281,20 +305,24 @@ static void xq_asl_init(void)
atexit(redirect_atexit);
}
-int xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd) {
+int
+xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd)
+{
#ifdef HAVE_LIBDISPATCH
int err __block = 0;
static dispatch_once_t once_control;
+
dispatch_once_f(&once_control, NULL, xq_asl_init);
#else
int err = 0;
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+
assert(pthread_once(&once_control, xq_asl_init) == 0);
#endif
-
- if(fd < 0)
+
+ if (fd < 0)
return EBADF;
-
+
#ifdef HAVE_LIBDISPATCH
#define BLOCK_DONE return
dispatch_sync(redirect_serial_q, ^
@@ -304,10 +332,11 @@ int xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd) {
#endif
{
/* Reallocate if we need more space */
- if(fd >= n_redirect_fds) {
+ if (fd >= n_redirect_fds) {
size_t new_n = 1 << (ffs(fd) + 1);
- asl_redirect *new_array = realloc(redirect_fds, new_n * sizeof(*redirect_fds));
- if(!new_array) {
+ asl_redirect *new_array =
+ realloc(redirect_fds, new_n * sizeof(*redirect_fds));
+ if (!new_array) {
err = errno;
BLOCK_DONE;
}
@@ -315,33 +344,35 @@ int xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd) {
memset(redirect_fds + n_redirect_fds, 0, new_n - n_redirect_fds);
n_redirect_fds = new_n;
}
-
+
/* If we're already listening on it, return error. */
- if(redirect_fds[fd].buf != NULL) {
+ if (redirect_fds[fd].buf != NULL) {
err = EBADF;
BLOCK_DONE;
}
-
+
/* Initialize our buffer */
- redirect_fds[fd].buf = (char *)malloc(BUF_SIZE);
- if(redirect_fds[fd].buf == NULL) {
+ redirect_fds[fd].buf = (char *) malloc(BUF_SIZE);
+ if (redirect_fds[fd].buf == NULL) {
err = errno;
BLOCK_DONE;
}
redirect_fds[fd].w = redirect_fds[fd].buf;
-
+
/* Store our ASL settings */
redirect_fds[fd].level = level;
redirect_fds[fd].asl = asl;
redirect_fds[fd].msg = msg;
-
+
/* Don't block on reads from this fd */
fcntl(fd, F_SETFL, O_NONBLOCK);
-
+
/* Start listening */
#ifdef HAVE_LIBDISPATCH
{
- dispatch_source_t read_source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, fd, 0, redirect_serial_q);
+ dispatch_source_t read_source =
+ dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, fd, 0,
+ redirect_serial_q);
redirect_fds[fd].read_source = read_source;
dispatch_set_context(read_source, read_source);
dispatch_source_set_event_handler_f(read_source, read_from_source);
@@ -352,6 +383,7 @@ int xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd) {
#else
{
struct kevent ev;
+
EV_SET(&ev, fd, EVFILT_READ, EV_ADD, 0, 0, 0);
kevent(kq, &ev, 1, NULL, 0, NULL);
}
@@ -360,36 +392,38 @@ int xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd) {
#ifdef HAVE_LIBDISPATCH
);
#else
-done:
+ done:
assert(pthread_mutex_unlock(&redirect_fds_lock) == 0);
#endif
#undef BLOCK_DONE
-
+
return err;
}
-int xq_asl_capture_fd(aslclient asl, aslmsg msg, int level, int fd) {
+int
+xq_asl_capture_fd(aslclient asl, aslmsg msg, int level, int fd)
+{
int pipepair[2];
-
+
/* Create pipe */
- if(pipe(pipepair) == -1)
+ if (pipe(pipepair) == -1)
return errno;
-
+
/* Close the read fd but not the write fd on exec */
- if(fcntl(pipepair[0], F_SETFD, FD_CLOEXEC) == -1)
+ if (fcntl(pipepair[0], F_SETFD, FD_CLOEXEC) == -1)
return errno;
/* Replace the existing fd */
- if(dup2(pipepair[1], fd) == -1) {
+ if (dup2(pipepair[1], fd) == -1) {
close(pipepair[0]);
close(pipepair[1]);
return errno;
}
/* If we capture STDOUT_FILENO, make sure we linebuffer stdout */
- if(fd == STDOUT_FILENO)
+ if (fd == STDOUT_FILENO)
setlinebuf(stdout);
-
+
/* Close the duplicate fds since they've been reassigned */
close(pipepair[1]);
@@ -398,7 +432,9 @@ int xq_asl_capture_fd(aslclient asl, aslmsg msg, int level, int fd) {
}
#ifdef DEBUG_CONSOLE_REDIRECT
-int main(int argc __unused, char **argv __unused) {
+int
+main(int argc __unused, char **argv __unused)
+{
xq_asl_capture_fd(NULL, NULL, ASL_LEVEL_NOTICE, STDOUT_FILENO);
xq_asl_capture_fd(NULL, NULL, ASL_LEVEL_ERR, STDERR_FILENO);
diff --git a/xorg-server/hw/xquartz/darwin.c b/xorg-server/hw/xquartz/darwin.c
index 465a96d12..a0ce377b1 100644
--- a/xorg-server/hw/xquartz/darwin.c
+++ b/xorg-server/hw/xquartz/darwin.c
@@ -38,10 +38,10 @@
#include "servermd.h"
#include "inputstr.h"
#include "scrnintstr.h"
-#include "mibstore.h" // mi backing store implementation
-#include "mipointer.h" // mi software cursor
-#include "micmap.h" // mi colormap code
-#include "fb.h" // fb framebuffer code
+#include "mibstore.h" // mi backing store implementation
+#include "mipointer.h" // mi software cursor
+#include "micmap.h" // mi colormap code
+#include "fb.h" // fb framebuffer code
#include "site.h"
#include "globals.h"
#include "dix.h"
@@ -79,21 +79,24 @@
aslclient aslc;
-void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...) {
+void
+xq_asl_log(int level, const char *subsystem, const char *file,
+ const char *function, int line, const char *fmt, ...)
+{
va_list args;
aslmsg msg = asl_new(ASL_TYPE_MSG);
- if(msg) {
+ if (msg) {
char *_line;
asl_set(msg, "File", file);
asl_set(msg, "Function", function);
asprintf(&_line, "%d", line);
- if(_line) {
+ if (_line) {
asl_set(msg, "Line", _line);
free(_line);
}
- if(subsystem)
+ if (subsystem)
asl_set(msg, "Subsystem", subsystem);
}
@@ -101,82 +104,86 @@ void xq_asl_log (int level, const char *subsystem, const char *file, const char
asl_vlog(aslc, msg, level, fmt, args);
va_end(args);
- if(msg)
+ if (msg)
asl_free(msg);
}
/*
* X server shared global variables
*/
-int darwinScreensFound = 0;
-DevPrivateKeyRec darwinScreenKeyRec;
-io_connect_t darwinParamConnect = 0;
-int darwinEventReadFD = -1;
-int darwinEventWriteFD = -1;
+int darwinScreensFound = 0;
+DevPrivateKeyRec darwinScreenKeyRec;
+io_connect_t darwinParamConnect = 0;
+int darwinEventReadFD = -1;
+int darwinEventWriteFD = -1;
+
// int darwinMouseAccelChange = 1;
-int darwinFakeButtons = 0;
+int darwinFakeButtons = 0;
// location of X11's (0,0) point in global screen coordinates
-int darwinMainScreenX = 0;
-int darwinMainScreenY = 0;
+int darwinMainScreenX = 0;
+int darwinMainScreenY = 0;
// parameters read from the command line or user preferences
-int darwinDesiredDepth = -1;
-int darwinSyncKeymap = FALSE;
+int darwinDesiredDepth = -1;
+int darwinSyncKeymap = FALSE;
// modifier masks for faking mouse buttons - ANY of these bits trigger it (not all)
#ifdef NX_DEVICELCMDKEYMASK
-int darwinFakeMouse2Mask = NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK;
-int darwinFakeMouse3Mask = NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK;
+int darwinFakeMouse2Mask = NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK;
+int darwinFakeMouse3Mask = NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK;
#else
-int darwinFakeMouse2Mask = NX_ALTERNATEMASK;
-int darwinFakeMouse3Mask = NX_COMMANDMASK;
+int darwinFakeMouse2Mask = NX_ALTERNATEMASK;
+int darwinFakeMouse3Mask = NX_COMMANDMASK;
#endif
// Modifier mask for overriding event delivery to appkit (might be useful to set this to rcommand for input menu
-unsigned int darwinAppKitModMask = 0; // Any of these bits
+unsigned int darwinAppKitModMask = 0; // Any of these bits
// Modifier mask for items in the Window menu (0 and -1 cause shortcuts to be disabled)
-unsigned int windowItemModMask = NX_COMMANDMASK;
+unsigned int windowItemModMask = NX_COMMANDMASK;
// devices
-DeviceIntPtr darwinKeyboard = NULL;
-DeviceIntPtr darwinPointer = NULL;
-DeviceIntPtr darwinTabletStylus = NULL;
-DeviceIntPtr darwinTabletCursor = NULL;
-DeviceIntPtr darwinTabletEraser = NULL;
+DeviceIntPtr darwinKeyboard = NULL;
+DeviceIntPtr darwinPointer = NULL;
+DeviceIntPtr darwinTabletStylus = NULL;
+DeviceIntPtr darwinTabletCursor = NULL;
+DeviceIntPtr darwinTabletEraser = NULL;
// Common pixmap formats
static PixmapFormatRec formats[] = {
- { 1, 1, BITMAP_SCANLINE_PAD },
- { 4, 8, BITMAP_SCANLINE_PAD },
- { 8, 8, BITMAP_SCANLINE_PAD },
- { 15, 16, BITMAP_SCANLINE_PAD },
- { 16, 16, BITMAP_SCANLINE_PAD },
- { 24, 32, BITMAP_SCANLINE_PAD },
- { 32, 32, BITMAP_SCANLINE_PAD }
+ {1, 1, BITMAP_SCANLINE_PAD},
+ {4, 8, BITMAP_SCANLINE_PAD},
+ {8, 8, BITMAP_SCANLINE_PAD},
+ {15, 16, BITMAP_SCANLINE_PAD},
+ {16, 16, BITMAP_SCANLINE_PAD},
+ {24, 32, BITMAP_SCANLINE_PAD},
+ {32, 32, BITMAP_SCANLINE_PAD}
};
-const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]);
+
+const int NUMFORMATS = sizeof(formats) / sizeof(formats[0]);
void
DarwinPrintBanner(void)
-{
- ErrorF("Xquartz starting:\n");
- ErrorF("X.Org X Server %s\n", XSERVER_VERSION);
- ErrorF("Build Date: %s\n", BUILD_DATE );
+{
+ ErrorF("Xquartz starting:\n");
+ ErrorF("X.Org X Server %s\n", XSERVER_VERSION);
+ ErrorF("Build Date: %s\n", BUILD_DATE);
}
-
/*
* DarwinSaveScreen
* X screensaver support. Not implemented.
*/
-static Bool DarwinSaveScreen(ScreenPtr pScreen, int on)
+static Bool
+DarwinSaveScreen(ScreenPtr pScreen, int on)
{
// FIXME
if (on == SCREEN_SAVER_FORCER) {
- } else if (on == SCREEN_SAVER_ON) {
- } else {
+ }
+ else if (on == SCREEN_SAVER_ON) {
+ }
+ else {
}
return TRUE;
}
@@ -186,14 +193,16 @@ static Bool DarwinSaveScreen(ScreenPtr pScreen, int on)
* This is a callback from dix during AddScreen() from InitOutput().
* Initialize the screen and communicate information about it back to dix.
*/
-static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) {
- int dpi;
- static int foundIndex = 0;
- Bool ret;
+static Bool
+DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
+{
+ int dpi;
+ static int foundIndex = 0;
+ Bool ret;
DarwinFramebufferPtr dfb;
if (!dixRegisterPrivateKey(&darwinScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
// reset index of found screens for each server generation
if (index == 0) {
@@ -212,23 +221,27 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv
// setup hardware/mode specific details
ret = QuartzAddScreen(foundIndex, pScreen);
foundIndex++;
- if (! ret)
+ if (!ret)
return FALSE;
// setup a single visual appropriate for our pixel type
- if(!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB,
- dfb->preferredCVC, dfb->redMask,
- dfb->greenMask, dfb->blueMask)) {
+ if (!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB,
+ dfb->preferredCVC, dfb->redMask,
+ dfb->greenMask, dfb->blueMask)) {
return FALSE;
}
-
+
// TODO: Make PseudoColor visuals not suck in TrueColor mode
// if(dfb->depth > 8)
// miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
- if(dfb->depth > 15)
- miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor, RM_ARGB(0,5,5,5), GM_ARGB(0,5,5,5), BM_ARGB(0,5,5,5));
- if(dfb->depth > 24)
- miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor, RM_ARGB(0,8,8,8), GM_ARGB(0,8,8,8), BM_ARGB(0,8,8,8));
+ if (dfb->depth > 15)
+ miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor,
+ RM_ARGB(0, 5, 5, 5), GM_ARGB(0, 5, 5, 5),
+ BM_ARGB(0, 5, 5, 5));
+ if (dfb->depth > 24)
+ miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor,
+ RM_ARGB(0, 8, 8, 8), GM_ARGB(0, 8, 8, 8),
+ BM_ARGB(0, 8, 8, 8));
miSetPixmapDepths();
@@ -240,17 +253,16 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv
dpi = 96;
// initialize fb
- if (! fbScreenInit(pScreen,
- dfb->framebuffer, // pointer to screen bitmap
- dfb->width, dfb->height, // screen size in pixels
- dpi, dpi, // dots per inch
- dfb->pitch/(dfb->bitsPerPixel/8), // pixel width of framebuffer
- dfb->bitsPerPixel)) // bits per pixel for screen
+ if (!fbScreenInit(pScreen, dfb->framebuffer, // pointer to screen bitmap
+ dfb->width, dfb->height, // screen size in pixels
+ dpi, dpi, // dots per inch
+ dfb->pitch / (dfb->bitsPerPixel / 8), // pixel width of framebuffer
+ dfb->bitsPerPixel)) // bits per pixel for screen
{
return FALSE;
}
- if (! fbPictureInit(pScreen, 0, 0)) {
+ if (!fbPictureInit(pScreen, 0, 0)) {
return FALSE;
}
@@ -268,7 +280,7 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv
// create and install the default colormap and
// set pScreen->blackPixel / pScreen->white
- if (!miCreateDefColormap( pScreen )) {
+ if (!miCreateDefColormap(pScreen)) {
return FALSE;
}
@@ -276,7 +288,7 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv
pScreen->y = dfb->y;
/* ErrorF("Screen %d added: %dx%d @ (%d,%d)\n",
- index, dfb->width, dfb->height, dfb->x, dfb->y); */
+ index, dfb->width, dfb->height, dfb->x, dfb->y); */
return TRUE;
}
@@ -292,100 +304,110 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv
/*
* DarwinMouseProc: Handle the initialization, etc. of a mouse
*/
-static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
+static int
+DarwinMouseProc(DeviceIntPtr pPointer, int what)
+{
#define NBUTTONS 7
#define NAXES 2
- // 7 buttons: left, right, middle, then four scroll wheel "buttons"
- CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3, 4, 5, 6, 7};
- Atom btn_labels[NBUTTONS] = {0};
- Atom axes_labels[NAXES] = {0};
+ // 7 buttons: left, right, middle, then four scroll wheel "buttons"
+ CARD8 map[NBUTTONS + 1] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+ Atom btn_labels[NBUTTONS] = { 0 };
+ Atom axes_labels[NAXES] = { 0 };
switch (what) {
- case DEVICE_INIT:
- pPointer->public.on = FALSE;
-
- btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
- btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
- btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
- btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
- btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
- btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
- btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
-
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
-
-
- // Set button map.
- InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
- btn_labels,
- (PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), NAXES,
- axes_labels);
- InitValuatorAxisStruct(pPointer, 0, axes_labels[0], NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Absolute);
- InitValuatorAxisStruct(pPointer, 1, axes_labels[1], NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Absolute);
- break;
- case DEVICE_ON:
- pPointer->public.on = TRUE;
- AddEnabledDevice( darwinEventReadFD );
- return Success;
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- pPointer->public.on = FALSE;
- RemoveEnabledDevice(darwinEventReadFD);
- return Success;
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+
+ // Set button map.
+ InitPointerDeviceStruct((DevicePtr) pPointer, map, NBUTTONS,
+ btn_labels,
+ (PtrCtrlProcPtr) NoopDDA,
+ GetMotionHistorySize(), NAXES, axes_labels);
+ InitValuatorAxisStruct(pPointer, 0, axes_labels[0], NO_AXIS_LIMITS,
+ NO_AXIS_LIMITS, 0, 0, 0, Absolute);
+ InitValuatorAxisStruct(pPointer, 1, axes_labels[1], NO_AXIS_LIMITS,
+ NO_AXIS_LIMITS, 0, 0, 0, Absolute);
+ break;
+ case DEVICE_ON:
+ pPointer->public.on = TRUE;
+ AddEnabledDevice(darwinEventReadFD);
+ return Success;
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pPointer->public.on = FALSE;
+ RemoveEnabledDevice(darwinEventReadFD);
+ return Success;
}
-
+
return Success;
#undef NBUTTONS
#undef NAXES
}
-static int DarwinTabletProc(DeviceIntPtr pPointer, int what) {
+static int
+DarwinTabletProc(DeviceIntPtr pPointer, int what)
+{
#define NBUTTONS 3
#define NAXES 5
- CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3};
- Atom btn_labels[NBUTTONS] = {0};
- Atom axes_labels[NAXES] = {0};
+ CARD8 map[NBUTTONS + 1] = { 0, 1, 2, 3 };
+ Atom btn_labels[NBUTTONS] = { 0 };
+ Atom axes_labels[NAXES] = { 0 };
switch (what) {
- case DEVICE_INIT:
- pPointer->public.on = FALSE;
-
- btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
- btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
- btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
-
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
- axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE);
- axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_X);
- axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_Y);
-
- // Set button map.
- InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
- btn_labels,
- (PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), NAXES,
- axes_labels);
- InitProximityClassDeviceStruct(pPointer);
-
- InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
- InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
- InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
- InitValuatorAxisStruct(pPointer, 3, axes_labels[3], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
- InitValuatorAxisStruct(pPointer, 4, axes_labels[4], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
+ axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE);
+ axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_X);
+ axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_Y);
+
+ // Set button map.
+ InitPointerDeviceStruct((DevicePtr) pPointer, map, NBUTTONS,
+ btn_labels,
+ (PtrCtrlProcPtr) NoopDDA,
+ GetMotionHistorySize(), NAXES, axes_labels);
+ InitProximityClassDeviceStruct(pPointer);
+
+ InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 0,
+ XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
+ InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 0,
+ XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
+ InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 0,
+ XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
+ InitValuatorAxisStruct(pPointer, 3, axes_labels[3],
+ -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT,
+ 1, 0, 1, Absolute);
+ InitValuatorAxisStruct(pPointer, 4, axes_labels[4],
+ -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT,
+ 1, 0, 1, Absolute);
// pPointer->use = IsXExtensionDevice;
- break;
- case DEVICE_ON:
- pPointer->public.on = TRUE;
- AddEnabledDevice( darwinEventReadFD );
- return Success;
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- pPointer->public.on = FALSE;
- RemoveEnabledDevice(darwinEventReadFD);
- return Success;
+ break;
+ case DEVICE_ON:
+ pPointer->public.on = TRUE;
+ AddEnabledDevice(darwinEventReadFD);
+ return Success;
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pPointer->public.on = FALSE;
+ RemoveEnabledDevice(darwinEventReadFD);
+ return Success;
}
return Success;
#undef NBUTTONS
@@ -396,22 +418,23 @@ static int DarwinTabletProc(DeviceIntPtr pPointer, int what) {
* DarwinKeybdProc
* Callback from X
*/
-static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff )
+static int
+DarwinKeybdProc(DeviceIntPtr pDev, int onoff)
{
- switch ( onoff ) {
- case DEVICE_INIT:
- DarwinKeyboardInit( pDev );
- break;
- case DEVICE_ON:
- pDev->public.on = TRUE;
- AddEnabledDevice( darwinEventReadFD );
- break;
- case DEVICE_OFF:
- pDev->public.on = FALSE;
- RemoveEnabledDevice( darwinEventReadFD );
- break;
- case DEVICE_CLOSE:
- break;
+ switch (onoff) {
+ case DEVICE_INIT:
+ DarwinKeyboardInit(pDev);
+ break;
+ case DEVICE_ON:
+ pDev->public.on = TRUE;
+ AddEnabledDevice(darwinEventReadFD);
+ break;
+ case DEVICE_OFF:
+ pDev->public.on = FALSE;
+ RemoveEnabledDevice(darwinEventReadFD);
+ break;
+ case DEVICE_CLOSE:
+ break;
}
return Success;
@@ -429,7 +452,8 @@ static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff )
* DarwinParseModifierList
* Parse a list of modifier names and return a corresponding modifier mask
*/
-int DarwinParseModifierList(const char *constmodifiers, int separatelr)
+int
+DarwinParseModifierList(const char *constmodifiers, int separatelr)
{
int result = 0;
@@ -440,9 +464,9 @@ int DarwinParseModifierList(const char *constmodifiers, int separatelr)
char *p = modifiers;
while (p) {
- modifier = strsep(&p, " ,+&|/"); // allow lots of separators
+ modifier = strsep(&p, " ,+&|/"); // allow lots of separators
nxkey = DarwinModifierStringToNXMask(modifier, separatelr);
- if(nxkey)
+ if (nxkey)
result |= nxkey;
else
ErrorF("fakebuttons: Unknown modifier \"%s\"\n", modifier);
@@ -464,10 +488,12 @@ int DarwinParseModifierList(const char *constmodifiers, int separatelr)
* InitInput
* Register the keyboard and mouse devices
*/
-void InitInput( int argc, char **argv )
+void
+InitInput(int argc, char **argv)
{
- XkbRMLVOSet rmlvo = { .rules = "base", .model = "empty", .layout = "empty",
- .variant = NULL, .options = NULL };
+ XkbRMLVOSet rmlvo = {.rules = "base",.model = "empty",.layout = "empty",
+ .variant = NULL,.options = NULL
+ };
/* We need to really have rules... or something... */
XkbSetRulesDflts(&rmlvo);
@@ -475,18 +501,18 @@ void InitInput( int argc, char **argv )
darwinKeyboard->name = strdup("keyboard");
/* here's the snippet from the current gdk sources:
- if (!strcmp (tmp_name, "pointer"))
- gdkdev->info.source = GDK_SOURCE_MOUSE;
- else if (!strcmp (tmp_name, "wacom") ||
- !strcmp (tmp_name, "pen"))
- gdkdev->info.source = GDK_SOURCE_PEN;
- else if (!strcmp (tmp_name, "eraser"))
- gdkdev->info.source = GDK_SOURCE_ERASER;
- else if (!strcmp (tmp_name, "cursor"))
- gdkdev->info.source = GDK_SOURCE_CURSOR;
- else
- gdkdev->info.source = GDK_SOURCE_PEN;
- */
+ if (!strcmp (tmp_name, "pointer"))
+ gdkdev->info.source = GDK_SOURCE_MOUSE;
+ else if (!strcmp (tmp_name, "wacom") ||
+ !strcmp (tmp_name, "pen"))
+ gdkdev->info.source = GDK_SOURCE_PEN;
+ else if (!strcmp (tmp_name, "eraser"))
+ gdkdev->info.source = GDK_SOURCE_ERASER;
+ else if (!strcmp (tmp_name, "cursor"))
+ gdkdev->info.source = GDK_SOURCE_CURSOR;
+ else
+ gdkdev->info.source = GDK_SOURCE_PEN;
+ */
darwinPointer = AddInputDevice(serverClient, DarwinMouseProc, TRUE);
darwinPointer->name = strdup("pointer");
@@ -505,7 +531,8 @@ void InitInput( int argc, char **argv )
QuartzInitInput(argc, argv);
}
-void CloseInput(void)
+void
+CloseInput(void)
{
DarwinEQFini();
}
@@ -525,18 +552,18 @@ void CloseInput(void)
* easier target to hit.
*/
void
-DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo)
+DarwinAdjustScreenOrigins(ScreenInfo * pScreenInfo)
{
int i, left, top;
left = pScreenInfo->screens[0]->x;
- top = pScreenInfo->screens[0]->y;
+ top = pScreenInfo->screens[0]->y;
/* Find leftmost screen. If there's a tie, take the topmost of the two. */
for (i = 1; i < pScreenInfo->numScreens; i++) {
- if (pScreenInfo->screens[i]->x < left ||
- (pScreenInfo->screens[i]->x == left && pScreenInfo->screens[i]->y < top))
- {
+ if (pScreenInfo->screens[i]->x < left ||
+ (pScreenInfo->screens[i]->x == left &&
+ pScreenInfo->screens[i]->y < top)) {
left = pScreenInfo->screens[i]->x;
top = pScreenInfo->screens[i]->y;
}
@@ -544,7 +571,7 @@ DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo)
darwinMainScreenX = left;
darwinMainScreenY = top;
-
+
DEBUG_LOG("top = %d, left=%d\n", top, left);
/* Shift all screens so that there is a screen whose top left
@@ -557,12 +584,12 @@ DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo)
pScreenInfo->screens[i]->x -= darwinMainScreenX;
pScreenInfo->screens[i]->y -= darwinMainScreenY;
DEBUG_LOG("Screen %d placed at X11 coordinate (%d,%d).\n",
- i, pScreenInfo->screens[i]->x, pScreenInfo->screens[i]->y);
+ i, pScreenInfo->screens[i]->x,
+ pScreenInfo->screens[i]->y);
}
}
}
-
/*
* InitOutput
* Initialize screenInfo for all actually accessible framebuffers.
@@ -576,7 +603,8 @@ DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo)
* After other screen setup has been done, a mode specific
* SetupScreen function can be called to finalize screen setup.
*/
-void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
+void
+InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
{
int i;
@@ -601,56 +629,62 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
DarwinAdjustScreenOrigins(pScreenInfo);
}
-
/*
* OsVendorFatalError
*/
-void OsVendorFatalError( void )
+void
+OsVendorFatalError(void)
{
- ErrorF( " OsVendorFatalError\n" );
+ ErrorF(" OsVendorFatalError\n");
}
-
/*
* OsVendorInit
* Initialization of Darwin OS support.
*/
-void OsVendorInit(void)
+void
+OsVendorInit(void)
{
if (serverGeneration == 1) {
char *lf;
char *home = getenv("HOME");
+
assert(home);
- assert(0 < asprintf(&lf, "%s/Library/Logs/%s.X11.log", home, bundle_id_prefix));
+ assert(0 <
+ asprintf(&lf, "%s/Library/Logs/%s.X11.log", home,
+ bundle_id_prefix));
LogInit(lf, ".old");
free(lf);
DarwinPrintBanner();
#ifdef ENABLE_DEBUG_LOG
- {
- char *home_dir=NULL, *log_file_path=NULL;
- home_dir = getenv("HOME");
- if (home_dir) asprintf(&log_file_path, "%s/%s", home_dir, DEBUG_LOG_NAME);
- if (log_file_path) {
- if (!access(log_file_path, F_OK)) {
- debug_log_fp = fopen(log_file_path, "a");
- if (debug_log_fp) ErrorF("Debug logging enabled to %s\n", log_file_path);
- }
- free(log_file_path);
- }
- }
+ {
+ char *home_dir = NULL, *log_file_path = NULL;
+
+ home_dir = getenv("HOME");
+ if (home_dir)
+ asprintf(&log_file_path, "%s/%s", home_dir, DEBUG_LOG_NAME);
+ if (log_file_path) {
+ if (!access(log_file_path, F_OK)) {
+ debug_log_fp = fopen(log_file_path, "a");
+ if (debug_log_fp)
+ ErrorF("Debug logging enabled to %s\n", log_file_path);
+ }
+ free(log_file_path);
+ }
+ }
#endif
}
}
-
/*
* ddxProcessArgument
* Process device-dependent command line args. Returns 0 if argument is
* not device dependent, otherwise Count of number of elements of argv
* that are part of a device dependent commandline option.
*/
-int ddxProcessArgument( int argc, char *argv[], int i )
+int
+ddxProcessArgument(int argc, char *argv[], int i)
{
// if ( !strcmp( argv[i], "-fullscreen" ) ) {
// ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" );
@@ -663,75 +697,74 @@ int ddxProcessArgument( int argc, char *argv[], int i )
// }
// This command line arg is passed when launched from the Aqua GUI.
- if ( !strncmp( argv[i], "-psn_", 5 ) ) {
+ if (!strncmp(argv[i], "-psn_", 5)) {
return 1;
}
- if ( !strcmp( argv[i], "-fakebuttons" ) ) {
+ if (!strcmp(argv[i], "-fakebuttons")) {
darwinFakeButtons = TRUE;
- ErrorF( "Faking a three button mouse\n" );
+ ErrorF("Faking a three button mouse\n");
return 1;
}
- if ( !strcmp( argv[i], "-nofakebuttons" ) ) {
+ if (!strcmp(argv[i], "-nofakebuttons")) {
darwinFakeButtons = FALSE;
- ErrorF( "Not faking a three button mouse\n" );
+ ErrorF("Not faking a three button mouse\n");
return 1;
}
- if (!strcmp( argv[i], "-fakemouse2" ) ) {
- if ( i == argc-1 ) {
- FatalError( "-fakemouse2 must be followed by a modifer list\n" );
+ if (!strcmp(argv[i], "-fakemouse2")) {
+ if (i == argc - 1) {
+ FatalError("-fakemouse2 must be followed by a modifer list\n");
}
- if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], ""))
+ if (!strcasecmp(argv[i + 1], "none") || !strcmp(argv[i + 1], ""))
darwinFakeMouse2Mask = 0;
else
- darwinFakeMouse2Mask = DarwinParseModifierList(argv[i+1], 1);
+ darwinFakeMouse2Mask = DarwinParseModifierList(argv[i + 1], 1);
ErrorF("Modifier mask to fake mouse button 2 = 0x%x\n",
darwinFakeMouse2Mask);
return 2;
}
- if (!strcmp( argv[i], "-fakemouse3" ) ) {
- if ( i == argc-1 ) {
- FatalError( "-fakemouse3 must be followed by a modifer list\n" );
+ if (!strcmp(argv[i], "-fakemouse3")) {
+ if (i == argc - 1) {
+ FatalError("-fakemouse3 must be followed by a modifer list\n");
}
- if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], ""))
+ if (!strcasecmp(argv[i + 1], "none") || !strcmp(argv[i + 1], ""))
darwinFakeMouse3Mask = 0;
else
- darwinFakeMouse3Mask = DarwinParseModifierList(argv[i+1], 1);
+ darwinFakeMouse3Mask = DarwinParseModifierList(argv[i + 1], 1);
ErrorF("Modifier mask to fake mouse button 3 = 0x%x\n",
darwinFakeMouse3Mask);
return 2;
}
- if ( !strcmp( argv[i], "+synckeymap" ) ) {
+ if (!strcmp(argv[i], "+synckeymap")) {
darwinSyncKeymap = TRUE;
return 1;
}
- if ( !strcmp( argv[i], "-synckeymap" ) ) {
+ if (!strcmp(argv[i], "-synckeymap")) {
darwinSyncKeymap = FALSE;
return 1;
}
- if ( !strcmp( argv[i], "-depth" ) ) {
- if ( i == argc-1 ) {
- FatalError( "-depth must be followed by a number\n" );
+ if (!strcmp(argv[i], "-depth")) {
+ if (i == argc - 1) {
+ FatalError("-depth must be followed by a number\n");
}
- darwinDesiredDepth = atoi( argv[i+1] );
- if(darwinDesiredDepth != -1 &&
- darwinDesiredDepth != 8 &&
- darwinDesiredDepth != 15 &&
- darwinDesiredDepth != 24) {
- FatalError( "Unsupported pixel depth. Use 8, 15, or 24 bits\n" );
+ darwinDesiredDepth = atoi(argv[i + 1]);
+ if (darwinDesiredDepth != -1 &&
+ darwinDesiredDepth != 8 &&
+ darwinDesiredDepth != 15 && darwinDesiredDepth != 24) {
+ FatalError("Unsupported pixel depth. Use 8, 15, or 24 bits\n");
}
- ErrorF( "Attempting to use pixel depth of %i\n", darwinDesiredDepth );
+ ErrorF("Attempting to use pixel depth of %i\n", darwinDesiredDepth);
return 2;
}
- if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) {
+ if (!strcmp(argv[i], "-showconfig") || !strcmp(argv[i], "-version")) {
DarwinPrintBanner();
exit(0);
}
@@ -739,48 +772,51 @@ int ddxProcessArgument( int argc, char *argv[], int i )
return 0;
}
-
/*
* ddxUseMsg --
* Print out correct use of device dependent commandline options.
* Maybe the user now knows what really to do ...
*/
-void ddxUseMsg( void )
+void
+ddxUseMsg(void)
{
ErrorF("\n");
ErrorF("\n");
ErrorF("Device Dependent Usage:\n");
ErrorF("\n");
ErrorF("-depth <8,15,24> : use this bit depth.\n");
- ErrorF("-fakebuttons : fake a three button mouse with Command and Option keys.\n");
+ ErrorF
+ ("-fakebuttons : fake a three button mouse with Command and Option keys.\n");
ErrorF("-nofakebuttons : don't fake a three button mouse.\n");
- ErrorF("-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.\n");
- ErrorF("-fakemouse3 <modifiers> : fake right mouse button with modifier keys.\n");
- ErrorF(" ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n");
+ ErrorF
+ ("-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.\n");
+ ErrorF
+ ("-fakemouse3 <modifiers> : fake right mouse button with modifier keys.\n");
+ ErrorF
+ (" ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n");
ErrorF("-version : show the server version.\n");
ErrorF("\n");
}
-
/*
* ddxGiveUp --
* Device dependent cleanup. Called by dix before normal server death.
*/
-void ddxGiveUp( enum ExitCode error )
+void
+ddxGiveUp(enum ExitCode error)
{
LogClose(error);
}
-
/*
* AbortDDX --
* DDX - specific abort routine. Called by AbortServer(). The attempt is
* made to restore all original setting of the displays. Also all devices
* are closed.
*/
-_X_NORETURN
-void AbortDDX( enum ExitCode error ) {
- ErrorF( " AbortDDX\n" );
+_X_NORETURN void
+AbortDDX(enum ExitCode error)
+{
+ ErrorF(" AbortDDX\n");
OsAbort();
}
-
diff --git a/xorg-server/hw/xquartz/darwin.h b/xorg-server/hw/xquartz/darwin.h
index aafc12fbf..b1157ce97 100644
--- a/xorg-server/hw/xquartz/darwin.h
+++ b/xorg-server/hw/xquartz/darwin.h
@@ -39,7 +39,7 @@
// From darwin.c
void DarwinPrintBanner(void);
int DarwinParseModifierList(const char *constmodifiers, int separatelr);
-void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
+void DarwinAdjustScreenOrigins(ScreenInfo * pScreenInfo);
#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey))
@@ -48,39 +48,42 @@ void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
* Global variables from darwin.c
*/
extern DevPrivateKeyRec darwinScreenKeyRec;
+
#define darwinScreenKey (&darwinScreenKeyRec)
-extern int darwinScreensFound;
-extern io_connect_t darwinParamConnect;
-extern int darwinEventReadFD;
-extern int darwinEventWriteFD;
-extern DeviceIntPtr darwinPointer;
-extern DeviceIntPtr darwinTabletCursor;
-extern DeviceIntPtr darwinTabletStylus;
-extern DeviceIntPtr darwinTabletEraser;
-extern DeviceIntPtr darwinKeyboard;
+extern int darwinScreensFound;
+extern io_connect_t darwinParamConnect;
+extern int darwinEventReadFD;
+extern int darwinEventWriteFD;
+extern DeviceIntPtr darwinPointer;
+extern DeviceIntPtr darwinTabletCursor;
+extern DeviceIntPtr darwinTabletStylus;
+extern DeviceIntPtr darwinTabletEraser;
+extern DeviceIntPtr darwinKeyboard;
// User preferences
-extern int darwinMouseAccelChange;
-extern int darwinFakeButtons;
-extern int darwinFakeMouse2Mask;
-extern int darwinFakeMouse3Mask;
-extern unsigned int darwinAppKitModMask;
-extern unsigned int windowItemModMask;
-extern int darwinSyncKeymap;
-extern int darwinDesiredDepth;
+extern int darwinMouseAccelChange;
+extern int darwinFakeButtons;
+extern int darwinFakeMouse2Mask;
+extern int darwinFakeMouse3Mask;
+extern unsigned int darwinAppKitModMask;
+extern unsigned int windowItemModMask;
+extern int darwinSyncKeymap;
+extern int darwinDesiredDepth;
// location of X11's (0,0) point in global screen coordinates
-extern int darwinMainScreenX;
-extern int darwinMainScreenY;
+extern int darwinMainScreenX;
+extern int darwinMainScreenY;
// bundle-main.c
extern char *bundle_id_prefix;
-_X_ATTRIBUTE_PRINTF(6,7)
-extern void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...);
+_X_ATTRIBUTE_PRINTF(6, 7)
+extern void
+xq_asl_log(int level, const char *subsystem, const char *file,
+ const char *function, int line, const char *fmt, ...);
#define ASL_LOG(level, subsystem, msg, args...) xq_asl_log(level, subsystem, __FILE__, __FUNCTION__, __LINE__, msg, ##args)
#define DEBUG_LOG(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "XQuartz", msg, ##args)
#define TRACE() DEBUG_LOG("TRACE")
-#endif /* _DARWIN_H */
+#endif /* _DARWIN_H */
diff --git a/xorg-server/hw/xquartz/darwinEvents.c b/xorg-server/hw/xquartz/darwinEvents.c
index 3438da116..cf29a7b21 100644
--- a/xorg-server/hw/xquartz/darwinEvents.c
+++ b/xorg-server/hw/xquartz/darwinEvents.c
@@ -75,9 +75,10 @@ in this Software without prior written authorization from The Open Group.
#include "applewmExt.h"
/* FIXME: Abstract this better */
-extern Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev);
+extern Bool QuartzModeEventHandler(int screenNum, XQuartzEvent * e,
+ DeviceIntPtr dev);
-int darwin_all_modifier_flags = 0; // last known modifier state
+int darwin_all_modifier_flags = 0; // last known modifier state
int darwin_all_modifier_mask = 0;
int darwin_x11_modifier_mask = 0;
@@ -88,42 +89,50 @@ static pthread_mutex_t fd_add_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t fd_add_ready_cond = PTHREAD_COND_INITIALIZER;
static pthread_t fd_add_tid = NULL;
-static InternalEvent* darwinEvents = NULL;
+static InternalEvent *darwinEvents = NULL;
static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t mieq_ready_cond = PTHREAD_COND_INITIALIZER;
/*** Pthread Magics ***/
-static pthread_t create_thread(void *(*func)(void *), void *arg) {
+static pthread_t
+create_thread(void *(*func) (void *), void *arg)
+{
pthread_attr_t attr;
pthread_t tid;
- pthread_attr_init (&attr);
- pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
- pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
- pthread_create (&tid, &attr, func, arg);
- pthread_attr_destroy (&attr);
+ pthread_attr_init(&attr);
+ pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ pthread_create(&tid, &attr, func, arg);
+ pthread_attr_destroy(&attr);
return tid;
}
void darwinEvents_lock(void);
-void darwinEvents_lock(void) {
+void
+darwinEvents_lock(void)
+{
int err;
- if((err = pthread_mutex_lock(&mieq_lock))) {
+
+ if ((err = pthread_mutex_lock(&mieq_lock))) {
ErrorF("%s:%s:%d: Failed to lock mieq_lock: %d\n",
__FILE__, __FUNCTION__, __LINE__, err);
xorg_backtrace();
}
- if(darwinEvents == NULL) {
+ if (darwinEvents == NULL) {
pthread_cond_wait(&mieq_ready_cond, &mieq_lock);
}
}
void darwinEvents_unlock(void);
-void darwinEvents_unlock(void) {
+void
+darwinEvents_unlock(void)
+{
int err;
- if((err = pthread_mutex_unlock(&mieq_lock))) {
+
+ if ((err = pthread_mutex_unlock(&mieq_lock))) {
ErrorF("%s:%s:%d: Failed to unlock mieq_lock: %d\n",
__FILE__, __FUNCTION__, __LINE__, err);
xorg_backtrace();
@@ -134,7 +143,9 @@ void darwinEvents_unlock(void) {
* DarwinPressModifierKey
* Press or release the given modifier key (one of NX_MODIFIERKEY_* constants)
*/
-static void DarwinPressModifierKey(int pressed, int key) {
+static void
+DarwinPressModifierKey(int pressed, int key)
+{
int keycode = DarwinModifierNXKeyToNXKeycode(key, 0);
if (keycode == 0) {
@@ -165,9 +176,9 @@ static int darwin_x11_modifier_mask_list[] = {
static int darwin_all_modifier_mask_additions[] = { NX_SECONDARYFNMASK, };
-static void DarwinUpdateModifiers(
- int pressed, // KeyPress or KeyRelease
- int flags ) // modifier flags that have changed
+static void
+DarwinUpdateModifiers(int pressed, // KeyPress or KeyRelease
+ int flags) // modifier flags that have changed
{
int *f;
int key;
@@ -175,15 +186,15 @@ static void DarwinUpdateModifiers(
/* Capslock is special. This mask is the state of capslock (on/off),
* not the state of the button. Hopefully we can find a better solution.
*/
- if(NX_ALPHASHIFTMASK & flags) {
+ if (NX_ALPHASHIFTMASK & flags) {
DarwinPressModifierKey(KeyPress, NX_MODIFIERKEY_ALPHALOCK);
DarwinPressModifierKey(KeyRelease, NX_MODIFIERKEY_ALPHALOCK);
}
-
- for(f=darwin_x11_modifier_mask_list; *f; f++)
- if(*f & flags && *f != NX_ALPHASHIFTMASK) {
+
+ for (f = darwin_x11_modifier_mask_list; *f; f++)
+ if (*f & flags && *f != NX_ALPHASHIFTMASK) {
key = DarwinModifierNXMaskToNXKey(*f);
- if(key == -1)
+ if (key == -1)
ErrorF("DarwinUpdateModifiers: Unsupported NXMask: 0x%x\n", *f);
else
DarwinPressModifierKey(pressed, key);
@@ -194,107 +205,107 @@ static void DarwinUpdateModifiers(
be moved into their own individual functions and set as handlers using
mieqSetHandler. */
-static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr dev) {
+static void
+DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr dev)
+{
XQuartzEvent *e = &(ie->xquartz_event);
- switch(e->subtype) {
- case kXquartzControllerNotify:
- DEBUG_LOG("kXquartzControllerNotify\n");
- AppleWMSendEvent(AppleWMControllerNotify,
- AppleWMControllerNotifyMask,
- e->data[0],
- e->data[1]);
- break;
-
- case kXquartzPasteboardNotify:
- DEBUG_LOG("kXquartzPasteboardNotify\n");
- AppleWMSendEvent(AppleWMPasteboardNotify,
- AppleWMPasteboardNotifyMask,
- e->data[0],
- e->data[1]);
- break;
-
- case kXquartzActivate:
- DEBUG_LOG("kXquartzActivate\n");
- QuartzShow();
- AppleWMSendEvent(AppleWMActivationNotify,
- AppleWMActivationNotifyMask,
- AppleWMIsActive, 0);
- break;
-
- case kXquartzDeactivate:
- DEBUG_LOG("kXquartzDeactivate\n");
- AppleWMSendEvent(AppleWMActivationNotify,
- AppleWMActivationNotifyMask,
- AppleWMIsInactive, 0);
- QuartzHide();
- break;
-
- case kXquartzReloadPreferences:
- DEBUG_LOG("kXquartzReloadPreferences\n");
- AppleWMSendEvent(AppleWMActivationNotify,
- AppleWMActivationNotifyMask,
- AppleWMReloadPreferences, 0);
- break;
-
- case kXquartzToggleFullscreen:
- DEBUG_LOG("kXquartzToggleFullscreen\n");
- if(XQuartzIsRootless)
- ErrorF("Ignoring kXquartzToggleFullscreen because of rootless mode.");
- else
- QuartzRandRToggleFullscreen();
- break;
-
- case kXquartzSetRootless:
- DEBUG_LOG("kXquartzSetRootless\n");
- if(e->data[0]) {
- QuartzRandRSetFakeRootless();
- } else {
- QuartzRandRSetFakeFullscreen(FALSE);
- }
- break;
-
- case kXquartzSetRootClip:
- QuartzSetRootClip((Bool)e->data[0]);
- break;
-
- case kXquartzQuit:
- GiveUp(0);
- break;
-
- case kXquartzSpaceChanged:
- DEBUG_LOG("kXquartzSpaceChanged\n");
- QuartzSpaceChanged(e->data[0]);
- break;
-
- case kXquartzListenOnOpenFD:
- ErrorF("Calling ListenOnOpenFD() for new fd: %d\n", (int)e->data[0]);
- ListenOnOpenFD((int)e->data[0], 1);
- break;
-
- case kXquartzReloadKeymap:
- DarwinKeyboardReloadHandler();
- break;
-
- case kXquartzDisplayChanged:
- DEBUG_LOG("kXquartzDisplayChanged\n");
- QuartzUpdateScreens();
-
- /* Update our RandR info */
- QuartzRandRUpdateFakeModes(TRUE);
- break;
-
- default:
- if(!QuartzModeEventHandler(screenNum, e, dev))
- ErrorF("Unknown application defined event type %d.\n", e->subtype);
- }
+ switch (e->subtype) {
+ case kXquartzControllerNotify:
+ DEBUG_LOG("kXquartzControllerNotify\n");
+ AppleWMSendEvent(AppleWMControllerNotify,
+ AppleWMControllerNotifyMask, e->data[0], e->data[1]);
+ break;
+
+ case kXquartzPasteboardNotify:
+ DEBUG_LOG("kXquartzPasteboardNotify\n");
+ AppleWMSendEvent(AppleWMPasteboardNotify,
+ AppleWMPasteboardNotifyMask, e->data[0], e->data[1]);
+ break;
+
+ case kXquartzActivate:
+ DEBUG_LOG("kXquartzActivate\n");
+ QuartzShow();
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask, AppleWMIsActive, 0);
+ break;
+
+ case kXquartzDeactivate:
+ DEBUG_LOG("kXquartzDeactivate\n");
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask, AppleWMIsInactive, 0);
+ QuartzHide();
+ break;
+
+ case kXquartzReloadPreferences:
+ DEBUG_LOG("kXquartzReloadPreferences\n");
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask,
+ AppleWMReloadPreferences, 0);
+ break;
+
+ case kXquartzToggleFullscreen:
+ DEBUG_LOG("kXquartzToggleFullscreen\n");
+ if (XQuartzIsRootless)
+ ErrorF
+ ("Ignoring kXquartzToggleFullscreen because of rootless mode.");
+ else
+ QuartzRandRToggleFullscreen();
+ break;
+
+ case kXquartzSetRootless:
+ DEBUG_LOG("kXquartzSetRootless\n");
+ if (e->data[0]) {
+ QuartzRandRSetFakeRootless();
+ }
+ else {
+ QuartzRandRSetFakeFullscreen(FALSE);
+ }
+ break;
+
+ case kXquartzSetRootClip:
+ QuartzSetRootClip((Bool) e->data[0]);
+ break;
+
+ case kXquartzQuit:
+ GiveUp(0);
+ break;
+
+ case kXquartzSpaceChanged:
+ DEBUG_LOG("kXquartzSpaceChanged\n");
+ QuartzSpaceChanged(e->data[0]);
+ break;
+
+ case kXquartzListenOnOpenFD:
+ ErrorF("Calling ListenOnOpenFD() for new fd: %d\n", (int) e->data[0]);
+ ListenOnOpenFD((int) e->data[0], 1);
+ break;
+
+ case kXquartzReloadKeymap:
+ DarwinKeyboardReloadHandler();
+ break;
+
+ case kXquartzDisplayChanged:
+ DEBUG_LOG("kXquartzDisplayChanged\n");
+ QuartzUpdateScreens();
+
+ /* Update our RandR info */
+ QuartzRandRUpdateFakeModes(TRUE);
+ break;
+
+ default:
+ if (!QuartzModeEventHandler(screenNum, e, dev))
+ ErrorF("Unknown application defined event type %d.\n", e->subtype);
+ }
}
-void DarwinListenOnOpenFD(int fd) {
+void
+DarwinListenOnOpenFD(int fd)
+{
ErrorF("DarwinListenOnOpenFD: %d\n", fd);
-
+
pthread_mutex_lock(&fd_add_lock);
- if(fd_add_count < FD_ADD_MAX)
+ if (fd_add_count < FD_ADD_MAX)
fd_add[fd_add_count++] = fd;
else
ErrorF("FD Addition buffer at max. Dropping fd addition request.\n");
@@ -303,7 +314,9 @@ void DarwinListenOnOpenFD(int fd) {
pthread_mutex_unlock(&fd_add_lock);
}
-static void *DarwinProcessFDAdditionQueue_thread(void *args) {
+static void *
+DarwinProcessFDAdditionQueue_thread(void *args)
+{
/* TODO: Possibly adjust this to no longer be a race... maybe trigger this
* once a client connects and claims to be the WM.
*
@@ -320,15 +333,17 @@ static void *DarwinProcessFDAdditionQueue_thread(void *args) {
sleep_for.tv_sec = 3;
sleep_for.tv_nsec = 0;
- ErrorF("X11.app: DarwinProcessFDAdditionQueue_thread: Sleeping to allow xinitrc to catchup.\n");
- while(nanosleep(&sleep_for, &sleep_remaining) != 0) {
+ ErrorF
+ ("X11.app: DarwinProcessFDAdditionQueue_thread: Sleeping to allow xinitrc to catchup.\n");
+ while (nanosleep(&sleep_for, &sleep_remaining) != 0) {
sleep_for = sleep_remaining;
}
pthread_mutex_lock(&fd_add_lock);
- while(true) {
- while(fd_add_count) {
- DarwinSendDDXEvent(kXquartzListenOnOpenFD, 1, fd_add[--fd_add_count]);
+ while (true) {
+ while (fd_add_count) {
+ DarwinSendDDXEvent(kXquartzListenOnOpenFD, 1,
+ fd_add[--fd_add_count]);
}
pthread_cond_wait(&fd_add_ready_cond, &fd_add_lock);
}
@@ -336,17 +351,21 @@ static void *DarwinProcessFDAdditionQueue_thread(void *args) {
return NULL;
}
-Bool DarwinEQInit(void) {
+Bool
+DarwinEQInit(void)
+{
int *p;
- for(p=darwin_x11_modifier_mask_list, darwin_all_modifier_mask=0; *p; p++) {
+ for (p = darwin_x11_modifier_mask_list, darwin_all_modifier_mask = 0; *p;
+ p++) {
darwin_x11_modifier_mask |= *p;
}
-
- for(p=darwin_all_modifier_mask_additions, darwin_all_modifier_mask= darwin_x11_modifier_mask; *p; p++) {
+
+ for (p = darwin_all_modifier_mask_additions, darwin_all_modifier_mask =
+ darwin_x11_modifier_mask; *p; p++) {
darwin_all_modifier_mask |= *p;
}
-
+
mieqInit();
mieqSetHandler(ET_XQuartz, DarwinEventHandler);
@@ -356,22 +375,24 @@ Bool DarwinEQInit(void) {
*/
if (!darwinEvents) {
darwinEvents = InitEventList(GetMaximumEventsNum());;
-
+
if (!darwinEvents)
FatalError("Couldn't allocate event buffer\n");
-
+
darwinEvents_lock();
pthread_cond_broadcast(&mieq_ready_cond);
darwinEvents_unlock();
}
- if(!fd_add_tid)
+ if (!fd_add_tid)
fd_add_tid = create_thread(DarwinProcessFDAdditionQueue_thread, NULL);
-
+
return TRUE;
}
-void DarwinEQFini(void) {
+void
+DarwinEQFini(void)
+{
mieqFini();
}
@@ -379,53 +400,65 @@ void DarwinEQFini(void) {
* ProcessInputEvents
* Read and process events from the event queue until it is empty.
*/
-void ProcessInputEvents(void) {
+void
+ProcessInputEvents(void)
+{
char nullbyte;
- int x = sizeof(nullbyte);
-
+ int x = sizeof(nullbyte);
+
mieqProcessInputEvents();
// Empty the signaling pipe
while (x == sizeof(nullbyte)) {
- x = read(darwinEventReadFD, &nullbyte, sizeof(nullbyte));
+ x = read(darwinEventReadFD, &nullbyte, sizeof(nullbyte));
}
}
/* Sends a null byte down darwinEventWriteFD, which will cause the
Dispatch() event loop to check out event queue */
-static void DarwinPokeEQ(void) {
- char nullbyte=0;
- // <daniels> oh, i ... er ... christ.
- write(darwinEventWriteFD, &nullbyte, sizeof(nullbyte));
+static void
+DarwinPokeEQ(void)
+{
+ char nullbyte = 0;
+
+ // <daniels> oh, i ... er ... christ.
+ write(darwinEventWriteFD, &nullbyte, sizeof(nullbyte));
}
/* Convert from Appkit pointer input values to X input values:
* Note: pointer_x and pointer_y are relative to the upper-left of primary
* display.
*/
-static void DarwinPrepareValuators(DeviceIntPtr pDev, int *valuators, ScreenPtr screen,
- float pointer_x, float pointer_y,
- float pressure, float tilt_x, float tilt_y) {
+static void
+DarwinPrepareValuators(DeviceIntPtr pDev, int *valuators, ScreenPtr screen,
+ float pointer_x, float pointer_y,
+ float pressure, float tilt_x, float tilt_y)
+{
/* Fix offset between darwin and X screens */
pointer_x -= darwinMainScreenX + screen->x;
pointer_y -= darwinMainScreenY + screen->y;
- if(pointer_x < 0.0)
+ if (pointer_x < 0.0)
pointer_x = 0.0;
- if(pointer_y < 0.0)
+ if (pointer_y < 0.0)
pointer_y = 0.0;
-
- if(pDev == darwinPointer) {
+
+ if (pDev == darwinPointer) {
valuators[0] = pointer_x;
valuators[1] = pointer_y;
valuators[2] = 0;
valuators[3] = 0;
valuators[4] = 0;
- } else {
+ }
+ else {
/* Setup our array of values */
- valuators[0] = XQUARTZ_VALUATOR_LIMIT * (pointer_x / (float)screenInfo.screens[0]->width);
- valuators[1] = XQUARTZ_VALUATOR_LIMIT * (pointer_y / (float)screenInfo.screens[0]->height);
+ valuators[0] =
+ XQUARTZ_VALUATOR_LIMIT * (pointer_x /
+ (float) screenInfo.screens[0]->width);
+ valuators[1] =
+ XQUARTZ_VALUATOR_LIMIT * (pointer_y /
+ (float) screenInfo.screens[0]->height);
valuators[2] = XQUARTZ_VALUATOR_LIMIT * pressure;
valuators[3] = XQUARTZ_VALUATOR_LIMIT * tilt_x;
valuators[4] = XQUARTZ_VALUATOR_LIMIT * tilt_y;
@@ -434,13 +467,17 @@ static void DarwinPrepareValuators(DeviceIntPtr pDev, int *valuators, ScreenPtr
// valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]);
}
-void DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev) {
+void
+DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev)
+{
darwinEvents_lock(); {
int i;
+
if (pDev->button) {
for (i = 0; i < pDev->button->numButtons; i++) {
if (BitIsOn(pDev->button->down, i)) {
- QueuePointerEvents(pDev, ButtonRelease, i, POINTER_ABSOLUTE, NULL);
+ QueuePointerEvents(pDev, ButtonRelease, i, POINTER_ABSOLUTE,
+ NULL);
}
}
}
@@ -448,157 +485,207 @@ void DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev) {
if (pDev->key) {
for (i = 0; i < NUM_KEYCODES; i++) {
if (BitIsOn(pDev->key->down, i + MIN_KEYCODE)) {
- QueueKeyboardEvents(pDev, KeyRelease, i + MIN_KEYCODE, NULL);
+ QueueKeyboardEvents(pDev, KeyRelease, i + MIN_KEYCODE,
+ NULL);
}
}
}
DarwinPokeEQ();
- } darwinEvents_unlock();
+ }
+ darwinEvents_unlock();
}
-void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, float pointer_x, float pointer_y,
- float pressure, float tilt_x, float tilt_y) {
- static int darwinFakeMouseButtonDown = 0;
+void
+DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
+ float pointer_x, float pointer_y, float pressure,
+ float tilt_x, float tilt_y)
+{
+ static int darwinFakeMouseButtonDown = 0;
ScreenPtr screen;
int valuators[5];
-
+
//DEBUG_LOG("x=%f, y=%f, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y);
-
- if(!darwinEvents) {
- DEBUG_LOG("DarwinSendPointerEvents called before darwinEvents was initialized\n");
- return;
- }
+
+ if (!darwinEvents) {
+ DEBUG_LOG
+ ("DarwinSendPointerEvents called before darwinEvents was initialized\n");
+ return;
+ }
screen = miPointerGetScreen(pDev);
- if(!screen) {
- DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n");
+ if (!screen) {
+ DEBUG_LOG
+ ("DarwinSendPointerEvents called before screen was initialized\n");
return;
}
/* Handle fake click */
- if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
- if(darwinFakeMouseButtonDown != 0) {
+ if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
+ if (darwinFakeMouseButtonDown != 0) {
/* We're currently "down" with another button, so release it first */
- DarwinSendPointerEvents(pDev, ButtonRelease, darwinFakeMouseButtonDown, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
- darwinFakeMouseButtonDown=0;
+ DarwinSendPointerEvents(pDev, ButtonRelease,
+ darwinFakeMouseButtonDown, pointer_x,
+ pointer_y, pressure, tilt_x, tilt_y);
+ darwinFakeMouseButtonDown = 0;
}
- if (darwin_all_modifier_flags & darwinFakeMouse2Mask) {
+ if (darwin_all_modifier_flags & darwinFakeMouse2Mask) {
ev_button = 2;
- darwinFakeMouseButtonDown = 2;
- DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse2Mask);
- } else if (darwin_all_modifier_flags & darwinFakeMouse3Mask) {
+ darwinFakeMouseButtonDown = 2;
+ DarwinUpdateModKeys(darwin_all_modifier_flags &
+ ~darwinFakeMouse2Mask);
+ }
+ else if (darwin_all_modifier_flags & darwinFakeMouse3Mask) {
ev_button = 3;
- darwinFakeMouseButtonDown = 3;
- DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse3Mask);
- }
- }
+ darwinFakeMouseButtonDown = 3;
+ DarwinUpdateModKeys(darwin_all_modifier_flags &
+ ~darwinFakeMouse3Mask);
+ }
+ }
- if (ev_type == ButtonRelease && ev_button == 1) {
- if(darwinFakeMouseButtonDown) {
+ if (ev_type == ButtonRelease && ev_button == 1) {
+ if (darwinFakeMouseButtonDown) {
ev_button = darwinFakeMouseButtonDown;
}
- if(darwinFakeMouseButtonDown == 2) {
- DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse2Mask);
- } else if(darwinFakeMouseButtonDown == 3) {
- DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse3Mask);
+ if (darwinFakeMouseButtonDown == 2) {
+ DarwinUpdateModKeys(darwin_all_modifier_flags &
+ ~darwinFakeMouse2Mask);
+ }
+ else if (darwinFakeMouseButtonDown == 3) {
+ DarwinUpdateModKeys(darwin_all_modifier_flags &
+ ~darwinFakeMouse3Mask);
}
darwinFakeMouseButtonDown = 0;
- }
+ }
- DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y,
+ pressure, tilt_x, tilt_y);
darwinEvents_lock(); {
ValuatorMask mask;
- valuator_mask_set_range(&mask, 0, (pDev == darwinPointer) ? 2 : 5, valuators);
+
+ valuator_mask_set_range(&mask, 0, (pDev == darwinPointer) ? 2 : 5,
+ valuators);
QueuePointerEvents(pDev, ev_type, ev_button, POINTER_ABSOLUTE, &mask);
DarwinPokeEQ();
} darwinEvents_unlock();
}
-void DarwinSendKeyboardEvents(int ev_type, int keycode) {
+void
+DarwinSendKeyboardEvents(int ev_type, int keycode)
+{
- if(!darwinEvents) {
- DEBUG_LOG("DarwinSendKeyboardEvents called before darwinEvents was initialized\n");
- return;
- }
+ if (!darwinEvents) {
+ DEBUG_LOG
+ ("DarwinSendKeyboardEvents called before darwinEvents was initialized\n");
+ return;
+ }
darwinEvents_lock(); {
- QueueKeyboardEvents(darwinKeyboard, ev_type, keycode + MIN_KEYCODE, NULL);
+ QueueKeyboardEvents(darwinKeyboard, ev_type, keycode + MIN_KEYCODE,
+ NULL);
DarwinPokeEQ();
- } darwinEvents_unlock();
+ }
+ darwinEvents_unlock();
}
-void DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x, float pointer_y,
- float pressure, float tilt_x, float tilt_y) {
+void
+DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x,
+ float pointer_y, float pressure, float tilt_x,
+ float tilt_y)
+{
ScreenPtr screen;
int valuators[5];
- DEBUG_LOG("DarwinSendProximityEvents: %d l:%f,%f p:%f t:%f,%f\n", ev_type, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DEBUG_LOG("DarwinSendProximityEvents: %d l:%f,%f p:%f t:%f,%f\n", ev_type,
+ pointer_x, pointer_y, pressure, tilt_x, tilt_y);
- if(!darwinEvents) {
- DEBUG_LOG("DarwinSendProximityEvents called before darwinEvents was initialized\n");
+ if (!darwinEvents) {
+ DEBUG_LOG
+ ("DarwinSendProximityEvents called before darwinEvents was initialized\n");
return;
}
-
+
screen = miPointerGetScreen(pDev);
- if(!screen) {
- DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n");
+ if (!screen) {
+ DEBUG_LOG
+ ("DarwinSendPointerEvents called before screen was initialized\n");
return;
- }
+ }
- DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y,
+ pressure, tilt_x, tilt_y);
darwinEvents_lock(); {
ValuatorMask mask;
+
valuator_mask_set_range(&mask, 0, 5, valuators);
QueueProximityEvents(pDev, ev_type, &mask);
DarwinPokeEQ();
} darwinEvents_unlock();
}
-
/* Send the appropriate number of button clicks to emulate scroll wheel */
-void DarwinSendScrollEvents(float count_x, float count_y,
- float pointer_x, float pointer_y,
- float pressure, float tilt_x, float tilt_y) {
- int sign_x, sign_y;
- if(!darwinEvents) {
- DEBUG_LOG("DarwinSendScrollEvents called before darwinEvents was initialized\n");
- return;
- }
-
- sign_x = count_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE;
- sign_y = count_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE;
- count_x = fabs(count_x);
- count_y = fabs(count_y);
-
- while ((count_x > 0.0f) || (count_y > 0.0f)) {
- if (count_x > 0.0f) {
- DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
- DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
- count_x = count_x - 1.0f;
- }
- if (count_y > 0.0f) {
- DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
- DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
- count_y = count_y - 1.0f;
- }
- }
+void
+DarwinSendScrollEvents(float count_x, float count_y,
+ float pointer_x, float pointer_y,
+ float pressure, float tilt_x, float tilt_y)
+{
+ int sign_x, sign_y;
+
+ if (!darwinEvents) {
+ DEBUG_LOG
+ ("DarwinSendScrollEvents called before darwinEvents was initialized\n");
+ return;
+ }
+
+ sign_x = count_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE;
+ sign_y = count_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE;
+ count_x = fabs(count_x);
+ count_y = fabs(count_y);
+
+ while ((count_x > 0.0f) || (count_y > 0.0f)) {
+ if (count_x > 0.0f) {
+ DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_x,
+ pointer_x, pointer_y, pressure, tilt_x,
+ tilt_y);
+ DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_x,
+ pointer_x, pointer_y, pressure, tilt_x,
+ tilt_y);
+ count_x = count_x - 1.0f;
+ }
+ if (count_y > 0.0f) {
+ DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_y,
+ pointer_x, pointer_y, pressure, tilt_x,
+ tilt_y);
+ DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_y,
+ pointer_x, pointer_y, pressure, tilt_x,
+ tilt_y);
+ count_y = count_y - 1.0f;
+ }
+ }
}
/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
reflect changing modifier flags (alt, control, meta, etc) */
-void DarwinUpdateModKeys(int flags) {
- DarwinUpdateModifiers(KeyRelease, darwin_all_modifier_flags & ~flags & darwin_x11_modifier_mask);
- DarwinUpdateModifiers(KeyPress, ~darwin_all_modifier_flags & flags & darwin_x11_modifier_mask);
- darwin_all_modifier_flags = flags;
+void
+DarwinUpdateModKeys(int flags)
+{
+ DarwinUpdateModifiers(KeyRelease,
+ darwin_all_modifier_flags & ~flags &
+ darwin_x11_modifier_mask);
+ DarwinUpdateModifiers(KeyPress,
+ ~darwin_all_modifier_flags & flags &
+ darwin_x11_modifier_mask);
+ darwin_all_modifier_flags = flags;
}
/*
* DarwinSendDDXEvent
* Send the X server thread a message by placing it on the event queue.
*/
-void DarwinSendDDXEvent(int type, int argc, ...) {
+void
+DarwinSendDDXEvent(int type, int argc, ...)
+{
XQuartzEvent e;
int i;
va_list args;
@@ -611,14 +698,14 @@ void DarwinSendDDXEvent(int type, int argc, ...) {
e.subtype = type;
if (argc > 0 && argc < XQUARTZ_EVENT_MAXARGS) {
- va_start (args, argc);
+ va_start(args, argc);
for (i = 0; i < argc; i++)
- e.data[i] = (uint32_t) va_arg (args, uint32_t);
- va_end (args);
+ e.data[i] = (uint32_t) va_arg(args, uint32_t);
+ va_end(args);
}
darwinEvents_lock(); {
- mieqEnqueue(NULL, (InternalEvent*)&e);
+ mieqEnqueue(NULL, (InternalEvent *) &e);
DarwinPokeEQ();
} darwinEvents_unlock();
}
diff --git a/xorg-server/hw/xquartz/darwinEvents.h b/xorg-server/hw/xquartz/darwinEvents.h
index a44872b69..515dd3049 100644
--- a/xorg-server/hw/xquartz/darwinEvents.h
+++ b/xorg-server/hw/xquartz/darwinEvents.h
@@ -37,13 +37,16 @@ void DarwinEQEnqueue(const xEventPtr e);
void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
void DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev);
-void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, float pointer_x, float pointer_y,
- float pressure, float tilt_x, float tilt_y);
-void DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x, float pointer_y,
- float pressure, float tilt_x, float tilt_y);
+void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
+ float pointer_x, float pointer_y, float pressure,
+ float tilt_x, float tilt_y);
+void DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x,
+ float pointer_y, float pressure, float tilt_x,
+ float tilt_y);
void DarwinSendKeyboardEvents(int ev_type, int keycode);
-void DarwinSendScrollEvents(float count_x, float count_y, float pointer_x, float pointer_y,
- float pressure, float tilt_x, float tilt_y);
+void DarwinSendScrollEvents(float count_x, float count_y, float pointer_x,
+ float pointer_y, float pressure, float tilt_x,
+ float tilt_y);
void DarwinUpdateModKeys(int flags);
void DarwinListenOnOpenFD(int fd);
@@ -51,28 +54,28 @@ void DarwinListenOnOpenFD(int fd);
* Subtypes for the ET_XQuartz event type
*/
enum {
- kXquartzReloadKeymap, // Reload system keymap
- kXquartzActivate, // restore X drawing and cursor
- kXquartzDeactivate, // clip X drawing and switch to Aqua cursor
- kXquartzSetRootClip, // enable or disable drawing to the X screen
- kXquartzQuit, // kill the X server and release the display
- kXquartzBringAllToFront, // bring all X windows to front
- kXquartzToggleFullscreen, // Enable/Disable fullscreen mode
- kXquartzSetRootless, // Set rootless mode
- kXquartzSpaceChanged, // Spaces changed
- kXquartzListenOnOpenFD, // Listen to the launchd fd (passed as arg)
+ kXquartzReloadKeymap, // Reload system keymap
+ kXquartzActivate, // restore X drawing and cursor
+ kXquartzDeactivate, // clip X drawing and switch to Aqua cursor
+ kXquartzSetRootClip, // enable or disable drawing to the X screen
+ kXquartzQuit, // kill the X server and release the display
+ kXquartzBringAllToFront, // bring all X windows to front
+ kXquartzToggleFullscreen, // Enable/Disable fullscreen mode
+ kXquartzSetRootless, // Set rootless mode
+ kXquartzSpaceChanged, // Spaces changed
+ kXquartzListenOnOpenFD, // Listen to the launchd fd (passed as arg)
/*
* AppleWM events
*/
- kXquartzControllerNotify, // send an AppleWMControllerNotify event
- kXquartzPasteboardNotify, // notify the WM to copy or paste
- kXquartzReloadPreferences, // send AppleWMReloadPreferences
+ kXquartzControllerNotify, // send an AppleWMControllerNotify event
+ kXquartzPasteboardNotify, // notify the WM to copy or paste
+ kXquartzReloadPreferences, // send AppleWMReloadPreferences
/*
* Xplugin notification events
*/
- kXquartzDisplayChanged, // display configuration has changed
- kXquartzWindowState, // window visibility state has changed
- kXquartzWindowMoved, // window has moved on screen
+ kXquartzDisplayChanged, // display configuration has changed
+ kXquartzWindowState, // window visibility state has changed
+ kXquartzWindowMoved, // window has moved on screen
};
/* Send one of the above events to the server thread. */
@@ -89,4 +92,4 @@ extern int darwin_x11_modifier_mask;
/* The current state of the above listed modifiers */
extern int darwin_all_modifier_flags;
-#endif /* _DARWIN_EVENTS_H */
+#endif /* _DARWIN_EVENTS_H */
diff --git a/xorg-server/hw/xquartz/darwinXinput.c b/xorg-server/hw/xquartz/darwinXinput.c
index 94c31bb23..4d6604ed4 100644
--- a/xorg-server/hw/xquartz/darwinXinput.c
+++ b/xorg-server/hw/xquartz/darwinXinput.c
@@ -78,7 +78,7 @@ SOFTWARE.
int
SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
{
- DEBUG_LOG("SetDeviceMode(%p, %p, %d)\n", client, dev, mode);
+ DEBUG_LOG("SetDeviceMode(%p, %p, %d)\n", client, dev, mode);
return BadMatch;
}
@@ -96,11 +96,11 @@ SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
int
SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
- int *valuators, int first_valuator, int num_valuators)
+ int *valuators, int first_valuator, int num_valuators)
{
- DEBUG_LOG("SetDeviceValuators(%p, %p, %p, %d, %d)\n", client,
- dev, valuators, first_valuator, num_valuators);
- return BadMatch;
+ DEBUG_LOG("SetDeviceValuators(%p, %p, %p, %d, %d)\n", client,
+ dev, valuators, first_valuator, num_valuators);
+ return BadMatch;
}
/****************************************************************************
@@ -112,15 +112,13 @@ SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
*/
int
-ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
- xDeviceCtl * control)
+ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control)
{
- DEBUG_LOG("ChangeDeviceControl(%p, %p, %p)\n", client, dev, control);
- return BadMatch;
+ DEBUG_LOG("ChangeDeviceControl(%p, %p, %p)\n", client, dev, control);
+ return BadMatch;
}
-
/****************************************************************************
*
* Caller: configAddDevice (and others)
@@ -129,11 +127,11 @@ ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
*
*/
int
-NewInputDeviceRequest(InputOption *options, InputAttributes *attrs,
+NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
DeviceIntPtr *pdev)
{
- DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev);
- return BadValue;
+ DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev);
+ return BadValue;
}
/****************************************************************************
@@ -146,6 +144,5 @@ NewInputDeviceRequest(InputOption *options, InputAttributes *attrs,
void
DeleteInputDeviceRequest(DeviceIntPtr dev)
{
- DEBUG_LOG("DeleteInputDeviceRequest(%p)\n", dev);
+ DEBUG_LOG("DeleteInputDeviceRequest(%p)\n", dev);
}
-
diff --git a/xorg-server/hw/xquartz/keysym2ucs.c b/xorg-server/hw/xquartz/keysym2ucs.c
index 8626ebc4e..73ea55ad3 100644
--- a/xorg-server/hw/xquartz/keysym2ucs.c
+++ b/xorg-server/hw/xquartz/keysym2ucs.c
@@ -40,795 +40,796 @@
#include <string.h>
struct codepair {
- unsigned short keysym;
- unsigned short ucs;
+ unsigned short keysym;
+ unsigned short ucs;
};
const static struct codepair keysymtab[] = {
- { 0x01a1, 0x0104 },
- { 0x01a2, 0x02d8 },
- { 0x01a3, 0x0141 },
- { 0x01a5, 0x013d },
- { 0x01a6, 0x015a },
- { 0x01a9, 0x0160 },
- { 0x01aa, 0x015e },
- { 0x01ab, 0x0164 },
- { 0x01ac, 0x0179 },
- { 0x01ae, 0x017d },
- { 0x01af, 0x017b },
- { 0x01b1, 0x0105 },
- { 0x01b2, 0x02db },
- { 0x01b3, 0x0142 },
- { 0x01b5, 0x013e },
- { 0x01b6, 0x015b },
- { 0x01b7, 0x02c7 },
- { 0x01b9, 0x0161 },
- { 0x01ba, 0x015f },
- { 0x01bb, 0x0165 },
- { 0x01bc, 0x017a },
- { 0x01bd, 0x02dd },
- { 0x01be, 0x017e },
- { 0x01bf, 0x017c },
- { 0x01c0, 0x0154 },
- { 0x01c3, 0x0102 },
- { 0x01c5, 0x0139 },
- { 0x01c6, 0x0106 },
- { 0x01c8, 0x010c },
- { 0x01ca, 0x0118 },
- { 0x01cc, 0x011a },
- { 0x01cf, 0x010e },
- { 0x01d0, 0x0110 },
- { 0x01d1, 0x0143 },
- { 0x01d2, 0x0147 },
- { 0x01d5, 0x0150 },
- { 0x01d8, 0x0158 },
- { 0x01d9, 0x016e },
- { 0x01db, 0x0170 },
- { 0x01de, 0x0162 },
- { 0x01e0, 0x0155 },
- { 0x01e3, 0x0103 },
- { 0x01e5, 0x013a },
- { 0x01e6, 0x0107 },
- { 0x01e8, 0x010d },
- { 0x01ea, 0x0119 },
- { 0x01ec, 0x011b },
- { 0x01ef, 0x010f },
- { 0x01f0, 0x0111 },
- { 0x01f1, 0x0144 },
- { 0x01f2, 0x0148 },
- { 0x01f5, 0x0151 },
- { 0x01f8, 0x0159 },
- { 0x01f9, 0x016f },
- { 0x01fb, 0x0171 },
- { 0x01fe, 0x0163 },
- { 0x01ff, 0x02d9 },
- { 0x02a1, 0x0126 },
- { 0x02a6, 0x0124 },
- { 0x02a9, 0x0130 },
- { 0x02ab, 0x011e },
- { 0x02ac, 0x0134 },
- { 0x02b1, 0x0127 },
- { 0x02b6, 0x0125 },
- { 0x02b9, 0x0131 },
- { 0x02bb, 0x011f },
- { 0x02bc, 0x0135 },
- { 0x02c5, 0x010a },
- { 0x02c6, 0x0108 },
- { 0x02d5, 0x0120 },
- { 0x02d8, 0x011c },
- { 0x02dd, 0x016c },
- { 0x02de, 0x015c },
- { 0x02e5, 0x010b },
- { 0x02e6, 0x0109 },
- { 0x02f5, 0x0121 },
- { 0x02f8, 0x011d },
- { 0x02fd, 0x016d },
- { 0x02fe, 0x015d },
- { 0x03a2, 0x0138 },
- { 0x03a3, 0x0156 },
- { 0x03a5, 0x0128 },
- { 0x03a6, 0x013b },
- { 0x03aa, 0x0112 },
- { 0x03ab, 0x0122 },
- { 0x03ac, 0x0166 },
- { 0x03b3, 0x0157 },
- { 0x03b5, 0x0129 },
- { 0x03b6, 0x013c },
- { 0x03ba, 0x0113 },
- { 0x03bb, 0x0123 },
- { 0x03bc, 0x0167 },
- { 0x03bd, 0x014a },
- { 0x03bf, 0x014b },
- { 0x03c0, 0x0100 },
- { 0x03c7, 0x012e },
- { 0x03cc, 0x0116 },
- { 0x03cf, 0x012a },
- { 0x03d1, 0x0145 },
- { 0x03d2, 0x014c },
- { 0x03d3, 0x0136 },
- { 0x03d9, 0x0172 },
- { 0x03dd, 0x0168 },
- { 0x03de, 0x016a },
- { 0x03e0, 0x0101 },
- { 0x03e7, 0x012f },
- { 0x03ec, 0x0117 },
- { 0x03ef, 0x012b },
- { 0x03f1, 0x0146 },
- { 0x03f2, 0x014d },
- { 0x03f3, 0x0137 },
- { 0x03f9, 0x0173 },
- { 0x03fd, 0x0169 },
- { 0x03fe, 0x016b },
- { 0x047e, 0x203e },
- { 0x04a1, 0x3002 },
- { 0x04a2, 0x300c },
- { 0x04a3, 0x300d },
- { 0x04a4, 0x3001 },
- { 0x04a5, 0x30fb },
- { 0x04a6, 0x30f2 },
- { 0x04a7, 0x30a1 },
- { 0x04a8, 0x30a3 },
- { 0x04a9, 0x30a5 },
- { 0x04aa, 0x30a7 },
- { 0x04ab, 0x30a9 },
- { 0x04ac, 0x30e3 },
- { 0x04ad, 0x30e5 },
- { 0x04ae, 0x30e7 },
- { 0x04af, 0x30c3 },
- { 0x04b0, 0x30fc },
- { 0x04b1, 0x30a2 },
- { 0x04b2, 0x30a4 },
- { 0x04b3, 0x30a6 },
- { 0x04b4, 0x30a8 },
- { 0x04b5, 0x30aa },
- { 0x04b6, 0x30ab },
- { 0x04b7, 0x30ad },
- { 0x04b8, 0x30af },
- { 0x04b9, 0x30b1 },
- { 0x04ba, 0x30b3 },
- { 0x04bb, 0x30b5 },
- { 0x04bc, 0x30b7 },
- { 0x04bd, 0x30b9 },
- { 0x04be, 0x30bb },
- { 0x04bf, 0x30bd },
- { 0x04c0, 0x30bf },
- { 0x04c1, 0x30c1 },
- { 0x04c2, 0x30c4 },
- { 0x04c3, 0x30c6 },
- { 0x04c4, 0x30c8 },
- { 0x04c5, 0x30ca },
- { 0x04c6, 0x30cb },
- { 0x04c7, 0x30cc },
- { 0x04c8, 0x30cd },
- { 0x04c9, 0x30ce },
- { 0x04ca, 0x30cf },
- { 0x04cb, 0x30d2 },
- { 0x04cc, 0x30d5 },
- { 0x04cd, 0x30d8 },
- { 0x04ce, 0x30db },
- { 0x04cf, 0x30de },
- { 0x04d0, 0x30df },
- { 0x04d1, 0x30e0 },
- { 0x04d2, 0x30e1 },
- { 0x04d3, 0x30e2 },
- { 0x04d4, 0x30e4 },
- { 0x04d5, 0x30e6 },
- { 0x04d6, 0x30e8 },
- { 0x04d7, 0x30e9 },
- { 0x04d8, 0x30ea },
- { 0x04d9, 0x30eb },
- { 0x04da, 0x30ec },
- { 0x04db, 0x30ed },
- { 0x04dc, 0x30ef },
- { 0x04dd, 0x30f3 },
- { 0x04de, 0x309b },
- { 0x04df, 0x309c },
- { 0x05ac, 0x060c },
- { 0x05bb, 0x061b },
- { 0x05bf, 0x061f },
- { 0x05c1, 0x0621 },
- { 0x05c2, 0x0622 },
- { 0x05c3, 0x0623 },
- { 0x05c4, 0x0624 },
- { 0x05c5, 0x0625 },
- { 0x05c6, 0x0626 },
- { 0x05c7, 0x0627 },
- { 0x05c8, 0x0628 },
- { 0x05c9, 0x0629 },
- { 0x05ca, 0x062a },
- { 0x05cb, 0x062b },
- { 0x05cc, 0x062c },
- { 0x05cd, 0x062d },
- { 0x05ce, 0x062e },
- { 0x05cf, 0x062f },
- { 0x05d0, 0x0630 },
- { 0x05d1, 0x0631 },
- { 0x05d2, 0x0632 },
- { 0x05d3, 0x0633 },
- { 0x05d4, 0x0634 },
- { 0x05d5, 0x0635 },
- { 0x05d6, 0x0636 },
- { 0x05d7, 0x0637 },
- { 0x05d8, 0x0638 },
- { 0x05d9, 0x0639 },
- { 0x05da, 0x063a },
- { 0x05e0, 0x0640 },
- { 0x05e1, 0x0641 },
- { 0x05e2, 0x0642 },
- { 0x05e3, 0x0643 },
- { 0x05e4, 0x0644 },
- { 0x05e5, 0x0645 },
- { 0x05e6, 0x0646 },
- { 0x05e7, 0x0647 },
- { 0x05e8, 0x0648 },
- { 0x05e9, 0x0649 },
- { 0x05ea, 0x064a },
- { 0x05eb, 0x064b },
- { 0x05ec, 0x064c },
- { 0x05ed, 0x064d },
- { 0x05ee, 0x064e },
- { 0x05ef, 0x064f },
- { 0x05f0, 0x0650 },
- { 0x05f1, 0x0651 },
- { 0x05f2, 0x0652 },
- { 0x06a1, 0x0452 },
- { 0x06a2, 0x0453 },
- { 0x06a3, 0x0451 },
- { 0x06a4, 0x0454 },
- { 0x06a5, 0x0455 },
- { 0x06a6, 0x0456 },
- { 0x06a7, 0x0457 },
- { 0x06a8, 0x0458 },
- { 0x06a9, 0x0459 },
- { 0x06aa, 0x045a },
- { 0x06ab, 0x045b },
- { 0x06ac, 0x045c },
- { 0x06ae, 0x045e },
- { 0x06af, 0x045f },
- { 0x06b0, 0x2116 },
- { 0x06b1, 0x0402 },
- { 0x06b2, 0x0403 },
- { 0x06b3, 0x0401 },
- { 0x06b4, 0x0404 },
- { 0x06b5, 0x0405 },
- { 0x06b6, 0x0406 },
- { 0x06b7, 0x0407 },
- { 0x06b8, 0x0408 },
- { 0x06b9, 0x0409 },
- { 0x06ba, 0x040a },
- { 0x06bb, 0x040b },
- { 0x06bc, 0x040c },
- { 0x06be, 0x040e },
- { 0x06bf, 0x040f },
- { 0x06c0, 0x044e },
- { 0x06c1, 0x0430 },
- { 0x06c2, 0x0431 },
- { 0x06c3, 0x0446 },
- { 0x06c4, 0x0434 },
- { 0x06c5, 0x0435 },
- { 0x06c6, 0x0444 },
- { 0x06c7, 0x0433 },
- { 0x06c8, 0x0445 },
- { 0x06c9, 0x0438 },
- { 0x06ca, 0x0439 },
- { 0x06cb, 0x043a },
- { 0x06cc, 0x043b },
- { 0x06cd, 0x043c },
- { 0x06ce, 0x043d },
- { 0x06cf, 0x043e },
- { 0x06d0, 0x043f },
- { 0x06d1, 0x044f },
- { 0x06d2, 0x0440 },
- { 0x06d3, 0x0441 },
- { 0x06d4, 0x0442 },
- { 0x06d5, 0x0443 },
- { 0x06d6, 0x0436 },
- { 0x06d7, 0x0432 },
- { 0x06d8, 0x044c },
- { 0x06d9, 0x044b },
- { 0x06da, 0x0437 },
- { 0x06db, 0x0448 },
- { 0x06dc, 0x044d },
- { 0x06dd, 0x0449 },
- { 0x06de, 0x0447 },
- { 0x06df, 0x044a },
- { 0x06e0, 0x042e },
- { 0x06e1, 0x0410 },
- { 0x06e2, 0x0411 },
- { 0x06e3, 0x0426 },
- { 0x06e4, 0x0414 },
- { 0x06e5, 0x0415 },
- { 0x06e6, 0x0424 },
- { 0x06e7, 0x0413 },
- { 0x06e8, 0x0425 },
- { 0x06e9, 0x0418 },
- { 0x06ea, 0x0419 },
- { 0x06eb, 0x041a },
- { 0x06ec, 0x041b },
- { 0x06ed, 0x041c },
- { 0x06ee, 0x041d },
- { 0x06ef, 0x041e },
- { 0x06f0, 0x041f },
- { 0x06f1, 0x042f },
- { 0x06f2, 0x0420 },
- { 0x06f3, 0x0421 },
- { 0x06f4, 0x0422 },
- { 0x06f5, 0x0423 },
- { 0x06f6, 0x0416 },
- { 0x06f7, 0x0412 },
- { 0x06f8, 0x042c },
- { 0x06f9, 0x042b },
- { 0x06fa, 0x0417 },
- { 0x06fb, 0x0428 },
- { 0x06fc, 0x042d },
- { 0x06fd, 0x0429 },
- { 0x06fe, 0x0427 },
- { 0x06ff, 0x042a },
- { 0x07a1, 0x0386 },
- { 0x07a2, 0x0388 },
- { 0x07a3, 0x0389 },
- { 0x07a4, 0x038a },
- { 0x07a5, 0x03aa },
- { 0x07a7, 0x038c },
- { 0x07a8, 0x038e },
- { 0x07a9, 0x03ab },
- { 0x07ab, 0x038f },
- { 0x07ae, 0x0385 },
- { 0x07af, 0x2015 },
- { 0x07b1, 0x03ac },
- { 0x07b2, 0x03ad },
- { 0x07b3, 0x03ae },
- { 0x07b4, 0x03af },
- { 0x07b5, 0x03ca },
- { 0x07b6, 0x0390 },
- { 0x07b7, 0x03cc },
- { 0x07b8, 0x03cd },
- { 0x07b9, 0x03cb },
- { 0x07ba, 0x03b0 },
- { 0x07bb, 0x03ce },
- { 0x07c1, 0x0391 },
- { 0x07c2, 0x0392 },
- { 0x07c3, 0x0393 },
- { 0x07c4, 0x0394 },
- { 0x07c5, 0x0395 },
- { 0x07c6, 0x0396 },
- { 0x07c7, 0x0397 },
- { 0x07c8, 0x0398 },
- { 0x07c9, 0x0399 },
- { 0x07ca, 0x039a },
- { 0x07cb, 0x039b },
- { 0x07cc, 0x039c },
- { 0x07cd, 0x039d },
- { 0x07ce, 0x039e },
- { 0x07cf, 0x039f },
- { 0x07d0, 0x03a0 },
- { 0x07d1, 0x03a1 },
- { 0x07d2, 0x03a3 },
- { 0x07d4, 0x03a4 },
- { 0x07d5, 0x03a5 },
- { 0x07d6, 0x03a6 },
- { 0x07d7, 0x03a7 },
- { 0x07d8, 0x03a8 },
- { 0x07d9, 0x03a9 },
- { 0x07e1, 0x03b1 },
- { 0x07e2, 0x03b2 },
- { 0x07e3, 0x03b3 },
- { 0x07e4, 0x03b4 },
- { 0x07e5, 0x03b5 },
- { 0x07e6, 0x03b6 },
- { 0x07e7, 0x03b7 },
- { 0x07e8, 0x03b8 },
- { 0x07e9, 0x03b9 },
- { 0x07ea, 0x03ba },
- { 0x07eb, 0x03bb },
- { 0x07ec, 0x03bc },
- { 0x07ed, 0x03bd },
- { 0x07ee, 0x03be },
- { 0x07ef, 0x03bf },
- { 0x07f0, 0x03c0 },
- { 0x07f1, 0x03c1 },
- { 0x07f2, 0x03c3 },
- { 0x07f3, 0x03c2 },
- { 0x07f4, 0x03c4 },
- { 0x07f5, 0x03c5 },
- { 0x07f6, 0x03c6 },
- { 0x07f7, 0x03c7 },
- { 0x07f8, 0x03c8 },
- { 0x07f9, 0x03c9 },
- { 0x08a1, 0x23b7 },
- { 0x08a2, 0x250c },
- { 0x08a3, 0x2500 },
- { 0x08a4, 0x2320 },
- { 0x08a5, 0x2321 },
- { 0x08a6, 0x2502 },
- { 0x08a7, 0x23a1 },
- { 0x08a8, 0x23a3 },
- { 0x08a9, 0x23a4 },
- { 0x08aa, 0x23a6 },
- { 0x08ab, 0x239b },
- { 0x08ac, 0x239d },
- { 0x08ad, 0x239e },
- { 0x08ae, 0x23a0 },
- { 0x08af, 0x23a8 },
- { 0x08b0, 0x23ac },
- { 0x08bc, 0x2264 },
- { 0x08bd, 0x2260 },
- { 0x08be, 0x2265 },
- { 0x08bf, 0x222b },
- { 0x08c0, 0x2234 },
- { 0x08c1, 0x221d },
- { 0x08c2, 0x221e },
- { 0x08c5, 0x2207 },
- { 0x08c8, 0x223c },
- { 0x08c9, 0x2243 },
- { 0x08cd, 0x21d4 },
- { 0x08ce, 0x21d2 },
- { 0x08cf, 0x2261 },
- { 0x08d6, 0x221a },
- { 0x08da, 0x2282 },
- { 0x08db, 0x2283 },
- { 0x08dc, 0x2229 },
- { 0x08dd, 0x222a },
- { 0x08de, 0x2227 },
- { 0x08df, 0x2228 },
- { 0x08ef, 0x2202 },
- { 0x08f6, 0x0192 },
- { 0x08fb, 0x2190 },
- { 0x08fc, 0x2191 },
- { 0x08fd, 0x2192 },
- { 0x08fe, 0x2193 },
- { 0x09e0, 0x25c6 },
- { 0x09e1, 0x2592 },
- { 0x09e2, 0x2409 },
- { 0x09e3, 0x240c },
- { 0x09e4, 0x240d },
- { 0x09e5, 0x240a },
- { 0x09e8, 0x2424 },
- { 0x09e9, 0x240b },
- { 0x09ea, 0x2518 },
- { 0x09eb, 0x2510 },
- { 0x09ec, 0x250c },
- { 0x09ed, 0x2514 },
- { 0x09ee, 0x253c },
- { 0x09ef, 0x23ba },
- { 0x09f0, 0x23bb },
- { 0x09f1, 0x2500 },
- { 0x09f2, 0x23bc },
- { 0x09f3, 0x23bd },
- { 0x09f4, 0x251c },
- { 0x09f5, 0x2524 },
- { 0x09f6, 0x2534 },
- { 0x09f7, 0x252c },
- { 0x09f8, 0x2502 },
- { 0x0aa1, 0x2003 },
- { 0x0aa2, 0x2002 },
- { 0x0aa3, 0x2004 },
- { 0x0aa4, 0x2005 },
- { 0x0aa5, 0x2007 },
- { 0x0aa6, 0x2008 },
- { 0x0aa7, 0x2009 },
- { 0x0aa8, 0x200a },
- { 0x0aa9, 0x2014 },
- { 0x0aaa, 0x2013 },
- { 0x0aae, 0x2026 },
- { 0x0aaf, 0x2025 },
- { 0x0ab0, 0x2153 },
- { 0x0ab1, 0x2154 },
- { 0x0ab2, 0x2155 },
- { 0x0ab3, 0x2156 },
- { 0x0ab4, 0x2157 },
- { 0x0ab5, 0x2158 },
- { 0x0ab6, 0x2159 },
- { 0x0ab7, 0x215a },
- { 0x0ab8, 0x2105 },
- { 0x0abb, 0x2012 },
- { 0x0abc, 0x2329 },
- { 0x0abe, 0x232a },
- { 0x0ac3, 0x215b },
- { 0x0ac4, 0x215c },
- { 0x0ac5, 0x215d },
- { 0x0ac6, 0x215e },
- { 0x0ac9, 0x2122 },
- { 0x0aca, 0x2613 },
- { 0x0acc, 0x25c1 },
- { 0x0acd, 0x25b7 },
- { 0x0ace, 0x25cb },
- { 0x0acf, 0x25af },
- { 0x0ad0, 0x2018 },
- { 0x0ad1, 0x2019 },
- { 0x0ad2, 0x201c },
- { 0x0ad3, 0x201d },
- { 0x0ad4, 0x211e },
- { 0x0ad6, 0x2032 },
- { 0x0ad7, 0x2033 },
- { 0x0ad9, 0x271d },
- { 0x0adb, 0x25ac },
- { 0x0adc, 0x25c0 },
- { 0x0add, 0x25b6 },
- { 0x0ade, 0x25cf },
- { 0x0adf, 0x25ae },
- { 0x0ae0, 0x25e6 },
- { 0x0ae1, 0x25ab },
- { 0x0ae2, 0x25ad },
- { 0x0ae3, 0x25b3 },
- { 0x0ae4, 0x25bd },
- { 0x0ae5, 0x2606 },
- { 0x0ae6, 0x2022 },
- { 0x0ae7, 0x25aa },
- { 0x0ae8, 0x25b2 },
- { 0x0ae9, 0x25bc },
- { 0x0aea, 0x261c },
- { 0x0aeb, 0x261e },
- { 0x0aec, 0x2663 },
- { 0x0aed, 0x2666 },
- { 0x0aee, 0x2665 },
- { 0x0af0, 0x2720 },
- { 0x0af1, 0x2020 },
- { 0x0af2, 0x2021 },
- { 0x0af3, 0x2713 },
- { 0x0af4, 0x2717 },
- { 0x0af5, 0x266f },
- { 0x0af6, 0x266d },
- { 0x0af7, 0x2642 },
- { 0x0af8, 0x2640 },
- { 0x0af9, 0x260e },
- { 0x0afa, 0x2315 },
- { 0x0afb, 0x2117 },
- { 0x0afc, 0x2038 },
- { 0x0afd, 0x201a },
- { 0x0afe, 0x201e },
- { 0x0ba3, 0x003c },
- { 0x0ba6, 0x003e },
- { 0x0ba8, 0x2228 },
- { 0x0ba9, 0x2227 },
- { 0x0bc0, 0x00af },
- { 0x0bc2, 0x22a5 },
- { 0x0bc3, 0x2229 },
- { 0x0bc4, 0x230a },
- { 0x0bc6, 0x005f },
- { 0x0bca, 0x2218 },
- { 0x0bcc, 0x2395 },
- { 0x0bce, 0x22a4 },
- { 0x0bcf, 0x25cb },
- { 0x0bd3, 0x2308 },
- { 0x0bd6, 0x222a },
- { 0x0bd8, 0x2283 },
- { 0x0bda, 0x2282 },
- { 0x0bdc, 0x22a2 },
- { 0x0bfc, 0x22a3 },
- { 0x0cdf, 0x2017 },
- { 0x0ce0, 0x05d0 },
- { 0x0ce1, 0x05d1 },
- { 0x0ce2, 0x05d2 },
- { 0x0ce3, 0x05d3 },
- { 0x0ce4, 0x05d4 },
- { 0x0ce5, 0x05d5 },
- { 0x0ce6, 0x05d6 },
- { 0x0ce7, 0x05d7 },
- { 0x0ce8, 0x05d8 },
- { 0x0ce9, 0x05d9 },
- { 0x0cea, 0x05da },
- { 0x0ceb, 0x05db },
- { 0x0cec, 0x05dc },
- { 0x0ced, 0x05dd },
- { 0x0cee, 0x05de },
- { 0x0cef, 0x05df },
- { 0x0cf0, 0x05e0 },
- { 0x0cf1, 0x05e1 },
- { 0x0cf2, 0x05e2 },
- { 0x0cf3, 0x05e3 },
- { 0x0cf4, 0x05e4 },
- { 0x0cf5, 0x05e5 },
- { 0x0cf6, 0x05e6 },
- { 0x0cf7, 0x05e7 },
- { 0x0cf8, 0x05e8 },
- { 0x0cf9, 0x05e9 },
- { 0x0cfa, 0x05ea },
- { 0x0da1, 0x0e01 },
- { 0x0da2, 0x0e02 },
- { 0x0da3, 0x0e03 },
- { 0x0da4, 0x0e04 },
- { 0x0da5, 0x0e05 },
- { 0x0da6, 0x0e06 },
- { 0x0da7, 0x0e07 },
- { 0x0da8, 0x0e08 },
- { 0x0da9, 0x0e09 },
- { 0x0daa, 0x0e0a },
- { 0x0dab, 0x0e0b },
- { 0x0dac, 0x0e0c },
- { 0x0dad, 0x0e0d },
- { 0x0dae, 0x0e0e },
- { 0x0daf, 0x0e0f },
- { 0x0db0, 0x0e10 },
- { 0x0db1, 0x0e11 },
- { 0x0db2, 0x0e12 },
- { 0x0db3, 0x0e13 },
- { 0x0db4, 0x0e14 },
- { 0x0db5, 0x0e15 },
- { 0x0db6, 0x0e16 },
- { 0x0db7, 0x0e17 },
- { 0x0db8, 0x0e18 },
- { 0x0db9, 0x0e19 },
- { 0x0dba, 0x0e1a },
- { 0x0dbb, 0x0e1b },
- { 0x0dbc, 0x0e1c },
- { 0x0dbd, 0x0e1d },
- { 0x0dbe, 0x0e1e },
- { 0x0dbf, 0x0e1f },
- { 0x0dc0, 0x0e20 },
- { 0x0dc1, 0x0e21 },
- { 0x0dc2, 0x0e22 },
- { 0x0dc3, 0x0e23 },
- { 0x0dc4, 0x0e24 },
- { 0x0dc5, 0x0e25 },
- { 0x0dc6, 0x0e26 },
- { 0x0dc7, 0x0e27 },
- { 0x0dc8, 0x0e28 },
- { 0x0dc9, 0x0e29 },
- { 0x0dca, 0x0e2a },
- { 0x0dcb, 0x0e2b },
- { 0x0dcc, 0x0e2c },
- { 0x0dcd, 0x0e2d },
- { 0x0dce, 0x0e2e },
- { 0x0dcf, 0x0e2f },
- { 0x0dd0, 0x0e30 },
- { 0x0dd1, 0x0e31 },
- { 0x0dd2, 0x0e32 },
- { 0x0dd3, 0x0e33 },
- { 0x0dd4, 0x0e34 },
- { 0x0dd5, 0x0e35 },
- { 0x0dd6, 0x0e36 },
- { 0x0dd7, 0x0e37 },
- { 0x0dd8, 0x0e38 },
- { 0x0dd9, 0x0e39 },
- { 0x0dda, 0x0e3a },
- { 0x0ddf, 0x0e3f },
- { 0x0de0, 0x0e40 },
- { 0x0de1, 0x0e41 },
- { 0x0de2, 0x0e42 },
- { 0x0de3, 0x0e43 },
- { 0x0de4, 0x0e44 },
- { 0x0de5, 0x0e45 },
- { 0x0de6, 0x0e46 },
- { 0x0de7, 0x0e47 },
- { 0x0de8, 0x0e48 },
- { 0x0de9, 0x0e49 },
- { 0x0dea, 0x0e4a },
- { 0x0deb, 0x0e4b },
- { 0x0dec, 0x0e4c },
- { 0x0ded, 0x0e4d },
- { 0x0df0, 0x0e50 },
- { 0x0df1, 0x0e51 },
- { 0x0df2, 0x0e52 },
- { 0x0df3, 0x0e53 },
- { 0x0df4, 0x0e54 },
- { 0x0df5, 0x0e55 },
- { 0x0df6, 0x0e56 },
- { 0x0df7, 0x0e57 },
- { 0x0df8, 0x0e58 },
- { 0x0df9, 0x0e59 },
- { 0x0ea1, 0x3131 },
- { 0x0ea2, 0x3132 },
- { 0x0ea3, 0x3133 },
- { 0x0ea4, 0x3134 },
- { 0x0ea5, 0x3135 },
- { 0x0ea6, 0x3136 },
- { 0x0ea7, 0x3137 },
- { 0x0ea8, 0x3138 },
- { 0x0ea9, 0x3139 },
- { 0x0eaa, 0x313a },
- { 0x0eab, 0x313b },
- { 0x0eac, 0x313c },
- { 0x0ead, 0x313d },
- { 0x0eae, 0x313e },
- { 0x0eaf, 0x313f },
- { 0x0eb0, 0x3140 },
- { 0x0eb1, 0x3141 },
- { 0x0eb2, 0x3142 },
- { 0x0eb3, 0x3143 },
- { 0x0eb4, 0x3144 },
- { 0x0eb5, 0x3145 },
- { 0x0eb6, 0x3146 },
- { 0x0eb7, 0x3147 },
- { 0x0eb8, 0x3148 },
- { 0x0eb9, 0x3149 },
- { 0x0eba, 0x314a },
- { 0x0ebb, 0x314b },
- { 0x0ebc, 0x314c },
- { 0x0ebd, 0x314d },
- { 0x0ebe, 0x314e },
- { 0x0ebf, 0x314f },
- { 0x0ec0, 0x3150 },
- { 0x0ec1, 0x3151 },
- { 0x0ec2, 0x3152 },
- { 0x0ec3, 0x3153 },
- { 0x0ec4, 0x3154 },
- { 0x0ec5, 0x3155 },
- { 0x0ec6, 0x3156 },
- { 0x0ec7, 0x3157 },
- { 0x0ec8, 0x3158 },
- { 0x0ec9, 0x3159 },
- { 0x0eca, 0x315a },
- { 0x0ecb, 0x315b },
- { 0x0ecc, 0x315c },
- { 0x0ecd, 0x315d },
- { 0x0ece, 0x315e },
- { 0x0ecf, 0x315f },
- { 0x0ed0, 0x3160 },
- { 0x0ed1, 0x3161 },
- { 0x0ed2, 0x3162 },
- { 0x0ed3, 0x3163 },
- { 0x0ed4, 0x11a8 },
- { 0x0ed5, 0x11a9 },
- { 0x0ed6, 0x11aa },
- { 0x0ed7, 0x11ab },
- { 0x0ed8, 0x11ac },
- { 0x0ed9, 0x11ad },
- { 0x0eda, 0x11ae },
- { 0x0edb, 0x11af },
- { 0x0edc, 0x11b0 },
- { 0x0edd, 0x11b1 },
- { 0x0ede, 0x11b2 },
- { 0x0edf, 0x11b3 },
- { 0x0ee0, 0x11b4 },
- { 0x0ee1, 0x11b5 },
- { 0x0ee2, 0x11b6 },
- { 0x0ee3, 0x11b7 },
- { 0x0ee4, 0x11b8 },
- { 0x0ee5, 0x11b9 },
- { 0x0ee6, 0x11ba },
- { 0x0ee7, 0x11bb },
- { 0x0ee8, 0x11bc },
- { 0x0ee9, 0x11bd },
- { 0x0eea, 0x11be },
- { 0x0eeb, 0x11bf },
- { 0x0eec, 0x11c0 },
- { 0x0eed, 0x11c1 },
- { 0x0eee, 0x11c2 },
- { 0x0eef, 0x316d },
- { 0x0ef0, 0x3171 },
- { 0x0ef1, 0x3178 },
- { 0x0ef2, 0x317f },
- { 0x0ef3, 0x3181 },
- { 0x0ef4, 0x3184 },
- { 0x0ef5, 0x3186 },
- { 0x0ef6, 0x318d },
- { 0x0ef7, 0x318e },
- { 0x0ef8, 0x11eb },
- { 0x0ef9, 0x11f0 },
- { 0x0efa, 0x11f9 },
- { 0x0eff, 0x20a9 },
+ {0x01a1, 0x0104},
+ {0x01a2, 0x02d8},
+ {0x01a3, 0x0141},
+ {0x01a5, 0x013d},
+ {0x01a6, 0x015a},
+ {0x01a9, 0x0160},
+ {0x01aa, 0x015e},
+ {0x01ab, 0x0164},
+ {0x01ac, 0x0179},
+ {0x01ae, 0x017d},
+ {0x01af, 0x017b},
+ {0x01b1, 0x0105},
+ {0x01b2, 0x02db},
+ {0x01b3, 0x0142},
+ {0x01b5, 0x013e},
+ {0x01b6, 0x015b},
+ {0x01b7, 0x02c7},
+ {0x01b9, 0x0161},
+ {0x01ba, 0x015f},
+ {0x01bb, 0x0165},
+ {0x01bc, 0x017a},
+ {0x01bd, 0x02dd},
+ {0x01be, 0x017e},
+ {0x01bf, 0x017c},
+ {0x01c0, 0x0154},
+ {0x01c3, 0x0102},
+ {0x01c5, 0x0139},
+ {0x01c6, 0x0106},
+ {0x01c8, 0x010c},
+ {0x01ca, 0x0118},
+ {0x01cc, 0x011a},
+ {0x01cf, 0x010e},
+ {0x01d0, 0x0110},
+ {0x01d1, 0x0143},
+ {0x01d2, 0x0147},
+ {0x01d5, 0x0150},
+ {0x01d8, 0x0158},
+ {0x01d9, 0x016e},
+ {0x01db, 0x0170},
+ {0x01de, 0x0162},
+ {0x01e0, 0x0155},
+ {0x01e3, 0x0103},
+ {0x01e5, 0x013a},
+ {0x01e6, 0x0107},
+ {0x01e8, 0x010d},
+ {0x01ea, 0x0119},
+ {0x01ec, 0x011b},
+ {0x01ef, 0x010f},
+ {0x01f0, 0x0111},
+ {0x01f1, 0x0144},
+ {0x01f2, 0x0148},
+ {0x01f5, 0x0151},
+ {0x01f8, 0x0159},
+ {0x01f9, 0x016f},
+ {0x01fb, 0x0171},
+ {0x01fe, 0x0163},
+ {0x01ff, 0x02d9},
+ {0x02a1, 0x0126},
+ {0x02a6, 0x0124},
+ {0x02a9, 0x0130},
+ {0x02ab, 0x011e},
+ {0x02ac, 0x0134},
+ {0x02b1, 0x0127},
+ {0x02b6, 0x0125},
+ {0x02b9, 0x0131},
+ {0x02bb, 0x011f},
+ {0x02bc, 0x0135},
+ {0x02c5, 0x010a},
+ {0x02c6, 0x0108},
+ {0x02d5, 0x0120},
+ {0x02d8, 0x011c},
+ {0x02dd, 0x016c},
+ {0x02de, 0x015c},
+ {0x02e5, 0x010b},
+ {0x02e6, 0x0109},
+ {0x02f5, 0x0121},
+ {0x02f8, 0x011d},
+ {0x02fd, 0x016d},
+ {0x02fe, 0x015d},
+ {0x03a2, 0x0138},
+ {0x03a3, 0x0156},
+ {0x03a5, 0x0128},
+ {0x03a6, 0x013b},
+ {0x03aa, 0x0112},
+ {0x03ab, 0x0122},
+ {0x03ac, 0x0166},
+ {0x03b3, 0x0157},
+ {0x03b5, 0x0129},
+ {0x03b6, 0x013c},
+ {0x03ba, 0x0113},
+ {0x03bb, 0x0123},
+ {0x03bc, 0x0167},
+ {0x03bd, 0x014a},
+ {0x03bf, 0x014b},
+ {0x03c0, 0x0100},
+ {0x03c7, 0x012e},
+ {0x03cc, 0x0116},
+ {0x03cf, 0x012a},
+ {0x03d1, 0x0145},
+ {0x03d2, 0x014c},
+ {0x03d3, 0x0136},
+ {0x03d9, 0x0172},
+ {0x03dd, 0x0168},
+ {0x03de, 0x016a},
+ {0x03e0, 0x0101},
+ {0x03e7, 0x012f},
+ {0x03ec, 0x0117},
+ {0x03ef, 0x012b},
+ {0x03f1, 0x0146},
+ {0x03f2, 0x014d},
+ {0x03f3, 0x0137},
+ {0x03f9, 0x0173},
+ {0x03fd, 0x0169},
+ {0x03fe, 0x016b},
+ {0x047e, 0x203e},
+ {0x04a1, 0x3002},
+ {0x04a2, 0x300c},
+ {0x04a3, 0x300d},
+ {0x04a4, 0x3001},
+ {0x04a5, 0x30fb},
+ {0x04a6, 0x30f2},
+ {0x04a7, 0x30a1},
+ {0x04a8, 0x30a3},
+ {0x04a9, 0x30a5},
+ {0x04aa, 0x30a7},
+ {0x04ab, 0x30a9},
+ {0x04ac, 0x30e3},
+ {0x04ad, 0x30e5},
+ {0x04ae, 0x30e7},
+ {0x04af, 0x30c3},
+ {0x04b0, 0x30fc},
+ {0x04b1, 0x30a2},
+ {0x04b2, 0x30a4},
+ {0x04b3, 0x30a6},
+ {0x04b4, 0x30a8},
+ {0x04b5, 0x30aa},
+ {0x04b6, 0x30ab},
+ {0x04b7, 0x30ad},
+ {0x04b8, 0x30af},
+ {0x04b9, 0x30b1},
+ {0x04ba, 0x30b3},
+ {0x04bb, 0x30b5},
+ {0x04bc, 0x30b7},
+ {0x04bd, 0x30b9},
+ {0x04be, 0x30bb},
+ {0x04bf, 0x30bd},
+ {0x04c0, 0x30bf},
+ {0x04c1, 0x30c1},
+ {0x04c2, 0x30c4},
+ {0x04c3, 0x30c6},
+ {0x04c4, 0x30c8},
+ {0x04c5, 0x30ca},
+ {0x04c6, 0x30cb},
+ {0x04c7, 0x30cc},
+ {0x04c8, 0x30cd},
+ {0x04c9, 0x30ce},
+ {0x04ca, 0x30cf},
+ {0x04cb, 0x30d2},
+ {0x04cc, 0x30d5},
+ {0x04cd, 0x30d8},
+ {0x04ce, 0x30db},
+ {0x04cf, 0x30de},
+ {0x04d0, 0x30df},
+ {0x04d1, 0x30e0},
+ {0x04d2, 0x30e1},
+ {0x04d3, 0x30e2},
+ {0x04d4, 0x30e4},
+ {0x04d5, 0x30e6},
+ {0x04d6, 0x30e8},
+ {0x04d7, 0x30e9},
+ {0x04d8, 0x30ea},
+ {0x04d9, 0x30eb},
+ {0x04da, 0x30ec},
+ {0x04db, 0x30ed},
+ {0x04dc, 0x30ef},
+ {0x04dd, 0x30f3},
+ {0x04de, 0x309b},
+ {0x04df, 0x309c},
+ {0x05ac, 0x060c},
+ {0x05bb, 0x061b},
+ {0x05bf, 0x061f},
+ {0x05c1, 0x0621},
+ {0x05c2, 0x0622},
+ {0x05c3, 0x0623},
+ {0x05c4, 0x0624},
+ {0x05c5, 0x0625},
+ {0x05c6, 0x0626},
+ {0x05c7, 0x0627},
+ {0x05c8, 0x0628},
+ {0x05c9, 0x0629},
+ {0x05ca, 0x062a},
+ {0x05cb, 0x062b},
+ {0x05cc, 0x062c},
+ {0x05cd, 0x062d},
+ {0x05ce, 0x062e},
+ {0x05cf, 0x062f},
+ {0x05d0, 0x0630},
+ {0x05d1, 0x0631},
+ {0x05d2, 0x0632},
+ {0x05d3, 0x0633},
+ {0x05d4, 0x0634},
+ {0x05d5, 0x0635},
+ {0x05d6, 0x0636},
+ {0x05d7, 0x0637},
+ {0x05d8, 0x0638},
+ {0x05d9, 0x0639},
+ {0x05da, 0x063a},
+ {0x05e0, 0x0640},
+ {0x05e1, 0x0641},
+ {0x05e2, 0x0642},
+ {0x05e3, 0x0643},
+ {0x05e4, 0x0644},
+ {0x05e5, 0x0645},
+ {0x05e6, 0x0646},
+ {0x05e7, 0x0647},
+ {0x05e8, 0x0648},
+ {0x05e9, 0x0649},
+ {0x05ea, 0x064a},
+ {0x05eb, 0x064b},
+ {0x05ec, 0x064c},
+ {0x05ed, 0x064d},
+ {0x05ee, 0x064e},
+ {0x05ef, 0x064f},
+ {0x05f0, 0x0650},
+ {0x05f1, 0x0651},
+ {0x05f2, 0x0652},
+ {0x06a1, 0x0452},
+ {0x06a2, 0x0453},
+ {0x06a3, 0x0451},
+ {0x06a4, 0x0454},
+ {0x06a5, 0x0455},
+ {0x06a6, 0x0456},
+ {0x06a7, 0x0457},
+ {0x06a8, 0x0458},
+ {0x06a9, 0x0459},
+ {0x06aa, 0x045a},
+ {0x06ab, 0x045b},
+ {0x06ac, 0x045c},
+ {0x06ae, 0x045e},
+ {0x06af, 0x045f},
+ {0x06b0, 0x2116},
+ {0x06b1, 0x0402},
+ {0x06b2, 0x0403},
+ {0x06b3, 0x0401},
+ {0x06b4, 0x0404},
+ {0x06b5, 0x0405},
+ {0x06b6, 0x0406},
+ {0x06b7, 0x0407},
+ {0x06b8, 0x0408},
+ {0x06b9, 0x0409},
+ {0x06ba, 0x040a},
+ {0x06bb, 0x040b},
+ {0x06bc, 0x040c},
+ {0x06be, 0x040e},
+ {0x06bf, 0x040f},
+ {0x06c0, 0x044e},
+ {0x06c1, 0x0430},
+ {0x06c2, 0x0431},
+ {0x06c3, 0x0446},
+ {0x06c4, 0x0434},
+ {0x06c5, 0x0435},
+ {0x06c6, 0x0444},
+ {0x06c7, 0x0433},
+ {0x06c8, 0x0445},
+ {0x06c9, 0x0438},
+ {0x06ca, 0x0439},
+ {0x06cb, 0x043a},
+ {0x06cc, 0x043b},
+ {0x06cd, 0x043c},
+ {0x06ce, 0x043d},
+ {0x06cf, 0x043e},
+ {0x06d0, 0x043f},
+ {0x06d1, 0x044f},
+ {0x06d2, 0x0440},
+ {0x06d3, 0x0441},
+ {0x06d4, 0x0442},
+ {0x06d5, 0x0443},
+ {0x06d6, 0x0436},
+ {0x06d7, 0x0432},
+ {0x06d8, 0x044c},
+ {0x06d9, 0x044b},
+ {0x06da, 0x0437},
+ {0x06db, 0x0448},
+ {0x06dc, 0x044d},
+ {0x06dd, 0x0449},
+ {0x06de, 0x0447},
+ {0x06df, 0x044a},
+ {0x06e0, 0x042e},
+ {0x06e1, 0x0410},
+ {0x06e2, 0x0411},
+ {0x06e3, 0x0426},
+ {0x06e4, 0x0414},
+ {0x06e5, 0x0415},
+ {0x06e6, 0x0424},
+ {0x06e7, 0x0413},
+ {0x06e8, 0x0425},
+ {0x06e9, 0x0418},
+ {0x06ea, 0x0419},
+ {0x06eb, 0x041a},
+ {0x06ec, 0x041b},
+ {0x06ed, 0x041c},
+ {0x06ee, 0x041d},
+ {0x06ef, 0x041e},
+ {0x06f0, 0x041f},
+ {0x06f1, 0x042f},
+ {0x06f2, 0x0420},
+ {0x06f3, 0x0421},
+ {0x06f4, 0x0422},
+ {0x06f5, 0x0423},
+ {0x06f6, 0x0416},
+ {0x06f7, 0x0412},
+ {0x06f8, 0x042c},
+ {0x06f9, 0x042b},
+ {0x06fa, 0x0417},
+ {0x06fb, 0x0428},
+ {0x06fc, 0x042d},
+ {0x06fd, 0x0429},
+ {0x06fe, 0x0427},
+ {0x06ff, 0x042a},
+ {0x07a1, 0x0386},
+ {0x07a2, 0x0388},
+ {0x07a3, 0x0389},
+ {0x07a4, 0x038a},
+ {0x07a5, 0x03aa},
+ {0x07a7, 0x038c},
+ {0x07a8, 0x038e},
+ {0x07a9, 0x03ab},
+ {0x07ab, 0x038f},
+ {0x07ae, 0x0385},
+ {0x07af, 0x2015},
+ {0x07b1, 0x03ac},
+ {0x07b2, 0x03ad},
+ {0x07b3, 0x03ae},
+ {0x07b4, 0x03af},
+ {0x07b5, 0x03ca},
+ {0x07b6, 0x0390},
+ {0x07b7, 0x03cc},
+ {0x07b8, 0x03cd},
+ {0x07b9, 0x03cb},
+ {0x07ba, 0x03b0},
+ {0x07bb, 0x03ce},
+ {0x07c1, 0x0391},
+ {0x07c2, 0x0392},
+ {0x07c3, 0x0393},
+ {0x07c4, 0x0394},
+ {0x07c5, 0x0395},
+ {0x07c6, 0x0396},
+ {0x07c7, 0x0397},
+ {0x07c8, 0x0398},
+ {0x07c9, 0x0399},
+ {0x07ca, 0x039a},
+ {0x07cb, 0x039b},
+ {0x07cc, 0x039c},
+ {0x07cd, 0x039d},
+ {0x07ce, 0x039e},
+ {0x07cf, 0x039f},
+ {0x07d0, 0x03a0},
+ {0x07d1, 0x03a1},
+ {0x07d2, 0x03a3},
+ {0x07d4, 0x03a4},
+ {0x07d5, 0x03a5},
+ {0x07d6, 0x03a6},
+ {0x07d7, 0x03a7},
+ {0x07d8, 0x03a8},
+ {0x07d9, 0x03a9},
+ {0x07e1, 0x03b1},
+ {0x07e2, 0x03b2},
+ {0x07e3, 0x03b3},
+ {0x07e4, 0x03b4},
+ {0x07e5, 0x03b5},
+ {0x07e6, 0x03b6},
+ {0x07e7, 0x03b7},
+ {0x07e8, 0x03b8},
+ {0x07e9, 0x03b9},
+ {0x07ea, 0x03ba},
+ {0x07eb, 0x03bb},
+ {0x07ec, 0x03bc},
+ {0x07ed, 0x03bd},
+ {0x07ee, 0x03be},
+ {0x07ef, 0x03bf},
+ {0x07f0, 0x03c0},
+ {0x07f1, 0x03c1},
+ {0x07f2, 0x03c3},
+ {0x07f3, 0x03c2},
+ {0x07f4, 0x03c4},
+ {0x07f5, 0x03c5},
+ {0x07f6, 0x03c6},
+ {0x07f7, 0x03c7},
+ {0x07f8, 0x03c8},
+ {0x07f9, 0x03c9},
+ {0x08a1, 0x23b7},
+ {0x08a2, 0x250c},
+ {0x08a3, 0x2500},
+ {0x08a4, 0x2320},
+ {0x08a5, 0x2321},
+ {0x08a6, 0x2502},
+ {0x08a7, 0x23a1},
+ {0x08a8, 0x23a3},
+ {0x08a9, 0x23a4},
+ {0x08aa, 0x23a6},
+ {0x08ab, 0x239b},
+ {0x08ac, 0x239d},
+ {0x08ad, 0x239e},
+ {0x08ae, 0x23a0},
+ {0x08af, 0x23a8},
+ {0x08b0, 0x23ac},
+ {0x08bc, 0x2264},
+ {0x08bd, 0x2260},
+ {0x08be, 0x2265},
+ {0x08bf, 0x222b},
+ {0x08c0, 0x2234},
+ {0x08c1, 0x221d},
+ {0x08c2, 0x221e},
+ {0x08c5, 0x2207},
+ {0x08c8, 0x223c},
+ {0x08c9, 0x2243},
+ {0x08cd, 0x21d4},
+ {0x08ce, 0x21d2},
+ {0x08cf, 0x2261},
+ {0x08d6, 0x221a},
+ {0x08da, 0x2282},
+ {0x08db, 0x2283},
+ {0x08dc, 0x2229},
+ {0x08dd, 0x222a},
+ {0x08de, 0x2227},
+ {0x08df, 0x2228},
+ {0x08ef, 0x2202},
+ {0x08f6, 0x0192},
+ {0x08fb, 0x2190},
+ {0x08fc, 0x2191},
+ {0x08fd, 0x2192},
+ {0x08fe, 0x2193},
+ {0x09e0, 0x25c6},
+ {0x09e1, 0x2592},
+ {0x09e2, 0x2409},
+ {0x09e3, 0x240c},
+ {0x09e4, 0x240d},
+ {0x09e5, 0x240a},
+ {0x09e8, 0x2424},
+ {0x09e9, 0x240b},
+ {0x09ea, 0x2518},
+ {0x09eb, 0x2510},
+ {0x09ec, 0x250c},
+ {0x09ed, 0x2514},
+ {0x09ee, 0x253c},
+ {0x09ef, 0x23ba},
+ {0x09f0, 0x23bb},
+ {0x09f1, 0x2500},
+ {0x09f2, 0x23bc},
+ {0x09f3, 0x23bd},
+ {0x09f4, 0x251c},
+ {0x09f5, 0x2524},
+ {0x09f6, 0x2534},
+ {0x09f7, 0x252c},
+ {0x09f8, 0x2502},
+ {0x0aa1, 0x2003},
+ {0x0aa2, 0x2002},
+ {0x0aa3, 0x2004},
+ {0x0aa4, 0x2005},
+ {0x0aa5, 0x2007},
+ {0x0aa6, 0x2008},
+ {0x0aa7, 0x2009},
+ {0x0aa8, 0x200a},
+ {0x0aa9, 0x2014},
+ {0x0aaa, 0x2013},
+ {0x0aae, 0x2026},
+ {0x0aaf, 0x2025},
+ {0x0ab0, 0x2153},
+ {0x0ab1, 0x2154},
+ {0x0ab2, 0x2155},
+ {0x0ab3, 0x2156},
+ {0x0ab4, 0x2157},
+ {0x0ab5, 0x2158},
+ {0x0ab6, 0x2159},
+ {0x0ab7, 0x215a},
+ {0x0ab8, 0x2105},
+ {0x0abb, 0x2012},
+ {0x0abc, 0x2329},
+ {0x0abe, 0x232a},
+ {0x0ac3, 0x215b},
+ {0x0ac4, 0x215c},
+ {0x0ac5, 0x215d},
+ {0x0ac6, 0x215e},
+ {0x0ac9, 0x2122},
+ {0x0aca, 0x2613},
+ {0x0acc, 0x25c1},
+ {0x0acd, 0x25b7},
+ {0x0ace, 0x25cb},
+ {0x0acf, 0x25af},
+ {0x0ad0, 0x2018},
+ {0x0ad1, 0x2019},
+ {0x0ad2, 0x201c},
+ {0x0ad3, 0x201d},
+ {0x0ad4, 0x211e},
+ {0x0ad6, 0x2032},
+ {0x0ad7, 0x2033},
+ {0x0ad9, 0x271d},
+ {0x0adb, 0x25ac},
+ {0x0adc, 0x25c0},
+ {0x0add, 0x25b6},
+ {0x0ade, 0x25cf},
+ {0x0adf, 0x25ae},
+ {0x0ae0, 0x25e6},
+ {0x0ae1, 0x25ab},
+ {0x0ae2, 0x25ad},
+ {0x0ae3, 0x25b3},
+ {0x0ae4, 0x25bd},
+ {0x0ae5, 0x2606},
+ {0x0ae6, 0x2022},
+ {0x0ae7, 0x25aa},
+ {0x0ae8, 0x25b2},
+ {0x0ae9, 0x25bc},
+ {0x0aea, 0x261c},
+ {0x0aeb, 0x261e},
+ {0x0aec, 0x2663},
+ {0x0aed, 0x2666},
+ {0x0aee, 0x2665},
+ {0x0af0, 0x2720},
+ {0x0af1, 0x2020},
+ {0x0af2, 0x2021},
+ {0x0af3, 0x2713},
+ {0x0af4, 0x2717},
+ {0x0af5, 0x266f},
+ {0x0af6, 0x266d},
+ {0x0af7, 0x2642},
+ {0x0af8, 0x2640},
+ {0x0af9, 0x260e},
+ {0x0afa, 0x2315},
+ {0x0afb, 0x2117},
+ {0x0afc, 0x2038},
+ {0x0afd, 0x201a},
+ {0x0afe, 0x201e},
+ {0x0ba3, 0x003c},
+ {0x0ba6, 0x003e},
+ {0x0ba8, 0x2228},
+ {0x0ba9, 0x2227},
+ {0x0bc0, 0x00af},
+ {0x0bc2, 0x22a5},
+ {0x0bc3, 0x2229},
+ {0x0bc4, 0x230a},
+ {0x0bc6, 0x005f},
+ {0x0bca, 0x2218},
+ {0x0bcc, 0x2395},
+ {0x0bce, 0x22a4},
+ {0x0bcf, 0x25cb},
+ {0x0bd3, 0x2308},
+ {0x0bd6, 0x222a},
+ {0x0bd8, 0x2283},
+ {0x0bda, 0x2282},
+ {0x0bdc, 0x22a2},
+ {0x0bfc, 0x22a3},
+ {0x0cdf, 0x2017},
+ {0x0ce0, 0x05d0},
+ {0x0ce1, 0x05d1},
+ {0x0ce2, 0x05d2},
+ {0x0ce3, 0x05d3},
+ {0x0ce4, 0x05d4},
+ {0x0ce5, 0x05d5},
+ {0x0ce6, 0x05d6},
+ {0x0ce7, 0x05d7},
+ {0x0ce8, 0x05d8},
+ {0x0ce9, 0x05d9},
+ {0x0cea, 0x05da},
+ {0x0ceb, 0x05db},
+ {0x0cec, 0x05dc},
+ {0x0ced, 0x05dd},
+ {0x0cee, 0x05de},
+ {0x0cef, 0x05df},
+ {0x0cf0, 0x05e0},
+ {0x0cf1, 0x05e1},
+ {0x0cf2, 0x05e2},
+ {0x0cf3, 0x05e3},
+ {0x0cf4, 0x05e4},
+ {0x0cf5, 0x05e5},
+ {0x0cf6, 0x05e6},
+ {0x0cf7, 0x05e7},
+ {0x0cf8, 0x05e8},
+ {0x0cf9, 0x05e9},
+ {0x0cfa, 0x05ea},
+ {0x0da1, 0x0e01},
+ {0x0da2, 0x0e02},
+ {0x0da3, 0x0e03},
+ {0x0da4, 0x0e04},
+ {0x0da5, 0x0e05},
+ {0x0da6, 0x0e06},
+ {0x0da7, 0x0e07},
+ {0x0da8, 0x0e08},
+ {0x0da9, 0x0e09},
+ {0x0daa, 0x0e0a},
+ {0x0dab, 0x0e0b},
+ {0x0dac, 0x0e0c},
+ {0x0dad, 0x0e0d},
+ {0x0dae, 0x0e0e},
+ {0x0daf, 0x0e0f},
+ {0x0db0, 0x0e10},
+ {0x0db1, 0x0e11},
+ {0x0db2, 0x0e12},
+ {0x0db3, 0x0e13},
+ {0x0db4, 0x0e14},
+ {0x0db5, 0x0e15},
+ {0x0db6, 0x0e16},
+ {0x0db7, 0x0e17},
+ {0x0db8, 0x0e18},
+ {0x0db9, 0x0e19},
+ {0x0dba, 0x0e1a},
+ {0x0dbb, 0x0e1b},
+ {0x0dbc, 0x0e1c},
+ {0x0dbd, 0x0e1d},
+ {0x0dbe, 0x0e1e},
+ {0x0dbf, 0x0e1f},
+ {0x0dc0, 0x0e20},
+ {0x0dc1, 0x0e21},
+ {0x0dc2, 0x0e22},
+ {0x0dc3, 0x0e23},
+ {0x0dc4, 0x0e24},
+ {0x0dc5, 0x0e25},
+ {0x0dc6, 0x0e26},
+ {0x0dc7, 0x0e27},
+ {0x0dc8, 0x0e28},
+ {0x0dc9, 0x0e29},
+ {0x0dca, 0x0e2a},
+ {0x0dcb, 0x0e2b},
+ {0x0dcc, 0x0e2c},
+ {0x0dcd, 0x0e2d},
+ {0x0dce, 0x0e2e},
+ {0x0dcf, 0x0e2f},
+ {0x0dd0, 0x0e30},
+ {0x0dd1, 0x0e31},
+ {0x0dd2, 0x0e32},
+ {0x0dd3, 0x0e33},
+ {0x0dd4, 0x0e34},
+ {0x0dd5, 0x0e35},
+ {0x0dd6, 0x0e36},
+ {0x0dd7, 0x0e37},
+ {0x0dd8, 0x0e38},
+ {0x0dd9, 0x0e39},
+ {0x0dda, 0x0e3a},
+ {0x0ddf, 0x0e3f},
+ {0x0de0, 0x0e40},
+ {0x0de1, 0x0e41},
+ {0x0de2, 0x0e42},
+ {0x0de3, 0x0e43},
+ {0x0de4, 0x0e44},
+ {0x0de5, 0x0e45},
+ {0x0de6, 0x0e46},
+ {0x0de7, 0x0e47},
+ {0x0de8, 0x0e48},
+ {0x0de9, 0x0e49},
+ {0x0dea, 0x0e4a},
+ {0x0deb, 0x0e4b},
+ {0x0dec, 0x0e4c},
+ {0x0ded, 0x0e4d},
+ {0x0df0, 0x0e50},
+ {0x0df1, 0x0e51},
+ {0x0df2, 0x0e52},
+ {0x0df3, 0x0e53},
+ {0x0df4, 0x0e54},
+ {0x0df5, 0x0e55},
+ {0x0df6, 0x0e56},
+ {0x0df7, 0x0e57},
+ {0x0df8, 0x0e58},
+ {0x0df9, 0x0e59},
+ {0x0ea1, 0x3131},
+ {0x0ea2, 0x3132},
+ {0x0ea3, 0x3133},
+ {0x0ea4, 0x3134},
+ {0x0ea5, 0x3135},
+ {0x0ea6, 0x3136},
+ {0x0ea7, 0x3137},
+ {0x0ea8, 0x3138},
+ {0x0ea9, 0x3139},
+ {0x0eaa, 0x313a},
+ {0x0eab, 0x313b},
+ {0x0eac, 0x313c},
+ {0x0ead, 0x313d},
+ {0x0eae, 0x313e},
+ {0x0eaf, 0x313f},
+ {0x0eb0, 0x3140},
+ {0x0eb1, 0x3141},
+ {0x0eb2, 0x3142},
+ {0x0eb3, 0x3143},
+ {0x0eb4, 0x3144},
+ {0x0eb5, 0x3145},
+ {0x0eb6, 0x3146},
+ {0x0eb7, 0x3147},
+ {0x0eb8, 0x3148},
+ {0x0eb9, 0x3149},
+ {0x0eba, 0x314a},
+ {0x0ebb, 0x314b},
+ {0x0ebc, 0x314c},
+ {0x0ebd, 0x314d},
+ {0x0ebe, 0x314e},
+ {0x0ebf, 0x314f},
+ {0x0ec0, 0x3150},
+ {0x0ec1, 0x3151},
+ {0x0ec2, 0x3152},
+ {0x0ec3, 0x3153},
+ {0x0ec4, 0x3154},
+ {0x0ec5, 0x3155},
+ {0x0ec6, 0x3156},
+ {0x0ec7, 0x3157},
+ {0x0ec8, 0x3158},
+ {0x0ec9, 0x3159},
+ {0x0eca, 0x315a},
+ {0x0ecb, 0x315b},
+ {0x0ecc, 0x315c},
+ {0x0ecd, 0x315d},
+ {0x0ece, 0x315e},
+ {0x0ecf, 0x315f},
+ {0x0ed0, 0x3160},
+ {0x0ed1, 0x3161},
+ {0x0ed2, 0x3162},
+ {0x0ed3, 0x3163},
+ {0x0ed4, 0x11a8},
+ {0x0ed5, 0x11a9},
+ {0x0ed6, 0x11aa},
+ {0x0ed7, 0x11ab},
+ {0x0ed8, 0x11ac},
+ {0x0ed9, 0x11ad},
+ {0x0eda, 0x11ae},
+ {0x0edb, 0x11af},
+ {0x0edc, 0x11b0},
+ {0x0edd, 0x11b1},
+ {0x0ede, 0x11b2},
+ {0x0edf, 0x11b3},
+ {0x0ee0, 0x11b4},
+ {0x0ee1, 0x11b5},
+ {0x0ee2, 0x11b6},
+ {0x0ee3, 0x11b7},
+ {0x0ee4, 0x11b8},
+ {0x0ee5, 0x11b9},
+ {0x0ee6, 0x11ba},
+ {0x0ee7, 0x11bb},
+ {0x0ee8, 0x11bc},
+ {0x0ee9, 0x11bd},
+ {0x0eea, 0x11be},
+ {0x0eeb, 0x11bf},
+ {0x0eec, 0x11c0},
+ {0x0eed, 0x11c1},
+ {0x0eee, 0x11c2},
+ {0x0eef, 0x316d},
+ {0x0ef0, 0x3171},
+ {0x0ef1, 0x3178},
+ {0x0ef2, 0x317f},
+ {0x0ef3, 0x3181},
+ {0x0ef4, 0x3184},
+ {0x0ef5, 0x3186},
+ {0x0ef6, 0x318d},
+ {0x0ef7, 0x318e},
+ {0x0ef8, 0x11eb},
+ {0x0ef9, 0x11f0},
+ {0x0efa, 0x11f9},
+ {0x0eff, 0x20a9},
#if 0
- /* FIXME: there is no keysym 0x13a4? But 0x20ac is EuroSign in both
- keysym and Unicode */
- { 0x13a4, 0x20ac },
+ /* FIXME: there is no keysym 0x13a4? But 0x20ac is EuroSign in both
+ keysym and Unicode */
+ {0x13a4, 0x20ac},
#endif
- { 0x13bc, 0x0152 },
- { 0x13bd, 0x0153 },
- { 0x13be, 0x0178 },
- { 0x20ac, 0x20ac },
+ {0x13bc, 0x0152},
+ {0x13bd, 0x0153},
+ {0x13be, 0x0178},
+ {0x20ac, 0x20ac},
- /* Special function keys. */
+ /* Special function keys. */
- { 0xff08, 0x0008 }, /* XK_BackSpace */
- { 0xff09, 0x0009 }, /* XK_Tab */
- { 0xff0a, 0x000a }, /* XK_Linefeed */
- { 0xff0d, 0x000d }, /* XK_Return */
- { 0xff13, 0x0013 }, /* XK_Pause */
- { 0xff1b, 0x001b }, /* XK_Escape */
- { 0xff50, 0x0001 }, /* XK_Home */
- { 0xff51, 0x001c }, /* XK_Left */
- { 0xff52, 0x001e }, /* XK_Up */
- { 0xff53, 0x001d }, /* XK_Right */
- { 0xff54, 0x001f }, /* XK_Down */
- { 0xff55, 0x000b }, /* XK_Prior */
- { 0xff56, 0x000c }, /* XK_Next */
- { 0xff57, 0x0004 }, /* XK_End */
- { 0xff6a, 0x0005 }, /* XK_Help */
- { 0xffff, 0x007f }, /* XK_Delete */
+ {0xff08, 0x0008}, /* XK_BackSpace */
+ {0xff09, 0x0009}, /* XK_Tab */
+ {0xff0a, 0x000a}, /* XK_Linefeed */
+ {0xff0d, 0x000d}, /* XK_Return */
+ {0xff13, 0x0013}, /* XK_Pause */
+ {0xff1b, 0x001b}, /* XK_Escape */
+ {0xff50, 0x0001}, /* XK_Home */
+ {0xff51, 0x001c}, /* XK_Left */
+ {0xff52, 0x001e}, /* XK_Up */
+ {0xff53, 0x001d}, /* XK_Right */
+ {0xff54, 0x001f}, /* XK_Down */
+ {0xff55, 0x000b}, /* XK_Prior */
+ {0xff56, 0x000c}, /* XK_Next */
+ {0xff57, 0x0004}, /* XK_End */
+ {0xff6a, 0x0005}, /* XK_Help */
+ {0xffff, 0x007f}, /* XK_Delete */
};
-long keysym2ucs(int keysym)
+long
+keysym2ucs(int keysym)
{
int min = 0;
int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
@@ -841,33 +842,35 @@ long keysym2ucs(int keysym)
/* also check for directly encoded 24-bit UCS characters */
if ((keysym & 0xff000000) == 0x01000000)
- return keysym & 0x00ffffff;
+ return keysym & 0x00ffffff;
/* binary search in table */
while (max >= min) {
- mid = (min + max) / 2;
- if (keysymtab[mid].keysym < keysym)
- min = mid + 1;
- else if (keysymtab[mid].keysym > keysym)
- max = mid - 1;
- else {
- /* found it */
- return keysymtab[mid].ucs;
- }
+ mid = (min + max) / 2;
+ if (keysymtab[mid].keysym < keysym)
+ min = mid + 1;
+ else if (keysymtab[mid].keysym > keysym)
+ max = mid - 1;
+ else {
+ /* found it */
+ return keysymtab[mid].ucs;
+ }
}
/* no matching Unicode value found */
return -1;
}
-static int reverse_compare (const void *a, const void *b)
+static int
+reverse_compare(const void *a, const void *b)
{
const struct codepair *ca = a, *cb = b;
return ca->ucs - cb->ucs;
}
-int ucs2keysym(long ucs)
+int
+ucs2keysym(long ucs)
{
static struct codepair *reverse_keysymtab;
@@ -875,33 +878,30 @@ int ucs2keysym(long ucs)
int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
int mid;
- if (reverse_keysymtab == NULL)
- {
- reverse_keysymtab = malloc (sizeof (keysymtab));
- memcpy (reverse_keysymtab, keysymtab, sizeof (keysymtab));
+ if (reverse_keysymtab == NULL) {
+ reverse_keysymtab = malloc(sizeof(keysymtab));
+ memcpy(reverse_keysymtab, keysymtab, sizeof(keysymtab));
- qsort (reverse_keysymtab,
- sizeof (keysymtab) / sizeof (struct codepair),
- sizeof (struct codepair),
- reverse_compare);
+ qsort(reverse_keysymtab,
+ sizeof(keysymtab) / sizeof(struct codepair),
+ sizeof(struct codepair), reverse_compare);
}
/* first check for Latin-1 characters (1:1 mapping) */
- if ((ucs >= 0x0020 && ucs <= 0x007e) ||
- (ucs >= 0x00a0 && ucs <= 0x00ff))
+ if ((ucs >= 0x0020 && ucs <= 0x007e) || (ucs >= 0x00a0 && ucs <= 0x00ff))
return ucs;
/* binary search in table */
while (max >= min) {
- mid = (min + max) / 2;
- if (reverse_keysymtab[mid].ucs < ucs)
- min = mid + 1;
- else if (reverse_keysymtab[mid].ucs > ucs)
- max = mid - 1;
- else {
- /* found it */
- return reverse_keysymtab[mid].keysym;
- }
+ mid = (min + max) / 2;
+ if (reverse_keysymtab[mid].ucs < ucs)
+ min = mid + 1;
+ else if (reverse_keysymtab[mid].ucs > ucs)
+ max = mid - 1;
+ else {
+ /* found it */
+ return reverse_keysymtab[mid].keysym;
+ }
}
/* finally, assume a directly encoded 24-bit UCS character */
diff --git a/xorg-server/hw/xquartz/mach-startup/bundle-main.c b/xorg-server/hw/xquartz/mach-startup/bundle-main.c
index 94c606823..7a53803da 100644
--- a/xorg-server/hw/xquartz/mach-startup/bundle-main.c
+++ b/xorg-server/hw/xquartz/mach-startup/bundle-main.c
@@ -69,8 +69,13 @@ void DarwinListenOnOpenFD(int fd);
extern aslclient aslc;
/* Ditto, from os/log.c */
-extern void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
-extern void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
+extern void
+ErrorF(const char *f, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+extern void
+FatalError(const char *f, ...)
+_X_ATTRIBUTE_PRINTF(1, 2)
+ _X_NORETURN;
extern int noPanoramiXExtension;
@@ -85,16 +90,19 @@ extern int noPanoramiXExtension;
#define XSERVER_VERSION "?"
#endif
-static char __crashreporter_info_buff__[4096] = {0};
-static const char *__crashreporter_info__ __attribute__((__used__)) = &__crashreporter_info_buff__[0];
+static char __crashreporter_info_buff__[4096] = { 0 };
+
+static const char *__crashreporter_info__ __attribute__ ((__used__)) =
+ &__crashreporter_info_buff__[0];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
// This is actually a toolchain requirement, but I'm not sure the correct check,
// but it should be fine to just only include it for Leopard and later. This line
// just tells the linker to never strip this symbol (such as for space optimization)
-asm (".desc ___crashreporter_info__, 0x10");
+asm(".desc ___crashreporter_info__, 0x10");
#endif
-static const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE;
+static const char *__crashreporter_info__base =
+ "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE;
char *bundle_id_prefix = NULL;
static char *server_bootstrap_name = NULL;
@@ -113,16 +121,18 @@ static char *pref_startx_script;
#ifndef HAVE_LIBDISPATCH
/*** Pthread Magics ***/
-static pthread_t create_thread(void *(*func)(void *), void *arg) {
+static pthread_t
+create_thread(void *(*func) (void *), void *arg)
+{
pthread_attr_t attr;
pthread_t tid;
-
- pthread_attr_init (&attr);
- pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
- pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
- pthread_create (&tid, &attr, func, arg);
- pthread_attr_destroy (&attr);
-
+
+ pthread_attr_init(&attr);
+ pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ pthread_create(&tid, &attr, func, arg);
+ pthread_attr_destroy(&attr);
+
return tid;
}
#endif
@@ -130,11 +140,13 @@ static pthread_t create_thread(void *(*func)(void *), void *arg) {
/*** Mach-O IPC Stuffs ***/
union MaxMsgSize {
- union __RequestUnion__mach_startup_subsystem req;
- union __ReplyUnion__mach_startup_subsystem rep;
+ union __RequestUnion__mach_startup_subsystem req;
+ union __ReplyUnion__mach_startup_subsystem rep;
};
-static mach_port_t checkin_or_register(char *bname) {
+static mach_port_t
+checkin_or_register(char *bname)
+{
kern_return_t kr;
mach_port_t mp;
@@ -150,7 +162,8 @@ static mach_port_t checkin_or_register(char *bname) {
exit(EXIT_FAILURE);
}
- kr = mach_port_insert_right(mach_task_self(), mp, mp, MACH_MSG_TYPE_MAKE_SEND);
+ kr = mach_port_insert_right(mach_task_self(), mp, mp,
+ MACH_MSG_TYPE_MAKE_SEND);
if (kr != KERN_SUCCESS) {
ErrorF("mach_port_insert_right(): %s\n", mach_error_string(kr));
exit(EXIT_FAILURE);
@@ -158,7 +171,7 @@ static mach_port_t checkin_or_register(char *bname) {
#ifdef __clang__
#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations" // bootstrap_register
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // bootstrap_register
#endif
kr = bootstrap_register(bootstrap_port, bname, mp);
#ifdef __clang__
@@ -174,23 +187,25 @@ static mach_port_t checkin_or_register(char *bname) {
}
/*** $DISPLAY handoff ***/
-static int accept_fd_handoff(int connected_fd) {
+static int
+accept_fd_handoff(int connected_fd)
+{
int launchd_fd;
-
+
char databuf[] = "display";
struct iovec iov[1];
-
+
union {
struct cmsghdr hdr;
char bytes[CMSG_SPACE(sizeof(int))];
} buf;
-
+
struct msghdr msg;
struct cmsghdr *cmsg;
iov[0].iov_base = databuf;
- iov[0].iov_len = sizeof(databuf);
-
+ iov[0].iov_len = sizeof(databuf);
+
msg.msg_iov = iov;
msg.msg_iovlen = 1;
msg.msg_control = buf.bytes;
@@ -198,23 +213,25 @@ static int accept_fd_handoff(int connected_fd) {
msg.msg_name = 0;
msg.msg_namelen = 0;
msg.msg_flags = 0;
-
- cmsg = CMSG_FIRSTHDR (&msg);
+
+ cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
-
+
msg.msg_controllen = cmsg->cmsg_len;
-
- *((int*)CMSG_DATA(cmsg)) = -1;
-
- if(recvmsg(connected_fd, &msg, 0) < 0) {
- ErrorF("X11.app: Error receiving $DISPLAY file descriptor. recvmsg() error: %s\n", strerror(errno));
+
+ *((int *) CMSG_DATA(cmsg)) = -1;
+
+ if (recvmsg(connected_fd, &msg, 0) < 0) {
+ ErrorF
+ ("X11.app: Error receiving $DISPLAY file descriptor. recvmsg() error: %s\n",
+ strerror(errno));
return -1;
}
-
- launchd_fd = *((int*)CMSG_DATA(cmsg));
-
+
+ launchd_fd = *((int *) CMSG_DATA(cmsg));
+
return launchd_fd;
}
@@ -227,10 +244,14 @@ typedef struct {
* descriptor for the new connection to accept_fd_handoff()
*/
#ifdef HAVE_LIBDISPATCH
-static void socket_handoff(socket_handoff_t *handoff_data) {
+static void
+socket_handoff(socket_handoff_t * handoff_data)
+{
#else
-static void *socket_handoff_thread(void *arg) {
- socket_handoff_t *handoff_data = (socket_handoff_t *)arg;
+static void *
+socket_handoff_thread(void *arg)
+{
+ socket_handoff_t *handoff_data = (socket_handoff_t *) arg;
#endif
int launchd_fd = -1;
@@ -239,17 +260,20 @@ static void *socket_handoff_thread(void *arg) {
/* Now actually get the passed file descriptor from this connection
* If we encounter an error, keep listening.
*/
- while(launchd_fd == -1) {
+ while (launchd_fd == -1) {
connected_fd = accept(handoff_data->fd, NULL, NULL);
- if(connected_fd == -1) {
- ErrorF("X11.app: Failed to accept incoming connection on socket (fd=%d): %s\n", handoff_data->fd, strerror(errno));
+ if (connected_fd == -1) {
+ ErrorF
+ ("X11.app: Failed to accept incoming connection on socket (fd=%d): %s\n",
+ handoff_data->fd, strerror(errno));
sleep(2);
continue;
}
launchd_fd = accept_fd_handoff(connected_fd);
- if(launchd_fd == -1)
- ErrorF("X11.app: Error receiving $DISPLAY file descriptor, no descriptor received? Waiting for another connection.\n");
+ if (launchd_fd == -1)
+ ErrorF
+ ("X11.app: Error receiving $DISPLAY file descriptor, no descriptor received? Waiting for another connection.\n");
close(connected_fd);
}
@@ -257,8 +281,10 @@ static void *socket_handoff_thread(void *arg) {
close(handoff_data->fd);
unlink(handoff_data->filename);
free(handoff_data);
-
- ErrorF("X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);
+
+ ErrorF
+ ("X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n",
+ launchd_fd);
DarwinListenOnOpenFD(launchd_fd);
#ifndef HAVE_LIBDISPATCH
@@ -266,67 +292,78 @@ static void *socket_handoff_thread(void *arg) {
#endif
}
-static int create_socket(char *filename_out) {
+static int
+create_socket(char *filename_out)
+{
struct sockaddr_un servaddr_un;
struct sockaddr *servaddr;
socklen_t servaddr_len;
int ret_fd;
size_t try, try_max;
-
- for(try=0, try_max=5; try < try_max; try++) {
+
+ for (try = 0, try_max = 5; try < try_max; try++) {
tmpnam(filename_out);
-
+
/* Setup servaddr_un */
- memset (&servaddr_un, 0, sizeof (struct sockaddr_un));
+ memset(&servaddr_un, 0, sizeof(struct sockaddr_un));
servaddr_un.sun_family = AF_UNIX;
- strlcpy(servaddr_un.sun_path, filename_out, sizeof(servaddr_un.sun_path));
-
+ strlcpy(servaddr_un.sun_path, filename_out,
+ sizeof(servaddr_un.sun_path));
+
servaddr = (struct sockaddr *) &servaddr_un;
- servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename_out);
-
+ servaddr_len =
+ sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) +
+ strlen(filename_out);
+
ret_fd = socket(PF_UNIX, SOCK_STREAM, 0);
- if(ret_fd == -1) {
- ErrorF("X11.app: Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno));
+ if (ret_fd == -1) {
+ ErrorF("X11.app: Failed to create socket (try %d / %d): %s - %s\n",
+ (int) try + 1, (int) try_max, filename_out, strerror(errno));
continue;
}
-
- if(bind(ret_fd, servaddr, servaddr_len) != 0) {
- ErrorF("X11.app: Failed to bind socket: %d - %s\n", errno, strerror(errno));
+
+ if (bind(ret_fd, servaddr, servaddr_len) != 0) {
+ ErrorF("X11.app: Failed to bind socket: %d - %s\n", errno,
+ strerror(errno));
close(ret_fd);
return 0;
}
-
- if(listen(ret_fd, 10) != 0) {
- ErrorF("X11.app: Failed to listen to socket: %s - %d - %s\n", filename_out, errno, strerror(errno));
+
+ if (listen(ret_fd, 10) != 0) {
+ ErrorF("X11.app: Failed to listen to socket: %s - %d - %s\n",
+ filename_out, errno, strerror(errno));
close(ret_fd);
return 0;
}
-
+
#ifdef DEBUG
- ErrorF("X11.app: Listening on socket for fd handoff: (%d) %s\n", ret_fd, filename_out);
+ ErrorF("X11.app: Listening on socket for fd handoff: (%d) %s\n",
+ ret_fd, filename_out);
#endif
-
+
return ret_fd;
}
-
+
return 0;
}
static int launchd_socket_handed_off = 0;
-kern_return_t do_request_fd_handoff_socket(mach_port_t port, string_t filename) {
+kern_return_t
+do_request_fd_handoff_socket(mach_port_t port, string_t filename)
+{
socket_handoff_t *handoff_data;
-
+
launchd_socket_handed_off = 1;
- handoff_data = (socket_handoff_t *)calloc(1,sizeof(socket_handoff_t));
- if(!handoff_data) {
+ handoff_data = (socket_handoff_t *) calloc(1, sizeof(socket_handoff_t));
+ if (!handoff_data) {
ErrorF("X11.app: Error allocating memory for handoff_data\n");
return KERN_FAILURE;
}
handoff_data->fd = create_socket(handoff_data->filename);
- if(!handoff_data->fd) {
+ if (!handoff_data->fd) {
free(handoff_data);
return KERN_FAILURE;
}
@@ -334,71 +371,78 @@ kern_return_t do_request_fd_handoff_socket(mach_port_t port, string_t filename)
strlcpy(filename, handoff_data->filename, STRING_T_SIZE);
#ifdef HAVE_LIBDISPATCH
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
- socket_handoff(handoff_data);
- });
+ dispatch_async(dispatch_get_global_queue
+ (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ {
+ socket_handoff(handoff_data);}
+ );
#else
create_thread(socket_handoff_thread, handoff_data);
#endif
-
+
#ifdef DEBUG
- ErrorF("X11.app: Thread created for handoff. Returning success to tell caller to connect and push the fd.\n");
+ ErrorF
+ ("X11.app: Thread created for handoff. Returning success to tell caller to connect and push the fd.\n");
#endif
return KERN_SUCCESS;
}
-kern_return_t do_request_pid(mach_port_t port, int *my_pid) {
+kern_return_t
+do_request_pid(mach_port_t port, int *my_pid)
+{
*my_pid = getpid();
return KERN_SUCCESS;
}
/*** Server Startup ***/
-kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
- mach_msg_type_number_t argvCnt,
- string_array_t envp,
- mach_msg_type_number_t envpCnt) {
+kern_return_t
+do_start_x11_server(mach_port_t port, string_array_t argv,
+ mach_msg_type_number_t argvCnt,
+ string_array_t envp, mach_msg_type_number_t envpCnt)
+{
/* And now back to char ** */
char **_argv = alloca((argvCnt + 1) * sizeof(char *));
char **_envp = alloca((envpCnt + 1) * sizeof(char *));
size_t i;
-
+
/* If we didn't get handed a launchd DISPLAY socket, we should
* unset DISPLAY or we can run into problems with pbproxy
*/
- if(!launchd_socket_handed_off) {
+ if (!launchd_socket_handed_off) {
ErrorF("X11.app: No launchd socket handed off, unsetting DISPLAY\n");
unsetenv("DISPLAY");
}
-
- if(!_argv || !_envp) {
+
+ if (!_argv || !_envp) {
return KERN_FAILURE;
}
ErrorF("X11.app: do_start_x11_server(): argc=%d\n", argvCnt);
- for(i=0; i < argvCnt; i++) {
+ for (i = 0; i < argvCnt; i++) {
_argv[i] = argv[i];
- ErrorF("\targv[%u] = %s\n", (unsigned)i, argv[i]);
+ ErrorF("\targv[%u] = %s\n", (unsigned) i, argv[i]);
}
_argv[argvCnt] = NULL;
-
- for(i=0; i < envpCnt; i++) {
+
+ for (i = 0; i < envpCnt; i++) {
_envp[i] = envp[i];
}
_envp[envpCnt] = NULL;
-
- if(server_main(argvCnt, _argv, _envp) == 0)
+
+ if (server_main(argvCnt, _argv, _envp) == 0)
return KERN_SUCCESS;
else
return KERN_FAILURE;
}
-static int startup_trigger(int argc, char **argv, char **envp) {
+static int
+startup_trigger(int argc, char **argv, char **envp)
+{
Display *display;
const char *s;
-
+
/* Take care of the case where we're called like a normal DDX */
- if(argc > 1 && argv[1][0] == ':') {
+ if (argc > 1 && argv[1][0] == ':') {
size_t i;
kern_return_t kr;
mach_port_t mp;
@@ -407,32 +451,35 @@ static int startup_trigger(int argc, char **argv, char **envp) {
/* We need to count envp */
int envpc;
- for(envpc=0; envp[envpc]; envpc++);
+
+ for (envpc = 0; envp[envpc]; envpc++);
/* We have fixed-size string lengths due to limitations in IPC,
* so we need to copy our argv and envp.
*/
- newargv = (string_array_t)alloca(argc * sizeof(string_t));
- newenvp = (string_array_t)alloca(envpc * sizeof(string_t));
-
- if(!newargv || !newenvp) {
+ newargv = (string_array_t) alloca(argc * sizeof(string_t));
+ newenvp = (string_array_t) alloca(envpc * sizeof(string_t));
+
+ if (!newargv || !newenvp) {
ErrorF("Memory allocation failure\n");
exit(EXIT_FAILURE);
}
-
- for(i=0; i < argc; i++) {
+
+ for (i = 0; i < argc; i++) {
strlcpy(newargv[i], argv[i], STRING_T_SIZE);
}
- for(i=0; i < envpc; i++) {
+ for (i = 0; i < envpc; i++) {
strlcpy(newenvp[i], envp[i], STRING_T_SIZE);
}
kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
if (kr != KERN_SUCCESS) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- ErrorF("bootstrap_look_up(%s): %s\n", server_bootstrap_name, bootstrap_strerror(kr));
+ ErrorF("bootstrap_look_up(%s): %s\n", server_bootstrap_name,
+ bootstrap_strerror(kr));
#else
- ErrorF("bootstrap_look_up(%s): %ul\n", server_bootstrap_name, (unsigned long)kr);
+ ErrorF("bootstrap_look_up(%s): %ul\n", server_bootstrap_name,
+ (unsigned long) kr);
#endif
exit(EXIT_FAILURE);
}
@@ -448,10 +495,10 @@ static int startup_trigger(int argc, char **argv, char **envp) {
/* If we have a process serial number and it's our only arg, act as if
* the user double clicked the app bundle: launch app_to_run if possible
*/
- if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) {
+ if (argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) {
/* Now, try to open a display, if so, run the launcher */
display = XOpenDisplay(NULL);
- if(display) {
+ if (display) {
/* Could open the display, start the launcher */
XCloseDisplay(display);
@@ -460,31 +507,41 @@ static int startup_trigger(int argc, char **argv, char **envp) {
}
/* Start the server */
- if((s = getenv("DISPLAY"))) {
- ErrorF("X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s);
+ if ((s = getenv("DISPLAY"))) {
+ ErrorF
+ ("X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n",
+ s);
unsetenv("DISPLAY");
- } else {
- ErrorF("X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n");
+ }
+ else {
+ ErrorF
+ ("X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n");
}
return execute(pref_startx_script);
}
/** Setup the environment we want our child processes to inherit */
-static void ensure_path(const char *dir) {
+static void
+ensure_path(const char *dir)
+{
char buf[1024], *temp;
-
+
/* Make sure /usr/X11/bin is in the $PATH */
temp = getenv("PATH");
- if(temp == NULL || temp[0] == 0) {
- snprintf(buf, sizeof(buf), "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:%s", dir);
+ if (temp == NULL || temp[0] == 0) {
+ snprintf(buf, sizeof(buf),
+ "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:%s", dir);
setenv("PATH", buf, TRUE);
- } else if(strnstr(temp, X11BINDIR, sizeof(temp)) == NULL) {
+ }
+ else if (strnstr(temp, X11BINDIR, sizeof(temp)) == NULL) {
snprintf(buf, sizeof(buf), "%s:%s", temp, dir);
setenv("PATH", buf, TRUE);
}
}
-static void setup_console_redirect(const char *bundle_id) {
+static void
+setup_console_redirect(const char *bundle_id)
+{
char *asl_sender;
char *asl_facility;
@@ -493,7 +550,7 @@ static void setup_console_redirect(const char *bundle_id) {
asl_facility = strdup(bundle_id);
assert(asl_facility);
- if(strcmp(asl_facility + strlen(asl_facility) - 4, ".X11") == 0)
+ if (strcmp(asl_facility + strlen(asl_facility) - 4, ".X11") == 0)
asl_facility[strlen(asl_facility) - 4] = '\0';
assert(aslc = asl_open(asl_sender, asl_facility, ASL_OPT_NO_DELAY));
@@ -505,7 +562,9 @@ static void setup_console_redirect(const char *bundle_id) {
xq_asl_capture_fd(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO);
}
-static void setup_env(void) {
+static void
+setup_env(void)
+{
char *temp;
const char *pds = NULL;
const char *disp = getenv("DISPLAY");
@@ -515,81 +574,93 @@ static void setup_env(void) {
* quartz-wm and the Xquartz stub's MachIPC)
*/
CFBundleRef bundle = CFBundleGetMainBundle();
- if(bundle) {
+
+ if (bundle) {
CFStringRef pd = CFBundleGetIdentifier(bundle);
- if(pd) {
+
+ if (pd) {
pds = CFStringGetCStringPtr(pd, 0);
}
}
/* fallback to hardcoded value if we can't discover it */
- if(!pds) {
- pds = BUNDLE_ID_PREFIX".X11";
+ if (!pds) {
+ pds = BUNDLE_ID_PREFIX ".X11";
}
setup_console_redirect(pds);
server_bootstrap_name = strdup(pds);
- if(!server_bootstrap_name) {
+ if (!server_bootstrap_name) {
ErrorF("X11.app: Memory allocation error.\n");
exit(1);
}
setenv("X11_PREFS_DOMAIN", server_bootstrap_name, 1);
-
+
len = strlen(server_bootstrap_name);
bundle_id_prefix = malloc(sizeof(char) * (len - 3));
- if(!bundle_id_prefix) {
+ if (!bundle_id_prefix) {
ErrorF("X11.app: Memory allocation error.\n");
exit(1);
}
strlcpy(bundle_id_prefix, server_bootstrap_name, len - 3);
-
+
/* We need to unset DISPLAY if it is not our socket */
- if(disp) {
+ if (disp) {
/* s = basename(disp) */
const char *d, *s;
- for(s = NULL, d = disp; *d; d++) {
- if(*d == '/')
+
+ for (s = NULL, d = disp; *d; d++) {
+ if (*d == '/')
s = d + 1;
}
- if(s && *s) {
- if(strcmp(bundle_id_prefix, "org.x") == 0 && strcmp(s, ":0") == 0) {
- ErrorF("X11.app: Detected old style launchd DISPLAY, please update xinit.\n");
- } else {
- temp = (char *)malloc(sizeof(char) * len);
- if(!temp) {
- ErrorF("X11.app: Memory allocation error creating space for socket name test.\n");
+ if (s && *s) {
+ if (strcmp(bundle_id_prefix, "org.x") == 0 && strcmp(s, ":0") == 0) {
+ ErrorF
+ ("X11.app: Detected old style launchd DISPLAY, please update xinit.\n");
+ }
+ else {
+ temp = (char *) malloc(sizeof(char) * len);
+ if (!temp) {
+ ErrorF
+ ("X11.app: Memory allocation error creating space for socket name test.\n");
exit(1);
}
strlcpy(temp, bundle_id_prefix, len);
strlcat(temp, ":0", len);
-
- if(strcmp(temp, s) != 0) {
+
+ if (strcmp(temp, s) != 0) {
/* If we don't have a match, unset it. */
- ErrorF("X11.app: DISPLAY (\"%s\") does not match our id (\"%s\"), unsetting.\n", disp, bundle_id_prefix);
+ ErrorF
+ ("X11.app: DISPLAY (\"%s\") does not match our id (\"%s\"), unsetting.\n",
+ disp, bundle_id_prefix);
unsetenv("DISPLAY");
}
free(temp);
}
- } else {
+ }
+ else {
/* The DISPLAY environment variable is not formatted like a launchd socket, so reset. */
- ErrorF("X11.app: DISPLAY does not look like a launchd set variable, unsetting.\n");
+ ErrorF
+ ("X11.app: DISPLAY does not look like a launchd set variable, unsetting.\n");
unsetenv("DISPLAY");
}
}
/* Make sure PATH is right */
ensure_path(X11BINDIR);
-
+
/* cd $HOME */
temp = getenv("HOME");
- if(temp != NULL && temp[0] != '\0')
+ if (temp != NULL && temp[0] != '\0')
chdir(temp);
}
/*** Main ***/
-int main(int argc, char **argv, char **envp) {
+int
+main(int argc, char **argv, char **envp)
+{
Bool listenOnly = FALSE;
int i;
mach_msg_size_t mxmsgsz = sizeof(union MaxMsgSize) + MAX_TRAILER_SIZE;
@@ -598,31 +669,32 @@ int main(int argc, char **argv, char **envp) {
/* Setup our environment for our children */
setup_env();
-
+
/* The server must not run the PanoramiX operations. */
noPanoramiXExtension = TRUE;
/* Setup the initial crasherporter info */
- strlcpy(__crashreporter_info_buff__, __crashreporter_info__base, sizeof(__crashreporter_info_buff__));
-
+ strlcpy(__crashreporter_info_buff__, __crashreporter_info__base,
+ sizeof(__crashreporter_info_buff__));
+
ErrorF("X11.app: main(): argc=%d\n", argc);
- for(i=0; i < argc; i++) {
- ErrorF("\targv[%u] = %s\n", (unsigned)i, argv[i]);
- if(!strcmp(argv[i], "--listenonly")) {
+ for (i = 0; i < argc; i++) {
+ ErrorF("\targv[%u] = %s\n", (unsigned) i, argv[i]);
+ if (!strcmp(argv[i], "--listenonly")) {
listenOnly = TRUE;
}
}
mp = checkin_or_register(server_bootstrap_name);
- if(mp == MACH_PORT_NULL) {
+ if (mp == MACH_PORT_NULL) {
ErrorF("NULL mach service: %s", server_bootstrap_name);
return EXIT_FAILURE;
}
-
+
/* Check if we need to do something other than listen, and make another
* thread handle it.
*/
- if(!listenOnly) {
+ if (!listenOnly) {
pid_t child1, child2;
int status;
@@ -632,50 +704,51 @@ int main(int argc, char **argv, char **envp) {
pref_login_shell = command_from_prefs("login_shell", DEFAULT_SHELL);
assert(pref_login_shell);
- pref_startx_script = command_from_prefs("startx_script", DEFAULT_STARTX);
+ pref_startx_script =
+ command_from_prefs("startx_script", DEFAULT_STARTX);
assert(pref_startx_script);
/* Do the fork-twice trick to avoid having to reap zombies */
child1 = fork();
switch (child1) {
- case -1: /* error */
- FatalError("fork() failed: %s\n", strerror(errno));
+ case -1: /* error */
+ FatalError("fork() failed: %s\n", strerror(errno));
- case 0: /* child1 */
- child2 = fork();
+ case 0: /* child1 */
+ child2 = fork();
- switch (child2) {
- int max_files;
+ switch (child2) {
+ int max_files;
- case -1: /* error */
- FatalError("fork() failed: %s\n", strerror(errno));
+ case -1: /* error */
+ FatalError("fork() failed: %s\n", strerror(errno));
- case 0: /* child2 */
- /* close all open files except for standard streams */
- max_files = sysconf(_SC_OPEN_MAX);
- for(i = 3; i < max_files; i++)
- close(i);
+ case 0: /* child2 */
+ /* close all open files except for standard streams */
+ max_files = sysconf(_SC_OPEN_MAX);
+ for (i = 3; i < max_files; i++)
+ close(i);
- /* ensure stdin is on /dev/null */
- close(0);
- open("/dev/null", O_RDONLY);
+ /* ensure stdin is on /dev/null */
+ close(0);
+ open("/dev/null", O_RDONLY);
- return startup_trigger(argc, argv, envp);
+ return startup_trigger(argc, argv, envp);
- default: /* parent (child1) */
- _exit(0);
- }
- break;
+ default: /* parent (child1) */
+ _exit(0);
+ }
+ break;
- default: /* parent */
- waitpid(child1, &status, 0);
+ default: /* parent */
+ waitpid(child1, &status, 0);
}
free(pref_app_to_run);
free(pref_login_shell);
free(pref_startx_script);
}
-
+
/* Main event loop */
ErrorF("Waiting for startup parameters via Mach IPC.\n");
kr = mach_msg_server(mach_startup_server, mxmsgsz, mp, 0);
@@ -683,72 +756,83 @@ int main(int argc, char **argv, char **envp) {
ErrorF("%s.X11(mp): %s\n", BUNDLE_ID_PREFIX, mach_error_string(kr));
return EXIT_FAILURE;
}
-
+
return EXIT_SUCCESS;
}
-static int execute(const char *command) {
+static int
+execute(const char *command)
+{
const char *newargv[4];
const char **p;
-
+
newargv[0] = pref_login_shell;
newargv[1] = "-c";
newargv[2] = command;
newargv[3] = NULL;
-
+
ErrorF("X11.app: Launching %s:\n", command);
- for(p=newargv; *p; p++) {
- ErrorF("\targv[%ld] = %s\n", (long int)(p - newargv), *p);
+ for (p = newargv; *p; p++) {
+ ErrorF("\targv[%ld] = %s\n", (long int) (p - newargv), *p);
}
- execvp (newargv[0], (char * const *) newargv);
- perror ("X11.app: Couldn't exec.");
+ execvp(newargv[0], (char *const *) newargv);
+ perror("X11.app: Couldn't exec.");
return 1;
}
-static char *command_from_prefs(const char *key, const char *default_value) {
+static char *
+command_from_prefs(const char *key, const char *default_value)
+{
char *command = NULL;
-
+
CFStringRef cfKey;
CFPropertyListRef PlistRef;
- if(!key)
+ if (!key)
return NULL;
cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII);
- if(!cfKey)
+ if (!cfKey)
return NULL;
- PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication);
-
+ PlistRef =
+ CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication);
+
if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
- CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII);
+ CFStringRef cfDefaultValue =
+ CFStringCreateWithCString(NULL, default_value,
+ kCFStringEncodingASCII);
int len = strlen(default_value) + 1;
- if(!cfDefaultValue)
+ if (!cfDefaultValue)
goto command_from_prefs_out;
- CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication);
+ CFPreferencesSetAppValue(cfKey, cfDefaultValue,
+ kCFPreferencesCurrentApplication);
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
CFRelease(cfDefaultValue);
-
- command = (char *)malloc(len * sizeof(char));
- if(!command)
+
+ command = (char *) malloc(len * sizeof(char));
+ if (!command)
goto command_from_prefs_out;
strcpy(command, default_value);
- } else {
- int len = CFStringGetLength((CFStringRef)PlistRef) + 1;
- command = (char *)malloc(len * sizeof(char));
- if(!command)
+ }
+ else {
+ int len = CFStringGetLength((CFStringRef) PlistRef) + 1;
+
+ command = (char *) malloc(len * sizeof(char));
+ if (!command)
goto command_from_prefs_out;
- CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII);
+ CFStringGetCString((CFStringRef) PlistRef, command, len,
+ kCFStringEncodingASCII);
}
-command_from_prefs_out:
+ command_from_prefs_out:
if (PlistRef)
CFRelease(PlistRef);
- if(cfKey)
+ if (cfKey)
CFRelease(cfKey);
return command;
}
diff --git a/xorg-server/hw/xquartz/mach-startup/launchd_fd.c b/xorg-server/hw/xquartz/mach-startup/launchd_fd.c
index 8003dd177..fd1d276e3 100644
--- a/xorg-server/hw/xquartz/mach-startup/launchd_fd.c
+++ b/xorg-server/hw/xquartz/mach-startup/launchd_fd.c
@@ -38,54 +38,68 @@
extern aslclient aslc;
-int launchd_display_fd(void) {
+int
+launchd_display_fd(void)
+{
launch_data_t sockets_dict, checkin_request, checkin_response;
launch_data_t listening_fd_array, listening_fd;
/* Get launchd fd */
if ((checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN)) == NULL) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.\n");
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "launch_data_new_string(\"" LAUNCH_KEY_CHECKIN
+ "\") Unable to create string.\n");
return ERROR_FD;
}
-
+
if ((checkin_response = launch_msg(checkin_request)) == NULL) {
- asl_log(aslc, NULL, ASL_LEVEL_WARNING, "launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %s\n",strerror(errno));
+ asl_log(aslc, NULL, ASL_LEVEL_WARNING,
+ "launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %s\n",
+ strerror(errno));
return ERROR_FD;
}
-
+
if (LAUNCH_DATA_ERRNO == launch_data_get_type(checkin_response)) {
// ignore EACCES, which is common if we weren't started by launchd
if (launch_data_get_errno(checkin_response) != EACCES)
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in failed: %s\n", strerror(launch_data_get_errno(checkin_response)));
+ asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in failed: %s\n",
+ strerror(launch_data_get_errno(checkin_response)));
return ERROR_FD;
- }
-
- sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS);
+ }
+
+ sockets_dict =
+ launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS);
if (NULL == sockets_dict) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in: no sockets found to answer requests on!\n");
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "launchd check-in: no sockets found to answer requests on!\n");
return ERROR_FD;
}
-
+
if (launch_data_dict_get_count(sockets_dict) > 1) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in: some sockets will be ignored!\n");
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "launchd check-in: some sockets will be ignored!\n");
return ERROR_FD;
}
-
- listening_fd_array = launch_data_dict_lookup(sockets_dict, BUNDLE_ID_PREFIX":0");
+
+ listening_fd_array =
+ launch_data_dict_lookup(sockets_dict, BUNDLE_ID_PREFIX ":0");
if (NULL == listening_fd_array) {
listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0");
if (NULL == listening_fd_array) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in: No known sockets found to answer requests on! \"%s:0\" and \":0\" failed.\n", BUNDLE_ID_PREFIX);
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "launchd check-in: No known sockets found to answer requests on! \"%s:0\" and \":0\" failed.\n",
+ BUNDLE_ID_PREFIX);
return ERROR_FD;
}
}
-
- if (launch_data_array_get_count(listening_fd_array)!=1) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in: Expected 1 socket from launchd, got %u)\n",
- (unsigned)launch_data_array_get_count(listening_fd_array));
+
+ if (launch_data_array_get_count(listening_fd_array) != 1) {
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "launchd check-in: Expected 1 socket from launchd, got %u)\n",
+ (unsigned) launch_data_array_get_count(listening_fd_array));
return ERROR_FD;
}
-
- listening_fd=launch_data_array_get_index(listening_fd_array, 0);
+
+ listening_fd = launch_data_array_get_index(listening_fd_array, 0);
return launch_data_get_fd(listening_fd);
}
diff --git a/xorg-server/hw/xquartz/mach-startup/stub.c b/xorg-server/hw/xquartz/mach-startup/stub.c
index d8e4abdd1..f457aaba0 100644
--- a/xorg-server/hw/xquartz/mach-startup/stub.c
+++ b/xorg-server/hw/xquartz/mach-startup/stub.c
@@ -58,85 +58,105 @@ static char x11_path[PATH_MAX + 1];
static pid_t x11app_pid = 0;
aslclient aslc;
-static void set_x11_path(void) {
+static void
+set_x11_path(void)
+{
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
CFURLRef appURL = NULL;
- OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL);
+ OSStatus osstatus =
+ LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil,
+ nil, &appURL);
switch (osstatus) {
- case noErr:
- if (appURL == NULL) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Invalid response from LSFindApplicationForInfo(%s)",
- kX11AppBundleId);
- exit(1);
- }
+ case noErr:
+ if (appURL == NULL) {
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Invalid response from LSFindApplicationForInfo(%s)",
+ kX11AppBundleId);
+ exit(1);
+ }
- if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Error resolving URL for %s", kX11AppBundleId);
- exit(3);
- }
+ if (!CFURLGetFileSystemRepresentation
+ (appURL, true, (unsigned char *) x11_path, sizeof(x11_path))) {
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Error resolving URL for %s", kX11AppBundleId);
+ exit(3);
+ }
- strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
- asl_log(aslc, NULL, ASL_LEVEL_INFO, "Xquartz: X11.app = %s", x11_path);
- break;
- case kLSApplicationNotFoundErr:
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Unable to find application for %s", kX11AppBundleId);
- exit(10);
- default:
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Unable to find application for %s, error code = %d",
- kX11AppBundleId, (int)osstatus);
- exit(11);
+ strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
+ asl_log(aslc, NULL, ASL_LEVEL_INFO, "Xquartz: X11.app = %s", x11_path);
+ break;
+ case kLSApplicationNotFoundErr:
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Unable to find application for %s", kX11AppBundleId);
+ exit(10);
+ default:
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Unable to find application for %s, error code = %d",
+ kX11AppBundleId, (int) osstatus);
+ exit(11);
}
#else
/* TODO: Make Tiger smarter... but TBH, this should never get called on Tiger... */
- strlcpy(x11_path, "/Applications/Utilities/X11.app/Contents/MacOS/X11", sizeof(x11_path));
+ strlcpy(x11_path, "/Applications/Utilities/X11.app/Contents/MacOS/X11",
+ sizeof(x11_path));
#endif
}
-static int connect_to_socket(const char *filename) {
+static int
+connect_to_socket(const char *filename)
+{
struct sockaddr_un servaddr_un;
struct sockaddr *servaddr;
socklen_t servaddr_len;
int ret_fd;
/* Setup servaddr_un */
- memset (&servaddr_un, 0, sizeof (struct sockaddr_un));
+ memset(&servaddr_un, 0, sizeof(struct sockaddr_un));
servaddr_un.sun_family = AF_UNIX;
strlcpy(servaddr_un.sun_path, filename, sizeof(servaddr_un.sun_path));
-
+
servaddr = (struct sockaddr *) &servaddr_un;
- servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename);
-
+ servaddr_len =
+ sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) +
+ strlen(filename);
+
ret_fd = socket(PF_UNIX, SOCK_STREAM, 0);
- if(ret_fd == -1) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Failed to create socket: %s - %s", filename, strerror(errno));
+ if (ret_fd == -1) {
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Failed to create socket: %s - %s", filename,
+ strerror(errno));
return -1;
}
- if(connect(ret_fd, servaddr, servaddr_len) < 0) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Failed to connect to socket: %s - %d - %s", filename, errno, strerror(errno));
+ if (connect(ret_fd, servaddr, servaddr_len) < 0) {
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Failed to connect to socket: %s - %d - %s", filename,
+ errno, strerror(errno));
close(ret_fd);
return -1;
}
-
+
return ret_fd;
}
-static void send_fd_handoff(int connected_fd, int launchd_fd) {
+static void
+send_fd_handoff(int connected_fd, int launchd_fd)
+{
char databuf[] = "display";
struct iovec iov[1];
-
+
union {
struct cmsghdr hdr;
char bytes[CMSG_SPACE(sizeof(int))];
} buf;
-
+
struct msghdr msg;
struct cmsghdr *cmsg;
iov[0].iov_base = databuf;
- iov[0].iov_len = sizeof(databuf);
+ iov[0].iov_len = sizeof(databuf);
msg.msg_iov = iov;
msg.msg_iovlen = 1;
@@ -146,32 +166,39 @@ static void send_fd_handoff(int connected_fd, int launchd_fd) {
msg.msg_namelen = 0;
msg.msg_flags = 0;
- cmsg = CMSG_FIRSTHDR (&msg);
+ cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
msg.msg_controllen = cmsg->cmsg_len;
-
- *((int*)CMSG_DATA(cmsg)) = launchd_fd;
-
- if(sendmsg(connected_fd, &msg, 0) < 0) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Error sending $DISPLAY file descriptor over fd %d: %d -- %s", connected_fd, errno, strerror(errno));
+
+ *((int *) CMSG_DATA(cmsg)) = launchd_fd;
+
+ if (sendmsg(connected_fd, &msg, 0) < 0) {
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Error sending $DISPLAY file descriptor over fd %d: %d -- %s",
+ connected_fd, errno, strerror(errno));
return;
}
- asl_log(aslc, NULL, ASL_LEVEL_DEBUG, "Xquartz: Message sent. Closing handoff fd.");
+ asl_log(aslc, NULL, ASL_LEVEL_DEBUG,
+ "Xquartz: Message sent. Closing handoff fd.");
close(connected_fd);
}
-__attribute__((__noreturn__))
-static void signal_handler(int sig) {
- if(x11app_pid)
+__attribute__ ((__noreturn__))
+static void
+signal_handler(int sig)
+{
+ if (x11app_pid)
kill(x11app_pid, sig);
_exit(0);
}
-int main(int argc, char **argv, char **envp) {
+int
+main(int argc, char **argv, char **envp)
+{
int envpc;
kern_return_t kr;
mach_port_t mp;
@@ -185,7 +212,7 @@ int main(int argc, char **argv, char **envp) {
char *asl_facility;
char *server_bootstrap_name = kX11AppBundleId;
- if(getenv("X11_PREFS_DOMAIN"))
+ if (getenv("X11_PREFS_DOMAIN"))
server_bootstrap_name = getenv("X11_PREFS_DOMAIN");
asprintf(&asl_sender, "%s.stub", server_bootstrap_name);
@@ -193,8 +220,8 @@ int main(int argc, char **argv, char **envp) {
asl_facility = strdup(server_bootstrap_name);
assert(asl_facility);
- if(strcmp(asl_facility + strlen(asl_facility) - 4, ".X11") == 0)
- asl_facility[strlen(asl_facility) - 4] = '\0';
+ if (strcmp(asl_facility + strlen(asl_facility) - 4, ".X11") == 0)
+ asl_facility[strlen(asl_facility) - 4] = '\0';
assert(aslc = asl_open(asl_sender, asl_facility, ASL_OPT_NO_DELAY));
free(asl_sender);
@@ -205,103 +232,119 @@ int main(int argc, char **argv, char **envp) {
* time out waiting for it and will just poll for the server.
*/
handler = signal(SIGUSR1, SIG_IGN);
- if(handler == SIG_IGN)
+ if (handler == SIG_IGN)
kill(getppid(), SIGUSR1);
signal(SIGUSR1, handler);
/* Pass on SIGs to X11.app */
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
-
+
/* Get the $DISPLAY FD */
launchd_fd = launchd_display_fd();
kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
- if(kr != KERN_SUCCESS) {
+ if (kr != KERN_SUCCESS) {
pid_t child;
- asl_log(aslc, NULL, ASL_LEVEL_WARNING, "Xquartz: Unable to locate waiting server: %s", server_bootstrap_name);
+ asl_log(aslc, NULL, ASL_LEVEL_WARNING,
+ "Xquartz: Unable to locate waiting server: %s",
+ server_bootstrap_name);
set_x11_path();
/* This forking is ugly and will be cleaned up later */
child = fork();
- if(child == -1) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Could not fork: %s", strerror(errno));
+ if (child == -1) {
+ asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Could not fork: %s",
+ strerror(errno));
return EXIT_FAILURE;
}
- if(child == 0) {
+ if (child == 0) {
char *_argv[3];
+
_argv[0] = x11_path;
_argv[1] = "--listenonly";
_argv[2] = NULL;
- asl_log(aslc, NULL, ASL_LEVEL_NOTICE, "Xquartz: Starting X server: %s --listenonly", x11_path);
+ asl_log(aslc, NULL, ASL_LEVEL_NOTICE,
+ "Xquartz: Starting X server: %s --listenonly", x11_path);
return execvp(x11_path, _argv);
}
/* Try connecting for 10 seconds */
- for(i=0; i < 80; i++) {
+ for (i = 0; i < 80; i++) {
usleep(250000);
kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
- if(kr == KERN_SUCCESS)
+ if (kr == KERN_SUCCESS)
break;
}
- if(kr != KERN_SUCCESS) {
+ if (kr != KERN_SUCCESS) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: bootstrap_look_up(): %s", bootstrap_strerror(kr));
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: bootstrap_look_up(): %s", bootstrap_strerror(kr));
#else
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: bootstrap_look_up(): %ul", (unsigned long)kr);
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: bootstrap_look_up(): %ul", (unsigned long) kr);
#endif
return EXIT_FAILURE;
}
}
-
+
/* Get X11.app's pid */
request_pid(mp, &x11app_pid);
/* Handoff the $DISPLAY FD */
- if(launchd_fd != -1) {
+ if (launchd_fd != -1) {
size_t try, try_max;
int handoff_fd = -1;
- for(try=0, try_max=5; try < try_max; try++) {
- if(request_fd_handoff_socket(mp, handoff_socket_filename) != KERN_SUCCESS) {
- asl_log(aslc, NULL, ASL_LEVEL_INFO, "Xquartz: Failed to request a socket from the server to send the $DISPLAY fd over (try %d of %d)", (int)try+1, (int)try_max);
+ for (try = 0, try_max = 5; try < try_max; try++) {
+ if (request_fd_handoff_socket(mp, handoff_socket_filename) !=
+ KERN_SUCCESS) {
+ asl_log(aslc, NULL, ASL_LEVEL_INFO,
+ "Xquartz: Failed to request a socket from the server to send the $DISPLAY fd over (try %d of %d)",
+ (int) try + 1, (int) try_max);
continue;
}
handoff_fd = connect_to_socket(handoff_socket_filename);
- if(handoff_fd == -1) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Failed to connect to socket (try %d of %d)", (int)try+1, (int)try_max);
+ if (handoff_fd == -1) {
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Failed to connect to socket (try %d of %d)",
+ (int) try + 1, (int) try_max);
continue;
}
- asl_log(aslc, NULL, ASL_LEVEL_INFO, "Xquartz: Handoff connection established (try %d of %d) on fd %d, \"%s\". Sending message.", (int)try+1, (int)try_max, handoff_fd, handoff_socket_filename);
- send_fd_handoff(handoff_fd, launchd_fd);
+ asl_log(aslc, NULL, ASL_LEVEL_INFO,
+ "Xquartz: Handoff connection established (try %d of %d) on fd %d, \"%s\". Sending message.",
+ (int) try + 1, (int) try_max, handoff_fd,
+ handoff_socket_filename);
+ send_fd_handoff(handoff_fd, launchd_fd);
close(handoff_fd);
break;
}
}
/* Count envp */
- for(envpc=0; envp[envpc]; envpc++);
-
+ for (envpc = 0; envp[envpc]; envpc++);
+
/* We have fixed-size string lengths due to limitations in IPC,
* so we need to copy our argv and envp.
*/
- newargv = (string_array_t)calloc((1 + argc), sizeof(string_t));
- newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t));
+ newargv = (string_array_t) calloc((1 + argc), sizeof(string_t));
+ newenvp = (string_array_t) calloc((1 + envpc), sizeof(string_t));
- if(!newargv || !newenvp) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Memory allocation failure");
+ if (!newargv || !newenvp) {
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Memory allocation failure");
return EXIT_FAILURE;
}
-
- for(i=0; i < argc; i++) {
+
+ for (i = 0; i < argc; i++) {
strlcpy(newargv[i], argv[i], STRING_T_SIZE);
}
- for(i=0; i < envpc; i++) {
+ for (i = 0; i < envpc; i++) {
strlcpy(newenvp[i], envp[i], STRING_T_SIZE);
}
@@ -311,7 +354,8 @@ int main(int argc, char **argv, char **envp) {
free(newenvp);
if (kr != KERN_SUCCESS) {
- asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: start_x11_server: %s", mach_error_string(kr));
+ asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: start_x11_server: %s",
+ mach_error_string(kr));
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
diff --git a/xorg-server/hw/xquartz/pbproxy/app-main.m b/xorg-server/hw/xquartz/pbproxy/app-main.m
index 772c458a1..c061418d8 100644
--- a/xorg-server/hw/xquartz/pbproxy/app-main.m
+++ b/xorg-server/hw/xquartz/pbproxy/app-main.m
@@ -31,10 +31,10 @@
#import "x-selection.h"
#include <pthread.h>
-#include <unistd.h> /*for getpid*/
+#include <unistd.h> /*for getpid */
#include <Cocoa/Cocoa.h>
-static const char *app_prefs_domain = BUNDLE_ID_PREFIX".xpbproxy";
+static const char *app_prefs_domain = BUNDLE_ID_PREFIX ".xpbproxy";
CFStringRef app_prefs_domain_cfstr;
/* Stubs */
@@ -43,18 +43,20 @@ BOOL serverRunning = YES;
pthread_mutex_t serverRunningMutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t serverRunningCond = PTHREAD_COND_INITIALIZER;
-static void signal_handler (int sig) {
- switch(sig) {
- case SIGHUP:
- xpbproxy_prefs_reload = YES;
- break;
- default:
- _exit(EXIT_SUCCESS);
+static void
+signal_handler(int sig)
+{
+ switch (sig) {
+ case SIGHUP:
+ xpbproxy_prefs_reload = YES;
+ break;
+ default:
+ _exit(EXIT_SUCCESS);
}
}
void
-ErrorF(const char * f, ...)
+ErrorF(const char *f, ...)
{
va_list args;
@@ -64,7 +66,10 @@ ErrorF(const char * f, ...)
}
/* TODO: Have this actually log to ASL */
-void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...) {
+void
+xq_asl_log(int level, const char *subsystem, const char *file,
+ const char *function, int line, const char *fmt, ...)
+{
#ifdef DEBUG
va_list args;
@@ -74,7 +79,9 @@ void xq_asl_log (int level, const char *subsystem, const char *file, const char
#endif
}
-int main (int argc, const char *argv[]) {
+int
+main(int argc, const char *argv[])
+{
const char *s;
int i;
@@ -84,31 +91,36 @@ int main (int argc, const char *argv[]) {
xpbproxy_is_standalone = YES;
- if((s = getenv("X11_PREFS_DOMAIN")))
+ if ((s = getenv("X11_PREFS_DOMAIN")))
app_prefs_domain = s;
for (i = 1; i < argc; i++) {
- if(strcmp (argv[i], "--prefs-domain") == 0 && i+1 < argc) {
+ if (strcmp(argv[i], "--prefs-domain") == 0 && i + 1 < argc) {
app_prefs_domain = argv[++i];
- } else if (strcmp (argv[i], "--help") == 0) {
+ }
+ else if (strcmp(argv[i], "--help") == 0) {
ErrorF("usage: xpbproxy OPTIONS\n"
"Pasteboard proxying for X11.\n\n"
"--prefs-domain <domain> Change the domain used for reading preferences\n"
- " (default: %s)\n", app_prefs_domain);
+ " (default: %s)\n",
+ app_prefs_domain);
return 0;
- } else {
+ }
+ else {
ErrorF("usage: xpbproxy OPTIONS...\n"
- "Try 'xpbproxy --help' for more information.\n");
+ "Try 'xpbproxy --help' for more information.\n");
return 1;
}
}
-
- app_prefs_domain_cfstr = CFStringCreateWithCString(NULL, app_prefs_domain, kCFStringEncodingUTF8);
-
- signal (SIGINT, signal_handler);
- signal (SIGTERM, signal_handler);
- signal (SIGHUP, signal_handler);
- signal (SIGPIPE, SIG_IGN);
+
+ app_prefs_domain_cfstr =
+ CFStringCreateWithCString(NULL, app_prefs_domain,
+ kCFStringEncodingUTF8);
+
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+ signal(SIGHUP, signal_handler);
+ signal(SIGPIPE, SIG_IGN);
return xpbproxy_run();
}
diff --git a/xorg-server/hw/xquartz/pbproxy/main.m b/xorg-server/hw/xquartz/pbproxy/main.m
index 29ce83b35..b52aec8a4 100644
--- a/xorg-server/hw/xquartz/pbproxy/main.m
+++ b/xorg-server/hw/xquartz/pbproxy/main.m
@@ -51,27 +51,31 @@ extern BOOL serverRunning;
extern pthread_mutex_t serverRunningMutex;
extern pthread_cond_t serverRunningCond;
-static inline void wait_for_server_init(void) {
+static inline void
+wait_for_server_init(void)
+{
/* If the server hasn't finished initializing, wait for it... */
- if(!serverRunning) {
+ if (!serverRunning) {
pthread_mutex_lock(&serverRunningMutex);
- while(!serverRunning)
+ while (!serverRunning)
pthread_cond_wait(&serverRunningCond, &serverRunningMutex);
pthread_mutex_unlock(&serverRunningMutex);
}
}
-static int x_io_error_handler (Display *dpy) {
+static int
+x_io_error_handler(Display * dpy)
+{
/* We lost our connection to the server. */
-
- TRACE ();
+
+ TRACE();
/* trigger the thread to restart?
* NO - this would be to a "deeper" problem, and restarts would just
* make things worse...
*/
#ifdef STANDALONE_XPBPROXY
- if(xpbproxy_is_standalone)
+ if (xpbproxy_is_standalone)
exit(EXIT_FAILURE);
#endif
@@ -80,70 +84,81 @@ static int x_io_error_handler (Display *dpy) {
return 0;
}
-static int x_error_handler (Display *dpy, XErrorEvent *errevent) {
+static int
+x_error_handler(Display * dpy, XErrorEvent * errevent)
+{
return 0;
}
-int xpbproxy_run (void) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+int
+xpbproxy_run(void)
+{
+ NSAutoreleasePool *pool =[[NSAutoreleasePool alloc] init];
size_t i;
-
+
wait_for_server_init();
-
- for(i=0, xpbproxy_dpy=NULL; !xpbproxy_dpy && i<5; i++) {
+
+ for (i = 0, xpbproxy_dpy = NULL; !xpbproxy_dpy && i < 5; i++) {
xpbproxy_dpy = XOpenDisplay(NULL);
-
- if(!xpbproxy_dpy && display) {
+
+ if (!xpbproxy_dpy && display) {
char _display[32];
+
snprintf(_display, sizeof(_display), ":%s", display);
setenv("DISPLAY", _display, TRUE);
-
- xpbproxy_dpy=XOpenDisplay(_display);
+
+ xpbproxy_dpy = XOpenDisplay(_display);
}
- if(!xpbproxy_dpy)
+ if (!xpbproxy_dpy)
sleep(1);
}
-
+
if (xpbproxy_dpy == NULL) {
ErrorF("xpbproxy: can't open default display\n");
[pool release];
return EXIT_FAILURE;
}
-
- XSetIOErrorHandler (x_io_error_handler);
- XSetErrorHandler (x_error_handler);
-
- if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base,
- &xpbproxy_apple_wm_error_base)) {
+
+ XSetIOErrorHandler(x_io_error_handler);
+ XSetErrorHandler(x_error_handler);
+
+ if (!XAppleWMQueryExtension(xpbproxy_dpy, &xpbproxy_apple_wm_event_base,
+ &xpbproxy_apple_wm_error_base)) {
ErrorF("xpbproxy: can't open AppleWM server extension\n");
[pool release];
return EXIT_FAILURE;
}
- xpbproxy_have_xfixes = XFixesQueryExtension(xpbproxy_dpy, &xpbproxy_xfixes_event_base, &xpbproxy_xfixes_error_base);
+ xpbproxy_have_xfixes =
+ XFixesQueryExtension(xpbproxy_dpy, &xpbproxy_xfixes_event_base,
+ &xpbproxy_xfixes_error_base);
+
+ XAppleWMSelectInput(xpbproxy_dpy, AppleWMActivationNotifyMask |
+ AppleWMPasteboardNotifyMask);
- XAppleWMSelectInput (xpbproxy_dpy, AppleWMActivationNotifyMask |
- AppleWMPasteboardNotifyMask);
-
- _selection_object = [[x_selection alloc] init];
-
- if(!xpbproxy_input_register()) {
+ _selection_object =[[x_selection alloc] init];
+
+ if (!xpbproxy_input_register()) {
[pool release];
return EXIT_FAILURE;
}
-
+
[pool release];
-
+
CFRunLoopRun();
return EXIT_SUCCESS;
}
-id xpbproxy_selection_object (void) {
+id
+xpbproxy_selection_object(void)
+{
return _selection_object;
}
-Time xpbproxy_current_timestamp (void) {
+Time
+xpbproxy_current_timestamp(void)
+{
/* FIXME: may want to fetch a timestamp from the server.. */
return CurrentTime;
}
diff --git a/xorg-server/hw/xquartz/pbproxy/pbproxy.h b/xorg-server/hw/xquartz/pbproxy/pbproxy.h
index c80a660cc..bdb15aeca 100644
--- a/xorg-server/hw/xquartz/pbproxy/pbproxy.h
+++ b/xorg-server/hw/xquartz/pbproxy/pbproxy.h
@@ -65,11 +65,11 @@ extern BOOL xpbproxy_is_standalone;
#endif
/* from main.m */
-extern void xpbproxy_set_is_active (BOOL state);
-extern BOOL xpbproxy_get_is_active (void);
-extern id xpbproxy_selection_object (void);
-extern Time xpbproxy_current_timestamp (void);
-extern int xpbproxy_run (void);
+extern void xpbproxy_set_is_active(BOOL state);
+extern BOOL xpbproxy_get_is_active(void);
+extern id xpbproxy_selection_object(void);
+extern Time xpbproxy_current_timestamp(void);
+extern int xpbproxy_run(void);
extern Display *xpbproxy_dpy;
extern int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base;
@@ -77,17 +77,21 @@ extern int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base;
extern BOOL xpbproxy_have_xfixes;
/* from x-input.m */
-extern BOOL xpbproxy_input_register (void);
+extern BOOL xpbproxy_input_register(void);
/* os/log.c or app-main.m */
-extern void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
+extern void
+ErrorF(const char *f, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
/* from darwin.h */
-_X_ATTRIBUTE_PRINTF(6,7)
-extern void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...);
+_X_ATTRIBUTE_PRINTF(6, 7)
+extern void
+xq_asl_log(int level, const char *subsystem, const char *file,
+ const char *function, int line, const char *fmt, ...);
#define ASL_LOG(level, subsystem, msg, args...) xq_asl_log(level, subsystem, __FILE__, __FUNCTION__, __LINE__, msg, ##args)
#define DebugF(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "xpbproxy", msg, ##args)
#define TRACE() DebugF("TRACE")
-#endif /* PBPROXY_H */
+#endif /* PBPROXY_H */
diff --git a/xorg-server/hw/xquartz/pbproxy/trick_autotools.c b/xorg-server/hw/xquartz/pbproxy/trick_autotools.c
index a38f077b1..11aff526d 100644
--- a/xorg-server/hw/xquartz/pbproxy/trick_autotools.c
+++ b/xorg-server/hw/xquartz/pbproxy/trick_autotools.c
@@ -1,3 +1,5 @@
-int this_is_just_here_to_make_automake_work() {
- return 0;
+int
+this_is_just_here_to_make_automake_work()
+{
+ return 0;
}
diff --git a/xorg-server/hw/xquartz/pbproxy/x-input.m b/xorg-server/hw/xquartz/pbproxy/x-input.m
index ebb89980f..134bf59d8 100644
--- a/xorg-server/hw/xquartz/pbproxy/x-input.m
+++ b/xorg-server/hw/xquartz/pbproxy/x-input.m
@@ -48,126 +48,138 @@ BOOL xpbproxy_prefs_reload = NO;
/* Timestamp when the X server last told us it's active */
static Time last_activation_time;
-static void x_event_apple_wm_notify(XAppleWMNotifyEvent *e) {
+static void
+x_event_apple_wm_notify(XAppleWMNotifyEvent * e)
+{
int type = e->type - xpbproxy_apple_wm_event_base;
int kind = e->kind;
/* We want to reload prefs even if we're not active */
- if(type == AppleWMActivationNotify &&
- kind == AppleWMReloadPreferences)
- [xpbproxy_selection_object() reload_preferences];
+ if (type == AppleWMActivationNotify && kind == AppleWMReloadPreferences)
+ [xpbproxy_selection_object()reload_preferences];
- if(![xpbproxy_selection_object() is_active])
+ if (![xpbproxy_selection_object()is_active])
return;
- switch (type) {
- case AppleWMActivationNotify:
- switch (kind) {
- case AppleWMIsActive:
- last_activation_time = e->time;
- [xpbproxy_selection_object() x_active:e->time];
- break;
-
- case AppleWMIsInactive:
- [xpbproxy_selection_object() x_inactive:e->time];
- break;
- }
+ switch (type) {
+ case AppleWMActivationNotify:
+ switch (kind) {
+ case AppleWMIsActive:
+ last_activation_time = e->time;
+ [xpbproxy_selection_object()x_active:e->time];
break;
-
- case AppleWMPasteboardNotify:
- switch (kind) {
- case AppleWMCopyToPasteboard:
- [xpbproxy_selection_object() x_copy:e->time];
- }
+
+ case AppleWMIsInactive:
+ [xpbproxy_selection_object()x_inactive:e->time];
break;
+ }
+ break;
+
+ case AppleWMPasteboardNotify:
+ switch (kind) {
+ case AppleWMCopyToPasteboard:
+ [xpbproxy_selection_object()x_copy:e->time];
+ }
+ break;
}
}
-static void xpbproxy_process_xevents(void) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- if(pool == nil) {
+static void
+xpbproxy_process_xevents(void)
+{
+ NSAutoreleasePool *pool =[[NSAutoreleasePool alloc] init];
+
+ if (pool == nil) {
ErrorF("unable to allocate/init auto release pool!\n");
return;
}
-
+
while (XPending(xpbproxy_dpy) != 0) {
XEvent e;
-
- XNextEvent (xpbproxy_dpy, &e);
-
- switch (e.type) {
- case SelectionClear:
- if([xpbproxy_selection_object() is_active])
- [xpbproxy_selection_object () clear_event:&e.xselectionclear];
- break;
-
- case SelectionRequest:
- [xpbproxy_selection_object () request_event:&e.xselectionrequest];
- break;
-
- case SelectionNotify:
- [xpbproxy_selection_object () notify_event:&e.xselection];
- break;
-
- case PropertyNotify:
- [xpbproxy_selection_object () property_event:&e.xproperty];
- break;
-
- default:
- if(e.type >= xpbproxy_apple_wm_event_base &&
- e.type < xpbproxy_apple_wm_event_base + AppleWMNumberEvents) {
- x_event_apple_wm_notify((XAppleWMNotifyEvent *) &e);
- } else if(e.type == xpbproxy_xfixes_event_base + XFixesSelectionNotify) {
- [xpbproxy_selection_object() xfixes_selection_notify:(XFixesSelectionNotifyEvent *)&e];
- }
- break;
+
+ XNextEvent(xpbproxy_dpy, &e);
+
+ switch (e.type) {
+ case SelectionClear:
+ if ([xpbproxy_selection_object()is_active])
+ [xpbproxy_selection_object()clear_event:&e.xselectionclear];
+ break;
+
+ case SelectionRequest:
+ [xpbproxy_selection_object()request_event:&e.xselectionrequest];
+ break;
+
+ case SelectionNotify:
+ [xpbproxy_selection_object()notify_event:&e.xselection];
+ break;
+
+ case PropertyNotify:
+ [xpbproxy_selection_object()property_event:&e.xproperty];
+ break;
+
+ default:
+ if (e.type >= xpbproxy_apple_wm_event_base &&
+ e.type < xpbproxy_apple_wm_event_base + AppleWMNumberEvents) {
+ x_event_apple_wm_notify((XAppleWMNotifyEvent *) & e);
+ }
+ else if (e.type ==
+ xpbproxy_xfixes_event_base + XFixesSelectionNotify) {
+ [xpbproxy_selection_object()xfixes_selection_notify:(XFixesSelectionNotifyEvent *) &
+ e];
+ }
+ break;
}
-
+
XFlush(xpbproxy_dpy);
}
-
+
[pool release];
}
-static BOOL add_input_socket (int sock, CFOptionFlags callback_types,
- CFSocketCallBack callback, const CFSocketContext *ctx,
- CFRunLoopSourceRef *cf_source) {
+static BOOL
+add_input_socket(int sock, CFOptionFlags callback_types,
+ CFSocketCallBack callback, const CFSocketContext * ctx,
+ CFRunLoopSourceRef * cf_source)
+{
CFSocketRef cf_sock;
-
- cf_sock = CFSocketCreateWithNative (kCFAllocatorDefault, sock,
- callback_types, callback, ctx);
+
+ cf_sock = CFSocketCreateWithNative(kCFAllocatorDefault, sock,
+ callback_types, callback, ctx);
if (cf_sock == NULL) {
- close (sock);
+ close(sock);
return FALSE;
}
-
- *cf_source = CFSocketCreateRunLoopSource (kCFAllocatorDefault,
- cf_sock, 0);
- CFRelease (cf_sock);
-
+
+ *cf_source = CFSocketCreateRunLoopSource(kCFAllocatorDefault, cf_sock, 0);
+ CFRelease(cf_sock);
+
if (*cf_source == NULL)
return FALSE;
-
- CFRunLoopAddSource (CFRunLoopGetCurrent (),
- *cf_source, kCFRunLoopDefaultMode);
+
+ CFRunLoopAddSource(CFRunLoopGetCurrent(),
+ *cf_source, kCFRunLoopDefaultMode);
return TRUE;
}
-static void x_input_callback (CFSocketRef sock, CFSocketCallBackType type,
- CFDataRef address, const void *data, void *info) {
+static void
+x_input_callback(CFSocketRef sock, CFSocketCallBackType type,
+ CFDataRef address, const void *data, void *info)
+{
#ifdef STANDALONE_XPBPROXY
- if(xpbproxy_prefs_reload) {
- [xpbproxy_selection_object() reload_preferences];
+ if (xpbproxy_prefs_reload) {
+ [xpbproxy_selection_object()reload_preferences];
xpbproxy_prefs_reload = NO;
}
#endif
-
+
xpbproxy_process_xevents();
}
-BOOL xpbproxy_input_register(void) {
- return add_input_socket(ConnectionNumber(xpbproxy_dpy), kCFSocketReadCallBack,
- x_input_callback, NULL, &xpbproxy_dpy_source);
+BOOL
+xpbproxy_input_register(void)
+{
+ return add_input_socket(ConnectionNumber(xpbproxy_dpy),
+ kCFSocketReadCallBack, x_input_callback, NULL,
+ &xpbproxy_dpy_source);
}
diff --git a/xorg-server/hw/xquartz/pbproxy/x-selection.h b/xorg-server/hw/xquartz/pbproxy/x-selection.h
index d4a39e58f..f5c6c9bd5 100644
--- a/xorg-server/hw/xquartz/pbproxy/x-selection.h
+++ b/xorg-server/hw/xquartz/pbproxy/x-selection.h
@@ -41,9 +41,9 @@
/* This stores image data or text. */
struct propdata {
- unsigned char *data;
- size_t length;
- int format;
+ unsigned char *data;
+ size_t length;
+ int format;
};
struct atom_list {
@@ -52,16 +52,13 @@ struct atom_list {
compound_text, atom_pair;
};
-
-@interface x_selection : NSObject
-{
-@private
-
- /* The unmapped window we use for fetching selections. */
+ @interface x_selection:NSObject {
+ @private
+ /* The unmapped window we use for fetching selections. */
Window _selection_window;
Atom request_atom;
-
+
struct {
struct propdata propdata;
Window requestor;
@@ -74,37 +71,40 @@ struct atom_list {
* pending_copy is > 0 we do it again.
*/
int pending_copy;
+
/*
* This is used for the same purpose as pending_copy, but for the
* CLIPBOARD. It also prevents a race with INCR transfers.
*/
- int pending_clipboard;
-
+ int pending_clipboard;
+
struct atom_list atoms[1];
}
-- (void) x_active:(Time)timestamp;
-- (void) x_inactive:(Time)timestamp;
-
-- (void) x_copy:(Time)timestamp;
-
-- (void) clear_event:(XSelectionClearEvent *)e;
-- (void) request_event:(XSelectionRequestEvent *)e;
-- (void) notify_event:(XSelectionEvent *)e;
-- (void) property_event:(XPropertyEvent *)e;
-- (void) xfixes_selection_notify:(XFixesSelectionNotifyEvent *)e;
-- (void) handle_selection:(Atom)selection type:(Atom)type propdata:(struct propdata *)pdata;
-- (void) claim_clipboard;
-- (BOOL) set_clipboard_manager_status:(BOOL)value;
-- (void) own_clipboard;
-- (void) copy_completed:(Atom)selection;
-
-- (void) reload_preferences;
-- (BOOL) is_active;
-- (void) send_none:(XSelectionRequestEvent *)e;
-@end
+ -(void) x_active:(Time) timestamp;
+ -(void) x_inactive:(Time) timestamp;
+
+ -(void) x_copy:(Time) timestamp;
+
+ -(void) clear_event:(XSelectionClearEvent *) e;
+ -(void) request_event:(XSelectionRequestEvent *) e;
+ -(void) notify_event:(XSelectionEvent *) e;
+ -(void) property_event:(XPropertyEvent *) e;
+ -(void) xfixes_selection_notify:(XFixesSelectionNotifyEvent *) e;
+ -(void) handle_selection:(Atom)
+selection type:(Atom)
+type propdata:(struct propdata *) pdata;
+-(void) claim_clipboard;
+ -(BOOL) set_clipboard_manager_status:(BOOL) value;
+-(void) own_clipboard;
+ -(void) copy_completed:(Atom) selection;
+
+-(void) reload_preferences;
+-(BOOL) is_active;
+ -(void) send_none:(XSelectionRequestEvent *) e;
+@end
/* main.m */
extern x_selection *_selection_object;
-#endif /* X_SELECTION_H */
+#endif /* X_SELECTION_H */
diff --git a/xorg-server/hw/xquartz/pbproxy/x-selection.m b/xorg-server/hw/xquartz/pbproxy/x-selection.m
index b5f4dde5c..317aed073 100644
--- a/xorg-server/hw/xquartz/pbproxy/x-selection.m
+++ b/xorg-server/hw/xquartz/pbproxy/x-selection.m
@@ -65,59 +65,61 @@
*/
static struct {
- BOOL active ;
- BOOL primary_on_grab; /* This is provided as an option for people who
- * want it and has issues that won't ever be
- * addressed to make it *always* work.
- */
+ BOOL active;
+ BOOL primary_on_grab; /* This is provided as an option for people who
+ * want it and has issues that won't ever be
+ * addressed to make it *always* work.
+ */
BOOL clipboard_to_pasteboard;
BOOL pasteboard_to_primary;
BOOL pasteboard_to_clipboard;
-} pbproxy_prefs = { YES, NO, YES, YES, YES };
+} pbproxy_prefs = {
+YES, NO, YES, YES, YES};
@implementation x_selection
-
-static struct propdata null_propdata = {NULL, 0, 0};
+ static struct propdata null_propdata = { NULL, 0, 0 };
#ifdef DEBUG
static void
-dump_prefs() {
- ErrorF(fp,
- "pbproxy preferences:\n"
- "\tactive %u\n"
- "\tprimary_on_grab %u\n"
- "\tclipboard_to_pasteboard %u\n"
- "\tpasteboard_to_primary %u\n"
- "\tpasteboard_to_clipboard %u\n",
- pbproxy_prefs.active,
- pbproxy_prefs.primary_on_grab,
- pbproxy_prefs.clipboard_to_pasteboard,
- pbproxy_prefs.pasteboard_to_primary,
- pbproxy_prefs.pasteboard_to_clipboard);
+dump_prefs()
+{
+ ErrorF(fp,
+ "pbproxy preferences:\n"
+ "\tactive %u\n"
+ "\tprimary_on_grab %u\n"
+ "\tclipboard_to_pasteboard %u\n"
+ "\tpasteboard_to_primary %u\n"
+ "\tpasteboard_to_clipboard %u\n",
+ pbproxy_prefs.active,
+ pbproxy_prefs.primary_on_grab,
+ pbproxy_prefs.clipboard_to_pasteboard,
+ pbproxy_prefs.pasteboard_to_primary,
+ pbproxy_prefs.pasteboard_to_clipboard);
}
#endif
extern CFStringRef app_prefs_domain_cfstr;
static BOOL
-prefs_get_bool (CFStringRef key, BOOL defaultValue) {
+prefs_get_bool(CFStringRef key, BOOL defaultValue)
+{
Boolean value, ok;
-
- value = CFPreferencesGetAppBooleanValue (key, app_prefs_domain_cfstr, &ok);
-
+
+ value = CFPreferencesGetAppBooleanValue(key, app_prefs_domain_cfstr, &ok);
+
return ok ? (BOOL) value : defaultValue;
}
static void
-init_propdata (struct propdata *pdata)
+init_propdata(struct propdata *pdata)
{
*pdata = null_propdata;
}
static void
-free_propdata (struct propdata *pdata)
+free_propdata(struct propdata *pdata)
{
- free (pdata->data);
+ free(pdata->data);
*pdata = null_propdata;
}
@@ -127,188 +129,175 @@ free_propdata (struct propdata *pdata)
* The property is only deleted when bytesleft is 0 if delete is True.
*/
static Bool
-get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Atom *type)
+get_property(Window win, Atom property, struct propdata *pdata, Bool delete,
+ Atom *type)
{
long offset = 0;
unsigned long numitems, bytesleft = 0;
+
#ifdef TEST
/* This is used to test the growth handling. */
unsigned long length = 4UL;
#else
- unsigned long length = (100000UL + 3) / 4;
+ unsigned long length = (100000UL + 3) / 4;
#endif
unsigned char *buf = NULL, *chunk = NULL;
size_t buflen = 0, chunkbytesize = 0;
int format;
- TRACE ();
-
- if(None == property)
- return True;
-
- do
- {
- unsigned long newbuflen = 0;
- unsigned char *newbuf = NULL;
-
-#ifdef TEST
- ErrorF("bytesleft %lu\n", bytesleft);
+ TRACE();
+
+ if (None == property)
+ return True;
+
+ do {
+ unsigned long newbuflen = 0;
+ unsigned char *newbuf = NULL;
+
+#ifdef TEST
+ ErrorF("bytesleft %lu\n", bytesleft);
#endif
- if (Success != XGetWindowProperty (xpbproxy_dpy, win, property,
- offset, length, delete,
- AnyPropertyType,
- type, &format, &numitems,
- &bytesleft, &chunk))
- {
- DebugF ("Error while getting window property.\n");
- *pdata = null_propdata;
- free (buf);
- return True;
- }
-
+ if (Success != XGetWindowProperty(xpbproxy_dpy, win, property,
+ offset, length, delete,
+ AnyPropertyType,
+ type, &format, &numitems,
+ &bytesleft, &chunk)) {
+ DebugF("Error while getting window property.\n");
+ *pdata = null_propdata;
+ free(buf);
+ return True;
+ }
+
#ifdef TEST
- ErrorF("format %d numitems %lu bytesleft %lu\n",
- format, numitems, bytesleft);
-
- ErrorF("type %s\n", XGetAtomName (xpbproxy_dpy, *type));
+ ErrorF("format %d numitems %lu bytesleft %lu\n",
+ format, numitems, bytesleft);
+
+ ErrorF("type %s\n", XGetAtomName(xpbproxy_dpy, *type));
#endif
-
- /* Format is the number of bits. */
- if (format == 8)
- chunkbytesize = numitems;
- else if (format == 16)
- chunkbytesize = numitems * sizeof(short);
- else if (format == 32)
- chunkbytesize = numitems * sizeof(long);
+
+ /* Format is the number of bits. */
+ if (format == 8)
+ chunkbytesize = numitems;
+ else if (format == 16)
+ chunkbytesize = numitems * sizeof(short);
+ else if (format == 32)
+ chunkbytesize = numitems * sizeof(long);
#ifdef TEST
- ErrorF("chunkbytesize %zu\n", chunkbytesize);
+ ErrorF("chunkbytesize %zu\n", chunkbytesize);
#endif
- newbuflen = buflen + chunkbytesize;
- if (newbuflen > 0)
- {
- newbuf = realloc (buf, newbuflen);
-
- if (NULL == newbuf)
- {
- XFree (chunk);
- free (buf);
- return True;
- }
-
- memcpy (newbuf + buflen, chunk, chunkbytesize);
- XFree (chunk);
- buf = newbuf;
- buflen = newbuflen;
- /* offset is a multiple of 32 bits*/
- offset += chunkbytesize / 4;
- }
- else
- {
- if (chunk)
- XFree (chunk);
- }
-
+ newbuflen = buflen + chunkbytesize;
+ if (newbuflen > 0) {
+ newbuf = realloc(buf, newbuflen);
+
+ if (NULL == newbuf) {
+ XFree(chunk);
+ free(buf);
+ return True;
+ }
+
+ memcpy(newbuf + buflen, chunk, chunkbytesize);
+ XFree(chunk);
+ buf = newbuf;
+ buflen = newbuflen;
+ /* offset is a multiple of 32 bits */
+ offset += chunkbytesize / 4;
+ }
+ else {
+ if (chunk)
+ XFree(chunk);
+ }
+
#ifdef TEST
- ErrorF("bytesleft %lu\n", bytesleft);
+ ErrorF("bytesleft %lu\n", bytesleft);
#endif
} while (bytesleft > 0);
-
+
pdata->data = buf;
pdata->length = buflen;
pdata->format = format;
- return /*success*/ False;
+ return /*success */ False;
}
-
/* Implementation methods */
/* This finds the preferred type from a TARGETS list.*/
-- (Atom) find_preferred:(struct propdata *)pdata
-{
+ -(Atom) find_preferred:(struct propdata *) pdata {
Atom a = None;
size_t i, step;
Bool png = False, jpeg = False, utf8 = False, string = False;
- TRACE ();
-
- if (pdata->format != 32)
- {
- ErrorF("Atom list is expected to be formatted as an array of 32bit values.\n");
- return None;
- }
-
- for (i = 0, step = sizeof(long); i < pdata->length; i += step)
- {
- a = (Atom)*(long *)(pdata->data + i);
-
- if (a == atoms->image_png)
- {
- png = True;
- }
- else if (a == atoms->image_jpeg)
- {
- jpeg = True;
- }
- else if (a == atoms->utf8_string)
- {
- utf8 = True;
- }
- else if (a == atoms->string)
- {
- string = True;
- }
- else
- {
- char *type = XGetAtomName(xpbproxy_dpy, a);
- if (type)
- {
- DebugF("Unhandled X11 mime type: %s", type);
- XFree(type);
- }
- }
- }
-
- /*We prefer PNG over strings, and UTF8 over a Latin-1 string.*/
+ TRACE();
+
+ if (pdata->format != 32) {
+ ErrorF
+ ("Atom list is expected to be formatted as an array of 32bit values.\n");
+ return None;
+ }
+
+ for (i = 0, step = sizeof(long); i < pdata->length; i += step) {
+ a = (Atom) *(long *) (pdata->data + i);
+
+ if (a == atoms->image_png) {
+ png = True;
+ }
+ else if (a == atoms->image_jpeg) {
+ jpeg = True;
+ }
+ else if (a == atoms->utf8_string) {
+ utf8 = True;
+ }
+ else if (a == atoms->string) {
+ string = True;
+ }
+ else {
+ char *type = XGetAtomName(xpbproxy_dpy, a);
+
+ if (type) {
+ DebugF("Unhandled X11 mime type: %s", type);
+ XFree(type);
+ }
+ }
+ }
+
+ /*We prefer PNG over strings, and UTF8 over a Latin-1 string. */
if (png)
- return atoms->image_png;
+ return atoms->image_png;
if (jpeg)
- return atoms->image_jpeg;
+ return atoms->image_jpeg;
if (utf8)
- return atoms->utf8_string;
+ return atoms->utf8_string;
if (string)
- return atoms->string;
+ return atoms->string;
- /* This is evidently something we don't know how to handle.*/
+ /* This is evidently something we don't know how to handle. */
return None;
}
/* Return True if this is an INCR-style transfer. */
-- (Bool) is_incr_type:(XSelectionEvent *)e
-{
+ -(Bool) is_incr_type:(XSelectionEvent *) e {
Atom seltype;
int format;
unsigned long numitems = 0UL, bytesleft = 0UL;
unsigned char *chunk;
-
- TRACE ();
- if (Success != XGetWindowProperty (xpbproxy_dpy, e->requestor, e->property,
- /*offset*/ 0L, /*length*/ 4UL,
- /*Delete*/ False,
- AnyPropertyType, &seltype, &format,
- &numitems, &bytesleft, &chunk))
- {
- return False;
+ TRACE();
+
+ if (Success != XGetWindowProperty(xpbproxy_dpy, e->requestor, e->property,
+ /*offset */ 0L, /*length */ 4UL,
+ /*Delete */ False,
+ AnyPropertyType, &seltype, &format,
+ &numitems, &bytesleft, &chunk)) {
+ return False;
}
- if(chunk)
- XFree(chunk);
+ if (chunk)
+ XFree(chunk);
return (seltype == atoms->incr) ? True : False;
}
@@ -317,133 +306,122 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
* This should be called after a selection has been copied,
* or when the selection is unfinished before a transfer completes.
*/
-- (void) release_pending
-{
- TRACE ();
+-(void) release_pending {
+ TRACE();
- free_propdata (&pending.propdata);
+ free_propdata(&pending.propdata);
pending.requestor = None;
pending.selection = None;
}
/* Return True if an error occurs during an append.*/
/* Return False if the append succeeds. */
-- (Bool) append_to_pending:(struct propdata *)pdata requestor:(Window)requestor
+ -(Bool) append_to_pending:(struct propdata *)
+pdata requestor:(Window) requestor
{
unsigned char *newdata;
size_t newlength;
-
- TRACE ();
-
- if (requestor != pending.requestor)
- {
- [self release_pending];
- pending.requestor = requestor;
- }
-
+
+ TRACE();
+
+ if (requestor != pending.requestor) {
+ [self release_pending];
+ pending.requestor = requestor;
+ }
+
newlength = pending.propdata.length + pdata->length;
newdata = realloc(pending.propdata.data, newlength);
- if(NULL == newdata)
- {
- perror("realloc propdata");
- [self release_pending];
+ if (NULL == newdata) {
+ perror("realloc propdata");
+ [self release_pending];
return True;
}
memcpy(newdata + pending.propdata.length, pdata->data, pdata->length);
pending.propdata.data = newdata;
pending.propdata.length = newlength;
-
+
return False;
}
-
-
/* Called when X11 becomes active (i.e. has key focus) */
-- (void) x_active:(Time)timestamp
-{
+ -(void) x_active:(Time) timestamp {
static NSInteger changeCount;
NSInteger countNow;
NSPasteboard *pb;
- TRACE ();
+ TRACE();
- pb = [NSPasteboard generalPasteboard];
+ pb =[NSPasteboard generalPasteboard];
if (nil == pb)
- return;
+ return;
- countNow = [pb changeCount];
+ countNow =[pb changeCount];
- if (countNow != changeCount)
- {
- DebugF ("changed pasteboard!\n");
+ if (countNow != changeCount) {
+ DebugF("changed pasteboard!\n");
changeCount = countNow;
-
- if (pbproxy_prefs.pasteboard_to_primary)
- {
- XSetSelectionOwner (xpbproxy_dpy, atoms->primary, _selection_window, CurrentTime);
+
+ if (pbproxy_prefs.pasteboard_to_primary) {
+ XSetSelectionOwner(xpbproxy_dpy, atoms->primary, _selection_window,
+ CurrentTime);
}
-
+
if (pbproxy_prefs.pasteboard_to_clipboard) {
[self own_clipboard];
}
}
#if 0
- /*gstaplin: we should perhaps investigate something like this branch above...*/
- if ([_pasteboard availableTypeFromArray: _known_types] != nil)
- {
- /* Pasteboard has data we should proxy; I think it makes
- sense to put it on both CLIPBOARD and PRIMARY */
-
- XSetSelectionOwner (xpbproxy_dpy, atoms->clipboard,
- _selection_window, timestamp);
- XSetSelectionOwner (xpbproxy_dpy, atoms->primary,
- _selection_window, timestamp);
- }
+ /*gstaplin: we should perhaps investigate something like this branch above... */
+ if ([_pasteboard availableTypeFromArray:_known_types] != nil) {
+ /* Pasteboard has data we should proxy; I think it makes
+ sense to put it on both CLIPBOARD and PRIMARY */
+
+ XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard,
+ _selection_window, timestamp);
+ XSetSelectionOwner(xpbproxy_dpy, atoms->primary,
+ _selection_window, timestamp);
+ }
#endif
}
/* Called when X11 loses key focus */
-- (void) x_inactive:(Time)timestamp
-{
- TRACE ();
+ -(void) x_inactive:(Time) timestamp {
+ TRACE();
}
/* This requests the TARGETS list from the PRIMARY selection owner. */
-- (void) x_copy_request_targets
-{
- TRACE ();
+-(void) x_copy_request_targets {
+ TRACE();
request_atom = atoms->targets;
- XConvertSelection (xpbproxy_dpy, atoms->primary, atoms->targets,
- atoms->primary, _selection_window, CurrentTime);
+ XConvertSelection(xpbproxy_dpy, atoms->primary, atoms->targets,
+ atoms->primary, _selection_window, CurrentTime);
}
/* Called when the Edit/Copy item on the main X11 menubar is selected
* and no appkit window claims it. */
-- (void) x_copy:(Time)timestamp
-{
+ -(void) x_copy:(Time) timestamp {
Window w;
- TRACE ();
+ TRACE();
- w = XGetSelectionOwner (xpbproxy_dpy, atoms->primary);
+ w = XGetSelectionOwner(xpbproxy_dpy, atoms->primary);
- if (None != w)
- {
- ++pending_copy;
-
- if (1 == pending_copy) {
- /*
- * There are no other copy operations in progress, so we
- * can proceed safely. Otherwise the copy_completed method
- * will see that the pending_copy is > 1, and do another copy.
- */
- [self x_copy_request_targets];
- }
+ if (None != w) {
+ ++pending_copy;
+
+ if (1 == pending_copy) {
+ /*
+ * There are no other copy operations in progress, so we
+ * can proceed safely. Otherwise the copy_completed method
+ * will see that the pending_copy is > 1, and do another copy.
+ */
+ [self x_copy_request_targets];
+ }
}
}
@@ -451,32 +429,37 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
* This prevents tools like xclipboard from causing havoc.
* Returns TRUE on success
*/
-- (BOOL) set_clipboard_manager_status:(BOOL)value
-{
- TRACE ();
+ -(BOOL) set_clipboard_manager_status:(BOOL) value {
+ TRACE();
- Window owner = XGetSelectionOwner (xpbproxy_dpy, atoms->clipboard_manager);
+ Window owner = XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager);
- if(value) {
- if(owner == _selection_window)
+ if (value) {
+ if (owner == _selection_window)
return TRUE;
- if(owner != None) {
- ErrorF("A clipboard manager using window 0x%lx already owns the clipboard selection. "
- "pbproxy will not sync clipboard to pasteboard.\n", owner);
+ if (owner != None) {
+ ErrorF
+ ("A clipboard manager using window 0x%lx already owns the clipboard selection. "
+ "pbproxy will not sync clipboard to pasteboard.\n", owner);
return FALSE;
}
-
- XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager, _selection_window, CurrentTime);
- return (_selection_window == XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager));
- } else {
- if(owner != _selection_window)
+
+ XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager,
+ _selection_window, CurrentTime);
+ return (_selection_window ==
+ XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager));
+ }
+ else {
+ if (owner != _selection_window)
return TRUE;
- XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager, None, CurrentTime);
- return(None == XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager));
+ XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager, None,
+ CurrentTime);
+ return (None ==
+ XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager));
}
-
+
return FALSE;
}
@@ -484,31 +467,30 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
* This occurs when we previously owned a selection,
* and then lost it from another client.
*/
-- (void) clear_event:(XSelectionClearEvent *)e
-{
-
+ -(void) clear_event:(XSelectionClearEvent *) e {
+
+ TRACE();
+
+ DebugF("e->selection %s\n", XGetAtomName(xpbproxy_dpy, e->selection));
- TRACE ();
-
- DebugF ("e->selection %s\n", XGetAtomName (xpbproxy_dpy, e->selection));
-
- if(e->selection == atoms->clipboard) {
+ if (e->selection == atoms->clipboard) {
/*
* We lost ownership of the CLIPBOARD.
*/
++pending_clipboard;
-
+
if (1 == pending_clipboard) {
/* Claim the clipboard contents from the new owner. */
[self claim_clipboard];
}
- } else if(e->selection == atoms->clipboard_manager) {
- if(pbproxy_prefs.clipboard_to_pasteboard) {
+ }
+ else if (e->selection == atoms->clipboard_manager) {
+ if (pbproxy_prefs.clipboard_to_pasteboard) {
/* Another CLIPBOARD_MANAGER has set itself as owner. Disable syncing
* to avoid a race.
*/
ErrorF("Another clipboard manager was started! "
- "xpbproxy is disabling syncing with clipboard.\n");
+ "xpbproxy is disabling syncing with clipboard.\n");
pbproxy_prefs.clipboard_to_pasteboard = NO;
}
}
@@ -517,73 +499,71 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
/*
* We greedily acquire the clipboard after it changes, and on startup.
*/
-- (void) claim_clipboard
-{
+-(void) claim_clipboard {
Window owner;
-
- TRACE ();
-
+
+ TRACE();
+
if (!pbproxy_prefs.clipboard_to_pasteboard)
return;
-
- owner = XGetSelectionOwner (xpbproxy_dpy, atoms->clipboard);
+
+ owner = XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard);
if (None == owner) {
/*
* The owner probably died or we are just starting up pbproxy.
* Set pbproxy's _selection_window as the owner, and continue.
*/
- DebugF ("No clipboard owner.\n");
- [self copy_completed:atoms->clipboard];
+ DebugF("No clipboard owner.\n");
+ [self copy_completed:atoms->clipboard];
return;
- } else if (owner == _selection_window) {
- [self copy_completed:atoms->clipboard];
+ }
+ else if (owner == _selection_window) {
+ [self copy_completed:atoms->clipboard];
return;
}
-
- DebugF ("requesting targets\n");
-
+
+ DebugF("requesting targets\n");
+
request_atom = atoms->targets;
- XConvertSelection (xpbproxy_dpy, atoms->clipboard, atoms->targets,
- atoms->clipboard, _selection_window, CurrentTime);
- XFlush (xpbproxy_dpy);
+ XConvertSelection(xpbproxy_dpy, atoms->clipboard, atoms->targets,
+ atoms->clipboard, _selection_window, CurrentTime);
+ XFlush(xpbproxy_dpy);
/* Now we will get a SelectionNotify event in the future. */
}
/* Greedily acquire the clipboard. */
-- (void) own_clipboard
-{
+-(void) own_clipboard {
- TRACE ();
+ TRACE();
/* We should perhaps have a boundary limit on the number of iterations... */
- do
- {
- XSetSelectionOwner (xpbproxy_dpy, atoms->clipboard, _selection_window,
- CurrentTime);
- } while (_selection_window != XGetSelectionOwner (xpbproxy_dpy,
- atoms->clipboard));
+ do {
+ XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard, _selection_window,
+ CurrentTime);
+ } while (_selection_window != XGetSelectionOwner(xpbproxy_dpy,
+ atoms->clipboard));
}
-- (void) init_reply:(XEvent *)reply request:(XSelectionRequestEvent *)e
+ -(void) init_reply:(XEvent *)
+reply request:(XSelectionRequestEvent *) e
{
reply->xselection.type = SelectionNotify;
reply->xselection.selection = e->selection;
reply->xselection.target = e->target;
reply->xselection.requestor = e->requestor;
reply->xselection.time = e->time;
- reply->xselection.property = None;
+ reply->xselection.property = None;
}
-- (void) send_reply:(XEvent *)reply
-{
+ -(void) send_reply:(XEvent *) reply {
/*
* We are supposed to use an empty event mask, and not propagate
* the event, according to the ICCCM.
*/
- DebugF ("reply->xselection.requestor 0x%lx\n", reply->xselection.requestor);
-
- XSendEvent (xpbproxy_dpy, reply->xselection.requestor, False, 0, reply);
- XFlush (xpbproxy_dpy);
+ DebugF("reply->xselection.requestor 0x%lx\n", reply->xselection.requestor);
+
+ XSendEvent(xpbproxy_dpy, reply->xselection.requestor, False, 0, reply);
+ XFlush(xpbproxy_dpy);
}
/*
@@ -594,76 +574,75 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
* (in Latin-1 encoding). The requestor can then make the choice based on
* the list.
*/
-- (void) send_targets:(XSelectionRequestEvent *)e pasteboard:(NSPasteboard *)pb
+ -(void) send_targets:(XSelectionRequestEvent *)
+e pasteboard:(NSPasteboard *) pb
{
XEvent reply;
NSArray *pbtypes;
- [self init_reply:&reply request:e];
+ [self init_reply: &reply request:e];
- pbtypes = [pb types];
- if (pbtypes)
- {
- long list[7]; /* Don't forget to increase this if we handle more types! */
+ pbtypes =[pb types];
+ if (pbtypes) {
+ long list[7]; /* Don't forget to increase this if we handle more types! */
long count = 0;
-
- /*
- * I'm not sure if this is needed, but some toolkits/clients list
- * TARGETS in response to targets.
- */
- list[count] = atoms->targets;
- ++count;
-
- if ([pbtypes containsObject:NSStringPboardType])
- {
- /* We have a string type that we can convert to UTF8, or Latin-1... */
- DebugF ("NSStringPboardType\n");
- list[count] = atoms->utf8_string;
- ++count;
- list[count] = atoms->string;
- ++count;
- list[count] = atoms->compound_text;
- ++count;
- }
-
- /* TODO add the NSPICTPboardType back again, once we have conversion
- * functionality in send_image.
- */
+
+ /*
+ * I'm not sure if this is needed, but some toolkits/clients list
+ * TARGETS in response to targets.
+ */
+ list[count] = atoms->targets;
+ ++count;
+
+ if ([pbtypes containsObject:NSStringPboardType]) {
+ /* We have a string type that we can convert to UTF8, or Latin-1... */
+ DebugF("NSStringPboardType\n");
+ list[count] = atoms->utf8_string;
+ ++count;
+ list[count] = atoms->string;
+ ++count;
+ list[count] = atoms->compound_text;
+ ++count;
+ }
+
+ /* TODO add the NSPICTPboardType back again, once we have conversion
+ * functionality in send_image.
+ */
#ifdef __clang__
#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations" // NSPICTPboardType
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // NSPICTPboardType
#endif
- if ([pbtypes containsObject:NSPICTPboardType]
- || [pbtypes containsObject:NSTIFFPboardType])
- {
- /* We can convert a TIFF to a PNG or JPEG. */
- DebugF ("NSTIFFPboardType\n");
- list[count] = atoms->image_png;
- ++count;
- list[count] = atoms->image_jpeg;
- ++count;
- }
+ if ([pbtypes containsObject:NSPICTPboardType]
+ ||[pbtypes containsObject:NSTIFFPboardType]) {
+ /* We can convert a TIFF to a PNG or JPEG. */
+ DebugF("NSTIFFPboardType\n");
+ list[count] = atoms->image_png;
+ ++count;
+ list[count] = atoms->image_jpeg;
+ ++count;
+ }
#ifdef __clang__
#pragma clang diagnostic pop
#endif
- if (count)
- {
- /* We have a list of ATOMs to send. */
- XChangeProperty (xpbproxy_dpy, e->requestor, e->property, atoms->atom, 32,
- PropModeReplace, (unsigned char *) list, count);
-
- reply.xselection.property = e->property;
- }
+ if (count) {
+ /* We have a list of ATOMs to send. */
+ XChangeProperty(xpbproxy_dpy, e->requestor, e->property,
+ atoms->atom, 32, PropModeReplace,
+ (unsigned char *) list, count);
+
+ reply.xselection.property = e->property;
+ }
}
- [self send_reply:&reply];
+ [self send_reply:&reply];
}
-
-- (void) send_string:(XSelectionRequestEvent *)e utf8:(BOOL)utf8 pasteboard:(NSPasteboard *)pb
+ -(void) send_string:(XSelectionRequestEvent *)
+e utf8:(BOOL)
+utf8 pasteboard:(NSPasteboard *) pb
{
XEvent reply;
NSArray *pbtypes;
@@ -671,162 +650,158 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
const char *bytes;
NSUInteger length;
- TRACE ();
+ TRACE();
+
+ [self init_reply: &reply request:e];
- [self init_reply:&reply request:e];
+ pbtypes =[pb types];
- pbtypes = [pb types];
-
- if (![pbtypes containsObject:NSStringPboardType])
- {
- [self send_reply:&reply];
- return;
+ if (![pbtypes containsObject:NSStringPboardType]) {
+ [self send_reply:&reply];
+ return;
}
#ifdef __LP64__
- DebugF ("pbtypes retainCount after containsObject: %lu\n", [pbtypes retainCount]);
+ DebugF("pbtypes retainCount after containsObject: %lu\n",
+ [pbtypes retainCount]);
#else
- DebugF ("pbtypes retainCount after containsObject: %u\n", [pbtypes retainCount]);
+ DebugF("pbtypes retainCount after containsObject: %u\n",
+ [pbtypes retainCount]);
#endif
- data = [pb stringForType:NSStringPboardType];
+ data =[pb stringForType:NSStringPboardType];
- if (nil == data)
- {
- [self send_reply:&reply];
- return;
- }
-
- if (utf8)
- {
- bytes = [data UTF8String];
- /*
- * We don't want the UTF-8 string length here.
- * We want the length in bytes.
- */
- length = strlen (bytes);
-
- if (length < 50) {
- DebugF ("UTF-8: %s\n", bytes);
+ if (nil == data) {
+ [self send_reply:&reply];
+ return;
+ }
+
+ if (utf8) {
+ bytes =[data UTF8String];
+ /*
+ * We don't want the UTF-8 string length here.
+ * We want the length in bytes.
+ */
+ length = strlen(bytes);
+
+ if (length < 50) {
+ DebugF("UTF-8: %s\n", bytes);
#ifdef __LP64__
- DebugF ("UTF-8 length: %lu\n", length);
+ DebugF("UTF-8 length: %lu\n", length);
#else
- DebugF ("UTF-8 length: %u\n", length);
+ DebugF("UTF-8 length: %u\n", length);
#endif
- }
- }
- else
- {
- DebugF ("Latin-1\n");
- bytes = [data cStringUsingEncoding:NSISOLatin1StringEncoding];
- /*WARNING: bytes is not NUL-terminated. */
- length = [data lengthOfBytesUsingEncoding:NSISOLatin1StringEncoding];
- }
-
- DebugF ("e->target %s\n", XGetAtomName (xpbproxy_dpy, e->target));
-
- XChangeProperty (xpbproxy_dpy, e->requestor, e->property, e->target,
- 8, PropModeReplace, (unsigned char *) bytes, length);
-
+ }
+ }
+ else {
+ DebugF("Latin-1\n");
+ bytes =[data cStringUsingEncoding:NSISOLatin1StringEncoding];
+ /*WARNING: bytes is not NUL-terminated. */
+ length =[data lengthOfBytesUsingEncoding:NSISOLatin1StringEncoding];
+ }
+
+ DebugF("e->target %s\n", XGetAtomName(xpbproxy_dpy, e->target));
+
+ XChangeProperty(xpbproxy_dpy, e->requestor, e->property, e->target,
+ 8, PropModeReplace, (unsigned char *) bytes, length);
+
reply.xselection.property = e->property;
- [self send_reply:&reply];
+ [self send_reply:&reply];
}
-- (void) send_compound_text:(XSelectionRequestEvent *)e pasteboard:(NSPasteboard *)pb
+ -(void) send_compound_text:(XSelectionRequestEvent *)
+e pasteboard:(NSPasteboard *) pb
{
XEvent reply;
NSArray *pbtypes;
-
- TRACE ();
-
- [self init_reply:&reply request:e];
-
- pbtypes = [pb types];
-
- if ([pbtypes containsObject: NSStringPboardType])
- {
- NSString *data = [pb stringForType:NSStringPboardType];
- if (nil != data)
- {
- /*
- * Cast to (void *) to avoid a const warning.
- * AFAIK Xutf8TextListToTextProperty does not modify the input memory.
- */
- void *utf8 = (void *)[data UTF8String];
- char *list[] = { utf8, NULL };
- XTextProperty textprop;
-
- textprop.value = NULL;
-
- if (Success == Xutf8TextListToTextProperty (xpbproxy_dpy, list, 1,
- XCompoundTextStyle,
- &textprop))
- {
-
- if (8 != textprop.format)
- DebugF ("textprop.format is unexpectedly not 8 - it's %d instead\n",
- textprop.format);
-
- XChangeProperty (xpbproxy_dpy, e->requestor, e->property,
- atoms->compound_text, textprop.format,
- PropModeReplace, textprop.value,
- textprop.nitems);
-
- reply.xselection.property = e->property;
- }
-
- if (textprop.value)
- XFree (textprop.value);
-
- }
- }
-
- [self send_reply:&reply];
+
+ TRACE();
+
+ [self init_reply: &reply request:e];
+
+ pbtypes =[pb types];
+
+ if ([pbtypes containsObject:NSStringPboardType]) {
+ NSString *data =[pb stringForType:NSStringPboardType];
+
+ if (nil != data) {
+ /*
+ * Cast to (void *) to avoid a const warning.
+ * AFAIK Xutf8TextListToTextProperty does not modify the input memory.
+ */
+ void *utf8 = (void *)[data UTF8String];
+ char *list[] = { utf8, NULL };
+ XTextProperty textprop;
+
+ textprop.value = NULL;
+
+ if (Success == Xutf8TextListToTextProperty(xpbproxy_dpy, list, 1,
+ XCompoundTextStyle,
+ &textprop)) {
+
+ if (8 != textprop.format)
+ DebugF
+ ("textprop.format is unexpectedly not 8 - it's %d instead\n",
+ textprop.format);
+
+ XChangeProperty(xpbproxy_dpy, e->requestor, e->property,
+ atoms->compound_text, textprop.format,
+ PropModeReplace, textprop.value,
+ textprop.nitems);
+
+ reply.xselection.property = e->property;
+ }
+
+ if (textprop.value)
+ XFree(textprop.value);
+
+ }
+ }
+
+ [self send_reply:&reply];
}
/* Finding a test application that uses MULTIPLE has proven to be difficult. */
-- (void) send_multiple:(XSelectionRequestEvent *)e
-{
+ -(void) send_multiple:(XSelectionRequestEvent *) e {
XEvent reply;
- TRACE ();
+ TRACE();
+
+ [self init_reply: &reply request:e];
- [self init_reply:&reply request:e];
+ if (None != e->property) {
- if (None != e->property)
- {
-
}
-
- [self send_reply:&reply];
+
+ [self send_reply:&reply];
}
/* Return nil if an error occured. */
/* DO NOT retain the encdata for longer than the length of an event response.
* The autorelease pool will reuse/free it.
- */
-- (NSData *) encode_image_data:(NSData *)data type:(NSBitmapImageFileType)enctype
+ */
+ -(NSData *) encode_image_data:(NSData *)
+data type:(NSBitmapImageFileType) enctype
{
- NSBitmapImageRep *bmimage = nil;
+ NSBitmapImageRep *bmimage = nil;
NSData *encdata = nil;
NSDictionary *dict = nil;
- bmimage = [[NSBitmapImageRep alloc] initWithData:data];
+ bmimage =[[NSBitmapImageRep alloc] initWithData:data];
if (nil == bmimage)
- return nil;
+ return nil;
- dict = [[NSDictionary alloc] init];
- encdata = [bmimage representationUsingType:enctype properties:dict];
+ dict =[[NSDictionary alloc] init];
+ encdata =[bmimage representationUsingType: enctype properties:dict];
- if (nil == encdata)
- {
- [dict autorelease];
- [bmimage autorelease];
- return nil;
+ if (nil == encdata) {
+ [dict autorelease];
+ [bmimage autorelease];
+ return nil;
}
-
+
[dict autorelease];
[bmimage autorelease];
@@ -835,60 +810,53 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
/* Return YES when an error has occured when trying to send the PICT. */
/* The caller should send a default reponse with a property of None when an error occurs. */
-- (BOOL) send_image_pict_reply:(XSelectionRequestEvent *)e
- pasteboard:(NSPasteboard *)pb
- type:(NSBitmapImageFileType)imagetype
+ -(BOOL) send_image_pict_reply: (XSelectionRequestEvent *) e pasteboard: (NSPasteboard *) pb type:(NSBitmapImageFileType) imagetype
{
XEvent reply;
NSImage *img = nil;
NSData *data = nil, *encdata = nil;
NSUInteger length;
const void *bytes = NULL;
-
- img = [[NSImage alloc] initWithPasteboard:pb];
- if (nil == img)
- {
- return YES;
+ img =[[NSImage alloc] initWithPasteboard:pb];
+
+ if (nil == img) {
+ return YES;
}
-
- data = [img TIFFRepresentation];
- if (nil == data)
- {
- [img autorelease];
- ErrorF("unable to convert PICT to TIFF!\n");
- return YES;
- }
-
- encdata = [self encode_image_data:data type:imagetype];
- if(nil == encdata)
- {
- [img autorelease];
- return YES;
- }
-
- [self init_reply:&reply request:e];
-
- length = [encdata length];
- bytes = [encdata bytes];
-
- XChangeProperty (xpbproxy_dpy, e->requestor, e->property, e->target,
- 8, PropModeReplace, bytes, length);
+ data =[img TIFFRepresentation];
+
+ if (nil == data) {
+ [img autorelease];
+ ErrorF("unable to convert PICT to TIFF!\n");
+ return YES;
+ }
+
+ encdata =[self encode_image_data: data type:imagetype];
+ if (nil == encdata) {
+ [img autorelease];
+ return YES;
+ }
+
+ [self init_reply: &reply request:e];
+
+ length =[encdata length];
+ bytes =[encdata bytes];
+
+ XChangeProperty(xpbproxy_dpy, e->requestor, e->property, e->target,
+ 8, PropModeReplace, bytes, length);
reply.xselection.property = e->property;
- [self send_reply:&reply];
+ [self send_reply:&reply];
[img autorelease];
- return NO; /*no error*/
+ return NO; /*no error */
}
/* Return YES if an error occured. */
/* The caller should send a reply with a property of None when an error occurs. */
-- (BOOL) send_image_tiff_reply:(XSelectionRequestEvent *)e
- pasteboard:(NSPasteboard *)pb
- type:(NSBitmapImageFileType)imagetype
+ -(BOOL) send_image_tiff_reply: (XSelectionRequestEvent *) e pasteboard: (NSPasteboard *) pb type:(NSBitmapImageFileType) imagetype
{
XEvent reply;
NSData *data = nil;
@@ -896,91 +864,87 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
NSUInteger length;
const void *bytes = NULL;
- data = [pb dataForType:NSTIFFPboardType];
+ data =[pb dataForType:NSTIFFPboardType];
if (nil == data)
- return YES;
-
- encdata = [self encode_image_data:data type:imagetype];
+ return YES;
+
+ encdata =[self encode_image_data: data type:imagetype];
- if(nil == encdata)
- return YES;
+ if (nil == encdata)
+ return YES;
+
+ [self init_reply: &reply request:e];
- [self init_reply:&reply request:e];
+ length =[encdata length];
+ bytes =[encdata bytes];
- length = [encdata length];
- bytes = [encdata bytes];
-
- XChangeProperty (xpbproxy_dpy, e->requestor, e->property, e->target,
- 8, PropModeReplace, bytes, length);
+ XChangeProperty(xpbproxy_dpy, e->requestor, e->property, e->target,
+ 8, PropModeReplace, bytes, length);
reply.xselection.property = e->property;
-
- [self send_reply:&reply];
- return NO; /*no error*/
+ [self send_reply:&reply];
+
+ return NO; /*no error */
}
-- (void) send_image:(XSelectionRequestEvent *)e pasteboard:(NSPasteboard *)pb
+ -(void) send_image:(XSelectionRequestEvent *)
+e pasteboard:(NSPasteboard *) pb
{
NSArray *pbtypes = nil;
NSBitmapImageFileType imagetype = NSPNGFileType;
- TRACE ();
+ TRACE();
if (e->target == atoms->image_png)
- imagetype = NSPNGFileType;
+ imagetype = NSPNGFileType;
else if (e->target == atoms->image_jpeg)
- imagetype = NSJPEGFileType;
- else
- {
- ErrorF("internal failure in xpbproxy! imagetype being sent isn't PNG or JPEG.\n");
+ imagetype = NSJPEGFileType;
+ else {
+ ErrorF
+ ("internal failure in xpbproxy! imagetype being sent isn't PNG or JPEG.\n");
}
- pbtypes = [pb types];
+ pbtypes =[pb types];
- if (pbtypes)
- {
- if ([pbtypes containsObject:NSTIFFPboardType])
- {
- if (NO == [self send_image_tiff_reply:e pasteboard:pb type:imagetype])
- return;
- }
+ if (pbtypes) {
+ if ([pbtypes containsObject:NSTIFFPboardType]) {
+ if (NO ==[self send_image_tiff_reply: e pasteboard: pb type:imagetype])
+ return;
+ }
#ifdef __clang__
#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations" // NSPICTPboardType
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // NSPICTPboardType
#endif
- else if ([pbtypes containsObject:NSPICTPboardType])
+ else if ([pbtypes containsObject:NSPICTPboardType])
#ifdef __clang__
#pragma clang diagnostic pop
#endif
- {
- if (NO == [self send_image_pict_reply:e pasteboard:pb type:imagetype])
- return;
+ {
+ if (NO ==[self send_image_pict_reply: e pasteboard: pb type:imagetype])
+ return;
- /* Fall through intentionally to the send_none: */
- }
+ /* Fall through intentionally to the send_none: */
+ }
}
- [self send_none:e];
+ [self send_none:e];
}
-- (void)send_none:(XSelectionRequestEvent *)e
-{
+ -(void) send_none:(XSelectionRequestEvent *) e {
XEvent reply;
- TRACE ();
+ TRACE();
- [self init_reply:&reply request:e];
- [self send_reply:&reply];
+ [self init_reply: &reply request:e];
+ [self send_reply:&reply];
}
-
/* Another client requested the data or targets of data available from the clipboard. */
-- (void)request_event:(XSelectionRequestEvent *)e
-{
+ -(void) request_event:(XSelectionRequestEvent *) e {
NSPasteboard *pb;
- TRACE ();
+ TRACE();
/* TODO We should also keep track of the time of the selection, and
* according to the ICCCM "refuse the request" if the event timestamp
@@ -992,388 +956,367 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
* Perhaps we should just punt and ignore races.
*/
- /*TODO we need a COMPOUND_TEXT test app*/
- /*TODO we need a MULTIPLE test app*/
+ /*TODO we need a COMPOUND_TEXT test app */
+ /*TODO we need a MULTIPLE test app */
- pb = [NSPasteboard generalPasteboard];
- if (nil == pb)
- {
- [self send_none:e];
- return;
+ pb =[NSPasteboard generalPasteboard];
+ if (nil == pb) {
+ [self send_none:e];
+ return;
}
-
if (None != e->target)
- DebugF ("e->target %s\n", XGetAtomName (xpbproxy_dpy, e->target));
-
- if (e->target == atoms->targets)
- {
- /* The paste requestor wants to know what TARGETS we support. */
- [self send_targets:e pasteboard:pb];
- }
- else if (e->target == atoms->multiple)
- {
- /*
- * This isn't finished, and may never be, unless I can find
- * a good test app.
- */
- [self send_multiple:e];
- }
- else if (e->target == atoms->utf8_string)
- {
- [self send_string:e utf8:YES pasteboard:pb];
- }
- else if (e->target == atoms->string)
- {
- [self send_string:e utf8:NO pasteboard:pb];
- }
- else if (e->target == atoms->compound_text)
- {
- [self send_compound_text:e pasteboard:pb];
- }
- else if (e->target == atoms->multiple)
- {
- [self send_multiple:e];
- }
- else if (e->target == atoms->image_png || e->target == atoms->image_jpeg)
- {
- [self send_image:e pasteboard:pb];
+ DebugF("e->target %s\n", XGetAtomName(xpbproxy_dpy, e->target));
+
+ if (e->target == atoms->targets) {
+ /* The paste requestor wants to know what TARGETS we support. */
+ [self send_targets: e pasteboard:pb];
}
- else
- {
- [self send_none:e];
+ else if (e->target == atoms->multiple) {
+ /*
+ * This isn't finished, and may never be, unless I can find
+ * a good test app.
+ */
+ [self send_multiple:e];
+ }
+ else if (e->target == atoms->utf8_string) {
+ [self send_string: e utf8: YES pasteboard:pb];
+ }
+ else if (e->target == atoms->string) {
+ [self send_string: e utf8: NO pasteboard:pb];
+ }
+ else if (e->target == atoms->compound_text) {
+ [self send_compound_text: e pasteboard:pb];
+ }
+ else if (e->target == atoms->multiple) {
+ [self send_multiple:e];
+ }
+ else if (e->target == atoms->image_png || e->target == atoms->image_jpeg) {
+ [self send_image: e pasteboard:pb];
+ }
+ else {
+ [self send_none:e];
}
}
/* This handles the events resulting from an XConvertSelection request. */
-- (void) notify_event:(XSelectionEvent *)e
-{
+ -(void) notify_event:(XSelectionEvent *) e {
Atom type;
struct propdata pdata;
-
- TRACE ();
+
+ TRACE();
[self release_pending];
-
+
if (None == e->property) {
- DebugF ("e->property is None.\n");
- [self copy_completed:e->selection];
- /* Nothing is selected. */
- return;
+ DebugF("e->property is None.\n");
+ [self copy_completed:e->selection];
+ /* Nothing is selected. */
+ return;
}
#if 0
- ErrorF("e->selection %s\n", XGetAtomName (xpbproxy_dpy, e->selection));
- ErrorF("e->property %s\n", XGetAtomName (xpbproxy_dpy, e->property));
+ ErrorF("e->selection %s\n", XGetAtomName(xpbproxy_dpy, e->selection));
+ ErrorF("e->property %s\n", XGetAtomName(xpbproxy_dpy, e->property));
#endif
- if ([self is_incr_type:e])
- {
- /*
- * This is an INCR-style transfer, which means that we
- * will get the data after a series of PropertyNotify events.
- */
- DebugF ("is INCR\n");
+ if ([self is_incr_type:e]) {
+ /*
+ * This is an INCR-style transfer, which means that we
+ * will get the data after a series of PropertyNotify events.
+ */
+ DebugF("is INCR\n");
- if (get_property (e->requestor, e->property, &pdata, /*Delete*/ True, &type))
- {
- /*
- * An error occured, so we should invoke the copy_completed:, but
- * not handle_selection:type:propdata:
- */
- [self copy_completed:e->selection];
- return;
- }
+ if (get_property
+ (e->requestor, e->property, &pdata, /*Delete */ True, &type)) {
+ /*
+ * An error occured, so we should invoke the copy_completed:, but
+ * not handle_selection:type:propdata:
+ */
+ [self copy_completed:e->selection];
+ return;
+ }
- free_propdata (&pdata);
+ free_propdata(&pdata);
- pending.requestor = e->requestor;
- pending.selection = e->selection;
+ pending.requestor = e->requestor;
+ pending.selection = e->selection;
- DebugF ("set pending.requestor to 0x%lx\n", pending.requestor);
+ DebugF("set pending.requestor to 0x%lx\n", pending.requestor);
}
- else
- {
- if (get_property (e->requestor, e->property, &pdata, /*Delete*/ True, &type))
- {
- [self copy_completed:e->selection];
- return;
- }
-
- /* We have the complete selection data.*/
- [self handle_selection:e->selection type:type propdata:&pdata];
-
- DebugF ("handled selection with the first notify_event\n");
+ else {
+ if (get_property
+ (e->requestor, e->property, &pdata, /*Delete */ True, &type)) {
+ [self copy_completed:e->selection];
+ return;
+ }
+
+ /* We have the complete selection data. */
+ [self handle_selection: e->selection type: type propdata:&pdata];
+
+ DebugF("handled selection with the first notify_event\n");
}
}
/* This is used for INCR transfers. See the ICCCM for the details. */
/* This is used to retrieve PRIMARY and CLIPBOARD selections. */
-- (void) property_event:(XPropertyEvent *)e
-{
+ -(void) property_event:(XPropertyEvent *) e {
struct propdata pdata;
Atom type;
- TRACE ();
-
- if (None != e->atom)
- {
+ TRACE();
+
+ if (None != e->atom) {
#ifdef DEBUG
- char *name = XGetAtomName (xpbproxy_dpy, e->atom);
+ char *name = XGetAtomName(xpbproxy_dpy, e->atom);
- if (name)
- {
- DebugF ("e->atom %s\n", name);
- XFree(name);
- }
+ if (name) {
+ DebugF("e->atom %s\n", name);
+ XFree(name);
+ }
#endif
}
- if (None != pending.requestor && PropertyNewValue == e->state)
- {
- DebugF ("pending.requestor 0x%lx\n", pending.requestor);
+ if (None != pending.requestor && PropertyNewValue == e->state) {
+ DebugF("pending.requestor 0x%lx\n", pending.requestor);
- if (get_property (e->window, e->atom, &pdata, /*Delete*/ True, &type))
- {
- [self copy_completed:pending.selection];
- [self release_pending];
- return;
- }
-
- if (0 == pdata.length)
- {
- /*
- * We completed the transfer.
- * handle_selection will call copy_completed: for us.
- */
- [self handle_selection:pending.selection type:type propdata:&pending.propdata];
- free_propdata(&pdata);
- pending.propdata = null_propdata;
- pending.requestor = None;
- pending.selection = None;
- }
- else
- {
- [self append_to_pending:&pdata requestor:e->window];
- free_propdata (&pdata);
- }
+ if (get_property(e->window, e->atom, &pdata, /*Delete */ True, &type)) {
+ [self copy_completed:pending.selection];
+ [self release_pending];
+ return;
+ }
+
+ if (0 == pdata.length) {
+ /*
+ * We completed the transfer.
+ * handle_selection will call copy_completed: for us.
+ */
+ [self handle_selection: pending.selection type: type propdata:&pending.
+ propdata];
+ free_propdata(&pdata);
+ pending.propdata = null_propdata;
+ pending.requestor = None;
+ pending.selection = None;
+ }
+ else {
+ [self append_to_pending: &pdata requestor:e->window];
+ free_propdata(&pdata);
+ }
}
}
-- (void) xfixes_selection_notify:(XFixesSelectionNotifyEvent *)e {
- if(!pbproxy_prefs.active)
+ -(void) xfixes_selection_notify:(XFixesSelectionNotifyEvent *) e {
+ if (!pbproxy_prefs.active)
return;
-
- switch(e->subtype) {
- case XFixesSetSelectionOwnerNotify:
- if(e->selection == atoms->primary && pbproxy_prefs.primary_on_grab)
- [self x_copy:e->timestamp];
- break;
-
- case XFixesSelectionWindowDestroyNotify:
- case XFixesSelectionClientCloseNotify:
- default:
- ErrorF("Unhandled XFixesSelectionNotifyEvent: subtype=%d\n", e->subtype);
- break;
+
+ switch (e->subtype) {
+ case XFixesSetSelectionOwnerNotify:
+ if (e->selection == atoms->primary && pbproxy_prefs.primary_on_grab)
+ [self x_copy:e->timestamp];
+ break;
+
+ case XFixesSelectionWindowDestroyNotify:
+ case XFixesSelectionClientCloseNotify:
+ default:
+ ErrorF("Unhandled XFixesSelectionNotifyEvent: subtype=%d\n",
+ e->subtype);
+ break;
}
}
-- (void) handle_targets: (Atom)selection propdata:(struct propdata *)pdata
+ -(void) handle_targets:(Atom)
+selection propdata:(struct propdata *) pdata
{
/* Find a type we can handle and prefer from the list of ATOMs. */
Atom preferred;
char *name;
- TRACE ();
+ TRACE();
+
+ preferred =[self find_preferred:pdata];
- preferred = [self find_preferred:pdata];
-
- if (None == preferred)
- {
- /*
- * This isn't required by the ICCCM, but some apps apparently
- * don't respond to TARGETS properly.
- */
- preferred = atoms->string;
+ if (None == preferred) {
+ /*
+ * This isn't required by the ICCCM, but some apps apparently
+ * don't respond to TARGETS properly.
+ */
+ preferred = atoms->string;
}
- (void)name; /* Avoid a warning with non-debug compiles. */
+ (void) name; /* Avoid a warning with non-debug compiles. */
#ifdef DEBUG
- name = XGetAtomName (xpbproxy_dpy, preferred);
+ name = XGetAtomName(xpbproxy_dpy, preferred);
- if (name)
- {
- DebugF ("requesting %s\n", name);
+ if (name) {
+ DebugF("requesting %s\n", name);
}
#endif
request_atom = preferred;
- XConvertSelection (xpbproxy_dpy, selection, preferred, selection,
- _selection_window, CurrentTime);
+ XConvertSelection(xpbproxy_dpy, selection, preferred, selection,
+ _selection_window, CurrentTime);
}
/* This handles the image type of selection (typically in CLIPBOARD). */
/* We convert to a TIFF, so that other applications can paste more easily. */
-- (void) handle_image: (struct propdata *)pdata pasteboard:(NSPasteboard *)pb
+ -(void) handle_image:(struct propdata *)
+pdata pasteboard:(NSPasteboard *) pb
{
NSArray *pbtypes;
NSUInteger length;
NSData *data, *tiff;
NSBitmapImageRep *bmimage;
- TRACE ();
+ TRACE();
length = pdata->length;
- data = [[NSData alloc] initWithBytes:pdata->data length:length];
+ data =[[NSData alloc] initWithBytes: pdata->data length:length];
- if (nil == data)
- {
- DebugF ("unable to create NSData object!\n");
- return;
+ if (nil == data) {
+ DebugF("unable to create NSData object!\n");
+ return;
}
#ifdef __LP64__
- DebugF ("data retainCount before NSBitmapImageRep initWithData: %lu\n",
- [data retainCount]);
+ DebugF("data retainCount before NSBitmapImageRep initWithData: %lu\n",
+ [data retainCount]);
#else
- DebugF ("data retainCount before NSBitmapImageRep initWithData: %u\n",
- [data retainCount]);
+ DebugF("data retainCount before NSBitmapImageRep initWithData: %u\n",
+ [data retainCount]);
#endif
- bmimage = [[NSBitmapImageRep alloc] initWithData:data];
+ bmimage =[[NSBitmapImageRep alloc] initWithData:data];
- if (nil == bmimage)
- {
- [data autorelease];
- DebugF ("unable to create NSBitmapImageRep!\n");
- return;
+ if (nil == bmimage) {
+ [data autorelease];
+ DebugF("unable to create NSBitmapImageRep!\n");
+ return;
}
#ifdef __LP64__
- DebugF ("data retainCount after NSBitmapImageRep initWithData: %lu\n",
- [data retainCount]);
+ DebugF("data retainCount after NSBitmapImageRep initWithData: %lu\n",
+ [data retainCount]);
#else
- DebugF ("data retainCount after NSBitmapImageRep initWithData: %u\n",
- [data retainCount]);
+ DebugF("data retainCount after NSBitmapImageRep initWithData: %u\n",
+ [data retainCount]);
#endif
- @try
- {
- tiff = [bmimage TIFFRepresentation];
+ @try {
+ tiff =[bmimage TIFFRepresentation];
}
- @catch (NSException *e)
- {
- DebugF ("NSTIFFException!\n");
- [data autorelease];
- [bmimage autorelease];
- return;
+ @catch(NSException * e) {
+ DebugF("NSTIFFException!\n");
+ [data autorelease];
+ [bmimage autorelease];
+ return;
}
-
+
#ifdef __LP64__
- DebugF ("bmimage retainCount after TIFFRepresentation %lu\n", [bmimage retainCount]);
+ DebugF("bmimage retainCount after TIFFRepresentation %lu\n",
+ [bmimage retainCount]);
#else
- DebugF ("bmimage retainCount after TIFFRepresentation %u\n", [bmimage retainCount]);
+ DebugF("bmimage retainCount after TIFFRepresentation %u\n",
+ [bmimage retainCount]);
#endif
- pbtypes = [NSArray arrayWithObjects:NSTIFFPboardType, nil];
+ pbtypes =[NSArray arrayWithObjects:NSTIFFPboardType, nil];
- if (nil == pbtypes)
- {
- [data autorelease];
- [bmimage autorelease];
- return;
+ if (nil == pbtypes) {
+ [data autorelease];
+ [bmimage autorelease];
+ return;
}
- [pb declareTypes:pbtypes owner:nil];
- if (YES != [pb setData:tiff forType:NSTIFFPboardType])
- {
- DebugF ("writing pasteboard data failed!\n");
+ [pb declareTypes: pbtypes owner:nil];
+ if (YES !=[pb setData: tiff forType:NSTIFFPboardType]) {
+ DebugF("writing pasteboard data failed!\n");
}
[data autorelease];
#ifdef __LP64__
- DebugF ("bmimage retainCount before release %lu\n", [bmimage retainCount]);
+ DebugF("bmimage retainCount before release %lu\n",[bmimage retainCount]);
#else
- DebugF ("bmimage retainCount before release %u\n", [bmimage retainCount]);
+ DebugF("bmimage retainCount before release %u\n",[bmimage retainCount]);
#endif
[bmimage autorelease];
}
/* This handles the UTF8_STRING type of selection. */
-- (void) handle_utf8_string:(struct propdata *)pdata pasteboard:(NSPasteboard *)pb
+ -(void) handle_utf8_string:(struct propdata *)
+pdata pasteboard:(NSPasteboard *) pb
{
NSString *string;
NSArray *pbtypes;
-
- TRACE ();
- string = [[NSString alloc] initWithBytes:pdata->data length:pdata->length encoding:NSUTF8StringEncoding];
-
+ TRACE();
+
+ string =[[NSString alloc] initWithBytes: pdata->data length: pdata->length encoding:NSUTF8StringEncoding];
+
if (nil == string)
- return;
+ return;
- pbtypes = [NSArray arrayWithObjects:NSStringPboardType, nil];
+ pbtypes =[NSArray arrayWithObjects:NSStringPboardType, nil];
- if (nil == pbtypes)
- {
- [string autorelease];
- return;
+ if (nil == pbtypes) {
+ [string autorelease];
+ return;
}
- [pb declareTypes:pbtypes owner:nil];
-
- if (YES != [pb setString:string forType:NSStringPboardType]) {
- ErrorF("pasteboard setString:forType: failed!\n");
+ [pb declareTypes: pbtypes owner:nil];
+
+ if (YES !=[pb setString: string forType:NSStringPboardType]) {
+ ErrorF("pasteboard setString:forType: failed!\n");
}
[string autorelease];
- DebugF ("done handling utf8 string\n");
+ DebugF("done handling utf8 string\n");
}
/* This handles the STRING type, which should be in Latin-1. */
-- (void) handle_string: (struct propdata *)pdata pasteboard:(NSPasteboard *)pb
+ -(void) handle_string:(struct propdata *)
+pdata pasteboard:(NSPasteboard *) pb
{
- NSString *string;
+ NSString *string;
NSArray *pbtypes;
- TRACE ();
+ TRACE();
+
+ string =[[NSString alloc] initWithBytes: pdata->data length: pdata->length encoding:NSISOLatin1StringEncoding];
- string = [[NSString alloc] initWithBytes:pdata->data length:pdata->length encoding:NSISOLatin1StringEncoding];
-
if (nil == string)
- return;
+ return;
- pbtypes = [NSArray arrayWithObjects:NSStringPboardType, nil];
+ pbtypes =[NSArray arrayWithObjects:NSStringPboardType, nil];
- if (nil == pbtypes)
- {
- [string autorelease];
- return;
+ if (nil == pbtypes) {
+ [string autorelease];
+ return;
}
- [pb declareTypes:pbtypes owner:nil];
- if (YES != [pb setString:string forType:NSStringPboardType]) {
- ErrorF("pasteboard setString:forType failed in handle_string!\n");
+ [pb declareTypes: pbtypes owner:nil];
+ if (YES !=[pb setString: string forType:NSStringPboardType]) {
+ ErrorF("pasteboard setString:forType failed in handle_string!\n");
}
[string autorelease];
}
/* This is called when the selection is completely retrieved from another client. */
/* Warning: this frees the propdata. */
-- (void) handle_selection:(Atom)selection type:(Atom)type propdata:(struct propdata *)pdata
+ -(void) handle_selection:(Atom)
+selection type:(Atom)
+type propdata:(struct propdata *) pdata
{
NSPasteboard *pb;
- TRACE ();
+ TRACE();
- pb = [NSPasteboard generalPasteboard];
+ pb =[NSPasteboard generalPasteboard];
- if (nil == pb)
- {
- [self copy_completed:selection];
- free_propdata (pdata);
- return;
+ if (nil == pb) {
+ [self copy_completed:selection];
+ free_propdata(pdata);
+ return;
}
/*
@@ -1381,205 +1324,201 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
* These aren't ICCCM compliant apps, but we need these to work...
*/
if (request_atom == atoms->targets
- && (type == atoms->atom || type == atoms->targets))
- {
- [self handle_targets:selection propdata:pdata];
- free_propdata(pdata);
- return;
- }
- else if (type == atoms->image_png)
- {
- [self handle_image:pdata pasteboard:pb];
- }
- else if (type == atoms->image_jpeg)
- {
- [self handle_image:pdata pasteboard:pb];
- }
- else if (type == atoms->utf8_string)
- {
- [self handle_utf8_string:pdata pasteboard:pb];
- }
- else if (type == atoms->string)
- {
- [self handle_string:pdata pasteboard:pb];
- }
-
+ && (type == atoms->atom || type == atoms->targets)) {
+ [self handle_targets: selection propdata:pdata];
+ free_propdata(pdata);
+ return;
+ }
+ else if (type == atoms->image_png) {
+ [self handle_image: pdata pasteboard:pb];
+ }
+ else if (type == atoms->image_jpeg) {
+ [self handle_image: pdata pasteboard:pb];
+ }
+ else if (type == atoms->utf8_string) {
+ [self handle_utf8_string: pdata pasteboard:pb];
+ }
+ else if (type == atoms->string) {
+ [self handle_string: pdata pasteboard:pb];
+ }
+
free_propdata(pdata);
- [self copy_completed:selection];
+ [self copy_completed:selection];
}
-
-- (void) copy_completed:(Atom)selection
-{
- TRACE ();
+ -(void) copy_completed:(Atom) selection {
+ TRACE();
char *name;
- (void)name; /* Avoid warning with non-debug compiles. */
+ (void) name; /* Avoid warning with non-debug compiles. */
#ifdef DEBUG
- name = XGetAtomName (xpbproxy_dpy, selection);
- if (name)
- {
- DebugF ("copy_completed: %s\n", name);
- XFree (name);
+ name = XGetAtomName(xpbproxy_dpy, selection);
+ if (name) {
+ DebugF("copy_completed: %s\n", name);
+ XFree(name);
}
#endif
- if (selection == atoms->primary && pending_copy > 0)
- {
- --pending_copy;
- if (pending_copy > 0)
- {
- /* Copy PRIMARY again. */
- [self x_copy_request_targets];
- return;
- }
- }
- else if (selection == atoms->clipboard && pending_clipboard > 0)
- {
- --pending_clipboard;
- if (pending_clipboard > 0)
- {
- /* Copy CLIPBOARD. */
- [self claim_clipboard];
- return;
- }
- else
- {
- /* We got the final data. Now set pbproxy as the owner. */
- [self own_clipboard];
- return;
- }
- }
-
+ if (selection == atoms->primary && pending_copy > 0) {
+ --pending_copy;
+ if (pending_copy > 0) {
+ /* Copy PRIMARY again. */
+ [self x_copy_request_targets];
+ return;
+ }
+ }
+ else if (selection == atoms->clipboard && pending_clipboard > 0) {
+ --pending_clipboard;
+ if (pending_clipboard > 0) {
+ /* Copy CLIPBOARD. */
+ [self claim_clipboard];
+ return;
+ }
+ else {
+ /* We got the final data. Now set pbproxy as the owner. */
+ [self own_clipboard];
+ return;
+ }
+ }
+
/*
* We had 1 or more primary in progress, and the clipboard arrived
* while we were busy.
*/
- if (pending_clipboard > 0)
- {
- [self claim_clipboard];
+ if (pending_clipboard > 0) {
+ [self claim_clipboard];
}
}
-- (void) reload_preferences
-{
+-(void) reload_preferences {
/*
* It's uncertain how we could handle the synchronization failing, so cast to void.
* The prefs_get_bool should fall back to defaults if the org.x.X11 plist doesn't exist or is invalid.
*/
- (void)CFPreferencesAppSynchronize(app_prefs_domain_cfstr);
+ (void) CFPreferencesAppSynchronize(app_prefs_domain_cfstr);
#ifdef STANDALONE_XPBPROXY
- if(xpbproxy_is_standalone)
+ if (xpbproxy_is_standalone)
pbproxy_prefs.active = YES;
else
#endif
- pbproxy_prefs.active = prefs_get_bool(CFSTR("sync_pasteboard"), pbproxy_prefs.active);
- pbproxy_prefs.primary_on_grab = prefs_get_bool(CFSTR("sync_primary_on_select"), pbproxy_prefs.primary_on_grab);
- pbproxy_prefs.clipboard_to_pasteboard = prefs_get_bool(CFSTR("sync_clipboard_to_pasteboard"), pbproxy_prefs.clipboard_to_pasteboard);
- pbproxy_prefs.pasteboard_to_primary = prefs_get_bool(CFSTR("sync_pasteboard_to_primary"), pbproxy_prefs.pasteboard_to_primary);
- pbproxy_prefs.pasteboard_to_clipboard = prefs_get_bool(CFSTR("sync_pasteboard_to_clipboard"), pbproxy_prefs.pasteboard_to_clipboard);
+ pbproxy_prefs.active =
+ prefs_get_bool(CFSTR("sync_pasteboard"), pbproxy_prefs.active);
+ pbproxy_prefs.primary_on_grab =
+ prefs_get_bool(CFSTR("sync_primary_on_select"),
+ pbproxy_prefs.primary_on_grab);
+ pbproxy_prefs.clipboard_to_pasteboard =
+ prefs_get_bool(CFSTR("sync_clipboard_to_pasteboard"),
+ pbproxy_prefs.clipboard_to_pasteboard);
+ pbproxy_prefs.pasteboard_to_primary =
+ prefs_get_bool(CFSTR("sync_pasteboard_to_primary"),
+ pbproxy_prefs.pasteboard_to_primary);
+ pbproxy_prefs.pasteboard_to_clipboard =
+ prefs_get_bool(CFSTR("sync_pasteboard_to_clipboard"),
+ pbproxy_prefs.pasteboard_to_clipboard);
/* This is used for debugging. */
//dump_prefs();
- if(pbproxy_prefs.active && pbproxy_prefs.primary_on_grab && !xpbproxy_have_xfixes) {
- ErrorF("Disabling sync_primary_on_select functionality due to missing XFixes extension.\n");
+ if (pbproxy_prefs.active && pbproxy_prefs.primary_on_grab &&
+ !xpbproxy_have_xfixes) {
+ ErrorF
+ ("Disabling sync_primary_on_select functionality due to missing XFixes extension.\n");
pbproxy_prefs.primary_on_grab = NO;
}
/* Claim or release the CLIPBOARD_MANAGER atom */
- if(![self set_clipboard_manager_status:(pbproxy_prefs.active && pbproxy_prefs.clipboard_to_pasteboard)])
+ if (![self set_clipboard_manager_status:(pbproxy_prefs.active &&
+ pbproxy_prefs.
+ clipboard_to_pasteboard)])
pbproxy_prefs.clipboard_to_pasteboard = NO;
-
- if(pbproxy_prefs.active && pbproxy_prefs.clipboard_to_pasteboard)
+
+ if (pbproxy_prefs.active && pbproxy_prefs.clipboard_to_pasteboard)
[self claim_clipboard];
}
-- (BOOL) is_active
-{
+-(BOOL) is_active {
return pbproxy_prefs.active;
}
/* NSPasteboard-required methods */
-- (void) paste:(id)sender
-{
- TRACE ();
+ -(void) paste:(id) sender {
+ TRACE();
}
-- (void) pasteboard:(NSPasteboard *)pb provideDataForType:(NSString *)type
+ -(void) pasteboard:(NSPasteboard *)
+pb provideDataForType:(NSString *) type
{
- TRACE ();
+ TRACE();
}
-- (void) pasteboardChangedOwner:(NSPasteboard *)pb
-{
- TRACE ();
+ -(void) pasteboardChangedOwner:(NSPasteboard *) pb {
+ TRACE();
/* Right now we don't care with this. */
}
/* Allocation */
-- init
-{
+-init {
unsigned long pixel;
- self = [super init];
+ self =[super init];
if (self == nil)
- return nil;
-
- atoms->primary = XInternAtom (xpbproxy_dpy, "PRIMARY", False);
- atoms->clipboard = XInternAtom (xpbproxy_dpy, "CLIPBOARD", False);
- atoms->text = XInternAtom (xpbproxy_dpy, "TEXT", False);
- atoms->utf8_string = XInternAtom (xpbproxy_dpy, "UTF8_STRING", False);
- atoms->string = XInternAtom (xpbproxy_dpy, "STRING", False);
- atoms->targets = XInternAtom (xpbproxy_dpy, "TARGETS", False);
- atoms->multiple = XInternAtom (xpbproxy_dpy, "MULTIPLE", False);
- atoms->cstring = XInternAtom (xpbproxy_dpy, "CSTRING", False);
- atoms->image_png = XInternAtom (xpbproxy_dpy, "image/png", False);
- atoms->image_jpeg = XInternAtom (xpbproxy_dpy, "image/jpeg", False);
- atoms->incr = XInternAtom (xpbproxy_dpy, "INCR", False);
- atoms->atom = XInternAtom (xpbproxy_dpy, "ATOM", False);
- atoms->clipboard_manager = XInternAtom (xpbproxy_dpy, "CLIPBOARD_MANAGER", False);
- atoms->compound_text = XInternAtom (xpbproxy_dpy, "COMPOUND_TEXT", False);
- atoms->atom_pair = XInternAtom (xpbproxy_dpy, "ATOM_PAIR", False);
-
- pixel = BlackPixel (xpbproxy_dpy, DefaultScreen (xpbproxy_dpy));
- _selection_window = XCreateSimpleWindow (xpbproxy_dpy, DefaultRootWindow (xpbproxy_dpy),
- 0, 0, 1, 1, 0, pixel, pixel);
+ return nil;
+
+ atoms->primary = XInternAtom(xpbproxy_dpy, "PRIMARY", False);
+ atoms->clipboard = XInternAtom(xpbproxy_dpy, "CLIPBOARD", False);
+ atoms->text = XInternAtom(xpbproxy_dpy, "TEXT", False);
+ atoms->utf8_string = XInternAtom(xpbproxy_dpy, "UTF8_STRING", False);
+ atoms->string = XInternAtom(xpbproxy_dpy, "STRING", False);
+ atoms->targets = XInternAtom(xpbproxy_dpy, "TARGETS", False);
+ atoms->multiple = XInternAtom(xpbproxy_dpy, "MULTIPLE", False);
+ atoms->cstring = XInternAtom(xpbproxy_dpy, "CSTRING", False);
+ atoms->image_png = XInternAtom(xpbproxy_dpy, "image/png", False);
+ atoms->image_jpeg = XInternAtom(xpbproxy_dpy, "image/jpeg", False);
+ atoms->incr = XInternAtom(xpbproxy_dpy, "INCR", False);
+ atoms->atom = XInternAtom(xpbproxy_dpy, "ATOM", False);
+ atoms->clipboard_manager =
+ XInternAtom(xpbproxy_dpy, "CLIPBOARD_MANAGER", False);
+ atoms->compound_text = XInternAtom(xpbproxy_dpy, "COMPOUND_TEXT", False);
+ atoms->atom_pair = XInternAtom(xpbproxy_dpy, "ATOM_PAIR", False);
+
+ pixel = BlackPixel(xpbproxy_dpy, DefaultScreen(xpbproxy_dpy));
+ _selection_window =
+ XCreateSimpleWindow(xpbproxy_dpy, DefaultRootWindow(xpbproxy_dpy), 0, 0,
+ 1, 1, 0, pixel, pixel);
/* This is used to get PropertyNotify events when doing INCR transfers. */
- XSelectInput (xpbproxy_dpy, _selection_window, PropertyChangeMask);
+ XSelectInput(xpbproxy_dpy, _selection_window, PropertyChangeMask);
request_atom = None;
- init_propdata (&pending.propdata);
+ init_propdata(&pending.propdata);
pending.requestor = None;
pending.selection = None;
pending_copy = 0;
pending_clipboard = 0;
- if(xpbproxy_have_xfixes)
- XFixesSelectSelectionInput(xpbproxy_dpy, _selection_window, atoms->primary,
+ if (xpbproxy_have_xfixes)
+ XFixesSelectSelectionInput(xpbproxy_dpy, _selection_window,
+ atoms->primary,
XFixesSetSelectionOwnerNotifyMask);
[self reload_preferences];
-
+
return self;
}
-- (void) dealloc
-{
- if (None != _selection_window)
- {
- XDestroyWindow (xpbproxy_dpy, _selection_window);
- _selection_window = None;
+-(void) dealloc {
+ if (None != _selection_window) {
+ XDestroyWindow(xpbproxy_dpy, _selection_window);
+ _selection_window = None;
}
- free_propdata (&pending.propdata);
+ free_propdata(&pending.propdata);
[super dealloc];
}
diff --git a/xorg-server/hw/xquartz/pseudoramiX.c b/xorg-server/hw/xquartz/pseudoramiX.c
index 5a5b9c2e7..f5375039b 100644
--- a/xorg-server/hw/xquartz/pseudoramiX.c
+++ b/xorg-server/hw/xquartz/pseudoramiX.c
@@ -47,9 +47,9 @@ Equipment Corporation.
Bool noPseudoramiXExtension = FALSE;
-extern int ProcPanoramiXQueryVersion (ClientPtr client);
+extern int ProcPanoramiXQueryVersion(ClientPtr client);
-static void PseudoramiXResetProc(ExtensionEntry *extEntry);
+static void PseudoramiXResetProc(ExtensionEntry * extEntry);
static int ProcPseudoramiXQueryVersion(ClientPtr client);
static int ProcPseudoramiXGetState(ClientPtr client);
@@ -67,7 +67,6 @@ static int SProcPseudoramiXIsActive(ClientPtr client);
static int SProcPseudoramiXQueryScreens(ClientPtr client);
static int SProcPseudoramiXDispatch(ClientPtr client);
-
typedef struct {
int x;
int y;
@@ -80,7 +79,6 @@ static int pseudoramiXScreensAllocated = 0;
static int pseudoramiXNumScreens = 0;
static unsigned long pseudoramiXGeneration = 0;
-
// Add a PseudoramiX screen.
// The rest of the X server will know nothing about this screen.
// Can be called before or after extension init.
@@ -90,13 +88,14 @@ PseudoramiXAddScreen(int x, int y, int w, int h)
{
PseudoramiXScreenRec *s;
- if (noPseudoramiXExtension) return;
+ if (noPseudoramiXExtension)
+ return;
if (pseudoramiXNumScreens == pseudoramiXScreensAllocated) {
pseudoramiXScreensAllocated += pseudoramiXScreensAllocated + 1;
pseudoramiXScreens = realloc(pseudoramiXScreens,
- pseudoramiXScreensAllocated *
- sizeof(PseudoramiXScreenRec));
+ pseudoramiXScreensAllocated *
+ sizeof(PseudoramiXScreenRec));
}
DEBUG_LOG("x: %d, y: %d, w: %d, h: %d\n", x, y, w, h);
@@ -108,15 +107,16 @@ PseudoramiXAddScreen(int x, int y, int w, int h)
s->h = h;
}
-
// Initialize PseudoramiX.
// Copied from PanoramiXExtensionInit
-void PseudoramiXExtensionInit(int argc, char *argv[])
+void
+PseudoramiXExtensionInit(int argc, char *argv[])
{
- Bool success = FALSE;
- ExtensionEntry *extEntry;
+ Bool success = FALSE;
+ ExtensionEntry *extEntry;
- if (noPseudoramiXExtension) return;
+ if (noPseudoramiXExtension)
+ return;
TRACE();
@@ -134,11 +134,11 @@ void PseudoramiXExtensionInit(int argc, char *argv[])
extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
ProcPseudoramiXDispatch,
SProcPseudoramiXDispatch,
- PseudoramiXResetProc,
- StandardMinorOpcode);
+ PseudoramiXResetProc, StandardMinorOpcode);
if (!extEntry) {
ErrorF("PseudoramiXExtensionInit(): AddExtension failed\n");
- } else {
+ }
+ else {
pseudoramiXGeneration = serverGeneration;
success = TRUE;
}
@@ -151,34 +151,34 @@ void PseudoramiXExtensionInit(int argc, char *argv[])
}
}
-
-void PseudoramiXResetScreens(void)
+void
+PseudoramiXResetScreens(void)
{
TRACE();
pseudoramiXNumScreens = 0;
}
-
-static void PseudoramiXResetProc(ExtensionEntry *extEntry)
+static void
+PseudoramiXResetProc(ExtensionEntry * extEntry)
{
TRACE();
PseudoramiXResetScreens();
}
-
// was PanoramiX
-static int ProcPseudoramiXQueryVersion(ClientPtr client)
+static int
+ProcPseudoramiXQueryVersion(ClientPtr client)
{
TRACE();
return ProcPanoramiXQueryVersion(client);
}
-
// was PanoramiX
-static int ProcPseudoramiXGetState(ClientPtr client)
+static int
+ProcPseudoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin;
@@ -186,11 +186,11 @@ static int ProcPseudoramiXGetState(ClientPtr client)
register int rc;
TRACE();
-
+
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
@@ -201,13 +201,13 @@ static int ProcPseudoramiXGetState(ClientPtr client)
swapl(&rep.length);
swaps(&rep.state);
}
- WriteToClient (client, sizeof (xPanoramiXGetStateReply), (char *) &rep);
+ WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *) &rep);
return Success;
}
-
// was PanoramiX
-static int ProcPseudoramiXGetScreenCount(ClientPtr client)
+static int
+ProcPseudoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin;
@@ -215,11 +215,11 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client)
register int rc;
TRACE();
-
+
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
@@ -230,31 +230,31 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client)
swapl(&rep.length);
swaps(&rep.ScreenCount);
}
- WriteToClient (client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
+ WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *) &rep);
return Success;
}
-
// was PanoramiX
-static int ProcPseudoramiXGetScreenSize(ClientPtr client)
+static int
+ProcPseudoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
- WindowPtr pWin;
- xPanoramiXGetScreenSizeReply rep;
- register int n, rc;
+ WindowPtr pWin;
+ xPanoramiXGetScreenSizeReply rep;
+ register int n, rc;
TRACE();
-
+
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
/* screen dimensions */
- rep.width = pseudoramiXScreens[stuff->screen].w;
+ rep.width = pseudoramiXScreens[stuff->screen].w;
// was screenInfo.screens[stuff->screen]->width;
rep.height = pseudoramiXScreens[stuff->screen].h;
// was screenInfo.screens[stuff->screen]->height;
@@ -264,19 +264,19 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client)
swaps(&rep.width);
swaps(&rep.height);
}
- WriteToClient (client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
+ WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep);
return Success;
}
-
// was Xinerama
-static int ProcPseudoramiXIsActive(ClientPtr client)
+static int
+ProcPseudoramiXIsActive(ClientPtr client)
{
/* REQUEST(xXineramaIsActiveReq); */
- xXineramaIsActiveReply rep;
+ xXineramaIsActiveReply rep;
TRACE();
-
+
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
rep.type = X_Reply;
@@ -284,23 +284,24 @@ static int ProcPseudoramiXIsActive(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.state = !noPseudoramiXExtension;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.state);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.state);
}
- WriteToClient (client, sizeof (xXineramaIsActiveReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
return Success;
}
-
// was Xinerama
-static int ProcPseudoramiXQueryScreens(ClientPtr client)
+static int
+ProcPseudoramiXQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
- xXineramaQueryScreensReply rep;
+ xXineramaQueryScreensReply rep;
+
+ DEBUG_LOG("noPseudoramiXExtension=%d, pseudoramiXNumScreens=%d\n",
+ noPseudoramiXExtension, pseudoramiXNumScreens);
- DEBUG_LOG("noPseudoramiXExtension=%d, pseudoramiXNumScreens=%d\n", noPseudoramiXExtension, pseudoramiXNumScreens);
-
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
rep.type = X_Reply;
@@ -308,155 +309,150 @@ static int ProcPseudoramiXQueryScreens(ClientPtr client)
rep.number = noPseudoramiXExtension ? 0 : pseudoramiXNumScreens;
rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.number);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.number);
}
- WriteToClient (client, sizeof (xXineramaQueryScreensReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep);
if (!noPseudoramiXExtension) {
- xXineramaScreenInfo scratch;
- int i;
-
- for(i = 0; i < pseudoramiXNumScreens; i++) {
- scratch.x_org = pseudoramiXScreens[i].x;
- scratch.y_org = pseudoramiXScreens[i].y;
- scratch.width = pseudoramiXScreens[i].w;
- scratch.height = pseudoramiXScreens[i].h;
-
- if(client->swapped) {
- swaps(&scratch.x_org);
- swaps(&scratch.y_org);
- swaps(&scratch.width);
- swaps(&scratch.height);
- }
- WriteToClient (client, sz_XineramaScreenInfo, (char *) &scratch);
- }
+ xXineramaScreenInfo scratch;
+ int i;
+
+ for (i = 0; i < pseudoramiXNumScreens; i++) {
+ scratch.x_org = pseudoramiXScreens[i].x;
+ scratch.y_org = pseudoramiXScreens[i].y;
+ scratch.width = pseudoramiXScreens[i].w;
+ scratch.height = pseudoramiXScreens[i].h;
+
+ if (client->swapped) {
+ swaps(&scratch.x_org);
+ swaps(&scratch.y_org);
+ swaps(&scratch.width);
+ swaps(&scratch.height);
+ }
+ WriteToClient(client, sz_XineramaScreenInfo, (char *) &scratch);
+ }
}
return Success;
}
-
// was PanoramiX
-static int ProcPseudoramiXDispatch (ClientPtr client)
-{ REQUEST(xReq);
+static int
+ProcPseudoramiXDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
TRACE();
- switch (stuff->data)
- {
- case X_PanoramiXQueryVersion:
- return ProcPseudoramiXQueryVersion(client);
- case X_PanoramiXGetState:
- return ProcPseudoramiXGetState(client);
- case X_PanoramiXGetScreenCount:
- return ProcPseudoramiXGetScreenCount(client);
- case X_PanoramiXGetScreenSize:
- return ProcPseudoramiXGetScreenSize(client);
- case X_XineramaIsActive:
- return ProcPseudoramiXIsActive(client);
- case X_XineramaQueryScreens:
- return ProcPseudoramiXQueryScreens(client);
+ switch (stuff->data) {
+ case X_PanoramiXQueryVersion:
+ return ProcPseudoramiXQueryVersion(client);
+ case X_PanoramiXGetState:
+ return ProcPseudoramiXGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return ProcPseudoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return ProcPseudoramiXGetScreenSize(client);
+ case X_XineramaIsActive:
+ return ProcPseudoramiXIsActive(client);
+ case X_XineramaQueryScreens:
+ return ProcPseudoramiXQueryScreens(client);
}
return BadRequest;
}
-
-
static int
-SProcPseudoramiXQueryVersion (ClientPtr client)
+SProcPseudoramiXQueryVersion(ClientPtr client)
{
- REQUEST(xPanoramiXQueryVersionReq);
+ REQUEST(xPanoramiXQueryVersionReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
- return ProcPseudoramiXQueryVersion(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
+ return ProcPseudoramiXQueryVersion(client);
}
static int
SProcPseudoramiXGetState(ClientPtr client)
{
- REQUEST(xPanoramiXGetStateReq);
+ REQUEST(xPanoramiXGetStateReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
- return ProcPseudoramiXGetState(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ return ProcPseudoramiXGetState(client);
}
static int
SProcPseudoramiXGetScreenCount(ClientPtr client)
{
- REQUEST(xPanoramiXGetScreenCountReq);
+ REQUEST(xPanoramiXGetScreenCountReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
- return ProcPseudoramiXGetScreenCount(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ return ProcPseudoramiXGetScreenCount(client);
}
static int
SProcPseudoramiXGetScreenSize(ClientPtr client)
{
- REQUEST(xPanoramiXGetScreenSizeReq);
+ REQUEST(xPanoramiXGetScreenSizeReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
- return ProcPseudoramiXGetScreenSize(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ return ProcPseudoramiXGetScreenSize(client);
}
-
static int
SProcPseudoramiXIsActive(ClientPtr client)
{
- REQUEST(xXineramaIsActiveReq);
+ REQUEST(xXineramaIsActiveReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
- return ProcPseudoramiXIsActive(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+ return ProcPseudoramiXIsActive(client);
}
-
static int
SProcPseudoramiXQueryScreens(ClientPtr client)
{
- REQUEST(xXineramaQueryScreensReq);
+ REQUEST(xXineramaQueryScreensReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
- return ProcPseudoramiXQueryScreens(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+ return ProcPseudoramiXQueryScreens(client);
}
-
static int
-SProcPseudoramiXDispatch (ClientPtr client)
-{ REQUEST(xReq);
+SProcPseudoramiXDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
TRACE();
- switch (stuff->data)
- {
- case X_PanoramiXQueryVersion:
- return SProcPseudoramiXQueryVersion(client);
- case X_PanoramiXGetState:
- return SProcPseudoramiXGetState(client);
- case X_PanoramiXGetScreenCount:
- return SProcPseudoramiXGetScreenCount(client);
- case X_PanoramiXGetScreenSize:
- return SProcPseudoramiXGetScreenSize(client);
- case X_XineramaIsActive:
- return SProcPseudoramiXIsActive(client);
- case X_XineramaQueryScreens:
- return SProcPseudoramiXQueryScreens(client);
+ switch (stuff->data) {
+ case X_PanoramiXQueryVersion:
+ return SProcPseudoramiXQueryVersion(client);
+ case X_PanoramiXGetState:
+ return SProcPseudoramiXGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return SProcPseudoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return SProcPseudoramiXGetScreenSize(client);
+ case X_XineramaIsActive:
+ return SProcPseudoramiXIsActive(client);
+ case X_XineramaQueryScreens:
+ return SProcPseudoramiXQueryScreens(client);
}
return BadRequest;
}
diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c
index c395b42e6..e4578cc3e 100644
--- a/xorg-server/hw/xquartz/quartz.c
+++ b/xorg-server/hw/xquartz/quartz.c
@@ -68,10 +68,10 @@
#include <rootlessCommon.h>
#include <Xplugin.h>
-DevPrivateKeyRec quartzScreenKeyRec;
-int aquaMenuBarHeight = 0;
-QuartzModeProcsPtr quartzProcs = NULL;
-const char *quartzOpenGLBundle = NULL;
+DevPrivateKeyRec quartzScreenKeyRec;
+int aquaMenuBarHeight = 0;
+QuartzModeProcsPtr quartzProcs = NULL;
+const char *quartzOpenGLBundle = NULL;
Bool XQuartzFullscreenDisableHotkeys = TRUE;
Bool XQuartzOptionSendsAlt = FALSE;
@@ -96,9 +96,8 @@ int32_t XQuartzShieldingWindowLevel = 0;
* QuartzAddScreen
* Do mode dependent initialization of each screen for Quartz.
*/
-Bool QuartzAddScreen(
- int index,
- ScreenPtr pScreen)
+Bool
+QuartzAddScreen(int index, ScreenPtr pScreen)
{
// allocate space for private per screen Quartz specific storage
QuartzScreenPtr displayInfo = calloc(sizeof(QuartzScreenRec), 1);
@@ -110,25 +109,23 @@ Bool QuartzAddScreen(
return quartzProcs->AddScreen(index, pScreen);
}
-
/*
* QuartzSetupScreen
* Finalize mode specific setup of each screen.
*/
-Bool QuartzSetupScreen(
- int index,
- ScreenPtr pScreen)
+Bool
+QuartzSetupScreen(int index, ScreenPtr pScreen)
{
// do Quartz mode specific setup
- if (! quartzProcs->SetupScreen(index, pScreen))
+ if (!quartzProcs->SetupScreen(index, pScreen))
return FALSE;
// setup cursor support
- if (! quartzProcs->InitCursor(pScreen))
+ if (!quartzProcs->InitCursor(pScreen))
return FALSE;
#if defined(RANDR)
- if(!QuartzRandRInit(pScreen)) {
+ if (!QuartzRandRInit(pScreen)) {
DEBUG_LOG("Failed to init RandR extension.\n");
return FALSE;
}
@@ -137,14 +134,12 @@ Bool QuartzSetupScreen(
return TRUE;
}
-
/*
* QuartzInitOutput
* Quartz display initialization.
*/
-void QuartzInitOutput(
- int argc,
- char **argv )
+void
+QuartzInitOutput(int argc, char **argv)
{
/* For XQuartz, we want to just use the default signal handler to work better with CrashTracer */
signal(SIGSEGV, SIG_DFL);
@@ -167,27 +162,23 @@ void QuartzInitOutput(
#endif
if (!RegisterBlockAndWakeupHandlers(QuartzBlockHandler,
- QuartzWakeupHandler,
- NULL))
- {
+ QuartzWakeupHandler, NULL)) {
FatalError("Could not register block and wakeup handlers.");
}
if (!dixRegisterPrivateKey(&quartzScreenKeyRec, PRIVATE_SCREEN, 0))
- FatalError("Failed to alloc quartz screen private.\n");
+ FatalError("Failed to alloc quartz screen private.\n");
// Do display mode specific initialization
quartzProcs->DisplayInit();
}
-
/*
* QuartzInitInput
* Inform the main thread the X server is ready to handle events.
*/
-void QuartzInitInput(
- int argc,
- char **argv )
+void
+QuartzInitInput(int argc, char **argv)
{
X11ApplicationSetCanQuit(0);
X11ApplicationServerReady();
@@ -196,44 +187,44 @@ void QuartzInitInput(
quartzProcs->InitInput(argc, argv);
}
-
-void QuartzUpdateScreens(void) {
+void
+QuartzUpdateScreens(void)
+{
ScreenPtr pScreen;
WindowPtr pRoot;
int x, y, width, height, sx, sy;
xEvent e;
BoxRec bounds;
-
- if (noPseudoramiXExtension || screenInfo.numScreens != 1)
- {
+
+ if (noPseudoramiXExtension || screenInfo.numScreens != 1) {
/* FIXME: if not using Xinerama, we have multiple screens, and
- to do this properly may need to add or remove screens. Which
- isn't possible. So don't do anything. Another reason why
- we default to running with Xinerama. */
-
+ to do this properly may need to add or remove screens. Which
+ isn't possible. So don't do anything. Another reason why
+ we default to running with Xinerama. */
+
return;
}
-
+
pScreen = screenInfo.screens[0];
-
+
PseudoramiXResetScreens();
quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height, pScreen);
-
+
pScreen->x = x;
pScreen->y = y;
pScreen->mmWidth = pScreen->mmWidth * ((double) width / pScreen->width);
pScreen->mmHeight = pScreen->mmHeight * ((double) height / pScreen->height);
pScreen->width = width;
pScreen->height = height;
-
+
DarwinAdjustScreenOrigins(&screenInfo);
-
+
/* DarwinAdjustScreenOrigins or UpdateScreen may change pScreen->x/y,
* so use it rather than x/y
*/
sx = pScreen->x + darwinMainScreenX;
sy = pScreen->y + darwinMainScreenY;
-
+
/* Adjust the root window. */
pRoot = pScreen->root;
AppleWMSetScreenOrigin(pRoot);
@@ -250,7 +241,10 @@ void QuartzUpdateScreens(void) {
inputInfo.pointer->spriteInfo->sprite->physLimits = bounds;
inputInfo.pointer->spriteInfo->sprite->hotLimits = bounds;
- DEBUG_LOG("Root Window: %dx%d @ (%d, %d) darwinMainScreen (%d, %d) xy (%d, %d) dixScreenOrigins (%d, %d)\n", width, height, x - sx, y - sy, darwinMainScreenX, darwinMainScreenY, x, y, pScreen->x, pScreen->y);
+ DEBUG_LOG
+ ("Root Window: %dx%d @ (%d, %d) darwinMainScreen (%d, %d) xy (%d, %d) dixScreenOrigins (%d, %d)\n",
+ width, height, x - sx, y - sy, darwinMainScreenX, darwinMainScreenY, x,
+ y, pScreen->x, pScreen->y);
/* Send an event for the root reconfigure */
e.u.u.type = ConfigureNotify;
@@ -267,74 +261,86 @@ void QuartzUpdateScreens(void) {
quartzProcs->UpdateScreen(pScreen);
/* miPaintWindow needs to be called after RootlessUpdateScreenPixmap (from xprUpdateScreen) */
- miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
+ miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
/* Tell RandR about the new size, so new connections get the correct info */
RRScreenSizeNotify(pScreen);
}
-static void pokeActivityCallback(CFRunLoopTimerRef timer, void *info) {
+static void
+pokeActivityCallback(CFRunLoopTimerRef timer, void *info)
+{
UpdateSystemActivity(OverallAct);
}
-static void QuartzScreenSaver(int state) {
+static void
+QuartzScreenSaver(int state)
+{
static CFRunLoopTimerRef pokeActivityTimer = NULL;
- static CFRunLoopTimerContext pokeActivityContext = { 0, NULL, NULL, NULL, NULL };
+ static CFRunLoopTimerContext pokeActivityContext =
+ { 0, NULL, NULL, NULL, NULL };
static OSSpinLock pokeActivitySpinLock = OS_SPINLOCK_INIT;
OSSpinLockLock(&pokeActivitySpinLock);
- if(state) {
- if(pokeActivityTimer == NULL)
+ if (state) {
+ if (pokeActivityTimer == NULL)
goto QuartzScreenSaverEnd;
CFRunLoopTimerInvalidate(pokeActivityTimer);
CFRelease(pokeActivityTimer);
pokeActivityTimer = NULL;
- } else {
- if(pokeActivityTimer != NULL)
+ }
+ else {
+ if (pokeActivityTimer != NULL)
goto QuartzScreenSaverEnd;
-
- pokeActivityTimer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 30, 0, 0, pokeActivityCallback, &pokeActivityContext);
- if(pokeActivityTimer == NULL) {
+
+ pokeActivityTimer =
+ CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 30, 0, 0,
+ pokeActivityCallback, &pokeActivityContext);
+ if (pokeActivityTimer == NULL) {
ErrorF("Unable to create pokeActivityTimer.\n");
goto QuartzScreenSaverEnd;
}
- CFRunLoopAddTimer(CFRunLoopGetMain(), pokeActivityTimer, kCFRunLoopCommonModes);
+ CFRunLoopAddTimer(CFRunLoopGetMain(), pokeActivityTimer,
+ kCFRunLoopCommonModes);
}
-QuartzScreenSaverEnd:
+ QuartzScreenSaverEnd:
OSSpinLockUnlock(&pokeActivitySpinLock);
}
-void QuartzShowFullscreen(int state) {
+void
+QuartzShowFullscreen(int state)
+{
int i;
-
+
DEBUG_LOG("QuartzShowFullscreen: state=%d\n", state);
-
- if(XQuartzIsRootless) {
+
+ if (XQuartzIsRootless) {
ErrorF("QuartzShowFullscreen called while in rootless mode.\n");
return;
}
-
+
QuartzScreenSaver(!state);
-
- if(XQuartzFullscreenVisible == state)
+
+ if (XQuartzFullscreenVisible == state)
return;
-
+
XQuartzFullscreenVisible = state;
-
- xp_disable_update ();
-
+
+ xp_disable_update();
+
if (!XQuartzFullscreenVisible)
RootlessHideAllWindows();
-
+
RootlessUpdateRooted(XQuartzFullscreenVisible);
-
+
if (XQuartzFullscreenVisible) {
- RootlessShowAllWindows ();
- for (i=0; i < screenInfo.numScreens; i++) {
- ScreenPtr pScreen = screenInfo.screens[i];
+ RootlessShowAllWindows();
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
RootlessRepositionWindows(pScreen);
// JH: I don't think this is necessary, but keeping it here as a reminder
//RootlessUpdateScreenPixmap(pScreen);
@@ -345,32 +351,35 @@ void QuartzShowFullscreen(int state) {
* in fullscreen mode, even though it's not visible.
*/
X11ApplicationShowHideMenubar(!XQuartzFullscreenVisible);
-
- xp_reenable_update ();
-
+
+ xp_reenable_update();
+
if (XQuartzFullscreenDisableHotkeys)
xp_disable_hot_keys(XQuartzFullscreenVisible);
}
-void QuartzSetRootless(Bool state) {
+void
+QuartzSetRootless(Bool state)
+{
DEBUG_LOG("QuartzSetRootless state=%d\n", state);
-
- if(XQuartzIsRootless == state)
+
+ if (XQuartzIsRootless == state)
return;
-
- if(state)
+
+ if (state)
QuartzShowFullscreen(FALSE);
-
+
XQuartzIsRootless = state;
xp_disable_update();
- /* When in rootless, the menubar is not part of the screen, so we need to update our screens on toggle */
+ /* When in rootless, the menubar is not part of the screen, so we need to update our screens on toggle */
QuartzUpdateScreens();
- if(XQuartzIsRootless) {
+ if (XQuartzIsRootless) {
RootlessShowAllWindows();
- } else {
+ }
+ else {
RootlessHideAllWindows();
}
@@ -387,31 +396,33 @@ void QuartzSetRootless(Bool state) {
* Calls mode specific screen resume to restore the X clip regions
* (if needed) and the X server cursor state.
*/
-void QuartzShow(void) {
+void
+QuartzShow(void)
+{
int i;
if (XQuartzServerVisible)
return;
-
+
XQuartzServerVisible = TRUE;
for (i = 0; i < screenInfo.numScreens; i++) {
if (screenInfo.screens[i]) {
quartzProcs->ResumeScreen(screenInfo.screens[i]);
}
}
-
+
if (!XQuartzIsRootless)
QuartzShowFullscreen(TRUE);
}
-
/*
* QuartzHide
* Remove the X server display from the screen. Does nothing if already
* hidden. Calls mode specific screen suspend to set X clip regions to
* prevent drawing (if needed) and restore the Aqua cursor.
*/
-void QuartzHide(void)
+void
+QuartzHide(void)
{
int i;
@@ -423,18 +434,17 @@ void QuartzHide(void)
}
}
- if(!XQuartzIsRootless)
+ if (!XQuartzIsRootless)
QuartzShowFullscreen(FALSE);
XQuartzServerVisible = FALSE;
}
-
/*
* QuartzSetRootClip
* Enable or disable rendering to the X screen.
*/
-void QuartzSetRootClip(
- BOOL enable)
+void
+QuartzSetRootClip(BOOL enable)
{
int i;
@@ -452,7 +462,9 @@ void QuartzSetRootClip(
* QuartzSpaceChanged
* Unmap offscreen windows, map onscreen windows
*/
-void QuartzSpaceChanged(uint32_t space_id) {
+void
+QuartzSpaceChanged(uint32_t space_id)
+{
/* Do something special here, so we don't depend on quartz-wm for spaces to work... */
DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", space_id);
}
@@ -462,26 +474,30 @@ void QuartzSpaceChanged(uint32_t space_id) {
* Associate an X11 screen with one or more CoreGraphics display IDs by copying
* the list into a private array. Free the previously copied array, if present.
*/
-void QuartzCopyDisplayIDs(ScreenPtr pScreen,
- int displayCount, CGDirectDisplayID *displayIDs) {
+void
+QuartzCopyDisplayIDs(ScreenPtr pScreen,
+ int displayCount, CGDirectDisplayID * displayIDs)
+{
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
free(pQuartzScreen->displayIDs);
- if(displayCount) {
+ if (displayCount) {
size_t size = displayCount * sizeof(CGDirectDisplayID);
+
pQuartzScreen->displayIDs = malloc(size);
memcpy(pQuartzScreen->displayIDs, displayIDs, size);
- } else {
- pQuartzScreen->displayIDs = NULL;
+ }
+ else {
+ pQuartzScreen->displayIDs = NULL;
}
pQuartzScreen->displayCount = displayCount;
}
void NSBeep(void);
-void DDXRingBell(
- int volume, // volume is % of max
- int pitch, // pitch is Hz
- int duration) // duration is milliseconds
+void
+DDXRingBell(int volume, // volume is % of max
+ int pitch, // pitch is Hz
+ int duration) // duration is milliseconds
{
if (volume)
NSBeep();
diff --git a/xorg-server/hw/xquartz/quartzCocoa.m b/xorg-server/hw/xquartz/quartzCocoa.m
index d1087015b..c0401b5e1 100644
--- a/xorg-server/hw/xquartz/quartzCocoa.m
+++ b/xorg-server/hw/xquartz/quartzCocoa.m
@@ -1,71 +1,66 @@
-/**************************************************************
- *
- * Quartz-specific support for the Darwin X Server
- * that requires Cocoa and Objective-C.
- *
- * This file is separate from the parts of Quartz support
- * that use X include files to avoid symbol collisions.
- *
- * Copyright (c) 2001-2004 Torrey T. Lyons and Greg Parker.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#include "sanitizedCocoa.h"
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "quartzCommon.h"
-#include "inputstr.h"
-
-#include "darwin.h"
-
-/*
- * QuartzBlockHandler
- * Clean out any autoreleased objects.
- */
-void QuartzBlockHandler(
- pointer blockData,
- OSTimePtr pTimeout,
- pointer pReadmask)
-{
- static NSAutoreleasePool *aPool = nil;
-
- [aPool release];
- aPool = [[NSAutoreleasePool alloc] init];
-}
-
-
-/*
- * QuartzWakeupHandler
- */
-void QuartzWakeupHandler(
- pointer blockData,
- int result,
- pointer pReadmask)
-{
- // nothing here
-}
+/**************************************************************
+ *
+ * Quartz-specific support for the Darwin X Server
+ * that requires Cocoa and Objective-C.
+ *
+ * This file is separate from the parts of Quartz support
+ * that use X include files to avoid symbol collisions.
+ *
+ * Copyright (c) 2001-2004 Torrey T. Lyons and Greg Parker.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#include "sanitizedCocoa.h"
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+#include "inputstr.h"
+
+#include "darwin.h"
+
+/*
+ * QuartzBlockHandler
+ * Clean out any autoreleased objects.
+ */
+void
+QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+{
+ static NSAutoreleasePool *aPool = nil;
+
+ [aPool release];
+ aPool =[[NSAutoreleasePool alloc] init];
+}
+
+/*
+ * QuartzWakeupHandler
+ */
+void
+QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask)
+{
+ // nothing here
+}
diff --git a/xorg-server/hw/xquartz/quartzCommon.h b/xorg-server/hw/xquartz/quartzCommon.h
index ac089ac71..e12e1d25c 100644
--- a/xorg-server/hw/xquartz/quartzCommon.h
+++ b/xorg-server/hw/xquartz/quartzCommon.h
@@ -1,52 +1,54 @@
-/*
- * quartzCommon.h
- *
- * Common definitions used internally by all Quartz modes
- *
- * This file should be included before any X11 or IOKit headers
- * so that it can avoid symbol conflicts.
- *
- * Copyright (c) 2001-2004 Torrey T. Lyons and Greg Parker.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifndef _QUARTZCOMMON_H
-#define _QUARTZCOMMON_H
-
-#include <X11/Xdefs.h>
-#include "privates.h"
-
-// Other shared data
-extern DevPrivateKeyRec quartzScreenKeyRec;
-#define quartzScreenKey (&quartzScreenKeyRec)
-extern int aquaMenuBarHeight;
-
-// Name of GLX bundle for native OpenGL
-extern const char *quartzOpenGLBundle;
-
-void QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask);
-void QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask);
-
-#endif /* _QUARTZCOMMON_H */
+/*
+ * quartzCommon.h
+ *
+ * Common definitions used internally by all Quartz modes
+ *
+ * This file should be included before any X11 or IOKit headers
+ * so that it can avoid symbol conflicts.
+ *
+ * Copyright (c) 2001-2004 Torrey T. Lyons and Greg Parker.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef _QUARTZCOMMON_H
+#define _QUARTZCOMMON_H
+
+#include <X11/Xdefs.h>
+#include "privates.h"
+
+// Other shared data
+extern DevPrivateKeyRec quartzScreenKeyRec;
+
+#define quartzScreenKey (&quartzScreenKeyRec)
+extern int aquaMenuBarHeight;
+
+// Name of GLX bundle for native OpenGL
+extern const char *quartzOpenGLBundle;
+
+void QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout,
+ pointer pReadmask);
+void QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask);
+
+#endif /* _QUARTZCOMMON_H */
diff --git a/xorg-server/hw/xquartz/quartzKeyboard.c b/xorg-server/hw/xquartz/quartzKeyboard.c
index e682f08b6..e7aadbcf5 100644
--- a/xorg-server/hw/xquartz/quartzKeyboard.c
+++ b/xorg-server/hw/xquartz/quartzKeyboard.c
@@ -65,7 +65,7 @@
#include "keysym2ucs.h"
extern void
-CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
+ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
enum {
MOD_COMMAND = 256,
@@ -84,33 +84,31 @@ const static struct {
unsigned short keycode;
KeySym keysym;
} known_keys[] = {
- {55, XK_Meta_L},
- {56, XK_Shift_L},
- {57, XK_Caps_Lock},
- {58, XK_Alt_L},
- {59, XK_Control_L},
-
- {60, XK_Shift_R},
- {61, XK_Alt_R},
- {62, XK_Control_R},
- {63, XK_Meta_R},
-
- {122, XK_F1},
- {120, XK_F2},
- {99, XK_F3},
- {118, XK_F4},
- {96, XK_F5},
- {97, XK_F6},
- {98, XK_F7},
- {100, XK_F8},
- {101, XK_F9},
- {109, XK_F10},
- {103, XK_F11},
- {111, XK_F12},
- {105, XK_F13},
- {107, XK_F14},
- {113, XK_F15},
-};
+ {
+ 55, XK_Meta_L}, {
+ 56, XK_Shift_L}, {
+ 57, XK_Caps_Lock}, {
+ 58, XK_Alt_L}, {
+ 59, XK_Control_L}, {
+ 60, XK_Shift_R}, {
+ 61, XK_Alt_R}, {
+ 62, XK_Control_R}, {
+ 63, XK_Meta_R}, {
+ 122, XK_F1}, {
+ 120, XK_F2}, {
+ 99, XK_F3}, {
+ 118, XK_F4}, {
+ 96, XK_F5}, {
+ 97, XK_F6}, {
+ 98, XK_F7}, {
+ 100, XK_F8}, {
+ 101, XK_F9}, {
+ 109, XK_F10}, {
+ 103, XK_F11}, {
+ 111, XK_F12}, {
+ 105, XK_F13}, {
+ 107, XK_F14}, {
+113, XK_F15},};
#endif
#if HACK_KEYPAD
@@ -121,24 +119,24 @@ const static struct {
unsigned short keycode;
KeySym normal, keypad;
} known_numeric_keys[] = {
- {65, XK_period, XK_KP_Decimal},
- {67, XK_asterisk, XK_KP_Multiply},
- {69, XK_plus, XK_KP_Add},
- {75, XK_slash, XK_KP_Divide},
- {76, 0x01000003, XK_KP_Enter},
- {78, XK_minus, XK_KP_Subtract},
- {81, XK_equal, XK_KP_Equal},
- {82, XK_0, XK_KP_0},
- {83, XK_1, XK_KP_1},
- {84, XK_2, XK_KP_2},
- {85, XK_3, XK_KP_3},
- {86, XK_4, XK_KP_4},
- {87, XK_5, XK_KP_5},
- {88, XK_6, XK_KP_6},
- {89, XK_7, XK_KP_7},
- {91, XK_8, XK_KP_8},
- {92, XK_9, XK_KP_9},
-};
+ {
+ 65, XK_period, XK_KP_Decimal}, {
+ 67, XK_asterisk, XK_KP_Multiply}, {
+ 69, XK_plus, XK_KP_Add}, {
+ 75, XK_slash, XK_KP_Divide}, {
+ 76, 0x01000003, XK_KP_Enter}, {
+ 78, XK_minus, XK_KP_Subtract}, {
+ 81, XK_equal, XK_KP_Equal}, {
+ 82, XK_0, XK_KP_0}, {
+ 83, XK_1, XK_KP_1}, {
+ 84, XK_2, XK_KP_2}, {
+ 85, XK_3, XK_KP_3}, {
+ 86, XK_4, XK_KP_4}, {
+ 87, XK_5, XK_KP_5}, {
+ 88, XK_6, XK_KP_6}, {
+ 89, XK_7, XK_KP_7}, {
+ 91, XK_8, XK_KP_8}, {
+92, XK_9, XK_KP_9},};
#endif
#if HACK_BLACKLIST
@@ -148,7 +146,7 @@ const static struct {
*
* legacy Mac keycodes for arrow keys that shift-modify to math symbols
*/
-const static unsigned short keycode_blacklist[] = {66, 70, 72, 77};
+const static unsigned short keycode_blacklist[] = { 66, 70, 72, 77 };
#endif
/* Table mapping normal keysyms to their dead equivalents.
@@ -157,30 +155,40 @@ const static unsigned short keycode_blacklist[] = {66, 70, 72, 77};
const static struct {
KeySym normal, dead;
} dead_keys[] = {
- {XK_grave, XK_dead_grave},
- {XK_apostrophe, XK_dead_acute}, /* US:"=" on a Czech keyboard */
- {XK_acute, XK_dead_acute},
- {UKEYSYM (0x384), XK_dead_acute}, /* US:";" on a Greek keyboard */
+ {
+ XK_grave, XK_dead_grave}, {
+ XK_apostrophe, XK_dead_acute}, /* US:"=" on a Czech keyboard */
+ {
+ XK_acute, XK_dead_acute}, {
+ UKEYSYM(0x384), XK_dead_acute}, /* US:";" on a Greek keyboard */
// {XK_Greek_accentdieresis, XK_dead_diaeresis}, /* US:"opt+;" on a Greek keyboard ... replace with dead_accentdieresis if there is one */
- {XK_asciicircum, XK_dead_circumflex},
- {UKEYSYM (0x2c6), XK_dead_circumflex}, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
- {XK_asciitilde, XK_dead_tilde},
- {UKEYSYM (0x2dc), XK_dead_tilde}, /* SMALL TILDE */
- {XK_macron, XK_dead_macron},
- {XK_breve, XK_dead_breve},
- {XK_abovedot, XK_dead_abovedot},
- {XK_diaeresis, XK_dead_diaeresis},
- {UKEYSYM (0x2da), XK_dead_abovering}, /* DOT ABOVE */
- {XK_doubleacute, XK_dead_doubleacute},
- {XK_caron, XK_dead_caron},
- {XK_cedilla, XK_dead_cedilla},
- {XK_ogonek, XK_dead_ogonek},
- {UKEYSYM (0x269), XK_dead_iota}, /* LATIN SMALL LETTER IOTA */
- {UKEYSYM (0x2ec), XK_dead_voiced_sound}, /* MODIFIER LETTER VOICING */
+ {
+ XK_asciicircum, XK_dead_circumflex}, {
+ UKEYSYM(0x2c6), XK_dead_circumflex}, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
+ {
+ XK_asciitilde, XK_dead_tilde}, {
+ UKEYSYM(0x2dc), XK_dead_tilde}, /* SMALL TILDE */
+ {
+ XK_macron, XK_dead_macron}, {
+ XK_breve, XK_dead_breve}, {
+ XK_abovedot, XK_dead_abovedot}, {
+ XK_diaeresis, XK_dead_diaeresis}, {
+ UKEYSYM(0x2da), XK_dead_abovering}, /* DOT ABOVE */
+ {
+ XK_doubleacute, XK_dead_doubleacute}, {
+ XK_caron, XK_dead_caron}, {
+ XK_cedilla, XK_dead_cedilla}, {
+ XK_ogonek, XK_dead_ogonek}, {
+ UKEYSYM(0x269), XK_dead_iota}, /* LATIN SMALL LETTER IOTA */
+ {
+ UKEYSYM(0x2ec), XK_dead_voiced_sound}, /* MODIFIER LETTER VOICING */
/* {XK_semivoiced_sound, XK_dead_semivoiced_sound}, */
- {UKEYSYM (0x323), XK_dead_belowdot}, /* COMBINING DOT BELOW */
- {UKEYSYM (0x309), XK_dead_hook}, /* COMBINING HOOK ABOVE */
- {UKEYSYM (0x31b), XK_dead_horn}, /* COMBINING HORN */
+ {
+ UKEYSYM(0x323), XK_dead_belowdot}, /* COMBINING DOT BELOW */
+ {
+ UKEYSYM(0x309), XK_dead_hook}, /* COMBINING HOOK ABOVE */
+ {
+ UKEYSYM(0x31b), XK_dead_horn}, /* COMBINING HORN */
};
typedef struct darwinKeyboardInfo_struct {
@@ -192,7 +200,9 @@ typedef struct darwinKeyboardInfo_struct {
darwinKeyboardInfo keyInfo;
pthread_mutex_t keyInfo_mutex = PTHREAD_MUTEX_INITIALIZER;
-static void DarwinChangeKeyboardControl(DeviceIntPtr device, KeybdCtrl *ctrl) {
+static void
+DarwinChangeKeyboardControl(DeviceIntPtr device, KeybdCtrl * ctrl)
+{
// FIXME: to be implemented
// keyclick, bell volume / pitch, autorepead, LED's
}
@@ -206,7 +216,9 @@ static void DarwinChangeKeyboardControl(DeviceIntPtr device, KeybdCtrl *ctrl) {
* Use the keyMap field of keyboard info structure to populate
* the modMap and modifierKeycodes fields.
*/
-static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
+static void
+DarwinBuildModifierMaps(darwinKeyboardInfo * info)
+{
int i;
KeySym *k;
@@ -217,83 +229,84 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
k = info->keyMap + i * GLYPHS_PER_KEY;
switch (*k) {
- case XK_Shift_L:
- info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
- info->modMap[MIN_KEYCODE + i] = ShiftMask;
- break;
+ case XK_Shift_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
+ info->modMap[MIN_KEYCODE + i] = ShiftMask;
+ break;
- case XK_Shift_R:
+ case XK_Shift_R:
#ifdef NX_MODIFIERKEY_RSHIFT
- info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i;
+ info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i;
#else
- info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
+ info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
#endif
- info->modMap[MIN_KEYCODE + i] = ShiftMask;
- break;
+ info->modMap[MIN_KEYCODE + i] = ShiftMask;
+ break;
- case XK_Control_L:
- info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
- info->modMap[MIN_KEYCODE + i] = ControlMask;
- break;
+ case XK_Control_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
+ info->modMap[MIN_KEYCODE + i] = ControlMask;
+ break;
- case XK_Control_R:
+ case XK_Control_R:
#ifdef NX_MODIFIERKEY_RCONTROL
- info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i;
+ info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i;
#else
- info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
+ info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
#endif
- info->modMap[MIN_KEYCODE + i] = ControlMask;
- break;
+ info->modMap[MIN_KEYCODE + i] = ControlMask;
+ break;
- case XK_Caps_Lock:
- info->modifierKeycodes[NX_MODIFIERKEY_ALPHALOCK][0] = i;
- info->modMap[MIN_KEYCODE + i] = LockMask;
- break;
+ case XK_Caps_Lock:
+ info->modifierKeycodes[NX_MODIFIERKEY_ALPHALOCK][0] = i;
+ info->modMap[MIN_KEYCODE + i] = LockMask;
+ break;
- case XK_Alt_L:
- info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
- info->modMap[MIN_KEYCODE + i] = Mod1Mask;
- if(!XQuartzOptionSendsAlt)
- *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
- break;
+ case XK_Alt_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ if (!XQuartzOptionSendsAlt)
+ *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
+ break;
- case XK_Alt_R:
+ case XK_Alt_R:
#ifdef NX_MODIFIERKEY_RALTERNATE
- info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
+ info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
#else
- info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+ info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
#endif
- if(!XQuartzOptionSendsAlt)
- *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
- info->modMap[MIN_KEYCODE + i] = Mod1Mask;
- break;
+ if (!XQuartzOptionSendsAlt)
+ *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ break;
- case XK_Mode_switch:
- ErrorF("DarwinBuildModifierMaps: XK_Mode_switch encountered, unable to determine side.\n");
- info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+ case XK_Mode_switch:
+ ErrorF
+ ("DarwinBuildModifierMaps: XK_Mode_switch encountered, unable to determine side.\n");
+ info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
#ifdef NX_MODIFIERKEY_RALTERNATE
- info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
+ info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
#endif
- info->modMap[MIN_KEYCODE + i] = Mod1Mask;
- break;
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ break;
- case XK_Meta_L:
- info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
- info->modMap[MIN_KEYCODE + i] = Mod2Mask;
- break;
+ case XK_Meta_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
+ info->modMap[MIN_KEYCODE + i] = Mod2Mask;
+ break;
- case XK_Meta_R:
+ case XK_Meta_R:
#ifdef NX_MODIFIERKEY_RCOMMAND
- info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i;
+ info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i;
#else
- info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
+ info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
#endif
- info->modMap[MIN_KEYCODE + i] = Mod2Mask;
- break;
+ info->modMap[MIN_KEYCODE + i] = Mod2Mask;
+ break;
- case XK_Num_Lock:
- info->modMap[MIN_KEYCODE + i] = Mod3Mask;
- break;
+ case XK_Num_Lock:
+ info->modMap[MIN_KEYCODE + i] = Mod3Mask;
+ break;
}
}
}
@@ -304,7 +317,9 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
* X keyboard map and modifier map. Set the new keyboard
* device structure.
*/
-void DarwinKeyboardInit(DeviceIntPtr pDev) {
+void
+DarwinKeyboardInit(DeviceIntPtr pDev)
+{
// Open a shared connection to the HID System.
// Note that the Event Status Driver is really just a wrapper
// for a kIOHIDParamConnectType connection.
@@ -320,46 +335,51 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
/* Set the repeat rates based on global preferences and keycodes for modifiers.
* Precondition: Has the keyInfo_mutex lock.
*/
-static void DarwinKeyboardSetRepeat(DeviceIntPtr pDev, int initialKeyRepeatValue, int keyRepeatValue) {
- if(initialKeyRepeatValue == 300000) { // off
+static void
+DarwinKeyboardSetRepeat(DeviceIntPtr pDev, int initialKeyRepeatValue,
+ int keyRepeatValue)
+{
+ if (initialKeyRepeatValue == 300000) { // off
/* Turn off repeats globally */
XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOff);
- } else {
+ }
+ else {
int i;
- XkbControlsPtr ctrl;
- XkbControlsRec old;
+ XkbControlsPtr ctrl;
+ XkbControlsRec old;
/* Turn on repeats globally */
XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOn);
-
+
/* Setup the bit mask for individual key repeats */
ctrl = pDev->key->xkbInfo->desc->ctrls;
- old= *ctrl;
-
+ old = *ctrl;
+
ctrl->repeat_delay = initialKeyRepeatValue * 15;
ctrl->repeat_interval = keyRepeatValue * 15;
/* Turn off key-repeat for modifier keys, on for others */
/* First set them all on */
- for(i=0; i < XkbPerKeyBitArraySize; i++)
+ for (i = 0; i < XkbPerKeyBitArraySize; i++)
ctrl->per_key_repeat[i] = -1;
/* Now turn off the modifiers */
- for(i=0; i < 32; i++) {
+ for (i = 0; i < 32; i++) {
unsigned char keycode;
-
+
keycode = keyInfo.modifierKeycodes[i][0];
- if(keycode)
+ if (keycode)
ClearBit(ctrl->per_key_repeat, keycode + MIN_KEYCODE);
keycode = keyInfo.modifierKeycodes[i][1];
- if(keycode)
+ if (keycode)
ClearBit(ctrl->per_key_repeat, keycode + MIN_KEYCODE);
}
/* Hurray for data duplication */
if (pDev->kbdfeed)
- memcpy(pDev->kbdfeed->ctrl.autoRepeats, ctrl->per_key_repeat, XkbPerKeyBitArraySize);
+ memcpy(pDev->kbdfeed->ctrl.autoRepeats, ctrl->per_key_repeat,
+ XkbPerKeyBitArraySize);
//ErrorF("per_key_repeat =\n");
//for(i=0; i < XkbPerKeyBitArraySize; i++)
@@ -370,7 +390,9 @@ static void DarwinKeyboardSetRepeat(DeviceIntPtr pDev, int initialKeyRepeatValue
}
}
-void DarwinKeyboardReloadHandler(void) {
+void
+DarwinKeyboardReloadHandler(void)
+{
KeySymsRec keySyms;
CFIndex initialKeyRepeatValue, keyRepeatValue;
BOOL ok;
@@ -383,62 +405,78 @@ void DarwinKeyboardReloadHandler(void) {
DEBUG_LOG("DarwinKeyboardReloadHandler\n");
/* Get our key repeat settings from GlobalPreferences */
- (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences"));
-
- initialKeyRepeatValue = CFPreferencesGetAppIntegerValue(CFSTR("InitialKeyRepeat"), CFSTR(".GlobalPreferences"), &ok);
- if(!ok)
+ (void) CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences"));
+
+ initialKeyRepeatValue =
+ CFPreferencesGetAppIntegerValue(CFSTR("InitialKeyRepeat"),
+ CFSTR(".GlobalPreferences"), &ok);
+ if (!ok)
initialKeyRepeatValue = 35;
-
- keyRepeatValue = CFPreferencesGetAppIntegerValue(CFSTR("KeyRepeat"), CFSTR(".GlobalPreferences"), &ok);
- if(!ok)
+
+ keyRepeatValue =
+ CFPreferencesGetAppIntegerValue(CFSTR("KeyRepeat"),
+ CFSTR(".GlobalPreferences"), &ok);
+ if (!ok)
keyRepeatValue = 6;
-
+
pthread_mutex_lock(&keyInfo_mutex); {
/* Initialize our keySyms */
keySyms.map = keyInfo.keyMap;
- keySyms.mapWidth = GLYPHS_PER_KEY;
+ keySyms.mapWidth = GLYPHS_PER_KEY;
keySyms.minKeyCode = MIN_KEYCODE;
keySyms.maxKeyCode = MAX_KEYCODE;
- // TODO: We should build the entire XkbDescRec and use XkbCopyKeymap
+ // TODO: We should build the entire XkbDescRec and use XkbCopyKeymap
/* Apply the mappings to darwinKeyboard */
XkbApplyMappingChange(darwinKeyboard, &keySyms, keySyms.minKeyCode,
keySyms.maxKeyCode - keySyms.minKeyCode + 1,
keyInfo.modMap, serverClient);
- DarwinKeyboardSetRepeat(darwinKeyboard, initialKeyRepeatValue, keyRepeatValue);
+ DarwinKeyboardSetRepeat(darwinKeyboard, initialKeyRepeatValue,
+ keyRepeatValue);
/* Apply the mappings to the core keyboard */
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
XkbApplyMappingChange(pDev, &keySyms, keySyms.minKeyCode,
- keySyms.maxKeyCode - keySyms.minKeyCode + 1,
- keyInfo.modMap, serverClient);
- DarwinKeyboardSetRepeat(pDev, initialKeyRepeatValue, keyRepeatValue);
+ keySyms.maxKeyCode - keySyms.minKeyCode +
+ 1, keyInfo.modMap, serverClient);
+ DarwinKeyboardSetRepeat(pDev, initialKeyRepeatValue,
+ keyRepeatValue);
}
}
- } pthread_mutex_unlock(&keyInfo_mutex);
+ }
+ pthread_mutex_unlock(&keyInfo_mutex);
/* Modify with xmodmap */
if (access(xmodmap, F_OK) == 0) {
/* Check for system .Xmodmap */
if (access(sysmodmap, F_OK) == 0) {
- if(snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, sysmodmap) < sizeof(cmd)) {
+ if (snprintf(cmd, sizeof(cmd), "%s %s", xmodmap, sysmodmap) <
+ sizeof(cmd)) {
X11ApplicationLaunchClient(cmd);
- } else {
- ErrorF("X11.app: Unable to create / execute xmodmap command line");
+ }
+ else {
+ ErrorF
+ ("X11.app: Unable to create / execute xmodmap command line");
}
}
/* Check for user's local .Xmodmap */
- if ((homedir != NULL) && (snprintf (usermodmap, sizeof(usermodmap), "%s/.Xmodmap", homedir) < sizeof(usermodmap))) {
+ if ((homedir != NULL) &&
+ (snprintf(usermodmap, sizeof(usermodmap), "%s/.Xmodmap", homedir) <
+ sizeof(usermodmap))) {
if (access(usermodmap, F_OK) == 0) {
- if(snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, usermodmap) < sizeof(cmd)) {
+ if (snprintf(cmd, sizeof(cmd), "%s %s", xmodmap, usermodmap) <
+ sizeof(cmd)) {
X11ApplicationLaunchClient(cmd);
- } else {
- ErrorF("X11.app: Unable to create / execute xmodmap command line");
+ }
+ else {
+ ErrorF
+ ("X11.app: Unable to create / execute xmodmap command line");
}
}
- } else {
+ }
+ else {
ErrorF("X11.app: Unable to determine path to user's .Xmodmap");
}
}
@@ -460,8 +498,11 @@ void DarwinKeyboardReloadHandler(void) {
* side = 0 for left or 1 for right.
* Returns 0 if key+side is not a known modifier.
*/
-int DarwinModifierNXKeyToNXKeycode(int key, int side) {
+int
+DarwinModifierNXKeyToNXKeycode(int key, int side)
+{
int retval;
+
pthread_mutex_lock(&keyInfo_mutex);
retval = keyInfo.modifierKeycodes[key][side];
pthread_mutex_unlock(&keyInfo_mutex);
@@ -474,7 +515,9 @@ int DarwinModifierNXKeyToNXKeycode(int key, int side) {
* Returns -1 if keycode+side is not a modifier key
* outSide may be NULL, else it gets 0 for left and 1 for right.
*/
-int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) {
+int
+DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide)
+{
int key, side;
keycode += MIN_KEYCODE;
@@ -483,7 +526,8 @@ int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) {
pthread_mutex_lock(&keyInfo_mutex);
for (key = 0; key < NX_NUMMODIFIERS; key++) {
for (side = 0; side <= 1; side++) {
- if (keyInfo.modifierKeycodes[key][side] == keycode) break;
+ if (keyInfo.modifierKeycodes[key][side] == keycode)
+ break;
}
}
pthread_mutex_unlock(&keyInfo_mutex);
@@ -491,7 +535,8 @@ int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) {
if (key == NX_NUMMODIFIERS) {
return -1;
}
- if (outSide) *outSide = side;
+ if (outSide)
+ *outSide = side;
return key;
}
@@ -500,32 +545,50 @@ int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) {
* DarwinModifierNXMaskToNXKey
* Returns -1 if mask is not a known modifier mask.
*/
-int DarwinModifierNXMaskToNXKey(int mask) {
+int
+DarwinModifierNXMaskToNXKey(int mask)
+{
switch (mask) {
- case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK;
- case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT;
+ case NX_ALPHASHIFTMASK:
+ return NX_MODIFIERKEY_ALPHALOCK;
+ case NX_SHIFTMASK:
+ return NX_MODIFIERKEY_SHIFT;
#ifdef NX_DEVICELSHIFTKEYMASK
- case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT;
- case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT;
+ case NX_DEVICELSHIFTKEYMASK:
+ return NX_MODIFIERKEY_SHIFT;
+ case NX_DEVICERSHIFTKEYMASK:
+ return NX_MODIFIERKEY_RSHIFT;
#endif
- case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL;
+ case NX_CONTROLMASK:
+ return NX_MODIFIERKEY_CONTROL;
#ifdef NX_DEVICELCTLKEYMASK
- case NX_DEVICELCTLKEYMASK: return NX_MODIFIERKEY_CONTROL;
- case NX_DEVICERCTLKEYMASK: return NX_MODIFIERKEY_RCONTROL;
+ case NX_DEVICELCTLKEYMASK:
+ return NX_MODIFIERKEY_CONTROL;
+ case NX_DEVICERCTLKEYMASK:
+ return NX_MODIFIERKEY_RCONTROL;
#endif
- case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE;
+ case NX_ALTERNATEMASK:
+ return NX_MODIFIERKEY_ALTERNATE;
#ifdef NX_DEVICELALTKEYMASK
- case NX_DEVICELALTKEYMASK: return NX_MODIFIERKEY_ALTERNATE;
- case NX_DEVICERALTKEYMASK: return NX_MODIFIERKEY_RALTERNATE;
+ case NX_DEVICELALTKEYMASK:
+ return NX_MODIFIERKEY_ALTERNATE;
+ case NX_DEVICERALTKEYMASK:
+ return NX_MODIFIERKEY_RALTERNATE;
#endif
- case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND;
+ case NX_COMMANDMASK:
+ return NX_MODIFIERKEY_COMMAND;
#ifdef NX_DEVICELCMDKEYMASK
- case NX_DEVICELCMDKEYMASK: return NX_MODIFIERKEY_COMMAND;
- case NX_DEVICERCMDKEYMASK: return NX_MODIFIERKEY_RCOMMAND;
-#endif
- case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD;
- case NX_HELPMASK: return NX_MODIFIERKEY_HELP;
- case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN;
+ case NX_DEVICELCMDKEYMASK:
+ return NX_MODIFIERKEY_COMMAND;
+ case NX_DEVICERCMDKEYMASK:
+ return NX_MODIFIERKEY_RCOMMAND;
+#endif
+ case NX_NUMERICPADMASK:
+ return NX_MODIFIERKEY_NUMERICPAD;
+ case NX_HELPMASK:
+ return NX_MODIFIERKEY_HELP;
+ case NX_SECONDARYFNMASK:
+ return NX_MODIFIERKEY_SECONDARYFN;
}
return -1;
}
@@ -534,27 +597,45 @@ int DarwinModifierNXMaskToNXKey(int mask) {
* DarwinModifierNXKeyToNXMask
* Returns 0 if key is not a known modifier key.
*/
-int DarwinModifierNXKeyToNXMask(int key) {
+int
+DarwinModifierNXKeyToNXMask(int key)
+{
switch (key) {
- case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK;
+ case NX_MODIFIERKEY_ALPHALOCK:
+ return NX_ALPHASHIFTMASK;
#ifdef NX_DEVICELSHIFTKEYMASK
- case NX_MODIFIERKEY_SHIFT: return NX_DEVICELSHIFTKEYMASK;
- case NX_MODIFIERKEY_RSHIFT: return NX_DEVICERSHIFTKEYMASK;
- case NX_MODIFIERKEY_CONTROL: return NX_DEVICELCTLKEYMASK;
- case NX_MODIFIERKEY_RCONTROL: return NX_DEVICERCTLKEYMASK;
- case NX_MODIFIERKEY_ALTERNATE: return NX_DEVICELALTKEYMASK;
- case NX_MODIFIERKEY_RALTERNATE: return NX_DEVICERALTKEYMASK;
- case NX_MODIFIERKEY_COMMAND: return NX_DEVICELCMDKEYMASK;
- case NX_MODIFIERKEY_RCOMMAND: return NX_DEVICERCMDKEYMASK;
+ case NX_MODIFIERKEY_SHIFT:
+ return NX_DEVICELSHIFTKEYMASK;
+ case NX_MODIFIERKEY_RSHIFT:
+ return NX_DEVICERSHIFTKEYMASK;
+ case NX_MODIFIERKEY_CONTROL:
+ return NX_DEVICELCTLKEYMASK;
+ case NX_MODIFIERKEY_RCONTROL:
+ return NX_DEVICERCTLKEYMASK;
+ case NX_MODIFIERKEY_ALTERNATE:
+ return NX_DEVICELALTKEYMASK;
+ case NX_MODIFIERKEY_RALTERNATE:
+ return NX_DEVICERALTKEYMASK;
+ case NX_MODIFIERKEY_COMMAND:
+ return NX_DEVICELCMDKEYMASK;
+ case NX_MODIFIERKEY_RCOMMAND:
+ return NX_DEVICERCMDKEYMASK;
#else
- case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK;
- case NX_MODIFIERKEY_CONTROL: return NX_CONTROLMASK;
- case NX_MODIFIERKEY_ALTERNATE: return NX_ALTERNATEMASK;
- case NX_MODIFIERKEY_COMMAND: return NX_COMMANDMASK;
-#endif
- case NX_MODIFIERKEY_NUMERICPAD: return NX_NUMERICPADMASK;
- case NX_MODIFIERKEY_HELP: return NX_HELPMASK;
- case NX_MODIFIERKEY_SECONDARYFN: return NX_SECONDARYFNMASK;
+ case NX_MODIFIERKEY_SHIFT:
+ return NX_SHIFTMASK;
+ case NX_MODIFIERKEY_CONTROL:
+ return NX_CONTROLMASK;
+ case NX_MODIFIERKEY_ALTERNATE:
+ return NX_ALTERNATEMASK;
+ case NX_MODIFIERKEY_COMMAND:
+ return NX_COMMANDMASK;
+#endif
+ case NX_MODIFIERKEY_NUMERICPAD:
+ return NX_NUMERICPADMASK;
+ case NX_MODIFIERKEY_HELP:
+ return NX_HELPMASK;
+ case NX_MODIFIERKEY_SECONDARYFN:
+ return NX_SECONDARYFNMASK;
}
return 0;
}
@@ -563,48 +644,85 @@ int DarwinModifierNXKeyToNXMask(int key) {
* DarwinModifierStringToNXMask
* Returns 0 if string is not a known modifier.
*/
-int DarwinModifierStringToNXMask(const char *str, int separatelr) {
+int
+DarwinModifierStringToNXMask(const char *str, int separatelr)
+{
#ifdef NX_DEVICELSHIFTKEYMASK
- if(separatelr) {
- if (!strcasecmp(str, "shift")) return NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK;
- if (!strcasecmp(str, "control")) return NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK;
- if (!strcasecmp(str, "option")) return NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK;
- if (!strcasecmp(str, "alt")) return NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK;
- if (!strcasecmp(str, "command")) return NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK;
- if (!strcasecmp(str, "lshift")) return NX_DEVICELSHIFTKEYMASK;
- if (!strcasecmp(str, "rshift")) return NX_DEVICERSHIFTKEYMASK;
- if (!strcasecmp(str, "lcontrol")) return NX_DEVICELCTLKEYMASK;
- if (!strcasecmp(str, "rcontrol")) return NX_DEVICERCTLKEYMASK;
- if (!strcasecmp(str, "loption")) return NX_DEVICELALTKEYMASK;
- if (!strcasecmp(str, "roption")) return NX_DEVICERALTKEYMASK;
- if (!strcasecmp(str, "lalt")) return NX_DEVICELALTKEYMASK;
- if (!strcasecmp(str, "ralt")) return NX_DEVICERALTKEYMASK;
- if (!strcasecmp(str, "lcommand")) return NX_DEVICELCMDKEYMASK;
- if (!strcasecmp(str, "rcommand")) return NX_DEVICERCMDKEYMASK;
- } else {
-#endif
- if (!strcasecmp(str, "shift")) return NX_SHIFTMASK;
- if (!strcasecmp(str, "control")) return NX_CONTROLMASK;
- if (!strcasecmp(str, "option")) return NX_ALTERNATEMASK;
- if (!strcasecmp(str, "alt")) return NX_ALTERNATEMASK;
- if (!strcasecmp(str, "command")) return NX_COMMANDMASK;
- if (!strcasecmp(str, "lshift")) return NX_SHIFTMASK;
- if (!strcasecmp(str, "rshift")) return NX_SHIFTMASK;
- if (!strcasecmp(str, "lcontrol")) return NX_CONTROLMASK;
- if (!strcasecmp(str, "rcontrol")) return NX_CONTROLMASK;
- if (!strcasecmp(str, "loption")) return NX_ALTERNATEMASK;
- if (!strcasecmp(str, "roption")) return NX_ALTERNATEMASK;
- if (!strcasecmp(str, "lalt")) return NX_ALTERNATEMASK;
- if (!strcasecmp(str, "ralt")) return NX_ALTERNATEMASK;
- if (!strcasecmp(str, "lcommand")) return NX_COMMANDMASK;
- if (!strcasecmp(str, "rcommand")) return NX_COMMANDMASK;
+ if (separatelr) {
+ if (!strcasecmp(str, "shift"))
+ return NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK;
+ if (!strcasecmp(str, "control"))
+ return NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK;
+ if (!strcasecmp(str, "option"))
+ return NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK;
+ if (!strcasecmp(str, "alt"))
+ return NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK;
+ if (!strcasecmp(str, "command"))
+ return NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK;
+ if (!strcasecmp(str, "lshift"))
+ return NX_DEVICELSHIFTKEYMASK;
+ if (!strcasecmp(str, "rshift"))
+ return NX_DEVICERSHIFTKEYMASK;
+ if (!strcasecmp(str, "lcontrol"))
+ return NX_DEVICELCTLKEYMASK;
+ if (!strcasecmp(str, "rcontrol"))
+ return NX_DEVICERCTLKEYMASK;
+ if (!strcasecmp(str, "loption"))
+ return NX_DEVICELALTKEYMASK;
+ if (!strcasecmp(str, "roption"))
+ return NX_DEVICERALTKEYMASK;
+ if (!strcasecmp(str, "lalt"))
+ return NX_DEVICELALTKEYMASK;
+ if (!strcasecmp(str, "ralt"))
+ return NX_DEVICERALTKEYMASK;
+ if (!strcasecmp(str, "lcommand"))
+ return NX_DEVICELCMDKEYMASK;
+ if (!strcasecmp(str, "rcommand"))
+ return NX_DEVICERCMDKEYMASK;
+ }
+ else {
+#endif
+ if (!strcasecmp(str, "shift"))
+ return NX_SHIFTMASK;
+ if (!strcasecmp(str, "control"))
+ return NX_CONTROLMASK;
+ if (!strcasecmp(str, "option"))
+ return NX_ALTERNATEMASK;
+ if (!strcasecmp(str, "alt"))
+ return NX_ALTERNATEMASK;
+ if (!strcasecmp(str, "command"))
+ return NX_COMMANDMASK;
+ if (!strcasecmp(str, "lshift"))
+ return NX_SHIFTMASK;
+ if (!strcasecmp(str, "rshift"))
+ return NX_SHIFTMASK;
+ if (!strcasecmp(str, "lcontrol"))
+ return NX_CONTROLMASK;
+ if (!strcasecmp(str, "rcontrol"))
+ return NX_CONTROLMASK;
+ if (!strcasecmp(str, "loption"))
+ return NX_ALTERNATEMASK;
+ if (!strcasecmp(str, "roption"))
+ return NX_ALTERNATEMASK;
+ if (!strcasecmp(str, "lalt"))
+ return NX_ALTERNATEMASK;
+ if (!strcasecmp(str, "ralt"))
+ return NX_ALTERNATEMASK;
+ if (!strcasecmp(str, "lcommand"))
+ return NX_COMMANDMASK;
+ if (!strcasecmp(str, "rcommand"))
+ return NX_COMMANDMASK;
#ifdef NX_DEVICELSHIFTKEYMASK
}
#endif
- if (!strcasecmp(str, "lock")) return NX_ALPHASHIFTMASK;
- if (!strcasecmp(str, "fn")) return NX_SECONDARYFNMASK;
- if (!strcasecmp(str, "help")) return NX_HELPMASK;
- if (!strcasecmp(str, "numlock")) return NX_NUMERICPADMASK;
+ if (!strcasecmp(str, "lock"))
+ return NX_ALPHASHIFTMASK;
+ if (!strcasecmp(str, "fn"))
+ return NX_SECONDARYFNMASK;
+ if (!strcasecmp(str, "help"))
+ return NX_HELPMASK;
+ if (!strcasecmp(str, "numlock"))
+ return NX_NUMERICPADMASK;
return 0;
}
@@ -613,12 +731,15 @@ int DarwinModifierStringToNXMask(const char *str, int separatelr) {
* This allows the ddx layer to prevent some keys from being remapped
* as modifier keys.
*/
-Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return 1;
}
-static inline UniChar macroman2ucs(unsigned char c) {
+static inline UniChar
+macroman2ucs(unsigned char c)
+{
/* Precalculated table mapping MacRoman-128 to Unicode. Generated
by creating single element CFStringRefs then extracting the
first character. */
@@ -642,20 +763,27 @@ static inline UniChar macroman2ucs(unsigned char c) {
0xaf, 0x2d8, 0x2d9, 0x2da, 0xb8, 0x2dd, 0x2db, 0x2c7,
};
- if (c < 128) return c;
- else return table[c - 128];
+ if (c < 128)
+ return c;
+ else
+ return table[c - 128];
}
-static KeySym make_dead_key(KeySym in) {
+static KeySym
+make_dead_key(KeySym in)
+{
int i;
- for (i = 0; i < sizeof (dead_keys) / sizeof (dead_keys[0]); i++)
- if (dead_keys[i].normal == in) return dead_keys[i].dead;
+ for (i = 0; i < sizeof(dead_keys) / sizeof(dead_keys[0]); i++)
+ if (dead_keys[i].normal == in)
+ return dead_keys[i].dead;
return in;
}
-static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
+static Bool
+QuartzReadSystemKeymap(darwinKeyboardInfo * info)
+{
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
KeyboardLayoutRef key_layout;
int is_uchr = 1;
@@ -669,48 +797,58 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
CFDataRef currentKeyLayoutDataRef = NULL;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource();
+ TISInputSourceRef currentKeyLayoutRef =
+ TISCopyCurrentKeyboardLayoutInputSource();
if (currentKeyLayoutRef) {
- currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData);
- if (currentKeyLayoutDataRef)
- chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
+ currentKeyLayoutDataRef =
+ (CFDataRef) TISGetInputSourceProperty(currentKeyLayoutRef,
+ kTISPropertyUnicodeKeyLayoutData);
+ if (currentKeyLayoutDataRef)
+ chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
}
#endif
#ifdef __clang__
#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations" // KLGetCurrentKeyboardLayout, KLGetKeyboardLayoutProperty
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // KLGetCurrentKeyboardLayout, KLGetKeyboardLayoutProperty
#endif
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
if (chr_data == NULL) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- ErrorF("X11.app: Error detected in determining keyboard layout. If you are using an Apple-provided keyboard layout, please report this error at http://xquartz.macosforge.org and http://bugreport.apple.com\n");
- ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n",
- (unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data);
+ ErrorF
+ ("X11.app: Error detected in determining keyboard layout. If you are using an Apple-provided keyboard layout, please report this error at http://xquartz.macosforge.org and http://bugreport.apple.com\n");
+ ErrorF
+ ("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n",
+ (unsigned) keyboard_type, currentKeyLayoutRef,
+ currentKeyLayoutDataRef, chr_data);
#endif
- KLGetCurrentKeyboardLayout (&key_layout);
- KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
+ KLGetCurrentKeyboardLayout(&key_layout);
+ KLGetKeyboardLayoutProperty(key_layout, kKLuchrData, &chr_data);
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- if(chr_data != NULL) {
- ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n");
+ if (chr_data != NULL) {
+ ErrorF
+ ("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n");
}
#endif
}
if (chr_data == NULL) {
- ErrorF("X11.app: Debug Info: kKLuchrData failed, trying kKLKCHRData.\n");
- ErrorF("If you are using a 3rd party keyboard layout, please see http://xquartz.macosforge.org/trac/ticket/154\n");
- KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
+ ErrorF
+ ("X11.app: Debug Info: kKLuchrData failed, trying kKLKCHRData.\n");
+ ErrorF
+ ("If you are using a 3rd party keyboard layout, please see http://xquartz.macosforge.org/trac/ticket/154\n");
+ KLGetKeyboardLayoutProperty(key_layout, kKLKCHRData, &chr_data);
is_uchr = 0;
num_keycodes = 128;
-
+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- if(chr_data != NULL) {
- ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n");
+ if (chr_data != NULL) {
+ ErrorF
+ ("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n");
}
#endif
}
@@ -721,61 +859,66 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- if(currentKeyLayoutRef)
+ if (currentKeyLayoutRef)
CFRelease(currentKeyLayoutRef);
#endif
-
+
if (chr_data == NULL) {
- ErrorF ( "Couldn't get uchr or kchr resource\n");
- return FALSE;
+ ErrorF("Couldn't get uchr or kchr resource\n");
+ return FALSE;
}
-
+
/* Scan the keycode range for the Unicode character that each
key produces in the four shift states. Then convert that to
an X11 keysym (which may just the bit that says "this is
Unicode" if it can't find the real symbol.) */
-
+
/* KeyTranslate is not available on 64-bit platforms; UCKeyTranslate
must be used instead. */
for (i = 0; i < num_keycodes; i++) {
- static const int mods[4] = {0, MOD_SHIFT, MOD_OPTION,
- MOD_OPTION | MOD_SHIFT};
+ static const int mods[4] = { 0, MOD_SHIFT, MOD_OPTION,
+ MOD_OPTION | MOD_SHIFT
+ };
k = info->keyMap + i * GLYPHS_PER_KEY;
for (j = 0; j < 4; j++) {
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
- if (is_uchr) {
+ if (is_uchr) {
#endif
UniChar s[8];
UniCharCount len;
UInt32 dead_key_state = 0, extra_dead = 0;
- err = UCKeyTranslate (chr_data, i, kUCKeyActionDown,
- mods[j] >> 8, keyboard_type, 0,
- &dead_key_state, 8, &len, s);
- if (err != noErr) continue;
+ err = UCKeyTranslate(chr_data, i, kUCKeyActionDown,
+ mods[j] >> 8, keyboard_type, 0,
+ &dead_key_state, 8, &len, s);
+ if (err != noErr)
+ continue;
if (len == 0 && dead_key_state != 0) {
/* Found a dead key. Work out which one it is, but
remembering that it's dead. */
- err = UCKeyTranslate (chr_data, i, kUCKeyActionDown,
- mods[j] >> 8, keyboard_type,
- kUCKeyTranslateNoDeadKeysMask,
- &extra_dead, 8, &len, s);
- if (err != noErr) continue;
+ err = UCKeyTranslate(chr_data, i, kUCKeyActionDown,
+ mods[j] >> 8, keyboard_type,
+ kUCKeyTranslateNoDeadKeysMask,
+ &extra_dead, 8, &len, s);
+ if (err != noErr)
+ continue;
}
/* Not sure why 0x0010 is there.
* 0x0000 - <rdar://problem/7793566> 'Unicode Hex Input' ...
*/
if (len > 0 && s[0] != 0x0010 && s[0] != 0x0000) {
- k[j] = ucs2keysym (s[0]);
- if (dead_key_state != 0) k[j] = make_dead_key (k[j]);
+ k[j] = ucs2keysym(s[0]);
+ if (dead_key_state != 0)
+ k[j] = make_dead_key(k[j]);
}
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
- } else { // kchr
+ }
+ else { // kchr
UInt32 c, state = 0, state2 = 0;
UInt16 code;
@@ -783,10 +926,10 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
#ifdef __clang__
#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations" // KeyTranslate
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // KeyTranslate
#endif
- c = KeyTranslate (chr_data, code, &state);
+ c = KeyTranslate(chr_data, code, &state);
/* Dead keys are only processed on key-down, so ask
to translate those events. When we find a dead key,
@@ -794,7 +937,7 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
us the actual dead character. */
if (state != 0)
- c = KeyTranslate (chr_data, code | 128, &state2);
+ c = KeyTranslate(chr_data, code | 128, &state2);
#ifdef __clang__
#pragma clang diagnostic pop
@@ -803,45 +946,52 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
/* Characters seem to be in MacRoman encoding. */
if (c != 0 && c != 0x0010) {
- k[j] = ucs2keysym (macroman2ucs (c & 255));
+ k[j] = ucs2keysym(macroman2ucs(c & 255));
- if (state != 0) k[j] = make_dead_key (k[j]);
+ if (state != 0)
+ k[j] = make_dead_key(k[j]);
}
}
#endif
}
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] = NoSymbol;
+ if (k[3] == k[2])
+ k[3] = NoSymbol;
+ if (k[1] == k[0])
+ k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3])
+ k[2] = k[3] = NoSymbol;
+ if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol)
+ k[3] = NoSymbol;
}
#if HACK_MISSING
/* Fix up some things that are normally missing.. */
-
- for (i = 0; i < sizeof (known_keys) / sizeof (known_keys[0]); i++) {
+
+ for (i = 0; i < sizeof(known_keys) / sizeof(known_keys[0]); i++) {
k = info->keyMap + known_keys[i].keycode * GLYPHS_PER_KEY;
-
- if ( k[0] == NoSymbol && k[1] == NoSymbol
+
+ if (k[0] == NoSymbol && k[1] == NoSymbol
&& k[2] == NoSymbol && k[3] == NoSymbol)
k[0] = known_keys[i].keysym;
}
#endif
-
+
#if HACK_KEYPAD
/* And some more things. We find the right symbols for the numeric
- keypad, but not the KP_ keysyms. So try to convert known keycodes. */
- for (i = 0; i < sizeof (known_numeric_keys) / sizeof (known_numeric_keys[0]); i++) {
+ keypad, but not the KP_ keysyms. So try to convert known keycodes. */
+ for (i = 0; i < sizeof(known_numeric_keys) / sizeof(known_numeric_keys[0]);
+ i++) {
k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
-
+
if (k[0] == known_numeric_keys[i].normal)
k[0] = known_numeric_keys[i].keypad;
}
#endif
-
+
#if HACK_BLACKLIST
- for (i = 0; i < sizeof (keycode_blacklist) / sizeof (keycode_blacklist[0]); i++) {
+ for (i = 0; i < sizeof(keycode_blacklist) / sizeof(keycode_blacklist[0]);
+ i++) {
k = info->keyMap + keycode_blacklist[i] * GLYPHS_PER_KEY;
k[0] = k[1] = k[2] = k[3] = NoSymbol;
}
@@ -852,8 +1002,11 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
return TRUE;
}
-Bool QuartsResyncKeymap(Bool sendDDXEvent) {
+Bool
+QuartsResyncKeymap(Bool sendDDXEvent)
+{
Bool retval;
+
/* Update keyInfo */
pthread_mutex_lock(&keyInfo_mutex);
memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
@@ -861,7 +1014,7 @@ Bool QuartsResyncKeymap(Bool sendDDXEvent) {
pthread_mutex_unlock(&keyInfo_mutex);
/* Tell server thread to deal with new keyInfo */
- if(sendDDXEvent)
+ if (sendDDXEvent)
DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
return retval;
diff --git a/xorg-server/hw/xquartz/quartzRandR.c b/xorg-server/hw/xquartz/quartzRandR.c
index 98b382d65..b7c424f50 100644
--- a/xorg-server/hw/xquartz/quartzRandR.c
+++ b/xorg-server/hw/xquartz/quartzRandR.c
@@ -64,14 +64,17 @@ static Bool ignore_next_fake_mode_update = FALSE;
#define CALLBACK_ERROR -1
typedef int (*QuartzModeCallback)
- (ScreenPtr, QuartzModeInfoPtr, void *);
+ (ScreenPtr, QuartzModeInfoPtr, void *);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
-static long getDictLong (CFDictionaryRef dictRef, CFStringRef key) {
+static long
+getDictLong(CFDictionaryRef dictRef, CFStringRef key)
+{
long value;
CFNumberRef numRef = (CFNumberRef) CFDictionaryGetValue(dictRef, key);
+
if (!numRef)
return 0;
@@ -80,10 +83,13 @@ static long getDictLong (CFDictionaryRef dictRef, CFStringRef key) {
return value;
}
-static double getDictDouble (CFDictionaryRef dictRef, CFStringRef key) {
+static double
+getDictDouble(CFDictionaryRef dictRef, CFStringRef key)
+{
double value;
CFNumberRef numRef = (CFNumberRef) CFDictionaryGetValue(dictRef, key);
+
if (!numRef)
return 0.0;
@@ -92,43 +98,51 @@ static double getDictDouble (CFDictionaryRef dictRef, CFStringRef key) {
return value;
}
-static void QuartzRandRGetModeInfo (CFDictionaryRef modeRef,
- QuartzModeInfoPtr pMode) {
+static void
+QuartzRandRGetModeInfo(CFDictionaryRef modeRef, QuartzModeInfoPtr pMode)
+{
pMode->width = (size_t) getDictLong(modeRef, kCGDisplayWidth);
pMode->height = (size_t) getDictLong(modeRef, kCGDisplayHeight);
- pMode->refresh = (int)(getDictDouble(modeRef, kCGDisplayRefreshRate) + 0.5);
+ pMode->refresh =
+ (int) (getDictDouble(modeRef, kCGDisplayRefreshRate) + 0.5);
if (pMode->refresh == 0)
pMode->refresh = DEFAULT_REFRESH;
pMode->ref = NULL;
pMode->pSize = NULL;
}
-static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
- QuartzModeInfoPtr pMode) {
+static Bool
+QuartzRandRCopyCurrentModeInfo(CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode)
+{
CFDictionaryRef curModeRef = CGDisplayCurrentMode(screenId);
+
if (!curModeRef)
return FALSE;
QuartzRandRGetModeInfo(curModeRef, pMode);
- pMode->ref = (void *)curModeRef;
+ pMode->ref = (void *) curModeRef;
CFRetain(pMode->ref);
return TRUE;
}
-static Bool QuartzRandRSetCGMode (CGDirectDisplayID screenId,
- QuartzModeInfoPtr pMode) {
+static Bool
+QuartzRandRSetCGMode(CGDirectDisplayID screenId, QuartzModeInfoPtr pMode)
+{
CFDictionaryRef modeRef = (CFDictionaryRef) pMode->ref;
+
return (CGDisplaySwitchToMode(screenId, modeRef) == kCGErrorSuccess);
}
-static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
- QuartzModeCallback callback,
- void *data) {
+static Bool
+QuartzRandREnumerateModes(ScreenPtr pScreen,
+ QuartzModeCallback callback, void *data)
+{
Bool retval = FALSE;
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
/* Just an 800x600 fallback if we have no attached heads */
- if(pQuartzScreen->displayIDs) {
+ if (pQuartzScreen->displayIDs) {
CFDictionaryRef curModeRef, modeRef;
long curBpp;
CFArrayRef modes;
@@ -146,6 +160,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
return FALSE;
for (i = 0; i < CFArrayGetCount(modes); i++) {
int cb;
+
modeRef = (CFDictionaryRef) CFArrayGetValueAtIndex(modes, i);
/* Skip modes that are not usable on the current display or have a
@@ -157,7 +172,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
continue;
QuartzRandRGetModeInfo(modeRef, &modeInfo);
- modeInfo.ref = (void *)modeRef;
+ modeInfo.ref = (void *) modeRef;
cb = callback(pScreen, &modeInfo, data);
if (cb == CALLBACK_CONTINUE)
retval = TRUE;
@@ -168,35 +183,36 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
}
}
- switch(callback(pScreen, &pQuartzScreen->rootlessMode, data)) {
- case CALLBACK_SUCCESS:
- return TRUE;
- case CALLBACK_ERROR:
- return FALSE;
- case CALLBACK_CONTINUE:
- retval = TRUE;
- default:
- break;
+ switch (callback(pScreen, &pQuartzScreen->rootlessMode, data)) {
+ case CALLBACK_SUCCESS:
+ return TRUE;
+ case CALLBACK_ERROR:
+ return FALSE;
+ case CALLBACK_CONTINUE:
+ retval = TRUE;
+ default:
+ break;
}
- switch(callback(pScreen, &pQuartzScreen->fullscreenMode, data)) {
- case CALLBACK_SUCCESS:
- return TRUE;
- case CALLBACK_ERROR:
- return FALSE;
- case CALLBACK_CONTINUE:
- retval = TRUE;
- default:
- break;
+ switch (callback(pScreen, &pQuartzScreen->fullscreenMode, data)) {
+ case CALLBACK_SUCCESS:
+ return TRUE;
+ case CALLBACK_ERROR:
+ return FALSE;
+ case CALLBACK_CONTINUE:
+ retval = TRUE;
+ default:
+ break;
}
return retval;
}
-#else /* we have the new CG APIs from Snow Leopard */
+#else /* we have the new CG APIs from Snow Leopard */
-static void QuartzRandRGetModeInfo (CGDisplayModeRef modeRef,
- QuartzModeInfoPtr pMode) {
+static void
+QuartzRandRGetModeInfo(CGDisplayModeRef modeRef, QuartzModeInfoPtr pMode)
+{
pMode->width = CGDisplayModeGetWidth(modeRef);
pMode->height = CGDisplayModeGetHeight(modeRef);
pMode->refresh = (int) (CGDisplayModeGetRefreshRate(modeRef) + 0.5);
@@ -206,9 +222,12 @@ static void QuartzRandRGetModeInfo (CGDisplayModeRef modeRef,
pMode->pSize = NULL;
}
-static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
- QuartzModeInfoPtr pMode) {
+static Bool
+QuartzRandRCopyCurrentModeInfo(CGDirectDisplayID screenId,
+ QuartzModeInfoPtr pMode)
+{
CGDisplayModeRef curModeRef = CGDisplayCopyDisplayMode(screenId);
+
if (!curModeRef)
return FALSE;
@@ -217,23 +236,27 @@ static Bool QuartzRandRCopyCurrentModeInfo (CGDirectDisplayID screenId,
return TRUE;
}
-static Bool QuartzRandRSetCGMode (CGDirectDisplayID screenId,
- QuartzModeInfoPtr pMode) {
+static Bool
+QuartzRandRSetCGMode(CGDirectDisplayID screenId, QuartzModeInfoPtr pMode)
+{
CGDisplayModeRef modeRef = (CGDisplayModeRef) pMode->ref;
+
if (!modeRef)
return FALSE;
- return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) == kCGErrorSuccess);
+ return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) ==
+ kCGErrorSuccess);
}
-static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
- QuartzModeCallback callback,
- void *data) {
+static Bool
+QuartzRandREnumerateModes(ScreenPtr pScreen,
+ QuartzModeCallback callback, void *data)
+{
Bool retval = FALSE;
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
/* Just an 800x600 fallback if we have no attached heads */
- if(pQuartzScreen->displayIDs) {
+ if (pQuartzScreen->displayIDs) {
CGDisplayModeRef curModeRef, modeRef;
CFStringRef curPixelEnc, pixelEnc;
CFComparisonResult pixelEncEqual;
@@ -255,6 +278,7 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
}
for (i = 0; i < CFArrayGetCount(modes); i++) {
int cb;
+
modeRef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
/* Skip modes that are not usable on the current display or have a
@@ -273,11 +297,13 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
cb = callback(pScreen, &modeInfo, data);
if (cb == CALLBACK_CONTINUE) {
retval = TRUE;
- } else if (cb == CALLBACK_SUCCESS) {
+ }
+ else if (cb == CALLBACK_SUCCESS) {
CFRelease(modes);
CFRelease(curPixelEnc);
return TRUE;
- } else if (cb == CALLBACK_ERROR) {
+ }
+ else if (cb == CALLBACK_ERROR) {
CFRelease(modes);
CFRelease(curPixelEnc);
return FALSE;
@@ -288,81 +314,91 @@ static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
CFRelease(curPixelEnc);
}
- switch(callback(pScreen, &pQuartzScreen->rootlessMode, data)) {
- case CALLBACK_SUCCESS:
- return TRUE;
- case CALLBACK_ERROR:
- return FALSE;
- case CALLBACK_CONTINUE:
- retval = TRUE;
- default:
- break;
+ switch (callback(pScreen, &pQuartzScreen->rootlessMode, data)) {
+ case CALLBACK_SUCCESS:
+ return TRUE;
+ case CALLBACK_ERROR:
+ return FALSE;
+ case CALLBACK_CONTINUE:
+ retval = TRUE;
+ default:
+ break;
}
- switch(callback(pScreen, &pQuartzScreen->fullscreenMode, data)) {
- case CALLBACK_SUCCESS:
- return TRUE;
- case CALLBACK_ERROR:
- return FALSE;
- case CALLBACK_CONTINUE:
- retval = TRUE;
- default:
- break;
+ switch (callback(pScreen, &pQuartzScreen->fullscreenMode, data)) {
+ case CALLBACK_SUCCESS:
+ return TRUE;
+ case CALLBACK_ERROR:
+ return FALSE;
+ case CALLBACK_CONTINUE:
+ retval = TRUE;
+ default:
+ break;
}
return retval;
}
-#endif /* Snow Leopard CoreGraphics APIs */
+#endif /* Snow Leopard CoreGraphics APIs */
-
-static Bool QuartzRandRModesEqual (QuartzModeInfoPtr pMode1,
- QuartzModeInfoPtr pMode2) {
+static Bool
+QuartzRandRModesEqual(QuartzModeInfoPtr pMode1, QuartzModeInfoPtr pMode2)
+{
return (pMode1->width == pMode2->width) &&
- (pMode1->height == pMode2->height) &&
- (pMode1->refresh == pMode2->refresh);
+ (pMode1->height == pMode2->height) &&
+ (pMode1->refresh == pMode2->refresh);
}
-static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
- QuartzModeInfoPtr pMode) {
+static Bool
+QuartzRandRRegisterMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode)
+{
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
- Bool isCurrentMode = QuartzRandRModesEqual(&pQuartzScreen->currentMode, pMode);
+ Bool isCurrentMode =
+ QuartzRandRModesEqual(&pQuartzScreen->currentMode, pMode);
/* TODO: DPI */
- pMode->pSize = RRRegisterSize(pScreen, pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
+ pMode->pSize =
+ RRRegisterSize(pScreen, pMode->width, pMode->height, pScreen->mmWidth,
+ pScreen->mmHeight);
if (pMode->pSize) {
//DEBUG_LOG("registering: %d x %d @ %d %s\n", (int)pMode->width, (int)pMode->height, (int)pMode->refresh, isCurrentMode ? "*" : "");
RRRegisterRate(pScreen, pMode->pSize, pMode->refresh);
if (isCurrentMode)
- RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh, pMode->pSize);
+ RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh,
+ pMode->pSize);
return TRUE;
}
return FALSE;
}
-static int QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
- QuartzModeInfoPtr pMode,
- void *data __unused) {
- if(QuartzRandRRegisterMode(pScreen, pMode)) {
+static int
+QuartzRandRRegisterModeCallback(ScreenPtr pScreen,
+ QuartzModeInfoPtr pMode, void *data __unused)
+{
+ if (QuartzRandRRegisterMode(pScreen, pMode)) {
return CALLBACK_CONTINUE;
- } else {
+ }
+ else {
return CALLBACK_ERROR;
}
}
-static Bool QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, BOOL doRegister) {
+static Bool
+QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, BOOL doRegister)
+{
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
- Bool captureDisplay = (pMode->refresh != FAKE_REFRESH_FULLSCREEN && pMode->refresh != FAKE_REFRESH_ROOTLESS);
+ Bool captureDisplay = (pMode->refresh != FAKE_REFRESH_FULLSCREEN &&
+ pMode->refresh != FAKE_REFRESH_ROOTLESS);
CGDirectDisplayID screenId;
- if(pQuartzScreen->displayIDs == NULL)
+ if (pQuartzScreen->displayIDs == NULL)
return FALSE;
screenId = pQuartzScreen->displayIDs[0];
- if(XQuartzShieldingWindowLevel == 0 && captureDisplay) {
- if(!X11ApplicationCanEnterRandR())
+ if (XQuartzShieldingWindowLevel == 0 && captureDisplay) {
+ if (!X11ApplicationCanEnterRandR())
return FALSE;
CGCaptureAllDisplays();
XQuartzShieldingWindowLevel = CGShieldingWindowLevel(); // 2147483630
@@ -370,11 +406,14 @@ static Bool QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, BOOL
CGShieldingWindowID(screenId), XQuartzShieldingWindowLevel);
}
- if (pQuartzScreen->currentMode.ref && CFEqual(pMode->ref, pQuartzScreen->currentMode.ref)) {
+ if (pQuartzScreen->currentMode.ref &&
+ CFEqual(pMode->ref, pQuartzScreen->currentMode.ref)) {
DEBUG_LOG("Requested RandR resolution matches current CG mode\n");
- } if (QuartzRandRSetCGMode(screenId, pMode)) {
+ }
+ if (QuartzRandRSetCGMode(screenId, pMode)) {
ignore_next_fake_mode_update = TRUE;
- } else {
+ }
+ else {
DEBUG_LOG("Error while requesting CG resolution change.\n");
return FALSE;
}
@@ -387,13 +426,13 @@ static Bool QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, BOOL
QuartzShowFullscreen(TRUE);
}
- if(pQuartzScreen->currentMode.ref)
+ if (pQuartzScreen->currentMode.ref)
CFRelease(pQuartzScreen->currentMode.ref);
pQuartzScreen->currentMode = *pMode;
- if(pQuartzScreen->currentMode.ref)
+ if (pQuartzScreen->currentMode.ref)
CFRetain(pQuartzScreen->currentMode.ref);
-
- if(XQuartzShieldingWindowLevel != 0 && !captureDisplay) {
+
+ if (XQuartzShieldingWindowLevel != 0 && !captureDisplay) {
CGReleaseAllDisplays();
XQuartzShieldingWindowLevel = 0;
}
@@ -401,32 +440,37 @@ static Bool QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, BOOL
return TRUE;
}
-static int QuartzRandRSetModeCallback (ScreenPtr pScreen,
- QuartzModeInfoPtr pMode,
- void *data) {
+static int
+QuartzRandRSetModeCallback(ScreenPtr pScreen,
+ QuartzModeInfoPtr pMode, void *data)
+{
QuartzModeInfoPtr pReqMode = (QuartzModeInfoPtr) data;
-
+
if (!QuartzRandRModesEqual(pMode, pReqMode))
- return CALLBACK_CONTINUE; /* continue enumeration */
+ return CALLBACK_CONTINUE; /* continue enumeration */
- DEBUG_LOG("Found a match for requested RandR resolution (%dx%d@%d).\n", (int)pMode->width, (int)pMode->height, (int)pMode->refresh);
+ DEBUG_LOG("Found a match for requested RandR resolution (%dx%d@%d).\n",
+ (int) pMode->width, (int) pMode->height, (int) pMode->refresh);
- if(QuartzRandRSetMode(pScreen, pMode, FALSE))
+ if (QuartzRandRSetMode(pScreen, pMode, FALSE))
return CALLBACK_SUCCESS;
else
return CALLBACK_ERROR;
}
-static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
- *rotations = RR_Rotate_0; /* TODO: support rotation */
+static Bool
+QuartzRandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
+{
+ *rotations = RR_Rotate_0; /* TODO: support rotation */
- return QuartzRandREnumerateModes(pScreen, QuartzRandRRegisterModeCallback, NULL);
+ return QuartzRandREnumerateModes(pScreen, QuartzRandRRegisterModeCallback,
+ NULL);
}
-static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize) {
+static Bool
+QuartzRandRSetConfig(ScreenPtr pScreen,
+ Rotation randr, int rate, RRScreenSizePtr pSize)
+{
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
QuartzModeInfo reqMode;
@@ -437,92 +481,111 @@ static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
/* Do not switch modes if requested mode is equal to current mode. */
if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->currentMode))
return TRUE;
-
- if (QuartzRandREnumerateModes(pScreen, QuartzRandRSetModeCallback, &reqMode)) {
+
+ if (QuartzRandREnumerateModes
+ (pScreen, QuartzRandRSetModeCallback, &reqMode)) {
return TRUE;
}
-
- DEBUG_LOG("Unable to find a matching config: %d x %d @ %d\n", (int)reqMode.width, (int)reqMode.height, (int)reqMode.refresh);
+
+ DEBUG_LOG("Unable to find a matching config: %d x %d @ %d\n",
+ (int) reqMode.width, (int) reqMode.height, (int) reqMode.refresh);
return FALSE;
}
-static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
+static Bool
+_QuartzRandRUpdateFakeModes(ScreenPtr pScreen)
+{
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
QuartzModeInfo activeMode;
- if(pQuartzScreen->displayCount > 0) {
- if(!QuartzRandRCopyCurrentModeInfo(pQuartzScreen->displayIDs[0], &activeMode)) {
+ if (pQuartzScreen->displayCount > 0) {
+ if (!QuartzRandRCopyCurrentModeInfo
+ (pQuartzScreen->displayIDs[0], &activeMode)) {
ErrorF("Unable to determine current display mode.\n");
return FALSE;
}
- } else {
+ }
+ else {
memset(&activeMode, 0, sizeof(activeMode));
activeMode.width = 800;
activeMode.height = 600;
activeMode.refresh = 60;
}
- if(pQuartzScreen->fullscreenMode.ref)
+ if (pQuartzScreen->fullscreenMode.ref)
CFRelease(pQuartzScreen->fullscreenMode.ref);
- if(pQuartzScreen->currentMode.ref)
+ if (pQuartzScreen->currentMode.ref)
CFRelease(pQuartzScreen->currentMode.ref);
- if(pQuartzScreen->displayCount > 1) {
+ if (pQuartzScreen->displayCount > 1) {
activeMode.width = pScreen->width;
activeMode.height = pScreen->height;
- if(XQuartzIsRootless)
+ if (XQuartzIsRootless)
activeMode.height += aquaMenuBarHeight;
}
- pQuartzScreen->fullscreenMode = activeMode;
+ pQuartzScreen->fullscreenMode = activeMode;
pQuartzScreen->fullscreenMode.refresh = FAKE_REFRESH_FULLSCREEN;
pQuartzScreen->rootlessMode = activeMode;
pQuartzScreen->rootlessMode.refresh = FAKE_REFRESH_ROOTLESS;
pQuartzScreen->rootlessMode.height -= aquaMenuBarHeight;
- if(XQuartzIsRootless) {
+ if (XQuartzIsRootless) {
pQuartzScreen->currentMode = pQuartzScreen->rootlessMode;
- } else {
+ }
+ else {
pQuartzScreen->currentMode = pQuartzScreen->fullscreenMode;
}
/* This extra retain is for currentMode's copy.
* fullscreen and rootless share a retain.
*/
- if(pQuartzScreen->currentMode.ref)
+ if (pQuartzScreen->currentMode.ref)
CFRetain(pQuartzScreen->currentMode.ref);
-
- DEBUG_LOG("rootlessMode: %d x %d\n", (int)pQuartzScreen->rootlessMode.width, (int)pQuartzScreen->rootlessMode.height);
- DEBUG_LOG("fullscreenMode: %d x %d\n", (int)pQuartzScreen->fullscreenMode.width, (int)pQuartzScreen->fullscreenMode.height);
- DEBUG_LOG("currentMode: %d x %d\n", (int)pQuartzScreen->currentMode.width, (int)pQuartzScreen->currentMode.height);
-
+
+ DEBUG_LOG("rootlessMode: %d x %d\n",
+ (int) pQuartzScreen->rootlessMode.width,
+ (int) pQuartzScreen->rootlessMode.height);
+ DEBUG_LOG("fullscreenMode: %d x %d\n",
+ (int) pQuartzScreen->fullscreenMode.width,
+ (int) pQuartzScreen->fullscreenMode.height);
+ DEBUG_LOG("currentMode: %d x %d\n", (int) pQuartzScreen->currentMode.width,
+ (int) pQuartzScreen->currentMode.height);
+
return TRUE;
}
-Bool QuartzRandRUpdateFakeModes (BOOL force_update) {
+Bool
+QuartzRandRUpdateFakeModes(BOOL force_update)
+{
ScreenPtr pScreen = screenInfo.screens[0];
-
- if(ignore_next_fake_mode_update) {
- DEBUG_LOG("Ignoring update request caused by RandR resolution change.\n");
+
+ if (ignore_next_fake_mode_update) {
+ DEBUG_LOG
+ ("Ignoring update request caused by RandR resolution change.\n");
ignore_next_fake_mode_update = FALSE;
return TRUE;
}
-
- if(!_QuartzRandRUpdateFakeModes(pScreen))
+
+ if (!_QuartzRandRUpdateFakeModes(pScreen))
return FALSE;
-
- if(force_update)
+
+ if (force_update)
RRGetInfo(pScreen, TRUE);
return TRUE;
}
-Bool QuartzRandRInit (ScreenPtr pScreen) {
- rrScrPrivPtr pScrPriv;
-
- if (!RRScreenInit (pScreen)) return FALSE;
- if (!_QuartzRandRUpdateFakeModes (pScreen)) return FALSE;
+Bool
+QuartzRandRInit(ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit(pScreen))
+ return FALSE;
+ if (!_QuartzRandRUpdateFakeModes(pScreen))
+ return FALSE;
pScrPriv = rrGetScrPriv(pScreen);
pScrPriv->rrGetInfo = QuartzRandRGetInfo;
@@ -530,12 +593,14 @@ Bool QuartzRandRInit (ScreenPtr pScreen) {
return TRUE;
}
-void QuartzRandRSetFakeRootless (void) {
+void
+QuartzRandRSetFakeRootless(void)
+{
int i;
-
+
DEBUG_LOG("QuartzRandRSetFakeRootless called.\n");
-
- for (i=0; i < screenInfo.numScreens; i++) {
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
ScreenPtr pScreen = screenInfo.screens[i];
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
@@ -543,18 +608,20 @@ void QuartzRandRSetFakeRootless (void) {
}
}
-void QuartzRandRSetFakeFullscreen (BOOL state) {
+void
+QuartzRandRSetFakeFullscreen(BOOL state)
+{
int i;
DEBUG_LOG("QuartzRandRSetFakeFullscreen called.\n");
-
- for (i=0; i < screenInfo.numScreens; i++) {
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
ScreenPtr pScreen = screenInfo.screens[i];
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
QuartzRandRSetMode(pScreen, &pQuartzScreen->fullscreenMode, TRUE);
}
-
+
QuartzShowFullscreen(state);
}
@@ -563,23 +630,31 @@ void QuartzRandRSetFakeFullscreen (BOOL state) {
* mode, this will toggles us to the default fake mode and hide windows if
* it is fullscreen
*/
-void QuartzRandRToggleFullscreen (void) {
+void
+QuartzRandRToggleFullscreen(void)
+{
ScreenPtr pScreen = screenInfo.screens[0];
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
if (pQuartzScreen->currentMode.ref == NULL) {
- ErrorF("Ignoring QuartzRandRToggleFullscreen because don't have a current mode set.\n");
- } else if (pQuartzScreen->currentMode.refresh == FAKE_REFRESH_ROOTLESS) {
- ErrorF("Ignoring QuartzRandRToggleFullscreen because we are in rootless mode.\n");
- } else if (pQuartzScreen->currentMode.refresh == FAKE_REFRESH_FULLSCREEN) {
+ ErrorF
+ ("Ignoring QuartzRandRToggleFullscreen because don't have a current mode set.\n");
+ }
+ else if (pQuartzScreen->currentMode.refresh == FAKE_REFRESH_ROOTLESS) {
+ ErrorF
+ ("Ignoring QuartzRandRToggleFullscreen because we are in rootless mode.\n");
+ }
+ else if (pQuartzScreen->currentMode.refresh == FAKE_REFRESH_FULLSCREEN) {
/* Legacy fullscreen mode. Hide/Show */
QuartzShowFullscreen(!XQuartzFullscreenVisible);
- } else {
+ }
+ else {
/* RandR fullscreen mode. Return to default mode and hide if it is fullscreen. */
- if(XQuartzRootlessDefault) {
+ if (XQuartzRootlessDefault) {
QuartzRandRSetFakeRootless();
- } else {
+ }
+ else {
QuartzRandRSetFakeFullscreen(FALSE);
}
- }
+ }
}
diff --git a/xorg-server/hw/xquartz/quartzStartup.c b/xorg-server/hw/xquartz/quartzStartup.c
index 25ef76efa..183bf7618 100644
--- a/xorg-server/hw/xquartz/quartzStartup.c
+++ b/xorg-server/hw/xquartz/quartzStartup.c
@@ -56,59 +56,68 @@ struct arg {
char **envp;
};
-_X_NORETURN
-static void server_thread (void *arg) {
- struct arg args = *((struct arg *)arg);
+_X_NORETURN static void
+server_thread(void *arg)
+{
+ struct arg args = *((struct arg *) arg);
+
free(arg);
- exit (dix_main(args.argc, args.argv, args.envp));
+ exit(dix_main(args.argc, args.argv, args.envp));
}
-static pthread_t create_thread (void *func, void *arg) {
+static pthread_t
+create_thread(void *func, void *arg)
+{
pthread_attr_t attr;
pthread_t tid;
-
- pthread_attr_init (&attr);
- pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
- pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
- pthread_create (&tid, &attr, func, arg);
- pthread_attr_destroy (&attr);
-
+
+ pthread_attr_init(&attr);
+ pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ pthread_create(&tid, &attr, func, arg);
+ pthread_attr_destroy(&attr);
+
return tid;
}
-void QuartzInitServer(int argc, char **argv, char **envp) {
- struct arg *args = (struct arg*)malloc(sizeof(struct arg));
- if(!args)
+void
+QuartzInitServer(int argc, char **argv, char **envp)
+{
+ struct arg *args = (struct arg *) malloc(sizeof(struct arg));
+
+ if (!args)
FatalError("Could not allocate memory.\n");
-
+
args->argc = argc;
args->argv = argv;
args->envp = envp;
-
+
if (!create_thread(server_thread, args)) {
FatalError("can't create secondary thread\n");
}
}
-int server_main(int argc, char **argv, char **envp) {
- int i;
- int fd[2];
+int
+server_main(int argc, char **argv, char **envp)
+{
+ int i;
+ int fd[2];
/* Unset CFProcessPath, so our children don't inherit this kludge we need
* to load our nib. If an xterm gets this set, then it fails to
* 'open hi.txt' properly.
*/
unsetenv("CFProcessPath");
-
+
// Make a pipe to pass events
- assert( pipe(fd) == 0 );
+ assert(pipe(fd) == 0);
darwinEventReadFD = fd[0];
darwinEventWriteFD = fd[1];
fcntl(darwinEventReadFD, F_SETFL, O_NONBLOCK);
for (i = 1; i < argc; i++) {
// Display version info without starting Mac OS X UI if requested
- if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) {
+ if (!strcmp(argv[i], "-showconfig") || !strcmp(argv[i], "-version")) {
DarwinPrintBanner();
exit(0);
}
diff --git a/xorg-server/hw/xquartz/xpr/appledri.c b/xorg-server/hw/xquartz/xpr/appledri.c
index 44c132abc..4ef0061b2 100644
--- a/xorg-server/hw/xquartz/xpr/appledri.c
+++ b/xorg-server/hw/xquartz/xpr/appledri.c
@@ -59,36 +59,31 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
static int DRIErrorBase = 0;
-
-static void AppleDRIResetProc(ExtensionEntry* extEntry);
+static void AppleDRIResetProc(ExtensionEntry * extEntry);
static int ProcAppleDRICreatePixmap(ClientPtr client);
static unsigned char DRIReqCode = 0;
static int DRIEventBase = 0;
-static void SNotifyEvent(xAppleDRINotifyEvent *from, xAppleDRINotifyEvent *to);
+static void SNotifyEvent(xAppleDRINotifyEvent * from,
+ xAppleDRINotifyEvent * to);
typedef struct _DRIEvent *DRIEventPtr;
typedef struct _DRIEvent {
- DRIEventPtr next;
- ClientPtr client;
- XID clientResource;
- unsigned int mask;
+ DRIEventPtr next;
+ ClientPtr client;
+ XID clientResource;
+ unsigned int mask;
} DRIEventRec;
-/*ARGSUSED*/
-static void
-AppleDRIResetProc (
- ExtensionEntry* extEntry
-)
+ /*ARGSUSED*/ static void
+AppleDRIResetProc(ExtensionEntry * extEntry)
{
DRIReset();
}
static int
-ProcAppleDRIQueryVersion(
- register ClientPtr client
-)
+ProcAppleDRIQueryVersion(register ClientPtr client)
{
xAppleDRIQueryVersionReply rep;
@@ -106,17 +101,14 @@ ProcAppleDRIQueryVersion(
swaps(&rep.minorVersion);
swapl(&rep.patchVersion);
}
- WriteToClient(client, sizeof(xAppleDRIQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xAppleDRIQueryVersionReply), (char *) &rep);
return Success;
}
-
/* surfaces */
static int
-ProcAppleDRIQueryDirectRenderingCapable(
- register ClientPtr client
-)
+ProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client)
{
xAppleDRIQueryDirectRenderingCapableReply rep;
Bool isCapable;
@@ -127,8 +119,8 @@ ProcAppleDRIQueryDirectRenderingCapable(
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if (!DRIQueryDirectRenderingCapable( screenInfo.screens[stuff->screen],
- &isCapable)) {
+ if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen],
+ &isCapable)) {
return BadValue;
}
rep.isCapable = isCapable;
@@ -141,18 +133,17 @@ ProcAppleDRIQueryDirectRenderingCapable(
swapl(&rep.length);
}
- WriteToClient(client,
- sizeof(xAppleDRIQueryDirectRenderingCapableReply), (char *)&rep);
+ WriteToClient(client,
+ sizeof(xAppleDRIQueryDirectRenderingCapableReply),
+ (char *) &rep);
return Success;
}
static int
-ProcAppleDRIAuthConnection(
- register ClientPtr client
-)
+ProcAppleDRIAuthConnection(register ClientPtr client)
{
xAppleDRIAuthConnectionReply rep;
-
+
REQUEST(xAppleDRIAuthConnectionReq);
REQUEST_SIZE_MATCH(xAppleDRIAuthConnectionReq);
@@ -161,25 +152,23 @@ ProcAppleDRIAuthConnection(
rep.sequenceNumber = client->sequence;
rep.authenticated = 1;
- if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic)) {
- ErrorF("Failed to authenticate %u\n", (unsigned int)stuff->magic);
+ if (!DRIAuthConnection(screenInfo.screens[stuff->screen], stuff->magic)) {
+ ErrorF("Failed to authenticate %u\n", (unsigned int) stuff->magic);
rep.authenticated = 0;
}
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
- swapl(&rep.authenticated); /* Yes, this is a CARD32 ... sigh */
+ swapl(&rep.authenticated); /* Yes, this is a CARD32 ... sigh */
}
- WriteToClient(client, sizeof(xAppleDRIAuthConnectionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xAppleDRIAuthConnectionReply), (char *) &rep);
return Success;
}
-static void surface_notify(
- void *_arg,
- void *data
-)
+static void
+surface_notify(void *_arg, void *data)
{
DRISurfaceNotifyArg *arg = _arg;
int client_index = (int) x_cvt_vptr_to_uint(data);
@@ -192,13 +181,11 @@ static void surface_notify(
se.kind = arg->kind;
se.arg = arg->id;
se.time = currentTime.milliseconds;
- WriteEventsToClient (clients[client_index], 1, (xEvent *) &se);
+ WriteEventsToClient(clients[client_index], 1, (xEvent *) &se);
}
static int
-ProcAppleDRICreateSurface(
- ClientPtr client
-)
+ProcAppleDRICreateSurface(ClientPtr client)
{
xAppleDRICreateSurfaceReply rep;
DrawablePtr pDrawable;
@@ -213,17 +200,16 @@ ProcAppleDRICreateSurface(
rep.sequenceNumber = client->sequence;
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.key_0 = rep.key_1 = rep.uid = 0;
- if (!DRICreateSurface( screenInfo.screens[stuff->screen],
- (Drawable)stuff->drawable, pDrawable,
- stuff->client_id, &sid, key,
- surface_notify,
- x_cvt_uint_to_vptr(client->index))) {
+ if (!DRICreateSurface(screenInfo.screens[stuff->screen],
+ (Drawable) stuff->drawable, pDrawable,
+ stuff->client_id, &sid, key,
+ surface_notify, x_cvt_uint_to_vptr(client->index))) {
return BadValue;
}
@@ -239,28 +225,27 @@ ProcAppleDRICreateSurface(
swapl(&rep.uid);
}
- WriteToClient(client, sizeof(xAppleDRICreateSurfaceReply), (char *)&rep);
+ WriteToClient(client, sizeof(xAppleDRICreateSurfaceReply), (char *) &rep);
return Success;
}
static int
-ProcAppleDRIDestroySurface(
- register ClientPtr client
-)
+ProcAppleDRIDestroySurface(register ClientPtr client)
{
int rc;
+
REQUEST(xAppleDRIDestroySurfaceReq);
DrawablePtr pDrawable;
+
REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq);
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
- if (!DRIDestroySurface( screenInfo.screens[stuff->screen],
- (Drawable)stuff->drawable,
- pDrawable, NULL, NULL)) {
+ if (!DRIDestroySurface(screenInfo.screens[stuff->screen],
+ (Drawable) stuff->drawable, pDrawable, NULL, NULL)) {
return BadValue;
}
@@ -283,23 +268,21 @@ ProcAppleDRICreatePixmap(ClientPtr client)
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
- if(rc != Success)
+ if (rc != Success)
return rc;
-
- if(!DRICreatePixmap(screenInfo.screens[stuff->screen],
- (Drawable)stuff->drawable,
- pDrawable,
- path, PATH_MAX)) {
+
+ if (!DRICreatePixmap(screenInfo.screens[stuff->screen],
+ (Drawable) stuff->drawable,
+ pDrawable, path, PATH_MAX)) {
+ return BadValue;
+ }
+
+ if (!DRIGetPixmapData(pDrawable, &width, &height, &pitch, &bpp, &ptr)) {
return BadValue;
}
- if(!DRIGetPixmapData(pDrawable, &width, &height,
- &pitch, &bpp, &ptr)) {
- return BadValue;
- }
-
rep.stringLength = strlen(path) + 1;
-
+
rep.type = X_Reply;
rep.length = bytes_to_int32(rep.stringLength);
rep.sequenceNumber = client->sequence;
@@ -309,9 +292,9 @@ ProcAppleDRICreatePixmap(ClientPtr client)
rep.bpp = bpp;
rep.size = pitch * height;
- if(sizeof(rep) != sz_xAppleDRICreatePixmapReply)
- ErrorF("error sizeof(rep) is %zu\n", sizeof(rep));
-
+ if (sizeof(rep) != sz_xAppleDRICreatePixmapReply)
+ ErrorF("error sizeof(rep) is %zu\n", sizeof(rep));
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -334,15 +317,16 @@ ProcAppleDRIDestroyPixmap(ClientPtr client)
{
DrawablePtr pDrawable;
int rc;
+
REQUEST(xAppleDRIDestroyPixmapReq);
REQUEST_SIZE_MATCH(xAppleDRIDestroyPixmapReq);
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ DixReadAccess);
+
+ if (rc != Success)
+ return rc;
- if(rc != Success)
- return rc;
-
DRIDestroyPixmap(pDrawable);
return Success;
@@ -351,14 +335,11 @@ ProcAppleDRIDestroyPixmap(ClientPtr client)
/* dispatch */
static int
-ProcAppleDRIDispatch (
- register ClientPtr client
-)
+ProcAppleDRIDispatch(register ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_AppleDRIQueryVersion:
return ProcAppleDRIQueryVersion(client);
case X_AppleDRIQueryDirectRenderingCapable:
@@ -368,8 +349,7 @@ ProcAppleDRIDispatch (
if (!LocalClient(client))
return DRIErrorBase + AppleDRIClientNotLocal;
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_AppleDRIAuthConnection:
return ProcAppleDRIAuthConnection(client);
case X_AppleDRICreateSurface:
@@ -377,9 +357,9 @@ ProcAppleDRIDispatch (
case X_AppleDRIDestroySurface:
return ProcAppleDRIDestroySurface(client);
case X_AppleDRICreatePixmap:
- return ProcAppleDRICreatePixmap(client);
+ return ProcAppleDRICreatePixmap(client);
case X_AppleDRIDestroyPixmap:
- return ProcAppleDRIDestroyPixmap(client);
+ return ProcAppleDRIDestroyPixmap(client);
default:
return BadRequest;
@@ -387,22 +367,17 @@ ProcAppleDRIDispatch (
}
static void
-SNotifyEvent(
- xAppleDRINotifyEvent *from,
- xAppleDRINotifyEvent *to
-)
+SNotifyEvent(xAppleDRINotifyEvent * from, xAppleDRINotifyEvent * to)
{
to->type = from->type;
to->kind = from->kind;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->time, to->time);
- cpswapl (from->arg, to->arg);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->time, to->time);
+ cpswapl(from->arg, to->arg);
}
static int
-SProcAppleDRIQueryVersion(
- register ClientPtr client
-)
+SProcAppleDRIQueryVersion(register ClientPtr client)
{
REQUEST(xAppleDRIQueryVersionReq);
swaps(&stuff->length);
@@ -410,9 +385,7 @@ SProcAppleDRIQueryVersion(
}
static int
-SProcAppleDRIQueryDirectRenderingCapable(
- register ClientPtr client
-)
+SProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client)
{
REQUEST(xAppleDRIQueryDirectRenderingCapableReq);
swaps(&stuff->length);
@@ -421,9 +394,7 @@ SProcAppleDRIQueryDirectRenderingCapable(
}
static int
-SProcAppleDRIAuthConnection(
- register ClientPtr client
-)
+SProcAppleDRIAuthConnection(register ClientPtr client)
{
REQUEST(xAppleDRIAuthConnectionReq);
swaps(&stuff->length);
@@ -433,9 +404,7 @@ SProcAppleDRIAuthConnection(
}
static int
-SProcAppleDRICreateSurface(
- register ClientPtr client
-)
+SProcAppleDRICreateSurface(register ClientPtr client)
{
REQUEST(xAppleDRICreateSurfaceReq);
swaps(&stuff->length);
@@ -446,9 +415,7 @@ SProcAppleDRICreateSurface(
}
static int
-SProcAppleDRIDestroySurface(
- register ClientPtr client
-)
+SProcAppleDRIDestroySurface(register ClientPtr client)
{
REQUEST(xAppleDRIDestroySurfaceReq);
swaps(&stuff->length);
@@ -458,9 +425,7 @@ SProcAppleDRIDestroySurface(
}
static int
-SProcAppleDRICreatePixmap(
- register ClientPtr client
-)
+SProcAppleDRICreatePixmap(register ClientPtr client)
{
REQUEST(xAppleDRICreatePixmapReq);
swaps(&stuff->length);
@@ -470,9 +435,7 @@ SProcAppleDRICreatePixmap(
}
static int
-SProcAppleDRIDestroyPixmap(
- register ClientPtr client
-)
+SProcAppleDRIDestroyPixmap(register ClientPtr client)
{
REQUEST(xAppleDRIDestroyPixmapReq);
swaps(&stuff->length);
@@ -481,14 +444,11 @@ SProcAppleDRIDestroyPixmap(
}
static int
-SProcAppleDRIDispatch (
- register ClientPtr client
-)
+SProcAppleDRIDispatch(register ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_AppleDRIQueryVersion:
return SProcAppleDRIQueryVersion(client);
case X_AppleDRIQueryDirectRenderingCapable:
@@ -498,8 +458,7 @@ SProcAppleDRIDispatch (
if (!LocalClient(client))
return DRIErrorBase + AppleDRIClientNotLocal;
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_AppleDRIAuthConnection:
return SProcAppleDRIAuthConnection(client);
case X_AppleDRICreateSurface:
@@ -507,9 +466,9 @@ SProcAppleDRIDispatch (
case X_AppleDRIDestroySurface:
return SProcAppleDRIDestroySurface(client);
case X_AppleDRICreatePixmap:
- return SProcAppleDRICreatePixmap(client);
+ return SProcAppleDRICreatePixmap(client);
case X_AppleDRIDestroyPixmap:
- return SProcAppleDRIDestroyPixmap(client);
+ return SProcAppleDRIDestroyPixmap(client);
default:
return BadRequest;
@@ -519,7 +478,7 @@ SProcAppleDRIDispatch (
void
AppleDRIExtensionInit(void)
{
- ExtensionEntry* extEntry;
+ ExtensionEntry *extEntry;
if (DRIExtensionInit() &&
(extEntry = AddExtension(APPLEDRINAME,
@@ -527,13 +486,13 @@ AppleDRIExtensionInit(void)
AppleDRINumberErrors,
ProcAppleDRIDispatch,
SProcAppleDRIDispatch,
- AppleDRIResetProc,
- StandardMinorOpcode))) {
+ AppleDRIResetProc, StandardMinorOpcode))) {
size_t i;
- DRIReqCode = (unsigned char)extEntry->base;
+
+ DRIReqCode = (unsigned char) extEntry->base;
DRIErrorBase = extEntry->errorBase;
DRIEventBase = extEntry->eventBase;
- for (i=0; i < AppleDRINumberEvents; i++)
+ for (i = 0; i < AppleDRINumberEvents; i++)
EventSwapVector[DRIEventBase + i] = (EventSwapPtr) SNotifyEvent;
}
}
diff --git a/xorg-server/hw/xquartz/xpr/appledristr.h b/xorg-server/hw/xquartz/xpr/appledristr.h
index b5ffe5b46..131a699d9 100644
--- a/xorg-server/hw/xquartz/xpr/appledristr.h
+++ b/xorg-server/hw/xquartz/xpr/appledristr.h
@@ -46,207 +46,200 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define APPLE_DRI_MINOR_VERSION 0
#define APPLE_DRI_PATCH_VERSION 0
-typedef struct _AppleDRIQueryVersion
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIQueryVersion */
- CARD16 length B16;
+typedef struct _AppleDRIQueryVersion {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIQueryVersion */
+ CARD16 length B16;
} xAppleDRIQueryVersionReq;
+
#define sz_xAppleDRIQueryVersionReq 4
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD16 majorVersion B16; /* major version of DRI protocol */
- CARD16 minorVersion B16; /* minor version of DRI protocol */
- CARD32 patchVersion B32; /* patch version of DRI protocol */
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16; /* major version of DRI protocol */
+ CARD16 minorVersion B16; /* minor version of DRI protocol */
+ CARD32 patchVersion B32; /* patch version of DRI protocol */
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xAppleDRIQueryVersionReply;
+
#define sz_xAppleDRIQueryVersionReply 32
-typedef struct _AppleDRIQueryDirectRenderingCapable
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
- CARD16 length B16;
- CARD32 screen B32;
+typedef struct _AppleDRIQueryDirectRenderingCapable {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
+ CARD16 length B16;
+ CARD32 screen B32;
} xAppleDRIQueryDirectRenderingCapableReq;
+
#define sz_xAppleDRIQueryDirectRenderingCapableReq 8
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- BOOL isCapable;
- BOOL pad2;
- BOOL pad3;
- BOOL pad4;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
- CARD32 pad8 B32;
- CARD32 pad9 B32;
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ BOOL isCapable;
+ BOOL pad2;
+ BOOL pad3;
+ BOOL pad4;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+ CARD32 pad8 B32;
+ CARD32 pad9 B32;
} xAppleDRIQueryDirectRenderingCapableReply;
+
#define sz_xAppleDRIQueryDirectRenderingCapableReply 32
-typedef struct _AppleDRIAuthConnection
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICloseConnection */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 magic B32;
+typedef struct _AppleDRIAuthConnection {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICloseConnection */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 magic B32;
} xAppleDRIAuthConnectionReq;
+
#define sz_xAppleDRIAuthConnectionReq 12
-typedef struct
-{
- BYTE type;
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 authenticated B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
+typedef struct {
+ BYTE type;
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 authenticated B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xAppleDRIAuthConnectionReply;
+
#define zx_xAppleDRIAuthConnectionReply 32
-typedef struct _AppleDRICreateSurface
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICreateSurface */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
- CARD32 client_id B32;
+typedef struct _AppleDRICreateSurface {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICreateSurface */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
+ CARD32 client_id B32;
} xAppleDRICreateSurfaceReq;
+
#define sz_xAppleDRICreateSurfaceReq 16
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 key_0 B32;
- CARD32 key_1 B32;
- CARD32 uid B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 key_0 B32;
+ CARD32 key_1 B32;
+ CARD32 uid B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xAppleDRICreateSurfaceReply;
+
#define sz_xAppleDRICreateSurfaceReply 32
-typedef struct _AppleDRIDestroySurface
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIDestroySurface */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
+typedef struct _AppleDRIDestroySurface {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIDestroySurface */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
} xAppleDRIDestroySurfaceReq;
+
#define sz_xAppleDRIDestroySurfaceReq 12
-typedef struct _AppleDRINotify
-{
- BYTE type; /* always eventBase + event type */
- BYTE kind;
- CARD16 sequenceNumber B16;
- CARD32 time B32; /* time of change */
- CARD32 pad1 B32;
- CARD32 arg B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
+typedef struct _AppleDRINotify {
+ BYTE type; /* always eventBase + event type */
+ BYTE kind;
+ CARD16 sequenceNumber B16;
+ CARD32 time B32; /* time of change */
+ CARD32 pad1 B32;
+ CARD32 arg B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xAppleDRINotifyEvent;
-#define sz_xAppleDRINotifyEvent 32
+#define sz_xAppleDRINotifyEvent 32
-typedef struct
-{
- CARD8 reqType;
- CARD8 driReqType;
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
- BOOL doubleSwap;
- CARD8 pad1, pad2, pad3;
+typedef struct {
+ CARD8 reqType;
+ CARD8 driReqType;
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
+ BOOL doubleSwap;
+ CARD8 pad1, pad2, pad3;
} xAppleDRICreateSharedBufferReq;
#define sz_xAppleDRICreateSharedBufferReq 16
-typedef struct
-{
- BYTE type;
- BYTE data1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 stringLength B32; /* 0 on error */
- CARD32 width B32;
- CARD32 height B32;
- CARD32 pad1 B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
+typedef struct {
+ BYTE type;
+ BYTE data1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 stringLength B32; /* 0 on error */
+ CARD32 width B32;
+ CARD32 height B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
} xAppleDRICreateSharedBufferReply;
#define sz_xAppleDRICreateSharedBufferReply 32
-typedef struct
-{
- CARD8 reqType;
- CARD8 driReqType;
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
+typedef struct {
+ CARD8 reqType;
+ CARD8 driReqType;
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
} xAppleDRISwapBuffersReq;
#define sz_xAppleDRISwapBuffersReq 12
-typedef struct
-{
- CARD8 reqType; /*1 */
- CARD8 driReqType; /*2 */
- CARD16 length B16; /*4 */
- CARD32 screen B32; /*8 */
- CARD32 drawable B32; /*12 */
+typedef struct {
+ CARD8 reqType; /*1 */
+ CARD8 driReqType; /*2 */
+ CARD16 length B16; /*4 */
+ CARD32 screen B32; /*8 */
+ CARD32 drawable B32; /*12 */
} xAppleDRICreatePixmapReq;
#define sz_xAppleDRICreatePixmapReq 12
-typedef struct
-{
- BYTE type; /*1 */
- BOOL pad1; /*2 */
- CARD16 sequenceNumber B16; /*4 */
- CARD32 length B32; /*8 */
- CARD32 width B32; /*12 */
- CARD32 height B32; /*16 */
- CARD32 pitch B32; /*20 */
- CARD32 bpp B32; /*24 */
- CARD32 size B32; /*28 */
- CARD32 stringLength B32; /*32 */
+typedef struct {
+ BYTE type; /*1 */
+ BOOL pad1; /*2 */
+ CARD16 sequenceNumber B16; /*4 */
+ CARD32 length B32; /*8 */
+ CARD32 width B32; /*12 */
+ CARD32 height B32; /*16 */
+ CARD32 pitch B32; /*20 */
+ CARD32 bpp B32; /*24 */
+ CARD32 size B32; /*28 */
+ CARD32 stringLength B32; /*32 */
} xAppleDRICreatePixmapReply;
#define sz_xAppleDRICreatePixmapReply 32
-typedef struct
-{
- CARD8 reqType; /*1 */
- CARD8 driReqType; /*2 */
- CARD16 length B16; /*4 */
- CARD32 drawable B32; /*8 */
+typedef struct {
+ CARD8 reqType; /*1 */
+ CARD8 driReqType; /*2 */
+ CARD16 length B16; /*4 */
+ CARD32 drawable B32; /*8 */
} xAppleDRIDestroyPixmapReq;
#define sz_xAppleDRIDestroyPixmapReq 8
@@ -255,12 +248,12 @@ typedef struct
void AppleDRISendEvent(
#if NeedFunctionPrototypes
- int /* type */ ,
- unsigned int /* mask */ ,
- int /* which */ ,
- int /* arg */
+ int /* type */ ,
+ unsigned int /* mask */ ,
+ int /* which */ ,
+ int /* arg */
#endif
- );
+ );
-#endif /* _APPLEDRI_SERVER_ */
-#endif /* _APPLEDRISTR_H_ */
+#endif /* _APPLEDRI_SERVER_ */
+#endif /* _APPLEDRISTR_H_ */
diff --git a/xorg-server/hw/xquartz/xpr/dri.c b/xorg-server/hw/xquartz/xpr/dri.c
index a58f2c76d..0ce1d0771 100644
--- a/xorg-server/hw/xquartz/xpr/dri.c
+++ b/xorg-server/hw/xquartz/xpr/dri.c
@@ -75,12 +75,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <AvailabilityMacros.h>
static DevPrivateKeyRec DRIScreenPrivKeyRec;
+
#define DRIScreenPrivKey (&DRIScreenPrivKeyRec)
static DevPrivateKeyRec DRIWindowPrivKeyRec;
+
#define DRIWindowPrivKey (&DRIWindowPrivKeyRec)
static DevPrivateKeyRec DRIPixmapPrivKeyRec;
+
#define DRIPixmapPrivKey (&DRIPixmapPrivKeyRec)
static DevPrivateKeyRec DRIPixmapBufferPrivKeyRec;
+
#define DRIPixmapBufferPrivKey (&DRIPixmapBufferPrivKeyRec)
static RESTYPE DRIDrawablePrivResType;
@@ -96,29 +100,29 @@ typedef struct {
int width;
int height;
char shmPath[PATH_MAX];
- int fd; /* From shm_open (for now) */
- size_t length; /* length of buffer */
- void *buffer;
+ int fd; /* From shm_open (for now) */
+ size_t length; /* length of buffer */
+ void *buffer;
} DRIPixmapBuffer, *DRIPixmapBufferPtr;
Bool
DRIScreenInit(ScreenPtr pScreen)
{
- DRIScreenPrivPtr pDRIPriv;
- int i;
+ DRIScreenPrivPtr pDRIPriv;
+ int i;
if (!dixRegisterPrivateKey(&DRIScreenPrivKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&DRIWindowPrivKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&DRIPixmapPrivKeyRec, PRIVATE_PIXMAP, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&DRIPixmapBufferPrivKeyRec, PRIVATE_PIXMAP, 0))
- return FALSE;
+ return FALSE;
pDRIPriv = (DRIScreenPrivPtr) calloc(1, sizeof(DRIScreenPrivRec));
if (!pDRIPriv) {
- dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
return FALSE;
}
@@ -137,7 +141,7 @@ DRIScreenInit(ScreenPtr pScreen)
Bool
DRIFinishScreenInit(ScreenPtr pScreen)
{
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
/* Wrap DRI support */
pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
@@ -167,7 +171,7 @@ DRICloseScreen(ScreenPtr pScreen)
if (pDRIPriv && pDRIPriv->directRenderingSupport) {
free(pDRIPriv);
- dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
}
}
@@ -175,7 +179,7 @@ Bool
DRIExtensionInit(void)
{
DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete,
- "DRIDrawable");
+ "DRIDrawable");
return DRIDrawablePrivResType != 0;
}
@@ -193,7 +197,7 @@ DRIReset(void)
}
Bool
-DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool* isCapable)
+DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
@@ -213,7 +217,8 @@ DRIAuthConnection(ScreenPtr pScreen, unsigned int magic)
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE;
+ if (drmAuthMagic(pDRIPriv->drmFD, magic))
+ return FALSE;
#endif
return TRUE;
}
@@ -246,12 +251,13 @@ DRIUpdateSurface(DRIDrawablePrivPtr pDRIDrawablePriv, DrawablePtr pDraw)
wc.shape_nrects = RegionNumRects(&pWin->clipList);
wc.shape_rects = RegionRects(&pWin->clipList);
- wc.shape_tx = - (pTopWin->drawable.x - pTopWin->borderWidth);
- wc.shape_ty = - (pTopWin->drawable.y - pTopWin->borderWidth);
+ wc.shape_tx = -(pTopWin->drawable.x - pTopWin->borderWidth);
+ wc.shape_ty = -(pTopWin->drawable.y - pTopWin->borderWidth);
flags |= XP_BOUNDS | XP_SHAPE;
- } else if (pDraw->type == DRAWABLE_PIXMAP) {
+ }
+ else if (pDraw->type == DRAWABLE_PIXMAP) {
wc.x = 0;
wc.y = 0;
wc.width = pDraw->width;
@@ -265,7 +271,8 @@ DRIUpdateSurface(DRIDrawablePrivPtr pDRIDrawablePriv, DrawablePtr pDraw)
/* Return NULL if an error occurs. */
static DRIDrawablePrivPtr
-CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr) {
+CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id * widPtr)
+{
DRIDrawablePrivPtr pDRIDrawablePriv;
xp_window_id wid = 0;
@@ -274,50 +281,49 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
if (pDRIDrawablePriv == NULL) {
- xp_error err;
- xp_window_changes wc;
-
- /* allocate a DRI Window Private record */
- if (!(pDRIDrawablePriv = malloc(sizeof(*pDRIDrawablePriv)))) {
- return NULL;
- }
-
- pDRIDrawablePriv->pDraw = (DrawablePtr)pWin;
- pDRIDrawablePriv->pScreen = pScreen;
- pDRIDrawablePriv->refCount = 0;
- pDRIDrawablePriv->drawableIndex = -1;
- pDRIDrawablePriv->notifiers = NULL;
-
- /* find the physical window */
- wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE));
-
- if (wid == 0) {
- free(pDRIDrawablePriv);
- return NULL;
- }
-
- /* allocate the physical surface */
- err = xp_create_surface(wid, &pDRIDrawablePriv->sid);
-
- if (err != Success) {
- free(pDRIDrawablePriv);
- return NULL;
- }
-
- /* Make it visible */
- wc.stack_mode = XP_MAPPED_ABOVE;
- wc.sibling = 0;
- err = xp_configure_surface(pDRIDrawablePriv->sid, XP_STACKING, &wc);
-
- if (err != Success) {
- xp_destroy_surface(pDRIDrawablePriv->sid);
- free(pDRIDrawablePriv);
- return NULL;
- }
-
- /* save private off of preallocated index */
- dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
- pDRIDrawablePriv);
+ xp_error err;
+ xp_window_changes wc;
+
+ /* allocate a DRI Window Private record */
+ if (!(pDRIDrawablePriv = malloc(sizeof(*pDRIDrawablePriv)))) {
+ return NULL;
+ }
+
+ pDRIDrawablePriv->pDraw = (DrawablePtr) pWin;
+ pDRIDrawablePriv->pScreen = pScreen;
+ pDRIDrawablePriv->refCount = 0;
+ pDRIDrawablePriv->drawableIndex = -1;
+ pDRIDrawablePriv->notifiers = NULL;
+
+ /* find the physical window */
+ wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE));
+
+ if (wid == 0) {
+ free(pDRIDrawablePriv);
+ return NULL;
+ }
+
+ /* allocate the physical surface */
+ err = xp_create_surface(wid, &pDRIDrawablePriv->sid);
+
+ if (err != Success) {
+ free(pDRIDrawablePriv);
+ return NULL;
+ }
+
+ /* Make it visible */
+ wc.stack_mode = XP_MAPPED_ABOVE;
+ wc.sibling = 0;
+ err = xp_configure_surface(pDRIDrawablePriv->sid, XP_STACKING, &wc);
+
+ if (err != Success) {
+ xp_destroy_surface(pDRIDrawablePriv->sid);
+ free(pDRIDrawablePriv);
+ return NULL;
+ }
+
+ /* save private off of preallocated index */
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, pDRIDrawablePriv);
}
*widPtr = wid;
@@ -327,111 +333,109 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
/* Return NULL if an error occurs. */
static DRIDrawablePrivPtr
-CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
+CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix)
+{
DRIDrawablePrivPtr pDRIDrawablePriv;
-
+
pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix);
if (pDRIDrawablePriv == NULL) {
- xp_error err;
-
- /* allocate a DRI Window Private record */
- if (!(pDRIDrawablePriv = calloc(1, sizeof(*pDRIDrawablePriv)))) {
- return NULL;
- }
-
- pDRIDrawablePriv->pDraw = (DrawablePtr)pPix;
- pDRIDrawablePriv->pScreen = pScreen;
- pDRIDrawablePriv->refCount = 0;
- pDRIDrawablePriv->drawableIndex = -1;
- pDRIDrawablePriv->notifiers = NULL;
-
- /* Passing a null window id to Xplugin in 10.3+ asks for
- an accelerated offscreen surface. */
-
- err = xp_create_surface(0, &pDRIDrawablePriv->sid);
- if (err != Success) {
- free(pDRIDrawablePriv);
- return NULL;
- }
-
- /*
- * The DRIUpdateSurface will be called to resize the surface
- * after this function, if the export is successful.
- */
-
- /* save private off of preallocated index */
- dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey,
- pDRIDrawablePriv);
- }
-
+ xp_error err;
+
+ /* allocate a DRI Window Private record */
+ if (!(pDRIDrawablePriv = calloc(1, sizeof(*pDRIDrawablePriv)))) {
+ return NULL;
+ }
+
+ pDRIDrawablePriv->pDraw = (DrawablePtr) pPix;
+ pDRIDrawablePriv->pScreen = pScreen;
+ pDRIDrawablePriv->refCount = 0;
+ pDRIDrawablePriv->drawableIndex = -1;
+ pDRIDrawablePriv->notifiers = NULL;
+
+ /* Passing a null window id to Xplugin in 10.3+ asks for
+ an accelerated offscreen surface. */
+
+ err = xp_create_surface(0, &pDRIDrawablePriv->sid);
+ if (err != Success) {
+ free(pDRIDrawablePriv);
+ return NULL;
+ }
+
+ /*
+ * The DRIUpdateSurface will be called to resize the surface
+ * after this function, if the export is successful.
+ */
+
+ /* save private off of preallocated index */
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, pDRIDrawablePriv);
+ }
+
return pDRIDrawablePriv;
}
-
Bool
DRICreateSurface(ScreenPtr pScreen, Drawable id,
DrawablePtr pDrawable, xp_client_id client_id,
- xp_surface_id *surface_id, unsigned int ret_key[2],
+ xp_surface_id * surface_id, unsigned int ret_key[2],
void (*notify) (void *arg, void *data), void *notify_data)
{
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- xp_window_id wid = 0;
- DRIDrawablePrivPtr pDRIDrawablePriv;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ xp_window_id wid = 0;
+ DRIDrawablePrivPtr pDRIDrawablePriv;
if (pDrawable->type == DRAWABLE_WINDOW) {
- pDRIDrawablePriv = CreateSurfaceForWindow(pScreen,
- (WindowPtr)pDrawable, &wid);
+ pDRIDrawablePriv = CreateSurfaceForWindow(pScreen,
+ (WindowPtr) pDrawable, &wid);
- if(NULL == pDRIDrawablePriv)
- return FALSE; /*error*/
+ if (NULL == pDRIDrawablePriv)
+ return FALSE; /*error */
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
else if (pDrawable->type == DRAWABLE_PIXMAP) {
- pDRIDrawablePriv = CreateSurfaceForPixmap(pScreen,
- (PixmapPtr)pDrawable);
+ pDRIDrawablePriv = CreateSurfaceForPixmap(pScreen,
+ (PixmapPtr) pDrawable);
- if(NULL == pDRIDrawablePriv)
- return FALSE; /*error*/
+ if (NULL == pDRIDrawablePriv)
+ return FALSE; /*error */
}
#endif
else {
- /* We handle GLXPbuffers in a different way (via CGL). */
+ /* We handle GLXPbuffers in a different way (via CGL). */
return FALSE;
}
-
-
+
/* Finish initialization of new surfaces */
if (pDRIDrawablePriv->refCount == 0) {
- unsigned int key[2] = {0};
+ unsigned int key[2] = { 0 };
xp_error err;
/* try to give the client access to the surface */
if (client_id != 0) {
- /*
- * Xplugin accepts a 0 wid if the surface id is offscreen, such
- * as for a pixmap.
- */
- err = xp_export_surface(wid, pDRIDrawablePriv->sid,
- client_id, key);
+ /*
+ * Xplugin accepts a 0 wid if the surface id is offscreen, such
+ * as for a pixmap.
+ */
+ err = xp_export_surface(wid, pDRIDrawablePriv->sid, client_id, key);
if (err != Success) {
xp_destroy_surface(pDRIDrawablePriv->sid);
free(pDRIDrawablePriv);
-
- /*
- * Now set the dix privates to NULL that were previously set.
- * This prevents reusing an invalid pointer.
- */
- if(pDrawable->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDrawable;
-
- dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
- } else if(pDrawable->type == DRAWABLE_PIXMAP) {
- PixmapPtr pPix = (PixmapPtr)pDrawable;
-
- dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL);
- }
-
+
+ /*
+ * Now set the dix privates to NULL that were previously set.
+ * This prevents reusing an invalid pointer.
+ */
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDrawable;
+
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
+ }
+ else if (pDrawable->type == DRAWABLE_PIXMAP) {
+ PixmapPtr pPix = (PixmapPtr) pDrawable;
+
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL);
+ }
+
return FALSE;
}
}
@@ -445,10 +449,11 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
if (surface_hash == NULL)
surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL);
x_hash_table_insert(surface_hash,
- x_cvt_uint_to_vptr(pDRIDrawablePriv->sid), pDRIDrawablePriv);
+ x_cvt_uint_to_vptr(pDRIDrawablePriv->sid),
+ pDRIDrawablePriv);
/* track this in case this window is destroyed */
- AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable);
+ AddResource(id, DRIDrawablePrivResType, (pointer) pDrawable);
/* Initialize shape */
DRIUpdateSurface(pDRIDrawablePriv, pDrawable);
@@ -475,38 +480,40 @@ Bool
DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
void (*notify) (void *, void *), void *notify_data)
{
- DRIDrawablePrivPtr pDRIDrawablePriv;
+ DRIDrawablePrivPtr pDRIDrawablePriv;
if (pDrawable->type == DRAWABLE_WINDOW) {
- pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW((WindowPtr)pDrawable);
- } else if (pDrawable->type == DRAWABLE_PIXMAP) {
- pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP((PixmapPtr)pDrawable);
- } else {
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW((WindowPtr) pDrawable);
+ }
+ else if (pDrawable->type == DRAWABLE_PIXMAP) {
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP((PixmapPtr) pDrawable);
+ }
+ else {
return FALSE;
}
if (pDRIDrawablePriv != NULL) {
- /*
- * This doesn't seem to be used, because notify is NULL in all callers.
- */
+ /*
+ * This doesn't seem to be used, because notify is NULL in all callers.
+ */
if (notify != NULL) {
- pDRIDrawablePriv->notifiers = x_hook_remove(pDRIDrawablePriv->notifiers,
- notify, notify_data);
+ pDRIDrawablePriv->notifiers =
+ x_hook_remove(pDRIDrawablePriv->notifiers, notify, notify_data);
}
- --pDRIDrawablePriv->refCount;
+ --pDRIDrawablePriv->refCount;
- /*
- * Check if the drawable privates still have a reference to the
- * surface.
- */
+ /*
+ * Check if the drawable privates still have a reference to the
+ * surface.
+ */
if (pDRIDrawablePriv->refCount <= 0) {
/*
- * This calls back to DRIDrawablePrivDelete which
- * frees the private area and dispatches events, if needed.
- */
+ * This calls back to DRIDrawablePrivDelete which
+ * frees the private area and dispatches events, if needed.
+ */
FreeResourceByType(id, DRIDrawablePrivResType, FALSE);
}
}
@@ -521,38 +528,38 @@ DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
Bool
DRIDrawablePrivDelete(pointer pResource, XID id)
{
- DrawablePtr pDrawable = (DrawablePtr)pResource;
- DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen);
- DRIDrawablePrivPtr pDRIDrawablePriv = NULL;
- WindowPtr pWin = NULL;
- PixmapPtr pPix = NULL;
+ DrawablePtr pDrawable = (DrawablePtr) pResource;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv = NULL;
+ WindowPtr pWin = NULL;
+ PixmapPtr pPix = NULL;
if (pDrawable->type == DRAWABLE_WINDOW) {
- pWin = (WindowPtr)pDrawable;
+ pWin = (WindowPtr) pDrawable;
pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
- } else if (pDrawable->type == DRAWABLE_PIXMAP) {
- pPix = (PixmapPtr)pDrawable;
+ }
+ else if (pDrawable->type == DRAWABLE_PIXMAP) {
+ pPix = (PixmapPtr) pDrawable;
pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix);
}
if (pDRIDrawablePriv == NULL) {
- /*
- * We reuse __func__ and the resource type for the GLXPixmap code.
- * Attempt to free a pixmap buffer associated with the resource
- * if possible.
- */
- return DRIFreePixmapImp(pDrawable);
- }
-
+ /*
+ * We reuse __func__ and the resource type for the GLXPixmap code.
+ * Attempt to free a pixmap buffer associated with the resource
+ * if possible.
+ */
+ return DRIFreePixmapImp(pDrawable);
+ }
+
if (pDRIDrawablePriv->drawableIndex != -1) {
/* release drawable table entry */
pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL;
}
if (pDRIDrawablePriv->sid != 0) {
- DRISurfaceNotify(pDRIDrawablePriv->sid, AppleDRISurfaceNotifyDestroyed);
+ DRISurfaceNotify(pDRIDrawablePriv->sid, AppleDRISurfaceNotifyDestroyed);
}
-
if (pDRIDrawablePriv->notifiers != NULL)
x_hook_free(pDRIDrawablePriv->notifiers);
@@ -560,9 +567,10 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
free(pDRIDrawablePriv);
if (pDrawable->type == DRAWABLE_WINDOW) {
- dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
- } else if (pDrawable->type == DRAWABLE_PIXMAP) {
- dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL);
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
+ }
+ else if (pDrawable->type == DRAWABLE_PIXMAP) {
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL);
}
--pDRIPriv->nrWindows;
@@ -583,7 +591,7 @@ DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg)
pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
- (*pScreen->WindowExposures)(pWin, prgn, bsreg);
+ (*pScreen->WindowExposures) (pWin, prgn, bsreg);
pScreen->WindowExposures = DRIWindowExposures;
}
@@ -596,17 +604,17 @@ DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
DRIDrawablePrivPtr pDRIDrawablePriv;
if (pDRIPriv->nrWindows > 0) {
- pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
- if (pDRIDrawablePriv != NULL) {
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+ if (pDRIDrawablePriv != NULL) {
DRIUpdateSurface(pDRIDrawablePriv, &pWin->drawable);
- }
+ }
}
/* unwrap */
pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow;
/* call lower layers */
- (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
/* rewrap */
pScreen->CopyWindow = DRICopyWindow;
@@ -623,7 +631,7 @@ DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
/* call lower layers */
- returnValue = (*pScreen->ValidateTree)(pParent, pChild, kind);
+ returnValue = (*pScreen->ValidateTree) (pParent, pChild, kind);
/* rewrap */
pScreen->ValidateTree = DRIValidateTree;
@@ -639,7 +647,8 @@ DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
if (pParent) {
pScreen = pParent->drawable.pScreen;
- } else {
+ }
+ else {
pScreen = pChild->drawable.pScreen;
}
pDRIPriv = DRI_SCREEN_PRIV(pScreen);
@@ -649,7 +658,7 @@ DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
/* call lower layers */
- (*pScreen->PostValidateTree)(pParent, pChild, kind);
+ (*pScreen->PostValidateTree) (pParent, pChild, kind);
/* rewrap */
pScreen->PostValidateTree = DRIPostValidateTree;
@@ -661,7 +670,7 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- DRIDrawablePrivPtr pDRIDrawablePriv;
+ DRIDrawablePrivPtr pDRIDrawablePriv;
if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
DRIUpdateSurface(pDRIDrawablePriv, &pWin->drawable);
@@ -670,7 +679,7 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy)
if (pDRIPriv->wrap.ClipNotify) {
pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify;
- (*pScreen->ClipNotify)(pWin, dx, dy);
+ (*pScreen->ClipNotify) (pWin, dx, dy);
pScreen->ClipNotify = DRIClipNotify;
}
@@ -687,9 +696,7 @@ DRIGetWrappedFuncs(ScreenPtr pScreen)
}
void
-DRIQueryVersion(int *majorVersion,
- int *minorVersion,
- int *patchVersion)
+DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion)
{
*majorVersion = APPLE_DRI_MAJOR_VERSION;
*minorVersion = APPLE_DRI_MINOR_VERSION;
@@ -700,7 +707,7 @@ DRIQueryVersion(int *majorVersion,
* Note: this also cleans up the hash table in addition to notifying clients.
* The sid/surface-id should not be used after this, because it will be
* invalid.
- */
+ */
void
DRISurfaceNotify(xp_surface_id id, int kind)
{
@@ -710,8 +717,7 @@ DRISurfaceNotify(xp_surface_id id, int kind)
arg.id = id;
arg.kind = kind;
- if (surface_hash != NULL)
- {
+ if (surface_hash != NULL) {
pDRIDrawablePriv = x_hash_table_lookup(surface_hash,
x_cvt_uint_to_vptr(id), NULL);
}
@@ -719,24 +725,22 @@ DRISurfaceNotify(xp_surface_id id, int kind)
if (pDRIDrawablePriv == NULL)
return;
- if (kind == AppleDRISurfaceNotifyDestroyed)
- {
- x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(id));
+ if (kind == AppleDRISurfaceNotifyDestroyed) {
+ x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(id));
}
x_hook_run(pDRIDrawablePriv->notifiers, &arg);
- if (kind == AppleDRISurfaceNotifyDestroyed)
- {
- xp_error error;
-
- error = xp_destroy_surface(pDRIDrawablePriv->sid);
-
- if(error)
- ErrorF("%s: xp_destroy_surface failed: %d\n", __func__, error);
-
- /* Guard against reuse, even though we are freeing after this. */
- pDRIDrawablePriv->sid = 0;
+ if (kind == AppleDRISurfaceNotifyDestroyed) {
+ xp_error error;
+
+ error = xp_destroy_surface(pDRIDrawablePriv->sid);
+
+ if (error)
+ ErrorF("%s: xp_destroy_surface failed: %d\n", __func__, error);
+
+ /* Guard against reuse, even though we are freeing after this. */
+ pDRIDrawablePriv->sid = 0;
FreeResourceByType(pDRIDrawablePriv->pDraw->id,
DRIDrawablePrivResType, FALSE);
@@ -747,137 +751,140 @@ DRISurfaceNotify(xp_surface_id id, int kind)
* This creates a shared memory buffer for use with GLXPixmaps
* and AppleSGLX.
*/
-Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
- DrawablePtr pDrawable, char *path,
- size_t pathmax)
+Bool
+DRICreatePixmap(ScreenPtr pScreen, Drawable id,
+ DrawablePtr pDrawable, char *path, size_t pathmax)
{
DRIPixmapBufferPtr shared;
PixmapPtr pPix;
-
- if(pDrawable->type != DRAWABLE_PIXMAP)
- return FALSE;
- pPix = (PixmapPtr)pDrawable;
+ if (pDrawable->type != DRAWABLE_PIXMAP)
+ return FALSE;
+
+ pPix = (PixmapPtr) pDrawable;
shared = malloc(sizeof(*shared));
- if(NULL == shared) {
+ if (NULL == shared) {
FatalError("failed to allocate DRIPixmapBuffer in %s\n", __func__);
}
-
+
shared->pDrawable = pDrawable;
shared->refCount = 1;
- if(pDrawable->bitsPerPixel >= 24) {
- shared->bytesPerPixel = 4;
- } else if(pDrawable->bitsPerPixel <= 16) {
- shared->bytesPerPixel = 2;
+ if (pDrawable->bitsPerPixel >= 24) {
+ shared->bytesPerPixel = 4;
}
-
+ else if (pDrawable->bitsPerPixel <= 16) {
+ shared->bytesPerPixel = 2;
+ }
+
shared->width = pDrawable->width;
shared->height = pDrawable->height;
-
- if(-1 == snprintf(shared->shmPath, sizeof(shared->shmPath),
- "%d_0x%lx", getpid(),
- (unsigned long)id)) {
+
+ if (-1 == snprintf(shared->shmPath, sizeof(shared->shmPath),
+ "%d_0x%lx", getpid(), (unsigned long) id)) {
FatalError("buffer overflow in %s\n", __func__);
}
-
- shared->fd = shm_open(shared->shmPath,
- O_RDWR | O_EXCL | O_CREAT,
+
+ shared->fd = shm_open(shared->shmPath,
+ O_RDWR | O_EXCL | O_CREAT,
S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH);
-
- if(-1 == shared->fd) {
- free(shared);
+
+ if (-1 == shared->fd) {
+ free(shared);
return FALSE;
- }
-
+ }
+
shared->length = shared->width * shared->height * shared->bytesPerPixel;
-
- if(-1 == ftruncate(shared->fd, shared->length)) {
- ErrorF("failed to ftruncate (extend) file.");
- shm_unlink(shared->shmPath);
- close(shared->fd);
- free(shared);
- return FALSE;
+
+ if (-1 == ftruncate(shared->fd, shared->length)) {
+ ErrorF("failed to ftruncate (extend) file.");
+ shm_unlink(shared->shmPath);
+ close(shared->fd);
+ free(shared);
+ return FALSE;
}
shared->buffer = mmap(NULL, shared->length,
PROT_READ | PROT_WRITE,
MAP_FILE | MAP_SHARED, shared->fd, 0);
-
- if(MAP_FAILED == shared->buffer) {
- ErrorF("failed to mmap shared memory.");
- shm_unlink(shared->shmPath);
- close(shared->fd);
- free(shared);
- return FALSE;
- }
-
+
+ if (MAP_FAILED == shared->buffer) {
+ ErrorF("failed to mmap shared memory.");
+ shm_unlink(shared->shmPath);
+ close(shared->fd);
+ free(shared);
+ return FALSE;
+ }
+
strlcpy(path, shared->shmPath, pathmax);
-
+
dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, shared);
- AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable);
+ AddResource(id, DRIDrawablePrivResType, (pointer) pDrawable);
return TRUE;
}
-
-Bool DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height,
- int *pitch, int *bpp, void **ptr) {
+Bool
+DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height,
+ int *pitch, int *bpp, void **ptr)
+{
PixmapPtr pPix;
DRIPixmapBufferPtr shared;
- if(pDrawable->type != DRAWABLE_PIXMAP)
- return FALSE;
+ if (pDrawable->type != DRAWABLE_PIXMAP)
+ return FALSE;
- pPix = (PixmapPtr)pDrawable;
+ pPix = (PixmapPtr) pDrawable;
shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey);
- if(NULL == shared)
- return FALSE;
+ if (NULL == shared)
+ return FALSE;
assert(pDrawable->width == shared->width);
assert(pDrawable->height == shared->height);
-
+
*width = shared->width;
*height = shared->height;
*bpp = shared->bytesPerPixel;
*pitch = shared->width * shared->bytesPerPixel;
- *ptr = shared->buffer;
+ *ptr = shared->buffer;
return TRUE;
}
static Bool
-DRIFreePixmapImp(DrawablePtr pDrawable) {
+DRIFreePixmapImp(DrawablePtr pDrawable)
+{
DRIPixmapBufferPtr shared;
PixmapPtr pPix;
- if(pDrawable->type != DRAWABLE_PIXMAP)
- return FALSE;
+ if (pDrawable->type != DRAWABLE_PIXMAP)
+ return FALSE;
- pPix = (PixmapPtr)pDrawable;
+ pPix = (PixmapPtr) pDrawable;
shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey);
- if(NULL == shared)
- return FALSE;
+ if (NULL == shared)
+ return FALSE;
close(shared->fd);
munmap(shared->buffer, shared->length);
shm_unlink(shared->shmPath);
free(shared);
- dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (pointer)NULL);
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (pointer) NULL);
return TRUE;
}
-void
-DRIDestroyPixmap(DrawablePtr pDrawable) {
- if(DRIFreePixmapImp(pDrawable))
- FreeResourceByType(pDrawable->id, DRIDrawablePrivResType, FALSE);
+void
+DRIDestroyPixmap(DrawablePtr pDrawable)
+{
+ if (DRIFreePixmapImp(pDrawable))
+ FreeResourceByType(pDrawable->id, DRIDrawablePrivResType, FALSE);
}
diff --git a/xorg-server/hw/xquartz/xpr/dri.h b/xorg-server/hw/xquartz/xpr/dri.h
index 48fea3668..b4342617c 100644
--- a/xorg-server/hw/xquartz/xpr/dri.h
+++ b/xorg-server/hw/xquartz/xpr/dri.h
@@ -43,8 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "appledri.h"
#include <Xplugin.h>
-typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
-
+typedef void (*ClipNotifyPtr) (WindowPtr, int, int);
/*
* These functions can be wrapped by the DRI. Each of these have
@@ -52,11 +51,11 @@ typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
* overridden by the driver in its [driver]DRIScreenInit function.
*/
typedef struct {
- WindowExposuresProcPtr WindowExposures;
- CopyWindowProcPtr CopyWindow;
- ValidateTreeProcPtr ValidateTree;
- PostValidateTreeProcPtr PostValidateTree;
- ClipNotifyProcPtr ClipNotify;
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ ClipNotifyProcPtr ClipNotify;
} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
typedef struct {
@@ -74,8 +73,7 @@ extern Bool DRIExtensionInit(void);
extern void DRIReset(void);
-extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
- Bool *isCapable);
+extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable);
extern Bool DRIAuthConnection(ScreenPtr pScreen, unsigned int magic);
@@ -83,55 +81,43 @@ extern Bool DRICreateSurface(ScreenPtr pScreen,
Drawable id,
DrawablePtr pDrawable,
xp_client_id client_id,
- xp_surface_id *surface_id,
+ xp_surface_id * surface_id,
unsigned int key[2],
void (*notify) (void *arg, void *data),
void *notify_data);
extern Bool DRIDestroySurface(ScreenPtr pScreen,
- Drawable id,
- DrawablePtr pDrawable,
- void (*notify) (void *arg, void *data),
- void *notify_data);
+ Drawable id,
+ DrawablePtr pDrawable,
+ void (*notify) (void *arg, void *data),
+ void *notify_data);
-extern Bool DRIDrawablePrivDelete(pointer pResource,
- XID id);
+extern Bool DRIDrawablePrivDelete(pointer pResource, XID id);
extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
extern void DRICopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
+ DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-extern int DRIValidateTree(WindowPtr pParent,
- WindowPtr pChild,
- VTKind kind);
+extern int DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind);
extern void DRIPostValidateTree(WindowPtr pParent,
- WindowPtr pChild,
- VTKind kind);
+ WindowPtr pChild, VTKind kind);
-extern void DRIClipNotify(WindowPtr pWin,
- int dx,
- int dy);
+extern void DRIClipNotify(WindowPtr pWin, int dx, int dy);
-extern void DRIWindowExposures(WindowPtr pWin,
- RegionPtr prgn,
- RegionPtr bsreg);
+extern void DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg);
-extern void DRISurfaceNotify (xp_surface_id id, int kind);
+extern void DRISurfaceNotify(xp_surface_id id, int kind);
extern void DRIQueryVersion(int *majorVersion,
- int *minorVersion,
- int *patchVersion);
+ int *minorVersion, int *patchVersion);
extern Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
- DrawablePtr pDrawable, char *path,
- size_t pathmax);
+ DrawablePtr pDrawable, char *path, size_t pathmax);
extern Bool DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height,
- int *pitch, int *bpp, void **ptr);
-
+ int *pitch, int *bpp, void **ptr);
extern void DRIDestroyPixmap(DrawablePtr pDrawable);
diff --git a/xorg-server/hw/xquartz/xpr/driWrap.c b/xorg-server/hw/xquartz/xpr/driWrap.c
index c38761555..eca31b263 100644
--- a/xorg-server/hw/xquartz/xpr/driWrap.c
+++ b/xorg-server/hw/xquartz/xpr/driWrap.c
@@ -1,537 +1,552 @@
-/*
-Copyright (c) 2009 Apple Computer, Inc.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stddef.h>
-#include "mi.h"
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "dixfontstr.h"
-#include "mivalidate.h"
-#include "driWrap.h"
-#include "dri.h"
-
-#include <OpenGL/OpenGL.h>
-
-typedef struct {
- GCOps *originalOps;
-} DRIGCRec;
-
-typedef struct {
- GCOps *originalOps;
- CreateGCProcPtr CreateGC;
-} DRIWrapScreenRec;
-
-typedef struct {
- Bool didSave;
- int devKind;
- DevUnion devPrivate;
-} DRISavedDrawableState;
-
-static DevPrivateKeyRec driGCKeyRec;
-#define driGCKey (&driGCKeyRec)
-
-static DevPrivateKeyRec driWrapScreenKeyRec;
-#define driWrapScreenKey (&driWrapScreenKeyRec)
-
-static GCOps driGCOps;
-
-#define wrap(priv, real, member, func) { \
- priv->member = real->member; \
- real->member = func; \
- }
-
-#define unwrap(priv, real, member) { \
- real->member = priv->member; \
- }
-
-static DRIGCRec *
-DRIGetGCPriv(GCPtr pGC) {
- return dixLookupPrivate(&pGC->devPrivates, driGCKey);
-}
-
-static void
-DRIUnwrapGC(GCPtr pGC) {
- DRIGCRec *pGCPriv = DRIGetGCPriv(pGC);
-
- pGC->ops = pGCPriv->originalOps;
-}
-
-static void
-DRIWrapGC(GCPtr pGC) {
- pGC->ops = &driGCOps;
-}
-
-static void
-DRISurfaceSetDrawable(DrawablePtr pDraw,
- DRISavedDrawableState *saved) {
- saved->didSave = FALSE;
-
- if(pDraw->type == DRAWABLE_PIXMAP) {
- int pitch, width, height, bpp;
- void *buffer;
-
- if(DRIGetPixmapData(pDraw, &width, &height, &pitch, &bpp, &buffer)) {
- PixmapPtr pPix = (PixmapPtr)pDraw;
-
- saved->devKind = pPix->devKind;
- saved->devPrivate.ptr = pPix->devPrivate.ptr;
- saved->didSave = TRUE;
-
- pPix->devKind = pitch;
- pPix->devPrivate.ptr = buffer;
- }
- }
-}
-
-static void
-DRISurfaceRestoreDrawable(DrawablePtr pDraw,
- DRISavedDrawableState *saved) {
- PixmapPtr pPix = (PixmapPtr)pDraw;
-
- if(!saved->didSave)
- return;
-
- pPix->devKind = saved->devKind;
- pPix->devPrivate.ptr = saved->devPrivate.ptr;
-}
-
-static void
-DRIFillSpans(DrawablePtr dst, GCPtr pGC, int nInit,
- DDXPointPtr pptInit, int *pwidthInit,
- int sorted) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRISetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc,
- DDXPointPtr pptInit, int *pwidthInit,
- int nspans, int sorted) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit, nspans, sorted);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRIPutImage(DrawablePtr dst, GCPtr pGC,
- int depth, int x, int y, int w, int h,
- int leftPad, int format, char *pBits) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->PutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pBits);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static RegionPtr
-DRICopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
- int srcx, int srcy, int w, int h,
- int dstx, int dsty) {
- RegionPtr pReg;
- DRISavedDrawableState pSrcSaved, dstSaved;
-
- DRISurfaceSetDrawable(pSrc, &pSrcSaved);
- DRISurfaceSetDrawable(dst, &dstSaved);
-
- DRIUnwrapGC(pGC);
-
- pReg = pGC->ops->CopyArea(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(pSrc, &pSrcSaved);
- DRISurfaceRestoreDrawable(dst, &dstSaved);
-
- return pReg;
-}
-
-static RegionPtr
-DRICopyPlane(DrawablePtr pSrc, DrawablePtr dst,
- GCPtr pGC, int srcx, int srcy,
- int w, int h, int dstx, int dsty,
- unsigned long plane) {
- RegionPtr pReg;
- DRISavedDrawableState pSrcSaved, dstSaved;
-
- DRISurfaceSetDrawable(pSrc, &pSrcSaved);
- DRISurfaceSetDrawable(dst, &dstSaved);
-
-
- DRIUnwrapGC(pGC);
-
- pReg = pGC->ops->CopyPlane(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty,
- plane);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(pSrc, &pSrcSaved);
- DRISurfaceRestoreDrawable(dst, &dstSaved);
-
- return pReg;
-}
-
-static void
-DRIPolyPoint(DrawablePtr dst, GCPtr pGC,
- int mode, int npt, DDXPointPtr pptInit) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->PolyPoint(dst, pGC, mode, npt, pptInit);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRIPolylines(DrawablePtr dst, GCPtr pGC,
- int mode, int npt, DDXPointPtr pptInit) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->Polylines(dst, pGC, mode, npt, pptInit);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRIPolySegment(DrawablePtr dst, GCPtr pGC,
- int nseg, xSegment *pSeg) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->PolySegment(dst, pGC, nseg, pSeg);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRIPolyRectangle(DrawablePtr dst, GCPtr pGC,
- int nRects, xRectangle *pRects) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->PolyRectangle(dst, pGC, nRects, pRects);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-static void
-DRIPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc *parcs) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->PolyArc(dst, pGC, narcs, parcs);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRIFillPolygon(DrawablePtr dst, GCPtr pGC,
- int shape, int mode, int count,
- DDXPointPtr pptInit) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRIPolyFillRect(DrawablePtr dst, GCPtr pGC,
- int nRectsInit, xRectangle *pRectsInit) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRIPolyFillArc(DrawablePtr dst, GCPtr pGC,
- int narcsInit, xArc *parcsInit) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->PolyFillArc(dst, pGC, narcsInit, parcsInit);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static int
-DRIPolyText8(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, char *chars) {
- int ret;
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- ret = pGC->ops->PolyText8(dst, pGC, x, y, count, chars);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-
- return ret;
-}
-
-static int
-DRIPolyText16(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, unsigned short *chars) {
- int ret;
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- ret = pGC->ops->PolyText16(dst, pGC, x, y, count, chars);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-
- return ret;
-}
-
-static void
-DRIImageText8(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, char *chars) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->ImageText8(dst, pGC, x, y, count, chars);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRIImageText16(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, unsigned short *chars) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->ImageText16(dst, pGC, x, y, count, chars);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRIImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
- int x, int y, unsigned int nglyphInit,
- CharInfoPtr *ppciInit, pointer unused) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyphInit, ppciInit, unused);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void DRIPolyGlyphBlt(DrawablePtr dst, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase) {
- DRISavedDrawableState saved;
-
- DRISurfaceSetDrawable(dst, &saved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->PolyGlyphBlt(dst, pGC, x, y, nglyph, ppci, pglyphBase);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(dst, &saved);
-}
-
-static void
-DRIPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
- int dx, int dy, int xOrg, int yOrg) {
- DRISavedDrawableState bitMapSaved, dstSaved;
-
- DRISurfaceSetDrawable(&pBitMap->drawable, &bitMapSaved);
- DRISurfaceSetDrawable(dst, &dstSaved);
-
- DRIUnwrapGC(pGC);
-
- pGC->ops->PushPixels(pGC, pBitMap, dst, dx, dy, xOrg, yOrg);
-
- DRIWrapGC(pGC);
-
- DRISurfaceRestoreDrawable(&pBitMap->drawable, &bitMapSaved);
- DRISurfaceRestoreDrawable(dst, &dstSaved);
-}
-
-
-static GCOps driGCOps = {
- DRIFillSpans,
- DRISetSpans,
- DRIPutImage,
- DRICopyArea,
- DRICopyPlane,
- DRIPolyPoint,
- DRIPolylines,
- DRIPolySegment,
- DRIPolyRectangle,
- DRIPolyArc,
- DRIFillPolygon,
- DRIPolyFillRect,
- DRIPolyFillArc,
- DRIPolyText8,
- DRIPolyText16,
- DRIImageText8,
- DRIImageText16,
- DRIImageGlyphBlt,
- DRIPolyGlyphBlt,
- DRIPushPixels
-};
-
-
-static Bool
-DRICreateGC(GCPtr pGC) {
- ScreenPtr pScreen = pGC->pScreen;
- DRIWrapScreenRec *pScreenPriv;
- DRIGCRec *pGCPriv;
- Bool ret;
-
- pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, driWrapScreenKey);
-
- pGCPriv = DRIGetGCPriv(pGC);
-
- unwrap(pScreenPriv, pScreen, CreateGC);
- ret = pScreen->CreateGC(pGC);
-
- if(ret) {
- pGCPriv->originalOps = pGC->ops;
- pGC->ops = &driGCOps;
- }
-
- wrap(pScreenPriv, pScreen, CreateGC, DRICreateGC);
-
- return ret;
-}
-
-
-/* Return false if an error occurred. */
-Bool
-DRIWrapInit(ScreenPtr pScreen) {
- DRIWrapScreenRec *pScreenPriv;
-
- if(!dixRegisterPrivateKey(&driGCKeyRec, PRIVATE_GC, sizeof(DRIGCRec)))
- return FALSE;
-
- if(!dixRegisterPrivateKey(&driWrapScreenKeyRec, PRIVATE_SCREEN, sizeof(DRIWrapScreenRec)))
- return FALSE;
-
- pScreenPriv = dixGetPrivateAddr(&pScreen->devPrivates, &driWrapScreenKeyRec);
- pScreenPriv->CreateGC = pScreen->CreateGC;
- pScreen->CreateGC = DRICreateGC;
-
- return TRUE;
-}
+/*
+Copyright (c) 2009 Apple Computer, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stddef.h>
+#include "mi.h"
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "dixfontstr.h"
+#include "mivalidate.h"
+#include "driWrap.h"
+#include "dri.h"
+
+#include <OpenGL/OpenGL.h>
+
+typedef struct {
+ GCOps *originalOps;
+} DRIGCRec;
+
+typedef struct {
+ GCOps *originalOps;
+ CreateGCProcPtr CreateGC;
+} DRIWrapScreenRec;
+
+typedef struct {
+ Bool didSave;
+ int devKind;
+ DevUnion devPrivate;
+} DRISavedDrawableState;
+
+static DevPrivateKeyRec driGCKeyRec;
+
+#define driGCKey (&driGCKeyRec)
+
+static DevPrivateKeyRec driWrapScreenKeyRec;
+
+#define driWrapScreenKey (&driWrapScreenKeyRec)
+
+static GCOps driGCOps;
+
+#define wrap(priv, real, member, func) { \
+ priv->member = real->member; \
+ real->member = func; \
+ }
+
+#define unwrap(priv, real, member) { \
+ real->member = priv->member; \
+ }
+
+static DRIGCRec *
+DRIGetGCPriv(GCPtr pGC)
+{
+ return dixLookupPrivate(&pGC->devPrivates, driGCKey);
+}
+
+static void
+DRIUnwrapGC(GCPtr pGC)
+{
+ DRIGCRec *pGCPriv = DRIGetGCPriv(pGC);
+
+ pGC->ops = pGCPriv->originalOps;
+}
+
+static void
+DRIWrapGC(GCPtr pGC)
+{
+ pGC->ops = &driGCOps;
+}
+
+static void
+DRISurfaceSetDrawable(DrawablePtr pDraw, DRISavedDrawableState * saved)
+{
+ saved->didSave = FALSE;
+
+ if (pDraw->type == DRAWABLE_PIXMAP) {
+ int pitch, width, height, bpp;
+ void *buffer;
+
+ if (DRIGetPixmapData(pDraw, &width, &height, &pitch, &bpp, &buffer)) {
+ PixmapPtr pPix = (PixmapPtr) pDraw;
+
+ saved->devKind = pPix->devKind;
+ saved->devPrivate.ptr = pPix->devPrivate.ptr;
+ saved->didSave = TRUE;
+
+ pPix->devKind = pitch;
+ pPix->devPrivate.ptr = buffer;
+ }
+ }
+}
+
+static void
+DRISurfaceRestoreDrawable(DrawablePtr pDraw, DRISavedDrawableState * saved)
+{
+ PixmapPtr pPix = (PixmapPtr) pDraw;
+
+ if (!saved->didSave)
+ return;
+
+ pPix->devKind = saved->devKind;
+ pPix->devPrivate.ptr = saved->devPrivate.ptr;
+}
+
+static void
+DRIFillSpans(DrawablePtr dst, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int sorted)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRISetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc,
+ DDXPointPtr pptInit, int *pwidthInit, int nspans, int sorted)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit, nspans, sorted);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPutImage(DrawablePtr dst, GCPtr pGC,
+ int depth, int x, int y, int w, int h,
+ int leftPad, int format, char *pBits)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pBits);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static RegionPtr
+DRICopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ RegionPtr pReg;
+ DRISavedDrawableState pSrcSaved, dstSaved;
+
+ DRISurfaceSetDrawable(pSrc, &pSrcSaved);
+ DRISurfaceSetDrawable(dst, &dstSaved);
+
+ DRIUnwrapGC(pGC);
+
+ pReg = pGC->ops->CopyArea(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(pSrc, &pSrcSaved);
+ DRISurfaceRestoreDrawable(dst, &dstSaved);
+
+ return pReg;
+}
+
+static RegionPtr
+DRICopyPlane(DrawablePtr pSrc, DrawablePtr dst,
+ GCPtr pGC, int srcx, int srcy,
+ int w, int h, int dstx, int dsty, unsigned long plane)
+{
+ RegionPtr pReg;
+ DRISavedDrawableState pSrcSaved, dstSaved;
+
+ DRISurfaceSetDrawable(pSrc, &pSrcSaved);
+ DRISurfaceSetDrawable(dst, &dstSaved);
+
+ DRIUnwrapGC(pGC);
+
+ pReg = pGC->ops->CopyPlane(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty,
+ plane);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(pSrc, &pSrcSaved);
+ DRISurfaceRestoreDrawable(dst, &dstSaved);
+
+ return pReg;
+}
+
+static void
+DRIPolyPoint(DrawablePtr dst, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyPoint(dst, pGC, mode, npt, pptInit);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolylines(DrawablePtr dst, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->Polylines(dst, pGC, mode, npt, pptInit);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolySegment(DrawablePtr dst, GCPtr pGC, int nseg, xSegment * pSeg)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolySegment(dst, pGC, nseg, pSeg);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolyRectangle(DrawablePtr dst, GCPtr pGC, int nRects, xRectangle *pRects)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyRectangle(dst, pGC, nRects, pRects);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc * parcs)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyArc(dst, pGC, narcs, parcs);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIFillPolygon(DrawablePtr dst, GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr pptInit)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolyFillRect(DrawablePtr dst, GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolyFillArc(DrawablePtr dst, GCPtr pGC, int narcsInit, xArc * parcsInit)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyFillArc(dst, pGC, narcsInit, parcsInit);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static int
+DRIPolyText8(DrawablePtr dst, GCPtr pGC, int x, int y, int count, char *chars)
+{
+ int ret;
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ ret = pGC->ops->PolyText8(dst, pGC, x, y, count, chars);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+
+ return ret;
+}
+
+static int
+DRIPolyText16(DrawablePtr dst, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ int ret;
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ ret = pGC->ops->PolyText16(dst, pGC, x, y, count, chars);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+
+ return ret;
+}
+
+static void
+DRIImageText8(DrawablePtr dst, GCPtr pGC, int x, int y, int count, char *chars)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->ImageText8(dst, pGC, x, y, count, chars);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIImageText16(DrawablePtr dst, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->ImageText16(dst, pGC, x, y, count, chars);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
+ int x, int y, unsigned int nglyphInit,
+ CharInfoPtr * ppciInit, pointer unused)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyphInit, ppciInit, unused);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolyGlyphBlt(DrawablePtr dst, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyGlyphBlt(dst, pGC, x, y, nglyph, ppci, pglyphBase);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
+ int dx, int dy, int xOrg, int yOrg)
+{
+ DRISavedDrawableState bitMapSaved, dstSaved;
+
+ DRISurfaceSetDrawable(&pBitMap->drawable, &bitMapSaved);
+ DRISurfaceSetDrawable(dst, &dstSaved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PushPixels(pGC, pBitMap, dst, dx, dy, xOrg, yOrg);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(&pBitMap->drawable, &bitMapSaved);
+ DRISurfaceRestoreDrawable(dst, &dstSaved);
+}
+
+static GCOps driGCOps = {
+ DRIFillSpans,
+ DRISetSpans,
+ DRIPutImage,
+ DRICopyArea,
+ DRICopyPlane,
+ DRIPolyPoint,
+ DRIPolylines,
+ DRIPolySegment,
+ DRIPolyRectangle,
+ DRIPolyArc,
+ DRIFillPolygon,
+ DRIPolyFillRect,
+ DRIPolyFillArc,
+ DRIPolyText8,
+ DRIPolyText16,
+ DRIImageText8,
+ DRIImageText16,
+ DRIImageGlyphBlt,
+ DRIPolyGlyphBlt,
+ DRIPushPixels
+};
+
+static Bool
+DRICreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ DRIWrapScreenRec *pScreenPriv;
+ DRIGCRec *pGCPriv;
+ Bool ret;
+
+ pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, driWrapScreenKey);
+
+ pGCPriv = DRIGetGCPriv(pGC);
+
+ unwrap(pScreenPriv, pScreen, CreateGC);
+ ret = pScreen->CreateGC(pGC);
+
+ if (ret) {
+ pGCPriv->originalOps = pGC->ops;
+ pGC->ops = &driGCOps;
+ }
+
+ wrap(pScreenPriv, pScreen, CreateGC, DRICreateGC);
+
+ return ret;
+}
+
+/* Return false if an error occurred. */
+Bool
+DRIWrapInit(ScreenPtr pScreen)
+{
+ DRIWrapScreenRec *pScreenPriv;
+
+ if (!dixRegisterPrivateKey(&driGCKeyRec, PRIVATE_GC, sizeof(DRIGCRec)))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey
+ (&driWrapScreenKeyRec, PRIVATE_SCREEN, sizeof(DRIWrapScreenRec)))
+ return FALSE;
+
+ pScreenPriv =
+ dixGetPrivateAddr(&pScreen->devPrivates, &driWrapScreenKeyRec);
+ pScreenPriv->CreateGC = pScreen->CreateGC;
+ pScreen->CreateGC = DRICreateGC;
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xquartz/xpr/dristruct.h b/xorg-server/hw/xquartz/xpr/dristruct.h
index 19d78a973..13d590b1f 100644
--- a/xorg-server/hw/xquartz/xpr/dristruct.h
+++ b/xorg-server/hw/xquartz/xpr/dristruct.h
@@ -46,15 +46,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
dixLookupPrivate(&(pPix)->devPrivates, DRIPixmapPrivKey))
-typedef struct _DRIDrawablePrivRec
-{
- xp_surface_id sid;
- int drawableIndex;
- DrawablePtr pDraw;
- ScreenPtr pScreen;
- int refCount;
- unsigned int key[2];
- x_list *notifiers; /* list of (FUN . DATA) */
+typedef struct _DRIDrawablePrivRec {
+ xp_surface_id sid;
+ int drawableIndex;
+ DrawablePtr pDraw;
+ ScreenPtr pScreen;
+ int refCount;
+ unsigned int key[2];
+ x_list *notifiers; /* list of (FUN . DATA) */
} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
@@ -64,13 +63,11 @@ typedef struct _DRIDrawablePrivRec
dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
DRIScreenPrivKey))
-
-typedef struct _DRIScreenPrivRec
-{
- Bool directRenderingSupport;
- int nrWindows;
- DRIWrappedFuncsRec wrap;
- DrawablePtr DRIDrawables[DRI_MAX_DRAWABLES];
+typedef struct _DRIScreenPrivRec {
+ Bool directRenderingSupport;
+ int nrWindows;
+ DRIWrappedFuncsRec wrap;
+ DrawablePtr DRIDrawables[DRI_MAX_DRAWABLES];
} DRIScreenPrivRec, *DRIScreenPrivPtr;
-#endif /* DRI_STRUCT_H */
+#endif /* DRI_STRUCT_H */
diff --git a/xorg-server/hw/xquartz/xpr/x-hash.c b/xorg-server/hw/xquartz/xpr/x-hash.c
index 7c6a67bd1..a3ff66177 100644
--- a/xorg-server/hw/xquartz/xpr/x-hash.c
+++ b/xorg-server/hw/xquartz/xpr/x-hash.c
@@ -65,13 +65,13 @@ static const unsigned int bucket_sizes[] = {
#define N_BUCKET_SIZES (sizeof (bucket_sizes) / sizeof (bucket_sizes[0]))
static inline unsigned int
-hash_table_total_buckets (x_hash_table *h)
+hash_table_total_buckets(x_hash_table * h)
{
return bucket_sizes[h->bucket_index];
}
static inline void
-hash_table_destroy_item (x_hash_table *h, void *k, void *v)
+hash_table_destroy_item(x_hash_table * h, void *k, void *v)
{
if (h->destroy_key != 0)
(*h->destroy_key) (k);
@@ -81,7 +81,7 @@ hash_table_destroy_item (x_hash_table *h, void *k, void *v)
}
static inline size_t
-hash_table_hash_key (x_hash_table *h, void *k)
+hash_table_hash_key(x_hash_table * h, void *k)
{
if (h->hash_key != 0)
return (*h->hash_key) (k);
@@ -90,7 +90,7 @@ hash_table_hash_key (x_hash_table *h, void *k)
}
static inline int
-hash_table_compare_keys (x_hash_table *h, void *k1, void *k2)
+hash_table_compare_keys(x_hash_table * h, void *k1, void *k2)
{
if (h->compare_keys == 0)
return k1 == k2;
@@ -99,7 +99,7 @@ hash_table_compare_keys (x_hash_table *h, void *k1, void *k2)
}
static void
-hash_table_split (x_hash_table *h)
+hash_table_split(x_hash_table * h)
{
x_list **new, **old;
x_list *node, *item, *next;
@@ -110,28 +110,25 @@ hash_table_split (x_hash_table *h)
if (h->bucket_index == N_BUCKET_SIZES - 1)
return;
- old_size = hash_table_total_buckets (h);
+ old_size = hash_table_total_buckets(h);
old = h->buckets;
h->bucket_index++;
- new_size = hash_table_total_buckets (h);
- new = calloc (new_size, sizeof (x_list *));
+ new_size = hash_table_total_buckets(h);
+ new = calloc(new_size, sizeof(x_list *));
- if (new == 0)
- {
+ if (new == 0) {
h->bucket_index--;
return;
}
- for (i = 0; i < old_size; i++)
- {
- for (node = old[i]; node != 0; node = next)
- {
+ for (i = 0; i < old_size; i++) {
+ for (node = old[i]; node != 0; node = next) {
next = node->next;
item = node->data;
- b = hash_table_hash_key (h, ITEM_KEY (item)) % new_size;
+ b = hash_table_hash_key(h, ITEM_KEY(item)) % new_size;
node->next = new[b];
new[b] = node;
@@ -139,30 +136,27 @@ hash_table_split (x_hash_table *h)
}
h->buckets = new;
- free (old);
+ free(old);
}
-X_EXTERN x_hash_table *
-X_PFX (hash_table_new) (x_hash_fun *hash,
- x_compare_fun *compare,
- x_destroy_fun *key_destroy,
- x_destroy_fun *value_destroy)
-{
+X_EXTERN x_hash_table *X_PFX(hash_table_new) (x_hash_fun * hash,
+ x_compare_fun * compare,
+ x_destroy_fun * key_destroy,
+ x_destroy_fun * value_destroy) {
x_hash_table *h;
- h = calloc (1, sizeof (x_hash_table));
+ h = calloc(1, sizeof(x_hash_table));
if (h == 0)
return 0;
h->bucket_index = 0;
- h->buckets = calloc (hash_table_total_buckets (h), sizeof (x_list *));
+ h->buckets = calloc(hash_table_total_buckets(h), sizeof(x_list *));
- if (h->buckets == 0)
- {
- free (h);
+ if (h->buckets == 0) {
+ free(h);
return 0;
}
-
+
h->hash_key = hash;
h->compare_keys = compare;
h->destroy_key = key_destroy;
@@ -172,66 +166,57 @@ X_PFX (hash_table_new) (x_hash_fun *hash,
}
X_EXTERN void
-X_PFX (hash_table_free) (x_hash_table *h)
-{
+ X_PFX(hash_table_free) (x_hash_table * h) {
int n, i;
x_list *node, *item;
- assert (h != NULL);
+ assert(h != NULL);
- n = hash_table_total_buckets (h);
+ n = hash_table_total_buckets(h);
- for (i = 0; i < n; i++)
- {
- for (node = h->buckets[i]; node != 0; node = node->next)
- {
+ for (i = 0; i < n; i++) {
+ for (node = h->buckets[i]; node != 0; node = node->next) {
item = node->data;
- hash_table_destroy_item (h, ITEM_KEY (item), ITEM_VALUE (item));
- ITEM_FREE (item);
+ hash_table_destroy_item(h, ITEM_KEY(item), ITEM_VALUE(item));
+ ITEM_FREE(item);
}
- X_PFX (list_free) (h->buckets[i]);
+ X_PFX(list_free) (h->buckets[i]);
}
- free (h->buckets);
- free (h);
+ free(h->buckets);
+ free(h);
}
X_EXTERN unsigned int
-X_PFX (hash_table_size) (x_hash_table *h)
-{
- assert (h != NULL);
+ X_PFX(hash_table_size) (x_hash_table * h) {
+ assert(h != NULL);
return h->total_keys;
}
static void
-hash_table_modify (x_hash_table *h, void *k, void *v, int replace)
+hash_table_modify(x_hash_table * h, void *k, void *v, int replace)
{
size_t hash_value;
x_list *node, *item;
- assert (h != NULL);
+ assert(h != NULL);
- hash_value = hash_table_hash_key (h, k);
+ hash_value = hash_table_hash_key(h, k);
- for (node = h->buckets[hash_value % hash_table_total_buckets (h)];
- node != 0; node = node->next)
- {
+ for (node = h->buckets[hash_value % hash_table_total_buckets(h)];
+ node != 0; node = node->next) {
item = node->data;
- if (hash_table_compare_keys (h, ITEM_KEY (item), k))
- {
- if (replace)
- {
- hash_table_destroy_item (h, ITEM_KEY (item),
- ITEM_VALUE (item));
+ if (hash_table_compare_keys(h, ITEM_KEY(item), k)) {
+ if (replace) {
+ hash_table_destroy_item(h, ITEM_KEY(item), ITEM_VALUE(item));
item->next = k;
- ITEM_VALUE (item) = v;
+ ITEM_VALUE(item) = v;
}
- else
- {
- hash_table_destroy_item (h, k, ITEM_VALUE (item));
- ITEM_VALUE (item) = v;
+ else {
+ hash_table_destroy_item(h, k, ITEM_VALUE(item));
+ ITEM_VALUE(item) = v;
}
return;
}
@@ -240,78 +225,69 @@ hash_table_modify (x_hash_table *h, void *k, void *v, int replace)
/* Key isn't already in the table. Insert it. */
if (h->total_keys + 1
- > hash_table_total_buckets (h) * SPLIT_THRESHOLD_FACTOR)
- {
- hash_table_split (h);
+ > hash_table_total_buckets(h) * SPLIT_THRESHOLD_FACTOR) {
+ hash_table_split(h);
}
- hash_value = hash_value % hash_table_total_buckets (h);
- h->buckets[hash_value] = X_PFX (list_prepend) (h->buckets[hash_value],
- ITEM_NEW (k, v));
+ hash_value = hash_value % hash_table_total_buckets(h);
+ h->buckets[hash_value] = X_PFX(list_prepend) (h->buckets[hash_value],
+ ITEM_NEW(k, v));
h->total_keys++;
}
X_EXTERN void
-X_PFX (hash_table_insert) (x_hash_table *h, void *k, void *v)
-{
- hash_table_modify (h, k, v, 0);
+ X_PFX(hash_table_insert) (x_hash_table * h, void *k, void *v) {
+ hash_table_modify(h, k, v, 0);
}
X_EXTERN void
-X_PFX (hash_table_replace) (x_hash_table *h, void *k, void *v)
-{
- hash_table_modify (h, k, v, 1);
+ X_PFX(hash_table_replace) (x_hash_table * h, void *k, void *v) {
+ hash_table_modify(h, k, v, 1);
}
X_EXTERN void
-X_PFX (hash_table_remove) (x_hash_table *h, void *k)
-{
+ X_PFX(hash_table_remove) (x_hash_table * h, void *k) {
size_t hash_value;
x_list **ptr, *item;
- assert (h != NULL);
+ assert(h != NULL);
- hash_value = hash_table_hash_key (h, k);
+ hash_value = hash_table_hash_key(h, k);
- for (ptr = &h->buckets[hash_value % hash_table_total_buckets (h)];
- *ptr != 0; ptr = &((*ptr)->next))
- {
+ for (ptr = &h->buckets[hash_value % hash_table_total_buckets(h)];
+ *ptr != 0; ptr = &((*ptr)->next)) {
item = (*ptr)->data;
- if (hash_table_compare_keys (h, ITEM_KEY (item), k))
- {
- hash_table_destroy_item (h, ITEM_KEY (item), ITEM_VALUE (item));
- ITEM_FREE (item);
+ if (hash_table_compare_keys(h, ITEM_KEY(item), k)) {
+ hash_table_destroy_item(h, ITEM_KEY(item), ITEM_VALUE(item));
+ ITEM_FREE(item);
item = *ptr;
*ptr = item->next;
- X_PFX (list_free_1) (item);
+ X_PFX(list_free_1) (item);
h->total_keys--;
return;
}
}
}
-X_EXTERN void *
-X_PFX (hash_table_lookup) (x_hash_table *h, void *k, void **k_ret)
-{
+X_EXTERN void *X_PFX(hash_table_lookup) (x_hash_table * h, void *k,
+ void **k_ret) {
size_t hash_value;
x_list *node, *item;
- assert (h != NULL);
+ assert(h != NULL);
- hash_value = hash_table_hash_key (h, k);
+ hash_value = hash_table_hash_key(h, k);
- for (node = h->buckets[hash_value % hash_table_total_buckets (h)];
- node != 0; node = node->next)
- {
+ for (node = h->buckets[hash_value % hash_table_total_buckets(h)];
+ node != 0; node = node->next) {
item = node->data;
- if (hash_table_compare_keys (h, ITEM_KEY (item), k))
- {
+ if (hash_table_compare_keys(h, ITEM_KEY(item), k)) {
if (k_ret != 0)
- *k_ret = ITEM_KEY (item);
+ *k_ret = ITEM_KEY(item);
- return ITEM_VALUE (item);
+ return ITEM_VALUE(item);
}
}
@@ -322,22 +298,20 @@ X_PFX (hash_table_lookup) (x_hash_table *h, void *k, void **k_ret)
}
X_EXTERN void
-X_PFX (hash_table_foreach) (x_hash_table *h,
- x_hash_foreach_fun *fun, void *data)
-{
+
+X_PFX(hash_table_foreach) (x_hash_table * h,
+ x_hash_foreach_fun * fun, void *data) {
int i, n;
x_list *node, *item;
- assert (h != NULL);
+ assert(h != NULL);
- n = hash_table_total_buckets (h);
+ n = hash_table_total_buckets(h);
- for (i = 0; i < n; i++)
- {
- for (node = h->buckets[i]; node != 0; node = node->next)
- {
+ for (i = 0; i < n; i++) {
+ for (node = h->buckets[i]; node != 0; node = node->next) {
item = node->data;
- (*fun) (ITEM_KEY (item), ITEM_VALUE (item), data);
+ (*fun) (ITEM_KEY(item), ITEM_VALUE(item), data);
}
}
}
diff --git a/xorg-server/hw/xquartz/xpr/x-hash.h b/xorg-server/hw/xquartz/xpr/x-hash.h
index f876b6b71..c4543346a 100644
--- a/xorg-server/hw/xquartz/xpr/x-hash.h
+++ b/xorg-server/hw/xquartz/xpr/x-hash.h
@@ -43,49 +43,45 @@ typedef void (x_hash_foreach_fun) (void *k, void *v, void *data);
/* for X_PFX and X_EXTERN */
#include "x-list.h"
-X_EXTERN x_hash_table *X_PFX (hash_table_new) (x_hash_fun *hash,
- x_compare_fun *compare,
- x_destroy_fun *key_destroy,
- x_destroy_fun *value_destroy);
-X_EXTERN void X_PFX (hash_table_free) (x_hash_table *h);
-
-X_EXTERN unsigned int X_PFX (hash_table_size) (x_hash_table *h);
-
-X_EXTERN void X_PFX (hash_table_insert) (x_hash_table *h, void *k, void *v);
-X_EXTERN void X_PFX (hash_table_replace) (x_hash_table *h, void *k, void *v);
-X_EXTERN void X_PFX (hash_table_remove) (x_hash_table *h, void *k);
-X_EXTERN void *X_PFX (hash_table_lookup) (x_hash_table *h,
- void *k, void **k_ret);
-X_EXTERN void X_PFX (hash_table_foreach) (x_hash_table *h,
- x_hash_foreach_fun *fun,
- void *data);
+X_EXTERN x_hash_table *X_PFX(hash_table_new) (x_hash_fun * hash,
+ x_compare_fun * compare,
+ x_destroy_fun * key_destroy,
+ x_destroy_fun * value_destroy);
+X_EXTERN void X_PFX(hash_table_free) (x_hash_table * h);
+
+X_EXTERN unsigned int X_PFX(hash_table_size) (x_hash_table * h);
+
+X_EXTERN void X_PFX(hash_table_insert) (x_hash_table * h, void *k, void *v);
+X_EXTERN void X_PFX(hash_table_replace) (x_hash_table * h, void *k, void *v);
+X_EXTERN void X_PFX(hash_table_remove) (x_hash_table * h, void *k);
+X_EXTERN void *X_PFX(hash_table_lookup) (x_hash_table * h,
+ void *k, void **k_ret);
+X_EXTERN void X_PFX(hash_table_foreach) (x_hash_table * h,
+ x_hash_foreach_fun * fun, void *data);
/* Conversion between unsigned int (e.g. xp_resource_id) and void pointer */
/* Forward declarations */
-static __inline__ void *
-X_PFX (cvt_uint_to_vptr) (unsigned int val) __attribute__((always_inline));
+static __inline__ void *X_PFX(cvt_uint_to_vptr) (unsigned int val)
+ __attribute__ ((always_inline));
static __inline__ unsigned int
-X_PFX (cvt_vptr_to_uint) (void * val) __attribute__((always_inline));
+ X_PFX(cvt_vptr_to_uint) (void *val) __attribute__ ((always_inline));
/* Implementations */
-static __inline__ void *
-X_PFX (cvt_uint_to_vptr) (unsigned int val)
-{
- return (void*)((unsigned long)(val));
+static __inline__ void *X_PFX(cvt_uint_to_vptr) (unsigned int val) {
+ return (void *) ((unsigned long) (val));
}
static __inline__ unsigned int
-X_PFX (cvt_vptr_to_uint) (void * val)
-{
- size_t sv = (size_t)val;
- unsigned int uv = (unsigned int)sv;
-
- /* If this assert fails, chances are val actually is a pointer,
- or there's been memory corruption */
- assert(sv == uv);
-
- return uv;
+ X_PFX(cvt_vptr_to_uint) (void *val) {
+ size_t sv = (size_t) val;
+ unsigned int uv = (unsigned int) sv;
+
+ /* If this assert fails, chances are val actually is a pointer,
+ or there's been memory corruption */
+ assert(sv == uv);
+
+ return uv;
}
-#endif /* X_HASH_H */
+#endif /* X_HASH_H */
diff --git a/xorg-server/hw/xquartz/xpr/x-hook.c b/xorg-server/hw/xquartz/xpr/x-hook.c
index c65b6fc68..fd34658e7 100644
--- a/xorg-server/hw/xquartz/xpr/x-hook.c
+++ b/xorg-server/hw/xquartz/xpr/x-hook.c
@@ -1,120 +1,111 @@
-/* x-hook.c
-
- Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation files
- (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
- HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
-
- Except as contained in this notice, the name(s) of the above
- copyright holders shall not be used in advertising or otherwise to
- promote the sale, use or other dealings in this Software without
- prior written authorization. */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "x-hook.h"
-#include <stdlib.h>
-#include <assert.h>
-#include "os.h"
-
-#define CELL_NEW(f,d) X_PFX (list_prepend) ((x_list *) (f), (d))
-#define CELL_FREE(c) X_PFX (list_free_1) (c)
-#define CELL_FUN(c) ((x_hook_function *) ((c)->next))
-#define CELL_DATA(c) ((c)->data)
-
-X_EXTERN x_list *
-X_PFX (hook_add) (x_list *lst, x_hook_function *fun, void *data)
-{
- return X_PFX (list_prepend) (lst, CELL_NEW (fun, data));
-}
-
-X_EXTERN x_list *
-X_PFX (hook_remove) (x_list *lst, x_hook_function *fun, void *data)
-{
- x_list *node, *cell;
- x_list *to_delete = NULL;
-
- for (node = lst; node != NULL; node = node->next)
- {
- cell = node->data;
- if (CELL_FUN (cell) == fun && CELL_DATA (cell) == data)
- to_delete = X_PFX (list_prepend) (to_delete, cell);
- }
-
- for (node = to_delete; node != NULL; node = node->next)
- {
- cell = node->data;
- lst = X_PFX (list_remove) (lst, cell);
- CELL_FREE (cell);
- }
-
- X_PFX (list_free) (to_delete);
- return lst;
-}
-
-X_EXTERN void
-X_PFX (hook_run) (x_list *lst, void *arg)
-{
- x_list *node, *cell;
- x_hook_function **fun;
- void **data;
- int length, i;
-
- if(!lst)
- return;
-
- length = X_PFX (list_length) (lst);
- fun = malloc(sizeof (x_hook_function *) * length);
- data = malloc(sizeof (void *) * length);
-
- if(!fun || !data) {
- FatalError("Failed to allocate memory in %s\n", __func__);
- }
-
- for (i = 0, node = lst; node != NULL; node = node->next, i++)
- {
- cell = node->data;
- fun[i] = CELL_FUN (cell);
- data[i] = CELL_DATA (cell);
- }
-
- for (i = 0; i < length; i++)
- {
- (*fun[i]) (arg, data[i]);
- }
-
- free(fun);
- free(data);
-}
-
-X_EXTERN void
-X_PFX (hook_free) (x_list *lst)
-{
- x_list *node;
-
- for (node = lst; node != NULL; node = node->next)
- {
- CELL_FREE (node->data);
- }
-
- X_PFX (list_free) (lst);
-}
+/* x-hook.c
+
+ Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "x-hook.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "os.h"
+
+#define CELL_NEW(f,d) X_PFX (list_prepend) ((x_list *) (f), (d))
+#define CELL_FREE(c) X_PFX (list_free_1) (c)
+#define CELL_FUN(c) ((x_hook_function *) ((c)->next))
+#define CELL_DATA(c) ((c)->data)
+
+X_EXTERN x_list *X_PFX(hook_add) (x_list * lst, x_hook_function * fun,
+ void *data) {
+ return X_PFX(list_prepend) (lst, CELL_NEW(fun, data));
+}
+
+X_EXTERN x_list *X_PFX(hook_remove) (x_list * lst, x_hook_function * fun,
+ void *data) {
+ x_list *node, *cell;
+ x_list *to_delete = NULL;
+
+ for (node = lst; node != NULL; node = node->next) {
+ cell = node->data;
+ if (CELL_FUN(cell) == fun && CELL_DATA(cell) == data)
+ to_delete = X_PFX(list_prepend) (to_delete, cell);
+ }
+
+ for (node = to_delete; node != NULL; node = node->next) {
+ cell = node->data;
+ lst = X_PFX(list_remove) (lst, cell);
+ CELL_FREE(cell);
+ }
+
+ X_PFX(list_free) (to_delete);
+ return lst;
+}
+
+X_EXTERN void
+ X_PFX(hook_run) (x_list * lst, void *arg) {
+ x_list *node, *cell;
+ x_hook_function **fun;
+ void **data;
+ int length, i;
+
+ if (!lst)
+ return;
+
+ length = X_PFX(list_length) (lst);
+ fun = malloc(sizeof(x_hook_function *) * length);
+ data = malloc(sizeof(void *) * length);
+
+ if (!fun || !data) {
+ FatalError("Failed to allocate memory in %s\n", __func__);
+ }
+
+ for (i = 0, node = lst; node != NULL; node = node->next, i++) {
+ cell = node->data;
+ fun[i] = CELL_FUN(cell);
+ data[i] = CELL_DATA(cell);
+ }
+
+ for (i = 0; i < length; i++) {
+ (*fun[i]) (arg, data[i]);
+ }
+
+ free(fun);
+ free(data);
+}
+
+X_EXTERN void
+ X_PFX(hook_free) (x_list * lst) {
+ x_list *node;
+
+ for (node = lst; node != NULL; node = node->next) {
+ CELL_FREE(node->data);
+ }
+
+ X_PFX(list_free) (lst);
+}
diff --git a/xorg-server/hw/xquartz/xpr/x-hook.h b/xorg-server/hw/xquartz/xpr/x-hook.h
index 392352d50..da3407f92 100644
--- a/xorg-server/hw/xquartz/xpr/x-hook.h
+++ b/xorg-server/hw/xquartz/xpr/x-hook.h
@@ -32,11 +32,13 @@
#include "x-list.h"
-typedef void x_hook_function (void *arg, void *data);
+typedef void x_hook_function(void *arg, void *data);
-X_EXTERN x_list *X_PFX (hook_add) (x_list *lst, x_hook_function *fun, void *data);
-X_EXTERN x_list *X_PFX (hook_remove) (x_list *lst, x_hook_function *fun, void *data);
-X_EXTERN void X_PFX (hook_run) (x_list *lst, void *arg);
-X_EXTERN void X_PFX (hook_free) (x_list *lst);
+X_EXTERN x_list *X_PFX(hook_add) (x_list * lst, x_hook_function * fun,
+ void *data);
+X_EXTERN x_list *X_PFX(hook_remove) (x_list * lst, x_hook_function * fun,
+ void *data);
+X_EXTERN void X_PFX(hook_run) (x_list * lst, void *arg);
+X_EXTERN void X_PFX(hook_free) (x_list * lst);
-#endif /* X_HOOK_H */
+#endif /* X_HOOK_H */
diff --git a/xorg-server/hw/xquartz/xpr/x-list.c b/xorg-server/hw/xquartz/xpr/x-list.c
index 77c9309aa..757ff4cb0 100644
--- a/xorg-server/hw/xquartz/xpr/x-list.c
+++ b/xorg-server/hw/xquartz/xpr/x-list.c
@@ -50,57 +50,51 @@ static x_list *freelist;
static pthread_mutex_t freelist_lock = PTHREAD_MUTEX_INITIALIZER;
static inline void
-list_free_1 (x_list *node)
+list_free_1(x_list * node)
{
node->next = freelist;
freelist = node;
}
X_EXTERN void
-X_PFX (list_free_1) (x_list *node)
-{
- assert (node != NULL);
+ X_PFX(list_free_1) (x_list * node) {
+ assert(node != NULL);
- pthread_mutex_lock (&freelist_lock);
+ pthread_mutex_lock(&freelist_lock);
- list_free_1 (node);
+ list_free_1(node);
- pthread_mutex_unlock (&freelist_lock);
+ pthread_mutex_unlock(&freelist_lock);
}
X_EXTERN void
-X_PFX (list_free) (x_list *lst)
-{
+ X_PFX(list_free) (x_list * lst) {
x_list *next;
- pthread_mutex_lock (&freelist_lock);
+ pthread_mutex_lock(&freelist_lock);
- for (; lst != NULL; lst = next)
- {
+ for (; lst != NULL; lst = next) {
next = lst->next;
- list_free_1 (lst);
+ list_free_1(lst);
}
- pthread_mutex_unlock (&freelist_lock);
+ pthread_mutex_unlock(&freelist_lock);
}
-X_EXTERN x_list *
-X_PFX (list_prepend) (x_list *lst, void *data)
-{
+X_EXTERN x_list *X_PFX(list_prepend) (x_list * lst, void *data) {
x_list *node;
- pthread_mutex_lock (&freelist_lock);
+ pthread_mutex_lock(&freelist_lock);
- if (freelist == NULL)
- {
+ if (freelist == NULL) {
x_list_block *b;
int i;
- b = malloc (sizeof (x_list_block));
+ b = malloc(sizeof(x_list_block));
assert(b != NULL);
for (i = 0; i < NODES_PER_BLOCK - 1; i++)
- b->l[i].next = &(b->l[i+1]);
+ b->l[i].next = &(b->l[i + 1]);
b->l[i].next = NULL;
freelist = b->l;
@@ -109,7 +103,7 @@ X_PFX (list_prepend) (x_list *lst, void *data)
node = freelist;
freelist = node->next;
- pthread_mutex_unlock (&freelist_lock);
+ pthread_mutex_unlock(&freelist_lock);
node->next = lst;
node->data = data;
@@ -117,29 +111,24 @@ X_PFX (list_prepend) (x_list *lst, void *data)
return node;
}
-X_EXTERN x_list *
-X_PFX (list_append) (x_list *lst, void *data)
-{
+X_EXTERN x_list *X_PFX(list_append) (x_list * lst, void *data) {
x_list *head = lst;
if (lst == NULL)
- return X_PFX (list_prepend) (NULL, data);
+ return X_PFX(list_prepend) (NULL, data);
while (lst->next != NULL)
lst = lst->next;
- lst->next = X_PFX (list_prepend) (NULL, data);
+ lst->next = X_PFX(list_prepend) (NULL, data);
return head;
}
-X_EXTERN x_list *
-X_PFX (list_reverse) (x_list *lst)
-{
+X_EXTERN x_list *X_PFX(list_reverse) (x_list * lst) {
x_list *head = NULL, *next;
-
- while (lst != NULL)
- {
+
+ while (lst != NULL) {
next = lst->next;
lst->next = head;
head = lst;
@@ -149,11 +138,8 @@ X_PFX (list_reverse) (x_list *lst)
return head;
}
-X_EXTERN x_list *
-X_PFX (list_find) (x_list *lst, void *data)
-{
- for (; lst != NULL; lst = lst->next)
- {
+X_EXTERN x_list *X_PFX(list_find) (x_list * lst, void *data) {
+ for (; lst != NULL; lst = lst->next) {
if (lst->data == data)
return lst;
}
@@ -161,26 +147,22 @@ X_PFX (list_find) (x_list *lst, void *data)
return NULL;
}
-X_EXTERN x_list *
-X_PFX (list_nth) (x_list *lst, int n)
-{
+X_EXTERN x_list *X_PFX(list_nth) (x_list * lst, int n) {
while (n-- > 0 && lst != NULL)
lst = lst->next;
return lst;
}
-X_EXTERN x_list *
-X_PFX (list_pop) (x_list *lst, void **data_ret)
-{
+X_EXTERN x_list *X_PFX(list_pop) (x_list * lst, void **data_ret) {
void *data = NULL;
- if (lst != NULL)
- {
+ if (lst != NULL) {
x_list *tem = lst;
+
data = lst->data;
lst = lst->next;
- X_PFX (list_free_1) (tem);
+ X_PFX(list_free_1) (tem);
}
if (data_ret != NULL)
@@ -189,61 +171,50 @@ X_PFX (list_pop) (x_list *lst, void **data_ret)
return lst;
}
-X_EXTERN x_list *
-X_PFX (list_filter) (x_list *lst,
- int (*pred) (void *item, void *data), void *data)
-{
+X_EXTERN x_list *X_PFX(list_filter) (x_list * lst,
+ int (*pred) (void *item, void *data),
+ void *data) {
x_list *ret = NULL, *node;
- for (node = lst; node != NULL; node = node->next)
- {
+ for (node = lst; node != NULL; node = node->next) {
if ((*pred) (node->data, data))
- ret = X_PFX (list_prepend) (ret, node->data);
+ ret = X_PFX(list_prepend) (ret, node->data);
}
- return X_PFX (list_reverse) (ret);
+ return X_PFX(list_reverse) (ret);
}
-X_EXTERN x_list *
-X_PFX (list_map) (x_list *lst,
- void *(*fun) (void *item, void *data), void *data)
-{
+X_EXTERN x_list *X_PFX(list_map) (x_list * lst,
+ void *(*fun) (void *item, void *data),
+ void *data) {
x_list *ret = NULL, *node;
- for (node = lst; node != NULL; node = node->next)
- {
- X_PFX (list_prepend) (ret, fun (node->data, data));
+ for (node = lst; node != NULL; node = node->next) {
+ X_PFX(list_prepend) (ret, fun(node->data, data));
}
- return X_PFX (list_reverse) (ret);
+ return X_PFX(list_reverse) (ret);
}
-X_EXTERN x_list *
-X_PFX (list_copy) (x_list *lst)
-{
+X_EXTERN x_list *X_PFX(list_copy) (x_list * lst) {
x_list *copy = NULL;
- for (; lst != NULL; lst = lst->next)
- {
- copy = X_PFX (list_prepend) (copy, lst->data);
+ for (; lst != NULL; lst = lst->next) {
+ copy = X_PFX(list_prepend) (copy, lst->data);
}
- return X_PFX (list_reverse) (copy);
+ return X_PFX(list_reverse) (copy);
}
-X_EXTERN x_list *
-X_PFX (list_remove) (x_list *lst, void *data)
-{
+X_EXTERN x_list *X_PFX(list_remove) (x_list * lst, void *data) {
x_list **ptr, *node;
- for (ptr = &lst; *ptr != NULL;)
- {
+ for (ptr = &lst; *ptr != NULL;) {
node = *ptr;
- if (node->data == data)
- {
+ if (node->data == data) {
*ptr = node->next;
- X_PFX (list_free_1) (node);
+ X_PFX(list_free_1) (node);
}
else
ptr = &((*ptr)->next);
@@ -253,8 +224,7 @@ X_PFX (list_remove) (x_list *lst, void *data)
}
X_EXTERN unsigned int
-X_PFX (list_length) (x_list *lst)
-{
+ X_PFX(list_length) (x_list * lst) {
unsigned int n;
n = 0;
@@ -265,19 +235,17 @@ X_PFX (list_length) (x_list *lst)
}
X_EXTERN void
-X_PFX (list_foreach) (x_list *lst,
- void (*fun) (void *data, void *user_data),
- void *user_data)
-{
- for (; lst != NULL; lst = lst->next)
- {
+
+X_PFX(list_foreach) (x_list * lst,
+ void (*fun) (void *data, void *user_data),
+ void *user_data) {
+ for (; lst != NULL; lst = lst->next) {
(*fun) (lst->data, user_data);
}
}
static x_list *
-list_sort_1 (x_list *lst, int length,
- int (*less) (const void *, const void *))
+list_sort_1(x_list * lst, int length, int (*less) (const void *, const void *))
{
x_list *mid, *ptr;
x_list *out_head, *out;
@@ -299,20 +267,19 @@ list_sort_1 (x_list *lst, int length,
/* Sort each sub-list. */
- lst = list_sort_1 (lst, mid_point, less);
- mid = list_sort_1 (mid, length - mid_point, less);
+ lst = list_sort_1(lst, mid_point, less);
+ mid = list_sort_1(mid, length - mid_point, less);
/* Then merge them back together. */
- assert (lst != NULL && mid != NULL);
+ assert(lst != NULL && mid != NULL);
if ((*less) (mid->data, lst->data))
out = out_head = mid, mid = mid->next;
else
out = out_head = lst, lst = lst->next;
- while (lst != NULL && mid != NULL)
- {
+ while (lst != NULL && mid != NULL) {
if ((*less) (mid->data, lst->data))
out = out->next = mid, mid = mid->next;
else
@@ -327,12 +294,11 @@ list_sort_1 (x_list *lst, int length,
return out_head;
}
-X_EXTERN x_list *
-X_PFX (list_sort) (x_list *lst, int (*less) (const void *, const void *))
-{
+X_EXTERN x_list *X_PFX(list_sort) (x_list * lst,
+ int (*less) (const void *, const void *)) {
int length;
- length = X_PFX (list_length) (lst);
+ length = X_PFX(list_length) (lst);
- return list_sort_1 (lst, length, less);
+ return list_sort_1(lst, length, less);
}
diff --git a/xorg-server/hw/xquartz/xpr/xprAppleWM.c b/xorg-server/hw/xquartz/xpr/xprAppleWM.c
index b6b9a5fc8..77b9fa3e8 100644
--- a/xorg-server/hw/xquartz/xpr/xprAppleWM.c
+++ b/xorg-server/hw/xquartz/xpr/xprAppleWM.c
@@ -43,9 +43,8 @@
#include "quartz.h"
#include "x-hash.h"
-static int xprSetWindowLevel(
- WindowPtr pWin,
- int level)
+static int
+xprSetWindowLevel(WindowPtr pWin, int level)
{
xp_window_id wid;
xp_window_changes wc;
@@ -56,25 +55,25 @@ static int xprSetWindowLevel(
if (level < 0 || level >= AppleWMNumWindowLevels) {
return BadValue;
}
-
- wid = x_cvt_vptr_to_uint(RootlessFrameForWindow (pWin, TRUE));
+
+ wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE));
if (wid == 0)
return BadWindow;
- RootlessStopDrawing (pWin, FALSE);
+ RootlessStopDrawing(pWin, FALSE);
winRec = WINREC(pWin);
-
- if(!winRec)
+
+ if (!winRec)
return BadWindow;
-
- if(XQuartzIsRootless)
+
+ if (XQuartzIsRootless)
wc.window_level = normal_window_levels[level];
- else if(XQuartzShieldingWindowLevel)
+ else if (XQuartzShieldingWindowLevel)
wc.window_level = XQuartzShieldingWindowLevel + 1;
else
wc.window_level = rooted_window_levels[level];
-
- if (xp_configure_window (wid, XP_WINDOW_LEVEL, &wc) != Success) {
+
+ if (xp_configure_window(wid, XP_WINDOW_LEVEL, &wc) != Success) {
return BadValue;
}
@@ -84,52 +83,54 @@ static int xprSetWindowLevel(
}
#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 3
-static int xprAttachTransient(WindowPtr pWinChild, WindowPtr pWinParent) {
- xp_window_id child_wid, parent_wid;
+static int
+xprAttachTransient(WindowPtr pWinChild, WindowPtr pWinParent)
+{
+ xp_window_id child_wid, parent_wid;
xp_window_changes wc;
child_wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWinChild, TRUE));
if (child_wid == 0)
return BadWindow;
- if(pWinParent) {
- parent_wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWinParent, TRUE));
+ if (pWinParent) {
+ parent_wid =
+ x_cvt_vptr_to_uint(RootlessFrameForWindow(pWinParent, TRUE));
if (parent_wid == 0)
return BadWindow;
- } else {
+ }
+ else {
parent_wid = 0;
}
-
+
wc.transient_for = parent_wid;
- RootlessStopDrawing (pWinChild, FALSE);
+ RootlessStopDrawing(pWinChild, FALSE);
if (xp_configure_window(child_wid, XP_ATTACH_TRANSIENT, &wc) != Success) {
return BadValue;
}
- return Success;
+ return Success;
}
#endif
-static int xprFrameDraw(
- WindowPtr pWin,
- xp_frame_class class,
- xp_frame_attr attr,
- const BoxRec *outer,
- const BoxRec *inner,
- unsigned int title_len,
- const unsigned char *title_bytes)
+static int
+xprFrameDraw(WindowPtr pWin,
+ xp_frame_class class,
+ xp_frame_attr attr,
+ const BoxRec * outer,
+ const BoxRec * inner,
+ unsigned int title_len, const unsigned char *title_bytes)
{
xp_window_id wid;
- wid = x_cvt_vptr_to_uint(RootlessFrameForWindow (pWin, FALSE));
+ wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, FALSE));
if (wid == 0)
return BadWindow;
- if (xp_frame_draw (wid, class, attr, outer, inner,
- title_len, title_bytes) != Success)
- {
+ if (xp_frame_draw(wid, class, attr, outer, inner,
+ title_len, title_bytes) != Success) {
return BadValue;
}
@@ -155,8 +156,8 @@ static AppleWMProcsRec xprAppleWMProcs = {
#endif
};
-
-void xprAppleWMInit(void)
+void
+xprAppleWMInit(void)
{
AppleWMExtensionInit(&xprAppleWMProcs);
}
diff --git a/xorg-server/hw/xquartz/xpr/xprCursor.c b/xorg-server/hw/xquartz/xpr/xprCursor.c
index 2b31865a5..b0afa8c0e 100644
--- a/xorg-server/hw/xquartz/xpr/xprCursor.c
+++ b/xorg-server/hw/xquartz/xpr/xprCursor.c
@@ -51,12 +51,13 @@
#include "x-hash.h"
typedef struct {
- int cursorVisible;
- QueryBestSizeProcPtr QueryBestSize;
- miPointerSpriteFuncPtr spriteFuncs;
+ int cursorVisible;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
static DevPrivateKeyRec darwinCursorScreenKeyRec;
+
#define darwinCursorScreenKey (&darwinCursorScreenKeyRec)
#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
@@ -85,22 +86,22 @@ load_cursor(CursorPtr src, int screen)
hot_y = src->bits->yhot;
#ifdef ARGB_CURSOR
- if (src->bits->argb != NULL)
- {
+ if (src->bits->argb != NULL) {
#if BITMAP_BIT_ORDER == MSBFirst
- rowbytes = src->bits->width * sizeof (CARD32);
+ rowbytes = src->bits->width * sizeof(CARD32);
data = (uint32_t *) src->bits->argb;
#else
- const uint32_t *be_data=(uint32_t *) src->bits->argb;
+ const uint32_t *be_data = (uint32_t *) src->bits->argb;
unsigned i;
- rowbytes = src->bits->width * sizeof (CARD32);
+
+ rowbytes = src->bits->width * sizeof(CARD32);
data = malloc(rowbytes * src->bits->height);
free_data = TRUE;
- if(!data) {
+ if (!data) {
FatalError("Failed to allocate memory in %s\n", __func__);
}
- for(i=0;i<(src->bits->width*src->bits->height);i++)
- data[i]=ntohl(be_data[i]);
+ for (i = 0; i < (src->bits->width * src->bits->height); i++)
+ data[i] = ntohl(be_data[i]);
#endif
}
else
@@ -123,42 +124,43 @@ load_cursor(CursorPtr src, int screen)
rowbytes = ((src->bits->width * 4) + 31) & ~31;
data = malloc(rowbytes * src->bits->height);
free_data = TRUE;
- if(!data) {
+ if (!data) {
FatalError("Failed to allocate memory in %s\n", __func__);
}
-
- if (!src->bits->emptyMask)
- {
+
+ if (!src->bits->emptyMask) {
ycount = src->bits->height;
- srow = src->bits->source; mrow = src->bits->mask;
+ srow = src->bits->source;
+ mrow = src->bits->mask;
drow = data;
- while (ycount-- > 0)
- {
+ while (ycount-- > 0) {
xcount = bits_to_bytes(src->bits->width);
- sptr = srow; mptr = mrow;
+ sptr = srow;
+ mptr = mrow;
dptr = drow;
- while (xcount-- > 0)
- {
+ while (xcount-- > 0) {
uint8_t s, m;
int i;
- s = *sptr++; m = *mptr++;
- for (i = 0; i < 8; i++)
- {
+ s = *sptr++;
+ m = *mptr++;
+ for (i = 0; i < 8; i++) {
#if BITMAP_BIT_ORDER == MSBFirst
if (m & 128)
*dptr++ = (s & 128) ? fg_color : bg_color;
else
*dptr++ = 0;
- s <<= 1; m <<= 1;
+ s <<= 1;
+ m <<= 1;
#else
if (m & 1)
*dptr++ = (s & 1) ? fg_color : bg_color;
else
*dptr++ = 0;
- s >>= 1; m >>= 1;
+ s >>= 1;
+ m >>= 1;
#endif
}
}
@@ -168,19 +170,17 @@ load_cursor(CursorPtr src, int screen)
drow = (uint32_t *) ((char *) drow + rowbytes);
}
}
- else
- {
+ else {
memset(data, 0, src->bits->height * rowbytes);
}
}
err = xp_set_cursor(width, height, hot_x, hot_y, data, rowbytes);
- if(free_data)
+ if (free_data)
free(data);
return err == Success;
}
-
/*
===========================================================================
@@ -196,7 +196,7 @@ load_cursor(CursorPtr src, int screen)
static Bool
QuartzRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- if(pCursor == NULL || pCursor->bits == NULL)
+ if (pCursor == NULL || pCursor->bits == NULL)
return FALSE;
/* FIXME: cache ARGB8888 representation? */
@@ -204,7 +204,6 @@ QuartzRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
return TRUE;
}
-
/*
* QuartzUnrealizeCursor
* Free the storage space associated with a realized cursor.
@@ -215,33 +214,29 @@ QuartzUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
return TRUE;
}
-
/*
* QuartzSetCursor
* Set the cursor sprite and position.
*/
static void
-QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
+ int y)
{
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
if (!XQuartzServerVisible)
return;
- if (pCursor == NULL)
- {
- if (ScreenPriv->cursorVisible)
- {
+ if (pCursor == NULL) {
+ if (ScreenPriv->cursorVisible) {
xp_hide_cursor();
ScreenPriv->cursorVisible = FALSE;
}
}
- else
- {
+ else {
load_cursor(pCursor, pScreen->myNum);
- if (!ScreenPriv->cursorVisible)
- {
+ if (!ScreenPriv->cursorVisible) {
xp_show_cursor();
ScreenPriv->cursorVisible = TRUE;
}
@@ -274,7 +269,6 @@ QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
return FALSE;
}
-
/*
* QuartzCrossScreen
*/
@@ -284,7 +278,6 @@ QuartzCrossScreen(ScreenPtr pScreen, Bool entering)
return;
}
-
/*
* QuartzWarpCursor
* Change the cursor position without generating an event or motion history.
@@ -294,8 +287,7 @@ QuartzCrossScreen(ScreenPtr pScreen, Bool entering)
static void
QuartzWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
- if (XQuartzServerVisible)
- {
+ if (XQuartzServerVisible) {
int sx, sy;
sx = pScreen->x + darwinMainScreenX;
@@ -308,7 +300,6 @@ QuartzWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
miPointerUpdateSprite(pDev);
}
-
static miPointerScreenFuncRec quartzScreenFuncsRec = {
QuartzCursorOffScreen,
QuartzCrossScreen,
@@ -317,7 +308,6 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = {
NULL
};
-
/*
===========================================================================
@@ -336,15 +326,13 @@ QuartzCursorQueryBestSize(int class, unsigned short *width,
{
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
- if (class == CursorShape)
- {
+ if (class == CursorShape) {
/* FIXME: query window server? */
*width = 32;
*height = 32;
}
- else
- {
- (*ScreenPriv->QueryBestSize)(class, width, height, pScreen);
+ else {
+ (*ScreenPriv->QueryBestSize) (class, width, height, pScreen);
}
}
@@ -363,7 +351,7 @@ QuartzInitCursor(ScreenPtr pScreen)
return FALSE;
if (!dixRegisterPrivateKey(&darwinCursorScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
ScreenPriv = calloc(1, sizeof(QuartzCursorScreenRec));
if (ScreenPriv == NULL)
@@ -384,7 +372,7 @@ QuartzInitCursor(ScreenPtr pScreen)
PointPriv->spriteFuncs->UnrealizeCursor = QuartzUnrealizeCursor;
PointPriv->spriteFuncs->SetCursor = QuartzSetCursor;
PointPriv->spriteFuncs->MoveCursor = QuartzMoveCursor;
-
+
ScreenPriv->cursorVisible = TRUE;
return TRUE;
}
@@ -398,7 +386,6 @@ QuartzSuspendXCursor(ScreenPtr pScreen)
{
}
-
/*
* QuartzResumeXCursor
* X server is showing. Restore the X cursor.
@@ -410,7 +397,7 @@ QuartzResumeXCursor(ScreenPtr pScreen)
CursorPtr pCursor;
/* TODO: Tablet? */
-
+
pWin = GetSpriteWindow(darwinPointer);
if (pWin->drawable.pScreen != pScreen)
return;
diff --git a/xorg-server/hw/xquartz/xpr/xprEvent.c b/xorg-server/hw/xquartz/xpr/xprEvent.c
index 4e7ece64f..7f4b077c3 100644
--- a/xorg-server/hw/xquartz/xpr/xprEvent.c
+++ b/xorg-server/hw/xquartz/xpr/xprEvent.c
@@ -55,24 +55,25 @@
#include "rootlessWindow.h"
#include "xprEvent.h"
-Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) {
- switch(e->subtype) {
- case kXquartzWindowState:
- DEBUG_LOG("kXquartzWindowState\n");
- RootlessNativeWindowStateChanged(xprGetXWindow(e->data[0]),
- e->data[1]);
- return TRUE;
-
- case kXquartzWindowMoved:
- DEBUG_LOG("kXquartzWindowMoved\n");
- RootlessNativeWindowMoved(xprGetXWindow(e->data[0]));
- return TRUE;
-
- case kXquartzBringAllToFront:
- DEBUG_LOG("kXquartzBringAllToFront\n");
- RootlessOrderAllWindows(e->data[0]);
- return TRUE;
- default:
- return FALSE;
+Bool
+QuartzModeEventHandler(int screenNum, XQuartzEvent * e, DeviceIntPtr dev)
+{
+ switch (e->subtype) {
+ case kXquartzWindowState:
+ DEBUG_LOG("kXquartzWindowState\n");
+ RootlessNativeWindowStateChanged(xprGetXWindow(e->data[0]), e->data[1]);
+ return TRUE;
+
+ case kXquartzWindowMoved:
+ DEBUG_LOG("kXquartzWindowMoved\n");
+ RootlessNativeWindowMoved(xprGetXWindow(e->data[0]));
+ return TRUE;
+
+ case kXquartzBringAllToFront:
+ DEBUG_LOG("kXquartzBringAllToFront\n");
+ RootlessOrderAllWindows(e->data[0]);
+ return TRUE;
+ default:
+ return FALSE;
}
}
diff --git a/xorg-server/hw/xquartz/xpr/xprFrame.c b/xorg-server/hw/xquartz/xpr/xprFrame.c
index 98f1cc3ed..ed81c4b48 100644
--- a/xorg-server/hw/xquartz/xpr/xprFrame.c
+++ b/xorg-server/hw/xquartz/xpr/xprFrame.c
@@ -73,37 +73,51 @@ static pthread_rwlock_t window_hash_rwlock;
#endif
/* Prototypes for static functions */
-static Bool xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
+static Bool
+xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
int newX, int newY, RegionPtr pShape);
-static void xprDestroyFrame(RootlessFrameID wid);
-static void xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
-static void xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
+static void
+xprDestroyFrame(RootlessFrameID wid);
+static void
+xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
+static void
+xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
int newX, int newY, unsigned int newW, unsigned int newH,
unsigned int gravity);
-static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid);
-static void xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape);
-static void xprUnmapFrame(RootlessFrameID wid);
-static void xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow);
-static void xprStopDrawing(RootlessFrameID wid, Bool flush);
-static void xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage);
-static void xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
+static void
+xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid);
+static void
+xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape);
+static void
+xprUnmapFrame(RootlessFrameID wid);
+static void
+xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow);
+static void
+xprStopDrawing(RootlessFrameID wid, Bool flush);
+static void
+xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage);
+static void
+xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec * rects,
int shift_x, int shift_y);
-static void xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin);
-static Bool xprDoReorderWindow(RootlessWindowPtr pFrame);
-static void xprHideWindow(RootlessFrameID wid);
-static void xprUpdateColormap(RootlessFrameID wid, ScreenPtr pScreen);
-static void xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
+static void
+xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin);
+static Bool
+xprDoReorderWindow(RootlessWindowPtr pFrame);
+static void
+xprHideWindow(RootlessFrameID wid);
+static void
+xprUpdateColormap(RootlessFrameID wid, ScreenPtr pScreen);
+static void
+xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec * dstRects,
int dx, int dy);
-
static inline xp_error
xprConfigureWindow(xp_window_id id, unsigned int mask,
- const xp_window_changes *values)
+ const xp_window_changes * values)
{
return xp_configure_window(id, mask, values);
}
-
static void
xprSetNativeProperty(RootlessWindowPtr pFrame)
{
@@ -112,20 +126,22 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
long data;
err = xp_get_native_window(x_cvt_vptr_to_uint(pFrame->wid), &native_id);
- if (err == Success)
- {
+ if (err == Success) {
/* FIXME: move this to AppleWM extension */
data = native_id;
- dixChangeWindowProperty(serverClient, pFrame->win, xa_native_window_id(),
- XA_INTEGER, 32, PropModeReplace, 1, &data, TRUE);
+ dixChangeWindowProperty(serverClient, pFrame->win,
+ xa_native_window_id(), XA_INTEGER, 32,
+ PropModeReplace, 1, &data, TRUE);
}
}
static xp_error
-xprColormapCallback(void *data, int first_color, int n_colors, uint32_t *colors)
+xprColormapCallback(void *data, int first_color, int n_colors,
+ uint32_t * colors)
{
- return (RootlessResolveColormap (data, first_color, n_colors, colors) ? XP_Success : XP_BadMatch);
+ return (RootlessResolveColormap(data, first_color, n_colors, colors) ?
+ XP_Success : XP_BadMatch);
}
/*
@@ -147,8 +163,7 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
wc.bit_gravity = XP_GRAVITY_NONE;
mask |= XP_BOUNDS;
- if (pWin->drawable.depth == 8)
- {
+ if (pWin->drawable.depth == 8) {
wc.depth = XP_DEPTH_INDEX8;
wc.colormap = xprColormapCallback;
wc.colormap_data = pScreen;
@@ -162,35 +177,34 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
wc.depth = XP_DEPTH_NIL;
mask |= XP_DEPTH;
- if (pShape != NULL)
- {
+ if (pShape != NULL) {
wc.shape_nrects = RegionNumRects(pShape);
wc.shape_rects = RegionRects(pShape);
wc.shape_tx = wc.shape_ty = 0;
mask |= XP_SHAPE;
}
- pFrame->level = !IsRoot (pWin) ? AppleWMWindowLevelNormal : AppleWMNumWindowLevels;
+ pFrame->level =
+ !IsRoot(pWin) ? AppleWMWindowLevelNormal : AppleWMNumWindowLevels;
- if(XQuartzIsRootless)
+ if (XQuartzIsRootless)
wc.window_level = normal_window_levels[pFrame->level];
- else if(XQuartzShieldingWindowLevel)
+ else if (XQuartzShieldingWindowLevel)
wc.window_level = XQuartzShieldingWindowLevel + 1;
else
wc.window_level = rooted_window_levels[pFrame->level];
mask |= XP_WINDOW_LEVEL;
- err = xp_create_window(mask, &wc, (xp_window_id *) &pFrame->wid);
+ err = xp_create_window(mask, &wc, (xp_window_id *) & pFrame->wid);
- if (err != Success)
- {
+ if (err != Success) {
return FALSE;
}
#ifdef HAVE_LIBDISPATCH
- dispatch_async(window_hash_serial_q, ^{
- x_hash_table_insert(window_hash, pFrame->wid, pFrame);
- });
+ dispatch_async(window_hash_serial_q, ^ {
+ x_hash_table_insert(window_hash, pFrame->wid, pFrame);}
+ );
#else
pthread_rwlock_wrlock(&window_hash_rwlock);
x_hash_table_insert(window_hash, pFrame->wid, pFrame);
@@ -202,7 +216,6 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
return TRUE;
}
-
/*
* Destroy a frame.
*/
@@ -212,9 +225,8 @@ xprDestroyFrame(RootlessFrameID wid)
xp_error err;
#ifdef HAVE_LIBDISPATCH
- dispatch_async(window_hash_serial_q, ^{
- x_hash_table_remove(window_hash, wid);
- });
+ dispatch_async(window_hash_serial_q, ^ {
+ x_hash_table_remove(window_hash, wid);});
#else
pthread_rwlock_wrlock(&window_hash_rwlock);
x_hash_table_remove(window_hash, wid);
@@ -223,10 +235,10 @@ xprDestroyFrame(RootlessFrameID wid)
err = xp_destroy_window(x_cvt_vptr_to_uint(wid));
if (err != Success)
- FatalError("Could not destroy window %d (%d).", (int)x_cvt_vptr_to_uint(wid), (int)err);
+ FatalError("Could not destroy window %d (%d).",
+ (int) x_cvt_vptr_to_uint(wid), (int) err);
}
-
/*
* Move a frame on screen.
*/
@@ -241,7 +253,6 @@ xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_ORIGIN, &wc);
}
-
/*
* Resize and move a frame.
*/
@@ -264,43 +275,46 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_BOUNDS, &wc);
}
-
/*
* Change frame stacking.
*/
-static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
+static void
+xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
+{
xp_window_changes wc;
unsigned int mask = XP_STACKING;
+
#ifdef HAVE_LIBDISPATCH
__block
#endif
- RootlessWindowRec *winRec;
+ RootlessWindowRec * winRec;
/* Stack frame below nextWid it if it exists, or raise
frame above everything otherwise. */
- if(nextWid == NULL) {
+ if (nextWid == NULL) {
wc.stack_mode = XP_MAPPED_ABOVE;
wc.sibling = 0;
- } else {
+ }
+ else {
wc.stack_mode = XP_MAPPED_BELOW;
wc.sibling = x_cvt_vptr_to_uint(nextWid);
}
#ifdef HAVE_LIBDISPATCH
- dispatch_sync(window_hash_serial_q, ^{
- winRec = x_hash_table_lookup(window_hash, wid, NULL);
- });
+ dispatch_sync(window_hash_serial_q, ^ {
+ winRec = x_hash_table_lookup(window_hash, wid, NULL);}
+ );
#else
pthread_rwlock_rdlock(&window_hash_rwlock);
winRec = x_hash_table_lookup(window_hash, wid, NULL);
pthread_rwlock_unlock(&window_hash_rwlock);
#endif
-
- if(winRec) {
- if(XQuartzIsRootless)
+
+ if (winRec) {
+ if (XQuartzIsRootless)
wc.window_level = normal_window_levels[winRec->level];
- else if(XQuartzShieldingWindowLevel)
+ else if (XQuartzShieldingWindowLevel)
wc.window_level = XQuartzShieldingWindowLevel + 1;
else
wc.window_level = rooted_window_levels[winRec->level];
@@ -310,7 +324,6 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
xprConfigureWindow(x_cvt_vptr_to_uint(wid), mask, &wc);
}
-
/*
* Change the frame's shape.
*/
@@ -319,13 +332,11 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
{
xp_window_changes wc;
- if (pShape != NULL)
- {
+ if (pShape != NULL) {
wc.shape_nrects = RegionNumRects(pShape);
wc.shape_rects = RegionRects(pShape);
}
- else
- {
+ else {
wc.shape_nrects = -1;
wc.shape_rects = NULL;
}
@@ -335,7 +346,6 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_SHAPE, &wc);
}
-
/*
* Unmap a frame.
*/
@@ -350,7 +360,6 @@ xprUnmapFrame(RootlessFrameID wid)
xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_STACKING, &wc);
}
-
/*
* Start drawing to a frame.
* Prepare for direct access to its backing buffer.
@@ -362,15 +371,17 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
unsigned int rowbytes[2];
xp_error err;
- err = xp_lock_window(x_cvt_vptr_to_uint(wid), NULL, NULL, data, rowbytes, NULL);
+ err =
+ xp_lock_window(x_cvt_vptr_to_uint(wid), NULL, NULL, data, rowbytes,
+ NULL);
if (err != Success)
- FatalError("Could not lock window %d for drawing (%d).", (int)x_cvt_vptr_to_uint(wid), (int)err);
+ FatalError("Could not lock window %d for drawing (%d).",
+ (int) x_cvt_vptr_to_uint(wid), (int) err);
*pixelData = data[0];
*bytesPerRow = rowbytes[0];
}
-
/*
* Stop drawing to a frame.
*/
@@ -383,11 +394,11 @@ xprStopDrawing(RootlessFrameID wid, Bool flush)
/* This should be a FatalError, but we started tripping over it. Make it a
* FatalError after http://xquartz.macosforge.org/trac/ticket/482 is fixed.
*/
- if(err != Success)
- ErrorF("Could not unlock window %d after drawing (%d).", (int)x_cvt_vptr_to_uint(wid), (int)err);
+ if (err != Success)
+ ErrorF("Could not unlock window %d after drawing (%d).",
+ (int) x_cvt_vptr_to_uint(wid), (int) err);
}
-
/*
* Flush drawing updates to the screen.
*/
@@ -397,18 +408,16 @@ xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
xp_flush_window(x_cvt_vptr_to_uint(wid));
}
-
/*
* Mark damaged rectangles as requiring redisplay to screen.
*/
static void
-xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
+xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec * rects,
int shift_x, int shift_y)
{
xp_mark_window(x_cvt_vptr_to_uint(wid), nrects, rects, shift_x, shift_y);
}
-
/*
* Called after the window associated with a frame has been switched
* to a new top-level parent.
@@ -421,31 +430,29 @@ xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
xprSetNativeProperty(pFrame);
}
-
/*
* Called to check if the frame should be reordered when it is restacked.
*/
-static Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
+static Bool
+xprDoReorderWindow(RootlessWindowPtr pFrame)
{
WindowPtr pWin = pFrame->win;
return AppleWMDoReorderWindow(pWin);
}
-
/*
* Copy area in frame to another part of frame.
* Used to accelerate scrolling.
*/
static void
-xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
+xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec * dstRects,
int dx, int dy)
{
xp_copy_window(x_cvt_vptr_to_uint(wid), x_cvt_vptr_to_uint(wid),
dstNrects, dstRects, dx, dy);
}
-
static RootlessFrameProcsRec xprRootlessProcs = {
xprCreateFrame,
xprDestroyFrame,
@@ -466,7 +473,6 @@ static RootlessFrameProcsRec xprRootlessProcs = {
xprCopyWindow
};
-
/*
* Initialize XPR implementation
*/
@@ -480,15 +486,16 @@ xprInit(ScreenPtr pScreen)
assert((window_hash = x_hash_table_new(NULL, NULL, NULL, NULL)));
#ifdef HAVE_LIBDISPATCH
- assert((window_hash_serial_q = dispatch_queue_create(BUNDLE_ID_PREFIX".X11.xpr_window_hash", NULL)));
+ assert((window_hash_serial_q =
+ dispatch_queue_create(BUNDLE_ID_PREFIX ".X11.xpr_window_hash",
+ NULL)));
#else
assert(0 == pthread_rwlock_init(&window_hash_rwlock, NULL));
#endif
-
+
return TRUE;
}
-
/*
* Given the id of a physical window, try to find the top-level (or root)
* X window that it represents.
@@ -498,11 +505,14 @@ xprGetXWindow(xp_window_id wid)
{
#ifdef HAVE_LIBDISPATCH
RootlessWindowRec *winRec __block;
- dispatch_sync(window_hash_serial_q, ^{
- winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
- });
+
+ dispatch_sync(window_hash_serial_q, ^ {
+ winRec =
+ x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid),
+ NULL);});
#else
RootlessWindowRec *winRec;
+
pthread_rwlock_rdlock(&window_hash_rwlock);
winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
pthread_rwlock_unlock(&window_hash_rwlock);
@@ -529,7 +539,6 @@ xprIsX11Window(int windowNumber)
return ret;
}
-
/*
* xprHideWindows
* Hide or unhide all top level windows. This is called for application hide/
@@ -544,6 +553,7 @@ xprHideWindows(Bool hide)
for (screen = 0; screen < screenInfo.numScreens; screen++) {
RootlessFrameID prevWid = NULL;
+
pRoot = screenInfo.screens[screen]->root;
for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) {
@@ -552,7 +562,8 @@ xprHideWindows(Bool hide)
if (winRec != NULL) {
if (hide) {
xprUnmapFrame(winRec->wid);
- } else {
+ }
+ else {
BoxRec box;
xprRestackFrame(winRec->wid, prevWid);
@@ -577,32 +588,35 @@ xprHideWindows(Bool hide)
Bool no_configure_window;
static inline int
-configure_window (xp_window_id id, unsigned int mask,
- const xp_window_changes *values)
+configure_window(xp_window_id id, unsigned int mask,
+ const xp_window_changes * values)
{
- if (!no_configure_window)
- return xp_configure_window (id, mask, values);
- else
- return XP_Success;
+ if (!no_configure_window)
+ return xp_configure_window(id, mask, values);
+ else
+ return XP_Success;
}
-
static
-void xprUpdateColormap(RootlessFrameID wid, ScreenPtr pScreen)
+ void
+xprUpdateColormap(RootlessFrameID wid, ScreenPtr pScreen)
{
- /* This is how we tell xp that the colormap may have changed. */
- xp_window_changes wc;
- wc.colormap = xprColormapCallback;
- wc.colormap_data = pScreen;
+ /* This is how we tell xp that the colormap may have changed. */
+ xp_window_changes wc;
- configure_window(MAKE_WINDOW_ID(wid), XP_COLORMAP, &wc);
+ wc.colormap = xprColormapCallback;
+ wc.colormap_data = pScreen;
+
+ configure_window(MAKE_WINDOW_ID(wid), XP_COLORMAP, &wc);
}
static
-void xprHideWindow(RootlessFrameID wid)
+ void
+xprHideWindow(RootlessFrameID wid)
{
- xp_window_changes wc;
- wc.stack_mode = XP_UNMAPPED;
- wc.sibling = 0;
- configure_window(MAKE_WINDOW_ID(wid), XP_STACKING, &wc);
+ xp_window_changes wc;
+
+ wc.stack_mode = XP_UNMAPPED;
+ wc.sibling = 0;
+ configure_window(MAKE_WINDOW_ID(wid), XP_STACKING, &wc);
}
diff --git a/xorg-server/hw/xquartz/xpr/xprScreen.c b/xorg-server/hw/xquartz/xpr/xprScreen.c
index 002355eca..185369e6b 100644
--- a/xorg-server/hw/xquartz/xpr/xprScreen.c
+++ b/xorg-server/hw/xquartz/xpr/xprScreen.c
@@ -51,7 +51,7 @@
#include "rootlessCommon.h"
#ifdef DAMAGE
-# include "damage.h"
+#include "damage.h"
#endif
/* 10.4's deferred update makes X slower.. have to live with the tearing
@@ -65,61 +65,67 @@ static const char *xprOpenGLBundle = "glxCGL.bundle";
* eventHandler
* Callback handler for Xplugin events.
*/
-static void eventHandler(unsigned int type, const void *arg,
- unsigned int arg_size, void *data) {
-
+static void
+eventHandler(unsigned int type, const void *arg,
+ unsigned int arg_size, void *data)
+{
+
switch (type) {
- case XP_EVENT_DISPLAY_CHANGED:
- DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n");
- DarwinSendDDXEvent(kXquartzDisplayChanged, 0);
- break;
-
- case XP_EVENT_WINDOW_STATE_CHANGED:
- if (arg_size >= sizeof(xp_window_state_event)) {
- const xp_window_state_event *ws_arg = arg;
-
- DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state);
- DarwinSendDDXEvent(kXquartzWindowState, 2,
- ws_arg->id, ws_arg->state);
- } else {
- DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n");
- }
- break;
-
- case XP_EVENT_WINDOW_MOVED:
- DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n");
- if (arg_size == sizeof(xp_window_id)) {
- xp_window_id id = * (xp_window_id *) arg;
- DarwinSendDDXEvent(kXquartzWindowMoved, 1, id);
- }
- break;
-
- case XP_EVENT_SURFACE_DESTROYED:
- DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n");
- case XP_EVENT_SURFACE_CHANGED:
- DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n");
- if (arg_size == sizeof(xp_surface_id)) {
- int kind;
-
- if (type == XP_EVENT_SURFACE_DESTROYED)
- kind = AppleDRISurfaceNotifyDestroyed;
- else
- kind = AppleDRISurfaceNotifyChanged;
-
- DRISurfaceNotify(*(xp_surface_id *) arg, kind);
- }
- break;
+ case XP_EVENT_DISPLAY_CHANGED:
+ DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n");
+ DarwinSendDDXEvent(kXquartzDisplayChanged, 0);
+ break;
+
+ case XP_EVENT_WINDOW_STATE_CHANGED:
+ if (arg_size >= sizeof(xp_window_state_event)) {
+ const xp_window_state_event *ws_arg = arg;
+
+ DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n",
+ ws_arg->id, ws_arg->state);
+ DarwinSendDDXEvent(kXquartzWindowState, 2, ws_arg->id,
+ ws_arg->state);
+ }
+ else {
+ DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n");
+ }
+ break;
+
+ case XP_EVENT_WINDOW_MOVED:
+ DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n");
+ if (arg_size == sizeof(xp_window_id)) {
+ xp_window_id id = *(xp_window_id *) arg;
+
+ DarwinSendDDXEvent(kXquartzWindowMoved, 1, id);
+ }
+ break;
+
+ case XP_EVENT_SURFACE_DESTROYED:
+ DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n");
+ case XP_EVENT_SURFACE_CHANGED:
+ DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n");
+ if (arg_size == sizeof(xp_surface_id)) {
+ int kind;
+
+ if (type == XP_EVENT_SURFACE_DESTROYED)
+ kind = AppleDRISurfaceNotifyDestroyed;
+ else
+ kind = AppleDRISurfaceNotifyChanged;
+
+ DRISurfaceNotify(*(xp_surface_id *) arg, kind);
+ }
+ break;
#ifdef XP_EVENT_SPACE_CHANGED
- case XP_EVENT_SPACE_CHANGED:
- DEBUG_LOG("XP_EVENT_SPACE_CHANGED\n");
- if(arg_size == sizeof(uint32_t)) {
- uint32_t space_id = *(uint32_t *)arg;
- DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id);
- }
- break;
+ case XP_EVENT_SPACE_CHANGED:
+ DEBUG_LOG("XP_EVENT_SPACE_CHANGED\n");
+ if (arg_size == sizeof(uint32_t)) {
+ uint32_t space_id = *(uint32_t *) arg;
+
+ DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id);
+ }
+ break;
#endif
- default:
- ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type);
+ default:
+ ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type);
}
}
@@ -132,7 +138,7 @@ displayAtIndex(int index)
{
CGError err;
CGDisplayCount cnt;
- CGDirectDisplayID dpy[index+1];
+ CGDirectDisplayID dpy[index + 1];
err = CGGetActiveDisplayList(index + 1, dpy, &cnt);
if (err == kCGErrorSuccess && cnt == index + 1)
@@ -153,19 +159,18 @@ displayScreenBounds(CGDirectDisplayID id)
frame = CGDisplayBounds(id);
DEBUG_LOG(" %dx%d @ (%d,%d).\n",
- (int)frame.size.width, (int)frame.size.height,
- (int)frame.origin.x, (int)frame.origin.y);
-
+ (int) frame.size.width, (int) frame.size.height,
+ (int) frame.origin.x, (int) frame.origin.y);
+
/* Remove menubar to help standard X11 window managers. */
- if (XQuartzIsRootless &&
- frame.origin.x == 0 && frame.origin.y == 0) {
+ if (XQuartzIsRootless && frame.origin.x == 0 && frame.origin.y == 0) {
frame.origin.y += aquaMenuBarHeight;
frame.size.height -= aquaMenuBarHeight;
}
DEBUG_LOG(" %dx%d @ (%d,%d).\n",
- (int)frame.size.width, (int)frame.size.height,
- (int)frame.origin.x, (int)frame.origin.y);
+ (int) frame.size.width, (int) frame.size.height,
+ (int) frame.origin.x, (int) frame.origin.y);
return frame;
}
@@ -176,7 +181,8 @@ displayScreenBounds(CGDirectDisplayID id)
* with PseudoramiX.
*/
static void
-xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScreen)
+xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height,
+ ScreenPtr pScreen)
{
CGDisplayCount i, displayCount;
CGDirectDisplayID *displayList = NULL;
@@ -184,10 +190,11 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScr
// Find all the CoreGraphics displays
CGGetActiveDisplayList(0, NULL, &displayCount);
- DEBUG_LOG("displayCount: %d\n", (int)displayCount);
+ DEBUG_LOG("displayCount: %d\n", (int) displayCount);
- if(!displayCount) {
- ErrorF("CoreGraphics has reported no connected displays. Creating a stub 800x600 display.\n");
+ if (!displayCount) {
+ ErrorF
+ ("CoreGraphics has reported no connected displays. Creating a stub 800x600 display.\n");
*x = *y = 0;
*width = 800;
*height = 600;
@@ -204,7 +211,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScr
displayCount = 1;
displayList = malloc(displayCount * sizeof(CGDirectDisplayID));
- if(!displayList)
+ if (!displayList)
FatalError("Unable to allocate memory for list of displays.\n");
CGGetActiveDisplayList(displayCount, displayList, &displayCount);
QuartzCopyDisplayIDs(pScreen, displayCount, displayList);
@@ -212,6 +219,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScr
/* Get the union of all screens */
for (i = 0; i < displayCount; i++) {
CGDirectDisplayID dpy = displayList[i];
+
frame = displayScreenBounds(dpy);
unionRect = CGRectUnion(unionRect, frame);
}
@@ -226,8 +234,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScr
*x, *y, *width, *height);
/* Tell PseudoramiX about the real screens. */
- for (i = 0; i < displayCount; i++)
- {
+ for (i = 0; i < displayCount; i++) {
CGDirectDisplayID dpy = displayList[i];
frame = displayScreenBounds(dpy);
@@ -235,7 +242,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScr
frame.origin.y -= unionRect.origin.y;
DEBUG_LOG(" placed at X11 coordinate (%d,%d).\n",
- (int)frame.origin.x, (int)frame.origin.y);
+ (int) frame.origin.x, (int) frame.origin.y);
PseudoramiXAddScreen(frame.origin.x, frame.origin.y,
frame.size.width, frame.size.height);
@@ -263,20 +270,18 @@ xprDisplayInit(void)
if (noPseudoramiXExtension)
darwinScreensFound = displayCount;
else
- darwinScreensFound = 1;
+ darwinScreensFound = 1;
if (xp_init(XP_BACKGROUND_EVENTS | XP_NO_DEFERRED_UPDATES) != Success)
FatalError("Could not initialize the Xplugin library.");
xp_select_events(XP_EVENT_DISPLAY_CHANGED
- | XP_EVENT_WINDOW_STATE_CHANGED
- | XP_EVENT_WINDOW_MOVED
+ | XP_EVENT_WINDOW_STATE_CHANGED | XP_EVENT_WINDOW_MOVED
#ifdef XP_EVENT_SPACE_CHANGED
| XP_EVENT_SPACE_CHANGED
#endif
| XP_EVENT_SURFACE_CHANGED
- | XP_EVENT_SURFACE_DESTROYED,
- eventHandler, NULL);
+ | XP_EVENT_SURFACE_DESTROYED, eventHandler, NULL);
AppleDRIExtensionInit();
xprAppleWMInit();
@@ -297,81 +302,92 @@ xprAddScreen(int index, ScreenPtr pScreen)
int depth = darwinDesiredDepth;
DEBUG_LOG("index=%d depth=%d\n", index, depth);
-
- if(depth == -1) {
+
+ if (depth == -1) {
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
- depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
+ depth =
+ CGDisplaySamplesPerPixel(kCGDirectMainDisplay) *
+ CGDisplayBitsPerSample(kCGDirectMainDisplay);
#else
CGDisplayModeRef modeRef;
CFStringRef encStrRef;
-
+
modeRef = CGDisplayCopyDisplayMode(kCGDirectMainDisplay);
- if(!modeRef)
+ if (!modeRef)
goto have_depth;
encStrRef = CGDisplayModeCopyPixelEncoding(modeRef);
CFRelease(modeRef);
- if(!encStrRef)
+ if (!encStrRef)
goto have_depth;
-
- if(CFStringCompare(encStrRef, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+
+ if (CFStringCompare
+ (encStrRef, CFSTR(IO32BitDirectPixels),
+ kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
depth = 24;
- } else if(CFStringCompare(encStrRef, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+ }
+ else if (CFStringCompare
+ (encStrRef, CFSTR(IO16BitDirectPixels),
+ kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
depth = 15;
- } else if(CFStringCompare(encStrRef, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+ }
+ else if (CFStringCompare
+ (encStrRef, CFSTR(IO8BitIndexedPixels),
+ kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
depth = 8;
}
CFRelease(encStrRef);
#endif
}
-
+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
-have_depth:
+ have_depth:
#endif
- switch(depth) {
- case 8: // pseudo-working
- dfb->visuals = PseudoColorMask;
- dfb->preferredCVC = PseudoColor;
- dfb->depth = 8;
- dfb->bitsPerRGB = 8;
- dfb->bitsPerPixel = 8;
- dfb->redMask = 0;
- dfb->greenMask = 0;
- dfb->blueMask = 0;
- break;
- case 15:
- dfb->visuals = TrueColorMask; //LARGE_VISUALS;
- dfb->preferredCVC = TrueColor;
- dfb->depth = 15;
- dfb->bitsPerRGB = 5;
- dfb->bitsPerPixel = 16;
- dfb->redMask = RM_ARGB(0,5,5,5);
- dfb->greenMask = GM_ARGB(0,5,5,5);
- dfb->blueMask = BM_ARGB(0,5,5,5);
- break;
+ switch (depth) {
+ case 8: // pseudo-working
+ dfb->visuals = PseudoColorMask;
+ dfb->preferredCVC = PseudoColor;
+ dfb->depth = 8;
+ dfb->bitsPerRGB = 8;
+ dfb->bitsPerPixel = 8;
+ dfb->redMask = 0;
+ dfb->greenMask = 0;
+ dfb->blueMask = 0;
+ break;
+ case 15:
+ dfb->visuals = TrueColorMask; //LARGE_VISUALS;
+ dfb->preferredCVC = TrueColor;
+ dfb->depth = 15;
+ dfb->bitsPerRGB = 5;
+ dfb->bitsPerPixel = 16;
+ dfb->redMask = RM_ARGB(0, 5, 5, 5);
+ dfb->greenMask = GM_ARGB(0, 5, 5, 5);
+ dfb->blueMask = BM_ARGB(0, 5, 5, 5);
+ break;
// case 24:
- default:
- if(depth != 24)
- ErrorF("Unsupported color depth requested. Defaulting to 24bit. (depth=%d darwinDesiredDepth=%d)\n", depth, darwinDesiredDepth);
- dfb->visuals = TrueColorMask; //LARGE_VISUALS;
- dfb->preferredCVC = TrueColor;
- dfb->depth = 24;
- dfb->bitsPerRGB = 8;
- dfb->bitsPerPixel = 32;
- dfb->redMask = RM_ARGB(0,8,8,8);
- dfb->greenMask = GM_ARGB(0,8,8,8);
- dfb->blueMask = BM_ARGB(0,8,8,8);
- break;
+ default:
+ if (depth != 24)
+ ErrorF
+ ("Unsupported color depth requested. Defaulting to 24bit. (depth=%d darwinDesiredDepth=%d)\n",
+ depth, darwinDesiredDepth);
+ dfb->visuals = TrueColorMask; //LARGE_VISUALS;
+ dfb->preferredCVC = TrueColor;
+ dfb->depth = 24;
+ dfb->bitsPerRGB = 8;
+ dfb->bitsPerPixel = 32;
+ dfb->redMask = RM_ARGB(0, 8, 8, 8);
+ dfb->greenMask = GM_ARGB(0, 8, 8, 8);
+ dfb->blueMask = BM_ARGB(0, 8, 8, 8);
+ break;
}
- if (noPseudoramiXExtension)
- {
+ if (noPseudoramiXExtension) {
CGDirectDisplayID dpy;
CGRect frame;
ErrorF("Warning: noPseudoramiXExtension!\n");
-
+
dpy = displayAtIndex(index);
QuartzCopyDisplayIDs(pScreen, 1, &dpy);
@@ -379,12 +395,12 @@ have_depth:
dfb->x = frame.origin.x;
dfb->y = frame.origin.y;
- dfb->width = frame.size.width;
+ dfb->width = frame.size.width;
dfb->height = frame.size.height;
}
- else
- {
- xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height, pScreen);
+ else {
+ xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height,
+ pScreen);
}
/* Passing zero width (pitch) makes miCreateScreenResources set the
diff --git a/xorg-server/hw/xwin/InitInput.c b/xorg-server/hw/xwin/InitInput.c
index 3e02633a5..e7f402f80 100644
--- a/xorg-server/hw/xwin/InitInput.c
+++ b/xorg-server/hw/xwin/InitInput.c
@@ -33,17 +33,15 @@
#include "dixstruct.h"
#include "inputstr.h"
#include <unistd.h>
-
/*
* Local function prototypes
*/
#ifdef XWIN_CLIPBOARD
-int winProcEstablishConnection(ClientPtr /* client */);
-int winProcSetSelectionOwner(ClientPtr /* client */);
+int winProcEstablishConnection(ClientPtr /* client */ );
+int winProcSetSelectionOwner(ClientPtr /* client */ );
#endif
-
/*
* Local global declarations
*/
@@ -61,89 +59,83 @@ DeviceIntPtr g_pwinKeyboard;
*/
Bool
-LegalModifier (unsigned int uiKey, DeviceIntPtr pDevice)
+LegalModifier(unsigned int uiKey, DeviceIntPtr pDevice)
{
- return TRUE;
+ return TRUE;
}
-
/* Called from dix/dispatch.c */
/*
* Run through the Windows message queue(s) one more time.
* Tell mi to dequeue the events that we have sent it.
*/
void
-ProcessInputEvents (void)
+ProcessInputEvents(void)
{
- mieqProcessInputEvents ();
+ mieqProcessInputEvents();
}
-
-void DDXRingBell(int volume, int pitch, int duration)
+void
+DDXRingBell(int volume, int pitch, int duration)
{
- /* winKeybdBell is used instead */
- return;
+ /* winKeybdBell is used instead */
+ return;
}
-
/* See Porting Layer Definition - p. 17 */
void
-InitInput (int argc, char *argv[])
+InitInput(int argc, char *argv[])
{
int rc;
- winDebug ("InitInput\n");
+ winDebug("InitInput\n");
#ifdef XWIN_CLIPBOARD
- /*
- * Wrap some functions at every generation of the server.
- */
- if (InitialVector[2] != winProcEstablishConnection)
- {
- winProcEstablishConnectionOrig = InitialVector[2];
- InitialVector[2] = winProcEstablishConnection;
+ /*
+ * Wrap some functions at every generation of the server.
+ */
+ if (InitialVector[2] != winProcEstablishConnection) {
+ winProcEstablishConnectionOrig = InitialVector[2];
+ InitialVector[2] = winProcEstablishConnection;
}
#endif
- rc = AllocDevicePair(serverClient, "Windows",
- &g_pwinPointer,
- &g_pwinKeyboard,
- winMouseProc,
- winKeybdProc,
- FALSE);
+ rc = AllocDevicePair(serverClient, "Windows",
+ &g_pwinPointer,
+ &g_pwinKeyboard,
+ winMouseProc,
+ winKeybdProc,
+ FALSE);
- if (rc != Success)
- FatalError("Failed to init vcxsrv default devices.\n");
+ if (rc != Success)
+ FatalError("Failed to init vcxsrv default devices.\n");
- mieqInit ();
+ mieqInit();
- /* Do not nitialize the mode key states here yet since the keyboard device is not started yet
- winInitializeModeKeyStates (); */
+ /* Do not nitialize the mode key states here yet since the keyboard device is not started yet
+ winInitializeModeKeyStates (); */
#ifdef HAS_DEVWINDOWS
- /* Only open the windows message queue device once */
- if (g_fdMessageQueue == WIN_FD_INVALID)
- {
- /* Open a file descriptor for the Windows message queue */
- g_fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY);
-
- if (g_fdMessageQueue == -1)
- {
- FatalError ("InitInput - Failed opening %s\n",
- WIN_MSG_QUEUE_FNAME);
- }
-
- /* Add the message queue as a device to wait for in WaitForSomething */
- AddEnabledDevice (g_fdMessageQueue);
+ /* Only open the windows message queue device once */
+ if (g_fdMessageQueue == WIN_FD_INVALID) {
+ /* Open a file descriptor for the Windows message queue */
+ g_fdMessageQueue = open(WIN_MSG_QUEUE_FNAME, O_RDONLY);
+
+ if (g_fdMessageQueue == -1) {
+ FatalError("InitInput - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
+ }
+
+ /* Add the message queue as a device to wait for in WaitForSomething */
+ AddEnabledDevice(g_fdMessageQueue);
}
#endif
- winDebug ("InitInput - returning\n");
+ winDebug("InitInput - returning\n");
}
void
-CloseInput (void)
+CloseInput(void)
{
- mieqFini ();
- g_pwinPointer=NULL;
- g_pwinKeyboard=NULL;
+ mieqFini();
+ g_pwinPointer=NULL;
+ g_pwinKeyboard=NULL;
}
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
index 2a1635c92..ceb71ff07 100644
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -48,25 +48,22 @@ from The Open Group.
#ifdef RELOCATE_PROJECTROOT
#undef Status
#include <shlobj.h>
-typedef HRESULT (__stdcall * SHGETFOLDERPATHPROC)(
- HWND hwndOwner,
- int nFolder,
- HANDLE hToken,
- DWORD dwFlags,
- LPSTR pszPath
-);
+typedef HRESULT (__stdcall * SHGETFOLDERPATHPROC)(HWND hwndOwner,
+ int nFolder,
+ HANDLE hToken,
+ DWORD dwFlags, LPTSTR pszPath);
#endif
/*
* References to external symbols
*/
#ifdef XWIN_CLIPBOARD
-extern Bool g_fUnicodeClipboard;
-extern Bool g_fClipboardLaunched;
-extern Bool g_fClipboardStarted;
-extern pthread_t g_ptClipboardProc;
-extern HWND g_hwndClipboard;
-extern Bool g_fClipboard;
+extern Bool g_fUnicodeClipboard;
+extern Bool g_fClipboardLaunched;
+extern Bool g_fClipboardStarted;
+extern pthread_t g_ptClipboardProc;
+extern HWND g_hwndClipboard;
+extern Bool g_fClipboard;
#endif
/*
@@ -75,29 +72,28 @@ extern Bool g_fClipboard;
#ifdef XWIN_CLIPBOARD
static void
-winClipboardShutdown (void);
+ winClipboardShutdown(void);
#endif
#if defined(DDXOSVERRORF)
void
-OsVendorVErrorF (const char *pszFormat, va_list va_args);
+ OsVendorVErrorF(const char *pszFormat, va_list va_args);
#endif
static Bool
-winCheckDisplayNumber (void);
+ winCheckDisplayNumber(void);
void
-winLogCommandLine (int argc, char *argv[]);
+ winLogCommandLine(int argc, char *argv[]);
void
-winLogVersionInfo (void);
+ winLogVersionInfo(void);
Bool
-winValidateArgs (void);
+ winValidateArgs(void);
#ifdef RELOCATE_PROJECTROOT
-const char *
-winGetBaseDir(void);
+const char *winGetBaseDir(void);
#endif
/*
@@ -114,38 +110,36 @@ winGetBaseDir(void);
*/
static PixmapFormatRec g_PixmapFormats[] = {
- { 1, 1, BITMAP_SCANLINE_PAD },
- { 4, 8, BITMAP_SCANLINE_PAD },
- { 8, 8, BITMAP_SCANLINE_PAD },
- { 15, 16, BITMAP_SCANLINE_PAD },
- { 16, 16, BITMAP_SCANLINE_PAD },
- { 24, 32, BITMAP_SCANLINE_PAD },
- { 32, 32, BITMAP_SCANLINE_PAD }
+ {1, 1, BITMAP_SCANLINE_PAD},
+ {4, 8, BITMAP_SCANLINE_PAD},
+ {8, 8, BITMAP_SCANLINE_PAD},
+ {15, 16, BITMAP_SCANLINE_PAD},
+ {16, 16, BITMAP_SCANLINE_PAD},
+ {24, 32, BITMAP_SCANLINE_PAD},
+ {32, 32, BITMAP_SCANLINE_PAD}
};
-const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]);
+const int NUMFORMATS = sizeof(g_PixmapFormats) / sizeof(g_PixmapFormats[0]);
#ifdef XWIN_CLIPBOARD
static void
-winClipboardShutdown (void)
+winClipboardShutdown(void)
{
- /* Close down clipboard resources */
- if (g_fClipboard && g_fClipboardLaunched && g_fClipboardStarted)
- {
- /* Synchronously destroy the clipboard window */
- if (g_hwndClipboard != NULL)
- {
+ /* Close down clipboard resources */
+ if (g_fClipboard && g_fClipboardLaunched && g_fClipboardStarted) {
+ /* Synchronously destroy the clipboard window */
+ if (g_hwndClipboard != NULL) {
g_fClipboardStarted=FALSE; /* This is to avoid dead-locls caused by the clipboard thread still doing some stuff */
- SendMessage (g_hwndClipboard, WM_DESTROY, 0, 0);
- /* NOTE: g_hwndClipboard is set to NULL in winclipboardthread.c */
- }
- else
- return;
-
- /* Wait for the clipboard thread to exit */
- pthread_join (g_ptClipboardProc, NULL);
-
- winDebug ("winClipboardShutdown - Clipboard thread has exited.\n");
+ SendMessage(g_hwndClipboard, WM_DESTROY, 0, 0);
+ /* NOTE: g_hwndClipboard is set to NULL in winclipboardthread.c */
+ }
+ else
+ return;
+
+ /* Wait for the clipboard thread to exit */
+ pthread_join(g_ptClipboardProc, NULL);
+
+ winDebug("winClipboardShutdown - Clipboard thread has exited.\n");
}
}
#endif
@@ -158,91 +152,89 @@ winClipboardShutdown (void)
*/
void
-ddxBeforeReset (void)
+ddxBeforeReset(void)
{
- winDebug ("ddxBeforeReset - Hello\n");
+ winDebug("ddxBeforeReset - Hello\n");
#ifdef XWIN_CLIPBOARD
- winClipboardShutdown ();
+ winClipboardShutdown();
#endif
}
#endif
-
/* See Porting Layer Definition - p. 57 */
void
-ddxGiveUp (enum ExitCode error)
+ddxGiveUp(enum ExitCode error)
{
- int i;
+ int i;
- winDebug ("ddxGiveUp\n");
+ winDebug("ddxGiveUp\n");
- /* Perform per-screen deinitialization */
- for (i = 0; i < g_iNumScreens; ++i)
- {
- /* Delete the tray icon */
- if (!g_ScreenInfo[i].fNoTrayIcon && g_ScreenInfo[i].pScreen)
- winDeleteNotifyIcon (winGetScreenPriv (g_ScreenInfo[i].pScreen));
+ /* Perform per-screen deinitialization */
+ for (i = 0; i < g_iNumScreens; ++i) {
+ /* Delete the tray icon */
+ if (!g_ScreenInfo[i].fNoTrayIcon && g_ScreenInfo[i].pScreen)
+ winDeleteNotifyIcon(winGetScreenPriv(g_ScreenInfo[i].pScreen));
}
#ifdef XWIN_MULTIWINDOW
/* Unload libraries for taskbar grouping */
winTaskbarDestroy ();
- /* Notify the worker threads we're exiting */
- winDeinitMultiWindowWM ();
+ /* Notify the worker threads we're exiting */
+ winDeinitMultiWindowWM();
#endif
#ifdef HAS_DEVWINDOWS
- /* Close our handle to our message queue */
- if (g_fdMessageQueue != WIN_FD_INVALID)
- {
- /* Close /dev/windows */
- close (g_fdMessageQueue);
+ /* Close our handle to our message queue */
+ if (g_fdMessageQueue != WIN_FD_INVALID) {
+ /* Close /dev/windows */
+ close(g_fdMessageQueue);
- /* Set the file handle to invalid */
- g_fdMessageQueue = WIN_FD_INVALID;
+ /* Set the file handle to invalid */
+ g_fdMessageQueue = WIN_FD_INVALID;
}
#endif
- if (!g_fLogInited) {
- g_pszLogFile = LogInit (g_pszLogFile, NULL);
- g_fLogInited = TRUE;
- }
- LogClose (error);
-
- /*
- * At this point we aren't creating any new screens, so
- * we are guaranteed to not need the DirectDraw functions.
- */
- winReleaseDDProcAddresses();
-
- /* Free concatenated command line */
- free(g_pszCommandLine);
- g_pszCommandLine = NULL;
-
- /* Remove our keyboard hook if it is installed */
- winRemoveKeyboardHookLL ();
-
- /* Tell Windows that we want to end the app */
- PostQuitMessage (0);
-}
+ if (!g_fLogInited) {
+ g_pszLogFile = LogInit(g_pszLogFile, NULL);
+ g_fLogInited = TRUE;
+ }
+ LogClose(error);
+ /*
+ * At this point we aren't creating any new screens, so
+ * we are guaranteed to not need the DirectDraw functions.
+ */
+ winReleaseDDProcAddresses();
+
+ /* Free concatenated command line */
+ free(g_pszCommandLine);
+ g_pszCommandLine = NULL;
+
+ /* Remove our keyboard hook if it is installed */
+ winRemoveKeyboardHookLL();
+
+ /* Tell Windows that we want to end the app */
+ PostQuitMessage(0);
+}
/* See Porting Layer Definition - p. 57 */
void
-AbortDDX (enum ExitCode error)
+AbortDDX(enum ExitCode error)
{
- winDebug ("AbortDDX\n");
- ddxGiveUp (error);
+ winDebug("AbortDDX\n");
+ ddxGiveUp(error);
}
#ifdef __CYGWIN__
/* hasmntopt is currently not implemented for cygwin */
-static const char *winCheckMntOpt(const struct mntent *mnt, const char *opt)
+static const char *
+winCheckMntOpt(const struct mntent *mnt, const char *opt)
{
const char *s;
size_t len;
+
if (mnt == NULL)
return NULL;
if (opt == NULL)
@@ -254,101 +246,96 @@ static const char *winCheckMntOpt(const struct mntent *mnt, const char *opt)
s = strstr(mnt->mnt_opts, opt);
if (s == NULL)
return NULL;
- if ((s == mnt->mnt_opts || *(s-1) == ',') && (s[len] == 0 || s[len] == ','))
- return (char *)opt;
+ if ((s == mnt->mnt_opts || *(s - 1) == ',') &&
+ (s[len] == 0 || s[len] == ','))
+ return (char *) opt;
return NULL;
}
static void
winCheckMount(void)
{
- FILE *mnt;
- struct mntent *ent;
-
- enum { none = 0, sys_root, user_root, sys_tmp, user_tmp }
- level = none, curlevel;
- BOOL binary = TRUE;
-
- mnt = setmntent("/etc/mtab", "r");
- if (mnt == NULL)
- {
- ErrorF("setmntent failed");
- return;
- }
-
- while ((ent = getmntent(mnt)) != NULL)
- {
- BOOL system = (winCheckMntOpt(ent, "user") != NULL);
- BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
- BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
-
- if (system)
- {
- if (root)
- curlevel = sys_root;
- else if (tmp)
- curlevel = sys_tmp;
- else
- continue;
+ FILE *mnt;
+ struct mntent *ent;
+
+ enum { none = 0, sys_root, user_root, sys_tmp, user_tmp }
+ level = none, curlevel;
+ BOOL binary = TRUE;
+
+ mnt = setmntent("/etc/mtab", "r");
+ if (mnt == NULL) {
+ ErrorF("setmntent failed");
+ return;
}
- else
- {
- if (root)
- curlevel = user_root;
- else if (tmp)
- curlevel = user_tmp;
- else
- continue;
+
+ while ((ent = getmntent(mnt)) != NULL) {
+ BOOL system = (winCheckMntOpt(ent, "user") != NULL);
+ BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
+ BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
+
+ if (system) {
+ if (root)
+ curlevel = sys_root;
+ else if (tmp)
+ curlevel = sys_tmp;
+ else
+ continue;
+ }
+ else {
+ if (root)
+ curlevel = user_root;
+ else if (tmp)
+ curlevel = user_tmp;
+ else
+ continue;
+ }
+
+ if (curlevel <= level)
+ continue;
+ level = curlevel;
+
+ if ((winCheckMntOpt(ent, "binary") == NULL) &&
+ (winCheckMntOpt(ent, "binmode") == NULL))
+ binary = FALSE;
+ else
+ binary = TRUE;
+ }
+
+ if (endmntent(mnt) != 1) {
+ ErrorF("endmntent failed");
+ return;
}
- if (curlevel <= level)
- continue;
- level = curlevel;
-
- if ((winCheckMntOpt(ent, "binary") == NULL) &&
- (winCheckMntOpt(ent, "binmode") == NULL))
- binary = FALSE;
- else
- binary = TRUE;
- }
-
- if (endmntent(mnt) != 1)
- {
- ErrorF("endmntent failed");
- return;
- }
-
#ifdef WINDBG
- if (!binary)
- winDebug("/tmp mounted in textmode\n");
+ if (!binary)
+ winDebug("/tmp mounted in textmode\n");
#endif
}
#else
static void
-winCheckMount(void)
+winCheckMount(void)
{
}
#endif
#ifdef RELOCATE_PROJECTROOT
-const char *
+const char *
winGetBaseDir(void)
{
static BOOL inited = FALSE;
static char buffer[MAX_PATH];
- if (!inited)
- {
+
+ if (!inited) {
char *fendptr;
HMODULE module = GetModuleHandle(NULL);
DWORD size = GetModuleFileName(module, buffer, sizeof(buffer));
+
if (sizeof(buffer) > 0)
- buffer[sizeof(buffer)-1] = 0;
-
+ buffer[sizeof(buffer) - 1] = 0;
+
fendptr = buffer + size;
- while (fendptr > buffer)
- {
- if (*fendptr == '\\' || *fendptr == '/')
- {
+ while (fendptr > buffer) {
+ if (*fendptr == '\\' || *fendptr == '/') {
*fendptr = 0;
break;
}
@@ -361,10 +348,11 @@ winGetBaseDir(void)
#endif
static void
-winFixupPaths (void)
+winFixupPaths(void)
{
BOOL changed_fontpath = FALSE;
MessageType font_from = X_DEFAULT;
+
#ifdef RELOCATE_PROJECTROOT
const char *basedir = winGetBaseDir();
size_t basedirlen = strlen(basedir);
@@ -384,10 +372,9 @@ winFixupPaths (void)
#else
FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt");
#endif
- if (fontdirs != NULL)
- {
+ if (fontdirs != NULL) {
char buffer[256];
- int needs_sep = TRUE;
+ int needs_sep = TRUE;
int comment_block = FALSE;
/* get default fontpath */
@@ -395,8 +382,7 @@ winFixupPaths (void)
size_t size = strlen(fontpath);
/* read all lines */
- while (!feof(fontdirs))
- {
+ while (!feof(fontdirs)) {
size_t blen;
char *hashchar;
char *str;
@@ -404,29 +390,26 @@ winFixupPaths (void)
/* read one line */
str = fgets(buffer, sizeof(buffer), fontdirs);
- if (str == NULL) /* stop on error or eof */
+ if (str == NULL) /* stop on error or eof */
break;
if (strchr(str, '\n') != NULL)
has_eol = TRUE;
/* check if block is continued comment */
- if (comment_block)
- {
+ if (comment_block) {
/* ignore all input */
- *str = 0;
- blen = 0;
- if (has_eol) /* check if line ended in this block */
+ *str = 0;
+ blen = 0;
+ if (has_eol) /* check if line ended in this block */
comment_block = FALSE;
}
- else
- {
+ else {
/* find comment character. ignore all trailing input */
hashchar = strchr(str, '#');
- if (hashchar != NULL)
- {
+ if (hashchar != NULL) {
*hashchar = 0;
- if (!has_eol) /* mark next block as continued comment */
+ if (!has_eol) /* mark next block as continued comment */
comment_block = TRUE;
}
}
@@ -435,31 +418,30 @@ winFixupPaths (void)
while (*str == ' ' || *str == '\t')
str++;
- /* get size, strip whitespaces from end */
+ /* get size, strip whitespaces from end */
blen = strlen(str);
- while (blen > 0 && (str[blen-1] == ' ' ||
- str[blen-1] == '\t' || str[blen-1] == '\n'))
- {
+ while (blen > 0 && (str[blen - 1] == ' ' ||
+ str[blen - 1] == '\t' ||
+ str[blen - 1] == '\n')) {
str[--blen] = 0;
}
- /* still something left to add? */
- if (blen > 0)
- {
+ /* still something left to add? */
+ if (blen > 0) {
size_t newsize = size + blen;
+
/* reserve one character more for ',' */
if (needs_sep)
newsize++;
/* allocate memory */
if (fontpath == NULL)
- fontpath = malloc(newsize+1);
+ fontpath = malloc(newsize + 1);
else
- fontpath = realloc(fontpath, newsize+1);
+ fontpath = realloc(fontpath, newsize + 1);
/* add separator */
- if (needs_sep)
- {
+ if (needs_sep) {
fontpath[size] = ',';
size++;
needs_sep = FALSE;
@@ -477,14 +459,14 @@ winFixupPaths (void)
}
/* cleanup */
- fclose(fontdirs);
+ fclose(fontdirs);
defaultFontPath = strdup(fontpath);
free(fontpath);
changed_fontpath = TRUE;
font_from = X_CONFIG;
}
}
-#endif /* READ_FONTDIRS */
+#endif /* READ_FONTDIRS */
#ifdef RELOCATE_PROJECTROOT
{
const char *libx11dir = PROJECTROOT "/lib/X11";
@@ -497,20 +479,19 @@ winFixupPaths (void)
ptr = strchr(oldptr, ',');
if (ptr == NULL)
ptr = endptr;
- while (ptr != NULL)
- {
+ while (ptr != NULL) {
size_t oldfp_len = (ptr - oldptr);
size_t newsize = oldfp_len;
char *newpath = malloc(newsize + 1);
+
strncpy(newpath, oldptr, newsize);
newpath[newsize] = 0;
-
- if (strncmp(libx11dir, newpath, libx11dir_len) == 0)
- {
+ if (strncmp(libx11dir, newpath, libx11dir_len) == 0) {
char *compose;
+
newsize = newsize - libx11dir_len + basedirlen;
- compose = malloc(newsize + 1);
+ compose = malloc(newsize + 1);
strcpy(compose, basedir);
strncat(compose, newpath + libx11dir_len, newsize - basedirlen);
compose[newsize] = 0;
@@ -520,7 +501,7 @@ winFixupPaths (void)
oldfp_len = newfp_len;
if (oldfp_len > 0)
- newfp_len ++; /* space for separator */
+ newfp_len++; /* space for separator */
newfp_len += newsize;
if (newfp == NULL)
@@ -528,8 +509,7 @@ winFixupPaths (void)
else
newfp = realloc(newfp, newfp_len + 1);
- if (oldfp_len > 0)
- {
+ if (oldfp_len > 0) {
strcpy(newfp + oldfp_len, ",");
oldfp_len++;
}
@@ -537,82 +517,78 @@ winFixupPaths (void)
free(newpath);
- if (*ptr == 0)
- {
+ if (*ptr == 0) {
oldptr = ptr;
ptr = NULL;
- } else
- {
+ }
+ else {
oldptr = ptr + 1;
ptr = strchr(oldptr, ',');
if (ptr == NULL)
ptr = endptr;
}
- }
+ }
defaultFontPath = strdup(newfp);
free(newfp);
changed_fontpath = TRUE;
}
-#endif /* RELOCATE_PROJECTROOT */
+#endif /* RELOCATE_PROJECTROOT */
if (changed_fontpath)
winDebug ("FontPath set to \"%s\"\n", defaultFontPath);
#ifdef RELOCATE_PROJECTROOT
- if (getenv("XKEYSYMDB") == NULL)
- {
+ if (getenv("XKEYSYMDB") == NULL) {
char buffer[MAX_PATH];
- snprintf(buffer, sizeof(buffer), "XKEYSYMDB=%s\\XKeysymDB",
- basedir);
- buffer[sizeof(buffer)-1] = 0;
+
+ snprintf(buffer, sizeof(buffer), "XKEYSYMDB=%s\\XKeysymDB", basedir);
+ buffer[sizeof(buffer) - 1] = 0;
putenv(buffer);
}
- if (getenv("XERRORDB") == NULL)
- {
+ if (getenv("XERRORDB") == NULL) {
char buffer[MAX_PATH];
- snprintf(buffer, sizeof(buffer), "XERRORDB=%s\\XErrorDB",
- basedir);
- buffer[sizeof(buffer)-1] = 0;
+
+ snprintf(buffer, sizeof(buffer), "XERRORDB=%s\\XErrorDB", basedir);
+ buffer[sizeof(buffer) - 1] = 0;
putenv(buffer);
}
- if (getenv("XLOCALEDIR") == NULL)
- {
+ if (getenv("XLOCALEDIR") == NULL) {
char buffer[MAX_PATH];
- snprintf(buffer, sizeof(buffer), "XLOCALEDIR=%s\\locale",
- basedir);
- buffer[sizeof(buffer)-1] = 0;
+
+ snprintf(buffer, sizeof(buffer), "XLOCALEDIR=%s\\locale", basedir);
+ buffer[sizeof(buffer) - 1] = 0;
putenv(buffer);
}
- if (getenv("XHOSTPREFIX") == NULL)
- {
+ if (getenv("XHOSTPREFIX") == NULL) {
char buffer[MAX_PATH];
snprintf(buffer, sizeof(buffer), "XHOSTPREFIX=%s\\X",
basedir);
buffer[sizeof(buffer)-1] = 0;
putenv(buffer);
}
- if (getenv("HOME") == NULL)
- {
+ if (getenv("HOME") == NULL) {
char buffer[MAX_PATH + 5];
+
strncpy(buffer, "HOME=", 5);
/* query appdata directory */
- if (SHGetFolderPathA(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, buffer + 5) == 0)
- {
+ if (SHGetFolderPathA
+ (NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0,
+ buffer + 5) == 0) {
putenv(buffer);
- } else
- {
+ }
+ else {
ErrorF ("Can not determine HOME directory\n");
}
}
if (!g_fLogFileChanged) {
static char buffer[MAX_PATH];
DWORD size = GetTempPath(sizeof(buffer), buffer);
- if (size && size < sizeof(buffer))
- {
- snprintf(buffer + size, sizeof(buffer) - size,
+
+ if (size && size < sizeof(buffer)) {
+ snprintf(buffer + size, sizeof(buffer) - size,
"VCXSrv.%s.log", display);
- buffer[sizeof(buffer)-1] = 0;
+ buffer[sizeof(buffer) - 1] = 0;
g_pszLogFile = buffer;
GetLongPathName(buffer, buffer, MAX_PATH);
winDebug ("Logfile set to \"%s\"\n", g_pszLogFile);
@@ -623,300 +599,288 @@ winFixupPaths (void)
snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkbdata", basedir);
if (sizeof(xkbbasedir) > 0)
- xkbbasedir[sizeof(xkbbasedir)-1] = 0;
+ xkbbasedir[sizeof(xkbbasedir) - 1] = 0;
XkbBaseDirectory = xkbbasedir;
- XkbBinDirectory = basedir;
+ XkbBinDirectory = basedir;
}
-#endif /* RELOCATE_PROJECTROOT */
+#endif /* RELOCATE_PROJECTROOT */
}
void
-OsVendorInit (void)
+OsVendorInit(void)
{
- /* Re-initialize global variables on server reset */
- winInitializeGlobals ();
+ /* Re-initialize global variables on server reset */
+ winInitializeGlobals();
- winFixupPaths();
+ winFixupPaths();
#ifdef DDXOSVERRORF
- if (!OsVendorVErrorFProc)
- OsVendorVErrorFProc = OsVendorVErrorF;
+ if (!OsVendorVErrorFProc)
+ OsVendorVErrorFProc = OsVendorVErrorF;
#endif
- if (!g_fLogInited) {
- /* keep this order. If LogInit fails it calls Abort which then calls
- * ddxGiveUp where LogInit is called again and creates an infinite
- * recursion. If we set g_fLogInited to TRUE before the init we
- * avoid the second call
- */
- g_fLogInited = TRUE;
- g_pszLogFile = LogInit (g_pszLogFile, NULL);
- }
- LogSetParameter (XLOG_FLUSH, 1);
- LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
- LogSetParameter (XLOG_FILE_VERBOSITY, g_iLogVerbose);
-
- /* Log the version information */
- if (serverGeneration == 1)
- winLogVersionInfo ();
-
- winCheckMount();
-
- /* Add a default screen if no screens were specified */
- if (g_iNumScreens == 0)
- {
- winDebug ("OsVendorInit - Creating default screen 0\n");
-
- /*
- * We need to initialize the default screen 0 if no -screen
- * arguments were processed.
- *
- * Add a screen 0 using the defaults set by winInitializeDefaultScreens()
- * and any additional default screen parameters given
- */
- winInitializeScreens(1);
-
- /* We have to flag this as an explicit screen, even though it isn't */
- g_ScreenInfo[0].fExplicitScreen = TRUE;
+ if (!g_fLogInited) {
+ /* keep this order. If LogInit fails it calls Abort which then calls
+ * ddxGiveUp where LogInit is called again and creates an infinite
+ * recursion. If we set g_fLogInited to TRUE before the init we
+ * avoid the second call
+ */
+ g_fLogInited = TRUE;
+ g_pszLogFile = LogInit(g_pszLogFile, NULL);
+ }
+ LogSetParameter(XLOG_FLUSH, 1);
+ LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose);
+ LogSetParameter(XLOG_FILE_VERBOSITY, g_iLogVerbose);
+
+ /* Log the version information */
+ if (serverGeneration == 1)
+ winLogVersionInfo();
+
+ winCheckMount();
+
+ /* Add a default screen if no screens were specified */
+ if (g_iNumScreens == 0) {
+ winDebug("OsVendorInit - Creating default screen 0\n");
+
+ /*
+ * We need to initialize the default screen 0 if no -screen
+ * arguments were processed.
+ *
+ * Add a screen 0 using the defaults set by winInitializeDefaultScreens()
+ * and any additional default screen parameters given
+ */
+ winInitializeScreens(1);
+
+ /* We have to flag this as an explicit screen, even though it isn't */
+ g_ScreenInfo[0].fExplicitScreen = TRUE;
}
- /* Work out what the default emulate3buttons setting should be, and apply
- it if nothing was explicitly specified */
- {
- int mouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
- int j;
-
- for (j = 0; j < g_iNumScreens; j++)
- {
- if (g_ScreenInfo[j].iE3BTimeout == WIN_E3B_DEFAULT)
- {
- if (mouseButtons < 3)
- {
- static Bool reportOnce = TRUE;
- g_ScreenInfo[j].iE3BTimeout = WIN_DEFAULT_E3B_TIME;
- if (reportOnce)
- {
- reportOnce = FALSE;
- winDebug("Windows reports only %d mouse buttons, defaulting to -emulate3buttons\n", mouseButtons);
- }
- }
- else
- {
- g_ScreenInfo[j].iE3BTimeout = WIN_E3B_OFF;
- }
- }
- }
- }
+ /* Work out what the default emulate3buttons setting should be, and apply
+ it if nothing was explicitly specified */
+ {
+ int mouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
+ int j;
+
+ for (j = 0; j < g_iNumScreens; j++) {
+ if (g_ScreenInfo[j].iE3BTimeout == WIN_E3B_DEFAULT) {
+ if (mouseButtons < 3) {
+ static Bool reportOnce = TRUE;
+
+ g_ScreenInfo[j].iE3BTimeout = WIN_DEFAULT_E3B_TIME;
+ if (reportOnce) {
+ reportOnce = FALSE;
+ winDebug("Windows reports only %d mouse buttons, defaulting to -emulate3buttons\n",
+ mouseButtons);
+ }
+ }
+ else {
+ g_ScreenInfo[j].iE3BTimeout = WIN_E3B_OFF;
+ }
+ }
+ }
+ }
}
static void
-winUseMsg (void)
+winUseMsg(void)
{
- ErrorF("\n");
- ErrorF("\n");
- ErrorF(EXECUTABLE_NAME " Device Dependent Usage:\n");
- ErrorF("\n");
+ ErrorF("\n");
+ ErrorF("\n");
+ ErrorF(EXECUTABLE_NAME " Device Dependent Usage:\n");
+ ErrorF("\n");
#ifdef XWIN_CLIPBOARD
- ErrorF ("-[no]clipboard\n"
- "\tEnable [disable] the clipboard integration. Default is enabled.\n");
+ ErrorF("-[no]clipboard\n"
+ "\tEnable [disable] the clipboard integration. Default is enabled.\n");
ErrorF ("-[no]clipboardprimary\n"
"\t[Do not] map the PRIMARY selection to the windows clipboard.\n"
"\tThe CLIPBOARD selection is always mapped if -clipboard is enabled.\n"
"\tDefault is mapped.\n");
#endif
- ErrorF ("-clipupdates num_boxes\n"
- "\tUse a clipping region to constrain shadow update blits to\n"
- "\tthe updated region when num_boxes, or more, are in the\n"
- "\tupdated region.\n");
+ ErrorF("-clipupdates num_boxes\n"
+ "\tUse a clipping region to constrain shadow update blits to\n"
+ "\tthe updated region when num_boxes, or more, are in the\n"
+ "\tupdated region.\n");
#ifdef XWIN_XF86CONFIG
- ErrorF ("-config\n"
- "\tSpecify a configuration file.\n");
+ ErrorF("-config\n" "\tSpecify a configuration file.\n");
- ErrorF ("-configdir\n"
- "\tSpecify a configuration directory.\n");
+ ErrorF("-configdir\n" "\tSpecify a configuration directory.\n");
#endif
- ErrorF ("-depth bits_per_pixel\n"
- "\tSpecify an optional bitdepth to use in fullscreen mode\n"
- "\twith a DirectDraw engine.\n");
+ ErrorF("-depth bits_per_pixel\n"
+ "\tSpecify an optional bitdepth to use in fullscreen mode\n"
+ "\twith a DirectDraw engine.\n");
- ErrorF ("-[no]emulate3buttons [timeout]\n"
- "\tEmulate 3 button mouse with an optional timeout in\n"
- "\tmilliseconds.\n");
+ ErrorF("-[no]emulate3buttons [timeout]\n"
+ "\tEmulate 3 button mouse with an optional timeout in\n"
+ "\tmilliseconds.\n");
#ifdef XWIN_EMULATEPSEUDO
- ErrorF ("-emulatepseudo\n"
- "\tCreate a depth 8 PseudoColor visual when running in\n"
- "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n"
- "\tdepths. The PseudoColor visual does not have correct colors,\n"
- "\tand it may crash, but it at least allows you to run your\n"
- "\tapplication in TrueColor modes.\n");
+ ErrorF("-emulatepseudo\n"
+ "\tCreate a depth 8 PseudoColor visual when running in\n"
+ "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n"
+ "\tdepths. The PseudoColor visual does not have correct colors,\n"
+ "\tand it may crash, but it at least allows you to run your\n"
+ "\tapplication in TrueColor modes.\n");
#endif
- ErrorF ("-engine engine_type_id\n"
- "\tOverride the server's automatically selected engine type:\n"
- "\t\t1 - Shadow GDI\n"
- "\t\t2 - Shadow DirectDraw\n"
- "\t\t4 - Shadow DirectDraw4 Non-Locking\n"
+ ErrorF("-engine engine_type_id\n"
+ "\tOverride the server's automatically selected engine type:\n"
+ "\t\t1 - Shadow GDI\n"
+ "\t\t2 - Shadow DirectDraw\n"
+ "\t\t4 - Shadow DirectDraw4 Non-Locking\n"
#ifdef XWIN_PRIMARYFB
- "\t\t8 - Primary DirectDraw - obsolete\n"
+ "\t\t8 - Primary DirectDraw - obsolete\n"
#endif
#ifdef XWIN_NATIVEGDI
- "\t\t16 - Native GDI - experimental\n"
+ "\t\t16 - Native GDI - experimental\n"
#endif
- );
+ );
- ErrorF ("-fullscreen\n"
- "\tRun the server in fullscreen mode.\n");
+ ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n");
- ErrorF ("-ignoreinput\n"
- "\tIgnore keyboard and mouse input.\n");
+ ErrorF("-ignoreinput\n" "\tIgnore keyboard and mouse input.\n");
#ifdef XWIN_MULTIWINDOWINTWM
- ErrorF ("-internalwm\n"
- "\tRun the internal window manager.\n");
+ ErrorF("-internalwm\n" "\tRun the internal window manager.\n");
#endif
#ifdef XWIN_XF86CONFIG
- ErrorF ("-keyboard\n"
- "\tSpecify a keyboard device from the configuration file.\n");
+ ErrorF("-keyboard\n"
+ "\tSpecify a keyboard device from the configuration file.\n");
#endif
- ErrorF ("-[no]keyhook\n"
- "\tGrab special Windows keypresses like Alt-Tab or the Menu "
- "key.\n");
+ ErrorF("-[no]keyhook\n"
+ "\tGrab special Windows keypresses like Alt-Tab or the Menu "
+ "key.\n");
- ErrorF ("-lesspointer\n"
- "\tHide the windows mouse pointer when it is over any\n"
- "\t" EXECUTABLE_NAME " window. This prevents ghost cursors appearing when\n"
- "\tthe Windows cursor is drawn on top of the X cursor\n");
+ ErrorF("-lesspointer\n"
+ "\tHide the windows mouse pointer when it is over any\n"
+ "\t" EXECUTABLE_NAME
+ " window. This prevents ghost cursors appearing when\n"
+ "\tthe Windows cursor is drawn on top of the X cursor\n");
- ErrorF ("-logfile filename\n"
- "\tWrite log messages to <filename>.\n");
+ ErrorF("-logfile filename\n" "\tWrite log messages to <filename>.\n");
- ErrorF ("-logverbose verbosity\n"
- "\tSet the verbosity of log messages. [NOTE: Only a few messages\n"
- "\trespect the settings yet]\n"
- "\t\t0 - only print fatal error.\n"
- "\t\t1 - print additional configuration information.\n"
- "\t\t2 - print additional runtime information [default].\n"
- "\t\t3 - print debugging and tracing information.\n");
+ ErrorF("-logverbose verbosity\n"
+ "\tSet the verbosity of log messages. [NOTE: Only a few messages\n"
+ "\trespect the settings yet]\n"
+ "\t\t0 - only print fatal error.\n"
+ "\t\t1 - print additional configuration information.\n"
+ "\t\t2 - print additional runtime information [default].\n"
+ "\t\t3 - print debugging and tracing information.\n");
- ErrorF ("-[no]multimonitors or -[no]multiplemonitors\n"
- "\tUse the entire virtual screen if multiple\n"
- "\tmonitors are present.\n");
+ ErrorF("-[no]multimonitors or -[no]multiplemonitors\n"
+ "\tUse the entire virtual screen if multiple\n"
+ "\tmonitors are present.\n");
#ifdef XWIN_MULTIWINDOW
- ErrorF ("-multiwindow\n"
- "\tRun the server in multi-window mode.\n");
+ ErrorF("-multiwindow\n" "\tRun the server in multi-window mode.\n");
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- ErrorF ("-mwextwm\n"
- "\tRun the server in multi-window external window manager mode.\n");
+ ErrorF("-mwextwm\n"
+ "\tRun the server in multi-window external window manager mode.\n");
#endif
- ErrorF ("-nodecoration\n"
- "\tDo not draw a window border, title bar, etc. Windowed\n"
- "\tmode only.\n");
+ ErrorF("-nodecoration\n"
+ "\tDo not draw a window border, title bar, etc. Windowed\n"
+ "\tmode only.\n");
#ifdef XWIN_CLIPBOARD
- ErrorF ("-nounicodeclipboard\n"
- "\tDo not use Unicode clipboard even if on a NT-based platform.\n");
+ ErrorF("-nounicodeclipboard\n"
+ "\tDo not use Unicode clipboard even if on a NT-based platform.\n");
#endif
- ErrorF ("-refresh rate_in_Hz\n"
- "\tSpecify an optional refresh rate to use in fullscreen mode\n"
- "\twith a DirectDraw engine.\n");
+ ErrorF("-refresh rate_in_Hz\n"
+ "\tSpecify an optional refresh rate to use in fullscreen mode\n"
+ "\twith a DirectDraw engine.\n");
- ErrorF ("-resize=none|scrollbars|randr"
- "\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n"
- "\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n"
- "\textension to resize the X screen. 'randr' is the default.\n");
+ ErrorF("-resize=none|scrollbars|randr"
+ "\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n"
+ "\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n"
+ "\textension to resize the X screen. 'randr' is the default.\n");
- ErrorF ("-rootless\n"
- "\tRun the server in rootless mode.\n");
+ ErrorF("-rootless\n" "\tRun the server in rootless mode.\n");
- ErrorF ("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n"
- "\tEnable screen scr_num and optionally specify a width and\n"
- "\theight and initial position for that screen. Additionally\n"
- "\ta monitor number can be specified to start the server on,\n"
- "\tat which point, all coordinates become relative to that\n"
- "\tmonitor. Examples:\n"
- "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n"
- "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
- "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
+ ErrorF("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n"
+ "\tEnable screen scr_num and optionally specify a width and\n"
+ "\theight and initial position for that screen. Additionally\n"
+ "\ta monitor number can be specified to start the server on,\n"
+ "\tat which point, all coordinates become relative to that\n"
+ "\tmonitor. Examples:\n"
+ "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n"
+ "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
+ "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
- ErrorF ("-silent-dup-error\n"
- "\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n"
- "\texit silently and don't display any error message.\n");
+ ErrorF("-silent-dup-error\n"
+ "\tIf another instance of " EXECUTABLE_NAME
+ " with the same display number is running\n"
+ "\texit silently and don't display any error message.\n");
- ErrorF ("-swcursor\n"
- "\tDisable the usage of the Windows cursor and use the X11 software\n"
- "\tcursor instead.\n");
+ ErrorF("-swcursor\n"
+ "\tDisable the usage of the Windows cursor and use the X11 software\n"
+ "\tcursor instead.\n");
- ErrorF ("-[no]trayicon\n"
- "\tDo not create a tray icon. Default is to create one\n"
- "\ticon per screen. You can globally disable tray icons with\n"
- "\t-notrayicon, then enable it for specific screens with\n"
- "\t-trayicon for those screens.\n");
+ ErrorF("-[no]trayicon\n"
+ "\tDo not create a tray icon. Default is to create one\n"
+ "\ticon per screen. You can globally disable tray icons with\n"
+ "\t-notrayicon, then enable it for specific screens with\n"
+ "\t-trayicon for those screens.\n");
- ErrorF ("-[no]unixkill\n"
- "\tCtrl+Alt+Backspace exits the X Server.\n");
+ ErrorF("-[no]unixkill\n" "\tCtrl+Alt+Backspace exits the X Server.\n");
- ErrorF ("-[no]wgl\n"
- "\tEnable the GLX extension to use the native Windows WGL interface for accelerated OpenGL\n");
+ ErrorF("-[no]wgl\n"
+ "\tEnable the GLX extension to use the native Windows WGL interface for accelerated OpenGL\n");
ErrorF ("-swrastwgl\n"
"\tEnable the GLX extension to use the native Windows WGL interface based on the swrast interface for accelerated OpenGL\n");
- ErrorF ("-[no]winkill\n"
- "\tAlt+F4 exits the X Server.\n");
+ ErrorF("-[no]winkill\n" "\tAlt+F4 exits the X Server.\n");
- ErrorF ("-xkblayout XKBLayout\n"
- "\tEquivalent to XKBLayout in XF86Config files.\n"
- "\tFor example: -xkblayout de\n");
+ ErrorF("-xkblayout XKBLayout\n"
+ "\tEquivalent to XKBLayout in XF86Config files.\n"
+ "\tFor example: -xkblayout de\n");
- ErrorF ("-xkbmodel XKBModel\n"
- "\tEquivalent to XKBModel in XF86Config files.\n");
+ ErrorF("-xkbmodel XKBModel\n"
+ "\tEquivalent to XKBModel in XF86Config files.\n");
- ErrorF ("-xkboptions XKBOptions\n"
- "\tEquivalent to XKBOptions in XF86Config files.\n");
+ ErrorF("-xkboptions XKBOptions\n"
+ "\tEquivalent to XKBOptions in XF86Config files.\n");
- ErrorF ("-xkbrules XKBRules\n"
- "\tEquivalent to XKBRules in XF86Config files.\n");
+ ErrorF("-xkbrules XKBRules\n"
+ "\tEquivalent to XKBRules in XF86Config files.\n");
- ErrorF ("-xkbvariant XKBVariant\n"
- "\tEquivalent to XKBVariant in XF86Config files.\n"
- "\tFor example: -xkbvariant nodeadkeys\n");
+ ErrorF("-xkbvariant XKBVariant\n"
+ "\tEquivalent to XKBVariant in XF86Config files.\n"
+ "\tFor example: -xkbvariant nodeadkeys\n");
}
/* See Porting Layer Definition - p. 57 */
void
ddxUseMsg(void)
{
- /* Set a flag so that FatalError won't give duplicate warning message */
- g_fSilentFatalError = TRUE;
-
- winUseMsg();
-
- /* Log file will not be opened for UseMsg unless we open it now */
- if (!g_fLogInited) {
- g_pszLogFile = LogInit (g_pszLogFile, NULL);
- g_fLogInited = TRUE;
- }
- LogClose (EXIT_NO_ERROR);
-
- /* Notify user where UseMsg text can be found.*/
- if (!g_fNoHelpMessageBox)
- winMessageBoxF ("The " PROJECT_NAME " help text has been printed to "
- "%s.\n"
- "Please open %s to read the help text.\n",
- MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile);
+ /* Set a flag so that FatalError won't give duplicate warning message */
+ g_fSilentFatalError = TRUE;
+
+ winUseMsg();
+
+ /* Log file will not be opened for UseMsg unless we open it now */
+ if (!g_fLogInited) {
+ g_pszLogFile = LogInit(g_pszLogFile, NULL);
+ g_fLogInited = TRUE;
+ }
+ LogClose(EXIT_NO_ERROR);
+
+ /* Notify user where UseMsg text can be found. */
+ if (!g_fNoHelpMessageBox)
+ winMessageBoxF("The " PROJECT_NAME " help text has been printed to "
+ "%s.\n"
+ "Please open %s to read the help text.\n",
+ MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile);
}
/* See Porting Layer Definition - p. 20 */
@@ -927,111 +891,104 @@ ddxUseMsg(void)
*/
void
-InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
+InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
{
- int i;
+ int i;
- /* Log the command line */
- winLogCommandLine (argc, argv);
+ /* Log the command line */
+ winLogCommandLine(argc, argv);
- winDebug ("InitOutput\n");
+ winDebug("InitOutput\n");
- /* Validate command-line arguments */
- if (serverGeneration == 1 && !winValidateArgs ())
- {
- FatalError ("InitOutput - Invalid command-line arguments found. "
- "Exiting.\n");
+ /* Validate command-line arguments */
+ if (serverGeneration == 1 && !winValidateArgs()) {
+ FatalError("InitOutput - Invalid command-line arguments found. "
+ "Exiting.\n");
}
- /* Check for duplicate invocation on same display number.*/
- if (serverGeneration == 1 && !winCheckDisplayNumber ())
- {
- if (g_fSilentDupError)
- g_fSilentFatalError = TRUE;
- FatalError ("InitOutput - Duplicate invocation on display "
- "number: %s. Exiting.\n", display);
+ /* Check for duplicate invocation on same display number. */
+ if (serverGeneration == 1 && !winCheckDisplayNumber()) {
+ if (g_fSilentDupError)
+ g_fSilentFatalError = TRUE;
+ FatalError("InitOutput - Duplicate invocation on display "
+ "number: %s. Exiting.\n", display);
}
#ifdef XWIN_XF86CONFIG
- /* Try to read the xorg.conf-style configuration file */
- if (!winReadConfigfile ())
- ErrorF ("InitOutput - Error reading config file\n");
+ /* Try to read the xorg.conf-style configuration file */
+ if (!winReadConfigfile())
+ ErrorF ("InitOutput - Error reading config file\n");
#else
- winConfigFiles ();
+ winConfigFiles();
#endif
- /* Load preferences from XWinrc file */
- LoadPreferences();
-
- /* Setup global screen info parameters */
- screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
- screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
- screenInfo->numPixmapFormats = NUMFORMATS;
-
- /* Describe how we want common pixmap formats padded */
- for (i = 0; i < NUMFORMATS; i++)
- {
- screenInfo->formats[i] = g_PixmapFormats[i];
+ /* Load preferences from XWinrc file */
+ LoadPreferences();
+
+ /* Setup global screen info parameters */
+ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ screenInfo->numPixmapFormats = NUMFORMATS;
+
+ /* Describe how we want common pixmap formats padded */
+ for (i = 0; i < NUMFORMATS; i++) {
+ screenInfo->formats[i] = g_PixmapFormats[i];
}
- /* Load pointers to DirectDraw functions */
- winGetDDProcAddresses ();
-
- /* Detect supported engines */
- winDetectSupportedEngines ();
+ /* Load pointers to DirectDraw functions */
+ winGetDDProcAddresses();
+
+ /* Detect supported engines */
+ winDetectSupportedEngines();
#ifdef XWIN_MULTIWINDOW
/* Load libraries for taskbar grouping */
winTaskbarInit ();
#endif
- /* Store the instance handle */
- g_hInstance = GetModuleHandle (NULL);
+ /* Store the instance handle */
+ g_hInstance = GetModuleHandle(NULL);
- /* Initialize each screen */
- for (i = 0; i < g_iNumScreens; ++i)
- {
- /* Initialize the screen */
- if (-1 == AddScreen (winScreenInit, argc, argv))
- {
- FatalError ("InitOutput - Couldn't add screen %d", i);
- }
+ /* Initialize each screen */
+ for (i = 0; i < g_iNumScreens; ++i) {
+ /* Initialize the screen */
+ if (-1 == AddScreen(winScreenInit, argc, argv)) {
+ FatalError("InitOutput - Couldn't add screen %d", i);
+ }
}
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Generate a cookie used by internal clients for authorization */
- if (g_fXdmcpEnabled || g_fAuthEnabled)
- winGenerateAuthorization ();
-
- /* Perform some one time initialization */
- if (1 == serverGeneration)
- {
- /*
- * setlocale applies to all threads in the current process.
- * Apply locale specified in LANG environment variable.
- */
- if (!setlocale (LC_ALL, ""))
- {
- ErrorF ("setlocale failed.\n");
- }
+ /* Generate a cookie used by internal clients for authorization */
+ if (g_fXdmcpEnabled || g_fAuthEnabled)
+ winGenerateAuthorization();
+
+ /* Perform some one time initialization */
+ if (1 == serverGeneration) {
+ /*
+ * setlocale applies to all threads in the current process.
+ * Apply locale specified in LANG environment variable.
+ */
+ if (!setlocale (LC_ALL, ""))
+ {
+ ErrorF ("setlocale failed.\n");
+ }
- /* See if X supports the current locale */
- if (XSupportsLocale () == FALSE)
- {
- ErrorF ("Warning: Locale not supported by X, falling back to 'C' locale.\n");
- setlocale(LC_ALL, "C");
- }
+ /* See if X supports the current locale */
+ if (XSupportsLocale () == FALSE)
+ {
+ ErrorF ("Warning: Locale not supported by X, falling back to 'C' locale.\n");
+ setlocale(LC_ALL, "C");
+ }
}
#endif
- winDebug ("InitOutput - Returning.\n");
+ winDebug("InitOutput - Returning.\n");
}
-
/*
* winCheckDisplayNumber - Check if another instance of Cygwin/X is
* already running on the same display number. If no one exists,
@@ -1041,67 +998,60 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
*/
static Bool
-winCheckDisplayNumber (void)
+winCheckDisplayNumber(void)
{
- int nDisp;
- HANDLE mutex;
- char name[MAX_PATH];
- char * pszPrefix = '\0';
- OSVERSIONINFO osvi = {0};
-
- /* Check display range */
- nDisp = atoi (display);
- if (nDisp < 0 || nDisp > 59535)
- {
- ErrorF ("winCheckDisplayNumber - Bad display number: %d\n", nDisp);
- return FALSE;
+ int nDisp;
+ HANDLE mutex;
+ char name[MAX_PATH];
+ char *pszPrefix = '\0';
+ OSVERSIONINFO osvi = { 0 };
+
+ /* Check display range */
+ nDisp = atoi(display);
+ if (nDisp < 0 || nDisp > 59535) {
+ ErrorF("winCheckDisplayNumber - Bad display number: %d\n", nDisp);
+ return FALSE;
}
- /* Set first character of mutex name to null */
- name[0] = '\0';
+ /* Set first character of mutex name to null */
+ name[0] = '\0';
- /* Get operating system version information */
- osvi.dwOSVersionInfoSize = sizeof (osvi);
- GetVersionEx (&osvi);
+ /* Get operating system version information */
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
- /* Want a mutex shared among all terminals on NT > 4.0 */
- if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT
- && osvi.dwMajorVersion >= 5)
- {
- pszPrefix = "Global\\";
+ /* Want a mutex shared among all terminals on NT > 4.0 */
+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5) {
+ pszPrefix = "Global\\";
}
- /* Setup Cygwin/X specific part of name */
- snprintf (name, sizeof(name), "%sCYGWINX_DISPLAY:%d", pszPrefix, nDisp);
-
- /* Windows automatically releases the mutex when this process exits */
- mutex = CreateMutex (NULL, FALSE, name);
- if (!mutex)
- {
- LPVOID lpMsgBuf;
-
- /* Display a fancy error message */
- FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError (),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf,
- 0, NULL);
- ErrorF ("winCheckDisplayNumber - CreateMutex failed: %s\n",
- (LPSTR)lpMsgBuf);
- LocalFree (lpMsgBuf);
-
- return FALSE;
+ /* Setup Cygwin/X specific part of name */
+ snprintf(name, sizeof(name), "%sCYGWINX_DISPLAY:%d", pszPrefix, nDisp);
+
+ /* Windows automatically releases the mutex when this process exits */
+ mutex = CreateMutex(NULL, FALSE, name);
+ if (!mutex) {
+ LPVOID lpMsgBuf;
+
+ /* Display a fancy error message */
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) & lpMsgBuf, 0, NULL);
+ ErrorF("winCheckDisplayNumber - CreateMutex failed: %s\n",
+ (LPSTR) lpMsgBuf);
+ LocalFree(lpMsgBuf);
+
+ return FALSE;
}
- if (GetLastError () == ERROR_ALREADY_EXISTS)
- {
- ErrorF ("winCheckDisplayNumber - "
- "VCXsrv, Xming or Cygwin/X is already running on display %d\n",
- nDisp);
- return FALSE;
+ if (GetLastError() == ERROR_ALREADY_EXISTS) {
+ ErrorF("winCheckDisplayNumber - "
+ "VCXsrv, Xming or Cygwin/X is already running on display %d\n", nDisp);
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/glx/glwindows.h b/xorg-server/hw/xwin/glx/glwindows.h
index 72278df30..42adc5b60 100644
--- a/xorg-server/hw/xwin/glx/glwindows.h
+++ b/xorg-server/hw/xwin/glx/glwindows.h
@@ -28,25 +28,25 @@
* DEALINGS IN THE SOFTWARE.
*/
-
#include <GL/gl.h>
typedef struct {
- unsigned int enableDebug : 1;
- unsigned int enableTrace : 1;
- unsigned int dumpPFD : 1;
- unsigned int dumpHWND : 1;
- unsigned int dumpDC : 1;
- unsigned int enableGLcallTrace : 1;
- unsigned int enableWGLcallTrace :1;
+ unsigned int enableDebug:1;
+ unsigned int enableTrace:1;
+ unsigned int dumpPFD:1;
+ unsigned int dumpHWND:1;
+ unsigned int dumpDC:1;
+ unsigned int enableGLcallTrace:1;
+ unsigned int enableWGLcallTrace:1;
} glxWinDebugSettingsRec;
extern glxWinDebugSettingsRec glxWinDebugSettings;
void glWinCallDelta(void);
void glxWinPushNativeProvider(void);
-const GLubyte* glGetStringWrapperNonstatic(GLenum name);
-void glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width, GLsizei height);
+const GLubyte *glGetStringWrapperNonstatic(GLenum name);
+void glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width,
+ GLsizei height);
void glWinSetupDispatchTable(void);
#ifdef _DEBUG
diff --git a/xorg-server/hw/xwin/glx/glwrap.c b/xorg-server/hw/xwin/glx/glwrap.c
index fe59f71ef..21a42aa9c 100644
--- a/xorg-server/hw/xwin/glx/glwrap.c
+++ b/xorg-server/hw/xwin/glx/glwrap.c
@@ -53,55 +53,49 @@ static unsigned int glWinDirectProcCalls = 0;
void
glWinCallDelta(void)
{
- static unsigned int glWinIndirectProcCallsLast = 0;
- static unsigned int glWinDirectProcCallsLast = 0;
- if ((glWinIndirectProcCalls != glWinIndirectProcCallsLast) ||
- (glWinDirectProcCalls != glWinDirectProcCallsLast))
- {
- if (glxWinDebugSettings.enableTrace)
- {
- ErrorF("after %d direct and %d indirect GL calls\n",
- glWinDirectProcCalls - glWinDirectProcCallsLast,
- glWinIndirectProcCalls - glWinIndirectProcCallsLast);
+ static unsigned int glWinIndirectProcCallsLast = 0;
+ static unsigned int glWinDirectProcCallsLast = 0;
+
+ if ((glWinIndirectProcCalls != glWinIndirectProcCallsLast) ||
+ (glWinDirectProcCalls != glWinDirectProcCallsLast)) {
+ if (glxWinDebugSettings.enableTrace) {
+ ErrorF("after %d direct and %d indirect GL calls\n",
+ glWinDirectProcCalls - glWinDirectProcCallsLast,
+ glWinIndirectProcCalls - glWinIndirectProcCallsLast);
}
- glWinDirectProcCallsLast = glWinDirectProcCalls;
- glWinIndirectProcCallsLast = glWinIndirectProcCalls;
+ glWinDirectProcCallsLast = glWinDirectProcCalls;
+ glWinIndirectProcCallsLast = glWinIndirectProcCalls;
}
}
#endif
static PROC
-glWinResolveHelper(PROC *cache, char *symbol)
+glWinResolveHelper(PROC * cache, char *symbol)
{
- PROC proc = NULL;
-
- /* If not yet cached, call wglGetProcAddress */
- if ((*cache) == NULL)
- {
- proc = wglGetProcAddress(symbol);
- if (proc == NULL)
- {
- winDebug("glwrap: Can't resolve \"%s\"\n", symbol);
- (*cache) = (PROC)-1;
+ PROC proc = NULL;
+
+ /* If not yet cached, call wglGetProcAddress */
+ if ((*cache) == NULL) {
+ proc = wglGetProcAddress(symbol);
+ if (proc == NULL) {
+ winDebug("glwrap: Can't resolve \"%s\"\n", symbol);
+ (*cache) = (PROC) - 1;
}
- else
- {
- winDebug("glwrap: Resolved \"%s\"\n", symbol);
- (*cache) = proc;
+ else {
+ winDebug("glwrap: Resolved \"%s\"\n", symbol);
+ (*cache) = proc;
}
}
- /* Cached wglGetProcAddress failure */
- else if ((*cache) == (PROC)-1)
- {
- proc = 0;
+ /* Cached wglGetProcAddress failure */
+ else if ((*cache) == (PROC) - 1) {
+ proc = 0;
}
- /* Cached wglGetProcAddress result */
- else
- {
- proc = (*cache);
+ /* Cached wglGetProcAddress result */
+ else {
+ proc = (*cache);
}
- return proc;
+ return proc;
}
#ifdef _DEBUG
@@ -138,20 +132,24 @@ glWinResolveHelper(PROC *cache, char *symbol)
Special non-static wrapper for glGetString for debug output
*/
-const GLubyte* glGetStringWrapperNonstatic(GLenum name)
+const GLubyte *
+glGetStringWrapperNonstatic(GLenum name)
{
- return glGetString(name);
+ return glGetString(name);
}
/*
Special non-static wrapper for glAddSwapHintRectWIN for copySubBuffers
*/
-typedef void (__stdcall *PFNGLADDSWAPHINTRECTWIN)(GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (__stdcall * PFNGLADDSWAPHINTRECTWIN) (GLint x, GLint y,
+ GLsizei width,
+ GLsizei height);
-void glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width, GLsizei height)
+void
+glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width,
+ GLsizei height)
{
- RESOLVE(PFNGLADDSWAPHINTRECTWIN, "glAddSwapHintRectWIN");
- proc(x, y, width, height);
+ RESOLVE(PFNGLADDSWAPHINTRECTWIN, "glAddSwapHintRectWIN");
+ proc(x, y, width, height);
}
-
diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c
index b60f0c87c..1a4916aaa 100644
--- a/xorg-server/hw/xwin/glx/indirect.c
+++ b/xorg-server/hw/xwin/glx/indirect.c
@@ -112,61 +112,58 @@ extern Bool g_fNativeGl;
* structure definitions
*/
-typedef struct __GLXWinContext __GLXWinContext;
+typedef struct __GLXWinContext __GLXWinContext;
typedef struct __GLXWinDrawable __GLXWinDrawable;
typedef struct __GLXWinScreen glxWinScreen;
typedef struct __GLXWinConfig GLXWinConfig;
struct __GLXWinContext {
- __GLXcontext base;
- HGLRC ctx; /* Windows GL Context */
+ __GLXcontext base;
+ HGLRC ctx; /* Windows GL Context */
HDC hDC; /* Windows device context */
HDC hreadDC; /* Windows device read context */
- __GLXWinContext *shareContext; /* Context with which we will share display lists and textures */
- HWND hwnd; /* For detecting when HWND has changed */
+ __GLXWinContext *shareContext; /* Context with which we will share display lists and textures */
+ HWND hwnd; /* For detecting when HWND has changed */
HWND hreadwnd;
struct _glapi_table *Dispatch;
};
-struct __GLXWinDrawable
-{
- __GLXdrawable base;
- __GLXWinContext *drawContext;
+struct __GLXWinDrawable {
+ __GLXdrawable base;
+ __GLXWinContext *drawContext;
- /* If this drawable is GLX_DRAWABLE_PBUFFER */
- HPBUFFERARB hPbuffer;
+ /* If this drawable is GLX_DRAWABLE_PBUFFER */
+ HPBUFFERARB hPbuffer;
- /* If this drawable is GLX_DRAWABLE_PIXMAP */
- HDC dibDC;
- HBITMAP hDIB;
- HBITMAP hOldDIB; /* original DIB for DC */
- void *pOldBits; /* original pBits for this drawable's pixmap */
+ /* If this drawable is GLX_DRAWABLE_PIXMAP */
+ HDC dibDC;
+ HBITMAP hDIB;
+ HBITMAP hOldDIB; /* original DIB for DC */
+ void *pOldBits; /* original pBits for this drawable's pixmap */
};
-struct __GLXWinScreen
-{
- __GLXscreen base;
+struct __GLXWinScreen {
+ __GLXscreen base;
- /* Supported GLX extensions */
- unsigned char glx_enable_bits[__GLX_EXT_BYTES];
+ /* Supported GLX extensions */
+ unsigned char glx_enable_bits[__GLX_EXT_BYTES];
- Bool has_WGL_ARB_multisample;
- Bool has_WGL_ARB_pixel_format;
- Bool has_WGL_ARB_pbuffer;
- Bool has_WGL_ARB_render_texture;
+ Bool has_WGL_ARB_multisample;
+ Bool has_WGL_ARB_pixel_format;
+ Bool has_WGL_ARB_pbuffer;
+ Bool has_WGL_ARB_render_texture;
- /* wrapped screen functions */
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
+ /* wrapped screen functions */
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
DestroyWindowProcPtr DestroyWindow;
- CopyWindowProcPtr CopyWindow;
+ CopyWindowProcPtr CopyWindow;
PositionWindowProcPtr PositionWindow;
};
-struct __GLXWinConfig
-{
- __GLXconfig base;
- int pixelFormatIndex;
+struct __GLXWinConfig {
+ __GLXconfig base;
+ int pixelFormatIndex;
};
/* ---------------------------------------------------------------------- */
@@ -203,9 +200,10 @@ void GLWIN_HDC_DEBUG_MSG(const char *Message, HDC hDc, HWND hwnd)
}
-glxWinDebugSettingsRec glxWinDebugSettings = { 0, 0, 0, 0, 0, 0};
+glxWinDebugSettingsRec glxWinDebugSettings = { 0, 0, 0, 0, 0, 0 };
-static void glxWinInitDebugSettings(void)
+static void
+glxWinInitDebugSettings(void)
{
char *envptr;
@@ -238,8 +236,7 @@ static void glxWinInitDebugSettings(void)
glxWinDebugSettings.enableWGLcallTrace = (atoi(envptr) == 1);
envptr = getenv("GLWIN_DEBUG_ALL");
- if (envptr != NULL)
- {
+ if (envptr != NULL) {
glxWinDebugSettings.enableDebug = 1;
glxWinDebugSettings.enableTrace = 1;
glxWinDebugSettings.dumpPFD = 1;
@@ -247,37 +244,34 @@ static void glxWinInitDebugSettings(void)
glxWinDebugSettings.dumpDC = 1;
glxWinDebugSettings.enableGLcallTrace = 1;
glxWinDebugSettings.enableWGLcallTrace = 1;
- }
+ }
}
#endif
static
-const char *glxWinErrorMessage(void)
+const char *
+glxWinErrorMessage(void)
{
- static char errorbuffer[1024];
- unsigned int last_error = GetLastError();
-
- if (!FormatMessage(
- FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK,
- NULL,
- last_error,
- 0,
- (LPTSTR) &errorbuffer,
- sizeof(errorbuffer),
- NULL ))
- {
- snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error");
+ static char errorbuffer[1024];
+ unsigned int last_error = GetLastError();
+
+ if (!FormatMessage
+ (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
+ FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, last_error, 0,
+ (LPTSTR) & errorbuffer, sizeof(errorbuffer), NULL)) {
+ snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error");
}
- if ((errorbuffer[strlen(errorbuffer)-1] == '\n') || (errorbuffer[strlen(errorbuffer)-1] == '\r'))
- errorbuffer[strlen(errorbuffer)-1] = 0;
+ if ((errorbuffer[strlen(errorbuffer) - 1] == '\n') ||
+ (errorbuffer[strlen(errorbuffer) - 1] == '\r'))
+ errorbuffer[strlen(errorbuffer) - 1] = 0;
- sprintf(errorbuffer + strlen(errorbuffer), " (%08x)", last_error);
+ sprintf(errorbuffer + strlen(errorbuffer), " (%08x)", last_error);
- return errorbuffer;
+ return errorbuffer;
}
-static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd);
+static void pfdOut(const PIXELFORMATDESCRIPTOR * pfd);
#ifdef _DEBUG
@@ -287,36 +281,39 @@ static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd);
pipesym = " | "; \
}
-static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd)
+static void
+pfdOut(const PIXELFORMATDESCRIPTOR * pfd)
{
- const char *pipesym = ""; /* will be set after first flag dump */
+ const char *pipesym = ""; /* will be set after first flag dump */
+
ErrorF("PIXELFORMATDESCRIPTOR:\n");
ErrorF("nSize = %u\n", pfd->nSize);
ErrorF("nVersion = %u\n", pfd->nVersion);
ErrorF("dwFlags = %lu = {", pfd->dwFlags);
- DUMP_PFD_FLAG(PFD_DOUBLEBUFFER);
- DUMP_PFD_FLAG(PFD_STEREO);
- DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW);
- DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP);
- DUMP_PFD_FLAG(PFD_SUPPORT_GDI);
- DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL);
- DUMP_PFD_FLAG(PFD_GENERIC_FORMAT);
- DUMP_PFD_FLAG(PFD_NEED_PALETTE);
- DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE);
- DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE);
- DUMP_PFD_FLAG(PFD_SWAP_COPY);
- DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS);
- DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED);
- DUMP_PFD_FLAG(PFD_SUPPORT_DIRECTDRAW);
- DUMP_PFD_FLAG(PFD_DIRECT3D_ACCELERATED);
- DUMP_PFD_FLAG(PFD_SUPPORT_COMPOSITION);
- DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE);
- DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE);
- DUMP_PFD_FLAG(PFD_STEREO_DONTCARE);
+ DUMP_PFD_FLAG(PFD_DOUBLEBUFFER);
+ DUMP_PFD_FLAG(PFD_STEREO);
+ DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW);
+ DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP);
+ DUMP_PFD_FLAG(PFD_SUPPORT_GDI);
+ DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL);
+ DUMP_PFD_FLAG(PFD_GENERIC_FORMAT);
+ DUMP_PFD_FLAG(PFD_NEED_PALETTE);
+ DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE);
+ DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE);
+ DUMP_PFD_FLAG(PFD_SWAP_COPY);
+ DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS);
+ DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED);
+ DUMP_PFD_FLAG(PFD_SUPPORT_DIRECTDRAW);
+ DUMP_PFD_FLAG(PFD_DIRECT3D_ACCELERATED);
+ DUMP_PFD_FLAG(PFD_SUPPORT_COMPOSITION);
+ DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE);
+ DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE);
+ DUMP_PFD_FLAG(PFD_STEREO_DONTCARE);
ErrorF("}\n");
ErrorF("iPixelType = %hu = %s\n", pfd->iPixelType,
- (pfd->iPixelType == PFD_TYPE_RGBA ? "PFD_TYPE_RGBA" : "PFD_TYPE_COLORINDEX"));
+ (pfd->iPixelType ==
+ PFD_TYPE_RGBA ? "PFD_TYPE_RGBA" : "PFD_TYPE_COLORINDEX"));
ErrorF("cColorBits = %hhu\n", pfd->cColorBits);
ErrorF("cRedBits = %hhu\n", pfd->cRedBits);
ErrorF("cRedShift = %hhu\n", pfd->cRedShift);
@@ -345,87 +342,88 @@ static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd)
static const char *
visual_class_name(int cls)
{
- switch (cls) {
- case GLX_STATIC_COLOR:
- return "StaticColor";
- case GLX_PSEUDO_COLOR:
- return "PseudoColor";
- case GLX_STATIC_GRAY:
- return "StaticGray";
- case GLX_GRAY_SCALE:
- return "GrayScale";
- case GLX_TRUE_COLOR:
- return "TrueColor";
- case GLX_DIRECT_COLOR:
- return "DirectColor";
- default:
- return "-none-";
- }
+ switch (cls) {
+ case GLX_STATIC_COLOR:
+ return "StaticColor";
+ case GLX_PSEUDO_COLOR:
+ return "PseudoColor";
+ case GLX_STATIC_GRAY:
+ return "StaticGray";
+ case GLX_GRAY_SCALE:
+ return "GrayScale";
+ case GLX_TRUE_COLOR:
+ return "TrueColor";
+ case GLX_DIRECT_COLOR:
+ return "DirectColor";
+ default:
+ return "-none-";
+ }
}
static const char *
swap_method_name(int mthd)
{
- switch (mthd)
- {
+ switch (mthd) {
case GLX_SWAP_EXCHANGE_OML:
- return "xchg";
+ return "xchg";
case GLX_SWAP_COPY_OML:
- return "copy";
+ return "copy";
case GLX_SWAP_UNDEFINED_OML:
- return " ";
+ return " ";
default:
- return "????";
+ return "????";
}
}
static void
-fbConfigsDump(unsigned int n, __GLXconfig *c)
+fbConfigsDump(unsigned int n, __GLXconfig * c)
{
- ErrorF("%d fbConfigs\n", n);
- ErrorF("pxf vis fb render Ste aux accum MS drawable Group/\n");
- ErrorF("idx ID ID VisualType Depth Lvl RGB CI DB Swap reo R G B A Z S buf AR AG AB AA bufs num W P Pb Float Trans Caveat\n");
- ErrorF("-----------------------------------------------------------------------------------------------------------------------------\n");
-
- while (c != NULL)
- {
- unsigned int i = ((GLXWinConfig *)c)->pixelFormatIndex;
-
- ErrorF("%3d %3x %3x "
- "%-11s"
- " %3d %3d %s %s %s %s %s "
- "%2d %2d %2d %2d "
- "%2d %2d "
- "%2d "
- "%2d %2d %2d %2d"
- " %2d %2d"
- " %s %s %s "
- " %s "
- " %s "
- " %d %s"
- "\n",
- i, c->visualID, c->fbconfigID,
- visual_class_name(c->visualType),
- c->rgbBits ? c->rgbBits : c->indexBits,
- c->level,
- (c->renderType & GLX_RGBA_BIT) ? "y" : ".",
- (c->renderType & GLX_COLOR_INDEX_BIT) ? "y" : ".",
- c->doubleBufferMode ? "y" : ".",
- swap_method_name(c->swapMethod),
- c->stereoMode ? "y" : ".",
- c->redBits, c->greenBits, c->blueBits, c->alphaBits,
- c->depthBits, c->stencilBits,
- c->numAuxBuffers,
- c->accumRedBits, c->accumGreenBits, c->accumBlueBits, c->accumAlphaBits,
- c->sampleBuffers, c->samples,
- (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".",
- (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".",
- (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".",
- ".",
- (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
- c->visualSelectGroup, (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ");
-
- c = c->next;
+ ErrorF("%d fbConfigs\n", n);
+ ErrorF
+ ("pxf vis fb render Ste aux accum MS drawable Group/\n");
+ ErrorF
+ ("idx ID ID VisualType Depth Lvl RGB CI DB Swap reo R G B A Z S buf AR AG AB AA bufs num W P Pb Float Trans Caveat\n");
+ ErrorF
+ ("-----------------------------------------------------------------------------------------------------------------------------\n");
+
+ while (c != NULL) {
+ unsigned int i = ((GLXWinConfig *) c)->pixelFormatIndex;
+
+ ErrorF("%3d %3x %3x "
+ "%-11s"
+ " %3d %3d %s %s %s %s %s "
+ "%2d %2d %2d %2d "
+ "%2d %2d "
+ "%2d "
+ "%2d %2d %2d %2d"
+ " %2d %2d"
+ " %s %s %s "
+ " %s "
+ " %s "
+ " %d %s"
+ "\n",
+ i, c->visualID, c->fbconfigID,
+ visual_class_name(c->visualType),
+ c->rgbBits ? c->rgbBits : c->indexBits,
+ c->level,
+ (c->renderType & GLX_RGBA_BIT) ? "y" : ".",
+ (c->renderType & GLX_COLOR_INDEX_BIT) ? "y" : ".",
+ c->doubleBufferMode ? "y" : ".",
+ swap_method_name(c->swapMethod),
+ c->stereoMode ? "y" : ".",
+ c->redBits, c->greenBits, c->blueBits, c->alphaBits,
+ c->depthBits, c->stencilBits,
+ c->numAuxBuffers,
+ c->accumRedBits, c->accumGreenBits, c->accumBlueBits,
+ c->accumAlphaBits, c->sampleBuffers, c->samples,
+ (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".",
+ (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".",
+ (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".", ".",
+ (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
+ c->visualSelectGroup,
+ (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ");
+
+ c = c->next;
}
}
#endif
@@ -436,30 +434,35 @@ fbConfigsDump(unsigned int n, __GLXconfig *c)
*/
static __GLXscreen *glxWinScreenProbe(ScreenPtr pScreen);
-static __GLXcontext *glxWinCreateContext(__GLXscreen *screen,
- __GLXconfig *modes,
- __GLXcontext *baseShareContext);
+static __GLXcontext *glxWinCreateContext(__GLXscreen * screen,
+ __GLXconfig * modes,
+ __GLXcontext * baseShareContext);
static __GLXdrawable *glxWinCreateDrawable(ClientPtr client,
- __GLXscreen *screen,
- DrawablePtr pDraw,
- XID drawId,
- int type,
- XID glxDrawId,
- __GLXconfig *conf);
+ __GLXscreen * screen,
+ DrawablePtr pDraw,
+ XID drawId,
+ int type,
+ XID glxDrawId, __GLXconfig * conf);
static Bool glxWinRealizeWindow(WindowPtr pWin);
static Bool glxWinUnrealizeWindow(WindowPtr pWin);
static Bool glxWinDestroyWindow(WindowPtr pWin);
-static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
static Bool glxWinPositionWindow(WindowPtr pWindow, int x, int y);
-static HDC glxWinMakeDC(__GLXWinContext *gc, __GLXWinDrawable *draw, HWND *hwnd);
-static void glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable *draw);
+static HDC glxWinMakeDC(__GLXWinContext * gc, __GLXWinDrawable * draw,
+ HWND * hwnd);
+static void glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable * draw);
-static void glxWinCreateConfigs(HDC dc, glxWinScreen *screen);
-static void glxWinCreateConfigsExt(HDC hdc, glxWinScreen *screen);
-static int fbConfigToPixelFormat(__GLXconfig *mode, PIXELFORMATDESCRIPTOR *pfdret, int drawableTypeOverride);
-static int fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig *mode, int drawableTypeOverride, glxWinScreen *winScreen);
+static void glxWinCreateConfigs(HDC dc, glxWinScreen * screen);
+static void glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen);
+static int fbConfigToPixelFormat(__GLXconfig * mode,
+ PIXELFORMATDESCRIPTOR * pfdret,
+ int drawableTypeOverride);
+static int fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode,
+ int drawableTypeOverride,
+ glxWinScreen * winScreen);
/* ---------------------------------------------------------------------- */
/*
@@ -485,7 +488,7 @@ glxWinPushNativeProvider(void)
*/
static void
-glxWinScreenDestroy(__GLXscreen *screen)
+glxWinScreenDestroy(__GLXscreen * screen)
{
GLWIN_DEBUG_MSG("glxWinScreenDestroy(%p)", screen);
__glXScreenDestroy(screen);
@@ -493,14 +496,15 @@ glxWinScreenDestroy(__GLXscreen *screen)
}
static int
-glxWinScreenSwapInterval(__GLXdrawable *drawable, int interval)
+glxWinScreenSwapInterval(__GLXdrawable * drawable, int interval)
{
- BOOL ret = wglSwapIntervalEXTWrapper(interval);
- if (!ret)
- {
- ErrorF("wglSwapIntervalEXT interval %d failed:%s\n", interval, glxWinErrorMessage());
+ BOOL ret = wglSwapIntervalEXTWrapper(interval);
+
+ if (!ret) {
+ ErrorF("wglSwapIntervalEXT interval %d failed:%s\n", interval,
+ glxWinErrorMessage());
}
- return ret;
+ return ret;
}
static LRESULT CALLBACK GlxWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -519,51 +523,48 @@ static LRESULT CALLBACK GlxWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
static void
glxLogExtensions(const char *prefix, const char *extensions)
{
- int length = 0;
- char *strl;
- char *str = strdup(extensions);
+ int length = 0;
+ char *strl;
+ char *str = strdup(extensions);
- if (str == NULL)
- {
- ErrorF("glxLogExtensions: xalloc error\n");
- return;
+ if (str == NULL) {
+ ErrorF("glxLogExtensions: xalloc error\n");
+ return;
}
- strl = strtok(str, " ");
- if (!strl)
- {
- winDebug("%s", prefix);
- }
- else
- {
- winDebug("%s%s", prefix, strl);
- length = strlen(prefix) + strlen(strl);
- }
-
- while (1)
+ strl = strtok(str, " ");
+ if (!strl)
{
- strl = strtok(NULL, " ");
- if (strl == NULL) break;
+ winDebug("%s", prefix);
+ }
+ else
+ {
+ winDebug("%s%s", prefix, strl);
+ length = strlen(prefix) + strlen(strl);
+ }
- if (length + strlen(strl) + 1 > 120)
- {
- winDebug("\n");
- winDebug("%s",prefix);
- length = strlen(prefix);
+ while (1) {
+ strl = strtok(NULL, " ");
+ if (strl == NULL)
+ break;
+
+ if (length + strlen(strl) + 1 > 120) {
+ winDebug("\n");
+ winDebug("%s", prefix);
+ length = strlen(prefix);
}
- else
- {
- winDebug(" ");
- length++;
+ else {
+ winDebug(" ");
+ length++;
}
- winDebug("%s", strl);
- length = length + strlen(strl);
+ winDebug("%s", strl);
+ length = length + strlen(strl);
}
- winDebug("\n");
+ winDebug("\n");
- free(str);
+ free(str);
}
/* This is called by GlxExtensionInit() asking the GLX provider if it can handle the screen... */
@@ -584,18 +585,18 @@ glxWinScreenProbe(ScreenPtr pScreen)
#endif
if (pScreen == NULL)
- return NULL;
+ return NULL;
- if (!winCheckScreenAiglxIsSupported(pScreen))
- {
- LogMessage(X_ERROR,"AIGLX: No native OpenGL in modes with a root window\n");
+ if (!winCheckScreenAiglxIsSupported(pScreen)) {
+ LogMessage(X_ERROR,
+ "AIGLX: No native OpenGL in modes with a root window\n");
return NULL;
- }
+ }
screen = calloc(1, sizeof(glxWinScreen));
if (NULL == screen)
- return NULL;
+ return NULL;
/* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */
screen->RealizeWindow = pScreen->RealizeWindow;
@@ -613,34 +614,36 @@ glxWinScreenProbe(ScreenPtr pScreen)
// create window class
{
- static wATOM glTestWndClass = 0;
- if (glTestWndClass == 0)
- {
- WNDCLASSEX wc;
- glTestWndClass=1;
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = CS_OWNDC ;
- wc.lpfnWndProc = GlxWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = g_hInstance;
- wc.hIcon = 0;
- wc.hCursor = 0;
- wc.hbrBackground = 0;
- wc.lpszMenuName = NULL;
- wc.lpszClassName = WIN_GL_WINDOW_CLASS;
- wc.hIconSm = 0;
- RegisterClassEx (&wc);
- }
+ static wATOM glTestWndClass = 0;
+
+ if (glTestWndClass == 0) {
+ WNDCLASSEX wc;
+ glTestWndClass=1;
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = CS_OWNDC ;
+ wc.lpfnWndProc = GlxWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
+ wc.hIcon = 0;
+ wc.hCursor = 0;
+ wc.hbrBackground = 0;
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WIN_GL_WINDOW_CLASS;
+ wc.hIconSm = 0;
+ RegisterClassEx(&wc);
+ }
}
// create an invisible window for a scratch DC
hwnd = CreateWindowExA(0,
WIN_GL_WINDOW_CLASS,
"XWin GL Renderer Capabilities Test Window",
- 0, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
+ 0, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL),
+ NULL);
if (hwnd == NULL)
- LogMessage(X_ERROR,"AIGLX: Couldn't create a window for render capabilities testing\n");
+ LogMessage(X_ERROR,
+ "AIGLX: Couldn't create a window for render capabilities testing\n");
hdc = GetDC(hwnd);
@@ -660,10 +663,11 @@ glxWinScreenProbe(ScreenPtr pScreen)
winDebug("GL_VERSION: %s\n", glGetStringWrapperNonstatic(GL_VERSION));
winDebug("GL_VENDOR: %s\n", glGetStringWrapperNonstatic(GL_VENDOR));
winDebug("GL_RENDERER: %s\n", glGetStringWrapperNonstatic(GL_RENDERER));
- gl_extensions = (const char *)glGetStringWrapperNonstatic(GL_EXTENSIONS);
+ gl_extensions = (const char *) glGetStringWrapperNonstatic(GL_EXTENSIONS);
glxLogExtensions("GL_EXTENSIONS: ", gl_extensions);
wgl_extensions = wglGetExtensionsStringARBWrapper(hdc);
- if (!wgl_extensions) wgl_extensions = "";
+ if (!wgl_extensions)
+ wgl_extensions = "";
glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions);
// Can you see the problem here? The extensions string is DC specific
@@ -672,48 +676,50 @@ glxWinScreenProbe(ScreenPtr pScreen)
// those screens to be accelerated in XP and earlier...
{
- // testing facility to not use any WGL extensions
- char *envptr = getenv("GLWIN_NO_WGL_EXTENSIONS");
- if ((envptr != NULL) && (atoi(envptr) != 0))
- {
- ErrorF("GLWIN_NO_WGL_EXTENSIONS is set, ignoring WGL_EXTENSIONS\n");
- wgl_extensions = "";
+ // testing facility to not use any WGL extensions
+ char *envptr = getenv("GLWIN_NO_WGL_EXTENSIONS");
+
+ if ((envptr != NULL) && (atoi(envptr) != 0)) {
+ ErrorF("GLWIN_NO_WGL_EXTENSIONS is set, ignoring WGL_EXTENSIONS\n");
+ wgl_extensions = "";
}
}
{
- Bool glx_sgi_make_current_read = FALSE;
-
- //
- // Based on the WGL extensions available, enable various GLX extensions
- // XXX: make this table-driven ?
- //
- memset(screen->glx_enable_bits, 0, __GLX_EXT_BYTES);
-
- __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_info");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_rating");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig");
-
- if (strstr(wgl_extensions, "WGL_ARB_make_current_read"))
- {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_make_current_read");
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
- glx_sgi_make_current_read = TRUE;
+ Bool glx_sgi_make_current_read = FALSE;
+
+ //
+ // Based on the WGL extensions available, enable various GLX extensions
+ // XXX: make this table-driven ?
+ //
+ memset(screen->glx_enable_bits, 0, __GLX_EXT_BYTES);
+
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_info");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_rating");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig");
+
+ if (strstr(wgl_extensions, "WGL_ARB_make_current_read")) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_make_current_read");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
+ glx_sgi_make_current_read = TRUE;
}
- if (strstr(gl_extensions, "GL_WIN_swap_hint"))
- {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
- LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
+ if (strstr(gl_extensions, "GL_WIN_swap_hint")) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_copy_sub_buffer");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
}
- if (strstr(wgl_extensions, "WGL_EXT_swap_control"))
- {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_swap_control");
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
+ if (strstr(wgl_extensions, "WGL_EXT_swap_control")) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_swap_control");
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_swap_control");
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
}
/* // Hmm? screen->texOffset */
@@ -724,107 +730,104 @@ glxWinScreenProbe(ScreenPtr pScreen)
/* screen->has_WGL_ARB_render_texture = TRUE; */
/* } */
- if (strstr(wgl_extensions, "WGL_ARB_pbuffer"))
- {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_pbuffer");
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGIX_pbuffer\n");
- screen->has_WGL_ARB_pbuffer = TRUE;
+ if (strstr(wgl_extensions, "WGL_ARB_pbuffer")) {
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_pbuffer");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGIX_pbuffer\n");
+ screen->has_WGL_ARB_pbuffer = TRUE;
}
- if (strstr(wgl_extensions, "WGL_ARB_multisample"))
- {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_multisample");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIS_multisample");
- LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_multisample and GLX_SGIS_multisample\n");
- screen->has_WGL_ARB_multisample = TRUE;
+ if (strstr(wgl_extensions, "WGL_ARB_multisample")) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_ARB_multisample");
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGIS_multisample");
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_ARB_multisample and GLX_SGIS_multisample\n");
+ screen->has_WGL_ARB_multisample = TRUE;
}
- screen->base.destroy = glxWinScreenDestroy;
- screen->base.createContext = glxWinCreateContext;
- screen->base.createDrawable = glxWinCreateDrawable;
- screen->base.swapInterval = glxWinScreenSwapInterval;
- screen->base.pScreen = pScreen;
-
- // Creating the fbConfigs initializes screen->base.fbconfigs and screen->base.numFBConfigs
- if (strstr(wgl_extensions, "WGL_ARB_pixel_format"))
- {
- glxWinCreateConfigsExt(hdc, screen);
-
- /*
- Some graphics drivers appear to advertise WGL_ARB_pixel_format,
- but it doesn't work usefully, so we have to be prepared for it
- to fail and fall back to using DescribePixelFormat()
- */
- if (screen->base.numFBConfigs > 0)
- {
- screen->has_WGL_ARB_pixel_format = TRUE;
+ screen->base.destroy = glxWinScreenDestroy;
+ screen->base.createContext = glxWinCreateContext;
+ screen->base.createDrawable = glxWinCreateDrawable;
+ screen->base.swapInterval = glxWinScreenSwapInterval;
+ screen->base.pScreen = pScreen;
+
+ // Creating the fbConfigs initializes screen->base.fbconfigs and screen->base.numFBConfigs
+ if (strstr(wgl_extensions, "WGL_ARB_pixel_format")) {
+ glxWinCreateConfigsExt(hdc, screen);
+
+ /*
+ Some graphics drivers appear to advertise WGL_ARB_pixel_format,
+ but it doesn't work usefully, so we have to be prepared for it
+ to fail and fall back to using DescribePixelFormat()
+ */
+ if (screen->base.numFBConfigs > 0) {
+ screen->has_WGL_ARB_pixel_format = TRUE;
}
}
- if (screen->base.numFBConfigs <= 0)
- {
- glxWinCreateConfigs(hdc, screen);
- screen->has_WGL_ARB_pixel_format = FALSE;
+ if (screen->base.numFBConfigs <= 0) {
+ glxWinCreateConfigs(hdc, screen);
+ screen->has_WGL_ARB_pixel_format = FALSE;
}
- /*
- If we still didn't get any fbConfigs, we can't provide GLX for this screen
- */
- if (screen->base.numFBConfigs <= 0)
- {
- free(screen);
- LogMessage(X_ERROR,"AIGLX: No fbConfigs could be made from native OpenGL pixel formats\n");
- return NULL;
+ /*
+ If we still didn't get any fbConfigs, we can't provide GLX for this screen
+ */
+ if (screen->base.numFBConfigs <= 0) {
+ free(screen);
+ LogMessage(X_ERROR,
+ "AIGLX: No fbConfigs could be made from native OpenGL pixel formats\n");
+ return NULL;
}
- /* These will be set by __glXScreenInit */
- screen->base.visuals = NULL;
- screen->base.numVisuals = 0;
+ /* These will be set by __glXScreenInit */
+ screen->base.visuals = NULL;
+ screen->base.numVisuals = 0;
- __glXScreenInit(&screen->base, pScreen);
+ __glXScreenInit(&screen->base, pScreen);
#ifdef _DEBUG
- // dump out fbConfigs now fbConfigIds and visualIDs have been assigned
- fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs);
+ // dump out fbConfigs now fbConfigIds and visualIDs have been assigned
+ fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs);
#endif
- // Override the GL extensions string set by __glXScreenInit()
- screen->base.GLextensions = strdup(gl_extensions);
-
- // Generate the GLX extensions string (overrides that set by __glXScreenInit())
- {
- unsigned int buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
- if (buffer_size > 0)
- {
- free(screen->base.GLXextensions);
-
- screen->base.GLXextensions = xnfalloc(buffer_size);
- __glXGetExtensionString(screen->glx_enable_bits, screen->base.GLXextensions);
- }
- }
+ // Override the GL extensions string set by __glXScreenInit()
+ screen->base.GLextensions = strdup(gl_extensions);
- //
- // Override the GLX version (__glXScreenInit() sets it to "1.2")
- // if we have all the needed extensions to operate as a higher version
- //
- // SGIX_fbconfig && SGIX_pbuffer && SGI_make_current_read -> 1.3
- // ARB_multisample -> 1.4
- //
- if (screen->has_WGL_ARB_pbuffer && glx_sgi_make_current_read)
+ // Generate the GLX extensions string (overrides that set by __glXScreenInit())
{
- if (screen->has_WGL_ARB_multisample)
- {
- screen->base.GLXmajor = 1;
- screen->base.GLXminor = 4;
+ unsigned int buffer_size =
+ __glXGetExtensionString(screen->glx_enable_bits, NULL);
+ if (buffer_size > 0) {
+ free(screen->base.GLXextensions);
+
+ screen->base.GLXextensions = xnfalloc(buffer_size);
+ __glXGetExtensionString(screen->glx_enable_bits,
+ screen->base.GLXextensions);
}
- else
- {
- screen->base.GLXmajor = 1;
- screen->base.GLXminor = 3;
+ }
+
+ //
+ // Override the GLX version (__glXScreenInit() sets it to "1.2")
+ // if we have all the needed extensions to operate as a higher version
+ //
+ // SGIX_fbconfig && SGIX_pbuffer && SGI_make_current_read -> 1.3
+ // ARB_multisample -> 1.4
+ //
+ if (screen->has_WGL_ARB_pbuffer && glx_sgi_make_current_read) {
+ if (screen->has_WGL_ARB_multisample) {
+ screen->base.GLXmajor = 1;
+ screen->base.GLXminor = 4;
+ }
+ else {
+ screen->base.GLXmajor = 1;
+ screen->base.GLXminor = 3;
}
}
}
- LogMessage(X_INFO, "AIGLX: Set GLX version to %d.%d\n", screen->base.GLXmajor, screen->base.GLXminor);
+ LogMessage(X_INFO, "AIGLX: Set GLX version to %d.%d\n",
+ screen->base.GLXmajor, screen->base.GLXminor);
wglMakeCurrent(NULL, NULL);
wglDeleteContext(hglrc);
@@ -862,7 +865,6 @@ glxWinRealizeWindow(WindowPtr pWin)
return result;
}
-
static void
glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
@@ -872,9 +874,8 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
GLWIN_TRACE_MSG("glxWinCopyWindow pWindow %p", pWindow);
- dixLookupResourceByType((pointer) &pGlxDraw, pWindow->drawable.id, __glXDrawableRes,
- NullClient, DixUnknownAccess);
-
+ dixLookupResourceByType((pointer) &pGlxDraw, pWindow->drawable.id,
+ __glXDrawableRes, NullClient, DixUnknownAccess);
/*
Discard any CopyWindow requests if a GL drawing context is pointing at the window
@@ -882,12 +883,11 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
For regions which are being drawn by GL, the shadow framebuffer doesn't have the
correct bits, so we wish to avoid shadow framebuffer damage occuring, which will
cause those incorrect bits to be transferred to the display....
- */
- if (pGlxDraw && pGlxDraw->drawContext)
- {
+ */
+ if (pGlxDraw && pGlxDraw->drawContext) {
GLWIN_DEBUG_MSG("glxWinCopyWindow: discarding");
return;
- }
+ }
GLWIN_DEBUG_MSG("glxWinCopyWindow - passing to hw layer");
@@ -928,7 +928,7 @@ glxWinUnrealizeWindow(WindowPtr pWin)
{
Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen;
- glxWinScreen *screenPriv = (glxWinScreen *)glxGetScreen(pScreen);
+ glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen);
winWindowPriv(pWin);
GLWIN_DEBUG_MSG("glxWinUnrealizeWindow");
@@ -990,123 +990,117 @@ glxWinDestroyWindow(WindowPtr pWin)
*/
static GLboolean
-glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable *base)
+glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base)
{
BOOL ret;
- __GLXWinDrawable *draw = (__GLXWinDrawable *)base;
+ __GLXWinDrawable *draw = (__GLXWinDrawable *) base;
/* Swap buffers on the last active context for drawing on the drawable */
- if (draw->drawContext == NULL)
- {
+ if (draw->drawContext == NULL) {
GLWIN_TRACE_MSG("glxWinSwapBuffers - no context for drawable");
return GL_FALSE;
- }
+ }
- GLWIN_TRACE_MSG("glxWinSwapBuffers on drawable %p, last context %p (native ctx %p)", base, draw->drawContext, draw->drawContext->ctx);
+ GLWIN_TRACE_MSG
+ ("glxWinSwapBuffers on drawable %p, last context %p (native ctx %p)",
+ base, draw->drawContext, draw->drawContext->ctx);
/*
draw->drawContext->base.drawPriv will not be set if the context is not current anymore,
but if it is, it should point to this drawable....
- */
- assert((draw->drawContext->base.drawPriv == NULL) || (draw->drawContext->base.drawPriv == base));
+ */
+ assert((draw->drawContext->base.drawPriv == NULL) ||
+ (draw->drawContext->base.drawPriv == base));
ret = SwapBuffers(draw->drawContext->hDC);
- if (!ret)
- {
+ if (!ret) {
ErrorF("wglSwapBuffers failed: %s\n", glxWinErrorMessage());
return GL_FALSE;
- }
+ }
return GL_TRUE;
}
static void
-glxWinDrawableCopySubBuffer(__GLXdrawable *drawable,
+glxWinDrawableCopySubBuffer(__GLXdrawable * drawable,
int x, int y, int w, int h)
{
- glAddSwapHintRectWINWrapperNonstatic(x, y, w, h);
- glxWinDrawableSwapBuffers(NULL, drawable);
+ glAddSwapHintRectWINWrapperNonstatic(x, y, w, h);
+ glxWinDrawableSwapBuffers(NULL, drawable);
}
static void
-glxWinDrawableDestroy(__GLXdrawable *base)
+glxWinDrawableDestroy(__GLXdrawable * base)
{
- __GLXWinDrawable *glxPriv = (__GLXWinDrawable *)base;
-
- if (glxPriv->drawContext && (__glXLastContext == &((glxPriv->drawContext)->base)))
- {
- // if this context is current and has unflushed commands, say we have flushed them
- // (don't actually flush them, the window is going away anyhow, and an implict flush occurs
- // on the next context change)
- // (GLX core considers it an error when we try to select a new current context if the old one
- // has unflushed commands, but the window has disappeared..)
- __glXLastContext->hasUnflushedCommands = FALSE;
- __glXLastContext = NULL;
+ __GLXWinDrawable *glxPriv = (__GLXWinDrawable *) base;
+
+ if (glxPriv->drawContext &&
+ (__glXLastContext == &((glxPriv->drawContext)->base))) {
+ // if this context is current and has unflushed commands, say we have flushed them
+ // (don't actually flush them, the window is going away anyhow, and an implict flush occurs
+ // on the next context change)
+ // (GLX core considers it an error when we try to select a new current context if the old one
+ // has unflushed commands, but the window has disappeared..)
+ __glXLastContext->hasUnflushedCommands = FALSE;
+ __glXLastContext = NULL;
}
- if (glxPriv->hPbuffer)
- if (!wglDestroyPbufferARBWrapper(glxPriv->hPbuffer))
- {
- ErrorF("wglDestroyPbufferARB failed: %s\n", glxWinErrorMessage());
- }
+ if (glxPriv->hPbuffer)
+ if (!wglDestroyPbufferARBWrapper(glxPriv->hPbuffer)) {
+ ErrorF("wglDestroyPbufferARB failed: %s\n", glxWinErrorMessage());
+ }
- if (glxPriv->dibDC)
- {
- // restore the default DIB
- SelectObject(glxPriv->dibDC, glxPriv->hOldDIB);
+ if (glxPriv->dibDC) {
+ // restore the default DIB
+ SelectObject(glxPriv->dibDC, glxPriv->hOldDIB);
- if (!DeleteDC(glxPriv->dibDC))
- {
- ErrorF("DeleteDC failed: %s\n", glxWinErrorMessage());
+ if (!DeleteDC(glxPriv->dibDC)) {
+ ErrorF("DeleteDC failed: %s\n", glxWinErrorMessage());
}
}
- if (glxPriv->hDIB)
- {
- if (!DeleteObject(glxPriv->hDIB))
- {
- ErrorF("DeleteObject failed: %s\n", glxWinErrorMessage());
+ if (glxPriv->hDIB) {
+ if (!DeleteObject(glxPriv->hDIB)) {
+ ErrorF("DeleteObject failed: %s\n", glxWinErrorMessage());
}
- ((PixmapPtr)glxPriv->base.pDraw)->devPrivate.ptr = glxPriv->pOldBits;
- glxPriv->base.pDraw->pScreen->DestroyPixmap((PixmapPtr)glxPriv->base.pDraw); /* Decrement reference count since we do not use it any more */
+ ((PixmapPtr) glxPriv->base.pDraw)->devPrivate.ptr = glxPriv->pOldBits;
+ glxPriv->base.pDraw->pScreen->DestroyPixmap((PixmapPtr)glxPriv->base.pDraw); /* Decrement reference count since we do not use it any more */
}
- GLWIN_DEBUG_MSG("glxWinDestroyDrawable");
- free(glxPriv);
+ GLWIN_DEBUG_MSG("glxWinDestroyDrawable");
+ free(glxPriv);
}
static __GLXdrawable *
glxWinCreateDrawable(ClientPtr client,
- __GLXscreen *screen,
- DrawablePtr pDraw,
- XID drawId,
- int type,
- XID glxDrawId,
- __GLXconfig *conf)
+ __GLXscreen * screen,
+ DrawablePtr pDraw,
+ XID drawId, int type, XID glxDrawId, __GLXconfig * conf)
{
- __GLXWinDrawable *glxPriv;
+ __GLXWinDrawable *glxPriv;
- glxPriv = calloc(1,sizeof(*glxPriv));
+ glxPriv = calloc(1, sizeof *glxPriv);
- if (glxPriv == NULL)
- return NULL;
+ if (glxPriv == NULL)
+ return NULL;
- if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
- free(glxPriv);
- return NULL;
- }
+ if (!__glXDrawableInit
+ (&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
+ free(glxPriv);
+ return NULL;
+ }
- glxPriv->base.destroy = glxWinDrawableDestroy;
- glxPriv->base.swapBuffers = glxWinDrawableSwapBuffers;
- glxPriv->base.copySubBuffer = glxWinDrawableCopySubBuffer;
- // glxPriv->base.waitX what are these for?
- // glxPriv->base.waitGL
+ glxPriv->base.destroy = glxWinDrawableDestroy;
+ glxPriv->base.swapBuffers = glxWinDrawableSwapBuffers;
+ glxPriv->base.copySubBuffer = glxWinDrawableCopySubBuffer;
+ // glxPriv->base.waitX what are these for?
+ // glxPriv->base.waitGL
- GLWIN_DEBUG_MSG("glxWinCreateDrawable %p", glxPriv);
+ GLWIN_DEBUG_MSG("glxWinCreateDrawable %p", glxPriv);
- return &glxPriv->base;
+ return &glxPriv->base;
}
/* ---------------------------------------------------------------------- */
@@ -1115,21 +1109,21 @@ glxWinCreateDrawable(ClientPtr client,
*/
static
-int glxWinBindTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap)
+ int
+glxWinBindTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap)
{
- ErrorF("glxWinBindTexImage: not implemented\n");
- return FALSE;
+ ErrorF("glxWinBindTexImage: not implemented\n");
+ return FALSE;
}
static
-int glxWinReleaseTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap)
+ int
+glxWinReleaseTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap)
{
- ErrorF(" glxWinReleaseTexImage: not implemented\n");
- return FALSE;
+ ErrorF(" glxWinReleaseTexImage: not implemented\n");
+ return FALSE;
}
/* ---------------------------------------------------------------------- */
@@ -1152,13 +1146,14 @@ int glxWinReleaseTexImage(__GLXcontext *baseContext,
*/
static Bool
-glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawableTypeOverride)
+glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride,
+ int drawableTypeOverride)
{
- __GLXscreen *screen = gc->base.pGlxScreen;
- glxWinScreen *winScreen = (glxWinScreen *)screen;
+ __GLXscreen *screen = gc->base.pGlxScreen;
+ glxWinScreen *winScreen = (glxWinScreen *) screen;
- __GLXconfig *config = gc->base.config;
- GLXWinConfig *winConfig = (GLXWinConfig *)config;
+ __GLXconfig *config = gc->base.config;
+ GLXWinConfig *winConfig = (GLXWinConfig *) config;
WindowPtr pWin;
@@ -1174,18 +1169,18 @@ glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawable
}
GLWIN_DEBUG_MSG("glxWinSetPixelFormat: pixelFormatIndex %d", winConfig->pixelFormatIndex);
- /*
+ /*
Normally, we can just use the the pixelFormatIndex corresponding
to the fbconfig which has been specified by the client
*/
/*
- However, in certain special cases this pixel format will be incompatible with the
- use we are going to put it to, so we need to re-evaluate the pixel format to use:
+ However, in certain special cases this pixel format will be incompatible with the
+ use we are going to put it to, so we need to re-evaluate the pixel format to use:
- 1) When PFD_DRAW_TO_BITMAP is set, ChoosePixelFormat() always returns a format with
+ 1) When PFD_DRAW_TO_BITMAP is set, ChoosePixelFormat() always returns a format with
the cColorBits we asked for, so we need to ensure it matches the bpp of the bitmap
- 2) Applications may assume that visuals selected with glXChooseVisual() work with
+ 2) Applications may assume that visuals selected with glXChooseVisual() work with
pixmap drawables (there is no attribute to explicitly query for pixmap drawable
support as there is for glXChooseFBConfig())
(it's arguable this is an error in the application, but we try to make it work)
@@ -1194,63 +1189,63 @@ glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawable
by default, but if the actual drawable type we're trying to select the context
on (drawableTypeOverride) isn't supported by the selected fbConfig, reconsider
and see if we can find a suitable one...
- */
- ErrorF("glxWinSetPixelFormat: having second thoughts: cColorbits %d, bppOveride %d; config->drawableType %d, drawableTypeOverride %d\n",
- (config->redBits + config->greenBits + config->blueBits), bppOverride, config->drawableType, drawableTypeOverride);
-
- if (!winScreen->has_WGL_ARB_pixel_format)
- {
- PIXELFORMATDESCRIPTOR pfd;
- int pixelFormat;
-
- /* convert fbConfig to PFD */
- if (fbConfigToPixelFormat(gc->base.config, &pfd, drawableTypeOverride))
- {
- ErrorF("glxWinSetPixelFormat: fbConfigToPixelFormat failed\n");
- return FALSE;
+ */
+ ErrorF
+ ("glxWinSetPixelFormat: having second thoughts: cColorbits %d, bppOveride %d; config->drawableType %d, drawableTypeOverride %d\n",
+ (config->redBits + config->greenBits + config->blueBits), bppOverride,
+ config->drawableType, drawableTypeOverride);
+
+ if (!winScreen->has_WGL_ARB_pixel_format) {
+ PIXELFORMATDESCRIPTOR pfd;
+ int pixelFormat;
+
+ /* convert fbConfig to PFD */
+ if (fbConfigToPixelFormat(gc->base.config, &pfd, drawableTypeOverride)) {
+ ErrorF("glxWinSetPixelFormat: fbConfigToPixelFormat failed\n");
+ return FALSE;
}
#ifdef _DEBUG
if (glxWinDebugSettings.dumpPFD)
- pfdOut(&pfd);
+ pfdOut(&pfd);
#endif
- if (bppOverride)
- {
- GLWIN_DEBUG_MSG("glxWinSetPixelFormat: Forcing bpp from %d to %d\n", pfd.cColorBits, bppOverride);
- pfd.cColorBits = bppOverride;
+ if (bppOverride) {
+ GLWIN_DEBUG_MSG("glxWinSetPixelFormat: Forcing bpp from %d to %d\n",
+ pfd.cColorBits, bppOverride);
+ pfd.cColorBits = bppOverride;
}
- pixelFormat = ChoosePixelFormat(hdc, &pfd);
- if (pixelFormat == 0)
- {
- ErrorF("ChoosePixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ pixelFormat = ChoosePixelFormat(hdc, &pfd);
+ if (pixelFormat == 0) {
+ ErrorF("ChoosePixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
- GLWIN_DEBUG_MSG("ChoosePixelFormat: chose pixelFormatIndex %d", pixelFormat);
- ErrorF("ChoosePixelFormat: chose pixelFormatIndex %d (rather than %d as originally planned)\n", pixelFormat, winConfig->pixelFormatIndex);
+ GLWIN_DEBUG_MSG("ChoosePixelFormat: chose pixelFormatIndex %d",
+ pixelFormat);
+ ErrorF
+ ("ChoosePixelFormat: chose pixelFormatIndex %d (rather than %d as originally planned)\n",
+ pixelFormat, winConfig->pixelFormatIndex);
- ErrorF("Setting pixel format 2 to %d on hdc %x\n",pixelFormat,hdc);
- if (!SetPixelFormat(hdc, pixelFormat, &pfd))
- {
- ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ ErrorF("Setting pixel format 2 to %d on hdc %x\n",pixelFormat,hdc);
+ if (!SetPixelFormat(hdc, pixelFormat, &pfd)) {
+ ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
}
- else
- {
- int pixelFormat = fbConfigToPixelFormatIndex(hdc, gc->base.config, drawableTypeOverride, winScreen);
- if (pixelFormat != 0)
- {
+ else {
+ int pixelFormat =
+ fbConfigToPixelFormatIndex(hdc, gc->base.config,
+ drawableTypeOverride, winScreen);
+ if (pixelFormat != 0) {
GLWIN_DEBUG_MSG("wglChoosePixelFormat: chose pixelFormatIndex %d", pixelFormat);
ErrorF("Setting pixel format 3 to %d on hdc %x\n",pixelFormat,hdc);
- if (!SetPixelFormat(hdc, pixelFormat, NULL))
- {
- ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
- }
+ if (!SetPixelFormat(hdc, pixelFormat, NULL)) {
+ ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
+ }
return TRUE;
}
else
@@ -1290,40 +1285,37 @@ glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawable
}
}
}
- return TRUE;
+ return TRUE;
}
static HDC
glxWinMakeDC(__GLXWinContext *gc, __GLXWinDrawable *draw, HWND *hwnd)
{
- HDC hdc = NULL;
- *hwnd = NULL;
+ HDC hdc = NULL;
+ *hwnd = NULL;
- if (draw == NULL)
- {
- GLWIN_TRACE_MSG("No drawable for context %p (native ctx %p)", gc, gc->ctx);
- return NULL;
+ if (draw == NULL) {
+ GLWIN_TRACE_MSG("No drawable for context %p (native ctx %p)", gc,
+ gc->ctx);
+ return NULL;
}
- switch (draw->base.type)
- {
+ switch (draw->base.type) {
case GLX_DRAWABLE_WINDOW:
{
- WindowPtr pWin;
+ WindowPtr pWin;
- pWin = (WindowPtr) draw->base.pDraw;
- if (pWin == NULL)
- {
- GLWIN_TRACE_MSG("for drawable %p, no WindowPtr", pWin);
- return NULL;
+ pWin = (WindowPtr) draw->base.pDraw;
+ if (pWin == NULL) {
+ GLWIN_TRACE_MSG("for drawable %p, no WindowPtr", pWin);
+ return NULL;
}
- *hwnd = winGetWindowInfo(pWin);
+ *hwnd = winGetWindowInfo(pWin);
- if (*hwnd == NULL)
- {
- ErrorF("No HWND error: %s\n", glxWinErrorMessage());
- return NULL;
+ if (*hwnd == NULL) {
+ ErrorF("No HWND error: %s\n", glxWinErrorMessage());
+ return NULL;
}
if (!gc->hDC)
@@ -1341,30 +1333,32 @@ glxWinMakeDC(__GLXWinContext *gc, __GLXWinDrawable *draw, HWND *hwnd)
}
#ifdef _DEBUG
- if (glxWinDebugSettings.enableTrace)
- GLWIN_DEBUG_HWND(*hwnd);
+ if (glxWinDebugSettings.enableTrace)
+ GLWIN_DEBUG_HWND(*hwnd);
- GLWIN_TRACE_MSG("for context %p (native ctx %p), hWnd changed from %p to %p", gc, gc->ctx, gc->hwnd, *hwnd);
+ GLWIN_TRACE_MSG
+ ("for context %p (native ctx %p), hWnd changed from %p to %p",
+ gc, gc->ctx, gc->hwnd, *hwnd);
#endif
if (gc->hwnd!=*hwnd)
ErrorF("Window changed handle from %x to %x\n", gc->hwnd, *hwnd);
gc->hwnd = *hwnd;
}
- break;
+ break;
- case GLX_DRAWABLE_PBUFFER:
+ case GLX_DRAWABLE_PBUFFER:
{
hdc = wglGetPbufferDCARBWrapper(draw->hPbuffer);
if (hdc == NULL)
- ErrorF("GetDC (pbuffer) error: %s\n", glxWinErrorMessage());
+ ErrorF("GetDC (pbuffer) error: %s\n", glxWinErrorMessage());
gc->ctx = wglCreateContext(hdc);
}
- break;
+ break;
- case GLX_DRAWABLE_PIXMAP:
+ case GLX_DRAWABLE_PIXMAP:
{
hdc = draw->dibDC;
#ifdef _DEBUG
@@ -1372,219 +1366,232 @@ glxWinMakeDC(__GLXWinContext *gc, __GLXWinDrawable *draw, HWND *hwnd)
GLWIN_DEBUG_MSG("Got PIXMAP HDC %p for window %p", hdc, *hwnd);
#endif
}
- break;
+ break;
- default:
+ default:
{
- ErrorF("glxWinMakeDC: tried to makeDC for unhandled drawable type %d\n", draw->base.type);
+ ErrorF("glxWinMakeDC: tried to makeDC for unhandled drawable type %d\n",
+ draw->base.type);
+ }
}
- }
#ifdef _DEBUG
- if (glxWinDebugSettings.dumpDC)
- GLWIN_HDC_DEBUG_MSG("Got HDC %p for window %p", hdc, *hwnd);
+ if (glxWinDebugSettings.dumpDC)
+ GLWIN_HDC_DEBUG_MSG("Got HDC %p for window %p", hdc, *hwnd);
#endif
return hdc;
}
static void
-glxWinReleaseDC(HWND hwnd, HDC hdc,__GLXWinDrawable *draw)
+glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable * draw)
{
- switch (draw->base.type)
- {
+ switch (draw->base.type) {
case GLX_DRAWABLE_WINDOW:
{
- ReleaseDC(hwnd, hdc);
+ ReleaseDC(hwnd, hdc);
}
- break;
+ break;
- case GLX_DRAWABLE_PBUFFER:
+ case GLX_DRAWABLE_PBUFFER:
{
- if (!wglReleasePbufferDCARBWrapper(draw->hPbuffer, hdc))
- {
- ErrorF("wglReleasePbufferDCARB error: %s\n", glxWinErrorMessage());
+ if (!wglReleasePbufferDCARBWrapper(draw->hPbuffer, hdc)) {
+ ErrorF("wglReleasePbufferDCARB error: %s\n", glxWinErrorMessage());
}
}
- break;
+ break;
- case GLX_DRAWABLE_PIXMAP:
+ case GLX_DRAWABLE_PIXMAP:
{
- // don't release DC, the memory DC lives as long as the bitmap
+ // don't release DC, the memory DC lives as long as the bitmap
- // We must ensure that all GDI drawing into the bitmap has completed
- // in case we subsequently access the bits from it
- GdiFlush();
+ // We must ensure that all GDI drawing into the bitmap has completed
+ // in case we subsequently access the bits from it
+ GdiFlush();
}
- break;
+ break;
- default:
+ default:
{
- ErrorF("glxWinReleaseDC: tried to releaseDC for unhandled drawable type %d\n", draw->base.type);
+ ErrorF
+ ("glxWinReleaseDC: tried to releaseDC for unhandled drawable type %d\n",
+ draw->base.type);
+ }
}
- }
}
static void
-glxWinDeferredCreateContext(__GLXWinContext *gc, __GLXWinDrawable *draw)
+glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
{
- HWND hwnd;
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: attach context %p to drawable %p", gc, draw);
+ HWND hwnd;
- switch (draw->base.type)
- {
+ GLWIN_DEBUG_MSG
+ ("glxWinDeferredCreateContext: attach context %p to drawable %p", gc,
+ draw);
+
+ switch (draw->base.type) {
case GLX_DRAWABLE_WINDOW:
{
- WindowPtr pWin = (WindowPtr) draw->base.pDraw;
+ WindowPtr pWin = (WindowPtr) draw->base.pDraw;
- if (!(gc->base.config->drawableType & GLX_WINDOW_BIT))
- {
- ErrorF("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_WINDOW_BIT to a GLX_DRAWABLE_WINDOW drawable\n");
+ if (!(gc->base.config->drawableType & GLX_WINDOW_BIT)) {
+ ErrorF
+ ("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_WINDOW_BIT to a GLX_DRAWABLE_WINDOW drawable\n");
}
- if (pWin == NULL)
- {
- GLWIN_DEBUG_MSG("Deferring until X window is created");
- return;
+ if (pWin == NULL) {
+ GLWIN_DEBUG_MSG("Deferring until X window is created");
+ return;
}
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: pWin %p", pWin);
+ GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: pWin %p", pWin);
- if (winGetWindowInfo(pWin) == NULL)
- {
- GLWIN_DEBUG_MSG("Deferring until native window is created");
- return;
+ if (winGetWindowInfo(pWin) == NULL) {
+ GLWIN_DEBUG_MSG("Deferring until native window is created");
+ return;
}
}
- break;
+ break;
case GLX_DRAWABLE_PBUFFER:
{
WindowPtr pWin = (WindowPtr) draw->base.pDraw;
- if (draw->hPbuffer == NULL)
- {
- __GLXscreen *screen;
- glxWinScreen *winScreen;
- int pixelFormat;
- // XXX: which DC are supposed to use???
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
- HDC screenDC=pWinScreen->hdcScreen;
-
- if (!(gc->base.config->drawableType & GLX_PBUFFER_BIT))
- {
- ErrorF("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_PBUFFER_BIT to a GLX_DRAWABLE_PBUFFER drawable\n");
+ if (draw->hPbuffer == NULL) {
+ __GLXscreen *screen;
+ glxWinScreen *winScreen;
+ int pixelFormat;
+
+ // XXX: which DC are supposed to use???
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
+ HDC screenDC=pWinScreen->hdcScreen;
+
+ if (!(gc->base.config->drawableType & GLX_PBUFFER_BIT)) {
+ ErrorF
+ ("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_PBUFFER_BIT to a GLX_DRAWABLE_PBUFFER drawable\n");
}
- screen = gc->base.pGlxScreen;
- winScreen = (glxWinScreen *)screen;
+ screen = gc->base.pGlxScreen;
+ winScreen = (glxWinScreen *) screen;
- pixelFormat = fbConfigToPixelFormatIndex(screenDC, gc->base.config, GLX_PBUFFER_BIT, winScreen);
- if (pixelFormat == 0)
- {
- ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
- return;
+ pixelFormat =
+ fbConfigToPixelFormatIndex(screenDC, gc->base.config,
+ GLX_PBUFFER_BIT, winScreen);
+ if (pixelFormat == 0) {
+ ErrorF("wglChoosePixelFormat error: %s\n",
+ glxWinErrorMessage());
+ return;
}
- draw->hPbuffer = wglCreatePbufferARBWrapper(screenDC, pixelFormat, draw->base.pDraw->width, draw->base.pDraw->height, NULL);
+ draw->hPbuffer =
+ wglCreatePbufferARBWrapper(screenDC, pixelFormat,
+ draw->base.pDraw->width,
+ draw->base.pDraw->height, NULL);
- if (draw->hPbuffer == NULL)
- {
- ErrorF("wglCreatePbufferARBWrapper error: %s\n", glxWinErrorMessage());
- return;
+ if (draw->hPbuffer == NULL) {
+ ErrorF("wglCreatePbufferARBWrapper error: %s\n",
+ glxWinErrorMessage());
+ return;
}
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: pBuffer %p created for drawable %p", draw->hPbuffer, draw);
+ GLWIN_DEBUG_MSG
+ ("glxWinDeferredCreateContext: pBuffer %p created for drawable %p",
+ draw->hPbuffer, draw);
}
}
- break;
+ break;
case GLX_DRAWABLE_PIXMAP:
{
- if (draw->dibDC == NULL)
- {
- BITMAPINFOHEADER bmpHeader;
- void *pBits;
-
- memset (&bmpHeader, 0, sizeof(BITMAPINFOHEADER));
- bmpHeader.biSize = sizeof(BITMAPINFOHEADER);
- bmpHeader.biWidth = draw->base.pDraw->width;
- bmpHeader.biHeight = draw->base.pDraw->height;
- bmpHeader.biPlanes = 1;
- bmpHeader.biBitCount = draw->base.pDraw->bitsPerPixel;
- bmpHeader.biCompression = BI_RGB;
-
- if (!(gc->base.config->drawableType & GLX_PIXMAP_BIT))
- {
- ErrorF("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_PIXMAP_BIT to a GLX_DRAWABLE_PIXMAP drawable\n");
+ if (draw->dibDC == NULL) {
+ BITMAPINFOHEADER bmpHeader;
+ void *pBits;
+
+ memset(&bmpHeader, 0, sizeof(BITMAPINFOHEADER));
+ bmpHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmpHeader.biWidth = draw->base.pDraw->width;
+ bmpHeader.biHeight = draw->base.pDraw->height;
+ bmpHeader.biPlanes = 1;
+ bmpHeader.biBitCount = draw->base.pDraw->bitsPerPixel;
+ bmpHeader.biCompression = BI_RGB;
+
+ if (!(gc->base.config->drawableType & GLX_PIXMAP_BIT)) {
+ ErrorF
+ ("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_PIXMAP_BIT to a GLX_DRAWABLE_PIXMAP drawable\n");
}
- draw->dibDC = CreateCompatibleDC(NULL);
- if (draw->dibDC == NULL)
- {
- ErrorF("CreateCompatibleDC error: %s\n", glxWinErrorMessage());
- return;
+ draw->dibDC = CreateCompatibleDC(NULL);
+ if (draw->dibDC == NULL) {
+ ErrorF("CreateCompatibleDC error: %s\n", glxWinErrorMessage());
+ return;
}
- draw->hDIB = CreateDIBSection(draw->dibDC, (BITMAPINFO *)&bmpHeader, DIB_RGB_COLORS, &pBits, 0, 0);
- if (draw->dibDC == NULL)
- {
- ErrorF("CreateDIBSection error: %s\n", glxWinErrorMessage());
- return;
+ draw->hDIB =
+ CreateDIBSection(draw->dibDC, (BITMAPINFO *) & bmpHeader,
+ DIB_RGB_COLORS, &pBits, 0, 0);
+ if (draw->dibDC == NULL) {
+ ErrorF("CreateDIBSection error: %s\n", glxWinErrorMessage());
+ return;
}
- // XXX: CreateDIBSection insists on allocating the bitmap memory for us, so we're going to
- // need some jiggery pokery to point the underlying X Drawable's bitmap at the same set of bits
- // so that they can be read with XGetImage as well as glReadPixels, assuming the formats are
- // even compatible ...
- draw->pOldBits = ((PixmapPtr)draw->base.pDraw)->devPrivate.ptr;
- ((PixmapPtr)draw->base.pDraw)->devPrivate.ptr = pBits;
+ // XXX: CreateDIBSection insists on allocating the bitmap memory for us, so we're going to
+ // need some jiggery pokery to point the underlying X Drawable's bitmap at the same set of bits
+ // so that they can be read with XGetImage as well as glReadPixels, assuming the formats are
+ // even compatible ...
+ draw->pOldBits = ((PixmapPtr) draw->base.pDraw)->devPrivate.ptr;
+ ((PixmapPtr) draw->base.pDraw)->devPrivate.ptr = pBits;
((PixmapPtr)draw->base.pDraw)->refcnt++; /* Increment reference count to be sure it is not freed before the glxdrawable is destroyed */
- // Select the DIB into the DC
- draw->hOldDIB = SelectObject(draw->dibDC, draw->hDIB);
- if (!draw->hOldDIB)
- {
- ErrorF("SelectObject error: %s\n", glxWinErrorMessage());
+ // Select the DIB into the DC
+ draw->hOldDIB = SelectObject(draw->dibDC, draw->hDIB);
+ if (!draw->hOldDIB) {
+ ErrorF("SelectObject error: %s\n", glxWinErrorMessage());
}
- // Set the pixel format of the bitmap
- glxWinSetPixelFormat(gc, draw->dibDC, draw->base.pDraw->bitsPerPixel, GLX_PIXMAP_BIT);
+ // Set the pixel format of the bitmap
+ glxWinSetPixelFormat(gc, draw->dibDC,
+ draw->base.pDraw->bitsPerPixel,
+ GLX_PIXMAP_BIT);
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: DIB bitmap %p created for drawable %p", draw->hDIB, draw);
+ GLWIN_DEBUG_MSG
+ ("glxWinDeferredCreateContext: DIB bitmap %p created for drawable %p",
+ draw->hDIB, draw);
}
}
- break;
+ break;
default:
{
- ErrorF("glxWinDeferredCreateContext: tried to attach unhandled drawable type %d\n", draw->base.type);
- return;
+ ErrorF
+ ("glxWinDeferredCreateContext: tried to attach unhandled drawable type %d\n",
+ draw->base.type);
+ return;
+ }
}
- }
- gc->hDC = glxWinMakeDC(gc, draw, &hwnd);
+ gc->hDC = glxWinMakeDC(gc, draw, &hwnd);
- if (gc->ctx == NULL)
- {
+ if (gc->ctx == NULL) {
glxWinReleaseDC(hwnd, gc->hDC, draw);
gc->hDC=0;
- ErrorF("wglCreateContext error: %s\n", glxWinErrorMessage());
- return;
+ ErrorF("wglCreateContext error: %s\n", glxWinErrorMessage());
+ return;
}
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: attached context %p to native context %p drawable %p", gc, gc->ctx, draw);
+ GLWIN_DEBUG_MSG
+ ("glxWinDeferredCreateContext: attached context %p to native context %p drawable %p",
+ gc, gc->ctx, draw);
- // if the native context was created successfully, shareLists if needed
- if (gc->ctx && gc->shareContext && gc->shareContext->ctx)
- {
- GLWIN_DEBUG_MSG("glxWinCreateContextReal shareLists with context %p (native ctx %p)", gc->shareContext, gc->shareContext->ctx);
+ // if the native context was created successfully, shareLists if needed
+ if (gc->ctx && gc->shareContext && gc->shareContext->ctx) {
+ GLWIN_DEBUG_MSG
+ ("glxWinCreateContextReal shareLists with context %p (native ctx %p)",
+ gc->shareContext, gc->shareContext->ctx);
- if (!wglShareLists(gc->shareContext->ctx, gc->ctx))
- {
- ErrorF("wglShareLists error: %s\n", glxWinErrorMessage());
+ if (!wglShareLists(gc->shareContext->ctx, gc->ctx)) {
+ ErrorF("wglShareLists error: %s\n", glxWinErrorMessage());
}
}
}
@@ -1594,70 +1601,64 @@ glxWinDeferredCreateContext(__GLXWinContext *gc, __GLXWinDrawable *draw)
* Context functions
*/
-
/* Context manipulation routines should return TRUE on success, FALSE on failure */
static int
-glxWinContextMakeCurrent(__GLXcontext *base)
+glxWinContextMakeCurrent(__GLXcontext * base)
{
- __GLXWinContext *gc = (__GLXWinContext *)base;
- BOOL ret;
- __GLXWinDrawable *drawPriv;
+ __GLXWinContext *gc = (__GLXWinContext *) base;
+ BOOL ret;
+ __GLXWinDrawable *drawPriv;
#ifdef _DEBUG
- GLWIN_TRACE_MSG("glxWinContextMakeCurrent context %p (native ctx %p)", gc, gc->ctx);
- glWinCallDelta();
+ GLWIN_TRACE_MSG("glxWinContextMakeCurrent context %p (native ctx %p)", gc, gc->ctx);
+ glWinCallDelta();
#endif
- /* Keep a note of the last active context in the drawable */
- drawPriv = (__GLXWinDrawable *)gc->base.drawPriv;
- drawPriv->drawContext = gc;
+ /* Keep a note of the last active context in the drawable */
+ drawPriv = (__GLXWinDrawable *)gc->base.drawPriv;
+ drawPriv->drawContext = gc;
- if (gc->ctx == NULL)
- {
- glxWinDeferredCreateContext(gc, drawPriv);
+ if (gc->ctx == NULL) {
+ glxWinDeferredCreateContext(gc, drawPriv);
}
- _glapi_set_dispatch(gc->Dispatch);
+ _glapi_set_dispatch(gc->Dispatch);
- if (gc->ctx == NULL)
- {
- ErrorF("glxWinContextMakeCurrent: Native context is NULL\n");
+ if (gc->ctx == NULL) {
+ ErrorF("glxWinContextMakeCurrent: Native context is NULL\n");
drawPriv->drawContext = NULL; /* clear last active context because we return error */
- return FALSE;
+ return FALSE;
}
- if ((gc->base.readPriv != NULL) && (gc->base.readPriv != gc->base.drawPriv))
- {
- // XXX: should only occur with WGL_ARB_make_current_read
- /*
- If there is a separate read drawable, create a separate read DC, and
- use the wglMakeContextCurrent extension to make the context current drawing
- to one DC and reading from the other
- */
- gc->hreadDC = glxWinMakeDC(gc, (__GLXWinDrawable *)gc->base.readPriv, &gc->hreadwnd);
- if (gc->hreadDC == NULL)
+ if ((gc->base.readPriv != NULL) && (gc->base.readPriv != gc->base.drawPriv)) {
+ // XXX: should only occur with WGL_ARB_make_current_read
+ /*
+ If there is a separate read drawable, create a separate read DC, and
+ use the wglMakeContextCurrent extension to make the context current drawing
+ to one DC and reading from the other
+ */
+ gc->hreadDC = glxWinMakeDC(gc, (__GLXWinDrawable *)gc->base.readPriv, &gc->hreadwnd);
+ if (gc->hreadDC == NULL)
{
- ErrorF("glxWinMakeDC failed for readDC\n");
- drawPriv->drawContext = NULL; /* clear last active context because we return error */
- return FALSE;
+ ErrorF("glxWinMakeDC failed for readDC\n");
+ drawPriv->drawContext = NULL; /* clear last active context because we return error */
+ return FALSE;
}
- ret = wglMakeContextCurrentARBWrapper(gc->hDC, gc->hreadDC, gc->ctx);
- if (!ret)
- {
- ErrorF("wglMakeContextCurrentARBWrapper error: %s\n", glxWinErrorMessage());
+ ret = wglMakeContextCurrentARBWrapper(gc->hDC, gc->hreadDC, gc->ctx);
+ if (!ret) {
+ ErrorF("wglMakeContextCurrentARBWrapper error: %s\n",
+ glxWinErrorMessage());
}
}
- else
- {
- /* Otherwise, just use wglMakeCurrent */
+ else {
+ /* Otherwise, just use wglMakeCurrent */
if (!gc->hDC)
{
/* It probably has been release by loseCurrent, so create it again */
gc->hDC = glxWinMakeDC(gc, drawPriv, &gc->hwnd);
}
ret = wglMakeCurrent(gc->hDC, gc->ctx);
- if (!ret)
- {
+ if (!ret) {
DWORD ErrorCode=GetLastError();
ErrorF("wglMakeCurrent error: %x dc %p ctx %p\n", ErrorCode,gc->hDC,gc->ctx);
if (!ErrorCode)
@@ -1668,128 +1669,125 @@ glxWinContextMakeCurrent(__GLXcontext *base)
}
}
- // apparently make current could fail if the context is current in a different thread,
- // but that shouldn't be able to happen in the current server...
- if (!ret)
- drawPriv->drawContext = NULL; /* clear last active context because we return error */
+ // apparently make current could fail if the context is current in a different thread,
+ // but that shouldn't be able to happen in the current server...
+ if (!ret)
+ drawPriv->drawContext = NULL; /* clear last active context because we return error */
- return ret;
+ return ret;
}
static int
-glxWinContextLoseCurrent(__GLXcontext *base)
+glxWinContextLoseCurrent(__GLXcontext * base)
{
- BOOL ret=TRUE;
- __GLXWinContext *gc = (__GLXWinContext *)base;
- __GLXWinDrawable *drawPriv = (__GLXWinDrawable *)gc->base.drawPriv;
+ BOOL ret=TRUE;
+ __GLXWinContext *gc = (__GLXWinContext *) base;
+ __GLXWinDrawable *drawPriv = (__GLXWinDrawable *)gc->base.drawPriv;
#ifdef _DEBUG
- GLWIN_TRACE_MSG("glxWinContextLoseCurrent context %p (native ctx %p)", gc, gc->ctx);
- glWinCallDelta();
+ GLWIN_TRACE_MSG("glxWinContextLoseCurrent context %p (native ctx %p)", gc, gc->ctx);
+ glWinCallDelta();
#endif
- /* Clear the last active context in the drawable */
- if (drawPriv) drawPriv->drawContext = NULL;
+ /* Clear the last active context in the drawable */
+ if (drawPriv) drawPriv->drawContext = NULL;
- if (wglGetCurrentContext()==gc->ctx)
- {
- /* Only do this when we are sure we are currently the active, otherwise we are deactivating the wrong one (this is happening!!!) */
- ret = wglMakeCurrent(NULL, NULL);
- if (!ret)
- ErrorF("glxWinContextLoseCurrent error: %s\n", glxWinErrorMessage());
- }
- else
- {
- return FALSE;
- }
+ if (wglGetCurrentContext()==gc->ctx)
+ {
+ /* Only do this when we are sure we are currently the active, otherwise we are deactivating the wrong one (this is happening!!!) */
+ ret = wglMakeCurrent(NULL, NULL);
+ if (!ret)
+ ErrorF("glxWinContextLoseCurrent error: %s\n", glxWinErrorMessage());
+ }
+ else
+ {
+ return FALSE;
+ }
- base->isCurrent=FALSE; /* It looks like glx is not doing this */
- _glapi_set_dispatch(NULL);
+ base->isCurrent=FALSE; /* It looks like glx is not doing this */
+ _glapi_set_dispatch(NULL);
- return ret;
+ return ret;
}
static int
-glxWinContextCopy(__GLXcontext *dst_base, __GLXcontext *src_base, unsigned long mask)
+glxWinContextCopy(__GLXcontext * dst_base, __GLXcontext * src_base,
+ unsigned long mask)
{
- __GLXWinContext *dst = (__GLXWinContext *)dst_base;
- __GLXWinContext *src = (__GLXWinContext *)src_base;
- BOOL ret;
+ __GLXWinContext *dst = (__GLXWinContext *) dst_base;
+ __GLXWinContext *src = (__GLXWinContext *) src_base;
+ BOOL ret;
- GLWIN_DEBUG_MSG("glxWinContextCopy");
+ GLWIN_DEBUG_MSG("glxWinContextCopy");
- ret = wglCopyContext(src->ctx, dst->ctx, mask);
- if (!ret)
- {
- ErrorF("wglCopyContext error: %s\n", glxWinErrorMessage());
+ ret = wglCopyContext(src->ctx, dst->ctx, mask);
+ if (!ret) {
+ ErrorF("wglCopyContext error: %s\n", glxWinErrorMessage());
}
- return ret;
+ return ret;
}
static void
-glxWinContextDestroy(__GLXcontext *base)
+glxWinContextDestroy(__GLXcontext * base)
{
- __GLXWinContext *gc = (__GLXWinContext *)base;
+ __GLXWinContext *gc = (__GLXWinContext *) base;
- if (gc != NULL)
- {
+ if (gc != NULL) {
__GLXWinDrawable *drawPriv = (__GLXWinDrawable *)gc->base.drawPriv;
- GLWIN_DEBUG_MSG("GLXcontext %p destroyed (native ctx %p)", base, gc->ctx);
+ GLWIN_DEBUG_MSG("GLXcontext %p destroyed (native ctx %p)", base,
+ gc->ctx);
- if (gc->ctx)
- {
- BOOL ret;
- /* It's bad style to delete the context while it's still current */
- if (wglGetCurrentContext() == gc->ctx)
- {
- wglMakeCurrent(NULL, NULL);
- }
+ if (gc->ctx) {
+ BOOL ret;
+ /* It's bad style to delete the context while it's still current */
+ if (wglGetCurrentContext() == gc->ctx) {
+ wglMakeCurrent(NULL, NULL);
+ }
+
+ ret = wglDeleteContext(gc->ctx);
- ret = wglDeleteContext(gc->ctx);
- if (!ret)
- ErrorF("wglDeleteContext error: %s\n", glxWinErrorMessage());
- if (drawPriv && gc->hDC) glxWinReleaseDC(gc->hwnd, gc->hDC, drawPriv);
- if (gc->base.readPriv && gc->hreadDC) glxWinReleaseDC(gc->hreadwnd, gc->hreadDC, (__GLXWinDrawable *)gc->base.readPriv);
- gc->hDC=NULL;
- gc->hreadDC=NULL;
- gc->ctx = NULL;
+ if (!ret)
+ ErrorF("wglDeleteContext error: %s\n", glxWinErrorMessage());
+ if (drawPriv && gc->hDC) glxWinReleaseDC(gc->hwnd, gc->hDC, drawPriv);
+ if (gc->base.readPriv && gc->hreadDC) glxWinReleaseDC(gc->hreadwnd, gc->hreadDC, (__GLXWinDrawable *)gc->base.readPriv);
+ gc->hDC=NULL;
+ gc->hreadDC=NULL;
+ gc->ctx = NULL;
}
- /* Clear the last active context in the drawable */
- if (drawPriv) drawPriv->drawContext = NULL;
+ /* Clear the last active context in the drawable */
+ if (drawPriv) drawPriv->drawContext = NULL;
- free(gc->Dispatch);
- free(gc);
- _glapi_set_dispatch(NULL);
+ free(gc->Dispatch);
+ free(gc);
+ _glapi_set_dispatch(NULL);
}
}
static __GLXcontext *
-glxWinCreateContext(__GLXscreen *screen,
- __GLXconfig *modes,
- __GLXcontext *baseShareContext)
+glxWinCreateContext(__GLXscreen * screen,
+ __GLXconfig * modes, __GLXcontext * baseShareContext)
{
__GLXWinContext *context;
- __GLXWinContext *shareContext = (__GLXWinContext *)baseShareContext;
+ __GLXWinContext *shareContext = (__GLXWinContext *) baseShareContext;
- static __GLXtextureFromPixmap glxWinTextureFromPixmap =
- {
+ static __GLXtextureFromPixmap glxWinTextureFromPixmap = {
glxWinBindTexImage,
glxWinReleaseTexImage
- };
+ };
- context = (__GLXWinContext *)calloc(1, sizeof(__GLXWinContext));
+ context = (__GLXWinContext *) calloc(1, sizeof(__GLXWinContext));
if (!context)
return NULL;
memset(context, 0, sizeof *context);
- context->base.destroy = glxWinContextDestroy;
- context->base.makeCurrent = glxWinContextMakeCurrent;
- context->base.loseCurrent = glxWinContextLoseCurrent;
- context->base.copy = glxWinContextCopy;
+ context->base.destroy = glxWinContextDestroy;
+ context->base.makeCurrent = glxWinContextMakeCurrent;
+ context->base.loseCurrent = glxWinContextLoseCurrent;
+ context->base.copy = glxWinContextCopy;
context->base.textureFromPixmap = &glxWinTextureFromPixmap;
context->base.config = modes;
context->base.pGlxScreen = screen;
@@ -1825,32 +1823,33 @@ static int GetShift(int Mask)
}
static int
-fbConfigToPixelFormat(__GLXconfig *mode, PIXELFORMATDESCRIPTOR *pfdret, int drawableTypeOverride)
+fbConfigToPixelFormat(__GLXconfig * mode, PIXELFORMATDESCRIPTOR * pfdret,
+ int drawableTypeOverride)
{
PIXELFORMATDESCRIPTOR pfd = {
- sizeof(PIXELFORMATDESCRIPTOR), /* size of this pfd */
- 1, /* version number */
- PFD_SUPPORT_OPENGL, /* support OpenGL */
- PFD_TYPE_RGBA, /* RGBA type */
- 24, /* 24-bit color depth */
- 0, 0, 0, 0, 0, 0, /* color bits ignored */
- 0, /* no alpha buffer */
- 0, /* shift bit ignored */
- 0, /* no accumulation buffer */
- 0, 0, 0, 0, /* accum bits ignored */
- 32, /* 32-bit z-buffer */
- 0, /* no stencil buffer */
- 0, /* no auxiliary buffer */
- PFD_MAIN_PLANE, /* main layer */
- 0, /* reserved */
- 0, 0, 0 /* layer masks ignored */
+ sizeof(PIXELFORMATDESCRIPTOR), /* size of this pfd */
+ 1, /* version number */
+ PFD_SUPPORT_OPENGL, /* support OpenGL */
+ PFD_TYPE_RGBA, /* RGBA type */
+ 24, /* 24-bit color depth */
+ 0, 0, 0, 0, 0, 0, /* color bits ignored */
+ 0, /* no alpha buffer */
+ 0, /* shift bit ignored */
+ 0, /* no accumulation buffer */
+ 0, 0, 0, 0, /* accum bits ignored */
+ 32, /* 32-bit z-buffer */
+ 0, /* no stencil buffer */
+ 0, /* no auxiliary buffer */
+ PFD_MAIN_PLANE, /* main layer */
+ 0, /* reserved */
+ 0, 0, 0 /* layer masks ignored */
};
if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT)
- pfd.dwFlags |= PFD_DRAW_TO_WINDOW; /* support window */
+ pfd.dwFlags |= PFD_DRAW_TO_WINDOW; /* support window */
if ((mode->drawableType | drawableTypeOverride) & GLX_PIXMAP_BIT)
- pfd.dwFlags |= (PFD_DRAW_TO_BITMAP | PFD_SUPPORT_GDI); /* supports software rendering to bitmap */
+ pfd.dwFlags |= (PFD_DRAW_TO_BITMAP | PFD_SUPPORT_GDI); /* supports software rendering to bitmap */
if (mode->stereoMode) {
pfd.dwFlags |= PFD_STEREO;
@@ -1880,7 +1879,9 @@ fbConfigToPixelFormat(__GLXconfig *mode, PIXELFORMATDESCRIPTOR *pfdret, int draw
pfd.dwVisibleMask = mode->transparentIndex;
}
- pfd.cAccumBits = mode->accumRedBits + mode->accumGreenBits + mode->accumBlueBits + mode->accumAlphaBits;
+ pfd.cAccumBits =
+ mode->accumRedBits + mode->accumGreenBits + mode->accumBlueBits +
+ mode->accumAlphaBits;
pfd.cAccumRedBits = mode->accumRedBits;
pfd.cAccumGreenBits = mode->accumGreenBits;
pfd.cAccumBlueBits = mode->accumBlueBits;
@@ -1901,94 +1902,98 @@ fbConfigToPixelFormat(__GLXconfig *mode, PIXELFORMATDESCRIPTOR *pfdret, int draw
#define SET_ATTR_VALUE(attr, value) { attribList[i++] = attr; attribList[i++] = value; assert(i < NUM_ELEMENTS(attribList)); }
static int
-fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig *mode, int drawableTypeOverride, glxWinScreen *winScreen)
+fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode,
+ int drawableTypeOverride, glxWinScreen * winScreen)
{
- UINT numFormats;
- unsigned int i = 0;
-
- /* convert fbConfig to attr-value list */
- int attribList[60];
-
- SET_ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, TRUE);
- SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, (mode->visualType == GLX_TRUE_COLOR) ? WGL_TYPE_RGBA_ARB : WGL_TYPE_COLORINDEX_ARB);
- SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, (mode->visualType == GLX_TRUE_COLOR) ? mode->rgbBits : mode->indexBits);
- SET_ATTR_VALUE(WGL_RED_BITS_ARB, mode->redBits);
- SET_ATTR_VALUE(WGL_GREEN_BITS_ARB, mode->greenBits);
- SET_ATTR_VALUE(WGL_BLUE_BITS_ARB, mode->blueBits);
- SET_ATTR_VALUE(WGL_ALPHA_BITS_ARB, mode->alphaBits);
- SET_ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, mode->accumRedBits);
- SET_ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, mode->accumGreenBits);
- SET_ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, mode->accumBlueBits);
- SET_ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, mode->accumAlphaBits);
- SET_ATTR_VALUE(WGL_DEPTH_BITS_ARB, mode->depthBits);
- SET_ATTR_VALUE(WGL_STENCIL_BITS_ARB, mode->stencilBits);
- SET_ATTR_VALUE(WGL_AUX_BUFFERS_ARB, mode->numAuxBuffers);
-
- if (mode->doubleBufferMode)
- SET_ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, TRUE);
-
- if (mode->stereoMode)
- SET_ATTR_VALUE(WGL_STEREO_ARB, TRUE);
-
- // Some attributes are only added to the list if the value requested is not 'don't care', as exactly matching that is daft..
- if (mode->swapMethod == GLX_SWAP_EXCHANGE_OML)
- SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_EXCHANGE_ARB);
-
- if (mode->swapMethod == GLX_SWAP_COPY_OML)
- SET_ATTR_VALUE(WGL_SWAP_COPY_ARB, TRUE);
-
- // XXX: this should probably be the other way around, but that messes up drawableTypeOverride
- if (mode->visualRating == GLX_SLOW_VISUAL_EXT)
- SET_ATTR_VALUE(WGL_ACCELERATION_ARB, WGL_NO_ACCELERATION_ARB);
-
- // must support all the drawable types the mode supports
- if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT)
- SET_ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB,TRUE);
-
- // XXX: this is a horrible hacky heuristic, in fact this whole drawableTypeOverride thing is a bad idea
- // try to avoid asking for formats which don't exist (by not asking for all when adjusting the config to include the drawableTypeOverride)
- if (drawableTypeOverride == GLX_WINDOW_BIT)
- {
- if (mode->drawableType & GLX_PIXMAP_BIT)
- SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
+ UINT numFormats;
+ unsigned int i = 0;
+
+ /* convert fbConfig to attr-value list */
+ int attribList[60];
+
+ SET_ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, TRUE);
+ SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB,
+ (mode->visualType ==
+ GLX_TRUE_COLOR) ? WGL_TYPE_RGBA_ARB :
+ WGL_TYPE_COLORINDEX_ARB);
+ SET_ATTR_VALUE(WGL_COLOR_BITS_ARB,
+ (mode->visualType ==
+ GLX_TRUE_COLOR) ? mode->rgbBits : mode->indexBits);
+ SET_ATTR_VALUE(WGL_RED_BITS_ARB, mode->redBits);
+ SET_ATTR_VALUE(WGL_GREEN_BITS_ARB, mode->greenBits);
+ SET_ATTR_VALUE(WGL_BLUE_BITS_ARB, mode->blueBits);
+ SET_ATTR_VALUE(WGL_ALPHA_BITS_ARB, mode->alphaBits);
+ SET_ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, mode->accumRedBits);
+ SET_ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, mode->accumGreenBits);
+ SET_ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, mode->accumBlueBits);
+ SET_ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, mode->accumAlphaBits);
+ SET_ATTR_VALUE(WGL_DEPTH_BITS_ARB, mode->depthBits);
+ SET_ATTR_VALUE(WGL_STENCIL_BITS_ARB, mode->stencilBits);
+ SET_ATTR_VALUE(WGL_AUX_BUFFERS_ARB, mode->numAuxBuffers);
+
+ if (mode->doubleBufferMode)
+ SET_ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, TRUE);
+
+ if (mode->stereoMode)
+ SET_ATTR_VALUE(WGL_STEREO_ARB, TRUE);
+
+ // Some attributes are only added to the list if the value requested is not 'don't care', as exactly matching that is daft..
+ if (mode->swapMethod == GLX_SWAP_EXCHANGE_OML)
+ SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_EXCHANGE_ARB);
+
+ if (mode->swapMethod == GLX_SWAP_COPY_OML)
+ SET_ATTR_VALUE(WGL_SWAP_COPY_ARB, TRUE);
+
+ // XXX: this should probably be the other way around, but that messes up drawableTypeOverride
+ if (mode->visualRating == GLX_SLOW_VISUAL_EXT)
+ SET_ATTR_VALUE(WGL_ACCELERATION_ARB, WGL_NO_ACCELERATION_ARB);
+
+ // must support all the drawable types the mode supports
+ if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT)
+ SET_ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, TRUE);
+
+ // XXX: this is a horrible hacky heuristic, in fact this whole drawableTypeOverride thing is a bad idea
+ // try to avoid asking for formats which don't exist (by not asking for all when adjusting the config to include the drawableTypeOverride)
+ if (drawableTypeOverride == GLX_WINDOW_BIT) {
+ if (mode->drawableType & GLX_PIXMAP_BIT)
+ SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
- if (mode->drawableType & GLX_PBUFFER_BIT)
- if (winScreen->has_WGL_ARB_pbuffer)
- SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
+ if (mode->drawableType & GLX_PBUFFER_BIT)
+ if (winScreen->has_WGL_ARB_pbuffer)
+ SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
}
- else
- {
- if (drawableTypeOverride & GLX_PIXMAP_BIT)
- SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
+ else {
+ if (drawableTypeOverride & GLX_PIXMAP_BIT)
+ SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
- if (drawableTypeOverride & GLX_PBUFFER_BIT)
- if (winScreen->has_WGL_ARB_pbuffer)
- SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
+ if (drawableTypeOverride & GLX_PBUFFER_BIT)
+ if (winScreen->has_WGL_ARB_pbuffer)
+ SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
}
- SET_ATTR_VALUE(0, 0); // terminator
+ SET_ATTR_VALUE(0, 0); // terminator
- /* choose the first match */
- {
- int pixelFormatIndex;
+ /* choose the first match */
+ {
+ int pixelFormatIndex;
- if (!wglChoosePixelFormatARBWrapper(hdc, attribList, NULL, 1, &pixelFormatIndex, &numFormats))
- {
- ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
- }
- else
- {
- if (numFormats > 0)
- {
- GLWIN_DEBUG_MSG("wglChoosePixelFormat: chose pixelFormatIndex %d)", pixelFormatIndex);
- return pixelFormatIndex;
- }
- else
- ErrorF("wglChoosePixelFormat couldn't decide\n");
- }
- }
+ if (!wglChoosePixelFormatARBWrapper
+ (hdc, attribList, NULL, 1, &pixelFormatIndex, &numFormats)) {
+ ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
+ }
+ else {
+ if (numFormats > 0) {
+ GLWIN_DEBUG_MSG
+ ("wglChoosePixelFormat: chose pixelFormatIndex %d)",
+ pixelFormatIndex);
+ return pixelFormatIndex;
+ }
+ else
+ ErrorF("wglChoosePixelFormat couldn't decide\n");
+ }
+ }
- return 0;
+ return 0;
}
/* ---------------------------------------------------------------------- */
@@ -1999,119 +2004,121 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig *mode, int drawableTypeOverride,
// Create the GLXconfigs using DescribePixelFormat()
//
static void
-glxWinCreateConfigs(HDC hdc, glxWinScreen *screen)
+glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)
{
- GLXWinConfig *c, *result, *prev = NULL;
- int numConfigs = 0;
- int i = 0;
- int n = 0;
- PIXELFORMATDESCRIPTOR pfd;
+ GLXWinConfig *c, *result, *prev = NULL;
+ int numConfigs = 0;
+ int i = 0;
+ int n = 0;
+ PIXELFORMATDESCRIPTOR pfd;
- GLWIN_DEBUG_MSG("glxWinCreateConfigs");
+ GLWIN_DEBUG_MSG("glxWinCreateConfigs");
- screen->base.numFBConfigs = 0;
- screen->base.fbconfigs = NULL;
+ screen->base.numFBConfigs = 0;
+ screen->base.fbconfigs = NULL;
- // get the number of pixelformats
- numConfigs = DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL);
- GLWIN_DEBUG_MSG("DescribePixelFormat says %d possible pixel formats", numConfigs);
+ // get the number of pixelformats
+ numConfigs =
+ DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL);
+ GLWIN_DEBUG_MSG("DescribePixelFormat says %d possible pixel formats",
+ numConfigs);
- /* alloc */
- result = malloc(sizeof(GLXWinConfig) * numConfigs);
+ /* alloc */
+ result = malloc(sizeof(GLXWinConfig) * numConfigs);
- if (NULL == result)
- {
- return;
+ if (NULL == result) {
+ return;
}
- memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
- n = 0;
+ memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
+ n = 0;
- /* fill in configs */
- for (i = 0; i < numConfigs; i++)
- {
- int rc;
+ /* fill in configs */
+ for (i = 0; i < numConfigs; i++) {
+ int rc;
- c = &(result[i]);
- c->base.next = NULL;
- c->pixelFormatIndex = i+1;
+ c = &(result[i]);
+ c->base.next = NULL;
+ c->pixelFormatIndex = i + 1;
- rc = DescribePixelFormat(hdc, i+1, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ rc = DescribePixelFormat(hdc, i + 1, sizeof(PIXELFORMATDESCRIPTOR),
+ &pfd);
- if (!rc)
- {
- ErrorF("DescribePixelFormat failed for index %d, error %s\n", i+1, glxWinErrorMessage());
- break;
+ if (!rc) {
+ ErrorF("DescribePixelFormat failed for index %d, error %s\n", i + 1,
+ glxWinErrorMessage());
+ break;
}
#ifdef _DEBUG
- if (glxWinDebugSettings.dumpPFD)
- pfdOut(&pfd);
+ if (glxWinDebugSettings.dumpPFD)
+ pfdOut(&pfd);
#endif
- if (!(pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP)) || !(pfd.dwFlags & PFD_SUPPORT_OPENGL))
- {
- GLWIN_DEBUG_MSG("pixelFormat %d has unsuitable flags 0x%08lx, skipping", i+1, pfd.dwFlags);
- continue;
+ if (!(pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP)) ||
+ !(pfd.dwFlags & PFD_SUPPORT_OPENGL)) {
+ GLWIN_DEBUG_MSG
+ ("pixelFormat %d has unsuitable flags 0x%08lx, skipping", i + 1,
+ pfd.dwFlags);
+ continue;
}
- c->base.doubleBufferMode = (pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE;
- c->base.stereoMode = (pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE;
+ c->base.doubleBufferMode =
+ (pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE;
+ c->base.stereoMode = (pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE;
- c->base.redBits = pfd.cRedBits;
- c->base.greenBits = pfd.cGreenBits;
- c->base.blueBits = pfd.cBlueBits;
- c->base.alphaBits = pfd.cAlphaBits;
+ c->base.redBits = pfd.cRedBits;
+ c->base.greenBits = pfd.cGreenBits;
+ c->base.blueBits = pfd.cBlueBits;
+ c->base.alphaBits = pfd.cAlphaBits;
- c->base.redMask = BITS_AND_SHIFT_TO_MASK(pfd.cRedBits, pfd.cRedShift);
- c->base.greenMask = BITS_AND_SHIFT_TO_MASK(pfd.cGreenBits, pfd.cGreenShift);
- c->base.blueMask = BITS_AND_SHIFT_TO_MASK(pfd.cBlueBits, pfd.cBlueShift);
- c->base.alphaMask = BITS_AND_SHIFT_TO_MASK(pfd.cAlphaBits, pfd.cAlphaShift);
+ c->base.redMask = BITS_AND_SHIFT_TO_MASK(pfd.cRedBits, pfd.cRedShift);
+ c->base.greenMask =
+ BITS_AND_SHIFT_TO_MASK(pfd.cGreenBits, pfd.cGreenShift);
+ c->base.blueMask =
+ BITS_AND_SHIFT_TO_MASK(pfd.cBlueBits, pfd.cBlueShift);
+ c->base.alphaMask =
+ BITS_AND_SHIFT_TO_MASK(pfd.cAlphaBits, pfd.cAlphaShift);
- c->base.rgbBits = pfd.cColorBits;
+ c->base.rgbBits = pfd.cColorBits;
- if (pfd.iPixelType == PFD_TYPE_COLORINDEX)
- {
- c->base.indexBits = pfd.cColorBits;
+ if (pfd.iPixelType == PFD_TYPE_COLORINDEX) {
+ c->base.indexBits = pfd.cColorBits;
}
- else
- {
- c->base.indexBits = 0;
+ else {
+ c->base.indexBits = 0;
}
- c->base.accumRedBits = pfd.cAccumRedBits;
- c->base.accumGreenBits = pfd.cAccumGreenBits;
- c->base.accumBlueBits = pfd.cAccumBlueBits;
- c->base.accumAlphaBits = pfd.cAccumAlphaBits;
- // pfd.cAccumBits;
+ c->base.accumRedBits = pfd.cAccumRedBits;
+ c->base.accumGreenBits = pfd.cAccumGreenBits;
+ c->base.accumBlueBits = pfd.cAccumBlueBits;
+ c->base.accumAlphaBits = pfd.cAccumAlphaBits;
+ // pfd.cAccumBits;
- c->base.depthBits = pfd.cDepthBits;
- c->base.stencilBits = pfd.cStencilBits;
- c->base.numAuxBuffers = pfd.cAuxBuffers;
+ c->base.depthBits = pfd.cDepthBits;
+ c->base.stencilBits = pfd.cStencilBits;
+ c->base.numAuxBuffers = pfd.cAuxBuffers;
- // pfd.iLayerType; // ignored
- c->base.level = 0;
- // pfd.dwLayerMask; // ignored
- // pfd.dwDamageMask; // ignored
+ // pfd.iLayerType; // ignored
+ c->base.level = 0;
+ // pfd.dwLayerMask; // ignored
+ // pfd.dwDamageMask; // ignored
- c->base.pixmapMode = 0;
- c->base.visualID = -1; // will be set by __glXScreenInit()
+ c->base.pixmapMode = 0;
+ c->base.visualID = -1; // will be set by __glXScreenInit()
- /* EXT_visual_rating / GLX 1.2 */
- if (pfd.dwFlags & PFD_GENERIC_FORMAT)
- {
- c->base.visualRating = GLX_SLOW_VISUAL_EXT;
+ /* EXT_visual_rating / GLX 1.2 */
+ if (pfd.dwFlags & PFD_GENERIC_FORMAT) {
+ c->base.visualRating = GLX_SLOW_VISUAL_EXT;
}
- else
- {
- // PFD_GENERIC_ACCELERATED is not considered, so this may be MCD or ICD acclerated...
- c->base.visualRating = GLX_NONE_EXT;
+ else {
+ // PFD_GENERIC_ACCELERATED is not considered, so this may be MCD or ICD acclerated...
+ c->base.visualRating = GLX_NONE_EXT;
}
- /* EXT_visual_info / GLX 1.2 */
- if (pfd.iPixelType == PFD_TYPE_COLORINDEX)
- {
- c->base.visualType = GLX_STATIC_COLOR;
+ /* EXT_visual_info / GLX 1.2 */
+ if (pfd.iPixelType == PFD_TYPE_COLORINDEX) {
+ c->base.visualType = GLX_STATIC_COLOR;
c->base.transparentRed = GLX_NONE;
c->base.transparentGreen = GLX_NONE;
c->base.transparentBlue = GLX_NONE;
@@ -2130,451 +2137,477 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen *screen)
c->base.transparentPixel = GLX_TRANSPARENT_RGB;
}
- /* ARB_multisample / SGIS_multisample */
- c->base.sampleBuffers = 0;
- c->base.samples = 0;
+ /* ARB_multisample / SGIS_multisample */
+ c->base.sampleBuffers = 0;
+ c->base.samples = 0;
- /* SGIX_fbconfig / GLX 1.3 */
- c->base.drawableType = (((pfd.dwFlags & PFD_DRAW_TO_WINDOW) ? GLX_WINDOW_BIT : 0)
- | ((pfd.dwFlags & PFD_DRAW_TO_BITMAP) ? GLX_PIXMAP_BIT : 0));
+ /* SGIX_fbconfig / GLX 1.3 */
+ c->base.drawableType =
+ (((pfd.dwFlags & PFD_DRAW_TO_WINDOW) ? GLX_WINDOW_BIT : 0)
+ | ((pfd.dwFlags & PFD_DRAW_TO_BITMAP) ? GLX_PIXMAP_BIT : 0));
- if (pfd.iPixelType == PFD_TYPE_COLORINDEX)
- {
- c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
+ if (pfd.iPixelType == PFD_TYPE_COLORINDEX) {
+ c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
}
- else
- {
- c->base.renderType = GLX_RGBA_BIT;
+ else {
+ c->base.renderType = GLX_RGBA_BIT;
}
- c->base.xRenderable = GL_TRUE;
- c->base.fbconfigID = -1; // will be set by __glXScreenInit()
+ c->base.xRenderable = GL_TRUE;
+ c->base.fbconfigID = -1; // will be set by __glXScreenInit()
- /* SGIX_pbuffer / GLX 1.3 */
- // XXX: How can we find these values out ???
- c->base.maxPbufferWidth = -1;
- c->base.maxPbufferHeight = -1;
- c->base.maxPbufferPixels = -1;
- c->base.optimalPbufferWidth = 0; // there is no optimal value
- c->base.optimalPbufferHeight = 0;
+ /* SGIX_pbuffer / GLX 1.3 */
+ // XXX: How can we find these values out ???
+ c->base.maxPbufferWidth = -1;
+ c->base.maxPbufferHeight = -1;
+ c->base.maxPbufferPixels = -1;
+ c->base.optimalPbufferWidth = 0; // there is no optimal value
+ c->base.optimalPbufferHeight = 0;
- /* SGIX_visual_select_group */
- // arrange for visuals with the best acceleration to be preferred in selection
- switch (pfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED))
- {
+ /* SGIX_visual_select_group */
+ // arrange for visuals with the best acceleration to be preferred in selection
+ switch (pfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED)) {
case 0:
- c->base.visualSelectGroup = 2;
- break;
+ c->base.visualSelectGroup = 2;
+ break;
case PFD_GENERIC_ACCELERATED:
- c->base.visualSelectGroup = 1;
- break;
+ c->base.visualSelectGroup = 1;
+ break;
case PFD_GENERIC_FORMAT:
- c->base.visualSelectGroup = 0;
- break;
+ c->base.visualSelectGroup = 0;
+ break;
default:
- ;
- // "can't happen"
+ ;
+ // "can't happen"
}
- /* OML_swap_method */
- if (pfd.dwFlags & PFD_SWAP_EXCHANGE)
- c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
- else if (pfd.dwFlags & PFD_SWAP_COPY)
- c->base.swapMethod = GLX_SWAP_COPY_OML;
- else
- c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
+ /* OML_swap_method */
+ if (pfd.dwFlags & PFD_SWAP_EXCHANGE)
+ c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
+ else if (pfd.dwFlags & PFD_SWAP_COPY)
+ c->base.swapMethod = GLX_SWAP_COPY_OML;
+ else
+ c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
- /* EXT_import_context */
- c->base.screen = screen->base.pScreen->myNum;
+ /* EXT_import_context */
+ c->base.screen = screen->base.pScreen->myNum;
- /* EXT_texture_from_pixmap */
- c->base.bindToTextureRgb = -1;
- c->base.bindToTextureRgba = -1;
- c->base.bindToMipmapTexture = -1;
- c->base.bindToTextureTargets = -1;
- c->base.yInverted = -1;
+ /* EXT_texture_from_pixmap */
+ c->base.bindToTextureRgb = -1;
+ c->base.bindToTextureRgba = -1;
+ c->base.bindToMipmapTexture = -1;
+ c->base.bindToTextureTargets = -1;
+ c->base.yInverted = -1;
- n++;
+ n++;
- // update previous config to point to this config
- if (prev)
- prev->base.next = &(c->base);
+ // update previous config to point to this config
+ if (prev)
+ prev->base.next = &(c->base);
- prev = c;
+ prev = c;
}
- GLWIN_DEBUG_MSG("found %d pixelFormats suitable for conversion to fbConfigs", n);
+ GLWIN_DEBUG_MSG
+ ("found %d pixelFormats suitable for conversion to fbConfigs", n);
- screen->base.numFBConfigs = n;
- screen->base.fbconfigs = &(result->base);
+ screen->base.numFBConfigs = n;
+ screen->base.fbconfigs = &(result->base);
}
// helper function to access an attribute value from an attribute value array by attribute
static
-int getAttrValue(const int attrs[], int values[], unsigned int num, int attr, int fallback)
+ int
+getAttrValue(const int attrs[], int values[], unsigned int num, int attr,
+ int fallback)
{
- unsigned int i;
- for (i = 0; i < num; i++)
- {
- if (attrs[i] == attr)
- {
- GLWIN_TRACE_MSG("getAttrValue attr 0x%x, value %d", attr, values[i]);
- return values[i];
+ unsigned int i;
+
+ for (i = 0; i < num; i++) {
+ if (attrs[i] == attr) {
+ GLWIN_TRACE_MSG("getAttrValue attr 0x%x, value %d", attr,
+ values[i]);
+ return values[i];
}
}
- ErrorF("getAttrValue failed to find attr 0x%x, using default value %d\n", attr, fallback);
- return fallback;
+ ErrorF("getAttrValue failed to find attr 0x%x, using default value %d\n",
+ attr, fallback);
+ return fallback;
}
//
// Create the GLXconfigs using wglGetPixelFormatAttribfvARB() extension
//
static void
-glxWinCreateConfigsExt(HDC hdc, glxWinScreen *screen)
+glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
{
- GLXWinConfig *c, *result, *prev = NULL;
- int i = 0;
- int n = 0;
+ GLXWinConfig *c, *result, *prev = NULL;
+ int i = 0;
+ int n = 0;
- const int attr = WGL_NUMBER_PIXEL_FORMATS_ARB;
- int numConfigs;
+ const int attr = WGL_NUMBER_PIXEL_FORMATS_ARB;
+ int numConfigs;
- int attrs[50];
- unsigned int num_attrs = 0;
+ int attrs[50];
+ unsigned int num_attrs = 0;
- GLWIN_DEBUG_MSG("glxWinCreateConfigsExt");
+ GLWIN_DEBUG_MSG("glxWinCreateConfigsExt");
- screen->base.numFBConfigs = 0;
- screen->base.fbconfigs = NULL;
+ screen->base.numFBConfigs = 0;
+ screen->base.fbconfigs = NULL;
- if (!wglGetPixelFormatAttribivARBWrapper(hdc, 0, 0, 1, &attr, &numConfigs))
- {
- ErrorF("wglGetPixelFormatAttribivARB failed for WGL_NUMBER_PIXEL_FORMATS_ARB: %s\n", glxWinErrorMessage());
- return;
+ if (!wglGetPixelFormatAttribivARBWrapper(hdc, 0, 0, 1, &attr, &numConfigs)) {
+ ErrorF
+ ("wglGetPixelFormatAttribivARB failed for WGL_NUMBER_PIXEL_FORMATS_ARB: %s\n",
+ glxWinErrorMessage());
+ return;
}
- GLWIN_DEBUG_MSG("wglGetPixelFormatAttribivARB says %d possible pixel formats", numConfigs);
+ GLWIN_DEBUG_MSG
+ ("wglGetPixelFormatAttribivARB says %d possible pixel formats",
+ numConfigs);
- /* alloc */
- result = malloc(sizeof(GLXWinConfig) * numConfigs);
+ /* alloc */
+ result = malloc(sizeof(GLXWinConfig) * numConfigs);
- if (NULL == result)
- {
- return;
+ if (NULL == result) {
+ return;
}
- memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
- n = 0;
+ memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
+ n = 0;
#define ADD_ATTR(a) { attrs[num_attrs++] = a; assert(num_attrs < NUM_ELEMENTS(attrs)); }
- ADD_ATTR(WGL_DRAW_TO_WINDOW_ARB);
- ADD_ATTR(WGL_DRAW_TO_BITMAP_ARB);
- ADD_ATTR(WGL_ACCELERATION_ARB);
- ADD_ATTR(WGL_SWAP_LAYER_BUFFERS_ARB);
- ADD_ATTR(WGL_NUMBER_OVERLAYS_ARB);
- ADD_ATTR(WGL_NUMBER_UNDERLAYS_ARB);
- ADD_ATTR(WGL_TRANSPARENT_ARB);
- ADD_ATTR(WGL_TRANSPARENT_RED_VALUE_ARB);
- ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
- ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
- ADD_ATTR(WGL_TRANSPARENT_ALPHA_VALUE_ARB);
- ADD_ATTR(WGL_SUPPORT_OPENGL_ARB);
- ADD_ATTR(WGL_DOUBLE_BUFFER_ARB);
- ADD_ATTR(WGL_STEREO_ARB);
- ADD_ATTR(WGL_PIXEL_TYPE_ARB);
- ADD_ATTR(WGL_COLOR_BITS_ARB);
- ADD_ATTR(WGL_RED_BITS_ARB);
- ADD_ATTR(WGL_RED_SHIFT_ARB);
- ADD_ATTR(WGL_GREEN_BITS_ARB);
- ADD_ATTR(WGL_GREEN_SHIFT_ARB);
- ADD_ATTR(WGL_BLUE_BITS_ARB);
- ADD_ATTR(WGL_BLUE_SHIFT_ARB);
- ADD_ATTR(WGL_ALPHA_BITS_ARB);
- ADD_ATTR(WGL_ALPHA_SHIFT_ARB);
- ADD_ATTR(WGL_ACCUM_RED_BITS_ARB);
- ADD_ATTR(WGL_ACCUM_GREEN_BITS_ARB);
- ADD_ATTR(WGL_ACCUM_BLUE_BITS_ARB);
- ADD_ATTR(WGL_ACCUM_ALPHA_BITS_ARB);
- ADD_ATTR(WGL_DEPTH_BITS_ARB);
- ADD_ATTR(WGL_STENCIL_BITS_ARB);
- ADD_ATTR(WGL_AUX_BUFFERS_ARB);
- ADD_ATTR(WGL_SWAP_METHOD_ARB);
-
- if (screen->has_WGL_ARB_multisample)
- {
- // we may not query these attrs if WGL_ARB_multisample is not offered
- ADD_ATTR(WGL_SAMPLE_BUFFERS_ARB);
- ADD_ATTR(WGL_SAMPLES_ARB);
+ ADD_ATTR(WGL_DRAW_TO_WINDOW_ARB);
+ ADD_ATTR(WGL_DRAW_TO_BITMAP_ARB);
+ ADD_ATTR(WGL_ACCELERATION_ARB);
+ ADD_ATTR(WGL_SWAP_LAYER_BUFFERS_ARB);
+ ADD_ATTR(WGL_NUMBER_OVERLAYS_ARB);
+ ADD_ATTR(WGL_NUMBER_UNDERLAYS_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_RED_VALUE_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_ALPHA_VALUE_ARB);
+ ADD_ATTR(WGL_SUPPORT_OPENGL_ARB);
+ ADD_ATTR(WGL_DOUBLE_BUFFER_ARB);
+ ADD_ATTR(WGL_STEREO_ARB);
+ ADD_ATTR(WGL_PIXEL_TYPE_ARB);
+ ADD_ATTR(WGL_COLOR_BITS_ARB);
+ ADD_ATTR(WGL_RED_BITS_ARB);
+ ADD_ATTR(WGL_RED_SHIFT_ARB);
+ ADD_ATTR(WGL_GREEN_BITS_ARB);
+ ADD_ATTR(WGL_GREEN_SHIFT_ARB);
+ ADD_ATTR(WGL_BLUE_BITS_ARB);
+ ADD_ATTR(WGL_BLUE_SHIFT_ARB);
+ ADD_ATTR(WGL_ALPHA_BITS_ARB);
+ ADD_ATTR(WGL_ALPHA_SHIFT_ARB);
+ ADD_ATTR(WGL_ACCUM_RED_BITS_ARB);
+ ADD_ATTR(WGL_ACCUM_GREEN_BITS_ARB);
+ ADD_ATTR(WGL_ACCUM_BLUE_BITS_ARB);
+ ADD_ATTR(WGL_ACCUM_ALPHA_BITS_ARB);
+ ADD_ATTR(WGL_DEPTH_BITS_ARB);
+ ADD_ATTR(WGL_STENCIL_BITS_ARB);
+ ADD_ATTR(WGL_AUX_BUFFERS_ARB);
+ ADD_ATTR(WGL_SWAP_METHOD_ARB);
+
+ if (screen->has_WGL_ARB_multisample) {
+ // we may not query these attrs if WGL_ARB_multisample is not offered
+ ADD_ATTR(WGL_SAMPLE_BUFFERS_ARB);
+ ADD_ATTR(WGL_SAMPLES_ARB);
}
- if (screen->has_WGL_ARB_render_texture)
- {
- // we may not query these attrs if WGL_ARB_render_texture is not offered
- ADD_ATTR(WGL_BIND_TO_TEXTURE_RGB_ARB);
- ADD_ATTR(WGL_BIND_TO_TEXTURE_RGBA_ARB);
+ if (screen->has_WGL_ARB_render_texture) {
+ // we may not query these attrs if WGL_ARB_render_texture is not offered
+ ADD_ATTR(WGL_BIND_TO_TEXTURE_RGB_ARB);
+ ADD_ATTR(WGL_BIND_TO_TEXTURE_RGBA_ARB);
}
- if (screen->has_WGL_ARB_pbuffer)
- {
- // we may not query these attrs if WGL_ARB_pbuffer is not offered
- ADD_ATTR(WGL_DRAW_TO_PBUFFER_ARB);
- ADD_ATTR(WGL_MAX_PBUFFER_PIXELS_ARB);
- ADD_ATTR(WGL_MAX_PBUFFER_WIDTH_ARB);
- ADD_ATTR(WGL_MAX_PBUFFER_HEIGHT_ARB);
+ if (screen->has_WGL_ARB_pbuffer) {
+ // we may not query these attrs if WGL_ARB_pbuffer is not offered
+ ADD_ATTR(WGL_DRAW_TO_PBUFFER_ARB);
+ ADD_ATTR(WGL_MAX_PBUFFER_PIXELS_ARB);
+ ADD_ATTR(WGL_MAX_PBUFFER_WIDTH_ARB);
+ ADD_ATTR(WGL_MAX_PBUFFER_HEIGHT_ARB);
}
- /* fill in configs */
- for (i = 0; i < numConfigs; i++)
- {
+ /* fill in configs */
+ for (i = 0; i < numConfigs; i++) {
int sizevalues=num_attrs*sizeof(int);
int *values=(int*)_alloca(sizevalues);
memset(values,0,sizevalues);
- c = &(result[i]);
- c->base.next = NULL;
- c->pixelFormatIndex = i+1;
+ c = &(result[i]);
+ c->base.next = NULL;
+ c->pixelFormatIndex = i + 1;
- if (!wglGetPixelFormatAttribivARBWrapper(hdc, i+1, 0, num_attrs, attrs, values))
- {
- ErrorF("wglGetPixelFormatAttribivARB failed for index %d, error %s\n", i+1, glxWinErrorMessage());
- break;
+ if (!wglGetPixelFormatAttribivARBWrapper
+ (hdc, i + 1, 0, num_attrs, attrs, values)) {
+ ErrorF
+ ("wglGetPixelFormatAttribivARB failed for index %d, error %s\n",
+ i + 1, glxWinErrorMessage());
+ break;
}
#define ATTR_VALUE(a, d) getAttrValue(attrs, values, num_attrs, (a), (d))
- if (!ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, 0))
- {
- GLWIN_DEBUG_MSG("pixelFormat %d isn't WGL_SUPPORT_OPENGL_ARB, skipping", i+1);
- continue;
+ if (!ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, 0)) {
+ GLWIN_DEBUG_MSG
+ ("pixelFormat %d isn't WGL_SUPPORT_OPENGL_ARB, skipping",
+ i + 1);
+ continue;
}
- c->base.doubleBufferMode = ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, 0) ? GL_TRUE : GL_FALSE;
- c->base.stereoMode = ATTR_VALUE(WGL_STEREO_ARB, 0) ? GL_TRUE : GL_FALSE;
-
- c->base.redBits = ATTR_VALUE(WGL_RED_BITS_ARB, 0);
- c->base.greenBits = ATTR_VALUE(WGL_GREEN_BITS_ARB, 0);
- c->base.blueBits = ATTR_VALUE(WGL_BLUE_BITS_ARB, 0);
- c->base.alphaBits = ATTR_VALUE(WGL_ALPHA_BITS_ARB, 0);
-
- c->base.redMask = BITS_AND_SHIFT_TO_MASK(c->base.redBits, ATTR_VALUE(WGL_RED_SHIFT_ARB, 0));
- c->base.greenMask = BITS_AND_SHIFT_TO_MASK(c->base.greenBits, ATTR_VALUE(WGL_GREEN_SHIFT_ARB, 0));
- c->base.blueMask = BITS_AND_SHIFT_TO_MASK(c->base.blueBits, ATTR_VALUE(WGL_BLUE_SHIFT_ARB, 0));
- c->base.alphaMask = BITS_AND_SHIFT_TO_MASK(c->base.alphaBits, ATTR_VALUE(WGL_ALPHA_SHIFT_ARB, 0));
-
- switch (ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0))
- {
+ c->base.doubleBufferMode =
+ ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, 0) ? GL_TRUE : GL_FALSE;
+ c->base.stereoMode = ATTR_VALUE(WGL_STEREO_ARB, 0) ? GL_TRUE : GL_FALSE;
+
+ c->base.redBits = ATTR_VALUE(WGL_RED_BITS_ARB, 0);
+ c->base.greenBits = ATTR_VALUE(WGL_GREEN_BITS_ARB, 0);
+ c->base.blueBits = ATTR_VALUE(WGL_BLUE_BITS_ARB, 0);
+ c->base.alphaBits = ATTR_VALUE(WGL_ALPHA_BITS_ARB, 0);
+
+ c->base.redMask =
+ BITS_AND_SHIFT_TO_MASK(c->base.redBits,
+ ATTR_VALUE(WGL_RED_SHIFT_ARB, 0));
+ c->base.greenMask =
+ BITS_AND_SHIFT_TO_MASK(c->base.greenBits,
+ ATTR_VALUE(WGL_GREEN_SHIFT_ARB, 0));
+ c->base.blueMask =
+ BITS_AND_SHIFT_TO_MASK(c->base.blueBits,
+ ATTR_VALUE(WGL_BLUE_SHIFT_ARB, 0));
+ c->base.alphaMask =
+ BITS_AND_SHIFT_TO_MASK(c->base.alphaBits,
+ ATTR_VALUE(WGL_ALPHA_SHIFT_ARB, 0));
+
+ switch (ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0)) {
case WGL_TYPE_COLORINDEX_ARB:
- c->base.indexBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
- c->base.rgbBits = 0;
- c->base.visualType = GLX_STATIC_COLOR;
- break;
+ c->base.indexBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
+ c->base.rgbBits = 0;
+ c->base.visualType = GLX_STATIC_COLOR;
+ break;
case WGL_TYPE_RGBA_FLOAT_ARB:
- GLWIN_DEBUG_MSG("pixelFormat %d is WGL_TYPE_RGBA_FLOAT_ARB, skipping", i+1);
- continue;
+ GLWIN_DEBUG_MSG
+ ("pixelFormat %d is WGL_TYPE_RGBA_FLOAT_ARB, skipping", i + 1);
+ continue;
case WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT:
- GLWIN_DEBUG_MSG("pixelFormat %d is WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT, skipping", i+1);
- continue;
+ GLWIN_DEBUG_MSG
+ ("pixelFormat %d is WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT, skipping",
+ i + 1);
+ continue;
case WGL_TYPE_RGBA_ARB:
- c->base.indexBits = 0;
- c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
- c->base.visualType = GLX_TRUE_COLOR;
- break;
+ c->base.indexBits = 0;
+ c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
+ c->base.visualType = GLX_TRUE_COLOR;
+ break;
default:
- ErrorF("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_PIXEL_TYPE_ARB\n", ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0));
- continue;
+ ErrorF
+ ("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_PIXEL_TYPE_ARB\n",
+ ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0));
+ continue;
}
- c->base.accumRedBits = ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, 0);
- c->base.accumGreenBits = ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, 0);
- c->base.accumBlueBits = ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, 0);
- c->base.accumAlphaBits = ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, 0);
-
- c->base.depthBits = ATTR_VALUE(WGL_DEPTH_BITS_ARB, 0);
- c->base.stencilBits = ATTR_VALUE(WGL_STENCIL_BITS_ARB, 0);
- c->base.numAuxBuffers = ATTR_VALUE(WGL_AUX_BUFFERS_ARB, 0);
+ c->base.accumRedBits = ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, 0);
+ c->base.accumGreenBits = ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, 0);
+ c->base.accumBlueBits = ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, 0);
+ c->base.accumAlphaBits = ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, 0);
- {
- int layers = ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB,0) + ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0);
+ c->base.depthBits = ATTR_VALUE(WGL_DEPTH_BITS_ARB, 0);
+ c->base.stencilBits = ATTR_VALUE(WGL_STENCIL_BITS_ARB, 0);
+ c->base.numAuxBuffers = ATTR_VALUE(WGL_AUX_BUFFERS_ARB, 0);
- if (layers > 0)
- {
- ErrorF("pixelFormat %d: has %d overlay, %d underlays which aren't currently handled", i, ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB,0), ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0));
- // XXX: need to iterate over layers?
- }
- }
- c->base.level = 0;
+ {
+ int layers =
+ ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB,
+ 0) + ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0);
+
+ if (layers > 0) {
+ ErrorF
+ ("pixelFormat %d: has %d overlay, %d underlays which aren't currently handled",
+ i, ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB, 0),
+ ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0));
+ // XXX: need to iterate over layers?
+ }
+ }
+ c->base.level = 0;
- c->base.pixmapMode = 0; // ???
- c->base.visualID = -1; // will be set by __glXScreenInit()
+ c->base.pixmapMode = 0; // ???
+ c->base.visualID = -1; // will be set by __glXScreenInit()
- /* EXT_visual_rating / GLX 1.2 */
- switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0))
- {
+ /* EXT_visual_rating / GLX 1.2 */
+ switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0)) {
default:
- ErrorF("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_ACCELERATION_ARB\n", ATTR_VALUE(WGL_ACCELERATION_ARB, 0));
+ ErrorF
+ ("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_ACCELERATION_ARB\n",
+ ATTR_VALUE(WGL_ACCELERATION_ARB, 0));
case WGL_NO_ACCELERATION_ARB:
- c->base.visualRating = GLX_SLOW_VISUAL_EXT;
- break;
+ c->base.visualRating = GLX_SLOW_VISUAL_EXT;
+ break;
case WGL_GENERIC_ACCELERATION_ARB:
case WGL_FULL_ACCELERATION_ARB:
- c->base.visualRating = GLX_NONE_EXT;
- break;
+ c->base.visualRating = GLX_NONE_EXT;
+ break;
}
- /* EXT_visual_info / GLX 1.2 */
- // c->base.visualType is set above
- if (ATTR_VALUE(WGL_TRANSPARENT_ARB, 0))
- {
- c->base.transparentPixel = (c->base.visualType == GLX_TRUE_COLOR) ? GLX_TRANSPARENT_RGB_EXT : GLX_TRANSPARENT_INDEX_EXT;
- c->base.transparentRed = ATTR_VALUE(WGL_TRANSPARENT_RED_VALUE_ARB, 0);
- c->base.transparentGreen = ATTR_VALUE(WGL_TRANSPARENT_GREEN_VALUE_ARB, 0);
- c->base.transparentBlue = ATTR_VALUE(WGL_TRANSPARENT_BLUE_VALUE_ARB, 0);
- c->base.transparentAlpha = ATTR_VALUE(WGL_TRANSPARENT_ALPHA_VALUE_ARB, 0);
- c->base.transparentIndex = ATTR_VALUE(WGL_TRANSPARENT_INDEX_VALUE_ARB, 0);
+ /* EXT_visual_info / GLX 1.2 */
+ // c->base.visualType is set above
+ if (ATTR_VALUE(WGL_TRANSPARENT_ARB, 0)) {
+ c->base.transparentPixel =
+ (c->base.visualType ==
+ GLX_TRUE_COLOR) ? GLX_TRANSPARENT_RGB_EXT :
+ GLX_TRANSPARENT_INDEX_EXT;
+ c->base.transparentRed =
+ ATTR_VALUE(WGL_TRANSPARENT_RED_VALUE_ARB, 0);
+ c->base.transparentGreen =
+ ATTR_VALUE(WGL_TRANSPARENT_GREEN_VALUE_ARB, 0);
+ c->base.transparentBlue =
+ ATTR_VALUE(WGL_TRANSPARENT_BLUE_VALUE_ARB, 0);
+ c->base.transparentAlpha =
+ ATTR_VALUE(WGL_TRANSPARENT_ALPHA_VALUE_ARB, 0);
+ c->base.transparentIndex =
+ ATTR_VALUE(WGL_TRANSPARENT_INDEX_VALUE_ARB, 0);
}
- else
- {
- c->base.transparentPixel = GLX_NONE_EXT;
- c->base.transparentRed = GLX_NONE;
- c->base.transparentGreen = GLX_NONE;
- c->base.transparentBlue = GLX_NONE;
- c->base.transparentAlpha = GLX_NONE;
- c->base.transparentIndex = GLX_NONE;
+ else {
+ c->base.transparentPixel = GLX_NONE_EXT;
+ c->base.transparentRed = GLX_NONE;
+ c->base.transparentGreen = GLX_NONE;
+ c->base.transparentBlue = GLX_NONE;
+ c->base.transparentAlpha = GLX_NONE;
+ c->base.transparentIndex = GLX_NONE;
}
- /* ARB_multisample / SGIS_multisample */
- if (screen->has_WGL_ARB_multisample)
- {
- c->base.sampleBuffers = ATTR_VALUE(WGL_SAMPLE_BUFFERS_ARB, 0);
- c->base.samples = ATTR_VALUE(WGL_SAMPLES_ARB, 0);
+ /* ARB_multisample / SGIS_multisample */
+ if (screen->has_WGL_ARB_multisample) {
+ c->base.sampleBuffers = ATTR_VALUE(WGL_SAMPLE_BUFFERS_ARB, 0);
+ c->base.samples = ATTR_VALUE(WGL_SAMPLES_ARB, 0);
}
- else
- {
- c->base.sampleBuffers = 0;
- c->base.samples = 0;
+ else {
+ c->base.sampleBuffers = 0;
+ c->base.samples = 0;
}
- /* SGIX_fbconfig / GLX 1.3 */
- c->base.drawableType = ((ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, 0) ? GLX_WINDOW_BIT : 0)
- | (ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, 0) ? GLX_PIXMAP_BIT : 0)
- | (ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, 0) ? GLX_PBUFFER_BIT : 0));
-
- /*
- Assume OpenGL RGBA rendering is available on all visuals
- (it is specified to render to red component in single-channel visuals,
- if supported, but there doesn't seem to be any mechanism to check if it
- is supported)
-
- Color index rendering is only supported on single-channel visuals
- */
- if (c->base.visualType == GLX_STATIC_COLOR)
- {
- c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
+ /* SGIX_fbconfig / GLX 1.3 */
+ c->base.drawableType =
+ ((ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, 0) ? GLX_WINDOW_BIT : 0)
+ | (ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, 0) ? GLX_PIXMAP_BIT : 0)
+ | (ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, 0) ? GLX_PBUFFER_BIT : 0));
+
+ /*
+ Assume OpenGL RGBA rendering is available on all visuals
+ (it is specified to render to red component in single-channel visuals,
+ if supported, but there doesn't seem to be any mechanism to check if it
+ is supported)
+
+ Color index rendering is only supported on single-channel visuals
+ */
+ if (c->base.visualType == GLX_STATIC_COLOR) {
+ c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
}
- else
- {
- c->base.renderType = GLX_RGBA_BIT;
+ else {
+ c->base.renderType = GLX_RGBA_BIT;
}
- c->base.xRenderable = GL_TRUE;
- c->base.fbconfigID = -1; // will be set by __glXScreenInit()
+ c->base.xRenderable = GL_TRUE;
+ c->base.fbconfigID = -1; // will be set by __glXScreenInit()
- /* SGIX_pbuffer / GLX 1.3 */
- if (screen->has_WGL_ARB_pbuffer)
- {
- c->base.maxPbufferWidth = ATTR_VALUE(WGL_MAX_PBUFFER_WIDTH_ARB, -1);
- c->base.maxPbufferHeight = ATTR_VALUE(WGL_MAX_PBUFFER_HEIGHT_ARB, -1);
- c->base.maxPbufferPixels = ATTR_VALUE(WGL_MAX_PBUFFER_PIXELS_ARB, -1);
+ /* SGIX_pbuffer / GLX 1.3 */
+ if (screen->has_WGL_ARB_pbuffer) {
+ c->base.maxPbufferWidth = ATTR_VALUE(WGL_MAX_PBUFFER_WIDTH_ARB, -1);
+ c->base.maxPbufferHeight =
+ ATTR_VALUE(WGL_MAX_PBUFFER_HEIGHT_ARB, -1);
+ c->base.maxPbufferPixels =
+ ATTR_VALUE(WGL_MAX_PBUFFER_PIXELS_ARB, -1);
}
- else
- {
- c->base.maxPbufferWidth = -1;
- c->base.maxPbufferHeight = -1;
- c->base.maxPbufferPixels = -1;
+ else {
+ c->base.maxPbufferWidth = -1;
+ c->base.maxPbufferHeight = -1;
+ c->base.maxPbufferPixels = -1;
}
- c->base.optimalPbufferWidth = 0; // there is no optimal value
- c->base.optimalPbufferHeight = 0;
+ c->base.optimalPbufferWidth = 0; // there is no optimal value
+ c->base.optimalPbufferHeight = 0;
- /* SGIX_visual_select_group */
- // arrange for visuals with the best acceleration to be preferred in selection
- switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0))
- {
+ /* SGIX_visual_select_group */
+ // arrange for visuals with the best acceleration to be preferred in selection
+ switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0)) {
case WGL_FULL_ACCELERATION_ARB:
- c->base.visualSelectGroup = 2;
- break;
+ c->base.visualSelectGroup = 2;
+ break;
case WGL_GENERIC_ACCELERATION_ARB:
- c->base.visualSelectGroup = 1;
- break;
+ c->base.visualSelectGroup = 1;
+ break;
default:
case WGL_NO_ACCELERATION_ARB:
- c->base.visualSelectGroup = 0;
- break;
+ c->base.visualSelectGroup = 0;
+ break;
}
- /* OML_swap_method */
- switch (ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0))
- {
+ /* OML_swap_method */
+ switch (ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0)) {
case WGL_SWAP_EXCHANGE_ARB:
- c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
- break;
+ c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
+ break;
case WGL_SWAP_COPY_ARB:
- c->base.swapMethod = GLX_SWAP_COPY_OML;
- break;
+ c->base.swapMethod = GLX_SWAP_COPY_OML;
+ break;
default:
- ErrorF("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_SWAP_METHOD_ARB\n", ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0));
+ ErrorF
+ ("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_SWAP_METHOD_ARB\n",
+ ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0));
case WGL_SWAP_UNDEFINED_ARB:
- c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
+ c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
}
- /* EXT_import_context */
- c->base.screen = screen->base.pScreen->myNum;
-
- /* EXT_texture_from_pixmap */
- /*
- Mesa's DRI configs always have bindToTextureRgb/Rgba TRUE (see driCreateConfigs(), so setting
- bindToTextureRgb/bindToTextureRgba to FALSE means that swrast can't find any fbConfigs to use,
- so setting these to 0, even if we know bindToTexture isn't available, isn't a good idea...
- */
- if (screen->has_WGL_ARB_render_texture)
- {
- c->base.bindToTextureRgb = ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGB_ARB, -1);
- c->base.bindToTextureRgba = ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGBA_ARB, -1);
+ /* EXT_import_context */
+ c->base.screen = screen->base.pScreen->myNum;
+
+ /* EXT_texture_from_pixmap */
+ /*
+ Mesa's DRI configs always have bindToTextureRgb/Rgba TRUE (see driCreateConfigs(), so setting
+ bindToTextureRgb/bindToTextureRgba to FALSE means that swrast can't find any fbConfigs to use,
+ so setting these to 0, even if we know bindToTexture isn't available, isn't a good idea...
+ */
+ if (screen->has_WGL_ARB_render_texture) {
+ c->base.bindToTextureRgb =
+ ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGB_ARB, -1);
+ c->base.bindToTextureRgba =
+ ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGBA_ARB, -1);
}
- else
- {
- c->base.bindToTextureRgb = -1;
- c->base.bindToTextureRgba = -1;
+ else {
+ c->base.bindToTextureRgb = -1;
+ c->base.bindToTextureRgba = -1;
}
- c->base.bindToMipmapTexture = -1;
- c->base.bindToTextureTargets = GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT | GLX_TEXTURE_RECTANGLE_BIT_EXT;
- c->base.yInverted = -1;
+ c->base.bindToMipmapTexture = -1;
+ c->base.bindToTextureTargets =
+ GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
+ GLX_TEXTURE_RECTANGLE_BIT_EXT;
+ c->base.yInverted = -1;
- n++;
+ n++;
- // update previous config to point to this config
- if (prev)
- prev->base.next = &(c->base);
+ // update previous config to point to this config
+ if (prev)
+ prev->base.next = &(c->base);
- prev = c;
+ prev = c;
}
- screen->base.numFBConfigs = n;
- screen->base.fbconfigs = &(result->base);
+ screen->base.numFBConfigs = n;
+ screen->base.fbconfigs = &(result->base);
}
diff --git a/xorg-server/hw/xwin/glx/wgl_ext_api.h b/xorg-server/hw/xwin/glx/wgl_ext_api.h
index 0edc6e6ed..63b1d7ef1 100644
--- a/xorg-server/hw/xwin/glx/wgl_ext_api.h
+++ b/xorg-server/hw/xwin/glx/wgl_ext_api.h
@@ -1,87 +1,83 @@
-/*
- * File: wgl_ext_api.h
- * Purpose: Wrapper functions for Win32 OpenGL wgl extension functions
- *
- * Authors: Jon TURNEY
- *
- * Copyright (c) Jon TURNEY 2009
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef wgl_ext_api_h
-#define wgl_ext_api_h
-
-#include "wglext.h"
-
-void wglResolveExtensionProcs(void);
-
-/*
- Prototypes for wrapper functions we actually use
- XXX: should be automatically generated as well
-*/
-
-const char * __stdcall wglGetExtensionsStringARBWrapper(HDC hdc);
-BOOL __stdcall wglMakeContextCurrentARBWrapper(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
-HDC __stdcall wglGetCurrentReadDCARBWrapper(VOID);
-
-BOOL __stdcall wglGetPixelFormatAttribivARBWrapper(HDC hdc,
- int iPixelFormat,
- int iLayerPlane,
- UINT nAttributes,
- const int *piAttributes,
- int *piValues);
-
-BOOL __stdcall wglGetPixelFormatAttribfvARBWrapper(HDC hdc,
- int iPixelFormat,
- int iLayerPlane,
- UINT nAttributes,
- const int *piAttributes,
- FLOAT *pfValues);
-
-BOOL __stdcall wglChoosePixelFormatARBWrapper(HDC hdc,
- const int *piAttribIList,
- const FLOAT *pfAttribFList,
- UINT nMaxFormats,
- int *piFormats,
- UINT *nNumFormats);
-
-HPBUFFERARB __stdcall wglCreatePbufferARBWrapper(HDC hDC,
- int iPixelFormat,
- int iWidth,
- int iHeight,
- const int *piAttribList);
-
-HDC __stdcall wglGetPbufferDCARBWrapper(HPBUFFERARB hPbuffer);
-
-int __stdcall wglReleasePbufferDCARBWrapper(HPBUFFERARB hPbuffer,
- HDC hDC);
-
-BOOL __stdcall wglDestroyPbufferARBWrapper(HPBUFFERARB hPbuffer);
-
-BOOL __stdcall wglQueryPbufferARBWrapper(HPBUFFERARB hPbuffer,
- int iAttribute,
- int *piValue);
-
-BOOL __stdcall wglSwapIntervalEXTWrapper(int interval);
-
-int __stdcall wglGetSwapIntervalEXTWrapper(void);
-
-#endif /* wgl_ext_api_h */
+/*
+ * File: wgl_ext_api.h
+ * Purpose: Wrapper functions for Win32 OpenGL wgl extension functions
+ *
+ * Authors: Jon TURNEY
+ *
+ * Copyright (c) Jon TURNEY 2009
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef wgl_ext_api_h
+#define wgl_ext_api_h
+
+#include "wglext.h"
+
+void wglResolveExtensionProcs(void);
+
+/*
+ Prototypes for wrapper functions we actually use
+ XXX: should be automatically generated as well
+*/
+
+const char * __stdcall wglGetExtensionsStringARBWrapper(HDC hdc);
+BOOL __stdcall wglMakeContextCurrentARBWrapper(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+HDC __stdcall wglGetCurrentReadDCARBWrapper(VOID);
+
+BOOL __stdcall wglGetPixelFormatAttribivARBWrapper(HDC hdc,
+ int iPixelFormat,
+ int iLayerPlane,
+ UINT nAttributes,
+ const int *piAttributes,
+ int *piValues);
+
+BOOL __stdcall wglGetPixelFormatAttribfvARBWrapper(HDC hdc,
+ int iPixelFormat,
+ int iLayerPlane,
+ UINT nAttributes,
+ const int *piAttributes,
+ FLOAT * pfValues);
+
+BOOL __stdcall wglChoosePixelFormatARBWrapper(HDC hdc,
+ const int *piAttribIList,
+ const FLOAT * pfAttribFList,
+ UINT nMaxFormats,
+ int *piFormats, UINT * nNumFormats);
+
+HPBUFFERARB __stdcall wglCreatePbufferARBWrapper(HDC hDC,
+ int iPixelFormat,
+ int iWidth,
+ int iHeight, const int *piAttribList);
+
+HDC __stdcall wglGetPbufferDCARBWrapper(HPBUFFERARB hPbuffer);
+
+int __stdcall wglReleasePbufferDCARBWrapper(HPBUFFERARB hPbuffer, HDC hDC);
+
+BOOL __stdcall wglDestroyPbufferARBWrapper(HPBUFFERARB hPbuffer);
+
+BOOL __stdcall wglQueryPbufferARBWrapper(HPBUFFERARB hPbuffer,
+ int iAttribute, int *piValue);
+
+BOOL __stdcall wglSwapIntervalEXTWrapper(int interval);
+
+int __stdcall wglGetSwapIntervalEXTWrapper(void);
+
+#endif /* wgl_ext_api_h */
diff --git a/xorg-server/hw/xwin/glx/winpriv.c b/xorg-server/hw/xwin/glx/winpriv.c
index 4badb5320..4f2bc21a8 100644
--- a/xorg-server/hw/xwin/glx/winpriv.c
+++ b/xorg-server/hw/xwin/glx/winpriv.c
@@ -14,26 +14,26 @@
extern Bool g_fXdmcpEnabled;
void
-winCreateWindowsWindow (WindowPtr pWin);
+ winCreateWindowsWindow(WindowPtr pWin);
+
/**
* Return size and handles of a window.
* If pWin is NULL, then the information for the root window is requested.
*/
-HWND winGetWindowInfo(WindowPtr pWin)
+HWND
+winGetWindowInfo(WindowPtr pWin)
{
HWND hwnd = NULL;
winDebug("%s:%d pWin %p XID 0x%x\n", __FUNCTION__, __LINE__, pWin, pWin->drawable.id);
/* a real window was requested */
- if (pWin != NULL)
- {
+ if (pWin != NULL) {
/* Get the window and screen privates */
ScreenPtr pScreen = pWin->drawable.pScreen;
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
winScreenInfoPtr pScreenInfo = NULL;
- if (pWinScreen == NULL)
- {
+ if (pWinScreen == NULL) {
ErrorF("winGetWindowInfo: screen has no privates\n");
return hwnd;
}
@@ -43,18 +43,15 @@ HWND winGetWindowInfo(WindowPtr pWin)
pScreenInfo = pWinScreen->pScreenInfo;
#ifdef XWIN_MULTIWINDOW
/* check for multiwindow mode */
- if (pScreenInfo->fMultiWindow)
- {
+ if (pScreenInfo->fMultiWindow) {
winWindowPriv(pWin);
- if (pWinPriv == NULL)
- {
+ if (pWinPriv == NULL) {
ErrorF("winGetWindowInfo: window has no privates\n");
return hwnd;
}
- if (pWinPriv->hWnd == NULL)
- {
+ if (pWinPriv->hWnd == NULL) {
if (pWin->parent && pWin->parent->parent)
{
int offsetx;
@@ -103,8 +100,7 @@ HWND winGetWindowInfo(WindowPtr pWin)
winDebug("winGetWindowInfo: forcing window to exist...\n");
}
}
- if (pWinPriv->hWnd != NULL)
- {
+ if (pWinPriv->hWnd != NULL) {
/* copy window handle */
hwnd = pWinPriv->hWnd;
}
@@ -157,30 +153,26 @@ HWND winGetWindowInfo(WindowPtr pWin)
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
/* check for multiwindow external wm mode */
- if (pScreenInfo->fMWExtWM)
- {
+ if (pScreenInfo->fMWExtWM) {
win32RootlessWindowPtr pRLWinPriv
- = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
+ = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
if (pRLWinPriv == NULL) {
ErrorF("winGetWindowInfo: window has no privates\n");
}
- if (pRLWinPriv->hWnd != NULL)
- {
+ if (pRLWinPriv->hWnd != NULL) {
/* copy window handle */
hwnd = pRLWinPriv->hWnd;
}
}
#endif
}
- else
- {
+ else {
ScreenPtr pScreen = g_ScreenInfo[0].pScreen;
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
- if (pWinScreen == NULL)
- {
+ if (pWinScreen == NULL) {
ErrorF("winGetWindowInfo: screen has no privates\n");
}
else
@@ -197,21 +189,21 @@ HWND winGetWindowInfo(WindowPtr pWin)
Bool
winCheckScreenAiglxIsSupported(ScreenPtr pScreen)
{
- winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
- winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo;
+ winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
+ winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo;
#ifdef XWIN_MULTIWINDOW
- if (pScreenInfo->fMultiWindow)
- return TRUE;
+ if (pScreenInfo->fMultiWindow)
+ return TRUE;
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- if (pScreenInfo->fMWExtWM)
- return TRUE;
+ if (pScreenInfo->fMWExtWM)
+ return TRUE;
#endif
if (g_fXdmcpEnabled)
return TRUE;
- return FALSE;
+ return FALSE;
}
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index aa01d6ed1..8c7df4cac 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -44,21 +44,20 @@
/* WM_XBUTTON Messages. They should go into w32api. */
#ifndef WM_XBUTTONDOWN
-# define WM_XBUTTONDOWN 523
+#define WM_XBUTTONDOWN 523
#endif
#ifndef WM_XBUTTONUP
-# define WM_XBUTTONUP 524
+#define WM_XBUTTONUP 524
#endif
#ifndef WM_XBUTTONDBLCLK
-# define WM_XBUTTONDBLCLK 525
+#define WM_XBUTTONDBLCLK 525
#endif
-
#define WIN_DEFAULT_BPP 0
#define WIN_DEFAULT_WHITEPIXEL 255
#define WIN_DEFAULT_BLACKPIXEL 0
#define WIN_DEFAULT_LINEBIAS 0
-#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
+#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
#define WIN_DEFAULT_DPI 96
#define WIN_DEFAULT_REFRESH 0
#define WIN_DEFAULT_WIN_KILL TRUE
@@ -101,15 +100,15 @@
#define WIN_FD_INVALID -1
-#define WIN_SERVER_NONE 0x0L /* 0 */
-#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
-#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
-#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
+#define WIN_SERVER_NONE 0x0L /* 0 */
+#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
+#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
+#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
#ifdef XWIN_PRIMARYFB
-#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
+#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
#endif
#ifdef XWIN_NATIVEGDI
-# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
+#define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
#endif
#define AltMapIndex Mod1MapIndex
@@ -147,8 +146,8 @@ typedef int pid_t;
#include <sys/mman.h>
#ifndef MAP_FILE
#define MAP_FILE 0
-#endif /* MAP_FILE */
-#endif /* HAVE_MMAP */
+#endif /* MAP_FILE */
+#endif /* HAVE_MMAP */
#include <X11/X.h>
#include <X11/Xproto.h>
@@ -192,7 +191,6 @@ typedef int pid_t;
#include "winms.h"
#include "winresource.h"
-
/*
* Define Windows constants
*/
@@ -201,7 +199,6 @@ typedef int pid_t;
#define WM_INIT_SYS_MENU (WM_USER + 1001)
#define WM_GIVEUP (WM_USER + 1002)
-
/* Local includes */
#include "winwindow.h"
#include "winmsg.h"
@@ -213,7 +210,6 @@ if (++PROFPT##point % thresh == 0)\
ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\
}
-
/* We use xor this macro for detecting toggle key state changes */
#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b)))
@@ -232,117 +228,111 @@ static Atom func (void) { \
* Typedefs for engine dependent function pointers
*/
-typedef Bool (*winAllocateFBProcPtr)(ScreenPtr);
+typedef Bool (*winAllocateFBProcPtr) (ScreenPtr);
-typedef void (*winFreeFBProcPtr)(ScreenPtr);
+typedef void (*winFreeFBProcPtr) (ScreenPtr);
-typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr);
+typedef void (*winShadowUpdateProcPtr) (ScreenPtr, shadowBufPtr);
-typedef Bool (*winInitScreenProcPtr)(ScreenPtr);
+typedef Bool (*winInitScreenProcPtr) (ScreenPtr);
-typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr);
+typedef Bool (*winCloseScreenProcPtr) (int, ScreenPtr);
-typedef Bool (*winInitVisualsProcPtr)(ScreenPtr);
+typedef Bool (*winInitVisualsProcPtr) (ScreenPtr);
-typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr);
+typedef Bool (*winAdjustVideoModeProcPtr) (ScreenPtr);
-typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr);
+typedef Bool (*winCreateBoundingWindowProcPtr) (ScreenPtr);
-typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **);
+typedef Bool (*winFinishScreenInitProcPtr) (int, ScreenPtr, int, char **);
-typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr);
+typedef Bool (*winBltExposedRegionsProcPtr) (ScreenPtr);
-typedef Bool (*winActivateAppProcPtr)(ScreenPtr);
+typedef Bool (*winActivateAppProcPtr) (ScreenPtr);
-typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen);
+typedef Bool (*winRedrawScreenProcPtr) (ScreenPtr pScreen);
-typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen);
+typedef Bool (*winRealizeInstalledPaletteProcPtr) (ScreenPtr pScreen);
-typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap);
+typedef Bool (*winInstallColormapProcPtr) (ColormapPtr pColormap);
-typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap,
- int ndef, xColorItem *pdefs);
+typedef Bool (*winStoreColorsProcPtr) (ColormapPtr pmap,
+ int ndef, xColorItem * pdefs);
-typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap);
+typedef Bool (*winCreateColormapProcPtr) (ColormapPtr pColormap);
-typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap);
+typedef Bool (*winDestroyColormapProcPtr) (ColormapPtr pColormap);
-typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr);
+typedef Bool (*winHotKeyAltTabProcPtr) (ScreenPtr);
-typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr);
+typedef Bool (*winCreatePrimarySurfaceProcPtr) (ScreenPtr);
-typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
+typedef Bool (*winReleasePrimarySurfaceProcPtr) (ScreenPtr);
-typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
+typedef Bool (*winFinishCreateWindowsWindowProcPtr) (WindowPtr pWin);
-typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
+typedef Bool (*winCreateScreenResourcesProc) (ScreenPtr);
#ifdef XWIN_NATIVEGDI
/* Typedefs for native GDI wrappers */
typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
-typedef Bool (*UnrealizeFontPtr)(ScreenPtr pScreen, FontPtr pFont);
+typedef Bool (*UnrealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
#endif
-
/*
* GC (graphics context) privates
*/
-typedef struct
-{
- HDC hdc;
- HDC hdcMem;
+typedef struct {
+ HDC hdc;
+ HDC hdcMem;
} winPrivGCRec, *winPrivGCPtr;
-
/*
* Pixmap privates
*/
-typedef struct
-{
- HDC hdcSelected;
- HBITMAP hBitmap;
- BYTE *pbBits;
- DWORD dwScanlineBytes;
- BITMAPINFOHEADER *pbmih;
+typedef struct {
+ HDC hdcSelected;
+ HBITMAP hBitmap;
+ BYTE *pbBits;
+ DWORD dwScanlineBytes;
+ BITMAPINFOHEADER *pbmih;
} winPrivPixmapRec, *winPrivPixmapPtr;
-
/*
* Colormap privates
*/
-typedef struct
-{
- HPALETTE hPalette;
- LPDIRECTDRAWPALETTE lpDDPalette;
- RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
- PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
+typedef struct {
+ HPALETTE hPalette;
+ LPDIRECTDRAWPALETTE lpDDPalette;
+ RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
+ PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
} winPrivCmapRec, *winPrivCmapPtr;
/*
* Windows Cursor handling.
- */
-
+ */
+
typedef struct {
- /* from GetSystemMetrics */
- int sm_cx;
- int sm_cy;
-
- BOOL visible;
- HCURSOR handle;
- QueryBestSizeProcPtr QueryBestSize;
- miPointerSpriteFuncPtr spriteFuncs;
+ /* from GetSystemMetrics */
+ int sm_cx;
+ int sm_cy;
+
+ BOOL visible;
+ HCURSOR handle;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
} winCursorRec;
/*
* Resize modes
*/
typedef enum {
- notAllowed,
- resizeWithScrollbars,
- resizeWithRandr
+ notAllowed,
+ resizeWithScrollbars,
+ resizeWithRandr
} winResizeMode;
/*
@@ -350,297 +340,296 @@ typedef enum {
* in the server startup sequence.
*/
-typedef struct
-{
- ScreenPtr pScreen;
-
- /* Did the user specify a height and width? */
- Bool fUserGaveHeightAndWidth;
+typedef struct {
+ ScreenPtr pScreen;
+
+ /* Did the user specify a height and width? */
+ Bool fUserGaveHeightAndWidth;
- DWORD dwScreen;
+ DWORD dwScreen;
- int iMonitor;
+ int iMonitor;
HMONITOR hMonitor;
- DWORD dwUserWidth;
- DWORD dwUserHeight;
- DWORD dwWidth;
- DWORD dwHeight;
- DWORD dwPaddedWidth;
-
- /* Did the user specify a screen position? */
- Bool fUserGavePosition;
- DWORD dwInitialX;
- DWORD dwInitialY;
-
- /*
- * dwStride is the number of whole pixels that occupy a scanline,
- * including those pixels that are not displayed. This is basically
- * a rounding up of the width.
- */
- DWORD dwStride;
-
- /* Offset of the screen in the window when using scrollbars */
- DWORD dwXOffset;
- DWORD dwYOffset;
-
- DWORD dwBPP;
- DWORD dwDepth;
- DWORD dwRefreshRate;
- char *pfb;
- DWORD dwEngine;
- DWORD dwEnginePreferred;
- DWORD dwClipUpdatesNBoxes;
+ DWORD dwUserWidth;
+ DWORD dwUserHeight;
+ DWORD dwWidth;
+ DWORD dwHeight;
+ DWORD dwPaddedWidth;
+
+ /* Did the user specify a screen position? */
+ Bool fUserGavePosition;
+ DWORD dwInitialX;
+ DWORD dwInitialY;
+
+ /*
+ * dwStride is the number of whole pixels that occupy a scanline,
+ * including those pixels that are not displayed. This is basically
+ * a rounding up of the width.
+ */
+ DWORD dwStride;
+
+ /* Offset of the screen in the window when using scrollbars */
+ DWORD dwXOffset;
+ DWORD dwYOffset;
+
+ DWORD dwBPP;
+ DWORD dwDepth;
+ DWORD dwRefreshRate;
+ char *pfb;
+ DWORD dwEngine;
+ DWORD dwEnginePreferred;
+ DWORD dwClipUpdatesNBoxes;
#ifdef XWIN_EMULATEPSEUDO
- Bool fEmulatePseudo;
+ Bool fEmulatePseudo;
#endif
- Bool fFullScreen;
- Bool fDecoration;
+ Bool fFullScreen;
+ Bool fDecoration;
#ifdef XWIN_MULTIWINDOWEXTWM
- Bool fMWExtWM;
- Bool fAnotherWMRunning;
+ Bool fMWExtWM;
+ Bool fAnotherWMRunning;
#endif
#ifdef XWIN_MULTIWINDOWINTWM
Bool fInternalWM;
#endif
- Bool fRootless;
+ Bool fRootless;
#ifdef XWIN_MULTIWINDOW
- Bool fMultiWindow;
+ Bool fMultiWindow;
#endif
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- Bool fMultiMonitorOverride;
+ Bool fMultiMonitorOverride;
#endif
- Bool fMultipleMonitors;
- Bool fLessPointer;
- winResizeMode iResizeMode;
- Bool fNoTrayIcon;
- int iE3BTimeout;
- /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
- Bool fUseWinKillKey;
- Bool fUseUnixKillKey;
- Bool fIgnoreInput;
-
- /* Did the user explicitly set this screen? */
- Bool fExplicitScreen;
+ Bool fMultipleMonitors;
+ Bool fLessPointer;
+ winResizeMode iResizeMode;
+ Bool fNoTrayIcon;
+ int iE3BTimeout;
+ /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
+ Bool fUseWinKillKey;
+ Bool fUseUnixKillKey;
+ Bool fIgnoreInput;
+
+ /* Did the user explicitly set this screen? */
+ Bool fExplicitScreen;
} winScreenInfo, *winScreenInfoPtr;
-
/*
* Screen privates
*/
-typedef struct _winPrivScreenRec
-{
- winScreenInfoPtr pScreenInfo;
+typedef struct _winPrivScreenRec {
+ winScreenInfoPtr pScreenInfo;
- Bool fEnabled;
- Bool fClosed;
- Bool fActive;
- Bool fBadDepth;
+ Bool fEnabled;
+ Bool fClosed;
+ Bool fActive;
+ Bool fBadDepth;
- int iDeltaZ;
+ int iDeltaZ;
- int iConnectedClients;
+ int iConnectedClients;
- CloseScreenProcPtr CloseScreen;
+ CloseScreenProcPtr CloseScreen;
- DWORD dwRedMask;
- DWORD dwGreenMask;
- DWORD dwBlueMask;
- DWORD dwBitsPerRGB;
+ DWORD dwRedMask;
+ DWORD dwGreenMask;
+ DWORD dwBlueMask;
+ DWORD dwBitsPerRGB;
- DWORD dwModeKeyStates;
+ DWORD dwModeKeyStates;
- /* Handle to icons that must be freed */
- HICON hiconNotifyIcon;
+ /* Handle to icons that must be freed */
+ HICON hiconNotifyIcon;
- /* Palette management */
- ColormapPtr pcmapInstalled;
+ /* Palette management */
+ ColormapPtr pcmapInstalled;
- /* Pointer to the root visual so we only have to look it up once */
- VisualPtr pRootVisual;
+ /* Pointer to the root visual so we only have to look it up once */
+ VisualPtr pRootVisual;
- /* 3 button emulation variables */
- int iE3BCachedPress;
- Bool fE3BFakeButton2Sent;
+ /* 3 button emulation variables */
+ int iE3BCachedPress;
+ Bool fE3BFakeButton2Sent;
- /* Privates used by shadow fb GDI server */
- HBITMAP hbmpShadow;
- HDC hdcScreen;
- HDC hdcShadow;
- HWND hwndScreen;
- BITMAPINFOHEADER *pbmih;
+ /* Privates used by shadow fb GDI server */
+ HBITMAP hbmpShadow;
+ HDC hdcScreen;
+ HDC hdcShadow;
+ HWND hwndScreen;
+ BITMAPINFOHEADER *pbmih;
- /* Privates used by shadow fb and primary fb DirectDraw servers */
- LPDIRECTDRAW pdd;
- LPDIRECTDRAWSURFACE pddsPrimary;
- LPDIRECTDRAW2 pdd2;
+ /* Privates used by shadow fb and primary fb DirectDraw servers */
+ LPDIRECTDRAW pdd;
+ LPDIRECTDRAWSURFACE pddsPrimary;
+ LPDIRECTDRAW2 pdd2;
- /* Privates used by shadow fb DirectDraw server */
- LPDIRECTDRAWSURFACE pddsShadow;
- LPDDSURFACEDESC pddsdShadow;
+ /* Privates used by shadow fb DirectDraw server */
+ LPDIRECTDRAWSURFACE pddsShadow;
+ LPDDSURFACEDESC pddsdShadow;
#ifdef XWIN_PRIMARYFB
- /* Privates used by primary fb DirectDraw server */
- LPDIRECTDRAWSURFACE pddsOffscreen;
- LPDDSURFACEDESC pddsdOffscreen;
- LPDDSURFACEDESC pddsdPrimary;
+ /* Privates used by primary fb DirectDraw server */
+ LPDIRECTDRAWSURFACE pddsOffscreen;
+ LPDDSURFACEDESC pddsdOffscreen;
+ LPDDSURFACEDESC pddsdPrimary;
#endif
- /* Privates used by shadow fb DirectDraw Nonlocking server */
- LPDIRECTDRAW4 pdd4;
- LPDIRECTDRAWSURFACE4 pddsShadow4;
- LPDIRECTDRAWSURFACE4 pddsPrimary4;
- BOOL fRetryCreateSurface;
+ /* Privates used by shadow fb DirectDraw Nonlocking server */
+ LPDIRECTDRAW4 pdd4;
+ LPDIRECTDRAWSURFACE4 pddsShadow4;
+ LPDIRECTDRAWSURFACE4 pddsPrimary4;
+ BOOL fRetryCreateSurface;
- /* Privates used by both shadow fb DirectDraw servers */
- LPDIRECTDRAWCLIPPER pddcPrimary;
+ /* Privates used by both shadow fb DirectDraw servers */
+ LPDIRECTDRAWCLIPPER pddcPrimary;
#ifdef XWIN_MULTIWINDOWEXTWM
- /* Privates used by multi-window external window manager */
- RootlessFrameID widTop;
- Bool fRestacking;
+ /* Privates used by multi-window external window manager */
+ RootlessFrameID widTop;
+ Bool fRestacking;
#endif
#ifdef XWIN_MULTIWINDOW
- /* Privates used by multi-window */
- pthread_t ptWMProc;
- pthread_t ptXMsgProc;
- void *pWMInfo;
+ /* Privates used by multi-window */
+ pthread_t ptWMProc;
+ pthread_t ptXMsgProc;
+ void *pWMInfo;
#endif
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- /* Privates used by both multi-window and rootless */
- Bool fRootWindowShown;
+ /* Privates used by both multi-window and rootless */
+ Bool fRootWindowShown;
#endif
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Privates used for any module running in a seperate thread */
- pthread_mutex_t pmServerStarted;
- Bool fServerStarted;
+ /* Privates used for any module running in a seperate thread */
+ pthread_mutex_t pmServerStarted;
+ Bool fServerStarted;
#endif
-
- /* Engine specific functions */
- winAllocateFBProcPtr pwinAllocateFB;
- winFreeFBProcPtr pwinFreeFB;
- winShadowUpdateProcPtr pwinShadowUpdate;
- winInitScreenProcPtr pwinInitScreen;
- winCloseScreenProcPtr pwinCloseScreen;
- winInitVisualsProcPtr pwinInitVisuals;
- winAdjustVideoModeProcPtr pwinAdjustVideoMode;
- winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
- winFinishScreenInitProcPtr pwinFinishScreenInit;
- winBltExposedRegionsProcPtr pwinBltExposedRegions;
- winActivateAppProcPtr pwinActivateApp;
- winRedrawScreenProcPtr pwinRedrawScreen;
- winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
- winInstallColormapProcPtr pwinInstallColormap;
- winStoreColorsProcPtr pwinStoreColors;
- winCreateColormapProcPtr pwinCreateColormap;
- winDestroyColormapProcPtr pwinDestroyColormap;
- winHotKeyAltTabProcPtr pwinHotKeyAltTab;
- winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
- winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
-
- winCreateScreenResourcesProc pwinCreateScreenResources;
+
+ /* Engine specific functions */
+ winAllocateFBProcPtr pwinAllocateFB;
+ winFreeFBProcPtr pwinFreeFB;
+ winShadowUpdateProcPtr pwinShadowUpdate;
+ winInitScreenProcPtr pwinInitScreen;
+ winCloseScreenProcPtr pwinCloseScreen;
+ winInitVisualsProcPtr pwinInitVisuals;
+ winAdjustVideoModeProcPtr pwinAdjustVideoMode;
+ winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
+ winFinishScreenInitProcPtr pwinFinishScreenInit;
+ winBltExposedRegionsProcPtr pwinBltExposedRegions;
+ winActivateAppProcPtr pwinActivateApp;
+ winRedrawScreenProcPtr pwinRedrawScreen;
+ winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
+ winInstallColormapProcPtr pwinInstallColormap;
+ winStoreColorsProcPtr pwinStoreColors;
+ winCreateColormapProcPtr pwinCreateColormap;
+ winDestroyColormapProcPtr pwinDestroyColormap;
+ winHotKeyAltTabProcPtr pwinHotKeyAltTab;
+ winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
+ winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
+
+ winCreateScreenResourcesProc pwinCreateScreenResources;
#ifdef XWIN_MULTIWINDOW
- /* Window Procedures for MultiWindow mode */
- winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
+ /* Window Procedures for MultiWindow mode */
+ winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
#endif
- /* Window Procedures for Rootless mode */
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- PositionWindowProcPtr PositionWindow;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- ValidateTreeProcPtr ValidateTree;
- PostValidateTreeProcPtr PostValidateTree;
- CopyWindowProcPtr CopyWindow;
- ClearToBackgroundProcPtr ClearToBackground;
- ClipNotifyProcPtr ClipNotify;
- RestackWindowProcPtr RestackWindow;
- ReparentWindowProcPtr ReparentWindow;
- ResizeWindowProcPtr ResizeWindow;
- MoveWindowProcPtr MoveWindow;
- SetShapeProcPtr SetShape;
-
- winCursorRec cursor;
+ /* Window Procedures for Rootless mode */
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ PositionWindowProcPtr PositionWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ CopyWindowProcPtr CopyWindow;
+ ClearToBackgroundProcPtr ClearToBackground;
+ ClipNotifyProcPtr ClipNotify;
+ RestackWindowProcPtr RestackWindow;
+ ReparentWindowProcPtr ReparentWindow;
+ ResizeWindowProcPtr ResizeWindow;
+ MoveWindowProcPtr MoveWindow;
+ SetShapeProcPtr SetShape;
+
+ winCursorRec cursor;
#ifdef XWIN_NATIVEGDI
- RealizeFontPtr RealizeFont;
- UnrealizeFontPtr UnrealizeFont;
+ RealizeFontPtr RealizeFont;
+ UnrealizeFontPtr UnrealizeFont;
#endif
} winPrivScreenRec;
-
#ifdef XWIN_MULTIWINDOWEXTWM
typedef struct {
- RootlessWindowPtr pFrame;
- HWND hWnd;
- int dwWidthBytes;
- BITMAPINFOHEADER *pbmihShadow;
- HBITMAP hbmpShadow;
- HDC hdcShadow;
- HDC hdcScreen;
- BOOL fResized;
- BOOL fRestackingNow;
- BOOL fClose;
- BOOL fMovingOrSizing;
- BOOL fDestroyed;//for debug
- char *pfb;
+ RootlessWindowPtr pFrame;
+ HWND hWnd;
+ int dwWidthBytes;
+ BITMAPINFOHEADER *pbmihShadow;
+ HBITMAP hbmpShadow;
+ HDC hdcShadow;
+ HDC hdcScreen;
+ BOOL fResized;
+ BOOL fRestackingNow;
+ BOOL fClose;
+ BOOL fMovingOrSizing;
+ BOOL fDestroyed; //for debug
+ char *pfb;
} win32RootlessWindowRec, *win32RootlessWindowPtr;
#endif
-
typedef struct {
- pointer value;
- XID id;
+ pointer value;
+ XID id;
} WindowIDPairRec, *WindowIDPairPtr;
-
/*
* Extern declares for general global variables
*/
#include "winglobals.h"
-extern winScreenInfo * g_ScreenInfo;
-extern miPointerScreenFuncRec g_winPointerCursorFuncs;
-extern DWORD g_dwEvents;
+extern winScreenInfo *g_ScreenInfo;
+extern miPointerScreenFuncRec g_winPointerCursorFuncs;
+extern DWORD g_dwEvents;
+
#ifdef HAS_DEVWINDOWS
-extern int g_fdMessageQueue;
+extern int g_fdMessageQueue;
#endif
-extern DevPrivateKeyRec g_iScreenPrivateKeyRec;
+extern DevPrivateKeyRec g_iScreenPrivateKeyRec;
+
#define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec)
-extern DevPrivateKeyRec g_iCmapPrivateKeyRec;
+extern DevPrivateKeyRec g_iCmapPrivateKeyRec;
+
#define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec)
-extern DevPrivateKeyRec g_iGCPrivateKeyRec;
+extern DevPrivateKeyRec g_iGCPrivateKeyRec;
+
#define g_iGCPrivateKey (&g_iGCPrivateKeyRec)
-extern DevPrivateKeyRec g_iPixmapPrivateKeyRec;
+extern DevPrivateKeyRec g_iPixmapPrivateKeyRec;
+
#define g_iPixmapPrivateKey (&g_iPixmapPrivateKeyRec)
-extern DevPrivateKeyRec g_iWindowPrivateKeyRec;
+extern DevPrivateKeyRec g_iWindowPrivateKeyRec;
+
#define g_iWindowPrivateKey (&g_iWindowPrivateKeyRec)
-extern unsigned long g_ulServerGeneration;
-extern DWORD g_dwEnginesSupported;
-extern HINSTANCE g_hInstance;
-extern int g_copyROP[];
-extern int g_patternROP[];
-extern const char * g_pszQueryHost;
-extern DeviceIntPtr g_pwinPointer;
-extern DeviceIntPtr g_pwinKeyboard;
+extern unsigned long g_ulServerGeneration;
+extern DWORD g_dwEnginesSupported;
+extern HINSTANCE g_hInstance;
+extern int g_copyROP[];
+extern int g_patternROP[];
+extern const char *g_pszQueryHost;
+extern DeviceIntPtr g_pwinPointer;
+extern DeviceIntPtr g_pwinKeyboard;
/*
* Extern declares for dynamically loaded library function pointers
*/
-extern FARPROC g_fpDirectDrawCreate;
-extern FARPROC g_fpDirectDrawCreateClipper;
-
+extern FARPROC g_fpDirectDrawCreate;
+extern FARPROC g_fpDirectDrawCreateClipper;
/*
* Screen privates macros
@@ -655,7 +644,6 @@ extern FARPROC g_fpDirectDrawCreateClipper;
#define winScreenPriv(pScreen) \
winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen)
-
/*
* Colormap privates macros
*/
@@ -669,7 +657,6 @@ extern FARPROC g_fpDirectDrawCreateClipper;
#define winCmapPriv(pCmap) \
winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap)
-
/*
* GC privates macros
*/
@@ -683,7 +670,6 @@ extern FARPROC g_fpDirectDrawCreateClipper;
#define winGCPriv(pGC) \
winPrivGCPtr pGCPriv = winGetGCPriv(pGC)
-
/*
* Pixmap privates macros
*/
@@ -697,7 +683,6 @@ extern FARPROC g_fpDirectDrawCreateClipper;
#define winPixmapPriv(pPixmap) \
winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap)
-
/*
* Window privates macros
*/
@@ -723,7 +708,7 @@ extern FARPROC g_fpDirectDrawCreateClipper;
real->mem = priv->mem; \
}
-#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
+#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem)
@@ -731,20 +716,18 @@ extern FARPROC g_fpDirectDrawCreateClipper;
* BEGIN DDX and DIX Function Prototypes
*/
-
/*
* winallpriv.c
*/
Bool
-winAllocatePrivates (ScreenPtr pScreen);
+ winAllocatePrivates(ScreenPtr pScreen);
Bool
-winInitCmapPrivates (ColormapPtr pCmap, int index);
+ winInitCmapPrivates(ColormapPtr pCmap, int index);
Bool
-winAllocateCmapPrivates (ColormapPtr pCmap);
-
+ winAllocateCmapPrivates(ColormapPtr pCmap);
/*
* winauth.c
@@ -752,21 +735,18 @@ winAllocateCmapPrivates (ColormapPtr pCmap);
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
Bool
-winGenerateAuthorization (void);
+ winGenerateAuthorization(void);
void winSetAuthorization(void);
#endif
-
/*
* winblock.c
*/
void
-winBlockHandler (int nScreen,
- pointer pBlockData,
- pointer pTimeout,
- pointer pReadMask);
+winBlockHandler(int nScreen,
+ pointer pBlockData, pointer pTimeout, pointer pReadMask);
#ifdef XWIN_NATIVEGDI
/*
@@ -774,44 +754,40 @@ winBlockHandler (int nScreen,
*/
RegionPtr
-winPixmapToRegionNativeGDI (PixmapPtr pPix);
+ winPixmapToRegionNativeGDI(PixmapPtr pPix);
#endif
-
#ifdef XWIN_CLIPBOARD
/*
* winclipboardinit.c
*/
Bool
-winInitClipboard (void);
+ winInitClipboard(void);
void
-winFixClipboardChain (int Removed);
+ winFixClipboardChain (int Removed);
#endif
-
/*
* wincmap.c
*/
void
-winSetColormapFunctions (ScreenPtr pScreen);
+ winSetColormapFunctions(ScreenPtr pScreen);
Bool
-winCreateDefColormap (ScreenPtr pScreen);
-
+ winCreateDefColormap(ScreenPtr pScreen);
/*
* wincreatewnd.c
*/
Bool
-winCreateBoundingWindowFullScreen (ScreenPtr pScreen);
+ winCreateBoundingWindowFullScreen(ScreenPtr pScreen);
Bool
-winCreateBoundingWindowWindowed (ScreenPtr pScreen);
-
+ winCreateBoundingWindowWindowed(ScreenPtr pScreen);
/*
* windialogs.c
@@ -821,31 +797,29 @@ int
GetLiveClients (winPrivScreenPtr pScreenPriv);
void
-winDisplayExitDialog (winPrivScreenPtr pScreenPriv);
+ winDisplayExitDialog(winPrivScreenPtr pScreenPriv);
void
-winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv);
+ winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv);
void
-winDisplayAboutDialog (winPrivScreenPtr pScreenPriv);
-
+ winDisplayAboutDialog(winPrivScreenPtr pScreenPriv);
/*
* winengine.c
*/
void
-winDetectSupportedEngines (void);
+ winDetectSupportedEngines(void);
Bool
-winSetEngine (ScreenPtr pScreen);
+ winSetEngine(ScreenPtr pScreen);
Bool
-winGetDDProcAddresses (void);
+ winGetDDProcAddresses(void);
void
-winReleaseDDProcAddresses(void);
-
+ winReleaseDDProcAddresses(void);
/*
* winerror.c
@@ -853,12 +827,11 @@ winReleaseDDProcAddresses(void);
#ifdef DDXOSVERRORF
void
-OSVenderVErrorF (const char *pszFormat, va_list va_args);
+ OSVenderVErrorF(const char *pszFormat, va_list va_args);
#endif
void
-winMessageBoxF (const char *pszError, UINT uType, ...);
-
+ winMessageBoxF(const char *pszError, UINT uType, ...);
#ifdef XWIN_NATIVEGDI
/*
@@ -866,14 +839,12 @@ winMessageBoxF (const char *pszError, UINT uType, ...);
*/
void
-winFillSpansNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- int nSpans,
- DDXPointPtr pPoints,
- int *pWidths,
- int fSorted);
-#endif
+winFillSpansNativeGDI(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints, int *pWidths, int fSorted);
+#endif
#ifdef XWIN_NATIVEGDI
/*
@@ -881,87 +852,79 @@ winFillSpansNativeGDI (DrawablePtr pDrawable,
*/
Bool
-winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
+ winRealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont);
Bool
-winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
+ winUnrealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont);
#endif
-
#ifdef XWIN_NATIVEGDI
/*
* wingc.c
*/
Bool
-winCreateGCNativeGDI (GCPtr pGC);
+ winCreateGCNativeGDI(GCPtr pGC);
#endif
-
#ifdef XWIN_NATIVEGDI
/*
* wingetsp.c
*/
void
-winGetSpansNativeGDI (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr pPoints,
- int *pWidths,
- int nSpans,
- char *pDst);
-#endif
+winGetSpansNativeGDI(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst);
+#endif
/*
* winglobals.c
*/
void
-winInitializeGlobals (void);
-
+ winInitializeGlobals(void);
/*
* winkeybd.c
*/
void
-winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode);
+ winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode);
int
-winKeybdProc (DeviceIntPtr pDeviceInt, int iState);
+ winKeybdProc(DeviceIntPtr pDeviceInt, int iState);
void
-winInitializeModeKeyStates (void);
+ winInitializeModeKeyStates(void);
void
-winRestoreModeKeyStates (void);
+ winRestoreModeKeyStates(void);
Bool
-winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam);
+ winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam);
void
-winKeybdReleaseKeys (void);
+ winKeybdReleaseKeys(void);
void
-winSendKeyEvent (DWORD dwKey, Bool fDown);
+ winSendKeyEvent(DWORD dwKey, Bool fDown);
-BOOL
-winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
+BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
void
-winFixShiftKeys (int iScanCode);
+ winFixShiftKeys(int iScanCode);
/*
* winkeyhook.c
*/
Bool
-winInstallKeyboardHookLL (void);
+ winInstallKeyboardHookLL(void);
void
-winRemoveKeyboardHookLL (void);
-
+ winRemoveKeyboardHookLL(void);
/*
* winmisc.c
@@ -969,42 +932,41 @@ winRemoveKeyboardHookLL (void);
#ifdef XWIN_NATIVEGDI
void
-winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
- unsigned short *pHeight, ScreenPtr pScreen);
+
+winQueryBestSizeNativeGDI(int class, unsigned short *pWidth,
+ unsigned short *pHeight, ScreenPtr pScreen);
#endif
CARD8
-winCountBits (DWORD dw);
+ winCountBits(DWORD dw);
Bool
-winUpdateFBPointer (ScreenPtr pScreen, void *pbits);
+ winUpdateFBPointer(ScreenPtr pScreen, void *pbits);
#ifdef XWIN_NATIVEGDI
-BOOL
-winPaintBackground (HWND hwnd, COLORREF colorref);
+BOOL winPaintBackground(HWND hwnd, COLORREF colorref);
#endif
-
/*
* winmouse.c
*/
int
-winMouseProc (DeviceIntPtr pDeviceInt, int iState);
+ winMouseProc(DeviceIntPtr pDeviceInt, int iState);
int
-winMouseWheel (ScreenPtr pScreen, int iDeltaZ);
+ winMouseWheel(ScreenPtr pScreen, int iDeltaZ);
void
-winMouseButtonsSendEvent (int iEventType, int iButton);
+ winMouseButtonsSendEvent(int iEventType, int iButton);
int
-winMouseButtonsHandle (ScreenPtr pScreen,
- int iEventType, int iButton,
- WPARAM wParam);
+
+winMouseButtonsHandle(ScreenPtr pScreen,
+ int iEventType, int iButton, WPARAM wParam);
void
-winEnqueueMotion(int x, int y);
+ winEnqueueMotion(int x, int y);
#ifdef XWIN_NATIVEGDI
/*
@@ -1012,43 +974,42 @@ winEnqueueMotion(int x, int y);
*/
HBITMAP
-winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
- BYTE **ppbBits, BITMAPINFO **ppbmi);
+winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth,
+ BYTE ** ppbBits, BITMAPINFO ** ppbmi);
Bool
-winSetEngineFunctionsNativeGDI (ScreenPtr pScreen);
+ winSetEngineFunctionsNativeGDI(ScreenPtr pScreen);
#endif
-
#ifdef XWIN_PRIMARYFB
/*
* winpfbddd.c
*/
Bool
-winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen);
+ winSetEngineFunctionsPrimaryDD(ScreenPtr pScreen);
#endif
-
#ifdef XWIN_NATIVEGDI
/*
* winpixmap.c
*/
PixmapPtr
-winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint);
+
+winCreatePixmapNativeGDI(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint);
Bool
-winDestroyPixmapNativeGDI (PixmapPtr pPixmap);
+ winDestroyPixmapNativeGDI(PixmapPtr pPixmap);
Bool
-winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
- int iWidth, int iHeight,
- int iDepth,
- int iBitsPerPixel,
- int devKind,
- pointer pPixData);
+
+winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap,
+ int iWidth, int iHeight,
+ int iDepth,
+ int iBitsPerPixel,
+ int devKind, pointer pPixData);
#endif
#ifdef XWIN_NATIVEGDI
@@ -1057,13 +1018,10 @@ winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
*/
void
-winPolyLineNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
-#endif
+winPolyLineNativeGDI(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
+#endif
#ifdef XWIN_NATIVEGDI
/*
@@ -1071,32 +1029,27 @@ winPolyLineNativeGDI (DrawablePtr pDrawable,
*/
void
-winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
- int dx, int dy, int xOrg, int yOrg);
-#endif
+winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg);
+#endif
/*
* winscrinit.c
*/
Bool
-winScreenInit (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
+ winScreenInit(int index, ScreenPtr pScreen, int argc, char **argv);
Bool
-winFinishScreenInitFB (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
+ winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv);
#if defined(XWIN_NATIVEGDI)
Bool
-winFinishScreenInitNativeGDI (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
-#endif
+winFinishScreenInitNativeGDI(int index,
+ ScreenPtr pScreen, int argc, char **argv);
+#endif
#ifdef XWIN_NATIVEGDI
/*
@@ -1104,50 +1057,43 @@ winFinishScreenInitNativeGDI (int index,
*/
void
-winSetSpansNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- char *pSrc,
- DDXPointPtr pPoints,
- int *pWidth,
- int nSpans,
- int fSorted);
-#endif
+winSetSpansNativeGDI(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints, int *pWidth, int nSpans, int fSorted);
+#endif
/*
* winshaddd.c
*/
Bool
-winSetEngineFunctionsShadowDD (ScreenPtr pScreen);
-
+ winSetEngineFunctionsShadowDD(ScreenPtr pScreen);
/*
* winshadddnl.c
*/
Bool
-winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen);
-
+ winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen);
/*
* winshadgdi.c
*/
Bool
-winSetEngineFunctionsShadowGDI (ScreenPtr pScreen);
-
+ winSetEngineFunctionsShadowGDI(ScreenPtr pScreen);
/*
* winwakeup.c
*/
void
-winWakeupHandler (int nScreen,
- pointer pWakeupData,
- unsigned long ulResult,
- pointer pReadmask);
+winWakeupHandler(int nScreen,
+ pointer pWakeupData,
+ unsigned long ulResult, pointer pReadmask);
/*
* winwindow.c
@@ -1155,60 +1101,57 @@ winWakeupHandler (int nScreen,
#ifdef XWIN_NATIVEGDI
Bool
-winCreateWindowNativeGDI (WindowPtr pWin);
+ winCreateWindowNativeGDI(WindowPtr pWin);
Bool
-winDestroyWindowNativeGDI (WindowPtr pWin);
+ winDestroyWindowNativeGDI(WindowPtr pWin);
Bool
-winPositionWindowNativeGDI (WindowPtr pWin, int x, int y);
+ winPositionWindowNativeGDI(WindowPtr pWin, int x, int y);
-void
-winCopyWindowNativeGDI (WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
+void
+
+winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
Bool
-winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask);
+ winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask);
Bool
-winUnmapWindowNativeGDI (WindowPtr pWindow);
+ winUnmapWindowNativeGDI(WindowPtr pWindow);
Bool
-winMapWindowNativeGDI (WindowPtr pWindow);
+ winMapWindowNativeGDI(WindowPtr pWindow);
#endif
Bool
-winCreateWindowRootless (WindowPtr pWindow);
+ winCreateWindowRootless(WindowPtr pWindow);
Bool
-winDestroyWindowRootless (WindowPtr pWindow);
+ winDestroyWindowRootless(WindowPtr pWindow);
Bool
-winPositionWindowRootless (WindowPtr pWindow, int x, int y);
+ winPositionWindowRootless(WindowPtr pWindow, int x, int y);
Bool
-winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask);
+ winChangeWindowAttributesRootless(WindowPtr pWindow, unsigned long mask);
Bool
-winUnmapWindowRootless (WindowPtr pWindow);
+ winUnmapWindowRootless(WindowPtr pWindow);
Bool
-winMapWindowRootless (WindowPtr pWindow);
+ winMapWindowRootless(WindowPtr pWindow);
void
-winSetShapeRootless (WindowPtr pWindow, int kind);
-
+ winSetShapeRootless(WindowPtr pWindow, int kind);
/*
* winmultiwindowicons.c - Used by both multi-window and Win32Rootless
*/
-HICON
-winXIconToHICON (WindowPtr pWin, int iconSize);
+HICON winXIconToHICON(WindowPtr pWin, int iconSize);
void
-winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
+ winSelectIcons(WindowPtr pWin, HICON * pIcon, HICON * pSmallIcon);
#ifdef XWIN_MULTIWINDOW
/*
@@ -1216,102 +1159,98 @@ winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
*/
void
-winReshapeMultiWindow (WindowPtr pWin);
+ winReshapeMultiWindow(WindowPtr pWin);
void
-winSetShapeMultiWindow (WindowPtr pWindow, int kind);
+ winSetShapeMultiWindow(WindowPtr pWindow, int kind);
void
-winUpdateRgnMultiWindow (WindowPtr pWindow);
+ winUpdateRgnMultiWindow(WindowPtr pWindow);
#endif
-
#ifdef XWIN_MULTIWINDOW
/*
* winmultiwindowwindow.c
*/
Bool
-winCreateWindowMultiWindow (WindowPtr pWindow);
+ winCreateWindowMultiWindow(WindowPtr pWindow);
Bool
-winDestroyWindowMultiWindow (WindowPtr pWindow);
+ winDestroyWindowMultiWindow(WindowPtr pWindow);
Bool
-winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y);
+ winPositionWindowMultiWindow(WindowPtr pWindow, int x, int y);
Bool
-winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask);
+ winChangeWindowAttributesMultiWindow(WindowPtr pWindow, unsigned long mask);
Bool
-winUnmapWindowMultiWindow (WindowPtr pWindow);
+ winUnmapWindowMultiWindow(WindowPtr pWindow);
Bool
-winMapWindowMultiWindow (WindowPtr pWindow);
+ winMapWindowMultiWindow(WindowPtr pWindow);
void
-winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent);
+ winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent);
void
-winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib);
+ winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib);
void
-winReorderWindowsMultiWindow (void);
+ winReorderWindowsMultiWindow(void);
void
-winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
- unsigned int h, WindowPtr pSib);
+
+winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w,
+ unsigned int h, WindowPtr pSib);
void
-winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
- WindowPtr pSib, VTKind kind);
+
+winMoveWindowMultiWindow(WindowPtr pWin, int x, int y,
+ WindowPtr pSib, VTKind kind);
void
-winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
- RegionPtr oldRegion);
+
+winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt,
+ RegionPtr oldRegion);
XID
-winGetWindowID (WindowPtr pWin);
+ winGetWindowID(WindowPtr pWin);
int
-winAdjustXWindow (WindowPtr pWin, HWND hwnd);
+ winAdjustXWindow(WindowPtr pWin, HWND hwnd);
#endif
-
#ifdef XWIN_MULTIWINDOW
/*
* winmultiwindowwndproc.c
*/
LRESULT CALLBACK
-winTopLevelWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam);
+winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
#endif
-
/*
* wintrayicon.c
*/
void
-winInitNotifyIcon (winPrivScreenPtr pScreenPriv, Bool Modify);
+ winInitNotifyIcon (winPrivScreenPtr pScreenPriv, Bool Modify);
void
-winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv);
+ winDeleteNotifyIcon(winPrivScreenPtr pScreenPriv);
LRESULT
-winHandleIconMessage (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam,
- winPrivScreenPtr pScreenPriv);
-
+winHandleIconMessage(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam,
+ winPrivScreenPtr pScreenPriv);
/*
* winwndproc.c
*/
LRESULT CALLBACK
-winWindowProc (HWND hWnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-
+winWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
#ifdef XWIN_MULTIWINDOWEXTWM
/*
@@ -1319,55 +1258,61 @@ winWindowProc (HWND hWnd, UINT message,
*/
Bool
-winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
- int newX, int newY, RegionPtr pShape);
+
+winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape);
void
-winMWExtWMDestroyFrame (RootlessFrameID wid);
+ winMWExtWMDestroyFrame(RootlessFrameID wid);
void
-winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
+
+winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
void
-winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
- int newX, int newY, unsigned int newW, unsigned int newH,
- unsigned int gravity);
+
+winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
+ int newX, int newY, unsigned int newW, unsigned int newH,
+ unsigned int gravity);
void
-winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid);
+ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid);
void
-winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape);
+ winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape);
void
-winMWExtWMUnmapFrame (RootlessFrameID wid);
+ winMWExtWMUnmapFrame(RootlessFrameID wid);
void
-winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
+
+winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow);
void
-winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush);
+ winMWExtWMStopDrawing(RootlessFrameID wid, Bool flush);
void
-winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage);
+ winMWExtWMUpdateRegion(RootlessFrameID wid, RegionPtr pDamage);
void
-winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects,
- int shift_x, int shift_y);
+
+winMWExtWMDamageRects(RootlessFrameID wid, int count, const BoxRec * rects,
+ int shift_x, int shift_y);
void
-winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin);
+ winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin);
void
-winMWExtWMCopyBytes (unsigned int width, unsigned int height,
- const void *src, unsigned int srcRowBytes,
- void *dst, unsigned int dstRowBytes);
+
+winMWExtWMCopyBytes(unsigned int width, unsigned int height,
+ const void *src, unsigned int srcRowBytes,
+ void *dst, unsigned int dstRowBytes);
void
-winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
- int dx, int dy);
-#endif
+winMWExtWMCopyWindow(RootlessFrameID wid, int dstNrects,
+ const BoxRec * dstRects, int dx, int dy);
+#endif
#ifdef XWIN_MULTIWINDOWEXTWM
/*
@@ -1375,69 +1320,67 @@ winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects
*/
void
-winMWExtWMReorderWindows (ScreenPtr pScreen);
+ winMWExtWMReorderWindows(ScreenPtr pScreen);
void
-winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y);
+ winMWExtWMMoveXWindow(WindowPtr pWin, int x, int y);
void
-winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h);
+ winMWExtWMResizeXWindow(WindowPtr pWin, int w, int h);
void
-winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h);
+ winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h);
void
-winMWExtWMUpdateIcon (Window id);
+ winMWExtWMUpdateIcon(Window id);
void
-winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
- winScreenInfoPtr pScreenInfo);
-wBOOL CALLBACK
-winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam);
+winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv,
+ winScreenInfoPtr pScreenInfo);
+
+wBOOL CALLBACK winMWExtWMDecorateWindow(HWND hwnd, LPARAM lParam);
void
-winMWExtWMRestackWindows (ScreenPtr pScreen);
+ winMWExtWMRestackWindows(ScreenPtr pScreen);
#endif
#ifdef XWIN_MULTIWINDOWINTWM
Bool
-winIsInternalWMRunning (winScreenInfoPtr pScreenInfo);
+ winIsInternalWMRunning (winScreenInfoPtr pScreenInfo);
#endif
-
#ifdef XWIN_MULTIWINDOWEXTWM
/*
* winwin32rootlesswndproc.c
*/
LRESULT CALLBACK
-winMWExtWMWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam);
+winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
#endif
-
/*
* winwindowswm.c
*/
void
-winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
- Window window, int x, int y, int w, int h);
+
+winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg,
+ Window window, int x, int y, int w, int h);
void
-winWindowsWMExtensionInit (void);
+ winWindowsWMExtensionInit(void);
/*
* wincursor.c
*/
Bool
-winInitCursor (ScreenPtr pScreen);
+ winInitCursor(ScreenPtr pScreen);
/*
* winprocarg.c
*/
void
-winInitializeScreens(int maxscreens);
+ winInitializeScreens(int maxscreens);
/*
* windisplay.c
@@ -1450,17 +1393,15 @@ winGetDisplayName(char *szDisplay, unsigned int screen);
* winrandr.c
*/
Bool
-winRandRInit (ScreenPtr pScreen);
+ winRandRInit(ScreenPtr pScreen);
void
-winDoRandRScreenSetSize (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight);
+
+winDoRandRScreenSetSize(ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height, CARD32 mmWidth, CARD32 mmHeight);
/*
* END DDX and DIX Function Prototypes
*/
-#endif /* _WIN_H_ */
-
+#endif /* _WIN_H_ */
diff --git a/xorg-server/hw/xwin/winallpriv.c b/xorg-server/hw/xwin/winallpriv.c
index f4078207e..a263d3a7f 100644
--- a/xorg-server/hw/xwin/winallpriv.c
+++ b/xorg-server/hw/xwin/winallpriv.c
@@ -1,178 +1,168 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Keith Packard, MIT X Consortium
- * Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-
-/* See Porting Layer Definition - p. 58 */
-/*
- * Allocate indexes for the privates that we use.
- * Allocate memory directly for the screen privates.
- * Reserve space in GCs and Pixmaps for our privates.
- * Colormap privates are handled in winAllocateCmapPrivates ()
- */
-
-Bool
-winAllocatePrivates (ScreenPtr pScreen)
-{
- winPrivScreenPtr pScreenPriv;
-
- winDebug ("winAllocateScreenPrivates - g_ulServerGeneration: %d "
- "serverGeneration: %d\n",
- g_ulServerGeneration, serverGeneration);
-
- /* We need a new slot for our privates if the screen gen has changed */
- if (g_ulServerGeneration != serverGeneration)
- {
- g_ulServerGeneration = serverGeneration;
- }
-
- /* Allocate memory for the screen private structure */
- pScreenPriv = (winPrivScreenPtr) malloc (sizeof (winPrivScreenRec));
- if (!pScreenPriv)
- {
- ErrorF ("winAllocateScreenPrivates - malloc () failed\n");
- return FALSE;
- }
-
- /* Initialize the memory of the private structure */
- ZeroMemory (pScreenPriv, sizeof (winPrivScreenRec));
-
- /* Intialize private structure members */
- pScreenPriv->fActive = TRUE;
-
- /* Register our screen private */
- if (!dixRegisterPrivateKey(g_iScreenPrivateKey, PRIVATE_SCREEN, 0))
- {
- ErrorF ("winAllocatePrivates - dixRegisterPrivateKey () failed\n");
- return FALSE;
- }
-
- /* Save the screen private pointer */
- winSetScreenPriv (pScreen, pScreenPriv);
-
- /* Reserve GC memory for our privates */
- if (!dixRegisterPrivateKey(g_iGCPrivateKey, PRIVATE_GC, sizeof (winPrivGCRec)))
- {
- ErrorF ("winAllocatePrivates - AllocateGCPrivate () failed\n");
- return FALSE;
- }
-
- /* Reserve Pixmap memory for our privates */
- if (!dixRegisterPrivateKey(g_iPixmapPrivateKey, PRIVATE_PIXMAP, sizeof (winPrivPixmapRec)))
- {
- ErrorF ("winAllocatePrivates - AllocatePixmapPrivates () failed\n");
- return FALSE;
- }
-
- /* Reserve Window memory for our privates */
- if (!dixRegisterPrivateKey(g_iWindowPrivateKey, PRIVATE_WINDOW, sizeof (winPrivWinRec)))
- {
- ErrorF ("winAllocatePrivates () - AllocateWindowPrivates () failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/*
- * Colormap privates may be allocated after the default colormap has
- * already been created for some screens. This initialization procedure
- * is called for each default colormap that is found.
- */
-
-Bool
-winInitCmapPrivates (ColormapPtr pcmap, int index)
-{
- winDebug ("winInitCmapPrivates\n");
-
- /*
- * I see no way that this function can do anything useful
- * with only a ColormapPtr. We don't have the index for
- * our dev privates yet, so we can't really initialize
- * anything. Perhaps I am misunderstanding the purpose
- * of this function.
- */
- /* That's definitely true.
- * I therefore changed the API and added the index as argument.
- */
- return TRUE;
-}
-
-
-/*
- * Allocate memory for our colormap privates
- */
-
-Bool
-winAllocateCmapPrivates (ColormapPtr pCmap)
-{
- winPrivCmapPtr pCmapPriv;
- static unsigned long s_ulPrivateGeneration = 0;
-
- winDebug ("winAllocateCmapPrivates\n");
-
- /* Get a new privates index when the server generation changes */
- if (s_ulPrivateGeneration != serverGeneration)
- {
- /* Save the new server generation */
- s_ulPrivateGeneration = serverGeneration;
- }
-
- /* Allocate memory for our private structure */
- pCmapPriv = (winPrivCmapPtr) malloc (sizeof (winPrivCmapRec));
- if (!pCmapPriv)
- {
- ErrorF ("winAllocateCmapPrivates - malloc () failed\n");
- return FALSE;
- }
-
- /* Initialize the memory of the private structure */
- ZeroMemory (pCmapPriv, sizeof (winPrivCmapRec));
-
- /* Register our colourmap private */
- if (!dixRegisterPrivateKey(g_iCmapPrivateKey, PRIVATE_COLORMAP, 0))
- {
- ErrorF ("winAllocateCmapPrivates - AllocateCmapPrivate () failed\n");
- return FALSE;
- }
-
- /* Save the cmap private pointer */
- winSetCmapPriv (pCmap, pCmapPriv);
-
- winDebug ("winAllocateCmapPrivates - Returning\n");
-
- return TRUE;
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Keith Packard, MIT X Consortium
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+/* See Porting Layer Definition - p. 58 */
+/*
+ * Allocate indexes for the privates that we use.
+ * Allocate memory directly for the screen privates.
+ * Reserve space in GCs and Pixmaps for our privates.
+ * Colormap privates are handled in winAllocateCmapPrivates ()
+ */
+
+Bool
+winAllocatePrivates(ScreenPtr pScreen)
+{
+ winPrivScreenPtr pScreenPriv;
+
+ winDebug("winAllocateScreenPrivates - g_ulServerGeneration: %d "
+ "serverGeneration: %d\n", g_ulServerGeneration, serverGeneration);
+
+ /* We need a new slot for our privates if the screen gen has changed */
+ if (g_ulServerGeneration != serverGeneration) {
+ g_ulServerGeneration = serverGeneration;
+ }
+
+ /* Allocate memory for the screen private structure */
+ pScreenPriv = (winPrivScreenPtr) malloc(sizeof(winPrivScreenRec));
+ if (!pScreenPriv) {
+ ErrorF("winAllocateScreenPrivates - malloc () failed\n");
+ return FALSE;
+ }
+
+ /* Initialize the memory of the private structure */
+ ZeroMemory(pScreenPriv, sizeof(winPrivScreenRec));
+
+ /* Intialize private structure members */
+ pScreenPriv->fActive = TRUE;
+
+ /* Register our screen private */
+ if (!dixRegisterPrivateKey(g_iScreenPrivateKey, PRIVATE_SCREEN, 0)) {
+ ErrorF ("winAllocatePrivates - dixRegisterPrivateKey () failed\n");
+ return FALSE;
+ }
+
+ /* Save the screen private pointer */
+ winSetScreenPriv(pScreen, pScreenPriv);
+
+ /* Reserve GC memory for our privates */
+ if (!dixRegisterPrivateKey
+ (g_iGCPrivateKey, PRIVATE_GC, sizeof(winPrivGCRec))) {
+ ErrorF("winAllocatePrivates - AllocateGCPrivate () failed\n");
+ return FALSE;
+ }
+
+ /* Reserve Pixmap memory for our privates */
+ if (!dixRegisterPrivateKey
+ (g_iPixmapPrivateKey, PRIVATE_PIXMAP, sizeof(winPrivPixmapRec))) {
+ ErrorF("winAllocatePrivates - AllocatePixmapPrivates () failed\n");
+ return FALSE;
+ }
+
+ /* Reserve Window memory for our privates */
+ if (!dixRegisterPrivateKey
+ (g_iWindowPrivateKey, PRIVATE_WINDOW, sizeof(winPrivWinRec))) {
+ ErrorF("winAllocatePrivates () - AllocateWindowPrivates () failed\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/*
+ * Colormap privates may be allocated after the default colormap has
+ * already been created for some screens. This initialization procedure
+ * is called for each default colormap that is found.
+ */
+
+Bool
+winInitCmapPrivates(ColormapPtr pcmap, int index)
+{
+ winDebug("winInitCmapPrivates\n");
+
+ /*
+ * I see no way that this function can do anything useful
+ * with only a ColormapPtr. We don't have the index for
+ * our dev privates yet, so we can't really initialize
+ * anything. Perhaps I am misunderstanding the purpose
+ * of this function.
+ */
+ /* That's definitely true.
+ * I therefore changed the API and added the index as argument.
+ */
+ return TRUE;
+}
+
+/*
+ * Allocate memory for our colormap privates
+ */
+
+Bool
+winAllocateCmapPrivates(ColormapPtr pCmap)
+{
+ winPrivCmapPtr pCmapPriv;
+ static unsigned long s_ulPrivateGeneration = 0;
+
+ winDebug("winAllocateCmapPrivates\n");
+
+ /* Get a new privates index when the server generation changes */
+ if (s_ulPrivateGeneration != serverGeneration) {
+ /* Save the new server generation */
+ s_ulPrivateGeneration = serverGeneration;
+ }
+
+ /* Allocate memory for our private structure */
+ pCmapPriv = (winPrivCmapPtr) malloc(sizeof(winPrivCmapRec));
+ if (!pCmapPriv) {
+ ErrorF("winAllocateCmapPrivates - malloc () failed\n");
+ return FALSE;
+ }
+
+ /* Initialize the memory of the private structure */
+ ZeroMemory(pCmapPriv, sizeof(winPrivCmapRec));
+
+ /* Register our colourmap private */
+ if (!dixRegisterPrivateKey(g_iCmapPrivateKey, PRIVATE_COLORMAP, 0)) {
+ ErrorF("winAllocateCmapPrivates - AllocateCmapPrivate () failed\n");
+ return FALSE;
+ }
+
+ /* Save the cmap private pointer */
+ winSetCmapPriv(pCmap, pCmapPriv);
+
+ winDebug("winAllocateCmapPrivates - Returning\n");
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winauth.c b/xorg-server/hw/xwin/winauth.c
index b603f70f5..18e370ef7 100644
--- a/xorg-server/hw/xwin/winauth.c
+++ b/xorg-server/hw/xwin/winauth.c
@@ -1,216 +1,197 @@
-/*
- *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors: Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-
-#define GC X11_GC /* To avoid compilation errors later when including win.h (which also defines the GC type) */
-#include <X11/Xlib.h>
-#undef GC
-
-#include "win.h"
-
-/* Includes for authorization */
-#include "securitysrv.h"
-
-/*
- * Constants
- */
-
-#define AUTH_NAME "MIT-MAGIC-COOKIE-1"
-
-
-/*
- * Locals
- */
-
-static XID g_authId = 0;
-static unsigned int g_uiAuthDataLen = 0;
-static char *g_pAuthData = NULL;
-
-/*
- * Code to generate a MIT-MAGIC-COOKIE-1, copied from under XCSECURITY
- */
-
-
-
-#ifndef XCSECURITY
-static
-void
-GenerateRandomData (int len, char *buf)
-{
- int fd;
-#ifdef _MSC_VER
- static HANDLE hAdvApi32;
- static BOOLEAN (_stdcall * RtlGenRandom)(void *,unsigned long);
-
- if (!hAdvApi32)
- {
- hAdvApi32=LoadLibrary("advapi32.dll");
- RtlGenRandom=(BOOLEAN (_stdcall *)(void*,unsigned long))GetProcAddress(hAdvApi32,"SystemFunction036");
- }
- RtlGenRandom(buf, len);
-#else
- fd = open("/dev/urandom", O_RDONLY);
- read(fd, buf, len);
- close(fd);
-#endif
-}
-
-
-static char cookie[16]; /* 128 bits */
-
-XID
-static MitGenerateCookie (
- unsigned data_length,
- char *data,
- XID id,
- unsigned *data_length_return,
- char **data_return)
-{
- int i = 0;
- int status;
-
- while (data_length--)
- {
- cookie[i++] += *data++;
- if (i >= sizeof (cookie)) i = 0;
- }
- GenerateRandomData(sizeof (cookie), cookie);
- status = MitAddCookie(sizeof (cookie), cookie, id);
- if (!status)
- {
- id = -1;
- }
- else
- {
- *data_return = cookie;
- *data_length_return = sizeof (cookie);
- }
- return id;
-}
-
-static
-XID
-GenerateAuthorization(
- unsigned name_length,
- char *name,
- unsigned data_length,
- char *data,
- unsigned *data_length_return,
- char **data_return)
-{
- return MitGenerateCookie(data_length, data,
- FakeClientID(0), data_length_return, data_return);
-}
-#endif
-
-/*
- * Generate authorization cookie for internal server clients
- */
-
-Bool
-winGenerateAuthorization (void)
-{
- SecurityAuthorizationPtr pAuth = NULL;
-
- /* Call OS layer to generate authorization key */
- g_authId = GenerateAuthorization (strlen (AUTH_NAME),
- AUTH_NAME,
- 0,
- NULL,
- &g_uiAuthDataLen,
- &g_pAuthData);
- if ((XID) ~0L == g_authId)
- {
- ErrorF ("winGenerateAuthorization - GenerateAuthorization failed\n");
- goto auth_bailout;
- }
-#ifdef WINDBG
- else
- {
- winDebug("winGenerateAuthorization - GenerateAuthorization success!\n"
- "AuthDataLen: %d AuthData: %s\n",
- g_uiAuthDataLen, g_pAuthData);
- }
-#endif
-
-#ifdef XCSECURITY
- /* Allocate structure for additional auth information */
- pAuth = (SecurityAuthorizationPtr)
- malloc(sizeof (SecurityAuthorizationRec));
- if (!(pAuth))
- {
- ErrorF ("winGenerateAuthorization - Failed allocating "
- "SecurityAuthorizationPtr.\n");
- goto auth_bailout;
- }
-
- /* Fill in the auth fields */
- pAuth->id = g_authId;
- pAuth->timeout = 0; /* live for x seconds after refcnt == 0 */
- pAuth->group = None;
- pAuth->trustLevel = XSecurityClientTrusted;
- pAuth->refcnt = 1; /* this auth must stick around */
- pAuth->secondsRemaining = 0;
- pAuth->timer = NULL;
- pAuth->eventClients = NULL;
-
- /* Add the authorization to the server's auth list */
- if (!AddResource (g_authId,
- SecurityAuthorizationResType,
- pAuth))
- {
- ErrorF ("winGenerateAuthorization - AddResource failed for auth.\n");
- goto auth_bailout;
- }
-
- /* Don't free the auth data, since it is still used internally */
-#endif
-
- return TRUE;
-
- auth_bailout:
- free(pAuth);
-
- return FALSE;
-}
-
-/* Use our generated cookie for authentication */
-void
-winSetAuthorization(void)
-{
- if (g_pAuthData)
- XSetAuthorization (AUTH_NAME,
- strlen (AUTH_NAME),
- g_pAuthData,
- g_uiAuthDataLen);
-}
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
+#define GC X11_GC /* To avoid compilation errors later when including win.h (which also defines the GC type) */
+#include <X11/Xlib.h>
+#undef GC
+
+#include "win.h"
+
+/* Includes for authorization */
+#include "securitysrv.h"
+
+/*
+ * Constants
+ */
+
+#define AUTH_NAME "MIT-MAGIC-COOKIE-1"
+
+/*
+ * Locals
+ */
+
+static XID g_authId = 0;
+static unsigned int g_uiAuthDataLen = 0;
+static char *g_pAuthData = NULL;
+
+/*
+ * Code to generate a MIT-MAGIC-COOKIE-1, copied from under XCSECURITY
+ */
+
+
+
+#ifndef XCSECURITY
+static
+ void
+GenerateRandomData(int len, char *buf)
+{
+ int fd;
+#ifdef _MSC_VER
+ static HANDLE hAdvApi32;
+ static BOOLEAN (_stdcall * RtlGenRandom)(void *,unsigned long);
+
+ if (!hAdvApi32)
+ {
+ hAdvApi32=LoadLibrary("advapi32.dll");
+ RtlGenRandom=(BOOLEAN (_stdcall *)(void*,unsigned long))GetProcAddress(hAdvApi32,"SystemFunction036");
+ }
+ RtlGenRandom(buf, len);
+#else
+ fd = open("/dev/urandom", O_RDONLY);
+ read(fd, buf, len);
+ close(fd);
+#endif
+}
+
+static char cookie[16]; /* 128 bits */
+
+XID
+ static
+MitGenerateCookie(unsigned data_length,
+ char *data,
+ XID id, unsigned *data_length_return, char **data_return)
+{
+ int i = 0;
+ int status;
+
+ while (data_length--) {
+ cookie[i++] += *data++;
+ if (i >= sizeof(cookie))
+ i = 0;
+ }
+ GenerateRandomData(sizeof(cookie), cookie);
+ status = MitAddCookie(sizeof(cookie), cookie, id);
+ if (!status) {
+ id = -1;
+ }
+ else {
+ *data_return = cookie;
+ *data_length_return = sizeof(cookie);
+ }
+ return id;
+}
+
+static
+ XID
+GenerateAuthorization(unsigned name_length,
+ char *name,
+ unsigned data_length,
+ char *data,
+ unsigned *data_length_return, char **data_return)
+{
+ return MitGenerateCookie(data_length, data,
+ FakeClientID(0), data_length_return, data_return);
+}
+#endif
+
+/*
+ * Generate authorization cookie for internal server clients
+ */
+
+Bool
+winGenerateAuthorization(void)
+{
+ SecurityAuthorizationPtr pAuth = NULL;
+
+ /* Call OS layer to generate authorization key */
+ g_authId = GenerateAuthorization(strlen(AUTH_NAME),
+ AUTH_NAME,
+ 0, NULL, &g_uiAuthDataLen, &g_pAuthData);
+ if ((XID) ~0L == g_authId) {
+ ErrorF("winGenerateAuthorization - GenerateAuthorization failed\n");
+ goto auth_bailout;
+ }
+#ifdef WINDBG
+ else {
+ winDebug("winGenerateAuthorization - GenerateAuthorization success!\n"
+ "AuthDataLen: %d AuthData: %s\n",
+ g_uiAuthDataLen, g_pAuthData);
+ }
+#endif
+
+#ifdef XCSECURITY
+ /* Allocate structure for additional auth information */
+ pAuth = (SecurityAuthorizationPtr)
+ malloc(sizeof(SecurityAuthorizationRec));
+ if (!(pAuth)) {
+ ErrorF("winGenerateAuthorization - Failed allocating "
+ "SecurityAuthorizationPtr.\n");
+ goto auth_bailout;
+ }
+
+ /* Fill in the auth fields */
+ pAuth->id = g_authId;
+ pAuth->timeout = 0; /* live for x seconds after refcnt == 0 */
+ pAuth->group = None;
+ pAuth->trustLevel = XSecurityClientTrusted;
+ pAuth->refcnt = 1; /* this auth must stick around */
+ pAuth->secondsRemaining = 0;
+ pAuth->timer = NULL;
+ pAuth->eventClients = NULL;
+
+ /* Add the authorization to the server's auth list */
+ if (!AddResource(g_authId, SecurityAuthorizationResType, pAuth)) {
+ ErrorF("winGenerateAuthorization - AddResource failed for auth.\n");
+ goto auth_bailout;
+ }
+
+ /* Don't free the auth data, since it is still used internally */
+#endif
+
+ return TRUE;
+
+ auth_bailout:
+ free(pAuth);
+
+ return FALSE;
+}
+
+/* Use our generated cookie for authentication */
+void
+winSetAuthorization(void)
+{
+ if (g_pAuthData)
+ XSetAuthorization(AUTH_NAME,
+ strlen(AUTH_NAME), g_pAuthData, g_uiAuthDataLen);
+}
diff --git a/xorg-server/hw/xwin/winblock.c b/xorg-server/hw/xwin/winblock.c
index a70d7a42a..c18d080fa 100644
--- a/xorg-server/hw/xwin/winblock.c
+++ b/xorg-server/hw/xwin/winblock.c
@@ -1,96 +1,89 @@
-/*
- *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors: Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-#include "winmsg.h"
-
-/* See Porting Layer Definition - p. 6 */
-void
-winBlockHandler (int nScreen,
- pointer pBlockData,
- pointer pTimeout,
- pointer pReadMask)
-{
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- winScreenPriv((ScreenPtr)pBlockData);
-#endif
- MSG msg;
-#ifndef HAS_DEVWINDOWS
- struct timeval **tvp = pTimeout;
- if (*tvp != NULL)
- {
- (*tvp)->tv_sec = 0;
- (*tvp)->tv_usec = 100;
- }
-#endif
-
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Signal threaded modules to begin */
- if (pScreenPriv != NULL && !pScreenPriv->fServerStarted)
- {
- int iReturn;
-
- winDebug ("winBlockHandler - Releasing pmServerStarted\n");
-
- /* Flag that modules are to be started */
- pScreenPriv->fServerStarted = TRUE;
-
- /* Unlock the mutex for threaded modules */
- iReturn = pthread_mutex_unlock (&pScreenPriv->pmServerStarted);
- if (iReturn != 0)
- {
- ErrorF ("winBlockHandler - pthread_mutex_unlock () failed: %d\n",
- iReturn);
- goto winBlockHandler_ProcessMessages;
- }
-
- winDebug ("winBlockHandler - pthread_mutex_unlock () returned\n");
- }
-
-winBlockHandler_ProcessMessages:
-#endif
-
- /* Process all messages on our queue */
- while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
- {
- if ((g_hDlgDepthChange == 0
- || !IsDialogMessage (g_hDlgDepthChange, &msg))
- && (g_hDlgExit == 0
- || !IsDialogMessage (g_hDlgExit, &msg))
- && (g_hDlgAbout == 0
- || !IsDialogMessage (g_hDlgAbout, &msg)))
- {
- DispatchMessage (&msg);
- }
- }
-}
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winmsg.h"
+
+/* See Porting Layer Definition - p. 6 */
+void
+winBlockHandler(int nScreen,
+ pointer pBlockData, pointer pTimeout, pointer pReadMask)
+{
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ winScreenPriv((ScreenPtr) pBlockData);
+#endif
+ MSG msg;
+
+#ifndef HAS_DEVWINDOWS
+ struct timeval **tvp = pTimeout;
+
+ if (*tvp != NULL) {
+ (*tvp)->tv_sec = 0;
+ (*tvp)->tv_usec = 100;
+ }
+#endif
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Signal threaded modules to begin */
+ if (pScreenPriv != NULL && !pScreenPriv->fServerStarted) {
+ int iReturn;
+
+ winDebug("winBlockHandler - Releasing pmServerStarted\n");
+
+ /* Flag that modules are to be started */
+ pScreenPriv->fServerStarted = TRUE;
+
+ /* Unlock the mutex for threaded modules */
+ iReturn = pthread_mutex_unlock(&pScreenPriv->pmServerStarted);
+ if (iReturn != 0) {
+ ErrorF("winBlockHandler - pthread_mutex_unlock () failed: %d\n",
+ iReturn);
+ goto winBlockHandler_ProcessMessages;
+ }
+
+ winDebug("winBlockHandler - pthread_mutex_unlock () returned\n");
+ }
+
+ winBlockHandler_ProcessMessages:
+#endif
+
+ /* Process all messages on our queue */
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if ((g_hDlgDepthChange == 0
+ || !IsDialogMessage(g_hDlgDepthChange, &msg))
+ && (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg))
+ && (g_hDlgAbout == 0 || !IsDialogMessage(g_hDlgAbout, &msg))) {
+ DispatchMessage(&msg);
+ }
+ }
+}
diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h
index 41acfecce..d430b343f 100644
--- a/xorg-server/hw/xwin/winclipboard.h
+++ b/xorg-server/hw/xwin/winclipboard.h
@@ -58,12 +58,11 @@ typedef int pid_t;
/* Windows headers */
#include <X11/Xwindows.h>
-
/* Clipboard module constants */
#define WIN_CLIPBOARD_WINDOW_CLASS "xwinclip"
#define WIN_CLIPBOARD_WINDOW_TITLE "xwinclip"
#ifdef HAS_DEVWINDOWS
-# define WIN_MSG_QUEUE_FNAME "/dev/windows"
+#define WIN_MSG_QUEUE_FNAME "/dev/windows"
#endif
#define WIN_CONNECT_RETRIES 40
#define WIN_CONNECT_DELAY 4
@@ -82,68 +81,56 @@ typedef int pid_t;
*/
extern char *display;
-
/*
* winclipboardinit.c
*/
Bool
-winInitClipboard (void);
-
-HWND
-winClipboardCreateMessagingWindow (void);
+ winInitClipboard(void);
+HWND winClipboardCreateMessagingWindow(void);
/*
* winclipboardtextconv.c
*/
void
-winClipboardDOStoUNIX (char *pszData, int iLength);
+ winClipboardDOStoUNIX(char *pszData, int iLength);
void
-winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
-
+ winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
/*
* winclipboardthread.c
*/
-void *
-winClipboardProc (void *);
+void *winClipboardProc(void *);
void
-winDeinitClipboard (void);
-
+ winDeinitClipboard(void);
/*
* winclipboardunicode.c
*/
Bool
-winClipboardDetectUnicodeSupport (void);
-
+ winClipboardDetectUnicodeSupport(void);
/*
* winclipboardwndproc.c
*/
-BOOL
-winClipboardFlushWindowsMessageQueue (HWND hwnd);
+BOOL winClipboardFlushWindowsMessageQueue(HWND hwnd);
LRESULT CALLBACK
-winClipboardWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-
+winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
/*
* winclipboardxevents.c
*/
int
-winClipboardFlushXEvents (HWND hwnd,
- int iWindow,
- Display *pDisplay,
- Bool fUnicodeSupport,
- Bool ClipboardOpened);
+
+winClipboardFlushXEvents(HWND hwnd,
+ int iWindow, Display * pDisplay, Bool fUnicodeSupport, Bool ClipboardOpened);
#endif
diff --git a/xorg-server/hw/xwin/winclipboardinit.c b/xorg-server/hw/xwin/winclipboardinit.c
index d5990900a..1ddb35775 100644
--- a/xorg-server/hw/xwin/winclipboardinit.c
+++ b/xorg-server/hw/xwin/winclipboardinit.c
@@ -1,148 +1,137 @@
-/*
- *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors: Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "dixstruct.h"
-#include "winclipboard.h"
-#include "objbase.h"
-#include "ddraw.h"
-#include "winwindow.h"
-
-
-/*
- * Local typedefs
- */
-
-typedef int (*winDispatchProcPtr) (ClientPtr);
-
-int winProcSetSelectionOwner(ClientPtr /* client */);
-
-
-/*
- * References to external symbols
- */
-
-extern pthread_t g_ptClipboardProc;
-extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
-extern Bool g_fClipboard;
-extern HWND g_hwndClipboard;
-
-
-/*
- * Intialize the Clipboard module
- */
-
-Bool
-winInitClipboard (void)
-{
- winDebug ("winInitClipboard ()\n");
-
- /* Wrap some internal server functions */
- if (ProcVector[X_SetSelectionOwner] != winProcSetSelectionOwner)
- {
- winProcSetSelectionOwnerOrig = ProcVector[X_SetSelectionOwner];
- ProcVector[X_SetSelectionOwner] = winProcSetSelectionOwner;
- }
-
- /* Spawn a thread for the Clipboard module */
- if (pthread_create (&g_ptClipboardProc,
- NULL,
- winClipboardProc,
- NULL))
- {
- /* Bail if thread creation failed */
- ErrorF ("winInitClipboard - pthread_create failed.\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/*
- * Create the Windows window that we use to recieve Windows messages
- */
-
-HWND
-winClipboardCreateMessagingWindow (void)
-{
- WNDCLASSEX wc;
- HWND hwnd;
-
- /* Setup our window class */
- wc.cbSize=sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = winClipboardWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = GetModuleHandle (NULL);
- wc.hIcon = 0;
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = WIN_CLIPBOARD_WINDOW_CLASS;
- wc.hIconSm = 0;
- RegisterClassEx (&wc);
-
- /* Create the window */
- hwnd = CreateWindowExA (0, /* Extended styles */
- WIN_CLIPBOARD_WINDOW_CLASS,/* Class name */
- WIN_CLIPBOARD_WINDOW_TITLE,/* Window name */
- WS_OVERLAPPED, /* Not visible anyway */
- CW_USEDEFAULT, /* Horizontal position */
- CW_USEDEFAULT, /* Vertical position */
- CW_USEDEFAULT, /* Right edge */
- CW_USEDEFAULT, /* Bottom edge */
- (HWND) NULL, /* No parent or owner window */
- (HMENU) NULL, /* No menu */
- GetModuleHandle (NULL),/* Instance handle */
- NULL); /* Creation data */
- assert (hwnd != NULL);
-
- /* I'm not sure, but we may need to call this to start message processing */
- ShowWindow (hwnd, SW_HIDE);
-
- /* Similarly, we may need a call to this even though we don't paint */
- UpdateWindow (hwnd);
-
- return hwnd;
-}
-
-void
-winFixClipboardChain (int Removed)
-{
- if (g_fClipboard
- && g_hwndClipboard)
- {
- PostMessage (g_hwndClipboard, WM_WM_REINIT, Removed, 0);
- }
-}
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "dixstruct.h"
+#include "winclipboard.h"
+#include "objbase.h"
+#include "ddraw.h"
+#include "winwindow.h"
+
+/*
+ * Local typedefs
+ */
+
+typedef int (*winDispatchProcPtr) (ClientPtr);
+
+int winProcSetSelectionOwner(ClientPtr /* client */ );
+
+/*
+ * References to external symbols
+ */
+
+extern pthread_t g_ptClipboardProc;
+extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
+extern Bool g_fClipboard;
+extern HWND g_hwndClipboard;
+
+/*
+ * Intialize the Clipboard module
+ */
+
+Bool
+winInitClipboard(void)
+{
+ winDebug ("winInitClipboard ()\n");
+
+ /* Wrap some internal server functions */
+ if (ProcVector[X_SetSelectionOwner] != winProcSetSelectionOwner) {
+ winProcSetSelectionOwnerOrig = ProcVector[X_SetSelectionOwner];
+ ProcVector[X_SetSelectionOwner] = winProcSetSelectionOwner;
+ }
+
+ /* Spawn a thread for the Clipboard module */
+ if (pthread_create(&g_ptClipboardProc, NULL, winClipboardProc, NULL)) {
+ /* Bail if thread creation failed */
+ ErrorF("winInitClipboard - pthread_create failed.\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/*
+ * Create the Windows window that we use to recieve Windows messages
+ */
+
+HWND
+winClipboardCreateMessagingWindow(void)
+{
+ WNDCLASSEX wc;
+ HWND hwnd;
+
+ /* Setup our window class */
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winClipboardWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = GetModuleHandle(NULL);
+ wc.hIcon = 0;
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WIN_CLIPBOARD_WINDOW_CLASS;
+ wc.hIconSm = 0;
+ RegisterClassEx(&wc);
+
+ /* Create the window */
+ hwnd = CreateWindowExA(0, /* Extended styles */
+ WIN_CLIPBOARD_WINDOW_CLASS, /* Class name */
+ WIN_CLIPBOARD_WINDOW_TITLE, /* Window name */
+ WS_OVERLAPPED, /* Not visible anyway */
+ CW_USEDEFAULT, /* Horizontal position */
+ CW_USEDEFAULT, /* Vertical position */
+ CW_USEDEFAULT, /* Right edge */
+ CW_USEDEFAULT, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle(NULL), /* Instance handle */
+ NULL); /* Creation data */
+ assert(hwnd != NULL);
+
+ /* I'm not sure, but we may need to call this to start message processing */
+ ShowWindow(hwnd, SW_HIDE);
+
+ /* Similarly, we may need a call to this even though we don't paint */
+ UpdateWindow(hwnd);
+
+ return hwnd;
+}
+
+void
+winFixClipboardChain(int Removed)
+{
+ if (g_fClipboard && g_hwndClipboard) {
+ PostMessage (g_hwndClipboard, WM_WM_REINIT, Removed, 0);
+ }
+}
diff --git a/xorg-server/hw/xwin/winclipboardtextconv.c b/xorg-server/hw/xwin/winclipboardtextconv.c
index 400f560fa..74a351b17 100644
--- a/xorg-server/hw/xwin/winclipboardtextconv.c
+++ b/xorg-server/hw/xwin/winclipboardtextconv.c
@@ -36,9 +36,9 @@
#include <stdlib.h>
void
-winClipboardDOStoUNIX (char *pszSrc, int iLength);
+ winClipboardDOStoUNIX(char *pszSrc, int iLength);
void
-winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
+ winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
/*
* Convert \r\n to \n
@@ -48,108 +48,100 @@ winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
*/
void
-winClipboardDOStoUNIX (char *pszSrc, int iLength)
+winClipboardDOStoUNIX(char *pszSrc, int iLength)
{
- char *pszDest = pszSrc;
- char *pszEnd = pszSrc + iLength;
+ char *pszDest = pszSrc;
+ char *pszEnd = pszSrc + iLength;
- /* Loop until the last character */
- while (pszSrc < pszEnd)
- {
- /* Copy the current source character to current destination character */
- *pszDest = *pszSrc;
+ /* Loop until the last character */
+ while (pszSrc < pszEnd) {
+ /* Copy the current source character to current destination character */
+ *pszDest = *pszSrc;
- /* Advance to the next source character */
- pszSrc++;
+ /* Advance to the next source character */
+ pszSrc++;
- /* Don't advance the destination character if we need to drop an \r */
- if (*pszDest != '\r' || *pszSrc != '\n')
- pszDest++;
+ /* Don't advance the destination character if we need to drop an \r */
+ if (*pszDest != '\r' || *pszSrc != '\n')
+ pszDest++;
}
- /* Move the terminating null */
- *pszDest = '\0';
+ /* Move the terminating null */
+ *pszDest = '\0';
}
-
/*
* Convert \n to \r\n
*/
void
-winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength)
+winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength)
{
- int iNewlineCount = 0;
- unsigned char *pszSrc = *ppszData;
- unsigned char *pszEnd = pszSrc + iLength;
- unsigned char *pszDest = NULL, *pszDestBegin = NULL;
-
- winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData);
-
- /* Count \n characters without leading \r */
- while (pszSrc < pszEnd)
- {
- /* Skip ahead two character if found set of \r\n */
- if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n')
- {
- pszSrc += 2;
- continue;
- }
-
- /* Increment the count if found naked \n */
- if (*pszSrc == '\n')
- {
- iNewlineCount++;
- }
-
- pszSrc++;
+ int iNewlineCount = 0;
+ unsigned char *pszSrc = *ppszData;
+ unsigned char *pszEnd = pszSrc + iLength;
+ unsigned char *pszDest = NULL, *pszDestBegin = NULL;
+
+ winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData);
+
+ /* Count \n characters without leading \r */
+ while (pszSrc < pszEnd) {
+ /* Skip ahead two character if found set of \r\n */
+ if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n') {
+ pszSrc += 2;
+ continue;
+ }
+
+ /* Increment the count if found naked \n */
+ if (*pszSrc == '\n') {
+ iNewlineCount++;
+ }
+
+ pszSrc++;
}
-
- /* Return if no naked \n's */
- if (iNewlineCount == 0)
- return;
-
- /* Allocate a new string */
- pszDestBegin = pszDest = malloc (iLength + iNewlineCount + 1);
-
- /* Set source pointer to beginning of data string */
- pszSrc = *ppszData;
-
- /* Loop through all characters in source string */
- while (pszSrc < pszEnd)
- {
- /* Copy line endings that are already valid */
- if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n')
- {
- *pszDest = *pszSrc;
- *(pszDest + 1) = *(pszSrc + 1);
- pszDest += 2;
- pszSrc += 2;
- continue;
- }
-
- /* Add \r to naked \n's */
- if (*pszSrc == '\n')
- {
- *pszDest = '\r';
- *(pszDest + 1) = *pszSrc;
- pszDest += 2;
- pszSrc += 1;
- continue;
- }
-
- /* Copy normal characters */
- *pszDest = *pszSrc;
- pszSrc++;
- pszDest++;
+
+ /* Return if no naked \n's */
+ if (iNewlineCount == 0)
+ return;
+
+ /* Allocate a new string */
+ pszDestBegin = pszDest = malloc(iLength + iNewlineCount + 1);
+
+ /* Set source pointer to beginning of data string */
+ pszSrc = *ppszData;
+
+ /* Loop through all characters in source string */
+ while (pszSrc < pszEnd) {
+ /* Copy line endings that are already valid */
+ if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n') {
+ *pszDest = *pszSrc;
+ *(pszDest + 1) = *(pszSrc + 1);
+ pszDest += 2;
+ pszSrc += 2;
+ continue;
+ }
+
+ /* Add \r to naked \n's */
+ if (*pszSrc == '\n') {
+ *pszDest = '\r';
+ *(pszDest + 1) = *pszSrc;
+ pszDest += 2;
+ pszSrc += 1;
+ continue;
+ }
+
+ /* Copy normal characters */
+ *pszDest = *pszSrc;
+ pszSrc++;
+ pszDest++;
}
- /* Put terminating null at end of new string */
- *pszDest = '\0';
+ /* Put terminating null at end of new string */
+ *pszDest = '\0';
- /* Swap string pointers */
- free (*ppszData);
- *ppszData = pszDestBegin;
+ /* Swap string pointers */
+ free(*ppszData);
+ *ppszData = pszDestBegin;
- winDebug("UNIXtoDOS () - Final string:'%s'\n", pszDestBegin);
+ winDebug("UNIXtoDOS () - Final string:'%s'\n", pszDestBegin);
}
diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c
index 758bbd32d..50643149b 100644
--- a/xorg-server/hw/xwin/winclipboardthread.c
+++ b/xorg-server/hw/xwin/winclipboardthread.c
@@ -46,42 +46,39 @@
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
-
/*
* References to external symbols
*/
-extern Bool g_fUnicodeClipboard;
-extern unsigned long serverGeneration;
-extern Bool g_fClipboardStarted;
-extern Bool g_fClipboardLaunched;
-extern HWND g_hwndClipboard;
-extern void *g_pClipboardDisplay;
-extern Window g_iClipboardWindow;
+extern Bool g_fUnicodeClipboard;
+extern unsigned long serverGeneration;
+extern Bool g_fClipboardStarted;
+extern Bool g_fClipboardLaunched;
+extern HWND g_hwndClipboard;
+extern void *g_pClipboardDisplay;
+extern Window g_iClipboardWindow;
extern Bool g_fClipboardPrimary;
-
/*
* Global variables
*/
-static jmp_buf g_jmpEntry;
+static jmp_buf g_jmpEntry;
static XIOErrorHandler g_winClipboardOldIOErrorHandler;
static pthread_t g_winClipboardProcThread;
-Bool g_fUnicodeSupport = FALSE;
-Bool g_fUseUnicode = FALSE;
-
+Bool g_fUnicodeSupport = FALSE;
+Bool g_fUseUnicode = FALSE;
/*
* Local function prototypes
*/
static int
-winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr);
+ winClipboardErrorHandler(Display * pDisplay, XErrorEvent * pErr);
static int
-winClipboardIOErrorHandler (Display *pDisplay);
+ winClipboardIOErrorHandler(Display * pDisplay);
static void
winClipboardThreadExit(void *arg);
@@ -90,348 +87,321 @@ winClipboardThreadExit(void *arg);
*/
void *
-winClipboardProc (void *pvNotUsed)
+winClipboardProc(void *pvNotUsed)
{
- Atom atomClipboard, atomClipboardManager;
- int iReturn;
- HWND hwnd = NULL;
- int iConnectionNumber = 0;
+ Atom atomClipboard, atomClipboardManager;
+ int iReturn;
+ HWND hwnd = NULL;
+ int iConnectionNumber = 0;
+
#ifdef HAS_DEVWINDOWS
- int fdMessageQueue = 0;
+ int fdMessageQueue = 0;
#else
- struct timeval tvTimeout;
+ struct timeval tvTimeout;
#endif
- fd_set fdsRead;
- int iMaxDescriptor;
- Display *pDisplay = NULL;
- Window iWindow = None;
- int iRetries;
- Bool fUseUnicode;
- char szDisplay[512];
- int iSelectError;
-
- pthread_cleanup_push(&winClipboardThreadExit, NULL);
+ fd_set fdsRead;
+ int iMaxDescriptor;
+ Display *pDisplay = NULL;
+ Window iWindow = None;
+ int iRetries;
+ Bool fUseUnicode;
+ char szDisplay[512];
+ int iSelectError;
- winDebug ("winClipboardProc - Hello\n");
+ pthread_cleanup_push(&winClipboardThreadExit, NULL);
- /* Do we have Unicode support? */
- g_fUnicodeSupport = winClipboardDetectUnicodeSupport ();
+ winDebug ("winClipboardProc - Hello\n");
- /* Do we use Unicode clipboard? */
- fUseUnicode = g_fUnicodeClipboard && g_fUnicodeSupport;
+ /* Do we have Unicode support? */
+ g_fUnicodeSupport = winClipboardDetectUnicodeSupport();
- /* Save the Unicode support flag in a global */
- g_fUseUnicode = fUseUnicode;
+ /* Do we use Unicode clipboard? */
+ fUseUnicode = g_fUnicodeClipboard && g_fUnicodeSupport;
- /* Create Windows messaging window */
- hwnd = winClipboardCreateMessagingWindow ();
-
- /* Save copy of HWND in screen privates */
- g_hwndClipboard = hwnd;
-
- /* Set error handler */
- XSetErrorHandler (winClipboardErrorHandler);
- g_winClipboardProcThread = pthread_self();
- g_winClipboardOldIOErrorHandler = XSetIOErrorHandler (winClipboardIOErrorHandler);
+ /* Save the Unicode support flag in a global */
+ g_fUseUnicode = fUseUnicode;
- /* Set jump point for Error exits */
- iReturn = setjmp (g_jmpEntry);
+ /* Create Windows messaging window */
+ hwnd = winClipboardCreateMessagingWindow ();
- /* Check if we should continue operations */
- if (iReturn != WIN_JMP_ERROR_IO
- && iReturn != WIN_JMP_OKAY)
- {
- /* setjmp returned an unknown value, exit */
- ErrorF ("winClipboardProc - setjmp returned: %d exiting\n",
- iReturn);
- goto thread_errorexit;
+ /* Save copy of HWND in screen privates */
+ g_hwndClipboard = hwnd;
+
+ /* Set error handler */
+ XSetErrorHandler(winClipboardErrorHandler);
+ g_winClipboardProcThread = pthread_self();
+ g_winClipboardOldIOErrorHandler =
+ XSetIOErrorHandler(winClipboardIOErrorHandler);
+
+ /* Set jump point for Error exits */
+ iReturn = setjmp(g_jmpEntry);
+
+ /* Check if we should continue operations */
+ if (iReturn != WIN_JMP_ERROR_IO && iReturn != WIN_JMP_OKAY) {
+ /* setjmp returned an unknown value, exit */
+ ErrorF("winClipboardProc - setjmp returned: %d exiting\n", iReturn);
+ goto thread_errorexit;
}
- else if (iReturn == WIN_JMP_ERROR_IO)
- {
- /* TODO: Cleanup the Win32 window and free any allocated memory */
- ErrorF ("winClipboardProc - setjmp returned for IO Error Handler.\n");
+ else if (iReturn == WIN_JMP_ERROR_IO) {
+ /* TODO: Cleanup the Win32 window and free any allocated memory */
+ ErrorF("winClipboardProc - setjmp returned for IO Error Handler.\n");
}
- /* Use our generated cookie for authentication */
- winSetAuthorization();
-
- /* Initialize retry count */
- iRetries = 0;
-
- /* Setup the display connection string x */
- /*
- * NOTE: Always connect to screen 0 since we require that screen
- * numbers start at 0 and increase without gaps. We only need
- * to connect to one screen on the display to get events
- * for all screens on the display. That is why there is only
- * one clipboard client thread.
- */
- winGetDisplayName(szDisplay,0);
-
- /* Print the display connection string */
- winDebug ("winClipboardProc - DISPLAY=%s\n", szDisplay);
-
- /* Open the X display */
- do
- {
- pDisplay = XOpenDisplay (szDisplay);
- if (pDisplay == NULL)
- {
- ErrorF ("winClipboardProc - Could not open display, "
- "try: %d, sleeping: %d\n",
- iRetries + 1, WIN_CONNECT_DELAY);
- ++iRetries;
- sleep (WIN_CONNECT_DELAY);
- continue;
- }
- else
- break;
+ /* Use our generated cookie for authentication */
+ winSetAuthorization();
+
+ /* Initialize retry count */
+ iRetries = 0;
+
+ /* Setup the display connection string x */
+ /*
+ * NOTE: Always connect to screen 0 since we require that screen
+ * numbers start at 0 and increase without gaps. We only need
+ * to connect to one screen on the display to get events
+ * for all screens on the display. That is why there is only
+ * one clipboard client thread.
+ */
+ winGetDisplayName(szDisplay,0);
+
+ /* Print the display connection string */
+ winDebug ("winClipboardProc - DISPLAY=%s\n", szDisplay);
+
+ /* Open the X display */
+ do {
+ pDisplay = XOpenDisplay(szDisplay);
+ if (pDisplay == NULL) {
+ ErrorF("winClipboardProc - Could not open display, "
+ "try: %d, sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY);
+ ++iRetries;
+ sleep(WIN_CONNECT_DELAY);
+ continue;
+ }
+ else
+ break;
}
- while (pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
+ while (pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
- /* Make sure that the display opened */
- if (pDisplay == NULL)
- {
- ErrorF ("winClipboardProc - Failed opening the display, giving up\n");
- goto thread_errorexit;
+ /* Make sure that the display opened */
+ if (pDisplay == NULL) {
+ ErrorF("winClipboardProc - Failed opening the display, giving up\n");
+ goto thread_errorexit;
}
- /* Save the display in the screen privates */
- g_pClipboardDisplay = pDisplay;
+ /* Save the display in the screen privates */
+ g_pClipboardDisplay = pDisplay;
- winDebug ("winClipboardProc - XOpenDisplay () returned and "
- "successfully opened the display.\n");
+ winDebug ("winClipboardProc - XOpenDisplay () returned and "
+ "successfully opened the display.\n");
- /* Get our connection number */
- iConnectionNumber = ConnectionNumber (pDisplay);
+ /* Get our connection number */
+ iConnectionNumber = ConnectionNumber(pDisplay);
- winDebug("Clipboard is using socket %d\n",iConnectionNumber);
+ winDebug("Clipboard is using socket %d\n",iConnectionNumber);
#ifdef HAS_DEVWINDOWS
- /* Open a file descriptor for the windows message queue */
- fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, _O_RDONLY);
- if (fdMessageQueue == -1)
- {
- ErrorF ("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
+ /* Open a file descriptor for the windows message queue */
+ fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, _O_RDONLY);
+ if (fdMessageQueue == -1) {
+ ErrorF("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
goto thread_errorexit;
}
- /* Find max of our file descriptors */
- iMaxDescriptor = max (fdMessageQueue, iConnectionNumber) + 1;
+ /* Find max of our file descriptors */
+ iMaxDescriptor = max(fdMessageQueue, iConnectionNumber) + 1;
#else
- iMaxDescriptor = iConnectionNumber + 1;
+ iMaxDescriptor = iConnectionNumber + 1;
#endif
- /* Create atoms */
- atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
- atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False);
- XInternAtom (pDisplay, WIN_LOCAL_PROPERTY, False);
- XInternAtom (pDisplay, "UTF8_STRING", False);
- XInternAtom (pDisplay, "COMPOUND_TEXT", False);
- XInternAtom (pDisplay, "TARGETS", False);
-
- /* Create a messaging window */
- iWindow = XCreateSimpleWindow (pDisplay,
- DefaultRootWindow (pDisplay),
- 1, 1,
- 500, 500,
- 0,
- BlackPixel (pDisplay, 0),
- BlackPixel (pDisplay, 0));
- if (iWindow == 0)
- {
- ErrorF ("winClipboardProc - Could not create an X window.\n");
- goto thread_errorexit;
+ /* Create atoms */
+ atomClipboard = XInternAtom(pDisplay, "CLIPBOARD", False);
+ atomClipboardManager = XInternAtom(pDisplay, "CLIPBOARD_MANAGER", False);
+ XInternAtom (pDisplay, WIN_LOCAL_PROPERTY, False);
+ XInternAtom (pDisplay, "UTF8_STRING", False);
+ XInternAtom (pDisplay, "COMPOUND_TEXT", False);
+ XInternAtom (pDisplay, "TARGETS", False);
+
+ /* Create a messaging window */
+ iWindow = XCreateSimpleWindow(pDisplay,
+ DefaultRootWindow(pDisplay),
+ 1, 1,
+ 500, 500,
+ 0,
+ BlackPixel(pDisplay, 0),
+ BlackPixel(pDisplay, 0));
+ if (iWindow == 0) {
+ ErrorF("winClipboardProc - Could not create an X window.\n");
+ goto thread_errorexit;
}
- XStoreName(pDisplay, iWindow, "xwinclip");
+ XStoreName(pDisplay, iWindow, "xwinclip");
- /* Select event types to watch */
- if (XSelectInput (pDisplay,
- iWindow,
- PropertyChangeMask) == BadWindow)
- ErrorF ("winClipboardProc - XSelectInput generated BadWindow "
- "on messaging window\n");
+ /* Select event types to watch */
+ if (XSelectInput(pDisplay, iWindow, PropertyChangeMask) == BadWindow)
+ ErrorF("winClipboardProc - XSelectInput generated BadWindow "
+ "on messaging window\n");
- /* Save the window in the screen privates */
- g_iClipboardWindow = iWindow;
+ /* Save the window in the screen privates */
+ g_iClipboardWindow = iWindow;
- /* Assert ownership of selections if Win32 clipboard is owned */
- if (NULL != GetClipboardOwner ())
- {
+ /* Assert ownership of selections if Win32 clipboard is owned */
+ if (NULL != GetClipboardOwner()) {
if (g_fClipboardPrimary)
{
- /* PRIMARY */
- winDebug("winClipboardProc - asserted ownership.\n");
- iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
- iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow /*||
- XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow*/)
- {
- ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
- goto thread_errorexit;
- }
+ /* PRIMARY */
+ winDebug("winClipboardProc - asserted ownership.\n");
+ iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
+ iWindow, CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow /*||
+ XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow*/)
+ {
+ ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
+ goto thread_errorexit;
+ }
}
- /* CLIPBOARD */
- iReturn = XSetSelectionOwner (pDisplay, atomClipboard,
- iWindow, CurrentTime);
+ /* CLIPBOARD */
+ iReturn = XSetSelectionOwner(pDisplay, atomClipboard,
+ iWindow, CurrentTime);
if (iReturn == BadAtom || iReturn == BadWindow /*||
- XGetSelectionOwner (pDisplay, atomClipboard) != iWindow*/)
- {
- ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
- goto thread_errorexit;
- }
+ XGetSelectionOwner (pDisplay, atomClipboard) != iWindow*/)
+ {
+ ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
+ goto thread_errorexit;
+ }
}
- /* Pre-flush X events */
- /*
- * NOTE: Apparently you'll freeze if you don't do this,
- * because there may be events in local data structures
- * already.
- */
- /*winClipboardFlushXEvents (hwnd,
- iWindow,
- pDisplay,
- fUseUnicode);
- */
- /* Pre-flush Windows messages */
- winDebug ("Start flushing \n");
- if (!winClipboardFlushWindowsMessageQueue (hwnd))
- {
- ErrorF ("winClipboardFlushWindowsMessageQueue - returned 0\n");
- goto thread_errorexit;
- }
-
- winDebug ("winClipboardProc - Started\n");
- /* Signal that the clipboard client has started */
- g_fClipboardStarted = TRUE;
-
- /* Loop for X events */
- while (1)
+ /* Pre-flush X events */
+ /*
+ * NOTE: Apparently you'll freeze if you don't do this,
+ * because there may be events in local data structures
+ * already.
+ */
+ //winClipboardFlushXEvents(hwnd, iWindow, pDisplay, fUseUnicode);
+
+ /* Pre-flush Windows messages */
+ winDebug ("Start flushing \n");
+ if (!winClipboardFlushWindowsMessageQueue(hwnd))
{
- /* Setup the file descriptor set */
- /*
- * NOTE: You have to do this before every call to select
- * because select modifies the mask to indicate
- * which descriptors are ready.
- */
- FD_ZERO (&fdsRead);
- FD_SET (iConnectionNumber, &fdsRead);
+ ErrorF ("winClipboardFlushWindowsMessageQueue - returned 0\n");
+ goto thread_errorexit;
+ }
+
+ winDebug ("winClipboardProc - Started\n");
+ /* Signal that the clipboard client has started */
+ g_fClipboardStarted = TRUE;
+
+ /* Loop for X events */
+ while (1) {
+ /* Setup the file descriptor set */
+ /*
+ * NOTE: You have to do this before every call to select
+ * because select modifies the mask to indicate
+ * which descriptors are ready.
+ */
+ FD_ZERO(&fdsRead);
+ FD_SET(iConnectionNumber, &fdsRead);
#ifdef HAS_DEVWINDOWS
- FD_SET (fdMessageQueue, &fdsRead);
+ FD_SET(fdMessageQueue, &fdsRead);
#else
- tvTimeout.tv_sec = 0;
- tvTimeout.tv_usec = 100;
+ tvTimeout.tv_sec = 0;
+ tvTimeout.tv_usec = 100;
#endif
- /* Wait for a Windows event or an X event */
- iReturn = select (iMaxDescriptor, /* Highest fds number */
- &fdsRead, /* Read mask */
- NULL, /* No write mask */
- NULL, /* No exception mask */
+ /* Wait for a Windows event or an X event */
+ iReturn = select(iMaxDescriptor, /* Highest fds number */
+ &fdsRead, /* Read mask */
+ NULL, /* No write mask */
+ NULL, /* No exception mask */
#ifdef HAS_DEVWINDOWS
- NULL /* No timeout */
+ NULL /* No timeout */
#else
- &tvTimeout /* Set timeout */
+ &tvTimeout /* Set timeout */
#endif
- );
+ );
#ifndef HAS_WINSOCK
- iSelectError = errno;
+ iSelectError = errno;
#else
- iSelectError = WSAGetLastError();
+ iSelectError = WSAGetLastError();
#endif
- if (iReturn < 0)
- {
+ if (iReturn < 0) {
#ifndef HAS_WINSOCK
- if (iSelectError == EINTR)
+ if (iSelectError == EINTR)
#else
- if (iSelectError == WSAEINTR)
+ if (iSelectError == WSAEINTR)
#endif
- continue;
-
- ErrorF ("winClipboardProc - Call to select () failed: %d. "
- "Bailing.\n", iReturn);
- break;
- }
+ continue;
- /* Branch on which descriptor became active */
+ ErrorF("winClipboardProc - Call to select () failed: %d. "
+ "Bailing.\n", iReturn);
+ break;
+ }
+
+ /* Branch on which descriptor became active */
// if (FD_ISSET (iConnectionNumber, &fdsRead))
// { Also do it when no read since winClipboardFlushXEvents
// is sending the output.
- /* Process X events */
- /* Exit when we see that server is shutting down */
- iReturn = winClipboardFlushXEvents (hwnd,
- iWindow,
- pDisplay,
- fUseUnicode,
- FALSE
- );
- if (WIN_XEVENTS_SHUTDOWN == iReturn)
- {
- ErrorF ("winClipboardProc - winClipboardFlushXEvents "
- "trapped shutdown event, exiting main loop.\n");
- break;
- }
+ /* Process X events */
+ /* Exit when we see that server is shutting down */
+ iReturn = winClipboardFlushXEvents(hwnd,
+ iWindow, pDisplay, fUseUnicode, FALSE);
+ if (WIN_XEVENTS_SHUTDOWN == iReturn) {
+ ErrorF("winClipboardProc - winClipboardFlushXEvents "
+ "trapped shutdown event, exiting main loop.\n");
+ break;
+ }
// }
#ifdef HAS_DEVWINDOWS
- /* Check for Windows event ready */
- if (FD_ISSET (fdMessageQueue, &fdsRead))
+ /* Check for Windows event ready */
+ if (FD_ISSET(fdMessageQueue, &fdsRead))
#else
- if (1)
+ if (1)
#endif
- {
- /* Process Windows messages */
- if (!winClipboardFlushWindowsMessageQueue (hwnd))
- {
- ErrorF ("winClipboardProc - "
- "winClipboardFlushWindowsMessageQueue trapped "
- "WM_QUIT message, exiting main loop.\n");
- break;
- }
- }
+ {
+ /* Process Windows messages */
+ if (!winClipboardFlushWindowsMessageQueue(hwnd)) {
+ ErrorF("winClipboardProc - "
+ "winClipboardFlushWindowsMessageQueue trapped "
+ "WM_QUIT message, exiting main loop.\n");
+ break;
+ }
+ }
}
- /* Close our X window */
- if (pDisplay && iWindow)
- {
- iReturn = XDestroyWindow (pDisplay, iWindow);
- if (iReturn == BadWindow)
- ErrorF ("winClipboardProc - XDestroyWindow returned BadWindow.\n");
+ /* Close our X window */
+ if (pDisplay && iWindow) {
+ iReturn = XDestroyWindow(pDisplay, iWindow);
+ if (iReturn == BadWindow)
+ ErrorF("winClipboardProc - XDestroyWindow returned BadWindow.\n");
#ifdef WINDBG
- else
- winDebug ("winClipboardProc - XDestroyWindow succeeded.\n");
+ else
+ winDebug("winClipboardProc - XDestroyWindow succeeded.\n");
#endif
}
-
#ifdef HAS_DEVWINDOWS
- /* Close our Win32 message handle */
- if (fdMessageQueue)
- close (fdMessageQueue);
+ /* Close our Win32 message handle */
+ if (fdMessageQueue)
+ close(fdMessageQueue);
#endif
#if 0
- /*
- * FIXME: XCloseDisplay hangs if we call it, as of 2004/03/26. The
- * XSync and XSelectInput calls did not help.
- */
+ /*
+ * FIXME: XCloseDisplay hangs if we call it, as of 2004/03/26. The
+ * XSync and XSelectInput calls did not help.
+ */
- /* Discard any remaining events */
- XSync (pDisplay, TRUE);
+ /* Discard any remaining events */
+ XSync(pDisplay, TRUE);
- /* Select event types to watch */
- XSelectInput (pDisplay,
- DefaultRootWindow (pDisplay),
- None);
+ /* Select event types to watch */
+ XSelectInput(pDisplay, DefaultRootWindow(pDisplay), None);
- /* Close our X display */
- if (pDisplay)
- {
- XCloseDisplay (pDisplay);
+ /* Close our X display */
+ if (pDisplay) {
+ XCloseDisplay(pDisplay);
}
#endif
@@ -458,24 +428,20 @@ commonexit:
pthread_cleanup_pop(0);
- return NULL;
+ return NULL;
}
-
/*
* winClipboardErrorHandler - Our application specific error handler
*/
static int
-winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr)
+winClipboardErrorHandler(Display * pDisplay, XErrorEvent * pErr)
{
- char pszErrorMsg[100];
-
- XGetErrorText (pDisplay,
- pErr->error_code,
- pszErrorMsg,
- sizeof (pszErrorMsg));
- ErrorF ("winClipboardErrorHandler - ERROR: \n\t%s\n"
+ char pszErrorMsg[100];
+
+ XGetErrorText(pDisplay, pErr->error_code, pszErrorMsg, sizeof(pszErrorMsg));
+ ErrorF("winClipboardErrorHandler - ERROR: \n\t%s\n"
" errorCode %d\n"
" serial %lu\n"
" resourceID 0x%x\n"
@@ -487,29 +453,27 @@ winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr)
, pErr->resourceid
, pErr->request_code
, pErr->minor_code);
- return 0;
+ return 0;
}
-
/*
* winClipboardIOErrorHandler - Our application specific IO error handler
*/
static int
-winClipboardIOErrorHandler (Display *pDisplay)
+winClipboardIOErrorHandler(Display * pDisplay)
{
- ErrorF ("winClipboardIOErrorHandler!\n\n");
+ ErrorF("winClipboardIOErrorHandler!\n\n");
- if (pthread_equal(pthread_self(),g_winClipboardProcThread))
- {
- /* Restart at the main entry point */
- longjmp (g_jmpEntry, WIN_JMP_ERROR_IO);
+ if (pthread_equal(pthread_self(), g_winClipboardProcThread)) {
+ /* Restart at the main entry point */
+ longjmp(g_jmpEntry, WIN_JMP_ERROR_IO);
}
- if (g_winClipboardOldIOErrorHandler)
- g_winClipboardOldIOErrorHandler(pDisplay);
+ if (g_winClipboardOldIOErrorHandler)
+ g_winClipboardOldIOErrorHandler(pDisplay);
- return 0;
+ return 0;
}
/*
diff --git a/xorg-server/hw/xwin/winclipboardunicode.c b/xorg-server/hw/xwin/winclipboardunicode.c
index f49306904..530ad9a01 100644
--- a/xorg-server/hw/xwin/winclipboardunicode.c
+++ b/xorg-server/hw/xwin/winclipboardunicode.c
@@ -33,25 +33,23 @@
#endif
#include "winclipboard.h"
-
/*
* Determine whether we suport Unicode or not.
* NOTE: Currently, just check if we are on an NT-based platform or not.
*/
Bool
-winClipboardDetectUnicodeSupport (void)
+winClipboardDetectUnicodeSupport(void)
{
- Bool fReturn = FALSE;
- OSVERSIONINFOEX osvi = {0};
+ Bool fReturn = FALSE;
+ OSVERSIONINFOEX osvi = { 0 };
- /* Get operating system version information */
- osvi.dwOSVersionInfoSize = sizeof (osvi);
- GetVersionEx ((LPOSVERSIONINFO)&osvi);
+ /* Get operating system version information */
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx ((LPOSVERSIONINFO)&osvi);
- /* Branch on platform ID */
- switch (osvi.dwPlatformId)
- {
+ /* Branch on platform ID */
+ switch (osvi.dwPlatformId) {
case VER_PLATFORM_WIN32_NT:
if (osvi.dwMajorVersion >= 6)
{
@@ -71,17 +69,17 @@ winClipboardDetectUnicodeSupport (void)
else if (osvi.dwMinorVersion == 1)
{
winDebug ("OS: Windows XP\n");
- fReturn = TRUE;
+ fReturn = TRUE;
}
else if (osvi.dwMinorVersion == 0) winDebug ("OS: Windows 2000\n");
}
else if (osvi.dwMajorVersion <= 4) winDebug ("OS: Windows NT\n");
- break;
+ break;
case VER_PLATFORM_WIN32_WINDOWS:
winDebug ("OS: Windows 95/98/Me\n");
- break;
+ break;
}
- return fReturn;
+ return fReturn;
}
diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c
index 50a63001f..0dd39703d 100644
--- a/xorg-server/hw/xwin/winclipboardwndproc.c
+++ b/xorg-server/hw/xwin/winclipboardwndproc.c
@@ -52,36 +52,35 @@
* References to external symbols
*/
-extern Bool g_fUseUnicode;
-extern Bool g_fUnicodeSupport;
-extern void *g_pClipboardDisplay;
-extern Window g_iClipboardWindow;
-extern Atom g_atomLastOwnedSelection;
+extern Bool g_fUseUnicode;
+extern Bool g_fUnicodeSupport;
+extern void *g_pClipboardDisplay;
+extern Window g_iClipboardWindow;
+extern Atom g_atomLastOwnedSelection;
extern Bool g_fClipboardStarted;
extern HWND g_hwndClipboard;
extern Bool g_fClipboardPrimary;
-
/*
* Local function prototypes
*/
static int
-winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
- Bool fUseUnicode, int iTimeoutSec);
+winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
+ Bool fUseUnicode, int iTimeoutSec);
/*
* Process X events up to specified timeout
*/
static int
-winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
- Bool fUseUnicode, int iTimeoutSec)
+winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
+ Bool fUseUnicode, int iTimeoutSec)
{
- int iConnNumber;
- struct timeval tv;
- int iReturn;
- DWORD dwStopTime = (GetTickCount () / 1000) + iTimeoutSec;
+ int iConnNumber;
+ struct timeval tv;
+ int iReturn;
+ DWORD dwStopTime = (GetTickCount() / 1000) + iTimeoutSec;
/* Make sure the output messages are sent before waiting on a response. */
iReturn = winClipboardFlushXEvents (hwnd,
@@ -95,58 +94,51 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
return iReturn;
}
- /* Get our connection number */
- iConnNumber = ConnectionNumber (pDisplay);
-
- /* Loop for X events */
- while (1)
- {
- fd_set fdsRead;
-
- /* Setup the file descriptor set */
- FD_ZERO (&fdsRead);
- FD_SET (iConnNumber, &fdsRead);
-
- /* Adjust timeout */
- tv.tv_sec = dwStopTime - (GetTickCount () / 1000);
- tv.tv_usec = 0;
-
- /* Break out if no time left */
- if (tv.tv_sec < 0)
- return WIN_XEVENTS_SUCCESS;
-
- /* Wait for an X event */
- iReturn = select (iConnNumber + 1,/* Highest fds number */
- &fdsRead, /* Read mask */
- NULL, /* No write mask */
- NULL, /* No exception mask */
- &tv); /* No timeout */
- if (iReturn < 0)
- {
- ErrorF ("winProcessXEventsTimeout - Call to select () failed: %d (%x). "
- "Bailing.\n", iReturn, WSAGetLastError());
- break;
- }
+ /* Get our connection number */
+ iConnNumber = ConnectionNumber(pDisplay);
+
+ /* Loop for X events */
+ while (1) {
+ fd_set fdsRead;
+
+ /* Setup the file descriptor set */
+ FD_ZERO(&fdsRead);
+ FD_SET(iConnNumber, &fdsRead);
+
+ /* Adjust timeout */
+ tv.tv_sec = dwStopTime - (GetTickCount() / 1000);
+ tv.tv_usec = 0;
+
+ /* Break out if no time left */
+ if (tv.tv_sec < 0)
+ return WIN_XEVENTS_SUCCESS;
+
+ /* Wait for an X event */
+ iReturn = select(iConnNumber + 1, /* Highest fds number */
+ &fdsRead, /* Read mask */
+ NULL, /* No write mask */
+ NULL, /* No exception mask */
+ &tv); /* No timeout */
+ if (iReturn < 0) {
+ ErrorF ("winProcessXEventsTimeout - Call to select () failed: %d (%x). "
+ "Bailing.\n", iReturn, WSAGetLastError());
+ break;
+ }
- /* Branch on which descriptor became active */
- if (FD_ISSET (iConnNumber, &fdsRead))
- {
- /* Process X events */
- /* Exit when we see that server is shutting down */
- iReturn = winClipboardFlushXEvents (hwnd,
- iWindow,
- pDisplay,
- fUseUnicode,
- TRUE);
- if (WIN_XEVENTS_NOTIFY == iReturn)
- {
- /* Bail out if notify processed */
- return iReturn;
- }
- }
+ /* Branch on which descriptor became active */
+ if (FD_ISSET(iConnNumber, &fdsRead)) {
+ /* Process X events */
+ /* Exit when we see that server is shutting down */
+ iReturn = winClipboardFlushXEvents(hwnd,
+ iWindow, pDisplay, fUseUnicode, TRUE);
+ if (WIN_XEVENTS_NOTIFY == iReturn) {
+ /* Bail out if notify processed */
+ return iReturn;
+ }
+ }
}
- return WIN_XEVENTS_SUCCESS;
+ return WIN_XEVENTS_SUCCESS;
}
/*
@@ -154,35 +146,33 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
*/
LRESULT CALLBACK
-winClipboardWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam)
+winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- static HWND s_hwndNextViewer;
+ static HWND s_hwndNextViewer;
- /* Branch on message type */
- switch (message)
- {
+ /* Branch on message type */
+ switch (message) {
case WM_DESTROY:
- {
- winDebug ("winClipboardWindowProc - WM_DESTROY\n");
+ {
+ winDebug("winClipboardWindowProc - WM_DESTROY\n");
- /* Remove ourselves from the clipboard chain */
- ChangeClipboardChain (hwnd, s_hwndNextViewer);
-
- s_hwndNextViewer = NULL;
- g_hwndClipboard = NULL;
- PostQuitMessage (0);
- }
- return 0;
+ /* Remove ourselves from the clipboard chain */
+ ChangeClipboardChain(hwnd, s_hwndNextViewer);
+ s_hwndNextViewer = NULL;
+ g_hwndClipboard = NULL;
+ PostQuitMessage(0);
+ }
+ return 0;
case WM_CREATE:
- {
- HWND first, next;
- DWORD error_code = 0;
- winDebug ("winClipboardWindowProc - WM_CREATE\n");
-
- /* Add ourselves to the clipboard viewer chain */
+ {
+ HWND first, next;
+ DWORD error_code = 0;
+
+ winDebug("winClipboardWindowProc - WM_CREATE\n");
+
+ /* Add ourselves to the clipboard viewer chain */
s_hwndNextViewer = SetClipboardViewer (hwnd);
#ifdef _DEBUG
if (s_hwndNextViewer== hwnd)
@@ -192,55 +182,51 @@ winClipboardWindowProc (HWND hwnd, UINT message,
}
#endif
- }
- return 0;
-
+ }
+ return 0;
case WM_CHANGECBCHAIN:
- {
- winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: wParam(%x) "
- "lParam(%x) s_hwndNextViewer(%x)\n",
- wParam, lParam, s_hwndNextViewer);
+ {
+ winDebug("winClipboardWindowProc - WM_CHANGECBCHAIN: wParam(%x) "
+ "lParam(%x) s_hwndNextViewer(%x)\n",
+ wParam, lParam, s_hwndNextViewer);
- if ((HWND) wParam == s_hwndNextViewer)
- {
- s_hwndNextViewer = (HWND) lParam;
- if (s_hwndNextViewer == hwnd)
- {
+ if ((HWND) wParam == s_hwndNextViewer) {
+ s_hwndNextViewer = (HWND) lParam;
+ if (s_hwndNextViewer == hwnd) {
winDebug("WM_CHANGECBCHAIN: trying to set s_hwndNextViewer to own window. Resetting it back to NULL. ");
s_hwndNextViewer=NULL; /* This would cause an endless loop, so break it by ending the loop here. I have seen this happening, why??? */
- }
- }
- else if (s_hwndNextViewer)
- SendMessage (s_hwndNextViewer, message,
- wParam, lParam);
+ }
+ }
+ else if (s_hwndNextViewer)
+ SendMessage(s_hwndNextViewer, message, wParam, lParam);
- }
- winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n");
- return 0;
+ }
+ winDebug("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n");
+ return 0;
case WM_WM_REINIT:
- {
+ {
/* Ensure that we're in the clipboard chain. Some apps,
* WinXP's remote desktop for one, don't play nice with the
* chain. This message is called whenever we receive a
* WM_ACTIVATEAPP message to ensure that we continue to
* receive clipboard messages.
- *
- * It might be possible to detect if we're still in the chain
- * by calling SendMessage (GetClipboardViewer(),
- * WM_DRAWCLIPBOARD, 0, 0); and then seeing if we get the
- * WM_DRAWCLIPBOARD message. That, however, might be more
- * expensive than just putting ourselves back into the chain.
- */
-
- HWND first, next;
- DWORD error_code = 0;
+ *
+ * It might be possible to detect if we're still in the chain
+ * by calling SendMessage (GetClipboardViewer(),
+ * WM_DRAWCLIPBOARD, 0, 0); and then seeing if we get the
+ * WM_DRAWCLIPBOARD message. That, however, might be more
+ * expensive than just putting ourselves back into the chain.
+ */
+
+ HWND first, next;
+ DWORD error_code = 0;
if (!g_hwndClipboard)
return 0;
- winDebug ("winClipboardWindowProc - WM_WM_REINIT: Enter\n");
+ winDebug("winClipboardWindowProc - WM_WM_REINIT: Enter\n");
- first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
+ first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
if (first != hwnd)
{
winDebug (" WM_WM_REINIT: Replacing us(%x) with %x at head "
@@ -258,17 +244,16 @@ winClipboardWindowProc (HWND hwnd, UINT message,
}
winDebug ("winClipboardWindowProc - WM_WM_REINIT: Exit\n");
}
- return 0;
-
+ return 0;
case WM_DRAWCLIPBOARD:
- {
- static Atom atomClipboard;
- static int generation;
- static Bool s_fProcessingDrawClipboard = FALSE;
- Display *pDisplay = g_pClipboardDisplay;
- Window iWindow = g_iClipboardWindow;
- int iReturn;
+ {
+ static Atom atomClipboard;
+ static int generation;
+ static Bool s_fProcessingDrawClipboard = FALSE;
+ Display *pDisplay = g_pClipboardDisplay;
+ Window iWindow = g_iClipboardWindow;
+ int iReturn;
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD 0x%x 0x%x 0x%x: Enter\n",hwnd,wParam,lParam);
@@ -280,50 +265,46 @@ winClipboardWindowProc (HWND hwnd, UINT message,
return 0;
}
- if (generation != serverGeneration)
- {
+ if (generation != serverGeneration) {
generation = serverGeneration;
- atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
- }
-
- /*
- * We've occasionally seen a loop in the clipboard chain.
- * Try and fix it on the first hint of recursion.
- */
- if (! s_fProcessingDrawClipboard)
- {
- s_fProcessingDrawClipboard = TRUE;
- }
- else
- {
- /* Attempt to break the nesting by getting out of the chain, twice?, and then fix and bail */
- ChangeClipboardChain (hwnd, s_hwndNextViewer);
+ atomClipboard = XInternAtom(pDisplay, "CLIPBOARD", False);
+ }
+
+ /*
+ * We've occasionally seen a loop in the clipboard chain.
+ * Try and fix it on the first hint of recursion.
+ */
+ if (!s_fProcessingDrawClipboard) {
+ s_fProcessingDrawClipboard = TRUE;
+ }
+ else {
+ /* Attempt to break the nesting by getting out of the chain, twice?, and then fix and bail */
+ ChangeClipboardChain(hwnd, s_hwndNextViewer);
winFixClipboardChain(1);
ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "Nested calls detected. Re-initing.\n");
- winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
- s_fProcessingDrawClipboard = FALSE;
- return 0;
- }
-
- /*
- * Do not take ownership of the X11 selections when something
- * other than CF_TEXT or CF_UNICODETEXT has been copied
- * into the Win32 clipboard.
- */
- if (!IsClipboardFormatAvailable (CF_TEXT)
- && !IsClipboardFormatAvailable (CF_UNICODETEXT))
- {
-
- winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "Clipboard does not contain CF_TEXT nor "
- "CF_UNICODETEXT.\n");
+ "Nested calls detected. Re-initing.\n");
+ winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ s_fProcessingDrawClipboard = FALSE;
+ return 0;
+ }
- /*
- * We need to make sure that the X Server has processed
- * previous XSetSelectionOwner messages.
- */
- XSync (pDisplay, FALSE);
+ /*
+ * Do not take ownership of the X11 selections when something
+ * other than CF_TEXT or CF_UNICODETEXT has been copied
+ * into the Win32 clipboard.
+ */
+ if (!IsClipboardFormatAvailable(CF_TEXT)
+ && !IsClipboardFormatAvailable(CF_UNICODETEXT)) {
+
+ winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Clipboard does not contain CF_TEXT nor "
+ "CF_UNICODETEXT.\n");
+
+ /*
+ * We need to make sure that the X Server has processed
+ * previous XSetSelectionOwner messages.
+ */
+ XSync(pDisplay, FALSE);
if (g_fClipboardPrimary)
{
@@ -342,28 +323,24 @@ winClipboardWindowProc (HWND hwnd, UINT message,
ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
"XGetSelection failed for PRIMARY: %d\n", iReturn);
}
- /* Release CLIPBOARD selection if owned */
- iReturn = XGetSelectionOwner (pDisplay,
- atomClipboard);
- if (iReturn == g_iClipboardWindow)
- {
- winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "CLIPBOARD selection is owned by us.\n");
- XSetSelectionOwner (pDisplay,
- atomClipboard,
- None,
- CurrentTime);
- }
- else if (BadWindow == iReturn || BadAtom == iReturn)
- ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "XGetSelection failed for CLIPBOARD: %d\n", iReturn);
-
- winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
- s_fProcessingDrawClipboard = FALSE;
- if (s_hwndNextViewer)
- SendMessage (s_hwndNextViewer, message, wParam, lParam);
- return 0;
- }
+ /* Release CLIPBOARD selection if owned */
+ iReturn = XGetSelectionOwner(pDisplay, atomClipboard);
+ if (iReturn == g_iClipboardWindow) {
+ winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "CLIPBOARD selection is owned by us.\n");
+ XSetSelectionOwner(pDisplay, atomClipboard, None, CurrentTime);
+ }
+ else if (BadWindow == iReturn || BadAtom == iReturn)
+ ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "XGetSelection failed for CLIPBOARD: %d\n",
+ iReturn);
+
+ winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ s_fProcessingDrawClipboard = FALSE;
+ if (s_hwndNextViewer)
+ SendMessage(s_hwndNextViewer, message, wParam, lParam);
+ return 0;
+ }
/* Only reassert ownership when we did not change the clipboard ourselves */
if (hwnd!=(HWND)wParam)
{
@@ -403,159 +380,148 @@ winClipboardWindowProc (HWND hwnd, UINT message,
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
"Reasserted ownership of CLIPBOARD\n");
}
-
+
/* Flush the pending SetSelectionOwner event now */
XFlush (pDisplay);
}
- s_fProcessingDrawClipboard = FALSE;
- winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
- /* Pass the message on the next window in the clipboard viewer chain */
- if (s_hwndNextViewer)
- SendMessage (s_hwndNextViewer, message, wParam, lParam);
- return 0;
+ s_fProcessingDrawClipboard = FALSE;
+ winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ /* Pass the message on the next window in the clipboard viewer chain */
+ if (s_hwndNextViewer)
+ SendMessage(s_hwndNextViewer, message, wParam, lParam);
+ return 0;
}
-
case WM_DESTROYCLIPBOARD:
- /*
- * NOTE: Intentionally do nothing.
- * Changes in the Win32 clipboard are handled by WM_DRAWCLIPBOARD
- * above. We only process this message to conform to the specs
- * for delayed clipboard rendering in Win32. You might think
- * that we need to release ownership of the X11 selections, but
- * we do not, because a WM_DRAWCLIPBOARD message will closely
- * follow this message and reassert ownership of the X11
- * selections, handling the issue for us.
- */
- winDebug ("winClipboardWindowProc - WM_DESTROYCLIPBOARD - Ignored.\n");
- return 0;
+ /*
+ * NOTE: Intentionally do nothing.
+ * Changes in the Win32 clipboard are handled by WM_DRAWCLIPBOARD
+ * above. We only process this message to conform to the specs
+ * for delayed clipboard rendering in Win32. You might think
+ * that we need to release ownership of the X11 selections, but
+ * we do not, because a WM_DRAWCLIPBOARD message will closely
+ * follow this message and reassert ownership of the X11
+ * selections, handling the issue for us.
+ */
+ winDebug("winClipboardWindowProc - WM_DESTROYCLIPBOARD - Ignored.\n");
+ return 0;
case WM_RENDERFORMAT:
case WM_RENDERALLFORMATS:
- {
- int iReturn;
- Display *pDisplay = g_pClipboardDisplay;
- Window iWindow = g_iClipboardWindow;
- Bool fConvertToUnicode;
-
- winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Hello.\n");
-
- /* Flag whether to convert to Unicode or not */
- if (message == WM_RENDERALLFORMATS)
- fConvertToUnicode = FALSE;
- else
- fConvertToUnicode = g_fUnicodeSupport && (CF_UNICODETEXT == wParam);
-
- /* Request the selection contents */
- iReturn = XConvertSelection (pDisplay,
- g_atomLastOwnedSelection,
- XInternAtom (pDisplay,
- "COMPOUND_TEXT", False),
- XInternAtom (pDisplay,
- WIN_LOCAL_PROPERTY, False),
- iWindow,
- CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow)
- {
- ErrorF ("winClipboardWindowProc - WM_RENDER*FORMAT - "
- "XConvertSelection () failed\n");
- break;
- }
+ {
+ int iReturn;
+ Display *pDisplay = g_pClipboardDisplay;
+ Window iWindow = g_iClipboardWindow;
+ Bool fConvertToUnicode;
+
+ winDebug("winClipboardWindowProc - WM_RENDER*FORMAT - Hello.\n");
+
+ /* Flag whether to convert to Unicode or not */
+ if (message == WM_RENDERALLFORMATS)
+ fConvertToUnicode = FALSE;
+ else
+ fConvertToUnicode = g_fUnicodeSupport && (CF_UNICODETEXT == wParam);
+
+ /* Request the selection contents */
+ iReturn = XConvertSelection(pDisplay,
+ g_atomLastOwnedSelection,
+ XInternAtom(pDisplay,
+ "COMPOUND_TEXT", False),
+ XInternAtom(pDisplay,
+ WIN_LOCAL_PROPERTY, False),
+ iWindow, CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow) {
+ ErrorF ("winClipboardWindowProc - WM_RENDER*FORMAT - "
+ "XConvertSelection () failed\n");
+ break;
+ }
- /* Special handling for WM_RENDERALLFORMATS */
- if (message == WM_RENDERALLFORMATS)
- {
- /* We must open and empty the clipboard */
- if (!OpenClipboard (hwnd))
- {
- ErrorF ("winClipboardWindowProc - WM_RENDER*FORMATS - "
- "OpenClipboard () failed: %08x\n",
- GetLastError ());
- break;
- }
-
- if (!EmptyClipboard ())
- {
- ErrorF ("winClipboardWindowProc - WM_RENDER*FORMATS - "
- "EmptyClipboard () failed: %08x\n",
- GetLastError ());
+ /* Special handling for WM_RENDERALLFORMATS */
+ if (message == WM_RENDERALLFORMATS) {
+ /* We must open and empty the clipboard */
+ if (!OpenClipboard(hwnd)) {
+ ErrorF ("winClipboardWindowProc - WM_RENDER*FORMATS - "
+ "OpenClipboard () failed: %08x\n",
+ GetLastError());
+ break;
+ }
+
+ if (!EmptyClipboard()) {
+ ErrorF ("winClipboardWindowProc - WM_RENDER*FORMATS - "
+ "EmptyClipboard () failed: %08x\n",
+ GetLastError());
CloseClipboard ();
- break;
- }
- }
+ break;
+ }
+ }
- /* Process the SelectionNotify event */
- iReturn = winProcessXEventsTimeout (hwnd,
- iWindow,
- pDisplay,
- fConvertToUnicode,
- WIN_POLL_TIMEOUT);
-
- /*
- * The last call to winProcessXEventsTimeout
- * from above had better have seen a notify event, or else we
- * are dealing with a buggy or old X11 app. In these cases we
- * have to paste some fake data to the Win32 clipboard to
- * satisfy the requirement that we write something to it.
- */
- if (WIN_XEVENTS_NOTIFY != iReturn)
- {
- ErrorF("winClipboardWindowProc - winProcessXEventsTimeout should have returned WIN_XEVENTS_NOTIFY was %d\n",iReturn);
- /* Paste no data, to satisfy required call to SetClipboardData */
- if (g_fUnicodeSupport)
- SetClipboardData (CF_UNICODETEXT, NULL);
- SetClipboardData (CF_TEXT, NULL);
+ /* Process the SelectionNotify event */
+ iReturn = winProcessXEventsTimeout(hwnd,
+ iWindow,
+ pDisplay,
+ fConvertToUnicode, WIN_POLL_TIMEOUT);
+
+ /*
+ * The last call to winProcessXEventsTimeout
+ * from above had better have seen a notify event, or else we
+ * are dealing with a buggy or old X11 app. In these cases we
+ * have to paste some fake data to the Win32 clipboard to
+ * satisfy the requirement that we write something to it.
+ */
+ if (WIN_XEVENTS_NOTIFY != iReturn) {
+ ErrorF("winClipboardWindowProc - winProcessXEventsTimeout should have returned WIN_XEVENTS_NOTIFY was %d\n",iReturn);
+ /* Paste no data, to satisfy required call to SetClipboardData */
+ if (g_fUnicodeSupport)
+ SetClipboardData(CF_UNICODETEXT, NULL);
+ SetClipboardData(CF_TEXT, NULL);
+
+ ErrorF
+ ("winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY\n");
+ }
- ErrorF("winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY\n");
- }
+ /* Special handling for WM_RENDERALLFORMATS */
+ if (message == WM_RENDERALLFORMATS) {
+ /* We must close the clipboard */
- /* Special handling for WM_RENDERALLFORMATS */
- if (message == WM_RENDERALLFORMATS)
- {
- /* We must close the clipboard */
-
- if (!CloseClipboard ())
- {
- ErrorF ("winClipboardWindowProc - WM_RENDERALLFORMATS - "
- "CloseClipboard () failed: %08x\n",
- GetLastError ());
- break;
- }
- }
+ if (!CloseClipboard()) {
+ ErrorF ("winClipboardWindowProc - WM_RENDERALLFORMATS - "
+ "CloseClipboard () failed: %08x\n",
+ GetLastError());
+ break;
+ }
+ }
- winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Returning.\n");
- return 0;
- }
+ winDebug("winClipboardWindowProc - WM_RENDER*FORMAT - Returning.\n");
+ return 0;
+ }
}
- /* Let Windows perform default processing for unhandled messages */
- return DefWindowProc (hwnd, message, wParam, lParam);
+ /* Let Windows perform default processing for unhandled messages */
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
-
/*
* Process any pending Windows messages
*/
BOOL
-winClipboardFlushWindowsMessageQueue (HWND hwnd)
+winClipboardFlushWindowsMessageQueue(HWND hwnd)
{
- MSG msg;
-
- /* Flush the messaging window queue */
- /* NOTE: Do not pass the hwnd of our messaging window to PeekMessage,
- * as this will filter out many non-window-specific messages that
- * are sent to our thread, such as WM_QUIT.
- */
- while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
- {
- /* Dispatch the message if not WM_QUIT */
- if (msg.message == WM_QUIT)
- return FALSE;
- else
- DispatchMessage (&msg);
+ MSG msg;
+
+ /* Flush the messaging window queue */
+ /* NOTE: Do not pass the hwnd of our messaging window to PeekMessage,
+ * as this will filter out many non-window-specific messages that
+ * are sent to our thread, such as WM_QUIT.
+ */
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ /* Dispatch the message if not WM_QUIT */
+ if (msg.message == WM_QUIT)
+ return FALSE;
+ else
+ DispatchMessage(&msg);
}
-
- return TRUE;
+
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c
index 3743b9edb..4005bf176 100644
--- a/xorg-server/hw/xwin/winclipboardwrappers.c
+++ b/xorg-server/hw/xwin/winclipboardwrappers.c
@@ -37,7 +37,6 @@
#include "dixstruct.h"
#include <X11/Xatom.h>
-
/*
* Constants
*/
@@ -46,37 +45,35 @@
#define CLIP_OWN_PRIMARY 0
#define CLIP_OWN_CLIPBOARD 1
-
/*
* Local function prototypes
*/
-int winProcEstablishConnection(ClientPtr /* client */);
-int winProcSetSelectionOwner(ClientPtr /* client */);
+int winProcEstablishConnection(ClientPtr /* client */ );
+int winProcSetSelectionOwner(ClientPtr /* client */ );
+
DISPATCH_PROC(winProcEstablishConnection);
DISPATCH_PROC(winProcSetSelectionOwner);
-
/*
* References to external symbols
*/
-extern Bool g_fUnicodeSupport;
-extern int g_iNumScreens;
-extern unsigned int g_uiAuthDataLen;
-extern char *g_pAuthData;
-extern Bool g_fXdmcpEnabled;
-extern Bool g_fClipboardLaunched;
-extern Bool g_fClipboardStarted;
-extern Bool g_fClipboard;
-extern Window g_iClipboardWindow;
-extern Atom g_atomLastOwnedSelection;
-extern HWND g_hwndClipboard;
+extern Bool g_fUnicodeSupport;
+extern int g_iNumScreens;
+extern unsigned int g_uiAuthDataLen;
+extern char *g_pAuthData;
+extern Bool g_fXdmcpEnabled;
+extern Bool g_fClipboardLaunched;
+extern Bool g_fClipboardStarted;
+extern Bool g_fClipboard;
+extern Window g_iClipboardWindow;
+extern Atom g_atomLastOwnedSelection;
+extern HWND g_hwndClipboard;
extern Bool g_fClipboardPrimary;
-extern winDispatchProcPtr winProcEstablishConnectionOrig;
-extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
-
+extern winDispatchProcPtr winProcEstablishConnectionOrig;
+extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
/*
* Wrapper for internal EstablishConnection function.
@@ -85,291 +82,269 @@ extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
*/
int
-winProcEstablishConnection (ClientPtr client)
+winProcEstablishConnection(ClientPtr client)
{
- int iReturn;
- static int s_iCallCount = 0;
- static unsigned long s_ulServerGeneration = 0;
+ int iReturn;
+ static int s_iCallCount = 0;
+ static unsigned long s_ulServerGeneration = 0;
#ifdef WINDBG
if (s_iCallCount == 0) winDebug ("winProcEstablishConnection - Hello\n");
#endif
- /* Do nothing if clipboard is not enabled */
- if (!g_fClipboard)
- {
+ /* Do nothing if clipboard is not enabled */
+ if (!g_fClipboard) {
winDebug ("winProcEstablishConnection - Clipboard is not enabled, "
- "returning.\n");
-
- /* Unwrap the original function, call it, and return */
- InitialVector[2] = winProcEstablishConnectionOrig;
- iReturn = (*winProcEstablishConnectionOrig) (client);
- winProcEstablishConnectionOrig = NULL;
- return iReturn;
+ "returning.\n");
+
+ /* Unwrap the original function, call it, and return */
+ InitialVector[2] = winProcEstablishConnectionOrig;
+ iReturn = (*winProcEstablishConnectionOrig) (client);
+ winProcEstablishConnectionOrig = NULL;
+ return iReturn;
}
- /* Watch for server reset */
- if (s_ulServerGeneration != serverGeneration)
- {
- /* Save new generation number */
- s_ulServerGeneration = serverGeneration;
+ /* Watch for server reset */
+ if (s_ulServerGeneration != serverGeneration) {
+ /* Save new generation number */
+ s_ulServerGeneration = serverGeneration;
- /* Reset call count */
- s_iCallCount = 0;
+ /* Reset call count */
+ s_iCallCount = 0;
}
- /* Increment call count */
- ++s_iCallCount;
-
- /*
- * This procedure is only used for initialization.
- * We can unwrap the original procedure at this point
- * so that this function is no longer called until the
- * server resets and the function is wrapped again.
- */
- InitialVector[2] = winProcEstablishConnectionOrig;
-
- /*
- * Call original function and bail if it fails.
- * NOTE: We must do this first, since we need XdmcpOpenDisplay
- * to be called before we initialize our clipboard client.
- */
- iReturn = (*winProcEstablishConnectionOrig) (client);
- if (iReturn != 0)
- {
- ErrorF ("winProcEstablishConnection - ProcEstablishConnection "
- "failed, bailing.\n");
- return iReturn;
+ /* Increment call count */
+ ++s_iCallCount;
+
+ /*
+ * This procedure is only used for initialization.
+ * We can unwrap the original procedure at this point
+ * so that this function is no longer called until the
+ * server resets and the function is wrapped again.
+ */
+ InitialVector[2] = winProcEstablishConnectionOrig;
+
+ /*
+ * Call original function and bail if it fails.
+ * NOTE: We must do this first, since we need XdmcpOpenDisplay
+ * to be called before we initialize our clipboard client.
+ */
+ iReturn = (*winProcEstablishConnectionOrig) (client);
+ if (iReturn != 0) {
+ ErrorF("winProcEstablishConnection - ProcEstablishConnection "
+ "failed, bailing.\n");
+ return iReturn;
}
- /* Clear original function pointer */
- winProcEstablishConnectionOrig = NULL;
+ /* Clear original function pointer */
+ winProcEstablishConnectionOrig = NULL;
- /* If the clipboard client has already been started, abort */
- if (g_fClipboardLaunched)
- {
- winDebug ("winProcEstablishConnection - Clipboard client already "
- "launched, returning.\n");
- return iReturn;
+ /* If the clipboard client has already been started, abort */
+ if (g_fClipboardLaunched) {
+ winDebug ("winProcEstablishConnection - Clipboard client already "
+ "launched, returning.\n");
+ return iReturn;
}
- /* Startup the clipboard client if clipboard mode is being used */
- if (g_fClipboard)
- {
- /*
- * NOTE: The clipboard client is started here for a reason:
- * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
- * 2) If the clipboard client attaches during X Server startup,
- * then it becomes the "magic client" that causes the X Server
- * to reset if it exits.
- * 3) XDMCP calls KillAllClients when it starts up.
- * 4) The clipboard client is a client, so it is killed.
- * 5) The clipboard client is the "magic client", so the X Server
- * resets itself.
- * 6) This repeats ad infinitum.
- * 7) We avoid this by waiting until at least one client (could
- * be XDM, could be another client) connects, which makes it
- * almost certain that the clipboard client will not connect
- * until after XDM when using XDMCP.
- */
-
- /* Create the clipboard client thread */
- if (!winInitClipboard ())
- {
- ErrorF ("winProcEstablishConnection - winClipboardInit "
- "failed.\n");
- return iReturn;
- }
-
- winDebug ("winProcEstablishConnection - winInitClipboard returned.\n");
+ /* Startup the clipboard client if clipboard mode is being used */
+ if (g_fClipboard) {
+ /*
+ * NOTE: The clipboard client is started here for a reason:
+ * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
+ * 2) If the clipboard client attaches during X Server startup,
+ * then it becomes the "magic client" that causes the X Server
+ * to reset if it exits.
+ * 3) XDMCP calls KillAllClients when it starts up.
+ * 4) The clipboard client is a client, so it is killed.
+ * 5) The clipboard client is the "magic client", so the X Server
+ * resets itself.
+ * 6) This repeats ad infinitum.
+ * 7) We avoid this by waiting until at least one client (could
+ * be XDM, could be another client) connects, which makes it
+ * almost certain that the clipboard client will not connect
+ * until after XDM when using XDMCP.
+ */
+
+ /* Create the clipboard client thread */
+ if (!winInitClipboard()) {
+ ErrorF("winProcEstablishConnection - winClipboardInit "
+ "failed.\n");
+ return iReturn;
+ }
+
+ winDebug ("winProcEstablishConnection - winInitClipboard returned.\n");
}
-
- /* Flag that clipboard client has been launched */
- g_fClipboardLaunched = TRUE;
- return iReturn;
-}
+ /* Flag that clipboard client has been launched */
+ g_fClipboardLaunched = TRUE;
+ return iReturn;
+}
/*
* Wrapper for internal SetSelectionOwner function.
* Grabs ownership of Windows clipboard when X11 clipboard owner changes.
*/
int
-winProcSetSelectionOwner (ClientPtr client)
+winProcSetSelectionOwner(ClientPtr client)
{
- int i;
- DrawablePtr pDrawable;
- WindowPtr pWindow = None;
- static Window s_iOwners[CLIP_NUM_SELECTIONS] = {None};
- static unsigned long s_ulServerGeneration = 0;
- REQUEST(xSetSelectionOwnerReq);
-
- REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
-
- winDebug ("winProcSetSelectionOwner - Hello.\n");
-
- /* Watch for server reset */
- if (s_ulServerGeneration != serverGeneration)
- {
- /* Save new generation number */
- s_ulServerGeneration = serverGeneration;
+ int i;
+ DrawablePtr pDrawable;
+ WindowPtr pWindow = None;
+ static Window s_iOwners[CLIP_NUM_SELECTIONS] = { None };
+ static unsigned long s_ulServerGeneration = 0;
+
+ REQUEST(xSetSelectionOwnerReq);
+
+ REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
+
+ winDebug("winProcSetSelectionOwner - Hello.\n");
+
+ /* Watch for server reset */
+ if (s_ulServerGeneration != serverGeneration) {
+ /* Save new generation number */
+ s_ulServerGeneration = serverGeneration;
- /* Initialize static variables */
- for (i = 0; i < CLIP_NUM_SELECTIONS; ++i)
- s_iOwners[i] = None;
+ /* Initialize static variables */
+ for (i = 0; i < CLIP_NUM_SELECTIONS; ++i)
+ s_iOwners[i] = None;
}
- /* Abort if clipboard not completely initialized yet */
- if (!g_fClipboardStarted)
- {
+ /* Abort if clipboard not completely initialized yet */
+ if (!g_fClipboardStarted) {
winDebug ("winProcSetSelectionOwner - Clipboard not yet started, "
- "aborting.\n");
+ "aborting.\n");
goto winProcSetSelectionOwner_Done;
}
-
- /* Grab window if we have one */
- if (None != stuff->window)
- {
- /* Grab the Window from the request */
- int rc = dixLookupWindow(&pWindow, stuff->window, client, DixReadAccess);
- if (rc != Success) {
- ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n");
- goto winProcSetSelectionOwner_Done;
- }
+
+ /* Grab window if we have one */
+ if (None != stuff->window) {
+ /* Grab the Window from the request */
+ int rc =
+ dixLookupWindow(&pWindow, stuff->window, client, DixReadAccess);
+ if (rc != Success) {
+ ErrorF("winProcSetSelectionOwner - Found BadWindow, aborting.\n");
+ goto winProcSetSelectionOwner_Done;
+ }
}
- /* Now we either have a valid window or None */
-
- /* Save selection owners for monitored selections, ignore other selections */
- if (XA_PRIMARY == stuff->selection && g_fClipboardPrimary)
- {
- /* Look for owned -> not owned transition */
- if (None == stuff->window
- && None != s_iOwners[CLIP_OWN_PRIMARY])
- {
- winDebug ("winProcSetSelectionOwner - PRIMARY - Going from "
- "owned to not owned.\n");
-
- /* Adjust last owned selection */
- if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
- g_atomLastOwnedSelection = MakeAtom ("CLIPBOARD", 9, TRUE);
- else
- g_atomLastOwnedSelection = None;
- }
-
- /* Save new selection owner or None */
- s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
-
- winDebug ("winProcSetSelectionOwner - PRIMARY - Now owned by: 0x%x (clipboard is 0x%x)\n",
- stuff->window,g_iClipboardWindow);
+ /* Now we either have a valid window or None */
+
+ /* Save selection owners for monitored selections, ignore other selections */
+ if (XA_PRIMARY == stuff->selection && g_fClipboardPrimary) {
+ /* Look for owned -> not owned transition */
+ if (None == stuff->window && None != s_iOwners[CLIP_OWN_PRIMARY]) {
+ winDebug("winProcSetSelectionOwner - PRIMARY - Going from "
+ "owned to not owned.\n");
+
+ /* Adjust last owned selection */
+ if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
+ g_atomLastOwnedSelection = MakeAtom("CLIPBOARD", 9, TRUE);
+ else
+ g_atomLastOwnedSelection = None;
+ }
+
+ /* Save new selection owner or None */
+ s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
+
+ winDebug ("winProcSetSelectionOwner - PRIMARY - Now owned by: 0x%x (clipboard is 0x%x)\n",
+ stuff->window,g_iClipboardWindow);
}
- else if (MakeAtom ("CLIPBOARD", 9, TRUE) == stuff->selection)
- {
- /* Look for owned -> not owned transition */
- if (None == stuff->window
- && None != s_iOwners[CLIP_OWN_CLIPBOARD])
- {
- winDebug ("winProcSetSelectionOwner - CLIPBOARD - Going from "
- "owned to not owned.\n");
-
- /* Adjust last owned selection */
- if ((None != s_iOwners[CLIP_OWN_PRIMARY]) && g_fClipboardPrimary)
- g_atomLastOwnedSelection = XA_PRIMARY;
- else
- g_atomLastOwnedSelection = None;
- }
-
- /* Save new selection owner or None */
- s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window;
-
- winDebug ("winProcSetSelectionOwner - CLIPBOARD - Now owned by: 0x%x, clipboard is 0x%x\n",
- stuff->window,g_iClipboardWindow);
+ else if (MakeAtom("CLIPBOARD", 9, TRUE) == stuff->selection) {
+ /* Look for owned -> not owned transition */
+ if (None == stuff->window && None != s_iOwners[CLIP_OWN_CLIPBOARD]) {
+ winDebug("winProcSetSelectionOwner - CLIPBOARD - Going from "
+ "owned to not owned.\n");
+
+ /* Adjust last owned selection */
+ if ((None != s_iOwners[CLIP_OWN_PRIMARY]) && g_fClipboardPrimary)
+ g_atomLastOwnedSelection = XA_PRIMARY;
+ else
+ g_atomLastOwnedSelection = None;
+ }
+
+ /* Save new selection owner or None */
+ s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window;
+
+ winDebug ("winProcSetSelectionOwner - CLIPBOARD - Now owned by: 0x%x, clipboard is 0x%x\n",
+ stuff->window,g_iClipboardWindow);
}
- else
- goto winProcSetSelectionOwner_Done;
-
- /*
- * At this point, if one of the selections is still owned by the
- * clipboard manager then it should be marked as unowned since
- * we will be taking ownership of the Win32 clipboard.
- */
- if (g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY])
- s_iOwners[CLIP_OWN_PRIMARY] = None;
- if (g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD])
- s_iOwners[CLIP_OWN_CLIPBOARD] = None;
-
- /* Abort if no window at this point */
- if (None == stuff->window)
- {
- winDebug ("winProcSetSelectionOwner - No window, returning.\n");
- goto winProcSetSelectionOwner_Done;
+ else
+ goto winProcSetSelectionOwner_Done;
+
+ /*
+ * At this point, if one of the selections is still owned by the
+ * clipboard manager then it should be marked as unowned since
+ * we will be taking ownership of the Win32 clipboard.
+ */
+ if (g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY])
+ s_iOwners[CLIP_OWN_PRIMARY] = None;
+ if (g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD])
+ s_iOwners[CLIP_OWN_CLIPBOARD] = None;
+
+ /* Abort if no window at this point */
+ if (None == stuff->window) {
+ winDebug ("winProcSetSelectionOwner - No window, returning.\n");
+ goto winProcSetSelectionOwner_Done;
}
- /* Abort if invalid selection */
- if (!ValidAtom (stuff->selection))
- {
- winDebug ("winProcSetSelectionOwner - Found BadAtom, aborting.\n");
- goto winProcSetSelectionOwner_Done;
+ /* Abort if invalid selection */
+ if (!ValidAtom(stuff->selection)) {
+ winDebug ("winProcSetSelectionOwner - Found BadAtom, aborting.\n");
+ goto winProcSetSelectionOwner_Done;
}
- /* Cast Window to Drawable */
- pDrawable = (DrawablePtr) pWindow;
-
- /* Abort if clipboard manager is owning the selection */
- if (pDrawable->id == g_iClipboardWindow)
- {
- winDebug ("winProcSetSelectionOwner - We changed ownership, "
- "aborting.\n");
- goto winProcSetSelectionOwner_Done;
+ /* Cast Window to Drawable */
+ pDrawable = (DrawablePtr) pWindow;
+
+ /* Abort if clipboard manager is owning the selection */
+ if (pDrawable->id == g_iClipboardWindow) {
+ winDebug ("winProcSetSelectionOwner - We changed ownership, "
+ "aborting.\n");
+ goto winProcSetSelectionOwner_Done;
}
- /* Abort if root window is taking ownership */
- if (pDrawable->id == 0)
- {
- winDebug ("winProcSetSelectionOwner - Root window taking ownership, "
- "aborting\n");
- goto winProcSetSelectionOwner_Done;
+ /* Abort if root window is taking ownership */
+ if (pDrawable->id == 0) {
+ winDebug ("winProcSetSelectionOwner - Root window taking ownership, "
+ "aborting\n");
+ goto winProcSetSelectionOwner_Done;
}
- /* Access the Windows clipboard */
- if (!OpenClipboard (g_hwndClipboard))
- {
- ErrorF ("winProcSetSelectionOwner - OpenClipboard () failed: %08x, hwnd: %08x\n",
- (int) GetLastError (),g_hwndClipboard);
- goto winProcSetSelectionOwner_Done;
+ /* Access the Windows clipboard */
+ if (!OpenClipboard(g_hwndClipboard)) {
+ ErrorF ("winProcSetSelectionOwner - OpenClipboard () failed: %08x, hwnd: %08x\n",
+ (int) GetLastError (),g_hwndClipboard);
+ goto winProcSetSelectionOwner_Done;
}
- /* Take ownership of the Windows clipboard */
- if (!EmptyClipboard ())
- {
- ErrorF ("winProcSetSelectionOwner - EmptyClipboard () failed: %08x\n",
- (int) GetLastError ());
- CloseClipboard ();
- goto winProcSetSelectionOwner_Done;
+ /* Take ownership of the Windows clipboard */
+ if (!EmptyClipboard()) {
+ ErrorF("winProcSetSelectionOwner - EmptyClipboard () failed: %08x\n",
+ (int) GetLastError());
+ CloseClipboard ();
+ goto winProcSetSelectionOwner_Done;
}
- winDebug("winProcSetSelectionOwner - SetClipboardData NULL\n");
+ winDebug("winProcSetSelectionOwner - SetClipboardData NULL\n");
- /* Advertise Unicode if we support it */
- if (g_fUnicodeSupport)
- SetClipboardData (CF_UNICODETEXT, NULL);
+ /* Advertise Unicode if we support it */
+ if (g_fUnicodeSupport)
+ SetClipboardData(CF_UNICODETEXT, NULL);
- /* Always advertise regular text */
- SetClipboardData (CF_TEXT, NULL);
+ /* Always advertise regular text */
+ SetClipboardData(CF_TEXT, NULL);
- /* Save handle to last owned selection */
- g_atomLastOwnedSelection = stuff->selection;
+ /* Save handle to last owned selection */
+ g_atomLastOwnedSelection = stuff->selection;
- /* Release the clipboard */
- if (!CloseClipboard ())
- {
- ErrorF ("winProcSetSelectionOwner - CloseClipboard () failed: "
- "%08x\n",
- (int) GetLastError ());
- goto winProcSetSelectionOwner_Done;
+ /* Release the clipboard */
+ if (!CloseClipboard()) {
+ ErrorF("winProcSetSelectionOwner - CloseClipboard () failed: "
+ "%08x\n", (int) GetLastError());
+ goto winProcSetSelectionOwner_Done;
}
winProcSetSelectionOwner_Done:
- return (*winProcSetSelectionOwnerOrig) (client);
+ return (*winProcSetSelectionOwnerOrig) (client);
}
diff --git a/xorg-server/hw/xwin/winclipboardxevents.c b/xorg-server/hw/xwin/winclipboardxevents.c
index 53b4d7d77..2be03b707 100644
--- a/xorg-server/hw/xwin/winclipboardxevents.c
+++ b/xorg-server/hw/xwin/winclipboardxevents.c
@@ -37,190 +37,176 @@
#include "misc.h"
#include "winmsg.h"
#include <unistd.h>
-
/*
* References to external symbols
*/
-extern Bool g_fUnicodeSupport;
+extern Bool g_fUnicodeSupport;
extern Bool g_fClipboardPrimary;
-
/*
* Process any pending X events
*/
int
-winClipboardFlushXEvents (HWND hwnd,
- int iWindow,
- Display *pDisplay,
- Bool fUseUnicode,
- Bool ClipboardOpened)
+winClipboardFlushXEvents(HWND hwnd,
+ int iWindow, Display * pDisplay, Bool fUseUnicode, Bool ClipboardOpened)
{
- static Atom atomLocalProperty;
- static Atom atomCompoundText;
- static Atom atomUTF8String;
- static Atom atomTargets;
- static int generation;
-
- if (generation != serverGeneration)
- {
- generation = serverGeneration;
- atomLocalProperty = XInternAtom (pDisplay, WIN_LOCAL_PROPERTY, False);
- atomUTF8String = XInternAtom (pDisplay, "UTF8_STRING", False);
- atomCompoundText = XInternAtom (pDisplay, "COMPOUND_TEXT", False);
- atomTargets = XInternAtom (pDisplay, "TARGETS", False);
+ static Atom atomLocalProperty;
+ static Atom atomCompoundText;
+ static Atom atomUTF8String;
+ static Atom atomTargets;
+ static int generation;
+
+ if (generation != serverGeneration) {
+ generation = serverGeneration;
+ atomLocalProperty = XInternAtom(pDisplay, WIN_LOCAL_PROPERTY, False);
+ atomUTF8String = XInternAtom(pDisplay, "UTF8_STRING", False);
+ atomCompoundText = XInternAtom(pDisplay, "COMPOUND_TEXT", False);
+ atomTargets = XInternAtom(pDisplay, "TARGETS", False);
}
- /* Process all pending events */
- while (XPending (pDisplay))
- {
- XTextProperty xtpText = {0};
- XEvent event;
- XSelectionEvent eventSelection;
- unsigned long ulReturnBytesLeft;
- char *pszReturnData = NULL;
- char *pszGlobalData = NULL;
- int iReturn;
- HGLOBAL hGlobal = NULL;
- XICCEncodingStyle xiccesStyle;
- int iConvertDataLen = 0;
- char *pszConvertData = NULL;
- char *pszTextList[2] = {NULL};
- int iCount;
- char **ppszTextList = NULL;
- wchar_t *pwszUnicodeStr = NULL;
- int iUnicodeLen = 0;
- int iReturnDataLen = 0;
- int i;
- Bool fAbort = FALSE;
- Bool fCloseClipboard = FALSE;
- Bool fSetClipboardData = TRUE;
-
- /* Get the next event - will not block because one is ready */
- XNextEvent (pDisplay, &event);
+ /* Process all pending events */
+ while (XPending(pDisplay)) {
+ XTextProperty xtpText = { 0 };
+ XEvent event;
+ XSelectionEvent eventSelection;
+ unsigned long ulReturnBytesLeft;
+ char *pszReturnData = NULL;
+ char *pszGlobalData = NULL;
+ int iReturn;
+ HGLOBAL hGlobal = NULL;
+ XICCEncodingStyle xiccesStyle;
+ int iConvertDataLen = 0;
+ char *pszConvertData = NULL;
+ char *pszTextList[2] = { NULL };
+ int iCount;
+ char **ppszTextList = NULL;
+ wchar_t *pwszUnicodeStr = NULL;
+ int iUnicodeLen = 0;
+ int iReturnDataLen = 0;
+ int i;
+ Bool fAbort = FALSE;
+ Bool fCloseClipboard = FALSE;
+ Bool fSetClipboardData = TRUE;
+
+ /* Get the next event - will not block because one is ready */
+ XNextEvent(pDisplay, &event);
winDebug ("Received event type %d\n",event.type);
- /* Branch on the event type */
- switch (event.type)
- {
- /*
- * SelectionRequest
- */
+ /* Branch on the event type */
+ switch (event.type) {
+ /*
+ * SelectionRequest
+ */
- case SelectionRequest:
+ case SelectionRequest:
#ifdef _DEBUG
- {
- char *pszAtomName = NULL;
- winDebug("SelectionRequest - target %d\n",
+ {
+ char *pszAtomName = NULL;
+
+ winDebug("SelectionRequest - target %d\n",
event.xselectionrequest.target);
- pszAtomName = XGetAtomName (pDisplay,
- event.xselectionrequest.target);
- winDebug("SelectionRequest - Target atom name %s\n", pszAtomName);
- XFree (pszAtomName);
- pszAtomName = NULL;
+ pszAtomName = XGetAtomName(pDisplay,
+ event.xselectionrequest.target);
+ winDebug("SelectionRequest - Target atom name %s\n", pszAtomName);
+ XFree(pszAtomName);
+ pszAtomName = NULL;
winDebug ("SelectionRequest - owner %d\n", event.xselectionrequest.owner);
winDebug ("SelectionRequest - requestor %d\n", event.xselectionrequest.requestor);
- }
+ }
#endif
- /* Abort if invalid target type */
- if (event.xselectionrequest.target != XA_STRING
- && event.xselectionrequest.target != atomUTF8String
- && event.xselectionrequest.target != atomCompoundText
- && event.xselectionrequest.target != atomTargets)
- {
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
-
- /* Handle targets type of request */
- if (event.xselectionrequest.target == atomTargets)
- {
- Atom atomTargetArr[] = {atomTargets,
- atomCompoundText,
- atomUTF8String,
- XA_STRING};
-
- /* Try to change the property */
- iReturn = XChangeProperty (pDisplay,
- event.xselectionrequest.requestor,
- event.xselectionrequest.property,
- XA_ATOM,
- 32,
- PropModeReplace,
- (unsigned char *) atomTargetArr,
- (sizeof (atomTargetArr)
- / sizeof (atomTargetArr[0])));
- if (iReturn == BadAlloc
- || iReturn == BadAtom
- || iReturn == BadMatch
- || iReturn == BadValue
- || iReturn == BadWindow)
- {
- ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
- "XChangeProperty failed: %d\n",
- iReturn);
- }
-
- /* Setup selection notify xevent */
- eventSelection.type = SelectionNotify;
- eventSelection.send_event = True;
- eventSelection.display = pDisplay;
- eventSelection.requestor = event.xselectionrequest.requestor;
- eventSelection.selection = event.xselectionrequest.selection;
- eventSelection.target = event.xselectionrequest.target;
- eventSelection.property = event.xselectionrequest.property;
- eventSelection.time = event.xselectionrequest.time;
-
- /*
- * Notify the requesting window that
- * the operation has completed
- */
- iReturn = XSendEvent (pDisplay,
- eventSelection.requestor,
- False,
- 0L,
- (XEvent *) &eventSelection);
- if (iReturn == BadValue || iReturn == BadWindow)
- {
- ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
- "XSendEvent () failed\n");
- }
- break;
- }
-
- /* Check that clipboard format is available */
- if (fUseUnicode
- && !IsClipboardFormatAvailable (CF_UNICODETEXT))
- {
- static int count; /* Hack to stop acroread spamming the log */
- static HWND lasthwnd; /* I've not seen any other client get here repeatedly? */
- if (hwnd != lasthwnd) count = 0;
- count++;
- if (count < 6) ErrorF ("winClipboardFlushXEvents - CF_UNICODETEXT is not "
- "available from Win32 clipboard. Aborting %d.\n", count);
- lasthwnd = hwnd;
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
- else if (!fUseUnicode
- && !IsClipboardFormatAvailable (CF_TEXT))
- {
- ErrorF ("winClipboardFlushXEvents - CF_TEXT is not "
- "available from Win32 clipboard. Aborting.\n");
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
-
- /* Access the clipboard */
+ /* Abort if invalid target type */
+ if (event.xselectionrequest.target != XA_STRING
+ && event.xselectionrequest.target != atomUTF8String
+ && event.xselectionrequest.target != atomCompoundText
+ && event.xselectionrequest.target != atomTargets) {
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Handle targets type of request */
+ if (event.xselectionrequest.target == atomTargets) {
+ Atom atomTargetArr[] = { atomTargets,
+ atomCompoundText,
+ atomUTF8String,
+ XA_STRING
+ };
+
+ /* Try to change the property */
+ iReturn = XChangeProperty(pDisplay,
+ event.xselectionrequest.requestor,
+ event.xselectionrequest.property,
+ XA_ATOM,
+ 32,
+ PropModeReplace,
+ (unsigned char *) atomTargetArr,
+ (sizeof(atomTargetArr)
+ / sizeof(atomTargetArr[0])));
+ if (iReturn == BadAlloc
+ || iReturn == BadAtom
+ || iReturn == BadMatch
+ || iReturn == BadValue || iReturn == BadWindow) {
+ ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+ "XChangeProperty failed: %d\n", iReturn);
+ }
+
+ /* Setup selection notify xevent */
+ eventSelection.type = SelectionNotify;
+ eventSelection.send_event = True;
+ eventSelection.display = pDisplay;
+ eventSelection.requestor = event.xselectionrequest.requestor;
+ eventSelection.selection = event.xselectionrequest.selection;
+ eventSelection.target = event.xselectionrequest.target;
+ eventSelection.property = event.xselectionrequest.property;
+ eventSelection.time = event.xselectionrequest.time;
+
+ /*
+ * Notify the requesting window that
+ * the operation has completed
+ */
+ iReturn = XSendEvent(pDisplay,
+ eventSelection.requestor,
+ False, 0L, (XEvent *) & eventSelection);
+ if (iReturn == BadValue || iReturn == BadWindow) {
+ ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed\n");
+ }
+ break;
+ }
+
+ /* Check that clipboard format is available */
+ if (fUseUnicode && !IsClipboardFormatAvailable(CF_UNICODETEXT)) {
+ static int count; /* Hack to stop acroread spamming the log */
+ static HWND lasthwnd; /* I've not seen any other client get here repeatedly? */
+
+ if (hwnd != lasthwnd)
+ count = 0;
+ count++;
+ if (count < 6)
+ ErrorF("winClipboardFlushXEvents - CF_UNICODETEXT is not "
+ "available from Win32 clipboard. Aborting %d.\n",
+ count);
+ lasthwnd = hwnd;
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+ else if (!fUseUnicode && !IsClipboardFormatAvailable(CF_TEXT)) {
+ ErrorF("winClipboardFlushXEvents - CF_TEXT is not "
+ "available from Win32 clipboard. Aborting.\n");
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Access the clipboard */
if (!ClipboardOpened)
{
if (!OpenClipboard (hwnd))
@@ -237,35 +223,32 @@ winClipboardFlushXEvents (HWND hwnd,
/* Indicate that clipboard was opened */
fCloseClipboard = TRUE;
}
- /* Setup the string style */
- if (event.xselectionrequest.target == XA_STRING)
- xiccesStyle = XStringStyle;
+ /* Setup the string style */
+ if (event.xselectionrequest.target == XA_STRING)
+ xiccesStyle = XStringStyle;
#ifdef X_HAVE_UTF8_STRING
- else if (event.xselectionrequest.target == atomUTF8String)
- xiccesStyle = XUTF8StringStyle;
+ else if (event.xselectionrequest.target == atomUTF8String)
+ xiccesStyle = XUTF8StringStyle;
#endif
- else if (event.xselectionrequest.target == atomCompoundText)
- xiccesStyle = XCompoundTextStyle;
- else
- xiccesStyle = XStringStyle;
-
- /*
- * FIXME: Can't pass CF_UNICODETEXT on Windows 95/98/Me
- */
-
- /* Get a pointer to the clipboard text, in desired format */
- if (fUseUnicode)
- {
- /* Retrieve clipboard data */
- hGlobal = GetClipboardData (CF_UNICODETEXT);
- }
- else
- {
- /* Retrieve clipboard data */
- hGlobal = GetClipboardData (CF_TEXT);
- }
- if (!hGlobal)
- {
+ else if (event.xselectionrequest.target == atomCompoundText)
+ xiccesStyle = XCompoundTextStyle;
+ else
+ xiccesStyle = XStringStyle;
+
+ /*
+ * FIXME: Can't pass CF_UNICODETEXT on Windows 95/98/Me
+ */
+
+ /* Get a pointer to the clipboard text, in desired format */
+ if (fUseUnicode) {
+ /* Retrieve clipboard data */
+ hGlobal = GetClipboardData(CF_UNICODETEXT);
+ }
+ else {
+ /* Retrieve clipboard data */
+ hGlobal = GetClipboardData(CF_TEXT);
+ }
+ if (!hGlobal) {
if (GetLastError()==ERROR_CLIPBOARD_NOT_OPEN && ClipboardOpened)
{
ErrorF("We should not have received a SelectionRequest????\n"
@@ -276,541 +259,468 @@ winClipboardFlushXEvents (HWND hwnd,
XSetSelectionOwner (pDisplay, XInternAtom (pDisplay, "CLIPBOARD", False), None, CurrentTime);
}
ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
- "GetClipboardData () failed: %08lx\n",
- GetLastError ());
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
- pszGlobalData = (char *) GlobalLock (hGlobal);
-
- /* Convert the Unicode string to UTF8 (MBCS) */
- if (fUseUnicode)
- {
- iConvertDataLen = WideCharToMultiByte (CP_UTF8,
- 0,
- (LPCWSTR)pszGlobalData,
- -1,
- NULL,
- 0,
- NULL,
- NULL);
- /* NOTE: iConvertDataLen includes space for null terminator */
- pszConvertData = (char *) malloc (iConvertDataLen);
- WideCharToMultiByte (CP_UTF8,
- 0,
- (LPCWSTR)pszGlobalData,
- -1,
- pszConvertData,
- iConvertDataLen,
- NULL,
- NULL);
- }
- else
- {
- pszConvertData = strdup (pszGlobalData);
- iConvertDataLen = strlen (pszConvertData) + 1;
- }
-
- /* Convert DOS string to UNIX string */
- winClipboardDOStoUNIX (pszConvertData, strlen (pszConvertData));
-
- /* Setup our text list */
- pszTextList[0] = pszConvertData;
- pszTextList[1] = NULL;
-
- /* Initialize the text property */
- xtpText.value = NULL;
- xtpText.nitems = 0;
-
- /* Create the text property from the text list */
- if (fUseUnicode)
- {
+ "GetClipboardData () failed: %08lx\n", GetLastError());
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+ pszGlobalData = (char *) GlobalLock(hGlobal);
+
+ /* Convert the Unicode string to UTF8 (MBCS) */
+ if (fUseUnicode) {
+ iConvertDataLen = WideCharToMultiByte(CP_UTF8,
+ 0,
+ (LPCWSTR) pszGlobalData,
+ -1, NULL, 0, NULL, NULL);
+ /* NOTE: iConvertDataLen includes space for null terminator */
+ pszConvertData = (char *) malloc(iConvertDataLen);
+ WideCharToMultiByte(CP_UTF8,
+ 0,
+ (LPCWSTR) pszGlobalData,
+ -1,
+ pszConvertData,
+ iConvertDataLen, NULL, NULL);
+ }
+ else {
+ pszConvertData = strdup(pszGlobalData);
+ iConvertDataLen = strlen(pszConvertData) + 1;
+ }
+
+ /* Convert DOS string to UNIX string */
+ winClipboardDOStoUNIX(pszConvertData, strlen(pszConvertData));
+
+ /* Setup our text list */
+ pszTextList[0] = pszConvertData;
+ pszTextList[1] = NULL;
+
+ /* Initialize the text property */
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+
+ /* Create the text property from the text list */
+ if (fUseUnicode) {
#ifdef X_HAVE_UTF8_STRING
- iReturn = Xutf8TextListToTextProperty (pDisplay,
- pszTextList,
- 1,
- xiccesStyle,
- &xtpText);
+ iReturn = Xutf8TextListToTextProperty(pDisplay,
+ pszTextList,
+ 1, xiccesStyle, &xtpText);
#endif
- }
- else
- {
- iReturn = XmbTextListToTextProperty (pDisplay,
- pszTextList,
- 1,
- xiccesStyle,
- &xtpText);
- }
- if (iReturn == XNoMemory || iReturn == XLocaleNotSupported)
- {
- ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
- "X*TextListToTextProperty failed: %d\n",
- iReturn);
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
-
- /* Free the converted string */
- free (pszConvertData);
- pszConvertData = NULL;
-
- /* Copy the clipboard text to the requesting window */
- iReturn = XChangeProperty (pDisplay,
- event.xselectionrequest.requestor,
- event.xselectionrequest.property,
- event.xselectionrequest.target,
- 8,
- PropModeReplace,
- xtpText.value,
- xtpText.nitems);
- if (iReturn == BadAlloc || iReturn == BadAtom
- || iReturn == BadMatch || iReturn == BadValue
- || iReturn == BadWindow)
- {
- ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
- "XChangeProperty failed: %d\n",
- iReturn);
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
-
- /* Release the clipboard data */
- GlobalUnlock (hGlobal);
- pszGlobalData = NULL;
+ }
+ else {
+ iReturn = XmbTextListToTextProperty(pDisplay,
+ pszTextList,
+ 1, xiccesStyle, &xtpText);
+ }
+ if (iReturn == XNoMemory || iReturn == XLocaleNotSupported) {
+ ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+ "X*TextListToTextProperty failed: %d\n", iReturn);
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Free the converted string */
+ free(pszConvertData);
+ pszConvertData = NULL;
+
+ /* Copy the clipboard text to the requesting window */
+ iReturn = XChangeProperty(pDisplay,
+ event.xselectionrequest.requestor,
+ event.xselectionrequest.property,
+ event.xselectionrequest.target,
+ 8,
+ PropModeReplace,
+ xtpText.value, xtpText.nitems);
+ if (iReturn == BadAlloc || iReturn == BadAtom
+ || iReturn == BadMatch || iReturn == BadValue
+ || iReturn == BadWindow) {
+ ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+ "XChangeProperty failed: %d\n", iReturn);
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Release the clipboard data */
+ GlobalUnlock(hGlobal);
+ pszGlobalData = NULL;
if (fCloseClipboard)
{
fCloseClipboard = FALSE;
CloseClipboard ();
}
- /* Clean up */
- XFree (xtpText.value);
- xtpText.value = NULL;
- xtpText.nitems = 0;
-
- /* Setup selection notify event */
- eventSelection.type = SelectionNotify;
- eventSelection.send_event = True;
- eventSelection.display = pDisplay;
- eventSelection.requestor = event.xselectionrequest.requestor;
- eventSelection.selection = event.xselectionrequest.selection;
- eventSelection.target = event.xselectionrequest.target;
- eventSelection.property = event.xselectionrequest.property;
- eventSelection.time = event.xselectionrequest.time;
-
- /* Notify the requesting window that the operation has completed */
- iReturn = XSendEvent (pDisplay,
- eventSelection.requestor,
- False,
- 0L,
- (XEvent *) &eventSelection);
- if (iReturn == BadValue || iReturn == BadWindow)
- {
- ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
- "XSendEvent () failed\n");
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionRequest_Done;
- }
-
- winClipboardFlushXEvents_SelectionRequest_Done:
- /* Free allocated resources */
- if (xtpText.value)
- {
- XFree (xtpText.value);
- xtpText.value = NULL;
- xtpText.nitems = 0;
- }
- free(pszConvertData);
- if (hGlobal && pszGlobalData)
- GlobalUnlock (hGlobal);
-
- /*
- * Send a SelectionNotify event to the requesting
- * client when we abort.
- */
- if (fAbort)
- {
- /* Setup selection notify event */
- eventSelection.type = SelectionNotify;
- eventSelection.send_event = True;
- eventSelection.display = pDisplay;
- eventSelection.requestor = event.xselectionrequest.requestor;
- eventSelection.selection = event.xselectionrequest.selection;
- eventSelection.target = event.xselectionrequest.target;
- eventSelection.property = None;
- eventSelection.time = event.xselectionrequest.time;
-
- /* Notify the requesting window that the operation is complete */
- iReturn = XSendEvent (pDisplay,
- eventSelection.requestor,
- False,
- 0L,
- (XEvent *) &eventSelection);
- if (iReturn == BadValue || iReturn == BadWindow)
- {
- /*
- * Should not be a problem if XSendEvent fails because
- * the client may simply have exited.
- */
- ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
- "XSendEvent () failed for abort event.\n");
- }
- }
-
- /* Close clipboard if it was opened */
- if (fCloseClipboard)
- {
- fCloseClipboard = FALSE;
- CloseClipboard ();
- }
- break;
-
-
- /*
- * SelectionNotify
- */
- case SelectionNotify:
+ /* Clean up */
+ XFree(xtpText.value);
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+
+ /* Setup selection notify event */
+ eventSelection.type = SelectionNotify;
+ eventSelection.send_event = True;
+ eventSelection.display = pDisplay;
+ eventSelection.requestor = event.xselectionrequest.requestor;
+ eventSelection.selection = event.xselectionrequest.selection;
+ eventSelection.target = event.xselectionrequest.target;
+ eventSelection.property = event.xselectionrequest.property;
+ eventSelection.time = event.xselectionrequest.time;
+
+ /* Notify the requesting window that the operation has completed */
+ iReturn = XSendEvent(pDisplay,
+ eventSelection.requestor,
+ False, 0L, (XEvent *) & eventSelection);
+ if (iReturn == BadValue || iReturn == BadWindow) {
+ ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed\n");
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ winClipboardFlushXEvents_SelectionRequest_Done:
+ /* Free allocated resources */
+ if (xtpText.value) {
+ XFree(xtpText.value);
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+ }
+ free(pszConvertData);
+ if (hGlobal && pszGlobalData)
+ GlobalUnlock(hGlobal);
+
+ /*
+ * Send a SelectionNotify event to the requesting
+ * client when we abort.
+ */
+ if (fAbort) {
+ /* Setup selection notify event */
+ eventSelection.type = SelectionNotify;
+ eventSelection.send_event = True;
+ eventSelection.display = pDisplay;
+ eventSelection.requestor = event.xselectionrequest.requestor;
+ eventSelection.selection = event.xselectionrequest.selection;
+ eventSelection.target = event.xselectionrequest.target;
+ eventSelection.property = None;
+ eventSelection.time = event.xselectionrequest.time;
+
+ /* Notify the requesting window that the operation is complete */
+ iReturn = XSendEvent(pDisplay,
+ eventSelection.requestor,
+ False, 0L, (XEvent *) & eventSelection);
+ if (iReturn == BadValue || iReturn == BadWindow) {
+ /*
+ * Should not be a problem if XSendEvent fails because
+ * the client may simply have exited.
+ */
+ ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed for abort event.\n");
+ }
+ }
+
+ /* Close clipboard if it was opened */
+ if (fCloseClipboard) {
+ fCloseClipboard = FALSE;
+ CloseClipboard();
+ }
+ break;
+
+ /*
+ * SelectionNotify
+ */
+ case SelectionNotify:
#ifdef _DEBUG
- winDebug ("winClipboardFlushXEvents - SelectionNotify\n");
- {
- char *pszAtomName;
- pszAtomName = XGetAtomName (pDisplay,
- event.xselection.selection);
+ winDebug("winClipboardFlushXEvents - SelectionNotify\n");
+ {
+ char *pszAtomName;
+
+ pszAtomName = XGetAtomName(pDisplay,
+ event.xselection.selection);
- winDebug("winClipboardFlushXEvents - SelectionNotify - ATOM: %s\n",
+ winDebug
+ ("winClipboardFlushXEvents - SelectionNotify - ATOM: %s\n",
pszAtomName);
winDebug ("SelectionNotify - requestor %d\n", event.xselectionrequest.requestor);
- XFree (pszAtomName);
- }
+ XFree(pszAtomName);
+ }
#endif
- /*
- * Request conversion of UTF8 and CompoundText targets.
- */
- if (event.xselection.property == None)
- {
- if (event.xselection.target == XA_STRING)
- {
- winDebug ("winClipboardFlushXEvents - SelectionNotify - "
- "XA_STRING\n");
-
- return WIN_XEVENTS_CONVERT;
- }
- else if (event.xselection.target == atomUTF8String)
- {
- winDebug("winClipboardFlushXEvents - SelectionNotify - "
- "Requesting conversion of UTF8 target.\n");
-
- XConvertSelection (pDisplay,
- event.xselection.selection,
- XA_STRING,
- atomLocalProperty,
- iWindow,
- CurrentTime);
-
- /* Process the ConvertSelection event */
- XFlush (pDisplay);
- return WIN_XEVENTS_CONVERT;
- }
+ /*
+ * Request conversion of UTF8 and CompoundText targets.
+ */
+ if (event.xselection.property == None) {
+ if (event.xselection.target == XA_STRING) {
+ winDebug("winClipboardFlushXEvents - SelectionNotify - "
+ "XA_STRING\n");
+
+ return WIN_XEVENTS_CONVERT;
+ }
+ else if (event.xselection.target == atomUTF8String) {
+ winDebug("winClipboardFlushXEvents - SelectionNotify - "
+ "Requesting conversion of UTF8 target.\n");
+
+ XConvertSelection(pDisplay,
+ event.xselection.selection,
+ XA_STRING,
+ atomLocalProperty, iWindow, CurrentTime);
+
+ /* Process the ConvertSelection event */
+ XFlush(pDisplay);
+ return WIN_XEVENTS_CONVERT;
+ }
#ifdef X_HAVE_UTF8_STRING
- else if (event.xselection.target == atomCompoundText)
- {
- winDebug("winClipboardFlushXEvents - SelectionNotify - "
- "Requesting conversion of CompoundText target.\n");
-
- XConvertSelection (pDisplay,
- event.xselection.selection,
- atomUTF8String,
- atomLocalProperty,
- iWindow,
- CurrentTime);
-
- /* Process the ConvertSelection event */
- XFlush (pDisplay);
- return WIN_XEVENTS_CONVERT;
- }
+ else if (event.xselection.target == atomCompoundText) {
+ winDebug("winClipboardFlushXEvents - SelectionNotify - "
+ "Requesting conversion of CompoundText target.\n");
+
+ XConvertSelection(pDisplay,
+ event.xselection.selection,
+ atomUTF8String,
+ atomLocalProperty, iWindow, CurrentTime);
+
+ /* Process the ConvertSelection event */
+ XFlush(pDisplay);
+ return WIN_XEVENTS_CONVERT;
+ }
#endif
- else
- {
- ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
- "Unknown format. Cannot request conversion, "
- "aborting.\n");
- break;
- }
- }
-
- /* Retrieve the size of the stored data */
- iReturn = XGetWindowProperty (pDisplay,
- iWindow,
- atomLocalProperty,
- 0,
- 0, /* Don't get data, just size */
- False,
- AnyPropertyType,
- &xtpText.encoding,
- &xtpText.format,
- &xtpText.nitems,
- &ulReturnBytesLeft,
- &xtpText.value);
- if (iReturn != Success)
- {
- ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
- "XGetWindowProperty () failed, aborting: %d\n",
- iReturn);
- break;
- }
-
- winDebug("SelectionNotify - returned data %d left %d\n",
- xtpText.nitems, ulReturnBytesLeft);
-
- /* Request the selection data */
- iReturn = XGetWindowProperty (pDisplay,
- iWindow,
- atomLocalProperty,
- 0,
- ulReturnBytesLeft,
- False,
- AnyPropertyType,
- &xtpText.encoding,
- &xtpText.format,
- &xtpText.nitems,
- &ulReturnBytesLeft,
- &xtpText.value);
- if (iReturn != Success)
- {
- ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
- "XGetWindowProperty () failed, aborting: %d\n",
- iReturn);
- break;
- }
+ else {
+ ErrorF("winClipboardFlushXEvents - SelectionNotify - "
+ "Unknown format. Cannot request conversion, "
+ "aborting.\n");
+ break;
+ }
+ }
+
+ /* Retrieve the size of the stored data */
+ iReturn = XGetWindowProperty(pDisplay, iWindow, atomLocalProperty, 0, 0, /* Don't get data, just size */
+ False,
+ AnyPropertyType,
+ &xtpText.encoding,
+ &xtpText.format,
+ &xtpText.nitems,
+ &ulReturnBytesLeft, &xtpText.value);
+ if (iReturn != Success) {
+ ErrorF("winClipboardFlushXEvents - SelectionNotify - "
+ "XGetWindowProperty () failed, aborting: %d\n", iReturn);
+ break;
+ }
+
+ winDebug("SelectionNotify - returned data %d left %d\n",
+ xtpText.nitems, ulReturnBytesLeft);
+
+ /* Request the selection data */
+ iReturn = XGetWindowProperty(pDisplay,
+ iWindow,
+ atomLocalProperty,
+ 0,
+ ulReturnBytesLeft,
+ False,
+ AnyPropertyType,
+ &xtpText.encoding,
+ &xtpText.format,
+ &xtpText.nitems,
+ &ulReturnBytesLeft, &xtpText.value);
+ if (iReturn != Success) {
+ ErrorF("winClipboardFlushXEvents - SelectionNotify - "
+ "XGetWindowProperty () failed, aborting: %d\n", iReturn);
+ break;
+ }
#ifdef WINDBG
- {
- char *pszAtomName = NULL;
-
- winDebug("SelectionNotify - returned data %d left %d\n",
- xtpText.nitems, ulReturnBytesLeft);
- pszAtomName = XGetAtomName(pDisplay, xtpText.encoding);
- winDebug("Notify atom name %s\n", pszAtomName);
- XFree (pszAtomName);
- pszAtomName = NULL;
- }
+ {
+ char *pszAtomName = NULL;
+
+ winDebug("SelectionNotify - returned data %d left %d\n",
+ xtpText.nitems, ulReturnBytesLeft);
+ pszAtomName = XGetAtomName(pDisplay, xtpText.encoding);
+ winDebug("Notify atom name %s\n", pszAtomName);
+ XFree(pszAtomName);
+ pszAtomName = NULL;
+ }
#endif
- if (fUseUnicode)
- {
+ if (fUseUnicode) {
#ifdef X_HAVE_UTF8_STRING
- /* Convert the text property to a text list */
- iReturn = Xutf8TextPropertyToTextList (pDisplay,
- &xtpText,
- &ppszTextList,
- &iCount);
+ /* Convert the text property to a text list */
+ iReturn = Xutf8TextPropertyToTextList(pDisplay,
+ &xtpText,
+ &ppszTextList, &iCount);
#endif
- }
- else
- {
- iReturn = XmbTextPropertyToTextList (pDisplay,
- &xtpText,
- &ppszTextList,
- &iCount);
- }
- if (iReturn == Success || iReturn > 0)
- {
- /* Conversion succeeded or some unconvertible characters */
- if (ppszTextList != NULL)
- {
- iReturnDataLen = 0;
- for (i = 0; i < iCount; i++)
- {
- iReturnDataLen += strlen(ppszTextList[i]);
- }
- pszReturnData = (char *) malloc (iReturnDataLen + 1);
- pszReturnData[0] = '\0';
- for (i = 0; i < iCount; i++)
- {
- strcat (pszReturnData, ppszTextList[i]);
- }
- }
- else
- {
- ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
- "X*TextPropertyToTextList list_return is NULL.\n");
- pszReturnData = (char *) malloc (1);
- pszReturnData[0] = '\0';
- }
- }
- else
- {
- ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
- "X*TextPropertyToTextList returned: ");
- switch (iReturn)
- {
- case XNoMemory:
- ErrorF ("XNoMemory\n");
- break;
- case XLocaleNotSupported:
- ErrorF ("XLocaleNotSupported\n");
- break;
- case XConverterNotFound:
- ErrorF ("XConverterNotFound\n");
- break;
- default:
- ErrorF ("%d\n", iReturn);
- break;
- }
- pszReturnData = (char *) malloc (1);
- pszReturnData[0] = '\0';
- }
-
- /* Free the data returned from XGetWindowProperty */
- if (ppszTextList)
- XFreeStringList (ppszTextList);
- ppszTextList = NULL;
- XFree (xtpText.value);
- xtpText.value = NULL;
- xtpText.nitems = 0;
-
- /* Convert the X clipboard string to DOS format */
- winClipboardUNIXtoDOS ((unsigned char **)&pszReturnData, strlen (pszReturnData));
-
- if (fUseUnicode)
- {
- /* Find out how much space needed to convert MBCS to Unicode */
- iUnicodeLen = MultiByteToWideChar (CP_UTF8,
- 0,
- pszReturnData,
- -1,
- NULL,
- 0);
-
- /* Allocate memory for the Unicode string */
- pwszUnicodeStr
- = (wchar_t*) malloc (sizeof (wchar_t) * (iUnicodeLen + 1));
- if (!pwszUnicodeStr)
- {
- ErrorF ("winClipboardFlushXEvents - SelectionNotify "
- "malloc failed for pwszUnicodeStr, aborting.\n");
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionNotify_Done;
- }
-
- /* Do the actual conversion */
- MultiByteToWideChar (CP_UTF8,
- 0,
- pszReturnData,
- -1,
- pwszUnicodeStr,
- iUnicodeLen);
-
- /* Allocate global memory for the X clipboard data */
- hGlobal = GlobalAlloc (GMEM_MOVEABLE,
- sizeof (wchar_t) * (iUnicodeLen + 1));
- }
- else
- {
- pszConvertData = strdup (pszReturnData);
- iConvertDataLen = strlen (pszConvertData) + 1;
-
- /* Allocate global memory for the X clipboard data */
- hGlobal = GlobalAlloc (GMEM_MOVEABLE, iConvertDataLen);
- }
-
- free (pszReturnData);
-
- /* Check that global memory was allocated */
- if (!hGlobal)
- {
- ErrorF ("winClipboardFlushXEvents - SelectionNotify "
- "GlobalAlloc failed, aborting: %ld\n",
- GetLastError ());
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionNotify_Done;
- }
-
- /* Obtain a pointer to the global memory */
- pszGlobalData = GlobalLock (hGlobal);
- if (pszGlobalData == NULL)
- {
- ErrorF ("winClipboardFlushXEvents - Could not lock global "
- "memory for clipboard transfer\n");
-
- /* Abort */
- fAbort = TRUE;
- goto winClipboardFlushXEvents_SelectionNotify_Done;
- }
-
- /* Copy the returned string into the global memory */
- if (fUseUnicode)
- {
- memcpy (pszGlobalData,
- pwszUnicodeStr,
- sizeof (wchar_t) * (iUnicodeLen + 1));
- free (pwszUnicodeStr);
- pwszUnicodeStr = NULL;
- }
- else
- {
- strcpy (pszGlobalData, pszConvertData);
- free (pszConvertData);
- pszConvertData = NULL;
- }
-
- /* Release the pointer to the global memory */
- GlobalUnlock (hGlobal);
- pszGlobalData = NULL;
-
- /* Push the selection data to the Windows clipboard */
- if (fUseUnicode)
- SetClipboardData (CF_UNICODETEXT, hGlobal);
- else
- SetClipboardData (CF_TEXT, hGlobal);
-
- /* Flag that SetClipboardData has been called */
- fSetClipboardData = FALSE;
-
- /*
- * NOTE: Do not try to free pszGlobalData, it is owned by
- * Windows after the call to SetClipboardData ().
- */
-
- winClipboardFlushXEvents_SelectionNotify_Done:
- /* Free allocated resources */
- if (ppszTextList)
- XFreeStringList (ppszTextList);
- if (xtpText.value)
- {
- XFree (xtpText.value);
- xtpText.value = NULL;
- xtpText.nitems = 0;
- }
- free(pszConvertData);
- free(pwszUnicodeStr);
- if (hGlobal && pszGlobalData)
- GlobalUnlock (hGlobal);
- if (fSetClipboardData && g_fUnicodeSupport)
- SetClipboardData (CF_UNICODETEXT, NULL);
- if (fSetClipboardData)
- SetClipboardData (CF_TEXT, NULL);
- return WIN_XEVENTS_NOTIFY;
+ }
+ else {
+ iReturn = XmbTextPropertyToTextList(pDisplay,
+ &xtpText,
+ &ppszTextList, &iCount);
+ }
+ if (iReturn == Success || iReturn > 0) {
+ /* Conversion succeeded or some unconvertible characters */
+ if (ppszTextList != NULL) {
+ iReturnDataLen = 0;
+ for (i = 0; i < iCount; i++) {
+ iReturnDataLen += strlen(ppszTextList[i]);
+ }
+ pszReturnData = (char *) malloc(iReturnDataLen + 1);
+ pszReturnData[0] = '\0';
+ for (i = 0; i < iCount; i++) {
+ strcat(pszReturnData, ppszTextList[i]);
+ }
+ }
+ else {
+ ErrorF("winClipboardFlushXEvents - SelectionNotify - "
+ "X*TextPropertyToTextList list_return is NULL.\n");
+ pszReturnData = (char *) malloc(1);
+ pszReturnData[0] = '\0';
+ }
+ }
+ else {
+ ErrorF("winClipboardFlushXEvents - SelectionNotify - "
+ "X*TextPropertyToTextList returned: ");
+ switch (iReturn) {
+ case XNoMemory:
+ ErrorF("XNoMemory\n");
+ break;
+ case XLocaleNotSupported:
+ ErrorF("XLocaleNotSupported\n");
+ break;
+ case XConverterNotFound:
+ ErrorF("XConverterNotFound\n");
+ break;
+ default:
+ ErrorF("%d\n", iReturn);
+ break;
+ }
+ pszReturnData = (char *) malloc(1);
+ pszReturnData[0] = '\0';
+ }
+
+ /* Free the data returned from XGetWindowProperty */
+ if (ppszTextList)
+ XFreeStringList(ppszTextList);
+ ppszTextList = NULL;
+ XFree(xtpText.value);
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+
+ /* Convert the X clipboard string to DOS format */
+ winClipboardUNIXtoDOS((unsigned char **)&pszReturnData, strlen(pszReturnData));
+
+ if (fUseUnicode) {
+ /* Find out how much space needed to convert MBCS to Unicode */
+ iUnicodeLen = MultiByteToWideChar(CP_UTF8,
+ 0,
+ pszReturnData, -1, NULL, 0);
+
+ /* Allocate memory for the Unicode string */
+ pwszUnicodeStr
+ = (wchar_t *) malloc(sizeof(wchar_t) * (iUnicodeLen + 1));
+ if (!pwszUnicodeStr) {
+ ErrorF("winClipboardFlushXEvents - SelectionNotify "
+ "malloc failed for pwszUnicodeStr, aborting.\n");
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionNotify_Done;
+ }
+
+ /* Do the actual conversion */
+ MultiByteToWideChar(CP_UTF8,
+ 0,
+ pszReturnData,
+ -1, pwszUnicodeStr, iUnicodeLen);
+
+ /* Allocate global memory for the X clipboard data */
+ hGlobal = GlobalAlloc(GMEM_MOVEABLE,
+ sizeof(wchar_t) * (iUnicodeLen + 1));
+ }
+ else {
+ pszConvertData = strdup(pszReturnData);
+ iConvertDataLen = strlen(pszConvertData) + 1;
+
+ /* Allocate global memory for the X clipboard data */
+ hGlobal = GlobalAlloc(GMEM_MOVEABLE, iConvertDataLen);
+ }
+
+ free(pszReturnData);
+
+ /* Check that global memory was allocated */
+ if (!hGlobal) {
+ ErrorF("winClipboardFlushXEvents - SelectionNotify "
+ "GlobalAlloc failed, aborting: %ld\n", GetLastError());
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionNotify_Done;
+ }
+
+ /* Obtain a pointer to the global memory */
+ pszGlobalData = GlobalLock(hGlobal);
+ if (pszGlobalData == NULL) {
+ ErrorF("winClipboardFlushXEvents - Could not lock global "
+ "memory for clipboard transfer\n");
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionNotify_Done;
+ }
+
+ /* Copy the returned string into the global memory */
+ if (fUseUnicode) {
+ memcpy(pszGlobalData,
+ pwszUnicodeStr, sizeof(wchar_t) * (iUnicodeLen + 1));
+ free(pwszUnicodeStr);
+ pwszUnicodeStr = NULL;
+ }
+ else {
+ strcpy(pszGlobalData, pszConvertData);
+ free(pszConvertData);
+ pszConvertData = NULL;
+ }
+
+ /* Release the pointer to the global memory */
+ GlobalUnlock(hGlobal);
+ pszGlobalData = NULL;
+
+ /* Push the selection data to the Windows clipboard */
+ if (fUseUnicode)
+ SetClipboardData(CF_UNICODETEXT, hGlobal);
+ else
+ SetClipboardData(CF_TEXT, hGlobal);
+
+ /* Flag that SetClipboardData has been called */
+ fSetClipboardData = FALSE;
+
+ /*
+ * NOTE: Do not try to free pszGlobalData, it is owned by
+ * Windows after the call to SetClipboardData ().
+ */
+
+ winClipboardFlushXEvents_SelectionNotify_Done:
+ /* Free allocated resources */
+ if (ppszTextList)
+ XFreeStringList(ppszTextList);
+ if (xtpText.value) {
+ XFree(xtpText.value);
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+ }
+ free(pszConvertData);
+ free(pwszUnicodeStr);
+ if (hGlobal && pszGlobalData)
+ GlobalUnlock(hGlobal);
+ if (fSetClipboardData && g_fUnicodeSupport)
+ SetClipboardData(CF_UNICODETEXT, NULL);
+ if (fSetClipboardData)
+ SetClipboardData(CF_TEXT, NULL);
+ return WIN_XEVENTS_NOTIFY;
/*
* SelectionClear
*/
case SelectionClear:
#ifdef _DEBUG
- winDebug ("SelectionClear - doing nothing\n");
+ winDebug("SelectionClear - doing nothing\n");
{
char *pszAtomName;
@@ -824,20 +734,21 @@ winClipboardFlushXEvents (HWND hwnd,
XFree (pszAtomName);
}
#endif
- break;
+ break;
- case PropertyNotify:
- break;
+ case PropertyNotify:
+ break;
- case MappingNotify:
- XRefreshKeyboardMapping((XMappingEvent *)&event);
- break;
-
- default:
- ErrorF ("winClipboardFlushXEvents - unexpected event type %d\n", event.type);
- break;
- }
+ case MappingNotify:
+ XRefreshKeyboardMapping((XMappingEvent *)&event);
+ break;
+
+ default:
+ ErrorF("winClipboardFlushXEvents - unexpected event type %d\n",
+ event.type);
+ break;
+ }
}
- return WIN_XEVENTS_SUCCESS;
+ return WIN_XEVENTS_SUCCESS;
}
diff --git a/xorg-server/hw/xwin/wincmap.c b/xorg-server/hw/xwin/wincmap.c
index 83279fd84..283372a9f 100644
--- a/xorg-server/hw/xwin/wincmap.c
+++ b/xorg-server/hw/xwin/wincmap.c
@@ -1,619 +1,550 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Dakshinamurthy Karra
- * Suhaib M Siddiqi
- * Peter Busch
- * Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-
-/*
- * Local prototypes
- */
-
-static int
-winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps);
-
-static void
-winStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs);
-
-static void
-winInstallColormap (ColormapPtr pmap);
-
-static void
-winUninstallColormap (ColormapPtr pmap);
-
-static void
-winResolveColor (unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual);
-
-static Bool
-winCreateColormap (ColormapPtr pmap);
-
-static void
-winDestroyColormap (ColormapPtr pmap);
-
-static Bool
-winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap);
-
-static Bool
-winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap);
-
-
-/*
- * Set screen functions for colormaps
- */
-
-void
-winSetColormapFunctions (ScreenPtr pScreen)
-{
- pScreen->CreateColormap = winCreateColormap;
- pScreen->DestroyColormap = winDestroyColormap;
- pScreen->InstallColormap = winInstallColormap;
- pScreen->UninstallColormap = winUninstallColormap;
- pScreen->ListInstalledColormaps = winListInstalledColormaps;
- pScreen->StoreColors = winStoreColors;
- pScreen->ResolveColor = winResolveColor;
-}
-
-
-/* See Porting Layer Definition - p. 30 */
-/*
- * Walk the list of installed colormaps, filling the pmaps list
- * with the resource ids of the installed maps, and return
- * a count of the total number of installed maps.
- */
-static int
-winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps)
-{
- winScreenPriv(pScreen);
-
- /*
- * There will only be one installed colormap, so we only need
- * to return one id, and the count of installed maps will always
- * be one.
- */
- *pmaps = pScreenPriv->pcmapInstalled->mid;
- return 1;
-}
-
-
-/* See Porting Layer Definition - p. 30 */
-/* See Programming Windows - p. 663 */
-static void
-winInstallColormap (ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- ColormapPtr oldpmap = pScreenPriv->pcmapInstalled;
-
- winDebug ("winInstallColormap\n");
-
- /* Did the colormap actually change? */
- if (pColormap != oldpmap)
- {
- winDebug ("winInstallColormap - Colormap has changed, attempt "
- "to install.\n");
-
- /* Was there a previous colormap? */
- if (oldpmap != (ColormapPtr) None)
- {
- /* There was a previous colormap; tell clients it is gone */
- WalkTree (pColormap->pScreen, TellLostMap, (char *)&oldpmap->mid);
- }
-
- /* Install new colormap */
- pScreenPriv->pcmapInstalled = pColormap;
- WalkTree (pColormap->pScreen, TellGainedMap, (char *)&pColormap->mid);
-
- /* Call the engine specific colormap install procedure */
- if (!((*pScreenPriv->pwinInstallColormap) (pColormap)))
- {
- ErrorF ("winInstallColormap - Screen specific colormap install "
- "procedure failed. Continuing, but colors may be "
- "messed up from now on.\n");
- }
- }
-
- /* Save a pointer to the newly installed colormap */
- pScreenPriv->pcmapInstalled = pColormap;
-}
-
-
-/* See Porting Layer Definition - p. 30 */
-static void
-winUninstallColormap (ColormapPtr pmap)
-{
- winScreenPriv(pmap->pScreen);
- ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
-
- winDebug ("winUninstallColormap\n");
-
- /* Is the colormap currently installed? */
- if (pmap != curpmap)
- {
- /* Colormap not installed, nothing to do */
- return;
- }
-
- /* Clear the installed colormap flag */
- pScreenPriv->pcmapInstalled = NULL;
-
- /*
- * NOTE: The default colormap does not get "uninstalled" before
- * it is destroyed.
- */
-
- /* Install the default cmap in place of the cmap to be uninstalled */
- if (pmap->mid != pmap->pScreen->defColormap)
- {
- dixLookupResourceByType((pointer) &curpmap, pmap->pScreen->defColormap,
- RT_COLORMAP, NullClient, DixUnknownAccess);
- (*pmap->pScreen->InstallColormap) (curpmap);
- }
-}
-
-
-/* See Porting Layer Definition - p. 30 */
-static void
-winStoreColors (ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs)
-{
- ScreenPtr pScreen = pmap->pScreen;
- winScreenPriv(pScreen);
- winCmapPriv(pmap);
- int i;
- unsigned short nRed, nGreen, nBlue;
-
-#ifdef WINDBG
- if (ndef != 1)
- winDebug ("winStoreColors - ndef: %d\n",
- ndef);
-#endif
-
- /* Save the new colors in the colormap privates */
- for (i = 0; i < ndef; ++i)
- {
- /* Adjust the colors from the X color spec to the Windows color spec */
- nRed = pdefs[i].red >> 8;
- nGreen = pdefs[i].green >> 8;
- nBlue = pdefs[i].blue >> 8;
-
- /* Copy the colors to a palette entry table */
- pCmapPriv->peColors[pdefs[0].pixel + i].peRed = nRed;
- pCmapPriv->peColors[pdefs[0].pixel + i].peGreen = nGreen;
- pCmapPriv->peColors[pdefs[0].pixel + i].peBlue = nBlue;
-
- /* Copy the colors to a RGBQUAD table */
- pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbRed = nRed;
- pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbGreen = nGreen;
- pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbBlue = nBlue;
-
- winDebug ("winStoreColors - nRed %d nGreen %d nBlue %d\n",
- nRed, nGreen, nBlue);
- }
-
- /* Call the engine specific store colors procedure */
- if (!((pScreenPriv->pwinStoreColors) (pmap, ndef, pdefs)))
- {
- ErrorF ("winStoreColors - Engine cpecific color storage procedure "
- "failed. Continuing, but colors may be messed up from now "
- "on.\n");
- }
-}
-
-
-/* See Porting Layer Definition - p. 30 */
-static void
-winResolveColor (unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual)
-{
- winDebug ("winResolveColor ()\n");
-
- miResolveColor (pred, pgreen, pblue, pVisual);
-}
-
-
-/* See Porting Layer Definition - p. 29 */
-static Bool
-winCreateColormap (ColormapPtr pmap)
-{
- winPrivCmapPtr pCmapPriv = NULL;
- ScreenPtr pScreen = pmap->pScreen;
- winScreenPriv(pScreen);
-
- winDebug ("winCreateColormap\n");
-
- /* Allocate colormap privates */
- if (!winAllocateCmapPrivates (pmap))
- {
- ErrorF ("winCreateColorma - Couldn't allocate cmap privates\n");
- return FALSE;
- }
-
- /* Get a pointer to the newly allocated privates */
- pCmapPriv = winGetCmapPriv (pmap);
-
- /*
- * FIXME: This is some evil hackery to help in handling some X clients
- * that expect the top pixel to be white. This "help" only lasts until
- * some client overwrites the top colormap entry.
- *
- * We don't want to actually allocate the top entry, as that causes
- * problems with X clients that need 7 planes (128 colors) in the default
- * colormap, such as Magic 7.1.
- */
- pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbRed = 255;
- pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbGreen = 255;
- pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbBlue = 255;
- pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peRed = 255;
- pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peGreen = 255;
- pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peBlue = 255;
-
- /* Call the engine specific colormap initialization procedure */
- if (!((*pScreenPriv->pwinCreateColormap) (pmap)))
- {
- ErrorF ("winCreateColormap - Engine specific colormap creation "
- "procedure failed. Aborting.\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/* See Porting Layer Definition - p. 29, 30 */
-static void
-winDestroyColormap (ColormapPtr pColormap)
-{
- winScreenPriv(pColormap->pScreen);
- winCmapPriv(pColormap);
-
- /* Call the engine specific colormap destruction procedure */
- if (!((*pScreenPriv->pwinDestroyColormap) (pColormap)))
- {
- ErrorF ("winDestroyColormap - Engine specific colormap destruction "
- "procedure failed. Continuing, but it is possible that memory "
- "was leaked, or that colors will be messed up from now on.\n");
- }
-
- /* Free the colormap privates */
- free (pCmapPriv);
- winSetCmapPriv (pColormap, NULL);
-
- winDebug ("winDestroyColormap - Returning\n");
-}
-
-
-/*
- * Internal function to load the palette used by the Shadow DIB
- */
-
-static Bool
-winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap)
-{
- winScreenPriv(pScreen);
- int i;
- Pixel pixel; /* Pixel == CARD32 */
- CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */
- UINT uiColorsRetrieved = 0;
- RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
-
- /* Get the color table for the screen */
- uiColorsRetrieved = GetDIBColorTable (pScreenPriv->hdcScreen,
- 0,
- WIN_NUM_PALETTE_ENTRIES,
- rgbColors);
- if (uiColorsRetrieved == 0)
- {
- ErrorF ("winGetPaletteDIB - Could not retrieve screen color table\n");
- return FALSE;
- }
-
- winDebug ("winGetPaletteDIB - Retrieved %d colors from DIB\n",
- uiColorsRetrieved);
-
- /* Set the DIB color table to the default screen palette */
- if (SetDIBColorTable (pScreenPriv->hdcShadow,
- 0,
- uiColorsRetrieved,
- rgbColors) == 0)
- {
- ErrorF ("winGetPaletteDIB - SetDIBColorTable () failed\n");
- return FALSE;
- }
-
- /* Alloc each color in the DIB color table */
- for (i = 0; i < uiColorsRetrieved; ++i)
- {
- pixel = i;
-
- /* Extract the color values for current palette entry */
- nRed = rgbColors[i].rgbRed << 8;
- nGreen = rgbColors[i].rgbGreen << 8;
- nBlue = rgbColors[i].rgbBlue << 8;
-
- winDebug ("winGetPaletteDIB - Allocating a color: %d; "
- "%d %d %d\n",
- pixel, nRed, nGreen, nBlue);
-
- /* Allocate a entry in the X colormap */
- if (AllocColor (pcmap,
- &nRed,
- &nGreen,
- &nBlue,
- &pixel,
- 0) != Success)
- {
- ErrorF ("winGetPaletteDIB - AllocColor () failed, pixel %d\n",
- i);
- return FALSE;
- }
-
- if (i != pixel
- || nRed != rgbColors[i].rgbRed
- || nGreen != rgbColors[i].rgbGreen
- || nBlue != rgbColors[i].rgbBlue)
- {
- winDebug ("winGetPaletteDIB - Got: %d; "
- "%d %d %d\n",
- (int) pixel, nRed, nGreen, nBlue);
- }
-
- /* FIXME: Not sure that this bit is needed at all */
- pcmap->red[i].co.local.red = nRed;
- pcmap->red[i].co.local.green = nGreen;
- pcmap->red[i].co.local.blue = nBlue;
- }
-
- /* System is using a colormap */
- /* Set the black and white pixel indices */
- pScreen->whitePixel = uiColorsRetrieved - 1;
- pScreen->blackPixel = 0;
-
- return TRUE;
-}
-
-
-/*
- * Internal function to load the standard system palette being used by DD
- */
-
-static Bool
-winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap)
-{
- int i;
- Pixel pixel; /* Pixel == CARD32 */
- CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */
- UINT uiSystemPaletteEntries;
- LPPALETTEENTRY ppeColors = NULL;
- HDC hdc = NULL;
-
- /* Get a DC to obtain the default palette */
- hdc = GetDC (NULL);
- if (hdc == NULL)
- {
- ErrorF ("winGetPaletteDD - Couldn't get a DC\n");
- return FALSE;
- }
-
- /* Get the number of entries in the system palette */
- uiSystemPaletteEntries = GetSystemPaletteEntries (hdc,
- 0, 0, NULL);
- if (uiSystemPaletteEntries == 0)
- {
- ErrorF ("winGetPaletteDD - Unable to determine number of "
- "system palette entries\n");
- return FALSE;
- }
-
- winDebug ("winGetPaletteDD - uiSystemPaletteEntries %d\n",
- uiSystemPaletteEntries);
-
- /* Allocate palette entries structure */
- ppeColors = malloc (uiSystemPaletteEntries * sizeof (PALETTEENTRY));
- if (ppeColors == NULL)
- {
- ErrorF ("winGetPaletteDD - malloc () for colormap failed\n");
- return FALSE;
- }
-
- /* Get system palette entries */
- GetSystemPaletteEntries (hdc,
- 0, uiSystemPaletteEntries, ppeColors);
-
- /* Allocate an X colormap entry for every system palette entry */
- for (i = 0; i < uiSystemPaletteEntries; ++i)
- {
- pixel = i;
-
- /* Extract the color values for current palette entry */
- nRed = ppeColors[i].peRed << 8;
- nGreen = ppeColors[i].peGreen << 8;
- nBlue = ppeColors[i].peBlue << 8;
- winDebug ("winGetPaletteDD - Allocating a color: %d; "
- "%d %d %d\n",
- pixel, nRed, nGreen, nBlue);
- if (AllocColor (pcmap,
- &nRed,
- &nGreen,
- &nBlue,
- &pixel,
- 0) != Success)
- {
- ErrorF ("winGetPaletteDD - AllocColor () failed, pixel %d\n",
- i);
- free (ppeColors);
- ppeColors = NULL;
- return FALSE;
- }
-
- pcmap->red[i].co.local.red = nRed;
- pcmap->red[i].co.local.green = nGreen;
- pcmap->red[i].co.local.blue = nBlue;
- }
-
- /* System is using a colormap */
- /* Set the black and white pixel indices */
- pScreen->whitePixel = uiSystemPaletteEntries - 1;
- pScreen->blackPixel = 0;
-
- /* Free colormap */
- free(ppeColors);
- ppeColors = NULL;
-
- /* Free the DC */
- if (hdc != NULL)
- {
- ReleaseDC (NULL, hdc);
- hdc = NULL;
- }
-
- return TRUE;
-}
-
-
-/*
- * Install the standard fb colormap, or the GDI colormap,
- * depending on the current screen depth.
- */
-
-Bool
-winCreateDefColormap (ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- unsigned short zero = 0, ones = 0xFFFF;
- VisualPtr pVisual = pScreenPriv->pRootVisual;
- ColormapPtr pcmap = NULL;
- Pixel wp, bp;
-
- winDebug ("winCreateDefColormap\n");
-
- /* Use standard fb colormaps for non palettized color modes */
- if (pScreenInfo->dwBPP > 8)
- {
- winDebug ("winCreateDefColormap - Deferring to " \
- "fbCreateDefColormap ()\n");
- return fbCreateDefColormap (pScreen);
- }
-
- /*
- * AllocAll for non-Dynamic visual classes,
- * AllocNone for Dynamic visual classes.
- */
-
- /*
- * Dynamic visual classes allow the colors of the color map
- * to be changed by clients.
- */
-
- winDebug ("winCreateDefColormap - defColormap: %d\n",
- pScreen->defColormap);
-
- /* Allocate an X colormap, owned by client 0 */
- if (CreateColormap (pScreen->defColormap,
- pScreen,
- pVisual,
- &pcmap,
- (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
- 0) != Success)
- {
- ErrorF ("winCreateDefColormap - CreateColormap failed\n");
- return FALSE;
- }
- if (pcmap == NULL)
- {
- ErrorF ("winCreateDefColormap - Colormap could not be created\n");
- return FALSE;
- }
-
- winDebug ("winCreateDefColormap - Created a colormap\n");
-
- /* Branch on the visual class */
- if (!(pVisual->class & DynamicClass))
- {
- /* Branch on engine type */
- if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI)
- {
- /* Load the colors being used by the Shadow DIB */
- if (!winGetPaletteDIB (pScreen, pcmap))
- {
- ErrorF ("winCreateDefColormap - Couldn't get DIB colors\n");
- return FALSE;
- }
- }
- else
- {
- /* Load the colors from the default system palette */
- if (!winGetPaletteDD (pScreen, pcmap))
- {
- ErrorF ("winCreateDefColormap - Couldn't get colors "
- "for DD\n");
- return FALSE;
- }
- }
- }
- else
- {
- wp = pScreen->whitePixel;
- bp = pScreen->blackPixel;
-
- /* Allocate a black and white pixel */
- if ((AllocColor (pcmap, &ones, &ones, &ones, &wp, 0) !=
- Success)
- ||
- (AllocColor (pcmap, &zero, &zero, &zero, &bp, 0) !=
- Success))
- {
- ErrorF ("winCreateDefColormap - Couldn't allocate bp or wp\n");
- return FALSE;
- }
-
- pScreen->whitePixel = wp;
- pScreen->blackPixel = bp;
-
- }
-
- /* Install the created colormap */
- (*pScreen->InstallColormap)(pcmap);
-
- winDebug ("winCreateDefColormap - Returning\n");
-
- return TRUE;
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+/*
+ * Local prototypes
+ */
+
+static int
+ winListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps);
+
+static void
+ winStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs);
+
+static void
+ winInstallColormap(ColormapPtr pmap);
+
+static void
+ winUninstallColormap(ColormapPtr pmap);
+
+static void
+
+winResolveColor(unsigned short *pred,
+ unsigned short *pgreen,
+ unsigned short *pblue, VisualPtr pVisual);
+
+static Bool
+ winCreateColormap(ColormapPtr pmap);
+
+static void
+ winDestroyColormap(ColormapPtr pmap);
+
+static Bool
+ winGetPaletteDIB(ScreenPtr pScreen, ColormapPtr pcmap);
+
+static Bool
+ winGetPaletteDD(ScreenPtr pScreen, ColormapPtr pcmap);
+
+/*
+ * Set screen functions for colormaps
+ */
+
+void
+winSetColormapFunctions(ScreenPtr pScreen)
+{
+ pScreen->CreateColormap = winCreateColormap;
+ pScreen->DestroyColormap = winDestroyColormap;
+ pScreen->InstallColormap = winInstallColormap;
+ pScreen->UninstallColormap = winUninstallColormap;
+ pScreen->ListInstalledColormaps = winListInstalledColormaps;
+ pScreen->StoreColors = winStoreColors;
+ pScreen->ResolveColor = winResolveColor;
+}
+
+/* See Porting Layer Definition - p. 30 */
+/*
+ * Walk the list of installed colormaps, filling the pmaps list
+ * with the resource ids of the installed maps, and return
+ * a count of the total number of installed maps.
+ */
+static int
+winListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps)
+{
+ winScreenPriv(pScreen);
+
+ /*
+ * There will only be one installed colormap, so we only need
+ * to return one id, and the count of installed maps will always
+ * be one.
+ */
+ *pmaps = pScreenPriv->pcmapInstalled->mid;
+ return 1;
+}
+
+/* See Porting Layer Definition - p. 30 */
+/* See Programming Windows - p. 663 */
+static void
+winInstallColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ ColormapPtr oldpmap = pScreenPriv->pcmapInstalled;
+
+ winDebug("winInstallColormap\n");
+
+ /* Did the colormap actually change? */
+ if (pColormap != oldpmap) {
+ winDebug("winInstallColormap - Colormap has changed, attempt "
+ "to install.\n");
+
+ /* Was there a previous colormap? */
+ if (oldpmap != (ColormapPtr) None) {
+ /* There was a previous colormap; tell clients it is gone */
+ WalkTree(pColormap->pScreen, TellLostMap, (char *) &oldpmap->mid);
+ }
+
+ /* Install new colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
+ WalkTree(pColormap->pScreen, TellGainedMap, (char *) &pColormap->mid);
+
+ /* Call the engine specific colormap install procedure */
+ if (!((*pScreenPriv->pwinInstallColormap) (pColormap))) {
+ ErrorF ("winInstallColormap - Screen specific colormap install "
+ "procedure failed. Continuing, but colors may be "
+ "messed up from now on.\n");
+ }
+ }
+
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
+}
+
+/* See Porting Layer Definition - p. 30 */
+static void
+winUninstallColormap(ColormapPtr pmap)
+{
+ winScreenPriv(pmap->pScreen);
+ ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
+
+ winDebug("winUninstallColormap\n");
+
+ /* Is the colormap currently installed? */
+ if (pmap != curpmap) {
+ /* Colormap not installed, nothing to do */
+ return;
+ }
+
+ /* Clear the installed colormap flag */
+ pScreenPriv->pcmapInstalled = NULL;
+
+ /*
+ * NOTE: The default colormap does not get "uninstalled" before
+ * it is destroyed.
+ */
+
+ /* Install the default cmap in place of the cmap to be uninstalled */
+ if (pmap->mid != pmap->pScreen->defColormap) {
+ dixLookupResourceByType((pointer) &curpmap, pmap->pScreen->defColormap,
+ RT_COLORMAP, NullClient, DixUnknownAccess);
+ (*pmap->pScreen->InstallColormap) (curpmap);
+ }
+}
+
+/* See Porting Layer Definition - p. 30 */
+static void
+winStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+
+ winScreenPriv(pScreen);
+ winCmapPriv(pmap);
+ int i;
+ unsigned short nRed, nGreen, nBlue;
+
+#ifdef WINDBG
+ if (ndef != 1)
+ winDebug("winStoreColors - ndef: %d\n", ndef);
+#endif
+
+ /* Save the new colors in the colormap privates */
+ for (i = 0; i < ndef; ++i) {
+ /* Adjust the colors from the X color spec to the Windows color spec */
+ nRed = pdefs[i].red >> 8;
+ nGreen = pdefs[i].green >> 8;
+ nBlue = pdefs[i].blue >> 8;
+
+ /* Copy the colors to a palette entry table */
+ pCmapPriv->peColors[pdefs[0].pixel + i].peRed = nRed;
+ pCmapPriv->peColors[pdefs[0].pixel + i].peGreen = nGreen;
+ pCmapPriv->peColors[pdefs[0].pixel + i].peBlue = nBlue;
+
+ /* Copy the colors to a RGBQUAD table */
+ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbRed = nRed;
+ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbGreen = nGreen;
+ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbBlue = nBlue;
+
+ winDebug("winStoreColors - nRed %d nGreen %d nBlue %d\n",
+ nRed, nGreen, nBlue);
+ }
+
+ /* Call the engine specific store colors procedure */
+ if (!((pScreenPriv->pwinStoreColors) (pmap, ndef, pdefs))) {
+ ErrorF ("winStoreColors - Engine cpecific color storage procedure "
+ "failed. Continuing, but colors may be messed up from now "
+ "on.\n");
+ }
+}
+
+/* See Porting Layer Definition - p. 30 */
+static void
+winResolveColor(unsigned short *pred,
+ unsigned short *pgreen,
+ unsigned short *pblue, VisualPtr pVisual)
+{
+ winDebug("winResolveColor ()\n");
+
+ miResolveColor(pred, pgreen, pblue, pVisual);
+}
+
+/* See Porting Layer Definition - p. 29 */
+static Bool
+winCreateColormap(ColormapPtr pmap)
+{
+ winPrivCmapPtr pCmapPriv = NULL;
+ ScreenPtr pScreen = pmap->pScreen;
+
+ winScreenPriv(pScreen);
+
+ winDebug("winCreateColormap\n");
+
+ /* Allocate colormap privates */
+ if (!winAllocateCmapPrivates(pmap)) {
+ ErrorF("winCreateColorma - Couldn't allocate cmap privates\n");
+ return FALSE;
+ }
+
+ /* Get a pointer to the newly allocated privates */
+ pCmapPriv = winGetCmapPriv(pmap);
+
+ /*
+ * FIXME: This is some evil hackery to help in handling some X clients
+ * that expect the top pixel to be white. This "help" only lasts until
+ * some client overwrites the top colormap entry.
+ *
+ * We don't want to actually allocate the top entry, as that causes
+ * problems with X clients that need 7 planes (128 colors) in the default
+ * colormap, such as Magic 7.1.
+ */
+ pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbRed = 255;
+ pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbGreen = 255;
+ pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbBlue = 255;
+ pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peRed = 255;
+ pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peGreen = 255;
+ pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peBlue = 255;
+
+ /* Call the engine specific colormap initialization procedure */
+ if (!((*pScreenPriv->pwinCreateColormap) (pmap))) {
+ ErrorF("winCreateColormap - Engine specific colormap creation "
+ "procedure failed. Aborting.\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* See Porting Layer Definition - p. 29, 30 */
+static void
+winDestroyColormap(ColormapPtr pColormap)
+{
+ winScreenPriv(pColormap->pScreen);
+ winCmapPriv(pColormap);
+
+ /* Call the engine specific colormap destruction procedure */
+ if (!((*pScreenPriv->pwinDestroyColormap) (pColormap))) {
+ ErrorF ("winDestroyColormap - Engine specific colormap destruction "
+ "procedure failed. Continuing, but it is possible that memory "
+ "was leaked, or that colors will be messed up from now on.\n");
+ }
+
+ /* Free the colormap privates */
+ free(pCmapPriv);
+ winSetCmapPriv(pColormap, NULL);
+
+ winDebug("winDestroyColormap - Returning\n");
+}
+
+/*
+ * Internal function to load the palette used by the Shadow DIB
+ */
+
+static Bool
+winGetPaletteDIB(ScreenPtr pScreen, ColormapPtr pcmap)
+{
+ winScreenPriv(pScreen);
+ int i;
+ Pixel pixel; /* Pixel == CARD32 */
+ CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */
+ UINT uiColorsRetrieved = 0;
+ RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
+
+ /* Get the color table for the screen */
+ uiColorsRetrieved = GetDIBColorTable(pScreenPriv->hdcScreen,
+ 0, WIN_NUM_PALETTE_ENTRIES, rgbColors);
+ if (uiColorsRetrieved == 0) {
+ ErrorF("winGetPaletteDIB - Could not retrieve screen color table\n");
+ return FALSE;
+ }
+
+ winDebug("winGetPaletteDIB - Retrieved %d colors from DIB\n",
+ uiColorsRetrieved);
+
+ /* Set the DIB color table to the default screen palette */
+ if (SetDIBColorTable(pScreenPriv->hdcShadow,
+ 0, uiColorsRetrieved, rgbColors) == 0) {
+ ErrorF("winGetPaletteDIB - SetDIBColorTable () failed\n");
+ return FALSE;
+ }
+
+ /* Alloc each color in the DIB color table */
+ for (i = 0; i < uiColorsRetrieved; ++i) {
+ pixel = i;
+
+ /* Extract the color values for current palette entry */
+ nRed = rgbColors[i].rgbRed << 8;
+ nGreen = rgbColors[i].rgbGreen << 8;
+ nBlue = rgbColors[i].rgbBlue << 8;
+
+ winDebug("winGetPaletteDIB - Allocating a color: %d; "
+ "%d %d %d\n", pixel, nRed, nGreen, nBlue);
+
+ /* Allocate a entry in the X colormap */
+ if (AllocColor(pcmap, &nRed, &nGreen, &nBlue, &pixel, 0) != Success) {
+ ErrorF("winGetPaletteDIB - AllocColor () failed, pixel %d\n", i);
+ return FALSE;
+ }
+
+ if (i != pixel
+ || nRed != rgbColors[i].rgbRed
+ || nGreen != rgbColors[i].rgbGreen
+ || nBlue != rgbColors[i].rgbBlue) {
+ winDebug("winGetPaletteDIB - Got: %d; "
+ "%d %d %d\n", (int) pixel, nRed, nGreen, nBlue);
+ }
+
+ /* FIXME: Not sure that this bit is needed at all */
+ pcmap->red[i].co.local.red = nRed;
+ pcmap->red[i].co.local.green = nGreen;
+ pcmap->red[i].co.local.blue = nBlue;
+ }
+
+ /* System is using a colormap */
+ /* Set the black and white pixel indices */
+ pScreen->whitePixel = uiColorsRetrieved - 1;
+ pScreen->blackPixel = 0;
+
+ return TRUE;
+}
+
+/*
+ * Internal function to load the standard system palette being used by DD
+ */
+
+static Bool
+winGetPaletteDD(ScreenPtr pScreen, ColormapPtr pcmap)
+{
+ int i;
+ Pixel pixel; /* Pixel == CARD32 */
+ CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */
+ UINT uiSystemPaletteEntries;
+ LPPALETTEENTRY ppeColors = NULL;
+ HDC hdc = NULL;
+
+ /* Get a DC to obtain the default palette */
+ hdc = GetDC(NULL);
+ if (hdc == NULL) {
+ ErrorF("winGetPaletteDD - Couldn't get a DC\n");
+ return FALSE;
+ }
+
+ /* Get the number of entries in the system palette */
+ uiSystemPaletteEntries = GetSystemPaletteEntries(hdc, 0, 0, NULL);
+ if (uiSystemPaletteEntries == 0) {
+ ErrorF("winGetPaletteDD - Unable to determine number of "
+ "system palette entries\n");
+ return FALSE;
+ }
+
+ winDebug("winGetPaletteDD - uiSystemPaletteEntries %d\n",
+ uiSystemPaletteEntries);
+
+ /* Allocate palette entries structure */
+ ppeColors = malloc(uiSystemPaletteEntries * sizeof(PALETTEENTRY));
+ if (ppeColors == NULL) {
+ ErrorF("winGetPaletteDD - malloc () for colormap failed\n");
+ return FALSE;
+ }
+
+ /* Get system palette entries */
+ GetSystemPaletteEntries(hdc, 0, uiSystemPaletteEntries, ppeColors);
+
+ /* Allocate an X colormap entry for every system palette entry */
+ for (i = 0; i < uiSystemPaletteEntries; ++i) {
+ pixel = i;
+
+ /* Extract the color values for current palette entry */
+ nRed = ppeColors[i].peRed << 8;
+ nGreen = ppeColors[i].peGreen << 8;
+ nBlue = ppeColors[i].peBlue << 8;
+ winDebug("winGetPaletteDD - Allocating a color: %d; "
+ "%d %d %d\n", pixel, nRed, nGreen, nBlue);
+ if (AllocColor(pcmap, &nRed, &nGreen, &nBlue, &pixel, 0) != Success) {
+ ErrorF("winGetPaletteDD - AllocColor () failed, pixel %d\n", i);
+ free(ppeColors);
+ ppeColors = NULL;
+ return FALSE;
+ }
+
+ pcmap->red[i].co.local.red = nRed;
+ pcmap->red[i].co.local.green = nGreen;
+ pcmap->red[i].co.local.blue = nBlue;
+ }
+
+ /* System is using a colormap */
+ /* Set the black and white pixel indices */
+ pScreen->whitePixel = uiSystemPaletteEntries - 1;
+ pScreen->blackPixel = 0;
+
+ /* Free colormap */
+ free(ppeColors);
+ ppeColors = NULL;
+
+ /* Free the DC */
+ if (hdc != NULL) {
+ ReleaseDC(NULL, hdc);
+ hdc = NULL;
+ }
+
+ return TRUE;
+}
+
+/*
+ * Install the standard fb colormap, or the GDI colormap,
+ * depending on the current screen depth.
+ */
+
+Bool
+winCreateDefColormap(ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ unsigned short zero = 0, ones = 0xFFFF;
+ VisualPtr pVisual = pScreenPriv->pRootVisual;
+ ColormapPtr pcmap = NULL;
+ Pixel wp, bp;
+
+ winDebug("winCreateDefColormap\n");
+
+ /* Use standard fb colormaps for non palettized color modes */
+ if (pScreenInfo->dwBPP > 8) {
+ winDebug("winCreateDefColormap - Deferring to "
+ "fbCreateDefColormap ()\n");
+ return fbCreateDefColormap(pScreen);
+ }
+
+ /*
+ * AllocAll for non-Dynamic visual classes,
+ * AllocNone for Dynamic visual classes.
+ */
+
+ /*
+ * Dynamic visual classes allow the colors of the color map
+ * to be changed by clients.
+ */
+
+ winDebug("winCreateDefColormap - defColormap: %d\n", pScreen->defColormap);
+
+ /* Allocate an X colormap, owned by client 0 */
+ if (CreateColormap(pScreen->defColormap,
+ pScreen,
+ pVisual,
+ &pcmap,
+ (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
+ 0) != Success) {
+ ErrorF("winCreateDefColormap - CreateColormap failed\n");
+ return FALSE;
+ }
+ if (pcmap == NULL) {
+ ErrorF("winCreateDefColormap - Colormap could not be created\n");
+ return FALSE;
+ }
+
+ winDebug("winCreateDefColormap - Created a colormap\n");
+
+ /* Branch on the visual class */
+ if (!(pVisual->class & DynamicClass)) {
+ /* Branch on engine type */
+ if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI) {
+ /* Load the colors being used by the Shadow DIB */
+ if (!winGetPaletteDIB(pScreen, pcmap)) {
+ ErrorF("winCreateDefColormap - Couldn't get DIB colors\n");
+ return FALSE;
+ }
+ }
+ else {
+ /* Load the colors from the default system palette */
+ if (!winGetPaletteDD(pScreen, pcmap)) {
+ ErrorF("winCreateDefColormap - Couldn't get colors "
+ "for DD\n");
+ return FALSE;
+ }
+ }
+ }
+ else {
+ wp = pScreen->whitePixel;
+ bp = pScreen->blackPixel;
+
+ /* Allocate a black and white pixel */
+ if ((AllocColor(pcmap, &ones, &ones, &ones, &wp, 0) != Success)
+ || (AllocColor(pcmap, &zero, &zero, &zero, &bp, 0) != Success)) {
+ ErrorF("winCreateDefColormap - Couldn't allocate bp or wp\n");
+ return FALSE;
+ }
+
+ pScreen->whitePixel = wp;
+ pScreen->blackPixel = bp;
+
+ }
+
+ /* Install the created colormap */
+ (*pScreen->InstallColormap) (pcmap);
+
+ winDebug("winCreateDefColormap - Returning\n");
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winconfig.c b/xorg-server/hw/xwin/winconfig.c
index 4441550b0..57825af72 100644
--- a/xorg-server/hw/xwin/winconfig.c
+++ b/xorg-server/hw/xwin/winconfig.c
@@ -63,42 +63,42 @@ XF86ConfigPtr g_xf86configptr = NULL;
WinCmdlineRec g_cmdline = {
#ifdef XWIN_XF86CONFIG
- NULL, /* configFile */
- NULL, /* configDir */
+ NULL, /* configFile */
+ NULL, /* configDir */
#endif
- NULL, /* fontPath */
+ NULL, /* fontPath */
#ifdef XWIN_XF86CONFIG
- NULL, /* keyboard */
+ NULL, /* keyboard */
#endif
- NULL, /* xkbRules */
- NULL, /* xkbModel */
- NULL, /* xkbLayout */
- NULL, /* xkbVariant */
- NULL, /* xkbOptions */
- NULL, /* screenname */
- NULL, /* mousename */
- FALSE, /* emulate3Buttons */
- 0 /* emulate3Timeout */
+ NULL, /* xkbRules */
+ NULL, /* xkbModel */
+ NULL, /* xkbLayout */
+ NULL, /* xkbVariant */
+ NULL, /* xkbOptions */
+ NULL, /* screenname */
+ NULL, /* mousename */
+ FALSE, /* emulate3Buttons */
+ 0 /* emulate3Timeout */
};
winInfoRec g_winInfo = {
- { /* keyboard */
- 0, /* leds */
- 500, /* delay */
- 30 /* rate */
- }
- ,
- { /* xkb */
- NULL, /* rules */
- NULL, /* model */
- NULL, /* layout */
- NULL, /* variant */
- NULL, /* options */
- }
- ,
- {
- FALSE,
- 50}
+ { /* keyboard */
+ 0, /* leds */
+ 500, /* delay */
+ 30 /* rate */
+ }
+ ,
+ { /* xkb */
+ NULL, /* rules */
+ NULL, /* model */
+ NULL, /* layout */
+ NULL, /* variant */
+ NULL, /* options */
+ }
+ ,
+ {
+ FALSE,
+ 50}
};
#define NULL_IF_EMPTY(x) (winNameCompare(x,"")?x:NULL)
@@ -106,130 +106,111 @@ winInfoRec g_winInfo = {
#ifdef XWIN_XF86CONFIG
serverLayoutRec g_winConfigLayout;
-static Bool ParseOptionValue (int scrnIndex, pointer options,
- OptionInfoPtr p);
-static Bool configLayout (serverLayoutPtr, XF86ConfLayoutPtr, char *);
-static Bool configImpliedLayout (serverLayoutPtr, XF86ConfScreenPtr);
-static Bool GetBoolValue (OptionInfoPtr p, const char *s);
-
+static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p);
+static Bool configLayout(serverLayoutPtr, XF86ConfLayoutPtr, char *);
+static Bool configImpliedLayout(serverLayoutPtr, XF86ConfScreenPtr);
+static Bool GetBoolValue(OptionInfoPtr p, const char *s);
Bool
-winReadConfigfile ()
+winReadConfigfile()
{
- Bool retval = TRUE;
- char *filename, *dirname;
- MessageType filefrom = X_DEFAULT;
- MessageType dirfrom = X_DEFAULT;
- char *xf86ConfigFile = NULL;
- char *xf86ConfigDir = NULL;
-
- if (g_cmdline.configFile)
- {
- filefrom = X_CMDLINE;
- xf86ConfigFile = g_cmdline.configFile;
+ Bool retval = TRUE;
+ char *filename, *dirname;
+ MessageType filefrom = X_DEFAULT;
+ MessageType dirfrom = X_DEFAULT;
+ char *xf86ConfigFile = NULL;
+ char *xf86ConfigDir = NULL;
+
+ if (g_cmdline.configFile) {
+ filefrom = X_CMDLINE;
+ xf86ConfigFile = g_cmdline.configFile;
}
- if (g_cmdline.configDir)
- {
- dirfrom = X_CMDLINE;
- xf86ConfigDir = g_cmdline.configDir;
+ if (g_cmdline.configDir) {
+ dirfrom = X_CMDLINE;
+ xf86ConfigDir = g_cmdline.configDir;
}
- /* Parse config file into data structure */
- xf86initConfigFiles();
- dirname = xf86openConfigDirFiles (CONFIGDIRPATH, xf86ConfigDir, PROJECTROOT);
- filename = xf86openConfigFile (CONFIGPATH, xf86ConfigFile, PROJECTROOT);
+ /* Parse config file into data structure */
+ xf86initConfigFiles();
+ dirname = xf86openConfigDirFiles(CONFIGDIRPATH, xf86ConfigDir, PROJECTROOT);
+ filename = xf86openConfigFile(CONFIGPATH, xf86ConfigFile, PROJECTROOT);
- /* Hack for backward compatibility */
- if (!filename && from == X_DEFAULT)
- filename = xf86openConfigFile (CONFIGPATH, "XF86Config", PROJECTROOT);
+ /* Hack for backward compatibility */
+ if (!filename && from == X_DEFAULT)
+ filename = xf86openConfigFile(CONFIGPATH, "XF86Config", PROJECTROOT);
- if (filename)
- {
- winDebug ("Using config file: \"%s\"\n", filename);
+ if (filename) {
+ winDebug ("Using config file: \"%s\"\n", filename);
}
- else
- {
- ErrorF ("Unable to locate/open config file");
- if (xf86ConfigFile)
- ErrorF (": \"%s\"", xf86ConfigFile);
- ErrorF ("\n");
+ else {
+ ErrorF ("Unable to locate/open config file");
+ if (xf86ConfigFile)
+ ErrorF(": \"%s\"", xf86ConfigFile);
+ ErrorF("\n");
}
- if (dirname)
- {
- winMsg (from, "Using config directory: \"%s\"\n", dirname);
+ if (dirname) {
+ winMsg(from, "Using config directory: \"%s\"\n", dirname);
}
- else
- {
- winMsg (X_ERROR, "Unable to locate/open config directory");
- if (xf86ConfigDir)
- ErrorF (": \"%s\"", xf86ConfigDir);
- ErrorF ("\n");
+ else {
+ winMsg(X_ERROR, "Unable to locate/open config directory");
+ if (xf86ConfigDir)
+ ErrorF(": \"%s\"", xf86ConfigDir);
+ ErrorF("\n");
}
- if (!filename && !dirname)
- {
- return FALSE;
+ if (!filename && !dirname) {
+ return FALSE;
}
- free(filename);
- free(dirname);
- if ((g_xf86configptr = xf86readConfigFile ()) == NULL)
- {
- ErrorF ("Problem parsing the config file\n");
- return FALSE;
+ free(filename);
+ free(dirname);
+ if ((g_xf86configptr = xf86readConfigFile()) == NULL) {
+ ErrorF ("Problem parsing the config file\n");
+ return FALSE;
}
- xf86closeConfigFile ();
+ xf86closeConfigFile();
- LogPrintMarkers();
+ LogPrintMarkers();
- /* set options from data structure */
+ /* set options from data structure */
- if (g_xf86configptr->conf_layout_lst == NULL || g_cmdline.screenname != NULL)
- {
- if (g_cmdline.screenname == NULL)
- {
- winDebug ("No Layout section. Using the first Screen section.\n");
- }
- if (!configImpliedLayout (&g_winConfigLayout,
- g_xf86configptr->conf_screen_lst))
- {
- ErrorF ("Unable to determine the screen layout\n");
- return FALSE;
- }
+ if (g_xf86configptr->conf_layout_lst == NULL ||
+ g_cmdline.screenname != NULL) {
+ if (g_cmdline.screenname == NULL) {
+ winDebug ("No Layout section. Using the first Screen section.\n");
+ }
+ if (!configImpliedLayout(&g_winConfigLayout,
+ g_xf86configptr->conf_screen_lst)) {
+ ErrorF ("Unable to determine the screen layout\n");
+ return FALSE;
+ }
}
- else
- {
- /* Check if layout is given in the config file */
- if (g_xf86configptr->conf_flags != NULL)
- {
- char *dfltlayout = NULL;
- pointer optlist = g_xf86configptr->conf_flags->flg_option_lst;
-
- if (optlist && winFindOption (optlist, "defaultserverlayout"))
- dfltlayout =
- winSetStrOption (optlist, "defaultserverlayout", NULL);
-
- if (!configLayout (&g_winConfigLayout,
- g_xf86configptr->conf_layout_lst,
- dfltlayout))
- {
- ErrorF ("Unable to determine the screen layout\n");
- return FALSE;
- }
- }
- else
- {
- if (!configLayout (&g_winConfigLayout,
- g_xf86configptr->conf_layout_lst,
- NULL))
- {
- ErrorF ("Unable to determine the screen layout\n");
- return FALSE;
- }
- }
+ else {
+ /* Check if layout is given in the config file */
+ if (g_xf86configptr->conf_flags != NULL) {
+ char *dfltlayout = NULL;
+ pointer optlist = g_xf86configptr->conf_flags->flg_option_lst;
+
+ if (optlist && winFindOption(optlist, "defaultserverlayout"))
+ dfltlayout =
+ winSetStrOption(optlist, "defaultserverlayout", NULL);
+
+ if (!configLayout(&g_winConfigLayout,
+ g_xf86configptr->conf_layout_lst, dfltlayout)) {
+ ErrorF ("Unable to determine the screen layout\n");
+ return FALSE;
+ }
+ }
+ else {
+ if (!configLayout(&g_winConfigLayout,
+ g_xf86configptr->conf_layout_lst, NULL)) {
+ ErrorF ("Unable to determine the screen layout\n");
+ return FALSE;
+ }
+ }
}
- /* setup special config files */
- winConfigFiles ();
- return retval;
+ /* setup special config files */
+ winConfigFiles();
+ return retval;
}
#endif
@@ -238,270 +219,256 @@ winReadConfigfile ()
/* Set the keyboard configuration */
Bool
-winConfigKeyboard (DeviceIntPtr pDevice)
+winConfigKeyboard(DeviceIntPtr pDevice)
{
- char layoutName[KL_NAMELENGTH];
- unsigned char layoutFriendlyName[256];
- static unsigned int layoutNum = 0;
- int keyboardType;
+ char layoutName[KL_NAMELENGTH];
+ unsigned char layoutFriendlyName[256];
+ static unsigned int layoutNum = 0;
+ int keyboardType;
+
#ifdef XWIN_XF86CONFIG
- XF86ConfInputPtr kbd = NULL;
- XF86ConfInputPtr input_list = NULL;
- MessageType kbdfrom = X_CONFIG;
+ XF86ConfInputPtr kbd = NULL;
+ XF86ConfInputPtr input_list = NULL;
+ MessageType kbdfrom = X_CONFIG;
#endif
- MessageType from = X_DEFAULT;
- char *s = NULL;
-
- /* Setup defaults */
- XkbGetRulesDflts(&g_winInfo.xkb);
-
- /*
- * Query the windows autorepeat settings and change the xserver defaults.
- */
- {
- int kbd_delay;
- DWORD kbd_speed;
- if (SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &kbd_delay, 0) &&
- SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &kbd_speed, 0))
- {
- switch (kbd_delay)
- {
- case 0: g_winInfo.keyboard.delay = 250; break;
- case 1: g_winInfo.keyboard.delay = 500; break;
- case 2: g_winInfo.keyboard.delay = 750; break;
- default:
- case 3: g_winInfo.keyboard.delay = 1000; break;
- }
- g_winInfo.keyboard.rate = (kbd_speed>0)?kbd_speed:1;
- winDebug("Setting autorepeat to delay=%d, rate=%d\n",
- g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
- }
- }
-
-
- keyboardType = GetKeyboardType (0);
- if (keyboardType > 0 && GetKeyboardLayoutName (layoutName))
- {
- WinKBLayoutPtr pLayout;
- Bool bfound = FALSE;
-
- if (! layoutNum)
- layoutNum = strtoul (layoutName, (char **)NULL, 16);
- if ((layoutNum & 0xffff) == 0x411) {
- /* The japanese layouts know a lot of different IMEs which all have
- different layout numbers set. Map them to a single entry.
- Same might apply for chinese, korean and other symbol languages
- too */
- layoutNum = (layoutNum & 0xffff);
- if (keyboardType == 7)
- {
- /* Japanese layouts have problems with key event messages
- such as the lack of WM_KEYUP for Caps Lock key.
- Loading US layout fixes this problem. */
- if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
- winDebug("Loading US keyboard layout.\n");
- else
- ErrorF ("LoadKeyboardLayout failed.\n");
- }
- }
+ MessageType from = X_DEFAULT;
+ char *s = NULL;
- /* Discover the friendly name of the current layout */
+ /* Setup defaults */
+ XkbGetRulesDflts(&g_winInfo.xkb);
+
+ /*
+ * Query the windows autorepeat settings and change the xserver defaults.
+ */
{
- HKEY regkey = NULL;
- const char regtempl[] = "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
- char *regpath;
- DWORD namesize = sizeof(layoutFriendlyName);
-
- regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1);
- strcpy(regpath, regtempl);
- strcat(regpath, layoutName);
-
- if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, &regkey))
- RegQueryValueEx(regkey, "Layout Text", 0, NULL, layoutFriendlyName, &namesize);
-
- /* Close registry key */
- if (regkey)
- RegCloseKey (regkey);
- free(regpath);
+ int kbd_delay;
+ DWORD kbd_speed;
+
+ if (SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &kbd_delay, 0) &&
+ SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &kbd_speed, 0)) {
+ switch (kbd_delay) {
+ case 0:
+ g_winInfo.keyboard.delay = 250;
+ break;
+ case 1:
+ g_winInfo.keyboard.delay = 500;
+ break;
+ case 2:
+ g_winInfo.keyboard.delay = 750;
+ break;
+ default:
+ case 3:
+ g_winInfo.keyboard.delay = 1000;
+ break;
+ }
+ g_winInfo.keyboard.rate = (kbd_speed > 0) ? kbd_speed : 1;
+ winDebug("Setting autorepeat to delay=%d, rate=%d\n",
+ g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
+ }
}
- winDebug ("Windows keyboard layout: \"%s\" (%08x) \"%s\", type %d\n",
- layoutName, layoutNum, layoutFriendlyName, keyboardType);
-
- for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++)
- {
- if (pLayout->winlayout != layoutNum)
- continue;
- if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType)
- continue;
-
- bfound = TRUE;
- winDebug (
- "Found matching XKB configuration \"%s\"\n",
- pLayout->layoutname);
-
- winDebug(
- "Model = \"%s\" Layout = \"%s\""
- " Variant = \"%s\" Options = \"%s\"\n",
- pLayout->xkbmodel ? pLayout->xkbmodel : "none",
- pLayout->xkblayout ? pLayout->xkblayout : "none",
- pLayout->xkbvariant ? pLayout->xkbvariant : "none",
- pLayout->xkboptions ? pLayout->xkboptions : "none");
-
- g_winInfo.xkb.model = pLayout->xkbmodel;
- g_winInfo.xkb.layout = pLayout->xkblayout;
- g_winInfo.xkb.variant = pLayout->xkbvariant;
- g_winInfo.xkb.options = pLayout->xkboptions;
-
-
- break;
- }
-
- if (!bfound)
- {
- ErrorF ("Keyboardlayout \"%s\" (%s) is unknown, using X server default layout\n", layoutFriendlyName, layoutName);
- }
- }
-
- /* parse the configuration */
-#ifdef XWIN_XF86CONFIG
- if (g_cmdline.keyboard)
- kbdfrom = X_CMDLINE;
+ keyboardType = GetKeyboardType(0);
+ if (keyboardType > 0 && GetKeyboardLayoutName(layoutName)) {
+ WinKBLayoutPtr pLayout;
+ Bool bfound = FALSE;
+
+ if (!layoutNum)
+ layoutNum = strtoul(layoutName, (char **) NULL, 16);
+ if ((layoutNum & 0xffff) == 0x411) {
+ /* The japanese layouts know a lot of different IMEs which all have
+ different layout numbers set. Map them to a single entry.
+ Same might apply for chinese, korean and other symbol languages
+ too */
+ layoutNum = (layoutNum & 0xffff);
+ if (keyboardType == 7) {
+ /* Japanese layouts have problems with key event messages
+ such as the lack of WM_KEYUP for Caps Lock key.
+ Loading US layout fixes this problem. */
+ if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
+ winDebug("Loading US keyboard layout.\n");
+ else
+ ErrorF ("LoadKeyboardLayout failed.\n");
+ }
+ }
- /*
- * Until the layout code is finished, I search for the keyboard
- * device and configure the server with it.
- */
+ /* Discover the friendly name of the current layout */
+ {
+ HKEY regkey = NULL;
+ const char regtempl[] =
+ "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
+ char *regpath;
+ DWORD namesize = sizeof(layoutFriendlyName);
+
+ regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1);
+ strcpy(regpath, regtempl);
+ strcat(regpath, layoutName);
+
+ if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, &regkey))
+ RegQueryValueEx(regkey, "Layout Text", 0, NULL,
+ layoutFriendlyName, &namesize);
+
+ /* Close registry key */
+ if (regkey)
+ RegCloseKey(regkey);
+ free(regpath);
+ }
- if (g_xf86configptr != NULL)
- input_list = g_xf86configptr->conf_input_lst;
+ winDebug ("Windows keyboard layout: \"%s\" (%08x) \"%s\", type %d\n",
+ layoutName, layoutNum, layoutFriendlyName, keyboardType);
+
+ for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++) {
+ if (pLayout->winlayout != layoutNum)
+ continue;
+ if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType)
+ continue;
+
+ bfound = TRUE;
+ winDebug (
+ "Found matching XKB configuration \"%s\"\n",
+ pLayout->layoutname);
+
+ winDebug(
+ "Model = \"%s\" Layout = \"%s\""
+ " Variant = \"%s\" Options = \"%s\"\n",
+ pLayout->xkbmodel ? pLayout->xkbmodel : "none",
+ pLayout->xkblayout ? pLayout->xkblayout : "none",
+ pLayout->xkbvariant ? pLayout->xkbvariant : "none",
+ pLayout->xkboptions ? pLayout->xkboptions : "none");
+
+ g_winInfo.xkb.model = pLayout->xkbmodel;
+ g_winInfo.xkb.layout = pLayout->xkblayout;
+ g_winInfo.xkb.variant = pLayout->xkbvariant;
+ g_winInfo.xkb.options = pLayout->xkboptions;
+
+ break;
+ }
- while (input_list != NULL)
- {
- if (winNameCompare (input_list->inp_driver, "keyboard") == 0)
- {
- /* Check if device name matches requested name */
- if (g_cmdline.keyboard && winNameCompare (input_list->inp_identifier,
- g_cmdline.keyboard))
- continue;
- kbd = input_list;
- }
- input_list = input_list->list.next;
+ if (!bfound) {
+ ErrorF ("Keyboardlayout \"%s\" (%s) is unknown, using X server default layout\n",
+ layoutFriendlyName, layoutName);
+ }
}
- if (kbd != NULL)
- {
-
- if (kbd->inp_identifier)
- winDebug ("Using keyboard \"%s\" as primary keyboard\n",
- kbd->inp_identifier);
+ /* parse the configuration */
+#ifdef XWIN_XF86CONFIG
+ if (g_cmdline.keyboard)
+ kbdfrom = X_CMDLINE;
+
+ /*
+ * Until the layout code is finished, I search for the keyboard
+ * device and configure the server with it.
+ */
+
+ if (g_xf86configptr != NULL)
+ input_list = g_xf86configptr->conf_input_lst;
+
+ while (input_list != NULL) {
+ if (winNameCompare(input_list->inp_driver, "keyboard") == 0) {
+ /* Check if device name matches requested name */
+ if (g_cmdline.keyboard && winNameCompare(input_list->inp_identifier,
+ g_cmdline.keyboard))
+ continue;
+ kbd = input_list;
+ }
+ input_list = input_list->list.next;
+ }
- if ((s = winSetStrOption(kbd->inp_option_lst, "AutoRepeat", NULL)))
- {
- if ((sscanf(s, "%ld %ld", &g_winInfo.keyboard.delay,
- &g_winInfo.keyboard.rate) != 2) ||
- (g_winInfo.keyboard.delay < 1) ||
- (g_winInfo.keyboard.rate == 0) ||
- (1000 / g_winInfo.keyboard.rate) < 1)
- {
- ErrorF ("\"%s\" is not a valid AutoRepeat value", s);
- free(s);
- return FALSE;
+ if (kbd != NULL) {
+
+ if (kbd->inp_identifier)
+ winDebug ("Using keyboard \"%s\" as primary keyboard\n",
+ kbd->inp_identifier);
+
+ if ((s = winSetStrOption(kbd->inp_option_lst, "AutoRepeat", NULL))) {
+ if ((sscanf(s, "%ld %ld", &g_winInfo.keyboard.delay,
+ &g_winInfo.keyboard.rate) != 2) ||
+ (g_winInfo.keyboard.delay < 1) ||
+ (g_winInfo.keyboard.rate == 0) ||
+ (1000 / g_winInfo.keyboard.rate) < 1) {
+ ErrorF ("\"%s\" is not a valid AutoRepeat value", s);
+ free(s);
+ return FALSE;
}
- free(s);
- winDebug ("AutoRepeat: %ld %ld\n",
- g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
+ free(s);
+ winDebug ("AutoRepeat: %ld %ld\n",
+ g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
}
#endif
-
+
s = NULL;
- if (g_cmdline.xkbRules)
- {
+ if (g_cmdline.xkbRules) {
s = g_cmdline.xkbRules;
from = X_CMDLINE;
- }
+ }
#ifdef XWIN_XF86CONFIG
- else
- {
- s = winSetStrOption (kbd->inp_option_lst, "XkbRules", NULL);
+ else {
+ s = winSetStrOption(kbd->inp_option_lst, "XkbRules", NULL);
from = X_CONFIG;
- }
+ }
#endif
- if (s)
- {
- g_winInfo.xkb.rules = NULL_IF_EMPTY (s);
+ if (s) {
+ g_winInfo.xkb.rules = NULL_IF_EMPTY(s);
winDebug ("XKB: rules: \"%s\"\n", s);
- }
-
+ }
+
s = NULL;
- if (g_cmdline.xkbModel)
- {
+ if (g_cmdline.xkbModel) {
s = g_cmdline.xkbModel;
from = X_CMDLINE;
- }
+ }
#ifdef XWIN_XF86CONFIG
- else
- {
- s = winSetStrOption (kbd->inp_option_lst, "XkbModel", NULL);
+ else {
+ s = winSetStrOption(kbd->inp_option_lst, "XkbModel", NULL);
from = X_CONFIG;
- }
+ }
#endif
- if (s)
- {
- g_winInfo.xkb.model = NULL_IF_EMPTY (s);
- winDebug ("XKB: model: \"%s\"\n", s);
- }
+ if (s) {
+ g_winInfo.xkb.model = NULL_IF_EMPTY(s);
+ winDebug ("XKB: model: \"%s\"\n", s);
+ }
s = NULL;
- if (g_cmdline.xkbLayout)
- {
+ if (g_cmdline.xkbLayout) {
s = g_cmdline.xkbLayout;
from = X_CMDLINE;
- }
+ }
#ifdef XWIN_XF86CONFIG
- else
- {
- s = winSetStrOption (kbd->inp_option_lst, "XkbLayout", NULL);
+ else {
+ s = winSetStrOption(kbd->inp_option_lst, "XkbLayout", NULL);
from = X_CONFIG;
- }
+ }
#endif
- if (s)
- {
- g_winInfo.xkb.layout = NULL_IF_EMPTY (s);
- winDebug ("XKB: layout: \"%s\"\n", s);
- }
+ if (s) {
+ g_winInfo.xkb.layout = NULL_IF_EMPTY(s);
+ winDebug ("XKB: layout: \"%s\"\n", s);
+ }
s = NULL;
- if (g_cmdline.xkbVariant)
- {
+ if (g_cmdline.xkbVariant) {
s = g_cmdline.xkbVariant;
from = X_CMDLINE;
- }
+ }
#ifdef XWIN_XF86CONFIG
- else
- {
- s = winSetStrOption (kbd->inp_option_lst, "XkbVariant", NULL);
+ else {
+ s = winSetStrOption(kbd->inp_option_lst, "XkbVariant", NULL);
from = X_CONFIG;
- }
+ }
#endif
- if (s)
- {
- g_winInfo.xkb.variant = NULL_IF_EMPTY (s);
- winDebug ("XKB: variant: \"%s\"\n", s);
- }
+ if (s) {
+ g_winInfo.xkb.variant = NULL_IF_EMPTY(s);
+ winDebug ("XKB: variant: \"%s\"\n", s);
+ }
s = NULL;
- if (g_cmdline.xkbOptions)
- {
+ if (g_cmdline.xkbOptions) {
s = g_cmdline.xkbOptions;
from = X_CMDLINE;
- }
+ }
#ifdef XWIN_XF86CONFIG
- else
- {
- s = winSetStrOption (kbd->inp_option_lst, "XkbOptions", NULL);
+ else {
+ s = winSetStrOption(kbd->inp_option_lst, "XkbOptions", NULL);
from = X_CONFIG;
- }
+ }
#else
else
{
@@ -509,203 +476,184 @@ winConfigKeyboard (DeviceIntPtr pDevice)
s="grab:break_actions"; /* Currently attach default CTRL+ALT+NKP/ and CTRL+ALT+NKP* mappings to release grab functions */
}
#endif
- if (s)
- {
- g_winInfo.xkb.options = NULL_IF_EMPTY (s);
- winDebug ("XKB: options: \"%s\"\n", s);
- }
+ if (s) {
+ g_winInfo.xkb.options = NULL_IF_EMPTY(s);
+ winDebug ("XKB: options: \"%s\"\n", s);
+ }
#ifdef XWIN_XF86CONFIG
}
#endif
- return TRUE;
+ return TRUE;
}
-
#ifdef XWIN_XF86CONFIG
Bool
-winConfigMouse (DeviceIntPtr pDevice)
+winConfigMouse(DeviceIntPtr pDevice)
{
- MessageType mousefrom = X_CONFIG;
+ MessageType mousefrom = X_CONFIG;
- XF86ConfInputPtr mouse = NULL;
- XF86ConfInputPtr input_list = NULL;
+ XF86ConfInputPtr mouse = NULL;
+ XF86ConfInputPtr input_list = NULL;
- if (g_cmdline.mouse)
- mousefrom = X_CMDLINE;
+ if (g_cmdline.mouse)
+ mousefrom = X_CMDLINE;
- if (g_xf86configptr != NULL)
- input_list = g_xf86configptr->conf_input_lst;
+ if (g_xf86configptr != NULL)
+ input_list = g_xf86configptr->conf_input_lst;
- while (input_list != NULL)
- {
- if (winNameCompare (input_list->inp_driver, "mouse") == 0)
- {
- /* Check if device name matches requested name */
- if (g_cmdline.mouse && winNameCompare (input_list->inp_identifier,
- g_cmdline.mouse))
- continue;
- mouse = input_list;
- }
- input_list = input_list->list.next;
+ while (input_list != NULL) {
+ if (winNameCompare(input_list->inp_driver, "mouse") == 0) {
+ /* Check if device name matches requested name */
+ if (g_cmdline.mouse && winNameCompare(input_list->inp_identifier,
+ g_cmdline.mouse))
+ continue;
+ mouse = input_list;
+ }
+ input_list = input_list->list.next;
}
- if (mouse != NULL)
- {
- if (mouse->inp_identifier)
- winDebug ("Using pointer \"%s\" as primary pointer\n",
- mouse->inp_identifier);
-
- g_winInfo.pointer.emulate3Buttons =
- winSetBoolOption (mouse->inp_option_lst, "Emulate3Buttons", FALSE);
- if (g_cmdline.emulate3buttons)
- g_winInfo.pointer.emulate3Buttons = g_cmdline.emulate3buttons;
-
- g_winInfo.pointer.emulate3Timeout =
- winSetIntOption (mouse->inp_option_lst, "Emulate3Timeout", 50);
- if (g_cmdline.emulate3timeout)
- g_winInfo.pointer.emulate3Timeout = g_cmdline.emulate3timeout;
+ if (mouse != NULL) {
+ if (mouse->inp_identifier)
+ winDebug ("Using pointer \"%s\" as primary pointer\n",
+ mouse->inp_identifier);
+
+ g_winInfo.pointer.emulate3Buttons =
+ winSetBoolOption(mouse->inp_option_lst, "Emulate3Buttons", FALSE);
+ if (g_cmdline.emulate3buttons)
+ g_winInfo.pointer.emulate3Buttons = g_cmdline.emulate3buttons;
+
+ g_winInfo.pointer.emulate3Timeout =
+ winSetIntOption(mouse->inp_option_lst, "Emulate3Timeout", 50);
+ if (g_cmdline.emulate3timeout)
+ g_winInfo.pointer.emulate3Timeout = g_cmdline.emulate3timeout;
}
- else
- {
+ else {
winDebug ("No primary pointer configured\n");
winDebug ("Using compiletime defaults for pointer\n");
}
- return TRUE;
+ return TRUE;
}
-
Bool
-winConfigFiles ()
+winConfigFiles()
{
- MessageType from;
- XF86ConfFilesPtr filesptr = NULL;
+ MessageType from;
+ XF86ConfFilesPtr filesptr = NULL;
- /* set some shortcuts */
- if (g_xf86configptr != NULL)
- {
- filesptr = g_xf86configptr->conf_files;
+ /* set some shortcuts */
+ if (g_xf86configptr != NULL) {
+ filesptr = g_xf86configptr->conf_files;
}
+ /* Fontpath */
+ from = X_DEFAULT;
- /* Fontpath */
- from = X_DEFAULT;
-
- if (g_cmdline.fontPath)
- {
- from = X_CMDLINE;
- defaultFontPath = g_cmdline.fontPath;
+ if (g_cmdline.fontPath) {
+ from = X_CMDLINE;
+ defaultFontPath = g_cmdline.fontPath;
}
- else if (filesptr != NULL && filesptr->file_fontpath)
- {
- from = X_CONFIG;
- defaultFontPath = strdup (filesptr->file_fontpath);
+ else if (filesptr != NULL && filesptr->file_fontpath) {
+ from = X_CONFIG;
+ defaultFontPath = strdup(filesptr->file_fontpath);
}
- winDebug ("FontPath set to \"%s\"\n", defaultFontPath);
+ winDebug ("FontPath set to \"%s\"\n", defaultFontPath);
- return TRUE;
+ return TRUE;
}
#else
Bool
-winConfigFiles (void)
+winConfigFiles(void)
{
- /* Fontpath */
- if (g_cmdline.fontPath)
- {
- defaultFontPath = g_cmdline.fontPath;
- winDebug("FontPath set to \"%s\"\n", defaultFontPath);
+ /* Fontpath */
+ if (g_cmdline.fontPath) {
+ defaultFontPath = g_cmdline.fontPath;
+ winDebug("FontPath set to \"%s\"\n", defaultFontPath);
}
- return TRUE;
+ return TRUE;
}
#endif
-
Bool
-winConfigOptions (void)
+winConfigOptions(void)
{
- return TRUE;
+ return TRUE;
}
-
Bool
-winConfigScreens (void)
+winConfigScreens(void)
{
- return TRUE;
+ return TRUE;
}
-
#ifdef XWIN_XF86CONFIG
char *
-winSetStrOption (pointer optlist, const char *name, char *deflt)
+winSetStrOption(pointer optlist, const char *name, char *deflt)
{
- OptionInfoRec o;
-
- o.name = name;
- o.type = OPTV_STRING;
- if (ParseOptionValue (-1, optlist, &o))
- deflt = o.value.str;
- if (deflt)
- return strdup (deflt);
- else
- return NULL;
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_STRING;
+ if (ParseOptionValue(-1, optlist, &o))
+ deflt = o.value.str;
+ if (deflt)
+ return strdup(deflt);
+ else
+ return NULL;
}
-
int
-winSetBoolOption (pointer optlist, const char *name, int deflt)
+winSetBoolOption(pointer optlist, const char *name, int deflt)
{
- OptionInfoRec o;
+ OptionInfoRec o;
- o.name = name;
- o.type = OPTV_BOOLEAN;
- if (ParseOptionValue (-1, optlist, &o))
- deflt = o.value.bool;
- return deflt;
+ o.name = name;
+ o.type = OPTV_BOOLEAN;
+ if (ParseOptionValue(-1, optlist, &o))
+ deflt = o.value.bool;
+ return deflt;
}
-
int
-winSetIntOption (pointer optlist, const char *name, int deflt)
+winSetIntOption(pointer optlist, const char *name, int deflt)
{
- OptionInfoRec o;
+ OptionInfoRec o;
- o.name = name;
- o.type = OPTV_INTEGER;
- if (ParseOptionValue (-1, optlist, &o))
- deflt = o.value.num;
- return deflt;
+ o.name = name;
+ o.type = OPTV_INTEGER;
+ if (ParseOptionValue(-1, optlist, &o))
+ deflt = o.value.num;
+ return deflt;
}
-
double
-winSetRealOption (pointer optlist, const char *name, double deflt)
+winSetRealOption(pointer optlist, const char *name, double deflt)
{
- OptionInfoRec o;
+ OptionInfoRec o;
- o.name = name;
- o.type = OPTV_REAL;
- if (ParseOptionValue (-1, optlist, &o))
- deflt = o.value.realnum;
- return deflt;
+ o.name = name;
+ o.type = OPTV_REAL;
+ if (ParseOptionValue(-1, optlist, &o))
+ deflt = o.value.realnum;
+ return deflt;
}
double
-winSetPercentOption (pointer optlist, const char *name, double deflt)
+winSetPercentOption(pointer optlist, const char *name, double deflt)
{
- OptionInfoRec o;
+ OptionInfoRec o;
- o.name = name;
- o.type = OPTV_PERCENT;
- if (ParseOptionValue (-1, optlist, &o))
- deflt = o.value.realnum;
- return deflt;
+ o.name = name;
+ o.type = OPTV_PERCENT;
+ if (ParseOptionValue(-1, optlist, &o))
+ deflt = o.value.realnum;
+ return deflt;
}
#endif
-
/*
* Compare two strings for equality. This is caseinsensitive and
* The characters '_', ' ' (space) and '\t' (tab) are treated as
@@ -713,45 +661,42 @@ winSetPercentOption (pointer optlist, const char *name, double deflt)
*/
int
-winNameCompare (const char *s1, const char *s2)
+winNameCompare(const char *s1, const char *s2)
{
- char c1, c2;
+ char c1, c2;
- if (!s1 || *s1 == 0)
- {
- if (!s2 || *s2 == 0)
- return 0;
- else
- return 1;
+ if (!s1 || *s1 == 0) {
+ if (!s2 || *s2 == 0)
+ return 0;
+ else
+ return 1;
}
- while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
- s1++;
- while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
- s2++;
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
- c1 = (isupper ((int)*s1) ? tolower ((int)*s1) : *s1);
- c2 = (isupper ((int)*s2) ? tolower ((int)*s2) : *s2);
+ c1 = (isupper((int) *s1) ? tolower((int) *s1) : *s1);
+ c2 = (isupper((int) *s2) ? tolower((int) *s2) : *s2);
- while (c1 == c2)
- {
- if (c1 == 0)
- return 0;
- s1++;
- s2++;
-
- while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
- s1++;
- while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
- s2++;
-
- c1 = (isupper ((int)*s1) ? tolower ((int)*s1) : *s1);
- c2 = (isupper ((int)*s2) ? tolower ((int)*s2) : *s2);
+ while (c1 == c2) {
+ if (c1 == 0)
+ return 0;
+ s1++;
+ s2++;
+
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+
+ c1 = (isupper((int) *s1) ? tolower((int) *s1) : *s1);
+ c2 = (isupper((int) *s2) ? tolower((int) *s2) : *s2);
}
- return c1 - c2;
+ return c1 - c2;
}
-
#ifdef XWIN_XF86CONFIG
/*
* Find the named option in the list.
@@ -759,351 +704,297 @@ winNameCompare (const char *s1, const char *s2)
*/
XF86OptionPtr
-winFindOption (XF86OptionPtr list, const char *name)
+winFindOption(XF86OptionPtr list, const char *name)
{
- while (list)
- {
- if (winNameCompare (list->opt_name, name) == 0)
- return list;
- list = list->list.next;
+ while (list) {
+ if (winNameCompare(list->opt_name, name) == 0)
+ return list;
+ list = list->list.next;
}
- return NULL;
+ return NULL;
}
-
/*
* Find the Value of an named option.
* @return The option value or NULL if not found.
*/
char *
-winFindOptionValue (XF86OptionPtr list, const char *name)
+winFindOptionValue(XF86OptionPtr list, const char *name)
{
- list = winFindOption (list, name);
- if (list)
- {
- if (list->opt_val)
- return list->opt_val;
- else
- return "";
+ list = winFindOption(list, name);
+ if (list) {
+ if (list->opt_val)
+ return list->opt_val;
+ else
+ return "";
}
- return NULL;
+ return NULL;
}
-
/*
* Parse the option.
*/
static Bool
-ParseOptionValue (int scrnIndex, pointer options, OptionInfoPtr p)
+ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p)
{
- char *s, *end;
+ char *s, *end;
- if ((s = winFindOptionValue (options, p->name)) != NULL)
- {
- switch (p->type)
- {
- case OPTV_INTEGER:
- if (*s == '\0')
- {
+ if ((s = winFindOptionValue(options, p->name)) != NULL) {
+ switch (p->type) {
+ case OPTV_INTEGER:
+ if (*s == '\0') {
winDebug ( "Option \"%s\" requires an integer value\n",
- p->name);
- p->found = FALSE;
- }
- else
- {
- p->value.num = strtoul (s, &end, 0);
- if (*end == '\0')
- {
- p->found = TRUE;
- }
- else
- {
- winDebug ( "Option \"%s\" requires an integer value\n",
- p->name);
- p->found = FALSE;
- }
- }
- break;
- case OPTV_STRING:
- if (*s == '\0')
- {
- winDebug ( "Option \"%s\" requires an string value\n", p->name);
- p->found = FALSE;
- }
- else
- {
- p->value.str = s;
- p->found = TRUE;
- }
- break;
- case OPTV_ANYSTR:
- p->value.str = s;
- p->found = TRUE;
- break;
- case OPTV_REAL:
- if (*s == '\0')
- {
- winDebug ( "Option \"%s\" requires a floating point value\n",
- p->name);
- p->found = FALSE;
- }
- else
- {
- p->value.realnum = strtod (s, &end);
- if (*end == '\0')
- {
- p->found = TRUE;
- }
- else
- {
- winDebug ( "Option \"%s\" requires a floating point value\n",
- p->name);
- p->found = FALSE;
- }
- }
- break;
- case OPTV_BOOLEAN:
- if (GetBoolValue (p, s))
- {
- p->found = TRUE;
- }
- else
- {
- winDebug ( "Option \"%s\" requires a boolean value\n", p->name);
- p->found = FALSE;
- }
- break;
- case OPTV_PERCENT:
- if (*s == '\0')
- {
- winDrvMsg (scrnIndex, X_WARNING,
- "Option \"%s\" requires a percent value\n",
- p->name);
- p->found = FALSE;
- }
- else
- {
- double percent = strtod (s, &end);
-
- if (end != s && winNameCompare (end, "%"))
- {
- p->found = TRUE;
- p->value.realnum = percent;
- }
- else
- {
- winDrvMsg (scrnIndex, X_WARNING,
- "Option \"%s\" requires a frequency value\n",
- p->name);
- p->found = FALSE;
- }
- }
- case OPTV_FREQ:
- if (*s == '\0')
- {
- winDebug ( "Option \"%s\" requires a frequency value\n",
- p->name);
- p->found = FALSE;
- }
- else
- {
- double freq = strtod (s, &end);
- int units = 0;
-
- if (end != s)
- {
- p->found = TRUE;
- if (!winNameCompare (end, "Hz"))
- units = 1;
- else if (!winNameCompare (end, "kHz") ||
- !winNameCompare (end, "k"))
- units = 1000;
- else if (!winNameCompare (end, "MHz") ||
- !winNameCompare (end, "M"))
- units = 1000000;
- else
- {
- winDebug ( "Option \"%s\" requires a frequency value\n",
- p->name);
- p->found = FALSE;
- }
- if (p->found)
- freq *= (double) units;
- }
- else
- {
- winDebug ( "Option \"%s\" requires a frequency value\n",
- p->name);
- p->found = FALSE;
- }
- if (p->found)
- {
- p->value.freq.freq = freq;
- p->value.freq.units = units;
- }
- }
- break;
- case OPTV_NONE:
- /* Should never get here */
- p->found = FALSE;
- break;
- }
- if (p->found)
- {
- winDebug ("Option \"%s\"", p->name);
- if (!(p->type == OPTV_BOOLEAN && *s == 0))
- {
- winDebug (" \"%s\"", s);
- }
- winDebug ("\n");
- }
+ p->found = FALSE;
+ }
+ else {
+ p->value.num = strtoul(s, &end, 0);
+ if (*end == '\0') {
+ p->found = TRUE;
+ }
+ else {
+ winDebug ( "Option \"%s\" requires an integer value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_STRING:
+ if (*s == '\0') {
+ winDebug ( "Option \"%s\" requires an string value\n", p->name);
+ p->found = FALSE;
+ }
+ else {
+ p->value.str = s;
+ p->found = TRUE;
+ }
+ break;
+ case OPTV_ANYSTR:
+ p->value.str = s;
+ p->found = TRUE;
+ break;
+ case OPTV_REAL:
+ if (*s == '\0') {
+ winDebug ( "Option \"%s\" requires a floating point value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ else {
+ p->value.realnum = strtod(s, &end);
+ if (*end == '\0') {
+ p->found = TRUE;
+ }
+ else {
+ winDebug ( "Option \"%s\" requires a floating point value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_BOOLEAN:
+ if (GetBoolValue(p, s)) {
+ p->found = TRUE;
+ }
+ else {
+ winDebug ( "Option \"%s\" requires a boolean value\n", p->name);
+ p->found = FALSE;
+ }
+ break;
+ case OPTV_PERCENT:
+ if (*s == '\0') {
+ winDrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a percent value\n", p->name);
+ p->found = FALSE;
+ }
+ else {
+ double percent = strtod(s, &end);
+
+ if (end != s && winNameCompare(end, "%")) {
+ p->found = TRUE;
+ p->value.realnum = percent;
+ }
+ else {
+ winDrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
+ case OPTV_FREQ:
+ if (*s == '\0') {
+ winDebug ( "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ else {
+ double freq = strtod(s, &end);
+ int units = 0;
+
+ if (end != s) {
+ p->found = TRUE;
+ if (!winNameCompare(end, "Hz"))
+ units = 1;
+ else if (!winNameCompare(end, "kHz") ||
+ !winNameCompare(end, "k"))
+ units = 1000;
+ else if (!winNameCompare(end, "MHz") ||
+ !winNameCompare(end, "M"))
+ units = 1000000;
+ else {
+ winDebug ( "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ if (p->found)
+ freq *= (double) units;
+ }
+ else {
+ winDebug ( "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ if (p->found) {
+ p->value.freq.freq = freq;
+ p->value.freq.units = units;
+ }
+ }
+ break;
+ case OPTV_NONE:
+ /* Should never get here */
+ p->found = FALSE;
+ break;
+ }
+ if (p->found) {
+ winDebug ("Option \"%s\"", p->name);
+ if (!(p->type == OPTV_BOOLEAN && *s == 0)) {
+ winDebug (" \"%s\"", s);
+ }
+ winDebug ("\n");
+ }
}
- else if (p->type == OPTV_BOOLEAN)
- {
- /* Look for matches with options with or without a "No" prefix. */
- char *n, *newn;
- OptionInfoRec opt;
-
- n = winNormalizeName (p->name);
- if (!n)
- {
- p->found = FALSE;
- return FALSE;
- }
- if (strncmp (n, "no", 2) == 0)
- {
- newn = n + 2;
- }
- else
- {
- free (n);
- n = malloc (strlen (p->name) + 2 + 1);
- if (!n)
- {
- p->found = FALSE;
- return FALSE;
- }
- strcpy (n, "No");
- strcat (n, p->name);
- newn = n;
- }
- if ((s = winFindOptionValue (options, newn)) != NULL)
- {
- if (GetBoolValue (&opt, s))
- {
- p->value.bool = !opt.value.bool;
- p->found = TRUE;
- }
- else
- {
- winDebug ( "Option \"%s\" requires a boolean value\n", newn);
- p->found = FALSE;
- }
- }
- else
- {
- p->found = FALSE;
- }
- if (p->found)
- {
- winDebug ("Option \"%s\"", newn);
- if (*s != 0)
- {
- winDebug (" \"%s\"", s);
- }
- winDebug ("\n");
- }
- free (n);
+ else if (p->type == OPTV_BOOLEAN) {
+ /* Look for matches with options with or without a "No" prefix. */
+ char *n, *newn;
+ OptionInfoRec opt;
+
+ n = winNormalizeName(p->name);
+ if (!n) {
+ p->found = FALSE;
+ return FALSE;
+ }
+ if (strncmp(n, "no", 2) == 0) {
+ newn = n + 2;
+ }
+ else {
+ free(n);
+ n = malloc(strlen(p->name) + 2 + 1);
+ if (!n) {
+ p->found = FALSE;
+ return FALSE;
+ }
+ strcpy(n, "No");
+ strcat(n, p->name);
+ newn = n;
+ }
+ if ((s = winFindOptionValue(options, newn)) != NULL) {
+ if (GetBoolValue(&opt, s)) {
+ p->value.bool = !opt.value.bool;
+ p->found = TRUE;
+ }
+ else {
+ winDebug ( "Option \"%s\" requires a boolean value\n", newn);
+ p->found = FALSE;
+ }
+ }
+ else {
+ p->found = FALSE;
+ }
+ if (p->found) {
+ winDebug ("Option \"%s\"", newn);
+ if (*s != 0) {
+ winDebug (" \"%s\"", s);
+ }
+ winDebug ("\n");
+ }
+ free(n);
}
- else
- {
- p->found = FALSE;
+ else {
+ p->found = FALSE;
}
- return p->found;
+ return p->found;
}
-
static Bool
-configLayout (serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
- char *default_layout)
+configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
+ char *default_layout)
{
#if 0
#pragma warn UNIMPLEMENTED
#endif
- return TRUE;
+ return TRUE;
}
-
static Bool
-configImpliedLayout (serverLayoutPtr servlayoutp,
- XF86ConfScreenPtr conf_screen)
+configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
{
#if 0
#pragma warn UNIMPLEMENTED
#endif
- return TRUE;
+ return TRUE;
}
-
static Bool
-GetBoolValue (OptionInfoPtr p, const char *s)
+GetBoolValue(OptionInfoPtr p, const char *s)
{
- if (*s == 0)
- {
- p->value.bool = TRUE;
+ if (*s == 0) {
+ p->value.bool = TRUE;
}
- else
- {
- if (winNameCompare (s, "1") == 0)
- p->value.bool = TRUE;
- else if (winNameCompare (s, "on") == 0)
- p->value.bool = TRUE;
- else if (winNameCompare (s, "true") == 0)
- p->value.bool = TRUE;
- else if (winNameCompare (s, "yes") == 0)
- p->value.bool = TRUE;
- else if (winNameCompare (s, "0") == 0)
- p->value.bool = FALSE;
- else if (winNameCompare (s, "off") == 0)
- p->value.bool = FALSE;
- else if (winNameCompare (s, "false") == 0)
- p->value.bool = FALSE;
- else if (winNameCompare (s, "no") == 0)
- p->value.bool = FALSE;
+ else {
+ if (winNameCompare(s, "1") == 0)
+ p->value.bool = TRUE;
+ else if (winNameCompare(s, "on") == 0)
+ p->value.bool = TRUE;
+ else if (winNameCompare(s, "true") == 0)
+ p->value.bool = TRUE;
+ else if (winNameCompare(s, "yes") == 0)
+ p->value.bool = TRUE;
+ else if (winNameCompare(s, "0") == 0)
+ p->value.bool = FALSE;
+ else if (winNameCompare(s, "off") == 0)
+ p->value.bool = FALSE;
+ else if (winNameCompare(s, "false") == 0)
+ p->value.bool = FALSE;
+ else if (winNameCompare(s, "no") == 0)
+ p->value.bool = FALSE;
}
- return TRUE;
+ return TRUE;
}
#endif
-
char *
-winNormalizeName (const char *s)
+winNormalizeName(const char *s)
{
- char *ret, *q;
- const char *p;
-
- if (s == NULL)
- return NULL;
-
- ret = malloc (strlen (s) + 1);
- for (p = s, q = ret; *p != 0; p++)
- {
- switch (*p)
- {
- case '_':
- case ' ':
- case '\t':
- continue;
- default:
- if (isupper ((int)*p))
- *q++ = tolower ((int)*p);
- else
- *q++ = *p;
- }
+ char *ret, *q;
+ const char *p;
+
+ if (s == NULL)
+ return NULL;
+
+ ret = malloc(strlen(s) + 1);
+ for (p = s, q = ret; *p != 0; p++) {
+ switch (*p) {
+ case '_':
+ case ' ':
+ case '\t':
+ continue;
+ default:
+ if (isupper((int) *p))
+ *q++ = tolower((int) *p);
+ else
+ *q++ = *p;
+ }
}
- *q = '\0';
- return ret;
+ *q = '\0';
+ return ret;
}
-
diff --git a/xorg-server/hw/xwin/winconfig.h b/xorg-server/hw/xwin/winconfig.h
index 7f533cff0..94571ff71 100644
--- a/xorg-server/hw/xwin/winconfig.h
+++ b/xorg-server/hw/xwin/winconfig.h
@@ -1,324 +1,264 @@
-#ifndef __WIN_CONFIG_H__
-#define __WIN_CONFIG_H__
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Alexander Gottwald
- */
-
-#include "win.h"
-#ifdef XWIN_XF86CONFIG
-#include "../xfree86/parser/xf86Parser.h"
-#endif
-
-
-/* These are taken from hw/xfree86/common/xf86str.h */
-
-typedef struct
-{
- CARD32 red, green, blue;
-}
-rgb;
-
-
-typedef struct
-{
- float red, green, blue;
-}
-Gamma;
-
-
-typedef struct
-{
- char *identifier;
- char *vendor;
- char *board;
- char *chipset;
- char *ramdac;
- char *driver;
- struct _confscreenrec *myScreenSection;
- Bool claimed;
- Bool active;
- Bool inUse;
- int videoRam;
- int textClockFreq;
- pointer options;
- int screen; /* For multi-CRTC cards */
-}
-GDevRec, *GDevPtr;
-
-
-typedef struct
-{
- char *identifier;
- char *driver;
- pointer commonOptions;
- pointer extraOptions;
-}
-IDevRec, *IDevPtr;
-
-
-typedef struct
-{
- int frameX0;
- int frameY0;
- int virtualX;
- int virtualY;
- int depth;
- int fbbpp;
- rgb weight;
- rgb blackColour;
- rgb whiteColour;
- int defaultVisual;
- char **modes;
- pointer options;
-}
-DispRec, *DispPtr;
-
-
-typedef struct _confxvportrec
-{
- char *identifier;
- pointer options;
-}
-confXvPortRec, *confXvPortPtr;
-
-
-typedef struct _confxvadaptrec
-{
- char *identifier;
- int numports;
- confXvPortPtr ports;
- pointer options;
-}
-confXvAdaptorRec, *confXvAdaptorPtr;
-
-
-typedef struct _confscreenrec
-{
- char *id;
- int screennum;
- int defaultdepth;
- int defaultbpp;
- int defaultfbbpp;
- GDevPtr device;
- int numdisplays;
- DispPtr displays;
- int numxvadaptors;
- confXvAdaptorPtr xvadaptors;
- pointer options;
-}
-confScreenRec, *confScreenPtr;
-
-
-typedef enum
-{
- PosObsolete = -1,
- PosAbsolute = 0,
- PosRightOf,
- PosLeftOf,
- PosAbove,
- PosBelow,
- PosRelative
-}
-PositionType;
-
-
-typedef struct _screenlayoutrec
-{
- confScreenPtr screen;
- char *topname;
- confScreenPtr top;
- char *bottomname;
- confScreenPtr bottom;
- char *leftname;
- confScreenPtr left;
- char *rightname;
- confScreenPtr right;
- PositionType where;
- int x;
- int y;
- char *refname;
- confScreenPtr refscreen;
-}
-screenLayoutRec, *screenLayoutPtr;
-
-
-typedef struct _serverlayoutrec
-{
- char *id;
- screenLayoutPtr screens;
- GDevPtr inactives;
- IDevPtr inputs;
- pointer options;
-}
-serverLayoutRec, *serverLayoutPtr;
-
-
-/*
- * winconfig.c
- */
-
-typedef struct
-{
- /* Files */
-#ifdef XWIN_XF86CONFIG
- char *configFile;
- char *configDir;
-#endif
- char *fontPath;
- /* input devices - keyboard */
-#ifdef XWIN_XF86CONFIG
- char *keyboard;
-#endif
- char *xkbRules;
- char *xkbModel;
- char *xkbLayout;
- char *xkbVariant;
- char *xkbOptions;
- /* layout */
- char *screenname;
- /* mouse settings */
- char *mouse;
- Bool emulate3buttons;
- long emulate3timeout;
-}
-WinCmdlineRec, *WinCmdlinePtr;
-
-
-extern WinCmdlineRec g_cmdline;
-#ifdef XWIN_XF86CONFIG
-extern XF86ConfigPtr g_xf86configptr;
-#endif
-extern serverLayoutRec g_winConfigLayout;
-
-
-/*
- * Function prototypes
- */
-
-Bool winReadConfigfile (void);
-Bool winConfigFiles (void);
-Bool winConfigOptions (void);
-Bool winConfigScreens (void);
-Bool winConfigKeyboard (DeviceIntPtr pDevice);
-Bool winConfigMouse (DeviceIntPtr pDevice);
-
-
-typedef struct
-{
- double freq;
- int units;
-}
-OptFrequency;
-
-
-typedef union
-{
- unsigned long num;
- char *str;
- double realnum;
- Bool bool;
- OptFrequency freq;
-}
-ValueUnion;
-
-
-typedef enum
-{
- OPTV_NONE = 0,
- OPTV_INTEGER,
- OPTV_STRING, /* a non-empty string */
- OPTV_ANYSTR, /* Any string, including an empty one */
- OPTV_REAL,
- OPTV_BOOLEAN,
- OPTV_PERCENT,
- OPTV_FREQ
-}
-OptionValueType;
-
-
-typedef enum
-{
- OPTUNITS_HZ = 1,
- OPTUNITS_KHZ,
- OPTUNITS_MHZ
-}
-OptFreqUnits;
-
-
-typedef struct
-{
- int token;
- const char *name;
- OptionValueType type;
- ValueUnion value;
- Bool found;
-}
-OptionInfoRec, *OptionInfoPtr;
-
-
-/*
- * Function prototypes
- */
-
-char *winSetStrOption (pointer optlist, const char *name, char *deflt);
-int winSetBoolOption (pointer optlist, const char *name, int deflt);
-int winSetIntOption (pointer optlist, const char *name, int deflt);
-double winSetRealOption (pointer optlist, const char *name, double deflt);
-double winSetPercentOption (pointer optlist, const char *name, double deflt);
-#ifdef XWIN_XF86CONFIG
-XF86OptionPtr winFindOption (XF86OptionPtr list, const char *name);
-char *winFindOptionValue (XF86OptionPtr list, const char *name);
-#endif
-int winNameCompare (const char *s1, const char *s2);
-char *winNormalizeName (const char *s);
-
-
-typedef struct
-{
- struct
- {
- long leds;
- long delay;
- long rate;
- }
- keyboard;
- XkbRMLVOSet xkb;
- struct
- {
- Bool emulate3Buttons;
- long emulate3Timeout;
- }
- pointer;
-}
-winInfoRec, *winInfoPtr;
-
-
-extern winInfoRec g_winInfo;
-
-#endif
+#ifndef __WIN_CONFIG_H__
+#define __WIN_CONFIG_H__
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Alexander Gottwald
+ */
+
+#include "win.h"
+#ifdef XWIN_XF86CONFIG
+#include "../xfree86/parser/xf86Parser.h"
+#endif
+
+/* These are taken from hw/xfree86/common/xf86str.h */
+
+typedef struct {
+ CARD32 red, green, blue;
+} rgb;
+
+typedef struct {
+ float red, green, blue;
+} Gamma;
+
+typedef struct {
+ char *identifier;
+ char *vendor;
+ char *board;
+ char *chipset;
+ char *ramdac;
+ char *driver;
+ struct _confscreenrec *myScreenSection;
+ Bool claimed;
+ Bool active;
+ Bool inUse;
+ int videoRam;
+ int textClockFreq;
+ pointer options;
+ int screen; /* For multi-CRTC cards */
+} GDevRec, *GDevPtr;
+
+typedef struct {
+ char *identifier;
+ char *driver;
+ pointer commonOptions;
+ pointer extraOptions;
+} IDevRec, *IDevPtr;
+
+typedef struct {
+ int frameX0;
+ int frameY0;
+ int virtualX;
+ int virtualY;
+ int depth;
+ int fbbpp;
+ rgb weight;
+ rgb blackColour;
+ rgb whiteColour;
+ int defaultVisual;
+ char **modes;
+ pointer options;
+} DispRec, *DispPtr;
+
+typedef struct _confxvportrec {
+ char *identifier;
+ pointer options;
+} confXvPortRec, *confXvPortPtr;
+
+typedef struct _confxvadaptrec {
+ char *identifier;
+ int numports;
+ confXvPortPtr ports;
+ pointer options;
+} confXvAdaptorRec, *confXvAdaptorPtr;
+
+typedef struct _confscreenrec {
+ char *id;
+ int screennum;
+ int defaultdepth;
+ int defaultbpp;
+ int defaultfbbpp;
+ GDevPtr device;
+ int numdisplays;
+ DispPtr displays;
+ int numxvadaptors;
+ confXvAdaptorPtr xvadaptors;
+ pointer options;
+} confScreenRec, *confScreenPtr;
+
+typedef enum {
+ PosObsolete = -1,
+ PosAbsolute = 0,
+ PosRightOf,
+ PosLeftOf,
+ PosAbove,
+ PosBelow,
+ PosRelative
+} PositionType;
+
+typedef struct _screenlayoutrec {
+ confScreenPtr screen;
+ char *topname;
+ confScreenPtr top;
+ char *bottomname;
+ confScreenPtr bottom;
+ char *leftname;
+ confScreenPtr left;
+ char *rightname;
+ confScreenPtr right;
+ PositionType where;
+ int x;
+ int y;
+ char *refname;
+ confScreenPtr refscreen;
+} screenLayoutRec, *screenLayoutPtr;
+
+typedef struct _serverlayoutrec {
+ char *id;
+ screenLayoutPtr screens;
+ GDevPtr inactives;
+ IDevPtr inputs;
+ pointer options;
+} serverLayoutRec, *serverLayoutPtr;
+
+/*
+ * winconfig.c
+ */
+
+typedef struct {
+ /* Files */
+#ifdef XWIN_XF86CONFIG
+ char *configFile;
+ char *configDir;
+#endif
+ char *fontPath;
+ /* input devices - keyboard */
+#ifdef XWIN_XF86CONFIG
+ char *keyboard;
+#endif
+ char *xkbRules;
+ char *xkbModel;
+ char *xkbLayout;
+ char *xkbVariant;
+ char *xkbOptions;
+ /* layout */
+ char *screenname;
+ /* mouse settings */
+ char *mouse;
+ Bool emulate3buttons;
+ long emulate3timeout;
+} WinCmdlineRec, *WinCmdlinePtr;
+
+extern WinCmdlineRec g_cmdline;
+
+#ifdef XWIN_XF86CONFIG
+extern XF86ConfigPtr g_xf86configptr;
+#endif
+extern serverLayoutRec g_winConfigLayout;
+
+/*
+ * Function prototypes
+ */
+
+Bool winReadConfigfile(void);
+Bool winConfigFiles(void);
+Bool winConfigOptions(void);
+Bool winConfigScreens(void);
+Bool winConfigKeyboard(DeviceIntPtr pDevice);
+Bool winConfigMouse(DeviceIntPtr pDevice);
+
+typedef struct {
+ double freq;
+ int units;
+} OptFrequency;
+
+typedef union {
+ unsigned long num;
+ char *str;
+ double realnum;
+ Bool bool;
+ OptFrequency freq;
+} ValueUnion;
+
+typedef enum {
+ OPTV_NONE = 0,
+ OPTV_INTEGER,
+ OPTV_STRING, /* a non-empty string */
+ OPTV_ANYSTR, /* Any string, including an empty one */
+ OPTV_REAL,
+ OPTV_BOOLEAN,
+ OPTV_PERCENT,
+ OPTV_FREQ
+} OptionValueType;
+
+typedef enum {
+ OPTUNITS_HZ = 1,
+ OPTUNITS_KHZ,
+ OPTUNITS_MHZ
+} OptFreqUnits;
+
+typedef struct {
+ int token;
+ const char *name;
+ OptionValueType type;
+ ValueUnion value;
+ Bool found;
+} OptionInfoRec, *OptionInfoPtr;
+
+/*
+ * Function prototypes
+ */
+
+char *winSetStrOption(pointer optlist, const char *name, char *deflt);
+int winSetBoolOption(pointer optlist, const char *name, int deflt);
+int winSetIntOption(pointer optlist, const char *name, int deflt);
+double winSetRealOption(pointer optlist, const char *name, double deflt);
+double winSetPercentOption(pointer optlist, const char *name, double deflt);
+
+#ifdef XWIN_XF86CONFIG
+XF86OptionPtr winFindOption(XF86OptionPtr list, const char *name);
+char *winFindOptionValue(XF86OptionPtr list, const char *name);
+#endif
+int winNameCompare(const char *s1, const char *s2);
+char *winNormalizeName(const char *s);
+
+typedef struct {
+ struct {
+ long leds;
+ long delay;
+ long rate;
+ } keyboard;
+ XkbRMLVOSet xkb;
+ struct {
+ Bool emulate3Buttons;
+ long emulate3Timeout;
+ } pointer;
+} winInfoRec, *winInfoPtr;
+
+extern winInfoRec g_winInfo;
+
+#endif
diff --git a/xorg-server/hw/xwin/wincreatewnd.c b/xorg-server/hw/xwin/wincreatewnd.c
index 9b5b2f78f..0580421ae 100644
--- a/xorg-server/hw/xwin/wincreatewnd.c
+++ b/xorg-server/hw/xwin/wincreatewnd.c
@@ -39,481 +39,455 @@
*/
static Bool
-winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo);
+ winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo);
static Bool
-winAdjustForAutoHide (RECT *prcWorkArea, winScreenInfo *pScreenInfo);
-
+ winAdjustForAutoHide (RECT *prcWorkArea, winScreenInfo *pScreenInfo);
/*
* Create a full screen window
*/
Bool
-winCreateBoundingWindowFullScreen (ScreenPtr pScreen)
+winCreateBoundingWindowFullScreen(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- int iX = pScreenInfo->dwInitialX;
- int iY = pScreenInfo->dwInitialY;
- int iWidth = pScreenInfo->dwWidth;
- int iHeight = pScreenInfo->dwHeight;
- HWND *phwnd = &pScreenPriv->hwndScreen;
- WNDCLASSEX wc;
- char szTitle[256];
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ int iX = pScreenInfo->dwInitialX;
+ int iY = pScreenInfo->dwInitialY;
+ int iWidth = pScreenInfo->dwWidth;
+ int iHeight = pScreenInfo->dwHeight;
+ HWND *phwnd = &pScreenPriv->hwndScreen;
+ WNDCLASSEX wc;
+ char szTitle[256];
char HostName[256];
gethostname(HostName,256);
- winDebug ("winCreateBoundingWindowFullScreen\n");
-
- /* Setup our window class */
- wc.cbSize=sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = winWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = g_hInstance;
- wc.hIcon = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
- GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0);
- wc.hCursor = 0;
- wc.hbrBackground = 0;
- wc.lpszMenuName = NULL;
- wc.lpszClassName = WINDOW_CLASS;
- wc.hIconSm = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
- GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE);
- RegisterClassEx (&wc);
-
- /* Set display and screen-specific tooltip text */
- if (g_pszQueryHost != NULL)
- snprintf (szTitle,
- sizeof (szTitle),
- WINDOW_TITLE_XDMCP,
- g_pszQueryHost,
- HostName,
- display,
- (int) pScreenInfo->dwScreen);
- else
+ winDebug("winCreateBoundingWindowFullScreen\n");
+
+ /* Setup our window class */
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
+ wc.hIcon =
+ (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
+ GetSystemMetrics(SM_CXICON),
+ GetSystemMetrics(SM_CYICON), 0);
+ wc.hCursor = 0;
+ wc.hbrBackground = 0;
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WINDOW_CLASS;
+ wc.hIconSm =
+ (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE);
+ RegisterClassEx(&wc);
+
+ /* Set display and screen-specific tooltip text */
+ if (g_pszQueryHost != NULL)
+ snprintf(szTitle,
+ sizeof(szTitle),
+ WINDOW_TITLE_XDMCP,
+ g_pszQueryHost, HostName, display, (int) pScreenInfo->dwScreen);
+ else
{
- snprintf (szTitle,
- sizeof (szTitle),
- WINDOW_TITLE,
- HostName,
- display,
- (int) pScreenInfo->dwScreen);
+ snprintf(szTitle,
+ sizeof(szTitle),
+ WINDOW_TITLE, HostName, display, (int) pScreenInfo->dwScreen);
}
- /* Create the window */
- *phwnd = CreateWindowExA (0, /* Extended styles */
- WINDOW_CLASS, /* Class name */
- szTitle, /* Window name */
- WS_POPUP,
- iX, /* Horizontal position */
- iY, /* Vertical position */
- iWidth, /* Right edge */
- iHeight, /* Bottom edge */
- (HWND) NULL, /* No parent or owner window */
- (HMENU) NULL, /* No menu */
- GetModuleHandle (NULL),/* Instance handle */
- pScreenPriv); /* ScreenPrivates */
-
- /* Branch on the server engine */
- switch (pScreenInfo->dwEngine)
- {
+ /* Create the window */
+ *phwnd = CreateWindowExA(0, /* Extended styles */
+ WINDOW_CLASS, /* Class name */
+ szTitle, /* Window name */
+ WS_POPUP, iX, /* Horizontal position */
+ iY, /* Vertical position */
+ iWidth, /* Right edge */
+ iHeight, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle(NULL), /* Instance handle */
+ pScreenPriv); /* ScreenPrivates */
+
+ /* Branch on the server engine */
+ switch (pScreenInfo->dwEngine) {
#ifdef XWIN_NATIVEGDI
case WIN_SERVER_SHADOW_GDI:
- /* Show the window */
- ShowWindow (*phwnd, SW_SHOWMAXIMIZED);
- break;
+ /* Show the window */
+ ShowWindow(*phwnd, SW_SHOWMAXIMIZED);
+ break;
#endif
default:
- /* Hide the window */
- ShowWindow (*phwnd, SW_SHOWNORMAL);
- break;
+ /* Hide the window */
+ ShowWindow(*phwnd, SW_SHOWNORMAL);
+ break;
}
- /* Send first paint message */
- UpdateWindow (*phwnd);
+ /* Send first paint message */
+ UpdateWindow(*phwnd);
- /* Attempt to bring our window to the top of the display */
- BringWindowToTop (*phwnd);
+ /* Attempt to bring our window to the top of the display */
+ BringWindowToTop(*phwnd);
- return TRUE;
+ return TRUE;
}
-
/*
* Create our primary Windows display window
*/
Bool
-winCreateBoundingWindowWindowed (ScreenPtr pScreen)
+winCreateBoundingWindowWindowed(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- int iWidth = pScreenInfo->dwUserWidth;
- int iHeight = pScreenInfo->dwUserHeight;
- int iPosX;
- int iPosY;
- HWND *phwnd = &pScreenPriv->hwndScreen;
- WNDCLASSEX wc;
- RECT rcClient, rcWorkArea;
- DWORD dwWindowStyle;
- BOOL fForceShowWindow = FALSE;
- char szTitle[256];
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ int iWidth = pScreenInfo->dwUserWidth;
+ int iHeight = pScreenInfo->dwUserHeight;
+ int iPosX;
+ int iPosY;
+ HWND *phwnd = &pScreenPriv->hwndScreen;
+ WNDCLASSEX wc;
+ RECT rcClient, rcWorkArea;
+ DWORD dwWindowStyle;
+ BOOL fForceShowWindow = FALSE;
+ char szTitle[256];
char HostName[256];
gethostname(HostName,256);
-
- winDebug ("winCreateBoundingWindowWindowed - User w: %d h: %d\n",
- (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight);
- winDebug ("winCreateBoundingWindowWindowed - Current w: %d h: %d\n",
- (int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight);
- /* Set the common window style flags */
- dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;
-
- /* Decorated or undecorated window */
- if (pScreenInfo->fDecoration
+ winDebug("winCreateBoundingWindowWindowed - User w: %d h: %d\n",
+ (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight);
+ winDebug("winCreateBoundingWindowWindowed - Current w: %d h: %d\n",
+ (int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight);
+
+ /* Set the common window style flags */
+ dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;
+
+ /* Decorated or undecorated window */
+ if (pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
+ && !pScreenInfo->fMWExtWM
#endif
- && !pScreenInfo->fRootless
+ && !pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- && !pScreenInfo->fMultiWindow
+ && !pScreenInfo->fMultiWindow
#endif
- )
- {
+ ) {
/* Try to handle startup via run.exe. run.exe instructs Windows to
* hide all created windows. Detect this case and make sure the
* window is shown nevertheless */
- STARTUPINFO startupInfo;
+ STARTUPINFO startupInfo;
+
GetStartupInfo(&startupInfo);
- if (startupInfo.dwFlags & STARTF_USESHOWWINDOW &&
- startupInfo.wShowWindow == SW_HIDE)
- {
- fForceShowWindow = TRUE;
- }
+ if (startupInfo.dwFlags & STARTF_USESHOWWINDOW &&
+ startupInfo.wShowWindow == SW_HIDE) {
+ fForceShowWindow = TRUE;
+ }
dwWindowStyle |= WS_CAPTION;
if (pScreenInfo->iResizeMode != notAllowed)
dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
}
- else
- dwWindowStyle |= WS_POPUP;
-
- /* Setup our window class */
- wc.cbSize=sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = winWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = g_hInstance;
- wc.hIcon = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
- GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0);
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = WINDOW_CLASS;
- wc.hIconSm = (HICON)LoadImage (g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
- GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE);
- RegisterClassEx (&wc);
-
- /* Get size of work area */
- winGetWorkArea (&rcWorkArea, pScreenInfo);
-
- /* Adjust for auto-hide taskbars */
- winAdjustForAutoHide (&rcWorkArea, pScreenInfo);
-
- /* Did the user specify a position? */
- if (pScreenInfo->fUserGavePosition)
- {
- iPosX = pScreenInfo->dwInitialX;
- iPosY = pScreenInfo->dwInitialY;
+ else
+ dwWindowStyle |= WS_POPUP;
+
+ /* Setup our window class */
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
+ wc.hIcon =
+ (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
+ GetSystemMetrics(SM_CXICON),
+ GetSystemMetrics(SM_CYICON), 0);
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WINDOW_CLASS;
+ wc.hIconSm =
+ (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE);
+ RegisterClassEx(&wc);
+
+ /* Get size of work area */
+ winGetWorkArea(&rcWorkArea, pScreenInfo);
+
+ /* Adjust for auto-hide taskbars */
+ winAdjustForAutoHide (&rcWorkArea, pScreenInfo);
+
+ /* Did the user specify a position? */
+ if (pScreenInfo->fUserGavePosition) {
+ iPosX = pScreenInfo->dwInitialX;
+ iPosY = pScreenInfo->dwInitialY;
}
- else
- {
- iPosX = rcWorkArea.left;
- iPosY = rcWorkArea.top;
+ else {
+ iPosX = rcWorkArea.left;
+ iPosY = rcWorkArea.top;
}
- /* Clean up the scrollbars flag, if necessary */
- if ((!pScreenInfo->fDecoration
+ /* Clean up the scrollbars flag, if necessary */
+ if ((!pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
- || pScreenInfo->fMWExtWM
+ || pScreenInfo->fMWExtWM
#endif
- || pScreenInfo->fRootless
+ || pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- || pScreenInfo->fMultiWindow
+ || pScreenInfo->fMultiWindow
#endif
- )
- && (pScreenInfo->iResizeMode == resizeWithScrollbars))
- {
- /* We cannot have scrollbars if we do not have a window border */
- pScreenInfo->iResizeMode = notAllowed;
+ )
+ && (pScreenInfo->iResizeMode == resizeWithScrollbars)) {
+ /* We cannot have scrollbars if we do not have a window border */
+ pScreenInfo->iResizeMode = notAllowed;
}
- /* Did the user specify a height and width? */
- if (pScreenInfo->fUserGaveHeightAndWidth)
- {
- /* User gave a desired height and width, try to accomodate */
- winDebug ("winCreateBoundingWindowWindowed - User gave height "
- "and width\n");
-
- /* Adjust the window width and height for borders and title bar */
- if (pScreenInfo->fDecoration
+ /* Did the user specify a height and width? */
+ if (pScreenInfo->fUserGaveHeightAndWidth) {
+ /* User gave a desired height and width, try to accomodate */
+ winDebug("winCreateBoundingWindowWindowed - User gave height "
+ "and width\n");
+
+ /* Adjust the window width and height for borders and title bar */
+ if (pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
+ && !pScreenInfo->fMWExtWM
#endif
- && !pScreenInfo->fRootless
+ && !pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- && !pScreenInfo->fMultiWindow
+ && !pScreenInfo->fMultiWindow
#endif
- )
- {
- winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n");
-
- /* Are we resizable */
- if (pScreenInfo->iResizeMode != notAllowed)
- {
- winDebug ("winCreateBoundingWindowWindowed - Window is resizable\n");
-
- iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
- iHeight += 2 * GetSystemMetrics (SM_CYSIZEFRAME)
- + GetSystemMetrics (SM_CYCAPTION);
- }
- else
- {
- winDebug ("winCreateBoundingWindowWindowed - Window is not resizable\n");
-
- iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME);
- iHeight += 2 * GetSystemMetrics (SM_CYFIXEDFRAME)
- + GetSystemMetrics (SM_CYCAPTION);
- }
- }
+ ) {
+ winDebug
+ ("winCreateBoundingWindowWindowed - Window has decoration\n");
+
+ /* Are we resizable */
+ if (pScreenInfo->iResizeMode != notAllowed) {
+ winDebug
+ ("winCreateBoundingWindowWindowed - Window is resizable\n");
+
+ iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight += 2 * GetSystemMetrics(SM_CYSIZEFRAME)
+ + GetSystemMetrics(SM_CYCAPTION);
+ }
+ else {
+ winDebug
+ ("winCreateBoundingWindowWindowed - Window is not resizable\n");
+
+ iWidth += 2 * GetSystemMetrics(SM_CXFIXEDFRAME);
+ iHeight += 2 * GetSystemMetrics(SM_CYFIXEDFRAME)
+ + GetSystemMetrics(SM_CYCAPTION);
+ }
+ }
}
- else
- {
- /* By default, we are creating a window that is as large as possible */
- winDebug ("winCreateBoundingWindowWindowed - User did not give "
- "height and width\n");
- /* Defaults are wrong if we have multiple monitors */
- if (pScreenInfo->fMultipleMonitors)
- {
- iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
- iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
- }
+ else {
+ /* By default, we are creating a window that is as large as possible */
+ winDebug("winCreateBoundingWindowWindowed - User did not give "
+ "height and width\n");
+ /* Defaults are wrong if we have multiple monitors */
+ if (pScreenInfo->fMultipleMonitors) {
+ iWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ iHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+ }
}
- /* Make sure window is no bigger than work area */
- if (TRUE
+ /* Make sure window is no bigger than work area */
+ if (TRUE
#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
+ && !pScreenInfo->fMWExtWM
#endif
#ifdef XWIN_MULTIWINDOW
- && !pScreenInfo->fMultiWindow
+ && !pScreenInfo->fMultiWindow
#endif
- )
- {
- /* Trim window width to fit work area */
- if (iWidth > (rcWorkArea.right - rcWorkArea.left))
- iWidth = rcWorkArea.right - rcWorkArea.left;
-
- /* Trim window height to fit work area */
- if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top))
- iHeight = rcWorkArea.bottom - rcWorkArea.top;
-
- winDebug ("winCreateBoundingWindowWindowed - Adjusted width: %d "\
- "height: %d\n",
- iWidth, iHeight);
+ ) {
+ /* Trim window width to fit work area */
+ if (iWidth > (rcWorkArea.right - rcWorkArea.left))
+ iWidth = rcWorkArea.right - rcWorkArea.left;
+
+ /* Trim window height to fit work area */
+ if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top))
+ iHeight = rcWorkArea.bottom - rcWorkArea.top;
+
+ winDebug("winCreateBoundingWindowWindowed - Adjusted width: %d "
+ "height: %d\n", iWidth, iHeight);
}
- /* Set display and screen-specific tooltip text */
- if (g_pszQueryHost != NULL)
- snprintf (szTitle,
- sizeof (szTitle),
- WINDOW_TITLE_XDMCP,
- g_pszQueryHost,
- HostName,
- display,
- (int) pScreenInfo->dwScreen);
- else
+ /* Set display and screen-specific tooltip text */
+ if (g_pszQueryHost != NULL)
+ snprintf(szTitle,
+ sizeof(szTitle),
+ WINDOW_TITLE_XDMCP,
+ g_pszQueryHost, HostName, display, (int) pScreenInfo->dwScreen);
+ else
{
- snprintf (szTitle,
- sizeof (szTitle),
- WINDOW_TITLE,
- HostName,
- display,
- (int) pScreenInfo->dwScreen);
+ snprintf(szTitle,
+ sizeof(szTitle),
+ WINDOW_TITLE, HostName, display, (int) pScreenInfo->dwScreen);
}
- /* Create the window */
- *phwnd = CreateWindowExA (0, /* Extended styles */
- WINDOW_CLASS, /* Class name */
- szTitle, /* Window name */
- dwWindowStyle,
- iPosX, /* Horizontal position */
- iPosY, /* Vertical position */
- iWidth, /* Right edge */
- iHeight, /* Bottom edge */
- (HWND) NULL, /* No parent or owner window */
- (HMENU) NULL, /* No menu */
- GetModuleHandle (NULL),/* Instance handle */
- pScreenPriv); /* ScreenPrivates */
- if (*phwnd == NULL)
- {
- ErrorF ("winCreateBoundingWindowWindowed - CreateWindowEx () failed\n");
- return FALSE;
+ /* Create the window */
+ *phwnd = CreateWindowExA(0, /* Extended styles */
+ WINDOW_CLASS, /* Class name */
+ szTitle, /* Window name */
+ dwWindowStyle, iPosX, /* Horizontal position */
+ iPosY, /* Vertical position */
+ iWidth, /* Right edge */
+ iHeight, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle(NULL), /* Instance handle */
+ pScreenPriv); /* ScreenPrivates */
+ if (*phwnd == NULL) {
+ ErrorF("winCreateBoundingWindowWindowed - CreateWindowEx () failed\n");
+ return FALSE;
}
- winDebug ("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n");
+ winDebug("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n");
- if (fForceShowWindow)
- {
- ErrorF("winCreateBoundingWindowWindowed - Setting normal windowstyle\n");
- ShowWindow(*phwnd, SW_SHOW);
- }
+ if (fForceShowWindow) {
+ ErrorF
+ ("winCreateBoundingWindowWindowed - Setting normal windowstyle\n");
+ ShowWindow(*phwnd, SW_SHOW);
+ }
- /* Get the client area coordinates */
- if (!GetClientRect (*phwnd, &rcClient))
- {
- ErrorF ("winCreateBoundingWindowWindowed - GetClientRect () "
- "failed\n");
- return FALSE;
+ /* Get the client area coordinates */
+ if (!GetClientRect(*phwnd, &rcClient)) {
+ ErrorF("winCreateBoundingWindowWindowed - GetClientRect () "
+ "failed\n");
+ return FALSE;
}
- winDebug ("winCreateBoundingWindowWindowed - WindowClient "
- "w %ld h %ld r %ld l %ld b %ld t %ld\n",
- rcClient.right - rcClient.left,
- rcClient.bottom - rcClient.top,
- rcClient.right, rcClient.left,
- rcClient.bottom, rcClient.top);
-
- /* We adjust the visual size if the user did not specify it */
- if (!((pScreenInfo->iResizeMode == resizeWithScrollbars) && pScreenInfo->fUserGaveHeightAndWidth))
- {
- /*
- * User did not give a height and width with scrollbars enabled,
- * so we will resize the underlying visual to be as large as
- * the initial view port (page size). This way scrollbars will
- * not appear until the user shrinks the window, if they ever do.
- *
- * NOTE: We have to store the viewport size here because
- * the user may have an autohide taskbar, which would
- * cause the viewport size to be one less in one dimension
- * than the viewport size that we calculated by subtracting
- * the size of the borders and caption.
- */
- pScreenInfo->dwWidth = rcClient.right - rcClient.left;
- pScreenInfo->dwHeight = rcClient.bottom - rcClient.top;
+ winDebug("winCreateBoundingWindowWindowed - WindowClient "
+ "w %ld h %ld r %ld l %ld b %ld t %ld\n",
+ rcClient.right - rcClient.left,
+ rcClient.bottom - rcClient.top,
+ rcClient.right, rcClient.left, rcClient.bottom, rcClient.top);
+
+ /* We adjust the visual size if the user did not specify it */
+ if (!
+ ((pScreenInfo->iResizeMode == resizeWithScrollbars) &&
+ pScreenInfo->fUserGaveHeightAndWidth)) {
+ /*
+ * User did not give a height and width with scrollbars enabled,
+ * so we will resize the underlying visual to be as large as
+ * the initial view port (page size). This way scrollbars will
+ * not appear until the user shrinks the window, if they ever do.
+ *
+ * NOTE: We have to store the viewport size here because
+ * the user may have an autohide taskbar, which would
+ * cause the viewport size to be one less in one dimension
+ * than the viewport size that we calculated by subtracting
+ * the size of the borders and caption.
+ */
+ pScreenInfo->dwWidth = rcClient.right - rcClient.left;
+ pScreenInfo->dwHeight = rcClient.bottom - rcClient.top;
}
#if 0
- /*
- * NOTE: For the uninitiated, the page size is the number of pixels
- * that we can display in the x or y direction at a time and the
- * range is the total number of pixels in the x or y direction that we
- * have available to display. In other words, the page size is the
- * size of the window area minus the space the caption, borders, and
- * scrollbars (if any) occupy, and the range is the size of the
- * underlying X visual. Notice that, contrary to what some of the
- * MSDN Library arcticles lead you to believe, the windows
- * ``client area'' size does not include the scrollbars. In other words,
- * the whole client area size that is reported to you is drawable by
- * you; you do not have to subtract the size of the scrollbars from
- * the client area size, and if you did it would result in the size
- * of the scrollbars being double counted.
- */
-
- /* Setup scrollbar page and range, if scrollbars are enabled */
- if (pScreenInfo->fScrollbars)
- {
- SCROLLINFO si;
-
- /* Initialize the scrollbar info structure */
- si.cbSize = sizeof (si);
- si.fMask = SIF_RANGE | SIF_PAGE;
- si.nMin = 0;
-
- /* Setup the width range and page size */
- si.nMax = pScreenInfo->dwWidth - 1;
- si.nPage = rcClient.right - rcClient.left;
- winDebug ("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n",
- si.nMax, si.nPage);
- SetScrollInfo (*phwnd, SB_HORZ, &si, TRUE);
-
- /* Setup the height range and page size */
- si.nMax = pScreenInfo->dwHeight - 1;
- si.nPage = rcClient.bottom - rcClient.top;
- winDebug ("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n",
- si.nMax, si.nPage);
- SetScrollInfo (*phwnd, SB_VERT, &si, TRUE);
+ /*
+ * NOTE: For the uninitiated, the page size is the number of pixels
+ * that we can display in the x or y direction at a time and the
+ * range is the total number of pixels in the x or y direction that we
+ * have available to display. In other words, the page size is the
+ * size of the window area minus the space the caption, borders, and
+ * scrollbars (if any) occupy, and the range is the size of the
+ * underlying X visual. Notice that, contrary to what some of the
+ * MSDN Library arcticles lead you to believe, the windows
+ * ``client area'' size does not include the scrollbars. In other words,
+ * the whole client area size that is reported to you is drawable by
+ * you; you do not have to subtract the size of the scrollbars from
+ * the client area size, and if you did it would result in the size
+ * of the scrollbars being double counted.
+ */
+
+ /* Setup scrollbar page and range, if scrollbars are enabled */
+ if (pScreenInfo->fScrollbars) {
+ SCROLLINFO si;
+
+ /* Initialize the scrollbar info structure */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_RANGE | SIF_PAGE;
+ si.nMin = 0;
+
+ /* Setup the width range and page size */
+ si.nMax = pScreenInfo->dwWidth - 1;
+ si.nPage = rcClient.right - rcClient.left;
+ winDebug("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n",
+ si.nMax, si.nPage);
+ SetScrollInfo(*phwnd, SB_HORZ, &si, TRUE);
+
+ /* Setup the height range and page size */
+ si.nMax = pScreenInfo->dwHeight - 1;
+ si.nPage = rcClient.bottom - rcClient.top;
+ winDebug("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n",
+ si.nMax, si.nPage);
+ SetScrollInfo(*phwnd, SB_VERT, &si, TRUE);
}
#endif
- /* Show the window */
- if (FALSE
+ /* Show the window */
+ if (FALSE
#ifdef XWIN_MULTIWINDOWEXTWM
- || pScreenInfo->fMWExtWM
+ || pScreenInfo->fMWExtWM
#endif
#ifdef XWIN_MULTIWINDOW
- || pScreenInfo->fMultiWindow
+ || pScreenInfo->fMultiWindow
#endif
- )
- {
+ ) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- pScreenPriv->fRootWindowShown = FALSE;
+ pScreenPriv->fRootWindowShown = FALSE;
#endif
- ShowWindow (*phwnd, SW_HIDE);
+ ShowWindow(*phwnd, SW_HIDE);
}
- else
- ShowWindow (*phwnd, SW_SHOWNORMAL);
- if (!UpdateWindow (*phwnd))
- {
- ErrorF ("winCreateBoundingWindowWindowed - UpdateWindow () failed\n");
- return FALSE;
+ else
+ ShowWindow(*phwnd, SW_SHOWNORMAL);
+ if (!UpdateWindow(*phwnd)) {
+ ErrorF("winCreateBoundingWindowWindowed - UpdateWindow () failed\n");
+ return FALSE;
}
-
- /* Attempt to bring our window to the top of the display */
- if (TRUE
+
+ /* Attempt to bring our window to the top of the display */
+ if (TRUE
#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
+ && !pScreenInfo->fMWExtWM
#endif
- && !pScreenInfo->fRootless
+ && !pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- && !pScreenInfo->fMultiWindow
+ && !pScreenInfo->fMultiWindow
#endif
- )
- {
- if (!BringWindowToTop (*phwnd))
- {
- ErrorF ("winCreateBoundingWindowWindowed - BringWindowToTop () "
- "failed\n");
- return FALSE;
- }
+ ) {
+ if (!BringWindowToTop(*phwnd)) {
+ ErrorF("winCreateBoundingWindowWindowed - BringWindowToTop () "
+ "failed\n");
+ return FALSE;
+ }
}
#ifdef XWIN_NATIVEGDI
- /* Paint window background blue */
- if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI)
- winPaintBackground (*phwnd, RGB (0x00, 0x00, 0xFF));
+ /* Paint window background blue */
+ if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI)
+ winPaintBackground(*phwnd, RGB(0x00, 0x00, 0xFF));
#endif
- winDebug ("winCreateBoundingWindowWindowed - Returning\n");
+ winDebug("winCreateBoundingWindowWindowed - Returning\n");
- return TRUE;
+ return TRUE;
}
-
/*
* Find the work area of all attached monitors
*/
static Bool
-winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo)
+winGetWorkArea(RECT * prcWorkArea, winScreenInfo * pScreenInfo)
{
- int iPrimaryWidth, iPrimaryHeight;
- int iWidth, iHeight;
- int iLeft, iTop;
- int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight;
+ int iPrimaryWidth, iPrimaryHeight;
+ int iWidth, iHeight;
+ int iLeft, iTop;
+ int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight;
/* Use GetMonitorInfo to get work area for monitor */
if (!pScreenInfo->fMultipleMonitors)
@@ -534,62 +508,59 @@ winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo)
ErrorF ("winGetWorkArea - GetMonitorInfo() failed for monitor %d\n", pScreenInfo->iMonitor);
}
- /* Bail out here if we aren't using multiple monitors */
- return TRUE;
+ /* Bail out here if we aren't using multiple monitors */
+ return TRUE;
}
/* SPI_GETWORKAREA only gets the work area of the primary screen. */
SystemParametersInfo (SPI_GETWORKAREA, 0, prcWorkArea, 0);
winDebug ("winGetWorkArea - Primary Monitor WorkArea: %d %d %d %d\n",
- (int) prcWorkArea->top, (int) prcWorkArea->left,
- (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
- /* Get size of full virtual screen */
- iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
- iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+ /* Get size of full virtual screen */
+ iWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ iHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
- winDebug ("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight);
+ winDebug("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight);
- /* Get origin of full virtual screen */
- iLeft = GetSystemMetrics (SM_XVIRTUALSCREEN);
- iTop = GetSystemMetrics (SM_YVIRTUALSCREEN);
+ /* Get origin of full virtual screen */
+ iLeft = GetSystemMetrics(SM_XVIRTUALSCREEN);
+ iTop = GetSystemMetrics(SM_YVIRTUALSCREEN);
- winDebug ("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop);
-
- /* Get size of primary screen */
- iPrimaryWidth = GetSystemMetrics (SM_CXSCREEN);
- iPrimaryHeight = GetSystemMetrics (SM_CYSCREEN);
+ winDebug("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop);
- winDebug ("winGetWorkArea - Primary screen is %d x %d\n",
- iPrimaryWidth, iPrimaryHeight);
-
- /* Work out how much of the primary screen we aren't using */
- iPrimaryNonWorkAreaWidth = iPrimaryWidth - (prcWorkArea->right -
- prcWorkArea->left);
- iPrimaryNonWorkAreaHeight = iPrimaryHeight - (prcWorkArea->bottom
- - prcWorkArea->top);
-
- /* Update the rectangle to include all monitors */
- if (iLeft < 0)
- {
- prcWorkArea->left = iLeft;
+ /* Get size of primary screen */
+ iPrimaryWidth = GetSystemMetrics(SM_CXSCREEN);
+ iPrimaryHeight = GetSystemMetrics(SM_CYSCREEN);
+
+ winDebug("winGetWorkArea - Primary screen is %d x %d\n",
+ iPrimaryWidth, iPrimaryHeight);
+
+ /* Work out how much of the primary screen we aren't using */
+ iPrimaryNonWorkAreaWidth = iPrimaryWidth - (prcWorkArea->right -
+ prcWorkArea->left);
+ iPrimaryNonWorkAreaHeight = iPrimaryHeight - (prcWorkArea->bottom
+ - prcWorkArea->top);
+
+ /* Update the rectangle to include all monitors */
+ if (iLeft < 0) {
+ prcWorkArea->left = iLeft;
}
- if (iTop < 0)
- {
- prcWorkArea->top = iTop;
+ if (iTop < 0) {
+ prcWorkArea->top = iTop;
}
- prcWorkArea->right = prcWorkArea->left + iWidth -
- iPrimaryNonWorkAreaWidth;
- prcWorkArea->bottom = prcWorkArea->top + iHeight -
- iPrimaryNonWorkAreaHeight;
-
- winDebug ("winGetWorkArea - Adjusted WorkArea for multiple "
- "monitors: %d %d %d %d\n",
- (int) prcWorkArea->top, (int) prcWorkArea->left,
- (int) prcWorkArea->bottom, (int) prcWorkArea->right);
-
- return TRUE;
+ prcWorkArea->right = prcWorkArea->left + iWidth - iPrimaryNonWorkAreaWidth;
+ prcWorkArea->bottom = prcWorkArea->top + iHeight -
+ iPrimaryNonWorkAreaHeight;
+
+ winDebug("winGetWorkArea - Adjusted WorkArea for multiple "
+ "monitors: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+
+ return TRUE;
}
static Bool
@@ -614,7 +585,6 @@ winTaskbarOnScreenEdge(unsigned int uEdge, winScreenInfo *pScreenInfo)
}
return FALSE;
}
-
/*
* Adjust the client area so that any auto-hide toolbars
* will work correctly.
@@ -623,54 +593,50 @@ winTaskbarOnScreenEdge(unsigned int uEdge, winScreenInfo *pScreenInfo)
static Bool
winAdjustForAutoHide (RECT *prcWorkArea, winScreenInfo *pScreenInfo)
{
- APPBARDATA abd;
+ APPBARDATA abd;
- winDebug ("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n",
- (int) prcWorkArea->top, (int) prcWorkArea->left,
- (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+ winDebug("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
- /* Find out if the Windows taskbar is set to auto-hide */
- ZeroMemory (&abd, sizeof (abd));
- abd.cbSize = sizeof (abd);
- if (SHAppBarMessage (ABM_GETSTATE, &abd) & ABS_AUTOHIDE)
- winDebug ("winAdjustForAutoHide - Taskbar is auto hide\n");
+ /* Find out if the Windows taskbar is set to auto-hide */
+ ZeroMemory(&abd, sizeof(abd));
+ abd.cbSize = sizeof(abd);
+ if (SHAppBarMessage(ABM_GETSTATE, &abd) & ABS_AUTOHIDE)
+ winDebug("winAdjustForAutoHide - Taskbar is auto hide\n");
/*
Despite the forgoing, we are checking for any AppBar
hiding along a monitor edge, not just the Windows TaskBar.
*/
- /* Look for a TOP auto-hide taskbar */
- if (winTaskbarOnScreenEdge(ABE_TOP, pScreenInfo))
- {
- winDebug ("winAdjustForAutoHide - Found TOP auto-hide taskbar\n");
- prcWorkArea->top += 1;
+ /* Look for a TOP auto-hide taskbar */
+ if (winTaskbarOnScreenEdge(ABE_TOP, pScreenInfo)) {
+ winDebug("winAdjustForAutoHide - Found TOP auto-hide taskbar\n");
+ prcWorkArea->top += 1;
}
- /* Look for a LEFT auto-hide taskbar */
- if (winTaskbarOnScreenEdge(ABE_LEFT, pScreenInfo))
- {
- winDebug ("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n");
- prcWorkArea->left += 1;
+ /* Look for a LEFT auto-hide taskbar */
+ if (winTaskbarOnScreenEdge(ABE_LEFT, pScreenInfo)) {
+ winDebug("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n");
+ prcWorkArea->left += 1;
}
- /* Look for a BOTTOM auto-hide taskbar */
- if (winTaskbarOnScreenEdge(ABE_BOTTOM, pScreenInfo))
- {
- winDebug ("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n");
- prcWorkArea->bottom -= 1;
+ /* Look for a BOTTOM auto-hide taskbar */
+ if (winTaskbarOnScreenEdge(ABE_BOTTOM, pScreenInfo)) {
+ winDebug("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n");
+ prcWorkArea->bottom -= 1;
}
- /* Look for a RIGHT auto-hide taskbar */
- if (winTaskbarOnScreenEdge(ABE_RIGHT, pScreenInfo))
- {
- winDebug ("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n");
- prcWorkArea->right -= 1;
+ /* Look for a RIGHT auto-hide taskbar */
+ if (winTaskbarOnScreenEdge(ABE_RIGHT, pScreenInfo)) {
+ winDebug("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n");
+ prcWorkArea->right -= 1;
}
- winDebug ("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n",
- (int) prcWorkArea->top, (int) prcWorkArea->left,
- (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+ winDebug("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
- return TRUE;
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c
index 3cae2361b..8f4130207 100644
--- a/xorg-server/hw/xwin/wincursor.c
+++ b/xorg-server/hw/xwin/wincursor.c
@@ -1,628 +1,613 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Dakshinamurthy Karra
- * Suhaib M Siddiqi
- * Peter Busch
- * Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-#include "winmsg.h"
-#include <cursorstr.h>
-#include <mipointrst.h>
-#include <servermd.h>
-#include "misc.h"
-
-#define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114)
-
-#ifdef _MSC_VER
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-/*
- * Local function prototypes
- */
-
-static void
-winPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
-
-static Bool
-winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y);
-
-static void
-winCrossScreen (ScreenPtr pScreen, Bool fEntering);
-
-miPointerScreenFuncRec g_winPointerCursorFuncs =
-{
- winCursorOffScreen,
- winCrossScreen,
- winPointerWarpCursor
-};
-
-
-static void
-winPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
- winScreenPriv(pScreen);
- RECT rcClient;
- static Bool s_fInitialWarp = TRUE;
-
- /* Discard first warp call */
- if (s_fInitialWarp)
- {
- /* First warp moves mouse to center of window, just ignore it */
-
- /* Don't ignore subsequent warps */
- s_fInitialWarp = FALSE;
-
- winDebug ("winPointerWarpCursor - Discarding first warp: %d %d\n",
- x, y);
-
- return;
- }
-
- /*
- Only update the Windows cursor position if root window is active,
- or we are in a rootless mode
- */
- if ((pScreenPriv->hwndScreen == GetForegroundWindow ())
- || pScreenPriv->pScreenInfo->fRootless
-#ifdef XWIN_MULTIWINDOW
- || pScreenPriv->pScreenInfo->fMultiWindow
-#endif
- )
- {
- /* Get the client area coordinates */
- GetClientRect (pScreenPriv->hwndScreen, &rcClient);
-
- /* Translate the client area coords to screen coords */
- MapWindowPoints (pScreenPriv->hwndScreen,
- HWND_DESKTOP,
- (LPPOINT)&rcClient,
- 2);
-
- /*
- * Update the Windows cursor position so that we don't
- * immediately warp back to the current position.
- */
- SetCursorPos (rcClient.left + x, rcClient.top + y);
- }
-
- /* Call the mi warp procedure to do the actual warping in X. */
- miPointerWarpCursor (pDev, pScreen, x, y);
-}
-
-static Bool
-winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
-{
- return FALSE;
-}
-
-static void
-winCrossScreen (ScreenPtr pScreen, Bool fEntering)
-{
-}
-
-static unsigned char
-reverse(unsigned char c)
-{
- int i;
- unsigned char ret = 0;
- for (i = 0; i < 8; ++i)
- {
- ret |= ((c >> i)&1) << (7 - i);
- }
- return ret;
-}
-
-/*
- * Convert X cursor to Windows cursor
- * FIXME: Perhaps there are more smart code
- */
-static HCURSOR
-winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen)
-{
- winScreenPriv(pScreen);
- HCURSOR hCursor = NULL;
- unsigned char *pAnd;
- unsigned char *pXor;
- int nCX, nCY;
- int nBytes;
- double dForeY, dBackY;
- BOOL fReverse;
- HBITMAP hAnd, hXor;
- ICONINFO ii;
- unsigned char *pCur;
- int x, y;
- unsigned char bit;
- HDC hDC;
- BITMAPV4HEADER bi;
- BITMAPINFO *pbmi;
- unsigned long *lpBits;
-
- winDebug("winLoadCursor: Win32: %dx%d X11: %dx%d hotspot: %d,%d\n",
- pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
- pCursor->bits->width, pCursor->bits->height,
- pCursor->bits->xhot, pCursor->bits->yhot
- );
-
- /* We can use only White and Black, so calc brightness of color
- * Also check if the cursor is inverted */
- dForeY = BRIGHTNESS(pCursor->fore);
- dBackY = BRIGHTNESS(pCursor->back);
- fReverse = dForeY < dBackY;
-
- /* Check wether the X11 cursor is bigger than the win32 cursor */
- if (pScreenPriv->cursor.sm_cx < pCursor->bits->width ||
- pScreenPriv->cursor.sm_cy < pCursor->bits->height)
- {
- ErrorF ("winLoadCursor - Windows requires %dx%d cursor but X requires %dx%d\n",
- pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
- pCursor->bits->width, pCursor->bits->height);
- }
-
- /* Get the number of bytes required to store the whole cursor image
- * This is roughly (sm_cx * sm_cy) / 8
- * round up to 8 pixel boundary so we can convert whole bytes */
- nBytes = bits_to_bytes(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy;
-
- /* Get the effective width and height */
- nCX = min(pScreenPriv->cursor.sm_cx, pCursor->bits->width);
- nCY = min(pScreenPriv->cursor.sm_cy, pCursor->bits->height);
-
- /* Allocate memory for the bitmaps */
- pAnd = malloc (nBytes);
- memset (pAnd, 0xFF, nBytes);
- pXor = calloc (1, nBytes);
-
- /* Convert the X11 bitmap to a win32 bitmap
- * The first is for an empty mask */
- if (pCursor->bits->emptyMask)
- {
- int x, y, xmax = bits_to_bytes(nCX);
- for (y = 0; y < nCY; ++y)
- for (x = 0; x < xmax; ++x)
- {
- int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + x;
- int nXPix = BitmapBytePad(pCursor->bits->width) * y + x;
-
- pAnd[nWinPix] = 0;
- if (fReverse)
- pXor[nWinPix] = reverse (~pCursor->bits->source[nXPix]);
- else
- pXor[nWinPix] = reverse (pCursor->bits->source[nXPix]);
- }
- }
- else
- {
- int x, y, xmax = bits_to_bytes(nCX);
- for (y = 0; y < nCY; ++y)
- for (x = 0; x < xmax; ++x)
- {
- int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + x;
- int nXPix = BitmapBytePad(pCursor->bits->width) * y + x;
-
- unsigned char mask = pCursor->bits->mask[nXPix];
- pAnd[nWinPix] = reverse (~mask);
- if (fReverse)
- pXor[nWinPix] = reverse (~pCursor->bits->source[nXPix] & mask);
- else
- pXor[nWinPix] = reverse (pCursor->bits->source[nXPix] & mask);
- }
- }
-
- /* prepare the pointers */
- hCursor = NULL;
- lpBits = NULL;
-
- /* We have a truecolor alpha-blended cursor and can use it! */
- if (pCursor->bits->argb)
- {
- winDebug("winLoadCursor: Trying truecolor alphablended cursor\n");
- memset (&bi, 0, sizeof (BITMAPV4HEADER));
- bi.bV4Size = sizeof(BITMAPV4HEADER);
- bi.bV4Width = pScreenPriv->cursor.sm_cx;
- bi.bV4Height = -(pScreenPriv->cursor.sm_cy); /* right-side up */
- bi.bV4Planes = 1;
- bi.bV4BitCount = 32;
- bi.bV4V4Compression = BI_BITFIELDS;
- bi.bV4RedMask = 0x00FF0000;
- bi.bV4GreenMask = 0x0000FF00;
- bi.bV4BlueMask = 0x000000FF;
- bi.bV4AlphaMask = 0xFF000000;
-
- lpBits = (unsigned long *) calloc (pScreenPriv->cursor.sm_cx*pScreenPriv->cursor.sm_cy,
- sizeof (unsigned long));
-
- if (lpBits)
- {
- for (y=0; y<nCY; y++)
- {
- unsigned long *src, *dst;
- src = &(pCursor->bits->argb[y * pCursor->bits->width]);
- dst = &(lpBits[y * pScreenPriv->cursor.sm_cx]);
- memcpy (dst, src, 4*nCX);
- }
- }
- } /* End if-truecolor-icon */
-
- if (!lpBits)
- {
- /* Bicolor, use a palettized DIB */
- winDebug("winLoadCursor: Trying two color cursor\n");
- pbmi = (BITMAPINFO*)&bi;
- memset (pbmi, 0, sizeof (BITMAPINFOHEADER));
- pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- pbmi->bmiHeader.biWidth = pScreenPriv->cursor.sm_cx;
- pbmi->bmiHeader.biHeight = -abs(pScreenPriv->cursor.sm_cy); /* right-side up */
- pbmi->bmiHeader.biPlanes = 1;
- pbmi->bmiHeader.biBitCount = 8;
- pbmi->bmiHeader.biCompression = BI_RGB;
- pbmi->bmiHeader.biSizeImage = 0;
- pbmi->bmiHeader.biClrUsed = 3;
- pbmi->bmiHeader.biClrImportant = 3;
- pbmi->bmiColors[0].rgbRed = 0; /* Empty */
- pbmi->bmiColors[0].rgbGreen = 0;
- pbmi->bmiColors[0].rgbBlue = 0;
- pbmi->bmiColors[0].rgbReserved = 0;
- pbmi->bmiColors[1].rgbRed = pCursor->backRed>>8; /* Background */
- pbmi->bmiColors[1].rgbGreen = pCursor->backGreen>>8;
- pbmi->bmiColors[1].rgbBlue = pCursor->backBlue>>8;
- pbmi->bmiColors[1].rgbReserved = 0;
- pbmi->bmiColors[2].rgbRed = pCursor->foreRed>>8; /* Foreground */
- pbmi->bmiColors[2].rgbGreen = pCursor->foreGreen>>8;
- pbmi->bmiColors[2].rgbBlue = pCursor->foreBlue>>8;
- pbmi->bmiColors[2].rgbReserved = 0;
-
- lpBits = (unsigned long *) calloc (pScreenPriv->cursor.sm_cx*pScreenPriv->cursor.sm_cy,
- sizeof (char));
-
- pCur = (unsigned char *)lpBits;
- if (lpBits)
- {
- for (y=0; y<pScreenPriv->cursor.sm_cy; y++)
- {
- for (x=0; x<pScreenPriv->cursor.sm_cx; x++)
- {
- if (x>=nCX || y>=nCY) /* Outside of X11 icon bounds */
- (*pCur++) = 0;
- else /* Within X11 icon bounds */
- {
- int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + (x/8);
-
- bit = pAnd[nWinPix];
- bit = bit & (1<<(7-(x&7)));
- if (!bit) /* Within the cursor mask? */
- {
- int nXPix = BitmapBytePad(pCursor->bits->width) * y + (x/8);
- bit = ~reverse(~pCursor->bits->source[nXPix] & pCursor->bits->mask[nXPix]);
- bit = bit & (1<<(7-(x&7)));
- if (bit) /* Draw foreground */
- (*pCur++) = 2;
- else /* Draw background */
- (*pCur++) = 1;
- }
- else /* Outside the cursor mask */
- (*pCur++) = 0;
- }
- } /* end for (x) */
- } /* end for (y) */
- } /* end if (lpbits) */
- }
-
- /* If one of the previous two methods gave us the bitmap we need, make a cursor */
- if (lpBits)
- {
- winDebug("winLoadCursor: Creating bitmap cursor: hotspot %d,%d\n",
- pCursor->bits->xhot, pCursor->bits->yhot);
-
- hAnd = NULL;
- hXor = NULL;
-
- hAnd = CreateBitmap (pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy, 1, 1, pAnd);
-
- hDC = GetDC (NULL);
- if (hDC)
- {
- hXor = CreateCompatibleBitmap (hDC, pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy);
- SetDIBits (hDC, hXor, 0, pScreenPriv->cursor.sm_cy, lpBits, (BITMAPINFO*)&bi, DIB_RGB_COLORS);
- ReleaseDC (NULL, hDC);
- }
- free (lpBits);
-
-
- if (hAnd && hXor)
- {
- ii.fIcon = FALSE;
- ii.xHotspot = pCursor->bits->xhot;
- ii.yHotspot = pCursor->bits->yhot;
- ii.hbmMask = hAnd;
- ii.hbmColor = hXor;
- hCursor = (HCURSOR) CreateIconIndirect( &ii );
-
- if (hCursor == NULL)
- winW32Error("winLoadCursor - CreateIconIndirect failed:");
- else
- {
- if (GetIconInfo(hCursor, &ii))
- {
- if (ii.fIcon)
- {
- winDebug("winLoadCursor: CreateIconIndirect returned no cursor. Trying again.\n");
-
- DestroyCursor(hCursor);
-
- ii.fIcon = FALSE;
- ii.xHotspot = pCursor->bits->xhot;
- ii.yHotspot = pCursor->bits->yhot;
- hCursor = (HCURSOR) CreateIconIndirect( &ii );
-
- if (hCursor == NULL)
- winW32Error("winLoadCursor - CreateIconIndirect failed:");
- }
- /* GetIconInfo creates new bitmaps. Destroy them again */
- if (ii.hbmMask)
- DeleteObject(ii.hbmMask);
- if (ii.hbmColor)
- DeleteObject(ii.hbmColor);
- }
- }
- }
-
- if (hAnd)
- DeleteObject (hAnd);
- if (hXor)
- DeleteObject (hXor);
- }
-
- if (!hCursor)
- {
- /* We couldn't make a color cursor for this screen, use
- black and white instead */
- hCursor = CreateCursor (g_hInstance,
- pCursor->bits->xhot, pCursor->bits->yhot,
- pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
- pAnd, pXor);
- if (hCursor == NULL)
- winW32Error("winLoadCursor - CreateCursor failed:");
- }
- free (pAnd);
- free (pXor);
-
- return hCursor;
-}
-
-/*
-===========================================================================
-
- Pointer sprite functions
-
-===========================================================================
-*/
-
-/*
- * winRealizeCursor
- * Convert the X cursor representation to native format if possible.
- */
-static Bool
-winRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- if(pCursor == NULL || pCursor->bits == NULL)
- return FALSE;
-
- /* FIXME: cache ARGB8888 representation? */
-
- return TRUE;
-}
-
-
-/*
- * winUnrealizeCursor
- * Free the storage space associated with a realized cursor.
- */
-static Bool
-winUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-
-/*
- * winSetCursor
- * Set the cursor sprite and position.
- */
-static void
-winSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- POINT ptCurPos, ptTemp;
- HWND hwnd;
- RECT rcClient;
- BOOL bInhibit;
- winScreenPriv(pScreen);
- winDebug("winSetCursor: cursor=%p\n", pCursor);
-
- /* Inhibit changing the cursor if the mouse is not in a client area */
- bInhibit = FALSE;
- if (GetCursorPos (&ptCurPos))
- {
- hwnd = WindowFromPoint (ptCurPos);
- if (hwnd)
- {
- if (GetClientRect (hwnd, &rcClient))
- {
- ptTemp.x = rcClient.left;
- ptTemp.y = rcClient.top;
- if (ClientToScreen (hwnd, &ptTemp))
- {
- rcClient.left = ptTemp.x;
- rcClient.top = ptTemp.y;
- ptTemp.x = rcClient.right;
- ptTemp.y = rcClient.bottom;
- if (ClientToScreen (hwnd, &ptTemp))
- {
- rcClient.right = ptTemp.x;
- rcClient.bottom = ptTemp.y;
- if (!PtInRect (&rcClient, ptCurPos))
- bInhibit = TRUE;
- }
- }
- }
- }
- }
-
- if (pCursor == NULL)
- {
- if (pScreenPriv->cursor.visible)
- {
- if (!bInhibit && g_fSoftwareCursor)
- ShowCursor (FALSE);
- pScreenPriv->cursor.visible = FALSE;
- }
- }
- else
- {
- if (pScreenPriv->cursor.handle)
- {
- if (!bInhibit)
- SetCursor (NULL);
- DestroyCursor (pScreenPriv->cursor.handle);
- pScreenPriv->cursor.handle = NULL;
- }
- pScreenPriv->cursor.handle =
- winLoadCursor (pScreen, pCursor, pScreen->myNum);
- winDebug("winSetCursor: handle=%p\n", pScreenPriv->cursor.handle);
-
- if (!bInhibit)
- SetCursor (pScreenPriv->cursor.handle);
-
- if (!pScreenPriv->cursor.visible)
- {
- if (!bInhibit && g_fSoftwareCursor)
- ShowCursor (TRUE);
- pScreenPriv->cursor.visible = TRUE;
- }
- }
-}
-
-
-/*
- * winMoveCursor
- * Move the cursor. This is a noop for us.
- */
-static void
-winMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
-}
-
-static Bool
-winDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
-{
- winScreenPriv(pScr);
- return pScreenPriv->cursor.spriteFuncs->DeviceCursorInitialize(pDev, pScr);
-}
-
-static void
-winDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
-{
- winScreenPriv(pScr);
- pScreenPriv->cursor.spriteFuncs->DeviceCursorCleanup(pDev, pScr);
-}
-
-static miPointerSpriteFuncRec winSpriteFuncsRec = {
- winRealizeCursor,
- winUnrealizeCursor,
- winSetCursor,
- winMoveCursor,
- winDeviceCursorInitialize,
- winDeviceCursorCleanup
-};
-
-
-/*
-===========================================================================
-
- Other screen functions
-
-===========================================================================
-*/
-
-/*
- * winCursorQueryBestSize
- * Handle queries for best cursor size
- */
-static void
-winCursorQueryBestSize (int class, unsigned short *width,
- unsigned short *height, ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
-
- if (class == CursorShape)
- {
- *width = pScreenPriv->cursor.sm_cx;
- *height = pScreenPriv->cursor.sm_cy;
- }
- else
- {
- if (pScreenPriv->cursor.QueryBestSize)
- (*pScreenPriv->cursor.QueryBestSize)(class, width, height, pScreen);
- }
-}
-
-/*
- * winInitCursor
- * Initialize cursor support
- */
-Bool
-winInitCursor (ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- miPointerScreenPtr pPointPriv;
- /* override some screen procedures */
- pScreenPriv->cursor.QueryBestSize = pScreen->QueryBestSize;
- pScreen->QueryBestSize = winCursorQueryBestSize;
-
- pPointPriv = (miPointerScreenPtr)
- dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
-
- if (pPointPriv)
- {
- pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs;
- pPointPriv->spriteFuncs = &winSpriteFuncsRec;
- }
- pScreenPriv->cursor.handle = NULL;
- pScreenPriv->cursor.visible = FALSE;
-
- pScreenPriv->cursor.sm_cx = GetSystemMetrics (SM_CXCURSOR);
- pScreenPriv->cursor.sm_cy = GetSystemMetrics (SM_CYCURSOR);
-
- return TRUE;
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winmsg.h"
+#include <cursorstr.h>
+#include <mipointrst.h>
+#include <servermd.h>
+#include "misc.h"
+
+#define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114)
+
+#ifdef _MSC_VER
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
+/*
+ * Local function prototypes
+ */
+
+static void
+ winPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
+
+static Bool
+ winCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y);
+
+static void
+ winCrossScreen(ScreenPtr pScreen, Bool fEntering);
+
+miPointerScreenFuncRec g_winPointerCursorFuncs = {
+ winCursorOffScreen,
+ winCrossScreen,
+ winPointerWarpCursor
+};
+
+static void
+winPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+ winScreenPriv(pScreen);
+ RECT rcClient;
+ static Bool s_fInitialWarp = TRUE;
+
+ /* Discard first warp call */
+ if (s_fInitialWarp) {
+ /* First warp moves mouse to center of window, just ignore it */
+
+ /* Don't ignore subsequent warps */
+ s_fInitialWarp = FALSE;
+
+ winDebug (
+ "winPointerWarpCursor - Discarding first warp: %d %d\n",
+ x, y);
+
+ return;
+ }
+
+ /*
+ Only update the Windows cursor position if root window is active,
+ or we are in a rootless mode
+ */
+ if ((pScreenPriv->hwndScreen == GetForegroundWindow())
+ || pScreenPriv->pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+ || pScreenPriv->pScreenInfo->fMultiWindow
+#endif
+ ) {
+ /* Get the client area coordinates */
+ GetClientRect(pScreenPriv->hwndScreen, &rcClient);
+
+ /* Translate the client area coords to screen coords */
+ MapWindowPoints(pScreenPriv->hwndScreen,
+ HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+
+ /*
+ * Update the Windows cursor position so that we don't
+ * immediately warp back to the current position.
+ */
+ SetCursorPos(rcClient.left + x, rcClient.top + y);
+ }
+
+ /* Call the mi warp procedure to do the actual warping in X. */
+ miPointerWarpCursor(pDev, pScreen, x, y);
+}
+
+static Bool
+winCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+static void
+winCrossScreen(ScreenPtr pScreen, Bool fEntering)
+{
+}
+
+static unsigned char
+reverse(unsigned char c)
+{
+ int i;
+ unsigned char ret = 0;
+
+ for (i = 0; i < 8; ++i) {
+ ret |= ((c >> i) & 1) << (7 - i);
+ }
+ return ret;
+}
+
+/*
+ * Convert X cursor to Windows cursor
+ * FIXME: Perhaps there are more smart code
+ */
+static HCURSOR
+winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
+{
+ winScreenPriv(pScreen);
+ HCURSOR hCursor = NULL;
+ unsigned char *pAnd;
+ unsigned char *pXor;
+ int nCX, nCY;
+ int nBytes;
+ double dForeY, dBackY;
+ BOOL fReverse;
+ HBITMAP hAnd, hXor;
+ ICONINFO ii;
+ unsigned char *pCur;
+ int x, y;
+ unsigned char bit;
+ HDC hDC;
+ BITMAPV4HEADER bi;
+ BITMAPINFO *pbmi;
+ unsigned long *lpBits;
+
+ winDebug("winLoadCursor: Win32: %dx%d X11: %dx%d hotspot: %d,%d\n",
+ pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
+ pCursor->bits->width, pCursor->bits->height,
+ pCursor->bits->xhot, pCursor->bits->yhot);
+
+ /* We can use only White and Black, so calc brightness of color
+ * Also check if the cursor is inverted */
+ dForeY = BRIGHTNESS(pCursor->fore);
+ dBackY = BRIGHTNESS(pCursor->back);
+ fReverse = dForeY < dBackY;
+
+ /* Check wether the X11 cursor is bigger than the win32 cursor */
+ if (pScreenPriv->cursor.sm_cx < pCursor->bits->width ||
+ pScreenPriv->cursor.sm_cy < pCursor->bits->height) {
+ ErrorF (
+ "winLoadCursor - Windows requires %dx%d cursor but X requires %dx%d\n",
+ pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
+ pCursor->bits->width, pCursor->bits->height);
+ }
+
+ /* Get the number of bytes required to store the whole cursor image
+ * This is roughly (sm_cx * sm_cy) / 8
+ * round up to 8 pixel boundary so we can convert whole bytes */
+ nBytes =
+ bits_to_bytes(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy;
+
+ /* Get the effective width and height */
+ nCX = min(pScreenPriv->cursor.sm_cx, pCursor->bits->width);
+ nCY = min(pScreenPriv->cursor.sm_cy, pCursor->bits->height);
+
+ /* Allocate memory for the bitmaps */
+ pAnd = malloc(nBytes);
+ memset(pAnd, 0xFF, nBytes);
+ pXor = calloc(1, nBytes);
+
+ /* Convert the X11 bitmap to a win32 bitmap
+ * The first is for an empty mask */
+ if (pCursor->bits->emptyMask) {
+ int x, y, xmax = bits_to_bytes(nCX);
+
+ for (y = 0; y < nCY; ++y)
+ for (x = 0; x < xmax; ++x) {
+ int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + x;
+ int nXPix = BitmapBytePad(pCursor->bits->width) * y + x;
+
+ pAnd[nWinPix] = 0;
+ if (fReverse)
+ pXor[nWinPix] = reverse(~pCursor->bits->source[nXPix]);
+ else
+ pXor[nWinPix] = reverse(pCursor->bits->source[nXPix]);
+ }
+ }
+ else {
+ int x, y, xmax = bits_to_bytes(nCX);
+
+ for (y = 0; y < nCY; ++y)
+ for (x = 0; x < xmax; ++x) {
+ int nWinPix = bits_to_bytes(pScreenPriv->cursor.sm_cx) * y + x;
+ int nXPix = BitmapBytePad(pCursor->bits->width) * y + x;
+
+ unsigned char mask = pCursor->bits->mask[nXPix];
+
+ pAnd[nWinPix] = reverse(~mask);
+ if (fReverse)
+ pXor[nWinPix] =
+ reverse(~pCursor->bits->source[nXPix] & mask);
+ else
+ pXor[nWinPix] =
+ reverse(pCursor->bits->source[nXPix] & mask);
+ }
+ }
+
+ /* prepare the pointers */
+ hCursor = NULL;
+ lpBits = NULL;
+
+ /* We have a truecolor alpha-blended cursor and can use it! */
+ if (pCursor->bits->argb) {
+ winDebug("winLoadCursor: Trying truecolor alphablended cursor\n");
+ memset(&bi, 0, sizeof(BITMAPV4HEADER));
+ bi.bV4Size = sizeof(BITMAPV4HEADER);
+ bi.bV4Width = pScreenPriv->cursor.sm_cx;
+ bi.bV4Height = -(pScreenPriv->cursor.sm_cy); /* right-side up */
+ bi.bV4Planes = 1;
+ bi.bV4BitCount = 32;
+ bi.bV4V4Compression = BI_BITFIELDS;
+ bi.bV4RedMask = 0x00FF0000;
+ bi.bV4GreenMask = 0x0000FF00;
+ bi.bV4BlueMask = 0x000000FF;
+ bi.bV4AlphaMask = 0xFF000000;
+
+ lpBits =
+ (unsigned long *) calloc(pScreenPriv->cursor.sm_cx *
+ pScreenPriv->cursor.sm_cy,
+ sizeof(unsigned long));
+
+ if (lpBits) {
+ for (y = 0; y < nCY; y++) {
+ unsigned long *src, *dst;
+
+ src = &(pCursor->bits->argb[y * pCursor->bits->width]);
+ dst = &(lpBits[y * pScreenPriv->cursor.sm_cx]);
+ memcpy(dst, src, 4 * nCX);
+ }
+ }
+ } /* End if-truecolor-icon */
+
+ if (!lpBits) {
+ /* Bicolor, use a palettized DIB */
+ winDebug("winLoadCursor: Trying two color cursor\n");
+ pbmi = (BITMAPINFO *) & bi;
+ memset(pbmi, 0, sizeof(BITMAPINFOHEADER));
+ pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ pbmi->bmiHeader.biWidth = pScreenPriv->cursor.sm_cx;
+ pbmi->bmiHeader.biHeight = -abs(pScreenPriv->cursor.sm_cy); /* right-side up */
+ pbmi->bmiHeader.biPlanes = 1;
+ pbmi->bmiHeader.biBitCount = 8;
+ pbmi->bmiHeader.biCompression = BI_RGB;
+ pbmi->bmiHeader.biSizeImage = 0;
+ pbmi->bmiHeader.biClrUsed = 3;
+ pbmi->bmiHeader.biClrImportant = 3;
+ pbmi->bmiColors[0].rgbRed = 0; /* Empty */
+ pbmi->bmiColors[0].rgbGreen = 0;
+ pbmi->bmiColors[0].rgbBlue = 0;
+ pbmi->bmiColors[0].rgbReserved = 0;
+ pbmi->bmiColors[1].rgbRed = pCursor->backRed >> 8; /* Background */
+ pbmi->bmiColors[1].rgbGreen = pCursor->backGreen >> 8;
+ pbmi->bmiColors[1].rgbBlue = pCursor->backBlue >> 8;
+ pbmi->bmiColors[1].rgbReserved = 0;
+ pbmi->bmiColors[2].rgbRed = pCursor->foreRed >> 8; /* Foreground */
+ pbmi->bmiColors[2].rgbGreen = pCursor->foreGreen >> 8;
+ pbmi->bmiColors[2].rgbBlue = pCursor->foreBlue >> 8;
+ pbmi->bmiColors[2].rgbReserved = 0;
+
+ lpBits =
+ (unsigned long *) calloc(pScreenPriv->cursor.sm_cx *
+ pScreenPriv->cursor.sm_cy, sizeof(char));
+
+ pCur = (unsigned char *) lpBits;
+ if (lpBits) {
+ for (y = 0; y < pScreenPriv->cursor.sm_cy; y++) {
+ for (x = 0; x < pScreenPriv->cursor.sm_cx; x++) {
+ if (x >= nCX || y >= nCY) /* Outside of X11 icon bounds */
+ (*pCur++) = 0;
+ else { /* Within X11 icon bounds */
+
+ int nWinPix =
+ bits_to_bytes(pScreenPriv->cursor.sm_cx) * y +
+ (x / 8);
+
+ bit = pAnd[nWinPix];
+ bit = bit & (1 << (7 - (x & 7)));
+ if (!bit) { /* Within the cursor mask? */
+ int nXPix =
+ BitmapBytePad(pCursor->bits->width) * y +
+ (x / 8);
+ bit =
+ ~reverse(~pCursor->bits->
+ source[nXPix] & pCursor->bits->
+ mask[nXPix]);
+ bit = bit & (1 << (7 - (x & 7)));
+ if (bit) /* Draw foreground */
+ (*pCur++) = 2;
+ else /* Draw background */
+ (*pCur++) = 1;
+ }
+ else /* Outside the cursor mask */
+ (*pCur++) = 0;
+ }
+ } /* end for (x) */
+ } /* end for (y) */
+ } /* end if (lpbits) */
+ }
+
+ /* If one of the previous two methods gave us the bitmap we need, make a cursor */
+ if (lpBits) {
+ winDebug("winLoadCursor: Creating bitmap cursor: hotspot %d,%d\n",
+ pCursor->bits->xhot, pCursor->bits->yhot);
+
+ hAnd = NULL;
+ hXor = NULL;
+
+ hAnd =
+ CreateBitmap(pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
+ 1, 1, pAnd);
+
+ hDC = GetDC(NULL);
+ if (hDC) {
+ hXor =
+ CreateCompatibleBitmap(hDC, pScreenPriv->cursor.sm_cx,
+ pScreenPriv->cursor.sm_cy);
+ SetDIBits(hDC, hXor, 0, pScreenPriv->cursor.sm_cy, lpBits,
+ (BITMAPINFO *) & bi, DIB_RGB_COLORS);
+ ReleaseDC(NULL, hDC);
+ }
+ free(lpBits);
+
+ if (hAnd && hXor) {
+ ii.fIcon = FALSE;
+ ii.xHotspot = pCursor->bits->xhot;
+ ii.yHotspot = pCursor->bits->yhot;
+ ii.hbmMask = hAnd;
+ ii.hbmColor = hXor;
+ hCursor = (HCURSOR) CreateIconIndirect(&ii);
+
+ if (hCursor == NULL)
+ winW32Error("winLoadCursor - CreateIconIndirect failed:");
+ else {
+ if (GetIconInfo(hCursor, &ii)) {
+ if (ii.fIcon) {
+ winDebug
+ ("winLoadCursor: CreateIconIndirect returned no cursor. Trying again.\n");
+ DestroyCursor(hCursor);
+
+ ii.fIcon = FALSE;
+ ii.xHotspot = pCursor->bits->xhot;
+ ii.yHotspot = pCursor->bits->yhot;
+ hCursor = (HCURSOR) CreateIconIndirect(&ii);
+
+ if (hCursor == NULL)
+ winW32Error(
+ "winLoadCursor - CreateIconIndirect failed:");
+ }
+ /* GetIconInfo creates new bitmaps. Destroy them again */
+ if (ii.hbmMask)
+ DeleteObject(ii.hbmMask);
+ if (ii.hbmColor)
+ DeleteObject(ii.hbmColor);
+ }
+ }
+ }
+
+ if (hAnd)
+ DeleteObject(hAnd);
+ if (hXor)
+ DeleteObject(hXor);
+ }
+
+ if (!hCursor) {
+ /* We couldn't make a color cursor for this screen, use
+ black and white instead */
+ hCursor = CreateCursor(g_hInstance,
+ pCursor->bits->xhot, pCursor->bits->yhot,
+ pScreenPriv->cursor.sm_cx,
+ pScreenPriv->cursor.sm_cy, pAnd, pXor);
+ if (hCursor == NULL)
+ winW32Error("winLoadCursor - CreateCursor failed:");
+ }
+ free(pAnd);
+ free(pXor);
+
+ return hCursor;
+}
+
+/*
+===========================================================================
+
+ Pointer sprite functions
+
+===========================================================================
+*/
+
+/*
+ * winRealizeCursor
+ * Convert the X cursor representation to native format if possible.
+ */
+static Bool
+winRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+{
+ if (pCursor == NULL || pCursor->bits == NULL)
+ return FALSE;
+
+ /* FIXME: cache ARGB8888 representation? */
+
+ return TRUE;
+}
+
+/*
+ * winUnrealizeCursor
+ * Free the storage space associated with a realized cursor.
+ */
+static Bool
+winUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+{
+ return TRUE;
+}
+
+/*
+ * winSetCursor
+ * Set the cursor sprite and position.
+ */
+static void
+winSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
+ int y)
+{
+ POINT ptCurPos, ptTemp;
+ HWND hwnd;
+ RECT rcClient;
+ BOOL bInhibit;
+
+ winScreenPriv(pScreen);
+ winDebug("winSetCursor: cursor=%p\n", pCursor);
+
+ /* Inhibit changing the cursor if the mouse is not in a client area */
+ bInhibit = FALSE;
+ if (GetCursorPos(&ptCurPos)) {
+ hwnd = WindowFromPoint(ptCurPos);
+ if (hwnd) {
+ if (GetClientRect(hwnd, &rcClient)) {
+ ptTemp.x = rcClient.left;
+ ptTemp.y = rcClient.top;
+ if (ClientToScreen(hwnd, &ptTemp)) {
+ rcClient.left = ptTemp.x;
+ rcClient.top = ptTemp.y;
+ ptTemp.x = rcClient.right;
+ ptTemp.y = rcClient.bottom;
+ if (ClientToScreen(hwnd, &ptTemp)) {
+ rcClient.right = ptTemp.x;
+ rcClient.bottom = ptTemp.y;
+ if (!PtInRect(&rcClient, ptCurPos))
+ bInhibit = TRUE;
+ }
+ }
+ }
+ }
+ }
+
+ if (pCursor == NULL) {
+ if (pScreenPriv->cursor.visible) {
+ if (!bInhibit && g_fSoftwareCursor)
+ ShowCursor(FALSE);
+ pScreenPriv->cursor.visible = FALSE;
+ }
+ }
+ else {
+ if (pScreenPriv->cursor.handle) {
+ if (!bInhibit)
+ SetCursor(NULL);
+ DestroyCursor(pScreenPriv->cursor.handle);
+ pScreenPriv->cursor.handle = NULL;
+ }
+ pScreenPriv->cursor.handle =
+ winLoadCursor(pScreen, pCursor, pScreen->myNum);
+ winDebug("winSetCursor: handle=%p\n", pScreenPriv->cursor.handle);
+
+ if (!bInhibit)
+ SetCursor(pScreenPriv->cursor.handle);
+
+ if (!pScreenPriv->cursor.visible) {
+ if (!bInhibit && g_fSoftwareCursor)
+ ShowCursor(TRUE);
+ pScreenPriv->cursor.visible = TRUE;
+ }
+ }
+}
+
+/*
+ * winMoveCursor
+ * Move the cursor. This is a noop for us.
+ */
+static void
+winMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+}
+
+static Bool
+winDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+ winScreenPriv(pScr);
+ return pScreenPriv->cursor.spriteFuncs->DeviceCursorInitialize(pDev, pScr);
+}
+
+static void
+winDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+ winScreenPriv(pScr);
+ pScreenPriv->cursor.spriteFuncs->DeviceCursorCleanup(pDev, pScr);
+}
+
+static miPointerSpriteFuncRec winSpriteFuncsRec = {
+ winRealizeCursor,
+ winUnrealizeCursor,
+ winSetCursor,
+ winMoveCursor,
+ winDeviceCursorInitialize,
+ winDeviceCursorCleanup
+};
+
+/*
+===========================================================================
+
+ Other screen functions
+
+===========================================================================
+*/
+
+/*
+ * winCursorQueryBestSize
+ * Handle queries for best cursor size
+ */
+static void
+winCursorQueryBestSize(int class, unsigned short *width,
+ unsigned short *height, ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+
+ if (class == CursorShape) {
+ *width = pScreenPriv->cursor.sm_cx;
+ *height = pScreenPriv->cursor.sm_cy;
+ }
+ else {
+ if (pScreenPriv->cursor.QueryBestSize)
+ (*pScreenPriv->cursor.QueryBestSize) (class, width, height,
+ pScreen);
+ }
+}
+
+/*
+ * winInitCursor
+ * Initialize cursor support
+ */
+Bool
+winInitCursor(ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ miPointerScreenPtr pPointPriv;
+
+ /* override some screen procedures */
+ pScreenPriv->cursor.QueryBestSize = pScreen->QueryBestSize;
+ pScreen->QueryBestSize = winCursorQueryBestSize;
+
+ pPointPriv = (miPointerScreenPtr)
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+
+ if (pPointPriv)
+ {
+ pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs;
+ pPointPriv->spriteFuncs = &winSpriteFuncsRec;
+ }
+ pScreenPriv->cursor.handle = NULL;
+ pScreenPriv->cursor.visible = FALSE;
+
+ pScreenPriv->cursor.sm_cx = GetSystemMetrics(SM_CXCURSOR);
+ pScreenPriv->cursor.sm_cy = GetSystemMetrics(SM_CYCURSOR);
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/windialogs.c b/xorg-server/hw/xwin/windialogs.c
index 0d5d7c641..bc6715066 100644
--- a/xorg-server/hw/xwin/windialogs.c
+++ b/xorg-server/hw/xwin/windialogs.c
@@ -39,88 +39,80 @@
#include <shellapi.h>
#include "winprefs.h"
-
/*
* References to external globals
*/
#ifdef XWIN_CLIPBOARD
-extern Bool g_fClipboardStarted;
+extern Bool g_fClipboardStarted;
#endif
/*
* Local function prototypes
*/
static wBOOL CALLBACK
-winExitDlgProc (HWND hDialog, UINT message,
- WPARAM wParam, LPARAM lParam);
+winExitDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);
static wBOOL CALLBACK
-winChangeDepthDlgProc (HWND hDialog, UINT message,
- WPARAM wParam, LPARAM lParam);
+winChangeDepthDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);
static wBOOL CALLBACK
-winAboutDlgProc (HWND hDialog, UINT message,
- WPARAM wParam, LPARAM lParam);
-
+winAboutDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);
static void
-winDrawURLWindow (LPARAM lParam);
+ winDrawURLWindow(LPARAM lParam);
static LRESULT CALLBACK
-winURLWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static void
-winOverrideURLButton (HWND hdlg, int id);
+ winOverrideURLButton(HWND hdlg, int id);
static void
-winUnoverrideURLButton (HWND hdlg, int id);
-
+ winUnoverrideURLButton(HWND hdlg, int id);
/*
* Owner-draw a button as a URL
*/
static void
-winDrawURLWindow (LPARAM lParam)
+winDrawURLWindow(LPARAM lParam)
{
- DRAWITEMSTRUCT *draw;
- char str[256];
- RECT rect;
- HFONT font;
- COLORREF crText;
-
- draw = (DRAWITEMSTRUCT *) lParam;
- GetWindowText (draw->hwndItem, str, sizeof(str));
- str[255] = 0;
- GetClientRect (draw->hwndItem, &rect);
-
- /* Color the button depending upon its state */
- if (draw->itemState & ODS_SELECTED)
- crText = RGB(128+64,0,0);
- else if (draw->itemState & ODS_FOCUS)
- crText = RGB(0,128+64,0);
- else
- crText = RGB(0,0,128+64);
- SetTextColor (draw->hDC, crText);
-
- /* Create font 8 high, standard dialog font */
- font = CreateFont (-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
- 0, 0, 0, 0, 0, "MS Sans Serif");
- if (!font)
- {
- ErrorF ("winDrawURLWindow: Unable to create URL font, bailing.\n");
- return;
+ DRAWITEMSTRUCT *draw;
+ char str[256];
+ RECT rect;
+ HFONT font;
+ COLORREF crText;
+
+ draw = (DRAWITEMSTRUCT *) lParam;
+ GetWindowText(draw->hwndItem, str, sizeof(str));
+ str[255] = 0;
+ GetClientRect(draw->hwndItem, &rect);
+
+ /* Color the button depending upon its state */
+ if (draw->itemState & ODS_SELECTED)
+ crText = RGB(128 + 64, 0, 0);
+ else if (draw->itemState & ODS_FOCUS)
+ crText = RGB(0, 128 + 64, 0);
+ else
+ crText = RGB(0, 0, 128 + 64);
+ SetTextColor(draw->hDC, crText);
+
+ /* Create font 8 high, standard dialog font */
+ font = CreateFont(-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
+ 0, 0, 0, 0, 0, "MS Sans Serif");
+ if (!font) {
+ ErrorF("winDrawURLWindow: Unable to create URL font, bailing.\n");
+ return;
}
- /* Draw it */
- SetBkMode (draw->hDC, OPAQUE);
- SelectObject (draw->hDC, font);
- DrawText (draw->hDC, str, strlen (str),&rect,DT_LEFT | DT_VCENTER);
- /* Delete the created font, replace it with stock font */
- DeleteObject (SelectObject (draw->hDC, GetStockObject (ANSI_VAR_FONT)));
+ /* Draw it */
+ SetBkMode(draw->hDC, OPAQUE);
+ SelectObject(draw->hDC, font);
+ DrawText(draw->hDC, str, strlen(str), &rect, DT_LEFT | DT_VCENTER);
+ /* Delete the created font, replace it with stock font */
+ DeleteObject(SelectObject(draw->hDC, GetStockObject(ANSI_VAR_FONT)));
}
-
/*
* WndProc for overridden buttons
*/
@@ -128,48 +120,47 @@ winDrawURLWindow (LPARAM lParam)
static LRESULT CALLBACK
winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC origCB = NULL;
- HCURSOR cursor;
-
- /* If it's a SetCursor message, tell it to the hand */
- if (msg==WM_SETCURSOR) {
- cursor = LoadCursor (NULL, IDC_HAND);
- if (cursor)
- SetCursor (cursor);
- return TRUE;
- }
- origCB = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- /* Otherwise fall through to original WndProc */
- if (origCB)
- return CallWindowProc (origCB, hwnd, msg, wParam, lParam);
- else
- return FALSE;
+ WNDPROC origCB = NULL;
+ HCURSOR cursor;
+
+ /* If it's a SetCursor message, tell it to the hand */
+ if (msg == WM_SETCURSOR) {
+ cursor = LoadCursor(NULL, IDC_HAND);
+ if (cursor)
+ SetCursor(cursor);
+ return TRUE;
+ }
+ origCB = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ /* Otherwise fall through to original WndProc */
+ if (origCB)
+ return CallWindowProc(origCB, hwnd, msg, wParam, lParam);
+ else
+ return FALSE;
}
-
/*
* Register and unregister the custom WndProc
*/
static void
-winOverrideURLButton (HWND hwnd, int id)
+winOverrideURLButton(HWND hwnd, int id)
{
- WNDPROC origCB;
- origCB = (WNDPROC)SetWindowLongPtr(GetDlgItem (hwnd, id),
- GWLP_WNDPROC, (LONG_PTR)winURLWndProc);
- SetWindowLongPtr(GetDlgItem (hwnd, id), GWLP_USERDATA, (LONG_PTR)origCB);
+ WNDPROC origCB;
+
+ origCB = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwnd, id),
+ GWLP_WNDPROC, (LONG_PTR) winURLWndProc);
+ SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_USERDATA, (LONG_PTR) origCB);
}
static void
-winUnoverrideURLButton (HWND hwnd, int id)
+winUnoverrideURLButton(HWND hwnd, int id)
{
- WNDPROC origCB;
- origCB = (WNDPROC)SetWindowLongPtr(GetDlgItem (hwnd, id),
- GWLP_USERDATA, 0);
- if (origCB)
- SetWindowLongPtr(GetDlgItem (hwnd, id), GWLP_WNDPROC, (LONG_PTR)origCB);
-}
+ WNDPROC origCB;
+ origCB = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_USERDATA, 0);
+ if (origCB)
+ SetWindowLongPtr(GetDlgItem(hwnd, id), GWLP_WNDPROC, (LONG_PTR) origCB);
+}
/*
* Center a dialog window in the desktop window
@@ -177,94 +168,93 @@ winUnoverrideURLButton (HWND hwnd, int id)
*/
static void
-winInitDialog (HWND hwndDlg)
+winInitDialog(HWND hwndDlg)
{
- HWND hwndDesk;
- RECT rc, rcDlg, rcDesk;
- HICON hIcon, hIconSmall;
-
- hwndDesk = GetParent (hwndDlg);
- if (!hwndDesk || IsIconic (hwndDesk))
- hwndDesk = GetDesktopWindow ();
-
- /* Remove minimize and maximize buttons */
- SetWindowLongPtr(hwndDlg, GWL_STYLE,
- GetWindowLongPtr(hwndDlg, GWL_STYLE)
- & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
-
- /* Set Window not to show in the task bar */
- SetWindowLongPtr(hwndDlg, GWL_EXSTYLE,
- GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW );
-
- /* Center dialog window in the screen. Not done for multi-monitor systems, where
- * it is likely to end up split across the screens. In that case, it appears
- * near the Tray icon.
- */
- if (GetSystemMetrics(SM_CMONITORS)>1) {
- /* Still need to refresh the frame change. */
+ HWND hwndDesk;
+ RECT rc, rcDlg, rcDesk;
+ HICON hIcon, hIconSmall;
+
+ hwndDesk = GetParent(hwndDlg);
+ if (!hwndDesk || IsIconic(hwndDesk))
+ hwndDesk = GetDesktopWindow();
+
+ /* Remove minimize and maximize buttons */
+ SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE)
+ & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
+
+ /* Set Window not to show in the task bar */
+ SetWindowLongPtr(hwndDlg, GWL_EXSTYLE,
+ GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW);
+
+ /* Center dialog window in the screen. Not done for multi-monitor systems, where
+ * it is likely to end up split across the screens. In that case, it appears
+ * near the Tray icon.
+ */
+ if (GetSystemMetrics(SM_CMONITORS) > 1) {
+ /* Still need to refresh the frame change. */
SetWindowPos (hwndDlg, HWND_TOP, 0,0,0,0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
- } else {
- GetWindowRect (hwndDesk, &rcDesk);
- GetWindowRect (hwndDlg, &rcDlg);
- CopyRect (&rc, &rcDesk);
-
- OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top);
- OffsetRect (&rc, -rc.left, -rc.top);
- OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom);
-
- SetWindowPos (hwndDlg,
- HWND_TOPMOST,
- rcDesk.left + (rc.right / 2),
- rcDesk.top + (rc.bottom / 2),
- 0, 0,
- SWP_NOSIZE | SWP_FRAMECHANGED);
- }
+ }
+ else {
+ GetWindowRect(hwndDesk, &rcDesk);
+ GetWindowRect(hwndDlg, &rcDlg);
+ CopyRect(&rc, &rcDesk);
+
+ OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
+ OffsetRect(&rc, -rc.left, -rc.top);
+ OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
+
+ SetWindowPos(hwndDlg,
+ HWND_TOPMOST,
+ rcDesk.left + (rc.right / 2),
+ rcDesk.top + (rc.bottom / 2),
+ 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED);
+ }
#ifdef XWIN_MULTIWINDOW
- if (g_hIconX) hIcon=g_hIconX;
- else
+ if (g_hIconX)
+ hIcon = g_hIconX;
+ else
#endif
- hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
+ hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
#ifdef XWIN_MULTIWINDOW
- if (g_hSmallIconX) hIconSmall=g_hSmallIconX;
- else
+ if (g_hSmallIconX)
+ hIconSmall = g_hSmallIconX;
+ else
#endif
- hIconSmall = LoadImage (g_hInstance,
- MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
- GetSystemMetrics(SM_CXSMICON),
- GetSystemMetrics(SM_CYSMICON),
- LR_SHARED);
-
- PostMessage (hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
- PostMessage (hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
-}
+ hIconSmall = LoadImage(g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), LR_SHARED);
+ PostMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
+ PostMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
+}
int
GetLiveClients (winPrivScreenPtr pScreenPriv)
{
- int i;
- int liveClients = 0;
+ int i;
+ int liveClients = 0;
- /* Count up running clients (clients[0] is serverClient) */
- for (i = 1; i < currentMaxClients; i++)
- if (clients[i] != NullClient)
- liveClients++;
+ /* Count up running clients (clients[0] is serverClient) */
+ for (i = 1; i < currentMaxClients; i++)
+ if (clients[i] != NullClient)
+ liveClients++;
#if defined(XWIN_MULTIWINDOW)
- /* Count down server internal clients */
- if (pScreenPriv->pScreenInfo->fMultiWindow)
- liveClients -= 2; /* multiwindow window manager & XMsgProc */
+ /* Count down server internal clients */
+ if (pScreenPriv->pScreenInfo->fMultiWindow)
+ liveClients -= 2; /* multiwindow window manager & XMsgProc */
#endif
#if defined(XWIN_CLIPBOARD)
- if (g_fClipboardStarted)
- liveClients--; /* clipboard manager */
+ if (g_fClipboardStarted)
+ liveClients--; /* clipboard manager */
#endif
- /* A user reported that this sometimes drops below zero. just eye-candy. */
- if (liveClients < 0)
- liveClients = 0;
+ /* A user reported that this sometimes drops below zero. just eye-candy. */
+ if (liveClients < 0)
+ liveClients = 0;
pScreenPriv->iConnectedClients = liveClients;
@@ -280,488 +270,445 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
{
int liveClients = GetLiveClients(pScreenPriv);
- /* Don't show the exit confirmation dialog if SilentExit & no clients,
- or ForceExit, is enabled */
- if ((pref.fSilentExit && liveClients <= 0) || pref.fForceExit)
- {
- if (g_hDlgExit != NULL)
- {
- DestroyWindow (g_hDlgExit);
- g_hDlgExit = NULL;
- }
- PostMessage (pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
- return;
+ /* Don't show the exit confirmation dialog if SilentExit & no clients,
+ or ForceExit, is enabled */
+ if ((pref.fSilentExit && liveClients <= 0) || pref.fForceExit) {
+ if (g_hDlgExit != NULL) {
+ DestroyWindow(g_hDlgExit);
+ g_hDlgExit = NULL;
+ }
+ PostMessage(pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
+ return;
}
- /* Check if dialog already exists */
- if (g_hDlgExit != NULL)
- {
- /* Dialog box already exists, display it */
- ShowWindow (g_hDlgExit, SW_SHOWDEFAULT);
+ /* Check if dialog already exists */
+ if (g_hDlgExit != NULL) {
+ /* Dialog box already exists, display it */
+ ShowWindow(g_hDlgExit, SW_SHOWDEFAULT);
- /* User has lost the dialog. Show them where it is. */
- SetForegroundWindow (g_hDlgExit);
+ /* User has lost the dialog. Show them where it is. */
+ SetForegroundWindow(g_hDlgExit);
- return;
+ return;
}
- /* Create dialog box */
- g_hDlgExit = CreateDialogParam (g_hInstance,
- "EXIT_DIALOG",
- pScreenPriv->hwndScreen,
- winExitDlgProc,
- (int) pScreenPriv);
-
- /* Show the dialog box */
- ShowWindow (g_hDlgExit, SW_SHOW);
-
- /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
- SetForegroundWindow (g_hDlgExit);
-
- /* Set focus to the Cancel button */
- PostMessage (g_hDlgExit, WM_NEXTDLGCTL,
- (WPARAM)GetDlgItem (g_hDlgExit, IDCANCEL), TRUE);
+ /* Create dialog box */
+ g_hDlgExit = CreateDialogParam(g_hInstance,
+ "EXIT_DIALOG",
+ pScreenPriv->hwndScreen,
+ winExitDlgProc, (int) pScreenPriv);
+
+ /* Show the dialog box */
+ ShowWindow(g_hDlgExit, SW_SHOW);
+
+ /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
+ SetForegroundWindow(g_hDlgExit);
+
+ /* Set focus to the Cancel button */
+ PostMessage(g_hDlgExit, WM_NEXTDLGCTL,
+ (WPARAM) GetDlgItem(g_hDlgExit, IDCANCEL), TRUE);
}
#define CONNECTED_CLIENTS_FORMAT "There %s currently %d client%s connected."
-
/*
* Exit dialog window procedure
*/
static wBOOL CALLBACK
-winExitDlgProc (HWND hDialog, UINT message,
- WPARAM wParam, LPARAM lParam)
+winExitDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam)
{
- static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winPrivScreenPtr s_pScreenPriv = NULL;
- /* Branch on message type */
- switch (message)
- {
+ /* Branch on message type */
+ switch (message) {
case WM_INITDIALOG:
- {
- char *pszConnectedClients;
-
- /* Store pointers to private structures for future use */
- s_pScreenPriv = (winPrivScreenPtr) lParam;
-
- winInitDialog (hDialog);
-
- /* Format the connected clients string */
- if (asprintf (&pszConnectedClients, CONNECTED_CLIENTS_FORMAT,
- (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are",
- s_pScreenPriv->iConnectedClients,
- (s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1)
- return TRUE;
-
-
-
- /* Set the number of connected clients */
- SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED),
- pszConnectedClients);
- free(pszConnectedClients);
- }
- return TRUE;
+ {
+ char *pszConnectedClients;
+
+ /* Store pointers to private structures for future use */
+ s_pScreenPriv = (winPrivScreenPtr) lParam;
+
+ winInitDialog(hDialog);
+
+ /* Format the connected clients string */
+ if (asprintf(&pszConnectedClients, CONNECTED_CLIENTS_FORMAT,
+ (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are",
+ s_pScreenPriv->iConnectedClients,
+ (s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1)
+ return TRUE;
+
+ /* Set the number of connected clients */
+ SetWindowText(GetDlgItem(hDialog, IDC_CLIENTS_CONNECTED),
+ pszConnectedClients);
+ free(pszConnectedClients);
+ }
+ return TRUE;
case WM_COMMAND:
- switch (LOWORD (wParam))
- {
- case IDOK:
- /* Send message to call the GiveUp function */
- PostMessage (s_pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
- DestroyWindow (g_hDlgExit);
- g_hDlgExit = NULL;
-
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- return TRUE;
-
- case IDCANCEL:
- DestroyWindow (g_hDlgExit);
- g_hDlgExit = NULL;
-
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- return TRUE;
- }
- break;
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ /* Send message to call the GiveUp function */
+ PostMessage(s_pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
+ DestroyWindow(g_hDlgExit);
+ g_hDlgExit = NULL;
+
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
+
+ case IDCANCEL:
+ DestroyWindow(g_hDlgExit);
+ g_hDlgExit = NULL;
+
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
+ }
+ break;
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
- /* Show the cursor if it is hidden */
- if (g_fSoftwareCursor && !g_fCursor)
- {
- g_fCursor = TRUE;
- ShowCursor (TRUE);
- }
- return TRUE;
+ /* Show the cursor if it is hidden */
+ if (g_fSoftwareCursor && !g_fCursor) {
+ g_fCursor = TRUE;
+ ShowCursor(TRUE);
+ }
+ return TRUE;
case WM_CLOSE:
- DestroyWindow (g_hDlgExit);
- g_hDlgExit = NULL;
+ DestroyWindow(g_hDlgExit);
+ g_hDlgExit = NULL;
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- return TRUE;
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
}
- return FALSE;
+ return FALSE;
}
-
/*
* Display the Depth Change dialog box
*/
void
-winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv)
+winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv)
{
- /* Check if dialog already exists */
- if (g_hDlgDepthChange != NULL)
- {
- /* Dialog box already exists, display it */
- ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT);
+ /* Check if dialog already exists */
+ if (g_hDlgDepthChange != NULL) {
+ /* Dialog box already exists, display it */
+ ShowWindow(g_hDlgDepthChange, SW_SHOWDEFAULT);
- /* User has lost the dialog. Show them where it is. */
- SetForegroundWindow (g_hDlgDepthChange);
+ /* User has lost the dialog. Show them where it is. */
+ SetForegroundWindow(g_hDlgDepthChange);
- return;
+ return;
}
- /*
- * Display a notification to the user that the visual
- * will not be displayed until the Windows display depth
- * is restored to the original value.
- */
- g_hDlgDepthChange = CreateDialogParam (g_hInstance,
- "DEPTH_CHANGE_BOX",
- pScreenPriv->hwndScreen,
- winChangeDepthDlgProc,
- (int) pScreenPriv);
- /* Show the dialog box */
- ShowWindow (g_hDlgDepthChange, SW_SHOW);
-
- winDebug ("winDisplayDepthChangeDialog - DialogBox returned: %d\n",
- (int) g_hDlgDepthChange);
- winDebug ("winDisplayDepthChangeDialog - GetLastError: %d\n",
- (int) GetLastError ());
-
- /* Minimize the display window */
- ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE);
+ /*
+ * Display a notification to the user that the visual
+ * will not be displayed until the Windows display depth
+ * is restored to the original value.
+ */
+ g_hDlgDepthChange = CreateDialogParam(g_hInstance,
+ "DEPTH_CHANGE_BOX",
+ pScreenPriv->hwndScreen,
+ winChangeDepthDlgProc,
+ (int) pScreenPriv);
+ /* Show the dialog box */
+ ShowWindow(g_hDlgDepthChange, SW_SHOW);
+
+ winDebug ("winDisplayDepthChangeDialog - DialogBox returned: %d\n",
+ (int) g_hDlgDepthChange);
+ winDebug ("winDisplayDepthChangeDialog - GetLastError: %d\n",
+ (int) GetLastError());
+
+ /* Minimize the display window */
+ ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE);
}
-
/*
* Process messages for the dialog that is displayed for
* disruptive screen depth changes.
*/
static wBOOL CALLBACK
-winChangeDepthDlgProc (HWND hwndDialog, UINT message,
- WPARAM wParam, LPARAM lParam)
+winChangeDepthDlgProc(HWND hwndDialog, UINT message,
+ WPARAM wParam, LPARAM lParam)
{
- static winPrivScreenPtr s_pScreenPriv = NULL;
- static winScreenInfo *s_pScreenInfo = NULL;
- static ScreenPtr s_pScreen = NULL;
+ static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winScreenInfo *s_pScreenInfo = NULL;
+ static ScreenPtr s_pScreen = NULL;
- winDebug ("winChangeDepthDlgProc\n");
+ winDebug("winChangeDepthDlgProc\n");
- /* Branch on message type */
- switch (message)
- {
+ /* Branch on message type */
+ switch (message) {
case WM_INITDIALOG:
- winDebug ("winChangeDepthDlgProc - WM_INITDIALOG\n");
+ winDebug("winChangeDepthDlgProc - WM_INITDIALOG\n");
- /* Store pointers to private structures for future use */
- s_pScreenPriv = (winPrivScreenPtr) lParam;
- s_pScreenInfo = s_pScreenPriv->pScreenInfo;
- s_pScreen = s_pScreenInfo->pScreen;
+ /* Store pointers to private structures for future use */
+ s_pScreenPriv = (winPrivScreenPtr) lParam;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
- winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %08x, "
- "s_pScreenInfo: %08x, s_pScreen: %08x\n",
- s_pScreenPriv, s_pScreenInfo, s_pScreen);
+ winDebug("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %08x, "
+ "s_pScreenInfo: %08x, s_pScreen: %08x\n",
+ s_pScreenPriv, s_pScreenInfo, s_pScreen);
- winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
- "current bpp: %d\n",
- s_pScreenInfo->dwBPP,
- GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
+ winDebug("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
+ "current bpp: %d\n",
+ s_pScreenInfo->dwBPP,
+ GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
- winInitDialog( hwndDialog );
+ winInitDialog(hwndDialog);
- return TRUE;
+ return TRUE;
case WM_DISPLAYCHANGE:
- winDebug ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
- "new bpp: %d\n",
- s_pScreenInfo->dwBPP,
- GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
+ winDebug("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
+ "new bpp: %d\n",
+ s_pScreenInfo->dwBPP,
+ GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
- /* Dismiss the dialog if the display returns to the original depth */
- if (GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL) == s_pScreenInfo->dwBPP)
- {
- winDebug ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n");
+ /* Dismiss the dialog if the display returns to the original depth */
+ if (GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL) ==
+ s_pScreenInfo->dwBPP) {
+ winDebug ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n");
- /* Depth has been restored, dismiss dialog */
- DestroyWindow (g_hDlgDepthChange);
- g_hDlgDepthChange = NULL;
+ /* Depth has been restored, dismiss dialog */
+ DestroyWindow(g_hDlgDepthChange);
+ g_hDlgDepthChange = NULL;
- /* Flag that we have a valid screen depth */
- s_pScreenPriv->fBadDepth = FALSE;
- }
- return TRUE;
+ /* Flag that we have a valid screen depth */
+ s_pScreenPriv->fBadDepth = FALSE;
+ }
+ return TRUE;
case WM_COMMAND:
- switch (LOWORD (wParam))
- {
- case IDOK:
- case IDCANCEL:
- ErrorF ("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
-
- /*
- * User dismissed the dialog, hide it until the
- * display mode is restored.
- */
- ShowWindow (g_hDlgDepthChange, SW_HIDE);
- return TRUE;
- }
- break;
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ case IDCANCEL:
+ ErrorF("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
+
+ /*
+ * User dismissed the dialog, hide it until the
+ * display mode is restored.
+ */
+ ShowWindow(g_hDlgDepthChange, SW_HIDE);
+ return TRUE;
+ }
+ break;
case WM_CLOSE:
- winDebug ("winChangeDepthDlgProc - WM_CLOSE\n");
+ winDebug ("winChangeDepthDlgProc - WM_CLOSE\n");
- DestroyWindow (g_hDlgAbout);
- g_hDlgAbout = NULL;
+ DestroyWindow(g_hDlgAbout);
+ g_hDlgAbout = NULL;
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- return TRUE;
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
}
- return FALSE;
+ return FALSE;
}
-
/*
* Display the About dialog box
*/
void
-winDisplayAboutDialog (winPrivScreenPtr pScreenPriv)
+winDisplayAboutDialog(winPrivScreenPtr pScreenPriv)
{
- /* Check if dialog already exists */
- if (g_hDlgAbout != NULL)
- {
- /* Dialog box already exists, display it */
- ShowWindow (g_hDlgAbout, SW_SHOWDEFAULT);
+ /* Check if dialog already exists */
+ if (g_hDlgAbout != NULL) {
+ /* Dialog box already exists, display it */
+ ShowWindow(g_hDlgAbout, SW_SHOWDEFAULT);
- /* User has lost the dialog. Show them where it is. */
- SetForegroundWindow (g_hDlgAbout);
+ /* User has lost the dialog. Show them where it is. */
+ SetForegroundWindow(g_hDlgAbout);
- return;
+ return;
}
- /*
- * Display the about box
- */
- g_hDlgAbout = CreateDialogParam (g_hInstance,
- "ABOUT_BOX",
- pScreenPriv->hwndScreen,
- winAboutDlgProc,
- (int) pScreenPriv);
-
- /* Show the dialog box */
- ShowWindow (g_hDlgAbout, SW_SHOW);
-
- /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
- SetForegroundWindow (g_hDlgAbout);
-
- /* Set focus to the OK button */
- PostMessage (g_hDlgAbout, WM_NEXTDLGCTL,
- (WPARAM)GetDlgItem (g_hDlgAbout, IDOK), TRUE);
-}
+ /*
+ * Display the about box
+ */
+ g_hDlgAbout = CreateDialogParam(g_hInstance,
+ "ABOUT_BOX",
+ pScreenPriv->hwndScreen,
+ winAboutDlgProc, (int) pScreenPriv);
+
+ /* Show the dialog box */
+ ShowWindow(g_hDlgAbout, SW_SHOW);
+ /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
+ SetForegroundWindow(g_hDlgAbout);
+
+ /* Set focus to the OK button */
+ PostMessage(g_hDlgAbout, WM_NEXTDLGCTL,
+ (WPARAM) GetDlgItem(g_hDlgAbout, IDOK), TRUE);
+}
/*
* Process messages for the about dialog.
*/
static wBOOL CALLBACK
-winAboutDlgProc (HWND hwndDialog, UINT message,
- WPARAM wParam, LPARAM lParam)
+winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam)
{
- static winPrivScreenPtr s_pScreenPriv = NULL;
- static winScreenInfo *s_pScreenInfo = NULL;
- static ScreenPtr s_pScreen = NULL;
+ static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winScreenInfo *s_pScreenInfo = NULL;
+ static ScreenPtr s_pScreen = NULL;
- winDebug ("winAboutDlgProc\n");
+ winDebug("winAboutDlgProc\n");
- /* Branch on message type */
- switch (message)
- {
+ /* Branch on message type */
+ switch (message) {
case WM_INITDIALOG:
- winDebug ("winAboutDlgProc - WM_INITDIALOG\n");
+ winDebug("winAboutDlgProc - WM_INITDIALOG\n");
- /* Store pointers to private structures for future use */
- s_pScreenPriv = (winPrivScreenPtr) lParam;
- s_pScreenInfo = s_pScreenPriv->pScreenInfo;
- s_pScreen = s_pScreenInfo->pScreen;
+ /* Store pointers to private structures for future use */
+ s_pScreenPriv = (winPrivScreenPtr) lParam;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
- winInitDialog (hwndDialog);
+ winInitDialog(hwndDialog);
- /* Override the URL buttons */
- winOverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
- winOverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
- winOverrideURLButton (hwndDialog, ID_ABOUT_UG);
- winOverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
+ /* Override the URL buttons */
+ winOverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG);
+ winOverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);
+ winOverrideURLButton(hwndDialog, ID_ABOUT_UG);
+ winOverrideURLButton(hwndDialog, ID_ABOUT_FAQ);
- return TRUE;
+ return TRUE;
case WM_DRAWITEM:
- /* Draw the URL buttons as needed */
- winDrawURLWindow (lParam);
- return TRUE;
+ /* Draw the URL buttons as needed */
+ winDrawURLWindow(lParam);
+ return TRUE;
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
- /* Show the cursor if it is hidden */
- if (g_fSoftwareCursor && !g_fCursor)
- {
- g_fCursor = TRUE;
- ShowCursor (TRUE);
- }
- return TRUE;
+ /* Show the cursor if it is hidden */
+ if (g_fSoftwareCursor && !g_fCursor) {
+ g_fCursor = TRUE;
+ ShowCursor(TRUE);
+ }
+ return TRUE;
case WM_COMMAND:
- switch (LOWORD (wParam))
- {
- case IDOK:
- case IDCANCEL:
- winDebug ("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ case IDCANCEL:
+ winDebug ("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
+
+ DestroyWindow(g_hDlgAbout);
+ g_hDlgAbout = NULL;
- DestroyWindow (g_hDlgAbout);
- g_hDlgAbout = NULL;
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ /* Restore window procedures for URL buttons */
+ winUnoverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG);
+ winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);
+ winUnoverrideURLButton(hwndDialog, ID_ABOUT_UG);
+ winUnoverrideURLButton(hwndDialog, ID_ABOUT_FAQ);
- /* Restore window procedures for URL buttons */
- winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
- winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
- winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG);
- winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
+ return TRUE;
- return TRUE;
+ case ID_ABOUT_CHANGELOG:
+ {
+ int iReturn;
- case ID_ABOUT_CHANGELOG:
- {
- int iReturn;
#ifdef __CYGWIN__
- const char * pszCygPath = "/usr/X11R6/share/doc/"
- "xorg-x11-xwin/changelog.html";
- char pszWinPath[MAX_PATH + 1];
+ const char *pszCygPath = "/usr/X11R6/share/doc/"
+ "xorg-x11-xwin/changelog.html";
+ char pszWinPath[MAX_PATH + 1];
- /* Convert the POSIX path to a Win32 path */
- cygwin_conv_to_win32_path (pszCygPath, pszWinPath);
+ /* Convert the POSIX path to a Win32 path */
+ cygwin_conv_to_win32_path(pszCygPath, pszWinPath);
#else
- const char * pszWinPath = "http://x.cygwin.com/"
- "devel/server/changelog.html";
+ const char *pszWinPath = "http://x.cygwin.com/"
+ "devel/server/changelog.html";
#endif
-
- iReturn = (int)ShellExecute (NULL,
- "open",
- pszWinPath,
- NULL,
- NULL,
- SW_MAXIMIZE);
- if (iReturn < 32)
- {
- ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - "
- "ShellExecute failed: %d\n",
- iReturn);
- }
- }
- return TRUE;
-
- case ID_ABOUT_WEBSITE:
- {
- const char * pszPath = __VENDORDWEBSUPPORT__;
- int iReturn;
-
- iReturn = (int)ShellExecute (NULL,
- "open",
- pszPath,
- NULL,
- NULL,
- SW_MAXIMIZE);
- if (iReturn < 32)
- {
- ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - "
- "ShellExecute failed: %d\n",
- iReturn);
- }
- }
- return TRUE;
-
- case ID_ABOUT_UG:
- {
- const char * pszPath = "http://x.cygwin.com/docs/ug/";
- int iReturn;
-
- iReturn = (int)ShellExecute (NULL,
- "open",
- pszPath,
- NULL,
- NULL,
- SW_MAXIMIZE);
- if (iReturn < 32)
- {
- ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - "
- "ShellExecute failed: %d\n",
- iReturn);
- }
- }
- return TRUE;
-
- case ID_ABOUT_FAQ:
- {
- const char * pszPath = "http://x.cygwin.com/docs/faq/";
- int iReturn;
-
- iReturn = (int)ShellExecute (NULL,
- "open",
- pszPath,
- NULL,
- NULL,
- SW_MAXIMIZE);
- if (iReturn < 32)
- {
- ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - "
- "ShellExecute failed: %d\n",
- iReturn);
- }
- }
- return TRUE;
- }
- break;
+
+ iReturn = (int) ShellExecute(NULL,
+ "open",
+ pszWinPath, NULL, NULL, SW_MAXIMIZE);
+ if (iReturn < 32) {
+ ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - "
+ "ShellExecute failed: %d\n", iReturn);
+ }
+ }
+ return TRUE;
+
+ case ID_ABOUT_WEBSITE:
+ {
+ const char *pszPath = __VENDORDWEBSUPPORT__;
+ int iReturn;
+
+ iReturn = (int) ShellExecute(NULL,
+ "open",
+ pszPath, NULL, NULL, SW_MAXIMIZE);
+ if (iReturn < 32) {
+ ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - "
+ "ShellExecute failed: %d\n", iReturn);
+ }
+ }
+ return TRUE;
+
+ case ID_ABOUT_UG:
+ {
+ const char *pszPath = "http://x.cygwin.com/docs/ug/";
+ int iReturn;
+
+ iReturn = (int) ShellExecute(NULL,
+ "open",
+ pszPath, NULL, NULL, SW_MAXIMIZE);
+ if (iReturn < 32) {
+ ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - "
+ "ShellExecute failed: %d\n", iReturn);
+ }
+ }
+ return TRUE;
+
+ case ID_ABOUT_FAQ:
+ {
+ const char *pszPath = "http://x.cygwin.com/docs/faq/";
+ int iReturn;
+
+ iReturn = (int) ShellExecute(NULL,
+ "open",
+ pszPath, NULL, NULL, SW_MAXIMIZE);
+ if (iReturn < 32) {
+ ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - "
+ "ShellExecute failed: %d\n", iReturn);
+ }
+ }
+ return TRUE;
+ }
+ break;
case WM_CLOSE:
- ErrorF ("winAboutDlgProc - WM_CLOSE\n");
+ ErrorF("winAboutDlgProc - WM_CLOSE\n");
- DestroyWindow (g_hDlgAbout);
- g_hDlgAbout = NULL;
+ DestroyWindow(g_hDlgAbout);
+ g_hDlgAbout = NULL;
- /* Fix to make sure keyboard focus isn't trapped */
- PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
- /* Restore window procedures for URL buttons */
- winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
- winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
- winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG);
- winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
+ /* Restore window procedures for URL buttons */
+ winUnoverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG);
+ winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);
+ winUnoverrideURLButton(hwndDialog, ID_ABOUT_UG);
+ winUnoverrideURLButton(hwndDialog, ID_ABOUT_FAQ);
- return TRUE;
+ return TRUE;
}
- return FALSE;
+ return FALSE;
}
diff --git a/xorg-server/hw/xwin/winengine.c b/xorg-server/hw/xwin/winengine.c
index 3f5048dcd..b118864bb 100644
--- a/xorg-server/hw/xwin/winengine.c
+++ b/xorg-server/hw/xwin/winengine.c
@@ -38,8 +38,8 @@
* Global variables for function pointers into
* dynamically loaded libraries
*/
-FARPROC g_fpDirectDrawCreate = NULL;
-FARPROC g_fpDirectDrawCreateClipper = NULL;
+FARPROC g_fpDirectDrawCreate = NULL;
+FARPROC g_fpDirectDrawCreateClipper = NULL;
/*
module handle for dynamically loaded directdraw library
@@ -52,86 +52,82 @@ static HMODULE g_hmodDirectDraw = NULL;
*/
void
-winDetectSupportedEngines (void)
+winDetectSupportedEngines(void)
{
- OSVERSIONINFO osvi;
+ OSVERSIONINFO osvi;
- /* Initialize the engine support flags */
- g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI;
+ /* Initialize the engine support flags */
+ g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI;
#ifdef XWIN_NATIVEGDI
- g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI;
+ g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI;
#endif
- /* Get operating system version information */
- ZeroMemory (&osvi, sizeof (osvi));
- osvi.dwOSVersionInfoSize = sizeof (osvi);
- GetVersionEx (&osvi);
-
- /* Do we have DirectDraw? */
- if (g_hmodDirectDraw != NULL)
- {
- LPDIRECTDRAW lpdd = NULL;
- LPDIRECTDRAW4 lpdd4 = NULL;
- HRESULT ddrval;
-
- /* Was the DirectDrawCreate function found? */
- if (g_fpDirectDrawCreate == NULL)
- {
- /* No DirectDraw support */
- return;
- }
-
- /* DirectDrawCreate exists, try to call it */
- /* Create a DirectDraw object, store the address at lpdd */
- ddrval = (*g_fpDirectDrawCreate) (NULL,
- (void**) &lpdd,
- NULL);
- if (FAILED (ddrval))
- {
- /* No DirectDraw support */
- winDebug ("winDetectSupportedEngines - DirectDraw not installed\n");
- return;
- }
- else
- {
- /* We have DirectDraw */
- winDebug ("winDetectSupportedEngines - DirectDraw installed\n");
- g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
+ /* Get operating system version information */
+ ZeroMemory(&osvi, sizeof(osvi));
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
+
+ /* Do we have DirectDraw? */
+ if (g_hmodDirectDraw != NULL) {
+ LPDIRECTDRAW lpdd = NULL;
+ LPDIRECTDRAW4 lpdd4 = NULL;
+ HRESULT ddrval;
+
+ /* Was the DirectDrawCreate function found? */
+ if (g_fpDirectDrawCreate == NULL) {
+ /* No DirectDraw support */
+ return;
+ }
+
+ /* DirectDrawCreate exists, try to call it */
+ /* Create a DirectDraw object, store the address at lpdd */
+ ddrval = (*g_fpDirectDrawCreate) (NULL, (void **) &lpdd, NULL);
+ if (FAILED(ddrval)) {
+ /* No DirectDraw support */
+ winDebug (
+ "winDetectSupportedEngines - DirectDraw not installed\n");
+ return;
+ }
+ else {
+ /* We have DirectDraw */
+ winDebug (
+ "winDetectSupportedEngines - DirectDraw installed\n");
+ g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
#ifdef XWIN_PRIMARYFB
- /* Allow PrimaryDD engine if NT */
- if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
- {
- g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD;
- winDebug ("winDetectSupportedEngines - Allowing PrimaryDD\n");
- }
+ /* Allow PrimaryDD engine if NT */
+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
+ g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD;
+ winDebug (
+ "winDetectSupportedEngines - Allowing PrimaryDD\n");
+ }
#endif
- }
-
- /* Try to query for DirectDraw4 interface */
- ddrval = IDirectDraw_QueryInterface (lpdd,
- &IID_IDirectDraw4,
- (LPVOID*) &lpdd4);
- if (SUCCEEDED (ddrval))
- {
- /* We have DirectDraw4 */
- winDebug ("winDetectSupportedEngines - DirectDraw4 installed\n");
- g_dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL;
- }
-
- /* Cleanup DirectDraw interfaces */
- if (lpdd4 != NULL)
- IDirectDraw_Release (lpdd4);
- if (lpdd != NULL)
- IDirectDraw_Release (lpdd);
+ }
+
+ /* Try to query for DirectDraw4 interface */
+ ddrval = IDirectDraw_QueryInterface(lpdd,
+ &IID_IDirectDraw4,
+ (LPVOID *) & lpdd4);
+ if (SUCCEEDED(ddrval)) {
+ /* We have DirectDraw4 */
+ winDebug (
+ "winDetectSupportedEngines - DirectDraw4 installed\n");
+ g_dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL;
+ }
+
+ /* Cleanup DirectDraw interfaces */
+ if (lpdd4 != NULL)
+ IDirectDraw_Release(lpdd4);
+ if (lpdd != NULL)
+ IDirectDraw_Release(lpdd);
}
- winDebug ("winDetectSupportedEngines - Returning, supported engines %08x\n",
- (unsigned int) g_dwEnginesSupported);
+ winDebug (
+ "winDetectSupportedEngines - Returning, supported engines %08x\n",
+ (unsigned int) g_dwEnginesSupported);
}
-
/*
* Set the engine type, depending on the engines
* supported for this screen, and whether the user
@@ -139,197 +135,183 @@ winDetectSupportedEngines (void)
*/
Bool
-winSetEngine (ScreenPtr pScreen)
+winSetEngine(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HDC hdc;
- DWORD dwBPP;
-
- /* Get a DC */
- hdc = GetDC (NULL);
- if (hdc == NULL)
- {
- ErrorF ("winSetEngine - Couldn't get an HDC\n");
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc;
+ DWORD dwBPP;
+
+ /* Get a DC */
+ hdc = GetDC(NULL);
+ if (hdc == NULL) {
+ ErrorF("winSetEngine - Couldn't get an HDC\n");
+ return FALSE;
}
- /*
- * pScreenInfo->dwBPP may be 0 to indicate that the current screen
- * depth is to be used. Thus, we must query for the current display
- * depth here.
- */
- dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
-
- /* Release the DC */
- ReleaseDC (NULL, hdc);
- hdc = NULL;
-
- /* ShadowGDI is the only engine that supports windowed PseudoColor */
- if (dwBPP == 8 && !pScreenInfo->fFullScreen)
- {
- winDebug ("winSetEngine - Windowed && PseudoColor => ShadowGDI\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
-
- /* Set engine function pointers */
- winSetEngineFunctionsShadowGDI (pScreen);
- return TRUE;
+ /*
+ * pScreenInfo->dwBPP may be 0 to indicate that the current screen
+ * depth is to be used. Thus, we must query for the current display
+ * depth here.
+ */
+ dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
+
+ /* Release the DC */
+ ReleaseDC(NULL, hdc);
+ hdc = NULL;
+
+ /* ShadowGDI is the only engine that supports windowed PseudoColor */
+ if (dwBPP == 8 && !pScreenInfo->fFullScreen) {
+ winDebug (
+ "winSetEngine - Windowed && PseudoColor => ShadowGDI\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
+
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowGDI(pScreen);
+ return TRUE;
}
- /* ShadowGDI is the only engine that supports Multi Window Mode */
- if (
- FALSE
+ /* ShadowGDI is the only engine that supports Multi Window Mode */
+ if (FALSE
#ifdef XWIN_MULTIWINDOWEXTWM
- || pScreenInfo->fMWExtWM
+ || pScreenInfo->fMWExtWM
#endif
#ifdef XWIN_MULTIWINDOW
- || pScreenInfo->fMultiWindow
+ || pScreenInfo->fMultiWindow
#endif
- )
- {
- winDebug ("winSetEngine - Multi Window or Rootless => ShadowGDI\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
-
- /* Set engine function pointers */
- winSetEngineFunctionsShadowGDI (pScreen);
- return TRUE;
+ ) {
+ winDebug (
+ "winSetEngine - Multi Window or Rootless => ShadowGDI\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
+
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowGDI(pScreen);
+ return TRUE;
}
/* If there is a user's choice, we'll use that */
- if (pScreenInfo->dwEnginePreferred)
- {
- winDebug ("winSetEngine - Using user's preference: %d\n",
- (int) pScreenInfo->dwEnginePreferred);
- pScreenInfo->dwEngine = pScreenInfo->dwEnginePreferred;
-
- /* Setup engine function pointers */
- switch (pScreenInfo->dwEngine)
- {
- case WIN_SERVER_SHADOW_GDI:
- winSetEngineFunctionsShadowGDI (pScreen);
- break;
- case WIN_SERVER_SHADOW_DD:
- winSetEngineFunctionsShadowDD (pScreen);
- break;
- case WIN_SERVER_SHADOW_DDNL:
- winSetEngineFunctionsShadowDDNL (pScreen);
- break;
+ if (pScreenInfo->dwEnginePreferred) {
+ winDebug ("winSetEngine - Using user's preference: %d\n",
+ (int) pScreenInfo->dwEnginePreferred);
+ pScreenInfo->dwEngine = pScreenInfo->dwEnginePreferred;
+
+ /* Setup engine function pointers */
+ switch (pScreenInfo->dwEngine) {
+ case WIN_SERVER_SHADOW_GDI:
+ winSetEngineFunctionsShadowGDI(pScreen);
+ break;
+ case WIN_SERVER_SHADOW_DD:
+ winSetEngineFunctionsShadowDD(pScreen);
+ break;
+ case WIN_SERVER_SHADOW_DDNL:
+ winSetEngineFunctionsShadowDDNL(pScreen);
+ break;
#ifdef XWIN_PRIMARYFB
- case WIN_SERVER_PRIMARY_DD:
- winSetEngineFunctionsPrimaryDD (pScreen);
- break;
+ case WIN_SERVER_PRIMARY_DD:
+ winSetEngineFunctionsPrimaryDD(pScreen);
+ break;
#endif
#ifdef XWIN_NATIVEGDI
- case WIN_SERVER_NATIVE_GDI:
- winSetEngineFunctionsNativeGDI (pScreen);
- break;
+ case WIN_SERVER_NATIVE_GDI:
+ winSetEngineFunctionsNativeGDI(pScreen);
+ break;
#endif
- default:
- FatalError ("winSetEngine - Invalid engine type %d\n",pScreenInfo->dwEngine);
- }
- return TRUE;
+ default:
+ FatalError ("winSetEngine - Invalid engine type %d\n",pScreenInfo->dwEngine);
+ }
+ return TRUE;
}
- /* ShadowDDNL has good performance, so why not */
- if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DDNL)
- {
- winDebug ("winSetEngine - Using Shadow DirectDraw NonLocking\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DDNL;
+ /* ShadowDDNL has good performance, so why not */
+ if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DDNL) {
+ winDebug ("winSetEngine - Using Shadow DirectDraw NonLocking\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DDNL;
- /* Set engine function pointers */
- winSetEngineFunctionsShadowDDNL (pScreen);
- return TRUE;
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowDDNL(pScreen);
+ return TRUE;
}
- /* ShadowDD is next in line */
- if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DD)
- {
- winDebug ("winSetEngine - Using Shadow DirectDraw\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DD;
+ /* ShadowDD is next in line */
+ if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DD) {
+ winDebug ("winSetEngine - Using Shadow DirectDraw\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DD;
- /* Set engine function pointers */
- winSetEngineFunctionsShadowDD (pScreen);
- return TRUE;
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowDD(pScreen);
+ return TRUE;
}
- /* ShadowGDI is next in line */
- if (g_dwEnginesSupported & WIN_SERVER_SHADOW_GDI)
- {
- winDebug ("winSetEngine - Using Shadow GDI DIB\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
+ /* ShadowGDI is next in line */
+ if (g_dwEnginesSupported & WIN_SERVER_SHADOW_GDI) {
+ winDebug ("winSetEngine - Using Shadow GDI DIB\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
- /* Set engine function pointers */
- winSetEngineFunctionsShadowGDI (pScreen);
- return TRUE;
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowGDI(pScreen);
+ return TRUE;
}
- return TRUE;
+ return TRUE;
}
-
/*
* Get procedure addresses for DirectDrawCreate and DirectDrawCreateClipper
*/
Bool
-winGetDDProcAddresses (void)
+winGetDDProcAddresses(void)
{
- Bool fReturn = TRUE;
-
- /* Load the DirectDraw library */
- g_hmodDirectDraw = LoadLibraryEx ("ddraw.dll", NULL, 0);
- if (g_hmodDirectDraw == NULL)
- {
- ErrorF ("winGetDDProcAddresses - Could not load ddraw.dll\n");
- fReturn = TRUE;
- goto winGetDDProcAddresses_Exit;
+ Bool fReturn = TRUE;
+
+ /* Load the DirectDraw library */
+ g_hmodDirectDraw = LoadLibraryEx("ddraw.dll", NULL, 0);
+ if (g_hmodDirectDraw == NULL) {
+ ErrorF("winGetDDProcAddresses - Could not load ddraw.dll\n");
+ fReturn = TRUE;
+ goto winGetDDProcAddresses_Exit;
}
- /* Try to get the DirectDrawCreate address */
- g_fpDirectDrawCreate = GetProcAddress (g_hmodDirectDraw,
- "DirectDrawCreate");
- if (g_fpDirectDrawCreate == NULL)
- {
- ErrorF ("winGetDDProcAddresses - Could not get DirectDrawCreate "
- "address\n");
- fReturn = TRUE;
- goto winGetDDProcAddresses_Exit;
+ /* Try to get the DirectDrawCreate address */
+ g_fpDirectDrawCreate = GetProcAddress(g_hmodDirectDraw, "DirectDrawCreate");
+ if (g_fpDirectDrawCreate == NULL) {
+ ErrorF("winGetDDProcAddresses - Could not get DirectDrawCreate "
+ "address\n");
+ fReturn = TRUE;
+ goto winGetDDProcAddresses_Exit;
}
- /* Try to get the DirectDrawCreateClipper address */
- g_fpDirectDrawCreateClipper = GetProcAddress (g_hmodDirectDraw,
- "DirectDrawCreateClipper");
- if (g_fpDirectDrawCreateClipper == NULL)
- {
- ErrorF ("winGetDDProcAddresses - Could not get "
- "DirectDrawCreateClipper address\n");
- fReturn = FALSE;
- goto winGetDDProcAddresses_Exit;
+ /* Try to get the DirectDrawCreateClipper address */
+ g_fpDirectDrawCreateClipper = GetProcAddress(g_hmodDirectDraw,
+ "DirectDrawCreateClipper");
+ if (g_fpDirectDrawCreateClipper == NULL) {
+ ErrorF("winGetDDProcAddresses - Could not get "
+ "DirectDrawCreateClipper address\n");
+ fReturn = FALSE;
+ goto winGetDDProcAddresses_Exit;
}
- /*
- * Note: Do not unload ddraw.dll here. Do it in GiveUp
- */
+ /*
+ * Note: Do not unload ddraw.dll here. Do it in GiveUp
+ */
winGetDDProcAddresses_Exit:
- /* Unload the DirectDraw library if we failed to initialize */
- if (!fReturn && g_hmodDirectDraw != NULL)
- {
- FreeLibrary (g_hmodDirectDraw);
- g_hmodDirectDraw = NULL;
+ /* Unload the DirectDraw library if we failed to initialize */
+ if (!fReturn && g_hmodDirectDraw != NULL) {
+ FreeLibrary(g_hmodDirectDraw);
+ g_hmodDirectDraw = NULL;
}
-
- return fReturn;
+
+ return fReturn;
}
void
winReleaseDDProcAddresses(void)
{
- if (g_hmodDirectDraw != NULL)
- {
- FreeLibrary (g_hmodDirectDraw);
- g_hmodDirectDraw = NULL;
- g_fpDirectDrawCreate = NULL;
- g_fpDirectDrawCreateClipper = NULL;
+ if (g_hmodDirectDraw != NULL) {
+ FreeLibrary(g_hmodDirectDraw);
+ g_hmodDirectDraw = NULL;
+ g_fpDirectDrawCreate = NULL;
+ g_fpDirectDrawCreateClipper = NULL;
}
}
diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c
index e95be3f4c..48c963d62 100644
--- a/xorg-server/hw/xwin/winerror.c
+++ b/xorg-server/hw/xwin/winerror.c
@@ -39,18 +39,18 @@ extern Bool g_fSilentDupError;
#ifdef DDXOSVERRORF
/* Prototype */
void
-OsVendorVErrorF (const char *pszFormat, va_list va_args);
+ OsVendorVErrorF(const char *pszFormat, va_list va_args);
void
-OsVendorVErrorF (const char *pszFormat, va_list va_args)
+OsVendorVErrorF(const char *pszFormat, va_list va_args)
{
#if defined(XWIN_CLIPBOARD) || defined (XWIN_MULTIWINDOW)
- /* make sure the clipboard and multiwindow threads do not interfere the
- * main thread */
- static pthread_mutex_t s_pmPrinting = PTHREAD_MUTEX_INITIALIZER;
+ /* make sure the clipboard and multiwindow threads do not interfere the
+ * main thread */
+ static pthread_mutex_t s_pmPrinting = PTHREAD_MUTEX_INITIALIZER;
- /* Lock the printing mutex */
- pthread_mutex_lock (&s_pmPrinting);
+ /* Lock the printing mutex */
+ pthread_mutex_lock(&s_pmPrinting);
#endif
/*
@@ -71,17 +71,16 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args)
}
}
- /* Print the error message to a log file, could be stderr */
- LogVWrite (0, pszFormat, va_args);
+ /* Print the error message to a log file, could be stderr */
+ LogVWrite(0, pszFormat, va_args);
#if defined(XWIN_CLIPBOARD) || defined (XWIN_MULTIWINDOW)
- /* Unlock the printing mutex */
- pthread_mutex_unlock (&s_pmPrinting);
+ /* Unlock the printing mutex */
+ pthread_mutex_unlock(&s_pmPrinting);
#endif
}
#endif
-
/*
* os/util.c/FatalError () calls our vendor ErrorF, so the message
* from a FatalError will be logged. Thus, the message for the
@@ -91,17 +90,17 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args)
*/
char g_FatalErrorMessage[1024];
void
-OsVendorFatalError (void)
+OsVendorFatalError(void)
{
- /* Don't give duplicate warning if UseMsg was called */
- if (g_fSilentFatalError)
- return;
+ /* Don't give duplicate warning if UseMsg was called */
+ if (g_fSilentFatalError)
+ return;
- if (!g_fLogInited) {
- g_fLogInited = TRUE;
- g_pszLogFile = LogInit (g_pszLogFile, NULL);
- }
- LogClose (EXIT_ERR_ABORT);
+ if (!g_fLogInited) {
+ g_fLogInited = TRUE;
+ g_pszLogFile = LogInit(g_pszLogFile, NULL);
+ }
+ LogClose(EXIT_ERR_ABORT);
winMessageBoxF (
"A fatal error has occurred and " PROJECT_NAME " will now exit.\n" \
@@ -110,27 +109,26 @@ OsVendorFatalError (void)
MB_ICONERROR, g_FatalErrorMessage, (g_pszLogFile?g_pszLogFile:"the logfile"));
}
-
/*
* winMessageBoxF - Print a formatted error message in a useful
* message box.
*/
void
-winMessageBoxF (const char *pszError, UINT uType, ...)
+winMessageBoxF(const char *pszError, UINT uType, ...)
{
- char * pszErrorF = NULL;
- char * pszMsgBox = NULL;
- va_list args;
- int size;
-
- va_start(args, uType);
- size = vasprintf (&pszErrorF, pszError, args);
- va_end(args);
- if (size == -1) {
- pszErrorF = NULL;
- goto winMessageBoxF_Cleanup;
- }
+ char *pszErrorF = NULL;
+ char *pszMsgBox = NULL;
+ va_list args;
+ int size;
+
+ va_start(args, uType);
+ size = vasprintf(&pszErrorF, pszError, args);
+ va_end(args);
+ if (size == -1) {
+ pszErrorF = NULL;
+ goto winMessageBoxF_Cleanup;
+ }
#define MESSAGEBOXF \
"%s\n" \
@@ -141,27 +139,22 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
"XWin was started with the following command-line:\n\n" \
"%s\n"
- size = asprintf (&pszMsgBox, MESSAGEBOXF,
- pszErrorF, XVENDORNAME,
- XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH,
+ size = asprintf(&pszMsgBox, MESSAGEBOXF,
+ pszErrorF, XVENDORNAME,
+ XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH,
XORG_VERSION_SNAP,
- BUILDERADDR,
- BUILDERSTRING,
- g_pszCommandLine);
+ BUILDERADDR, BUILDERSTRING, g_pszCommandLine);
- if (size == -1) {
- pszMsgBox = NULL;
- goto winMessageBoxF_Cleanup;
- }
+ if (size == -1) {
+ pszMsgBox = NULL;
+ goto winMessageBoxF_Cleanup;
+ }
- /* Display the message box string */
- MessageBox (NULL,
- pszMsgBox,
- PROJECT_NAME,
- MB_OK | uType);
+ /* Display the message box string */
+ MessageBox(NULL, pszMsgBox, PROJECT_NAME, MB_OK | uType);
winMessageBoxF_Cleanup:
- free(pszErrorF);
- free(pszMsgBox);
+ free(pszErrorF);
+ free(pszMsgBox);
#undef MESSAGEBOXF
}
diff --git a/xorg-server/hw/xwin/winfillsp.c b/xorg-server/hw/xwin/winfillsp.c
index 1cc91e62a..f2432ed23 100644
--- a/xorg-server/hw/xwin/winfillsp.c
+++ b/xorg-server/hw/xwin/winfillsp.c
@@ -1,831 +1,842 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Harold L Hunt II
- * Alan Hourihane <alanh@fairlite.demon.co.uk>
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-
-extern void ROP16(HDC hdc, int rop);
-
-#define TRANSLATE_COLOR(color) \
-{ \
- if (pDrawable->depth == 15) \
- color = ((color & 0x1F) << 19) | ((color & 0x03E0) << 6) | \
- ((color & 0xF800) >> 8); \
- else if (pDrawable->depth == 16) \
- color = ((color & 0x1F) << 19) | ((color & 0x07E0) << 5) | \
- ((color & 0xF800) >> 8); \
- else if (pDrawable->depth == 24 || pDrawable->depth == 32) \
- color = ((color & 0xFF) << 16) | (color & 0xFF00) | \
- ((color & 0xFF0000) >> 16); \
-}
-
-/* See Porting Layer Definition - p. 54 */
-void
-winFillSpansNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- int iSpans,
- DDXPointPtr pPoints,
- int *piWidths,
- int fSorted)
-{
- winGCPriv(pGC);
- HBITMAP hbmpOrig = NULL, hbmpOrigStipple = NULL;
- HBITMAP hPenOrig = NULL;
- HBITMAP hBitmap = NULL;
- PixmapPtr pPixmap = NULL;
- winPrivPixmapPtr pPixmapPriv = NULL;
- PixmapPtr pStipple = NULL;
- winPrivPixmapPtr pStipplePriv = NULL;
- PixmapPtr pTile = NULL;
- winPrivPixmapPtr pTilePriv = NULL;
- HDC hdcStipple = NULL, hdcTile = NULL;
- HPEN hPen = NULL;
- int iX;
- int fg, bg;
- RegionPtr pClip = pGC->pCompositeClip;
- BoxPtr pextent, pbox;
- int nbox;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1;
- HRGN hrgn = NULL, combined = NULL;
-
- nbox = RegionNumRects (pClip);
- pbox = RegionRects (pClip);
-
- if (!nbox) return;
-
- combined = CreateRectRgn (pbox->x1, pbox->y1, pbox->x2, pbox->y2);
- nbox--; pbox++;
-
- while (nbox--)
- {
- hrgn = CreateRectRgn (pbox->x1, pbox->y1, pbox->x2, pbox->y2);
- CombineRgn (combined, combined, hrgn, RGN_OR);
- DeleteObject (hrgn);
- hrgn = NULL;
- pbox++;
- }
-
- pextent = RegionExtents(pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
-
- /* Branch on the type of drawable we have */
- switch (pDrawable->type)
- {
- case DRAWABLE_PIXMAP:
-
- SelectClipRgn (pGCPriv->hdcMem, combined);
- DeleteObject (combined);
- combined = NULL;
-
- /* Get a pixmap pointer from the drawable pointer, and fetch privates */
- pPixmap = (PixmapPtr) pDrawable;
- pPixmapPriv = winGetPixmapPriv (pPixmap);
-
- /* Select the drawable pixmap into memory hdc */
- hbmpOrig = SelectObject (pGCPriv->hdcMem, pPixmapPriv->hBitmap);
- if (hbmpOrig == NULL)
- FatalError ("winFillSpans - DRAWABLE_PIXMAP - "
- "SelectObject () failed on\n\tpPixmapPriv->hBitmap: "
- "%08x\n", (unsigned int) pPixmapPriv->hBitmap);
-
- /* Branch on the fill type */
- switch (pGC->fillStyle)
- {
- case FillSolid:
-
- ROP16 (pGCPriv->hdcMem, pGC->alu);
-
- if (pDrawable->depth == 1)
- {
- if (pGC->fgPixel == 0)
- hPenOrig = SelectObject (pGCPriv->hdcMem,
- GetStockObject (BLACK_PEN));
- else
- hPenOrig = SelectObject (pGCPriv->hdcMem,
- GetStockObject (WHITE_PEN));
- }
- else
- {
- fg = pGC->fgPixel;
- TRANSLATE_COLOR (fg);
- hPen = CreatePen (PS_SOLID, 0, fg);
- hPenOrig = SelectObject (pGCPriv->hdcMem, hPen);
- }
-
- while (iSpans--)
- {
- fullX1 = pPoints->x;
- fullY1 = pPoints->y;
- fullX2 = fullX1 + (int) *piWidths;
- pPoints++;
- piWidths++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- MoveToEx (pGCPriv->hdcMem, fullX1, fullY1, NULL);
- LineTo (pGCPriv->hdcMem, fullX2, fullY1);
- }
-
- SetROP2 (pGCPriv->hdcMem, R2_COPYPEN);
-
- /* Give back the Pen */
- SelectObject (pGCPriv->hdcMem, hPenOrig);
-
- if (pDrawable->depth != 1)
- DeleteObject (hPen);
- break;
-
- case FillOpaqueStippled:
-
- pStipple = pGC->stipple;
- pStipplePriv = winGetPixmapPriv (pStipple);
-
- /* Create a device-dependent bitmap for the stipple */
- hBitmap = CreateDIBitmap (pGCPriv->hdcMem,
- (BITMAPINFOHEADER *)pStipplePriv->pbmih,
- CBM_INIT,
- pStipplePriv->pbBits,
- (BITMAPINFO *)pStipplePriv->pbmih,
- DIB_RGB_COLORS);
-
- /* Create a memory DC to hold the stipple */
- hdcStipple = CreateCompatibleDC (pGCPriv->hdcMem);
-
- /* Select the stipple bitmap into the stipple DC */
- hbmpOrigStipple = SelectObject (hdcStipple, hBitmap);
- if (hbmpOrigStipple == NULL)
- FatalError ("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
- "SelectObject () failed on hbmpOrigStipple\n");
-
- /* Make a temporary copy of the foreground and background colors */
- bg = pGC->bgPixel;
- fg = pGC->fgPixel;
-
- /* Translate the depth-dependent colors to Win32 COLORREFs */
- TRANSLATE_COLOR (fg);
- TRANSLATE_COLOR (bg);
- SetTextColor (pGCPriv->hdcMem, fg);
- SetBkColor (pGCPriv->hdcMem, bg);
-
- while (iSpans--)
- {
- int width = pStipple->drawable.width;
- fullX1 = pPoints->x;
- fullY1 = pPoints->y;
- fullX2 = fullX1 + (int) *piWidths;
- pPoints++;
- piWidths++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- for (iX = fullX1; iX < fullX2; iX += width)
- {
- int xoffset;
-
- if ((iX + pStipple->drawable.width) > fullX2)
- width = fullX2 - iX;
- else
- width = pStipple->drawable.width;
-
- if (iX == fullX1)
- xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pStipple->drawable.width) - pStipple->drawable.width)) % pStipple->drawable.width;
- else
- xoffset = 0;
-
- if (xoffset + width > pStipple->drawable.width)
- width = pStipple->drawable.width - xoffset;
-
- BitBlt (pGCPriv->hdcMem,
- iX, fullY1,
- width, 1,
- hdcStipple,
- xoffset,
- (fullY1 - (pDrawable->y + (pGC->patOrg.y % pStipple->drawable.height) - pStipple->drawable.height)) % pStipple->drawable.height,
- g_copyROP[pGC->alu]);
- }
- }
-
- /* Clear the stipple HDC */
- SelectObject (hdcStipple, hbmpOrigStipple);
- DeleteDC (hdcStipple);
-
- /* Delete the device dependent stipple bitmap */
- DeleteObject (hBitmap);
-
- break;
- case FillStippled:
-
- pStipple = pGC->stipple;
- pStipplePriv = winGetPixmapPriv (pStipple);
-
- /* Create a device-dependent bitmap for the stipple */
- hBitmap = CreateDIBitmap (pGCPriv->hdcMem,
- (BITMAPINFOHEADER *)pStipplePriv->pbmih,
- CBM_INIT,
- pStipplePriv->pbBits,
- (BITMAPINFO *)pStipplePriv->pbmih,
- DIB_RGB_COLORS);
-
- /* Create a memory DC to hold the stipple */
- hdcStipple = CreateCompatibleDC (pGCPriv->hdcMem);
-
- /* Select the stipple bitmap into the stipple DC */
- hbmpOrigStipple = SelectObject (hdcStipple, hBitmap);
- if (hbmpOrigStipple == NULL)
- FatalError ("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
- "SelectObject () failed on hbmpOrigStipple\n");
-
- /* Make a temporary copy of the foreground and background colors */
- bg = pGC->bgPixel;
- fg = pGC->fgPixel;
-
- /* Translate the depth-dependent colors to Win32 COLORREFs */
- TRANSLATE_COLOR (fg);
- TRANSLATE_COLOR (bg);
-
- /* this is fudgy, we should only invert on the last one
- * We need to get the black/white pixels right in the
- * colormap. But yeah ! it's working..
- */
- if (pGC->bgPixel != -1 && pGC->fgPixel != -1)
- {
- SetTextColor (pGCPriv->hdcMem, fg);
- SetBkColor (pGCPriv->hdcMem, bg);
- BitBlt (hdcStipple,
- 0, 0,
- pStipple->drawable.width, pStipple->drawable.height,
- hdcStipple,
- 0, 0,
- 0x330008);
- }
- else if (pGC->bgPixel == -1)
- {
- SetTextColor (pGCPriv->hdcMem, fg);
- SetBkMode (pGCPriv->hdcMem, TRANSPARENT);
- BitBlt (hdcStipple,
- 0, 0,
- pStipple->drawable.width, pStipple->drawable.height,
- hdcStipple,
- 0, 0,
- 0x330008);
- }
- else if (pGC->fgPixel == -1)
- {
- SetTextColor (pGCPriv->hdcMem, bg);
- SetBkMode (pGCPriv->hdcMem, TRANSPARENT);
-#if 0
- BitBlt (hdcStipple,
- 0, 0,
- pStipple->drawable.width, pStipple->drawable.height,
- hdcStipple,
- 0, 0,
- 0x330008);
-#endif
- }
-
- while (iSpans--)
- {
- int width = pStipple->drawable.width;
- fullX1 = pPoints->x;
- fullY1 = pPoints->y;
- fullX2 = fullX1 + (int) *piWidths;
- pPoints++;
- piWidths++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- for (iX = fullX1; iX < fullX2; iX += width)
- {
- int xoffset;
-
- if ((iX + pStipple->drawable.width) > fullX2)
- width = fullX2 - iX;
- else
- width = pStipple->drawable.width;
-
- if (iX == fullX1)
- xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pStipple->drawable.width) - pStipple->drawable.width)) % pStipple->drawable.width;
- else
- xoffset = 0;
-
- if (xoffset + width > pStipple->drawable.width)
- width = pStipple->drawable.width - xoffset;
-
- BitBlt (pGCPriv->hdcMem,
- iX, fullY1,
- width, 1,
- hdcStipple,
- xoffset,
- (fullY1 - (pDrawable->y + (pGC->patOrg.y % pStipple->drawable.height) - pStipple->drawable.height)) % pStipple->drawable.height,
- g_copyROP[pGC->alu]);
- }
- }
-
- /* Clear the stipple HDC */
- SelectObject (hdcStipple, hbmpOrigStipple);
- DeleteDC (hdcStipple);
-
- /* Delete the device dependent stipple bitmap */
- DeleteObject (hBitmap);
-
- /* Restore the background mode */
- SetBkMode (pGCPriv->hdcMem, OPAQUE);
- break;
-
- case FillTiled:
-
- /* Get a pixmap pointer from the tile pointer, and fetch privates */
- pTile = (PixmapPtr) pGC->tile.pixmap;
- pTilePriv = winGetPixmapPriv (pTile);
-
- /* Create a memory DC to hold the tile */
- hdcTile = CreateCompatibleDC (pGCPriv->hdcMem);
-
- /* Select the tile into a DC */
- hbmpOrig = SelectObject (hdcTile, pTilePriv->hBitmap);
- if (hbmpOrig == NULL)
- FatalError ("winFillSpans - DRAWABLE_PIXMAP - FillTiled - "
- "SelectObject () failed on pTilePriv->hBitmap\n");
-
- while (iSpans--)
- {
- int width = pTile->drawable.width;
- fullX1 = pPoints->x;
- fullY1 = pPoints->y;
- fullX2 = fullX1 + (int) *piWidths;
- pPoints++;
- piWidths++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- for (iX = fullX1; iX < fullX2; iX += width)
- {
- int xoffset;
-
- if ((iX + pTile->drawable.width) > fullX2)
- width = fullX2 - iX;
- else
- width = pTile->drawable.width;
-
- if (iX == fullX1)
- xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pTile->drawable.width) - pTile->drawable.width)) % pTile->drawable.width;
- else
- xoffset = 0;
-
- if (xoffset + width > pTile->drawable.width)
- width = pTile->drawable.width - xoffset;
-
- BitBlt (pGCPriv->hdcMem,
- iX, fullY1,
- width, 1,
- hdcTile,
- xoffset,
- (fullY1 - (pDrawable->y + (pGC->patOrg.y % pTile->drawable.height) - pTile->drawable.height)) % pTile->drawable.height,
- g_copyROP[pGC->alu]);
- }
- }
-
- /* Push the tile pixmap out of the memory HDC */
- SelectObject (hdcTile, hbmpOrig);
-
- /* Delete the tile */
- DeleteDC (hdcTile);
- break;
-
- default:
- ErrorF ("winFillSpans - DRAWABLE_PIXMAP - Unknown fillStyle\n");
- break;
- }
-
- /* Reset clip region */
- SelectClipRgn (pGCPriv->hdcMem, NULL);
-
- /* Push the drawable pixmap out of the GC HDC */
- SelectObject (pGCPriv->hdcMem, hbmpOrig);
- break;
-
- case DRAWABLE_WINDOW:
-
- SelectClipRgn (pGCPriv->hdc, combined);
- DeleteObject (combined);
- combined = NULL;
-
- /* Branch on fill style */
- switch (pGC->fillStyle)
- {
- case FillSolid:
-
- ROP16 (pGCPriv->hdc, pGC->alu);
-
- if (pDrawable->depth == 1)
- {
- if (pGC->fgPixel == 0)
- hPenOrig = SelectObject (pGCPriv->hdc,
- GetStockObject (BLACK_PEN));
- else
- hPenOrig = SelectObject (pGCPriv->hdc,
- GetStockObject (WHITE_PEN));
- }
- else
- {
- fg = pGC->fgPixel;
- TRANSLATE_COLOR (fg);
- hPen = CreatePen (PS_SOLID, 0, fg);
- hPenOrig = SelectObject (pGCPriv->hdc, hPen);
- }
-
- while (iSpans--)
- {
- fullX1 = pPoints->x;
- fullY1 = pPoints->y;
- fullX2 = fullX1 + (int) *piWidths;
- pPoints++;
- piWidths++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- MoveToEx (pGCPriv->hdc, fullX1, fullY1, NULL);
- LineTo (pGCPriv->hdc, fullX2, fullY1);
- }
-
- SetROP2 (pGCPriv->hdc, R2_COPYPEN);
-
- /* Give back the Brush */
- SelectObject (pGCPriv->hdc, hPenOrig);
-
- if (pDrawable->depth != 1)
- DeleteObject (hPen);
- break;
-
- case FillOpaqueStippled:
-
- pStipple = pGC->stipple;
- pStipplePriv = winGetPixmapPriv (pStipple);
-
- /* Create a device-dependent bitmap for the stipple */
- hBitmap = CreateDIBitmap (pGCPriv->hdc,
- (BITMAPINFOHEADER *)pStipplePriv->pbmih,
- CBM_INIT,
- pStipplePriv->pbBits,
- (BITMAPINFO *)pStipplePriv->pbmih,
- DIB_RGB_COLORS);
-
- /* Create a memory DC to hold the stipple */
- hdcStipple = CreateCompatibleDC (pGCPriv->hdc);
-
- /* Select the stipple bitmap into the stipple DC */
- hbmpOrigStipple = SelectObject (hdcStipple, hBitmap);
- if (hbmpOrigStipple == NULL)
- FatalError ("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
- "SelectObject () failed on hbmpOrigStipple\n");
-
- /* Make a temporary copy of the foreground and background colors */
- bg = pGC->bgPixel;
- fg = pGC->fgPixel;
-
- /* Translate the depth-dependent colors to Win32 COLORREFs */
- TRANSLATE_COLOR (fg);
- TRANSLATE_COLOR (bg);
- SetTextColor (pGCPriv->hdc, fg);
- SetBkColor (pGCPriv->hdc, bg);
-
- while (iSpans--)
- {
- int width = pStipple->drawable.width;
- fullX1 = pPoints->x;
- fullY1 = pPoints->y;
- fullX2 = fullX1 + (int) *piWidths;
- pPoints++;
- piWidths++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- for (iX = fullX1; iX < fullX2; iX += width)
- {
- int xoffset;
-
- if ((iX + pStipple->drawable.width) > fullX2)
- width = fullX2 - iX;
- else
- width = pStipple->drawable.width;
-
- if (iX == fullX1)
- xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pStipple->drawable.width) - pStipple->drawable.width)) % pStipple->drawable.width;
- else
- xoffset = 0;
-
- if (xoffset + width > pStipple->drawable.width)
- width = pStipple->drawable.width - xoffset;
-
- BitBlt (pGCPriv->hdc,
- iX, fullY1,
- width, 1,
- hdcStipple,
- xoffset,
- (fullY1 - (pDrawable->y + (pGC->patOrg.y % pStipple->drawable.height) - pStipple->drawable.height)) % pStipple->drawable.height,
- g_copyROP[pGC->alu]);
- }
- }
-
- /* Clear the stipple HDC */
- SelectObject (hdcStipple, hbmpOrigStipple);
- DeleteDC (hdcStipple);
-
- /* Delete the device dependent stipple bitmap */
- DeleteObject (hBitmap);
-
- break;
-
- case FillStippled:
- pStipple = pGC->stipple;
- pStipplePriv = winGetPixmapPriv (pStipple);
-
- /* Create a device-dependent bitmap for the stipple */
- hBitmap = CreateDIBitmap (pGCPriv->hdcMem,
- (BITMAPINFOHEADER *)pStipplePriv->pbmih,
- CBM_INIT,
- pStipplePriv->pbBits,
- (BITMAPINFO *)pStipplePriv->pbmih,
- DIB_RGB_COLORS);
-
- /* Create a memory DC to hold the stipple */
- hdcStipple = CreateCompatibleDC (pGCPriv->hdc);
-
- /* Select the stipple bitmap into the stipple DC */
- hbmpOrigStipple = SelectObject (hdcStipple, hBitmap);
- if (hbmpOrigStipple == NULL)
- FatalError ("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
- "SelectObject () failed on hbmpOrigStipple\n");
-
- /* Make a temporary copy of the foreground and background colors */
- bg = pGC->bgPixel;
- fg = pGC->fgPixel;
-
- /* Translate the depth-dependent colors to Win32 COLORREFs */
- TRANSLATE_COLOR (fg);
- TRANSLATE_COLOR (bg);
-
- /* this is fudgy, we should only invert on the last one
- * We need to get the black/white pixels right in the
- * colormap. But yeah ! it's working..
- */
- if (pGC->bgPixel != -1 && pGC->fgPixel != -1)
- {
- SetTextColor (pGCPriv->hdc, fg);
- SetBkColor (pGCPriv->hdc, bg);
- BitBlt (hdcStipple,
- 0, 0,
- pStipple->drawable.width, pStipple->drawable.height,
- hdcStipple,
- 0,0,
- 0x330008);
- }
- else if (pGC->bgPixel == -1)
- {
- SetTextColor (pGCPriv->hdc, fg);
- SetBkMode (pGCPriv->hdc, TRANSPARENT);
- BitBlt (hdcStipple,
- 0, 0,
- pStipple->drawable.width, pStipple->drawable.height,
- hdcStipple,
- 0,0,
- 0x330008);
- }
- else if (pGC->fgPixel == -1)
- {
- SetTextColor (pGCPriv->hdc, bg);
- SetBkMode (pGCPriv->hdc, TRANSPARENT);
-#if 0
- BitBlt (hdcStipple,
- 0, 0,
- pStipple->drawable.width, pStipple->drawable.height,
- hdcStipple,
- 0, 0,
- 0x330008);
-#endif
- }
-
- while (iSpans--)
- {
- int width = pStipple->drawable.width;
- fullX1 = pPoints->x;
- fullY1 = pPoints->y;
- fullX2 = fullX1 + (int) *piWidths;
- pPoints++;
- piWidths++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- for (iX = fullX1; iX < fullX2; iX += width)
- {
- int xoffset;
-
- if ((iX + pStipple->drawable.width) > fullX2)
- width = fullX2 - iX;
- else
- width = pStipple->drawable.width;
-
- if (iX == fullX1)
- xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pStipple->drawable.width) - pStipple->drawable.width)) % pStipple->drawable.width;
- else
- xoffset = 0;
-
- if (xoffset + width > pStipple->drawable.width)
- width = pStipple->drawable.width - xoffset;
-
- BitBlt (pGCPriv->hdc,
- iX, fullY1,
- width, 1,
- hdcStipple,
- xoffset,
- (fullY1 - (pDrawable->y + (pGC->patOrg.y % pStipple->drawable.height) - pStipple->drawable.height)) % pStipple->drawable.height,
- g_copyROP[pGC->alu]);
- }
- }
-
- /* Clear the stipple HDC */
- SelectObject (hdcStipple, hbmpOrigStipple);
- DeleteDC (hdcStipple);
-
- /* Delete the device dependent stipple bitmap */
- DeleteObject (hBitmap);
-
- /* Restore the background mode */
- SetBkMode (pGCPriv->hdc, OPAQUE);
- break;
-
- case FillTiled:
-
- /* Get a pixmap pointer from the tile pointer, and fetch privates */
- pTile = (PixmapPtr) pGC->tile.pixmap;
- pTilePriv = winGetPixmapPriv (pTile);
-
- /* Select the tile into a DC */
- hbmpOrig = SelectObject (pGCPriv->hdcMem, pTilePriv->hBitmap);
- if (hbmpOrig == NULL)
- FatalError ("winFillSpans - DRAWABLE_WINDOW - FillTiled - "
- "SelectObject () failed on pTilePriv->hBitmap\n");
-
- while (iSpans--)
- {
- int width = pTile->drawable.width;
- fullX1 = pPoints->x;
- fullY1 = pPoints->y;
- fullX2 = fullX1 + (int) *piWidths;
- pPoints++;
- piWidths++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- for (iX = fullX1; iX < fullX2; iX += width)
- {
- int xoffset;
-
- if ((iX + pTile->drawable.width) > fullX2)
- width = fullX2 - iX;
- else
- width = pTile->drawable.width;
-
- if (iX == fullX1)
- xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pTile->drawable.width) - pTile->drawable.width)) % pTile->drawable.width;
- else
- xoffset = 0;
-
- if (xoffset + width > pTile->drawable.width)
- width = pTile->drawable.width - xoffset;
-
- BitBlt (pGCPriv->hdc,
- iX, fullY1,
- width, 1,
- pGCPriv->hdcMem,
- xoffset,
- (fullY1 - (pDrawable->y + (pGC->patOrg.y % pTile->drawable.height) - pTile->drawable.height)) % pTile->drawable.height,
- g_copyROP[pGC->alu]);
- }
- }
-
- /* Push the tile pixmap out of the memory HDC */
- SelectObject (pGCPriv->hdcMem, hbmpOrig);
- break;
-
- default:
- ErrorF ("winFillSpans - DRAWABLE_WINDOW - Unknown fillStyle\n");
- break;
- }
-
- /* Reset clip region */
- SelectClipRgn (pGCPriv->hdc, NULL);
- break;
-
- default:
- ErrorF ("winFillSpans - Unknown drawable type\n");
- break;
- }
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Harold L Hunt II
+ * Alan Hourihane <alanh@fairlite.demon.co.uk>
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+extern void ROP16(HDC hdc, int rop);
+
+#define TRANSLATE_COLOR(color) \
+{ \
+ if (pDrawable->depth == 15) \
+ color = ((color & 0x1F) << 19) | ((color & 0x03E0) << 6) | \
+ ((color & 0xF800) >> 8); \
+ else if (pDrawable->depth == 16) \
+ color = ((color & 0x1F) << 19) | ((color & 0x07E0) << 5) | \
+ ((color & 0xF800) >> 8); \
+ else if (pDrawable->depth == 24 || pDrawable->depth == 32) \
+ color = ((color & 0xFF) << 16) | (color & 0xFF00) | \
+ ((color & 0xFF0000) >> 16); \
+}
+
+/* See Porting Layer Definition - p. 54 */
+void
+winFillSpansNativeGDI(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int iSpans,
+ DDXPointPtr pPoints, int *piWidths, int fSorted)
+{
+ winGCPriv(pGC);
+ HBITMAP hbmpOrig = NULL, hbmpOrigStipple = NULL;
+ HBITMAP hPenOrig = NULL;
+ HBITMAP hBitmap = NULL;
+ PixmapPtr pPixmap = NULL;
+ winPrivPixmapPtr pPixmapPriv = NULL;
+ PixmapPtr pStipple = NULL;
+ winPrivPixmapPtr pStipplePriv = NULL;
+ PixmapPtr pTile = NULL;
+ winPrivPixmapPtr pTilePriv = NULL;
+ HDC hdcStipple = NULL, hdcTile = NULL;
+ HPEN hPen = NULL;
+ int iX;
+ int fg, bg;
+ RegionPtr pClip = pGC->pCompositeClip;
+ BoxPtr pextent, pbox;
+ int nbox;
+ int extentX1, extentX2, extentY1, extentY2;
+ int fullX1, fullX2, fullY1;
+ HRGN hrgn = NULL, combined = NULL;
+
+ nbox = RegionNumRects(pClip);
+ pbox = RegionRects(pClip);
+
+ if (!nbox)
+ return;
+
+ combined = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
+ nbox--;
+ pbox++;
+
+ while (nbox--) {
+ hrgn = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
+ CombineRgn(combined, combined, hrgn, RGN_OR);
+ DeleteObject(hrgn);
+ hrgn = NULL;
+ pbox++;
+ }
+
+ pextent = RegionExtents(pClip);
+ extentX1 = pextent->x1;
+ extentY1 = pextent->y1;
+ extentX2 = pextent->x2;
+ extentY2 = pextent->y2;
+
+ /* Branch on the type of drawable we have */
+ switch (pDrawable->type) {
+ case DRAWABLE_PIXMAP:
+
+ SelectClipRgn(pGCPriv->hdcMem, combined);
+ DeleteObject(combined);
+ combined = NULL;
+
+ /* Get a pixmap pointer from the drawable pointer, and fetch privates */
+ pPixmap = (PixmapPtr) pDrawable;
+ pPixmapPriv = winGetPixmapPriv(pPixmap);
+
+ /* Select the drawable pixmap into memory hdc */
+ hbmpOrig = SelectObject(pGCPriv->hdcMem, pPixmapPriv->hBitmap);
+ if (hbmpOrig == NULL)
+ FatalError("winFillSpans - DRAWABLE_PIXMAP - "
+ "SelectObject () failed on\n\tpPixmapPriv->hBitmap: "
+ "%08x\n", (unsigned int) pPixmapPriv->hBitmap);
+
+ /* Branch on the fill type */
+ switch (pGC->fillStyle) {
+ case FillSolid:
+
+ ROP16(pGCPriv->hdcMem, pGC->alu);
+
+ if (pDrawable->depth == 1) {
+ if (pGC->fgPixel == 0)
+ hPenOrig = SelectObject(pGCPriv->hdcMem,
+ GetStockObject(BLACK_PEN));
+ else
+ hPenOrig = SelectObject(pGCPriv->hdcMem,
+ GetStockObject(WHITE_PEN));
+ }
+ else {
+ fg = pGC->fgPixel;
+ TRANSLATE_COLOR(fg);
+ hPen = CreatePen(PS_SOLID, 0, fg);
+ hPenOrig = SelectObject(pGCPriv->hdcMem, hPen);
+ }
+
+ while (iSpans--) {
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ MoveToEx(pGCPriv->hdcMem, fullX1, fullY1, NULL);
+ LineTo(pGCPriv->hdcMem, fullX2, fullY1);
+ }
+
+ SetROP2(pGCPriv->hdcMem, R2_COPYPEN);
+
+ /* Give back the Pen */
+ SelectObject(pGCPriv->hdcMem, hPenOrig);
+
+ if (pDrawable->depth != 1)
+ DeleteObject(hPen);
+ break;
+
+ case FillOpaqueStippled:
+
+ pStipple = pGC->stipple;
+ pStipplePriv = winGetPixmapPriv(pStipple);
+
+ /* Create a device-dependent bitmap for the stipple */
+ hBitmap = CreateDIBitmap(pGCPriv->hdcMem,
+ (BITMAPINFOHEADER *) pStipplePriv->pbmih,
+ CBM_INIT,
+ pStipplePriv->pbBits,
+ (BITMAPINFO *) pStipplePriv->pbmih,
+ DIB_RGB_COLORS);
+
+ /* Create a memory DC to hold the stipple */
+ hdcStipple = CreateCompatibleDC(pGCPriv->hdcMem);
+
+ /* Select the stipple bitmap into the stipple DC */
+ hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
+ if (hbmpOrigStipple == NULL)
+ FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
+ "SelectObject () failed on hbmpOrigStipple\n");
+
+ /* Make a temporary copy of the foreground and background colors */
+ bg = pGC->bgPixel;
+ fg = pGC->fgPixel;
+
+ /* Translate the depth-dependent colors to Win32 COLORREFs */
+ TRANSLATE_COLOR(fg);
+ TRANSLATE_COLOR(bg);
+ SetTextColor(pGCPriv->hdcMem, fg);
+ SetBkColor(pGCPriv->hdcMem, bg);
+
+ while (iSpans--) {
+ int width = pStipple->drawable.width;
+
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width) {
+ int xoffset;
+
+ if ((iX + pStipple->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pStipple->drawable.width;
+
+ if (iX == fullX1)
+ xoffset =
+ (fullX1 -
+ (pDrawable->x +
+ (pGC->patOrg.x % pStipple->drawable.width) -
+ pStipple->drawable.width)) %
+ pStipple->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pStipple->drawable.width)
+ width = pStipple->drawable.width - xoffset;
+
+ BitBlt(pGCPriv->hdcMem,
+ iX, fullY1,
+ width, 1,
+ hdcStipple,
+ xoffset,
+ (fullY1 -
+ (pDrawable->y +
+ (pGC->patOrg.y % pStipple->drawable.height) -
+ pStipple->drawable.height)) %
+ pStipple->drawable.height, g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Clear the stipple HDC */
+ SelectObject(hdcStipple, hbmpOrigStipple);
+ DeleteDC(hdcStipple);
+
+ /* Delete the device dependent stipple bitmap */
+ DeleteObject(hBitmap);
+
+ break;
+ case FillStippled:
+
+ pStipple = pGC->stipple;
+ pStipplePriv = winGetPixmapPriv(pStipple);
+
+ /* Create a device-dependent bitmap for the stipple */
+ hBitmap = CreateDIBitmap(pGCPriv->hdcMem,
+ (BITMAPINFOHEADER *) pStipplePriv->pbmih,
+ CBM_INIT,
+ pStipplePriv->pbBits,
+ (BITMAPINFO *) pStipplePriv->pbmih,
+ DIB_RGB_COLORS);
+
+ /* Create a memory DC to hold the stipple */
+ hdcStipple = CreateCompatibleDC(pGCPriv->hdcMem);
+
+ /* Select the stipple bitmap into the stipple DC */
+ hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
+ if (hbmpOrigStipple == NULL)
+ FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
+ "SelectObject () failed on hbmpOrigStipple\n");
+
+ /* Make a temporary copy of the foreground and background colors */
+ bg = pGC->bgPixel;
+ fg = pGC->fgPixel;
+
+ /* Translate the depth-dependent colors to Win32 COLORREFs */
+ TRANSLATE_COLOR(fg);
+ TRANSLATE_COLOR(bg);
+
+ /* this is fudgy, we should only invert on the last one
+ * We need to get the black/white pixels right in the
+ * colormap. But yeah ! it's working..
+ */
+ if (pGC->bgPixel != -1 && pGC->fgPixel != -1) {
+ SetTextColor(pGCPriv->hdcMem, fg);
+ SetBkColor(pGCPriv->hdcMem, bg);
+ BitBlt(hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple, 0, 0, 0x330008);
+ }
+ else if (pGC->bgPixel == -1) {
+ SetTextColor(pGCPriv->hdcMem, fg);
+ SetBkMode(pGCPriv->hdcMem, TRANSPARENT);
+ BitBlt(hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple, 0, 0, 0x330008);
+ }
+ else if (pGC->fgPixel == -1) {
+ SetTextColor(pGCPriv->hdcMem, bg);
+ SetBkMode(pGCPriv->hdcMem, TRANSPARENT);
+#if 0
+ BitBlt(hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple, 0, 0, 0x330008);
+#endif
+ }
+
+ while (iSpans--) {
+ int width = pStipple->drawable.width;
+
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width) {
+ int xoffset;
+
+ if ((iX + pStipple->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pStipple->drawable.width;
+
+ if (iX == fullX1)
+ xoffset =
+ (fullX1 -
+ (pDrawable->x +
+ (pGC->patOrg.x % pStipple->drawable.width) -
+ pStipple->drawable.width)) %
+ pStipple->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pStipple->drawable.width)
+ width = pStipple->drawable.width - xoffset;
+
+ BitBlt(pGCPriv->hdcMem,
+ iX, fullY1,
+ width, 1,
+ hdcStipple,
+ xoffset,
+ (fullY1 -
+ (pDrawable->y +
+ (pGC->patOrg.y % pStipple->drawable.height) -
+ pStipple->drawable.height)) %
+ pStipple->drawable.height, g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Clear the stipple HDC */
+ SelectObject(hdcStipple, hbmpOrigStipple);
+ DeleteDC(hdcStipple);
+
+ /* Delete the device dependent stipple bitmap */
+ DeleteObject(hBitmap);
+
+ /* Restore the background mode */
+ SetBkMode(pGCPriv->hdcMem, OPAQUE);
+ break;
+
+ case FillTiled:
+
+ /* Get a pixmap pointer from the tile pointer, and fetch privates */
+ pTile = (PixmapPtr) pGC->tile.pixmap;
+ pTilePriv = winGetPixmapPriv(pTile);
+
+ /* Create a memory DC to hold the tile */
+ hdcTile = CreateCompatibleDC(pGCPriv->hdcMem);
+
+ /* Select the tile into a DC */
+ hbmpOrig = SelectObject(hdcTile, pTilePriv->hBitmap);
+ if (hbmpOrig == NULL)
+ FatalError("winFillSpans - DRAWABLE_PIXMAP - FillTiled - "
+ "SelectObject () failed on pTilePriv->hBitmap\n");
+
+ while (iSpans--) {
+ int width = pTile->drawable.width;
+
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width) {
+ int xoffset;
+
+ if ((iX + pTile->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pTile->drawable.width;
+
+ if (iX == fullX1)
+ xoffset =
+ (fullX1 -
+ (pDrawable->x +
+ (pGC->patOrg.x % pTile->drawable.width) -
+ pTile->drawable.width)) % pTile->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pTile->drawable.width)
+ width = pTile->drawable.width - xoffset;
+
+ BitBlt(pGCPriv->hdcMem,
+ iX, fullY1,
+ width, 1,
+ hdcTile,
+ xoffset,
+ (fullY1 -
+ (pDrawable->y +
+ (pGC->patOrg.y % pTile->drawable.height) -
+ pTile->drawable.height)) % pTile->drawable.height,
+ g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Push the tile pixmap out of the memory HDC */
+ SelectObject(hdcTile, hbmpOrig);
+
+ /* Delete the tile */
+ DeleteDC(hdcTile);
+ break;
+
+ default:
+ ErrorF("winFillSpans - DRAWABLE_PIXMAP - Unknown fillStyle\n");
+ break;
+ }
+
+ /* Reset clip region */
+ SelectClipRgn(pGCPriv->hdcMem, NULL);
+
+ /* Push the drawable pixmap out of the GC HDC */
+ SelectObject(pGCPriv->hdcMem, hbmpOrig);
+ break;
+
+ case DRAWABLE_WINDOW:
+
+ SelectClipRgn(pGCPriv->hdc, combined);
+ DeleteObject(combined);
+ combined = NULL;
+
+ /* Branch on fill style */
+ switch (pGC->fillStyle) {
+ case FillSolid:
+
+ ROP16(pGCPriv->hdc, pGC->alu);
+
+ if (pDrawable->depth == 1) {
+ if (pGC->fgPixel == 0)
+ hPenOrig = SelectObject(pGCPriv->hdc,
+ GetStockObject(BLACK_PEN));
+ else
+ hPenOrig = SelectObject(pGCPriv->hdc,
+ GetStockObject(WHITE_PEN));
+ }
+ else {
+ fg = pGC->fgPixel;
+ TRANSLATE_COLOR(fg);
+ hPen = CreatePen(PS_SOLID, 0, fg);
+ hPenOrig = SelectObject(pGCPriv->hdc, hPen);
+ }
+
+ while (iSpans--) {
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ MoveToEx(pGCPriv->hdc, fullX1, fullY1, NULL);
+ LineTo(pGCPriv->hdc, fullX2, fullY1);
+ }
+
+ SetROP2(pGCPriv->hdc, R2_COPYPEN);
+
+ /* Give back the Brush */
+ SelectObject(pGCPriv->hdc, hPenOrig);
+
+ if (pDrawable->depth != 1)
+ DeleteObject(hPen);
+ break;
+
+ case FillOpaqueStippled:
+
+ pStipple = pGC->stipple;
+ pStipplePriv = winGetPixmapPriv(pStipple);
+
+ /* Create a device-dependent bitmap for the stipple */
+ hBitmap = CreateDIBitmap(pGCPriv->hdc,
+ (BITMAPINFOHEADER *) pStipplePriv->pbmih,
+ CBM_INIT,
+ pStipplePriv->pbBits,
+ (BITMAPINFO *) pStipplePriv->pbmih,
+ DIB_RGB_COLORS);
+
+ /* Create a memory DC to hold the stipple */
+ hdcStipple = CreateCompatibleDC(pGCPriv->hdc);
+
+ /* Select the stipple bitmap into the stipple DC */
+ hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
+ if (hbmpOrigStipple == NULL)
+ FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
+ "SelectObject () failed on hbmpOrigStipple\n");
+
+ /* Make a temporary copy of the foreground and background colors */
+ bg = pGC->bgPixel;
+ fg = pGC->fgPixel;
+
+ /* Translate the depth-dependent colors to Win32 COLORREFs */
+ TRANSLATE_COLOR(fg);
+ TRANSLATE_COLOR(bg);
+ SetTextColor(pGCPriv->hdc, fg);
+ SetBkColor(pGCPriv->hdc, bg);
+
+ while (iSpans--) {
+ int width = pStipple->drawable.width;
+
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width) {
+ int xoffset;
+
+ if ((iX + pStipple->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pStipple->drawable.width;
+
+ if (iX == fullX1)
+ xoffset =
+ (fullX1 -
+ (pDrawable->x +
+ (pGC->patOrg.x % pStipple->drawable.width) -
+ pStipple->drawable.width)) %
+ pStipple->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pStipple->drawable.width)
+ width = pStipple->drawable.width - xoffset;
+
+ BitBlt(pGCPriv->hdc,
+ iX, fullY1,
+ width, 1,
+ hdcStipple,
+ xoffset,
+ (fullY1 -
+ (pDrawable->y +
+ (pGC->patOrg.y % pStipple->drawable.height) -
+ pStipple->drawable.height)) %
+ pStipple->drawable.height, g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Clear the stipple HDC */
+ SelectObject(hdcStipple, hbmpOrigStipple);
+ DeleteDC(hdcStipple);
+
+ /* Delete the device dependent stipple bitmap */
+ DeleteObject(hBitmap);
+
+ break;
+
+ case FillStippled:
+ pStipple = pGC->stipple;
+ pStipplePriv = winGetPixmapPriv(pStipple);
+
+ /* Create a device-dependent bitmap for the stipple */
+ hBitmap = CreateDIBitmap(pGCPriv->hdcMem,
+ (BITMAPINFOHEADER *) pStipplePriv->pbmih,
+ CBM_INIT,
+ pStipplePriv->pbBits,
+ (BITMAPINFO *) pStipplePriv->pbmih,
+ DIB_RGB_COLORS);
+
+ /* Create a memory DC to hold the stipple */
+ hdcStipple = CreateCompatibleDC(pGCPriv->hdc);
+
+ /* Select the stipple bitmap into the stipple DC */
+ hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
+ if (hbmpOrigStipple == NULL)
+ FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
+ "SelectObject () failed on hbmpOrigStipple\n");
+
+ /* Make a temporary copy of the foreground and background colors */
+ bg = pGC->bgPixel;
+ fg = pGC->fgPixel;
+
+ /* Translate the depth-dependent colors to Win32 COLORREFs */
+ TRANSLATE_COLOR(fg);
+ TRANSLATE_COLOR(bg);
+
+ /* this is fudgy, we should only invert on the last one
+ * We need to get the black/white pixels right in the
+ * colormap. But yeah ! it's working..
+ */
+ if (pGC->bgPixel != -1 && pGC->fgPixel != -1) {
+ SetTextColor(pGCPriv->hdc, fg);
+ SetBkColor(pGCPriv->hdc, bg);
+ BitBlt(hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple, 0, 0, 0x330008);
+ }
+ else if (pGC->bgPixel == -1) {
+ SetTextColor(pGCPriv->hdc, fg);
+ SetBkMode(pGCPriv->hdc, TRANSPARENT);
+ BitBlt(hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple, 0, 0, 0x330008);
+ }
+ else if (pGC->fgPixel == -1) {
+ SetTextColor(pGCPriv->hdc, bg);
+ SetBkMode(pGCPriv->hdc, TRANSPARENT);
+#if 0
+ BitBlt(hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple, 0, 0, 0x330008);
+#endif
+ }
+
+ while (iSpans--) {
+ int width = pStipple->drawable.width;
+
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width) {
+ int xoffset;
+
+ if ((iX + pStipple->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pStipple->drawable.width;
+
+ if (iX == fullX1)
+ xoffset =
+ (fullX1 -
+ (pDrawable->x +
+ (pGC->patOrg.x % pStipple->drawable.width) -
+ pStipple->drawable.width)) %
+ pStipple->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pStipple->drawable.width)
+ width = pStipple->drawable.width - xoffset;
+
+ BitBlt(pGCPriv->hdc,
+ iX, fullY1,
+ width, 1,
+ hdcStipple,
+ xoffset,
+ (fullY1 -
+ (pDrawable->y +
+ (pGC->patOrg.y % pStipple->drawable.height) -
+ pStipple->drawable.height)) %
+ pStipple->drawable.height, g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Clear the stipple HDC */
+ SelectObject(hdcStipple, hbmpOrigStipple);
+ DeleteDC(hdcStipple);
+
+ /* Delete the device dependent stipple bitmap */
+ DeleteObject(hBitmap);
+
+ /* Restore the background mode */
+ SetBkMode(pGCPriv->hdc, OPAQUE);
+ break;
+
+ case FillTiled:
+
+ /* Get a pixmap pointer from the tile pointer, and fetch privates */
+ pTile = (PixmapPtr) pGC->tile.pixmap;
+ pTilePriv = winGetPixmapPriv(pTile);
+
+ /* Select the tile into a DC */
+ hbmpOrig = SelectObject(pGCPriv->hdcMem, pTilePriv->hBitmap);
+ if (hbmpOrig == NULL)
+ FatalError("winFillSpans - DRAWABLE_WINDOW - FillTiled - "
+ "SelectObject () failed on pTilePriv->hBitmap\n");
+
+ while (iSpans--) {
+ int width = pTile->drawable.width;
+
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width) {
+ int xoffset;
+
+ if ((iX + pTile->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pTile->drawable.width;
+
+ if (iX == fullX1)
+ xoffset =
+ (fullX1 -
+ (pDrawable->x +
+ (pGC->patOrg.x % pTile->drawable.width) -
+ pTile->drawable.width)) % pTile->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pTile->drawable.width)
+ width = pTile->drawable.width - xoffset;
+
+ BitBlt(pGCPriv->hdc,
+ iX, fullY1,
+ width, 1,
+ pGCPriv->hdcMem,
+ xoffset,
+ (fullY1 -
+ (pDrawable->y +
+ (pGC->patOrg.y % pTile->drawable.height) -
+ pTile->drawable.height)) % pTile->drawable.height,
+ g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Push the tile pixmap out of the memory HDC */
+ SelectObject(pGCPriv->hdcMem, hbmpOrig);
+ break;
+
+ default:
+ ErrorF("winFillSpans - DRAWABLE_WINDOW - Unknown fillStyle\n");
+ break;
+ }
+
+ /* Reset clip region */
+ SelectClipRgn(pGCPriv->hdc, NULL);
+ break;
+
+ default:
+ ErrorF("winFillSpans - Unknown drawable type\n");
+ break;
+ }
+}
diff --git a/xorg-server/hw/xwin/wingc.c b/xorg-server/hw/xwin/wingc.c
index bf307a44c..0ad64676d 100644
--- a/xorg-server/hw/xwin/wingc.c
+++ b/xorg-server/hw/xwin/wingc.c
@@ -1,162 +1,156 @@
-/*
- *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors: Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-void
-winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg);
-
-
-/*
- * Local prototypes
- */
-
-static void
-winValidateGCNativeGDI (GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable);
-
-static void
-winDestroyGCNativeGDI (GCPtr pGC);
-
-const GCFuncs winGCFuncs = {
- winValidateGCNativeGDI,
- miChangeGC,
- miCopyGC,
- winDestroyGCNativeGDI,
- miChangeClip,
- miDestroyClip,
- miCopyClip,
-};
-
-/* Drawing Primitives */
-const GCOps winGCOps = {
- winFillSpansNativeGDI,
- winSetSpansNativeGDI,
- miPutImage,
- miCopyArea,
- miCopyPlane,
- miPolyPoint,
- winPolyLineNativeGDI,
- miPolySegment,
- miPolyRectangle,
- miPolyArc,
- miFillPolygon,
- miPolyFillRect,
- miPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- miImageGlyphBlt,
- miPolyGlyphBlt,
- miPushPixels,
-};
-
-
-/* See Porting Layer Definition - p. 45 */
-/* See mfb/mfbgc.c - mfbCreateGC() */
-/* See Strategies for Porting - pp. 15, 16 */
-Bool
-winCreateGCNativeGDI (GCPtr pGC)
-{
- winPrivGCPtr pGCPriv = NULL;
- winPrivScreenPtr pScreenPriv = NULL;
-
- winDebug ("winCreateGCNativeGDI - depth: %d\n",
- pGC->depth);
-
- pGC->ops = (GCOps *) &winGCOps;
- pGC->funcs = (GCFuncs *) &winGCFuncs;
-
- /* We want all coordinates passed to spans functions to be screen relative */
- pGC->miTranslate = TRUE;
-
- /* Allocate privates for this GC */
- pGCPriv = winGetGCPriv (pGC);
- if (pGCPriv == NULL)
- {
- ErrorF ("winCreateGCNativeGDI () - Privates pointer was NULL\n");
- return FALSE;
- }
-
- /* Create a new screen DC for the display window */
- pScreenPriv = winGetScreenPriv (pGC->pScreen);
- pGCPriv->hdc = GetDC (pScreenPriv->hwndScreen);
-
- /* Allocate a memory DC for the GC */
- pGCPriv->hdcMem = CreateCompatibleDC (pGCPriv->hdc);
-
- return TRUE;
-}
-
-static void
-winValidateGCNativeGDI (GCPtr pGC,
- unsigned long ulChanges,
- DrawablePtr pDrawable)
-{
- if ((ulChanges & (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode))
- || (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)))
- {
- miComputeCompositeClip (pGC, pDrawable);
- }
-}
-
-
-/* See Porting Layer Definition - p. 46 */
-static void
-winDestroyGCNativeGDI (GCPtr pGC)
-{
- winGCPriv(pGC);
- winScreenPriv(pGC->pScreen);
-
- if (pGC->freeCompClip)
- RegionDestroy(pGC->pCompositeClip);
-
- /* Free the memory DC */
- if (pGCPriv->hdcMem != NULL)
- {
- DeleteDC (pGCPriv->hdcMem);
- pGCPriv->hdcMem = NULL;
- }
-
- /* Release the screen DC for the display window */
- if (pGCPriv->hdc != NULL)
- {
- ReleaseDC (pScreenPriv->hwndScreen, pGCPriv->hdc);
- pGCPriv->hdc = NULL;
- }
-
- /* Invalidate the GC privates pointer */
- winSetGCPriv (pGC, NULL);
-}
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+void
+
+winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx,
+ int dy, int xOrg, int yOrg);
+
+/*
+ * Local prototypes
+ */
+
+static void
+
+winValidateGCNativeGDI(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
+
+static void
+ winDestroyGCNativeGDI(GCPtr pGC);
+
+const GCFuncs winGCFuncs = {
+ winValidateGCNativeGDI,
+ miChangeGC,
+ miCopyGC,
+ winDestroyGCNativeGDI,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip,
+};
+
+/* Drawing Primitives */
+const GCOps winGCOps = {
+ winFillSpansNativeGDI,
+ winSetSpansNativeGDI,
+ miPutImage,
+ miCopyArea,
+ miCopyPlane,
+ miPolyPoint,
+ winPolyLineNativeGDI,
+ miPolySegment,
+ miPolyRectangle,
+ miPolyArc,
+ miFillPolygon,
+ miPolyFillRect,
+ miPolyFillArc,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ miImageGlyphBlt,
+ miPolyGlyphBlt,
+ miPushPixels,
+};
+
+/* See Porting Layer Definition - p. 45 */
+/* See mfb/mfbgc.c - mfbCreateGC() */
+/* See Strategies for Porting - pp. 15, 16 */
+Bool
+winCreateGCNativeGDI(GCPtr pGC)
+{
+ winPrivGCPtr pGCPriv = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+
+ winDebug ("winCreateGCNativeGDI - depth: %d\n", pGC->depth);
+
+ pGC->ops = (GCOps *) & winGCOps;
+ pGC->funcs = (GCFuncs *) & winGCFuncs;
+
+ /* We want all coordinates passed to spans functions to be screen relative */
+ pGC->miTranslate = TRUE;
+
+ /* Allocate privates for this GC */
+ pGCPriv = winGetGCPriv(pGC);
+ if (pGCPriv == NULL) {
+ ErrorF("winCreateGCNativeGDI () - Privates pointer was NULL\n");
+ return FALSE;
+ }
+
+ /* Create a new screen DC for the display window */
+ pScreenPriv = winGetScreenPriv(pGC->pScreen);
+ pGCPriv->hdc = GetDC(pScreenPriv->hwndScreen);
+
+ /* Allocate a memory DC for the GC */
+ pGCPriv->hdcMem = CreateCompatibleDC(pGCPriv->hdc);
+
+ return TRUE;
+}
+
+static void
+winValidateGCNativeGDI(GCPtr pGC,
+ unsigned long ulChanges, DrawablePtr pDrawable)
+{
+ if ((ulChanges &
+ (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode))
+ || (pDrawable->serialNumber !=
+ (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) {
+ miComputeCompositeClip(pGC, pDrawable);
+ }
+}
+
+/* See Porting Layer Definition - p. 46 */
+static void
+winDestroyGCNativeGDI(GCPtr pGC)
+{
+ winGCPriv(pGC);
+ winScreenPriv(pGC->pScreen);
+
+ if (pGC->freeCompClip)
+ RegionDestroy(pGC->pCompositeClip);
+
+ /* Free the memory DC */
+ if (pGCPriv->hdcMem != NULL) {
+ DeleteDC(pGCPriv->hdcMem);
+ pGCPriv->hdcMem = NULL;
+ }
+
+ /* Release the screen DC for the display window */
+ if (pGCPriv->hdc != NULL) {
+ ReleaseDC(pScreenPriv->hwndScreen, pGCPriv->hdc);
+ pGCPriv->hdc = NULL;
+ }
+
+ /* Invalidate the GC privates pointer */
+ winSetGCPriv(pGC, NULL);
+}
diff --git a/xorg-server/hw/xwin/wingetsp.c b/xorg-server/hw/xwin/wingetsp.c
index 0fd0ebce9..1076b5cc5 100644
--- a/xorg-server/hw/xwin/wingetsp.c
+++ b/xorg-server/hw/xwin/wingetsp.c
@@ -1,167 +1,154 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Harold L Hunt II
- * Alan Hourihane <alanh@fairlite.demon.co.uk>
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/* See Porting Layer Definition - p. 55 */
-void
-winGetSpansNativeGDI (DrawablePtr pDrawable,
- int nMax,
- DDXPointPtr pPoints,
- int *piWidths,
- int iSpans,
- char *pDsts)
-{
- PixmapPtr pPixmap = NULL;
- winPrivPixmapPtr pPixmapPriv = NULL;
- int iSpan;
- DDXPointPtr pPoint = NULL;
- int *piWidth = NULL;
- char *pDst = pDsts;
- HBITMAP hbmpWindow, hbmpOrig, hbmpOrig1;
- BYTE *pbWindow = NULL;
- HDC hdcMem, hdcMem1;
- ScreenPtr pScreen = pDrawable->pScreen;
- winScreenPriv(pScreen);
-
- /* Branch on the drawable type */
- switch (pDrawable->type)
- {
- case DRAWABLE_PIXMAP:
- winDebug ("winGetSpans - DRAWABLE_PIXMAP %08x\n",
- pDrawable);
-
- pPixmap = (PixmapPtr) pDrawable;
- pPixmapPriv = winGetPixmapPriv (pPixmap);
-
- /* Open a memory HDC */
- hdcMem1 = CreateCompatibleDC (NULL);
- hdcMem = CreateCompatibleDC (NULL);
-
- /* Select the drawable pixmap into a DC */
- hbmpOrig1 = SelectObject (hdcMem1, pPixmapPriv->hBitmap);
-
- if (hbmpOrig1 == NULL)
- FatalError ("winGetSpans - DRAWABLE_PIXMAP - SelectObject () "
- "failed on pPixmapPriv->hBitmap\n");
-
- /* Loop through spans */
- for (iSpan = 0; iSpan < iSpans; ++iSpan)
- {
- pPoint = pPoints + iSpan;
- piWidth = piWidths + iSpan;
-
- hbmpWindow = winCreateDIBNativeGDI (*piWidth, 1,
- pDrawable->depth,
- &pbWindow,
- NULL);
-
- hbmpOrig = SelectObject (hdcMem, hbmpWindow);
-
- /* Transfer the window bits to the window bitmap */
- BitBlt (hdcMem,
- 0, 0,
- *piWidth, 1,
- hdcMem1,
- pPoint->x, pPoint->y,
- SRCCOPY);
-
- memcpy (pDst,
- (char*) pbWindow,
- PixmapBytePad (*piWidth, pDrawable->depth));
-
- /* Pop the window bitmap out of the HDC and delete the bitmap */
- SelectObject (hdcMem, hbmpOrig);
- DeleteObject (hbmpWindow);
-
- /* Calculate offset of next bit destination */
- pDst += PixmapBytePad (*piWidth, pDrawable->depth);
- }
-
- /* Pop the pixmap's bitmap out of the HDC */
- SelectObject (hdcMem1, hbmpOrig1);
-
- /* Delete the HDCs */
- DeleteDC (hdcMem1);
- DeleteDC (hdcMem);
- break;
-
- case DRAWABLE_WINDOW:
-
- /* Open a memory HDC */
- hdcMem = CreateCompatibleDC (NULL);
-
- /* Loop through spans */
- for (iSpan = 0; iSpan < iSpans; ++iSpan)
- {
- pPoint = pPoints + iSpan;
- piWidth = piWidths + iSpan;
-
- hbmpWindow = winCreateDIBNativeGDI (*piWidth, 1,
- pDrawable->depth,
- &pbWindow,
- NULL);
-
- hbmpOrig = SelectObject (hdcMem, hbmpWindow);
-
- /* Transfer the window bits to the window bitmap */
- BitBlt (hdcMem,
- 0, 0,
- *piWidth, 1,
- pScreenPriv->hdcScreen,
- pPoint->x, pPoint->y,
- SRCCOPY);
-
- memcpy (pDst,
- (char*) pbWindow,
- PixmapBytePad (*piWidth, pDrawable->depth));
-
- /* Pop the window bitmap out of the HDC */
- SelectObject (hdcMem, hbmpOrig);
-
- DeleteObject (hbmpWindow);
-
- /* Calculate offset of next bit destination */
- pDst += PixmapBytePad (*piWidth, pDrawable->depth);
- }
-
- /* Delete the window bitmap */
- DeleteDC (hdcMem);
- break;
-
- default:
- FatalError ("winGetSpans - Unknown drawable type\n");
- break;
- }
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Harold L Hunt II
+ * Alan Hourihane <alanh@fairlite.demon.co.uk>
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+/* See Porting Layer Definition - p. 55 */
+void
+winGetSpansNativeGDI(DrawablePtr pDrawable,
+ int nMax,
+ DDXPointPtr pPoints,
+ int *piWidths, int iSpans, char *pDsts)
+{
+ PixmapPtr pPixmap = NULL;
+ winPrivPixmapPtr pPixmapPriv = NULL;
+ int iSpan;
+ DDXPointPtr pPoint = NULL;
+ int *piWidth = NULL;
+ char *pDst = pDsts;
+ HBITMAP hbmpWindow, hbmpOrig, hbmpOrig1;
+ BYTE *pbWindow = NULL;
+ HDC hdcMem, hdcMem1;
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ winScreenPriv(pScreen);
+
+ /* Branch on the drawable type */
+ switch (pDrawable->type) {
+ case DRAWABLE_PIXMAP:
+ winDebug ("winGetSpans - DRAWABLE_PIXMAP %08x\n", pDrawable);
+
+ pPixmap = (PixmapPtr) pDrawable;
+ pPixmapPriv = winGetPixmapPriv(pPixmap);
+
+ /* Open a memory HDC */
+ hdcMem1 = CreateCompatibleDC(NULL);
+ hdcMem = CreateCompatibleDC(NULL);
+
+ /* Select the drawable pixmap into a DC */
+ hbmpOrig1 = SelectObject(hdcMem1, pPixmapPriv->hBitmap);
+
+ if (hbmpOrig1 == NULL)
+ FatalError("winGetSpans - DRAWABLE_PIXMAP - SelectObject () "
+ "failed on pPixmapPriv->hBitmap\n");
+
+ /* Loop through spans */
+ for (iSpan = 0; iSpan < iSpans; ++iSpan) {
+ pPoint = pPoints + iSpan;
+ piWidth = piWidths + iSpan;
+
+ hbmpWindow = winCreateDIBNativeGDI(*piWidth, 1,
+ pDrawable->depth,
+ &pbWindow, NULL);
+
+ hbmpOrig = SelectObject(hdcMem, hbmpWindow);
+
+ /* Transfer the window bits to the window bitmap */
+ BitBlt(hdcMem,
+ 0, 0, *piWidth, 1, hdcMem1, pPoint->x, pPoint->y, SRCCOPY);
+
+ memcpy(pDst,
+ (char *) pbWindow,
+ PixmapBytePad(*piWidth, pDrawable->depth));
+
+ /* Pop the window bitmap out of the HDC and delete the bitmap */
+ SelectObject(hdcMem, hbmpOrig);
+ DeleteObject(hbmpWindow);
+
+ /* Calculate offset of next bit destination */
+ pDst += PixmapBytePad(*piWidth, pDrawable->depth);
+ }
+
+ /* Pop the pixmap's bitmap out of the HDC */
+ SelectObject(hdcMem1, hbmpOrig1);
+
+ /* Delete the HDCs */
+ DeleteDC(hdcMem1);
+ DeleteDC(hdcMem);
+ break;
+
+ case DRAWABLE_WINDOW:
+
+ /* Open a memory HDC */
+ hdcMem = CreateCompatibleDC(NULL);
+
+ /* Loop through spans */
+ for (iSpan = 0; iSpan < iSpans; ++iSpan) {
+ pPoint = pPoints + iSpan;
+ piWidth = piWidths + iSpan;
+
+ hbmpWindow = winCreateDIBNativeGDI(*piWidth, 1,
+ pDrawable->depth,
+ &pbWindow, NULL);
+
+ hbmpOrig = SelectObject(hdcMem, hbmpWindow);
+
+ /* Transfer the window bits to the window bitmap */
+ BitBlt(hdcMem,
+ 0, 0,
+ *piWidth, 1,
+ pScreenPriv->hdcScreen, pPoint->x, pPoint->y, SRCCOPY);
+
+ memcpy(pDst,
+ (char *) pbWindow,
+ PixmapBytePad(*piWidth, pDrawable->depth));
+
+ /* Pop the window bitmap out of the HDC */
+ SelectObject(hdcMem, hbmpOrig);
+
+ DeleteObject(hbmpWindow);
+
+ /* Calculate offset of next bit destination */
+ pDst += PixmapBytePad(*piWidth, pDrawable->depth);
+ }
+
+ /* Delete the window bitmap */
+ DeleteDC(hdcMem);
+ break;
+
+ default:
+ FatalError("winGetSpans - Unknown drawable type\n");
+ break;
+ }
+}
diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c
index e11a71248..5da959cae 100644
--- a/xorg-server/hw/xwin/winkeybd.c
+++ b/xorg-server/hw/xwin/winkeybd.c
@@ -31,7 +31,6 @@
* Harold L Hunt II
*/
-
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
@@ -49,12 +48,10 @@ static Bool g_winKeyState[NUM_KEYCODES];
*/
static void
-winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
- pointer pCtrl, int iClass);
+ winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, pointer pCtrl, int iClass);
static void
-winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl);
-
+ winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl);
/*
* Translate a Windows WM_[SYS]KEY(UP/DOWN) message
@@ -66,14 +63,14 @@ winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl);
*/
void
-winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
+winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
{
- int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
- int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
- int iParam = HIWORD (lParam);
- int iParamScanCode = LOBYTE (iParam);
+ int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
+ int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
+ int iParam = HIWORD(lParam);
+ int iParamScanCode = LOBYTE(iParam);
- winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
+ winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
/* WM_ key messages faked by Vista speech recognition (WSR) don't have a
* scan code.
@@ -82,129 +79,117 @@ winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
* System.Windows.Forms.SendKeys.SendWait(), which appears always to give a
* scan code of 1
*/
- if (iParamScanCode <= 1)
- {
- if (VK_PRIOR <= wParam && wParam <= VK_DOWN)
- /* Trigger special case table to translate to extended
- * keycode, otherwise if num_lock is on, we can get keypad
- * numbers instead of navigation keys. */
- iParam |= KF_EXTENDED;
- else
- iParamScanCode = MapVirtualKeyEx(wParam,
- /*MAPVK_VK_TO_VSC*/0,
- GetKeyboardLayout(0));
+ if (iParamScanCode <= 1) {
+ if (VK_PRIOR <= wParam && wParam <= VK_DOWN)
+ /* Trigger special case table to translate to extended
+ * keycode, otherwise if num_lock is on, we can get keypad
+ * numbers instead of navigation keys. */
+ iParam |= KF_EXTENDED;
+ else
+ iParamScanCode = MapVirtualKeyEx(wParam,
+ /*MAPVK_VK_TO_VSC */ 0,
+ GetKeyboardLayout(0));
}
- /* Branch on special extended, special non-extended, or normal key */
- if ((iParam & KF_EXTENDED) && iKeyFixupEx)
- *piScanCode = iKeyFixupEx;
- else if (iKeyFixup)
- *piScanCode = iKeyFixup;
- else if (wParam == 0 && iParamScanCode == 0x70)
- *piScanCode = KEY_HKTG;
- else
- switch (iParamScanCode)
- {
- case 0x70:
+ /* Branch on special extended, special non-extended, or normal key */
+ if ((iParam & KF_EXTENDED) && iKeyFixupEx)
+ *piScanCode = iKeyFixupEx;
+ else if (iKeyFixup)
+ *piScanCode = iKeyFixup;
+ else if (wParam == 0 && iParamScanCode == 0x70)
*piScanCode = KEY_HKTG;
- break;
- case 0x73:
- *piScanCode = KEY_BSlash2;
- break;
- default:
- *piScanCode = iParamScanCode;
- break;
- }
+ else
+ switch (iParamScanCode) {
+ case 0x70:
+ *piScanCode = KEY_HKTG;
+ break;
+ case 0x73:
+ *piScanCode = KEY_BSlash2;
+ break;
+ default:
+ *piScanCode = iParamScanCode;
+ break;
+ }
}
-
/* Ring the keyboard bell (system speaker on PCs) */
static void
-winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
- pointer pCtrl, int iClass)
+winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, pointer pCtrl, int iClass)
{
- /*
- * We can't use Beep () here because it uses the PC speaker
- * on NT/2000. MessageBeep (MB_OK) will play the default system
- * sound on systems with a sound card or it will beep the PC speaker
- * on systems that do not have a sound card.
- */
- MessageBeep (MB_OK);
+ /*
+ * We can't use Beep () here because it uses the PC speaker
+ * on NT/2000. MessageBeep (MB_OK) will play the default system
+ * sound on systems with a sound card or it will beep the PC speaker
+ * on systems that do not have a sound card.
+ */
+ MessageBeep(MB_OK);
}
-
/* Change some keyboard configuration parameters */
static void
-winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl)
+winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl)
{
}
-
/*
* See Porting Layer Definition - p. 18
* winKeybdProc is known as a DeviceProc.
*/
int
-winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
+winKeybdProc(DeviceIntPtr pDeviceInt, int iState)
{
- DevicePtr pDevice = (DevicePtr) pDeviceInt;
- XkbSrvInfoPtr xkbi;
- XkbControlsPtr ctrl;
+ DevicePtr pDevice = (DevicePtr) pDeviceInt;
+ XkbSrvInfoPtr xkbi;
+ XkbControlsPtr ctrl;
- switch (iState)
- {
+ switch (iState) {
case DEVICE_INIT:
- winConfigKeyboard (pDeviceInt);
-
- /* FIXME: Maybe we should use winGetKbdLeds () here? */
- defaultKeyboardControl.leds = g_winInfo.keyboard.leds;
-
- winDebug("Rules = \"%s\" Model = \"%s\" Layout = \"%s\""
- " Variant = \"%s\" Options = \"%s\"\n",
- g_winInfo.xkb.rules ? g_winInfo.xkb.rules : "none",
- g_winInfo.xkb.model ? g_winInfo.xkb.model : "none",
- g_winInfo.xkb.layout ? g_winInfo.xkb.layout : "none",
- g_winInfo.xkb.variant ? g_winInfo.xkb.variant : "none",
- g_winInfo.xkb.options ? g_winInfo.xkb.options : "none");
-
- InitKeyboardDeviceStruct (pDeviceInt,
- &g_winInfo.xkb,
- winKeybdBell,
- winKeybdCtrl);
-
- xkbi = pDeviceInt->key->xkbInfo;
- if ((xkbi != NULL) && (xkbi->desc != NULL))
- {
- ctrl = xkbi->desc->ctrls;
- ctrl->repeat_delay = g_winInfo.keyboard.delay;
- ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate;
+ winConfigKeyboard(pDeviceInt);
+
+ /* FIXME: Maybe we should use winGetKbdLeds () here? */
+ defaultKeyboardControl.leds = g_winInfo.keyboard.leds;
+
+ winDebug("Rules = \"%s\" Model = \"%s\" Layout = \"%s\""
+ " Variant = \"%s\" Options = \"%s\"\n",
+ g_winInfo.xkb.rules ? g_winInfo.xkb.rules : "none",
+ g_winInfo.xkb.model ? g_winInfo.xkb.model : "none",
+ g_winInfo.xkb.layout ? g_winInfo.xkb.layout : "none",
+ g_winInfo.xkb.variant ? g_winInfo.xkb.variant : "none",
+ g_winInfo.xkb.options ? g_winInfo.xkb.options : "none");
+
+ InitKeyboardDeviceStruct(pDeviceInt,
+ &g_winInfo.xkb, winKeybdBell, winKeybdCtrl);
+
+ xkbi = pDeviceInt->key->xkbInfo;
+ if ((xkbi != NULL) && (xkbi->desc != NULL)) {
+ ctrl = xkbi->desc->ctrls;
+ ctrl->repeat_delay = g_winInfo.keyboard.delay;
+ ctrl->repeat_interval = 1000 / g_winInfo.keyboard.rate;
}
- else
- {
- winDebug ("winKeybdProc - Error initializing keyboard AutoRepeat\n");
+ else {
+ winDebug ("winKeybdProc - Error initializing keyboard AutoRepeat\n");
}
- break;
-
- case DEVICE_ON:
- pDevice->on = TRUE;
+ break;
- // immediately copy the state of this keyboard device to the VCK
- // (which otherwise happens lazily after the first keypress)
- CopyKeyClass(pDeviceInt, inputInfo.keyboard);
- break;
+ case DEVICE_ON:
+ pDevice->on = TRUE;
+
+ // immediately copy the state of this keyboard device to the VCK
+ // (which otherwise happens lazily after the first keypress)
+ CopyKeyClass(pDeviceInt, inputInfo.keyboard);
+ break;
case DEVICE_CLOSE:
- case DEVICE_OFF:
- pDevice->on = FALSE;
- break;
+ case DEVICE_OFF:
+ pDevice->on = FALSE;
+ break;
}
- return Success;
+ return Success;
}
-
/*
* Detect current mode key states upon server startup.
*
@@ -213,38 +198,33 @@ winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
*/
void
-winInitializeModeKeyStates (void)
+winInitializeModeKeyStates(void)
{
- /* Restore NumLock */
- if (GetKeyState (VK_NUMLOCK) & 0x0001)
- {
- winSendKeyEvent (KEY_NumLock, TRUE);
- winSendKeyEvent (KEY_NumLock, FALSE);
+ /* Restore NumLock */
+ if (GetKeyState(VK_NUMLOCK) & 0x0001) {
+ winSendKeyEvent(KEY_NumLock, TRUE);
+ winSendKeyEvent(KEY_NumLock, FALSE);
}
- /* Restore CapsLock */
- if (GetKeyState (VK_CAPITAL) & 0x0001)
- {
- winSendKeyEvent (KEY_CapsLock, TRUE);
- winSendKeyEvent (KEY_CapsLock, FALSE);
+ /* Restore CapsLock */
+ if (GetKeyState(VK_CAPITAL) & 0x0001) {
+ winSendKeyEvent(KEY_CapsLock, TRUE);
+ winSendKeyEvent(KEY_CapsLock, FALSE);
}
- /* Restore ScrollLock */
- if (GetKeyState (VK_SCROLL) & 0x0001)
- {
- winSendKeyEvent (KEY_ScrollLock, TRUE);
- winSendKeyEvent (KEY_ScrollLock, FALSE);
+ /* Restore ScrollLock */
+ if (GetKeyState(VK_SCROLL) & 0x0001) {
+ winSendKeyEvent(KEY_ScrollLock, TRUE);
+ winSendKeyEvent(KEY_ScrollLock, FALSE);
}
- /* Restore KanaLock */
- if (GetKeyState (VK_KANA) & 0x0001)
- {
- winSendKeyEvent (KEY_HKTG, TRUE);
- winSendKeyEvent (KEY_HKTG, FALSE);
+ /* Restore KanaLock */
+ if (GetKeyState(VK_KANA) & 0x0001) {
+ winSendKeyEvent(KEY_HKTG, TRUE);
+ winSendKeyEvent(KEY_HKTG, FALSE);
}
}
-
/*
* Upon regaining the keyboard focus we must
* resynchronize our internal mode key states
@@ -252,29 +232,31 @@ winInitializeModeKeyStates (void)
*/
void
-winRestoreModeKeyStates (void)
+winRestoreModeKeyStates(void)
{
- DWORD dwKeyState;
- BOOL processEvents = TRUE;
- unsigned short internalKeyStates;
-
- /* X server is being initialized */
- if (!inputInfo.keyboard)
- return;
-
- /* Only process events if the rootwindow is mapped. The keyboard events
- * will cause segfaults otherwise */
- if (screenInfo.screens[0]->root && screenInfo.screens[0]->root->mapped == FALSE)
- processEvents = FALSE;
-
- /* Force to process all pending events in the mi event queue */
- if (processEvents)
- mieqProcessInputEvents ();
-
- /* Read the mode key states of our X server */
- /* (stored in the virtual core keyboard) */
- internalKeyStates = XkbStateFieldFromRec(&inputInfo.keyboard->key->xkbInfo->state);
- winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates);
+ DWORD dwKeyState;
+ BOOL processEvents = TRUE;
+ unsigned short internalKeyStates;
+
+ /* X server is being initialized */
+ if (!inputInfo.keyboard)
+ return;
+
+ /* Only process events if the rootwindow is mapped. The keyboard events
+ * will cause segfaults otherwise */
+ if (screenInfo.screens[0]->root &&
+ screenInfo.screens[0]->root->mapped == FALSE)
+ processEvents = FALSE;
+
+ /* Force to process all pending events in the mi event queue */
+ if (processEvents)
+ mieqProcessInputEvents();
+
+ /* Read the mode key states of our X server */
+ /* (stored in the virtual core keyboard) */
+ internalKeyStates =
+ XkbStateFieldFromRec(&inputInfo.keyboard->key->xkbInfo->state);
+ winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates);
{
/* Make sure the message queue is empty, otherwise the GetKeyState will not always
@@ -291,11 +273,11 @@ winRestoreModeKeyStates (void)
}
}
- /*
- * NOTE: The C XOR operator, ^, will not work here because it is
- * a bitwise operator, not a logical operator. C does not
- * have a logical XOR operator, so we use a macro instead.
- */
+ /*
+ * NOTE: The C XOR operator, ^, will not work here because it is
+ * a bitwise operator, not a logical operator. C does not
+ * have a logical XOR operator, so we use a macro instead.
+ */
{
/* consider modifer keys */
@@ -320,204 +302,182 @@ winRestoreModeKeyStates (void)
winSendKeyEvent (KEY_AltLang, altgr);
}
- /* Has the key state changed? */
- dwKeyState = GetKeyState (VK_NUMLOCK) & 0x0001;
- if (WIN_XOR (internalKeyStates & NumLockMask, dwKeyState))
- {
- winSendKeyEvent (KEY_NumLock, TRUE);
- winSendKeyEvent (KEY_NumLock, FALSE);
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState(VK_NUMLOCK) & 0x0001;
+ if (WIN_XOR(internalKeyStates & NumLockMask, dwKeyState)) {
+ winSendKeyEvent(KEY_NumLock, TRUE);
+ winSendKeyEvent(KEY_NumLock, FALSE);
}
- /* Has the key state changed? */
- dwKeyState = GetKeyState (VK_CAPITAL) & 0x0001;
- if (WIN_XOR (internalKeyStates & LockMask, dwKeyState))
- {
- winSendKeyEvent (KEY_CapsLock, TRUE);
- winSendKeyEvent (KEY_CapsLock, FALSE);
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState(VK_CAPITAL) & 0x0001;
+ if (WIN_XOR(internalKeyStates & LockMask, dwKeyState)) {
+ winSendKeyEvent(KEY_CapsLock, TRUE);
+ winSendKeyEvent(KEY_CapsLock, FALSE);
}
- /* Has the key state changed? */
- dwKeyState = GetKeyState (VK_SCROLL) & 0x0001;
- if (WIN_XOR (internalKeyStates & ScrollLockMask, dwKeyState))
- {
- winSendKeyEvent (KEY_ScrollLock, TRUE);
- winSendKeyEvent (KEY_ScrollLock, FALSE);
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState(VK_SCROLL) & 0x0001;
+ if (WIN_XOR(internalKeyStates & ScrollLockMask, dwKeyState)) {
+ winSendKeyEvent(KEY_ScrollLock, TRUE);
+ winSendKeyEvent(KEY_ScrollLock, FALSE);
}
- /* Has the key state changed? */
- dwKeyState = GetKeyState (VK_KANA) & 0x0001;
- if (WIN_XOR (internalKeyStates & KanaMask, dwKeyState))
- {
- winSendKeyEvent (KEY_HKTG, TRUE);
- winSendKeyEvent (KEY_HKTG, FALSE);
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState(VK_KANA) & 0x0001;
+ if (WIN_XOR(internalKeyStates & KanaMask, dwKeyState)) {
+ winSendKeyEvent(KEY_HKTG, TRUE);
+ winSendKeyEvent(KEY_HKTG, FALSE);
}
}
-
/*
* Look for the lovely fake Control_L press/release generated by Windows
* when AltGr is pressed/released on a non-U.S. keyboard.
*/
Bool
-winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
+winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam)
{
- MSG msgNext;
- LONG lTime;
- Bool fReturn;
-
- static Bool lastWasControlL = FALSE;
- static UINT lastMessage;
- static LONG lastTime;
-
- /*
- * Fake Ctrl_L presses will be followed by an Alt_R press
- * with the same timestamp as the Ctrl_L press.
- */
- if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
- && wParam == VK_CONTROL
- && (HIWORD (lParam) & KF_EXTENDED) == 0)
- {
- /* Got a Ctrl_L press */
-
- /* Get time of current message */
- lTime = GetMessageTime ();
-
- /* Look for next press message */
- fReturn = PeekMessage (&msgNext, NULL,
- WM_KEYDOWN, WM_SYSKEYDOWN,
- PM_NOREMOVE);
-
- if (fReturn && msgNext.message != WM_KEYDOWN && msgNext.message != WM_SYSKEYDOWN)
- fReturn = 0;
-
- if (!fReturn)
- {
- lastWasControlL = TRUE;
- lastMessage = message;
- lastTime = lTime;
+ MSG msgNext;
+ LONG lTime;
+ Bool fReturn;
+
+ static Bool lastWasControlL = FALSE;
+ static UINT lastMessage;
+ static LONG lastTime;
+
+ /*
+ * Fake Ctrl_L presses will be followed by an Alt_R press
+ * with the same timestamp as the Ctrl_L press.
+ */
+ if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
+ && wParam == VK_CONTROL && (HIWORD(lParam) & KF_EXTENDED) == 0) {
+ /* Got a Ctrl_L press */
+
+ /* Get time of current message */
+ lTime = GetMessageTime();
+
+ /* Look for next press message */
+ fReturn = PeekMessage(&msgNext, NULL,
+ WM_KEYDOWN, WM_SYSKEYDOWN, PM_NOREMOVE);
+
+ if (fReturn && msgNext.message != WM_KEYDOWN &&
+ msgNext.message != WM_SYSKEYDOWN)
+ fReturn = 0;
+
+ if (!fReturn) {
+ lastWasControlL = TRUE;
+ lastMessage = message;
+ lastTime = lTime;
}
- else
- {
- lastWasControlL = FALSE;
+ else {
+ lastWasControlL = FALSE;
}
- /* Is next press an Alt_R with the same timestamp? */
- if (fReturn && msgNext.wParam == VK_MENU
- && msgNext.time == lTime
- && (HIWORD (msgNext.lParam) & KF_EXTENDED))
- {
- /*
- * Next key press is Alt_R with same timestamp as current
- * Ctrl_L message. Therefore, this Ctrl_L press is a fake
- * event, so discard it.
- */
- return TRUE;
- }
+ /* Is next press an Alt_R with the same timestamp? */
+ if (fReturn && msgNext.wParam == VK_MENU
+ && msgNext.time == lTime
+ && (HIWORD(msgNext.lParam) & KF_EXTENDED)) {
+ /*
+ * Next key press is Alt_R with same timestamp as current
+ * Ctrl_L message. Therefore, this Ctrl_L press is a fake
+ * event, so discard it.
+ */
+ return TRUE;
+ }
}
- /*
- * Sometimes, the Alt_R press message is not yet posted when the
- * fake Ctrl_L press message arrives (even though it has the
- * same timestamp), so check for an Alt_R press message that has
- * arrived since the last Ctrl_L message.
- */
- else if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
- && wParam == VK_MENU
- && (HIWORD (lParam) & KF_EXTENDED))
- {
- /* Got a Alt_R press */
-
- if (lastWasControlL)
- {
- lTime = GetMessageTime ();
-
- if (lastTime == lTime)
- {
+ /*
+ * Sometimes, the Alt_R press message is not yet posted when the
+ * fake Ctrl_L press message arrives (even though it has the
+ * same timestamp), so check for an Alt_R press message that has
+ * arrived since the last Ctrl_L message.
+ */
+ else if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
+ && wParam == VK_MENU && (HIWORD(lParam) & KF_EXTENDED)) {
+ /* Got a Alt_R press */
+
+ if (lastWasControlL) {
+ lTime = GetMessageTime();
+
+ if (lastTime == lTime) {
/* Undo the fake Ctrl_L press by sending a fake Ctrl_L release */
- winSendKeyEvent (KEY_LCtrl, FALSE);
+ winSendKeyEvent(KEY_LCtrl, FALSE);
}
- lastWasControlL = FALSE;
+ lastWasControlL = FALSE;
}
}
- /*
- * Fake Ctrl_L releases will be followed by an Alt_R release
- * with the same timestamp as the Ctrl_L release.
- */
- else if ((message == WM_KEYUP || message == WM_SYSKEYUP)
- && wParam == VK_CONTROL
- && (HIWORD (lParam) & KF_EXTENDED) == 0)
- {
- /* Got a Ctrl_L release */
-
- /* Get time of current message */
- lTime = GetMessageTime ();
-
- /* Look for next release message */
- fReturn = PeekMessage (&msgNext, NULL,
- WM_KEYUP, WM_SYSKEYUP,
- PM_NOREMOVE);
-
- if (fReturn && msgNext.message != WM_KEYUP && msgNext.message != WM_SYSKEYUP)
- fReturn = 0;
-
- lastWasControlL = FALSE;
-
- /* Is next press an Alt_R with the same timestamp? */
- if (fReturn
- && (msgNext.message == WM_KEYUP
- || msgNext.message == WM_SYSKEYUP)
- && msgNext.wParam == VK_MENU
- && msgNext.time == lTime
- && (HIWORD (msgNext.lParam) & KF_EXTENDED))
- {
- /*
- * Next key release is Alt_R with same timestamp as current
- * Ctrl_L message. Therefore, this Ctrl_L release is a fake
- * event, so discard it.
- */
- return TRUE;
- }
+ /*
+ * Fake Ctrl_L releases will be followed by an Alt_R release
+ * with the same timestamp as the Ctrl_L release.
+ */
+ else if ((message == WM_KEYUP || message == WM_SYSKEYUP)
+ && wParam == VK_CONTROL && (HIWORD(lParam) & KF_EXTENDED) == 0) {
+ /* Got a Ctrl_L release */
+
+ /* Get time of current message */
+ lTime = GetMessageTime();
+
+ /* Look for next release message */
+ fReturn = PeekMessage(&msgNext, NULL,
+ WM_KEYUP, WM_SYSKEYUP, PM_NOREMOVE);
+
+ if (fReturn && msgNext.message != WM_KEYUP &&
+ msgNext.message != WM_SYSKEYUP)
+ fReturn = 0;
+
+ lastWasControlL = FALSE;
+
+ /* Is next press an Alt_R with the same timestamp? */
+ if (fReturn
+ && (msgNext.message == WM_KEYUP || msgNext.message == WM_SYSKEYUP)
+ && msgNext.wParam == VK_MENU
+ && msgNext.time == lTime
+ && (HIWORD(msgNext.lParam) & KF_EXTENDED)) {
+ /*
+ * Next key release is Alt_R with same timestamp as current
+ * Ctrl_L message. Therefore, this Ctrl_L release is a fake
+ * event, so discard it.
+ */
+ return TRUE;
+ }
}
- else
- {
- /* On any other press or release message, we don't have a
- potentially fake Ctrl_L to worry about anymore... */
- lastWasControlL = FALSE;
+ else {
+ /* On any other press or release message, we don't have a
+ potentially fake Ctrl_L to worry about anymore... */
+ lastWasControlL = FALSE;
}
- /* Not a fake control left press/release */
- return FALSE;
+ /* Not a fake control left press/release */
+ return FALSE;
}
-
/*
* Lift any modifier keys that are pressed
*/
void
-winKeybdReleaseKeys (void)
+winKeybdReleaseKeys(void)
{
- int i;
+ int i;
#ifdef HAS_DEVWINDOWS
- /* Verify that the mi input system has been initialized */
- if (g_fdMessageQueue == WIN_FD_INVALID)
- return;
+ /* Verify that the mi input system has been initialized */
+ if (g_fdMessageQueue == WIN_FD_INVALID)
+ return;
#endif
- /* Loop through all keys */
- for (i = 0; i < NUM_KEYCODES; ++i)
- {
- /* Pop key if pressed */
- if (g_winKeyState[i])
- winSendKeyEvent (i, FALSE);
+ /* Loop through all keys */
+ for (i = 0; i < NUM_KEYCODES; ++i) {
+ /* Pop key if pressed */
+ if (g_winKeyState[i])
+ winSendKeyEvent(i, FALSE);
- /* Reset pressed flag for keys */
- g_winKeyState[i] = FALSE;
+ /* Reset pressed flag for keys */
+ g_winKeyState[i] = FALSE;
}
}
-
/*
* Take a raw X key code and send an up or down event for it.
*
@@ -525,55 +485,57 @@ winKeybdReleaseKeys (void)
*/
void
-winSendKeyEvent (DWORD dwKey, Bool fDown)
+winSendKeyEvent(DWORD dwKey, Bool fDown)
{
- /*
- * When alt-tabing between screens we can get phantom key up messages
- * Here we only pass them through it we think we should!
- */
- if (g_winKeyState[dwKey] == FALSE && fDown == FALSE) return;
+ /*
+ * When alt-tabing between screens we can get phantom key up messages
+ * Here we only pass them through it we think we should!
+ */
+ if (g_winKeyState[dwKey] == FALSE && fDown == FALSE)
+ return;
- /* Update the keyState map */
- g_winKeyState[dwKey] = fDown;
+ /* Update the keyState map */
+ g_winKeyState[dwKey] = fDown;
- QueueKeyboardEvents(g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE, NULL);
+ QueueKeyboardEvents(g_pwinKeyboard, fDown ? KeyPress : KeyRelease,
+ dwKey + MIN_KEYCODE, NULL);
- winDebug("winSendKeyEvent: dwKey: %d, fDown: %d\n",
- dwKey, fDown);
+ winDebug("winSendKeyEvent: dwKey: %d, fDown: %d\n", dwKey, fDown);
}
-BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
+BOOL
+winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
{
- switch (wParam)
- {
+ switch (wParam) {
case VK_CONTROL:
- if ((lParam & 0x1ff0000) == 0x11d0000 && g_winKeyState[KEY_RCtrl])
- return TRUE;
- if ((lParam & 0x1ff0000) == 0x01d0000 && g_winKeyState[KEY_LCtrl])
- return TRUE;
- break;
+ if ((lParam & 0x1ff0000) == 0x11d0000 && g_winKeyState[KEY_RCtrl])
+ return TRUE;
+ if ((lParam & 0x1ff0000) == 0x01d0000 && g_winKeyState[KEY_LCtrl])
+ return TRUE;
+ break;
case VK_SHIFT:
- if ((lParam & 0x1ff0000) == 0x0360000 && g_winKeyState[KEY_ShiftR])
- return TRUE;
- if ((lParam & 0x1ff0000) == 0x02a0000 && g_winKeyState[KEY_ShiftL])
- return TRUE;
- break;
+ if ((lParam & 0x1ff0000) == 0x0360000 && g_winKeyState[KEY_ShiftR])
+ return TRUE;
+ if ((lParam & 0x1ff0000) == 0x02a0000 && g_winKeyState[KEY_ShiftL])
+ return TRUE;
+ break;
default:
- return TRUE;
- }
- return FALSE;
+ return TRUE;
+ }
+ return FALSE;
}
/* Only on shift release message is sent even if both are pressed.
* Fix this here
*/
-void winFixShiftKeys (int iScanCode)
+void
+winFixShiftKeys(int iScanCode)
{
- if (GetKeyState (VK_SHIFT) & 0x8000)
- return;
+ if (GetKeyState(VK_SHIFT) & 0x8000)
+ return;
- if (iScanCode == KEY_ShiftL && g_winKeyState[KEY_ShiftR])
- winSendKeyEvent (KEY_ShiftR, FALSE);
- if (iScanCode == KEY_ShiftR && g_winKeyState[KEY_ShiftL])
- winSendKeyEvent (KEY_ShiftL, FALSE);
+ if (iScanCode == KEY_ShiftL && g_winKeyState[KEY_ShiftR])
+ winSendKeyEvent(KEY_ShiftR, FALSE);
+ if (iScanCode == KEY_ShiftR && g_winKeyState[KEY_ShiftL])
+ winSendKeyEvent(KEY_ShiftL, FALSE);
}
diff --git a/xorg-server/hw/xwin/winkeybd.h b/xorg-server/hw/xwin/winkeybd.h
index 292d05cb6..545aef751 100644
--- a/xorg-server/hw/xwin/winkeybd.h
+++ b/xorg-server/hw/xwin/winkeybd.h
@@ -45,264 +45,266 @@
* may not be associated with the appropriate scan code/extended bit
*/
const int
-g_iKeyMap [] = {
- /* count Windows VK, ASCII, ASCII when extended VK */
- /* 0 */ 0, 0, 0,
- /* 1 */ 0, 0, 0,
- /* 2 */ 0, 0, 0,
- /* 3 */ VK_CANCEL, 0, KEY_Break,
- /* 4 */ 0, 0, 0,
- /* 5 */ 0, 0, 0,
- /* 6 */ 0, 0, 0,
- /* 7 */ 0, 0, 0,
- /* 8 */ 0, 0, 0,
- /* 9 */ 0, 0, 0,
- /* 10 */ 0, 0, 0,
- /* 11 */ 0, 0, 0,
- /* 12 */ 0, 0, 0,
- /* 13 */ VK_RETURN, 0, KEY_KP_Enter,
- /* 14 */ 0, 0, 0,
- /* 15 */ 0, 0, 0,
- /* 16 */ VK_SHIFT, 0, 0,
- /* 17 */ VK_CONTROL, 0, KEY_RCtrl,
- /* 18 */ VK_MENU, 0, KEY_AltLang,
- /* 19 */ VK_PAUSE, KEY_Pause, 0,
- /* 20 */ 0, 0, 0,
- /* 21 */ 0, 0, 0,
- /* 22 */ 0, 0, 0,
- /* 23 */ 0, 0, 0,
- /* 24 */ 0, 0, 0,
- /* 25 */ 0, 0, 0,
- /* 26 */ 0, 0, 0,
- /* 27 */ 0, 0, 0,
- /* 28 */ 0, 0, 0,
- /* 29 */ 0, 0, 0,
- /* 30 */ 0, 0, 0,
- /* 31 */ 0, 0, 0,
- /* 32 */ 0, 0, 0,
- /* 33 */ VK_PRIOR, KEY_PgUp, KEY_PgUp,
- /* 34 */ VK_NEXT, KEY_PgDown, KEY_PgDown,
- /* 35 */ VK_END, KEY_End, KEY_End,
- /* 36 */ VK_HOME, KEY_Home, KEY_Home,
- /* 37 */ VK_LEFT, KEY_Left, KEY_Left,
- /* 38 */ VK_UP, KEY_Up, KEY_Up,
- /* 39 */ VK_RIGHT, KEY_Right, KEY_Right,
- /* 40 */ VK_DOWN, KEY_Down, KEY_Down,
- /* 41 */ 0, 0, 0,
- /* 42 */ 0, 0, 0,
- /* 43 */ 0, 0, 0,
- /* 44 */ VK_SNAPSHOT, 0, KEY_Print,
- /* 45 */ VK_INSERT, 0, KEY_Insert,
- /* 46 */ VK_DELETE, 0, KEY_Delete,
- /* 47 */ 0, 0, 0,
- /* 48 */ 0, 0, 0,
- /* 49 */ 0, 0, 0,
- /* 50 */ 0, 0, 0,
- /* 51 */ 0, 0, 0,
- /* 52 */ 0, 0, 0,
- /* 53 */ 0, 0, 0,
- /* 54 */ 0, 0, 0,
- /* 55 */ 0, 0, 0,
- /* 56 */ 0, 0, 0,
- /* 57 */ 0, 0, 0,
- /* 58 */ 0, 0, 0,
- /* 59 */ 0, 0, 0,
- /* 60 */ 0, 0, 0,
- /* 61 */ 0, 0, 0,
- /* 62 */ 0, 0, 0,
- /* 63 */ 0, 0, 0,
- /* 64 */ 0, 0, 0,
- /* 65 */ 0, 0, 0,
- /* 66 */ 0, 0, 0,
- /* 67 */ 0, 0, 0,
- /* 68 */ 0, 0, 0,
- /* 69 */ 0, 0, 0,
- /* 70 */ 0, 0, 0,
- /* 71 */ 0, 0, 0,
- /* 72 */ 0, 0, 0,
- /* 73 */ 0, 0, 0,
- /* 74 */ 0, 0, 0,
- /* 75 */ 0, 0, 0,
- /* 76 */ 0, 0, 0,
- /* 77 */ 0, 0, 0,
- /* 78 */ 0, 0, 0,
- /* 79 */ 0, 0, 0,
- /* 80 */ 0, 0, 0,
- /* 81 */ 0, 0, 0,
- /* 82 */ 0, 0, 0,
- /* 83 */ 0, 0, 0,
- /* 84 */ 0, 0, 0,
- /* 85 */ 0, 0, 0,
- /* 86 */ 0, 0, 0,
- /* 87 */ 0, 0, 0,
- /* 88 */ 0, 0, 0,
- /* 89 */ 0, 0, 0,
- /* 90 */ 0, 0, 0,
- /* 91 */ VK_LWIN, KEY_LMeta, 0,
- /* 92 */ VK_RWIN, KEY_RMeta, 0,
- /* 93 */ VK_APPS, KEY_Menu, 0,
- /* 94 */ 0, 0, 0,
- /* 95 */ 0, 0, 0,
- /* 96 */ 0, 0, 0,
- /* 97 */ 0, 0, 0,
- /* 98 */ 0, 0, 0,
- /* 99 */ 0, 0, 0,
- /* 100 */ 0, 0, 0,
- /* 101 */ 0, 0, 0,
- /* 102 */ 0, 0, 0,
- /* 103 */ 0, 0, 0,
- /* 104 */ 0, 0, 0,
- /* 105 */ 0, 0, 0,
- /* 106 */ 0, 0, 0,
- /* 107 */ 0, 0, 0,
- /* 108 */ 0, 0, 0,
- /* 109 */ 0, 0, 0,
- /* 110 */ 0, 0, 0,
- /* 111 */ VK_DIVIDE, 0, KEY_KP_Divide,
- /* 112 */ 0, 0, 0,
- /* 113 */ 0, 0, 0,
- /* 114 */ 0, 0, 0,
- /* 115 */ 0, 0, 0,
- /* 116 */ 0, 0, 0,
- /* 117 */ 0, 0, 0,
- /* 118 */ 0, 0, 0,
- /* 119 */ 0, 0, 0,
- /* 120 */ 0, 0, 0,
- /* 121 */ 0, 0, 0,
- /* 122 */ 0, 0, 0,
- /* 123 */ 0, 0, 0,
- /* 124 */ 0, 0, 0,
- /* 125 */ 0, 0, 0,
- /* 126 */ 0, 0, 0,
- /* 127 */ 0, 0, 0,
- /* 128 */ 0, 0, 0,
- /* 129 */ 0, 0, 0,
- /* 130 */ 0, 0, 0,
- /* 131 */ 0, 0, 0,
- /* 132 */ 0, 0, 0,
- /* 133 */ 0, 0, 0,
- /* 134 */ 0, 0, 0,
- /* 135 */ 0, 0, 0,
- /* 136 */ 0, 0, 0,
- /* 137 */ 0, 0, 0,
- /* 138 */ 0, 0, 0,
- /* 139 */ 0, 0, 0,
- /* 140 */ 0, 0, 0,
- /* 141 */ 0, 0, 0,
- /* 142 */ 0, 0, 0,
- /* 143 */ 0, 0, 0,
- /* 144 */ 0, 0, 0,
- /* 145 */ 0, 0, 0,
- /* 146 */ 0, 0, 0,
- /* 147 */ 0, 0, 0,
- /* 148 */ 0, 0, 0,
- /* 149 */ 0, 0, 0,
- /* 150 */ 0, 0, 0,
- /* 151 */ 0, 0, 0,
- /* 152 */ 0, 0, 0,
- /* 153 */ 0, 0, 0,
- /* 154 */ 0, 0, 0,
- /* 155 */ 0, 0, 0,
- /* 156 */ 0, 0, 0,
- /* 157 */ 0, 0, 0,
- /* 158 */ 0, 0, 0,
- /* 159 */ 0, 0, 0,
- /* 160 */ VK_LSHIFT, KEY_ShiftL, KEY_ShiftL,
- /* 161 */ VK_RSHIFT, KEY_ShiftR, KEY_ShiftR,
- /* 162 */ VK_LCONTROL, KEY_LCtrl, KEY_LCtrl,
- /* 163 */ VK_RCONTROL, KEY_RCtrl, KEY_RCtrl,
- /* 164 */ VK_LMENU, KEY_Alt, KEY_Alt,
- /* 165 */ VK_RMENU, KEY_AltLang, KEY_AltLang,
- /* 166 */ 0, 0, 0,
- /* 167 */ 0, 0, 0,
- /* 168 */ 0, 0, 0,
- /* 169 */ 0, 0, 0,
- /* 170 */ 0, 0, 0,
- /* 171 */ 0, 0, 0,
- /* 172 */ 0, 0, 0,
- /* 173 */ VK_VOLUME_MUTE, 0, KEY_Mute,
- /* 174 */ VK_VOLUME_DOWN, 0, KEY_AudioLower,
- /* 175 */ VK_VOLUME_UP, 0, KEY_AudioRaise,
- /* 176 */ VK_MEDIA_NEXT_TRACK, 0, KEY_NEXTSONG,
- /* 177 */ VK_MEDIA_PREV_TRACK, 0, KEY_PREVIOUSSONG,
- /* 178 */ VK_MEDIA_STOP, 0, KEY_STOPCD,
- /* 179 */ VK_MEDIA_PLAY_PAUSE, 0, KEY_PLAYPAUSE,
- /* 180 */ 0, 0, 0,
- /* 181 */ 0, 0, 0,
- /* 182 */ 0, 0, 0,
- /* 183 */ 0, 0, 0,
- /* 184 */ 0, 0, 0,
- /* 185 */ 0, 0, 0,
- /* 186 */ 0, 0, 0,
- /* 187 */ 0, 0, 0,
- /* 188 */ 0, 0, 0,
- /* 189 */ 0, 0, 0,
- /* 190 */ 0, 0, 0,
- /* 191 */ 0, 0, 0,
- /* 192 */ 0, 0, 0,
- /* 193 */ 0, 0, 0,
- /* 194 */ 0, 0, 0,
- /* 195 */ 0, 0, 0,
- /* 196 */ 0, 0, 0,
- /* 197 */ 0, 0, 0,
- /* 198 */ 0, 0, 0,
- /* 199 */ 0, 0, 0,
- /* 200 */ 0, 0, 0,
- /* 201 */ 0, 0, 0,
- /* 202 */ 0, 0, 0,
- /* 203 */ 0, 0, 0,
- /* 204 */ 0, 0, 0,
- /* 205 */ 0, 0, 0,
- /* 206 */ 0, 0, 0,
- /* 207 */ 0, 0, 0,
- /* 208 */ 0, 0, 0,
- /* 209 */ 0, 0, 0,
- /* 210 */ 0, 0, 0,
- /* 211 */ 0, 0, 0,
- /* 212 */ 0, 0, 0,
- /* 213 */ 0, 0, 0,
- /* 214 */ 0, 0, 0,
- /* 215 */ 0, 0, 0,
- /* 216 */ 0, 0, 0,
- /* 217 */ 0, 0, 0,
- /* 218 */ 0, 0, 0,
- /* 219 */ 0, 0, 0,
- /* 220 */ 0, 0, 0,
- /* 221 */ 0, 0, 0,
- /* 222 */ 0, 0, 0,
- /* 223 */ VK_OEM_8, 0, KEY_RCtrl, /* at least on Canadian Multilingual Standard layout */
- /* 224 */ 0, 0, 0,
- /* 225 */ 0, 0, 0,
- /* 226 */ 0, 0, 0,
- /* 227 */ 0, 0, 0,
- /* 228 */ 0, 0, 0,
- /* 229 */ 0, 0, 0,
- /* 230 */ 0, 0, 0,
- /* 231 */ 0, 0, 0,
- /* 232 */ 0, 0, 0,
- /* 233 */ 0, 0, 0,
- /* 234 */ 0, 0, 0,
- /* 235 */ 0, 0, 0,
- /* 236 */ 0, 0, 0,
- /* 237 */ 0, 0, 0,
- /* 238 */ 0, 0, 0,
- /* 239 */ 0, 0, 0,
- /* 240 */ 0, 0, 0,
- /* 241 */ 0, 0, 0,
- /* 242 */ 0, 0, 0,
- /* 243 */ 0, 0, 0,
- /* 244 */ 0, 0, 0,
- /* 245 */ 0, 0, 0,
- /* 246 */ 0, 0, 0,
- /* 247 */ 0, 0, 0,
- /* 248 */ 0, 0, 0,
- /* 249 */ 0, 0, 0,
- /* 250 */ 0, 0, 0,
- /* 251 */ 0, 0, 0,
- /* 252 */ 0, 0, 0,
- /* 253 */ 0, 0, 0,
- /* 254 */ 0, 0, 0,
- /* 255 */ VK_FN, 0, KEY_Fn /* Most keyboards don't generate a scancode for Fn, but a few do... */
+ g_iKeyMap[] = {
+ /* count Windows VK, ASCII, ASCII when extended VK */
+ /* 0 */ 0, 0, 0,
+ /* 1 */ 0, 0, 0,
+ /* 2 */ 0, 0, 0,
+ /* 3 */ VK_CANCEL, 0, KEY_Break,
+ /* 4 */ 0, 0, 0,
+ /* 5 */ 0, 0, 0,
+ /* 6 */ 0, 0, 0,
+ /* 7 */ 0, 0, 0,
+ /* 8 */ 0, 0, 0,
+ /* 9 */ 0, 0, 0,
+ /* 10 */ 0, 0, 0,
+ /* 11 */ 0, 0, 0,
+ /* 12 */ 0, 0, 0,
+ /* 13 */ VK_RETURN, 0, KEY_KP_Enter,
+ /* 14 */ 0, 0, 0,
+ /* 15 */ 0, 0, 0,
+ /* 16 */ VK_SHIFT, 0, 0,
+ /* 17 */ VK_CONTROL, 0, KEY_RCtrl,
+ /* 18 */ VK_MENU, 0, KEY_AltLang,
+ /* 19 */ VK_PAUSE, KEY_Pause, 0,
+ /* 20 */ 0, 0, 0,
+ /* 21 */ 0, 0, 0,
+ /* 22 */ 0, 0, 0,
+ /* 23 */ 0, 0, 0,
+ /* 24 */ 0, 0, 0,
+ /* 25 */ 0, 0, 0,
+ /* 26 */ 0, 0, 0,
+ /* 27 */ 0, 0, 0,
+ /* 28 */ 0, 0, 0,
+ /* 29 */ 0, 0, 0,
+ /* 30 */ 0, 0, 0,
+ /* 31 */ 0, 0, 0,
+ /* 32 */ 0, 0, 0,
+ /* 33 */ VK_PRIOR, KEY_PgUp, KEY_PgUp,
+ /* 34 */ VK_NEXT, KEY_PgDown, KEY_PgDown,
+ /* 35 */ VK_END, KEY_End, KEY_End,
+ /* 36 */ VK_HOME, KEY_Home, KEY_Home,
+ /* 37 */ VK_LEFT, KEY_Left, KEY_Left,
+ /* 38 */ VK_UP, KEY_Up, KEY_Up,
+ /* 39 */ VK_RIGHT, KEY_Right, KEY_Right,
+ /* 40 */ VK_DOWN, KEY_Down, KEY_Down,
+ /* 41 */ 0, 0, 0,
+ /* 42 */ 0, 0, 0,
+ /* 43 */ 0, 0, 0,
+ /* 44 */ VK_SNAPSHOT, 0, KEY_Print,
+ /* 45 */ VK_INSERT, 0, KEY_Insert,
+ /* 46 */ VK_DELETE, 0, KEY_Delete,
+ /* 47 */ 0, 0, 0,
+ /* 48 */ 0, 0, 0,
+ /* 49 */ 0, 0, 0,
+ /* 50 */ 0, 0, 0,
+ /* 51 */ 0, 0, 0,
+ /* 52 */ 0, 0, 0,
+ /* 53 */ 0, 0, 0,
+ /* 54 */ 0, 0, 0,
+ /* 55 */ 0, 0, 0,
+ /* 56 */ 0, 0, 0,
+ /* 57 */ 0, 0, 0,
+ /* 58 */ 0, 0, 0,
+ /* 59 */ 0, 0, 0,
+ /* 60 */ 0, 0, 0,
+ /* 61 */ 0, 0, 0,
+ /* 62 */ 0, 0, 0,
+ /* 63 */ 0, 0, 0,
+ /* 64 */ 0, 0, 0,
+ /* 65 */ 0, 0, 0,
+ /* 66 */ 0, 0, 0,
+ /* 67 */ 0, 0, 0,
+ /* 68 */ 0, 0, 0,
+ /* 69 */ 0, 0, 0,
+ /* 70 */ 0, 0, 0,
+ /* 71 */ 0, 0, 0,
+ /* 72 */ 0, 0, 0,
+ /* 73 */ 0, 0, 0,
+ /* 74 */ 0, 0, 0,
+ /* 75 */ 0, 0, 0,
+ /* 76 */ 0, 0, 0,
+ /* 77 */ 0, 0, 0,
+ /* 78 */ 0, 0, 0,
+ /* 79 */ 0, 0, 0,
+ /* 80 */ 0, 0, 0,
+ /* 81 */ 0, 0, 0,
+ /* 82 */ 0, 0, 0,
+ /* 83 */ 0, 0, 0,
+ /* 84 */ 0, 0, 0,
+ /* 85 */ 0, 0, 0,
+ /* 86 */ 0, 0, 0,
+ /* 87 */ 0, 0, 0,
+ /* 88 */ 0, 0, 0,
+ /* 89 */ 0, 0, 0,
+ /* 90 */ 0, 0, 0,
+ /* 91 */ VK_LWIN, KEY_LMeta, 0,
+ /* 92 */ VK_RWIN, KEY_RMeta, 0,
+ /* 93 */ VK_APPS, KEY_Menu, 0,
+ /* 94 */ 0, 0, 0,
+ /* 95 */ 0, 0, 0,
+ /* 96 */ 0, 0, 0,
+ /* 97 */ 0, 0, 0,
+ /* 98 */ 0, 0, 0,
+ /* 99 */ 0, 0, 0,
+ /* 100 */ 0, 0, 0,
+ /* 101 */ 0, 0, 0,
+ /* 102 */ 0, 0, 0,
+ /* 103 */ 0, 0, 0,
+ /* 104 */ 0, 0, 0,
+ /* 105 */ 0, 0, 0,
+ /* 106 */ 0, 0, 0,
+ /* 107 */ 0, 0, 0,
+ /* 108 */ 0, 0, 0,
+ /* 109 */ 0, 0, 0,
+ /* 110 */ 0, 0, 0,
+ /* 111 */ VK_DIVIDE, 0, KEY_KP_Divide,
+ /* 112 */ 0, 0, 0,
+ /* 113 */ 0, 0, 0,
+ /* 114 */ 0, 0, 0,
+ /* 115 */ 0, 0, 0,
+ /* 116 */ 0, 0, 0,
+ /* 117 */ 0, 0, 0,
+ /* 118 */ 0, 0, 0,
+ /* 119 */ 0, 0, 0,
+ /* 120 */ 0, 0, 0,
+ /* 121 */ 0, 0, 0,
+ /* 122 */ 0, 0, 0,
+ /* 123 */ 0, 0, 0,
+ /* 124 */ 0, 0, 0,
+ /* 125 */ 0, 0, 0,
+ /* 126 */ 0, 0, 0,
+ /* 127 */ 0, 0, 0,
+ /* 128 */ 0, 0, 0,
+ /* 129 */ 0, 0, 0,
+ /* 130 */ 0, 0, 0,
+ /* 131 */ 0, 0, 0,
+ /* 132 */ 0, 0, 0,
+ /* 133 */ 0, 0, 0,
+ /* 134 */ 0, 0, 0,
+ /* 135 */ 0, 0, 0,
+ /* 136 */ 0, 0, 0,
+ /* 137 */ 0, 0, 0,
+ /* 138 */ 0, 0, 0,
+ /* 139 */ 0, 0, 0,
+ /* 140 */ 0, 0, 0,
+ /* 141 */ 0, 0, 0,
+ /* 142 */ 0, 0, 0,
+ /* 143 */ 0, 0, 0,
+ /* 144 */ 0, 0, 0,
+ /* 145 */ 0, 0, 0,
+ /* 146 */ 0, 0, 0,
+ /* 147 */ 0, 0, 0,
+ /* 148 */ 0, 0, 0,
+ /* 149 */ 0, 0, 0,
+ /* 150 */ 0, 0, 0,
+ /* 151 */ 0, 0, 0,
+ /* 152 */ 0, 0, 0,
+ /* 153 */ 0, 0, 0,
+ /* 154 */ 0, 0, 0,
+ /* 155 */ 0, 0, 0,
+ /* 156 */ 0, 0, 0,
+ /* 157 */ 0, 0, 0,
+ /* 158 */ 0, 0, 0,
+ /* 159 */ 0, 0, 0,
+ /* 160 */ VK_LSHIFT, KEY_ShiftL, KEY_ShiftL,
+ /* 161 */ VK_RSHIFT, KEY_ShiftR, KEY_ShiftR,
+ /* 162 */ VK_LCONTROL, KEY_LCtrl, KEY_LCtrl,
+ /* 163 */ VK_RCONTROL, KEY_RCtrl, KEY_RCtrl,
+ /* 164 */ VK_LMENU, KEY_Alt, KEY_Alt,
+ /* 165 */ VK_RMENU, KEY_AltLang, KEY_AltLang,
+ /* 166 */ 0, 0, 0,
+ /* 167 */ 0, 0, 0,
+ /* 168 */ 0, 0, 0,
+ /* 169 */ 0, 0, 0,
+ /* 170 */ 0, 0, 0,
+ /* 171 */ 0, 0, 0,
+ /* 172 */ 0, 0, 0,
+ /* 173 */ VK_VOLUME_MUTE, 0, KEY_Mute,
+ /* 174 */ VK_VOLUME_DOWN, 0, KEY_AudioLower,
+ /* 175 */ VK_VOLUME_UP, 0, KEY_AudioRaise,
+ /* 176 */ VK_MEDIA_NEXT_TRACK, 0, KEY_NEXTSONG,
+ /* 177 */ VK_MEDIA_PREV_TRACK, 0, KEY_PREVIOUSSONG,
+ /* 178 */ VK_MEDIA_STOP, 0, KEY_STOPCD,
+ /* 179 */ VK_MEDIA_PLAY_PAUSE, 0, KEY_PLAYPAUSE,
+ /* 180 */ 0, 0, 0,
+ /* 181 */ 0, 0, 0,
+ /* 182 */ 0, 0, 0,
+ /* 183 */ 0, 0, 0,
+ /* 184 */ 0, 0, 0,
+ /* 185 */ 0, 0, 0,
+ /* 186 */ 0, 0, 0,
+ /* 187 */ 0, 0, 0,
+ /* 188 */ 0, 0, 0,
+ /* 189 */ 0, 0, 0,
+ /* 190 */ 0, 0, 0,
+ /* 191 */ 0, 0, 0,
+ /* 192 */ 0, 0, 0,
+ /* 193 */ 0, 0, 0,
+ /* 194 */ 0, 0, 0,
+ /* 195 */ 0, 0, 0,
+ /* 196 */ 0, 0, 0,
+ /* 197 */ 0, 0, 0,
+ /* 198 */ 0, 0, 0,
+ /* 199 */ 0, 0, 0,
+ /* 200 */ 0, 0, 0,
+ /* 201 */ 0, 0, 0,
+ /* 202 */ 0, 0, 0,
+ /* 203 */ 0, 0, 0,
+ /* 204 */ 0, 0, 0,
+ /* 205 */ 0, 0, 0,
+ /* 206 */ 0, 0, 0,
+ /* 207 */ 0, 0, 0,
+ /* 208 */ 0, 0, 0,
+ /* 209 */ 0, 0, 0,
+ /* 210 */ 0, 0, 0,
+ /* 211 */ 0, 0, 0,
+ /* 212 */ 0, 0, 0,
+ /* 213 */ 0, 0, 0,
+ /* 214 */ 0, 0, 0,
+ /* 215 */ 0, 0, 0,
+ /* 216 */ 0, 0, 0,
+ /* 217 */ 0, 0, 0,
+ /* 218 */ 0, 0, 0,
+ /* 219 */ 0, 0, 0,
+ /* 220 */ 0, 0, 0,
+ /* 221 */ 0, 0, 0,
+ /* 222 */ 0, 0, 0,
+ /* 223 */ VK_OEM_8, 0, KEY_RCtrl,
+ /* at least on Canadian Multilingual Standard layout */
+ /* 224 */ 0, 0, 0,
+ /* 225 */ 0, 0, 0,
+ /* 226 */ 0, 0, 0,
+ /* 227 */ 0, 0, 0,
+ /* 228 */ 0, 0, 0,
+ /* 229 */ 0, 0, 0,
+ /* 230 */ 0, 0, 0,
+ /* 231 */ 0, 0, 0,
+ /* 232 */ 0, 0, 0,
+ /* 233 */ 0, 0, 0,
+ /* 234 */ 0, 0, 0,
+ /* 235 */ 0, 0, 0,
+ /* 236 */ 0, 0, 0,
+ /* 237 */ 0, 0, 0,
+ /* 238 */ 0, 0, 0,
+ /* 239 */ 0, 0, 0,
+ /* 240 */ 0, 0, 0,
+ /* 241 */ 0, 0, 0,
+ /* 242 */ 0, 0, 0,
+ /* 243 */ 0, 0, 0,
+ /* 244 */ 0, 0, 0,
+ /* 245 */ 0, 0, 0,
+ /* 246 */ 0, 0, 0,
+ /* 247 */ 0, 0, 0,
+ /* 248 */ 0, 0, 0,
+ /* 249 */ 0, 0, 0,
+ /* 250 */ 0, 0, 0,
+ /* 251 */ 0, 0, 0,
+ /* 252 */ 0, 0, 0,
+ /* 253 */ 0, 0, 0,
+ /* 254 */ 0, 0, 0,
+ /* 255 */ VK_FN, 0, KEY_Fn
+ /* Most keyboards don't generate a scancode for Fn, but a few do... */
};
-#endif /* WINKEYBD_H */
+#endif /* WINKEYBD_H */
diff --git a/xorg-server/hw/xwin/winkeyhook.c b/xorg-server/hw/xwin/winkeyhook.c
index e452fa5f7..124150850 100644
--- a/xorg-server/hw/xwin/winkeyhook.c
+++ b/xorg-server/hw/xwin/winkeyhook.c
@@ -1,186 +1,173 @@
-/*
- *Copyright (C) 2004 Harold L Hunt II All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors: Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-
-static HHOOK g_hhookKeyboardLL = NULL;
-
-
-/*
- * Function prototypes
- */
-
-static LRESULT CALLBACK
-winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam);
-
-
-#ifndef LLKHF_EXTENDED
-# define LLKHF_EXTENDED 0x00000001
-#endif
-#ifndef LLKHF_UP
-# define LLKHF_UP 0x00000080
-#endif
-
-
-/*
- * KeyboardMessageHook
- */
-
-static LRESULT CALLBACK
-winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
-{
- BOOL fPassKeystroke = FALSE;
- BOOL fPassAltTab = TRUE;
- PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
- HWND hwnd = GetActiveWindow();
-#ifdef XWIN_MULTIWINDOW
- WindowPtr pWin = NULL;
- winPrivWinPtr pWinPriv = NULL;
- winPrivScreenPtr pScreenPriv = NULL;
- winScreenInfo *pScreenInfo = NULL;
-
- /* Check if the Windows window property for our X window pointer is valid */
- if ((pWin = GetProp (hwnd, WIN_WINDOW_PROP)) != NULL)
- {
- /* Get a pointer to our window privates */
- pWinPriv = winGetWindowPriv(pWin);
-
- /* Get pointers to our screen privates and screen info */
- pScreenPriv = pWinPriv->pScreenPriv;
- pScreenInfo = pScreenPriv->pScreenInfo;
-
- if (pScreenInfo->fMultiWindow)
- fPassAltTab = FALSE;
- }
-#endif
-
- /* Pass keystrokes on to our main message loop */
- if (iCode == HC_ACTION)
- {
- winDebug("winKeyboardMessageHook: vkCode: %08x scanCode: %08x\n", p->vkCode, p->scanCode);
-
- switch (wParam)
- {
- case WM_KEYDOWN: case WM_SYSKEYDOWN:
- case WM_KEYUP: case WM_SYSKEYUP:
- fPassKeystroke =
- (fPassAltTab &&
- (p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0))
- || (p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)
- ;
- break;
- }
- }
-
- /*
- * Pass message on to our main message loop.
- * We process this immediately with SendMessage so that the keystroke
- * appears in, hopefully, the correct order.
- */
- if (fPassKeystroke)
- {
- LPARAM lParamKey = 0x0;
-
- /* Construct the lParam from KBDLLHOOKSTRUCT */
- lParamKey = lParamKey | (0x0000FFFF & 0x00000001); /* Repeat count */
- lParamKey = lParamKey | (0x00FF0000 & (p->scanCode << 16));
- lParamKey = lParamKey
- | (0x01000000 & ((p->flags & LLKHF_EXTENDED) << 23));
- lParamKey = lParamKey
- | (0x20000000
- & ((p->flags & LLKHF_ALTDOWN) << 24));
- lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24));
-
- /* Send message to our main window that has the keyboard focus */
- PostMessage (hwnd,
- (UINT) wParam,
- (WPARAM) p->vkCode,
- lParamKey);
-
- return 1;
- }
-
- /* Call next hook */
- return CallNextHookEx (NULL, iCode, wParam, lParam);
-}
-
-
-/*
- * Attempt to install the keyboard hook, return FALSE if it was not installed
- */
-
-Bool
-winInstallKeyboardHookLL (void)
-{
- OSVERSIONINFO osvi = {0};
-
- /* Get operating system version information */
- osvi.dwOSVersionInfoSize = sizeof (osvi);
- GetVersionEx (&osvi);
-
- /* Branch on platform ID */
- switch (osvi.dwPlatformId)
- {
- case VER_PLATFORM_WIN32_NT:
- /* Low-level is supported on NT 4.0 SP3+ only */
- /* TODO: Return FALSE on NT 4.0 with no SP, SP1, or SP2 */
- break;
-
- case VER_PLATFORM_WIN32_WINDOWS:
- /* Low-level hook is not supported on non-NT */
- return FALSE;
- }
-
- /* Install the hook only once */
- if (!g_hhookKeyboardLL)
- g_hhookKeyboardLL = SetWindowsHookEx (WH_KEYBOARD_LL,
- winKeyboardMessageHookLL,
- g_hInstance,
- 0);
-
- return TRUE;
-}
-
-
-/*
- * Remove the keyboard hook if it is installed
- */
-
-void
-winRemoveKeyboardHookLL (void)
-{
- if (g_hhookKeyboardLL)
- UnhookWindowsHookEx (g_hhookKeyboardLL);
- g_hhookKeyboardLL = NULL;
-}
+/*
+ *Copyright (C) 2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+static HHOOK g_hhookKeyboardLL = NULL;
+
+/*
+ * Function prototypes
+ */
+
+static LRESULT CALLBACK
+winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam);
+
+#ifndef LLKHF_EXTENDED
+#define LLKHF_EXTENDED 0x00000001
+#endif
+#ifndef LLKHF_UP
+#define LLKHF_UP 0x00000080
+#endif
+
+/*
+ * KeyboardMessageHook
+ */
+
+static LRESULT CALLBACK
+winKeyboardMessageHookLL(int iCode, WPARAM wParam, LPARAM lParam)
+{
+ BOOL fPassKeystroke = FALSE;
+ BOOL fPassAltTab = TRUE;
+ PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
+ HWND hwnd = GetActiveWindow();
+
+#ifdef XWIN_MULTIWINDOW
+ WindowPtr pWin = NULL;
+ winPrivWinPtr pWinPriv = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pWin = GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) {
+ /* Get a pointer to our window privates */
+ pWinPriv = winGetWindowPriv(pWin);
+
+ /* Get pointers to our screen privates and screen info */
+ pScreenPriv = pWinPriv->pScreenPriv;
+ pScreenInfo = pScreenPriv->pScreenInfo;
+
+ if (pScreenInfo->fMultiWindow)
+ fPassAltTab = FALSE;
+ }
+#endif
+
+ /* Pass keystrokes on to our main message loop */
+ if (iCode == HC_ACTION) {
+ winDebug("winKeyboardMessageHook: vkCode: %08x scanCode: %08x\n",
+ p->vkCode, p->scanCode);
+
+ switch (wParam) {
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ case WM_KEYUP:
+ case WM_SYSKEYUP:
+ fPassKeystroke =
+ (fPassAltTab &&
+ (p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0))
+ || (p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN);
+ break;
+ }
+ }
+
+ /*
+ * Pass message on to our main message loop.
+ * We process this immediately with SendMessage so that the keystroke
+ * appears in, hopefully, the correct order.
+ */
+ if (fPassKeystroke) {
+ LPARAM lParamKey = 0x0;
+
+ /* Construct the lParam from KBDLLHOOKSTRUCT */
+ lParamKey = lParamKey | (0x0000FFFF & 0x00000001); /* Repeat count */
+ lParamKey = lParamKey | (0x00FF0000 & (p->scanCode << 16));
+ lParamKey = lParamKey
+ | (0x01000000 & ((p->flags & LLKHF_EXTENDED) << 23));
+ lParamKey = lParamKey
+ | (0x20000000 & ((p->flags & LLKHF_ALTDOWN) << 24));
+ lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24));
+
+ /* Send message to our main window that has the keyboard focus */
+ PostMessage(hwnd, (UINT) wParam, (WPARAM) p->vkCode, lParamKey);
+
+ return 1;
+ }
+
+ /* Call next hook */
+ return CallNextHookEx(NULL, iCode, wParam, lParam);
+}
+
+/*
+ * Attempt to install the keyboard hook, return FALSE if it was not installed
+ */
+
+Bool
+winInstallKeyboardHookLL(void)
+{
+ OSVERSIONINFO osvi = { 0 };
+
+ /* Get operating system version information */
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
+
+ /* Branch on platform ID */
+ switch (osvi.dwPlatformId) {
+ case VER_PLATFORM_WIN32_NT:
+ /* Low-level is supported on NT 4.0 SP3+ only */
+ /* TODO: Return FALSE on NT 4.0 with no SP, SP1, or SP2 */
+ break;
+
+ case VER_PLATFORM_WIN32_WINDOWS:
+ /* Low-level hook is not supported on non-NT */
+ return FALSE;
+ }
+
+ /* Install the hook only once */
+ if (!g_hhookKeyboardLL)
+ g_hhookKeyboardLL = SetWindowsHookEx(WH_KEYBOARD_LL,
+ winKeyboardMessageHookLL,
+ g_hInstance, 0);
+
+ return TRUE;
+}
+
+/*
+ * Remove the keyboard hook if it is installed
+ */
+
+void
+winRemoveKeyboardHookLL(void)
+{
+ if (g_hhookKeyboardLL)
+ UnhookWindowsHookEx(g_hhookKeyboardLL);
+ g_hhookKeyboardLL = NULL;
+}
diff --git a/xorg-server/hw/xwin/winlayouts.h b/xorg-server/hw/xwin/winlayouts.h
index c53f0e054..82da2da63 100644
--- a/xorg-server/hw/xwin/winlayouts.h
+++ b/xorg-server/hw/xwin/winlayouts.h
@@ -1,96 +1,98 @@
-/*
- * Copyright (c) 2005 Alexander Gottwald
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-/* Definitions for various keyboard layouts from windows and their
- * XKB settings.
- */
-
-typedef struct
-{
- unsigned int winlayout;
- int winkbtype;
- char *xkbmodel;
- char *xkblayout;
- char *xkbvariant;
- char *xkboptions;
- char *layoutname;
-} WinKBLayoutRec, *WinKBLayoutPtr;
-
-/*
- This table is sorted by low byte of winlayout, then by next byte, etc.
-*/
-
-WinKBLayoutRec winKBLayouts[] =
-{
- { 0x00000404, -1, "pc105", "zh_TW", NULL, NULL, "Chinese (Taiwan)"},
- { 0x00000405, -1, "pc105", "cz", NULL, NULL, "Czech"},
- { 0x00010405, -1, "pc105", "cz_qwerty", NULL, NULL, "Czech (QWERTY)"},
- { 0x00000406, -1, "pc105", "dk", NULL, NULL, "Danish"},
- { 0x00000407, -1, "pc105", "de", NULL, NULL, "German (Germany)"},
- { 0x00010407, -1, "pc105", "de", NULL, NULL, "German (Germany,IBM)"},
- { 0x00000807, -1, "pc105", "ch", "de", NULL, "German (Switzerland)"},
- { 0x00000409, -1, "pc105", "us", NULL, NULL, "English (USA)"},
- { 0x00010409, -1, "pc105", "dvorak", NULL, NULL, "English (USA,Dvorak)"},
- { 0x00020409, -1, "pc105", "us_intl", NULL, NULL, "English (USA,International)"},
- { 0x00000809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"},
- { 0x00001009, -1, "pc105", "ca", "fr", NULL, "French (Canada)"},
- { 0x00011009, -1, "pc105", "ca", "multix", NULL, "Canadian Multilingual Standard"},
- { 0x00001809, -1, "pc105", "ie", NULL, NULL, "Irish"},
- { 0x0000040a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain,Traditional Sort)"},
- { 0x0000080a, -1, "pc105", "latam", NULL, NULL, "Latin American"},
- { 0x0000040b, -1, "pc105", "fi", NULL, NULL, "Finnish"},
- { 0x0000040c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"},
- { 0x0000080c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"},
- { 0x0001080c, -1, "pc105", "be", NULL, NULL, "Belgian (Comma)"},
- { 0x00000c0c, -1, "pc105", "ca", "fr-legacy", NULL, "French (Canada, Legacy)"},
- { 0x0000100c, -1, "pc105", "ch", "fr", NULL, "French (Switzerland)"},
- { 0x0000040d, -1, "pc105", "il", NULL, NULL, "Hebrew"},
- { 0x0000040e, -1, "pc105", "hu", NULL, NULL, "Hungarian"},
- { 0x0000040f, -1, "pc105", "is", NULL, NULL, "Icelandic"},
- { 0x00000410, -1, "pc105", "it", NULL, NULL, "Italian"},
- { 0x00010410, -1, "pc105", "it", NULL, NULL, "Italian (142)"},
- { 0xa0000410, -1, "macbook79", "it", "mac", NULL, "Italiano (Apple)"},
- { 0x00000411, 7, "jp106", "jp", NULL, NULL, "Japanese"},
- { 0x00000413, -1, "pc105", "nl", NULL, NULL, "Dutch"},
- { 0x00000813, -1, "pc105", "be", NULL, NULL, "Dutch (Belgian)"},
- { 0x00000414, -1, "pc105", "no", NULL, NULL, "Norwegian"},
- { 0x00000415, -1, "pc105", "pl", NULL, NULL, "Polish (Programmers)"},
- { 0x00000416, -1, "pc105", "br", NULL, NULL, "Portuguese (Brazil,ABNT)"},
- { 0x00010416, -1, "abnt2", "br", NULL, NULL, "Portuguese (Brazil,ABNT2)"},
- { 0x00000816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"},
- { 0x0000041a, -1, "pc105", "hr", NULL, NULL, "Croatian"},
- { 0x0000041d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"},
- { 0x0000041f, -1, "pc105", "tr", NULL, NULL, "Turkish (Q)"},
- { 0x0001041f, -1, "pc105", "tr", "f", NULL, "Turkish (F)"},
- { 0x00000424, -1, "pc105", "si", NULL, NULL, "Slovenian"},
- { 0x00000425, -1, "pc105", "ee", NULL, NULL, "Estonian"},
- { 0x00000452, -1, "pc105", "gb", "intl", NULL, "United Kingdom (Extended)"},
- { -1, -1, NULL, NULL, NULL, NULL, NULL}
-};
-
-/*
- See http://technet.microsoft.com/en-us/library/cc766503%28WS.10%29.aspx
- for a listing of input locale (keyboard layout) codes
-*/
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+/* Definitions for various keyboard layouts from windows and their
+ * XKB settings.
+ */
+
+typedef struct {
+ unsigned int winlayout;
+ int winkbtype;
+ char *xkbmodel;
+ char *xkblayout;
+ char *xkbvariant;
+ char *xkboptions;
+ char *layoutname;
+} WinKBLayoutRec, *WinKBLayoutPtr;
+
+/*
+ This table is sorted by low byte of winlayout, then by next byte, etc.
+*/
+
+WinKBLayoutRec winKBLayouts[] = {
+ {0x00000404, -1, "pc105", "zh_TW", NULL, NULL, "Chinese (Taiwan)"},
+ {0x00000405, -1, "pc105", "cz", NULL, NULL, "Czech"},
+ {0x00010405, -1, "pc105", "cz_qwerty", NULL, NULL, "Czech (QWERTY)"},
+ {0x00000406, -1, "pc105", "dk", NULL, NULL, "Danish"},
+ {0x00000407, -1, "pc105", "de", NULL, NULL, "German (Germany)"},
+ {0x00010407, -1, "pc105", "de", NULL, NULL, "German (Germany,IBM)"},
+ {0x00000807, -1, "pc105", "ch", "de", NULL, "German (Switzerland)"},
+ {0x00000409, -1, "pc105", "us", NULL, NULL, "English (USA)"},
+ {0x00010409, -1, "pc105", "dvorak", NULL, NULL, "English (USA,Dvorak)"},
+ {0x00020409, -1, "pc105", "us_intl", NULL, NULL,
+ "English (USA,International)"},
+ {0x00000809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"},
+ {0x00001009, -1, "pc105", "ca", "fr", NULL, "French (Canada)"},
+ {0x00011009, -1, "pc105", "ca", "multix", NULL,
+ "Canadian Multilingual Standard"},
+ {0x00001809, -1, "pc105", "ie", NULL, NULL, "Irish"},
+ {0x0000040a, -1, "pc105", "es", NULL, NULL,
+ "Spanish (Spain,Traditional Sort)"},
+ {0x0000080a, -1, "pc105", "latam", NULL, NULL, "Latin American"},
+ {0x0000040b, -1, "pc105", "fi", NULL, NULL, "Finnish"},
+ {0x0000040c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"},
+ {0x0000080c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"},
+ {0x0001080c, -1, "pc105", "be", NULL, NULL, "Belgian (Comma)"},
+ {0x00000c0c, -1, "pc105", "ca", "fr-legacy", NULL,
+ "French (Canada, Legacy)"},
+ {0x0000100c, -1, "pc105", "ch", "fr", NULL, "French (Switzerland)"},
+ {0x0000040d, -1, "pc105", "il", NULL, NULL, "Hebrew"},
+ {0x0000040e, -1, "pc105", "hu", NULL, NULL, "Hungarian"},
+ {0x0000040f, -1, "pc105", "is", NULL, NULL, "Icelandic"},
+ {0x00000410, -1, "pc105", "it", NULL, NULL, "Italian"},
+ {0x00010410, -1, "pc105", "it", NULL, NULL, "Italian (142)"},
+ {0xa0000410, -1, "macbook79", "it", "mac", NULL, "Italiano (Apple)"},
+ {0x00000411, 7, "jp106", "jp", NULL, NULL, "Japanese"},
+ {0x00000413, -1, "pc105", "nl", NULL, NULL, "Dutch"},
+ {0x00000813, -1, "pc105", "be", NULL, NULL, "Dutch (Belgian)"},
+ {0x00000414, -1, "pc105", "no", NULL, NULL, "Norwegian"},
+ {0x00000415, -1, "pc105", "pl", NULL, NULL, "Polish (Programmers)"},
+ {0x00000416, -1, "pc105", "br", NULL, NULL, "Portuguese (Brazil,ABNT)"},
+ {0x00010416, -1, "abnt2", "br", NULL, NULL, "Portuguese (Brazil,ABNT2)"},
+ {0x00000816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"},
+ {0x0000041a, -1, "pc105", "hr", NULL, NULL, "Croatian"},
+ {0x0000041d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"},
+ {0x0000041f, -1, "pc105", "tr", NULL, NULL, "Turkish (Q)"},
+ {0x0001041f, -1, "pc105", "tr", "f", NULL, "Turkish (F)"},
+ {0x00000424, -1, "pc105", "si", NULL, NULL, "Slovenian"},
+ {0x00000425, -1, "pc105", "ee", NULL, NULL, "Estonian"},
+ {0x00000452, -1, "pc105", "gb", "intl", NULL, "United Kingdom (Extended)"},
+ {-1, -1, NULL, NULL, NULL, NULL, NULL}
+};
+
+/*
+ See http://technet.microsoft.com/en-us/library/cc766503%28WS.10%29.aspx
+ for a listing of input locale (keyboard layout) codes
+*/
diff --git a/xorg-server/hw/xwin/winmisc.c b/xorg-server/hw/xwin/winmisc.c
index a5a2d3d1c..f810ed073 100644
--- a/xorg-server/hw/xwin/winmisc.c
+++ b/xorg-server/hw/xwin/winmisc.c
@@ -41,112 +41,103 @@
*/
void
-winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
- unsigned short *pHeight, ScreenPtr pScreen)
+winQueryBestSizeNativeGDI(int class, unsigned short *pWidth,
+ unsigned short *pHeight, ScreenPtr pScreen)
{
winDebug ("winQueryBestSizeNativeGDI\n");
}
#endif
-
/*
* Count the number of one bits in a color mask.
*/
CARD8
-winCountBits (DWORD dw)
+winCountBits(DWORD dw)
{
- DWORD dwBits = 0;
+ DWORD dwBits = 0;
- while (dw)
- {
- dwBits += (dw & 1);
- dw >>= 1;
+ while (dw) {
+ dwBits += (dw & 1);
+ dw >>= 1;
}
- return dwBits;
+ return dwBits;
}
-
/*
* Modify the screen pixmap to point to the new framebuffer address
*/
Bool
-winUpdateFBPointer (ScreenPtr pScreen, void *pbits)
+winUpdateFBPointer(ScreenPtr pScreen, void *pbits)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Location of shadow framebuffer has changed */
- pScreenInfo->pfb = pbits;
-
- /* Update the screen pixmap */
- if (!(*pScreen->ModifyPixmapHeader) (pScreen->devPrivate,
- pScreen->width,
- pScreen->height,
- pScreen->rootDepth,
- BitsPerPixel (pScreen->rootDepth),
- PixmapBytePad (pScreenInfo->dwStride,
- pScreenInfo->dwBPP),
- pScreenInfo->pfb))
- {
- FatalError ("winUpdateFramebufferPointer - Failed modifying "\
- "screen pixmap\n");
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Location of shadow framebuffer has changed */
+ pScreenInfo->pfb = pbits;
+
+ /* Update the screen pixmap */
+ if (!(*pScreen->ModifyPixmapHeader) (pScreen->devPrivate,
+ pScreen->width,
+ pScreen->height,
+ pScreen->rootDepth,
+ BitsPerPixel(pScreen->rootDepth),
+ PixmapBytePad(pScreenInfo->dwStride,
+ pScreenInfo->dwBPP),
+ pScreenInfo->pfb)) {
+ FatalError("winUpdateFramebufferPointer - Failed modifying "
+ "screen pixmap\n");
}
- return TRUE;
+ return TRUE;
}
-
#ifdef XWIN_NATIVEGDI
/*
* Paint the window background with the specified color
*/
BOOL
-winPaintBackground (HWND hwnd, COLORREF colorref)
+winPaintBackground(HWND hwnd, COLORREF colorref)
{
- HDC hdc;
- HBRUSH hbrush;
- RECT rect;
-
- /* Create an hdc */
- hdc = GetDC (hwnd);
- if (hdc == NULL)
- {
- printf ("gdiWindowProc - GetDC failed\n");
- exit (1);
+ HDC hdc;
+ HBRUSH hbrush;
+ RECT rect;
+
+ /* Create an hdc */
+ hdc = GetDC(hwnd);
+ if (hdc == NULL) {
+ printf("gdiWindowProc - GetDC failed\n");
+ exit(1);
}
- /* Create and select blue brush */
- hbrush = CreateSolidBrush (colorref);
- if (hbrush == NULL)
- {
- printf ("gdiWindowProc - CreateSolidBrush failed\n");
- exit (1);
+ /* Create and select blue brush */
+ hbrush = CreateSolidBrush(colorref);
+ if (hbrush == NULL) {
+ printf("gdiWindowProc - CreateSolidBrush failed\n");
+ exit(1);
}
- /* Get window extents */
- if (GetClientRect (hwnd, &rect) == FALSE)
- {
- printf ("gdiWindowProc - GetClientRect failed\n");
- exit (1);
+ /* Get window extents */
+ if (GetClientRect(hwnd, &rect) == FALSE) {
+ printf("gdiWindowProc - GetClientRect failed\n");
+ exit(1);
}
- /* Fill window with blue brush */
- if (FillRect (hdc, &rect, hbrush) == 0)
- {
- printf ("gdiWindowProc - FillRect failed\n");
- exit (1);
+ /* Fill window with blue brush */
+ if (FillRect(hdc, &rect, hbrush) == 0) {
+ printf("gdiWindowProc - FillRect failed\n");
+ exit(1);
}
- /* Delete blue brush */
- DeleteObject (hbrush);
+ /* Delete blue brush */
+ DeleteObject(hbrush);
- /* Release the hdc */
- ReleaseDC (hwnd, hdc);
+ /* Release the hdc */
+ ReleaseDC(hwnd, hdc);
- return TRUE;
+ return TRUE;
}
#endif
diff --git a/xorg-server/hw/xwin/winmonitors.c b/xorg-server/hw/xwin/winmonitors.c
index a253afc61..31c7aeab0 100644
--- a/xorg-server/hw/xwin/winmonitors.c
+++ b/xorg-server/hw/xwin/winmonitors.c
@@ -30,7 +30,6 @@ from The Open Group.
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
-
#include "win.h"
#define COMPILE_MULTIMON_STUBS
#include <multimon.h>
@@ -41,25 +40,27 @@ from The Open Group.
*/
static
-wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
+ wBOOL CALLBACK
+getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
{
- struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data;
- // only get data for monitor number specified in <data>
- data->monitorNum++;
- if (data->monitorNum == data->requestedMonitor)
- {
- data->bMonitorSpecifiedExists = TRUE;
- data->monitorOffsetX = rect->left;
- data->monitorOffsetY = rect->top;
- data->monitorHeight = rect->bottom - rect->top;
- data->monitorWidth = rect->right - rect->left;
+ struct GetMonitorInfoData *data = (struct GetMonitorInfoData *) _data;
+
+ // only get data for monitor number specified in <data>
+ data->monitorNum++;
+ if (data->monitorNum == data->requestedMonitor) {
+ data->bMonitorSpecifiedExists = TRUE;
+ data->monitorOffsetX = rect->left;
+ data->monitorOffsetY = rect->top;
+ data->monitorHeight = rect->bottom - rect->top;
+ data->monitorWidth = rect->right - rect->left;
data->monitorHandle = hMonitor;
- return FALSE;
- }
- return TRUE;
+ return FALSE;
+ }
+ return TRUE;
}
-Bool QueryMonitor(int index, struct GetMonitorInfoData *data)
+Bool
+QueryMonitor(int index, struct GetMonitorInfoData *data)
{
/* prepare data */
if (data == NULL)
diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c
index e7cb1ccb7..63081d62c 100644
--- a/xorg-server/hw/xwin/winmouse.c
+++ b/xorg-server/hw/xwin/winmouse.c
@@ -44,7 +44,7 @@
#endif
#include "inputstr.h"
-#include "exevents.h" /* for button/axes labels */
+#include "exevents.h" /* for button/axes labels */
#include "xserver-properties.h"
#include "inpututils.h"
@@ -57,308 +57,283 @@ static CARD8 const *g_winMouseButtonMap = NULL;
*/
int
-winMouseProc (DeviceIntPtr pDeviceInt, int iState)
+winMouseProc(DeviceIntPtr pDeviceInt, int iState)
{
- int lngMouseButtons, i;
- int lngWheelEvents = 4;
- CARD8 *map;
- DevicePtr pDevice = (DevicePtr) pDeviceInt;
- Atom *btn_labels;
- Atom axes_labels[2];
-
- switch (iState)
- {
+ int lngMouseButtons, i;
+ int lngWheelEvents = 4;
+ CARD8 *map;
+ DevicePtr pDevice = (DevicePtr) pDeviceInt;
+ Atom *btn_labels;
+ Atom axes_labels[2];
+
+ switch (iState) {
case DEVICE_INIT:
- /* Get number of mouse buttons */
- lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
- winDebug("%d mouse buttons found\n", lngMouseButtons);
-
- /* Mapping of windows events to X events:
- * LEFT:1 MIDDLE:2 RIGHT:3
- * SCROLL_UP:4 SCROLL_DOWN:5
- * XBUTTON 1:6 XBUTTON 2:7 ...
- *
- * To map scroll wheel correctly we need at least the 3 normal buttons
- */
- if (lngMouseButtons < 3)
- lngMouseButtons = 3;
-
- /* allocate memory:
- * number of buttons + 2x mouse wheel event + 1 extra (offset for map)
- */
- map = malloc(sizeof(CARD8) * (lngMouseButtons + lngWheelEvents + 1));
-
- /* initalize button map */
- map[0] = 0;
- for (i=1; i <= lngMouseButtons + lngWheelEvents; i++)
- map[i] = i;
-
- btn_labels = calloc((lngMouseButtons + lngWheelEvents), sizeof(Atom));
- btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
- btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
- btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
- btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
- btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ /* Get number of mouse buttons */
+ lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
+ winDebug("%d mouse buttons found\n", lngMouseButtons);
+
+ /* Mapping of windows events to X events:
+ * LEFT:1 MIDDLE:2 RIGHT:3
+ * SCROLL_UP:4 SCROLL_DOWN:5
+ * XBUTTON 1:6 XBUTTON 2:7 ...
+ *
+ * To map scroll wheel correctly we need at least the 3 normal buttons
+ */
+ if (lngMouseButtons < 3)
+ lngMouseButtons = 3;
+
+ /* allocate memory:
+ * number of buttons + 2x mouse wheel event + 1 extra (offset for map)
+ */
+ map = malloc(sizeof(CARD8) * (lngMouseButtons + lngWheelEvents + 1));
+
+ /* initalize button map */
+ map[0] = 0;
+ for (i = 1; i <= lngMouseButtons + lngWheelEvents; i++)
+ map[i] = i;
+
+ btn_labels = calloc((lngMouseButtons + lngWheelEvents), sizeof(Atom));
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
- InitPointerDeviceStruct (pDevice,
- map,
- lngMouseButtons + lngWheelEvents,
- btn_labels,
- (PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(),
- 2,
- axes_labels);
- free(map);
- free(btn_labels);
+ InitPointerDeviceStruct(pDevice,
+ map,
+ lngMouseButtons + lngWheelEvents,
+ btn_labels,
+ (PtrCtrlProcPtr)NoopDDA,
+ GetMotionHistorySize(), 2, axes_labels);
+ free(map);
+ free(btn_labels);
- g_winMouseButtonMap = pDeviceInt->button->map;
- break;
+ g_winMouseButtonMap = pDeviceInt->button->map;
+ break;
case DEVICE_ON:
- pDevice->on = TRUE;
- break;
+ pDevice->on = TRUE;
+ break;
case DEVICE_CLOSE:
- g_winMouseButtonMap = NULL;
+ g_winMouseButtonMap = NULL;
case DEVICE_OFF:
- pDevice->on = FALSE;
- break;
+ pDevice->on = FALSE;
+ break;
}
- return Success;
+ return Success;
}
-
/* Handle the mouse wheel */
int
-winMouseWheel (ScreenPtr pScreen, int iDeltaZ)
+winMouseWheel(ScreenPtr pScreen, int iDeltaZ)
{
- winScreenPriv(pScreen);
- int button; /* Button4 or Button5 */
-
- /* Button4 = WheelUp */
- /* Button5 = WheelDown */
-
- /* Do we have any previous delta stored? */
- if ((pScreenPriv->iDeltaZ > 0
- && iDeltaZ > 0)
- || (pScreenPriv->iDeltaZ < 0
- && iDeltaZ < 0))
- {
- /* Previous delta and of same sign as current delta */
- iDeltaZ += pScreenPriv->iDeltaZ;
- pScreenPriv->iDeltaZ = 0;
+ winScreenPriv(pScreen);
+ int button; /* Button4 or Button5 */
+
+ /* Button4 = WheelUp */
+ /* Button5 = WheelDown */
+
+ /* Do we have any previous delta stored? */
+ if ((pScreenPriv->iDeltaZ > 0 && iDeltaZ > 0)
+ || (pScreenPriv->iDeltaZ < 0 && iDeltaZ < 0)) {
+ /* Previous delta and of same sign as current delta */
+ iDeltaZ += pScreenPriv->iDeltaZ;
+ pScreenPriv->iDeltaZ = 0;
}
- else
- {
- /*
- * Previous delta of different sign, or zero.
- * We will set it to zero for either case,
- * as blindly setting takes just as much time
- * as checking, then setting if necessary :)
- */
- pScreenPriv->iDeltaZ = 0;
+ else {
+ /*
+ * Previous delta of different sign, or zero.
+ * We will set it to zero for either case,
+ * as blindly setting takes just as much time
+ * as checking, then setting if necessary :)
+ */
+ pScreenPriv->iDeltaZ = 0;
}
- /*
- * Only process this message if the wheel has moved further than
- * WHEEL_DELTA
- */
- if (iDeltaZ >= WHEEL_DELTA || (-1 * iDeltaZ) >= WHEEL_DELTA)
- {
- pScreenPriv->iDeltaZ = 0;
-
- /* Figure out how many whole deltas of the wheel we have */
- iDeltaZ /= WHEEL_DELTA;
+ /*
+ * Only process this message if the wheel has moved further than
+ * WHEEL_DELTA
+ */
+ if (iDeltaZ >= WHEEL_DELTA || (-1 * iDeltaZ) >= WHEEL_DELTA) {
+ pScreenPriv->iDeltaZ = 0;
+
+ /* Figure out how many whole deltas of the wheel we have */
+ iDeltaZ /= WHEEL_DELTA;
}
- else
- {
- /*
- * Wheel has not moved past WHEEL_DELTA threshold;
- * we will store the wheel delta until the threshold
- * has been reached.
- */
- pScreenPriv->iDeltaZ = iDeltaZ;
- return 0;
+ else {
+ /*
+ * Wheel has not moved past WHEEL_DELTA threshold;
+ * we will store the wheel delta until the threshold
+ * has been reached.
+ */
+ pScreenPriv->iDeltaZ = iDeltaZ;
+ return 0;
}
- /* Set the button to indicate up or down wheel delta */
- if (iDeltaZ > 0)
- {
- button = Button4;
+ /* Set the button to indicate up or down wheel delta */
+ if (iDeltaZ > 0) {
+ button = Button4;
}
- else
- {
- button = Button5;
+ else {
+ button = Button5;
}
- /*
- * Flip iDeltaZ to positive, if negative,
- * because always need to generate a *positive* number of
- * button clicks for the Z axis.
- */
- if (iDeltaZ < 0)
- {
- iDeltaZ *= -1;
+ /*
+ * Flip iDeltaZ to positive, if negative,
+ * because always need to generate a *positive* number of
+ * button clicks for the Z axis.
+ */
+ if (iDeltaZ < 0) {
+ iDeltaZ *= -1;
}
- /* Generate X input messages for each wheel delta we have seen */
- while (iDeltaZ--)
- {
- /* Push the wheel button */
- winMouseButtonsSendEvent (ButtonPress, button);
+ /* Generate X input messages for each wheel delta we have seen */
+ while (iDeltaZ--) {
+ /* Push the wheel button */
+ winMouseButtonsSendEvent(ButtonPress, button);
- /* Release the wheel button */
- winMouseButtonsSendEvent (ButtonRelease, button);
+ /* Release the wheel button */
+ winMouseButtonsSendEvent(ButtonRelease, button);
}
- return 0;
+ return 0;
}
-
/*
* Enqueue a mouse button event
*/
void
-winMouseButtonsSendEvent (int iEventType, int iButton)
+winMouseButtonsSendEvent(int iEventType, int iButton)
{
- ValuatorMask mask;
+ ValuatorMask mask;
- if (g_winMouseButtonMap)
- iButton = g_winMouseButtonMap[iButton];
+ if (g_winMouseButtonMap)
+ iButton = g_winMouseButtonMap[iButton];
- valuator_mask_zero(&mask);
- QueuePointerEvents(g_pwinPointer, iEventType, iButton,
- POINTER_RELATIVE, &mask);
+ valuator_mask_zero(&mask);
+ QueuePointerEvents(g_pwinPointer, iEventType, iButton,
+ POINTER_RELATIVE, &mask);
winDebug("winMouseButtonsSendEvent: iEventType: %d, iButton: %d\n",
- iEventType, iButton);
+ iEventType, iButton);
}
-
/*
* Decide what to do with a Windows mouse message
*/
int
-winMouseButtonsHandle (ScreenPtr pScreen,
- int iEventType, int iButton,
- WPARAM wParam)
+winMouseButtonsHandle(ScreenPtr pScreen,
+ int iEventType, int iButton, WPARAM wParam)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Send button events right away if emulate 3 buttons is off */
- if (pScreenInfo->iE3BTimeout == WIN_E3B_OFF)
- {
- /* Emulate 3 buttons is off, send the button event */
- winMouseButtonsSendEvent (iEventType, iButton);
- return 0;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Send button events right away if emulate 3 buttons is off */
+ if (pScreenInfo->iE3BTimeout == WIN_E3B_OFF) {
+ /* Emulate 3 buttons is off, send the button event */
+ winMouseButtonsSendEvent(iEventType, iButton);
+ return 0;
}
- /* Emulate 3 buttons is on, let the fun begin */
- if (iEventType == ButtonPress
- && pScreenPriv->iE3BCachedPress == 0
- && !pScreenPriv->fE3BFakeButton2Sent)
- {
- /*
- * Button was pressed, no press is cached,
- * and there is no fake button 2 release pending.
- */
-
- /* Store button press type */
- pScreenPriv->iE3BCachedPress = iButton;
-
- /*
- * Set a timer to send this button press if the other button
- * is not pressed within the timeout time.
- */
- SetTimer (pScreenPriv->hwndScreen,
- WIN_E3B_TIMER_ID,
- pScreenInfo->iE3BTimeout,
- NULL);
+ /* Emulate 3 buttons is on, let the fun begin */
+ if (iEventType == ButtonPress
+ && pScreenPriv->iE3BCachedPress == 0
+ && !pScreenPriv->fE3BFakeButton2Sent) {
+ /*
+ * Button was pressed, no press is cached,
+ * and there is no fake button 2 release pending.
+ */
+
+ /* Store button press type */
+ pScreenPriv->iE3BCachedPress = iButton;
+
+ /*
+ * Set a timer to send this button press if the other button
+ * is not pressed within the timeout time.
+ */
+ SetTimer(pScreenPriv->hwndScreen,
+ WIN_E3B_TIMER_ID, pScreenInfo->iE3BTimeout, NULL);
}
- else if (iEventType == ButtonPress
- && pScreenPriv->iE3BCachedPress != 0
- && pScreenPriv->iE3BCachedPress != iButton
- && !pScreenPriv->fE3BFakeButton2Sent)
- {
- /*
- * Button press is cached, other button was pressed,
- * and there is no fake button 2 release pending.
- */
-
- /* Mouse button was cached and other button was pressed */
- KillTimer (pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
- pScreenPriv->iE3BCachedPress = 0;
-
- /* Send fake middle button */
- winMouseButtonsSendEvent (ButtonPress, Button2);
-
- /* Indicate that a fake middle button event was sent */
- pScreenPriv->fE3BFakeButton2Sent = TRUE;
+ else if (iEventType == ButtonPress
+ && pScreenPriv->iE3BCachedPress != 0
+ && pScreenPriv->iE3BCachedPress != iButton
+ && !pScreenPriv->fE3BFakeButton2Sent) {
+ /*
+ * Button press is cached, other button was pressed,
+ * and there is no fake button 2 release pending.
+ */
+
+ /* Mouse button was cached and other button was pressed */
+ KillTimer(pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
+ pScreenPriv->iE3BCachedPress = 0;
+
+ /* Send fake middle button */
+ winMouseButtonsSendEvent(ButtonPress, Button2);
+
+ /* Indicate that a fake middle button event was sent */
+ pScreenPriv->fE3BFakeButton2Sent = TRUE;
}
- else if (iEventType == ButtonRelease
- && pScreenPriv->iE3BCachedPress == iButton)
- {
- /*
- * Cached button was released before timer ran out,
- * and before the other mouse button was pressed.
- */
- KillTimer (pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
- pScreenPriv->iE3BCachedPress = 0;
-
- /* Send cached press, then send release */
- winMouseButtonsSendEvent (ButtonPress, iButton);
- winMouseButtonsSendEvent (ButtonRelease, iButton);
+ else if (iEventType == ButtonRelease
+ && pScreenPriv->iE3BCachedPress == iButton) {
+ /*
+ * Cached button was released before timer ran out,
+ * and before the other mouse button was pressed.
+ */
+ KillTimer(pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
+ pScreenPriv->iE3BCachedPress = 0;
+
+ /* Send cached press, then send release */
+ winMouseButtonsSendEvent(ButtonPress, iButton);
+ winMouseButtonsSendEvent(ButtonRelease, iButton);
}
- else if (iEventType == ButtonRelease
- && pScreenPriv->fE3BFakeButton2Sent
- && !(wParam & MK_LBUTTON)
- && !(wParam & MK_RBUTTON))
- {
- /*
- * Fake button 2 was sent and both mouse buttons have now been released
- */
- pScreenPriv->fE3BFakeButton2Sent = FALSE;
-
- /* Send middle mouse button release */
- winMouseButtonsSendEvent (ButtonRelease, Button2);
+ else if (iEventType == ButtonRelease
+ && pScreenPriv->fE3BFakeButton2Sent && !(wParam & MK_LBUTTON)
+ && !(wParam & MK_RBUTTON)) {
+ /*
+ * Fake button 2 was sent and both mouse buttons have now been released
+ */
+ pScreenPriv->fE3BFakeButton2Sent = FALSE;
+
+ /* Send middle mouse button release */
+ winMouseButtonsSendEvent(ButtonRelease, Button2);
}
- else if (iEventType == ButtonRelease
- && pScreenPriv->iE3BCachedPress == 0
- && !pScreenPriv->fE3BFakeButton2Sent)
- {
- /*
- * Button was release, no button is cached,
- * and there is no fake button 2 release is pending.
- */
- winMouseButtonsSendEvent (ButtonRelease, iButton);
+ else if (iEventType == ButtonRelease
+ && pScreenPriv->iE3BCachedPress == 0
+ && !pScreenPriv->fE3BFakeButton2Sent) {
+ /*
+ * Button was release, no button is cached,
+ * and there is no fake button 2 release is pending.
+ */
+ winMouseButtonsSendEvent(ButtonRelease, iButton);
}
- return 0;
+ return 0;
}
/**
* Enqueue a motion event.
*
*/
-void winEnqueueMotion(int x, int y)
+void
+winEnqueueMotion(int x, int y)
{
- int valuators[2];
- ValuatorMask mask;
+ int valuators[2];
+ ValuatorMask mask;
- valuators[0] = x;
- valuators[1] = y;
+ valuators[0] = x;
+ valuators[1] = y;
- valuator_mask_set_range(&mask, 0, 2, valuators);
- QueuePointerEvents(g_pwinPointer, MotionNotify, 0,
- POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
+ valuator_mask_set_range(&mask, 0, 2, valuators);
+ QueuePointerEvents(g_pwinPointer, MotionNotify, 0,
+ POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
}
diff --git a/xorg-server/hw/xwin/winmsg.c b/xorg-server/hw/xwin/winmsg.c
index e3d68915f..3b08d4fde 100644
--- a/xorg-server/hw/xwin/winmsg.c
+++ b/xorg-server/hw/xwin/winmsg.c
@@ -39,22 +39,29 @@
#include <stdarg.h>
#ifdef WINDBG
+
+
+
+
+
void
-winDebug (const char *format, ...)
+winDebug(const char *format, ...)
{
- va_list ap;
- va_start (ap, format);
- LogVMessageVerb(X_NONE, 3, format, ap);
- va_end (ap);
+ va_list ap;
+
+ va_start(ap, format);
+ LogVMessageVerb(X_NONE, 3, format, ap);
+ va_end(ap);
}
void
winDebug4 (const char *format, ...)
{
- va_list ap;
- va_start (ap, format);
+ va_list ap;
+
+ va_start(ap, format);
LogVMessageVerb(X_NONE, 4, format, ap);
- va_end (ap);
+ va_end(ap);
}
#endif
@@ -68,51 +75,50 @@ void
winW32ErrorEx(const char *msg, DWORD errorcode)
{
LPVOID buffer;
- if (!FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- errorcode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &buffer,
- 0,
- NULL ))
- {
+
+ if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ errorcode,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) & buffer, 0, NULL)) {
ErrorF(msg);
ErrorF("Unknown error in FormatMessage!\n");
}
- else
- {
+ else {
ErrorF("%s %s", msg, (char *)buffer);
LocalFree(buffer);
}
}
#ifdef WINDBG
-void winDebugWin32Message(const char* function, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+void
+winDebugWin32Message(const char *function, HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
{
- static int force = 0;
-
- if (message >= WM_USER)
- {
- if (force || getenv("WIN_DEBUG_MESSAGES") || getenv("WIN_DEBUG_WM_USER"))
- {
- winDebug("%s - Message WM_USER + %d\n", function, message - WM_USER);
- winDebug("\thwnd 0x%x wParam 0x%x lParam 0x%x\n", hwnd, wParam, lParam);
- }
+ static int force = 0;
+
+ if (message >= WM_USER) {
+ if (force || getenv("WIN_DEBUG_MESSAGES") ||
+ getenv("WIN_DEBUG_WM_USER")) {
+ winDebug("%s - Message WM_USER + %d\n", function,
+ message - WM_USER);
+ winDebug("\thwnd 0x%x wParam 0x%x lParam 0x%x\n", hwnd, wParam,
+ lParam);
+ }
}
- else if (message < MESSAGE_NAMES_LEN && MESSAGE_NAMES[message])
- {
- const char *msgname = MESSAGE_NAMES[message];
- char buffer[64];
- snprintf(buffer, sizeof(buffer), "WIN_DEBUG_%s", msgname);
- buffer[63] = 0;
- if (force || getenv("WIN_DEBUG_MESSAGES") || getenv(buffer))
- {
- winDebug("%s - Message %s\n", function, MESSAGE_NAMES[message]);
- winDebug("\thwnd 0x%x wParam 0x%x lParam 0x%x\n", hwnd, wParam, lParam);
- }
+ else if (message < MESSAGE_NAMES_LEN && MESSAGE_NAMES[message]) {
+ const char *msgname = MESSAGE_NAMES[message];
+ char buffer[64];
+
+ snprintf(buffer, sizeof(buffer), "WIN_DEBUG_%s", msgname);
+ buffer[63] = 0;
+ if (force || getenv("WIN_DEBUG_MESSAGES") || getenv(buffer)) {
+ winDebug("%s - Message %s\n", function, MESSAGE_NAMES[message]);
+ winDebug("\thwnd 0x%x wParam 0x%x lParam 0x%x\n", hwnd, wParam,
+ lParam);
+ }
}
}
#endif
diff --git a/xorg-server/hw/xwin/winmultiwindowclass.c b/xorg-server/hw/xwin/winmultiwindowclass.c
index ca08ae483..cc7628d5c 100644
--- a/xorg-server/hw/xwin/winmultiwindowclass.c
+++ b/xorg-server/hw/xwin/winmultiwindowclass.c
@@ -43,287 +43,255 @@
DEFINE_ATOM_HELPER(AtmWmWindowRole, "WM_WINDOW_ROLE")
-
int
-winMultiWindowGetClassHint (WindowPtr pWin, char **res_name, char **res_class)
+winMultiWindowGetClassHint(WindowPtr pWin, char **res_name, char **res_class)
{
- struct _Window *pwin;
- struct _Property *prop;
- int len_name, len_class;
-
- if (!pWin || !res_name || !res_class)
- {
- ErrorF ("winMultiWindowGetClassHint - pWin, res_name, or res_class was "
- "NULL\n");
- return 0;
+ struct _Window *pwin;
+ struct _Property *prop;
+ int len_name, len_class;
+
+ if (!pWin || !res_name || !res_class) {
+ ErrorF("winMultiWindowGetClassHint - pWin, res_name, or res_class was "
+ "NULL\n");
+ return 0;
}
-
- pwin = (struct _Window*) pWin;
-
- if (pwin->optional)
- prop = (struct _Property *) pwin->optional->userProps;
- else
- prop = NULL;
-
- *res_name = *res_class = NULL;
-
- while (prop)
- {
- if (prop->propertyName == XA_WM_CLASS
- && prop->type == XA_STRING
- && prop->format == 8
- && prop->data)
- {
- len_name = strlen ((char *) prop->data);
-
- (*res_name) = malloc (len_name + 1);
-
- if (!*res_name)
- {
- ErrorF ("winMultiWindowGetClassHint - *res_name was NULL\n");
- return 0;
- }
-
- /* Add one to len_name to allow copying of trailing 0 */
- strncpy ((*res_name), prop->data, len_name + 1);
-
- if (len_name == prop->size)
- len_name--;
-
- len_class = strlen (((char *)prop->data) + 1 + len_name);
-
- (*res_class) = malloc (len_class + 1);
-
- if (!*res_class)
- {
- ErrorF ("winMultiWindowGetClassHint - *res_class was NULL\n");
-
- /* Free the previously allocated res_name */
- free (*res_name);
- return 0;
- }
-
- strcpy ((*res_class), ((char *)prop->data) + 1 + len_name);
-
- return 1;
- }
- else
- prop = prop->next;
+
+ pwin = (struct _Window *) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ *res_name = *res_class = NULL;
+
+ while (prop) {
+ if (prop->propertyName == XA_WM_CLASS
+ && prop->type == XA_STRING && prop->format == 8 && prop->data) {
+ len_name = strlen((char *) prop->data);
+
+ (*res_name) = malloc(len_name + 1);
+
+ if (!*res_name) {
+ ErrorF("winMultiWindowGetClassHint - *res_name was NULL\n");
+ return 0;
+ }
+
+ /* Add one to len_name to allow copying of trailing 0 */
+ strncpy((*res_name), prop->data, len_name + 1);
+
+ if (len_name == prop->size)
+ len_name--;
+
+ len_class = strlen(((char *) prop->data) + 1 + len_name);
+
+ (*res_class) = malloc(len_class + 1);
+
+ if (!*res_class) {
+ ErrorF("winMultiWindowGetClassHint - *res_class was NULL\n");
+
+ /* Free the previously allocated res_name */
+ free(*res_name);
+ return 0;
+ }
+
+ strcpy((*res_class), ((char *) prop->data) + 1 + len_name);
+
+ return 1;
+ }
+ else
+ prop = prop->next;
}
-
- return 0;
-}
+ return 0;
+}
int
-winMultiWindowGetWMHints (WindowPtr pWin, WinXWMHints *hints)
+winMultiWindowGetWMHints(WindowPtr pWin, WinXWMHints * hints)
{
- struct _Window *pwin;
- struct _Property *prop;
+ struct _Window *pwin;
+ struct _Property *prop;
- if (!pWin || !hints)
- {
- ErrorF ("winMultiWindowGetWMHints - pWin or hints was NULL\n");
- return 0;
+ if (!pWin || !hints) {
+ ErrorF("winMultiWindowGetWMHints - pWin or hints was NULL\n");
+ return 0;
}
- pwin = (struct _Window*) pWin;
-
- if (pwin->optional)
- prop = (struct _Property *) pwin->optional->userProps;
- else
- prop = NULL;
-
- memset (hints, 0, sizeof (WinXWMHints));
-
- while (prop)
- {
- if (prop->propertyName == XA_WM_HINTS
- && prop->format == 32
- && prop->data)
- {
- memcpy (hints, prop->data, 4*(int)prop->size); /* format/8 = 4 */
- return 1;
- }
- else
- prop = prop->next;
+ pwin = (struct _Window *) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ memset(hints, 0, sizeof(WinXWMHints));
+
+ while (prop) {
+ if (prop->propertyName == XA_WM_HINTS && prop->data
+ && prop->format == 32) {
+ memcpy (hints, prop->data, 4*(int)prop->size); /* format/8 = 4 */
+ return 1;
+ }
+ else
+ prop = prop->next;
}
-
- return 0;
-}
+ return 0;
+}
int
-winMultiWindowGetWindowRole (WindowPtr pWin, char **res_role)
+winMultiWindowGetWindowRole(WindowPtr pWin, char **res_role)
{
- struct _Window *pwin;
- struct _Property *prop;
- int len_role;
-
- if (!pWin || !res_role)
- return 0;
-
- pwin = (struct _Window*) pWin;
-
- if (pwin->optional)
- prop = (struct _Property *) pwin->optional->userProps;
- else
- prop = NULL;
-
- *res_role = NULL;
- while (prop)
- {
- if (prop->propertyName == AtmWmWindowRole ()
- && prop->type == XA_STRING
- && prop->format == 8
- && prop->data)
- {
- len_role= prop->size;
-
- (*res_role) = malloc (len_role + 1);
-
- if (!*res_role)
- {
- ErrorF ("winMultiWindowGetWindowRole - *res_role was NULL\n");
- return 0;
- }
-
- strncpy ((*res_role), prop->data, len_role);
- (*res_role)[len_role] = 0;
-
- return 1;
- }
- else
- prop = prop->next;
+ struct _Window *pwin;
+ struct _Property *prop;
+ int len_role;
+
+ if (!pWin || !res_role)
+ return 0;
+
+ pwin = (struct _Window *) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ *res_role = NULL;
+ while (prop) {
+ if (prop->propertyName == AtmWmWindowRole()
+ && prop->type == XA_STRING && prop->format == 8 && prop->data) {
+ len_role = prop->size;
+
+ (*res_role) = malloc(len_role + 1);
+
+ if (!*res_role) {
+ ErrorF("winMultiWindowGetWindowRole - *res_role was NULL\n");
+ return 0;
+ }
+
+ strncpy((*res_role), prop->data, len_role);
+ (*res_role)[len_role] = 0;
+
+ return 1;
+ }
+ else
+ prop = prop->next;
}
-
- return 0;
-}
+ return 0;
+}
int
-winMultiWindowGetWMNormalHints (WindowPtr pWin, WinXSizeHints *hints)
+winMultiWindowGetWMNormalHints(WindowPtr pWin, WinXSizeHints * hints)
{
- struct _Window *pwin;
- struct _Property *prop;
+ struct _Window *pwin;
+ struct _Property *prop;
- if (!pWin || !hints)
- {
- ErrorF ("winMultiWindowGetWMNormalHints - pWin or hints was NULL\n");
- return 0;
+ if (!pWin || !hints) {
+ ErrorF("winMultiWindowGetWMNormalHints - pWin or hints was NULL\n");
+ return 0;
}
- pwin = (struct _Window*) pWin;
-
- if (pwin->optional)
- prop = (struct _Property *) pwin->optional->userProps;
- else
- prop = NULL;
-
- memset (hints, 0, sizeof (WinXSizeHints));
-
- while (prop)
- {
- if (prop->propertyName == XA_WM_NORMAL_HINTS
- && prop->format == 32
- && prop->data)
- {
- memcpy (hints, prop->data, 4*(int)prop->size); /* format/8 = 4 */
- return 1;
- }
- else
- prop = prop->next;
+ pwin = (struct _Window *) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ memset(hints, 0, sizeof(WinXSizeHints));
+
+ while (prop) {
+ if (prop->propertyName == XA_WM_NORMAL_HINTS && prop->data
+ && prop->format == 32) {
+ memcpy (hints, prop->data, 4*(int)prop->size); /* format/8 = 4 */
+ return 1;
+ }
+ else
+ prop = prop->next;
}
- return 0;
+ return 0;
}
int
-winMultiWindowGetTransientFor (WindowPtr pWin, WindowPtr *ppDaddy)
+winMultiWindowGetTransientFor(WindowPtr pWin, WindowPtr *ppDaddy)
{
- struct _Window *pwin;
- struct _Property *prop;
+ struct _Window *pwin;
+ struct _Property *prop;
- if (!pWin)
- {
- ErrorF ("winMultiWindowGetTransientFor - pWin was NULL\n");
- return 0;
+ if (!pWin) {
+ ErrorF("winMultiWindowGetTransientFor - pWin was NULL\n");
+ return 0;
}
- pwin = (struct _Window*) pWin;
-
- if (pwin->optional)
- prop = (struct _Property *) pwin->optional->userProps;
- else
- prop = NULL;
-
- if (ppDaddy)
- *ppDaddy = NULL;
-
- while (prop)
- {
- if (prop->propertyName == XA_WM_TRANSIENT_FOR
- && prop->format == 32
- && prop->data)
- {
- if (ppDaddy)
- memcpy (ppDaddy, prop->data, 4*(int)prop->size); /* format/8 = 4 */
- return 1;
+ pwin = (struct _Window *) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ if (ppDaddy)
+ *ppDaddy = NULL;
+
+ while (prop) {
+ if (prop->propertyName == XA_WM_TRANSIENT_FOR
+ && prop->format == 32
+ && prop->data) {
+ if (ppDaddy)
+ memcpy (ppDaddy, prop->data, 4*(int)prop->size); /* format/8 = 4 */
+ return 1;
}
- else
- prop = prop->next;
+ else
+ prop = prop->next;
}
- return 0;
+ return 0;
}
int
-winMultiWindowGetWMName (WindowPtr pWin, char **wmName)
+winMultiWindowGetWMName(WindowPtr pWin, char **wmName)
{
- struct _Window *pwin;
- struct _Property *prop;
- int len_name;
-
- if (!pWin || !wmName)
- {
- ErrorF ("winMultiWindowGetClassHint - pWin, res_name, or res_class was "
- "NULL\n");
- return 0;
+ struct _Window *pwin;
+ struct _Property *prop;
+ int len_name;
+
+ if (!pWin || !wmName) {
+ ErrorF("winMultiWindowGetClassHint - pWin, res_name, or res_class was "
+ "NULL\n");
+ return 0;
}
-
- pwin = (struct _Window*) pWin;
-
- if (pwin->optional)
- prop = (struct _Property *) pwin->optional->userProps;
- else
- prop = NULL;
-
- *wmName = NULL;
-
- while (prop)
- {
- if (prop->propertyName == XA_WM_NAME
- && prop->type == XA_STRING
- && prop->data)
- {
- len_name = prop->size;
-
- (*wmName) = malloc (len_name + 1);
-
- if (!*wmName)
- {
- ErrorF ("winMultiWindowGetWMName - *wmName was NULL\n");
- return 0;
- }
-
- strncpy ((*wmName), prop->data, len_name);
- (*wmName)[len_name] = 0;
-
- return 1;
- }
- else
- prop = prop->next;
+
+ pwin = (struct _Window *) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ *wmName = NULL;
+
+ while (prop) {
+ if (prop->propertyName == XA_WM_NAME
+ && prop->type == XA_STRING && prop->data) {
+ len_name = prop->size;
+
+ (*wmName) = malloc(len_name + 1);
+
+ if (!*wmName) {
+ ErrorF("winMultiWindowGetWMName - *wmName was NULL\n");
+ return 0;
+ }
+
+ strncpy((*wmName), prop->data, len_name);
+ (*wmName)[len_name] = 0;
+
+ return 1;
+ }
+ else
+ prop = prop->next;
}
-
- return 0;
+
+ return 0;
}
diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c
index d534cf0b7..42bdb5f9c 100644
--- a/xorg-server/hw/xwin/winmultiwindowicons.c
+++ b/xorg-server/hw/xwin/winmultiwindowicons.c
@@ -39,235 +39,221 @@
#include "propertyst.h"
#include "windowstr.h"
-
/*
* Prototypes for local functions
*/
static void
-winScaleXBitmapToWindows (int iconSize, int effBPP,
- PixmapPtr pixmap, unsigned char *image);
+winScaleXBitmapToWindows(int iconSize, int effBPP,
+ PixmapPtr pixmap, unsigned char *image);
/*
* Scale an X icon bitmap into a Windoze icon bitmap
*/
static void
-winScaleXBitmapToWindows (int iconSize,
- int effBPP,
- PixmapPtr pixmap,
- unsigned char *image)
+winScaleXBitmapToWindows(int iconSize,
+ int effBPP, PixmapPtr pixmap, unsigned char *image)
{
- int row, column, effXBPP, effXDepth;
- unsigned char *outPtr;
- char *iconData = 0;
- int stride, xStride;
- float factX, factY;
- int posX, posY;
- unsigned char *ptr;
- unsigned int zero;
- unsigned int color;
-
- effXBPP = BitsPerPixel(pixmap->drawable.depth);
- effXDepth = pixmap->drawable.depth;
-
- if (pixmap->drawable.bitsPerPixel == 15)
- effXBPP = 16;
-
- if (pixmap->drawable.depth == 15)
- effXDepth = 16;
-
- /* Need 16-bit aligned rows for DDBitmaps */
- stride = ((iconSize * effBPP + 15) & (~15)) / 8;
- xStride = PixmapBytePad (pixmap->drawable.width, pixmap->drawable.depth);
- if (stride == 0 || xStride == 0)
- {
- ErrorF ("winScaleXBitmapToWindows - stride or xStride is zero. "
- "Bailing.\n");
- return;
+ int row, column, effXBPP, effXDepth;
+ unsigned char *outPtr;
+ char *iconData = 0;
+ int stride, xStride;
+ float factX, factY;
+ int posX, posY;
+ unsigned char *ptr;
+ unsigned int zero;
+ unsigned int color;
+
+ effXBPP = BitsPerPixel(pixmap->drawable.depth);
+ effXDepth = pixmap->drawable.depth;
+
+ if (pixmap->drawable.bitsPerPixel == 15)
+ effXBPP = 16;
+
+ if (pixmap->drawable.depth == 15)
+ effXDepth = 16;
+
+ /* Need 16-bit aligned rows for DDBitmaps */
+ stride = ((iconSize * effBPP + 15) & (~15)) / 8;
+ xStride = PixmapBytePad(pixmap->drawable.width, pixmap->drawable.depth);
+ if (stride == 0 || xStride == 0) {
+ ErrorF("winScaleXBitmapToWindows - stride or xStride is zero. "
+ "Bailing.\n");
+ return;
}
- /* Allocate memory for icon data */
- iconData = malloc (xStride * pixmap->drawable.height);
- if (!iconData)
- {
- ErrorF ("winScaleXBitmapToWindows - malloc failed for iconData. "
- "Bailing.\n");
- return;
+ /* Allocate memory for icon data */
+ iconData = malloc(xStride * pixmap->drawable.height);
+ if (!iconData) {
+ ErrorF("winScaleXBitmapToWindows - malloc failed for iconData. "
+ "Bailing.\n");
+ return;
}
- /* Get icon data */
- miGetImage ((DrawablePtr) &(pixmap->drawable), 0, 0,
- pixmap->drawable.width, pixmap->drawable.height,
- ZPixmap, 0xffffffff, iconData);
-
- /* Keep aspect ratio */
- factX = ((float)pixmap->drawable.width) / ((float)iconSize);
- factY = ((float)pixmap->drawable.height) / ((float)iconSize);
- if (factX > factY)
- factY = factX;
- else
- factX = factY;
-
- /* Out-of-bounds, fill icon with zero */
- zero = 0;
-
- for (row = 0; row < iconSize; row++)
- {
- outPtr = image + stride * row;
- for (column = 0; column < iconSize; column++)
- {
- posX = factX * column;
- posY = factY * row;
-
- ptr = (unsigned char*) iconData + posY*xStride;
- if (effXBPP == 1)
- {
- ptr += posX / 8;
-
- /* Out of X icon bounds, leave space blank */
- if (posX >= pixmap->drawable.width
- || posY >= pixmap->drawable.height)
- ptr = (unsigned char *) &zero;
-
- if ((*ptr) & (1 << (posX & 7)))
- switch (effBPP)
- {
- case 32:
- *(outPtr++) = 0;
- case 24:
- *(outPtr++) = 0;
- case 16:
- *(outPtr++) = 0;
- case 8:
- *(outPtr++) = 0;
- break;
- case 1:
- outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
- break;
- }
- else
- switch (effBPP)
- {
- case 32:
- *(outPtr++) = 255;
- *(outPtr++) = 255;
- *(outPtr++) = 255;
- *(outPtr++) = 0;
- break;
- case 24:
- *(outPtr++) = 255;
- case 16:
- *(outPtr++) = 255;
- case 8:
- *(outPtr++) = 255;
- break;
- case 1:
- outPtr[column / 8] |= (1 << (7 - (column & 7)));
- break;
- }
- }
- else if (effXDepth == 24 || effXDepth == 32)
- {
- ptr += posX * (effXBPP / 8);
-
- /* Out of X icon bounds, leave space blank */
- if (posX >= pixmap->drawable.width
- || posY >= pixmap->drawable.height)
- ptr = (unsigned char *) &zero;
- color = (((*ptr) << 16)
- + ((*(ptr + 1)) << 8)
- + ((*(ptr + 2)) << 0));
- switch (effBPP)
- {
- case 32:
- *(outPtr++) = *(ptr++); /* b */
- *(outPtr++) = *(ptr++); /* g */
- *(outPtr++) = *(ptr++); /* r */
- *(outPtr++) = (effXDepth == 32) ? *(ptr++) : 0x0; /* alpha */
- break;
- case 24:
- *(outPtr++) = *(ptr++);
- *(outPtr++) = *(ptr++);
- *(outPtr++) = *(ptr++);
- break;
- case 16:
- color = ((((*ptr) >> 2) << 10)
- + (((*(ptr + 1)) >> 2) << 5)
- + (((*(ptr + 2)) >> 2)));
- *(outPtr++) = (color >> 8);
- *(outPtr++) = (color & 255);
- break;
- case 8:
- color = (((*ptr))) + (((*(ptr + 1)))) + (((*(ptr + 2))));
- color /= 3;
- *(outPtr++) = color;
- break;
- case 1:
- if (color)
- outPtr[column / 8] |= (1 << (7 - (column & 7)));
- else
- outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
- }
- }
- else if (effXDepth == 16)
- {
- ptr += posX * (effXBPP / 8);
-
- /* Out of X icon bounds, leave space blank */
- if (posX >= pixmap->drawable.width
- || posY >= pixmap->drawable.height)
- ptr = (unsigned char *) &zero;
- color = ((*ptr) << 8) + (*(ptr + 1));
- switch (effBPP)
- {
- case 32:
- *(outPtr++) = (color & 31) << 2;
- *(outPtr++) = ((color >> 5) & 31) << 2;
- *(outPtr++) = ((color >> 10) & 31) << 2;
- *(outPtr++) = 0; /* resvd */
- break;
- case 24:
- *(outPtr++) = (color & 31) << 2;
- *(outPtr++) = ((color >> 5) & 31) << 2;
- *(outPtr++) = ((color >> 10) & 31) << 2;
- break;
- case 16:
- *(outPtr++) = *(ptr++);
- *(outPtr++) = *(ptr++);
- break;
- case 8:
- *(outPtr++) = (((color & 31)
- + ((color >> 5) & 31)
- + ((color >> 10) & 31)) / 3) << 2;
- break;
- case 1:
- if (color)
- outPtr[column / 8] |= (1 << (7 - (column & 7)));
- else
- outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
- break;
- } /* end switch(effbpp) */
- } /* end if effxbpp==16) */
- } /* end for column */
- } /* end for row */
- free (iconData);
+ /* Get icon data */
+ miGetImage((DrawablePtr) &(pixmap->drawable), 0, 0,
+ pixmap->drawable.width, pixmap->drawable.height,
+ ZPixmap, 0xffffffff, iconData);
+
+ /* Keep aspect ratio */
+ factX = ((float) pixmap->drawable.width) / ((float) iconSize);
+ factY = ((float) pixmap->drawable.height) / ((float) iconSize);
+ if (factX > factY)
+ factY = factX;
+ else
+ factX = factY;
+
+ /* Out-of-bounds, fill icon with zero */
+ zero = 0;
+
+ for (row = 0; row < iconSize; row++) {
+ outPtr = image + stride * row;
+ for (column = 0; column < iconSize; column++) {
+ posX = factX * column;
+ posY = factY * row;
+
+ ptr = (unsigned char *) iconData + posY * xStride;
+ if (effXBPP == 1) {
+ ptr += posX / 8;
+
+ /* Out of X icon bounds, leave space blank */
+ if (posX >= pixmap->drawable.width
+ || posY >= pixmap->drawable.height)
+ ptr = (unsigned char *) &zero;
+
+ if ((*ptr) & (1 << (posX & 7)))
+ switch (effBPP) {
+ case 32:
+ *(outPtr++) = 0;
+ case 24:
+ *(outPtr++) = 0;
+ case 16:
+ *(outPtr++) = 0;
+ case 8:
+ *(outPtr++) = 0;
+ break;
+ case 1:
+ outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
+ break;
+ }
+ else
+ switch (effBPP) {
+ case 32:
+ *(outPtr++) = 255;
+ *(outPtr++) = 255;
+ *(outPtr++) = 255;
+ *(outPtr++) = 0;
+ break;
+ case 24:
+ *(outPtr++) = 255;
+ case 16:
+ *(outPtr++) = 255;
+ case 8:
+ *(outPtr++) = 255;
+ break;
+ case 1:
+ outPtr[column / 8] |= (1 << (7 - (column & 7)));
+ break;
+ }
+ }
+ else if (effXDepth == 24 || effXDepth == 32) {
+ ptr += posX * (effXBPP / 8);
+
+ /* Out of X icon bounds, leave space blank */
+ if (posX >= pixmap->drawable.width
+ || posY >= pixmap->drawable.height)
+ ptr = (unsigned char *) &zero;
+ color = (((*ptr) << 16)
+ + ((*(ptr + 1)) << 8)
+ + ((*(ptr + 2)) << 0));
+ switch (effBPP) {
+ case 32:
+ *(outPtr++) = *(ptr++); /* b */
+ *(outPtr++) = *(ptr++); /* g */
+ *(outPtr++) = *(ptr++); /* r */
+ *(outPtr++) = (effXDepth == 32) ? *(ptr++) : 0x0; /* alpha */
+ break;
+ case 24:
+ *(outPtr++) = *(ptr++);
+ *(outPtr++) = *(ptr++);
+ *(outPtr++) = *(ptr++);
+ break;
+ case 16:
+ color = ((((*ptr) >> 2) << 10)
+ + (((*(ptr + 1)) >> 2) << 5)
+ + (((*(ptr + 2)) >> 2)));
+ *(outPtr++) = (color >> 8);
+ *(outPtr++) = (color & 255);
+ break;
+ case 8:
+ color = (((*ptr))) + (((*(ptr + 1)))) + (((*(ptr + 2))));
+ color /= 3;
+ *(outPtr++) = color;
+ break;
+ case 1:
+ if (color)
+ outPtr[column / 8] |= (1 << (7 - (column & 7)));
+ else
+ outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
+ }
+ }
+ else if (effXDepth == 16) {
+ ptr += posX * (effXBPP / 8);
+
+ /* Out of X icon bounds, leave space blank */
+ if (posX >= pixmap->drawable.width
+ || posY >= pixmap->drawable.height)
+ ptr = (unsigned char *) &zero;
+ color = ((*ptr) << 8) + (*(ptr + 1));
+ switch (effBPP) {
+ case 32:
+ *(outPtr++) = (color & 31) << 2;
+ *(outPtr++) = ((color >> 5) & 31) << 2;
+ *(outPtr++) = ((color >> 10) & 31) << 2;
+ *(outPtr++) = 0; /* resvd */
+ break;
+ case 24:
+ *(outPtr++) = (color & 31) << 2;
+ *(outPtr++) = ((color >> 5) & 31) << 2;
+ *(outPtr++) = ((color >> 10) & 31) << 2;
+ break;
+ case 16:
+ *(outPtr++) = *(ptr++);
+ *(outPtr++) = *(ptr++);
+ break;
+ case 8:
+ *(outPtr++) = (((color & 31)
+ + ((color >> 5) & 31)
+ + ((color >> 10) & 31)) / 3) << 2;
+ break;
+ case 1:
+ if (color)
+ outPtr[column / 8] |= (1 << (7 - (column & 7)));
+ else
+ outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
+ break;
+ } /* end switch(effbpp) */
+ } /* end if effxbpp==16) */
+ } /* end for column */
+ } /* end for row */
+ free(iconData);
}
static HICON
-NetWMToWinIconAlpha(uint32_t *icon)
+NetWMToWinIconAlpha(uint32_t * icon)
{
- int width = icon[0];
- int height = icon[1];
- uint32_t *pixels = &icon[2];
- HICON result;
- HDC hdc = GetDC(NULL);
- uint32_t *DIB_pixels;
+ int width = icon[0];
+ int height = icon[1];
+ uint32_t *pixels = &icon[2];
+ HICON result;
+ HDC hdc = GetDC(NULL);
+ uint32_t *DIB_pixels;
ICONINFO ii;
BITMAPV5HEADER bmh;
- /* Define an ARGB pixel format used for Color+Alpha icons */
+ /* Define an ARGB pixel format used for Color+Alpha icons */
ZeroMemory(&bmh,sizeof(bmh));
bmh.bV5Size = sizeof(bmh);
bmh.bV5Width = width;
@@ -280,126 +266,134 @@ NetWMToWinIconAlpha(uint32_t *icon)
bmh.bV5GreenMask = 0x0000FF00;
bmh.bV5BlueMask = 0x000000FF;
- ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO*)&bmh,
- DIB_RGB_COLORS, (void**)&DIB_pixels, NULL, 0);
- ReleaseDC(NULL, hdc);
- ii.hbmMask = CreateBitmap(width, height, 1, 1, NULL);
- memcpy(DIB_pixels, pixels, height*width*4);
+ ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO *) & bmh,
+ DIB_RGB_COLORS, (void **) &DIB_pixels, NULL,
+ 0);
+ ReleaseDC(NULL, hdc);
+ ii.hbmMask = CreateBitmap(width, height, 1, 1, NULL);
+ memcpy(DIB_pixels, pixels, height * width * 4);
- /* CreateIconIndirect() traditionally required DDBitmaps */
- /* Systems from WinXP accept 32-bit ARGB DIBitmaps with full 8-bit alpha support */
- /* The icon is created with a DIB + empty DDB mask (an MS example does the same) */
+ /* CreateIconIndirect() traditionally required DDBitmaps */
+ /* Systems from WinXP accept 32-bit ARGB DIBitmaps with full 8-bit alpha support */
+ /* The icon is created with a DIB + empty DDB mask (an MS example does the same) */
ii.fIcon = TRUE;
ii.xHotspot = 0;
ii.yHotspot = 0;
- result = CreateIconIndirect(&ii);
+ result = CreateIconIndirect(&ii);
- DeleteObject(ii.hbmColor);
- DeleteObject(ii.hbmMask);
+ DeleteObject(ii.hbmColor);
+ DeleteObject(ii.hbmMask);
- winDebug("NetWMToWinIconAlpha - %d x %d = %p\n", icon[0], icon[1], result);
- return result;
+ winDebug("NetWMToWinIconAlpha - %d x %d = %p\n", icon[0], icon[1], result);
+ return result;
}
static HICON
-NetWMToWinIconThreshold(uint32_t *icon)
+NetWMToWinIconThreshold(uint32_t * icon)
{
- int width = icon[0];
- int height = icon[1];
- uint32_t *pixels = &icon[2];
- int row, col;
- HICON result;
- ICONINFO ii;
-
- HDC hdc = GetDC(NULL);
- HDC xorDC = CreateCompatibleDC(hdc);
- HDC andDC = CreateCompatibleDC(hdc);
- ii.hbmColor = CreateCompatibleBitmap(hdc, width, height);
- ii.hbmMask = CreateCompatibleBitmap(hdc, width, height);
- ReleaseDC(NULL, hdc);
- SelectObject(xorDC, ii.hbmColor);
- SelectObject(andDC, ii.hbmMask);
-
- for (row = 0; row < height; row++) {
- for (col = 0; col < width; col++) {
- if ((*pixels & 0xFF000000) > 31<<24) { /* 31 alpha threshold, i.e. opaque above, transparent below */
- SetPixelV(xorDC, col, row, RGB(((char*)pixels)[2], ((char*)pixels)[1],
- ((char*)pixels)[0]));
- SetPixelV(andDC, col, row, RGB(0, 0, 0)); /* black mask */
- }
- else {
- SetPixelV(xorDC, col, row, RGB(0, 0, 0));
- SetPixelV(andDC, col, row, RGB(255, 255, 255)); /* white mask */
- }
- pixels++;
+ int width = icon[0];
+ int height = icon[1];
+ uint32_t *pixels = &icon[2];
+ int row, col;
+ HICON result;
+ ICONINFO ii;
+
+ HDC hdc = GetDC(NULL);
+ HDC xorDC = CreateCompatibleDC(hdc);
+ HDC andDC = CreateCompatibleDC(hdc);
+
+ ii.hbmColor = CreateCompatibleBitmap(hdc, width, height);
+ ii.hbmMask = CreateCompatibleBitmap(hdc, width, height);
+ ReleaseDC(NULL, hdc);
+ SelectObject(xorDC, ii.hbmColor);
+ SelectObject(andDC, ii.hbmMask);
+
+ for (row = 0; row < height; row++) {
+ for (col = 0; col < width; col++) {
+ if ((*pixels & 0xFF000000) > 31 << 24) { /* 31 alpha threshold, i.e. opaque above, transparent below */
+ SetPixelV(xorDC, col, row,
+ RGB(((char *) pixels)[2], ((char *) pixels)[1],
+ ((char *) pixels)[0]));
+ SetPixelV(andDC, col, row, RGB(0, 0, 0)); /* black mask */
+ }
+ else {
+ SetPixelV(xorDC, col, row, RGB(0, 0, 0));
+ SetPixelV(andDC, col, row, RGB(255, 255, 255)); /* white mask */
+ }
+ pixels++;
+ }
}
- }
- DeleteDC(xorDC);
- DeleteDC(andDC);
+ DeleteDC(xorDC);
+ DeleteDC(andDC);
ii.fIcon = TRUE;
ii.xHotspot = 0;
ii.yHotspot = 0;
- result = CreateIconIndirect(&ii);
+ result = CreateIconIndirect(&ii);
- DeleteObject(ii.hbmColor);
- DeleteObject(ii.hbmMask );
+ DeleteObject(ii.hbmColor);
+ DeleteObject(ii.hbmMask);
- winDebug("NetWMToWinIconThreshold - %d x %d = %p\n", icon[0], icon[1], result);
- return result;
+ winDebug("NetWMToWinIconThreshold - %d x %d = %p\n", icon[0], icon[1],
+ result);
+ return result;
}
static HICON
-NetWMToWinIcon(int bpp, uint32_t *icon)
+NetWMToWinIcon(int bpp, uint32_t * icon)
{
- static Bool hasIconAlphaChannel = FALSE;
- static BOOL versionChecked = FALSE;
-
- if (!versionChecked)
- {
- OSVERSIONINFOEX osvi = {0};
- ULONGLONG dwlConditionMask = 0;
-
- osvi.dwOSVersionInfoSize = sizeof (osvi);
- osvi.dwMajorVersion = 5;
- osvi.dwMinorVersion = 1;
-
- /* Windows versions later than XP have icon alpha channel suport, 2000 does not */
- VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
- VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
- hasIconAlphaChannel = VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask);
- versionChecked = TRUE;
-
- winDebug("OS has icon alpha channel support: %s\n", hasIconAlphaChannel ? "yes" : "no");
+ static Bool hasIconAlphaChannel = FALSE;
+ static BOOL versionChecked = FALSE;
+
+ if (!versionChecked) {
+ OSVERSIONINFOEX osvi = { 0 };
+ ULONGLONG dwlConditionMask = 0;
+
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ osvi.dwMajorVersion = 5;
+ osvi.dwMinorVersion = 1;
+
+ /* Windows versions later than XP have icon alpha channel suport, 2000 does not */
+ VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION,
+ VER_GREATER_EQUAL);
+ VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION,
+ VER_GREATER_EQUAL);
+ hasIconAlphaChannel =
+ VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION,
+ dwlConditionMask);
+ versionChecked = TRUE;
+
+ winDebug("OS has icon alpha channel support: %s\n",
+ hasIconAlphaChannel ? "yes" : "no");
}
- if (hasIconAlphaChannel && (bpp==32))
- return NetWMToWinIconAlpha(icon);
- else
- return NetWMToWinIconThreshold(icon);
+ if (hasIconAlphaChannel && (bpp == 32))
+ return NetWMToWinIconAlpha(icon);
+ else
+ return NetWMToWinIconThreshold(icon);
}
static pointer
GetWindowProp(WindowPtr pWin, Atom name, long int *size_return)
{
- struct _Window *pwin;
- struct _Property *prop;
-
- if (!pWin || !name) {
- ErrorF ("GetWindowProp - pWin or name was NULL\n");
- return 0;
- }
- pwin = (struct _Window*) pWin;
- if (!pwin->optional) return NULL;
- for (prop = (struct _Property *) pwin->optional->userProps;
- prop;
- prop=prop->next){
- if (prop->propertyName == name) {
- *size_return=prop->size;
- return prop->data;
+ struct _Window *pwin;
+ struct _Property *prop;
+
+ if (!pWin || !name) {
+ ErrorF("GetWindowProp - pWin or name was NULL\n");
+ return 0;
+ }
+ pwin = (struct _Window *) pWin;
+ if (!pwin->optional)
+ return NULL;
+ for (prop = (struct _Property *) pwin->optional->userProps;
+ prop; prop = prop->next) {
+ if (prop->propertyName == name) {
+ *size_return = prop->size;
+ return prop->data;
+ }
}
- }
- return NULL;
+ return NULL;
}
/*
@@ -407,130 +401,128 @@ GetWindowProp(WindowPtr pWin, Atom name, long int *size_return)
*/
HICON
-winXIconToHICON (WindowPtr pWin, int iconSize)
+winXIconToHICON(WindowPtr pWin, int iconSize)
{
- unsigned char *mask, *image, *imageMask;
- unsigned char *dst, *src;
- PixmapPtr iconPtr;
- PixmapPtr maskPtr;
- int planes, bpp, effBPP, stride, maskStride, i;
- int biggest_size = 0;
- HDC hDC;
- ICONINFO ii;
- WinXWMHints hints;
- HICON hIcon = NULL;
- uint32_t *biggest_icon = NULL;
-
- /* Try to get _NET_WM_ICON icons first */
- static Atom _XA_NET_WM_ICON;
- static int generation;
- uint32_t *icon, *icon_data = NULL;
- long int size=0;
-
- hDC = GetDC (GetDesktopWindow ());
- planes = GetDeviceCaps (hDC, PLANES);
- bpp = GetDeviceCaps (hDC, BITSPIXEL);
- ReleaseDC (GetDesktopWindow (), hDC);
-
- if (generation != serverGeneration) {
- generation = serverGeneration;
- _XA_NET_WM_ICON = MakeAtom("_NET_WM_ICON", 12, TRUE);
- }
-
- if (_XA_NET_WM_ICON) icon_data = GetWindowProp(pWin, _XA_NET_WM_ICON, &size);
- if (icon_data)
- {
- for(icon = icon_data;
- icon < &icon_data[size] && *icon;
- icon = &icon[icon[0]*icon[1]+2])
- {
- if (icon[0]==iconSize && icon[1]==iconSize)
- return NetWMToWinIcon(bpp, icon);
- /* Find the biggest icon and let Windows scale the size */
- else if (biggest_size < icon[0])
- {
- biggest_icon = icon;
- biggest_size = icon[0];
- }
- }
- if (biggest_icon)
- return NetWMToWinIcon(bpp, biggest_icon);
+ unsigned char *mask, *image, *imageMask;
+ unsigned char *dst, *src;
+ PixmapPtr iconPtr;
+ PixmapPtr maskPtr;
+ int planes, bpp, effBPP, stride, maskStride, i;
+ int biggest_size = 0;
+ HDC hDC;
+ ICONINFO ii;
+ WinXWMHints hints;
+ HICON hIcon = NULL;
+ uint32_t *biggest_icon = NULL;
+
+ /* Try to get _NET_WM_ICON icons first */
+ static Atom _XA_NET_WM_ICON;
+ static int generation;
+ uint32_t *icon, *icon_data = NULL;
+ long int size = 0;
+
+ hDC = GetDC(GetDesktopWindow());
+ planes = GetDeviceCaps(hDC, PLANES);
+ bpp = GetDeviceCaps(hDC, BITSPIXEL);
+ ReleaseDC(GetDesktopWindow(), hDC);
+
+ if (generation != serverGeneration) {
+ generation = serverGeneration;
+ _XA_NET_WM_ICON = MakeAtom("_NET_WM_ICON", 12, TRUE);
}
- winDebug("winXIconToHICON - pWin %x: no suitable NetIcon\n",(int)pWin, iconSize);
-
- winMultiWindowGetWMHints (pWin, &hints);
- if (!hints.icon_pixmap) return NULL;
-
- dixLookupResourceByType((pointer) &iconPtr, hints.icon_pixmap, RT_PIXMAP,
- NullClient, DixUnknownAccess);
-
- if (!iconPtr) return NULL;
-
- /* 15 BPP is really 16BPP as far as we care */
- if (bpp == 15)
- effBPP = 16;
- else
- effBPP = bpp;
-
- /* Need 16-bit aligned rows for DDBitmaps */
- stride = ((iconSize * effBPP + 15) & (~15)) / 8;
-
- /* Mask is 1-bit deep */
- maskStride = ((iconSize * 1 + 15) & (~15)) / 8;
-
- image = malloc (stride * iconSize);
- imageMask = malloc (stride * iconSize);
- /* Default to a completely black mask */
- mask = calloc (maskStride, iconSize);
-
- winScaleXBitmapToWindows (iconSize, effBPP, iconPtr, image);
- dixLookupResourceByType((pointer) &maskPtr, hints.icon_mask, RT_PIXMAP,
- NullClient, DixUnknownAccess);
-
- if (maskPtr)
- {
- winScaleXBitmapToWindows (iconSize, 1, maskPtr, mask);
-
- winScaleXBitmapToWindows (iconSize, effBPP, maskPtr, imageMask);
-
- /* Now we need to set all bits of the icon which are not masked */
- /* on to 0 because Color is really an XOR, not an OR function */
- dst = image;
- src = imageMask;
-
- for (i = 0; i < (stride * iconSize); i++)
- if ((*(src++)))
- *(dst++) = 0;
- else
- dst++;
+
+ if (_XA_NET_WM_ICON)
+ icon_data = GetWindowProp(pWin, _XA_NET_WM_ICON, &size);
+ if (icon_data) {
+ for (icon = icon_data;
+ icon < &icon_data[size] && *icon;
+ icon = &icon[icon[0] * icon[1] + 2]) {
+ if (icon[0] == iconSize && icon[1] == iconSize)
+ return NetWMToWinIcon(bpp, icon);
+ /* Find the biggest icon and let Windows scale the size */
+ else if (biggest_size < icon[0]) {
+ biggest_icon = icon;
+ biggest_size = icon[0];
+ }
+ }
+ if (biggest_icon)
+ return NetWMToWinIcon(bpp, biggest_icon);
}
-
- ii.fIcon = TRUE;
- ii.xHotspot = 0; /* ignored */
- ii.yHotspot = 0; /* ignored */
-
- /* Create Win32 mask from pixmap shape */
- ii.hbmMask = CreateBitmap (iconSize, iconSize, planes, 1, mask);
+ winDebug("winXIconToHICON - pWin %x: no suitable NetIcon\n", (int) pWin,
+ iconSize);
- /* Create Win32 bitmap from pixmap */
- ii.hbmColor = CreateBitmap (iconSize, iconSize, planes, bpp, image);
+ winMultiWindowGetWMHints(pWin, &hints);
+ if (!hints.icon_pixmap)
+ return NULL;
- /* Merge Win32 mask and bitmap into icon */
- hIcon = CreateIconIndirect (&ii);
+ dixLookupResourceByType((pointer) &iconPtr, hints.icon_pixmap, RT_PIXMAP,
+ NullClient, DixUnknownAccess);
- /* Release Win32 mask and bitmap */
- DeleteObject (ii.hbmMask);
- DeleteObject (ii.hbmColor);
+ if (!iconPtr)
+ return NULL;
- /* Free X mask and bitmap */
- free (mask);
- free (image);
- free (imageMask);
+ /* 15 BPP is really 16BPP as far as we care */
+ if (bpp == 15)
+ effBPP = 16;
+ else
+ effBPP = bpp;
- return hIcon;
-}
+ /* Need 16-bit aligned rows for DDBitmaps */
+ stride = ((iconSize * effBPP + 15) & (~15)) / 8;
+
+ /* Mask is 1-bit deep */
+ maskStride = ((iconSize * 1 + 15) & (~15)) / 8;
+
+ image = malloc(stride * iconSize);
+ imageMask = malloc(stride * iconSize);
+ /* Default to a completely black mask */
+ mask = calloc(maskStride, iconSize);
+
+ winScaleXBitmapToWindows(iconSize, effBPP, iconPtr, image);
+ dixLookupResourceByType((pointer) &maskPtr, hints.icon_mask, RT_PIXMAP,
+ NullClient, DixUnknownAccess);
+
+ if (maskPtr) {
+ winScaleXBitmapToWindows(iconSize, 1, maskPtr, mask);
+
+ winScaleXBitmapToWindows(iconSize, effBPP, maskPtr, imageMask);
+
+ /* Now we need to set all bits of the icon which are not masked */
+ /* on to 0 because Color is really an XOR, not an OR function */
+ dst = image;
+ src = imageMask;
+
+ for (i = 0; i < (stride * iconSize); i++)
+ if ((*(src++)))
+ *(dst++) = 0;
+ else
+ dst++;
+ }
+
+ ii.fIcon = TRUE;
+ ii.xHotspot = 0; /* ignored */
+ ii.yHotspot = 0; /* ignored */
+
+ /* Create Win32 mask from pixmap shape */
+ ii.hbmMask = CreateBitmap(iconSize, iconSize, planes, 1, mask);
+ /* Create Win32 bitmap from pixmap */
+ ii.hbmColor = CreateBitmap(iconSize, iconSize, planes, bpp, image);
+ /* Merge Win32 mask and bitmap into icon */
+ hIcon = CreateIconIndirect(&ii);
+
+ /* Release Win32 mask and bitmap */
+ DeleteObject(ii.hbmMask);
+ DeleteObject(ii.hbmColor);
+
+ /* Free X mask and bitmap */
+ free(mask);
+ free(image);
+ free(imageMask);
+
+ return hIcon;
+}
/*
* Change the Windows window icon
@@ -538,112 +530,115 @@ winXIconToHICON (WindowPtr pWin, int iconSize)
#ifdef XWIN_MULTIWINDOW
void
-winUpdateIcon (Window id)
+winUpdateIcon(Window id)
{
- WindowPtr pWin;
- HICON hIcon, hIconSmall=NULL, hIconOld;
-
- dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess);
- if (pWin)
- {
- winWindowPriv(pWin);
- if (pWinPriv->hWnd) {
- hIcon = winOverrideIcon ((unsigned long)pWin);
- if (!hIcon) {
- hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));
- if (!hIcon) {
- hIcon = g_hIconX;
- hIconSmall = g_hSmallIconX;
- } else {
- /* Leave undefined if not found */
- hIconSmall = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON));
- }
+ WindowPtr pWin;
+ HICON hIcon, hIconSmall = NULL, hIconOld;
+
+ dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient,
+ DixUnknownAccess);
+ if (pWin) {
+ winWindowPriv(pWin);
+ if (pWinPriv->hWnd) {
+ hIcon = winOverrideIcon((unsigned long) pWin);
+ if (!hIcon) {
+ hIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXICON));
+ if (!hIcon) {
+ hIcon = g_hIconX;
+ hIconSmall = g_hSmallIconX;
+ }
+ else {
+ /* Leave undefined if not found */
+ hIconSmall =
+ winXIconToHICON(pWin, GetSystemMetrics(SM_CXSMICON));
+ }
+ }
+
+ /* Set the large icon */
+ hIconOld = (HICON) SendMessage(pWinPriv->hWnd,
+ WM_SETICON, ICON_BIG,
+ (LPARAM) hIcon);
+
+ /* Delete the icon if its not the default */
+ winDestroyIcon(hIconOld);
+
+ /* Same for the small icon */
+ hIconOld = (HICON) SendMessage(pWinPriv->hWnd,
+ WM_SETICON, ICON_SMALL,
+ (LPARAM) hIconSmall);
+ winDestroyIcon(hIconOld);
}
+ }
+}
- /* Set the large icon */
- hIconOld = (HICON) SendMessage (pWinPriv->hWnd,
- WM_SETICON, ICON_BIG, (LPARAM) hIcon);
+void
+winInitGlobalIcons(void)
+{
+ int sm_cx = GetSystemMetrics(SM_CXICON);
+ int sm_cxsm = GetSystemMetrics(SM_CXSMICON);
- /* Delete the icon if its not the default */
- winDestroyIcon(hIconOld);
+ /* Load default X icon in case it's not ready yet */
+ if (!g_hIconX) {
+ g_hIconX = winOverrideDefaultIcon(sm_cx);
+ g_hSmallIconX = winOverrideDefaultIcon(sm_cxsm);
+ }
- /* Same for the small icon */
- hIconOld = (HICON) SendMessage (pWinPriv->hWnd,
- WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
- winDestroyIcon(hIconOld);
- }
- }
+ if (!g_hIconX) {
+ g_hIconX = (HICON) LoadImage(g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN),
+ IMAGE_ICON,
+ GetSystemMetrics(SM_CXICON),
+ GetSystemMetrics(SM_CYICON), 0);
+ g_hSmallIconX = (HICON) LoadImage(g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN),
+ IMAGE_ICON,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON),
+ LR_DEFAULTSIZE);
+ }
}
-void winInitGlobalIcons (void)
+void
+winSelectIcons(WindowPtr pWin, HICON * pIcon, HICON * pSmallIcon)
{
- int sm_cx = GetSystemMetrics(SM_CXICON);
- int sm_cxsm = GetSystemMetrics(SM_CXSMICON);
- /* Load default X icon in case it's not ready yet */
- if (!g_hIconX)
- {
- g_hIconX = winOverrideDefaultIcon(sm_cx);
- g_hSmallIconX = winOverrideDefaultIcon(sm_cxsm);
+ HICON hIcon, hSmallIcon;
+
+ winInitGlobalIcons();
+
+ /* Try and get the icon from WM_HINTS */
+ hIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXICON));
+ hSmallIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXSMICON));
+
+ /* If we got the small, but not the large one swap them */
+ if (!hIcon && hSmallIcon) {
+ hIcon = hSmallIcon;
+ hSmallIcon = NULL;
}
-
- if (!g_hIconX)
- {
- g_hIconX = (HICON)LoadImage (g_hInstance,
- MAKEINTRESOURCE(IDI_XWIN),
- IMAGE_ICON,
- GetSystemMetrics(SM_CXICON),
- GetSystemMetrics(SM_CYICON),
- 0);
- g_hSmallIconX = (HICON)LoadImage (g_hInstance,
- MAKEINTRESOURCE(IDI_XWIN),
- IMAGE_ICON,
- GetSystemMetrics(SM_CXSMICON),
- GetSystemMetrics(SM_CYSMICON),
- LR_DEFAULTSIZE);
+
+ /* Use default X icon if no icon loaded from WM_HINTS */
+ if (!hIcon) {
+ hIcon = g_hIconX;
+ hSmallIcon = g_hSmallIconX;
}
-}
-void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon)
-{
- HICON hIcon, hSmallIcon;
-
- winInitGlobalIcons();
-
- /* Try and get the icon from WM_HINTS */
- hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));
- hSmallIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON));
-
- /* If we got the small, but not the large one swap them */
- if (!hIcon && hSmallIcon)
- {
- hIcon = hSmallIcon;
- hSmallIcon = NULL;
- }
-
- /* Use default X icon if no icon loaded from WM_HINTS */
- if (!hIcon) {
- hIcon = g_hIconX;
- hSmallIcon = g_hSmallIconX;
- }
-
- if (pIcon)
- *pIcon = hIcon;
- else
- winDestroyIcon(hIcon);
-
- if (pSmallIcon)
- *pSmallIcon = hSmallIcon;
- else
- winDestroyIcon(hSmallIcon);
+ if (pIcon)
+ *pIcon = hIcon;
+ else
+ winDestroyIcon(hIcon);
+
+ if (pSmallIcon)
+ *pSmallIcon = hSmallIcon;
+ else
+ winDestroyIcon(hSmallIcon);
}
-void winDestroyIcon(HICON hIcon)
+void
+winDestroyIcon(HICON hIcon)
{
- /* Delete the icon if its not one of the application defaults or an override */
- if (hIcon &&
- hIcon != g_hIconX &&
- hIcon != g_hSmallIconX &&
- !winIconIsOverride((unsigned long)hIcon))
- DestroyIcon (hIcon);
+ /* Delete the icon if its not one of the application defaults or an override */
+ if (hIcon &&
+ hIcon != g_hIconX &&
+ hIcon != g_hSmallIconX && !winIconIsOverride((unsigned long) hIcon))
+ DestroyIcon(hIcon);
}
#endif
diff --git a/xorg-server/hw/xwin/winmultiwindowshape.c b/xorg-server/hw/xwin/winmultiwindowshape.c
index 9219bb708..26cd715bc 100644
--- a/xorg-server/hw/xwin/winmultiwindowshape.c
+++ b/xorg-server/hw/xwin/winmultiwindowshape.c
@@ -1,215 +1,206 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Kensuke Matsuzaki
- * Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-
-#include "win.h"
-
-
-/*
- * winSetShapeMultiWindow - See Porting Layer Definition - p. 42
- */
-
-void
-winSetShapeMultiWindow (WindowPtr pWin, int kind)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
-
- winDebug ("winSetShapeMultiWindow - pWin: %08x kind: %i\n", pWin, kind);
-
- WIN_UNWRAP(SetShape);
- (*pScreen->SetShape)(pWin, kind);
- WIN_WRAP(SetShape, winSetShapeMultiWindow);
-
- /* Update the Windows window's shape */
- winReshapeMultiWindow (pWin);
- winUpdateRgnMultiWindow (pWin);
-
- return;
-}
-
-
-/*
- * winUpdateRgnMultiWindow - Local function to update a Windows window region
- */
-
-void
-winUpdateRgnMultiWindow (WindowPtr pWin)
-{
- SetWindowRgn (winGetWindowPriv(pWin)->hWnd,
- winGetWindowPriv(pWin)->hRgn, TRUE);
-
- /* The system now owns the region specified by the region handle and will delete it when it is no longer needed. */
- winGetWindowPriv(pWin)->hRgn = NULL;
-}
-
-
-/*
- * winReshapeMultiWindow - Computes the composite clipping region for a window
- */
-
-void
-winReshapeMultiWindow (WindowPtr pWin)
-{
- int nRects;
- RegionRec rrNewShape;
- BoxPtr pShape, pRects, pEnd;
- HRGN hRgn, hRgnRect;
- winWindowPriv(pWin);
-
- winDebug ("winReshape ()\n");
-
- /* Bail if the window is the root window */
- if (pWin->parent == NULL)
- return;
-
- /* Bail if the window is not top level */
- if (pWin->parent->parent != NULL)
- return;
-
- /* Bail if Windows window handle is invalid */
- if (pWinPriv->hWnd == NULL)
- return;
-
- /* Free any existing window region stored in the window privates */
- if (pWinPriv->hRgn != NULL)
- {
- DeleteObject (pWinPriv->hRgn);
- pWinPriv->hRgn = NULL;
- }
-
- /* Bail if the window has no bounding region defined */
- if (!wBoundingShape (pWin))
- return;
-
- RegionNull(&rrNewShape);
- RegionCopy(&rrNewShape, wBoundingShape(pWin));
- RegionTranslate(&rrNewShape, pWin->borderWidth, pWin->borderWidth);
-
- nRects = RegionNumRects(&rrNewShape);
- pShape = RegionRects(&rrNewShape);
-
- /* Don't do anything if there are no rectangles in the region */
- if (nRects > 0)
- {
- RECT rcClient;
- RECT rcWindow;
- int iOffsetX, iOffsetY;
-
- /* Get client rectangle */
- if (!GetClientRect (pWinPriv->hWnd, &rcClient))
- {
- ErrorF ("winReshape - GetClientRect failed, bailing: %d\n",
- (int) GetLastError ());
- return;
- }
-
- /* Translate client rectangle coords to screen coords */
- /* NOTE: Only transforms top and left members */
- ClientToScreen (pWinPriv->hWnd, (LPPOINT) &rcClient);
-
- /* Get window rectangle */
- if (!GetWindowRect (pWinPriv->hWnd, &rcWindow))
- {
- ErrorF ("winReshape - GetWindowRect failed, bailing: %d\n",
- (int) GetLastError ());
- return;
- }
-
- /* Calculate offset from window upper-left to client upper-left */
- iOffsetX = rcClient.left - rcWindow.left;
- iOffsetY = rcClient.top - rcWindow.top;
-
- /* Create initial Windows region for title bar */
- /* FIXME: Mean, nasty, ugly hack!!! */
- hRgn = CreateRectRgn (0, 0, rcWindow.right, iOffsetY);
- if (hRgn == NULL)
- {
- ErrorF ("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) "
- "failed: %d\n",
- 0, 0, (int) rcWindow.right, iOffsetY, (int) GetLastError ());
- }
-
- /* Loop through all rectangles in the X region */
- for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++)
- {
- /* Create a Windows region for the X rectangle */
- hRgnRect = CreateRectRgn (pRects->x1 + iOffsetX,
- pRects->y1 + iOffsetY,
- pRects->x2 + iOffsetX,
- pRects->y2 + iOffsetY);
- if (hRgnRect == NULL)
- {
- ErrorF ("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) "
- "failed: %d\n"
- "\tx1: %d x2: %d xOff: %d y1: %d y2: %d yOff: %d\n",
- pRects->x1 + iOffsetX,
- pRects->y1 + iOffsetY,
- pRects->x2 + iOffsetX,
- pRects->y2 + iOffsetY,
- (int) GetLastError (),
- pRects->x1, pRects->x2, iOffsetX,
- pRects->y1, pRects->y2, iOffsetY);
- }
-
- /* Merge the Windows region with the accumulated region */
- if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR)
- {
- ErrorF ("winReshape - CombineRgn () failed: %d\n",
- (int) GetLastError ());
- }
-
- /* Delete the temporary Windows region */
- DeleteObject (hRgnRect);
- }
-
- /* Save a handle to the composite region in the window privates */
- pWinPriv->hRgn = hRgn;
- }
-
- RegionUninit(&rrNewShape);
-
- return;
-}
-
-void
-winShapeRgnUpdateMultiwindow(HWND hwnd)
-{
- WindowPtr pWin = GetProp (hwnd, WIN_WINDOW_PROP);
- if (pWin)
- {
- winReshapeMultiWindow(pWin);
- winUpdateRgnMultiWindow(pWin);
- }
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Kensuke Matsuzaki
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
+#include "win.h"
+
+/*
+ * winSetShapeMultiWindow - See Porting Layer Definition - p. 42
+ */
+
+void
+winSetShapeMultiWindow(WindowPtr pWin, int kind)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winScreenPriv(pScreen);
+
+ winDebug ("winSetShapeMultiWindow - pWin: %08x kind: %i\n", pWin, kind);
+
+ WIN_UNWRAP(SetShape);
+ (*pScreen->SetShape) (pWin, kind);
+ WIN_WRAP(SetShape, winSetShapeMultiWindow);
+
+ /* Update the Windows window's shape */
+ winReshapeMultiWindow(pWin);
+ winUpdateRgnMultiWindow(pWin);
+
+ return;
+}
+
+/*
+ * winUpdateRgnMultiWindow - Local function to update a Windows window region
+ */
+
+void
+winUpdateRgnMultiWindow(WindowPtr pWin)
+{
+ SetWindowRgn(winGetWindowPriv(pWin)->hWnd,
+ winGetWindowPriv(pWin)->hRgn, TRUE);
+
+ /* The system now owns the region specified by the region handle and will delete it when it is no longer needed. */
+ winGetWindowPriv(pWin)->hRgn = NULL;
+}
+
+/*
+ * winReshapeMultiWindow - Computes the composite clipping region for a window
+ */
+
+void
+winReshapeMultiWindow(WindowPtr pWin)
+{
+ int nRects;
+ RegionRec rrNewShape;
+ BoxPtr pShape, pRects, pEnd;
+ HRGN hRgn, hRgnRect;
+
+ winWindowPriv(pWin);
+
+ winDebug("winReshape ()\n");
+
+ /* Bail if the window is the root window */
+ if (pWin->parent == NULL)
+ return;
+
+ /* Bail if the window is not top level */
+ if (pWin->parent->parent != NULL)
+ return;
+
+ /* Bail if Windows window handle is invalid */
+ if (pWinPriv->hWnd == NULL)
+ return;
+
+ /* Free any existing window region stored in the window privates */
+ if (pWinPriv->hRgn != NULL) {
+ DeleteObject(pWinPriv->hRgn);
+ pWinPriv->hRgn = NULL;
+ }
+
+ /* Bail if the window has no bounding region defined */
+ if (!wBoundingShape(pWin))
+ return;
+
+ RegionNull(&rrNewShape);
+ RegionCopy(&rrNewShape, wBoundingShape(pWin));
+ RegionTranslate(&rrNewShape, pWin->borderWidth, pWin->borderWidth);
+
+ nRects = RegionNumRects(&rrNewShape);
+ pShape = RegionRects(&rrNewShape);
+
+ /* Don't do anything if there are no rectangles in the region */
+ if (nRects > 0) {
+ RECT rcClient;
+ RECT rcWindow;
+ int iOffsetX, iOffsetY;
+
+ /* Get client rectangle */
+ if (!GetClientRect(pWinPriv->hWnd, &rcClient)) {
+ ErrorF("winReshape - GetClientRect failed, bailing: %d\n",
+ (int) GetLastError());
+ return;
+ }
+
+ /* Translate client rectangle coords to screen coords */
+ /* NOTE: Only transforms top and left members */
+ ClientToScreen(pWinPriv->hWnd, (LPPOINT) & rcClient);
+
+ /* Get window rectangle */
+ if (!GetWindowRect(pWinPriv->hWnd, &rcWindow)) {
+ ErrorF("winReshape - GetWindowRect failed, bailing: %d\n",
+ (int) GetLastError());
+ return;
+ }
+
+ /* Calculate offset from window upper-left to client upper-left */
+ iOffsetX = rcClient.left - rcWindow.left;
+ iOffsetY = rcClient.top - rcWindow.top;
+
+ /* Create initial Windows region for title bar */
+ /* FIXME: Mean, nasty, ugly hack!!! */
+ hRgn = CreateRectRgn(0, 0, rcWindow.right, iOffsetY);
+ if (hRgn == NULL) {
+ ErrorF("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) "
+ "failed: %d\n",
+ 0, 0, (int) rcWindow.right, iOffsetY, (int) GetLastError());
+ }
+
+ /* Loop through all rectangles in the X region */
+ for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++) {
+ /* Create a Windows region for the X rectangle */
+ hRgnRect = CreateRectRgn(pRects->x1 + iOffsetX,
+ pRects->y1 + iOffsetY,
+ pRects->x2 + iOffsetX,
+ pRects->y2 + iOffsetY);
+ if (hRgnRect == NULL) {
+ ErrorF("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) "
+ "failed: %d\n"
+ "\tx1: %d x2: %d xOff: %d y1: %d y2: %d yOff: %d\n",
+ pRects->x1 + iOffsetX,
+ pRects->y1 + iOffsetY,
+ pRects->x2 + iOffsetX,
+ pRects->y2 + iOffsetY,
+ (int) GetLastError(),
+ pRects->x1, pRects->x2, iOffsetX,
+ pRects->y1, pRects->y2, iOffsetY);
+ }
+
+ /* Merge the Windows region with the accumulated region */
+ if (CombineRgn(hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) {
+ ErrorF("winReshape - CombineRgn () failed: %d\n",
+ (int) GetLastError());
+ }
+
+ /* Delete the temporary Windows region */
+ DeleteObject(hRgnRect);
+ }
+
+ /* Save a handle to the composite region in the window privates */
+ pWinPriv->hRgn = hRgn;
+ }
+
+ RegionUninit(&rrNewShape);
+
+ return;
+}
+
+void
+winShapeRgnUpdateMultiwindow(HWND hwnd)
+{
+ WindowPtr pWin = GetProp (hwnd, WIN_WINDOW_PROP);
+ if (pWin)
+ {
+ winReshapeMultiWindow(pWin);
+ winUpdateRgnMultiWindow(pWin);
+ }
+}
diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c
index 836587f74..3bdc2138d 100644
--- a/xorg-server/hw/xwin/winmultiwindowwindow.c
+++ b/xorg-server/hw/xwin/winmultiwindowwindow.c
@@ -44,45 +44,45 @@
*/
void
-winCreateWindowsWindow (WindowPtr pWin);
+ winCreateWindowsWindow(WindowPtr pWin);
static void
-winDestroyWindowsWindow (WindowPtr pWin);
+ winDestroyWindowsWindow(WindowPtr pWin);
static void
-winUpdateWindowsWindow (WindowPtr pWin);
+ winUpdateWindowsWindow(WindowPtr pWin);
static void
-winFindWindow (pointer value, XID id, pointer cdata);
+ winFindWindow(pointer value, XID id, pointer cdata);
static
-void winInitMultiWindowClass(void)
+ void
+winInitMultiWindowClass(void)
{
- static wATOM atomXWinClass=0;
- WNDCLASSEX wcx;
-
- if (atomXWinClass==0)
- {
- /* Setup our window class */
- wcx.cbSize=sizeof(WNDCLASSEX);
- wcx.style = CS_HREDRAW | CS_VREDRAW | (g_fNativeGl ? CS_OWNDC : 0);
- wcx.lpfnWndProc = winTopLevelWindowProc;
- wcx.cbClsExtra = 0;
- wcx.cbWndExtra = 0;
- wcx.hInstance = g_hInstance;
- wcx.hIcon = g_hIconX;
- wcx.hCursor = 0;
- wcx.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
- wcx.lpszMenuName = NULL;
- wcx.lpszClassName = WINDOW_CLASS_X;
- wcx.hIconSm = g_hSmallIconX;
+ static wATOM atomXWinClass = 0;
+ WNDCLASSEX wcx;
+
+ if (atomXWinClass == 0) {
+ /* Setup our window class */
+ wcx.cbSize = sizeof(WNDCLASSEX);
+ wcx.style = CS_HREDRAW | CS_VREDRAW | (g_fNativeGl ? CS_OWNDC : 0);
+ wcx.lpfnWndProc = winTopLevelWindowProc;
+ wcx.cbClsExtra = 0;
+ wcx.cbWndExtra = 0;
+ wcx.hInstance = g_hInstance;
+ wcx.hIcon = g_hIconX;
+ wcx.hCursor = 0;
+ wcx.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wcx.lpszMenuName = NULL;
+ wcx.lpszClassName = WINDOW_CLASS_X;
+ wcx.hIconSm = g_hSmallIconX;
#if CYGMULTIWINDOW_DEBUG
winDebug ("winCreateWindowsWindow - Creating class: %s\n", WINDOW_CLASS_X);
#endif
- atomXWinClass = RegisterClassEx (&wcx);
- }
+ atomXWinClass = RegisterClassEx(&wcx);
+ }
}
/*
@@ -90,63 +90,63 @@ void winInitMultiWindowClass(void)
*/
Bool
-winCreateWindowMultiWindow (WindowPtr pWin)
+winCreateWindowMultiWindow(WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
winDebug ("winCreateWindowMultiWindow - pWin: %p\n", pWin);
#endif
-
- WIN_UNWRAP(CreateWindow);
- fResult = (*pScreen->CreateWindow) (pWin);
- WIN_WRAP(CreateWindow, winCreateWindowMultiWindow);
-
- /* Initialize some privates values */
- pWinPriv->hRgn = NULL;
- pWinPriv->hWnd = NULL;
- pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
- pWinPriv->fXKilled = FALSE;
+
+ WIN_UNWRAP(CreateWindow);
+ fResult = (*pScreen->CreateWindow) (pWin);
+ WIN_WRAP(CreateWindow, winCreateWindowMultiWindow);
+
+ /* Initialize some privates values */
+ pWinPriv->hRgn = NULL;
+ pWinPriv->hWnd = NULL;
+ pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
+ pWinPriv->fXKilled = FALSE;
#ifdef XWIN_GLX_WINDOWS
- pWinPriv->fWglUsed = FALSE;
+ pWinPriv->fWglUsed = FALSE;
#endif
- return fResult;
+ return fResult;
}
-
/*
* DestroyWindow - See Porting Layer Definition - p. 37
*/
Bool
-winDestroyWindowMultiWindow (WindowPtr pWin)
+winDestroyWindowMultiWindow(WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
winDebug ("winDestroyWindowMultiWindow - pWin: %p\n", pWin);
#endif
-
- WIN_UNWRAP(DestroyWindow);
- fResult = (*pScreen->DestroyWindow)(pWin);
- WIN_WRAP(DestroyWindow, winDestroyWindowMultiWindow);
-
- /* Flag that the window has been destroyed */
- pWinPriv->fXKilled = TRUE;
-
- /* Kill the MS Windows window associated with this window */
- winDestroyWindowsWindow (pWin);
- return fResult;
-}
+ WIN_UNWRAP(DestroyWindow);
+ fResult = (*pScreen->DestroyWindow) (pWin);
+ WIN_WRAP(DestroyWindow, winDestroyWindowMultiWindow);
+
+ /* Flag that the window has been destroyed */
+ pWinPriv->fXKilled = TRUE;
+ /* Kill the MS Windows window associated with this window */
+ winDestroyWindowsWindow(pWin);
+
+ return fResult;
+}
/*
* PositionWindow - See Porting Layer Definition - p. 37
@@ -157,98 +157,97 @@ winDestroyWindowMultiWindow (WindowPtr pWin)
*/
Bool
-winPositionWindowMultiWindow (WindowPtr pWin, int x, int y)
+winPositionWindowMultiWindow(WindowPtr pWin, int x, int y)
{
- Bool fResult = TRUE;
- int iX, iY, iWidth, iHeight;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
-
- HWND hWnd = pWinPriv->hWnd;
- RECT rcNew;
- RECT rcOld;
+ Bool fResult = TRUE;
+ int iX, iY, iWidth, iHeight;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+ HWND hWnd = pWinPriv->hWnd;
+ RECT rcNew;
+ RECT rcOld;
#ifdef WINDBG
- RECT rcClient;
- RECT *lpRc;
+ RECT rcClient;
+ RECT *lpRc;
#endif
- DWORD dwExStyle;
- DWORD dwStyle;
+ DWORD dwExStyle;
+ DWORD dwStyle;
winDebug ("winPositionWindowMultiWindow - pWin: %p\n", pWin);
-
- WIN_UNWRAP(PositionWindow);
- fResult = (*pScreen->PositionWindow)(pWin, x, y);
- WIN_WRAP(PositionWindow, winPositionWindowMultiWindow);
-
- winDebug ("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n",
- x, y);
- /* Bail out if the Windows window handle is bad */
- if (!hWnd)
- {
+ WIN_UNWRAP(PositionWindow);
+ fResult = (*pScreen->PositionWindow) (pWin, x, y);
+ WIN_WRAP(PositionWindow, winPositionWindowMultiWindow);
+
+ winDebug ("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n",
+ x, y);
+
+ /* Bail out if the Windows window handle is bad */
+ if (!hWnd) {
winDebug ("\timmediately return since hWnd is NULL\n");
if (pWin->redirectDraw != RedirectDrawNone)
{
winDebug("winPositionWindowMultiWindow: Calling compReallocPixmap to make sure the pixmap buffer is valid.\n");
compReallocPixmap(pWin, x, y, pWin->drawable.width, pWin->drawable.height, pWin->borderWidth);
}
- return fResult;
+ return fResult;
}
- /* Get the Windows window style and extended style */
- dwExStyle = GetWindowLongPtr (hWnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr (hWnd, GWL_STYLE);
+ /* Get the Windows window style and extended style */
+ dwExStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr(hWnd, GWL_STYLE);
- /* Get the X and Y location of the X window */
- iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
- iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+ /* Get the X and Y location of the X window */
+ iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
- /* Get the height and width of the X window */
- iWidth = pWin->drawable.width;
- iHeight = pWin->drawable.height;
+ /* Get the height and width of the X window */
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
- /* Store the origin, height, and width in a rectangle structure */
- SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight);
#if CYGMULTIWINDOW_DEBUG
- lpRc = &rcNew;
+ lpRc = &rcNew;
winDebug ("winPositionWindowMultiWindow - (%d ms)drawable (%d, %d)-(%d, %d)\n",
- GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+ GetTickCount(), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
#endif
- /*
- * Calculate the required size of the Windows window rectangle,
- * given the size of the Windows window client area.
- */
- AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx(&rcNew, dwStyle, FALSE, dwExStyle);
- /* Get a rectangle describing the old Windows window */
- GetWindowRect (hWnd, &rcOld);
+ /* Get a rectangle describing the old Windows window */
+ GetWindowRect(hWnd, &rcOld);
#if CYGMULTIWINDOW_DEBUG
- /* Get a rectangle describing the Windows window client area */
- GetClientRect (hWnd, &rcClient);
-
- lpRc = &rcNew;
- winDebug ("winPositionWindowMultiWindow - (%d ms)rcNew (%d, %d)-(%d, %d)\n",
- GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
-
- lpRc = &rcOld;
- winDebug ("winPositionWindowMultiWindow - (%d ms)rcOld (%d, %d)-(%d, %d)\n",
- GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
-
- lpRc = &rcClient;
- winDebug ("(%d ms)rcClient (%d, %d)-(%d, %d)\n",
- GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+ /* Get a rectangle describing the Windows window client area */
+ GetClientRect(hWnd, &rcClient);
+
+ lpRc = &rcNew;
+ winDebug ("winPositionWindowMultiWindow - (%d ms)rcNew (%d, %d)-(%d, %d)\n",
+ GetTickCount(), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+
+ lpRc = &rcOld;
+ winDebug ("winPositionWindowMultiWindow - (%d ms)rcOld (%d, %d)-(%d, %d)\n",
+ GetTickCount(), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+
+ lpRc = &rcClient;
+ winDebug ("(%d ms)rcClient (%d, %d)-(%d, %d)\n",
+ GetTickCount(), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
#endif
- /* Check if the old rectangle and new rectangle are the same */
- if (!EqualRect (&rcNew, &rcOld))
- {
+ /* Check if the old rectangle and new rectangle are the same */
+ if (!EqualRect(&rcNew, &rcOld)) {
winDebug ("winPositionWindowMultiWindow - Need to move\n");
winDebug ("\tMoveWindow to (%ld, %ld) - %ldx%ld\n", rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
/* Change the position and dimensions of the Windows window */
if (pWinPriv->fWglUsed)
@@ -267,39 +266,37 @@ winPositionWindowMultiWindow (WindowPtr pWin, int x, int y)
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
TRUE);
}
- else
- {
+ else {
winDebug ("winPositionWindowMultiWindow - Not need to move\n");
}
- return fResult;
+ return fResult;
}
-
/*
* ChangeWindowAttributes - See Porting Layer Definition - p. 37
*/
Bool
-winChangeWindowAttributesMultiWindow (WindowPtr pWin, unsigned long mask)
+winChangeWindowAttributesMultiWindow(WindowPtr pWin, unsigned long mask)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winDebug ("winChangeWindowAttributesMultiWindow - pWin: %08x\n", pWin);
-
- WIN_UNWRAP(ChangeWindowAttributes);
- fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask);
- WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesMultiWindow);
-
- /*
- * NOTE: We do not currently need to do anything here.
- */
+ winScreenPriv(pScreen);
- return fResult;
-}
+ winDebug ("winChangeWindowAttributesMultiWindow - pWin: %08x\n", pWin);
+
+ WIN_UNWRAP(ChangeWindowAttributes);
+ fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
+ WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesMultiWindow);
+
+ /*
+ * NOTE: We do not currently need to do anything here.
+ */
+ return fResult;
+}
/*
* UnmapWindow - See Porting Layer Definition - p. 37
@@ -307,30 +304,30 @@ winChangeWindowAttributesMultiWindow (WindowPtr pWin, unsigned long mask)
*/
Bool
-winUnmapWindowMultiWindow (WindowPtr pWin)
+winUnmapWindowMultiWindow(WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winUnmapWindowMultiWindow - pWin: %08x\n", pWin);
+ winDebug ("winUnmapWindowMultiWindow - pWin: %08x\n", pWin);
#endif
-
- WIN_UNWRAP(UnrealizeWindow);
- fResult = (*pScreen->UnrealizeWindow)(pWin);
- WIN_WRAP(UnrealizeWindow, winUnmapWindowMultiWindow);
-
- /* Flag that the window has been killed */
- pWinPriv->fXKilled = TRUE;
-
- /* Destroy the Windows window associated with this X window */
- winDestroyWindowsWindow (pWin);
- return fResult;
-}
+ WIN_UNWRAP(UnrealizeWindow);
+ fResult = (*pScreen->UnrealizeWindow) (pWin);
+ WIN_WRAP(UnrealizeWindow, winUnmapWindowMultiWindow);
+
+ /* Flag that the window has been killed */
+ pWinPriv->fXKilled = TRUE;
+
+ /* Destroy the Windows window associated with this X window */
+ winDestroyWindowsWindow(pWin);
+ return fResult;
+}
/*
* MapWindow - See Porting Layer Definition - p. 37
@@ -338,116 +335,120 @@ winUnmapWindowMultiWindow (WindowPtr pWin)
*/
Bool
-winMapWindowMultiWindow (WindowPtr pWin)
+winMapWindowMultiWindow(WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMapWindowMultiWindow - pWin: %08x\n", pWin);
+ winDebug ("winMapWindowMultiWindow - pWin: %08x\n", pWin);
#endif
-
- WIN_UNWRAP(RealizeWindow);
- fResult = (*pScreen->RealizeWindow)(pWin);
- WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
-
- /* Flag that this window has not been destroyed */
- pWinPriv->fXKilled = FALSE;
- /* Refresh/redisplay the Windows window associated with this X window */
- winUpdateWindowsWindow (pWin);
+ WIN_UNWRAP(RealizeWindow);
+ fResult = (*pScreen->RealizeWindow) (pWin);
+ WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
- /* Update the Windows window's shape */
- winReshapeMultiWindow (pWin);
- winUpdateRgnMultiWindow (pWin);
+ /* Flag that this window has not been destroyed */
+ pWinPriv->fXKilled = FALSE;
- return fResult;
-}
+ /* Refresh/redisplay the Windows window associated with this X window */
+ winUpdateWindowsWindow(pWin);
+
+ /* Update the Windows window's shape */
+ winReshapeMultiWindow(pWin);
+ winUpdateRgnMultiWindow(pWin);
+ return fResult;
+}
/*
* ReparentWindow - See Porting Layer Definition - p. 42
*/
void
-winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent)
+winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winDebug("winReparentMultiWindow - pWin:%08x XID:0x%x, reparent from pWin:%08x XID:0x%x to pWin:%08x XID:0x%x\n",
- pWin, pWin->drawable.id, pPriorParent, pPriorParent->drawable.id, pWin->parent, pWin->parent->drawable.id);
+ winScreenPriv(pScreen);
- WIN_UNWRAP(ReparentWindow);
- if (pScreen->ReparentWindow)
- (*pScreen->ReparentWindow)(pWin, pPriorParent);
- WIN_WRAP(ReparentWindow, winReparentWindowMultiWindow);
-
- /* Update the Windows window associated with this X window */
- winUpdateWindowsWindow (pWin);
-}
+ winDebug
+ ("winReparentMultiWindow - pWin:%08x XID:0x%x, reparent from pWin:%08x XID:0x%x to pWin:%08x XID:0x%x\n",
+ pWin, pWin->drawable.id, pPriorParent, pPriorParent->drawable.id,
+ pWin->parent, pWin->parent->drawable.id);
+
+ WIN_UNWRAP(ReparentWindow);
+ if (pScreen->ReparentWindow)
+ (*pScreen->ReparentWindow) (pWin, pPriorParent);
+ WIN_WRAP(ReparentWindow, winReparentWindowMultiWindow);
+ /* Update the Windows window associated with this X window */
+ winUpdateWindowsWindow(pWin);
+}
/*
* RestackWindow - Shuffle the z-order of a window
*/
void
-winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib)
+winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winScreenPriv(pScreen);
winDebug ("winRestackMultiWindow - %08x\n", pWin);
-
- WIN_UNWRAP(RestackWindow);
- if (pScreen->RestackWindow)
- (*pScreen->RestackWindow)(pWin, pOldNextSib);
- WIN_WRAP(RestackWindow, winRestackWindowMultiWindow);
-
- /*
- * Calling winReorderWindowsMultiWindow here means our window manager
- * (i.e. Windows Explorer) has initiative to determine Z order.
- */
- if (pWin->nextSib != pOldNextSib)
- winReorderWindowsMultiWindow ();
-}
+ WIN_UNWRAP(RestackWindow);
+ if (pScreen->RestackWindow)
+ (*pScreen->RestackWindow) (pWin, pOldNextSib);
+ WIN_WRAP(RestackWindow, winRestackWindowMultiWindow);
+
+ /*
+ * Calling winReorderWindowsMultiWindow here means our window manager
+ * (i.e. Windows Explorer) has initiative to determine Z order.
+ */
+ if (pWin->nextSib != pOldNextSib)
+ winReorderWindowsMultiWindow();
+}
/*
* winCreateWindowsWindow - Create a Windows window associated with an X window
*/
void
-winCreateWindowsWindow (WindowPtr pWin)
+winCreateWindowsWindow(WindowPtr pWin)
{
- int iX, iY;
- int iWidth;
- int iHeight;
- HWND hWnd;
- HWND hFore = NULL;
- winWindowPriv(pWin);
- HICON hIcon;
- HICON hIconSmall;
- winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
- WinXSizeHints hints;
- WindowPtr pDaddy;
- DWORD dwStyle, dwExStyle;
- RECT rc;
-
- winInitMultiWindowClass();
-
- winDebug("winCreateWindowsTopLevelWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id);
-
- iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
- iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
-
- iWidth = pWin->drawable.width;
- iHeight = pWin->drawable.height;
-
- /* If it's an InputOutput window, and so is going to end up being made visible,
+ int iX, iY;
+ int iWidth;
+ int iHeight;
+ HWND hWnd;
+ HWND hFore = NULL;
+
+ winWindowPriv(pWin);
+ HICON hIcon;
+ HICON hIconSmall;
+ winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
+ WinXSizeHints hints;
+ WindowPtr pDaddy;
+ DWORD dwStyle, dwExStyle;
+ RECT rc;
+
+ winInitMultiWindowClass();
+
+ winDebug("winCreateWindowsTopLevelWindow - pWin:%08x XID:0x%x \n", pWin,
+ pWin->drawable.id);
+
+ iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
+ /* If it's an InputOutput window, and so is going to end up being made visible,
make sure the window actually ends up somewhere where it will be visible
Dont't do it by making just one of the two iX and iY CW_USEDEFAULT since
this will create a window at place CW_USEDEFAULT which is 0x80000000 */
@@ -486,75 +487,77 @@ winCreateWindowsWindow (WindowPtr pWin)
}
}
- winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY);
+ winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX,
+ iY);
- if (winMultiWindowGetTransientFor (pWin, &pDaddy))
- {
- if (pDaddy)
- {
- hFore = GetForegroundWindow();
- if (hFore && (pDaddy != (WindowPtr)GetProp(hFore, WIN_WID_PROP))) hFore = NULL;
- }
+ if (winMultiWindowGetTransientFor(pWin, &pDaddy)) {
+ if (pDaddy) {
+ hFore = GetForegroundWindow();
+ if (hFore && (pDaddy != (WindowPtr) GetProp(hFore, WIN_WID_PROP)))
+ hFore = NULL;
+ }
}
- else
- {
- /* Default positions if none specified */
- if (!winMultiWindowGetWMNormalHints(pWin, &hints))
- hints.flags = 0;
- if (!(hints.flags & (USPosition|PPosition)) &&
- !pWin->overrideRedirect)
- {
- iX = CW_USEDEFAULT;
- iY = CW_USEDEFAULT;
- }
+ else {
+ /* Default positions if none specified */
+ if (!winMultiWindowGetWMNormalHints(pWin, &hints))
+ hints.flags = 0;
+ if (!(hints.flags & (USPosition | PPosition)) &&
+ !pWin->overrideRedirect) {
+ iX = CW_USEDEFAULT;
+ iY = CW_USEDEFAULT;
+ }
}
- /* Make it WS_OVERLAPPED in create call since WS_POPUP doesn't support */
- /* CW_USEDEFAULT, change back to popup after creation */
- dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
- dwExStyle = WS_EX_TOOLWINDOW;
-
- /*
- Calculate the window coordinates containing the requested client area,
- being careful to preseve CW_USEDEFAULT
- */
- rc.top = (iY != CW_USEDEFAULT) ? iY : 0;
- rc.left = (iX != CW_USEDEFAULT) ? iX : 0;
- rc.bottom = rc.top + iHeight;
- rc.right = rc.left + iWidth;
- AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle);
- if (iY != CW_USEDEFAULT) iY = rc.top;
- if (iX != CW_USEDEFAULT) iX = rc.left;
- iHeight = rc.bottom - rc.top;
- iWidth = rc.right - rc.left;
-
- winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX, iY);
-
- /* Create the window */
- hWnd = CreateWindowExA (dwExStyle, /* Extended styles */
- WINDOW_CLASS_X, /* Class name */
- WINDOW_TITLE_X, /* Window name */
- dwStyle, /* Styles */
- iX, /* Horizontal position */
- iY, /* Vertical position */
- iWidth, /* Right edge */
- iHeight, /* Bottom edge */
- hFore, /* Null or Parent window if transient*/
- (HMENU) NULL, /* No menu */
- GetModuleHandle (NULL), /* Instance handle */
- pWin); /* ScreenPrivates */
- if (hWnd == NULL)
- {
- ErrorF ("winCreateWindowsWindow - CreateWindowExA () failed: %d\n",
- (int) GetLastError ());
+ /* Make it WS_OVERLAPPED in create call since WS_POPUP doesn't support */
+ /* CW_USEDEFAULT, change back to popup after creation */
+ dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
+ dwExStyle = WS_EX_TOOLWINDOW;
+
+ /*
+ Calculate the window coordinates containing the requested client area,
+ being careful to preseve CW_USEDEFAULT
+ */
+ rc.top = (iY != CW_USEDEFAULT) ? iY : 0;
+ rc.left = (iX != CW_USEDEFAULT) ? iX : 0;
+ rc.bottom = rc.top + iHeight;
+ rc.right = rc.left + iWidth;
+ AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle);
+ if (iY != CW_USEDEFAULT)
+ iY = rc.top;
+ if (iX != CW_USEDEFAULT)
+ iX = rc.left;
+ iHeight = rc.bottom - rc.top;
+ iWidth = rc.right - rc.left;
+
+ winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX,
+ iY);
+
+ /* Create the window */
+ hWnd = CreateWindowExA(dwExStyle, /* Extended styles */
+ WINDOW_CLASS_X, /* Class name */
+ WINDOW_TITLE_X, /* Window name */
+ dwStyle, /* Styles */
+ iX, /* Horizontal position */
+ iY, /* Vertical position */
+ iWidth, /* Right edge */
+ iHeight, /* Bottom edge */
+ hFore, /* Null or Parent window if transient */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle(NULL), /* Instance handle */
+ pWin); /* ScreenPrivates */
+ if (hWnd == NULL) {
+ ErrorF("winCreateWindowsWindow - CreateWindowExA () failed: %d\n",
+ (int) GetLastError());
}
- pWinPriv->hWnd = hWnd;
+ pWinPriv->hWnd = hWnd;
+
+ /* Set application or .XWinrc defined Icons */
+ winSelectIcons(pWin, &hIcon, &hIconSmall);
+ if (hIcon)
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
+ if (hIconSmall)
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
- /* Set application or .XWinrc defined Icons */
- winSelectIcons(pWin, &hIcon, &hIconSmall);
- if (hIcon) SendMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
- if (hIconSmall) SendMessage (hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
-
/* If we asked the native WM to place the window, synchronize the X window position.
Do this before the next SetWindowPos because this one is generating a WM_STYLECHANGED
message which is causing a window move, which is wrong if the Xwindow does not
@@ -564,119 +567,115 @@ winCreateWindowsWindow (WindowPtr pWin)
winAdjustXWindow(pWin, hWnd);
}
- /* Change style back to popup, already placed... */
- SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
- SetWindowPos (hWnd, 0, 0, 0, 0, 0,
- SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ /* Change style back to popup, already placed... */
+ SetWindowLongPtr(hWnd, GWL_STYLE,
+ WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
+ SetWindowPos(hWnd, 0, 0, 0, 0, 0,
+ SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE |
+ SWP_NOACTIVATE);
- /* Make sure it gets the proper system menu for a WS_POPUP, too */
- GetSystemMenu (hWnd, TRUE);
+ /* Make sure it gets the proper system menu for a WS_POPUP, too */
+ GetSystemMenu(hWnd, TRUE);
- /* Cause any .XWinrc menus to be added in main WNDPROC */
- PostMessage (hWnd, WM_INIT_SYS_MENU, 0, 0);
-
- SetProp (hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin));
+ /* Cause any .XWinrc menus to be added in main WNDPROC */
+ PostMessage(hWnd, WM_INIT_SYS_MENU, 0, 0);
- /* Flag that this Windows window handles its own activation */
- SetProp (hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0);
+ SetProp(hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin));
- /* Call engine-specific create window procedure */
- (*pScreenPriv->pwinFinishCreateWindowsWindow) (pWin);
-}
+ /* Flag that this Windows window handles its own activation */
+ SetProp(hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0);
+ /* Call engine-specific create window procedure */
+ (*pScreenPriv->pwinFinishCreateWindowsWindow) (pWin);
+}
Bool winInDestroyWindowsWindow = FALSE;
+
/*
* winDestroyWindowsWindow - Destroy a Windows window associated
* with an X window
*/
static void
-winDestroyWindowsWindow (WindowPtr pWin)
+winDestroyWindowsWindow(WindowPtr pWin)
{
- MSG msg;
- winWindowPriv(pWin);
- BOOL oldstate = winInDestroyWindowsWindow;
- HICON hIcon;
- HICON hIconSm;
+ MSG msg;
- winDebug("winDestroyWindowsWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id);
+ winWindowPriv(pWin);
+ BOOL oldstate = winInDestroyWindowsWindow;
+ HICON hIcon;
+ HICON hIconSm;
- /* Bail out if the Windows window handle is invalid */
- if (pWinPriv->hWnd == NULL)
- return;
+ winDebug("winDestroyWindowsWindow - pWin:%08x XID:0x%x \n", pWin,
+ pWin->drawable.id);
- winInDestroyWindowsWindow = TRUE;
+ /* Bail out if the Windows window handle is invalid */
+ if (pWinPriv->hWnd == NULL)
+ return;
- /* Store the info we need to destroy after this window is gone */
- hIcon = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
- hIconSm = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
+ winInDestroyWindowsWindow = TRUE;
- /* Destroy the Windows window */
- DestroyWindow (pWinPriv->hWnd);
+ /* Store the info we need to destroy after this window is gone */
+ hIcon = (HICON) SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
+ hIconSm = (HICON) SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
- /* Null our handle to the Window so referencing it will cause an error */
- pWinPriv->hWnd = NULL;
+ /* Destroy the Windows window */
+ DestroyWindow(pWinPriv->hWnd);
- /* Destroy any icons we created for this window */
- winDestroyIcon(hIcon);
- winDestroyIcon(hIconSm);
+ /* Null our handle to the Window so referencing it will cause an error */
+ pWinPriv->hWnd = NULL;
+
+ /* Destroy any icons we created for this window */
+ winDestroyIcon(hIcon);
+ winDestroyIcon(hIconSm);
#ifdef XWIN_GLX_WINDOWS
- /* No longer note WGL used on this window */
- pWinPriv->fWglUsed = FALSE;
+ /* No longer note WGL used on this window */
+ pWinPriv->fWglUsed = FALSE;
#endif
- /* Process all messages on our queue */
- while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
- {
- if (g_hDlgDepthChange == 0 || !IsDialogMessage (g_hDlgDepthChange, &msg))
- {
- DispatchMessage (&msg);
- }
+ /* Process all messages on our queue */
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if (g_hDlgDepthChange == 0 || !IsDialogMessage(g_hDlgDepthChange, &msg)) {
+ DispatchMessage(&msg);
+ }
}
- winInDestroyWindowsWindow = oldstate;
+ winInDestroyWindowsWindow = oldstate;
- winDebug("winDestroyWindowsWindow - done\n");
+ winDebug("winDestroyWindowsWindow - done\n");
}
-
/*
* winUpdateWindowsWindow - Redisplay/redraw a Windows window
* associated with an X window
*/
static void
-winUpdateWindowsWindow (WindowPtr pWin)
+winUpdateWindowsWindow(WindowPtr pWin)
{
- winWindowPriv(pWin);
- HWND hWnd = pWinPriv->hWnd;
+ winWindowPriv(pWin);
+ HWND hWnd = pWinPriv->hWnd;
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winUpdateWindowsWindow\n");
+ winDebug ("winUpdateWindowsWindow\n");
#endif
- /* Check if the Windows window's parents have been destroyed */
- if (pWin->parent != NULL
- && pWin->parent->parent == NULL
- && pWin->mapped)
- {
- /* Create the Windows window if it has been destroyed */
- if (hWnd == NULL)
- {
- winCreateWindowsWindow (pWin);
- assert (pWinPriv->hWnd != NULL);
- }
-
- /* Display the window without activating it */
- if (pWin->drawable.class != InputOnly)
- ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE);
-
- /* Send first paint message */
- UpdateWindow (pWinPriv->hWnd);
+ /* Check if the Windows window's parents have been destroyed */
+ if (pWin->parent != NULL && pWin->parent->parent == NULL && pWin->mapped) {
+ /* Create the Windows window if it has been destroyed */
+ if (hWnd == NULL) {
+ winCreateWindowsWindow(pWin);
+ assert(pWinPriv->hWnd != NULL);
+ }
+
+ /* Display the window without activating it */
+ if (pWin->drawable.class != InputOnly)
+ ShowWindow(pWinPriv->hWnd, SW_SHOWNOACTIVATE);
+
+ /* Send first paint message */
+ UpdateWindow(pWinPriv->hWnd);
}
- else if (hWnd != NULL)
- {
+ else if (hWnd != NULL) {
if (pWinPriv->fWglUsed)
{
/* We do not need to destroy the window but to reparent it and move it to the
@@ -723,209 +722,199 @@ winUpdateWindowsWindow (WindowPtr pWin)
#endif
}
-
/*
* winGetWindowID -
*/
XID
-winGetWindowID (WindowPtr pWin)
+winGetWindowID(WindowPtr pWin)
{
- WindowIDPairRec wi = {pWin, 0};
- ClientPtr c = wClient(pWin);
-
- /* */
- FindClientResourcesByType (c, RT_WINDOW, winFindWindow, &wi);
+ WindowIDPairRec wi = { pWin, 0 };
+ ClientPtr c = wClient(pWin);
+
+ /* */
+ FindClientResourcesByType(c, RT_WINDOW, winFindWindow, &wi);
#if CYGMULTIWINDOW_DEBUG
winDebug ("winGetWindowID - Window ID: %d\n", wi.id);
#endif
- return wi.id;
+ return wi.id;
}
-
/*
* winFindWindow -
*/
static void
-winFindWindow (pointer value, XID id, pointer cdata)
+winFindWindow(pointer value, XID id, pointer cdata)
{
- WindowIDPairPtr wi = (WindowIDPairPtr)cdata;
+ WindowIDPairPtr wi = (WindowIDPairPtr) cdata;
- if (value == wi->value)
- {
- wi->id = id;
+ if (value == wi->value) {
+ wi->id = id;
}
}
-
/*
* winReorderWindowsMultiWindow -
*/
void
-winReorderWindowsMultiWindow (void)
+winReorderWindowsMultiWindow(void)
{
- HWND hwnd = NULL;
- WindowPtr pWin = NULL;
- WindowPtr pWinSib = NULL;
- XID vlist[2];
- static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */
- DWORD dwCurrentProcessID = GetCurrentProcessId ();
- DWORD dwWindowProcessID = 0;
-
- winDebug ("winReorderWindowsMultiWindow\n");
-
- if (fRestacking)
- {
- /* It is a recusive call so immediately exit */
+ HWND hwnd = NULL;
+ WindowPtr pWin = NULL;
+ WindowPtr pWinSib = NULL;
+ XID vlist[2];
+ static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */
+ DWORD dwCurrentProcessID = GetCurrentProcessId();
+ DWORD dwWindowProcessID = 0;
+
+ winDebug ("winReorderWindowsMultiWindow\n");
+
+ if (fRestacking) {
+ /* It is a recusive call so immediately exit */
winDebug ("winReorderWindowsMultiWindow - "
- "exit because fRestacking == TRUE\n");
- return;
+ "exit because fRestacking == TRUE\n");
+ return;
}
- fRestacking = TRUE;
-
- /* Loop through top level Window windows, descending in Z order */
- for ( hwnd = GetTopWindow (NULL);
- hwnd;
- hwnd = GetNextWindow (hwnd, GW_HWNDNEXT) )
- {
- /* Don't take care of other Cygwin/X process's windows */
- GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
-
- if ( GetProp (hwnd, WIN_WINDOW_PROP)
- && (dwWindowProcessID == dwCurrentProcessID)
- && !IsIconic (hwnd) ) /* ignore minimized windows */
- {
- pWinSib = pWin;
- pWin = GetProp (hwnd, WIN_WINDOW_PROP);
-
- if (!pWinSib)
- { /* 1st window - raise to the top */
- vlist[0] = Above;
-
- ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin));
- }
- else
- { /* 2nd or deeper windows - just below the previous one */
- vlist[0] = winGetWindowID (pWinSib);
- vlist[1] = Below;
-
- ConfigureWindow (pWin, CWSibling | CWStackMode,
- vlist, wClient(pWin));
- }
- }
+ fRestacking = TRUE;
+
+ /* Loop through top level Window windows, descending in Z order */
+ for (hwnd = GetTopWindow(NULL);
+ hwnd; hwnd = GetNextWindow(hwnd, GW_HWNDNEXT)) {
+ /* Don't take care of other Cygwin/X process's windows */
+ GetWindowThreadProcessId(hwnd, &dwWindowProcessID);
+
+ if (GetProp(hwnd, WIN_WINDOW_PROP)
+ && (dwWindowProcessID == dwCurrentProcessID)
+ && !IsIconic(hwnd)) { /* ignore minimized windows */
+ pWinSib = pWin;
+ pWin = GetProp(hwnd, WIN_WINDOW_PROP);
+
+ if (!pWinSib) { /* 1st window - raise to the top */
+ vlist[0] = Above;
+
+ ConfigureWindow(pWin, CWStackMode, vlist, wClient(pWin));
+ }
+ else { /* 2nd or deeper windows - just below the previous one */
+ vlist[0] = winGetWindowID(pWinSib);
+ vlist[1] = Below;
+
+ ConfigureWindow(pWin, CWSibling | CWStackMode,
+ vlist, wClient(pWin));
+ }
+ }
}
- fRestacking = FALSE;
+ fRestacking = FALSE;
}
-
/*
* winMinimizeWindow - Minimize in response to WM_CHANGE_STATE
*/
void
-winMinimizeWindow (Window id)
+winMinimizeWindow(Window id)
{
- WindowPtr pWin;
- winPrivWinPtr pWinPriv;
+ WindowPtr pWin;
+ winPrivWinPtr pWinPriv;
+
#ifdef XWIN_MULTIWINDOWEXTWM
- win32RootlessWindowPtr pRLWinPriv;
+ win32RootlessWindowPtr pRLWinPriv;
#endif
- HWND hWnd;
- ScreenPtr pScreen = NULL;
- winPrivScreenPtr pScreenPriv = NULL;
- winScreenInfo *pScreenInfo = NULL;
-
- winDebug ("winMinimizeWindow\n");
-
- dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess);
- if (!pWin)
- {
- ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__);
- return;
- }
+ HWND hWnd;
+ ScreenPtr pScreen = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+
+ winDebug ("winMinimizeWindow\n");
+
+ dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient,
+ DixUnknownAccess);
+ if (!pWin) {
+ ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__);
+ return;
+ }
- pScreen = pWin->drawable.pScreen;
- if (pScreen) pScreenPriv = winGetScreenPriv(pScreen);
- if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
+ pScreen = pWin->drawable.pScreen;
+ if (pScreen)
+ pScreenPriv = winGetScreenPriv(pScreen);
+ if (pScreenPriv)
+ pScreenInfo = pScreenPriv->pScreenInfo;
#ifdef XWIN_MULTIWINDOWINTWM
- if (pScreenPriv && pScreenInfo->fInternalWM)
- {
- pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
- hWnd = pRLWinPriv->hWnd;
+ if (pScreenPriv && pScreenInfo->fInternalWM) {
+ pRLWinPriv =
+ (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
+ hWnd = pRLWinPriv->hWnd;
}
- else
+ else
#else
- if (pScreenPriv)
+ if (pScreenPriv)
#endif
{
- pWinPriv = winGetWindowPriv (pWin);
- hWnd = pWinPriv->hWnd;
+ pWinPriv = winGetWindowPriv(pWin);
+ hWnd = pWinPriv->hWnd;
}
- ShowWindow (hWnd, SW_MINIMIZE);
+ ShowWindow(hWnd, SW_MINIMIZE);
}
-
/*
* CopyWindow - See Porting Layer Definition - p. 39
*/
void
-winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
- RegionPtr oldRegion)
+winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt, RegionPtr oldRegion)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winDebug ("CopyWindowMultiWindow\n");
+ winScreenPriv(pScreen);
- WIN_UNWRAP(CopyWindow);
- (*pScreen->CopyWindow)(pWin, oldpt, oldRegion);
- WIN_WRAP(CopyWindow, winCopyWindowMultiWindow);
-}
+ winDebug ("CopyWindowMultiWindow\n");
+ WIN_UNWRAP(CopyWindow);
+ (*pScreen->CopyWindow) (pWin, oldpt, oldRegion);
+ WIN_WRAP(CopyWindow, winCopyWindowMultiWindow);
+}
/*
* MoveWindow - See Porting Layer Definition - p. 42
*/
void
-winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
- WindowPtr pSib, VTKind kind)
+winMoveWindowMultiWindow(WindowPtr pWin, int x, int y,
+ WindowPtr pSib, VTKind kind)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winScreenPriv(pScreen);
winDebug ("MoveWindowMultiWindow to (%d, %d)\n", x, y);
- WIN_UNWRAP(MoveWindow);
- (*pScreen->MoveWindow)(pWin, x, y, pSib, kind);
- WIN_WRAP(MoveWindow, winMoveWindowMultiWindow);
+ WIN_UNWRAP(MoveWindow);
+ (*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
+ WIN_WRAP(MoveWindow, winMoveWindowMultiWindow);
}
-
/*
* ResizeWindow - See Porting Layer Definition - p. 42
*/
void
-winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
- unsigned int h, WindowPtr pSib)
+winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w,
+ unsigned int h, WindowPtr pSib)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winScreenPriv(pScreen);
winDebug ("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h);
- WIN_UNWRAP(ResizeWindow);
- (*pScreen->ResizeWindow)(pWin, x, y, w, h, pSib);
- WIN_WRAP(ResizeWindow, winResizeWindowMultiWindow);
+ WIN_UNWRAP(ResizeWindow);
+ (*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
+ WIN_WRAP(ResizeWindow, winResizeWindowMultiWindow);
}
-
/*
* winAdjustXWindow
*
@@ -937,83 +926,81 @@ winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
* adjusts Windows window with respect to X window.
*/
int
-winAdjustXWindow (WindowPtr pWin, HWND hwnd)
+winAdjustXWindow(WindowPtr pWin, HWND hwnd)
{
- RECT rcDraw; /* Rect made from pWin->drawable to be adjusted */
- RECT rcWin; /* The source: WindowRect from hwnd */
- DrawablePtr pDraw;
- XID vlist[4];
- LONG dX, dY, dW, dH, x, y;
- DWORD dwStyle, dwExStyle;
+ RECT rcDraw; /* Rect made from pWin->drawable to be adjusted */
+ RECT rcWin; /* The source: WindowRect from hwnd */
+ DrawablePtr pDraw;
+ XID vlist[4];
+ LONG dX, dY, dW, dH, x, y;
+ DWORD dwStyle, dwExStyle;
#define WIDTH(rc) (rc.right - rc.left)
#define HEIGHT(rc) (rc.bottom - rc.top)
-
- winDebug ("winAdjustXWindow\n");
- if (IsIconic (hwnd))
- {
+ winDebug ("winAdjustXWindow\n");
+
+ if (IsIconic(hwnd)) {
winDebug ("\timmediately return because the window is iconized\n");
- /*
- * If the Windows window is minimized, its WindowRect has
- * meaningless values so we don't adjust X window to it.
- */
- vlist[0] = 0;
- vlist[1] = 0;
- return ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
+ /*
+ * If the Windows window is minimized, its WindowRect has
+ * meaningless values so we don't adjust X window to it.
+ */
+ vlist[0] = 0;
+ vlist[1] = 0;
+ return ConfigureWindow(pWin, CWX | CWY, vlist, wClient(pWin));
}
-
- pDraw = &pWin->drawable;
-
- /* Calculate the window rect from the drawable */
- x = pDraw->x + GetSystemMetrics (SM_XVIRTUALSCREEN);
- y = pDraw->y + GetSystemMetrics (SM_YVIRTUALSCREEN);
- SetRect (&rcDraw, x, y, x + pDraw->width, y + pDraw->height);
- winDebug("\tDrawable extend {%d, %d, %d, %d}, {%d, %d}\n",
- rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
- rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
- dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE);
- winDebug("\tWindowStyle: %08x %08x\n", dwStyle, dwExStyle);
- AdjustWindowRectEx (&rcDraw, dwStyle, FALSE, dwExStyle);
-
- /* The source of adjust */
- GetWindowRect (hwnd, &rcWin);
- winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
- rcWin.left, rcWin.top, rcWin.right, rcWin.bottom,
- rcWin.right - rcWin.left, rcWin.bottom - rcWin.top);
- winDebug("\tDraw extend {%d, %d, %d, %d}, {%d, %d}\n",
- rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
- rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
-
- if (EqualRect (&rcDraw, &rcWin)) {
- /* Bail if no adjust is needed */
+
+ pDraw = &pWin->drawable;
+
+ /* Calculate the window rect from the drawable */
+ x = pDraw->x + GetSystemMetrics(SM_XVIRTUALSCREEN);
+ y = pDraw->y + GetSystemMetrics(SM_YVIRTUALSCREEN);
+ SetRect(&rcDraw, x, y, x + pDraw->width, y + pDraw->height);
+ winDebug("\tDrawable extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
+ rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
+ dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
+ winDebug("\tWindowStyle: %08x %08x\n", dwStyle, dwExStyle);
+ AdjustWindowRectEx(&rcDraw, dwStyle, FALSE, dwExStyle);
+
+ /* The source of adjust */
+ GetWindowRect(hwnd, &rcWin);
+ winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcWin.left, rcWin.top, rcWin.right, rcWin.bottom,
+ rcWin.right - rcWin.left, rcWin.bottom - rcWin.top);
+ winDebug("\tDraw extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
+ rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
+
+ if (EqualRect(&rcDraw, &rcWin)) {
+ /* Bail if no adjust is needed */
winDebug ("\treturn because already adjusted\n");
- return 0;
- }
-
- /* Calculate delta values */
- dX = rcWin.left - rcDraw.left;
- dY = rcWin.top - rcDraw.top;
- dW = WIDTH(rcWin) - WIDTH(rcDraw);
- dH = HEIGHT(rcWin) - HEIGHT(rcDraw);
-
- /*
- * Adjust.
- * We may only need to move (vlist[0] and [1]), or only resize
- * ([2] and [3]) but currently we set all the parameters and leave
- * the decision to ConfigureWindow. The reason is code simplicity.
- */
- vlist[0] = pDraw->x + dX - wBorderWidth(pWin);
- vlist[1] = pDraw->y + dY - wBorderWidth(pWin);
- vlist[2] = pDraw->width + dW;
- vlist[3] = pDraw->height + dH;
- winDebug ("\tConfigureWindow to (%ld, %ld) - %ldx%ld\n", vlist[0], vlist[1],
- vlist[2], vlist[3]);
- return ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight,
- vlist, wClient(pWin));
-
+ return 0;
+ }
+
+ /* Calculate delta values */
+ dX = rcWin.left - rcDraw.left;
+ dY = rcWin.top - rcDraw.top;
+ dW = WIDTH(rcWin) - WIDTH(rcDraw);
+ dH = HEIGHT(rcWin) - HEIGHT(rcDraw);
+
+ /*
+ * Adjust.
+ * We may only need to move (vlist[0] and [1]), or only resize
+ * ([2] and [3]) but currently we set all the parameters and leave
+ * the decision to ConfigureWindow. The reason is code simplicity.
+ */
+ vlist[0] = pDraw->x + dX - wBorderWidth(pWin);
+ vlist[1] = pDraw->y + dY - wBorderWidth(pWin);
+ vlist[2] = pDraw->width + dW;
+ vlist[3] = pDraw->height + dH;
+ winDebug ("\tConfigureWindow to (%ld, %ld) - %ldx%ld\n", vlist[0], vlist[1],
+ vlist[2], vlist[3]);
+ return ConfigureWindow(pWin, CWX | CWY | CWWidth | CWHeight,
+ vlist, wClient(pWin));
+
#undef WIDTH
#undef HEIGHT
}
-
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c
index 5a8a38ac4..c93d3efe9 100644
--- a/xorg-server/hw/xwin/winmultiwindowwm.c
+++ b/xorg-server/hw/xwin/winmultiwindowwm.c
@@ -90,7 +90,7 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin);
#define WIN_CONNECT_RETRIES 5
#define WIN_CONNECT_DELAY 5
#ifdef HAS_DEVWINDOWS
-# define WIN_MSG_QUEUE_FNAME "/dev/windows"
+#define WIN_MSG_QUEUE_FNAME "/dev/windows"
#endif
#define WIN_JMP_OKAY 0
#define WIN_JMP_ERROR_IO 2
@@ -100,124 +100,122 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin);
*/
typedef struct _WMMsgNodeRec {
- winWMMessageRec msg;
- struct _WMMsgNodeRec *pNext;
+ winWMMessageRec msg;
+ struct _WMMsgNodeRec *pNext;
} WMMsgNodeRec, *WMMsgNodePtr;
typedef struct _WMMsgQueueRec {
- struct _WMMsgNodeRec *pHead;
- struct _WMMsgNodeRec *pTail;
- pthread_mutex_t pmMutex;
- pthread_cond_t pcNotEmpty;
+ struct _WMMsgNodeRec *pHead;
+ struct _WMMsgNodeRec *pTail;
+ pthread_mutex_t pmMutex;
+ pthread_cond_t pcNotEmpty;
#ifdef _DEBUG
- int nQueueSize;
+ int nQueueSize;
#endif
} WMMsgQueueRec, *WMMsgQueuePtr;
typedef struct _WMInfo {
- Display *pDisplay;
- WMMsgQueueRec wmMsgQueue;
- Atom atmWmProtos;
- Atom atmWmDelete;
- Atom atmPrivMap;
+ Display *pDisplay;
+ WMMsgQueueRec wmMsgQueue;
+ Atom atmWmProtos;
+ Atom atmWmDelete;
+ Atom atmPrivMap;
#ifdef XWIN_MULTIWINDOWINTWM
- Bool fAllowOtherWM;
+ Bool fAllowOtherWM;
#endif
} WMInfoRec, *WMInfoPtr;
typedef struct _WMProcArgRec {
- DWORD dwScreen;
- WMInfoPtr pWMInfo;
- pthread_mutex_t *ppmServerStarted;
+ DWORD dwScreen;
+ WMInfoPtr pWMInfo;
+ pthread_mutex_t *ppmServerStarted;
} WMProcArgRec, *WMProcArgPtr;
typedef struct _XMsgProcArgRec {
- Display *pDisplay;
- DWORD dwScreen;
- WMInfoPtr pWMInfo;
- pthread_mutex_t *ppmServerStarted;
- HWND hwndScreen;
+ Display *pDisplay;
+ DWORD dwScreen;
+ WMInfoPtr pWMInfo;
+ pthread_mutex_t *ppmServerStarted;
+ HWND hwndScreen;
} XMsgProcArgRec, *XMsgProcArgPtr;
-
/*
* References to external symbols
*/
extern char *display;
-extern void ErrorF (const char* /*f*/, ...);
+extern void ErrorF(const char * /*f */ , ...);
/*
* Prototypes for local functions
*/
static void
-PushMessage (WMMsgQueuePtr pQueue, WMMsgNodePtr pNode);
+ PushMessage(WMMsgQueuePtr pQueue, WMMsgNodePtr pNode);
-static WMMsgNodePtr
-PopMessage (WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo);
+static WMMsgNodePtr PopMessage(WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo);
static Bool
-InitQueue (WMMsgQueuePtr pQueue);
+ InitQueue(WMMsgQueuePtr pQueue);
static void
-GetWindowName (Display * pDpy, Window iWin, wchar_t **ppName);
+ GetWindowName(Display * pDpy, Window iWin, wchar_t ** ppName);
static int
-SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData);
+ SendXMessage(Display * pDisplay, Window iWin, Atom atmType, long nData);
static void
-UpdateName (WMInfoPtr pWMInfo, Window iWindow);
+ UpdateName(WMInfoPtr pWMInfo, Window iWindow);
-static void*
-winMultiWindowWMProc (void* pArg);
+static void *winMultiWindowWMProc(void *pArg);
static int
-winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr);
+ winMultiWindowWMErrorHandler(Display * pDisplay, XErrorEvent * pErr);
static int
-winMultiWindowWMIOErrorHandler (Display *pDisplay);
+ winMultiWindowWMIOErrorHandler(Display * pDisplay);
-static void *
-winMultiWindowXMsgProc (void *pArg);
+static void *winMultiWindowXMsgProc(void *pArg);
static int
-winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr);
+ winMultiWindowXMsgProcErrorHandler(Display * pDisplay, XErrorEvent * pErr);
static int
-winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay);
+ winMultiWindowXMsgProcIOErrorHandler(Display * pDisplay);
static void
winMultiWindowThreadExit(void *arg);
static int
-winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr);
+ winRedirectErrorHandler(Display * pDisplay, XErrorEvent * pErr);
static void
-winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg);
+ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg);
static Bool
-CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen, Bool fAllowOtherWM);
+
+CheckAnotherWindowManager(Display * pDisplay, DWORD dwScreen,
+ Bool fAllowOtherWM);
static void
-winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle);
+ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle);
void
-winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle);
+ winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle);
/*
* Local globals
*/
-static jmp_buf g_jmpWMEntry;
+static jmp_buf g_jmpWMEntry;
static XIOErrorHandler g_winMultiWindowWMOldIOErrorHandler;
static pthread_t g_winMultiWindowWMThread;
-static jmp_buf g_jmpXMsgProcEntry;
+static jmp_buf g_jmpXMsgProcEntry;
static XIOErrorHandler g_winMultiWindowXMsgProcOldIOErrorHandler;
static pthread_t g_winMultiWindowXMsgProcThread;
-static Bool g_shutdown = FALSE;
-static Bool redirectError = FALSE;
-static Bool g_fAnotherWMRunning = FALSE;
+static Bool g_shutdown = FALSE;
+static Bool redirectError = FALSE;
+static Bool g_fAnotherWMRunning = FALSE;
static HMODULE g_hmodShell32Dll = NULL;
static HMODULE g_hmodOle32Dll = NULL;
static SHGETPROPERTYSTOREFORWINDOWPROC g_pSHGetPropertyStoreForWindow = NULL;
@@ -228,100 +226,92 @@ static PROPVARIANTCLEARPROC g_pPropVariantClear = NULL;
*/
static void
-PushMessage (WMMsgQueuePtr pQueue, WMMsgNodePtr pNode)
+PushMessage(WMMsgQueuePtr pQueue, WMMsgNodePtr pNode)
{
- /* Lock the queue mutex */
- pthread_mutex_lock (&pQueue->pmMutex);
+ /* Lock the queue mutex */
+ pthread_mutex_lock(&pQueue->pmMutex);
- pNode->pNext = NULL;
-
- if (pQueue->pTail != NULL)
- {
- pQueue->pTail->pNext = pNode;
+ pNode->pNext = NULL;
+
+ if (pQueue->pTail != NULL) {
+ pQueue->pTail->pNext = pNode;
}
- pQueue->pTail = pNode;
-
- if (pQueue->pHead == NULL)
- {
- pQueue->pHead = pNode;
+ pQueue->pTail = pNode;
+
+ if (pQueue->pHead == NULL) {
+ pQueue->pHead = pNode;
}
#ifdef _DEBUG
/* Increase the count of elements in the queue by one */
- ++(pQueue->nQueueSize);
+ ++(pQueue->nQueueSize);
#endif
- /* Release the queue mutex */
- pthread_mutex_unlock (&pQueue->pmMutex);
+ /* Release the queue mutex */
+ pthread_mutex_unlock(&pQueue->pmMutex);
- /* Signal that the queue is not empty */
- pthread_cond_signal (&pQueue->pcNotEmpty);
+ /* Signal that the queue is not empty */
+ pthread_cond_signal(&pQueue->pcNotEmpty);
}
-
#ifdef WINDBG
/*
* QueueSize - Return the size of the queue
*/
static int
-QueueSize (WMMsgQueuePtr pQueue)
+QueueSize(WMMsgQueuePtr pQueue)
{
- WMMsgNodePtr pNode;
- int nSize = 0;
-
- /* Loop through all elements in the queue */
- for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext)
- ++nSize;
+ WMMsgNodePtr pNode;
+ int nSize = 0;
- return nSize;
+ /* Loop through all elements in the queue */
+ for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext)
+ ++nSize;
+
+ return nSize;
}
#endif
-
/*
* PopMessage - Pop a message from the queue
*/
static WMMsgNodePtr
-PopMessage (WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo)
+PopMessage(WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo)
{
- WMMsgNodePtr pNode;
+ WMMsgNodePtr pNode;
- /* Lock the queue mutex */
- pthread_mutex_lock (&pQueue->pmMutex);
+ /* Lock the queue mutex */
+ pthread_mutex_lock(&pQueue->pmMutex);
- /* Wait for --- */
- while (pQueue->pHead == NULL)
- {
- pthread_cond_wait (&pQueue->pcNotEmpty, &pQueue->pmMutex);
+ /* Wait for --- */
+ while (pQueue->pHead == NULL) {
+ pthread_cond_wait(&pQueue->pcNotEmpty, &pQueue->pmMutex);
}
-
- pNode = pQueue->pHead;
- if (pQueue->pHead != NULL)
- {
- pQueue->pHead = pQueue->pHead->pNext;
+
+ pNode = pQueue->pHead;
+ if (pQueue->pHead != NULL) {
+ pQueue->pHead = pQueue->pHead->pNext;
}
- if (pQueue->pTail == pNode)
- {
- pQueue->pTail = NULL;
+ if (pQueue->pTail == pNode) {
+ pQueue->pTail = NULL;
}
#ifdef _DEBUG
/* Drop the number of elements in the queue by one */
- --(pQueue->nQueueSize);
+ --(pQueue->nQueueSize);
winDebug ("Queue Size %d %d\n", pQueue->nQueueSize, QueueSize(pQueue));
#endif
-
- /* Release the queue mutex */
- pthread_mutex_unlock (&pQueue->pmMutex);
- return pNode;
-}
+ /* Release the queue mutex */
+ pthread_mutex_unlock(&pQueue->pmMutex);
+ return pNode;
+}
#if 0
/*
@@ -329,195 +319,178 @@ PopMessage (WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo)
*/
static Bool
-HaveMessage (WMMsgQueuePtr pQueue, UINT msg, Window iWindow)
+HaveMessage(WMMsgQueuePtr pQueue, UINT msg, Window iWindow)
{
- WMMsgNodePtr pNode;
-
- for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext)
- {
- if (pNode->msg.msg==msg && pNode->msg.iWindow==iWindow)
- return True;
+ WMMsgNodePtr pNode;
+
+ for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext) {
+ if (pNode->msg.msg == msg && pNode->msg.iWindow == iWindow)
+ return True;
}
-
- return False;
+
+ return False;
}
#endif
-
/*
* InitQueue - Initialize the Window Manager message queue
*/
static
-Bool
-InitQueue (WMMsgQueuePtr pQueue)
+ Bool
+InitQueue(WMMsgQueuePtr pQueue)
{
- /* Check if the pQueue pointer is NULL */
- if (pQueue == NULL)
- {
- ErrorF ("InitQueue - pQueue is NULL. Exiting.\n");
- return FALSE;
+ /* Check if the pQueue pointer is NULL */
+ if (pQueue == NULL) {
+ ErrorF("InitQueue - pQueue is NULL. Exiting.\n");
+ return FALSE;
}
- /* Set the head and tail to NULL */
- pQueue->pHead = NULL;
- pQueue->pTail = NULL;
+ /* Set the head and tail to NULL */
+ pQueue->pHead = NULL;
+ pQueue->pTail = NULL;
- /* There are no elements initially */
+ /* There are no elements initially */
#ifdef _DEBUG
- pQueue->nQueueSize = 0;
+ pQueue->nQueueSize = 0;
- winDebug ("InitQueue - Queue Size %d %d\n", pQueue->nQueueSize,
- QueueSize(pQueue));
+ winDebug ("InitQueue - Queue Size %d %d\n", pQueue->nQueueSize,
+ QueueSize(pQueue));
#endif
- winDebug ("InitQueue - Calling pthread_mutex_init\n");
+ winDebug ("InitQueue - Calling pthread_mutex_init\n");
- /* Create synchronization objects */
- pthread_mutex_init (&pQueue->pmMutex, NULL);
+ /* Create synchronization objects */
+ pthread_mutex_init(&pQueue->pmMutex, NULL);
- winDebug ("InitQueue - pthread_mutex_init returned\n");
- winDebug ("InitQueue - Calling pthread_cond_init\n");
+ winDebug ("InitQueue - pthread_mutex_init returned\n");
+ winDebug ("InitQueue - Calling pthread_cond_init\n");
- pthread_cond_init (&pQueue->pcNotEmpty, NULL);
+ pthread_cond_init(&pQueue->pcNotEmpty, NULL);
- winDebug ("InitQueue - pthread_cond_init returned\n");
+ winDebug ("InitQueue - pthread_cond_init returned\n");
- return TRUE;
+ return TRUE;
}
-
/*
* GetWindowName - Retrieve the title of an X Window
*/
static void
-GetWindowName (Display *pDisplay, Window iWin, wchar_t **ppName)
+GetWindowName(Display * pDisplay, Window iWin, wchar_t ** ppName)
{
- int nResult, nNum;
- char **ppList;
- char *pszReturnData;
- int iLen, i;
- XTextProperty xtpName;
-
- winDebug ("GetWindowName\n");
-
- /* Intialize ppName to NULL */
- *ppName = NULL;
-
- /* Try to get --- */
- nResult = XGetWMName (pDisplay, iWin, &xtpName);
- if (!nResult || !xtpName.value || !xtpName.nitems)
- {
- ErrorF ("GetWindowName - XGetWMName failed. No name.\n");
- return;
+ int nResult, nNum;
+ char **ppList;
+ char *pszReturnData;
+ int iLen, i;
+ XTextProperty xtpName;
+
+ winDebug ("GetWindowName\n");
+
+ /* Intialize ppName to NULL */
+ *ppName = NULL;
+
+ /* Try to get --- */
+ nResult = XGetWMName(pDisplay, iWin, &xtpName);
+ if (!nResult || !xtpName.value || !xtpName.nitems) {
+ ErrorF("GetWindowName - XGetWMName failed. No name.\n");
+ return;
}
- if (Xutf8TextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
- {
- iLen = 0;
- for (i = 0; i < nNum; i++) iLen += strlen(ppList[i]);
- pszReturnData = (char *) malloc (iLen + 1);
- pszReturnData[0] = '\0';
- for (i = 0; i < nNum; i++) strcat (pszReturnData, ppList[i]);
- if (ppList) XFreeStringList (ppList);
- }
- else
- {
- pszReturnData = (char *) malloc (1);
- pszReturnData[0] = '\0';
- }
- iLen = MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, NULL, 0);
- *ppName = (wchar_t*)malloc(sizeof(wchar_t)*(iLen + 1));
- MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, *ppName, iLen);
- XFree (xtpName.value);
- free (pszReturnData);
- winDebug ("GetWindowName - Returning\n");
+ if (Xutf8TextPropertyToTextList(pDisplay, &xtpName, &ppList, &nNum) >=
+ Success && nNum > 0 && *ppList) {
+ iLen = 0;
+ for (i = 0; i < nNum; i++)
+ iLen += strlen(ppList[i]);
+ pszReturnData = (char *) malloc(iLen + 1);
+ pszReturnData[0] = '\0';
+ for (i = 0; i < nNum; i++)
+ strcat(pszReturnData, ppList[i]);
+ if (ppList)
+ XFreeStringList(ppList);
+ }
+ else {
+ pszReturnData = (char *) malloc(1);
+ pszReturnData[0] = '\0';
+ }
+ iLen = MultiByteToWideChar(CP_UTF8, 0, pszReturnData, -1, NULL, 0);
+ *ppName = (wchar_t *) malloc(sizeof(wchar_t) * (iLen + 1));
+ MultiByteToWideChar(CP_UTF8, 0, pszReturnData, -1, *ppName, iLen);
+ XFree(xtpName.value);
+ free(pszReturnData);
+ winDebug ("GetWindowName - Returning\n");
}
-
/*
* Send a message to the X server from the WM thread
*/
static int
-SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData)
+SendXMessage(Display * pDisplay, Window iWin, Atom atmType, long nData)
{
- XEvent e;
-
- /* Prepare the X event structure */
- e.type = ClientMessage;
- e.xclient.window = iWin;
- e.xclient.message_type = atmType;
- e.xclient.format = 32;
- e.xclient.data.l[0] = nData;
- e.xclient.data.l[1] = CurrentTime;
-
- /* Send the event to X */
- return XSendEvent (pDisplay, iWin, False, NoEventMask, &e);
+ XEvent e;
+
+ /* Prepare the X event structure */
+ e.type = ClientMessage;
+ e.xclient.window = iWin;
+ e.xclient.message_type = atmType;
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = nData;
+ e.xclient.data.l[1] = CurrentTime;
+
+ /* Send the event to X */
+ return XSendEvent(pDisplay, iWin, False, NoEventMask, &e);
}
-
/*
* Updates the name of a HWND according to its X WM_NAME property
*/
static void
-UpdateName (WMInfoPtr pWMInfo, Window iWindow)
+UpdateName(WMInfoPtr pWMInfo, Window iWindow)
{
- wchar_t *pszName;
- Atom atmType;
- int fmtRet;
- unsigned long items, remain;
- HWND *retHwnd, hWnd;
- XWindowAttributes attr;
-
- hWnd = 0;
-
- /* See if we can get the cached HWND for this window... */
- if (XGetWindowProperty (pWMInfo->pDisplay,
- iWindow,
- pWMInfo->atmPrivMap,
- 0,
- 1,
- False,
- XA_INTEGER,//pWMInfo->atmPrivMap,
- &atmType,
- &fmtRet,
- &items,
- &remain,
- (unsigned char **) &retHwnd) == Success)
- {
- if (retHwnd)
- {
- hWnd = *retHwnd;
- XFree (retHwnd);
- }
+ wchar_t *pszName;
+ Atom atmType;
+ int fmtRet;
+ unsigned long items, remain;
+ HWND *retHwnd, hWnd;
+ XWindowAttributes attr;
+
+ hWnd = 0;
+
+ /* See if we can get the cached HWND for this window... */
+ if (XGetWindowProperty(pWMInfo->pDisplay, iWindow, pWMInfo->atmPrivMap, 0, 1, False, XA_INTEGER, //pWMInfo->atmPrivMap,
+ &atmType,
+ &fmtRet,
+ &items,
+ &remain, (unsigned char **) &retHwnd) == Success) {
+ if (retHwnd) {
+ hWnd = *retHwnd;
+ XFree(retHwnd);
+ }
}
-
- /* Some sanity checks */
- if (!hWnd) return;
- if (!IsWindow (hWnd)) return;
- /* Set the Windows window name */
- GetWindowName (pWMInfo->pDisplay, iWindow, &pszName);
- if (pszName)
- {
- /* Get the window attributes */
- XGetWindowAttributes (pWMInfo->pDisplay,
- iWindow,
- &attr);
- if (!attr.override_redirect)
- {
- SetWindowTextW (hWnd, pszName);
- winUpdateIcon (iWindow);
- }
-
- free (pszName);
+ /* Some sanity checks */
+ if (!hWnd)
+ return;
+ if (!IsWindow(hWnd))
+ return;
+
+ /* Set the Windows window name */
+ GetWindowName(pWMInfo->pDisplay, iWindow, &pszName);
+ if (pszName) {
+ /* Get the window attributes */
+ XGetWindowAttributes(pWMInfo->pDisplay, iWindow, &attr);
+ if (!attr.override_redirect) {
+ SetWindowTextW(hWnd, pszName);
+ winUpdateIcon(iWindow);
+ }
+
+ free(pszName);
}
}
-
#if 0
/*
* Fix up any differences between the X11 and Win32 window stacks
@@ -526,609 +499,546 @@ UpdateName (WMInfoPtr pWMInfo, Window iWindow)
static void
PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction)
{
- Atom atmType;
- int fmtRet;
- unsigned long items, remain;
- HWND hWnd, *retHwnd;
- DWORD myWinProcID, winProcID;
- Window xWindow;
- WINDOWPLACEMENT wndPlace;
-
- hWnd = NULL;
- /* See if we can get the cached HWND for this window... */
- if (XGetWindowProperty (pWMInfo->pDisplay,
- iWindow,
- pWMInfo->atmPrivMap,
- 0,
- 1,
- False,
- XA_INTEGER,//pWMInfo->atmPrivMap,
- &atmType,
- &fmtRet,
- &items,
- &remain,
- (unsigned char **) &retHwnd) == Success)
- {
- if (retHwnd)
- {
- hWnd = *retHwnd;
- XFree (retHwnd);
- }
+ Atom atmType;
+ int fmtRet;
+ unsigned long items, remain;
+ HWND hWnd, *retHwnd;
+ DWORD myWinProcID, winProcID;
+ Window xWindow;
+ WINDOWPLACEMENT wndPlace;
+
+ hWnd = NULL;
+ /* See if we can get the cached HWND for this window... */
+ if (XGetWindowProperty(pWMInfo->pDisplay, iWindow, pWMInfo->atmPrivMap, 0, 1, False, XA_INTEGER, //pWMInfo->atmPrivMap,
+ &atmType,
+ &fmtRet,
+ &items,
+ &remain, (unsigned char **) &retHwnd) == Success) {
+ if (retHwnd) {
+ hWnd = *retHwnd;
+ XFree(retHwnd);
+ }
}
-
- if (!hWnd) return;
-
- GetWindowThreadProcessId (hWnd, &myWinProcID);
- hWnd = GetNextWindow (hWnd, direction);
-
- while (hWnd) {
- GetWindowThreadProcessId (hWnd, &winProcID);
- if (winProcID == myWinProcID)
- {
- wndPlace.length = sizeof(WINDOWPLACEMENT);
- GetWindowPlacement (hWnd, &wndPlace);
- if ( !(wndPlace.showCmd==SW_HIDE ||
- wndPlace.showCmd==SW_MINIMIZE) )
- {
- xWindow = (Window)GetProp (hWnd, WIN_WID_PROP);
- if (xWindow)
- {
- if (direction==GW_HWNDPREV)
- XRaiseWindow (pWMInfo->pDisplay, xWindow);
- else
- XLowerWindow (pWMInfo->pDisplay, xWindow);
- }
- }
- }
+
+ if (!hWnd)
+ return;
+
+ GetWindowThreadProcessId(hWnd, &myWinProcID);
hWnd = GetNextWindow(hWnd, direction);
- }
-}
-#endif /* PreserveWin32Stack */
+ while (hWnd) {
+ GetWindowThreadProcessId(hWnd, &winProcID);
+ if (winProcID == myWinProcID) {
+ wndPlace.length = sizeof(WINDOWPLACEMENT);
+ GetWindowPlacement(hWnd, &wndPlace);
+ if (!(wndPlace.showCmd == SW_HIDE ||
+ wndPlace.showCmd == SW_MINIMIZE)) {
+ xWindow = (Window) GetProp(hWnd, WIN_WID_PROP);
+ if (xWindow) {
+ if (direction == GW_HWNDPREV)
+ XRaiseWindow(pWMInfo->pDisplay, xWindow);
+ else
+ XLowerWindow(pWMInfo->pDisplay, xWindow);
+ }
+ }
+ }
+ hWnd = GetNextWindow(hWnd, direction);
+ }
+}
+#endif /* PreserveWin32Stack */
/*
* winMultiWindowWMProc
*/
static void *
-winMultiWindowWMProc (void *pArg)
+winMultiWindowWMProc(void *pArg)
{
- WMProcArgPtr pProcArg = (WMProcArgPtr)pArg;
- WMInfoPtr pWMInfo = pProcArg->pWMInfo;
+ WMProcArgPtr pProcArg = (WMProcArgPtr) pArg;
+ WMInfoPtr pWMInfo = pProcArg->pWMInfo;
- pthread_cleanup_push(&winMultiWindowThreadExit, NULL);
-
- /* Initialize the Window Manager */
- winInitMultiWindowWM (pWMInfo, pProcArg);
+ pthread_cleanup_push(&winMultiWindowThreadExit, NULL);
- winDebug ("winMultiWindowWMProc ()\n");
+ /* Initialize the Window Manager */
+ winInitMultiWindowWM(pWMInfo, pProcArg);
- /* Loop until we explicitly break out */
- for (;;)
- {
- WMMsgNodePtr pNode;
+ winDebug ("winMultiWindowWMProc ()\n");
+
+ /* Loop until we explicitly break out */
+ for (;;) {
+ WMMsgNodePtr pNode;
#ifdef XWIN_MULTIWINDOWINTWM
- if(g_fAnotherWMRunning)/* Another Window manager exists. */
- {
- Sleep (1000);
- continue;
- }
+ if (g_fAnotherWMRunning) { /* Another Window manager exists. */
+ Sleep(1000);
+ continue;
+ }
#endif
- /* Pop a message off of our queue */
- pNode = PopMessage (&pWMInfo->wmMsgQueue, pWMInfo);
- if (pNode == NULL)
- {
- /* Bail if PopMessage returns without a message */
- /* NOTE: Remember that PopMessage is a blocking function. */
- ErrorF ("winMultiWindowWMProc - Queue is Empty? Exiting.\n");
- pthread_exit (NULL);
- }
-
- winDebug ("winMultiWindowWMProc - %d ms MSG: %d ID: %d\n",
- GetTickCount (), (int)pNode->msg.msg, (int)pNode->msg.dwID);
-
- /* Branch on the message type */
- switch (pNode->msg.msg)
- {
- case WM_WM_RAISE:
- winDebug ("\tWM_WM_RAISE\n");
- /* Raise the window */
- XRaiseWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
- break;
-
- case WM_WM_LOWER:
- winDebug ("\tWM_WM_LOWER\n");
-
- /* Lower the window */
- XLowerWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
- break;
-
- case WM_WM_MAP:
- winDebug ("\tWM_WM_MAP\n");
- /* Put a note as to the HWND associated with this Window */
- XChangeProperty (pWMInfo->pDisplay,
- pNode->msg.iWindow,
- pWMInfo->atmPrivMap,
- XA_INTEGER,//pWMInfo->atmPrivMap,
- 32,
- PropModeReplace,
- (unsigned char *) &(pNode->msg.hwndWindow),
- 1);
- UpdateName (pWMInfo, pNode->msg.iWindow);
- winUpdateIcon (pNode->msg.iWindow);
- {
- HWND zstyle = HWND_NOTOPMOST;
- winApplyHints (pWMInfo->pDisplay, pNode->msg.iWindow, pNode->msg.hwndWindow, &zstyle);
- winUpdateWindowPosition (pNode->msg.hwndWindow, TRUE, &zstyle);
- }
- break;
-
- case WM_WM_MAP2:
- winDebug ("\tWM_WM_MAP2\n");
-
- XChangeProperty (pWMInfo->pDisplay,
- pNode->msg.iWindow,
- pWMInfo->atmPrivMap,
- XA_INTEGER,//pWMInfo->atmPrivMap,
- 32,
- PropModeReplace,
- (unsigned char *) &(pNode->msg.hwndWindow),
- 1);
- break;
-
- case WM_WM_MAP3:
- winDebug ("\tWM_WM_MAP3\n");
-
- /* Put a note as to the HWND associated with this Window */
- XChangeProperty (pWMInfo->pDisplay,
- pNode->msg.iWindow,
- pWMInfo->atmPrivMap,
- XA_INTEGER,//pWMInfo->atmPrivMap,
- 32,
- PropModeReplace,
- (unsigned char *) &(pNode->msg.hwndWindow),
- 1);
- UpdateName (pWMInfo, pNode->msg.iWindow);
- winUpdateIcon (pNode->msg.iWindow);
- {
- HWND zstyle = HWND_NOTOPMOST;
- winApplyHints (pWMInfo->pDisplay, pNode->msg.iWindow, pNode->msg.hwndWindow, &zstyle);
- winUpdateWindowPosition (pNode->msg.hwndWindow, TRUE, &zstyle);
- }
- break;
-
- case WM_WM_UNMAP:
- winDebug ("\tWM_WM_UNMAP\n");
-
- /* Unmap the window */
- XUnmapWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
- break;
-
- case WM_WM_KILL:
- winDebug ("\tWM_WM_KILL\n");
- {
- int i, n, found = 0;
- Atom *protocols;
-
- /* --- */
- if (XGetWMProtocols (pWMInfo->pDisplay,
- pNode->msg.iWindow,
- &protocols,
- &n))
- {
- for (i = 0; i < n; ++i)
- if (protocols[i] == pWMInfo->atmWmDelete)
- ++found;
-
- XFree (protocols);
- }
-
- /* --- */
- if (found)
- SendXMessage (pWMInfo->pDisplay,
- pNode->msg.iWindow,
- pWMInfo->atmWmProtos,
- pWMInfo->atmWmDelete);
- else
- XKillClient (pWMInfo->pDisplay,
- pNode->msg.iWindow);
- }
- break;
-
- case WM_WM_ACTIVATE:
- winDebug ("\tWM_WM_ACTIVATE\n");
-
- /* Set the input focus */
- XSetInputFocus (pWMInfo->pDisplay,
- pNode->msg.iWindow,
- RevertToPointerRoot,
- CurrentTime);
- break;
-
- case WM_WM_NAME_EVENT:
- UpdateName (pWMInfo, pNode->msg.iWindow);
- break;
-
- case WM_WM_HINTS_EVENT:
- winUpdateIcon (pNode->msg.iWindow);
- break;
-
- case WM_WM_CHANGE_STATE:
- /* Minimize the window in Windows */
- winMinimizeWindow (pNode->msg.iWindow);
- break;
-
- default:
- ErrorF ("winMultiWindowWMProc - Unknown Message. Exiting.\n");
- pthread_exit (NULL);
- break;
- }
-
- /* Free the retrieved message */
- free (pNode);
-
- /* Flush any pending events on our display */
- XFlush (pWMInfo->pDisplay);
+ /* Pop a message off of our queue */
+ pNode = PopMessage(&pWMInfo->wmMsgQueue, pWMInfo);
+ if (pNode == NULL) {
+ /* Bail if PopMessage returns without a message */
+ /* NOTE: Remember that PopMessage is a blocking function. */
+ ErrorF("winMultiWindowWMProc - Queue is Empty? Exiting.\n");
+ pthread_exit(NULL);
+ }
+
+ winDebug ("winMultiWindowWMProc - %d ms MSG: %d ID: %d\n",
+ GetTickCount(), (int) pNode->msg.msg, (int) pNode->msg.dwID);
+
+ /* Branch on the message type */
+ switch (pNode->msg.msg) {
+ case WM_WM_RAISE:
+ winDebug ("\tWM_WM_RAISE\n");
+ /* Raise the window */
+ XRaiseWindow(pWMInfo->pDisplay, pNode->msg.iWindow);
+ break;
+
+ case WM_WM_LOWER:
+ winDebug ("\tWM_WM_LOWER\n");
+
+ /* Lower the window */
+ XLowerWindow(pWMInfo->pDisplay, pNode->msg.iWindow);
+ break;
+
+ case WM_WM_MAP:
+ winDebug ("\tWM_WM_MAP\n");
+ /* Put a note as to the HWND associated with this Window */
+ XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, //pWMInfo->atmPrivMap,
+ 32,
+ PropModeReplace,
+ (unsigned char *) &(pNode->msg.hwndWindow), 1);
+ UpdateName(pWMInfo, pNode->msg.iWindow);
+ winUpdateIcon(pNode->msg.iWindow);
+ {
+ HWND zstyle = HWND_NOTOPMOST;
+ winApplyHints (pWMInfo->pDisplay, pNode->msg.iWindow, pNode->msg.hwndWindow, &zstyle);
+ winUpdateWindowPosition (pNode->msg.hwndWindow, TRUE, &zstyle);
+ }
+ break;
+
+ case WM_WM_MAP2:
+ winDebug ("\tWM_WM_MAP2\n");
+
+ XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, //pWMInfo->atmPrivMap,
+ 32,
+ PropModeReplace,
+ (unsigned char *) &(pNode->msg.hwndWindow), 1);
+ break;
+
+ case WM_WM_MAP3:
+ winDebug ("\tWM_WM_MAP3\n");
+
+ /* Put a note as to the HWND associated with this Window */
+ XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, //pWMInfo->atmPrivMap,
+ 32,
+ PropModeReplace,
+ (unsigned char *) &(pNode->msg.hwndWindow), 1);
+ UpdateName(pWMInfo, pNode->msg.iWindow);
+ winUpdateIcon(pNode->msg.iWindow);
+ {
+ HWND zstyle = HWND_NOTOPMOST;
+
+ winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow,
+ pNode->msg.hwndWindow, &zstyle);
+ winUpdateWindowPosition(pNode->msg.hwndWindow, TRUE, &zstyle);
+ }
+ break;
+
+ case WM_WM_UNMAP:
+ winDebug ("\tWM_WM_UNMAP\n");
+
+ /* Unmap the window */
+ XUnmapWindow(pWMInfo->pDisplay, pNode->msg.iWindow);
+ break;
+
+ case WM_WM_KILL:
+ winDebug ("\tWM_WM_KILL\n");
+ {
+ int i, n, found = 0;
+ Atom *protocols;
+
+ /* --- */
+ if (XGetWMProtocols(pWMInfo->pDisplay,
+ pNode->msg.iWindow, &protocols, &n)) {
+ for (i = 0; i < n; ++i)
+ if (protocols[i] == pWMInfo->atmWmDelete)
+ ++found;
+
+ XFree(protocols);
+ }
+
+ /* --- */
+ if (found)
+ SendXMessage(pWMInfo->pDisplay,
+ pNode->msg.iWindow,
+ pWMInfo->atmWmProtos, pWMInfo->atmWmDelete);
+ else
+ XKillClient(pWMInfo->pDisplay, pNode->msg.iWindow);
+ }
+ break;
+
+ case WM_WM_ACTIVATE:
+ winDebug ("\tWM_WM_ACTIVATE\n");
+
+ /* Set the input focus */
+ XSetInputFocus(pWMInfo->pDisplay,
+ pNode->msg.iWindow,
+ RevertToPointerRoot, CurrentTime);
+ break;
+
+ case WM_WM_NAME_EVENT:
+ UpdateName(pWMInfo, pNode->msg.iWindow);
+ break;
+
+ case WM_WM_HINTS_EVENT:
+ winUpdateIcon(pNode->msg.iWindow);
+ break;
+
+ case WM_WM_CHANGE_STATE:
+ /* Minimize the window in Windows */
+ winMinimizeWindow(pNode->msg.iWindow);
+ break;
+
+ default:
+ ErrorF("winMultiWindowWMProc - Unknown Message. Exiting.\n");
+ pthread_exit(NULL);
+ break;
+ }
+
+ /* Free the retrieved message */
+ free(pNode);
+
+ /* Flush any pending events on our display */
+ XFlush(pWMInfo->pDisplay);
}
- /* Free the condition variable */
- pthread_cond_destroy (&pWMInfo->wmMsgQueue.pcNotEmpty);
-
- /* Free the mutex variable */
- pthread_mutex_destroy (&pWMInfo->wmMsgQueue.pmMutex);
-
- /* Free the passed-in argument */
- free (pProcArg);
-
- winDebug("-winMultiWindowWMProc ()\n");
+ /* Free the condition variable */
+ pthread_cond_destroy(&pWMInfo->wmMsgQueue.pcNotEmpty);
- pthread_cleanup_pop(0);
+ /* Free the mutex variable */
+ pthread_mutex_destroy(&pWMInfo->wmMsgQueue.pmMutex);
- return NULL;
-}
+ /* Free the passed-in argument */
+ free(pProcArg);
+ winDebug("-winMultiWindowWMProc ()\n");
+
+ pthread_cleanup_pop(0);
+
+ return NULL;
+}
/*
* X message procedure
*/
static void *
-winMultiWindowXMsgProc (void *pArg)
+winMultiWindowXMsgProc(void *pArg)
{
- winWMMessageRec msg;
- XMsgProcArgPtr pProcArg = (XMsgProcArgPtr) pArg;
- char pszDisplay[512];
- int iRetries;
- XEvent event;
- Atom atmWmName;
- Atom atmWmHints;
- Atom atmWmChange;
- int iReturn;
- XIconSize *xis;
-
- pthread_cleanup_push(&winMultiWindowThreadExit, NULL);
-
- winDebug ("winMultiWindowXMsgProc - Hello\n");
-
- /* Check that argument pointer is not invalid */
- if (pProcArg == NULL)
- {
- ErrorF ("winMultiWindowXMsgProc - pProcArg is NULL. Exiting.\n");
- pthread_exit (NULL);
+ winWMMessageRec msg;
+ XMsgProcArgPtr pProcArg = (XMsgProcArgPtr) pArg;
+ char pszDisplay[512];
+ int iRetries;
+ XEvent event;
+ Atom atmWmName;
+ Atom atmWmHints;
+ Atom atmWmChange;
+ int iReturn;
+ XIconSize *xis;
+
+ pthread_cleanup_push(&winMultiWindowThreadExit, NULL);
+
+ winDebug ("winMultiWindowXMsgProc - Hello\n");
+
+ /* Check that argument pointer is not invalid */
+ if (pProcArg == NULL) {
+ ErrorF("winMultiWindowXMsgProc - pProcArg is NULL. Exiting.\n");
+ pthread_exit(NULL);
}
- winDebug ("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n");
+ winDebug ("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n");
- /* Grab the server started mutex - pause until we get it */
- iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
- if (iReturn != 0)
- {
- ErrorF ("winMultiWindowXMsgProc - pthread_mutex_lock () failed: %d. "
- "Exiting.\n",
- iReturn);
- pthread_exit (NULL);
+ /* Grab the server started mutex - pause until we get it */
+ iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted);
+ if (iReturn != 0) {
+ ErrorF("winMultiWindowXMsgProc - pthread_mutex_lock () failed: %d. "
+ "Exiting.\n", iReturn);
+ pthread_exit(NULL);
}
- winDebug ("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n");
+ winDebug ("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n");
- /* Release the server started mutex */
- pthread_mutex_unlock (pProcArg->ppmServerStarted);
+ /* Release the server started mutex */
+ pthread_mutex_unlock(pProcArg->ppmServerStarted);
- winDebug ("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
+ winDebug ("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
- /* Install our error handler */
- XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
- g_winMultiWindowXMsgProcThread = pthread_self();
- g_winMultiWindowXMsgProcOldIOErrorHandler = XSetIOErrorHandler (winMultiWindowXMsgProcIOErrorHandler);
+ /* Install our error handler */
+ XSetErrorHandler(winMultiWindowXMsgProcErrorHandler);
+ g_winMultiWindowXMsgProcThread = pthread_self();
+ g_winMultiWindowXMsgProcOldIOErrorHandler =
+ XSetIOErrorHandler(winMultiWindowXMsgProcIOErrorHandler);
- /* Set jump point for IO Error exits */
- iReturn = setjmp (g_jmpXMsgProcEntry);
+ /* Set jump point for IO Error exits */
+ iReturn = setjmp(g_jmpXMsgProcEntry);
- /* Check if we should continue operations */
- if (iReturn != WIN_JMP_ERROR_IO
- && iReturn != WIN_JMP_OKAY)
- {
- /* setjmp returned an unknown value, exit */
- ErrorF ("winInitMultiWindowXMsgProc - setjmp returned: %d. Exiting.\n",
- iReturn);
- pthread_exit (NULL);
+ /* Check if we should continue operations */
+ if (iReturn != WIN_JMP_ERROR_IO && iReturn != WIN_JMP_OKAY) {
+ /* setjmp returned an unknown value, exit */
+ ErrorF("winInitMultiWindowXMsgProc - setjmp returned: %d. Exiting.\n",
+ iReturn);
+ pthread_exit(NULL);
}
- else if (iReturn == WIN_JMP_ERROR_IO)
- {
- ErrorF ("winInitMultiWindowXMsgProc - Caught IO Error. Exiting.\n");
- pthread_exit (NULL);
+ else if (iReturn == WIN_JMP_ERROR_IO) {
+ ErrorF("winInitMultiWindowXMsgProc - Caught IO Error. Exiting.\n");
+ pthread_exit(NULL);
}
- /* Setup the display connection string x */
- winGetDisplayName(pszDisplay, (int)pProcArg->dwScreen);
+ /* Setup the display connection string x */
+ winGetDisplayName(pszDisplay, (int)pProcArg->dwScreen);
- /* Print the display connection string */
- winDebug ("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay);
+ /* Print the display connection string */
+ winDebug ("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay);
- /* Use our generated cookie for authentication */
- winSetAuthorization();
-
- /* Initialize retry count */
- iRetries = 0;
+ /* Use our generated cookie for authentication */
+ winSetAuthorization();
- /* Open the X display */
- do
- {
- /* Try to open the display */
- pProcArg->pDisplay = XOpenDisplay (pszDisplay);
- if (pProcArg->pDisplay == NULL)
- {
- winDebug ("winMultiWindowXMsgProc - Could not open display, try: %d, "
- "sleeping: %d\n",
- iRetries + 1, WIN_CONNECT_DELAY);
- ++iRetries;
- sleep (WIN_CONNECT_DELAY);
- continue;
- }
- else
- break;
+ /* Initialize retry count */
+ iRetries = 0;
+
+ /* Open the X display */
+ do {
+ /* Try to open the display */
+ pProcArg->pDisplay = XOpenDisplay(pszDisplay);
+ if (pProcArg->pDisplay == NULL) {
+ winDebug ("winMultiWindowXMsgProc - Could not open display, try: %d, "
+ "sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY);
+ ++iRetries;
+ sleep(WIN_CONNECT_DELAY);
+ continue;
+ }
+ else
+ break;
}
- while (pProcArg->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
-
- /* Make sure that the display opened */
- if (pProcArg->pDisplay == NULL)
- {
- ErrorF ("winMultiWindowXMsgProc - Failed opening the display. "
- "Exiting.\n");
- pthread_exit (NULL);
+ while (pProcArg->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
+
+ /* Make sure that the display opened */
+ if (pProcArg->pDisplay == NULL) {
+ ErrorF("winMultiWindowXMsgProc - Failed opening the display. "
+ "Exiting.\n");
+ pthread_exit(NULL);
}
- winDebug ("winMultiWindowXMsgProc - XOpenDisplay () returned and "
- "successfully opened the display.\n");
+ winDebug ("winMultiWindowXMsgProc - XOpenDisplay () returned and "
+ "successfully opened the display.\n");
- /* Check if another window manager is already running */
+ /* Check if another window manager is already running */
#ifdef XWIN_MULTIWINDOWINTWM
- g_fAnotherWMRunning = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen, pProcArg->pWMInfo->fAllowOtherWM);
+ g_fAnotherWMRunning =
+ CheckAnotherWindowManager(pProcArg->pDisplay, pProcArg->dwScreen,
+ pProcArg->pWMInfo->fAllowOtherWM);
#else
- g_fAnotherWMRunning = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen, FALSE);
+ g_fAnotherWMRunning =
+ CheckAnotherWindowManager(pProcArg->pDisplay, pProcArg->dwScreen,
+ FALSE);
#endif
- if (g_fAnotherWMRunning
+ if (g_fAnotherWMRunning
#ifdef XWIN_MULTIWINDOWINTWM
- && !pProcArg->pWMInfo->fAllowOtherWM
+ && !pProcArg->pWMInfo->fAllowOtherWM
#endif
- )
- {
- ErrorF ("winMultiWindowXMsgProc - "
- "another window manager is running. Exiting.\n");
- pthread_exit (NULL);
+ ) {
+ ErrorF("winMultiWindowXMsgProc - "
+ "another window manager is running. Exiting.\n");
+ pthread_exit(NULL);
}
- /* Set up the supported icon sizes */
- xis = XAllocIconSize ();
- if (xis)
- {
- xis->min_width = xis->min_height = 16;
- xis->max_width = xis->max_height = 48;
- xis->width_inc = xis->height_inc = 16;
- XSetIconSizes (pProcArg->pDisplay,
- RootWindow (pProcArg->pDisplay, pProcArg->dwScreen),
- xis,
- 1);
- XFree (xis);
+ /* Set up the supported icon sizes */
+ xis = XAllocIconSize();
+ if (xis) {
+ xis->min_width = xis->min_height = 16;
+ xis->max_width = xis->max_height = 48;
+ xis->width_inc = xis->height_inc = 16;
+ XSetIconSizes(pProcArg->pDisplay,
+ RootWindow(pProcArg->pDisplay, pProcArg->dwScreen),
+ xis, 1);
+ XFree(xis);
}
- atmWmName = XInternAtom (pProcArg->pDisplay,
- "WM_NAME",
- False);
- atmWmHints = XInternAtom (pProcArg->pDisplay,
- "WM_HINTS",
- False);
- atmWmChange = XInternAtom (pProcArg->pDisplay,
- "WM_CHANGE_STATE",
- False);
+ atmWmName = XInternAtom(pProcArg->pDisplay, "WM_NAME", False);
+ atmWmHints = XInternAtom(pProcArg->pDisplay, "WM_HINTS", False);
+ atmWmChange = XInternAtom(pProcArg->pDisplay, "WM_CHANGE_STATE", False);
- /*
- iiimxcf had a bug until 2009-04-27, assuming that the
- WM_STATE atom exists, causing clients to fail with
- a BadAtom X error if it doesn't.
+ /*
+ iiimxcf had a bug until 2009-04-27, assuming that the
+ WM_STATE atom exists, causing clients to fail with
+ a BadAtom X error if it doesn't.
- Since this is on in the default Solaris 10 install,
- workaround this by making sure it does exist...
- */
- XInternAtom(pProcArg->pDisplay, "WM_STATE", 0);
+ Since this is on in the default Solaris 10 install,
+ workaround this by making sure it does exist...
+ */
+ XInternAtom(pProcArg->pDisplay, "WM_STATE", 0);
- /* Loop until we explicitly break out */
- while (1)
- {
- if (g_shutdown)
- break;
+ /* Loop until we explicitly break out */
+ while (1) {
+ if (g_shutdown)
+ break;
#ifdef XWIN_MULTIWINDOWINTWM
- if (pProcArg->pWMInfo->fAllowOtherWM && !XPending (pProcArg->pDisplay))
- {
- if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen, TRUE))
- {
- if (!g_fAnotherWMRunning)
- {
- g_fAnotherWMRunning = TRUE;
- SendMessage(*(HWND*)pProcArg->hwndScreen, WM_UNMANAGE, 0, 0);
- }
- }
- else
- {
- if (g_fAnotherWMRunning)
- {
- g_fAnotherWMRunning = FALSE;
- SendMessage(*(HWND*)pProcArg->hwndScreen, WM_MANAGE, 0, 0);
- }
- }
- Sleep (500);
- continue;
- }
+ if (pProcArg->pWMInfo->fAllowOtherWM && !XPending(pProcArg->pDisplay)) {
+ if (CheckAnotherWindowManager
+ (pProcArg->pDisplay, pProcArg->dwScreen, TRUE)) {
+ if (!g_fAnotherWMRunning) {
+ g_fAnotherWMRunning = TRUE;
+ SendMessage(*(HWND *) pProcArg->hwndScreen, WM_UNMANAGE, 0,
+ 0);
+ }
+ }
+ else {
+ if (g_fAnotherWMRunning) {
+ g_fAnotherWMRunning = FALSE;
+ SendMessage(*(HWND *) pProcArg->hwndScreen, WM_MANAGE, 0,
+ 0);
+ }
+ }
+ Sleep(500);
+ continue;
+ }
#endif
- /* Fetch next event */
- XNextEvent (pProcArg->pDisplay, &event);
-
- /* Branch on event type */
- if (event.type == MapNotify /* CreateNotify */)
- {
- XWindowAttributes attr;
-
- XSelectInput (pProcArg->pDisplay,
- event.xcreatewindow.window,
- PropertyChangeMask);
-
- /* Get the window attributes */
- XGetWindowAttributes (pProcArg->pDisplay,
- event.xcreatewindow.window,
- &attr);
-
- if (!attr.override_redirect && attr.class != InputOnly)
- XSetWindowBorderWidth(pProcArg->pDisplay,
- event.xcreatewindow.window,
- 0);
- }
- else if (event.type == MapNotify)
- {
- /* Fake a reparentNotify event as SWT/Motif expects a
- Window Manager to reparent a top-level window when
- it is mapped and waits until they do.
-
- We don't actually need to reparent, as the frame is
- a native window, not an X window
-
- We do this on MapNotify, not MapRequest like a real
- Window Manager would, so we don't have do get involved
- in actually mapping the window via it's (non-existent)
- parent...
-
- See sourceware bugzilla #9848
- */
-
- XWindowAttributes attr;
- Window root;
- Window parent;
- Window *children;
- unsigned int nchildren;
-
- if (XGetWindowAttributes(event.xmap.display,
- event.xmap.window,
- &attr) &&
- XQueryTree(event.xmap.display,
- event.xmap.window,
- &root, &parent, &children, &nchildren))
- {
- if (children) XFree(children);
-
- /*
- It's a top-level window if the parent window is a root window
- Only non-override_redirect windows can get reparented
- */
- if ((attr.root == parent) && !event.xmap.override_redirect)
- {
- XEvent event_send;
-
- event_send.type = ReparentNotify;
- event_send.xreparent.event = event.xmap.window;
- event_send.xreparent.window = event.xmap.window;
- event_send.xreparent.parent = parent;
- event_send.xreparent.x = attr.x;
- event_send.xreparent.y = attr.y;
- event_send.xreparent.override_redirect = False;
-
- XSendEvent(event.xmap.display,
- event.xmap.window,
- True, StructureNotifyMask,
- &event_send);
+ /* Fetch next event */
+ XNextEvent(pProcArg->pDisplay, &event);
+
+ /* Branch on event type */
+ if (event.type == MapNotify /* CreateNotify */) {
+ XWindowAttributes attr;
+
+ XSelectInput(pProcArg->pDisplay,
+ event.xcreatewindow.window, PropertyChangeMask);
+
+ /* Get the window attributes */
+ XGetWindowAttributes(pProcArg->pDisplay,
+ event.xcreatewindow.window, &attr);
+
+ if (!attr.override_redirect && attr.class != InputOnly)
+ XSetWindowBorderWidth(pProcArg->pDisplay,
+ event.xcreatewindow.window, 0);
+ }
+ else if (event.type == MapNotify) {
+ /* Fake a reparentNotify event as SWT/Motif expects a
+ Window Manager to reparent a top-level window when
+ it is mapped and waits until they do.
+
+ We don't actually need to reparent, as the frame is
+ a native window, not an X window
+
+ We do this on MapNotify, not MapRequest like a real
+ Window Manager would, so we don't have do get involved
+ in actually mapping the window via it's (non-existent)
+ parent...
+
+ See sourceware bugzilla #9848
+ */
+
+ XWindowAttributes attr;
+ Window root;
+ Window parent;
+ Window *children;
+ unsigned int nchildren;
+
+ if (XGetWindowAttributes(event.xmap.display,
+ event.xmap.window,
+ &attr) &&
+ XQueryTree(event.xmap.display,
+ event.xmap.window,
+ &root, &parent, &children, &nchildren)) {
+ if (children)
+ XFree(children);
+
+ /*
+ It's a top-level window if the parent window is a root window
+ Only non-override_redirect windows can get reparented
+ */
+ if ((attr.root == parent) && !event.xmap.override_redirect) {
+ XEvent event_send;
+
+ event_send.type = ReparentNotify;
+ event_send.xreparent.event = event.xmap.window;
+ event_send.xreparent.window = event.xmap.window;
+ event_send.xreparent.parent = parent;
+ event_send.xreparent.x = attr.x;
+ event_send.xreparent.y = attr.y;
+ event_send.xreparent.override_redirect = False;
+
+ XSendEvent(event.xmap.display,
+ event.xmap.window,
+ True, StructureNotifyMask, &event_send);
}
}
}
- else if (event.type == ConfigureNotify)
- {
- if (!event.xconfigure.send_event)
- {
- /*
- Java applications using AWT on JRE 1.6.0 break with non-reparenting WMs AWT
- doesn't explicitly know about (See sun bug #6434227)
-
- XDecoratedPeer.handleConfigureNotifyEvent() only processes non-synthetic
- ConfigureNotify events to update window location if it's identified the
- WM as a non-reparenting WM it knows about (compiz or lookingglass)
-
- Rather than tell all sorts of lies to get XWM to recognize us as one of
- those, simply send a synthetic ConfigureNotify for every non-synthetic one
- */
- XEvent event_send = event;
- event_send.xconfigure.send_event = TRUE;
- event_send.xconfigure.event = event.xconfigure.window;
- XSendEvent(event.xconfigure.display,
- event.xconfigure.window,
- True, StructureNotifyMask,
- &event_send);
+ else if (event.type == ConfigureNotify) {
+ if (!event.xconfigure.send_event) {
+ /*
+ Java applications using AWT on JRE 1.6.0 break with non-reparenting WMs AWT
+ doesn't explicitly know about (See sun bug #6434227)
+
+ XDecoratedPeer.handleConfigureNotifyEvent() only processes non-synthetic
+ ConfigureNotify events to update window location if it's identified the
+ WM as a non-reparenting WM it knows about (compiz or lookingglass)
+
+ Rather than tell all sorts of lies to get XWM to recognize us as one of
+ those, simply send a synthetic ConfigureNotify for every non-synthetic one
+ */
+ XEvent event_send = event;
+
+ event_send.xconfigure.send_event = TRUE;
+ event_send.xconfigure.event = event.xconfigure.window;
+ XSendEvent(event.xconfigure.display,
+ event.xconfigure.window,
+ True, StructureNotifyMask, &event_send);
}
}
- else if (event.type == PropertyNotify
- && event.xproperty.atom == atmWmName)
- {
- memset (&msg, 0, sizeof (msg));
-
- msg.msg = WM_WM_NAME_EVENT;
- msg.iWindow = event.xproperty.window;
-
- /* Other fields ignored */
- winSendMessageToWM (pProcArg->pWMInfo, &msg);
- }
- else if (event.type == PropertyNotify
- && event.xproperty.atom == atmWmHints)
- {
- memset (&msg, 0, sizeof (msg));
-
- msg.msg = WM_WM_HINTS_EVENT;
- msg.iWindow = event.xproperty.window;
-
- /* Other fields ignored */
- winSendMessageToWM (pProcArg->pWMInfo, &msg);
- }
- else if (event.type == ClientMessage
- && event.xclient.message_type == atmWmChange
- && event.xclient.data.l[0] == IconicState)
- {
- winDebug ("winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState\n");
-
- memset (&msg, 0, sizeof (msg));
-
- msg.msg = WM_WM_CHANGE_STATE;
- msg.iWindow = event.xclient.window;
-
- winSendMessageToWM (pProcArg->pWMInfo, &msg);
- }
+ else if (event.type == PropertyNotify
+ && event.xproperty.atom == atmWmName) {
+ memset(&msg, 0, sizeof(msg));
+
+ msg.msg = WM_WM_NAME_EVENT;
+ msg.iWindow = event.xproperty.window;
+
+ /* Other fields ignored */
+ winSendMessageToWM(pProcArg->pWMInfo, &msg);
+ }
+ else if (event.type == PropertyNotify
+ && event.xproperty.atom == atmWmHints) {
+ memset(&msg, 0, sizeof(msg));
+
+ msg.msg = WM_WM_HINTS_EVENT;
+ msg.iWindow = event.xproperty.window;
+
+ /* Other fields ignored */
+ winSendMessageToWM(pProcArg->pWMInfo, &msg);
+ }
+ else if (event.type == ClientMessage
+ && event.xclient.message_type == atmWmChange
+ && event.xclient.data.l[0] == IconicState) {
+ winDebug ("winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState\n");
+
+ memset(&msg, 0, sizeof(msg));
+
+ msg.msg = WM_WM_CHANGE_STATE;
+ msg.iWindow = event.xclient.window;
+
+ winSendMessageToWM(pProcArg->pWMInfo, &msg);
+ }
}
- XCloseDisplay (pProcArg->pDisplay);
- pthread_cleanup_pop(0);
- return NULL;
+ XCloseDisplay(pProcArg->pDisplay);
+ pthread_cleanup_pop(0);
+ return NULL;
}
-
/*
* winInitWM - Entry point for the X server to spawn
* the Window Manager thread. Called from
@@ -1136,334 +1046,300 @@ winMultiWindowXMsgProc (void *pArg)
*/
Bool
-winInitWM (void **ppWMInfo,
- pthread_t *ptWMProc,
- pthread_t *ptXMsgProc,
- pthread_mutex_t *ppmServerStarted,
- int dwScreen,
- HWND hwndScreen,
- BOOL allowOtherWM)
+winInitWM(void **ppWMInfo,
+ pthread_t * ptWMProc,
+ pthread_t * ptXMsgProc,
+ pthread_mutex_t * ppmServerStarted,
+ int dwScreen, HWND hwndScreen, BOOL allowOtherWM)
{
- WMProcArgPtr pArg = (WMProcArgPtr) malloc (sizeof(WMProcArgRec));
- WMInfoPtr pWMInfo = (WMInfoPtr) malloc (sizeof(WMInfoRec));
- XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc (sizeof(XMsgProcArgRec));
-
- /* Bail if the input parameters are bad */
- if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) {
- ErrorF ("winInitWM - malloc failed.\n");
- free(pArg);
- free(pWMInfo);
- free(pXMsgArg);
- return FALSE;
- }
-
- /* Zero the allocated memory */
- ZeroMemory (pArg, sizeof (WMProcArgRec));
- ZeroMemory (pWMInfo, sizeof (WMInfoRec));
- ZeroMemory (pXMsgArg, sizeof (XMsgProcArgRec));
+ WMProcArgPtr pArg = (WMProcArgPtr) malloc(sizeof(WMProcArgRec));
+ WMInfoPtr pWMInfo = (WMInfoPtr) malloc(sizeof(WMInfoRec));
+ XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc(sizeof(XMsgProcArgRec));
+
+ /* Bail if the input parameters are bad */
+ if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) {
+ ErrorF("winInitWM - malloc failed.\n");
+ free(pArg);
+ free(pWMInfo);
+ free(pXMsgArg);
+ return FALSE;
+ }
+
+ /* Zero the allocated memory */
+ ZeroMemory(pArg, sizeof(WMProcArgRec));
+ ZeroMemory(pWMInfo, sizeof(WMInfoRec));
+ ZeroMemory(pXMsgArg, sizeof(XMsgProcArgRec));
- /* Set a return pointer to the Window Manager info structure */
- *ppWMInfo = pWMInfo;
+ /* Set a return pointer to the Window Manager info structure */
+ *ppWMInfo = pWMInfo;
#ifdef XWIN_MULTIWINDOWINTWM
- pWMInfo->fAllowOtherWM = allowOtherWM;
+ pWMInfo->fAllowOtherWM = allowOtherWM;
#endif
- /* Setup the argument structure for the thread function */
- pArg->dwScreen = dwScreen;
- pArg->pWMInfo = pWMInfo;
- pArg->ppmServerStarted = ppmServerStarted;
-
- /* Intialize the message queue */
- if (!InitQueue (&pWMInfo->wmMsgQueue))
- {
- ErrorF ("winInitWM - InitQueue () failed.\n");
- return FALSE;
+ /* Setup the argument structure for the thread function */
+ pArg->dwScreen = dwScreen;
+ pArg->pWMInfo = pWMInfo;
+ pArg->ppmServerStarted = ppmServerStarted;
+
+ /* Intialize the message queue */
+ if (!InitQueue(&pWMInfo->wmMsgQueue)) {
+ ErrorF("winInitWM - InitQueue () failed.\n");
+ return FALSE;
}
-
- /* Spawn a thread for the Window Manager */
- if (pthread_create (ptWMProc, NULL, winMultiWindowWMProc, pArg))
- {
- /* Bail if thread creation failed */
- ErrorF ("winInitWM - pthread_create failed for Window Manager.\n");
- return FALSE;
+
+ /* Spawn a thread for the Window Manager */
+ if (pthread_create(ptWMProc, NULL, winMultiWindowWMProc, pArg)) {
+ /* Bail if thread creation failed */
+ ErrorF("winInitWM - pthread_create failed for Window Manager.\n");
+ return FALSE;
}
- /* Spawn the XNextEvent thread, will send messages to WM */
- pXMsgArg->dwScreen = dwScreen;
- pXMsgArg->pWMInfo = pWMInfo;
- pXMsgArg->ppmServerStarted = ppmServerStarted;
- pXMsgArg->hwndScreen = hwndScreen;
- if (pthread_create (ptXMsgProc, NULL, winMultiWindowXMsgProc, pXMsgArg))
- {
- /* Bail if thread creation failed */
- ErrorF ("winInitWM - pthread_create failed on XMSG.\n");
- return FALSE;
+ /* Spawn the XNextEvent thread, will send messages to WM */
+ pXMsgArg->dwScreen = dwScreen;
+ pXMsgArg->pWMInfo = pWMInfo;
+ pXMsgArg->ppmServerStarted = ppmServerStarted;
+ pXMsgArg->hwndScreen = hwndScreen;
+ if (pthread_create(ptXMsgProc, NULL, winMultiWindowXMsgProc, pXMsgArg)) {
+ /* Bail if thread creation failed */
+ ErrorF("winInitWM - pthread_create failed on XMSG.\n");
+ return FALSE;
}
- winDebug ("winInitWM - Returning.\n");
+ winDebug("winInitWM - Returning.\n");
- return TRUE;
+ return TRUE;
}
-
/*
* Window manager thread - setup
*/
static void
-winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
+winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
{
- int iRetries = 0;
- char pszDisplay[512];
- int iReturn;
+ int iRetries = 0;
+ char pszDisplay[512];
+ int iReturn;
- winDebug ("winInitMultiWindowWM - Hello\n");
+ winDebug ("winInitMultiWindowWM - Hello\n");
- /* Check that argument pointer is not invalid */
- if (pProcArg == NULL)
- {
- ErrorF ("winInitMultiWindowWM - pProcArg is NULL. Exiting.\n");
- pthread_exit (NULL);
+ /* Check that argument pointer is not invalid */
+ if (pProcArg == NULL) {
+ ErrorF("winInitMultiWindowWM - pProcArg is NULL. Exiting.\n");
+ pthread_exit(NULL);
}
- winDebug ("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n");
+ winDebug ("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n");
- /* Grab our garbage mutex to satisfy pthread_cond_wait */
- iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
- if (iReturn != 0)
- {
- ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () failed: %d. "
- "Exiting.\n",
- iReturn);
- pthread_exit (NULL);
+ /* Grab our garbage mutex to satisfy pthread_cond_wait */
+ iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted);
+ if (iReturn != 0) {
+ ErrorF("winInitMultiWindowWM - pthread_mutex_lock () failed: %d. "
+ "Exiting.\n", iReturn);
+ pthread_exit(NULL);
}
- winDebug ("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
+ winDebug ("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
- /* Release the server started mutex */
- pthread_mutex_unlock (pProcArg->ppmServerStarted);
+ /* Release the server started mutex */
+ pthread_mutex_unlock(pProcArg->ppmServerStarted);
- winDebug ("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
+ winDebug ("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
- /* Install our error handler */
- XSetErrorHandler (winMultiWindowWMErrorHandler);
- g_winMultiWindowWMThread = pthread_self();
- g_winMultiWindowWMOldIOErrorHandler = XSetIOErrorHandler (winMultiWindowWMIOErrorHandler);
+ /* Install our error handler */
+ XSetErrorHandler(winMultiWindowWMErrorHandler);
+ g_winMultiWindowWMThread = pthread_self();
+ g_winMultiWindowWMOldIOErrorHandler =
+ XSetIOErrorHandler(winMultiWindowWMIOErrorHandler);
- /* Set jump point for IO Error exits */
- iReturn = setjmp (g_jmpWMEntry);
+ /* Set jump point for IO Error exits */
+ iReturn = setjmp(g_jmpWMEntry);
- /* Check if we should continue operations */
- if (iReturn != WIN_JMP_ERROR_IO
- && iReturn != WIN_JMP_OKAY)
- {
- /* setjmp returned an unknown value, exit */
- ErrorF ("winInitMultiWindowWM - setjmp returned: %d. Exiting.\n",
- iReturn);
- pthread_exit (NULL);
+ /* Check if we should continue operations */
+ if (iReturn != WIN_JMP_ERROR_IO && iReturn != WIN_JMP_OKAY) {
+ /* setjmp returned an unknown value, exit */
+ ErrorF("winInitMultiWindowWM - setjmp returned: %d. Exiting.\n",
+ iReturn);
+ pthread_exit(NULL);
}
- else if (iReturn == WIN_JMP_ERROR_IO)
- {
- ErrorF ("winInitMultiWindowWM - Caught IO Error. Exiting.\n");
- pthread_exit (NULL);
+ else if (iReturn == WIN_JMP_ERROR_IO) {
+ ErrorF("winInitMultiWindowWM - Caught IO Error. Exiting.\n");
+ pthread_exit(NULL);
}
- /* Setup the display connection string x */
- winGetDisplayName(pszDisplay, (int)pProcArg->dwScreen);
-
- /* Print the display connection string */
- winDebug ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
-
- /* Use our generated cookie for authentication */
- winSetAuthorization();
-
- /* Open the X display */
- do
- {
- /* Try to open the display */
- pWMInfo->pDisplay = XOpenDisplay (pszDisplay);
- if (pWMInfo->pDisplay == NULL)
- {
- ErrorF ("winInitMultiWindowWM - Could not open display, try: %d, "
- "sleeping: %d\n",
- iRetries + 1, WIN_CONNECT_DELAY);
- ++iRetries;
- sleep (WIN_CONNECT_DELAY);
- continue;
- }
- else
- break;
+ /* Setup the display connection string x */
+ winGetDisplayName(pszDisplay, (int)pProcArg->dwScreen);
+
+ /* Print the display connection string */
+ winDebug ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
+
+ /* Use our generated cookie for authentication */
+ winSetAuthorization();
+
+ /* Open the X display */
+ do {
+ /* Try to open the display */
+ pWMInfo->pDisplay = XOpenDisplay(pszDisplay);
+ if (pWMInfo->pDisplay == NULL) {
+ ErrorF("winInitMultiWindowWM - Could not open display, try: %d, "
+ "sleeping: %d\n", iRetries + 1, WIN_CONNECT_DELAY);
+ ++iRetries;
+ sleep(WIN_CONNECT_DELAY);
+ continue;
+ }
+ else
+ break;
}
- while (pWMInfo->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
-
- /* Make sure that the display opened */
- if (pWMInfo->pDisplay == NULL)
- {
- ErrorF ("winInitMultiWindowWM - Failed opening the display. "
- "Exiting.\n");
- pthread_exit (NULL);
+ while (pWMInfo->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
+
+ /* Make sure that the display opened */
+ if (pWMInfo->pDisplay == NULL) {
+ ErrorF("winInitMultiWindowWM - Failed opening the display. "
+ "Exiting.\n");
+ pthread_exit(NULL);
}
- winDebug ("winInitMultiWindowWM - XOpenDisplay () returned and "
- "successfully opened the display.\n");
-
+ winDebug ("winInitMultiWindowWM - XOpenDisplay () returned and "
+ "successfully opened the display.\n");
- /* Create some atoms */
- pWMInfo->atmWmProtos = XInternAtom (pWMInfo->pDisplay,
- "WM_PROTOCOLS",
- False);
- pWMInfo->atmWmDelete = XInternAtom (pWMInfo->pDisplay,
- "WM_DELETE_WINDOW",
- False);
+ /* Create some atoms */
+ pWMInfo->atmWmProtos = XInternAtom(pWMInfo->pDisplay,
+ "WM_PROTOCOLS", False);
+ pWMInfo->atmWmDelete = XInternAtom(pWMInfo->pDisplay,
+ "WM_DELETE_WINDOW", False);
- pWMInfo->atmPrivMap = XInternAtom (pWMInfo->pDisplay,
- WINDOWSWM_NATIVE_HWND,
- False);
+ pWMInfo->atmPrivMap = XInternAtom(pWMInfo->pDisplay,
+ WINDOWSWM_NATIVE_HWND, False);
+ if (1) {
+ Cursor cursor = XCreateFontCursor(pWMInfo->pDisplay, XC_left_ptr);
- if (1) {
- Cursor cursor = XCreateFontCursor (pWMInfo->pDisplay, XC_left_ptr);
- if (cursor)
- {
- XDefineCursor (pWMInfo->pDisplay, DefaultRootWindow(pWMInfo->pDisplay), cursor);
- XFreeCursor (pWMInfo->pDisplay, cursor);
+ if (cursor) {
+ XDefineCursor(pWMInfo->pDisplay,
+ DefaultRootWindow(pWMInfo->pDisplay), cursor);
+ XFreeCursor(pWMInfo->pDisplay, cursor);
+ }
}
- }
}
-
/*
* winSendMessageToWM - Send a message from the X thread to the WM thread
*/
void
-winSendMessageToWM (void *pWMInfo, winWMMessagePtr pMsg)
+winSendMessageToWM(void *pWMInfo, winWMMessagePtr pMsg)
{
- WMMsgNodePtr pNode;
-
- winDebug ("winSendMessageToWM ()\n");
-
- pNode = (WMMsgNodePtr)malloc(sizeof(WMMsgNodeRec));
- if (pNode != NULL)
- {
- memcpy (&pNode->msg, pMsg, sizeof(winWMMessageRec));
- PushMessage (&((WMInfoPtr)pWMInfo)->wmMsgQueue, pNode);
+ WMMsgNodePtr pNode;
+
+ winDebug ("winSendMessageToWM ()\n");
+
+ pNode = (WMMsgNodePtr) malloc(sizeof(WMMsgNodeRec));
+ if (pNode != NULL) {
+ memcpy(&pNode->msg, pMsg, sizeof(winWMMessageRec));
+ PushMessage(&((WMInfoPtr) pWMInfo)->wmMsgQueue, pNode);
}
}
-
/*
* Window manager error handler
*/
static int
-winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr)
+winMultiWindowWMErrorHandler(Display * pDisplay, XErrorEvent * pErr)
{
- char pszErrorMsg[100];
+ char pszErrorMsg[100];
- if (pErr->request_code == X_ChangeWindowAttributes
- && pErr->error_code == BadAccess)
- {
- ErrorF ("winMultiWindowWMErrorHandler - ChangeWindowAttributes "
- "BadAccess.\n");
- return 0;
+ if (pErr->request_code == X_ChangeWindowAttributes
+ && pErr->error_code == BadAccess) {
+ ErrorF("winMultiWindowWMErrorHandler - ChangeWindowAttributes "
+ "BadAccess.\n");
+ return 0;
}
-
- XGetErrorText (pDisplay,
- pErr->error_code,
- pszErrorMsg,
- sizeof (pszErrorMsg));
- ErrorF ("winMultiWindowWMErrorHandler - ERROR: %s\n"
- " errorCode %d\n"
- " serial %d\n"
- " resourceID 0x%x\n"
- " majorCode %d\n"
- " minorCode %d\n"
- , pszErrorMsg
- , pErr->error_code
- , pErr->serial
- , pErr->resourceid
- , pErr->request_code
- , pErr->minor_code);
-
- return 0;
-}
+ XGetErrorText(pDisplay, pErr->error_code, pszErrorMsg, sizeof(pszErrorMsg));
+ ErrorF ("winMultiWindowWMErrorHandler - ERROR: %s\n"
+ " errorCode %d\n"
+ " serial %d\n"
+ " resourceID 0x%x\n"
+ " majorCode %d\n"
+ " minorCode %d\n"
+ , pszErrorMsg
+ , pErr->error_code
+ , pErr->serial
+ , pErr->resourceid
+ , pErr->request_code
+ , pErr->minor_code);
+
+ return 0;
+}
/*
* Window manager IO error handler
*/
static int
-winMultiWindowWMIOErrorHandler (Display *pDisplay)
+winMultiWindowWMIOErrorHandler(Display * pDisplay)
{
- ErrorF ("winMultiWindowWMIOErrorHandler!\n\n");
+ ErrorF("winMultiWindowWMIOErrorHandler!\n\n");
- if (pthread_equal(pthread_self(),g_winMultiWindowWMThread))
- {
- if (g_shutdown)
- pthread_exit(NULL);
+ if (pthread_equal(pthread_self(), g_winMultiWindowWMThread)) {
+ if (g_shutdown)
+ pthread_exit(NULL);
- /* Restart at the main entry point */
- longjmp (g_jmpWMEntry, WIN_JMP_ERROR_IO);
+ /* Restart at the main entry point */
+ longjmp(g_jmpWMEntry, WIN_JMP_ERROR_IO);
}
- if (g_winMultiWindowWMOldIOErrorHandler)
- g_winMultiWindowWMOldIOErrorHandler(pDisplay);
+ if (g_winMultiWindowWMOldIOErrorHandler)
+ g_winMultiWindowWMOldIOErrorHandler(pDisplay);
- return 0;
+ return 0;
}
-
/*
* X message procedure error handler
*/
static int
-winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr)
+winMultiWindowXMsgProcErrorHandler(Display * pDisplay, XErrorEvent * pErr)
{
- char pszErrorMsg[100];
-
- XGetErrorText (pDisplay,
- pErr->error_code,
- pszErrorMsg,
- sizeof (pszErrorMsg));
- ErrorF ("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n"
- " errorCode %d\n"
- " serial %d\n"
- " resourceID 0x%x\n"
- " majorCode %d\n"
- " minorCode %d\n"
- , pszErrorMsg
- , pErr->error_code
- , pErr->serial
- , pErr->resourceid
- , pErr->request_code
- , pErr->minor_code);
-
- return 0;
+ char pszErrorMsg[100];
+
+ XGetErrorText(pDisplay, pErr->error_code, pszErrorMsg, sizeof(pszErrorMsg));
+ ErrorF ("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n"
+ " errorCode %d\n"
+ " serial %d\n"
+ " resourceID 0x%x\n"
+ " majorCode %d\n"
+ " minorCode %d\n"
+ , pszErrorMsg
+ , pErr->error_code
+ , pErr->serial
+ , pErr->resourceid
+ , pErr->request_code
+ , pErr->minor_code);
+
+ return 0;
}
-
/*
* X message procedure IO error handler
*/
static int
-winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay)
+winMultiWindowXMsgProcIOErrorHandler(Display * pDisplay)
{
- ErrorF ("winMultiWindowXMsgProcIOErrorHandler!\n\n");
+ ErrorF("winMultiWindowXMsgProcIOErrorHandler!\n\n");
- if (pthread_equal(pthread_self(),g_winMultiWindowXMsgProcThread))
- {
- /* Restart at the main entry point */
- longjmp (g_jmpXMsgProcEntry, WIN_JMP_ERROR_IO);
+ if (pthread_equal(pthread_self(), g_winMultiWindowXMsgProcThread)) {
+ /* Restart at the main entry point */
+ longjmp(g_jmpXMsgProcEntry, WIN_JMP_ERROR_IO);
}
- if (g_winMultiWindowXMsgProcOldIOErrorHandler)
- g_winMultiWindowXMsgProcOldIOErrorHandler(pDisplay);
+ if (g_winMultiWindowXMsgProcOldIOErrorHandler)
+ g_winMultiWindowXMsgProcOldIOErrorHandler(pDisplay);
- return 0;
+ return 0;
}
/*
@@ -1478,47 +1354,48 @@ winMultiWindowThreadExit(void *arg)
/* multiwindow client thread has exited, stop server as well */
TerminateProcess(GetCurrentProcess(),1);
}
-
/*
* Catch RedirectError to detect other window manager running
*/
static int
-winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr)
+winRedirectErrorHandler(Display * pDisplay, XErrorEvent * pErr)
{
- redirectError = TRUE;
- return 0;
+ redirectError = TRUE;
+ return 0;
}
-
/*
* Check if another window manager is running
*/
static Bool
-CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen, Bool fAllowOtherWM)
+CheckAnotherWindowManager(Display * pDisplay, DWORD dwScreen,
+ Bool fAllowOtherWM)
{
- /*
- Try to select the events which only one client at a time is allowed to select.
- If this causes an error, another window manager is already running...
- */
- redirectError = FALSE;
- XSetErrorHandler (winRedirectErrorHandler);
- XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
- ResizeRedirectMask | SubstructureRedirectMask | ButtonPressMask);
- XSync (pDisplay, 0);
- XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
-
- /*
- Side effect: select the events we are actually interested in...
-
- If other WMs are not allowed, also select one of the events which only one client
- at a time is allowed to select, so other window managers won't start...
- */
- XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
- SubstructureNotifyMask | ( !fAllowOtherWM ? ButtonPressMask : 0));
- XSync (pDisplay, 0);
- return redirectError;
+ /*
+ Try to select the events which only one client at a time is allowed to select.
+ If this causes an error, another window manager is already running...
+ */
+ redirectError = FALSE;
+ XSetErrorHandler(winRedirectErrorHandler);
+ XSelectInput(pDisplay, RootWindow(pDisplay, dwScreen),
+ ResizeRedirectMask | SubstructureRedirectMask |
+ ButtonPressMask);
+ XSync(pDisplay, 0);
+ XSetErrorHandler(winMultiWindowXMsgProcErrorHandler);
+
+ /*
+ Side effect: select the events we are actually interested in...
+
+ If other WMs are not allowed, also select one of the events which only one client
+ at a time is allowed to select, so other window managers won't start...
+ */
+ XSelectInput(pDisplay, RootWindow(pDisplay, dwScreen),
+ SubstructureNotifyMask | (!fAllowOtherWM ? ButtonPressMask :
+ 0));
+ XSync(pDisplay, 0);
+ return redirectError;
}
/*
@@ -1526,10 +1403,10 @@ CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen, Bool fAllowOtherWM
*/
void
-winDeinitMultiWindowWM (void)
+winDeinitMultiWindowWM(void)
{
- winDebug ("winDeinitMultiWindowWM - Noting shutdown in progress\n");
- g_shutdown = TRUE;
+ winDebug ("winDeinitMultiWindowWM - Noting shutdown in progress\n");
+ g_shutdown = TRUE;
}
/* Windows window styles */
@@ -1545,254 +1422,276 @@ winDeinitMultiWindowWM (void)
#define HINT_MIN (1L<<1)
static void
-winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
+winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
{
- static Atom windowState, motif_wm_hints, windowType;
- static Atom hiddenState, fullscreenState, belowState, aboveState;
- static Atom dockWindow;
- static int generation;
- Atom type, *pAtom = NULL;
- int format;
- unsigned long hint = 0, maxmin = 0, style, nitems = 0 , left = 0;
+ static Atom windowState, motif_wm_hints, windowType;
+ static Atom hiddenState, fullscreenState, belowState, aboveState;
+ static Atom dockWindow;
+ static int generation;
+ Atom type, *pAtom = NULL;
+ int format;
+ unsigned long hint = 0, maxmin = 0, style, nitems = 0, left = 0;
WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP);
- MwmHints *mwm_hint = NULL;
+ MwmHints *mwm_hint = NULL;
WinXSizeHints SizeHints;
- if (!hWnd) return;
- if (!IsWindow (hWnd)) return;
-
- if (generation != serverGeneration) {
- generation = serverGeneration;
- windowState = XInternAtom(pDisplay, "_NET_WM_STATE", False);
- motif_wm_hints = XInternAtom(pDisplay, "_MOTIF_WM_HINTS", False);
- windowType = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE", False);
- hiddenState = XInternAtom(pDisplay, "_NET_WM_STATE_HIDDEN", False);
- fullscreenState = XInternAtom(pDisplay, "_NET_WM_STATE_FULLSCREEN", False);
- belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False);
- aboveState = XInternAtom(pDisplay, "_NET_WM_STATE_ABOVE", False);
- dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False);
- }
-
- if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
- 1L, False, XA_ATOM, &type, &format,
- &nitems, &left, (unsigned char **)&pAtom) == Success)
- {
- if (pAtom && nitems == 1)
- {
- if (*pAtom == hiddenState) maxmin |= HINT_MIN;
- else if (*pAtom == fullscreenState) maxmin |= HINT_MAX;
- if (*pAtom == belowState) *zstyle = HWND_BOTTOM;
- else if (*pAtom == aboveState) *zstyle = HWND_TOPMOST;
+ if (!hWnd)
+ return;
+ if (!IsWindow(hWnd))
+ return;
+
+ if (generation != serverGeneration) {
+ generation = serverGeneration;
+ windowState = XInternAtom(pDisplay, "_NET_WM_STATE", False);
+ motif_wm_hints = XInternAtom(pDisplay, "_MOTIF_WM_HINTS", False);
+ windowType = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE", False);
+ hiddenState = XInternAtom(pDisplay, "_NET_WM_STATE_HIDDEN", False);
+ fullscreenState =
+ XInternAtom(pDisplay, "_NET_WM_STATE_FULLSCREEN", False);
+ belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False);
+ aboveState = XInternAtom(pDisplay, "_NET_WM_STATE_ABOVE", False);
+ dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False);
}
- if (pAtom) XFree(pAtom);
- }
-
- nitems = left = 0;
- if (XGetWindowProperty(pDisplay, iWindow, motif_wm_hints, 0L,
- PropMwmHintsElements, False, motif_wm_hints, &type, &format,
- &nitems, &left, (unsigned char **)&mwm_hint) == Success)
- {
- if (mwm_hint && nitems == PropMwmHintsElements && (mwm_hint->flags & MwmHintsDecorations))
- {
- if (!mwm_hint->decorations) hint |= HINT_NOFRAME;
- else if (!(mwm_hint->decorations & MwmDecorAll))
- {
- if (mwm_hint->decorations & MwmDecorBorder) hint |= HINT_BORDER;
- if (mwm_hint->decorations & MwmDecorHandle) hint |= HINT_SIZEBOX;
- if (mwm_hint->decorations & MwmDecorTitle) hint |= HINT_CAPTION;
- if (!(mwm_hint->decorations & MwmDecorMenu)) hint |= HINT_NOSYSMENU;
- if (!(mwm_hint->decorations & MwmDecorMinimize)) hint |= HINT_NOMINIMIZE;
- if (!(mwm_hint->decorations & MwmDecorMaximize)) hint |= HINT_NOMAXIMIZE;
- }
- else
- {
- /*
- MwmDecorAll means all decorations *except* those specified by other flag
- bits that are set. Not yet implemented.
- */
- }
+
+ if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
+ 1L, False, XA_ATOM, &type, &format,
+ &nitems, &left,
+ (unsigned char **) &pAtom) == Success) {
+ if (pAtom && nitems == 1) {
+ if (*pAtom == hiddenState)
+ maxmin |= HINT_MIN;
+ else if (*pAtom == fullscreenState)
+ maxmin |= HINT_MAX;
+ if (*pAtom == belowState)
+ *zstyle = HWND_BOTTOM;
+ else if (*pAtom == aboveState)
+ *zstyle = HWND_TOPMOST;
+ }
+ if (pAtom)
+ XFree(pAtom);
}
- if (mwm_hint) XFree(mwm_hint);
- }
-
- nitems = left = 0;
- pAtom = NULL;
- if (XGetWindowProperty(pDisplay, iWindow, windowType, 0L,
- 1L, False, XA_ATOM, &type, &format,
- &nitems, &left, (unsigned char **)&pAtom) == Success)
- {
- if (pAtom && nitems == 1)
+
+ nitems = left = 0;
+ if (XGetWindowProperty(pDisplay, iWindow, motif_wm_hints, 0L,
+ PropMwmHintsElements, False, motif_wm_hints, &type,
+ &format, &nitems, &left,
+ (unsigned char **) &mwm_hint) == Success) {
+ if (mwm_hint && nitems == PropMwmHintsElements &&
+ (mwm_hint->flags & MwmHintsDecorations)) {
+ if (!mwm_hint->decorations)
+ hint |= HINT_NOFRAME;
+ else if (!(mwm_hint->decorations & MwmDecorAll)) {
+ if (mwm_hint->decorations & MwmDecorBorder)
+ hint |= HINT_BORDER;
+ if (mwm_hint->decorations & MwmDecorHandle)
+ hint |= HINT_SIZEBOX;
+ if (mwm_hint->decorations & MwmDecorTitle)
+ hint |= HINT_CAPTION;
+ if (!(mwm_hint->decorations & MwmDecorMenu))
+ hint |= HINT_NOSYSMENU;
+ if (!(mwm_hint->decorations & MwmDecorMinimize))
+ hint |= HINT_NOMINIMIZE;
+ if (!(mwm_hint->decorations & MwmDecorMaximize))
+ hint |= HINT_NOMAXIMIZE;
+ }
+ else {
+ /*
+ MwmDecorAll means all decorations *except* those specified by other flag
+ bits that are set. Not yet implemented.
+ */
+ }
+ }
+ if (mwm_hint)
+ XFree(mwm_hint);
+ }
+
+ nitems = left = 0;
+ pAtom = NULL;
+ if (XGetWindowProperty(pDisplay, iWindow, windowType, 0L,
+ 1L, False, XA_ATOM, &type, &format,
+ &nitems, &left,
+ (unsigned char **) &pAtom) == Success) {
+ if (pAtom && nitems == 1) {
+ if (*pAtom == dockWindow) {
+ hint = (hint & ~HINT_NOFRAME) | HINT_SIZEBOX; /* Xming puts a sizebox on dock windows */
+ *zstyle = HWND_TOPMOST;
+ }
+ }
+ if (pAtom)
+ XFree(pAtom);
+ }
+
{
- if (*pAtom == dockWindow)
- {
- hint = (hint & ~HINT_NOFRAME) | HINT_SIZEBOX; /* Xming puts a sizebox on dock windows */
- *zstyle = HWND_TOPMOST;
- }
+ XSizeHints *normal_hint = XAllocSizeHints();
+ long supplied;
+
+ if (normal_hint &&
+ (XGetWMNormalHints(pDisplay, iWindow, normal_hint, &supplied) ==
+ Success)) {
+ if (normal_hint->flags & PMaxSize) {
+ /* Not maximizable if a maximum size is specified */
+ hint |= HINT_NOMAXIMIZE;
+
+ if (normal_hint->flags & PMinSize) {
+ /*
+ If both minimum size and maximum size are specified and are the same,
+ don't bother with a resizing frame
+ */
+ if ((normal_hint->min_width == normal_hint->max_width)
+ && (normal_hint->min_height == normal_hint->max_height))
+ hint = (hint & ~HINT_SIZEBOX);
+ }
+ }
+ }
+ XFree(normal_hint);
}
- if (pAtom) XFree(pAtom);
- }
-
- {
- XSizeHints *normal_hint = XAllocSizeHints();
- long supplied;
- if (normal_hint && (XGetWMNormalHints(pDisplay, iWindow, normal_hint, &supplied) == Success))
- {
- if (normal_hint->flags & PMaxSize)
- {
- /* Not maximizable if a maximum size is specified */
- hint |= HINT_NOMAXIMIZE;
-
- if (normal_hint->flags & PMinSize)
- {
- /*
- If both minimum size and maximum size are specified and are the same,
- don't bother with a resizing frame
- */
- if ((normal_hint->min_width == normal_hint->max_width)
- && (normal_hint->min_height == normal_hint->max_height))
- hint = (hint & ~HINT_SIZEBOX);
- }
- }
- }
- XFree(normal_hint);
- }
-
- /* Override hint settings from above with settings from config file */
- {
- XClassHint class_hint = {0,0};
-
- if (XGetClassHint(pDisplay, iWindow, &class_hint))
- {
- char *window_name = 0;
- char *application_id = 0;
- XFetchName(pDisplay, iWindow, &window_name);
-
- style = winOverrideStyle(class_hint.res_name, class_hint.res_class, window_name);
+
+ /* Override hint settings from above with settings from config file */
+ {
+ XClassHint class_hint = { 0, 0 };
+
+ if (XGetClassHint(pDisplay, iWindow, &class_hint)) {
+ char *window_name = 0;
+ char *application_id = 0;
+ XFetchName(pDisplay, iWindow, &window_name);
+
+ style =
+ winOverrideStyle(class_hint.res_name, class_hint.res_class,
+ window_name);
#define APPLICATION_ID_FORMAT "%s.vcxsrv.%s"
#define APPLICATION_ID_UNKNOWN "unknown"
- if (class_hint.res_class)
- {
- asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, class_hint.res_class);
- }
- else
- {
- asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, APPLICATION_ID_UNKNOWN);
- }
- winSetAppID (hWnd, application_id);
-
- if (class_hint.res_name) XFree(class_hint.res_name);
- if (class_hint.res_class) XFree(class_hint.res_class);
- if (application_id) free(application_id);
- if (window_name) XFree(window_name);
- }
- else
- {
- style = STYLE_NONE;
- }
- }
-
- if (style & STYLE_TOPMOST) *zstyle = HWND_TOPMOST;
- else if (style & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX;
- else if (style & STYLE_MINIMIZE) maxmin = (hint & ~HINT_MAX) | HINT_MIN;
- else if (style & STYLE_BOTTOM) *zstyle = HWND_BOTTOM;
-
- if (maxmin & HINT_MAX) SendMessage(hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
- else if (maxmin & HINT_MIN) SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
-
- if (style & STYLE_NOTITLE)
- hint = (hint & ~HINT_NOFRAME & ~HINT_BORDER & ~HINT_CAPTION) | HINT_SIZEBOX;
- else if (style & STYLE_OUTLINE)
- hint = (hint & ~HINT_NOFRAME & ~HINT_CAPTION) | HINT_BORDER;
- else if (style & STYLE_NOFRAME)
- hint = (hint & ~HINT_BORDER & ~HINT_CAPTION) | HINT_NOFRAME;
-
- /* Now apply styles to window */
- style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */
- if (!hint) /* All on, but no resize of children is allowed */
- style = style | WS_CAPTION;
- else if (hint & HINT_NOFRAME) /* All off */
- style = style & ~WS_CAPTION & ~WS_SIZEBOX;
- else style = style | ((hint & HINT_BORDER) ? WS_BORDER : 0) |
- ((hint & HINT_SIZEBOX) ? WS_SIZEBOX : 0) |
- ((hint & HINT_CAPTION) ? WS_CAPTION : 0);
-
- if (hint & HINT_NOMAXIMIZE)
- style = style & ~WS_MAXIMIZEBOX;
-
- if (hint & HINT_NOMINIMIZE)
- style = style & ~WS_MINIMIZEBOX;
-
- if (hint & HINT_NOSYSMENU)
- style = style & ~WS_SYSMENU;
-
- if (!IsWindow (hWnd))
- {
- ErrorF("Windows window 0x%x has become invalid, so returning without applying hints\n",hWnd);
- return;
- }
-
- if (winMultiWindowGetWMNormalHints(pWin, &SizeHints))
- {
- if (!(SizeHints.max_width&&SizeHints.max_height&&(SizeHints.min_width == SizeHints.max_width)&&(SizeHints.min_height == SizeHints.max_height) ))
- style|=WS_SIZEBOX;
- }
- else
- style|=WS_SIZEBOX;
- SetWindowLongPtr (hWnd, GWL_STYLE, style);
-}
-
-void
-winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle)
-{
- int iX, iY, iWidth, iHeight;
- int iDx, iDy;
- RECT rcNew;
- WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP);
- DrawablePtr pDraw = NULL;
+ if (class_hint.res_class)
+ {
+ asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, class_hint.res_class);
+ }
+ else
+ {
+ asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, APPLICATION_ID_UNKNOWN);
+ }
+ winSetAppID (hWnd, application_id);
- if (!pWin) return;
- pDraw = &pWin->drawable;
- if (!pDraw) return;
+ if (class_hint.res_name) XFree(class_hint.res_name);
+ if (class_hint.res_class) XFree(class_hint.res_class);
+ if (application_id) free(application_id);
+ if (window_name) XFree(window_name);
+ }
+ else {
+ style = STYLE_NONE;
+ }
+ }
- /* Get the X and Y location of the X window */
- iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
- iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+ if (style & STYLE_TOPMOST)
+ *zstyle = HWND_TOPMOST;
+ else if (style & STYLE_MAXIMIZE)
+ maxmin = (hint & ~HINT_MIN) | HINT_MAX;
+ else if (style & STYLE_MINIMIZE)
+ maxmin = (hint & ~HINT_MAX) | HINT_MIN;
+ else if (style & STYLE_BOTTOM)
+ *zstyle = HWND_BOTTOM;
+
+ if (maxmin & HINT_MAX)
+ SendMessage(hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
+ else if (maxmin & HINT_MIN)
+ SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+
+ if (style & STYLE_NOTITLE)
+ hint =
+ (hint & ~HINT_NOFRAME & ~HINT_BORDER & ~HINT_CAPTION) |
+ HINT_SIZEBOX;
+ else if (style & STYLE_OUTLINE)
+ hint =
+ (hint & ~HINT_NOFRAME & ~HINT_CAPTION) | HINT_BORDER;
+ else if (style & STYLE_NOFRAME)
+ hint =
+ (hint & ~HINT_BORDER & ~HINT_CAPTION) | HINT_NOFRAME;
+
+ /* Now apply styles to window */
+ style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */
+ if (!hint) /* All on, but no resize of children is allowed */
+ style = style | WS_CAPTION;
+ else if (hint & HINT_NOFRAME) /* All off */
+ style = style & ~WS_CAPTION & ~WS_SIZEBOX;
+ else
+ style = style | ((hint & HINT_BORDER) ? WS_BORDER : 0) |
+ ((hint & HINT_SIZEBOX) ? WS_SIZEBOX : 0) |
+ ((hint & HINT_CAPTION) ? WS_CAPTION : 0);
- /* Get the height and width of the X window */
- iWidth = pWin->drawable.width;
- iHeight = pWin->drawable.height;
+ if (hint & HINT_NOMAXIMIZE)
+ style = style & ~WS_MAXIMIZEBOX;
- /* Setup a rectangle with the X window position and size */
- SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
+ if (hint & HINT_NOMINIMIZE)
+ style = style & ~WS_MINIMIZEBOX;
- AdjustWindowRectEx (&rcNew, GetWindowLongPtr (hWnd, GWL_STYLE), FALSE, WS_EX_APPWINDOW);
+ if (hint & HINT_NOSYSMENU)
+ style = style & ~WS_SYSMENU;
- /* Don't allow window decoration to disappear off to top-left as a result of this adjustment */
- if (rcNew.left < GetSystemMetrics(SM_XVIRTUALSCREEN))
+ if (!IsWindow (hWnd))
{
- iDx = GetSystemMetrics(SM_XVIRTUALSCREEN) - rcNew.left;
- rcNew.left += iDx;
- rcNew.right += iDx;
+ ErrorF("Windows window 0x%x has become invalid, so returning without applying hints\n",hWnd);
+ return;
}
-
- if (rcNew.top < GetSystemMetrics(SM_YVIRTUALSCREEN))
+
+ if (winMultiWindowGetWMNormalHints(pWin, &SizeHints))
{
- iDy = GetSystemMetrics(SM_YVIRTUALSCREEN) - rcNew.top;
- rcNew.top += iDy;
- rcNew.bottom += iDy;
+ if (!(SizeHints.max_width&&SizeHints.max_height&&(SizeHints.min_width == SizeHints.max_width)&&(SizeHints.min_height == SizeHints.max_height) ))
+ style|=WS_SIZEBOX;
}
+ else
+ style|=WS_SIZEBOX;
+ SetWindowLongPtr(hWnd, GWL_STYLE, style);
+}
- /* Position the Windows window */
- SetWindowPos (hWnd, *zstyle, rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
- 0);
+void
+winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle)
+{
+ int iX, iY, iWidth, iHeight;
+ int iDx, iDy;
+ RECT rcNew;
+ WindowPtr pWin = GetProp(hWnd, WIN_WINDOW_PROP);
+ DrawablePtr pDraw = NULL;
+
+ if (!pWin)
+ return;
+ pDraw = &pWin->drawable;
+ if (!pDraw)
+ return;
+
+ /* Get the X and Y location of the X window */
+ iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ /* Get the height and width of the X window */
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
+ /* Setup a rectangle with the X window position and size */
+ SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight);
+
+ AdjustWindowRectEx(&rcNew, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE,
+ WS_EX_APPWINDOW);
+
+ /* Don't allow window decoration to disappear off to top-left as a result of this adjustment */
+ if (rcNew.left < GetSystemMetrics(SM_XVIRTUALSCREEN)) {
+ iDx = GetSystemMetrics(SM_XVIRTUALSCREEN) - rcNew.left;
+ rcNew.left += iDx;
+ rcNew.right += iDx;
+ }
- if (reshape)
- {
- winReshapeMultiWindow(pWin);
- winUpdateRgnMultiWindow(pWin);
- }
+ if (rcNew.top < GetSystemMetrics(SM_YVIRTUALSCREEN)) {
+ iDy = GetSystemMetrics(SM_YVIRTUALSCREEN) - rcNew.top;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
+ }
+
+ /* Position the Windows window */
+ SetWindowPos(hWnd, *zstyle, rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, 0);
+
+ if (reshape) {
+ winReshapeMultiWindow(pWin);
+ winUpdateRgnMultiWindow(pWin);
+ }
}
void
diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c
index ff66b602f..c124f86ba 100644
--- a/xorg-server/hw/xwin/winmultiwindowwndproc.c
+++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c
@@ -53,15 +53,13 @@
#include <xkbsrv.h>
#endif
-extern void winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle);
-
+extern void winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle);
/*
* Local globals
*/
-static UINT_PTR g_uipMousePollingTimerID = 0;
-
+static UINT_PTR g_uipMousePollingTimerID = 0;
/*
* Constant defines
@@ -69,244 +67,242 @@ static UINT_PTR g_uipMousePollingTimerID = 0;
#define WIN_MULTIWINDOW_SHAPE YES
-
/*
* ConstrainSize - Taken from TWM sources - Respects hints for sizing
*/
#define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) )
static void
-ConstrainSize (WinXSizeHints hints, int *widthp, int *heightp)
+ConstrainSize(WinXSizeHints hints, int *widthp, int *heightp)
{
- int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta;
- int baseWidth, baseHeight;
- int dwidth = *widthp, dheight = *heightp;
-
- if (hints.flags & PMinSize)
- {
- minWidth = hints.min_width;
- minHeight = hints.min_height;
+ int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta;
+ int baseWidth, baseHeight;
+ int dwidth = *widthp, dheight = *heightp;
+
+ if (hints.flags & PMinSize) {
+ minWidth = hints.min_width;
+ minHeight = hints.min_height;
}
- else if (hints.flags & PBaseSize)
- {
- minWidth = hints.base_width;
- minHeight = hints.base_height;
+ else if (hints.flags & PBaseSize) {
+ minWidth = hints.base_width;
+ minHeight = hints.base_height;
}
- else
- minWidth = minHeight = 1;
-
- if (hints.flags & PBaseSize)
- {
- baseWidth = hints.base_width;
- baseHeight = hints.base_height;
- }
- else if (hints.flags & PMinSize)
- {
- baseWidth = hints.min_width;
- baseHeight = hints.min_height;
+ else
+ minWidth = minHeight = 1;
+
+ if (hints.flags & PBaseSize) {
+ baseWidth = hints.base_width;
+ baseHeight = hints.base_height;
}
- else
- baseWidth = baseHeight = 0;
+ else if (hints.flags & PMinSize) {
+ baseWidth = hints.min_width;
+ baseHeight = hints.min_height;
+ }
+ else
+ baseWidth = baseHeight = 0;
- if (hints.flags & PMaxSize)
- {
- maxWidth = hints.max_width;
- maxHeight = hints.max_height;
+ if (hints.flags & PMaxSize) {
+ maxWidth = hints.max_width;
+ maxHeight = hints.max_height;
}
- else
- {
- maxWidth = MAXINT;
- maxHeight = MAXINT;
+ else {
+ maxWidth = MAXINT;
+ maxHeight = MAXINT;
}
- if (hints.flags & PResizeInc)
- {
- xinc = hints.width_inc;
- yinc = hints.height_inc;
+ if (hints.flags & PResizeInc) {
+ xinc = hints.width_inc;
+ yinc = hints.height_inc;
}
- else
- xinc = yinc = 1;
-
- /*
- * First, clamp to min and max values
- */
- if (dwidth < minWidth)
- dwidth = minWidth;
- if (dheight < minHeight)
- dheight = minHeight;
-
- if (dwidth > maxWidth)
- dwidth = maxWidth;
- if (dheight > maxHeight)
- dheight = maxHeight;
-
- /*
- * Second, fit to base + N * inc
- */
- dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth;
- dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight;
-
- /*
- * Third, adjust for aspect ratio
- */
-
- /*
- * The math looks like this:
- *
- * minAspectX dwidth maxAspectX
- * ---------- <= ------- <= ----------
- * minAspectY dheight maxAspectY
- *
- * If that is multiplied out, then the width and height are
- * invalid in the following situations:
- *
- * minAspectX * dheight > minAspectY * dwidth
- * maxAspectX * dheight < maxAspectY * dwidth
- *
- */
-
- if (hints.flags & PAspect)
- {
- if (hints.min_aspect.x * dheight > hints.min_aspect.y * dwidth)
- {
- delta = makemult(hints.min_aspect.x * dheight / hints.min_aspect.y - dwidth, xinc);
- if (dwidth + delta <= maxWidth)
- dwidth += delta;
- else
- {
- delta = makemult(dheight - dwidth*hints.min_aspect.y/hints.min_aspect.x, yinc);
- if (dheight - delta >= minHeight)
- dheight -= delta;
+ else
+ xinc = yinc = 1;
+
+ /*
+ * First, clamp to min and max values
+ */
+ if (dwidth < minWidth)
+ dwidth = minWidth;
+ if (dheight < minHeight)
+ dheight = minHeight;
+
+ if (dwidth > maxWidth)
+ dwidth = maxWidth;
+ if (dheight > maxHeight)
+ dheight = maxHeight;
+
+ /*
+ * Second, fit to base + N * inc
+ */
+ dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth;
+ dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight;
+
+ /*
+ * Third, adjust for aspect ratio
+ */
+
+ /*
+ * The math looks like this:
+ *
+ * minAspectX dwidth maxAspectX
+ * ---------- <= ------- <= ----------
+ * minAspectY dheight maxAspectY
+ *
+ * If that is multiplied out, then the width and height are
+ * invalid in the following situations:
+ *
+ * minAspectX * dheight > minAspectY * dwidth
+ * maxAspectX * dheight < maxAspectY * dwidth
+ *
+ */
+
+ if (hints.flags & PAspect) {
+ if (hints.min_aspect.x * dheight > hints.min_aspect.y * dwidth) {
+ delta =
+ makemult(hints.min_aspect.x * dheight / hints.min_aspect.y -
+ dwidth, xinc);
+ if (dwidth + delta <= maxWidth)
+ dwidth += delta;
+ else {
+ delta =
+ makemult(dheight -
+ dwidth * hints.min_aspect.y / hints.min_aspect.x,
+ yinc);
+ if (dheight - delta >= minHeight)
+ dheight -= delta;
}
}
-
- if (hints.max_aspect.x * dheight < hints.max_aspect.y * dwidth)
- {
- delta = makemult(dwidth * hints.max_aspect.y / hints.max_aspect.x - dheight, yinc);
- if (dheight + delta <= maxHeight)
- dheight += delta;
- else
- {
- delta = makemult(dwidth - hints.max_aspect.x*dheight/hints.max_aspect.y, xinc);
- if (dwidth - delta >= minWidth)
- dwidth -= delta;
+
+ if (hints.max_aspect.x * dheight < hints.max_aspect.y * dwidth) {
+ delta =
+ makemult(dwidth * hints.max_aspect.y / hints.max_aspect.x -
+ dheight, yinc);
+ if (dheight + delta <= maxHeight)
+ dheight += delta;
+ else {
+ delta =
+ makemult(dwidth -
+ hints.max_aspect.x * dheight / hints.max_aspect.y,
+ xinc);
+ if (dwidth - delta >= minWidth)
+ dwidth -= delta;
}
}
}
-
- /* Return computed values */
- *widthp = dwidth;
- *heightp = dheight;
-}
-#undef makemult
+ /* Return computed values */
+ *widthp = dwidth;
+ *heightp = dheight;
+}
+#undef makemult
/*
* ValidateSizing - Ensures size request respects hints
*/
static int
-ValidateSizing (HWND hwnd, WindowPtr pWin,
- WPARAM wParam, LPARAM lParam)
+ValidateSizing(HWND hwnd, WindowPtr pWin, WPARAM wParam, LPARAM lParam)
{
- WinXSizeHints sizeHints;
- RECT *rect;
- int iWidth, iHeight;
- RECT rcClient, rcWindow;
- int iBorderWidthX, iBorderWidthY;
-
- /* Invalid input checking */
- if (pWin==NULL || lParam==0)
- return FALSE;
-
- /* No size hints, no checking */
- if (!winMultiWindowGetWMNormalHints (pWin, &sizeHints))
- return FALSE;
-
- /* Avoid divide-by-zero */
- if (sizeHints.flags & PResizeInc)
- {
- if (sizeHints.width_inc == 0) sizeHints.width_inc = 1;
- if (sizeHints.height_inc == 0) sizeHints.height_inc = 1;
+ WinXSizeHints sizeHints;
+ RECT *rect;
+ int iWidth, iHeight;
+ RECT rcClient, rcWindow;
+ int iBorderWidthX, iBorderWidthY;
+
+ /* Invalid input checking */
+ if (pWin == NULL || lParam == 0)
+ return FALSE;
+
+ /* No size hints, no checking */
+ if (!winMultiWindowGetWMNormalHints(pWin, &sizeHints))
+ return FALSE;
+
+ /* Avoid divide-by-zero */
+ if (sizeHints.flags & PResizeInc) {
+ if (sizeHints.width_inc == 0)
+ sizeHints.width_inc = 1;
+ if (sizeHints.height_inc == 0)
+ sizeHints.height_inc = 1;
+ }
+
+ rect = (RECT *) lParam;
+
+ iWidth = rect->right - rect->left;
+ iHeight = rect->bottom - rect->top;
+
+ /* Now remove size of any borders and title bar */
+ GetClientRect(hwnd, &rcClient);
+ GetWindowRect(hwnd, &rcWindow);
+ iBorderWidthX =
+ (rcWindow.right - rcWindow.left) - (rcClient.right - rcClient.left);
+ iBorderWidthY =
+ (rcWindow.bottom - rcWindow.top) - (rcClient.bottom - rcClient.top);
+ iWidth -= iBorderWidthX;
+ iHeight -= iBorderWidthY;
+
+ /* Constrain the size to legal values */
+ ConstrainSize(sizeHints, &iWidth, &iHeight);
+
+ /* Add back the size of borders and title bar */
+ iWidth += iBorderWidthX;
+ iHeight += iBorderWidthY;
+
+ /* Adjust size according to where we're dragging from */
+ switch (wParam) {
+ case WMSZ_TOP:
+ case WMSZ_TOPRIGHT:
+ case WMSZ_BOTTOM:
+ case WMSZ_BOTTOMRIGHT:
+ case WMSZ_RIGHT:
+ rect->right = rect->left + iWidth;
+ break;
+ default:
+ rect->left = rect->right - iWidth;
+ break;
+ }
+ switch (wParam) {
+ case WMSZ_BOTTOM:
+ case WMSZ_BOTTOMRIGHT:
+ case WMSZ_BOTTOMLEFT:
+ case WMSZ_RIGHT:
+ case WMSZ_LEFT:
+ rect->bottom = rect->top + iHeight;
+ break;
+ default:
+ rect->top = rect->bottom - iHeight;
+ break;
}
-
- rect = (RECT*)lParam;
-
- iWidth = rect->right - rect->left;
- iHeight = rect->bottom - rect->top;
-
- /* Now remove size of any borders and title bar */
- GetClientRect(hwnd, &rcClient);
- GetWindowRect(hwnd, &rcWindow);
- iBorderWidthX = (rcWindow.right - rcWindow.left) - (rcClient.right - rcClient.left);
- iBorderWidthY = (rcWindow.bottom - rcWindow.top) - (rcClient.bottom - rcClient.top);
- iWidth -= iBorderWidthX;
- iHeight -= iBorderWidthY;
-
- /* Constrain the size to legal values */
- ConstrainSize (sizeHints, &iWidth, &iHeight);
-
- /* Add back the size of borders and title bar */
- iWidth += iBorderWidthX;
- iHeight += iBorderWidthY;
-
- /* Adjust size according to where we're dragging from */
- switch(wParam) {
- case WMSZ_TOP:
- case WMSZ_TOPRIGHT:
- case WMSZ_BOTTOM:
- case WMSZ_BOTTOMRIGHT:
- case WMSZ_RIGHT:
- rect->right = rect->left + iWidth;
- break;
- default:
- rect->left = rect->right - iWidth;
- break;
- }
- switch(wParam) {
- case WMSZ_BOTTOM:
- case WMSZ_BOTTOMRIGHT:
- case WMSZ_BOTTOMLEFT:
- case WMSZ_RIGHT:
- case WMSZ_LEFT:
- rect->bottom = rect->top + iHeight;
- break;
- default:
- rect->top = rect->bottom - iHeight;
- break;
- }
- return TRUE;
+ return TRUE;
}
extern Bool winInDestroyWindowsWindow;
static Bool winInRaiseWindow = FALSE;
-static void winRaiseWindow(WindowPtr pWin)
+static void
+winRaiseWindow(WindowPtr pWin)
{
- if (!winInDestroyWindowsWindow && !winInRaiseWindow)
- {
- BOOL oldstate = winInRaiseWindow;
- XID vlist[1] = { 0 };
- winInRaiseWindow = TRUE;
- /* Call configure window directly to make sure it gets processed
- * in time
- */
- ConfigureWindow(pWin, CWStackMode, vlist, serverClient);
- winInRaiseWindow = oldstate;
- }
+ if (!winInDestroyWindowsWindow && !winInRaiseWindow) {
+ BOOL oldstate = winInRaiseWindow;
+ XID vlist[1] = { 0 };
+ winInRaiseWindow = TRUE;
+ /* Call configure window directly to make sure it gets processed
+ * in time
+ */
+ ConfigureWindow(pWin, CWStackMode, vlist, serverClient);
+ winInRaiseWindow = oldstate;
+ }
}
static
-void winStartMousePolling(winPrivScreenPtr s_pScreenPriv)
+ void
+winStartMousePolling(winPrivScreenPtr s_pScreenPriv)
{
- /*
- * Timer to poll mouse position. This is needed to make
- * programs like xeyes follow the mouse properly when the
- * mouse pointer is outside of any X window.
- */
- if (g_uipMousePollingTimerID == 0)
- g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen,
- WIN_POLLING_MOUSE_TIMER_ID,
- MOUSE_POLLING_INTERVAL,
- NULL);
+ /*
+ * Timer to poll mouse position. This is needed to make
+ * programs like xeyes follow the mouse properly when the
+ * mouse pointer is outside of any X window.
+ */
+ if (g_uipMousePollingTimerID == 0)
+ g_uipMousePollingTimerID = SetTimer(s_pScreenPriv->hwndScreen,
+ WIN_POLLING_MOUSE_TIMER_ID,
+ MOUSE_POLLING_INTERVAL, NULL);
}
/*
@@ -314,636 +310,630 @@ void winStartMousePolling(winPrivScreenPtr s_pScreenPriv)
*/
LRESULT CALLBACK
-winTopLevelWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam)
+winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- POINT ptMouse;
- HDC hdcUpdate;
- PAINTSTRUCT ps;
- WindowPtr pWin = NULL;
- winPrivWinPtr pWinPriv = NULL;
- ScreenPtr s_pScreen = NULL;
- winPrivScreenPtr s_pScreenPriv = NULL;
- winScreenInfo *s_pScreenInfo = NULL;
- HWND hwndScreen = NULL;
- DrawablePtr pDraw = NULL;
- winWMMessageRec wmMsg;
- Bool fWMMsgInitialized = FALSE;
- static Bool s_fTracking = FALSE;
- Bool needRestack = FALSE;
- LRESULT ret;
+ POINT ptMouse;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+ WindowPtr pWin = NULL;
+ winPrivWinPtr pWinPriv = NULL;
+ ScreenPtr s_pScreen = NULL;
+ winPrivScreenPtr s_pScreenPriv = NULL;
+ winScreenInfo *s_pScreenInfo = NULL;
+ HWND hwndScreen = NULL;
+ DrawablePtr pDraw = NULL;
+ winWMMessageRec wmMsg;
+ Bool fWMMsgInitialized = FALSE;
+ static Bool s_fTracking = FALSE;
+ Bool needRestack = FALSE;
+ LRESULT ret;
static Bool hasEnteredSizeMove = FALSE;
- winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam, lParam);
-
- /* Check if the Windows window property for our X window pointer is valid */
- if ((pWin = GetProp (hwnd, WIN_WINDOW_PROP)) != NULL)
- {
- /* Our X window pointer is valid */
+ winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam,
+ lParam);
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pWin = GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) {
+ /* Our X window pointer is valid */
- /* Get pointers to the drawable and the screen */
- pDraw = &pWin->drawable;
- s_pScreen = pWin->drawable.pScreen;
+ /* Get pointers to the drawable and the screen */
+ pDraw = &pWin->drawable;
+ s_pScreen = pWin->drawable.pScreen;
- /* Get a pointer to our window privates */
- pWinPriv = winGetWindowPriv(pWin);
+ /* Get a pointer to our window privates */
+ pWinPriv = winGetWindowPriv(pWin);
- /* Get pointers to our screen privates and screen info */
- s_pScreenPriv = pWinPriv->pScreenPriv;
- s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ /* Get pointers to our screen privates and screen info */
+ s_pScreenPriv = pWinPriv->pScreenPriv;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
- /* Get the handle for our screen-sized window */
- hwndScreen = s_pScreenPriv->hwndScreen;
+ /* Get the handle for our screen-sized window */
+ hwndScreen = s_pScreenPriv->hwndScreen;
- /* */
- wmMsg.msg = 0;
- wmMsg.hwndWindow = hwnd;
- wmMsg.iWindow = (Window)GetProp (hwnd, WIN_WID_PROP);
+ /* */
+ wmMsg.msg = 0;
+ wmMsg.hwndWindow = hwnd;
+ wmMsg.iWindow = (Window) GetProp(hwnd, WIN_WID_PROP);
- wmMsg.iX = pDraw->x;
- wmMsg.iY = pDraw->y;
- wmMsg.iWidth = pDraw->width;
- wmMsg.iHeight = pDraw->height;
+ wmMsg.iX = pDraw->x;
+ wmMsg.iY = pDraw->y;
+ wmMsg.iWidth = pDraw->width;
+ wmMsg.iHeight = pDraw->height;
- fWMMsgInitialized = TRUE;
+ fWMMsgInitialized = TRUE;
}
- #ifdef _DEBUG
- else if (message!=WM_CREATE)
+ #ifdef _DEBUG
+ else if (message!=WM_CREATE)
{
- winDebug("Warning: message 0x%x received when WIN_WINDOW_PROP NULL\n",message);
+ winDebug("Warning: message 0x%x received when WIN_WINDOW_PROP NULL\n",message);
}
#endif
- /* Branch on message type */
- switch (message)
- {
+ /* Branch on message type */
+ switch (message) {
case WM_CREATE:
- /* */
- SetProp (hwnd,
- WIN_WINDOW_PROP,
- (HANDLE)((LPCREATESTRUCT) lParam)->lpCreateParams);
-
- /* */
- SetProp (hwnd,
- WIN_WID_PROP,
- (HANDLE)winGetWindowID (((LPCREATESTRUCT) lParam)->lpCreateParams));
-
- /*
- * Make X windows' Z orders sync with Windows windows because
- * there can be AlwaysOnTop windows overlapped on the window
- * currently being created.
- */
- winReorderWindowsMultiWindow ();
-
- /* Fix a 'round title bar corner background should be transparent not black' problem when first painted */
- {
- RECT rWindow;
- HRGN hRgnWindow;
- GetWindowRect(hwnd, &rWindow);
- hRgnWindow = CreateRectRgnIndirect(&rWindow);
- SetWindowRgn (hwnd, hRgnWindow, TRUE);
- }
+ /* */
+ SetProp(hwnd,
+ WIN_WINDOW_PROP,
+ (HANDLE) ((LPCREATESTRUCT) lParam)->lpCreateParams);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)VCXSRV_SIGNATURE);
+ /* */
+ SetProp(hwnd,
+ WIN_WID_PROP,
+ (HANDLE) winGetWindowID(((LPCREATESTRUCT) lParam)->
+ lpCreateParams));
- return 0;
+ /*
+ * Make X windows' Z orders sync with Windows windows because
+ * there can be AlwaysOnTop windows overlapped on the window
+ * currently being created.
+ */
+ winReorderWindowsMultiWindow();
+
+ /* Fix a 'round title bar corner background should be transparent not black' problem when first painted */
+ {
+ RECT rWindow;
+ HRGN hRgnWindow;
+
+ GetWindowRect(hwnd, &rWindow);
+ hRgnWindow = CreateRectRgnIndirect(&rWindow);
+ SetWindowRgn(hwnd, hRgnWindow, TRUE);
+ }
+
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)VCXSRV_SIGNATURE);
+
+ return 0;
case WM_INIT_SYS_MENU:
- /*
- * Add whatever the setup file wants to for this window
- */
- SetupSysMenu ((unsigned long)hwnd);
- return 0;
+ /*
+ * Add whatever the setup file wants to for this window
+ */
+ SetupSysMenu((unsigned long) hwnd);
+ return 0;
case WM_SYSCOMMAND:
- /*
- * Any window menu items go through here
- */
- if (HandleCustomWM_COMMAND ((unsigned long)hwnd, LOWORD(wParam)))
- {
- /* Don't pass customized menus to DefWindowProc */
- return 0;
- }
- if (wParam == SC_RESTORE || wParam == SC_MAXIMIZE)
- {
- WINDOWPLACEMENT wndpl;
- wndpl.length = sizeof(wndpl);
- if (GetWindowPlacement(hwnd, &wndpl) && wndpl.showCmd == SW_SHOWMINIMIZED)
- needRestack = TRUE;
- }
- break;
+ /*
+ * Any window menu items go through here
+ */
+ if (HandleCustomWM_COMMAND((unsigned long) hwnd, LOWORD(wParam))) {
+ /* Don't pass customized menus to DefWindowProc */
+ return 0;
+ }
+ if (wParam == SC_RESTORE || wParam == SC_MAXIMIZE) {
+ WINDOWPLACEMENT wndpl;
+
+ wndpl.length = sizeof(wndpl);
+ if (GetWindowPlacement(hwnd, &wndpl) &&
+ wndpl.showCmd == SW_SHOWMINIMIZED)
+ needRestack = TRUE;
+ }
+ break;
case WM_INITMENU:
- /* Checks/Unchecks any menu items before they are displayed */
- HandleCustomWM_INITMENU ((unsigned long)hwnd, wParam);
- break;
+ /* Checks/Unchecks any menu items before they are displayed */
+ HandleCustomWM_INITMENU((unsigned long) hwnd, wParam);
+ break;
case WM_ERASEBKGND:
- /*
- * Pretend that we did erase the background but we don't care,
- * since we repaint the entire region anyhow
- * This avoids some flickering when resizing.
- */
- return TRUE;
+ /*
+ * Pretend that we did erase the background but we don't care,
+ * since we repaint the entire region anyhow
+ * This avoids some flickering when resizing.
+ */
+ return TRUE;
case WM_PAINT:
- /* Only paint if our window handle is valid */
- if (hwndScreen == NULL)
- break;
-
- /* BeginPaint gives us an hdc that clips to the invalidated region */
- hdcUpdate = BeginPaint (hwnd, &ps);
- /* Avoid the BitBlt's if the PAINTSTRUCT is bogus */
- if (ps.rcPaint.right==0 && ps.rcPaint.bottom==0 && ps.rcPaint.left==0 && ps.rcPaint.top==0)
- {
- EndPaint (hwnd, &ps);
- return 0;
- }
+ /* Only paint if our window handle is valid */
+ if (hwndScreen == NULL)
+ break;
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint(hwnd, &ps);
+ /* Avoid the BitBlt's if the PAINTSTRUCT is bogus */
+ if (ps.rcPaint.right == 0 && ps.rcPaint.bottom == 0 &&
+ ps.rcPaint.left == 0 && ps.rcPaint.top == 0) {
+ EndPaint(hwnd, &ps);
+ return 0;
+ }
#ifdef XWIN_GLX_WINDOWS
- if (pWinPriv->fWglUsed)
- {
- /*
- For regions which are being drawn by GL, the shadow framebuffer doesn't have the
- correct bits, so don't bitblt from the shadow framebuffer
-
- XXX: For now, just leave it alone, but ideally we want to send an expose event to
- the window so it really redraws the affected region...
- */
- ValidateRect(hwnd, &(ps.rcPaint));
+ if (pWinPriv->fWglUsed) {
+ /*
+ For regions which are being drawn by GL, the shadow framebuffer doesn't have the
+ correct bits, so don't bitblt from the shadow framebuffer
+
+ XXX: For now, just leave it alone, but ideally we want to send an expose event to
+ the window so it really redraws the affected region...
+ */
+ ValidateRect(hwnd, &(ps.rcPaint));
}
- else
+ else
#endif
- /* Try to copy from the shadow buffer */
- if (!BitBlt (hdcUpdate,
- ps.rcPaint.left, ps.rcPaint.top,
- ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top,
- s_pScreenPriv->hdcShadow,
- ps.rcPaint.left + pWin->drawable.x, ps.rcPaint.top + pWin->drawable.y,
- SRCCOPY))
- {
- LPVOID lpMsgBuf;
-
- /* Display a fancy error message */
- FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError (),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf,
- 0, NULL);
-
- ErrorF ("winTopLevelWindowProc - BitBlt failed: %s\n",
- (LPSTR)lpMsgBuf);
- LocalFree (lpMsgBuf);
- }
-
- /* EndPaint frees the DC */
- EndPaint (hwnd, &ps);
- return 0;
+ /* Try to copy from the shadow buffer */
+ if (!BitBlt(hdcUpdate,
+ ps.rcPaint.left, ps.rcPaint.top,
+ ps.rcPaint.right - ps.rcPaint.left,
+ ps.rcPaint.bottom - ps.rcPaint.top,
+ s_pScreenPriv->hdcShadow,
+ ps.rcPaint.left + pWin->drawable.x,
+ ps.rcPaint.top + pWin->drawable.y, SRCCOPY)) {
+ LPVOID lpMsgBuf;
+
+ /* Display a fancy error message */
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) & lpMsgBuf, 0, NULL);
+
+ ErrorF("winTopLevelWindowProc - BitBlt failed: %s\n",
+ (LPSTR) lpMsgBuf);
+ LocalFree(lpMsgBuf);
+ }
+
+ /* EndPaint frees the DC */
+ EndPaint(hwnd, &ps);
+ return 0;
case WM_MOUSEMOVE:
- /* Unpack the client area mouse coordinates */
- ptMouse.x = GET_X_LPARAM(lParam);
- ptMouse.y = GET_Y_LPARAM(lParam);
-
- /* Translate the client area mouse coordinates to screen coordinates */
- ClientToScreen (hwnd, &ptMouse);
-
- /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
- ptMouse.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
- ptMouse.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
-
- /* We can't do anything without privates */
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
-
- /* Has the mouse pointer crossed screens? */
- if (s_pScreen != miPointerGetScreen(g_pwinPointer))
- miPointerSetScreen (g_pwinPointer, s_pScreenInfo->dwScreen,
- ptMouse.x - s_pScreenInfo->dwXOffset,
- ptMouse.y - s_pScreenInfo->dwYOffset);
-
- /* Are we tracking yet? */
- if (!s_fTracking)
- {
- TRACKMOUSEEVENT tme;
-
- /* Setup data structure */
- ZeroMemory (&tme, sizeof (tme));
- tme.cbSize = sizeof (tme);
- tme.dwFlags = TME_LEAVE;
- tme.hwndTrack = hwnd;
-
- /* Call the tracking function */
- if (!TrackMouseEvent(&tme))
- ErrorF ("winTopLevelWindowProc - TrackMouseEvent failed\n");
-
- /* Flag that we are tracking now */
- s_fTracking = TRUE;
- }
-
- /* Hide or show the Windows mouse cursor */
- if (g_fSoftwareCursor && g_fCursor)
- {
- /* Hide Windows cursor */
- g_fCursor = FALSE;
- ShowCursor (FALSE);
- }
-
- /* Kill the timer used to poll mouse events */
- if (g_uipMousePollingTimerID != 0)
- {
- KillTimer (s_pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID);
- g_uipMousePollingTimerID = 0;
- }
-
- /* Deliver absolute cursor position to X Server */
- winEnqueueMotion(ptMouse.x - s_pScreenInfo->dwXOffset,
- ptMouse.y - s_pScreenInfo->dwYOffset);
+ /* Unpack the client area mouse coordinates */
+ ptMouse.x = GET_X_LPARAM(lParam);
+ ptMouse.y = GET_Y_LPARAM(lParam);
+
+ /* Translate the client area mouse coordinates to screen coordinates */
+ ClientToScreen(hwnd, &ptMouse);
+
+ /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
+ ptMouse.x -= GetSystemMetrics(SM_XVIRTUALSCREEN);
+ ptMouse.y -= GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Has the mouse pointer crossed screens? */
+ if (s_pScreen != miPointerGetScreen(g_pwinPointer))
+ miPointerSetScreen(g_pwinPointer, s_pScreenInfo->dwScreen,
+ ptMouse.x - s_pScreenInfo->dwXOffset,
+ ptMouse.y - s_pScreenInfo->dwYOffset);
+
+ /* Are we tracking yet? */
+ if (!s_fTracking) {
+ TRACKMOUSEEVENT tme;
+
+ /* Setup data structure */
+ ZeroMemory(&tme, sizeof(tme));
+ tme.cbSize = sizeof(tme);
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = hwnd;
+
+ /* Call the tracking function */
+ if (!TrackMouseEvent(&tme))
+ ErrorF("winTopLevelWindowProc - TrackMouseEvent failed\n");
+
+ /* Flag that we are tracking now */
+ s_fTracking = TRUE;
+ }
+
+ /* Hide or show the Windows mouse cursor */
+ if (g_fSoftwareCursor && g_fCursor) {
+ /* Hide Windows cursor */
+ g_fCursor = FALSE;
+ ShowCursor(FALSE);
+ }
+
+ /* Kill the timer used to poll mouse events */
+ if (g_uipMousePollingTimerID != 0) {
+ KillTimer(s_pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID);
+ g_uipMousePollingTimerID = 0;
+ }
+
+ /* Deliver absolute cursor position to X Server */
+ winEnqueueMotion(ptMouse.x - s_pScreenInfo->dwXOffset,
+ ptMouse.y - s_pScreenInfo->dwYOffset);
+
+ return 0;
- return 0;
-
case WM_NCMOUSEMOVE:
- /*
- * We break instead of returning 0 since we need to call
- * DefWindowProc to get the mouse cursor changes
- * and min/max/close button highlighting in Windows XP.
- * The Platform SDK says that you should return 0 if you
- * process this message, but it fails to mention that you
- * will give up any default functionality if you do return 0.
- */
-
- /* We can't do anything without privates */
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
-
- /* Non-client mouse movement, show Windows cursor */
- if (g_fSoftwareCursor && !g_fCursor)
- {
- g_fCursor = TRUE;
- ShowCursor (TRUE);
- }
-
- winStartMousePolling(s_pScreenPriv);
+ /*
+ * We break instead of returning 0 since we need to call
+ * DefWindowProc to get the mouse cursor changes
+ * and min/max/close button highlighting in Windows XP.
+ * The Platform SDK says that you should return 0 if you
+ * process this message, but it fails to mention that you
+ * will give up any default functionality if you do return 0.
+ */
- break;
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Non-client mouse movement, show Windows cursor */
+ if (g_fSoftwareCursor && !g_fCursor) {
+ g_fCursor = TRUE;
+ ShowCursor(TRUE);
+ }
+
+ winStartMousePolling(s_pScreenPriv);
+
+ break;
case WM_MOUSELEAVE:
/* We can't do anything without privates */
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- /* Mouse has left our client area */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ /* Mouse has left our client area */
- /* Flag that we are no longer tracking */
- s_fTracking = FALSE;
+ /* Flag that we are no longer tracking */
+ s_fTracking = FALSE;
- /* Show the mouse cursor, if necessary */
- if (g_fSoftwareCursor && !g_fCursor)
- {
- g_fCursor = TRUE;
- ShowCursor (TRUE);
- }
+ /* Show the mouse cursor, if necessary */
+ if (g_fSoftwareCursor && !g_fCursor) {
+ g_fCursor = TRUE;
+ ShowCursor(TRUE);
+ }
- winStartMousePolling(s_pScreenPriv);
+ winStartMousePolling(s_pScreenPriv);
- return 0;
+ return 0;
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[0] = TRUE;
- SetCapture(hwnd);
- return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[0] = TRUE;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(s_pScreen, ButtonPress, Button1, wParam);
case WM_LBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[0] = FALSE;
- ReleaseCapture();
- winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[0] = FALSE;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
+ return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button1, wParam);
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[1] = TRUE;
- SetCapture(hwnd);
- return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[1] = TRUE;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(s_pScreen, ButtonPress, Button2, wParam);
case WM_MBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[1] = FALSE;
- ReleaseCapture();
- winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[1] = FALSE;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
+ return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button2, wParam);
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[2] = TRUE;
- SetCapture(hwnd);
- return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[2] = TRUE;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(s_pScreen, ButtonPress, Button3, wParam);
case WM_RBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- g_fButton[2] = FALSE;
- ReleaseCapture();
- winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[2] = FALSE;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
+ return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button3, wParam);
case WM_XBUTTONDBLCLK:
case WM_XBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- SetCapture(hwnd);
- return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 5,
+ wParam);
case WM_XBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- ReleaseCapture();
- winStartMousePolling(s_pScreenPriv);
- return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
+ return winMouseButtonsHandle(s_pScreen, ButtonRelease,
+ HIWORD(wParam) + 5, wParam);
case WM_MOUSEWHEEL:
- if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) == HTCLIENT)
- {
- /* Pass the message to the root window */
- SendMessage (hwndScreen, message, wParam, lParam);
- return 0;
- }
- else break;
+ if (SendMessage
+ (hwnd, WM_NCHITTEST, 0,
+ MAKELONG(GET_X_LPARAM(lParam),
+ GET_Y_LPARAM(lParam))) == HTCLIENT) {
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+ return 0;
+ }
+ else
+ break;
case WM_SETFOCUS:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- {
- /* Get the parent window for transient handling */
- HWND hParent = GetParent(hwnd);
- if (hParent && IsIconic(hParent)) ShowWindow (hParent, SW_RESTORE);
- }
+ {
+ /* Get the parent window for transient handling */
+ HWND hParent = GetParent(hwnd);
+
+ if (hParent && IsIconic(hParent))
+ ShowWindow(hParent, SW_RESTORE);
+ }
- winRestoreModeKeyStates ();
+ winRestoreModeKeyStates();
+
+ /* Add the keyboard hook if possible */
+ if (g_fKeyboardHookLL)
+ g_fKeyboardHookLL = winInstallKeyboardHookLL();
+ return 0;
- /* Add the keyboard hook if possible */
- if (g_fKeyboardHookLL)
- g_fKeyboardHookLL = winInstallKeyboardHookLL ();
- return 0;
-
case WM_KILLFOCUS:
- /* Pop any pressed keys since we are losing keyboard focus */
- winKeybdReleaseKeys ();
+ /* Pop any pressed keys since we are losing keyboard focus */
+ winKeybdReleaseKeys();
- /* Remove our keyboard hook if it is installed */
- winRemoveKeyboardHookLL ();
+ /* Remove our keyboard hook if it is installed */
+ winRemoveKeyboardHookLL();
- /* Revert the X focus as well, but only if the Windows focus is going to another window */
- if (!wParam && pWin)
- DeleteWindowFromAnyEvents(pWin, FALSE);
+ /* Revert the X focus as well, but only if the Windows focus is going to another window */
+ if (!wParam && pWin)
+ DeleteWindowFromAnyEvents(pWin, FALSE);
- return 0;
+ return 0;
- case WM_SYSDEADCHAR:
+ case WM_SYSDEADCHAR:
case WM_DEADCHAR:
- /*
- * NOTE: We do nothing with WM_*CHAR messages,
- * nor does the root window, so we can just toss these messages.
- */
- return 0;
+ /*
+ * NOTE: We do nothing with WM_*CHAR messages,
+ * nor does the root window, so we can just toss these messages.
+ */
+ return 0;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
- /*
- * Don't pass Alt-F4 key combo to root window,
- * let Windows translate to WM_CLOSE and close this top-level window.
- *
- * NOTE: We purposely don't check the fUseWinKillKey setting because
- * it should only apply to the key handling for the root window,
- * not for top-level window-manager windows.
- *
- * ALSO NOTE: We do pass Ctrl-Alt-Backspace to the root window
- * because that is a key combo that no X app should be expecting to
- * receive, since it has historically been used to shutdown the X server.
- * Passing Ctrl-Alt-Backspace to the root window preserves that
- * behavior, assuming that -unixkill has been passed as a parameter.
- */
- if (wParam == VK_F4 && (GetKeyState (VK_MENU) & 0x8000))
- break;
+ /*
+ * Don't pass Alt-F4 key combo to root window,
+ * let Windows translate to WM_CLOSE and close this top-level window.
+ *
+ * NOTE: We purposely don't check the fUseWinKillKey setting because
+ * it should only apply to the key handling for the root window,
+ * not for top-level window-manager windows.
+ *
+ * ALSO NOTE: We do pass Ctrl-Alt-Backspace to the root window
+ * because that is a key combo that no X app should be expecting to
+ * receive, since it has historically been used to shutdown the X server.
+ * Passing Ctrl-Alt-Backspace to the root window preserves that
+ * behavior, assuming that -unixkill has been passed as a parameter.
+ */
+ if (wParam == VK_F4 && (GetKeyState(VK_MENU) & 0x8000))
+ break;
#ifdef WINDBG
- if (wParam == VK_ESCAPE)
- {
- /* Place for debug: put any tests and dumps here */
- WINDOWPLACEMENT windPlace;
- RECT rc;
- LPRECT pRect;
-
- windPlace.length = sizeof (WINDOWPLACEMENT);
- GetWindowPlacement (hwnd, &windPlace);
- pRect = &windPlace.rcNormalPosition;
- winDebug ("\nCYGWINDOWING Dump:\n"
- "\tdrawable: (%hd, %hd) - %hdx%hd\n", pDraw->x,
- pDraw->y, pDraw->width, pDraw->height);
- winDebug ("\twindPlace: (%ld, %ld) - %ldx%ld\n", pRect->left,
- pRect->top, pRect->right - pRect->left,
- pRect->bottom - pRect->top);
- if (GetClientRect (hwnd, &rc))
- {
- pRect = &rc;
- winDebug ("\tClientRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
- pRect->top, pRect->right - pRect->left,
- pRect->bottom - pRect->top);
- }
- if (GetWindowRect (hwnd, &rc))
- {
- pRect = &rc;
- winDebug ("\tWindowRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
- pRect->top, pRect->right - pRect->left,
- pRect->bottom - pRect->top);
- }
- winDebug ("\n");
- }
+ if (wParam == VK_ESCAPE) {
+ /* Place for debug: put any tests and dumps here */
+ WINDOWPLACEMENT windPlace;
+ RECT rc;
+ LPRECT pRect;
+
+ windPlace.length = sizeof(WINDOWPLACEMENT);
+ GetWindowPlacement(hwnd, &windPlace);
+ pRect = &windPlace.rcNormalPosition;
+ winDebug ("\nCYGWINDOWING Dump:\n"
+ "\tdrawable: (%hd, %hd) - %hdx%hd\n", pDraw->x,
+ pDraw->y, pDraw->width, pDraw->height);
+ winDebug ("\twindPlace: (%ld, %ld) - %ldx%ld\n", pRect->left,
+ pRect->top, pRect->right - pRect->left,
+ pRect->bottom - pRect->top);
+ if (GetClientRect(hwnd, &rc)) {
+ pRect = &rc;
+ winDebug ("\tClientRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
+ pRect->top, pRect->right - pRect->left,
+ pRect->bottom - pRect->top);
+ }
+ if (GetWindowRect(hwnd, &rc)) {
+ pRect = &rc;
+ winDebug ("\tWindowRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
+ pRect->top, pRect->right - pRect->left,
+ pRect->bottom - pRect->top);
+ }
+ winDebug ("\n");
+ }
#endif
-
- /* Pass the message to the root window */
- return winWindowProc(hwndScreen, message, wParam, lParam);
+
+ /* Pass the message to the root window */
+ return winWindowProc(hwndScreen, message, wParam, lParam);
case WM_SYSKEYUP:
case WM_KEYUP:
-
- /* Pass the message to the root window */
- return winWindowProc(hwndScreen, message, wParam, lParam);
+ /* Pass the message to the root window */
+ return winWindowProc(hwndScreen, message, wParam, lParam);
case WM_HOTKEY:
- /* Pass the message to the root window */
- SendMessage (hwndScreen, message, wParam, lParam);
- return 0;
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+ return 0;
case WM_ACTIVATE:
- /* Pass the message to the root window */
- SendMessage (hwndScreen, message, wParam, lParam);
-
- if (LOWORD(wParam) != WA_INACTIVE)
- {
- /* Raise the window to the top in Z order */
- /* ago: Activate does not mean putting it to front! */
- /*
- wmMsg.msg = WM_WM_RAISE;
- if (fWMMsgInitialized)
- winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
- */
-
- /* Tell our Window Manager thread to activate the window */
- wmMsg.msg = WM_WM_ACTIVATE;
- if (fWMMsgInitialized && pWin->realized && !pWin->overrideRedirect /* for OOo menus */)
- winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
- }
- /* Prevent the mouse wheel from stalling when another window is minimized */
- if (HIWORD(wParam) == 0 && LOWORD(wParam) == WA_ACTIVE &&
- (HWND)lParam != NULL && (HWND)lParam != (HWND)GetParent(hwnd))
- SetFocus(hwnd);
- return 0;
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+
+ if (LOWORD(wParam) != WA_INACTIVE) {
+ /* Raise the window to the top in Z order */
+ /* ago: Activate does not mean putting it to front! */
+ /*
+ wmMsg.msg = WM_WM_RAISE;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ */
+
+ /* Tell our Window Manager thread to activate the window */
+ wmMsg.msg = WM_WM_ACTIVATE;
+ if (fWMMsgInitialized && pWin->realized && !pWin->overrideRedirect /* for OOo menus */)
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ }
+ /* Prevent the mouse wheel from stalling when another window is minimized */
+ if (HIWORD(wParam) == 0 && LOWORD(wParam) == WA_ACTIVE &&
+ (HWND) lParam != NULL && (HWND) lParam != (HWND) GetParent(hwnd))
+ SetFocus(hwnd);
+ return 0;
case WM_ACTIVATEAPP:
- /*
- * This message is also sent to the root window
- * so we do nothing for individual multiwindow windows
- */
- break;
+ /*
+ * This message is also sent to the root window
+ * so we do nothing for individual multiwindow windows
+ */
+ break;
case WM_CLOSE:
/* Remove property AppUserModelID */
winSetAppID (hwnd, NULL);
- /* Branch on if the window was killed in X already */
- if (pWinPriv->fXKilled)
- {
- /* Window was killed, go ahead and destroy the window */
- DestroyWindow (hwnd);
- }
- else
- {
- /* Tell our Window Manager thread to kill the window */
- wmMsg.msg = WM_WM_KILL;
- if (fWMMsgInitialized)
- winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
- }
- return 0;
+ /* Branch on if the window was killed in X already */
+ if (pWinPriv->fXKilled) {
+ /* Window was killed, go ahead and destroy the window */
+ DestroyWindow(hwnd);
+ }
+ else {
+ /* Tell our Window Manager thread to kill the window */
+ wmMsg.msg = WM_WM_KILL;
+ if (fWMMsgInitialized)
+ winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
+ }
+ return 0;
case WM_DESTROY:
- /* Branch on if the window was killed in X already */
- if (pWinPriv && !pWinPriv->fXKilled)
- {
- winDebug ("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n");
-
- /* Tell our Window Manager thread to kill the window */
- wmMsg.msg = WM_WM_KILL;
- if (fWMMsgInitialized)
- winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
- }
-
- RemoveProp (hwnd, WIN_WINDOW_PROP);
- RemoveProp (hwnd, WIN_WID_PROP);
- RemoveProp (hwnd, WIN_NEEDMANAGE_PROP);
+ /* Branch on if the window was killed in X already */
+ if (pWinPriv && !pWinPriv->fXKilled) {
+ winDebug ("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n");
- break;
+ /* Tell our Window Manager thread to kill the window */
+ wmMsg.msg = WM_WM_KILL;
+ if (fWMMsgInitialized)
+ winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
+ }
+
+ RemoveProp(hwnd, WIN_WINDOW_PROP);
+ RemoveProp(hwnd, WIN_WID_PROP);
+ RemoveProp(hwnd, WIN_NEEDMANAGE_PROP);
+
+ break;
case WM_MOVE:
- /* Adjust the X Window to the moved Windows window */
- if (!hasEnteredSizeMove) winAdjustXWindow (pWin, hwnd);
- /* else: Wait for WM_EXITSIZEMOVE */
- return 0;
+ /* Adjust the X Window to the moved Windows window */
+ if (!hasEnteredSizeMove) winAdjustXWindow (pWin, hwnd);
+ /* else: Wait for WM_EXITSIZEMOVE */
+ return 0;
case WM_SHOWWINDOW:
- /* Bail out if the window is being hidden */
- if (!wParam)
- return 0;
-
- /* */
- if (!pWin->overrideRedirect)
- {
- /* Flag that this window needs to be made active when clicked */
- SetProp (hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1);
-
- if (!(GetWindowLongPtr (hwnd, GWL_EXSTYLE) & WS_EX_APPWINDOW))
- {
- HWND zstyle = HWND_NOTOPMOST;
-
- /* Set the window extended style flags */
- SetWindowLongPtr (hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
-
- /* Set the transient style flags */
- if (GetParent(hwnd)) SetWindowLongPtr (hwnd, GWL_STYLE,
- WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
- /* Set the window standard style flags */
- else SetWindowLongPtr (hwnd, GWL_STYLE,
- (WS_POPUP | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS)
- & ~WS_CAPTION & ~WS_SIZEBOX);
-
- winUpdateWindowPosition (hwnd, FALSE, &zstyle);
-
- {
- WinXWMHints hints;
- if (winMultiWindowGetWMHints(pWin, &hints))
- {
- /*
- Give the window focus, unless it has an InputHint
- which is FALSE (this is used by e.g. glean to
- avoid every test window grabbing the focus)
- */
- if (!((hints.flags & InputHint) && (!hints.input)))
- {
- SetForegroundWindow (hwnd);
- }
- }
- }
- }
- wmMsg.msg = WM_WM_MAP3;
- }
- else /* It is an overridden window so make it top of Z stack */
- {
- HWND forHwnd = GetForegroundWindow();
- winDebug ("overridden window is shown\n");
- if (forHwnd != NULL)
- {
- if (GetWindowLongPtr(forHwnd, GWLP_USERDATA) & (LONG_PTR)VCXSRV_SIGNATURE)
- {
- if (GetWindowLongPtr(forHwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
- SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- else
- SetWindowPos (hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- }
- }
- wmMsg.msg = WM_WM_MAP2;
- }
-
- /* Tell our Window Manager thread to map the window */
- if (fWMMsgInitialized)
- winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
-
- winStartMousePolling(s_pScreenPriv);
+ /* Bail out if the window is being hidden */
+ if (!wParam)
+ return 0;
+
+ /* */
+ if (!pWin->overrideRedirect) {
+ /* Flag that this window needs to be made active when clicked */
+ SetProp(hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1);
+
+ if (!(GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_APPWINDOW)) {
+ HWND zstyle = HWND_NOTOPMOST;
+
+ /* Set the window extended style flags */
+ SetWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
+
+ /* Set the transient style flags */
+ if (GetParent(hwnd))
+ SetWindowLongPtr(hwnd, GWL_STYLE,
+ WS_POPUP | WS_OVERLAPPED | WS_SYSMENU |
+ WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
+ /* Set the window standard style flags */
+ else
+ SetWindowLongPtr(hwnd, GWL_STYLE,
+ (WS_POPUP | WS_OVERLAPPEDWINDOW |
+ WS_CLIPCHILDREN | WS_CLIPSIBLINGS)
+ & ~WS_CAPTION & ~WS_SIZEBOX);
+
+ winUpdateWindowPosition(hwnd, FALSE, &zstyle);
+
+ {
+ WinXWMHints hints;
+
+ if (winMultiWindowGetWMHints(pWin, &hints)) {
+ /*
+ Give the window focus, unless it has an InputHint
+ which is FALSE (this is used by e.g. glean to
+ avoid every test window grabbing the focus)
+ */
+ if (!((hints.flags & InputHint) && (!hints.input))) {
+ SetForegroundWindow(hwnd);
+ }
+ }
+ }
+ }
+ wmMsg.msg = WM_WM_MAP3;
+ }
+ else { /* It is an overridden window so make it top of Z stack */
+
+ HWND forHwnd = GetForegroundWindow();
+ winDebug ("overridden window is shown\n");
+ if (forHwnd != NULL) {
+ if (GetWindowLongPtr(forHwnd, GWLP_USERDATA) & (LONG_PTR)
+ VCXSRV_SIGNATURE) {
+ if (GetWindowLongPtr(forHwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
+ SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ else
+ SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ }
+ }
+ wmMsg.msg = WM_WM_MAP2;
+ }
- return 0;
+ /* Tell our Window Manager thread to map the window */
+ if (fWMMsgInitialized)
+ winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
+
+ winStartMousePolling(s_pScreenPriv);
+
+ return 0;
case WM_SIZING:
- /* Need to legalize the size according to WM_NORMAL_HINTS */
- /* for applications like xterm */
- return ValidateSizing (hwnd, pWin, wParam, lParam);
+ /* Need to legalize the size according to WM_NORMAL_HINTS */
+ /* for applications like xterm */
+ return ValidateSizing(hwnd, pWin, wParam, lParam);
case WM_WINDOWPOSCHANGING:
{
@@ -966,64 +956,58 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
break;
case WM_WINDOWPOSCHANGED:
- {
- LPWINDOWPOS pWinPos = (LPWINDOWPOS) lParam;
+ {
+ LPWINDOWPOS pWinPos = (LPWINDOWPOS) lParam;
- if (!(pWinPos->flags & SWP_NOZORDER))
- {
+ if (!(pWinPos->flags & SWP_NOZORDER)) {
#if CYGWINDOWING_DEBUG
- winDebug ("\twindow z order was changed\n");
+ winDebug("\twindow z order was changed\n");
#endif
- if (pWinPos->hwndInsertAfter == HWND_TOP
- ||pWinPos->hwndInsertAfter == HWND_TOPMOST
- ||pWinPos->hwndInsertAfter == HWND_NOTOPMOST)
- {
+ if (pWinPos->hwndInsertAfter == HWND_TOP
+ || pWinPos->hwndInsertAfter == HWND_TOPMOST
+ || pWinPos->hwndInsertAfter == HWND_NOTOPMOST) {
#if CYGWINDOWING_DEBUG
- winDebug ("\traise to top\n");
+ winDebug("\traise to top\n");
#endif
- /* Raise the window to the top in Z order */
- winRaiseWindow(pWin);
- }
- else if (pWinPos->hwndInsertAfter == HWND_BOTTOM)
- {
- }
- else
- {
- /* Check if this window is top of X windows. */
- HWND hWndAbove = NULL;
- DWORD dwCurrentProcessID = GetCurrentProcessId ();
- DWORD dwWindowProcessID = 0;
-
- for (hWndAbove = pWinPos->hwndInsertAfter;
- hWndAbove != NULL;
- hWndAbove = GetNextWindow (hWndAbove, GW_HWNDPREV))
- {
- /* Ignore other XWin process's window */
- GetWindowThreadProcessId (hWndAbove, &dwWindowProcessID);
-
- if ((dwWindowProcessID == dwCurrentProcessID)
- && GetProp (hWndAbove, WIN_WINDOW_PROP)
- && !IsWindowVisible (hWndAbove)
- && !IsIconic (hWndAbove) ) /* ignore minimized windows */
- break;
- }
- /* If this is top of X windows in Windows stack,
- raise it in X stack. */
- if (hWndAbove == NULL)
- {
+ /* Raise the window to the top in Z order */
+ winRaiseWindow(pWin);
+ }
+ else if (pWinPos->hwndInsertAfter == HWND_BOTTOM) {
+ }
+ else {
+ /* Check if this window is top of X windows. */
+ HWND hWndAbove = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId();
+ DWORD dwWindowProcessID = 0;
+
+ for (hWndAbove = pWinPos->hwndInsertAfter;
+ hWndAbove != NULL;
+ hWndAbove = GetNextWindow(hWndAbove, GW_HWNDPREV)) {
+ /* Ignore other XWin process's window */
+ GetWindowThreadProcessId(hWndAbove, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp(hWndAbove, WIN_WINDOW_PROP)
+ && !IsWindowVisible(hWndAbove)
+ && !IsIconic(hWndAbove)) /* ignore minimized windows */
+ break;
+ }
+ /* If this is top of X windows in Windows stack,
+ raise it in X stack. */
+ if (hWndAbove == NULL) {
#if CYGWINDOWING_DEBUG
- winDebug ("\traise to top\n");
+ winDebug("\traise to top\n");
#endif
- winRaiseWindow(pWin);
- }
- }
- }
- }
- /*
- * Pass the message to DefWindowProc to let the function
- * break down WM_WINDOWPOSCHANGED to WM_MOVE and WM_SIZE.
- */
- break;
+ winRaiseWindow(pWin);
+ }
+ }
+ }
+ }
+ /*
+ * Pass the message to DefWindowProc to let the function
+ * break down WM_WINDOWPOSCHANGED to WM_MOVE and WM_SIZE.
+ */
+ break;
case WM_ENTERSIZEMOVE:
hasEnteredSizeMove = TRUE;
@@ -1036,80 +1020,79 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
return 0;
case WM_SIZE:
- /* see dix/window.c */
+ /* see dix/window.c */
#ifdef WINDBG
- {
- char buf[64];
- switch (wParam)
- {
- case SIZE_MINIMIZED:
- strcpy(buf, "SIZE_MINIMIZED");
- break;
- case SIZE_MAXIMIZED:
- strcpy(buf, "SIZE_MAXIMIZED");
- break;
- case SIZE_RESTORED:
- strcpy(buf, "SIZE_RESTORED");
- break;
- default:
- strcpy(buf, "UNKNOWN_FLAG");
- }
- winDebug ("winTopLevelWindowProc - WM_SIZE to %dx%d (%s) - %d ms\n",
- (int)LOWORD(lParam), (int)HIWORD(lParam), buf,
- (int)(GetTickCount ()));
- }
+ {
+ char buf[64];
+
+ switch (wParam) {
+ case SIZE_MINIMIZED:
+ strcpy(buf, "SIZE_MINIMIZED");
+ break;
+ case SIZE_MAXIMIZED:
+ strcpy(buf, "SIZE_MAXIMIZED");
+ break;
+ case SIZE_RESTORED:
+ strcpy(buf, "SIZE_RESTORED");
+ break;
+ default:
+ strcpy(buf, "UNKNOWN_FLAG");
+ }
+ winDebug ("winTopLevelWindowProc - WM_SIZE to %dx%d (%s) - %d ms\n",
+ (int) LOWORD(lParam), (int) HIWORD(lParam), buf,
+ (int) (GetTickCount()));
+ }
#endif
- if (!hasEnteredSizeMove)
+ if (!hasEnteredSizeMove)
{
- /* Adjust the X Window to the moved Windows window */
- winAdjustXWindow (pWin, hwnd);
- if (wParam == SIZE_MINIMIZED) winReorderWindowsMultiWindow();
- }
- /* else: wait for WM_EXITSIZEMOVE */
- return 0; /* end of WM_SIZE handler */
+ /* Adjust the X Window to the moved Windows window */
+ winAdjustXWindow (pWin, hwnd);
+ if (wParam == SIZE_MINIMIZED) winReorderWindowsMultiWindow();
+ }
+ /* else: wait for WM_EXITSIZEMOVE */
+ return 0; /* end of WM_SIZE handler */
case WM_STYLECHANGED:
/* when the style changes, adjust the window size so the client area remains the same */
- {
- LONG x,y;
- DrawablePtr pDraw = &pWin->drawable;
- x = pDraw->x - wBorderWidth(pWin);
- y = pDraw->y - wBorderWidth(pWin);
- winPositionWindowMultiWindow(pWin, x, y);
- }
- return 0;
+ {
+ LONG x,y;
+ DrawablePtr pDraw = &pWin->drawable;
+ x = pDraw->x - wBorderWidth(pWin);
+ y = pDraw->y - wBorderWidth(pWin);
+ winPositionWindowMultiWindow(pWin, x, y);
+ }
+ return 0;
case WM_MOUSEACTIVATE:
- /* Check if this window needs to be made active when clicked */
- if (!GetProp (pWinPriv->hWnd, WIN_NEEDMANAGE_PROP))
- {
- winDebug ("winTopLevelWindowProc - WM_MOUSEACTIVATE - "
- "MA_NOACTIVATE\n");
+ /* Check if this window needs to be made active when clicked */
+ if (!GetProp(pWinPriv->hWnd, WIN_NEEDMANAGE_PROP)) {
+ winDebug ("winTopLevelWindowProc - WM_MOUSEACTIVATE - "
+ "MA_NOACTIVATE\n");
- /* */
- return MA_NOACTIVATE;
- }
- break;
+ /* */
+ return MA_NOACTIVATE;
+ }
+ break;
case WM_SETCURSOR:
- if (LOWORD(lParam) == HTCLIENT)
- {
- if (!g_fSoftwareCursor) SetCursor (s_pScreenPriv->cursor.handle);
- return TRUE;
- }
- break;
+ if (LOWORD(lParam) == HTCLIENT) {
+ if (!g_fSoftwareCursor)
+ SetCursor(s_pScreenPriv->cursor.handle);
+ return TRUE;
+ }
+ break;
default:
- break;
+ break;
}
- ret = DefWindowProc (hwnd, message, wParam, lParam);
- /*
- * If the window was minized we get the stack change before the window is restored
- * and so it gets lost. Ensure there stacking order is correct.
- */
- if (needRestack)
- winReorderWindowsMultiWindow();
- return ret;
+ ret = DefWindowProc(hwnd, message, wParam, lParam);
+ /*
+ * If the window was minized we get the stack change before the window is restored
+ * and so it gets lost. Ensure there stacking order is correct.
+ */
+ if (needRestack)
+ winReorderWindowsMultiWindow();
+ return ret;
}
diff --git a/xorg-server/hw/xwin/winnativegdi.c b/xorg-server/hw/xwin/winnativegdi.c
index c6238d43b..88cc52976 100644
--- a/xorg-server/hw/xwin/winnativegdi.c
+++ b/xorg-server/hw/xwin/winnativegdi.c
@@ -33,76 +33,69 @@
#endif
#include "win.h"
-
/*
* Local function prototypes
*/
static Bool
-winAllocateFBNativeGDI (ScreenPtr pScreen);
+ winAllocateFBNativeGDI(ScreenPtr pScreen);
static void
-winShadowUpdateNativeGDI (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ winShadowUpdateNativeGDI(ScreenPtr pScreen, shadowBufPtr pBuf);
static Bool
-winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen);
+ winCloseScreenNativeGDI(int nIndex, ScreenPtr pScreen);
static Bool
-winInitVisualsNativeGDI (ScreenPtr pScreen);
+ winInitVisualsNativeGDI(ScreenPtr pScreen);
static Bool
-winAdjustVideoModeNativeGDI (ScreenPtr pScreen);
+ winAdjustVideoModeNativeGDI(ScreenPtr pScreen);
#if 0
static Bool
-winBltExposedRegionsNativeGDI (ScreenPtr pScreen);
+ winBltExposedRegionsNativeGDI(ScreenPtr pScreen);
#endif
static Bool
-winActivateAppNativeGDI (ScreenPtr pScreen);
+ winActivateAppNativeGDI(ScreenPtr pScreen);
static Bool
-winRedrawScreenNativeGDI (ScreenPtr pScreen);
+ winRedrawScreenNativeGDI(ScreenPtr pScreen);
static Bool
-winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen);
+ winRealizeInstalledPaletteNativeGDI(ScreenPtr pScreen);
static Bool
-winInstallColormapNativeGDI (ColormapPtr pColormap);
+ winInstallColormapNativeGDI(ColormapPtr pColormap);
static Bool
-winStoreColorsNativeGDI (ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs);
+ winStoreColorsNativeGDI(ColormapPtr pmap, int ndef, xColorItem * pdefs);
static Bool
-winCreateColormapNativeGDI (ColormapPtr pColormap);
+ winCreateColormapNativeGDI(ColormapPtr pColormap);
static Bool
-winDestroyColormapNativeGDI (ColormapPtr pColormap);
-
-
+ winDestroyColormapNativeGDI(ColormapPtr pColormap);
static Bool
-winAllocateFBNativeGDI (ScreenPtr pScreen)
+winAllocateFBNativeGDI(ScreenPtr pScreen)
{
- FatalError ("winAllocateFBNativeGDI\n");
+ FatalError("winAllocateFBNativeGDI\n");
- return TRUE;
+ return TRUE;
}
static void
-winFreeFBNativeGDI (ScreenPtr pScreen)
+winFreeFBNativeGDI(ScreenPtr pScreen)
{
- FatalError ("winFreeFBNativeGDI\n");
+ FatalError("winFreeFBNativeGDI\n");
}
-
static Bool
winInitScreenNativeGDI(ScreenPtr pScreen)
{
- FatalError ("winInitScreenNativeGDI\n");
+ FatalError("winInitScreenNativeGDI\n");
}
/*
@@ -111,425 +104,389 @@ winInitScreenNativeGDI(ScreenPtr pScreen)
*/
static Bool
-winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen)
+winCloseScreenNativeGDI(int nIndex, ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- winDebug ("winCloseScreenNativeGDI - Freeing screen resources\n");
-
- /* Flag that the screen is closed */
- pScreenPriv->fClosed = TRUE;
- pScreenPriv->fActive = FALSE;
-
- /*
- * NOTE: mi doesn't use a CloseScreen procedure, so we do not
- * need to call a wrapped procedure here.
- */
-
- /* Delete the window property */
- RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
-
- winDebug ("winCloseScreenNativeGDI - Destroying window\n");
-
- /* Delete tray icon, if we have one */
- if (!pScreenInfo->fNoTrayIcon)
- winDeleteNotifyIcon (pScreenPriv);
-
- /* Free the exit confirmation dialog box, if it exists */
- if (g_hDlgExit != NULL)
- {
- DestroyWindow (g_hDlgExit);
- g_hDlgExit = NULL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ winDebug ("winCloseScreenNativeGDI - Freeing screen resources\n");
+
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
+
+ /*
+ * NOTE: mi doesn't use a CloseScreen procedure, so we do not
+ * need to call a wrapped procedure here.
+ */
+
+ /* Delete the window property */
+ RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
+
+ winDebug ("winCloseScreenNativeGDI - Destroying window\n");
+
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon(pScreenPriv);
+
+ /* Free the exit confirmation dialog box, if it exists */
+ if (g_hDlgExit != NULL) {
+ DestroyWindow(g_hDlgExit);
+ g_hDlgExit = NULL;
}
- /* Kill our window */
- if (pScreenPriv->hwndScreen)
- {
- DestroyWindow (pScreenPriv->hwndScreen);
- pScreenPriv->hwndScreen = NULL;
+ /* Kill our window */
+ if (pScreenPriv->hwndScreen) {
+ DestroyWindow(pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
}
- /* Invalidate our screeninfo's pointer to the screen */
- pScreenInfo->pScreen = NULL;
+ /* Invalidate our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
- /* Free the screen privates for this screen */
- free (pScreenPriv);
+ /* Free the screen privates for this screen */
+ free(pScreenPriv);
- winDebug ("winCloseScreenNativeGDI - Returning\n");
+ winDebug ("winCloseScreenNativeGDI - Returning\n");
- return TRUE;
+ return TRUE;
}
-
static void
-winShadowUpdateNativeGDI (ScreenPtr pScreen,
- shadowBufPtr pBuf)
+winShadowUpdateNativeGDI(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- FatalError ("winShadowUpdateNativeGDI\n");
- return;
+ FatalError("winShadowUpdateNativeGDI\n");
+ return;
}
-
static Bool
-winInitVisualsNativeGDI (ScreenPtr pScreen)
+winInitVisualsNativeGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- /* Set the bitsPerRGB and bit masks */
- switch (pScreenInfo->dwDepth)
- {
+ /* Set the bitsPerRGB and bit masks */
+ switch (pScreenInfo->dwDepth) {
case 24:
- pScreenPriv->dwBitsPerRGB = 8;
- pScreenPriv->dwRedMask = 0x00FF0000;
- pScreenPriv->dwGreenMask = 0x0000FF00;
- pScreenPriv->dwBlueMask = 0x000000FF;
- break;
-
+ pScreenPriv->dwBitsPerRGB = 8;
+ pScreenPriv->dwRedMask = 0x00FF0000;
+ pScreenPriv->dwGreenMask = 0x0000FF00;
+ pScreenPriv->dwBlueMask = 0x000000FF;
+ break;
+
case 16:
- pScreenPriv->dwBitsPerRGB = 6;
- pScreenPriv->dwRedMask = 0xF800;
- pScreenPriv->dwGreenMask = 0x07E0;
- pScreenPriv->dwBlueMask = 0x001F;
- break;
-
+ pScreenPriv->dwBitsPerRGB = 6;
+ pScreenPriv->dwRedMask = 0xF800;
+ pScreenPriv->dwGreenMask = 0x07E0;
+ pScreenPriv->dwBlueMask = 0x001F;
+ break;
+
case 15:
- pScreenPriv->dwBitsPerRGB = 5;
- pScreenPriv->dwRedMask = 0x7C00;
- pScreenPriv->dwGreenMask = 0x03E0;
- pScreenPriv->dwBlueMask = 0x001F;
- break;
-
+ pScreenPriv->dwBitsPerRGB = 5;
+ pScreenPriv->dwRedMask = 0x7C00;
+ pScreenPriv->dwGreenMask = 0x03E0;
+ pScreenPriv->dwBlueMask = 0x001F;
+ break;
+
case 8:
- pScreenPriv->dwBitsPerRGB = 8;
- pScreenPriv->dwRedMask = 0;
- pScreenPriv->dwGreenMask = 0;
- pScreenPriv->dwBlueMask = 0;
- break;
+ pScreenPriv->dwBitsPerRGB = 8;
+ pScreenPriv->dwRedMask = 0;
+ pScreenPriv->dwGreenMask = 0;
+ pScreenPriv->dwBlueMask = 0;
+ break;
default:
- ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n");
- return FALSE;
- break;
+ ErrorF("winInitVisualsNativeGDI - Unknown screen depth\n");
+ return FALSE;
+ break;
}
- /* Tell the user how many bits per RGB we are using */
- winDebug ("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n",
- (int) pScreenPriv->dwBitsPerRGB);
+ /* Tell the user how many bits per RGB we are using */
+ winDebug ("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n",
+ (int) pScreenPriv->dwBitsPerRGB);
- /* Create a single visual according to the Windows screen depth */
- switch (pScreenInfo->dwDepth)
- {
+ /* Create a single visual according to the Windows screen depth */
+ switch (pScreenInfo->dwDepth) {
case 24:
case 16:
case 15:
- if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
- TrueColorMask,
- pScreenPriv->dwBitsPerRGB,
- TrueColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask))
- {
- ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n");
- return FALSE;
- }
- break;
+ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ TrueColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask)) {
+ ErrorF("winInitVisuals - miSetVisualTypesAndMasks failed\n");
+ return FALSE;
+ }
+ break;
case 8:
- winDebug ("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
- if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
- StaticColorMask,
- pScreenPriv->dwBitsPerRGB,
- StaticColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask))
- {
- ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n");
- return FALSE;
- }
- break;
+ winDebug ("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
+ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
+ StaticColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ StaticColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask)) {
+ ErrorF("winInitVisuals - miSetVisualTypesAndMasks failed\n");
+ return FALSE;
+ }
+ break;
default:
- ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n");
- return FALSE;
+ ErrorF("winInitVisualsNativeGDI - Unknown screen depth\n");
+ return FALSE;
}
- winDebug ("winInitVisualsNativeGDI - Returning\n");
+ winDebug ("winInitVisualsNativeGDI - Returning\n");
- return TRUE;
+ return TRUE;
}
-
/* Adjust the video mode */
static Bool
-winAdjustVideoModeNativeGDI (ScreenPtr pScreen)
+winAdjustVideoModeNativeGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HDC hdc = NULL;
- DWORD dwBPP;
-
- hdc = GetDC (NULL);
-
- /* We're in serious trouble if we can't get a DC */
- if (hdc == NULL)
- {
- ErrorF ("winAdjustVideoModeNativeGDI - GetDC () failed\n");
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc = NULL;
+ DWORD dwBPP;
+
+ hdc = GetDC(NULL);
+
+ /* We're in serious trouble if we can't get a DC */
+ if (hdc == NULL) {
+ ErrorF("winAdjustVideoModeNativeGDI - GetDC () failed\n");
+ return FALSE;
}
- /* Query GDI for current display depth */
- dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
- pScreenInfo->dwDepth = GetDeviceCaps (hdc, PLANES);
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
+ pScreenInfo->dwDepth = GetDeviceCaps(hdc, PLANES);
- switch (pScreenInfo->dwDepth) {
+ switch (pScreenInfo->dwDepth) {
case 24:
case 16:
case 15:
case 8:
- break;
+ break;
default:
- if (dwBPP == 32)
- pScreenInfo->dwDepth = 24;
- else
- pScreenInfo->dwDepth = dwBPP;
- break;
- }
+ if (dwBPP == 32)
+ pScreenInfo->dwDepth = 24;
+ else
+ pScreenInfo->dwDepth = dwBPP;
+ break;
+ }
- /* GDI cannot change the screen depth, so we'll use GDI's depth */
- pScreenInfo->dwBPP = dwBPP;
+ /* GDI cannot change the screen depth, so we'll use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
- /* Release our DC */
- ReleaseDC (NULL, hdc);
+ /* Release our DC */
+ ReleaseDC(NULL, hdc);
- return TRUE;
+ return TRUE;
}
-
static Bool
-winActivateAppNativeGDI (ScreenPtr pScreen)
+winActivateAppNativeGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
-
- /*
- * Are we active?
- * Are we fullscreen?
- */
- if (pScreenPriv != NULL
- && pScreenPriv->fActive
- && pScreenPriv->pScreenInfo
- && pScreenPriv->pScreenInfo->fFullScreen)
- {
- /*
- * Activating, attempt to bring our window
- * to the top of the display
- */
- ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE);
+ winScreenPriv(pScreen);
+
+ /*
+ * Are we active?
+ * Are we fullscreen?
+ */
+ if (pScreenPriv != NULL
+ && pScreenPriv->fActive
+ && pScreenPriv->pScreenInfo && pScreenPriv->pScreenInfo->fFullScreen) {
+ /*
+ * Activating, attempt to bring our window
+ * to the top of the display
+ */
+ ShowWindow(pScreenPriv->hwndScreen, SW_RESTORE);
}
- /*
- * Are we inactive?
- * Are we fullscreen?
- */
- if (pScreenPriv != NULL
- && !pScreenPriv->fActive
- && pScreenPriv->pScreenInfo
- && pScreenPriv->pScreenInfo->fFullScreen)
- {
- /*
- * Deactivating, stuff our window onto the
- * task bar.
- */
- ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE);
+ /*
+ * Are we inactive?
+ * Are we fullscreen?
+ */
+ if (pScreenPriv != NULL
+ && !pScreenPriv->fActive
+ && pScreenPriv->pScreenInfo && pScreenPriv->pScreenInfo->fFullScreen) {
+ /*
+ * Deactivating, stuff our window onto the
+ * task bar.
+ */
+ ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE);
}
- return TRUE;
+ return TRUE;
}
-
HBITMAP
-winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
- BYTE **ppbBits, BITMAPINFO **ppbmi)
+winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth,
+ BYTE ** ppbBits, BITMAPINFO ** ppbmi)
{
- BITMAPINFOHEADER *pbmih = NULL;
- HBITMAP hBitmap = NULL;
- BITMAPINFO *pbmi = NULL;
-
- /* Don't create an invalid bitmap */
- if (iWidth == 0
- || iHeight == 0
- || iDepth == 0)
- {
- ErrorF ("\nwinCreateDIBNativeGDI - Invalid specs w %d h %d d %d\n\n",
- iWidth, iHeight, iDepth);
- return NULL;
+ BITMAPINFOHEADER *pbmih = NULL;
+ HBITMAP hBitmap = NULL;
+ BITMAPINFO *pbmi = NULL;
+
+ /* Don't create an invalid bitmap */
+ if (iWidth == 0 || iHeight == 0 || iDepth == 0) {
+ ErrorF("\nwinCreateDIBNativeGDI - Invalid specs w %d h %d d %d\n\n",
+ iWidth, iHeight, iDepth);
+ return NULL;
}
- /* Allocate bitmap info header */
- pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
- + 256 * sizeof (RGBQUAD));
- if (pbmih == NULL)
- {
- ErrorF ("winCreateDIBNativeGDI - malloc () failed\n");
- return FALSE;
+ /* Allocate bitmap info header */
+ pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER)
+ + 256 * sizeof(RGBQUAD));
+ if (pbmih == NULL) {
+ ErrorF("winCreateDIBNativeGDI - malloc () failed\n");
+ return FALSE;
}
- ZeroMemory (pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD));
-
- /* Describe bitmap to be created */
- pbmih->biSize = sizeof (BITMAPINFOHEADER);
- pbmih->biWidth = iWidth;
- pbmih->biHeight = -iHeight;
- pbmih->biPlanes = 1;
- pbmih->biBitCount = iDepth;
- pbmih->biCompression = BI_RGB;
+ ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
+
+ /* Describe bitmap to be created */
+ pbmih->biSize = sizeof(BITMAPINFOHEADER);
+ pbmih->biWidth = iWidth;
+ pbmih->biHeight = -iHeight;
+ pbmih->biPlanes = 1;
+ pbmih->biBitCount = iDepth;
+ pbmih->biCompression = BI_RGB;
/*
- pbmih->biSizeImage = 0;
- pbmih->biXPelsPerMeter = 0;
- pbmih->biYPelsPerMeter = 0;
- pbmih->biClrUsed = 0;
- pbmih->biClrImportant = 0;
+ pbmih->biSizeImage = 0;
+ pbmih->biXPelsPerMeter = 0;
+ pbmih->biYPelsPerMeter = 0;
+ pbmih->biClrUsed = 0;
+ pbmih->biClrImportant = 0;
*/
- /* Setup color table for mono DIBs */
- if (iDepth == 1)
- {
- pbmi = (BITMAPINFO*) pbmih;
- pbmi->bmiColors[1].rgbBlue = 255;
- pbmi->bmiColors[1].rgbGreen = 255;
- pbmi->bmiColors[1].rgbRed = 255;
+ /* Setup color table for mono DIBs */
+ if (iDepth == 1) {
+ pbmi = (BITMAPINFO *) pbmih;
+ pbmi->bmiColors[1].rgbBlue = 255;
+ pbmi->bmiColors[1].rgbGreen = 255;
+ pbmi->bmiColors[1].rgbRed = 255;
}
- /* Create a DIB with a bit pointer */
- hBitmap = CreateDIBSection (NULL,
- (BITMAPINFO *) pbmih,
- DIB_RGB_COLORS,
- (void **) ppbBits,
- NULL,
- 0);
- if (hBitmap == NULL)
- {
- ErrorF ("winCreateDIBNativeGDI - CreateDIBSection () failed\n");
- return NULL;
+ /* Create a DIB with a bit pointer */
+ hBitmap = CreateDIBSection(NULL,
+ (BITMAPINFO *) pbmih,
+ DIB_RGB_COLORS, (void **) ppbBits, NULL, 0);
+ if (hBitmap == NULL) {
+ ErrorF("winCreateDIBNativeGDI - CreateDIBSection () failed\n");
+ return NULL;
}
- /* Free the bitmap info header memory */
- if (ppbmi != NULL)
- {
- /* Store the address of the BMIH in the ppbmih parameter */
- *ppbmi = (BITMAPINFO *) pbmih;
+ /* Free the bitmap info header memory */
+ if (ppbmi != NULL) {
+ /* Store the address of the BMIH in the ppbmih parameter */
+ *ppbmi = (BITMAPINFO *) pbmih;
}
- else
- {
- free (pbmih);
- pbmih = NULL;
+ else {
+ free(pbmih);
+ pbmih = NULL;
}
- return hBitmap;
+ return hBitmap;
}
-
#if 0
static Bool
-winBltExposedRegionsNativeGDI (ScreenPtr pScreen)
+winBltExposedRegionsNativeGDI(ScreenPtr pScreen)
{
-
- return TRUE;
+
+ return TRUE;
}
#endif
-
static Bool
-winRedrawScreenNativeGDI (ScreenPtr pScreen)
+winRedrawScreenNativeGDI(ScreenPtr pScreen)
{
- FatalError ("winRedrawScreenNativeGDI\n");
- return TRUE;
+ FatalError("winRedrawScreenNativeGDI\n");
+ return TRUE;
}
-
static Bool
-winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen)
+winRealizeInstalledPaletteNativeGDI(ScreenPtr pScreen)
{
- FatalError ("winRealizeInstalledPaletteNativeGDI\n");
- return TRUE;
+ FatalError("winRealizeInstalledPaletteNativeGDI\n");
+ return TRUE;
}
-
static Bool
-winInstallColormapNativeGDI (ColormapPtr pColormap)
+winInstallColormapNativeGDI(ColormapPtr pColormap)
{
- FatalError ("winInstallColormapNativeGDI\n");
- return TRUE;
+ FatalError("winInstallColormapNativeGDI\n");
+ return TRUE;
}
-
static Bool
-winStoreColorsNativeGDI (ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs)
+winStoreColorsNativeGDI(ColormapPtr pmap, int ndef, xColorItem * pdefs)
{
- FatalError ("winStoreColorsNativeGDI\n");
- return TRUE;
+ FatalError("winStoreColorsNativeGDI\n");
+ return TRUE;
}
-
static Bool
-winCreateColormapNativeGDI (ColormapPtr pColormap)
+winCreateColormapNativeGDI(ColormapPtr pColormap)
{
- FatalError ("winCreateColormapNativeGDI\n");
- return TRUE;
+ FatalError("winCreateColormapNativeGDI\n");
+ return TRUE;
}
-
static Bool
-winDestroyColormapNativeGDI (ColormapPtr pColormap)
+winDestroyColormapNativeGDI(ColormapPtr pColormap)
{
- FatalError ("winDestroyColormapNativeGDI\n");
- return TRUE;
+ FatalError("winDestroyColormapNativeGDI\n");
+ return TRUE;
}
-
/* Set engine specific funtions */
Bool
-winSetEngineFunctionsNativeGDI (ScreenPtr pScreen)
+winSetEngineFunctionsNativeGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Set our pointers */
- pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI;
- pScreenPriv->pwinFreeFB = winFreeFBNativeGDI;
- pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI;
- pScreenPriv->pwinInitScreen = winInitScreenNativeGDI;
- pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI;
- pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI;
- pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI;
- if (pScreenInfo->fFullScreen)
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
- else
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
- pScreenPriv->pwinFinishScreenInit = winFinishScreenInitNativeGDI;
- /*
- * WARNING: Do not set the BltExposedRegions procedure pointer to anything
- * other than NULL until a working painting procedure is in place.
- * Else, winWindowProc will get stuck in an infinite loop because
- * Windows expects the BeginPaint and EndPaint functions to be called
- * before a WM_PAINT message can be removed from the queue. We are
- * using NULL here as a signal for winWindowProc that it should
- * not signal that the WM_PAINT message has been processed.
- */
- pScreenPriv->pwinBltExposedRegions = NULL;
- pScreenPriv->pwinActivateApp = winActivateAppNativeGDI;
- pScreenPriv->pwinRedrawScreen = winRedrawScreenNativeGDI;
- pScreenPriv->pwinRealizeInstalledPalette =
- winRealizeInstalledPaletteNativeGDI;
- pScreenPriv->pwinInstallColormap = winInstallColormapNativeGDI;
- pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI;
- pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI;
- pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI;
- pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
-
- return TRUE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI;
+ pScreenPriv->pwinFreeFB = winFreeFBNativeGDI;
+ pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI;
+ pScreenPriv->pwinInitScreen = winInitScreenNativeGDI;
+ pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI;
+ pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI;
+ if (pScreenInfo->fFullScreen)
+ pScreenPriv->pwinCreateBoundingWindow =
+ winCreateBoundingWindowFullScreen;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitNativeGDI;
+ /*
+ * WARNING: Do not set the BltExposedRegions procedure pointer to anything
+ * other than NULL until a working painting procedure is in place.
+ * Else, winWindowProc will get stuck in an infinite loop because
+ * Windows expects the BeginPaint and EndPaint functions to be called
+ * before a WM_PAINT message can be removed from the queue. We are
+ * using NULL here as a signal for winWindowProc that it should
+ * not signal that the WM_PAINT message has been processed.
+ */
+ pScreenPriv->pwinBltExposedRegions = NULL;
+ pScreenPriv->pwinActivateApp = winActivateAppNativeGDI;
+ pScreenPriv->pwinRedrawScreen = winRedrawScreenNativeGDI;
+ pScreenPriv->pwinRealizeInstalledPalette =
+ winRealizeInstalledPaletteNativeGDI;
+ pScreenPriv->pwinInstallColormap = winInstallColormapNativeGDI;
+ pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI;
+ pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI;
+ pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI;
+ pScreenPriv->pwinHotKeyAltTab =
+ (winHotKeyAltTabProcPtr) (void (*)(void)) NoopDDA;
+
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/winpfbdd.c b/xorg-server/hw/xwin/winpfbdd.c
index 3ea61ade2..d9b095f3a 100644
--- a/xorg-server/hw/xwin/winpfbdd.c
+++ b/xorg-server/hw/xwin/winpfbdd.c
@@ -36,241 +36,225 @@
#endif
#include "win.h"
-
/*
* Local function prototypes
*/
static Bool
-winAllocateFBPrimaryDD (ScreenPtr pScreen);
+ winAllocateFBPrimaryDD(ScreenPtr pScreen);
static Bool
-winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen);
+ winCloseScreenPrimaryDD(int nIndex, ScreenPtr pScreen);
static Bool
-winInitVisualsPrimaryDD (ScreenPtr pScreen);
+ winInitVisualsPrimaryDD(ScreenPtr pScreen);
static Bool
-winAdjustVideoModePrimaryDD (ScreenPtr pScreen);
+ winAdjustVideoModePrimaryDD(ScreenPtr pScreen);
static Bool
-winActivateAppPrimaryDD (ScreenPtr pScreen);
+ winActivateAppPrimaryDD(ScreenPtr pScreen);
static Bool
-winHotKeyAltTabPrimaryDD (ScreenPtr pScreen);
-
+ winHotKeyAltTabPrimaryDD(ScreenPtr pScreen);
/*
* Create a DirectDraw primary surface
*/
static Bool
-winAllocateFBPrimaryDD (ScreenPtr pScreen)
+winAllocateFBPrimaryDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC ddsd;
- DDSURFACEDESC *pddsdPrimary = NULL;
- DDSURFACEDESC *pddsdOffscreen = NULL;
- RECT rcClient;
-
- winDebug ("winAllocateFBPrimaryDD\n");
-
- /* Get client area location in screen coords */
- GetClientRect (pScreenPriv->hwndScreen, &rcClient);
- MapWindowPoints (pScreenPriv->hwndScreen,
- HWND_DESKTOP,
- (LPPOINT)&rcClient, 2);
-
- /* Create a DirectDraw object, store the address at lpdd */
- ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
- if (ddrval != DD_OK)
- FatalError ("winAllocateFBPrimaryDD - Could not start DirectDraw\n");
-
- /* Get a DirectDraw2 interface pointer */
- ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd,
- &IID_IDirectDraw2,
- (LPVOID*) &pScreenPriv->pdd2);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC ddsd;
+ DDSURFACEDESC *pddsdPrimary = NULL;
+ DDSURFACEDESC *pddsdOffscreen = NULL;
+ RECT rcClient;
+
+ winDebug ("winAllocateFBPrimaryDD\n");
+
+ /* Get client area location in screen coords */
+ GetClientRect(pScreenPriv->hwndScreen, &rcClient);
+ MapWindowPoints(pScreenPriv->hwndScreen,
+ HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+
+ /* Create a DirectDraw object, store the address at lpdd */
+ ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
+ if (ddrval != DD_OK)
+ FatalError("winAllocateFBPrimaryDD - Could not start DirectDraw\n");
+
+ /* Get a DirectDraw2 interface pointer */
+ ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
+ &IID_IDirectDraw2,
+ (LPVOID *) & pScreenPriv->pdd2);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
}
-
- winDebug ("winAllocateFBPrimaryDD - Created and initialized DD\n");
-
- /* Are we windowed or fullscreen? */
- if (pScreenInfo->fFullScreen)
- {
- /* Full screen mode */
- ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2,
- pScreenPriv->hwndScreen,
- DDSCL_FULLSCREEN
- | DDSCL_EXCLUSIVE);
- if (FAILED (ddrval))
- FatalError ("winAllocateFBPrimaryDD - Could not set "
- "cooperative level\n");
-
- /* Change the video mode to the mode requested */
- ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2,
- pScreenInfo->dwWidth,
- pScreenInfo->dwHeight,
- pScreenInfo->dwBPP,
- pScreenInfo->dwRefreshRate,
- 0);
- if (FAILED (ddrval))
- FatalError ("winAllocateFBPrimaryDD - Could not set "
- "full screen display mode\n");
+ winDebug ("winAllocateFBPrimaryDD - Created and initialized DD\n");
+
+ /* Are we windowed or fullscreen? */
+ if (pScreenInfo->fFullScreen) {
+ /* Full screen mode */
+ ddrval = IDirectDraw2_SetCooperativeLevel(pScreenPriv->pdd2,
+ pScreenPriv->hwndScreen,
+ DDSCL_FULLSCREEN
+ | DDSCL_EXCLUSIVE);
+ if (FAILED(ddrval))
+ FatalError("winAllocateFBPrimaryDD - Could not set "
+ "cooperative level\n");
+
+ /* Change the video mode to the mode requested */
+ ddrval = IDirectDraw2_SetDisplayMode(pScreenPriv->pdd2,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP,
+ pScreenInfo->dwRefreshRate, 0);
+ if (FAILED(ddrval))
+ FatalError("winAllocateFBPrimaryDD - Could not set "
+ "full screen display mode\n");
}
- else
- {
- /* Windowed mode */
- ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2,
- pScreenPriv->hwndScreen,
- DDSCL_NORMAL);
- if (FAILED (ddrval))
- FatalError ("winAllocateFBPrimaryDD - Could not set "
- "cooperative level\n");
+ else {
+ /* Windowed mode */
+ ddrval = IDirectDraw2_SetCooperativeLevel(pScreenPriv->pdd2,
+ pScreenPriv->hwndScreen,
+ DDSCL_NORMAL);
+ if (FAILED(ddrval))
+ FatalError("winAllocateFBPrimaryDD - Could not set "
+ "cooperative level\n");
}
- /* Describe the primary surface */
- ZeroMemory (&ddsd, sizeof (ddsd));
- ddsd.dwSize = sizeof (ddsd);
- ddsd.dwFlags = DDSD_CAPS;
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-
- /* Create the primary surface */
- ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2,
- &ddsd,
- &pScreenPriv->pddsPrimary,
- NULL);
- if (FAILED (ddrval))
- FatalError ("winAllocateFBPrimaryDD - Could not create primary "
- "surface %08x\n", (unsigned int) ddrval);
-
- winDebug ("winAllocateFBPrimaryDD - Created primary\n");
-
- /* Allocate a DD surface description for our screen privates */
- pddsdPrimary = pScreenPriv->pddsdPrimary
- = malloc (sizeof (DDSURFACEDESC));
- if (pddsdPrimary == NULL)
- FatalError ("winAllocateFBPrimaryDD - Could not allocate surface "
- "description memory\n");
- ZeroMemory (pddsdPrimary, sizeof (*pddsdPrimary));
- pddsdPrimary->dwSize = sizeof (*pddsdPrimary);
-
- /* Describe the offscreen surface to be created */
- /*
- * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
- * as drawing, locking, and unlocking take forever
- * with video memory surfaces. In addition,
- * video memory is a somewhat scarce resource,
- * so you shouldn't be allocating video memory when
- * you have the option of using system memory instead.
- */
- ZeroMemory (&ddsd, sizeof (ddsd));
- ddsd.dwSize = sizeof (ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
- ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
- ddsd.dwHeight = pScreenInfo->dwHeight;
- ddsd.dwWidth = pScreenInfo->dwWidth;
-
- /* Create the shadow surface */
- ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2,
- &ddsd,
- &pScreenPriv->pddsOffscreen,
- NULL);
- if (ddrval != DD_OK)
- FatalError ("winAllocateFBPrimaryDD - Could not create shadow "
- "surface\n");
-
- winDebug ("winAllocateFBPrimaryDD - Created offscreen\n");
-
- /* Allocate a DD surface description for our screen privates */
- pddsdOffscreen = pScreenPriv->pddsdOffscreen
- = malloc (sizeof (DDSURFACEDESC));
- if (pddsdOffscreen == NULL)
- FatalError ("winAllocateFBPrimaryDD - Could not allocate surface "
- "description memory\n");
- ZeroMemory (pddsdOffscreen, sizeof (*pddsdOffscreen));
- pddsdOffscreen->dwSize = sizeof (*pddsdOffscreen);
-
- winDebug ("winAllocateFBPrimaryDD - Locking primary\n");
-
- /* Lock the primary surface */
- ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary,
- pScreenInfo->fFullScreen ? NULL:&rcClient,
- pddsdPrimary,
- DDLOCK_WAIT,
- NULL);
- if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL)
- FatalError ("winAllocateFBPrimaryDD - Could not lock "
- "primary surface\n");
-
- winDebug ("winAllocateFBPrimaryDD - Locked primary\n");
-
- /* We don't know how to deal with anything other than RGB */
- if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB))
- FatalError ("winAllocateFBPrimaryDD - Color format other than RGB\n");
-
- /* Grab the pitch from the surface desc */
- pScreenInfo->dwStride = (pddsdPrimary->u1.lPitch * 8)
- / pScreenInfo->dwBPP;
-
- /* Save the pointer to our surface memory */
- pScreenInfo->pfb = pddsdPrimary->lpSurface;
-
- /* Grab the color depth and masks from the surface description */
- pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask;
- pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask;
- pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask;
-
- winDebug ("winAllocateFBPrimaryDD - Returning\n");
-
- return TRUE;
+ /* Describe the primary surface */
+ ZeroMemory(&ddsd, sizeof(ddsd));
+ ddsd.dwSize = sizeof(ddsd);
+ ddsd.dwFlags = DDSD_CAPS;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+
+ /* Create the primary surface */
+ ddrval = IDirectDraw2_CreateSurface(pScreenPriv->pdd2,
+ &ddsd, &pScreenPriv->pddsPrimary, NULL);
+ if (FAILED(ddrval))
+ FatalError("winAllocateFBPrimaryDD - Could not create primary "
+ "surface %08x\n", (unsigned int) ddrval);
+
+ winDebug ("winAllocateFBPrimaryDD - Created primary\n");
+
+ /* Allocate a DD surface description for our screen privates */
+ pddsdPrimary = pScreenPriv->pddsdPrimary = malloc(sizeof(DDSURFACEDESC));
+ if (pddsdPrimary == NULL)
+ FatalError("winAllocateFBPrimaryDD - Could not allocate surface "
+ "description memory\n");
+ ZeroMemory(pddsdPrimary, sizeof(*pddsdPrimary));
+ pddsdPrimary->dwSize = sizeof(*pddsdPrimary);
+
+ /* Describe the offscreen surface to be created */
+ /*
+ * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
+ * as drawing, locking, and unlocking take forever
+ * with video memory surfaces. In addition,
+ * video memory is a somewhat scarce resource,
+ * so you shouldn't be allocating video memory when
+ * you have the option of using system memory instead.
+ */
+ ZeroMemory(&ddsd, sizeof(ddsd));
+ ddsd.dwSize = sizeof(ddsd);
+ ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
+ ddsd.dwHeight = pScreenInfo->dwHeight;
+ ddsd.dwWidth = pScreenInfo->dwWidth;
+
+ /* Create the shadow surface */
+ ddrval = IDirectDraw2_CreateSurface(pScreenPriv->pdd2,
+ &ddsd,
+ &pScreenPriv->pddsOffscreen, NULL);
+ if (ddrval != DD_OK)
+ FatalError("winAllocateFBPrimaryDD - Could not create shadow "
+ "surface\n");
+
+ winDebug ("winAllocateFBPrimaryDD - Created offscreen\n");
+
+ /* Allocate a DD surface description for our screen privates */
+ pddsdOffscreen = pScreenPriv->pddsdOffscreen
+ = malloc(sizeof(DDSURFACEDESC));
+ if (pddsdOffscreen == NULL)
+ FatalError("winAllocateFBPrimaryDD - Could not allocate surface "
+ "description memory\n");
+ ZeroMemory(pddsdOffscreen, sizeof(*pddsdOffscreen));
+ pddsdOffscreen->dwSize = sizeof(*pddsdOffscreen);
+
+ winDebug ("winAllocateFBPrimaryDD - Locking primary\n");
+
+ /* Lock the primary surface */
+ ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsPrimary,
+ pScreenInfo->
+ fFullScreen ? NULL : &rcClient,
+ pddsdPrimary, DDLOCK_WAIT, NULL);
+ if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL)
+ FatalError("winAllocateFBPrimaryDD - Could not lock "
+ "primary surface\n");
+
+ winDebug ("winAllocateFBPrimaryDD - Locked primary\n");
+
+ /* We don't know how to deal with anything other than RGB */
+ if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB))
+ FatalError("winAllocateFBPrimaryDD - Color format other than RGB\n");
+
+ /* Grab the pitch from the surface desc */
+ pScreenInfo->dwStride = (pddsdPrimary->u1.lPitch * 8)
+ / pScreenInfo->dwBPP;
+
+ /* Save the pointer to our surface memory */
+ pScreenInfo->pfb = pddsdPrimary->lpSurface;
+
+ /* Grab the color depth and masks from the surface description */
+ pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask;
+ pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask;
+ pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask;
+
+ winDebug ("winAllocateFBPrimaryDD - Returning\n");
+
+ return TRUE;
}
static void
-winFreeFBPrimaryDD (ScreenPtr pScreen)
+winFreeFBPrimaryDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Free the offscreen surface, if there is one */
- if (pScreenPriv->pddsOffscreen)
- {
- IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, NULL);
- IDirectDrawSurface2_Release (pScreenPriv->pddsOffscreen);
- pScreenPriv->pddsOffscreen = NULL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Free the offscreen surface, if there is one */
+ if (pScreenPriv->pddsOffscreen) {
+ IDirectDrawSurface2_Unlock(pScreenPriv->pddsOffscreen, NULL);
+ IDirectDrawSurface2_Release(pScreenPriv->pddsOffscreen);
+ pScreenPriv->pddsOffscreen = NULL;
}
- /* Release the primary surface, if there is one */
- if (pScreenPriv->pddsPrimary)
- {
- IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL);
- IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
- pScreenPriv->pddsPrimary = NULL;
+ /* Release the primary surface, if there is one */
+ if (pScreenPriv->pddsPrimary) {
+ IDirectDrawSurface2_Unlock(pScreenPriv->pddsPrimary, NULL);
+ IDirectDrawSurface2_Release(pScreenPriv->pddsPrimary);
+ pScreenPriv->pddsPrimary = NULL;
}
- /* Free the DirectDraw object, if there is one */
- if (pScreenPriv->pdd)
- {
- IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd);
- IDirectDraw2_Release (pScreenPriv->pdd);
- pScreenPriv->pdd = NULL;
+ /* Free the DirectDraw object, if there is one */
+ if (pScreenPriv->pdd) {
+ IDirectDraw2_RestoreDisplayMode(pScreenPriv->pdd);
+ IDirectDraw2_Release(pScreenPriv->pdd);
+ pScreenPriv->pdd = NULL;
}
- /* Invalidate the ScreenInfo's fb pointer */
- pScreenInfo->pfb = NULL;
+ /* Invalidate the ScreenInfo's fb pointer */
+ pScreenInfo->pfb = NULL;
}
static Bool
winInitScreenPrimaryDD(ScreenPtr pScreen)
{
- return winAllocateFBPrimaryDD(pScreen);
+ return winAllocateFBPrimaryDD(pScreen);
}
/*
@@ -280,56 +264,53 @@ winInitScreenPrimaryDD(ScreenPtr pScreen)
*/
static Bool
-winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen)
+winCloseScreenPrimaryDD(int nIndex, ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- Bool fReturn;
-
- ErrorF ("winCloseScreenPrimaryDD - Freeing screen resources\n");
-
- /* Flag that the screen is closed */
- pScreenPriv->fClosed = TRUE;
- pScreenPriv->fActive = FALSE;
-
- /* Call the wrapped CloseScreen procedure */
- WIN_UNWRAP(CloseScreen);
- if (pScreen->CloseScreen)
- fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
-
- /* Delete the window property */
- RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
-
- winFreeFBPrimaryDD(pScreen);
-
- /* Delete tray icon, if we have one */
- if (!pScreenInfo->fNoTrayIcon)
- winDeleteNotifyIcon (pScreenPriv);
-
- /* Free the exit confirmation dialog box, if it exists */
- if (g_hDlgExit != NULL)
- {
- DestroyWindow (g_hDlgExit);
- g_hDlgExit = NULL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ Bool fReturn;
+
+ ErrorF("winCloseScreenPrimaryDD - Freeing screen resources\n");
+
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
+
+ /* Call the wrapped CloseScreen procedure */
+ WIN_UNWRAP(CloseScreen);
+ if (pScreen->CloseScreen)
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+
+ /* Delete the window property */
+ RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
+
+ winFreeFBPrimaryDD(pScreen);
+
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon(pScreenPriv);
+
+ /* Free the exit confirmation dialog box, if it exists */
+ if (g_hDlgExit != NULL) {
+ DestroyWindow(g_hDlgExit);
+ g_hDlgExit = NULL;
}
- /* Kill our window */
- if (pScreenPriv->hwndScreen)
- {
- DestroyWindow (pScreenPriv->hwndScreen);
- pScreenPriv->hwndScreen = NULL;
+ /* Kill our window */
+ if (pScreenPriv->hwndScreen) {
+ DestroyWindow(pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
}
- /* Kill our screeninfo's pointer to the screen */
- pScreenInfo->pScreen = NULL;
+ /* Kill our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
- /* Free the screen privates for this screen */
- free ((pointer) pScreenPriv);
+ /* Free the screen privates for this screen */
+ free((pointer) pScreenPriv);
- return fReturn;
+ return fReturn;
}
-
/*
* Tell mi what sort of visuals we need.
*
@@ -339,114 +320,106 @@ winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen)
*/
static Bool
-winInitVisualsPrimaryDD (ScreenPtr pScreen)
+winInitVisualsPrimaryDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- DWORD dwRedBits, dwGreenBits, dwBlueBits;
-
- /* Count the number of ones in each color mask */
- dwRedBits = winCountBits (pScreenPriv->dwRedMask);
- dwGreenBits = winCountBits (pScreenPriv->dwGreenMask);
- dwBlueBits = winCountBits (pScreenPriv->dwBlueMask);
-
- /* Store the maximum number of ones in a color mask as the bitsPerRGB */
- if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwRedBits;
- else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwGreenBits;
- else
- pScreenPriv->dwBitsPerRGB = dwBlueBits;
-
- winDebug ("winInitVisualsPrimaryDD - Masks: %08x %08x %08x bpRGB: %d\n",
- (unsigned int) pScreenPriv->dwRedMask,
- (unsigned int) pScreenPriv->dwGreenMask,
- (unsigned int) pScreenPriv->dwBlueMask,
- (int) pScreenPriv->dwBitsPerRGB);
-
- /* Create a single visual according to the Windows screen depth */
- switch (pScreenInfo->dwDepth)
- {
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ DWORD dwRedBits, dwGreenBits, dwBlueBits;
+
+ /* Count the number of ones in each color mask */
+ dwRedBits = winCountBits(pScreenPriv->dwRedMask);
+ dwGreenBits = winCountBits(pScreenPriv->dwGreenMask);
+ dwBlueBits = winCountBits(pScreenPriv->dwBlueMask);
+
+ /* Store the maximum number of ones in a color mask as the bitsPerRGB */
+ if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwRedBits;
+ else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwGreenBits;
+ else
+ pScreenPriv->dwBitsPerRGB = dwBlueBits;
+
+ winDebug ("winInitVisualsPrimaryDD - Masks: %08x %08x %08x bpRGB: %d\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask,
+ (int) pScreenPriv->dwBitsPerRGB);
+
+ /* Create a single visual according to the Windows screen depth */
+ switch (pScreenInfo->dwDepth) {
case 24:
case 16:
case 15:
- if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
- TrueColorMask,
- pScreenPriv->dwBitsPerRGB,
- TrueColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask))
- {
- ErrorF ("winInitVisualsPrimaryDD - "
- "miSetVisualTypesAndMasks failed\n");
- return FALSE;
- }
- break;
+ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ TrueColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask)) {
+ ErrorF("winInitVisualsPrimaryDD - "
+ "miSetVisualTypesAndMasks failed\n");
+ return FALSE;
+ }
+ break;
case 8:
- winDebug ("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
- if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
- PseudoColorMask,
- pScreenPriv->dwBitsPerRGB,
- PseudoColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask))
- {
- ErrorF ("winInitVisualsPrimaryDD - "
- "miSetVisualTypesAndMasks failed\n");
- return FALSE;
- }
- winDebug ("winInitVisualsPrimaryDD - Returned from "
- "miSetVisualTypesAndMasks\n");
- break;
+ winDebug("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
+ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
+ PseudoColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ PseudoColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask)) {
+ ErrorF("winInitVisualsPrimaryDD - "
+ "miSetVisualTypesAndMasks failed\n");
+ return FALSE;
+ }
+ winDebug("winInitVisualsPrimaryDD - Returned from "
+ "miSetVisualTypesAndMasks\n");
+ break;
default:
- ErrorF ("winInitVisualsPrimaryDD - Unknown screen depth\n");
- return FALSE;
+ ErrorF("winInitVisualsPrimaryDD - Unknown screen depth\n");
+ return FALSE;
}
- winDebug ("winInitVisualsPrimaryDD - Returning\n");
+ winDebug ("winInitVisualsPrimaryDD - Returning\n");
- return TRUE;
+ return TRUE;
}
-
static Bool
-winAdjustVideoModePrimaryDD (ScreenPtr pScreen)
+winAdjustVideoModePrimaryDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HDC hdc = NULL;
- DWORD dwBPP;
-
- /* We're in serious trouble if we can't get a DC */
- hdc = GetDC (NULL);
- if (hdc == NULL)
- {
- ErrorF ("winAdjustVideoModePrimaryDD - GetDC failed\n");
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc = NULL;
+ DWORD dwBPP;
+
+ /* We're in serious trouble if we can't get a DC */
+ hdc = GetDC(NULL);
+ if (hdc == NULL) {
+ ErrorF("winAdjustVideoModePrimaryDD - GetDC failed\n");
+ return FALSE;
}
- /* Query GDI for current display depth */
- dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
- /* DirectDraw can only change the depth in fullscreen mode */
- if (!(pScreenInfo->fFullScreen &&
- (pScreenInfo->dwBPP != WIN_DEFAULT_BPP)))
- {
- /* Otherwise, We'll use GDI's depth */
- pScreenInfo->dwBPP = dwBPP;
+ /* DirectDraw can only change the depth in fullscreen mode */
+ if (!(pScreenInfo->fFullScreen && (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) {
+ /* Otherwise, We'll use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
}
- /* Release our DC */
- ReleaseDC (NULL, hdc);
+ /* Release our DC */
+ ReleaseDC(NULL, hdc);
- return TRUE;
+ return TRUE;
}
-
/*
* We need to blit our offscreen fb to
* the screen when we are activated, and we need to point
@@ -454,85 +427,76 @@ winAdjustVideoModePrimaryDD (ScreenPtr pScreen)
*/
static Bool
-winActivateAppPrimaryDD (ScreenPtr pScreen)
+winActivateAppPrimaryDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- RECT rcSrc, rcClient;
- HRESULT ddrval = DD_OK;
-
- /* Check for errors */
- if (pScreenPriv == NULL
- || pScreenPriv->pScreenInfo == NULL
- || pScreenPriv->pddsPrimary == NULL
- || pScreenPriv->pddsOffscreen == NULL)
- return FALSE;
-
- /* Check for do-nothing */
- if (!pScreenPriv->fActive)
- return TRUE;
-
- /* We are activating */
- ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsOffscreen);
- if (ddrval == DD_OK)
- {
- IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen,
- NULL);
- /*
- * We don't check for an error from Unlock, because it
- * doesn't matter if the Unlock failed.
- */
+ winScreenPriv(pScreen);
+ RECT rcSrc, rcClient;
+ HRESULT ddrval = DD_OK;
+
+ /* Check for errors */
+ if (pScreenPriv == NULL
+ || pScreenPriv->pScreenInfo == NULL
+ || pScreenPriv->pddsPrimary == NULL
+ || pScreenPriv->pddsOffscreen == NULL)
+ return FALSE;
+
+ /* Check for do-nothing */
+ if (!pScreenPriv->fActive)
+ return TRUE;
+
+ /* We are activating */
+ ddrval = IDirectDrawSurface2_IsLost(pScreenPriv->pddsOffscreen);
+ if (ddrval == DD_OK) {
+ IDirectDrawSurface2_Unlock(pScreenPriv->pddsOffscreen, NULL);
+ /*
+ * We don't check for an error from Unlock, because it
+ * doesn't matter if the Unlock failed.
+ */
}
- /* Restore both surfaces, just cause I like it that way */
- IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen);
- IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
-
- /* Get client area in screen coords */
- GetClientRect (pScreenPriv->hwndScreen, &rcClient);
- MapWindowPoints (pScreenPriv->hwndScreen,
- HWND_DESKTOP,
- (LPPOINT)&rcClient, 2);
-
- /* Setup a source rectangle */
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.right = pScreenPriv->pScreenInfo->dwWidth;
- rcSrc.bottom = pScreenPriv->pScreenInfo->dwHeight;
-
- ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
- &rcClient,
- pScreenPriv->pddsOffscreen,
- &rcSrc,
- DDBLT_WAIT,
- NULL);
- if (ddrval != DD_OK)
- FatalError ("winActivateAppPrimaryDD () - Failed blitting offscreen "
- "surface to primary surface %08x\n", (unsigned int) ddrval);
-
- /* Lock the primary surface */
- ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary,
- &rcClient,
- pScreenPriv->pddsdPrimary,
- DDLOCK_WAIT,
- NULL);
- if (ddrval != DD_OK
- || pScreenPriv->pddsdPrimary->lpSurface == NULL)
- FatalError ("winActivateAppPrimaryDD () - Could not lock "
- "primary surface\n");
-
- /* Notify FB of the new memory pointer */
- winUpdateFBPointer (pScreen,
- pScreenPriv->pddsdPrimary->lpSurface);
-
- /*
- * Register the Alt-Tab combo as a hotkey so we can copy
- * the primary framebuffer before the display mode changes
- */
- RegisterHotKey (pScreenPriv->hwndScreen, 1, MOD_ALT, 9);
-
- return TRUE;
-}
+ /* Restore both surfaces, just cause I like it that way */
+ IDirectDrawSurface2_Restore(pScreenPriv->pddsOffscreen);
+ IDirectDrawSurface2_Restore(pScreenPriv->pddsPrimary);
+
+ /* Get client area in screen coords */
+ GetClientRect(pScreenPriv->hwndScreen, &rcClient);
+ MapWindowPoints(pScreenPriv->hwndScreen,
+ HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+
+ /* Setup a source rectangle */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenPriv->pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenPriv->pScreenInfo->dwHeight;
+
+ ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
+ &rcClient,
+ pScreenPriv->pddsOffscreen,
+ &rcSrc, DDBLT_WAIT, NULL);
+ if (ddrval != DD_OK)
+ FatalError("winActivateAppPrimaryDD () - Failed blitting offscreen "
+ "surface to primary surface %08x\n", (unsigned int) ddrval);
+
+ /* Lock the primary surface */
+ ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsPrimary,
+ &rcClient,
+ pScreenPriv->pddsdPrimary,
+ DDLOCK_WAIT, NULL);
+ if (ddrval != DD_OK || pScreenPriv->pddsdPrimary->lpSurface == NULL)
+ FatalError("winActivateAppPrimaryDD () - Could not lock "
+ "primary surface\n");
+
+ /* Notify FB of the new memory pointer */
+ winUpdateFBPointer(pScreen, pScreenPriv->pddsdPrimary->lpSurface);
+
+ /*
+ * Register the Alt-Tab combo as a hotkey so we can copy
+ * the primary framebuffer before the display mode changes
+ */
+ RegisterHotKey(pScreenPriv->hwndScreen, 1, MOD_ALT, 9);
+ return TRUE;
+}
/*
* Handle the Alt+Tab hotkey.
@@ -543,133 +507,123 @@ winActivateAppPrimaryDD (ScreenPtr pScreen)
*/
static Bool
-winHotKeyAltTabPrimaryDD (ScreenPtr pScreen)
+winHotKeyAltTabPrimaryDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RECT rcClient, rcSrc;
- HRESULT ddrval = DD_OK;
-
- winDebug ("\nwinHotKeyAltTabPrimaryDD\n\n");
-
- /* Alt+Tab was pressed, we will lose focus very soon */
- pScreenPriv->fActive = FALSE;
-
- /* Check for error conditions */
- if (pScreenPriv->pddsPrimary == NULL
- || pScreenPriv->pddsOffscreen == NULL)
- return FALSE;
-
- /* Get client area in screen coords */
- GetClientRect (pScreenPriv->hwndScreen, &rcClient);
- MapWindowPoints (pScreenPriv->hwndScreen,
- HWND_DESKTOP,
- (LPPOINT)&rcClient, 2);
-
- /* Did we loose the primary surface? */
- ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsPrimary);
- if (ddrval == DD_OK)
- {
- ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary,
- NULL);
- if (FAILED (ddrval))
- FatalError ("winHotKeyAltTabPrimaryDD - Failed unlocking primary "
- "surface\n");
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RECT rcClient, rcSrc;
+ HRESULT ddrval = DD_OK;
+
+ winDebug ("\nwinHotKeyAltTabPrimaryDD\n\n");
+
+ /* Alt+Tab was pressed, we will lose focus very soon */
+ pScreenPriv->fActive = FALSE;
+
+ /* Check for error conditions */
+ if (pScreenPriv->pddsPrimary == NULL || pScreenPriv->pddsOffscreen == NULL)
+ return FALSE;
+
+ /* Get client area in screen coords */
+ GetClientRect(pScreenPriv->hwndScreen, &rcClient);
+ MapWindowPoints(pScreenPriv->hwndScreen,
+ HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+
+ /* Did we loose the primary surface? */
+ ddrval = IDirectDrawSurface2_IsLost(pScreenPriv->pddsPrimary);
+ if (ddrval == DD_OK) {
+ ddrval = IDirectDrawSurface2_Unlock(pScreenPriv->pddsPrimary, NULL);
+ if (FAILED(ddrval))
+ FatalError("winHotKeyAltTabPrimaryDD - Failed unlocking primary "
+ "surface\n");
}
- /* Setup a source rectangle */
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.right = pScreenInfo->dwWidth;
- rcSrc.bottom = pScreenInfo->dwHeight;
-
- /* Blit the primary surface to the offscreen surface */
- ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen,
- NULL, /* should be rcDest */
- pScreenPriv->pddsPrimary,
- NULL,
- DDBLT_WAIT,
- NULL);
- if (ddrval == DDERR_SURFACELOST)
- {
- IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen);
- IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
-
- /* Blit the primary surface to the offscreen surface */
- ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen,
- NULL,
- pScreenPriv->pddsPrimary,
- NULL,
- DDBLT_WAIT,
- NULL);
- if (FAILED (ddrval))
- FatalError ("winHotKeyAltTabPrimaryDD - Failed blitting primary "
- "surface to offscreen surface: %08x\n",
- (unsigned int) ddrval);
+ /* Setup a source rectangle */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Blit the primary surface to the offscreen surface */
+ ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsOffscreen, NULL, /* should be rcDest */
+ pScreenPriv->pddsPrimary,
+ NULL, DDBLT_WAIT, NULL);
+ if (ddrval == DDERR_SURFACELOST) {
+ IDirectDrawSurface2_Restore(pScreenPriv->pddsOffscreen);
+ IDirectDrawSurface2_Restore(pScreenPriv->pddsPrimary);
+
+ /* Blit the primary surface to the offscreen surface */
+ ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsOffscreen,
+ NULL,
+ pScreenPriv->pddsPrimary,
+ NULL, DDBLT_WAIT, NULL);
+ if (FAILED(ddrval))
+ FatalError("winHotKeyAltTabPrimaryDD - Failed blitting primary "
+ "surface to offscreen surface: %08x\n",
+ (unsigned int) ddrval);
}
- else
- {
- FatalError ("winHotKeyAltTabPrimaryDD - Unknown error from "
- "Blt: %08dx\n", (unsigned int) ddrval);
+ else {
+ FatalError("winHotKeyAltTabPrimaryDD - Unknown error from "
+ "Blt: %08dx\n", (unsigned int) ddrval);
}
- /* Lock the offscreen surface */
- ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsOffscreen,
- NULL,
- pScreenPriv->pddsdOffscreen,
- DDLOCK_WAIT,
- NULL);
- if (ddrval != DD_OK
- || pScreenPriv->pddsdPrimary->lpSurface == NULL)
- FatalError ("winHotKeyAltTabPrimaryDD - Could not lock "
- "offscreen surface\n");
-
- /* Notify FB of the new memory pointer */
- winUpdateFBPointer (pScreen,
- pScreenPriv->pddsdOffscreen->lpSurface);
-
- /* Unregister our hotkey */
- UnregisterHotKey (pScreenPriv->hwndScreen, 1);
-
- return TRUE;
-}
+ /* Lock the offscreen surface */
+ ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsOffscreen,
+ NULL,
+ pScreenPriv->pddsdOffscreen,
+ DDLOCK_WAIT, NULL);
+ if (ddrval != DD_OK || pScreenPriv->pddsdPrimary->lpSurface == NULL)
+ FatalError("winHotKeyAltTabPrimaryDD - Could not lock "
+ "offscreen surface\n");
+
+ /* Notify FB of the new memory pointer */
+ winUpdateFBPointer(pScreen, pScreenPriv->pddsdOffscreen->lpSurface);
+
+ /* Unregister our hotkey */
+ UnregisterHotKey(pScreenPriv->hwndScreen, 1);
+ return TRUE;
+}
/* Set engine specific functions */
Bool
-winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen)
+winSetEngineFunctionsPrimaryDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Set our pointers */
- pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD;
- pScreenPriv->pwinFreeFB = winFreeFBPrimaryDD;
- pScreenPriv->pwinShadowUpdate = (winShadowUpdateProcPtr) (void (*)(void))NoopDDA;
- pScreenPriv->pwinInitScreen = winInitScreenPrimaryDD;
- pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD;
- pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD;
- pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD;
- if (pScreenInfo->fFullScreen)
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
- else
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
- pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
- pScreenPriv->pwinBltExposedRegions = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA;
- pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD;
- pScreenPriv->pwinRedrawScreen = NULL;
- pScreenPriv->pwinRealizeInstalledPalette = NULL;
- pScreenPriv->pwinInstallColormap = NULL;
- pScreenPriv->pwinStoreColors = NULL;
- pScreenPriv->pwinCreateColormap = NULL;
- pScreenPriv->pwinDestroyColormap = NULL;
- pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD;
- pScreenPriv->pwinCreatePrimarySurface = (winCreatePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
- pScreenPriv->pwinReleasePrimarySurface = (winReleasePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD;
+ pScreenPriv->pwinFreeFB = winFreeFBPrimaryDD;
+ pScreenPriv->pwinShadowUpdate =
+ (winShadowUpdateProcPtr) (void (*)(void)) NoopDDA;
+ pScreenPriv->pwinInitScreen = winInitScreenPrimaryDD;
+ pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD;
+ pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD;
+ if (pScreenInfo->fFullScreen)
+ pScreenPriv->pwinCreateBoundingWindow =
+ winCreateBoundingWindowFullScreen;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
+ pScreenPriv->pwinBltExposedRegions =
+ (winBltExposedRegionsProcPtr) (void (*)(void)) NoopDDA;
+ pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD;
+ pScreenPriv->pwinRedrawScreen = NULL;
+ pScreenPriv->pwinRealizeInstalledPalette = NULL;
+ pScreenPriv->pwinInstallColormap = NULL;
+ pScreenPriv->pwinStoreColors = NULL;
+ pScreenPriv->pwinCreateColormap = NULL;
+ pScreenPriv->pwinDestroyColormap = NULL;
+ pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD;
+ pScreenPriv->pwinCreatePrimarySurface =
+ (winCreatePrimarySurfaceProcPtr) (void (*)(void)) NoopDDA;
+ pScreenPriv->pwinReleasePrimarySurface =
+ (winReleasePrimarySurfaceProcPtr) (void (*)(void)) NoopDDA;
#ifdef XWIN_MULTIWINDOW
- pScreenPriv->pwinFinishCreateWindowsWindow =
- (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
+ pScreenPriv->pwinFinishCreateWindowsWindow =
+ (winFinishCreateWindowsWindowProcPtr) (void (*)(void)) NoopDDA;
#endif
- return TRUE;
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/winpixmap.c b/xorg-server/hw/xwin/winpixmap.c
index 2af95f225..ac883a84c 100644
--- a/xorg-server/hw/xwin/winpixmap.c
+++ b/xorg-server/hw/xwin/winpixmap.c
@@ -1,184 +1,178 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: drewry, september 1986
- * Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-
-/*
- * Local prototypes
- */
-
-#if 0
-static void
-winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw);
-
-static void
-winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh);
-
-static void
-winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
- int xrot, int yrot);
-#endif
-
-
-/* See Porting Layer Definition - p. 34 */
-/* See mfb/mfbpixmap.c - mfbCreatePixmap() */
-PixmapPtr
-winCreatePixmapNativeGDI (ScreenPtr pScreen,
- int iWidth, int iHeight,
- int iDepth, unsigned usage_hint)
-{
- winPrivPixmapPtr pPixmapPriv = NULL;
- PixmapPtr pPixmap = NULL;
-
- /* Allocate pixmap memory */
- pPixmap = AllocatePixmap (pScreen, 0);
- if (!pPixmap)
- {
- ErrorF ("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n");
- return NullPixmap;
- }
-
- winDebug ("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n",
- iWidth, iHeight, iDepth, usage_hint,
- PixmapBytePad (iWidth, iDepth));
-
- /* Setup pixmap values */
- pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
- pPixmap->drawable.pScreen = pScreen;
- pPixmap->drawable.depth = iDepth;
- pPixmap->drawable.bitsPerPixel = BitsPerPixel (iDepth);
- pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = iWidth;
- pPixmap->drawable.height = iHeight;
- pPixmap->devKind = 0;
- pPixmap->refcnt = 1;
- pPixmap->devPrivate.ptr = NULL;
- pPixmap->usage_hint = usage_hint;
-
- /* Pixmap privates are allocated by AllocatePixmap */
- pPixmapPriv = winGetPixmapPriv (pPixmap);
-
- /* Initialize pixmap privates */
- pPixmapPriv->hBitmap = NULL;
- pPixmapPriv->hdcSelected = NULL;
- pPixmapPriv->pbBits = NULL;
- pPixmapPriv->dwScanlineBytes = PixmapBytePad (iWidth, iDepth);
-
- /* Check for zero width or height pixmaps */
- if (iWidth == 0 || iHeight == 0)
- {
- /* Don't allocate a real pixmap, just set fields and return */
- return pPixmap;
- }
-
- /* Create a DIB for the pixmap */
- pPixmapPriv->hBitmap = winCreateDIBNativeGDI (iWidth, iHeight, iDepth,
- &pPixmapPriv->pbBits,
- (BITMAPINFO **) &pPixmapPriv->pbmih);
-
- winDebug ("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for " \
- "screen: %08x\n",
- pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen);
-
- return pPixmap;
-}
-
-
-/*
- * See Porting Layer Definition - p. 35
- *
- * See mfb/mfbpixmap.c - mfbDestroyPixmap()
- */
-
-Bool
-winDestroyPixmapNativeGDI (PixmapPtr pPixmap)
-{
- winPrivPixmapPtr pPixmapPriv = NULL;
-
- winDebug ("winDestroyPixmapNativeGDI ()\n");
-
- /* Bail early if there is not a pixmap to destroy */
- if (pPixmap == NULL)
- {
- ErrorF ("winDestroyPixmapNativeGDI () - No pixmap to destroy\n");
- return TRUE;
- }
-
- /* Get a handle to the pixmap privates */
- pPixmapPriv = winGetPixmapPriv (pPixmap);
-
- winDebug ("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
- pPixmapPriv->hBitmap);
-
- /* Decrement reference count, return if nonzero */
- --pPixmap->refcnt;
- if (pPixmap->refcnt != 0)
- return TRUE;
-
- /* Free GDI bitmap */
- if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap);
-
- /* Free the bitmap info header memory */
- free(pPixmapPriv->pbmih);
- pPixmapPriv->pbmih = NULL;
-
- /* Free the pixmap memory */
- free (pPixmap);
- pPixmap = NULL;
-
- return TRUE;
-}
-
-
-/*
- * Not used yet
- */
-
-Bool
-winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
- int iWidth, int iHeight,
- int iDepth,
- int iBitsPerPixel,
- int devKind,
- pointer pPixData)
-{
- FatalError ("winModifyPixmapHeaderNativeGDI ()\n");
- return TRUE;
-}
-
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: drewry, september 1986
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+/*
+ * Local prototypes
+ */
+
+#if 0
+static void
+ winXRotatePixmapNativeGDI(PixmapPtr pPix, int rw);
+
+static void
+ winYRotatePixmapNativeGDI(PixmapPtr pPix, int rh);
+
+static void
+
+winCopyRotatePixmapNativeGDI(PixmapPtr psrcPix, PixmapPtr *ppdstPix,
+ int xrot, int yrot);
+#endif
+
+/* See Porting Layer Definition - p. 34 */
+/* See mfb/mfbpixmap.c - mfbCreatePixmap() */
+PixmapPtr
+winCreatePixmapNativeGDI(ScreenPtr pScreen,
+ int iWidth, int iHeight,
+ int iDepth, unsigned usage_hint)
+{
+ winPrivPixmapPtr pPixmapPriv = NULL;
+ PixmapPtr pPixmap = NULL;
+
+ /* Allocate pixmap memory */
+ pPixmap = AllocatePixmap(pScreen, 0);
+ if (!pPixmap) {
+ ErrorF("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n");
+ return NullPixmap;
+ }
+
+ winDebug("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n",
+ iWidth, iHeight, iDepth, usage_hint,
+ PixmapBytePad(iWidth, iDepth));
+
+ /* Setup pixmap values */
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = iDepth;
+ pPixmap->drawable.bitsPerPixel = BitsPerPixel(iDepth);
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = iWidth;
+ pPixmap->drawable.height = iHeight;
+ pPixmap->devKind = 0;
+ pPixmap->refcnt = 1;
+ pPixmap->devPrivate.ptr = NULL;
+ pPixmap->usage_hint = usage_hint;
+
+ /* Pixmap privates are allocated by AllocatePixmap */
+ pPixmapPriv = winGetPixmapPriv(pPixmap);
+
+ /* Initialize pixmap privates */
+ pPixmapPriv->hBitmap = NULL;
+ pPixmapPriv->hdcSelected = NULL;
+ pPixmapPriv->pbBits = NULL;
+ pPixmapPriv->dwScanlineBytes = PixmapBytePad(iWidth, iDepth);
+
+ /* Check for zero width or height pixmaps */
+ if (iWidth == 0 || iHeight == 0) {
+ /* Don't allocate a real pixmap, just set fields and return */
+ return pPixmap;
+ }
+
+ /* Create a DIB for the pixmap */
+ pPixmapPriv->hBitmap = winCreateDIBNativeGDI(iWidth, iHeight, iDepth,
+ &pPixmapPriv->pbBits,
+ (BITMAPINFO **) & pPixmapPriv->
+ pbmih);
+
+ winDebug("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for "
+ "screen: %08x\n",
+ pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen);
+
+ return pPixmap;
+}
+
+/*
+ * See Porting Layer Definition - p. 35
+ *
+ * See mfb/mfbpixmap.c - mfbDestroyPixmap()
+ */
+
+Bool
+winDestroyPixmapNativeGDI(PixmapPtr pPixmap)
+{
+ winPrivPixmapPtr pPixmapPriv = NULL;
+
+ winDebug("winDestroyPixmapNativeGDI ()\n");
+
+ /* Bail early if there is not a pixmap to destroy */
+ if (pPixmap == NULL) {
+ ErrorF("winDestroyPixmapNativeGDI () - No pixmap to destroy\n");
+ return TRUE;
+ }
+
+ /* Get a handle to the pixmap privates */
+ pPixmapPriv = winGetPixmapPriv(pPixmap);
+
+ winDebug("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
+ pPixmapPriv->hBitmap);
+
+ /* Decrement reference count, return if nonzero */
+ --pPixmap->refcnt;
+ if (pPixmap->refcnt != 0)
+ return TRUE;
+
+ /* Free GDI bitmap */
+ if (pPixmapPriv->hBitmap)
+ DeleteObject(pPixmapPriv->hBitmap);
+
+ /* Free the bitmap info header memory */
+ free(pPixmapPriv->pbmih);
+ pPixmapPriv->pbmih = NULL;
+
+ /* Free the pixmap memory */
+ free(pPixmap);
+ pPixmap = NULL;
+
+ return TRUE;
+}
+
+/*
+ * Not used yet
+ */
+
+Bool
+winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap,
+ int iWidth, int iHeight,
+ int iDepth,
+ int iBitsPerPixel, int devKind, pointer pPixData)
+{
+ FatalError("winModifyPixmapHeaderNativeGDI ()\n");
+ return TRUE;
+}
+
diff --git a/xorg-server/hw/xwin/winpolyline.c b/xorg-server/hw/xwin/winpolyline.c
index bf98d73ec..ce7c8de28 100644
--- a/xorg-server/hw/xwin/winpolyline.c
+++ b/xorg-server/hw/xwin/winpolyline.c
@@ -35,23 +35,19 @@
/* See Porting Layer Definition - p. 50 */
void
-winPolyLineNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
+winPolyLineNativeGDI(DrawablePtr pDrawable,
+ GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
{
- switch (pGC->lineStyle)
- {
+ switch (pGC->lineStyle) {
case LineSolid:
- if (pGC->lineWidth == 0)
- miZeroLine (pDrawable, pGC, mode, npt, ppt);
- else
- miWideLine (pDrawable, pGC, mode, npt, ppt);
- break;
+ if (pGC->lineWidth == 0)
+ miZeroLine (pDrawable, pGC, mode, npt, ppt);
+ else
+ miWideLine(pDrawable, pGC, mode, npt, ppt);
+ break;
case LineOnOffDash:
case LineDoubleDash:
- miWideDash (pDrawable, pGC, mode, npt, ppt);
- break;
+ miWideDash(pDrawable, pGC, mode, npt, ppt);
+ break;
}
}
diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c
index 8c738e515..8f403cec3 100644
--- a/xorg-server/hw/xwin/winprefs.c
+++ b/xorg-server/hw/xwin/winprefs.c
@@ -54,165 +54,142 @@ extern const char *winGetBaseDir(void);
extern const char *g_pszLogFile;
/* From winprefslex.l, the real parser */
-extern int parse_file (FILE *fp);
-
+extern int parse_file(FILE * fp);
/* Currently in use command ID, incremented each new menu item created */
static int g_cmdid = STARTMENUID;
-
/* Defined in DIX */
extern char *display;
/* Local function to handle comma-ified icon names */
-static HICON
-LoadImageComma (char *fname, int sx, int sy, int flags);
-
+static HICON LoadImageComma(char *fname, int sx, int sy, int flags);
/*
* Creates or appends a menu from a MENUPARSED structure
*/
static HMENU
-MakeMenu (char *name,
- HMENU editMenu,
- int editItem)
+MakeMenu(char *name, HMENU editMenu, int editItem)
{
- int i;
- int item;
- MENUPARSED *m;
- HMENU hmenu, hsub;
-
- for (i=0; i<pref.menuItems; i++)
- {
- if (!strcmp(name, pref.menu[i].menuName))
- break;
+ int i;
+ int item;
+ MENUPARSED *m;
+ HMENU hmenu, hsub;
+
+ for (i = 0; i < pref.menuItems; i++) {
+ if (!strcmp(name, pref.menu[i].menuName))
+ break;
}
-
- /* Didn't find a match, bummer */
- if (i==pref.menuItems)
- {
- ErrorF("MakeMenu: Can't find menu %s\n", name);
- return NULL;
+
+ /* Didn't find a match, bummer */
+ if (i == pref.menuItems) {
+ ErrorF("MakeMenu: Can't find menu %s\n", name);
+ return NULL;
}
-
- m = &(pref.menu[i]);
- if (editMenu)
- {
- hmenu = editMenu;
- item = editItem;
+ m = &(pref.menu[i]);
+
+ if (editMenu) {
+ hmenu = editMenu;
+ item = editItem;
}
- else
- {
- hmenu = CreatePopupMenu();
- if (!hmenu)
- {
- ErrorF("MakeMenu: Unable to CreatePopupMenu() %s\n", name);
- return NULL;
- }
- item = 0;
+ else {
+ hmenu = CreatePopupMenu();
+ if (!hmenu) {
+ ErrorF("MakeMenu: Unable to CreatePopupMenu() %s\n", name);
+ return NULL;
+ }
+ item = 0;
}
- /* Add the menu items */
- for (i=0; i<m->menuItems; i++)
- {
- /* Only assign IDs one time... */
- if ( m->menuItem[i].commandID == 0 )
- m->menuItem[i].commandID = g_cmdid++;
-
- switch (m->menuItem[i].cmd)
- {
- case CMD_EXEC:
- case CMD_ALWAYSONTOP:
- case CMD_RELOAD:
- InsertMenu (hmenu,
- item,
- MF_BYPOSITION|MF_ENABLED|MF_STRING,
- m->menuItem[i].commandID,
- m->menuItem[i].text);
- break;
-
- case CMD_SEPARATOR:
- InsertMenu (hmenu,
- item,
- MF_BYPOSITION|MF_SEPARATOR,
- 0,
- NULL);
- break;
-
- case CMD_MENU:
- /* Recursive! */
- hsub = MakeMenu (m->menuItem[i].param, 0, 0);
- if (hsub)
- InsertMenu (hmenu,
- item,
- MF_BYPOSITION|MF_POPUP|MF_ENABLED|MF_STRING,
- (UINT_PTR)hsub,
- m->menuItem[i].text);
- break;
- }
-
- /* If item==-1 (means to add at end of menu) don't increment) */
- if (item>=0)
- item++;
+ /* Add the menu items */
+ for (i = 0; i < m->menuItems; i++) {
+ /* Only assign IDs one time... */
+ if (m->menuItem[i].commandID == 0)
+ m->menuItem[i].commandID = g_cmdid++;
+
+ switch (m->menuItem[i].cmd) {
+ case CMD_EXEC:
+ case CMD_ALWAYSONTOP:
+ case CMD_RELOAD:
+ InsertMenu(hmenu,
+ item,
+ MF_BYPOSITION | MF_ENABLED | MF_STRING,
+ m->menuItem[i].commandID, m->menuItem[i].text);
+ break;
+
+ case CMD_SEPARATOR:
+ InsertMenu(hmenu, item, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
+ break;
+
+ case CMD_MENU:
+ /* Recursive! */
+ hsub = MakeMenu(m->menuItem[i].param, 0, 0);
+ if (hsub)
+ InsertMenu(hmenu,
+ item,
+ MF_BYPOSITION | MF_POPUP | MF_ENABLED | MF_STRING,
+ (UINT_PTR) hsub, m->menuItem[i].text);
+ break;
+ }
+
+ /* If item==-1 (means to add at end of menu) don't increment) */
+ if (item >= 0)
+ item++;
}
- return hmenu;
+ return hmenu;
}
-
#ifdef XWIN_MULTIWINDOW
/*
* Callback routine that is executed once per window class.
* Removes or creates custom window settings depending on LPARAM
*/
static wBOOL CALLBACK
-ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
+ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam)
{
- HICON hicon;
- Window wid;
+ HICON hicon;
+ Window wid;
- if (!hwnd) {
- ErrorF("ReloadEnumWindowsProc: hwnd==NULL!\n");
- return FALSE;
- }
+ if (!hwnd) {
+ ErrorF("ReloadEnumWindowsProc: hwnd==NULL!\n");
+ return FALSE;
+ }
- /* It's our baby, either clean or dirty it */
- if (lParam==FALSE)
- {
- /* Reset the window's icon to undefined. */
- hicon = (HICON)SendMessage(hwnd, WM_SETICON, ICON_BIG, 0);
+ /* It's our baby, either clean or dirty it */
+ if (lParam == FALSE) {
+ /* Reset the window's icon to undefined. */
+ hicon = (HICON) SendMessage(hwnd, WM_SETICON, ICON_BIG, 0);
- /* If the old icon is generated on-the-fly, get rid of it, will regen */
- winDestroyIcon (hicon);
+ /* If the old icon is generated on-the-fly, get rid of it, will regen */
+ winDestroyIcon(hicon);
- /* Same for the small icon */
- hicon = (HICON)SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0);
- winDestroyIcon (hicon);
+ /* Same for the small icon */
+ hicon = (HICON) SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0);
+ winDestroyIcon(hicon);
- /* Remove any menu additions; bRevert=TRUE destroys any modified menus */
- GetSystemMenu (hwnd, TRUE);
-
- /* This window is now clean of our taint (but with undefined icons) */
+ /* Remove any menu additions; bRevert=TRUE destroys any modified menus */
+ GetSystemMenu(hwnd, TRUE);
+
+ /* This window is now clean of our taint (but with undefined icons) */
}
- else
- {
- /* winUpdateIcon() will set the icon default, dynamic, or from xwinrc */
- wid = (Window)GetProp (hwnd, WIN_WID_PROP);
- if (wid)
- winUpdateIcon (wid);
+ else {
+ /* winUpdateIcon() will set the icon default, dynamic, or from xwinrc */
+ wid = (Window) GetProp(hwnd, WIN_WID_PROP);
+ if (wid)
+ winUpdateIcon(wid);
- /* Update the system menu for this window */
- SetupSysMenu ((unsigned long)hwnd);
+ /* Update the system menu for this window */
+ SetupSysMenu((unsigned long) hwnd);
- /* That was easy... */
+ /* That was easy... */
}
- return TRUE;
+ return TRUE;
}
#endif
-
/*
* Removes any custom icons in classes, custom menus, etc.
* Frees all members in pref structure.
@@ -220,353 +197,327 @@ ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
* Set custom icons and menus again.
*/
static void
-ReloadPrefs (void)
+ReloadPrefs(void)
{
- int i;
+ int i;
#ifdef XWIN_MULTIWINDOW
- /* First, iterate over all windows, deleting their icons and custom menus.
- * This is really only needed because winDestroyIcon() will try to
- * destroy the old global icons, which will have changed.
- * It is probably better to set a windows USER_DATA to flag locally defined
- * icons, and use that to accurately know when to destroy old icons.
- */
- EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE);
+ /* First, iterate over all windows, deleting their icons and custom menus.
+ * This is really only needed because winDestroyIcon() will try to
+ * destroy the old global icons, which will have changed.
+ * It is probably better to set a windows USER_DATA to flag locally defined
+ * icons, and use that to accurately know when to destroy old icons.
+ */
+ EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE);
#endif
-
- /* Now, free/clear all info from our prefs structure */
- for (i=0; i<pref.menuItems; i++)
- free (pref.menu[i].menuItem);
- free (pref.menu);
- pref.menu = NULL;
- pref.menuItems = 0;
-
- pref.rootMenuName[0] = 0;
-
- free (pref.sysMenu);
- pref.sysMenuItems = 0;
-
- pref.defaultSysMenuName[0] = 0;
- pref.defaultSysMenuPos = 0;
-
- pref.iconDirectory[0] = 0;
- pref.defaultIconName[0] = 0;
- pref.trayIconName[0] = 0;
-
- for (i=0; i<pref.iconItems; i++)
- if (pref.icon[i].hicon)
- DestroyIcon ((HICON)pref.icon[i].hicon);
- free (pref.icon);
- pref.icon = NULL;
- pref.iconItems = 0;
-
- /* Free global default X icon */
- if (g_hIconX)
- DestroyIcon (g_hIconX);
- if (g_hSmallIconX)
- DestroyIcon (g_hSmallIconX);
-
- /* Reset the custom command IDs */
- g_cmdid = STARTMENUID;
-
- /* Load the updated resource file */
- LoadPreferences();
-
- g_hIconX = NULL;
- g_hSmallIconX = NULL;
+
+ /* Now, free/clear all info from our prefs structure */
+ for (i = 0; i < pref.menuItems; i++)
+ free(pref.menu[i].menuItem);
+ free(pref.menu);
+ pref.menu = NULL;
+ pref.menuItems = 0;
+
+ pref.rootMenuName[0] = 0;
+
+ free(pref.sysMenu);
+ pref.sysMenuItems = 0;
+
+ pref.defaultSysMenuName[0] = 0;
+ pref.defaultSysMenuPos = 0;
+
+ pref.iconDirectory[0] = 0;
+ pref.defaultIconName[0] = 0;
+ pref.trayIconName[0] = 0;
+
+ for (i = 0; i < pref.iconItems; i++)
+ if (pref.icon[i].hicon)
+ DestroyIcon((HICON) pref.icon[i].hicon);
+ free(pref.icon);
+ pref.icon = NULL;
+ pref.iconItems = 0;
+
+ /* Free global default X icon */
+ if (g_hIconX)
+ DestroyIcon(g_hIconX);
+ if (g_hSmallIconX)
+ DestroyIcon(g_hSmallIconX);
+
+ /* Reset the custom command IDs */
+ g_cmdid = STARTMENUID;
+
+ /* Load the updated resource file */
+ LoadPreferences();
+
+ g_hIconX = NULL;
+ g_hSmallIconX = NULL;
#ifdef XWIN_MULTIWINDOW
- winInitGlobalIcons();
+ winInitGlobalIcons();
#endif
-
+
#ifdef XWIN_MULTIWINDOW
- /* Rebuild the icons and menus */
- EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE);
+ /* Rebuild the icons and menus */
+ EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE);
#endif
- /* Whew, done */
+ /* Whew, done */
}
/*
* Check/uncheck the ALWAYSONTOP items in this menu
*/
void
-HandleCustomWM_INITMENU(unsigned long hwndIn,
- unsigned long hmenuIn)
+HandleCustomWM_INITMENU(unsigned long hwndIn, unsigned long hmenuIn)
{
- HWND hwnd;
- HMENU hmenu;
- DWORD dwExStyle;
- int i, j;
-
- hwnd = (HWND)hwndIn;
- hmenu = (HMENU)hmenuIn;
- if (!hwnd || !hmenu)
- return;
-
- if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
- dwExStyle = MF_BYCOMMAND | MF_CHECKED;
- else
- dwExStyle = MF_BYCOMMAND | MF_UNCHECKED;
-
- for (i=0; i<pref.menuItems; i++)
- for (j=0; j<pref.menu[i].menuItems; j++)
- if (pref.menu[i].menuItem[j].cmd==CMD_ALWAYSONTOP)
- CheckMenuItem (hmenu, pref.menu[i].menuItem[j].commandID, dwExStyle );
-
+ HWND hwnd;
+ HMENU hmenu;
+ DWORD dwExStyle;
+ int i, j;
+
+ hwnd = (HWND) hwndIn;
+ hmenu = (HMENU) hmenuIn;
+ if (!hwnd || !hmenu)
+ return;
+
+ if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
+ dwExStyle = MF_BYCOMMAND | MF_CHECKED;
+ else
+ dwExStyle = MF_BYCOMMAND | MF_UNCHECKED;
+
+ for (i = 0; i < pref.menuItems; i++)
+ for (j = 0; j < pref.menu[i].menuItems; j++)
+ if (pref.menu[i].menuItem[j].cmd == CMD_ALWAYSONTOP)
+ CheckMenuItem(hmenu, pref.menu[i].menuItem[j].commandID,
+ dwExStyle);
+
}
-
+
/*
* Searches for the custom WM_COMMAND command ID and performs action.
* Return TRUE if command is proccessed, FALSE otherwise.
*/
Bool
-HandleCustomWM_COMMAND (unsigned long hwndIn,
- int command)
+HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
{
- HWND hwnd;
- int i, j;
- MENUPARSED *m;
- DWORD dwExStyle;
-
- hwnd = (HWND)hwndIn;
-
- if (!command)
- return FALSE;
-
- for (i=0; i<pref.menuItems; i++)
- {
- m = &(pref.menu[i]);
- for (j=0; j<m->menuItems; j++)
- {
- if (command==m->menuItem[j].commandID)
- {
- /* Match! */
- switch(m->menuItem[j].cmd)
- {
+ HWND hwnd;
+ int i, j;
+ MENUPARSED *m;
+ DWORD dwExStyle;
+
+ hwnd = (HWND) hwndIn;
+
+ if (!command)
+ return FALSE;
+
+ for (i = 0; i < pref.menuItems; i++) {
+ m = &(pref.menu[i]);
+ for (j = 0; j < m->menuItems; j++) {
+ if (command == m->menuItem[j].commandID) {
+ /* Match! */
+ switch (m->menuItem[j].cmd) {
#ifdef __CYGWIN__
- case CMD_EXEC:
- if (fork()==0)
- {
- struct rlimit rl;
- unsigned long i;
-
- /* Close any open descriptors except for STD* */
- getrlimit (RLIMIT_NOFILE, &rl);
- for (i = STDERR_FILENO+1; i < rl.rlim_cur; i++)
- close(i);
-
- /* Disassociate any TTYs */
- setsid();
-
- execl ("/bin/sh",
- "/bin/sh",
- "-c",
- m->menuItem[j].param,
- NULL);
- exit (0);
- }
- else
- return TRUE;
- break;
+ case CMD_EXEC:
+ if (fork() == 0) {
+ struct rlimit rl;
+ unsigned long i;
+
+ /* Close any open descriptors except for STD* */
+ getrlimit(RLIMIT_NOFILE, &rl);
+ for (i = STDERR_FILENO + 1; i < rl.rlim_cur; i++)
+ close(i);
+
+ /* Disassociate any TTYs */
+ setsid();
+
+ execl("/bin/sh",
+ "/bin/sh", "-c", m->menuItem[j].param, NULL);
+ exit(0);
+ }
+ else
+ return TRUE;
+ break;
#else
- case CMD_EXEC:
- {
- /* Start process without console window */
- STARTUPINFO start;
- PROCESS_INFORMATION child;
-
- memset (&start, 0, sizeof (start));
- start.cb = sizeof (start);
- //start.dwFlags = STARTF_USESHOWWINDOW;
- //start.wShowWindow = SW_HIDE;
-
- memset (&child, 0, sizeof (child));
-
- if (CreateProcess (NULL, m->menuItem[j].param, NULL, NULL, FALSE, 0,
- NULL, NULL, &start, &child))
- {
- CloseHandle (child.hThread);
- CloseHandle (child.hProcess);
- }
- else
- MessageBox(NULL, m->menuItem[j].param, "VcXsrv Exec Command Error!", MB_OK | MB_ICONEXCLAMATION);
- }
- return TRUE;
+ case CMD_EXEC:
+ {
+ /* Start process without console window */
+ STARTUPINFO start;
+ PROCESS_INFORMATION child;
+
+ memset(&start, 0, sizeof(start));
+ start.cb = sizeof(start);
+ //start.dwFlags = STARTF_USESHOWWINDOW;
+ //start.wShowWindow = SW_HIDE;
+
+ memset(&child, 0, sizeof(child));
+
+ if (CreateProcess
+ (NULL, m->menuItem[j].param, NULL, NULL, FALSE, 0, NULL,
+ NULL, &start, &child)) {
+ CloseHandle(child.hThread);
+ CloseHandle(child.hProcess);
+ }
+ else
+ MessageBox(NULL, m->menuItem[j].param,
+ "VcXsrv Exec Command Error!",
+ MB_OK | MB_ICONEXCLAMATION);
+ }
+ return TRUE;
#endif
- case CMD_ALWAYSONTOP:
- if (!hwnd)
- return FALSE;
-
- /* Get extended window style */
- dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
-
- /* Handle topmost windows */
- if (dwExStyle & WS_EX_TOPMOST)
- SetWindowPos (hwnd,
- HWND_NOTOPMOST,
- 0, 0,
- 0, 0,
- SWP_NOSIZE | SWP_NOMOVE);
- else
- SetWindowPos (hwnd,
- HWND_TOPMOST,
- 0, 0,
- 0, 0,
- SWP_NOSIZE | SWP_NOMOVE);
+ case CMD_ALWAYSONTOP:
+ if (!hwnd)
+ return FALSE;
+
+ /* Get extended window style */
+ dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
+
+ /* Handle topmost windows */
+ if (dwExStyle & WS_EX_TOPMOST)
+ SetWindowPos(hwnd,
+ HWND_NOTOPMOST,
+ 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
+ else
+ SetWindowPos(hwnd,
+ HWND_TOPMOST,
+ 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
#if XWIN_MULTIWINDOW
- /* Reflect the changed Z order */
- winReorderWindowsMultiWindow ();
+ /* Reflect the changed Z order */
+ winReorderWindowsMultiWindow();
#endif
- return TRUE;
-
- case CMD_RELOAD:
- ReloadPrefs();
- return TRUE;
-
- default:
- return FALSE;
- }
- } /* match */
- } /* for j */
- } /* for i */
-
- return FALSE;
-}
+ return TRUE;
+ case CMD_RELOAD:
+ ReloadPrefs();
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+ } /* match */
+ } /* for j */
+ } /* for i */
+
+ return FALSE;
+}
#ifdef XWIN_MULTIWINDOW
/*
* Add the default or a custom menu depending on the class match
*/
void
-SetupSysMenu (unsigned long hwndIn)
+SetupSysMenu(unsigned long hwndIn)
{
- HWND hwnd;
- HMENU sys;
- int i;
- WindowPtr pWin;
- char *res_name, *res_class;
-
- hwnd = (HWND)hwndIn;
- if (!hwnd)
- return;
-
- pWin = GetProp (hwnd, WIN_WINDOW_PROP);
-
- sys = GetSystemMenu (hwnd, FALSE);
- if (!sys)
- return;
-
- if (pWin)
- {
- /* First see if there's a class match... */
- if (winMultiWindowGetClassHint (pWin, &res_name, &res_class))
- {
- for (i=0; i<pref.sysMenuItems; i++)
- {
- if (!strcmp(pref.sysMenu[i].match, res_name) ||
- !strcmp(pref.sysMenu[i].match, res_class) )
- {
- free(res_name);
- free(res_class);
-
- MakeMenu (pref.sysMenu[i].menuName, sys,
- pref.sysMenu[i].menuPos==AT_START?0:-1);
- return;
- }
- }
-
- /* No match, just free alloc'd strings */
- free(res_name);
- free(res_class);
- } /* Found wm_class */
- } /* if pwin */
-
- /* Fallback to system default */
- if (pref.defaultSysMenuName[0])
- {
- if (pref.defaultSysMenuPos==AT_START)
- MakeMenu (pref.defaultSysMenuName, sys, 0);
- else
- MakeMenu (pref.defaultSysMenuName, sys, -1);
+ HWND hwnd;
+ HMENU sys;
+ int i;
+ WindowPtr pWin;
+ char *res_name, *res_class;
+
+ hwnd = (HWND) hwndIn;
+ if (!hwnd)
+ return;
+
+ pWin = GetProp(hwnd, WIN_WINDOW_PROP);
+
+ sys = GetSystemMenu(hwnd, FALSE);
+ if (!sys)
+ return;
+
+ if (pWin) {
+ /* First see if there's a class match... */
+ if (winMultiWindowGetClassHint(pWin, &res_name, &res_class)) {
+ for (i = 0; i < pref.sysMenuItems; i++) {
+ if (!strcmp(pref.sysMenu[i].match, res_name) ||
+ !strcmp(pref.sysMenu[i].match, res_class)) {
+ free(res_name);
+ free(res_class);
+
+ MakeMenu(pref.sysMenu[i].menuName, sys,
+ pref.sysMenu[i].menuPos == AT_START ? 0 : -1);
+ return;
+ }
+ }
+
+ /* No match, just free alloc'd strings */
+ free(res_name);
+ free(res_class);
+ } /* Found wm_class */
+ } /* if pwin */
+
+ /* Fallback to system default */
+ if (pref.defaultSysMenuName[0]) {
+ if (pref.defaultSysMenuPos == AT_START)
+ MakeMenu(pref.defaultSysMenuName, sys, 0);
+ else
+ MakeMenu(pref.defaultSysMenuName, sys, -1);
}
}
#endif
-
/*
* Possibly add a menu to the toolbar icon
*/
void
-SetupRootMenu (unsigned long hmenuRoot)
+SetupRootMenu(unsigned long hmenuRoot)
{
- HMENU root;
+ HMENU root;
- root = (HMENU)hmenuRoot;
- if (!root)
- return;
+ root = (HMENU) hmenuRoot;
+ if (!root)
+ return;
- if (pref.rootMenuName[0])
- {
- MakeMenu(pref.rootMenuName, root, 0);
+ if (pref.rootMenuName[0]) {
+ MakeMenu(pref.rootMenuName, root, 0);
}
}
-
/*
* Check for and return an overridden default ICON specified in the prefs
*/
HICON
winOverrideDefaultIcon(int size)
{
- HICON hicon;
-
- if (pref.defaultIconName[0])
- {
- hicon = LoadImageComma (pref.defaultIconName, size, size, 0);
- if (hicon==NULL)
- ErrorF ("winOverrideDefaultIcon: LoadImageComma(%s) failed\n",
- pref.defaultIconName);
-
- return hicon;
+ HICON hicon;
+
+ if (pref.defaultIconName[0]) {
+ hicon = LoadImageComma(pref.defaultIconName, size, size, 0);
+ if (hicon == NULL)
+ ErrorF("winOverrideDefaultIcon: LoadImageComma(%s) failed\n",
+ pref.defaultIconName);
+
+ return hicon;
}
- return 0;
+ return 0;
}
-
/*
* Return the HICON to use in the taskbar notification area
*/
HICON
winTaskbarIcon(void)
{
- HICON hicon;
-
- hicon = 0;
- /* First try and load an overridden, if success then return it */
- if (pref.trayIconName[0])
- {
- hicon = LoadImageComma (pref.trayIconName,
- GetSystemMetrics (SM_CXSMICON),
- GetSystemMetrics (SM_CYSMICON),
- 0 );
+ HICON hicon;
+
+ hicon = 0;
+ /* First try and load an overridden, if success then return it */
+ if (pref.trayIconName[0]) {
+ hicon = LoadImageComma(pref.trayIconName,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), 0);
}
- /* Otherwise return the default */
- if (!hicon)
- hicon = (HICON) LoadImage (g_hInstance,
- MAKEINTRESOURCE(IDI_XWIN),
- IMAGE_ICON,
- GetSystemMetrics (SM_CXSMICON),
- GetSystemMetrics (SM_CYSMICON),
- 0);
+ /* Otherwise return the default */
+ if (!hicon)
+ hicon = (HICON) LoadImage(g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN),
+ IMAGE_ICON,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), 0);
- return hicon;
+ return hicon;
}
-
/*
* Parse a filename to extract an icon:
* If fname is exactly ",nnn" then extract icon from our resource
@@ -574,64 +525,53 @@ winTaskbarIcon(void)
* else try to load it as an .ico file and if that fails return NULL
*/
static HICON
-LoadImageComma (char *fname, int sx, int sy, int flags)
+LoadImageComma(char *fname, int sx, int sy, int flags)
{
- HICON hicon;
- int index;
- char file[PATH_MAX+NAME_MAX+2];
-
- /* Some input error checking */
- if (!fname || !fname[0])
- return NULL;
-
- index = 0;
- hicon = NULL;
-
- if (fname[0]==',')
- {
- /* It's the XWIN.EXE resource they want */
- index = atoi (fname+1);
- hicon = LoadImage (g_hInstance,
- MAKEINTRESOURCE(index),
- IMAGE_ICON,
- sx,
- sy,
- flags);
+ HICON hicon;
+ int index;
+ char file[PATH_MAX + NAME_MAX + 2];
+
+ /* Some input error checking */
+ if (!fname || !fname[0])
+ return NULL;
+
+ index = 0;
+ hicon = NULL;
+
+ if (fname[0] == ',') {
+ /* It's the XWIN.EXE resource they want */
+ index = atoi(fname + 1);
+ hicon = LoadImage(g_hInstance,
+ MAKEINTRESOURCE(index), IMAGE_ICON, sx, sy, flags);
}
- else
- {
- file[0] = 0;
- /* Prepend path if not given a "X:\" filename */
- if ( !(fname[0] && fname[1]==':' && fname[2]=='\\') )
- {
- strcpy (file, pref.iconDirectory);
- if (pref.iconDirectory[0])
- if (fname[strlen(fname)-1]!='\\')
- strcat (file, "\\");
+ else {
+ file[0] = 0;
+ /* Prepend path if not given a "X:\" filename */
+ if (!(fname[0] && fname[1] == ':' && fname[2] == '\\')) {
+ strcpy(file, pref.iconDirectory);
+ if (pref.iconDirectory[0])
+ if (fname[strlen(fname) - 1] != '\\')
+ strcat(file, "\\");
+ }
+ strcat(file, fname);
+
+ if (strrchr(file, ',')) {
+ /* Specified as <fname>,<index> */
+
+ *(strrchr(file, ',')) = 0; /* End string at comma */
+ index = atoi(strrchr(fname, ',') + 1);
+ hicon = ExtractIcon(g_hInstance, file, index);
+ }
+ else {
+ /* Just an .ico file... */
+
+ hicon = (HICON) LoadImage(NULL,
+ file,
+ IMAGE_ICON,
+ sx, sy, LR_LOADFROMFILE | flags);
}
- strcat (file, fname);
-
- if (strrchr (file, ','))
- {
- /* Specified as <fname>,<index> */
-
- *(strrchr (file, ',')) = 0; /* End string at comma */
- index = atoi (strrchr (fname, ',') + 1);
- hicon = ExtractIcon (g_hInstance, file, index);
- }
- else
- {
- /* Just an .ico file... */
-
- hicon = (HICON)LoadImage (NULL,
- file,
- IMAGE_ICON,
- sx,
- sy,
- LR_LOADFROMFILE|flags);
- }
}
- return hicon;
+ return hicon;
}
/*
@@ -639,54 +579,52 @@ LoadImageComma (char *fname, int sx, int sy, int flags)
* ICONS{} section in the prefs file, and load the icon from a file
*/
HICON
-winOverrideIcon (unsigned long longWin)
+winOverrideIcon(unsigned long longWin)
{
- WindowPtr pWin = (WindowPtr) longWin;
- char *res_name, *res_class;
- int i;
- HICON hicon;
- char *wmName;
+ WindowPtr pWin = (WindowPtr) longWin;
+ char *res_name, *res_class;
+ int i;
+ HICON hicon;
+ char *wmName;
+
+ if (pWin == NULL)
+ return 0;
+
+ /* If we can't find the class, we can't override from default! */
+ if (!winMultiWindowGetClassHint(pWin, &res_name, &res_class))
+ return 0;
+
+ winMultiWindowGetWMName(pWin, &wmName);
+
+ for (i = 0; i < pref.iconItems; i++) {
+ if (!strcmp(pref.icon[i].match, res_name) ||
+ !strcmp(pref.icon[i].match, res_class) ||
+ (wmName && strstr(wmName, pref.icon[i].match))) {
+ free(res_name);
+ free(res_class);
+ free(wmName);
+
+ if (pref.icon[i].hicon)
+ return pref.icon[i].hicon;
+
+ hicon = LoadImageComma(pref.icon[i].iconFile, 0, 0, LR_DEFAULTSIZE);
+ if (hicon == NULL)
+ ErrorF("winOverrideIcon: LoadImageComma(%s) failed\n",
+ pref.icon[i].iconFile);
+
+ pref.icon[i].hicon = hicon;
+ return hicon;
+ }
+ }
- if (pWin==NULL)
- return 0;
+ /* Didn't find the icon, fail gracefully */
+ free(res_name);
+ free(res_class);
+ free(wmName);
- /* If we can't find the class, we can't override from default! */
- if (!winMultiWindowGetClassHint (pWin, &res_name, &res_class))
return 0;
-
- winMultiWindowGetWMName (pWin, &wmName);
-
- for (i=0; i<pref.iconItems; i++) {
- if (!strcmp(pref.icon[i].match, res_name) ||
- !strcmp(pref.icon[i].match, res_class) ||
- (wmName && strstr(wmName, pref.icon[i].match)))
- {
- free (res_name);
- free (res_class);
- free(wmName);
-
- if (pref.icon[i].hicon)
- return pref.icon[i].hicon;
-
- hicon = LoadImageComma (pref.icon[i].iconFile, 0, 0, LR_DEFAULTSIZE);
- if (hicon==NULL)
- ErrorF ("winOverrideIcon: LoadImageComma(%s) failed\n",
- pref.icon[i].iconFile);
-
- pref.icon[i].hicon = hicon;
- return hicon;
- }
- }
-
- /* Didn't find the icon, fail gracefully */
- free (res_name);
- free (res_class);
- free(wmName);
-
- return 0;
}
-
/*
* Should we free this icon or leave it in memory (is it part of our
* ICONS{} overrides)?
@@ -694,187 +632,168 @@ winOverrideIcon (unsigned long longWin)
int
winIconIsOverride(unsigned hiconIn)
{
- HICON hicon;
- int i;
+ HICON hicon;
+ int i;
- hicon = (HICON)hiconIn;
+ hicon = (HICON) hiconIn;
- if (!hicon)
- return 0;
-
- for (i=0; i<pref.iconItems; i++)
- if ((HICON)pref.icon[i].hicon == hicon)
- return 1;
-
- return 0;
-}
+ if (!hicon)
+ return 0;
+ for (i = 0; i < pref.iconItems; i++)
+ if ((HICON) pref.icon[i].hicon == hicon)
+ return 1;
+ return 0;
+}
/*
* Open and parse the XWinrc config file @path.
* If @path is NULL, use the built-in default.
*/
static int
-winPrefsLoadPreferences (char *path)
+winPrefsLoadPreferences(char *path)
{
- FILE *prefFile = NULL;
+ FILE *prefFile = NULL;
- if (path)
- prefFile = fopen (path, "r");
+ if (path)
+ prefFile = fopen(path, "r");
#ifndef _MSC_VER
- else
- {
- char defaultPrefs[] =
- "MENU rmenu {\n"
- " \"How to customize this menu\" EXEC \"xterm +tb -e man XWinrc\"\n"
- " \"Launch xterm\" EXEC xterm\n"
- " \"Load .XWinrc\" RELOAD\n"
- " SEPARATOR\n"
- "}\n"
- "\n"
- "ROOTMENU rmenu\n";
-
- path = "built-in default";
- prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r");
+ else {
+ char defaultPrefs[] =
+ "MENU rmenu {\n"
+ " \"How to customize this menu\" EXEC \"xterm +tb -e man XWinrc\"\n"
+ " \"Launch xterm\" EXEC xterm\n"
+ " \"Load .XWinrc\" RELOAD\n"
+ " SEPARATOR\n" "}\n" "\n" "ROOTMENU rmenu\n";
+
+ path = "built-in default";
+ prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r");
}
#endif
- if (!prefFile)
- {
- ErrorF ("LoadPreferences: %s not found\n", path);
- return FALSE;
+ if (!prefFile) {
+ ErrorF("LoadPreferences: %s not found\n", path);
+ return FALSE;
}
- ErrorF ("LoadPreferences: Loading %s\n", path);
+ ErrorF("LoadPreferences: Loading %s\n", path);
- if((parse_file (prefFile)) != 0)
- {
- ErrorF ("LoadPreferences: %s is badly formed!\n", path);
- fclose (prefFile);
- return FALSE;
+ if ((parse_file(prefFile)) != 0) {
+ ErrorF("LoadPreferences: %s is badly formed!\n", path);
+ fclose(prefFile);
+ return FALSE;
}
- fclose (prefFile);
- return TRUE;
+ fclose(prefFile);
+ return TRUE;
}
-
-
/*
* Try and open ~/.XWinrc and system.XWinrc
* Load it into prefs structure for use by other functions
*/
void
-LoadPreferences (void)
+LoadPreferences(void)
{
- char *home;
- char fname[PATH_MAX+NAME_MAX+2];
- char szDisplay[512];
- char *szEnvDisplay;
- int i, j;
- char param[PARAM_MAX+1];
- char *srcParam, *dstParam;
- int parsed = FALSE;
-
- /* First, clear all preference settings */
- memset (&pref, 0, sizeof(pref));
-
- /* Now try and find a ~/.xwinrc file */
- home = getenv ("HOME");
- if (home)
- {
- strcpy (fname, home);
- if (fname[strlen(fname)-1]!='/')
- strcat (fname, "/");
- strcat (fname, ".XWinrc");
- parsed = winPrefsLoadPreferences(fname);
+ char *home;
+ char fname[PATH_MAX + NAME_MAX + 2];
+ char szDisplay[512];
+ char *szEnvDisplay;
+ int i, j;
+ char param[PARAM_MAX + 1];
+ char *srcParam, *dstParam;
+ int parsed = FALSE;
+
+ /* First, clear all preference settings */
+ memset(&pref, 0, sizeof(pref));
+
+ /* Now try and find a ~/.xwinrc file */
+ home = getenv("HOME");
+ if (home) {
+ strcpy(fname, home);
+ if (fname[strlen(fname) - 1] != '/')
+ strcat(fname, "/");
+ strcat(fname, ".XWinrc");
+ parsed = winPrefsLoadPreferences(fname);
}
- /* No home file found, check system default */
- if (!parsed)
- {
- char buffer[MAX_PATH];
+ /* No home file found, check system default */
+ if (!parsed) {
+ char buffer[MAX_PATH];
+
#ifdef RELOCATE_PROJECTROOT
- snprintf(buffer, sizeof(buffer), "%s\\system.XWinrc", winGetBaseDir());
+ snprintf(buffer, sizeof(buffer), "%s\\system.XWinrc", winGetBaseDir());
#else
- strncpy(buffer, SYSCONFDIR"/X11/system.XWinrc", sizeof(buffer));
+ strncpy(buffer, SYSCONFDIR "/X11/system.XWinrc", sizeof(buffer));
#endif
- buffer[sizeof(buffer)-1] = 0;
- parsed = winPrefsLoadPreferences(buffer);
+ buffer[sizeof(buffer) - 1] = 0;
+ parsed = winPrefsLoadPreferences(buffer);
}
- /* Neither user nor system configuration found, or were badly formed */
- if (!parsed)
- {
- ErrorF ("LoadPreferences: See \"man XWinrc\" to customize the XWin menu.\n");
- parsed = winPrefsLoadPreferences(NULL);
+ /* Neither user nor system configuration found, or were badly formed */
+ if (!parsed) {
+ ErrorF
+ ("LoadPreferences: See \"man XWinrc\" to customize the XWin menu.\n");
+ parsed = winPrefsLoadPreferences(NULL);
}
- /* Setup a DISPLAY environment variable, need to allocate on heap */
- /* because putenv doesn't copy the argument... Always use screen 0 */
- winGetDisplayName(szDisplay, 0);
- szEnvDisplay = (char *)(malloc(strlen(szDisplay)+9/*strlen("DISPLAY=")+1*/));
- snprintf(szEnvDisplay, 512, "DISPLAY=%s", szDisplay);
- putenv (szEnvDisplay);
-
- /* Replace any "%display%" in menu commands with display string */
- for (i=0; i<pref.menuItems; i++)
- {
- for (j=0; j<pref.menu[i].menuItems; j++)
- {
- if (pref.menu[i].menuItem[j].cmd==CMD_EXEC)
- {
- srcParam = pref.menu[i].menuItem[j].param;
- dstParam = param;
- while (*srcParam) {
- if (!strncmp(srcParam, "%display%", 9))
- {
- memcpy (dstParam, szDisplay, strlen(szDisplay));
- dstParam += strlen(szDisplay);
- srcParam += 9;
- }
- else if (!strncmp(srcParam, "%logfile%", 9))
- {
- memcpy (dstParam, g_pszLogFile, strlen(g_pszLogFile));
- dstParam += strlen(g_pszLogFile);
- srcParam += 9;
- }
- else
- {
- *dstParam = *srcParam;
- dstParam++;
- srcParam++;
- }
- }
- *dstParam = 0;
- strcpy (pref.menu[i].menuItem[j].param, param);
- } /* cmd==cmd_exec */
- } /* for all menuitems */
- } /* for all menus */
+ /* Setup a DISPLAY environment variable, need to allocate on heap */
+ /* because putenv doesn't copy the argument... Always use screen 0 */
+ winGetDisplayName(szDisplay, 0);
+ szEnvDisplay = (char *)(malloc(strlen(szDisplay)+9/*strlen("DISPLAY=")+1*/));
+ snprintf(szEnvDisplay, 512, "DISPLAY=%s", szDisplay);
+ putenv (szEnvDisplay);
+
+ /* Replace any "%display%" in menu commands with display string */
+ for (i = 0; i < pref.menuItems; i++) {
+ for (j = 0; j < pref.menu[i].menuItems; j++) {
+ if (pref.menu[i].menuItem[j].cmd == CMD_EXEC) {
+ srcParam = pref.menu[i].menuItem[j].param;
+ dstParam = param;
+ while (*srcParam) {
+ if (!strncmp(srcParam, "%display%", 9)) {
+ memcpy(dstParam, szDisplay, strlen(szDisplay));
+ dstParam += strlen(szDisplay);
+ srcParam += 9;
+ }
+ else if (!strncmp(srcParam, "%logfile%", 9)) {
+ memcpy (dstParam, g_pszLogFile, strlen(g_pszLogFile));
+ dstParam += strlen(g_pszLogFile);
+ srcParam += 9;
+ }
+ else {
+ *dstParam = *srcParam;
+ dstParam++;
+ srcParam++;
+ }
+ }
+ *dstParam = 0;
+ strcpy(pref.menu[i].menuItem[j].param, param);
+ } /* cmd==cmd_exec */
+ } /* for all menuitems */
+ } /* for all menus */
}
-
/*
* Check for a match of the window class to one specified in the
* STYLES{} section in the prefs file, and return the style type
*/
unsigned long
-winOverrideStyle (char *res_name, char *res_class, char *wmName)
+winOverrideStyle(char *res_name, char *res_class, char *wmName)
{
- int i;
-
- for (i=0; i<pref.styleItems; i++) {
- if ((res_name && !strcmp(pref.style[i].match, res_name)) ||
- (res_class && !strcmp(pref.style[i].match, res_class)) ||
- (wmName && strstr(wmName, pref.style[i].match)))
- {
- if (pref.style[i].type)
- return pref.style[i].type;
- }
- }
-
- /* Didn't find the style, fail gracefully */
- return STYLE_NONE;
+ int i;
+
+ for (i = 0; i < pref.styleItems; i++) {
+ if ((res_name && !strcmp(pref.style[i].match, res_name)) ||
+ (res_class && !strcmp(pref.style[i].match, res_class)) ||
+ (wmName && strstr(wmName, pref.style[i].match))) {
+ if (pref.style[i].type)
+ return pref.style[i].type;
+ }
+ }
+
+ /* Didn't find the style, fail gracefully */
+ return STYLE_NONE;
}
diff --git a/xorg-server/hw/xwin/winprefs.h b/xorg-server/hw/xwin/winprefs.h
index ecd0a3fbd..fcce8d840 100644
--- a/xorg-server/hw/xwin/winprefs.h
+++ b/xorg-server/hw/xwin/winprefs.h
@@ -45,146 +45,131 @@
#ifndef NAME_MAX
#define NAME_MAX PATH_MAX
#endif
-#define MENU_MAX 128 /* Maximum string length of a menu name or item */
+#define MENU_MAX 128 /* Maximum string length of a menu name or item */
#define PARAM_MAX (4*PATH_MAX) /* Maximum length of a parameter to a MENU */
-
/* Supported commands in a MENU {} statement */
-typedef enum MENUCOMMANDTYPE
-{
- CMD_EXEC, /* /bin/sh -c the parameter */
- CMD_MENU, /* Display a popup menu named param */
- CMD_SEPARATOR, /* Menu separator */
- CMD_ALWAYSONTOP, /* Toggle always-on-top mode */
- CMD_RELOAD /* Reparse the .XWINRC file */
+typedef enum MENUCOMMANDTYPE {
+ CMD_EXEC, /* /bin/sh -c the parameter */
+ CMD_MENU, /* Display a popup menu named param */
+ CMD_SEPARATOR, /* Menu separator */
+ CMD_ALWAYSONTOP, /* Toggle always-on-top mode */
+ CMD_RELOAD /* Reparse the .XWINRC file */
} MENUCOMMANDTYPE;
-#define STYLE_NONE (0L) /* Dummy the first entry */
-#define STYLE_NOTITLE (1L) /* Force window style no titlebar */
-#define STYLE_OUTLINE (1L<<1) /* Force window style just thin-line border */
-#define STYLE_NOFRAME (1L<<2) /* Force window style no frame */
-#define STYLE_TOPMOST (1L<<3) /* Open a window always-on-top */
-#define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */
-#define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */
-#define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */
+#define STYLE_NONE (0L) /* Dummy the first entry */
+#define STYLE_NOTITLE (1L) /* Force window style no titlebar */
+#define STYLE_OUTLINE (1L<<1) /* Force window style just thin-line border */
+#define STYLE_NOFRAME (1L<<2) /* Force window style no frame */
+#define STYLE_TOPMOST (1L<<3) /* Open a window always-on-top */
+#define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */
+#define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */
+#define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */
/* Where to place a system menu */
-typedef enum MENUPOSITION
-{
- AT_START, /* Place menu at the top of the system menu */
- AT_END /* Put it at the bottom of the menu (default) */
+typedef enum MENUPOSITION {
+ AT_START, /* Place menu at the top of the system menu */
+ AT_END /* Put it at the bottom of the menu (default) */
} MENUPOSITION;
/* Menu item definitions */
-typedef struct MENUITEM
-{
- char text[MENU_MAX+1]; /* To be displayed in menu */
- MENUCOMMANDTYPE cmd; /* What should it do? */
- char param[PARAM_MAX+1]; /* Any parameters? */
- unsigned long commandID; /* Windows WM_COMMAND ID assigned at runtime */
+typedef struct MENUITEM {
+ char text[MENU_MAX + 1]; /* To be displayed in menu */
+ MENUCOMMANDTYPE cmd; /* What should it do? */
+ char param[PARAM_MAX + 1]; /* Any parameters? */
+ unsigned long commandID; /* Windows WM_COMMAND ID assigned at runtime */
} MENUITEM;
/* A completely read in menu... */
-typedef struct MENUPARSED
-{
- char menuName[MENU_MAX+1]; /* What's it called in the text? */
- MENUITEM *menuItem; /* Array of items */
- int menuItems; /* How big's the array? */
+typedef struct MENUPARSED {
+ char menuName[MENU_MAX + 1]; /* What's it called in the text? */
+ MENUITEM *menuItem; /* Array of items */
+ int menuItems; /* How big's the array? */
} MENUPARSED;
/* To map between a window and a system menu to add for it */
-typedef struct SYSMENUITEM
-{
- char match[MENU_MAX+1]; /* String to look for to apply this sysmenu */
- char menuName[MENU_MAX+1]; /* Which menu to show? Used to set *menu */
- MENUPOSITION menuPos; /* Where to place it (ignored in root) */
+typedef struct SYSMENUITEM {
+ char match[MENU_MAX + 1]; /* String to look for to apply this sysmenu */
+ char menuName[MENU_MAX + 1]; /* Which menu to show? Used to set *menu */
+ MENUPOSITION menuPos; /* Where to place it (ignored in root) */
} SYSMENUITEM;
/* To redefine icons for certain window types */
-typedef struct ICONITEM
-{
- char match[MENU_MAX+1]; /* What string to search for? */
- char iconFile[PATH_MAX+NAME_MAX+2]; /* Icon location, WIN32 path */
- HICON hicon; /* LoadImage() result */
+typedef struct ICONITEM {
+ char match[MENU_MAX + 1]; /* What string to search for? */
+ char iconFile[PATH_MAX + NAME_MAX + 2]; /* Icon location, WIN32 path */
+ HICON hicon; /* LoadImage() result */
} ICONITEM;
/* To redefine styles for certain window types */
-typedef struct STYLEITEM
-{
- char match[MENU_MAX+1]; /* What string to search for? */
- unsigned long type; /* What should it do? */
+typedef struct STYLEITEM {
+ char match[MENU_MAX + 1]; /* What string to search for? */
+ unsigned long type; /* What should it do? */
} STYLEITEM;
-typedef struct WINPREFS
-{
- /* Menu information */
- MENUPARSED *menu; /* Array of created menus */
- int menuItems; /* How big? */
+typedef struct WINPREFS {
+ /* Menu information */
+ MENUPARSED *menu; /* Array of created menus */
+ int menuItems; /* How big? */
- /* Taskbar menu settings */
- char rootMenuName[MENU_MAX+1]; /* Menu for taskbar icon */
+ /* Taskbar menu settings */
+ char rootMenuName[MENU_MAX + 1]; /* Menu for taskbar icon */
- /* System menu addition menus */
- SYSMENUITEM *sysMenu;
- int sysMenuItems;
+ /* System menu addition menus */
+ SYSMENUITEM *sysMenu;
+ int sysMenuItems;
- /* Which menu to add to unmatched windows? */
- char defaultSysMenuName[MENU_MAX+1];
- MENUPOSITION defaultSysMenuPos; /* Where to place it */
+ /* Which menu to add to unmatched windows? */
+ char defaultSysMenuName[MENU_MAX + 1];
+ MENUPOSITION defaultSysMenuPos; /* Where to place it */
- /* Icon information */
- char iconDirectory[PATH_MAX+1]; /* Where do the .icos lie? (Win32 path) */
- char defaultIconName[NAME_MAX+1]; /* Replacement for x.ico */
- char trayIconName[NAME_MAX+1]; /* Replacement for tray icon */
+ /* Icon information */
+ char iconDirectory[PATH_MAX + 1]; /* Where do the .icos lie? (Win32 path) */
+ char defaultIconName[NAME_MAX + 1]; /* Replacement for x.ico */
+ char trayIconName[NAME_MAX + 1]; /* Replacement for tray icon */
- ICONITEM *icon;
- int iconItems;
+ ICONITEM *icon;
+ int iconItems;
- STYLEITEM *style;
- int styleItems;
+ STYLEITEM *style;
+ int styleItems;
- /* Force exit flag */
- Bool fForceExit;
+ /* Force exit flag */
+ Bool fForceExit;
- /* Silent exit flag */
- Bool fSilentExit;
+ /* Silent exit flag */
+ Bool fSilentExit;
} WINPREFS;
/* The global pref settings structure loaded by the winprefyacc.y parser */
extern WINPREFS pref;
-
/* Functions */
void
-LoadPreferences(void);
+ LoadPreferences(void);
void
-SetupRootMenu (unsigned long hmenuRoot);
+ SetupRootMenu(unsigned long hmenuRoot);
void
-SetupSysMenu (unsigned long hwndIn);
+ SetupSysMenu(unsigned long hwndIn);
void
-HandleCustomWM_INITMENU(unsigned long hwndIn,
- unsigned long hmenuIn);
+ HandleCustomWM_INITMENU(unsigned long hwndIn, unsigned long hmenuIn);
Bool
-HandleCustomWM_COMMAND (unsigned long hwndIn,
- int command);
+ HandleCustomWM_COMMAND(unsigned long hwndIn, int command);
int
-winIconIsOverride (unsigned hiconIn);
+ winIconIsOverride(unsigned hiconIn);
-HICON
-winOverrideIcon (unsigned long longpWin);
+HICON winOverrideIcon(unsigned long longpWin);
unsigned long
-winOverrideStyle (char *res_name, char *res_class, char *wmName);
+ winOverrideStyle(char *res_name, char *res_class, char *wmName);
-HICON
-winTaskbarIcon(void);
+HICON winTaskbarIcon(void);
-HICON
-winOverrideDefaultIcon(int size);
+HICON winOverrideDefaultIcon(int size);
#endif
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c
index 1418f78bc..bb7f2fd94 100644
--- a/xorg-server/hw/xwin/winprocarg.c
+++ b/xorg-server/hw/xwin/winprocarg.c
@@ -42,9 +42,9 @@ from The Open Group.
*/
#ifdef XWIN_CLIPBOARD
-extern Bool g_fUnicodeClipboard;
-extern Bool g_fClipboard;
-extern Bool g_fClipboardPrimary;
+extern Bool g_fUnicodeClipboard;
+extern Bool g_fClipboard;
+extern Bool g_fClipboardPrimary;
#endif
/*
@@ -52,13 +52,13 @@ extern Bool g_fClipboardPrimary;
*/
void
-winLogCommandLine (int argc, char *argv[]);
+ winLogCommandLine(int argc, char *argv[]);
void
-winLogVersionInfo (void);
+ winLogVersionInfo(void);
#ifdef DDXOSVERRORF
-void OsVendorVErrorF (const char *pszFormat, va_list va_args);
+void OsVendorVErrorF(const char *pszFormat, va_list va_args);
#endif
/*
@@ -71,122 +71,128 @@ static winScreenInfo defaultScreenInfo;
static void
winInitializeScreenDefaults(void)
{
- DWORD dwWidth, dwHeight;
- static Bool fInitializedScreenDefaults = FALSE;
-
- /* Bail out early if default screen has already been initialized */
- if (fInitializedScreenDefaults)
- return;
-
- /* Zero the memory used for storing the screen info */
- memset(&defaultScreenInfo, 0, sizeof(winScreenInfo));
-
- /* Get default width and height */
- /*
- * NOTE: These defaults will cause the window to cover only
- * the primary monitor in the case that we have multiple monitors.
- */
- dwWidth = GetSystemMetrics (SM_CXSCREEN);
- dwHeight = GetSystemMetrics (SM_CYSCREEN);
-
- winDebug ("winInitializeScreenDefaults - primary monitor w %d h %d\n", (int) dwWidth, (int) dwHeight);
-
- /* Set a default DPI, if no '-dpi' option was used */
- if (monitorResolution == 0)
- {
- HDC hdc = GetDC(NULL);
- if (hdc)
- {
- int dpiX = GetDeviceCaps(hdc, LOGPIXELSX);
- int dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
-
- winDebug("winInitializeDefaultScreens - native DPI x %d y %d\n", dpiX, dpiY);
- monitorResolution = dpiY;
- ReleaseDC(NULL, hdc);
+ DWORD dwWidth, dwHeight;
+ static Bool fInitializedScreenDefaults = FALSE;
+
+ /* Bail out early if default screen has already been initialized */
+ if (fInitializedScreenDefaults)
+ return;
+
+ /* Zero the memory used for storing the screen info */
+ memset(&defaultScreenInfo, 0, sizeof(winScreenInfo));
+
+ /* Get default width and height */
+ /*
+ * NOTE: These defaults will cause the window to cover only
+ * the primary monitor in the case that we have multiple monitors.
+ */
+ dwWidth = GetSystemMetrics(SM_CXSCREEN);
+ dwHeight = GetSystemMetrics(SM_CYSCREEN);
+
+ winDebug (
+ "winInitializeScreenDefaults - primary monitor w %d h %d\n",
+ (int) dwWidth, (int) dwHeight);
+
+ /* Set a default DPI, if no '-dpi' option was used */
+ if (monitorResolution == 0) {
+ HDC hdc = GetDC(NULL);
+
+ if (hdc) {
+ int dpiX = GetDeviceCaps(hdc, LOGPIXELSX);
+ int dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
+
+ winDebug(
+ "winInitializeDefaultScreens - native DPI x %d y %d\n",
+ dpiX, dpiY);
+ monitorResolution = dpiY;
+ ReleaseDC(NULL, hdc);
}
- else
- {
- winDebug("winInitializeDefaultScreens - Failed to retrieve native DPI, falling back to default of %d DPI\n", WIN_DEFAULT_DPI);
- monitorResolution = WIN_DEFAULT_DPI;
+ else {
+ winDebug(
+ "winInitializeDefaultScreens - Failed to retrieve native DPI, falling back to default of %d DPI\n",
+ WIN_DEFAULT_DPI);
+ monitorResolution = WIN_DEFAULT_DPI;
}
}
- defaultScreenInfo.iMonitor = 1;
- defaultScreenInfo.hMonitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY);
- defaultScreenInfo.dwWidth = dwWidth;
- defaultScreenInfo.dwHeight = dwHeight;
- defaultScreenInfo.dwUserWidth = dwWidth;
- defaultScreenInfo.dwUserHeight = dwHeight;
- defaultScreenInfo.fUserGaveHeightAndWidth = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH;
- defaultScreenInfo.fUserGavePosition = FALSE;
- defaultScreenInfo.dwBPP = WIN_DEFAULT_BPP;
- defaultScreenInfo.dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES;
+ defaultScreenInfo.iMonitor = 1;
+ defaultScreenInfo.hMonitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY);
+ defaultScreenInfo.dwWidth = dwWidth;
+ defaultScreenInfo.dwHeight = dwHeight;
+ defaultScreenInfo.dwUserWidth = dwWidth;
+ defaultScreenInfo.dwUserHeight = dwHeight;
+ defaultScreenInfo.fUserGaveHeightAndWidth =
+ WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH;
+ defaultScreenInfo.fUserGavePosition = FALSE;
+ defaultScreenInfo.dwBPP = WIN_DEFAULT_BPP;
+ defaultScreenInfo.dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES;
#ifdef XWIN_EMULATEPSEUDO
- defaultScreenInfo.fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO;
+ defaultScreenInfo.fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO;
#endif
- defaultScreenInfo.dwRefreshRate = WIN_DEFAULT_REFRESH;
- defaultScreenInfo.pfb = NULL;
- defaultScreenInfo.fFullScreen = FALSE;
- defaultScreenInfo.fDecoration = TRUE;
+ defaultScreenInfo.dwRefreshRate = WIN_DEFAULT_REFRESH;
+ defaultScreenInfo.pfb = NULL;
+ defaultScreenInfo.fFullScreen = FALSE;
+ defaultScreenInfo.fDecoration = TRUE;
#ifdef XWIN_MULTIWINDOWEXTWM
- defaultScreenInfo.fMWExtWM = FALSE;
+ defaultScreenInfo.fMWExtWM = FALSE;
#endif
#ifdef XWIN_MULTIWINDOWINTWM
- defaultScreenInfo.fInternalWM = FALSE;
+ defaultScreenInfo.fInternalWM = FALSE;
#endif
- defaultScreenInfo.fRootless = FALSE;
+ defaultScreenInfo.fRootless = FALSE;
#ifdef XWIN_MULTIWINDOW
- defaultScreenInfo.fMultiWindow = FALSE;
+ defaultScreenInfo.fMultiWindow = FALSE;
#endif
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- defaultScreenInfo.fMultiMonitorOverride = FALSE;
+ defaultScreenInfo.fMultiMonitorOverride = FALSE;
#endif
- defaultScreenInfo.fMultipleMonitors = FALSE;
- defaultScreenInfo.fLessPointer = FALSE;
- defaultScreenInfo.iResizeMode = resizeWithRandr;
- defaultScreenInfo.fNoTrayIcon = FALSE;
- defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT;
- defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
- defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
- defaultScreenInfo.fIgnoreInput = FALSE;
- defaultScreenInfo.fExplicitScreen = FALSE;
-
- /* Note that the default screen has been initialized */
- fInitializedScreenDefaults = TRUE;
+ defaultScreenInfo.fMultipleMonitors = FALSE;
+ defaultScreenInfo.fLessPointer = FALSE;
+ defaultScreenInfo.iResizeMode = resizeWithRandr;
+ defaultScreenInfo.fNoTrayIcon = FALSE;
+ defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT;
+ defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
+ defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
+ defaultScreenInfo.fIgnoreInput = FALSE;
+ defaultScreenInfo.fExplicitScreen = FALSE;
+
+ /* Note that the default screen has been initialized */
+ fInitializedScreenDefaults = TRUE;
}
static void
winInitializeScreen(int i)
{
- winDebug ("winInitializeScreen - %d\n",i);
+ winDebug ("winInitializeScreen - %d\n",i);
- /* Initialize default screen values, if needed */
- winInitializeScreenDefaults();
+ /* Initialize default screen values, if needed */
+ winInitializeScreenDefaults();
- /* Copy the default screen info */
- g_ScreenInfo[i] = defaultScreenInfo;
+ /* Copy the default screen info */
+ g_ScreenInfo[i] = defaultScreenInfo;
- /* Set the screen number */
- g_ScreenInfo[i].dwScreen = i;
+ /* Set the screen number */
+ g_ScreenInfo[i].dwScreen = i;
}
void
winInitializeScreens(int maxscreens)
{
- int i;
- winDebug ("winInitializeScreens - %i\n", maxscreens);
+ int i;
- if (maxscreens > g_iNumScreens)
- {
- /* Reallocate the memory for DDX-specific screen info */
- g_ScreenInfo = realloc(g_ScreenInfo, maxscreens * sizeof (winScreenInfo));
+ winDebug ("winInitializeScreens - %i\n", maxscreens);
+
+ if (maxscreens > g_iNumScreens) {
+ /* Reallocate the memory for DDX-specific screen info */
+ g_ScreenInfo =
+ realloc(g_ScreenInfo, maxscreens * sizeof(winScreenInfo));
- /* Set default values for any new screens */
- for (i = g_iNumScreens; i < maxscreens ; i++)
- winInitializeScreen(i);
+ /* Set default values for any new screens */
+ for (i = g_iNumScreens; i < maxscreens; i++)
+ winInitializeScreen(i);
- /* Keep a count of the number of screens */
- g_iNumScreens = maxscreens;
+ /* Keep a count of the number of screens */
+ g_iNumScreens = maxscreens;
}
}
@@ -212,539 +218,507 @@ winInitializeScreens(int maxscreens)
/* Check if enough arguments are given for the option */
#define CHECK_ARGS(count) if (i + count >= argc) { UseMsg (); return 0; }
-/* Compare the current option with the string. */
+/* Compare the current option with the string. */
#define IS_OPTION(name) (strcmp (argv[i], name) == 0)
int
-ddxProcessArgument (int argc, char *argv[], int i)
+ddxProcessArgument(int argc, char *argv[], int i)
{
- static Bool s_fBeenHere = FALSE;
- winScreenInfo *screenInfoPtr = NULL;
+ static Bool s_fBeenHere = FALSE;
+ winScreenInfo *screenInfoPtr = NULL;
- /* Initialize once */
- if (!s_fBeenHere)
- {
+ /* Initialize once */
+ if (!s_fBeenHere) {
#ifdef DDXOSVERRORF
- /*
- * This initialises our hook into VErrorF () for catching log messages
- * that are generated before OsInit () is called.
- */
- OsVendorVErrorFProc = OsVendorVErrorF;
+ /*
+ * This initialises our hook into VErrorF () for catching log messages
+ * that are generated before OsInit () is called.
+ */
+ OsVendorVErrorFProc = OsVendorVErrorF;
#endif
- s_fBeenHere = TRUE;
+ s_fBeenHere = TRUE;
- /* Initialize only if option is not -help */
- if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") &&
- !IS_OPTION("-version") && !IS_OPTION("--version"))
- {
+ /* Initialize only if option is not -help */
+ if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") &&
+ !IS_OPTION("-version") && !IS_OPTION("--version")) {
- /* Log the version information */
- winLogVersionInfo ();
+ /* Log the version information */
+ winLogVersionInfo();
- /* Log the command line */
- winLogCommandLine (argc, argv);
+ /* Log the command line */
+ winLogCommandLine(argc, argv);
- /*
- * Initialize default screen settings. We have to do this before
- * OsVendorInit () gets called, otherwise we will overwrite
- * settings changed by parameters such as -fullscreen, etc.
- */
- winDebug ("ddxProcessArgument - Initializing default "
- "screens\n");
- winInitializeScreenDefaults();
- }
+ /*
+ * Initialize default screen settings. We have to do this before
+ * OsVendorInit () gets called, otherwise we will overwrite
+ * settings changed by parameters such as -fullscreen, etc.
+ */
+ winDebug ("ddxProcessArgument - Initializing default "
+ "screens\n");
+ winInitializeScreenDefaults();
+ }
}
- winDebug ("ddxProcessArgument - arg: %s\n", argv[i]);
-
- /*
- * Look for the '-help' and similar options
- */
- if (IS_OPTION ("-help") || IS_OPTION("-h") || IS_OPTION("--help"))
- {
- /* Reset logfile. We don't need that helpmessage in the logfile */
- g_pszLogFile = NULL;
- g_fNoHelpMessageBox = TRUE;
- UseMsg();
- exit (0);
- return 1;
+ winDebug("ddxProcessArgument - arg: %s\n", argv[i]);
+
+ /*
+ * Look for the '-help' and similar options
+ */
+ if (IS_OPTION("-help") || IS_OPTION("-h") || IS_OPTION("--help")) {
+ /* Reset logfile. We don't need that helpmessage in the logfile */
+ g_pszLogFile = NULL;
+ g_fNoHelpMessageBox = TRUE;
+ UseMsg();
+ exit(0);
+ return 1;
}
- if (IS_OPTION ("-version") || IS_OPTION("--version"))
- {
- /* Reset logfile. We don't need that versioninfo in the logfile */
- g_pszLogFile = NULL;
- winLogVersionInfo ();
- exit (0);
- return 1;
+ if (IS_OPTION("-version") || IS_OPTION("--version")) {
+ /* Reset logfile. We don't need that versioninfo in the logfile */
+ g_pszLogFile = NULL;
+ winLogVersionInfo();
+ exit(0);
+ return 1;
}
- /*
- * Look for the '-screen scr_num [width height]' argument
- */
- if (IS_OPTION ("-screen"))
- {
- int iArgsProcessed = 1;
- int nScreenNum;
- int iWidth, iHeight, iX, iY;
- int iMonitor;
-
- winDebug ("ddxProcessArgument - screen - argc: %d i: %d\n",
- argc, i);
-
- /* Display the usage message if the argument is malformed */
- if (i + 1 >= argc)
- {
- return 0;
- }
-
- /* Grab screen number */
- nScreenNum = atoi (argv[i + 1]);
-
- /* Validate the specified screen number */
- if (nScreenNum < 0)
- {
- ErrorF ("ddxProcessArgument - screen - Invalid screen number %d\n",
- nScreenNum);
- UseMsg ();
- return 0;
+ /*
+ * Look for the '-screen scr_num [width height]' argument
+ */
+ if (IS_OPTION("-screen")) {
+ int iArgsProcessed = 1;
+ int nScreenNum;
+ int iWidth, iHeight, iX, iY;
+ int iMonitor;
+
+ winDebug("ddxProcessArgument - screen - argc: %d i: %d\n", argc, i);
+
+ /* Display the usage message if the argument is malformed */
+ if (i + 1 >= argc) {
+ return 0;
+ }
+
+ /* Grab screen number */
+ nScreenNum = atoi(argv[i + 1]);
+
+ /* Validate the specified screen number */
+ if (nScreenNum < 0) {
+ ErrorF("ddxProcessArgument - screen - Invalid screen number %d\n",
+ nScreenNum);
+ UseMsg();
+ return 0;
}
- /*
- Initialize default values for any new screens
+ /*
+ Initialize default values for any new screens
- Note that default values can't change after a -screen option is
- seen, so it's safe to do this for each screen as it is introduced
- */
- winInitializeScreens(nScreenNum+1);
+ Note that default values can't change after a -screen option is
+ seen, so it's safe to do this for each screen as it is introduced
+ */
+ winInitializeScreens(nScreenNum + 1);
- /* look for @m where m is monitor number */
- if (i + 2 < argc
- && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor))
- {
- struct GetMonitorInfoData data;
- if (!QueryMonitor(iMonitor, &data))
- {
- ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n");
- } else if (data.bMonitorSpecifiedExists == TRUE)
- {
- winDebug("ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
- iArgsProcessed = 3;
- g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
- g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
- g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
- g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
- g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth;
- g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight;
- g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth;
- g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight;
- g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
- g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
- }
- else
- {
- /* monitor does not exist, error out */
- ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
- iMonitor);
- UseMsg ();
- exit (0);
- return 0;
- }
- }
-
- /* Look for 'WxD' or 'W D' */
- else if (i + 2 < argc
- && 2 == sscanf (argv[i + 2], "%dx%d",
- (int *) &iWidth,
- (int *) &iHeight))
- {
- winDebug ("ddxProcessArgument - screen - Found ``WxD'' arg\n");
- iArgsProcessed = 3;
- g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
- g_ScreenInfo[nScreenNum].dwWidth = iWidth;
- g_ScreenInfo[nScreenNum].dwHeight = iHeight;
- g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
- g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
- /* Look for WxD+X+Y */
- if (2 == sscanf (argv[i + 2], "%*dx%*d+%d+%d",
- (int *) &iX,
- (int *) &iY))
- {
- winDebug("ddxProcessArgument - screen - Found ``X+Y'' arg\n");
- g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
- g_ScreenInfo[nScreenNum].dwInitialX = iX;
- g_ScreenInfo[nScreenNum].dwInitialY = iY;
-
- /* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */
- if (1 == sscanf (argv[i + 2], "%*dx%*d+%*d+%*d@%d",
- (int *) &iMonitor))
- {
- struct GetMonitorInfoData data;
- if (!QueryMonitor(iMonitor, &data))
- {
- ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n");
- } else if (data.bMonitorSpecifiedExists == TRUE)
- {
- g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
+ /* look for @m where m is monitor number */
+ if (i + 2 < argc && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor)) {
+ struct GetMonitorInfoData data;
+
+ if (!QueryMonitor(iMonitor, &data)) {
+ ErrorF
+ ("ddxProcessArgument - screen - Querying monitors failed\n");
+ }
+ else if (data.bMonitorSpecifiedExists == TRUE) {
+ winDebug(
+ "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n",
+ iMonitor);
+ iArgsProcessed = 3;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
+ g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
+ g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth;
+ g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight;
+ g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth;
+ g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight;
+ g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
+ g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
+ }
+ else {
+ /* monitor does not exist, error out */
+ ErrorF
+ ("ddxProcessArgument - screen - Invalid monitor number %d\n",
+ iMonitor);
+ UseMsg();
+ exit(0);
+ return 0;
+ }
+ }
+
+ /* Look for 'WxD' or 'W D' */
+ else if (i + 2 < argc
+ && 2 == sscanf(argv[i + 2], "%dx%d",
+ (int *) &iWidth, (int *) &iHeight)) {
+ winDebug (
+ "ddxProcessArgument - screen - Found ``WxD'' arg\n");
+ iArgsProcessed = 3;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
+ g_ScreenInfo[nScreenNum].dwWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwHeight = iHeight;
+ g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
+ /* Look for WxD+X+Y */
+ if (2 == sscanf(argv[i + 2], "%*dx%*d+%d+%d",
+ (int *) &iX, (int *) &iY)) {
+ winDebug (
+ "ddxProcessArgument - screen - Found ``X+Y'' arg\n");
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].dwInitialX = iX;
+ g_ScreenInfo[nScreenNum].dwInitialY = iY;
+
+ /* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */
+ if (1 == sscanf(argv[i + 2], "%*dx%*d+%*d+%*d@%d",
+ (int *) &iMonitor)) {
+ struct GetMonitorInfoData data;
+
+ if (!QueryMonitor(iMonitor, &data)) {
+ ErrorF
+ ("ddxProcessArgument - screen - Querying monitors failed\n");
+ }
+ else if (data.bMonitorSpecifiedExists == TRUE) {
+ g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
- g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX;
- g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY;
- }
- else
- {
- /* monitor does not exist, error out */
- ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
- iMonitor);
- UseMsg ();
- exit (0);
- return 0;
- }
-
- }
- }
-
- /* look for WxD@m where m is monitor number */
- else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d",
- (int *) &iMonitor))
- {
- struct GetMonitorInfoData data;
- if (!QueryMonitor(iMonitor, &data))
- {
- ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n");
- } else if (data.bMonitorSpecifiedExists == TRUE)
- {
- winDebug ("ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
- g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
- g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
- g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
- g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
- g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
- }
- else
- {
- /* monitor does not exist, error out */
- ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
- iMonitor);
- UseMsg ();
- exit (0);
- return 0;
- }
-
- }
- }
- else if (i + 3 < argc
- && 1 == sscanf (argv[i + 2], "%d",
- (int *) &iWidth)
- && 1 == sscanf (argv[i + 3], "%d",
- (int *) &iHeight))
- {
- winDebug ("ddxProcessArgument - screen - Found ``W D'' arg\n");
- iArgsProcessed = 4;
- g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
- g_ScreenInfo[nScreenNum].dwWidth = iWidth;
- g_ScreenInfo[nScreenNum].dwHeight = iHeight;
- g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
- g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
- if (i + 5 < argc
- && 1 == sscanf (argv[i + 4], "%d",
- (int *) &iX)
- && 1 == sscanf (argv[i + 5], "%d",
- (int *) &iY))
- {
- winDebug ("ddxProcessArgument - screen - Found ``X Y'' arg\n");
- iArgsProcessed = 6;
- g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
- g_ScreenInfo[nScreenNum].dwInitialX = iX;
- g_ScreenInfo[nScreenNum].dwInitialY = iY;
- }
- }
- else
- {
- ErrorF ("ddxProcessArgument - screen - Did not find size arg. "
- "dwWidth: %d dwHeight: %d\n",
- (int) g_ScreenInfo[nScreenNum].dwWidth,
- (int) g_ScreenInfo[nScreenNum].dwHeight);
- iArgsProcessed = 2;
- g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
- }
-
- /* Flag that this screen was explicity specified by the user */
- g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE;
-
- /*
- * Keep track of the last screen number seen, as parameters seen
- * before a screen number apply to all screens, whereas parameters
- * seen after a screen number apply to that screen number only.
- */
- iLastScreen = nScreenNum;
-
- return iArgsProcessed;
- }
+ g_ScreenInfo[nScreenNum].dwInitialX +=
+ data.monitorOffsetX;
+ g_ScreenInfo[nScreenNum].dwInitialY +=
+ data.monitorOffsetY;
+ }
+ else {
+ /* monitor does not exist, error out */
+ ErrorF
+ ("ddxProcessArgument - screen - Invalid monitor number %d\n",
+ iMonitor);
+ UseMsg();
+ exit(0);
+ return 0;
+ }
+
+ }
+ }
+ /* look for WxD@m where m is monitor number */
+ else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d", (int *) &iMonitor)) {
+ struct GetMonitorInfoData data;
+
+ if (!QueryMonitor(iMonitor, &data)) {
+ ErrorF
+ ("ddxProcessArgument - screen - Querying monitors failed\n");
+ }
+ else if (data.bMonitorSpecifiedExists == TRUE) {
+ winDebug (
+ "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n",
+ iMonitor);
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
+ g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
+ g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
+ g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
+ }
+ else {
+ /* monitor does not exist, error out */
+ ErrorF
+ ("ddxProcessArgument - screen - Invalid monitor number %d\n",
+ iMonitor);
+ UseMsg();
+ exit(0);
+ return 0;
+ }
- /*
- * Is this parameter attached to a screen or global?
- *
- * If the parameter is for all screens (appears before
- * any -screen option), store it in the default screen
- * info
- *
- * If the parameter is for a single screen (appears
- * after a -screen option), store it in the screen info
- * for that screen
- *
- */
- if (iLastScreen == -1)
- {
- screenInfoPtr = &defaultScreenInfo;
+ }
+ }
+ else if (i + 3 < argc && 1 == sscanf(argv[i + 2], "%d", (int *) &iWidth)
+ && 1 == sscanf(argv[i + 3], "%d", (int *) &iHeight)) {
+ winDebug (
+ "ddxProcessArgument - screen - Found ``W D'' arg\n");
+ iArgsProcessed = 4;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
+ g_ScreenInfo[nScreenNum].dwWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwHeight = iHeight;
+ g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
+ if (i + 5 < argc && 1 == sscanf(argv[i + 4], "%d", (int *) &iX)
+ && 1 == sscanf(argv[i + 5], "%d", (int *) &iY)) {
+ winDebug (
+ "ddxProcessArgument - screen - Found ``X Y'' arg\n");
+ iArgsProcessed = 6;
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].dwInitialX = iX;
+ g_ScreenInfo[nScreenNum].dwInitialY = iY;
+ }
+ }
+ else {
+ ErrorF (
+ "ddxProcessArgument - screen - Did not find size arg. "
+ "dwWidth: %d dwHeight: %d\n",
+ (int) g_ScreenInfo[nScreenNum].dwWidth,
+ (int) g_ScreenInfo[nScreenNum].dwHeight);
+ iArgsProcessed = 2;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
+ }
+
+ /* Flag that this screen was explicity specified by the user */
+ g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE;
+
+ /*
+ * Keep track of the last screen number seen, as parameters seen
+ * before a screen number apply to all screens, whereas parameters
+ * seen after a screen number apply to that screen number only.
+ */
+ iLastScreen = nScreenNum;
+
+ return iArgsProcessed;
}
- else
- {
- screenInfoPtr = &(g_ScreenInfo[iLastScreen]);
+
+ /*
+ * Is this parameter attached to a screen or global?
+ *
+ * If the parameter is for all screens (appears before
+ * any -screen option), store it in the default screen
+ * info
+ *
+ * If the parameter is for a single screen (appears
+ * after a -screen option), store it in the screen info
+ * for that screen
+ *
+ */
+ if (iLastScreen == -1) {
+ screenInfoPtr = &defaultScreenInfo;
+ }
+ else {
+ screenInfoPtr = &(g_ScreenInfo[iLastScreen]);
}
- /*
- * Look for the '-engine n' argument
- */
- if (IS_OPTION ("-engine"))
- {
- DWORD dwEngine = 0;
- CARD8 c8OnBits = 0;
-
- /* Display the usage message if the argument is malformed */
- if (++i >= argc)
- {
- UseMsg ();
- return 0;
- }
-
- /* Grab the argument */
- dwEngine = atoi (argv[i]);
-
- /* Count the one bits in the engine argument */
- c8OnBits = winCountBits (dwEngine);
-
- /* Argument should only have a single bit on */
- if (c8OnBits != 1)
- {
- UseMsg ();
- return 0;
- }
-
- screenInfoPtr->dwEnginePreferred = dwEngine;
-
- /* Indicate that we have processed the argument */
- return 2;
+ /*
+ * Look for the '-engine n' argument
+ */
+ if (IS_OPTION("-engine")) {
+ DWORD dwEngine = 0;
+ CARD8 c8OnBits = 0;
+
+ /* Display the usage message if the argument is malformed */
+ if (++i >= argc) {
+ UseMsg();
+ return 0;
+ }
+
+ /* Grab the argument */
+ dwEngine = atoi(argv[i]);
+
+ /* Count the one bits in the engine argument */
+ c8OnBits = winCountBits(dwEngine);
+
+ /* Argument should only have a single bit on */
+ if (c8OnBits != 1) {
+ UseMsg();
+ return 0;
+ }
+
+ screenInfoPtr->dwEnginePreferred = dwEngine;
+
+ /* Indicate that we have processed the argument */
+ return 2;
}
- /*
- * Look for the '-fullscreen' argument
- */
- if (IS_OPTION ("-fullscreen"))
- {
+ /*
+ * Look for the '-fullscreen' argument
+ */
+ if (IS_OPTION("-fullscreen")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!screenInfoPtr->fMultiMonitorOverride)
+ if (!screenInfoPtr->fMultiMonitorOverride)
screenInfoPtr->fMultipleMonitors = FALSE;
#endif
- screenInfoPtr->fFullScreen = TRUE;
+ screenInfoPtr->fFullScreen = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-lesspointer' argument
- */
- if (IS_OPTION ("-lesspointer"))
- {
- screenInfoPtr->fLessPointer = TRUE;
+ /*
+ * Look for the '-lesspointer' argument
+ */
+ if (IS_OPTION("-lesspointer")) {
+ screenInfoPtr->fLessPointer = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-nodecoration' argument
- */
- if (IS_OPTION ("-nodecoration"))
- {
+ /*
+ * Look for the '-nodecoration' argument
+ */
+ if (IS_OPTION("-nodecoration")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!screenInfoPtr->fMultiMonitorOverride)
- screenInfoPtr->fMultipleMonitors = FALSE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = FALSE;
#endif
- screenInfoPtr->fDecoration = FALSE;
+ screenInfoPtr->fDecoration = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#ifdef XWIN_MULTIWINDOWEXTWM
- /*
- * Look for the '-mwextwm' argument
- */
- if (IS_OPTION ("-mwextwm"))
- {
- if (!screenInfoPtr->fMultiMonitorOverride)
- screenInfoPtr->fMultipleMonitors = TRUE;
- screenInfoPtr->fMWExtWM = TRUE;
-
- /* Indicate that we have processed this argument */
- return 1;
+ /*
+ * Look for the '-mwextwm' argument
+ */
+ if (IS_OPTION("-mwextwm")) {
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = TRUE;
+ screenInfoPtr->fMWExtWM = TRUE;
+
+ /* Indicate that we have processed this argument */
+ return 1;
}
#endif
#ifdef XWIN_MULTIWINDOWINTWM
- /*
- * Look for the '-internalwm' argument
- */
- if (IS_OPTION ("-internalwm"))
- {
- if (!screenInfoPtr->fMultiMonitorOverride)
- screenInfoPtr->fMultipleMonitors = TRUE;
- screenInfoPtr->fMWExtWM = TRUE;
- screenInfoPtr->fInternalWM = TRUE;
-
- /* Indicate that we have processed this argument */
- return 1;
+ /*
+ * Look for the '-internalwm' argument
+ */
+ if (IS_OPTION("-internalwm")) {
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = TRUE;
+ screenInfoPtr->fMWExtWM = TRUE;
+ screenInfoPtr->fInternalWM = TRUE;
+
+ /* Indicate that we have processed this argument */
+ return 1;
}
#endif
- /*
- * Look for the '-rootless' argument
- */
- if (IS_OPTION ("-rootless"))
- {
+ /*
+ * Look for the '-rootless' argument
+ */
+ if (IS_OPTION("-rootless")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!screenInfoPtr->fMultiMonitorOverride)
- screenInfoPtr->fMultipleMonitors = FALSE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = FALSE;
#endif
- screenInfoPtr->fRootless = TRUE;
+ screenInfoPtr->fRootless = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#ifdef XWIN_MULTIWINDOW
- /*
- * Look for the '-multiwindow' argument
- */
- if (IS_OPTION ("-multiwindow"))
- {
+ /*
+ * Look for the '-multiwindow' argument
+ */
+ if (IS_OPTION("-multiwindow")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (!screenInfoPtr->fMultiMonitorOverride)
- screenInfoPtr->fMultipleMonitors = TRUE;
+ if (!screenInfoPtr->fMultiMonitorOverride)
+ screenInfoPtr->fMultipleMonitors = TRUE;
#endif
- screenInfoPtr->fMultiWindow = TRUE;
+ screenInfoPtr->fMultiWindow = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#endif
- /*
- * Look for the '-multiplemonitors' argument
- */
- if (IS_OPTION ("-multiplemonitors")
- || IS_OPTION ("-multimonitors"))
- {
+ /*
+ * Look for the '-multiplemonitors' argument
+ */
+ if (IS_OPTION("-multiplemonitors")
+ || IS_OPTION("-multimonitors")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- screenInfoPtr->fMultiMonitorOverride = TRUE;
+ screenInfoPtr->fMultiMonitorOverride = TRUE;
#endif
- screenInfoPtr->fMultipleMonitors = TRUE;
+ screenInfoPtr->fMultipleMonitors = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-nomultiplemonitors' argument
- */
- if (IS_OPTION ("-nomultiplemonitors")
- || IS_OPTION ("-nomultimonitors"))
- {
+ /*
+ * Look for the '-nomultiplemonitors' argument
+ */
+ if (IS_OPTION("-nomultiplemonitors")
+ || IS_OPTION("-nomultimonitors")) {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- screenInfoPtr->fMultiMonitorOverride = TRUE;
+ screenInfoPtr->fMultiMonitorOverride = TRUE;
#endif
- screenInfoPtr->fMultipleMonitors = FALSE;
+ screenInfoPtr->fMultipleMonitors = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
+ /*
+ * Look for the '-scrollbars' argument
+ */
+ if (IS_OPTION("-scrollbars")) {
- /*
- * Look for the '-scrollbars' argument
- */
- if (IS_OPTION ("-scrollbars"))
- {
-
- screenInfoPtr->iResizeMode = resizeWithScrollbars;
+ screenInfoPtr->iResizeMode = resizeWithScrollbars;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-resize' argument
- */
- if (IS_OPTION ("-resize") || IS_OPTION ("-noresize") ||
- (strncmp(argv[i], "-resize=",strlen("-resize=")) == 0))
- {
- winResizeMode mode;
+ /*
+ * Look for the '-resize' argument
+ */
+ if (IS_OPTION("-resize") || IS_OPTION("-noresize") ||
+ (strncmp(argv[i], "-resize=", strlen("-resize=")) == 0)) {
+ winResizeMode mode;
- if (IS_OPTION ("-resize"))
- mode = resizeWithRandr;
- else if (IS_OPTION ("-noresize"))
- mode = notAllowed;
- else if (strncmp(argv[i], "-resize=",strlen("-resize=")) == 0)
- {
- char *option = argv[i] + strlen("-resize=");
- if (strcmp(option, "randr") == 0)
+ if (IS_OPTION("-resize"))
mode = resizeWithRandr;
- else if (strcmp(option, "scrollbars") == 0)
- mode = resizeWithScrollbars;
- else if (strcmp(option, "none") == 0)
+ else if (IS_OPTION("-noresize"))
mode = notAllowed;
- else
- {
- ErrorF ("ddxProcessArgument - resize - Invalid resize mode %s\n", option);
- return 0;
+ else if (strncmp(argv[i], "-resize=", strlen("-resize=")) == 0) {
+ char *option = argv[i] + strlen("-resize=");
+
+ if (strcmp(option, "randr") == 0)
+ mode = resizeWithRandr;
+ else if (strcmp(option, "scrollbars") == 0)
+ mode = resizeWithScrollbars;
+ else if (strcmp(option, "none") == 0)
+ mode = notAllowed;
+ else {
+ ErrorF("ddxProcessArgument - resize - Invalid resize mode %s\n",
+ option);
+ return 0;
}
}
- else
- {
- ErrorF ("ddxProcessArgument - resize - Invalid resize option %s\n", argv[i]);
- return 0;
+ else {
+ ErrorF("ddxProcessArgument - resize - Invalid resize option %s\n",
+ argv[i]);
+ return 0;
}
- screenInfoPtr->iResizeMode = mode;
+ screenInfoPtr->iResizeMode = mode;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
#ifdef XWIN_CLIPBOARD
- /*
- * Look for the '-clipboard' argument
- */
- if (IS_OPTION ("-clipboard"))
- {
- /* Now the default, we still accept the arg for backwards compatibility */
- g_fClipboard = TRUE;
-
- /* Indicate that we have processed this argument */
- return 1;
+ /*
+ * Look for the '-clipboard' argument
+ */
+ if (IS_OPTION("-clipboard")) {
+ /* Now the default, we still accept the arg for backwards compatibility */
+ g_fClipboard = TRUE;
+
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-noclipboard' argument
- */
- if (IS_OPTION ("-noclipboard"))
- {
- g_fClipboard = FALSE;
+ /*
+ * Look for the '-noclipboard' argument
+ */
+ if (IS_OPTION("-noclipboard")) {
+ g_fClipboard = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
/*
@@ -772,516 +746,468 @@ ddxProcessArgument (int argc, char *argv[], int i)
#endif
+ /*
+ * Look for the '-ignoreinput' argument
+ */
+ if (IS_OPTION("-ignoreinput")) {
+ screenInfoPtr->fIgnoreInput = TRUE;
- /*
- * Look for the '-ignoreinput' argument
- */
- if (IS_OPTION ("-ignoreinput"))
- {
- screenInfoPtr->fIgnoreInput = TRUE;
-
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-emulate3buttons' argument
- */
- if (IS_OPTION ("-emulate3buttons"))
- {
- int iArgsProcessed = 1;
- int iE3BTimeout = WIN_DEFAULT_E3B_TIME;
-
- /* Grab the optional timeout value */
- if (i + 1 < argc
- && 1 == sscanf (argv[i + 1], "%d",
- &iE3BTimeout))
- {
- /* Indicate that we have processed the next argument */
- iArgsProcessed++;
+ /*
+ * Look for the '-emulate3buttons' argument
+ */
+ if (IS_OPTION("-emulate3buttons")) {
+ int iArgsProcessed = 1;
+ int iE3BTimeout = WIN_DEFAULT_E3B_TIME;
+
+ /* Grab the optional timeout value */
+ if (i + 1 < argc && 1 == sscanf(argv[i + 1], "%d", &iE3BTimeout)) {
+ /* Indicate that we have processed the next argument */
+ iArgsProcessed++;
+ }
+ else {
+ /*
+ * sscanf () won't modify iE3BTimeout if it doesn't find
+ * the specified format; however, I want to be explicit
+ * about setting the default timeout in such cases to
+ * prevent some programs (me) from getting confused.
+ */
+ iE3BTimeout = WIN_DEFAULT_E3B_TIME;
}
- else
- {
- /*
- * sscanf () won't modify iE3BTimeout if it doesn't find
- * the specified format; however, I want to be explicit
- * about setting the default timeout in such cases to
- * prevent some programs (me) from getting confused.
- */
- iE3BTimeout = WIN_DEFAULT_E3B_TIME;
- }
-
- screenInfoPtr->iE3BTimeout = iE3BTimeout;
- /* Indicate that we have processed this argument */
- return iArgsProcessed;
+ screenInfoPtr->iE3BTimeout = iE3BTimeout;
+
+ /* Indicate that we have processed this argument */
+ return iArgsProcessed;
}
- /*
- * Look for the '-noemulate3buttons' argument
- */
- if (IS_OPTION ("-noemulate3buttons"))
- {
- screenInfoPtr->iE3BTimeout = WIN_E3B_OFF;
+ /*
+ * Look for the '-noemulate3buttons' argument
+ */
+ if (IS_OPTION("-noemulate3buttons")) {
+ screenInfoPtr->iE3BTimeout = WIN_E3B_OFF;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-depth n' argument
- */
- if (IS_OPTION ("-depth"))
- {
- DWORD dwBPP = 0;
-
- /* Display the usage message if the argument is malformed */
- if (++i >= argc)
- {
- UseMsg ();
- return 0;
- }
-
- /* Grab the argument */
- dwBPP = atoi (argv[i]);
-
- screenInfoPtr->dwBPP = dwBPP;
-
- /* Indicate that we have processed the argument */
- return 2;
+ /*
+ * Look for the '-depth n' argument
+ */
+ if (IS_OPTION("-depth")) {
+ DWORD dwBPP = 0;
+
+ /* Display the usage message if the argument is malformed */
+ if (++i >= argc) {
+ UseMsg();
+ return 0;
+ }
+
+ /* Grab the argument */
+ dwBPP = atoi(argv[i]);
+
+ screenInfoPtr->dwBPP = dwBPP;
+
+ /* Indicate that we have processed the argument */
+ return 2;
}
- /*
- * Look for the '-refresh n' argument
- */
- if (IS_OPTION ("-refresh"))
- {
- DWORD dwRefreshRate = 0;
-
- /* Display the usage message if the argument is malformed */
- if (++i >= argc)
- {
- UseMsg ();
- return 0;
- }
-
- /* Grab the argument */
- dwRefreshRate = atoi (argv[i]);
-
- screenInfoPtr->dwRefreshRate = dwRefreshRate;
-
- /* Indicate that we have processed the argument */
- return 2;
+ /*
+ * Look for the '-refresh n' argument
+ */
+ if (IS_OPTION("-refresh")) {
+ DWORD dwRefreshRate = 0;
+
+ /* Display the usage message if the argument is malformed */
+ if (++i >= argc) {
+ UseMsg();
+ return 0;
+ }
+
+ /* Grab the argument */
+ dwRefreshRate = atoi(argv[i]);
+
+ screenInfoPtr->dwRefreshRate = dwRefreshRate;
+
+ /* Indicate that we have processed the argument */
+ return 2;
}
- /*
- * Look for the '-clipupdates num_boxes' argument
- */
- if (IS_OPTION ("-clipupdates"))
- {
- DWORD dwNumBoxes = 0;
-
- /* Display the usage message if the argument is malformed */
- if (++i >= argc)
- {
- UseMsg ();
- return 0;
- }
-
- /* Grab the argument */
- dwNumBoxes = atoi (argv[i]);
-
- screenInfoPtr->dwClipUpdatesNBoxes = dwNumBoxes;
-
- /* Indicate that we have processed the argument */
- return 2;
+ /*
+ * Look for the '-clipupdates num_boxes' argument
+ */
+ if (IS_OPTION("-clipupdates")) {
+ DWORD dwNumBoxes = 0;
+
+ /* Display the usage message if the argument is malformed */
+ if (++i >= argc) {
+ UseMsg();
+ return 0;
+ }
+
+ /* Grab the argument */
+ dwNumBoxes = atoi(argv[i]);
+
+ screenInfoPtr->dwClipUpdatesNBoxes = dwNumBoxes;
+
+ /* Indicate that we have processed the argument */
+ return 2;
}
#ifdef XWIN_EMULATEPSEUDO
- /*
- * Look for the '-emulatepseudo' argument
- */
- if (IS_OPTION ("-emulatepseudo"))
- {
- screenInfoPtr->fEmulatePseudo = TRUE;
-
- /* Indicate that we have processed this argument */
- return 1;
+ /*
+ * Look for the '-emulatepseudo' argument
+ */
+ if (IS_OPTION("-emulatepseudo")) {
+ screenInfoPtr->fEmulatePseudo = TRUE;
+
+ /* Indicate that we have processed this argument */
+ return 1;
}
#endif
- /*
- * Look for the '-nowinkill' argument
- */
- if (IS_OPTION ("-nowinkill"))
- {
- screenInfoPtr->fUseWinKillKey = FALSE;
+ /*
+ * Look for the '-nowinkill' argument
+ */
+ if (IS_OPTION("-nowinkill")) {
+ screenInfoPtr->fUseWinKillKey = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-winkill' argument
- */
- if (IS_OPTION ("-winkill"))
- {
- screenInfoPtr->fUseWinKillKey = TRUE;
+ /*
+ * Look for the '-winkill' argument
+ */
+ if (IS_OPTION("-winkill")) {
+ screenInfoPtr->fUseWinKillKey = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-nounixkill' argument
- */
- if (IS_OPTION ("-nounixkill"))
- {
- screenInfoPtr->fUseUnixKillKey = FALSE;
+ /*
+ * Look for the '-nounixkill' argument
+ */
+ if (IS_OPTION("-nounixkill")) {
+ screenInfoPtr->fUseUnixKillKey = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-unixkill' argument
- */
- if (IS_OPTION ("-unixkill"))
- {
- screenInfoPtr->fUseUnixKillKey = TRUE;
+ /*
+ * Look for the '-unixkill' argument
+ */
+ if (IS_OPTION("-unixkill")) {
+ screenInfoPtr->fUseUnixKillKey = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-notrayicon' argument
- */
- if (IS_OPTION ("-notrayicon"))
- {
- screenInfoPtr->fNoTrayIcon = TRUE;
+ /*
+ * Look for the '-notrayicon' argument
+ */
+ if (IS_OPTION("-notrayicon")) {
+ screenInfoPtr->fNoTrayIcon = TRUE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-trayicon' argument
- */
- if (IS_OPTION ("-trayicon"))
- {
- screenInfoPtr->fNoTrayIcon = FALSE;
+ /*
+ * Look for the '-trayicon' argument
+ */
+ if (IS_OPTION("-trayicon")) {
+ screenInfoPtr->fNoTrayIcon = FALSE;
- /* Indicate that we have processed this argument */
- return 1;
+ /* Indicate that we have processed this argument */
+ return 1;
}
- /*
- * Look for the '-fp' argument
- */
- if (IS_OPTION ("-fp"))
- {
- CHECK_ARGS (1);
- g_cmdline.fontPath = argv[++i];
- return 0; /* Let DIX parse this again */
+ /*
+ * Look for the '-fp' argument
+ */
+ if (IS_OPTION("-fp")) {
+ CHECK_ARGS(1);
+ g_cmdline.fontPath = argv[++i];
+ return 0; /* Let DIX parse this again */
}
- /*
- * Look for the '-query' argument
- */
- if (IS_OPTION ("-query"))
- {
- CHECK_ARGS (1);
- g_fXdmcpEnabled = TRUE;
- g_pszQueryHost = argv[++i];
- return 0; /* Let DIX parse this again */
+ /*
+ * Look for the '-query' argument
+ */
+ if (IS_OPTION("-query")) {
+ CHECK_ARGS(1);
+ g_fXdmcpEnabled = TRUE;
+ g_pszQueryHost = argv[++i];
+ return 0; /* Let DIX parse this again */
}
- /*
- * Look for the '-auth' argument
- */
- if (IS_OPTION ("-auth"))
- {
- g_fAuthEnabled = TRUE;
- return 0; /* Let DIX parse this again */
+ /*
+ * Look for the '-auth' argument
+ */
+ if (IS_OPTION("-auth")) {
+ g_fAuthEnabled = TRUE;
+ return 0; /* Let DIX parse this again */
}
- /*
- * Look for the '-indirect' or '-broadcast' arguments
- */
- if (IS_OPTION ("-indirect")
- || IS_OPTION ("-broadcast"))
- {
- g_fXdmcpEnabled = TRUE;
- return 0; /* Let DIX parse this again */
+ /*
+ * Look for the '-indirect' or '-broadcast' arguments
+ */
+ if (IS_OPTION("-indirect")
+ || IS_OPTION("-broadcast")) {
+ g_fXdmcpEnabled = TRUE;
+ return 0; /* Let DIX parse this again */
}
- /*
- * Look for the '-config' argument
- */
- if (IS_OPTION ("-config")
- || IS_OPTION ("-xf86config"))
- {
- CHECK_ARGS (1);
+ /*
+ * Look for the '-config' argument
+ */
+ if (IS_OPTION("-config")
+ || IS_OPTION("-xf86config")) {
+ CHECK_ARGS(1);
#ifdef XWIN_XF86CONFIG
- g_cmdline.configFile = argv[++i];
+ g_cmdline.configFile = argv[++i];
#else
- winMessageBoxF ("The %s option is not supported in this "
- "release.\n"
- "Ignoring this option and continuing.\n",
- MB_ICONINFORMATION,
- argv[i]);
+ winMessageBoxF("The %s option is not supported in this "
+ "release.\n"
+ "Ignoring this option and continuing.\n",
+ MB_ICONINFORMATION, argv[i]);
#endif
- return 2;
+ return 2;
}
- /*
- * Look for the '-configdir' argument
- */
- if (IS_OPTION ("-configdir"))
- {
- CHECK_ARGS (1);
+ /*
+ * Look for the '-configdir' argument
+ */
+ if (IS_OPTION("-configdir")) {
+ CHECK_ARGS(1);
#ifdef XWIN_XF86CONFIG
- g_cmdline.configDir = argv[++i];
+ g_cmdline.configDir = argv[++i];
#else
- winMessageBoxF ("The %s option is not supported in this "
- "release.\n"
- "Ignoring this option and continuing.\n",
- MB_ICONINFORMATION,
- argv[i]);
+ winMessageBoxF("The %s option is not supported in this "
+ "release.\n"
+ "Ignoring this option and continuing.\n",
+ MB_ICONINFORMATION, argv[i]);
#endif
- return 2;
+ return 2;
}
- /*
- * Look for the '-keyboard' argument
- */
- if (IS_OPTION ("-keyboard"))
- {
+ /*
+ * Look for the '-keyboard' argument
+ */
+ if (IS_OPTION("-keyboard")) {
#ifdef XWIN_XF86CONFIG
- CHECK_ARGS (1);
- g_cmdline.keyboard = argv[++i];
+ CHECK_ARGS(1);
+ g_cmdline.keyboard = argv[++i];
#else
- winMessageBoxF ("The -keyboard option is not supported in this "
- "release.\n"
- "Ignoring this option and continuing.\n",
- MB_ICONINFORMATION);
+ winMessageBoxF("The -keyboard option is not supported in this "
+ "release.\n"
+ "Ignoring this option and continuing.\n",
+ MB_ICONINFORMATION);
#endif
- return 2;
+ return 2;
}
- /*
- * Look for the '-logfile' argument
- */
- if (IS_OPTION ("-logfile"))
- {
- CHECK_ARGS (1);
- g_pszLogFile = argv[++i];
+ /*
+ * Look for the '-logfile' argument
+ */
+ if (IS_OPTION("-logfile")) {
+ CHECK_ARGS(1);
+ g_pszLogFile = argv[++i];
#ifdef RELOCATE_PROJECTROOT
- g_fLogFileChanged = TRUE;
+ g_fLogFileChanged = TRUE;
#endif
- return 2;
+ return 2;
}
- /*
- * Look for the '-logverbose' argument
- */
- if (IS_OPTION ("-logverbose"))
- {
- CHECK_ARGS (1);
- g_iLogVerbose = atoi(argv[++i]);
- return 2;
+ /*
+ * Look for the '-logverbose' argument
+ */
+ if (IS_OPTION("-logverbose")) {
+ CHECK_ARGS(1);
+ g_iLogVerbose = atoi(argv[++i]);
+ return 2;
}
#ifdef XWIN_CLIPBOARD
- /*
- * Look for the '-nounicodeclipboard' argument
- */
- if (IS_OPTION ("-nounicodeclipboard"))
- {
- g_fUnicodeClipboard = FALSE;
- /* Indicate that we have processed the argument */
- return 1;
+ /*
+ * Look for the '-nounicodeclipboard' argument
+ */
+ if (IS_OPTION("-nounicodeclipboard")) {
+ g_fUnicodeClipboard = FALSE;
+ /* Indicate that we have processed the argument */
+ return 1;
}
#endif
- if (IS_OPTION ("-xkbrules"))
- {
- CHECK_ARGS (1);
- g_cmdline.xkbRules = argv[++i];
- return 2;
+ if (IS_OPTION("-xkbrules")) {
+ CHECK_ARGS(1);
+ g_cmdline.xkbRules = argv[++i];
+ return 2;
}
- if (IS_OPTION ("-xkbmodel"))
- {
- CHECK_ARGS (1);
- g_cmdline.xkbModel = argv[++i];
- return 2;
+ if (IS_OPTION("-xkbmodel")) {
+ CHECK_ARGS(1);
+ g_cmdline.xkbModel = argv[++i];
+ return 2;
}
- if (IS_OPTION ("-xkblayout"))
- {
- CHECK_ARGS (1);
- g_cmdline.xkbLayout = argv[++i];
- return 2;
+ if (IS_OPTION("-xkblayout")) {
+ CHECK_ARGS(1);
+ g_cmdline.xkbLayout = argv[++i];
+ return 2;
}
- if (IS_OPTION ("-xkbvariant"))
- {
- CHECK_ARGS (1);
- g_cmdline.xkbVariant = argv[++i];
- return 2;
+ if (IS_OPTION("-xkbvariant")) {
+ CHECK_ARGS(1);
+ g_cmdline.xkbVariant = argv[++i];
+ return 2;
}
- if (IS_OPTION ("-xkboptions"))
- {
- CHECK_ARGS (1);
- g_cmdline.xkbOptions = argv[++i];
- return 2;
+ if (IS_OPTION("-xkboptions")) {
+ CHECK_ARGS(1);
+ g_cmdline.xkbOptions = argv[++i];
+ return 2;
}
- if (IS_OPTION ("-keyhook"))
- {
- g_fKeyboardHookLL = TRUE;
- return 1;
+ if (IS_OPTION("-keyhook")) {
+ g_fKeyboardHookLL = TRUE;
+ return 1;
}
-
- if (IS_OPTION ("-nokeyhook"))
- {
- g_fKeyboardHookLL = FALSE;
- return 1;
+
+ if (IS_OPTION("-nokeyhook")) {
+ g_fKeyboardHookLL = FALSE;
+ return 1;
}
-
- if (IS_OPTION ("-swcursor"))
- {
- g_fSoftwareCursor = TRUE;
- return 1;
+
+ if (IS_OPTION("-swcursor")) {
+ g_fSoftwareCursor = TRUE;
+ return 1;
}
-
- if (IS_OPTION ("-silent-dup-error"))
- {
- g_fSilentDupError = TRUE;
- return 1;
+
+ if (IS_OPTION("-silent-dup-error")) {
+ g_fSilentDupError = TRUE;
+ return 1;
}
- if (IS_OPTION("-wgl"))
- {
- g_fNativeGl = TRUE;
- return 1;
+ if (IS_OPTION("-wgl")) {
+ g_fNativeGl = TRUE;
+ return 1;
}
- else if (IS_OPTION("-nowgl"))
- {
- g_fNativeGl = FALSE;
- return 1;
+
+ else if (IS_OPTION("-nowgl")) {
+ g_fNativeGl = FALSE;
+ return 1;
}
- else if (IS_OPTION("-swrastwgl"))
+ else if (IS_OPTION("-swrastwgl"))
{
- g_fswrastwgl = TRUE;
- return 1;
+ g_fswrastwgl = TRUE;
+ return 1;
}
- else if (IS_OPTION("-parentprocessid"))
+ else if (IS_OPTION("-parentprocessid"))
{
- DWORD dwProcessId;
- CHECK_ARGS (1);
- dwProcessId = atoi(argv[++i]);
- if (!AllowSetForegroundWindow(dwProcessId))
+ DWORD dwProcessId;
+ CHECK_ARGS (1);
+ dwProcessId = atoi(argv[++i]);
+ if (!AllowSetForegroundWindow(dwProcessId))
{
- winMessageBoxF ("Error calling AllowSetForegroundWindow.", MB_ICONINFORMATION);
- return 0;
- }
- return 2;
+ winMessageBoxF ("Error calling AllowSetForegroundWindow.", MB_ICONINFORMATION);
+ return 0;
+ }
+ return 2;
}
- return 0;
+ return 0;
}
-
/*
* winLogCommandLine - Write entire command line to the log file
*/
void
-winLogCommandLine (int argc, char *argv[])
+winLogCommandLine(int argc, char *argv[])
{
- int i;
- int iSize = 0;
- int iCurrLen = 0;
+ int i;
+ int iSize = 0;
+ int iCurrLen = 0;
#define CHARS_PER_LINE 60
- /* Bail if command line has already been logged */
- if (g_pszCommandLine)
- return;
-
- /* Count how much memory is needed for concatenated command line */
- for (i = 0, iCurrLen = 0; i < argc; ++i)
- if (argv[i])
- {
- /* Adds two characters for lines that overflow */
- if ((strlen (argv[i]) < CHARS_PER_LINE
- && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE)
- || strlen (argv[i]) > CHARS_PER_LINE)
- {
- iCurrLen = 0;
- iSize += 2;
- }
-
- /* Add space for item and trailing space */
- iSize += strlen (argv[i]) + 1;
-
- /* Update current line length */
- iCurrLen += strlen (argv[i]);
- }
-
- /* Allocate memory for concatenated command line */
- g_pszCommandLine = malloc (iSize + 1);
- if (!g_pszCommandLine)
- FatalError ("winLogCommandLine - Could not allocate memory for "
- "command line string. Exiting.\n");
-
- /* Set first character to concatenated command line to null */
- g_pszCommandLine[0] = '\0';
-
- /* Loop through all args */
- for (i = 0, iCurrLen = 0; i < argc; ++i)
- {
- /* Add a character for lines that overflow */
- if ((strlen (argv[i]) < CHARS_PER_LINE
- && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE)
- || strlen (argv[i]) > CHARS_PER_LINE)
- {
- iCurrLen = 0;
-
- /* Add line break if it fits */
- strncat (g_pszCommandLine, "\n ", iSize - strlen (g_pszCommandLine));
- }
-
- strncat (g_pszCommandLine, argv[i], iSize - strlen (g_pszCommandLine));
- strncat (g_pszCommandLine, " ", iSize - strlen (g_pszCommandLine));
-
- /* Save new line length */
- iCurrLen += strlen (argv[i]);
+ /* Bail if command line has already been logged */
+ if (g_pszCommandLine)
+ return;
+
+ /* Count how much memory is needed for concatenated command line */
+ for (i = 0, iCurrLen = 0; i < argc; ++i)
+ if (argv[i]) {
+ /* Adds two characters for lines that overflow */
+ if ((strlen(argv[i]) < CHARS_PER_LINE
+ && iCurrLen + strlen(argv[i]) > CHARS_PER_LINE)
+ || strlen(argv[i]) > CHARS_PER_LINE) {
+ iCurrLen = 0;
+ iSize += 2;
+ }
+
+ /* Add space for item and trailing space */
+ iSize += strlen(argv[i]) + 1;
+
+ /* Update current line length */
+ iCurrLen += strlen(argv[i]);
+ }
+
+ /* Allocate memory for concatenated command line */
+ g_pszCommandLine = malloc(iSize + 1);
+ if (!g_pszCommandLine)
+ FatalError("winLogCommandLine - Could not allocate memory for "
+ "command line string. Exiting.\n");
+
+ /* Set first character to concatenated command line to null */
+ g_pszCommandLine[0] = '\0';
+
+ /* Loop through all args */
+ for (i = 0, iCurrLen = 0; i < argc; ++i) {
+ /* Add a character for lines that overflow */
+ if ((strlen(argv[i]) < CHARS_PER_LINE
+ && iCurrLen + strlen(argv[i]) > CHARS_PER_LINE)
+ || strlen(argv[i]) > CHARS_PER_LINE) {
+ iCurrLen = 0;
+
+ /* Add line break if it fits */
+ strncat(g_pszCommandLine, "\n ", iSize - strlen(g_pszCommandLine));
+ }
+
+ strncat(g_pszCommandLine, argv[i], iSize - strlen(g_pszCommandLine));
+ strncat(g_pszCommandLine, " ", iSize - strlen(g_pszCommandLine));
+
+ /* Save new line length */
+ iCurrLen += strlen(argv[i]);
}
- winDebug ("XWin was started with the following command line:\n\n"
- "%s\n\n", g_pszCommandLine);
+ winDebug ("XWin was started with the following command line:\n\n"
+ "%s\n\n", g_pszCommandLine);
}
-
/*
* winLogVersionInfo - Log version information
*/
void
-winLogVersionInfo (void)
+winLogVersionInfo(void)
{
#ifdef WINDBG
- static Bool s_fBeenHere = FALSE;
-
- if (s_fBeenHere)
- return;
- s_fBeenHere = TRUE;
-
- winDebug ("Welcome to the VcXsrv X Server\n");
- winDebug ("Vendor: %s\n", XVENDORNAME);
- winDebug ("Release: %d.%d.%d.%d\n\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP);
- winDebug ("%s\n\n", BUILDERSTRING);
- winDebug ("Contact: %s\n\n", BUILDERADDR);
+ static Bool s_fBeenHere = FALSE;
+
+ if (s_fBeenHere)
+ return;
+ s_fBeenHere = TRUE;
+
+ winDebug ("Welcome to the VcXsrv X Server\n");
+ winDebug ("Vendor: %s\n", XVENDORNAME);
+ winDebug ("Release: %d.%d.%d.%d\n\n", XORG_VERSION_MAJOR,
+ XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP);
+ winDebug ("%s\n\n", BUILDERSTRING);
+ winDebug ("Contact: %s\n\n", BUILDERADDR);
#endif
}
diff --git a/xorg-server/hw/xwin/winrandr.c b/xorg-server/hw/xwin/winrandr.c
index 596c1ab9d..1b340850c 100644
--- a/xorg-server/hw/xwin/winrandr.c
+++ b/xorg-server/hw/xwin/winrandr.c
@@ -34,163 +34,159 @@
#include <xwin-config.h>
#endif
#include "win.h"
-#include "mivalidate.h" // for union _Validate used by windowstr.h
+#include "mivalidate.h" // for union _Validate used by windowstr.h
#ifndef RANDR_12_INTERFACE
#error X server must have RandR 1.2 interface
#endif
-
/*
* Answer queries about the RandR features supported.
*/
static Bool
-winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations)
+winRandRGetInfo(ScreenPtr pScreen, Rotation * pRotations)
{
- winDebug ("winRandRGetInfo ()\n");
+ winDebug("winRandRGetInfo ()\n");
- /* Don't support rotations */
- *pRotations = RR_Rotate_0;
+ /* Don't support rotations */
+ *pRotations = RR_Rotate_0;
- /*
- The screen doesn't have to be limited to the actual
- monitor size (we can have scrollbars :-), so what is
- the upper limit?
- */
- RRScreenSetSizeRange(pScreen, 0, 0, 4096, 4096);
+ /*
+ The screen doesn't have to be limited to the actual
+ monitor size (we can have scrollbars :-), so what is
+ the upper limit?
+ */
+ RRScreenSetSizeRange(pScreen, 0, 0, 4096, 4096);
- return TRUE;
+ return TRUE;
}
/*
*/
void
-winDoRandRScreenSetSize (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight)
+winDoRandRScreenSetSize(ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height, CARD32 mmWidth, CARD32 mmHeight)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- WindowPtr pRoot = pScreen->root;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ WindowPtr pRoot = pScreen->root;
- // Prevent screen updates while we change things around
- SetRootClip(pScreen, FALSE);
+ // Prevent screen updates while we change things around
+ SetRootClip(pScreen, FALSE);
- /* Update the screen size as requested */
- pScreenInfo->dwWidth = width;
- pScreenInfo->dwHeight = height;
+ /* Update the screen size as requested */
+ pScreenInfo->dwWidth = width;
+ pScreenInfo->dwHeight = height;
- /* Reallocate the framebuffer used by the drawing engine */
- (*pScreenPriv->pwinFreeFB)(pScreen);
- if (!(*pScreenPriv->pwinAllocateFB)(pScreen))
- {
- ErrorF ("winDoRandRScreenSetSize - Could not reallocate framebuffer\n");
+ /* Reallocate the framebuffer used by the drawing engine */
+ (*pScreenPriv->pwinFreeFB) (pScreen);
+ if (!(*pScreenPriv->pwinAllocateFB) (pScreen)) {
+ ErrorF("winDoRandRScreenSetSize - Could not reallocate framebuffer\n");
}
- pScreen->width = width;
- pScreen->height = height;
- pScreen->mmWidth = mmWidth;
- pScreen->mmHeight = mmHeight;
+ pScreen->width = width;
+ pScreen->height = height;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
- /* Update the screen pixmap to point to the new framebuffer */
- winUpdateFBPointer(pScreen, pScreenInfo->pfb);
+ /* Update the screen pixmap to point to the new framebuffer */
+ winUpdateFBPointer(pScreen, pScreenInfo->pfb);
- // pScreen->devPrivate == pScreen->GetScreenPixmap(screen) ?
- // resize the root window
- //pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL);
- // does this emit a ConfigureNotify??
+ // pScreen->devPrivate == pScreen->GetScreenPixmap(screen) ?
+ // resize the root window
+ //pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL);
+ // does this emit a ConfigureNotify??
- // Restore the ability to update screen, now with new dimensions
- SetRootClip(pScreen, TRUE);
+ // Restore the ability to update screen, now with new dimensions
+ SetRootClip(pScreen, TRUE);
- // and arrange for it to be repainted
- miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
+ // and arrange for it to be repainted
+ miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
- /* Indicate that a screen size change took place */
- RRScreenSizeNotify(pScreen);
+ /* Indicate that a screen size change took place */
+ RRScreenSizeNotify(pScreen);
}
/*
* Respond to resize request
*/
static
-Bool
-winRandRScreenSetSize (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight)
+ Bool
+winRandRScreenSetSize(ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height, CARD32 mmWidth, CARD32 mmHeight)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- winDebug ("winRandRScreenSetSize ()\n");
+ winDebug("winRandRScreenSetSize ()\n");
- /*
- It doesn't currently make sense to allow resize in fullscreen mode
- (we'd actually have to list the supported resolutions)
- */
- if (pScreenInfo->fFullScreen)
- {
- ErrorF ("winRandRScreenSetSize - resize not supported in fullscreen mode\n");
- return FALSE;
+ /*
+ It doesn't currently make sense to allow resize in fullscreen mode
+ (we'd actually have to list the supported resolutions)
+ */
+ if (pScreenInfo->fFullScreen) {
+ ErrorF
+ ("winRandRScreenSetSize - resize not supported in fullscreen mode\n");
+ return FALSE;
}
- /*
- Client resize requests aren't allowed in rootless modes, even if
- the X screen is monitor or virtual desktop size, we'd need to
- resize the native display size
- */
- if (FALSE
+ /*
+ Client resize requests aren't allowed in rootless modes, even if
+ the X screen is monitor or virtual desktop size, we'd need to
+ resize the native display size
+ */
+ if (FALSE
#ifdef XWIN_MULTIWINDOWEXTWM
- || pScreenInfo->fMWExtWM
+ || pScreenInfo->fMWExtWM
#endif
- || pScreenInfo->fRootless
+ || pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- || pScreenInfo->fMultiWindow
+ || pScreenInfo->fMultiWindow
#endif
- )
- {
- ErrorF ("winRandRScreenSetSize - resize not supported in rootless modes\n");
- return FALSE;
+ ) {
+ ErrorF
+ ("winRandRScreenSetSize - resize not supported in rootless modes\n");
+ return FALSE;
}
- winDoRandRScreenSetSize(pScreen, width, height, mmWidth, mmHeight);
+ winDoRandRScreenSetSize(pScreen, width, height, mmWidth, mmHeight);
- /* Cause the native window for the screen to resize itself */
- {
- DWORD dwStyle, dwExStyle;
- RECT rcClient;
+ /* Cause the native window for the screen to resize itself */
+ {
+ DWORD dwStyle, dwExStyle;
+ RECT rcClient;
- rcClient.left = 0;
- rcClient.top = 0;
- rcClient.right = width;
- rcClient.bottom = height;
+ rcClient.left = 0;
+ rcClient.top = 0;
+ rcClient.right = width;
+ rcClient.bottom = height;
- ErrorF ("winRandRScreenSetSize new client area w: %d h: %d\n", width, height);
+ ErrorF("winRandRScreenSetSize new client area w: %d h: %d\n", width,
+ height);
- /* Get the Windows window style and extended style */
- dwExStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_STYLE);
+ /* Get the Windows window style and extended style */
+ dwExStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_STYLE);
- /*
- * Calculate the window size needed for the given client area
- * adjusting for any decorations it will have
- */
- AdjustWindowRectEx(&rcClient, dwStyle, FALSE, dwExStyle);
+ /*
+ * Calculate the window size needed for the given client area
+ * adjusting for any decorations it will have
+ */
+ AdjustWindowRectEx(&rcClient, dwStyle, FALSE, dwExStyle);
- ErrorF ("winRandRScreenSetSize new window area w: %ld h: %ld\n", rcClient.right-rcClient.left, rcClient.bottom-rcClient.top);
+ ErrorF("winRandRScreenSetSize new window area w: %ld h: %ld\n",
+ rcClient.right - rcClient.left, rcClient.bottom - rcClient.top);
- SetWindowPos(pScreenPriv->hwndScreen, NULL,
- 0, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top,
- SWP_NOZORDER | SWP_NOMOVE);
- }
+ SetWindowPos(pScreenPriv->hwndScreen, NULL,
+ 0, 0, rcClient.right - rcClient.left,
+ rcClient.bottom - rcClient.top, SWP_NOZORDER | SWP_NOMOVE);
+ }
- return TRUE;
+ return TRUE;
}
/*
@@ -198,24 +194,24 @@ winRandRScreenSetSize (ScreenPtr pScreen,
*/
Bool
-winRandRInit (ScreenPtr pScreen)
+winRandRInit(ScreenPtr pScreen)
{
- rrScrPrivPtr pRRScrPriv;
- winDebug ("winRandRInit ()\n");
+ rrScrPrivPtr pRRScrPriv;
- if (!RRScreenInit (pScreen))
- {
- ErrorF ("winRandRInit () - RRScreenInit () failed\n");
- return FALSE;
+ winDebug("winRandRInit ()\n");
+
+ if (!RRScreenInit(pScreen)) {
+ ErrorF("winRandRInit () - RRScreenInit () failed\n");
+ return FALSE;
}
- /* Set some RandR function pointers */
- pRRScrPriv = rrGetScrPriv (pScreen);
- pRRScrPriv->rrGetInfo = winRandRGetInfo;
- pRRScrPriv->rrSetConfig = NULL;
- pRRScrPriv->rrScreenSetSize = winRandRScreenSetSize;
- pRRScrPriv->rrCrtcSet = NULL;
- pRRScrPriv->rrCrtcSetGamma = NULL;
+ /* Set some RandR function pointers */
+ pRRScrPriv = rrGetScrPriv(pScreen);
+ pRRScrPriv->rrGetInfo = winRandRGetInfo;
+ pRRScrPriv->rrSetConfig = NULL;
+ pRRScrPriv->rrScreenSetSize = winRandRScreenSetSize;
+ pRRScrPriv->rrCrtcSet = NULL;
+ pRRScrPriv->rrCrtcSetGamma = NULL;
- return TRUE;
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/winregistry.c b/xorg-server/hw/xwin/winregistry.c
index 898ed978b..0535c879d 100644
--- a/xorg-server/hw/xwin/winregistry.c
+++ b/xorg-server/hw/xwin/winregistry.c
@@ -34,38 +34,32 @@
#include "win.h"
/* Prototypes */
-DWORD
-winGetRegistryDWORD (HKEY hkey, char *pszRegistryKey);
+DWORD winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey);
DWORD
-winGetRegistryDWORD (HKEY hkey, char *pszRegistryKey)
+winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey)
{
- HKEY hkResult;
- DWORD dwDisposition;
+ HKEY hkResult;
+ DWORD dwDisposition;
- RegCreateKeyEx (hkey,
- pszRegistryKey,
- 0,
- '\0',
- REG_OPTION_NON_VOLATILE,
- KEY_READ,
- NULL,
- &hkResult,
- &dwDisposition);
+ RegCreateKeyEx(hkey,
+ pszRegistryKey,
+ 0,
+ '\0',
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ, NULL, &hkResult, &dwDisposition);
- if (dwDisposition == REG_CREATED_NEW_KEY)
- {
- winDebug ("winGetRegistryDWORD - Created new key: %s\n", pszRegistryKey);
+ if (dwDisposition == REG_CREATED_NEW_KEY) {
+ winDebug ("winGetRegistryDWORD - Created new key: %s\n", pszRegistryKey);
}
- else if (dwDisposition == REG_OPENED_EXISTING_KEY)
- {
- winDebug ("winGetRegistryDWORD - Opened existing key: %s\n",
- pszRegistryKey);
+ else if (dwDisposition == REG_OPENED_EXISTING_KEY) {
+ winDebug ("winGetRegistryDWORD - Opened existing key: %s\n",
+ pszRegistryKey);
}
- /* Free the registry key handle */
- RegCloseKey (hkResult);
- hkResult = NULL;
+ /* Free the registry key handle */
+ RegCloseKey(hkResult);
+ hkResult = NULL;
- return 0;
+ return 0;
}
diff --git a/xorg-server/hw/xwin/winrop.c b/xorg-server/hw/xwin/winrop.c
index f4818920a..1f9ff7320 100644
--- a/xorg-server/hw/xwin/winrop.c
+++ b/xorg-server/hw/xwin/winrop.c
@@ -37,108 +37,106 @@
#include "win.h"
void
-ROP16 (HDC hdc, int rop);
-
-int g_copyROP[16] = { 0xFF0062, /* GXclear - 0 */
- 0x8800C6, /* GXand - S & D */
- 0x440328, /* GXandReverse - S & !D */
- 0xCC0020, /* GXcopy - S */
- 0x220326, /* GXandInverted - !S & D */
- 0xAA0029, /* GXnoop - D */
- 0x660046, /* GXxor - S ^ D */
- 0xEE0086, /* GXor - S | D */
- 0x1100A6, /* GXnor - !S & !D */
- 0x990126, /* GXequiv - !S ^ D */
- 0x550009, /* GXinvert - !D */
- 0xDD0228, /* GXorReverse - S | !D */
- 0x330008, /* GXcopyInverted - !S */
- 0xBB0226, /* GXorInverted - !S | D */
- 0x7700C6, /* GXnand - !S | !D */
- 0x000042 /* GXset - 1 */
+ ROP16(HDC hdc, int rop);
+
+int g_copyROP[16] = { 0xFF0062, /* GXclear - 0 */
+ 0x8800C6, /* GXand - S & D */
+ 0x440328, /* GXandReverse - S & !D */
+ 0xCC0020, /* GXcopy - S */
+ 0x220326, /* GXandInverted - !S & D */
+ 0xAA0029, /* GXnoop - D */
+ 0x660046, /* GXxor - S ^ D */
+ 0xEE0086, /* GXor - S | D */
+ 0x1100A6, /* GXnor - !S & !D */
+ 0x990126, /* GXequiv - !S ^ D */
+ 0x550009, /* GXinvert - !D */
+ 0xDD0228, /* GXorReverse - S | !D */
+ 0x330008, /* GXcopyInverted - !S */
+ 0xBB0226, /* GXorInverted - !S | D */
+ 0x7700C6, /* GXnand - !S | !D */
+ 0x000042 /* GXset - 1 */
};
-int g_patternROP[16] = {0xFF0062, /* GXclear - 0 */
- 0xA000C9, /* GXand - P & D */
- 0xF50225, /* GXandReverse - P & !D */
- 0xF00021, /* GXcopy - P */
- 0x5F00E9, /* GXandInverted - !P & D */
- 0xAA0029, /* GXnoop - D */
- 0xA50065, /* GXxor - P ^ D */
- 0xA000C9, /* GXor - P | D */
- 0x5F00E9, /* GXnor - !P & !D */
- 0x5A0049, /* GXequiv - !P ^ D */
- 0x550009, /* GXinvert - !D */
- 0x500325, /* GXorReverse - P | !D */
- 0x0F0001, /* GXcopyInverted - !P */
- 0x0A0329, /* GXorInverted - !P | D */
- 0x0500A9, /* GXnand - !P | !D */
- 0x000042 /* GXset - 1 */
+int g_patternROP[16] = { 0xFF0062, /* GXclear - 0 */
+ 0xA000C9, /* GXand - P & D */
+ 0xF50225, /* GXandReverse - P & !D */
+ 0xF00021, /* GXcopy - P */
+ 0x5F00E9, /* GXandInverted - !P & D */
+ 0xAA0029, /* GXnoop - D */
+ 0xA50065, /* GXxor - P ^ D */
+ 0xA000C9, /* GXor - P | D */
+ 0x5F00E9, /* GXnor - !P & !D */
+ 0x5A0049, /* GXequiv - !P ^ D */
+ 0x550009, /* GXinvert - !D */
+ 0x500325, /* GXorReverse - P | !D */
+ 0x0F0001, /* GXcopyInverted - !P */
+ 0x0A0329, /* GXorInverted - !P | D */
+ 0x0500A9, /* GXnand - !P | !D */
+ 0x000042 /* GXset - 1 */
};
-
void
-ROP16 (HDC hdc, int rop)
+ROP16(HDC hdc, int rop)
{
- switch (rop)
- {
+ switch (rop) {
case GXclear:
- SetROP2 (hdc, R2_BLACK);
- break;
+ SetROP2(hdc, R2_BLACK);
+ break;
case GXand:
- SetROP2 (hdc, R2_MASKPEN);
- break;
+ SetROP2(hdc, R2_MASKPEN);
+ break;
case GXandReverse:
- SetROP2 (hdc, R2_MASKPENNOT);
- break;
+ SetROP2(hdc, R2_MASKPENNOT);
+ break;
case GXcopy:
- SetROP2 (hdc, R2_COPYPEN);
- break;
+ SetROP2(hdc, R2_COPYPEN);
+ break;
case GXnoop:
- SetROP2 (hdc, R2_NOP);
- break;
+ SetROP2(hdc, R2_NOP);
+ break;
case GXxor:
- SetROP2 (hdc, R2_XORPEN);
- break;
+ SetROP2(hdc, R2_XORPEN);
+ break;
case GXor:
- SetROP2 (hdc, R2_MERGEPEN);
- break;
+ SetROP2(hdc, R2_MERGEPEN);
+ break;
case GXnor:
- SetROP2 (hdc, R2_NOTMERGEPEN);
- break;
+ SetROP2(hdc, R2_NOTMERGEPEN);
+ break;
case GXequiv:
- SetROP2 (hdc, R2_NOTXORPEN);
- break;
+ SetROP2(hdc, R2_NOTXORPEN);
+ break;
case GXinvert:
- SetROP2 (hdc, R2_NOT);
- break;
+ SetROP2(hdc, R2_NOT);
+ break;
case GXorReverse:
- SetROP2 (hdc, R2_MERGEPENNOT);
- break;
+ SetROP2(hdc, R2_MERGEPENNOT);
+ break;
case GXcopyInverted:
- SetROP2 (hdc, R2_NOTCOPYPEN);
- break;
+ SetROP2(hdc, R2_NOTCOPYPEN);
+ break;
case GXorInverted:
- SetROP2 (hdc, R2_MERGENOTPEN);
- break;
+ SetROP2(hdc, R2_MERGENOTPEN);
+ break;
case GXnand:
- SetROP2 (hdc, R2_NOTMASKPEN);
- break;
+ SetROP2(hdc, R2_NOTMASKPEN);
+ break;
case GXset:
- SetROP2 (hdc, R2_WHITE);
- break;
+ SetROP2(hdc, R2_WHITE);
+ break;
}
}
diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c
index 3cf74cdcc..2b699a84e 100644
--- a/xorg-server/hw/xwin/winscrinit.c
+++ b/xorg-server/hw/xwin/winscrinit.c
@@ -38,30 +38,28 @@
#include "win.h"
#include "winmsg.h"
-
#ifdef XWIN_MULTIWINDOWEXTWM
-static RootlessFrameProcsRec
-winMWExtWMProcs = {
- winMWExtWMCreateFrame,
- winMWExtWMDestroyFrame,
-
- winMWExtWMMoveFrame,
- winMWExtWMResizeFrame,
- winMWExtWMRestackFrame,
- winMWExtWMReshapeFrame,
- winMWExtWMUnmapFrame,
-
- winMWExtWMStartDrawing,
- winMWExtWMStopDrawing,
- winMWExtWMUpdateRegion,
- winMWExtWMDamageRects,
- winMWExtWMRootlessSwitchWindow,
- NULL,//winMWExtWMDoReorderWindow,
- NULL,//winMWExtWMHideWindow,
- NULL,//winMWExtWMUpdateColorMap,
-
- NULL,//winMWExtWMCopyBytes,
- winMWExtWMCopyWindow
+static RootlessFrameProcsRec winMWExtWMProcs = {
+ winMWExtWMCreateFrame,
+ winMWExtWMDestroyFrame,
+
+ winMWExtWMMoveFrame,
+ winMWExtWMResizeFrame,
+ winMWExtWMRestackFrame,
+ winMWExtWMReshapeFrame,
+ winMWExtWMUnmapFrame,
+
+ winMWExtWMStartDrawing,
+ winMWExtWMStopDrawing,
+ winMWExtWMUpdateRegion,
+ winMWExtWMDamageRects,
+ winMWExtWMRootlessSwitchWindow,
+ NULL, //winMWExtWMDoReorderWindow,
+ NULL, //winMWExtWMHideWindow,
+ NULL, //winMWExtWMUpdateColorMap,
+
+ NULL, //winMWExtWMCopyBytes,
+ winMWExtWMCopyWindow
};
#endif
@@ -74,8 +72,7 @@ winMWExtWMProcs = {
*/
static Bool
-winSaveScreen (ScreenPtr pScreen, int on);
-
+ winSaveScreen(ScreenPtr pScreen, int on);
/*
* Determine what type of screen we are initializing
@@ -84,376 +81,346 @@ winSaveScreen (ScreenPtr pScreen, int on);
*/
Bool
-winScreenInit (int index,
- ScreenPtr pScreen,
- int argc, char **argv)
+winScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
{
- winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
- winPrivScreenPtr pScreenPriv;
- HDC hdc;
- DWORD dwInitialBPP;
+ winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+ winPrivScreenPtr pScreenPriv;
+ HDC hdc;
+ DWORD dwInitialBPP;
- winDebug ("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
- pScreenInfo->dwWidth, pScreenInfo->dwHeight);
+ winDebug("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight);
- /* Allocate privates for this screen */
- if (!winAllocatePrivates (pScreen))
- {
- ErrorF ("winScreenInit - Couldn't allocate screen privates\n");
- return FALSE;
+ /* Allocate privates for this screen */
+ if (!winAllocatePrivates(pScreen)) {
+ ErrorF("winScreenInit - Couldn't allocate screen privates\n");
+ return FALSE;
}
- /* Get a pointer to the privates structure that was allocated */
- pScreenPriv = winGetScreenPriv (pScreen);
+ /* Get a pointer to the privates structure that was allocated */
+ pScreenPriv = winGetScreenPriv(pScreen);
- /* Save a pointer to this screen in the screen info structure */
- pScreenInfo->pScreen = pScreen;
+ /* Save a pointer to this screen in the screen info structure */
+ pScreenInfo->pScreen = pScreen;
- /* Save a pointer to the screen info in the screen privates structure */
- /* This allows us to get back to the screen info from a screen pointer */
- pScreenPriv->pScreenInfo = pScreenInfo;
+ /* Save a pointer to the screen info in the screen privates structure */
+ /* This allows us to get back to the screen info from a screen pointer */
+ pScreenPriv->pScreenInfo = pScreenInfo;
- /*
- * Determine which engine to use.
- *
- * NOTE: This is done once per screen because each screen possibly has
- * a preferred engine specified on the command line.
- */
- if (!winSetEngine (pScreen))
- {
- ErrorF ("winScreenInit - winSetEngine () failed\n");
- return FALSE;
+ /*
+ * Determine which engine to use.
+ *
+ * NOTE: This is done once per screen because each screen possibly has
+ * a preferred engine specified on the command line.
+ */
+ if (!winSetEngine(pScreen)) {
+ ErrorF("winScreenInit - winSetEngine () failed\n");
+ return FALSE;
}
- /* Horribly misnamed function: Allow engine to adjust BPP for screen */
- dwInitialBPP = pScreenInfo->dwBPP;
+ /* Horribly misnamed function: Allow engine to adjust BPP for screen */
+ dwInitialBPP = pScreenInfo->dwBPP;
- if (pScreenPriv->pwinAdjustVideoMode && !(*pScreenPriv->pwinAdjustVideoMode) (pScreen))
- {
- ErrorF ("winScreenInit - winAdjustVideoMode () failed\n");
- return FALSE;
- }
-
- if (dwInitialBPP == WIN_DEFAULT_BPP)
- {
- /* No -depth parameter was passed, let the user know the depth being used */
- winDebug ("winScreenInit - Using Windows display depth of %d bits per pixel\n", (int) pScreenInfo->dwBPP);
- }
- else if (dwInitialBPP != pScreenInfo->dwBPP)
- {
- /* Warn user if engine forced a depth different to -depth parameter */
- winDebug ("winScreenInit - Command line depth of %d bpp overidden by engine, using %d bpp\n", (int) dwInitialBPP, (int) pScreenInfo->dwBPP);
- }
- else
- {
- winDebug ("winScreenInit - Using command line depth of %d bpp\n", (int) pScreenInfo->dwBPP);
- }
-
- /* Check for supported display depth */
- if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1))))
- {
- ErrorF ("winScreenInit - Unsupported display depth: %d\n" \
- "Change your Windows display depth to 15, 16, 24, or 32 bits "
- "per pixel.\n",
- (int) pScreenInfo->dwBPP);
- ErrorF ("winScreenInit - Supported depths: %08x\n",
- WIN_SUPPORTED_BPPS);
+ if (pScreenPriv->pwinAdjustVideoMode && !(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) {
+ ErrorF("winScreenInit - winAdjustVideoMode () failed\n");
+ return FALSE;
+ }
+
+ if (dwInitialBPP == WIN_DEFAULT_BPP) {
+ /* No -depth parameter was passed, let the user know the depth being used */
+ winDebug
+ ("winScreenInit - Using Windows display depth of %d bits per pixel\n",
+ (int) pScreenInfo->dwBPP);
+ }
+ else if (dwInitialBPP != pScreenInfo->dwBPP) {
+ /* Warn user if engine forced a depth different to -depth parameter */
+ winDebug
+ ("winScreenInit - Command line depth of %d bpp overidden by engine, using %d bpp\n",
+ (int) dwInitialBPP, (int) pScreenInfo->dwBPP);
+ }
+ else {
+ winDebug("winScreenInit - Using command line depth of %d bpp\n",
+ (int) pScreenInfo->dwBPP);
+ }
+
+ /* Check for supported display depth */
+ if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1)))) {
+ ErrorF("winScreenInit - Unsupported display depth: %d\n"
+ "Change your Windows display depth to 15, 16, 24, or 32 bits "
+ "per pixel.\n", (int) pScreenInfo->dwBPP);
+ ErrorF("winScreenInit - Supported depths: %08x\n", WIN_SUPPORTED_BPPS);
#if WIN_CHECK_DEPTH
- return FALSE;
+ return FALSE;
#endif
}
- /*
- * Check that all monitors have the same display depth if we are using
- * multiple monitors
- */
- if (pScreenInfo->fMultipleMonitors
- && !GetSystemMetrics (SM_SAMEDISPLAYFORMAT))
- {
- ErrorF ("winScreenInit - Monitors do not all have same pixel format / "
- "display depth.\n");
- if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI)
- {
- ErrorF ("winScreenInit - Performance may suffer off primary display.\n");
+ /*
+ * Check that all monitors have the same display depth if we are using
+ * multiple monitors
+ */
+ if (pScreenInfo->fMultipleMonitors
+ && !GetSystemMetrics(SM_SAMEDISPLAYFORMAT)) {
+ ErrorF("winScreenInit - Monitors do not all have same pixel format / "
+ "display depth.\n");
+ if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI) {
+ ErrorF
+ ("winScreenInit - Performance may suffer off primary display.\n");
}
- else
- {
- ErrorF ("winScreenInit - Using primary display only.\n");
- pScreenInfo->fMultipleMonitors = FALSE;
+ else {
+ ErrorF("winScreenInit - Using primary display only.\n");
+ pScreenInfo->fMultipleMonitors = FALSE;
}
}
- /* Create display window */
- if (pScreenPriv->pwinCreateBoundingWindow && !(*pScreenPriv->pwinCreateBoundingWindow) (pScreen))
- {
- ErrorF ("winScreenInit - pwinCreateBoundingWindow () "
- "failed\n");
- return FALSE;
+ /* Create display window */
+ if (pScreenPriv->pwinCreateBoundingWindow && !(*pScreenPriv->pwinCreateBoundingWindow) (pScreen)) {
+ ErrorF("winScreenInit - pwinCreateBoundingWindow () " "failed\n");
+ return FALSE;
}
- /* Get a device context */
- hdc = GetDC (pScreenPriv->hwndScreen);
+ /* Get a device context */
+ hdc = GetDC(pScreenPriv->hwndScreen);
- /* Are we using multiple monitors? */
- if (pScreenInfo->fMultipleMonitors)
- {
- /*
- * In this case, some of the defaults set in
- * winInitializeScreenDefaults() are not correct ...
- */
- if (!pScreenInfo->fUserGaveHeightAndWidth)
- {
- pScreenInfo->dwWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
- pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
- }
+ /* Are we using multiple monitors? */
+ if (pScreenInfo->fMultipleMonitors) {
+ /*
+ * In this case, some of the defaults set in
+ * winInitializeScreenDefaults() are not correct ...
+ */
+ if (!pScreenInfo->fUserGaveHeightAndWidth) {
+ pScreenInfo->dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ pScreenInfo->dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+ }
}
- /* Release the device context */
- ReleaseDC (pScreenPriv->hwndScreen, hdc);
-
- /* Clear the visuals list */
- miClearVisualTypes ();
+ /* Release the device context */
+ ReleaseDC(pScreenPriv->hwndScreen, hdc);
+
+ /* Clear the visuals list */
+ miClearVisualTypes();
- /* Call the engine dependent screen initialization procedure */
- if (pScreenPriv->pwinFinishScreenInit && !((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv)))
- {
- ErrorF ("winScreenInit - winFinishScreenInit () failed\n");
+ /* Call the engine dependent screen initialization procedure */
+ if (pScreenPriv->pwinFinishScreenInit && !((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) {
+ ErrorF("winScreenInit - winFinishScreenInit () failed\n");
- /* call the engine dependent screen close procedure to clean up from a failure */
- pScreenPriv->pwinCloseScreen(index, pScreen);
+ /* call the engine dependent screen close procedure to clean up from a failure */
+ pScreenPriv->pwinCloseScreen(index, pScreen);
- return FALSE;
+ return FALSE;
}
- if (!g_fSoftwareCursor)
- winInitCursor(pScreen);
+ if (!g_fSoftwareCursor)
+ winInitCursor(pScreen);
#ifdef WINDBG
- else
- winDebug("winScreenInit - Using software cursor\n");
+ else
+ winDebug("winScreenInit - Using software cursor\n");
#endif
- /*
- Note the screen origin in a normalized coordinate space where (0,0) is at the top left
- of the native virtual desktop area
- */
- pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN);
- pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN);
+ /*
+ Note the screen origin in a normalized coordinate space where (0,0) is at the top left
+ of the native virtual desktop area
+ */
+ pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN);
+ pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN);
- winDebug("Screen %d added at virtual desktop coordinate (%d,%d).\n",
- index, pScreen->x, pScreen->y);
- winDebug ("winScreenInit - returning\n");
+ winDebug("Screen %d added at virtual desktop coordinate (%d,%d).\n",
+ index, pScreen->x, pScreen->y);
+ winDebug("winScreenInit - returning\n");
- return TRUE;
+ return TRUE;
}
static Bool
winCreateScreenResources(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- Bool result;
+ winScreenPriv(pScreen);
+ Bool result;
- result = pScreenPriv->pwinCreateScreenResources(pScreen);
+ result = pScreenPriv->pwinCreateScreenResources(pScreen);
- /* Now the screen bitmap has been wrapped in a pixmap,
- add that to the Shadow framebuffer */
- if (!shadowAdd(pScreen, pScreen->devPrivate,
- pScreenPriv->pwinShadowUpdate, NULL, 0, 0))
- {
- ErrorF ("winCreateScreenResources - shadowAdd () failed\n");
- return FALSE;
+ /* Now the screen bitmap has been wrapped in a pixmap,
+ add that to the Shadow framebuffer */
+ if (!shadowAdd(pScreen, pScreen->devPrivate,
+ pScreenPriv->pwinShadowUpdate, NULL, 0, 0)) {
+ ErrorF("winCreateScreenResources - shadowAdd () failed\n");
+ return FALSE;
}
- return result;
+ return result;
}
/* See Porting Layer Definition - p. 20 */
Bool
-winFinishScreenInitFB (int index,
- ScreenPtr pScreen,
- int argc, char **argv)
+winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- VisualPtr pVisual = NULL;
- char *pbits = NULL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ VisualPtr pVisual = NULL;
+ char *pbits = NULL;
+
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- int iReturn;
+ int iReturn;
#endif
- /* Create framebuffer */
- if (!(*pScreenPriv->pwinInitScreen) (pScreen))
- {
- ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n");
- return FALSE;
- }
-
- /*
- * Calculate the number of bits that are used to represent color in each pixel,
- * the color depth for the screen
- */
- if (pScreenInfo->dwBPP == 8)
- pScreenInfo->dwDepth = 8;
- else
- pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask)
- + winCountBits (pScreenPriv->dwGreenMask)
- + winCountBits (pScreenPriv->dwBlueMask);
-
- winDebug ("winFinishScreenInitFB - Masks: %08x %08x %08x\n",
- (unsigned int) pScreenPriv->dwRedMask,
- (unsigned int) pScreenPriv->dwGreenMask,
- (unsigned int) pScreenPriv->dwBlueMask);
-
- /* Init visuals */
- if (!(*pScreenPriv->pwinInitVisuals) (pScreen))
- {
- ErrorF ("winFinishScreenInitFB - winInitVisuals failed\n");
- return FALSE;
- }
-
- /* Setup a local variable to point to the framebuffer */
- pbits = pScreenInfo->pfb;
-
- /* Apparently we need this for the render extension */
- miSetPixmapDepths ();
-
- /* Start fb initialization */
- if (!fbSetupScreen (pScreen,
- pScreenInfo->pfb,
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- monitorResolution, monitorResolution,
- pScreenInfo->dwStride,
- pScreenInfo->dwBPP))
- {
- ErrorF ("winFinishScreenInitFB - fbSetupScreen failed\n");
- return FALSE;
- }
-
- /* Override default colormap routines if visual class is dynamic */
- if (pScreenInfo->dwDepth == 8
- && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
- || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
- && pScreenInfo->fFullScreen)
- || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
- && pScreenInfo->fFullScreen)))
- {
- winSetColormapFunctions (pScreen);
-
- /*
- * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its
- * own colormap, as it cannot allocate 7 planes in the default
- * colormap. Setting whitePixel to 1 allows Magic to get 7
- * planes in the default colormap, so it doesn't create its
- * own colormap. This latter situation is highly desireable,
- * as it keeps the Magic window viewable when switching to
- * other X clients that use the default colormap.
- */
- pScreen->blackPixel = 0;
- pScreen->whitePixel = 1;
- }
-
- /* Place our save screen function */
- pScreen->SaveScreen = winSaveScreen;
-
- /* Finish fb initialization */
- if (!fbFinishScreenInit (pScreen,
- pScreenInfo->pfb,
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- monitorResolution, monitorResolution,
- pScreenInfo->dwStride,
- pScreenInfo->dwBPP))
- {
- ErrorF ("winFinishScreenInitFB - fbFinishScreenInit failed\n");
- return FALSE;
- }
-
- /* Save a pointer to the root visual */
- for (pVisual = pScreen->visuals;
- pVisual->vid != pScreen->rootVisual;
- pVisual++);
- pScreenPriv->pRootVisual = pVisual;
-
- /*
- * Setup points to the block and wakeup handlers. Pass a pointer
- * to the current screen as pWakeupdata.
- */
- pScreen->BlockHandler = winBlockHandler;
- pScreen->WakeupHandler = winWakeupHandler;
- pScreen->blockData = pScreen;
- pScreen->wakeupData = pScreen;
-
- /* Render extension initialization, calls miPictureInit */
- if (!fbPictureInit (pScreen, NULL, 0))
- {
- ErrorF ("winFinishScreenInitFB - fbPictureInit () failed\n");
- return FALSE;
+ /* Create framebuffer */
+ if (!(*pScreenPriv->pwinInitScreen) (pScreen)) {
+ ErrorF("winFinishScreenInitFB - Could not allocate framebuffer\n");
+ return FALSE;
+ }
+
+ /*
+ * Calculate the number of bits that are used to represent color in each pixel,
+ * the color depth for the screen
+ */
+ if (pScreenInfo->dwBPP == 8)
+ pScreenInfo->dwDepth = 8;
+ else
+ pScreenInfo->dwDepth = winCountBits(pScreenPriv->dwRedMask)
+ + winCountBits(pScreenPriv->dwGreenMask)
+ + winCountBits(pScreenPriv->dwBlueMask);
+
+ winDebug ("winFinishScreenInitFB - Masks: %08x %08x %08x\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask);
+
+ /* Init visuals */
+ if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) {
+ ErrorF("winFinishScreenInitFB - winInitVisuals failed\n");
+ return FALSE;
+ }
+
+ /* Setup a local variable to point to the framebuffer */
+ pbits = pScreenInfo->pfb;
+
+ /* Apparently we need this for the render extension */
+ miSetPixmapDepths();
+
+ /* Start fb initialization */
+ if (!fbSetupScreen(pScreen,
+ pScreenInfo->pfb,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
+ pScreenInfo->dwStride, pScreenInfo->dwBPP)) {
+ ErrorF("winFinishScreenInitFB - fbSetupScreen failed\n");
+ return FALSE;
+ }
+
+ /* Override default colormap routines if visual class is dynamic */
+ if (pScreenInfo->dwDepth == 8
+ && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
+ || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
+ && pScreenInfo->fFullScreen)
+ || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ && pScreenInfo->fFullScreen))) {
+ winSetColormapFunctions(pScreen);
+
+ /*
+ * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its
+ * own colormap, as it cannot allocate 7 planes in the default
+ * colormap. Setting whitePixel to 1 allows Magic to get 7
+ * planes in the default colormap, so it doesn't create its
+ * own colormap. This latter situation is highly desireable,
+ * as it keeps the Magic window viewable when switching to
+ * other X clients that use the default colormap.
+ */
+ pScreen->blackPixel = 0;
+ pScreen->whitePixel = 1;
+ }
+
+ /* Place our save screen function */
+ pScreen->SaveScreen = winSaveScreen;
+
+ /* Finish fb initialization */
+ if (!fbFinishScreenInit(pScreen,
+ pScreenInfo->pfb,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
+ pScreenInfo->dwStride, pScreenInfo->dwBPP)) {
+ ErrorF("winFinishScreenInitFB - fbFinishScreenInit failed\n");
+ return FALSE;
+ }
+
+ /* Save a pointer to the root visual */
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual; pVisual++);
+ pScreenPriv->pRootVisual = pVisual;
+
+ /*
+ * Setup points to the block and wakeup handlers. Pass a pointer
+ * to the current screen as pWakeupdata.
+ */
+ pScreen->BlockHandler = winBlockHandler;
+ pScreen->WakeupHandler = winWakeupHandler;
+ pScreen->blockData = pScreen;
+ pScreen->wakeupData = pScreen;
+
+ /* Render extension initialization, calls miPictureInit */
+ if (!fbPictureInit(pScreen, NULL, 0)) {
+ ErrorF("winFinishScreenInitFB - fbPictureInit () failed\n");
+ return FALSE;
}
#ifdef RANDR
- /* Initialize resize and rotate support */
- if (!winRandRInit (pScreen))
- {
- ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n");
- return FALSE;
+ /* Initialize resize and rotate support */
+ if (!winRandRInit(pScreen)) {
+ ErrorF("winFinishScreenInitFB - winRandRInit () failed\n");
+ return FALSE;
}
#endif
- /* Setup the cursor routines */
- winDebug ("winFinishScreenInitFB - Calling miDCInitialize ()\n");
- miDCInitialize (pScreen, &g_winPointerCursorFuncs);
+ /* Setup the cursor routines */
+ winDebug("winFinishScreenInitFB - Calling miDCInitialize ()\n");
+ miDCInitialize(pScreen, &g_winPointerCursorFuncs);
- /* KDrive does winCreateDefColormap right after miDCInitialize */
- /* Create a default colormap */
- winDebug ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n");
- if (!winCreateDefColormap (pScreen))
- {
- ErrorF ("winFinishScreenInitFB - Could not create colormap\n");
- return FALSE;
+ /* KDrive does winCreateDefColormap right after miDCInitialize */
+ /* Create a default colormap */
+ winDebug("winFinishScreenInitFB - Calling winCreateDefColormap ()\n");
+ if (!winCreateDefColormap(pScreen)) {
+ ErrorF("winFinishScreenInitFB - Could not create colormap\n");
+ return FALSE;
}
- /* Initialize the shadow framebuffer layer */
- if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
- || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
- || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
+ /* Initialize the shadow framebuffer layer */
+ if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
+ || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
+ && !pScreenInfo->fMWExtWM
#endif
- )
- {
- winDebug ("winFinishScreenInitFB - Calling shadowSetup ()\n");
- if (!shadowSetup(pScreen))
- {
- ErrorF ("winFinishScreenInitFB - shadowSetup () failed\n");
- return FALSE;
- }
+ ) {
+ winDebug("winFinishScreenInitFB - Calling shadowSetup ()\n");
+ if (!shadowSetup(pScreen)) {
+ ErrorF("winFinishScreenInitFB - shadowSetup () failed\n");
+ return FALSE;
+ }
- /* Wrap CreateScreenResources so we can add the screen pixmap
- to the Shadow framebuffer after it's been created */
- pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources;
- pScreen->CreateScreenResources = winCreateScreenResources;
+ /* Wrap CreateScreenResources so we can add the screen pixmap
+ to the Shadow framebuffer after it's been created */
+ pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = winCreateScreenResources;
}
#ifdef XWIN_MULTIWINDOWEXTWM
- /* Handle multi-window external window manager mode */
- if (pScreenInfo->fMWExtWM)
- {
- winDebug ("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n");
-
- RootlessInit(pScreen, &winMWExtWMProcs);
-
- winDebug ("winScreenInit - MultiWindowExtWM - RootlessInit returned\n");
-
- rootless_CopyBytes_threshold = 0;
- /* FIXME: How many? Profiling needed? */
- rootless_CopyWindow_threshold = 1;
-
- winWindowsWMExtensionInit ();
+ /* Handle multi-window external window manager mode */
+ if (pScreenInfo->fMWExtWM) {
+ winDebug("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n");
+
+ RootlessInit(pScreen, &winMWExtWMProcs);
+
+ winDebug("winScreenInit - MultiWindowExtWM - RootlessInit returned\n");
+
+ rootless_CopyBytes_threshold = 0;
+ /* FIXME: How many? Profiling needed? */
+ rootless_CopyWindow_threshold = 1;
+
+ winWindowsWMExtensionInit();
}
#endif
- /* Handle rootless mode */
- if (pScreenInfo->fRootless)
- {
- /* Define the WRAP macro temporarily for local use */
+ /* Handle rootless mode */
+ if (pScreenInfo->fRootless) {
+ /* Define the WRAP macro temporarily for local use */
#define WRAP(a) \
if (pScreen->a) { \
pScreenPriv->a = pScreen->a; \
@@ -462,34 +429,32 @@ winFinishScreenInitFB (int index,
pScreenPriv->a = NULL; \
}
- /* Save a pointer to each lower-level window procedure */
- WRAP(CreateWindow);
- WRAP(DestroyWindow);
- WRAP(RealizeWindow);
- WRAP(UnrealizeWindow);
- WRAP(PositionWindow);
- WRAP(ChangeWindowAttributes);
- WRAP(SetShape);
-
- /* Assign rootless window procedures to be top level procedures */
- pScreen->CreateWindow = winCreateWindowRootless;
- pScreen->DestroyWindow = winDestroyWindowRootless;
- pScreen->PositionWindow = winPositionWindowRootless;
- /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless;*/
- pScreen->RealizeWindow = winMapWindowRootless;
- pScreen->UnrealizeWindow = winUnmapWindowRootless;
- pScreen->SetShape = winSetShapeRootless;
-
- /* Undefine the WRAP macro, as it is not needed elsewhere */
+ /* Save a pointer to each lower-level window procedure */
+ WRAP(CreateWindow);
+ WRAP(DestroyWindow);
+ WRAP(RealizeWindow);
+ WRAP(UnrealizeWindow);
+ WRAP(PositionWindow);
+ WRAP(ChangeWindowAttributes);
+ WRAP(SetShape);
+
+ /* Assign rootless window procedures to be top level procedures */
+ pScreen->CreateWindow = winCreateWindowRootless;
+ pScreen->DestroyWindow = winDestroyWindowRootless;
+ pScreen->PositionWindow = winPositionWindowRootless;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless; */
+ pScreen->RealizeWindow = winMapWindowRootless;
+ pScreen->UnrealizeWindow = winUnmapWindowRootless;
+ pScreen->SetShape = winSetShapeRootless;
+
+ /* Undefine the WRAP macro, as it is not needed elsewhere */
#undef WRAP
}
-
#ifdef XWIN_MULTIWINDOW
- /* Handle multi window mode */
- else if (pScreenInfo->fMultiWindow)
- {
- /* Define the WRAP macro temporarily for local use */
+ /* Handle multi window mode */
+ else if (pScreenInfo->fMultiWindow) {
+ /* Define the WRAP macro temporarily for local use */
#define WRAP(a) \
if (pScreen->a) { \
pScreenPriv->a = pScreen->a; \
@@ -498,263 +463,250 @@ winFinishScreenInitFB (int index,
pScreenPriv->a = NULL; \
}
- /* Save a pointer to each lower-level window procedure */
- WRAP(CreateWindow);
- WRAP(DestroyWindow);
- WRAP(RealizeWindow);
- WRAP(UnrealizeWindow);
- WRAP(PositionWindow);
- WRAP(ChangeWindowAttributes);
- WRAP(ReparentWindow);
- WRAP(RestackWindow);
- WRAP(ResizeWindow);
- WRAP(MoveWindow);
- WRAP(CopyWindow);
- WRAP(SetShape);
-
- /* Assign multi-window window procedures to be top level procedures */
- pScreen->CreateWindow = winCreateWindowMultiWindow;
- pScreen->DestroyWindow = winDestroyWindowMultiWindow;
- pScreen->PositionWindow = winPositionWindowMultiWindow;
- /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow;*/
- pScreen->RealizeWindow = winMapWindowMultiWindow;
- pScreen->UnrealizeWindow = winUnmapWindowMultiWindow;
- pScreen->ReparentWindow = winReparentWindowMultiWindow;
- pScreen->RestackWindow = winRestackWindowMultiWindow;
- pScreen->ResizeWindow = winResizeWindowMultiWindow;
- pScreen->MoveWindow = winMoveWindowMultiWindow;
- pScreen->CopyWindow = winCopyWindowMultiWindow;
- pScreen->SetShape = winSetShapeMultiWindow;
-
- /* Undefine the WRAP macro, as it is not needed elsewhere */
+ /* Save a pointer to each lower-level window procedure */
+ WRAP(CreateWindow);
+ WRAP(DestroyWindow);
+ WRAP(RealizeWindow);
+ WRAP(UnrealizeWindow);
+ WRAP(PositionWindow);
+ WRAP(ChangeWindowAttributes);
+ WRAP(ReparentWindow);
+ WRAP(RestackWindow);
+ WRAP(ResizeWindow);
+ WRAP(MoveWindow);
+ WRAP(CopyWindow);
+ WRAP(SetShape);
+
+ /* Assign multi-window window procedures to be top level procedures */
+ pScreen->CreateWindow = winCreateWindowMultiWindow;
+ pScreen->DestroyWindow = winDestroyWindowMultiWindow;
+ pScreen->PositionWindow = winPositionWindowMultiWindow;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow; */
+ pScreen->RealizeWindow = winMapWindowMultiWindow;
+ pScreen->UnrealizeWindow = winUnmapWindowMultiWindow;
+ pScreen->ReparentWindow = winReparentWindowMultiWindow;
+ pScreen->RestackWindow = winRestackWindowMultiWindow;
+ pScreen->ResizeWindow = winResizeWindowMultiWindow;
+ pScreen->MoveWindow = winMoveWindowMultiWindow;
+ pScreen->CopyWindow = winCopyWindowMultiWindow;
+ pScreen->SetShape = winSetShapeMultiWindow;
+
+ /* Undefine the WRAP macro, as it is not needed elsewhere */
#undef WRAP
}
#endif
- /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
+ /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Create a mutex for modules in separate threads to wait for */
- iReturn = pthread_mutex_init (&pScreenPriv->pmServerStarted, NULL);
- if (iReturn != 0)
- {
- ErrorF ("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n",
- iReturn);
- return FALSE;
- }
-
- /* Own the mutex for modules in separate threads */
- iReturn = pthread_mutex_lock (&pScreenPriv->pmServerStarted);
- if (iReturn != 0)
- {
- ErrorF ("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n",
- iReturn);
- return FALSE;
- }
-
- /* Set the ServerStarted flag to false */
- pScreenPriv->fServerStarted = FALSE;
+ /* Create a mutex for modules in separate threads to wait for */
+ iReturn = pthread_mutex_init(&pScreenPriv->pmServerStarted, NULL);
+ if (iReturn != 0) {
+ ErrorF("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n",
+ iReturn);
+ return FALSE;
+ }
+
+ /* Own the mutex for modules in separate threads */
+ iReturn = pthread_mutex_lock(&pScreenPriv->pmServerStarted);
+ if (iReturn != 0) {
+ ErrorF("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n",
+ iReturn);
+ return FALSE;
+ }
+
+ /* Set the ServerStarted flag to false */
+ pScreenPriv->fServerStarted = FALSE;
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- pScreenPriv->fRestacking = FALSE;
+ pScreenPriv->fRestacking = FALSE;
#endif
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (FALSE
+ if (FALSE
#ifdef XWIN_MULTIWINDOW
- || pScreenInfo->fMultiWindow
+ || pScreenInfo->fMultiWindow
#endif
#ifdef XWIN_MULTIWINDOWINTWM
- || pScreenInfo->fInternalWM
+ || pScreenInfo->fInternalWM
#endif
- )
- {
- winDebug ("winFinishScreenInitFB - Calling winInitWM.\n");
-
- /* Initialize multi window mode */
- if (!winInitWM (&pScreenPriv->pWMInfo,
- &pScreenPriv->ptWMProc,
- &pScreenPriv->ptXMsgProc,
- &pScreenPriv->pmServerStarted,
- pScreenInfo->dwScreen,
- (HWND)&pScreenPriv->hwndScreen,
+ ) {
+ winDebug("winFinishScreenInitFB - Calling winInitWM.\n");
+
+ /* Initialize multi window mode */
+ if (!winInitWM(&pScreenPriv->pWMInfo,
+ &pScreenPriv->ptWMProc,
+ &pScreenPriv->ptXMsgProc,
+ &pScreenPriv->pmServerStarted,
+ pScreenInfo->dwScreen, (HWND) & pScreenPriv->hwndScreen,
#ifdef XWIN_MULTIWINDOWINTWM
- pScreenInfo->fInternalWM ||
+ pScreenInfo->fInternalWM ||
#endif
- FALSE))
- {
- ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n");
- return FALSE;
+ FALSE)) {
+ ErrorF("winFinishScreenInitFB - winInitWM () failed.\n");
+ return FALSE;
}
- }
+ }
#endif
- /* Tell the server that we are enabled */
- pScreenPriv->fEnabled = TRUE;
+ /* Tell the server that we are enabled */
+ pScreenPriv->fEnabled = TRUE;
- /* Tell the server that we have a valid depth */
- pScreenPriv->fBadDepth = FALSE;
+ /* Tell the server that we have a valid depth */
+ pScreenPriv->fBadDepth = FALSE;
- winDebug ("winFinishScreenInitFB - returning\n");
+ winDebug("winFinishScreenInitFB - returning\n");
- return TRUE;
+ return TRUE;
}
#ifdef XWIN_NATIVEGDI
/* See Porting Layer Definition - p. 20 */
Bool
-winFinishScreenInitNativeGDI (int index,
- ScreenPtr pScreen,
- int argc, char **argv)
+winFinishScreenInitNativeGDI(int index,
+ ScreenPtr pScreen, int argc, char **argv)
{
- winScreenPriv(pScreen);
- winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
- VisualPtr pVisuals = NULL;
- DepthPtr pDepths = NULL;
- VisualID rootVisual = 0;
- int nVisuals = 0, nDepths = 0, nRootDepth = 0;
-
- /* Ignore user input (mouse, keyboard) */
- pScreenInfo->fIgnoreInput = FALSE;
-
- /* Get device contexts for the screen and shadow bitmap */
- pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
- if (pScreenPriv->hdcScreen == NULL)
- FatalError ("winFinishScreenInitNativeGDI - Couldn't get a DC\n");
-
- /* Init visuals */
- if (!(*pScreenPriv->pwinInitVisuals) (pScreen))
- {
- ErrorF ("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n");
- return FALSE;
- }
-
- /* Initialize the mi visuals */
- if (!miInitVisuals (&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth,
- &rootVisual,
- ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8,
- TrueColor))
- {
- ErrorF ("winFinishScreenInitNativeGDI - miInitVisuals () failed\n");
- return FALSE;
- }
-
- /* Initialize the CloseScreen procedure pointer */
- pScreen->CloseScreen = NULL;
-
- /* Initialize the mi code */
- if (!miScreenInit (pScreen,
- NULL, /* No framebuffer */
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- monitorResolution, monitorResolution,
- pScreenInfo->dwStride,
- nRootDepth, nDepths, pDepths, rootVisual,
- nVisuals, pVisuals))
- {
- ErrorF ("winFinishScreenInitNativeGDI - miScreenInit failed\n");
- return FALSE;
- }
-
- pScreen->defColormap = FakeClientID(0);
-
- /*
- * Register our block and wakeup handlers; these procedures
- * process messages in our Windows message queue; specifically,
- * they process mouse and keyboard input.
- */
- pScreen->BlockHandler = winBlockHandler;
- pScreen->WakeupHandler = winWakeupHandler;
- pScreen->blockData = pScreen;
- pScreen->wakeupData = pScreen;
-
- /* Place our save screen function */
- pScreen->SaveScreen = winSaveScreen;
-
- /* Pixmaps */
- pScreen->CreatePixmap = winCreatePixmapNativeGDI;
- pScreen->DestroyPixmap = winDestroyPixmapNativeGDI;
-
- /* Other Screen Routines */
- pScreen->QueryBestSize = winQueryBestSizeNativeGDI;
- pScreen->SaveScreen = winSaveScreen;
- pScreen->GetImage = miGetImage;
- pScreen->GetSpans = winGetSpansNativeGDI;
-
- /* Window Procedures */
- pScreen->CreateWindow = winCreateWindowNativeGDI;
- pScreen->DestroyWindow = winDestroyWindowNativeGDI;
- pScreen->PositionWindow = winPositionWindowNativeGDI;
- /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI;*/
- pScreen->RealizeWindow = winMapWindowNativeGDI;
- pScreen->UnrealizeWindow = winUnmapWindowNativeGDI;
-
- /* Paint window */
- pScreen->CopyWindow = winCopyWindowNativeGDI;
-
- /* Fonts */
- pScreen->RealizeFont = winRealizeFontNativeGDI;
- pScreen->UnrealizeFont = winUnrealizeFontNativeGDI;
-
- /* GC */
- pScreen->CreateGC = winCreateGCNativeGDI;
-
- /* Colormap Routines */
- pScreen->CreateColormap = miInitializeColormap;
- pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
- pScreen->InstallColormap = miInstallColormap;
- pScreen->UninstallColormap = miUninstallColormap;
- pScreen->ListInstalledColormaps = miListInstalledColormaps;
- pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
- pScreen->ResolveColor = miResolveColor;
-
- /* Bitmap */
- pScreen->BitmapToRegion = winPixmapToRegionNativeGDI;
-
- winDebug ("winFinishScreenInitNativeGDI - calling miDCInitialize\n");
-
- /* Set the default white and black pixel positions */
- pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0;
-
- /* Initialize the cursor */
- if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs))
- {
- ErrorF ("winFinishScreenInitNativeGDI - miDCInitialize failed\n");
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+ VisualPtr pVisuals = NULL;
+ DepthPtr pDepths = NULL;
+ VisualID rootVisual = 0;
+ int nVisuals = 0, nDepths = 0, nRootDepth = 0;
+
+ /* Ignore user input (mouse, keyboard) */
+ pScreenInfo->fIgnoreInput = FALSE;
+
+ /* Get device contexts for the screen and shadow bitmap */
+ pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen);
+ if (pScreenPriv->hdcScreen == NULL)
+ FatalError("winFinishScreenInitNativeGDI - Couldn't get a DC\n");
+
+ /* Init visuals */
+ if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) {
+ ErrorF("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n");
+ return FALSE;
+ }
+
+ /* Initialize the mi visuals */
+ if (!miInitVisuals(&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth,
+ &rootVisual,
+ ((unsigned long) 1 << (pScreenInfo->dwDepth - 1)), 8,
+ TrueColor)) {
+ ErrorF("winFinishScreenInitNativeGDI - miInitVisuals () failed\n");
+ return FALSE;
+ }
+
+ /* Initialize the CloseScreen procedure pointer */
+ pScreen->CloseScreen = NULL;
+
+ /* Initialize the mi code */
+ if (!miScreenInit(pScreen, NULL, /* No framebuffer */
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
+ pScreenInfo->dwStride,
+ nRootDepth, nDepths, pDepths, rootVisual,
+ nVisuals, pVisuals)) {
+ ErrorF("winFinishScreenInitNativeGDI - miScreenInit failed\n");
+ return FALSE;
+ }
+
+ pScreen->defColormap = FakeClientID(0);
+
+ /*
+ * Register our block and wakeup handlers; these procedures
+ * process messages in our Windows message queue; specifically,
+ * they process mouse and keyboard input.
+ */
+ pScreen->BlockHandler = winBlockHandler;
+ pScreen->WakeupHandler = winWakeupHandler;
+ pScreen->blockData = pScreen;
+ pScreen->wakeupData = pScreen;
+
+ /* Place our save screen function */
+ pScreen->SaveScreen = winSaveScreen;
+
+ /* Pixmaps */
+ pScreen->CreatePixmap = winCreatePixmapNativeGDI;
+ pScreen->DestroyPixmap = winDestroyPixmapNativeGDI;
+
+ /* Other Screen Routines */
+ pScreen->QueryBestSize = winQueryBestSizeNativeGDI;
+ pScreen->SaveScreen = winSaveScreen;
+ pScreen->GetImage = miGetImage;
+ pScreen->GetSpans = winGetSpansNativeGDI;
+
+ /* Window Procedures */
+ pScreen->CreateWindow = winCreateWindowNativeGDI;
+ pScreen->DestroyWindow = winDestroyWindowNativeGDI;
+ pScreen->PositionWindow = winPositionWindowNativeGDI;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI; */
+ pScreen->RealizeWindow = winMapWindowNativeGDI;
+ pScreen->UnrealizeWindow = winUnmapWindowNativeGDI;
+
+ /* Paint window */
+ pScreen->CopyWindow = winCopyWindowNativeGDI;
+
+ /* Fonts */
+ pScreen->RealizeFont = winRealizeFontNativeGDI;
+ pScreen->UnrealizeFont = winUnrealizeFontNativeGDI;
+
+ /* GC */
+ pScreen->CreateGC = winCreateGCNativeGDI;
+
+ /* Colormap Routines */
+ pScreen->CreateColormap = miInitializeColormap;
+ pScreen->DestroyColormap =
+ (DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
+ pScreen->InstallColormap = miInstallColormap;
+ pScreen->UninstallColormap = miUninstallColormap;
+ pScreen->ListInstalledColormaps = miListInstalledColormaps;
+ pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
+ pScreen->ResolveColor = miResolveColor;
+
+ /* Bitmap */
+ pScreen->BitmapToRegion = winPixmapToRegionNativeGDI;
+
+ winDebug ("winFinishScreenInitNativeGDI - calling miDCInitialize\n");
+
+ /* Set the default white and black pixel positions */
+ pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0;
+
+ /* Initialize the cursor */
+ if (!miDCInitialize(pScreen, &g_winPointerCursorFuncs)) {
+ ErrorF("winFinishScreenInitNativeGDI - miDCInitialize failed\n");
+ return FALSE;
}
-
- /* Create a default colormap */
- if (!miCreateDefColormap (pScreen))
- {
- ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
- "failed\n");
- return FALSE;
+
+ /* Create a default colormap */
+ if (!miCreateDefColormap(pScreen)) {
+ ErrorF("winFinishScreenInitNativeGDI - miCreateDefColormap () "
+ "failed\n");
+ return FALSE;
}
- winDebug ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
- "returned\n");
-
- /* mi doesn't use a CloseScreen procedure, so no need to wrap */
- pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
+ winDebug ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
+ "returned\n");
- /* Tell the server that we are enabled */
- pScreenPriv->fEnabled = TRUE;
+ /* mi doesn't use a CloseScreen procedure, so no need to wrap */
+ pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
+
+ /* Tell the server that we are enabled */
+ pScreenPriv->fEnabled = TRUE;
- winDebug ("winFinishScreenInitNativeGDI - Successful addition of "
- "screen %08x\n",
- (unsigned int) pScreen);
+ winDebug ("winFinishScreenInitNativeGDI - Successful addition of "
+ "screen %08x\n", (unsigned int) pScreen);
- return TRUE;
+ return TRUE;
}
#endif
-
/* See Porting Layer Definition - p. 33 */
static Bool
-winSaveScreen (ScreenPtr pScreen, int on)
+winSaveScreen(ScreenPtr pScreen, int on)
{
- return TRUE;
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/winsetsp.c b/xorg-server/hw/xwin/winsetsp.c
index 6150a9182..fb9105132 100644
--- a/xorg-server/hw/xwin/winsetsp.c
+++ b/xorg-server/hw/xwin/winsetsp.c
@@ -1,183 +1,174 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Harold L Hunt II
- * Alan Hourihane <alanh@fairlite.demon.co.uk>
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-typedef struct mybitmap
-{
- BITMAPINFOHEADER bmiHeader;
- RGBQUAD bmiColors[256]; /* Maximum palette used in case of 8-bit per pixel */
-} mybitmap_t;
-
-/* See Porting Layer Definition - p. 55 */
-void
-winSetSpansNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- char *pSrcs,
- DDXPointPtr pPoints,
- int *piWidths,
- int iSpans,
- int fSorted)
-{
- winGCPriv(pGC);
- PixmapPtr pPixmap = NULL;
- winPrivPixmapPtr pPixmapPriv = NULL;
- HBITMAP hbmpOrig = NULL;
- mybitmap_t bmi;
- HRGN hrgn = NULL, combined = NULL;
- int nbox;
- BoxPtr pbox;
-
- nbox = RegionNumRects (pGC->pCompositeClip);
- pbox = RegionRects (pGC->pCompositeClip);
-
- if (!nbox) return;
-
- combined = CreateRectRgn (pbox->x1, pbox->y1, pbox->x2, pbox->y2);
- nbox--; pbox++;
- while (nbox--)
- {
- hrgn = CreateRectRgn (pbox->x1, pbox->y1, pbox->x2, pbox->y2);
- CombineRgn (combined, combined, hrgn, RGN_OR);
- DeleteObject (hrgn);
- hrgn = NULL;
- pbox++;
- }
-
- /* Branch on the drawable type */
- switch (pDrawable->type)
- {
- case DRAWABLE_PIXMAP:
-
- SelectClipRgn (pGCPriv->hdcMem, combined);
- DeleteObject (combined);
- combined = NULL;
-
- pPixmap = (PixmapPtr) pDrawable;
- pPixmapPriv = winGetPixmapPriv (pPixmap);
-
- /* Select the drawable pixmap into a DC */
- hbmpOrig = SelectObject (pGCPriv->hdcMem, pPixmapPriv->hBitmap);
- if (hbmpOrig == NULL)
- FatalError ("winSetSpans - DRAWABLE_PIXMAP - SelectObject () "
- "failed on pPixmapPriv->hBitmap\n");
-
- while (iSpans--)
- {
- ZeroMemory (&bmi, sizeof (mybitmap_t));
- bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
- bmi.bmiHeader.biWidth = *piWidths;
- bmi.bmiHeader.biHeight = 1;
- bmi.bmiHeader.biPlanes = 1;
- bmi.bmiHeader.biBitCount = pDrawable->depth;
- bmi.bmiHeader.biCompression = BI_RGB;
-
- /* Setup color table for mono DIBs */
- if (pDrawable->depth == 1)
- {
- bmi.bmiColors[1].rgbBlue = 255;
- bmi.bmiColors[1].rgbGreen = 255;
- bmi.bmiColors[1].rgbRed = 255;
- }
-
- StretchDIBits (pGCPriv->hdcMem,
- pPoints->x, pPoints->y,
- *piWidths, 1,
- 0, 0,
- *piWidths, 1,
- pSrcs,
- (BITMAPINFO*)&bmi,
- DIB_RGB_COLORS,
- g_copyROP[pGC->alu]);
-
- pSrcs += PixmapBytePad (*piWidths, pDrawable->depth);
- pPoints++;
- piWidths++;
- }
-
- /* Reset the clip region */
- SelectClipRgn (pGCPriv->hdcMem, NULL);
-
- /* Push the drawable pixmap out of the GC HDC */
- SelectObject (pGCPriv->hdcMem, hbmpOrig);
- break;
-
- case DRAWABLE_WINDOW:
-
- SelectClipRgn (pGCPriv->hdc, combined);
- DeleteObject (combined);
- combined = NULL;
-
- while (iSpans--)
- {
- ZeroMemory (&bmi, sizeof (mybitmap_t));
- bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
- bmi.bmiHeader.biWidth = *piWidths;
- bmi.bmiHeader.biHeight = 1;
- bmi.bmiHeader.biPlanes = 1;
- bmi.bmiHeader.biBitCount = pDrawable->depth;
- bmi.bmiHeader.biCompression = BI_RGB;
-
- /* Setup color table for mono DIBs */
- if (pDrawable->depth == 1)
- {
- bmi.bmiColors[1].rgbBlue = 255;
- bmi.bmiColors[1].rgbGreen = 255;
- bmi.bmiColors[1].rgbRed = 255;
- }
-
- StretchDIBits (pGCPriv->hdc,
- pPoints->x, pPoints->y,
- *piWidths, 1,
- 0, 0,
- *piWidths, 1,
- pSrcs,
- (BITMAPINFO *) &bmi,
- DIB_RGB_COLORS,
- g_copyROP[pGC->alu]);
-
- pSrcs += PixmapBytePad (*piWidths, pDrawable->depth);
- pPoints++;
- piWidths++;
- }
-
- /* Reset the clip region */
- SelectClipRgn (pGCPriv->hdc, NULL);
- break;
-
- default:
- FatalError ("\nwinSetSpansNativeGDI - Unknown drawable type\n\n");
- break;
- }
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Harold L Hunt II
+ * Alan Hourihane <alanh@fairlite.demon.co.uk>
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+typedef struct mybitmap
+{
+ BITMAPINFOHEADER bmiHeader;
+ RGBQUAD bmiColors[256]; /* Maximum palette used in case of 8-bit per pixel */
+} mybitmap_t;
+/* See Porting Layer Definition - p. 55 */
+void
+winSetSpansNativeGDI(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrcs,
+ DDXPointPtr pPoints,
+ int *piWidths, int iSpans, int fSorted)
+{
+ winGCPriv(pGC);
+ PixmapPtr pPixmap = NULL;
+ winPrivPixmapPtr pPixmapPriv = NULL;
+ HBITMAP hbmpOrig = NULL;
+ mybitmap_t bmi;
+ HRGN hrgn = NULL, combined = NULL;
+ int nbox;
+ BoxPtr pbox;
+
+ nbox = RegionNumRects(pGC->pCompositeClip);
+ pbox = RegionRects(pGC->pCompositeClip);
+
+ if (!nbox)
+ return;
+
+ combined = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
+ nbox--;
+ pbox++;
+ while (nbox--) {
+ hrgn = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
+ CombineRgn(combined, combined, hrgn, RGN_OR);
+ DeleteObject(hrgn);
+ hrgn = NULL;
+ pbox++;
+ }
+
+ /* Branch on the drawable type */
+ switch (pDrawable->type) {
+ case DRAWABLE_PIXMAP:
+
+ SelectClipRgn(pGCPriv->hdcMem, combined);
+ DeleteObject(combined);
+ combined = NULL;
+
+ pPixmap = (PixmapPtr) pDrawable;
+ pPixmapPriv = winGetPixmapPriv(pPixmap);
+
+ /* Select the drawable pixmap into a DC */
+ hbmpOrig = SelectObject(pGCPriv->hdcMem, pPixmapPriv->hBitmap);
+ if (hbmpOrig == NULL)
+ FatalError("winSetSpans - DRAWABLE_PIXMAP - SelectObject () "
+ "failed on pPixmapPriv->hBitmap\n");
+
+ while (iSpans--) {
+ ZeroMemory (&bmi, sizeof (mybitmap_t));
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = *piWidths;
+ bmi.bmiHeader.biHeight = 1;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = pDrawable->depth;
+ bmi.bmiHeader.biCompression = BI_RGB;
+
+ /* Setup color table for mono DIBs */
+ if (pDrawable->depth == 1) {
+ bmi.bmiColors[1].rgbBlue = 255;
+ bmi.bmiColors[1].rgbGreen = 255;
+ bmi.bmiColors[1].rgbRed = 255;
+ }
+
+ StretchDIBits(pGCPriv->hdcMem,
+ pPoints->x, pPoints->y,
+ *piWidths, 1,
+ 0, 0,
+ *piWidths, 1,
+ pSrcs,
+ (BITMAPINFO*)&bmi,
+ DIB_RGB_COLORS, g_copyROP[pGC->alu]);
+
+ pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
+ pPoints++;
+ piWidths++;
+ }
+
+ /* Reset the clip region */
+ SelectClipRgn(pGCPriv->hdcMem, NULL);
+
+ /* Push the drawable pixmap out of the GC HDC */
+ SelectObject(pGCPriv->hdcMem, hbmpOrig);
+ break;
+
+ case DRAWABLE_WINDOW:
+
+ SelectClipRgn(pGCPriv->hdc, combined);
+ DeleteObject(combined);
+ combined = NULL;
+
+ while (iSpans--) {
+ ZeroMemory (&bmi, sizeof (mybitmap_t));
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = *piWidths;
+ bmi.bmiHeader.biHeight = 1;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = pDrawable->depth;
+ bmi.bmiHeader.biCompression = BI_RGB;
+
+ /* Setup color table for mono DIBs */
+ if (pDrawable->depth == 1) {
+ bmi.bmiColors[1].rgbBlue = 255;
+ bmi.bmiColors[1].rgbGreen = 255;
+ bmi.bmiColors[1].rgbRed = 255;
+ }
+
+ StretchDIBits(pGCPriv->hdc,
+ pPoints->x, pPoints->y,
+ *piWidths, 1,
+ 0, 0,
+ *piWidths, 1,
+ pSrcs,
+ (BITMAPINFO *) & bmi,
+ DIB_RGB_COLORS, g_copyROP[pGC->alu]);
+
+ pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
+ pPoints++;
+ piWidths++;
+ }
+
+ /* Reset the clip region */
+ SelectClipRgn(pGCPriv->hdc, NULL);
+ break;
+
+ default:
+ FatalError("\nwinSetSpansNativeGDI - Unknown drawable type\n\n");
+ break;
+ }
+}
diff --git a/xorg-server/hw/xwin/winshaddd.c b/xorg-server/hw/xwin/winshaddd.c
index cf4dd62f1..4b0eba1cb 100644
--- a/xorg-server/hw/xwin/winshaddd.c
+++ b/xorg-server/hw/xwin/winshaddd.c
@@ -37,61 +37,55 @@
#include "win.h"
-/*
-
/*
* Local prototypes
*/
static Bool
-winAllocateFBShadowDD (ScreenPtr pScreen);
+ winAllocateFBShadowDD(ScreenPtr pScreen);
static void
-winShadowUpdateDD (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf);
static Bool
-winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen);
+ winCloseScreenShadowDD(int nIndex, ScreenPtr pScreen);
static Bool
-winInitVisualsShadowDD (ScreenPtr pScreen);
+ winInitVisualsShadowDD(ScreenPtr pScreen);
static Bool
-winAdjustVideoModeShadowDD (ScreenPtr pScreen);
+ winAdjustVideoModeShadowDD(ScreenPtr pScreen);
static Bool
-winBltExposedRegionsShadowDD (ScreenPtr pScreen);
+ winBltExposedRegionsShadowDD(ScreenPtr pScreen);
static Bool
-winActivateAppShadowDD (ScreenPtr pScreen);
+ winActivateAppShadowDD(ScreenPtr pScreen);
static Bool
-winRedrawScreenShadowDD (ScreenPtr pScreen);
+ winRedrawScreenShadowDD(ScreenPtr pScreen);
static Bool
-winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen);
+ winRealizeInstalledPaletteShadowDD(ScreenPtr pScreen);
static Bool
-winInstallColormapShadowDD (ColormapPtr pColormap);
+ winInstallColormapShadowDD(ColormapPtr pColormap);
static Bool
-winStoreColorsShadowDD (ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs);
+ winStoreColorsShadowDD(ColormapPtr pmap, int ndef, xColorItem * pdefs);
static Bool
-winCreateColormapShadowDD (ColormapPtr pColormap);
+ winCreateColormapShadowDD(ColormapPtr pColormap);
static Bool
-winDestroyColormapShadowDD (ColormapPtr pColormap);
+ winDestroyColormapShadowDD(ColormapPtr pColormap);
static Bool
-winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen);
+ winCreatePrimarySurfaceShadowDD(ScreenPtr pScreen);
static Bool
-winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen);
-
+ winReleasePrimarySurfaceShadowDD(ScreenPtr pScreen);
/*
* Create the primary surface and attach the clipper.
@@ -100,89 +94,80 @@ winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen);
*/
static Bool
-winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen)
+winCreatePrimarySurfaceShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC ddsd;
-
- /* Describe the primary surface */
- ZeroMemory (&ddsd, sizeof (ddsd));
- ddsd.dwSize = sizeof (ddsd);
- ddsd.dwFlags = DDSD_CAPS;
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-
- /* Create the primary surface */
- ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2,
- &ddsd,
- &pScreenPriv->pddsPrimary,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winCreatePrimarySurfaceShadowDD - Could not create primary "
- "surface: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ winScreenPriv(pScreen);
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC ddsd;
+
+ /* Describe the primary surface */
+ ZeroMemory(&ddsd, sizeof(ddsd));
+ ddsd.dwSize = sizeof(ddsd);
+ ddsd.dwFlags = DDSD_CAPS;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+
+ /* Create the primary surface */
+ ddrval = IDirectDraw2_CreateSurface(pScreenPriv->pdd2,
+ &ddsd, &pScreenPriv->pddsPrimary, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winCreatePrimarySurfaceShadowDD - Could not create primary "
+ "surface: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
-
- winDebug ("winCreatePrimarySurfaceShadowDD - Created primary surface\n");
-
- /*
- * Attach a clipper to the primary surface that will clip our blits to our
- * display window.
- */
- ddrval = IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary,
- pScreenPriv->pddcPrimary);
- if (FAILED (ddrval))
- {
- ErrorF ("winCreatePrimarySurfaceShadowDD - Primary attach clipper "
- "failed: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+
+ winDebug("winCreatePrimarySurfaceShadowDD - Created primary surface\n");
+
+ /*
+ * Attach a clipper to the primary surface that will clip our blits to our
+ * display window.
+ */
+ ddrval = IDirectDrawSurface2_SetClipper(pScreenPriv->pddsPrimary,
+ pScreenPriv->pddcPrimary);
+ if (FAILED(ddrval)) {
+ ErrorF("winCreatePrimarySurfaceShadowDD - Primary attach clipper "
+ "failed: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
- winDebug ("winCreatePrimarySurfaceShadowDD - Attached clipper to "
- "primary surface\n");
+ winDebug("winCreatePrimarySurfaceShadowDD - Attached clipper to "
+ "primary surface\n");
- /* Everything was correct */
- return TRUE;
+ /* Everything was correct */
+ return TRUE;
}
-
/*
* Detach the clipper and release the primary surface.
* Called from WM_DISPLAYCHANGE.
*/
static Bool
-winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen)
+winReleasePrimarySurfaceShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
- winDebug ("winReleasePrimarySurfaceShadowDD - Hello\n");
+ winDebug ("winReleasePrimarySurfaceShadowDD - Hello\n");
- /* Release the primary surface and clipper, if they exist */
- if (pScreenPriv->pddsPrimary)
- {
- /*
- * Detach the clipper from the primary surface.
- * NOTE: We do this explicity for clarity. The Clipper is not released.
- */
- IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary,
- NULL);
+ /* Release the primary surface and clipper, if they exist */
+ if (pScreenPriv->pddsPrimary) {
+ /*
+ * Detach the clipper from the primary surface.
+ * NOTE: We do this explicity for clarity. The Clipper is not released.
+ */
+ IDirectDrawSurface2_SetClipper(pScreenPriv->pddsPrimary, NULL);
- winDebug ("winReleasePrimarySurfaceShadowDD - Detached clipper\n");
+ winDebug ("winReleasePrimarySurfaceShadowDD - Detached clipper\n");
- /* Release the primary surface */
- IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
- pScreenPriv->pddsPrimary = NULL;
+ /* Release the primary surface */
+ IDirectDrawSurface2_Release(pScreenPriv->pddsPrimary);
+ pScreenPriv->pddsPrimary = NULL;
}
- winDebug ("winReleasePrimarySurfaceShadowDD - Released primary surface\n");
+ winDebug ("winReleasePrimarySurfaceShadowDD - Released primary surface\n");
- return TRUE;
+ return TRUE;
}
-
/*
* Create a DirectDraw surface for the shadow framebuffer; also create
* a primary surface object so we can blit to the display.
@@ -192,319 +177,283 @@ winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen)
*/
static Bool
-winAllocateFBShadowDD (ScreenPtr pScreen)
+winAllocateFBShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC ddsd;
- DDSURFACEDESC *pddsdShadow = NULL;
-
- winDebug ("winAllocateFBShadowDD\n");
-
- /* Create a clipper */
- ddrval = (*g_fpDirectDrawCreateClipper) (0,
- &pScreenPriv->pddcPrimary,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Could not create clipper: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC ddsd;
+ DDSURFACEDESC *pddsdShadow = NULL;
+
+ winDebug("winAllocateFBShadowDD\n");
+
+ /* Create a clipper */
+ ddrval = (*g_fpDirectDrawCreateClipper) (0,
+ &pScreenPriv->pddcPrimary, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDD - Could not create clipper: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
}
- winDebug ("winAllocateFBShadowDD - Created a clipper\n");
-
- /* Attach the clipper to our display window */
- ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary,
- 0,
- pScreenPriv->hwndScreen);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Clipper not attached to "
- "window: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ winDebug("winAllocateFBShadowDD - Created a clipper\n");
+
+ /* Attach the clipper to our display window */
+ ddrval = IDirectDrawClipper_SetHWnd(pScreenPriv->pddcPrimary,
+ 0, pScreenPriv->hwndScreen);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDD - Clipper not attached to "
+ "window: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
- winDebug ("winAllocateFBShadowDD - Attached clipper to window\n");
+ winDebug("winAllocateFBShadowDD - Attached clipper to window\n");
- /* Create a DirectDraw object, store the address at lpdd */
- ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Could not start DirectDraw: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ /* Create a DirectDraw object, store the address at lpdd */
+ ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDD - Could not start DirectDraw: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
}
- winDebug ("winAllocateFBShadowDD () - Created and initialized DD\n");
-
- /* Get a DirectDraw2 interface pointer */
- ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd,
- &IID_IDirectDraw2,
- (LPVOID*) &pScreenPriv->pdd2);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ winDebug("winAllocateFBShadowDD () - Created and initialized DD\n");
+
+ /* Get a DirectDraw2 interface pointer */
+ ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
+ &IID_IDirectDraw2,
+ (LPVOID *) & pScreenPriv->pdd2);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
}
- /* Are we full screen? */
- if (pScreenInfo->fFullScreen)
- {
- DDSURFACEDESC ddsdCurrent;
- DWORD dwRefreshRateCurrent = 0;
- HDC hdc = NULL;
-
- /* Set the cooperative level to full screen */
- ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2,
- pScreenPriv->hwndScreen,
- DDSCL_EXCLUSIVE
- | DDSCL_FULLSCREEN);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Could not set "
- "cooperative level: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
-
- /*
- * We only need to get the current refresh rate for comparison
- * if a refresh rate has been passed on the command line.
- */
- if (pScreenInfo->dwRefreshRate != 0)
- {
- ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent));
- ddsdCurrent.dwSize = sizeof (ddsdCurrent);
-
- /* Get information about current display settings */
- ddrval = IDirectDraw2_GetDisplayMode (pScreenPriv->pdd2,
- &ddsdCurrent);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Could not get current "
- "refresh rate: %08x. Continuing.\n",
- (unsigned int) ddrval);
- dwRefreshRateCurrent = 0;
- }
- else
- {
- /* Grab the current refresh rate */
- dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate;
- }
- }
-
- /* Clean up the refresh rate */
- if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate)
- {
- /*
- * Refresh rate is non-specified or equal to current.
- */
- pScreenInfo->dwRefreshRate = 0;
- }
-
- /* Grab a device context for the screen */
- hdc = GetDC (NULL);
- if (hdc == NULL)
- {
- ErrorF ("winAllocateFBShadowDD - GetDC () failed\n");
- return FALSE;
- }
-
- /* Only change the video mode when different than current mode */
- if (!pScreenInfo->fMultipleMonitors
- && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN)
- || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN)
- || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL)
- || pScreenInfo->dwRefreshRate != 0))
- {
- winDebug ("winAllocateFBShadowDD - Changing video mode\n");
-
- /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
- ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2,
- pScreenInfo->dwWidth,
- pScreenInfo->dwHeight,
- pScreenInfo->dwBPP,
- pScreenInfo->dwRefreshRate,
- 0);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Could not set "\
- "full screen display mode: %08x\n",
- (unsigned int) ddrval);
- ErrorF ("winAllocateFBShadowDD - Using default driver refresh rate\n");
- ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2,
- pScreenInfo->dwWidth,
- pScreenInfo->dwHeight,
- pScreenInfo->dwBPP,
- 0,
- 0);
- if (FAILED(ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Could not set default refresh rate "
- "full screen display mode: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
- }
- }
- else
- {
- winDebug ("winAllocateFBShadowDD - Not changing video mode\n");
- }
-
- /* Release our DC */
- ReleaseDC (NULL, hdc);
- hdc = NULL;
+ /* Are we full screen? */
+ if (pScreenInfo->fFullScreen) {
+ DDSURFACEDESC ddsdCurrent;
+ DWORD dwRefreshRateCurrent = 0;
+ HDC hdc = NULL;
+
+ /* Set the cooperative level to full screen */
+ ddrval = IDirectDraw2_SetCooperativeLevel(pScreenPriv->pdd2,
+ pScreenPriv->hwndScreen,
+ DDSCL_EXCLUSIVE
+ | DDSCL_FULLSCREEN);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDD - Could not set "
+ "cooperative level: %08x\n", (unsigned int) ddrval);
+ return FALSE;
+ }
+
+ /*
+ * We only need to get the current refresh rate for comparison
+ * if a refresh rate has been passed on the command line.
+ */
+ if (pScreenInfo->dwRefreshRate != 0) {
+ ZeroMemory(&ddsdCurrent, sizeof(ddsdCurrent));
+ ddsdCurrent.dwSize = sizeof(ddsdCurrent);
+
+ /* Get information about current display settings */
+ ddrval = IDirectDraw2_GetDisplayMode(pScreenPriv->pdd2,
+ &ddsdCurrent);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDD - Could not get current "
+ "refresh rate: %08x. Continuing.\n",
+ (unsigned int) ddrval);
+ dwRefreshRateCurrent = 0;
+ }
+ else {
+ /* Grab the current refresh rate */
+ dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate;
+ }
+ }
+
+ /* Clean up the refresh rate */
+ if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) {
+ /*
+ * Refresh rate is non-specified or equal to current.
+ */
+ pScreenInfo->dwRefreshRate = 0;
+ }
+
+ /* Grab a device context for the screen */
+ hdc = GetDC(NULL);
+ if (hdc == NULL) {
+ ErrorF("winAllocateFBShadowDD - GetDC () failed\n");
+ return FALSE;
+ }
+
+ /* Only change the video mode when different than current mode */
+ if (!pScreenInfo->fMultipleMonitors
+ && (pScreenInfo->dwWidth != GetSystemMetrics(SM_CXSCREEN)
+ || pScreenInfo->dwHeight != GetSystemMetrics(SM_CYSCREEN)
+ || pScreenInfo->dwBPP != GetDeviceCaps(hdc, BITSPIXEL)
+ || pScreenInfo->dwRefreshRate != 0)) {
+ winDebug ("winAllocateFBShadowDD - Changing video mode\n");
+
+ /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
+ ddrval = IDirectDraw2_SetDisplayMode(pScreenPriv->pdd2,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP,
+ pScreenInfo->dwRefreshRate, 0);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDD - Could not set "
+ "full screen display mode: %08x\n",
+ (unsigned int) ddrval);
+ ErrorF
+ ("winAllocateFBShadowDD - Using default driver refresh rate\n");
+ ddrval =
+ IDirectDraw2_SetDisplayMode(pScreenPriv->pdd2,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP, 0, 0);
+ if (FAILED(ddrval)) {
+ ErrorF
+ ("winAllocateFBShadowDD - Could not set default refresh rate "
+ "full screen display mode: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+ }
+ }
+ else {
+ winDebug ("winAllocateFBShadowDD - Not changing video mode\n");
+ }
+
+ /* Release our DC */
+ ReleaseDC(NULL, hdc);
+ hdc = NULL;
}
- else
- {
- /* Set the cooperative level for windowed mode */
- ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2,
- pScreenPriv->hwndScreen,
- DDSCL_NORMAL);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Could not set "\
- "cooperative level: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
+ else {
+ /* Set the cooperative level for windowed mode */
+ ddrval = IDirectDraw2_SetCooperativeLevel(pScreenPriv->pdd2,
+ pScreenPriv->hwndScreen,
+ DDSCL_NORMAL);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDD - Could not set "
+ "cooperative level: %08x\n", (unsigned int) ddrval);
+ return FALSE;
+ }
}
- /* Create the primary surface */
- if (!winCreatePrimarySurfaceShadowDD (pScreen))
- {
- ErrorF ("winAllocateFBShadowDD - winCreatePrimarySurfaceShadowDD "
- "failed\n");
- return FALSE;
+ /* Create the primary surface */
+ if (!winCreatePrimarySurfaceShadowDD(pScreen)) {
+ ErrorF("winAllocateFBShadowDD - winCreatePrimarySurfaceShadowDD "
+ "failed\n");
+ return FALSE;
}
- /* Describe the shadow surface to be created */
- /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
- * as drawing, locking, and unlocking take forever
- * with video memory surfaces. In addition,
- * video memory is a somewhat scarce resource,
- * so you shouldn't be allocating video memory when
- * you have the option of using system memory instead.
- */
- ZeroMemory (&ddsd, sizeof (ddsd));
- ddsd.dwSize = sizeof (ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
- ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
- ddsd.dwHeight = pScreenInfo->dwHeight;
- ddsd.dwWidth = pScreenInfo->dwWidth;
-
- /* Create the shadow surface */
- ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2,
- &ddsd,
- &pScreenPriv->pddsShadow,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDD - Could not create shadow "\
- "surface: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ /* Describe the shadow surface to be created */
+ /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
+ * as drawing, locking, and unlocking take forever
+ * with video memory surfaces. In addition,
+ * video memory is a somewhat scarce resource,
+ * so you shouldn't be allocating video memory when
+ * you have the option of using system memory instead.
+ */
+ ZeroMemory(&ddsd, sizeof(ddsd));
+ ddsd.dwSize = sizeof(ddsd);
+ ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
+ ddsd.dwHeight = pScreenInfo->dwHeight;
+ ddsd.dwWidth = pScreenInfo->dwWidth;
+
+ /* Create the shadow surface */
+ ddrval = IDirectDraw2_CreateSurface(pScreenPriv->pdd2,
+ &ddsd, &pScreenPriv->pddsShadow, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDD - Could not create shadow "
+ "surface: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
-
- winDebug ("winAllocateFBShadowDD - Created shadow\n");
-
- /* Allocate a DD surface description for our screen privates */
- pddsdShadow = pScreenPriv->pddsdShadow = malloc (sizeof (DDSURFACEDESC));
- if (pddsdShadow == NULL)
- {
- ErrorF ("winAllocateFBShadowDD - Could not allocate surface "\
- "description memory\n");
- return FALSE;
+
+ winDebug("winAllocateFBShadowDD - Created shadow\n");
+
+ /* Allocate a DD surface description for our screen privates */
+ pddsdShadow = pScreenPriv->pddsdShadow = malloc(sizeof(DDSURFACEDESC));
+ if (pddsdShadow == NULL) {
+ ErrorF("winAllocateFBShadowDD - Could not allocate surface "
+ "description memory\n");
+ return FALSE;
}
- ZeroMemory (pddsdShadow, sizeof (*pddsdShadow));
- pddsdShadow->dwSize = sizeof (*pddsdShadow);
-
- winDebug ("winAllocateFBShadowDD - Locking shadow\n");
-
- /* Lock the shadow surface */
- ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow,
- NULL,
- pddsdShadow,
- DDLOCK_WAIT,
- NULL);
- if (FAILED (ddrval) || pddsdShadow->lpSurface == NULL)
- {
- ErrorF ("winAllocateFBShadowDD - Could not lock shadow "\
- "surface: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ ZeroMemory(pddsdShadow, sizeof(*pddsdShadow));
+ pddsdShadow->dwSize = sizeof(*pddsdShadow);
+
+ winDebug("winAllocateFBShadowDD - Locking shadow\n");
+
+ /* Lock the shadow surface */
+ ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsShadow,
+ NULL, pddsdShadow, DDLOCK_WAIT, NULL);
+ if (FAILED(ddrval) || pddsdShadow->lpSurface == NULL) {
+ ErrorF("winAllocateFBShadowDD - Could not lock shadow "
+ "surface: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
- winDebug ("winAllocateFBShadowDD - Locked shadow\n");
+ winDebug("winAllocateFBShadowDD - Locked shadow\n");
- /* We don't know how to deal with anything other than RGB */
- if (!(pddsdShadow->ddpfPixelFormat.dwFlags & DDPF_RGB))
- {
- ErrorF ("winAllocateFBShadowDD - Color format other than RGB\n");
- return FALSE;
+ /* We don't know how to deal with anything other than RGB */
+ if (!(pddsdShadow->ddpfPixelFormat.dwFlags & DDPF_RGB)) {
+ ErrorF("winAllocateFBShadowDD - Color format other than RGB\n");
+ return FALSE;
}
- /* Grab the pitch from the surface desc */
- pScreenInfo->dwStride = (pddsdShadow->u1.lPitch * 8)
- / pScreenInfo->dwBPP;
+ /* Grab the pitch from the surface desc */
+ pScreenInfo->dwStride = (pddsdShadow->u1.lPitch * 8)
+ / pScreenInfo->dwBPP;
+
+ /* Save the pointer to our surface memory */
+ pScreenInfo->pfb = pddsdShadow->lpSurface;
- /* Save the pointer to our surface memory */
- pScreenInfo->pfb = pddsdShadow->lpSurface;
-
- /* Grab the color depth and masks from the surface description */
- pScreenPriv->dwRedMask = pddsdShadow->ddpfPixelFormat.u2.dwRBitMask;
- pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask;
- pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask;
+ /* Grab the color depth and masks from the surface description */
+ pScreenPriv->dwRedMask = pddsdShadow->ddpfPixelFormat.u2.dwRBitMask;
+ pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask;
+ pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask;
- winDebug ("winAllocateFBShadowDD - Returning\n");
+ winDebug("winAllocateFBShadowDD - Returning\n");
- return TRUE;
+ return TRUE;
}
static void
-winFreeFBShadowDD (ScreenPtr pScreen)
+winFreeFBShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Free the shadow surface, if there is one */
- if (pScreenPriv->pddsShadow)
- {
- IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL);
- IDirectDrawSurface2_Release (pScreenPriv->pddsShadow);
- pScreenPriv->pddsShadow = NULL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Free the shadow surface, if there is one */
+ if (pScreenPriv->pddsShadow) {
+ IDirectDrawSurface2_Unlock(pScreenPriv->pddsShadow, NULL);
+ IDirectDrawSurface2_Release(pScreenPriv->pddsShadow);
+ pScreenPriv->pddsShadow = NULL;
}
- /* Detach the clipper from the primary surface and release the primary surface, if there is one */
- winReleasePrimarySurfaceShadowDD(pScreen);
+ /* Detach the clipper from the primary surface and release the primary surface, if there is one */
+ winReleasePrimarySurfaceShadowDD(pScreen);
- /* Release the clipper object */
- if (pScreenPriv->pddcPrimary)
- {
- IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
- pScreenPriv->pddcPrimary = NULL;
+ /* Release the clipper object */
+ if (pScreenPriv->pddcPrimary) {
+ IDirectDrawClipper_Release(pScreenPriv->pddcPrimary);
+ pScreenPriv->pddcPrimary = NULL;
}
- /* Free the DirectDraw2 object, if there is one */
- if (pScreenPriv->pdd2)
- {
- IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd2);
- IDirectDraw2_Release (pScreenPriv->pdd2);
- pScreenPriv->pdd2 = NULL;
+ /* Free the DirectDraw2 object, if there is one */
+ if (pScreenPriv->pdd2) {
+ IDirectDraw2_RestoreDisplayMode(pScreenPriv->pdd2);
+ IDirectDraw2_Release(pScreenPriv->pdd2);
+ pScreenPriv->pdd2 = NULL;
}
- /* Free the DirectDraw object, if there is one */
- if (pScreenPriv->pdd)
- {
- IDirectDraw_Release (pScreenPriv->pdd);
- pScreenPriv->pdd = NULL;
+ /* Free the DirectDraw object, if there is one */
+ if (pScreenPriv->pdd) {
+ IDirectDraw_Release(pScreenPriv->pdd);
+ pScreenPriv->pdd = NULL;
}
- /* Invalidate the ScreenInfo's fb pointer */
- pScreenInfo->pfb = NULL;
+ /* Invalidate the ScreenInfo's fb pointer */
+ pScreenInfo->pfb = NULL;
}
/*
@@ -512,162 +461,149 @@ winFreeFBShadowDD (ScreenPtr pScreen)
*/
static void
-winShadowUpdateDD (ScreenPtr pScreen,
- shadowBufPtr pBuf)
+winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RegionPtr damage = shadowDamage(pBuf);
- HRESULT ddrval = DD_OK;
- RECT rcDest, rcSrc;
- POINT ptOrigin;
- DWORD dwBox = RegionNumRects (damage);
- BoxPtr pBox = RegionRects (damage);
- HRGN hrgnTemp = NULL, hrgnCombined = NULL;
-
- /*
- * Return immediately if the app is not active
- * and we are fullscreen, or if we have a bad display depth
- */
- if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
- || pScreenPriv->fBadDepth) return;
-
- /* Return immediately if we didn't get needed surfaces */
- if (!pScreenPriv->pddsPrimary || !pScreenPriv->pddsShadow)
- return;
-
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
- MapWindowPoints (pScreenPriv->hwndScreen,
- HWND_DESKTOP,
- (LPPOINT)&ptOrigin, 1);
-
- /* Unlock the shadow surface, so we can blit */
- ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winShadowUpdateDD - Unlock failed\n");
- return;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RegionPtr damage = shadowDamage(pBuf);
+ HRESULT ddrval = DD_OK;
+ RECT rcDest, rcSrc;
+ POINT ptOrigin;
+ DWORD dwBox = RegionNumRects(damage);
+ BoxPtr pBox = RegionRects(damage);
+ HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+
+ /*
+ * Return immediately if the app is not active
+ * and we are fullscreen, or if we have a bad display depth
+ */
+ if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
+ || pScreenPriv->fBadDepth)
+ return;
+
+ /* Return immediately if we didn't get needed surfaces */
+ if (!pScreenPriv->pddsPrimary || !pScreenPriv->pddsShadow)
+ return;
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+ MapWindowPoints(pScreenPriv->hwndScreen,
+ HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+
+ /* Unlock the shadow surface, so we can blit */
+ ddrval = IDirectDrawSurface2_Unlock(pScreenPriv->pddsShadow, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winShadowUpdateDD - Unlock failed\n");
+ return;
}
- /*
- * Handle small regions with multiple blits,
- * handle large regions by creating a clipping region and
- * doing a single blit constrained to that clipping region.
- */
- if (pScreenInfo->dwClipUpdatesNBoxes == 0
- || dwBox < pScreenInfo->dwClipUpdatesNBoxes)
- {
- /* Loop through all boxes in the damaged region */
- while (dwBox--)
- {
- /* Assign damage box to source rectangle */
- rcSrc.left = pBox->x1;
- rcSrc.top = pBox->y1;
- rcSrc.right = pBox->x2;
- rcSrc.bottom = pBox->y2;
-
- /* Calculate destination rectange */
- rcDest.left = ptOrigin.x + rcSrc.left;
- rcDest.top = ptOrigin.y + rcSrc.top;
- rcDest.right = ptOrigin.x + rcSrc.right;
- rcDest.bottom = ptOrigin.y + rcSrc.bottom;
-
- /* Blit the damaged areas */
- ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
- &rcDest,
- pScreenPriv->pddsShadow,
- &rcSrc,
- DDBLT_WAIT,
- NULL);
-
- /* Get a pointer to the next box */
- ++pBox;
- }
+ /*
+ * Handle small regions with multiple blits,
+ * handle large regions by creating a clipping region and
+ * doing a single blit constrained to that clipping region.
+ */
+ if (pScreenInfo->dwClipUpdatesNBoxes == 0
+ || dwBox < pScreenInfo->dwClipUpdatesNBoxes) {
+ /* Loop through all boxes in the damaged region */
+ while (dwBox--) {
+ /* Assign damage box to source rectangle */
+ rcSrc.left = pBox->x1;
+ rcSrc.top = pBox->y1;
+ rcSrc.right = pBox->x2;
+ rcSrc.bottom = pBox->y2;
+
+ /* Calculate destination rectange */
+ rcDest.left = ptOrigin.x + rcSrc.left;
+ rcDest.top = ptOrigin.y + rcSrc.top;
+ rcDest.right = ptOrigin.x + rcSrc.right;
+ rcDest.bottom = ptOrigin.y + rcSrc.bottom;
+
+ /* Blit the damaged areas */
+ ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
+ &rcDest,
+ pScreenPriv->pddsShadow,
+ &rcSrc, DDBLT_WAIT, NULL);
+
+ /* Get a pointer to the next box */
+ ++pBox;
+ }
}
- else
- {
- BoxPtr pBoxExtents = RegionExtents(damage);
-
- /* Compute a GDI region from the damaged region */
- hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
- dwBox--;
- pBox++;
- while (dwBox--)
- {
- hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
- CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
- DeleteObject (hrgnTemp);
- pBox++;
- }
-
- /* Install the GDI region as a clipping region */
- SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined);
- DeleteObject (hrgnCombined);
- hrgnCombined = NULL;
-
- /* Calculating a bounding box for the source is easy */
- rcSrc.left = pBoxExtents->x1;
- rcSrc.top = pBoxExtents->y1;
- rcSrc.right = pBoxExtents->x2;
- rcSrc.bottom = pBoxExtents->y2;
-
- /* Calculating a bounding box for the destination is trickier */
- rcDest.left = ptOrigin.x + rcSrc.left;
- rcDest.top = ptOrigin.y + rcSrc.top;
- rcDest.right = ptOrigin.x + rcSrc.right;
- rcDest.bottom = ptOrigin.y + rcSrc.bottom;
-
- /* Our Blt should be clipped to the invalidated region */
- ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
- &rcDest,
- pScreenPriv->pddsShadow,
- &rcSrc,
- DDBLT_WAIT,
- NULL);
-
- /* Reset the clip region */
- SelectClipRgn (pScreenPriv->hdcScreen, NULL);
+ else {
+ BoxPtr pBoxExtents = RegionExtents(damage);
+
+ /* Compute a GDI region from the damaged region */
+ hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ dwBox--;
+ pBox++;
+ while (dwBox--) {
+ hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
+ DeleteObject(hrgnTemp);
+ pBox++;
+ }
+
+ /* Install the GDI region as a clipping region */
+ SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);
+ DeleteObject(hrgnCombined);
+ hrgnCombined = NULL;
+
+ /* Calculating a bounding box for the source is easy */
+ rcSrc.left = pBoxExtents->x1;
+ rcSrc.top = pBoxExtents->y1;
+ rcSrc.right = pBoxExtents->x2;
+ rcSrc.bottom = pBoxExtents->y2;
+
+ /* Calculating a bounding box for the destination is trickier */
+ rcDest.left = ptOrigin.x + rcSrc.left;
+ rcDest.top = ptOrigin.y + rcSrc.top;
+ rcDest.right = ptOrigin.x + rcSrc.right;
+ rcDest.bottom = ptOrigin.y + rcSrc.bottom;
+
+ /* Our Blt should be clipped to the invalidated region */
+ ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
+ &rcDest,
+ pScreenPriv->pddsShadow,
+ &rcSrc, DDBLT_WAIT, NULL);
+
+ /* Reset the clip region */
+ SelectClipRgn(pScreenPriv->hdcScreen, NULL);
}
- /* Relock the shadow surface */
- ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow,
- NULL,
- pScreenPriv->pddsdShadow,
- DDLOCK_WAIT,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winShadowUpdateDD - Lock failed\n");
- return;
+ /* Relock the shadow surface */
+ ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsShadow,
+ NULL,
+ pScreenPriv->pddsdShadow,
+ DDLOCK_WAIT, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winShadowUpdateDD - Lock failed\n");
+ return;
}
- /* Has our memory pointer changed? */
- if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
- {
+ /* Has our memory pointer changed? */
+ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) {
extern const char *g_pszLogFile;
- ErrorF ("winShadowUpdateDD - Memory location of the shadow "
- "surface has changed, trying to update the root window "
- "pixmap header to point to the new address. If you get "
- "this message and "PROJECT_NAME" freezes or crashes "
- "after this message then send a problem report and your "
- "%s file to " BUILDERADDR "\n", g_pszLogFile);
-
- /* Location of shadow framebuffer has changed */
- winUpdateFBPointer(pScreen, pScreenPriv->pddsdShadow->lpSurface);
+ ErrorF("winShadowUpdateDD - Memory location of the shadow "
+ "surface has changed, trying to update the root window "
+ "pixmap header to point to the new address. If you get "
+ "this message and " PROJECT_NAME " freezes or crashes "
+ "after this message then send a problem report and your "
+ "%s file to " BUILDERADDR "\n", g_pszLogFile);
+
+ /* Location of shadow framebuffer has changed */
+ winUpdateFBPointer(pScreen, pScreenPriv->pddsdShadow->lpSurface);
}
}
static Bool
-winInitScreenShadowDD (ScreenPtr pScreen)
+winInitScreenShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
- /* Get a device context for the screen */
- pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+ /* Get a device context for the screen */
+ pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen);
- return winAllocateFBShadowDD(pScreen);
+ return winAllocateFBShadowDD(pScreen);
}
/*
@@ -677,64 +613,61 @@ winInitScreenShadowDD (ScreenPtr pScreen)
*/
static Bool
-winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
+winCloseScreenShadowDD(int nIndex, ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- Bool fReturn;
-
- winDebug ("winCloseScreenShadowDD - Freeing screen resources\n");
-
- /* Flag that the screen is closed */
- pScreenPriv->fClosed = TRUE;
- pScreenPriv->fActive = FALSE;
-
- /* Call the wrapped CloseScreen procedure */
- WIN_UNWRAP(CloseScreen);
- if (pScreen->CloseScreen)
- fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
-
- winFreeFBShadowDD(pScreen);
-
- /* Free the screen DC */
- ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
-
- /* Delete the window property */
- RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
-
- /* Delete tray icon, if we have one */
- if (!pScreenInfo->fNoTrayIcon)
- winDeleteNotifyIcon (pScreenPriv);
-
- /* Free the exit confirmation dialog box, if it exists */
- if (g_hDlgExit != NULL)
- {
- DestroyWindow (g_hDlgExit);
- g_hDlgExit = NULL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ Bool fReturn;
+
+ winDebug("winCloseScreenShadowDD - Freeing screen resources\n");
+
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
+
+ /* Call the wrapped CloseScreen procedure */
+ WIN_UNWRAP(CloseScreen);
+ if (pScreen->CloseScreen)
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+
+ winFreeFBShadowDD(pScreen);
+
+ /* Free the screen DC */
+ ReleaseDC(pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
+
+ /* Delete the window property */
+ RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
+
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon(pScreenPriv);
+
+ /* Free the exit confirmation dialog box, if it exists */
+ if (g_hDlgExit != NULL) {
+ DestroyWindow(g_hDlgExit);
+ g_hDlgExit = NULL;
}
- /* Kill our window */
- if (pScreenPriv->hwndScreen)
- {
- DestroyWindow (pScreenPriv->hwndScreen);
- pScreenPriv->hwndScreen = NULL;
+ /* Kill our window */
+ if (pScreenPriv->hwndScreen) {
+ DestroyWindow(pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
}
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Destroy the thread startup mutex */
- if (pScreenPriv->pmServerStarted) pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
+ /* Destroy the thread startup mutex */
+ if (pScreenPriv->pmServerStarted) pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
#endif
- /* Kill our screeninfo's pointer to the screen */
- pScreenInfo->pScreen = NULL;
+ /* Kill our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
- /* Free the screen privates for this screen */
- free ((pointer) pScreenPriv);
+ /* Free the screen privates for this screen */
+ free((pointer) pScreenPriv);
- return fReturn;
+ return fReturn;
}
-
/*
* Tell mi what sort of visuals we need.
*
@@ -744,583 +677,528 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
*/
static Bool
-winInitVisualsShadowDD (ScreenPtr pScreen)
+winInitVisualsShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- DWORD dwRedBits, dwGreenBits, dwBlueBits;
-
- /* Count the number of ones in each color mask */
- dwRedBits = winCountBits (pScreenPriv->dwRedMask);
- dwGreenBits = winCountBits (pScreenPriv->dwGreenMask);
- dwBlueBits = winCountBits (pScreenPriv->dwBlueMask);
-
- /* Store the maximum number of ones in a color mask as the bitsPerRGB */
- if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0)
- pScreenPriv->dwBitsPerRGB = 8;
- else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwRedBits;
- else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwGreenBits;
- else
- pScreenPriv->dwBitsPerRGB = dwBlueBits;
-
- winDebug ("winInitVisualsShadowDD - Masks %08x %08x %08x BPRGB %d d %d "
- "bpp %d\n",
- (unsigned int) pScreenPriv->dwRedMask,
- (unsigned int) pScreenPriv->dwGreenMask,
- (unsigned int) pScreenPriv->dwBlueMask,
- (int) pScreenPriv->dwBitsPerRGB,
- (int) pScreenInfo->dwDepth,
- (int) pScreenInfo->dwBPP);
-
- /* Create a single visual according to the Windows screen depth */
- switch (pScreenInfo->dwDepth)
- {
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ DWORD dwRedBits, dwGreenBits, dwBlueBits;
+
+ /* Count the number of ones in each color mask */
+ dwRedBits = winCountBits(pScreenPriv->dwRedMask);
+ dwGreenBits = winCountBits(pScreenPriv->dwGreenMask);
+ dwBlueBits = winCountBits(pScreenPriv->dwBlueMask);
+
+ /* Store the maximum number of ones in a color mask as the bitsPerRGB */
+ if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0)
+ pScreenPriv->dwBitsPerRGB = 8;
+ else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwRedBits;
+ else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwGreenBits;
+ else
+ pScreenPriv->dwBitsPerRGB = dwBlueBits;
+
+ winDebug ("winInitVisualsShadowDD - Masks %08x %08x %08x BPRGB %d d %d "
+ "bpp %d\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask,
+ (int) pScreenPriv->dwBitsPerRGB,
+ (int) pScreenInfo->dwDepth, (int) pScreenInfo->dwBPP);
+
+ /* Create a single visual according to the Windows screen depth */
+ switch (pScreenInfo->dwDepth) {
case 24:
case 16:
case 15:
- /* Create the real visual */
- if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
- TrueColorMask,
- pScreenPriv->dwBitsPerRGB,
- TrueColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask))
- {
- ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
- "failed for TrueColor\n");
- return FALSE;
- }
+ /* Create the real visual */
+ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ TrueColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask)) {
+ ErrorF("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
+ "failed for TrueColor\n");
+ return FALSE;
+ }
#ifdef XWIN_EMULATEPSEUDO
- if (!pScreenInfo->fEmulatePseudo)
- break;
-
- /* Setup a pseudocolor visual */
- if (!miSetVisualTypesAndMasks (8,
- PseudoColorMask,
- 8,
- -1,
- 0,
- 0,
- 0))
- {
- ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
- "failed for PseudoColor\n");
- return FALSE;
- }
+ if (!pScreenInfo->fEmulatePseudo)
+ break;
+
+ /* Setup a pseudocolor visual */
+ if (!miSetVisualTypesAndMasks(8, PseudoColorMask, 8, -1, 0, 0, 0)) {
+ ErrorF("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
+ "failed for PseudoColor\n");
+ return FALSE;
+ }
#endif
- break;
+ break;
case 8:
- if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
- pScreenInfo->fFullScreen
- ? PseudoColorMask : StaticColorMask,
- pScreenPriv->dwBitsPerRGB,
- pScreenInfo->fFullScreen
- ? PseudoColor : StaticColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask))
- {
- ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
- "failed\n");
- return FALSE;
- }
- break;
+ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
+ pScreenInfo->fFullScreen
+ ? PseudoColorMask : StaticColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenInfo->fFullScreen
+ ? PseudoColor : StaticColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask)) {
+ ErrorF("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+ break;
default:
- ErrorF ("winInitVisualsShadowDD - Unknown screen depth\n");
- return FALSE;
+ ErrorF("winInitVisualsShadowDD - Unknown screen depth\n");
+ return FALSE;
}
- winDebug ("winInitVisualsShadowDD - Returning\n");
+ winDebug("winInitVisualsShadowDD - Returning\n");
- return TRUE;
+ return TRUE;
}
-
/*
* Adjust the user proposed video mode
*/
static Bool
-winAdjustVideoModeShadowDD (ScreenPtr pScreen)
+winAdjustVideoModeShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HDC hdc = NULL;
- DWORD dwBPP;
-
- /* We're in serious trouble if we can't get a DC */
- hdc = GetDC (NULL);
- if (hdc == NULL)
- {
- ErrorF ("winAdjustVideoModeShadowDD - GetDC () failed\n");
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc = NULL;
+ DWORD dwBPP;
+
+ /* We're in serious trouble if we can't get a DC */
+ hdc = GetDC(NULL);
+ if (hdc == NULL) {
+ ErrorF("winAdjustVideoModeShadowDD - GetDC () failed\n");
+ return FALSE;
}
- /* Query GDI for current display depth */
- dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
- /* DirectDraw can only change the depth in fullscreen mode */
- if (!(pScreenInfo->fFullScreen &&
- (pScreenInfo->dwBPP != WIN_DEFAULT_BPP)))
- {
- /* Otherwise, We'll use GDI's depth */
- pScreenInfo->dwBPP = dwBPP;
+ /* DirectDraw can only change the depth in fullscreen mode */
+ if (!(pScreenInfo->fFullScreen && (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) {
+ /* Otherwise, We'll use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
}
- /* Release our DC */
- ReleaseDC (NULL, hdc);
- return TRUE;
+ /* Release our DC */
+ ReleaseDC(NULL, hdc);
+ return TRUE;
}
-
/*
* Blt exposed regions to the screen
*/
static Bool
-winBltExposedRegionsShadowDD (ScreenPtr pScreen)
+winBltExposedRegionsShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RECT rcSrc, rcDest;
- POINT ptOrigin;
- HDC hdcUpdate = NULL;
- PAINTSTRUCT ps;
- HRESULT ddrval = DD_OK;
- Bool fReturn = TRUE;
- Bool fLocked = TRUE;
- int i;
-
- /* BeginPaint gives us an hdc that clips to the invalidated region */
- hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps);
- if (hdcUpdate == NULL)
- {
- ErrorF ("winBltExposedRegionsShadowDD - BeginPaint () returned "
- "a NULL device context handle. Aborting blit attempt.\n");
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RECT rcSrc, rcDest;
+ POINT ptOrigin;
+ HDC hdcUpdate = NULL;
+ PAINTSTRUCT ps;
+ HRESULT ddrval = DD_OK;
+ Bool fReturn = TRUE;
+ Bool fLocked = TRUE;
+ int i;
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint(pScreenPriv->hwndScreen, &ps);
+ if (hdcUpdate == NULL) {
+ ErrorF("winBltExposedRegionsShadowDD - BeginPaint () returned "
+ "a NULL device context handle. Aborting blit attempt.\n");
+ return FALSE;
}
-
- /* Unlock the shadow surface, so we can blit */
- ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL);
- if (FAILED (ddrval))
- {
- fReturn = FALSE;
- goto winBltExposedRegionsShadowDD_Exit;
+
+ /* Unlock the shadow surface, so we can blit */
+ ddrval = IDirectDrawSurface2_Unlock(pScreenPriv->pddsShadow, NULL);
+ if (FAILED(ddrval)) {
+ fReturn = FALSE;
+ goto winBltExposedRegionsShadowDD_Exit;
}
- else
- {
- /* Flag that we have unlocked the shadow surface */
- fLocked = FALSE;
+ else {
+ /* Flag that we have unlocked the shadow surface */
+ fLocked = FALSE;
}
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
-
- MapWindowPoints (pScreenPriv->hwndScreen,
- HWND_DESKTOP,
- (LPPOINT)&ptOrigin, 1);
- rcDest.left = ptOrigin.x;
- rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
- rcDest.top = ptOrigin.y;
- rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
-
- /* Source can be enter shadow surface, as Blt should clip */
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.right = pScreenInfo->dwWidth;
- rcSrc.bottom = pScreenInfo->dwHeight;
-
- /* Try to regain the primary surface and blit again if we've lost it */
- for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i)
- {
- /* Our Blt should be clipped to the invalidated region */
- ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
- &rcDest,
- pScreenPriv->pddsShadow,
- &rcSrc,
- DDBLT_WAIT,
- NULL);
- if (ddrval == DDERR_SURFACELOST)
- {
- /* Surface was lost */
- ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt "
- "reported that the primary surface was lost, "
- "trying to restore, retry: %d\n", i + 1);
-
- /* Try to restore the surface, once */
- ddrval = IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
- ErrorF ("winBltExposedRegionsShadowDD - "
- "IDirectDrawSurface2_Restore returned: ");
- if (ddrval == DD_OK)
- ErrorF ("DD_OK\n");
- else if (ddrval == DDERR_WRONGMODE)
- ErrorF ("DDERR_WRONGMODE\n");
- else if (ddrval == DDERR_INCOMPATIBLEPRIMARY)
- ErrorF ("DDERR_INCOMPATIBLEPRIMARY\n");
- else if (ddrval == DDERR_UNSUPPORTED)
- ErrorF ("DDERR_UNSUPPORTED\n");
- else if (ddrval == DDERR_INVALIDPARAMS)
- ErrorF ("DDERR_INVALIDPARAMS\n");
- else if (ddrval == DDERR_INVALIDOBJECT)
- ErrorF ("DDERR_INVALIDOBJECT\n");
- else
- ErrorF ("unknown error: %08x\n", (unsigned int) ddrval);
-
- /* Loop around to try the blit one more time */
- continue;
- }
- else if (FAILED (ddrval))
- {
- fReturn = FALSE;
- ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt "
- "failed, but surface not lost: %08x %d\n",
- (unsigned int) ddrval, (int) ddrval);
- goto winBltExposedRegionsShadowDD_Exit;
- }
- else
- {
- /* Success, stop looping */
- break;
- }
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+
+ MapWindowPoints(pScreenPriv->hwndScreen,
+ HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+ rcDest.left = ptOrigin.x;
+ rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
+ rcDest.top = ptOrigin.y;
+ rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
+
+ /* Source can be enter shadow surface, as Blt should clip */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Try to regain the primary surface and blit again if we've lost it */
+ for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i) {
+ /* Our Blt should be clipped to the invalidated region */
+ ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
+ &rcDest,
+ pScreenPriv->pddsShadow,
+ &rcSrc, DDBLT_WAIT, NULL);
+ if (ddrval == DDERR_SURFACELOST) {
+ /* Surface was lost */
+ ErrorF("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt "
+ "reported that the primary surface was lost, "
+ "trying to restore, retry: %d\n", i + 1);
+
+ /* Try to restore the surface, once */
+ ddrval = IDirectDrawSurface2_Restore(pScreenPriv->pddsPrimary);
+ ErrorF("winBltExposedRegionsShadowDD - "
+ "IDirectDrawSurface2_Restore returned: ");
+ if (ddrval == DD_OK)
+ ErrorF("DD_OK\n");
+ else if (ddrval == DDERR_WRONGMODE)
+ ErrorF("DDERR_WRONGMODE\n");
+ else if (ddrval == DDERR_INCOMPATIBLEPRIMARY)
+ ErrorF("DDERR_INCOMPATIBLEPRIMARY\n");
+ else if (ddrval == DDERR_UNSUPPORTED)
+ ErrorF("DDERR_UNSUPPORTED\n");
+ else if (ddrval == DDERR_INVALIDPARAMS)
+ ErrorF("DDERR_INVALIDPARAMS\n");
+ else if (ddrval == DDERR_INVALIDOBJECT)
+ ErrorF("DDERR_INVALIDOBJECT\n");
+ else
+ ErrorF("unknown error: %08x\n", (unsigned int) ddrval);
+
+ /* Loop around to try the blit one more time */
+ continue;
+ }
+ else if (FAILED(ddrval)) {
+ fReturn = FALSE;
+ ErrorF("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt "
+ "failed, but surface not lost: %08x %d\n",
+ (unsigned int) ddrval, (int) ddrval);
+ goto winBltExposedRegionsShadowDD_Exit;
+ }
+ else {
+ /* Success, stop looping */
+ break;
+ }
}
- /* Relock the shadow surface */
- ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow,
- NULL,
- pScreenPriv->pddsdShadow,
- DDLOCK_WAIT,
- NULL);
- if (FAILED (ddrval))
- {
- fReturn = FALSE;
- ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Lock "
- "failed\n");
- goto winBltExposedRegionsShadowDD_Exit;
+ /* Relock the shadow surface */
+ ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsShadow,
+ NULL,
+ pScreenPriv->pddsdShadow,
+ DDLOCK_WAIT, NULL);
+ if (FAILED(ddrval)) {
+ fReturn = FALSE;
+ ErrorF("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Lock "
+ "failed\n");
+ goto winBltExposedRegionsShadowDD_Exit;
}
- else
- {
- /* Indicate that we have relocked the shadow surface */
- fLocked = TRUE;
+ else {
+ /* Indicate that we have relocked the shadow surface */
+ fLocked = TRUE;
}
- /* Has our memory pointer changed? */
- if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
- winUpdateFBPointer (pScreen,
- pScreenPriv->pddsdShadow->lpSurface);
+ /* Has our memory pointer changed? */
+ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
+ winUpdateFBPointer(pScreen, pScreenPriv->pddsdShadow->lpSurface);
winBltExposedRegionsShadowDD_Exit:
- /* EndPaint frees the DC */
- if (hdcUpdate != NULL)
- EndPaint (pScreenPriv->hwndScreen, &ps);
-
- /*
- * Relock the surface if it is not locked. We don't care if locking fails,
- * as it will cause the server to shutdown within a few more operations.
- */
- if (!fLocked)
- {
- IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow,
- NULL,
- pScreenPriv->pddsdShadow,
- DDLOCK_WAIT,
- NULL);
-
- /* Has our memory pointer changed? */
- if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
- winUpdateFBPointer (pScreen,
- pScreenPriv->pddsdShadow->lpSurface);
-
- fLocked = TRUE;
+ /* EndPaint frees the DC */
+ if (hdcUpdate != NULL)
+ EndPaint(pScreenPriv->hwndScreen, &ps);
+
+ /*
+ * Relock the surface if it is not locked. We don't care if locking fails,
+ * as it will cause the server to shutdown within a few more operations.
+ */
+ if (!fLocked) {
+ IDirectDrawSurface2_Lock(pScreenPriv->pddsShadow,
+ NULL,
+ pScreenPriv->pddsdShadow, DDLOCK_WAIT, NULL);
+
+ /* Has our memory pointer changed? */
+ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
+ winUpdateFBPointer(pScreen, pScreenPriv->pddsdShadow->lpSurface);
+
+ fLocked = TRUE;
}
- return fReturn;
+ return fReturn;
}
-
/*
* Do any engine-specific appliation-activation processing
*/
static Bool
-winActivateAppShadowDD (ScreenPtr pScreen)
+winActivateAppShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
-
- /*
- * Do we have a surface?
- * Are we active?
- * Are we fullscreen?
- */
- if (pScreenPriv != NULL
- && pScreenPriv->pddsPrimary != NULL
- && pScreenPriv->fActive)
- {
- /* Primary surface was lost, restore it */
- IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
+ winScreenPriv(pScreen);
+
+ /*
+ * Do we have a surface?
+ * Are we active?
+ * Are we fullscreen?
+ */
+ if (pScreenPriv != NULL
+ && pScreenPriv->pddsPrimary != NULL && pScreenPriv->fActive) {
+ /* Primary surface was lost, restore it */
+ IDirectDrawSurface2_Restore(pScreenPriv->pddsPrimary);
}
- return TRUE;
+ return TRUE;
}
-
/*
* Reblit the shadow framebuffer to the screen.
*/
static Bool
-winRedrawScreenShadowDD (ScreenPtr pScreen)
+winRedrawScreenShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HRESULT ddrval = DD_OK;
- RECT rcSrc, rcDest;
- POINT ptOrigin;
-
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
- MapWindowPoints (pScreenPriv->hwndScreen,
- HWND_DESKTOP,
- (LPPOINT)&ptOrigin, 1);
- rcDest.left = ptOrigin.x;
- rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
- rcDest.top = ptOrigin.y;
- rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
-
- /* Source can be entire shadow surface, as Blt should clip for us */
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.right = pScreenInfo->dwWidth;
- rcSrc.bottom = pScreenInfo->dwHeight;
-
- /* Redraw the whole window, to take account for the new colors */
- ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
- &rcDest,
- pScreenPriv->pddsShadow,
- &rcSrc,
- DDBLT_WAIT,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winRedrawScreenShadowDD - IDirectDrawSurface_Blt () "
- "failed: %08x\n",
- (unsigned int) ddrval);
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ RECT rcSrc, rcDest;
+ POINT ptOrigin;
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+ MapWindowPoints(pScreenPriv->hwndScreen,
+ HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+ rcDest.left = ptOrigin.x;
+ rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
+ rcDest.top = ptOrigin.y;
+ rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
+
+ /* Source can be entire shadow surface, as Blt should clip for us */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Redraw the whole window, to take account for the new colors */
+ ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
+ &rcDest,
+ pScreenPriv->pddsShadow,
+ &rcSrc, DDBLT_WAIT, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winRedrawScreenShadowDD - IDirectDrawSurface_Blt () "
+ "failed: %08x\n", (unsigned int) ddrval);
}
- return TRUE;
+ return TRUE;
}
-
/*
* Realize the currently installed colormap
*/
static Bool
-winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen)
+winRealizeInstalledPaletteShadowDD(ScreenPtr pScreen)
{
- return TRUE;
+ return TRUE;
}
-
/*
* Install the specified colormap
*/
static Bool
-winInstallColormapShadowDD (ColormapPtr pColormap)
+winInstallColormapShadowDD(ColormapPtr pColormap)
{
- ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
- HRESULT ddrval = DD_OK;
-
- /* Install the DirectDraw palette on the primary surface */
- ddrval = IDirectDrawSurface2_SetPalette (pScreenPriv->pddsPrimary,
- pCmapPriv->lpDDPalette);
- if (FAILED (ddrval))
- {
- ErrorF ("winInstallColormapShadowDD - Failed installing the "
- "DirectDraw palette.\n");
- return FALSE;
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ HRESULT ddrval = DD_OK;
+
+ /* Install the DirectDraw palette on the primary surface */
+ ddrval = IDirectDrawSurface2_SetPalette(pScreenPriv->pddsPrimary,
+ pCmapPriv->lpDDPalette);
+ if (FAILED(ddrval)) {
+ ErrorF("winInstallColormapShadowDD - Failed installing the "
+ "DirectDraw palette.\n");
+ return FALSE;
}
- /* Save a pointer to the newly installed colormap */
- pScreenPriv->pcmapInstalled = pColormap;
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
- return TRUE;
+ return TRUE;
}
-
/*
* Store the specified colors in the specified colormap
*/
static Bool
-winStoreColorsShadowDD (ColormapPtr pColormap,
- int ndef,
- xColorItem *pdefs)
+winStoreColorsShadowDD(ColormapPtr pColormap, int ndef, xColorItem * pdefs)
{
- ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
- ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
- HRESULT ddrval = DD_OK;
-
- /* Put the X colormap entries into the Windows logical palette */
- ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette,
- 0,
- pdefs[0].pixel,
- ndef,
- pCmapPriv->peColors
- + pdefs[0].pixel);
- if (FAILED (ddrval))
- {
- ErrorF ("winStoreColorsShadowDD - SetEntries () failed\n");
- return FALSE;
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
+ HRESULT ddrval = DD_OK;
+
+ /* Put the X colormap entries into the Windows logical palette */
+ ddrval = IDirectDrawPalette_SetEntries(pCmapPriv->lpDDPalette,
+ 0,
+ pdefs[0].pixel,
+ ndef,
+ pCmapPriv->peColors
+ + pdefs[0].pixel);
+ if (FAILED(ddrval)) {
+ ErrorF("winStoreColorsShadowDD - SetEntries () failed\n");
+ return FALSE;
}
- /* Don't install the DirectDraw palette if the colormap is not installed */
- if (pColormap != curpmap)
- {
- return TRUE;
+ /* Don't install the DirectDraw palette if the colormap is not installed */
+ if (pColormap != curpmap) {
+ return TRUE;
}
- if (!winInstallColormapShadowDD (pColormap))
- {
- ErrorF ("winStoreColorsShadowDD - Failed installing colormap\n");
- return FALSE;
+ if (!winInstallColormapShadowDD(pColormap)) {
+ ErrorF("winStoreColorsShadowDD - Failed installing colormap\n");
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
-
/*
* Colormap initialization procedure
*/
static Bool
-winCreateColormapShadowDD (ColormapPtr pColormap)
+winCreateColormapShadowDD(ColormapPtr pColormap)
{
- HRESULT ddrval = DD_OK;
- ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
-
- /* Create a DirectDraw palette */
- ddrval = IDirectDraw2_CreatePalette (pScreenPriv->pdd,
- DDPCAPS_8BIT | DDPCAPS_ALLOW256,
- pCmapPriv->peColors,
- &pCmapPriv->lpDDPalette,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winCreateColormapShadowDD - CreatePalette failed\n");
- return FALSE;
+ HRESULT ddrval = DD_OK;
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+
+ /* Create a DirectDraw palette */
+ ddrval = IDirectDraw2_CreatePalette(pScreenPriv->pdd,
+ DDPCAPS_8BIT | DDPCAPS_ALLOW256,
+ pCmapPriv->peColors,
+ &pCmapPriv->lpDDPalette, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winCreateColormapShadowDD - CreatePalette failed\n");
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
-
/*
* Colormap destruction procedure
*/
static Bool
-winDestroyColormapShadowDD (ColormapPtr pColormap)
+winDestroyColormapShadowDD(ColormapPtr pColormap)
{
- winScreenPriv(pColormap->pScreen);
- winCmapPriv(pColormap);
- HRESULT ddrval = DD_OK;
-
- /*
- * Is colormap to be destroyed the default?
- *
- * Non-default colormaps should have had winUninstallColormap
- * called on them before we get here. The default colormap
- * will not have had winUninstallColormap called on it. Thus,
- * we need to handle the default colormap in a special way.
- */
- if (pColormap->flags & IsDefault)
- {
- winDebug ("winDestroyColormapShadowDD - Destroying default "
- "colormap\n");
-
- /*
- * FIXME: Walk the list of all screens, popping the default
- * palette out of each screen device context.
- */
-
- /* Pop the palette out of the primary surface */
- ddrval = IDirectDrawSurface2_SetPalette (pScreenPriv->pddsPrimary,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winDestroyColormapShadowDD - Failed freeing the "
- "default colormap DirectDraw palette.\n");
- return FALSE;
- }
-
- /* Clear our private installed colormap pointer */
- pScreenPriv->pcmapInstalled = NULL;
+ winScreenPriv(pColormap->pScreen);
+ winCmapPriv(pColormap);
+ HRESULT ddrval = DD_OK;
+
+ /*
+ * Is colormap to be destroyed the default?
+ *
+ * Non-default colormaps should have had winUninstallColormap
+ * called on them before we get here. The default colormap
+ * will not have had winUninstallColormap called on it. Thus,
+ * we need to handle the default colormap in a special way.
+ */
+ if (pColormap->flags & IsDefault) {
+ winDebug("winDestroyColormapShadowDD - Destroying default "
+ "colormap\n");
+
+ /*
+ * FIXME: Walk the list of all screens, popping the default
+ * palette out of each screen device context.
+ */
+
+ /* Pop the palette out of the primary surface */
+ ddrval = IDirectDrawSurface2_SetPalette(pScreenPriv->pddsPrimary, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winDestroyColormapShadowDD - Failed freeing the "
+ "default colormap DirectDraw palette.\n");
+ return FALSE;
+ }
+
+ /* Clear our private installed colormap pointer */
+ pScreenPriv->pcmapInstalled = NULL;
}
-
- /* Release the palette */
- IDirectDrawPalette_Release (pCmapPriv->lpDDPalette);
-
- /* Invalidate the colormap privates */
- pCmapPriv->lpDDPalette = NULL;
-
- return TRUE;
-}
+ /* Release the palette */
+ IDirectDrawPalette_Release(pCmapPriv->lpDDPalette);
+
+ /* Invalidate the colormap privates */
+ pCmapPriv->lpDDPalette = NULL;
+
+ return TRUE;
+}
/*
* Set engine specific functions
*/
Bool
-winSetEngineFunctionsShadowDD (ScreenPtr pScreen)
+winSetEngineFunctionsShadowDD(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Set our pointers */
- pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD;
- pScreenPriv->pwinFreeFB = winFreeFBShadowDD;
- pScreenPriv->pwinShadowUpdate = winShadowUpdateDD;
- pScreenPriv->pwinInitScreen = winInitScreenShadowDD;
- pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD;
- pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD;
- pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD;
- if (pScreenInfo->fFullScreen)
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
- else
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
- pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
- pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDD;
- pScreenPriv->pwinActivateApp = winActivateAppShadowDD;
- pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDD;
- pScreenPriv->pwinRealizeInstalledPalette
- = winRealizeInstalledPaletteShadowDD;
- pScreenPriv->pwinInstallColormap = winInstallColormapShadowDD;
- pScreenPriv->pwinStoreColors = winStoreColorsShadowDD;
- pScreenPriv->pwinCreateColormap = winCreateColormapShadowDD;
- pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDD;
- pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
- pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDD;
- pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDD;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD;
+ pScreenPriv->pwinFreeFB = winFreeFBShadowDD;
+ pScreenPriv->pwinShadowUpdate = winShadowUpdateDD;
+ pScreenPriv->pwinInitScreen = winInitScreenShadowDD;
+ pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD;
+ pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD;
+ if (pScreenInfo->fFullScreen)
+ pScreenPriv->pwinCreateBoundingWindow =
+ winCreateBoundingWindowFullScreen;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
+ pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDD;
+ pScreenPriv->pwinActivateApp = winActivateAppShadowDD;
+ pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDD;
+ pScreenPriv->pwinRealizeInstalledPalette
+ = winRealizeInstalledPaletteShadowDD;
+ pScreenPriv->pwinInstallColormap = winInstallColormapShadowDD;
+ pScreenPriv->pwinStoreColors = winStoreColorsShadowDD;
+ pScreenPriv->pwinCreateColormap = winCreateColormapShadowDD;
+ pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDD;
+ pScreenPriv->pwinHotKeyAltTab =
+ (winHotKeyAltTabProcPtr) (void (*)(void)) NoopDDA;
+ pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDD;
+ pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDD;
#ifdef XWIN_MULTIWINDOW
- pScreenPriv->pwinFinishCreateWindowsWindow =
- (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
+ pScreenPriv->pwinFinishCreateWindowsWindow =
+ (winFinishCreateWindowsWindowProcPtr) (void (*)(void)) NoopDDA;
#endif
- return TRUE;
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c
index 2f7e34243..17fe23e5a 100644
--- a/xorg-server/hw/xwin/winshadddnl.c
+++ b/xorg-server/hw/xwin/winshadddnl.c
@@ -36,7 +36,6 @@
#endif
#include "win.h"
-
/*
* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
* so we have to redefine it here.
@@ -45,7 +44,7 @@
#ifdef DEFINE_GUID
#undef DEFINE_GUID
#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
-#endif /* DEFINE_GUID */
+#endif /* DEFINE_GUID */
#endif
/*
@@ -53,63 +52,60 @@
* here manually. Should be handled by ddraw.h
*/
#ifndef IID_IDirectDraw4
-DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 );
-#endif /* IID_IDirectDraw4 */
+DEFINE_GUID(IID_IDirectDraw4, 0x9c59509a, 0x39bd, 0x11d1, 0x8c, 0x4a, 0x00,
+ 0xc0, 0x4f, 0xd9, 0x30, 0xc5);
+#endif /* IID_IDirectDraw4 */
#define FAIL_MSG_MAX_BLT 10
-
/*
* Local prototypes
*/
static Bool
-winAllocateFBShadowDDNL (ScreenPtr pScreen);
+ winAllocateFBShadowDDNL(ScreenPtr pScreen);
static void
-winShadowUpdateDDNL (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf);
static Bool
-winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen);
+ winCloseScreenShadowDDNL(int nIndex, ScreenPtr pScreen);
static Bool
-winInitVisualsShadowDDNL (ScreenPtr pScreen);
+ winInitVisualsShadowDDNL(ScreenPtr pScreen);
static Bool
-winAdjustVideoModeShadowDDNL (ScreenPtr pScreen);
+ winAdjustVideoModeShadowDDNL(ScreenPtr pScreen);
static Bool
-winBltExposedRegionsShadowDDNL (ScreenPtr pScreen);
+ winBltExposedRegionsShadowDDNL(ScreenPtr pScreen);
static Bool
-winActivateAppShadowDDNL (ScreenPtr pScreen);
+ winActivateAppShadowDDNL(ScreenPtr pScreen);
static Bool
-winRedrawScreenShadowDDNL (ScreenPtr pScreen);
+ winRedrawScreenShadowDDNL(ScreenPtr pScreen);
static Bool
-winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen);
+ winRealizeInstalledPaletteShadowDDNL(ScreenPtr pScreen);
static Bool
-winInstallColormapShadowDDNL (ColormapPtr pColormap);
+ winInstallColormapShadowDDNL(ColormapPtr pColormap);
static Bool
-winStoreColorsShadowDDNL (ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs);
+ winStoreColorsShadowDDNL(ColormapPtr pmap, int ndef, xColorItem * pdefs);
static Bool
-winCreateColormapShadowDDNL (ColormapPtr pColormap);
+ winCreateColormapShadowDDNL(ColormapPtr pColormap);
static Bool
-winDestroyColormapShadowDDNL (ColormapPtr pColormap);
+ winDestroyColormapShadowDDNL(ColormapPtr pColormap);
static Bool
-winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen);
+ winCreatePrimarySurfaceShadowDDNL(ScreenPtr pScreen);
static Bool
-winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen);
+ winReleasePrimarySurfaceShadowDDNL(ScreenPtr pScreen);
static HRESULT myIDirectDrawSurface4_Blt( ScreenPtr pScreen, RECT *pRect, RECT *prcSrc)
{
@@ -170,7 +166,6 @@ static HRESULT myIDirectDrawSurface4_Blt( ScreenPtr pScreen, RECT *pRect, RECT *
return ddrval;
}
-
/*
* Create the primary surface and attach the clipper.
* Used for both the initial surface creation and during
@@ -178,80 +173,72 @@ static HRESULT myIDirectDrawSurface4_Blt( ScreenPtr pScreen, RECT *pRect, RECT *
*/
static Bool
-winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
+winCreatePrimarySurfaceShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC2 ddsd;
-
- winDebug ("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n");
-
- /* Describe the primary surface */
- ZeroMemory (&ddsd, sizeof (ddsd));
- ddsd.dwSize = sizeof (ddsd);
- ddsd.dwFlags = DDSD_CAPS;
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-
- /* Create the primary surface */
- ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
- &ddsd,
- &pScreenPriv->pddsPrimary4,
- NULL);
- pScreenPriv->fRetryCreateSurface = FALSE;
- if (FAILED (ddrval))
- {
- if (ddrval == DDERR_NOEXCLUSIVEMODE)
- {
- /* Recreating the surface failed. Mark screen to retry later */
- pScreenPriv->fRetryCreateSurface = TRUE;
- winDebug ("winCreatePrimarySurfaceShadowDDNL - Could not create "
- "primary surface: DDERR_NOEXCLUSIVEMODE\n");
+ winScreenPriv(pScreen);
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC2 ddsd;
+
+ winDebug("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n");
+
+ /* Describe the primary surface */
+ ZeroMemory(&ddsd, sizeof(ddsd));
+ ddsd.dwSize = sizeof(ddsd);
+ ddsd.dwFlags = DDSD_CAPS;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+
+ /* Create the primary surface */
+ ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4,
+ &ddsd,
+ &pScreenPriv->pddsPrimary4, NULL);
+ pScreenPriv->fRetryCreateSurface = FALSE;
+ if (FAILED(ddrval)) {
+ if (ddrval == DDERR_NOEXCLUSIVEMODE) {
+ /* Recreating the surface failed. Mark screen to retry later */
+ pScreenPriv->fRetryCreateSurface = TRUE;
+ winDebug("winCreatePrimarySurfaceShadowDDNL - Could not create "
+ "primary surface: DDERR_NOEXCLUSIVEMODE\n");
}
- else
- {
- ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create "
- "primary surface: %08x\n", (unsigned int) ddrval);
+ else {
+ ErrorF("winCreatePrimarySurfaceShadowDDNL - Could not create "
+ "primary surface: %08x\n", (unsigned int) ddrval);
}
- return FALSE;
+ return FALSE;
}
-
- winDebug ("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n");
- /* Attach our clipper to our primary surface handle */
- ddrval = IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
- pScreenPriv->pddcPrimary);
- if (FAILED (ddrval))
- {
- ErrorF ("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper "
- "failed: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ winDebug("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n");
+
+ /* Attach our clipper to our primary surface handle */
+ ddrval = IDirectDrawSurface4_SetClipper(pScreenPriv->pddsPrimary4,
+ pScreenPriv->pddcPrimary);
+ if (FAILED(ddrval)) {
+ ErrorF("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper "
+ "failed: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
- winDebug ("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary "
- "surface\n");
+ winDebug("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary "
+ "surface\n");
- /* Everything was correct */
- return TRUE;
+ /* Everything was correct */
+ return TRUE;
}
-
static void ClosePrimarySurfaceShadowDDNL (winPrivScreenPtr pScreenPriv)
{
- /* Release the primary surface and clipper, if they exist */
- if (pScreenPriv->pddsPrimary4)
- {
- /*
- * Detach the clipper from the primary surface.
- * NOTE: We do this explicity for clarity. The Clipper is not released.
- */
- IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, NULL);
-
- winDebug ("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n");
-
- /* Release the primary surface */
- IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4);
- pScreenPriv->pddsPrimary4 = NULL;
+ /* Release the primary surface and clipper, if they exist */
+ if (pScreenPriv->pddsPrimary4) {
+ /*
+ * Detach the clipper from the primary surface.
+ * NOTE: We do this explicity for clarity. The Clipper is not released.
+ */
+ IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, NULL);
+
+ winDebug("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n");
+
+ /* Release the primary surface */
+ IDirectDrawSurface4_Release(pScreenPriv->pddsPrimary4);
+ pScreenPriv->pddsPrimary4 = NULL;
}
}
@@ -295,11 +282,10 @@ winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
ClosePrimarySurfaceShadowDDNL(pScreenPriv);
- winDebug ("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n");
-
- return TRUE;
-}
+ winDebug("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n");
+ return TRUE;
+}
/*
* Create a DirectDraw surface for the shadow framebuffer; also create
@@ -310,335 +296,304 @@ winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
*/
Bool
-winAllocateFBShadowDDNL (ScreenPtr pScreen)
+winAllocateFBShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC2 ddsdShadow;
- char *lpSurface = NULL;
- DDPIXELFORMAT ddpfPrimary;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC2 ddsdShadow;
+ char *lpSurface = NULL;
+ DDPIXELFORMAT ddpfPrimary;
- winDebug ("winAllocateFBShadowDDNL - w %d h %d d %d\n",
- pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth);
+ winDebug("winAllocateFBShadowDDNL - w %d h %d d %d\n",
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth);
- /* Set the padded screen width */
- pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth,
- pScreenInfo->dwBPP);
+ /* Set the padded screen width */
+ pScreenInfo->dwPaddedWidth = PixmapBytePad(pScreenInfo->dwWidth,
+ pScreenInfo->dwBPP);
- if ( pScreenInfo->pfb)
- {
- ErrorF("winAllocateFBShadowDDNL calling for the second time, reallocating\n");
- lpSurface=pScreenInfo->pfb;
+ if ( pScreenInfo->pfb)
+ {
+ ErrorF("winAllocateFBShadowDDNL calling for the second time, reallocating\n");
+ lpSurface=pScreenInfo->pfb;
- if (pScreenPriv->pddsShadow4)
+ if (pScreenPriv->pddsShadow4)
+ {
+ IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4);
+ pScreenPriv->pddsShadow4 = NULL;
+ }
+ ClosePrimarySurfaceShadowDDNL(pScreenPriv);
+ ReleaseDDNL(pScreenPriv);
+ }
+ else
{
- IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4);
- pScreenPriv->pddsShadow4 = NULL;
+ /* Allocate memory for our shadow surface */
+ lpSurface = malloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
+ if (lpSurface == NULL) {
+ ErrorF ("winAllocateFBShadowDDNL - Could not allocate bits\n");
+ return FALSE;
+ }
+
+ /*
+ * Initialize the framebuffer memory so we don't get a
+ * strange display at startup
+ */
+ ZeroMemory (lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
}
- ClosePrimarySurfaceShadowDDNL(pScreenPriv);
- ReleaseDDNL(pScreenPriv);
- }
- else
- {
- /* Allocate memory for our shadow surface */
- lpSurface = malloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
- if (lpSurface == NULL)
- {
- ErrorF ("winAllocateFBShadowDDNL - Could not allocate bits\n");
+ /* Create a clipper */
+ ddrval = (*g_fpDirectDrawCreateClipper) (0,
+ &pScreenPriv->pddcPrimary, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n",
+ (unsigned int) ddrval);
return FALSE;
- }
-
- /*
- * Initialize the framebuffer memory so we don't get a
- * strange display at startup
- */
- ZeroMemory (lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
- }
- /* Create a clipper */
- ddrval = (*g_fpDirectDrawCreateClipper) (0,
- &pScreenPriv->pddcPrimary,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
}
- winDebug ("winAllocateFBShadowDDNL - Created a clipper\n");
+ winDebug("winAllocateFBShadowDDNL - Created a clipper\n");
- /* Attach the clipper to our display window */
- ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary,
- 0,
- pScreenPriv->hwndScreen);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Clipper not attached "
- "to window: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ /* Attach the clipper to our display window */
+ ddrval = IDirectDrawClipper_SetHWnd(pScreenPriv->pddcPrimary,
+ 0, pScreenPriv->hwndScreen);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDDNL - Clipper not attached "
+ "to window: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
- winDebug ("winAllocateFBShadowDDNL - Attached clipper to window\n");
+ winDebug("winAllocateFBShadowDDNL - Attached clipper to window\n");
- /* Create a DirectDraw object, store the address at lpdd */
- ddrval = (*g_fpDirectDrawCreate) (NULL,
- (LPDIRECTDRAW*) &pScreenPriv->pdd,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Could not start "
- "DirectDraw: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ /* Create a DirectDraw object, store the address at lpdd */
+ ddrval = (*g_fpDirectDrawCreate) (NULL,
+ (LPDIRECTDRAW *) & pScreenPriv->pdd,
+ NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDDNL - Could not start "
+ "DirectDraw: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
- winDebug ("winAllocateFBShadowDDNL - Created and initialized DD\n");
+ winDebug("winAllocateFBShadowDDNL - Created and initialized DD\n");
- /* Get a DirectDraw4 interface pointer */
- ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd,
- &IID_IDirectDraw4,
- (LPVOID*) &pScreenPriv->pdd4);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ /* Get a DirectDraw4 interface pointer */
+ ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
+ &IID_IDirectDraw4,
+ (LPVOID *) & pScreenPriv->pdd4);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
}
- /* Are we full screen? */
- if (pScreenInfo->fFullScreen)
- {
- DDSURFACEDESC2 ddsdCurrent;
- DWORD dwRefreshRateCurrent = 0;
- HDC hdc = NULL;
-
- /* Set the cooperative level to full screen */
- ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4,
- pScreenPriv->hwndScreen,
- DDSCL_EXCLUSIVE
- | DDSCL_FULLSCREEN);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Could not set "
- "cooperative level: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
-
- /*
- * We only need to get the current refresh rate for comparison
- * if a refresh rate has been passed on the command line.
- */
- if (pScreenInfo->dwRefreshRate != 0)
- {
- ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent));
- ddsdCurrent.dwSize = sizeof (ddsdCurrent);
-
- /* Get information about current display settings */
- ddrval = IDirectDraw4_GetDisplayMode (pScreenPriv->pdd4,
- &ddsdCurrent);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Could not get current "
- "refresh rate: %08x. Continuing.\n",
- (unsigned int) ddrval);
- dwRefreshRateCurrent = 0;
- }
- else
- {
- /* Grab the current refresh rate */
- dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate;
- }
- }
-
- /* Clean up the refresh rate */
- if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate)
- {
- /*
- * Refresh rate is non-specified or equal to current.
- */
- pScreenInfo->dwRefreshRate = 0;
- }
-
- /* Grab a device context for the screen */
- hdc = GetDC (NULL);
- if (hdc == NULL)
- {
- ErrorF ("winAllocateFBShadowDDNL - GetDC () failed\n");
- return FALSE;
- }
-
- /* Only change the video mode when different than current mode */
- if (!pScreenInfo->fMultipleMonitors
- && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN)
- || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN)
- || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL)
- || pScreenInfo->dwRefreshRate != 0))
- {
- winDebug ("winAllocateFBShadowDDNL - Changing video mode\n");
-
- /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
- ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4,
- pScreenInfo->dwWidth,
- pScreenInfo->dwHeight,
- pScreenInfo->dwBPP,
- pScreenInfo->dwRefreshRate,
- 0);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Could not set "
- "full screen display mode: %08x\n",
- (unsigned int) ddrval);
- ErrorF ("winAllocateFBShadowDDNL - Using default driver refresh rate\n");
- ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4,
- pScreenInfo->dwWidth,
- pScreenInfo->dwHeight,
- pScreenInfo->dwBPP,
- 0,
- 0);
- if (FAILED(ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Could not set default refresh rate "
- "full screen display mode: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
- }
- }
- else
- {
- winDebug ("winAllocateFBShadowDDNL - Not changing video mode\n");
- }
+ /* Are we full screen? */
+ if (pScreenInfo->fFullScreen) {
+ DDSURFACEDESC2 ddsdCurrent;
+ DWORD dwRefreshRateCurrent = 0;
+ HDC hdc = NULL;
+
+ /* Set the cooperative level to full screen */
+ ddrval = IDirectDraw4_SetCooperativeLevel(pScreenPriv->pdd4,
+ pScreenPriv->hwndScreen,
+ DDSCL_EXCLUSIVE
+ | DDSCL_FULLSCREEN);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDDNL - Could not set "
+ "cooperative level: %08x\n", (unsigned int) ddrval);
+ return FALSE;
+ }
+
+ /*
+ * We only need to get the current refresh rate for comparison
+ * if a refresh rate has been passed on the command line.
+ */
+ if (pScreenInfo->dwRefreshRate != 0) {
+ ZeroMemory(&ddsdCurrent, sizeof(ddsdCurrent));
+ ddsdCurrent.dwSize = sizeof(ddsdCurrent);
+
+ /* Get information about current display settings */
+ ddrval = IDirectDraw4_GetDisplayMode(pScreenPriv->pdd4,
+ &ddsdCurrent);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDDNL - Could not get current "
+ "refresh rate: %08x. Continuing.\n",
+ (unsigned int) ddrval);
+ dwRefreshRateCurrent = 0;
+ }
+ else {
+ /* Grab the current refresh rate */
+ dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate;
+ }
+ }
+
+ /* Clean up the refresh rate */
+ if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) {
+ /*
+ * Refresh rate is non-specified or equal to current.
+ */
+ pScreenInfo->dwRefreshRate = 0;
+ }
+
+ /* Grab a device context for the screen */
+ hdc = GetDC(NULL);
+ if (hdc == NULL) {
+ ErrorF("winAllocateFBShadowDDNL - GetDC () failed\n");
+ return FALSE;
+ }
+
+ /* Only change the video mode when different than current mode */
+ if (!pScreenInfo->fMultipleMonitors
+ && (pScreenInfo->dwWidth != GetSystemMetrics(SM_CXSCREEN)
+ || pScreenInfo->dwHeight != GetSystemMetrics(SM_CYSCREEN)
+ || pScreenInfo->dwBPP != GetDeviceCaps(hdc, BITSPIXEL)
+ || pScreenInfo->dwRefreshRate != 0)) {
+ winDebug("winAllocateFBShadowDDNL - Changing video mode\n");
+
+ /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
+ ddrval = IDirectDraw4_SetDisplayMode(pScreenPriv->pdd4,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP,
+ pScreenInfo->dwRefreshRate, 0);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDDNL - Could not set "
+ "full screen display mode: %08x\n",
+ (unsigned int) ddrval);
+ ErrorF
+ ("winAllocateFBShadowDDNL - Using default driver refresh rate\n");
+ ddrval =
+ IDirectDraw4_SetDisplayMode(pScreenPriv->pdd4,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP, 0, 0);
+ if (FAILED(ddrval)) {
+ ErrorF
+ ("winAllocateFBShadowDDNL - Could not set default refresh rate "
+ "full screen display mode: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+ }
+ }
+ else {
+ winDebug("winAllocateFBShadowDDNL - Not changing video mode\n");
+ }
- /* Release our DC */
- ReleaseDC (NULL, hdc);
- hdc = NULL;
+ /* Release our DC */
+ ReleaseDC(NULL, hdc);
+ hdc = NULL;
}
- else
- {
- /* Set the cooperative level for windowed mode */
- ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4,
- pScreenPriv->hwndScreen,
- DDSCL_NORMAL);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Could not set "
- "cooperative level: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
+ else {
+ /* Set the cooperative level for windowed mode */
+ ddrval = IDirectDraw4_SetCooperativeLevel(pScreenPriv->pdd4,
+ pScreenPriv->hwndScreen,
+ DDSCL_NORMAL);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDDNL - Could not set "
+ "cooperative level: %08x\n", (unsigned int) ddrval);
+ return FALSE;
+ }
}
- /* Create the primary surface */
- if (!winCreatePrimarySurfaceShadowDDNL (pScreen))
- {
- ErrorF ("winAllocateFBShadowDDNL - winCreatePrimarySurfaceShadowDDNL "
- "failed\n");
- return FALSE;
+ /* Create the primary surface */
+ if (!winCreatePrimarySurfaceShadowDDNL(pScreen)) {
+ ErrorF("winAllocateFBShadowDDNL - winCreatePrimarySurfaceShadowDDNL "
+ "failed\n");
+ return FALSE;
}
- /* Get primary surface's pixel format */
- ZeroMemory (&ddpfPrimary, sizeof (ddpfPrimary));
- ddpfPrimary.dwSize = sizeof (ddpfPrimary);
- ddrval = IDirectDrawSurface4_GetPixelFormat (pScreenPriv->pddsPrimary4,
- &ddpfPrimary);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Could not get primary "
- "pixformat: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
+ /* Get primary surface's pixel format */
+ ZeroMemory(&ddpfPrimary, sizeof(ddpfPrimary));
+ ddpfPrimary.dwSize = sizeof(ddpfPrimary);
+ ddrval = IDirectDrawSurface4_GetPixelFormat(pScreenPriv->pddsPrimary4,
+ &ddpfPrimary);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDDNL - Could not get primary "
+ "pixformat: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
- winDebug ("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x "
- "dwRGBBitCount: %d\n",
- ddpfPrimary.u2.dwRBitMask,
- ddpfPrimary.u3.dwGBitMask,
- ddpfPrimary.u4.dwBBitMask,
- ddpfPrimary.u1.dwRGBBitCount);
-
- /* Describe the shadow surface to be created */
- /*
- * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
- * as drawing, locking, and unlocking take forever
- * with video memory surfaces. In addition,
- * video memory is a somewhat scarce resource,
- * so you shouldn't be allocating video memory when
- * you have the option of using system memory instead.
- */
- ZeroMemory (&ddsdShadow, sizeof (ddsdShadow));
- ddsdShadow.dwSize = sizeof (ddsdShadow);
- ddsdShadow.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH
- | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT;
- ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
- ddsdShadow.dwHeight = pScreenInfo->dwHeight;
- ddsdShadow.dwWidth = pScreenInfo->dwWidth;
- ddsdShadow.u1.lPitch = pScreenInfo->dwPaddedWidth;
- ddsdShadow.lpSurface = lpSurface;
- ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary;
-
- winDebug ("winAllocateFBShadowDDNL - lPitch: %d\n",
- (int) pScreenInfo->dwPaddedWidth);
-
- /* Create the shadow surface */
- ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
- &ddsdShadow,
- &pScreenPriv->pddsShadow4,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winAllocateFBShadowDDNL - Could not create shadow "
- "surface: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ winDebug("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x "
+ "dwRGBBitCount: %d\n",
+ ddpfPrimary.u2.dwRBitMask,
+ ddpfPrimary.u3.dwGBitMask,
+ ddpfPrimary.u4.dwBBitMask, ddpfPrimary.u1.dwRGBBitCount);
+
+ /* Describe the shadow surface to be created */
+ /*
+ * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
+ * as drawing, locking, and unlocking take forever
+ * with video memory surfaces. In addition,
+ * video memory is a somewhat scarce resource,
+ * so you shouldn't be allocating video memory when
+ * you have the option of using system memory instead.
+ */
+ ZeroMemory(&ddsdShadow, sizeof(ddsdShadow));
+ ddsdShadow.dwSize = sizeof(ddsdShadow);
+ ddsdShadow.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH
+ | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT;
+ ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
+ ddsdShadow.dwHeight = pScreenInfo->dwHeight;
+ ddsdShadow.dwWidth = pScreenInfo->dwWidth;
+ ddsdShadow.u1.lPitch = pScreenInfo->dwPaddedWidth;
+ ddsdShadow.lpSurface = lpSurface;
+ ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary;
+
+ winDebug("winAllocateFBShadowDDNL - lPitch: %d\n",
+ (int) pScreenInfo->dwPaddedWidth);
+
+ /* Create the shadow surface */
+ ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4,
+ &ddsdShadow,
+ &pScreenPriv->pddsShadow4, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winAllocateFBShadowDDNL - Could not create shadow "
+ "surface: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
-
- winDebug ("winAllocateFBShadowDDNL - Created shadow pitch: %d\n",
- (int) ddsdShadow.u1.lPitch);
- /* Grab the pitch from the surface desc */
- pScreenInfo->dwStride = (ddsdShadow.u1.lPitch * 8)
- / pScreenInfo->dwBPP;
+ winDebug("winAllocateFBShadowDDNL - Created shadow pitch: %d\n",
+ (int) ddsdShadow.u1.lPitch);
- winDebug ("winAllocateFBShadowDDNL - Created shadow stride: %d\n",
- (int) pScreenInfo->dwStride);
+ /* Grab the pitch from the surface desc */
+ pScreenInfo->dwStride = (ddsdShadow.u1.lPitch * 8)
+ / pScreenInfo->dwBPP;
- /* Save the pointer to our surface memory */
- pScreenInfo->pfb = lpSurface;
-
- /* Grab the masks from the surface description */
- pScreenPriv->dwRedMask = ddsdShadow.u4.ddpfPixelFormat.u2.dwRBitMask;
- pScreenPriv->dwGreenMask = ddsdShadow.u4.ddpfPixelFormat.u3.dwGBitMask;
- pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask;
+ winDebug("winAllocateFBShadowDDNL - Created shadow stride: %d\n",
+ (int) pScreenInfo->dwStride);
+
+ /* Save the pointer to our surface memory */
+ pScreenInfo->pfb = lpSurface;
+
+ /* Grab the masks from the surface description */
+ pScreenPriv->dwRedMask = ddsdShadow.u4.ddpfPixelFormat.u2.dwRBitMask;
+ pScreenPriv->dwGreenMask = ddsdShadow.u4.ddpfPixelFormat.u3.dwGBitMask;
+ pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask;
- winDebug ("winAllocateFBShadowDDNL - Returning\n");
+ winDebug("winAllocateFBShadowDDNL - Returning\n");
- return TRUE;
+ return TRUE;
}
static void
winFreeFBShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Free the shadow surface, if there is one */
- if (pScreenPriv->pddsShadow4)
- {
- IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4);
- free (pScreenInfo->pfb);
- pScreenInfo->pfb = NULL;
- pScreenPriv->pddsShadow4 = NULL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Free the shadow surface, if there is one */
+ if (pScreenPriv->pddsShadow4) {
+ IDirectDrawSurface4_Release(pScreenPriv->pddsShadow4);
+ free(pScreenInfo->pfb);
+ pScreenInfo->pfb = NULL;
+ pScreenPriv->pddsShadow4 = NULL;
}
- /* Detach the clipper from the primary surface and release the primary surface, if there is one */
- winReleasePrimarySurfaceShadowDDNL(pScreen);
+ /* Detach the clipper from the primary surface and release the primary surface, if there is one */
+ winReleasePrimarySurfaceShadowDDNL(pScreen);
- ReleaseDDNL(pScreenPriv);
+ ReleaseDDNL(pScreenPriv);
- /* Invalidate the ScreenInfo's fb pointer */
- pScreenInfo->pfb = NULL;
+ /* Invalidate the ScreenInfo's fb pointer */
+ pScreenInfo->pfb = NULL;
}
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
@@ -647,171 +602,161 @@ winFreeFBShadowDDNL(ScreenPtr pScreen)
*/
static
-Bool
-winFinishCreateWindowsWindowDDNL (WindowPtr pWin)
+ Bool
+winFinishCreateWindowsWindowDDNL(WindowPtr pWin)
{
- winWindowPriv(pWin);
- winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC2 ddsd;
- int iWidth, iHeight;
- int iX, iY;
-
- winDebug ("winFinishCreateWindowsWindowDDNL!\n\n");
-
- iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
- iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
-
- iWidth = pWin->drawable.width;
- iHeight = pWin->drawable.height;
-
- /* Describe the primary surface */
- ZeroMemory (&ddsd, sizeof (ddsd));
- ddsd.dwSize = sizeof (ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
- ddsd.dwHeight = iHeight;
- ddsd.dwWidth = iWidth;
-
- /* Create the primary surface */
- ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
- &ddsd,
- &pWinPriv->pddsPrimary4,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winFinishCreateWindowsWindowDDNL - Could not create primary "
- "surface: %08x\n",
- (unsigned int)ddrval);
- return FALSE;
+ winWindowPriv(pWin);
+ winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC2 ddsd;
+ int iWidth, iHeight;
+ int iX, iY;
+
+ winDebug("winFinishCreateWindowsWindowDDNL!\n\n");
+
+ iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
+ /* Describe the primary surface */
+ ZeroMemory(&ddsd, sizeof(ddsd));
+ ddsd.dwSize = sizeof(ddsd);
+ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+ ddsd.dwHeight = iHeight;
+ ddsd.dwWidth = iWidth;
+
+ /* Create the primary surface */
+ ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4,
+ &ddsd, &pWinPriv->pddsPrimary4, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winFinishCreateWindowsWindowDDNL - Could not create primary "
+ "surface: %08x\n", (unsigned int) ddrval);
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
#endif
-
/*
* Transfer the damaged regions of the shadow framebuffer to the display.
*/
static void
-winShadowUpdateDDNL (ScreenPtr pScreen,
- shadowBufPtr pBuf)
+winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RegionPtr damage = shadowDamage(pBuf);
- RECT rcDest, rcSrc;
- POINT ptOrigin;
- DWORD dwBox = RegionNumRects (damage);
- BoxPtr pBox = RegionRects (damage);
- HRGN hrgnTemp = NULL, hrgnCombined = NULL;
-
- /*
- * Return immediately if the app is not active
- * and we are fullscreen, or if we have a bad display depth
- */
- if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
- || pScreenPriv->fBadDepth) return;
-
- /* Return immediately if we didn't get needed surfaces */
- if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4)
- return;
-
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
- MapWindowPoints (pScreenPriv->hwndScreen,
- HWND_DESKTOP,
- (LPPOINT)&ptOrigin, 1);
-
- /*
- * Handle small regions with multiple blits,
- * handle large regions by creating a clipping region and
- * doing a single blit constrained to that clipping region.
- */
- if (pScreenInfo->dwClipUpdatesNBoxes == 0
- || dwBox < pScreenInfo->dwClipUpdatesNBoxes)
- {
- /* Loop through all boxes in the damaged region */
- while (dwBox--)
- {
- /* Assign damage box to source rectangle */
- rcSrc.left = pBox->x1;
- rcSrc.top = pBox->y1;
- rcSrc.right = pBox->x2;
- rcSrc.bottom = pBox->y2;
-
- /* Calculate destination rectangle */
- rcDest.left = ptOrigin.x + rcSrc.left;
- rcDest.top = ptOrigin.y + rcSrc.top;
- rcDest.right = ptOrigin.x + rcSrc.right;
- rcDest.bottom = ptOrigin.y + rcSrc.bottom;
-
- /* Blit the damaged areas */
- if (pScreenPriv->pddsPrimary4)
- myIDirectDrawSurface4_Blt (pScreen,
- &rcDest,
- &rcSrc);
-
- /* Get a pointer to the next box */
- ++pBox;
- }
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RegionPtr damage = shadowDamage(pBuf);
+ RECT rcDest, rcSrc;
+ POINT ptOrigin;
+ DWORD dwBox = RegionNumRects(damage);
+ BoxPtr pBox = RegionRects(damage);
+ HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+
+ /*
+ * Return immediately if the app is not active
+ * and we are fullscreen, or if we have a bad display depth
+ */
+ if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
+ || pScreenPriv->fBadDepth)
+ return;
+
+ /* Return immediately if we didn't get needed surfaces */
+ if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4)
+ return;
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+ MapWindowPoints(pScreenPriv->hwndScreen,
+ HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+
+ /*
+ * Handle small regions with multiple blits,
+ * handle large regions by creating a clipping region and
+ * doing a single blit constrained to that clipping region.
+ */
+ if (pScreenInfo->dwClipUpdatesNBoxes == 0
+ || dwBox < pScreenInfo->dwClipUpdatesNBoxes) {
+ /* Loop through all boxes in the damaged region */
+ while (dwBox--) {
+ /* Assign damage box to source rectangle */
+ rcSrc.left = pBox->x1;
+ rcSrc.top = pBox->y1;
+ rcSrc.right = pBox->x2;
+ rcSrc.bottom = pBox->y2;
+
+ /* Calculate destination rectangle */
+ rcDest.left = ptOrigin.x + rcSrc.left;
+ rcDest.top = ptOrigin.y + rcSrc.top;
+ rcDest.right = ptOrigin.x + rcSrc.right;
+ rcDest.bottom = ptOrigin.y + rcSrc.bottom;
+
+ /* Blit the damaged areas */
+ if (pScreenPriv->pddsPrimary4)
+ myIDirectDrawSurface4_Blt (pScreen,
+ &rcDest,
+ &rcSrc);
+
+ /* Get a pointer to the next box */
+ ++pBox;
+ }
}
- else
- {
- BoxPtr pBoxExtents = RegionExtents(damage);
-
- /* Compute a GDI region from the damaged region */
- hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
- dwBox--;
- pBox++;
- while (dwBox--)
- {
- hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
- CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
- DeleteObject (hrgnTemp);
- pBox++;
- }
-
- /* Install the GDI region as a clipping region */
- SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined);
- DeleteObject (hrgnCombined);
- hrgnCombined = NULL;
-
- winDebug ("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n",
- pBoxExtents->x1, pBoxExtents->y1,
- pBoxExtents->x2, pBoxExtents->y2);
-
- /* Calculating a bounding box for the source is easy */
- rcSrc.left = pBoxExtents->x1;
- rcSrc.top = pBoxExtents->y1;
- rcSrc.right = pBoxExtents->x2;
- rcSrc.bottom = pBoxExtents->y2;
-
- /* Calculating a bounding box for the destination is trickier */
- rcDest.left = ptOrigin.x + rcSrc.left;
- rcDest.top = ptOrigin.y + rcSrc.top;
- rcDest.right = ptOrigin.x + rcSrc.right;
- rcDest.bottom = ptOrigin.y + rcSrc.bottom;
-
- /* Our Blt should be clipped to the invalidated region */
- myIDirectDrawSurface4_Blt (pScreen, &rcDest, &rcSrc);
-
- /* Reset the clip region */
- SelectClipRgn (pScreenPriv->hdcScreen, NULL);
+ else {
+ BoxPtr pBoxExtents = RegionExtents(damage);
+
+ /* Compute a GDI region from the damaged region */
+ hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ dwBox--;
+ pBox++;
+ while (dwBox--) {
+ hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
+ DeleteObject(hrgnTemp);
+ pBox++;
+ }
+
+ /* Install the GDI region as a clipping region */
+ SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);
+ DeleteObject(hrgnCombined);
+ hrgnCombined = NULL;
+
+ winDebug("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n",
+ pBoxExtents->x1, pBoxExtents->y1,
+ pBoxExtents->x2, pBoxExtents->y2);
+
+ /* Calculating a bounding box for the source is easy */
+ rcSrc.left = pBoxExtents->x1;
+ rcSrc.top = pBoxExtents->y1;
+ rcSrc.right = pBoxExtents->x2;
+ rcSrc.bottom = pBoxExtents->y2;
+
+ /* Calculating a bounding box for the destination is trickier */
+ rcDest.left = ptOrigin.x + rcSrc.left;
+ rcDest.top = ptOrigin.y + rcSrc.top;
+ rcDest.right = ptOrigin.x + rcSrc.right;
+ rcDest.bottom = ptOrigin.y + rcSrc.bottom;
+
+ /* Our Blt should be clipped to the invalidated region */
+ myIDirectDrawSurface4_Blt (pScreen, &rcDest, &rcSrc);
+
+ /* Reset the clip region */
+ SelectClipRgn(pScreenPriv->hdcScreen, NULL);
}
}
static Bool
winInitScreenShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
- /* Get a device context for the screen */
- pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+ /* Get a device context for the screen */
+ pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen);
- return winAllocateFBShadowDDNL(pScreen);
+ return winAllocateFBShadowDDNL(pScreen);
}
/*
@@ -821,64 +766,61 @@ winInitScreenShadowDDNL(ScreenPtr pScreen)
*/
static Bool
-winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
+winCloseScreenShadowDDNL(int nIndex, ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- Bool fReturn=FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ Bool fReturn=FALSE;
- winDebug ("winCloseScreenShadowDDNL - Freeing screen resources\n");
+ winDebug("winCloseScreenShadowDDNL - Freeing screen resources\n");
- /* Flag that the screen is closed */
- pScreenPriv->fClosed = TRUE;
- pScreenPriv->fActive = FALSE;
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
- /* Call the wrapped CloseScreen procedure */
- WIN_UNWRAP(CloseScreen);
- if (pScreen->CloseScreen)
- fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+ /* Call the wrapped CloseScreen procedure */
+ WIN_UNWRAP(CloseScreen);
+ if (pScreen->CloseScreen)
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
- winFreeFBShadowDDNL(pScreen);
+ winFreeFBShadowDDNL(pScreen);
- /* Free the screen DC */
- ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
+ /* Free the screen DC */
+ ReleaseDC(pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
- /* Delete the window property */
- RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
+ /* Delete the window property */
+ RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
- /* Delete tray icon, if we have one */
- if (!pScreenInfo->fNoTrayIcon)
- winDeleteNotifyIcon (pScreenPriv);
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon(pScreenPriv);
- /* Free the exit confirmation dialog box, if it exists */
- if (g_hDlgExit != NULL)
- {
- DestroyWindow (g_hDlgExit);
- g_hDlgExit = NULL;
+ /* Free the exit confirmation dialog box, if it exists */
+ if (g_hDlgExit != NULL) {
+ DestroyWindow(g_hDlgExit);
+ g_hDlgExit = NULL;
}
- /* Kill our window */
- if (pScreenPriv->hwndScreen)
- {
- DestroyWindow (pScreenPriv->hwndScreen);
- pScreenPriv->hwndScreen = NULL;
+ /* Kill our window */
+ if (pScreenPriv->hwndScreen) {
+ DestroyWindow(pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
}
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Destroy the thread startup mutex */
- if (pScreenPriv->pmServerStarted) pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
+ /* Destroy the thread startup mutex */
+ if (pScreenPriv->pmServerStarted) pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
#endif
- /* Kill our screeninfo's pointer to the screen */
- pScreenInfo->pScreen = NULL;
+ /* Kill our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
- /* Free the screen privates for this screen */
- free ((pointer) pScreenPriv);
+ /* Free the screen privates for this screen */
+ free((pointer) pScreenPriv);
- return fReturn;
+ return fReturn;
}
-
/*
* Tell mi what sort of visuals we need.
*
@@ -888,477 +830,444 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
*/
static Bool
-winInitVisualsShadowDDNL (ScreenPtr pScreen)
+winInitVisualsShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- DWORD dwRedBits, dwGreenBits, dwBlueBits;
-
- /* Count the number of ones in each color mask */
- dwRedBits = winCountBits (pScreenPriv->dwRedMask);
- dwGreenBits = winCountBits (pScreenPriv->dwGreenMask);
- dwBlueBits = winCountBits (pScreenPriv->dwBlueMask);
-
- /* Store the maximum number of ones in a color mask as the bitsPerRGB */
- if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0)
- pScreenPriv->dwBitsPerRGB = 8;
- else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwRedBits;
- else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwGreenBits;
- else
- pScreenPriv->dwBitsPerRGB = dwBlueBits;
-
- winDebug ("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d "
- "bpp %d\n",
- (unsigned int) pScreenPriv->dwRedMask,
- (unsigned int) pScreenPriv->dwGreenMask,
- (unsigned int) pScreenPriv->dwBlueMask,
- (int) pScreenPriv->dwBitsPerRGB,
- (int) pScreenInfo->dwDepth,
- (int) pScreenInfo->dwBPP);
-
- /* Create a single visual according to the Windows screen depth */
- switch (pScreenInfo->dwDepth)
- {
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ DWORD dwRedBits, dwGreenBits, dwBlueBits;
+
+ /* Count the number of ones in each color mask */
+ dwRedBits = winCountBits(pScreenPriv->dwRedMask);
+ dwGreenBits = winCountBits(pScreenPriv->dwGreenMask);
+ dwBlueBits = winCountBits(pScreenPriv->dwBlueMask);
+
+ /* Store the maximum number of ones in a color mask as the bitsPerRGB */
+ if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0)
+ pScreenPriv->dwBitsPerRGB = 8;
+ else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwRedBits;
+ else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwGreenBits;
+ else
+ pScreenPriv->dwBitsPerRGB = dwBlueBits;
+
+ winDebug("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d "
+ "bpp %d\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask,
+ (int) pScreenPriv->dwBitsPerRGB,
+ (int) pScreenInfo->dwDepth, (int) pScreenInfo->dwBPP);
+
+ /* Create a single visual according to the Windows screen depth */
+ switch (pScreenInfo->dwDepth) {
case 24:
case 16:
case 15:
- /* Setup the real visual */
- if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
- TrueColorMask,
- pScreenPriv->dwBitsPerRGB,
- -1,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask))
- {
- ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
- "failed for TrueColor\n");
- return FALSE;
- }
+ /* Setup the real visual */
+ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ -1,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask)) {
+ ErrorF("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
+ "failed for TrueColor\n");
+ return FALSE;
+ }
#ifdef XWIN_EMULATEPSEUDO
- if (!pScreenInfo->fEmulatePseudo)
- break;
-
- /* Setup a pseudocolor visual */
- if (!miSetVisualTypesAndMasks (8,
- PseudoColorMask,
- 8,
- -1,
- 0,
- 0,
- 0))
- {
- ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
- "failed for PseudoColor\n");
- return FALSE;
- }
+ if (!pScreenInfo->fEmulatePseudo)
+ break;
+
+ /* Setup a pseudocolor visual */
+ if (!miSetVisualTypesAndMasks(8, PseudoColorMask, 8, -1, 0, 0, 0)) {
+ ErrorF("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
+ "failed for PseudoColor\n");
+ return FALSE;
+ }
#endif
- break;
+ break;
case 8:
- if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
- pScreenInfo->fFullScreen
- ? PseudoColorMask : StaticColorMask,
- pScreenPriv->dwBitsPerRGB,
- pScreenInfo->fFullScreen
- ? PseudoColor : StaticColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask))
- {
- ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
- "failed\n");
- return FALSE;
- }
- break;
+ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
+ pScreenInfo->fFullScreen
+ ? PseudoColorMask : StaticColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenInfo->fFullScreen
+ ? PseudoColor : StaticColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask)) {
+ ErrorF("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+ break;
default:
- ErrorF ("winInitVisualsShadowDDNL - Unknown screen depth\n");
- return FALSE;
+ ErrorF("winInitVisualsShadowDDNL - Unknown screen depth\n");
+ return FALSE;
}
- winDebug ("winInitVisualsShadowDDNL - Returning\n");
+ winDebug("winInitVisualsShadowDDNL - Returning\n");
- return TRUE;
+ return TRUE;
}
-
/*
* Adjust the user proposed video mode
*/
static Bool
-winAdjustVideoModeShadowDDNL (ScreenPtr pScreen)
+winAdjustVideoModeShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HDC hdc = NULL;
- DWORD dwBPP;
-
- /* We're in serious trouble if we can't get a DC */
- hdc = GetDC (NULL);
- if (hdc == NULL)
- {
- ErrorF ("winAdjustVideoModeShadowDDNL - GetDC () failed\n");
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc = NULL;
+ DWORD dwBPP;
+
+ /* We're in serious trouble if we can't get a DC */
+ hdc = GetDC(NULL);
+ if (hdc == NULL) {
+ ErrorF("winAdjustVideoModeShadowDDNL - GetDC () failed\n");
+ return FALSE;
}
- /* Query GDI for current display depth */
- dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
- /* DirectDraw can only change the depth in fullscreen mode */
- if (!(pScreenInfo->fFullScreen &&
- (pScreenInfo->dwBPP != WIN_DEFAULT_BPP)))
- {
- /* Otherwise, We'll use GDI's depth */
- pScreenInfo->dwBPP = dwBPP;
+ /* DirectDraw can only change the depth in fullscreen mode */
+ if (!(pScreenInfo->fFullScreen && (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) {
+ /* Otherwise, We'll use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
}
- /* Release our DC */
- ReleaseDC (NULL, hdc);
+ /* Release our DC */
+ ReleaseDC(NULL, hdc);
- return TRUE;
+ return TRUE;
}
-
/*
* Blt exposed regions to the screen
*/
static Bool
-winBltExposedRegionsShadowDDNL (ScreenPtr pScreen)
+winBltExposedRegionsShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RECT rcSrc, rcDest;
- POINT ptOrigin;
- HDC hdcUpdate;
- PAINTSTRUCT ps;
- HRESULT ddrval = DD_OK;
- Bool fReturn = TRUE;
- int i;
-
- /* Quite common case. The primary surface was lost (maybe because of depth
- * change). Try to create a new primary surface. Bail out if this fails */
- if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface &&
- !winCreatePrimarySurfaceShadowDDNL(pScreen))
- {
- Sleep(100);
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RECT rcSrc, rcDest;
+ POINT ptOrigin;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+ HRESULT ddrval = DD_OK;
+ Bool fReturn = TRUE;
+ int i;
+
+ /* Quite common case. The primary surface was lost (maybe because of depth
+ * change). Try to create a new primary surface. Bail out if this fails */
+ if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface &&
+ !winCreatePrimarySurfaceShadowDDNL(pScreen)) {
+ Sleep(100);
+ return FALSE;
}
- if (pScreenPriv->pddsPrimary4 == NULL)
- return FALSE;
-
- /* BeginPaint gives us an hdc that clips to the invalidated region */
- hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps);
- if (hdcUpdate == NULL)
- {
- fReturn = FALSE;
- ErrorF ("winBltExposedRegionsShadowDDNL - BeginPaint () returned "
- "a NULL device context handle. Aborting blit attempt.\n");
- goto winBltExposedRegionsShadowDDNL_Exit;
+ if (pScreenPriv->pddsPrimary4 == NULL)
+ return FALSE;
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint(pScreenPriv->hwndScreen, &ps);
+ if (hdcUpdate == NULL) {
+ fReturn = FALSE;
+ ErrorF("winBltExposedRegionsShadowDDNL - BeginPaint () returned "
+ "a NULL device context handle. Aborting blit attempt.\n");
+ goto winBltExposedRegionsShadowDDNL_Exit;
}
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
-
- MapWindowPoints (pScreenPriv->hwndScreen,
- HWND_DESKTOP,
- (LPPOINT)&ptOrigin, 1);
- rcDest.left = ptOrigin.x;
- rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
- rcDest.top = ptOrigin.y;
- rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
-
- /* Source can be entire shadow surface, as Blt should clip for us */
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.right = pScreenInfo->dwWidth;
- rcSrc.bottom = pScreenInfo->dwHeight;
-
- /* Our Blt should be clipped to the invalidated region */
- ddrval = myIDirectDrawSurface4_Blt (pScreen, &rcDest, &rcSrc);
- if (FAILED (ddrval))
- {
- fReturn = FALSE;
- }
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+
+ MapWindowPoints(pScreenPriv->hwndScreen,
+ HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+ rcDest.left = ptOrigin.x;
+ rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
+ rcDest.top = ptOrigin.y;
+ rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
+
+ /* Source can be entire shadow surface, as Blt should clip for us */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Our Blt should be clipped to the invalidated region */
+ ddrval = myIDirectDrawSurface4_Blt (pScreen, &rcDest, &rcSrc);
+ if (FAILED (ddrval))
+ {
+ fReturn = FALSE;
+ }
winBltExposedRegionsShadowDDNL_Exit:
- /* EndPaint frees the DC */
- if (hdcUpdate != NULL)
- EndPaint (pScreenPriv->hwndScreen, &ps);
- return fReturn;
+ /* EndPaint frees the DC */
+ if (hdcUpdate != NULL)
+ EndPaint(pScreenPriv->hwndScreen, &ps);
+ return fReturn;
}
-
/*
* Do any engine-specific application-activation processing
*/
static Bool
-winActivateAppShadowDDNL (ScreenPtr pScreen)
+winActivateAppShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
+ winScreenPriv(pScreen);
- /*
- * Do we have a surface?
- * Are we active?
- * Are we full screen?
- */
- if (pScreenPriv != NULL
- && pScreenPriv->pddsPrimary4 != NULL
- && pScreenPriv->fActive)
- {
- /* Primary surface was lost, restore it */
- IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4);
+ /*
+ * Do we have a surface?
+ * Are we active?
+ * Are we full screen?
+ */
+ if (pScreenPriv != NULL
+ && pScreenPriv->pddsPrimary4 != NULL && pScreenPriv->fActive) {
+ /* Primary surface was lost, restore it */
+ IDirectDrawSurface4_Restore(pScreenPriv->pddsPrimary4);
}
- return TRUE;
+ return TRUE;
}
-
/*
* Reblit the shadow framebuffer to the screen.
*/
static Bool
-winRedrawScreenShadowDDNL (ScreenPtr pScreen)
+winRedrawScreenShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RECT rcSrc, rcDest;
- POINT ptOrigin;
-
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
- MapWindowPoints (pScreenPriv->hwndScreen,
- HWND_DESKTOP,
- (LPPOINT)&ptOrigin, 1);
- rcDest.left = ptOrigin.x;
- rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
- rcDest.top = ptOrigin.y;
- rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
-
- /* Source can be entire shadow surface, as Blt should clip for us */
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.right = pScreenInfo->dwWidth;
- rcSrc.bottom = pScreenInfo->dwHeight;
-
- /* Redraw the whole window, to take account for the new colors */
- myIDirectDrawSurface4_Blt (pScreen, &rcDest, &rcSrc);
- return TRUE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RECT rcSrc, rcDest;
+ POINT ptOrigin;
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+ MapWindowPoints(pScreenPriv->hwndScreen,
+ HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+ rcDest.left = ptOrigin.x;
+ rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
+ rcDest.top = ptOrigin.y;
+ rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
+
+ /* Source can be entire shadow surface, as Blt should clip for us */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Redraw the whole window, to take account for the new colors */
+ myIDirectDrawSurface4_Blt (pScreen, &rcDest, &rcSrc);
+ return TRUE;
}
-
/*
* Realize the currently installed colormap
*/
static Bool
-winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen)
+winRealizeInstalledPaletteShadowDDNL(ScreenPtr pScreen)
{
- return TRUE;
+ return TRUE;
}
-
/*
* Install the specified colormap
*/
static Bool
-winInstallColormapShadowDDNL (ColormapPtr pColormap)
+winInstallColormapShadowDDNL(ColormapPtr pColormap)
{
- ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
- HRESULT ddrval = DD_OK;
-
- /* Install the DirectDraw palette on the primary surface */
- ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4,
- pCmapPriv->lpDDPalette);
- if (FAILED (ddrval))
- {
- ErrorF ("winInstallColormapShadowDDNL - Failed installing the "
- "DirectDraw palette.\n");
- return FALSE;
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ HRESULT ddrval = DD_OK;
+
+ /* Install the DirectDraw palette on the primary surface */
+ ddrval = IDirectDrawSurface4_SetPalette(pScreenPriv->pddsPrimary4,
+ pCmapPriv->lpDDPalette);
+ if (FAILED(ddrval)) {
+ ErrorF("winInstallColormapShadowDDNL - Failed installing the "
+ "DirectDraw palette.\n");
+ return FALSE;
}
- /* Save a pointer to the newly installed colormap */
- pScreenPriv->pcmapInstalled = pColormap;
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
- return TRUE;
+ return TRUE;
}
-
/*
* Store the specified colors in the specified colormap
*/
static Bool
-winStoreColorsShadowDDNL (ColormapPtr pColormap,
- int ndef,
- xColorItem *pdefs)
+winStoreColorsShadowDDNL(ColormapPtr pColormap, int ndef, xColorItem * pdefs)
{
- ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
- ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
- HRESULT ddrval = DD_OK;
-
- /* Put the X colormap entries into the Windows logical palette */
- ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette,
- 0,
- pdefs[0].pixel,
- ndef,
- pCmapPriv->peColors
- + pdefs[0].pixel);
- if (FAILED (ddrval))
- {
- ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", (unsigned int) ddrval);
- return FALSE;
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
+ HRESULT ddrval = DD_OK;
+
+ /* Put the X colormap entries into the Windows logical palette */
+ ddrval = IDirectDrawPalette_SetEntries(pCmapPriv->lpDDPalette,
+ 0,
+ pdefs[0].pixel,
+ ndef,
+ pCmapPriv->peColors
+ + pdefs[0].pixel);
+ if (FAILED(ddrval)) {
+ ErrorF("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
}
- /* Don't install the DirectDraw palette if the colormap is not installed */
- if (pColormap != curpmap)
- {
- return TRUE;
+ /* Don't install the DirectDraw palette if the colormap is not installed */
+ if (pColormap != curpmap) {
+ return TRUE;
}
- if (!winInstallColormapShadowDDNL (pColormap))
- {
- ErrorF ("winStoreColorsShadowDDNL - Failed installing colormap\n");
- return FALSE;
+ if (!winInstallColormapShadowDDNL(pColormap)) {
+ ErrorF("winStoreColorsShadowDDNL - Failed installing colormap\n");
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
-
/*
* Colormap initialization procedure
*/
static Bool
-winCreateColormapShadowDDNL (ColormapPtr pColormap)
+winCreateColormapShadowDDNL(ColormapPtr pColormap)
{
- HRESULT ddrval = DD_OK;
- ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
-
- /* Create a DirectDraw palette */
- ddrval = IDirectDraw4_CreatePalette (pScreenPriv->pdd4,
- DDPCAPS_8BIT | DDPCAPS_ALLOW256,
- pCmapPriv->peColors,
- &pCmapPriv->lpDDPalette,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winCreateColormapShadowDDNL - CreatePalette failed\n");
- return FALSE;
+ HRESULT ddrval = DD_OK;
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+
+ /* Create a DirectDraw palette */
+ ddrval = IDirectDraw4_CreatePalette(pScreenPriv->pdd4,
+ DDPCAPS_8BIT | DDPCAPS_ALLOW256,
+ pCmapPriv->peColors,
+ &pCmapPriv->lpDDPalette, NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winCreateColormapShadowDDNL - CreatePalette failed\n");
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
-
/*
* Colormap destruction procedure
*/
static Bool
-winDestroyColormapShadowDDNL (ColormapPtr pColormap)
+winDestroyColormapShadowDDNL(ColormapPtr pColormap)
{
- winScreenPriv(pColormap->pScreen);
- winCmapPriv(pColormap);
- HRESULT ddrval = DD_OK;
-
- /*
- * Is colormap to be destroyed the default?
- *
- * Non-default colormaps should have had winUninstallColormap
- * called on them before we get here. The default colormap
- * will not have had winUninstallColormap called on it. Thus,
- * we need to handle the default colormap in a special way.
- */
- if (pColormap->flags & IsDefault)
- {
- winDebug ("winDestroyColormapShadowDDNL - Destroying default colormap\n");
-
- /*
- * FIXME: Walk the list of all screens, popping the default
- * palette out of each screen device context.
- */
-
- /* Pop the palette out of the primary surface */
- ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4,
- NULL);
- if (FAILED (ddrval))
- {
- ErrorF ("winDestroyColormapShadowDDNL - Failed freeing the "
- "default colormap DirectDraw palette.\n");
- return FALSE;
- }
-
- /* Clear our private installed colormap pointer */
- pScreenPriv->pcmapInstalled = NULL;
+ winScreenPriv(pColormap->pScreen);
+ winCmapPriv(pColormap);
+ HRESULT ddrval = DD_OK;
+
+ /*
+ * Is colormap to be destroyed the default?
+ *
+ * Non-default colormaps should have had winUninstallColormap
+ * called on them before we get here. The default colormap
+ * will not have had winUninstallColormap called on it. Thus,
+ * we need to handle the default colormap in a special way.
+ */
+ if (pColormap->flags & IsDefault) {
+ winDebug
+ ("winDestroyColormapShadowDDNL - Destroying default colormap\n");
+
+ /*
+ * FIXME: Walk the list of all screens, popping the default
+ * palette out of each screen device context.
+ */
+
+ /* Pop the palette out of the primary surface */
+ ddrval = IDirectDrawSurface4_SetPalette(pScreenPriv->pddsPrimary4,
+ NULL);
+ if (FAILED(ddrval)) {
+ ErrorF("winDestroyColormapShadowDDNL - Failed freeing the "
+ "default colormap DirectDraw palette.\n");
+ return FALSE;
+ }
+
+ /* Clear our private installed colormap pointer */
+ pScreenPriv->pcmapInstalled = NULL;
}
-
- /* Release the palette */
- IDirectDrawPalette_Release (pCmapPriv->lpDDPalette);
-
- /* Invalidate the colormap privates */
- pCmapPriv->lpDDPalette = NULL;
- return TRUE;
-}
+ /* Release the palette */
+ IDirectDrawPalette_Release(pCmapPriv->lpDDPalette);
+ /* Invalidate the colormap privates */
+ pCmapPriv->lpDDPalette = NULL;
+
+ return TRUE;
+}
/*
* Set pointers to our engine specific functions
*/
Bool
-winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen)
+winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Set our pointers */
- pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL;
- pScreenPriv->pwinFreeFB = winFreeFBShadowDDNL;
- pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL;
- pScreenPriv->pwinInitScreen = winInitScreenShadowDDNL;
- pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL;
- pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL;
- pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL;
- if (pScreenInfo->fFullScreen)
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
- else
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
- pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
- pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL;
- pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL;
- pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDDNL;
- pScreenPriv->pwinRealizeInstalledPalette
- = winRealizeInstalledPaletteShadowDDNL;
- pScreenPriv->pwinInstallColormap = winInstallColormapShadowDDNL;
- pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL;
- pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL;
- pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL;
- pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
- pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL;
- pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL;
+ pScreenPriv->pwinFreeFB = winFreeFBShadowDDNL;
+ pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL;
+ pScreenPriv->pwinInitScreen = winInitScreenShadowDDNL;
+ pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL;
+ pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL;
+ if (pScreenInfo->fFullScreen)
+ pScreenPriv->pwinCreateBoundingWindow =
+ winCreateBoundingWindowFullScreen;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
+ pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL;
+ pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL;
+ pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDDNL;
+ pScreenPriv->pwinRealizeInstalledPalette
+ = winRealizeInstalledPaletteShadowDDNL;
+ pScreenPriv->pwinInstallColormap = winInstallColormapShadowDDNL;
+ pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL;
+ pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL;
+ pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL;
+ pScreenPriv->pwinHotKeyAltTab =
+ (winHotKeyAltTabProcPtr) (void (*)(void)) NoopDDA;
+ pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL;
+ pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL;
#ifdef XWIN_MULTIWINDOW
- pScreenPriv->pwinFinishCreateWindowsWindow
- = winFinishCreateWindowsWindowDDNL;
+ pScreenPriv->pwinFinishCreateWindowsWindow
+ = winFinishCreateWindowsWindowDDNL;
#endif
- return TRUE;
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/winshadgdi.c b/xorg-server/hw/xwin/winshadgdi.c
index a11ca43bd..c4d1da8d0 100644
--- a/xorg-server/hw/xwin/winshadgdi.c
+++ b/xorg-server/hw/xwin/winshadgdi.c
@@ -33,410 +33,382 @@
#endif
#include "win.h"
-
/*
* Local function prototypes
*/
#ifdef XWIN_MULTIWINDOW
-static wBOOL CALLBACK
-winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam);
+static wBOOL CALLBACK winRedrawAllProcShadowGDI(HWND hwnd, LPARAM lParam);
-static wBOOL CALLBACK
-winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam);
+static wBOOL CALLBACK winRedrawDamagedWindowShadowGDI(HWND hwnd, LPARAM lParam);
#endif
static Bool
-winAllocateFBShadowGDI (ScreenPtr pScreen);
+ winAllocateFBShadowGDI(ScreenPtr pScreen);
static void
-winShadowUpdateGDI (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf);
static Bool
-winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen);
+ winCloseScreenShadowGDI(int nIndex, ScreenPtr pScreen);
static Bool
-winInitVisualsShadowGDI (ScreenPtr pScreen);
+ winInitVisualsShadowGDI(ScreenPtr pScreen);
static Bool
-winAdjustVideoModeShadowGDI (ScreenPtr pScreen);
+ winAdjustVideoModeShadowGDI(ScreenPtr pScreen);
static Bool
-winBltExposedRegionsShadowGDI (ScreenPtr pScreen);
+ winBltExposedRegionsShadowGDI(ScreenPtr pScreen);
static Bool
-winActivateAppShadowGDI (ScreenPtr pScreen);
+ winActivateAppShadowGDI(ScreenPtr pScreen);
static Bool
-winRedrawScreenShadowGDI (ScreenPtr pScreen);
+ winRedrawScreenShadowGDI(ScreenPtr pScreen);
static Bool
-winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen);
+ winRealizeInstalledPaletteShadowGDI(ScreenPtr pScreen);
static Bool
-winInstallColormapShadowGDI (ColormapPtr pColormap);
+ winInstallColormapShadowGDI(ColormapPtr pColormap);
static Bool
-winStoreColorsShadowGDI (ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs);
+ winStoreColorsShadowGDI(ColormapPtr pmap, int ndef, xColorItem * pdefs);
static Bool
-winCreateColormapShadowGDI (ColormapPtr pColormap);
+ winCreateColormapShadowGDI(ColormapPtr pColormap);
static Bool
-winDestroyColormapShadowGDI (ColormapPtr pColormap);
-
+ winDestroyColormapShadowGDI(ColormapPtr pColormap);
/*
* Internal function to get the DIB format that is compatible with the screen
*/
static
-Bool
-winQueryScreenDIBFormat (ScreenPtr pScreen, BITMAPINFOHEADER *pbmih)
+ Bool
+winQueryScreenDIBFormat(ScreenPtr pScreen, BITMAPINFOHEADER * pbmih)
{
- winScreenPriv(pScreen);
- HBITMAP hbmp;
+ winScreenPriv(pScreen);
+ HBITMAP hbmp;
#ifdef WINDBG
- LPDWORD pdw = NULL;
+ LPDWORD pdw = NULL;
#endif
-
- /* Create a memory bitmap compatible with the screen */
- hbmp = CreateCompatibleBitmap (pScreenPriv->hdcScreen, 1, 1);
- if (hbmp == NULL)
- {
- ErrorF ("winQueryScreenDIBFormat - CreateCompatibleBitmap failed\n");
- return FALSE;
+
+ /* Create a memory bitmap compatible with the screen */
+ hbmp = CreateCompatibleBitmap(pScreenPriv->hdcScreen, 1, 1);
+ if (hbmp == NULL) {
+ ErrorF("winQueryScreenDIBFormat - CreateCompatibleBitmap failed\n");
+ return FALSE;
}
-
- /* Initialize our bitmap info header */
- ZeroMemory (pbmih, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD));
- pbmih->biSize = sizeof (BITMAPINFOHEADER);
-
- /* Get the biBitCount */
- if (!GetDIBits (pScreenPriv->hdcScreen,
- hbmp,
- 0, 1,
- NULL,
- (BITMAPINFO*) pbmih,
- DIB_RGB_COLORS))
- {
- ErrorF ("winQueryScreenDIBFormat - First call to GetDIBits failed\n");
- DeleteObject (hbmp);
- return FALSE;
+
+ /* Initialize our bitmap info header */
+ ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
+ pbmih->biSize = sizeof(BITMAPINFOHEADER);
+
+ /* Get the biBitCount */
+ if (!GetDIBits(pScreenPriv->hdcScreen,
+ hbmp, 0, 1, NULL, (BITMAPINFO *) pbmih, DIB_RGB_COLORS)) {
+ ErrorF("winQueryScreenDIBFormat - First call to GetDIBits failed\n");
+ DeleteObject(hbmp);
+ return FALSE;
}
#ifdef WINDBG
- /* Get a pointer to bitfields */
- pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER));
+ /* Get a pointer to bitfields */
+ pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER));
- winDebug ("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n",
- pdw[0], pdw[1], pdw[2]);
+ winDebug("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n",
+ pdw[0], pdw[1], pdw[2]);
#endif
- /* Get optimal color table, or the optimal bitfields */
- if (!GetDIBits (pScreenPriv->hdcScreen,
- hbmp,
- 0, 1,
- NULL,
- (BITMAPINFO*)pbmih,
- DIB_RGB_COLORS))
- {
- ErrorF ("winQueryScreenDIBFormat - Second call to GetDIBits "
- "failed\n");
- DeleteObject (hbmp);
- return FALSE;
+ /* Get optimal color table, or the optimal bitfields */
+ if (!GetDIBits(pScreenPriv->hdcScreen,
+ hbmp, 0, 1, NULL, (BITMAPINFO *) pbmih, DIB_RGB_COLORS)) {
+ ErrorF("winQueryScreenDIBFormat - Second call to GetDIBits "
+ "failed\n");
+ DeleteObject(hbmp);
+ return FALSE;
}
- /* Free memory */
- DeleteObject (hbmp);
-
- return TRUE;
-}
+ /* Free memory */
+ DeleteObject(hbmp);
+ return TRUE;
+}
/*
* Internal function to determine the GDI bits per rgb and bit masks
*/
static
-Bool
-winQueryRGBBitsAndMasks (ScreenPtr pScreen)
+ Bool
+winQueryRGBBitsAndMasks(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- BITMAPINFOHEADER *pbmih = NULL;
- Bool fReturn = TRUE;
- LPDWORD pdw = NULL;
- DWORD dwRedBits, dwGreenBits, dwBlueBits;
-
- /* Color masks for 8 bpp are standardized */
- if (GetDeviceCaps (pScreenPriv->hdcScreen, RASTERCAPS) & RC_PALETTE)
- {
- /*
- * RGB BPP for 8 bit palletes is always 8
- * and the color masks are always 0.
- */
- pScreenPriv->dwBitsPerRGB = 8;
- pScreenPriv->dwRedMask = 0x0L;
- pScreenPriv->dwGreenMask = 0x0L;
- pScreenPriv->dwBlueMask = 0x0L;
- return TRUE;
+ winScreenPriv(pScreen);
+ BITMAPINFOHEADER *pbmih = NULL;
+ Bool fReturn = TRUE;
+ LPDWORD pdw = NULL;
+ DWORD dwRedBits, dwGreenBits, dwBlueBits;
+
+ /* Color masks for 8 bpp are standardized */
+ if (GetDeviceCaps(pScreenPriv->hdcScreen, RASTERCAPS) & RC_PALETTE) {
+ /*
+ * RGB BPP for 8 bit palletes is always 8
+ * and the color masks are always 0.
+ */
+ pScreenPriv->dwBitsPerRGB = 8;
+ pScreenPriv->dwRedMask = 0x0L;
+ pScreenPriv->dwGreenMask = 0x0L;
+ pScreenPriv->dwBlueMask = 0x0L;
+ return TRUE;
}
- /* Color masks for 24 bpp are standardized */
- if (GetDeviceCaps (pScreenPriv->hdcScreen, PLANES)
- * GetDeviceCaps (pScreenPriv->hdcScreen, BITSPIXEL) == 24)
- {
- winDebug ("winQueryRGBBitsAndMasks - GetDeviceCaps (BITSPIXEL) "
- "returned 24 for the screen. Using default 24bpp masks.\n");
-
- /* 8 bits per primary color */
- pScreenPriv->dwBitsPerRGB = 8;
-
- /* Set screen privates masks */
- pScreenPriv->dwRedMask = WIN_24BPP_MASK_RED;
- pScreenPriv->dwGreenMask = WIN_24BPP_MASK_GREEN;
- pScreenPriv->dwBlueMask = WIN_24BPP_MASK_BLUE;
-
- return TRUE;
+ /* Color masks for 24 bpp are standardized */
+ if (GetDeviceCaps(pScreenPriv->hdcScreen, PLANES)
+ * GetDeviceCaps(pScreenPriv->hdcScreen, BITSPIXEL) == 24) {
+ winDebug ("winQueryRGBBitsAndMasks - GetDeviceCaps (BITSPIXEL) "
+ "returned 24 for the screen. Using default 24bpp masks.\n");
+
+ /* 8 bits per primary color */
+ pScreenPriv->dwBitsPerRGB = 8;
+
+ /* Set screen privates masks */
+ pScreenPriv->dwRedMask = WIN_24BPP_MASK_RED;
+ pScreenPriv->dwGreenMask = WIN_24BPP_MASK_GREEN;
+ pScreenPriv->dwBlueMask = WIN_24BPP_MASK_BLUE;
+
+ return TRUE;
}
- /* Allocate a bitmap header and color table */
- pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
- + 256 * sizeof (RGBQUAD));
- if (pbmih == NULL)
- {
- ErrorF ("winQueryRGBBitsAndMasks - malloc failed\n");
- return FALSE;
+ /* Allocate a bitmap header and color table */
+ pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER)
+ + 256 * sizeof(RGBQUAD));
+ if (pbmih == NULL) {
+ ErrorF("winQueryRGBBitsAndMasks - malloc failed\n");
+ return FALSE;
}
- /* Get screen description */
- if (winQueryScreenDIBFormat (pScreen, pbmih))
- {
- /* Get a pointer to bitfields */
- pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER));
-
+ /* Get screen description */
+ if (winQueryScreenDIBFormat(pScreen, pbmih)) {
+ /* Get a pointer to bitfields */
+ pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER));
+
#ifdef WINDBG
- winDebug ("%s - Masks: %08x %08x %08x\n", __FUNCTION__,
- pdw[0], pdw[1], pdw[2]);
- winDebug ("%s - Bitmap: %dx%d %d bpp %d planes\n", __FUNCTION__,
- pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount, pbmih->biPlanes);
- winDebug ("%s - Compression: %d %s\n", __FUNCTION__,
- pbmih->biCompression,
- (pbmih->biCompression == BI_RGB?"(BI_RGB)":
- (pbmih->biCompression == BI_RLE8?"(BI_RLE8)":
- (pbmih->biCompression == BI_RLE4?"(BI_RLE4)":
- (pbmih->biCompression == BI_BITFIELDS?"(BI_BITFIELDS)":""
- )))));
+ winDebug("%s - Masks: %08x %08x %08x\n", __FUNCTION__,
+ pdw[0], pdw[1], pdw[2]);
+ winDebug("%s - Bitmap: %dx%d %d bpp %d planes\n", __FUNCTION__,
+ pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount,
+ pbmih->biPlanes);
+ winDebug("%s - Compression: %d %s\n", __FUNCTION__,
+ pbmih->biCompression,
+ (pbmih->biCompression ==
+ BI_RGB ? "(BI_RGB)" : (pbmih->biCompression ==
+ BI_RLE8 ? "(BI_RLE8)" : (pbmih->
+ biCompression
+ ==
+ BI_RLE4 ?
+ "(BI_RLE4)"
+ : (pbmih->
+ biCompression
+ ==
+ BI_BITFIELDS
+ ?
+ "(BI_BITFIELDS)"
+ : "")))));
#endif
- /* Handle BI_RGB case, which is returned by Wine */
- if (pbmih->biCompression == BI_RGB)
- {
- dwRedBits = 5;
- dwGreenBits = 5;
- dwBlueBits = 5;
-
- pScreenPriv->dwBitsPerRGB = 5;
-
- /* Set screen privates masks */
- pScreenPriv->dwRedMask = 0x7c00;
- pScreenPriv->dwGreenMask = 0x03e0;
- pScreenPriv->dwBlueMask = 0x001f;
+ /* Handle BI_RGB case, which is returned by Wine */
+ if (pbmih->biCompression == BI_RGB) {
+ dwRedBits = 5;
+ dwGreenBits = 5;
+ dwBlueBits = 5;
+
+ pScreenPriv->dwBitsPerRGB = 5;
+
+ /* Set screen privates masks */
+ pScreenPriv->dwRedMask = 0x7c00;
+ pScreenPriv->dwGreenMask = 0x03e0;
+ pScreenPriv->dwBlueMask = 0x001f;
+ }
+ else {
+ /* Count the number of bits in each mask */
+ dwRedBits = winCountBits(pdw[0]);
+ dwGreenBits = winCountBits(pdw[1]);
+ dwBlueBits = winCountBits(pdw[2]);
+
+ /* Find maximum bits per red, green, blue */
+ if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwRedBits;
+ else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwGreenBits;
+ else
+ pScreenPriv->dwBitsPerRGB = dwBlueBits;
+
+ /* Set screen privates masks */
+ pScreenPriv->dwRedMask = pdw[0];
+ pScreenPriv->dwGreenMask = pdw[1];
+ pScreenPriv->dwBlueMask = pdw[2];
}
- else
- {
- /* Count the number of bits in each mask */
- dwRedBits = winCountBits (pdw[0]);
- dwGreenBits = winCountBits (pdw[1]);
- dwBlueBits = winCountBits (pdw[2]);
-
- /* Find maximum bits per red, green, blue */
- if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwRedBits;
- else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwGreenBits;
- else
- pScreenPriv->dwBitsPerRGB = dwBlueBits;
-
- /* Set screen privates masks */
- pScreenPriv->dwRedMask = pdw[0];
- pScreenPriv->dwGreenMask = pdw[1];
- pScreenPriv->dwBlueMask = pdw[2];
- }
}
- else
- {
- ErrorF ("winQueryRGBBitsAndMasks - winQueryScreenDIBFormat failed\n");
- fReturn = FALSE;
+ else {
+ ErrorF("winQueryRGBBitsAndMasks - winQueryScreenDIBFormat failed\n");
+ fReturn = FALSE;
}
- /* Free memory */
- free (pbmih);
+ /* Free memory */
+ free(pbmih);
- return fReturn;
+ return fReturn;
}
-
#ifdef XWIN_MULTIWINDOW
/*
* Redraw all ---?
*/
static wBOOL CALLBACK
-winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam)
+winRedrawAllProcShadowGDI(HWND hwnd, LPARAM lParam)
{
- if (hwnd == (HWND)lParam)
- return TRUE;
- InvalidateRect (hwnd, NULL, FALSE);
- UpdateWindow (hwnd);
- return TRUE;
+ if (hwnd == (HWND) lParam)
+ return TRUE;
+ InvalidateRect(hwnd, NULL, FALSE);
+ UpdateWindow(hwnd);
+ return TRUE;
}
static wBOOL CALLBACK
-winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam)
+winRedrawDamagedWindowShadowGDI(HWND hwnd, LPARAM lParam)
{
- BoxPtr pDamage = (BoxPtr)lParam;
- RECT rcClient, rcDamage, rcRedraw;
- POINT topLeft, bottomRight;
-
- if (IsIconic (hwnd))
- return TRUE; /* Don't care minimized windows */
-
- /* Convert the damaged area from Screen coords to Client coords */
- topLeft.x = pDamage->x1; topLeft.y = pDamage->y1;
- bottomRight.x = pDamage->x2; bottomRight.y = pDamage->y2;
- topLeft.x += GetSystemMetrics (SM_XVIRTUALSCREEN);
- bottomRight.x += GetSystemMetrics (SM_XVIRTUALSCREEN);
- topLeft.y += GetSystemMetrics (SM_YVIRTUALSCREEN);
- bottomRight.y += GetSystemMetrics (SM_YVIRTUALSCREEN);
- ScreenToClient (hwnd, &topLeft);
- ScreenToClient (hwnd, &bottomRight);
- SetRect (&rcDamage, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y);
-
- GetClientRect (hwnd, &rcClient);
-
- if (IntersectRect (&rcRedraw, &rcClient, &rcDamage))
- {
- InvalidateRect (hwnd, &rcRedraw, FALSE);
- UpdateWindow (hwnd);
+ BoxPtr pDamage = (BoxPtr) lParam;
+ RECT rcClient, rcDamage, rcRedraw;
+ POINT topLeft, bottomRight;
+
+ if (IsIconic(hwnd))
+ return TRUE; /* Don't care minimized windows */
+
+ /* Convert the damaged area from Screen coords to Client coords */
+ topLeft.x = pDamage->x1;
+ topLeft.y = pDamage->y1;
+ bottomRight.x = pDamage->x2;
+ bottomRight.y = pDamage->y2;
+ topLeft.x += GetSystemMetrics(SM_XVIRTUALSCREEN);
+ bottomRight.x += GetSystemMetrics(SM_XVIRTUALSCREEN);
+ topLeft.y += GetSystemMetrics(SM_YVIRTUALSCREEN);
+ bottomRight.y += GetSystemMetrics(SM_YVIRTUALSCREEN);
+ ScreenToClient(hwnd, &topLeft);
+ ScreenToClient(hwnd, &bottomRight);
+ SetRect(&rcDamage, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y);
+
+ GetClientRect(hwnd, &rcClient);
+
+ if (IntersectRect(&rcRedraw, &rcClient, &rcDamage)) {
+ InvalidateRect(hwnd, &rcRedraw, FALSE);
+ UpdateWindow(hwnd);
}
- return TRUE;
+ return TRUE;
}
#endif
-
/*
* Allocate a DIB for the shadow framebuffer GDI server
*/
static Bool
-winAllocateFBShadowGDI (ScreenPtr pScreen)
+winAllocateFBShadowGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- DIBSECTION dibsection;
- Bool fReturn = TRUE;
-
- /* Describe shadow bitmap to be created */
- pScreenPriv->pbmih->biWidth = pScreenInfo->dwWidth;
- pScreenPriv->pbmih->biHeight = -pScreenInfo->dwHeight;
-
- winDebug ("winAllocateFBShadowGDI - Creating DIB with width: %d height: %d "
- "depth: %d\n",
- (int) pScreenPriv->pbmih->biWidth, (int) -pScreenPriv->pbmih->biHeight, pScreenPriv->pbmih->biBitCount);
-
- /* Create a DI shadow bitmap with a bit pointer */
- pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen,
- (BITMAPINFO *) pScreenPriv->pbmih,
- DIB_RGB_COLORS,
- (VOID**) &pScreenInfo->pfb,
- NULL,
- 0);
- if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL)
- {
- winW32Error ("winAllocateFBShadowGDI - CreateDIBSection failed:");
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ DIBSECTION dibsection;
+ Bool fReturn = TRUE;
+
+ /* Describe shadow bitmap to be created */
+ pScreenPriv->pbmih->biWidth = pScreenInfo->dwWidth;
+ pScreenPriv->pbmih->biHeight = -pScreenInfo->dwHeight;
+
+ winDebug ("winAllocateFBShadowGDI - Creating DIB with width: %d height: %d "
+ "depth: %d\n",
+ (int) pScreenPriv->pbmih->biWidth,
+ (int) -pScreenPriv->pbmih->biHeight, pScreenPriv->pbmih->biBitCount);
+
+ /* Create a DI shadow bitmap with a bit pointer */
+ pScreenPriv->hbmpShadow = CreateDIBSection(pScreenPriv->hdcScreen,
+ (BITMAPINFO *) pScreenPriv->
+ pbmih, DIB_RGB_COLORS,
+ (VOID **) & pScreenInfo->pfb,
+ NULL, 0);
+ if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL) {
+ winW32Error ("winAllocateFBShadowGDI - CreateDIBSection failed:");
+ return FALSE;
}
- else
- {
- winDebug ("winAllocateFBShadowGDI - Shadow buffer allocated\n");
+ else {
+ winDebug("winAllocateFBShadowGDI - Shadow buffer allocated\n");
}
- /* Get information about the bitmap that was allocated */
- GetObject (pScreenPriv->hbmpShadow,
- sizeof (dibsection),
- &dibsection);
-
- /* Print information about bitmap allocated */
- winDebug ("winAllocateFBShadowGDI - Dibsection width: %d height: %d "
- "depth: %d size image: %d\n",
- (int) dibsection.dsBmih.biWidth, (int) dibsection.dsBmih.biHeight,
- dibsection.dsBmih.biBitCount,
- (int) dibsection.dsBmih.biSizeImage);
-
- /* Select the shadow bitmap into the shadow DC */
- SelectObject (pScreenPriv->hdcShadow,
- pScreenPriv->hbmpShadow);
-
- winDebug ("winAllocateFBShadowGDI - Attempting a shadow blit\n");
-
- /* Do a test blit from the shadow to the screen, I think */
- fReturn = BitBlt (pScreenPriv->hdcScreen,
- 0, 0,
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- pScreenPriv->hdcShadow,
- 0, 0,
- SRCCOPY);
- if (fReturn)
- {
- winDebug ("winAllocateFBShadowGDI - Shadow blit success\n");
+ /* Get information about the bitmap that was allocated */
+ GetObject(pScreenPriv->hbmpShadow, sizeof(dibsection), &dibsection);
+
+ /* Print information about bitmap allocated */
+ winDebug("winAllocateFBShadowGDI - Dibsection width: %d height: %d "
+ "depth: %d size image: %d\n",
+ (int) dibsection.dsBmih.biWidth, (int) dibsection.dsBmih.biHeight,
+ dibsection.dsBmih.biBitCount, (int) dibsection.dsBmih.biSizeImage);
+
+ /* Select the shadow bitmap into the shadow DC */
+ SelectObject(pScreenPriv->hdcShadow, pScreenPriv->hbmpShadow);
+
+ winDebug("winAllocateFBShadowGDI - Attempting a shadow blit\n");
+
+ /* Do a test blit from the shadow to the screen, I think */
+ fReturn = BitBlt(pScreenPriv->hdcScreen,
+ 0, 0,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ pScreenPriv->hdcShadow, 0, 0, SRCCOPY);
+ if (fReturn) {
+ winDebug("winAllocateFBShadowGDI - Shadow blit success\n");
}
- else
- {
- winW32Error ("winAllocateFBShadowGDI - Shadow blit failure\n");
- /* ago: ignore this error. The blit fails with wine, but does not
- * cause any problems later. */
+ else {
+ winW32Error ("winAllocateFBShadowGDI - Shadow blit failure\n");
+ /* ago: ignore this error. The blit fails with wine, but does not
+ * cause any problems later. */
- fReturn = TRUE;
+ fReturn = TRUE;
}
- /* Look for height weirdness */
- if (dibsection.dsBmih.biHeight < 0)
- {
- dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight;
+ /* Look for height weirdness */
+ if (dibsection.dsBmih.biHeight < 0) {
+ dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight;
}
- /* Set screeninfo stride */
- pScreenInfo->dwStride = ((dibsection.dsBmih.biSizeImage
- / dibsection.dsBmih.biHeight)
- * 8) / pScreenInfo->dwBPP;
+ /* Set screeninfo stride */
+ pScreenInfo->dwStride = ((dibsection.dsBmih.biSizeImage
+ / dibsection.dsBmih.biHeight)
+ * 8) / pScreenInfo->dwBPP;
- winDebug ("winAllocateFBShadowGDI - Created shadow stride: %d\n",
- (int) pScreenInfo->dwStride);
+ winDebug("winAllocateFBShadowGDI - Created shadow stride: %d\n",
+ (int) pScreenInfo->dwStride);
#ifdef XWIN_MULTIWINDOW
- /* Redraw all windows */
- if (pScreenInfo->fMultiWindow)
- EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
+ /* Redraw all windows */
+ if (pScreenInfo->fMultiWindow)
+ EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
#endif
- return fReturn;
+ return fReturn;
}
static void
-winFreeFBShadowGDI (ScreenPtr pScreen)
+winFreeFBShadowGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- /* Free the shadow bitmap */
- DeleteObject (pScreenPriv->hbmpShadow);
+ /* Free the shadow bitmap */
+ DeleteObject(pScreenPriv->hbmpShadow);
- /* Invalidate the ScreenInfo's fb pointer */
- pScreenInfo->pfb = NULL;
+ /* Invalidate the ScreenInfo's fb pointer */
+ pScreenInfo->pfb = NULL;
}
/*
@@ -444,160 +416,146 @@ winFreeFBShadowGDI (ScreenPtr pScreen)
*/
static void
-winShadowUpdateGDI (ScreenPtr pScreen,
- shadowBufPtr pBuf)
+winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RegionPtr damage = shadowDamage(pBuf);
- DWORD dwBox = RegionNumRects (damage);
- BoxPtr pBox = RegionRects (damage);
- int x, y, w, h;
- HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RegionPtr damage = shadowDamage(pBuf);
+ DWORD dwBox = RegionNumRects(damage);
+ BoxPtr pBox = RegionRects(damage);
+ int x, y, w, h;
+ HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+
#ifdef XWIN_UPDATESTATS
- static DWORD s_dwNonUnitRegions = 0;
- static DWORD s_dwTotalUpdates = 0;
- static DWORD s_dwTotalBoxes = 0;
+ static DWORD s_dwNonUnitRegions = 0;
+ static DWORD s_dwTotalUpdates = 0;
+ static DWORD s_dwTotalBoxes = 0;
#endif
- BoxPtr pBoxExtents = RegionExtents(damage);
+ BoxPtr pBoxExtents = RegionExtents(damage);
- /*
- * Return immediately if the app is not active
- * and we are fullscreen, or if we have a bad display depth
- */
- if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
- || pScreenPriv->fBadDepth) return;
+ /*
+ * Return immediately if the app is not active
+ * and we are fullscreen, or if we have a bad display depth
+ */
+ if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
+ || pScreenPriv->fBadDepth)
+ return;
#ifdef XWIN_UPDATESTATS
- ++s_dwTotalUpdates;
- s_dwTotalBoxes += dwBox;
+ ++s_dwTotalUpdates;
+ s_dwTotalBoxes += dwBox;
- if (dwBox != 1)
- {
- ++s_dwNonUnitRegions;
- winDebug ("winShadowUpdatGDI - dwBox: %d\n", dwBox);
+ if (dwBox != 1) {
+ ++s_dwNonUnitRegions;
+ winDebug ("winShadowUpdatGDI - dwBox: %d\n", dwBox);
}
-
- if ((s_dwTotalUpdates % 100) == 0)
- {
- winDebug ("winShadowUpdateGDI - %d%% non-unity regions, avg boxes: %d "
- "nu: %d tu: %d\n",
- (s_dwNonUnitRegions * 100) / s_dwTotalUpdates,
- s_dwTotalBoxes / s_dwTotalUpdates,
- s_dwNonUnitRegions, s_dwTotalUpdates);
+
+ if ((s_dwTotalUpdates % 100) == 0)
+ winDebug ("winShadowUpdateGDI - %d%% non-unity regions, avg boxes: %d "
+ "nu: %d tu: %d\n",
+ (s_dwNonUnitRegions * 100) / s_dwTotalUpdates,
+ s_dwTotalBoxes / s_dwTotalUpdates,
+ s_dwNonUnitRegions, s_dwTotalUpdates);
}
-#endif /* XWIN_UPDATESTATS */
-
- /*
- * Handle small regions with multiple blits,
- * handle large regions by creating a clipping region and
- * doing a single blit constrained to that clipping region.
- */
- if (!pScreenInfo->fMultiWindow &&
- (pScreenInfo->dwClipUpdatesNBoxes == 0 ||
- dwBox < pScreenInfo->dwClipUpdatesNBoxes))
- {
- /* Loop through all boxes in the damaged region */
- while (dwBox--)
- {
- /*
- * Calculate x offset, y offset, width, and height for
- * current damage box
- */
- x = pBox->x1;
- y = pBox->y1;
- w = pBox->x2 - pBox->x1;
- h = pBox->y2 - pBox->y1;
-
- BitBlt (pScreenPriv->hdcScreen,
- x, y,
- w, h,
- pScreenPriv->hdcShadow,
- x, y,
- SRCCOPY);
-
- /* Get a pointer to the next box */
- ++pBox;
- }
+#endif /* XWIN_UPDATESTATS */
+
+ /*
+ * Handle small regions with multiple blits,
+ * handle large regions by creating a clipping region and
+ * doing a single blit constrained to that clipping region.
+ */
+ if (!pScreenInfo->fMultiWindow &&
+ (pScreenInfo->dwClipUpdatesNBoxes == 0 ||
+ dwBox < pScreenInfo->dwClipUpdatesNBoxes)) {
+ /* Loop through all boxes in the damaged region */
+ while (dwBox--) {
+ /*
+ * Calculate x offset, y offset, width, and height for
+ * current damage box
+ */
+ x = pBox->x1;
+ y = pBox->y1;
+ w = pBox->x2 - pBox->x1;
+ h = pBox->y2 - pBox->y1;
+
+ BitBlt(pScreenPriv->hdcScreen,
+ x, y, w, h, pScreenPriv->hdcShadow, x, y, SRCCOPY);
+
+ /* Get a pointer to the next box */
+ ++pBox;
+ }
}
- else if (!pScreenInfo->fMultiWindow)
- {
- /* Compute a GDI region from the damaged region */
- hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
- dwBox--;
- pBox++;
- while (dwBox--)
- {
- hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
- CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
- DeleteObject (hrgnTemp);
- pBox++;
- }
-
- /* Install the GDI region as a clipping region */
- SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined);
- DeleteObject (hrgnCombined);
- hrgnCombined = NULL;
-
- /*
- * Blit the shadow buffer to the screen,
- * constrained to the clipping region.
- */
- BitBlt (pScreenPriv->hdcScreen,
- pBoxExtents->x1, pBoxExtents->y1,
- pBoxExtents->x2 - pBoxExtents->x1,
- pBoxExtents->y2 - pBoxExtents->y1,
- pScreenPriv->hdcShadow,
- pBoxExtents->x1, pBoxExtents->y1,
- SRCCOPY);
-
- /* Reset the clip region */
- SelectClipRgn (pScreenPriv->hdcScreen, NULL);
+ else if (!pScreenInfo->fMultiWindow) {
+ /* Compute a GDI region from the damaged region */
+ hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ dwBox--;
+ pBox++;
+ while (dwBox--) {
+ hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
+ DeleteObject(hrgnTemp);
+ pBox++;
+ }
+
+ /* Install the GDI region as a clipping region */
+ SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);
+ DeleteObject(hrgnCombined);
+ hrgnCombined = NULL;
+
+ /*
+ * Blit the shadow buffer to the screen,
+ * constrained to the clipping region.
+ */
+ BitBlt(pScreenPriv->hdcScreen,
+ pBoxExtents->x1, pBoxExtents->y1,
+ pBoxExtents->x2 - pBoxExtents->x1,
+ pBoxExtents->y2 - pBoxExtents->y1,
+ pScreenPriv->hdcShadow,
+ pBoxExtents->x1, pBoxExtents->y1, SRCCOPY);
+
+ /* Reset the clip region */
+ SelectClipRgn(pScreenPriv->hdcScreen, NULL);
}
#ifdef XWIN_MULTIWINDOW
- /* Redraw all multiwindow windows */
- if (pScreenInfo->fMultiWindow)
- EnumThreadWindows (g_dwCurrentThreadID,
- winRedrawDamagedWindowShadowGDI,
- (LPARAM)pBoxExtents);
+ /* Redraw all multiwindow windows */
+ if (pScreenInfo->fMultiWindow)
+ EnumThreadWindows(g_dwCurrentThreadID,
+ winRedrawDamagedWindowShadowGDI,
+ (LPARAM) pBoxExtents);
#endif
}
-
static Bool
-winInitScreenShadowGDI (ScreenPtr pScreen)
+winInitScreenShadowGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
-
- /* Get device contexts for the screen and shadow bitmap */
- pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
- pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen);
-
- /* Allocate bitmap info header */
- pScreenPriv->pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
- + 256 * sizeof (RGBQUAD));
- if (pScreenPriv->pbmih == NULL)
- {
- ErrorF ("winInitScreenShadowGDI - malloc () failed\n");
- return FALSE;
+ winScreenPriv(pScreen);
+
+ /* Get device contexts for the screen and shadow bitmap */
+ pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen);
+ pScreenPriv->hdcShadow = CreateCompatibleDC(pScreenPriv->hdcScreen);
+
+ /* Allocate bitmap info header */
+ pScreenPriv->pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER)
+ + 256 * sizeof(RGBQUAD));
+ if (pScreenPriv->pbmih == NULL) {
+ ErrorF("winInitScreenShadowGDI - malloc () failed\n");
+ return FALSE;
}
- /* Query the screen format */
- if (!winQueryScreenDIBFormat (pScreen, pScreenPriv->pbmih))
- {
- ErrorF ("winInitScreenShadowGDI - winQueryScreenDIBFormat failed\n");
- return FALSE;
+ /* Query the screen format */
+ if (!winQueryScreenDIBFormat(pScreen, pScreenPriv->pbmih)) {
+ ErrorF("winInitScreenShadowGDI - winQueryScreenDIBFormat failed\n");
+ return FALSE;
}
- /* Determine our color masks */
- if (!winQueryRGBBitsAndMasks (pScreen))
- {
- ErrorF ("winInitScreenShadowGDI - winQueryRGBBitsAndMasks failed\n");
- return FALSE;
+ /* Determine our color masks */
+ if (!winQueryRGBBitsAndMasks(pScreen)) {
+ ErrorF("winInitScreenShadowGDI - winQueryRGBBitsAndMasks failed\n");
+ return FALSE;
}
- return winAllocateFBShadowGDI(pScreen);
+ return winAllocateFBShadowGDI(pScreen);
}
/* See Porting Layer Definition - p. 33 */
@@ -607,67 +565,64 @@ winInitScreenShadowGDI (ScreenPtr pScreen)
*/
static Bool
-winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
+winCloseScreenShadowGDI(int nIndex, ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- Bool fReturn;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ Bool fReturn;
- winDebug ("winCloseScreenShadowGDI - Freeing screen resources\n");
+ winDebug("winCloseScreenShadowGDI - Freeing screen resources\n");
- /* Flag that the screen is closed */
- pScreenPriv->fClosed = TRUE;
- pScreenPriv->fActive = FALSE;
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
- /* Call the wrapped CloseScreen procedure */
- WIN_UNWRAP(CloseScreen);
- if (pScreen->CloseScreen)
- fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+ /* Call the wrapped CloseScreen procedure */
+ WIN_UNWRAP(CloseScreen);
+ if (pScreen->CloseScreen)
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
- /* Delete the window property */
- RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
+ /* Delete the window property */
+ RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
- /* Free the shadow DC; which allows the bitmap to be freed */
- DeleteDC (pScreenPriv->hdcShadow);
+ /* Free the shadow DC; which allows the bitmap to be freed */
+ DeleteDC(pScreenPriv->hdcShadow);
- winFreeFBShadowGDI(pScreen);
+ winFreeFBShadowGDI(pScreen);
- /* Free the screen DC */
- ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
+ /* Free the screen DC */
+ ReleaseDC(pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
- /* Delete tray icon, if we have one */
- if (!pScreenInfo->fNoTrayIcon)
- winDeleteNotifyIcon (pScreenPriv);
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon(pScreenPriv);
- /* Free the exit confirmation dialog box, if it exists */
- if (g_hDlgExit != NULL)
- {
- DestroyWindow (g_hDlgExit);
- g_hDlgExit = NULL;
+ /* Free the exit confirmation dialog box, if it exists */
+ if (g_hDlgExit != NULL) {
+ DestroyWindow(g_hDlgExit);
+ g_hDlgExit = NULL;
}
- /* Kill our window */
- if (pScreenPriv->hwndScreen)
- {
- DestroyWindow (pScreenPriv->hwndScreen);
- pScreenPriv->hwndScreen = NULL;
+ /* Kill our window */
+ if (pScreenPriv->hwndScreen) {
+ DestroyWindow(pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
}
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Destroy the thread startup mutex */
- if (pScreenPriv->pmServerStarted) pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
+ /* Destroy the thread startup mutex */
+ if (pScreenPriv->pmServerStarted) pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
#endif
- /* Invalidate our screeninfo's pointer to the screen */
- pScreenInfo->pScreen = NULL;
+ /* Invalidate our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
- /* Free the screen privates for this screen */
- free ((pointer) pScreenPriv);
+ /* Free the screen privates for this screen */
+ free((pointer) pScreenPriv);
- return fReturn;
+ return fReturn;
}
-
/*
* Tell mi what sort of visuals we need.
*
@@ -677,561 +632,510 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
*/
static Bool
-winInitVisualsShadowGDI (ScreenPtr pScreen)
+winInitVisualsShadowGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Display debugging information */
- winDebug ("winInitVisualsShadowGDI - Masks %08x %08x %08x BPRGB %d d %d "
- "bpp %d\n",
- (unsigned int) pScreenPriv->dwRedMask,
- (unsigned int) pScreenPriv->dwGreenMask,
- (unsigned int) pScreenPriv->dwBlueMask,
- (int) pScreenPriv->dwBitsPerRGB,
- (int) pScreenInfo->dwDepth,
- (int) pScreenInfo->dwBPP);
-
- /* Create a single visual according to the Windows screen depth */
- switch (pScreenInfo->dwDepth)
- {
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Display debugging information */
+ winDebug ("winInitVisualsShadowGDI - Masks %08x %08x %08x BPRGB %d d %d "
+ "bpp %d\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask,
+ (int) pScreenPriv->dwBitsPerRGB,
+ (int) pScreenInfo->dwDepth, (int) pScreenInfo->dwBPP);
+
+ /* Create a single visual according to the Windows screen depth */
+ switch (pScreenInfo->dwDepth) {
case 24:
case 16:
case 15:
- /* Setup the real visual */
- if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
- TrueColorMask,
- pScreenPriv->dwBitsPerRGB,
- -1,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask))
- {
- ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks "
- "failed\n");
- return FALSE;
- }
+ /* Setup the real visual */
+ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ -1,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask)) {
+ ErrorF("winInitVisualsShadowGDI - miSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
#ifdef XWIN_EMULATEPSEUDO
- if (!pScreenInfo->fEmulatePseudo)
- break;
-
- /* Setup a pseudocolor visual */
- if (!miSetVisualTypesAndMasks (8,
- PseudoColorMask,
- 8,
- -1,
- 0,
- 0,
- 0))
- {
- ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks "
- "failed for PseudoColor\n");
- return FALSE;
- }
+ if (!pScreenInfo->fEmulatePseudo)
+ break;
+
+ /* Setup a pseudocolor visual */
+ if (!miSetVisualTypesAndMasks(8, PseudoColorMask, 8, -1, 0, 0, 0)) {
+ ErrorF("winInitVisualsShadowGDI - miSetVisualTypesAndMasks "
+ "failed for PseudoColor\n");
+ return FALSE;
+ }
#endif
- break;
+ break;
case 8:
- if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
- PseudoColorMask,
- pScreenPriv->dwBitsPerRGB,
- PseudoColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask))
- {
- ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks "
- "failed\n");
- return FALSE;
- }
- break;
+ if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
+ PseudoColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ PseudoColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask)) {
+ ErrorF("winInitVisualsShadowGDI - miSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+ break;
default:
- ErrorF ("winInitVisualsShadowGDI - Unknown screen depth\n");
- return FALSE;
+ ErrorF("winInitVisualsShadowGDI - Unknown screen depth\n");
+ return FALSE;
}
- winDebug ("winInitVisualsShadowGDI - Returning\n");
+ winDebug("winInitVisualsShadowGDI - Returning\n");
- return TRUE;
+ return TRUE;
}
-
/*
* Adjust the proposed video mode
*/
static Bool
-winAdjustVideoModeShadowGDI (ScreenPtr pScreen)
+winAdjustVideoModeShadowGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HDC hdc;
- DWORD dwBPP;
-
- hdc = GetDC (NULL);
-
- /* We're in serious trouble if we can't get a DC */
- if (hdc == NULL)
- {
- ErrorF ("winAdjustVideoModeShadowGDI - GetDC () failed\n");
- return FALSE;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc;
+ DWORD dwBPP;
+
+ hdc = GetDC(NULL);
+
+ /* We're in serious trouble if we can't get a DC */
+ if (hdc == NULL) {
+ ErrorF("winAdjustVideoModeShadowGDI - GetDC () failed\n");
+ return FALSE;
}
- /* Query GDI for current display depth */
- dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
- /* GDI cannot change the screen depth, so always use GDI's depth */
- pScreenInfo->dwBPP = dwBPP;
+ /* GDI cannot change the screen depth, so always use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
- /* Release our DC */
- ReleaseDC (NULL, hdc);
- hdc = NULL;
+ /* Release our DC */
+ ReleaseDC(NULL, hdc);
+ hdc = NULL;
- return TRUE;
+ return TRUE;
}
-
/*
* Blt exposed regions to the screen
*/
static Bool
-winBltExposedRegionsShadowGDI (ScreenPtr pScreen)
+winBltExposedRegionsShadowGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- winPrivCmapPtr pCmapPriv = NULL;
- HDC hdcUpdate;
- PAINTSTRUCT ps;
-
- /* BeginPaint gives us an hdc that clips to the invalidated region */
- hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps);
-
- /* Realize the palette, if we have one */
- if (pScreenPriv->pcmapInstalled != NULL)
- {
- pCmapPriv = winGetCmapPriv (pScreenPriv->pcmapInstalled);
-
- SelectPalette (hdcUpdate, pCmapPriv->hPalette, FALSE);
- RealizePalette (hdcUpdate);
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ winPrivCmapPtr pCmapPriv = NULL;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint(pScreenPriv->hwndScreen, &ps);
+
+ /* Realize the palette, if we have one */
+ if (pScreenPriv->pcmapInstalled != NULL) {
+ pCmapPriv = winGetCmapPriv(pScreenPriv->pcmapInstalled);
+
+ SelectPalette(hdcUpdate, pCmapPriv->hPalette, FALSE);
+ RealizePalette(hdcUpdate);
}
- /* Our BitBlt will be clipped to the invalidated region */
- BitBlt (hdcUpdate,
- 0, 0,
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- pScreenPriv->hdcShadow,
- 0, 0,
- SRCCOPY);
+ /* Our BitBlt will be clipped to the invalidated region */
+ BitBlt(hdcUpdate,
+ 0, 0,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ pScreenPriv->hdcShadow, 0, 0, SRCCOPY);
- /* EndPaint frees the DC */
- EndPaint (pScreenPriv->hwndScreen, &ps);
+ /* EndPaint frees the DC */
+ EndPaint(pScreenPriv->hwndScreen, &ps);
#ifdef XWIN_MULTIWINDOW
- /* Redraw all windows */
- if (pScreenInfo->fMultiWindow)
- EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI,
- (LPARAM)pScreenPriv->hwndScreen);
+ /* Redraw all windows */
+ if (pScreenInfo->fMultiWindow)
+ EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI,
+ (LPARAM) pScreenPriv->hwndScreen);
#endif
- return TRUE;
+ return TRUE;
}
-
/*
* Do any engine-specific appliation-activation processing
*/
static Bool
-winActivateAppShadowGDI (ScreenPtr pScreen)
+winActivateAppShadowGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /*
- * 2004/04/12 - Harold - We perform the restoring or minimizing
- * manually for ShadowGDI in fullscreen modes so that this engine
- * will perform just like ShadowDD and ShadowDDNL in fullscreen mode;
- * if we do not do this then our fullscreen window will appear in the
- * z-order when it is deactivated and it can be uncovered by resizing
- * or minimizing another window that is on top of it, which is not how
- * the DirectDraw engines work. Therefore we keep this code here to
- * make sure that all engines work the same in fullscreen mode.
- */
-
- /*
- * Are we active?
- * Are we fullscreen?
- */
- if (pScreenPriv->fActive
- && pScreenInfo->fFullScreen)
- {
- /*
- * Activating, attempt to bring our window
- * to the top of the display
- */
- ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE);
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /*
+ * 2004/04/12 - Harold - We perform the restoring or minimizing
+ * manually for ShadowGDI in fullscreen modes so that this engine
+ * will perform just like ShadowDD and ShadowDDNL in fullscreen mode;
+ * if we do not do this then our fullscreen window will appear in the
+ * z-order when it is deactivated and it can be uncovered by resizing
+ * or minimizing another window that is on top of it, which is not how
+ * the DirectDraw engines work. Therefore we keep this code here to
+ * make sure that all engines work the same in fullscreen mode.
+ */
+
+ /*
+ * Are we active?
+ * Are we fullscreen?
+ */
+ if (pScreenPriv->fActive && pScreenInfo->fFullScreen) {
+ /*
+ * Activating, attempt to bring our window
+ * to the top of the display
+ */
+ ShowWindow(pScreenPriv->hwndScreen, SW_RESTORE);
}
- else if (!pScreenPriv->fActive
- && pScreenInfo->fFullScreen)
- {
- /*
- * Deactivating, stuff our window onto the
- * task bar.
- */
- ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE);
+ else if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) {
+ /*
+ * Deactivating, stuff our window onto the
+ * task bar.
+ */
+ ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE);
}
- return TRUE;
+ return TRUE;
}
-
/*
* Reblit the shadow framebuffer to the screen.
*/
static Bool
-winRedrawScreenShadowGDI (ScreenPtr pScreen)
+winRedrawScreenShadowGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- /* Redraw the whole window, to take account for the new colors */
- BitBlt (pScreenPriv->hdcScreen,
- 0, 0,
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- pScreenPriv->hdcShadow,
- 0, 0,
- SRCCOPY);
+ /* Redraw the whole window, to take account for the new colors */
+ BitBlt(pScreenPriv->hdcScreen,
+ 0, 0,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ pScreenPriv->hdcShadow, 0, 0, SRCCOPY);
#ifdef XWIN_MULTIWINDOW
- /* Redraw all windows */
- if (pScreenInfo->fMultiWindow)
- EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
+ /* Redraw all windows */
+ if (pScreenInfo->fMultiWindow)
+ EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
#endif
- return TRUE;
+ return TRUE;
}
-
-
/*
* Realize the currently installed colormap
*/
static Bool
-winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen)
+winRealizeInstalledPaletteShadowGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winPrivCmapPtr pCmapPriv = NULL;
+ winScreenPriv(pScreen);
+ winPrivCmapPtr pCmapPriv = NULL;
- winDebug ("winRealizeInstalledPaletteShadowGDI\n");
+ winDebug("winRealizeInstalledPaletteShadowGDI\n");
- /* Don't do anything if there is not a colormap */
- if (pScreenPriv->pcmapInstalled == NULL)
- {
- winDebug ("winRealizeInstalledPaletteShadowGDI - No colormap "
- "installed\n");
- return TRUE;
+ /* Don't do anything if there is not a colormap */
+ if (pScreenPriv->pcmapInstalled == NULL) {
+ winDebug("winRealizeInstalledPaletteShadowGDI - No colormap "
+ "installed\n");
+ return TRUE;
}
- pCmapPriv = winGetCmapPriv (pScreenPriv->pcmapInstalled);
-
- /* Realize our palette for the screen */
- if (RealizePalette (pScreenPriv->hdcScreen) == GDI_ERROR)
- {
- ErrorF ("winRealizeInstalledPaletteShadowGDI - RealizePalette () "
- "failed\n");
- return FALSE;
+ pCmapPriv = winGetCmapPriv(pScreenPriv->pcmapInstalled);
+
+ /* Realize our palette for the screen */
+ if (RealizePalette(pScreenPriv->hdcScreen) == GDI_ERROR) {
+ ErrorF("winRealizeInstalledPaletteShadowGDI - RealizePalette () "
+ "failed\n");
+ return FALSE;
}
-
- /* Set the DIB color table */
- if (SetDIBColorTable (pScreenPriv->hdcShadow,
- 0,
- WIN_NUM_PALETTE_ENTRIES,
- pCmapPriv->rgbColors) == 0)
- {
- ErrorF ("winRealizeInstalledPaletteShadowGDI - SetDIBColorTable () "
- "failed\n");
- return FALSE;
+
+ /* Set the DIB color table */
+ if (SetDIBColorTable(pScreenPriv->hdcShadow,
+ 0,
+ WIN_NUM_PALETTE_ENTRIES, pCmapPriv->rgbColors) == 0) {
+ ErrorF("winRealizeInstalledPaletteShadowGDI - SetDIBColorTable () "
+ "failed\n");
+ return FALSE;
}
-
- return TRUE;
-}
+ return TRUE;
+}
/*
* Install the specified colormap
*/
static Bool
-winInstallColormapShadowGDI (ColormapPtr pColormap)
+winInstallColormapShadowGDI(ColormapPtr pColormap)
{
- ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- winCmapPriv(pColormap);
-
- /*
- * Tell Windows to install the new colormap
- */
- if (SelectPalette (pScreenPriv->hdcScreen,
- pCmapPriv->hPalette,
- FALSE) == NULL)
- {
- ErrorF ("winInstallColormapShadowGDI - SelectPalette () failed\n");
- return FALSE;
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ winCmapPriv(pColormap);
+
+ /*
+ * Tell Windows to install the new colormap
+ */
+ if (SelectPalette(pScreenPriv->hdcScreen,
+ pCmapPriv->hPalette, FALSE) == NULL) {
+ ErrorF("winInstallColormapShadowGDI - SelectPalette () failed\n");
+ return FALSE;
}
-
- /* Realize the palette */
- if (GDI_ERROR == RealizePalette (pScreenPriv->hdcScreen))
- {
- ErrorF ("winInstallColormapShadowGDI - RealizePalette () failed\n");
- return FALSE;
+
+ /* Realize the palette */
+ if (GDI_ERROR == RealizePalette(pScreenPriv->hdcScreen)) {
+ ErrorF("winInstallColormapShadowGDI - RealizePalette () failed\n");
+ return FALSE;
}
- /* Set the DIB color table */
- if (SetDIBColorTable (pScreenPriv->hdcShadow,
- 0,
- WIN_NUM_PALETTE_ENTRIES,
- pCmapPriv->rgbColors) == 0)
- {
- ErrorF ("winInstallColormapShadowGDI - SetDIBColorTable () failed\n");
- return FALSE;
+ /* Set the DIB color table */
+ if (SetDIBColorTable(pScreenPriv->hdcShadow,
+ 0,
+ WIN_NUM_PALETTE_ENTRIES, pCmapPriv->rgbColors) == 0) {
+ ErrorF("winInstallColormapShadowGDI - SetDIBColorTable () failed\n");
+ return FALSE;
}
- /* Redraw the whole window, to take account for the new colors */
- BitBlt (pScreenPriv->hdcScreen,
- 0, 0,
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- pScreenPriv->hdcShadow,
- 0, 0,
- SRCCOPY);
+ /* Redraw the whole window, to take account for the new colors */
+ BitBlt(pScreenPriv->hdcScreen,
+ 0, 0,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ pScreenPriv->hdcShadow, 0, 0, SRCCOPY);
- /* Save a pointer to the newly installed colormap */
- pScreenPriv->pcmapInstalled = pColormap;
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
#ifdef XWIN_MULTIWINDOW
- /* Redraw all windows */
- if (pScreenInfo->fMultiWindow)
- EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
+ /* Redraw all windows */
+ if (pScreenInfo->fMultiWindow)
+ EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
#endif
- return TRUE;
+ return TRUE;
}
-
/*
* Store the specified colors in the specified colormap
*/
static Bool
-winStoreColorsShadowGDI (ColormapPtr pColormap,
- int ndef,
- xColorItem *pdefs)
+winStoreColorsShadowGDI(ColormapPtr pColormap, int ndef, xColorItem * pdefs)
{
- ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
- ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
-
- /* Put the X colormap entries into the Windows logical palette */
- if (SetPaletteEntries (pCmapPriv->hPalette,
- pdefs[0].pixel,
- ndef,
- pCmapPriv->peColors + pdefs[0].pixel) == 0)
- {
- ErrorF ("winStoreColorsShadowGDI - SetPaletteEntries () failed\n");
- return FALSE;
+ ScreenPtr pScreen = pColormap->pScreen;
+
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
+
+ /* Put the X colormap entries into the Windows logical palette */
+ if (SetPaletteEntries(pCmapPriv->hPalette,
+ pdefs[0].pixel,
+ ndef, pCmapPriv->peColors + pdefs[0].pixel) == 0) {
+ ErrorF("winStoreColorsShadowGDI - SetPaletteEntries () failed\n");
+ return FALSE;
}
- /* Don't install the Windows palette if the colormap is not installed */
- if (pColormap != curpmap)
- {
- return TRUE;
+ /* Don't install the Windows palette if the colormap is not installed */
+ if (pColormap != curpmap) {
+ return TRUE;
}
- /* Try to install the newly modified colormap */
- if (!winInstallColormapShadowGDI (pColormap))
- {
- ErrorF ("winInstallColormapShadowGDI - winInstallColormapShadowGDI "
- "failed\n");
- return FALSE;
+ /* Try to install the newly modified colormap */
+ if (!winInstallColormapShadowGDI(pColormap)) {
+ ErrorF("winInstallColormapShadowGDI - winInstallColormapShadowGDI "
+ "failed\n");
+ return FALSE;
}
#if 0
- /* Tell Windows that the palette has changed */
- RealizePalette (pScreenPriv->hdcScreen);
-
- /* Set the DIB color table */
- if (SetDIBColorTable (pScreenPriv->hdcShadow,
- pdefs[0].pixel,
- ndef,
- pCmapPriv->rgbColors + pdefs[0].pixel) == 0)
- {
- ErrorF ("winInstallColormapShadowGDI - SetDIBColorTable () failed\n");
- return FALSE;
+ /* Tell Windows that the palette has changed */
+ RealizePalette(pScreenPriv->hdcScreen);
+
+ /* Set the DIB color table */
+ if (SetDIBColorTable(pScreenPriv->hdcShadow,
+ pdefs[0].pixel,
+ ndef, pCmapPriv->rgbColors + pdefs[0].pixel) == 0) {
+ ErrorF("winInstallColormapShadowGDI - SetDIBColorTable () failed\n");
+ return FALSE;
}
- /* Save a pointer to the newly installed colormap */
- pScreenPriv->pcmapInstalled = pColormap;
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
#endif
- return TRUE;
+ return TRUE;
}
-
/*
* Colormap initialization procedure
*/
static Bool
-winCreateColormapShadowGDI (ColormapPtr pColormap)
+winCreateColormapShadowGDI(ColormapPtr pColormap)
{
- LPLOGPALETTE lpPaletteNew = NULL;
- DWORD dwEntriesMax;
- VisualPtr pVisual;
- HPALETTE hpalNew = NULL;
- winCmapPriv(pColormap);
-
- /* Get a pointer to the visual that the colormap belongs to */
- pVisual = pColormap->pVisual;
-
- /* Get the maximum number of palette entries for this visual */
- dwEntriesMax = pVisual->ColormapEntries;
-
- /* Allocate a Windows logical color palette with max entries */
- lpPaletteNew = malloc (sizeof (LOGPALETTE)
- + (dwEntriesMax - 1) * sizeof (PALETTEENTRY));
- if (lpPaletteNew == NULL)
- {
- ErrorF ("winCreateColormapShadowGDI - Couldn't allocate palette "
- "with %d entries\n",
- (int) dwEntriesMax);
- return FALSE;
+ LPLOGPALETTE lpPaletteNew = NULL;
+ DWORD dwEntriesMax;
+ VisualPtr pVisual;
+ HPALETTE hpalNew = NULL;
+
+ winCmapPriv(pColormap);
+
+ /* Get a pointer to the visual that the colormap belongs to */
+ pVisual = pColormap->pVisual;
+
+ /* Get the maximum number of palette entries for this visual */
+ dwEntriesMax = pVisual->ColormapEntries;
+
+ /* Allocate a Windows logical color palette with max entries */
+ lpPaletteNew = malloc(sizeof(LOGPALETTE)
+ + (dwEntriesMax - 1) * sizeof(PALETTEENTRY));
+ if (lpPaletteNew == NULL) {
+ ErrorF("winCreateColormapShadowGDI - Couldn't allocate palette "
+ "with %d entries\n", (int) dwEntriesMax);
+ return FALSE;
}
- /* Zero out the colormap */
- ZeroMemory (lpPaletteNew, sizeof (LOGPALETTE)
- + (dwEntriesMax - 1) * sizeof (PALETTEENTRY));
-
- /* Set the logical palette structure */
- lpPaletteNew->palVersion = 0x0300;
- lpPaletteNew->palNumEntries = dwEntriesMax;
-
- /* Tell Windows to create the palette */
- hpalNew = CreatePalette (lpPaletteNew);
- if (hpalNew == NULL)
- {
- ErrorF ("winCreateColormapShadowGDI - CreatePalette () failed\n");
- free (lpPaletteNew);
- return FALSE;
+ /* Zero out the colormap */
+ ZeroMemory(lpPaletteNew, sizeof(LOGPALETTE)
+ + (dwEntriesMax - 1) * sizeof(PALETTEENTRY));
+
+ /* Set the logical palette structure */
+ lpPaletteNew->palVersion = 0x0300;
+ lpPaletteNew->palNumEntries = dwEntriesMax;
+
+ /* Tell Windows to create the palette */
+ hpalNew = CreatePalette(lpPaletteNew);
+ if (hpalNew == NULL) {
+ ErrorF("winCreateColormapShadowGDI - CreatePalette () failed\n");
+ free(lpPaletteNew);
+ return FALSE;
}
- /* Save the Windows logical palette handle in the X colormaps' privates */
- pCmapPriv->hPalette = hpalNew;
+ /* Save the Windows logical palette handle in the X colormaps' privates */
+ pCmapPriv->hPalette = hpalNew;
- /* Free the palette initialization memory */
- free (lpPaletteNew);
+ /* Free the palette initialization memory */
+ free(lpPaletteNew);
- return TRUE;
+ return TRUE;
}
-
/*
* Colormap destruction procedure
*/
static Bool
-winDestroyColormapShadowGDI (ColormapPtr pColormap)
+winDestroyColormapShadowGDI(ColormapPtr pColormap)
{
- winScreenPriv(pColormap->pScreen);
- winCmapPriv(pColormap);
-
- /*
- * Is colormap to be destroyed the default?
- *
- * Non-default colormaps should have had winUninstallColormap
- * called on them before we get here. The default colormap
- * will not have had winUninstallColormap called on it. Thus,
- * we need to handle the default colormap in a special way.
- */
- if (pColormap->flags & IsDefault)
- {
- winDebug ("winDestroyColormapShadowGDI - Destroying default "
- "colormap\n");
-
- /*
- * FIXME: Walk the list of all screens, popping the default
- * palette out of each screen device context.
- */
-
- /* Pop the palette out of the device context */
- SelectPalette (pScreenPriv->hdcScreen,
- GetStockObject (DEFAULT_PALETTE),
- FALSE);
-
- /* Clear our private installed colormap pointer */
- pScreenPriv->pcmapInstalled = NULL;
+ winScreenPriv(pColormap->pScreen);
+ winCmapPriv(pColormap);
+
+ /*
+ * Is colormap to be destroyed the default?
+ *
+ * Non-default colormaps should have had winUninstallColormap
+ * called on them before we get here. The default colormap
+ * will not have had winUninstallColormap called on it. Thus,
+ * we need to handle the default colormap in a special way.
+ */
+ if (pColormap->flags & IsDefault) {
+ winDebug("winDestroyColormapShadowGDI - Destroying default "
+ "colormap\n");
+
+ /*
+ * FIXME: Walk the list of all screens, popping the default
+ * palette out of each screen device context.
+ */
+
+ /* Pop the palette out of the device context */
+ SelectPalette(pScreenPriv->hdcScreen,
+ GetStockObject(DEFAULT_PALETTE), FALSE);
+
+ /* Clear our private installed colormap pointer */
+ pScreenPriv->pcmapInstalled = NULL;
}
-
- /* Try to delete the logical palette */
- if (DeleteObject (pCmapPriv->hPalette) == 0)
- {
- ErrorF ("winDestroyColormap - DeleteObject () failed\n");
- return FALSE;
+
+ /* Try to delete the logical palette */
+ if (DeleteObject(pCmapPriv->hPalette) == 0) {
+ ErrorF("winDestroyColormap - DeleteObject () failed\n");
+ return FALSE;
}
-
- /* Invalidate the colormap privates */
- pCmapPriv->hPalette = NULL;
- return TRUE;
-}
+ /* Invalidate the colormap privates */
+ pCmapPriv->hPalette = NULL;
+ return TRUE;
+}
/*
* Set engine specific funtions
*/
Bool
-winSetEngineFunctionsShadowGDI (ScreenPtr pScreen)
+winSetEngineFunctionsShadowGDI(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Set our pointers */
- pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI;
- pScreenPriv->pwinFreeFB = winFreeFBShadowGDI;
- pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI;
- pScreenPriv->pwinInitScreen = winInitScreenShadowGDI;
- pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI;
- pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI;
- pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI;
- if (pScreenInfo->fFullScreen)
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
- else
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
- pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
- pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI;
- pScreenPriv->pwinActivateApp = winActivateAppShadowGDI;
- pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowGDI;
- pScreenPriv->pwinRealizeInstalledPalette =
- winRealizeInstalledPaletteShadowGDI;
- pScreenPriv->pwinInstallColormap = winInstallColormapShadowGDI;
- pScreenPriv->pwinStoreColors = winStoreColorsShadowGDI;
- pScreenPriv->pwinCreateColormap = winCreateColormapShadowGDI;
- pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowGDI;
- pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
- pScreenPriv->pwinCreatePrimarySurface
- = (winCreatePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
- pScreenPriv->pwinReleasePrimarySurface
- = (winReleasePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI;
+ pScreenPriv->pwinFreeFB = winFreeFBShadowGDI;
+ pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI;
+ pScreenPriv->pwinInitScreen = winInitScreenShadowGDI;
+ pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI;
+ pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI;
+ if (pScreenInfo->fFullScreen)
+ pScreenPriv->pwinCreateBoundingWindow =
+ winCreateBoundingWindowFullScreen;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
+ pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI;
+ pScreenPriv->pwinActivateApp = winActivateAppShadowGDI;
+ pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowGDI;
+ pScreenPriv->pwinRealizeInstalledPalette =
+ winRealizeInstalledPaletteShadowGDI;
+ pScreenPriv->pwinInstallColormap = winInstallColormapShadowGDI;
+ pScreenPriv->pwinStoreColors = winStoreColorsShadowGDI;
+ pScreenPriv->pwinCreateColormap = winCreateColormapShadowGDI;
+ pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowGDI;
+ pScreenPriv->pwinHotKeyAltTab =
+ (winHotKeyAltTabProcPtr) (void (*)(void)) NoopDDA;
+ pScreenPriv->pwinCreatePrimarySurface =
+ (winCreatePrimarySurfaceProcPtr) (void (*)(void)) NoopDDA;
+ pScreenPriv->pwinReleasePrimarySurface =
+ (winReleasePrimarySurfaceProcPtr) (void (*)(void)) NoopDDA;
#ifdef XWIN_MULTIWINDOW
- pScreenPriv->pwinFinishCreateWindowsWindow =
- (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
+ pScreenPriv->pwinFinishCreateWindowsWindow =
+ (winFinishCreateWindowsWindowProcPtr) (void (*)(void)) NoopDDA;
#endif
- return TRUE;
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/wintrayicon.c b/xorg-server/hw/xwin/wintrayicon.c
index 01d53bc44..8a3952629 100644
--- a/xorg-server/hw/xwin/wintrayicon.c
+++ b/xorg-server/hw/xwin/wintrayicon.c
@@ -42,92 +42,88 @@ static NOTIFYICONDATA nid;
*/
void
-winInitNotifyIcon (winPrivScreenPtr pScreenPriv, Bool Modify)
+winInitNotifyIcon(winPrivScreenPtr pScreenPriv, Bool Modify)
{
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- char HostName[256];
-
- if (!Modify)
- {
- nid.cbSize = sizeof (NOTIFYICONDATA);
- nid.hWnd = pScreenPriv->hwndScreen;
- nid.uID = pScreenInfo->dwScreen;
- nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
- nid.uCallbackMessage = WM_TRAYICON;
- nid.hIcon = winTaskbarIcon ();
-
- /* Save handle to the icon so it can be freed later */
- pScreenPriv->hiconNotifyIcon = nid.hIcon;
- }
-
- gethostname(HostName,256);
-
- /* Set display and screen-specific tooltip text */
- if (g_pszQueryHost)
- {
- snprintf (nid.szTip,
- sizeof (nid.szTip),
- "%s - %s:%s.%d - %d clients",
- g_pszQueryHost,
- HostName,
- display,
- (int) pScreenInfo->dwScreen,
- pScreenPriv->iConnectedClients);
- }
- else
- {
- snprintf (nid.szTip,
- sizeof (nid.szTip),
- "%s:%s.%d - %d clients",
- HostName,
- display,
- (int) pScreenInfo->dwScreen,
- pScreenPriv->iConnectedClients);
- }
-
- /* Add the tray icon */
- if (!Shell_NotifyIcon ((Modify) ? NIM_MODIFY : NIM_ADD, &nid))
- ErrorF ("winInitNotifyIcon - Shell_NotifyIcon Failed\n");
-}
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ char HostName[256];
+
+ if (!Modify)
+ {
+ nid.cbSize = sizeof(NOTIFYICONDATA);
+ nid.hWnd = pScreenPriv->hwndScreen;
+ nid.uID = pScreenInfo->dwScreen;
+ nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
+ nid.uCallbackMessage = WM_TRAYICON;
+ nid.hIcon = winTaskbarIcon();
+
+ /* Save handle to the icon so it can be freed later */
+ pScreenPriv->hiconNotifyIcon = nid.hIcon;
+ }
+ gethostname(HostName,256);
+
+ /* Set display and screen-specific tooltip text */
+ if (g_pszQueryHost)
+ {
+ snprintf(nid.szTip,
+ sizeof(nid.szTip),
+ "%s - %s:%s.%d - %d clients",
+ g_pszQueryHost,
+ HostName,
+ display,
+ (int) pScreenInfo->dwScreen,
+ pScreenPriv->iConnectedClients);
+ }
+ else
+ {
+ snprintf (nid.szTip,
+ sizeof (nid.szTip),
+ "%s:%s.%d - %d clients",
+ HostName,
+ display,
+ (int) pScreenInfo->dwScreen,
+ pScreenPriv->iConnectedClients);
+ }
+
+ /* Add the tray icon */
+ if (!Shell_NotifyIcon ((Modify) ? NIM_MODIFY : NIM_ADD, &nid))
+ ErrorF("winInitNotifyIcon - Shell_NotifyIcon Failed\n");
+}
/*
* Delete the tray icon
*/
void
-winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv)
+winDeleteNotifyIcon(winPrivScreenPtr pScreenPriv)
{
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- if (!pScreenPriv->hiconNotifyIcon)
- return;
-
- /* Delete the tray icon */
- Shell_NotifyIcon (NIM_DELETE, &nid);
-
- /* Free the icon that was loaded */
- DestroyIcon (pScreenPriv->hiconNotifyIcon);
-
- pScreenPriv->hiconNotifyIcon = NULL;
-}
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ if (!pScreenPriv->hiconNotifyIcon)
+ return;
+ /* Delete the tray icon */
+ Shell_NotifyIcon (NIM_DELETE, &nid);
+
+ /* Free the icon that was loaded */
+ DestroyIcon (pScreenPriv->hiconNotifyIcon);
+
+ pScreenPriv->hiconNotifyIcon = NULL;
+}
/*
* Process messages intended for the tray icon
*/
LRESULT
-winHandleIconMessage (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam,
- winPrivScreenPtr pScreenPriv)
+winHandleIconMessage(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam, winPrivScreenPtr pScreenPriv)
{
#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_MULTIWINDOW)
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
#endif
- switch (lParam)
- {
+ switch (lParam) {
case WM_MOUSEMOVE:
{
static int PrevNrClients;
@@ -140,91 +136,85 @@ winHandleIconMessage (HWND hwnd, UINT message,
}
break;
case WM_LBUTTONUP:
- /* Restack and bring all windows to top */
- SetForegroundWindow (hwnd);
+ /* Restack and bring all windows to top */
+ SetForegroundWindow(hwnd);
#ifdef XWIN_MULTIWINDOWEXTWM
- if (pScreenInfo->fMWExtWM)
- winMWExtWMRestackWindows (pScreenInfo->pScreen);
+ if (pScreenInfo->fMWExtWM)
+ winMWExtWMRestackWindows(pScreenInfo->pScreen);
#endif
- break;
+ break;
case WM_LBUTTONDBLCLK:
- /* Display Exit dialog box */
- winDisplayExitDialog (pScreenPriv);
- break;
+ /* Display Exit dialog box */
+ winDisplayExitDialog(pScreenPriv);
+ break;
case WM_RBUTTONUP:
- {
- POINT ptCursor;
- HMENU hmenuPopup;
- HMENU hmenuTray;
+ {
+ POINT ptCursor;
+ HMENU hmenuPopup;
+ HMENU hmenuTray;
- /* Get cursor position */
- GetCursorPos (&ptCursor);
+ /* Get cursor position */
+ GetCursorPos(&ptCursor);
- /* Load tray icon menu resource */
- hmenuPopup = LoadMenu (g_hInstance,
- MAKEINTRESOURCE(IDM_TRAYICON_MENU));
- if (!hmenuPopup)
- ErrorF ("winHandleIconMessage - LoadMenu failed\n");
+ /* Load tray icon menu resource */
+ hmenuPopup = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDM_TRAYICON_MENU));
+ if (!hmenuPopup)
+ ErrorF("winHandleIconMessage - LoadMenu failed\n");
- /* Get actual tray icon menu */
- hmenuTray = GetSubMenu (hmenuPopup, 0);
+ /* Get actual tray icon menu */
+ hmenuTray = GetSubMenu(hmenuPopup, 0);
#ifdef XWIN_MULTIWINDOW
- /* Check for MultiWindow mode */
- if (pScreenInfo->fMultiWindow)
- {
- MENUITEMINFO mii = {0};
-
- /* Root is shown, remove the check box */
-
- /* Setup menu item info structure */
- mii.cbSize = sizeof (MENUITEMINFO);
- mii.fMask = MIIM_STATE;
- mii.fState = MFS_CHECKED;
-
- /* Unheck box if root is shown */
- if (pScreenPriv->fRootWindowShown)
- mii.fState = MFS_UNCHECKED;
-
- /* Set menu state */
- SetMenuItemInfo (hmenuTray, ID_APP_HIDE_ROOT, FALSE, &mii);
- }
- else
+ /* Check for MultiWindow mode */
+ if (pScreenInfo->fMultiWindow) {
+ MENUITEMINFO mii = { 0 };
+
+ /* Root is shown, remove the check box */
+
+ /* Setup menu item info structure */
+ mii.cbSize = sizeof(MENUITEMINFO);
+ mii.fMask = MIIM_STATE;
+ mii.fState = MFS_CHECKED;
+
+ /* Unheck box if root is shown */
+ if (pScreenPriv->fRootWindowShown)
+ mii.fState = MFS_UNCHECKED;
+
+ /* Set menu state */
+ SetMenuItemInfo(hmenuTray, ID_APP_HIDE_ROOT, FALSE, &mii);
+ }
+ else
#endif
- {
- /* Remove Hide Root Window button */
- RemoveMenu (hmenuTray,
- ID_APP_HIDE_ROOT,
- MF_BYCOMMAND);
- }
-
- SetupRootMenu ((unsigned long)hmenuTray);
-
- /*
- * NOTE: This three-step procedure is required for
- * proper popup menu operation. Without the
- * call to SetForegroundWindow the
- * popup menu will often not disappear when you click
- * outside of it. Without the PostMessage the second
- * time you display the popup menu it might immediately
- * disappear.
- */
- SetForegroundWindow (hwnd);
- TrackPopupMenuEx (hmenuTray,
- TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON,
- ptCursor.x, ptCursor.y,
- hwnd,
- NULL);
- PostMessage (hwnd, WM_NULL, 0, 0);
-
- /* Free menu */
- DestroyMenu (hmenuPopup);
- }
- break;
+ {
+ /* Remove Hide Root Window button */
+ RemoveMenu(hmenuTray, ID_APP_HIDE_ROOT, MF_BYCOMMAND);
+ }
+
+ SetupRootMenu((unsigned long) hmenuTray);
+
+ /*
+ * NOTE: This three-step procedure is required for
+ * proper popup menu operation. Without the
+ * call to SetForegroundWindow the
+ * popup menu will often not disappear when you click
+ * outside of it. Without the PostMessage the second
+ * time you display the popup menu it might immediately
+ * disappear.
+ */
+ SetForegroundWindow(hwnd);
+ TrackPopupMenuEx(hmenuTray,
+ TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON,
+ ptCursor.x, ptCursor.y, hwnd, NULL);
+ PostMessage(hwnd, WM_NULL, 0, 0);
+
+ /* Free menu */
+ DestroyMenu(hmenuPopup);
+ }
+ break;
}
- return 0;
+ return 0;
}
diff --git a/xorg-server/hw/xwin/winvalargs.c b/xorg-server/hw/xwin/winvalargs.c
index 04db777b0..eb6e973b8 100644
--- a/xorg-server/hw/xwin/winvalargs.c
+++ b/xorg-server/hw/xwin/winvalargs.c
@@ -34,22 +34,19 @@
#include "win.h"
#include "winmsg.h"
-
-
-
/*
* Verify all screens have been explicitly specified
*/
static BOOL
isEveryScreenExplicit(void)
{
- int i;
+ int i;
- for (i = 0; i < g_iNumScreens; i++)
- if (!g_ScreenInfo[i].fExplicitScreen)
- return FALSE;
+ for (i = 0; i < g_iNumScreens; i++)
+ if (!g_ScreenInfo[i].fExplicitScreen)
+ return FALSE;
- return TRUE;
+ return TRUE;
}
/*
@@ -57,124 +54,117 @@ isEveryScreenExplicit(void)
*/
Bool
-winValidateArgs (void)
+winValidateArgs(void)
{
- int i;
- int iMaxConsecutiveScreen = 0;
- BOOL fHasNormalScreen0 = FALSE;
- BOOL fImplicitScreenFound = FALSE;
-
- /*
- * Check for a malformed set of -screen parameters.
- * Examples of malformed parameters:
- * XWin -screen 1
- * XWin -screen 0 -screen 2
- * XWin -screen 1 -screen 2
- */
- if (!isEveryScreenExplicit())
- {
- ErrorF ("winValidateArgs - Malformed set of screen parameter(s). "
- "Screens must be specified consecutively starting with "
- "screen 0. That is, you cannot have only a screen 1, nor "
- "could you have screen 0 and screen 2. You instead must "
- "have screen 0, or screen 0 and screen 1, respectively. "
- "You can specify as many screens as you want.\n");
- return FALSE;
+ int i;
+ int iMaxConsecutiveScreen = 0;
+ BOOL fHasNormalScreen0 = FALSE;
+ BOOL fImplicitScreenFound = FALSE;
+
+ /*
+ * Check for a malformed set of -screen parameters.
+ * Examples of malformed parameters:
+ * XWin -screen 1
+ * XWin -screen 0 -screen 2
+ * XWin -screen 1 -screen 2
+ */
+ if (!isEveryScreenExplicit()) {
+ ErrorF("winValidateArgs - Malformed set of screen parameter(s). "
+ "Screens must be specified consecutively starting with "
+ "screen 0. That is, you cannot have only a screen 1, nor "
+ "could you have screen 0 and screen 2. You instead must "
+ "have screen 0, or screen 0 and screen 1, respectively. "
+ "You can specify as many screens as you want.\n");
+ return FALSE;
}
- /* Loop through all screens */
- for (i = 0; i < g_iNumScreens; ++i)
- {
- /*
- * Check for any combination of
- * -multiwindow, -mwextwm, and -rootless.
- */
- {
- int iCount = 0;
-
- /* Count conflicting options */
+ /* Loop through all screens */
+ for (i = 0; i < g_iNumScreens; ++i) {
+ /*
+ * Check for any combination of
+ * -multiwindow, -mwextwm, and -rootless.
+ */
+ {
+ int iCount = 0;
+
+ /* Count conflicting options */
#ifdef XWIN_MULTIWINDOW
- if (g_ScreenInfo[i].fMultiWindow)
- ++iCount;
+ if (g_ScreenInfo[i].fMultiWindow)
+ ++iCount;
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- if (g_ScreenInfo[i].fMWExtWM)
- ++iCount;
+ if (g_ScreenInfo[i].fMWExtWM)
+ ++iCount;
#endif
- if (g_ScreenInfo[i].fRootless)
- ++iCount;
-
- /* Check if the first screen is without rootless and multiwindow */
- if (iCount == 0 && i == 0)
- fHasNormalScreen0 = TRUE;
-
- /* Fail if two or more conflicting options */
- if (iCount > 1)
- {
- ErrorF ("winValidateArgs - Only one of -multiwindow, -mwextwm, "
- "and -rootless can be specific at a time.\n");
- return FALSE;
- }
- }
-
- /* Check for -multiwindow or -mwextwm and Xdmcp */
- /* allow xdmcp if screen 0 is normal. */
- if (g_fXdmcpEnabled && !fHasNormalScreen0
- && (FALSE
+ if (g_ScreenInfo[i].fRootless)
+ ++iCount;
+
+ /* Check if the first screen is without rootless and multiwindow */
+ if (iCount == 0 && i == 0)
+ fHasNormalScreen0 = TRUE;
+
+ /* Fail if two or more conflicting options */
+ if (iCount > 1) {
+ ErrorF("winValidateArgs - Only one of -multiwindow, -mwextwm, "
+ "and -rootless can be specific at a time.\n");
+ return FALSE;
+ }
+ }
+
+ /* Check for -multiwindow or -mwextwm and Xdmcp */
+ /* allow xdmcp if screen 0 is normal. */
+ if (g_fXdmcpEnabled && !fHasNormalScreen0 && (FALSE
#ifdef XWIN_MULTIWINDOW
- || g_ScreenInfo[i].fMultiWindow
+ || g_ScreenInfo[i].
+ fMultiWindow
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- || g_ScreenInfo[i].fMWExtWM
+ || g_ScreenInfo[i].
+ fMWExtWM
#endif
- )
- )
- {
- ErrorF ("winValidateArgs - Xdmcp (-query, -broadcast, or -indirect) "
- "is invalid with -multiwindow or -mwextwm.\n");
- return FALSE;
- }
-
- /* Check for -multiwindow, -mwextwm, or -rootless and fullscreen */
- if (g_ScreenInfo[i].fFullScreen
- && (FALSE
+ )
+ ) {
+ ErrorF("winValidateArgs - Xdmcp (-query, -broadcast, or -indirect) "
+ "is invalid with -multiwindow or -mwextwm.\n");
+ return FALSE;
+ }
+
+ /* Check for -multiwindow, -mwextwm, or -rootless and fullscreen */
+ if (g_ScreenInfo[i].fFullScreen && (FALSE
#ifdef XWIN_MULTIWINDOW
- || g_ScreenInfo[i].fMultiWindow
+ || g_ScreenInfo[i].fMultiWindow
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- || g_ScreenInfo[i].fMWExtWM
+ || g_ScreenInfo[i].fMWExtWM
#endif
- || g_ScreenInfo[i].fRootless)
- )
- {
- ErrorF ("winValidateArgs - -fullscreen is invalid with "
- "-multiwindow, -mwextwm, or -rootless.\n");
- return FALSE;
- }
-
- /* Check for !fullscreen and any fullscreen-only parameters */
- if (!g_ScreenInfo[i].fFullScreen
- && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_REFRESH
- || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_BPP))
- {
- ErrorF ("winValidateArgs - -refresh and -depth are only valid "
- "with -fullscreen.\n");
- return FALSE;
- }
-
- /* Check for fullscreen and any non-fullscreen parameters */
- if (g_ScreenInfo[i].fFullScreen
- && ((g_ScreenInfo[i].iResizeMode != notAllowed)
- || !g_ScreenInfo[i].fDecoration
- || g_ScreenInfo[i].fLessPointer))
- {
- ErrorF ("winValidateArgs - -fullscreen is invalid with "
- "-scrollbars, -resize, -nodecoration, or -lesspointer.\n");
- return FALSE;
- }
+ || g_ScreenInfo[i].fRootless)
+ ) {
+ ErrorF("winValidateArgs - -fullscreen is invalid with "
+ "-multiwindow, -mwextwm, or -rootless.\n");
+ return FALSE;
+ }
+
+ /* Check for !fullscreen and any fullscreen-only parameters */
+ if (!g_ScreenInfo[i].fFullScreen
+ && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_REFRESH
+ || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_BPP)) {
+ ErrorF("winValidateArgs - -refresh and -depth are only valid "
+ "with -fullscreen.\n");
+ return FALSE;
+ }
+
+ /* Check for fullscreen and any non-fullscreen parameters */
+ if (g_ScreenInfo[i].fFullScreen
+ && ((g_ScreenInfo[i].iResizeMode != notAllowed)
+ || !g_ScreenInfo[i].fDecoration
+ || g_ScreenInfo[i].fLessPointer)) {
+ ErrorF("winValidateArgs - -fullscreen is invalid with "
+ "-scrollbars, -resize, -nodecoration, or -lesspointer.\n");
+ return FALSE;
+ }
}
- winDebug ("winValidateArgs - Returning.\n");
+ winDebug("winValidateArgs - Returning.\n");
- return TRUE;
+ return TRUE;
}
diff --git a/xorg-server/hw/xwin/winvideo.c b/xorg-server/hw/xwin/winvideo.c
index ed205448d..151538d10 100644
--- a/xorg-server/hw/xwin/winvideo.c
+++ b/xorg-server/hw/xwin/winvideo.c
@@ -36,32 +36,24 @@
#include <X11/extensions/Xvproto.h>
void
-winInitVideo (ScreenPtr pScreen);
+ winInitVideo(ScreenPtr pScreen);
/*
* winInitVideo - Initialize support for the X Video (Xv) Extension.
*/
void
-winInitVideo (ScreenPtr pScreen)
+winInitVideo(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ if (pScreenInfo->dwBPP > 8) {
- if (pScreenInfo->dwBPP > 8)
- {
-
}
-
}
-
-
-
-
-
-
#if 0
#include "../xfree86/common/xf86.h"
#include "../Xext/xvdix.h"
@@ -69,80 +61,71 @@ winInitVideo (ScreenPtr pScreen)
#include <X11/extensions/Xv.h>
#endif
-
-
#if 0
/* client libraries expect an encoding */
-static XF86VideoEncodingRec DummyEncoding[1] =
-{
- {
- 0,
- "XV_IMAGE",
- IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
- {1, 1}
- }
+static XF86VideoEncodingRec DummyEncoding[1] = {
+ {
+ 0,
+ "XV_IMAGE",
+ IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
+ {1, 1}
+ }
};
#define NUM_FORMATS 3
-static XF86VideoFormatRec Formats[NUM_FORMATS] =
-{
- {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
+static XF86VideoFormatRec Formats[NUM_FORMATS] = {
+ {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
};
#define NUM_ATTRIBUTES 3
-static XF86AttributeRec Attributes[NUM_ATTRIBUTES] =
-{
- {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
- {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
- {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
+static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = {
+ {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
+ {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
+ {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
};
#define NUM_IMAGES 4
-static XF86ImageRec Images[NUM_IMAGES] =
-{
- XVIMAGE_YUY2,
- XVIMAGE_YV12,
- XVIMAGE_I420,
- XVIMAGE_UYVY
+static XF86ImageRec Images[NUM_IMAGES] = {
+ XVIMAGE_YUY2,
+ XVIMAGE_YV12,
+ XVIMAGE_I420,
+ XVIMAGE_UYVY
};
-
-
/*
* winInitVideo - Initialize support for the X Video (Xv) Extension.
*/
void
-winInitVideo (ScreenPtr pScreen)
+winInitVideo(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- XF86VideoAdaptorPtr newAdaptor = NULL;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ XF86VideoAdaptorPtr newAdaptor = NULL;
- if (pScreenInfo->dwBPP > 8)
- {
- newAdaptor = I810SetupImageVideo (pScreen);
- I810InitOffscreenImages (pScreen);
+ if (pScreenInfo->dwBPP > 8) {
+ newAdaptor = I810SetupImageVideo(pScreen);
+ I810InitOffscreenImages(pScreen);
}
-
- xf86XVScreenInit (pScreen, adaptors, 1);
-}
+ xf86XVScreenInit(pScreen, adaptors, 1);
+}
-static XF86VideoAdaptorPtr
-winSetupImageVideo (ScreenPtr pScreen)
+static XF86VideoAdaptorPtr
+winSetupImageVideo(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
#if 0
I810Ptr pI810 = I810PTR(pScrn);
#endif
XF86VideoAdaptorPtr adapt;
if (!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec))))
- return NULL;
+ return NULL;
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
@@ -195,8 +178,8 @@ winSetupImageVideo (ScreenPtr pScreen)
#if 0
xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
- xvContrast = MAKE_ATOM("XV_CONTRAST");
- xvColorKey = MAKE_ATOM("XV_COLORKEY");
+ xvContrast = MAKE_ATOM("XV_CONTRAST");
+ xvColorKey = MAKE_ATOM("XV_COLORKEY");
#endif
#if 0
diff --git a/xorg-server/hw/xwin/winwakeup.c b/xorg-server/hw/xwin/winwakeup.c
index 64c202fed..1d2bfedbe 100644
--- a/xorg-server/hw/xwin/winwakeup.c
+++ b/xorg-server/hw/xwin/winwakeup.c
@@ -1,61 +1,55 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Dakshinamurthy Karra
- * Suhaib M Siddiqi
- * Peter Busch
- * Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/* See Porting Layer Definition - p. 7 */
-void
-winWakeupHandler (int nScreen,
- pointer pWakeupData,
- unsigned long ulResult,
- pointer pReadmask)
-{
- MSG msg;
-
- /* Process all messages on our queue */
- while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
- {
- if ((g_hDlgDepthChange == 0
- || !IsDialogMessage (g_hDlgDepthChange, &msg))
- && (g_hDlgExit == 0
- || !IsDialogMessage (g_hDlgExit, &msg))
- && (g_hDlgAbout == 0
- || !IsDialogMessage (g_hDlgAbout, &msg)))
- {
- DispatchMessage (&msg);
- }
- }
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+/* See Porting Layer Definition - p. 7 */
+void
+winWakeupHandler(int nScreen,
+ pointer pWakeupData, unsigned long ulResult, pointer pReadmask)
+{
+ MSG msg;
+
+ /* Process all messages on our queue */
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if ((g_hDlgDepthChange == 0
+ || !IsDialogMessage(g_hDlgDepthChange, &msg))
+ && (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg))
+ && (g_hDlgAbout == 0 || !IsDialogMessage(g_hDlgAbout, &msg))) {
+ DispatchMessage(&msg);
+ }
+ }
+}
diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c
index 9f828503f..9ec1cbdf3 100644
--- a/xorg-server/hw/xwin/winwin32rootless.c
+++ b/xorg-server/hw/xwin/winwin32rootless.c
@@ -43,7 +43,6 @@
#include "winmultiwindowclass.h"
#include <X11/Xatom.h>
-
/*
* Constant defines
*/
@@ -65,13 +64,13 @@
DEFINE_ATOM_HELPER(AtmWindowsWmNativeHwnd, WINDOWSWM_NATIVE_HWND)
static void
-winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame);
+winMWExtWMSetNativeProperty(RootlessWindowPtr pFrame);
/*
* Global variables
*/
-Bool g_fNoConfigureWindow = FALSE;
+Bool g_fNoConfigureWindow = FALSE;
/*
* Internal function to get the DIB format that is compatible with the screen
@@ -80,804 +79,764 @@ Bool g_fNoConfigureWindow = FALSE;
static
Bool
-winMWExtWMQueryDIBFormat (win32RootlessWindowPtr pRLWinPriv, BITMAPINFOHEADER *pbmih)
+winMWExtWMQueryDIBFormat(win32RootlessWindowPtr pRLWinPriv,
+ BITMAPINFOHEADER * pbmih)
{
- HBITMAP hbmp;
+ HBITMAP hbmp;
#ifdef _DEBUG
- LPDWORD pdw = NULL;
+ LPDWORD pdw = NULL;
#endif
-
- /* Create a memory bitmap compatible with the screen */
- hbmp = CreateCompatibleBitmap (pRLWinPriv->hdcScreen, 1, 1);
- if (hbmp == NULL)
- {
- ErrorF ("winMWExtWMQueryDIBFormat - CreateCompatibleBitmap failed\n");
- return FALSE;
+
+ /* Create a memory bitmap compatible with the screen */
+ hbmp = CreateCompatibleBitmap(pRLWinPriv->hdcScreen, 1, 1);
+ if (hbmp == NULL) {
+ ErrorF("winMWExtWMQueryDIBFormat - CreateCompatibleBitmap failed\n");
+ return FALSE;
}
-
- /* Initialize our bitmap info header */
- ZeroMemory (pbmih, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD));
- pbmih->biSize = sizeof (BITMAPINFOHEADER);
-
- /* Get the biBitCount */
- if (!GetDIBits (pRLWinPriv->hdcScreen,
- hbmp,
- 0, 1,
- NULL,
- (BITMAPINFO*) pbmih,
- DIB_RGB_COLORS))
- {
- ErrorF ("winMWExtWMQueryDIBFormat - First call to GetDIBits failed\n");
- DeleteObject (hbmp);
- return FALSE;
+
+ /* Initialize our bitmap info header */
+ ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
+ pbmih->biSize = sizeof(BITMAPINFOHEADER);
+
+ /* Get the biBitCount */
+ if (!GetDIBits(pRLWinPriv->hdcScreen,
+ hbmp, 0, 1, NULL, (BITMAPINFO *) pbmih, DIB_RGB_COLORS)) {
+ ErrorF("winMWExtWMQueryDIBFormat - First call to GetDIBits failed\n");
+ DeleteObject(hbmp);
+ return FALSE;
}
#ifdef _DEBUG
- /* Get a pointer to bitfields */
- pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER));
+ /* Get a pointer to bitfields */
+ pdw = (DWORD *) ((CARD8 *) pbmih + sizeof(BITMAPINFOHEADER));
- winDebug ("winMWExtWMQueryDIBFormat - First call masks: %08x %08x %08x\n",
- (unsigned int)pdw[0], (unsigned int)pdw[1], (unsigned int)pdw[2]);
+ winDebug("winMWExtWMQueryDIBFormat - First call masks: %08x %08x %08x\n",
+ (unsigned int) pdw[0], (unsigned int) pdw[1],
+ (unsigned int) pdw[2]);
#endif
- /* Get optimal color table, or the optimal bitfields */
- if (!GetDIBits (pRLWinPriv->hdcScreen,
- hbmp,
- 0, 1,
- NULL,
- (BITMAPINFO*)pbmih,
- DIB_RGB_COLORS))
- {
- ErrorF ("winMWExtWMQueryDIBFormat - Second call to GetDIBits "
- "failed\n");
- DeleteObject (hbmp);
- return FALSE;
+ /* Get optimal color table, or the optimal bitfields */
+ if (!GetDIBits(pRLWinPriv->hdcScreen,
+ hbmp, 0, 1, NULL, (BITMAPINFO *) pbmih, DIB_RGB_COLORS)) {
+ ErrorF("winMWExtWMQueryDIBFormat - Second call to GetDIBits "
+ "failed\n");
+ DeleteObject(hbmp);
+ return FALSE;
}
- /* Free memory */
- DeleteObject (hbmp);
-
- return TRUE;
+ /* Free memory */
+ DeleteObject(hbmp);
+
+ return TRUE;
}
static HRGN
-winMWExtWMCreateRgnFromRegion (RegionPtr pShape)
+winMWExtWMCreateRgnFromRegion(RegionPtr pShape)
{
- int nRects;
- BoxPtr pRects, pEnd;
- HRGN hRgn, hRgnRect;
-
- if (pShape == NULL) return NULL;
-
- nRects = RegionNumRects(pShape);
- pRects = RegionRects(pShape);
-
- hRgn = CreateRectRgn (0, 0, 0, 0);
- if (hRgn == NULL)
- {
- ErrorF ("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) "
- "failed: %d\n",
- 0, 0, 0, 0, (int) GetLastError ());
+ int nRects;
+ BoxPtr pRects, pEnd;
+ HRGN hRgn, hRgnRect;
+
+ if (pShape == NULL)
+ return NULL;
+
+ nRects = RegionNumRects(pShape);
+ pRects = RegionRects(pShape);
+
+ hRgn = CreateRectRgn(0, 0, 0, 0);
+ if (hRgn == NULL) {
+ ErrorF("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) "
+ "failed: %d\n", 0, 0, 0, 0, (int) GetLastError());
}
- /* Loop through all rectangles in the X region */
- for (pEnd = pRects + nRects; pRects < pEnd; pRects++)
- {
- /* Create a Windows region for the X rectangle */
- hRgnRect = CreateRectRgn (pRects->x1,
- pRects->y1,
- pRects->x2,
- pRects->y2);
- if (hRgnRect == NULL)
- {
- ErrorF ("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) "
- "failed: %d\n",
- pRects->x1,
- pRects->y1,
- pRects->x2,
- pRects->y2,
- (int) GetLastError ());
- }
-
- /* Merge the Windows region with the accumulated region */
- if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR)
- {
- ErrorF ("winReshape - CombineRgn () failed: %d\n",
- (int) GetLastError ());
- }
-
- /* Delete the temporary Windows region */
- DeleteObject (hRgnRect);
+ /* Loop through all rectangles in the X region */
+ for (pEnd = pRects + nRects; pRects < pEnd; pRects++) {
+ /* Create a Windows region for the X rectangle */
+ hRgnRect = CreateRectRgn(pRects->x1,
+ pRects->y1, pRects->x2, pRects->y2);
+ if (hRgnRect == NULL) {
+ ErrorF("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) "
+ "failed: %d\n",
+ pRects->x1,
+ pRects->y1, pRects->x2, pRects->y2, (int) GetLastError());
+ }
+
+ /* Merge the Windows region with the accumulated region */
+ if (CombineRgn(hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) {
+ ErrorF("winReshape - CombineRgn () failed: %d\n",
+ (int) GetLastError());
+ }
+
+ /* Delete the temporary Windows region */
+ DeleteObject(hRgnRect);
}
-
- return hRgn;
+
+ return hRgn;
}
static void
-InitWin32RootlessEngine (win32RootlessWindowPtr pRLWinPriv)
+InitWin32RootlessEngine(win32RootlessWindowPtr pRLWinPriv)
{
- pRLWinPriv->hdcScreen = GetDC (pRLWinPriv->hWnd);
- pRLWinPriv->hdcShadow = CreateCompatibleDC (pRLWinPriv->hdcScreen);
- pRLWinPriv->hbmpShadow = NULL;
-
- /* Allocate bitmap info header */
- pRLWinPriv->pbmihShadow = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
- + 256 * sizeof (RGBQUAD));
- if (pRLWinPriv->pbmihShadow == NULL)
- {
- ErrorF ("InitWin32RootlessEngine - malloc () failed\n");
- return;
+ pRLWinPriv->hdcScreen = GetDC(pRLWinPriv->hWnd);
+ pRLWinPriv->hdcShadow = CreateCompatibleDC(pRLWinPriv->hdcScreen);
+ pRLWinPriv->hbmpShadow = NULL;
+
+ /* Allocate bitmap info header */
+ pRLWinPriv->pbmihShadow =
+ (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER)
+ + 256 * sizeof(RGBQUAD));
+ if (pRLWinPriv->pbmihShadow == NULL) {
+ ErrorF("InitWin32RootlessEngine - malloc () failed\n");
+ return;
}
-
- /* Query the screen format */
- winMWExtWMQueryDIBFormat (pRLWinPriv,
- pRLWinPriv->pbmihShadow);
+
+ /* Query the screen format */
+ winMWExtWMQueryDIBFormat(pRLWinPriv, pRLWinPriv->pbmihShadow);
}
Bool
-winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
- int newX, int newY, RegionPtr pShape)
+winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape)
{
#define CLASS_NAME_LENGTH 512
- Bool fResult = TRUE;
- win32RootlessWindowPtr pRLWinPriv;
- WNDCLASSEX wc;
- char pszClass[CLASS_NAME_LENGTH], pszWindowID[12];
- HICON hIcon;
- HICON hIconSmall;
- char *res_name, *res_class, *res_role;
- static int s_iWindowID = 0;
-
- winDebug ("winMWExtWMCreateFrame %d %d - %d %d\n",
- newX, newY, pFrame->width, pFrame->height);
-
- pRLWinPriv = (win32RootlessWindowPtr) malloc (sizeof (win32RootlessWindowRec));
- pRLWinPriv->pFrame = pFrame;
- pRLWinPriv->pfb = NULL;
- pRLWinPriv->hbmpShadow = NULL;
- pRLWinPriv->hdcShadow = NULL;
- pRLWinPriv->hdcScreen = NULL;
- pRLWinPriv->pbmihShadow = NULL;
- pRLWinPriv->fResized = TRUE;
- pRLWinPriv->fClose = FALSE;
- pRLWinPriv->fRestackingNow = FALSE;
- pRLWinPriv->fDestroyed = FALSE;
- pRLWinPriv->fMovingOrSizing = FALSE;
-
- // Store the implementation private frame ID
- pFrame->wid = (RootlessFrameID) pRLWinPriv;
-
- winSelectIcons(pFrame->win, &hIcon, &hIconSmall);
-
- /* Set standard class name prefix so we can identify window easily */
- strncpy (pszClass, WINDOW_CLASS_X, sizeof(pszClass));
-
- if (winMultiWindowGetClassHint (pFrame->win, &res_name, &res_class))
- {
- strncat (pszClass, "-", 1);
- strncat (pszClass, res_name, CLASS_NAME_LENGTH - strlen (pszClass));
- strncat (pszClass, "-", 1);
- strncat (pszClass, res_class, CLASS_NAME_LENGTH - strlen (pszClass));
-
- /* Check if a window class is provided by the WM_WINDOW_ROLE property,
- * if not use the WM_CLASS information.
- * For further information see:
- * http://tronche.com/gui/x/icccm/sec-5.html
- */
- if (winMultiWindowGetWindowRole (pFrame->win, &res_role) )
- {
- strcat (pszClass, "-");
- strcat (pszClass, res_role);
- free (res_role);
- }
-
- free (res_name);
- free (res_class);
+ Bool fResult = TRUE;
+ win32RootlessWindowPtr pRLWinPriv;
+ WNDCLASSEX wc;
+ char pszClass[CLASS_NAME_LENGTH], pszWindowID[12];
+ HICON hIcon;
+ HICON hIconSmall;
+ char *res_name, *res_class, *res_role;
+ static int s_iWindowID = 0;
+
+ winDebug("winMWExtWMCreateFrame %d %d - %d %d\n",
+ newX, newY, pFrame->width, pFrame->height);
+
+ pRLWinPriv =
+ (win32RootlessWindowPtr) malloc(sizeof(win32RootlessWindowRec));
+ pRLWinPriv->pFrame = pFrame;
+ pRLWinPriv->pfb = NULL;
+ pRLWinPriv->hbmpShadow = NULL;
+ pRLWinPriv->hdcShadow = NULL;
+ pRLWinPriv->hdcScreen = NULL;
+ pRLWinPriv->pbmihShadow = NULL;
+ pRLWinPriv->fResized = TRUE;
+ pRLWinPriv->fClose = FALSE;
+ pRLWinPriv->fRestackingNow = FALSE;
+ pRLWinPriv->fDestroyed = FALSE;
+ pRLWinPriv->fMovingOrSizing = FALSE;
+
+ // Store the implementation private frame ID
+ pFrame->wid = (RootlessFrameID) pRLWinPriv;
+
+ winSelectIcons(pFrame->win, &hIcon, &hIconSmall);
+
+ /* Set standard class name prefix so we can identify window easily */
+ strncpy(pszClass, WINDOW_CLASS_X, sizeof(pszClass));
+
+ if (winMultiWindowGetClassHint(pFrame->win, &res_name, &res_class)) {
+ strncat(pszClass, "-", 1);
+ strncat(pszClass, res_name, CLASS_NAME_LENGTH - strlen(pszClass));
+ strncat(pszClass, "-", 1);
+ strncat(pszClass, res_class, CLASS_NAME_LENGTH - strlen(pszClass));
+
+ /* Check if a window class is provided by the WM_WINDOW_ROLE property,
+ * if not use the WM_CLASS information.
+ * For further information see:
+ * http://tronche.com/gui/x/icccm/sec-5.html
+ */
+ if (winMultiWindowGetWindowRole(pFrame->win, &res_role)) {
+ strcat(pszClass, "-");
+ strcat(pszClass, res_role);
+ free(res_role);
+ }
+
+ free(res_name);
+ free(res_class);
}
- /* Add incrementing window ID to make unique class name */
- snprintf (pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++);
- pszWindowID[sizeof(pszWindowID)-1] = 0;
- strcat (pszClass, pszWindowID);
-
- winDebug ("winCreateWindowsWindow - Creating class: %s\n", pszClass);
-
- /* Setup our window class */
- wc.cbSize = sizeof(wc);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = winMWExtWMWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = g_hInstance;
- wc.hIcon = hIcon;
- wc.hIconSm = hIconSmall;
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = pszClass;
- RegisterClassEx (&wc);
-
- /* Create the window */
- g_fNoConfigureWindow = TRUE;
- pRLWinPriv->hWnd = CreateWindowExA (WS_EX_TOOLWINDOW, /* Extended styles */
- pszClass, /* Class name */
- WINDOW_TITLE_X, /* Window name */
- WS_POPUP | WS_CLIPCHILDREN,
- newX, /* Horizontal position */
- newY, /* Vertical position */
- pFrame->width, /* Right edge */
- pFrame->height, /* Bottom edge */
- (HWND) NULL, /* No parent or owner window */
- (HMENU) NULL, /* No menu */
- GetModuleHandle (NULL), /* Instance handle */
- pRLWinPriv); /* ScreenPrivates */
- if (pRLWinPriv->hWnd == NULL)
- {
- ErrorF ("winMWExtWMCreateFrame - CreateWindowExA () failed: %d\n",
- (int) GetLastError ());
- fResult = FALSE;
+ /* Add incrementing window ID to make unique class name */
+ snprintf(pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++);
+ pszWindowID[sizeof(pszWindowID) - 1] = 0;
+ strcat(pszClass, pszWindowID);
+
+ winDebug("winCreateWindowsWindow - Creating class: %s\n", pszClass);
+
+ /* Setup our window class */
+ wc.cbSize = sizeof(wc);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winMWExtWMWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
+ wc.hIcon = hIcon;
+ wc.hIconSm = hIconSmall;
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = pszClass;
+ RegisterClassEx(&wc);
+
+ /* Create the window */
+ g_fNoConfigureWindow = TRUE;
+ pRLWinPriv->hWnd = CreateWindowExA(WS_EX_TOOLWINDOW, /* Extended styles */
+ pszClass, /* Class name */
+ WINDOW_TITLE_X, /* Window name */
+ WS_POPUP | WS_CLIPCHILDREN, newX, /* Horizontal position */
+ newY, /* Vertical position */
+ pFrame->width, /* Right edge */
+ pFrame->height, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle(NULL), /* Instance handle */
+ pRLWinPriv); /* ScreenPrivates */
+ if (pRLWinPriv->hWnd == NULL) {
+ ErrorF("winMWExtWMCreateFrame - CreateWindowExA () failed: %d\n",
+ (int) GetLastError());
+ fResult = FALSE;
}
- winDebug ("winMWExtWMCreateFrame - ShowWindow\n");
+ winDebug("winMWExtWMCreateFrame - ShowWindow\n");
+
+ //ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE);
+ g_fNoConfigureWindow = FALSE;
- //ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE);
- g_fNoConfigureWindow = FALSE;
-
- if (pShape != NULL)
- {
- winMWExtWMReshapeFrame (pFrame->wid, pShape);
+ if (pShape != NULL) {
+ winMWExtWMReshapeFrame(pFrame->wid, pShape);
}
- winDebug ("winMWExtWMCreateFrame - (%08x) %08x\n",
- (int) pFrame->wid, (int) pRLWinPriv->hWnd);
+ winDebug("winMWExtWMCreateFrame - (%08x) %08x\n",
+ (int) pFrame->wid, (int) pRLWinPriv->hWnd);
- winMWExtWMSetNativeProperty (pFrame);
+ winMWExtWMSetNativeProperty(pFrame);
- return fResult;
+ return fResult;
}
void
-winMWExtWMDestroyFrame (RootlessFrameID wid)
+winMWExtWMDestroyFrame(RootlessFrameID wid)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- HICON hIcon;
- HICON hIconSm;
- HMODULE hInstance;
- int iReturn;
- char pszClass[CLASS_NAME_LENGTH];
-
- winDebug ("winMWExtWMDestroyFrame (%08x) %08x\n",
- (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
-
- /* Store the info we need to destroy after this window is gone */
- hInstance = (HINSTANCE) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HMODULE);
- hIcon = (HICON)SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
- hIconSm = (HICON)SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
- iReturn = GetClassName (pRLWinPriv->hWnd, pszClass, CLASS_NAME_LENGTH);
-
- pRLWinPriv->fClose = TRUE;
- pRLWinPriv->fDestroyed = TRUE;
-
- /* Destroy the Windows window */
- DestroyWindow (pRLWinPriv->hWnd);
-
- /* Only if we were able to get the name */
- if (iReturn)
- {
- winDebug ("winMWExtWMDestroyFrame - Unregistering %s: ", pszClass);
- iReturn = UnregisterClass (pszClass, hInstance);
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ HICON hIcon;
+ HICON hIconSm;
+ HMODULE hInstance;
+ int iReturn;
+ char pszClass[CLASS_NAME_LENGTH];
+
+ winDebug("winMWExtWMDestroyFrame (%08x) %08x\n",
+ (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
+
+ /* Store the info we need to destroy after this window is gone */
+ hInstance = (HINSTANCE) GetClassLongPtr(pRLWinPriv->hWnd, GCLP_HMODULE);
+ hIcon = (HICON) SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
+ hIconSm = (HICON) SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
+ iReturn = GetClassName(pRLWinPriv->hWnd, pszClass, CLASS_NAME_LENGTH);
+
+ pRLWinPriv->fClose = TRUE;
+ pRLWinPriv->fDestroyed = TRUE;
+
+ /* Destroy the Windows window */
+ DestroyWindow(pRLWinPriv->hWnd);
+
+ /* Only if we were able to get the name */
+ if (iReturn) {
+ winDebug("winMWExtWMDestroyFrame - Unregistering %s: ", pszClass);
+ iReturn = UnregisterClass(pszClass, hInstance);
- winDebug ("winMWExtWMDestroyFramew - Deleting Icon\n");
+ winDebug ("winMWExtWMDestroyFramew - Deleting Icon\n");
}
winDestroyIcon(hiconClass);
winDestroyIcon(hiconSmClass);
- winDebug ("winMWExtWMDestroyFrame - done\n");
+ winDebug("winMWExtWMDestroyFrame - done\n");
}
void
-winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int iNewX, int iNewY)
+winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX,
+ int iNewY)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- RECT rcNew;
- DWORD dwExStyle;
- DWORD dwStyle;
- int iX, iY, iWidth, iHeight;
-
- winDebug ("winMWExtWMMoveFrame (%08x) (%d %d)\n", (int) pRLWinPriv, iNewX, iNewY);
-
- /* Get the Windows window style and extended style */
- dwExStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE);
-
- /* Get the X and Y location of the X window */
- iX = iNewX + GetSystemMetrics (SM_XVIRTUALSCREEN);
- iY = iNewY + GetSystemMetrics (SM_YVIRTUALSCREEN);
-
- /* Get the height and width of the X window */
- iWidth = pRLWinPriv->pFrame->width;
- iHeight = pRLWinPriv->pFrame->height;
-
- /* Store the origin, height, and width in a rectangle structure */
- SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
-
- winDebug("\tWindow {%d, %d, %d, %d}, {%d, %d}\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
- /*
- * Calculate the required size of the Windows window rectangle,
- * given the size of the Windows window client area.
- */
- AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
-
- winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
- g_fNoConfigureWindow = TRUE;
- SetWindowPos (pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, 0, 0,
- SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
- g_fNoConfigureWindow = FALSE;
- winDebug ("winMWExtWMMoveFrame (%08x) done\n", (int) pRLWinPriv);
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ RECT rcNew;
+ DWORD dwExStyle;
+ DWORD dwStyle;
+ int iX, iY, iWidth, iHeight;
+
+ winDebug("winMWExtWMMoveFrame (%08x) (%d %d)\n", (int) pRLWinPriv, iNewX,
+ iNewY);
+
+ /* Get the Windows window style and extended style */
+ dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE);
+
+ /* Get the X and Y location of the X window */
+ iX = iNewX + GetSystemMetrics(SM_XVIRTUALSCREEN);
+ iY = iNewY + GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ /* Get the height and width of the X window */
+ iWidth = pRLWinPriv->pFrame->width;
+ iHeight = pRLWinPriv->pFrame->height;
+
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight);
+
+ winDebug("\tWindow {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx(&rcNew, dwStyle, FALSE, dwExStyle);
+
+ winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ g_fNoConfigureWindow = TRUE;
+ SetWindowPos(pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, 0, 0,
+ SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
+ g_fNoConfigureWindow = FALSE;
+ winDebug("winMWExtWMMoveFrame (%08x) done\n", (int) pRLWinPriv);
}
void
-winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
- int iNewX, int iNewY,
- unsigned int uiNewWidth, unsigned int uiNewHeight,
- unsigned int uiGravity)
+winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
+ int iNewX, int iNewY,
+ unsigned int uiNewWidth, unsigned int uiNewHeight,
+ unsigned int uiGravity)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- RECT rcNew;
- RECT rcOld;
- DWORD dwExStyle;
- DWORD dwStyle;
- int iX, iY;
-
- winDebug ("winMWExtWMResizeFrame (%08x) (%d %d)-(%d %d)\n",
- (int) pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight);
-
- pRLWinPriv->fResized = TRUE;
-
- /* Get the Windows window style and extended style */
- dwExStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE);
-
- /* Get the X and Y location of the X window */
- iX = iNewX + GetSystemMetrics (SM_XVIRTUALSCREEN);
- iY = iNewY + GetSystemMetrics (SM_YVIRTUALSCREEN);
-
- /* Store the origin, height, and width in a rectangle structure */
- SetRect (&rcNew, iX, iY, iX + uiNewWidth, iY + uiNewHeight);
-
- /*
- * Calculate the required size of the Windows window rectangle,
- * given the size of the Windows window client area.
- */
- AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
-
- /* Get a rectangle describing the old Windows window */
- GetWindowRect (pRLWinPriv->hWnd, &rcOld);
-
- /* Check if the old rectangle and new rectangle are the same */
- if (!EqualRect (&rcNew, &rcOld))
- {
-
- g_fNoConfigureWindow = TRUE;
- MoveWindow (pRLWinPriv->hWnd,
- rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
- TRUE);
- g_fNoConfigureWindow = FALSE;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ RECT rcNew;
+ RECT rcOld;
+ DWORD dwExStyle;
+ DWORD dwStyle;
+ int iX, iY;
+
+ winDebug("winMWExtWMResizeFrame (%08x) (%d %d)-(%d %d)\n",
+ (int) pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight);
+
+ pRLWinPriv->fResized = TRUE;
+
+ /* Get the Windows window style and extended style */
+ dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE);
+
+ /* Get the X and Y location of the X window */
+ iX = iNewX + GetSystemMetrics(SM_XVIRTUALSCREEN);
+ iY = iNewY + GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect(&rcNew, iX, iY, iX + uiNewWidth, iY + uiNewHeight);
+
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx(&rcNew, dwStyle, FALSE, dwExStyle);
+
+ /* Get a rectangle describing the old Windows window */
+ GetWindowRect(pRLWinPriv->hWnd, &rcOld);
+
+ /* Check if the old rectangle and new rectangle are the same */
+ if (!EqualRect(&rcNew, &rcOld)) {
+
+ g_fNoConfigureWindow = TRUE;
+ MoveWindow(pRLWinPriv->hWnd,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, TRUE);
+ g_fNoConfigureWindow = FALSE;
}
}
void
-winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid)
+winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- win32RootlessWindowPtr pRLNextWinPriv = (win32RootlessWindowPtr) nextWid;
- winScreenPriv(pRLWinPriv->pFrame->win->drawable.pScreen);
- winScreenInfo *pScreenInfo = NULL;
- DWORD dwCurrentProcessID = GetCurrentProcessId ();
- DWORD dwWindowProcessID = 0;
- HWND hWnd;
- Bool fFirst = TRUE;
- Bool fNeedRestack = TRUE;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ win32RootlessWindowPtr pRLNextWinPriv = (win32RootlessWindowPtr) nextWid;
+
+ winScreenPriv(pRLWinPriv->pFrame->win->drawable.pScreen);
+ winScreenInfo *pScreenInfo = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId();
+ DWORD dwWindowProcessID = 0;
+ HWND hWnd;
+ Bool fFirst = TRUE;
+ Bool fNeedRestack = TRUE;
- winDebug ("winMWExtWMRestackFrame (%08x)\n", (int) pRLWinPriv);
+ winDebug("winMWExtWMRestackFrame (%08x)\n", (int) pRLWinPriv);
- if (pScreenPriv && pScreenPriv->fRestacking) return;
+ if (pScreenPriv && pScreenPriv->fRestacking)
+ return;
- if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
+ if (pScreenPriv)
+ pScreenInfo = pScreenPriv->pScreenInfo;
- pRLWinPriv->fRestackingNow = TRUE;
+ pRLWinPriv->fRestackingNow = TRUE;
- /* Show window */
- if(!IsWindowVisible (pRLWinPriv->hWnd))
- ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE);
+ /* Show window */
+ if (!IsWindowVisible(pRLWinPriv->hWnd))
+ ShowWindow(pRLWinPriv->hWnd, SW_SHOWNOACTIVATE);
- if (pRLNextWinPriv == NULL)
- {
- winDebug ("Win %08x is top\n", pRLWinPriv);
- pScreenPriv->widTop = wid;
- SetWindowPos (pRLWinPriv->hWnd, HWND_TOP,
- 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ if (pRLNextWinPriv == NULL) {
+ winDebug("Win %08x is top\n", pRLWinPriv);
+ pScreenPriv->widTop = wid;
+ SetWindowPos(pRLWinPriv->hWnd, HWND_TOP,
+ 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
#ifdef XWIN_MULTIWINDOWINTWM
- else if (winIsInternalWMRunning(pScreenInfo))
- {
+ else if (winIsInternalWMRunning(pScreenInfo)) {
/* using mulwinidow wm */
- winDebug ("Win %08x is not top\n", pRLWinPriv);
-
- for (hWnd = GetNextWindow (pRLWinPriv->hWnd, GW_HWNDPREV);
- fNeedRestack && hWnd != NULL;
- hWnd = GetNextWindow (hWnd, GW_HWNDPREV))
- {
- GetWindowThreadProcessId (hWnd, &dwWindowProcessID);
-
- if ((dwWindowProcessID == dwCurrentProcessID)
- && GetProp (hWnd, WIN_WINDOW_PROP))
- {
- if (hWnd == pRLNextWinPriv->hWnd)
- {
- /* Enable interleave X window and Windows window */
- if (!fFirst)
- {
- winDebug ("raise: Insert after Win %08x\n", pRLNextWinPriv);
-
- SetWindowPos (pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
- 0, 0, 0, 0,
- SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
- }
- else
- {
- winDebug ("No change\n");
- }
- fNeedRestack = FALSE;
- break;
- }
- if (fFirst) fFirst = FALSE;
- }
- }
-
- for (hWnd = GetNextWindow (pRLWinPriv->hWnd, GW_HWNDNEXT);
- fNeedRestack && hWnd != NULL;
- hWnd = GetNextWindow (hWnd, GW_HWNDNEXT))
- {
- GetWindowThreadProcessId (hWnd, &dwWindowProcessID);
-
- if ((dwWindowProcessID == dwCurrentProcessID)
- && GetProp (hWnd, WIN_WINDOW_PROP))
- {
- if (hWnd == pRLNextWinPriv->hWnd)
- {
- winDebug ("lower: Insert after Win %08x\n", pRLNextWinPriv);
-
- SetWindowPos (pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
- 0, 0, 0, 0,
- SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
- fNeedRestack = FALSE;
- break;
- }
- }
- }
+ winDebug("Win %08x is not top\n", pRLWinPriv);
+
+ for (hWnd = GetNextWindow(pRLWinPriv->hWnd, GW_HWNDPREV);
+ fNeedRestack && hWnd != NULL;
+ hWnd = GetNextWindow(hWnd, GW_HWNDPREV)) {
+ GetWindowThreadProcessId(hWnd, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp(hWnd, WIN_WINDOW_PROP)) {
+ if (hWnd == pRLNextWinPriv->hWnd) {
+ /* Enable interleave X window and Windows window */
+ if (!fFirst) {
+ winDebug("raise: Insert after Win %08x\n",
+ pRLNextWinPriv);
+ SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
+ 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ }
+ else {
+ winDebug("No change\n");
+ }
+ fNeedRestack = FALSE;
+ break;
+ }
+ if (fFirst)
+ fFirst = FALSE;
+ }
+ }
+
+ for (hWnd = GetNextWindow(pRLWinPriv->hWnd, GW_HWNDNEXT);
+ fNeedRestack && hWnd != NULL;
+ hWnd = GetNextWindow(hWnd, GW_HWNDNEXT)) {
+ GetWindowThreadProcessId(hWnd, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp(hWnd, WIN_WINDOW_PROP)) {
+ if (hWnd == pRLNextWinPriv->hWnd) {
+ winDebug("lower: Insert after Win %08x\n", pRLNextWinPriv);
+
+ SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
+ 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ fNeedRestack = FALSE;
+ break;
+ }
+ }
+ }
}
#endif
- else
- {
- /* using general wm like twm, wmaker etc.
- Interleave X window and Windows window will cause problem. */
- SetWindowPos (pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
- 0, 0, 0, 0,
- SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ else {
+ /* using general wm like twm, wmaker etc.
+ Interleave X window and Windows window will cause problem. */
+ SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
+ 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
- winDebug ("winMWExtWMRestackFrame - done (%08x)\n", (int) pRLWinPriv);
+ winDebug("winMWExtWMRestackFrame - done (%08x)\n", (int) pRLWinPriv);
- pRLWinPriv->fRestackingNow = FALSE;
+ pRLWinPriv->fRestackingNow = FALSE;
}
void
-winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape)
+winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- HRGN hRgn, hRgnWindow, hRgnClient;
- RECT rcWindow, rcClient;
-
- winDebug ("winMWExtWMReshapeFrame (%08x)\n", (int) pRLWinPriv);
-
- hRgn = winMWExtWMCreateRgnFromRegion (pShape);
-
- /* Create region for non-client area */
- GetWindowRect (pRLWinPriv->hWnd, &rcWindow);
- GetClientRect (pRLWinPriv->hWnd, &rcClient);
- MapWindowPoints (pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2);
- OffsetRgn (hRgn, rcClient.left - rcWindow.left, rcClient.top - rcWindow.top);
- OffsetRect (&rcClient, -rcWindow.left, -rcWindow.top);
- OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
- hRgnWindow = CreateRectRgnIndirect (&rcWindow);
- hRgnClient = CreateRectRgnIndirect (&rcClient);
- CombineRgn (hRgnWindow, hRgnWindow, hRgnClient, RGN_DIFF);
- CombineRgn (hRgn, hRgnWindow, hRgn, RGN_OR);
-
-
- SetWindowRgn (pRLWinPriv->hWnd, hRgn, TRUE);
-
- DeleteObject (hRgnWindow);
- DeleteObject (hRgnClient);
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ HRGN hRgn, hRgnWindow, hRgnClient;
+ RECT rcWindow, rcClient;
+
+ winDebug("winMWExtWMReshapeFrame (%08x)\n", (int) pRLWinPriv);
+
+ hRgn = winMWExtWMCreateRgnFromRegion(pShape);
+
+ /* Create region for non-client area */
+ GetWindowRect(pRLWinPriv->hWnd, &rcWindow);
+ GetClientRect(pRLWinPriv->hWnd, &rcClient);
+ MapWindowPoints(pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+ OffsetRgn(hRgn, rcClient.left - rcWindow.left, rcClient.top - rcWindow.top);
+ OffsetRect(&rcClient, -rcWindow.left, -rcWindow.top);
+ OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top);
+ hRgnWindow = CreateRectRgnIndirect(&rcWindow);
+ hRgnClient = CreateRectRgnIndirect(&rcClient);
+ CombineRgn(hRgnWindow, hRgnWindow, hRgnClient, RGN_DIFF);
+ CombineRgn(hRgn, hRgnWindow, hRgn, RGN_OR);
+
+ SetWindowRgn(pRLWinPriv->hWnd, hRgn, TRUE);
+
+ DeleteObject(hRgnWindow);
+ DeleteObject(hRgnClient);
}
void
-winMWExtWMUnmapFrame (RootlessFrameID wid)
+winMWExtWMUnmapFrame(RootlessFrameID wid)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- winDebug ("winMWExtWMUnmapFrame (%08x)\n", (int) pRLWinPriv);
+ winDebug("winMWExtWMUnmapFrame (%08x)\n", (int) pRLWinPriv);
- g_fNoConfigureWindow = TRUE;
- //ShowWindow (pRLWinPriv->hWnd, SW_MINIMIZE);
- ShowWindow (pRLWinPriv->hWnd, SW_HIDE);
- g_fNoConfigureWindow = FALSE;
+ g_fNoConfigureWindow = TRUE;
+ //ShowWindow (pRLWinPriv->hWnd, SW_MINIMIZE);
+ ShowWindow(pRLWinPriv->hWnd, SW_HIDE);
+ g_fNoConfigureWindow = FALSE;
}
/*
* Fixme: Code sharing with winshadgdi.c and other engine support
*/
void
-winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow)
+winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- winPrivScreenPtr pScreenPriv = NULL;
- winScreenInfo *pScreenInfo = NULL;
- ScreenPtr pScreen = NULL;
- DIBSECTION dibsection;
- Bool fReturn = TRUE;
- HDC hdcNew;
- HBITMAP hbmpNew;
-
- winDebug ("winMWExtWMStartDrawing (%08x) %08x\n", (int) pRLWinPriv, pRLWinPriv->fDestroyed);
-
- if (!pRLWinPriv->fDestroyed)
- {
- pScreen = pRLWinPriv->pFrame->win->drawable.pScreen;
- if (pScreen) pScreenPriv = winGetScreenPriv(pScreen);
- if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
-
- winDebug ("\tpScreenPriv %08X\n", (int) pScreenPriv);
- winDebug ("\tpScreenInfo %08X\n", (int) pScreenInfo);
- winDebug ("\t(%d, %d)\n", (int)pRLWinPriv->pFrame->width,
- (int) pRLWinPriv->pFrame->height);
-
- if (pRLWinPriv->hdcScreen == NULL)
- {
- InitWin32RootlessEngine (pRLWinPriv);
- }
-
- if (pRLWinPriv->fResized)
- {
- /* width * bpp must be multiple of 4 to match 32bit alignment */
- int stridesize;
- int misalignment;
-
- pRLWinPriv->pbmihShadow->biWidth = pRLWinPriv->pFrame->width;
- pRLWinPriv->pbmihShadow->biHeight = -pRLWinPriv->pFrame->height;
-
- stridesize = pRLWinPriv->pFrame->width * (pScreenInfo->dwBPP >> 3);
- misalignment = stridesize & 3;
- if (misalignment != 0)
- {
- stridesize += 4 - misalignment;
- pRLWinPriv->pbmihShadow->biWidth = stridesize / (pScreenInfo->dwBPP >> 3);
- winDebug("\tresizing to %d (was %d)\n",
- pRLWinPriv->pbmihShadow->biWidth, pRLWinPriv->pFrame->width);
- }
-
- hdcNew = CreateCompatibleDC (pRLWinPriv->hdcScreen);
- /* Create a DI shadow bitmap with a bit pointer */
- hbmpNew = CreateDIBSection (pRLWinPriv->hdcScreen,
- (BITMAPINFO *) pRLWinPriv->pbmihShadow,
- DIB_RGB_COLORS,
- (VOID**) &pRLWinPriv->pfb,
- NULL,
- 0);
- if (hbmpNew == NULL || pRLWinPriv->pfb == NULL)
- {
- ErrorF ("winMWExtWMStartDrawing - CreateDIBSection failed\n");
- //return FALSE;
- }
- else
- {
- winDebug ("winMWExtWMStartDrawing - Shadow buffer allocated\n");
- }
-
- /* Get information about the bitmap that was allocated */
- GetObject (hbmpNew, sizeof (dibsection), &dibsection);
-
- /* Print information about bitmap allocated */
- winDebug ("winMWExtWMStartDrawing - Dibsection width: %d height: %d "
- "depth: %d size image: %d\n",
- (unsigned int)dibsection.dsBmih.biWidth,
- (unsigned int)dibsection.dsBmih.biHeight,
- (unsigned int)dibsection.dsBmih.biBitCount,
- (unsigned int)dibsection.dsBmih.biSizeImage);
-
- /* Select the shadow bitmap into the shadow DC */
- SelectObject (hdcNew, hbmpNew);
-
- winDebug ("winMWExtWMStartDrawing - Attempting a shadow blit\n");
-
- /* Blit from the old shadow to the new shadow */
- fReturn = BitBlt (hdcNew,
- 0, 0,
- pRLWinPriv->pFrame->width, pRLWinPriv->pFrame->height,
- pRLWinPriv->hdcShadow,
- 0, 0,
- SRCCOPY);
- if (fReturn)
- {
- winDebug ("winMWExtWMStartDrawing - Shadow blit success\n");
- }
- else
- {
- ErrorF ("winMWExtWMStartDrawing - Shadow blit failure\n");
- }
-
- /* Look for height weirdness */
- if (dibsection.dsBmih.biHeight < 0)
- {
- /* FIXME: Figure out why biHeight is sometimes negative */
- ErrorF ("winMWExtWMStartDrawing - WEIRDNESS - "
- "biHeight still negative: %d\n",
- (int) dibsection.dsBmih.biHeight);
- ErrorF ("winMWExtWMStartDrawing - WEIRDNESS - "
- "Flipping biHeight sign\n");
- dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight;
- }
-
- pRLWinPriv->dwWidthBytes = dibsection.dsBm.bmWidthBytes;
-
- winDebug ("winMWExtWMStartDrawing - bytesPerRow: %d\n",
- (unsigned int)dibsection.dsBm.bmWidthBytes);
-
- /* Free the old shadow bitmap */
- DeleteObject (pRLWinPriv->hdcShadow);
- DeleteObject (pRLWinPriv->hbmpShadow);
-
- pRLWinPriv->hdcShadow = hdcNew;
- pRLWinPriv->hbmpShadow = hbmpNew;
-
- pRLWinPriv->fResized = FALSE;
- winDebug ("winMWExtWMStartDrawing - 0x%08x %d\n",
- (unsigned int)pRLWinPriv->pfb,
- (unsigned int)dibsection.dsBm.bmWidthBytes);
- }
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+ ScreenPtr pScreen = NULL;
+ DIBSECTION dibsection;
+ Bool fReturn = TRUE;
+ HDC hdcNew;
+ HBITMAP hbmpNew;
+
+ winDebug("winMWExtWMStartDrawing (%08x) %08x\n", (int) pRLWinPriv,
+ pRLWinPriv->fDestroyed);
+
+ if (!pRLWinPriv->fDestroyed) {
+ pScreen = pRLWinPriv->pFrame->win->drawable.pScreen;
+ if (pScreen)
+ pScreenPriv = winGetScreenPriv(pScreen);
+ if (pScreenPriv)
+ pScreenInfo = pScreenPriv->pScreenInfo;
+
+ winDebug("\tpScreenPriv %08X\n", (int) pScreenPriv);
+ winDebug("\tpScreenInfo %08X\n", (int) pScreenInfo);
+ winDebug("\t(%d, %d)\n", (int) pRLWinPriv->pFrame->width,
+ (int) pRLWinPriv->pFrame->height);
+
+ if (pRLWinPriv->hdcScreen == NULL) {
+ InitWin32RootlessEngine(pRLWinPriv);
+ }
+
+ if (pRLWinPriv->fResized) {
+ /* width * bpp must be multiple of 4 to match 32bit alignment */
+ int stridesize;
+ int misalignment;
+
+ pRLWinPriv->pbmihShadow->biWidth = pRLWinPriv->pFrame->width;
+ pRLWinPriv->pbmihShadow->biHeight = -pRLWinPriv->pFrame->height;
+
+ stridesize = pRLWinPriv->pFrame->width * (pScreenInfo->dwBPP >> 3);
+ misalignment = stridesize & 3;
+ if (misalignment != 0) {
+ stridesize += 4 - misalignment;
+ pRLWinPriv->pbmihShadow->biWidth =
+ stridesize / (pScreenInfo->dwBPP >> 3);
+ winDebug("\tresizing to %d (was %d)\n",
+ pRLWinPriv->pbmihShadow->biWidth,
+ pRLWinPriv->pFrame->width);
+ }
+
+ hdcNew = CreateCompatibleDC(pRLWinPriv->hdcScreen);
+ /* Create a DI shadow bitmap with a bit pointer */
+ hbmpNew = CreateDIBSection(pRLWinPriv->hdcScreen,
+ (BITMAPINFO *) pRLWinPriv->pbmihShadow,
+ DIB_RGB_COLORS,
+ (VOID **) & pRLWinPriv->pfb, NULL, 0);
+ if (hbmpNew == NULL || pRLWinPriv->pfb == NULL) {
+ ErrorF("winMWExtWMStartDrawing - CreateDIBSection failed\n");
+ //return FALSE;
+ }
+ else {
+ winDebug("winMWExtWMStartDrawing - Shadow buffer allocated\n");
+ }
+
+ /* Get information about the bitmap that was allocated */
+ GetObject(hbmpNew, sizeof(dibsection), &dibsection);
+
+ /* Print information about bitmap allocated */
+ winDebug("winMWExtWMStartDrawing - Dibsection width: %d height: %d "
+ "depth: %d size image: %d\n",
+ (unsigned int) dibsection.dsBmih.biWidth,
+ (unsigned int) dibsection.dsBmih.biHeight,
+ (unsigned int) dibsection.dsBmih.biBitCount,
+ (unsigned int) dibsection.dsBmih.biSizeImage);
+
+ /* Select the shadow bitmap into the shadow DC */
+ SelectObject(hdcNew, hbmpNew);
+
+ winDebug("winMWExtWMStartDrawing - Attempting a shadow blit\n");
+
+ /* Blit from the old shadow to the new shadow */
+ fReturn = BitBlt(hdcNew,
+ 0, 0,
+ pRLWinPriv->pFrame->width,
+ pRLWinPriv->pFrame->height, pRLWinPriv->hdcShadow,
+ 0, 0, SRCCOPY);
+ if (fReturn) {
+ winDebug("winMWExtWMStartDrawing - Shadow blit success\n");
+ }
+ else {
+ ErrorF("winMWExtWMStartDrawing - Shadow blit failure\n");
+ }
+
+ /* Look for height weirdness */
+ if (dibsection.dsBmih.biHeight < 0) {
+ /* FIXME: Figure out why biHeight is sometimes negative */
+ ErrorF("winMWExtWMStartDrawing - WEIRDNESS - "
+ "biHeight still negative: %d\n",
+ (int) dibsection.dsBmih.biHeight);
+ ErrorF("winMWExtWMStartDrawing - WEIRDNESS - "
+ "Flipping biHeight sign\n");
+ dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight;
+ }
+
+ pRLWinPriv->dwWidthBytes = dibsection.dsBm.bmWidthBytes;
+
+ winDebug("winMWExtWMStartDrawing - bytesPerRow: %d\n",
+ (unsigned int) dibsection.dsBm.bmWidthBytes);
+
+ /* Free the old shadow bitmap */
+ DeleteObject(pRLWinPriv->hdcShadow);
+ DeleteObject(pRLWinPriv->hbmpShadow);
+
+ pRLWinPriv->hdcShadow = hdcNew;
+ pRLWinPriv->hbmpShadow = hbmpNew;
+
+ pRLWinPriv->fResized = FALSE;
+ winDebug("winMWExtWMStartDrawing - 0x%08x %d\n",
+ (unsigned int) pRLWinPriv->pfb,
+ (unsigned int) dibsection.dsBm.bmWidthBytes);
+ }
}
- else
- {
- ErrorF ("winMWExtWMStartDrawing - Already window was destroyed \n");
+ else {
+ ErrorF("winMWExtWMStartDrawing - Already window was destroyed \n");
}
- winDebug ("winMWExtWMStartDrawing - done (0x%08x) 0x%08x %d\n",
- (int) pRLWinPriv,
- (unsigned int)pRLWinPriv->pfb, (unsigned int)pRLWinPriv->dwWidthBytes);
- *pixelData = pRLWinPriv->pfb;
- *bytesPerRow = pRLWinPriv->dwWidthBytes;
+ winDebug("winMWExtWMStartDrawing - done (0x%08x) 0x%08x %d\n",
+ (int) pRLWinPriv,
+ (unsigned int) pRLWinPriv->pfb,
+ (unsigned int) pRLWinPriv->dwWidthBytes);
+ *pixelData = pRLWinPriv->pfb;
+ *bytesPerRow = pRLWinPriv->dwWidthBytes;
}
void
-winMWExtWMStopDrawing (RootlessFrameID wid, Bool fFlush)
+winMWExtWMStopDrawing(RootlessFrameID wid, Bool fFlush)
{
}
void
-winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage)
+winMWExtWMUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- if (!g_fNoConfigureWindow) UpdateWindow (pRLWinPriv->hWnd);
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+
+ if (!g_fNoConfigureWindow)
+ UpdateWindow(pRLWinPriv->hWnd);
}
void
-winMWExtWMDamageRects (RootlessFrameID wid, int nCount, const BoxRec *pRects,
- int shift_x, int shift_y)
+winMWExtWMDamageRects(RootlessFrameID wid, int nCount, const BoxRec * pRects,
+ int shift_x, int shift_y)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- const BoxRec *pEnd;
- winDebug ("winMWExtWMDamageRects (%08x, %d, %08x, %d, %d)\n",
- pRLWinPriv, nCount, pRects, shift_x, shift_y);
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ const BoxRec *pEnd;
- for (pEnd = pRects + nCount; pRects < pEnd; pRects++) {
+ winDebug("winMWExtWMDamageRects (%08x, %d, %08x, %d, %d)\n",
+ pRLWinPriv, nCount, pRects, shift_x, shift_y);
+
+ for (pEnd = pRects + nCount; pRects < pEnd; pRects++) {
RECT rcDmg;
+
rcDmg.left = pRects->x1 + shift_x;
rcDmg.top = pRects->y1 + shift_y;
rcDmg.right = pRects->x2 + shift_x;
rcDmg.bottom = pRects->y2 + shift_y;
- InvalidateRect (pRLWinPriv->hWnd, &rcDmg, FALSE);
+ InvalidateRect(pRLWinPriv->hWnd, &rcDmg, FALSE);
}
}
void
-winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin)
+winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
- winDebug ("winMWExtWMRootlessSwitchWindow (%08x) %08x\n",
- (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
- pRLWinPriv->pFrame = pFrame;
- pRLWinPriv->fResized = TRUE;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
+
+ winDebug("winMWExtWMRootlessSwitchWindow (%08x) %08x\n",
+ (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
+ pRLWinPriv->pFrame = pFrame;
+ pRLWinPriv->fResized = TRUE;
- /* Set the window extended style flags */
- SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
+ /* Set the window extended style flags */
+ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
- /* Set the window standard style flags */
- SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE,
- WS_POPUP | WS_CLIPCHILDREN);
+ /* Set the window standard style flags */
+ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN);
- DeleteProperty (serverClient, oldWin, AtmWindowsWmNativeHwnd ());
- winMWExtWMSetNativeProperty (pFrame);
+ DeleteProperty(serverClient, oldWin, AtmWindowsWmNativeHwnd());
+ winMWExtWMSetNativeProperty(pFrame);
}
void
-winMWExtWMCopyBytes (unsigned int width, unsigned int height,
- const void *src, unsigned int srcRowBytes,
- void *dst, unsigned int dstRowBytes)
+winMWExtWMCopyBytes(unsigned int width, unsigned int height,
+ const void *src, unsigned int srcRowBytes,
+ void *dst, unsigned int dstRowBytes)
{
- winDebug ("winMWExtWMCopyBytes - Not implemented\n");
+ winDebug("winMWExtWMCopyBytes - Not implemented\n");
}
void
-winMWExtWMCopyWindow (RootlessFrameID wid, int nDstRects, const BoxRec *pDstRects,
- int nDx, int nDy)
+winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects,
+ const BoxRec * pDstRects, int nDx, int nDy)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- const BoxRec *pEnd;
- RECT rcDmg;
- winDebug ("winMWExtWMCopyWindow (%08x, %d, %08x, %d, %d)\n",
- (int) pRLWinPriv, nDstRects, (int) pDstRects, nDx, nDy);
-
- for (pEnd = pDstRects + nDstRects; pDstRects < pEnd; pDstRects++)
- {
- winDebug ("BitBlt (%d, %d, %d, %d) (%d, %d)\n",
- pDstRects->x1, pDstRects->y1,
- pDstRects->x2 - pDstRects->x1,
- pDstRects->y2 - pDstRects->y1,
- pDstRects->x1 + nDx,
- pDstRects->y1 + nDy);
-
- if (!BitBlt (pRLWinPriv->hdcShadow,
- pDstRects->x1, pDstRects->y1,
- pDstRects->x2 - pDstRects->x1,
- pDstRects->y2 - pDstRects->y1,
- pRLWinPriv->hdcShadow,
- pDstRects->x1 + nDx, pDstRects->y1 + nDy,
- SRCCOPY))
- {
- ErrorF ("winMWExtWMCopyWindow - BitBlt failed.\n");
- }
-
- rcDmg.left = pDstRects->x1;
- rcDmg.top = pDstRects->y1;
- rcDmg.right = pDstRects->x2;
- rcDmg.bottom = pDstRects->y2;
-
- InvalidateRect (pRLWinPriv->hWnd, &rcDmg, FALSE);
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ const BoxRec *pEnd;
+ RECT rcDmg;
+
+ winDebug("winMWExtWMCopyWindow (%08x, %d, %08x, %d, %d)\n",
+ (int) pRLWinPriv, nDstRects, (int) pDstRects, nDx, nDy);
+
+ for (pEnd = pDstRects + nDstRects; pDstRects < pEnd; pDstRects++) {
+ winDebug("BitBlt (%d, %d, %d, %d) (%d, %d)\n",
+ pDstRects->x1, pDstRects->y1,
+ pDstRects->x2 - pDstRects->x1,
+ pDstRects->y2 - pDstRects->y1,
+ pDstRects->x1 + nDx, pDstRects->y1 + nDy);
+
+ if (!BitBlt(pRLWinPriv->hdcShadow,
+ pDstRects->x1, pDstRects->y1,
+ pDstRects->x2 - pDstRects->x1,
+ pDstRects->y2 - pDstRects->y1,
+ pRLWinPriv->hdcShadow,
+ pDstRects->x1 + nDx, pDstRects->y1 + nDy, SRCCOPY)) {
+ ErrorF("winMWExtWMCopyWindow - BitBlt failed.\n");
+ }
+
+ rcDmg.left = pDstRects->x1;
+ rcDmg.top = pDstRects->y1;
+ rcDmg.right = pDstRects->x2;
+ rcDmg.bottom = pDstRects->y2;
+
+ InvalidateRect(pRLWinPriv->hWnd, &rcDmg, FALSE);
}
- winDebug ("winMWExtWMCopyWindow - done\n");
+ winDebug("winMWExtWMCopyWindow - done\n");
}
-
/*
* winMWExtWMSetNativeProperty
*/
static void
-winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame)
+winMWExtWMSetNativeProperty(RootlessWindowPtr pFrame)
{
- win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
- long lData;
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
+ long lData;
- /* FIXME: move this to WindowsWM extension */
+ /* FIXME: move this to WindowsWM extension */
- lData = (long) pRLWinPriv->hWnd;
- dixChangeWindowProperty(serverClient, pFrame->win, AtmWindowsWmNativeHwnd(),
- XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
+ lData = (long) pRLWinPriv->hWnd;
+ dixChangeWindowProperty(serverClient, pFrame->win, AtmWindowsWmNativeHwnd(),
+ XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
}
diff --git a/xorg-server/hw/xwin/winwin32rootlesswindow.c b/xorg-server/hw/xwin/winwin32rootlesswindow.c
index bcfb2798e..19478ad60 100644
--- a/xorg-server/hw/xwin/winwin32rootlesswindow.c
+++ b/xorg-server/hw/xwin/winwin32rootlesswindow.c
@@ -42,345 +42,333 @@
*/
void
-winMWExtWMReorderWindows (ScreenPtr pScreen)
+winMWExtWMReorderWindows(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- HWND hwnd = NULL;
- win32RootlessWindowPtr pRLWin = NULL;
- win32RootlessWindowPtr pRLWinSib = NULL;
- DWORD dwCurrentProcessID = GetCurrentProcessId ();
- DWORD dwWindowProcessID = 0;
- XID vlist[2];
+ winScreenPriv(pScreen);
+ HWND hwnd = NULL;
+ win32RootlessWindowPtr pRLWin = NULL;
+ win32RootlessWindowPtr pRLWinSib = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId();
+ DWORD dwWindowProcessID = 0;
+ XID vlist[2];
#if CYGMULTIWINDOW_DEBUG && FALSE
- winDebug ("winMWExtWMReorderWindows\n");
+ winDebug("winMWExtWMReorderWindows\n");
#endif
- pScreenPriv->fRestacking = TRUE;
+ pScreenPriv->fRestacking = TRUE;
- if (pScreenPriv->fWindowOrderChanged)
- {
+ if (pScreenPriv->fWindowOrderChanged) {
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMReorderWindows - Need to restack\n");
+ winDebug("winMWExtWMReorderWindows - Need to restack\n");
#endif
- hwnd = GetTopWindow (NULL);
-
- while (hwnd)
- {
- GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
-
- if ((dwWindowProcessID == dwCurrentProcessID)
- && GetProp (hwnd, WIN_WINDOW_PROP))
- {
- pRLWinSib = pRLWin;
- pRLWin = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP);
-
- if (pRLWinSib)
- {
- vlist[0] = pRLWinSib->pFrame->win->drawable.id;
- vlist[1] = Below;
-
- ConfigureWindow (pRLWin->pFrame->win, CWSibling | CWStackMode,
- vlist, wClient(pRLWin->pFrame->win));
- }
- else
- {
- /* 1st window - raise to the top */
- vlist[0] = Above;
-
- ConfigureWindow (pRLWin->pFrame->win, CWStackMode,
- vlist, wClient(pRLWin->pFrame->win));
- }
- }
- hwnd = GetNextWindow (hwnd, GW_HWNDNEXT);
- }
+ hwnd = GetTopWindow(NULL);
+
+ while (hwnd) {
+ GetWindowThreadProcessId(hwnd, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp(hwnd, WIN_WINDOW_PROP)) {
+ pRLWinSib = pRLWin;
+ pRLWin =
+ (win32RootlessWindowPtr) GetProp(hwnd, WIN_WINDOW_PROP);
+
+ if (pRLWinSib) {
+ vlist[0] = pRLWinSib->pFrame->win->drawable.id;
+ vlist[1] = Below;
+
+ ConfigureWindow(pRLWin->pFrame->win,
+ CWSibling | CWStackMode, vlist,
+ wClient(pRLWin->pFrame->win));
+ }
+ else {
+ /* 1st window - raise to the top */
+ vlist[0] = Above;
+
+ ConfigureWindow(pRLWin->pFrame->win, CWStackMode,
+ vlist, wClient(pRLWin->pFrame->win));
+ }
+ }
+ hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
+ }
}
- pScreenPriv->fRestacking = FALSE;
- pScreenPriv->fWindowOrderChanged = FALSE;
+ pScreenPriv->fRestacking = FALSE;
+ pScreenPriv->fWindowOrderChanged = FALSE;
}
#endif
-
/*
* winMWExtWMMoveXWindow
*/
void
-winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y)
+winMWExtWMMoveXWindow(WindowPtr pWin, int x, int y)
{
- CARD32 *vlist = malloc(sizeof(CARD32)*2);
+ CARD32 *vlist = malloc(sizeof(CARD32) * 2);
- vlist[0] = x;
- vlist[1] = y;
- ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
- free(vlist);
+ vlist[0] = x;
+ vlist[1] = y;
+ ConfigureWindow(pWin, CWX | CWY, vlist, wClient(pWin));
+ free(vlist);
}
-
/*
* winMWExtWMResizeXWindow
*/
void
-winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h)
+winMWExtWMResizeXWindow(WindowPtr pWin, int w, int h)
{
- CARD32 *vlist = malloc(sizeof(CARD32)*2);
+ CARD32 *vlist = malloc(sizeof(CARD32) * 2);
- vlist[0] = w;
- vlist[1] = h;
- ConfigureWindow (pWin, CWWidth | CWHeight, vlist, wClient(pWin));
- free(vlist);
+ vlist[0] = w;
+ vlist[1] = h;
+ ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
+ free(vlist);
}
-
/*
* winMWExtWMMoveResizeXWindow
*/
void
-winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h)
+winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h)
{
- CARD32 *vlist = malloc(sizeof(long)*4);
+ CARD32 *vlist = malloc(sizeof(long) * 4);
- vlist[0] = x;
- vlist[1] = y;
- vlist[2] = w;
- vlist[3] = h;
+ vlist[0] = x;
+ vlist[1] = y;
+ vlist[2] = w;
+ vlist[3] = h;
- ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin));
- free(vlist);
+ ConfigureWindow(pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin));
+ free(vlist);
}
-
/*
* winMWExtWMUpdateIcon
* Change the Windows window icon
*/
void
-winMWExtWMUpdateIcon (Window id)
+winMWExtWMUpdateIcon(Window id)
{
- WindowPtr pWin;
- HICON hIcon, hiconOld;
+ WindowPtr pWin;
+ HICON hIcon, hiconOld;
- dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess);
- hIcon = winOverrideIcon ((unsigned long)pWin);
+ dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient,
+ DixUnknownAccess);
+ hIcon = winOverrideIcon((unsigned long) pWin);
- if (!hIcon)
- hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));
+ if (!hIcon)
+ hIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXICON));
- if (hIcon)
- {
- win32RootlessWindowPtr pRLWinPriv
- = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
+ if (hIcon) {
+ win32RootlessWindowPtr pRLWinPriv
+ = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
- if (pRLWinPriv->hWnd)
- {
+ if (pRLWinPriv->hWnd) {
- hiconOld = (HICON) SendMessage (pRLWinPriv->hWnd,
- WM_SETICON, ICON_BIG, (LPARAM) hIcon);
- winDestroyIcon(hiconOld);
- }
- hIcon=NULL;
+ hiconOld = (HICON) SendMessage(pRLWinPriv->hWnd,
+ WM_SETICON, ICON_BIG,
+ (LPARAM) hIcon);
+ winDestroyIcon(hiconOld);
+ }
+ hIcon = NULL;
}
}
-
/*
* winMWExtWMDecorateWindow - Update window style. Called by EnumWindows.
*/
wBOOL CALLBACK
-winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam)
+winMWExtWMDecorateWindow(HWND hwnd, LPARAM lParam)
{
- win32RootlessWindowPtr pRLWinPriv = NULL;
- ScreenPtr pScreen = NULL;
- winPrivScreenPtr pScreenPriv = NULL;
- winScreenInfo *pScreenInfo = NULL;
-
- /* Check if the Windows window property for our X window pointer is valid */
- if ((pRLWinPriv = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP)) != NULL)
- {
- if (pRLWinPriv != NULL && pRLWinPriv->pFrame != NULL && pRLWinPriv->pFrame->win != NULL)
- pScreen = pRLWinPriv->pFrame->win->drawable.pScreen;
- if (pScreen) pScreenPriv = winGetScreenPriv(pScreen);
- if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
- if (pRLWinPriv && pScreenInfo) winMWExtWMUpdateWindowDecoration (pRLWinPriv, pScreenInfo);
+ win32RootlessWindowPtr pRLWinPriv = NULL;
+ ScreenPtr pScreen = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pRLWinPriv =
+ (win32RootlessWindowPtr) GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) {
+ if (pRLWinPriv != NULL && pRLWinPriv->pFrame != NULL &&
+ pRLWinPriv->pFrame->win != NULL)
+ pScreen = pRLWinPriv->pFrame->win->drawable.pScreen;
+ if (pScreen)
+ pScreenPriv = winGetScreenPriv(pScreen);
+ if (pScreenPriv)
+ pScreenInfo = pScreenPriv->pScreenInfo;
+ if (pRLWinPriv && pScreenInfo)
+ winMWExtWMUpdateWindowDecoration(pRLWinPriv, pScreenInfo);
}
- return TRUE;
+ return TRUE;
}
-
/*
* winMWExtWMUpdateWindowDecoration - Update window style.
*/
void
-winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
- winScreenInfoPtr pScreenInfo)
+winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv,
+ winScreenInfoPtr pScreenInfo)
{
- Bool fDecorate = FALSE;
- DWORD dwExStyle = 0;
- DWORD dwStyle = 0;
- WINDOWPLACEMENT wndPlace;
- UINT showCmd = 0;
+ Bool fDecorate = FALSE;
+ DWORD dwExStyle = 0;
+ DWORD dwStyle = 0;
+ WINDOWPLACEMENT wndPlace;
+ UINT showCmd = 0;
- wndPlace.length = sizeof (WINDOWPLACEMENT);
+ wndPlace.length = sizeof(WINDOWPLACEMENT);
- /* Get current window placement */
- GetWindowPlacement (pRLWinPriv->hWnd, &wndPlace);
+ /* Get current window placement */
+ GetWindowPlacement(pRLWinPriv->hWnd, &wndPlace);
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- {
- if (!pRLWinPriv->pFrame->win->overrideRedirect)
- fDecorate = TRUE;
+ if (winIsInternalWMRunning(pScreenInfo)) {
+ if (!pRLWinPriv->pFrame->win->overrideRedirect)
+ fDecorate = TRUE;
}
#endif
- if (wndPlace.showCmd == SW_HIDE)
- return;
-
- if (IsWindowVisible (pRLWinPriv->hWnd))
- showCmd = SWP_SHOWWINDOW;
-
- showCmd |= SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER;
-
- winDebug ("winMWExtWMUpdateWindowDecoration %08x %s\n",
- (int)pRLWinPriv, fDecorate?"Decorate":"Bare");
-
- /* Get the standard and extended window style information */
- dwExStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE);
-
- if (fDecorate)
- {
- RECT rcNew;
- int iDx, iDy;
- winWMMessageRec wmMsg;
- winScreenPriv(pScreenInfo->pScreen);
-
- /* */
- if (!(dwExStyle & WS_EX_APPWINDOW))
- {
- winDebug ("\tBare=>Decorate\n");
- /* Setup a rectangle with the X window position and size */
- SetRect (&rcNew,
- pRLWinPriv->pFrame->x,
- pRLWinPriv->pFrame->y,
- pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
- pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
+ if (wndPlace.showCmd == SW_HIDE)
+ return;
+
+ if (IsWindowVisible(pRLWinPriv->hWnd))
+ showCmd = SWP_SHOWWINDOW;
+
+ showCmd |= SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER;
+
+ winDebug("winMWExtWMUpdateWindowDecoration %08x %s\n",
+ (int) pRLWinPriv, fDecorate ? "Decorate" : "Bare");
+
+ /* Get the standard and extended window style information */
+ dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE);
+
+ if (fDecorate) {
+ RECT rcNew;
+ int iDx, iDy;
+ winWMMessageRec wmMsg;
+
+ winScreenPriv(pScreenInfo->pScreen);
+
+ /* */
+ if (!(dwExStyle & WS_EX_APPWINDOW)) {
+ winDebug("\tBare=>Decorate\n");
+ /* Setup a rectangle with the X window position and size */
+ SetRect(&rcNew,
+ pRLWinPriv->pFrame->x,
+ pRLWinPriv->pFrame->y,
+ pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
+ pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
- /* */
- AdjustWindowRectEx (&rcNew,
- WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
- FALSE,
- WS_EX_APPWINDOW);
+ /* */
+ AdjustWindowRectEx(&rcNew,
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
+ FALSE, WS_EX_APPWINDOW);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
- /* Calculate position deltas */
- iDx = pRLWinPriv->pFrame->x - rcNew.left;
- iDy = pRLWinPriv->pFrame->y - rcNew.top;
+ /* Calculate position deltas */
+ iDx = pRLWinPriv->pFrame->x - rcNew.left;
+ iDy = pRLWinPriv->pFrame->y - rcNew.top;
- /* Calculate new rectangle */
- rcNew.left += iDx;
- rcNew.right += iDx;
- rcNew.top += iDy;
- rcNew.bottom += iDy;
+ /* Calculate new rectangle */
+ rcNew.left += iDx;
+ rcNew.right += iDx;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
- /* Set the window extended style flags */
- SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
+ /* Set the window extended style flags */
+ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
- /* Set the window standard style flags */
- SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE,
- WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW);
+ /* Set the window standard style flags */
+ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE,
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW);
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tWindowStyle: %08x %08x\n",
- WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
- WS_EX_APPWINDOW);
+ winDebug("\tWindowStyle: %08x %08x\n",
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
+ WS_EX_APPWINDOW);
#endif
- /* Position the Windows window */
+ /* Position the Windows window */
#ifdef CYGMULTIWINDOW_DEBUG
- winDebug("\tMoved {%d, %d, %d, %d}, {%d, %d}\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+ winDebug("\tMoved {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
- SetWindowPos (pRLWinPriv->hWnd, NULL,
- rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
- showCmd);
-
-
- wmMsg.hwndWindow = pRLWinPriv->hWnd;
- wmMsg.iWindow = (Window)pRLWinPriv->pFrame->win->drawable.id;
- wmMsg.msg = WM_WM_NAME_EVENT;
- winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
-
- winMWExtWMReshapeFrame ((RootlessFrameID)pRLWinPriv ,
- wBoundingShape(pRLWinPriv->pFrame->win));
- }
+ SetWindowPos(pRLWinPriv->hWnd, NULL,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ showCmd);
+
+ wmMsg.hwndWindow = pRLWinPriv->hWnd;
+ wmMsg.iWindow = (Window) pRLWinPriv->pFrame->win->drawable.id;
+ wmMsg.msg = WM_WM_NAME_EVENT;
+ winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
+
+ winMWExtWMReshapeFrame((RootlessFrameID) pRLWinPriv,
+ wBoundingShape(pRLWinPriv->pFrame->win));
+ }
}
- else
- {
- RECT rcNew;
-
- /* */
- if (dwExStyle & WS_EX_APPWINDOW)
- {
- winDebug ("\tDecorate=>Bare\n");
- /* Setup a rectangle with the X window position and size */
- SetRect (&rcNew,
- pRLWinPriv->pFrame->x,
- pRLWinPriv->pFrame->y,
- pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
- pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
+ else {
+ RECT rcNew;
+
+ /* */
+ if (dwExStyle & WS_EX_APPWINDOW) {
+ winDebug("\tDecorate=>Bare\n");
+ /* Setup a rectangle with the X window position and size */
+ SetRect(&rcNew,
+ pRLWinPriv->pFrame->x,
+ pRLWinPriv->pFrame->y,
+ pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
+ pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
#if 0
- /* */
- AdjustWindowRectEx (&rcNew,
- WS_POPUP | WS_CLIPCHILDREN,
- FALSE,
- WS_EX_TOOLWINDOW);
-
- /* Calculate position deltas */
- iDx = pRLWinPriv->pFrame->x - rcNew.left;
- iDy = pRLWinPriv->pFrame->y - rcNew.top;
-
- /* Calculate new rectangle */
- rcNew.left += iDx;
- rcNew.right += iDx;
- rcNew.top += iDy;
- rcNew.bottom += iDy;
+ /* */
+ AdjustWindowRectEx(&rcNew,
+ WS_POPUP | WS_CLIPCHILDREN,
+ FALSE, WS_EX_TOOLWINDOW);
+
+ /* Calculate position deltas */
+ iDx = pRLWinPriv->pFrame->x - rcNew.left;
+ iDy = pRLWinPriv->pFrame->y - rcNew.top;
+
+ /* Calculate new rectangle */
+ rcNew.left += iDx;
+ rcNew.right += iDx;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
#endif
- /* Hide window temporary to remove from taskbar. */
- ShowWindow( pRLWinPriv->hWnd, SW_HIDE );
+ /* Hide window temporary to remove from taskbar. */
+ ShowWindow(pRLWinPriv->hWnd, SW_HIDE);
- /* Set the window extended style flags */
- SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
+ /* Set the window extended style flags */
+ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
- /* Set the window standard style flags */
- SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE,
- WS_POPUP | WS_CLIPCHILDREN);
+ /* Set the window standard style flags */
+ SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE,
+ WS_POPUP | WS_CLIPCHILDREN);
- /* Position the Windows window */
- SetWindowPos (pRLWinPriv->hWnd, NULL,
- rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
- showCmd);
+ /* Position the Windows window */
+ SetWindowPos(pRLWinPriv->hWnd, NULL,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ showCmd);
- winMWExtWMReshapeFrame ((RootlessFrameID)pRLWinPriv ,
- wBoundingShape(pRLWinPriv->pFrame->win));
- }
+ winMWExtWMReshapeFrame((RootlessFrameID) pRLWinPriv,
+ wBoundingShape(pRLWinPriv->pFrame->win));
+ }
}
}
@@ -389,84 +377,86 @@ winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
* winIsInternalWMRunning (winScreenInfoPtr pScreenInfo)
*/
Bool
-winIsInternalWMRunning (winScreenInfoPtr pScreenInfo)
+winIsInternalWMRunning(winScreenInfoPtr pScreenInfo)
{
- return pScreenInfo->fInternalWM && !pScreenInfo->fAnotherWMRunning;
+ return pScreenInfo->fInternalWM && !pScreenInfo->fAnotherWMRunning;
}
#endif
-
/*
* winMWExtWMRestackWindows
*/
void
-winMWExtWMRestackWindows (ScreenPtr pScreen)
+winMWExtWMRestackWindows(ScreenPtr pScreen)
{
- winScreenPriv(pScreen);
- WindowPtr pRoot = pScreen->root;
- WindowPtr pWin = NULL;
- WindowPtr pWinPrev = NULL;
- win32RootlessWindowPtr pRLWin = NULL;
- win32RootlessWindowPtr pRLWinPrev = NULL;
- int nWindow = 0;
- HDWP hWinPosInfo = NULL;
+ winScreenPriv(pScreen);
+ WindowPtr pRoot = pScreen->root;
+ WindowPtr pWin = NULL;
+ WindowPtr pWinPrev = NULL;
+ win32RootlessWindowPtr pRLWin = NULL;
+ win32RootlessWindowPtr pRLWinPrev = NULL;
+ int nWindow = 0;
+ HDWP hWinPosInfo = NULL;
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMRestackWindows\n");
+ winDebug("winMWExtWMRestackWindows\n");
#endif
- pScreenPriv->fRestacking = TRUE;
+ pScreenPriv->fRestacking = TRUE;
- if (pRoot != NULL)
- {
- for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib)
- nWindow ++;
+ if (pRoot != NULL) {
+ for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib)
+ nWindow++;
- hWinPosInfo = BeginDeferWindowPos(nWindow);
+ hWinPosInfo = BeginDeferWindowPos(nWindow);
- for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib)
- {
- if (pWin->realized)
- {
- UINT uFlags;
+ for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) {
+ if (pWin->realized) {
+ UINT uFlags;
- pRLWin = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
- if (pRLWin == NULL) continue;
+ pRLWin =
+ (win32RootlessWindowPtr) RootlessFrameForWindow(pWin,
+ FALSE);
+ if (pRLWin == NULL)
+ continue;
- if (pWinPrev)
- pRLWinPrev = (win32RootlessWindowPtr) RootlessFrameForWindow (pWinPrev, FALSE);
+ if (pWinPrev)
+ pRLWinPrev =
+ (win32RootlessWindowPtr)
+ RootlessFrameForWindow(pWinPrev, FALSE);
- uFlags = SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW;
- if (pRLWinPrev != NULL) uFlags |= SWP_NOACTIVATE;
+ uFlags = SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW;
+ if (pRLWinPrev != NULL)
+ uFlags |= SWP_NOACTIVATE;
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMRestackWindows - DeferWindowPos (%08x, %08x)\n",
- pRLWin->hWnd,
- pRLWinPrev ? pRLWinPrev->hWnd : HWND_TOP);
+ winDebug
+ ("winMWExtWMRestackWindows - DeferWindowPos (%08x, %08x)\n",
+ pRLWin->hWnd, pRLWinPrev ? pRLWinPrev->hWnd : HWND_TOP);
#endif
- hWinPosInfo = DeferWindowPos (hWinPosInfo, pRLWin->hWnd,
- pRLWinPrev ? pRLWinPrev->hWnd : HWND_TOP,
- 0, 0, 0, 0,
- uFlags);
- if (hWinPosInfo == NULL)
- {
- ErrorF ("winMWExtWMRestackWindows - DeferWindowPos () failed: %d\n",
- (int) GetLastError ());
- return;
- }
- pWinPrev = pWin;
- }
- }
- if (!EndDeferWindowPos (hWinPosInfo))
- {
- ErrorF ("winMWExtWMRestackWindows - EndDeferWindowPos () failed: %d\n",
- (int) GetLastError ());
- return;
- }
+ hWinPosInfo = DeferWindowPos(hWinPosInfo, pRLWin->hWnd,
+ pRLWinPrev ? pRLWinPrev->
+ hWnd : HWND_TOP, 0, 0, 0, 0,
+ uFlags);
+ if (hWinPosInfo == NULL) {
+ ErrorF
+ ("winMWExtWMRestackWindows - DeferWindowPos () failed: %d\n",
+ (int) GetLastError());
+ return;
+ }
+ pWinPrev = pWin;
+ }
+ }
+ if (!EndDeferWindowPos(hWinPosInfo)) {
+ ErrorF
+ ("winMWExtWMRestackWindows - EndDeferWindowPos () failed: %d\n",
+ (int) GetLastError());
+ return;
+ }
}
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMRestackWindows - done\n");
+ winDebug("winMWExtWMRestackWindows - done\n");
#endif
- pScreenPriv->fRestacking = FALSE;
+ pScreenPriv->fRestacking = FALSE;
}
diff --git a/xorg-server/hw/xwin/winwin32rootlesswndproc.c b/xorg-server/hw/xwin/winwin32rootlesswndproc.c
index c47719701..46000efe4 100644
--- a/xorg-server/hw/xwin/winwin32rootlesswndproc.c
+++ b/xorg-server/hw/xwin/winwin32rootlesswndproc.c
@@ -43,7 +43,6 @@
#include "winmsg.h"
#include "inputstr.h"
-
/*
* Constant defines
*/
@@ -51,1275 +50,1236 @@
#define MOUSE_ACTIVATE_DEFAULT TRUE
#define RAISE_ON_CLICK_DEFAULT FALSE
-
/*
* Local globals
*/
-static UINT_PTR g_uipMousePollingTimerID = 0;
-
+static UINT_PTR g_uipMousePollingTimerID = 0;
/*
* Local function
*/
DEFINE_ATOM_HELPER(AtmWindowsWmRaiseOnClick, WINDOWSWM_RAISE_ON_CLICK)
-DEFINE_ATOM_HELPER(AtmWindowsWMMouseActivate, WINDOWSWM_MOUSE_ACTIVATE)
+ DEFINE_ATOM_HELPER(AtmWindowsWMMouseActivate, WINDOWSWM_MOUSE_ACTIVATE)
/* DEFINE_ATOM_HELPER(AtmWindowsWMClientWindow, WINDOWSWM_CLIENT_WINDOW) */
-
/*
* ConstrainSize - Taken from TWM sources - Respects hints for sizing
*/
#define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) )
static void
-ConstrainSize (WinXSizeHints hints, int *widthp, int *heightp)
+ConstrainSize(WinXSizeHints hints, int *widthp, int *heightp)
{
- int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta;
- int baseWidth, baseHeight;
- int dwidth = *widthp, dheight = *heightp;
-
- if (hints.flags & PMinSize)
- {
- minWidth = hints.min_width;
- minHeight = hints.min_height;
+ int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta;
+ int baseWidth, baseHeight;
+ int dwidth = *widthp, dheight = *heightp;
+
+ if (hints.flags & PMinSize) {
+ minWidth = hints.min_width;
+ minHeight = hints.min_height;
}
- else if (hints.flags & PBaseSize)
- {
- minWidth = hints.base_width;
- minHeight = hints.base_height;
+ else if (hints.flags & PBaseSize) {
+ minWidth = hints.base_width;
+ minHeight = hints.base_height;
}
- else
- minWidth = minHeight = 1;
-
- if (hints.flags & PBaseSize)
- {
- baseWidth = hints.base_width;
- baseHeight = hints.base_height;
- }
- else if (hints.flags & PMinSize)
- {
- baseWidth = hints.min_width;
- baseHeight = hints.min_height;
+ else
+ minWidth = minHeight = 1;
+
+ if (hints.flags & PBaseSize) {
+ baseWidth = hints.base_width;
+ baseHeight = hints.base_height;
+ }
+ else if (hints.flags & PMinSize) {
+ baseWidth = hints.min_width;
+ baseHeight = hints.min_height;
}
- else
- baseWidth = baseHeight = 0;
+ else
+ baseWidth = baseHeight = 0;
- if (hints.flags & PMaxSize)
- {
- maxWidth = hints.max_width;
- maxHeight = hints.max_height;
+ if (hints.flags & PMaxSize) {
+ maxWidth = hints.max_width;
+ maxHeight = hints.max_height;
}
- else
- {
- maxWidth = MAXINT;
- maxHeight = MAXINT;
+ else {
+ maxWidth = MAXINT;
+ maxHeight = MAXINT;
}
- if (hints.flags & PResizeInc)
- {
- xinc = hints.width_inc;
- yinc = hints.height_inc;
+ if (hints.flags & PResizeInc) {
+ xinc = hints.width_inc;
+ yinc = hints.height_inc;
}
- else
- xinc = yinc = 1;
-
- /*
- * First, clamp to min and max values
- */
- if (dwidth < minWidth)
- dwidth = minWidth;
- if (dheight < minHeight)
- dheight = minHeight;
-
- if (dwidth > maxWidth)
- dwidth = maxWidth;
- if (dheight > maxHeight)
- dheight = maxHeight;
-
- /*
- * Second, fit to base + N * inc
- */
- dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth;
- dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight;
-
- /*
- * Third, adjust for aspect ratio
- */
-
- /*
- * The math looks like this:
- *
- * minAspectX dwidth maxAspectX
- * ---------- <= ------- <= ----------
- * minAspectY dheight maxAspectY
- *
- * If that is multiplied out, then the width and height are
- * invalid in the following situations:
- *
- * minAspectX * dheight > minAspectY * dwidth
- * maxAspectX * dheight < maxAspectY * dwidth
- *
- */
-
- if (hints.flags & PAspect)
- {
- if (hints.min_aspect.x * dheight > hints.min_aspect.y * dwidth)
- {
- delta = makemult(hints.min_aspect.x * dheight / hints.min_aspect.y - dwidth, xinc);
- if (dwidth + delta <= maxWidth)
- dwidth += delta;
- else
- {
- delta = makemult(dheight - dwidth*hints.min_aspect.y/hints.min_aspect.x, yinc);
- if (dheight - delta >= minHeight)
- dheight -= delta;
+ else
+ xinc = yinc = 1;
+
+ /*
+ * First, clamp to min and max values
+ */
+ if (dwidth < minWidth)
+ dwidth = minWidth;
+ if (dheight < minHeight)
+ dheight = minHeight;
+
+ if (dwidth > maxWidth)
+ dwidth = maxWidth;
+ if (dheight > maxHeight)
+ dheight = maxHeight;
+
+ /*
+ * Second, fit to base + N * inc
+ */
+ dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth;
+ dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight;
+
+ /*
+ * Third, adjust for aspect ratio
+ */
+
+ /*
+ * The math looks like this:
+ *
+ * minAspectX dwidth maxAspectX
+ * ---------- <= ------- <= ----------
+ * minAspectY dheight maxAspectY
+ *
+ * If that is multiplied out, then the width and height are
+ * invalid in the following situations:
+ *
+ * minAspectX * dheight > minAspectY * dwidth
+ * maxAspectX * dheight < maxAspectY * dwidth
+ *
+ */
+
+ if (hints.flags & PAspect) {
+ if (hints.min_aspect.x * dheight > hints.min_aspect.y * dwidth) {
+ delta =
+ makemult(hints.min_aspect.x * dheight / hints.min_aspect.y -
+ dwidth, xinc);
+ if (dwidth + delta <= maxWidth)
+ dwidth += delta;
+ else {
+ delta =
+ makemult(dheight -
+ dwidth * hints.min_aspect.y / hints.min_aspect.x,
+ yinc);
+ if (dheight - delta >= minHeight)
+ dheight -= delta;
}
}
-
- if (hints.max_aspect.x * dheight < hints.max_aspect.y * dwidth)
- {
- delta = makemult(dwidth * hints.max_aspect.y / hints.max_aspect.x - dheight, yinc);
- if (dheight + delta <= maxHeight)
- dheight += delta;
- else
- {
- delta = makemult(dwidth - hints.max_aspect.x*dheight/hints.max_aspect.y, xinc);
- if (dwidth - delta >= minWidth)
- dwidth -= delta;
+
+ if (hints.max_aspect.x * dheight < hints.max_aspect.y * dwidth) {
+ delta =
+ makemult(dwidth * hints.max_aspect.y / hints.max_aspect.x -
+ dheight, yinc);
+ if (dheight + delta <= maxHeight)
+ dheight += delta;
+ else {
+ delta =
+ makemult(dwidth -
+ hints.max_aspect.x * dheight / hints.max_aspect.y,
+ xinc);
+ if (dwidth - delta >= minWidth)
+ dwidth -= delta;
}
}
}
-
- /* Return computed values */
- *widthp = dwidth;
- *heightp = dheight;
-}
-#undef makemult
+ /* Return computed values */
+ *widthp = dwidth;
+ *heightp = dheight;
+}
+#undef makemult
/*
* ValidateSizing - Ensures size request respects hints
*/
static int
-ValidateSizing (HWND hwnd, WindowPtr pWin,
- WPARAM wParam, LPARAM lParam)
+ValidateSizing(HWND hwnd, WindowPtr pWin, WPARAM wParam, LPARAM lParam)
{
- WinXSizeHints sizeHints;
- RECT *rect;
- int iWidth, iHeight, iTopBorder;
- POINT pt;
+ WinXSizeHints sizeHints;
+ RECT *rect;
+ int iWidth, iHeight, iTopBorder;
+ POINT pt;
+
+ /* Invalid input checking */
+ if (pWin == NULL || lParam == 0) {
+ ErrorF("Invalid input checking\n");
+ return FALSE;
+ }
- /* Invalid input checking */
- if (pWin==NULL || lParam==0)
- {
- ErrorF ("Invalid input checking\n");
- return FALSE;
+ /* No size hints, no checking */
+ if (!winMultiWindowGetWMNormalHints(pWin, &sizeHints)) {
+ ErrorF("No size hints, no checking\n");
+ return FALSE;
}
- /* No size hints, no checking */
- if (!winMultiWindowGetWMNormalHints (pWin, &sizeHints))
- {
- ErrorF ("No size hints, no checking\n");
- return FALSE;
+ /* Avoid divide-by-zero */
+ if (sizeHints.flags & PResizeInc) {
+ if (sizeHints.width_inc == 0)
+ sizeHints.width_inc = 1;
+ if (sizeHints.height_inc == 0)
+ sizeHints.height_inc = 1;
}
-
- /* Avoid divide-by-zero */
- if (sizeHints.flags & PResizeInc)
- {
- if (sizeHints.width_inc == 0) sizeHints.width_inc = 1;
- if (sizeHints.height_inc == 0) sizeHints.height_inc = 1;
+
+ rect = (RECT *) lParam;
+
+ iWidth = rect->right - rect->left;
+ iHeight = rect->bottom - rect->top;
+
+ /* Get title bar height, there must be an easier way?! */
+ pt.x = pt.y = 0;
+ ClientToScreen(hwnd, &pt);
+ iTopBorder = pt.y - rect->top;
+
+ /* Now remove size of any borders */
+ iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight -= GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder;
+
+ /* Constrain the size to legal values */
+ ConstrainSize(sizeHints, &iWidth, &iHeight);
+
+ /* Add back the borders */
+ iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight += GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder;
+
+ /* Adjust size according to where we're dragging from */
+ switch (wParam) {
+ case WMSZ_TOP:
+ case WMSZ_TOPRIGHT:
+ case WMSZ_BOTTOM:
+ case WMSZ_BOTTOMRIGHT:
+ case WMSZ_RIGHT:
+ rect->right = rect->left + iWidth;
+ break;
+ default:
+ rect->left = rect->right - iWidth;
+ break;
}
-
- rect = (RECT*)lParam;
-
- iWidth = rect->right - rect->left;
- iHeight = rect->bottom - rect->top;
-
- /* Get title bar height, there must be an easier way?! */
- pt.x = pt.y = 0;
- ClientToScreen(hwnd, &pt);
- iTopBorder = pt.y - rect->top;
-
- /* Now remove size of any borders */
- iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
- iHeight -= GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder;
-
- /* Constrain the size to legal values */
- ConstrainSize (sizeHints, &iWidth, &iHeight);
-
- /* Add back the borders */
- iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
- iHeight += GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder;
-
- /* Adjust size according to where we're dragging from */
- switch(wParam) {
- case WMSZ_TOP:
- case WMSZ_TOPRIGHT:
- case WMSZ_BOTTOM:
- case WMSZ_BOTTOMRIGHT:
- case WMSZ_RIGHT:
- rect->right = rect->left + iWidth;
- break;
- default:
- rect->left = rect->right - iWidth;
- break;
- }
- switch(wParam) {
- case WMSZ_BOTTOM:
- case WMSZ_BOTTOMRIGHT:
- case WMSZ_BOTTOMLEFT:
- case WMSZ_RIGHT:
- case WMSZ_LEFT:
- rect->bottom = rect->top + iHeight;
- break;
- default:
- rect->top = rect->bottom - iHeight;
- break;
- }
- return TRUE;
+ switch (wParam) {
+ case WMSZ_BOTTOM:
+ case WMSZ_BOTTOMRIGHT:
+ case WMSZ_BOTTOMLEFT:
+ case WMSZ_RIGHT:
+ case WMSZ_LEFT:
+ rect->bottom = rect->top + iHeight;
+ break;
+ default:
+ rect->top = rect->bottom - iHeight;
+ break;
+ }
+ return TRUE;
}
-
/*
* IsRaiseOnClick
*/
static Bool
-IsRaiseOnClick (WindowPtr pWin)
+IsRaiseOnClick(WindowPtr pWin)
{
- struct _Window *pwin;
- struct _Property *prop;
- /* XXX We're getting inputInfo.poniter here, but this might be really wrong.
- * Which pointer's current window do we want? */
- WindowPtr pRoot = GetCurrentRootWindow (inputInfo.pointer);
+ struct _Window *pwin;
+ struct _Property *prop;
- if (!pWin)
- {
- ErrorF ("IsRaiseOnClick - no prop use default value:%d\n",
- RAISE_ON_CLICK_DEFAULT);
- return RAISE_ON_CLICK_DEFAULT;
- }
+ /* XXX We're getting inputInfo.poniter here, but this might be really wrong.
+ * Which pointer's current window do we want? */
+ WindowPtr pRoot = GetCurrentRootWindow(inputInfo.pointer);
- pwin = (struct _Window*) pWin;
+ if (!pWin) {
+ ErrorF("IsRaiseOnClick - no prop use default value:%d\n",
+ RAISE_ON_CLICK_DEFAULT);
+ return RAISE_ON_CLICK_DEFAULT;
+ }
- if (pwin->optional)
- prop = (struct _Property *) pwin->optional->userProps;
- else
- prop = NULL;
+ pwin = (struct _Window *) pWin;
- while (prop)
- {
- if (prop->propertyName == AtmWindowsWmRaiseOnClick ()
- && prop->type == XA_INTEGER
- && prop->format == 32)
- {
- return *(int*)prop->data;
- }
- else
- prop = prop->next;
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ while (prop) {
+ if (prop->propertyName == AtmWindowsWmRaiseOnClick()
+ && prop->type == XA_INTEGER && prop->format == 32) {
+ return *(int *) prop->data;
+ }
+ else
+ prop = prop->next;
}
- if (pWin != pRoot)
- {
- return IsRaiseOnClick (pRoot);
+ if (pWin != pRoot) {
+ return IsRaiseOnClick(pRoot);
}
- else
- {
+ else {
#if CYGMULTIWINDOW_DEBUG
- winDebug ("IsRaiseOnClick - no prop use default value:%d\n",
- RAISE_ON_CLICK_DEFAULT);
+ winDebug("IsRaiseOnClick - no prop use default value:%d\n",
+ RAISE_ON_CLICK_DEFAULT);
#endif
- return RAISE_ON_CLICK_DEFAULT;
+ return RAISE_ON_CLICK_DEFAULT;
}
}
-
/*
* IsMouseActive
*/
static Bool
-IsMouseActive (WindowPtr pWin)
+IsMouseActive(WindowPtr pWin)
{
- struct _Window *pwin;
- struct _Property *prop;
- /* XXX We're getting inputInfo.poniter here, but this might be really wrong.
- * Which pointer's current window do we want? */
- WindowPtr pRoot = GetCurrentRootWindow (inputInfo.pointer);
+ struct _Window *pwin;
+ struct _Property *prop;
- if (!pWin)
- {
- ErrorF ("IsMouseActive - pWin was NULL use default value:%d\n",
- MOUSE_ACTIVATE_DEFAULT);
- return MOUSE_ACTIVATE_DEFAULT;
- }
+ /* XXX We're getting inputInfo.poniter here, but this might be really wrong.
+ * Which pointer's current window do we want? */
+ WindowPtr pRoot = GetCurrentRootWindow(inputInfo.pointer);
+
+ if (!pWin) {
+ ErrorF("IsMouseActive - pWin was NULL use default value:%d\n",
+ MOUSE_ACTIVATE_DEFAULT);
+ return MOUSE_ACTIVATE_DEFAULT;
+ }
- pwin = (struct _Window*) pWin;
+ pwin = (struct _Window *) pWin;
- if (pwin->optional)
- prop = (struct _Property *) pwin->optional->userProps;
- else
- prop = NULL;
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
- while (prop)
- {
- if (prop->propertyName == AtmWindowsWMMouseActivate ()
- && prop->type == XA_INTEGER
- && prop->format == 32)
- {
- return *(int*)prop->data;
- }
- else
- prop = prop->next;
+ while (prop) {
+ if (prop->propertyName == AtmWindowsWMMouseActivate()
+ && prop->type == XA_INTEGER && prop->format == 32) {
+ return *(int *) prop->data;
+ }
+ else
+ prop = prop->next;
}
- if (pWin != pRoot)
- {
- return IsMouseActive (pRoot);
+ if (pWin != pRoot) {
+ return IsMouseActive(pRoot);
}
- else
- {
+ else {
#if CYGMULTIWINDOW_DEBUG
- winDebug ("IsMouseActive - no prop use default value:%d\n",
- MOUSE_ACTIVATE_DEFAULT);
+ winDebug("IsMouseActive - no prop use default value:%d\n",
+ MOUSE_ACTIVATE_DEFAULT);
#endif
- return MOUSE_ACTIVATE_DEFAULT;
+ return MOUSE_ACTIVATE_DEFAULT;
}
}
-
/*
* winMWExtWMWindowProc - Window procedure
*/
LRESULT CALLBACK
-winMWExtWMWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam)
+winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- WindowPtr pWin = NULL;
- win32RootlessWindowPtr pRLWinPriv = NULL;
- ScreenPtr pScreen = NULL;
- winPrivScreenPtr pScreenPriv = NULL;
- winScreenInfo *pScreenInfo = NULL;
- HWND hwndScreen = NULL;
- POINT ptMouse;
- static Bool s_fTracking = FALSE;
- HDC hdcUpdate;
- PAINTSTRUCT ps;
- LPWINDOWPOS pWinPos = NULL;
- RECT rcClient;
- winWMMessageRec wmMsg;
- Bool fWMMsgInitialized = FALSE;
-
- /* Check if the Windows window property for our X window pointer is valid */
- if ((pRLWinPriv = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP)) != NULL)
- {
- pWin = pRLWinPriv->pFrame->win;
- pScreen = pWin->drawable.pScreen;
- if (pScreen) pScreenPriv = winGetScreenPriv(pScreen);
- if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
- if (pScreenPriv) hwndScreen = pScreenPriv->hwndScreen;
-
- wmMsg.msg = 0;
- wmMsg.hwndWindow = hwnd;
- wmMsg.iWindow = (Window)pWin->drawable.id;
-
- wmMsg.iX = pRLWinPriv->pFrame->x;
- wmMsg.iY = pRLWinPriv->pFrame->y;
- wmMsg.iWidth = pRLWinPriv->pFrame->width;
- wmMsg.iHeight = pRLWinPriv->pFrame->height;
-
- fWMMsgInitialized = TRUE;
- winDebugWin32Message("winMWExtWMWindowProc", hwnd, message, wParam, lParam);
-
- winDebug ("\thWnd %08X\n", hwnd);
- winDebug ("\tpScreenPriv %08X\n", pScreenPriv);
- winDebug ("\tpScreenInfo %08X\n", pScreenInfo);
- winDebug ("\thwndScreen %08X\n", hwndScreen);
- winDebug ("winMWExtWMWindowProc (%08x) %08x %08x %08x\n",
- pRLWinPriv, message, wParam, lParam);
+ WindowPtr pWin = NULL;
+ win32RootlessWindowPtr pRLWinPriv = NULL;
+ ScreenPtr pScreen = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+ HWND hwndScreen = NULL;
+ POINT ptMouse;
+ static Bool s_fTracking = FALSE;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+ LPWINDOWPOS pWinPos = NULL;
+ RECT rcClient;
+ winWMMessageRec wmMsg;
+ Bool fWMMsgInitialized = FALSE;
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pRLWinPriv =
+ (win32RootlessWindowPtr) GetProp(hwnd, WIN_WINDOW_PROP)) != NULL) {
+ pWin = pRLWinPriv->pFrame->win;
+ pScreen = pWin->drawable.pScreen;
+ if (pScreen)
+ pScreenPriv = winGetScreenPriv(pScreen);
+ if (pScreenPriv)
+ pScreenInfo = pScreenPriv->pScreenInfo;
+ if (pScreenPriv)
+ hwndScreen = pScreenPriv->hwndScreen;
+
+ wmMsg.msg = 0;
+ wmMsg.hwndWindow = hwnd;
+ wmMsg.iWindow = (Window) pWin->drawable.id;
+
+ wmMsg.iX = pRLWinPriv->pFrame->x;
+ wmMsg.iY = pRLWinPriv->pFrame->y;
+ wmMsg.iWidth = pRLWinPriv->pFrame->width;
+ wmMsg.iHeight = pRLWinPriv->pFrame->height;
+
+ fWMMsgInitialized = TRUE;
+ winDebugWin32Message("winMWExtWMWindowProc", hwnd, message, wParam,
+ lParam);
+
+ winDebug("\thWnd %08X\n", hwnd);
+ winDebug("\tpScreenPriv %08X\n", pScreenPriv);
+ winDebug("\tpScreenInfo %08X\n", pScreenInfo);
+ winDebug("\thwndScreen %08X\n", hwndScreen);
+ winDebug("winMWExtWMWindowProc (%08x) %08x %08x %08x\n",
+ pRLWinPriv, message, wParam, lParam);
}
- /* Branch on message type */
- switch (message)
- {
+ /* Branch on message type */
+ switch (message) {
case WM_CREATE:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_CREATE\n");
+ winDebug("winMWExtWMWindowProc - WM_CREATE\n");
#endif
- /* */
- SetProp (hwnd,
- WIN_WINDOW_PROP,
- (HANDLE)((LPCREATESTRUCT) lParam)->lpCreateParams);
- return 0;
+ /* */
+ SetProp(hwnd,
+ WIN_WINDOW_PROP,
+ (HANDLE) ((LPCREATESTRUCT) lParam)->lpCreateParams);
+ return 0;
case WM_CLOSE:
- winDebug ("winMWExtWMWindowProc - WM_CLOSE %d\n", pRLWinPriv->fClose);
-
- /* Tell window-manager to close window */
- if (pRLWinPriv->fClose)
- {
- DestroyWindow (hwnd);
- }
- else
- {
+ winDebug("winMWExtWMWindowProc - WM_CLOSE %d\n", pRLWinPriv->fClose);
+
+ /* Tell window-manager to close window */
+ if (pRLWinPriv->fClose) {
+ DestroyWindow(hwnd);
+ }
+ else {
+ if (winIsInternalWMRunning(pScreenInfo)) {
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- {
- /* Tell our Window Manager thread to kill the window */
- wmMsg.msg = WM_WM_KILL;
- if (fWMMsgInitialized)
- winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
- }
+ /* Tell our Window Manager thread to kill the window */
+ wmMsg.msg = WM_WM_KILL;
+ if (fWMMsgInitialized)
+ winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
+ }
#endif
- winWindowsWMSendEvent(WindowsWMControllerNotify,
- WindowsWMControllerNotifyMask,
- 1,
- WindowsWMCloseWindow,
- pWin->drawable.id,
- 0, 0, 0, 0);
- }
- return 0;
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMCloseWindow,
+ pWin->drawable.id, 0, 0, 0, 0);
+ }
+ return 0;
case WM_DESTROY:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_DESTROY\n");
+ winDebug("winMWExtWMWindowProc - WM_DESTROY\n");
#endif
- /* Free the shaodw DC; which allows the bitmap to be freed */
- DeleteDC (pRLWinPriv->hdcShadow);
- pRLWinPriv->hdcShadow = NULL;
-
- /* Free the shadow bitmap */
- DeleteObject (pRLWinPriv->hbmpShadow);
- pRLWinPriv->hbmpShadow = NULL;
-
- /* Free the screen DC */
- ReleaseDC (pRLWinPriv->hWnd, pRLWinPriv->hdcScreen);
- pRLWinPriv->hdcScreen = NULL;
-
- /* Free shadow buffer info header */
- free (pRLWinPriv->pbmihShadow);
- pRLWinPriv->pbmihShadow = NULL;
-
- pRLWinPriv->fResized = FALSE;
- pRLWinPriv->pfb = NULL;
- free (pRLWinPriv);
- RemoveProp (hwnd, WIN_WINDOW_PROP);
- break;
+ /* Free the shaodw DC; which allows the bitmap to be freed */
+ DeleteDC(pRLWinPriv->hdcShadow);
+ pRLWinPriv->hdcShadow = NULL;
+
+ /* Free the shadow bitmap */
+ DeleteObject(pRLWinPriv->hbmpShadow);
+ pRLWinPriv->hbmpShadow = NULL;
+
+ /* Free the screen DC */
+ ReleaseDC(pRLWinPriv->hWnd, pRLWinPriv->hdcScreen);
+ pRLWinPriv->hdcScreen = NULL;
+
+ /* Free shadow buffer info header */
+ free(pRLWinPriv->pbmihShadow);
+ pRLWinPriv->pbmihShadow = NULL;
+
+ pRLWinPriv->fResized = FALSE;
+ pRLWinPriv->pfb = NULL;
+ free(pRLWinPriv);
+ RemoveProp(hwnd, WIN_WINDOW_PROP);
+ break;
case WM_MOUSEMOVE:
#if CYGMULTIWINDOW_DEBUG && 0
- winDebug ("winMWExtWMWindowProc - WM_MOUSEMOVE\n");
+ winDebug("winMWExtWMWindowProc - WM_MOUSEMOVE\n");
#endif
- /* Unpack the client area mouse coordinates */
- ptMouse.x = GET_X_LPARAM(lParam);
- ptMouse.y = GET_Y_LPARAM(lParam);
-
- /* Translate the client area mouse coordinates to screen coordinates */
- ClientToScreen (hwnd, &ptMouse);
-
- /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
- ptMouse.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
- ptMouse.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
-
- /* We can't do anything without privates */
- if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
- break;
-
- /* Has the mouse pointer crossed screens? */
- if (pScreen != miPointerGetScreen(inputInfo.pointer))
- miPointerSetScreen (inputInfo.pointer, pScreenInfo->dwScreen,
- ptMouse.x - pScreenInfo->dwXOffset,
- ptMouse.y - pScreenInfo->dwYOffset);
-
- /* Are we tracking yet? */
- if (!s_fTracking)
- {
- TRACKMOUSEEVENT tme;
-
- /* Setup data structure */
- ZeroMemory (&tme, sizeof (tme));
- tme.cbSize = sizeof (tme);
- tme.dwFlags = TME_LEAVE;
- tme.hwndTrack = hwnd;
-
- /* Call the tracking function */
- if (!TrackMouseEvent(&tme))
- ErrorF ("winMWExtWMWindowProc - TrackMouseEvent failed\n");
-
- /* Flag that we are tracking now */
- s_fTracking = TRUE;
- }
-
- /* Kill the timer used to poll mouse events */
- if (g_uipMousePollingTimerID != 0)
- {
- KillTimer (pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID);
- g_uipMousePollingTimerID = 0;
- }
-
- /* Deliver absolute cursor position to X Server */
- winEnqueueMotion(ptMouse.x - pScreenInfo->dwXOffset,
- ptMouse.y - pScreenInfo->dwYOffset);
+ /* Unpack the client area mouse coordinates */
+ ptMouse.x = GET_X_LPARAM(lParam);
+ ptMouse.y = GET_Y_LPARAM(lParam);
+
+ /* Translate the client area mouse coordinates to screen coordinates */
+ ClientToScreen(hwnd, &ptMouse);
+
+ /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
+ ptMouse.x -= GetSystemMetrics(SM_XVIRTUALSCREEN);
+ ptMouse.y -= GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ /* We can't do anything without privates */
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Has the mouse pointer crossed screens? */
+ if (pScreen != miPointerGetScreen(inputInfo.pointer))
+ miPointerSetScreen(inputInfo.pointer, pScreenInfo->dwScreen,
+ ptMouse.x - pScreenInfo->dwXOffset,
+ ptMouse.y - pScreenInfo->dwYOffset);
+
+ /* Are we tracking yet? */
+ if (!s_fTracking) {
+ TRACKMOUSEEVENT tme;
+
+ /* Setup data structure */
+ ZeroMemory(&tme, sizeof(tme));
+ tme.cbSize = sizeof(tme);
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = hwnd;
+
+ /* Call the tracking function */
+ if (!TrackMouseEvent(&tme))
+ ErrorF("winMWExtWMWindowProc - TrackMouseEvent failed\n");
+
+ /* Flag that we are tracking now */
+ s_fTracking = TRUE;
+ }
+
+ /* Kill the timer used to poll mouse events */
+ if (g_uipMousePollingTimerID != 0) {
+ KillTimer(pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID);
+ g_uipMousePollingTimerID = 0;
+ }
+
+ /* Deliver absolute cursor position to X Server */
+ winEnqueueMotion(ptMouse.x - pScreenInfo->dwXOffset,
+ ptMouse.y - pScreenInfo->dwYOffset);
+
+ return 0;
- return 0;
-
case WM_NCMOUSEMOVE:
#if CYGMULTIWINDOW_DEBUG && 0
- winDebug ("winMWExtWMWindowProc - WM_NCMOUSEMOVE\n");
+ winDebug("winMWExtWMWindowProc - WM_NCMOUSEMOVE\n");
#endif
- /*
- * We break instead of returning 0 since we need to call
- * DefWindowProc to get the mouse cursor changes
- * and min/max/close button highlighting in Windows XP.
- * The Platform SDK says that you should return 0 if you
- * process this message, but it fails to mention that you
- * will give up any default functionality if you do return 0.
- */
-
- /* We can't do anything without privates */
- if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
- break;
-
- /*
- * Timer to poll mouse events. This is needed to make
- * programs like xeyes follow the mouse properly.
- */
- if (g_uipMousePollingTimerID == 0)
- g_uipMousePollingTimerID = SetTimer (pScreenPriv->hwndScreen,
- WIN_POLLING_MOUSE_TIMER_ID,
- MOUSE_POLLING_INTERVAL,
- NULL);
- break;
+ /*
+ * We break instead of returning 0 since we need to call
+ * DefWindowProc to get the mouse cursor changes
+ * and min/max/close button highlighting in Windows XP.
+ * The Platform SDK says that you should return 0 if you
+ * process this message, but it fails to mention that you
+ * will give up any default functionality if you do return 0.
+ */
+
+ /* We can't do anything without privates */
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+
+ /*
+ * Timer to poll mouse events. This is needed to make
+ * programs like xeyes follow the mouse properly.
+ */
+ if (g_uipMousePollingTimerID == 0)
+ g_uipMousePollingTimerID = SetTimer(pScreenPriv->hwndScreen,
+ WIN_POLLING_MOUSE_TIMER_ID,
+ MOUSE_POLLING_INTERVAL, NULL);
+ break;
case WM_MOUSELEAVE:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_MOUSELEAVE\n");
+ winDebug("winMWExtWMWindowProc - WM_MOUSELEAVE\n");
#endif
- /* Mouse has left our client area */
-
- /* Flag that we are no longer tracking */
- s_fTracking = FALSE;
-
- /*
- * Timer to poll mouse events. This is needed to make
- * programs like xeyes follow the mouse properly.
- */
- if (g_uipMousePollingTimerID == 0)
- g_uipMousePollingTimerID = SetTimer (pScreenPriv->hwndScreen,
- WIN_POLLING_MOUSE_TIMER_ID,
- MOUSE_POLLING_INTERVAL,
- NULL);
- return 0;
+ /* Mouse has left our client area */
+
+ /* Flag that we are no longer tracking */
+ s_fTracking = FALSE;
+
+ /*
+ * Timer to poll mouse events. This is needed to make
+ * programs like xeyes follow the mouse properly.
+ */
+ if (g_uipMousePollingTimerID == 0)
+ g_uipMousePollingTimerID = SetTimer(pScreenPriv->hwndScreen,
+ WIN_POLLING_MOUSE_TIMER_ID,
+ MOUSE_POLLING_INTERVAL, NULL);
+ return 0;
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_LBUTTONDBLCLK\n");
+ winDebug("winMWExtWMWindowProc - WM_LBUTTONDBLCLK\n");
#endif
- if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
- break;
- SetCapture (hwnd);
- return winMouseButtonsHandle (pScreen, ButtonPress, Button1, wParam);
-
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(pScreen, ButtonPress, Button1, wParam);
+
case WM_LBUTTONUP:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_LBUTTONUP\n");
+ winDebug("winMWExtWMWindowProc - WM_LBUTTONUP\n");
#endif
- if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
- break;
- ReleaseCapture ();
- return winMouseButtonsHandle (pScreen, ButtonRelease, Button1, wParam);
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture();
+ return winMouseButtonsHandle(pScreen, ButtonRelease, Button1, wParam);
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_MBUTTONDBLCLK\n");
+ winDebug("winMWExtWMWindowProc - WM_MBUTTONDBLCLK\n");
#endif
- if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
- break;
- SetCapture (hwnd);
- return winMouseButtonsHandle (pScreen, ButtonPress, Button2, wParam);
-
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(pScreen, ButtonPress, Button2, wParam);
+
case WM_MBUTTONUP:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_MBUTTONUP\n");
+ winDebug("winMWExtWMWindowProc - WM_MBUTTONUP\n");
#endif
- if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
- break;
- ReleaseCapture ();
- return winMouseButtonsHandle (pScreen, ButtonRelease, Button2, wParam);
-
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture();
+ return winMouseButtonsHandle(pScreen, ButtonRelease, Button2, wParam);
+
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_RBUTTONDBLCLK\n");
+ winDebug("winMWExtWMWindowProc - WM_RBUTTONDBLCLK\n");
#endif
- if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
- break;
- SetCapture (hwnd);
- return winMouseButtonsHandle (pScreen, ButtonPress, Button3, wParam);
-
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(pScreen, ButtonPress, Button3, wParam);
+
case WM_RBUTTONUP:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_RBUTTONUP\n");
+ winDebug("winMWExtWMWindowProc - WM_RBUTTONUP\n");
#endif
- if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
- break;
- ReleaseCapture ();
- return winMouseButtonsHandle (pScreen, ButtonRelease, Button3, wParam);
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture();
+ return winMouseButtonsHandle(pScreen, ButtonRelease, Button3, wParam);
case WM_XBUTTONDBLCLK:
case WM_XBUTTONDOWN:
- if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
- break;
- SetCapture (hwnd);
- return winMouseButtonsHandle (pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(pScreen, ButtonPress, HIWORD(wParam) + 5,
+ wParam);
case WM_XBUTTONUP:
- if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
- break;
- ReleaseCapture ();
- return winMouseButtonsHandle (pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture();
+ return winMouseButtonsHandle(pScreen, ButtonRelease, HIWORD(wParam) + 5,
+ wParam);
case WM_MOUSEWHEEL:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_MOUSEWHEEL\n");
+ winDebug("winMWExtWMWindowProc - WM_MOUSEWHEEL\n");
#endif
-
- /* Pass the message to the root window */
- SendMessage (hwndScreen, message, wParam, lParam);
- return 0;
+
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+ return 0;
case WM_MOUSEACTIVATE:
- winDebug ("winMWExtWMWindowProc - WM_MOUSEACTIVATE\n");
+ winDebug("winMWExtWMWindowProc - WM_MOUSEACTIVATE\n");
#ifdef XWIN_MULTIWINDOWINTWM
- /* Check if this window needs to be made active when clicked */
- if (winIsInternalWMRunning(pScreenInfo) && pWin->overrideRedirect)
- {
- winDebug ("winMWExtWMWindowProc - WM_MOUSEACTIVATE - "
- "MA_NOACTIVATE\n");
-
- /* */
- return MA_NOACTIVATE;
- }
+ /* Check if this window needs to be made active when clicked */
+ if (winIsInternalWMRunning(pScreenInfo) && pWin->overrideRedirect) {
+ winDebug("winMWExtWMWindowProc - WM_MOUSEACTIVATE - "
+ "MA_NOACTIVATE\n");
+
+ /* */
+ return MA_NOACTIVATE;
+ }
#endif
- if (
+ if (
#ifdef XWIN_MULTIWINDOWINTWM
- !winIsInternalWMRunning(pScreenInfo) &&
+ !winIsInternalWMRunning(pScreenInfo) &&
#endif
- !IsMouseActive (pWin))
- return MA_NOACTIVATE;
+ !IsMouseActive (pWin))
+ return MA_NOACTIVATE;
- break;
+ break;
case WM_KILLFOCUS:
- /* Pop any pressed keys since we are losing keyboard focus */
- winKeybdReleaseKeys ();
- return 0;
+ /* Pop any pressed keys since we are losing keyboard focus */
+ winKeybdReleaseKeys();
+ return 0;
case WM_SYSDEADCHAR:
case WM_DEADCHAR:
- /*
- * NOTE: We do nothing with WM_*CHAR messages,
- * nor does the root window, so we can just toss these messages.
- */
- return 0;
+ /*
+ * NOTE: We do nothing with WM_*CHAR messages,
+ * nor does the root window, so we can just toss these messages.
+ */
+ return 0;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_*KEYDOWN\n");
+ winDebug("winMWExtWMWindowProc - WM_*KEYDOWN\n");
#endif
- /*
- * Don't pass Alt-F4 key combo to root window,
- * let Windows translate to WM_CLOSE and close this top-level window.
- *
- * NOTE: We purposely don't check the fUseWinKillKey setting because
- * it should only apply to the key handling for the root window,
- * not for top-level window-manager windows.
- *
- * ALSO NOTE: We do pass Ctrl-Alt-Backspace to the root window
- * because that is a key combo that no X app should be expecting to
- * receive, since it has historically been used to shutdown the X server.
- * Passing Ctrl-Alt-Backspace to the root window preserves that
- * behavior, assuming that -unixkill has been passed as a parameter.
- */
- if (wParam == VK_F4 && (GetKeyState (VK_MENU) & 0x8000))
- break;
-
- /* Pass the message to the root window */
- SendMessage (hwndScreen, message, wParam, lParam);
- return 0;
+ /*
+ * Don't pass Alt-F4 key combo to root window,
+ * let Windows translate to WM_CLOSE and close this top-level window.
+ *
+ * NOTE: We purposely don't check the fUseWinKillKey setting because
+ * it should only apply to the key handling for the root window,
+ * not for top-level window-manager windows.
+ *
+ * ALSO NOTE: We do pass Ctrl-Alt-Backspace to the root window
+ * because that is a key combo that no X app should be expecting to
+ * receive, since it has historically been used to shutdown the X server.
+ * Passing Ctrl-Alt-Backspace to the root window preserves that
+ * behavior, assuming that -unixkill has been passed as a parameter.
+ */
+ if (wParam == VK_F4 && (GetKeyState(VK_MENU) & 0x8000))
+ break;
+
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+ return 0;
case WM_SYSKEYUP:
case WM_KEYUP:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_*KEYUP\n");
+ winDebug("winMWExtWMWindowProc - WM_*KEYUP\n");
#endif
- /* Pass the message to the root window */
- SendMessage (hwndScreen, message, wParam, lParam);
- return 0;
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+ return 0;
case WM_HOTKEY:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_HOTKEY\n");
+ winDebug("winMWExtWMWindowProc - WM_HOTKEY\n");
#endif
- /* Pass the message to the root window */
- SendMessage (hwndScreen, message, wParam, lParam);
- return 0;
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+ return 0;
case WM_ERASEBKGND:
- winDebug ("winMWExtWMWindowProc - WM_ERASEBKGND\n");
- /*
- * Pretend that we did erase the background but we don't care,
- * since we repaint the entire region anyhow
- * This avoids some flickering when resizing.
- */
- return TRUE;
+ winDebug("winMWExtWMWindowProc - WM_ERASEBKGND\n");
+ /*
+ * Pretend that we did erase the background but we don't care,
+ * since we repaint the entire region anyhow
+ * This avoids some flickering when resizing.
+ */
+ return TRUE;
case WM_PAINT:
-
- /* BeginPaint gives us an hdc that clips to the invalidated region */
- hdcUpdate = BeginPaint (hwnd, &ps);
-
- /* Try to copy from the shadow buffer */
- if (!BitBlt (hdcUpdate,
- ps.rcPaint.left, ps.rcPaint.top,
- ps.rcPaint.right - ps.rcPaint.left,
- ps.rcPaint.bottom - ps.rcPaint.top,
- pRLWinPriv->hdcShadow,
- ps.rcPaint.left, ps.rcPaint.top,
- SRCCOPY))
- {
- LPVOID lpMsgBuf;
-
- /* Display a fancy error message */
- FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError (),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf,
- 0, NULL);
-
- ErrorF ("winMWExtWMWindowProc - BitBlt failed: %s\n",
- (LPSTR)lpMsgBuf);
- LocalFree (lpMsgBuf);
- }
-
- /* EndPaint frees the DC */
- EndPaint (hwnd, &ps);
- break;
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint(hwnd, &ps);
+
+ /* Try to copy from the shadow buffer */
+ if (!BitBlt(hdcUpdate,
+ ps.rcPaint.left, ps.rcPaint.top,
+ ps.rcPaint.right - ps.rcPaint.left,
+ ps.rcPaint.bottom - ps.rcPaint.top,
+ pRLWinPriv->hdcShadow,
+ ps.rcPaint.left, ps.rcPaint.top, SRCCOPY)) {
+ LPVOID lpMsgBuf;
+
+ /* Display a fancy error message */
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) & lpMsgBuf, 0, NULL);
+
+ ErrorF("winMWExtWMWindowProc - BitBlt failed: %s\n",
+ (LPSTR) lpMsgBuf);
+ LocalFree(lpMsgBuf);
+ }
+
+ /* EndPaint frees the DC */
+ EndPaint(hwnd, &ps);
+ break;
case WM_ACTIVATE:
- winDebug ("winMWExtWMWindowProc - WM_ACTIVATE\n");
- if (LOWORD(wParam) != WA_INACTIVE)
- {
+ winDebug("winMWExtWMWindowProc - WM_ACTIVATE\n");
+ if (LOWORD(wParam) != WA_INACTIVE) {
+ if (winIsInternalWMRunning(pScreenInfo)) {
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- {
#if 0
- /* Raise the window to the top in Z order */
- wmMsg.msg = WM_WM_RAISE;
- if (fWMMsgInitialized)
- winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+ /* Raise the window to the top in Z order */
+ wmMsg.msg = WM_WM_RAISE;
+ if (fWMMsgInitialized)
+ winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
#endif
- /* Tell our Window Manager thread to activate the window */
- wmMsg.msg = WM_WM_ACTIVATE;
- if (fWMMsgInitialized)
- if (!pWin || !pWin->overrideRedirect) /* for OOo menus */
- winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
- }
+ /* Tell our Window Manager thread to activate the window */
+ wmMsg.msg = WM_WM_ACTIVATE;
+ if (fWMMsgInitialized)
+ if (!pWin || !pWin->overrideRedirect) /* for OOo menus */
+ winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
+ }
#endif
- winWindowsWMSendEvent(WindowsWMControllerNotify,
- WindowsWMControllerNotifyMask,
- 1,
- WindowsWMActivateWindow,
- pWin->drawable.id,
- 0, 0,
- 0, 0);
- }
- return 0;
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMActivateWindow,
+ pWin->drawable.id, 0, 0, 0, 0);
+ }
+ return 0;
#if 1
case WM_WINDOWPOSCHANGING:
- pWinPos = (LPWINDOWPOS)lParam;
- if (!(pWinPos->flags & SWP_NOZORDER))
- {
- if (pRLWinPriv->fRestackingNow || pScreenPriv->fRestacking)
- {
- winDebug ("Win %08x is now restacking.\n", (unsigned int)pRLWinPriv);
- break;
- }
-
- if (
+ pWinPos = (LPWINDOWPOS) lParam;
+ if (!(pWinPos->flags & SWP_NOZORDER)) {
+ if (pRLWinPriv->fRestackingNow || pScreenPriv->fRestacking) {
+ winDebug("Win %08x is now restacking.\n",
+ (unsigned int) pRLWinPriv);
+ break;
+ }
+
+ if (
#ifdef XWIN_MULTIWINDOWINTWM
- winIsInternalWMRunning(pScreenInfo) ||
+ winIsInternalWMRunning(pScreenInfo) ||
#endif
- IsRaiseOnClick (pWin))
- {
- winDebug ("Win %08x has WINDOWSWM_RAISE_ON_CLICK.\n", (unsigned int)pRLWinPriv);
- break;
- }
-
- winDebug ("Win %08x forbid to change z order (%08x).\n",
- (unsigned int)pRLWinPriv, (unsigned int)pWinPos->hwndInsertAfter);
-
- pWinPos->flags |= SWP_NOZORDER;
- }
- break;
+ IsRaiseOnClick (pWin))
+ winDebug("Win %08x has WINDOWSWM_RAISE_ON_CLICK.\n",
+ (unsigned int) pRLWinPriv);
+ break;
+ }
+
+ winDebug("Win %08x forbid to change z order (%08x).\n",
+ (unsigned int) pRLWinPriv,
+ (unsigned int) pWinPos->hwndInsertAfter);
+ pWinPos->flags |= SWP_NOZORDER;
+ }
+ break;
#endif
case WM_MOVE:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_MOVE - %d ms\n",
- (unsigned int)GetTickCount ());
+ winDebug("winMWExtWMWindowProc - WM_MOVE - %d ms\n",
+ (unsigned int) GetTickCount());
#endif
- if (g_fNoConfigureWindow) break;
+ if (g_fNoConfigureWindow)
+ break;
#if 0
- /* Bail if Windows window is not actually moving */
- if (pRLWinPriv->dwX == (short) LOWORD(lParam)
- && pRLWinPriv->dwY == (short) HIWORD(lParam))
- break;
-
- /* Also bail if we're maximizing, we'll do the whole thing in WM_SIZE */
- {
- WINDOWPLACEMENT windPlace;
- windPlace.length = sizeof (WINDOWPLACEMENT);
-
- /* Get current window placement */
- GetWindowPlacement (hwnd, &windPlace);
-
- /* Bail if maximizing */
- if (windPlace.showCmd == SW_MAXIMIZE
- || windPlace.showCmd == SW_SHOWMAXIMIZED)
- break;
- }
-#endif
+ /* Bail if Windows window is not actually moving */
+ if (pRLWinPriv->dwX == (short) LOWORD(lParam)
+ && pRLWinPriv->dwY == (short) HIWORD(lParam))
+ break;
+
+ /* Also bail if we're maximizing, we'll do the whole thing in WM_SIZE */
+ {
+ WINDOWPLACEMENT windPlace;
+
+ windPlace.length = sizeof(WINDOWPLACEMENT);
+
+ /* Get current window placement */
+ GetWindowPlacement(hwnd, &windPlace);
- winDebug ("\t(%d, %d)\n", (short) LOWORD(lParam), (short) HIWORD(lParam));
+ /* Bail if maximizing */
+ if (windPlace.showCmd == SW_MAXIMIZE
+ || windPlace.showCmd == SW_SHOWMAXIMIZED)
+ break;
+ }
+#endif
- if (!pRLWinPriv->fMovingOrSizing)
- {
+ winDebug("\t(%d, %d)\n", (short) LOWORD(lParam),
+ (short) HIWORD(lParam));
+ if (!pRLWinPriv->fMovingOrSizing) {
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- winAdjustXWindow (pWin, hwnd);
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow(pWin, hwnd);
#endif
- winMWExtWMMoveXWindow (pWin,
- (LOWORD(lParam) - wBorderWidth (pWin)
- - GetSystemMetrics (SM_XVIRTUALSCREEN)),
- (HIWORD(lParam) - wBorderWidth (pWin)
- - GetSystemMetrics (SM_YVIRTUALSCREEN)));
- }
- return 0;
+ winMWExtWMMoveXWindow(pWin, (LOWORD(lParam) - wBorderWidth(pWin)
+ - GetSystemMetrics(SM_XVIRTUALSCREEN)),
+ (HIWORD(lParam) - wBorderWidth(pWin)
+ - GetSystemMetrics(SM_YVIRTUALSCREEN)));
+ }
+ return 0;
case WM_SHOWWINDOW:
- winDebug ("winMWExtWMWindowProc - WM_SHOWWINDOW - %d ms\n",
- (unsigned int)GetTickCount ());
+ winDebug("winMWExtWMWindowProc - WM_SHOWWINDOW - %d ms\n",
+ (unsigned int) GetTickCount());
- /* Bail out if the window is being hidden */
- if (!wParam)
- return 0;
+ /* Bail out if the window is being hidden */
+ if (!wParam)
+ return 0;
#ifdef XWIN_MULTIWINDOWINTWM
- if (!pScreenInfo->fInternalWM)//XXXX
- return 0;
+ if (!pScreenInfo->fInternalWM) //XXXX
+ return 0;
- winMWExtWMUpdateWindowDecoration (pRLWinPriv, pScreenInfo);
+ winMWExtWMUpdateWindowDecoration(pRLWinPriv, pScreenInfo);
- if (winIsInternalWMRunning(pScreenInfo))
- {
- winDebug ("\tMapWindow\n");
+ if (winIsInternalWMRunning(pScreenInfo)) {
+ winDebug("\tMapWindow\n");
- /* Tell X to map the window */
- MapWindow (pWin, wClient(pWin));
+ /* Tell X to map the window */
+ MapWindow(pWin, wClient(pWin));
- if (!pRLWinPriv->pFrame->win->overrideRedirect)
- /* Bring the Windows window to the foreground */
- SetForegroundWindow (hwnd);
+ if (!pRLWinPriv->pFrame->win->overrideRedirect)
+ /* Bring the Windows window to the foreground */
+ SetForegroundWindow(hwnd);
- /* Setup the Window Manager message */
- wmMsg.msg = WM_WM_MAP;
- wmMsg.iWidth = pRLWinPriv->pFrame->width;
- wmMsg.iHeight = pRLWinPriv->pFrame->height;
+ /* Setup the Window Manager message */
+ wmMsg.msg = WM_WM_MAP;
+ wmMsg.iWidth = pRLWinPriv->pFrame->width;
+ wmMsg.iHeight = pRLWinPriv->pFrame->height;
- /* Tell our Window Manager thread to map the window */
- if (fWMMsgInitialized)
- winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
- }
+ /* Tell our Window Manager thread to map the window */
+ if (fWMMsgInitialized)
+ winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
+ }
#else
return 0;
#endif
- break;
+ break;
case WM_SIZING:
- /* Need to legalize the size according to WM_NORMAL_HINTS */
- /* for applications like xterm */
- return ValidateSizing (hwnd, pWin, wParam, lParam);
+ /* Need to legalize the size according to WM_NORMAL_HINTS */
+ /* for applications like xterm */
+ return ValidateSizing(hwnd, pWin, wParam, lParam);
case WM_WINDOWPOSCHANGED:
- {
- pWinPos = (LPWINDOWPOS) lParam;
+ {
+ pWinPos = (LPWINDOWPOS) lParam;
#ifdef _DEBUG
winDebug("winMWExtWMWindowProc - WM_WINDOWPOSCHANGED\n");
- winDebug("\tflags: %s%s%s%s%s%s%s%s%s%s%s%s\n",
- (pWinPos->flags & SWP_DRAWFRAME)?"SWP_DRAWFRAME ":"",
- (pWinPos->flags & SWP_FRAMECHANGED)?"SWP_FRAMECHANGED ":"",
- (pWinPos->flags & SWP_HIDEWINDOW)?"SWP_HIDEWINDOW ":"",
- (pWinPos->flags & SWP_NOACTIVATE)?"SWP_NOACTIVATE ":"",
- (pWinPos->flags & SWP_NOCOPYBITS)?"SWP_NOCOPYBITS ":"",
- (pWinPos->flags & SWP_NOMOVE)?"SWP_NOMOVE ":"",
- (pWinPos->flags & SWP_NOOWNERZORDER)?"SWP_NOOWNERZORDER ":"",
- (pWinPos->flags & SWP_NOSIZE)?"SWP_NOSIZE ":"",
- (pWinPos->flags & SWP_NOREDRAW)?"SWP_NOREDRAW ":"",
- (pWinPos->flags & SWP_NOSENDCHANGING)?"SWP_NOSENDCHANGING ":"",
- (pWinPos->flags & SWP_NOZORDER)?"SWP_NOZORDER ":"",
- (pWinPos->flags & SWP_SHOWWINDOW)?"SWP_SHOWWINDOW ":"");
- winDebug("\tno_configure: %s\n", (g_fNoConfigureWindow?"Yes":"No"));
- winDebug("\textend: (%d, %d, %d, %d)\n",
- pWinPos->x, pWinPos->y, pWinPos->cx, pWinPos->cy);
+ winDebug("\tflags: %s%s%s%s%s%s%s%s%s%s%s%s\n",
+ (pWinPos->flags & SWP_DRAWFRAME) ? "SWP_DRAWFRAME " : "",
+ (pWinPos->flags & SWP_FRAMECHANGED) ? "SWP_FRAMECHANGED " : "",
+ (pWinPos->flags & SWP_HIDEWINDOW) ? "SWP_HIDEWINDOW " : "",
+ (pWinPos->flags & SWP_NOACTIVATE) ? "SWP_NOACTIVATE " : "",
+ (pWinPos->flags & SWP_NOCOPYBITS) ? "SWP_NOCOPYBITS " : "",
+ (pWinPos->flags & SWP_NOMOVE) ? "SWP_NOMOVE " : "",
+ (pWinPos->
+ flags & SWP_NOOWNERZORDER) ? "SWP_NOOWNERZORDER " : "",
+ (pWinPos->flags & SWP_NOSIZE) ? "SWP_NOSIZE " : "",
+ (pWinPos->flags & SWP_NOREDRAW) ? "SWP_NOREDRAW " : "",
+ (pWinPos->
+ flags & SWP_NOSENDCHANGING) ? "SWP_NOSENDCHANGING " : "",
+ (pWinPos->flags & SWP_NOZORDER) ? "SWP_NOZORDER " : "",
+ (pWinPos->flags & SWP_SHOWWINDOW) ? "SWP_SHOWWINDOW " : "");
+ winDebug("\tno_configure: %s\n", (g_fNoConfigureWindow ? "Yes" : "No"));
+ winDebug("\textend: (%d, %d, %d, %d)\n",
+ pWinPos->x, pWinPos->y, pWinPos->cx, pWinPos->cy);
#endif
- if (pWinPos->flags & SWP_HIDEWINDOW) break;
+ if (pWinPos->flags & SWP_HIDEWINDOW)
+ break;
#ifdef XWIN_MULTIWINDOWINTWM
- /* Reorder if window z order was changed */
- if ((pScreenPriv != NULL)
- && !(pWinPos->flags & SWP_NOZORDER)
- && !(pWinPos->flags & SWP_SHOWWINDOW)
- && winIsInternalWMRunning(pScreenInfo))
- {
- winDebug ("\twindow z order was changed\n");
-
- if (pWinPos->hwndInsertAfter == HWND_TOP
- ||pWinPos->hwndInsertAfter == HWND_TOPMOST
- ||pWinPos->hwndInsertAfter == HWND_NOTOPMOST)
- {
- winDebug ("\traise to top\n");
-
- /* Raise the window to the top in Z order */
- wmMsg.msg = WM_WM_RAISE;
- if (fWMMsgInitialized)
- winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
- }
+ /* Reorder if window z order was changed */
+ if ((pScreenPriv != NULL)
+ && !(pWinPos->flags & SWP_NOZORDER)
+ && !(pWinPos->flags & SWP_SHOWWINDOW)
+ && winIsInternalWMRunning(pScreenInfo)) {
+ winDebug("\twindow z order was changed\n");
+
+ if (pWinPos->hwndInsertAfter == HWND_TOP
+ || pWinPos->hwndInsertAfter == HWND_TOPMOST
+ || pWinPos->hwndInsertAfter == HWND_NOTOPMOST) {
+ winDebug("\traise to top\n");
+
+ /* Raise the window to the top in Z order */
+ wmMsg.msg = WM_WM_RAISE;
+ if (fWMMsgInitialized)
+ winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
+ }
#if 1
- else if (pWinPos->hwndInsertAfter == HWND_BOTTOM)
- {
- }
- else
- {
- /* Check if this window is top of X windows. */
- HWND hWndAbove = NULL;
- DWORD dwCurrentProcessID = GetCurrentProcessId ();
- DWORD dwWindowProcessID = 0;
-
- for (hWndAbove = pWinPos->hwndInsertAfter;
- hWndAbove != NULL;
- hWndAbove = GetNextWindow (hWndAbove, GW_HWNDPREV))
- {
- /* Ignore other XWin process's window */
- GetWindowThreadProcessId (hWndAbove, &dwWindowProcessID);
-
- if ((dwWindowProcessID == dwCurrentProcessID)
- && GetProp (hWndAbove, WIN_WINDOW_PROP)
- && !IsWindowVisible (hWndAbove)
- && !IsIconic (hWndAbove) ) /* ignore minimized windows */
- break;
- }
- /* If this is top of X windows in Windows stack,
- raise it in X stack. */
- if (hWndAbove == NULL)
- {
- winDebug ("\traise to top\n");
-
- /* Raise the window to the top in Z order */
- wmMsg.msg = WM_WM_RAISE;
- if (fWMMsgInitialized)
- winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
- }
- }
+ else if (pWinPos->hwndInsertAfter == HWND_BOTTOM) {
+ }
+ else {
+ /* Check if this window is top of X windows. */
+ HWND hWndAbove = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId();
+ DWORD dwWindowProcessID = 0;
+
+ for (hWndAbove = pWinPos->hwndInsertAfter;
+ hWndAbove != NULL;
+ hWndAbove = GetNextWindow(hWndAbove, GW_HWNDPREV)) {
+ /* Ignore other XWin process's window */
+ GetWindowThreadProcessId(hWndAbove, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp(hWndAbove, WIN_WINDOW_PROP)
+ && !IsWindowVisible(hWndAbove)
+ && !IsIconic(hWndAbove)) /* ignore minimized windows */
+ break;
+ }
+ /* If this is top of X windows in Windows stack,
+ raise it in X stack. */
+ if (hWndAbove == NULL) {
+ winDebug("\traise to top\n");
+
+ /* Raise the window to the top in Z order */
+ wmMsg.msg = WM_WM_RAISE;
+ if (fWMMsgInitialized)
+ winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
+ }
+ }
#endif
- }
+ }
#endif
- if (!(pWinPos->flags & SWP_NOSIZE)) {
- if (IsIconic(hwnd)){
- winDebug ("\tIconic -> MINIMIZED\n");
+ if (!(pWinPos->flags & SWP_NOSIZE)) {
+ if (IsIconic(hwnd)) {
+ winDebug("\tIconic -> MINIMIZED\n");
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- {
- /* Raise the window to the top in Z order */
- wmMsg.msg = WM_WM_LOWER;
- if (fWMMsgInitialized)
- winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
- }
+ if (winIsInternalWMRunning(pScreenInfo)) {
+ /* Raise the window to the top in Z order */
+ wmMsg.msg = WM_WM_LOWER;
+ if (fWMMsgInitialized)
+ winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
+ }
#endif
- winWindowsWMSendEvent(WindowsWMControllerNotify,
- WindowsWMControllerNotifyMask,
- 1,
- WindowsWMMinimizeWindow,
- pWin->drawable.id,
- 0, 0, 0, 0);
- } else if (IsZoomed(hwnd)){
- winDebug ("\tZoomed -> MAXIMIZED\n");
-
- winWindowsWMSendEvent(WindowsWMControllerNotify,
- WindowsWMControllerNotifyMask,
- 1,
- WindowsWMMaximizeWindow,
- pWin->drawable.id,
- 0, 0, 0, 0);
- } else {
- winDebug ("\tnone -> RESTORED\n");
-
- winWindowsWMSendEvent(WindowsWMControllerNotify,
- WindowsWMControllerNotifyMask,
- 1,
- WindowsWMRestoreWindow,
- pWin->drawable.id,
- 0, 0, 0, 0);
- }
- }
- if (!g_fNoConfigureWindow ) {
-
- if (!pRLWinPriv->fMovingOrSizing
- /*&& (pWinPos->flags & SWP_SHOWWINDOW)*/) {
- GetClientRect (hwnd, &rcClient);
- MapWindowPoints (hwnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2);
-
- if (!(pWinPos->flags & SWP_NOMOVE)
- &&!(pWinPos->flags & SWP_NOSIZE)) {
- winDebug ("\tmove & resize\n");
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMMinimizeWindow,
+ pWin->drawable.id, 0, 0, 0, 0);
+ }
+ else if (IsZoomed(hwnd)) {
+ winDebug("\tZoomed -> MAXIMIZED\n");
+
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMMaximizeWindow,
+ pWin->drawable.id, 0, 0, 0, 0);
+ }
+ else {
+ winDebug("\tnone -> RESTORED\n");
+
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMRestoreWindow,
+ pWin->drawable.id, 0, 0, 0, 0);
+ }
+ }
+ if (!g_fNoConfigureWindow) {
+
+ if (!pRLWinPriv->fMovingOrSizing
+ /*&& (pWinPos->flags & SWP_SHOWWINDOW) */ ) {
+ GetClientRect(hwnd, &rcClient);
+ MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+
+ if (!(pWinPos->flags & SWP_NOMOVE)
+ && !(pWinPos->flags & SWP_NOSIZE)) {
+ winDebug("\tmove & resize\n");
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- winAdjustXWindow (pWin, hwnd);
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow(pWin, hwnd);
#endif
- winMWExtWMMoveResizeXWindow (pWin,
- rcClient.left - wBorderWidth (pWin)
- - GetSystemMetrics (SM_XVIRTUALSCREEN),
- rcClient.top - wBorderWidth (pWin)
- - GetSystemMetrics (SM_YVIRTUALSCREEN),
- rcClient.right - rcClient.left
- - wBorderWidth (pWin)*2,
- rcClient.bottom - rcClient.top
- - wBorderWidth (pWin)*2);
- } else if (!(pWinPos->flags & SWP_NOMOVE)) {
- winDebug ("\tmove\n");
+ winMWExtWMMoveResizeXWindow(pWin,
+ rcClient.left -
+ wBorderWidth(pWin)
+ -
+ GetSystemMetrics
+ (SM_XVIRTUALSCREEN),
+ rcClient.top -
+ wBorderWidth(pWin)
+ -
+ GetSystemMetrics
+ (SM_YVIRTUALSCREEN),
+ rcClient.right - rcClient.left -
+ wBorderWidth(pWin) * 2,
+ rcClient.bottom - rcClient.top -
+ wBorderWidth(pWin) * 2);
+ }
+ else if (!(pWinPos->flags & SWP_NOMOVE)) {
+ winDebug("\tmove\n");
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- winAdjustXWindow (pWin, hwnd);
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow(pWin, hwnd);
#endif
- winMWExtWMMoveResizeXWindow (pWin,
- rcClient.left - wBorderWidth (pWin)
- - GetSystemMetrics (SM_XVIRTUALSCREEN),
- rcClient.top - wBorderWidth (pWin)
- - GetSystemMetrics (SM_YVIRTUALSCREEN),
- rcClient.right - rcClient.left
- - wBorderWidth (pWin)*2,
- rcClient.bottom - rcClient.top
- - wBorderWidth (pWin)*2);
- } else if (!(pWinPos->flags & SWP_NOMOVE)) {
- winDebug ("\tmove\n");
+ winMWExtWMMoveResizeXWindow(pWin,
+ rcClient.left -
+ wBorderWidth(pWin)
+ -
+ GetSystemMetrics
+ (SM_XVIRTUALSCREEN),
+ rcClient.top -
+ wBorderWidth(pWin)
+ -
+ GetSystemMetrics
+ (SM_YVIRTUALSCREEN),
+ rcClient.right - rcClient.left -
+ wBorderWidth(pWin) * 2,
+ rcClient.bottom - rcClient.top -
+ wBorderWidth(pWin) * 2);
+ }
+ else if (!(pWinPos->flags & SWP_NOMOVE)) {
+ winDebug("\tmove\n");
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- winAdjustXWindow (pWin, hwnd);
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow(pWin, hwnd);
#endif
- winMWExtWMMoveXWindow (pWin,
- rcClient.left - wBorderWidth (pWin)
- - GetSystemMetrics (SM_XVIRTUALSCREEN),
- rcClient.top - wBorderWidth (pWin)
- - GetSystemMetrics (SM_YVIRTUALSCREEN));
- } else if (!(pWinPos->flags & SWP_NOSIZE)) {
- winDebug ("\tresize\n");
+ winMWExtWMMoveXWindow(pWin,
+ rcClient.left - wBorderWidth(pWin)
+ - GetSystemMetrics(SM_XVIRTUALSCREEN),
+ rcClient.top - wBorderWidth(pWin)
+ -
+ GetSystemMetrics(SM_YVIRTUALSCREEN));
+ }
+ else if (!(pWinPos->flags & SWP_NOSIZE)) {
+ winDebug("\tresize\n");
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- winAdjustXWindow (pWin, hwnd);
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow(pWin, hwnd);
#endif
- winMWExtWMResizeXWindow (pWin,
- rcClient.right - rcClient.left
- - wBorderWidth (pWin)*2,
- rcClient.bottom - rcClient.top
- - wBorderWidth (pWin)*2);
- }
- }
- }
- }
- winDebug ("winMWExtWMWindowProc - WM_WINDOWPOSCHANGED - done.\n");
+ winMWExtWMResizeXWindow(pWin,
+ rcClient.right - rcClient.left
+ - wBorderWidth(pWin) * 2,
+ rcClient.bottom - rcClient.top
+ - wBorderWidth(pWin) * 2);
+ }
+ }
+ }
+ }
+ winDebug("winMWExtWMWindowProc - WM_WINDOWPOSCHANGED - done.\n");
- return 0;
+ return 0;
case WM_SIZE:
- /* see dix/window.c */
- /* FIXME: Maximize/Restore? */
- winDebug ("winMWExtWMWindowProc - WM_SIZE - %d ms\n",
- (unsigned int)GetTickCount ());
+ /* see dix/window.c */
+ /* FIXME: Maximize/Restore? */
+ winDebug("winMWExtWMWindowProc - WM_SIZE - %d ms\n",
+ (unsigned int) GetTickCount());
- winDebug ("\t(%d, %d) %d\n", (short) LOWORD(lParam), (short) HIWORD(lParam), g_fNoConfigureWindow);
+ winDebug("\t(%d, %d) %d\n", (short) LOWORD(lParam),
+ (short) HIWORD(lParam), g_fNoConfigureWindow);
+ if (g_fNoConfigureWindow)
+ break;
- if (g_fNoConfigureWindow) break;
-
- /* Branch on type of resizing occurring */
- switch (wParam)
- {
- case SIZE_MINIMIZED:
- winDebug ("\tSIZE_MINIMIZED\n");
+ /* Branch on type of resizing occurring */
+ switch (wParam) {
+ case SIZE_MINIMIZED:
+ winDebug("\tSIZE_MINIMIZED\n");
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- {
- /* Raise the window to the top in Z order */
- wmMsg.msg = WM_WM_LOWER;
- if (fWMMsgInitialized)
- winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
- }
+ if (winIsInternalWMRunning(pScreenInfo)) {
+ /* Raise the window to the top in Z order */
+ wmMsg.msg = WM_WM_LOWER;
+ if (fWMMsgInitialized)
+ winSendMessageToWM(pScreenPriv->pWMInfo, &wmMsg);
+ }
#endif
- winWindowsWMSendEvent(WindowsWMControllerNotify,
- WindowsWMControllerNotifyMask,
- 1,
- WindowsWMMinimizeWindow,
- pWin->drawable.id,
- 0, 0,
- LOWORD(lParam), HIWORD(lParam));
- break;
-
- case SIZE_RESTORED:
- winDebug ("\tSIZE_RESTORED\n");
-
- winWindowsWMSendEvent(WindowsWMControllerNotify,
- WindowsWMControllerNotifyMask,
- 1,
- WindowsWMRestoreWindow,
- pWin->drawable.id,
- 0, 0,
- LOWORD(lParam), HIWORD(lParam));
- break;
-
- case SIZE_MAXIMIZED:
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMMinimizeWindow,
+ pWin->drawable.id,
+ 0, 0, LOWORD(lParam), HIWORD(lParam));
+ break;
+
+ case SIZE_RESTORED:
+ winDebug("\tSIZE_RESTORED\n");
+
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMRestoreWindow,
+ pWin->drawable.id,
+ 0, 0, LOWORD(lParam), HIWORD(lParam));
+ break;
+
+ case SIZE_MAXIMIZED:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("\tSIZE_MAXIMIZED\n");
+ winDebug("\tSIZE_MAXIMIZED\n");
#endif
- winWindowsWMSendEvent(WindowsWMControllerNotify,
- WindowsWMControllerNotifyMask,
- 1,
- WindowsWMMaximizeWindow,
- pWin->drawable.id,
- 0, 0,
- LOWORD(lParam), HIWORD(lParam));
- break;
- }
-
- /* Perform the resize and notify the X client */
- if (!pRLWinPriv->fMovingOrSizing)
- {
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMMaximizeWindow,
+ pWin->drawable.id,
+ 0, 0, LOWORD(lParam), HIWORD(lParam));
+ break;
+ }
+
+ /* Perform the resize and notify the X client */
+ if (!pRLWinPriv->fMovingOrSizing) {
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- winAdjustXWindow (pWin, hwnd);
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow(pWin, hwnd);
#endif
- winMWExtWMResizeXWindow (pWin,
- (short) LOWORD(lParam)
- - wBorderWidth (pWin)*2,
- (short) HIWORD(lParam)
- - wBorderWidth (pWin)*2);
- }
- break;
+ winMWExtWMResizeXWindow(pWin, (short) LOWORD(lParam)
+ - wBorderWidth(pWin) * 2,
+ (short) HIWORD(lParam)
+ - wBorderWidth(pWin) * 2);
+ }
+ break;
case WM_ACTIVATEAPP:
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMWindowProc - WM_ACTIVATEAPP - %d ms\n",
- (unsigned int)GetTickCount ());
+ winDebug("winMWExtWMWindowProc - WM_ACTIVATEAPP - %d ms\n",
+ (unsigned int) GetTickCount());
#endif
- if (wParam)
- {
+ if (wParam) {
+ if (winIsInternalWMRunning(pScreenInfo)) {
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- {
- }
- else
- {
- }
+ }
+ else {
+ }
#endif
- winWindowsWMSendEvent(WindowsWMActivationNotify,
- WindowsWMActivationNotifyMask,
- 1,
- WindowsWMIsActive,
- pWin->drawable.id,
- 0, 0,
- 0, 0);
- }
- else
- {
- winWindowsWMSendEvent(WindowsWMActivationNotify,
- WindowsWMActivationNotifyMask,
- 1,
- WindowsWMIsInactive,
- pWin->drawable.id,
- 0, 0,
- 0, 0);
- }
- break;
+ winWindowsWMSendEvent(WindowsWMActivationNotify,
+ WindowsWMActivationNotifyMask,
+ 1,
+ WindowsWMIsActive,
+ pWin->drawable.id, 0, 0, 0, 0);
+ }
+ else {
+ winWindowsWMSendEvent(WindowsWMActivationNotify,
+ WindowsWMActivationNotifyMask,
+ 1,
+ WindowsWMIsInactive,
+ pWin->drawable.id, 0, 0, 0, 0);
+ }
+ break;
case WM_SETCURSOR:
- if (LOWORD(lParam) == HTCLIENT)
- {
- if (!g_fSoftwareCursor) SetCursor (pScreenPriv->cursor.handle);
- return TRUE;
- }
- break;
+ if (LOWORD(lParam) == HTCLIENT) {
+ if (!g_fSoftwareCursor)
+ SetCursor(pScreenPriv->cursor.handle);
+ return TRUE;
+ }
+ break;
case WM_ENTERSIZEMOVE:
- winDebug ("winMWExtWMWindowProc - WM_ENTERSIZEMOVE - %d ms\n",
- (unsigned int)GetTickCount ());
+ winDebug("winMWExtWMWindowProc - WM_ENTERSIZEMOVE - %d ms\n",
+ (unsigned int) GetTickCount());
- pRLWinPriv->fMovingOrSizing = TRUE;
- break;
+ pRLWinPriv->fMovingOrSizing = TRUE;
+ break;
case WM_EXITSIZEMOVE:
- winDebug ("winMWExtWMWindowProc - WM_EXITSIZEMOVE - %d ms\n",
- (unsigned int)GetTickCount ());
+ winDebug("winMWExtWMWindowProc - WM_EXITSIZEMOVE - %d ms\n",
+ (unsigned int) GetTickCount());
- pRLWinPriv->fMovingOrSizing = FALSE;
+ pRLWinPriv->fMovingOrSizing = FALSE;
- GetClientRect (hwnd, &rcClient);
+ GetClientRect(hwnd, &rcClient);
- MapWindowPoints (hwnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2);
+ MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) & rcClient, 2);
#ifdef XWIN_MULTIWINDOWINTWM
- if (winIsInternalWMRunning(pScreenInfo))
- winAdjustXWindow (pWin, hwnd);
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow(pWin, hwnd);
#endif
- winMWExtWMMoveResizeXWindow (pWin,
- rcClient.left - wBorderWidth (pWin)
- - GetSystemMetrics (SM_XVIRTUALSCREEN),
- rcClient.top - wBorderWidth (pWin)
- - GetSystemMetrics (SM_YVIRTUALSCREEN),
- rcClient.right - rcClient.left
- - wBorderWidth (pWin)*2,
- rcClient.bottom - rcClient.top
- - wBorderWidth (pWin)*2);
- break;
+ winMWExtWMMoveResizeXWindow(pWin, rcClient.left - wBorderWidth(pWin)
+ - GetSystemMetrics(SM_XVIRTUALSCREEN),
+ rcClient.top - wBorderWidth(pWin)
+ - GetSystemMetrics(SM_YVIRTUALSCREEN),
+ rcClient.right - rcClient.left
+ - wBorderWidth(pWin) * 2,
+ rcClient.bottom - rcClient.top
+ - wBorderWidth(pWin) * 2);
+ break;
case WM_MANAGE:
- winDebug ("winMWExtWMWindowProc - WM_MANAGE\n");
- break;
+ winDebug ("winMWExtWMWindowProc - WM_MANAGE\n");
+ break;
case WM_UNMANAGE:
- winDebug ("winMWExtWMWindowProc - WM_UNMANAGE\n");
- break;
+ winDebug ("winMWExtWMWindowProc - WM_UNMANAGE\n");
+ break;
default:
- break;
+ break;
}
- return DefWindowProc (hwnd, message, wParam, lParam);
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c
index b83ea9485..a847561f8 100644
--- a/xorg-server/hw/xwin/winwindow.c
+++ b/xorg-server/hw/xwin/winwindow.c
@@ -34,559 +34,533 @@
#endif
#include "win.h"
-
/*
* Prototypes for local functions
*/
static int
-winAddRgn (WindowPtr pWindow, pointer data);
+ winAddRgn(WindowPtr pWindow, pointer data);
static
-void
-winUpdateRgnRootless (WindowPtr pWindow);
+ void
+ winUpdateRgnRootless(WindowPtr pWindow);
static
-void
-winReshapeRootless (WindowPtr pWin);
-
+ void
+ winReshapeRootless(WindowPtr pWin);
#ifdef XWIN_NATIVEGDI
/* See Porting Layer Definition - p. 37 */
/* See mfb/mfbwindow.c - mfbCreateWindow() */
Bool
-winCreateWindowNativeGDI (WindowPtr pWin)
+winCreateWindowNativeGDI(WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winDebug ("winCreateWindowNativeGDI (%p)\n", pWin);
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
- WIN_UNWRAP(CreateWindow);
- fResult = (*pScreen->CreateWindow) (pWin);
- WIN_WRAP(CreateWindow, winCreateWindowNativeGDI);
+ winDebug ("winCreateWindowNativeGDI (%p)\n", pWin);
- return fResult;
-}
+ WIN_UNWRAP(CreateWindow);
+ fResult = (*pScreen->CreateWindow) (pWin);
+ WIN_WRAP(CreateWindow, winCreateWindowNativeGDI);
+ return fResult;
+}
/* See Porting Layer Definition - p. 37 */
/* See mfb/mfbwindow.c - mfbDestroyWindow() */
Bool
-winDestroyWindowNativeGDI (WindowPtr pWin)
+winDestroyWindowNativeGDI(WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winDebug ("winDestroyWindowNativeGDI (%p)\n", pWin);
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
- WIN_UNWRAP(DestroyWindow);
- fResult = (*pScreen->DestroyWindow)(pWin);
- WIN_WRAP(DestroyWindow, winDestroyWindowNativeGDI);
+ winDebug ("winDestroyWindowNativeGDI (%p)\n", pWin);
- return fResult;
-}
+ WIN_UNWRAP(DestroyWindow);
+ fResult = (*pScreen->DestroyWindow) (pWin);
+ WIN_WRAP(DestroyWindow, winDestroyWindowNativeGDI);
+ return fResult;
+}
/* See Porting Layer Definition - p. 37 */
/* See mfb/mfbwindow.c - mfbPositionWindow() */
Bool
-winPositionWindowNativeGDI (WindowPtr pWin, int x, int y)
+winPositionWindowNativeGDI(WindowPtr pWin, int x, int y)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- winDebug ("winPositionWindowNativeGDI (%p)\n", pWin);
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
- WIN_UNWRAP(PositionWindow);
- fResult = (*pScreen->PositionWindow)(pWin, x, y);
- WIN_WRAP(PositionWindow, winPositionWindowNativeGDI);
+ winDebug ("winPositionWindowNativeGDI (%p)\n", pWin);
- return fResult;
-}
+ WIN_UNWRAP(PositionWindow);
+ fResult = (*pScreen->PositionWindow) (pWin, x, y);
+ WIN_WRAP(PositionWindow, winPositionWindowNativeGDI);
+ return fResult;
+}
/* See Porting Layer Definition - p. 39 */
/* See mfb/mfbwindow.c - mfbCopyWindow() */
-void
-winCopyWindowNativeGDI (WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
+void
+winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- DDXPointPtr pptSrc;
- DDXPointPtr ppt;
- RegionPtr prgnDst;
- BoxPtr pBox;
- int dx, dy;
- int i, nbox;
- WindowPtr pwinRoot;
- BoxPtr pBoxDst;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
-
- /* Get a pointer to the root window */
- pwinRoot = pWin->drawable.pScreen->root;
-
- /* Create a region for the destination */
- prgnDst = RegionCreate(NULL, 1);
-
- /* Calculate the shift from the source to the destination */
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
-
- /* Translate the region from the destination to the source? */
- RegionTranslate(prgnSrc, -dx, -dy);
- RegionIntersect(prgnDst, &pWin->borderClip,
- prgnSrc);
-
- /* Get a pointer to the first box in the region to be copied */
- pBox = RegionRects(prgnDst);
-
- /* Get the number of boxes in the region */
- nbox = RegionNumRects(prgnDst);
-
- /* Allocate source points for each box */
- if(!(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec))))
- return;
+ DDXPointPtr pptSrc;
+ DDXPointPtr ppt;
+ RegionPtr prgnDst;
+ BoxPtr pBox;
+ int dx, dy;
+ int i, nbox;
+ WindowPtr pwinRoot;
+ BoxPtr pBoxDst;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winScreenPriv(pScreen);
+
+ /* Get a pointer to the root window */
+ pwinRoot = pWin->drawable.pScreen->root;
+
+ /* Create a region for the destination */
+ prgnDst = RegionCreate(NULL, 1);
+
+ /* Calculate the shift from the source to the destination */
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+
+ /* Translate the region from the destination to the source? */
+ RegionTranslate(prgnSrc, -dx, -dy);
+ RegionIntersect(prgnDst, &pWin->borderClip, prgnSrc);
- /* Set an iterator pointer */
- ppt = pptSrc;
+ /* Get a pointer to the first box in the region to be copied */
+ pBox = RegionRects(prgnDst);
- /* Calculate the source point of each box? */
- for (i = nbox; --i >= 0; ppt++, pBox++)
- {
- ppt->x = pBox->x1 + dx;
- ppt->y = pBox->y1 + dy;
+ /* Get the number of boxes in the region */
+ nbox = RegionNumRects(prgnDst);
+
+ /* Allocate source points for each box */
+ if (!(pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec))))
+ return;
+
+ /* Set an iterator pointer */
+ ppt = pptSrc;
+
+ /* Calculate the source point of each box? */
+ for (i = nbox; --i >= 0; ppt++, pBox++) {
+ ppt->x = pBox->x1 + dx;
+ ppt->y = pBox->y1 + dy;
}
- /* Setup loop pointers again */
- pBoxDst = RegionRects(prgnDst);
- ppt = pptSrc;
-
- /* BitBlt each source to the destination point */
- for (i = nbox; --i >= 0; pBoxDst++, ppt++)
- {
- BitBlt (pScreenPriv->hdcScreen,
- pBoxDst->x1, pBoxDst->y1,
- pBoxDst->x2 - pBoxDst->x1, pBoxDst->y2 - pBoxDst->y1,
- pScreenPriv->hdcScreen,
- ppt->x, ppt->y,
- SRCCOPY);
+ /* Setup loop pointers again */
+ pBoxDst = RegionRects(prgnDst);
+ ppt = pptSrc;
+
+ /* BitBlt each source to the destination point */
+ for (i = nbox; --i >= 0; pBoxDst++, ppt++) {
+ BitBlt(pScreenPriv->hdcScreen,
+ pBoxDst->x1, pBoxDst->y1,
+ pBoxDst->x2 - pBoxDst->x1, pBoxDst->y2 - pBoxDst->y1,
+ pScreenPriv->hdcScreen, ppt->x, ppt->y, SRCCOPY);
}
- /* Cleanup the regions, etc. */
- free(pptSrc);
- RegionDestroy(prgnDst);
+ /* Cleanup the regions, etc. */
+ free(pptSrc);
+ RegionDestroy(prgnDst);
}
-
/* See Porting Layer Definition - p. 37 */
/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */
Bool
-winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask)
+winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
winDebug ("winChangeWindowAttributesNativeGDI (%p)\n", pWin);
-
- WIN_UNWRAP(ChangeWindowAttributes);
- fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask);
- WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesNativeGDI);
-
- /*
- * NOTE: We do not currently need to do anything here.
- */
-
- return fResult;
-}
+ WIN_UNWRAP(ChangeWindowAttributes);
+ fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
+ WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesNativeGDI);
+
+ /*
+ * NOTE: We do not currently need to do anything here.
+ */
+
+ return fResult;
+}
/* See Porting Layer Definition - p. 37
* Also referred to as UnrealizeWindow
*/
Bool
-winUnmapWindowNativeGDI (WindowPtr pWin)
+winUnmapWindowNativeGDI(WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
winDebug ("winUnmapWindowNativeGDI (%p)\n", pWin);
- WIN_UNWRAP(UnrealizeWindow);
- fResult = (*pScreen->UnrealizeWindow)(pWin);
- WIN_WRAP(UnrealizeWindow, winUnmapWindowNativeGDI);
-
- return fResult;
-}
+ WIN_UNWRAP(UnrealizeWindow);
+ fResult = (*pScreen->UnrealizeWindow) (pWin);
+ WIN_WRAP(UnrealizeWindow, winUnmapWindowNativeGDI);
+ return fResult;
+}
/* See Porting Layer Definition - p. 37
* Also referred to as RealizeWindow
*/
Bool
-winMapWindowNativeGDI (WindowPtr pWin)
+winMapWindowNativeGDI(WindowPtr pWin)
{
- Bool fResult = TRUE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
winDebug ("winMapWindowNativeGDI (%p)\n", pWin);
- WIN_UNWRAP(RealizeWindow);
- fResult = (*pScreen->RealizeWindow)(pWin);
- WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
-
- return fResult;
+ WIN_UNWRAP(RealizeWindow);
+ fResult = (*pScreen->RealizeWindow) (pWin);
+ WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
+
+ return fResult;
}
#endif
-
/* See Porting Layer Definition - p. 37 */
/* See mfb/mfbwindow.c - mfbCreateWindow() */
Bool
-winCreateWindowRootless (WindowPtr pWin)
+winCreateWindowRootless(WindowPtr pWin)
{
- Bool fResult = FALSE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
winDebug ("winCreateWindowRootless (%p)\n", pWin);
- WIN_UNWRAP(CreateWindow);
- fResult = (*pScreen->CreateWindow) (pWin);
- WIN_WRAP(CreateWindow, winCreateWindowRootless);
-
- pWinPriv->hRgn = NULL;
-
- return fResult;
-}
+ WIN_UNWRAP(CreateWindow);
+ fResult = (*pScreen->CreateWindow) (pWin);
+ WIN_WRAP(CreateWindow, winCreateWindowRootless);
+
+ pWinPriv->hRgn = NULL;
+ return fResult;
+}
/* See Porting Layer Definition - p. 37 */
/* See mfb/mfbwindow.c - mfbDestroyWindow() */
Bool
-winDestroyWindowRootless (WindowPtr pWin)
+winDestroyWindowRootless(WindowPtr pWin)
{
- Bool fResult = FALSE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
winDebug ("winDestroyWindowRootless (%p)\n", pWin);
- WIN_UNWRAP(DestroyWindow);
- fResult = (*pScreen->DestroyWindow)(pWin);
- WIN_WRAP(DestroyWindow, winDestroyWindowRootless);
-
- if (pWinPriv->hRgn != NULL)
- {
- DeleteObject(pWinPriv->hRgn);
- pWinPriv->hRgn = NULL;
+ WIN_UNWRAP(DestroyWindow);
+ fResult = (*pScreen->DestroyWindow) (pWin);
+ WIN_WRAP(DestroyWindow, winDestroyWindowRootless);
+
+ if (pWinPriv->hRgn != NULL) {
+ DeleteObject(pWinPriv->hRgn);
+ pWinPriv->hRgn = NULL;
}
-
- winUpdateRgnRootless (pWin);
-
- return fResult;
-}
+ winUpdateRgnRootless(pWin);
+
+ return fResult;
+}
/* See Porting Layer Definition - p. 37 */
/* See mfb/mfbwindow.c - mfbPositionWindow() */
Bool
-winPositionWindowRootless (WindowPtr pWin, int x, int y)
+winPositionWindowRootless(WindowPtr pWin, int x, int y)
{
- Bool fResult = FALSE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
-
- winDebug ("winPositionWindowRootless (%p)\n", pWin);
-
- WIN_UNWRAP(PositionWindow);
- fResult = (*pScreen->PositionWindow)(pWin, x, y);
- WIN_WRAP(PositionWindow, winPositionWindowRootless);
-
- winUpdateRgnRootless (pWin);
-
- return fResult;
-}
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winScreenPriv(pScreen);
+ winDebug ("winPositionWindowRootless (%p)\n", pWin);
+
+ WIN_UNWRAP(PositionWindow);
+ fResult = (*pScreen->PositionWindow) (pWin, x, y);
+ WIN_WRAP(PositionWindow, winPositionWindowRootless);
+
+ winUpdateRgnRootless(pWin);
+
+ return fResult;
+}
/* See Porting Layer Definition - p. 37 */
/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */
Bool
-winChangeWindowAttributesRootless (WindowPtr pWin, unsigned long mask)
+winChangeWindowAttributesRootless(WindowPtr pWin, unsigned long mask)
{
- Bool fResult = FALSE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winScreenPriv(pScreen);
winDebug ("winChangeWindowAttributesRootless (%p)\n", pWin);
- WIN_UNWRAP(ChangeWindowAttributes);
- fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask);
- WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesRootless);
+ WIN_UNWRAP(ChangeWindowAttributes);
+ fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
+ WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesRootless);
- winUpdateRgnRootless (pWin);
-
- return fResult;
-}
+ winUpdateRgnRootless(pWin);
+ return fResult;
+}
/* See Porting Layer Definition - p. 37
* Also referred to as UnrealizeWindow
*/
Bool
-winUnmapWindowRootless (WindowPtr pWin)
+winUnmapWindowRootless(WindowPtr pWin)
{
- Bool fResult = FALSE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
- winScreenPriv(pScreen);
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
winDebug ("winUnmapWindowRootless (%p)\n", pWin);
- WIN_UNWRAP(UnrealizeWindow);
- fResult = (*pScreen->UnrealizeWindow)(pWin);
- WIN_WRAP(UnrealizeWindow, winUnmapWindowRootless);
-
- if (pWinPriv->hRgn != NULL)
- {
- DeleteObject(pWinPriv->hRgn);
- pWinPriv->hRgn = NULL;
+ WIN_UNWRAP(UnrealizeWindow);
+ fResult = (*pScreen->UnrealizeWindow) (pWin);
+ WIN_WRAP(UnrealizeWindow, winUnmapWindowRootless);
+
+ if (pWinPriv->hRgn != NULL) {
+ DeleteObject(pWinPriv->hRgn);
+ pWinPriv->hRgn = NULL;
}
-
- winUpdateRgnRootless (pWin);
-
- return fResult;
-}
+ winUpdateRgnRootless(pWin);
+
+ return fResult;
+}
/* See Porting Layer Definition - p. 37
* Also referred to as RealizeWindow
*/
Bool
-winMapWindowRootless (WindowPtr pWin)
+winMapWindowRootless(WindowPtr pWin)
{
- Bool fResult = FALSE;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winScreenPriv(pScreen);
winDebug ("winMapWindowRootless (%p)\n", pWin);
- WIN_UNWRAP(RealizeWindow);
- fResult = (*pScreen->RealizeWindow)(pWin);
- WIN_WRAP(RealizeWindow, winMapWindowRootless);
+ WIN_UNWRAP(RealizeWindow);
+ fResult = (*pScreen->RealizeWindow) (pWin);
+ WIN_WRAP(RealizeWindow, winMapWindowRootless);
- winReshapeRootless (pWin);
-
- winUpdateRgnRootless (pWin);
-
- return fResult;
-}
+ winReshapeRootless(pWin);
+ winUpdateRgnRootless(pWin);
+
+ return fResult;
+}
void
-winSetShapeRootless (WindowPtr pWin, int kind)
+winSetShapeRootless(WindowPtr pWin, int kind)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- winScreenPriv(pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ winScreenPriv(pScreen);
winDebug ("winSetShapeRootless (%p, %i)\n", pWin, kind);
- WIN_UNWRAP(SetShape);
- (*pScreen->SetShape)(pWin, kind);
- WIN_WRAP(SetShape, winSetShapeRootless);
-
- winReshapeRootless (pWin);
- winUpdateRgnRootless (pWin);
-
- return;
-}
+ WIN_UNWRAP(SetShape);
+ (*pScreen->SetShape) (pWin, kind);
+ WIN_WRAP(SetShape, winSetShapeRootless);
+ winReshapeRootless(pWin);
+ winUpdateRgnRootless(pWin);
+
+ return;
+}
/*
* Local function for adding a region to the Windows window region
*/
static
-int
-winAddRgn (WindowPtr pWin, pointer data)
+ int
+winAddRgn(WindowPtr pWin, pointer data)
{
- int iX, iY, iWidth, iHeight, iBorder;
- HRGN hRgn = *(HRGN*)data;
- HRGN hRgnWin;
- winWindowPriv(pWin);
-
- /* If pWin is not Root */
- if (pWin->parent != NULL)
- {
- winDebug ("winAddRgn ()\n");
- if (pWin->mapped)
- {
- iBorder = wBorderWidth (pWin);
-
- iX = pWin->drawable.x - iBorder;
- iY = pWin->drawable.y - iBorder;
-
- iWidth = pWin->drawable.width + iBorder * 2;
- iHeight = pWin->drawable.height + iBorder * 2;
-
- hRgnWin = CreateRectRgn (0, 0, iWidth, iHeight);
-
- if (hRgnWin == NULL)
- {
- winDebug ("winAddRgn - CreateRectRgn () failed\n");
- winDebug (" Rect %d %d %d %d\n",
- iX, iY, iX + iWidth, iY + iHeight);
- }
-
- if (pWinPriv->hRgn)
- {
- if (CombineRgn (hRgnWin, hRgnWin, pWinPriv->hRgn, RGN_AND)
- == ERROR)
- {
- ErrorF ("winAddRgn - CombineRgn () failed\n");
- }
- }
-
- OffsetRgn (hRgnWin, iX, iY);
-
- if (CombineRgn (hRgn, hRgn, hRgnWin, RGN_OR) == ERROR)
- {
- ErrorF ("winAddRgn - CombineRgn () failed\n");
- }
-
- DeleteObject (hRgnWin);
- }
- return WT_DONTWALKCHILDREN;
+ int iX, iY, iWidth, iHeight, iBorder;
+ HRGN hRgn = *(HRGN *) data;
+ HRGN hRgnWin;
+
+ winWindowPriv(pWin);
+
+ /* If pWin is not Root */
+ if (pWin->parent != NULL) {
+ winDebug("winAddRgn ()\n");
+ if (pWin->mapped) {
+ iBorder = wBorderWidth(pWin);
+
+ iX = pWin->drawable.x - iBorder;
+ iY = pWin->drawable.y - iBorder;
+
+ iWidth = pWin->drawable.width + iBorder * 2;
+ iHeight = pWin->drawable.height + iBorder * 2;
+
+ hRgnWin = CreateRectRgn(0, 0, iWidth, iHeight);
+
+ if (hRgnWin == NULL) {
+ winDebug ("winAddRgn - CreateRectRgn () failed\n");
+ winDebug (" Rect %d %d %d %d\n",
+ iX, iY, iX + iWidth, iY + iHeight);
+ }
+
+ if (pWinPriv->hRgn) {
+ if (CombineRgn(hRgnWin, hRgnWin, pWinPriv->hRgn, RGN_AND)
+ == ERROR) {
+ ErrorF("winAddRgn - CombineRgn () failed\n");
+ }
+ }
+
+ OffsetRgn(hRgnWin, iX, iY);
+
+ if (CombineRgn(hRgn, hRgn, hRgnWin, RGN_OR) == ERROR) {
+ ErrorF("winAddRgn - CombineRgn () failed\n");
+ }
+
+ DeleteObject(hRgnWin);
+ }
+ return WT_DONTWALKCHILDREN;
}
- else
- {
- return WT_WALKCHILDREN;
+ else {
+ return WT_WALKCHILDREN;
}
}
-
/*
* Local function to update the Windows window's region
*/
static
-void
-winUpdateRgnRootless (WindowPtr pWin)
+ void
+winUpdateRgnRootless(WindowPtr pWin)
{
- HRGN hRgn = CreateRectRgn (0, 0, 0, 0);
-
- if (hRgn != NULL)
- {
- WalkTree (pWin->drawable.pScreen, winAddRgn, &hRgn);
- SetWindowRgn (winGetScreenPriv(pWin->drawable.pScreen)->hwndScreen,
- hRgn, TRUE);
+ HRGN hRgn = CreateRectRgn(0, 0, 0, 0);
+
+ if (hRgn != NULL) {
+ WalkTree(pWin->drawable.pScreen, winAddRgn, &hRgn);
+ SetWindowRgn(winGetScreenPriv(pWin->drawable.pScreen)->hwndScreen,
+ hRgn, TRUE);
}
- else
- {
- ErrorF ("winUpdateRgnRootless - CreateRectRgn failed.\n");
+ else {
+ ErrorF("winUpdateRgnRootless - CreateRectRgn failed.\n");
}
}
-
static
-void
-winReshapeRootless (WindowPtr pWin)
+ void
+winReshapeRootless(WindowPtr pWin)
{
- int nRects;
- RegionRec rrNewShape;
- BoxPtr pShape, pRects, pEnd;
- HRGN hRgn, hRgnRect;
- winWindowPriv(pWin);
+ int nRects;
+ RegionRec rrNewShape;
+ BoxPtr pShape, pRects, pEnd;
+ HRGN hRgn, hRgnRect;
- winDebug ("winReshapeRootless ()\n");
+ winWindowPriv(pWin);
- /* Bail if the window is the root window */
- if (pWin->parent == NULL)
- return;
+ winDebug("winReshapeRootless ()\n");
- /* Bail if the window is not top level */
- if (pWin->parent->parent != NULL)
- return;
+ /* Bail if the window is the root window */
+ if (pWin->parent == NULL)
+ return;
- /* Free any existing window region stored in the window privates */
- if (pWinPriv->hRgn != NULL)
- {
- DeleteObject (pWinPriv->hRgn);
- pWinPriv->hRgn = NULL;
+ /* Bail if the window is not top level */
+ if (pWin->parent->parent != NULL)
+ return;
+
+ /* Free any existing window region stored in the window privates */
+ if (pWinPriv->hRgn != NULL) {
+ DeleteObject(pWinPriv->hRgn);
+ pWinPriv->hRgn = NULL;
}
-
- /* Bail if the window has no bounding region defined */
- if (!wBoundingShape (pWin))
- return;
- RegionNull(&rrNewShape);
- RegionCopy(&rrNewShape, wBoundingShape(pWin));
- RegionTranslate(&rrNewShape, pWin->borderWidth,
- pWin->borderWidth);
-
- nRects = RegionNumRects(&rrNewShape);
- pShape = RegionRects(&rrNewShape);
-
- if (nRects > 0)
- {
- /* Create initial empty Windows region */
- hRgn = CreateRectRgn (0, 0, 0, 0);
-
- /* Loop through all rectangles in the X region */
- for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++)
- {
- /* Create a Windows region for the X rectangle */
- hRgnRect = CreateRectRgn (pRects->x1, pRects->y1,
- pRects->x2, pRects->y2);
- if (hRgnRect == NULL)
- {
- ErrorF("winReshapeRootless - CreateRectRgn() failed\n");
- }
-
- /* Merge the Windows region with the accumulated region */
- if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR)
- {
- ErrorF("winReshapeRootless - CombineRgn() failed\n");
- }
-
- /* Delete the temporary Windows region */
- DeleteObject (hRgnRect);
+ /* Bail if the window has no bounding region defined */
+ if (!wBoundingShape(pWin))
+ return;
+
+ RegionNull(&rrNewShape);
+ RegionCopy(&rrNewShape, wBoundingShape(pWin));
+ RegionTranslate(&rrNewShape, pWin->borderWidth, pWin->borderWidth);
+
+ nRects = RegionNumRects(&rrNewShape);
+ pShape = RegionRects(&rrNewShape);
+
+ if (nRects > 0) {
+ /* Create initial empty Windows region */
+ hRgn = CreateRectRgn(0, 0, 0, 0);
+
+ /* Loop through all rectangles in the X region */
+ for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++) {
+ /* Create a Windows region for the X rectangle */
+ hRgnRect = CreateRectRgn(pRects->x1, pRects->y1,
+ pRects->x2, pRects->y2);
+ if (hRgnRect == NULL) {
+ ErrorF("winReshapeRootless - CreateRectRgn() failed\n");
+ }
+
+ /* Merge the Windows region with the accumulated region */
+ if (CombineRgn(hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) {
+ ErrorF("winReshapeRootless - CombineRgn() failed\n");
+ }
+
+ /* Delete the temporary Windows region */
+ DeleteObject(hRgnRect);
}
-
- /* Save a handle to the composite region in the window privates */
- pWinPriv->hRgn = hRgn;
+
+ /* Save a handle to the composite region in the window privates */
+ pWinPriv->hRgn = hRgn;
}
- RegionUninit(&rrNewShape);
-
- return;
+ RegionUninit(&rrNewShape);
+
+ return;
}
diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h
index 7721f1411..ce8157d8a 100644
--- a/xorg-server/hw/xwin/winwindow.h
+++ b/xorg-server/hw/xwin/winwindow.h
@@ -41,7 +41,7 @@
/* Constant strings */
#ifndef PROJECT_NAME
-# define PROJECT_NAME "VcXsrv"
+#define PROJECT_NAME "VcXsrv"
#endif
#define EXECUTABLE_NAME "VcXsrv"
#define WINDOW_CLASS "VcXsrv/x"
@@ -52,7 +52,7 @@
#define WINDOW_TITLE_X PROJECT_NAME " X"
#define WIN_WINDOW_PROP "vcxsrv_window_prop_rl"
#ifdef HAS_DEVWINDOWS
-# define WIN_MSG_QUEUE_FNAME "/dev/windows"
+#define WIN_MSG_QUEUE_FNAME "/dev/windows"
#endif
#define WIN_WID_PROP "vcxsrv_wid_prop_rl"
#define WIN_NEEDMANAGE_PROP "vcxsrv_override_redirect_prop_rl"
@@ -61,45 +61,42 @@
typedef struct _winPrivScreenRec *winPrivScreenPtr;
-
/*
* Window privates
*/
-typedef struct
-{
- DWORD dwDummy;
- HRGN hRgn;
- HWND hWnd;
+typedef struct {
+ DWORD dwDummy;
+ HRGN hRgn;
+ HWND hWnd;
BOOL OpenGlWindow;
- winPrivScreenPtr pScreenPriv;
- Bool fXKilled;
- HDWP hDwp;
+ winPrivScreenPtr pScreenPriv;
+ Bool fXKilled;
+ HDWP hDwp;
#ifdef XWIN_GLX_WINDOWS
- Bool fWglUsed;
+ Bool fWglUsed;
#endif
- /* Privates used by primary fb DirectDraw server */
- LPDDSURFACEDESC pddsdPrimary;
+ /* Privates used by primary fb DirectDraw server */
+ LPDDSURFACEDESC pddsdPrimary;
- /* Privates used by shadow fb DirectDraw Nonlocking server */
- LPDIRECTDRAWSURFACE4 pddsPrimary4;
+ /* Privates used by shadow fb DirectDraw Nonlocking server */
+ LPDIRECTDRAWSURFACE4 pddsPrimary4;
- /* Privates used by both shadow fb DirectDraw servers */
- LPDIRECTDRAWCLIPPER pddcPrimary;
+ /* Privates used by both shadow fb DirectDraw servers */
+ LPDIRECTDRAWCLIPPER pddcPrimary;
} winPrivWinRec, *winPrivWinPtr;
#ifdef XWIN_MULTIWINDOW
-typedef struct _winWMMessageRec{
- DWORD dwID;
- DWORD msg;
- int iWindow;
- HWND hwndWindow;
- int iX, iY;
- int iWidth, iHeight;
+typedef struct _winWMMessageRec {
+ DWORD dwID;
+ DWORD msg;
+ int iWindow;
+ HWND hwndWindow;
+ int iX, iY;
+ int iWidth, iHeight;
} winWMMessageRec, *winWMMessagePtr;
-
/*
* winmultiwindowwm.c
*/
@@ -135,27 +132,27 @@ typedef struct _winWMMessageRec{
/* This structure only contains 3 elements... the Motif 2.0 structure
contains 5... we only need the first 3... so that is all we will define */
typedef struct MwmHints {
- unsigned long flags, functions, decorations;
+ unsigned long flags, functions, decorations;
} MwmHints;
+
#define PropMwmHintsElements 3
void
-winSendMessageToWM (void *pWMInfo, winWMMessagePtr msg);
+ winSendMessageToWM(void *pWMInfo, winWMMessagePtr msg);
Bool
-winInitWM (void **ppWMInfo,
- pthread_t *ptWMProc,
- pthread_t *ptXMsgProc,
- pthread_mutex_t *ppmServerStarted,
- int dwScreen,
- HWND hwndScreen,
- BOOL allowOtherWM);
+
+winInitWM(void **ppWMInfo,
+ pthread_t * ptWMProc,
+ pthread_t * ptXMsgProc,
+ pthread_mutex_t * ppmServerStarted,
+ int dwScreen, HWND hwndScreen, BOOL allowOtherWM);
void
-winDeinitMultiWindowWM (void);
+ winDeinitMultiWindowWM(void);
void
-winMinimizeWindow (Window id);
+ winMinimizeWindow(Window id);
void
winTaskbarInit (void);
@@ -165,19 +162,18 @@ winTaskbarDestroy (void);
void
winSetAppID (HWND hWnd, const char* AppID);
-
/*
* winmultiwindowicons.c
*/
void
-winUpdateIcon (Window id);
+ winUpdateIcon(Window id);
-void
-winInitGlobalIcons (void);
+void
+ winInitGlobalIcons(void);
-void
-winDestroyIcon(HICON hIcon);
+void
+ winDestroyIcon(HICON hIcon);
-#endif /* XWIN_MULTIWINDOW */
+#endif /* XWIN_MULTIWINDOW */
#endif
diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c
index 05879eb9d..a14caf7a9 100644
--- a/xorg-server/hw/xwin/winwindowswm.c
+++ b/xorg-server/hw/xwin/winwindowswm.c
@@ -47,207 +47,193 @@ static int WMErrorBase;
static unsigned char WMReqCode = 0;
static int WMEventBase = 0;
-static RESTYPE ClientType, eventResourceType; /* resource types for event masks */
+static RESTYPE ClientType, eventResourceType; /* resource types for event masks */
static XID eventResource;
/* Currently selected events */
static unsigned int eventMask = 0;
-static int WMFreeClient (pointer data, XID id);
-static int WMFreeEvents (pointer data, XID id);
-static void SNotifyEvent(xWindowsWMNotifyEvent *from, xWindowsWMNotifyEvent *to);
+static int WMFreeClient(pointer data, XID id);
+static int WMFreeEvents(pointer data, XID id);
+static void SNotifyEvent(xWindowsWMNotifyEvent * from,
+ xWindowsWMNotifyEvent * to);
typedef struct _WMEvent *WMEventPtr;
typedef struct _WMEvent {
- WMEventPtr next;
- ClientPtr client;
- XID clientResource;
- unsigned int mask;
+ WMEventPtr next;
+ ClientPtr client;
+ XID clientResource;
+ unsigned int mask;
} WMEventRec;
static inline BoxRec
-make_box (int x, int y, int w, int h)
+make_box(int x, int y, int w, int h)
{
- BoxRec r;
- r.x1 = x;
- r.y1 = y;
- r.x2 = x + w;
- r.y2 = y + h;
- return r;
+ BoxRec r;
+
+ r.x1 = x;
+ r.y1 = y;
+ r.x2 = x + w;
+ r.y2 = y + h;
+ return r;
}
static int
ProcWindowsWMQueryVersion(ClientPtr client)
{
- xWindowsWMQueryVersionReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_WINDOWSWM_MAJOR_VERSION;
- rep.minorVersion = SERVER_WINDOWSWM_MINOR_VERSION;
- rep.patchVersion = SERVER_WINDOWSWM_PATCH_VERSION;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
+ xWindowsWMQueryVersionReply rep;
+ int n;
+
+ REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = SERVER_WINDOWSWM_MAJOR_VERSION;
+ rep.minorVersion = SERVER_WINDOWSWM_MINOR_VERSION;
+ rep.patchVersion = SERVER_WINDOWSWM_PATCH_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
- WriteToClient(client, sizeof(xWindowsWMQueryVersionReply), (char *)&rep);
- return Success;
+ WriteToClient(client, sizeof(xWindowsWMQueryVersionReply), (char *) &rep);
+ return Success;
}
-
/* events */
static inline void
-updateEventMask (WMEventPtr *pHead)
+updateEventMask(WMEventPtr * pHead)
{
- WMEventPtr pCur;
+ WMEventPtr pCur;
- eventMask = 0;
- for (pCur = *pHead; pCur != NULL; pCur = pCur->next)
- eventMask |= pCur->mask;
+ eventMask = 0;
+ for (pCur = *pHead; pCur != NULL; pCur = pCur->next)
+ eventMask |= pCur->mask;
}
-/*ARGSUSED*/
-static int
-WMFreeClient (pointer data, XID id)
+ /*ARGSUSED*/ static int
+WMFreeClient(pointer data, XID id)
{
- WMEventPtr pEvent;
- WMEventPtr *pHead, pCur, pPrev;
-
- pEvent = (WMEventPtr) data;
- dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
- NullClient, DixUnknownAccess);
- if (pHead)
- {
- pPrev = 0;
- for (pCur = *pHead; pCur && pCur != pEvent; pCur=pCur->next)
- pPrev = pCur;
- if (pCur)
- {
- if (pPrev)
- pPrev->next = pEvent->next;
- else
- *pHead = pEvent->next;
- }
- updateEventMask (pHead);
+ WMEventPtr pEvent;
+ WMEventPtr *pHead, pCur, pPrev;
+
+ pEvent = (WMEventPtr) data;
+ dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
+ NullClient, DixUnknownAccess);
+ if (pHead) {
+ pPrev = 0;
+ for (pCur = *pHead; pCur && pCur != pEvent; pCur = pCur->next)
+ pPrev = pCur;
+ if (pCur) {
+ if (pPrev)
+ pPrev->next = pEvent->next;
+ else
+ *pHead = pEvent->next;
+ }
+ updateEventMask(pHead);
}
- free((pointer) pEvent);
- return 1;
+ free((pointer) pEvent);
+ return 1;
}
-/*ARGSUSED*/
-static int
-WMFreeEvents (pointer data, XID id)
+ /*ARGSUSED*/ static int
+WMFreeEvents(pointer data, XID id)
{
- WMEventPtr *pHead, pCur, pNext;
-
- pHead = (WMEventPtr *) data;
- for (pCur = *pHead; pCur; pCur = pNext)
- {
- pNext = pCur->next;
- FreeResource (pCur->clientResource, ClientType);
- free((pointer) pCur);
+ WMEventPtr *pHead, pCur, pNext;
+
+ pHead = (WMEventPtr *) data;
+ for (pCur = *pHead; pCur; pCur = pNext) {
+ pNext = pCur->next;
+ FreeResource(pCur->clientResource, ClientType);
+ free((pointer) pCur);
}
- free((pointer) pHead);
- eventMask = 0;
- return 1;
+ free((pointer) pHead);
+ eventMask = 0;
+ return 1;
}
static int
-ProcWindowsWMSelectInput (ClientPtr client)
+ProcWindowsWMSelectInput(ClientPtr client)
{
- REQUEST(xWindowsWMSelectInputReq);
- WMEventPtr pEvent, pNewEvent, *pHead;
- XID clientResource;
-
- REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq);
- dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType, client, DixWriteAccess);
- if (stuff->mask != 0)
- {
- if (pHead)
- {
- /* check for existing entry. */
- for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
- {
- if (pEvent->client == client)
- {
- pEvent->mask = stuff->mask;
- updateEventMask (pHead);
- return Success;
- }
- }
- }
-
- /* build the entry */
- pNewEvent = (WMEventPtr) malloc(sizeof (WMEventRec));
- if (!pNewEvent)
- return BadAlloc;
- pNewEvent->next = 0;
- pNewEvent->client = client;
- pNewEvent->mask = stuff->mask;
- /*
- * add a resource that will be deleted when
- * the client goes away
- */
- clientResource = FakeClientID (client->index);
- pNewEvent->clientResource = clientResource;
- if (!AddResource (clientResource, ClientType, (pointer)pNewEvent))
- return BadAlloc;
- /*
- * create a resource to contain a pointer to the list
- * of clients selecting input. This must be indirect as
- * the list may be arbitrarily rearranged which cannot be
- * done through the resource database.
- */
- if (!pHead)
- {
- pHead = (WMEventPtr *) malloc(sizeof (WMEventPtr));
- if (!pHead ||
- !AddResource (eventResource, eventResourceType, (pointer)pHead))
- {
- FreeResource (clientResource, RT_NONE);
- return BadAlloc;
- }
- *pHead = 0;
- }
- pNewEvent->next = *pHead;
- *pHead = pNewEvent;
- updateEventMask (pHead);
+ REQUEST(xWindowsWMSelectInputReq);
+ WMEventPtr pEvent, pNewEvent, *pHead;
+ XID clientResource;
+
+ REQUEST_SIZE_MATCH(xWindowsWMSelectInputReq);
+ dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
+ client, DixWriteAccess);
+ if (stuff->mask != 0) {
+ if (pHead) {
+ /* check for existing entry. */
+ for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
+ if (pEvent->client == client) {
+ pEvent->mask = stuff->mask;
+ updateEventMask(pHead);
+ return Success;
+ }
+ }
+ }
+
+ /* build the entry */
+ pNewEvent = (WMEventPtr) malloc(sizeof(WMEventRec));
+ if (!pNewEvent)
+ return BadAlloc;
+ pNewEvent->next = 0;
+ pNewEvent->client = client;
+ pNewEvent->mask = stuff->mask;
+ /*
+ * add a resource that will be deleted when
+ * the client goes away
+ */
+ clientResource = FakeClientID(client->index);
+ pNewEvent->clientResource = clientResource;
+ if (!AddResource(clientResource, ClientType, (pointer) pNewEvent))
+ return BadAlloc;
+ /*
+ * create a resource to contain a pointer to the list
+ * of clients selecting input. This must be indirect as
+ * the list may be arbitrarily rearranged which cannot be
+ * done through the resource database.
+ */
+ if (!pHead) {
+ pHead = (WMEventPtr *) malloc(sizeof(WMEventPtr));
+ if (!pHead ||
+ !AddResource(eventResource, eventResourceType, (pointer) pHead))
+ {
+ FreeResource(clientResource, RT_NONE);
+ return BadAlloc;
+ }
+ *pHead = 0;
+ }
+ pNewEvent->next = *pHead;
+ *pHead = pNewEvent;
+ updateEventMask(pHead);
}
- else if (stuff->mask == 0)
- {
- /* delete the interest */
- if (pHead)
- {
- pNewEvent = 0;
- for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
- {
- if (pEvent->client == client)
- break;
- pNewEvent = pEvent;
- }
- if (pEvent)
- {
- FreeResource (pEvent->clientResource, ClientType);
- if (pNewEvent)
- pNewEvent->next = pEvent->next;
- else
- *pHead = pEvent->next;
- free(pEvent);
- updateEventMask (pHead);
- }
- }
+ else if (stuff->mask == 0) {
+ /* delete the interest */
+ if (pHead) {
+ pNewEvent = 0;
+ for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
+ if (pEvent->client == client)
+ break;
+ pNewEvent = pEvent;
+ }
+ if (pEvent) {
+ FreeResource(pEvent->clientResource, ClientType);
+ if (pNewEvent)
+ pNewEvent->next = pEvent->next;
+ else
+ *pHead = pEvent->next;
+ free(pEvent);
+ updateEventMask(pHead);
+ }
+ }
}
- else
- {
- client->errorValue = stuff->mask;
- return BadValue;
+ else {
+ client->errorValue = stuff->mask;
+ return BadValue;
}
- return Success;
+ return Success;
}
/*
@@ -255,360 +241,350 @@ ProcWindowsWMSelectInput (ClientPtr client)
*/
void
-winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
- Window window, int x, int y, int w, int h)
+winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg,
+ Window window, int x, int y, int w, int h)
{
- WMEventPtr *pHead, pEvent;
- ClientPtr client;
- xWindowsWMNotifyEvent se;
- winDebug ("winWindowsWMSendEvent %d %d %d %d, %d %d - %d %d\n",
- type, mask, which, arg, x, y, w, h);
- dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
- NullClient, DixUnknownAccess);
- if (!pHead)
- return;
- for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
- {
- client = pEvent->client;
- winDebug ("winWindowsWMSendEvent - x%08x\n", (int) client);
- if ((pEvent->mask & mask) == 0)
- {
- continue;
- }
- winDebug ("winWindowsWMSendEvent - send\n");
-
- se.type = type + WMEventBase;
- se.kind = which;
- se.window = window;
- se.arg = arg;
- se.x = x;
- se.y = y;
- se.w = w;
- se.h = h;
- se.time = currentTime.milliseconds;
- WriteEventsToClient (client, 1, (xEvent *) &se);
+ WMEventPtr *pHead, pEvent;
+ ClientPtr client;
+ xWindowsWMNotifyEvent se;
+ winDebug ("winWindowsWMSendEvent %d %d %d %d, %d %d - %d %d\n",
+ type, mask, which, arg, x, y, w, h);
+ dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
+ NullClient, DixUnknownAccess);
+ if (!pHead)
+ return;
+ for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
+ client = pEvent->client;
+ winDebug ("winWindowsWMSendEvent - x%08x\n", (int) client);
+ if ((pEvent->mask & mask) == 0) {
+ continue;
+ }
+ winDebug ("winWindowsWMSendEvent - send\n");
+
+ se.type = type + WMEventBase;
+ se.kind = which;
+ se.window = window;
+ se.arg = arg;
+ se.x = x;
+ se.y = y;
+ se.w = w;
+ se.h = h;
+ se.time = currentTime.milliseconds;
+ WriteEventsToClient(client, 1, (xEvent *) &se);
}
}
/* general utility functions */
static int
-ProcWindowsWMDisableUpdate (ClientPtr client)
+ProcWindowsWMDisableUpdate(ClientPtr client)
{
- REQUEST_SIZE_MATCH(xWindowsWMDisableUpdateReq);
+ REQUEST_SIZE_MATCH(xWindowsWMDisableUpdateReq);
- //winDisableUpdate();
+ //winDisableUpdate();
- return Success;
+ return Success;
}
static int
-ProcWindowsWMReenableUpdate (ClientPtr client)
+ProcWindowsWMReenableUpdate(ClientPtr client)
{
- REQUEST_SIZE_MATCH(xWindowsWMReenableUpdateReq);
+ REQUEST_SIZE_MATCH(xWindowsWMReenableUpdateReq);
- //winEnableUpdate();
+ //winEnableUpdate();
- return Success;
+ return Success;
}
-
/* window functions */
static int
-ProcWindowsWMSetFrontProcess (ClientPtr client)
+ProcWindowsWMSetFrontProcess(ClientPtr client)
{
- REQUEST_SIZE_MATCH(xWindowsWMSetFrontProcessReq);
-
- //QuartzMessageMainThread(kWindowsSetFrontProcess, NULL, 0);
-
- return Success;
-}
+ REQUEST_SIZE_MATCH(xWindowsWMSetFrontProcessReq);
+
+ //QuartzMessageMainThread(kWindowsSetFrontProcess, NULL, 0);
+ return Success;
+}
/* frame functions */
static int
-ProcWindowsWMFrameGetRect (ClientPtr client)
+ProcWindowsWMFrameGetRect(ClientPtr client)
{
- xWindowsWMFrameGetRectReply rep;
- BoxRec ir;
- RECT rcNew;
- REQUEST(xWindowsWMFrameGetRectReq);
+ xWindowsWMFrameGetRectReply rep;
+ BoxRec ir;
+ RECT rcNew;
+
+ REQUEST(xWindowsWMFrameGetRectReq);
winDebug ("ProcWindowsWMFrameGetRect %d %d\n",
- (sizeof(xWindowsWMFrameGetRectReq) >> 2), (int) client->req_len);
-
- REQUEST_SIZE_MATCH(xWindowsWMFrameGetRectReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
-
- if (stuff->frame_rect != 0)
- {
- ErrorF ("ProcWindowsWMFrameGetRect - stuff->frame_rect != 0\n");
- return BadValue;
+ (sizeof(xWindowsWMFrameGetRectReq) >> 2), (int) client->req_len);
+
+ REQUEST_SIZE_MATCH(xWindowsWMFrameGetRectReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ ir = make_box(stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+
+ if (stuff->frame_rect != 0) {
+ ErrorF("ProcWindowsWMFrameGetRect - stuff->frame_rect != 0\n");
+ return BadValue;
}
- /* Store the origin, height, and width in a rectangle structure */
- SetRect (&rcNew, stuff->ix, stuff->iy,
- stuff->ix + stuff->iw, stuff->iy + stuff->ih);
-
- winDebug ("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
- stuff->ix, stuff->iy, stuff->ix + stuff->iw, stuff->iy + stuff->ih);
-
- /*
- * Calculate the required size of the Windows window rectangle,
- * given the size of the Windows window client area.
- */
- AdjustWindowRectEx (&rcNew, stuff->frame_style, FALSE, stuff->frame_style_ex);
- rep.x = rcNew.left;
- rep.y = rcNew.top;
- rep.w = rcNew.right - rcNew.left;
- rep.h = rcNew.bottom - rcNew.top;
- winDebug ("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
- rep.x, rep.y, rep.w, rep.h);
-
- WriteToClient(client, sizeof(xWindowsWMFrameGetRectReply), (char *)&rep);
- return Success;
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect(&rcNew, stuff->ix, stuff->iy,
+ stuff->ix + stuff->iw, stuff->iy + stuff->ih);
+
+ winDebug ("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
+ stuff->ix, stuff->iy, stuff->ix + stuff->iw, stuff->iy + stuff->ih);
+
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx(&rcNew, stuff->frame_style, FALSE,
+ stuff->frame_style_ex);
+ rep.x = rcNew.left;
+ rep.y = rcNew.top;
+ rep.w = rcNew.right - rcNew.left;
+ rep.h = rcNew.bottom - rcNew.top;
+ winDebug ("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
+ rep.x, rep.y, rep.w, rep.h);
+
+ WriteToClient(client, sizeof(xWindowsWMFrameGetRectReply), (char *) &rep);
+ return Success;
}
-
static int
-ProcWindowsWMFrameDraw (ClientPtr client)
+ProcWindowsWMFrameDraw(ClientPtr client)
{
- REQUEST(xWindowsWMFrameDrawReq);
- WindowPtr pWin;
- win32RootlessWindowPtr pRLWinPriv;
- RECT rcNew;
- int nCmdShow, rc;
- RegionRec newShape;
-
- REQUEST_SIZE_MATCH (xWindowsWMFrameDrawReq);
-
- winDebug ("ProcWindowsWMFrameDraw\n");
-
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
- if (rc != Success)
- return rc;
-
- winDebug ("ProcWindowsWMFrameDraw - Window found\n");
-
- pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, TRUE);
- if (pRLWinPriv == 0) return BadWindow;
-
- winDebug ("ProcWindowsWMFrameDraw - HWND 0x%08x 0x%08x 0x%08x\n",
- (int) pRLWinPriv->hWnd, (int) stuff->frame_style,
- (int) stuff->frame_style_ex);
- winDebug ("ProcWindowsWMFrameDraw - %d %d %d %d\n",
- stuff->ix, stuff->iy, stuff->iw, stuff->ih);
-
- /* Store the origin, height, and width in a rectangle structure */
- SetRect (&rcNew, stuff->ix, stuff->iy,
- stuff->ix + stuff->iw, stuff->iy + stuff->ih);
-
- /*
- * Calculate the required size of the Windows window rectangle,
- * given the size of the Windows window client area.
- */
- AdjustWindowRectEx (&rcNew, stuff->frame_style, FALSE, stuff->frame_style_ex);
-
- /* Set the window extended style flags */
- if (!SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, stuff->frame_style_ex))
- {
- return BadValue;
+ REQUEST(xWindowsWMFrameDrawReq);
+ WindowPtr pWin;
+ win32RootlessWindowPtr pRLWinPriv;
+ RECT rcNew;
+ int nCmdShow, rc;
+ RegionRec newShape;
+
+ REQUEST_SIZE_MATCH(xWindowsWMFrameDrawReq);
+
+ winDebug ("ProcWindowsWMFrameDraw\n");
+
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ winDebug ("ProcWindowsWMFrameDraw - Window found\n");
+
+ pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, TRUE);
+ if (pRLWinPriv == 0)
+ return BadWindow;
+
+ winDebug ("ProcWindowsWMFrameDraw - HWND 0x%08x 0x%08x 0x%08x\n",
+ (int) pRLWinPriv->hWnd, (int) stuff->frame_style,
+ (int) stuff->frame_style_ex);
+ winDebug ("ProcWindowsWMFrameDraw - %d %d %d %d\n",
+ stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect(&rcNew, stuff->ix, stuff->iy,
+ stuff->ix + stuff->iw, stuff->iy + stuff->ih);
+
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx(&rcNew, stuff->frame_style, FALSE,
+ stuff->frame_style_ex);
+
+ /* Set the window extended style flags */
+ if (!SetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE, stuff->frame_style_ex)) {
+ return BadValue;
}
- /* Set the window standard style flags */
- if (!SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE, stuff->frame_style))
- {
- return BadValue;
+ /* Set the window standard style flags */
+ if (!SetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE, stuff->frame_style)) {
+ return BadValue;
}
- /* Flush the window style */
- if (!SetWindowPos (pRLWinPriv->hWnd, NULL,
- rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
- SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE))
- {
- return BadValue;
+ /* Flush the window style */
+ if (!SetWindowPos(pRLWinPriv->hWnd, NULL,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE)) {
+ return BadValue;
}
- if (!IsWindowVisible(pRLWinPriv->hWnd))
- nCmdShow = SW_HIDE;
- else
- nCmdShow = SW_SHOWNA;
-
- ShowWindow (pRLWinPriv->hWnd, nCmdShow);
-
- winMWExtWMUpdateIcon (pWin->drawable.id);
-
- if (wBoundingShape(pWin) != NULL)
- {
- /* wBoundingShape is relative to *inner* origin of window.
- Translate by borderWidth to get the outside-relative position. */
-
- RegionNull(&newShape);
- RegionCopy(&newShape, wBoundingShape(pWin));
- RegionTranslate(&newShape, pWin->borderWidth, pWin->borderWidth);
- winMWExtWMReshapeFrame (pRLWinPriv, &newShape);
- RegionUninit(&newShape);
+ if (!IsWindowVisible(pRLWinPriv->hWnd))
+ nCmdShow = SW_HIDE;
+ else
+ nCmdShow = SW_SHOWNA;
+
+ ShowWindow(pRLWinPriv->hWnd, nCmdShow);
+
+ winMWExtWMUpdateIcon(pWin->drawable.id);
+
+ if (wBoundingShape(pWin) != NULL) {
+ /* wBoundingShape is relative to *inner* origin of window.
+ Translate by borderWidth to get the outside-relative position. */
+
+ RegionNull(&newShape);
+ RegionCopy(&newShape, wBoundingShape(pWin));
+ RegionTranslate(&newShape, pWin->borderWidth, pWin->borderWidth);
+ winMWExtWMReshapeFrame(pRLWinPriv, &newShape);
+ RegionUninit(&newShape);
}
- winDebug ("ProcWindowsWMFrameDraw - done\n");
+ winDebug ("ProcWindowsWMFrameDraw - done\n");
- return Success;
+ return Success;
}
static int
ProcWindowsWMFrameSetTitle(ClientPtr client)
{
- unsigned int title_length, title_max;
- char *title_bytes;
- REQUEST(xWindowsWMFrameSetTitleReq);
- WindowPtr pWin;
- win32RootlessWindowPtr pRLWinPriv;
- int rc;
+ unsigned int title_length, title_max;
+ char *title_bytes;
+
+ REQUEST(xWindowsWMFrameSetTitleReq);
+ WindowPtr pWin;
+ win32RootlessWindowPtr pRLWinPriv;
+ int rc;
- winDebug ("ProcWindowsWMFrameSetTitle\n");
+ winDebug ("ProcWindowsWMFrameSetTitle\n");
- REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq);
+ REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
- if (rc != Success)
- return rc;
- winDebug ("ProcWindowsWMFrameSetTitle - Window found\n");
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
+ winDebug ("ProcWindowsWMFrameSetTitle - Window found\n");
- title_length = stuff->title_length;
- title_max = (stuff->length << 2) - sizeof(xWindowsWMFrameSetTitleReq);
+ title_length = stuff->title_length;
+ title_max = (stuff->length << 2) - sizeof(xWindowsWMFrameSetTitleReq);
- if (title_max < title_length)
- return BadValue;
+ if (title_max < title_length)
+ return BadValue;
- winDebug ("ProcWindowsWMFrameSetTitle - length is valid\n");
+ winDebug ("ProcWindowsWMFrameSetTitle - length is valid\n");
- title_bytes = malloc (title_length+1);
- strncpy (title_bytes, (unsigned char *) &stuff[1], title_length);
- title_bytes[title_length] = '\0';
+ title_bytes = malloc(title_length + 1);
+ strncpy(title_bytes, (unsigned char *) &stuff[1], title_length);
+ title_bytes[title_length] = '\0';
- pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
+ pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
- if (pRLWinPriv == 0)
- {
- free (title_bytes);
- return BadWindow;
+ if (pRLWinPriv == 0) {
+ free(title_bytes);
+ return BadWindow;
}
-
- /* Flush the window style */
- SetWindowText (pRLWinPriv->hWnd, title_bytes);
- free (title_bytes);
+ /* Flush the window style */
+ SetWindowText(pRLWinPriv->hWnd, title_bytes);
- winDebug ("ProcWindowsWMFrameSetTitle - done\n");
+ free(title_bytes);
- return Success;
-}
+ winDebug ("ProcWindowsWMFrameSetTitle - done\n");
+ return Success;
+}
/* dispatch */
static int
-ProcWindowsWMDispatch (ClientPtr client)
+ProcWindowsWMDispatch(ClientPtr client)
{
- REQUEST(xReq);
+ REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_WindowsWMQueryVersion:
- return ProcWindowsWMQueryVersion(client);
+ return ProcWindowsWMQueryVersion(client);
}
- if (!LocalClient(client))
- return WMErrorBase + WindowsWMClientNotLocal;
+ if (!LocalClient(client))
+ return WMErrorBase + WindowsWMClientNotLocal;
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_WindowsWMSelectInput:
- return ProcWindowsWMSelectInput(client);
+ return ProcWindowsWMSelectInput(client);
case X_WindowsWMDisableUpdate:
- return ProcWindowsWMDisableUpdate(client);
+ return ProcWindowsWMDisableUpdate(client);
case X_WindowsWMReenableUpdate:
- return ProcWindowsWMReenableUpdate(client);
+ return ProcWindowsWMReenableUpdate(client);
case X_WindowsWMSetFrontProcess:
- return ProcWindowsWMSetFrontProcess(client);
+ return ProcWindowsWMSetFrontProcess(client);
case X_WindowsWMFrameGetRect:
- return ProcWindowsWMFrameGetRect(client);
+ return ProcWindowsWMFrameGetRect(client);
case X_WindowsWMFrameDraw:
- return ProcWindowsWMFrameDraw(client);
+ return ProcWindowsWMFrameDraw(client);
case X_WindowsWMFrameSetTitle:
- return ProcWindowsWMFrameSetTitle(client);
+ return ProcWindowsWMFrameSetTitle(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
static void
-SNotifyEvent (xWindowsWMNotifyEvent *from, xWindowsWMNotifyEvent *to)
+SNotifyEvent(xWindowsWMNotifyEvent * from, xWindowsWMNotifyEvent * to)
{
- to->type = from->type;
- to->kind = from->kind;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->window, to->window);
- cpswapl (from->time, to->time);
- cpswapl (from->arg, to->arg);
+ to->type = from->type;
+ to->kind = from->kind;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->window, to->window);
+ cpswapl(from->time, to->time);
+ cpswapl(from->arg, to->arg);
}
static int
-SProcWindowsWMQueryVersion (ClientPtr client)
+SProcWindowsWMQueryVersion(ClientPtr client)
{
- int n;
- REQUEST(xWindowsWMQueryVersionReq);
- swaps(&stuff->length);
- return ProcWindowsWMQueryVersion(client);
+ int n;
+
+ REQUEST(xWindowsWMQueryVersionReq);
+ swaps(&stuff->length);
+ return ProcWindowsWMQueryVersion(client);
}
static int
-SProcWindowsWMDispatch (ClientPtr client)
+SProcWindowsWMDispatch(ClientPtr client)
{
- REQUEST(xReq);
+ REQUEST(xReq);
- /* It is bound to be non-local when there is byte swapping */
- if (!LocalClient(client))
- return WMErrorBase + WindowsWMClientNotLocal;
+ /* It is bound to be non-local when there is byte swapping */
+ if (!LocalClient(client))
+ return WMErrorBase + WindowsWMClientNotLocal;
- /* only local clients are allowed WM access */
- switch (stuff->data)
- {
+ /* only local clients are allowed WM access */
+ switch (stuff->data) {
case X_WindowsWMQueryVersion:
- return SProcWindowsWMQueryVersion(client);
+ return SProcWindowsWMQueryVersion(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
void
-winWindowsWMExtensionInit (void)
+winWindowsWMExtensionInit(void)
{
- ExtensionEntry* extEntry;
-
- ClientType = CreateNewResourceType(WMFreeClient, "WMClient");
- eventResourceType = CreateNewResourceType(WMFreeEvents, "WMEvent");
- eventResource = FakeClientID(0);
-
- if (ClientType && eventResourceType &&
- (extEntry = AddExtension(WINDOWSWMNAME,
- WindowsWMNumberEvents,
- WindowsWMNumberErrors,
- ProcWindowsWMDispatch,
- SProcWindowsWMDispatch,
- NULL,
- StandardMinorOpcode)))
- {
- size_t i;
- WMReqCode = (unsigned char)extEntry->base;
- WMErrorBase = extEntry->errorBase;
- WMEventBase = extEntry->eventBase;
- for (i=0; i < WindowsWMNumberEvents; i++)
- EventSwapVector[WMEventBase + i] = (EventSwapPtr) SNotifyEvent;
+ ExtensionEntry *extEntry;
+
+ ClientType = CreateNewResourceType(WMFreeClient, "WMClient");
+ eventResourceType = CreateNewResourceType(WMFreeEvents, "WMEvent");
+ eventResource = FakeClientID(0);
+
+ if (ClientType && eventResourceType &&
+ (extEntry = AddExtension(WINDOWSWMNAME,
+ WindowsWMNumberEvents,
+ WindowsWMNumberErrors,
+ ProcWindowsWMDispatch,
+ SProcWindowsWMDispatch,
+ NULL, StandardMinorOpcode))) {
+ size_t i;
+
+ WMReqCode = (unsigned char) extEntry->base;
+ WMErrorBase = extEntry->errorBase;
+ WMEventBase = extEntry->eventBase;
+ for (i = 0; i < WindowsWMNumberEvents; i++)
+ EventSwapVector[WMEventBase + i] = (EventSwapPtr) SNotifyEvent;
}
}
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c
index 41ce51cec..77a3a76ba 100644
--- a/xorg-server/hw/xwin/winwndproc.c
+++ b/xorg-server/hw/xwin/winwndproc.c
@@ -53,9 +53,8 @@
*/
extern Bool g_fClipboardStarted;
-Bool g_fCursor = TRUE;
-Bool g_fButton[3] = { FALSE, FALSE, FALSE };
-
+Bool g_fCursor = TRUE;
+Bool g_fButton[3] = { FALSE, FALSE, FALSE };
/*
* Called by winWakeupHandler
@@ -63,1254 +62,1206 @@ Bool g_fButton[3] = { FALSE, FALSE, FALSE };
*/
LRESULT CALLBACK
-winWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam)
+winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- static winPrivScreenPtr s_pScreenPriv = NULL;
- static winScreenInfo *s_pScreenInfo = NULL;
- static ScreenPtr s_pScreen = NULL;
- static HWND s_hwndLastPrivates = NULL;
- static HINSTANCE s_hInstance;
- static Bool s_fTracking = FALSE;
- static unsigned long s_ulServerGeneration = 0;
- static UINT s_uTaskbarRestart = 0;
- int iScanCode;
- int i;
-
- winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam);
-
- /* Watch for server regeneration */
- if (g_ulServerGeneration != s_ulServerGeneration)
- {
- /* Store new server generation */
- s_ulServerGeneration = g_ulServerGeneration;
+ static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winScreenInfo *s_pScreenInfo = NULL;
+ static ScreenPtr s_pScreen = NULL;
+ static HWND s_hwndLastPrivates = NULL;
+ static HINSTANCE s_hInstance;
+ static Bool s_fTracking = FALSE;
+ static unsigned long s_ulServerGeneration = 0;
+ static UINT s_uTaskbarRestart = 0;
+ int iScanCode;
+ int i;
+
+ winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam);
+
+ /* Watch for server regeneration */
+ if (g_ulServerGeneration != s_ulServerGeneration) {
+ /* Store new server generation */
+ s_ulServerGeneration = g_ulServerGeneration;
}
- /* Only retrieve new privates pointers if window handle is null or changed */
- if ((s_pScreenPriv == NULL || hwnd != s_hwndLastPrivates)
- && (s_pScreenPriv = GetProp (hwnd, WIN_SCR_PROP)) != NULL)
- {
- winDebug ("winWindowProc - Setting privates handle\n");
- s_pScreenInfo = s_pScreenPriv->pScreenInfo;
- s_pScreen = s_pScreenInfo->pScreen;
- s_hwndLastPrivates = hwnd;
+ /* Only retrieve new privates pointers if window handle is null or changed */
+ if ((s_pScreenPriv == NULL || hwnd != s_hwndLastPrivates)
+ && (s_pScreenPriv = GetProp(hwnd, WIN_SCR_PROP)) != NULL) {
+ winDebug("winWindowProc - Setting privates handle\n");
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
+ s_hwndLastPrivates = hwnd;
}
- else if (s_pScreenPriv == NULL)
- {
- /* For safety, handle case that should never happen */
- s_pScreenInfo = NULL;
- s_pScreen = NULL;
- s_hwndLastPrivates = NULL;
+ else if (s_pScreenPriv == NULL) {
+ /* For safety, handle case that should never happen */
+ s_pScreenInfo = NULL;
+ s_pScreen = NULL;
+ s_hwndLastPrivates = NULL;
}
- /* Branch on message type */
- switch (message)
- {
+ /* Branch on message type */
+ switch (message) {
case WM_TRAYICON:
- return winHandleIconMessage (hwnd, message, wParam, lParam,
- s_pScreenPriv);
+ return winHandleIconMessage(hwnd, message, wParam, lParam,
+ s_pScreenPriv);
case WM_CREATE:
- winDebug ("winWindowProc - WM_CREATE\n");
-
- /*
- * Add a property to our display window that references
- * this screens' privates.
- *
- * This allows the window procedure to refer to the
- * appropriate window DC and shadow DC for the window that
- * it is processing. We use this to repaint exposed
- * areas of our display window.
- */
- s_pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams;
- s_hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
- s_pScreenInfo = s_pScreenPriv->pScreenInfo;
- s_pScreen = s_pScreenInfo->pScreen;
- s_hwndLastPrivates = hwnd;
- s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
- SetProp (hwnd, WIN_SCR_PROP, s_pScreenPriv);
-
- /* Setup tray icon */
- if (!s_pScreenInfo->fNoTrayIcon)
- {
- /*
- * NOTE: The WM_CREATE message is processed before CreateWindowEx
- * returns, so s_pScreenPriv->hwndScreen is invalid at this point.
- * We go ahead and copy our hwnd parameter over top of the screen
- * privates hwndScreen so that we have a valid value for
- * that member. Otherwise, the tray icon will disappear
- * the first time you move the mouse over top of it.
- */
-
- s_pScreenPriv->hwndScreen = hwnd;
-
- winInitNotifyIcon (s_pScreenPriv,FALSE);
- }
- return 0;
+ winDebug("winWindowProc - WM_CREATE\n");
+
+ /*
+ * Add a property to our display window that references
+ * this screens' privates.
+ *
+ * This allows the window procedure to refer to the
+ * appropriate window DC and shadow DC for the window that
+ * it is processing. We use this to repaint exposed
+ * areas of our display window.
+ */
+ s_pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams;
+ s_hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
+ s_hwndLastPrivates = hwnd;
+ s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
+ SetProp(hwnd, WIN_SCR_PROP, s_pScreenPriv);
+
+ /* Setup tray icon */
+ if (!s_pScreenInfo->fNoTrayIcon) {
+ /*
+ * NOTE: The WM_CREATE message is processed before CreateWindowEx
+ * returns, so s_pScreenPriv->hwndScreen is invalid at this point.
+ * We go ahead and copy our hwnd parameter over top of the screen
+ * privates hwndScreen so that we have a valid value for
+ * that member. Otherwise, the tray icon will disappear
+ * the first time you move the mouse over top of it.
+ */
+
+ s_pScreenPriv->hwndScreen = hwnd;
+
+ winInitNotifyIcon (s_pScreenPriv,FALSE);
+ }
+ return 0;
case WM_DISPLAYCHANGE:
- /*
- WM_DISPLAYCHANGE seems to be sent when the monitor layout or
- any monitor's resolution or depth changes, but it's lParam and
- wParam always indicate the resolution and bpp for the primary
- monitor (so ignore that as we could be on any monitor...)
- */
-
- /* We cannot handle a display mode change during initialization */
- if (s_pScreenInfo == NULL)
- FatalError ("winWindowProc - WM_DISPLAYCHANGE - The display "
- "mode changed while we were intializing. This is "
- "very bad and unexpected. Exiting.\n");
-
- /*
- * We do not care about display changes with
- * fullscreen DirectDraw engines, because those engines set
- * their own mode when they become active.
- */
- if (s_pScreenInfo->fFullScreen
- && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
- || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
+ /*
+ WM_DISPLAYCHANGE seems to be sent when the monitor layout or
+ any monitor's resolution or depth changes, but it's lParam and
+ wParam always indicate the resolution and bpp for the primary
+ monitor (so ignore that as we could be on any monitor...)
+ */
+
+ /* We cannot handle a display mode change during initialization */
+ if (s_pScreenInfo == NULL)
+ FatalError("winWindowProc - WM_DISPLAYCHANGE - The display "
+ "mode changed while we were intializing. This is "
+ "very bad and unexpected. Exiting.\n");
+
+ /*
+ * We do not care about display changes with
+ * fullscreen DirectDraw engines, because those engines set
+ * their own mode when they become active.
+ */
+ if (s_pScreenInfo->fFullScreen
+ && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
#ifdef XWIN_PRIMARYFB
- || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
+ || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
#endif
- ))
- {
- break;
- }
+ )) {
+ break;
+ }
- winDebug ("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
- "new height: %d new bpp: %d\n",
- LOWORD (lParam), HIWORD (lParam), wParam);
+ winDebug ("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
+ "new height: %d new bpp: %d\n",
+ LOWORD(lParam), HIWORD(lParam), wParam);
- /* 0 bpp has no defined meaning, ignore this message */
- if (wParam == 0)
- break;
+ /* 0 bpp has no defined meaning, ignore this message */
+ if (wParam == 0)
+ break;
- /*
- * Check for a disruptive change in depth.
- * We can only display a message for a disruptive depth change,
- * we cannot do anything to correct the situation.
- */
- /*
- XXX: maybe we need to check if GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
- has changed as well...
- */
- if (s_pScreenInfo->dwBPP != GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL))
- {
- if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
- || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
+ /*
+ * Check for a disruptive change in depth.
+ * We can only display a message for a disruptive depth change,
+ * we cannot do anything to correct the situation.
+ */
+ /*
+ XXX: maybe we need to check if GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
+ has changed as well...
+ */
+ if (s_pScreenInfo->dwBPP !=
+ GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)) {
+ if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD ||
+ s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
#ifdef XWIN_PRIMARYFB
- || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
+ || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
#endif
- ))
- {
- /* Cannot display the visual until the depth is restored */
- winDebug ("winWindowProc - Disruptive change in depth\n");
+ )) {
+ /* Cannot display the visual until the depth is restored */
+ winDebug ("winWindowProc - Disruptive change in depth\n");
- /* Display depth change dialog */
- winDisplayDepthChangeDialog (s_pScreenPriv);
+ /* Display depth change dialog */
+ winDisplayDepthChangeDialog(s_pScreenPriv);
- /* Flag that we have an invalid screen depth */
- s_pScreenPriv->fBadDepth = TRUE;
+ /* Flag that we have an invalid screen depth */
+ s_pScreenPriv->fBadDepth = TRUE;
- /* Minimize the display window */
- ShowWindow (hwnd, SW_MINIMIZE);
+ /* Minimize the display window */
+ ShowWindow(hwnd, SW_MINIMIZE);
}
- else
- {
- /* For GDI, performance may suffer until original depth is restored */
- ErrorF ("winWindowProc - Performance may be non-optimal after change in depth\n");
+ else {
+ /* For GDI, performance may suffer until original depth is restored */
+ ErrorF
+ ("winWindowProc - Performance may be non-optimal after change in depth\n");
}
}
- else
- {
- /* Flag that we have a valid screen depth */
- s_pScreenPriv->fBadDepth = FALSE;
+ else {
+ /* Flag that we have a valid screen depth */
+ s_pScreenPriv->fBadDepth = FALSE;
}
- /*
- If we could cheaply check if this WM_DISPLAYCHANGE change
- affects the monitor(s) which this X screen is displayed on
- then we should do so here. For the moment, assume it does.
- (this is probably usually the case so that might be an
- overoptimization)
- */
- {
- /*
- In rootless modes which are monitor or virtual desktop size
- use RandR to resize the X screen
- */
- if ((!s_pScreenInfo->fUserGaveHeightAndWidth) &&
- (s_pScreenInfo->iResizeMode == resizeWithRandr) &&
- (FALSE
+ /*
+ If we could cheaply check if this WM_DISPLAYCHANGE change
+ affects the monitor(s) which this X screen is displayed on
+ then we should do so here. For the moment, assume it does.
+ (this is probably usually the case so that might be an
+ overoptimization)
+ */
+ {
+ /*
+ In rootless modes which are monitor or virtual desktop size
+ use RandR to resize the X screen
+ */
+ if ((!s_pScreenInfo->fUserGaveHeightAndWidth) &&
+ (s_pScreenInfo->iResizeMode == resizeWithRandr) && (FALSE
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ ||
+ s_pScreenInfo->
+ fMWExtWM
#endif
- || s_pScreenInfo->fRootless
+ ||
+ s_pScreenInfo->
+ fRootless
#ifdef XWIN_MULTIWINDOW
- || s_pScreenInfo->fMultiWindow
+ ||
+ s_pScreenInfo->
+ fMultiWindow
#endif
- ))
- {
- DWORD dwWidth = 0, dwHeight = 0;
+ )) {
+ DWORD dwWidth = 0, dwHeight = 0;
- if (s_pScreenInfo->fMultipleMonitors)
- {
- /* resize to new virtual desktop size */
- dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
- dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+ if (s_pScreenInfo->fMultipleMonitors) {
+ /* resize to new virtual desktop size */
+ dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
}
- else
- {
- /* resize to new size of specified monitor */
- struct GetMonitorInfoData data;
- if (QueryMonitor(s_pScreenInfo->iMonitor, &data))
- {
- if (data.bMonitorSpecifiedExists == TRUE)
- {
- dwWidth = data.monitorWidth;
- dwHeight = data.monitorHeight;
- /*
- XXX: monitor may have changed position,
- so we might need to update xinerama data
- */
+ else {
+ /* resize to new size of specified monitor */
+ struct GetMonitorInfoData data;
+
+ if (QueryMonitor(s_pScreenInfo->iMonitor, &data)) {
+ if (data.bMonitorSpecifiedExists == TRUE) {
+ dwWidth = data.monitorWidth;
+ dwHeight = data.monitorHeight;
+ /*
+ XXX: monitor may have changed position,
+ so we might need to update xinerama data
+ */
}
- else
- {
- ErrorF ("Monitor number %d no longer exists!\n", s_pScreenInfo->iMonitor);
+ else {
+ ErrorF("Monitor number %d no longer exists!\n",
+ s_pScreenInfo->iMonitor);
}
}
}
- /*
- XXX: probably a small bug here: we don't compute the work area
- and allow for task bar
-
- XXX: generally, we don't allow for the task bar being moved after
- the server is started
- */
-
- /* Set screen size to match new size, if it is different to current */
- if ((s_pScreenInfo->dwWidth != dwWidth) ||
- (s_pScreenInfo->dwHeight != dwHeight))
+ /*
+ XXX: probably a small bug here: we don't compute the work area
+ and allow for task bar
+
+ XXX: generally, we don't allow for the task bar being moved after
+ the server is started
+ */
+
+ /* Set screen size to match new size, if it is different to current */
+ if ((s_pScreenInfo->dwWidth != dwWidth) ||
+ (s_pScreenInfo->dwHeight != dwHeight)) {
+ winDoRandRScreenSetSize(s_pScreen,
+ dwWidth,
+ dwHeight,
+ (dwWidth * 25.4) /
+ monitorResolution,
+ (dwHeight * 25.4) /
+ monitorResolution);
+ }
+ }
+ else {
+ /*
+ * We can simply recreate the same-sized primary surface when
+ * the display dimensions change.
+ */
+
+ /*
+ * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface
+ * and CreatePrimarySurface function pointers to point
+ * to the no operation function, NoopDDA. This allows us
+ * to blindly call these functions, even if they are not
+ * relevant to the current engine (e.g., Shadow GDI).
+ */
+
+ winDebug
+ ("winWindowProc - WM_DISPLAYCHANGE - Releasing and recreating primary surface\n");
+
+ /* Reallocate the framebuffer used by the drawing engine */
+ (*s_pScreenPriv->pwinFreeFB)(s_pScreen);
+ if (!(*s_pScreenPriv->pwinAllocateFB)(s_pScreen))
{
- winDoRandRScreenSetSize(s_pScreen,
- dwWidth,
- dwHeight,
- (dwWidth * 25.4) / monitorResolution,
- (dwHeight * 25.4) / monitorResolution);
+ ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Could not reallocate framebuffer\n");
}
- }
- else
- {
- /*
- * We can simply recreate the same-sized primary surface when
- * the display dimensions change.
- */
-
- /*
- * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface
- * and CreatePrimarySurface function pointers to point
- * to the no operation function, NoopDDA. This allows us
- * to blindly call these functions, even if they are not
- * relevant to the current engine (e.g., Shadow GDI).
- */
-
- winDebug ("winWindowProc - WM_DISPLAYCHANGE - Releasing and recreating primary surface\n");
-
- /* Reallocate the framebuffer used by the drawing engine */
- (*s_pScreenPriv->pwinFreeFB)(s_pScreen);
- if (!(*s_pScreenPriv->pwinAllocateFB)(s_pScreen))
- {
- ErrorF ("winWindowProc - WM_DISPLAYCHANGE - Could not reallocate framebuffer\n");
- }
- /* Update the screen pixmap to point to the new framebuffer */
- winUpdateFBPointer(s_pScreen, s_pScreenPriv->pScreenInfo->pfb);
- // Restore the ability to update screen, now with new dimensions
- SetRootClip(s_pScreen, TRUE);
-
- // and arrange for it to be repainted
- miPaintWindow(s_pScreen->root, &s_pScreen->root->borderClip, PW_BACKGROUND);
+ /* Update the screen pixmap to point to the new framebuffer */
+ winUpdateFBPointer(s_pScreen, s_pScreenPriv->pScreenInfo->pfb);
+ // Restore the ability to update screen, now with new dimensions
+ SetRootClip(s_pScreen, TRUE);
+
+ // and arrange for it to be repainted
+ miPaintWindow(s_pScreen->root, &s_pScreen->root->borderClip, PW_BACKGROUND);
}
- }
+ }
- break;
+ break;
- case WM_SYSCOMMAND:
- if (wParam == SC_MAXIMIZE||wParam == SC_RESTORE)
- {
- winDebug("Posting WM_EXITSIZEMOVE message since windows does not send it when the maximised/restored button is clicked.\n");
- PostMessage(hwnd, WM_EXITSIZEMOVE, 0, 0);
- }
- break;
+ case WM_SYSCOMMAND:
+ if (wParam == SC_MAXIMIZE||wParam == SC_RESTORE)
+ {
+ winDebug("Posting WM_EXITSIZEMOVE message since windows does not send it when the maximised/restored button is clicked.\n");
+ PostMessage(hwnd, WM_EXITSIZEMOVE, 0, 0);
+ }
+ break;
case WM_SIZE:
- {
- SCROLLINFO si;
- RECT rcWindow;
- int iWidth, iHeight;
+ {
+ SCROLLINFO si;
+ RECT rcWindow;
+ int iWidth, iHeight;
- winDebug ("winWindowProc - WM_SIZE\n");
+ winDebug("winWindowProc - WM_SIZE\n");
- /* Break if we do not allow resizing */
- if ((s_pScreenInfo->iResizeMode == notAllowed)
- || !s_pScreenInfo->fDecoration
+ /* Break if we do not allow resizing */
+ if ((s_pScreenInfo->iResizeMode == notAllowed)
+ || !s_pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- || s_pScreenInfo->fRootless
+ || s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- || s_pScreenInfo->fMultiWindow
+ || s_pScreenInfo->fMultiWindow
#endif
- || s_pScreenInfo->fFullScreen)
- break;
+ || s_pScreenInfo->fFullScreen)
+ break;
- /* No need to resize if we get minimized */
- if (wParam == SIZE_MINIMIZED)
- return 0;
+ /* No need to resize if we get minimized */
+ if (wParam == SIZE_MINIMIZED)
+ return 0;
winDebug ("winWindowProc - WM_SIZE - new client area w: %d h: %d\n",
- LOWORD (lParam), HIWORD (lParam));
+ LOWORD(lParam), HIWORD(lParam));
- if (s_pScreenInfo->iResizeMode == resizeWithRandr)
- {
+ if (s_pScreenInfo->iResizeMode == resizeWithRandr) {
/* Actual resizing is done on WM_EXITSIZEMOVE */
return 0;
- }
+ }
/* Otherwise iResizeMode == resizeWithScrollbars */
- /*
- * Get the size of the whole window, including client area,
- * scrollbars, and non-client area decorations (caption, borders).
- * We do this because we need to check if the client area
- * without scrollbars is large enough to display the whole visual.
- * The new client area size passed by lParam already subtracts
- * the size of the scrollbars if they are currently displayed.
- * So checking is LOWORD(lParam) == visual_width and
- * HIWORD(lParam) == visual_height will never tell us to hide
- * the scrollbars because the client area would always be too small.
- * GetClientRect returns the same sizes given by lParam, so we
- * cannot use GetClientRect either.
- */
- GetWindowRect (hwnd, &rcWindow);
- iWidth = rcWindow.right - rcWindow.left;
- iHeight = rcWindow.bottom - rcWindow.top;
-
- /* Subtract the frame size from the window size. */
- iWidth -= 2 * GetSystemMetrics (SM_CXSIZEFRAME);
- iHeight -= (2 * GetSystemMetrics (SM_CYSIZEFRAME)
- + GetSystemMetrics (SM_CYCAPTION));
-
- /*
- * Update scrollbar page sizes.
- * NOTE: If page size == range, then the scrollbar is
- * automatically hidden.
- */
-
- /* Is the naked client area large enough to show the whole visual? */
- if (iWidth < s_pScreenInfo->dwWidth
- || iHeight < s_pScreenInfo->dwHeight)
- {
- /* Client area too small to display visual, use scrollbars */
- iWidth -= GetSystemMetrics (SM_CXVSCROLL);
- iHeight -= GetSystemMetrics (SM_CYHSCROLL);
- }
-
- /* Set the horizontal scrollbar page size */
- si.cbSize = sizeof (si);
- si.fMask = SIF_PAGE | SIF_RANGE;
- si.nMin = 0;
- si.nMax = s_pScreenInfo->dwWidth - 1;
- si.nPage = iWidth;
- SetScrollInfo (hwnd, SB_HORZ, &si, TRUE);
-
- /* Set the vertical scrollbar page size */
- si.cbSize = sizeof (si);
- si.fMask = SIF_PAGE | SIF_RANGE;
- si.nMin = 0;
- si.nMax = s_pScreenInfo->dwHeight - 1;
- si.nPage = iHeight;
- SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
-
- /*
- * NOTE: Scrollbars may have moved if they were at the
- * far right/bottom, so we query their current position.
- */
-
- /* Get the horizontal scrollbar position and set the offset */
- si.cbSize = sizeof (si);
- si.fMask = SIF_POS;
- GetScrollInfo (hwnd, SB_HORZ, &si);
- s_pScreenInfo->dwXOffset = -si.nPos;
-
- /* Get the vertical scrollbar position and set the offset */
- si.cbSize = sizeof (si);
- si.fMask = SIF_POS;
- GetScrollInfo (hwnd, SB_VERT, &si);
- s_pScreenInfo->dwYOffset = -si.nPos;
- }
- return 0;
+ /*
+ * Get the size of the whole window, including client area,
+ * scrollbars, and non-client area decorations (caption, borders).
+ * We do this because we need to check if the client area
+ * without scrollbars is large enough to display the whole visual.
+ * The new client area size passed by lParam already subtracts
+ * the size of the scrollbars if they are currently displayed.
+ * So checking is LOWORD(lParam) == visual_width and
+ * HIWORD(lParam) == visual_height will never tell us to hide
+ * the scrollbars because the client area would always be too small.
+ * GetClientRect returns the same sizes given by lParam, so we
+ * cannot use GetClientRect either.
+ */
+ GetWindowRect(hwnd, &rcWindow);
+ iWidth = rcWindow.right - rcWindow.left;
+ iHeight = rcWindow.bottom - rcWindow.top;
+
+ /* Subtract the frame size from the window size. */
+ iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight -= (2 * GetSystemMetrics(SM_CYSIZEFRAME)
+ + GetSystemMetrics(SM_CYCAPTION));
+
+ /*
+ * Update scrollbar page sizes.
+ * NOTE: If page size == range, then the scrollbar is
+ * automatically hidden.
+ */
+
+ /* Is the naked client area large enough to show the whole visual? */
+ if (iWidth < s_pScreenInfo->dwWidth
+ || iHeight < s_pScreenInfo->dwHeight) {
+ /* Client area too small to display visual, use scrollbars */
+ iWidth -= GetSystemMetrics(SM_CXVSCROLL);
+ iHeight -= GetSystemMetrics(SM_CYHSCROLL);
+ }
+
+ /* Set the horizontal scrollbar page size */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_PAGE | SIF_RANGE;
+ si.nMin = 0;
+ si.nMax = s_pScreenInfo->dwWidth - 1;
+ si.nPage = iWidth;
+ SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
+
+ /* Set the vertical scrollbar page size */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_PAGE | SIF_RANGE;
+ si.nMin = 0;
+ si.nMax = s_pScreenInfo->dwHeight - 1;
+ si.nPage = iHeight;
+ SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+
+ /*
+ * NOTE: Scrollbars may have moved if they were at the
+ * far right/bottom, so we query their current position.
+ */
+
+ /* Get the horizontal scrollbar position and set the offset */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_POS;
+ GetScrollInfo(hwnd, SB_HORZ, &si);
+ s_pScreenInfo->dwXOffset = -si.nPos;
+
+ /* Get the vertical scrollbar position and set the offset */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_POS;
+ GetScrollInfo(hwnd, SB_VERT, &si);
+ s_pScreenInfo->dwYOffset = -si.nPos;
+ }
+ return 0;
case WM_ENTERSIZEMOVE:
- winDebug("winWindowProc - WM_ENTERSIZEMOVE\n");
- break;
+ winDebug("winWindowProc - WM_ENTERSIZEMOVE\n");
+ break;
case WM_EXITSIZEMOVE:
- winDebug("winWindowProc - WM_EXITSIZEMOVE\n");
-
- if (s_pScreenInfo->iResizeMode == resizeWithRandr)
- {
- /* Set screen size to match new client area, if it is different to current */
- RECT rcClient;
- DWORD dwWidth, dwHeight;
-
- GetClientRect (hwnd, &rcClient);
- dwWidth = rcClient.right - rcClient.left;
- dwHeight = rcClient.bottom - rcClient.top;
-
- if ((s_pScreenInfo->dwWidth != dwWidth) ||
- (s_pScreenInfo->dwHeight != dwHeight))
- {
- /* mm = dots * (25.4 mm / inch) / (dots / inch) */
- winDoRandRScreenSetSize(s_pScreen,
- dwWidth,
- dwHeight,
- (dwWidth * 25.4) / monitorResolution,
- (dwHeight * 25.4) / monitorResolution);
+ winDebug("winWindowProc - WM_EXITSIZEMOVE\n");
+
+ if (s_pScreenInfo->iResizeMode == resizeWithRandr) {
+ /* Set screen size to match new client area, if it is different to current */
+ RECT rcClient;
+ DWORD dwWidth, dwHeight;
+
+ GetClientRect(hwnd, &rcClient);
+ dwWidth = rcClient.right - rcClient.left;
+ dwHeight = rcClient.bottom - rcClient.top;
+
+ if ((s_pScreenInfo->dwWidth != dwWidth) ||
+ (s_pScreenInfo->dwHeight != dwHeight)) {
+ /* mm = dots * (25.4 mm / inch) / (dots / inch) */
+ winDoRandRScreenSetSize(s_pScreen,
+ dwWidth,
+ dwHeight,
+ (dwWidth * 25.4) / monitorResolution,
+ (dwHeight * 25.4) / monitorResolution);
}
}
- break;
+ break;
case WM_VSCROLL:
- {
- SCROLLINFO si;
- int iVertPos;
+ {
+ SCROLLINFO si;
+ int iVertPos;
+
+ winDebug("winWindowProc - WM_VSCROLL\n");
+
+ /* Get vertical scroll bar info */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_ALL;
+ GetScrollInfo(hwnd, SB_VERT, &si);
+
+ /* Save the vertical position for comparison later */
+ iVertPos = si.nPos;
+
+ /*
+ * Don't forget:
+ * moving the scrollbar to the DOWN, scroll the content UP
+ */
+ switch (LOWORD(wParam)) {
+ case SB_TOP:
+ si.nPos = si.nMin;
+ break;
- winDebug ("winWindowProc - WM_VSCROLL\n");
-
- /* Get vertical scroll bar info */
- si.cbSize = sizeof (si);
- si.fMask = SIF_ALL;
- GetScrollInfo (hwnd, SB_VERT, &si);
-
- /* Save the vertical position for comparison later */
- iVertPos = si.nPos;
-
- /*
- * Don't forget:
- * moving the scrollbar to the DOWN, scroll the content UP
- */
- switch (LOWORD(wParam))
- {
- case SB_TOP:
- si.nPos = si.nMin;
- break;
-
- case SB_BOTTOM:
- si.nPos = si.nMax - si.nPage + 1;
- break;
-
- case SB_LINEUP:
- si.nPos -= 1;
- break;
-
- case SB_LINEDOWN:
- si.nPos += 1;
- break;
-
- case SB_PAGEUP:
- si.nPos -= si.nPage;
- break;
-
- case SB_PAGEDOWN:
- si.nPos += si.nPage;
- break;
-
- case SB_THUMBTRACK:
- si.nPos = si.nTrackPos;
- break;
-
- default:
- break;
- }
-
- /*
- * We retrieve the position after setting it,
- * because Windows may adjust it.
- */
- si.fMask = SIF_POS;
- SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
- GetScrollInfo (hwnd, SB_VERT, &si);
-
- /* Scroll the window if the position has changed */
- if (si.nPos != iVertPos)
- {
- /* Save the new offset for bit block transfers, etc. */
- s_pScreenInfo->dwYOffset = -si.nPos;
-
- /* Change displayed region in the window */
- ScrollWindowEx (hwnd,
- 0,
- iVertPos - si.nPos,
- NULL,
- NULL,
- NULL,
- NULL,
- SW_INVALIDATE);
-
- /* Redraw the window contents */
- UpdateWindow (hwnd);
- }
- }
- return 0;
+ case SB_BOTTOM:
+ si.nPos = si.nMax - si.nPage + 1;
+ break;
+
+ case SB_LINEUP:
+ si.nPos -= 1;
+ break;
+
+ case SB_LINEDOWN:
+ si.nPos += 1;
+ break;
+
+ case SB_PAGEUP:
+ si.nPos -= si.nPage;
+ break;
+
+ case SB_PAGEDOWN:
+ si.nPos += si.nPage;
+ break;
+
+ case SB_THUMBTRACK:
+ si.nPos = si.nTrackPos;
+ break;
+
+ default:
+ break;
+ }
+
+ /*
+ * We retrieve the position after setting it,
+ * because Windows may adjust it.
+ */
+ si.fMask = SIF_POS;
+ SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+ GetScrollInfo(hwnd, SB_VERT, &si);
+
+ /* Scroll the window if the position has changed */
+ if (si.nPos != iVertPos) {
+ /* Save the new offset for bit block transfers, etc. */
+ s_pScreenInfo->dwYOffset = -si.nPos;
+
+ /* Change displayed region in the window */
+ ScrollWindowEx(hwnd,
+ 0,
+ iVertPos - si.nPos,
+ NULL, NULL, NULL, NULL, SW_INVALIDATE);
+
+ /* Redraw the window contents */
+ UpdateWindow(hwnd);
+ }
+ }
+ return 0;
case WM_HSCROLL:
- {
- SCROLLINFO si;
- int iHorzPos;
+ {
+ SCROLLINFO si;
+ int iHorzPos;
+
+ winDebug("winWindowProc - WM_HSCROLL\n");
+
+ /* Get horizontal scroll bar info */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_ALL;
+ GetScrollInfo(hwnd, SB_HORZ, &si);
+
+ /* Save the horizontal position for comparison later */
+ iHorzPos = si.nPos;
+
+ /*
+ * Don't forget:
+ * moving the scrollbar to the RIGHT, scroll the content LEFT
+ */
+ switch (LOWORD(wParam)) {
+ case SB_LEFT:
+ si.nPos = si.nMin;
+ break;
- winDebug ("winWindowProc - WM_HSCROLL\n");
-
- /* Get horizontal scroll bar info */
- si.cbSize = sizeof (si);
- si.fMask = SIF_ALL;
- GetScrollInfo (hwnd, SB_HORZ, &si);
-
- /* Save the horizontal position for comparison later */
- iHorzPos = si.nPos;
-
- /*
- * Don't forget:
- * moving the scrollbar to the RIGHT, scroll the content LEFT
- */
- switch (LOWORD(wParam))
- {
- case SB_LEFT:
- si.nPos = si.nMin;
- break;
-
- case SB_RIGHT:
- si.nPos = si.nMax - si.nPage + 1;
- break;
-
- case SB_LINELEFT:
- si.nPos -= 1;
- break;
-
- case SB_LINERIGHT:
- si.nPos += 1;
- break;
-
- case SB_PAGELEFT:
- si.nPos -= si.nPage;
- break;
-
- case SB_PAGERIGHT:
- si.nPos += si.nPage;
- break;
-
- case SB_THUMBTRACK:
- si.nPos = si.nTrackPos;
- break;
-
- default:
- break;
- }
-
- /*
- * We retrieve the position after setting it,
- * because Windows may adjust it.
- */
- si.fMask = SIF_POS;
- SetScrollInfo (hwnd, SB_HORZ, &si, TRUE);
- GetScrollInfo (hwnd, SB_HORZ, &si);
-
- /* Scroll the window if the position has changed */
- if (si.nPos != iHorzPos)
- {
- /* Save the new offset for bit block transfers, etc. */
- s_pScreenInfo->dwXOffset = -si.nPos;
-
- /* Change displayed region in the window */
- ScrollWindowEx (hwnd,
- iHorzPos - si.nPos,
- 0,
- NULL,
- NULL,
- NULL,
- NULL,
- SW_INVALIDATE);
-
- /* Redraw the window contents */
- UpdateWindow (hwnd);
- }
- }
- return 0;
+ case SB_RIGHT:
+ si.nPos = si.nMax - si.nPage + 1;
+ break;
+
+ case SB_LINELEFT:
+ si.nPos -= 1;
+ break;
+
+ case SB_LINERIGHT:
+ si.nPos += 1;
+ break;
+
+ case SB_PAGELEFT:
+ si.nPos -= si.nPage;
+ break;
+
+ case SB_PAGERIGHT:
+ si.nPos += si.nPage;
+ break;
+
+ case SB_THUMBTRACK:
+ si.nPos = si.nTrackPos;
+ break;
+
+ default:
+ break;
+ }
+
+ /*
+ * We retrieve the position after setting it,
+ * because Windows may adjust it.
+ */
+ si.fMask = SIF_POS;
+ SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
+ GetScrollInfo(hwnd, SB_HORZ, &si);
+
+ /* Scroll the window if the position has changed */
+ if (si.nPos != iHorzPos) {
+ /* Save the new offset for bit block transfers, etc. */
+ s_pScreenInfo->dwXOffset = -si.nPos;
+
+ /* Change displayed region in the window */
+ ScrollWindowEx(hwnd,
+ iHorzPos - si.nPos,
+ 0, NULL, NULL, NULL, NULL, SW_INVALIDATE);
+
+ /* Redraw the window contents */
+ UpdateWindow(hwnd);
+ }
+ }
+ return 0;
case WM_GETMINMAXINFO:
- {
- MINMAXINFO *pMinMaxInfo = (MINMAXINFO *) lParam;
- int iCaptionHeight;
- int iBorderHeight, iBorderWidth;
-
- winDebug ("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n",
- s_pScreenInfo);
-
- /* Can't do anything without screen info */
- if (s_pScreenInfo == NULL
- || (s_pScreenInfo->iResizeMode != resizeWithScrollbars)
- || s_pScreenInfo->fFullScreen
- || !s_pScreenInfo->fDecoration
+ {
+ MINMAXINFO *pMinMaxInfo = (MINMAXINFO *) lParam;
+ int iCaptionHeight;
+ int iBorderHeight, iBorderWidth;
+
+ winDebug("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n",
+ s_pScreenInfo);
+
+ /* Can't do anything without screen info */
+ if (s_pScreenInfo == NULL
+ || (s_pScreenInfo->iResizeMode != resizeWithScrollbars)
+ || s_pScreenInfo->fFullScreen || !s_pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- || s_pScreenInfo->fRootless
+ || s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
- || s_pScreenInfo->fMultiWindow
+ || s_pScreenInfo->fMultiWindow
#endif
- )
- break;
-
- /*
- * Here we can override the maximum tracking size, which
- * is the largest size that can be assigned to our window
- * via the sizing border.
- */
-
- /*
- * FIXME: Do we only need to do this once, since our visual size
- * does not change? Does Windows store this value statically
- * once we have set it once?
- */
-
- /* Get the border and caption sizes */
- iCaptionHeight = GetSystemMetrics (SM_CYCAPTION);
- iBorderWidth = 2 * GetSystemMetrics (SM_CXSIZEFRAME);
- iBorderHeight = 2 * GetSystemMetrics (SM_CYSIZEFRAME);
-
- /* Allow the full visual to be displayed */
- pMinMaxInfo->ptMaxTrackSize.x
- = s_pScreenInfo->dwWidth + iBorderWidth;
- pMinMaxInfo->ptMaxTrackSize.y
- = s_pScreenInfo->dwHeight + iBorderHeight + iCaptionHeight;
- }
- return 0;
+ )
+ break;
+
+ /*
+ * Here we can override the maximum tracking size, which
+ * is the largest size that can be assigned to our window
+ * via the sizing border.
+ */
+
+ /*
+ * FIXME: Do we only need to do this once, since our visual size
+ * does not change? Does Windows store this value statically
+ * once we have set it once?
+ */
+
+ /* Get the border and caption sizes */
+ iCaptionHeight = GetSystemMetrics(SM_CYCAPTION);
+ iBorderWidth = 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iBorderHeight = 2 * GetSystemMetrics(SM_CYSIZEFRAME);
+
+ /* Allow the full visual to be displayed */
+ pMinMaxInfo->ptMaxTrackSize.x = s_pScreenInfo->dwWidth + iBorderWidth;
+ pMinMaxInfo->ptMaxTrackSize.y
+ = s_pScreenInfo->dwHeight + iBorderHeight + iCaptionHeight;
+ }
+ return 0;
case WM_ERASEBKGND:
- winDebug ("winWindowProc - WM_ERASEBKGND\n");
- /*
- * Pretend that we did erase the background but we don't care,
- * the application uses the full window estate. This avoids some
- * flickering when resizing.
- */
- return TRUE;
+ winDebug("winWindowProc - WM_ERASEBKGND\n");
+ /*
+ * Pretend that we did erase the background but we don't care,
+ * the application uses the full window estate. This avoids some
+ * flickering when resizing.
+ */
+ return TRUE;
case WM_PAINT:
- /* Only paint if we have privates and the server is enabled */
- if (s_pScreenPriv == NULL
- || !s_pScreenPriv->fEnabled
- || (s_pScreenInfo->fFullScreen && !s_pScreenPriv->fActive)
- || s_pScreenPriv->fBadDepth)
- {
- /* We don't want to paint */
- break;
- }
-
- /* Break out here if we don't have a valid paint routine */
- if (s_pScreenPriv->pwinBltExposedRegions == NULL)
- break;
-
- /* Call the engine dependent repainter */
- (*s_pScreenPriv->pwinBltExposedRegions) (s_pScreen);
- return 0;
+ /* Only paint if we have privates and the server is enabled */
+ if (s_pScreenPriv == NULL
+ || !s_pScreenPriv->fEnabled
+ || (s_pScreenInfo->fFullScreen && !s_pScreenPriv->fActive)
+ || s_pScreenPriv->fBadDepth) {
+ /* We don't want to paint */
+ break;
+ }
+
+ /* Break out here if we don't have a valid paint routine */
+ if (s_pScreenPriv->pwinBltExposedRegions == NULL)
+ break;
+
+ /* Call the engine dependent repainter */
+ (*s_pScreenPriv->pwinBltExposedRegions) (s_pScreen);
+ return 0;
case WM_PALETTECHANGED:
- {
- winDebug ("winWindowProc - WM_PALETTECHANGED\n");
- /*
- * Don't process if we don't have privates or a colormap,
- * or if we have an invalid depth.
- */
- if (s_pScreenPriv == NULL
- || s_pScreenPriv->pcmapInstalled == NULL
- || s_pScreenPriv->fBadDepth)
- break;
-
- /* Return if we caused the palette to change */
- if ((HWND) wParam == hwnd)
- {
- /* Redraw the screen */
- (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen);
- return 0;
- }
-
- /* Reinstall the windows palette */
- (*s_pScreenPriv->pwinRealizeInstalledPalette) (s_pScreen);
-
- /* Redraw the screen */
- (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen);
- return 0;
- }
+ {
+ winDebug("winWindowProc - WM_PALETTECHANGED\n");
+ /*
+ * Don't process if we don't have privates or a colormap,
+ * or if we have an invalid depth.
+ */
+ if (s_pScreenPriv == NULL
+ || s_pScreenPriv->pcmapInstalled == NULL
+ || s_pScreenPriv->fBadDepth)
+ break;
+
+ /* Return if we caused the palette to change */
+ if ((HWND) wParam == hwnd) {
+ /* Redraw the screen */
+ (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen);
+ return 0;
+ }
+
+ /* Reinstall the windows palette */
+ (*s_pScreenPriv->pwinRealizeInstalledPalette) (s_pScreen);
+
+ /* Redraw the screen */
+ (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen);
+ return 0;
+ }
case WM_MOUSEMOVE:
- /* We can't do anything without privates */
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- /* We can't do anything without g_pwinPointer */
- if (g_pwinPointer == NULL)
- break;
+ /* We can't do anything without g_pwinPointer */
+ if (g_pwinPointer == NULL)
+ break;
- /* Has the mouse pointer crossed screens? */
- if (s_pScreen != miPointerGetScreen(g_pwinPointer))
- miPointerSetScreen (g_pwinPointer, s_pScreenInfo->dwScreen,
- GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
- GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset);
-
- /* Are we tracking yet? */
- if (!s_fTracking)
- {
- TRACKMOUSEEVENT tme;
-
- /* Setup data structure */
- ZeroMemory (&tme, sizeof (tme));
- tme.cbSize = sizeof (tme);
- tme.dwFlags = TME_LEAVE;
- tme.hwndTrack = hwnd;
-
- /* Call the tracking function */
- if (!TrackMouseEvent(&tme))
- ErrorF ("winWindowProc - TrackMouseEvent failed\n");
-
- /* Flag that we are tracking now */
- s_fTracking = TRUE;
- }
-
- /* Hide or show the Windows mouse cursor */
- if (g_fSoftwareCursor && g_fCursor && (s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer))
- {
- /* Hide Windows cursor */
- g_fCursor = FALSE;
- ShowCursor (FALSE);
- }
- else if (g_fSoftwareCursor && !g_fCursor && !s_pScreenPriv->fActive
- && !s_pScreenInfo->fLessPointer)
- {
- /* Show Windows cursor */
- g_fCursor = TRUE;
- ShowCursor (TRUE);
- }
-
- /* Deliver absolute cursor position to X Server */
- winEnqueueMotion(GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
- GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset);
- return 0;
+ /* Has the mouse pointer crossed screens? */
+ if (s_pScreen != miPointerGetScreen(g_pwinPointer))
+ miPointerSetScreen(g_pwinPointer, s_pScreenInfo->dwScreen,
+ GET_X_LPARAM(lParam) - s_pScreenInfo->dwXOffset,
+ GET_Y_LPARAM(lParam) - s_pScreenInfo->dwYOffset);
+
+ /* Are we tracking yet? */
+ if (!s_fTracking) {
+ TRACKMOUSEEVENT tme;
+
+ /* Setup data structure */
+ ZeroMemory(&tme, sizeof(tme));
+ tme.cbSize = sizeof(tme);
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = hwnd;
+
+ /* Call the tracking function */
+ if (!TrackMouseEvent(&tme))
+ ErrorF("winWindowProc - TrackMouseEvent failed\n");
+
+ /* Flag that we are tracking now */
+ s_fTracking = TRUE;
+ }
+
+ /* Hide or show the Windows mouse cursor */
+ if (g_fSoftwareCursor && g_fCursor &&
+ (s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer)) {
+ /* Hide Windows cursor */
+ g_fCursor = FALSE;
+ ShowCursor(FALSE);
+ }
+ else if (g_fSoftwareCursor && !g_fCursor && !s_pScreenPriv->fActive
+ && !s_pScreenInfo->fLessPointer) {
+ /* Show Windows cursor */
+ g_fCursor = TRUE;
+ ShowCursor(TRUE);
+ }
+
+ /* Deliver absolute cursor position to X Server */
+ winEnqueueMotion(GET_X_LPARAM(lParam) - s_pScreenInfo->dwXOffset,
+ GET_Y_LPARAM(lParam) - s_pScreenInfo->dwYOffset);
+ return 0;
case WM_NCMOUSEMOVE:
- /*
- * We break instead of returning 0 since we need to call
- * DefWindowProc to get the mouse cursor changes
- * and min/max/close button highlighting in Windows XP.
- * The Platform SDK says that you should return 0 if you
- * process this message, but it fails to mention that you
- * will give up any default functionality if you do return 0.
- */
-
- /* We can't do anything without privates */
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
-
- /* Non-client mouse movement, show Windows cursor */
- if (g_fSoftwareCursor && !g_fCursor)
- {
- g_fCursor = TRUE;
- ShowCursor (TRUE);
- }
- break;
+ /*
+ * We break instead of returning 0 since we need to call
+ * DefWindowProc to get the mouse cursor changes
+ * and min/max/close button highlighting in Windows XP.
+ * The Platform SDK says that you should return 0 if you
+ * process this message, but it fails to mention that you
+ * will give up any default functionality if you do return 0.
+ */
+
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Non-client mouse movement, show Windows cursor */
+ if (g_fSoftwareCursor && !g_fCursor) {
+ g_fCursor = TRUE;
+ ShowCursor(TRUE);
+ }
+ break;
case WM_MOUSELEAVE:
- /* Mouse has left our client area */
+ /* Mouse has left our client area */
- /* Flag that we are no longer tracking */
- s_fTracking = FALSE;
+ /* Flag that we are no longer tracking */
+ s_fTracking = FALSE;
- /* Show the mouse cursor, if necessary */
- if (g_fSoftwareCursor && !g_fCursor)
- {
- g_fCursor = TRUE;
- ShowCursor (TRUE);
- }
- return 0;
+ /* Show the mouse cursor, if necessary */
+ if (g_fSoftwareCursor && !g_fCursor) {
+ g_fCursor = TRUE;
+ ShowCursor(TRUE);
+ }
+ return 0;
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- SetCapture (hwnd);
- return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam);
-
+ )
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(s_pScreen, ButtonPress, Button1, wParam);
+
case WM_LBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- ReleaseCapture ();
- return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam);
+ )
+ ReleaseCapture();
+ return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button1, wParam);
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- SetCapture (hwnd);
- return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam);
-
+ )
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(s_pScreen, ButtonPress, Button2, wParam);
+
case WM_MBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- ReleaseCapture ();
- return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam);
-
+ )
+ ReleaseCapture();
+ return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button2, wParam);
+
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- SetCapture (hwnd);
- return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam);
-
+ )
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(s_pScreen, ButtonPress, Button3, wParam);
+
case WM_RBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- ReleaseCapture ();
- return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
+ )
+ ReleaseCapture();
+ return winMouseButtonsHandle(s_pScreen, ButtonRelease, Button3, wParam);
case WM_XBUTTONDBLCLK:
case WM_XBUTTONDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- SetCapture (hwnd);
- return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
+ )
+ SetCapture(hwnd);
+ return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 5,
+ wParam);
case WM_XBUTTONUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- if (s_pScreenInfo->fRootless
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOWEXTWM
- || s_pScreenInfo->fMWExtWM
+ || s_pScreenInfo->fMWExtWM
#endif
- )
- ReleaseCapture ();
- return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
+ )
+ ReleaseCapture();
+ return winMouseButtonsHandle(s_pScreen, ButtonRelease,
+ HIWORD(wParam) + 5, wParam);
case WM_TIMER:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
-
- /* Branch on the timer id */
- switch (wParam)
- {
- case WIN_E3B_TIMER_ID:
- /* Send delayed button press */
- winMouseButtonsSendEvent (ButtonPress,
- s_pScreenPriv->iE3BCachedPress);
-
- /* Kill this timer */
- KillTimer (s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
-
- /* Clear screen privates flags */
- s_pScreenPriv->iE3BCachedPress = 0;
- break;
-
- case WIN_POLLING_MOUSE_TIMER_ID:
- {
- POINT point;
- WPARAM wL, wM, wR, wShift, wCtrl;
- LPARAM lPos;
-
- /* Get the current position of the mouse cursor */
- GetCursorPos (&point);
-
- /* Map from screen (-X, -Y) to root (0, 0) */
- point.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
- point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
-
- /* Deliver absolute cursor position to X Server */
- winEnqueueMotion(point.x , point.y);
-
- /* Check if a button was released but we didn't see it */
- GetCursorPos (&point);
- wL = (GetKeyState (VK_LBUTTON) & 0x8000)?MK_LBUTTON:0;
- wM = (GetKeyState (VK_MBUTTON) & 0x8000)?MK_MBUTTON:0;
- wR = (GetKeyState (VK_RBUTTON) & 0x8000)?MK_RBUTTON:0;
- wShift = (GetKeyState (VK_SHIFT) & 0x8000)?MK_SHIFT:0;
- wCtrl = (GetKeyState (VK_CONTROL) & 0x8000)?MK_CONTROL:0;
- lPos = MAKELPARAM(point.x, point.y);
- if (g_fButton[0] && !wL)
- PostMessage (hwnd, WM_LBUTTONUP, wCtrl|wM|wR|wShift, lPos);
- if (g_fButton[1] && !wM)
- PostMessage (hwnd, WM_MBUTTONUP, wCtrl|wL|wR|wShift, lPos);
- if (g_fButton[2] && !wR)
- PostMessage (hwnd, WM_RBUTTONUP, wCtrl|wL|wM|wShift, lPos);
- }
- }
- return 0;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Branch on the timer id */
+ switch (wParam) {
+ case WIN_E3B_TIMER_ID:
+ /* Send delayed button press */
+ winMouseButtonsSendEvent(ButtonPress,
+ s_pScreenPriv->iE3BCachedPress);
+
+ /* Kill this timer */
+ KillTimer(s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
+
+ /* Clear screen privates flags */
+ s_pScreenPriv->iE3BCachedPress = 0;
+ break;
+
+ case WIN_POLLING_MOUSE_TIMER_ID:
+ {
+ POINT point;
+ WPARAM wL, wM, wR, wShift, wCtrl;
+ LPARAM lPos;
+
+ /* Get the current position of the mouse cursor */
+ GetCursorPos(&point);
+
+ /* Map from screen (-X, -Y) to root (0, 0) */
+ point.x -= GetSystemMetrics(SM_XVIRTUALSCREEN);
+ point.y -= GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ /* Deliver absolute cursor position to X Server */
+ winEnqueueMotion(point.x, point.y);
+
+ /* Check if a button was released but we didn't see it */
+ GetCursorPos(&point);
+ wL = (GetKeyState(VK_LBUTTON) & 0x8000) ? MK_LBUTTON : 0;
+ wM = (GetKeyState(VK_MBUTTON) & 0x8000) ? MK_MBUTTON : 0;
+ wR = (GetKeyState(VK_RBUTTON) & 0x8000) ? MK_RBUTTON : 0;
+ wShift = (GetKeyState(VK_SHIFT) & 0x8000) ? MK_SHIFT : 0;
+ wCtrl = (GetKeyState(VK_CONTROL) & 0x8000) ? MK_CONTROL : 0;
+ lPos = MAKELPARAM(point.x, point.y);
+ if (g_fButton[0] && !wL)
+ PostMessage(hwnd, WM_LBUTTONUP, wCtrl | wM | wR | wShift, lPos);
+ if (g_fButton[1] && !wM)
+ PostMessage(hwnd, WM_MBUTTONUP, wCtrl | wL | wR | wShift, lPos);
+ if (g_fButton[2] && !wR)
+ PostMessage(hwnd, WM_RBUTTONUP, wCtrl | wL | wM | wShift, lPos);
+ }
+ }
+ return 0;
case WM_CTLCOLORSCROLLBAR:
- FatalError ("winWindowProc - WM_CTLCOLORSCROLLBAR - We are not "
- "supposed to get this message. Exiting.\n");
- return 0;
+ FatalError("winWindowProc - WM_CTLCOLORSCROLLBAR - We are not "
+ "supposed to get this message. Exiting.\n");
+ return 0;
case WM_MOUSEWHEEL:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
- winDebug ("winWindowProc - WM_MOUSEWHEEL\n");
- winMouseWheel (s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam));
- break;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ winDebug("winWindowProc - WM_MOUSEWHEEL\n");
+ winMouseWheel(s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam));
+ break;
case WM_SETFOCUS:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- /* Restore the state of all mode keys */
- winRestoreModeKeyStates ();
+ /* Restore the state of all mode keys */
+ winRestoreModeKeyStates();
- /* Add the keyboard hook if possible */
- if (g_fKeyboardHookLL)
- g_fKeyboardHookLL = winInstallKeyboardHookLL ();
- return 0;
+ /* Add the keyboard hook if possible */
+ if (g_fKeyboardHookLL)
+ g_fKeyboardHookLL = winInstallKeyboardHookLL();
+ return 0;
case WM_KILLFOCUS:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- /* Release any pressed keys */
- winKeybdReleaseKeys ();
+ /* Release any pressed keys */
+ winKeybdReleaseKeys();
- /* Remove our keyboard hook if it is installed */
- winRemoveKeyboardHookLL ();
- return 0;
+ /* Remove our keyboard hook if it is installed */
+ winRemoveKeyboardHookLL();
+ return 0;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
-
- /*
- * FIXME: Catching Alt-F4 like this is really terrible. This should
- * be generalized to handle other Windows keyboard signals. Actually,
- * the list keys to catch and the actions to perform when caught should
- * be configurable; that way user's can customize the keys that they
- * need to have passed through to their window manager or apps, or they
- * can remap certain actions to new key codes that do not conflict
- * with the X apps that they are using. Yeah, that'll take awhile.
- */
- if ((s_pScreenInfo->fUseWinKillKey && wParam == VK_F4
- && (GetKeyState (VK_MENU) & 0x8000))
- || (s_pScreenInfo->fUseUnixKillKey && wParam == VK_BACK
- && (GetKeyState (VK_MENU) & 0x8000)
- && (GetKeyState (VK_CONTROL) & 0x8000)))
- {
- /*
- * Better leave this message here, just in case some unsuspecting
- * user enters Alt + F4 and is surprised when the application
- * quits.
- */
- winDebug ("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n");
-
- /* Display Exit dialog */
- winDisplayExitDialog (s_pScreenPriv);
- return 0;
- }
-
- /*
- * Don't do anything for the Windows keys, as focus will soon
- * be returned to Windows. We may be able to trap the Windows keys,
- * but we should determine if that is desirable before doing so.
- */
- if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
- break;
-
- /* Discard fake Ctrl_L events that precede AltGR on non-US keyboards */
- if (winIsFakeCtrl_L (message, wParam, lParam))
- return 0;
-
- /*
- * Discard presses generated from Windows auto-repeat
- */
- if (lParam & (1<<30))
- {
- switch (wParam)
- {
- /* ago: Pressing LControl while RControl is pressed is
- * Indicated as repeat. Fix this!
- */
- case VK_CONTROL:
- case VK_SHIFT:
- if (winCheckKeyPressed(wParam, lParam))
- return 0;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
- default:
+
+ /*
+ * FIXME: Catching Alt-F4 like this is really terrible. This should
+ * be generalized to handle other Windows keyboard signals. Actually,
+ * the list keys to catch and the actions to perform when caught should
+ * be configurable; that way user's can customize the keys that they
+ * need to have passed through to their window manager or apps, or they
+ * can remap certain actions to new key codes that do not conflict
+ * with the X apps that they are using. Yeah, that'll take awhile.
+ */
+ if ((s_pScreenInfo->fUseWinKillKey && wParam == VK_F4
+ && (GetKeyState(VK_MENU) & 0x8000))
+ || (s_pScreenInfo->fUseUnixKillKey && wParam == VK_BACK
+ && (GetKeyState(VK_MENU) & 0x8000)
+ && (GetKeyState(VK_CONTROL) & 0x8000))) {
+ /*
+ * Better leave this message here, just in case some unsuspecting
+ * user enters Alt + F4 and is surprised when the application
+ * quits.
+ */
+ winDebug ("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n");
+
+ /* Display Exit dialog */
+ winDisplayExitDialog(s_pScreenPriv);
return 0;
}
- }
-
- /* Translate Windows key code to X scan code */
- winTranslateKey (wParam, lParam, &iScanCode);
- /* Ignore repeats for CapsLock */
- if (wParam == VK_CAPITAL)
- lParam = 1;
+ /*
+ * Don't do anything for the Windows keys, as focus will soon
+ * be returned to Windows. We may be able to trap the Windows keys,
+ * but we should determine if that is desirable before doing so.
+ */
+ if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
+ break;
- /* Send the key event(s) */
- for (i = 0; i < LOWORD(lParam); ++i)
- winSendKeyEvent (iScanCode, TRUE);
- return 0;
+ /* Discard fake Ctrl_L events that precede AltGR on non-US keyboards */
+ if (winIsFakeCtrl_L(message, wParam, lParam))
+ return 0;
+
+ /*
+ * Discard presses generated from Windows auto-repeat
+ */
+ if (lParam & (1 << 30)) {
+ switch (wParam) {
+ /* ago: Pressing LControl while RControl is pressed is
+ * Indicated as repeat. Fix this!
+ */
+ case VK_CONTROL:
+ case VK_SHIFT:
+ if (winCheckKeyPressed(wParam, lParam))
+ return 0;
+ break;
+ default:
+ return 0;
+ }
+ }
+
+ /* Translate Windows key code to X scan code */
+ winTranslateKey(wParam, lParam, &iScanCode);
+
+ /* Ignore repeats for CapsLock */
+ if (wParam == VK_CAPITAL)
+ lParam = 1;
+
+ /* Send the key event(s) */
+ for (i = 0; i < LOWORD(lParam); ++i)
+ winSendKeyEvent(iScanCode, TRUE);
+ return 0;
case WM_SYSKEYUP:
case WM_KEYUP:
- if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
- break;
-
- /*
- * Don't do anything for the Windows keys, as focus will soon
- * be returned to Windows. We may be able to trap the Windows keys,
- * but we should determine if that is desirable before doing so.
- */
- if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
- break;
-
- /* Ignore the fake Ctrl_L that follows an AltGr release */
- if (winIsFakeCtrl_L (message, wParam, lParam))
- return 0;
-
- /* Enqueue a keyup event */
- winTranslateKey (wParam, lParam, &iScanCode);
- winSendKeyEvent (iScanCode, FALSE);
-
- /* Release all pressed shift keys */
- if (wParam == VK_SHIFT)
- winFixShiftKeys (iScanCode);
- return 0;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /*
+ * Don't do anything for the Windows keys, as focus will soon
+ * be returned to Windows. We may be able to trap the Windows keys,
+ * but we should determine if that is desirable before doing so.
+ */
+ if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
+ break;
+
+ /* Ignore the fake Ctrl_L that follows an AltGr release */
+ if (winIsFakeCtrl_L(message, wParam, lParam))
+ return 0;
+
+ /* Enqueue a keyup event */
+ winTranslateKey(wParam, lParam, &iScanCode);
+ winSendKeyEvent(iScanCode, FALSE);
+
+ /* Release all pressed shift keys */
+ if (wParam == VK_SHIFT)
+ winFixShiftKeys(iScanCode);
+ return 0;
case WM_HOTKEY:
- if (s_pScreenPriv == NULL)
- break;
+ if (s_pScreenPriv == NULL)
+ break;
- /* Call the engine-specific hot key handler */
- (*s_pScreenPriv->pwinHotKeyAltTab) (s_pScreen);
- return 0;
+ /* Call the engine-specific hot key handler */
+ (*s_pScreenPriv->pwinHotKeyAltTab) (s_pScreen);
+ return 0;
case WM_ACTIVATE:
- if (s_pScreenPriv == NULL
- || s_pScreenInfo->fIgnoreInput)
- break;
-
- /* TODO: Override display of window when we have a bad depth */
- if (LOWORD(wParam) != WA_INACTIVE && s_pScreenPriv->fBadDepth)
- {
- winDebug ("winWindowProc - WM_ACTIVATE - Bad depth, trying "
- "to override window activation\n");
-
- /* Minimize the window */
- ShowWindow (hwnd, SW_MINIMIZE);
-
- /* Display dialog box */
- if (g_hDlgDepthChange != NULL)
- {
- /* Make the existing dialog box active */
- SetActiveWindow (g_hDlgDepthChange);
- }
- else
- {
- /* TODO: Recreate the dialog box and bring to the top */
- ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT);
- }
-
- /* Don't do any other processing of this message */
- return 0;
- }
-
- winDebug ("winWindowProc - WM_ACTIVATE\n");
-
- /*
- * Focus is being changed to another window.
- * The other window may or may not belong to
- * our process.
- */
-
- /* Clear any lingering wheel delta */
- s_pScreenPriv->iDeltaZ = 0;
-
- /* Reshow the Windows mouse cursor if we are being deactivated */
- if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE
- && !g_fCursor)
- {
- /* Show Windows cursor */
- g_fCursor = TRUE;
- ShowCursor (TRUE);
- }
- return 0;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* TODO: Override display of window when we have a bad depth */
+ if (LOWORD(wParam) != WA_INACTIVE && s_pScreenPriv->fBadDepth) {
+ winDebug ("winWindowProc - WM_ACTIVATE - Bad depth, trying "
+ "to override window activation\n");
+
+ /* Minimize the window */
+ ShowWindow(hwnd, SW_MINIMIZE);
+
+ /* Display dialog box */
+ if (g_hDlgDepthChange != NULL) {
+ /* Make the existing dialog box active */
+ SetActiveWindow(g_hDlgDepthChange);
+ }
+ else {
+ /* TODO: Recreate the dialog box and bring to the top */
+ ShowWindow(g_hDlgDepthChange, SW_SHOWDEFAULT);
+ }
+
+ /* Don't do any other processing of this message */
+ return 0;
+ }
+
+ winDebug("winWindowProc - WM_ACTIVATE\n");
+
+ /*
+ * Focus is being changed to another window.
+ * The other window may or may not belong to
+ * our process.
+ */
+
+ /* Clear any lingering wheel delta */
+ s_pScreenPriv->iDeltaZ = 0;
+
+ /* Reshow the Windows mouse cursor if we are being deactivated */
+ if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE && !g_fCursor) {
+ /* Show Windows cursor */
+ g_fCursor = TRUE;
+ ShowCursor(TRUE);
+ }
+ return 0;
case WM_ACTIVATEAPP:
- if (s_pScreenPriv == NULL
- || s_pScreenInfo->fIgnoreInput)
- break;
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
- winDebug ("winWindowProc - WM_ACTIVATEAPP\n");
+ winDebug("winWindowProc - WM_ACTIVATEAPP\n");
- /* Activate or deactivate */
- s_pScreenPriv->fActive = wParam;
+ /* Activate or deactivate */
+ s_pScreenPriv->fActive = wParam;
- /* Reshow the Windows mouse cursor if we are being deactivated */
- if (g_fSoftwareCursor && !s_pScreenPriv->fActive
- && !g_fCursor)
- {
- /* Show Windows cursor */
- g_fCursor = TRUE;
- ShowCursor (TRUE);
- }
+ /* Reshow the Windows mouse cursor if we are being deactivated */
+ if (g_fSoftwareCursor && !s_pScreenPriv->fActive && !g_fCursor) {
+ /* Show Windows cursor */
+ g_fCursor = TRUE;
+ ShowCursor(TRUE);
+ }
#ifdef XWIN_CLIPBOARD
- /* Make sure the clipboard chain is ok. */
- winFixClipboardChain (0);
+ /* Make sure the clipboard chain is ok. */
+ winFixClipboardChain (0);
#endif
- /* Call engine specific screen activation/deactivation function */
- (*s_pScreenPriv->pwinActivateApp) (s_pScreen);
+ /* Call engine specific screen activation/deactivation function */
+ (*s_pScreenPriv->pwinActivateApp) (s_pScreen);
#ifdef XWIN_MULTIWINDOWINTWM
- if (s_pScreenPriv->fActive)
- {
- /* Restack all window unless using built-in wm. */
- if (s_pScreenInfo->fInternalWM && s_pScreenInfo->fAnotherWMRunning)
- winMWExtWMRestackWindows (s_pScreen);
- }
+ if (s_pScreenPriv->fActive) {
+ /* Restack all window unless using built-in wm. */
+ if (s_pScreenInfo->fInternalWM && s_pScreenInfo->fAnotherWMRunning)
+ winMWExtWMRestackWindows(s_pScreen);
+ }
#endif
- return 0;
+ return 0;
case WM_COMMAND:
- switch (LOWORD (wParam))
- {
- case ID_APP_EXIT:
- /* Display Exit dialog */
- winDisplayExitDialog (s_pScreenPriv);
- return 0;
+ switch (LOWORD(wParam)) {
+ case ID_APP_EXIT:
+ /* Display Exit dialog */
+ winDisplayExitDialog(s_pScreenPriv);
+ return 0;
#ifdef XWIN_MULTIWINDOW
- case ID_APP_HIDE_ROOT:
- if (s_pScreenPriv->fRootWindowShown)
- ShowWindow (s_pScreenPriv->hwndScreen, SW_HIDE);
- else
- ShowWindow (s_pScreenPriv->hwndScreen, SW_SHOW);
- s_pScreenPriv->fRootWindowShown = !s_pScreenPriv->fRootWindowShown;
- return 0;
+ case ID_APP_HIDE_ROOT:
+ if (s_pScreenPriv->fRootWindowShown)
+ ShowWindow(s_pScreenPriv->hwndScreen, SW_HIDE);
+ else
+ ShowWindow(s_pScreenPriv->hwndScreen, SW_SHOW);
+ s_pScreenPriv->fRootWindowShown = !s_pScreenPriv->fRootWindowShown;
+ return 0;
#endif
- case ID_APP_ABOUT:
- /* Display the About box */
- winDisplayAboutDialog (s_pScreenPriv);
- return 0;
+ case ID_APP_ABOUT:
+ /* Display the About box */
+ winDisplayAboutDialog(s_pScreenPriv);
+ return 0;
- default:
- /* It's probably one of the custom menus... */
- if (HandleCustomWM_COMMAND (0, LOWORD (wParam)))
- return 0;
- }
- break;
+ default:
+ /* It's probably one of the custom menus... */
+ if (HandleCustomWM_COMMAND(0, LOWORD(wParam)))
+ return 0;
+ }
+ break;
case WM_ENDSESSION:
case WM_GIVEUP:
- /* Tell X that we are giving up */
+ /* Tell X that we are giving up */
#ifdef XWIN_MULTIWINDOW
- if (s_pScreenInfo->fMultiWindow)
- winDeinitMultiWindowWM ();
+ if (s_pScreenInfo->fMultiWindow)
+ winDeinitMultiWindowWM();
#endif
g_fClipboardStarted=FALSE; /* This is to avoid dead-locls caused by the clipboard thread still doing some stuff */
- GiveUp (0);
- return 0;
+ GiveUp(0);
+ return 0;
case WM_CLOSE:
- /* Display Exit dialog */
- winDisplayExitDialog (s_pScreenPriv);
- return 0;
+ /* Display Exit dialog */
+ winDisplayExitDialog(s_pScreenPriv);
+ return 0;
case WM_SETCURSOR:
- if (LOWORD(lParam) == HTCLIENT)
- {
- if (!g_fSoftwareCursor) SetCursor (s_pScreenPriv->cursor.handle);
- return TRUE;
- }
- break;
+ if (LOWORD(lParam) == HTCLIENT) {
+ if (!g_fSoftwareCursor)
+ SetCursor(s_pScreenPriv->cursor.handle);
+ return TRUE;
+ }
+ break;
#ifdef XWIN_MULTIWINDOWEXTWM
case WM_MANAGE:
- winDebug ("winWindowProc - WM_MANAGE\n");
- s_pScreenInfo->fAnotherWMRunning = FALSE;
+ winDebug ("winWindowProc - WM_MANAGE\n");
+ s_pScreenInfo->fAnotherWMRunning = FALSE;
#ifdef XWIN_MULTIWINDOWINTWM
- if (s_pScreenInfo->fInternalWM)
- {
- EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0);
- //RootlessRepositionWindows (s_pScreen);
- }
+ if (s_pScreenInfo->fInternalWM) {
+ EnumThreadWindows(g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0);
+ //RootlessRepositionWindows (s_pScreen);
+ }
#endif
- break;
+ break;
case WM_UNMANAGE:
- winDebug ("winWindowProc - WM_UNMANAGE\n");
- s_pScreenInfo->fAnotherWMRunning = TRUE;
+ winDebug ("winWindowProc - WM_UNMANAGE\n");
+ s_pScreenInfo->fAnotherWMRunning = TRUE;
#ifdef XWIN_MULTIWINDOWINTWM
- if (s_pScreenInfo->fInternalWM)
- {
- EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0);
- winMWExtWMRestackWindows (s_pScreen);
- }
+ if (s_pScreenInfo->fInternalWM) {
+ EnumThreadWindows(g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0);
+ winMWExtWMRestackWindows(s_pScreen);
+ }
#endif
- break;
+ break;
#endif
default:
- if(message == s_uTaskbarRestart)
- {
- winInitNotifyIcon (s_pScreenPriv,FALSE);
- }
- break;
+ if (message == s_uTaskbarRestart) {
+ winInitNotifyIcon (s_pScreenPriv,FALSE);
+ }
+ break;
}
- return DefWindowProc (hwnd, message, wParam, lParam);
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
diff --git a/xorg-server/include/XIstubs.h b/xorg-server/include/XIstubs.h
index 380f8d8f2..b7ea4d1f4 100644
--- a/xorg-server/include/XIstubs.h
+++ b/xorg-server/include/XIstubs.h
@@ -1,49 +1,46 @@
-/************************************************************
-
-Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of the above listed
-copyright holder(s) not be used in advertising or publicity pertaining
-to distribution of the software without specific, written prior
-permission.
-
-THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
-TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
-LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-#ifndef XI_STUBS_H
-#define XI_STUBS_H 1
-
-extern _X_EXPORT int
-SetDeviceMode (
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- int /* mode */);
-
-extern _X_EXPORT int
-SetDeviceValuators (
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- int * /* valuators */,
- int /* first_valuator */,
- int /* num_valuators */);
-
-extern _X_EXPORT int
-ChangeDeviceControl (
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- xDeviceCtl * /* control */);
-
-#endif /* XI_STUBS_H */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef XI_STUBS_H
+#define XI_STUBS_H 1
+
+extern _X_EXPORT int
+ SetDeviceMode(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ int /* mode */ );
+
+extern _X_EXPORT int
+ SetDeviceValuators(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ int * /* valuators */ ,
+ int /* first_valuator */ ,
+ int /* num_valuators */ );
+
+extern _X_EXPORT int
+ ChangeDeviceControl(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ xDeviceCtl * /* control */ );
+
+#endif /* XI_STUBS_H */
diff --git a/xorg-server/include/Xprintf.h b/xorg-server/include/Xprintf.h
index 1d2882993..414fd46fb 100644
--- a/xorg-server/include/Xprintf.h
+++ b/xorg-server/include/Xprintf.h
@@ -1,69 +1,69 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef XPRINTF_H
-#define XPRINTF_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <X11/Xfuncproto.h>
-
-#ifndef _X_RESTRICT_KYWD
-# if defined(restrict) /* assume autoconf set it correctly */ || \
- (defined(__STDC__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */
-# define _X_RESTRICT_KYWD restrict
-# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
-# define _X_RESTRICT_KYWD __restrict__
-# else
-# define _X_RESTRICT_KYWD
-# endif
-#endif
-
-/*
- * These functions provide a portable implementation of the common (but not
- * yet universal) asprintf & vasprintf routines to allocate a buffer big
- * enough to sprintf the arguments to. The XNF variants terminate the server
- * if the allocation fails.
- * The buffer allocated is returned in the pointer provided in the first
- * argument. The return value is the size of the allocated buffer, or -1
- * on failure.
- */
-extern _X_EXPORT int Xasprintf (char **ret,
- const char * _X_RESTRICT_KYWD fmt,
- ...) _X_ATTRIBUTE_PRINTF(2,3);
-extern _X_EXPORT int Xvasprintf (char **ret,
- const char * _X_RESTRICT_KYWD fmt,
- va_list va) _X_ATTRIBUTE_PRINTF(2,0);
-extern _X_EXPORT int XNFasprintf (char **ret,
- const char * _X_RESTRICT_KYWD fmt,
- ...) _X_ATTRIBUTE_PRINTF(2,3);
-extern _X_EXPORT int XNFvasprintf (char **ret,
- const char * _X_RESTRICT_KYWD fmt,
- va_list va) _X_ATTRIBUTE_PRINTF(2,0);
-
-#if !defined(HAVE_ASPRINTF) && !defined(HAVE_VASPRINTF)
-# define asprintf Xasprintf
-# define vasprintf Xvasprintf
-#endif
-
-#endif /* XPRINTF_H */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef XPRINTF_H
+#define XPRINTF_H
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <X11/Xfuncproto.h>
+
+#ifndef _X_RESTRICT_KYWD
+#if defined(restrict) /* assume autoconf set it correctly */ || \
+ (defined(__STDC__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */
+#define _X_RESTRICT_KYWD restrict
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
+#define _X_RESTRICT_KYWD __restrict__
+#else
+#define _X_RESTRICT_KYWD
+#endif
+#endif
+
+/*
+ * These functions provide a portable implementation of the common (but not
+ * yet universal) asprintf & vasprintf routines to allocate a buffer big
+ * enough to sprintf the arguments to. The XNF variants terminate the server
+ * if the allocation fails.
+ * The buffer allocated is returned in the pointer provided in the first
+ * argument. The return value is the size of the allocated buffer, or -1
+ * on failure.
+ */
+extern _X_EXPORT int
+Xasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
+extern _X_EXPORT int
+Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, va_list va)
+_X_ATTRIBUTE_PRINTF(2, 0);
+extern _X_EXPORT int
+XNFasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
+extern _X_EXPORT int
+XNFvasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, va_list va)
+_X_ATTRIBUTE_PRINTF(2, 0);
+
+#if !defined(HAVE_ASPRINTF) && !defined(HAVE_VASPRINTF)
+#define asprintf Xasprintf
+#define vasprintf Xvasprintf
+#endif
+
+#endif /* XPRINTF_H */
diff --git a/xorg-server/include/callback.h b/xorg-server/include/callback.h
index 2c4510a6e..a2ea1faf7 100644
--- a/xorg-server/include/callback.h
+++ b/xorg-server/include/callback.h
@@ -1,98 +1,94 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifndef CALLBACK_H
-#define CALLBACK_H
-
-#include <X11/X.h> /* for GContext, Mask */
-#include <X11/Xdefs.h> /* for Bool */
-#include <X11/Xproto.h>
-#include <X11/Xfuncproto.h>
-
-#ifdef _MSC_VER
-#define inline __inline
-#endif
-
-/*
- * callback manager stuff
- */
-
-#ifndef _XTYPEDEF_CALLBACKLISTPTR
-typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */
-#define _XTYPEDEF_CALLBACKLISTPTR
-#endif
-
-typedef void (*CallbackProcPtr) (
- CallbackListPtr *, pointer, pointer);
-
-extern _X_EXPORT Bool AddCallback(
- CallbackListPtr * /*pcbl*/,
- CallbackProcPtr /*callback*/,
- pointer /*data*/);
-
-extern _X_EXPORT Bool DeleteCallback(
- CallbackListPtr * /*pcbl*/,
- CallbackProcPtr /*callback*/,
- pointer /*data*/);
-
-extern _X_EXPORT void _CallCallbacks(
- CallbackListPtr * /*pcbl*/,
- pointer /*call_data*/);
-
-static inline void
-CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
-{
- if (!pcbl || !*pcbl) return;
- _CallCallbacks(pcbl, call_data);
-}
-
-extern _X_EXPORT void DeleteCallbackList(
- CallbackListPtr * /*pcbl*/);
-
-extern _X_EXPORT void InitCallbackManager(void);
-
-#endif /* CALLBACK_H */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef CALLBACK_H
+#define CALLBACK_H
+
+#include <X11/X.h> /* for GContext, Mask */
+#include <X11/Xdefs.h> /* for Bool */
+#include <X11/Xproto.h>
+#include <X11/Xfuncproto.h>
+
+#ifdef _MSC_VER
+#define inline __inline
+#endif
+
+/*
+ * callback manager stuff
+ */
+
+#ifndef _XTYPEDEF_CALLBACKLISTPTR
+typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */
+
+#define _XTYPEDEF_CALLBACKLISTPTR
+#endif
+
+typedef void (*CallbackProcPtr) (CallbackListPtr *, pointer, pointer);
+
+extern _X_EXPORT Bool AddCallback(CallbackListPtr * /*pcbl */ ,
+ CallbackProcPtr /*callback */ ,
+ pointer /*data */ );
+
+extern _X_EXPORT Bool DeleteCallback(CallbackListPtr * /*pcbl */ ,
+ CallbackProcPtr /*callback */ ,
+ pointer /*data */ );
+
+extern _X_EXPORT void _CallCallbacks(CallbackListPtr * /*pcbl */ ,
+ pointer /*call_data */ );
+
+static inline void
+CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
+{
+ if (!pcbl || !*pcbl)
+ return;
+ _CallCallbacks(pcbl, call_data);
+}
+
+extern _X_EXPORT void DeleteCallbackList(CallbackListPtr * /*pcbl */ );
+
+extern _X_EXPORT void InitCallbackManager(void);
+
+#endif /* CALLBACK_H */
diff --git a/xorg-server/include/client.h b/xorg-server/include/client.h
index aaafc7da6..87f2b1172 100644
--- a/xorg-server/include/client.h
+++ b/xorg-server/include/client.h
@@ -28,16 +28,16 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
-#endif /* HAVE_DIX_CONFIG_H */
+#endif /* HAVE_DIX_CONFIG_H */
#include <X11/Xfuncproto.h>
#include <sys/types.h>
/* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs
* instead of accessing the fields directly. */
typedef struct {
- pid_t pid; /* process ID, -1 if not available */
- const char *cmdname; /* process name, NULL if not available */
- const char *cmdargs; /* process arguments, NULL if not available */
+ pid_t pid; /* process ID, -1 if not available */
+ const char *cmdname; /* process name, NULL if not available */
+ const char *cmdargs; /* process arguments, NULL if not available */
} ClientIdRec, *ClientIdPtr;
struct _Client;
@@ -49,11 +49,12 @@ void ReleaseClientIds(struct _Client *client);
/* Determine client IDs for caching. Exported on purpose for
* extensions such as SELinux. */
extern _X_EXPORT pid_t DetermineClientPid(struct _Client *client);
-extern _X_EXPORT void DetermineClientCmd(pid_t, const char **cmdname, const char **cmdargs);
+extern _X_EXPORT void DetermineClientCmd(pid_t, const char **cmdname,
+ const char **cmdargs);
/* Query cached client IDs. Exported on purpose for drivers. */
extern _X_EXPORT pid_t GetClientPid(struct _Client *client);
extern _X_EXPORT const char *GetClientCmdName(struct _Client *client);
extern _X_EXPORT const char *GetClientCmdArgs(struct _Client *client);
-#endif /* CLIENT_H */
+#endif /* CLIENT_H */
diff --git a/xorg-server/include/colormap.h b/xorg-server/include/colormap.h
index db4c1c834..8996cfec5 100644
--- a/xorg-server/include/colormap.h
+++ b/xorg-server/include/colormap.h
@@ -1,189 +1,170 @@
-/*
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-
-#ifndef CMAP_H
-#define CMAP_H 1
-
-#include <X11/Xproto.h>
-#include "screenint.h"
-#include "window.h"
-
-/* these follow X.h's AllocNone and AllocAll */
-#define CM_PSCREEN 2
-#define CM_PWIN 3
-/* Passed internally in colormap.c */
-#define REDMAP 0
-#define GREENMAP 1
-#define BLUEMAP 2
-#define PSEUDOMAP 3
-#define AllocPrivate (-1)
-#define AllocTemporary (-2)
-#define DynamicClass 1
-
-/* Values for the flags field of a colormap. These should have 1 bit set
- * and not overlap */
-#define IsDefault 1
-#define AllAllocated 2
-#define BeingCreated 4
-
-
-typedef CARD32 Pixel;
-typedef struct _CMEntry *EntryPtr;
-/* moved to screenint.h: typedef struct _ColormapRec *ColormapPtr */
-typedef struct _colorResource *colorResourcePtr;
-
-extern _X_EXPORT int CreateColormap(
- Colormap /*mid*/,
- ScreenPtr /*pScreen*/,
- VisualPtr /*pVisual*/,
- ColormapPtr* /*ppcmap*/,
- int /*alloc*/,
- int /*client*/);
-
-extern _X_EXPORT int FreeColormap(
- pointer /*pmap*/,
- XID /*mid*/);
-
-extern _X_EXPORT int TellLostMap(
- WindowPtr /*pwin*/,
- pointer /* Colormap *pmid */);
-
-extern _X_EXPORT int TellGainedMap(
- WindowPtr /*pwin*/,
- pointer /* Colormap *pmid */);
-
-extern _X_EXPORT int CopyColormapAndFree(
- Colormap /*mid*/,
- ColormapPtr /*pSrc*/,
- int /*client*/);
-
-extern _X_EXPORT int AllocColor(
- ColormapPtr /*pmap*/,
- unsigned short* /*pred*/,
- unsigned short* /*pgreen*/,
- unsigned short* /*pblue*/,
- Pixel* /*pPix*/,
- int /*client*/);
-
-extern _X_EXPORT void FakeAllocColor(
- ColormapPtr /*pmap*/,
- xColorItem * /*item*/);
-
-extern _X_EXPORT void FakeFreeColor(
- ColormapPtr /*pmap*/,
- Pixel /*pixel*/);
-
-typedef int (*ColorCompareProcPtr)(
- EntryPtr /*pent*/,
- xrgb * /*prgb*/);
-
-extern _X_EXPORT int FindColor(
- ColormapPtr /*pmap*/,
- EntryPtr /*pentFirst*/,
- int /*size*/,
- xrgb* /*prgb*/,
- Pixel* /*pPixel*/,
- int /*channel*/,
- int /*client*/,
- ColorCompareProcPtr /*comp*/);
-
-extern _X_EXPORT int QueryColors(
- ColormapPtr /*pmap*/,
- int /*count*/,
- Pixel* /*ppixIn*/,
- xrgb* /*prgbList*/,
- ClientPtr client);
-
-extern _X_EXPORT int FreeClientPixels(
- pointer /*pcr*/,
- XID /*fakeid*/);
-
-extern _X_EXPORT int AllocColorCells(
- int /*client*/,
- ColormapPtr /*pmap*/,
- int /*colors*/,
- int /*planes*/,
- Bool /*contig*/,
- Pixel* /*ppix*/,
- Pixel* /*masks*/);
-
-extern _X_EXPORT int AllocColorPlanes(
- int /*client*/,
- ColormapPtr /*pmap*/,
- int /*colors*/,
- int /*r*/,
- int /*g*/,
- int /*b*/,
- Bool /*contig*/,
- Pixel* /*pixels*/,
- Pixel* /*prmask*/,
- Pixel* /*pgmask*/,
- Pixel* /*pbmask*/);
-
-extern _X_EXPORT int FreeColors(
- ColormapPtr /*pmap*/,
- int /*client*/,
- int /*count*/,
- Pixel* /*pixels*/,
- Pixel /*mask*/);
-
-extern _X_EXPORT int StoreColors(
- ColormapPtr /*pmap*/,
- int /*count*/,
- xColorItem* /*defs*/,
- ClientPtr client);
-
-extern _X_EXPORT int IsMapInstalled(
- Colormap /*map*/,
- WindowPtr /*pWin*/);
-
-extern _X_EXPORT Bool ResizeVisualArray(
- ScreenPtr /* pScreen */,
- int /* new_vis_count */,
- DepthPtr /* depth */);
-
-#endif /* CMAP_H */
+/*
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifndef CMAP_H
+#define CMAP_H 1
+
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "window.h"
+
+/* these follow X.h's AllocNone and AllocAll */
+#define CM_PSCREEN 2
+#define CM_PWIN 3
+/* Passed internally in colormap.c */
+#define REDMAP 0
+#define GREENMAP 1
+#define BLUEMAP 2
+#define PSEUDOMAP 3
+#define AllocPrivate (-1)
+#define AllocTemporary (-2)
+#define DynamicClass 1
+
+/* Values for the flags field of a colormap. These should have 1 bit set
+ * and not overlap */
+#define IsDefault 1
+#define AllAllocated 2
+#define BeingCreated 4
+
+typedef CARD32 Pixel;
+typedef struct _CMEntry *EntryPtr;
+
+/* moved to screenint.h: typedef struct _ColormapRec *ColormapPtr */
+typedef struct _colorResource *colorResourcePtr;
+
+extern _X_EXPORT int CreateColormap(Colormap /*mid */ ,
+ ScreenPtr /*pScreen */ ,
+ VisualPtr /*pVisual */ ,
+ ColormapPtr * /*ppcmap */ ,
+ int /*alloc */ ,
+ int /*client */ );
+
+extern _X_EXPORT int FreeColormap(pointer /*pmap */ ,
+ XID /*mid */ );
+
+extern _X_EXPORT int TellLostMap(WindowPtr /*pwin */ ,
+ pointer /* Colormap *pmid */ );
+
+extern _X_EXPORT int TellGainedMap(WindowPtr /*pwin */ ,
+ pointer /* Colormap *pmid */ );
+
+extern _X_EXPORT int CopyColormapAndFree(Colormap /*mid */ ,
+ ColormapPtr /*pSrc */ ,
+ int /*client */ );
+
+extern _X_EXPORT int AllocColor(ColormapPtr /*pmap */ ,
+ unsigned short * /*pred */ ,
+ unsigned short * /*pgreen */ ,
+ unsigned short * /*pblue */ ,
+ Pixel * /*pPix */ ,
+ int /*client */ );
+
+extern _X_EXPORT void FakeAllocColor(ColormapPtr /*pmap */ ,
+ xColorItem * /*item */ );
+
+extern _X_EXPORT void FakeFreeColor(ColormapPtr /*pmap */ ,
+ Pixel /*pixel */ );
+
+typedef int (*ColorCompareProcPtr) (EntryPtr /*pent */ ,
+ xrgb * /*prgb */ );
+
+extern _X_EXPORT int FindColor(ColormapPtr /*pmap */ ,
+ EntryPtr /*pentFirst */ ,
+ int /*size */ ,
+ xrgb * /*prgb */ ,
+ Pixel * /*pPixel */ ,
+ int /*channel */ ,
+ int /*client */ ,
+ ColorCompareProcPtr /*comp */ );
+
+extern _X_EXPORT int QueryColors(ColormapPtr /*pmap */ ,
+ int /*count */ ,
+ Pixel * /*ppixIn */ ,
+ xrgb * /*prgbList */ ,
+ ClientPtr client);
+
+extern _X_EXPORT int FreeClientPixels(pointer /*pcr */ ,
+ XID /*fakeid */ );
+
+extern _X_EXPORT int AllocColorCells(int /*client */ ,
+ ColormapPtr /*pmap */ ,
+ int /*colors */ ,
+ int /*planes */ ,
+ Bool /*contig */ ,
+ Pixel * /*ppix */ ,
+ Pixel * /*masks */ );
+
+extern _X_EXPORT int AllocColorPlanes(int /*client */ ,
+ ColormapPtr /*pmap */ ,
+ int /*colors */ ,
+ int /*r */ ,
+ int /*g */ ,
+ int /*b */ ,
+ Bool /*contig */ ,
+ Pixel * /*pixels */ ,
+ Pixel * /*prmask */ ,
+ Pixel * /*pgmask */ ,
+ Pixel * /*pbmask */ );
+
+extern _X_EXPORT int FreeColors(ColormapPtr /*pmap */ ,
+ int /*client */ ,
+ int /*count */ ,
+ Pixel * /*pixels */ ,
+ Pixel /*mask */ );
+
+extern _X_EXPORT int StoreColors(ColormapPtr /*pmap */ ,
+ int /*count */ ,
+ xColorItem * /*defs */ ,
+ ClientPtr client);
+
+extern _X_EXPORT int IsMapInstalled(Colormap /*map */ ,
+ WindowPtr /*pWin */ );
+
+extern _X_EXPORT Bool ResizeVisualArray(ScreenPtr /* pScreen */ ,
+ int /* new_vis_count */ ,
+ DepthPtr /* depth */ );
+
+#endif /* CMAP_H */
diff --git a/xorg-server/include/colormapst.h b/xorg-server/include/colormapst.h
index bb79c86d2..ac0c62e70 100644
--- a/xorg-server/include/colormapst.h
+++ b/xorg-server/include/colormapst.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -53,67 +52,60 @@ SOFTWARE.
#include "privates.h"
/* Shared color -- the color is used by AllocColorPlanes */
-typedef struct
-{
+typedef struct {
unsigned short color;
- short refcnt;
+ short refcnt;
} SHAREDCOLOR;
/* LOCO -- a local color for a PseudoColor cell. DirectColor maps always
* use the first value (called red) in the structure. What channel they
* are really talking about depends on which map they are in. */
-typedef struct
-{
- unsigned short red, green, blue;
+typedef struct {
+ unsigned short red, green, blue;
} LOCO;
/* SHCO -- a shared color for a PseudoColor cell. Used with AllocColorPlanes.
* DirectColor maps always use the first value (called red) in the structure.
* What channel they are really talking about depends on which map they
* are in. */
-typedef struct
-{
+typedef struct {
SHAREDCOLOR *red, *green, *blue;
} SHCO;
-
/* color map entry */
-typedef struct _CMEntry
-{
- union
- {
- LOCO local;
- SHCO shco;
+typedef struct _CMEntry {
+ union {
+ LOCO local;
+ SHCO shco;
} co;
- short refcnt;
- Bool fShared;
+ short refcnt;
+ Bool fShared;
} Entry;
/* COLORMAPs can be used for either Direct or Pseudo color. PseudoColor
* only needs one cell table, we arbitrarily pick red. We keep track
* of that table with freeRed, numPixelsRed, and clientPixelsRed */
-typedef struct _ColormapRec
-{
- VisualPtr pVisual;
- short class; /* PseudoColor or DirectColor */
- XID mid; /* client's name for colormap */
- ScreenPtr pScreen; /* screen map is associated with */
- short flags; /* 1 = IsDefault
- * 2 = AllAllocated */
- int freeRed;
- int freeGreen;
- int freeBlue;
- int *numPixelsRed;
- int *numPixelsGreen;
- int *numPixelsBlue;
- Pixel **clientPixelsRed;
- Pixel **clientPixelsGreen;
- Pixel **clientPixelsBlue;
- Entry *red;
- Entry *green;
- Entry *blue;
- PrivateRec *devPrivates;
+typedef struct _ColormapRec {
+ VisualPtr pVisual;
+ short class; /* PseudoColor or DirectColor */
+ XID mid; /* client's name for colormap */
+ ScreenPtr pScreen; /* screen map is associated with */
+ short flags; /* 1 = IsDefault
+ * 2 = AllAllocated */
+ int freeRed;
+ int freeGreen;
+ int freeBlue;
+ int *numPixelsRed;
+ int *numPixelsGreen;
+ int *numPixelsBlue;
+ Pixel **clientPixelsRed;
+ Pixel **clientPixelsGreen;
+ Pixel **clientPixelsBlue;
+ Entry *red;
+ Entry *green;
+ Entry *blue;
+ PrivateRec *devPrivates;
} ColormapRec;
-
-#endif /* COLORMAP_H */
+
+#endif /* COLORMAP_H */
diff --git a/xorg-server/include/cursor.h b/xorg-server/include/cursor.h
index 394383a04..082325123 100644
--- a/xorg-server/include/cursor.h
+++ b/xorg-server/include/cursor.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -46,7 +45,7 @@ SOFTWARE.
******************************************************************/
#ifndef CURSOR_H
-#define CURSOR_H
+#define CURSOR_H
#include "misc.h"
#include "screenint.h"
@@ -64,77 +63,70 @@ typedef struct _Cursor *CursorPtr;
typedef struct _CursorMetric *CursorMetricPtr;
extern _X_EXPORT DevScreenPrivateKeyRec cursorScreenDevPriv;
+
#define CursorScreenKey (&cursorScreenDevPriv)
extern _X_EXPORT CursorPtr rootCursor;
-extern _X_EXPORT int FreeCursor(
- pointer /*pCurs*/,
- XID /*cid*/);
-
-extern _X_EXPORT int AllocARGBCursor(
- unsigned char* /*psrcbits*/,
- unsigned char* /*pmaskbits*/,
- CARD32* /*argb*/,
- CursorMetricPtr /*cm*/,
- unsigned /*foreRed*/,
- unsigned /*foreGreen*/,
- unsigned /*foreBlue*/,
- unsigned /*backRed*/,
- unsigned /*backGreen*/,
- unsigned /*backBlue*/,
- CursorPtr* /*ppCurs*/,
- ClientPtr /*client*/,
- XID /*cid*/);
-
-extern _X_EXPORT int AllocGlyphCursor(
- Font /*source*/,
- unsigned int /*sourceChar*/,
- Font /*mask*/,
- unsigned int /*maskChar*/,
- unsigned /*foreRed*/,
- unsigned /*foreGreen*/,
- unsigned /*foreBlue*/,
- unsigned /*backRed*/,
- unsigned /*backGreen*/,
- unsigned /*backBlue*/,
- CursorPtr* /*ppCurs*/,
- ClientPtr /*client*/,
- XID /*cid*/);
-
-extern _X_EXPORT CursorPtr CreateRootCursor(
- char* /*pfilename*/,
- unsigned int /*glyph*/);
-
-extern _X_EXPORT int ServerBitsFromGlyph(
- FontPtr /*pfont*/,
- unsigned int /*ch*/,
- CursorMetricPtr /*cm*/,
- unsigned char ** /*ppbits*/);
-
-extern _X_EXPORT Bool CursorMetricsFromGlyph(
- FontPtr /*pfont*/,
- unsigned /*ch*/,
- CursorMetricPtr /*cm*/);
-
-extern _X_EXPORT void CheckCursorConfinement(
- WindowPtr /*pWin*/);
-
-extern _X_EXPORT void NewCurrentScreen(
- struct _DeviceIntRec* /*pDev*/,
- ScreenPtr /*newScreen*/,
- int /*x*/,
- int /*y*/);
-
-extern _X_EXPORT Bool PointerConfinedToScreen(struct _DeviceIntRec* /* pDev */);
-
-extern _X_EXPORT void GetSpritePosition(
- struct _DeviceIntRec* /* pDev */,
- int * /*px*/,
- int * /*py*/);
+extern _X_EXPORT int FreeCursor(pointer /*pCurs */ ,
+ XID /*cid */ );
+
+extern _X_EXPORT int AllocARGBCursor(unsigned char * /*psrcbits */ ,
+ unsigned char * /*pmaskbits */ ,
+ CARD32 * /*argb */ ,
+ CursorMetricPtr /*cm */ ,
+ unsigned /*foreRed */ ,
+ unsigned /*foreGreen */ ,
+ unsigned /*foreBlue */ ,
+ unsigned /*backRed */ ,
+ unsigned /*backGreen */ ,
+ unsigned /*backBlue */ ,
+ CursorPtr * /*ppCurs */ ,
+ ClientPtr /*client */ ,
+ XID /*cid */ );
+
+extern _X_EXPORT int AllocGlyphCursor(Font /*source */ ,
+ unsigned int /*sourceChar */ ,
+ Font /*mask */ ,
+ unsigned int /*maskChar */ ,
+ unsigned /*foreRed */ ,
+ unsigned /*foreGreen */ ,
+ unsigned /*foreBlue */ ,
+ unsigned /*backRed */ ,
+ unsigned /*backGreen */ ,
+ unsigned /*backBlue */ ,
+ CursorPtr * /*ppCurs */ ,
+ ClientPtr /*client */ ,
+ XID /*cid */ );
+
+extern _X_EXPORT CursorPtr CreateRootCursor(char * /*pfilename */ ,
+ unsigned int /*glyph */ );
+
+extern _X_EXPORT int ServerBitsFromGlyph(FontPtr /*pfont */ ,
+ unsigned int /*ch */ ,
+ CursorMetricPtr /*cm */ ,
+ unsigned char ** /*ppbits */ );
+
+extern _X_EXPORT Bool CursorMetricsFromGlyph(FontPtr /*pfont */ ,
+ unsigned /*ch */ ,
+ CursorMetricPtr /*cm */ );
+
+extern _X_EXPORT void CheckCursorConfinement(WindowPtr /*pWin */ );
+
+extern _X_EXPORT void NewCurrentScreen(struct _DeviceIntRec * /*pDev */ ,
+ ScreenPtr /*newScreen */ ,
+ int /*x */ ,
+ int /*y */ );
+
+extern _X_EXPORT Bool PointerConfinedToScreen(struct _DeviceIntRec * /* pDev */
+ );
+
+extern _X_EXPORT void GetSpritePosition(struct _DeviceIntRec * /* pDev */ ,
+ int * /*px */ ,
+ int * /*py */ );
#ifdef PANORAMIX
-extern _X_EXPORT int XineramaGetCursorScreen(struct _DeviceIntRec* pDev);
-#endif /* PANORAMIX */
+extern _X_EXPORT int XineramaGetCursorScreen(struct _DeviceIntRec *pDev);
+#endif /* PANORAMIX */
-#endif /* CURSOR_H */
+#endif /* CURSOR_H */
diff --git a/xorg-server/include/dix.h b/xorg-server/include/dix.h
index f3f68d39c..5dc2ac568 100644
--- a/xorg-server/include/dix.h
+++ b/xorg-server/include/dix.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -65,7 +64,6 @@ SOFTWARE.
#define REQUEST(type) \
type *stuff = (type *)client->requestBuffer
-
#define REQUEST_SIZE_MATCH(req)\
if ((sizeof(req) >> 2) != client->req_len)\
return(BadLength)
@@ -100,7 +98,6 @@ SOFTWARE.
if (pGC->serialNumber != pDraw->serialNumber)\
ValidateGC(pDraw, pGC);
-
#define WriteReplyToClient(pClient, size, pReply) { \
if ((pClient)->swapped) \
(*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \
@@ -115,11 +112,12 @@ SOFTWARE.
typedef struct _TimeStamp *TimeStampPtr;
#ifndef _XTYPEDEF_CLIENTPTR
-typedef struct _Client *ClientPtr; /* also in misc.h */
+typedef struct _Client *ClientPtr; /* also in misc.h */
+
#define _XTYPEDEF_CLIENTPTR
#endif
-typedef struct _WorkQueue *WorkQueuePtr;
+typedef struct _WorkQueue *WorkQueuePtr;
extern _X_EXPORT ClientPtr clients[MAXCLIENTS];
extern _X_EXPORT ClientPtr serverClient;
@@ -127,130 +125,109 @@ extern _X_EXPORT int currentMaxClients;
extern _X_EXPORT char dispatchExceptionAtReset;
typedef int HWEventQueueType;
-typedef HWEventQueueType* HWEventQueuePtr;
+typedef HWEventQueueType *HWEventQueuePtr;
extern _X_EXPORT HWEventQueuePtr checkForInput[2];
typedef struct _TimeStamp {
- CARD32 months; /* really ~49.7 days */
+ CARD32 months; /* really ~49.7 days */
CARD32 milliseconds;
-} TimeStamp;
+} TimeStamp;
/* dispatch.c */
-extern _X_EXPORT void SetInputCheck(
- HWEventQueuePtr /*c0*/,
- HWEventQueuePtr /*c1*/);
+extern _X_EXPORT void SetInputCheck(HWEventQueuePtr /*c0 */ ,
+ HWEventQueuePtr /*c1 */ );
-extern _X_EXPORT void CloseDownClient(
- ClientPtr /*client*/);
+extern _X_EXPORT void CloseDownClient(ClientPtr /*client */ );
extern _X_EXPORT void UpdateCurrentTime(void);
extern _X_EXPORT void UpdateCurrentTimeIf(void);
-extern _X_EXPORT int dixDestroyPixmap(
- pointer /*value*/,
- XID /*pid*/);
+extern _X_EXPORT int dixDestroyPixmap(pointer /*value */ ,
+ XID /*pid */ );
-extern _X_EXPORT void InitClient(
- ClientPtr /*client*/,
- int /*i*/,
- pointer /*ospriv*/);
+extern _X_EXPORT void InitClient(ClientPtr /*client */ ,
+ int /*i */ ,
+ pointer /*ospriv */ );
-extern _X_EXPORT ClientPtr NextAvailableClient(
- pointer /*ospriv*/);
+extern _X_EXPORT ClientPtr NextAvailableClient(pointer /*ospriv */ );
-extern _X_EXPORT void SendErrorToClient(
- ClientPtr /*client*/,
- unsigned int /*majorCode*/,
- unsigned int /*minorCode*/,
- XID /*resId*/,
- int /*errorCode*/);
+extern _X_EXPORT void SendErrorToClient(ClientPtr /*client */ ,
+ unsigned int /*majorCode */ ,
+ unsigned int /*minorCode */ ,
+ XID /*resId */ ,
+ int /*errorCode */ );
-extern _X_EXPORT void MarkClientException(
- ClientPtr /*client*/);
+extern _X_EXPORT void MarkClientException(ClientPtr /*client */ );
extern _X_HIDDEN Bool CreateConnectionBlock(void);
+
/* dixutils.c */
-extern _X_EXPORT int CompareISOLatin1Lowered(
- const unsigned char * /*a*/,
- int alen,
- const unsigned char * /*b*/,
- int blen);
-
-extern _X_EXPORT int dixLookupWindow(
- WindowPtr *result,
- XID id,
- ClientPtr client,
- Mask access_mode);
-
-extern _X_EXPORT int dixLookupDrawable(
- DrawablePtr *result,
- XID id,
- ClientPtr client,
- Mask type_mask,
- Mask access_mode);
-
-extern _X_EXPORT int dixLookupGC(
- GCPtr *result,
- XID id,
- ClientPtr client,
- Mask access_mode);
-
-extern _X_EXPORT int dixLookupFontable(
- FontPtr *result,
- XID id,
- ClientPtr client,
- Mask access_mode);
-
-extern _X_EXPORT int dixLookupClient(
- ClientPtr *result,
- XID id,
- ClientPtr client,
- Mask access_mode);
+extern _X_EXPORT int CompareISOLatin1Lowered(const unsigned char * /*a */ ,
+ int alen,
+ const unsigned char * /*b */ ,
+ int blen);
+
+extern _X_EXPORT int dixLookupWindow(WindowPtr *result,
+ XID id,
+ ClientPtr client, Mask access_mode);
+
+extern _X_EXPORT int dixLookupDrawable(DrawablePtr *result,
+ XID id,
+ ClientPtr client,
+ Mask type_mask, Mask access_mode);
+
+extern _X_EXPORT int dixLookupGC(GCPtr *result,
+ XID id, ClientPtr client, Mask access_mode);
+
+extern _X_EXPORT int dixLookupFontable(FontPtr *result,
+ XID id,
+ ClientPtr client, Mask access_mode);
+
+extern _X_EXPORT int dixLookupClient(ClientPtr *result,
+ XID id,
+ ClientPtr client, Mask access_mode);
extern _X_EXPORT void NoopDDA(void);
-extern _X_EXPORT int AlterSaveSetForClient(
- ClientPtr /*client*/,
- WindowPtr /*pWin*/,
- unsigned /*mode*/,
- Bool /*toRoot*/,
- Bool /*map*/);
-
-extern _X_EXPORT void DeleteWindowFromAnySaveSet(
- WindowPtr /*pWin*/);
+extern _X_EXPORT int AlterSaveSetForClient(ClientPtr /*client */ ,
+ WindowPtr /*pWin */ ,
+ unsigned /*mode */ ,
+ Bool /*toRoot */ ,
+ Bool /*map */ );
-extern _X_EXPORT void BlockHandler(
- pointer /*pTimeout*/,
- pointer /*pReadmask*/);
+extern _X_EXPORT void DeleteWindowFromAnySaveSet(WindowPtr /*pWin */ );
-extern _X_EXPORT void WakeupHandler(
- int /*result*/,
- pointer /*pReadmask*/);
+extern _X_EXPORT void BlockHandler(pointer /*pTimeout */ ,
+ pointer /*pReadmask */ );
+
+extern _X_EXPORT void WakeupHandler(int /*result */ ,
+ pointer /*pReadmask */ );
void
-EnableLimitedSchedulingLatency(void);
+ EnableLimitedSchedulingLatency(void);
void
-DisableLimitedSchedulingLatency(void);
+ DisableLimitedSchedulingLatency(void);
-typedef void (* WakeupHandlerProcPtr)(
- pointer /* blockData */,
- int /* result */,
- pointer /* pReadmask */);
+typedef void (*WakeupHandlerProcPtr) (pointer /* blockData */ ,
+ int /* result */ ,
+ pointer /* pReadmask */ );
-extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(
- BlockHandlerProcPtr /*blockHandler*/,
- WakeupHandlerProcPtr /*wakeupHandler*/,
- pointer /*blockData*/);
+extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr
+ /*blockHandler */ ,
+ WakeupHandlerProcPtr
+ /*wakeupHandler */ ,
+ pointer /*blockData */ );
-extern _X_EXPORT void RemoveBlockAndWakeupHandlers(
- BlockHandlerProcPtr /*blockHandler*/,
- WakeupHandlerProcPtr /*wakeupHandler*/,
- pointer /*blockData*/);
+extern _X_EXPORT void RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr
+ /*blockHandler */ ,
+ WakeupHandlerProcPtr
+ /*wakeupHandler */ ,
+ pointer /*blockData */ );
extern _X_EXPORT void InitBlockAndWakeupHandlers(void);
@@ -258,302 +235,308 @@ extern _X_EXPORT void ProcessWorkQueue(void);
extern _X_EXPORT void ProcessWorkQueueZombies(void);
-extern _X_EXPORT Bool QueueWorkProc(
- Bool (* /*function*/)(
- ClientPtr /*clientUnused*/,
- pointer /*closure*/),
- ClientPtr /*client*/,
- pointer /*closure*/
-);
+extern _X_EXPORT Bool QueueWorkProc(Bool (* /*function */ )(
+ ClientPtr
+ /*clientUnused */
+ ,
+ pointer
+ /*closure */ ),
+ ClientPtr /*client */ ,
+ pointer /*closure */
+ );
-typedef Bool (* ClientSleepProcPtr)(
- ClientPtr /*client*/,
- pointer /*closure*/);
+typedef Bool (*ClientSleepProcPtr) (ClientPtr /*client */ ,
+ pointer /*closure */ );
-extern _X_EXPORT Bool ClientSleep(
- ClientPtr /*client*/,
- ClientSleepProcPtr /* function */,
- pointer /*closure*/);
+extern _X_EXPORT Bool ClientSleep(ClientPtr /*client */ ,
+ ClientSleepProcPtr /* function */ ,
+ pointer /*closure */ );
#ifndef ___CLIENTSIGNAL_DEFINED___
#define ___CLIENTSIGNAL_DEFINED___
-extern _X_EXPORT Bool ClientSignal(
- ClientPtr /*client*/);
-#endif /* ___CLIENTSIGNAL_DEFINED___ */
+extern _X_EXPORT Bool ClientSignal(ClientPtr /*client */ );
+#endif /* ___CLIENTSIGNAL_DEFINED___ */
-extern _X_EXPORT void ClientWakeup(
- ClientPtr /*client*/);
+extern _X_EXPORT void ClientWakeup(ClientPtr /*client */ );
-extern _X_EXPORT Bool ClientIsAsleep(
- ClientPtr /*client*/);
+extern _X_EXPORT Bool ClientIsAsleep(ClientPtr /*client */ );
/* atom.c */
-extern _X_EXPORT Atom MakeAtom(
- const char * /*string*/,
- unsigned /*len*/,
- Bool /*makeit*/);
+extern _X_EXPORT Atom MakeAtom(const char * /*string */ ,
+ unsigned /*len */ ,
+ Bool /*makeit */ );
-extern _X_EXPORT Bool ValidAtom(
- Atom /*atom*/);
+extern _X_EXPORT Bool ValidAtom(Atom /*atom */ );
-extern _X_EXPORT const char *NameForAtom(
- Atom /*atom*/);
+extern _X_EXPORT const char *NameForAtom(Atom /*atom */ );
-extern _X_EXPORT void AtomError(void) _X_NORETURN;
+extern _X_EXPORT void
+AtomError(void)
+ _X_NORETURN;
-extern _X_EXPORT void FreeAllAtoms(void);
+extern _X_EXPORT void
+FreeAllAtoms(void);
-extern _X_EXPORT void InitAtoms(void);
+extern _X_EXPORT void
+InitAtoms(void);
/* main.c */
-extern _X_EXPORT void SetVendorRelease(int release);
+extern _X_EXPORT void
+SetVendorRelease(int release);
-extern _X_EXPORT void SetVendorString(char *string);
+extern _X_EXPORT void
+SetVendorString(char *string);
/* events.c */
-extern void SetMaskForEvent(
- int /* deviceid */,
- Mask /* mask */,
- int /* event */);
-
-extern _X_EXPORT void ConfineToShape(
- DeviceIntPtr /* pDev */,
- RegionPtr /* shape */,
- int* /* px */,
- int* /* py */);
-
-extern _X_EXPORT Bool IsParent(
- WindowPtr /* maybeparent */,
- WindowPtr /* child */);
-
-extern _X_EXPORT WindowPtr GetCurrentRootWindow(DeviceIntPtr pDev);
-
-extern _X_EXPORT WindowPtr GetSpriteWindow(DeviceIntPtr pDev);
-
-
-extern _X_EXPORT void NoticeEventTime(InternalEvent *ev);
-
-extern void EnqueueEvent(
- InternalEvent * /* ev */,
- DeviceIntPtr /* device */);
-extern void PlayReleasedEvents(void);
-
-extern void ActivatePointerGrab(
- DeviceIntPtr /* mouse */,
- GrabPtr /* grab */,
- TimeStamp /* time */,
- Bool /* autoGrab */);
-
-extern void DeactivatePointerGrab(
- DeviceIntPtr /* mouse */);
-
-extern void ActivateKeyboardGrab(
- DeviceIntPtr /* keybd */,
- GrabPtr /* grab */,
- TimeStamp /* time */,
- Bool /* passive */);
-
-extern void DeactivateKeyboardGrab(
- DeviceIntPtr /* keybd */);
-
-extern BOOL ActivateFocusInGrab(
- DeviceIntPtr /* dev */,
- WindowPtr /* old */,
- WindowPtr /* win */);
-
-extern void AllowSome(
- ClientPtr /* client */,
- TimeStamp /* time */,
- DeviceIntPtr /* thisDev */,
- int /* newState */);
-
-extern void ReleaseActiveGrabs(
- ClientPtr client);
-
-extern GrabPtr CheckPassiveGrabsOnWindow(
- WindowPtr /* pWin */,
- DeviceIntPtr /* device */,
- InternalEvent * /* event */,
- BOOL /* checkCore */,
- BOOL /* activate */);
-
-extern _X_EXPORT int DeliverEventsToWindow(
- DeviceIntPtr /* pWin */,
- WindowPtr /* pWin */,
- xEventPtr /* pEvents */,
- int /* count */,
- Mask /* filter */,
- GrabPtr /* grab */);
-
-extern _X_EXPORT void DeliverRawEvent(
- RawDeviceEvent* /* ev */,
- DeviceIntPtr /* dev */
-);
-
-extern int DeliverDeviceEvents(
- WindowPtr /* pWin */,
- InternalEvent* /* event */,
- GrabPtr /* grab */,
- WindowPtr /* stopAt */,
- DeviceIntPtr /* dev */);
-
-extern int DeliverOneGrabbedEvent(
- InternalEvent* /* event*/,
- DeviceIntPtr /* dev */,
- enum InputLevel /* level */);
-
-extern void DeliverTouchEvents(
- DeviceIntPtr /* dev */,
- TouchPointInfoPtr /* ti */,
- InternalEvent* /* ev */,
- XID /* resource */);
-
-extern void InitializeSprite(
- DeviceIntPtr /* pDev */,
- WindowPtr /* pWin */);
-
-extern void UpdateSpriteForScreen(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScreen */);
-
-extern _X_EXPORT void WindowHasNewCursor(
- WindowPtr /* pWin */);
-
-extern Bool CheckDeviceGrabs(
- DeviceIntPtr /* device */,
- DeviceEvent* /* event */,
- WindowPtr /* ancestor */);
-
-extern void DeliverFocusedEvent(
- DeviceIntPtr /* keybd */,
- InternalEvent* /* event */,
- WindowPtr /* window */);
-
-extern int DeliverGrabbedEvent(
- InternalEvent* /* event */,
- DeviceIntPtr /* thisDev */,
- Bool /* deactivateGrab */);
-
-extern void FixKeyState(
- DeviceEvent* /* event */,
- DeviceIntPtr /* keybd */);
-
-extern void RecalculateDeliverableEvents(
- WindowPtr /* pWin */);
-
-extern _X_EXPORT int OtherClientGone(
- pointer /* value */,
- XID /* id */);
-
-extern void DoFocusEvents(
- DeviceIntPtr /* dev */,
- WindowPtr /* fromWin */,
- WindowPtr /* toWin */,
- int /* mode */);
-
-extern int SetInputFocus(
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- Window /* focusID */,
- CARD8 /* revertTo */,
- Time /* ctime */,
- Bool /* followOK */);
-
-extern int GrabDevice(
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- unsigned /* this_mode */,
- unsigned /* other_mode */,
- Window /* grabWindow */,
- unsigned /* ownerEvents */,
- Time /* ctime */,
- GrabMask* /* mask */,
- int /* grabtype */,
- Cursor /* curs */,
- Window /* confineToWin */,
- CARD8 * /* status */);
-
-extern void InitEvents(void);
-
-extern void CloseDownEvents(void);
-
-extern void DeleteWindowFromAnyEvents(
- WindowPtr /* pWin */,
- Bool /* freeResources */);
-
-
-extern Mask EventMaskForClient(
- WindowPtr /* pWin */,
- ClientPtr /* client */);
-
-
-
-extern _X_EXPORT int DeliverEvents(
- WindowPtr /*pWin*/,
- xEventPtr /*xE*/,
- int /*count*/,
- WindowPtr /*otherParent*/);
-
-extern Bool CheckMotion(
- DeviceEvent* /* ev */,
- DeviceIntPtr /* pDev */);
-
-extern _X_EXPORT void WriteEventsToClient(
- ClientPtr /*pClient*/,
- int /*count*/,
- xEventPtr /*events*/);
-
-extern _X_EXPORT int TryClientEvents(
- ClientPtr /*client*/,
- DeviceIntPtr /* device */,
- xEventPtr /*pEvents*/,
- int /*count*/,
- Mask /*mask*/,
- Mask /*filter*/,
- GrabPtr /*grab*/);
-
-extern _X_EXPORT void WindowsRestructured(void);
-
-extern int SetClientPointer(
- ClientPtr /* client */,
- DeviceIntPtr /* device */);
-
-extern _X_EXPORT DeviceIntPtr PickPointer(
- ClientPtr /* client */);
-
-extern _X_EXPORT DeviceIntPtr PickKeyboard(
- ClientPtr /* client */);
-
-extern Bool IsInterferingGrab(
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- xEvent* /* events */);
+extern void
+SetMaskForEvent(int /* deviceid */ ,
+ Mask /* mask */ ,
+ int /* event */ );
+
+extern _X_EXPORT void
+ConfineToShape(DeviceIntPtr /* pDev */ ,
+ RegionPtr /* shape */ ,
+ int * /* px */ ,
+ int * /* py */ );
+
+extern _X_EXPORT Bool
+IsParent(WindowPtr /* maybeparent */ ,
+ WindowPtr /* child */ );
+
+extern _X_EXPORT WindowPtr
+GetCurrentRootWindow(DeviceIntPtr pDev);
+
+extern _X_EXPORT WindowPtr
+GetSpriteWindow(DeviceIntPtr pDev);
+
+extern _X_EXPORT void
+NoticeEventTime(InternalEvent *ev,
+ DeviceIntPtr dev);
+
+extern void
+EnqueueEvent(InternalEvent * /* ev */ ,
+ DeviceIntPtr /* device */ );
+extern void
+PlayReleasedEvents(void);
+
+extern void
+ActivatePointerGrab(DeviceIntPtr /* mouse */ ,
+ GrabPtr /* grab */ ,
+ TimeStamp /* time */ ,
+ Bool /* autoGrab */ );
+
+extern void
+DeactivatePointerGrab(DeviceIntPtr /* mouse */ );
+
+extern void
+ActivateKeyboardGrab(DeviceIntPtr /* keybd */ ,
+ GrabPtr /* grab */ ,
+ TimeStamp /* time */ ,
+ Bool /* passive */ );
+
+extern void
+DeactivateKeyboardGrab(DeviceIntPtr /* keybd */ );
+
+extern BOOL
+ActivateFocusInGrab(DeviceIntPtr /* dev */ ,
+ WindowPtr /* old */ ,
+ WindowPtr /* win */ );
+
+extern void
+AllowSome(ClientPtr /* client */ ,
+ TimeStamp /* time */ ,
+ DeviceIntPtr /* thisDev */ ,
+ int /* newState */ );
+
+extern void
+ReleaseActiveGrabs(ClientPtr client);
+
+extern GrabPtr
+CheckPassiveGrabsOnWindow(WindowPtr /* pWin */ ,
+ DeviceIntPtr /* device */ ,
+ InternalEvent * /* event */ ,
+ BOOL /* checkCore */ ,
+ BOOL /* activate */ );
+
+extern _X_EXPORT int
+DeliverEventsToWindow(DeviceIntPtr /* pWin */ ,
+ WindowPtr /* pWin */ ,
+ xEventPtr /* pEvents */ ,
+ int /* count */ ,
+ Mask /* filter */ ,
+ GrabPtr /* grab */ );
+
+extern _X_EXPORT void
+DeliverRawEvent(RawDeviceEvent * /* ev */ ,
+ DeviceIntPtr /* dev */
+ );
+
+extern int
+DeliverDeviceEvents(WindowPtr /* pWin */ ,
+ InternalEvent * /* event */ ,
+ GrabPtr /* grab */ ,
+ WindowPtr /* stopAt */ ,
+ DeviceIntPtr /* dev */ );
+
+extern int
+DeliverOneGrabbedEvent(InternalEvent * /* event */ ,
+ DeviceIntPtr /* dev */ ,
+ enum InputLevel /* level */ );
+
+extern void
+DeliverTouchEvents(DeviceIntPtr /* dev */ ,
+ TouchPointInfoPtr /* ti */ ,
+ InternalEvent * /* ev */ ,
+ XID /* resource */ );
+
+extern void
+InitializeSprite(DeviceIntPtr /* pDev */ ,
+ WindowPtr /* pWin */ );
+
+extern void
+UpdateSpriteForScreen(DeviceIntPtr /* pDev */ ,
+ ScreenPtr /* pScreen */ );
+
+extern _X_EXPORT void
+WindowHasNewCursor(WindowPtr /* pWin */ );
+
+extern Bool
+CheckDeviceGrabs(DeviceIntPtr /* device */ ,
+ DeviceEvent * /* event */ ,
+ WindowPtr /* ancestor */ );
+
+extern void
+DeliverFocusedEvent(DeviceIntPtr /* keybd */ ,
+ InternalEvent * /* event */ ,
+ WindowPtr /* window */ );
+
+extern int
+DeliverGrabbedEvent(InternalEvent * /* event */ ,
+ DeviceIntPtr /* thisDev */ ,
+ Bool /* deactivateGrab */ );
+
+extern void
+FixKeyState(DeviceEvent * /* event */ ,
+ DeviceIntPtr /* keybd */ );
+
+extern void
+RecalculateDeliverableEvents(WindowPtr /* pWin */ );
+
+extern _X_EXPORT int
+OtherClientGone(pointer /* value */ ,
+ XID /* id */ );
+
+extern void
+DoFocusEvents(DeviceIntPtr /* dev */ ,
+ WindowPtr /* fromWin */ ,
+ WindowPtr /* toWin */ ,
+ int /* mode */ );
+
+extern int
+SetInputFocus(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ Window /* focusID */ ,
+ CARD8 /* revertTo */ ,
+ Time /* ctime */ ,
+ Bool /* followOK */ );
+
+extern int
+GrabDevice(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ unsigned /* this_mode */ ,
+ unsigned /* other_mode */ ,
+ Window /* grabWindow */ ,
+ unsigned /* ownerEvents */ ,
+ Time /* ctime */ ,
+ GrabMask * /* mask */ ,
+ int /* grabtype */ ,
+ Cursor /* curs */ ,
+ Window /* confineToWin */ ,
+ CARD8 * /* status */ );
+
+extern void
+InitEvents(void);
+
+extern void
+CloseDownEvents(void);
+
+extern void
+DeleteWindowFromAnyEvents(WindowPtr /* pWin */ ,
+ Bool /* freeResources */ );
+
+extern Mask
+EventMaskForClient(WindowPtr /* pWin */ ,
+ ClientPtr /* client */ );
+
+extern _X_EXPORT int
+DeliverEvents(WindowPtr /*pWin */ ,
+ xEventPtr /*xE */ ,
+ int /*count */ ,
+ WindowPtr /*otherParent */ );
+
+extern Bool
+CheckMotion(DeviceEvent * /* ev */ ,
+ DeviceIntPtr /* pDev */ );
+
+extern _X_EXPORT void
+WriteEventsToClient(ClientPtr /*pClient */ ,
+ int /*count */ ,
+ xEventPtr /*events */ );
+
+extern _X_EXPORT int
+TryClientEvents(ClientPtr /*client */ ,
+ DeviceIntPtr /* device */ ,
+ xEventPtr /*pEvents */ ,
+ int /*count */ ,
+ Mask /*mask */ ,
+ Mask /*filter */ ,
+ GrabPtr /*grab */ );
+
+extern _X_EXPORT void
+WindowsRestructured(void);
+
+extern int
+SetClientPointer(ClientPtr /* client */ ,
+ DeviceIntPtr /* device */ );
+
+extern _X_EXPORT DeviceIntPtr
+PickPointer(ClientPtr /* client */ );
+
+extern _X_EXPORT DeviceIntPtr
+PickKeyboard(ClientPtr /* client */ );
+
+extern Bool
+IsInterferingGrab(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ xEvent * /* events */ );
#ifdef PANORAMIX
-extern _X_EXPORT void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff);
+extern _X_EXPORT void
+ReinitializeRootWindow(WindowPtr win, int xoff, int yoff);
#endif
#ifdef RANDR
extern _X_EXPORT void
-ScreenRestructured (ScreenPtr pScreen);
+ScreenRestructured(ScreenPtr pScreen);
#endif
#ifndef HAVE_FFS
-extern _X_EXPORT int ffs(int i);
+extern _X_EXPORT int
+ffs(int i);
#endif
-
/*
* ServerGrabCallback stuff
*/
extern _X_EXPORT CallbackListPtr ServerGrabCallback;
-typedef enum {SERVER_GRABBED, SERVER_UNGRABBED,
- CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState;
+typedef enum { SERVER_GRABBED, SERVER_UNGRABBED,
+ CLIENT_PERVIOUS, CLIENT_IMPERVIOUS
+} ServerGrabState;
typedef struct {
ClientPtr client;
@@ -583,17 +566,28 @@ typedef struct {
DeviceIntPtr device;
} DeviceEventInfoRec;
-extern int XItoCoreType(int xi_type);
-extern Bool DevHasCursor(DeviceIntPtr pDev);
-extern _X_EXPORT Bool IsPointerDevice(DeviceIntPtr dev);
-extern _X_EXPORT Bool IsKeyboardDevice(DeviceIntPtr dev);
-extern Bool IsPointerEvent(InternalEvent *event);
-extern Bool IsTouchEvent(InternalEvent *event);
-extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev);
-extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev);
-
-extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
-extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
-extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what);
-
-#endif /* DIX_H */
+extern int
+XItoCoreType(int xi_type);
+extern Bool
+DevHasCursor(DeviceIntPtr pDev);
+extern _X_EXPORT Bool
+IsPointerDevice(DeviceIntPtr dev);
+extern _X_EXPORT Bool
+IsKeyboardDevice(DeviceIntPtr dev);
+extern Bool
+IsPointerEvent(InternalEvent *event);
+extern Bool
+IsTouchEvent(InternalEvent *event);
+extern _X_EXPORT Bool
+IsMaster(DeviceIntPtr dev);
+extern _X_EXPORT Bool
+IsFloating(DeviceIntPtr dev);
+
+extern _X_HIDDEN void
+CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
+extern _X_HIDDEN int
+CorePointerProc(DeviceIntPtr dev, int what);
+extern _X_HIDDEN int
+CoreKeyboardProc(DeviceIntPtr dev, int what);
+
+#endif /* DIX_H */
diff --git a/xorg-server/include/dixevents.h b/xorg-server/include/dixevents.h
index b9153456f..c8f384ea5 100644
--- a/xorg-server/include/dixevents.h
+++ b/xorg-server/include/dixevents.h
@@ -26,66 +26,62 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef DIXEVENTS_H
#define DIXEVENTS_H
-extern _X_EXPORT void SetCriticalEvent(int /* event */);
+extern _X_EXPORT void SetCriticalEvent(int /* event */ );
-extern _X_EXPORT CursorPtr GetSpriteCursor(DeviceIntPtr /*pDev*/);
+extern _X_EXPORT CursorPtr GetSpriteCursor(DeviceIntPtr /*pDev */ );
-extern _X_EXPORT int ProcAllowEvents(ClientPtr /* client */);
+extern _X_EXPORT int ProcAllowEvents(ClientPtr /* client */ );
-extern _X_EXPORT int MaybeDeliverEventsToClient(
- WindowPtr /* pWin */,
- xEvent * /* pEvents */,
- int /* count */,
- Mask /* filter */,
- ClientPtr /* dontClient */);
+extern _X_EXPORT int MaybeDeliverEventsToClient(WindowPtr /* pWin */ ,
+ xEvent * /* pEvents */ ,
+ int /* count */ ,
+ Mask /* filter */ ,
+ ClientPtr /* dontClient */ );
-extern _X_EXPORT int ProcWarpPointer(ClientPtr /* client */);
+extern _X_EXPORT int ProcWarpPointer(ClientPtr /* client */ );
-extern _X_EXPORT int EventSelectForWindow(
- WindowPtr /* pWin */,
- ClientPtr /* client */,
- Mask /* mask */);
+extern _X_EXPORT int EventSelectForWindow(WindowPtr /* pWin */ ,
+ ClientPtr /* client */ ,
+ Mask /* mask */ );
-extern _X_EXPORT int EventSuppressForWindow(
- WindowPtr /* pWin */,
- ClientPtr /* client */,
- Mask /* mask */,
- Bool * /* checkOptional */);
+extern _X_EXPORT int EventSuppressForWindow(WindowPtr /* pWin */ ,
+ ClientPtr /* client */ ,
+ Mask /* mask */ ,
+ Bool * /* checkOptional */ );
-extern _X_EXPORT int ProcSetInputFocus(ClientPtr /* client */);
+extern _X_EXPORT int ProcSetInputFocus(ClientPtr /* client */ );
-extern _X_EXPORT int ProcGetInputFocus(ClientPtr /* client */);
+extern _X_EXPORT int ProcGetInputFocus(ClientPtr /* client */ );
-extern _X_EXPORT int ProcGrabPointer(ClientPtr /* client */);
+extern _X_EXPORT int ProcGrabPointer(ClientPtr /* client */ );
-extern _X_EXPORT int ProcChangeActivePointerGrab(ClientPtr /* client */);
+extern _X_EXPORT int ProcChangeActivePointerGrab(ClientPtr /* client */ );
-extern _X_EXPORT int ProcUngrabPointer(ClientPtr /* client */);
+extern _X_EXPORT int ProcUngrabPointer(ClientPtr /* client */ );
-extern _X_EXPORT int ProcGrabKeyboard(ClientPtr /* client */);
+extern _X_EXPORT int ProcGrabKeyboard(ClientPtr /* client */ );
-extern _X_EXPORT int ProcUngrabKeyboard(ClientPtr /* client */);
+extern _X_EXPORT int ProcUngrabKeyboard(ClientPtr /* client */ );
-extern _X_EXPORT int ProcQueryPointer(ClientPtr /* client */);
+extern _X_EXPORT int ProcQueryPointer(ClientPtr /* client */ );
-extern _X_EXPORT int ProcSendEvent(ClientPtr /* client */);
+extern _X_EXPORT int ProcSendEvent(ClientPtr /* client */ );
-extern _X_EXPORT int ProcUngrabKey(ClientPtr /* client */);
+extern _X_EXPORT int ProcUngrabKey(ClientPtr /* client */ );
-extern _X_EXPORT int ProcGrabKey(ClientPtr /* client */);
+extern _X_EXPORT int ProcGrabKey(ClientPtr /* client */ );
-extern _X_EXPORT int ProcGrabButton(ClientPtr /* client */);
+extern _X_EXPORT int ProcGrabButton(ClientPtr /* client */ );
-extern _X_EXPORT int ProcUngrabButton(ClientPtr /* client */);
+extern _X_EXPORT int ProcUngrabButton(ClientPtr /* client */ );
-extern _X_EXPORT int ProcRecolorCursor(ClientPtr /* client */);
+extern _X_EXPORT int ProcRecolorCursor(ClientPtr /* client */ );
#ifdef PANORAMIX
extern _X_EXPORT void PostSyntheticMotion(DeviceIntPtr pDev,
- int x,
- int y,
- int screen,
- unsigned long time);
+ int x,
+ int y,
+ int screen, unsigned long time);
#endif
-#endif /* DIXEVENTS_H */
+#endif /* DIXEVENTS_H */
diff --git a/xorg-server/include/dixfont.h b/xorg-server/include/dixfont.h
index 7ed29cfba..9333041fb 100644
--- a/xorg-server/include/dixfont.h
+++ b/xorg-server/include/dixfont.h
@@ -1,184 +1,183 @@
-/***********************************************************
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifndef DIXFONT_H
-#define DIXFONT_H 1
-
-#include "dix.h"
-#include <X11/fonts/font.h>
-#include "closure.h"
-#include <X11/fonts/fontstruct.h>
-
-#define NullDIXFontProp ((DIXFontPropPtr)0)
-
-typedef struct _DIXFontProp *DIXFontPropPtr;
-
-extern _X_EXPORT Bool SetDefaultFont(char * /*defaultfontname*/);
-
-extern _X_EXPORT void QueueFontWakeup(FontPathElementPtr /*fpe*/);
-
-extern _X_EXPORT void RemoveFontWakeup(FontPathElementPtr /*fpe*/);
-
-extern _X_EXPORT void FontWakeup(pointer /*data*/,
- int /*count*/,
- pointer /*LastSelectMask*/);
-
-extern _X_EXPORT int OpenFont(ClientPtr /*client*/,
- XID /*fid*/,
- Mask /*flags*/,
- unsigned /*lenfname*/,
- char * /*pfontname*/);
-
-extern _X_EXPORT int CloseFont(pointer /*pfont*/,
- XID /*fid*/);
-
-typedef struct _xQueryFontReply *xQueryFontReplyPtr;
-
-extern _X_EXPORT void QueryFont(FontPtr /*pFont*/,
- xQueryFontReplyPtr /*pReply*/,
- int /*nProtoCCIStructs*/);
-
-extern _X_EXPORT int ListFonts(ClientPtr /*client*/,
- unsigned char * /*pattern*/,
- unsigned int /*length*/,
- unsigned int /*max_names*/);
-
-extern _X_EXPORT int
-doListFontsWithInfo(ClientPtr /*client*/,
- LFWIclosurePtr /*c*/);
-
-extern _X_EXPORT int doPolyText(ClientPtr /*client*/,
- PTclosurePtr /*c*/
-);
-
-extern _X_EXPORT int PolyText(ClientPtr /*client*/,
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- unsigned char * /*pElt*/,
- unsigned char * /*endReq*/,
- int /*xorg*/,
- int /*yorg*/,
- int /*reqType*/,
- XID /*did*/);
-
-extern _X_EXPORT int doImageText(ClientPtr /*client*/,
- ITclosurePtr /*c*/);
-
-extern _X_EXPORT int ImageText(ClientPtr /*client*/,
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*nChars*/,
- unsigned char * /*data*/,
- int /*xorg*/,
- int /*yorg*/,
- int /*reqType*/,
- XID /*did*/);
-
-extern _X_EXPORT int SetFontPath(ClientPtr /*client*/,
- int /*npaths*/,
- unsigned char * /*paths*/);
-
-extern _X_EXPORT int SetDefaultFontPath(char * /*path*/);
-
-extern _X_EXPORT int GetFontPath(ClientPtr client,
- int *count,
- int *length,
- unsigned char **result);
-
-extern _X_EXPORT void DeleteClientFontStuff(ClientPtr /*client*/);
-
-/* Quartz support on Mac OS X pulls in the QuickDraw
- framework whose InitFonts function conflicts here. */
-#ifdef __APPLE__
-#define InitFonts Darwin_X_InitFonts
-#endif
-extern _X_EXPORT void InitFonts(void);
-
-extern _X_EXPORT void FreeFonts(void);
-
-extern _X_EXPORT FontPtr find_old_font(XID /*id*/);
-
-extern _X_EXPORT void GetGlyphs(FontPtr /*font*/,
- unsigned long /*count*/,
- unsigned char * /*chars*/,
- FontEncoding /*fontEncoding*/,
- unsigned long * /*glyphcount*/,
- CharInfoPtr * /*glyphs*/);
-
-extern _X_EXPORT void QueryGlyphExtents(FontPtr /*pFont*/,
- CharInfoPtr * /*charinfo*/,
- unsigned long /*count*/,
- ExtentInfoPtr /*info*/);
-
-extern _X_EXPORT Bool QueryTextExtents(FontPtr /*pFont*/,
- unsigned long /*count*/,
- unsigned char * /*chars*/,
- ExtentInfoPtr /*info*/);
-
-extern _X_EXPORT Bool ParseGlyphCachingMode(char * /*str*/);
-
-extern _X_EXPORT void InitGlyphCaching(void);
-
-extern _X_EXPORT void SetGlyphCachingMode(int /*newmode*/);
-
-extern _X_EXPORT void register_fpe_functions(void);
-
-/*
- * libXfont stubs.
- */
-extern _X_EXPORT int client_auth_generation(ClientPtr client);
-
-extern _X_EXPORT void DeleteFontClientID(Font id);
-
-extern _X_EXPORT FontResolutionPtr GetClientResolutions(int *num);
-
-extern _X_EXPORT int GetDefaultPointSize(void);
-
-extern _X_EXPORT Font GetNewFontClientID(void);
-
-extern _X_EXPORT int init_fs_handlers(FontPathElementPtr fpe,
- BlockHandlerProcPtr block_handler);
-
-extern _X_EXPORT int RegisterFPEFunctions(NameCheckFunc name_func,
- InitFpeFunc init_func,
- FreeFpeFunc free_func,
- ResetFpeFunc reset_func,
- OpenFontFunc open_func,
- CloseFontFunc close_func,
- ListFontsFunc list_func,
- StartLfwiFunc start_lfwi_func,
- NextLfwiFunc next_lfwi_func,
- WakeupFpeFunc wakeup_func,
- ClientDiedFunc client_died,
- LoadGlyphsFunc load_glyphs,
- StartLaFunc start_list_alias_func,
- NextLaFunc next_list_alias_func,
- SetPathFunc set_path_func);
-
-extern _X_EXPORT void remove_fs_handlers(FontPathElementPtr fpe,
- BlockHandlerProcPtr blockHandler,
- Bool all);
-
-extern _X_EXPORT int StoreFontClientFont(FontPtr pfont, Font id);
-
-#endif /* DIXFONT_H */
+/***********************************************************
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef DIXFONT_H
+#define DIXFONT_H 1
+
+#include "dix.h"
+#include <X11/fonts/font.h>
+#include "closure.h"
+#include <X11/fonts/fontstruct.h>
+
+#define NullDIXFontProp ((DIXFontPropPtr)0)
+
+typedef struct _DIXFontProp *DIXFontPropPtr;
+
+extern _X_EXPORT Bool SetDefaultFont(char * /*defaultfontname */ );
+
+extern _X_EXPORT void QueueFontWakeup(FontPathElementPtr /*fpe */ );
+
+extern _X_EXPORT void RemoveFontWakeup(FontPathElementPtr /*fpe */ );
+
+extern _X_EXPORT void FontWakeup(pointer /*data */ ,
+ int /*count */ ,
+ pointer /*LastSelectMask */ );
+
+extern _X_EXPORT int OpenFont(ClientPtr /*client */ ,
+ XID /*fid */ ,
+ Mask /*flags */ ,
+ unsigned /*lenfname */ ,
+ char * /*pfontname */ );
+
+extern _X_EXPORT int CloseFont(pointer /*pfont */ ,
+ XID /*fid */ );
+
+typedef struct _xQueryFontReply *xQueryFontReplyPtr;
+
+extern _X_EXPORT void QueryFont(FontPtr /*pFont */ ,
+ xQueryFontReplyPtr /*pReply */ ,
+ int /*nProtoCCIStructs */ );
+
+extern _X_EXPORT int ListFonts(ClientPtr /*client */ ,
+ unsigned char * /*pattern */ ,
+ unsigned int /*length */ ,
+ unsigned int /*max_names */ );
+
+extern _X_EXPORT int
+ doListFontsWithInfo(ClientPtr /*client */ ,
+ LFWIclosurePtr /*c */ );
+
+extern _X_EXPORT int doPolyText(ClientPtr /*client */ ,
+ PTclosurePtr /*c */
+ );
+
+extern _X_EXPORT int PolyText(ClientPtr /*client */ ,
+ DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ unsigned char * /*pElt */ ,
+ unsigned char * /*endReq */ ,
+ int /*xorg */ ,
+ int /*yorg */ ,
+ int /*reqType */ ,
+ XID /*did */ );
+
+extern _X_EXPORT int doImageText(ClientPtr /*client */ ,
+ ITclosurePtr /*c */ );
+
+extern _X_EXPORT int ImageText(ClientPtr /*client */ ,
+ DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*nChars */ ,
+ unsigned char * /*data */ ,
+ int /*xorg */ ,
+ int /*yorg */ ,
+ int /*reqType */ ,
+ XID /*did */ );
+
+extern _X_EXPORT int SetFontPath(ClientPtr /*client */ ,
+ int /*npaths */ ,
+ unsigned char * /*paths */ );
+
+extern _X_EXPORT int SetDefaultFontPath(char * /*path */ );
+
+extern _X_EXPORT int GetFontPath(ClientPtr client,
+ int *count,
+ int *length, unsigned char **result);
+
+extern _X_EXPORT void DeleteClientFontStuff(ClientPtr /*client */ );
+
+/* Quartz support on Mac OS X pulls in the QuickDraw
+ framework whose InitFonts function conflicts here. */
+#ifdef __APPLE__
+#define InitFonts Darwin_X_InitFonts
+#endif
+extern _X_EXPORT void InitFonts(void);
+
+extern _X_EXPORT void FreeFonts(void);
+
+extern _X_EXPORT FontPtr find_old_font(XID /*id */ );
+
+extern _X_EXPORT void GetGlyphs(FontPtr /*font */ ,
+ unsigned long /*count */ ,
+ unsigned char * /*chars */ ,
+ FontEncoding /*fontEncoding */ ,
+ unsigned long * /*glyphcount */ ,
+ CharInfoPtr * /*glyphs */ );
+
+extern _X_EXPORT void QueryGlyphExtents(FontPtr /*pFont */ ,
+ CharInfoPtr * /*charinfo */ ,
+ unsigned long /*count */ ,
+ ExtentInfoPtr /*info */ );
+
+extern _X_EXPORT Bool QueryTextExtents(FontPtr /*pFont */ ,
+ unsigned long /*count */ ,
+ unsigned char * /*chars */ ,
+ ExtentInfoPtr /*info */ );
+
+extern _X_EXPORT Bool ParseGlyphCachingMode(char * /*str */ );
+
+extern _X_EXPORT void InitGlyphCaching(void);
+
+extern _X_EXPORT void SetGlyphCachingMode(int /*newmode */ );
+
+extern _X_EXPORT void register_fpe_functions(void);
+
+/*
+ * libXfont stubs.
+ */
+extern _X_EXPORT int client_auth_generation(ClientPtr client);
+
+extern _X_EXPORT void DeleteFontClientID(Font id);
+
+extern _X_EXPORT FontResolutionPtr GetClientResolutions(int *num);
+
+extern _X_EXPORT int GetDefaultPointSize(void);
+
+extern _X_EXPORT Font GetNewFontClientID(void);
+
+extern _X_EXPORT int init_fs_handlers(FontPathElementPtr fpe,
+ BlockHandlerProcPtr block_handler);
+
+extern _X_EXPORT int RegisterFPEFunctions(NameCheckFunc name_func,
+ InitFpeFunc init_func,
+ FreeFpeFunc free_func,
+ ResetFpeFunc reset_func,
+ OpenFontFunc open_func,
+ CloseFontFunc close_func,
+ ListFontsFunc list_func,
+ StartLfwiFunc start_lfwi_func,
+ NextLfwiFunc next_lfwi_func,
+ WakeupFpeFunc wakeup_func,
+ ClientDiedFunc client_died,
+ LoadGlyphsFunc load_glyphs,
+ StartLaFunc start_list_alias_func,
+ NextLaFunc next_list_alias_func,
+ SetPathFunc set_path_func);
+
+extern _X_EXPORT void remove_fs_handlers(FontPathElementPtr fpe,
+ BlockHandlerProcPtr blockHandler,
+ Bool all);
+
+extern _X_EXPORT int StoreFontClientFont(FontPtr pfont, Font id);
+
+#endif /* DIXFONT_H */
diff --git a/xorg-server/include/dixgrabs.h b/xorg-server/include/dixgrabs.h
index 4dd5eae6d..eccec77f8 100644
--- a/xorg-server/include/dixgrabs.h
+++ b/xorg-server/include/dixgrabs.h
@@ -35,35 +35,30 @@ extern GrabPtr AllocGrab(void);
extern void FreeGrab(GrabPtr grab);
extern Bool CopyGrab(GrabPtr dst, const GrabPtr src);
-extern GrabPtr CreateGrab(
- int /* client */,
- DeviceIntPtr /* device */,
- DeviceIntPtr /* modDevice */,
- WindowPtr /* window */,
- enum InputLevel /* grabtype */,
- GrabMask * /* mask */,
- struct _GrabParameters * /* param */,
- int /* type */,
- KeyCode /* keybut */,
- WindowPtr /* confineTo */,
- CursorPtr /* cursor */);
+extern GrabPtr CreateGrab(int /* client */ ,
+ DeviceIntPtr /* device */ ,
+ DeviceIntPtr /* modDevice */ ,
+ WindowPtr /* window */ ,
+ enum InputLevel /* grabtype */ ,
+ GrabMask * /* mask */ ,
+ struct _GrabParameters * /* param */ ,
+ int /* type */ ,
+ KeyCode /* keybut */ ,
+ WindowPtr /* confineTo */ ,
+ CursorPtr /* cursor */ );
-extern _X_EXPORT int DeletePassiveGrab(
- pointer /* value */,
- XID /* id */);
+extern _X_EXPORT int DeletePassiveGrab(pointer /* value */ ,
+ XID /* id */ );
-extern _X_EXPORT Bool GrabMatchesSecond(
- GrabPtr /* pFirstGrab */,
- GrabPtr /* pSecondGrab */,
- Bool /*ignoreDevice*/);
+extern _X_EXPORT Bool GrabMatchesSecond(GrabPtr /* pFirstGrab */ ,
+ GrabPtr /* pSecondGrab */ ,
+ Bool /*ignoreDevice */ );
-extern _X_EXPORT int AddPassiveGrabToList(
- ClientPtr /* client */,
- GrabPtr /* pGrab */);
+extern _X_EXPORT int AddPassiveGrabToList(ClientPtr /* client */ ,
+ GrabPtr /* pGrab */ );
-extern _X_EXPORT Bool DeletePassiveGrabFromList(
- GrabPtr /* pMinuendGrab */);
+extern _X_EXPORT Bool DeletePassiveGrabFromList(GrabPtr /* pMinuendGrab */ );
extern Bool GrabIsPointerGrab(GrabPtr grab);
extern Bool GrabIsKeyboardGrab(GrabPtr grab);
-#endif /* DIXGRABS_H */
+#endif /* DIXGRABS_H */
diff --git a/xorg-server/include/dixstruct.h b/xorg-server/include/dixstruct.h
index 130549cdf..5286f1691 100644
--- a/xorg-server/include/dixstruct.h
+++ b/xorg-server/include/dixstruct.h
@@ -41,33 +41,32 @@ SOFTWARE.
extern _X_EXPORT CallbackListPtr ClientStateCallback;
typedef struct {
- ClientPtr client;
- xConnSetupPrefix *prefix;
- xConnSetup *setup;
+ ClientPtr client;
+ xConnSetupPrefix *prefix;
+ xConnSetup *setup;
} NewClientInfoRec;
-typedef void (*ReplySwapPtr) (
- ClientPtr /* pClient */,
- int /* size */,
- void * /* pbuf */);
-
-extern _X_EXPORT void ReplyNotSwappd (
- ClientPtr /* pClient */,
- int /* size */,
- void * /* pbuf */) _X_NORETURN;
-
-typedef enum {ClientStateInitial,
- /* 1 is unused now, was ClientStateAuthenticating */
- ClientStateRunning = 2,
- ClientStateRetained,
- ClientStateGone
+typedef void (*ReplySwapPtr) (ClientPtr /* pClient */ ,
+ int /* size */ ,
+ void * /* pbuf */ );
+
+extern _X_EXPORT void
+ReplyNotSwappd(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ void * /* pbuf */ ) _X_NORETURN;
+
+typedef enum { ClientStateInitial,
+ /* 1 is unused now, was ClientStateAuthenticating */
+ ClientStateRunning = 2,
+ ClientStateRetained,
+ ClientStateGone
} ClientState;
#ifdef XFIXES
typedef struct _saveSet {
- struct _Window *windowPtr;
- Bool toRoot;
- Bool map;
+ struct _Window *windowPtr;
+ Bool toRoot;
+ Bool map;
} SaveSetElt;
#define SaveSetWindow(ss) ((ss).windowPtr)
#define SaveSetToRoot(ss) ((ss).toRoot)
@@ -77,6 +76,7 @@ typedef struct _saveSet {
#define SaveSetAssignMap(ss,m) ((ss).map = (m))
#else
typedef struct _Window *SaveSetElt;
+
#define SaveSetWindow(ss) (ss)
#define SaveSetToRoot(ss) FALSE
#define SaveSetShouldMap(ss) TRUE
@@ -86,44 +86,43 @@ typedef struct _Window *SaveSetElt;
#endif
typedef struct _Client {
- int index;
- Mask clientAsMask;
- pointer requestBuffer;
- pointer osPrivate; /* for OS layer, including scheduler */
- Bool swapped;
+ int index;
+ Mask clientAsMask;
+ pointer requestBuffer;
+ pointer osPrivate; /* for OS layer, including scheduler */
+ Bool swapped;
ReplySwapPtr pSwapReplyFunc;
- XID errorValue;
+ XID errorValue;
unsigned short sequence; //MH
- int closeDownMode;
- int clientGone;
- int noClientException; /* this client died or needs to be
- * killed */
- int ignoreCount; /* count for Attend/IgnoreClient */
- SaveSetElt *saveSet;
- int numSaved;
- int (**requestVector) (
- ClientPtr /* pClient */);
- CARD32 req_len; /* length of current request */
- Bool big_requests; /* supports large requests */
- int priority;
+ int closeDownMode;
+ int clientGone;
+ int noClientException; /* this client died or needs to be
+ * killed */
+ int ignoreCount; /* count for Attend/IgnoreClient */
+ SaveSetElt *saveSet;
+ int numSaved;
+ int (**requestVector) (ClientPtr /* pClient */ );
+ CARD32 req_len; /* length of current request */
+ Bool big_requests; /* supports large requests */
+ int priority;
ClientState clientState;
- PrivateRec *devPrivates;
- unsigned short xkbClientFlags;
- unsigned short mapNotifyMask;
- unsigned short newKeyboardNotifyMask;
- unsigned short vMajor,vMinor;
- KeyCode minKC,maxKC;
+ PrivateRec *devPrivates;
+ unsigned short xkbClientFlags;
+ unsigned short mapNotifyMask;
+ unsigned short newKeyboardNotifyMask;
+ unsigned short vMajor, vMinor;
+ KeyCode minKC, maxKC;
unsigned long replyBytesRemaining;
- int smart_priority;
- long smart_start_tick;
- long smart_stop_tick;
- long smart_check_tick;
-
+ int smart_priority;
+ long smart_start_tick;
+ long smart_stop_tick;
+ long smart_check_tick;
+
DeviceIntPtr clientPtr;
- ClientIdPtr clientIds;
+ ClientIdPtr clientIds;
unsigned short majorOp, minorOp;
-} ClientRec;
+} ClientRec;
/*
* Scheduling interface
@@ -133,60 +132,64 @@ extern _X_EXPORT long SmartScheduleInterval;
extern _X_EXPORT long SmartScheduleSlice;
extern _X_EXPORT long SmartScheduleMaxSlice;
extern _X_EXPORT Bool SmartScheduleDisable;
-extern _X_EXPORT void SmartScheduleStartTimer(void);
-extern _X_EXPORT void SmartScheduleStopTimer(void);
+extern _X_EXPORT void
+SmartScheduleStartTimer(void);
+extern _X_EXPORT void
+SmartScheduleStopTimer(void);
+
#define SMART_MAX_PRIORITY (20)
#define SMART_MIN_PRIORITY (-20)
-extern _X_EXPORT void SmartScheduleInit(void);
-
+extern _X_EXPORT void
+SmartScheduleInit(void);
/* This prototype is used pervasively in Xext, dix */
#define DISPATCH_PROC(func) int func(ClientPtr /* client */)
typedef struct _WorkQueue {
struct _WorkQueue *next;
- Bool (*function) (
- ClientPtr /* pClient */,
- pointer /* closure */
-);
- ClientPtr client;
- pointer closure;
-} WorkQueueRec;
+ Bool (*function) (ClientPtr /* pClient */ ,
+ pointer /* closure */
+ );
+ ClientPtr client;
+ pointer closure;
+} WorkQueueRec;
extern _X_EXPORT TimeStamp currentTime;
-extern _X_EXPORT TimeStamp lastDeviceEventTime;
+extern _X_EXPORT TimeStamp lastDeviceEventTime[MAXDEVICES];
-extern _X_EXPORT int CompareTimeStamps(
- TimeStamp /*a*/,
- TimeStamp /*b*/);
+extern _X_EXPORT int
+CompareTimeStamps(TimeStamp /*a */ ,
+ TimeStamp /*b */ );
-extern _X_EXPORT TimeStamp ClientTimeToServerTime(CARD32 /*c*/);
+extern _X_EXPORT TimeStamp
+ClientTimeToServerTime(CARD32 /*c */ );
typedef struct _CallbackRec {
- CallbackProcPtr proc;
- pointer data;
- Bool deleted;
- struct _CallbackRec *next;
+ CallbackProcPtr proc;
+ pointer data;
+ Bool deleted;
+ struct _CallbackRec *next;
} CallbackRec, *CallbackPtr;
typedef struct _CallbackList {
- int inCallback;
- Bool deleted;
- int numDeleted;
- CallbackPtr list;
+ int inCallback;
+ Bool deleted;
+ int numDeleted;
+ CallbackPtr list;
} CallbackListRec;
/* proc vectors */
-extern _X_EXPORT int (* InitialVector[3]) (ClientPtr /*client*/);
+extern _X_EXPORT int (*InitialVector[3]) (ClientPtr /*client */ );
-extern _X_EXPORT int (* ProcVector[256]) (ClientPtr /*client*/);
+extern _X_EXPORT int (*ProcVector[256]) (ClientPtr /*client */ );
-extern _X_EXPORT int (* SwappedProcVector[256]) (ClientPtr /*client*/);
+extern _X_EXPORT int (*SwappedProcVector[256]) (ClientPtr /*client */ );
extern _X_EXPORT ReplySwapPtr ReplySwapVector[256];
-extern _X_EXPORT int ProcBadRequest(ClientPtr /*client*/);
+extern _X_EXPORT int
+ProcBadRequest(ClientPtr /*client */ );
-#endif /* DIXSTRUCT_H */
+#endif /* DIXSTRUCT_H */
diff --git a/xorg-server/include/eventstr.h b/xorg-server/include/eventstr.h
index e4410a79f..dd6fbeffb 100644
--- a/xorg-server/include/eventstr.h
+++ b/xorg-server/include/eventstr.h
@@ -72,7 +72,7 @@ enum EventType {
ET_RawTouchUpdate,
ET_RawTouchEnd,
ET_XQuartz,
- ET_Internal = 0xFF /* First byte */
+ ET_Internal = 0xFF /* First byte */
};
/**
@@ -82,8 +82,7 @@ enum EventType {
* Note: We only use the device id because the DeviceIntPtr may become invalid while
* the event is in the EQ.
*/
-struct _DeviceEvent
-{
+struct _DeviceEvent {
unsigned char header; /**< Always ET_Internal */
enum EventType type; /**< One of EventType */
int length; /**< Length in bytes */
@@ -100,11 +99,11 @@ struct _DeviceEvent
float root_x_frac; /**< Pos relative to root window in frac part */
int16_t root_y; /**< Pos relative to root window in integral part */
float root_y_frac; /**< Pos relative to root window in frac part */
- uint8_t buttons[(MAX_BUTTONS + 7)/8]; /**< Button mask */
+ uint8_t buttons[(MAX_BUTTONS + 7) / 8]; /**< Button mask */
struct {
- uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
- uint8_t mode[(MAX_VALUATORS + 7)/8]; /**< Valuator mode (Abs or Rel)*/
- double data[MAX_VALUATORS]; /**< Valuator data */
+ uint8_t mask[(MAX_VALUATORS + 7) / 8];/**< Valuator mask */
+ uint8_t mode[(MAX_VALUATORS + 7) / 8];/**< Valuator mode (Abs or Rel)*/
+ double data[MAX_VALUATORS]; /**< Valuator data */
} valuators;
struct {
uint32_t base; /**< XKB base modifiers */
@@ -118,7 +117,7 @@ struct _DeviceEvent
uint8_t locked; /**< XKB locked group */
uint8_t effective;/**< XKB effective group */
} group;
- Window root; /**< Root window of the event */
+ Window root; /**< Root window of the event */
int corestate; /**< Core key/button state BEFORE the event */
int key_repeat; /**< Internally-generated key repeat event */
uint32_t flags; /**< Flags to be copied into the generated event */
@@ -129,8 +128,7 @@ struct _DeviceEvent
* has accepted or rejected a touch, or a grab/event selection in the delivery
* chain has been removed.
*/
-struct _TouchOwnershipEvent
-{
+struct _TouchOwnershipEvent {
unsigned char header; /**< Always ET_Internal */
enum EventType type; /**< One of EventType */
int length; /**< Length in bytes */
@@ -155,8 +153,7 @@ struct _TouchOwnershipEvent
/**
* Sent whenever a device's capabilities have changed.
*/
-struct _DeviceChangedEvent
-{
+struct _DeviceChangedEvent {
unsigned char header; /**< Always ET_Internal */
enum EventType type; /**< ET_DeviceChanged */
int length; /**< Length in bytes */
@@ -193,8 +190,7 @@ struct _DeviceChangedEvent
/**
* DGAEvent, used by DGA to intercept and emulate input events.
*/
-struct _DGAEvent
-{
+struct _DGAEvent {
unsigned char header; /**< Always ET_Internal */
enum EventType type; /**< ET_DGAEvent */
int length; /**< Length in bytes */
@@ -212,8 +208,7 @@ struct _DGAEvent
/**
* Raw event, contains the data as posted by the device.
*/
-struct _RawDeviceEvent
-{
+struct _RawDeviceEvent {
unsigned char header; /**< Always ET_Internal */
enum EventType type; /**< ET_Raw */
int length; /**< Length in bytes */
@@ -225,9 +220,9 @@ struct _RawDeviceEvent
uint32_t key; /**< Key code */
} detail;
struct {
- uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
- double data[MAX_VALUATORS]; /**< Valuator data */
- double data_raw[MAX_VALUATORS]; /**< Valuator data as posted */
+ uint8_t mask[(MAX_VALUATORS + 7) / 8];/**< Valuator mask */
+ double data[MAX_VALUATORS]; /**< Valuator data */
+ double data_raw[MAX_VALUATORS]; /**< Valuator data as posted */
} valuators;
uint32_t flags; /**< Flags to be copied into the generated event */
};
@@ -249,21 +244,21 @@ struct _XQuartzEvent {
* processing.
*/
union _InternalEvent {
- struct {
- unsigned char header; /**< Always ET_Internal */
- enum EventType type; /**< One of ET_* */
- int length; /**< Length in bytes */
- Time time; /**< Time in ms. */
- } any;
- DeviceEvent device_event;
- DeviceChangedEvent changed_event;
- TouchOwnershipEvent touch_ownership_event;
+ struct {
+ unsigned char header; /**< Always ET_Internal */
+ enum EventType type; /**< One of ET_* */
+ int length; /**< Length in bytes */
+ Time time; /**< Time in ms. */
+ } any;
+ DeviceEvent device_event;
+ DeviceChangedEvent changed_event;
+ TouchOwnershipEvent touch_ownership_event;
#if XFreeXDGA
- DGAEvent dga_event;
+ DGAEvent dga_event;
#endif
- RawDeviceEvent raw_event;
+ RawDeviceEvent raw_event;
#ifdef XQUARTZ
- XQuartzEvent xquartz_event;
+ XQuartzEvent xquartz_event;
#endif
};
diff --git a/xorg-server/include/exevents.h b/xorg-server/include/exevents.h
index fb2ef274c..feea170d2 100644
--- a/xorg-server/include/exevents.h
+++ b/xorg-server/include/exevents.h
@@ -41,313 +41,274 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* Scroll flags for ::SetScrollValuator.
*/
enum ScrollFlags {
- SCROLL_FLAG_NONE = 0,
+ SCROLL_FLAG_NONE = 0,
/**
* Do not emulate legacy button events for valuator events on this axis.
*/
- SCROLL_FLAG_DONT_EMULATE = (1 << 1),
+ SCROLL_FLAG_DONT_EMULATE = (1 << 1),
/**
* This axis is the preferred axis for valuator emulation for this axis'
* scroll type.
*/
- SCROLL_FLAG_PREFERRED = (1 << 2)
+ SCROLL_FLAG_PREFERRED = (1 << 2)
};
-extern _X_EXPORT int InitProximityClassDeviceStruct(
- DeviceIntPtr /* dev */);
-
-extern _X_EXPORT Bool InitValuatorAxisStruct(
- DeviceIntPtr /* dev */,
- int /* axnum */,
- Atom /* label */,
- int /* minval */,
- int /* maxval */,
- int /* resolution */,
- int /* min_res */,
- int /* max_res */,
- int /* mode */);
-
-extern _X_EXPORT Bool SetScrollValuator(
- DeviceIntPtr /* dev */,
- int /* axnum */,
- enum ScrollType /* type */,
- double /* increment */,
- int /* flags */);
+extern _X_EXPORT int InitProximityClassDeviceStruct(DeviceIntPtr /* dev */ );
+
+extern _X_EXPORT Bool InitValuatorAxisStruct(DeviceIntPtr /* dev */ ,
+ int /* axnum */ ,
+ Atom /* label */ ,
+ int /* minval */ ,
+ int /* maxval */ ,
+ int /* resolution */ ,
+ int /* min_res */ ,
+ int /* max_res */ ,
+ int /* mode */ );
+
+extern _X_EXPORT Bool SetScrollValuator(DeviceIntPtr /* dev */ ,
+ int /* axnum */ ,
+ enum ScrollType /* type */ ,
+ double /* increment */ ,
+ int /* flags */ );
/* Input device properties */
-extern _X_EXPORT void XIDeleteAllDeviceProperties(
- DeviceIntPtr /* device */
-);
-
-extern _X_EXPORT int XIDeleteDeviceProperty(
- DeviceIntPtr /* device */,
- Atom /* property */,
- Bool /* fromClient */
-);
-
-extern _X_EXPORT int XIChangeDeviceProperty(
- DeviceIntPtr /* dev */,
- Atom /* property */,
- Atom /* type */,
- int /* format*/,
- int /* mode*/,
- unsigned long /* len*/,
- const void* /* value*/,
- Bool /* sendevent*/
- );
-
-extern _X_EXPORT int XIGetDeviceProperty(
- DeviceIntPtr /* dev */,
- Atom /* property */,
- XIPropertyValuePtr* /* value */
-);
-
-extern _X_EXPORT int XISetDevicePropertyDeletable(
- DeviceIntPtr /* dev */,
- Atom /* property */,
- Bool /* deletable */
-);
-
-extern _X_EXPORT long XIRegisterPropertyHandler(
- DeviceIntPtr dev,
- int (*SetProperty) (DeviceIntPtr dev,
- Atom property,
- XIPropertyValuePtr prop,
- BOOL checkonly),
- int (*GetProperty) (DeviceIntPtr dev,
- Atom property),
- int (*DeleteProperty) (DeviceIntPtr dev,
- Atom property)
-);
-
-extern _X_EXPORT void XIUnregisterPropertyHandler(
- DeviceIntPtr dev,
- long id
-);
-
-extern _X_EXPORT Atom XIGetKnownProperty(
- const char* name
-);
+extern _X_EXPORT void XIDeleteAllDeviceProperties(DeviceIntPtr /* device */
+ );
+
+extern _X_EXPORT int XIDeleteDeviceProperty(DeviceIntPtr /* device */ ,
+ Atom /* property */ ,
+ Bool /* fromClient */
+ );
+
+extern _X_EXPORT int XIChangeDeviceProperty(DeviceIntPtr /* dev */ ,
+ Atom /* property */ ,
+ Atom /* type */ ,
+ int /* format */ ,
+ int /* mode */ ,
+ unsigned long /* len */ ,
+ const void * /* value */ ,
+ Bool /* sendevent */
+ );
+
+extern _X_EXPORT int XIGetDeviceProperty(DeviceIntPtr /* dev */ ,
+ Atom /* property */ ,
+ XIPropertyValuePtr * /* value */
+ );
+
+extern _X_EXPORT int XISetDevicePropertyDeletable(DeviceIntPtr /* dev */ ,
+ Atom /* property */ ,
+ Bool /* deletable */
+ );
+
+extern _X_EXPORT long XIRegisterPropertyHandler(DeviceIntPtr dev,
+ int (*SetProperty) (DeviceIntPtr
+ dev,
+ Atom
+ property,
+ XIPropertyValuePtr
+ prop,
+ BOOL
+ checkonly),
+ int (*GetProperty) (DeviceIntPtr
+ dev,
+ Atom
+ property),
+ int (*DeleteProperty)
+ (DeviceIntPtr dev,
+ Atom property)
+ );
+
+extern _X_EXPORT void XIUnregisterPropertyHandler(DeviceIntPtr dev, long id);
+
+extern _X_EXPORT Atom XIGetKnownProperty(const char *name);
extern _X_EXPORT DeviceIntPtr XIGetDevice(xEvent *ev);
-extern _X_EXPORT int XIPropToInt(
- XIPropertyValuePtr val,
- int *nelem_return,
- int **buf_return
-);
+extern _X_EXPORT int XIPropToInt(XIPropertyValuePtr val,
+ int *nelem_return, int **buf_return);
-extern _X_EXPORT int XIPropToFloat(
- XIPropertyValuePtr val,
- int *nelem_return,
- float **buf_return
-);
+extern _X_EXPORT int XIPropToFloat(XIPropertyValuePtr val,
+ int *nelem_return, float **buf_return);
/****************************************************************************
* End of driver interface *
****************************************************************************/
-
/**
* Attached to the devPrivates of each client. Specifies the version number as
* supported by the client.
*/
typedef struct _XIClientRec {
- int major_version;
- int minor_version;
+ int major_version;
+ int minor_version;
} XIClientRec, *XIClientPtr;
-
typedef struct _GrabParameters {
- int grabtype; /* CORE, etc. */
- unsigned int ownerEvents;
- unsigned int this_device_mode;
- unsigned int other_devices_mode;
- Window grabWindow;
- Window confineTo;
- Cursor cursor;
- unsigned int modifiers;
+ int grabtype; /* CORE, etc. */
+ unsigned int ownerEvents;
+ unsigned int this_device_mode;
+ unsigned int other_devices_mode;
+ Window grabWindow;
+ Window confineTo;
+ Cursor cursor;
+ unsigned int modifiers;
} GrabParameters;
-
extern int
-UpdateDeviceState (
- DeviceIntPtr /* device */,
- DeviceEvent* /* xE */);
+ UpdateDeviceState(DeviceIntPtr /* device */ ,
+ DeviceEvent * /* xE */ );
extern void
-ProcessOtherEvent (
- InternalEvent* /* ev */,
- DeviceIntPtr /* other */);
+ ProcessOtherEvent(InternalEvent * /* ev */ ,
+ DeviceIntPtr /* other */ );
extern void
-DeviceFocusEvent(
- DeviceIntPtr /* dev */,
- int /* type */,
- int /* mode */,
- int /* detail */,
- WindowPtr /* pWin */);
+ DeviceFocusEvent(DeviceIntPtr /* dev */ ,
+ int /* type */ ,
+ int /* mode */ ,
+ int /* detail */ ,
+ WindowPtr /* pWin */ );
extern int
-CheckGrabValues(
- ClientPtr /* client */,
- GrabParameters* /* param */);
+ CheckGrabValues(ClientPtr /* client */ ,
+ GrabParameters * /* param */ );
extern int
-GrabButton(
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- DeviceIntPtr /* modifier_device */,
- int /* button */,
- GrabParameters* /* param */,
- enum InputLevel /* grabtype */,
- GrabMask* /* eventMask */);
+ GrabButton(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ DeviceIntPtr /* modifier_device */ ,
+ int /* button */ ,
+ GrabParameters * /* param */ ,
+ enum InputLevel /* grabtype */ ,
+ GrabMask * /* eventMask */ );
extern int
-GrabKey(
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- DeviceIntPtr /* modifier_device */,
- int /* key */,
- GrabParameters* /* param */,
- enum InputLevel /* grabtype */,
- GrabMask* /* eventMask */);
+ GrabKey(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ DeviceIntPtr /* modifier_device */ ,
+ int /* key */ ,
+ GrabParameters * /* param */ ,
+ enum InputLevel /* grabtype */ ,
+ GrabMask * /* eventMask */ );
extern int
-GrabWindow(
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- int /* type */,
- GrabParameters* /* param */,
- GrabMask* /* eventMask */);
+ GrabWindow(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ int /* type */ ,
+ GrabParameters * /* param */ ,
+ GrabMask * /* eventMask */ );
extern int
-GrabTouch(
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- DeviceIntPtr /* mod_dev */,
- GrabParameters* /* param */,
- GrabMask* /* eventMask */);
+ GrabTouch(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ DeviceIntPtr /* mod_dev */ ,
+ GrabParameters * /* param */ ,
+ GrabMask * /* eventMask */ );
extern int
-SelectForWindow(
- DeviceIntPtr /* dev */,
- WindowPtr /* pWin */,
- ClientPtr /* client */,
- Mask /* mask */,
- Mask /* exclusivemasks */);
+ SelectForWindow(DeviceIntPtr /* dev */ ,
+ WindowPtr /* pWin */ ,
+ ClientPtr /* client */ ,
+ Mask /* mask */ ,
+ Mask /* exclusivemasks */ );
extern int
-AddExtensionClient (
- WindowPtr /* pWin */,
- ClientPtr /* client */,
- Mask /* mask */,
- int /* mskidx */);
+ AddExtensionClient(WindowPtr /* pWin */ ,
+ ClientPtr /* client */ ,
+ Mask /* mask */ ,
+ int /* mskidx */ );
extern void
-RecalculateDeviceDeliverableEvents(
- WindowPtr /* pWin */);
+ RecalculateDeviceDeliverableEvents(WindowPtr /* pWin */ );
extern int
-InputClientGone(
- WindowPtr /* pWin */,
- XID /* id */);
+ InputClientGone(WindowPtr /* pWin */ ,
+ XID /* id */ );
extern void
-WindowGone(
- WindowPtr /* win */);
+ WindowGone(WindowPtr /* win */ );
extern int
-SendEvent (
- ClientPtr /* client */,
- DeviceIntPtr /* d */,
- Window /* dest */,
- Bool /* propagate */,
- xEvent * /* ev */,
- Mask /* mask */,
- int /* count */);
+ SendEvent(ClientPtr /* client */ ,
+ DeviceIntPtr /* d */ ,
+ Window /* dest */ ,
+ Bool /* propagate */ ,
+ xEvent * /* ev */ ,
+ Mask /* mask */ ,
+ int /* count */ );
extern int
-SetButtonMapping (
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- int /* nElts */,
- BYTE * /* map */);
+ SetButtonMapping(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ int /* nElts */ ,
+ BYTE * /* map */ );
extern int
-ChangeKeyMapping(
- ClientPtr /* client */,
- DeviceIntPtr /* dev */,
- unsigned /* len */,
- int /* type */,
- KeyCode /* firstKeyCode */,
- CARD8 /* keyCodes */,
- CARD8 /* keySymsPerKeyCode */,
- KeySym * /* map */);
+ ChangeKeyMapping(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ unsigned /* len */ ,
+ int /* type */ ,
+ KeyCode /* firstKeyCode */ ,
+ CARD8 /* keyCodes */ ,
+ CARD8 /* keySymsPerKeyCode */ ,
+ KeySym * /* map */ );
extern void
-DeleteWindowFromAnyExtEvents(
- WindowPtr /* pWin */,
- Bool /* freeResources */);
+ DeleteWindowFromAnyExtEvents(WindowPtr /* pWin */ ,
+ Bool /* freeResources */ );
extern int
-MaybeSendDeviceMotionNotifyHint (
- deviceKeyButtonPointer * /* pEvents */,
- Mask /* mask */);
+ MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * /* pEvents */ ,
+ Mask /* mask */ );
extern void
-CheckDeviceGrabAndHintWindow (
- WindowPtr /* pWin */,
- int /* type */,
- deviceKeyButtonPointer * /* xE */,
- GrabPtr /* grab */,
- ClientPtr /* client */,
- Mask /* deliveryMask */);
+ CheckDeviceGrabAndHintWindow(WindowPtr /* pWin */ ,
+ int /* type */ ,
+ deviceKeyButtonPointer * /* xE */ ,
+ GrabPtr /* grab */ ,
+ ClientPtr /* client */ ,
+ Mask /* deliveryMask */ );
extern void
-MaybeStopDeviceHint(
- DeviceIntPtr /* dev */,
- ClientPtr /* client */);
+ MaybeStopDeviceHint(DeviceIntPtr /* dev */ ,
+ ClientPtr /* client */ );
extern int
-DeviceEventSuppressForWindow(
- WindowPtr /* pWin */,
- ClientPtr /* client */,
- Mask /* mask */,
- int /* maskndx */);
+ DeviceEventSuppressForWindow(WindowPtr /* pWin */ ,
+ ClientPtr /* client */ ,
+ Mask /* mask */ ,
+ int /* maskndx */ );
extern void
-SendEventToAllWindows(
- DeviceIntPtr /* dev */,
- Mask /* mask */,
- xEvent * /* ev */,
- int /* count */);
+ SendEventToAllWindows(DeviceIntPtr /* dev */ ,
+ Mask /* mask */ ,
+ xEvent * /* ev */ ,
+ int /* count */ );
extern void
-TouchRejected(
- DeviceIntPtr /* sourcedev */,
- TouchPointInfoPtr /* ti */,
- XID /* resource */,
- TouchOwnershipEvent * /* ev */);
+ TouchRejected(DeviceIntPtr /* sourcedev */ ,
+ TouchPointInfoPtr /* ti */ ,
+ XID /* resource */ ,
+ TouchOwnershipEvent * /* ev */ );
-extern _X_HIDDEN void XI2EventSwap(
- xGenericEvent * /* from */,
- xGenericEvent * /* to */);
+extern _X_HIDDEN void XI2EventSwap(xGenericEvent * /* from */ ,
+ xGenericEvent * /* to */ );
/* For an event such as MappingNotify which affects client interpretation
* of input events sent by device dev, should we notify the client, or
* would it merely be irrelevant and confusing? */
extern int
-XIShouldNotify(ClientPtr client, DeviceIntPtr dev);
+ XIShouldNotify(ClientPtr client, DeviceIntPtr dev);
extern void
-XISendDeviceChangedEvent(DeviceIntPtr device, DeviceChangedEvent *dce);
+ XISendDeviceChangedEvent(DeviceIntPtr device, DeviceChangedEvent *dce);
extern int
+
XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
- unsigned int len, unsigned char* mask);
+ unsigned int len, unsigned char *mask);
extern int
-XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len);
+ XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len);
-#endif /* EXEVENTS_H */
+#endif /* EXEVENTS_H */
diff --git a/xorg-server/include/extension.h b/xorg-server/include/extension.h
index 17accafd9..c7f51b9d1 100644
--- a/xorg-server/include/extension.h
+++ b/xorg-server/include/extension.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -46,20 +45,20 @@ SOFTWARE.
******************************************************************/
#ifndef EXTENSION_H
-#define EXTENSION_H
+#define EXTENSION_H
_XFUNCPROTOBEGIN
-extern _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr /*client*/);
+extern _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr /*client */ );
extern _X_EXPORT Bool EnableDisableExtension(const char *name, Bool enable);
-extern _X_EXPORT void EnableDisableExtensionError(const char *name, Bool enable);
+extern _X_EXPORT void EnableDisableExtensionError(const char *name,
+ Bool enable);
extern _X_EXPORT void InitExtensions(int argc, char **argv);
extern _X_EXPORT void CloseDownExtensions(void);
_XFUNCPROTOEND
-
-#endif /* EXTENSION_H */
+#endif /* EXTENSION_H */
diff --git a/xorg-server/include/extinit.h b/xorg-server/include/extinit.h
index 8e47beb48..a048b7254 100644
--- a/xorg-server/include/extinit.h
+++ b/xorg-server/include/extinit.h
@@ -33,15 +33,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "extnsionst.h"
extern void
-XInputExtensionInit(
- void
- );
+ XInputExtensionInit(void
+ );
extern _X_EXPORT void
-AssignTypeAndName (
- DeviceIntPtr /* dev */,
- Atom /* type */,
- const char * /* name */
- );
+ AssignTypeAndName(DeviceIntPtr /* dev */ ,
+ Atom /* type */ ,
+ const char * /* name */
+ );
-#endif /* EXTINIT_H */
+#endif /* EXTINIT_H */
diff --git a/xorg-server/include/extnsionst.h b/xorg-server/include/extnsionst.h
index aeefa9918..e82523698 100644
--- a/xorg-server/include/extnsionst.h
+++ b/xorg-server/include/extnsionst.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -46,7 +45,7 @@ SOFTWARE.
******************************************************************/
#ifndef EXTENSIONSTRUCT_H
-#define EXTENSIONSTRUCT_H
+#define EXTENSIONSTRUCT_H
#include "dix.h"
#include "misc.h"
@@ -57,19 +56,19 @@ SOFTWARE.
typedef struct _ExtensionEntry {
int index;
- void (* CloseDown)( /* called at server shutdown */
- struct _ExtensionEntry * /* extension */);
- char *name; /* extension name */
- int base; /* base request number */
- int eventBase;
+ void (*CloseDown) ( /* called at server shutdown */
+ struct _ExtensionEntry * /* extension */ );
+ char *name; /* extension name */
+ int base; /* base request number */
+ int eventBase;
int eventLast;
int errorBase;
int errorLast;
int num_aliases;
char **aliases;
pointer extPrivate;
- unsigned short (* MinorOpcode)( /* called for errors */
- ClientPtr /* client */);
+ unsigned short (*MinorOpcode) ( /* called for errors */
+ ClientPtr /* client */ );
PrivateRec *devPrivates;
} ExtensionEntry;
@@ -82,31 +81,32 @@ typedef void (*EventSwapPtr) (xEvent *, xEvent *);
extern _X_EXPORT EventSwapPtr EventSwapVector[128];
-extern _X_EXPORT void NotImplemented ( /* FIXME: this may move to another file... */
- xEvent *,
- xEvent *) _X_NORETURN;
+extern _X_EXPORT void
+NotImplemented( /* FIXME: this may move to another file... */
+ xEvent *, xEvent *) _X_NORETURN;
#define SetGCVector(pGC, VectorElement, NewRoutineAddress, Atom) \
pGC->VectorElement = NewRoutineAddress;
#define GetGCValue(pGC, GCElement) (pGC->GCElement)
-extern _X_EXPORT ExtensionEntry *AddExtension(
- const char* /*name*/,
- int /*NumEvents*/,
- int /*NumErrors*/,
- int (* /*MainProc*/)(ClientPtr /*client*/),
- int (* /*SwappedMainProc*/)(ClientPtr /*client*/),
- void (* /*CloseDownProc*/)(ExtensionEntry * /*extension*/),
- unsigned short (* /*MinorOpcodeProc*/)(ClientPtr /*client*/)
-);
-
-extern _X_EXPORT Bool AddExtensionAlias(
- const char* /*alias*/,
- ExtensionEntry * /*extension*/);
-
-extern _X_EXPORT ExtensionEntry *CheckExtension(const char *extname);
-extern _X_EXPORT ExtensionEntry *GetExtensionEntry(int major);
-
-#endif /* EXTENSIONSTRUCT_H */
-
+extern _X_EXPORT ExtensionEntry *
+AddExtension(const char * /*name */ ,
+ int /*NumEvents */ ,
+ int /*NumErrors */ ,
+ int (* /*MainProc */ )(ClientPtr /*client */ ),
+ int (* /*SwappedMainProc */ )(ClientPtr /*client */ ),
+ void (* /*CloseDownProc */ )(ExtensionEntry * /*extension */ ),
+ unsigned short (* /*MinorOpcodeProc */ )(ClientPtr /*client */ )
+ );
+
+extern _X_EXPORT Bool
+AddExtensionAlias(const char * /*alias */ ,
+ ExtensionEntry * /*extension */ );
+
+extern _X_EXPORT ExtensionEntry *
+CheckExtension(const char *extname);
+extern _X_EXPORT ExtensionEntry *
+GetExtensionEntry(int major);
+
+#endif /* EXTENSIONSTRUCT_H */
diff --git a/xorg-server/include/gc.h b/xorg-server/include/gc.h
index 89a74d8ba..6e5b92da2 100644
--- a/xorg-server/include/gc.h
+++ b/xorg-server/include/gc.h
@@ -1,163 +1,147 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifndef GC_H
-#define GC_H
-
-#include <X11/X.h> /* for GContext, Mask */
-#include <X11/Xdefs.h> /* for Bool */
-#include <X11/Xproto.h>
-#include "screenint.h" /* for ScreenPtr */
-#include "pixmap.h" /* for DrawablePtr */
-
-/* clientClipType field in GC */
-#define CT_NONE 0
-#define CT_PIXMAP 1
-#define CT_REGION 2
-#define CT_UNSORTED 6
-#define CT_YSORTED 10
-#define CT_YXSORTED 14
-#define CT_YXBANDED 18
-
-#define GCQREASON_VALIDATE 1
-#define GCQREASON_CHANGE 2
-#define GCQREASON_COPY_SRC 3
-#define GCQREASON_COPY_DST 4
-#define GCQREASON_DESTROY 5
-
-#define GC_CHANGE_SERIAL_BIT (((unsigned long)1)<<31)
-#define GC_CALL_VALIDATE_BIT (1L<<30)
-#define GCExtensionInterest (1L<<29)
-
-#define DRAWABLE_SERIAL_BITS (~(GC_CHANGE_SERIAL_BIT))
-
-#define MAX_SERIAL_NUM (1L<<28)
-
-#define NEXT_SERIAL_NUMBER ((++globalSerialNumber) > MAX_SERIAL_NUM ? \
- (globalSerialNumber = 1): globalSerialNumber)
-
-typedef struct _GCInterest *GCInterestPtr;
-typedef struct _GC *GCPtr;
-typedef struct _GCOps *GCOpsPtr;
-
-extern _X_EXPORT void ValidateGC(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/);
-
-typedef union {
- CARD32 val;
- pointer ptr;
-} ChangeGCVal, *ChangeGCValPtr;
-
-extern int ChangeGCXIDs(
- ClientPtr /*client*/,
- GCPtr /*pGC*/,
- BITS32 /*mask*/,
- CARD32 * /*pval*/);
-
-extern _X_EXPORT int ChangeGC(
- ClientPtr /*client*/,
- GCPtr /*pGC*/,
- BITS32 /*mask*/,
- ChangeGCValPtr /*pCGCV*/);
-
-extern _X_EXPORT GCPtr CreateGC(
- DrawablePtr /*pDrawable*/,
- BITS32 /*mask*/,
- XID* /*pval*/,
- int* /*pStatus*/,
- XID /*gcid*/,
- ClientPtr /*client*/);
-
-extern _X_EXPORT int CopyGC(
- GCPtr/*pgcSrc*/,
- GCPtr/*pgcDst*/,
- BITS32 /*mask*/);
-
-extern _X_EXPORT int FreeGC(
- pointer /*pGC*/,
- XID /*gid*/);
-
-extern _X_EXPORT void FreeGCperDepth(
- int /*screenNum*/);
-
-extern _X_EXPORT Bool CreateGCperDepth(
- int /*screenNum*/);
-
-extern _X_EXPORT Bool CreateDefaultStipple(
- int /*screenNum*/);
-
-extern _X_EXPORT void FreeDefaultStipple(
- int /*screenNum*/);
-
-extern _X_EXPORT int SetDashes(
- GCPtr /*pGC*/,
- unsigned /*offset*/,
- unsigned /*ndash*/,
- unsigned char* /*pdash*/);
-
-extern _X_EXPORT int VerifyRectOrder(
- int /*nrects*/,
- xRectangle* /*prects*/,
- int /*ordering*/);
-
-extern _X_EXPORT int SetClipRects(
- GCPtr /*pGC*/,
- int /*xOrigin*/,
- int /*yOrigin*/,
- int /*nrects*/,
- xRectangle* /*prects*/,
- int /*ordering*/);
-
-extern _X_EXPORT GCPtr GetScratchGC(
- unsigned /*depth*/,
- ScreenPtr /*pScreen*/);
-
-extern _X_EXPORT void FreeScratchGC(
- GCPtr /*pGC*/);
-
-#endif /* GC_H */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef GC_H
+#define GC_H
+
+#include <X11/X.h> /* for GContext, Mask */
+#include <X11/Xdefs.h> /* for Bool */
+#include <X11/Xproto.h>
+#include "screenint.h" /* for ScreenPtr */
+#include "pixmap.h" /* for DrawablePtr */
+
+/* clientClipType field in GC */
+#define CT_NONE 0
+#define CT_PIXMAP 1
+#define CT_REGION 2
+#define CT_UNSORTED 6
+#define CT_YSORTED 10
+#define CT_YXSORTED 14
+#define CT_YXBANDED 18
+
+#define GCQREASON_VALIDATE 1
+#define GCQREASON_CHANGE 2
+#define GCQREASON_COPY_SRC 3
+#define GCQREASON_COPY_DST 4
+#define GCQREASON_DESTROY 5
+
+#define GC_CHANGE_SERIAL_BIT (((unsigned long)1)<<31)
+#define GC_CALL_VALIDATE_BIT (1L<<30)
+#define GCExtensionInterest (1L<<29)
+
+#define DRAWABLE_SERIAL_BITS (~(GC_CHANGE_SERIAL_BIT))
+
+#define MAX_SERIAL_NUM (1L<<28)
+
+#define NEXT_SERIAL_NUMBER ((++globalSerialNumber) > MAX_SERIAL_NUM ? \
+ (globalSerialNumber = 1): globalSerialNumber)
+
+typedef struct _GCInterest *GCInterestPtr;
+typedef struct _GC *GCPtr;
+typedef struct _GCOps *GCOpsPtr;
+
+extern _X_EXPORT void ValidateGC(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ );
+
+typedef union {
+ CARD32 val;
+ pointer ptr;
+} ChangeGCVal, *ChangeGCValPtr;
+
+extern int ChangeGCXIDs(ClientPtr /*client */ ,
+ GCPtr /*pGC */ ,
+ BITS32 /*mask */ ,
+ CARD32 * /*pval */ );
+
+extern _X_EXPORT int ChangeGC(ClientPtr /*client */ ,
+ GCPtr /*pGC */ ,
+ BITS32 /*mask */ ,
+ ChangeGCValPtr /*pCGCV */ );
+
+extern _X_EXPORT GCPtr CreateGC(DrawablePtr /*pDrawable */ ,
+ BITS32 /*mask */ ,
+ XID * /*pval */ ,
+ int * /*pStatus */ ,
+ XID /*gcid */ ,
+ ClientPtr /*client */ );
+
+extern _X_EXPORT int CopyGC(GCPtr /*pgcSrc */ ,
+ GCPtr /*pgcDst */ ,
+ BITS32 /*mask */ );
+
+extern _X_EXPORT int FreeGC(pointer /*pGC */ ,
+ XID /*gid */ );
+
+extern _X_EXPORT void FreeGCperDepth(int /*screenNum */ );
+
+extern _X_EXPORT Bool CreateGCperDepth(int /*screenNum */ );
+
+extern _X_EXPORT Bool CreateDefaultStipple(int /*screenNum */ );
+
+extern _X_EXPORT void FreeDefaultStipple(int /*screenNum */ );
+
+extern _X_EXPORT int SetDashes(GCPtr /*pGC */ ,
+ unsigned /*offset */ ,
+ unsigned /*ndash */ ,
+ unsigned char * /*pdash */ );
+
+extern _X_EXPORT int VerifyRectOrder(int /*nrects */ ,
+ xRectangle * /*prects */ ,
+ int /*ordering */ );
+
+extern _X_EXPORT int SetClipRects(GCPtr /*pGC */ ,
+ int /*xOrigin */ ,
+ int /*yOrigin */ ,
+ int /*nrects */ ,
+ xRectangle * /*prects */ ,
+ int /*ordering */ );
+
+extern _X_EXPORT GCPtr GetScratchGC(unsigned /*depth */ ,
+ ScreenPtr /*pScreen */ );
+
+extern _X_EXPORT void FreeScratchGC(GCPtr /*pGC */ );
+
+#endif /* GC_H */
diff --git a/xorg-server/include/gcstruct.h b/xorg-server/include/gcstruct.h
index 5a34f0b70..7621ceb11 100644
--- a/xorg-server/include/gcstruct.h
+++ b/xorg-server/include/gcstruct.h
@@ -1,322 +1,292 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-
-
-#ifndef GCSTRUCT_H
-#define GCSTRUCT_H
-
-#include "gc.h"
-
-#include "regionstr.h"
-#include "region.h"
-#include "pixmap.h"
-#include "screenint.h"
-#include "privates.h"
-#include <X11/Xprotostr.h>
-
-#define GCAllBits ((1 << (GCLastBit + 1)) - 1)
-
-/*
- * functions which modify the state of the GC
- */
-
-typedef struct _GCFuncs {
- void (* ValidateGC)(
- GCPtr /*pGC*/,
- unsigned long /*stateChanges*/,
- DrawablePtr /*pDrawable*/);
-
- void (* ChangeGC)(
- GCPtr /*pGC*/,
- unsigned long /*mask*/);
-
- void (* CopyGC)(
- GCPtr /*pGCSrc*/,
- unsigned long /*mask*/,
- GCPtr /*pGCDst*/);
-
- void (* DestroyGC)(
- GCPtr /*pGC*/);
-
- void (* ChangeClip)(
- GCPtr /*pGC*/,
- int /*type*/,
- pointer /*pvalue*/,
- int /*nrects*/);
-
- void (* DestroyClip)(
- GCPtr /*pGC*/);
-
- void (* CopyClip)(
- GCPtr /*pgcDst*/,
- GCPtr /*pgcSrc*/);
-} GCFuncs;
-
-/*
- * graphics operations invoked through a GC
- */
-
-typedef struct _GCOps {
- void (* FillSpans)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/);
-
- void (* SetSpans)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- char * /*psrc*/,
- DDXPointPtr /*ppt*/,
- int * /*pwidth*/,
- int /*nspans*/,
- int /*fSorted*/);
-
- void (* PutImage)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*depth*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- int /*leftPad*/,
- int /*format*/,
- char * /*pBits*/);
-
- RegionPtr (* CopyArea)(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*w*/,
- int /*h*/,
- int /*dstx*/,
- int /*dsty*/);
-
- RegionPtr (* CopyPlane)(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- unsigned long /*bitPlane*/);
- void (* PolyPoint)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/);
-
- void (* Polylines)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/);
-
- void (* PolySegment)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSegs*/);
-
- void (* PolyRectangle)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nrects*/,
- xRectangle * /*pRects*/);
-
- void (* PolyArc)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/);
-
- void (* FillPolygon)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*shape*/,
- int /*mode*/,
- int /*count*/,
- DDXPointPtr /*pPts*/);
-
- void (* PolyFillRect)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nrectFill*/,
- xRectangle * /*prectInit*/);
-
- void (* PolyFillArc)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/);
-
- int (* PolyText8)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/);
-
- int (* PolyText16)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- unsigned short * /*chars*/);
-
- void (* ImageText8)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/);
-
- void (* ImageText16)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- unsigned short * /*chars*/);
-
- void (* ImageGlyphBlt)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/);
-
- void (* PolyGlyphBlt)(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/);
-
- void (* PushPixels)(
- GCPtr /*pGC*/,
- PixmapPtr /*pBitMap*/,
- DrawablePtr /*pDst*/,
- int /*w*/,
- int /*h*/,
- int /*x*/,
- int /*y*/);
-} GCOps;
-
-/* there is padding in the bit fields because the Sun compiler doesn't
- * force alignment to 32-bit boundaries. losers.
- */
-typedef struct _GC {
- ScreenPtr pScreen;
- unsigned char depth;
- unsigned char alu;
- unsigned short lineWidth;
- unsigned short dashOffset;
- unsigned short numInDashList;
- unsigned char *dash;
- unsigned int lineStyle : 2;
- unsigned int capStyle : 2;
- unsigned int joinStyle : 2;
- unsigned int fillStyle : 2;
- unsigned int fillRule : 1;
- unsigned int arcMode : 1;
- unsigned int subWindowMode : 1;
- unsigned int graphicsExposures : 1;
- unsigned int clientClipType : 2; /* CT_<kind> */
- unsigned int miTranslate:1; /* should mi things translate? */
- unsigned int tileIsPixel:1; /* tile is solid pixel */
- unsigned int fExpose:1; /* Call exposure handling */
- unsigned int freeCompClip:1; /* Free composite clip */
- unsigned int scratch_inuse:1; /* is this GC in a pool for reuse? */
- unsigned int unused:13; /* see comment above */
- unsigned long planemask;
- unsigned long fgPixel;
- unsigned long bgPixel;
- /*
- * alas -- both tile and stipple must be here as they
- * are independently specifiable
- */
- PixUnion tile;
- PixmapPtr stipple;
- DDXPointRec patOrg; /* origin for (tile, stipple) */
- struct _Font *font;
- DDXPointRec clipOrg;
- pointer clientClip;
- unsigned long stateChanges; /* masked with GC_<kind> */
- unsigned long serialNumber;
- GCFuncs *funcs;
- GCOps *ops;
- PrivateRec *devPrivates;
- /*
- * The following were moved here from private storage to allow device-
- * independent access to them from screen wrappers.
- * --- 1997.11.03 Marc Aurele La France (tsi@xfree86.org)
- */
- PixmapPtr pRotatedPixmap; /* tile/stipple rotated for alignment */
- RegionPtr pCompositeClip;
- /* fExpose & freeCompClip defined above */
-} GC;
-
-#endif /* GCSTRUCT_H */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef GCSTRUCT_H
+#define GCSTRUCT_H
+
+#include "gc.h"
+
+#include "regionstr.h"
+#include "region.h"
+#include "pixmap.h"
+#include "screenint.h"
+#include "privates.h"
+#include <X11/Xprotostr.h>
+
+#define GCAllBits ((1 << (GCLastBit + 1)) - 1)
+
+/*
+ * functions which modify the state of the GC
+ */
+
+typedef struct _GCFuncs {
+ void (*ValidateGC) (GCPtr /*pGC */ ,
+ unsigned long /*stateChanges */ ,
+ DrawablePtr /*pDrawable */ );
+
+ void (*ChangeGC) (GCPtr /*pGC */ ,
+ unsigned long /*mask */ );
+
+ void (*CopyGC) (GCPtr /*pGCSrc */ ,
+ unsigned long /*mask */ ,
+ GCPtr /*pGCDst */ );
+
+ void (*DestroyGC) (GCPtr /*pGC */ );
+
+ void (*ChangeClip) (GCPtr /*pGC */ ,
+ int /*type */ ,
+ pointer /*pvalue */ ,
+ int /*nrects */ );
+
+ void (*DestroyClip) (GCPtr /*pGC */ );
+
+ void (*CopyClip) (GCPtr /*pgcDst */ ,
+ GCPtr /*pgcSrc */ );
+} GCFuncs;
+
+/*
+ * graphics operations invoked through a GC
+ */
+
+typedef struct _GCOps {
+ void (*FillSpans) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*nInit */ ,
+ DDXPointPtr /*pptInit */ ,
+ int * /*pwidthInit */ ,
+ int /*fSorted */ );
+
+ void (*SetSpans) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ char * /*psrc */ ,
+ DDXPointPtr /*ppt */ ,
+ int * /*pwidth */ ,
+ int /*nspans */ ,
+ int /*fSorted */ );
+
+ void (*PutImage) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*depth */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*w */ ,
+ int /*h */ ,
+ int /*leftPad */ ,
+ int /*format */ ,
+ char * /*pBits */ );
+
+ RegionPtr (*CopyArea) (DrawablePtr /*pSrc */ ,
+ DrawablePtr /*pDst */ ,
+ GCPtr /*pGC */ ,
+ int /*srcx */ ,
+ int /*srcy */ ,
+ int /*w */ ,
+ int /*h */ ,
+ int /*dstx */ ,
+ int /*dsty */ );
+
+ RegionPtr (*CopyPlane) (DrawablePtr /*pSrcDrawable */ ,
+ DrawablePtr /*pDstDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*srcx */ ,
+ int /*srcy */ ,
+ int /*width */ ,
+ int /*height */ ,
+ int /*dstx */ ,
+ int /*dsty */ ,
+ unsigned long /*bitPlane */ );
+ void (*PolyPoint) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*mode */ ,
+ int /*npt */ ,
+ DDXPointPtr /*pptInit */ );
+
+ void (*Polylines) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*mode */ ,
+ int /*npt */ ,
+ DDXPointPtr /*pptInit */ );
+
+ void (*PolySegment) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*nseg */ ,
+ xSegment * /*pSegs */ );
+
+ void (*PolyRectangle) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*nrects */ ,
+ xRectangle * /*pRects */ );
+
+ void (*PolyArc) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*narcs */ ,
+ xArc * /*parcs */ );
+
+ void (*FillPolygon) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*shape */ ,
+ int /*mode */ ,
+ int /*count */ ,
+ DDXPointPtr /*pPts */ );
+
+ void (*PolyFillRect) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*nrectFill */ ,
+ xRectangle * /*prectInit */ );
+
+ void (*PolyFillArc) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*narcs */ ,
+ xArc * /*parcs */ );
+
+ int (*PolyText8) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*count */ ,
+ char * /*chars */ );
+
+ int (*PolyText16) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*count */ ,
+ unsigned short * /*chars */ );
+
+ void (*ImageText8) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*count */ ,
+ char * /*chars */ );
+
+ void (*ImageText16) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*count */ ,
+ unsigned short * /*chars */ );
+
+ void (*ImageGlyphBlt) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ unsigned int /*nglyph */ ,
+ CharInfoPtr * /*ppci */ ,
+ pointer /*pglyphBase */ );
+
+ void (*PolyGlyphBlt) (DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ unsigned int /*nglyph */ ,
+ CharInfoPtr * /*ppci */ ,
+ pointer /*pglyphBase */ );
+
+ void (*PushPixels) (GCPtr /*pGC */ ,
+ PixmapPtr /*pBitMap */ ,
+ DrawablePtr /*pDst */ ,
+ int /*w */ ,
+ int /*h */ ,
+ int /*x */ ,
+ int /*y */ );
+} GCOps;
+
+/* there is padding in the bit fields because the Sun compiler doesn't
+ * force alignment to 32-bit boundaries. losers.
+ */
+typedef struct _GC {
+ ScreenPtr pScreen;
+ unsigned char depth;
+ unsigned char alu;
+ unsigned short lineWidth;
+ unsigned short dashOffset;
+ unsigned short numInDashList;
+ unsigned char *dash;
+ unsigned int lineStyle:2;
+ unsigned int capStyle:2;
+ unsigned int joinStyle:2;
+ unsigned int fillStyle:2;
+ unsigned int fillRule:1;
+ unsigned int arcMode:1;
+ unsigned int subWindowMode:1;
+ unsigned int graphicsExposures:1;
+ unsigned int clientClipType:2; /* CT_<kind> */
+ unsigned int miTranslate:1; /* should mi things translate? */
+ unsigned int tileIsPixel:1; /* tile is solid pixel */
+ unsigned int fExpose:1; /* Call exposure handling */
+ unsigned int freeCompClip:1; /* Free composite clip */
+ unsigned int scratch_inuse:1; /* is this GC in a pool for reuse? */
+ unsigned int unused:13; /* see comment above */
+ unsigned long planemask;
+ unsigned long fgPixel;
+ unsigned long bgPixel;
+ /*
+ * alas -- both tile and stipple must be here as they
+ * are independently specifiable
+ */
+ PixUnion tile;
+ PixmapPtr stipple;
+ DDXPointRec patOrg; /* origin for (tile, stipple) */
+ struct _Font *font;
+ DDXPointRec clipOrg;
+ pointer clientClip;
+ unsigned long stateChanges; /* masked with GC_<kind> */
+ unsigned long serialNumber;
+ GCFuncs *funcs;
+ GCOps *ops;
+ PrivateRec *devPrivates;
+ /*
+ * The following were moved here from private storage to allow device-
+ * independent access to them from screen wrappers.
+ * --- 1997.11.03 Marc Aurele La France (tsi@xfree86.org)
+ */
+ PixmapPtr pRotatedPixmap; /* tile/stipple rotated for alignment */
+ RegionPtr pCompositeClip;
+ /* fExpose & freeCompClip defined above */
+} GC;
+
+#endif /* GCSTRUCT_H */
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index b7825a762..d891fe5db 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -53,7 +52,7 @@ SOFTWARE.
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include <stdint.h>
-#include "window.h" /* for WindowPtr */
+#include "window.h" /* for WindowPtr */
#include "xkbrules.h"
#include "events.h"
#include "list.h"
@@ -67,9 +66,9 @@ SOFTWARE.
#define POINTER_RELATIVE (1 << 1)
#define POINTER_ABSOLUTE (1 << 2)
#define POINTER_ACCELERATE (1 << 3)
-#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
-#define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */
-#define POINTER_EMULATED (1 << 6) /* Event was emulated from another event */
+#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
+#define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */
+#define POINTER_EMULATED (1 << 6) /* Event was emulated from another event */
/* GetTouchEvent flags */
#define TOUCH_ACCEPT (1 << 0)
@@ -90,12 +89,12 @@ SOFTWARE.
/* Maximum number of valuators, divided by six, rounded up, to get number
* of events. */
#define MAX_VALUATOR_EVENTS 6
-#define MAX_BUTTONS 256 /* completely arbitrarily chosen */
+#define MAX_BUTTONS 256 /* completely arbitrarily chosen */
#define NO_AXIS_LIMITS -1
#define MAP_LENGTH 256
-#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
+#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
#define NullGrab ((GrabPtr)NULL)
#define PointerRootWin ((WindowPtr)PointerRoot)
#define NoneWin ((WindowPtr)None)
@@ -132,108 +131,101 @@ typedef union _GrabMask GrabMask;
typedef struct _ValuatorMask ValuatorMask;
/* The DIX stores incoming input events in this list */
-extern InternalEvent* InputEventList;
+extern InternalEvent *InputEventList;
-typedef int (*DeviceProc)(
- DeviceIntPtr /*device*/,
- int /*what*/);
+typedef int (*DeviceProc) (DeviceIntPtr /*device */ ,
+ int /*what */ );
-typedef void (*ProcessInputProc)(
- InternalEvent * /*event*/,
- DeviceIntPtr /*device*/);
+typedef void (*ProcessInputProc) (InternalEvent * /*event */ ,
+ DeviceIntPtr /*device */ );
-typedef Bool (*DeviceHandleProc)(
- DeviceIntPtr /*device*/,
- void* /*data*/
+typedef Bool (*DeviceHandleProc) (DeviceIntPtr /*device */ ,
+ void * /*data */
);
-typedef void (*DeviceUnwrapProc)(
- DeviceIntPtr /*device*/,
- DeviceHandleProc /*proc*/,
- void* /*data*/
+typedef void (*DeviceUnwrapProc) (DeviceIntPtr /*device */ ,
+ DeviceHandleProc /*proc */ ,
+ void * /*data */
);
/* pointer acceleration handling */
-typedef void (*PointerAccelSchemeProc)(
- DeviceIntPtr /*device*/,
- ValuatorMask* /*valuators*/,
- CARD32 /*evtime*/);
+typedef void (*PointerAccelSchemeProc) (DeviceIntPtr /*device */ ,
+ ValuatorMask * /*valuators */ ,
+ CARD32 /*evtime */ );
-typedef void (*DeviceCallbackProc)(
- DeviceIntPtr /*pDev*/);
+typedef void (*DeviceCallbackProc) (DeviceIntPtr /*pDev */ );
struct _ValuatorAccelerationRec;
-typedef Bool (*PointerAccelSchemeInitProc)(
- DeviceIntPtr /*dev*/,
- struct _ValuatorAccelerationRec* /*protoScheme*/);
+typedef Bool (*PointerAccelSchemeInitProc) (DeviceIntPtr /*dev */ ,
+ struct _ValuatorAccelerationRec *
+ /*protoScheme */ );
typedef struct _DeviceRec {
- pointer devicePrivate;
- ProcessInputProc processInputProc; /* current */
- ProcessInputProc realInputProc; /* deliver */
- ProcessInputProc enqueueInputProc; /* enqueue */
- Bool on; /* used by DDX to keep state */
+ pointer devicePrivate;
+ ProcessInputProc processInputProc; /* current */
+ ProcessInputProc realInputProc; /* deliver */
+ ProcessInputProc enqueueInputProc; /* enqueue */
+ Bool on; /* used by DDX to keep state */
} DeviceRec, *DevicePtr;
typedef struct {
- int click, bell, bell_pitch, bell_duration;
- Bool autoRepeat;
- unsigned char autoRepeats[32];
- Leds leds;
- unsigned char id;
+ int click, bell, bell_pitch, bell_duration;
+ Bool autoRepeat;
+ unsigned char autoRepeats[32];
+ Leds leds;
+ unsigned char id;
} KeybdCtrl;
typedef struct {
- KeySym *map;
- KeyCode minKeyCode,
- maxKeyCode;
- int mapWidth;
+ KeySym *map;
+ KeyCode minKeyCode, maxKeyCode;
+ int mapWidth;
} KeySymsRec, *KeySymsPtr;
typedef struct {
- int num, den, threshold;
+ int num, den, threshold;
unsigned char id;
} PtrCtrl;
typedef struct {
- int resolution, min_value, max_value;
- int integer_displayed;
+ int resolution, min_value, max_value;
+ int integer_displayed;
unsigned char id;
} IntegerCtrl;
typedef struct {
- int max_symbols, num_symbols_supported;
- int num_symbols_displayed;
- KeySym *symbols_supported;
- KeySym *symbols_displayed;
+ int max_symbols, num_symbols_supported;
+ int num_symbols_displayed;
+ KeySym *symbols_supported;
+ KeySym *symbols_displayed;
unsigned char id;
} StringCtrl;
typedef struct {
- int percent, pitch, duration;
+ int percent, pitch, duration;
unsigned char id;
} BellCtrl;
typedef struct {
- Leds led_values;
- Mask led_mask;
+ Leds led_values;
+ Mask led_mask;
unsigned char id;
} LedCtrl;
-extern _X_EXPORT KeybdCtrl defaultKeyboardControl;
-extern _X_EXPORT PtrCtrl defaultPointerControl;
+extern _X_EXPORT KeybdCtrl defaultKeyboardControl;
+extern _X_EXPORT PtrCtrl defaultPointerControl;
typedef struct _InputOption InputOption;
typedef struct _XI2Mask XI2Mask;
typedef struct _InputAttributes {
- char *product;
- char *vendor;
- char *device;
- char *pnp_id;
- char *usb_id;
- char **tags; /* null-terminated */
- uint32_t flags;
+ char *product;
+ char *vendor;
+ char *device;
+ char *pnp_id;
+ char *usb_id;
+ char **tags; /* null-terminated */
+ uint32_t flags;
} InputAttributes;
#define ATTR_KEYBOARD (1<<0)
@@ -260,22 +252,18 @@ extern int button_is_down(DeviceIntPtr pDev, int button, int type);
extern void InitCoreDevices(void);
extern void InitXTestDevices(void);
-extern _X_EXPORT DeviceIntPtr AddInputDevice(
- ClientPtr /*client*/,
- DeviceProc /*deviceProc*/,
- Bool /*autoStart*/);
+extern _X_EXPORT DeviceIntPtr AddInputDevice(ClientPtr /*client */ ,
+ DeviceProc /*deviceProc */ ,
+ Bool /*autoStart */ );
-extern _X_EXPORT Bool EnableDevice(
- DeviceIntPtr /*device*/,
- BOOL /* sendevent */);
+extern _X_EXPORT Bool EnableDevice(DeviceIntPtr /*device */ ,
+ BOOL /* sendevent */ );
-extern _X_EXPORT Bool ActivateDevice(
- DeviceIntPtr /*device*/,
- BOOL /* sendevent */);
+extern _X_EXPORT Bool ActivateDevice(DeviceIntPtr /*device */ ,
+ BOOL /* sendevent */ );
-extern _X_EXPORT Bool DisableDevice(
- DeviceIntPtr /*device*/,
- BOOL /* sendevent */);
+extern _X_EXPORT Bool DisableDevice(DeviceIntPtr /*device */ ,
+ BOOL /* sendevent */ );
extern int InitAndStartDevices(void);
@@ -283,166 +271,148 @@ extern void CloseDownDevices(void);
extern void UndisplayDevices(void);
-extern _X_EXPORT int RemoveDevice(
- DeviceIntPtr /*dev*/,
- BOOL /* sendevent */);
+extern _X_EXPORT int RemoveDevice(DeviceIntPtr /*dev */ ,
+ BOOL /* sendevent */ );
extern _X_EXPORT int NumMotionEvents(void);
-extern _X_EXPORT int dixLookupDevice(
- DeviceIntPtr * /* dev */,
- int /* id */,
- ClientPtr /* client */,
- Mask /* access_mode */);
-
-extern _X_EXPORT void QueryMinMaxKeyCodes(
- KeyCode* /*minCode*/,
- KeyCode* /*maxCode*/);
-
-extern _X_EXPORT Bool SetKeySymsMap(
- KeySymsPtr /*dst*/,
- KeySymsPtr /*src*/);
-
-extern _X_EXPORT Bool InitButtonClassDeviceStruct(
- DeviceIntPtr /*device*/,
- int /*numButtons*/,
- Atom* /* labels */,
- CARD8* /*map*/);
-
-extern _X_INTERNAL ValuatorClassPtr AllocValuatorClass(
- ValuatorClassPtr src,
- int numAxes);
-
-extern _X_EXPORT Bool InitValuatorClassDeviceStruct(
- DeviceIntPtr /*device*/,
- int /*numAxes*/,
- Atom* /* labels */,
- int /*numMotionEvents*/,
- int /*mode*/);
-
-extern _X_EXPORT Bool InitPointerAccelerationScheme(
- DeviceIntPtr /*dev*/,
- int /*scheme*/);
-
-extern _X_EXPORT Bool InitFocusClassDeviceStruct(
- DeviceIntPtr /*device*/);
-
-extern _X_EXPORT Bool InitTouchClassDeviceStruct(
- DeviceIntPtr /*device*/,
- unsigned int /*max_touches*/,
- unsigned int /*mode*/,
- unsigned int /*numAxes*/);
-
-typedef void (*BellProcPtr)(
- int /*percent*/,
- DeviceIntPtr /*device*/,
- pointer /*ctrl*/,
- int);
-
-typedef void (*KbdCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- KeybdCtrl * /*ctrl*/);
-
-typedef void (*PtrCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- PtrCtrl * /*ctrl*/);
-
-extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct(
- DeviceIntPtr /*device*/,
- PtrCtrlProcPtr /*controlProc*/);
-
-typedef void (*StringCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- StringCtrl * /*ctrl*/);
-
-extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct(
- DeviceIntPtr /*device*/,
- StringCtrlProcPtr /*controlProc*/,
- int /*max_symbols*/,
- int /*num_symbols_supported*/,
- KeySym* /*symbols*/);
-
-typedef void (*BellCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- BellCtrl * /*ctrl*/);
-
-extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct(
- DeviceIntPtr /*device*/,
- BellProcPtr /*bellProc*/,
- BellCtrlProcPtr /*controlProc*/);
-
-typedef void (*LedCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- LedCtrl * /*ctrl*/);
-
-extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct(
- DeviceIntPtr /*device*/,
- LedCtrlProcPtr /*controlProc*/);
-
-typedef void (*IntegerCtrlProcPtr)(
- DeviceIntPtr /*device*/,
- IntegerCtrl * /*ctrl*/);
-
-
-extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct(
- DeviceIntPtr /*device*/,
- IntegerCtrlProcPtr /*controlProc*/);
-
-extern _X_EXPORT Bool InitPointerDeviceStruct(
- DevicePtr /*device*/,
- CARD8* /*map*/,
- int /*numButtons*/,
- Atom* /* btn_labels */,
- PtrCtrlProcPtr /*controlProc*/,
- int /*numMotionEvents*/,
- int /*numAxes*/,
- Atom* /* axes_labels */);
-
-extern _X_EXPORT Bool InitKeyboardDeviceStruct(
- DeviceIntPtr /*device*/,
- XkbRMLVOSet * /*rmlvo*/,
- BellProcPtr /*bellProc*/,
- KbdCtrlProcPtr /*controlProc*/);
-
-extern int ApplyPointerMapping(
- DeviceIntPtr /* pDev */,
- CARD8 * /* map */,
- int /* len */,
- ClientPtr /* client */);
-
-extern Bool BadDeviceMap(
- BYTE* /*buff*/,
- int /*length*/,
- unsigned /*low*/,
- unsigned /*high*/,
- XID* /*errval*/);
-
-extern void NoteLedState(
- DeviceIntPtr /*keybd*/,
- int /*led*/,
- Bool /*on*/);
-
-extern void MaybeStopHint(
- DeviceIntPtr /*device*/,
- ClientPtr /*client*/);
-
-extern void ProcessPointerEvent(
- InternalEvent* /* ev */,
- DeviceIntPtr /*mouse*/);
-
-extern void ProcessKeyboardEvent(
- InternalEvent* /*ev*/,
- DeviceIntPtr /*keybd*/);
-
-extern Bool LegalModifier(
- unsigned int /*key*/,
- DeviceIntPtr /*pDev*/);
+extern _X_EXPORT int dixLookupDevice(DeviceIntPtr * /* dev */ ,
+ int /* id */ ,
+ ClientPtr /* client */ ,
+ Mask /* access_mode */ );
+
+extern _X_EXPORT void QueryMinMaxKeyCodes(KeyCode * /*minCode */ ,
+ KeyCode * /*maxCode */ );
+
+extern _X_EXPORT Bool SetKeySymsMap(KeySymsPtr /*dst */ ,
+ KeySymsPtr /*src */ );
+
+extern _X_EXPORT Bool InitButtonClassDeviceStruct(DeviceIntPtr /*device */ ,
+ int /*numButtons */ ,
+ Atom * /* labels */ ,
+ CARD8 * /*map */ );
+
+extern _X_INTERNAL ValuatorClassPtr AllocValuatorClass(ValuatorClassPtr src,
+ int numAxes);
+
+extern _X_EXPORT Bool InitValuatorClassDeviceStruct(DeviceIntPtr /*device */ ,
+ int /*numAxes */ ,
+ Atom * /* labels */ ,
+ int /*numMotionEvents */ ,
+ int /*mode */ );
+
+extern _X_EXPORT Bool InitPointerAccelerationScheme(DeviceIntPtr /*dev */ ,
+ int /*scheme */ );
+
+extern _X_EXPORT Bool InitFocusClassDeviceStruct(DeviceIntPtr /*device */ );
+
+extern _X_EXPORT Bool InitTouchClassDeviceStruct(DeviceIntPtr /*device */ ,
+ unsigned int /*max_touches */ ,
+ unsigned int /*mode */ ,
+ unsigned int /*numAxes */ );
+
+typedef void (*BellProcPtr) (int /*percent */ ,
+ DeviceIntPtr /*device */ ,
+ pointer /*ctrl */ ,
+ int);
+
+typedef void (*KbdCtrlProcPtr) (DeviceIntPtr /*device */ ,
+ KeybdCtrl * /*ctrl */ );
+
+typedef void (*PtrCtrlProcPtr) (DeviceIntPtr /*device */ ,
+ PtrCtrl * /*ctrl */ );
+
+extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct(DeviceIntPtr /*device */
+ ,
+ PtrCtrlProcPtr
+ /*controlProc */ );
+
+typedef void (*StringCtrlProcPtr) (DeviceIntPtr /*device */ ,
+ StringCtrl * /*ctrl */ );
+
+extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct(DeviceIntPtr
+ /*device */ ,
+ StringCtrlProcPtr
+ /*controlProc */ ,
+ int /*max_symbols */ ,
+ int
+ /*num_symbols_supported */
+ ,
+ KeySym * /*symbols */
+ );
+
+typedef void (*BellCtrlProcPtr) (DeviceIntPtr /*device */ ,
+ BellCtrl * /*ctrl */ );
+
+extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct(DeviceIntPtr /*device */
+ ,
+ BellProcPtr
+ /*bellProc */ ,
+ BellCtrlProcPtr
+ /*controlProc */ );
+
+typedef void (*LedCtrlProcPtr) (DeviceIntPtr /*device */ ,
+ LedCtrl * /*ctrl */ );
+
+extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct(DeviceIntPtr /*device */
+ ,
+ LedCtrlProcPtr
+ /*controlProc */ );
+
+typedef void (*IntegerCtrlProcPtr) (DeviceIntPtr /*device */ ,
+ IntegerCtrl * /*ctrl */ );
+
+extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct(DeviceIntPtr
+ /*device */ ,
+ IntegerCtrlProcPtr
+ /*controlProc */ );
+
+extern _X_EXPORT Bool InitPointerDeviceStruct(DevicePtr /*device */ ,
+ CARD8 * /*map */ ,
+ int /*numButtons */ ,
+ Atom * /* btn_labels */ ,
+ PtrCtrlProcPtr /*controlProc */ ,
+ int /*numMotionEvents */ ,
+ int /*numAxes */ ,
+ Atom * /* axes_labels */ );
+
+extern _X_EXPORT Bool InitKeyboardDeviceStruct(DeviceIntPtr /*device */ ,
+ XkbRMLVOSet * /*rmlvo */ ,
+ BellProcPtr /*bellProc */ ,
+ KbdCtrlProcPtr /*controlProc */
+ );
+
+extern int ApplyPointerMapping(DeviceIntPtr /* pDev */ ,
+ CARD8 * /* map */ ,
+ int /* len */ ,
+ ClientPtr /* client */ );
+
+extern Bool BadDeviceMap(BYTE * /*buff */ ,
+ int /*length */ ,
+ unsigned /*low */ ,
+ unsigned /*high */ ,
+ XID * /*errval */ );
+
+extern void NoteLedState(DeviceIntPtr /*keybd */ ,
+ int /*led */ ,
+ Bool /*on */ );
+
+extern void MaybeStopHint(DeviceIntPtr /*device */ ,
+ ClientPtr /*client */ );
+
+extern void ProcessPointerEvent(InternalEvent * /* ev */ ,
+ DeviceIntPtr /*mouse */ );
+
+extern void ProcessKeyboardEvent(InternalEvent * /*ev */ ,
+ DeviceIntPtr /*keybd */ );
+
+extern Bool LegalModifier(unsigned int /*key */ ,
+ DeviceIntPtr /*pDev */ );
extern _X_EXPORT void ProcessInputEvents(void);
-extern _X_EXPORT void InitInput(
- int /*argc*/,
- char ** /*argv*/);
+extern _X_EXPORT void InitInput(int /*argc */ ,
+ char ** /*argv */ );
extern _X_EXPORT void CloseInput(void);
extern _X_EXPORT int GetMaximumEventsNum(void);
@@ -452,140 +422,109 @@ extern _X_EXPORT void FreeEventList(InternalEvent *list, int num_events);
extern void CreateClassesChangedEvent(InternalEvent *event,
DeviceIntPtr master,
- DeviceIntPtr slave,
- int flags);
-
-extern InternalEvent * UpdateFromMaster(
- InternalEvent *events,
- DeviceIntPtr pDev,
- int type,
- int *num_events);
-
-extern _X_EXPORT int GetPointerEvents(
- InternalEvent *events,
- DeviceIntPtr pDev,
- int type,
- int buttons,
- int flags,
- const ValuatorMask *mask);
-
-extern _X_EXPORT void QueuePointerEvents(
- DeviceIntPtr pDev,
- int type,
- int buttons,
- int flags,
- const ValuatorMask *mask);
-
-extern _X_EXPORT int GetKeyboardEvents(
- InternalEvent *events,
- DeviceIntPtr pDev,
- int type,
- int key_code,
- const ValuatorMask *mask);
-
-extern _X_EXPORT void QueueKeyboardEvents(
- DeviceIntPtr pDev,
- int type,
- int key_code,
- const ValuatorMask *mask);
-
-extern int GetTouchEvents(
- InternalEvent *events,
- DeviceIntPtr pDev,
- uint32_t ddx_touchid,
- uint16_t type,
- uint32_t flags,
- const ValuatorMask *mask);
+ DeviceIntPtr slave, int flags);
+
+extern InternalEvent *UpdateFromMaster(InternalEvent *events,
+ DeviceIntPtr pDev,
+ int type, int *num_events);
+
+extern _X_EXPORT int GetPointerEvents(InternalEvent *events,
+ DeviceIntPtr pDev,
+ int type,
+ int buttons,
+ int flags, const ValuatorMask *mask);
+
+extern _X_EXPORT void QueuePointerEvents(DeviceIntPtr pDev,
+ int type,
+ int buttons,
+ int flags, const ValuatorMask *mask);
+
+extern _X_EXPORT int GetKeyboardEvents(InternalEvent *events,
+ DeviceIntPtr pDev,
+ int type,
+ int key_code, const ValuatorMask *mask);
+
+extern _X_EXPORT void QueueKeyboardEvents(DeviceIntPtr pDev,
+ int type,
+ int key_code,
+ const ValuatorMask *mask);
+
+extern int GetTouchEvents(InternalEvent *events,
+ DeviceIntPtr pDev,
+ uint32_t ddx_touchid,
+ uint16_t type,
+ uint32_t flags, const ValuatorMask *mask);
void QueueTouchEvents(DeviceIntPtr device,
int type,
uint32_t ddx_touchid,
- int flags,
- const ValuatorMask *mask);
-
-extern int GetTouchOwnershipEvents(
- InternalEvent *events,
- DeviceIntPtr pDev,
- TouchPointInfoPtr ti,
- uint8_t mode,
- XID resource,
- uint32_t flags);
-
-extern _X_EXPORT int GetProximityEvents(
- InternalEvent *events,
- DeviceIntPtr pDev,
- int type,
- const ValuatorMask *mask);
-
-extern _X_EXPORT void QueueProximityEvents(
- DeviceIntPtr pDev,
- int type,
- const ValuatorMask *mask);
-
-extern void PostSyntheticMotion(
- DeviceIntPtr pDev,
- int x,
- int y,
- int screen,
- unsigned long time);
-
-extern _X_EXPORT int GetMotionHistorySize(
- void);
-
-extern _X_EXPORT void AllocateMotionHistory(
- DeviceIntPtr pDev);
-
-extern _X_EXPORT int GetMotionHistory(
- DeviceIntPtr pDev,
- xTimecoord **buff,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen,
- BOOL core);
+ int flags, const ValuatorMask *mask);
+
+extern int GetTouchOwnershipEvents(InternalEvent *events,
+ DeviceIntPtr pDev,
+ TouchPointInfoPtr ti,
+ uint8_t mode, XID resource, uint32_t flags);
+
+extern _X_EXPORT int GetProximityEvents(InternalEvent *events,
+ DeviceIntPtr pDev,
+ int type, const ValuatorMask *mask);
+
+extern _X_EXPORT void QueueProximityEvents(DeviceIntPtr pDev,
+ int type, const ValuatorMask *mask);
+
+extern void PostSyntheticMotion(DeviceIntPtr pDev,
+ int x, int y, int screen, unsigned long time);
+
+extern _X_EXPORT int GetMotionHistorySize(void);
+
+extern _X_EXPORT void AllocateMotionHistory(DeviceIntPtr pDev);
+
+extern _X_EXPORT int GetMotionHistory(DeviceIntPtr pDev,
+ xTimecoord ** buff,
+ unsigned long start,
+ unsigned long stop,
+ ScreenPtr pScreen, BOOL core);
extern void ReleaseButtonsAndKeys(DeviceIntPtr dev);
extern int AttachDevice(ClientPtr client,
- DeviceIntPtr slave,
- DeviceIntPtr master);
+ DeviceIntPtr slave, DeviceIntPtr master);
extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
extern _X_EXPORT int AllocDevicePair(ClientPtr client,
- const char* name,
- DeviceIntPtr* ptr,
- DeviceIntPtr* keybd,
- DeviceProc ptr_proc,
- DeviceProc keybd_proc,
- Bool master);
+ const char *name,
+ DeviceIntPtr *ptr,
+ DeviceIntPtr *keybd,
+ DeviceProc ptr_proc,
+ DeviceProc keybd_proc, Bool master);
extern void DeepCopyDeviceClasses(DeviceIntPtr from,
- DeviceIntPtr to,
- DeviceChangedEvent *dce);
+ DeviceIntPtr to, DeviceChangedEvent *dce);
/* Helper functions. */
extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
- KeyCode **modkeymap, int *max_keys_per_mod);
+ KeyCode **modkeymap,
+ int *max_keys_per_mod);
extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
int max_keys_per_mod);
-extern int AllocXTestDevice(ClientPtr client,
- const char* name,
- DeviceIntPtr* ptr,
- DeviceIntPtr* keybd,
- DeviceIntPtr master_ptr,
- DeviceIntPtr master_keybd);
+extern int AllocXTestDevice(ClientPtr client, const char *name,
+ DeviceIntPtr *ptr, DeviceIntPtr *keybd,
+ DeviceIntPtr master_ptr, DeviceIntPtr master_keybd);
extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
extern void SendDevicePresenceEvent(int deviceid, int type);
-extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attrs);
-extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
+extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *
+ attrs);
+extern _X_EXPORT void FreeInputAttributes(InputAttributes * attrs);
-enum TouchListenerState{
+enum TouchListenerState {
LISTENER_AWAITING_BEGIN = 0, /**< Waiting for a TouchBegin event */
LISTENER_AWAITING_OWNER, /**< Waiting for a TouchOwnership event */
LISTENER_EARLY_ACCEPT, /**< Waiting for ownership, has already
accepted */
- LISTENER_IS_OWNER, /**< Is the current owner */
+ LISTENER_IS_OWNER, /**< Is the current owner, hasn't accepted */
+ LISTENER_HAS_ACCEPTED, /**< Is the current owner, has accepted */
LISTENER_HAS_END, /**< Has already received the end event */
};
@@ -596,34 +535,40 @@ enum TouchListenerType {
LISTENER_POINTER_REGULAR,
};
-extern void TouchInitDDXTouchPoint(DeviceIntPtr dev, DDXTouchPointInfoPtr ddxtouch);
-extern DDXTouchPointInfoPtr TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id);
+extern void TouchInitDDXTouchPoint(DeviceIntPtr dev,
+ DDXTouchPointInfoPtr ddxtouch);
+extern DDXTouchPointInfoPtr TouchBeginDDXTouch(DeviceIntPtr dev,
+ uint32_t ddx_id);
extern void TouchEndDDXTouch(DeviceIntPtr dev, DDXTouchPointInfoPtr ti);
extern DDXTouchPointInfoPtr TouchFindByDDXID(DeviceIntPtr dev,
- uint32_t ddx_id,
- Bool create);
-extern Bool TouchInitTouchPoint(TouchClassPtr touch, ValuatorClassPtr v, int index);
+ uint32_t ddx_id, Bool create);
+extern Bool TouchInitTouchPoint(TouchClassPtr touch, ValuatorClassPtr v,
+ int index);
extern void TouchFreeTouchPoint(DeviceIntPtr dev, int index);
extern TouchPointInfoPtr TouchBeginTouch(DeviceIntPtr dev, int sourceid,
- uint32_t touchid, Bool emulate_pointer);
+ uint32_t touchid,
+ Bool emulate_pointer);
extern TouchPointInfoPtr TouchFindByClientID(DeviceIntPtr dev,
uint32_t client_id);
extern void TouchEndTouch(DeviceIntPtr dev, TouchPointInfoPtr ti);
extern Bool TouchEventHistoryAllocate(TouchPointInfoPtr ti);
extern void TouchEventHistoryFree(TouchPointInfoPtr ti);
extern void TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev);
-extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource);
+extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev,
+ XID resource);
extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource);
-extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level,
- enum TouchListenerType type, enum TouchListenerState state,
- WindowPtr window);
+extern void TouchAddListener(TouchPointInfoPtr ti, XID resource,
+ enum InputLevel level, enum TouchListenerType type,
+ enum TouchListenerState state, WindowPtr window);
extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource);
-extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev);
+extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti,
+ InternalEvent *ev);
extern Bool TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
InternalEvent *ev);
extern Bool TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite);
extern int TouchConvertToPointerEvent(const InternalEvent *ev,
- InternalEvent *motion, InternalEvent *button);
+ InternalEvent *motion,
+ InternalEvent *button);
extern int TouchGetPointerEventType(const InternalEvent *ev);
extern void TouchRemovePointerGrab(DeviceIntPtr dev);
extern void TouchListenerGone(XID resource);
@@ -631,15 +576,13 @@ extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
uint32_t touchid, Window grab_window, XID *error);
/* misc event helpers */
-extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
+extern Mask GetEventMask(DeviceIntPtr dev, xEvent *ev, InputClientsPtr clients);
extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
-extern Bool WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
+extern Bool WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent *ev);
extern int GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type);
void FixUpEventFromWindow(SpritePtr pSprite,
xEvent *xE,
- WindowPtr pWin,
- Window child,
- Bool calcChild);
+ WindowPtr pWin, Window child, Bool calcChild);
extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
extern int EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win);
extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab,
@@ -664,17 +607,12 @@ enum EventDeliveryState {
};
/* Implemented by the DDX. */
-extern _X_EXPORT int NewInputDeviceRequest(
- InputOption *options,
- InputAttributes *attrs,
- DeviceIntPtr *dev);
-extern _X_EXPORT void DeleteInputDeviceRequest(
- DeviceIntPtr dev);
-
-extern _X_EXPORT void DDXRingBell(
- int volume,
- int pitch,
- int duration);
+extern _X_EXPORT int NewInputDeviceRequest(InputOption *options,
+ InputAttributes * attrs,
+ DeviceIntPtr *dev);
+extern _X_EXPORT void DeleteInputDeviceRequest(DeviceIntPtr dev);
+
+extern _X_EXPORT void DDXRingBell(int volume, int pitch, int duration);
#define VALUATOR_MODE_ALL_AXES -1
extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis);
@@ -684,16 +622,15 @@ extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode);
xfixes/cursor.c uses it to determine if the cursor is enabled */
extern Bool EnableCursor;
-extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators);
+extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators);
extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask);
extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
- int first_valuator, int num_valuators,
- const int* valuators);
-extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask,
- int valuator,
+ int first_valuator,
+ int num_valuators,
+ const int *valuators);
+extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask, int valuator,
int data);
-extern _X_EXPORT void valuator_mask_set_double(ValuatorMask *mask,
- int valuator,
+extern _X_EXPORT void valuator_mask_set_double(ValuatorMask *mask, int valuator,
double data);
extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask);
extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask);
@@ -711,16 +648,21 @@ extern _X_EXPORT Bool valuator_mask_fetch_double(const ValuatorMask *mask,
int valnum, double *val);
/* InputOption handling interface */
-extern _X_EXPORT InputOption* input_option_new(InputOption *list, const char *key, const char *value);
+extern _X_EXPORT InputOption *input_option_new(InputOption *list,
+ const char *key,
+ const char *value);
extern _X_EXPORT void input_option_free_list(InputOption **opt);
-extern _X_EXPORT InputOption* input_option_free_element(InputOption *opt, const char *key);
-extern _X_EXPORT InputOption* input_option_find(InputOption *list, const char *key);
-extern _X_EXPORT const char* input_option_get_key(const InputOption *opt);
-extern _X_EXPORT const char* input_option_get_value(const InputOption *opt);
-extern _X_EXPORT void input_option_set_key(InputOption *opt, const char* key);
-extern _X_EXPORT void input_option_set_value(InputOption *opt, const char* value);
+extern _X_EXPORT InputOption *input_option_free_element(InputOption *opt,
+ const char *key);
+extern _X_EXPORT InputOption *input_option_find(InputOption *list,
+ const char *key);
+extern _X_EXPORT const char *input_option_get_key(const InputOption *opt);
+extern _X_EXPORT const char *input_option_get_value(const InputOption *opt);
+extern _X_EXPORT void input_option_set_key(InputOption *opt, const char *key);
+extern _X_EXPORT void input_option_set_value(InputOption *opt,
+ const char *value);
extern _X_HIDDEN Bool point_on_screen(ScreenPtr pScreen, int x, int y);
extern _X_HIDDEN void update_desktop_dimensions(void);
-#endif /* INPUT_H */
+#endif /* INPUT_H */
diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h
index 86db811fc..5a38924de 100644
--- a/xorg-server/include/inputstr.h
+++ b/xorg-server/include/inputstr.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -45,7 +44,6 @@ SOFTWARE.
********************************************************/
-
#ifndef INPUTSTRUCT_H
#define INPUTSTRUCT_H
@@ -62,7 +60,7 @@ SOFTWARE.
#define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
#define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
-extern _X_EXPORT int CountBits(const uint8_t *mask, int len);
+extern _X_EXPORT int CountBits(const uint8_t * mask, int len);
#define SameClient(obj,client) \
(CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
@@ -74,7 +72,7 @@ extern _X_EXPORT int CountBits(const uint8_t *mask, int len);
* this number here is bumped.
*/
#define XI2LASTEVENT XI_RawTouchEnd
-#define XI2MASKSIZE ((XI2LASTEVENT >> 3) + 1) /* no of bytes for masks */
+#define XI2MASKSIZE ((XI2LASTEVENT >> 3) + 1) /* no of bytes for masks */
/**
* Scroll types for ::SetScrollValuator and the scroll type in the
@@ -103,9 +101,9 @@ enum ScrollType {
* Kludge: OtherClients and InputClients must be compatible, see code.
*/
typedef struct _OtherClients {
- OtherClientsPtr next; /**< Pointer to the next mask */
- XID resource; /**< id for putting into resource manager */
- Mask mask; /**< Core event mask */
+ OtherClientsPtr next; /**< Pointer to the next mask */
+ XID resource; /**< id for putting into resource manager */
+ Mask mask; /**< Core event mask */
} OtherClients;
/**
@@ -116,11 +114,11 @@ typedef struct _OtherClients {
* a linked list.
*/
typedef struct _InputClients {
- InputClientsPtr next; /**< Pointer to the next mask */
- XID resource; /**< id for putting into resource manager */
- Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */
+ InputClientsPtr next; /**< Pointer to the next mask */
+ XID resource; /**< id for putting into resource manager */
+ Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */
/** XI2 event masks. One per device, each bit is a mask of (1 << type) */
- struct _XI2Mask *xi2mask;
+ struct _XI2Mask *xi2mask;
} InputClients;
/**
@@ -140,17 +138,17 @@ typedef struct _OtherInputMasks {
/**
* Bitwise OR of all masks by all clients and the window's parent's masks.
*/
- Mask deliverableEvents[EMASKSIZE];
+ Mask deliverableEvents[EMASKSIZE];
/**
* Bitwise OR of all masks by all clients on this window.
*/
- Mask inputEvents[EMASKSIZE];
+ Mask inputEvents[EMASKSIZE];
/** The do-not-propagate masks for each device. */
- Mask dontPropagateMask[EMASKSIZE];
+ Mask dontPropagateMask[EMASKSIZE];
/** The clients that selected for events */
- InputClientsPtr inputClients;
+ InputClientsPtr inputClients;
/* XI2 event masks. One per device, each bit is a mask of (1 << type) */
- struct _XI2Mask *xi2mask;
+ struct _XI2Mask *xi2mask;
} OtherInputMasks;
/*
@@ -160,13 +158,13 @@ typedef struct _OtherInputMasks {
* keyboard/pointer device) going at once in the server.
*/
-#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
- modifier combinations, but only
- 3 buttons. */
+#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
+ modifier combinations, but only
+ 3 buttons. */
-typedef struct _DetailRec { /* Grab details may be bit masks */
- unsigned int exact;
- Mask *pMask;
+typedef struct _DetailRec { /* Grab details may be bit masks */
+ unsigned int exact;
+ Mask *pMask;
} DetailRec;
union _GrabMask {
@@ -189,22 +187,22 @@ union _GrabMask {
* and deviceMask is set to the XI event mask for the grab.
*/
typedef struct _GrabRec {
- GrabPtr next; /* for chain of passive grabs */
- XID resource;
- DeviceIntPtr device;
- WindowPtr window;
- unsigned ownerEvents:1;
- unsigned keyboardMode:1;
- unsigned pointerMode:1;
- enum InputLevel grabtype;
- CARD8 type; /* event type */
- DetailRec modifiersDetail;
- DeviceIntPtr modifierDevice;
- DetailRec detail; /* key or button */
- WindowPtr confineTo; /* always NULL for keyboards */
- CursorPtr cursor; /* always NULL for keyboards */
- Mask eventMask;
- Mask deviceMask;
+ GrabPtr next; /* for chain of passive grabs */
+ XID resource;
+ DeviceIntPtr device;
+ WindowPtr window;
+ unsigned ownerEvents:1;
+ unsigned keyboardMode:1;
+ unsigned pointerMode:1;
+ enum InputLevel grabtype;
+ CARD8 type; /* event type */
+ DetailRec modifiersDetail;
+ DeviceIntPtr modifierDevice;
+ DetailRec detail; /* key or button */
+ WindowPtr confineTo; /* always NULL for keyboards */
+ CursorPtr cursor; /* always NULL for keyboards */
+ Mask eventMask;
+ Mask deviceMask;
/* XI2 event masks. One per device, each bit is a mask of (1 << type) */
struct _XI2Mask *xi2mask;
} GrabRec;
@@ -213,20 +211,20 @@ typedef struct _GrabRec {
* Sprite information for a device.
*/
typedef struct _SpriteRec {
- CursorPtr current;
- BoxRec hotLimits; /* logical constraints of hot spot */
- Bool confined; /* confined to screen */
- RegionPtr hotShape; /* additional logical shape constraint */
- BoxRec physLimits; /* physical constraints of hot spot */
- WindowPtr win; /* window of logical position */
- HotSpot hot; /* logical pointer position */
- HotSpot hotPhys; /* physical pointer position */
+ CursorPtr current;
+ BoxRec hotLimits; /* logical constraints of hot spot */
+ Bool confined; /* confined to screen */
+ RegionPtr hotShape; /* additional logical shape constraint */
+ BoxRec physLimits; /* physical constraints of hot spot */
+ WindowPtr win; /* window of logical position */
+ HotSpot hot; /* logical pointer position */
+ HotSpot hotPhys; /* physical pointer position */
#ifdef PANORAMIX
- ScreenPtr screen; /* all others are in Screen 0 coordinates */
- RegionRec Reg1; /* Region 1 for confining motion */
- RegionRec Reg2; /* Region 2 for confining virtual motion */
- WindowPtr windows[MAXSCREENS];
- WindowPtr confineWin; /* confine window */
+ ScreenPtr screen; /* all others are in Screen 0 coordinates */
+ RegionRec Reg1; /* Region 1 for confining motion */
+ RegionRec Reg2; /* Region 2 for confining virtual motion */
+ WindowPtr windows[MAXSCREENS];
+ WindowPtr confineWin; /* confine window */
#endif
/* The window trace information is used at dix/events.c to avoid having
* to compute all the windows between the root and the current pointer
@@ -251,133 +249,133 @@ typedef struct _SpriteRec {
} SpriteRec;
typedef struct _KeyClassRec {
- int sourceid;
- CARD8 down[DOWN_LENGTH];
- CARD8 postdown[DOWN_LENGTH];
- int modifierKeyCount[8];
+ int sourceid;
+ CARD8 down[DOWN_LENGTH];
+ CARD8 postdown[DOWN_LENGTH];
+ int modifierKeyCount[8];
struct _XkbSrvInfo *xkbInfo;
} KeyClassRec, *KeyClassPtr;
typedef struct _ScrollInfo {
- enum ScrollType type;
- double increment;
- int flags;
+ enum ScrollType type;
+ double increment;
+ int flags;
} ScrollInfo, *ScrollInfoPtr;
typedef struct _AxisInfo {
- int resolution;
- int min_resolution;
- int max_resolution;
- int min_value;
- int max_value;
- Atom label;
- CARD8 mode;
- ScrollInfo scroll;
+ int resolution;
+ int min_resolution;
+ int max_resolution;
+ int min_value;
+ int max_value;
+ Atom label;
+ CARD8 mode;
+ ScrollInfo scroll;
} AxisInfo, *AxisInfoPtr;
typedef struct _ValuatorAccelerationRec {
- int number;
- PointerAccelSchemeProc AccelSchemeProc;
- void *accelData; /* at disposal of AccelScheme */
- PointerAccelSchemeInitProc AccelInitProc;
- DeviceCallbackProc AccelCleanupProc;
+ int number;
+ PointerAccelSchemeProc AccelSchemeProc;
+ void *accelData; /* at disposal of AccelScheme */
+ PointerAccelSchemeInitProc AccelInitProc;
+ DeviceCallbackProc AccelCleanupProc;
} ValuatorAccelerationRec, *ValuatorAccelerationPtr;
typedef struct _ValuatorClassRec {
- int sourceid;
- int numMotionEvents;
- int first_motion;
- int last_motion;
- void *motion; /* motion history buffer. Different layout
- for MDs and SDs!*/
- WindowPtr motionHintWindow;
-
- AxisInfoPtr axes;
- unsigned short numAxes;
- double *axisVal; /* always absolute, but device-coord system */
- ValuatorAccelerationRec accelScheme;
- int h_scroll_axis; /* horiz smooth-scrolling axis */
- int v_scroll_axis; /* vert smooth-scrolling axis */
+ int sourceid;
+ int numMotionEvents;
+ int first_motion;
+ int last_motion;
+ void *motion; /* motion history buffer. Different layout
+ for MDs and SDs! */
+ WindowPtr motionHintWindow;
+
+ AxisInfoPtr axes;
+ unsigned short numAxes;
+ double *axisVal; /* always absolute, but device-coord system */
+ ValuatorAccelerationRec accelScheme;
+ int h_scroll_axis; /* horiz smooth-scrolling axis */
+ int v_scroll_axis; /* vert smooth-scrolling axis */
} ValuatorClassRec;
typedef struct _TouchPointInfo {
- uint32_t client_id; /* touch ID as seen in client events */
- int sourceid; /* Source device's ID for this touchpoint */
- Bool active; /* whether or not the touch is active */
- Bool pending_finish; /* true if the touch is physically inactive
- * but still owned by a grab */
- SpriteRec sprite; /* window trace for delivery */
- ValuatorMask *valuators; /* last recorded axis values */
+ uint32_t client_id; /* touch ID as seen in client events */
+ int sourceid; /* Source device's ID for this touchpoint */
+ Bool active; /* whether or not the touch is active */
+ Bool pending_finish; /* true if the touch is physically inactive
+ * but still owned by a grab */
+ SpriteRec sprite; /* window trace for delivery */
+ ValuatorMask *valuators; /* last recorded axis values */
struct _TouchListener {
- XID listener; /* grabs/event selection IDs receiving
- * events for this touch */
+ XID listener; /* grabs/event selection IDs receiving
+ * events for this touch */
enum TouchListenerType type;
enum TouchListenerState state;
- enum InputLevel level; /* matters only for emulating touches */
+ enum InputLevel level; /* matters only for emulating touches */
WindowPtr window;
} *listeners;
- int num_listeners;
- int num_grabs; /* number of open grabs on this touch
- * which have not accepted or rejected */
- Bool emulate_pointer;
- DeviceEvent *history; /* History of events on this touchpoint */
- size_t history_elements; /* Number of current elements in history */
- size_t history_size; /* Size of history in elements */
+ int num_listeners;
+ int num_grabs; /* number of open grabs on this touch
+ * which have not accepted or rejected */
+ Bool emulate_pointer;
+ DeviceEvent *history; /* History of events on this touchpoint */
+ size_t history_elements; /* Number of current elements in history */
+ size_t history_size; /* Size of history in elements */
} TouchPointInfoRec;
typedef struct _TouchListener TouchListener;
typedef struct _DDXTouchPointInfo {
- uint32_t client_id; /* touch ID as seen in client events */
- Bool active; /* whether or not the touch is active */
- uint32_t ddx_id; /* touch ID given by the DDX */
- Bool emulate_pointer;
+ uint32_t client_id; /* touch ID as seen in client events */
+ Bool active; /* whether or not the touch is active */
+ uint32_t ddx_id; /* touch ID given by the DDX */
+ Bool emulate_pointer;
- ValuatorMask* valuators; /* last recorded axis values */
+ ValuatorMask *valuators; /* last recorded axis values */
} DDXTouchPointInfoRec;
typedef struct _TouchClassRec {
- int sourceid;
- TouchPointInfoPtr touches;
- unsigned short num_touches; /* number of allocated touches */
- unsigned short max_touches; /* maximum number of touches, may be 0 */
- CARD8 mode; /* ::XIDirectTouch, XIDependentTouch */
+ int sourceid;
+ TouchPointInfoPtr touches;
+ unsigned short num_touches; /* number of allocated touches */
+ unsigned short max_touches; /* maximum number of touches, may be 0 */
+ CARD8 mode; /* ::XIDirectTouch, XIDependentTouch */
/* for pointer-emulation */
- CARD8 buttonsDown; /* number of buttons down */
- unsigned short state; /* logical button state */
- Mask motionMask;
+ CARD8 buttonsDown; /* number of buttons down */
+ unsigned short state; /* logical button state */
+ Mask motionMask;
} TouchClassRec;
typedef struct _ButtonClassRec {
- int sourceid;
- CARD8 numButtons;
- CARD8 buttonsDown; /* number of buttons currently down
- This counts logical buttons, not
- physical ones, i.e if some buttons
- are mapped to 0, they're not counted
- here */
- unsigned short state;
- Mask motionMask;
- CARD8 down[DOWN_LENGTH];
- CARD8 postdown[DOWN_LENGTH];
- CARD8 map[MAP_LENGTH];
- union _XkbAction *xkb_acts;
- Atom labels[MAX_BUTTONS];
+ int sourceid;
+ CARD8 numButtons;
+ CARD8 buttonsDown; /* number of buttons currently down
+ This counts logical buttons, not
+ physical ones, i.e if some buttons
+ are mapped to 0, they're not counted
+ here */
+ unsigned short state;
+ Mask motionMask;
+ CARD8 down[DOWN_LENGTH];
+ CARD8 postdown[DOWN_LENGTH];
+ CARD8 map[MAP_LENGTH];
+ union _XkbAction *xkb_acts;
+ Atom labels[MAX_BUTTONS];
} ButtonClassRec, *ButtonClassPtr;
typedef struct _FocusClassRec {
- int sourceid;
- WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */
- int revert;
- TimeStamp time;
- WindowPtr *trace;
- int traceSize;
- int traceGood;
+ int sourceid;
+ WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */
+ int revert;
+ TimeStamp time;
+ WindowPtr *trace;
+ int traceSize;
+ int traceGood;
} FocusClassRec, *FocusClassPtr;
typedef struct _ProximityClassRec {
- int sourceid;
- char in_proximity;
+ int sourceid;
+ char in_proximity;
} ProximityClassRec, *ProximityClassPtr;
typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
@@ -388,147 +386,134 @@ typedef struct _BellFeedbackClassRec *BellFeedbackPtr;
typedef struct _LedFeedbackClassRec *LedFeedbackPtr;
typedef struct _KbdFeedbackClassRec {
- BellProcPtr BellProc;
- KbdCtrlProcPtr CtrlProc;
- KeybdCtrl ctrl;
- KbdFeedbackPtr next;
+ BellProcPtr BellProc;
+ KbdCtrlProcPtr CtrlProc;
+ KeybdCtrl ctrl;
+ KbdFeedbackPtr next;
struct _XkbSrvLedInfo *xkb_sli;
} KbdFeedbackClassRec;
typedef struct _PtrFeedbackClassRec {
- PtrCtrlProcPtr CtrlProc;
- PtrCtrl ctrl;
- PtrFeedbackPtr next;
+ PtrCtrlProcPtr CtrlProc;
+ PtrCtrl ctrl;
+ PtrFeedbackPtr next;
} PtrFeedbackClassRec;
typedef struct _IntegerFeedbackClassRec {
- IntegerCtrlProcPtr CtrlProc;
- IntegerCtrl ctrl;
- IntegerFeedbackPtr next;
+ IntegerCtrlProcPtr CtrlProc;
+ IntegerCtrl ctrl;
+ IntegerFeedbackPtr next;
} IntegerFeedbackClassRec;
typedef struct _StringFeedbackClassRec {
- StringCtrlProcPtr CtrlProc;
- StringCtrl ctrl;
- StringFeedbackPtr next;
+ StringCtrlProcPtr CtrlProc;
+ StringCtrl ctrl;
+ StringFeedbackPtr next;
} StringFeedbackClassRec;
typedef struct _BellFeedbackClassRec {
- BellProcPtr BellProc;
- BellCtrlProcPtr CtrlProc;
- BellCtrl ctrl;
- BellFeedbackPtr next;
+ BellProcPtr BellProc;
+ BellCtrlProcPtr CtrlProc;
+ BellCtrl ctrl;
+ BellFeedbackPtr next;
} BellFeedbackClassRec;
typedef struct _LedFeedbackClassRec {
- LedCtrlProcPtr CtrlProc;
- LedCtrl ctrl;
- LedFeedbackPtr next;
+ LedCtrlProcPtr CtrlProc;
+ LedCtrl ctrl;
+ LedFeedbackPtr next;
struct _XkbSrvLedInfo *xkb_sli;
} LedFeedbackClassRec;
-
typedef struct _ClassesRec {
- KeyClassPtr key;
- ValuatorClassPtr valuator;
- TouchClassPtr touch;
- ButtonClassPtr button;
- FocusClassPtr focus;
- ProximityClassPtr proximity;
- KbdFeedbackPtr kbdfeed;
- PtrFeedbackPtr ptrfeed;
- IntegerFeedbackPtr intfeed;
- StringFeedbackPtr stringfeed;
- BellFeedbackPtr bell;
- LedFeedbackPtr leds;
+ KeyClassPtr key;
+ ValuatorClassPtr valuator;
+ TouchClassPtr touch;
+ ButtonClassPtr button;
+ FocusClassPtr focus;
+ ProximityClassPtr proximity;
+ KbdFeedbackPtr kbdfeed;
+ PtrFeedbackPtr ptrfeed;
+ IntegerFeedbackPtr intfeed;
+ StringFeedbackPtr stringfeed;
+ BellFeedbackPtr bell;
+ LedFeedbackPtr leds;
} ClassesRec;
-
/* Device properties */
-typedef struct _XIPropertyValue
-{
- Atom type; /* ignored by server */
- short format; /* format of data for swapping - 8,16,32 */
- long size; /* size of data in (format/8) bytes */
- pointer data; /* private to client */
+typedef struct _XIPropertyValue {
+ Atom type; /* ignored by server */
+ short format; /* format of data for swapping - 8,16,32 */
+ long size; /* size of data in (format/8) bytes */
+ pointer data; /* private to client */
} XIPropertyValueRec;
-typedef struct _XIProperty
-{
- struct _XIProperty *next;
- Atom propertyName;
- BOOL deletable; /* clients can delete this prop? */
- XIPropertyValueRec value;
+typedef struct _XIProperty {
+ struct _XIProperty *next;
+ Atom propertyName;
+ BOOL deletable; /* clients can delete this prop? */
+ XIPropertyValueRec value;
} XIPropertyRec;
-typedef XIPropertyRec *XIPropertyPtr;
+typedef XIPropertyRec *XIPropertyPtr;
typedef XIPropertyValueRec *XIPropertyValuePtr;
-
-typedef struct _XIPropertyHandler
-{
- struct _XIPropertyHandler* next;
+typedef struct _XIPropertyHandler {
+ struct _XIPropertyHandler *next;
long id;
int (*SetProperty) (DeviceIntPtr dev,
- Atom property,
- XIPropertyValuePtr prop,
- BOOL checkonly);
- int (*GetProperty) (DeviceIntPtr dev,
- Atom property);
- int (*DeleteProperty) (DeviceIntPtr dev,
- Atom property);
+ Atom property, XIPropertyValuePtr prop, BOOL checkonly);
+ int (*GetProperty) (DeviceIntPtr dev, Atom property);
+ int (*DeleteProperty) (DeviceIntPtr dev, Atom property);
} XIPropertyHandler, *XIPropertyHandlerPtr;
/* states for devices */
#define NOT_GRABBED 0
#define THAWED 1
-#define THAWED_BOTH 2 /* not a real state */
+#define THAWED_BOTH 2 /* not a real state */
#define FREEZE_NEXT_EVENT 3
#define FREEZE_BOTH_NEXT_EVENT 4
-#define FROZEN 5 /* any state >= has device frozen */
+#define FROZEN 5 /* any state >= has device frozen */
#define FROZEN_NO_EVENT 5
#define FROZEN_WITH_EVENT 6
#define THAW_OTHERS 7
-
typedef struct _GrabInfoRec {
- TimeStamp grabTime;
- Bool fromPassiveGrab; /* true if from passive grab */
- Bool implicitGrab; /* implicit from ButtonPress */
- GrabPtr activeGrab;
- GrabPtr grab;
- CARD8 activatingKey;
- void (*ActivateGrab) (
- DeviceIntPtr /*device*/,
- GrabPtr /*grab*/,
- TimeStamp /*time*/,
- Bool /*autoGrab*/);
- void (*DeactivateGrab)(
- DeviceIntPtr /*device*/);
+ TimeStamp grabTime;
+ Bool fromPassiveGrab; /* true if from passive grab */
+ Bool implicitGrab; /* implicit from ButtonPress */
+ GrabPtr activeGrab;
+ GrabPtr grab;
+ CARD8 activatingKey;
+ void (*ActivateGrab) (DeviceIntPtr /*device */ ,
+ GrabPtr /*grab */ ,
+ TimeStamp /*time */ ,
+ Bool /*autoGrab */ );
+ void (*DeactivateGrab) (DeviceIntPtr /*device */ );
struct {
- Bool frozen;
- int state;
- GrabPtr other; /* if other grab has this frozen */
- DeviceEvent *event; /* saved to be replayed */
+ Bool frozen;
+ int state;
+ GrabPtr other; /* if other grab has this frozen */
+ DeviceEvent *event; /* saved to be replayed */
} sync;
} GrabInfoRec, *GrabInfoPtr;
typedef struct _SpriteInfoRec {
/* sprite must always point to a valid sprite. For devices sharing the
* sprite, let sprite point to a paired spriteOwner's sprite. */
- SpritePtr sprite; /* sprite information */
- Bool spriteOwner; /* True if device owns the sprite */
- DeviceIntPtr paired; /* The paired device. Keyboard if
- spriteOwner is TRUE, otherwise the
- pointer that owns the sprite. */
+ SpritePtr sprite; /* sprite information */
+ Bool spriteOwner; /* True if device owns the sprite */
+ DeviceIntPtr paired; /* The paired device. Keyboard if
+ spriteOwner is TRUE, otherwise the
+ pointer that owns the sprite. */
/* keep states for animated cursor */
struct {
- CursorPtr pCursor;
- ScreenPtr pScreen;
- int elt;
- CARD32 time;
+ CursorPtr pCursor;
+ ScreenPtr pScreen;
+ int elt;
+ CARD32 time;
} anim;
} SpriteInfoRec, *SpriteInfoPtr;
@@ -542,42 +527,42 @@ typedef struct _SpriteInfoRec {
#define POINTER_OR_FLOAT 6 /* Pointer master for this device or this device if floating */
typedef struct _DeviceIntRec {
- DeviceRec public;
+ DeviceRec public;
DeviceIntPtr next;
- Bool startup; /* true if needs to be turned on at
- server initialization time */
- DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
- used to initialize, turn on, or
- turn off the device */
- Bool inited; /* TRUE if INIT returns Success */
- Bool enabled; /* TRUE if ON returns Success */
- Bool coreEvents; /* TRUE if device also sends core */
- GrabInfoRec deviceGrab; /* grab on the device */
- int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */
- Atom xinput_type;
- char *name;
- int id;
- KeyClassPtr key;
- ValuatorClassPtr valuator;
- TouchClassPtr touch;
- ButtonClassPtr button;
- FocusClassPtr focus;
- ProximityClassPtr proximity;
- KbdFeedbackPtr kbdfeed;
- PtrFeedbackPtr ptrfeed;
- IntegerFeedbackPtr intfeed;
- StringFeedbackPtr stringfeed;
- BellFeedbackPtr bell;
- LedFeedbackPtr leds;
+ Bool startup; /* true if needs to be turned on at
+ server initialization time */
+ DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
+ used to initialize, turn on, or
+ turn off the device */
+ Bool inited; /* TRUE if INIT returns Success */
+ Bool enabled; /* TRUE if ON returns Success */
+ Bool coreEvents; /* TRUE if device also sends core */
+ GrabInfoRec deviceGrab; /* grab on the device */
+ int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */
+ Atom xinput_type;
+ char *name;
+ int id;
+ KeyClassPtr key;
+ ValuatorClassPtr valuator;
+ TouchClassPtr touch;
+ ButtonClassPtr button;
+ FocusClassPtr focus;
+ ProximityClassPtr proximity;
+ KbdFeedbackPtr kbdfeed;
+ PtrFeedbackPtr ptrfeed;
+ IntegerFeedbackPtr intfeed;
+ StringFeedbackPtr stringfeed;
+ BellFeedbackPtr bell;
+ LedFeedbackPtr leds;
struct _XkbInterest *xkb_interest;
- char *config_info; /* used by the hotplug layer */
- ClassesPtr unused_classes; /* for master devices */
- int saved_master_id; /* for slaves while grabbed */
- PrivateRec *devPrivates;
- DeviceUnwrapProc unwrapProc;
- SpriteInfoPtr spriteInfo;
- DeviceIntPtr master; /* master device */
- DeviceIntPtr lastSlave; /* last slave device used */
+ char *config_info; /* used by the hotplug layer */
+ ClassesPtr unused_classes; /* for master devices */
+ int saved_master_id; /* for slaves while grabbed */
+ PrivateRec *devPrivates;
+ DeviceUnwrapProc unwrapProc;
+ SpriteInfoPtr spriteInfo;
+ DeviceIntPtr master; /* master device */
+ DeviceIntPtr lastSlave; /* last slave device used */
/* last valuator values recorded, not posted to client;
* for slave devices, valuators is in device coordinates, mapped to the
@@ -587,18 +572,18 @@ typedef struct _DeviceIntRec {
* remainder supports acceleration
*/
struct {
- double valuators[MAX_VALUATORS];
- int numValuators;
- DeviceIntPtr slave;
- ValuatorMask *scroll;
- int num_touches; /* size of the touches array */
+ double valuators[MAX_VALUATORS];
+ int numValuators;
+ DeviceIntPtr slave;
+ ValuatorMask *scroll;
+ int num_touches; /* size of the touches array */
DDXTouchPointInfoPtr touches;
} last;
/* Input device property handling. */
struct {
- XIPropertyPtr properties;
- XIPropertyHandlerPtr handlers; /* NULL-terminated */
+ XIPropertyPtr properties;
+ XIPropertyHandlerPtr handlers; /* NULL-terminated */
} properties;
/* coordinate transformation matrix for absolute input devices */
@@ -606,16 +591,18 @@ typedef struct _DeviceIntRec {
/* XTest related master device id */
int xtest_master_id;
+
+ struct _SyncCounter *idle_counter;
} DeviceIntRec;
typedef struct {
- int numDevices; /* total number of devices */
- DeviceIntPtr devices; /* all devices turned on */
- DeviceIntPtr off_devices; /* all devices turned off */
- DeviceIntPtr keyboard; /* the main one for the server */
- DeviceIntPtr pointer;
- DeviceIntPtr all_devices;
- DeviceIntPtr all_master_devices;
+ int numDevices; /* total number of devices */
+ DeviceIntPtr devices; /* all devices turned on */
+ DeviceIntPtr off_devices; /* all devices turned off */
+ DeviceIntPtr keyboard; /* the main one for the server */
+ DeviceIntPtr pointer;
+ DeviceIntPtr all_devices;
+ DeviceIntPtr all_master_devices;
} InputInfo;
extern _X_EXPORT InputInfo inputInfo;
@@ -623,11 +610,11 @@ extern _X_EXPORT InputInfo inputInfo;
/* for keeping the events for devices grabbed synchronously */
typedef struct _QdEvent *QdEventPtr;
typedef struct _QdEvent {
- struct xorg_list next;
- DeviceIntPtr device;
- ScreenPtr pScreen; /* what screen the pointer was on */
- unsigned long months; /* milliseconds is in the event */
- InternalEvent *event;
+ struct xorg_list next;
+ DeviceIntPtr device;
+ ScreenPtr pScreen; /* what screen the pointer was on */
+ unsigned long months; /* milliseconds is in the event */
+ InternalEvent *event;
} QdEventRec;
/**
@@ -639,23 +626,23 @@ typedef struct _QdEvent {
* replayed and processed as if they would come from the device directly.
*/
typedef struct _EventSyncInfo {
- struct xorg_list pending;
+ struct xorg_list pending;
/** The device to replay events for. Only set in AllowEvents(), in which
* case it is set to the device specified in the request. */
- DeviceIntPtr replayDev; /* kludgy rock to put flag for */
+ DeviceIntPtr replayDev; /* kludgy rock to put flag for */
/**
* The window the events are supposed to be replayed on.
* This window may be set to the grab's window (but only when
* Replay{Pointer|Keyboard} is given in the XAllowEvents()
* request. */
- WindowPtr replayWin; /* ComputeFreezes */
+ WindowPtr replayWin; /* ComputeFreezes */
/**
* Flag to indicate whether we're in the process of
* replaying events. Only set in ComputeFreezes(). */
- Bool playingEvents;
- TimeStamp time;
+ Bool playingEvents;
+ TimeStamp time;
} EventSyncInfoRec, *EventSyncInfoPtr;
extern EventSyncInfoRec syncEvents;
@@ -664,7 +651,8 @@ extern EventSyncInfoRec syncEvents;
* Given a sprite, returns the window at the bottom of the trace (i.e. the
* furthest window from the root).
*/
-static inline WindowPtr DeepestSpriteWin(SpritePtr sprite)
+static inline WindowPtr
+DeepestSpriteWin(SpritePtr sprite)
{
assert(sprite->spriteTraceGood > 0);
return sprite->spriteTrace[sprite->spriteTraceGood - 1];
@@ -676,4 +664,4 @@ struct _XI2Mask {
size_t mask_size; /* size of each mask in bytes */
};
-#endif /* INPUTSTRUCT_H */
+#endif /* INPUTSTRUCT_H */
diff --git a/xorg-server/include/inpututils.h b/xorg-server/include/inpututils.h
index 9e22c5a28..cd9a4de82 100644
--- a/xorg-server/include/inpututils.h
+++ b/xorg-server/include/inpututils.h
@@ -35,15 +35,16 @@
extern Mask event_filters[MAXDEVICES][MAXEVENTS];
struct _ValuatorMask {
- int8_t last_bit; /* highest bit set in mask */
- uint8_t mask[(MAX_VALUATORS + 7)/8];
- double valuators[MAX_VALUATORS]; /* valuator data */
+ int8_t last_bit; /* highest bit set in mask */
+ uint8_t mask[(MAX_VALUATORS + 7) / 8];
+ double valuators[MAX_VALUATORS]; /* valuator data */
};
extern void verify_internal_event(const InternalEvent *ev);
extern void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms);
extern int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd);
-extern void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event);
+extern void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd,
+ DeviceEvent *event);
extern Mask event_get_filter_from_type(DeviceIntPtr dev, int evtype);
extern Mask event_get_filter_from_xi2type(int evtype);
@@ -52,16 +53,16 @@ FP1616 double_to_fp1616(double in);
double fp1616_to_double(FP1616 in);
double fp3232_to_double(FP3232 in);
-
-XI2Mask* xi2mask_new(void);
-XI2Mask* xi2mask_new_with_size(size_t, size_t); /* don't use it */
-void xi2mask_free(XI2Mask** mask);
-Bool xi2mask_isset(XI2Mask* mask, const DeviceIntPtr dev, int event_type);
+XI2Mask *xi2mask_new(void);
+XI2Mask *xi2mask_new_with_size(size_t, size_t); /* don't use it */
+void xi2mask_free(XI2Mask **mask);
+Bool xi2mask_isset(XI2Mask *mask, const DeviceIntPtr dev, int event_type);
void xi2mask_set(XI2Mask *mask, int deviceid, int event_type);
void xi2mask_zero(XI2Mask *mask, int deviceid);
void xi2mask_merge(XI2Mask *dest, const XI2Mask *source);
size_t xi2mask_num_masks(const XI2Mask *mask);
size_t xi2mask_mask_size(const XI2Mask *mask);
-void xi2mask_set_one_mask(XI2Mask *xi2mask, int deviceid, const unsigned char *mask, size_t mask_size);
-const unsigned char* xi2mask_get_one_mask(const XI2Mask *xi2mask, int deviceid);
+void xi2mask_set_one_mask(XI2Mask *xi2mask, int deviceid,
+ const unsigned char *mask, size_t mask_size);
+const unsigned char *xi2mask_get_one_mask(const XI2Mask *xi2mask, int deviceid);
#endif
diff --git a/xorg-server/include/list.h b/xorg-server/include/list.h
index 14c671f37..96c0bcbd6 100644
--- a/xorg-server/include/list.h
+++ b/xorg-server/include/list.h
@@ -125,8 +125,7 @@ xorg_list_init(struct xorg_list *list)
static inline void
__xorg_list_add(struct xorg_list *entry,
- struct xorg_list *prev,
- struct xorg_list *next)
+ struct xorg_list *prev, struct xorg_list *next)
{
next->prev = entry;
entry->next = next;
@@ -176,7 +175,6 @@ xorg_list_append(struct xorg_list *entry, struct xorg_list *head)
__xorg_list_add(entry, head->prev, head);
}
-
static inline void
__xorg_list_del(struct xorg_list *prev, struct xorg_list *next)
{
@@ -311,8 +309,6 @@ xorg_list_is_empty(struct xorg_list *head)
&pos->member != (head); \
pos = tmp, tmp = __container_of(pos->member.next, tmp, member))
-
-
/* NULL-Terminated List Interface
*
* The interface below does _not_ use the struct xorg_list as described above.
@@ -391,7 +387,6 @@ xorg_list_is_empty(struct xorg_list *head)
_entry; \
_entry = _tmp, _tmp = (_tmp) ? (_tmp)->_member: NULL)
-
/**
* Append the element to the end of the list. This macro may be used to
* merge two lists.
@@ -477,10 +472,8 @@ xorg_list_is_empty(struct xorg_list *head)
* list functions. Unfortunately, the xf86OptionRec uses it and we can't
* easily get rid of it. Do not use for new code.
*/
-typedef struct generic_list_rec
-{
- void *next;
-}
-GenericListRec, *GenericListPtr, *glp;
+typedef struct generic_list_rec {
+ void *next;
+} GenericListRec, *GenericListPtr, *glp;
#endif
diff --git a/xorg-server/include/misc.h b/xorg-server/include/misc.h
index 9dabf1989..8f986d988 100644
--- a/xorg-server/include/misc.h
+++ b/xorg-server/include/misc.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -97,7 +96,7 @@ static double __inline trunc(double d)
#define MAXCLIENTS 256
#define MAXEXTENSIONS 128
#define MAXFORMATS 8
-#define MAXDEVICES 40 /* input devices */
+#define MAXDEVICES 40 /* input devices */
/* 128 event opcodes for core + extension events, excluding GE */
#define MAXEVENTS 128
@@ -112,14 +111,15 @@ typedef uint32_t ATOM;
#endif
#ifndef _XTYPEDEF_CALLBACKLISTPTR
-typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
+typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
+
#define _XTYPEDEF_CALLBACKLISTPTR
#endif
typedef struct _xReq *xReqPtr;
-#include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */
-#include <X11/Xfuncs.h> /* for bcopy, bzero, and bcmp */
+#include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */
+#include <X11/Xfuncs.h> /* for bcopy, bzero, and bcmp */
#define NullBox ((BoxPtr)0)
#define MILLI_PER_MIN (1000 * 60)
@@ -132,20 +132,19 @@ typedef struct _xReq *xReqPtr;
#define USE_BACKGROUND_PIXEL 3
#define USE_BORDER_PIXEL 3
-
/* byte swap a 32-bit literal */
-static inline uint32_t lswapl(uint32_t x)
+static inline uint32_t
+lswapl(uint32_t x)
{
- return ((x & 0xff) << 24) |
- ((x & 0xff00) << 8) |
- ((x & 0xff0000) >> 8) |
- ((x >> 24) & 0xff);
+ return ((x & 0xff) << 24) |
+ ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | ((x >> 24) & 0xff);
}
/* byte swap a 16-bit literal */
-static inline uint16_t lswaps(uint16_t x)
+static inline uint16_t
+lswaps(uint16_t x)
{
- return ((x & 0xff) << 8) | ((x >> 8) & 0xff);
+ return ((x & 0xff) << 8) | ((x >> 8) & 0xff);
}
#undef min
@@ -190,7 +189,7 @@ static inline uint16_t lswaps(uint16_t x)
#include <assert.h>
#include <ctype.h>
-#include <stdio.h> /* for fopen, etc... */
+#include <stdio.h> /* for fopen, etc... */
#endif
@@ -211,9 +210,11 @@ static inline uint16_t lswaps(uint16_t x)
* @return The number of bytes needed to hold bits.
*/
static __inline int
-bits_to_bytes(const int bits) {
+bits_to_bytes(const int bits)
+{
return ((bits + 7) >> 3);
}
+
/**
* Calculate the number of 4-byte units needed to hold the given number of
* bytes.
@@ -221,7 +222,8 @@ bits_to_bytes(const int bits) {
* @return The number of 4-byte units needed to hold bytes.
*/
static __inline int
-bytes_to_int32(const int bytes) {
+bytes_to_int32(const int bytes)
+{
return (((bytes) + 3) >> 2);
}
@@ -231,12 +233,12 @@ bytes_to_int32(const int bytes) {
* @return The closest multiple of 4 that is equal or higher than bytes.
*/
static __inline int
-pad_to_int32(const int bytes) {
+pad_to_int32(const int bytes)
+{
return (((bytes) + 3) & ~3);
}
-extern char**
-xstrtokenize(const char *str, const char* separators);
+extern char **xstrtokenize(const char *str, const char *separators);
/**
* Compare the two version numbers comprising of major.minor.
@@ -274,29 +276,34 @@ version_compare(uint16_t a_major, uint16_t a_minor,
SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff))
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-void __attribute__((error("wrong sized variable passed to swap"))) wrong_size(void);
+void __attribute__ ((error("wrong sized variable passed to swap")))
+wrong_size(void);
#else
-static inline void wrong_size(void)
+static inline void
+wrong_size(void)
{
}
#endif
#if !(defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)))
-static inline int __builtin_constant_p(int x)
+static inline int
+__builtin_constant_p(int x)
{
- return 0;
+ return 0;
}
#endif
/* byte swap a 32-bit value */
-static inline void swap_uint32(uint32_t *x)
+static inline void
+swap_uint32(uint32_t * x)
{
- char n = ((char *) x)[0];
- ((char *) x)[0] = ((char *) x)[3];
- ((char *) x)[3] = n;
- n = ((char *) x)[1];
- ((char *) x)[1] = ((char *) x)[2];
- ((char *) x)[2] = n;
+ char n = ((char *) x)[0];
+
+ ((char *) x)[0] = ((char *) x)[3];
+ ((char *) x)[3] = n;
+ n = ((char *) x)[1];
+ ((char *) x)[1] = ((char *) x)[2];
+ ((char *) x)[2] = n;
}
#define swapl(x) do { \
@@ -309,11 +316,13 @@ static inline void swap_uint32(uint32_t *x)
} while (0)
/* byte swap a 16-bit value */
-static inline void swap_uint16(uint16_t *x)
+static inline void
+swap_uint16(uint16_t * x)
{
- char n = ((char *) x)[0];
- ((char *) x)[0] = ((char *) x)[1];
- ((char *) x)[1] = n;
+ char n = ((char *) x)[0];
+
+ ((char *) x)[0] = ((char *) x)[1];
+ ((char *) x)[1] = n;
}
#define swaps(x) do { \
@@ -339,18 +348,13 @@ static inline void swap_uint16(uint16_t *x)
(dst) = lswaps((src)); \
} while (0)
-extern _X_EXPORT void SwapLongs(
- CARD32 *list,
- unsigned long count);
+extern _X_EXPORT void SwapLongs(CARD32 *list, unsigned long count);
-extern _X_EXPORT void SwapShorts(
- short *list,
- unsigned long count);
+extern _X_EXPORT void SwapShorts(short *list, unsigned long count);
extern _X_EXPORT void MakePredeclaredAtoms(void);
-extern _X_EXPORT int Ones(
- unsigned long /*mask*/);
+extern _X_EXPORT int Ones(unsigned long /*mask */ );
typedef struct _xPoint *DDXPointPtr;
typedef struct pixman_box16 *BoxPtr;
@@ -364,7 +368,8 @@ typedef struct _GrabRec *GrabPtr;
*/
#ifndef _XTYPEDEF_CHARINFOPTR
-typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */
+typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */
+
#define _XTYPEDEF_CHARINFOPTR
#endif
@@ -386,4 +391,4 @@ extern _X_EXPORT unsigned long serverGeneration;
#define BUG_WARN(cond) __BUG_WARN_MSG(cond, 0, NULL)
-#endif /* MISC_H */
+#endif /* MISC_H */
diff --git a/xorg-server/include/os.h b/xorg-server/include/os.h
index f62ada207..c10cf7b8f 100644
--- a/xorg-server/include/os.h
+++ b/xorg-server/include/os.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -45,7 +44,6 @@ SOFTWARE.
******************************************************************/
-
#ifndef OS_H
#define OS_H
@@ -85,25 +83,23 @@ typedef struct _NewClientRec *NewClientPtr;
#include <stdarg.h>
#ifdef DDXBEFORERESET
-extern void ddxBeforeReset (void);
+extern void ddxBeforeReset(void);
#endif
#ifdef DDXOSVERRORF
-extern _X_EXPORT void (*OsVendorVErrorFProc)(const char *, va_list args);
+extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *, va_list args);
#endif
-extern _X_EXPORT int WaitForSomething(
- int* /*pClientsReady*/
-);
+extern _X_EXPORT int WaitForSomething(int * /*pClientsReady */
+ );
-extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client*/);
+extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ );
-extern _X_EXPORT Bool InsertFakeRequest(
- ClientPtr /*client*/,
- char* /*data*/,
- int /*count*/);
+extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
+ char * /*data */ ,
+ int /*count */ );
-extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client*/);
+extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client */ );
extern _X_EXPORT void FlushAllOutput(void);
@@ -111,7 +107,8 @@ extern _X_EXPORT void FlushIfCriticalOutputPending(void);
extern _X_EXPORT void SetCriticalOutputPending(void);
-extern _X_EXPORT int WriteToClient(ClientPtr /*who*/, int /*count*/, const void* /*buf*/);
+extern _X_EXPORT int WriteToClient(ClientPtr /*who */ , int /*count */ ,
+ const void * /*buf */ );
extern _X_EXPORT void ResetOsBuffers(void);
@@ -127,93 +124,87 @@ extern _X_EXPORT void ResetWellKnownSockets(void);
extern _X_EXPORT void CloseWellKnownConnections(void);
-extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client*/);
+extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client */ );
-extern _X_EXPORT const char *ClientAuthorized(
- ClientPtr /*client*/,
- unsigned int /*proto_n*/,
- char* /*auth_proto*/,
- unsigned int /*string_n*/,
- char* /*auth_string*/);
+extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ ,
+ unsigned int /*proto_n */ ,
+ char * /*auth_proto */ ,
+ unsigned int /*string_n */ ,
+ char * /*auth_string */ );
-extern _X_EXPORT Bool EstablishNewConnections(
- ClientPtr /*clientUnused*/,
- pointer /*closure*/);
+extern _X_EXPORT Bool EstablishNewConnections(ClientPtr /*clientUnused */ ,
+ pointer /*closure */ );
extern _X_EXPORT void CheckConnections(void);
-extern _X_EXPORT void CloseDownConnection(ClientPtr /*client*/);
+extern _X_EXPORT void CloseDownConnection(ClientPtr /*client */ );
-extern _X_EXPORT void AddGeneralSocket(int /*fd*/);
+extern _X_EXPORT void AddGeneralSocket(int /*fd */ );
-extern _X_EXPORT void RemoveGeneralSocket(int /*fd*/);
+extern _X_EXPORT void RemoveGeneralSocket(int /*fd */ );
-extern _X_EXPORT void AddEnabledDevice(int /*fd*/);
+extern _X_EXPORT void AddEnabledDevice(int /*fd */ );
-extern _X_EXPORT void RemoveEnabledDevice(int /*fd*/);
+extern _X_EXPORT void RemoveEnabledDevice(int /*fd */ );
-extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client*/);
+extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client */ );
extern _X_EXPORT void ListenToAllClients(void);
-extern _X_EXPORT void IgnoreClient(ClientPtr /*client*/);
+extern _X_EXPORT void IgnoreClient(ClientPtr /*client */ );
-extern _X_EXPORT void AttendClient(ClientPtr /*client*/);
+extern _X_EXPORT void AttendClient(ClientPtr /*client */ );
-extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client*/);
+extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ );
-extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client*/);
+extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ );
#ifdef XQUARTZ
-extern void ListenOnOpenFD(int /* fd */, int /* noxauth */);
+extern void ListenOnOpenFD(int /* fd */ , int /* noxauth */ );
#endif
extern _X_EXPORT CARD32 GetTimeInMillis(void);
-extern _X_EXPORT void AdjustWaitForDelay(
- pointer /*waitTime*/,
- unsigned long /*newdelay*/);
+extern _X_EXPORT void AdjustWaitForDelay(pointer /*waitTime */ ,
+ unsigned long /*newdelay */ );
-typedef struct _OsTimerRec *OsTimerPtr;
+typedef struct _OsTimerRec *OsTimerPtr;
-typedef CARD32 (*OsTimerCallback)(
- OsTimerPtr /* timer */,
- CARD32 /* time */,
- pointer /* arg */);
+typedef CARD32 (*OsTimerCallback) (OsTimerPtr /* timer */ ,
+ CARD32 /* time */ ,
+ pointer /* arg */ );
extern _X_EXPORT void TimerInit(void);
-extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */);
+extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */ );
#define TimerAbsolute (1<<0)
#define TimerForceOld (1<<1)
-extern _X_EXPORT OsTimerPtr TimerSet(
- OsTimerPtr /* timer */,
- int /* flags */,
- CARD32 /* millis */,
- OsTimerCallback /* func */,
- pointer /* arg */);
+extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr /* timer */ ,
+ int /* flags */ ,
+ CARD32 /* millis */ ,
+ OsTimerCallback /* func */ ,
+ pointer /* arg */ );
extern _X_EXPORT void TimerCheck(void);
-extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */);
-extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */);
+extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */ );
+extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */ );
extern _X_EXPORT void SetScreenSaverTimer(void);
extern _X_EXPORT void FreeScreenSaverTimer(void);
-extern _X_EXPORT void AutoResetServer(int /*sig*/);
+extern _X_EXPORT void AutoResetServer(int /*sig */ );
-extern _X_EXPORT void GiveUp(int /*sig*/);
+extern _X_EXPORT void GiveUp(int /*sig */ );
extern _X_EXPORT void UseMsg(void);
-extern _X_EXPORT void ProcessCommandLine(int /*argc*/, char* /*argv*/[]);
+extern _X_EXPORT void ProcessCommandLine(int /*argc */ , char * /*argv */ []);
-extern _X_EXPORT int set_font_authorizations(
- char ** /* authorizations */,
- int * /*authlen */,
- pointer /* client */);
+extern _X_EXPORT int set_font_authorizations(char ** /* authorizations */ ,
+ int * /*authlen */ ,
+ pointer /* client */ );
#ifndef _HAVE_XALLOC_DECLS
#define _HAVE_XALLOC_DECLS
@@ -221,20 +212,28 @@ extern _X_EXPORT int set_font_authorizations(
/*
* Use malloc(3) instead.
*/
-extern _X_EXPORT void *Xalloc(unsigned long /*amount*/) _X_DEPRECATED;
+extern _X_EXPORT void *
+Xalloc(unsigned long /*amount */ ) _X_DEPRECATED;
+
/*
* Use calloc(3) instead
*/
-extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/) _X_DEPRECATED;
+extern _X_EXPORT void *
+Xcalloc(unsigned long /*amount */ ) _X_DEPRECATED;
+
/*
* Use realloc(3) instead
*/
-extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/)
- _X_DEPRECATED;
+extern _X_EXPORT void *
+Xrealloc(void * /*ptr */ , unsigned long /*amount */ )
+ _X_DEPRECATED;
+
/*
* Use free(3) instead
*/
-extern _X_EXPORT void Xfree(void * /*ptr*/) _X_DEPRECATED;
+extern _X_EXPORT void
+Xfree(void * /*ptr */ )
+ _X_DEPRECATED;
#endif
@@ -242,78 +241,114 @@ extern _X_EXPORT void Xfree(void * /*ptr*/) _X_DEPRECATED;
* This function malloc(3)s buffer, terminating the server if there is not
* enough memory.
*/
-extern _X_EXPORT void *XNFalloc(unsigned long /*amount*/);
+extern _X_EXPORT void *
+XNFalloc(unsigned long /*amount */ );
+
/*
* This function calloc(3)s buffer, terminating the server if there is not
* enough memory.
*/
-extern _X_EXPORT void *XNFcalloc(unsigned long /*amount*/);
+extern _X_EXPORT void *
+XNFcalloc(unsigned long /*amount */ );
+
/*
* This function realloc(3)s passed buffer, terminating the server if there is
* not enough memory.
*/
-extern _X_EXPORT void *XNFrealloc(void * /*ptr*/, unsigned long /*amount*/);
+extern _X_EXPORT void *
+XNFrealloc(void * /*ptr */ , unsigned long /*amount */ );
/*
* This function strdup(3)s passed string. The only difference from the library
* function that it is safe to pass NULL, as NULL will be returned.
*/
-extern _X_EXPORT char *Xstrdup(const char *s);
+extern _X_EXPORT char *
+Xstrdup(const char *s);
/*
* This function strdup(3)s passed string, terminating the server if there is
* not enough memory. If NULL is passed to this function, NULL is returned.
*/
-extern _X_EXPORT char *XNFstrdup(const char *s);
+extern _X_EXPORT char *
+XNFstrdup(const char *s);
/* Include new X*asprintf API */
#include "Xprintf.h"
/* Older api deprecated in favor of the asprintf versions */
-extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED;
-extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED;
-extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED;
-extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED;
+extern _X_EXPORT char *
+Xprintf(const char *fmt, ...)
+_X_ATTRIBUTE_PRINTF(1, 2)
+ _X_DEPRECATED;
+extern _X_EXPORT char *
+Xvprintf(const char *fmt, va_list va)
+_X_ATTRIBUTE_PRINTF(1, 0)
+ _X_DEPRECATED;
+extern _X_EXPORT char *
+XNFprintf(const char *fmt, ...)
+_X_ATTRIBUTE_PRINTF(1, 2)
+ _X_DEPRECATED;
+extern _X_EXPORT char *
+XNFvprintf(const char *fmt, va_list va)
+_X_ATTRIBUTE_PRINTF(1, 0)
+ _X_DEPRECATED;
-typedef void (*OsSigHandlerPtr)(int /* sig */);
-typedef int (*OsSigWrapperPtr)(int /* sig */);
+typedef void (*OsSigHandlerPtr) (int /* sig */ );
+typedef int (*OsSigWrapperPtr) (int /* sig */ );
-extern _X_EXPORT OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */);
-extern _X_EXPORT OsSigWrapperPtr OsRegisterSigWrapper(OsSigWrapperPtr newWrap);
+extern _X_EXPORT OsSigHandlerPtr
+OsSignal(int /* sig */ , OsSigHandlerPtr /* handler */ );
+extern _X_EXPORT OsSigWrapperPtr
+OsRegisterSigWrapper(OsSigWrapperPtr newWrap);
extern _X_EXPORT int auditTrailLevel;
-extern _X_EXPORT void LockServer(void);
-extern _X_EXPORT void UnlockServer(void);
+extern _X_EXPORT void
+LockServer(void);
+extern _X_EXPORT void
+UnlockServer(void);
-extern _X_EXPORT int OsLookupColor(
- int /*screen*/,
- char * /*name*/,
- unsigned /*len*/,
- unsigned short * /*pred*/,
- unsigned short * /*pgreen*/,
- unsigned short * /*pblue*/);
+extern _X_EXPORT int
+OsLookupColor(int /*screen */ ,
+ char * /*name */ ,
+ unsigned /*len */ ,
+ unsigned short * /*pred */ ,
+ unsigned short * /*pgreen */ ,
+ unsigned short * /*pblue */ );
-extern _X_EXPORT void OsInit(void);
+extern _X_EXPORT void
+OsInit(void);
-extern _X_EXPORT void OsCleanup(Bool);
+extern _X_EXPORT void
+OsCleanup(Bool);
-extern _X_EXPORT void OsVendorFatalError(void);
+extern _X_EXPORT void
+OsVendorFatalError(void);
-extern _X_EXPORT void OsVendorInit(void);
+extern _X_EXPORT void
+OsVendorInit(void);
-extern _X_EXPORT void OsBlockSignals (void);
+extern _X_EXPORT void
+OsBlockSignals(void);
-extern _X_EXPORT void OsReleaseSignals (void);
+extern _X_EXPORT void
+OsReleaseSignals(void);
-extern _X_EXPORT void OsAbort (void) _X_NORETURN;
+extern _X_EXPORT void
+OsAbort(void)
+ _X_NORETURN;
#if !defined(WIN32)
-extern _X_EXPORT int System(const char *);
-extern _X_EXPORT pointer Popen(const char *, const char *);
-extern _X_EXPORT int Pclose(pointer);
-extern _X_EXPORT pointer Fopen(const char *, const char *);
-extern _X_EXPORT int Fclose(pointer);
+extern _X_EXPORT int
+System(const char *);
+extern _X_EXPORT pointer
+Popen(const char *, const char *);
+extern _X_EXPORT int
+Pclose(pointer);
+extern _X_EXPORT pointer
+Fopen(const char *, const char *);
+extern _X_EXPORT int
+Fclose(pointer);
#else
#define System(a) system(a)
#define Popen(a,b) popen(a,b)
@@ -322,42 +357,47 @@ extern _X_EXPORT int Fclose(pointer);
#define Fclose(a) fclose(a)
#endif
-extern _X_EXPORT void CheckUserParameters(int argc, char **argv, char **envp);
-extern _X_EXPORT void CheckUserAuthorization(void);
+extern _X_EXPORT void
+CheckUserParameters(int argc, char **argv, char **envp);
+extern _X_EXPORT void
+CheckUserAuthorization(void);
-extern _X_EXPORT int AddHost(
- ClientPtr /*client*/,
- int /*family*/,
- unsigned /*length*/,
- const void * /*pAddr*/);
+extern _X_EXPORT int
+AddHost(ClientPtr /*client */ ,
+ int /*family */ ,
+ unsigned /*length */ ,
+ const void * /*pAddr */ );
-extern _X_EXPORT Bool ForEachHostInFamily (
- int /*family*/,
- Bool (* /*func*/ )(
- unsigned char * /* addr */,
- short /* len */,
- pointer /* closure */),
- pointer /*closure*/);
+extern _X_EXPORT Bool
+ForEachHostInFamily(int /*family */ ,
+ Bool (* /*func */ )(
+ unsigned char * /* addr */ ,
+ short /* len */ ,
+ pointer /* closure */ ),
+ pointer /*closure */ );
-extern _X_EXPORT int RemoveHost(
- ClientPtr /*client*/,
- int /*family*/,
- unsigned /*length*/,
- pointer /*pAddr*/);
+extern _X_EXPORT int
+RemoveHost(ClientPtr /*client */ ,
+ int /*family */ ,
+ unsigned /*length */ ,
+ pointer /*pAddr */ );
-extern _X_EXPORT int GetHosts(
- pointer * /*data*/,
- int * /*pnHosts*/,
- int * /*pLen*/,
- BOOL * /*pEnabled*/);
+extern _X_EXPORT int
+GetHosts(pointer * /*data */ ,
+ int * /*pnHosts */ ,
+ int * /*pLen */ ,
+ BOOL * /*pEnabled */ );
-typedef struct sockaddr * sockaddrPtr;
+typedef struct sockaddr *sockaddrPtr;
-extern _X_EXPORT int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client);
+extern _X_EXPORT int
+InvalidHost(sockaddrPtr /*saddr */ , int /*len */ , ClientPtr client);
-extern _X_EXPORT int LocalClient(ClientPtr /* client */);
+extern _X_EXPORT int
+LocalClient(ClientPtr /* client */ );
-extern _X_EXPORT int LocalClientCred(ClientPtr, int *, int *);
+extern _X_EXPORT int
+LocalClientCred(ClientPtr, int *, int *);
#define LCC_UID_SET (1 << 0)
#define LCC_GID_SET (1 << 1)
@@ -365,88 +405,101 @@ extern _X_EXPORT int LocalClientCred(ClientPtr, int *, int *);
#define LCC_ZID_SET (1 << 3)
typedef struct {
- int fieldsSet; /* Bit mask of fields set */
- int euid; /* Effective uid */
- int egid; /* Primary effective group id */
- int nSuppGids; /* Number of supplementary group ids */
- int *pSuppGids; /* Array of supplementary group ids */
- int pid; /* Process id */
- int zoneid; /* Only set on Solaris 10 & later */
+ int fieldsSet; /* Bit mask of fields set */
+ int euid; /* Effective uid */
+ int egid; /* Primary effective group id */
+ int nSuppGids; /* Number of supplementary group ids */
+ int *pSuppGids; /* Array of supplementary group ids */
+ int pid; /* Process id */
+ int zoneid; /* Only set on Solaris 10 & later */
} LocalClientCredRec;
-extern _X_EXPORT int GetLocalClientCreds(ClientPtr, LocalClientCredRec **);
-extern _X_EXPORT void FreeLocalClientCreds(LocalClientCredRec *);
-
-extern _X_EXPORT int ChangeAccessControl(ClientPtr /*client*/, int /*fEnabled*/);
+extern _X_EXPORT int
+GetLocalClientCreds(ClientPtr, LocalClientCredRec **);
+extern _X_EXPORT void
+FreeLocalClientCreds(LocalClientCredRec *);
-extern _X_EXPORT int GetAccessControl(void);
+extern _X_EXPORT int
+ChangeAccessControl(ClientPtr /*client */ , int /*fEnabled */ );
+extern _X_EXPORT int
+GetAccessControl(void);
-extern _X_EXPORT void AddLocalHosts(void);
+extern _X_EXPORT void
+AddLocalHosts(void);
-extern _X_EXPORT void ResetHosts(char *display);
+extern _X_EXPORT void
+ResetHosts(char *display);
-extern _X_EXPORT void EnableLocalHost(void);
+extern _X_EXPORT void
+EnableLocalHost(void);
-extern _X_EXPORT void DisableLocalHost(void);
+extern _X_EXPORT void
+DisableLocalHost(void);
-extern _X_EXPORT void AccessUsingXdmcp(void);
+extern _X_EXPORT void
+AccessUsingXdmcp(void);
-extern _X_EXPORT void DefineSelf(int /*fd*/, const int /*protocol*/);
+extern _X_EXPORT void
+DefineSelf(int /*fd */ , const int /*protocol*/);
#if XDMCP
-extern _X_EXPORT void AugmentSelf(pointer /*from*/, int /*len*/);
+extern _X_EXPORT void
+AugmentSelf(pointer /*from */ , int /*len */ );
-extern _X_EXPORT void RegisterAuthorizations(void);
+extern _X_EXPORT void
+RegisterAuthorizations(void);
#endif
-extern _X_EXPORT void InitAuthorization(char * /*filename*/);
+extern _X_EXPORT void
+InitAuthorization(char * /*filename */ );
/* extern int LoadAuthorization(void); */
-extern _X_EXPORT int AuthorizationFromID (
- XID id,
- unsigned short *name_lenp,
- const char **namep,
- unsigned short *data_lenp,
- char **datap);
-
-extern _X_EXPORT XID CheckAuthorization(
- unsigned int /*namelength*/,
- const char * /*name*/,
- unsigned int /*datalength*/,
- const char * /*data*/,
- ClientPtr /*client*/,
- const char ** /*reason*/
-);
-
-extern _X_EXPORT void ResetAuthorization(void);
-
-extern _X_EXPORT int RemoveAuthorization (
- unsigned short name_length,
- const char *name,
- unsigned short data_length,
- const char *data);
-
-extern _X_EXPORT int AddAuthorization(
- unsigned int /*name_length*/,
- const char * /*name*/,
- unsigned int /*data_length*/,
- char * /*data*/);
+extern _X_EXPORT int
+AuthorizationFromID(XID id,
+ unsigned short *name_lenp,
+ const char **namep,
+ unsigned short *data_lenp, char **datap);
+
+extern _X_EXPORT XID
+CheckAuthorization(unsigned int /*namelength */ ,
+ const char * /*name */ ,
+ unsigned int /*datalength */ ,
+ const char * /*data */ ,
+ ClientPtr /*client */ ,
+ const char ** /*reason */
+ );
+
+extern _X_EXPORT void
+ResetAuthorization(void);
+
+extern _X_EXPORT int
+RemoveAuthorization(unsigned short name_length,
+ const char *name,
+ unsigned short data_length, const char *data);
+
+extern _X_EXPORT int
+AddAuthorization(unsigned int /*name_length */ ,
+ const char * /*name */ ,
+ unsigned int /*data_length */ ,
+ char * /*data */ );
#ifdef XCSECURITY
-extern _X_EXPORT XID GenerateAuthorization(
- unsigned int /* name_length */,
- const char * /* name */,
- unsigned int /* data_length */,
- const char * /* data */,
- unsigned int * /* data_length_return */,
- char ** /* data_return */);
+extern _X_EXPORT XID
+GenerateAuthorization(unsigned int /* name_length */ ,
+ const char * /* name */ ,
+ unsigned int /* data_length */ ,
+ const char * /* data */ ,
+ unsigned int * /* data_length_return */ ,
+ char ** /* data_return */ );
#endif
-extern _X_EXPORT int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/);
+extern _X_EXPORT int
+ddxProcessArgument(int /*argc */ , char * /*argv */ [], int /*i */ );
-extern _X_EXPORT void ddxUseMsg(void);
+extern _X_EXPORT void
+ddxUseMsg(void);
/* stuff for ReplyCallback */
extern _X_EXPORT CallbackListPtr ReplyCallback;
@@ -463,39 +516,48 @@ typedef struct {
extern _X_EXPORT CallbackListPtr FlushCallback;
enum ExitCode {
- EXIT_NO_ERROR = 0,
- EXIT_ERR_ABORT = 1,
- EXIT_ERR_CONFIGURE = 2,
- EXIT_ERR_DRIVERS = 3,
+ EXIT_NO_ERROR = 0,
+ EXIT_ERR_ABORT = 1,
+ EXIT_ERR_CONFIGURE = 2,
+ EXIT_ERR_DRIVERS = 3,
};
-extern _X_EXPORT void AbortDDX(enum ExitCode error);
-extern _X_EXPORT void ddxGiveUp(enum ExitCode error);
-extern _X_EXPORT int TimeSinceLastInputEvent(void);
+extern _X_EXPORT void
+AbortDDX(enum ExitCode error);
+extern _X_EXPORT void
+ddxGiveUp(enum ExitCode error);
+extern _X_EXPORT int
+TimeSinceLastInputEvent(void);
/* strcasecmp.c */
#ifndef HAVE_STRCASECMP
#define strcasecmp xstrcasecmp
-extern _X_EXPORT int xstrcasecmp(const char *s1, const char *s2);
+extern _X_EXPORT int
+xstrcasecmp(const char *s1, const char *s2);
#endif
#ifndef HAVE_STRNCASECMP
#define strncasecmp xstrncasecmp
-extern _X_EXPORT int xstrncasecmp(const char *s1, const char *s2, size_t n);
+extern _X_EXPORT int
+xstrncasecmp(const char *s1, const char *s2, size_t n);
#endif
#ifndef HAVE_STRCASESTR
#define strcasestr xstrcasestr
-extern _X_EXPORT char *xstrcasestr(const char *s, const char *find);
+extern _X_EXPORT char *
+xstrcasestr(const char *s, const char *find);
#endif
#ifndef HAVE_STRLCPY
-extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz);
-extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz);
+extern _X_EXPORT size_t
+strlcpy(char *dst, const char *src, size_t siz);
+extern _X_EXPORT size_t
+strlcat(char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_STRNDUP
-extern _X_EXPORT char * strndup(const char *str, size_t n);
+extern _X_EXPORT char *
+strndup(const char *str, size_t n);
#endif
/* Logging. */
@@ -508,52 +570,77 @@ typedef enum _LogParameter {
/* Flags for log messages. */
typedef enum {
- X_PROBED, /* Value was probed */
- X_CONFIG, /* Value was given in the config file */
- X_DEFAULT, /* Value is a default */
- X_CMDLINE, /* Value was given on the command line */
- X_NOTICE, /* Notice */
- X_ERROR, /* Error message */
- X_WARNING, /* Warning message */
- X_INFO, /* Informational message */
- X_NONE, /* No prefix */
- X_NOT_IMPLEMENTED, /* Not implemented */
- X_UNKNOWN = -1 /* unknown -- this must always be last */
+ X_PROBED, /* Value was probed */
+ X_CONFIG, /* Value was given in the config file */
+ X_DEFAULT, /* Value is a default */
+ X_CMDLINE, /* Value was given on the command line */
+ X_NOTICE, /* Notice */
+ X_ERROR, /* Error message */
+ X_WARNING, /* Warning message */
+ X_INFO, /* Informational message */
+ X_NONE, /* No prefix */
+ X_NOT_IMPLEMENTED, /* Not implemented */
+ X_DEBUG, /* Debug message */
+ X_UNKNOWN = -1 /* unknown -- this must always be last */
} MessageType;
-extern _X_EXPORT const char *LogInit(const char *fname, const char *backup);
-extern _X_EXPORT void LogClose(enum ExitCode error);
-extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value);
-extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args) _X_ATTRIBUTE_PRINTF(2,0);
-extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
-extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format,
- va_list args) _X_ATTRIBUTE_PRINTF(3,0);
-extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format,
- ...) _X_ATTRIBUTE_PRINTF(3,4);
-extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
- _X_ATTRIBUTE_PRINTF(2,3);
-
-extern _X_EXPORT void LogVHdrMessageVerb(MessageType type, int verb,
- const char *msg_format, va_list msg_args,
- const char *hdr_format, va_list hdr_args)
- _X_ATTRIBUTE_PRINTF(3,0) _X_ATTRIBUTE_PRINTF(5,0);
-extern _X_EXPORT void LogHdrMessageVerb(MessageType type, int verb,
- const char *msg_format, va_list msg_args,
- const char *hdr_format, ...)
- _X_ATTRIBUTE_PRINTF(3,0) _X_ATTRIBUTE_PRINTF(5,6);
-extern _X_EXPORT void LogHdrMessage(MessageType type, const char *msg_format,
- va_list msg_args, const char *hdr_format, ...)
- _X_ATTRIBUTE_PRINTF(2,0) _X_ATTRIBUTE_PRINTF(4,5);
-
-extern _X_EXPORT void FreeAuditTimer(void);
-extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
-extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
-extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
+extern _X_EXPORT const char *
+LogInit(const char *fname, const char *backup);
+extern _X_EXPORT void
+LogClose(enum ExitCode error);
+extern _X_EXPORT Bool
+LogSetParameter(LogParameter param, int value);
+extern _X_EXPORT void
+LogVWrite(int verb, const char *f, va_list args)
+_X_ATTRIBUTE_PRINTF(2, 0);
+extern _X_EXPORT void
+LogWrite(int verb, const char *f, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
+extern _X_EXPORT void
+LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
+_X_ATTRIBUTE_PRINTF(3, 0);
+extern _X_EXPORT void
+LogMessageVerb(MessageType type, int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(3, 4);
+extern _X_EXPORT void
+LogMessage(MessageType type, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
+
+extern _X_EXPORT void
+LogVHdrMessageVerb(MessageType type, int verb,
+ const char *msg_format, va_list msg_args,
+ const char *hdr_format, va_list hdr_args)
+_X_ATTRIBUTE_PRINTF(3, 0)
+_X_ATTRIBUTE_PRINTF(5, 0);
+extern _X_EXPORT void
+LogHdrMessageVerb(MessageType type, int verb,
+ const char *msg_format, va_list msg_args,
+ const char *hdr_format, ...)
+_X_ATTRIBUTE_PRINTF(3, 0)
+_X_ATTRIBUTE_PRINTF(5, 6);
+extern _X_EXPORT void
+LogHdrMessage(MessageType type, const char *msg_format,
+ va_list msg_args, const char *hdr_format, ...)
+_X_ATTRIBUTE_PRINTF(2, 0)
+_X_ATTRIBUTE_PRINTF(4, 5);
+
+extern _X_EXPORT void
+FreeAuditTimer(void);
+extern _X_EXPORT void
+AuditF(const char *f, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+extern _X_EXPORT void
+VAuditF(const char *f, va_list args)
+_X_ATTRIBUTE_PRINTF(1, 0);
+extern _X_EXPORT void
+FatalError(const char *f, ...)
+_X_ATTRIBUTE_PRINTF(1, 2)
+ _X_NORETURN;
#ifdef DEBUG
#define DebugF ErrorF
#else
-#define DebugF(...) /* */
+#define DebugF(...) /* */
#endif
#ifdef _MSC_VER
@@ -566,14 +653,20 @@ extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X
#define SERVEXTERN _X_EXPORT
#endif
-extern _X_EXPORT void VErrorF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
-extern SERVEXTERN void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
-extern _X_EXPORT void LogPrintMarkers(void);
+extern _X_EXPORT void
+VErrorF(const char *f, va_list args)
+_X_ATTRIBUTE_PRINTF(1, 0);
+extern SERVEXTERN void
+ErrorF(const char *f, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+extern _X_EXPORT void
+LogPrintMarkers(void);
-extern _X_EXPORT void xorg_backtrace(void);
+extern _X_EXPORT void
+xorg_backtrace(void);
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
-#endif /* OS_H */
+#endif /* OS_H */
diff --git a/xorg-server/include/pixmap.h b/xorg-server/include/pixmap.h
index dc76a5b54..26d737c4d 100644
--- a/xorg-server/include/pixmap.h
+++ b/xorg-server/include/pixmap.h
@@ -1,119 +1,112 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifndef PIXMAP_H
-#define PIXMAP_H
-
-#include "misc.h"
-#include "screenint.h"
-
-/* types for Drawable */
-#define DRAWABLE_WINDOW 0
-#define DRAWABLE_PIXMAP 1
-#define UNDRAWABLE_WINDOW 2
-
-/* corresponding type masks for dixLookupDrawable() */
-#define M_DRAWABLE_WINDOW (1<<0)
-#define M_DRAWABLE_PIXMAP (1<<1)
-#define M_UNDRAWABLE_WINDOW (1<<2)
-#define M_ANY (-1)
-#define M_WINDOW (M_DRAWABLE_WINDOW|M_UNDRAWABLE_WINDOW)
-#define M_DRAWABLE (M_DRAWABLE_WINDOW|M_DRAWABLE_PIXMAP)
-#define M_UNDRAWABLE (M_UNDRAWABLE_WINDOW)
-
-/* flags to PaintWindow() */
-#define PW_BACKGROUND 0
-#define PW_BORDER 1
-
-#define NullPixmap ((PixmapPtr)0)
-
-typedef struct _Drawable *DrawablePtr;
-typedef struct _Pixmap *PixmapPtr;
-
-typedef union _PixUnion {
- PixmapPtr pixmap;
- unsigned long pixel;
-} PixUnion;
-
-#define SamePixUnion(a,b,isPixel)\
- ((isPixel) ? (a).pixel == (b).pixel : (a).pixmap == (b).pixmap)
-
-#define EqualPixUnion(as, a, bs, b) \
- ((as) == (bs) && (SamePixUnion (a, b, as)))
-
-#define OnScreenDrawable(type) \
- (type == DRAWABLE_WINDOW)
-
-#define WindowDrawable(type) \
- ((type == DRAWABLE_WINDOW) || (type == UNDRAWABLE_WINDOW))
-
-extern _X_EXPORT PixmapPtr GetScratchPixmapHeader(
- ScreenPtr /*pScreen*/,
- int /*width*/,
- int /*height*/,
- int /*depth*/,
- int /*bitsPerPixel*/,
- int /*devKind*/,
- pointer /*pPixData*/);
-
-extern _X_EXPORT void FreeScratchPixmapHeader(
- PixmapPtr /*pPixmap*/);
-
-extern _X_EXPORT Bool CreateScratchPixmapsForScreen(
- int /*scrnum*/);
-
-extern _X_EXPORT void FreeScratchPixmapsForScreen(
- int /*scrnum*/);
-
-extern _X_EXPORT PixmapPtr AllocatePixmap(
- ScreenPtr /*pScreen*/,
- int /*pixDataSize*/);
-
-extern _X_EXPORT void FreePixmap(
- PixmapPtr /*pPixmap*/);
-
-#endif /* PIXMAP_H */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef PIXMAP_H
+#define PIXMAP_H
+
+#include "misc.h"
+#include "screenint.h"
+
+/* types for Drawable */
+#define DRAWABLE_WINDOW 0
+#define DRAWABLE_PIXMAP 1
+#define UNDRAWABLE_WINDOW 2
+
+/* corresponding type masks for dixLookupDrawable() */
+#define M_DRAWABLE_WINDOW (1<<0)
+#define M_DRAWABLE_PIXMAP (1<<1)
+#define M_UNDRAWABLE_WINDOW (1<<2)
+#define M_ANY (-1)
+#define M_WINDOW (M_DRAWABLE_WINDOW|M_UNDRAWABLE_WINDOW)
+#define M_DRAWABLE (M_DRAWABLE_WINDOW|M_DRAWABLE_PIXMAP)
+#define M_UNDRAWABLE (M_UNDRAWABLE_WINDOW)
+
+/* flags to PaintWindow() */
+#define PW_BACKGROUND 0
+#define PW_BORDER 1
+
+#define NullPixmap ((PixmapPtr)0)
+
+typedef struct _Drawable *DrawablePtr;
+typedef struct _Pixmap *PixmapPtr;
+
+typedef union _PixUnion {
+ PixmapPtr pixmap;
+ unsigned long pixel;
+} PixUnion;
+
+#define SamePixUnion(a,b,isPixel)\
+ ((isPixel) ? (a).pixel == (b).pixel : (a).pixmap == (b).pixmap)
+
+#define EqualPixUnion(as, a, bs, b) \
+ ((as) == (bs) && (SamePixUnion (a, b, as)))
+
+#define OnScreenDrawable(type) \
+ (type == DRAWABLE_WINDOW)
+
+#define WindowDrawable(type) \
+ ((type == DRAWABLE_WINDOW) || (type == UNDRAWABLE_WINDOW))
+
+extern _X_EXPORT PixmapPtr GetScratchPixmapHeader(ScreenPtr /*pScreen */ ,
+ int /*width */ ,
+ int /*height */ ,
+ int /*depth */ ,
+ int /*bitsPerPixel */ ,
+ int /*devKind */ ,
+ pointer /*pPixData */ );
+
+extern _X_EXPORT void FreeScratchPixmapHeader(PixmapPtr /*pPixmap */ );
+
+extern _X_EXPORT Bool CreateScratchPixmapsForScreen(int /*scrnum */ );
+
+extern _X_EXPORT void FreeScratchPixmapsForScreen(int /*scrnum */ );
+
+extern _X_EXPORT PixmapPtr AllocatePixmap(ScreenPtr /*pScreen */ ,
+ int /*pixDataSize */ );
+
+extern _X_EXPORT void FreePixmap(PixmapPtr /*pPixmap */ );
+
+#endif /* PIXMAP_H */
diff --git a/xorg-server/include/privates.h b/xorg-server/include/privates.h
index 2b0040cba..c34b9512c 100644
--- a/xorg-server/include/privates.h
+++ b/xorg-server/include/privates.h
@@ -58,16 +58,16 @@ typedef enum {
} DevPrivateType;
typedef struct _DevPrivateKeyRec {
- int offset;
- int size;
- Bool initialized;
- Bool allocated;
- DevPrivateType type;
- struct _DevPrivateKeyRec *next;
+ int offset;
+ int size;
+ Bool initialized;
+ Bool allocated;
+ DevPrivateType type;
+ struct _DevPrivateKeyRec *next;
} DevPrivateKeyRec, *DevPrivateKey;
typedef struct _DevScreenPrivateKeyRec {
- DevPrivateKeyRec screenKey;
+ DevPrivateKeyRec screenKey;
} DevScreenPrivateKeyRec, *DevScreenPrivateKey;
/*
@@ -93,7 +93,7 @@ typedef struct _DevScreenPrivateKeyRec {
* during its operation.
*/
extern _X_EXPORT Bool
-dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size);
+ dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size);
/*
* Check whether a private key has been registered
@@ -127,7 +127,7 @@ dixGetPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
static inline void *
dixGetPrivate(PrivatePtr *privates, const DevPrivateKey key)
{
- assert (key->size == 0);
+ assert(key->size == 0);
return *(void **) dixGetPrivateAddr(privates, key);
}
@@ -138,7 +138,7 @@ dixGetPrivate(PrivatePtr *privates, const DevPrivateKey key)
static inline void
dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, pointer val)
{
- assert (key->size == 0);
+ assert(key->size == 0);
*(pointer *) dixGetPrivateAddr(privates, key) = val;
}
@@ -156,9 +156,9 @@ static inline pointer
dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key)
{
if (key->size)
- return dixGetPrivateAddr(privates, key);
+ return dixGetPrivateAddr(privates, key);
else
- return dixGetPrivate(privates, key);
+ return dixGetPrivate(privates, key);
}
/*
@@ -170,44 +170,52 @@ dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key)
static inline pointer *
dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
{
- assert (key->size == 0);
- return (pointer *)dixGetPrivateAddr(privates, key);
+ assert(key->size == 0);
+ return (pointer *) dixGetPrivateAddr(privates, key);
}
extern _X_EXPORT Bool
-dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen, DevPrivateType type, unsigned size);
+
+dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen,
+ DevPrivateType type, unsigned size);
extern _X_EXPORT DevPrivateKey
-_dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen);
+ _dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen);
static inline void *
-dixGetScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+dixGetScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key,
+ ScreenPtr pScreen)
{
return dixGetPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline void *
-dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key,
+ ScreenPtr pScreen)
{
return dixGetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline void
-dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen, pointer val)
+dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key,
+ ScreenPtr pScreen, pointer val)
{
dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val);
}
static inline pointer
-dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key,
+ ScreenPtr pScreen)
{
return dixLookupPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline pointer *
-dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key,
+ ScreenPtr pScreen)
{
- return dixLookupPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
+ return dixLookupPrivateAddr(privates,
+ _dixGetScreenPrivateKey(key, pScreen));
}
/*
@@ -220,19 +228,19 @@ dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key,
* extensions entries.
*/
extern _X_EXPORT Bool
-dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type);
+ dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type);
/*
* Frees separately allocated private data
*/
extern _X_EXPORT void
-dixFreePrivates(PrivatePtr privates, DevPrivateType type);
+ dixFreePrivates(PrivatePtr privates, DevPrivateType type);
/*
* Initialize privates by zeroing them
*/
extern _X_EXPORT void
-_dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type);
+ _dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type);
#define dixInitPrivates(o, v, type) _dixInitPrivates(&(o)->devPrivates, (v), type);
@@ -240,7 +248,7 @@ _dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type);
* Clean up privates
*/
extern _X_EXPORT void
-_dixFiniPrivates(PrivatePtr privates, DevPrivateType type);
+ _dixFiniPrivates(PrivatePtr privates, DevPrivateType type);
#define dixFiniPrivates(o,t) _dixFiniPrivates((o)->devPrivates,t)
@@ -249,13 +257,17 @@ _dixFiniPrivates(PrivatePtr privates, DevPrivateType type);
* for almost all objects, except for the list described
* above for dixAllocatePrivates.
*/
-extern _X_EXPORT void *
-_dixAllocateObjectWithPrivates(unsigned size, unsigned clear, unsigned offset, DevPrivateType type);
+extern _X_EXPORT void *_dixAllocateObjectWithPrivates(unsigned size,
+ unsigned clear,
+ unsigned offset,
+ DevPrivateType type);
#define dixAllocateObjectWithPrivates(t, type) (t *) _dixAllocateObjectWithPrivates(sizeof(t), sizeof(t), offsetof(t, devPrivates), type)
extern _X_EXPORT void
-_dixFreeObjectWithPrivates(void *object, PrivatePtr privates, DevPrivateType type);
+
+_dixFreeObjectWithPrivates(void *object, PrivatePtr privates,
+ DevPrivateType type);
#define dixFreeObjectWithPrivates(o,t) _dixFreeObjectWithPrivates(o, (o)->devPrivates, t)
@@ -263,20 +275,20 @@ _dixFreeObjectWithPrivates(void *object, PrivatePtr privates, DevPrivateType typ
* Return size of privates for the specified type
*/
extern _X_EXPORT int
-dixPrivatesSize(DevPrivateType type);
+ dixPrivatesSize(DevPrivateType type);
/*
* Dump out private stats to ErrorF
*/
extern void
-dixPrivateUsage(void);
+ dixPrivateUsage(void);
/*
* Resets the privates subsystem. dixResetPrivates is called from the main loop
* before each server generation. This function must only be called by main().
*/
extern _X_EXPORT void
-dixResetPrivates(void);
+ dixResetPrivates(void);
/*
* Looks up the offset where the devPrivates field is located.
@@ -287,7 +299,7 @@ dixResetPrivates(void);
* structure definition.
*/
extern _X_EXPORT int
-dixLookupPrivateOffset(RESTYPE type);
+ dixLookupPrivateOffset(RESTYPE type);
/*
* Convenience macro for adding an offset to an object pointer
@@ -295,4 +307,4 @@ dixLookupPrivateOffset(RESTYPE type);
*/
#define DEVPRIV_AT(ptr, offset) ((PrivatePtr *)((char *)(ptr) + offset))
-#endif /* PRIVATES_H */
+#endif /* PRIVATES_H */
diff --git a/xorg-server/include/property.h b/xorg-server/include/property.h
index 075eb4a0d..4219fc487 100644
--- a/xorg-server/include/property.h
+++ b/xorg-server/include/property.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -46,46 +45,41 @@ SOFTWARE.
******************************************************************/
#ifndef PROPERTY_H
-#define PROPERTY_H
+#define PROPERTY_H
#include "window.h"
typedef struct _Property *PropertyPtr;
-extern _X_EXPORT int dixLookupProperty(
- PropertyPtr * /*result*/,
- WindowPtr /*pWin*/,
- Atom /*proprty*/,
- ClientPtr /*pClient*/,
- Mask /*access_mode*/);
-
-extern _X_EXPORT int dixChangeWindowProperty(
- ClientPtr /*pClient*/,
- WindowPtr /*pWin*/,
- Atom /*property*/,
- Atom /*type*/,
- int /*format*/,
- int /*mode*/,
- unsigned long /*len*/,
- pointer /*value*/,
- Bool /*sendevent*/);
-
-extern _X_EXPORT int ChangeWindowProperty(
- WindowPtr /*pWin*/,
- Atom /*property*/,
- Atom /*type*/,
- int /*format*/,
- int /*mode*/,
- unsigned long /*len*/,
- pointer /*value*/,
- Bool /*sendevent*/);
-
-extern _X_EXPORT int DeleteProperty(
- ClientPtr /*client*/,
- WindowPtr /*pWin*/,
- Atom /*propName*/);
-
-extern _X_EXPORT void DeleteAllWindowProperties(
- WindowPtr /*pWin*/);
-
-#endif /* PROPERTY_H */
+extern _X_EXPORT int dixLookupProperty(PropertyPtr * /*result */ ,
+ WindowPtr /*pWin */ ,
+ Atom /*proprty */ ,
+ ClientPtr /*pClient */ ,
+ Mask /*access_mode */ );
+
+extern _X_EXPORT int dixChangeWindowProperty(ClientPtr /*pClient */ ,
+ WindowPtr /*pWin */ ,
+ Atom /*property */ ,
+ Atom /*type */ ,
+ int /*format */ ,
+ int /*mode */ ,
+ unsigned long /*len */ ,
+ pointer /*value */ ,
+ Bool /*sendevent */ );
+
+extern _X_EXPORT int ChangeWindowProperty(WindowPtr /*pWin */ ,
+ Atom /*property */ ,
+ Atom /*type */ ,
+ int /*format */ ,
+ int /*mode */ ,
+ unsigned long /*len */ ,
+ pointer /*value */ ,
+ Bool /*sendevent */ );
+
+extern _X_EXPORT int DeleteProperty(ClientPtr /*client */ ,
+ WindowPtr /*pWin */ ,
+ Atom /*propName */ );
+
+extern _X_EXPORT void DeleteAllWindowProperties(WindowPtr /*pWin */ );
+
+#endif /* PROPERTY_H */
diff --git a/xorg-server/include/regionstr.h b/xorg-server/include/regionstr.h
index 3dfef5c83..805257b3f 100644
--- a/xorg-server/include/regionstr.h
+++ b/xorg-server/include/regionstr.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -69,61 +68,79 @@ typedef struct pixman_region16_data RegDataRec, *RegDataPtr;
extern _X_EXPORT BoxRec RegionEmptyBox;
extern _X_EXPORT RegDataRec RegionEmptyData;
extern _X_EXPORT RegDataRec RegionBrokenData;
-static inline Bool RegionNil(RegionPtr reg) {
+static inline Bool
+RegionNil(RegionPtr reg)
+{
return ((reg)->data && !(reg)->data->numRects);
}
/* not a region */
-static inline Bool RegionNar(RegionPtr reg) {
+static inline Bool
+RegionNar(RegionPtr reg)
+{
return ((reg)->data == &RegionBrokenData);
}
-static inline int RegionNumRects(RegionPtr reg) {
+static inline int
+RegionNumRects(RegionPtr reg)
+{
return ((reg)->data ? (reg)->data->numRects : 1);
}
-static inline int RegionSize(RegionPtr reg) {
+static inline int
+RegionSize(RegionPtr reg)
+{
return ((reg)->data ? (reg)->data->size : 0);
}
-static inline BoxPtr RegionRects(RegionPtr reg) {
- return ((reg)->data ? (BoxPtr)((reg)->data + 1) : &(reg)->extents);
+static inline BoxPtr
+RegionRects(RegionPtr reg)
+{
+ return ((reg)->data ? (BoxPtr) ((reg)->data + 1) : &(reg)->extents);
}
-static inline BoxPtr RegionBoxptr(RegionPtr reg) {
- return ((BoxPtr)((reg)->data + 1));
+static inline BoxPtr
+RegionBoxptr(RegionPtr reg)
+{
+ return ((BoxPtr) ((reg)->data + 1));
}
-static inline BoxPtr RegionBox(RegionPtr reg, int i) {
+static inline BoxPtr
+RegionBox(RegionPtr reg, int i)
+{
return (&RegionBoxptr(reg)[i]);
}
-static inline BoxPtr RegionTop(RegionPtr reg) {
+static inline BoxPtr
+RegionTop(RegionPtr reg)
+{
return RegionBox(reg, (reg)->data->numRects);
}
-static inline BoxPtr RegionEnd(RegionPtr reg) {
+static inline BoxPtr
+RegionEnd(RegionPtr reg)
+{
return RegionBox(reg, (reg)->data->numRects - 1);
}
-static inline size_t RegionSizeof(int n) {
+static inline size_t
+RegionSizeof(int n)
+{
return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)));
}
-static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
+static inline void
+RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
{
- if ((_rect) != NULL)
- {
+ if ((_rect) != NULL) {
(_pReg)->extents = *(_rect);
- (_pReg)->data = (RegDataPtr)NULL;
+ (_pReg)->data = (RegDataPtr) NULL;
}
- else
- {
+ else {
(_pReg)->extents = RegionEmptyBox;
if (((_size) > 1) && ((_pReg)->data =
- (RegDataPtr)malloc(RegionSizeof(_size))))
- {
+ (RegDataPtr) malloc(RegionSizeof(_size)))) {
(_pReg)->data->size = (_size);
(_pReg)->data->numRects = 0;
}
@@ -132,35 +149,43 @@ static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
}
}
-static inline Bool RegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes)
+static inline Bool
+RegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes)
{
- return pixman_region_init_rects (pReg, boxes, nBoxes);
+ return pixman_region_init_rects(pReg, boxes, nBoxes);
}
-static inline void RegionUninit(RegionPtr _pReg)
+static inline void
+RegionUninit(RegionPtr _pReg)
{
if ((_pReg)->data && (_pReg)->data->size) {
- free((_pReg)->data);
- (_pReg)->data = NULL;
+ free((_pReg)->data);
+ (_pReg)->data = NULL;
}
}
-static inline void RegionReset(RegionPtr _pReg, BoxPtr _pBox)
+static inline void
+RegionReset(RegionPtr _pReg, BoxPtr _pBox)
{
(_pReg)->extents = *(_pBox);
RegionUninit(_pReg);
- (_pReg)->data = (RegDataPtr)NULL;
+ (_pReg)->data = (RegDataPtr) NULL;
}
-static inline Bool RegionNotEmpty(RegionPtr _pReg) {
+static inline Bool
+RegionNotEmpty(RegionPtr _pReg)
+{
return !RegionNil(_pReg);
}
-static inline Bool RegionBroken(RegionPtr _pReg) {
+static inline Bool
+RegionBroken(RegionPtr _pReg)
+{
return RegionNar(_pReg);
}
-static inline void RegionEmpty(RegionPtr _pReg)
+static inline void
+RegionEmpty(RegionPtr _pReg)
{
RegionUninit(_pReg);
(_pReg)->extents.x2 = (_pReg)->extents.x1;
@@ -168,12 +193,14 @@ static inline void RegionEmpty(RegionPtr _pReg)
(_pReg)->data = &RegionEmptyData;
}
-static inline BoxPtr RegionExtents(RegionPtr _pReg)
+static inline BoxPtr
+RegionExtents(RegionPtr _pReg)
{
return (&(_pReg)->extents);
}
-static inline void RegionNull(RegionPtr _pReg)
+static inline void
+RegionNull(RegionPtr _pReg)
{
(_pReg)->extents = RegionEmptyBox;
(_pReg)->data = &RegionEmptyData;
@@ -181,51 +208,42 @@ static inline void RegionNull(RegionPtr _pReg)
extern _X_EXPORT void InitRegions(void);
-extern _X_EXPORT RegionPtr RegionCreate(
- BoxPtr /*rect*/,
- int /*size*/);
+extern _X_EXPORT RegionPtr RegionCreate(BoxPtr /*rect */ ,
+ int /*size */ );
-extern _X_EXPORT void RegionDestroy(
- RegionPtr /*pReg*/);
+extern _X_EXPORT void RegionDestroy(RegionPtr /*pReg */ );
static inline Bool
RegionCopy(RegionPtr dst, RegionPtr src)
{
- return pixman_region_copy (dst, src);
+ return pixman_region_copy(dst, src);
}
static inline Bool
-RegionIntersect(
- RegionPtr newReg, /* destination Region */
- RegionPtr reg1,
- RegionPtr reg2 /* source regions */
+RegionIntersect(RegionPtr newReg, /* destination Region */
+ RegionPtr reg1, RegionPtr reg2 /* source regions */
)
{
- return pixman_region_intersect (newReg, reg1, reg2);
+ return pixman_region_intersect(newReg, reg1, reg2);
}
static inline Bool
-RegionUnion(
- RegionPtr newReg, /* destination Region */
- RegionPtr reg1,
- RegionPtr reg2 /* source regions */
+RegionUnion(RegionPtr newReg, /* destination Region */
+ RegionPtr reg1, RegionPtr reg2 /* source regions */
)
{
- return pixman_region_union (newReg, reg1, reg2);
+ return pixman_region_union(newReg, reg1, reg2);
}
-extern _X_EXPORT Bool RegionAppend(
- RegionPtr /*dstrgn*/,
- RegionPtr /*rgn*/);
+extern _X_EXPORT Bool RegionAppend(RegionPtr /*dstrgn */ ,
+ RegionPtr /*rgn */ );
-extern _X_EXPORT Bool RegionValidate(
- RegionPtr /*badreg*/,
- Bool * /*pOverlap*/);
+extern _X_EXPORT Bool RegionValidate(RegionPtr /*badreg */ ,
+ Bool * /*pOverlap */ );
-extern _X_EXPORT RegionPtr RegionFromRects(
- int /*nrects*/,
- xRectanglePtr /*prect*/,
- int /*ctype*/);
+extern _X_EXPORT RegionPtr RegionFromRects(int /*nrects */ ,
+ xRectanglePtr /*prect */ ,
+ int /*ctype */ );
/*-
*-----------------------------------------------------------------------
@@ -244,7 +262,7 @@ extern _X_EXPORT RegionPtr RegionFromRects(
static inline Bool
RegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
{
- return pixman_region_subtract (regD, regM, regS);
+ return pixman_region_subtract(regD, regM, regS);
}
/*-
@@ -264,19 +282,18 @@ RegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
*/
static inline Bool
-RegionInverse(
- RegionPtr newReg, /* Destination region */
- RegionPtr reg1, /* Region to invert */
- BoxPtr invRect /* Bounding box for inversion */
+RegionInverse(RegionPtr newReg, /* Destination region */
+ RegionPtr reg1, /* Region to invert */
+ BoxPtr invRect /* Bounding box for inversion */
)
{
- return pixman_region_inverse (newReg, reg1, invRect);
+ return pixman_region_inverse(newReg, reg1, invRect);
}
static inline int
RegionContainsRect(RegionPtr region, BoxPtr prect)
{
- return pixman_region_contains_rectangle (region, prect);
+ return pixman_region_contains_rectangle(region, prect);
}
/* TranslateRegion(pReg, x, y)
@@ -286,42 +303,34 @@ RegionContainsRect(RegionPtr region, BoxPtr prect)
static inline void
RegionTranslate(RegionPtr pReg, int x, int y)
{
- pixman_region_translate (pReg, x, y);
+ pixman_region_translate(pReg, x, y);
}
-extern _X_EXPORT Bool RegionBreak(
- RegionPtr /*pReg*/);
+extern _X_EXPORT Bool RegionBreak(RegionPtr /*pReg */ );
static inline Bool
-RegionContainsPoint(
- RegionPtr pReg,
- int x,
- int y,
- BoxPtr box /* "return" value */
+RegionContainsPoint(RegionPtr pReg, int x, int y, BoxPtr box /* "return" value */
)
{
- return pixman_region_contains_point (pReg, x, y, box);
+ return pixman_region_contains_point(pReg, x, y, box);
}
static inline Bool
RegionEqual(RegionPtr reg1, RegionPtr reg2)
{
- return pixman_region_equal (reg1, reg2);
+ return pixman_region_equal(reg1, reg2);
}
-extern _X_EXPORT Bool RegionRectAlloc(
- RegionPtr /*pRgn*/,
- int /*n*/
-);
+extern _X_EXPORT Bool RegionRectAlloc(RegionPtr /*pRgn */ ,
+ int /*n */
+ );
#ifdef DEBUG
-extern _X_EXPORT Bool RegionIsValid(
- RegionPtr /*prgn*/
-);
+extern _X_EXPORT Bool RegionIsValid(RegionPtr /*prgn */
+ );
#endif
-extern _X_EXPORT void RegionPrint(
- RegionPtr /*pReg*/);
+extern _X_EXPORT void RegionPrint(RegionPtr /*pReg */ );
#define INCLUDE_LEGACY_REGION_DEFINES
#ifdef INCLUDE_LEGACY_REGION_DEFINES
@@ -361,5 +370,5 @@ extern _X_EXPORT void RegionPrint(
#define REGION_EXTENTS(pScreen, r) RegionExtents(r)
#define REGION_NULL(pScreen, r) RegionNull(r)
-#endif /* INCLUDE_LEGACY_REGION_DEFINES */
-#endif /* REGIONSTRUCT_H */
+#endif /* INCLUDE_LEGACY_REGION_DEFINES */
+#endif /* REGIONSTRUCT_H */
diff --git a/xorg-server/include/resource.h b/xorg-server/include/resource.h
index ea4043b2f..f2f23768b 100644
--- a/xorg-server/include/resource.h
+++ b/xorg-server/include/resource.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -87,7 +86,7 @@ typedef uint32_t RESTYPE;
#define RT_NONE ((RESTYPE)0)
/* bits and fields within a resource id */
-#define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */
+#define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */
#if MAXCLIENTS == 64
#define RESOURCE_CLIENT_BITS 6
#endif
@@ -110,10 +109,10 @@ typedef uint32_t RESTYPE;
#define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK)
/* extract the client id from an XID */
#define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
-#define SERVER_BIT (Mask)0x40000000 /* use illegal bit */
+#define SERVER_BIT (Mask)0x40000000 /* use illegal bit */
#ifdef INVALID
-#undef INVALID /* needed on HP/UX */
+#undef INVALID /* needed on HP/UX */
#endif
/* Invalid resource id */
@@ -126,8 +125,9 @@ typedef uint32_t RESTYPE;
/* Resource state callback */
extern _X_EXPORT CallbackListPtr ResourceStateCallback;
-typedef enum {ResourceStateAdding,
- ResourceStateFreeing} ResourceState;
+typedef enum { ResourceStateAdding,
+ ResourceStateFreeing
+} ResourceState;
typedef struct {
ResourceState state;
@@ -136,120 +136,99 @@ typedef struct {
pointer value;
} ResourceStateInfoRec;
-typedef int (*DeleteType)(
- pointer /*value*/,
- XID /*id*/);
+typedef int (*DeleteType) (pointer /*value */ ,
+ XID /*id */ );
-typedef void (*FindResType)(
- pointer /*value*/,
- XID /*id*/,
- pointer /*cdata*/);
+typedef void (*FindResType) (pointer /*value */ ,
+ XID /*id */ ,
+ pointer /*cdata */ );
-typedef void (*FindAllRes)(
- pointer /*value*/,
- XID /*id*/,
- RESTYPE /*type*/,
- pointer /*cdata*/);
+typedef void (*FindAllRes) (pointer /*value */ ,
+ XID /*id */ ,
+ RESTYPE /*type */ ,
+ pointer /*cdata */ );
-typedef Bool (*FindComplexResType)(
- pointer /*value*/,
- XID /*id*/,
- pointer /*cdata*/);
+typedef Bool (*FindComplexResType) (pointer /*value */ ,
+ XID /*id */ ,
+ pointer /*cdata */ );
-extern _X_EXPORT RESTYPE CreateNewResourceType(
- DeleteType /*deleteFunc*/, const char * /*name*/);
+extern _X_EXPORT RESTYPE CreateNewResourceType(DeleteType /*deleteFunc */ ,
+ const char * /*name */ );
-extern _X_EXPORT void SetResourceTypeErrorValue(
- RESTYPE /*type*/, int /*errorValue*/);
+extern _X_EXPORT void SetResourceTypeErrorValue(RESTYPE /*type */ ,
+ int /*errorValue */ );
extern _X_EXPORT RESTYPE CreateNewResourceClass(void);
-extern _X_EXPORT Bool InitClientResources(
- ClientPtr /*client*/);
+extern _X_EXPORT Bool InitClientResources(ClientPtr /*client */ );
-extern _X_EXPORT XID FakeClientID(
- int /*client*/);
+extern _X_EXPORT XID FakeClientID(int /*client */ );
/* Quartz support on Mac OS X uses the CarbonCore
framework whose AddResource function conflicts here. */
#ifdef __APPLE__
#define AddResource Darwin_X_AddResource
#endif
-extern _X_EXPORT Bool AddResource(
- XID /*id*/,
- RESTYPE /*type*/,
- pointer /*value*/);
-
-extern _X_EXPORT void FreeResource(
- XID /*id*/,
- RESTYPE /*skipDeleteFuncType*/);
-
-extern _X_EXPORT void FreeResourceByType(
- XID /*id*/,
- RESTYPE /*type*/,
- Bool /*skipFree*/);
-
-extern _X_EXPORT Bool ChangeResourceValue(
- XID /*id*/,
- RESTYPE /*rtype*/,
- pointer /*value*/);
-
-extern _X_EXPORT void FindClientResourcesByType(
- ClientPtr /*client*/,
- RESTYPE /*type*/,
- FindResType /*func*/,
- pointer /*cdata*/);
-
-extern _X_EXPORT void FindAllClientResources(
- ClientPtr /*client*/,
- FindAllRes /*func*/,
- pointer /*cdata*/);
-
-extern _X_EXPORT void FreeClientNeverRetainResources(
- ClientPtr /*client*/);
-
-extern _X_EXPORT void FreeClientResources(
- ClientPtr /*client*/);
+extern _X_EXPORT Bool AddResource(XID /*id */ ,
+ RESTYPE /*type */ ,
+ pointer /*value */ );
+
+extern _X_EXPORT void FreeResource(XID /*id */ ,
+ RESTYPE /*skipDeleteFuncType */ );
+
+extern _X_EXPORT void FreeResourceByType(XID /*id */ ,
+ RESTYPE /*type */ ,
+ Bool /*skipFree */ );
+
+extern _X_EXPORT Bool ChangeResourceValue(XID /*id */ ,
+ RESTYPE /*rtype */ ,
+ pointer /*value */ );
+
+extern _X_EXPORT void FindClientResourcesByType(ClientPtr /*client */ ,
+ RESTYPE /*type */ ,
+ FindResType /*func */ ,
+ pointer /*cdata */ );
+
+extern _X_EXPORT void FindAllClientResources(ClientPtr /*client */ ,
+ FindAllRes /*func */ ,
+ pointer /*cdata */ );
+
+extern _X_EXPORT void FreeClientNeverRetainResources(ClientPtr /*client */ );
+
+extern _X_EXPORT void FreeClientResources(ClientPtr /*client */ );
extern _X_EXPORT void FreeAllResources(void);
-extern _X_EXPORT Bool LegalNewID(
- XID /*id*/,
- ClientPtr /*client*/);
-
-extern _X_EXPORT pointer LookupClientResourceComplex(
- ClientPtr client,
- RESTYPE type,
- FindComplexResType func,
- pointer cdata);
-
-extern _X_EXPORT int dixLookupResourceByType(
- pointer *result,
- XID id,
- RESTYPE rtype,
- ClientPtr client,
- Mask access_mode);
-
-extern _X_EXPORT int dixLookupResourceByClass(
- pointer *result,
- XID id,
- RESTYPE rclass,
- ClientPtr client,
- Mask access_mode);
-
-extern _X_EXPORT void GetXIDRange(
- int /*client*/,
- Bool /*server*/,
- XID * /*minp*/,
- XID * /*maxp*/);
-
-extern _X_EXPORT unsigned int GetXIDList(
- ClientPtr /*client*/,
- unsigned int /*count*/,
- XID * /*pids*/);
+extern _X_EXPORT Bool LegalNewID(XID /*id */ ,
+ ClientPtr /*client */ );
+
+extern _X_EXPORT pointer LookupClientResourceComplex(ClientPtr client,
+ RESTYPE type,
+ FindComplexResType func,
+ pointer cdata);
+
+extern _X_EXPORT int dixLookupResourceByType(pointer *result,
+ XID id,
+ RESTYPE rtype,
+ ClientPtr client,
+ Mask access_mode);
+
+extern _X_EXPORT int dixLookupResourceByClass(pointer *result,
+ XID id,
+ RESTYPE rclass,
+ ClientPtr client,
+ Mask access_mode);
+
+extern _X_EXPORT void GetXIDRange(int /*client */ ,
+ Bool /*server */ ,
+ XID * /*minp */ ,
+ XID * /*maxp */ );
+
+extern _X_EXPORT unsigned int GetXIDList(ClientPtr /*client */ ,
+ unsigned int /*count */ ,
+ XID * /*pids */ );
extern _X_EXPORT RESTYPE lastResourceType;
extern _X_EXPORT RESTYPE TypeMask;
-#endif /* RESOURCE_H */
-
+#endif /* RESOURCE_H */
diff --git a/xorg-server/include/screenint.h b/xorg-server/include/screenint.h
index 4e6c574e7..881747182 100644
--- a/xorg-server/include/screenint.h
+++ b/xorg-server/include/screenint.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -52,18 +51,18 @@ SOFTWARE.
typedef struct _PixmapFormat *PixmapFormatPtr;
typedef struct _Visual *VisualPtr;
-typedef struct _Depth *DepthPtr;
+typedef struct _Depth *DepthPtr;
typedef struct _Screen *ScreenPtr;
-extern _X_EXPORT int AddScreen(
- Bool (* /*pfnInit*/)(
- int /*index*/,
- ScreenPtr /*pScreen*/,
- int /*argc*/,
- char ** /*argv*/),
- int /*argc*/,
- char** /*argv*/);
+extern _X_EXPORT int AddScreen(Bool (* /*pfnInit */ )(
+ int /*index */ ,
+ ScreenPtr /*pScreen */
+ ,
+ int /*argc */ ,
+ char ** /*argv */ ),
+ int /*argc */ ,
+ char ** /*argv */ );
typedef struct _ColormapRec *ColormapPtr;
-#endif /* SCREENINT_H */
+#endif /* SCREENINT_H */
diff --git a/xorg-server/include/scrnintstr.h b/xorg-server/include/scrnintstr.h
index d327b7e43..21d2d0b5d 100644
--- a/xorg-server/include/scrnintstr.h
+++ b/xorg-server/include/scrnintstr.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -58,143 +57,122 @@ SOFTWARE.
#include "privates.h"
typedef struct _PixmapFormat {
- unsigned char depth;
- unsigned char bitsPerPixel;
- unsigned char scanlinePad;
- } PixmapFormatRec;
-
+ unsigned char depth;
+ unsigned char bitsPerPixel;
+ unsigned char scanlinePad;
+} PixmapFormatRec;
+
typedef struct _Visual {
- VisualID vid;
- short class;
- short bitsPerRGBValue;
- long ColormapEntries;
- short nplanes;/* = log2 (ColormapEntries). This does not
- * imply that the screen has this many planes.
- * it may have more or fewer */
- unsigned long redMask, greenMask, blueMask;
- int offsetRed, offsetGreen, offsetBlue;
- } VisualRec;
+ VisualID vid;
+ short class;
+ short bitsPerRGBValue;
+ long ColormapEntries;
+ short nplanes; /* = log2 (ColormapEntries). This does not
+ * imply that the screen has this many planes.
+ * it may have more or fewer */
+ unsigned long redMask, greenMask, blueMask;
+ int offsetRed, offsetGreen, offsetBlue;
+} VisualRec;
typedef struct _Depth {
- unsigned char depth;
- short numVids;
- VisualID *vids; /* block of visual ids for this depth */
- } DepthRec;
+ unsigned char depth;
+ short numVids;
+ VisualID *vids; /* block of visual ids for this depth */
+} DepthRec;
typedef struct _ScreenSaverStuff {
WindowPtr pWindow;
- XID wid;
- char blanked;
- Bool (*ExternalScreenSaver)(
- ScreenPtr /*pScreen*/,
- int /*xstate*/,
- Bool /*force*/);
+ XID wid;
+ char blanked;
+ Bool (*ExternalScreenSaver) (ScreenPtr /*pScreen */ ,
+ int /*xstate */ ,
+ Bool /*force */ );
} ScreenSaverStuffRec;
-
/*
* There is a typedef for each screen function pointer so that code that
* needs to declare a screen function pointer (e.g. in a screen private
* or as a local variable) can easily do so and retain full type checking.
*/
-typedef Bool (* CloseScreenProcPtr)(
- int /*index*/,
- ScreenPtr /*pScreen*/);
-
-typedef void (* QueryBestSizeProcPtr)(
- int /*class*/,
- unsigned short * /*pwidth*/,
- unsigned short * /*pheight*/,
- ScreenPtr /*pScreen*/);
-
-typedef Bool (* SaveScreenProcPtr)(
- ScreenPtr /*pScreen*/,
- int /*on*/);
-
-typedef void (* GetImageProcPtr)(
- DrawablePtr /*pDrawable*/,
- int /*sx*/,
- int /*sy*/,
- int /*w*/,
- int /*h*/,
- unsigned int /*format*/,
- unsigned long /*planeMask*/,
- char * /*pdstLine*/);
-
-typedef void (* GetSpansProcPtr)(
- DrawablePtr /*pDrawable*/,
- int /*wMax*/,
- DDXPointPtr /*ppt*/,
- int* /*pwidth*/,
- int /*nspans*/,
- char * /*pdstStart*/);
-
-typedef void (* SourceValidateProcPtr)(
- DrawablePtr /*pDrawable*/,
- int /*x*/,
- int /*y*/,
- int /*width*/,
- int /*height*/,
- unsigned int /*subWindowMode*/);
-
-typedef Bool (* CreateWindowProcPtr)(
- WindowPtr /*pWindow*/);
-
-typedef Bool (* DestroyWindowProcPtr)(
- WindowPtr /*pWindow*/);
-
-typedef Bool (* PositionWindowProcPtr)(
- WindowPtr /*pWindow*/,
- int /*x*/,
- int /*y*/);
-
-typedef Bool (* ChangeWindowAttributesProcPtr)(
- WindowPtr /*pWindow*/,
- unsigned long /*mask*/);
-
-typedef Bool (* RealizeWindowProcPtr)(
- WindowPtr /*pWindow*/);
-
-typedef Bool (* UnrealizeWindowProcPtr)(
- WindowPtr /*pWindow*/);
-
-typedef void (* RestackWindowProcPtr)(
- WindowPtr /*pWindow*/,
- WindowPtr /*pOldNextSib*/);
-
-typedef int (* ValidateTreeProcPtr)(
- WindowPtr /*pParent*/,
- WindowPtr /*pChild*/,
- VTKind /*kind*/);
-
-typedef void (* PostValidateTreeProcPtr)(
- WindowPtr /*pParent*/,
- WindowPtr /*pChild*/,
- VTKind /*kind*/);
-
-typedef void (* WindowExposuresProcPtr)(
- WindowPtr /*pWindow*/,
- RegionPtr /*prgn*/,
- RegionPtr /*other_exposed*/);
-
-typedef void (* CopyWindowProcPtr)(
- WindowPtr /*pWindow*/,
- DDXPointRec /*ptOldOrg*/,
- RegionPtr /*prgnSrc*/);
-
-typedef void (* ClearToBackgroundProcPtr)(
- WindowPtr /*pWindow*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- Bool /*generateExposures*/);
-
-typedef void (* ClipNotifyProcPtr)(
- WindowPtr /*pWindow*/,
- int /*dx*/,
- int /*dy*/);
+typedef Bool (*CloseScreenProcPtr) (int /*index */ ,
+ ScreenPtr /*pScreen */ );
+
+typedef void (*QueryBestSizeProcPtr) (int /*class */ ,
+ unsigned short * /*pwidth */ ,
+ unsigned short * /*pheight */ ,
+ ScreenPtr /*pScreen */ );
+
+typedef Bool (*SaveScreenProcPtr) (ScreenPtr /*pScreen */ ,
+ int /*on */ );
+
+typedef void (*GetImageProcPtr) (DrawablePtr /*pDrawable */ ,
+ int /*sx */ ,
+ int /*sy */ ,
+ int /*w */ ,
+ int /*h */ ,
+ unsigned int /*format */ ,
+ unsigned long /*planeMask */ ,
+ char * /*pdstLine */ );
+
+typedef void (*GetSpansProcPtr) (DrawablePtr /*pDrawable */ ,
+ int /*wMax */ ,
+ DDXPointPtr /*ppt */ ,
+ int * /*pwidth */ ,
+ int /*nspans */ ,
+ char * /*pdstStart */ );
+
+typedef void (*SourceValidateProcPtr) (DrawablePtr /*pDrawable */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*width */ ,
+ int /*height */ ,
+ unsigned int /*subWindowMode */ );
+
+typedef Bool (*CreateWindowProcPtr) (WindowPtr /*pWindow */ );
+
+typedef Bool (*DestroyWindowProcPtr) (WindowPtr /*pWindow */ );
+
+typedef Bool (*PositionWindowProcPtr) (WindowPtr /*pWindow */ ,
+ int /*x */ ,
+ int /*y */ );
+
+typedef Bool (*ChangeWindowAttributesProcPtr) (WindowPtr /*pWindow */ ,
+ unsigned long /*mask */ );
+
+typedef Bool (*RealizeWindowProcPtr) (WindowPtr /*pWindow */ );
+
+typedef Bool (*UnrealizeWindowProcPtr) (WindowPtr /*pWindow */ );
+
+typedef void (*RestackWindowProcPtr) (WindowPtr /*pWindow */ ,
+ WindowPtr /*pOldNextSib */ );
+
+typedef int (*ValidateTreeProcPtr) (WindowPtr /*pParent */ ,
+ WindowPtr /*pChild */ ,
+ VTKind /*kind */ );
+
+typedef void (*PostValidateTreeProcPtr) (WindowPtr /*pParent */ ,
+ WindowPtr /*pChild */ ,
+ VTKind /*kind */ );
+
+typedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ ,
+ RegionPtr /*prgn */ ,
+ RegionPtr /*other_exposed */ );
+
+typedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ ,
+ DDXPointRec /*ptOldOrg */ ,
+ RegionPtr /*prgnSrc */ );
+
+typedef void (*ClearToBackgroundProcPtr) (WindowPtr /*pWindow */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*w */ ,
+ int /*h */ ,
+ Bool /*generateExposures */ );
+
+typedef void (*ClipNotifyProcPtr) (WindowPtr /*pWindow */ ,
+ int /*dx */ ,
+ int /*dy */ );
/* pixmap will exist only for the duration of the current rendering operation */
#define CREATE_PIXMAP_USAGE_SCRATCH 1
@@ -203,379 +181,337 @@ typedef void (* ClipNotifyProcPtr)(
/* pixmap will contain a glyph */
#define CREATE_PIXMAP_USAGE_GLYPH_PICTURE 3
-typedef PixmapPtr (* CreatePixmapProcPtr)(
- ScreenPtr /*pScreen*/,
- int /*width*/,
- int /*height*/,
- int /*depth*/,
- unsigned /*usage_hint*/);
-
-typedef Bool (* DestroyPixmapProcPtr)(
- PixmapPtr /*pPixmap*/);
-
-typedef Bool (* RealizeFontProcPtr)(
- ScreenPtr /*pScreen*/,
- FontPtr /*pFont*/);
-
-typedef Bool (* UnrealizeFontProcPtr)(
- ScreenPtr /*pScreen*/,
- FontPtr /*pFont*/);
-
-typedef void (* ConstrainCursorProcPtr)(
- DeviceIntPtr /*pDev*/,
- ScreenPtr /*pScreen*/,
- BoxPtr /*pBox*/);
-
-typedef void (* CursorLimitsProcPtr)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /*pScreen*/,
- CursorPtr /*pCursor*/,
- BoxPtr /*pHotBox*/,
- BoxPtr /*pTopLeftBox*/);
-
-typedef Bool (* DisplayCursorProcPtr)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /*pScreen*/,
- CursorPtr /*pCursor*/);
-
-typedef Bool (* RealizeCursorProcPtr)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /*pScreen*/,
- CursorPtr /*pCursor*/);
-
-typedef Bool (* UnrealizeCursorProcPtr)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /*pScreen*/,
- CursorPtr /*pCursor*/);
-
-typedef void (* RecolorCursorProcPtr)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /*pScreen*/,
- CursorPtr /*pCursor*/,
- Bool /*displayed*/);
-
-typedef Bool (* SetCursorPositionProcPtr)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /*pScreen*/,
- int /*x*/,
- int /*y*/,
- Bool /*generateEvent*/);
-
-typedef Bool (* CreateGCProcPtr)(
- GCPtr /*pGC*/);
-
-typedef Bool (* CreateColormapProcPtr)(
- ColormapPtr /*pColormap*/);
-
-typedef void (* DestroyColormapProcPtr)(
- ColormapPtr /*pColormap*/);
-
-typedef void (* InstallColormapProcPtr)(
- ColormapPtr /*pColormap*/);
-
-typedef void (* UninstallColormapProcPtr)(
- ColormapPtr /*pColormap*/);
-
-typedef int (* ListInstalledColormapsProcPtr) (
- ScreenPtr /*pScreen*/,
- XID* /*pmaps */);
-
-typedef void (* StoreColorsProcPtr)(
- ColormapPtr /*pColormap*/,
- int /*ndef*/,
- xColorItem * /*pdef*/);
-
-typedef void (* ResolveColorProcPtr)(
- unsigned short* /*pred*/,
- unsigned short* /*pgreen*/,
- unsigned short* /*pblue*/,
- VisualPtr /*pVisual*/);
-
-typedef RegionPtr (* BitmapToRegionProcPtr)(
- PixmapPtr /*pPix*/);
-
-typedef void (* SendGraphicsExposeProcPtr)(
- ClientPtr /*client*/,
- RegionPtr /*pRgn*/,
- XID /*drawable*/,
- int /*major*/,
- int /*minor*/);
-
-typedef void (* ScreenBlockHandlerProcPtr)(
- int /*screenNum*/,
- pointer /*blockData*/,
- pointer /*pTimeout*/,
- pointer /*pReadmask*/);
-
-typedef void (* ScreenWakeupHandlerProcPtr)(
- int /*screenNum*/,
- pointer /*wakeupData*/,
- unsigned long /*result*/,
- pointer /*pReadMask*/);
-
-typedef Bool (* CreateScreenResourcesProcPtr)(
- ScreenPtr /*pScreen*/);
-
-typedef Bool (* ModifyPixmapHeaderProcPtr)(
- PixmapPtr /*pPixmap*/,
- int /*width*/,
- int /*height*/,
- int /*depth*/,
- int /*bitsPerPixel*/,
- int /*devKind*/,
- pointer /*pPixData*/);
-
-typedef PixmapPtr (* GetWindowPixmapProcPtr)(
- WindowPtr /*pWin*/);
-
-typedef void (* SetWindowPixmapProcPtr)(
- WindowPtr /*pWin*/,
- PixmapPtr /*pPix*/);
-
-typedef PixmapPtr (* GetScreenPixmapProcPtr)(
- ScreenPtr /*pScreen*/);
-
-typedef void (* SetScreenPixmapProcPtr)(
- PixmapPtr /*pPix*/);
-
-typedef void (* MarkWindowProcPtr)(
- WindowPtr /*pWin*/);
-
-typedef Bool (* MarkOverlappedWindowsProcPtr)(
- WindowPtr /*parent*/,
- WindowPtr /*firstChild*/,
- WindowPtr * /*pLayerWin*/);
-
-typedef int (* ConfigNotifyProcPtr)(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- int /*bw*/,
- WindowPtr /*pSib*/);
-
-typedef void (* MoveWindowProcPtr)(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/,
- WindowPtr /*pSib*/,
- VTKind /*kind*/);
-
-typedef void (* ResizeWindowProcPtr)(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*w*/,
- unsigned int /*h*/,
- WindowPtr /*pSib*/
-);
-
-typedef WindowPtr (* GetLayerWindowProcPtr)(
- WindowPtr /*pWin*/
-);
-
-typedef void (* HandleExposuresProcPtr)(
- WindowPtr /*pWin*/);
-
-typedef void (* ReparentWindowProcPtr)(
- WindowPtr /*pWin*/,
- WindowPtr /*pPriorParent*/);
-
-typedef void (* SetShapeProcPtr)(
- WindowPtr /*pWin*/,
- int /* kind */);
-
-typedef void (* ChangeBorderWidthProcPtr)(
- WindowPtr /*pWin*/,
- unsigned int /*width*/);
-
-typedef void (* MarkUnrealizedWindowProcPtr)(
- WindowPtr /*pChild*/,
- WindowPtr /*pWin*/,
- Bool /*fromConfigure*/);
+typedef PixmapPtr (*CreatePixmapProcPtr) (ScreenPtr /*pScreen */ ,
+ int /*width */ ,
+ int /*height */ ,
+ int /*depth */ ,
+ unsigned /*usage_hint */ );
+
+typedef Bool (*DestroyPixmapProcPtr) (PixmapPtr /*pPixmap */ );
+
+typedef Bool (*RealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
+ FontPtr /*pFont */ );
+
+typedef Bool (*UnrealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
+ FontPtr /*pFont */ );
+
+typedef void (*ConstrainCursorProcPtr) (DeviceIntPtr /*pDev */ ,
+ ScreenPtr /*pScreen */ ,
+ BoxPtr /*pBox */ );
+
+typedef void (*CursorLimitsProcPtr) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /*pScreen */ ,
+ CursorPtr /*pCursor */ ,
+ BoxPtr /*pHotBox */ ,
+ BoxPtr /*pTopLeftBox */ );
+
+typedef Bool (*DisplayCursorProcPtr) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /*pScreen */ ,
+ CursorPtr /*pCursor */ );
+
+typedef Bool (*RealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /*pScreen */ ,
+ CursorPtr /*pCursor */ );
+
+typedef Bool (*UnrealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /*pScreen */ ,
+ CursorPtr /*pCursor */ );
+
+typedef void (*RecolorCursorProcPtr) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /*pScreen */ ,
+ CursorPtr /*pCursor */ ,
+ Bool /*displayed */ );
+
+typedef Bool (*SetCursorPositionProcPtr) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /*pScreen */ ,
+ int /*x */ ,
+ int /*y */ ,
+ Bool /*generateEvent */ );
+
+typedef Bool (*CreateGCProcPtr) (GCPtr /*pGC */ );
+
+typedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ );
+
+typedef void (*DestroyColormapProcPtr) (ColormapPtr /*pColormap */ );
+
+typedef void (*InstallColormapProcPtr) (ColormapPtr /*pColormap */ );
+
+typedef void (*UninstallColormapProcPtr) (ColormapPtr /*pColormap */ );
+
+typedef int (*ListInstalledColormapsProcPtr) (ScreenPtr /*pScreen */ ,
+ XID * /*pmaps */ );
+
+typedef void (*StoreColorsProcPtr) (ColormapPtr /*pColormap */ ,
+ int /*ndef */ ,
+ xColorItem * /*pdef */ );
+
+typedef void (*ResolveColorProcPtr) (unsigned short * /*pred */ ,
+ unsigned short * /*pgreen */ ,
+ unsigned short * /*pblue */ ,
+ VisualPtr /*pVisual */ );
+
+typedef RegionPtr (*BitmapToRegionProcPtr) (PixmapPtr /*pPix */ );
+
+typedef void (*SendGraphicsExposeProcPtr) (ClientPtr /*client */ ,
+ RegionPtr /*pRgn */ ,
+ XID /*drawable */ ,
+ int /*major */ ,
+ int /*minor */ );
+
+typedef void (*ScreenBlockHandlerProcPtr) (int /*screenNum */ ,
+ pointer /*blockData */ ,
+ pointer /*pTimeout */ ,
+ pointer /*pReadmask */ );
+
+typedef void (*ScreenWakeupHandlerProcPtr) (int /*screenNum */ ,
+ pointer /*wakeupData */ ,
+ unsigned long /*result */ ,
+ pointer /*pReadMask */ );
+
+typedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ );
+
+typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr /*pPixmap */ ,
+ int /*width */ ,
+ int /*height */ ,
+ int /*depth */ ,
+ int /*bitsPerPixel */ ,
+ int /*devKind */ ,
+ pointer /*pPixData */ );
+
+typedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ );
+
+typedef void (*SetWindowPixmapProcPtr) (WindowPtr /*pWin */ ,
+ PixmapPtr /*pPix */ );
+
+typedef PixmapPtr (*GetScreenPixmapProcPtr) (ScreenPtr /*pScreen */ );
+
+typedef void (*SetScreenPixmapProcPtr) (PixmapPtr /*pPix */ );
+
+typedef void (*MarkWindowProcPtr) (WindowPtr /*pWin */ );
+
+typedef Bool (*MarkOverlappedWindowsProcPtr) (WindowPtr /*parent */ ,
+ WindowPtr /*firstChild */ ,
+ WindowPtr * /*pLayerWin */ );
+
+typedef int (*ConfigNotifyProcPtr) (WindowPtr /*pWin */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*w */ ,
+ int /*h */ ,
+ int /*bw */ ,
+ WindowPtr /*pSib */ );
+
+typedef void (*MoveWindowProcPtr) (WindowPtr /*pWin */ ,
+ int /*x */ ,
+ int /*y */ ,
+ WindowPtr /*pSib */ ,
+ VTKind /*kind */ );
+
+typedef void (*ResizeWindowProcPtr) (WindowPtr /*pWin */ ,
+ int /*x */ ,
+ int /*y */ ,
+ unsigned int /*w */ ,
+ unsigned int /*h */ ,
+ WindowPtr /*pSib */
+ );
+
+typedef WindowPtr (*GetLayerWindowProcPtr) (WindowPtr /*pWin */
+ );
+
+typedef void (*HandleExposuresProcPtr) (WindowPtr /*pWin */ );
+
+typedef void (*ReparentWindowProcPtr) (WindowPtr /*pWin */ ,
+ WindowPtr /*pPriorParent */ );
+
+typedef void (*SetShapeProcPtr) (WindowPtr /*pWin */ ,
+ int /* kind */ );
+
+typedef void (*ChangeBorderWidthProcPtr) (WindowPtr /*pWin */ ,
+ unsigned int /*width */ );
+
+typedef void (*MarkUnrealizedWindowProcPtr) (WindowPtr /*pChild */ ,
+ WindowPtr /*pWin */ ,
+ Bool /*fromConfigure */ );
#ifdef CreateWindow
#undef CreateWindow
#endif
-typedef Bool (* DeviceCursorInitializeProcPtr)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScreen */);
+typedef Bool (*DeviceCursorInitializeProcPtr) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /* pScreen */ );
-typedef void (* DeviceCursorCleanupProcPtr)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScreen */);
+typedef void (*DeviceCursorCleanupProcPtr) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /* pScreen */ );
-typedef void (*ConstrainCursorHarderProcPtr)(
- DeviceIntPtr, ScreenPtr, int, int *, int *);
+typedef void (*ConstrainCursorHarderProcPtr) (DeviceIntPtr, ScreenPtr, int,
+ int *, int *);
typedef struct _Screen {
- int myNum; /* index of this instance in Screens[] */
- ATOM id;
- short x, y, width, height;
- short mmWidth, mmHeight;
- short numDepths;
- unsigned char rootDepth;
- DepthPtr allowedDepths;
- unsigned long rootVisual;
- unsigned long defColormap;
- short minInstalledCmaps, maxInstalledCmaps;
- char backingStoreSupport, saveUnderSupport;
- unsigned long whitePixel, blackPixel;
- GCPtr GCperDepth[MAXFORMATS+1];
- /* next field is a stipple to use as default in
- a GC. we don't build default tiles of all depths
- because they are likely to be of a color
- different from the default fg pixel, so
- we don't win anything by building
- a standard one.
- */
- PixmapPtr PixmapPerDepth[1];
- pointer devPrivate;
- short numVisuals;
- VisualPtr visuals;
- WindowPtr root;
+ int myNum; /* index of this instance in Screens[] */
+ ATOM id;
+ short x, y, width, height;
+ short mmWidth, mmHeight;
+ short numDepths;
+ unsigned char rootDepth;
+ DepthPtr allowedDepths;
+ unsigned long rootVisual;
+ unsigned long defColormap;
+ short minInstalledCmaps, maxInstalledCmaps;
+ char backingStoreSupport, saveUnderSupport;
+ unsigned long whitePixel, blackPixel;
+ GCPtr GCperDepth[MAXFORMATS + 1];
+ /* next field is a stipple to use as default in
+ a GC. we don't build default tiles of all depths
+ because they are likely to be of a color
+ different from the default fg pixel, so
+ we don't win anything by building
+ a standard one.
+ */
+ PixmapPtr PixmapPerDepth[1];
+ pointer devPrivate;
+ short numVisuals;
+ VisualPtr visuals;
+ WindowPtr root;
ScreenSaverStuffRec screensaver;
/* Random screen procedures */
- CloseScreenProcPtr CloseScreen;
- QueryBestSizeProcPtr QueryBestSize;
- SaveScreenProcPtr SaveScreen;
- GetImageProcPtr GetImage;
- GetSpansProcPtr GetSpans;
- SourceValidateProcPtr SourceValidate;
+ CloseScreenProcPtr CloseScreen;
+ QueryBestSizeProcPtr QueryBestSize;
+ SaveScreenProcPtr SaveScreen;
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ SourceValidateProcPtr SourceValidate;
/* Window Procedures */
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- PositionWindowProcPtr PositionWindow;
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ PositionWindowProcPtr PositionWindow;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- ValidateTreeProcPtr ValidateTree;
- PostValidateTreeProcPtr PostValidateTree;
- WindowExposuresProcPtr WindowExposures;
- CopyWindowProcPtr CopyWindow;
- ClearToBackgroundProcPtr ClearToBackground;
- ClipNotifyProcPtr ClipNotify;
- RestackWindowProcPtr RestackWindow;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+ ClearToBackgroundProcPtr ClearToBackground;
+ ClipNotifyProcPtr ClipNotify;
+ RestackWindowProcPtr RestackWindow;
/* Pixmap procedures */
- CreatePixmapProcPtr CreatePixmap;
- DestroyPixmapProcPtr DestroyPixmap;
+ CreatePixmapProcPtr CreatePixmap;
+ DestroyPixmapProcPtr DestroyPixmap;
/* Font procedures */
- RealizeFontProcPtr RealizeFont;
- UnrealizeFontProcPtr UnrealizeFont;
+ RealizeFontProcPtr RealizeFont;
+ UnrealizeFontProcPtr UnrealizeFont;
/* Cursor Procedures */
- ConstrainCursorProcPtr ConstrainCursor;
+ ConstrainCursorProcPtr ConstrainCursor;
ConstrainCursorHarderProcPtr ConstrainCursorHarder;
- CursorLimitsProcPtr CursorLimits;
- DisplayCursorProcPtr DisplayCursor;
- RealizeCursorProcPtr RealizeCursor;
- UnrealizeCursorProcPtr UnrealizeCursor;
- RecolorCursorProcPtr RecolorCursor;
- SetCursorPositionProcPtr SetCursorPosition;
+ CursorLimitsProcPtr CursorLimits;
+ DisplayCursorProcPtr DisplayCursor;
+ RealizeCursorProcPtr RealizeCursor;
+ UnrealizeCursorProcPtr UnrealizeCursor;
+ RecolorCursorProcPtr RecolorCursor;
+ SetCursorPositionProcPtr SetCursorPosition;
/* GC procedures */
- CreateGCProcPtr CreateGC;
+ CreateGCProcPtr CreateGC;
/* Colormap procedures */
- CreateColormapProcPtr CreateColormap;
- DestroyColormapProcPtr DestroyColormap;
- InstallColormapProcPtr InstallColormap;
- UninstallColormapProcPtr UninstallColormap;
+ CreateColormapProcPtr CreateColormap;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ UninstallColormapProcPtr UninstallColormap;
ListInstalledColormapsProcPtr ListInstalledColormaps;
- StoreColorsProcPtr StoreColors;
- ResolveColorProcPtr ResolveColor;
+ StoreColorsProcPtr StoreColors;
+ ResolveColorProcPtr ResolveColor;
/* Region procedures */
- BitmapToRegionProcPtr BitmapToRegion;
- SendGraphicsExposeProcPtr SendGraphicsExpose;
+ BitmapToRegionProcPtr BitmapToRegion;
+ SendGraphicsExposeProcPtr SendGraphicsExpose;
/* os layer procedures */
- ScreenBlockHandlerProcPtr BlockHandler;
- ScreenWakeupHandlerProcPtr WakeupHandler;
+ ScreenBlockHandlerProcPtr BlockHandler;
+ ScreenWakeupHandlerProcPtr WakeupHandler;
pointer blockData;
pointer wakeupData;
/* anybody can get a piece of this array */
- PrivateRec *devPrivates;
+ PrivateRec *devPrivates;
CreateScreenResourcesProcPtr CreateScreenResources;
- ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
+ ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
- GetWindowPixmapProcPtr GetWindowPixmap;
- SetWindowPixmapProcPtr SetWindowPixmap;
- GetScreenPixmapProcPtr GetScreenPixmap;
- SetScreenPixmapProcPtr SetScreenPixmap;
+ GetWindowPixmapProcPtr GetWindowPixmap;
+ SetWindowPixmapProcPtr SetWindowPixmap;
+ GetScreenPixmapProcPtr GetScreenPixmap;
+ SetScreenPixmapProcPtr SetScreenPixmap;
- PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
+ PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
- unsigned int totalPixmapSize;
+ unsigned int totalPixmapSize;
- MarkWindowProcPtr MarkWindow;
+ MarkWindowProcPtr MarkWindow;
MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
- ConfigNotifyProcPtr ConfigNotify;
- MoveWindowProcPtr MoveWindow;
- ResizeWindowProcPtr ResizeWindow;
- GetLayerWindowProcPtr GetLayerWindow;
- HandleExposuresProcPtr HandleExposures;
- ReparentWindowProcPtr ReparentWindow;
+ ConfigNotifyProcPtr ConfigNotify;
+ MoveWindowProcPtr MoveWindow;
+ ResizeWindowProcPtr ResizeWindow;
+ GetLayerWindowProcPtr GetLayerWindow;
+ HandleExposuresProcPtr HandleExposures;
+ ReparentWindowProcPtr ReparentWindow;
- SetShapeProcPtr SetShape;
+ SetShapeProcPtr SetShape;
- ChangeBorderWidthProcPtr ChangeBorderWidth;
- MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
+ ChangeBorderWidthProcPtr ChangeBorderWidth;
+ MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
/* Device cursor procedures */
DeviceCursorInitializeProcPtr DeviceCursorInitialize;
- DeviceCursorCleanupProcPtr DeviceCursorCleanup;
+ DeviceCursorCleanupProcPtr DeviceCursorCleanup;
/* set it in driver side if X server can copy the framebuffer content.
* Meant to be used together with '-background none' option, avoiding
* malicious users to steal framebuffer's content if that would be the
* default */
- Bool canDoBGNoneRoot;
+ Bool canDoBGNoneRoot;
} ScreenRec;
-static inline RegionPtr BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix) {
- return (*(_pScreen)->BitmapToRegion)(pPix); /* no mi version?! */
+static inline RegionPtr
+BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix)
+{
+ return (*(_pScreen)->BitmapToRegion) (pPix); /* no mi version?! */
}
typedef struct _ScreenInfo {
- int imageByteOrder;
- int bitmapScanlineUnit;
- int bitmapScanlinePad;
- int bitmapBitOrder;
- int numPixmapFormats;
- PixmapFormatRec
- formats[MAXFORMATS];
- int numScreens;
- ScreenPtr screens[MAXSCREENS];
- int x; /* origin */
- int y; /* origin */
- int width; /* total width of all screens together */
- int height; /* total height of all screens together */
+ int imageByteOrder;
+ int bitmapScanlineUnit;
+ int bitmapScanlinePad;
+ int bitmapBitOrder;
+ int numPixmapFormats;
+ PixmapFormatRec formats[MAXFORMATS];
+ int numScreens;
+ ScreenPtr screens[MAXSCREENS];
+ int x; /* origin */
+ int y; /* origin */
+ int width; /* total width of all screens together */
+ int height; /* total height of all screens together */
} ScreenInfo;
extern _X_EXPORT ScreenInfo screenInfo;
-extern _X_EXPORT void InitOutput(
- ScreenInfo * /*pScreenInfo*/,
- int /*argc*/,
- char ** /*argv*/);
+extern _X_EXPORT void InitOutput(ScreenInfo * /*pScreenInfo */ ,
+ int /*argc */ ,
+ char ** /*argv */ );
-#endif /* SCREENINTSTRUCT_H */
+#endif /* SCREENINTSTRUCT_H */
diff --git a/xorg-server/include/swaprep.h b/xorg-server/include/swaprep.h
index 8c02737d3..3fa2a090c 100644
--- a/xorg-server/include/swaprep.h
+++ b/xorg-server/include/swaprep.h
@@ -26,236 +26,204 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SWAPREP_H
#define SWAPREP_H 1
-extern _X_EXPORT void Swap32Write(
- ClientPtr /* pClient */,
- int /* size */,
- CARD32 * /* pbuf */);
-
-extern _X_EXPORT void CopySwap32Write(
- ClientPtr /* pClient */,
- int /* size */,
- CARD32 * /* pbuf */);
-
-extern _X_EXPORT void CopySwap16Write(
- ClientPtr /* pClient */,
- int /* size */,
- short * /* pbuf */);
-
-extern _X_EXPORT void SGenericReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGenericReply * /* pRep */);
-
-extern _X_EXPORT void SGetWindowAttributesReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetWindowAttributesReply * /* pRep */);
-
-extern _X_EXPORT void SGetGeometryReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetGeometryReply * /* pRep */);
-
-extern _X_EXPORT void SQueryTreeReply(
- ClientPtr /* pClient */,
- int /* size */,
- xQueryTreeReply * /* pRep */);
-
-extern _X_EXPORT void SInternAtomReply(
- ClientPtr /* pClient */,
- int /* size */,
- xInternAtomReply * /* pRep */);
-
-extern _X_EXPORT void SGetAtomNameReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetAtomNameReply * /* pRep */);
-
-extern _X_EXPORT void SGetPropertyReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetPropertyReply * /* pRep */);
-
-extern _X_EXPORT void SListPropertiesReply(
- ClientPtr /* pClient */,
- int /* size */,
- xListPropertiesReply * /* pRep */);
-
-extern _X_EXPORT void SGetSelectionOwnerReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetSelectionOwnerReply * /* pRep */);
-
-extern _X_EXPORT void SQueryPointerReply(
- ClientPtr /* pClient */,
- int /* size */,
- xQueryPointerReply * /* pRep */);
-
-extern _X_EXPORT void SwapTimeCoordWrite(
- ClientPtr /* pClient */,
- int /* size */,
- xTimecoord * /* pRep */);
-
-extern _X_EXPORT void SGetMotionEventsReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetMotionEventsReply * /* pRep */);
-
-extern _X_EXPORT void STranslateCoordsReply(
- ClientPtr /* pClient */,
- int /* size */,
- xTranslateCoordsReply * /* pRep */);
-
-extern _X_EXPORT void SGetInputFocusReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetInputFocusReply * /* pRep */);
-
-extern _X_EXPORT void SQueryKeymapReply(
- ClientPtr /* pClient */,
- int /* size */,
- xQueryKeymapReply * /* pRep */);
-
-extern _X_EXPORT void SQueryFontReply(
- ClientPtr /* pClient */,
- int /* size */,
- xQueryFontReply * /* pRep */);
-
-extern _X_EXPORT void SQueryTextExtentsReply(
- ClientPtr /* pClient */,
- int /* size */,
- xQueryTextExtentsReply * /* pRep */);
-
-extern _X_EXPORT void SListFontsReply(
- ClientPtr /* pClient */,
- int /* size */,
- xListFontsReply * /* pRep */);
-
-extern _X_EXPORT void SListFontsWithInfoReply(
- ClientPtr /* pClient */,
- int /* size */,
- xListFontsWithInfoReply * /* pRep */);
-
-extern _X_EXPORT void SGetFontPathReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetFontPathReply * /* pRep */);
-
-extern _X_EXPORT void SGetImageReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetImageReply * /* pRep */);
-
-extern _X_EXPORT void SListInstalledColormapsReply(
- ClientPtr /* pClient */,
- int /* size */,
- xListInstalledColormapsReply * /* pRep */);
-
-extern _X_EXPORT void SAllocColorReply(
- ClientPtr /* pClient */,
- int /* size */,
- xAllocColorReply * /* pRep */);
-
-extern _X_EXPORT void SAllocNamedColorReply(
- ClientPtr /* pClient */,
- int /* size */,
- xAllocNamedColorReply * /* pRep */);
-
-extern _X_EXPORT void SAllocColorCellsReply(
- ClientPtr /* pClient */,
- int /* size */,
- xAllocColorCellsReply * /* pRep */);
-
-extern _X_EXPORT void SAllocColorPlanesReply(
- ClientPtr /* pClient */,
- int /* size */,
- xAllocColorPlanesReply * /* pRep */);
-
-extern _X_EXPORT void SQColorsExtend(
- ClientPtr /* pClient */,
- int /* size */,
- xrgb * /* prgb */);
-
-extern _X_EXPORT void SQueryColorsReply(
- ClientPtr /* pClient */,
- int /* size */,
- xQueryColorsReply * /* pRep */);
-
-extern _X_EXPORT void SLookupColorReply(
- ClientPtr /* pClient */,
- int /* size */,
- xLookupColorReply * /* pRep */);
-
-extern _X_EXPORT void SQueryBestSizeReply(
- ClientPtr /* pClient */,
- int /* size */,
- xQueryBestSizeReply * /* pRep */);
-
-extern _X_EXPORT void SListExtensionsReply(
- ClientPtr /* pClient */,
- int /* size */,
- xListExtensionsReply * /* pRep */);
-
-extern _X_EXPORT void SGetKeyboardMappingReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetKeyboardMappingReply * /* pRep */);
-
-extern _X_EXPORT void SGetPointerMappingReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetPointerMappingReply * /* pRep */);
-
-extern _X_EXPORT void SGetModifierMappingReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetModifierMappingReply * /* pRep */);
-
-extern _X_EXPORT void SGetKeyboardControlReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetKeyboardControlReply * /* pRep */);
-
-extern _X_EXPORT void SGetPointerControlReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetPointerControlReply * /* pRep */);
-
-extern _X_EXPORT void SGetScreenSaverReply(
- ClientPtr /* pClient */,
- int /* size */,
- xGetScreenSaverReply * /* pRep */);
-
-extern _X_EXPORT void SLHostsExtend(
- ClientPtr /* pClient */,
- int /* size */,
- char * /* buf */);
-
-extern _X_EXPORT void SListHostsReply(
- ClientPtr /* pClient */,
- int /* size */,
- xListHostsReply * /* pRep */);
-
-extern _X_EXPORT void SErrorEvent(
- xError * /* from */,
- xError * /* to */);
-
-extern _X_EXPORT void SwapConnSetupInfo(
- char * /* pInfo */,
- char * /* pInfoTBase */);
-
-extern _X_EXPORT void WriteSConnectionInfo(
- ClientPtr /* pClient */,
- unsigned long /* size */,
- char * /* pInfo */);
-
-extern _X_EXPORT void SwapConnSetupPrefix(
- xConnSetupPrefix * /* pcspFrom */,
- xConnSetupPrefix * /* pcspTo */);
-
-extern _X_EXPORT void WriteSConnSetupPrefix(
- ClientPtr /* pClient */,
- xConnSetupPrefix * /* pcsp */);
+extern _X_EXPORT void Swap32Write(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ CARD32 * /* pbuf */ );
+
+extern _X_EXPORT void CopySwap32Write(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ CARD32 * /* pbuf */ );
+
+extern _X_EXPORT void CopySwap16Write(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ short * /* pbuf */ );
+
+extern _X_EXPORT void SGenericReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGenericReply * /* pRep */ );
+
+extern _X_EXPORT void SGetWindowAttributesReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetWindowAttributesReply *
+ /* pRep */ );
+
+extern _X_EXPORT void SGetGeometryReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetGeometryReply * /* pRep */ );
+
+extern _X_EXPORT void SQueryTreeReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xQueryTreeReply * /* pRep */ );
+
+extern _X_EXPORT void SInternAtomReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xInternAtomReply * /* pRep */ );
+
+extern _X_EXPORT void SGetAtomNameReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetAtomNameReply * /* pRep */ );
+
+extern _X_EXPORT void SGetPropertyReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetPropertyReply * /* pRep */ );
+
+extern _X_EXPORT void SListPropertiesReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xListPropertiesReply * /* pRep */ );
+
+extern _X_EXPORT void SGetSelectionOwnerReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetSelectionOwnerReply *
+ /* pRep */ );
+
+extern _X_EXPORT void SQueryPointerReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xQueryPointerReply * /* pRep */ );
+
+extern _X_EXPORT void SwapTimeCoordWrite(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xTimecoord * /* pRep */ );
+
+extern _X_EXPORT void SGetMotionEventsReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetMotionEventsReply * /* pRep */
+ );
+
+extern _X_EXPORT void STranslateCoordsReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xTranslateCoordsReply * /* pRep */
+ );
+
+extern _X_EXPORT void SGetInputFocusReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetInputFocusReply * /* pRep */ );
+
+extern _X_EXPORT void SQueryKeymapReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xQueryKeymapReply * /* pRep */ );
+
+extern _X_EXPORT void SQueryFontReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xQueryFontReply * /* pRep */ );
+
+extern _X_EXPORT void SQueryTextExtentsReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xQueryTextExtentsReply * /* pRep */
+ );
+
+extern _X_EXPORT void SListFontsReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xListFontsReply * /* pRep */ );
+
+extern _X_EXPORT void SListFontsWithInfoReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xListFontsWithInfoReply *
+ /* pRep */ );
+
+extern _X_EXPORT void SGetFontPathReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetFontPathReply * /* pRep */ );
+
+extern _X_EXPORT void SGetImageReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetImageReply * /* pRep */ );
+
+extern _X_EXPORT void SListInstalledColormapsReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xListInstalledColormapsReply
+ * /* pRep */ );
+
+extern _X_EXPORT void SAllocColorReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xAllocColorReply * /* pRep */ );
+
+extern _X_EXPORT void SAllocNamedColorReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xAllocNamedColorReply * /* pRep */
+ );
+
+extern _X_EXPORT void SAllocColorCellsReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xAllocColorCellsReply * /* pRep */
+ );
+
+extern _X_EXPORT void SAllocColorPlanesReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xAllocColorPlanesReply * /* pRep */
+ );
+
+extern _X_EXPORT void SQColorsExtend(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xrgb * /* prgb */ );
+
+extern _X_EXPORT void SQueryColorsReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xQueryColorsReply * /* pRep */ );
+
+extern _X_EXPORT void SLookupColorReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xLookupColorReply * /* pRep */ );
+
+extern _X_EXPORT void SQueryBestSizeReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xQueryBestSizeReply * /* pRep */ );
+
+extern _X_EXPORT void SListExtensionsReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xListExtensionsReply * /* pRep */ );
+
+extern _X_EXPORT void SGetKeyboardMappingReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetKeyboardMappingReply *
+ /* pRep */ );
+
+extern _X_EXPORT void SGetPointerMappingReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetPointerMappingReply *
+ /* pRep */ );
+
+extern _X_EXPORT void SGetModifierMappingReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetModifierMappingReply *
+ /* pRep */ );
+
+extern _X_EXPORT void SGetKeyboardControlReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetKeyboardControlReply *
+ /* pRep */ );
+
+extern _X_EXPORT void SGetPointerControlReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetPointerControlReply *
+ /* pRep */ );
+
+extern _X_EXPORT void SGetScreenSaverReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xGetScreenSaverReply * /* pRep */ );
+
+extern _X_EXPORT void SLHostsExtend(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ char * /* buf */ );
+
+extern _X_EXPORT void SListHostsReply(ClientPtr /* pClient */ ,
+ int /* size */ ,
+ xListHostsReply * /* pRep */ );
+
+extern _X_EXPORT void SErrorEvent(xError * /* from */ ,
+ xError * /* to */ );
+
+extern _X_EXPORT void SwapConnSetupInfo(char * /* pInfo */ ,
+ char * /* pInfoTBase */ );
+
+extern _X_EXPORT void WriteSConnectionInfo(ClientPtr /* pClient */ ,
+ unsigned long /* size */ ,
+ char * /* pInfo */ );
+
+extern _X_EXPORT void SwapConnSetupPrefix(xConnSetupPrefix * /* pcspFrom */ ,
+ xConnSetupPrefix * /* pcspTo */ );
+
+extern _X_EXPORT void WriteSConnSetupPrefix(ClientPtr /* pClient */ ,
+ xConnSetupPrefix * /* pcsp */ );
#undef SWAPREP_PROC
#define SWAPREP_PROC(func) extern _X_EXPORT void func(xEvent * /* from */, xEvent * /* to */)
@@ -289,4 +257,4 @@ SWAPREP_PROC(SVisibilityEvent);
#undef SWAPREP_PROC
-#endif /* SWAPREP_H */
+#endif /* SWAPREP_H */
diff --git a/xorg-server/include/swapreq.h b/xorg-server/include/swapreq.h
index 8038f0272..07eff807f 100644
--- a/xorg-server/include/swapreq.h
+++ b/xorg-server/include/swapreq.h
@@ -26,11 +26,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SWAPREQ_H
#define SWAPREQ_H 1
-extern _X_EXPORT void SwapColorItem(
- xColorItem * /* pItem */);
+extern _X_EXPORT void SwapColorItem(xColorItem * /* pItem */ );
-extern _X_EXPORT void SwapConnClientPrefix(
- xConnClientPrefix * /* pCCP */);
+extern _X_EXPORT void SwapConnClientPrefix(xConnClientPrefix * /* pCCP */ );
#undef SWAPREQ_PROC
@@ -105,4 +103,4 @@ SWAPREQ_PROC(SProcWarpPointer);
#undef SWAPREQ_PROC
-#endif /* SWAPREQ_H */
+#endif /* SWAPREQ_H */
diff --git a/xorg-server/include/window.h b/xorg-server/include/window.h
index e13598b88..64c56aeb3 100644
--- a/xorg-server/include/window.h
+++ b/xorg-server/include/window.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -73,76 +72,65 @@ struct _Cursor;
typedef struct _BackingStore *BackingStorePtr;
typedef struct _Window *WindowPtr;
-typedef int (*VisitWindowProcPtr)(
- WindowPtr /*pWin*/,
- pointer /*data*/);
-
-extern _X_EXPORT int TraverseTree(
- WindowPtr /*pWin*/,
- VisitWindowProcPtr /*func*/,
- pointer /*data*/);
-
-extern _X_EXPORT int WalkTree(
- ScreenPtr /*pScreen*/,
- VisitWindowProcPtr /*func*/,
- pointer /*data*/);
-
-extern _X_EXPORT Bool CreateRootWindow(
- ScreenPtr /*pScreen*/);
-
-extern _X_EXPORT void InitRootWindow(
- WindowPtr /*pWin*/);
-
-typedef WindowPtr (* RealChildHeadProc) (WindowPtr pWin);
-
-extern _X_EXPORT void RegisterRealChildHeadProc (RealChildHeadProc proc);
-
-extern _X_EXPORT WindowPtr RealChildHead(
- WindowPtr /*pWin*/);
-
-extern _X_EXPORT WindowPtr CreateWindow(
- Window /*wid*/,
- WindowPtr /*pParent*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*w*/,
- unsigned int /*h*/,
- unsigned int /*bw*/,
- unsigned int /*class*/,
- Mask /*vmask*/,
- XID* /*vlist*/,
- int /*depth*/,
- ClientPtr /*client*/,
- VisualID /*visual*/,
- int* /*error*/);
-
-extern _X_EXPORT int DeleteWindow(
- pointer /*pWin*/,
- XID /*wid*/);
-
-extern _X_EXPORT int DestroySubwindows(
- WindowPtr /*pWin*/,
- ClientPtr /*client*/);
+typedef int (*VisitWindowProcPtr) (WindowPtr /*pWin */ ,
+ pointer /*data */ );
+
+extern _X_EXPORT int TraverseTree(WindowPtr /*pWin */ ,
+ VisitWindowProcPtr /*func */ ,
+ pointer /*data */ );
+
+extern _X_EXPORT int WalkTree(ScreenPtr /*pScreen */ ,
+ VisitWindowProcPtr /*func */ ,
+ pointer /*data */ );
+
+extern _X_EXPORT Bool CreateRootWindow(ScreenPtr /*pScreen */ );
+
+extern _X_EXPORT void InitRootWindow(WindowPtr /*pWin */ );
+
+typedef WindowPtr (*RealChildHeadProc) (WindowPtr pWin);
+
+extern _X_EXPORT void RegisterRealChildHeadProc(RealChildHeadProc proc);
+
+extern _X_EXPORT WindowPtr RealChildHead(WindowPtr /*pWin */ );
+
+extern _X_EXPORT WindowPtr CreateWindow(Window /*wid */ ,
+ WindowPtr /*pParent */ ,
+ int /*x */ ,
+ int /*y */ ,
+ unsigned int /*w */ ,
+ unsigned int /*h */ ,
+ unsigned int /*bw */ ,
+ unsigned int /*class */ ,
+ Mask /*vmask */ ,
+ XID * /*vlist */ ,
+ int /*depth */ ,
+ ClientPtr /*client */ ,
+ VisualID /*visual */ ,
+ int * /*error */ );
+
+extern _X_EXPORT int DeleteWindow(pointer /*pWin */ ,
+ XID /*wid */ );
+
+extern _X_EXPORT int DestroySubwindows(WindowPtr /*pWin */ ,
+ ClientPtr /*client */ );
/* Quartz support on Mac OS X uses the HIToolbox
framework whose ChangeWindowAttributes function conflicts here. */
#ifdef __APPLE__
#define ChangeWindowAttributes Darwin_X_ChangeWindowAttributes
#endif
-extern _X_EXPORT int ChangeWindowAttributes(
- WindowPtr /*pWin*/,
- Mask /*vmask*/,
- XID* /*vlist*/,
- ClientPtr /*client*/);
+extern _X_EXPORT int ChangeWindowAttributes(WindowPtr /*pWin */ ,
+ Mask /*vmask */ ,
+ XID * /*vlist */ ,
+ ClientPtr /*client */ );
-extern _X_EXPORT int ChangeWindowDeviceCursor(
- WindowPtr /*pWin*/,
- struct _DeviceIntRec* /*pDev*/,
- struct _Cursor* /*pCursor*/);
+extern _X_EXPORT int ChangeWindowDeviceCursor(WindowPtr /*pWin */ ,
+ struct _DeviceIntRec * /*pDev */ ,
+ struct _Cursor * /*pCursor */ );
-extern _X_EXPORT struct _Cursor* WindowGetDeviceCursor(
- WindowPtr /*pWin*/,
- struct _DeviceIntRec* /*pDev*/);
+extern _X_EXPORT struct _Cursor *WindowGetDeviceCursor(WindowPtr /*pWin */ ,
+ struct _DeviceIntRec *
+ /*pDev */ );
/* Quartz support on Mac OS X uses the HIToolbox
framework whose GetWindowAttributes function conflicts here. */
@@ -152,121 +140,93 @@ extern void Darwin_X_GetWindowAttributes(
#else
extern _X_EXPORT void GetWindowAttributes(
#endif
- WindowPtr /*pWin*/,
- ClientPtr /*client*/,
- xGetWindowAttributesReply* /* wa */);
-
-extern _X_EXPORT void GravityTranslate(
- int /*x*/,
- int /*y*/,
- int /*oldx*/,
- int /*oldy*/,
- int /*dw*/,
- int /*dh*/,
- unsigned /*gravity*/,
- int* /*destx*/,
- int* /*desty*/);
-
-extern _X_EXPORT int ConfigureWindow(
- WindowPtr /*pWin*/,
- Mask /*mask*/,
- XID* /*vlist*/,
- ClientPtr /*client*/);
-
-extern _X_EXPORT int CirculateWindow(
- WindowPtr /*pParent*/,
- int /*direction*/,
- ClientPtr /*client*/);
-
-extern _X_EXPORT int ReparentWindow(
- WindowPtr /*pWin*/,
- WindowPtr /*pParent*/,
- int /*x*/,
- int /*y*/,
- ClientPtr /*client*/);
-
-extern _X_EXPORT int MapWindow(
- WindowPtr /*pWin*/,
- ClientPtr /*client*/);
-
-extern _X_EXPORT void MapSubwindows(
- WindowPtr /*pParent*/,
- ClientPtr /*client*/);
-
-extern _X_EXPORT int UnmapWindow(
- WindowPtr /*pWin*/,
- Bool /*fromConfigure*/);
-
-extern _X_EXPORT void UnmapSubwindows(
- WindowPtr /*pWin*/);
-
-extern _X_EXPORT void HandleSaveSet(
- ClientPtr /*client*/);
-
-extern _X_EXPORT Bool PointInWindowIsVisible(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/);
-
-extern _X_EXPORT RegionPtr NotClippedByChildren(
- WindowPtr /*pWin*/);
-
-extern _X_EXPORT void SendVisibilityNotify(
- WindowPtr /*pWin*/);
-
-extern _X_EXPORT int dixSaveScreens(
- ClientPtr client,
- int on,
- int mode);
-
-extern _X_EXPORT int SaveScreens(
- int on,
- int mode);
-
-extern _X_EXPORT WindowPtr FindWindowWithOptional(
- WindowPtr /*w*/);
-
-extern _X_EXPORT void CheckWindowOptionalNeed(
- WindowPtr /*w*/);
-
-extern _X_EXPORT Bool MakeWindowOptional(
- WindowPtr /*pWin*/);
-
-extern _X_EXPORT WindowPtr MoveWindowInStack(
- WindowPtr /*pWin*/,
- WindowPtr /*pNextSib*/);
-
-extern _X_EXPORT void SetWinSize(
- WindowPtr /*pWin*/);
-
-extern _X_EXPORT void SetBorderSize(
- WindowPtr /*pWin*/);
-
-extern _X_EXPORT void ResizeChildrenWinSize(
- WindowPtr /*pWin*/,
- int /*dx*/,
- int /*dy*/,
- int /*dw*/,
- int /*dh*/);
+ WindowPtr /*pWin */ ,
+ ClientPtr /*client */ ,
+ xGetWindowAttributesReply *
+ /* wa */ );
+
+extern _X_EXPORT void GravityTranslate(int /*x */ ,
+ int /*y */ ,
+ int /*oldx */ ,
+ int /*oldy */ ,
+ int /*dw */ ,
+ int /*dh */ ,
+ unsigned /*gravity */ ,
+ int * /*destx */ ,
+ int * /*desty */ );
+
+extern _X_EXPORT int ConfigureWindow(WindowPtr /*pWin */ ,
+ Mask /*mask */ ,
+ XID * /*vlist */ ,
+ ClientPtr /*client */ );
+
+extern _X_EXPORT int CirculateWindow(WindowPtr /*pParent */ ,
+ int /*direction */ ,
+ ClientPtr /*client */ );
+
+extern _X_EXPORT int ReparentWindow(WindowPtr /*pWin */ ,
+ WindowPtr /*pParent */ ,
+ int /*x */ ,
+ int /*y */ ,
+ ClientPtr /*client */ );
+
+extern _X_EXPORT int MapWindow(WindowPtr /*pWin */ ,
+ ClientPtr /*client */ );
+
+extern _X_EXPORT void MapSubwindows(WindowPtr /*pParent */ ,
+ ClientPtr /*client */ );
+
+extern _X_EXPORT int UnmapWindow(WindowPtr /*pWin */ ,
+ Bool /*fromConfigure */ );
+
+extern _X_EXPORT void UnmapSubwindows(WindowPtr /*pWin */ );
+
+extern _X_EXPORT void HandleSaveSet(ClientPtr /*client */ );
+
+extern _X_EXPORT Bool PointInWindowIsVisible(WindowPtr /*pWin */ ,
+ int /*x */ ,
+ int /*y */ );
+
+extern _X_EXPORT RegionPtr NotClippedByChildren(WindowPtr /*pWin */ );
+
+extern _X_EXPORT void SendVisibilityNotify(WindowPtr /*pWin */ );
+
+extern _X_EXPORT int dixSaveScreens(ClientPtr client, int on, int mode);
+
+extern _X_EXPORT int SaveScreens(int on, int mode);
+
+extern _X_EXPORT WindowPtr FindWindowWithOptional(WindowPtr /*w */ );
+
+extern _X_EXPORT void CheckWindowOptionalNeed(WindowPtr /*w */ );
+
+extern _X_EXPORT Bool MakeWindowOptional(WindowPtr /*pWin */ );
+
+extern _X_EXPORT WindowPtr MoveWindowInStack(WindowPtr /*pWin */ ,
+ WindowPtr /*pNextSib */ );
+
+extern _X_EXPORT void SetWinSize(WindowPtr /*pWin */ );
+
+extern _X_EXPORT void SetBorderSize(WindowPtr /*pWin */ );
+
+extern _X_EXPORT void ResizeChildrenWinSize(WindowPtr /*pWin */ ,
+ int /*dx */ ,
+ int /*dy */ ,
+ int /*dw */ ,
+ int /*dh */ );
extern _X_EXPORT void ShapeExtensionInit(void);
-extern _X_EXPORT void SendShapeNotify(
- WindowPtr /* pWin */,
- int /* which */ );
+extern _X_EXPORT void SendShapeNotify(WindowPtr /* pWin */ ,
+ int /* which */ );
-extern _X_EXPORT RegionPtr CreateBoundingShape(
- WindowPtr /* pWin */ );
+extern _X_EXPORT RegionPtr CreateBoundingShape(WindowPtr /* pWin */ );
-extern _X_EXPORT RegionPtr CreateClipShape(
- WindowPtr /* pWin */ );
+extern _X_EXPORT RegionPtr CreateClipShape(WindowPtr /* pWin */ );
-extern _X_EXPORT void DisableMapUnmapEvents(
- WindowPtr /* pWin */ );
-extern _X_EXPORT void EnableMapUnmapEvents(
- WindowPtr /* pWin */ );
+extern _X_EXPORT void DisableMapUnmapEvents(WindowPtr /* pWin */ );
+extern _X_EXPORT void EnableMapUnmapEvents(WindowPtr /* pWin */ );
extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, Bool enable);
extern _X_EXPORT void PrintWindowTree(void);
-#endif /* WINDOW_H */
+#endif /* WINDOW_H */
diff --git a/xorg-server/include/xkbfile.h b/xorg-server/include/xkbfile.h
index db7dbfa40..9f3b04c30 100644
--- a/xorg-server/include/xkbfile.h
+++ b/xorg-server/include/xkbfile.h
@@ -39,14 +39,13 @@
#define XkbMapDefined (1<<0)
#define XkbStateDefined (1<<1)
-typedef void (*XkbFileAddOnFunc)(
- FILE * /* file */,
- XkbDescPtr /* result */,
- Bool /* topLevel */,
- Bool /* showImplicit */,
- int /* fileSection */,
- void * /* priv */
-);
+typedef void (*XkbFileAddOnFunc) (FILE * /* file */ ,
+ XkbDescPtr /* result */ ,
+ Bool /* topLevel */ ,
+ Bool /* showImplicit */ ,
+ int /* fileSection */ ,
+ void * /* priv */
+ );
/***====================================================================***/
@@ -82,101 +81,81 @@ typedef void (*XkbFileAddOnFunc)(
_XFUNCPROTOBEGIN
-extern _X_EXPORT char * XkbIndentText(
- unsigned /* size */
-);
-
-extern _X_EXPORT char * XkbAtomText(
- Atom /* atm */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbKeysymText(
- KeySym /* sym */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbStringText(
- char * /* str */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbKeyNameText(
- char * /* name */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char *
-XkbModIndexText(
- unsigned /* ndx */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char *
-XkbModMaskText(
- unsigned /* mask */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbVModIndexText(
- XkbDescPtr /* xkb */,
- unsigned /* ndx */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbVModMaskText(
- XkbDescPtr /* xkb */,
- unsigned /* modMask */,
- unsigned /* mask */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbConfigText(
- unsigned /* config */,
- unsigned /* format */
-);
-
-extern _X_EXPORT const char * XkbSIMatchText(
- unsigned /* type */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbIMWhichStateMaskText(
- unsigned /* use_which */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbControlsMaskText(
- unsigned /* ctrls */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbGeomFPText(
- int /* val */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbDoodadTypeText(
- unsigned /* type */,
- unsigned /* format */
-);
-
-extern _X_EXPORT const char * XkbActionTypeText(
- unsigned /* type */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbActionText(
- XkbDescPtr /* xkb */,
- XkbAction * /* action */,
- unsigned /* format */
-);
-
-extern _X_EXPORT char * XkbBehaviorText(
- XkbDescPtr /* xkb */,
- XkbBehavior * /* behavior */,
- unsigned /* format */
-);
+extern _X_EXPORT char *XkbIndentText(unsigned /* size */
+ );
+
+extern _X_EXPORT char *XkbAtomText(Atom /* atm */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbKeysymText(KeySym /* sym */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbStringText(char * /* str */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbKeyNameText(char * /* name */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbModIndexText(unsigned /* ndx */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbModMaskText(unsigned /* mask */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbVModIndexText(XkbDescPtr /* xkb */ ,
+ unsigned /* ndx */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbVModMaskText(XkbDescPtr /* xkb */ ,
+ unsigned /* modMask */ ,
+ unsigned /* mask */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbConfigText(unsigned /* config */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT const char *XkbSIMatchText(unsigned /* type */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbIMWhichStateMaskText(unsigned /* use_which */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbControlsMaskText(unsigned /* ctrls */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbGeomFPText(int /* val */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbDoodadTypeText(unsigned /* type */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT const char *XkbActionTypeText(unsigned /* type */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbActionText(XkbDescPtr /* xkb */ ,
+ XkbAction * /* action */ ,
+ unsigned /* format */
+ );
+
+extern _X_EXPORT char *XkbBehaviorText(XkbDescPtr /* xkb */ ,
+ XkbBehavior * /* behavior */ ,
+ unsigned /* format */
+ );
/***====================================================================***/
@@ -189,22 +168,19 @@ extern _X_EXPORT char * XkbBehaviorText(
#define XkbKSIsDeadKey(k) \
(((k)>=XK_dead_grave)&&((k)<=XK_dead_semivoiced_sound))
-extern _X_EXPORT unsigned _XkbKSCheckCase(
- KeySym /* sym */
-);
+extern _X_EXPORT unsigned _XkbKSCheckCase(KeySym /* sym */
+ );
-extern _X_EXPORT int XkbFindKeycodeByName(
- XkbDescPtr /* xkb */,
- char * /* name */,
- Bool /* use_aliases */
-);
+extern _X_EXPORT int XkbFindKeycodeByName(XkbDescPtr /* xkb */ ,
+ char * /* name */ ,
+ Bool /* use_aliases */
+ );
/***====================================================================***/
-extern _X_EXPORT Atom XkbInternAtom(
- char * /* name */,
- Bool /* onlyIfExists */
-);
+extern _X_EXPORT Atom XkbInternAtom(char * /* name */ ,
+ Bool /* onlyIfExists */
+ );
/***====================================================================***/
@@ -214,97 +190,87 @@ extern _X_EXPORT Atom XkbInternAtom(
#define XkbDW_Doodad 1
#define XkbDW_Section 2
typedef struct _XkbDrawable {
- int type;
- int priority;
- union {
- XkbDoodadPtr doodad;
- XkbSectionPtr section;
- } u;
- struct _XkbDrawable * next;
-} XkbDrawableRec,*XkbDrawablePtr;
+ int type;
+ int priority;
+ union {
+ XkbDoodadPtr doodad;
+ XkbSectionPtr section;
+ } u;
+ struct _XkbDrawable *next;
+} XkbDrawableRec, *XkbDrawablePtr;
#endif
/***====================================================================***/
-extern _X_EXPORT unsigned XkbConvertGetByNameComponents(
- Bool /* toXkm */,
- unsigned /* orig */
-);
+extern _X_EXPORT unsigned XkbConvertGetByNameComponents(Bool /* toXkm */ ,
+ unsigned /* orig */
+ );
-extern _X_EXPORT Bool XkbNameMatchesPattern(
- char * /* name */,
- char * /* pattern */
-);
+extern _X_EXPORT Bool XkbNameMatchesPattern(char * /* name */ ,
+ char * /* pattern */
+ );
/***====================================================================***/
-extern _X_EXPORT Bool XkbWriteXKBKeycodes(
- FILE * /* file */,
- XkbDescPtr /* result */,
- Bool /* topLevel */,
- Bool /* showImplicit */,
- XkbFileAddOnFunc /* addOn */,
- void * /* priv */
-);
-
-extern _X_EXPORT Bool XkbWriteXKBKeyTypes(
- FILE * /* file */,
- XkbDescPtr /* result */,
- Bool /* topLevel */,
- Bool /* showImplicit */,
- XkbFileAddOnFunc /* addOn */,
- void * /* priv */
-);
-
-extern _X_EXPORT Bool XkbWriteXKBCompatMap(
- FILE * /* file */,
- XkbDescPtr /* result */,
- Bool /* topLevel */,
- Bool /* showImplicit */,
- XkbFileAddOnFunc /* addOn */,
- void * /* priv */
-);
-
-extern _X_EXPORT Bool XkbWriteXKBSymbols(
- FILE * /* file */,
- XkbDescPtr /* result */,
- Bool /* topLevel */,
- Bool /* showImplicit */,
- XkbFileAddOnFunc /* addOn */,
- void * /* priv */
-);
-
-extern _X_EXPORT Bool XkbWriteXKBGeometry(
- FILE * /* file */,
- XkbDescPtr /* result */,
- Bool /* topLevel */,
- Bool /* showImplicit */,
- XkbFileAddOnFunc /* addOn */,
- void * /* priv */
-);
-
-extern _X_EXPORT Bool XkbWriteXKBKeymapForNames(
- FILE * /* file */,
- XkbComponentNamesPtr /* names */,
- XkbDescPtr /* xkb */,
- unsigned /* want */,
- unsigned /* need */
-);
+extern _X_EXPORT Bool XkbWriteXKBKeycodes(FILE * /* file */ ,
+ XkbDescPtr /* result */ ,
+ Bool /* topLevel */ ,
+ Bool /* showImplicit */ ,
+ XkbFileAddOnFunc /* addOn */ ,
+ void * /* priv */
+ );
+
+extern _X_EXPORT Bool XkbWriteXKBKeyTypes(FILE * /* file */ ,
+ XkbDescPtr /* result */ ,
+ Bool /* topLevel */ ,
+ Bool /* showImplicit */ ,
+ XkbFileAddOnFunc /* addOn */ ,
+ void * /* priv */
+ );
+
+extern _X_EXPORT Bool XkbWriteXKBCompatMap(FILE * /* file */ ,
+ XkbDescPtr /* result */ ,
+ Bool /* topLevel */ ,
+ Bool /* showImplicit */ ,
+ XkbFileAddOnFunc /* addOn */ ,
+ void * /* priv */
+ );
+
+extern _X_EXPORT Bool XkbWriteXKBSymbols(FILE * /* file */ ,
+ XkbDescPtr /* result */ ,
+ Bool /* topLevel */ ,
+ Bool /* showImplicit */ ,
+ XkbFileAddOnFunc /* addOn */ ,
+ void * /* priv */
+ );
+
+extern _X_EXPORT Bool XkbWriteXKBGeometry(FILE * /* file */ ,
+ XkbDescPtr /* result */ ,
+ Bool /* topLevel */ ,
+ Bool /* showImplicit */ ,
+ XkbFileAddOnFunc /* addOn */ ,
+ void * /* priv */
+ );
+
+extern _X_EXPORT Bool XkbWriteXKBKeymapForNames(FILE * /* file */ ,
+ XkbComponentNamesPtr /* names */
+ ,
+ XkbDescPtr /* xkb */ ,
+ unsigned /* want */ ,
+ unsigned /* need */
+ );
/***====================================================================***/
-extern _X_EXPORT Bool XkmProbe(
- FILE * /* file */
-);
+extern _X_EXPORT Bool XkmProbe(FILE * /* file */
+ );
-extern _X_EXPORT unsigned XkmReadFile(
- FILE * /* file */,
- unsigned /* need */,
- unsigned /* want */,
- XkbDescPtr * /* result */
-);
+extern _X_EXPORT unsigned XkmReadFile(FILE * /* file */ ,
+ unsigned /* need */ ,
+ unsigned /* want */ ,
+ XkbDescPtr * /* result */
+ );
_XFUNCPROTOEND
-
-#endif /* _XKBFILE_H_ */
+#endif /* _XKBFILE_H_ */
diff --git a/xorg-server/include/xkbrules.h b/xorg-server/include/xkbrules.h
index 0f3f93490..d21731884 100644
--- a/xorg-server/include/xkbrules.h
+++ b/xorg-server/include/xkbrules.h
@@ -30,41 +30,41 @@
/***====================================================================***/
typedef struct _XkbRMLVOSet {
- char * rules;
- char * model;
- char * layout;
- char * variant;
- char * options;
+ char *rules;
+ char *model;
+ char *layout;
+ char *variant;
+ char *options;
} XkbRMLVOSet;
typedef struct _XkbRF_VarDefs {
- char * model;
- char * layout;
- char * variant;
- char * options;
-} XkbRF_VarDefsRec,*XkbRF_VarDefsPtr;
+ char *model;
+ char *layout;
+ char *variant;
+ char *options;
+} XkbRF_VarDefsRec, *XkbRF_VarDefsPtr;
typedef struct _XkbRF_Rule {
- int number;
- int layout_num;
- int variant_num;
- char * model;
- char * layout;
- char * variant;
- char * option;
- /* yields */
- char * keycodes;
- char * symbols;
- char * types;
- char * compat;
- char * geometry;
- unsigned flags;
-} XkbRF_RuleRec,*XkbRF_RulePtr;
+ int number;
+ int layout_num;
+ int variant_num;
+ char *model;
+ char *layout;
+ char *variant;
+ char *option;
+ /* yields */
+ char *keycodes;
+ char *symbols;
+ char *types;
+ char *compat;
+ char *geometry;
+ unsigned flags;
+} XkbRF_RuleRec, *XkbRF_RulePtr;
typedef struct _XkbRF_Group {
- int number;
- char * name;
- char * words;
+ int number;
+ char *name;
+ char *words;
} XkbRF_GroupRec, *XkbRF_GroupPtr;
#define XkbRF_PendingMatch (1L<<1)
@@ -74,12 +74,12 @@ typedef struct _XkbRF_Group {
#define XkbRF_Invalid (1L<<5)
typedef struct _XkbRF_Rules {
- unsigned short sz_rules;
- unsigned short num_rules;
- XkbRF_RulePtr rules;
- unsigned short sz_groups;
- unsigned short num_groups;
- XkbRF_GroupPtr groups;
+ unsigned short sz_rules;
+ unsigned short num_rules;
+ XkbRF_RulePtr rules;
+ unsigned short sz_groups;
+ unsigned short num_groups;
+ XkbRF_GroupPtr groups;
} XkbRF_RulesRec, *XkbRF_RulesPtr;
/***====================================================================***/
@@ -87,33 +87,29 @@ typedef struct _XkbRF_Rules {
_XFUNCPROTOBEGIN
/* Seems preferable to dragging xkbstr.h in. */
-struct _XkbComponentNames;
+ struct _XkbComponentNames;
-extern _X_EXPORT Bool XkbRF_GetComponents(
- XkbRF_RulesPtr /* rules */,
- XkbRF_VarDefsPtr /* var_defs */,
- struct _XkbComponentNames * /* names */
-);
+extern _X_EXPORT Bool XkbRF_GetComponents(XkbRF_RulesPtr /* rules */ ,
+ XkbRF_VarDefsPtr /* var_defs */ ,
+ struct _XkbComponentNames * /* names */
+ );
-extern _X_EXPORT Bool XkbRF_LoadRules(
- FILE * /* file */,
- XkbRF_RulesPtr /* rules */
-);
+extern _X_EXPORT Bool XkbRF_LoadRules(FILE * /* file */ ,
+ XkbRF_RulesPtr /* rules */
+ );
-extern _X_EXPORT Bool XkbRF_LoadRulesByName(
- char * /* base */,
- char * /* locale */,
- XkbRF_RulesPtr /* rules */
-);
+extern _X_EXPORT Bool XkbRF_LoadRulesByName(char * /* base */ ,
+ char * /* locale */ ,
+ XkbRF_RulesPtr /* rules */
+ );
/***====================================================================***/
extern _X_EXPORT XkbRF_RulesPtr XkbRF_Create(void);
-extern _X_EXPORT void XkbRF_Free(
- XkbRF_RulesPtr /* rules */,
- Bool /* freeRules */
-);
+extern _X_EXPORT void XkbRF_Free(XkbRF_RulesPtr /* rules */ ,
+ Bool /* freeRules */
+ );
/***====================================================================***/
@@ -121,5 +117,4 @@ extern _X_EXPORT void XkbRF_Free(
#define _XKB_RF_NAMES_PROP_MAXLEN 1024
_XFUNCPROTOEND
-
-#endif /* _XKBRULES_H_ */
+#endif /* _XKBRULES_H_ */
diff --git a/xorg-server/include/xkbsrv.h b/xorg-server/include/xkbsrv.h
index 7b0053486..3b72885bd 100644
--- a/xorg-server/include/xkbsrv.h
+++ b/xorg-server/include/xkbsrv.h
@@ -59,40 +59,41 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "events.h"
typedef struct _XkbInterest {
- DeviceIntPtr dev;
- ClientPtr client;
- XID resource;
- struct _XkbInterest * next;
- CARD16 extDevNotifyMask;
- CARD16 stateNotifyMask;
- CARD16 namesNotifyMask;
- CARD32 ctrlsNotifyMask;
- CARD8 compatNotifyMask;
- BOOL bellNotifyMask;
- BOOL actionMessageMask;
- CARD16 accessXNotifyMask;
- CARD32 iStateNotifyMask;
- CARD32 iMapNotifyMask;
- CARD16 altSymsNotifyMask;
- CARD32 autoCtrls;
- CARD32 autoCtrlValues;
-} XkbInterestRec,*XkbInterestPtr;
+ DeviceIntPtr dev;
+ ClientPtr client;
+ XID resource;
+ struct _XkbInterest *next;
+ CARD16 extDevNotifyMask;
+ CARD16 stateNotifyMask;
+ CARD16 namesNotifyMask;
+ CARD32 ctrlsNotifyMask;
+ CARD8 compatNotifyMask;
+ BOOL bellNotifyMask;
+ BOOL actionMessageMask;
+ CARD16 accessXNotifyMask;
+ CARD32 iStateNotifyMask;
+ CARD32 iMapNotifyMask;
+ CARD16 altSymsNotifyMask;
+ CARD32 autoCtrls;
+ CARD32 autoCtrlValues;
+} XkbInterestRec, *XkbInterestPtr;
typedef struct _XkbRadioGroup {
- CARD8 flags;
- CARD8 nMembers;
- CARD8 dfltDown;
- CARD8 currentDown;
- CARD8 members[XkbRGMaxMembers];
+ CARD8 flags;
+ CARD8 nMembers;
+ CARD8 dfltDown;
+ CARD8 currentDown;
+ CARD8 members[XkbRGMaxMembers];
} XkbRadioGroupRec, *XkbRadioGroupPtr;
-typedef struct _XkbEventCause {
- CARD8 kc;
- CARD8 event;
- CARD8 mjr;
- CARD8 mnr;
- ClientPtr client;
-} XkbEventCauseRec,*XkbEventCausePtr;
+typedef struct _XkbEventCause {
+ CARD8 kc;
+ CARD8 event;
+ CARD8 mjr;
+ CARD8 mnr;
+ ClientPtr client;
+} XkbEventCauseRec, *XkbEventCausePtr;
+
#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\
(c)->mjr= (c)->mnr= 0; \
(c)->client= NULL; }
@@ -127,99 +128,98 @@ typedef struct _XkbEventCause {
#define _BEEP_BOUNCE_REJECT 15
typedef struct _XkbFilter {
- CARD16 keycode;
- CARD8 what;
- CARD8 active;
- CARD8 filterOthers;
- CARD32 priv;
- XkbAction upAction;
- int (*filter)(
- struct _XkbSrvInfo* /* xkbi */,
- struct _XkbFilter * /* filter */,
- unsigned /* keycode */,
- XkbAction * /* action */
- );
- struct _XkbFilter *next;
-} XkbFilterRec,*XkbFilterPtr;
+ CARD16 keycode;
+ CARD8 what;
+ CARD8 active;
+ CARD8 filterOthers;
+ CARD32 priv;
+ XkbAction upAction;
+ int (*filter) (struct _XkbSrvInfo * /* xkbi */ ,
+ struct _XkbFilter * /* filter */ ,
+ unsigned /* keycode */ ,
+ XkbAction * /* action */
+ );
+ struct _XkbFilter *next;
+} XkbFilterRec, *XkbFilterPtr;
typedef struct _XkbSrvInfo {
- XkbStateRec prev_state;
- XkbStateRec state;
- XkbDescPtr desc;
-
- DeviceIntPtr device;
- KbdCtrlProcPtr kbdProc;
-
- XkbRadioGroupPtr radioGroups;
- CARD8 nRadioGroups;
- CARD8 clearMods;
- CARD8 setMods;
- INT16 groupChange;
-
- CARD16 dfltPtrDelta;
-
- double mouseKeysCurve;
- double mouseKeysCurveFactor;
- INT16 mouseKeysDX;
- INT16 mouseKeysDY;
- CARD8 mouseKeysFlags;
- Bool mouseKeysAccel;
- CARD8 mouseKeysCounter;
-
- CARD8 lockedPtrButtons;
- CARD8 shiftKeyCount;
- KeyCode mouseKey;
- KeyCode inactiveKey;
- KeyCode slowKey;
- KeyCode repeatKey;
- CARD8 krgTimerActive;
- CARD8 beepType;
- CARD8 beepCount;
-
- CARD32 flags;
- CARD32 lastPtrEventTime;
- CARD32 lastShiftEventTime;
- OsTimerPtr beepTimer;
- OsTimerPtr mouseKeyTimer;
- OsTimerPtr slowKeysTimer;
- OsTimerPtr bounceKeysTimer;
- OsTimerPtr repeatKeyTimer;
- OsTimerPtr krgTimer;
-
- int szFilters;
- XkbFilterPtr filters;
+ XkbStateRec prev_state;
+ XkbStateRec state;
+ XkbDescPtr desc;
+
+ DeviceIntPtr device;
+ KbdCtrlProcPtr kbdProc;
+
+ XkbRadioGroupPtr radioGroups;
+ CARD8 nRadioGroups;
+ CARD8 clearMods;
+ CARD8 setMods;
+ INT16 groupChange;
+
+ CARD16 dfltPtrDelta;
+
+ double mouseKeysCurve;
+ double mouseKeysCurveFactor;
+ INT16 mouseKeysDX;
+ INT16 mouseKeysDY;
+ CARD8 mouseKeysFlags;
+ Bool mouseKeysAccel;
+ CARD8 mouseKeysCounter;
+
+ CARD8 lockedPtrButtons;
+ CARD8 shiftKeyCount;
+ KeyCode mouseKey;
+ KeyCode inactiveKey;
+ KeyCode slowKey;
+ KeyCode repeatKey;
+ CARD8 krgTimerActive;
+ CARD8 beepType;
+ CARD8 beepCount;
+
+ CARD32 flags;
+ CARD32 lastPtrEventTime;
+ CARD32 lastShiftEventTime;
+ OsTimerPtr beepTimer;
+ OsTimerPtr mouseKeyTimer;
+ OsTimerPtr slowKeysTimer;
+ OsTimerPtr bounceKeysTimer;
+ OsTimerPtr repeatKeyTimer;
+ OsTimerPtr krgTimer;
+
+ int szFilters;
+ XkbFilterPtr filters;
} XkbSrvInfoRec, *XkbSrvInfoPtr;
#define XkbSLI_IsDefault (1L<<0)
#define XkbSLI_HasOwnState (1L<<1)
-typedef struct _XkbSrvLedInfo {
- CARD16 flags;
- CARD16 class;
- CARD16 id;
- union {
- KbdFeedbackPtr kf;
- LedFeedbackPtr lf;
- } fb;
-
- CARD32 physIndicators;
- CARD32 autoState;
- CARD32 explicitState;
- CARD32 effectiveState;
-
- CARD32 mapsPresent;
- CARD32 namesPresent;
- XkbIndicatorMapPtr maps;
- Atom * names;
-
- CARD32 usesBase;
- CARD32 usesLatched;
- CARD32 usesLocked;
- CARD32 usesEffective;
- CARD32 usesCompat;
- CARD32 usesControls;
-
- CARD32 usedComponents;
+typedef struct _XkbSrvLedInfo {
+ CARD16 flags;
+ CARD16 class;
+ CARD16 id;
+ union {
+ KbdFeedbackPtr kf;
+ LedFeedbackPtr lf;
+ } fb;
+
+ CARD32 physIndicators;
+ CARD32 autoState;
+ CARD32 explicitState;
+ CARD32 effectiveState;
+
+ CARD32 mapsPresent;
+ CARD32 namesPresent;
+ XkbIndicatorMapPtr maps;
+ Atom *names;
+
+ CARD32 usesBase;
+ CARD32 usesLatched;
+ CARD32 usesLocked;
+ CARD32 usesEffective;
+ CARD32 usesCompat;
+ CARD32 usesControls;
+
+ CARD32 usedComponents;
} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr;
/*
@@ -236,8 +236,7 @@ typedef struct _XkbSrvLedInfo {
*/
#define _XkbStateNotifyInProgress (1<<0)
-typedef struct
-{
+typedef struct {
ProcessInputProc processInputProc;
/* If processInputProc is set to something different than realInputProc,
* UNWRAP and COND_WRAP will not touch processInputProc and update only
@@ -276,6 +275,7 @@ typedef struct
device->unwrapProc = oldprocs->unwrapProc;
extern _X_EXPORT DevPrivateKeyRec xkbDevicePrivateKeyRec;
+
#define xkbDevicePrivateKey (&xkbDevicePrivateKeyRec)
#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr)dixLookupPrivate(&(dev)->devPrivates, xkbDevicePrivateKey))
@@ -284,7 +284,6 @@ extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer);
/***====================================================================***/
-
/***====================================================================***/
#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask)
@@ -293,646 +292,536 @@ extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer);
/***====================================================================***/
-extern _X_EXPORT int XkbReqCode;
-extern _X_EXPORT int XkbEventBase;
-extern _X_EXPORT int XkbKeyboardErrorCode;
-extern _X_EXPORT const char * XkbBaseDirectory;
-extern _X_EXPORT const char * XkbBinDirectory;
+extern _X_EXPORT int XkbReqCode;
+extern _X_EXPORT int XkbEventBase;
+extern _X_EXPORT int XkbKeyboardErrorCode;
+extern _X_EXPORT const char *XkbBaseDirectory;
+extern _X_EXPORT const char *XkbBinDirectory;
-extern _X_EXPORT CARD32 xkbDebugFlags;
+extern _X_EXPORT CARD32 xkbDebugFlags;
-#define _XkbLibError(c,l,d) /* Epoch fail */
+#define _XkbLibError(c,l,d) /* Epoch fail */
#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))
-extern _X_EXPORT int DeviceKeyPress,DeviceKeyRelease,DeviceMotionNotify;
-extern _X_EXPORT int DeviceButtonPress,DeviceButtonRelease;
+extern _X_EXPORT int DeviceKeyPress, DeviceKeyRelease, DeviceMotionNotify;
+extern _X_EXPORT int DeviceButtonPress, DeviceButtonRelease;
#define Status int
-extern _X_EXPORT void XkbUseMsg(
- void
-);
-
-extern _X_EXPORT int XkbProcessArguments(
- int /* argc */,
- char ** /* argv */,
- int /* i */
-);
-
-extern _X_EXPORT Bool XkbInitPrivates(void);
-
-extern _X_EXPORT void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc);
-
-extern _X_EXPORT void XkbFreeCompatMap(
- XkbDescPtr /* xkb */,
- unsigned int /* which */,
- Bool /* freeMap */
-);
-
-extern _X_EXPORT void XkbFreeNames(
- XkbDescPtr /* xkb */,
- unsigned int /* which */,
- Bool /* freeMap */
-);
-
-extern _X_EXPORT int _XkbLookupAnyDevice(
- DeviceIntPtr *pDev,
- int id,
- ClientPtr client,
- Mask access_mode,
- int *xkb_err
-);
-
-extern _X_EXPORT int _XkbLookupKeyboard(
- DeviceIntPtr *pDev,
- int id,
- ClientPtr client,
- Mask access_mode,
- int *xkb_err
-);
-
-extern _X_EXPORT int _XkbLookupBellDevice(
- DeviceIntPtr *pDev,
- int id,
- ClientPtr client,
- Mask access_mode,
- int *xkb_err
-);
-
-extern _X_EXPORT int _XkbLookupLedDevice(
- DeviceIntPtr *pDev,
- int id,
- ClientPtr client,
- Mask access_mode,
- int *xkb_err
-);
-
-extern _X_EXPORT int _XkbLookupButtonDevice(
- DeviceIntPtr *pDev,
- int id,
- ClientPtr client,
- Mask access_mode,
- int *xkb_err
-);
-
-extern _X_EXPORT XkbDescPtr XkbAllocKeyboard(
- void
-);
-
-extern _X_EXPORT Status XkbAllocClientMap(
- XkbDescPtr /* xkb */,
- unsigned int /* which */,
- unsigned int /* nTypes */
-);
-
-extern _X_EXPORT Status XkbAllocServerMap(
- XkbDescPtr /* xkb */,
- unsigned int /* which */,
- unsigned int /* nNewActions */
-);
-
-extern _X_EXPORT void XkbFreeClientMap(
- XkbDescPtr /* xkb */,
- unsigned int /* what */,
- Bool /* freeMap */
-);
-
-extern _X_EXPORT void XkbFreeServerMap(
- XkbDescPtr /* xkb */,
- unsigned int /* what */,
- Bool /* freeMap */
-);
-
-extern _X_EXPORT Status XkbAllocIndicatorMaps(
- XkbDescPtr /* xkb */
-);
-
-extern _X_EXPORT Status XkbAllocCompatMap(
- XkbDescPtr /* xkb */,
- unsigned int /* which */,
- unsigned int /* nInterpret */
-);
-
-extern _X_EXPORT Status XkbAllocNames(
- XkbDescPtr /* xkb */,
- unsigned int /* which */,
- int /* nTotalRG */,
- int /* nTotalAliases */
-);
-
-extern _X_EXPORT Status XkbAllocControls(
- XkbDescPtr /* xkb */,
- unsigned int /* which*/
-);
-
-extern _X_EXPORT Status XkbCopyKeyTypes(
- XkbKeyTypePtr /* from */,
- XkbKeyTypePtr /* into */,
- int /* num_types */
-);
-
-extern _X_EXPORT Status XkbResizeKeyType(
- XkbDescPtr /* xkb */,
- int /* type_ndx */,
- int /* map_count */,
- Bool /* want_preserve */,
- int /* new_num_lvls */
-);
-
-extern _X_EXPORT void XkbFreeKeyboard(
- XkbDescPtr /* xkb */,
- unsigned int /* which */,
- Bool /* freeDesc */
-);
-
-extern _X_EXPORT void XkbFreeComponentNames(
- XkbComponentNamesPtr /* names */,
- Bool /* freeNames */
-);
-
-extern _X_EXPORT void XkbSetActionKeyMods(
- XkbDescPtr /* xkb */,
- XkbAction * /* act */,
- unsigned int /* mods */
-);
-
-extern _X_EXPORT unsigned int XkbMaskForVMask(
- XkbDescPtr /* xkb */,
- unsigned int /* vmask */
-);
-
-extern _X_EXPORT Bool XkbVirtualModsToReal(
- XkbDescPtr /* xkb */,
- unsigned int /* virtua_mask */,
- unsigned int * /* mask_rtrn */
-);
-
-extern _X_EXPORT unsigned int XkbAdjustGroup(
- int /* group */,
- XkbControlsPtr /* ctrls */
-);
-
-extern _X_EXPORT KeySym *XkbResizeKeySyms(
- XkbDescPtr /* xkb */,
- int /* key */,
- int /* needed */
-);
-
-extern _X_EXPORT XkbAction *XkbResizeKeyActions(
- XkbDescPtr /* xkb */,
- int /* key */,
- int /* needed */
-);
-
-extern _X_EXPORT void XkbUpdateKeyTypesFromCore(
- DeviceIntPtr /* pXDev */,
- KeySymsPtr /* syms */,
- KeyCode /* first */,
- CARD8 /* num */,
- XkbChangesPtr /* pChanges */
-);
-
-extern _X_EXPORT void XkbUpdateDescActions(
- XkbDescPtr /* xkb */,
- KeyCode /* first */,
- CARD8 /* num */,
- XkbChangesPtr /* changes */
-);
-
-extern _X_EXPORT void XkbUpdateActions(
- DeviceIntPtr /* pXDev */,
- KeyCode /* first */,
- CARD8 /* num */,
- XkbChangesPtr /* pChanges */,
- unsigned int * /* needChecksRtrn */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT KeySymsPtr XkbGetCoreMap(
- DeviceIntPtr /* keybd */
-);
-
-extern _X_EXPORT void XkbApplyMappingChange(
- DeviceIntPtr /* pXDev */,
- KeySymsPtr /* map */,
- KeyCode /* firstKey */,
- CARD8 /* num */,
- CARD8 * /* modmap */,
- ClientPtr /* client */
-);
-
-extern _X_EXPORT void XkbSetIndicators(
- DeviceIntPtr /* pXDev */,
- CARD32 /* affect */,
- CARD32 /* values */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT void XkbUpdateIndicators(
- DeviceIntPtr /* keybd */,
- CARD32 /* changed */,
- Bool /* check_edevs */,
- XkbChangesPtr /* pChanges */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT XkbSrvLedInfoPtr XkbAllocSrvLedInfo(
- DeviceIntPtr /* dev */,
- KbdFeedbackPtr /* kf */,
- LedFeedbackPtr /* lf */,
- unsigned int /* needed_parts */
-);
-
-extern _X_EXPORT XkbSrvLedInfoPtr XkbCopySrvLedInfo(
- DeviceIntPtr /* dev */,
- XkbSrvLedInfoPtr /* src */,
- KbdFeedbackPtr /* kf */,
- LedFeedbackPtr /* lf */
-);
-
-
-extern _X_EXPORT XkbSrvLedInfoPtr XkbFindSrvLedInfo(
- DeviceIntPtr /* dev */,
- unsigned int /* class */,
- unsigned int /* id */,
- unsigned int /* needed_parts */
-);
-
-extern _X_EXPORT void XkbApplyLedNameChanges(
- DeviceIntPtr /* dev */,
- XkbSrvLedInfoPtr /* sli */,
- unsigned int /* changed_names */,
- xkbExtensionDeviceNotify * /* ed */,
- XkbChangesPtr /* changes */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT void XkbApplyLedMapChanges(
- DeviceIntPtr /* dev */,
- XkbSrvLedInfoPtr /* sli */,
- unsigned int /* changed_maps */,
- xkbExtensionDeviceNotify * /* ed */,
- XkbChangesPtr /* changes */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT void XkbApplyLedStateChanges(
- DeviceIntPtr /* dev */,
- XkbSrvLedInfoPtr /* sli */,
- unsigned int /* changed_leds */,
- xkbExtensionDeviceNotify * /* ed */,
- XkbChangesPtr /* changes */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT void XkbFlushLedEvents(
- DeviceIntPtr /* dev */,
- DeviceIntPtr /* kbd */,
- XkbSrvLedInfoPtr /* sli */,
- xkbExtensionDeviceNotify * /* ed */,
- XkbChangesPtr /* changes */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT unsigned int XkbIndicatorsToUpdate(
- DeviceIntPtr /* dev */,
- unsigned long /* state_changes */,
- Bool /* enabled_ctrl_changes */
-);
-
-extern _X_EXPORT void XkbComputeDerivedState(
- XkbSrvInfoPtr /* xkbi */
-);
-
-extern _X_EXPORT void XkbCheckSecondaryEffects(
- XkbSrvInfoPtr /* xkbi */,
- unsigned int /* which */,
- XkbChangesPtr /* changes */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT void XkbCheckIndicatorMaps(
- DeviceIntPtr /* dev */,
- XkbSrvLedInfoPtr /* sli */,
- unsigned int /* which */
-);
-
-extern _X_EXPORT unsigned int XkbStateChangedFlags(
- XkbStatePtr /* old */,
- XkbStatePtr /* new */
-);
-
-extern _X_EXPORT void XkbSendStateNotify(
- DeviceIntPtr /* kbd */,
- xkbStateNotify * /* pSN */
-);
-
-extern _X_EXPORT void XkbSendMapNotify(
- DeviceIntPtr /* kbd */,
- xkbMapNotify * /* ev */
-);
-
-extern _X_EXPORT int XkbComputeControlsNotify(
- DeviceIntPtr /* kbd */,
- XkbControlsPtr /* old */,
- XkbControlsPtr /* new */,
- xkbControlsNotify * /* pCN */,
- Bool /* forceCtrlProc */
-);
-
-extern _X_EXPORT void XkbSendControlsNotify(
- DeviceIntPtr /* kbd */,
- xkbControlsNotify * /* ev */
-);
-
-extern _X_EXPORT void XkbSendCompatMapNotify(
- DeviceIntPtr /* kbd */,
- xkbCompatMapNotify * /* ev */
-);
-
-extern _X_EXPORT void XkbHandleBell(
- BOOL /* force */,
- BOOL /* eventOnly */,
- DeviceIntPtr /* kbd */,
- CARD8 /* percent */,
- pointer /* ctrl */,
- CARD8 /* class */,
- Atom /* name */,
- WindowPtr /* pWin */,
- ClientPtr /* pClient */
-);
-
-extern _X_EXPORT void XkbSendAccessXNotify(
- DeviceIntPtr /* kbd */,
- xkbAccessXNotify * /* pEv */
-);
-
-extern _X_EXPORT void XkbSendNamesNotify(
- DeviceIntPtr /* kbd */,
- xkbNamesNotify * /* ev */
-);
-
-extern _X_EXPORT void XkbSendActionMessage(
- DeviceIntPtr /* kbd */,
- xkbActionMessage * /* ev */
-);
-
-extern _X_EXPORT void XkbSendExtensionDeviceNotify(
- DeviceIntPtr /* kbd */,
- ClientPtr /* client */,
- xkbExtensionDeviceNotify * /* ev */
-);
-
-extern _X_EXPORT void XkbSendNotification(
- DeviceIntPtr /* kbd */,
- XkbChangesPtr /* pChanges */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT void XkbProcessKeyboardEvent(
- DeviceEvent* /* event */,
- DeviceIntPtr /* keybd */
-);
-
-extern _X_EXPORT void XkbHandleActions(
- DeviceIntPtr /* dev */,
- DeviceIntPtr /* kbd */,
- DeviceEvent* /* event */
-);
-
-extern _X_EXPORT Bool XkbEnableDisableControls(
- XkbSrvInfoPtr /* xkbi */,
- unsigned long /* change */,
- unsigned long /* newValues */,
- XkbChangesPtr /* changes */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT void AccessXInit(
- DeviceIntPtr /* dev */
-);
-
-extern _X_EXPORT Bool AccessXFilterPressEvent(
- DeviceEvent* /* event */,
- DeviceIntPtr /* keybd */
-);
-
-extern _X_EXPORT Bool AccessXFilterReleaseEvent(
- DeviceEvent* /* event */,
- DeviceIntPtr /* keybd */
-);
-
-extern _X_EXPORT void AccessXCancelRepeatKey(
- XkbSrvInfoPtr /* xkbi */,
- KeyCode /* key */
-);
-
-extern _X_EXPORT void AccessXComputeCurveFactor(
- XkbSrvInfoPtr /* xkbi */,
- XkbControlsPtr /* ctrls */
-);
-
-extern _X_EXPORT XkbInterestPtr XkbFindClientResource(
- DevicePtr /* inDev */,
- ClientPtr /* client */
-);
-
-extern _X_EXPORT XkbInterestPtr XkbAddClientResource(
- DevicePtr /* inDev */,
- ClientPtr /* client */,
- XID /* id */
-);
-
-extern _X_EXPORT int XkbRemoveResourceClient(
- DevicePtr /* inDev */,
- XID /* id */
-);
-
-extern _X_EXPORT int XkbDDXAccessXBeep(
- DeviceIntPtr /* dev */,
- unsigned int /* what */,
- unsigned int /* which */
-);
-
-extern _X_EXPORT int XkbDDXUsesSoftRepeat(
- DeviceIntPtr /* dev */
-);
-
-extern _X_EXPORT void XkbDDXKeybdCtrlProc(
- DeviceIntPtr /* dev */,
- KeybdCtrl * /* ctrl */
-);
-
-extern _X_EXPORT void XkbDDXChangeControls(
- DeviceIntPtr /* dev */,
- XkbControlsPtr /* old */,
- XkbControlsPtr /* new */
-);
-
-extern _X_EXPORT void XkbDDXUpdateDeviceIndicators(
- DeviceIntPtr /* dev */,
- XkbSrvLedInfoPtr /* sli */,
- CARD32 /* newState */
-);
-
-extern _X_EXPORT int XkbDDXTerminateServer(
- DeviceIntPtr /* dev */,
- KeyCode /* key */,
- XkbAction * /* act */
-);
-
-extern _X_EXPORT int XkbDDXSwitchScreen(
- DeviceIntPtr /* dev */,
- KeyCode /* key */,
- XkbAction * /* act */
-);
-
-extern _X_EXPORT int XkbDDXPrivate(
- DeviceIntPtr /* dev */,
- KeyCode /* key */,
- XkbAction * /* act */
-);
-
-extern _X_EXPORT void XkbDisableComputedAutoRepeats(
- DeviceIntPtr /* pXDev */,
- unsigned int /* key */
-);
-
-extern _X_EXPORT void XkbSetRepeatKeys(
- DeviceIntPtr /* pXDev */,
- int /* key */,
- int /* onoff */
-);
-
-extern _X_EXPORT int XkbLatchModifiers(
- DeviceIntPtr /* pXDev */,
- CARD8 /* mask */,
- CARD8 /* latches */
-);
-
-extern _X_EXPORT int XkbLatchGroup(
- DeviceIntPtr /* pXDev */,
- int /* group */
-);
-
-extern _X_EXPORT void XkbClearAllLatchesAndLocks(
- DeviceIntPtr /* dev */,
- XkbSrvInfoPtr /* xkbi */,
- Bool /* genEv */,
- XkbEventCausePtr /* cause */
-);
-
-extern _X_EXPORT void XkbGetRulesDflts(
- XkbRMLVOSet * /* rmlvo */
-);
-
-extern _X_EXPORT void XkbFreeRMLVOSet(
- XkbRMLVOSet * /* rmlvo */,
- Bool /* freeRMLVO */
-);
-
-extern _X_EXPORT void XkbSetRulesDflts(
- XkbRMLVOSet * /* rmlvo */
-);
-
-extern _X_EXPORT void XkbDeleteRulesDflts(
- void
-);
-
-extern _X_EXPORT int SProcXkbDispatch(
- ClientPtr /* client */
-);
-
-extern _X_EXPORT XkbGeometryPtr XkbLookupNamedGeometry(
- DeviceIntPtr /* dev */,
- Atom /* name */,
- Bool * /* shouldFree */
-);
-
-extern _X_EXPORT void XkbConvertCase(
- KeySym /* sym */,
- KeySym * /* lower */,
- KeySym * /* upper */
-);
-
-extern _X_EXPORT Status XkbChangeKeycodeRange(
- XkbDescPtr /* xkb */,
- int /* minKC */,
- int /* maxKC */,
- XkbChangesPtr /* changes */
-);
-
-extern _X_EXPORT void XkbFreeSrvLedInfo(
- XkbSrvLedInfoPtr /* sli */
-);
-
-extern _X_EXPORT void XkbFreeInfo(
- XkbSrvInfoPtr /* xkbi */
-);
-
-extern _X_EXPORT Status XkbChangeTypesOfKey(
- XkbDescPtr /* xkb */,
- int /* key */,
- int /* nGroups */,
- unsigned int /* groups */,
- int * /* newTypesIn */,
- XkbMapChangesPtr /* changes */
-);
-
-extern _X_EXPORT int XkbKeyTypesForCoreSymbols(
- XkbDescPtr /* xkb */,
- int /* map_width */,
- KeySym * /* core_syms */,
- unsigned int /* protected */,
- int * /* types_inout */,
- KeySym * /* xkb_syms_rtrn */
-);
-
-extern _X_EXPORT Bool XkbApplyCompatMapToKey(
- XkbDescPtr /* xkb */,
- KeyCode /* key */,
- XkbChangesPtr /* changes */
-);
-
-extern _X_EXPORT Bool XkbApplyVirtualModChanges(
- XkbDescPtr /* xkb */,
- unsigned int /* changed */,
- XkbChangesPtr /* changes */
-);
-
-extern _X_EXPORT void XkbSendNewKeyboardNotify(
- DeviceIntPtr /* kbd */,
- xkbNewKeyboardNotify * /* pNKN */
-);
-
-extern Bool XkbCopyKeymap(
- XkbDescPtr /* dst */,
- XkbDescPtr /* src */);
-
-extern _X_EXPORT Bool XkbCopyDeviceKeymap(
- DeviceIntPtr /* dst */,
- DeviceIntPtr /* src */);
-
-extern void XkbFilterEvents(
- ClientPtr /* pClient */,
- int /* nEvents */,
- xEvent* /* xE */);
-
-extern int XkbGetEffectiveGroup(
- XkbSrvInfoPtr /* xkbi */,
- XkbStatePtr /* xkbstate */,
- CARD8 /* keycode */);
-
-extern void XkbMergeLockedPtrBtns(
- DeviceIntPtr /* master */);
-
-extern void XkbFakeDeviceButton(
- DeviceIntPtr /* dev */,
- int /* press */,
- int /* button */);
-
+extern _X_EXPORT void XkbUseMsg(void
+ );
+
+extern _X_EXPORT int XkbProcessArguments(int /* argc */ ,
+ char ** /* argv */ ,
+ int /* i */
+ );
+
+extern _X_EXPORT Bool XkbInitPrivates(void);
+
+extern _X_EXPORT void XkbSetExtension(DeviceIntPtr device,
+ ProcessInputProc proc);
+
+extern _X_EXPORT void XkbFreeCompatMap(XkbDescPtr /* xkb */ ,
+ unsigned int /* which */ ,
+ Bool /* freeMap */
+ );
+
+extern _X_EXPORT void XkbFreeNames(XkbDescPtr /* xkb */ ,
+ unsigned int /* which */ ,
+ Bool /* freeMap */
+ );
+
+extern _X_EXPORT int _XkbLookupAnyDevice(DeviceIntPtr *pDev,
+ int id,
+ ClientPtr client,
+ Mask access_mode, int *xkb_err);
+
+extern _X_EXPORT int _XkbLookupKeyboard(DeviceIntPtr *pDev,
+ int id,
+ ClientPtr client,
+ Mask access_mode, int *xkb_err);
+
+extern _X_EXPORT int _XkbLookupBellDevice(DeviceIntPtr *pDev,
+ int id,
+ ClientPtr client,
+ Mask access_mode, int *xkb_err);
+
+extern _X_EXPORT int _XkbLookupLedDevice(DeviceIntPtr *pDev,
+ int id,
+ ClientPtr client,
+ Mask access_mode, int *xkb_err);
+
+extern _X_EXPORT int _XkbLookupButtonDevice(DeviceIntPtr *pDev,
+ int id,
+ ClientPtr client,
+ Mask access_mode, int *xkb_err);
+
+extern _X_EXPORT XkbDescPtr XkbAllocKeyboard(void
+ );
+
+extern _X_EXPORT Status XkbAllocClientMap(XkbDescPtr /* xkb */ ,
+ unsigned int /* which */ ,
+ unsigned int /* nTypes */
+ );
+
+extern _X_EXPORT Status XkbAllocServerMap(XkbDescPtr /* xkb */ ,
+ unsigned int /* which */ ,
+ unsigned int /* nNewActions */
+ );
+
+extern _X_EXPORT void XkbFreeClientMap(XkbDescPtr /* xkb */ ,
+ unsigned int /* what */ ,
+ Bool /* freeMap */
+ );
+
+extern _X_EXPORT void XkbFreeServerMap(XkbDescPtr /* xkb */ ,
+ unsigned int /* what */ ,
+ Bool /* freeMap */
+ );
+
+extern _X_EXPORT Status XkbAllocIndicatorMaps(XkbDescPtr /* xkb */
+ );
+
+extern _X_EXPORT Status XkbAllocCompatMap(XkbDescPtr /* xkb */ ,
+ unsigned int /* which */ ,
+ unsigned int /* nInterpret */
+ );
+
+extern _X_EXPORT Status XkbAllocNames(XkbDescPtr /* xkb */ ,
+ unsigned int /* which */ ,
+ int /* nTotalRG */ ,
+ int /* nTotalAliases */
+ );
+
+extern _X_EXPORT Status XkbAllocControls(XkbDescPtr /* xkb */ ,
+ unsigned int /* which */
+ );
+
+extern _X_EXPORT Status XkbCopyKeyTypes(XkbKeyTypePtr /* from */ ,
+ XkbKeyTypePtr /* into */ ,
+ int /* num_types */
+ );
+
+extern _X_EXPORT Status XkbResizeKeyType(XkbDescPtr /* xkb */ ,
+ int /* type_ndx */ ,
+ int /* map_count */ ,
+ Bool /* want_preserve */ ,
+ int /* new_num_lvls */
+ );
+
+extern _X_EXPORT void XkbFreeKeyboard(XkbDescPtr /* xkb */ ,
+ unsigned int /* which */ ,
+ Bool /* freeDesc */
+ );
+
+extern _X_EXPORT void XkbFreeComponentNames(XkbComponentNamesPtr /* names */ ,
+ Bool /* freeNames */
+ );
+
+extern _X_EXPORT void XkbSetActionKeyMods(XkbDescPtr /* xkb */ ,
+ XkbAction * /* act */ ,
+ unsigned int /* mods */
+ );
+
+extern _X_EXPORT unsigned int XkbMaskForVMask(XkbDescPtr /* xkb */ ,
+ unsigned int /* vmask */
+ );
+
+extern _X_EXPORT Bool XkbVirtualModsToReal(XkbDescPtr /* xkb */ ,
+ unsigned int /* virtua_mask */ ,
+ unsigned int * /* mask_rtrn */
+ );
+
+extern _X_EXPORT unsigned int XkbAdjustGroup(int /* group */ ,
+ XkbControlsPtr /* ctrls */
+ );
+
+extern _X_EXPORT KeySym *XkbResizeKeySyms(XkbDescPtr /* xkb */ ,
+ int /* key */ ,
+ int /* needed */
+ );
+
+extern _X_EXPORT XkbAction *XkbResizeKeyActions(XkbDescPtr /* xkb */ ,
+ int /* key */ ,
+ int /* needed */
+ );
+
+extern _X_EXPORT void XkbUpdateKeyTypesFromCore(DeviceIntPtr /* pXDev */ ,
+ KeySymsPtr /* syms */ ,
+ KeyCode /* first */ ,
+ CARD8 /* num */ ,
+ XkbChangesPtr /* pChanges */
+ );
+
+extern _X_EXPORT void XkbUpdateDescActions(XkbDescPtr /* xkb */ ,
+ KeyCode /* first */ ,
+ CARD8 /* num */ ,
+ XkbChangesPtr /* changes */
+ );
+
+extern _X_EXPORT void XkbUpdateActions(DeviceIntPtr /* pXDev */ ,
+ KeyCode /* first */ ,
+ CARD8 /* num */ ,
+ XkbChangesPtr /* pChanges */ ,
+ unsigned int * /* needChecksRtrn */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT KeySymsPtr XkbGetCoreMap(DeviceIntPtr /* keybd */
+ );
+
+extern _X_EXPORT void XkbApplyMappingChange(DeviceIntPtr /* pXDev */ ,
+ KeySymsPtr /* map */ ,
+ KeyCode /* firstKey */ ,
+ CARD8 /* num */ ,
+ CARD8 * /* modmap */ ,
+ ClientPtr /* client */
+ );
+
+extern _X_EXPORT void XkbSetIndicators(DeviceIntPtr /* pXDev */ ,
+ CARD32 /* affect */ ,
+ CARD32 /* values */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT void XkbUpdateIndicators(DeviceIntPtr /* keybd */ ,
+ CARD32 /* changed */ ,
+ Bool /* check_edevs */ ,
+ XkbChangesPtr /* pChanges */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT XkbSrvLedInfoPtr XkbAllocSrvLedInfo(DeviceIntPtr /* dev */ ,
+ KbdFeedbackPtr /* kf */ ,
+ LedFeedbackPtr /* lf */ ,
+ unsigned int /* needed_parts */
+ );
+
+extern _X_EXPORT XkbSrvLedInfoPtr XkbCopySrvLedInfo(DeviceIntPtr /* dev */ ,
+ XkbSrvLedInfoPtr /* src */ ,
+ KbdFeedbackPtr /* kf */ ,
+ LedFeedbackPtr /* lf */
+ );
+
+extern _X_EXPORT XkbSrvLedInfoPtr XkbFindSrvLedInfo(DeviceIntPtr /* dev */ ,
+ unsigned int /* class */ ,
+ unsigned int /* id */ ,
+ unsigned int /* needed_parts */
+ );
+
+extern _X_EXPORT void XkbApplyLedNameChanges(DeviceIntPtr /* dev */ ,
+ XkbSrvLedInfoPtr /* sli */ ,
+ unsigned int /* changed_names */ ,
+ xkbExtensionDeviceNotify * /* ed */
+ ,
+ XkbChangesPtr /* changes */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT void XkbApplyLedMapChanges(DeviceIntPtr /* dev */ ,
+ XkbSrvLedInfoPtr /* sli */ ,
+ unsigned int /* changed_maps */ ,
+ xkbExtensionDeviceNotify * /* ed */
+ ,
+ XkbChangesPtr /* changes */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT void XkbApplyLedStateChanges(DeviceIntPtr /* dev */ ,
+ XkbSrvLedInfoPtr /* sli */ ,
+ unsigned int /* changed_leds */ ,
+ xkbExtensionDeviceNotify *
+ /* ed */ ,
+ XkbChangesPtr /* changes */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT void XkbFlushLedEvents(DeviceIntPtr /* dev */ ,
+ DeviceIntPtr /* kbd */ ,
+ XkbSrvLedInfoPtr /* sli */ ,
+ xkbExtensionDeviceNotify * /* ed */ ,
+ XkbChangesPtr /* changes */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT unsigned int XkbIndicatorsToUpdate(DeviceIntPtr /* dev */ ,
+ unsigned long
+ /* state_changes */ ,
+ Bool /* enabled_ctrl_changes */
+ );
+
+extern _X_EXPORT void XkbComputeDerivedState(XkbSrvInfoPtr /* xkbi */
+ );
+
+extern _X_EXPORT void XkbCheckSecondaryEffects(XkbSrvInfoPtr /* xkbi */ ,
+ unsigned int /* which */ ,
+ XkbChangesPtr /* changes */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT void XkbCheckIndicatorMaps(DeviceIntPtr /* dev */ ,
+ XkbSrvLedInfoPtr /* sli */ ,
+ unsigned int /* which */
+ );
+
+extern _X_EXPORT unsigned int XkbStateChangedFlags(XkbStatePtr /* old */ ,
+ XkbStatePtr /* new */
+ );
+
+extern _X_EXPORT void XkbSendStateNotify(DeviceIntPtr /* kbd */ ,
+ xkbStateNotify * /* pSN */
+ );
+
+extern _X_EXPORT void XkbSendMapNotify(DeviceIntPtr /* kbd */ ,
+ xkbMapNotify * /* ev */
+ );
+
+extern _X_EXPORT int XkbComputeControlsNotify(DeviceIntPtr /* kbd */ ,
+ XkbControlsPtr /* old */ ,
+ XkbControlsPtr /* new */ ,
+ xkbControlsNotify * /* pCN */ ,
+ Bool /* forceCtrlProc */
+ );
+
+extern _X_EXPORT void XkbSendControlsNotify(DeviceIntPtr /* kbd */ ,
+ xkbControlsNotify * /* ev */
+ );
+
+extern _X_EXPORT void XkbSendCompatMapNotify(DeviceIntPtr /* kbd */ ,
+ xkbCompatMapNotify * /* ev */
+ );
+
+extern _X_EXPORT void XkbHandleBell(BOOL /* force */ ,
+ BOOL /* eventOnly */ ,
+ DeviceIntPtr /* kbd */ ,
+ CARD8 /* percent */ ,
+ pointer /* ctrl */ ,
+ CARD8 /* class */ ,
+ Atom /* name */ ,
+ WindowPtr /* pWin */ ,
+ ClientPtr /* pClient */
+ );
+
+extern _X_EXPORT void XkbSendAccessXNotify(DeviceIntPtr /* kbd */ ,
+ xkbAccessXNotify * /* pEv */
+ );
+
+extern _X_EXPORT void XkbSendNamesNotify(DeviceIntPtr /* kbd */ ,
+ xkbNamesNotify * /* ev */
+ );
+
+extern _X_EXPORT void XkbSendActionMessage(DeviceIntPtr /* kbd */ ,
+ xkbActionMessage * /* ev */
+ );
+
+extern _X_EXPORT void XkbSendExtensionDeviceNotify(DeviceIntPtr /* kbd */ ,
+ ClientPtr /* client */ ,
+ xkbExtensionDeviceNotify * /* ev */
+ );
+
+extern _X_EXPORT void XkbSendNotification(DeviceIntPtr /* kbd */ ,
+ XkbChangesPtr /* pChanges */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT void XkbProcessKeyboardEvent(DeviceEvent * /* event */ ,
+ DeviceIntPtr /* keybd */
+ );
+
+extern _X_EXPORT void XkbHandleActions(DeviceIntPtr /* dev */ ,
+ DeviceIntPtr /* kbd */ ,
+ DeviceEvent * /* event */
+ );
+
+extern _X_EXPORT Bool XkbEnableDisableControls(XkbSrvInfoPtr /* xkbi */ ,
+ unsigned long /* change */ ,
+ unsigned long /* newValues */ ,
+ XkbChangesPtr /* changes */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT void AccessXInit(DeviceIntPtr /* dev */
+ );
+
+extern _X_EXPORT Bool AccessXFilterPressEvent(DeviceEvent * /* event */ ,
+ DeviceIntPtr /* keybd */
+ );
+
+extern _X_EXPORT Bool AccessXFilterReleaseEvent(DeviceEvent * /* event */ ,
+ DeviceIntPtr /* keybd */
+ );
+
+extern _X_EXPORT void AccessXCancelRepeatKey(XkbSrvInfoPtr /* xkbi */ ,
+ KeyCode /* key */
+ );
+
+extern _X_EXPORT void AccessXComputeCurveFactor(XkbSrvInfoPtr /* xkbi */ ,
+ XkbControlsPtr /* ctrls */
+ );
+
+extern _X_EXPORT XkbInterestPtr XkbFindClientResource(DevicePtr /* inDev */ ,
+ ClientPtr /* client */
+ );
+
+extern _X_EXPORT XkbInterestPtr XkbAddClientResource(DevicePtr /* inDev */ ,
+ ClientPtr /* client */ ,
+ XID /* id */
+ );
+
+extern _X_EXPORT int XkbRemoveResourceClient(DevicePtr /* inDev */ ,
+ XID /* id */
+ );
+
+extern _X_EXPORT int XkbDDXAccessXBeep(DeviceIntPtr /* dev */ ,
+ unsigned int /* what */ ,
+ unsigned int /* which */
+ );
+
+extern _X_EXPORT int XkbDDXUsesSoftRepeat(DeviceIntPtr /* dev */
+ );
+
+extern _X_EXPORT void XkbDDXKeybdCtrlProc(DeviceIntPtr /* dev */ ,
+ KeybdCtrl * /* ctrl */
+ );
+
+extern _X_EXPORT void XkbDDXChangeControls(DeviceIntPtr /* dev */ ,
+ XkbControlsPtr /* old */ ,
+ XkbControlsPtr /* new */
+ );
+
+extern _X_EXPORT void XkbDDXUpdateDeviceIndicators(DeviceIntPtr /* dev */ ,
+ XkbSrvLedInfoPtr /* sli */ ,
+ CARD32 /* newState */
+ );
+
+extern _X_EXPORT int XkbDDXTerminateServer(DeviceIntPtr /* dev */ ,
+ KeyCode /* key */ ,
+ XkbAction * /* act */
+ );
+
+extern _X_EXPORT int XkbDDXSwitchScreen(DeviceIntPtr /* dev */ ,
+ KeyCode /* key */ ,
+ XkbAction * /* act */
+ );
+
+extern _X_EXPORT int XkbDDXPrivate(DeviceIntPtr /* dev */ ,
+ KeyCode /* key */ ,
+ XkbAction * /* act */
+ );
+
+extern _X_EXPORT void XkbDisableComputedAutoRepeats(DeviceIntPtr /* pXDev */ ,
+ unsigned int /* key */
+ );
+
+extern _X_EXPORT void XkbSetRepeatKeys(DeviceIntPtr /* pXDev */ ,
+ int /* key */ ,
+ int /* onoff */
+ );
+
+extern _X_EXPORT int XkbLatchModifiers(DeviceIntPtr /* pXDev */ ,
+ CARD8 /* mask */ ,
+ CARD8 /* latches */
+ );
+
+extern _X_EXPORT int XkbLatchGroup(DeviceIntPtr /* pXDev */ ,
+ int /* group */
+ );
+
+extern _X_EXPORT void XkbClearAllLatchesAndLocks(DeviceIntPtr /* dev */ ,
+ XkbSrvInfoPtr /* xkbi */ ,
+ Bool /* genEv */ ,
+ XkbEventCausePtr /* cause */
+ );
+
+extern _X_EXPORT void XkbGetRulesDflts(XkbRMLVOSet * /* rmlvo */
+ );
+
+extern _X_EXPORT void XkbFreeRMLVOSet(XkbRMLVOSet * /* rmlvo */ ,
+ Bool /* freeRMLVO */
+ );
+
+extern _X_EXPORT void XkbSetRulesDflts(XkbRMLVOSet * /* rmlvo */
+ );
+
+extern _X_EXPORT void XkbDeleteRulesDflts(void
+ );
+
+extern _X_EXPORT int SProcXkbDispatch(ClientPtr /* client */
+ );
+
+extern _X_EXPORT XkbGeometryPtr XkbLookupNamedGeometry(DeviceIntPtr /* dev */ ,
+ Atom /* name */ ,
+ Bool * /* shouldFree */
+ );
+
+extern _X_EXPORT void XkbConvertCase(KeySym /* sym */ ,
+ KeySym * /* lower */ ,
+ KeySym * /* upper */
+ );
+
+extern _X_EXPORT Status XkbChangeKeycodeRange(XkbDescPtr /* xkb */ ,
+ int /* minKC */ ,
+ int /* maxKC */ ,
+ XkbChangesPtr /* changes */
+ );
+
+extern _X_EXPORT void XkbFreeSrvLedInfo(XkbSrvLedInfoPtr /* sli */
+ );
+
+extern _X_EXPORT void XkbFreeInfo(XkbSrvInfoPtr /* xkbi */
+ );
+
+extern _X_EXPORT Status XkbChangeTypesOfKey(XkbDescPtr /* xkb */ ,
+ int /* key */ ,
+ int /* nGroups */ ,
+ unsigned int /* groups */ ,
+ int * /* newTypesIn */ ,
+ XkbMapChangesPtr /* changes */
+ );
+
+extern _X_EXPORT int XkbKeyTypesForCoreSymbols(XkbDescPtr /* xkb */ ,
+ int /* map_width */ ,
+ KeySym * /* core_syms */ ,
+ unsigned int /* protected */ ,
+ int * /* types_inout */ ,
+ KeySym * /* xkb_syms_rtrn */
+ );
+
+extern _X_EXPORT Bool XkbApplyCompatMapToKey(XkbDescPtr /* xkb */ ,
+ KeyCode /* key */ ,
+ XkbChangesPtr /* changes */
+ );
+
+extern _X_EXPORT Bool XkbApplyVirtualModChanges(XkbDescPtr /* xkb */ ,
+ unsigned int /* changed */ ,
+ XkbChangesPtr /* changes */
+ );
+
+extern _X_EXPORT void XkbSendNewKeyboardNotify(DeviceIntPtr /* kbd */ ,
+ xkbNewKeyboardNotify * /* pNKN */
+ );
+
+extern Bool XkbCopyKeymap(XkbDescPtr /* dst */ ,
+ XkbDescPtr /* src */ );
+
+extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */ ,
+ DeviceIntPtr /* src */ );
+
+extern void XkbFilterEvents(ClientPtr /* pClient */ ,
+ int /* nEvents */ ,
+ xEvent * /* xE */ );
+
+extern int XkbGetEffectiveGroup(XkbSrvInfoPtr /* xkbi */ ,
+ XkbStatePtr /* xkbstate */ ,
+ CARD8 /* keycode */ );
+
+extern void XkbMergeLockedPtrBtns(DeviceIntPtr /* master */ );
+
+extern void XkbFakeDeviceButton(DeviceIntPtr /* dev */ ,
+ int /* press */ ,
+ int /* button */ );
#include "xkbfile.h"
#include "xkbrules.h"
@@ -945,43 +834,42 @@ extern void XkbFakeDeviceButton(
#define _XkbListNumComponents 5
typedef struct _XkbSrvListInfo {
- int szPool;
- int nPool;
- char * pool;
-
- int maxRtrn;
- int nTotal;
-
- char * pattern[_XkbListNumComponents];
- int nFound[_XkbListNumComponents];
-} XkbSrvListInfoRec,*XkbSrvListInfoPtr;
-
-extern _X_EXPORT Status XkbDDXList(
- DeviceIntPtr /* dev */,
- XkbSrvListInfoPtr /* listing */,
- ClientPtr /* client */
-);
-
-extern _X_EXPORT unsigned int XkbDDXLoadKeymapByNames(
- DeviceIntPtr /* keybd */,
- XkbComponentNamesPtr /* names */,
- unsigned int /* want */,
- unsigned int /* need */,
- XkbDescPtr * /* finfoRtrn */,
- char * /* keymapNameRtrn */,
- int /* keymapNameRtrnLen */
-);
-
-extern _X_EXPORT Bool XkbDDXNamesFromRules(
- DeviceIntPtr /* keybd */,
- char * /* rules */,
- XkbRF_VarDefsPtr /* defs */,
- XkbComponentNamesPtr /* names */
-);
-
-extern _X_EXPORT XkbDescPtr XkbCompileKeymap(
- DeviceIntPtr /* dev */,
- XkbRMLVOSet * /* rmlvo */
-);
-
-#endif /* _XKBSRV_H_ */
+ int szPool;
+ int nPool;
+ char *pool;
+
+ int maxRtrn;
+ int nTotal;
+
+ char *pattern[_XkbListNumComponents];
+ int nFound[_XkbListNumComponents];
+} XkbSrvListInfoRec, *XkbSrvListInfoPtr;
+
+extern _X_EXPORT Status XkbDDXList(DeviceIntPtr /* dev */ ,
+ XkbSrvListInfoPtr /* listing */ ,
+ ClientPtr /* client */
+ );
+
+extern _X_EXPORT unsigned int XkbDDXLoadKeymapByNames(DeviceIntPtr /* keybd */ ,
+ XkbComponentNamesPtr
+ /* names */ ,
+ unsigned int /* want */ ,
+ unsigned int /* need */ ,
+ XkbDescPtr *
+ /* finfoRtrn */ ,
+ char *
+ /* keymapNameRtrn */ ,
+ int /* keymapNameRtrnLen */
+ );
+
+extern _X_EXPORT Bool XkbDDXNamesFromRules(DeviceIntPtr /* keybd */ ,
+ char * /* rules */ ,
+ XkbRF_VarDefsPtr /* defs */ ,
+ XkbComponentNamesPtr /* names */
+ );
+
+extern _X_EXPORT XkbDescPtr XkbCompileKeymap(DeviceIntPtr /* dev */ ,
+ XkbRMLVOSet * /* rmlvo */
+ );
+
+#endif /* _XKBSRV_H_ */
diff --git a/xorg-server/mi/mi.h b/xorg-server/mi/mi.h
index 24d1af911..638fc6bc7 100644
--- a/xorg-server/mi/mi.h
+++ b/xorg-server/mi/mi.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -62,538 +61,480 @@ SOFTWARE.
#define MiBits CARD32
typedef struct _miDash *miDashPtr;
+
#define EVEN_DASH 0
#define ODD_DASH ~0
/* miarc.c */
-extern _X_EXPORT void miPolyArc(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
+extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*narcs */ ,
+ xArc * /*parcs */
+ );
/* mibitblt.c */
-extern _X_EXPORT RegionPtr miCopyArea(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*xIn*/,
- int /*yIn*/,
- int /*widthSrc*/,
- int /*heightSrc*/,
- int /*xOut*/,
- int /*yOut*/
-);
-
-extern _X_EXPORT RegionPtr miCopyPlane(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- unsigned long /*bitPlane*/
-);
-
-extern _X_EXPORT void miGetImage(
- DrawablePtr /*pDraw*/,
- int /*sx*/,
- int /*sy*/,
- int /*w*/,
- int /*h*/,
- unsigned int /*format*/,
- unsigned long /*planeMask*/,
- char * /*pdstLine*/
-);
-
-extern _X_EXPORT void miPutImage(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*depth*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- int /*leftPad*/,
- int /*format*/,
- char * /*pImage*/
-);
+extern _X_EXPORT RegionPtr miCopyArea(DrawablePtr /*pSrcDrawable */ ,
+ DrawablePtr /*pDstDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*xIn */ ,
+ int /*yIn */ ,
+ int /*widthSrc */ ,
+ int /*heightSrc */ ,
+ int /*xOut */ ,
+ int /*yOut */
+ );
+
+extern _X_EXPORT RegionPtr miCopyPlane(DrawablePtr /*pSrcDrawable */ ,
+ DrawablePtr /*pDstDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*srcx */ ,
+ int /*srcy */ ,
+ int /*width */ ,
+ int /*height */ ,
+ int /*dstx */ ,
+ int /*dsty */ ,
+ unsigned long /*bitPlane */
+ );
+
+extern _X_EXPORT void miGetImage(DrawablePtr /*pDraw */ ,
+ int /*sx */ ,
+ int /*sy */ ,
+ int /*w */ ,
+ int /*h */ ,
+ unsigned int /*format */ ,
+ unsigned long /*planeMask */ ,
+ char * /*pdstLine */
+ );
+
+extern _X_EXPORT void miPutImage(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*depth */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*w */ ,
+ int /*h */ ,
+ int /*leftPad */ ,
+ int /*format */ ,
+ char * /*pImage */
+ );
/* micopy.c */
#define miGetCompositeClip(pGC) ((pGC)->pCompositeClip)
-typedef void (*miCopyProc) (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pDstBox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
+typedef void (*miCopyProc) (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pDstBox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse,
+ Bool upsidedown, Pixel bitplane, void *closure);
extern _X_EXPORT void
-miCopyRegion (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- RegionPtr pDstRegion,
- int dx,
- int dy,
- miCopyProc copyProc,
- Pixel bitPlane,
- void *closure);
+
+miCopyRegion(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ RegionPtr pDstRegion,
+ int dx,
+ int dy, miCopyProc copyProc, Pixel bitPlane, void *closure);
extern _X_EXPORT RegionPtr
-miDoCopy (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut,
- miCopyProc copyProc,
- Pixel bitplane,
- void *closure);
+
+miDoCopy(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn,
+ int yIn,
+ int widthSrc,
+ int heightSrc,
+ int xOut,
+ int yOut, miCopyProc copyProc, Pixel bitplane, void *closure);
/* micursor.c */
-extern _X_EXPORT void miRecolorCursor(
- DeviceIntPtr /* pDev */,
- ScreenPtr /*pScr*/,
- CursorPtr /*pCurs*/,
- Bool /*displayed*/
-);
+extern _X_EXPORT void miRecolorCursor(DeviceIntPtr /* pDev */ ,
+ ScreenPtr /*pScr */ ,
+ CursorPtr /*pCurs */ ,
+ Bool /*displayed */
+ );
/* midash.c */
-extern _X_EXPORT void miStepDash(
- int /*dist*/,
- int * /*pDashIndex*/,
- unsigned char * /*pDash*/,
- int /*numInDashList*/,
- int * /*pDashOffset*/
-);
+extern _X_EXPORT void miStepDash(int /*dist */ ,
+ int * /*pDashIndex */ ,
+ unsigned char * /*pDash */ ,
+ int /*numInDashList */ ,
+ int * /*pDashOffset */
+ );
/* mieq.c */
-
#ifndef INPUT_H
typedef struct _DeviceRec *DevicePtr;
#endif
-extern _X_EXPORT Bool mieqInit(
- void
-);
+extern _X_EXPORT Bool mieqInit(void
+ );
extern _X_EXPORT void mieqFini(void);
-extern _X_EXPORT void mieqEnqueue(
- DeviceIntPtr /*pDev*/,
- InternalEvent* /*e*/
-);
-
-extern _X_EXPORT void mieqSwitchScreen(
- DeviceIntPtr /* pDev */,
- ScreenPtr /*pScreen*/,
- Bool /*set_dequeue_screen*/
-);
-
-extern _X_EXPORT void mieqProcessDeviceEvent(
- DeviceIntPtr /* dev*/,
- InternalEvent* /* event */,
- ScreenPtr /* screen*/
-);
-
-extern _X_EXPORT void mieqProcessInputEvents(
- void
-);
-
-extern DeviceIntPtr CopyGetMasterEvent(
- DeviceIntPtr /* sdev */,
- InternalEvent* /* original */,
- InternalEvent* /* copy */
-);
+extern _X_EXPORT void mieqEnqueue(DeviceIntPtr /*pDev */ ,
+ InternalEvent * /*e */
+ );
+
+extern _X_EXPORT void mieqSwitchScreen(DeviceIntPtr /* pDev */ ,
+ ScreenPtr /*pScreen */ ,
+ Bool /*set_dequeue_screen */
+ );
+
+extern _X_EXPORT void mieqProcessDeviceEvent(DeviceIntPtr /* dev */ ,
+ InternalEvent * /* event */ ,
+ ScreenPtr /* screen */
+ );
+
+extern _X_EXPORT void mieqProcessInputEvents(void
+ );
+
+extern DeviceIntPtr CopyGetMasterEvent(DeviceIntPtr /* sdev */ ,
+ InternalEvent * /* original */ ,
+ InternalEvent * /* copy */
+ );
/**
* Custom input event handler. If you need to process input events in some
* other way than the default path, register an input event handler for the
* given internal event type.
*/
-typedef void (*mieqHandler)(int screen, InternalEvent* event, DeviceIntPtr dev);
+typedef void (*mieqHandler) (int screen, InternalEvent *event,
+ DeviceIntPtr dev);
void _X_EXPORT mieqSetHandler(int event, mieqHandler handler);
/* miexpose.c */
-extern _X_EXPORT RegionPtr miHandleExposures(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- unsigned long /*plane*/
-);
-
-extern _X_EXPORT void miSendGraphicsExpose(
- ClientPtr /*client*/,
- RegionPtr /*pRgn*/,
- XID /*drawable*/,
- int /*major*/,
- int /*minor*/
-);
-
-extern _X_EXPORT void miSendExposures(
- WindowPtr /*pWin*/,
- RegionPtr /*pRgn*/,
- int /*dx*/,
- int /*dy*/
-);
-
-extern _X_EXPORT void miWindowExposures(
- WindowPtr /*pWin*/,
- RegionPtr /*prgn*/,
- RegionPtr /*other_exposed*/
-);
-
-extern _X_EXPORT void miPaintWindow(
- WindowPtr /*pWin*/,
- RegionPtr /*prgn*/,
- int /*what*/
-);
-
-extern _X_EXPORT void miClearDrawable(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/
-);
+extern _X_EXPORT RegionPtr miHandleExposures(DrawablePtr /*pSrcDrawable */ ,
+ DrawablePtr /*pDstDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*srcx */ ,
+ int /*srcy */ ,
+ int /*width */ ,
+ int /*height */ ,
+ int /*dstx */ ,
+ int /*dsty */ ,
+ unsigned long /*plane */
+ );
+
+extern _X_EXPORT void miSendGraphicsExpose(ClientPtr /*client */ ,
+ RegionPtr /*pRgn */ ,
+ XID /*drawable */ ,
+ int /*major */ ,
+ int /*minor */
+ );
+
+extern _X_EXPORT void miSendExposures(WindowPtr /*pWin */ ,
+ RegionPtr /*pRgn */ ,
+ int /*dx */ ,
+ int /*dy */
+ );
+
+extern _X_EXPORT void miWindowExposures(WindowPtr /*pWin */ ,
+ RegionPtr /*prgn */ ,
+ RegionPtr /*other_exposed */
+ );
+
+extern _X_EXPORT void miPaintWindow(WindowPtr /*pWin */ ,
+ RegionPtr /*prgn */ ,
+ int /*what */
+ );
+
+extern _X_EXPORT void miClearDrawable(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */
+ );
/* mifillrct.c */
-extern _X_EXPORT void miPolyFillRect(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nrectFill*/,
- xRectangle * /*prectInit*/
-);
+extern _X_EXPORT void miPolyFillRect(DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*nrectFill */ ,
+ xRectangle * /*prectInit */
+ );
/* miglblt.c */
-extern _X_EXPORT void miPolyGlyphBlt(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
-
-extern _X_EXPORT void miImageGlyphBlt(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
+extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ unsigned int /*nglyph */ ,
+ CharInfoPtr * /*ppci */ ,
+ pointer /*pglyphBase */
+ );
+
+extern _X_EXPORT void miImageGlyphBlt(DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ unsigned int /*nglyph */ ,
+ CharInfoPtr * /*ppci */ ,
+ pointer /*pglyphBase */
+ );
/* mipoly.c */
-extern _X_EXPORT void miFillPolygon(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*shape*/,
- int /*mode*/,
- int /*count*/,
- DDXPointPtr /*pPts*/
-);
+extern _X_EXPORT void miFillPolygon(DrawablePtr /*dst */ ,
+ GCPtr /*pgc */ ,
+ int /*shape */ ,
+ int /*mode */ ,
+ int /*count */ ,
+ DDXPointPtr /*pPts */
+ );
/* mipolycon.c */
-extern _X_EXPORT Bool miFillConvexPoly(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*count*/,
- DDXPointPtr /*ptsIn*/
-);
+extern _X_EXPORT Bool miFillConvexPoly(DrawablePtr /*dst */ ,
+ GCPtr /*pgc */ ,
+ int /*count */ ,
+ DDXPointPtr /*ptsIn */
+ );
/* mipolygen.c */
-extern _X_EXPORT Bool miFillGeneralPoly(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*count*/,
- DDXPointPtr /*ptsIn*/
-);
+extern _X_EXPORT Bool miFillGeneralPoly(DrawablePtr /*dst */ ,
+ GCPtr /*pgc */ ,
+ int /*count */ ,
+ DDXPointPtr /*ptsIn */
+ );
/* mipolypnt.c */
-extern _X_EXPORT void miPolyPoint(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- xPoint * /*pptInit*/
-);
+extern _X_EXPORT void miPolyPoint(DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*mode */ ,
+ int /*npt */ ,
+ xPoint * /*pptInit */
+ );
/* mipolyrect.c */
-extern _X_EXPORT void miPolyRectangle(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*nrects*/,
- xRectangle * /*pRects*/
-);
+extern _X_EXPORT void miPolyRectangle(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*nrects */ ,
+ xRectangle * /*pRects */
+ );
/* mipolyseg.c */
-extern _X_EXPORT void miPolySegment(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSegs*/
-);
+extern _X_EXPORT void miPolySegment(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*nseg */ ,
+ xSegment * /*pSegs */
+ );
/* mipolytext.c */
-extern _X_EXPORT int miPolyText8(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/
-);
-
-extern _X_EXPORT int miPolyText16(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- unsigned short * /*chars*/
-);
-
-extern _X_EXPORT void miImageText8(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/
-);
-
-extern _X_EXPORT void miImageText16(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- unsigned short * /*chars*/
-);
+extern _X_EXPORT int miPolyText8(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*count */ ,
+ char * /*chars */
+ );
+
+extern _X_EXPORT int miPolyText16(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*count */ ,
+ unsigned short * /*chars */
+ );
+
+extern _X_EXPORT void miImageText8(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*count */ ,
+ char * /*chars */
+ );
+
+extern _X_EXPORT void miImageText16(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*count */ ,
+ unsigned short * /*chars */
+ );
/* mipushpxl.c */
-extern _X_EXPORT void miPushPixels(
- GCPtr /*pGC*/,
- PixmapPtr /*pBitMap*/,
- DrawablePtr /*pDrawable*/,
- int /*dx*/,
- int /*dy*/,
- int /*xOrg*/,
- int /*yOrg*/
-);
+extern _X_EXPORT void miPushPixels(GCPtr /*pGC */ ,
+ PixmapPtr /*pBitMap */ ,
+ DrawablePtr /*pDrawable */ ,
+ int /*dx */ ,
+ int /*dy */ ,
+ int /*xOrg */ ,
+ int /*yOrg */
+ );
/* miscrinit.c */
-extern _X_EXPORT Bool miModifyPixmapHeader(
- PixmapPtr /*pPixmap*/,
- int /*width*/,
- int /*height*/,
- int /*depth*/,
- int /*bitsPerPixel*/,
- int /*devKind*/,
- pointer /*pPixData*/
-);
-
-extern _X_EXPORT Bool miCreateScreenResources(
- ScreenPtr /*pScreen*/
-);
-
-extern _X_EXPORT Bool miScreenDevPrivateInit(
- ScreenPtr /*pScreen*/,
- int /*width*/,
- pointer /*pbits*/
-);
-
-extern _X_EXPORT Bool miScreenInit(
- ScreenPtr /*pScreen*/,
- pointer /*pbits*/,
- int /*xsize*/,
- int /*ysize*/,
- int /*dpix*/,
- int /*dpiy*/,
- int /*width*/,
- int /*rootDepth*/,
- int /*numDepths*/,
- DepthPtr /*depths*/,
- VisualID /*rootVisual*/,
- int /*numVisuals*/,
- VisualPtr /*visuals*/
-);
+extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr /*pPixmap */ ,
+ int /*width */ ,
+ int /*height */ ,
+ int /*depth */ ,
+ int /*bitsPerPixel */ ,
+ int /*devKind */ ,
+ pointer /*pPixData */
+ );
+
+extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */
+ );
+
+extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr /*pScreen */ ,
+ int /*width */ ,
+ pointer /*pbits */
+ );
+
+extern _X_EXPORT Bool miScreenInit(ScreenPtr /*pScreen */ ,
+ pointer /*pbits */ ,
+ int /*xsize */ ,
+ int /*ysize */ ,
+ int /*dpix */ ,
+ int /*dpiy */ ,
+ int /*width */ ,
+ int /*rootDepth */ ,
+ int /*numDepths */ ,
+ DepthPtr /*depths */ ,
+ VisualID /*rootVisual */ ,
+ int /*numVisuals */ ,
+ VisualPtr /*visuals */
+ );
/* mivaltree.c */
-extern _X_EXPORT int miShapedWindowIn(
- RegionPtr /*universe*/,
- RegionPtr /*bounding*/,
- BoxPtr /*rect*/,
- int /*x*/,
- int /*y*/
-);
+extern _X_EXPORT int miShapedWindowIn(RegionPtr /*universe */ ,
+ RegionPtr /*bounding */ ,
+ BoxPtr /*rect */ ,
+ int /*x */ ,
+ int /*y */
+ );
-typedef void
-(*SetRedirectBorderClipProcPtr) (WindowPtr pWindow, RegionPtr pRegion);
+typedef void
+ (*SetRedirectBorderClipProcPtr) (WindowPtr pWindow, RegionPtr pRegion);
typedef RegionPtr
-(*GetRedirectBorderClipProcPtr) (WindowPtr pWindow);
+ (*GetRedirectBorderClipProcPtr) (WindowPtr pWindow);
extern _X_EXPORT void
-miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
- GetRedirectBorderClipProcPtr getBorderClip);
-
-extern _X_EXPORT int miValidateTree(
- WindowPtr /*pParent*/,
- WindowPtr /*pChild*/,
- VTKind /*kind*/
-);
-
-extern _X_EXPORT void miWideLine(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pPts*/
-);
-
-extern _X_EXPORT void miWideDash(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pPts*/
-);
+
+miRegisterRedirectBorderClipProc(SetRedirectBorderClipProcPtr setBorderClip,
+ GetRedirectBorderClipProcPtr getBorderClip);
+
+extern _X_EXPORT int miValidateTree(WindowPtr /*pParent */ ,
+ WindowPtr /*pChild */ ,
+ VTKind /*kind */
+ );
+
+extern _X_EXPORT void miWideLine(DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*mode */ ,
+ int /*npt */ ,
+ DDXPointPtr /*pPts */
+ );
+
+extern _X_EXPORT void miWideDash(DrawablePtr /*pDrawable */ ,
+ GCPtr /*pGC */ ,
+ int /*mode */ ,
+ int /*npt */ ,
+ DDXPointPtr /*pPts */
+ );
/* miwindow.c */
-extern _X_EXPORT void miClearToBackground(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- Bool /*generateExposures*/
-);
-
-extern _X_EXPORT void miMarkWindow(
- WindowPtr /*pWin*/
-);
-
-extern _X_EXPORT Bool miMarkOverlappedWindows(
- WindowPtr /*pWin*/,
- WindowPtr /*pFirst*/,
- WindowPtr * /*ppLayerWin*/
-);
-
-extern _X_EXPORT void miHandleValidateExposures(
- WindowPtr /*pWin*/
-);
-
-extern _X_EXPORT void miMoveWindow(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/,
- WindowPtr /*pNextSib*/,
- VTKind /*kind*/
-);
-
-extern _X_EXPORT void miSlideAndSizeWindow(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*w*/,
- unsigned int /*h*/,
- WindowPtr /*pSib*/
-);
-
-extern _X_EXPORT WindowPtr miGetLayerWindow(
- WindowPtr /*pWin*/
-);
-
-extern _X_EXPORT void miSetShape(
- WindowPtr /*pWin*/,
- int /*kind*/
-);
-
-extern _X_EXPORT void miChangeBorderWidth(
- WindowPtr /*pWin*/,
- unsigned int /*width*/
-);
-
-extern _X_EXPORT void miMarkUnrealizedWindow(
- WindowPtr /*pChild*/,
- WindowPtr /*pWin*/,
- Bool /*fromConfigure*/
-);
-
-extern _X_EXPORT void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth);
+extern _X_EXPORT void miClearToBackground(WindowPtr /*pWin */ ,
+ int /*x */ ,
+ int /*y */ ,
+ int /*w */ ,
+ int /*h */ ,
+ Bool /*generateExposures */
+ );
+
+extern _X_EXPORT void miMarkWindow(WindowPtr /*pWin */
+ );
+
+extern _X_EXPORT Bool miMarkOverlappedWindows(WindowPtr /*pWin */ ,
+ WindowPtr /*pFirst */ ,
+ WindowPtr * /*ppLayerWin */
+ );
+
+extern _X_EXPORT void miHandleValidateExposures(WindowPtr /*pWin */
+ );
+
+extern _X_EXPORT void miMoveWindow(WindowPtr /*pWin */ ,
+ int /*x */ ,
+ int /*y */ ,
+ WindowPtr /*pNextSib */ ,
+ VTKind /*kind */
+ );
+
+extern _X_EXPORT void miSlideAndSizeWindow(WindowPtr /*pWin */ ,
+ int /*x */ ,
+ int /*y */ ,
+ unsigned int /*w */ ,
+ unsigned int /*h */ ,
+ WindowPtr /*pSib */
+ );
+
+extern _X_EXPORT WindowPtr miGetLayerWindow(WindowPtr /*pWin */
+ );
+
+extern _X_EXPORT void miSetShape(WindowPtr /*pWin */ ,
+ int /*kind */
+ );
+
+extern _X_EXPORT void miChangeBorderWidth(WindowPtr /*pWin */ ,
+ unsigned int /*width */
+ );
+
+extern _X_EXPORT void miMarkUnrealizedWindow(WindowPtr /*pChild */ ,
+ WindowPtr /*pWin */ ,
+ Bool /*fromConfigure */
+ );
+
+extern _X_EXPORT void miSegregateChildren(WindowPtr pWin, RegionPtr pReg,
+ int depth);
/* mizerarc.c */
-extern _X_EXPORT void miZeroPolyArc(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
+extern _X_EXPORT void miZeroPolyArc(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*narcs */ ,
+ xArc * /*parcs */
+ );
/* mizerline.c */
-extern _X_EXPORT void miZeroLine(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*mode*/,
- int /*nptInit*/,
- DDXPointRec * /*pptInit*/
-);
-
-extern _X_EXPORT void miZeroDashLine(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*mode*/,
- int /*nptInit*/,
- DDXPointRec * /*pptInit*/
-);
-
-extern _X_EXPORT void miPolyFillArc(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-
-#endif /* MI_H */
+extern _X_EXPORT void miZeroLine(DrawablePtr /*dst */ ,
+ GCPtr /*pgc */ ,
+ int /*mode */ ,
+ int /*nptInit */ ,
+ DDXPointRec * /*pptInit */
+ );
+
+extern _X_EXPORT void miZeroDashLine(DrawablePtr /*dst */ ,
+ GCPtr /*pgc */ ,
+ int /*mode */ ,
+ int /*nptInit */ ,
+ DDXPointRec * /*pptInit */
+ );
+
+extern _X_EXPORT void miPolyFillArc(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ int /*narcs */ ,
+ xArc * /*parcs */
+ );
+
+#endif /* MI_H */
diff --git a/xorg-server/mi/miarc.c b/xorg-server/mi/miarc.c
index 9fc8f478c..a73bce9e6 100644
--- a/xorg-server/mi/miarc.c
+++ b/xorg-server/mi/miarc.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -78,9 +77,9 @@ static double
cbrt(double x)
{
if (x > 0.0)
- return pow(x, 1.0/3.0);
+ return pow(x, 1.0 / 3.0);
else
- return -pow(-x, 1.0/3.0);
+ return -pow(-x, 1.0 / 3.0);
}
#endif
@@ -107,30 +106,32 @@ cbrt(double x)
#undef max
#undef min
-_X_INLINE static int max (const int x, const int y)
+_X_INLINE static int
+max(const int x, const int y)
{
- return x>y? x:y;
+ return x > y ? x : y;
}
-_X_INLINE static int min (const int x, const int y)
+_X_INLINE static int
+min(const int x, const int y)
{
- return x<y? x:y;
+ return x < y ? x : y;
}
struct bound {
- double min, max;
+ double min, max;
};
struct ibound {
- int min, max;
+ int min, max;
};
#define boundedLe(value, bounds)\
((bounds).min <= (value) && (value) <= (bounds).max)
struct line {
- double m, b;
- int valid;
+ double m, b;
+ int valid;
};
#define intersectLine(y,line) (line.m * (y) + line.b)
@@ -140,67 +141,67 @@ struct line {
*/
struct arc_bound {
- struct bound ellipse;
- struct bound inner;
- struct bound outer;
- struct bound right;
- struct bound left;
- struct ibound inneri;
- struct ibound outeri;
+ struct bound ellipse;
+ struct bound inner;
+ struct bound outer;
+ struct bound right;
+ struct bound left;
+ struct ibound inneri;
+ struct ibound outeri;
};
struct accelerators {
- double tail_y;
- double h2;
- double w2;
- double h4;
- double w4;
- double h2mw2;
- double h2l;
- double w2l;
- double fromIntX;
- double fromIntY;
- struct line left, right;
- int yorgu;
- int yorgl;
- int xorg;
+ double tail_y;
+ double h2;
+ double w2;
+ double h4;
+ double w4;
+ double h2mw2;
+ double h2l;
+ double w2l;
+ double fromIntX;
+ double fromIntY;
+ struct line left, right;
+ int yorgu;
+ int yorgl;
+ int xorg;
};
struct arc_def {
- double w, h, l;
- double a0, a1;
+ double w, h, l;
+ double a0, a1;
};
-# define todeg(xAngle) (((double) (xAngle)) / 64.0)
+#define todeg(xAngle) (((double) (xAngle)) / 64.0)
-# define RIGHT_END 0
-# define LEFT_END 1
+#define RIGHT_END 0
+#define LEFT_END 1
typedef struct _miArcJoin {
- int arcIndex0, arcIndex1;
- int phase0, phase1;
- int end0, end1;
+ int arcIndex0, arcIndex1;
+ int phase0, phase1;
+ int end0, end1;
} miArcJoinRec, *miArcJoinPtr;
typedef struct _miArcCap {
- int arcIndex;
- int end;
+ int arcIndex;
+ int end;
} miArcCapRec, *miArcCapPtr;
typedef struct _miArcFace {
- SppPointRec clock;
- SppPointRec center;
- SppPointRec counterClock;
+ SppPointRec clock;
+ SppPointRec center;
+ SppPointRec counterClock;
} miArcFaceRec, *miArcFacePtr;
typedef struct _miArcData {
- xArc arc;
- int render; /* non-zero means render after drawing */
- int join; /* related join */
- int cap; /* related cap */
- int selfJoin; /* final dash meets first dash */
- miArcFaceRec bounds[2];
- double x0, y0, x1, y1;
+ xArc arc;
+ int render; /* non-zero means render after drawing */
+ int join; /* related join */
+ int cap; /* related cap */
+ int selfJoin; /* final dash meets first dash */
+ miArcFaceRec bounds[2];
+ double x0, y0, x1, y1;
} miArcDataRec, *miArcDataPtr;
/*
@@ -209,101 +210,98 @@ typedef struct _miArcData {
*/
typedef struct _miPolyArc {
- int narcs;
- miArcDataPtr arcs;
- int ncaps;
- miArcCapPtr caps;
- int njoins;
- miArcJoinPtr joins;
+ int narcs;
+ miArcDataPtr arcs;
+ int ncaps;
+ miArcCapPtr caps;
+ int njoins;
+ miArcJoinPtr joins;
} miPolyArcRec, *miPolyArcPtr;
static void fillSpans(DrawablePtr pDrawable, GCPtr pGC);
static void newFinalSpan(int y, int xmin, int xmax);
-static void drawArc(xArc *tarc, int l, int a0, int a1, miArcFacePtr right,
- miArcFacePtr left);
-static void drawZeroArc(DrawablePtr pDraw, GCPtr pGC, xArc *tarc, int lw,
- miArcFacePtr left, miArcFacePtr right);
+static void drawArc(xArc * tarc, int l, int a0, int a1, miArcFacePtr right,
+ miArcFacePtr left);
+static void drawZeroArc(DrawablePtr pDraw, GCPtr pGC, xArc * tarc, int lw,
+ miArcFacePtr left, miArcFacePtr right);
static void miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
- miArcFacePtr pRight, int xOrgLeft, int yOrgLeft,
- double xFtransLeft, double yFtransLeft,
- int xOrgRight, int yOrgRight,
- double xFtransRight, double yFtransRight);
+ miArcFacePtr pRight, int xOrgLeft, int yOrgLeft,
+ double xFtransLeft, double yFtransLeft,
+ int xOrgRight, int yOrgRight,
+ double xFtransRight, double yFtransRight);
static void miArcCap(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pFace,
- int end, int xOrg, int yOrg, double xFtrans,
- double yFtrans);
+ int end, int xOrg, int yOrg, double xFtrans,
+ double yFtrans);
static void miRoundCap(DrawablePtr pDraw, GCPtr pGC, SppPointRec pCenter,
- SppPointRec pEnd, SppPointRec pCorner,
- SppPointRec pOtherCorner, int fLineEnd,
- int xOrg, int yOrg, double xFtrans, double yFtrans);
+ SppPointRec pEnd, SppPointRec pCorner,
+ SppPointRec pOtherCorner, int fLineEnd,
+ int xOrg, int yOrg, double xFtrans, double yFtrans);
static void miFreeArcs(miPolyArcPtr arcs, GCPtr pGC);
-static miPolyArcPtr miComputeArcs(xArc *parcs, int narcs, GCPtr pGC);
-static int miGetArcPts(SppArcPtr parc, int cpt, SppPointPtr *ppPts);
+static miPolyArcPtr miComputeArcs(xArc * parcs, int narcs, GCPtr pGC);
+static int miGetArcPts(SppArcPtr parc, int cpt, SppPointPtr * ppPts);
-# define CUBED_ROOT_2 1.2599210498948732038115849718451499938964
-# define CUBED_ROOT_4 1.5874010519681993173435330390930175781250
+#define CUBED_ROOT_2 1.2599210498948732038115849718451499938964
+#define CUBED_ROOT_4 1.5874010519681993173435330390930175781250
/*
* draw one segment of the arc using the arc spans generation routines
*/
static void
-miArcSegment(
- DrawablePtr pDraw,
- GCPtr pGC,
- xArc tarc,
- miArcFacePtr right,
- miArcFacePtr left)
+miArcSegment(DrawablePtr pDraw,
+ GCPtr pGC, xArc tarc, miArcFacePtr right, miArcFacePtr left)
{
int l = pGC->lineWidth;
int a0, a1, startAngle, endAngle;
miArcFacePtr temp;
if (!l)
- l = 1;
+ l = 1;
if (tarc.width == 0 || tarc.height == 0) {
- drawZeroArc (pDraw, pGC, &tarc, l, left, right);
- return;
+ drawZeroArc(pDraw, pGC, &tarc, l, left, right);
+ return;
}
if (pGC->miTranslate) {
- tarc.x += pDraw->x;
- tarc.y += pDraw->y;
+ tarc.x += pDraw->x;
+ tarc.y += pDraw->y;
}
a0 = tarc.angle1;
a1 = tarc.angle2;
if (a1 > FULLCIRCLE)
- a1 = FULLCIRCLE;
+ a1 = FULLCIRCLE;
else if (a1 < -FULLCIRCLE)
- a1 = -FULLCIRCLE;
+ a1 = -FULLCIRCLE;
if (a1 < 0) {
- startAngle = a0 + a1;
- endAngle = a0;
- temp = right;
- right = left;
- left = temp;
- } else {
- startAngle = a0;
- endAngle = a0 + a1;
+ startAngle = a0 + a1;
+ endAngle = a0;
+ temp = right;
+ right = left;
+ left = temp;
+ }
+ else {
+ startAngle = a0;
+ endAngle = a0 + a1;
}
/*
* bounds check the two angles
*/
if (startAngle < 0)
- startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE;
+ startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE;
if (startAngle >= FULLCIRCLE)
- startAngle = startAngle % FULLCIRCLE;
+ startAngle = startAngle % FULLCIRCLE;
if (endAngle < 0)
- endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE;
+ endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE;
if (endAngle > FULLCIRCLE)
- endAngle = (endAngle-1) % FULLCIRCLE + 1;
+ endAngle = (endAngle - 1) % FULLCIRCLE + 1;
if ((startAngle == endAngle) && a1) {
- startAngle = 0;
- endAngle = FULLCIRCLE;
+ startAngle = 0;
+ endAngle = FULLCIRCLE;
}
- drawArc (&tarc, l, startAngle, endAngle, right, left);
+ drawArc(&tarc, l, startAngle, endAngle, right, left);
}
/*
@@ -380,14 +378,11 @@ typedef struct {
} miArcSpanData;
static void drawQuadrant(struct arc_def *def, struct accelerators *acc,
- int a0, int a1, int mask, miArcFacePtr right,
- miArcFacePtr left, miArcSpanData *spdata);
+ int a0, int a1, int mask, miArcFacePtr right,
+ miArcFacePtr left, miArcSpanData * spdata);
static void
-miComputeCircleSpans(
- int lw,
- xArc *parc,
- miArcSpanData *spdata)
+miComputeCircleSpans(int lw, xArc * parc, miArcSpanData * spdata)
{
miArcSpan *span;
int doinner;
@@ -404,58 +399,48 @@ miComputeCircleSpans(
dx = 1 - dy;
MIWIDEARCSETUP(x, y, dy, slw, e, xk, xm, yk, ym);
inslw = parc->width + doinner;
- if (inslw > 0)
- {
- spdata->hole = spdata->top;
- MIWIDEARCSETUP(inx, iny, dy, inslw, ine, inxk, inxm, inyk, inym);
+ if (inslw > 0) {
+ spdata->hole = spdata->top;
+ MIWIDEARCSETUP(inx, iny, dy, inslw, ine, inxk, inxm, inyk, inym);
}
- else
- {
- spdata->hole = FALSE;
- doinner = -y;
+ else {
+ spdata->hole = FALSE;
+ doinner = -y;
}
spdata->count1 = -doinner - spdata->top;
spdata->count2 = y + doinner;
span = spdata->spans;
- while (y)
- {
- MIFILLARCSTEP(slw);
- span->lx = dy - x;
- if (++doinner <= 0)
- {
- span->lw = slw;
- span->rx = 0;
- span->rw = span->lx + slw;
- }
- else
- {
- MIFILLINARCSTEP(inslw);
- span->lw = x - inx;
- span->rx = dy - inx + inslw;
- span->rw = inx - x + slw - inslw;
- }
- span++;
- }
- if (spdata->bot)
- {
- if (spdata->count2)
- spdata->count2--;
- else
- {
- if (lw > (int)parc->height)
- span[-1].rx = span[-1].rw = -((lw - (int)parc->height) >> 1);
- else
- span[-1].rw = 0;
- spdata->count1--;
- }
+ while (y) {
+ MIFILLARCSTEP(slw);
+ span->lx = dy - x;
+ if (++doinner <= 0) {
+ span->lw = slw;
+ span->rx = 0;
+ span->rw = span->lx + slw;
+ }
+ else {
+ MIFILLINARCSTEP(inslw);
+ span->lw = x - inx;
+ span->rx = dy - inx + inslw;
+ span->rw = inx - x + slw - inslw;
+ }
+ span++;
+ }
+ if (spdata->bot) {
+ if (spdata->count2)
+ spdata->count2--;
+ else {
+ if (lw > (int) parc->height)
+ span[-1].rx = span[-1].rw = -((lw - (int) parc->height) >> 1);
+ else
+ span[-1].rw = 0;
+ spdata->count1--;
+ }
}
}
static void
-miComputeEllipseSpans(
- int lw,
- xArc *parc,
- miArcSpanData *spdata)
+miComputeEllipseSpans(int lw, xArc * parc, miArcSpanData * spdata)
{
miArcSpan *span;
double w, h, r, xorg;
@@ -463,8 +448,8 @@ miComputeEllipseSpans(
double A, T, b, d, x, y, t, inx, outx = 0.0, hepp, hepm;
int flip, solution;
- w = (double)parc->width / 2.0;
- h = (double)parc->height / 2.0;
+ w = (double) parc->width / 2.0;
+ h = (double) parc->height / 2.0;
r = lw / 2.0;
rs = r * r;
Hs = h * h;
@@ -479,177 +464,159 @@ miComputeEllipseSpans(
K = h + ((lw - 1) >> 1);
span = spdata->spans;
if (parc->width & 1)
- xorg = .5;
+ xorg = .5;
else
- xorg = 0.0;
- if (spdata->top)
- {
- span->lx = 0;
- span->lw = 1;
- span++;
+ xorg = 0.0;
+ if (spdata->top) {
+ span->lx = 0;
+ span->lw = 1;
+ span++;
}
spdata->count1 = 0;
spdata->count2 = 0;
spdata->hole = (spdata->top &&
- (int)parc->height * lw <= (int)(parc->width * parc->width) &&
- lw < (int)parc->height);
- for (; K > 0.0; K -= 1.0)
- {
- N = (K * K + Nk) / 6.0;
- Nc = N * N * N;
- Vr = Vk * K;
- t = Nc + Vr * Vr;
- d = Nc + t;
- if (d < 0.0) {
- d = Nc;
- b = N;
- if ( (b < 0.0) == (t < 0.0) )
- {
- b = -b;
- d = -d;
- }
- Z = N - 2.0 * b * cos(acos(-t / d) / 3.0);
- if ( (Z < 0.0) == (Vr < 0.0) )
- flip = 2;
- else
- flip = 1;
- }
- else
- {
- d = Vr * sqrt(d);
- Z = N + cbrt(t + d) + cbrt(t - d);
- flip = 0;
- }
- A = sqrt((Z + Z) - Nk);
- T = (Fk - Z) * K / A;
- inx = 0.0;
- solution = FALSE;
- b = -A + K;
- d = b * b - 4 * (Z + T);
- if (d >= 0)
- {
- d = sqrt(d);
- y = (b + d) / 2;
- if ((y >= 0.0) && (y < hepp))
- {
- solution = TRUE;
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- t = sqrt(rs - (t * t));
- else
- t = 0;
- if (flip == 2)
- inx = x - t;
- else
- outx = x + t;
- }
- }
- b = A + K;
- d = b * b - 4 * (Z - T);
- /* Because of the large magnitudes involved, we lose enough precision
- * that sometimes we end up with a negative value near the axis, when
- * it should be positive. This is a workaround.
- */
- if (d < 0 && !solution)
- d = 0.0;
- if (d >= 0) {
- d = sqrt(d);
- y = (b + d) / 2;
- if (y < hepp)
- {
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- inx = x - sqrt(rs - (t * t));
- else
- inx = x;
- }
- y = (b - d) / 2;
- if (y >= 0.0)
- {
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- t = sqrt(rs - (t * t));
- else
- t = 0;
- if (flip == 1)
- inx = x - t;
- else
- outx = x + t;
- }
- }
- span->lx = ICEIL(xorg - outx);
- if (inx <= 0.0)
- {
- spdata->count1++;
- span->lw = ICEIL(xorg + outx) - span->lx;
- span->rx = ICEIL(xorg + inx);
- span->rw = -ICEIL(xorg - inx);
- }
- else
- {
- spdata->count2++;
- span->lw = ICEIL(xorg - inx) - span->lx;
- span->rx = ICEIL(xorg + inx);
- span->rw = ICEIL(xorg + outx) - span->rx;
- }
- span++;
- }
- if (spdata->bot)
- {
- outx = w + r;
- if (r >= h && r <= w)
- inx = 0.0;
- else if (Nk < 0.0 && -Nk < Hs)
- {
- inx = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk);
- if (inx > w - r)
- inx = w - r;
- }
- else
- inx = w - r;
- span->lx = ICEIL(xorg - outx);
- if (inx <= 0.0)
- {
- span->lw = ICEIL(xorg + outx) - span->lx;
- span->rx = ICEIL(xorg + inx);
- span->rw = -ICEIL(xorg - inx);
- }
- else
- {
- span->lw = ICEIL(xorg - inx) - span->lx;
- span->rx = ICEIL(xorg + inx);
- span->rw = ICEIL(xorg + outx) - span->rx;
- }
- }
- if (spdata->hole)
- {
- span = &spdata->spans[spdata->count1];
- span->lw = -span->lx;
- span->rx = 1;
- span->rw = span->lw;
- spdata->count1--;
- spdata->count2++;
+ (int) parc->height * lw <= (int) (parc->width * parc->width)
+ && lw < (int) parc->height);
+ for (; K > 0.0; K -= 1.0) {
+ N = (K * K + Nk) / 6.0;
+ Nc = N * N * N;
+ Vr = Vk * K;
+ t = Nc + Vr * Vr;
+ d = Nc + t;
+ if (d < 0.0) {
+ d = Nc;
+ b = N;
+ if ((b < 0.0) == (t < 0.0)) {
+ b = -b;
+ d = -d;
+ }
+ Z = N - 2.0 * b * cos(acos(-t / d) / 3.0);
+ if ((Z < 0.0) == (Vr < 0.0))
+ flip = 2;
+ else
+ flip = 1;
+ }
+ else {
+ d = Vr * sqrt(d);
+ Z = N + cbrt(t + d) + cbrt(t - d);
+ flip = 0;
+ }
+ A = sqrt((Z + Z) - Nk);
+ T = (Fk - Z) * K / A;
+ inx = 0.0;
+ solution = FALSE;
+ b = -A + K;
+ d = b * b - 4 * (Z + T);
+ if (d >= 0) {
+ d = sqrt(d);
+ y = (b + d) / 2;
+ if ((y >= 0.0) && (y < hepp)) {
+ solution = TRUE;
+ if (y > hepm)
+ y = h;
+ t = y / h;
+ x = w * sqrt(1 - (t * t));
+ t = K - y;
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
+ if (flip == 2)
+ inx = x - t;
+ else
+ outx = x + t;
+ }
+ }
+ b = A + K;
+ d = b * b - 4 * (Z - T);
+ /* Because of the large magnitudes involved, we lose enough precision
+ * that sometimes we end up with a negative value near the axis, when
+ * it should be positive. This is a workaround.
+ */
+ if (d < 0 && !solution)
+ d = 0.0;
+ if (d >= 0) {
+ d = sqrt(d);
+ y = (b + d) / 2;
+ if (y < hepp) {
+ if (y > hepm)
+ y = h;
+ t = y / h;
+ x = w * sqrt(1 - (t * t));
+ t = K - y;
+ if (rs - (t * t) >= 0)
+ inx = x - sqrt(rs - (t * t));
+ else
+ inx = x;
+ }
+ y = (b - d) / 2;
+ if (y >= 0.0) {
+ if (y > hepm)
+ y = h;
+ t = y / h;
+ x = w * sqrt(1 - (t * t));
+ t = K - y;
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
+ if (flip == 1)
+ inx = x - t;
+ else
+ outx = x + t;
+ }
+ }
+ span->lx = ICEIL(xorg - outx);
+ if (inx <= 0.0) {
+ spdata->count1++;
+ span->lw = ICEIL(xorg + outx) - span->lx;
+ span->rx = ICEIL(xorg + inx);
+ span->rw = -ICEIL(xorg - inx);
+ }
+ else {
+ spdata->count2++;
+ span->lw = ICEIL(xorg - inx) - span->lx;
+ span->rx = ICEIL(xorg + inx);
+ span->rw = ICEIL(xorg + outx) - span->rx;
+ }
+ span++;
+ }
+ if (spdata->bot) {
+ outx = w + r;
+ if (r >= h && r <= w)
+ inx = 0.0;
+ else if (Nk < 0.0 && -Nk < Hs) {
+ inx = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk);
+ if (inx > w - r)
+ inx = w - r;
+ }
+ else
+ inx = w - r;
+ span->lx = ICEIL(xorg - outx);
+ if (inx <= 0.0) {
+ span->lw = ICEIL(xorg + outx) - span->lx;
+ span->rx = ICEIL(xorg + inx);
+ span->rw = -ICEIL(xorg - inx);
+ }
+ else {
+ span->lw = ICEIL(xorg - inx) - span->lx;
+ span->rx = ICEIL(xorg + inx);
+ span->rw = ICEIL(xorg + outx) - span->rx;
+ }
+ }
+ if (spdata->hole) {
+ span = &spdata->spans[spdata->count1];
+ span->lw = -span->lx;
+ span->rx = 1;
+ span->rw = span->lw;
+ spdata->count1--;
+ spdata->count2++;
}
}
static double
-tailX(
- double K,
- struct arc_def *def,
- struct arc_bound *bounds,
- struct accelerators *acc)
+tailX(double K,
+ struct arc_def *def, struct arc_bound *bounds, struct accelerators *acc)
{
double w, h, r;
double Hs, Hf, WH, Vk, Nk, Fk, Vr, N, Nc, Z, rs;
@@ -669,18 +636,18 @@ tailX(
Hf = acc->h4;
Nk = (Hf - Nk * Nk) / WH;
if (K == 0.0) {
- if (Nk < 0.0 && -Nk < Hs) {
- xs[0] = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk);
- xs[1] = w - r;
- if (acc->left.valid && boundedLe(K, bounds->left) &&
- !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0)
- return xs[1];
- if (acc->right.valid && boundedLe(K, bounds->right) &&
- !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0)
- return xs[1];
- return xs[0];
- }
- return w - r;
+ if (Nk < 0.0 && -Nk < Hs) {
+ xs[0] = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk);
+ xs[1] = w - r;
+ if (acc->left.valid && boundedLe(K, bounds->left) &&
+ !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0)
+ return xs[1];
+ if (acc->right.valid && boundedLe(K, bounds->right) &&
+ !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0)
+ return xs[1];
+ return xs[0];
+ }
+ return w - r;
}
Fk = Hf / WH;
hepp = h + EPSILON;
@@ -693,48 +660,44 @@ tailX(
t = Nc + Vr * Vr;
d = Nc + t;
if (d < 0.0) {
- d = Nc;
- b = N;
- if ( (b < 0.0) == (t < 0.0) )
- {
- b = -b;
- d = -d;
- }
- Z = N - 2.0 * b * cos(acos(-t / d) / 3.0);
- if ( (Z < 0.0) == (Vr < 0.0) )
- flip = 2;
- else
- flip = 1;
+ d = Nc;
+ b = N;
+ if ((b < 0.0) == (t < 0.0)) {
+ b = -b;
+ d = -d;
+ }
+ Z = N - 2.0 * b * cos(acos(-t / d) / 3.0);
+ if ((Z < 0.0) == (Vr < 0.0))
+ flip = 2;
+ else
+ flip = 1;
}
- else
- {
- d = Vr * sqrt(d);
- Z = N + cbrt(t + d) + cbrt(t - d);
- flip = 0;
+ else {
+ d = Vr * sqrt(d);
+ Z = N + cbrt(t + d) + cbrt(t - d);
+ flip = 0;
}
A = sqrt((Z + Z) - Nk);
T = (Fk - Z) * K / A;
solution = FALSE;
b = -A + K;
d = b * b - 4 * (Z + T);
- if (d >= 0 && flip == 2)
- {
- d = sqrt(d);
- y = (b + d) / 2;
- if ((y >= 0.0) && (y < hepp))
- {
- solution = TRUE;
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- t = sqrt(rs - (t * t));
- else
- t = 0;
- *xp++ = x - t;
- }
+ if (d >= 0 && flip == 2) {
+ d = sqrt(d);
+ y = (b + d) / 2;
+ if ((y >= 0.0) && (y < hepp)) {
+ solution = TRUE;
+ if (y > hepm)
+ y = h;
+ t = y / h;
+ x = w * sqrt(1 - (t * t));
+ t = K - y;
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
+ *xp++ = x - t;
+ }
}
b = A + K;
d = b * b - 4 * (Z - T);
@@ -743,76 +706,71 @@ tailX(
* it should be positive. This is a workaround.
*/
if (d < 0 && !solution)
- d = 0.0;
+ d = 0.0;
if (d >= 0) {
- d = sqrt(d);
- y = (b + d) / 2;
- if (y < hepp)
- {
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- *xp++ = x - sqrt(rs - (t * t));
- else
- *xp++ = x;
- }
- y = (b - d) / 2;
- if (y >= 0.0 && flip == 1)
- {
- if (y > hepm)
- y = h;
- t = y / h;
- x = w * sqrt(1 - (t * t));
- t = K - y;
- if (rs - (t * t) >= 0)
- t = sqrt(rs - (t * t));
- else
- t = 0;
- *xp++ = x - t;
- }
+ d = sqrt(d);
+ y = (b + d) / 2;
+ if (y < hepp) {
+ if (y > hepm)
+ y = h;
+ t = y / h;
+ x = w * sqrt(1 - (t * t));
+ t = K - y;
+ if (rs - (t * t) >= 0)
+ *xp++ = x - sqrt(rs - (t * t));
+ else
+ *xp++ = x;
+ }
+ y = (b - d) / 2;
+ if (y >= 0.0 && flip == 1) {
+ if (y > hepm)
+ y = h;
+ t = y / h;
+ x = w * sqrt(1 - (t * t));
+ t = K - y;
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
+ *xp++ = x - t;
+ }
}
if (xp > &xs[1]) {
- if (acc->left.valid && boundedLe(K, bounds->left) &&
- !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0)
- return xs[1];
- if (acc->right.valid && boundedLe(K, bounds->right) &&
- !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0)
- return xs[1];
+ if (acc->left.valid && boundedLe(K, bounds->left) &&
+ !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0)
+ return xs[1];
+ if (acc->right.valid && boundedLe(K, bounds->right) &&
+ !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0)
+ return xs[1];
}
return xs[0];
}
static miArcSpanData *
-miComputeWideEllipse(int lw, xArc *parc)
+miComputeWideEllipse(int lw, xArc * parc)
{
miArcSpanData *spdata = NULL;
int k;
if (!lw)
- lw = 1;
+ lw = 1;
k = (parc->height >> 1) + ((lw - 1) >> 1);
spdata = malloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2));
if (!spdata)
- return NULL;
- spdata->spans = (miArcSpan *)(spdata + 1);
+ return NULL;
+ spdata->spans = (miArcSpan *) (spdata + 1);
spdata->k = k;
spdata->top = !(lw & 1) && !(parc->width & 1);
spdata->bot = !(parc->height & 1);
if (parc->width == parc->height)
- miComputeCircleSpans(lw, parc, spdata);
+ miComputeCircleSpans(lw, parc, spdata);
else
- miComputeEllipseSpans(lw, parc, spdata);
+ miComputeEllipseSpans(lw, parc, spdata);
return spdata;
}
static void
-miFillWideEllipse(
- DrawablePtr pDraw,
- GCPtr pGC,
- xArc *parc)
+miFillWideEllipse(DrawablePtr pDraw, GCPtr pGC, xArc * parc)
{
DDXPointPtr points;
DDXPointPtr pts;
@@ -827,13 +785,12 @@ miFillWideEllipse(
n = (sizeof(int) * 2) * yorgu;
widths = malloc(n + (sizeof(DDXPointRec) * 2) * yorgu);
if (!widths)
- return;
- points = (DDXPointPtr)((char *)widths + n);
- spdata = miComputeWideEllipse((int)pGC->lineWidth, parc);
- if (!spdata)
- {
- free(widths);
- return;
+ return;
+ points = (DDXPointPtr) ((char *) widths + n);
+ spdata = miComputeWideEllipse((int) pGC->lineWidth, parc);
+ if (!spdata) {
+ free(widths);
+ return;
}
pts = points;
wids = widths;
@@ -841,88 +798,80 @@ miFillWideEllipse(
xorg = parc->x + (parc->width >> 1);
yorgu = parc->y + (parc->height >> 1);
yorgl = yorgu + (parc->height & 1);
- if (pGC->miTranslate)
- {
- xorg += pDraw->x;
- yorgu += pDraw->y;
- yorgl += pDraw->y;
+ if (pGC->miTranslate) {
+ xorg += pDraw->x;
+ yorgu += pDraw->y;
+ yorgl += pDraw->y;
}
yorgu -= spdata->k;
yorgl += spdata->k;
- if (spdata->top)
- {
- pts->x = xorg;
- pts->y = yorgu - 1;
- pts++;
- *wids++ = 1;
- span++;
- }
- for (n = spdata->count1; --n >= 0; )
- {
- pts[0].x = xorg + span->lx;
- pts[0].y = yorgu;
- wids[0] = span->lw;
- pts[1].x = pts[0].x;
- pts[1].y = yorgl;
- wids[1] = wids[0];
- yorgu++;
- yorgl--;
- pts += 2;
- wids += 2;
- span++;
- }
- if (spdata->hole)
- {
- pts[0].x = xorg;
- pts[0].y = yorgl;
- wids[0] = 1;
- pts++;
- wids++;
- }
- for (n = spdata->count2; --n >= 0; )
- {
- pts[0].x = xorg + span->lx;
- pts[0].y = yorgu;
- wids[0] = span->lw;
- pts[1].x = xorg + span->rx;
- pts[1].y = pts[0].y;
- wids[1] = span->rw;
- pts[2].x = pts[0].x;
- pts[2].y = yorgl;
- wids[2] = wids[0];
- pts[3].x = pts[1].x;
- pts[3].y = pts[2].y;
- wids[3] = wids[1];
- yorgu++;
- yorgl--;
- pts += 4;
- wids += 4;
- span++;
- }
- if (spdata->bot)
- {
- if (span->rw <= 0)
- {
- pts[0].x = xorg + span->lx;
- pts[0].y = yorgu;
- wids[0] = span->lw;
- pts++;
- wids++;
- }
- else
- {
- pts[0].x = xorg + span->lx;
- pts[0].y = yorgu;
- wids[0] = span->lw;
- pts[1].x = xorg + span->rx;
- pts[1].y = pts[0].y;
- wids[1] = span->rw;
- pts += 2;
- wids += 2;
- }
+ if (spdata->top) {
+ pts->x = xorg;
+ pts->y = yorgu - 1;
+ pts++;
+ *wids++ = 1;
+ span++;
+ }
+ for (n = spdata->count1; --n >= 0;) {
+ pts[0].x = xorg + span->lx;
+ pts[0].y = yorgu;
+ wids[0] = span->lw;
+ pts[1].x = pts[0].x;
+ pts[1].y = yorgl;
+ wids[1] = wids[0];
+ yorgu++;
+ yorgl--;
+ pts += 2;
+ wids += 2;
+ span++;
+ }
+ if (spdata->hole) {
+ pts[0].x = xorg;
+ pts[0].y = yorgl;
+ wids[0] = 1;
+ pts++;
+ wids++;
+ }
+ for (n = spdata->count2; --n >= 0;) {
+ pts[0].x = xorg + span->lx;
+ pts[0].y = yorgu;
+ wids[0] = span->lw;
+ pts[1].x = xorg + span->rx;
+ pts[1].y = pts[0].y;
+ wids[1] = span->rw;
+ pts[2].x = pts[0].x;
+ pts[2].y = yorgl;
+ wids[2] = wids[0];
+ pts[3].x = pts[1].x;
+ pts[3].y = pts[2].y;
+ wids[3] = wids[1];
+ yorgu++;
+ yorgl--;
+ pts += 4;
+ wids += 4;
+ span++;
+ }
+ if (spdata->bot) {
+ if (span->rw <= 0) {
+ pts[0].x = xorg + span->lx;
+ pts[0].y = yorgu;
+ wids[0] = span->lw;
+ pts++;
+ wids++;
+ }
+ else {
+ pts[0].x = xorg + span->lx;
+ pts[0].y = yorgu;
+ wids[0] = span->lw;
+ pts[1].x = xorg + span->rx;
+ pts[1].y = pts[0].y;
+ wids[1] = span->rw;
+ pts += 2;
+ wids += 2;
+ }
}
free(spdata);
- (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
+ (*pGC->ops->FillSpans) (pDraw, pGC, pts - points, points, widths, FALSE);
free(widths);
}
@@ -941,430 +890,406 @@ miFillWideEllipse(
*/
void
-miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
+miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
{
- int i;
- xArc *parc;
- int xMin, xMax, yMin, yMax;
- int pixmapWidth = 0, pixmapHeight = 0;
- int xOrg = 0, yOrg = 0;
- int width;
- Bool fTricky;
- DrawablePtr pDrawTo;
- CARD32 fg, bg;
- GCPtr pGCTo;
+ int i;
+ xArc *parc;
+ int xMin, xMax, yMin, yMax;
+ int pixmapWidth = 0, pixmapHeight = 0;
+ int xOrg = 0, yOrg = 0;
+ int width;
+ Bool fTricky;
+ DrawablePtr pDrawTo;
+ CARD32 fg, bg;
+ GCPtr pGCTo;
miPolyArcPtr polyArcs;
- int cap[2], join[2];
- int iphase;
- int halfWidth;
+ int cap[2], join[2];
+ int iphase;
+ int halfWidth;
width = pGC->lineWidth;
- if(width == 0 && pGC->lineStyle == LineSolid)
- {
- for(i = narcs, parc = parcs; --i >= 0; parc++)
- miArcSegment( pDraw, pGC, *parc,
- (miArcFacePtr) 0, (miArcFacePtr) 0 );
- fillSpans (pDraw, pGC);
- }
- else
- {
- if ((pGC->lineStyle == LineSolid) && narcs)
- {
- while (parcs->width && parcs->height &&
- (parcs->angle2 >= FULLCIRCLE ||
- parcs->angle2 <= -FULLCIRCLE))
- {
- miFillWideEllipse(pDraw, pGC, parcs);
- if (!--narcs)
- return;
- parcs++;
- }
- }
-
- /* Set up pDrawTo and pGCTo based on the rasterop */
- switch(pGC->alu)
- {
- case GXclear: /* 0 */
- case GXcopy: /* src */
- case GXcopyInverted: /* NOT src */
- case GXset: /* 1 */
- fTricky = FALSE;
- pDrawTo = pDraw;
- pGCTo = pGC;
- break;
- default:
- fTricky = TRUE;
-
- /* find bounding box around arcs */
- xMin = yMin = MAXSHORT;
- xMax = yMax = MINSHORT;
-
- for(i = narcs, parc = parcs; --i >= 0; parc++)
- {
- xMin = min (xMin, parc->x);
- yMin = min (yMin, parc->y);
- xMax = max (xMax, (parc->x + (int) parc->width));
- yMax = max (yMax, (parc->y + (int) parc->height));
- }
-
- /* expand box to deal with line widths */
- halfWidth = (width + 1)/2;
- xMin -= halfWidth;
- yMin -= halfWidth;
- xMax += halfWidth;
- yMax += halfWidth;
-
- /* compute pixmap size; limit it to size of drawable */
- xOrg = max(xMin, 0);
- yOrg = max(yMin, 0);
- pixmapWidth = min(xMax, pDraw->width) - xOrg;
- pixmapHeight = min(yMax, pDraw->height) - yOrg;
-
- /* if nothing left, return */
- if ( (pixmapWidth <= 0) || (pixmapHeight <= 0) ) return;
-
- for(i = narcs, parc = parcs; --i >= 0; parc++)
- {
- parc->x -= xOrg;
- parc->y -= yOrg;
- }
- if (pGC->miTranslate)
- {
- xOrg += pDraw->x;
- yOrg += pDraw->y;
- }
-
- /* set up scratch GC */
-
- pGCTo = GetScratchGC(1, pDraw->pScreen);
- if (!pGCTo)
- return;
- {
- ChangeGCVal gcvals[6];
- gcvals[0].val = GXcopy;
- gcvals[1].val = 1;
- gcvals[2].val = 0;
- gcvals[3].val = pGC->lineWidth;
- gcvals[4].val = pGC->capStyle;
- gcvals[5].val = pGC->joinStyle;
- ChangeGC(NullClient, pGCTo, GCFunction |
- GCForeground | GCBackground | GCLineWidth |
- GCCapStyle | GCJoinStyle, gcvals);
- }
-
- /* allocate a 1 bit deep pixmap of the appropriate size, and
- * validate it */
- pDrawTo = (DrawablePtr)(*pDraw->pScreen->CreatePixmap)
- (pDraw->pScreen, pixmapWidth, pixmapHeight, 1,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pDrawTo)
- {
- FreeScratchGC(pGCTo);
- return;
- }
- ValidateGC(pDrawTo, pGCTo);
- miClearDrawable(pDrawTo, pGCTo);
- }
-
- fg = pGC->fgPixel;
- bg = pGC->bgPixel;
- if ((pGC->fillStyle == FillTiled) ||
- (pGC->fillStyle == FillOpaqueStippled))
- bg = fg; /* the protocol sez these don't cause color changes */
-
- polyArcs = miComputeArcs (parcs, narcs, pGC);
-
- if (!polyArcs)
- {
- if (fTricky) {
- (*pDraw->pScreen->DestroyPixmap) ((PixmapPtr)pDrawTo);
- FreeScratchGC (pGCTo);
- }
- return;
- }
-
- cap[0] = cap[1] = 0;
- join[0] = join[1] = 0;
- for (iphase = ((pGC->lineStyle == LineDoubleDash) ? 1 : 0);
- iphase >= 0;
- iphase--)
- {
- ChangeGCVal gcval;
- if (iphase == 1) {
- gcval.val = bg;
- ChangeGC (NullClient, pGC, GCForeground, &gcval);
- ValidateGC (pDraw, pGC);
- } else if (pGC->lineStyle == LineDoubleDash) {
- gcval.val = fg;
- ChangeGC (NullClient, pGC, GCForeground, &gcval);
- ValidateGC (pDraw, pGC);
- }
- for (i = 0; i < polyArcs[iphase].narcs; i++) {
- miArcDataPtr arcData;
-
- arcData = &polyArcs[iphase].arcs[i];
- miArcSegment(pDrawTo, pGCTo, arcData->arc,
- &arcData->bounds[RIGHT_END],
- &arcData->bounds[LEFT_END]);
- if (polyArcs[iphase].arcs[i].render) {
- fillSpans (pDrawTo, pGCTo);
- /*
- * don't cap self-joining arcs
- */
- if (polyArcs[iphase].arcs[i].selfJoin &&
- cap[iphase] < polyArcs[iphase].arcs[i].cap)
- cap[iphase]++;
- while (cap[iphase] < polyArcs[iphase].arcs[i].cap) {
- int arcIndex, end;
- miArcDataPtr arcData0;
-
- arcIndex = polyArcs[iphase].caps[cap[iphase]].arcIndex;
- end = polyArcs[iphase].caps[cap[iphase]].end;
- arcData0 = &polyArcs[iphase].arcs[arcIndex];
- miArcCap (pDrawTo, pGCTo,
- &arcData0->bounds[end], end,
- arcData0->arc.x, arcData0->arc.y,
- (double) arcData0->arc.width / 2.0,
- (double) arcData0->arc.height / 2.0);
- ++cap[iphase];
- }
- while (join[iphase] < polyArcs[iphase].arcs[i].join) {
- int arcIndex0, arcIndex1, end0, end1;
- int phase0, phase1;
- miArcDataPtr arcData0, arcData1;
- miArcJoinPtr joinp;
-
- joinp = &polyArcs[iphase].joins[join[iphase]];
- arcIndex0 = joinp->arcIndex0;
- end0 = joinp->end0;
- arcIndex1 = joinp->arcIndex1;
- end1 = joinp->end1;
- phase0 = joinp->phase0;
- phase1 = joinp->phase1;
- arcData0 = &polyArcs[phase0].arcs[arcIndex0];
- arcData1 = &polyArcs[phase1].arcs[arcIndex1];
- miArcJoin (pDrawTo, pGCTo,
- &arcData0->bounds[end0],
- &arcData1->bounds[end1],
- arcData0->arc.x, arcData0->arc.y,
- (double) arcData0->arc.width / 2.0,
- (double) arcData0->arc.height / 2.0,
- arcData1->arc.x, arcData1->arc.y,
- (double) arcData1->arc.width / 2.0,
- (double) arcData1->arc.height / 2.0);
- ++join[iphase];
- }
- if (fTricky) {
- if (pGC->serialNumber != pDraw->serialNumber)
- ValidateGC (pDraw, pGC);
- (*pGC->ops->PushPixels) (pGC, (PixmapPtr)pDrawTo,
- pDraw, pixmapWidth, pixmapHeight, xOrg, yOrg);
- miClearDrawable ((DrawablePtr) pDrawTo, pGCTo);
- }
- }
- }
- }
- miFreeArcs(polyArcs, pGC);
-
- if(fTricky)
- {
- (*pGCTo->pScreen->DestroyPixmap)((PixmapPtr)pDrawTo);
- FreeScratchGC(pGCTo);
- }
+ if (width == 0 && pGC->lineStyle == LineSolid) {
+ for (i = narcs, parc = parcs; --i >= 0; parc++)
+ miArcSegment(pDraw, pGC, *parc, (miArcFacePtr) 0, (miArcFacePtr) 0);
+ fillSpans(pDraw, pGC);
+ }
+ else {
+ if ((pGC->lineStyle == LineSolid) && narcs) {
+ while (parcs->width && parcs->height &&
+ (parcs->angle2 >= FULLCIRCLE ||
+ parcs->angle2 <= -FULLCIRCLE)) {
+ miFillWideEllipse(pDraw, pGC, parcs);
+ if (!--narcs)
+ return;
+ parcs++;
+ }
+ }
+
+ /* Set up pDrawTo and pGCTo based on the rasterop */
+ switch (pGC->alu) {
+ case GXclear: /* 0 */
+ case GXcopy: /* src */
+ case GXcopyInverted: /* NOT src */
+ case GXset: /* 1 */
+ fTricky = FALSE;
+ pDrawTo = pDraw;
+ pGCTo = pGC;
+ break;
+ default:
+ fTricky = TRUE;
+
+ /* find bounding box around arcs */
+ xMin = yMin = MAXSHORT;
+ xMax = yMax = MINSHORT;
+
+ for (i = narcs, parc = parcs; --i >= 0; parc++) {
+ xMin = min(xMin, parc->x);
+ yMin = min(yMin, parc->y);
+ xMax = max(xMax, (parc->x + (int) parc->width));
+ yMax = max(yMax, (parc->y + (int) parc->height));
+ }
+
+ /* expand box to deal with line widths */
+ halfWidth = (width + 1) / 2;
+ xMin -= halfWidth;
+ yMin -= halfWidth;
+ xMax += halfWidth;
+ yMax += halfWidth;
+
+ /* compute pixmap size; limit it to size of drawable */
+ xOrg = max(xMin, 0);
+ yOrg = max(yMin, 0);
+ pixmapWidth = min(xMax, pDraw->width) - xOrg;
+ pixmapHeight = min(yMax, pDraw->height) - yOrg;
+
+ /* if nothing left, return */
+ if ((pixmapWidth <= 0) || (pixmapHeight <= 0))
+ return;
+
+ for (i = narcs, parc = parcs; --i >= 0; parc++) {
+ parc->x -= xOrg;
+ parc->y -= yOrg;
+ }
+ if (pGC->miTranslate) {
+ xOrg += pDraw->x;
+ yOrg += pDraw->y;
+ }
+
+ /* set up scratch GC */
+
+ pGCTo = GetScratchGC(1, pDraw->pScreen);
+ if (!pGCTo)
+ return;
+ {
+ ChangeGCVal gcvals[6];
+
+ gcvals[0].val = GXcopy;
+ gcvals[1].val = 1;
+ gcvals[2].val = 0;
+ gcvals[3].val = pGC->lineWidth;
+ gcvals[4].val = pGC->capStyle;
+ gcvals[5].val = pGC->joinStyle;
+ ChangeGC(NullClient, pGCTo, GCFunction |
+ GCForeground | GCBackground | GCLineWidth |
+ GCCapStyle | GCJoinStyle, gcvals);
+ }
+
+ /* allocate a 1 bit deep pixmap of the appropriate size, and
+ * validate it */
+ pDrawTo = (DrawablePtr) (*pDraw->pScreen->CreatePixmap)
+ (pDraw->pScreen, pixmapWidth, pixmapHeight, 1,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pDrawTo) {
+ FreeScratchGC(pGCTo);
+ return;
+ }
+ ValidateGC(pDrawTo, pGCTo);
+ miClearDrawable(pDrawTo, pGCTo);
+ }
+
+ fg = pGC->fgPixel;
+ bg = pGC->bgPixel;
+ if ((pGC->fillStyle == FillTiled) ||
+ (pGC->fillStyle == FillOpaqueStippled))
+ bg = fg; /* the protocol sez these don't cause color changes */
+
+ polyArcs = miComputeArcs(parcs, narcs, pGC);
+
+ if (!polyArcs) {
+ if (fTricky) {
+ (*pDraw->pScreen->DestroyPixmap) ((PixmapPtr) pDrawTo);
+ FreeScratchGC(pGCTo);
+ }
+ return;
+ }
+
+ cap[0] = cap[1] = 0;
+ join[0] = join[1] = 0;
+ for (iphase = ((pGC->lineStyle == LineDoubleDash) ? 1 : 0);
+ iphase >= 0; iphase--) {
+ ChangeGCVal gcval;
+
+ if (iphase == 1) {
+ gcval.val = bg;
+ ChangeGC(NullClient, pGC, GCForeground, &gcval);
+ ValidateGC(pDraw, pGC);
+ }
+ else if (pGC->lineStyle == LineDoubleDash) {
+ gcval.val = fg;
+ ChangeGC(NullClient, pGC, GCForeground, &gcval);
+ ValidateGC(pDraw, pGC);
+ }
+ for (i = 0; i < polyArcs[iphase].narcs; i++) {
+ miArcDataPtr arcData;
+
+ arcData = &polyArcs[iphase].arcs[i];
+ miArcSegment(pDrawTo, pGCTo, arcData->arc,
+ &arcData->bounds[RIGHT_END],
+ &arcData->bounds[LEFT_END]);
+ if (polyArcs[iphase].arcs[i].render) {
+ fillSpans(pDrawTo, pGCTo);
+ /*
+ * don't cap self-joining arcs
+ */
+ if (polyArcs[iphase].arcs[i].selfJoin &&
+ cap[iphase] < polyArcs[iphase].arcs[i].cap)
+ cap[iphase]++;
+ while (cap[iphase] < polyArcs[iphase].arcs[i].cap) {
+ int arcIndex, end;
+ miArcDataPtr arcData0;
+
+ arcIndex = polyArcs[iphase].caps[cap[iphase]].arcIndex;
+ end = polyArcs[iphase].caps[cap[iphase]].end;
+ arcData0 = &polyArcs[iphase].arcs[arcIndex];
+ miArcCap(pDrawTo, pGCTo,
+ &arcData0->bounds[end], end,
+ arcData0->arc.x, arcData0->arc.y,
+ (double) arcData0->arc.width / 2.0,
+ (double) arcData0->arc.height / 2.0);
+ ++cap[iphase];
+ }
+ while (join[iphase] < polyArcs[iphase].arcs[i].join) {
+ int arcIndex0, arcIndex1, end0, end1;
+ int phase0, phase1;
+ miArcDataPtr arcData0, arcData1;
+ miArcJoinPtr joinp;
+
+ joinp = &polyArcs[iphase].joins[join[iphase]];
+ arcIndex0 = joinp->arcIndex0;
+ end0 = joinp->end0;
+ arcIndex1 = joinp->arcIndex1;
+ end1 = joinp->end1;
+ phase0 = joinp->phase0;
+ phase1 = joinp->phase1;
+ arcData0 = &polyArcs[phase0].arcs[arcIndex0];
+ arcData1 = &polyArcs[phase1].arcs[arcIndex1];
+ miArcJoin(pDrawTo, pGCTo,
+ &arcData0->bounds[end0],
+ &arcData1->bounds[end1],
+ arcData0->arc.x, arcData0->arc.y,
+ (double) arcData0->arc.width / 2.0,
+ (double) arcData0->arc.height / 2.0,
+ arcData1->arc.x, arcData1->arc.y,
+ (double) arcData1->arc.width / 2.0,
+ (double) arcData1->arc.height / 2.0);
+ ++join[iphase];
+ }
+ if (fTricky) {
+ if (pGC->serialNumber != pDraw->serialNumber)
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->PushPixels) (pGC, (PixmapPtr) pDrawTo,
+ pDraw, pixmapWidth,
+ pixmapHeight, xOrg, yOrg);
+ miClearDrawable((DrawablePtr) pDrawTo, pGCTo);
+ }
+ }
+ }
+ }
+ miFreeArcs(polyArcs, pGC);
+
+ if (fTricky) {
+ (*pGCTo->pScreen->DestroyPixmap) ((PixmapPtr) pDrawTo);
+ FreeScratchGC(pGCTo);
+ }
}
}
static double
-angleBetween (SppPointRec center, SppPointRec point1, SppPointRec point2)
+angleBetween(SppPointRec center, SppPointRec point1, SppPointRec point2)
{
- double a1, a2, a;
-
- /*
- * reflect from X coordinates back to ellipse
- * coordinates -- y increasing upwards
- */
- a1 = miDatan2 (- (point1.y - center.y), point1.x - center.x);
- a2 = miDatan2 (- (point2.y - center.y), point2.x - center.x);
- a = a2 - a1;
- if (a <= -180.0)
- a += 360.0;
- else if (a > 180.0)
- a -= 360.0;
- return a;
+ double a1, a2, a;
+
+ /*
+ * reflect from X coordinates back to ellipse
+ * coordinates -- y increasing upwards
+ */
+ a1 = miDatan2(-(point1.y - center.y), point1.x - center.x);
+ a2 = miDatan2(-(point2.y - center.y), point2.x - center.x);
+ a = a2 - a1;
+ if (a <= -180.0)
+ a += 360.0;
+ else if (a > 180.0)
+ a -= 360.0;
+ return a;
}
static void
-translateBounds (
- miArcFacePtr b,
- int x,
- int y,
- double fx,
- double fy)
+translateBounds(miArcFacePtr b, int x, int y, double fx, double fy)
{
- fx += x;
- fy += y;
- b->clock.x -= fx;
- b->clock.y -= fy;
- b->center.x -= fx;
- b->center.y -= fy;
- b->counterClock.x -= fx;
- b->counterClock.y -= fy;
+ fx += x;
+ fy += y;
+ b->clock.x -= fx;
+ b->clock.y -= fy;
+ b->center.x -= fx;
+ b->center.y -= fy;
+ b->counterClock.x -= fx;
+ b->counterClock.y -= fy;
}
static void
miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
- miArcFacePtr pRight, int xOrgLeft, int yOrgLeft,
- double xFtransLeft, double yFtransLeft,
- int xOrgRight, int yOrgRight,
- double xFtransRight, double yFtransRight)
+ miArcFacePtr pRight, int xOrgLeft, int yOrgLeft,
+ double xFtransLeft, double yFtransLeft,
+ int xOrgRight, int yOrgRight,
+ double xFtransRight, double yFtransRight)
{
- SppPointRec center, corner, otherCorner;
- SppPointRec poly[5], e;
- SppPointPtr pArcPts;
- int cpt;
- SppArcRec arc;
- miArcFaceRec Right, Left;
- int polyLen = 0;
- int xOrg, yOrg;
- double xFtrans, yFtrans;
- double a;
- double ae, ac2, ec2, bc2, de;
- double width;
-
- xOrg = (xOrgRight + xOrgLeft) / 2;
- yOrg = (yOrgRight + yOrgLeft) / 2;
- xFtrans = (xFtransLeft + xFtransRight) / 2;
- yFtrans = (yFtransLeft + yFtransRight) / 2;
- Right = *pRight;
- translateBounds (&Right, xOrg - xOrgRight, yOrg - yOrgRight,
- xFtrans - xFtransRight, yFtrans - yFtransRight);
- Left = *pLeft;
- translateBounds (&Left, xOrg - xOrgLeft, yOrg - yOrgLeft,
- xFtrans - xFtransLeft, yFtrans - yFtransLeft);
- pRight = &Right;
- pLeft = &Left;
-
- if (pRight->clock.x == pLeft->counterClock.x &&
- pRight->clock.y == pLeft->counterClock.y)
- return;
- center = pRight->center;
- if (0 <= (a = angleBetween (center, pRight->clock, pLeft->counterClock))
- && a <= 180.0)
- {
- corner = pRight->clock;
- otherCorner = pLeft->counterClock;
- } else {
- a = angleBetween (center, pLeft->clock, pRight->counterClock);
- corner = pLeft->clock;
- otherCorner = pRight->counterClock;
- }
- switch (pGC->joinStyle) {
- case JoinRound:
- width = (pGC->lineWidth ? (double)pGC->lineWidth : (double)1);
-
- arc.x = center.x - width/2;
- arc.y = center.y - width/2;
- arc.width = width;
- arc.height = width;
- arc.angle1 = -miDatan2 (corner.y - center.y, corner.x - center.x);
- arc.angle2 = a;
- pArcPts = malloc(3 * sizeof (SppPointRec));
- if (!pArcPts)
- return;
- pArcPts[0].x = otherCorner.x;
- pArcPts[0].y = otherCorner.y;
- pArcPts[1].x = center.x;
- pArcPts[1].y = center.y;
- pArcPts[2].x = corner.x;
- pArcPts[2].y = corner.y;
- if( (cpt = miGetArcPts(&arc, 3, &pArcPts)) )
- {
- /* by drawing with miFillSppPoly and setting the endpoints of the arc
- * to be the corners, we assure that the cap will meet up with the
- * rest of the line */
- miFillSppPoly(pDraw, pGC, cpt, pArcPts, xOrg, yOrg, xFtrans, yFtrans);
- }
- free(pArcPts);
- return;
- case JoinMiter:
- /*
- * don't miter arcs with less than 11 degrees between them
- */
- if (a < 169.0) {
- poly[0] = corner;
- poly[1] = center;
- poly[2] = otherCorner;
- bc2 = (corner.x - otherCorner.x) * (corner.x - otherCorner.x) +
- (corner.y - otherCorner.y) * (corner.y - otherCorner.y);
- ec2 = bc2 / 4;
- ac2 = (corner.x - center.x) * (corner.x - center.x) +
- (corner.y - center.y) * (corner.y - center.y);
- ae = sqrt (ac2 - ec2);
- de = ec2 / ae;
- e.x = (corner.x + otherCorner.x) / 2;
- e.y = (corner.y + otherCorner.y) / 2;
- poly[3].x = e.x + de * (e.x - center.x) / ae;
- poly[3].y = e.y + de * (e.y - center.y) / ae;
- poly[4] = corner;
- polyLen = 5;
- break;
- }
- case JoinBevel:
- poly[0] = corner;
- poly[1] = center;
- poly[2] = otherCorner;
- poly[3] = corner;
- polyLen = 4;
- break;
- }
- miFillSppPoly (pDraw, pGC, polyLen, poly, xOrg, yOrg, xFtrans, yFtrans);
+ SppPointRec center, corner, otherCorner;
+ SppPointRec poly[5], e;
+ SppPointPtr pArcPts;
+ int cpt;
+ SppArcRec arc;
+ miArcFaceRec Right, Left;
+ int polyLen = 0;
+ int xOrg, yOrg;
+ double xFtrans, yFtrans;
+ double a;
+ double ae, ac2, ec2, bc2, de;
+ double width;
+
+ xOrg = (xOrgRight + xOrgLeft) / 2;
+ yOrg = (yOrgRight + yOrgLeft) / 2;
+ xFtrans = (xFtransLeft + xFtransRight) / 2;
+ yFtrans = (yFtransLeft + yFtransRight) / 2;
+ Right = *pRight;
+ translateBounds(&Right, xOrg - xOrgRight, yOrg - yOrgRight,
+ xFtrans - xFtransRight, yFtrans - yFtransRight);
+ Left = *pLeft;
+ translateBounds(&Left, xOrg - xOrgLeft, yOrg - yOrgLeft,
+ xFtrans - xFtransLeft, yFtrans - yFtransLeft);
+ pRight = &Right;
+ pLeft = &Left;
+
+ if (pRight->clock.x == pLeft->counterClock.x &&
+ pRight->clock.y == pLeft->counterClock.y)
+ return;
+ center = pRight->center;
+ if (0 <= (a = angleBetween(center, pRight->clock, pLeft->counterClock))
+ && a <= 180.0) {
+ corner = pRight->clock;
+ otherCorner = pLeft->counterClock;
+ }
+ else {
+ a = angleBetween(center, pLeft->clock, pRight->counterClock);
+ corner = pLeft->clock;
+ otherCorner = pRight->counterClock;
+ }
+ switch (pGC->joinStyle) {
+ case JoinRound:
+ width = (pGC->lineWidth ? (double) pGC->lineWidth : (double) 1);
+
+ arc.x = center.x - width / 2;
+ arc.y = center.y - width / 2;
+ arc.width = width;
+ arc.height = width;
+ arc.angle1 = -miDatan2(corner.y - center.y, corner.x - center.x);
+ arc.angle2 = a;
+ pArcPts = malloc(3 * sizeof(SppPointRec));
+ if (!pArcPts)
+ return;
+ pArcPts[0].x = otherCorner.x;
+ pArcPts[0].y = otherCorner.y;
+ pArcPts[1].x = center.x;
+ pArcPts[1].y = center.y;
+ pArcPts[2].x = corner.x;
+ pArcPts[2].y = corner.y;
+ if ((cpt = miGetArcPts(&arc, 3, &pArcPts))) {
+ /* by drawing with miFillSppPoly and setting the endpoints of the arc
+ * to be the corners, we assure that the cap will meet up with the
+ * rest of the line */
+ miFillSppPoly(pDraw, pGC, cpt, pArcPts, xOrg, yOrg, xFtrans,
+ yFtrans);
+ }
+ free(pArcPts);
+ return;
+ case JoinMiter:
+ /*
+ * don't miter arcs with less than 11 degrees between them
+ */
+ if (a < 169.0) {
+ poly[0] = corner;
+ poly[1] = center;
+ poly[2] = otherCorner;
+ bc2 = (corner.x - otherCorner.x) * (corner.x - otherCorner.x) +
+ (corner.y - otherCorner.y) * (corner.y - otherCorner.y);
+ ec2 = bc2 / 4;
+ ac2 = (corner.x - center.x) * (corner.x - center.x) +
+ (corner.y - center.y) * (corner.y - center.y);
+ ae = sqrt(ac2 - ec2);
+ de = ec2 / ae;
+ e.x = (corner.x + otherCorner.x) / 2;
+ e.y = (corner.y + otherCorner.y) / 2;
+ poly[3].x = e.x + de * (e.x - center.x) / ae;
+ poly[3].y = e.y + de * (e.y - center.y) / ae;
+ poly[4] = corner;
+ polyLen = 5;
+ break;
+ }
+ case JoinBevel:
+ poly[0] = corner;
+ poly[1] = center;
+ poly[2] = otherCorner;
+ poly[3] = corner;
+ polyLen = 4;
+ break;
+ }
+ miFillSppPoly(pDraw, pGC, polyLen, poly, xOrg, yOrg, xFtrans, yFtrans);
}
-/*ARGSUSED*/
-static void
-miArcCap (
- DrawablePtr pDraw,
- GCPtr pGC,
- miArcFacePtr pFace,
- int end,
- int xOrg,
- int yOrg,
- double xFtrans,
- double yFtrans)
+ /*ARGSUSED*/ static void
+miArcCap(DrawablePtr pDraw,
+ GCPtr pGC,
+ miArcFacePtr pFace,
+ int end, int xOrg, int yOrg, double xFtrans, double yFtrans)
{
- SppPointRec corner, otherCorner, center, endPoint, poly[5];
-
- corner = pFace->clock;
- otherCorner = pFace->counterClock;
- center = pFace->center;
- switch (pGC->capStyle) {
- case CapProjecting:
- poly[0].x = otherCorner.x;
- poly[0].y = otherCorner.y;
- poly[1].x = corner.x;
- poly[1].y = corner.y;
- poly[2].x = corner.x -
- (center.y - corner.y);
- poly[2].y = corner.y +
- (center.x - corner.x);
- poly[3].x = otherCorner.x -
- (otherCorner.y - center.y);
- poly[3].y = otherCorner.y +
- (otherCorner.x - center.x);
- poly[4].x = otherCorner.x;
- poly[4].y = otherCorner.y;
- miFillSppPoly (pDraw, pGC, 5, poly, xOrg, yOrg, xFtrans, yFtrans);
- break;
- case CapRound:
- /*
- * miRoundCap just needs these to be unequal.
- */
- endPoint = center;
- endPoint.x = endPoint.x + 100;
- miRoundCap (pDraw, pGC, center, endPoint, corner, otherCorner, 0,
- -xOrg, -yOrg, xFtrans, yFtrans);
- break;
- }
+ SppPointRec corner, otherCorner, center, endPoint, poly[5];
+
+ corner = pFace->clock;
+ otherCorner = pFace->counterClock;
+ center = pFace->center;
+ switch (pGC->capStyle) {
+ case CapProjecting:
+ poly[0].x = otherCorner.x;
+ poly[0].y = otherCorner.y;
+ poly[1].x = corner.x;
+ poly[1].y = corner.y;
+ poly[2].x = corner.x - (center.y - corner.y);
+ poly[2].y = corner.y + (center.x - corner.x);
+ poly[3].x = otherCorner.x - (otherCorner.y - center.y);
+ poly[3].y = otherCorner.y + (otherCorner.x - center.x);
+ poly[4].x = otherCorner.x;
+ poly[4].y = otherCorner.y;
+ miFillSppPoly(pDraw, pGC, 5, poly, xOrg, yOrg, xFtrans, yFtrans);
+ break;
+ case CapRound:
+ /*
+ * miRoundCap just needs these to be unequal.
+ */
+ endPoint = center;
+ endPoint.x = endPoint.x + 100;
+ miRoundCap(pDraw, pGC, center, endPoint, corner, otherCorner, 0,
+ -xOrg, -yOrg, xFtrans, yFtrans);
+ break;
+ }
}
/* MIROUNDCAP -- a private helper function
@@ -1373,47 +1298,42 @@ miArcCap (
* two corners at this end of the line.
* NOTE: pOtherCorner must be counter-clockwise from pCorner.
*/
-/*ARGSUSED*/
-static void
-miRoundCap(
- DrawablePtr pDraw,
- GCPtr pGC,
- SppPointRec pCenter,
- SppPointRec pEnd,
- SppPointRec pCorner,
- SppPointRec pOtherCorner,
- int fLineEnd,
- int xOrg,
- int yOrg,
- double xFtrans,
- double yFtrans)
+ /*ARGSUSED*/ static void
+miRoundCap(DrawablePtr pDraw,
+ GCPtr pGC,
+ SppPointRec pCenter,
+ SppPointRec pEnd,
+ SppPointRec pCorner,
+ SppPointRec pOtherCorner,
+ int fLineEnd, int xOrg, int yOrg, double xFtrans, double yFtrans)
{
- int cpt;
- double width;
- SppArcRec arc;
- SppPointPtr pArcPts;
+ int cpt;
+ double width;
+ SppArcRec arc;
+ SppPointPtr pArcPts;
- width = (pGC->lineWidth ? (double)pGC->lineWidth : (double)1);
+ width = (pGC->lineWidth ? (double) pGC->lineWidth : (double) 1);
- arc.x = pCenter.x - width/2;
- arc.y = pCenter.y - width/2;
+ arc.x = pCenter.x - width / 2;
+ arc.y = pCenter.y - width / 2;
arc.width = width;
arc.height = width;
- arc.angle1 = -miDatan2 (pCorner.y - pCenter.y, pCorner.x - pCenter.x);
- if(PTISEQUAL(pCenter, pEnd))
- arc.angle2 = - 180.0;
+ arc.angle1 = -miDatan2(pCorner.y - pCenter.y, pCorner.x - pCenter.x);
+ if (PTISEQUAL(pCenter, pEnd))
+ arc.angle2 = -180.0;
else {
- arc.angle2 = -miDatan2 (pOtherCorner.y - pCenter.y, pOtherCorner.x - pCenter.x) - arc.angle1;
- if (arc.angle2 < 0)
- arc.angle2 += 360.0;
+ arc.angle2 =
+ -miDatan2(pOtherCorner.y - pCenter.y,
+ pOtherCorner.x - pCenter.x) - arc.angle1;
+ if (arc.angle2 < 0)
+ arc.angle2 += 360.0;
}
pArcPts = (SppPointPtr) NULL;
- if( (cpt = miGetArcPts(&arc, 0, &pArcPts)) )
- {
- /* by drawing with miFillSppPoly and setting the endpoints of the arc
- * to be the corners, we assure that the cap will meet up with the
- * rest of the line */
- miFillSppPoly(pDraw, pGC, cpt, pArcPts, -xOrg, -yOrg, xFtrans, yFtrans);
+ if ((cpt = miGetArcPts(&arc, 0, &pArcPts))) {
+ /* by drawing with miFillSppPoly and setting the endpoints of the arc
+ * to be the corners, we assure that the cap will meet up with the
+ * rest of the line */
+ miFillSppPoly(pDraw, pGC, cpt, pArcPts, -xOrg, -yOrg, xFtrans, yFtrans);
}
free(pArcPts);
}
@@ -1430,79 +1350,91 @@ miRoundCap(
#define M_PI_2 1.57079632679489661923
#endif
-# define Dsin(d) ((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0)))
-# define Dcos(d) ((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0)))
-# define mod(a,b) ((a) >= 0 ? (a) % (b) : (b) - (-(a)) % (b))
+#define Dsin(d) ((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0)))
+#define Dcos(d) ((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0)))
+#define mod(a,b) ((a) >= 0 ? (a) % (b) : (b) - (-(a)) % (b))
static double
-miDcos (double a)
+miDcos(double a)
{
- int i;
-
- if (floor (a/90) == a/90) {
- i = (int) (a/90.0);
- switch (mod (i, 4)) {
- case 0: return 1;
- case 1: return 0;
- case 2: return -1;
- case 3: return 0;
- }
- }
- return cos (a * M_PI / 180.0);
+ int i;
+
+ if (floor(a / 90) == a / 90) {
+ i = (int) (a / 90.0);
+ switch (mod(i, 4)) {
+ case 0:
+ return 1;
+ case 1:
+ return 0;
+ case 2:
+ return -1;
+ case 3:
+ return 0;
+ }
+ }
+ return cos(a * M_PI / 180.0);
}
static double
-miDsin (double a)
+miDsin(double a)
{
- int i;
-
- if (floor (a/90) == a/90) {
- i = (int) (a/90.0);
- switch (mod (i, 4)) {
- case 0: return 0;
- case 1: return 1;
- case 2: return 0;
- case 3: return -1;
- }
- }
- return sin (a * M_PI / 180.0);
+ int i;
+
+ if (floor(a / 90) == a / 90) {
+ i = (int) (a / 90.0);
+ switch (mod(i, 4)) {
+ case 0:
+ return 0;
+ case 1:
+ return 1;
+ case 2:
+ return 0;
+ case 3:
+ return -1;
+ }
+ }
+ return sin(a * M_PI / 180.0);
}
static double
-miDasin (double v)
+miDasin(double v)
{
if (v == 0)
- return 0.0;
+ return 0.0;
if (v == 1.0)
- return 90.0;
+ return 90.0;
if (v == -1.0)
- return -90.0;
+ return -90.0;
return asin(v) * (180.0 / M_PI);
}
static double
-miDatan2 (double dy, double dx)
+miDatan2(double dy, double dx)
{
if (dy == 0) {
- if (dx >= 0)
- return 0.0;
- return 180.0;
- } else if (dx == 0) {
- if (dy > 0)
- return 90.0;
- return -90.0;
- } else if (fabs (dy) == fabs (dx)) {
- if (dy > 0) {
- if (dx > 0)
- return 45.0;
- return 135.0;
- } else {
- if (dx > 0)
- return 315.0;
- return 225.0;
- }
- } else {
- return atan2 (dy, dx) * (180.0 / M_PI);
+ if (dx >= 0)
+ return 0.0;
+ return 180.0;
+ }
+ else if (dx == 0) {
+ if (dy > 0)
+ return 90.0;
+ return -90.0;
+ }
+ else if (fabs(dy) == fabs(dx)) {
+ if (dy > 0) {
+ if (dx > 0)
+ return 45.0;
+ return 135.0;
+ }
+ else {
+ if (dx > 0)
+ return 315.0;
+ return 225.0;
+ }
+ }
+ else {
+ return atan2(dy, dx) * (180.0 / M_PI);
}
}
@@ -1519,30 +1451,28 @@ miDatan2 (double dy, double dx)
* count on realloc() to handle the null pointer correctly.
*/
static int
-miGetArcPts(
- SppArcPtr parc, /* points to an arc */
- int cpt, /* number of points already in arc list */
- SppPointPtr *ppPts) /* pointer to pointer to arc-list -- modified */
-{
- double st, /* Start Theta, start angle */
- et, /* End Theta, offset from start theta */
- dt, /* Delta Theta, angle to sweep ellipse */
- cdt, /* Cos Delta Theta, actually 2 cos(dt) */
- x0, y0, /* the recurrence formula needs two points to start */
- x1, y1,
- x2, y2, /* this will be the new point generated */
- xc, yc; /* the center point */
- int count, i;
- SppPointPtr poly;
+miGetArcPts(SppArcPtr parc, /* points to an arc */
+ int cpt, /* number of points already in arc list */
+ SppPointPtr * ppPts)
+{ /* pointer to pointer to arc-list -- modified */
+ double st, /* Start Theta, start angle */
+ et, /* End Theta, offset from start theta */
+ dt, /* Delta Theta, angle to sweep ellipse */
+ cdt, /* Cos Delta Theta, actually 2 cos(dt) */
+ x0, y0, /* the recurrence formula needs two points to start */
+ x1, y1, x2, y2, /* this will be the new point generated */
+ xc, yc; /* the center point */
+ int count, i;
+ SppPointPtr poly;
/* The spec says that positive angles indicate counterclockwise motion.
* Given our coordinate system (with 0,0 in the upper left corner),
* the screen appears flipped in Y. The easiest fix is to negate the
* angles given */
-
- st = - parc->angle1;
- et = - parc->angle2;
+ st = -parc->angle1;
+
+ et = -parc->angle2;
/* Try to get a delta theta that is within 1/2 pixel. Then adjust it
* so that it divides evenly into the total.
@@ -1550,175 +1480,151 @@ miGetArcPts(
*/
cdt = parc->width;
if (parc->height > cdt)
- cdt = parc->height;
+ cdt = parc->height;
cdt /= 2.0;
- if(cdt <= 0)
- return 0;
+ if (cdt <= 0)
+ return 0;
if (cdt < 1.0)
- cdt = 1.0;
- dt = miDasin ( 1.0 / cdt ); /* minimum step necessary */
- count = et/dt;
+ cdt = 1.0;
+ dt = miDasin(1.0 / cdt); /* minimum step necessary */
+ count = et / dt;
count = abs(count) + 1;
- dt = et/count;
+ dt = et / count;
count++;
cdt = 2 * miDcos(dt);
- if (!(poly = (SppPointPtr) realloc((pointer)*ppPts,
- (cpt + count) * sizeof(SppPointRec))))
- return 0;
+ if (!(poly = (SppPointPtr) realloc((pointer) *ppPts,
+ (cpt + count) * sizeof(SppPointRec))))
+ return 0;
*ppPts = poly;
- xc = parc->width/2.0; /* store half width and half height */
- yc = parc->height/2.0;
-
+ xc = parc->width / 2.0; /* store half width and half height */
+ yc = parc->height / 2.0;
+
x0 = xc * miDcos(st);
y0 = yc * miDsin(st);
x1 = xc * miDcos(st + dt);
y1 = yc * miDsin(st + dt);
- xc += parc->x; /* by adding initial point, these become */
- yc += parc->y; /* the center point */
+ xc += parc->x; /* by adding initial point, these become */
+ yc += parc->y; /* the center point */
poly[cpt].x = (xc + x0);
poly[cpt].y = (yc + y0);
poly[cpt + 1].x = (xc + x1);
poly[cpt + 1].y = (yc + y1);
- for(i = 2; i < count; i++)
- {
- x2 = cdt * x1 - x0;
- y2 = cdt * y1 - y0;
+ for (i = 2; i < count; i++) {
+ x2 = cdt * x1 - x0;
+ y2 = cdt * y1 - y0;
- poly[cpt + i].x = (xc + x2);
- poly[cpt + i].y = (yc + y2);
+ poly[cpt + i].x = (xc + x2);
+ poly[cpt + i].y = (yc + y2);
- x0 = x1; y0 = y1;
- x1 = x2; y1 = y2;
+ x0 = x1;
+ y0 = y1;
+ x1 = x2;
+ y1 = y2;
}
/* adjust the last point */
if (abs(parc->angle2) >= 360.0)
- poly[cpt +i -1] = poly[0];
+ poly[cpt + i - 1] = poly[0];
else {
- poly[cpt +i -1].x = (miDcos(st + et) * parc->width/2.0 + xc);
- poly[cpt +i -1].y = (miDsin(st + et) * parc->height/2.0 + yc);
+ poly[cpt + i - 1].x = (miDcos(st + et) * parc->width / 2.0 + xc);
+ poly[cpt + i - 1].y = (miDsin(st + et) * parc->height / 2.0 + yc);
}
return count;
}
struct arcData {
- double x0, y0, x1, y1;
- int selfJoin;
+ double x0, y0, x1, y1;
+ int selfJoin;
};
-# define ADD_REALLOC_STEP 20
+#define ADD_REALLOC_STEP 20
static void
-addCap (
- miArcCapPtr *capsp,
- int *ncapsp,
- int *sizep,
- int end,
- int arcIndex)
+addCap(miArcCapPtr * capsp, int *ncapsp, int *sizep, int end, int arcIndex)
{
- int newsize;
- miArcCapPtr cap;
-
- if (*ncapsp == *sizep)
- {
- newsize = *sizep + ADD_REALLOC_STEP;
- cap = (miArcCapPtr) realloc(*capsp,
- newsize * sizeof (**capsp));
- if (!cap)
- return;
- *sizep = newsize;
- *capsp = cap;
- }
- cap = &(*capsp)[*ncapsp];
- cap->end = end;
- cap->arcIndex = arcIndex;
- ++*ncapsp;
+ int newsize;
+ miArcCapPtr cap;
+
+ if (*ncapsp == *sizep) {
+ newsize = *sizep + ADD_REALLOC_STEP;
+ cap = (miArcCapPtr) realloc(*capsp, newsize * sizeof(**capsp));
+ if (!cap)
+ return;
+ *sizep = newsize;
+ *capsp = cap;
+ }
+ cap = &(*capsp)[*ncapsp];
+ cap->end = end;
+ cap->arcIndex = arcIndex;
+ ++*ncapsp;
}
static void
-addJoin (
- miArcJoinPtr *joinsp,
- int *njoinsp,
- int *sizep,
- int end0,
- int index0,
- int phase0,
- int end1,
- int index1,
- int phase1)
+addJoin(miArcJoinPtr * joinsp,
+ int *njoinsp,
+ int *sizep,
+ int end0, int index0, int phase0, int end1, int index1, int phase1)
{
- int newsize;
- miArcJoinPtr join;
-
- if (*njoinsp == *sizep)
- {
- newsize = *sizep + ADD_REALLOC_STEP;
- join = (miArcJoinPtr) realloc(*joinsp,
- newsize * sizeof (**joinsp));
- if (!join)
- return;
- *sizep = newsize;
- *joinsp = join;
- }
- join = &(*joinsp)[*njoinsp];
- join->end0 = end0;
- join->arcIndex0 = index0;
- join->phase0 = phase0;
- join->end1 = end1;
- join->arcIndex1 = index1;
- join->phase1 = phase1;
- ++*njoinsp;
+ int newsize;
+ miArcJoinPtr join;
+
+ if (*njoinsp == *sizep) {
+ newsize = *sizep + ADD_REALLOC_STEP;
+ join = (miArcJoinPtr) realloc(*joinsp, newsize * sizeof(**joinsp));
+ if (!join)
+ return;
+ *sizep = newsize;
+ *joinsp = join;
+ }
+ join = &(*joinsp)[*njoinsp];
+ join->end0 = end0;
+ join->arcIndex0 = index0;
+ join->phase0 = phase0;
+ join->end1 = end1;
+ join->arcIndex1 = index1;
+ join->phase1 = phase1;
+ ++*njoinsp;
}
static miArcDataPtr
-addArc (
- miArcDataPtr *arcsp,
- int *narcsp,
- int *sizep,
- xArc *xarc)
+addArc(miArcDataPtr * arcsp, int *narcsp, int *sizep, xArc * xarc)
{
- int newsize;
- miArcDataPtr arc;
-
- if (*narcsp == *sizep)
- {
- newsize = *sizep + ADD_REALLOC_STEP;
- arc = (miArcDataPtr) realloc(*arcsp,
- newsize * sizeof (**arcsp));
- if (!arc)
- return NULL;
- *sizep = newsize;
- *arcsp = arc;
- }
- arc = &(*arcsp)[*narcsp];
- arc->arc = *xarc;
- ++*narcsp;
- return arc;
+ int newsize;
+ miArcDataPtr arc;
+
+ if (*narcsp == *sizep) {
+ newsize = *sizep + ADD_REALLOC_STEP;
+ arc = (miArcDataPtr) realloc(*arcsp, newsize * sizeof(**arcsp));
+ if (!arc)
+ return NULL;
+ *sizep = newsize;
+ *arcsp = arc;
+ }
+ arc = &(*arcsp)[*narcsp];
+ arc->arc = *xarc;
+ ++*narcsp;
+ return arc;
}
static void
-miFreeArcs(
- miPolyArcPtr arcs,
- GCPtr pGC)
+miFreeArcs(miPolyArcPtr arcs, GCPtr pGC)
{
- int iphase;
-
- for (iphase = ((pGC->lineStyle == LineDoubleDash) ? 1 : 0);
- iphase >= 0;
- iphase--)
- {
- if (arcs[iphase].narcs > 0)
- free(arcs[iphase].arcs);
- if (arcs[iphase].njoins > 0)
- free(arcs[iphase].joins);
- if (arcs[iphase].ncaps > 0)
- free(arcs[iphase].caps);
- }
- free(arcs);
+ int iphase;
+
+ for (iphase = ((pGC->lineStyle == LineDoubleDash) ? 1 : 0);
+ iphase >= 0; iphase--) {
+ if (arcs[iphase].narcs > 0)
+ free(arcs[iphase].arcs);
+ if (arcs[iphase].njoins > 0)
+ free(arcs[iphase].joins);
+ if (arcs[iphase].ncaps > 0)
+ free(arcs[iphase].caps);
+ }
+ free(arcs);
}
/*
@@ -1729,486 +1635,484 @@ miFreeArcs(
* a polygonal approximation to the arc for computing arc lengths
*/
-# define DASH_MAP_SIZE 91
+#define DASH_MAP_SIZE 91
-# define dashIndexToAngle(di) ((((double) (di)) * 90.0) / ((double) DASH_MAP_SIZE - 1))
-# define xAngleToDashIndex(xa) ((((long) (xa)) * (DASH_MAP_SIZE - 1)) / (90 * 64))
-# define dashIndexToXAngle(di) ((((long) (di)) * (90 * 64)) / (DASH_MAP_SIZE - 1))
-# define dashXAngleStep (((double) (90 * 64)) / ((double) (DASH_MAP_SIZE - 1)))
+#define dashIndexToAngle(di) ((((double) (di)) * 90.0) / ((double) DASH_MAP_SIZE - 1))
+#define xAngleToDashIndex(xa) ((((long) (xa)) * (DASH_MAP_SIZE - 1)) / (90 * 64))
+#define dashIndexToXAngle(di) ((((long) (di)) * (90 * 64)) / (DASH_MAP_SIZE - 1))
+#define dashXAngleStep (((double) (90 * 64)) / ((double) (DASH_MAP_SIZE - 1)))
typedef struct {
- double map[DASH_MAP_SIZE];
+ double map[DASH_MAP_SIZE];
} dashMap;
-static int computeAngleFromPath(int startAngle, int endAngle, dashMap *map,
- int *lenp, int backwards);
+static int computeAngleFromPath(int startAngle, int endAngle, dashMap * map,
+ int *lenp, int backwards);
static void
-computeDashMap (
- xArc *arcp,
- dashMap *map)
+computeDashMap(xArc * arcp, dashMap * map)
{
- int di;
- double a, x, y, prevx = 0.0, prevy = 0.0, dist;
-
- for (di = 0; di < DASH_MAP_SIZE; di++) {
- a = dashIndexToAngle (di);
- x = ((double) arcp->width / 2.0) * miDcos (a);
- y = ((double) arcp->height / 2.0) * miDsin (a);
- if (di == 0) {
- map->map[di] = 0.0;
- } else {
- dist = hypot (x - prevx, y - prevy);
- map->map[di] = map->map[di - 1] + dist;
- }
- prevx = x;
- prevy = y;
- }
+ int di;
+ double a, x, y, prevx = 0.0, prevy = 0.0, dist;
+
+ for (di = 0; di < DASH_MAP_SIZE; di++) {
+ a = dashIndexToAngle(di);
+ x = ((double) arcp->width / 2.0) * miDcos(a);
+ y = ((double) arcp->height / 2.0) * miDsin(a);
+ if (di == 0) {
+ map->map[di] = 0.0;
+ }
+ else {
+ dist = hypot(x - prevx, y - prevy);
+ map->map[di] = map->map[di - 1] + dist;
+ }
+ prevx = x;
+ prevy = y;
+ }
}
-typedef enum {HORIZONTAL, VERTICAL, OTHER} arcTypes;
+typedef enum { HORIZONTAL, VERTICAL, OTHER } arcTypes;
/* this routine is a bit gory */
static miPolyArcPtr
-miComputeArcs (
- xArc *parcs,
- int narcs,
- GCPtr pGC)
+miComputeArcs(xArc * parcs, int narcs, GCPtr pGC)
{
- int isDashed, isDoubleDash;
- int dashOffset;
- miPolyArcPtr arcs;
- int start, i, j, k = 0, nexti, nextk = 0;
- int joinSize[2];
- int capSize[2];
- int arcSize[2];
- int angle2;
- double a0, a1;
- struct arcData *data;
- miArcDataPtr arc;
- xArc xarc;
- int iphase, prevphase = 0, joinphase;
- int arcsJoin;
- int selfJoin;
-
- int iDash = 0, dashRemaining = 0;
- int iDashStart = 0, dashRemainingStart = 0, iphaseStart;
- int startAngle, spanAngle, endAngle, backwards = 0;
- int prevDashAngle, dashAngle;
- dashMap map;
-
- isDashed = !(pGC->lineStyle == LineSolid);
- isDoubleDash = (pGC->lineStyle == LineDoubleDash);
- dashOffset = pGC->dashOffset;
-
- data = malloc(narcs * sizeof (struct arcData));
- if (!data)
- return NULL;
- arcs = malloc(sizeof (*arcs) * (isDoubleDash ? 2 : 1));
- if (!arcs)
- {
- free(data);
- return NULL;
- }
- for (i = 0; i < narcs; i++) {
- a0 = todeg (parcs[i].angle1);
- angle2 = parcs[i].angle2;
- if (angle2 > FULLCIRCLE)
- angle2 = FULLCIRCLE;
- else if (angle2 < -FULLCIRCLE)
- angle2 = -FULLCIRCLE;
- data[i].selfJoin = angle2 == FULLCIRCLE || angle2 == -FULLCIRCLE;
- a1 = todeg (parcs[i].angle1 + angle2);
- data[i].x0 = parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos (a0));
- data[i].y0 = parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin (a0));
- data[i].x1 = parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos (a1));
- data[i].y1 = parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin (a1));
- }
-
- for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++) {
- arcs[iphase].njoins = 0;
- arcs[iphase].joins = 0;
- joinSize[iphase] = 0;
-
- arcs[iphase].ncaps = 0;
- arcs[iphase].caps = 0;
- capSize[iphase] = 0;
-
- arcs[iphase].narcs = 0;
- arcs[iphase].arcs = 0;
- arcSize[iphase] = 0;
- }
-
- iphase = 0;
- if (isDashed) {
- iDash = 0;
- dashRemaining = pGC->dash[0];
- while (dashOffset > 0) {
- if (dashOffset >= dashRemaining) {
- dashOffset -= dashRemaining;
- iphase = iphase ? 0 : 1;
- iDash++;
- if (iDash == pGC->numInDashList)
- iDash = 0;
- dashRemaining = pGC->dash[iDash];
- } else {
- dashRemaining -= dashOffset;
- dashOffset = 0;
- }
- }
- iDashStart = iDash;
- dashRemainingStart = dashRemaining;
- }
- iphaseStart = iphase;
-
- for (i = narcs - 1; i >= 0; i--) {
- j = i + 1;
- if (j == narcs)
- j = 0;
- if (data[i].selfJoin || i == j ||
- (UNEQUAL (data[i].x1, data[j].x0) ||
- UNEQUAL (data[i].y1, data[j].y0)))
- {
- if (iphase == 0 || isDoubleDash)
- addCap (&arcs[iphase].caps, &arcs[iphase].ncaps,
- &capSize[iphase], RIGHT_END, 0);
- break;
- }
- }
- start = i + 1;
- if (start == narcs)
- start = 0;
- i = start;
- for (;;) {
- j = i + 1;
- if (j == narcs)
- j = 0;
- nexti = i+1;
- if (nexti == narcs)
- nexti = 0;
- if (isDashed) {
- /*
- ** deal with dashed arcs. Use special rules for certain 0 area arcs.
- ** Presumably, the other 0 area arcs still aren't done right.
- */
- arcTypes arcType = OTHER;
- CARD16 thisLength;
-
- if (parcs[i].height == 0
- && (parcs[i].angle1 % FULLCIRCLE) == 0x2d00
- && parcs[i].angle2 == 0x2d00)
- arcType = HORIZONTAL;
- else if (parcs[i].width == 0
- && (parcs[i].angle1 % FULLCIRCLE) == 0x1680
- && parcs[i].angle2 == 0x2d00)
- arcType = VERTICAL;
- if (arcType == OTHER) {
- /*
- * precompute an approximation map
- */
- computeDashMap (&parcs[i], &map);
- /*
- * compute each individual dash segment using the path
- * length function
- */
- startAngle = parcs[i].angle1;
- spanAngle = parcs[i].angle2;
- if (spanAngle > FULLCIRCLE)
- spanAngle = FULLCIRCLE;
- else if (spanAngle < -FULLCIRCLE)
- spanAngle = -FULLCIRCLE;
- if (startAngle < 0)
- startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE;
- if (startAngle >= FULLCIRCLE)
- startAngle = startAngle % FULLCIRCLE;
- endAngle = startAngle + spanAngle;
- backwards = spanAngle < 0;
- } else {
- xarc = parcs[i];
- if (arcType == VERTICAL) {
- xarc.angle1 = 0x1680;
- startAngle = parcs[i].y;
- endAngle = startAngle + parcs[i].height;
- } else {
- xarc.angle1 = 0x2d00;
- startAngle = parcs[i].x;
- endAngle = startAngle + parcs[i].width;
- }
- }
- dashAngle = startAngle;
- selfJoin = data[i].selfJoin &&
- (iphase == 0 || isDoubleDash);
- /*
- * add dashed arcs to each bucket
- */
- arc = 0;
- while (dashAngle != endAngle) {
- prevDashAngle = dashAngle;
- if (arcType == OTHER) {
- dashAngle = computeAngleFromPath (prevDashAngle, endAngle,
- &map, &dashRemaining, backwards);
- /* avoid troubles with huge arcs and small dashes */
- if (dashAngle == prevDashAngle) {
- if (backwards)
- dashAngle--;
- else
- dashAngle++;
- }
- } else {
- thisLength = (dashAngle + dashRemaining <= endAngle) ?
- dashRemaining : endAngle - dashAngle;
- if (arcType == VERTICAL) {
- xarc.y = dashAngle;
- xarc.height = thisLength;
- } else {
- xarc.x = dashAngle;
- xarc.width = thisLength;
- }
- dashAngle += thisLength;
- dashRemaining -= thisLength;
- }
- if (iphase == 0 || isDoubleDash) {
- if (arcType == OTHER) {
- xarc = parcs[i];
- spanAngle = prevDashAngle;
- if (spanAngle < 0)
- spanAngle = FULLCIRCLE - (-spanAngle) % FULLCIRCLE;
- if (spanAngle >= FULLCIRCLE)
- spanAngle = spanAngle % FULLCIRCLE;
- xarc.angle1 = spanAngle;
- spanAngle = dashAngle - prevDashAngle;
- if (backwards) {
- if (dashAngle > prevDashAngle)
- spanAngle = - FULLCIRCLE + spanAngle;
- } else {
- if (dashAngle < prevDashAngle)
- spanAngle = FULLCIRCLE + spanAngle;
- }
- if (spanAngle > FULLCIRCLE)
- spanAngle = FULLCIRCLE;
- if (spanAngle < -FULLCIRCLE)
- spanAngle = -FULLCIRCLE;
- xarc.angle2 = spanAngle;
- }
- arc = addArc (&arcs[iphase].arcs, &arcs[iphase].narcs,
- &arcSize[iphase], &xarc);
- if (!arc)
- goto arcfail;
- /*
- * cap each end of an on/off dash
- */
- if (!isDoubleDash) {
- if (prevDashAngle != startAngle) {
- addCap (&arcs[iphase].caps,
- &arcs[iphase].ncaps,
- &capSize[iphase], RIGHT_END,
- arc - arcs[iphase].arcs);
-
- }
- if (dashAngle != endAngle) {
- addCap (&arcs[iphase].caps,
- &arcs[iphase].ncaps,
- &capSize[iphase], LEFT_END,
- arc - arcs[iphase].arcs);
- }
- }
- arc->cap = arcs[iphase].ncaps;
- arc->join = arcs[iphase].njoins;
- arc->render = 0;
- arc->selfJoin = 0;
- if (dashAngle == endAngle)
- arc->selfJoin = selfJoin;
- }
- prevphase = iphase;
- if (dashRemaining <= 0) {
- ++iDash;
- if (iDash == pGC->numInDashList)
- iDash = 0;
- iphase = iphase ? 0:1;
- dashRemaining = pGC->dash[iDash];
- }
- }
- /*
- * make sure a place exists for the position data when
- * drawing a zero-length arc
- */
- if (startAngle == endAngle) {
- prevphase = iphase;
- if (!isDoubleDash && iphase == 1)
- prevphase = 0;
- arc = addArc (&arcs[prevphase].arcs, &arcs[prevphase].narcs,
- &arcSize[prevphase], &parcs[i]);
- if (!arc)
- goto arcfail;
- arc->join = arcs[prevphase].njoins;
- arc->cap = arcs[prevphase].ncaps;
- arc->selfJoin = data[i].selfJoin;
- }
- } else {
- arc = addArc (&arcs[iphase].arcs, &arcs[iphase].narcs,
- &arcSize[iphase], &parcs[i]);
- if (!arc)
- goto arcfail;
- arc->join = arcs[iphase].njoins;
- arc->cap = arcs[iphase].ncaps;
- arc->selfJoin = data[i].selfJoin;
- prevphase = iphase;
- }
- if (prevphase == 0 || isDoubleDash)
- k = arcs[prevphase].narcs - 1;
- if (iphase == 0 || isDoubleDash)
- nextk = arcs[iphase].narcs;
- if (nexti == start) {
- nextk = 0;
- if (isDashed) {
- iDash = iDashStart;
- iphase = iphaseStart;
- dashRemaining = dashRemainingStart;
- }
- }
- arcsJoin = narcs > 1 && i != j &&
- ISEQUAL (data[i].x1, data[j].x0) &&
- ISEQUAL (data[i].y1, data[j].y0) &&
- !data[i].selfJoin && !data[j].selfJoin;
- if (arc)
- {
- if (arcsJoin)
- arc->render = 0;
- else
- arc->render = 1;
- }
- if (arcsJoin &&
- (prevphase == 0 || isDoubleDash) &&
- (iphase == 0 || isDoubleDash))
- {
- joinphase = iphase;
- if (isDoubleDash) {
- if (nexti == start)
- joinphase = iphaseStart;
- /*
- * if the join is right at the dash,
- * draw the join in foreground
- * This is because the foreground
- * arcs are computed second, the results
- * of which are needed to draw the join
- */
- if (joinphase != prevphase)
- joinphase = 0;
- }
- if (joinphase == 0 || isDoubleDash) {
- addJoin (&arcs[joinphase].joins,
- &arcs[joinphase].njoins,
- &joinSize[joinphase],
- LEFT_END, k, prevphase,
- RIGHT_END, nextk, iphase);
- arc->join = arcs[prevphase].njoins;
- }
- } else {
- /*
- * cap the left end of this arc
- * unless it joins itself
- */
- if ((prevphase == 0 || isDoubleDash) &&
- !arc->selfJoin)
- {
- addCap (&arcs[prevphase].caps, &arcs[prevphase].ncaps,
- &capSize[prevphase], LEFT_END, k);
- arc->cap = arcs[prevphase].ncaps;
- }
- if (isDashed && !arcsJoin) {
- iDash = iDashStart;
- iphase = iphaseStart;
- dashRemaining = dashRemainingStart;
- }
- nextk = arcs[iphase].narcs;
- if (nexti == start) {
- nextk = 0;
- iDash = iDashStart;
- iphase = iphaseStart;
- dashRemaining = dashRemainingStart;
- }
- /*
- * cap the right end of the next arc. If the
- * next arc is actually the first arc, only
- * cap it if it joins with this arc. This
- * case will occur when the final dash segment
- * of an on/off dash is off. Of course, this
- * cap will be drawn at a strange time, but that
- * hardly matters...
- */
- if ((iphase == 0 || isDoubleDash) &&
- (nexti != start || (arcsJoin && isDashed)))
- addCap (&arcs[iphase].caps, &arcs[iphase].ncaps,
- &capSize[iphase], RIGHT_END, nextk);
- }
- i = nexti;
- if (i == start)
- break;
- }
- /*
- * make sure the last section is rendered
- */
- for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++)
- if (arcs[iphase].narcs > 0) {
- arcs[iphase].arcs[arcs[iphase].narcs-1].render = 1;
- arcs[iphase].arcs[arcs[iphase].narcs-1].join =
- arcs[iphase].njoins;
- arcs[iphase].arcs[arcs[iphase].narcs-1].cap =
- arcs[iphase].ncaps;
- }
- free(data);
- return arcs;
-arcfail:
- miFreeArcs(arcs, pGC);
- free(data);
- return NULL;
+ int isDashed, isDoubleDash;
+ int dashOffset;
+ miPolyArcPtr arcs;
+ int start, i, j, k = 0, nexti, nextk = 0;
+ int joinSize[2];
+ int capSize[2];
+ int arcSize[2];
+ int angle2;
+ double a0, a1;
+ struct arcData *data;
+ miArcDataPtr arc;
+ xArc xarc;
+ int iphase, prevphase = 0, joinphase;
+ int arcsJoin;
+ int selfJoin;
+
+ int iDash = 0, dashRemaining = 0;
+ int iDashStart = 0, dashRemainingStart = 0, iphaseStart;
+ int startAngle, spanAngle, endAngle, backwards = 0;
+ int prevDashAngle, dashAngle;
+ dashMap map;
+
+ isDashed = !(pGC->lineStyle == LineSolid);
+ isDoubleDash = (pGC->lineStyle == LineDoubleDash);
+ dashOffset = pGC->dashOffset;
+
+ data = malloc(narcs * sizeof(struct arcData));
+ if (!data)
+ return NULL;
+ arcs = malloc(sizeof(*arcs) * (isDoubleDash ? 2 : 1));
+ if (!arcs) {
+ free(data);
+ return NULL;
+ }
+ for (i = 0; i < narcs; i++) {
+ a0 = todeg(parcs[i].angle1);
+ angle2 = parcs[i].angle2;
+ if (angle2 > FULLCIRCLE)
+ angle2 = FULLCIRCLE;
+ else if (angle2 < -FULLCIRCLE)
+ angle2 = -FULLCIRCLE;
+ data[i].selfJoin = angle2 == FULLCIRCLE || angle2 == -FULLCIRCLE;
+ a1 = todeg(parcs[i].angle1 + angle2);
+ data[i].x0 =
+ parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos(a0));
+ data[i].y0 =
+ parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin(a0));
+ data[i].x1 =
+ parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos(a1));
+ data[i].y1 =
+ parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin(a1));
+ }
+
+ for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++) {
+ arcs[iphase].njoins = 0;
+ arcs[iphase].joins = 0;
+ joinSize[iphase] = 0;
+
+ arcs[iphase].ncaps = 0;
+ arcs[iphase].caps = 0;
+ capSize[iphase] = 0;
+
+ arcs[iphase].narcs = 0;
+ arcs[iphase].arcs = 0;
+ arcSize[iphase] = 0;
+ }
+
+ iphase = 0;
+ if (isDashed) {
+ iDash = 0;
+ dashRemaining = pGC->dash[0];
+ while (dashOffset > 0) {
+ if (dashOffset >= dashRemaining) {
+ dashOffset -= dashRemaining;
+ iphase = iphase ? 0 : 1;
+ iDash++;
+ if (iDash == pGC->numInDashList)
+ iDash = 0;
+ dashRemaining = pGC->dash[iDash];
+ }
+ else {
+ dashRemaining -= dashOffset;
+ dashOffset = 0;
+ }
+ }
+ iDashStart = iDash;
+ dashRemainingStart = dashRemaining;
+ }
+ iphaseStart = iphase;
+
+ for (i = narcs - 1; i >= 0; i--) {
+ j = i + 1;
+ if (j == narcs)
+ j = 0;
+ if (data[i].selfJoin || i == j ||
+ (UNEQUAL(data[i].x1, data[j].x0) ||
+ UNEQUAL(data[i].y1, data[j].y0))) {
+ if (iphase == 0 || isDoubleDash)
+ addCap(&arcs[iphase].caps, &arcs[iphase].ncaps,
+ &capSize[iphase], RIGHT_END, 0);
+ break;
+ }
+ }
+ start = i + 1;
+ if (start == narcs)
+ start = 0;
+ i = start;
+ for (;;) {
+ j = i + 1;
+ if (j == narcs)
+ j = 0;
+ nexti = i + 1;
+ if (nexti == narcs)
+ nexti = 0;
+ if (isDashed) {
+ /*
+ ** deal with dashed arcs. Use special rules for certain 0 area arcs.
+ ** Presumably, the other 0 area arcs still aren't done right.
+ */
+ arcTypes arcType = OTHER;
+ CARD16 thisLength;
+
+ if (parcs[i].height == 0
+ && (parcs[i].angle1 % FULLCIRCLE) == 0x2d00
+ && parcs[i].angle2 == 0x2d00)
+ arcType = HORIZONTAL;
+ else if (parcs[i].width == 0
+ && (parcs[i].angle1 % FULLCIRCLE) == 0x1680
+ && parcs[i].angle2 == 0x2d00)
+ arcType = VERTICAL;
+ if (arcType == OTHER) {
+ /*
+ * precompute an approximation map
+ */
+ computeDashMap(&parcs[i], &map);
+ /*
+ * compute each individual dash segment using the path
+ * length function
+ */
+ startAngle = parcs[i].angle1;
+ spanAngle = parcs[i].angle2;
+ if (spanAngle > FULLCIRCLE)
+ spanAngle = FULLCIRCLE;
+ else if (spanAngle < -FULLCIRCLE)
+ spanAngle = -FULLCIRCLE;
+ if (startAngle < 0)
+ startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE;
+ if (startAngle >= FULLCIRCLE)
+ startAngle = startAngle % FULLCIRCLE;
+ endAngle = startAngle + spanAngle;
+ backwards = spanAngle < 0;
+ }
+ else {
+ xarc = parcs[i];
+ if (arcType == VERTICAL) {
+ xarc.angle1 = 0x1680;
+ startAngle = parcs[i].y;
+ endAngle = startAngle + parcs[i].height;
+ }
+ else {
+ xarc.angle1 = 0x2d00;
+ startAngle = parcs[i].x;
+ endAngle = startAngle + parcs[i].width;
+ }
+ }
+ dashAngle = startAngle;
+ selfJoin = data[i].selfJoin && (iphase == 0 || isDoubleDash);
+ /*
+ * add dashed arcs to each bucket
+ */
+ arc = 0;
+ while (dashAngle != endAngle) {
+ prevDashAngle = dashAngle;
+ if (arcType == OTHER) {
+ dashAngle = computeAngleFromPath(prevDashAngle, endAngle,
+ &map, &dashRemaining,
+ backwards);
+ /* avoid troubles with huge arcs and small dashes */
+ if (dashAngle == prevDashAngle) {
+ if (backwards)
+ dashAngle--;
+ else
+ dashAngle++;
+ }
+ }
+ else {
+ thisLength = (dashAngle + dashRemaining <= endAngle) ?
+ dashRemaining : endAngle - dashAngle;
+ if (arcType == VERTICAL) {
+ xarc.y = dashAngle;
+ xarc.height = thisLength;
+ }
+ else {
+ xarc.x = dashAngle;
+ xarc.width = thisLength;
+ }
+ dashAngle += thisLength;
+ dashRemaining -= thisLength;
+ }
+ if (iphase == 0 || isDoubleDash) {
+ if (arcType == OTHER) {
+ xarc = parcs[i];
+ spanAngle = prevDashAngle;
+ if (spanAngle < 0)
+ spanAngle = FULLCIRCLE - (-spanAngle) % FULLCIRCLE;
+ if (spanAngle >= FULLCIRCLE)
+ spanAngle = spanAngle % FULLCIRCLE;
+ xarc.angle1 = spanAngle;
+ spanAngle = dashAngle - prevDashAngle;
+ if (backwards) {
+ if (dashAngle > prevDashAngle)
+ spanAngle = -FULLCIRCLE + spanAngle;
+ }
+ else {
+ if (dashAngle < prevDashAngle)
+ spanAngle = FULLCIRCLE + spanAngle;
+ }
+ if (spanAngle > FULLCIRCLE)
+ spanAngle = FULLCIRCLE;
+ if (spanAngle < -FULLCIRCLE)
+ spanAngle = -FULLCIRCLE;
+ xarc.angle2 = spanAngle;
+ }
+ arc = addArc(&arcs[iphase].arcs, &arcs[iphase].narcs,
+ &arcSize[iphase], &xarc);
+ if (!arc)
+ goto arcfail;
+ /*
+ * cap each end of an on/off dash
+ */
+ if (!isDoubleDash) {
+ if (prevDashAngle != startAngle) {
+ addCap(&arcs[iphase].caps,
+ &arcs[iphase].ncaps,
+ &capSize[iphase], RIGHT_END,
+ arc - arcs[iphase].arcs);
+
+ }
+ if (dashAngle != endAngle) {
+ addCap(&arcs[iphase].caps,
+ &arcs[iphase].ncaps,
+ &capSize[iphase], LEFT_END,
+ arc - arcs[iphase].arcs);
+ }
+ }
+ arc->cap = arcs[iphase].ncaps;
+ arc->join = arcs[iphase].njoins;
+ arc->render = 0;
+ arc->selfJoin = 0;
+ if (dashAngle == endAngle)
+ arc->selfJoin = selfJoin;
+ }
+ prevphase = iphase;
+ if (dashRemaining <= 0) {
+ ++iDash;
+ if (iDash == pGC->numInDashList)
+ iDash = 0;
+ iphase = iphase ? 0 : 1;
+ dashRemaining = pGC->dash[iDash];
+ }
+ }
+ /*
+ * make sure a place exists for the position data when
+ * drawing a zero-length arc
+ */
+ if (startAngle == endAngle) {
+ prevphase = iphase;
+ if (!isDoubleDash && iphase == 1)
+ prevphase = 0;
+ arc = addArc(&arcs[prevphase].arcs, &arcs[prevphase].narcs,
+ &arcSize[prevphase], &parcs[i]);
+ if (!arc)
+ goto arcfail;
+ arc->join = arcs[prevphase].njoins;
+ arc->cap = arcs[prevphase].ncaps;
+ arc->selfJoin = data[i].selfJoin;
+ }
+ }
+ else {
+ arc = addArc(&arcs[iphase].arcs, &arcs[iphase].narcs,
+ &arcSize[iphase], &parcs[i]);
+ if (!arc)
+ goto arcfail;
+ arc->join = arcs[iphase].njoins;
+ arc->cap = arcs[iphase].ncaps;
+ arc->selfJoin = data[i].selfJoin;
+ prevphase = iphase;
+ }
+ if (prevphase == 0 || isDoubleDash)
+ k = arcs[prevphase].narcs - 1;
+ if (iphase == 0 || isDoubleDash)
+ nextk = arcs[iphase].narcs;
+ if (nexti == start) {
+ nextk = 0;
+ if (isDashed) {
+ iDash = iDashStart;
+ iphase = iphaseStart;
+ dashRemaining = dashRemainingStart;
+ }
+ }
+ arcsJoin = narcs > 1 && i != j &&
+ ISEQUAL(data[i].x1, data[j].x0) &&
+ ISEQUAL(data[i].y1, data[j].y0) &&
+ !data[i].selfJoin && !data[j].selfJoin;
+ if (arc) {
+ if (arcsJoin)
+ arc->render = 0;
+ else
+ arc->render = 1;
+ }
+ if (arcsJoin &&
+ (prevphase == 0 || isDoubleDash) && (iphase == 0 || isDoubleDash)) {
+ joinphase = iphase;
+ if (isDoubleDash) {
+ if (nexti == start)
+ joinphase = iphaseStart;
+ /*
+ * if the join is right at the dash,
+ * draw the join in foreground
+ * This is because the foreground
+ * arcs are computed second, the results
+ * of which are needed to draw the join
+ */
+ if (joinphase != prevphase)
+ joinphase = 0;
+ }
+ if (joinphase == 0 || isDoubleDash) {
+ addJoin(&arcs[joinphase].joins,
+ &arcs[joinphase].njoins,
+ &joinSize[joinphase],
+ LEFT_END, k, prevphase, RIGHT_END, nextk, iphase);
+ arc->join = arcs[prevphase].njoins;
+ }
+ }
+ else {
+ /*
+ * cap the left end of this arc
+ * unless it joins itself
+ */
+ if ((prevphase == 0 || isDoubleDash) && !arc->selfJoin) {
+ addCap(&arcs[prevphase].caps, &arcs[prevphase].ncaps,
+ &capSize[prevphase], LEFT_END, k);
+ arc->cap = arcs[prevphase].ncaps;
+ }
+ if (isDashed && !arcsJoin) {
+ iDash = iDashStart;
+ iphase = iphaseStart;
+ dashRemaining = dashRemainingStart;
+ }
+ nextk = arcs[iphase].narcs;
+ if (nexti == start) {
+ nextk = 0;
+ iDash = iDashStart;
+ iphase = iphaseStart;
+ dashRemaining = dashRemainingStart;
+ }
+ /*
+ * cap the right end of the next arc. If the
+ * next arc is actually the first arc, only
+ * cap it if it joins with this arc. This
+ * case will occur when the final dash segment
+ * of an on/off dash is off. Of course, this
+ * cap will be drawn at a strange time, but that
+ * hardly matters...
+ */
+ if ((iphase == 0 || isDoubleDash) &&
+ (nexti != start || (arcsJoin && isDashed)))
+ addCap(&arcs[iphase].caps, &arcs[iphase].ncaps,
+ &capSize[iphase], RIGHT_END, nextk);
+ }
+ i = nexti;
+ if (i == start)
+ break;
+ }
+ /*
+ * make sure the last section is rendered
+ */
+ for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++)
+ if (arcs[iphase].narcs > 0) {
+ arcs[iphase].arcs[arcs[iphase].narcs - 1].render = 1;
+ arcs[iphase].arcs[arcs[iphase].narcs - 1].join =
+ arcs[iphase].njoins;
+ arcs[iphase].arcs[arcs[iphase].narcs - 1].cap = arcs[iphase].ncaps;
+ }
+ free(data);
+ return arcs;
+ arcfail:
+ miFreeArcs(arcs, pGC);
+ free(data);
+ return NULL;
}
static double
-angleToLength (
- int angle,
- dashMap *map)
+angleToLength(int angle, dashMap * map)
{
- double len, excesslen, sidelen = map->map[DASH_MAP_SIZE - 1], totallen;
- int di;
- int excess;
- Bool oddSide = FALSE;
-
- totallen = 0;
- if (angle >= 0) {
- while (angle >= 90 * 64) {
- angle -= 90 * 64;
- totallen += sidelen;
- oddSide = !oddSide;
- }
- } else {
- while (angle < 0) {
- angle += 90 * 64;
- totallen -= sidelen;
- oddSide = !oddSide;
- }
- }
- if (oddSide)
- angle = 90 * 64 - angle;
-
- di = xAngleToDashIndex (angle);
- excess = angle - dashIndexToXAngle (di);
-
- len = map->map[di];
- /*
- * linearly interpolate between this point and the next
- */
- if (excess > 0) {
- excesslen = (map->map[di + 1] - map->map[di]) *
- ((double) excess) / dashXAngleStep;
- len += excesslen;
- }
- if (oddSide)
- totallen += (sidelen - len);
- else
- totallen += len;
- return totallen;
+ double len, excesslen, sidelen = map->map[DASH_MAP_SIZE - 1], totallen;
+ int di;
+ int excess;
+ Bool oddSide = FALSE;
+
+ totallen = 0;
+ if (angle >= 0) {
+ while (angle >= 90 * 64) {
+ angle -= 90 * 64;
+ totallen += sidelen;
+ oddSide = !oddSide;
+ }
+ }
+ else {
+ while (angle < 0) {
+ angle += 90 * 64;
+ totallen -= sidelen;
+ oddSide = !oddSide;
+ }
+ }
+ if (oddSide)
+ angle = 90 * 64 - angle;
+
+ di = xAngleToDashIndex(angle);
+ excess = angle - dashIndexToXAngle(di);
+
+ len = map->map[di];
+ /*
+ * linearly interpolate between this point and the next
+ */
+ if (excess > 0) {
+ excesslen = (map->map[di + 1] - map->map[di]) *
+ ((double) excess) / dashXAngleStep;
+ len += excesslen;
+ }
+ if (oddSide)
+ totallen += (sidelen - len);
+ else
+ totallen += len;
+ return totallen;
}
/*
@@ -2216,63 +2120,62 @@ angleToLength (
*/
static int
-lengthToAngle (
- double len,
- dashMap *map)
+lengthToAngle(double len, dashMap * map)
{
- double sidelen = map->map[DASH_MAP_SIZE - 1];
- int angle, angleexcess;
- Bool oddSide = FALSE;
- int a0, a1, a;
-
- angle = 0;
- /*
- * step around the ellipse, subtracting sidelens and
- * adding 90 degrees. oddSide will tell if the
- * map should be interpolated in reverse
- */
- if (len >= 0) {
- if (sidelen == 0)
- return 2 * FULLCIRCLE; /* infinity */
- while (len >= sidelen) {
- angle += 90 * 64;
- len -= sidelen;
- oddSide = !oddSide;
- }
- } else {
- if (sidelen == 0)
- return -2 * FULLCIRCLE; /* infinity */
- while (len < 0) {
- angle -= 90 * 64;
- len += sidelen;
- oddSide = !oddSide;
- }
- }
- if (oddSide)
- len = sidelen - len;
- a0 = 0;
- a1 = DASH_MAP_SIZE - 1;
- /*
- * binary search for the closest pre-computed length
- */
- while (a1 - a0 > 1) {
- a = (a0 + a1) / 2;
- if (len > map->map[a])
- a0 = a;
- else
- a1 = a;
- }
- angleexcess = dashIndexToXAngle (a0);
- /*
- * linearly interpolate to the next point
- */
- angleexcess += (len - map->map[a0]) /
- (map->map[a0+1] - map->map[a0]) * dashXAngleStep;
- if (oddSide)
- angle += (90 * 64) - angleexcess;
- else
- angle += angleexcess;
- return angle;
+ double sidelen = map->map[DASH_MAP_SIZE - 1];
+ int angle, angleexcess;
+ Bool oddSide = FALSE;
+ int a0, a1, a;
+
+ angle = 0;
+ /*
+ * step around the ellipse, subtracting sidelens and
+ * adding 90 degrees. oddSide will tell if the
+ * map should be interpolated in reverse
+ */
+ if (len >= 0) {
+ if (sidelen == 0)
+ return 2 * FULLCIRCLE; /* infinity */
+ while (len >= sidelen) {
+ angle += 90 * 64;
+ len -= sidelen;
+ oddSide = !oddSide;
+ }
+ }
+ else {
+ if (sidelen == 0)
+ return -2 * FULLCIRCLE; /* infinity */
+ while (len < 0) {
+ angle -= 90 * 64;
+ len += sidelen;
+ oddSide = !oddSide;
+ }
+ }
+ if (oddSide)
+ len = sidelen - len;
+ a0 = 0;
+ a1 = DASH_MAP_SIZE - 1;
+ /*
+ * binary search for the closest pre-computed length
+ */
+ while (a1 - a0 > 1) {
+ a = (a0 + a1) / 2;
+ if (len > map->map[a])
+ a0 = a;
+ else
+ a1 = a;
+ }
+ angleexcess = dashIndexToXAngle(a0);
+ /*
+ * linearly interpolate to the next point
+ */
+ angleexcess += (len - map->map[a0]) /
+ (map->map[a0 + 1] - map->map[a0]) * dashXAngleStep;
+ if (oddSide)
+ angle += (90 * 64) - angleexcess;
+ else
+ angle += angleexcess;
+ return angle;
}
/*
@@ -2288,41 +2191,38 @@ lengthToAngle (
*/
static int
-computeAngleFromPath (
- int startAngle,
- int endAngle, /* normalized absolute angles in *64 degrees */
- dashMap *map,
- int *lenp,
- int backwards)
+computeAngleFromPath(int startAngle, int endAngle, /* normalized absolute angles in *64 degrees */
+ dashMap * map, int *lenp, int backwards)
{
- int a0, a1, a;
- double len0;
- int len;
-
- a0 = startAngle;
- a1 = endAngle;
- len = *lenp;
- if (backwards) {
- /*
- * flip the problem around to always be
- * forwards
- */
- a0 = FULLCIRCLE - a0;
- a1 = FULLCIRCLE - a1;
- }
- if (a1 < a0)
- a1 += FULLCIRCLE;
- len0 = angleToLength (a0, map);
- a = lengthToAngle (len0 + len, map);
- if (a > a1) {
- a = a1;
- len -= angleToLength (a1, map) - len0;
- } else
- len = 0;
- if (backwards)
- a = FULLCIRCLE - a;
- *lenp = len;
- return a;
+ int a0, a1, a;
+ double len0;
+ int len;
+
+ a0 = startAngle;
+ a1 = endAngle;
+ len = *lenp;
+ if (backwards) {
+ /*
+ * flip the problem around to always be
+ * forwards
+ */
+ a0 = FULLCIRCLE - a0;
+ a1 = FULLCIRCLE - a1;
+ }
+ if (a1 < a0)
+ a1 += FULLCIRCLE;
+ len0 = angleToLength(a0, map);
+ a = lengthToAngle(len0 + len, map);
+ if (a > a1) {
+ a = a1;
+ len -= angleToLength(a1, map) - len0;
+ }
+ else
+ len = 0;
+ if (backwards)
+ a = FULLCIRCLE - a;
+ *lenp = len;
+ return a;
}
/*
@@ -2334,133 +2234,122 @@ computeAngleFromPath (
*/
static void
-drawZeroArc (
- DrawablePtr pDraw,
- GCPtr pGC,
- xArc *tarc,
- int lw,
- miArcFacePtr left,
- miArcFacePtr right)
+drawZeroArc(DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc * tarc, int lw, miArcFacePtr left, miArcFacePtr right)
{
- double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0, w, h, x, y;
- double xmax, ymax, xmin, ymin;
- int a0, a1;
- double a, startAngle, endAngle;
- double l, lx, ly;
-
- l = lw / 2.0;
- a0 = tarc->angle1;
- a1 = tarc->angle2;
- if (a1 > FULLCIRCLE)
- a1 = FULLCIRCLE;
- else if (a1 < -FULLCIRCLE)
- a1 = -FULLCIRCLE;
- w = (double)tarc->width / 2.0;
- h = (double)tarc->height / 2.0;
- /*
- * play in X coordinates right away
- */
- startAngle = - ((double) a0 / 64.0);
- endAngle = - ((double) (a0 + a1) / 64.0);
-
- xmax = -w;
- xmin = w;
- ymax = -h;
- ymin = h;
- a = startAngle;
- for (;;)
- {
- x = w * miDcos(a);
- y = h * miDsin(a);
- if (a == startAngle)
- {
- x0 = x;
- y0 = y;
- }
- if (a == endAngle)
- {
- x1 = x;
- y1 = y;
- }
- if (x > xmax)
- xmax = x;
- if (x < xmin)
- xmin = x;
- if (y > ymax)
- ymax = y;
- if (y < ymin)
- ymin = y;
- if (a == endAngle)
- break;
- if (a1 < 0) /* clockwise */
- {
- if (floor (a / 90.0) == floor (endAngle / 90.0))
- a = endAngle;
- else
- a = 90 * (floor (a/90.0) + 1);
- }
- else
- {
- if (ceil (a / 90.0) == ceil (endAngle / 90.0))
- a = endAngle;
- else
- a = 90 * (ceil (a/90.0) - 1);
- }
- }
- lx = ly = l;
- if ((x1 - x0) + (y1 - y0) < 0)
- lx = ly = -l;
- if (h)
- {
- ly = 0.0;
- lx = -lx;
- }
- else
- lx = 0.0;
- if (right)
- {
- right->center.x = x0;
- right->center.y = y0;
- right->clock.x = x0 - lx;
- right->clock.y = y0 - ly;
- right->counterClock.x = x0 + lx;
- right->counterClock.y = y0 + ly;
- }
- if (left)
- {
- left->center.x = x1;
- left->center.y = y1;
- left->clock.x = x1 + lx;
- left->clock.y = y1 + ly;
- left->counterClock.x = x1 - lx;
- left->counterClock.y = y1 - ly;
- }
-
- x0 = xmin;
- x1 = xmax;
- y0 = ymin;
- y1 = ymax;
- if (ymin != y1) {
- xmin = -l;
- xmax = l;
- } else {
- ymin = -l;
- ymax = l;
- }
- if (xmax != xmin && ymax != ymin) {
- int minx, maxx, miny, maxy;
- xRectangle rect;
-
- minx = ICEIL (xmin + w) + tarc->x;
- maxx = ICEIL (xmax + w) + tarc->x;
- miny = ICEIL (ymin + h) + tarc->y;
- maxy = ICEIL (ymax + h) + tarc->y;
- rect.x = minx;
- rect.y = miny;
- rect.width = maxx - minx;
- rect.height = maxy - miny;
- (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect);
- }
+ double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0, w, h, x, y;
+ double xmax, ymax, xmin, ymin;
+ int a0, a1;
+ double a, startAngle, endAngle;
+ double l, lx, ly;
+
+ l = lw / 2.0;
+ a0 = tarc->angle1;
+ a1 = tarc->angle2;
+ if (a1 > FULLCIRCLE)
+ a1 = FULLCIRCLE;
+ else if (a1 < -FULLCIRCLE)
+ a1 = -FULLCIRCLE;
+ w = (double) tarc->width / 2.0;
+ h = (double) tarc->height / 2.0;
+ /*
+ * play in X coordinates right away
+ */
+ startAngle = -((double) a0 / 64.0);
+ endAngle = -((double) (a0 + a1) / 64.0);
+
+ xmax = -w;
+ xmin = w;
+ ymax = -h;
+ ymin = h;
+ a = startAngle;
+ for (;;) {
+ x = w * miDcos(a);
+ y = h * miDsin(a);
+ if (a == startAngle) {
+ x0 = x;
+ y0 = y;
+ }
+ if (a == endAngle) {
+ x1 = x;
+ y1 = y;
+ }
+ if (x > xmax)
+ xmax = x;
+ if (x < xmin)
+ xmin = x;
+ if (y > ymax)
+ ymax = y;
+ if (y < ymin)
+ ymin = y;
+ if (a == endAngle)
+ break;
+ if (a1 < 0) { /* clockwise */
+ if (floor(a / 90.0) == floor(endAngle / 90.0))
+ a = endAngle;
+ else
+ a = 90 * (floor(a / 90.0) + 1);
+ }
+ else {
+ if (ceil(a / 90.0) == ceil(endAngle / 90.0))
+ a = endAngle;
+ else
+ a = 90 * (ceil(a / 90.0) - 1);
+ }
+ }
+ lx = ly = l;
+ if ((x1 - x0) + (y1 - y0) < 0)
+ lx = ly = -l;
+ if (h) {
+ ly = 0.0;
+ lx = -lx;
+ }
+ else
+ lx = 0.0;
+ if (right) {
+ right->center.x = x0;
+ right->center.y = y0;
+ right->clock.x = x0 - lx;
+ right->clock.y = y0 - ly;
+ right->counterClock.x = x0 + lx;
+ right->counterClock.y = y0 + ly;
+ }
+ if (left) {
+ left->center.x = x1;
+ left->center.y = y1;
+ left->clock.x = x1 + lx;
+ left->clock.y = y1 + ly;
+ left->counterClock.x = x1 - lx;
+ left->counterClock.y = y1 - ly;
+ }
+
+ x0 = xmin;
+ x1 = xmax;
+ y0 = ymin;
+ y1 = ymax;
+ if (ymin != y1) {
+ xmin = -l;
+ xmax = l;
+ }
+ else {
+ ymin = -l;
+ ymax = l;
+ }
+ if (xmax != xmin && ymax != ymin) {
+ int minx, maxx, miny, maxy;
+ xRectangle rect;
+
+ minx = ICEIL(xmin + w) + tarc->x;
+ maxx = ICEIL(xmax + w) + tarc->x;
+ miny = ICEIL(ymin + h) + tarc->y;
+ maxy = ICEIL(ymax + h) + tarc->y;
+ rect.x = minx;
+ rect.y = miny;
+ rect.width = maxx - minx;
+ rect.height = maxy - miny;
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect);
+ }
}
/*
@@ -2469,27 +2358,26 @@ drawZeroArc (
*/
static void
-tailEllipseY (
- struct arc_def *def,
- struct accelerators *acc)
+tailEllipseY(struct arc_def *def, struct accelerators *acc)
{
- double t;
-
- acc->tail_y = 0.0;
- if (def->w == def->h)
- return;
- t = def->l * def->w;
- if (def->w > def->h) {
- if (t < acc->h2)
- return;
- } else {
- if (t > acc->h2)
- return;
- }
- t = 2.0 * def->h * t;
- t = (CUBED_ROOT_4 * acc->h2 - cbrt(t * t)) / acc->h2mw2;
- if (t > 0.0)
- acc->tail_y = def->h / CUBED_ROOT_2 * sqrt(t);
+ double t;
+
+ acc->tail_y = 0.0;
+ if (def->w == def->h)
+ return;
+ t = def->l * def->w;
+ if (def->w > def->h) {
+ if (t < acc->h2)
+ return;
+ }
+ else {
+ if (t > acc->h2)
+ return;
+ }
+ t = 2.0 * def->h * t;
+ t = (CUBED_ROOT_4 * acc->h2 - cbrt(t * t)) / acc->h2mw2;
+ if (t > 0.0)
+ acc->tail_y = def->h / CUBED_ROOT_2 * sqrt(t);
}
/*
@@ -2498,73 +2386,49 @@ tailEllipseY (
*/
static double
-outerXfromXY (
- double x,
- double y,
- struct arc_def *def,
- struct accelerators *acc)
+outerXfromXY(double x, double y, struct arc_def *def, struct accelerators *acc)
{
- return x + (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
+ return x + (x * acc->h2l) / sqrt(x * x * acc->h4 + y * y * acc->w4);
}
static double
-outerYfromXY (
- double x,
- double y,
- struct arc_def *def,
- struct accelerators *acc)
+outerYfromXY(double x, double y, struct arc_def *def, struct accelerators *acc)
{
- return y + (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
+ return y + (y * acc->w2l) / sqrt(x * x * acc->h4 + y * y * acc->w4);
}
static double
-innerXfromXY (
- double x,
- double y,
- struct arc_def *def,
- struct accelerators *acc)
+innerXfromXY(double x, double y, struct arc_def *def, struct accelerators *acc)
{
- return x - (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
+ return x - (x * acc->h2l) / sqrt(x * x * acc->h4 + y * y * acc->w4);
}
static double
-innerYfromXY (
- double x,
- double y,
- struct arc_def *def,
- struct accelerators *acc)
+innerYfromXY(double x, double y, struct arc_def *def, struct accelerators *acc)
{
- return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
+ return y - (y * acc->w2l) / sqrt(x * x * acc->h4 + y * y * acc->w4);
}
static double
-innerYfromY (
- double y,
- struct arc_def *def,
- struct accelerators *acc)
+innerYfromY(double y, struct arc_def *def, struct accelerators *acc)
{
- double x;
+ double x;
- x = (def->w / def->h) * sqrt (acc->h2 - y*y);
+ x = (def->w / def->h) * sqrt(acc->h2 - y * y);
- return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
+ return y - (y * acc->w2l) / sqrt(x * x * acc->h4 + y * y * acc->w4);
}
static void
-computeLine (
- double x1,
- double y1,
- double x2,
- double y2,
- struct line *line)
+computeLine(double x1, double y1, double x2, double y2, struct line *line)
{
- if (y1 == y2)
- line->valid = 0;
- else {
- line->m = (x1 - x2) / (y1 - y2);
- line->b = x1 - y1 * line->m;
- line->valid = 1;
- }
+ if (y1 == y2)
+ line->valid = 0;
+ else {
+ line->m = (x1 - x2) / (y1 - y2);
+ line->b = x1 - y1 * line->m;
+ line->valid = 1;
+ }
}
/*
@@ -2574,124 +2438,117 @@ computeLine (
*/
static void
-computeAcc (
- xArc *tarc,
- int lw,
- struct arc_def *def,
- struct accelerators *acc)
+computeAcc(xArc * tarc, int lw, struct arc_def *def, struct accelerators *acc)
{
- def->w = ((double) tarc->width) / 2.0;
- def->h = ((double) tarc->height) / 2.0;
- def->l = ((double) lw) / 2.0;
- acc->h2 = def->h * def->h;
- acc->w2 = def->w * def->w;
- acc->h4 = acc->h2 * acc->h2;
- acc->w4 = acc->w2 * acc->w2;
- acc->h2l = acc->h2 * def->l;
- acc->w2l = acc->w2 * def->l;
- acc->h2mw2 = acc->h2 - acc->w2;
- acc->fromIntX = (tarc->width & 1) ? 0.5 : 0.0;
- acc->fromIntY = (tarc->height & 1) ? 0.5 : 0.0;
- acc->xorg = tarc->x + (tarc->width >> 1);
- acc->yorgu = tarc->y + (tarc->height >> 1);
- acc->yorgl = acc->yorgu + (tarc->height & 1);
- tailEllipseY (def, acc);
+ def->w = ((double) tarc->width) / 2.0;
+ def->h = ((double) tarc->height) / 2.0;
+ def->l = ((double) lw) / 2.0;
+ acc->h2 = def->h * def->h;
+ acc->w2 = def->w * def->w;
+ acc->h4 = acc->h2 * acc->h2;
+ acc->w4 = acc->w2 * acc->w2;
+ acc->h2l = acc->h2 * def->l;
+ acc->w2l = acc->w2 * def->l;
+ acc->h2mw2 = acc->h2 - acc->w2;
+ acc->fromIntX = (tarc->width & 1) ? 0.5 : 0.0;
+ acc->fromIntY = (tarc->height & 1) ? 0.5 : 0.0;
+ acc->xorg = tarc->x + (tarc->width >> 1);
+ acc->yorgu = tarc->y + (tarc->height >> 1);
+ acc->yorgl = acc->yorgu + (tarc->height & 1);
+ tailEllipseY(def, acc);
}
-
+
/*
* compute y value bounds of various portions of the arc,
* the outer edge, the ellipse and the inner edge.
*/
static void
-computeBound (
- struct arc_def *def,
- struct arc_bound *bound,
- struct accelerators *acc,
- miArcFacePtr right,
- miArcFacePtr left)
+computeBound(struct arc_def *def,
+ struct arc_bound *bound,
+ struct accelerators *acc, miArcFacePtr right, miArcFacePtr left)
{
- double t;
- double innerTaily;
- double tail_y;
- struct bound innerx, outerx;
- struct bound ellipsex;
-
- bound->ellipse.min = Dsin (def->a0) * def->h;
- bound->ellipse.max = Dsin (def->a1) * def->h;
- if (def->a0 == 45 && def->w == def->h)
- ellipsex.min = bound->ellipse.min;
- else
- ellipsex.min = Dcos (def->a0) * def->w;
- if (def->a1 == 45 && def->w == def->h)
- ellipsex.max = bound->ellipse.max;
- else
- ellipsex.max = Dcos (def->a1) * def->w;
- bound->outer.min = outerYfromXY (ellipsex.min, bound->ellipse.min, def, acc);
- bound->outer.max = outerYfromXY (ellipsex.max, bound->ellipse.max, def, acc);
- bound->inner.min = innerYfromXY (ellipsex.min, bound->ellipse.min, def, acc);
- bound->inner.max = innerYfromXY (ellipsex.max, bound->ellipse.max, def, acc);
-
- outerx.min = outerXfromXY (ellipsex.min, bound->ellipse.min, def, acc);
- outerx.max = outerXfromXY (ellipsex.max, bound->ellipse.max, def, acc);
- innerx.min = innerXfromXY (ellipsex.min, bound->ellipse.min, def, acc);
- innerx.max = innerXfromXY (ellipsex.max, bound->ellipse.max, def, acc);
-
- /*
- * save the line end points for the
- * cap code to use. Careful here, these are
- * in cartesean coordinates (y increasing upwards)
- * while the cap code uses inverted coordinates
- * (y increasing downwards)
- */
-
- if (right) {
- right->counterClock.y = bound->outer.min;
- right->counterClock.x = outerx.min;
- right->center.y = bound->ellipse.min;
- right->center.x = ellipsex.min;
- right->clock.y = bound->inner.min;
- right->clock.x = innerx.min;
- }
-
- if (left) {
- left->clock.y = bound->outer.max;
- left->clock.x = outerx.max;
- left->center.y = bound->ellipse.max;
- left->center.x = ellipsex.max;
- left->counterClock.y = bound->inner.max;
- left->counterClock.x = innerx.max;
- }
-
- bound->left.min = bound->inner.max;
- bound->left.max = bound->outer.max;
- bound->right.min = bound->inner.min;
- bound->right.max = bound->outer.min;
-
- computeLine (innerx.min, bound->inner.min, outerx.min, bound->outer.min,
- &acc->right);
- computeLine (innerx.max, bound->inner.max, outerx.max, bound->outer.max,
- &acc->left);
-
- if (bound->inner.min > bound->inner.max) {
- t = bound->inner.min;
- bound->inner.min = bound->inner.max;
- bound->inner.max = t;
- }
- tail_y = acc->tail_y;
- if (tail_y > bound->ellipse.max)
- tail_y = bound->ellipse.max;
- else if (tail_y < bound->ellipse.min)
- tail_y = bound->ellipse.min;
- innerTaily = innerYfromY (tail_y, def, acc);
- if (bound->inner.min > innerTaily)
- bound->inner.min = innerTaily;
- if (bound->inner.max < innerTaily)
- bound->inner.max = innerTaily;
- bound->inneri.min = ICEIL(bound->inner.min - acc->fromIntY);
- bound->inneri.max = floor(bound->inner.max - acc->fromIntY);
- bound->outeri.min = ICEIL(bound->outer.min - acc->fromIntY);
- bound->outeri.max = floor(bound->outer.max - acc->fromIntY);
+ double t;
+ double innerTaily;
+ double tail_y;
+ struct bound innerx, outerx;
+ struct bound ellipsex;
+
+ bound->ellipse.min = Dsin(def->a0) * def->h;
+ bound->ellipse.max = Dsin(def->a1) * def->h;
+ if (def->a0 == 45 && def->w == def->h)
+ ellipsex.min = bound->ellipse.min;
+ else
+ ellipsex.min = Dcos(def->a0) * def->w;
+ if (def->a1 == 45 && def->w == def->h)
+ ellipsex.max = bound->ellipse.max;
+ else
+ ellipsex.max = Dcos(def->a1) * def->w;
+ bound->outer.min = outerYfromXY(ellipsex.min, bound->ellipse.min, def, acc);
+ bound->outer.max = outerYfromXY(ellipsex.max, bound->ellipse.max, def, acc);
+ bound->inner.min = innerYfromXY(ellipsex.min, bound->ellipse.min, def, acc);
+ bound->inner.max = innerYfromXY(ellipsex.max, bound->ellipse.max, def, acc);
+
+ outerx.min = outerXfromXY(ellipsex.min, bound->ellipse.min, def, acc);
+ outerx.max = outerXfromXY(ellipsex.max, bound->ellipse.max, def, acc);
+ innerx.min = innerXfromXY(ellipsex.min, bound->ellipse.min, def, acc);
+ innerx.max = innerXfromXY(ellipsex.max, bound->ellipse.max, def, acc);
+
+ /*
+ * save the line end points for the
+ * cap code to use. Careful here, these are
+ * in cartesean coordinates (y increasing upwards)
+ * while the cap code uses inverted coordinates
+ * (y increasing downwards)
+ */
+
+ if (right) {
+ right->counterClock.y = bound->outer.min;
+ right->counterClock.x = outerx.min;
+ right->center.y = bound->ellipse.min;
+ right->center.x = ellipsex.min;
+ right->clock.y = bound->inner.min;
+ right->clock.x = innerx.min;
+ }
+
+ if (left) {
+ left->clock.y = bound->outer.max;
+ left->clock.x = outerx.max;
+ left->center.y = bound->ellipse.max;
+ left->center.x = ellipsex.max;
+ left->counterClock.y = bound->inner.max;
+ left->counterClock.x = innerx.max;
+ }
+
+ bound->left.min = bound->inner.max;
+ bound->left.max = bound->outer.max;
+ bound->right.min = bound->inner.min;
+ bound->right.max = bound->outer.min;
+
+ computeLine(innerx.min, bound->inner.min, outerx.min, bound->outer.min,
+ &acc->right);
+ computeLine(innerx.max, bound->inner.max, outerx.max, bound->outer.max,
+ &acc->left);
+
+ if (bound->inner.min > bound->inner.max) {
+ t = bound->inner.min;
+ bound->inner.min = bound->inner.max;
+ bound->inner.max = t;
+ }
+ tail_y = acc->tail_y;
+ if (tail_y > bound->ellipse.max)
+ tail_y = bound->ellipse.max;
+ else if (tail_y < bound->ellipse.min)
+ tail_y = bound->ellipse.min;
+ innerTaily = innerYfromY(tail_y, def, acc);
+ if (bound->inner.min > innerTaily)
+ bound->inner.min = innerTaily;
+ if (bound->inner.max < innerTaily)
+ bound->inner.max = innerTaily;
+ bound->inneri.min = ICEIL(bound->inner.min - acc->fromIntY);
+ bound->inneri.max = floor(bound->inner.max - acc->fromIntY);
+ bound->outeri.min = ICEIL(bound->outer.min - acc->fromIntY);
+ bound->outeri.max = floor(bound->outer.max - acc->fromIntY);
}
/*
@@ -2745,24 +2602,21 @@ computeBound (
*/
static double
-hookEllipseY (
- double scan_y,
- struct arc_bound *bound,
- struct accelerators *acc,
- int left)
+hookEllipseY(double scan_y,
+ struct arc_bound *bound, struct accelerators *acc, int left)
{
- double ret;
-
- if (acc->h2mw2 == 0) {
- if ( (scan_y > 0 && !left) || (scan_y < 0 && left) )
- return bound->ellipse.min;
- return bound->ellipse.max;
- }
- ret = (acc->h4 * scan_y) / (acc->h2mw2);
- if (ret >= 0)
- return cbrt (ret);
- else
- return -cbrt (-ret);
+ double ret;
+
+ if (acc->h2mw2 == 0) {
+ if ((scan_y > 0 && !left) || (scan_y < 0 && left))
+ return bound->ellipse.min;
+ return bound->ellipse.max;
+ }
+ ret = (acc->h4 * scan_y) / (acc->h2mw2);
+ if (ret >= 0)
+ return cbrt(ret);
+ else
+ return -cbrt(-ret);
}
/*
@@ -2771,55 +2625,55 @@ hookEllipseY (
*/
static double
-hookX (
- double scan_y,
- struct arc_def *def,
- struct arc_bound *bound,
- struct accelerators *acc,
- int left)
+hookX(double scan_y,
+ struct arc_def *def,
+ struct arc_bound *bound, struct accelerators *acc, int left)
{
- double ellipse_y, x;
- double maxMin;
-
- if (def->w != def->h) {
- ellipse_y = hookEllipseY (scan_y, bound, acc, left);
- if (boundedLe (ellipse_y, bound->ellipse)) {
- /*
- * compute the value of the second
- * derivative
- */
- maxMin = ellipse_y*ellipse_y*ellipse_y * acc->h2mw2 -
- acc->h2 * scan_y * (3 * ellipse_y*ellipse_y - 2*acc->h2);
- if ((left && maxMin > 0) || (!left && maxMin < 0)) {
- if (ellipse_y == 0)
- return def->w + left ? -def->l : def->l;
- x = (acc->h2 * scan_y - ellipse_y * acc->h2mw2) *
- sqrt (acc->h2 - ellipse_y * ellipse_y) /
- (def->h * def->w * ellipse_y);
- return x;
- }
- }
- }
- if (left) {
- if (acc->left.valid && boundedLe (scan_y, bound->left)) {
- x = intersectLine (scan_y, acc->left);
- } else {
- if (acc->right.valid)
- x = intersectLine (scan_y, acc->right);
- else
- x = def->w - def->l;
- }
- } else {
- if (acc->right.valid && boundedLe (scan_y, bound->right)) {
- x = intersectLine (scan_y, acc->right);
- } else {
- if (acc->left.valid)
- x = intersectLine (scan_y, acc->left);
- else
- x = def->w - def->l;
- }
- }
- return x;
+ double ellipse_y, x;
+ double maxMin;
+
+ if (def->w != def->h) {
+ ellipse_y = hookEllipseY(scan_y, bound, acc, left);
+ if (boundedLe(ellipse_y, bound->ellipse)) {
+ /*
+ * compute the value of the second
+ * derivative
+ */
+ maxMin = ellipse_y * ellipse_y * ellipse_y * acc->h2mw2 -
+ acc->h2 * scan_y * (3 * ellipse_y * ellipse_y - 2 * acc->h2);
+ if ((left && maxMin > 0) || (!left && maxMin < 0)) {
+ if (ellipse_y == 0)
+ return def->w + left ? -def->l : def->l;
+ x = (acc->h2 * scan_y - ellipse_y * acc->h2mw2) *
+ sqrt(acc->h2 - ellipse_y * ellipse_y) /
+ (def->h * def->w * ellipse_y);
+ return x;
+ }
+ }
+ }
+ if (left) {
+ if (acc->left.valid && boundedLe(scan_y, bound->left)) {
+ x = intersectLine(scan_y, acc->left);
+ }
+ else {
+ if (acc->right.valid)
+ x = intersectLine(scan_y, acc->right);
+ else
+ x = def->w - def->l;
+ }
+ }
+ else {
+ if (acc->right.valid && boundedLe(scan_y, bound->right)) {
+ x = intersectLine(scan_y, acc->right);
+ }
+ else {
+ if (acc->left.valid)
+ x = intersectLine(scan_y, acc->left);
+ else
+ x = def->w - def->l;
+ }
+ }
+ return x;
}
/*
@@ -2828,152 +2682,130 @@ hookX (
*/
static void
-arcSpan (
- int y,
- int lx,
- int lw,
- int rx,
- int rw,
- struct arc_def *def,
- struct arc_bound *bounds,
- struct accelerators *acc,
- int mask)
+arcSpan(int y,
+ int lx,
+ int lw,
+ int rx,
+ int rw,
+ struct arc_def *def,
+ struct arc_bound *bounds, struct accelerators *acc, int mask)
{
- int linx, loutx, rinx, routx;
- double x, altx;
-
- if (boundedLe (y, bounds->inneri)) {
- linx = -(lx + lw);
- rinx = rx;
- } else {
- /*
- * intersection with left face
- */
- x = hookX (y + acc->fromIntY, def, bounds, acc, 1);
- if (acc->right.valid &&
- boundedLe (y + acc->fromIntY, bounds->right))
- {
- altx = intersectLine (y + acc->fromIntY, acc->right);
- if (altx < x)
- x = altx;
- }
- linx = -ICEIL(acc->fromIntX - x);
- rinx = ICEIL(acc->fromIntX + x);
- }
- if (boundedLe (y, bounds->outeri)) {
- loutx = -lx;
- routx = rx + rw;
- } else {
- /*
- * intersection with right face
- */
- x = hookX (y + acc->fromIntY, def, bounds, acc, 0);
- if (acc->left.valid &&
- boundedLe (y + acc->fromIntY, bounds->left))
- {
- altx = x;
- x = intersectLine (y + acc->fromIntY, acc->left);
- if (x < altx)
- x = altx;
- }
- loutx = -ICEIL(acc->fromIntX - x);
- routx = ICEIL(acc->fromIntX + x);
- }
- if (routx > rinx) {
- if (mask & 1)
- newFinalSpan (acc->yorgu - y,
- acc->xorg + rinx, acc->xorg + routx);
- if (mask & 8)
- newFinalSpan (acc->yorgl + y,
- acc->xorg + rinx, acc->xorg + routx);
- }
- if (loutx > linx) {
- if (mask & 2)
- newFinalSpan (acc->yorgu - y,
- acc->xorg - loutx, acc->xorg - linx);
- if (mask & 4)
- newFinalSpan (acc->yorgl + y,
- acc->xorg - loutx, acc->xorg - linx);
- }
+ int linx, loutx, rinx, routx;
+ double x, altx;
+
+ if (boundedLe(y, bounds->inneri)) {
+ linx = -(lx + lw);
+ rinx = rx;
+ }
+ else {
+ /*
+ * intersection with left face
+ */
+ x = hookX(y + acc->fromIntY, def, bounds, acc, 1);
+ if (acc->right.valid && boundedLe(y + acc->fromIntY, bounds->right)) {
+ altx = intersectLine(y + acc->fromIntY, acc->right);
+ if (altx < x)
+ x = altx;
+ }
+ linx = -ICEIL(acc->fromIntX - x);
+ rinx = ICEIL(acc->fromIntX + x);
+ }
+ if (boundedLe(y, bounds->outeri)) {
+ loutx = -lx;
+ routx = rx + rw;
+ }
+ else {
+ /*
+ * intersection with right face
+ */
+ x = hookX(y + acc->fromIntY, def, bounds, acc, 0);
+ if (acc->left.valid && boundedLe(y + acc->fromIntY, bounds->left)) {
+ altx = x;
+ x = intersectLine(y + acc->fromIntY, acc->left);
+ if (x < altx)
+ x = altx;
+ }
+ loutx = -ICEIL(acc->fromIntX - x);
+ routx = ICEIL(acc->fromIntX + x);
+ }
+ if (routx > rinx) {
+ if (mask & 1)
+ newFinalSpan(acc->yorgu - y, acc->xorg + rinx, acc->xorg + routx);
+ if (mask & 8)
+ newFinalSpan(acc->yorgl + y, acc->xorg + rinx, acc->xorg + routx);
+ }
+ if (loutx > linx) {
+ if (mask & 2)
+ newFinalSpan(acc->yorgu - y, acc->xorg - loutx, acc->xorg - linx);
+ if (mask & 4)
+ newFinalSpan(acc->yorgl + y, acc->xorg - loutx, acc->xorg - linx);
+ }
}
static void
-arcSpan0 (
- int lx,
- int lw,
- int rx,
- int rw,
- struct arc_def *def,
- struct arc_bound *bounds,
- struct accelerators *acc,
- int mask)
+arcSpan0(int lx,
+ int lw,
+ int rx,
+ int rw,
+ struct arc_def *def,
+ struct arc_bound *bounds, struct accelerators *acc, int mask)
{
double x;
- if (boundedLe (0, bounds->inneri) &&
- acc->left.valid && boundedLe (0, bounds->left) &&
- acc->left.b > 0)
- {
- x = def->w - def->l;
- if (acc->left.b < x)
- x = acc->left.b;
- lw = ICEIL(acc->fromIntX - x) - lx;
- rw += rx;
- rx = ICEIL(acc->fromIntX + x);
- rw -= rx;
- }
- arcSpan (0, lx, lw, rx, rw, def, bounds, acc, mask);
+ if (boundedLe(0, bounds->inneri) &&
+ acc->left.valid && boundedLe(0, bounds->left) && acc->left.b > 0) {
+ x = def->w - def->l;
+ if (acc->left.b < x)
+ x = acc->left.b;
+ lw = ICEIL(acc->fromIntX - x) - lx;
+ rw += rx;
+ rx = ICEIL(acc->fromIntX + x);
+ rw -= rx;
+ }
+ arcSpan(0, lx, lw, rx, rw, def, bounds, acc, mask);
}
static void
-tailSpan (
- int y,
- int lw,
- int rw,
- struct arc_def *def,
- struct arc_bound *bounds,
- struct accelerators *acc,
- int mask)
+tailSpan(int y,
+ int lw,
+ int rw,
+ struct arc_def *def,
+ struct arc_bound *bounds, struct accelerators *acc, int mask)
{
double yy, xalt, x, lx, rx;
int n;
if (boundedLe(y, bounds->outeri))
- arcSpan (y, 0, lw, -rw, rw, def, bounds, acc, mask);
+ arcSpan(y, 0, lw, -rw, rw, def, bounds, acc, mask);
else if (def->w != def->h) {
- yy = y + acc->fromIntY;
- x = tailX(yy, def, bounds, acc);
- if (yy == 0.0 && x == -rw - acc->fromIntX)
- return;
- if (acc->right.valid && boundedLe (yy, bounds->right)) {
- rx = x;
- lx = -x;
- xalt = intersectLine (yy, acc->right);
- if (xalt >= -rw - acc->fromIntX && xalt <= rx)
- rx = xalt;
- n = ICEIL(acc->fromIntX + lx);
- if (lw > n) {
- if (mask & 2)
- newFinalSpan (acc->yorgu - y,
- acc->xorg + n, acc->xorg + lw);
- if (mask & 4)
- newFinalSpan (acc->yorgl + y,
- acc->xorg + n, acc->xorg + lw);
- }
- n = ICEIL(acc->fromIntX + rx);
- if (n > -rw) {
- if (mask & 1)
- newFinalSpan (acc->yorgu - y,
- acc->xorg - rw, acc->xorg + n);
- if (mask & 8)
- newFinalSpan (acc->yorgl + y,
- acc->xorg - rw, acc->xorg + n);
- }
- }
- arcSpan (y,
- ICEIL(acc->fromIntX - x), 0,
- ICEIL(acc->fromIntX + x), 0,
- def, bounds, acc, mask);
+ yy = y + acc->fromIntY;
+ x = tailX(yy, def, bounds, acc);
+ if (yy == 0.0 && x == -rw - acc->fromIntX)
+ return;
+ if (acc->right.valid && boundedLe(yy, bounds->right)) {
+ rx = x;
+ lx = -x;
+ xalt = intersectLine(yy, acc->right);
+ if (xalt >= -rw - acc->fromIntX && xalt <= rx)
+ rx = xalt;
+ n = ICEIL(acc->fromIntX + lx);
+ if (lw > n) {
+ if (mask & 2)
+ newFinalSpan(acc->yorgu - y, acc->xorg + n, acc->xorg + lw);
+ if (mask & 4)
+ newFinalSpan(acc->yorgl + y, acc->xorg + n, acc->xorg + lw);
+ }
+ n = ICEIL(acc->fromIntX + rx);
+ if (n > -rw) {
+ if (mask & 1)
+ newFinalSpan(acc->yorgu - y, acc->xorg - rw, acc->xorg + n);
+ if (mask & 8)
+ newFinalSpan(acc->yorgl + y, acc->xorg - rw, acc->xorg + n);
+ }
+ }
+ arcSpan(y,
+ ICEIL(acc->fromIntX - x), 0,
+ ICEIL(acc->fromIntX + x), 0, def, bounds, acc, mask);
}
}
@@ -2982,254 +2814,247 @@ tailSpan (
* very bad.
*/
-static struct finalSpan **finalSpans = NULL;
-static int finalMiny = 0, finalMaxy = -1;
-static int finalSize = 0;
+static struct finalSpan **finalSpans = NULL;
+static int finalMiny = 0, finalMaxy = -1;
+static int finalSize = 0;
-static int nspans = 0; /* total spans, not just y coords */
+static int nspans = 0; /* total spans, not just y coords */
struct finalSpan {
- struct finalSpan *next;
- int min, max; /* x values */
+ struct finalSpan *next;
+ int min, max; /* x values */
};
-static struct finalSpan *freeFinalSpans, *tmpFinalSpan;
+static struct finalSpan *freeFinalSpans, *tmpFinalSpan;
-# define allocFinalSpan() (freeFinalSpans ?\
+#define allocFinalSpan() (freeFinalSpans ?\
((tmpFinalSpan = freeFinalSpans), \
(freeFinalSpans = freeFinalSpans->next), \
(tmpFinalSpan->next = 0), \
tmpFinalSpan) : \
realAllocSpan ())
-# define SPAN_CHUNK_SIZE 128
+#define SPAN_CHUNK_SIZE 128
struct finalSpanChunk {
- struct finalSpan data[SPAN_CHUNK_SIZE];
- struct finalSpanChunk *next;
+ struct finalSpan data[SPAN_CHUNK_SIZE];
+ struct finalSpanChunk *next;
};
-static struct finalSpanChunk *chunks;
+static struct finalSpanChunk *chunks;
static struct finalSpan *
-realAllocSpan (void)
+realAllocSpan(void)
{
- struct finalSpanChunk *newChunk;
- struct finalSpan *span;
- int i;
-
- newChunk = malloc(sizeof (struct finalSpanChunk));
- if (!newChunk)
- return (struct finalSpan *) NULL;
- newChunk->next = chunks;
- chunks = newChunk;
- freeFinalSpans = span = newChunk->data + 1;
- for (i = 1; i < SPAN_CHUNK_SIZE-1; i++) {
- span->next = span+1;
- span++;
- }
- span->next = 0;
- span = newChunk->data;
- span->next = 0;
- return span;
+ struct finalSpanChunk *newChunk;
+ struct finalSpan *span;
+ int i;
+
+ newChunk = malloc(sizeof(struct finalSpanChunk));
+ if (!newChunk)
+ return (struct finalSpan *) NULL;
+ newChunk->next = chunks;
+ chunks = newChunk;
+ freeFinalSpans = span = newChunk->data + 1;
+ for (i = 1; i < SPAN_CHUNK_SIZE - 1; i++) {
+ span->next = span + 1;
+ span++;
+ }
+ span->next = 0;
+ span = newChunk->data;
+ span->next = 0;
+ return span;
}
static void
-disposeFinalSpans (void)
+disposeFinalSpans(void)
{
- struct finalSpanChunk *chunk, *next;
-
- for (chunk = chunks; chunk; chunk = next) {
- next = chunk->next;
- free(chunk);
- }
- chunks = 0;
- freeFinalSpans = 0;
- free(finalSpans);
- finalSpans = 0;
+ struct finalSpanChunk *chunk, *next;
+
+ for (chunk = chunks; chunk; chunk = next) {
+ next = chunk->next;
+ free(chunk);
+ }
+ chunks = 0;
+ freeFinalSpans = 0;
+ free(finalSpans);
+ finalSpans = 0;
}
static void
-fillSpans (
- DrawablePtr pDrawable,
- GCPtr pGC)
+fillSpans(DrawablePtr pDrawable, GCPtr pGC)
{
- struct finalSpan *span;
- DDXPointPtr xSpan;
- int *xWidth;
- int i;
- struct finalSpan **f;
- int spany;
- DDXPointPtr xSpans;
- int *xWidths;
-
- if (nspans == 0)
- return;
- xSpan = xSpans = malloc(nspans * sizeof (DDXPointRec));
- xWidth = xWidths = malloc(nspans * sizeof (int));
- if (xSpans && xWidths)
- {
- i = 0;
- f = finalSpans;
- for (spany = finalMiny; spany <= finalMaxy; spany++, f++) {
- for (span = *f; span; span=span->next) {
- if (span->max <= span->min)
- continue;
- xSpan->x = span->min;
- xSpan->y = spany;
- ++xSpan;
- *xWidth++ = span->max - span->min;
- ++i;
- }
- }
- (*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE);
- }
- disposeFinalSpans ();
- free(xSpans);
- free(xWidths);
- finalMiny = 0;
- finalMaxy = -1;
- finalSize = 0;
- nspans = 0;
+ struct finalSpan *span;
+ DDXPointPtr xSpan;
+ int *xWidth;
+ int i;
+ struct finalSpan **f;
+ int spany;
+ DDXPointPtr xSpans;
+ int *xWidths;
+
+ if (nspans == 0)
+ return;
+ xSpan = xSpans = malloc(nspans * sizeof(DDXPointRec));
+ xWidth = xWidths = malloc(nspans * sizeof(int));
+ if (xSpans && xWidths) {
+ i = 0;
+ f = finalSpans;
+ for (spany = finalMiny; spany <= finalMaxy; spany++, f++) {
+ for (span = *f; span; span = span->next) {
+ if (span->max <= span->min)
+ continue;
+ xSpan->x = span->min;
+ xSpan->y = spany;
+ ++xSpan;
+ *xWidth++ = span->max - span->min;
+ ++i;
+ }
+ }
+ (*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE);
+ }
+ disposeFinalSpans();
+ free(xSpans);
+ free(xWidths);
+ finalMiny = 0;
+ finalMaxy = -1;
+ finalSize = 0;
+ nspans = 0;
}
-# define SPAN_REALLOC 100
+#define SPAN_REALLOC 100
-# define findSpan(y) ((finalMiny <= (y) && (y) <= finalMaxy) ? \
+#define findSpan(y) ((finalMiny <= (y) && (y) <= finalMaxy) ? \
&finalSpans[(y) - finalMiny] : \
realFindSpan (y))
static struct finalSpan **
-realFindSpan (int y)
+realFindSpan(int y)
{
- struct finalSpan **newSpans;
- int newSize, newMiny, newMaxy;
- int change;
- int i;
-
- if (y < finalMiny || y > finalMaxy) {
- if (!finalSize) {
- finalMiny = y;
- finalMaxy = y - 1;
- }
- if (y < finalMiny)
- change = finalMiny - y;
- else
- change = y - finalMaxy;
- if (change >= SPAN_REALLOC)
- change += SPAN_REALLOC;
- else
- change = SPAN_REALLOC;
- newSize = finalSize + change;
- newSpans = malloc(newSize * sizeof (struct finalSpan *));
- if (!newSpans)
- return NULL;
- newMiny = finalMiny;
- newMaxy = finalMaxy;
- if (y < finalMiny)
- newMiny = finalMiny - change;
- else
- newMaxy = finalMaxy + change;
- if (finalSpans) {
- memmove(((char *) newSpans) + (finalMiny-newMiny) * sizeof (struct finalSpan *),
- (char *) finalSpans,
- finalSize * sizeof (struct finalSpan *));
- free(finalSpans);
- }
- if ((i = finalMiny - newMiny) > 0)
- memset((char *)newSpans, 0, i * sizeof (struct finalSpan *));
- if ((i = newMaxy - finalMaxy) > 0)
- memset((char *)(newSpans + newSize - i), 0,
- i * sizeof (struct finalSpan *));
- finalSpans = newSpans;
- finalMaxy = newMaxy;
- finalMiny = newMiny;
- finalSize = newSize;
- }
- return &finalSpans[y - finalMiny];
+ struct finalSpan **newSpans;
+ int newSize, newMiny, newMaxy;
+ int change;
+ int i;
+
+ if (y < finalMiny || y > finalMaxy) {
+ if (!finalSize) {
+ finalMiny = y;
+ finalMaxy = y - 1;
+ }
+ if (y < finalMiny)
+ change = finalMiny - y;
+ else
+ change = y - finalMaxy;
+ if (change >= SPAN_REALLOC)
+ change += SPAN_REALLOC;
+ else
+ change = SPAN_REALLOC;
+ newSize = finalSize + change;
+ newSpans = malloc(newSize * sizeof(struct finalSpan *));
+ if (!newSpans)
+ return NULL;
+ newMiny = finalMiny;
+ newMaxy = finalMaxy;
+ if (y < finalMiny)
+ newMiny = finalMiny - change;
+ else
+ newMaxy = finalMaxy + change;
+ if (finalSpans) {
+ memmove(((char *) newSpans) +
+ (finalMiny - newMiny) * sizeof(struct finalSpan *),
+ (char *) finalSpans,
+ finalSize * sizeof(struct finalSpan *));
+ free(finalSpans);
+ }
+ if ((i = finalMiny - newMiny) > 0)
+ memset((char *) newSpans, 0, i * sizeof(struct finalSpan *));
+ if ((i = newMaxy - finalMaxy) > 0)
+ memset((char *) (newSpans + newSize - i), 0,
+ i * sizeof(struct finalSpan *));
+ finalSpans = newSpans;
+ finalMaxy = newMaxy;
+ finalMiny = newMiny;
+ finalSize = newSize;
+ }
+ return &finalSpans[y - finalMiny];
}
static void
-newFinalSpan (
- int y,
- int xmin,
- int xmax)
+newFinalSpan(int y, int xmin, int xmax)
{
- struct finalSpan *x;
- struct finalSpan **f;
- struct finalSpan *oldx;
- struct finalSpan *prev;
-
- f = findSpan (y);
- if (!f)
- return;
- oldx = 0;
- for (;;) {
- prev = 0;
- for (x = *f; x; x=x->next) {
- if (x == oldx) {
- prev = x;
- continue;
- }
- if (x->min <= xmax && xmin <= x->max) {
- if (oldx) {
- oldx->min = min (x->min, xmin);
- oldx->max = max (x->max, xmax);
- if (prev)
- prev->next = x->next;
- else
- *f = x->next;
- --nspans;
- } else {
- x->min = min (x->min, xmin);
- x->max = max (x->max, xmax);
- oldx = x;
- }
- xmin = oldx->min;
- xmax = oldx->max;
- break;
- }
- prev = x;
- }
- if (!x)
- break;
- }
- if (!oldx) {
- x = allocFinalSpan ();
- if (x)
- {
- x->min = xmin;
- x->max = xmax;
- x->next = *f;
- *f = x;
- ++nspans;
- }
- }
+ struct finalSpan *x;
+ struct finalSpan **f;
+ struct finalSpan *oldx;
+ struct finalSpan *prev;
+
+ f = findSpan(y);
+ if (!f)
+ return;
+ oldx = 0;
+ for (;;) {
+ prev = 0;
+ for (x = *f; x; x = x->next) {
+ if (x == oldx) {
+ prev = x;
+ continue;
+ }
+ if (x->min <= xmax && xmin <= x->max) {
+ if (oldx) {
+ oldx->min = min(x->min, xmin);
+ oldx->max = max(x->max, xmax);
+ if (prev)
+ prev->next = x->next;
+ else
+ *f = x->next;
+ --nspans;
+ }
+ else {
+ x->min = min(x->min, xmin);
+ x->max = max(x->max, xmax);
+ oldx = x;
+ }
+ xmin = oldx->min;
+ xmax = oldx->max;
+ break;
+ }
+ prev = x;
+ }
+ if (!x)
+ break;
+ }
+ if (!oldx) {
+ x = allocFinalSpan();
+ if (x) {
+ x->min = xmin;
+ x->max = xmax;
+ x->next = *f;
+ *f = x;
+ ++nspans;
+ }
+ }
}
static void
-mirrorSppPoint (
- int quadrant,
- SppPointPtr sppPoint)
+mirrorSppPoint(int quadrant, SppPointPtr sppPoint)
{
- switch (quadrant) {
- case 0:
- break;
- case 1:
- sppPoint->x = -sppPoint->x;
- break;
- case 2:
- sppPoint->x = -sppPoint->x;
- sppPoint->y = -sppPoint->y;
- break;
- case 3:
- sppPoint->y = -sppPoint->y;
- break;
- }
- /*
- * and translate to X coordinate system
- */
- sppPoint->y = -sppPoint->y;
+ switch (quadrant) {
+ case 0:
+ break;
+ case 1:
+ sppPoint->x = -sppPoint->x;
+ break;
+ case 2:
+ sppPoint->x = -sppPoint->x;
+ sppPoint->y = -sppPoint->y;
+ break;
+ case 3:
+ sppPoint->y = -sppPoint->y;
+ break;
+ }
+ /*
+ * and translate to X coordinate system
+ */
+ sppPoint->y = -sppPoint->y;
}
/*
@@ -3241,350 +3066,337 @@ mirrorSppPoint (
*/
static void
-drawArc (
- xArc *tarc,
- int l,
- int a0,
- int a1,
- miArcFacePtr right,
- miArcFacePtr left) /* save end line points */
-{
- struct arc_def def;
- struct accelerators acc;
- int startq, endq, curq;
- int rightq, leftq = 0, righta = 0, lefta = 0;
- miArcFacePtr passRight, passLeft;
- int q0 = 0, q1 = 0, mask;
- struct band {
- int a0, a1;
- int mask;
- } band[5], sweep[20];
- int bandno, sweepno;
- int i, j;
- int flipRight = 0, flipLeft = 0;
- int copyEnd = 0;
- miArcSpanData *spdata;
-
- spdata = miComputeWideEllipse(l, tarc);
- if (!spdata)
- return;
-
- if (a1 < a0)
- a1 += 360 * 64;
- startq = a0 / (90 * 64);
- if (a0 == a1)
- endq = startq;
- else
- endq = (a1-1) / (90 * 64);
- bandno = 0;
- curq = startq;
- rightq = -1;
- for (;;) {
- switch (curq) {
- case 0:
- if (a0 > 90 * 64)
- q0 = 0;
- else
- q0 = a0;
- if (a1 < 360 * 64)
- q1 = min (a1, 90 * 64);
- else
- q1 = 90 * 64;
- if (curq == startq && a0 == q0 && rightq < 0) {
- righta = q0;
- rightq = curq;
- }
- if (curq == endq && a1 == q1) {
- lefta = q1;
- leftq = curq;
- }
- break;
- case 1:
- if (a1 < 90 * 64)
- q0 = 0;
- else
- q0 = 180 * 64 - min (a1, 180 * 64);
- if (a0 > 180 * 64)
- q1 = 90 * 64;
- else
- q1 = 180 * 64 - max (a0, 90 * 64);
- if (curq == startq && 180 * 64 - a0 == q1) {
- righta = q1;
- rightq = curq;
- }
- if (curq == endq && 180 * 64 - a1 == q0) {
- lefta = q0;
- leftq = curq;
- }
- break;
- case 2:
- if (a0 > 270 * 64)
- q0 = 0;
- else
- q0 = max (a0, 180 * 64) - 180 * 64;
- if (a1 < 180 * 64)
- q1 = 90 * 64;
- else
- q1 = min (a1, 270 * 64) - 180 * 64;
- if (curq == startq && a0 - 180*64 == q0) {
- righta = q0;
- rightq = curq;
- }
- if (curq == endq && a1 - 180 * 64 == q1) {
- lefta = q1;
- leftq = curq;
- }
- break;
- case 3:
- if (a1 < 270 * 64)
- q0 = 0;
- else
- q0 = 360 * 64 - min (a1, 360 * 64);
- q1 = 360 * 64 - max (a0, 270 * 64);
- if (curq == startq && 360 * 64 - a0 == q1) {
- righta = q1;
- rightq = curq;
- }
- if (curq == endq && 360 * 64 - a1 == q0) {
- lefta = q0;
- leftq = curq;
- }
- break;
- }
- band[bandno].a0 = q0;
- band[bandno].a1 = q1;
- band[bandno].mask = 1 << curq;
- bandno++;
- if (curq == endq)
- break;
- curq++;
- if (curq == 4) {
- a0 = 0;
- a1 -= 360 * 64;
- curq = 0;
- endq -= 4;
- }
- }
- sweepno = 0;
- for (;;) {
- q0 = 90 * 64;
- mask = 0;
- /*
- * find left-most point
- */
- for (i = 0; i < bandno; i++)
- if (band[i].a0 <= q0) {
- q0 = band[i].a0;
- q1 = band[i].a1;
- mask = band[i].mask;
- }
- if (!mask)
- break;
- /*
- * locate next point of change
- */
- for (i = 0; i < bandno; i++)
- if (!(mask & band[i].mask)) {
- if (band[i].a0 == q0) {
- if (band[i].a1 < q1)
- q1 = band[i].a1;
- mask |= band[i].mask;
- } else if (band[i].a0 < q1)
- q1 = band[i].a0;
- }
- /*
- * create a new sweep
- */
- sweep[sweepno].a0 = q0;
- sweep[sweepno].a1 = q1;
- sweep[sweepno].mask = mask;
- sweepno++;
- /*
- * subtract the sweep from the affected bands
- */
- for (i = 0; i < bandno; i++)
- if (band[i].a0 == q0) {
- band[i].a0 = q1;
- /*
- * check if this band is empty
- */
- if (band[i].a0 == band[i].a1)
- band[i].a1 = band[i].a0 = 90 * 64 + 1;
- }
- }
- computeAcc (tarc, l, &def, &acc);
- for (j = 0; j < sweepno; j++) {
- mask = sweep[j].mask;
- passRight = passLeft = 0;
- if (mask & (1 << rightq)) {
- if (sweep[j].a0 == righta)
- passRight = right;
- else if (sweep[j].a1 == righta) {
- passLeft = right;
- flipRight = 1;
- }
- }
- if (mask & (1 << leftq)) {
- if (sweep[j].a1 == lefta)
- {
- if (passLeft)
- copyEnd = 1;
- passLeft = left;
- }
- else if (sweep[j].a0 == lefta) {
- if (passRight)
- copyEnd = 1;
- passRight = left;
- flipLeft = 1;
- }
- }
- drawQuadrant (&def, &acc, sweep[j].a0, sweep[j].a1, mask,
- passRight, passLeft, spdata);
- }
- /*
- * when copyEnd is set, both ends of the arc were computed
- * at the same time; drawQuadrant only takes one end though,
- * so the left end will be the only one holding the data. Copy
- * it from there.
- */
- if (copyEnd)
- *right = *left;
- /*
- * mirror the coordinates generated for the
- * faces of the arc
- */
- if (right) {
- mirrorSppPoint (rightq, &right->clock);
- mirrorSppPoint (rightq, &right->center);
- mirrorSppPoint (rightq, &right->counterClock);
- if (flipRight) {
- SppPointRec temp;
-
- temp = right->clock;
- right->clock = right->counterClock;
- right->counterClock = temp;
- }
- }
- if (left) {
- mirrorSppPoint (leftq, &left->counterClock);
- mirrorSppPoint (leftq, &left->center);
- mirrorSppPoint (leftq, &left->clock);
- if (flipLeft) {
- SppPointRec temp;
-
- temp = left->clock;
- left->clock = left->counterClock;
- left->counterClock = temp;
- }
- }
- free(spdata);
+drawArc(xArc * tarc,
+ int l, int a0, int a1, miArcFacePtr right, miArcFacePtr left)
+{ /* save end line points */
+ struct arc_def def;
+ struct accelerators acc;
+ int startq, endq, curq;
+ int rightq, leftq = 0, righta = 0, lefta = 0;
+ miArcFacePtr passRight, passLeft;
+ int q0 = 0, q1 = 0, mask;
+ struct band {
+ int a0, a1;
+ int mask;
+ } band[5], sweep[20];
+ int bandno, sweepno;
+ int i, j;
+ int flipRight = 0, flipLeft = 0;
+ int copyEnd = 0;
+ miArcSpanData *spdata;
+
+ spdata = miComputeWideEllipse(l, tarc);
+ if (!spdata)
+ return;
+
+ if (a1 < a0)
+ a1 += 360 * 64;
+ startq = a0 / (90 * 64);
+ if (a0 == a1)
+ endq = startq;
+ else
+ endq = (a1 - 1) / (90 * 64);
+ bandno = 0;
+ curq = startq;
+ rightq = -1;
+ for (;;) {
+ switch (curq) {
+ case 0:
+ if (a0 > 90 * 64)
+ q0 = 0;
+ else
+ q0 = a0;
+ if (a1 < 360 * 64)
+ q1 = min(a1, 90 * 64);
+ else
+ q1 = 90 * 64;
+ if (curq == startq && a0 == q0 && rightq < 0) {
+ righta = q0;
+ rightq = curq;
+ }
+ if (curq == endq && a1 == q1) {
+ lefta = q1;
+ leftq = curq;
+ }
+ break;
+ case 1:
+ if (a1 < 90 * 64)
+ q0 = 0;
+ else
+ q0 = 180 * 64 - min(a1, 180 * 64);
+ if (a0 > 180 * 64)
+ q1 = 90 * 64;
+ else
+ q1 = 180 * 64 - max(a0, 90 * 64);
+ if (curq == startq && 180 * 64 - a0 == q1) {
+ righta = q1;
+ rightq = curq;
+ }
+ if (curq == endq && 180 * 64 - a1 == q0) {
+ lefta = q0;
+ leftq = curq;
+ }
+ break;
+ case 2:
+ if (a0 > 270 * 64)
+ q0 = 0;
+ else
+ q0 = max(a0, 180 * 64) - 180 * 64;
+ if (a1 < 180 * 64)
+ q1 = 90 * 64;
+ else
+ q1 = min(a1, 270 * 64) - 180 * 64;
+ if (curq == startq && a0 - 180 * 64 == q0) {
+ righta = q0;
+ rightq = curq;
+ }
+ if (curq == endq && a1 - 180 * 64 == q1) {
+ lefta = q1;
+ leftq = curq;
+ }
+ break;
+ case 3:
+ if (a1 < 270 * 64)
+ q0 = 0;
+ else
+ q0 = 360 * 64 - min(a1, 360 * 64);
+ q1 = 360 * 64 - max(a0, 270 * 64);
+ if (curq == startq && 360 * 64 - a0 == q1) {
+ righta = q1;
+ rightq = curq;
+ }
+ if (curq == endq && 360 * 64 - a1 == q0) {
+ lefta = q0;
+ leftq = curq;
+ }
+ break;
+ }
+ band[bandno].a0 = q0;
+ band[bandno].a1 = q1;
+ band[bandno].mask = 1 << curq;
+ bandno++;
+ if (curq == endq)
+ break;
+ curq++;
+ if (curq == 4) {
+ a0 = 0;
+ a1 -= 360 * 64;
+ curq = 0;
+ endq -= 4;
+ }
+ }
+ sweepno = 0;
+ for (;;) {
+ q0 = 90 * 64;
+ mask = 0;
+ /*
+ * find left-most point
+ */
+ for (i = 0; i < bandno; i++)
+ if (band[i].a0 <= q0) {
+ q0 = band[i].a0;
+ q1 = band[i].a1;
+ mask = band[i].mask;
+ }
+ if (!mask)
+ break;
+ /*
+ * locate next point of change
+ */
+ for (i = 0; i < bandno; i++)
+ if (!(mask & band[i].mask)) {
+ if (band[i].a0 == q0) {
+ if (band[i].a1 < q1)
+ q1 = band[i].a1;
+ mask |= band[i].mask;
+ }
+ else if (band[i].a0 < q1)
+ q1 = band[i].a0;
+ }
+ /*
+ * create a new sweep
+ */
+ sweep[sweepno].a0 = q0;
+ sweep[sweepno].a1 = q1;
+ sweep[sweepno].mask = mask;
+ sweepno++;
+ /*
+ * subtract the sweep from the affected bands
+ */
+ for (i = 0; i < bandno; i++)
+ if (band[i].a0 == q0) {
+ band[i].a0 = q1;
+ /*
+ * check if this band is empty
+ */
+ if (band[i].a0 == band[i].a1)
+ band[i].a1 = band[i].a0 = 90 * 64 + 1;
+ }
+ }
+ computeAcc(tarc, l, &def, &acc);
+ for (j = 0; j < sweepno; j++) {
+ mask = sweep[j].mask;
+ passRight = passLeft = 0;
+ if (mask & (1 << rightq)) {
+ if (sweep[j].a0 == righta)
+ passRight = right;
+ else if (sweep[j].a1 == righta) {
+ passLeft = right;
+ flipRight = 1;
+ }
+ }
+ if (mask & (1 << leftq)) {
+ if (sweep[j].a1 == lefta) {
+ if (passLeft)
+ copyEnd = 1;
+ passLeft = left;
+ }
+ else if (sweep[j].a0 == lefta) {
+ if (passRight)
+ copyEnd = 1;
+ passRight = left;
+ flipLeft = 1;
+ }
+ }
+ drawQuadrant(&def, &acc, sweep[j].a0, sweep[j].a1, mask,
+ passRight, passLeft, spdata);
+ }
+ /*
+ * when copyEnd is set, both ends of the arc were computed
+ * at the same time; drawQuadrant only takes one end though,
+ * so the left end will be the only one holding the data. Copy
+ * it from there.
+ */
+ if (copyEnd)
+ *right = *left;
+ /*
+ * mirror the coordinates generated for the
+ * faces of the arc
+ */
+ if (right) {
+ mirrorSppPoint(rightq, &right->clock);
+ mirrorSppPoint(rightq, &right->center);
+ mirrorSppPoint(rightq, &right->counterClock);
+ if (flipRight) {
+ SppPointRec temp;
+
+ temp = right->clock;
+ right->clock = right->counterClock;
+ right->counterClock = temp;
+ }
+ }
+ if (left) {
+ mirrorSppPoint(leftq, &left->counterClock);
+ mirrorSppPoint(leftq, &left->center);
+ mirrorSppPoint(leftq, &left->clock);
+ if (flipLeft) {
+ SppPointRec temp;
+
+ temp = left->clock;
+ left->clock = left->counterClock;
+ left->counterClock = temp;
+ }
+ }
+ free(spdata);
}
static void
-drawQuadrant (
- struct arc_def *def,
- struct accelerators *acc,
- int a0,
- int a1,
- int mask,
- miArcFacePtr right,
- miArcFacePtr left,
- miArcSpanData *spdata)
+drawQuadrant(struct arc_def *def,
+ struct accelerators *acc,
+ int a0,
+ int a1,
+ int mask,
+ miArcFacePtr right, miArcFacePtr left, miArcSpanData * spdata)
{
- struct arc_bound bound;
- double yy, x, xalt;
- int y, miny, maxy;
- int n;
- miArcSpan *span;
-
- def->a0 = ((double) a0) / 64.0;
- def->a1 = ((double) a1) / 64.0;
- computeBound (def, &bound, acc, right, left);
- yy = bound.inner.min;
- if (bound.outer.min < yy)
- yy = bound.outer.min;
- miny = ICEIL(yy - acc->fromIntY);
- yy = bound.inner.max;
- if (bound.outer.max > yy)
- yy = bound.outer.max;
- maxy = floor(yy - acc->fromIntY);
- y = spdata->k;
- span = spdata->spans;
- if (spdata->top)
- {
- if (a1 == 90 * 64 && (mask & 1))
- newFinalSpan (acc->yorgu - y - 1, acc->xorg, acc->xorg + 1);
- span++;
- }
- for (n = spdata->count1; --n >= 0; )
- {
- if (y < miny)
- return;
- if (y <= maxy) {
- arcSpan (y,
- span->lx, -span->lx, 0, span->lx + span->lw,
- def, &bound, acc, mask);
- if (span->rw + span->rx)
- tailSpan (y, -span->rw, -span->rx, def, &bound, acc, mask);
- }
- y--;
- span++;
- }
- if (y < miny)
- return;
- if (spdata->hole)
- {
- if (y <= maxy)
- arcSpan (y, 0, 0, 0, 1, def, &bound, acc, mask & 0xc);
- }
- for (n = spdata->count2; --n >= 0; )
- {
- if (y < miny)
- return;
- if (y <= maxy)
- arcSpan (y, span->lx, span->lw, span->rx, span->rw,
- def, &bound, acc, mask);
- y--;
- span++;
- }
- if (spdata->bot && miny <= y && y <= maxy)
- {
- n = mask;
- if (y == miny)
- n &= 0xc;
- if (span->rw <= 0) {
- arcSpan0 (span->lx, -span->lx, 0, span->lx + span->lw,
- def, &bound, acc, n);
- if (span->rw + span->rx)
- tailSpan (y, -span->rw, -span->rx, def, &bound, acc, n);
- }
- else
- arcSpan0 (span->lx, span->lw, span->rx, span->rw,
- def, &bound, acc, n);
- y--;
- }
- while (y >= miny) {
- yy = y + acc->fromIntY;
- if (def->w == def->h) {
- xalt = def->w - def->l;
- x = -sqrt(xalt * xalt - yy * yy);
- } else {
- x = tailX(yy, def, &bound, acc);
- if (acc->left.valid && boundedLe (yy, bound.left)) {
- xalt = intersectLine (yy, acc->left);
- if (xalt < x)
- x = xalt;
- }
- if (acc->right.valid && boundedLe (yy, bound.right)) {
- xalt = intersectLine (yy, acc->right);
- if (xalt < x)
- x = xalt;
- }
- }
- arcSpan (y,
- ICEIL(acc->fromIntX - x), 0,
- ICEIL(acc->fromIntX + x), 0,
- def, &bound, acc, mask);
- y--;
- }
+ struct arc_bound bound;
+ double yy, x, xalt;
+ int y, miny, maxy;
+ int n;
+ miArcSpan *span;
+
+ def->a0 = ((double) a0) / 64.0;
+ def->a1 = ((double) a1) / 64.0;
+ computeBound(def, &bound, acc, right, left);
+ yy = bound.inner.min;
+ if (bound.outer.min < yy)
+ yy = bound.outer.min;
+ miny = ICEIL(yy - acc->fromIntY);
+ yy = bound.inner.max;
+ if (bound.outer.max > yy)
+ yy = bound.outer.max;
+ maxy = floor(yy - acc->fromIntY);
+ y = spdata->k;
+ span = spdata->spans;
+ if (spdata->top) {
+ if (a1 == 90 * 64 && (mask & 1))
+ newFinalSpan(acc->yorgu - y - 1, acc->xorg, acc->xorg + 1);
+ span++;
+ }
+ for (n = spdata->count1; --n >= 0;) {
+ if (y < miny)
+ return;
+ if (y <= maxy) {
+ arcSpan(y,
+ span->lx, -span->lx, 0, span->lx + span->lw,
+ def, &bound, acc, mask);
+ if (span->rw + span->rx)
+ tailSpan(y, -span->rw, -span->rx, def, &bound, acc, mask);
+ }
+ y--;
+ span++;
+ }
+ if (y < miny)
+ return;
+ if (spdata->hole) {
+ if (y <= maxy)
+ arcSpan(y, 0, 0, 0, 1, def, &bound, acc, mask & 0xc);
+ }
+ for (n = spdata->count2; --n >= 0;) {
+ if (y < miny)
+ return;
+ if (y <= maxy)
+ arcSpan(y, span->lx, span->lw, span->rx, span->rw,
+ def, &bound, acc, mask);
+ y--;
+ span++;
+ }
+ if (spdata->bot && miny <= y && y <= maxy) {
+ n = mask;
+ if (y == miny)
+ n &= 0xc;
+ if (span->rw <= 0) {
+ arcSpan0(span->lx, -span->lx, 0, span->lx + span->lw,
+ def, &bound, acc, n);
+ if (span->rw + span->rx)
+ tailSpan(y, -span->rw, -span->rx, def, &bound, acc, n);
+ }
+ else
+ arcSpan0(span->lx, span->lw, span->rx, span->rw,
+ def, &bound, acc, n);
+ y--;
+ }
+ while (y >= miny) {
+ yy = y + acc->fromIntY;
+ if (def->w == def->h) {
+ xalt = def->w - def->l;
+ x = -sqrt(xalt * xalt - yy * yy);
+ }
+ else {
+ x = tailX(yy, def, &bound, acc);
+ if (acc->left.valid && boundedLe(yy, bound.left)) {
+ xalt = intersectLine(yy, acc->left);
+ if (xalt < x)
+ x = xalt;
+ }
+ if (acc->right.valid && boundedLe(yy, bound.right)) {
+ xalt = intersectLine(yy, acc->right);
+ if (xalt < x)
+ x = xalt;
+ }
+ }
+ arcSpan(y,
+ ICEIL(acc->fromIntX - x), 0,
+ ICEIL(acc->fromIntX + x), 0, def, &bound, acc, mask);
+ y--;
+ }
}
diff --git a/xorg-server/mi/mibitblt.c b/xorg-server/mi/mibitblt.c
index fc6eb8d6e..b9873c16d 100644
--- a/xorg-server/mi/mibitblt.c
+++ b/xorg-server/mi/mibitblt.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -74,73 +73,67 @@ extern int ffs(int);
* We let SetSpans worry about clipping to the destination.
*/
RegionPtr
-miCopyArea(DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut)
+miCopyArea(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut)
{
- DDXPointPtr ppt, pptFirst;
- unsigned int *pwidthFirst, *pwidth, *pbits;
- BoxRec srcBox, *prect;
- /* may be a new region, or just a copy */
- RegionPtr prgnSrcClip;
- /* non-0 if we've created a src clip */
- RegionPtr prgnExposed;
- int realSrcClip = 0;
- int srcx, srcy, dstx, dsty, i, j, y, width, height,
- xMin, xMax, yMin, yMax;
- unsigned int *ordering;
- int numRects;
- BoxPtr boxes;
+ DDXPointPtr ppt, pptFirst;
+ unsigned int *pwidthFirst, *pwidth, *pbits;
+ BoxRec srcBox, *prect;
+
+ /* may be a new region, or just a copy */
+ RegionPtr prgnSrcClip;
+
+ /* non-0 if we've created a src clip */
+ RegionPtr prgnExposed;
+ int realSrcClip = 0;
+ int srcx, srcy, dstx, dsty, i, j, y, width, height, xMin, xMax, yMin, yMax;
+ unsigned int *ordering;
+ int numRects;
+ BoxPtr boxes;
srcx = xIn + pSrcDrawable->x;
srcy = yIn + pSrcDrawable->y;
/* If the destination isn't realized, this is easy */
if (pDstDrawable->type == DRAWABLE_WINDOW &&
- !((WindowPtr)pDstDrawable)->realized)
- return NULL;
+ !((WindowPtr) pDstDrawable)->realized)
+ return NULL;
/* clip the source */
- if (pSrcDrawable->type == DRAWABLE_PIXMAP)
- {
- BoxRec box;
+ if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
+ BoxRec box;
- box.x1 = pSrcDrawable->x;
- box.y1 = pSrcDrawable->y;
- box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
- box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
+ box.x1 = pSrcDrawable->x;
+ box.y1 = pSrcDrawable->y;
+ box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
+ box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
- prgnSrcClip = RegionCreate(&box, 1);
- realSrcClip = 1;
+ prgnSrcClip = RegionCreate(&box, 1);
+ realSrcClip = 1;
}
- else
- {
- if (pGC->subWindowMode == IncludeInferiors) {
- prgnSrcClip = NotClippedByChildren ((WindowPtr) pSrcDrawable);
- realSrcClip = 1;
- } else
- prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
+ else {
+ if (pGC->subWindowMode == IncludeInferiors) {
+ prgnSrcClip = NotClippedByChildren((WindowPtr) pSrcDrawable);
+ realSrcClip = 1;
+ }
+ else
+ prgnSrcClip = &((WindowPtr) pSrcDrawable)->clipList;
}
/* If the src drawable is a window, we need to translate the srcBox so
* that we can compare it with the window's clip region later on. */
srcBox.x1 = srcx;
srcBox.y1 = srcy;
- srcBox.x2 = srcx + widthSrc;
- srcBox.y2 = srcy + heightSrc;
+ srcBox.x2 = srcx + widthSrc;
+ srcBox.y2 = srcy + heightSrc;
dstx = xOut;
dsty = yOut;
- if (pGC->miTranslate)
- {
- dstx += pDstDrawable->x;
- dsty += pDstDrawable->y;
+ if (pGC->miTranslate) {
+ dstx += pDstDrawable->x;
+ dsty += pDstDrawable->y;
}
pptFirst = ppt = malloc(heightSrc * sizeof(DDXPointRec));
@@ -148,116 +141,112 @@ miCopyArea(DrawablePtr pSrcDrawable,
numRects = RegionNumRects(prgnSrcClip);
boxes = RegionRects(prgnSrcClip);
ordering = malloc(numRects * sizeof(unsigned int));
- if(!pptFirst || !pwidthFirst || !ordering)
- {
- free(ordering);
- free(pwidthFirst);
- free(pptFirst);
- return NULL;
+ if (!pptFirst || !pwidthFirst || !ordering) {
+ free(ordering);
+ free(pwidthFirst);
+ free(pptFirst);
+ return NULL;
}
/* If not the same drawable then order of move doesn't matter.
Following assumes that boxes are sorted from top
to bottom and left to right.
- */
+ */
if ((pSrcDrawable != pDstDrawable) &&
- ((pGC->subWindowMode != IncludeInferiors) ||
- (pSrcDrawable->type == DRAWABLE_PIXMAP) ||
- (pDstDrawable->type == DRAWABLE_PIXMAP)))
- for (i=0; i < numRects; i++)
- ordering[i] = i;
- else { /* within same drawable, must sequence moves carefully! */
- if (dsty <= srcBox.y1) { /* Scroll up or stationary vertical.
- Vertical order OK */
- if (dstx <= srcBox.x1) /* Scroll left or stationary horizontal.
- Horizontal order OK as well */
- for (i=0; i < numRects; i++)
+ ((pGC->subWindowMode != IncludeInferiors) ||
+ (pSrcDrawable->type == DRAWABLE_PIXMAP) ||
+ (pDstDrawable->type == DRAWABLE_PIXMAP)))
+ for (i = 0; i < numRects; i++)
ordering[i] = i;
- else { /* scroll right. must reverse horizontal banding of rects. */
- for (i=0, j=1, xMax=0; i < numRects; j=i+1, xMax=i) {
- /* find extent of current horizontal band */
- y=boxes[i].y1; /* band has this y coordinate */
- while ((j < numRects) && (boxes[j].y1 == y))
- j++;
- /* reverse the horizontal band in the output ordering */
- for (j-- ; j >= xMax; j--, i++)
- ordering[i] = j;
- }
+ else { /* within same drawable, must sequence moves carefully! */
+ if (dsty <= srcBox.y1) { /* Scroll up or stationary vertical.
+ Vertical order OK */
+ if (dstx <= srcBox.x1) /* Scroll left or stationary horizontal.
+ Horizontal order OK as well */
+ for (i = 0; i < numRects; i++)
+ ordering[i] = i;
+ else { /* scroll right. must reverse horizontal banding of rects. */
+ for (i = 0, j = 1, xMax = 0; i < numRects; j = i + 1, xMax = i) {
+ /* find extent of current horizontal band */
+ y = boxes[i].y1; /* band has this y coordinate */
+ while ((j < numRects) && (boxes[j].y1 == y))
+ j++;
+ /* reverse the horizontal band in the output ordering */
+ for (j--; j >= xMax; j--, i++)
+ ordering[i] = j;
+ }
+ }
}
- }
- else { /* Scroll down. Must reverse vertical banding. */
- if (dstx < srcBox.x1) { /* Scroll left. Horizontal order OK. */
- for (i=numRects-1, j=i-1, yMin=i, yMax=0;
- i >= 0;
- j=i-1, yMin=i) {
- /* find extent of current horizontal band */
- y=boxes[i].y1; /* band has this y coordinate */
- while ((j >= 0) && (boxes[j].y1 == y))
- j--;
- /* reverse the horizontal band in the output ordering */
- for (j++ ; j <= yMin; j++, i--, yMax++)
- ordering[yMax] = j;
- }
+ else { /* Scroll down. Must reverse vertical banding. */
+ if (dstx < srcBox.x1) { /* Scroll left. Horizontal order OK. */
+ for (i = numRects - 1, j = i - 1, yMin = i, yMax = 0;
+ i >= 0; j = i - 1, yMin = i) {
+ /* find extent of current horizontal band */
+ y = boxes[i].y1; /* band has this y coordinate */
+ while ((j >= 0) && (boxes[j].y1 == y))
+ j--;
+ /* reverse the horizontal band in the output ordering */
+ for (j++; j <= yMin; j++, i--, yMax++)
+ ordering[yMax] = j;
+ }
+ }
+ else /* Scroll right or horizontal stationary.
+ Reverse horizontal order as well (if stationary, horizontal
+ order can be swapped without penalty and this is faster
+ to compute). */
+ for (i = 0, j = numRects - 1; i < numRects; i++, j--)
+ ordering[i] = j;
}
- else /* Scroll right or horizontal stationary.
- Reverse horizontal order as well (if stationary, horizontal
- order can be swapped without penalty and this is faster
- to compute). */
- for (i=0, j=numRects-1; i < numRects; i++, j--)
- ordering[i] = j;
- }
}
-
- for(i = 0; i < numRects; i++)
- {
+
+ for (i = 0; i < numRects; i++) {
prect = &boxes[ordering[i]];
- xMin = max(prect->x1, srcBox.x1);
- xMax = min(prect->x2, srcBox.x2);
- yMin = max(prect->y1, srcBox.y1);
- yMax = min(prect->y2, srcBox.y2);
- /* is there anything visible here? */
- if(xMax <= xMin || yMax <= yMin)
- continue;
+ xMin = max(prect->x1, srcBox.x1);
+ xMax = min(prect->x2, srcBox.x2);
+ yMin = max(prect->y1, srcBox.y1);
+ yMax = min(prect->y2, srcBox.y2);
+ /* is there anything visible here? */
+ if (xMax <= xMin || yMax <= yMin)
+ continue;
ppt = pptFirst;
- pwidth = pwidthFirst;
- y = yMin;
- height = yMax - yMin;
- width = xMax - xMin;
-
- for(j = 0; j < height; j++)
- {
- /* We must untranslate before calling GetSpans */
- ppt->x = xMin;
- ppt++->y = y++;
- *pwidth++ = width;
- }
- pbits = malloc(height * PixmapBytePad(width, pSrcDrawable->depth));
- if (pbits)
- {
- (*pSrcDrawable->pScreen->GetSpans)(pSrcDrawable, width, pptFirst,
- (int *)pwidthFirst, height, (char *)pbits);
- ppt = pptFirst;
- pwidth = pwidthFirst;
- xMin -= (srcx - dstx);
- y = yMin - (srcy - dsty);
- for(j = 0; j < height; j++)
- {
- ppt->x = xMin;
- ppt++->y = y++;
- *pwidth++ = width;
- }
-
- (*pGC->ops->SetSpans)(pDstDrawable, pGC, (char *)pbits, pptFirst,
- (int *)pwidthFirst, height, TRUE);
- free(pbits);
- }
+ pwidth = pwidthFirst;
+ y = yMin;
+ height = yMax - yMin;
+ width = xMax - xMin;
+
+ for (j = 0; j < height; j++) {
+ /* We must untranslate before calling GetSpans */
+ ppt->x = xMin;
+ ppt++->y = y++;
+ *pwidth++ = width;
+ }
+ pbits = malloc(height * PixmapBytePad(width, pSrcDrawable->depth));
+ if (pbits) {
+ (*pSrcDrawable->pScreen->GetSpans) (pSrcDrawable, width, pptFirst,
+ (int *) pwidthFirst, height,
+ (char *) pbits);
+ ppt = pptFirst;
+ pwidth = pwidthFirst;
+ xMin -= (srcx - dstx);
+ y = yMin - (srcy - dsty);
+ for (j = 0; j < height; j++) {
+ ppt->x = xMin;
+ ppt++->y = y++;
+ *pwidth++ = width;
+ }
+
+ (*pGC->ops->SetSpans) (pDstDrawable, pGC, (char *) pbits, pptFirst,
+ (int *) pwidthFirst, height, TRUE);
+ free(pbits);
+ }
}
prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
- widthSrc, heightSrc, xOut, yOut, (unsigned long)0);
- if(realSrcClip)
- RegionDestroy(prgnSrcClip);
-
+ widthSrc, heightSrc, xOut, yOut,
+ (unsigned long) 0);
+ if (realSrcClip)
+ RegionDestroy(prgnSrcClip);
+
free(ordering);
free(pwidthFirst);
free(pptFirst);
@@ -274,21 +263,15 @@ miCopyArea(DrawablePtr pSrcDrawable,
* care about such things as scanline padding et alia.
*/
static
-MiBits *
-miGetPlane(
- DrawablePtr pDraw,
- int planeNum, /* number of the bitPlane */
- int sx,
- int sy,
- int w,
- int h,
- MiBits *result)
+MiBits *
+miGetPlane(DrawablePtr pDraw, int planeNum, /* number of the bitPlane */
+ int sx, int sy, int w, int h, MiBits * result)
{
- int i, j, k, width, bitsPerPixel, widthInBytes;
- DDXPointRec pt = {0, 0};
- MiBits pixel;
- MiBits bit;
- unsigned char *pCharsOut = NULL;
+ int i, j, k, width, bitsPerPixel, widthInBytes;
+ DDXPointRec pt = { 0, 0 };
+ MiBits pixel;
+ MiBits bit;
+ unsigned char *pCharsOut = NULL;
#if BITMAP_SCANLINE_UNIT == 8
#define OUT_TYPE unsigned char
@@ -303,81 +286,74 @@ miGetPlane(
#define OUT_TYPE CARD64
#endif
- OUT_TYPE *pOut;
- int delta = 0;
+ OUT_TYPE *pOut;
+ int delta = 0;
sx += pDraw->x;
sy += pDraw->y;
widthInBytes = BitmapBytePad(w);
- if(!result)
+ if (!result)
result = calloc(h, widthInBytes);
if (!result)
- return NULL;
+ return NULL;
bitsPerPixel = pDraw->bitsPerPixel;
pOut = (OUT_TYPE *) result;
- if(bitsPerPixel == 1)
- {
- pCharsOut = (unsigned char *) result;
- width = w;
+ if (bitsPerPixel == 1) {
+ pCharsOut = (unsigned char *) result;
+ width = w;
}
- else
- {
- delta = (widthInBytes / (BITMAP_SCANLINE_UNIT / 8)) -
- (w / BITMAP_SCANLINE_UNIT);
- width = 1;
+ else {
+ delta = (widthInBytes / (BITMAP_SCANLINE_UNIT / 8)) -
+ (w / BITMAP_SCANLINE_UNIT);
+ width = 1;
#if IMAGE_BYTE_ORDER == MSBFirst
- planeNum += (32 - bitsPerPixel);
+ planeNum += (32 - bitsPerPixel);
#endif
}
pt.y = sy;
- for (i = h; --i >= 0; pt.y++)
- {
- pt.x = sx;
- if(bitsPerPixel == 1)
- {
- (*pDraw->pScreen->GetSpans)(pDraw, width, &pt, &width, 1,
- (char *)pCharsOut);
- pCharsOut += widthInBytes;
- }
- else
- {
- k = 0;
- for(j = w; --j >= 0; pt.x++)
- {
- /* Fetch the next pixel */
- (*pDraw->pScreen->GetSpans)(pDraw, width, &pt, &width, 1,
- (char *)&pixel);
- /*
- * Now get the bit and insert into a bitmap in XY format.
- */
- bit = (pixel >> planeNum) & 1;
+ for (i = h; --i >= 0; pt.y++) {
+ pt.x = sx;
+ if (bitsPerPixel == 1) {
+ (*pDraw->pScreen->GetSpans) (pDraw, width, &pt, &width, 1,
+ (char *) pCharsOut);
+ pCharsOut += widthInBytes;
+ }
+ else {
+ k = 0;
+ for (j = w; --j >= 0; pt.x++) {
+ /* Fetch the next pixel */
+ (*pDraw->pScreen->GetSpans) (pDraw, width, &pt, &width, 1,
+ (char *) &pixel);
+ /*
+ * Now get the bit and insert into a bitmap in XY format.
+ */
+ bit = (pixel >> planeNum) & 1;
#if 0
- /* XXX assuming bit order == byte order */
+ /* XXX assuming bit order == byte order */
#if BITMAP_BIT_ORDER == LSBFirst
- bit <<= k;
+ bit <<= k;
#else
- bit <<= ((BITMAP_SCANLINE_UNIT - 1) - k);
+ bit <<= ((BITMAP_SCANLINE_UNIT - 1) - k);
#endif
#else
- /* XXX assuming byte order == LSBFirst */
- if (screenInfo.bitmapBitOrder == LSBFirst)
- bit <<= k;
- else
- bit <<= ((screenInfo.bitmapScanlineUnit - 1) -
- (k % screenInfo.bitmapScanlineUnit)) +
- ((k / screenInfo.bitmapScanlineUnit) *
- screenInfo.bitmapScanlineUnit);
+ /* XXX assuming byte order == LSBFirst */
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ bit <<= k;
+ else
+ bit <<= ((screenInfo.bitmapScanlineUnit - 1) -
+ (k % screenInfo.bitmapScanlineUnit)) +
+ ((k / screenInfo.bitmapScanlineUnit) *
+ screenInfo.bitmapScanlineUnit);
#endif
- *pOut |= (OUT_TYPE) bit;
- k++;
- if (k == BITMAP_SCANLINE_UNIT)
- {
- pOut++;
- k = 0;
- }
- }
- pOut += delta;
- }
+ *pOut |= (OUT_TYPE) bit;
+ k++;
+ if (k == BITMAP_SCANLINE_UNIT) {
+ pOut++;
+ k = 0;
+ }
+ }
+ pOut += delta;
+ }
}
return result;
@@ -395,76 +371,71 @@ miGetPlane(
*/
static void
miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
- MiBits *pbits, int srcx, int w, int h, int dstx, int dsty)
+ MiBits * pbits, int srcx, int w, int h, int dstx, int dsty)
{
- int oldfill, i;
+ int oldfill, i;
unsigned long oldfg;
- int *pwidth, *pwidthFirst;
- ChangeGCVal gcv[6];
- PixmapPtr pStipple, pPixmap;
- DDXPointRec oldOrg;
- GCPtr pGCT;
+ int *pwidth, *pwidthFirst;
+ ChangeGCVal gcv[6];
+ PixmapPtr pStipple, pPixmap;
+ DDXPointRec oldOrg;
+ GCPtr pGCT;
DDXPointPtr ppt, pptFirst;
xRectangle rect;
- RegionPtr prgnSrcClip;
+ RegionPtr prgnSrcClip;
pPixmap = (*pDraw->pScreen->CreatePixmap)
- (pDraw->pScreen, w + srcx, h, 1,
- CREATE_PIXMAP_USAGE_SCRATCH);
+ (pDraw->pScreen, w + srcx, h, 1, CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap)
- return;
+ return;
/* Put the image into a 1 bit deep pixmap */
pGCT = GetScratchGC(1, pDraw->pScreen);
- if (!pGCT)
- {
- (*pDraw->pScreen->DestroyPixmap)(pPixmap);
- return;
+ if (!pGCT) {
+ (*pDraw->pScreen->DestroyPixmap) (pPixmap);
+ return;
}
/* First set the whole pixmap to 0 */
gcv[0].val = 0;
ChangeGC(NullClient, pGCT, GCBackground, gcv);
- ValidateGC((DrawablePtr)pPixmap, pGCT);
- miClearDrawable((DrawablePtr)pPixmap, pGCT);
+ ValidateGC((DrawablePtr) pPixmap, pGCT);
+ miClearDrawable((DrawablePtr) pPixmap, pGCT);
ppt = pptFirst = malloc(h * sizeof(DDXPointRec));
pwidth = pwidthFirst = malloc(h * sizeof(int));
- if(!pptFirst || !pwidthFirst)
- {
- free(pwidthFirst);
- free(pptFirst);
- FreeScratchGC(pGCT);
- return;
+ if (!pptFirst || !pwidthFirst) {
+ free(pwidthFirst);
+ free(pptFirst);
+ FreeScratchGC(pGCT);
+ return;
}
/* we need a temporary region because ChangeClip must be assumed
to destroy what it's sent. note that this means we don't
have to free prgnSrcClip ourselves.
- */
+ */
prgnSrcClip = RegionCreate(NULL, 0);
RegionCopy(prgnSrcClip, prgnSrc);
RegionTranslate(prgnSrcClip, srcx, 0);
- (*pGCT->funcs->ChangeClip)(pGCT, CT_REGION, prgnSrcClip, 0);
- ValidateGC((DrawablePtr)pPixmap, pGCT);
+ (*pGCT->funcs->ChangeClip) (pGCT, CT_REGION, prgnSrcClip, 0);
+ ValidateGC((DrawablePtr) pPixmap, pGCT);
/* Since we know pDraw is always a pixmap, we never need to think
* about translation here */
- for(i = 0; i < h; i++)
- {
- ppt->x = 0;
- ppt++->y = i;
- *pwidth++ = w + srcx;
+ for (i = 0; i < h; i++) {
+ ppt->x = 0;
+ ppt++->y = i;
+ *pwidth++ = w + srcx;
}
- (*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits,
- pptFirst, pwidthFirst, h, TRUE);
+ (*pGCT->ops->SetSpans) ((DrawablePtr) pPixmap, pGCT, (char *) pbits,
+ pptFirst, pwidthFirst, h, TRUE);
free(pwidthFirst);
free(pptFirst);
-
/* Save current values from the client GC */
oldfill = pGC->fillStyle;
pStipple = pGC->stipple;
- if(pStipple)
+ if (pStipple)
pStipple->refcnt++;
oldOrg = pGC->patOrg;
@@ -476,7 +447,7 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
ChangeGC(NullClient, pGC,
GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin,
- gcv);
+ gcv);
ValidateGC(pDraw, pGC);
/* Fill the drawable with the stipple. This will draw the
@@ -487,15 +458,15 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
rect.y = dsty;
rect.width = w;
rect.height = h;
- (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect);
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect);
/* Invert the tiling pixmap. This sets 0s for 1s and 1s for 0s, only
* within the clipping region, the part outside is still all 0s */
gcv[0].val = GXinvert;
ChangeGC(NullClient, pGCT, GCFunction, gcv);
- ValidateGC((DrawablePtr)pPixmap, pGCT);
- (*pGCT->ops->CopyArea)((DrawablePtr)pPixmap, (DrawablePtr)pPixmap,
- pGCT, 0, 0, w + srcx, h, 0, 0);
+ ValidateGC((DrawablePtr) pPixmap, pGCT);
+ (*pGCT->ops->CopyArea) ((DrawablePtr) pPixmap, (DrawablePtr) pPixmap,
+ pGCT, 0, 0, w + srcx, h, 0, 0);
/* Swap foreground and background colors on the GC for the drawable.
* Now when we fill the drawable, we will fill in the "Background"
@@ -511,10 +482,10 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
rect.y = dsty;
rect.width = w;
rect.height = h;
- (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect);
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect);
/* Now put things back */
- if(pStipple)
+ if (pStipple)
pStipple->refcnt--;
gcv[0].val = oldfg;
gcv[1].val = pGC->fgPixel;
@@ -523,14 +494,14 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
gcv[4].val = oldOrg.x;
gcv[5].val = oldOrg.y;
ChangeGC(NullClient, pGC,
- GCForeground | GCBackground | GCFillStyle | GCStipple |
- GCTileStipXOrigin | GCTileStipYOrigin, gcv);
+ GCForeground | GCBackground | GCFillStyle | GCStipple |
+ GCTileStipXOrigin | GCTileStipYOrigin, gcv);
ValidateGC(pDraw, pGC);
/* put what we hope is a smaller clip region back in the scratch gc */
- (*pGCT->funcs->ChangeClip)(pGCT, CT_NONE, NULL, 0);
+ (*pGCT->funcs->ChangeClip) (pGCT, CT_NONE, NULL, 0);
FreeScratchGC(pGCT);
- (*pDraw->pScreen->DestroyPixmap)(pPixmap);
+ (*pDraw->pScreen->DestroyPixmap) (pPixmap);
}
@@ -541,20 +512,16 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
* Use the bitmap we've built up as a Stipple for the destination
*/
RegionPtr
-miCopyPlane( DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int srcx,
- int srcy,
- int width,
- int height,
- int dstx,
- int dsty,
- unsigned long bitPlane)
+miCopyPlane(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width, int height, int dstx, int dsty, unsigned long bitPlane)
{
- MiBits *ptile;
- BoxRec box;
- RegionPtr prgnSrc, prgnExposed;
+ MiBits *ptile;
+ BoxRec box;
+ RegionPtr prgnSrc, prgnExposed;
/* incorporate the source clip */
@@ -564,57 +531,55 @@ miCopyPlane( DrawablePtr pSrcDrawable,
box.y2 = box.y1 + height;
/* clip to visible drawable */
if (box.x1 < pSrcDrawable->x)
- box.x1 = pSrcDrawable->x;
+ box.x1 = pSrcDrawable->x;
if (box.y1 < pSrcDrawable->y)
- box.y1 = pSrcDrawable->y;
+ box.y1 = pSrcDrawable->y;
if (box.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
- box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
+ box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
if (box.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
- box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
+ box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
if (box.x1 > box.x2)
- box.x2 = box.x1;
+ box.x2 = box.x1;
if (box.y1 > box.y2)
- box.y2 = box.y1;
+ box.y2 = box.y1;
prgnSrc = RegionCreate(&box, 1);
if (pSrcDrawable->type != DRAWABLE_PIXMAP) {
- /* clip to visible drawable */
-
- if (pGC->subWindowMode == IncludeInferiors)
- {
- RegionPtr clipList = NotClippedByChildren ((WindowPtr) pSrcDrawable);
- RegionIntersect(prgnSrc, prgnSrc, clipList);
- RegionDestroy(clipList);
- } else
- RegionIntersect(prgnSrc, prgnSrc,
- &((WindowPtr)pSrcDrawable)->clipList);
+ /* clip to visible drawable */
+
+ if (pGC->subWindowMode == IncludeInferiors) {
+ RegionPtr clipList = NotClippedByChildren((WindowPtr) pSrcDrawable);
+
+ RegionIntersect(prgnSrc, prgnSrc, clipList);
+ RegionDestroy(clipList);
+ }
+ else
+ RegionIntersect(prgnSrc, prgnSrc,
+ &((WindowPtr) pSrcDrawable)->clipList);
}
box = *RegionExtents(prgnSrc);
RegionTranslate(prgnSrc, -box.x1, -box.y1);
- if ((box.x2 > box.x1) && (box.y2 > box.y1))
- {
- /* minimize the size of the data extracted */
- /* note that we convert the plane mask bitPlane into a plane number */
- box.x1 -= pSrcDrawable->x;
- box.x2 -= pSrcDrawable->x;
- box.y1 -= pSrcDrawable->y;
- box.y2 -= pSrcDrawable->y;
- ptile = miGetPlane(pSrcDrawable, ffs(bitPlane) - 1,
- box.x1, box.y1,
- box.x2 - box.x1, box.y2 - box.y1,
- (MiBits *) NULL);
- if (ptile)
- {
- miOpqStipDrawable(pDstDrawable, pGC, prgnSrc, ptile, 0,
- box.x2 - box.x1, box.y2 - box.y1,
- dstx + box.x1 - srcx, dsty + box.y1 - srcy);
- free(ptile);
- }
+ if ((box.x2 > box.x1) && (box.y2 > box.y1)) {
+ /* minimize the size of the data extracted */
+ /* note that we convert the plane mask bitPlane into a plane number */
+ box.x1 -= pSrcDrawable->x;
+ box.x2 -= pSrcDrawable->x;
+ box.y1 -= pSrcDrawable->y;
+ box.y2 -= pSrcDrawable->y;
+ ptile = miGetPlane(pSrcDrawable, ffs(bitPlane) - 1,
+ box.x1, box.y1,
+ box.x2 - box.x1, box.y2 - box.y1, (MiBits *) NULL);
+ if (ptile) {
+ miOpqStipDrawable(pDstDrawable, pGC, prgnSrc, ptile, 0,
+ box.x2 - box.x1, box.y2 - box.y1,
+ dstx + box.x1 - srcx, dsty + box.y1 - srcy);
+ free(ptile);
+ }
}
prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
- width, height, dstx, dsty, bitPlane);
+ width, height, dstx, dsty, bitPlane);
RegionDestroy(prgnSrc);
return prgnExposed;
}
@@ -636,80 +601,72 @@ miCopyPlane( DrawablePtr pSrcDrawable,
* get the single plane specified in planemask
*/
void
-miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h,
- unsigned int format, unsigned long planeMask, char *pDst)
+miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planeMask, char *pDst)
{
- unsigned char depth;
- int i, linelength, width, srcx, srcy;
- DDXPointRec pt = {0, 0};
- PixmapPtr pPixmap = NULL;
- GCPtr pGC = NULL;
+ unsigned char depth;
+ int i, linelength, width, srcx, srcy;
+ DDXPointRec pt = { 0, 0 };
+ PixmapPtr pPixmap = NULL;
+ GCPtr pGC = NULL;
depth = pDraw->depth;
- if(format == ZPixmap)
- {
- if ( (((1LL<<depth)-1)&planeMask) != (1LL<<depth)-1 )
- {
- ChangeGCVal gcv;
- xPoint pt;
-
- pGC = GetScratchGC(depth, pDraw->pScreen);
- if (!pGC)
- return;
+ if (format == ZPixmap) {
+ if ((((1LL << depth) - 1) & planeMask) != (1LL << depth) - 1) {
+ ChangeGCVal gcv;
+ xPoint pt;
+
+ pGC = GetScratchGC(depth, pDraw->pScreen);
+ if (!pGC)
+ return;
pPixmap = (*pDraw->pScreen->CreatePixmap)
- (pDraw->pScreen, w, 1, depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap)
- {
- FreeScratchGC(pGC);
- return;
- }
- /*
- * Clear the pixmap before doing anything else
- */
- ValidateGC((DrawablePtr)pPixmap, pGC);
- pt.x = pt.y = 0;
+ (pDraw->pScreen, w, 1, depth, CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pPixmap) {
+ FreeScratchGC(pGC);
+ return;
+ }
+ /*
+ * Clear the pixmap before doing anything else
+ */
+ ValidateGC((DrawablePtr) pPixmap, pGC);
+ pt.x = pt.y = 0;
width = w;
- (*pGC->ops->FillSpans)((DrawablePtr)pPixmap, pGC, 1, &pt, &width,
- TRUE);
-
- /* alu is already GXCopy */
- gcv.val = (XID)planeMask;
- ChangeGC(NullClient, pGC, GCPlaneMask, &gcv);
- ValidateGC((DrawablePtr)pPixmap, pGC);
- }
+ (*pGC->ops->FillSpans) ((DrawablePtr) pPixmap, pGC, 1, &pt, &width,
+ TRUE);
+
+ /* alu is already GXCopy */
+ gcv.val = (XID) planeMask;
+ ChangeGC(NullClient, pGC, GCPlaneMask, &gcv);
+ ValidateGC((DrawablePtr) pPixmap, pGC);
+ }
linelength = PixmapBytePad(w, depth);
- srcx = sx + pDraw->x;
- srcy = sy + pDraw->y;
- for(i = 0; i < h; i++)
- {
- pt.x = srcx;
- pt.y = srcy + i;
- width = w;
- (*pDraw->pScreen->GetSpans)(pDraw, w, &pt, &width, 1, pDst);
- if (pPixmap)
- {
- pt.x = 0;
- pt.y = 0;
- width = w;
- (*pGC->ops->SetSpans)((DrawablePtr)pPixmap, pGC, pDst,
- &pt, &width, 1, TRUE);
- (*pDraw->pScreen->GetSpans)((DrawablePtr)pPixmap, w, &pt,
- &width, 1, pDst);
- }
- pDst += linelength;
- }
- if (pPixmap)
- {
- (*pGC->pScreen->DestroyPixmap)(pPixmap);
- FreeScratchGC(pGC);
- }
+ srcx = sx + pDraw->x;
+ srcy = sy + pDraw->y;
+ for (i = 0; i < h; i++) {
+ pt.x = srcx;
+ pt.y = srcy + i;
+ width = w;
+ (*pDraw->pScreen->GetSpans) (pDraw, w, &pt, &width, 1, pDst);
+ if (pPixmap) {
+ pt.x = 0;
+ pt.y = 0;
+ width = w;
+ (*pGC->ops->SetSpans) ((DrawablePtr) pPixmap, pGC, pDst,
+ &pt, &width, 1, TRUE);
+ (*pDraw->pScreen->GetSpans) ((DrawablePtr) pPixmap, w, &pt,
+ &width, 1, pDst);
+ }
+ pDst += linelength;
+ }
+ if (pPixmap) {
+ (*pGC->pScreen->DestroyPixmap) (pPixmap);
+ FreeScratchGC(pGC);
+ }
}
- else
- {
- (void) miGetPlane(pDraw, ffs(planeMask) - 1, sx, sy, w, h,
- (MiBits *)pDst);
+ else {
+ (void) miGetPlane(pDraw, ffs(planeMask) - 1, sx, sy, w, h,
+ (MiBits *) pDst);
}
}
@@ -734,92 +691,86 @@ miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h,
* This part is simple, just call SetSpans
*/
void
-miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
- int x, int y, int w, int h,
- int leftPad, int format, char *pImage)
+miPutImage(DrawablePtr pDraw, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format, char *pImage)
{
- DDXPointPtr pptFirst, ppt;
- int *pwidthFirst, *pwidth;
- RegionPtr prgnSrc;
- BoxRec box;
- unsigned long oldFg, oldBg;
- ChangeGCVal gcv[3];
- unsigned long oldPlanemask;
- unsigned long i;
- long bytesPer;
+ DDXPointPtr pptFirst, ppt;
+ int *pwidthFirst, *pwidth;
+ RegionPtr prgnSrc;
+ BoxRec box;
+ unsigned long oldFg, oldBg;
+ ChangeGCVal gcv[3];
+ unsigned long oldPlanemask;
+ unsigned long i;
+ long bytesPer;
if (!w || !h)
- return;
- switch(format)
- {
- case XYBitmap:
+ return;
+ switch (format) {
+ case XYBitmap:
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = w;
- box.y2 = h;
- prgnSrc = RegionCreate(&box, 1);
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = w;
+ box.y2 = h;
+ prgnSrc = RegionCreate(&box, 1);
miOpqStipDrawable(pDraw, pGC, prgnSrc, (MiBits *) pImage,
- leftPad, w, h, x, y);
- RegionDestroy(prgnSrc);
- break;
-
- case XYPixmap:
- depth = pGC->depth;
- oldPlanemask = pGC->planemask;
- oldFg = pGC->fgPixel;
- oldBg = pGC->bgPixel;
- gcv[0].val = (XID)~0;
- gcv[1].val = (XID)0;
- ChangeGC(NullClient, pGC, GCForeground | GCBackground, gcv);
- bytesPer = (long)h * BitmapBytePad(w + leftPad);
-
- for (i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer)
- {
- if (i & oldPlanemask)
- {
- gcv[0].val = (XID)i;
- ChangeGC(NullClient, pGC, GCPlaneMask, gcv);
- ValidateGC(pDraw, pGC);
- (*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad,
- XYBitmap, (char *)pImage);
- }
- }
- gcv[0].val = (XID)oldPlanemask;
- gcv[1].val = (XID)oldFg;
- gcv[2].val = (XID)oldBg;
- ChangeGC(NullClient, pGC, GCPlaneMask | GCForeground | GCBackground, gcv);
- ValidateGC(pDraw, pGC);
- break;
-
- case ZPixmap:
+ leftPad, w, h, x, y);
+ RegionDestroy(prgnSrc);
+ break;
+
+ case XYPixmap:
+ depth = pGC->depth;
+ oldPlanemask = pGC->planemask;
+ oldFg = pGC->fgPixel;
+ oldBg = pGC->bgPixel;
+ gcv[0].val = (XID) ~0;
+ gcv[1].val = (XID) 0;
+ ChangeGC(NullClient, pGC, GCForeground | GCBackground, gcv);
+ bytesPer = (long) h *BitmapBytePad(w + leftPad);
+
+ for (i = 1 << (depth - 1); i != 0; i >>= 1, pImage += bytesPer) {
+ if (i & oldPlanemask) {
+ gcv[0].val = (XID) i;
+ ChangeGC(NullClient, pGC, GCPlaneMask, gcv);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->PutImage) (pDraw, pGC, 1, x, y, w, h, leftPad,
+ XYBitmap, (char *) pImage);
+ }
+ }
+ gcv[0].val = (XID) oldPlanemask;
+ gcv[1].val = (XID) oldFg;
+ gcv[2].val = (XID) oldBg;
+ ChangeGC(NullClient, pGC, GCPlaneMask | GCForeground | GCBackground,
+ gcv);
+ ValidateGC(pDraw, pGC);
+ break;
+
+ case ZPixmap:
ppt = pptFirst = malloc(h * sizeof(DDXPointRec));
pwidth = pwidthFirst = malloc(h * sizeof(int));
- if(!pptFirst || !pwidthFirst)
- {
- free(pwidthFirst);
- free(pptFirst);
- return;
+ if (!pptFirst || !pwidthFirst) {
+ free(pwidthFirst);
+ free(pptFirst);
+ return;
+ }
+ if (pGC->miTranslate) {
+ x += pDraw->x;
+ y += pDraw->y;
}
- if (pGC->miTranslate)
- {
- x += pDraw->x;
- y += pDraw->y;
- }
-
- for(i = 0; i < h; i++)
- {
- ppt->x = x;
- ppt->y = y + i;
- ppt++;
- *pwidth++ = w;
- }
-
- (*pGC->ops->SetSpans)(pDraw, pGC, (char *)pImage, pptFirst,
- pwidthFirst, h, TRUE);
- free(pwidthFirst);
- free(pptFirst);
- break;
+
+ for (i = 0; i < h; i++) {
+ ppt->x = x;
+ ppt->y = y + i;
+ ppt++;
+ *pwidth++ = w;
+ }
+
+ (*pGC->ops->SetSpans) (pDraw, pGC, (char *) pImage, pptFirst,
+ pwidthFirst, h, TRUE);
+ free(pwidthFirst);
+ free(pptFirst);
+ break;
}
}
diff --git a/xorg-server/mi/micmap.c b/xorg-server/mi/micmap.c
index 3746cad7f..90ca85d67 100644
--- a/xorg-server/mi/micmap.c
+++ b/xorg-server/mi/micmap.c
@@ -27,7 +27,6 @@
* are may be debatable.
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -43,11 +42,11 @@
DevPrivateKeyRec micmapScrPrivateKeyRec;
int
-miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
+miListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps)
{
if (GetInstalledmiColormap(pScreen)) {
- *pmaps = GetInstalledmiColormap(pScreen)->mid;
- return 1;
+ *pmaps = GetInstalledmiColormap(pScreen)->mid;
+ return 1;
}
return 0;
}
@@ -57,15 +56,14 @@ miInstallColormap(ColormapPtr pmap)
{
ColormapPtr oldpmap = GetInstalledmiColormap(pmap->pScreen);
- if(pmap != oldpmap)
- {
- /* Uninstall pInstalledMap. No hardware changes required, just
- * notify all interested parties. */
- if(oldpmap != (ColormapPtr)None)
- WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
- /* Install pmap */
- SetInstalledmiColormap(pmap->pScreen, pmap);
- WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
+ if (pmap != oldpmap) {
+ /* Uninstall pInstalledMap. No hardware changes required, just
+ * notify all interested parties. */
+ if (oldpmap != (ColormapPtr) None)
+ WalkTree(pmap->pScreen, TellLostMap, (char *) &oldpmap->mid);
+ /* Install pmap */
+ SetInstalledmiColormap(pmap->pScreen, pmap);
+ WalkTree(pmap->pScreen, TellGainedMap, (char *) &pmap->mid);
}
}
@@ -75,38 +73,33 @@ miUninstallColormap(ColormapPtr pmap)
{
ColormapPtr curpmap = GetInstalledmiColormap(pmap->pScreen);
- if(pmap == curpmap)
- {
- if (pmap->mid != pmap->pScreen->defColormap)
- {
- dixLookupResourceByType((pointer *)&curpmap,
- pmap->pScreen->defColormap,
- RT_COLORMAP, serverClient,
- DixUseAccess);
- (*pmap->pScreen->InstallColormap)(curpmap);
- }
+ if (pmap == curpmap) {
+ if (pmap->mid != pmap->pScreen->defColormap) {
+ dixLookupResourceByType((pointer *) &curpmap,
+ pmap->pScreen->defColormap,
+ RT_COLORMAP, serverClient, DixUseAccess);
+ (*pmap->pScreen->InstallColormap) (curpmap);
+ }
}
}
void
miResolveColor(unsigned short *pred, unsigned short *pgreen,
- unsigned short *pblue, VisualPtr pVisual)
+ unsigned short *pblue, VisualPtr pVisual)
{
int shift = 16 - pVisual->bitsPerRGBValue;
unsigned lim = (1 << pVisual->bitsPerRGBValue) - 1;
- if ((pVisual->class | DynamicClass) == GrayScale)
- {
- /* rescale to gray then rgb bits */
- *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
- *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
+ if ((pVisual->class | DynamicClass) == GrayScale) {
+ /* rescale to gray then rgb bits */
+ *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
+ *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
}
- else
- {
- /* rescale to rgb bits */
- *pred = ((*pred >> shift) * 65535) / lim;
- *pgreen = ((*pgreen >> shift) * 65535) / lim;
- *pblue = ((*pblue >> shift) * 65535) / lim;
+ else {
+ /* rescale to rgb bits */
+ *pred = ((*pred >> shift) * 65535) / lim;
+ *pgreen = ((*pgreen >> shift) * 65535) / lim;
+ *pblue = ((*pblue >> shift) * 65535) / lim;
}
}
@@ -121,66 +114,58 @@ miInitializeColormap(ColormapPtr pmap)
lim = (1 << pVisual->bitsPerRGBValue) - 1;
shift = 16 - pVisual->bitsPerRGBValue;
maxent = pVisual->ColormapEntries - 1;
- if (pVisual->class == TrueColor)
- {
- unsigned limr, limg, limb;
-
- limr = pVisual->redMask >> pVisual->offsetRed;
- for(i = 0; i <= min(limr,maxent); i++)
- {
- /* rescale to [0..65535] then rgb bits */
- pmap->red[i].co.local.red =
- ((((i * 65535) / limr) >> shift) * 65535) / lim;
- }
- for(; i <= maxent; i++) pmap->red[i].co.local.red = 65535;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- for(i = 0; i <= min(limg,maxent); i++)
- {
- /* rescale to [0..65535] then rgb bits */
- pmap->green[i].co.local.green =
- ((((i * 65535) / limg) >> shift) * 65535) / lim;
- }
- for(; i <= maxent; i++) pmap->green[i].co.local.green = 65535;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- for(i = 0; i <= min(limb,maxent); i++)
- {
- /* rescale to [0..65535] then rgb bits */
- pmap->blue[i].co.local.blue =
- ((((i * 65535) / limb) >> shift) * 65535) / lim;
- }
- for(; i <= maxent; i++) pmap->blue[i].co.local.blue = 65535;
+ if (pVisual->class == TrueColor) {
+ unsigned limr, limg, limb;
+
+ limr = pVisual->redMask >> pVisual->offsetRed;
+ for(i = 0; i <= min(limr,maxent); i++) {
+ /* rescale to [0..65535] then rgb bits */
+ pmap->red[i].co.local.red =
+ ((((i * 65535) / limr) >> shift) * 65535) / lim;
+ }
+ for(; i <= maxent; i++) pmap->red[i].co.local.red = 65535;
+ limg = pVisual->greenMask >> pVisual->offsetGreen;
+ for(i = 0; i <= min(limg,maxent); i++) {
+ /* rescale to [0..65535] then rgb bits */
+ pmap->green[i].co.local.green =
+ ((((i * 65535) / limg) >> shift) * 65535) / lim;
+ }
+ for(; i <= maxent; i++) pmap->green[i].co.local.green = 65535;
+ limb = pVisual->blueMask >> pVisual->offsetBlue;
+ for(i = 0; i <= min(limb,maxent); i++) {
+ /* rescale to [0..65535] then rgb bits */
+ pmap->blue[i].co.local.blue =
+ ((((i * 65535) / limb) >> shift) * 65535) / lim;
+ }
+ for(; i <= maxent; i++) pmap->blue[i].co.local.blue = 65535;
}
- else if (pVisual->class == StaticColor)
- {
- unsigned limr, limg, limb;
-
- limr = pVisual->redMask >> pVisual->offsetRed;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- for(i = 0; i <= maxent; i++)
- {
- /* rescale to [0..65535] then rgb bits */
- pmap->red[i].co.local.red =
- ((((((i & pVisual->redMask) >> pVisual->offsetRed)
- * 65535) / limr) >> shift) * 65535) / lim;
- pmap->red[i].co.local.green =
- ((((((i & pVisual->greenMask) >> pVisual->offsetGreen)
- * 65535) / limg) >> shift) * 65535) / lim;
- pmap->red[i].co.local.blue =
- ((((((i & pVisual->blueMask) >> pVisual->offsetBlue)
- * 65535) / limb) >> shift) * 65535) / lim;
- }
+ else if (pVisual->class == StaticColor) {
+ unsigned limr, limg, limb;
+
+ limr = pVisual->redMask >> pVisual->offsetRed;
+ limg = pVisual->greenMask >> pVisual->offsetGreen;
+ limb = pVisual->blueMask >> pVisual->offsetBlue;
+ for (i = 0; i <= maxent; i++) {
+ /* rescale to [0..65535] then rgb bits */
+ pmap->red[i].co.local.red =
+ ((((((i & pVisual->redMask) >> pVisual->offsetRed)
+ * 65535) / limr) >> shift) * 65535) / lim;
+ pmap->red[i].co.local.green =
+ ((((((i & pVisual->greenMask) >> pVisual->offsetGreen)
+ * 65535) / limg) >> shift) * 65535) / lim;
+ pmap->red[i].co.local.blue =
+ ((((((i & pVisual->blueMask) >> pVisual->offsetBlue)
+ * 65535) / limb) >> shift) * 65535) / lim;
+ }
}
- else if (pVisual->class == StaticGray)
- {
- for(i = 0; i <= maxent; i++)
- {
- /* rescale to [0..65535] then rgb bits */
- pmap->red[i].co.local.red = ((((i * 65535) / maxent) >> shift)
- * 65535) / lim;
- pmap->red[i].co.local.green = pmap->red[i].co.local.red;
- pmap->red[i].co.local.blue = pmap->red[i].co.local.red;
- }
+ else if (pVisual->class == StaticGray) {
+ for (i = 0; i <= maxent; i++) {
+ /* rescale to [0..65535] then rgb bits */
+ pmap->red[i].co.local.red = ((((i * 65535) / maxent) >> shift)
+ * 65535) / lim;
+ pmap->red[i].co.local.green = pmap->red[i].co.local.red;
+ pmap->red[i].co.local.blue = pmap->red[i].co.local.red;
+ }
}
return TRUE;
}
@@ -207,16 +192,16 @@ miInitializeColormap(ColormapPtr pmap)
}
int
-miExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem *indefs,
- xColorItem *outdefs)
+miExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem * indefs,
+ xColorItem * outdefs)
{
- int red, green, blue;
- int maxred, maxgreen, maxblue;
- int stepred, stepgreen, stepblue;
- VisualPtr pVisual;
- int pixel;
- int nresult;
- int i;
+ int red, green, blue;
+ int maxred, maxgreen, maxblue;
+ int stepred, stepgreen, stepblue;
+ VisualPtr pVisual;
+ int pixel;
+ int nresult;
+ int i;
pVisual = pmap->pVisual;
@@ -227,41 +212,31 @@ miExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem *indefs,
maxgreen = pVisual->greenMask;
maxblue = pVisual->blueMask;
nresult = 0;
- for (;ndef--; indefs++)
- {
- if (indefs->flags & DoRed)
- {
- red = indefs->pixel & pVisual->redMask;
- for (green = 0; green <= maxgreen; green += stepgreen)
- {
- for (blue = 0; blue <= maxblue; blue += stepblue)
- {
- AddElement (DoRed)
- }
- }
- }
- if (indefs->flags & DoGreen)
- {
- green = indefs->pixel & pVisual->greenMask;
- for (red = 0; red <= maxred; red += stepred)
- {
- for (blue = 0; blue <= maxblue; blue += stepblue)
- {
- AddElement (DoGreen)
- }
- }
- }
- if (indefs->flags & DoBlue)
- {
- blue = indefs->pixel & pVisual->blueMask;
- for (red = 0; red <= maxred; red += stepred)
- {
- for (green = 0; green <= maxgreen; green += stepgreen)
- {
- AddElement (DoBlue)
- }
- }
- }
+ for (; ndef--; indefs++) {
+ if (indefs->flags & DoRed) {
+ red = indefs->pixel & pVisual->redMask;
+ for (green = 0; green <= maxgreen; green += stepgreen) {
+ for (blue = 0; blue <= maxblue; blue += stepblue) {
+ AddElement(DoRed)
+ }
+ }
+ }
+ if (indefs->flags & DoGreen) {
+ green = indefs->pixel & pVisual->greenMask;
+ for (red = 0; red <= maxred; red += stepred) {
+ for (blue = 0; blue <= maxblue; blue += stepblue) {
+ AddElement(DoGreen)
+ }
+ }
+ }
+ if (indefs->flags & DoBlue) {
+ blue = indefs->pixel & pVisual->blueMask;
+ for (red = 0; red <= maxred; red += stepred) {
+ for (green = 0; green <= maxgreen; green += stepgreen) {
+ AddElement(DoBlue)
+ }
+ }
+ }
}
return nresult;
}
@@ -279,76 +254,73 @@ miCreateDefColormap(ScreenPtr pScreen)
* color specifications.
*/
static xColorItem citems[] = {
- { 0, 0, 0, 0, 0, 0 },
- { 1, 0x8000, 0, 0, 0, 0 },
- { 2, 0, 0x8000, 0, 0, 0 },
- { 3, 0x8000, 0x8000, 0, 0, 0 },
- { 4, 0, 0, 0x8000, 0, 0 },
- { 5, 0x8000, 0, 0x8000, 0, 0 },
- { 6, 0, 0x8000, 0x8000, 0, 0 },
- { 7, 0xc000, 0xc000, 0xc000, 0, 0 },
- { 8, 0xc000, 0xdc00, 0xc000, 0, 0 },
- { 9, 0xa600, 0xca00, 0xf000, 0, 0 },
- { 246, 0xff00, 0xfb00, 0xf000, 0, 0 },
- { 247, 0xa000, 0xa000, 0xa400, 0, 0 },
- { 248, 0x8000, 0x8000, 0x8000, 0, 0 },
- { 249, 0xff00, 0, 0, 0, 0 },
- { 250, 0, 0xff00, 0, 0, 0 },
- { 251, 0xff00, 0xff00, 0, 0, 0 },
- { 252, 0, 0, 0xff00, 0, 0 },
- { 253, 0xff00, 0, 0xff00, 0, 0 },
- { 254, 0, 0xff00, 0xff00, 0, 0 },
- { 255, 0xff00, 0xff00, 0xff00, 0, 0 }
+ {0, 0, 0, 0, 0, 0},
+ {1, 0x8000, 0, 0, 0, 0},
+ {2, 0, 0x8000, 0, 0, 0},
+ {3, 0x8000, 0x8000, 0, 0, 0},
+ {4, 0, 0, 0x8000, 0, 0},
+ {5, 0x8000, 0, 0x8000, 0, 0},
+ {6, 0, 0x8000, 0x8000, 0, 0},
+ {7, 0xc000, 0xc000, 0xc000, 0, 0},
+ {8, 0xc000, 0xdc00, 0xc000, 0, 0},
+ {9, 0xa600, 0xca00, 0xf000, 0, 0},
+ {246, 0xff00, 0xfb00, 0xf000, 0, 0},
+ {247, 0xa000, 0xa000, 0xa400, 0, 0},
+ {248, 0x8000, 0x8000, 0x8000, 0, 0},
+ {249, 0xff00, 0, 0, 0, 0},
+ {250, 0, 0xff00, 0, 0, 0},
+ {251, 0xff00, 0xff00, 0, 0, 0},
+ {252, 0, 0, 0xff00, 0, 0},
+ {253, 0xff00, 0, 0xff00, 0, 0},
+ {254, 0, 0xff00, 0xff00, 0, 0},
+ {255, 0xff00, 0xff00, 0xff00, 0, 0}
};
#define NUM_DESKTOP_COLORS sizeof citems / sizeof citems[0]
int i;
#else
- unsigned short zero = 0, ones = 0xFFFF;
+ unsigned short zero = 0, ones = 0xFFFF;
#endif
Pixel wp, bp;
- VisualPtr pVisual;
- ColormapPtr cmap;
+ VisualPtr pVisual;
+ ColormapPtr cmap;
int alloctype;
-
+
if (!dixRegisterPrivateKey(&micmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
for (pVisual = pScreen->visuals;
- pVisual->vid != pScreen->rootVisual;
- pVisual++)
- ;
+ pVisual->vid != pScreen->rootVisual; pVisual++);
if (pScreen->rootDepth == 1 || (pVisual->class & DynamicClass))
- alloctype = AllocNone;
+ alloctype = AllocNone;
else
- alloctype = AllocAll;
+ alloctype = AllocAll;
if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap,
- alloctype, 0) != Success)
- return FALSE;
+ alloctype, 0) != Success)
+ return FALSE;
if (pScreen->rootDepth > 1) {
- wp = pScreen->whitePixel;
- bp = pScreen->blackPixel;
+ wp = pScreen->whitePixel;
+ bp = pScreen->blackPixel;
#ifdef WIN32_not_tog
- for (i = 0; i < NUM_DESKTOP_COLORS; i++) {
- if (AllocColor (cmap,
- &citems[i].red, &citems[i].green, &citems[i].blue,
- &citems[i].pixel, 0) != Success)
- return FALSE;
- }
+ for (i = 0; i < NUM_DESKTOP_COLORS; i++) {
+ if (AllocColor(cmap,
+ &citems[i].red, &citems[i].green, &citems[i].blue,
+ &citems[i].pixel, 0) != Success)
+ return FALSE;
+ }
#else
- if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) !=
- Success) ||
- (AllocColor(cmap, &zero, &zero, &zero, &bp, 0) !=
- Success))
- return FALSE;
- pScreen->whitePixel = wp;
- pScreen->blackPixel = bp;
+ if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) !=
+ Success) ||
+ (AllocColor(cmap, &zero, &zero, &zero, &bp, 0) != Success))
+ return FALSE;
+ pScreen->whitePixel = wp;
+ pScreen->blackPixel = bp;
#endif
}
- (*pScreen->InstallColormap)(cmap);
+ (*pScreen->InstallColormap) (cmap);
return TRUE;
}
@@ -369,22 +341,22 @@ miCreateDefColormap(ScreenPtr pScreen)
#define _CE(d) (1 << _RZ(d))
typedef struct _miVisuals {
- struct _miVisuals *next;
- int depth;
- int bitsPerRGB;
- int visuals;
- int count;
- int preferredCVC;
- Pixel redMask, greenMask, blueMask;
+ struct _miVisuals *next;
+ int depth;
+ int bitsPerRGB;
+ int visuals;
+ int count;
+ int preferredCVC;
+ Pixel redMask, greenMask, blueMask;
} miVisualsRec, *miVisualsPtr;
-static int miVisualPriority[] = {
+static int miVisualPriority[] = {
PseudoColor, GrayScale, StaticColor, TrueColor, DirectColor, StaticGray
};
#define NUM_PRIORITY 6
-static miVisualsPtr miVisuals;
+static miVisualsPtr miVisuals;
void
miClearVisualTypes(void)
@@ -392,28 +364,26 @@ miClearVisualTypes(void)
miVisualsPtr v;
while ((v = miVisuals)) {
- miVisuals = v->next;
- free(v);
+ miVisuals = v->next;
+ free(v);
}
}
-
Bool
-miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
- int preferredCVC,
- Pixel redMask, Pixel greenMask, Pixel blueMask)
+miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
+ int preferredCVC,
+ Pixel redMask, Pixel greenMask, Pixel blueMask)
{
- miVisualsPtr new, *prev, v;
- int count;
+ miVisualsPtr new, *prev, v;
+ int count;
new = malloc(sizeof *new);
if (!new)
- return FALSE;
- if (!redMask || !greenMask || !blueMask)
- {
- redMask = _RM(depth);
- greenMask = _GM(depth);
- blueMask = _BM(depth);
+ return FALSE;
+ if (!redMask || !greenMask || !blueMask) {
+ redMask = _RM(depth);
+ greenMask = _GM(depth);
+ blueMask = _BM(depth);
}
new->next = 0;
new->depth = depth;
@@ -425,7 +395,7 @@ miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
new->blueMask = blueMask;
count = (visuals >> 1) & 033333333333;
count = visuals - count - ((count >> 1) & 033333333333);
- count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */
+ count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */
new->count = count;
for (prev = &miVisuals; (v = *prev); prev = &v->next);
*prev = new;
@@ -435,48 +405,46 @@ miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
Bool
miSetVisualTypes(int depth, int visuals, int bitsPerRGB, int preferredCVC)
{
- return miSetVisualTypesAndMasks (depth, visuals, bitsPerRGB,
- preferredCVC, 0, 0, 0);
+ return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB,
+ preferredCVC, 0, 0, 0);
}
int
miGetDefaultVisualMask(int depth)
{
if (depth > MAX_PSEUDO_DEPTH)
- return LARGE_VISUALS;
+ return LARGE_VISUALS;
else if (depth >= MIN_TRUE_DEPTH)
- return ALL_VISUALS;
+ return ALL_VISUALS;
else if (depth == 1)
- return StaticGrayMask;
+ return StaticGrayMask;
else
- return SMALL_VISUALS;
+ return SMALL_VISUALS;
}
static Bool
-miVisualTypesSet (int depth)
+miVisualTypesSet(int depth)
{
- miVisualsPtr visuals;
+ miVisualsPtr visuals;
for (visuals = miVisuals; visuals; visuals = visuals->next)
- if (visuals->depth == depth)
- return TRUE;
+ if (visuals->depth == depth)
+ return TRUE;
return FALSE;
}
Bool
-miSetPixmapDepths (void)
+miSetPixmapDepths(void)
{
- int d, f;
-
+ int d, f;
+
/* Add any unlisted depths from the pixmap formats */
- for (f = 0; f < screenInfo.numPixmapFormats; f++)
- {
- d = screenInfo.formats[f].depth;
- if (!miVisualTypesSet (d))
- {
- if (!miSetVisualTypes (d, 0, 0, -1))
- return FALSE;
- }
+ for (f = 0; f < screenInfo.numPixmapFormats; f++) {
+ d = screenInfo.formats[f].depth;
+ if (!miVisualTypesSet(d)) {
+ if (!miSetVisualTypes(d, 0, 0, -1))
+ return FALSE;
+ }
}
return TRUE;
}
@@ -485,16 +453,16 @@ miSetPixmapDepths (void)
* Distance to least significant one bit
*/
static int
-maskShift (Pixel p)
+maskShift(Pixel p)
{
- int s;
+ int s;
- if (!p) return 0;
+ if (!p)
+ return 0;
s = 0;
- while (!(p & 1))
- {
- s++;
- p >>= 1;
+ while (!(p & 1)) {
+ s++;
+ p >>= 1;
}
return s;
}
@@ -506,120 +474,113 @@ maskShift (Pixel p)
*/
Bool
-miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
- int *ndepthp, int *rootDepthp, VisualID *defaultVisp,
- unsigned long sizes, int bitsPerRGB, int preferredVis)
-
+miInitVisuals(VisualPtr * visualp, DepthPtr * depthp, int *nvisualp,
+ int *ndepthp, int *rootDepthp, VisualID * defaultVisp,
+ unsigned long sizes, int bitsPerRGB, int preferredVis)
{
- int i, j = 0, k;
- VisualPtr visual;
- DepthPtr depth;
- VisualID *vid;
- int d, b;
- int f;
- int ndepth, nvisual;
- int nvtype;
- int vtype;
- miVisualsPtr visuals, nextVisuals;
- int *preferredCVCs, *prefp;
- int first_depth;
+ int i, j = 0, k;
+ VisualPtr visual;
+ DepthPtr depth;
+ VisualID *vid;
+ int d, b;
+ int f;
+ int ndepth, nvisual;
+ int nvtype;
+ int vtype;
+ miVisualsPtr visuals, nextVisuals;
+ int *preferredCVCs, *prefp;
+ int first_depth;
/* none specified, we'll guess from pixmap formats */
- if (!miVisuals)
- {
- for (f = 0; f < screenInfo.numPixmapFormats; f++)
- {
- d = screenInfo.formats[f].depth;
- b = screenInfo.formats[f].bitsPerPixel;
- if (sizes & (1 << (b - 1)))
- vtype = miGetDefaultVisualMask(d);
- else
- vtype = 0;
- if (!miSetVisualTypes (d, vtype, bitsPerRGB, -1))
- return FALSE;
- }
+ if (!miVisuals) {
+ for (f = 0; f < screenInfo.numPixmapFormats; f++) {
+ d = screenInfo.formats[f].depth;
+ b = screenInfo.formats[f].bitsPerPixel;
+ if (sizes & (1 << (b - 1)))
+ vtype = miGetDefaultVisualMask(d);
+ else
+ vtype = 0;
+ if (!miSetVisualTypes(d, vtype, bitsPerRGB, -1))
+ return FALSE;
+ }
}
nvisual = 0;
ndepth = 0;
- for (visuals = miVisuals; visuals; visuals = nextVisuals)
- {
- nextVisuals = visuals->next;
- ndepth++;
- nvisual += visuals->count;
+ for (visuals = miVisuals; visuals; visuals = nextVisuals) {
+ nextVisuals = visuals->next;
+ ndepth++;
+ nvisual += visuals->count;
}
- depth = malloc(ndepth * sizeof (DepthRec));
- visual = malloc(nvisual * sizeof (VisualRec));
+ depth = malloc(ndepth * sizeof(DepthRec));
+ visual = malloc(nvisual * sizeof(VisualRec));
preferredCVCs = malloc(ndepth * sizeof(int));
- if (!depth || !visual || !preferredCVCs)
- {
- free(depth);
- free(visual);
- free(preferredCVCs);
- return FALSE;
+ if (!depth || !visual || !preferredCVCs) {
+ free(depth);
+ free(visual);
+ free(preferredCVCs);
+ return FALSE;
}
*depthp = depth;
*visualp = visual;
*ndepthp = ndepth;
*nvisualp = nvisual;
prefp = preferredCVCs;
- for (visuals = miVisuals; visuals; visuals = nextVisuals)
- {
- nextVisuals = visuals->next;
- d = visuals->depth;
- vtype = visuals->visuals;
- nvtype = visuals->count;
- *prefp = visuals->preferredCVC;
- prefp++;
- vid = NULL;
- if (nvtype)
- {
- vid = malloc(nvtype * sizeof (VisualID));
- if (!vid) {
- free(depth);
- free(visual);
- free(preferredCVCs);
- return FALSE;
- }
- }
- depth->depth = d;
- depth->numVids = nvtype;
- depth->vids = vid;
- depth++;
- for (i = 0; i < NUM_PRIORITY; i++) {
- if (! (vtype & (1 << miVisualPriority[i])))
- continue;
- visual->class = miVisualPriority[i];
- visual->bitsPerRGBValue = visuals->bitsPerRGB;
- visual->ColormapEntries = 1 << d;
- visual->nplanes = d;
- visual->vid = *vid = FakeClientID (0);
- switch (visual->class) {
- case PseudoColor:
- case GrayScale:
- case StaticGray:
- visual->redMask = 0;
- visual->greenMask = 0;
- visual->blueMask = 0;
- visual->offsetRed = 0;
- visual->offsetGreen = 0;
- visual->offsetBlue = 0;
- break;
- case DirectColor:
- case TrueColor:
- visual->ColormapEntries = _CE(d);
- /* fall through */
- case StaticColor:
- visual->redMask = visuals->redMask;
- visual->greenMask = visuals->greenMask;
- visual->blueMask = visuals->blueMask;
- visual->offsetRed = maskShift (visuals->redMask);
- visual->offsetGreen = maskShift (visuals->greenMask);
- visual->offsetBlue = maskShift (visuals->blueMask);
- }
- vid++;
- visual++;
- }
- free(visuals);
+ for (visuals = miVisuals; visuals; visuals = nextVisuals) {
+ nextVisuals = visuals->next;
+ d = visuals->depth;
+ vtype = visuals->visuals;
+ nvtype = visuals->count;
+ *prefp = visuals->preferredCVC;
+ prefp++;
+ vid = NULL;
+ if (nvtype) {
+ vid = malloc(nvtype * sizeof(VisualID));
+ if (!vid) {
+ free(depth);
+ free(visual);
+ free(preferredCVCs);
+ return FALSE;
+ }
+ }
+ depth->depth = d;
+ depth->numVids = nvtype;
+ depth->vids = vid;
+ depth++;
+ for (i = 0; i < NUM_PRIORITY; i++) {
+ if (!(vtype & (1 << miVisualPriority[i])))
+ continue;
+ visual->class = miVisualPriority[i];
+ visual->bitsPerRGBValue = visuals->bitsPerRGB;
+ visual->ColormapEntries = 1 << d;
+ visual->nplanes = d;
+ visual->vid = *vid = FakeClientID(0);
+ switch (visual->class) {
+ case PseudoColor:
+ case GrayScale:
+ case StaticGray:
+ visual->redMask = 0;
+ visual->greenMask = 0;
+ visual->blueMask = 0;
+ visual->offsetRed = 0;
+ visual->offsetGreen = 0;
+ visual->offsetBlue = 0;
+ break;
+ case DirectColor:
+ case TrueColor:
+ visual->ColormapEntries = _CE(d);
+ /* fall through */
+ case StaticColor:
+ visual->redMask = visuals->redMask;
+ visual->greenMask = visuals->greenMask;
+ visual->blueMask = visuals->blueMask;
+ visual->offsetRed = maskShift(visuals->redMask);
+ visual->offsetGreen = maskShift(visuals->greenMask);
+ visual->offsetBlue = maskShift(visuals->blueMask);
+ }
+ vid++;
+ visual++;
+ }
+ free(visuals);
}
miVisuals = NULL;
visual = *visualp;
@@ -632,46 +593,44 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
* default visual/depth from that depth.
*/
first_depth = 0;
- if (preferredVis < 0 && defaultColorVisualClass < 0 ) {
- for (i = 0; i < ndepth; i++) {
- if (preferredCVCs[i] >= 0) {
- first_depth = i;
- break;
- }
- }
+ if (preferredVis < 0 && defaultColorVisualClass < 0) {
+ for (i = 0; i < ndepth; i++) {
+ if (preferredCVCs[i] >= 0) {
+ first_depth = i;
+ break;
+ }
+ }
}
- for (i = first_depth; i < ndepth; i++)
- {
- int prefColorVisualClass = -1;
-
- if (defaultColorVisualClass >= 0)
- prefColorVisualClass = defaultColorVisualClass;
- else if (preferredVis >= 0)
- prefColorVisualClass = preferredVis;
- else if (preferredCVCs[i] >= 0)
- prefColorVisualClass = preferredCVCs[i];
-
- if (*rootDepthp && *rootDepthp != depth[i].depth)
- continue;
-
- for (j = 0; j < depth[i].numVids; j++)
- {
- for (k = 0; k < nvisual; k++)
- if (visual[k].vid == depth[i].vids[j])
- break;
- if (k == nvisual)
- continue;
- if (prefColorVisualClass < 0 ||
- visual[k].class == prefColorVisualClass)
- break;
- }
- if (j != depth[i].numVids)
- break;
+ for (i = first_depth; i < ndepth; i++) {
+ int prefColorVisualClass = -1;
+
+ if (defaultColorVisualClass >= 0)
+ prefColorVisualClass = defaultColorVisualClass;
+ else if (preferredVis >= 0)
+ prefColorVisualClass = preferredVis;
+ else if (preferredCVCs[i] >= 0)
+ prefColorVisualClass = preferredCVCs[i];
+
+ if (*rootDepthp && *rootDepthp != depth[i].depth)
+ continue;
+
+ for (j = 0; j < depth[i].numVids; j++) {
+ for (k = 0; k < nvisual; k++)
+ if (visual[k].vid == depth[i].vids[j])
+ break;
+ if (k == nvisual)
+ continue;
+ if (prefColorVisualClass < 0 ||
+ visual[k].class == prefColorVisualClass)
+ break;
+ }
+ if (j != depth[i].numVids)
+ break;
}
if (i == ndepth) {
- i = 0;
- j = 0;
+ i = 0;
+ j = 0;
}
*rootDepthp = depth[i].depth;
*defaultVisp = depth[i].vids[j];
diff --git a/xorg-server/mi/micmap.h b/xorg-server/mi/micmap.h
index dcfcfd47f..0e344b7ac 100644
--- a/xorg-server/mi/micmap.h
+++ b/xorg-server/mi/micmap.h
@@ -1,63 +1,67 @@
-
-#include "colormapst.h"
-
-#ifndef _MICMAP_H_
-#define _MICMAP_H_
-
-#define GetInstalledmiColormap(s) \
- ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, micmapScrPrivateKey))
-#define SetInstalledmiColormap(s,c) \
- (dixSetPrivate(&(s)->devPrivates, micmapScrPrivateKey, c))
-
-extern _X_EXPORT DevPrivateKeyRec micmapScrPrivateKeyRec;
-#define micmapScrPrivateKey (&micmapScrPrivateKeyRec)
-
-typedef Bool (* miInitVisualsProcPtr)(VisualPtr *, DepthPtr *, int *, int *,
- int *, VisualID *, unsigned long, int,
- int);
-
-extern _X_EXPORT int miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
-extern _X_EXPORT void miInstallColormap(ColormapPtr pmap);
-extern _X_EXPORT void miUninstallColormap(ColormapPtr pmap);
-
-extern _X_EXPORT void miResolveColor(unsigned short *, unsigned short *, unsigned short *,
- VisualPtr);
-extern _X_EXPORT Bool miInitializeColormap(ColormapPtr);
-extern _X_EXPORT int miExpandDirectColors(ColormapPtr, int, xColorItem *, xColorItem *);
-extern _X_EXPORT Bool miCreateDefColormap(ScreenPtr);
-extern _X_EXPORT void miClearVisualTypes(void);
-extern _X_EXPORT Bool miSetVisualTypes(int, int, int, int);
-extern _X_EXPORT Bool miSetPixmapDepths(void);
-extern _X_EXPORT Bool miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
- int preferredCVC,
- Pixel redMask, Pixel greenMask, Pixel blueMask);
-extern _X_EXPORT int miGetDefaultVisualMask(int);
-extern _X_EXPORT Bool miInitVisuals(VisualPtr *, DepthPtr *, int *, int *, int *, VisualID *,
- unsigned long, int, int);
-
-#define MAX_PSEUDO_DEPTH 10
-#define MIN_TRUE_DEPTH 6
-
-#define StaticGrayMask (1 << StaticGray)
-#define GrayScaleMask (1 << GrayScale)
-#define StaticColorMask (1 << StaticColor)
-#define PseudoColorMask (1 << PseudoColor)
-#define TrueColorMask (1 << TrueColor)
-#define DirectColorMask (1 << DirectColor)
-
-#define ALL_VISUALS (StaticGrayMask|\
- GrayScaleMask|\
- StaticColorMask|\
- PseudoColorMask|\
- TrueColorMask|\
- DirectColorMask)
-
-#define LARGE_VISUALS (TrueColorMask|\
- DirectColorMask)
-
-#define SMALL_VISUALS (StaticGrayMask|\
- GrayScaleMask|\
- StaticColorMask|\
- PseudoColorMask)
-
-#endif /* _MICMAP_H_ */
+
+#include "colormapst.h"
+
+#ifndef _MICMAP_H_
+#define _MICMAP_H_
+
+#define GetInstalledmiColormap(s) \
+ ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, micmapScrPrivateKey))
+#define SetInstalledmiColormap(s,c) \
+ (dixSetPrivate(&(s)->devPrivates, micmapScrPrivateKey, c))
+
+extern _X_EXPORT DevPrivateKeyRec micmapScrPrivateKeyRec;
+
+#define micmapScrPrivateKey (&micmapScrPrivateKeyRec)
+
+typedef Bool (*miInitVisualsProcPtr) (VisualPtr *, DepthPtr *, int *, int *,
+ int *, VisualID *, unsigned long, int,
+ int);
+
+extern _X_EXPORT int miListInstalledColormaps(ScreenPtr pScreen,
+ Colormap * pmaps);
+extern _X_EXPORT void miInstallColormap(ColormapPtr pmap);
+extern _X_EXPORT void miUninstallColormap(ColormapPtr pmap);
+
+extern _X_EXPORT void miResolveColor(unsigned short *, unsigned short *,
+ unsigned short *, VisualPtr);
+extern _X_EXPORT Bool miInitializeColormap(ColormapPtr);
+extern _X_EXPORT int miExpandDirectColors(ColormapPtr, int, xColorItem *,
+ xColorItem *);
+extern _X_EXPORT Bool miCreateDefColormap(ScreenPtr);
+extern _X_EXPORT void miClearVisualTypes(void);
+extern _X_EXPORT Bool miSetVisualTypes(int, int, int, int);
+extern _X_EXPORT Bool miSetPixmapDepths(void);
+extern _X_EXPORT Bool miSetVisualTypesAndMasks(int depth, int visuals,
+ int bitsPerRGB, int preferredCVC,
+ Pixel redMask, Pixel greenMask,
+ Pixel blueMask);
+extern _X_EXPORT int miGetDefaultVisualMask(int);
+extern _X_EXPORT Bool miInitVisuals(VisualPtr *, DepthPtr *, int *, int *,
+ int *, VisualID *, unsigned long, int, int);
+
+#define MAX_PSEUDO_DEPTH 10
+#define MIN_TRUE_DEPTH 6
+
+#define StaticGrayMask (1 << StaticGray)
+#define GrayScaleMask (1 << GrayScale)
+#define StaticColorMask (1 << StaticColor)
+#define PseudoColorMask (1 << PseudoColor)
+#define TrueColorMask (1 << TrueColor)
+#define DirectColorMask (1 << DirectColor)
+
+#define ALL_VISUALS (StaticGrayMask|\
+ GrayScaleMask|\
+ StaticColorMask|\
+ PseudoColorMask|\
+ TrueColorMask|\
+ DirectColorMask)
+
+#define LARGE_VISUALS (TrueColorMask|\
+ DirectColorMask)
+
+#define SMALL_VISUALS (StaticGrayMask|\
+ GrayScaleMask|\
+ StaticColorMask|\
+ PseudoColorMask)
+
+#endif /* _MICMAP_H_ */
diff --git a/xorg-server/mi/micopy.c b/xorg-server/mi/micopy.c
index ce01249e8..30795114d 100644
--- a/xorg-server/mi/micopy.c
+++ b/xorg-server/mi/micopy.c
@@ -1,350 +1,313 @@
-/*
- * Copyright © 1998 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "mi.h"
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "pixmap.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-
-void
-miCopyRegion (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- RegionPtr pDstRegion,
- int dx,
- int dy,
- miCopyProc copyProc,
- Pixel bitPlane,
- void *closure)
-{
- int careful;
- Bool reverse;
- Bool upsidedown;
- BoxPtr pbox;
- int nbox;
- BoxPtr pboxNew1, pboxNew2, pboxBase, pboxNext, pboxTmp;
-
- pbox = RegionRects(pDstRegion);
- nbox = RegionNumRects(pDstRegion);
-
- /* XXX we have to err on the side of safety when both are windows,
- * because we don't know if IncludeInferiors is being used.
- */
- careful = ((pSrcDrawable == pDstDrawable) ||
- ((pSrcDrawable->type == DRAWABLE_WINDOW) &&
- (pDstDrawable->type == DRAWABLE_WINDOW)));
-
- pboxNew1 = NULL;
- pboxNew2 = NULL;
- if (careful && dy < 0)
- {
- upsidedown = TRUE;
-
- if (nbox > 1)
- {
- /* keep ordering in each band, reverse order of bands */
- pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
- if(!pboxNew1)
- return;
- pboxBase = pboxNext = pbox+nbox-1;
- while (pboxBase >= pbox)
- {
- while ((pboxNext >= pbox) &&
- (pboxBase->y1 == pboxNext->y1))
- pboxNext--;
- pboxTmp = pboxNext+1;
- while (pboxTmp <= pboxBase)
- {
- *pboxNew1++ = *pboxTmp++;
- }
- pboxBase = pboxNext;
- }
- pboxNew1 -= nbox;
- pbox = pboxNew1;
- }
- }
- else
- {
- /* walk source top to bottom */
- upsidedown = FALSE;
- }
-
- if (careful && dx < 0)
- {
- /* walk source right to left */
- if (dy <= 0)
- reverse = TRUE;
- else
- reverse = FALSE;
-
- if (nbox > 1)
- {
- /* reverse order of rects in each band */
- pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
- if(!pboxNew2)
- {
- free(pboxNew1);
- return;
- }
- pboxBase = pboxNext = pbox;
- while (pboxBase < pbox+nbox)
- {
- while ((pboxNext < pbox+nbox) &&
- (pboxNext->y1 == pboxBase->y1))
- pboxNext++;
- pboxTmp = pboxNext;
- while (pboxTmp != pboxBase)
- {
- *pboxNew2++ = *--pboxTmp;
- }
- pboxBase = pboxNext;
- }
- pboxNew2 -= nbox;
- pbox = pboxNew2;
- }
- }
- else
- {
- /* walk source left to right */
- reverse = FALSE;
- }
-
- (*copyProc) (pSrcDrawable,
- pDstDrawable,
- pGC,
- pbox,
- nbox,
- dx, dy,
- reverse, upsidedown, bitPlane, closure);
-
- free(pboxNew1);
- free(pboxNew2);
-}
-
-RegionPtr
-miDoCopy (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut,
- miCopyProc copyProc,
- Pixel bitPlane,
- void *closure)
-{
- RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
- Bool freeSrcClip = FALSE;
- RegionPtr prgnExposed = NULL;
- RegionRec rgnDst;
- int dx;
- int dy;
- int numRects;
- int box_x1;
- int box_y1;
- int box_x2;
- int box_y2;
- Bool fastSrc = FALSE; /* for fast clipping with pixmap source */
- Bool fastDst = FALSE; /* for fast clipping with one rect dest */
- Bool fastExpose = FALSE; /* for fast exposures with pixmap source */
-
- /* Short cut for unmapped windows */
-
- if (pDstDrawable->type == DRAWABLE_WINDOW &&
- !((WindowPtr)pDstDrawable)->realized)
- {
- return NULL;
- }
-
- if (pSrcDrawable->pScreen->SourceValidate)
- {
- (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, xIn, yIn, widthSrc, heightSrc,
- pGC->subWindowMode);
- }
-
- /* Compute source clip region */
- if (pSrcDrawable->type == DRAWABLE_PIXMAP)
- {
- if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
- prgnSrcClip = miGetCompositeClip(pGC);
- else
- fastSrc = TRUE;
- }
- else
- {
- if (pGC->subWindowMode == IncludeInferiors)
- {
- /*
- * XFree86 DDX empties the border clip when the
- * VT is inactive, make sure the region isn't empty
- */
- if (!((WindowPtr) pSrcDrawable)->parent &&
- RegionNotEmpty(&((WindowPtr) pSrcDrawable)->borderClip))
- {
- /*
- * special case bitblt from root window in
- * IncludeInferiors mode; just like from a pixmap
- */
- fastSrc = TRUE;
- }
- else if ((pSrcDrawable == pDstDrawable) &&
- (pGC->clientClipType == CT_NONE))
- {
- prgnSrcClip = miGetCompositeClip(pGC);
- }
- else
- {
- prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
- freeSrcClip = TRUE;
- }
- }
- else
- {
- prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
- }
- }
-
- xIn += pSrcDrawable->x;
- yIn += pSrcDrawable->y;
-
- xOut += pDstDrawable->x;
- yOut += pDstDrawable->y;
-
- box_x1 = xIn;
- box_y1 = yIn;
- box_x2 = xIn + widthSrc;
- box_y2 = yIn + heightSrc;
-
- dx = xIn - xOut;
- dy = yIn - yOut;
-
- /* Don't create a source region if we are doing a fast clip */
- if (fastSrc)
- {
- RegionPtr cclip;
-
- fastExpose = TRUE;
- /*
- * clip the source; if regions extend beyond the source size,
- * make sure exposure events get sent
- */
- if (box_x1 < pSrcDrawable->x)
- {
- box_x1 = pSrcDrawable->x;
- fastExpose = FALSE;
- }
- if (box_y1 < pSrcDrawable->y)
- {
- box_y1 = pSrcDrawable->y;
- fastExpose = FALSE;
- }
- if (box_x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
- {
- box_x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
- fastExpose = FALSE;
- }
- if (box_y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
- {
- box_y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
- fastExpose = FALSE;
- }
-
- /* Translate and clip the dst to the destination composite clip */
- box_x1 -= dx;
- box_x2 -= dx;
- box_y1 -= dy;
- box_y2 -= dy;
-
- /* If the destination composite clip is one rectangle we can
- do the clip directly. Otherwise we have to create a full
- blown region and call intersect */
-
- cclip = miGetCompositeClip(pGC);
- if (RegionNumRects(cclip) == 1)
- {
- BoxPtr pBox = RegionRects(cclip);
-
- if (box_x1 < pBox->x1) box_x1 = pBox->x1;
- if (box_x2 > pBox->x2) box_x2 = pBox->x2;
- if (box_y1 < pBox->y1) box_y1 = pBox->y1;
- if (box_y2 > pBox->y2) box_y2 = pBox->y2;
- fastDst = TRUE;
- }
- }
-
- /* Check to see if the region is empty */
- if (box_x1 >= box_x2 || box_y1 >= box_y2)
- {
- RegionNull(&rgnDst);
- }
- else
- {
- BoxRec box;
- box.x1 = box_x1;
- box.y1 = box_y1;
- box.x2 = box_x2;
- box.y2 = box_y2;
- RegionInit(&rgnDst, &box, 1);
- }
-
- /* Clip against complex source if needed */
- if (!fastSrc)
- {
- RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip);
- RegionTranslate(&rgnDst, -dx, -dy);
- }
-
- /* Clip against complex dest if needed */
- if (!fastDst)
- {
- RegionIntersect(&rgnDst, &rgnDst,
- miGetCompositeClip(pGC));
- }
-
- /* Do bit blitting */
- numRects = RegionNumRects(&rgnDst);
- if (numRects && widthSrc && heightSrc)
- miCopyRegion (pSrcDrawable, pDstDrawable, pGC,
- &rgnDst, dx, dy, copyProc, bitPlane, closure);
-
- /* Pixmap sources generate a NoExposed (we return NULL to do this) */
- if (!fastExpose && pGC->fExpose)
- prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
- xIn - pSrcDrawable->x,
- yIn - pSrcDrawable->y,
- widthSrc, heightSrc,
- xOut - pDstDrawable->x,
- yOut - pDstDrawable->y,
- (unsigned long) bitPlane);
- RegionUninit(&rgnDst);
- if (freeSrcClip)
- RegionDestroy(prgnSrcClip);
- return prgnExposed;
-}
+/*
+ * Copyright © 1998 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "mi.h"
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmap.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+
+void
+miCopyRegion(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ RegionPtr pDstRegion,
+ int dx, int dy, miCopyProc copyProc, Pixel bitPlane, void *closure)
+{
+ int careful;
+ Bool reverse;
+ Bool upsidedown;
+ BoxPtr pbox;
+ int nbox;
+ BoxPtr pboxNew1, pboxNew2, pboxBase, pboxNext, pboxTmp;
+
+ pbox = RegionRects(pDstRegion);
+ nbox = RegionNumRects(pDstRegion);
+
+ /* XXX we have to err on the side of safety when both are windows,
+ * because we don't know if IncludeInferiors is being used.
+ */
+ careful = ((pSrcDrawable == pDstDrawable) ||
+ ((pSrcDrawable->type == DRAWABLE_WINDOW) &&
+ (pDstDrawable->type == DRAWABLE_WINDOW)));
+
+ pboxNew1 = NULL;
+ pboxNew2 = NULL;
+ if (careful && dy < 0) {
+ upsidedown = TRUE;
+
+ if (nbox > 1) {
+ /* keep ordering in each band, reverse order of bands */
+ pboxNew1 = (BoxPtr) malloc(sizeof(BoxRec) * nbox);
+ if (!pboxNew1)
+ return;
+ pboxBase = pboxNext = pbox + nbox - 1;
+ while (pboxBase >= pbox) {
+ while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1))
+ pboxNext--;
+ pboxTmp = pboxNext + 1;
+ while (pboxTmp <= pboxBase) {
+ *pboxNew1++ = *pboxTmp++;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew1 -= nbox;
+ pbox = pboxNew1;
+ }
+ }
+ else {
+ /* walk source top to bottom */
+ upsidedown = FALSE;
+ }
+
+ if (careful && dx < 0) {
+ /* walk source right to left */
+ if (dy <= 0)
+ reverse = TRUE;
+ else
+ reverse = FALSE;
+
+ if (nbox > 1) {
+ /* reverse order of rects in each band */
+ pboxNew2 = (BoxPtr) malloc(sizeof(BoxRec) * nbox);
+ if (!pboxNew2) {
+ free(pboxNew1);
+ return;
+ }
+ pboxBase = pboxNext = pbox;
+ while (pboxBase < pbox + nbox) {
+ while ((pboxNext < pbox + nbox) &&
+ (pboxNext->y1 == pboxBase->y1))
+ pboxNext++;
+ pboxTmp = pboxNext;
+ while (pboxTmp != pboxBase) {
+ *pboxNew2++ = *--pboxTmp;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew2 -= nbox;
+ pbox = pboxNew2;
+ }
+ }
+ else {
+ /* walk source left to right */
+ reverse = FALSE;
+ }
+
+ (*copyProc) (pSrcDrawable,
+ pDstDrawable,
+ pGC,
+ pbox, nbox, dx, dy, reverse, upsidedown, bitPlane, closure);
+
+ free(pboxNew1);
+ free(pboxNew2);
+}
+
+RegionPtr
+miDoCopy(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn,
+ int yIn,
+ int widthSrc,
+ int heightSrc,
+ int xOut, int yOut, miCopyProc copyProc, Pixel bitPlane, void *closure)
+{
+ RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
+ Bool freeSrcClip = FALSE;
+ RegionPtr prgnExposed = NULL;
+ RegionRec rgnDst;
+ int dx;
+ int dy;
+ int numRects;
+ int box_x1;
+ int box_y1;
+ int box_x2;
+ int box_y2;
+ Bool fastSrc = FALSE; /* for fast clipping with pixmap source */
+ Bool fastDst = FALSE; /* for fast clipping with one rect dest */
+ Bool fastExpose = FALSE; /* for fast exposures with pixmap source */
+
+ /* Short cut for unmapped windows */
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW &&
+ !((WindowPtr) pDstDrawable)->realized) {
+ return NULL;
+ }
+
+ if (pSrcDrawable->pScreen->SourceValidate) {
+ (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, xIn, yIn,
+ widthSrc, heightSrc,
+ pGC->subWindowMode);
+ }
+
+ /* Compute source clip region */
+ if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
+ if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
+ prgnSrcClip = miGetCompositeClip(pGC);
+ else
+ fastSrc = TRUE;
+ }
+ else {
+ if (pGC->subWindowMode == IncludeInferiors) {
+ /*
+ * XFree86 DDX empties the border clip when the
+ * VT is inactive, make sure the region isn't empty
+ */
+ if (!((WindowPtr) pSrcDrawable)->parent &&
+ RegionNotEmpty(&((WindowPtr) pSrcDrawable)->borderClip)) {
+ /*
+ * special case bitblt from root window in
+ * IncludeInferiors mode; just like from a pixmap
+ */
+ fastSrc = TRUE;
+ }
+ else if ((pSrcDrawable == pDstDrawable) &&
+ (pGC->clientClipType == CT_NONE)) {
+ prgnSrcClip = miGetCompositeClip(pGC);
+ }
+ else {
+ prgnSrcClip = NotClippedByChildren((WindowPtr) pSrcDrawable);
+ freeSrcClip = TRUE;
+ }
+ }
+ else {
+ prgnSrcClip = &((WindowPtr) pSrcDrawable)->clipList;
+ }
+ }
+
+ xIn += pSrcDrawable->x;
+ yIn += pSrcDrawable->y;
+
+ xOut += pDstDrawable->x;
+ yOut += pDstDrawable->y;
+
+ box_x1 = xIn;
+ box_y1 = yIn;
+ box_x2 = xIn + widthSrc;
+ box_y2 = yIn + heightSrc;
+
+ dx = xIn - xOut;
+ dy = yIn - yOut;
+
+ /* Don't create a source region if we are doing a fast clip */
+ if (fastSrc) {
+ RegionPtr cclip;
+
+ fastExpose = TRUE;
+ /*
+ * clip the source; if regions extend beyond the source size,
+ * make sure exposure events get sent
+ */
+ if (box_x1 < pSrcDrawable->x) {
+ box_x1 = pSrcDrawable->x;
+ fastExpose = FALSE;
+ }
+ if (box_y1 < pSrcDrawable->y) {
+ box_y1 = pSrcDrawable->y;
+ fastExpose = FALSE;
+ }
+ if (box_x2 > pSrcDrawable->x + (int) pSrcDrawable->width) {
+ box_x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
+ fastExpose = FALSE;
+ }
+ if (box_y2 > pSrcDrawable->y + (int) pSrcDrawable->height) {
+ box_y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
+ fastExpose = FALSE;
+ }
+
+ /* Translate and clip the dst to the destination composite clip */
+ box_x1 -= dx;
+ box_x2 -= dx;
+ box_y1 -= dy;
+ box_y2 -= dy;
+
+ /* If the destination composite clip is one rectangle we can
+ do the clip directly. Otherwise we have to create a full
+ blown region and call intersect */
+
+ cclip = miGetCompositeClip(pGC);
+ if (RegionNumRects(cclip) == 1) {
+ BoxPtr pBox = RegionRects(cclip);
+
+ if (box_x1 < pBox->x1)
+ box_x1 = pBox->x1;
+ if (box_x2 > pBox->x2)
+ box_x2 = pBox->x2;
+ if (box_y1 < pBox->y1)
+ box_y1 = pBox->y1;
+ if (box_y2 > pBox->y2)
+ box_y2 = pBox->y2;
+ fastDst = TRUE;
+ }
+ }
+
+ /* Check to see if the region is empty */
+ if (box_x1 >= box_x2 || box_y1 >= box_y2) {
+ RegionNull(&rgnDst);
+ }
+ else {
+ BoxRec box;
+
+ box.x1 = box_x1;
+ box.y1 = box_y1;
+ box.x2 = box_x2;
+ box.y2 = box_y2;
+ RegionInit(&rgnDst, &box, 1);
+ }
+
+ /* Clip against complex source if needed */
+ if (!fastSrc) {
+ RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip);
+ RegionTranslate(&rgnDst, -dx, -dy);
+ }
+
+ /* Clip against complex dest if needed */
+ if (!fastDst) {
+ RegionIntersect(&rgnDst, &rgnDst, miGetCompositeClip(pGC));
+ }
+
+ /* Do bit blitting */
+ numRects = RegionNumRects(&rgnDst);
+ if (numRects && widthSrc && heightSrc)
+ miCopyRegion(pSrcDrawable, pDstDrawable, pGC,
+ &rgnDst, dx, dy, copyProc, bitPlane, closure);
+
+ /* Pixmap sources generate a NoExposed (we return NULL to do this) */
+ if (!fastExpose && pGC->fExpose)
+ prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
+ xIn - pSrcDrawable->x,
+ yIn - pSrcDrawable->y,
+ widthSrc, heightSrc,
+ xOut - pDstDrawable->x,
+ yOut - pDstDrawable->y,
+ (unsigned long) bitPlane);
+ RegionUninit(&rgnDst);
+ if (freeSrcClip)
+ RegionDestroy(prgnSrcClip);
+ return prgnExposed;
+}
diff --git a/xorg-server/mi/midash.c b/xorg-server/mi/midash.c
index ba64d354f..78cbaf25e 100644
--- a/xorg-server/mi/midash.c
+++ b/xorg-server/mi/midash.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -53,38 +52,35 @@ SOFTWARE.
#include "mifpoly.h"
void
-miStepDash (
- int dist, /* distance to step */
- int *pDashIndex, /* current dash */
- unsigned char *pDash, /* dash list */
- int numInDashList, /* total length of dash list */
- int *pDashOffset /* offset into current dash */
+miStepDash(int dist, /* distance to step */
+ int *pDashIndex, /* current dash */
+ unsigned char *pDash, /* dash list */
+ int numInDashList, /* total length of dash list */
+ int *pDashOffset /* offset into current dash */
)
{
- int dashIndex, dashOffset;
+ int dashIndex, dashOffset;
int totallen;
- int i;
-
+ int i;
+
dashIndex = *pDashIndex;
dashOffset = *pDashOffset;
- if (dist < pDash[dashIndex] - dashOffset)
- {
- *pDashOffset = dashOffset + dist;
- return;
+ if (dist < pDash[dashIndex] - dashOffset) {
+ *pDashOffset = dashOffset + dist;
+ return;
}
dist -= pDash[dashIndex] - dashOffset;
if (++dashIndex == numInDashList)
- dashIndex = 0;
+ dashIndex = 0;
totallen = 0;
for (i = 0; i < numInDashList; i++)
- totallen += pDash[i];
+ totallen += pDash[i];
if (totallen <= dist)
- dist = dist % totallen;
- while (dist >= pDash[dashIndex])
- {
- dist -= pDash[dashIndex];
- if (++dashIndex == numInDashList)
- dashIndex = 0;
+ dist = dist % totallen;
+ while (dist >= pDash[dashIndex]) {
+ dist -= pDash[dashIndex];
+ if (++dashIndex == numInDashList)
+ dashIndex = 0;
}
*pDashIndex = dashIndex;
*pDashOffset = dist;
diff --git a/xorg-server/mi/midispcur.c b/xorg-server/mi/midispcur.c
index 32c5c9df6..24b9a700d 100644
--- a/xorg-server/mi/midispcur.c
+++ b/xorg-server/mi/midispcur.c
@@ -4,7 +4,6 @@
* machine independent cursor display routines
*/
-
/*
Copyright 1989, 1998 The Open Group
@@ -34,42 +33,45 @@ in this Software without prior written authorization from The Open Group.
#include <dix-config.h>
#endif
-# include <X11/X.h>
-# include "misc.h"
-# include "input.h"
-# include "cursorstr.h"
-# include "windowstr.h"
-# include "regionstr.h"
-# include "dixstruct.h"
-# include "scrnintstr.h"
-# include "servermd.h"
-# include "mipointer.h"
-# include "misprite.h"
-# include "gcstruct.h"
+#include <X11/X.h>
+#include "misc.h"
+#include "input.h"
+#include "cursorstr.h"
+#include "windowstr.h"
+#include "regionstr.h"
+#include "dixstruct.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#include "mipointer.h"
+#include "misprite.h"
+#include "gcstruct.h"
#ifdef ARGB_CURSOR
-# include "picturestr.h"
+#include "picturestr.h"
#endif
-# include "inputstr.h"
+#include "inputstr.h"
/* per-screen private data */
static DevPrivateKeyRec miDCScreenKeyRec;
+
#define miDCScreenKey (&miDCScreenKeyRec)
static DevScreenPrivateKeyRec miDCCursorBitsKeyRec;
+
#define miDCCursorBitsKey (&miDCCursorBitsKeyRec)
static DevScreenPrivateKeyRec miDCDeviceKeyRec;
+
#define miDCDeviceKey (&miDCDeviceKeyRec)
-static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
+static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
/* per device private data */
typedef struct {
- GCPtr pSourceGC, pMaskGC;
- GCPtr pSaveGC, pRestoreGC;
- PixmapPtr pSave;
+ GCPtr pSourceGC, pMaskGC;
+ GCPtr pSaveGC, pRestoreGC;
+ PixmapPtr pSave;
#ifdef ARGB_CURSOR
- PicturePtr pRootPicture;
+ PicturePtr pRootPicture;
#endif
} miDCBufferRec, *miDCBufferPtr;
@@ -83,64 +85,66 @@ typedef struct {
* in the pCursorBuffers array.
*/
typedef struct {
- CloseScreenProcPtr CloseScreen;
+ CloseScreenProcPtr CloseScreen;
} miDCScreenRec, *miDCScreenPtr;
#define miGetDCScreen(s) ((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey)))
/* per-cursor per-screen private data */
typedef struct {
- PixmapPtr sourceBits; /* source bits */
- PixmapPtr maskBits; /* mask bits */
+ PixmapPtr sourceBits; /* source bits */
+ PixmapPtr maskBits; /* mask bits */
#ifdef ARGB_CURSOR
- PicturePtr pPicture;
+ PicturePtr pPicture;
#endif
} miDCCursorRec, *miDCCursorPtr;
Bool
-miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
+miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
{
- miDCScreenPtr pScreenPriv;
+ miDCScreenPtr pScreenPriv;
if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0) ||
- !dixRegisterScreenPrivateKey(&miDCCursorBitsKeyRec, pScreen, PRIVATE_CURSOR_BITS, 0) ||
- !dixRegisterScreenPrivateKey(&miDCDeviceKeyRec, pScreen, PRIVATE_DEVICE, 0))
- return FALSE;
+ !dixRegisterScreenPrivateKey(&miDCCursorBitsKeyRec, pScreen,
+ PRIVATE_CURSOR_BITS, 0) ||
+ !dixRegisterScreenPrivateKey(&miDCDeviceKeyRec, pScreen, PRIVATE_DEVICE,
+ 0))
+ return FALSE;
- pScreenPriv = malloc(sizeof (miDCScreenRec));
+ pScreenPriv = malloc(sizeof(miDCScreenRec));
if (!pScreenPriv)
- return FALSE;
+ return FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miDCCloseScreen;
dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv);
- if (!miSpriteInitialize (pScreen, screenFuncs))
- {
- free((pointer) pScreenPriv);
- return FALSE;
+ if (!miSpriteInitialize(pScreen, screenFuncs)) {
+ free((pointer) pScreenPriv);
+ return FALSE;
}
return TRUE;
}
static Bool
-miDCCloseScreen (int index, ScreenPtr pScreen)
+miDCCloseScreen(int index, ScreenPtr pScreen)
{
- miDCScreenPtr pScreenPriv;
+ miDCScreenPtr pScreenPriv;
- pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- miDCScreenKey);
+ pScreenPriv = (miDCScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ miDCScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
free((pointer) pScreenPriv);
return (*pScreen->CloseScreen) (index, pScreen);
}
Bool
-miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
+miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
if (pCursor->bits->refcnt <= 1)
- dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, NULL);
+ dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey,
+ pScreen, NULL);
return TRUE;
}
@@ -148,228 +152,217 @@ miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
#define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win))
static VisualPtr
-miDCGetWindowVisual (WindowPtr pWin)
+miDCGetWindowVisual(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- VisualID vid = wVisual (pWin);
- int i;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual(pWin);
+ int i;
for (i = 0; i < pScreen->numVisuals; i++)
- if (pScreen->visuals[i].vid == vid)
- return &pScreen->visuals[i];
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
return 0;
}
static PicturePtr
-miDCMakePicture (PicturePtr *ppPicture, DrawablePtr pDraw, WindowPtr pWin)
+miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin)
{
- ScreenPtr pScreen = pDraw->pScreen;
- VisualPtr pVisual;
- PictFormatPtr pFormat;
- XID subwindow_mode = IncludeInferiors;
- PicturePtr pPicture;
- int error;
-
- pVisual = miDCGetWindowVisual (pWin);
+ ScreenPtr pScreen = pDraw->pScreen;
+ VisualPtr pVisual;
+ PictFormatPtr pFormat;
+ XID subwindow_mode = IncludeInferiors;
+ PicturePtr pPicture;
+ int error;
+
+ pVisual = miDCGetWindowVisual(pWin);
if (!pVisual)
- return 0;
- pFormat = PictureMatchVisual (pScreen, pDraw->depth, pVisual);
+ return 0;
+ pFormat = PictureMatchVisual(pScreen, pDraw->depth, pVisual);
if (!pFormat)
- return 0;
- pPicture = CreatePicture (0, pDraw, pFormat,
- CPSubwindowMode, &subwindow_mode,
- serverClient, &error);
+ return 0;
+ pPicture = CreatePicture(0, pDraw, pFormat,
+ CPSubwindowMode, &subwindow_mode,
+ serverClient, &error);
*ppPicture = pPicture;
return pPicture;
}
#endif
static miDCCursorPtr
-miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
+miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
{
- miDCCursorPtr pPriv;
- GCPtr pGC;
- ChangeGCVal gcvals;
+ miDCCursorPtr pPriv;
+ GCPtr pGC;
+ ChangeGCVal gcvals;
- pPriv = malloc(sizeof (miDCCursorRec));
+ pPriv = malloc(sizeof(miDCCursorRec));
if (!pPriv)
- return NULL;
+ return NULL;
#ifdef ARGB_CURSOR
- if (pCursor->bits->argb)
- {
- PixmapPtr pPixmap;
- PictFormatPtr pFormat;
- int error;
-
- pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
- if (!pFormat)
- {
- free((pointer) pPriv);
- return NULL;
- }
-
- pPriv->sourceBits = 0;
- pPriv->maskBits = 0;
- pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width,
- pCursor->bits->height, 32,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap)
- {
- free((pointer) pPriv);
- return NULL;
- }
- pGC = GetScratchGC (32, pScreen);
- if (!pGC)
- {
- (*pScreen->DestroyPixmap) (pPixmap);
- free((pointer) pPriv);
- return NULL;
- }
- ValidateGC (&pPixmap->drawable, pGC);
- (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32,
- 0, 0, pCursor->bits->width,
- pCursor->bits->height,
- 0, ZPixmap, (char *) pCursor->bits->argb);
- FreeScratchGC (pGC);
- pPriv->pPicture = CreatePicture (0, &pPixmap->drawable,
- pFormat, 0, 0, serverClient, &error);
+ if (pCursor->bits->argb) {
+ PixmapPtr pPixmap;
+ PictFormatPtr pFormat;
+ int error;
+
+ pFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8);
+ if (!pFormat) {
+ free((pointer) pPriv);
+ return NULL;
+ }
+
+ pPriv->sourceBits = 0;
+ pPriv->maskBits = 0;
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width,
+ pCursor->bits->height, 32,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pPixmap) {
+ free((pointer) pPriv);
+ return NULL;
+ }
+ pGC = GetScratchGC(32, pScreen);
+ if (!pGC) {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ free((pointer) pPriv);
+ return NULL;
+ }
+ ValidateGC(&pPixmap->drawable, pGC);
+ (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32,
+ 0, 0, pCursor->bits->width,
+ pCursor->bits->height,
+ 0, ZPixmap, (char *) pCursor->bits->argb);
+ FreeScratchGC(pGC);
+ pPriv->pPicture = CreatePicture(0, &pPixmap->drawable,
+ pFormat, 0, 0, serverClient, &error);
(*pScreen->DestroyPixmap) (pPixmap);
- if (!pPriv->pPicture)
- {
- free((pointer) pPriv);
- return NULL;
- }
- dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, pPriv);
- return pPriv;
+ if (!pPriv->pPicture) {
+ free((pointer) pPriv);
+ return NULL;
+ }
+ dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey,
+ pScreen, pPriv);
+ return pPriv;
}
pPriv->pPicture = 0;
#endif
- pPriv->sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0);
- if (!pPriv->sourceBits)
- {
- free((pointer) pPriv);
- return NULL;
+ pPriv->sourceBits =
+ (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width,
+ pCursor->bits->height, 1, 0);
+ if (!pPriv->sourceBits) {
+ free((pointer) pPriv);
+ return NULL;
}
- pPriv->maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0);
- if (!pPriv->maskBits)
- {
- (*pScreen->DestroyPixmap) (pPriv->sourceBits);
- free((pointer) pPriv);
- return NULL;
+ pPriv->maskBits =
+ (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width,
+ pCursor->bits->height, 1, 0);
+ if (!pPriv->maskBits) {
+ (*pScreen->DestroyPixmap) (pPriv->sourceBits);
+ free((pointer) pPriv);
+ return NULL;
}
- dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, pPriv);
+ dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen,
+ pPriv);
/* create the two sets of bits, clipping as appropriate */
- pGC = GetScratchGC (1, pScreen);
- if (!pGC)
- {
- (void) miDCUnrealizeCursor (pScreen, pCursor);
- return NULL;
+ pGC = GetScratchGC(1, pScreen);
+ if (!pGC) {
+ (void) miDCUnrealizeCursor(pScreen, pCursor);
+ return NULL;
}
- ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC);
- (*pGC->ops->PutImage) ((DrawablePtr)pPriv->sourceBits, pGC, 1,
- 0, 0, pCursor->bits->width, pCursor->bits->height,
- 0, XYPixmap, (char *)pCursor->bits->source);
+ ValidateGC((DrawablePtr) pPriv->sourceBits, pGC);
+ (*pGC->ops->PutImage) ((DrawablePtr) pPriv->sourceBits, pGC, 1,
+ 0, 0, pCursor->bits->width, pCursor->bits->height,
+ 0, XYPixmap, (char *) pCursor->bits->source);
gcvals.val = GXand;
- ChangeGC (NullClient, pGC, GCFunction, &gcvals);
- ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC);
- (*pGC->ops->PutImage) ((DrawablePtr)pPriv->sourceBits, pGC, 1,
- 0, 0, pCursor->bits->width, pCursor->bits->height,
- 0, XYPixmap, (char *)pCursor->bits->mask);
+ ChangeGC(NullClient, pGC, GCFunction, &gcvals);
+ ValidateGC((DrawablePtr) pPriv->sourceBits, pGC);
+ (*pGC->ops->PutImage) ((DrawablePtr) pPriv->sourceBits, pGC, 1,
+ 0, 0, pCursor->bits->width, pCursor->bits->height,
+ 0, XYPixmap, (char *) pCursor->bits->mask);
/* mask bits -- pCursor->mask & ~pCursor->source */
gcvals.val = GXcopy;
- ChangeGC (NullClient, pGC, GCFunction, &gcvals);
- ValidateGC ((DrawablePtr)pPriv->maskBits, pGC);
- (*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1,
- 0, 0, pCursor->bits->width, pCursor->bits->height,
- 0, XYPixmap, (char *)pCursor->bits->mask);
+ ChangeGC(NullClient, pGC, GCFunction, &gcvals);
+ ValidateGC((DrawablePtr) pPriv->maskBits, pGC);
+ (*pGC->ops->PutImage) ((DrawablePtr) pPriv->maskBits, pGC, 1,
+ 0, 0, pCursor->bits->width, pCursor->bits->height,
+ 0, XYPixmap, (char *) pCursor->bits->mask);
gcvals.val = GXandInverted;
- ChangeGC (NullClient, pGC, GCFunction, &gcvals);
- ValidateGC ((DrawablePtr)pPriv->maskBits, pGC);
- (*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1,
- 0, 0, pCursor->bits->width, pCursor->bits->height,
- 0, XYPixmap, (char *)pCursor->bits->source);
- FreeScratchGC (pGC);
+ ChangeGC(NullClient, pGC, GCFunction, &gcvals);
+ ValidateGC((DrawablePtr) pPriv->maskBits, pGC);
+ (*pGC->ops->PutImage) ((DrawablePtr) pPriv->maskBits, pGC, 1,
+ 0, 0, pCursor->bits->width, pCursor->bits->height,
+ 0, XYPixmap, (char *) pCursor->bits->source);
+ FreeScratchGC(pGC);
return pPriv;
}
Bool
-miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
+miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
- miDCCursorPtr pPriv;
-
- pPriv = (miDCCursorPtr)dixLookupScreenPrivate(&pCursor->bits->devPrivates,
- miDCCursorBitsKey, pScreen);
- if (pPriv && (pCursor->bits->refcnt <= 1))
- {
- if (pPriv->sourceBits)
- (*pScreen->DestroyPixmap) (pPriv->sourceBits);
- if (pPriv->maskBits)
- (*pScreen->DestroyPixmap) (pPriv->maskBits);
+ miDCCursorPtr pPriv;
+
+ pPriv = (miDCCursorPtr) dixLookupScreenPrivate(&pCursor->bits->devPrivates,
+ miDCCursorBitsKey, pScreen);
+ if (pPriv && (pCursor->bits->refcnt <= 1)) {
+ if (pPriv->sourceBits)
+ (*pScreen->DestroyPixmap) (pPriv->sourceBits);
+ if (pPriv->maskBits)
+ (*pScreen->DestroyPixmap) (pPriv->maskBits);
#ifdef ARGB_CURSOR
- if (pPriv->pPicture)
- FreePicture (pPriv->pPicture, 0);
+ if (pPriv->pPicture)
+ FreePicture(pPriv->pPicture, 0);
#endif
- free((pointer) pPriv);
- dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, NULL);
+ free((pointer) pPriv);
+ dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey,
+ pScreen, NULL);
}
return TRUE;
}
static void
-miDCPutBits (
- DrawablePtr pDrawable,
- miDCCursorPtr pPriv,
- GCPtr sourceGC,
- GCPtr maskGC,
- int x_org,
- int y_org,
- unsigned w,
- unsigned h,
- unsigned long source,
- unsigned long mask)
+miDCPutBits(DrawablePtr pDrawable,
+ miDCCursorPtr pPriv,
+ GCPtr sourceGC,
+ GCPtr maskGC,
+ int x_org,
+ int y_org,
+ unsigned w, unsigned h, unsigned long source, unsigned long mask)
{
ChangeGCVal gcval;
- int x, y;
+ int x, y;
- if (sourceGC->fgPixel != source)
- {
- gcval.val = source;
- ChangeGC (NullClient, sourceGC, GCForeground, &gcval);
+ if (sourceGC->fgPixel != source) {
+ gcval.val = source;
+ ChangeGC(NullClient, sourceGC, GCForeground, &gcval);
}
if (sourceGC->serialNumber != pDrawable->serialNumber)
- ValidateGC (pDrawable, sourceGC);
+ ValidateGC(pDrawable, sourceGC);
- if(sourceGC->miTranslate)
- {
+ if (sourceGC->miTranslate) {
x = pDrawable->x + x_org;
y = pDrawable->y + y_org;
- }
- else
- {
+ }
+ else {
x = x_org;
y = y_org;
}
- (*sourceGC->ops->PushPixels) (sourceGC, pPriv->sourceBits, pDrawable, w, h, x, y);
- if (maskGC->fgPixel != mask)
- {
- gcval.val = mask;
- ChangeGC (NullClient, maskGC, GCForeground, &gcval);
+ (*sourceGC->ops->PushPixels) (sourceGC, pPriv->sourceBits, pDrawable, w, h,
+ x, y);
+ if (maskGC->fgPixel != mask) {
+ gcval.val = mask;
+ ChangeGC(NullClient, maskGC, GCForeground, &gcval);
}
if (maskGC->serialNumber != pDrawable->serialNumber)
- ValidateGC (pDrawable, maskGC);
+ ValidateGC(pDrawable, maskGC);
- if(maskGC->miTranslate)
- {
+ if (maskGC->miTranslate) {
x = pDrawable->x + x_org;
y = pDrawable->y + y_org;
- }
- else
- {
+ }
+ else {
x = x_org;
y = y_org;
}
@@ -381,137 +374,131 @@ static GCPtr
miDCMakeGC(WindowPtr pWin)
{
GCPtr pGC;
- int status;
- XID gcvals[2];
+ int status;
+ XID gcvals[2];
gcvals[0] = IncludeInferiors;
gcvals[1] = FALSE;
- pGC = CreateGC((DrawablePtr)pWin,
- GCSubwindowMode|GCGraphicsExposures, gcvals, &status,
- (XID)0, serverClient);
+ pGC = CreateGC((DrawablePtr) pWin,
+ GCSubwindowMode | GCGraphicsExposures, gcvals, &status,
+ (XID) 0, serverClient);
return pGC;
}
-
Bool
-miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
- int x, int y, unsigned long source, unsigned long mask)
+miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
+ int x, int y, unsigned long source, unsigned long mask)
{
- miDCCursorPtr pPriv;
- miDCBufferPtr pBuffer;
- WindowPtr pWin;
-
- pPriv = (miDCCursorPtr)dixLookupScreenPrivate(&pCursor->bits->devPrivates,
- miDCCursorBitsKey, pScreen);
- if (!pPriv)
- {
- pPriv = miDCRealize(pScreen, pCursor);
- if (!pPriv)
- return FALSE;
+ miDCCursorPtr pPriv;
+ miDCBufferPtr pBuffer;
+ WindowPtr pWin;
+
+ pPriv = (miDCCursorPtr) dixLookupScreenPrivate(&pCursor->bits->devPrivates,
+ miDCCursorBitsKey, pScreen);
+ if (!pPriv) {
+ pPriv = miDCRealize(pScreen, pCursor);
+ if (!pPriv)
+ return FALSE;
}
pWin = pScreen->root;
pBuffer = miGetDCDevice(pDev, pScreen);
#ifdef ARGB_CURSOR
- if (pPriv->pPicture)
- {
- if (!EnsurePicture(pBuffer->pRootPicture, &pWin->drawable, pWin))
- return FALSE;
- CompositePicture (PictOpOver,
- pPriv->pPicture,
- NULL,
- pBuffer->pRootPicture,
- 0, 0, 0, 0,
- x, y,
- pCursor->bits->width,
- pCursor->bits->height);
+ if (pPriv->pPicture) {
+ if (!EnsurePicture(pBuffer->pRootPicture, &pWin->drawable, pWin))
+ return FALSE;
+ CompositePicture(PictOpOver,
+ pPriv->pPicture,
+ NULL,
+ pBuffer->pRootPicture,
+ 0, 0, 0, 0,
+ x, y, pCursor->bits->width, pCursor->bits->height);
}
else
#endif
{
- miDCPutBits ((DrawablePtr)pWin, pPriv,
- pBuffer->pSourceGC, pBuffer->pMaskGC,
- x, y, pCursor->bits->width, pCursor->bits->height,
- source, mask);
+ miDCPutBits((DrawablePtr) pWin, pPriv,
+ pBuffer->pSourceGC, pBuffer->pMaskGC,
+ x, y, pCursor->bits->width, pCursor->bits->height,
+ source, mask);
}
return TRUE;
}
Bool
-miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
- int x, int y, int w, int h)
+miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y, int w, int h)
{
- miDCBufferPtr pBuffer;
- PixmapPtr pSave;
- WindowPtr pWin;
- GCPtr pGC;
+ miDCBufferPtr pBuffer;
+ PixmapPtr pSave;
+ WindowPtr pWin;
+ GCPtr pGC;
pBuffer = miGetDCDevice(pDev, pScreen);
pSave = pBuffer->pSave;
pWin = pScreen->root;
- if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h)
- {
- if (pSave)
- (*pScreen->DestroyPixmap) (pSave);
- pBuffer->pSave = pSave =
- (*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth, 0);
- if (!pSave)
- return FALSE;
+ if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) {
+ if (pSave)
+ (*pScreen->DestroyPixmap) (pSave);
+ pBuffer->pSave = pSave =
+ (*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth, 0);
+ if (!pSave)
+ return FALSE;
}
pGC = pBuffer->pSaveGC;
if (pSave->drawable.serialNumber != pGC->serialNumber)
- ValidateGC ((DrawablePtr) pSave, pGC);
+ ValidateGC((DrawablePtr) pSave, pGC);
(*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC,
- x, y, w, h, 0, 0);
+ x, y, w, h, 0, 0);
return TRUE;
}
Bool
-miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
- int x, int y, int w, int h)
+miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y, int w, int h)
{
- miDCBufferPtr pBuffer;
- PixmapPtr pSave;
- WindowPtr pWin;
- GCPtr pGC;
+ miDCBufferPtr pBuffer;
+ PixmapPtr pSave;
+ WindowPtr pWin;
+ GCPtr pGC;
pBuffer = miGetDCDevice(pDev, pScreen);
pSave = pBuffer->pSave;
pWin = pScreen->root;
if (!pSave)
- return FALSE;
+ return FALSE;
pGC = pBuffer->pRestoreGC;
if (pWin->drawable.serialNumber != pGC->serialNumber)
- ValidateGC ((DrawablePtr) pWin, pGC);
+ ValidateGC((DrawablePtr) pWin, pGC);
(*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC,
- 0, 0, w, h, x, y);
+ 0, 0, w, h, x, y);
return TRUE;
}
Bool
miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- miDCBufferPtr pBuffer;
- WindowPtr pWin;
- int i;
+ miDCBufferPtr pBuffer;
+ WindowPtr pWin;
+ int i;
if (!DevHasCursor(pDev))
return TRUE;
- for (i = 0; i < screenInfo.numScreens; i++)
- {
+ for (i = 0; i < screenInfo.numScreens; i++) {
pScreen = screenInfo.screens[i];
pBuffer = calloc(1, sizeof(miDCBufferRec));
if (!pBuffer)
goto failure;
- dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, pBuffer);
+ dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen,
+ pBuffer);
pWin = pScreen->root;
pBuffer->pSourceGC = miDCMakeGC(pWin);
@@ -540,7 +527,7 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
return TRUE;
-failure:
+ failure:
miDCDeviceCleanup(pDev, pScreen);
@@ -550,23 +537,24 @@ failure:
void
miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- miDCBufferPtr pBuffer;
- int i;
+ miDCBufferPtr pBuffer;
+ int i;
- if (DevHasCursor(pDev))
- {
- for (i = 0; i < screenInfo.numScreens; i++)
- {
+ if (DevHasCursor(pDev)) {
+ for (i = 0; i < screenInfo.numScreens; i++) {
pScreen = screenInfo.screens[i];
pBuffer = miGetDCDevice(pDev, pScreen);
- if (pBuffer)
- {
- if (pBuffer->pSourceGC) FreeGC(pBuffer->pSourceGC, (GContext) 0);
- if (pBuffer->pMaskGC) FreeGC(pBuffer->pMaskGC, (GContext) 0);
- if (pBuffer->pSaveGC) FreeGC(pBuffer->pSaveGC, (GContext) 0);
- if (pBuffer->pRestoreGC) FreeGC(pBuffer->pRestoreGC, (GContext) 0);
+ if (pBuffer) {
+ if (pBuffer->pSourceGC)
+ FreeGC(pBuffer->pSourceGC, (GContext) 0);
+ if (pBuffer->pMaskGC)
+ FreeGC(pBuffer->pMaskGC, (GContext) 0);
+ if (pBuffer->pSaveGC)
+ FreeGC(pBuffer->pSaveGC, (GContext) 0);
+ if (pBuffer->pRestoreGC)
+ FreeGC(pBuffer->pRestoreGC, (GContext) 0);
#ifdef ARGB_CURSOR
/* If a pRootPicture was allocated for a root window, it
@@ -574,10 +562,12 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
* free it again here. */
#endif
- if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave);
+ if (pBuffer->pSave)
+ (*pScreen->DestroyPixmap) (pBuffer->pSave);
free(pBuffer);
- dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, NULL);
+ dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen,
+ NULL);
}
}
}
diff --git a/xorg-server/mi/mieq.c b/xorg-server/mi/mieq.c
index 6c46eb9fe..e117a8db7 100644
--- a/xorg-server/mi/mieq.c
+++ b/xorg-server/mi/mieq.c
@@ -36,27 +36,27 @@ in this Software without prior written authorization from The Open Group.
#include <dix-config.h>
#endif
-# include <X11/X.h>
-# include <X11/Xmd.h>
-# include <X11/Xproto.h>
-# include "misc.h"
-# include "windowstr.h"
-# include "pixmapstr.h"
-# include "inputstr.h"
-# include "inpututils.h"
-# include "mi.h"
-# include "mipointer.h"
-# include "scrnintstr.h"
-# include <X11/extensions/XI.h>
-# include <X11/extensions/XIproto.h>
-# include <X11/extensions/geproto.h>
-# include "extinit.h"
-# include "exglobals.h"
-# include "eventstr.h"
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "inputstr.h"
+#include "inpututils.h"
+#include "mi.h"
+#include "mipointer.h"
+#include "scrnintstr.h"
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/extensions/geproto.h>
+#include "extinit.h"
+#include "exglobals.h"
+#include "eventstr.h"
#ifdef DPMSExtension
-# include "dpmsproc.h"
-# include <X11/extensions/dpmsconst.h>
+#include "dpmsproc.h"
+#include <X11/extensions/dpmsconst.h>
#endif
/* Maximum size should be initial size multiplied by a power of 2 */
@@ -70,19 +70,19 @@ in this Software without prior written authorization from The Open Group.
#define DequeueScreen(dev) dev->spriteInfo->sprite->pDequeueScreen
typedef struct _Event {
- InternalEvent* events;
- ScreenPtr pScreen;
- DeviceIntPtr pDev; /* device this event _originated_ from */
+ InternalEvent *events;
+ ScreenPtr pScreen;
+ DeviceIntPtr pDev; /* device this event _originated_ from */
} EventRec, *EventPtr;
typedef struct _EventQueue {
- HWEventQueueType head, tail; /* long for SetInputCheck */
- CARD32 lastEventTime; /* to avoid time running backwards */
- int lastMotion; /* device ID if last event motion? */
- EventRec *events; /* our queue as an array */
- size_t nevents; /* the number of buckets in our queue */
- size_t dropped; /* counter for number of consecutive dropped events */
- mieqHandler handlers[128]; /* custom event handler */
+ HWEventQueueType head, tail; /* long for SetInputCheck */
+ CARD32 lastEventTime; /* to avoid time running backwards */
+ int lastMotion; /* device ID if last event motion? */
+ EventRec *events; /* our queue as an array */
+ size_t nevents; /* the number of buckets in our queue */
+ size_t dropped; /* counter for number of consecutive dropped events */
+ mieqHandler handlers[128]; /* custom event handler */
} EventQueueRec, *EventQueuePtr;
static EventQueueRec miEventQueue;
@@ -95,11 +95,13 @@ extern BOOL serverRunning;
extern pthread_mutex_t serverRunningMutex;
extern pthread_cond_t serverRunningCond;
-static inline void wait_for_server_init(void) {
+static inline void
+wait_for_server_init(void)
+{
/* If the server hasn't finished initializing, wait for it... */
- if(!serverRunning) {
+ if (!serverRunning) {
pthread_mutex_lock(&serverRunningMutex);
- while(!serverRunning)
+ while (!serverRunning)
pthread_cond_wait(&serverRunningCond, &serverRunningMutex);
pthread_mutex_unlock(&serverRunningMutex);
}
@@ -107,8 +109,10 @@ static inline void wait_for_server_init(void) {
#endif
static size_t
-mieqNumEnqueued(EventQueuePtr eventQueue) {
+mieqNumEnqueued(EventQueuePtr eventQueue)
+{
size_t n_enqueued = 0;
+
if (eventQueue->nevents) {
/* % is not well-defined with negative numbers... sigh */
n_enqueued = eventQueue->tail - eventQueue->head + eventQueue->nevents;
@@ -120,7 +124,8 @@ mieqNumEnqueued(EventQueuePtr eventQueue) {
/* Pre-condition: Called with miEventQueueMutex held */
static Bool
-mieqGrowQueue(EventQueuePtr eventQueue, size_t new_nevents) {
+mieqGrowQueue(EventQueuePtr eventQueue, size_t new_nevents)
+{
size_t i, n_enqueued, first_hunk;
EventRec *new_events;
@@ -151,14 +156,15 @@ mieqGrowQueue(EventQueuePtr eventQueue, size_t new_nevents) {
&eventQueue->events[eventQueue->head],
first_hunk * sizeof(EventRec));
memcpy(&new_events[first_hunk],
- eventQueue->events,
- eventQueue->head * sizeof(EventRec));
+ eventQueue->events, eventQueue->head * sizeof(EventRec));
/* Initialize the new portion */
for (i = eventQueue->nevents; i < new_nevents; i++) {
- InternalEvent* evlist = InitEventList(1);
+ InternalEvent *evlist = InitEventList(1);
+
if (!evlist) {
size_t j;
+
for (j = 0; j < i; j++)
FreeEventList(new_events[j].events, 1);
free(new_events);
@@ -183,10 +189,10 @@ Bool
mieqInit(void)
{
memset(&miEventQueue, 0, sizeof(miEventQueue));
- miEventQueue.lastEventTime = GetTimeInMillis ();
+ miEventQueue.lastEventTime = GetTimeInMillis();
- if(!mieqGrowQueue(&miEventQueue, QUEUE_INITIAL_SIZE))
- FatalError("Could not allocate event queue.\n");
+ if (!mieqGrowQueue(&miEventQueue, QUEUE_INITIAL_SIZE))
+ FatalError("Could not allocate event queue.\n");
SetInputCheck(&miEventQueue.head, &miEventQueue.tail);
return TRUE;
@@ -196,12 +202,12 @@ void
mieqFini(void)
{
int i;
- for (i = 0; i < miEventQueue.nevents; i++)
- {
- if (miEventQueue.events[i].events != NULL) {
- FreeEventList(miEventQueue.events[i].events, 1);
- miEventQueue.events[i].events = NULL;
- }
+
+ for (i = 0; i < miEventQueue.nevents; i++) {
+ if (miEventQueue.events[i].events != NULL) {
+ FreeEventList(miEventQueue.events[i].events, 1);
+ miEventQueue.events[i].events = NULL;
+ }
}
free(miEventQueue.events);
}
@@ -210,19 +216,20 @@ mieqFini(void)
* queue space.
*/
static Bool
-mieqReservedCandidate(InternalEvent *e) {
- switch(e->any.type) {
- case ET_KeyRelease:
- case ET_ButtonRelease:
+mieqReservedCandidate(InternalEvent *e)
+{
+ switch (e->any.type) {
+ case ET_KeyRelease:
+ case ET_ButtonRelease:
#if XFreeXDGA
- case ET_DGAEvent:
+ case ET_DGAEvent:
#endif
- case ET_RawKeyRelease:
- case ET_RawButtonRelease:
- case ET_XQuartz:
- return TRUE;
- default:
- return FALSE;
+ case ET_RawKeyRelease:
+ case ET_RawButtonRelease:
+ case ET_XQuartz:
+ return TRUE;
+ default:
+ return FALSE;
}
}
@@ -236,12 +243,12 @@ mieqReservedCandidate(InternalEvent *e) {
void
mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e)
{
- unsigned int oldtail = miEventQueue.tail;
- InternalEvent* evt;
- int isMotion = 0;
- int evlen;
- Time time;
- size_t n_enqueued;
+ unsigned int oldtail = miEventQueue.tail;
+ InternalEvent *evt;
+ int isMotion = 0;
+ int evlen;
+ Time time;
+ size_t n_enqueued;
#ifdef XQUARTZ
wait_for_server_init();
@@ -259,23 +266,33 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e)
if (isMotion && isMotion == miEventQueue.lastMotion &&
oldtail != miEventQueue.head) {
oldtail = (oldtail - 1) % miEventQueue.nevents;
- } else if ((n_enqueued + 1 == miEventQueue.nevents) ||
- ((n_enqueued + 1 >= miEventQueue.nevents - QUEUE_RESERVED_SIZE) && !mieqReservedCandidate(e))) {
+ }
+ else if ((n_enqueued + 1 == miEventQueue.nevents) ||
+ ((n_enqueued + 1 >= miEventQueue.nevents - QUEUE_RESERVED_SIZE) &&
+ !mieqReservedCandidate(e))) {
/* Toss events which come in late. Usually this means your server's
* stuck in an infinite loop somewhere, but SIGIO is still getting
* handled.
*/
miEventQueue.dropped++;
if (miEventQueue.dropped == 1) {
- ErrorF("[mi] EQ overflowing. Additional events will be discarded until existing events are processed.\n");
+ ErrorF
+ ("[mi] EQ overflowing. Additional events will be discarded until existing events are processed.\n");
xorg_backtrace();
- ErrorF("[mi] These backtraces from mieqEnqueue may point to a culprit higher up the stack.\n");
+ ErrorF
+ ("[mi] These backtraces from mieqEnqueue may point to a culprit higher up the stack.\n");
ErrorF("[mi] mieq is *NOT* the cause. It is a victim.\n");
- } else if (miEventQueue.dropped % QUEUE_DROP_BACKTRACE_FREQUENCY == 0 &&
- miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY <= QUEUE_DROP_BACKTRACE_MAX) {
- ErrorF("[mi] EQ overflow continuing. %lu events have been dropped.\n", miEventQueue.dropped);
- if (miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY == QUEUE_DROP_BACKTRACE_MAX) {
- ErrorF("[mi] No further overflow reports will be reported until the clog is cleared.\n");
+ }
+ else if (miEventQueue.dropped % QUEUE_DROP_BACKTRACE_FREQUENCY == 0 &&
+ miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY <=
+ QUEUE_DROP_BACKTRACE_MAX) {
+ ErrorF
+ ("[mi] EQ overflow continuing. %lu events have been dropped.\n",
+ miEventQueue.dropped);
+ if (miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY ==
+ QUEUE_DROP_BACKTRACE_MAX) {
+ ErrorF
+ ("[mi] No further overflow reports will be reported until the clog is cleared.\n");
}
xorg_backtrace();
}
@@ -357,61 +374,60 @@ mieqSetHandler(int event, mieqHandler handler)
* Change the device id of the given event to the given device's id.
*/
static void
-ChangeDeviceID(DeviceIntPtr dev, InternalEvent* event)
+ChangeDeviceID(DeviceIntPtr dev, InternalEvent *event)
{
- switch(event->any.type)
- {
- case ET_Motion:
- case ET_KeyPress:
- case ET_KeyRelease:
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_ProximityIn:
- case ET_ProximityOut:
- case ET_Hierarchy:
- case ET_DeviceChanged:
- case ET_TouchBegin:
- case ET_TouchUpdate:
- case ET_TouchEnd:
- event->device_event.deviceid = dev->id;
- break;
- case ET_TouchOwnership:
- event->touch_ownership_event.deviceid = dev->id;
- break;
+ switch (event->any.type) {
+ case ET_Motion:
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ case ET_Hierarchy:
+ case ET_DeviceChanged:
+ case ET_TouchBegin:
+ case ET_TouchUpdate:
+ case ET_TouchEnd:
+ event->device_event.deviceid = dev->id;
+ break;
+ case ET_TouchOwnership:
+ event->touch_ownership_event.deviceid = dev->id;
+ break;
#if XFreeXDGA
- case ET_DGAEvent:
- break;
+ case ET_DGAEvent:
+ break;
#endif
- case ET_RawKeyPress:
- case ET_RawKeyRelease:
- case ET_RawButtonPress:
- case ET_RawButtonRelease:
- case ET_RawMotion:
- case ET_RawTouchBegin:
- case ET_RawTouchEnd:
- case ET_RawTouchUpdate:
- event->raw_event.deviceid = dev->id;
- break;
- default:
- ErrorF("[mi] Unknown event type (%d), cannot change id.\n",
- event->any.type);
+ case ET_RawKeyPress:
+ case ET_RawKeyRelease:
+ case ET_RawButtonPress:
+ case ET_RawButtonRelease:
+ case ET_RawMotion:
+ case ET_RawTouchBegin:
+ case ET_RawTouchEnd:
+ case ET_RawTouchUpdate:
+ event->raw_event.deviceid = dev->id;
+ break;
+ default:
+ ErrorF("[mi] Unknown event type (%d), cannot change id.\n",
+ event->any.type);
}
}
static void
FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev,
- InternalEvent* original, InternalEvent *master)
+ InternalEvent *original, InternalEvent *master)
{
verify_internal_event(original);
verify_internal_event(master);
/* Ensure chained button mappings, i.e. that the detail field is the
* value of the mapped button on the SD, not the physical button */
if (original->any.type == ET_ButtonPress ||
- original->any.type == ET_ButtonRelease)
- {
+ original->any.type == ET_ButtonRelease) {
int btn = original->device_event.detail.button;
+
if (!sdev->button)
- return; /* Should never happen */
+ return; /* Should never happen */
master->device_event.detail.button = sdev->button->map[btn];
}
@@ -426,12 +442,12 @@ FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev,
*/
DeviceIntPtr
CopyGetMasterEvent(DeviceIntPtr sdev,
- InternalEvent* original, InternalEvent *copy)
+ InternalEvent *original, InternalEvent *copy)
{
DeviceIntPtr mdev;
int len = original->any.length;
int type = original->any.type;
- int mtype; /* which master type? */
+ int mtype; /* which master type? */
verify_internal_event(original);
@@ -444,22 +460,21 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
type = original->dga_event.subtype;
#endif
- switch(type)
- {
- case ET_KeyPress:
- case ET_KeyRelease:
- mtype = MASTER_KEYBOARD;
- break;
- case ET_ButtonPress:
- case ET_ButtonRelease:
- case ET_Motion:
- case ET_ProximityIn:
- case ET_ProximityOut:
- mtype = MASTER_POINTER;
- break;
- default:
- mtype = MASTER_ATTACHED;
- break;
+ switch (type) {
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ mtype = MASTER_KEYBOARD;
+ break;
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_Motion:
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ mtype = MASTER_POINTER;
+ break;
+ default:
+ mtype = MASTER_ATTACHED;
+ break;
}
mdev = GetMaster(sdev, mtype);
@@ -470,17 +485,16 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
return mdev;
}
-
static void
mieqMoveToNewScreen(DeviceIntPtr dev, ScreenPtr screen, DeviceEvent *event)
{
- if (dev && screen && screen != DequeueScreen(dev))
- {
+ if (dev && screen && screen != DequeueScreen(dev)) {
int x = 0, y = 0;
+
DequeueScreen(dev) = screen;
x = event->root_x;
y = event->root_y;
- NewCurrentScreen (dev, DequeueScreen(dev), x, y);
+ NewCurrentScreen(dev, DequeueScreen(dev), x, y);
}
}
@@ -490,13 +504,11 @@ mieqMoveToNewScreen(DeviceIntPtr dev, ScreenPtr screen, DeviceEvent *event)
* usual event processing cycle.
*/
void
-mieqProcessDeviceEvent(DeviceIntPtr dev,
- InternalEvent *event,
- ScreenPtr screen)
+mieqProcessDeviceEvent(DeviceIntPtr dev, InternalEvent *event, ScreenPtr screen)
{
mieqHandler handler;
DeviceIntPtr master;
- InternalEvent mevent; /* master event */
+ InternalEvent mevent; /* master event */
verify_internal_event(event);
@@ -506,22 +518,22 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
switch (event->any.type) {
/* Catch events that include valuator information and check if they
* are changing the screen */
- case ET_Motion:
- case ET_KeyPress:
- case ET_KeyRelease:
- case ET_ButtonPress:
- case ET_ButtonRelease:
- if (!handler)
- mieqMoveToNewScreen(dev, screen, &event->device_event);
- break;
- case ET_TouchBegin:
- case ET_TouchUpdate:
- case ET_TouchEnd:
- if (!handler && (event->device_event.flags & TOUCH_POINTER_EMULATED))
- mieqMoveToNewScreen(dev, screen, &event->device_event);
- break;
- default:
- break;
+ case ET_Motion:
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ if (!handler)
+ mieqMoveToNewScreen(dev, screen, &event->device_event);
+ break;
+ case ET_TouchBegin:
+ case ET_TouchUpdate:
+ case ET_TouchEnd:
+ if (!handler && (event->device_event.flags & TOUCH_POINTER_EMULATED))
+ mieqMoveToNewScreen(dev, screen, &event->device_event);
+ break;
+ default:
+ break;
}
master = CopyGetMasterEvent(dev, event, &mevent);
@@ -530,16 +542,17 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
/* If someone's registered a custom event handler, let them
* steal it. */
- if (handler)
- {
- int screenNum = dev && DequeueScreen(dev) ? DequeueScreen(dev)->myNum : (screen ? screen->myNum : 0);
+ if (handler) {
+ int screenNum = dev &&
+ DequeueScreen(dev) ? DequeueScreen(dev)->myNum : (screen ? screen->
+ myNum : 0);
handler(screenNum, event, dev);
/* Check for the SD's master in case the device got detached
* during event processing */
if (master && !IsFloating(dev))
handler(screenNum, &mevent, master);
- } else
- {
+ }
+ else {
/* process slave first, then master */
dev->public.processInputProc(event, dev);
@@ -557,8 +570,7 @@ mieqProcessInputEvents(void)
EventRec *e = NULL;
ScreenPtr screen;
static InternalEvent event;
- DeviceIntPtr dev = NULL,
- master = NULL;
+ DeviceIntPtr dev = NULL, master = NULL;
size_t n_enqueued;
#ifdef XQUARTZ
@@ -569,15 +581,18 @@ mieqProcessInputEvents(void)
n_enqueued = mieqNumEnqueued(&miEventQueue);
if (n_enqueued >= (miEventQueue.nevents - (2 * QUEUE_RESERVED_SIZE)) &&
miEventQueue.nevents < QUEUE_MAXIMUM_SIZE) {
- ErrorF("[mi] Increasing EQ size to %lu to prevent dropped events.\n", miEventQueue.nevents << 1);
+ ErrorF("[mi] Increasing EQ size to %lu to prevent dropped events.\n",
+ miEventQueue.nevents << 1);
if (!mieqGrowQueue(&miEventQueue, miEventQueue.nevents << 1)) {
ErrorF("[mi] Increasing the size of EQ failed.\n");
}
}
if (miEventQueue.dropped) {
- ErrorF("[mi] EQ processing has resumed after %lu dropped events.\n", miEventQueue.dropped);
- ErrorF("[mi] This may be caused my a misbehaving driver monopolizing the server's resources.\n");
+ ErrorF("[mi] EQ processing has resumed after %lu dropped events.\n",
+ miEventQueue.dropped);
+ ErrorF
+ ("[mi] This may be caused my a misbehaving driver monopolizing the server's resources.\n");
miEventQueue.dropped = 0;
}
@@ -585,8 +600,8 @@ mieqProcessInputEvents(void)
e = &miEventQueue.events[miEventQueue.head];
event = *e->events;
- dev = e->pDev;
- screen = e->pScreen;
+ dev = e->pDev;
+ screen = e->pScreen;
miEventQueue.head = (miEventQueue.head + 1) % miEventQueue.nevents;
@@ -597,7 +612,7 @@ mieqProcessInputEvents(void)
master = (dev) ? GetMaster(dev, MASTER_ATTACHED) : NULL;
if (screenIsSaved == SCREEN_SAVER_ON)
- dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
+ dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
#ifdef DPMSExtension
else if (DPMSPowerLevel != DPMSModeOn)
SetScreenSaverTimer();
@@ -620,4 +635,3 @@ mieqProcessInputEvents(void)
pthread_mutex_unlock(&miEventQueueMutex);
#endif
}
-
diff --git a/xorg-server/mi/miexpose.c b/xorg-server/mi/miexpose.c
index 0f1ebe59c..dbb29ca4a 100644
--- a/xorg-server/mi/miexpose.c
+++ b/xorg-server/mi/miexpose.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -72,7 +71,6 @@ Equipment Corporation.
******************************************************************/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -106,7 +104,7 @@ the region package can call this.
*/
#ifndef RECTLIMIT
-#define RECTLIMIT 25 /* pick a number, any number > 8 */
+#define RECTLIMIT 25 /* pick a number, any number > 8 */
#endif
/* miHandleExposures
@@ -128,131 +126,118 @@ exposing is done by the backing store's GraphicsExpose function, of course.
RegionPtr
miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GCPtr pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long plane)
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long plane)
{
- RegionPtr prgnSrcClip; /* drawable-relative source clip */
+ RegionPtr prgnSrcClip; /* drawable-relative source clip */
RegionRec rgnSrcRec;
- RegionPtr prgnDstClip; /* drawable-relative dest clip */
+ RegionPtr prgnDstClip; /* drawable-relative dest clip */
RegionRec rgnDstRec;
- BoxRec srcBox; /* unclipped source */
- RegionRec rgnExposed; /* exposed region, calculated source-
- relative, made dst relative to
- intersect with visible parts of
- dest and send events to client,
- and then screen relative to paint
- the window background
- */
+ BoxRec srcBox; /* unclipped source */
+ RegionRec rgnExposed; /* exposed region, calculated source-
+ relative, made dst relative to
+ intersect with visible parts of
+ dest and send events to client,
+ and then screen relative to paint
+ the window background
+ */
WindowPtr pSrcWin;
BoxRec expBox;
Bool extents;
/* avoid work if we can */
if (!pGC->graphicsExposures &&
- (pDstDrawable->type == DRAWABLE_PIXMAP) &&
- ((pSrcDrawable->type == DRAWABLE_PIXMAP) ||
- (((WindowPtr)pSrcDrawable)->backStorage == NULL)))
- return NULL;
-
+ (pDstDrawable->type == DRAWABLE_PIXMAP) &&
+ ((pSrcDrawable->type == DRAWABLE_PIXMAP) ||
+ (((WindowPtr) pSrcDrawable)->backStorage == NULL)))
+ return NULL;
+
srcBox.x1 = srcx;
srcBox.y1 = srcy;
- srcBox.x2 = srcx+width;
- srcBox.y2 = srcy+height;
-
- if (pSrcDrawable->type != DRAWABLE_PIXMAP)
- {
- BoxRec TsrcBox;
-
- TsrcBox.x1 = srcx + pSrcDrawable->x;
- TsrcBox.y1 = srcy + pSrcDrawable->y;
- TsrcBox.x2 = TsrcBox.x1 + width;
- TsrcBox.y2 = TsrcBox.y1 + height;
- pSrcWin = (WindowPtr) pSrcDrawable;
- if (pGC->subWindowMode == IncludeInferiors)
- {
- prgnSrcClip = NotClippedByChildren (pSrcWin);
- if ((RegionContainsRect(prgnSrcClip, &TsrcBox)) == rgnIN)
- {
- RegionDestroy(prgnSrcClip);
- return NULL;
- }
- }
- else
- {
- if ((RegionContainsRect(&pSrcWin->clipList, &TsrcBox)) == rgnIN)
- return NULL;
- prgnSrcClip = &rgnSrcRec;
- RegionNull(prgnSrcClip);
- RegionCopy(prgnSrcClip, &pSrcWin->clipList);
- }
- RegionTranslate(prgnSrcClip,
- -pSrcDrawable->x, -pSrcDrawable->y);
+ srcBox.x2 = srcx + width;
+ srcBox.y2 = srcy + height;
+
+ if (pSrcDrawable->type != DRAWABLE_PIXMAP) {
+ BoxRec TsrcBox;
+
+ TsrcBox.x1 = srcx + pSrcDrawable->x;
+ TsrcBox.y1 = srcy + pSrcDrawable->y;
+ TsrcBox.x2 = TsrcBox.x1 + width;
+ TsrcBox.y2 = TsrcBox.y1 + height;
+ pSrcWin = (WindowPtr) pSrcDrawable;
+ if (pGC->subWindowMode == IncludeInferiors) {
+ prgnSrcClip = NotClippedByChildren(pSrcWin);
+ if ((RegionContainsRect(prgnSrcClip, &TsrcBox)) == rgnIN) {
+ RegionDestroy(prgnSrcClip);
+ return NULL;
+ }
+ }
+ else {
+ if ((RegionContainsRect(&pSrcWin->clipList, &TsrcBox)) == rgnIN)
+ return NULL;
+ prgnSrcClip = &rgnSrcRec;
+ RegionNull(prgnSrcClip);
+ RegionCopy(prgnSrcClip, &pSrcWin->clipList);
+ }
+ RegionTranslate(prgnSrcClip, -pSrcDrawable->x, -pSrcDrawable->y);
}
- else
- {
- BoxRec box;
-
- if ((srcBox.x1 >= 0) && (srcBox.y1 >= 0) &&
- (srcBox.x2 <= pSrcDrawable->width) &&
- (srcBox.y2 <= pSrcDrawable->height))
- return NULL;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pSrcDrawable->width;
- box.y2 = pSrcDrawable->height;
- prgnSrcClip = &rgnSrcRec;
- RegionInit(prgnSrcClip, &box, 1);
- pSrcWin = NULL;
+ else {
+ BoxRec box;
+
+ if ((srcBox.x1 >= 0) && (srcBox.y1 >= 0) &&
+ (srcBox.x2 <= pSrcDrawable->width) &&
+ (srcBox.y2 <= pSrcDrawable->height))
+ return NULL;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pSrcDrawable->width;
+ box.y2 = pSrcDrawable->height;
+ prgnSrcClip = &rgnSrcRec;
+ RegionInit(prgnSrcClip, &box, 1);
+ pSrcWin = NULL;
}
- if (pDstDrawable == pSrcDrawable)
- {
- prgnDstClip = prgnSrcClip;
+ if (pDstDrawable == pSrcDrawable) {
+ prgnDstClip = prgnSrcClip;
}
- else if (pDstDrawable->type != DRAWABLE_PIXMAP)
- {
- if (pGC->subWindowMode == IncludeInferiors)
- {
- prgnDstClip = NotClippedByChildren((WindowPtr)pDstDrawable);
- }
- else
- {
- prgnDstClip = &rgnDstRec;
- RegionNull(prgnDstClip);
- RegionCopy(prgnDstClip,
- &((WindowPtr)pDstDrawable)->clipList);
- }
- RegionTranslate(prgnDstClip,
- -pDstDrawable->x, -pDstDrawable->y);
+ else if (pDstDrawable->type != DRAWABLE_PIXMAP) {
+ if (pGC->subWindowMode == IncludeInferiors) {
+ prgnDstClip = NotClippedByChildren((WindowPtr) pDstDrawable);
+ }
+ else {
+ prgnDstClip = &rgnDstRec;
+ RegionNull(prgnDstClip);
+ RegionCopy(prgnDstClip, &((WindowPtr) pDstDrawable)->clipList);
+ }
+ RegionTranslate(prgnDstClip, -pDstDrawable->x, -pDstDrawable->y);
}
- else
- {
- BoxRec box;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pDstDrawable->width;
- box.y2 = pDstDrawable->height;
- prgnDstClip = &rgnDstRec;
- RegionInit(prgnDstClip, &box, 1);
+ else {
+ BoxRec box;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pDstDrawable->width;
+ box.y2 = pDstDrawable->height;
+ prgnDstClip = &rgnDstRec;
+ RegionInit(prgnDstClip, &box, 1);
}
/* drawable-relative source region */
RegionInit(&rgnExposed, &srcBox, 1);
- /* now get the hidden parts of the source box*/
+ /* now get the hidden parts of the source box */
RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip);
/* move them over the destination */
- RegionTranslate(&rgnExposed, dstx-srcx, dsty-srcy);
+ RegionTranslate(&rgnExposed, dstx - srcx, dsty - srcy);
/* intersect with visible areas of dest */
RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip);
/* intersect with client clip region. */
if (pGC->clientClipType == CT_REGION)
- RegionIntersect(&rgnExposed, &rgnExposed, pGC->clientClip);
+ RegionIntersect(&rgnExposed, &rgnExposed, pGC->clientClip);
/*
* If we have LOTS of rectangles, we decide to take the extents
@@ -262,135 +247,121 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
* for windows.
*/
extents = pGC->graphicsExposures &&
- (RegionNumRects(&rgnExposed) > RECTLIMIT) &&
- (pDstDrawable->type != DRAWABLE_PIXMAP);
- if (pSrcWin)
- {
- RegionPtr region;
- if (!(region = wClipShape (pSrcWin)))
- region = wBoundingShape (pSrcWin);
- /*
- * If you try to CopyArea the extents of a shaped window, compacting the
- * exposed region will undo all our work!
- */
- if (extents && pSrcWin && region &&
- (RegionContainsRect(region, &srcBox) != rgnIN))
- extents = FALSE;
+ (RegionNumRects(&rgnExposed) > RECTLIMIT) &&
+ (pDstDrawable->type != DRAWABLE_PIXMAP);
+ if (pSrcWin) {
+ RegionPtr region;
+
+ if (!(region = wClipShape(pSrcWin)))
+ region = wBoundingShape(pSrcWin);
+ /*
+ * If you try to CopyArea the extents of a shaped window, compacting the
+ * exposed region will undo all our work!
+ */
+ if (extents && pSrcWin && region &&
+ (RegionContainsRect(region, &srcBox) != rgnIN))
+ extents = FALSE;
}
- if (extents)
- {
- expBox = *RegionExtents(&rgnExposed);
- RegionReset(&rgnExposed, &expBox);
+ if (extents) {
+ expBox = *RegionExtents(&rgnExposed);
+ RegionReset(&rgnExposed, &expBox);
}
if ((pDstDrawable->type != DRAWABLE_PIXMAP) &&
- (((WindowPtr)pDstDrawable)->backgroundState != None))
- {
- WindowPtr pWin = (WindowPtr)pDstDrawable;
-
- /* make the exposed area screen-relative */
- RegionTranslate(&rgnExposed,
- pDstDrawable->x, pDstDrawable->y);
-
- if (extents)
- {
- /* miPaintWindow doesn't clip, so we have to */
- RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList);
- }
- miPaintWindow((WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND);
-
- if (extents)
- {
- RegionReset(&rgnExposed, &expBox);
- }
- else
- RegionTranslate(&rgnExposed,
- -pDstDrawable->x, -pDstDrawable->y);
+ (((WindowPtr) pDstDrawable)->backgroundState != None)) {
+ WindowPtr pWin = (WindowPtr) pDstDrawable;
+
+ /* make the exposed area screen-relative */
+ RegionTranslate(&rgnExposed, pDstDrawable->x, pDstDrawable->y);
+
+ if (extents) {
+ /* miPaintWindow doesn't clip, so we have to */
+ RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList);
+ }
+ miPaintWindow((WindowPtr) pDstDrawable, &rgnExposed, PW_BACKGROUND);
+
+ if (extents) {
+ RegionReset(&rgnExposed, &expBox);
+ }
+ else
+ RegionTranslate(&rgnExposed, -pDstDrawable->x, -pDstDrawable->y);
}
- if (prgnDstClip == &rgnDstRec)
- {
- RegionUninit(prgnDstClip);
+ if (prgnDstClip == &rgnDstRec) {
+ RegionUninit(prgnDstClip);
}
- else if (prgnDstClip != prgnSrcClip)
- {
- RegionDestroy(prgnDstClip);
+ else if (prgnDstClip != prgnSrcClip) {
+ RegionDestroy(prgnDstClip);
}
- if (prgnSrcClip == &rgnSrcRec)
- {
- RegionUninit(prgnSrcClip);
+ if (prgnSrcClip == &rgnSrcRec) {
+ RegionUninit(prgnSrcClip);
}
- else
- {
- RegionDestroy(prgnSrcClip);
+ else {
+ RegionDestroy(prgnSrcClip);
}
- if (pGC->graphicsExposures)
- {
- /* don't look */
- RegionPtr exposed = RegionCreate(NullBox, 0);
- *exposed = rgnExposed;
- return exposed;
+ if (pGC->graphicsExposures) {
+ /* don't look */
+ RegionPtr exposed = RegionCreate(NullBox, 0);
+
+ *exposed = rgnExposed;
+ return exposed;
}
- else
- {
- RegionUninit(&rgnExposed);
- return NULL;
+ else {
+ RegionUninit(&rgnExposed);
+ return NULL;
}
}
/* send GraphicsExpose events, or a NoExpose event, based on the region */
void
-miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
- int major, int minor)
+miSendGraphicsExpose(ClientPtr client, RegionPtr pRgn, XID drawable,
+ int major, int minor)
{
- if (pRgn && !RegionNil(pRgn))
- {
+ if (pRgn && !RegionNil(pRgn)) {
xEvent *pEvent;
- xEvent *pe;
- BoxPtr pBox;
- int i;
- int numRects;
-
- numRects = RegionNumRects(pRgn);
- pBox = RegionRects(pRgn);
- if(!(pEvent = malloc(numRects * sizeof(xEvent))))
- return;
- pe = pEvent;
-
- for (i=1; i<=numRects; i++, pe++, pBox++)
- {
- pe->u.u.type = GraphicsExpose;
- pe->u.graphicsExposure.drawable = drawable;
- pe->u.graphicsExposure.x = pBox->x1;
- pe->u.graphicsExposure.y = pBox->y1;
- pe->u.graphicsExposure.width = pBox->x2 - pBox->x1;
- pe->u.graphicsExposure.height = pBox->y2 - pBox->y1;
- pe->u.graphicsExposure.count = numRects - i;
- pe->u.graphicsExposure.majorEvent = major;
- pe->u.graphicsExposure.minorEvent = minor;
- }
- /* GraphicsExpose is a "critical event", which TryClientEvents
- * handles specially. */
- TryClientEvents(client, NULL, pEvent, numRects,
- (Mask)0, NoEventMask, NullGrab);
- free(pEvent);
+ xEvent *pe;
+ BoxPtr pBox;
+ int i;
+ int numRects;
+
+ numRects = RegionNumRects(pRgn);
+ pBox = RegionRects(pRgn);
+ if (!(pEvent = malloc(numRects * sizeof(xEvent))))
+ return;
+ pe = pEvent;
+
+ for (i = 1; i <= numRects; i++, pe++, pBox++) {
+ pe->u.u.type = GraphicsExpose;
+ pe->u.graphicsExposure.drawable = drawable;
+ pe->u.graphicsExposure.x = pBox->x1;
+ pe->u.graphicsExposure.y = pBox->y1;
+ pe->u.graphicsExposure.width = pBox->x2 - pBox->x1;
+ pe->u.graphicsExposure.height = pBox->y2 - pBox->y1;
+ pe->u.graphicsExposure.count = numRects - i;
+ pe->u.graphicsExposure.majorEvent = major;
+ pe->u.graphicsExposure.minorEvent = minor;
+ }
+ /* GraphicsExpose is a "critical event", which TryClientEvents
+ * handles specially. */
+ TryClientEvents(client, NULL, pEvent, numRects,
+ (Mask) 0, NoEventMask, NullGrab);
+ free(pEvent);
}
- else
- {
+ else {
xEvent event;
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = NoExpose;
- event.u.noExposure.drawable = drawable;
- event.u.noExposure.majorEvent = major;
- event.u.noExposure.minorEvent = minor;
- WriteEventsToClient(client, 1, &event);
+
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = NoExpose;
+ event.u.noExposure.drawable = drawable;
+ event.u.noExposure.majorEvent = major;
+ event.u.noExposure.minorEvent = minor;
+ WriteEventsToClient(client, 1, &event);
}
}
-
void
-miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
+miSendExposures(WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
{
BoxPtr pBox;
int numRects;
@@ -399,48 +370,49 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
pBox = RegionRects(pRgn);
numRects = RegionNumRects(pRgn);
- if(!(pEvent = calloc(1, numRects * sizeof(xEvent))))
- return;
-
- for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++)
- {
- pe->u.u.type = Expose;
- pe->u.expose.window = pWin->drawable.id;
- pe->u.expose.x = pBox->x1 - dx;
- pe->u.expose.y = pBox->y1 - dy;
- pe->u.expose.width = pBox->x2 - pBox->x1;
- pe->u.expose.height = pBox->y2 - pBox->y1;
- pe->u.expose.count = i;
+ if (!(pEvent = calloc(1, numRects * sizeof(xEvent))))
+ return;
+
+ for (i = numRects, pe = pEvent; --i >= 0; pe++, pBox++) {
+ pe->u.u.type = Expose;
+ pe->u.expose.window = pWin->drawable.id;
+ pe->u.expose.x = pBox->x1 - dx;
+ pe->u.expose.y = pBox->y1 - dy;
+ pe->u.expose.width = pBox->x2 - pBox->x1;
+ pe->u.expose.height = pBox->y2 - pBox->y1;
+ pe->u.expose.count = i;
}
#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
- int scrnum = pWin->drawable.pScreen->myNum;
- int x = 0, y = 0;
- XID realWin = 0;
-
- if(!pWin->parent) {
- x = screenInfo.screens[scrnum]->x;
- y = screenInfo.screens[scrnum]->y;
- pWin = screenInfo.screens[0]->root;
- realWin = pWin->drawable.id;
- } else if (scrnum) {
- PanoramiXRes *win;
- win = PanoramiXFindIDByScrnum(XRT_WINDOW,
- pWin->drawable.id, scrnum);
- if(!win) {
- free(pEvent);
- return;
- }
- realWin = win->info[0].id;
- dixLookupWindow(&pWin, realWin, serverClient, DixSendAccess);
- }
- if(x || y || scrnum)
- for (i = 0; i < numRects; i++) {
- pEvent[i].u.expose.window = realWin;
- pEvent[i].u.expose.x += x;
- pEvent[i].u.expose.y += y;
- }
+ if (!noPanoramiXExtension) {
+ int scrnum = pWin->drawable.pScreen->myNum;
+ int x = 0, y = 0;
+ XID realWin = 0;
+
+ if (!pWin->parent) {
+ x = screenInfo.screens[scrnum]->x;
+ y = screenInfo.screens[scrnum]->y;
+ pWin = screenInfo.screens[0]->root;
+ realWin = pWin->drawable.id;
+ }
+ else if (scrnum) {
+ PanoramiXRes *win;
+
+ win = PanoramiXFindIDByScrnum(XRT_WINDOW,
+ pWin->drawable.id, scrnum);
+ if (!win) {
+ free(pEvent);
+ return;
+ }
+ realWin = win->info[0].id;
+ dixLookupWindow(&pWin, realWin, serverClient, DixSendAccess);
+ }
+ if (x || y || scrnum)
+ for (i = 0; i < numRects; i++) {
+ pEvent[i].u.expose.window = realWin;
+ pEvent[i].u.expose.x += x;
+ pEvent[i].u.expose.y += y;
+ }
}
#endif
@@ -450,69 +422,66 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
}
void
-miWindowExposures( WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed)
+miWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed)
{
- RegionPtr exposures = prgn;
+ RegionPtr exposures = prgn;
+
if ((prgn && !RegionNil(prgn)) ||
- (exposures && !RegionNil(exposures)) || other_exposed)
- {
- RegionRec expRec;
- int clientInterested;
-
- /*
- * Restore from backing-store FIRST.
- */
- clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask;
- if (other_exposed)
- {
- if (exposures)
- {
- RegionUnion(other_exposed,
- exposures,
- other_exposed);
- if (exposures != prgn)
- RegionDestroy(exposures);
- }
- exposures = other_exposed;
- }
- if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT))
- {
- /*
- * If we have LOTS of rectangles, we decide to take the extents
- * and force an exposure on that. This should require much less
- * work overall, on both client and server. This is cheating, but
- * isn't prohibited by the protocol ("spontaneous combustion" :-).
- */
- BoxRec box;
-
- box = *RegionExtents(exposures);
- if (exposures == prgn) {
- exposures = &expRec;
- RegionInit(exposures, &box, 1);
- RegionReset(prgn, &box);
- } else {
- RegionReset(exposures, &box);
- RegionUnion(prgn, prgn, exposures);
- }
- /* miPaintWindow doesn't clip, so we have to */
- RegionIntersect(prgn, prgn, &pWin->clipList);
- }
- if (prgn && !RegionNil(prgn))
- miPaintWindow(pWin, prgn, PW_BACKGROUND);
- if (clientInterested && exposures && !RegionNil(exposures))
- miSendExposures(pWin, exposures,
- pWin->drawable.x, pWin->drawable.y);
- if (exposures == &expRec)
- {
- RegionUninit(exposures);
- }
- else if (exposures && exposures != prgn && exposures != other_exposed)
- RegionDestroy(exposures);
- if (prgn)
- RegionEmpty(prgn);
+ (exposures && !RegionNil(exposures)) || other_exposed) {
+ RegionRec expRec;
+ int clientInterested;
+
+ /*
+ * Restore from backing-store FIRST.
+ */
+ clientInterested =
+ (pWin->eventMask | wOtherEventMasks(pWin)) & ExposureMask;
+ if (other_exposed) {
+ if (exposures) {
+ RegionUnion(other_exposed, exposures, other_exposed);
+ if (exposures != prgn)
+ RegionDestroy(exposures);
+ }
+ exposures = other_exposed;
+ }
+ if (clientInterested && exposures &&
+ (RegionNumRects(exposures) > RECTLIMIT)) {
+ /*
+ * If we have LOTS of rectangles, we decide to take the extents
+ * and force an exposure on that. This should require much less
+ * work overall, on both client and server. This is cheating, but
+ * isn't prohibited by the protocol ("spontaneous combustion" :-).
+ */
+ BoxRec box;
+
+ box = *RegionExtents(exposures);
+ if (exposures == prgn) {
+ exposures = &expRec;
+ RegionInit(exposures, &box, 1);
+ RegionReset(prgn, &box);
+ }
+ else {
+ RegionReset(exposures, &box);
+ RegionUnion(prgn, prgn, exposures);
+ }
+ /* miPaintWindow doesn't clip, so we have to */
+ RegionIntersect(prgn, prgn, &pWin->clipList);
+ }
+ if (prgn && !RegionNil(prgn))
+ miPaintWindow(pWin, prgn, PW_BACKGROUND);
+ if (clientInterested && exposures && !RegionNil(exposures))
+ miSendExposures(pWin, exposures,
+ pWin->drawable.x, pWin->drawable.y);
+ if (exposures == &expRec) {
+ RegionUninit(exposures);
+ }
+ else if (exposures && exposures != prgn && exposures != other_exposed)
+ RegionDestroy(exposures);
+ if (prgn)
+ RegionEmpty(prgn);
}
else if (exposures && exposures != prgn)
- RegionDestroy(exposures);
+ RegionDestroy(exposures);
}
#ifdef ROOTLESS
@@ -521,97 +490,97 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
void RootlessStartDrawing(WindowPtr pWin);
void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
Bool IsFramedWindow(WindowPtr pWin);
-#endif
+#endif
void
miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
ChangeGCVal gcval[6];
- BITS32 gcmask;
- GCPtr pGC;
- int i;
- BoxPtr pbox;
- xRectangle *prect;
- int numRects;
+ BITS32 gcmask;
+ GCPtr pGC;
+ int i;
+ BoxPtr pbox;
+ xRectangle *prect;
+ int numRects;
+
/*
* Distance from screen to destination drawable, use this
* to adjust rendering coordinates which come in in screen space
*/
- int draw_x_off, draw_y_off;
+ int draw_x_off, draw_y_off;
+
/*
* Tile offset for drawing; these need to align the tile
* to the appropriate window origin
*/
- int tile_x_off, tile_y_off;
- PixUnion fill;
- Bool solid = TRUE;
- DrawablePtr drawable = &pWin->drawable;
+ int tile_x_off, tile_y_off;
+ PixUnion fill;
+ Bool solid = TRUE;
+ DrawablePtr drawable = &pWin->drawable;
#ifdef ROOTLESS
- if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
- return;
+ if (!drawable || drawable->type == UNDRAWABLE_WINDOW)
+ return;
- if(IsFramedWindow(pWin)) {
+ if (IsFramedWindow(pWin)) {
RootlessStartDrawing(pWin);
RootlessDamageRegion(pWin, prgn);
-
- if(pWin->backgroundState == ParentRelative) {
- if((what == PW_BACKGROUND) ||
- (what == PW_BORDER && !pWin->borderIsPixel))
+
+ if (pWin->backgroundState == ParentRelative) {
+ if ((what == PW_BACKGROUND) ||
+ (what == PW_BORDER && !pWin->borderIsPixel))
RootlessSetPixmapOfAncestors(pWin);
}
}
#endif
-
- if (what == PW_BACKGROUND)
- {
- while (pWin->backgroundState == ParentRelative)
- pWin = pWin->parent;
-
- draw_x_off = drawable->x;
- draw_y_off = drawable->y;
-
- tile_x_off = pWin->drawable.x - draw_x_off;
- tile_y_off = pWin->drawable.y - draw_y_off;
- fill = pWin->background;
+
+ if (what == PW_BACKGROUND) {
+ while (pWin->backgroundState == ParentRelative)
+ pWin = pWin->parent;
+
+ draw_x_off = drawable->x;
+ draw_y_off = drawable->y;
+
+ tile_x_off = pWin->drawable.x - draw_x_off;
+ tile_y_off = pWin->drawable.y - draw_y_off;
+ fill = pWin->background;
#ifdef COMPOSITE
- if (pWin->inhibitBGPaint)
- return;
+ if (pWin->inhibitBGPaint)
+ return;
#endif
- switch (pWin->backgroundState) {
- case None:
- return;
- case BackgroundPixmap:
- solid = FALSE;
- break;
- }
+ switch (pWin->backgroundState) {
+ case None:
+ return;
+ case BackgroundPixmap:
+ solid = FALSE;
+ break;
+ }
}
- else
- {
- PixmapPtr pixmap;
-
- tile_x_off = drawable->x;
- tile_y_off = drawable->y;
-
- /* servers without pixmaps draw their own borders */
- if (!pScreen->GetWindowPixmap)
- return;
- pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
- drawable = &pixmap->drawable;
+ else {
+ PixmapPtr pixmap;
+
+ tile_x_off = drawable->x;
+ tile_y_off = drawable->y;
+
+ /* servers without pixmaps draw their own borders */
+ if (!pScreen->GetWindowPixmap)
+ return;
+ pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
+ drawable = &pixmap->drawable;
#ifdef COMPOSITE
- draw_x_off = pixmap->screen_x;
- draw_y_off = pixmap->screen_y;
- tile_x_off -= draw_x_off;
- tile_y_off -= draw_y_off;
+ draw_x_off = pixmap->screen_x;
+ draw_y_off = pixmap->screen_y;
+ tile_x_off -= draw_x_off;
+ tile_y_off -= draw_y_off;
#else
- draw_x_off = 0;
- draw_y_off = 0;
+ draw_x_off = 0;
+ draw_y_off = 0;
#endif
- fill = pWin->border;
- solid = pWin->borderIsPixel;
+ fill = pWin->border;
+ solid = pWin->borderIsPixel;
}
-
+
gcval[0].val = GXcopy;
gcmask = GCFunction;
@@ -622,62 +591,60 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
*/
#define RootlessAlphaMask(bpp) ((bpp) == 32 ? 0xFF000000 : 0)
#endif
-
- if (solid)
- {
+
+ if (solid) {
#ifdef ROOTLESS_SAFEALPHA
- gcval[1].val = fill.pixel | RootlessAlphaMask(pWin->drawable.bitsPerPixel);
+ gcval[1].val =
+ fill.pixel | RootlessAlphaMask(pWin->drawable.bitsPerPixel);
#else
- gcval[1].val = fill.pixel;
+ gcval[1].val = fill.pixel;
#endif
- gcval[2].val = FillSolid;
- gcmask |= GCForeground | GCFillStyle;
+ gcval[2].val = FillSolid;
+ gcmask |= GCForeground | GCFillStyle;
}
- else
- {
- int c=1;
+ else {
+ int c = 1;
+
#ifdef ROOTLESS_SAFEALPHA
- gcval[c++].val = ((CARD32)-1) & ~RootlessAlphaMask(pWin->drawable.bitsPerPixel);
- gcmask |= GCPlaneMask;
+ gcval[c++].val =
+ ((CARD32) -1) & ~RootlessAlphaMask(pWin->drawable.bitsPerPixel);
+ gcmask |= GCPlaneMask;
#endif
- gcval[c++].val = FillTiled;
- gcval[c++].ptr = (pointer)fill.pixmap;
- gcval[c++].val = tile_x_off;
- gcval[c++].val = tile_y_off;
- gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
+ gcval[c++].val = FillTiled;
+ gcval[c++].ptr = (pointer) fill.pixmap;
+ gcval[c++].val = tile_x_off;
+ gcval[c++].val = tile_y_off;
+ gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
}
prect = malloc(RegionNumRects(prgn) * sizeof(xRectangle));
if (!prect)
- return;
+ return;
pGC = GetScratchGC(drawable->depth, drawable->pScreen);
- if (!pGC)
- {
- free(prect);
- return;
+ if (!pGC) {
+ free(prect);
+ return;
}
-
- ChangeGC (NullClient, pGC, gcmask, gcval);
- ValidateGC (drawable, pGC);
+
+ ChangeGC(NullClient, pGC, gcmask, gcval);
+ ValidateGC(drawable, pGC);
numRects = RegionNumRects(prgn);
pbox = RegionRects(prgn);
- for (i= numRects; --i >= 0; pbox++, prect++)
- {
- prect->x = pbox->x1 - draw_x_off;
- prect->y = pbox->y1 - draw_y_off;
- prect->width = pbox->x2 - pbox->x1;
- prect->height = pbox->y2 - pbox->y1;
+ for (i = numRects; --i >= 0; pbox++, prect++) {
+ prect->x = pbox->x1 - draw_x_off;
+ prect->y = pbox->y1 - draw_y_off;
+ prect->width = pbox->x2 - pbox->x1;
+ prect->height = pbox->y2 - pbox->y1;
}
prect -= numRects;
- (*pGC->ops->PolyFillRect)(drawable, pGC, numRects, prect);
+ (*pGC->ops->PolyFillRect) (drawable, pGC, numRects, prect);
free(prect);
FreeScratchGC(pGC);
}
-
/* MICLEARDRAWABLE -- sets the entire drawable to the background color of
* the GC. Useful when we have a scratch drawable and need to initialize
* it. */
@@ -695,7 +662,7 @@ miClearDrawable(DrawablePtr pDraw, GCPtr pGC)
rect.height = pDraw->height;
ChangeGC(NullClient, pGC, GCForeground, &bg);
ValidateGC(pDraw, pGC);
- (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect);
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect);
ChangeGC(NullClient, pGC, GCForeground, &fg);
ValidateGC(pDraw, pGC);
}
diff --git a/xorg-server/mi/mifillarc.c b/xorg-server/mi/mifillarc.c
index dd0a7b91d..337343dd1 100644
--- a/xorg-server/mi/mifillarc.c
+++ b/xorg-server/mi/mifillarc.c
@@ -1,798 +1,712 @@
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Author: Bob Scheifler, MIT X Consortium
-
-********************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <math.h>
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "mifpoly.h"
-#include "mi.h"
-#include "mifillarc.h"
-
-#define QUADRANT (90 * 64)
-#define HALFCIRCLE (180 * 64)
-#define QUADRANT3 (270 * 64)
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define Dsin(d) sin((double)d*(M_PI/11520.0))
-#define Dcos(d) cos((double)d*(M_PI/11520.0))
-
-void
-miFillArcSetup(xArc *arc, miFillArcRec *info)
-{
- info->y = arc->height >> 1;
- info->dy = arc->height & 1;
- info->yorg = arc->y + info->y;
- info->dx = arc->width & 1;
- info->xorg = arc->x + (arc->width >> 1) + info->dx;
- info->dx = 1 - info->dx;
- if (arc->width == arc->height)
- {
- /* (2x - 2xorg)^2 = d^2 - (2y - 2yorg)^2 */
- /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */
- info->ym = 8;
- info->xm = 8;
- info->yk = info->y << 3;
- if (!info->dx)
- {
- info->xk = 0;
- info->e = -1;
- }
- else
- {
- info->y++;
- info->yk += 4;
- info->xk = -4;
- info->e = - (info->y << 3);
- }
- }
- else
- {
- /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */
- /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */
- info->ym = (arc->width * arc->width) << 3;
- info->xm = (arc->height * arc->height) << 3;
- info->yk = info->y * info->ym;
- if (!info->dy)
- info->yk -= info->ym >> 1;
- if (!info->dx)
- {
- info->xk = 0;
- info->e = - (info->xm >> 3);
- }
- else
- {
- info->y++;
- info->yk += info->ym;
- info->xk = -(info->xm >> 1);
- info->e = info->xk - info->yk;
- }
- }
-}
-
-static void
-miFillArcDSetup(xArc *arc, miFillArcDRec *info)
-{
- /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */
- /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */
- info->y = arc->height >> 1;
- info->dy = arc->height & 1;
- info->yorg = arc->y + info->y;
- info->dx = arc->width & 1;
- info->xorg = arc->x + (arc->width >> 1) + info->dx;
- info->dx = 1 - info->dx;
- info->ym = ((double)arc->width) * (arc->width * 8);
- info->xm = ((double)arc->height) * (arc->height * 8);
- info->yk = info->y * info->ym;
- if (!info->dy)
- info->yk -= info->ym / 2.0;
- if (!info->dx)
- {
- info->xk = 0;
- info->e = - (info->xm / 8.0);
- }
- else
- {
- info->y++;
- info->yk += info->ym;
- info->xk = -info->xm / 2.0;
- info->e = info->xk - info->yk;
- }
-}
-
-static void
-miGetArcEdge(
- xArc *arc,
- miSliceEdgePtr edge,
- int k,
- Bool top,
- Bool left )
-{
- int xady, y;
-
- y = arc->height >> 1;
- if (!(arc->width & 1))
- y++;
- if (!top)
- {
- y = -y;
- if (arc->height & 1)
- y--;
- }
- xady = k + y * edge->dx;
- if (xady <= 0)
- edge->x = - ((-xady) / edge->dy + 1);
- else
- edge->x = (xady - 1) / edge->dy;
- edge->e = xady - edge->x * edge->dy;
- if ((top && (edge->dx < 0)) || (!top && (edge->dx > 0)))
- edge->e = edge->dy - edge->e + 1;
- if (left)
- edge->x++;
- edge->x += arc->x + (arc->width >> 1);
- if (edge->dx > 0)
- {
- edge->deltax = 1;
- edge->stepx = edge->dx / edge->dy;
- edge->dx = edge->dx % edge->dy;
- }
- else
- {
- edge->deltax = -1;
- edge->stepx = - ((-edge->dx) / edge->dy);
- edge->dx = (-edge->dx) % edge->dy;
- }
- if (!top)
- {
- edge->deltax = -edge->deltax;
- edge->stepx = -edge->stepx;
- }
-}
-
-static void
-miEllipseAngleToSlope (int angle, int width, int height, int *dxp, int *dyp,
- double *d_dxp, double *d_dyp)
-{
- int dx, dy;
- double d_dx, d_dy, scale;
- Bool negative_dx, negative_dy;
-
- switch (angle) {
- case 0:
- *dxp = -1;
- *dyp = 0;
- if (d_dxp) {
- *d_dxp = width / 2.0;
- *d_dyp = 0;
- }
- break;
- case QUADRANT:
- *dxp = 0;
- *dyp = 1;
- if (d_dxp) {
- *d_dxp = 0;
- *d_dyp = - height / 2.0;
- }
- break;
- case HALFCIRCLE:
- *dxp = 1;
- *dyp = 0;
- if (d_dxp) {
- *d_dxp = - width / 2.0;
- *d_dyp = 0;
- }
- break;
- case QUADRANT3:
- *dxp = 0;
- *dyp = -1;
- if (d_dxp) {
- *d_dxp = 0;
- *d_dyp = height / 2.0;
- }
- break;
- default:
- d_dx = Dcos(angle) * width;
- d_dy = Dsin(angle) * height;
- if (d_dxp) {
- *d_dxp = d_dx / 2.0;
- *d_dyp = - d_dy / 2.0;
- }
- negative_dx = FALSE;
- if (d_dx < 0.0)
- {
- d_dx = -d_dx;
- negative_dx = TRUE;
- }
- negative_dy = FALSE;
- if (d_dy < 0.0)
- {
- d_dy = -d_dy;
- negative_dy = TRUE;
- }
- scale = d_dx;
- if (d_dy > d_dx)
- scale = d_dy;
- dx = floor ((d_dx * 32768) / scale + 0.5);
- if (negative_dx)
- dx = -dx;
- *dxp = dx;
- dy = floor ((d_dy * 32768) / scale + 0.5);
- if (negative_dy)
- dy = -dy;
- *dyp = dy;
- break;
- }
-}
-
-static void
-miGetPieEdge(
- xArc *arc,
- int angle,
- miSliceEdgePtr edge,
- Bool top,
- Bool left )
-{
- int k;
- int dx, dy;
-
- miEllipseAngleToSlope (angle, arc->width, arc->height, &dx, &dy, 0, 0);
-
- if (dy == 0)
- {
- edge->x = left ? -65536 : 65536;
- edge->stepx = 0;
- edge->e = 0;
- edge->dx = -1;
- return;
- }
- if (dx == 0)
- {
- edge->x = arc->x + (arc->width >> 1);
- if (left && (arc->width & 1))
- edge->x++;
- else if (!left && !(arc->width & 1))
- edge->x--;
- edge->stepx = 0;
- edge->e = 0;
- edge->dx = -1;
- return;
- }
- if (dy < 0) {
- dx = -dx;
- dy = -dy;
- }
- k = (arc->height & 1) ? dx : 0;
- if (arc->width & 1)
- k += dy;
- edge->dx = dx << 1;
- edge->dy = dy << 1;
- miGetArcEdge(arc, edge, k, top, left);
-}
-
-void
-miFillArcSliceSetup(xArc *arc, miArcSliceRec *slice, GCPtr pGC)
-{
- int angle1, angle2;
-
- angle1 = arc->angle1;
- if (arc->angle2 < 0)
- {
- angle2 = angle1;
- angle1 += arc->angle2;
- }
- else
- angle2 = angle1 + arc->angle2;
- while (angle1 < 0)
- angle1 += FULLCIRCLE;
- while (angle1 >= FULLCIRCLE)
- angle1 -= FULLCIRCLE;
- while (angle2 < 0)
- angle2 += FULLCIRCLE;
- while (angle2 >= FULLCIRCLE)
- angle2 -= FULLCIRCLE;
- slice->min_top_y = 0;
- slice->max_top_y = arc->height >> 1;
- slice->min_bot_y = 1 - (arc->height & 1);
- slice->max_bot_y = slice->max_top_y - 1;
- slice->flip_top = FALSE;
- slice->flip_bot = FALSE;
- if (pGC->arcMode == ArcPieSlice)
- {
- slice->edge1_top = (angle1 < HALFCIRCLE);
- slice->edge2_top = (angle2 <= HALFCIRCLE);
- if ((angle2 == 0) || (angle1 == HALFCIRCLE))
- {
- if (angle2 ? slice->edge2_top : slice->edge1_top)
- slice->min_top_y = slice->min_bot_y;
- else
- slice->min_top_y = arc->height;
- slice->min_bot_y = 0;
- }
- else if ((angle1 == 0) || (angle2 == HALFCIRCLE))
- {
- slice->min_top_y = slice->min_bot_y;
- if (angle1 ? slice->edge1_top : slice->edge2_top)
- slice->min_bot_y = arc->height;
- else
- slice->min_bot_y = 0;
- }
- else if (slice->edge1_top == slice->edge2_top)
- {
- if (angle2 < angle1)
- {
- slice->flip_top = slice->edge1_top;
- slice->flip_bot = !slice->edge1_top;
- }
- else if (slice->edge1_top)
- {
- slice->min_top_y = 1;
- slice->min_bot_y = arc->height;
- }
- else
- {
- slice->min_bot_y = 0;
- slice->min_top_y = arc->height;
- }
- }
- miGetPieEdge(arc, angle1, &slice->edge1,
- slice->edge1_top, !slice->edge1_top);
- miGetPieEdge(arc, angle2, &slice->edge2,
- slice->edge2_top, slice->edge2_top);
- }
- else
- {
- double w2, h2, x1, y1, x2, y2, dx, dy, scale;
- int signdx, signdy, y, k;
- Bool isInt1 = TRUE, isInt2 = TRUE;
-
- w2 = (double)arc->width / 2.0;
- h2 = (double)arc->height / 2.0;
- if ((angle1 == 0) || (angle1 == HALFCIRCLE))
- {
- x1 = angle1 ? -w2 : w2;
- y1 = 0.0;
- }
- else if ((angle1 == QUADRANT) || (angle1 == QUADRANT3))
- {
- x1 = 0.0;
- y1 = (angle1 == QUADRANT) ? h2 : -h2;
- }
- else
- {
- isInt1 = FALSE;
- x1 = Dcos(angle1) * w2;
- y1 = Dsin(angle1) * h2;
- }
- if ((angle2 == 0) || (angle2 == HALFCIRCLE))
- {
- x2 = angle2 ? -w2 : w2;
- y2 = 0.0;
- }
- else if ((angle2 == QUADRANT) || (angle2 == QUADRANT3))
- {
- x2 = 0.0;
- y2 = (angle2 == QUADRANT) ? h2 : -h2;
- }
- else
- {
- isInt2 = FALSE;
- x2 = Dcos(angle2) * w2;
- y2 = Dsin(angle2) * h2;
- }
- dx = x2 - x1;
- dy = y2 - y1;
- if (arc->height & 1)
- {
- y1 -= 0.5;
- y2 -= 0.5;
- }
- if (arc->width & 1)
- {
- x1 += 0.5;
- x2 += 0.5;
- }
- if (dy < 0.0)
- {
- dy = -dy;
- signdy = -1;
- }
- else
- signdy = 1;
- if (dx < 0.0)
- {
- dx = -dx;
- signdx = -1;
- }
- else
- signdx = 1;
- if (isInt1 && isInt2)
- {
- slice->edge1.dx = dx * 2;
- slice->edge1.dy = dy * 2;
- }
- else
- {
- scale = (dx > dy) ? dx : dy;
- slice->edge1.dx = floor((dx * 32768) / scale + .5);
- slice->edge1.dy = floor((dy * 32768) / scale + .5);
- }
- if (!slice->edge1.dy)
- {
- if (signdx < 0)
- {
- y = floor(y1 + 1.0);
- if (y >= 0)
- {
- slice->min_top_y = y;
- slice->min_bot_y = arc->height;
- }
- else
- {
- slice->max_bot_y = -y - (arc->height & 1);
- }
- }
- else
- {
- y = floor(y1);
- if (y >= 0)
- slice->max_top_y = y;
- else
- {
- slice->min_top_y = arc->height;
- slice->min_bot_y = -y - (arc->height & 1);
- }
- }
- slice->edge1_top = TRUE;
- slice->edge1.x = 65536;
- slice->edge1.stepx = 0;
- slice->edge1.e = 0;
- slice->edge1.dx = -1;
- slice->edge2 = slice->edge1;
- slice->edge2_top = FALSE;
- }
- else if (!slice->edge1.dx)
- {
- if (signdy < 0)
- x1 -= 1.0;
- slice->edge1.x = ceil(x1);
- slice->edge1_top = signdy < 0;
- slice->edge1.x += arc->x + (arc->width >> 1);
- slice->edge1.stepx = 0;
- slice->edge1.e = 0;
- slice->edge1.dx = -1;
- slice->edge2_top = !slice->edge1_top;
- slice->edge2 = slice->edge1;
- }
- else
- {
- if (signdx < 0)
- slice->edge1.dx = -slice->edge1.dx;
- if (signdy < 0)
- slice->edge1.dx = -slice->edge1.dx;
- k = ceil(((x1 + x2) * slice->edge1.dy - (y1 + y2) * slice->edge1.dx) / 2.0);
- slice->edge2.dx = slice->edge1.dx;
- slice->edge2.dy = slice->edge1.dy;
- slice->edge1_top = signdy < 0;
- slice->edge2_top = !slice->edge1_top;
- miGetArcEdge(arc, &slice->edge1, k,
- slice->edge1_top, !slice->edge1_top);
- miGetArcEdge(arc, &slice->edge2, k,
- slice->edge2_top, slice->edge2_top);
- }
- }
-}
-
-#define ADDSPANS() \
- pts->x = xorg - x; \
- pts->y = yorg - y; \
- *wids = slw; \
- pts++; \
- wids++; \
- if (miFillArcLower(slw)) \
- { \
- pts->x = xorg - x; \
- pts->y = yorg + y + dy; \
- pts++; \
- *wids++ = slw; \
- }
-
-static void
-miFillEllipseI(
- DrawablePtr pDraw,
- GCPtr pGC,
- xArc *arc )
-{
- int x, y, e;
- int yk, xk, ym, xm, dx, dy, xorg, yorg;
- int slw;
- miFillArcRec info;
- DDXPointPtr points;
- DDXPointPtr pts;
- int *widths;
- int *wids;
-
- points = malloc(sizeof(DDXPointRec) * arc->height);
- if (!points)
- return;
- widths = malloc(sizeof(int) * arc->height);
- if (!widths)
- {
- free(points);
- return;
- }
- miFillArcSetup(arc, &info);
- MIFILLARCSETUP();
- if (pGC->miTranslate)
- {
- xorg += pDraw->x;
- yorg += pDraw->y;
- }
- pts = points;
- wids = widths;
- while (y > 0)
- {
- MIFILLARCSTEP(slw);
- ADDSPANS();
- }
- (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
- free(widths);
- free(points);
-}
-
-static void
-miFillEllipseD(
- DrawablePtr pDraw,
- GCPtr pGC,
- xArc *arc )
-{
- int x, y;
- int xorg, yorg, dx, dy, slw;
- double e, yk, xk, ym, xm;
- miFillArcDRec info;
- DDXPointPtr points;
- DDXPointPtr pts;
- int *widths;
- int *wids;
-
- points = malloc(sizeof(DDXPointRec) * arc->height);
- if (!points)
- return;
- widths = malloc(sizeof(int) * arc->height);
- if (!widths)
- {
- free(points);
- return;
- }
- miFillArcDSetup(arc, &info);
- MIFILLARCSETUP();
- if (pGC->miTranslate)
- {
- xorg += pDraw->x;
- yorg += pDraw->y;
- }
- pts = points;
- wids = widths;
- while (y > 0)
- {
- MIFILLARCSTEP(slw);
- ADDSPANS();
- }
- (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
- free(widths);
- free(points);
-}
-
-#define ADDSPAN(l,r) \
- if (r >= l) \
- { \
- pts->x = l; \
- pts->y = ya; \
- pts++; \
- *wids++ = r - l + 1; \
- }
-
-#define ADDSLICESPANS(flip) \
- if (!flip) \
- { \
- ADDSPAN(xl, xr); \
- } \
- else \
- { \
- xc = xorg - x; \
- ADDSPAN(xc, xr); \
- xc += slw - 1; \
- ADDSPAN(xl, xc); \
- }
-
-static void
-miFillArcSliceI(
- DrawablePtr pDraw,
- GCPtr pGC,
- xArc *arc )
-{
- int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
- int x, y, e;
- miFillArcRec info;
- miArcSliceRec slice;
- int ya, xl, xr, xc;
- DDXPointPtr points;
- DDXPointPtr pts;
- int *widths;
- int *wids;
-
- miFillArcSetup(arc, &info);
- miFillArcSliceSetup(arc, &slice, pGC);
- MIFILLARCSETUP();
- slw = arc->height;
- if (slice.flip_top || slice.flip_bot)
- slw += (arc->height >> 1) + 1;
- points = malloc(sizeof(DDXPointRec) * slw);
- if (!points)
- return;
- widths = malloc(sizeof(int) * slw);
- if (!widths)
- {
- free(points);
- return;
- }
- if (pGC->miTranslate)
- {
- xorg += pDraw->x;
- yorg += pDraw->y;
- slice.edge1.x += pDraw->x;
- slice.edge2.x += pDraw->x;
- }
- pts = points;
- wids = widths;
- while (y > 0)
- {
- MIFILLARCSTEP(slw);
- MIARCSLICESTEP(slice.edge1);
- MIARCSLICESTEP(slice.edge2);
- if (miFillSliceUpper(slice))
- {
- ya = yorg - y;
- MIARCSLICEUPPER(xl, xr, slice, slw);
- ADDSLICESPANS(slice.flip_top);
- }
- if (miFillSliceLower(slice))
- {
- ya = yorg + y + dy;
- MIARCSLICELOWER(xl, xr, slice, slw);
- ADDSLICESPANS(slice.flip_bot);
- }
- }
- (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
- free(widths);
- free(points);
-}
-
-static void
-miFillArcSliceD(
- DrawablePtr pDraw,
- GCPtr pGC,
- xArc *arc )
-{
- int x, y;
- int dx, dy, xorg, yorg, slw;
- double e, yk, xk, ym, xm;
- miFillArcDRec info;
- miArcSliceRec slice;
- int ya, xl, xr, xc;
- DDXPointPtr points;
- DDXPointPtr pts;
- int *widths;
- int *wids;
-
- miFillArcDSetup(arc, &info);
- miFillArcSliceSetup(arc, &slice, pGC);
- MIFILLARCSETUP();
- slw = arc->height;
- if (slice.flip_top || slice.flip_bot)
- slw += (arc->height >> 1) + 1;
- points = malloc(sizeof(DDXPointRec) * slw);
- if (!points)
- return;
- widths = malloc(sizeof(int) * slw);
- if (!widths)
- {
- free(points);
- return;
- }
- if (pGC->miTranslate)
- {
- xorg += pDraw->x;
- yorg += pDraw->y;
- slice.edge1.x += pDraw->x;
- slice.edge2.x += pDraw->x;
- }
- pts = points;
- wids = widths;
- while (y > 0)
- {
- MIFILLARCSTEP(slw);
- MIARCSLICESTEP(slice.edge1);
- MIARCSLICESTEP(slice.edge2);
- if (miFillSliceUpper(slice))
- {
- ya = yorg - y;
- MIARCSLICEUPPER(xl, xr, slice, slw);
- ADDSLICESPANS(slice.flip_top);
- }
- if (miFillSliceLower(slice))
- {
- ya = yorg + y + dy;
- MIARCSLICELOWER(xl, xr, slice, slw);
- ADDSLICESPANS(slice.flip_bot);
- }
- }
- (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
- free(widths);
- free(points);
-}
-
-/* MIPOLYFILLARC -- The public entry for the PolyFillArc request.
- * Since we don't have to worry about overlapping segments, we can just
- * fill each arc as it comes.
- */
-void
-miPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
-{
- int i;
- xArc *arc;
-
- for(i = narcs, arc = parcs; --i >= 0; arc++)
- {
- if (miFillArcEmpty(arc))
- continue;
- if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE))
- {
- if (miCanFillArc(arc))
- miFillEllipseI(pDraw, pGC, arc);
- else
- miFillEllipseD(pDraw, pGC, arc);
- }
- else
- {
- if (miCanFillArc(arc))
- miFillArcSliceI(pDraw, pGC, arc);
- else
- miFillArcSliceD(pDraw, pGC, arc);
- }
- }
-}
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Bob Scheifler, MIT X Consortium
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <math.h>
+#include <X11/X.h>
+#include <X11/Xprotostr.h>
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "mifpoly.h"
+#include "mi.h"
+#include "mifillarc.h"
+
+#define QUADRANT (90 * 64)
+#define HALFCIRCLE (180 * 64)
+#define QUADRANT3 (270 * 64)
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#define Dsin(d) sin((double)d*(M_PI/11520.0))
+#define Dcos(d) cos((double)d*(M_PI/11520.0))
+
+void
+miFillArcSetup(xArc * arc, miFillArcRec * info)
+{
+ info->y = arc->height >> 1;
+ info->dy = arc->height & 1;
+ info->yorg = arc->y + info->y;
+ info->dx = arc->width & 1;
+ info->xorg = arc->x + (arc->width >> 1) + info->dx;
+ info->dx = 1 - info->dx;
+ if (arc->width == arc->height) {
+ /* (2x - 2xorg)^2 = d^2 - (2y - 2yorg)^2 */
+ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */
+ info->ym = 8;
+ info->xm = 8;
+ info->yk = info->y << 3;
+ if (!info->dx) {
+ info->xk = 0;
+ info->e = -1;
+ }
+ else {
+ info->y++;
+ info->yk += 4;
+ info->xk = -4;
+ info->e = -(info->y << 3);
+ }
+ }
+ else {
+ /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */
+ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */
+ info->ym = (arc->width * arc->width) << 3;
+ info->xm = (arc->height * arc->height) << 3;
+ info->yk = info->y * info->ym;
+ if (!info->dy)
+ info->yk -= info->ym >> 1;
+ if (!info->dx) {
+ info->xk = 0;
+ info->e = -(info->xm >> 3);
+ }
+ else {
+ info->y++;
+ info->yk += info->ym;
+ info->xk = -(info->xm >> 1);
+ info->e = info->xk - info->yk;
+ }
+ }
+}
+
+static void
+miFillArcDSetup(xArc * arc, miFillArcDRec * info)
+{
+ /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */
+ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */
+ info->y = arc->height >> 1;
+ info->dy = arc->height & 1;
+ info->yorg = arc->y + info->y;
+ info->dx = arc->width & 1;
+ info->xorg = arc->x + (arc->width >> 1) + info->dx;
+ info->dx = 1 - info->dx;
+ info->ym = ((double) arc->width) * (arc->width * 8);
+ info->xm = ((double) arc->height) * (arc->height * 8);
+ info->yk = info->y * info->ym;
+ if (!info->dy)
+ info->yk -= info->ym / 2.0;
+ if (!info->dx) {
+ info->xk = 0;
+ info->e = -(info->xm / 8.0);
+ }
+ else {
+ info->y++;
+ info->yk += info->ym;
+ info->xk = -info->xm / 2.0;
+ info->e = info->xk - info->yk;
+ }
+}
+
+static void
+miGetArcEdge(xArc * arc, miSliceEdgePtr edge, int k, Bool top, Bool left)
+{
+ int xady, y;
+
+ y = arc->height >> 1;
+ if (!(arc->width & 1))
+ y++;
+ if (!top) {
+ y = -y;
+ if (arc->height & 1)
+ y--;
+ }
+ xady = k + y * edge->dx;
+ if (xady <= 0)
+ edge->x = -((-xady) / edge->dy + 1);
+ else
+ edge->x = (xady - 1) / edge->dy;
+ edge->e = xady - edge->x * edge->dy;
+ if ((top && (edge->dx < 0)) || (!top && (edge->dx > 0)))
+ edge->e = edge->dy - edge->e + 1;
+ if (left)
+ edge->x++;
+ edge->x += arc->x + (arc->width >> 1);
+ if (edge->dx > 0) {
+ edge->deltax = 1;
+ edge->stepx = edge->dx / edge->dy;
+ edge->dx = edge->dx % edge->dy;
+ }
+ else {
+ edge->deltax = -1;
+ edge->stepx = -((-edge->dx) / edge->dy);
+ edge->dx = (-edge->dx) % edge->dy;
+ }
+ if (!top) {
+ edge->deltax = -edge->deltax;
+ edge->stepx = -edge->stepx;
+ }
+}
+
+static void
+miEllipseAngleToSlope(int angle, int width, int height, int *dxp, int *dyp,
+ double *d_dxp, double *d_dyp)
+{
+ int dx, dy;
+ double d_dx, d_dy, scale;
+ Bool negative_dx, negative_dy;
+
+ switch (angle) {
+ case 0:
+ *dxp = -1;
+ *dyp = 0;
+ if (d_dxp) {
+ *d_dxp = width / 2.0;
+ *d_dyp = 0;
+ }
+ break;
+ case QUADRANT:
+ *dxp = 0;
+ *dyp = 1;
+ if (d_dxp) {
+ *d_dxp = 0;
+ *d_dyp = -height / 2.0;
+ }
+ break;
+ case HALFCIRCLE:
+ *dxp = 1;
+ *dyp = 0;
+ if (d_dxp) {
+ *d_dxp = -width / 2.0;
+ *d_dyp = 0;
+ }
+ break;
+ case QUADRANT3:
+ *dxp = 0;
+ *dyp = -1;
+ if (d_dxp) {
+ *d_dxp = 0;
+ *d_dyp = height / 2.0;
+ }
+ break;
+ default:
+ d_dx = Dcos(angle) * width;
+ d_dy = Dsin(angle) * height;
+ if (d_dxp) {
+ *d_dxp = d_dx / 2.0;
+ *d_dyp = -d_dy / 2.0;
+ }
+ negative_dx = FALSE;
+ if (d_dx < 0.0) {
+ d_dx = -d_dx;
+ negative_dx = TRUE;
+ }
+ negative_dy = FALSE;
+ if (d_dy < 0.0) {
+ d_dy = -d_dy;
+ negative_dy = TRUE;
+ }
+ scale = d_dx;
+ if (d_dy > d_dx)
+ scale = d_dy;
+ dx = floor((d_dx * 32768) / scale + 0.5);
+ if (negative_dx)
+ dx = -dx;
+ *dxp = dx;
+ dy = floor((d_dy * 32768) / scale + 0.5);
+ if (negative_dy)
+ dy = -dy;
+ *dyp = dy;
+ break;
+ }
+}
+
+static void
+miGetPieEdge(xArc * arc, int angle, miSliceEdgePtr edge, Bool top, Bool left)
+{
+ int k;
+ int dx, dy;
+
+ miEllipseAngleToSlope(angle, arc->width, arc->height, &dx, &dy, 0, 0);
+
+ if (dy == 0) {
+ edge->x = left ? -65536 : 65536;
+ edge->stepx = 0;
+ edge->e = 0;
+ edge->dx = -1;
+ return;
+ }
+ if (dx == 0) {
+ edge->x = arc->x + (arc->width >> 1);
+ if (left && (arc->width & 1))
+ edge->x++;
+ else if (!left && !(arc->width & 1))
+ edge->x--;
+ edge->stepx = 0;
+ edge->e = 0;
+ edge->dx = -1;
+ return;
+ }
+ if (dy < 0) {
+ dx = -dx;
+ dy = -dy;
+ }
+ k = (arc->height & 1) ? dx : 0;
+ if (arc->width & 1)
+ k += dy;
+ edge->dx = dx << 1;
+ edge->dy = dy << 1;
+ miGetArcEdge(arc, edge, k, top, left);
+}
+
+void
+miFillArcSliceSetup(xArc * arc, miArcSliceRec * slice, GCPtr pGC)
+{
+ int angle1, angle2;
+
+ angle1 = arc->angle1;
+ if (arc->angle2 < 0) {
+ angle2 = angle1;
+ angle1 += arc->angle2;
+ }
+ else
+ angle2 = angle1 + arc->angle2;
+ while (angle1 < 0)
+ angle1 += FULLCIRCLE;
+ while (angle1 >= FULLCIRCLE)
+ angle1 -= FULLCIRCLE;
+ while (angle2 < 0)
+ angle2 += FULLCIRCLE;
+ while (angle2 >= FULLCIRCLE)
+ angle2 -= FULLCIRCLE;
+ slice->min_top_y = 0;
+ slice->max_top_y = arc->height >> 1;
+ slice->min_bot_y = 1 - (arc->height & 1);
+ slice->max_bot_y = slice->max_top_y - 1;
+ slice->flip_top = FALSE;
+ slice->flip_bot = FALSE;
+ if (pGC->arcMode == ArcPieSlice) {
+ slice->edge1_top = (angle1 < HALFCIRCLE);
+ slice->edge2_top = (angle2 <= HALFCIRCLE);
+ if ((angle2 == 0) || (angle1 == HALFCIRCLE)) {
+ if (angle2 ? slice->edge2_top : slice->edge1_top)
+ slice->min_top_y = slice->min_bot_y;
+ else
+ slice->min_top_y = arc->height;
+ slice->min_bot_y = 0;
+ }
+ else if ((angle1 == 0) || (angle2 == HALFCIRCLE)) {
+ slice->min_top_y = slice->min_bot_y;
+ if (angle1 ? slice->edge1_top : slice->edge2_top)
+ slice->min_bot_y = arc->height;
+ else
+ slice->min_bot_y = 0;
+ }
+ else if (slice->edge1_top == slice->edge2_top) {
+ if (angle2 < angle1) {
+ slice->flip_top = slice->edge1_top;
+ slice->flip_bot = !slice->edge1_top;
+ }
+ else if (slice->edge1_top) {
+ slice->min_top_y = 1;
+ slice->min_bot_y = arc->height;
+ }
+ else {
+ slice->min_bot_y = 0;
+ slice->min_top_y = arc->height;
+ }
+ }
+ miGetPieEdge(arc, angle1, &slice->edge1,
+ slice->edge1_top, !slice->edge1_top);
+ miGetPieEdge(arc, angle2, &slice->edge2,
+ slice->edge2_top, slice->edge2_top);
+ }
+ else {
+ double w2, h2, x1, y1, x2, y2, dx, dy, scale;
+ int signdx, signdy, y, k;
+ Bool isInt1 = TRUE, isInt2 = TRUE;
+
+ w2 = (double) arc->width / 2.0;
+ h2 = (double) arc->height / 2.0;
+ if ((angle1 == 0) || (angle1 == HALFCIRCLE)) {
+ x1 = angle1 ? -w2 : w2;
+ y1 = 0.0;
+ }
+ else if ((angle1 == QUADRANT) || (angle1 == QUADRANT3)) {
+ x1 = 0.0;
+ y1 = (angle1 == QUADRANT) ? h2 : -h2;
+ }
+ else {
+ isInt1 = FALSE;
+ x1 = Dcos(angle1) * w2;
+ y1 = Dsin(angle1) * h2;
+ }
+ if ((angle2 == 0) || (angle2 == HALFCIRCLE)) {
+ x2 = angle2 ? -w2 : w2;
+ y2 = 0.0;
+ }
+ else if ((angle2 == QUADRANT) || (angle2 == QUADRANT3)) {
+ x2 = 0.0;
+ y2 = (angle2 == QUADRANT) ? h2 : -h2;
+ }
+ else {
+ isInt2 = FALSE;
+ x2 = Dcos(angle2) * w2;
+ y2 = Dsin(angle2) * h2;
+ }
+ dx = x2 - x1;
+ dy = y2 - y1;
+ if (arc->height & 1) {
+ y1 -= 0.5;
+ y2 -= 0.5;
+ }
+ if (arc->width & 1) {
+ x1 += 0.5;
+ x2 += 0.5;
+ }
+ if (dy < 0.0) {
+ dy = -dy;
+ signdy = -1;
+ }
+ else
+ signdy = 1;
+ if (dx < 0.0) {
+ dx = -dx;
+ signdx = -1;
+ }
+ else
+ signdx = 1;
+ if (isInt1 && isInt2) {
+ slice->edge1.dx = dx * 2;
+ slice->edge1.dy = dy * 2;
+ }
+ else {
+ scale = (dx > dy) ? dx : dy;
+ slice->edge1.dx = floor((dx * 32768) / scale + .5);
+ slice->edge1.dy = floor((dy * 32768) / scale + .5);
+ }
+ if (!slice->edge1.dy) {
+ if (signdx < 0) {
+ y = floor(y1 + 1.0);
+ if (y >= 0) {
+ slice->min_top_y = y;
+ slice->min_bot_y = arc->height;
+ }
+ else {
+ slice->max_bot_y = -y - (arc->height & 1);
+ }
+ }
+ else {
+ y = floor(y1);
+ if (y >= 0)
+ slice->max_top_y = y;
+ else {
+ slice->min_top_y = arc->height;
+ slice->min_bot_y = -y - (arc->height & 1);
+ }
+ }
+ slice->edge1_top = TRUE;
+ slice->edge1.x = 65536;
+ slice->edge1.stepx = 0;
+ slice->edge1.e = 0;
+ slice->edge1.dx = -1;
+ slice->edge2 = slice->edge1;
+ slice->edge2_top = FALSE;
+ }
+ else if (!slice->edge1.dx) {
+ if (signdy < 0)
+ x1 -= 1.0;
+ slice->edge1.x = ceil(x1);
+ slice->edge1_top = signdy < 0;
+ slice->edge1.x += arc->x + (arc->width >> 1);
+ slice->edge1.stepx = 0;
+ slice->edge1.e = 0;
+ slice->edge1.dx = -1;
+ slice->edge2_top = !slice->edge1_top;
+ slice->edge2 = slice->edge1;
+ }
+ else {
+ if (signdx < 0)
+ slice->edge1.dx = -slice->edge1.dx;
+ if (signdy < 0)
+ slice->edge1.dx = -slice->edge1.dx;
+ k = ceil(((x1 + x2) * slice->edge1.dy -
+ (y1 + y2) * slice->edge1.dx) / 2.0);
+ slice->edge2.dx = slice->edge1.dx;
+ slice->edge2.dy = slice->edge1.dy;
+ slice->edge1_top = signdy < 0;
+ slice->edge2_top = !slice->edge1_top;
+ miGetArcEdge(arc, &slice->edge1, k,
+ slice->edge1_top, !slice->edge1_top);
+ miGetArcEdge(arc, &slice->edge2, k,
+ slice->edge2_top, slice->edge2_top);
+ }
+ }
+}
+
+#define ADDSPANS() \
+ pts->x = xorg - x; \
+ pts->y = yorg - y; \
+ *wids = slw; \
+ pts++; \
+ wids++; \
+ if (miFillArcLower(slw)) \
+ { \
+ pts->x = xorg - x; \
+ pts->y = yorg + y + dy; \
+ pts++; \
+ *wids++ = slw; \
+ }
+
+static void
+miFillEllipseI(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
+{
+ int x, y, e;
+ int yk, xk, ym, xm, dx, dy, xorg, yorg;
+ int slw;
+ miFillArcRec info;
+ DDXPointPtr points;
+ DDXPointPtr pts;
+ int *widths;
+ int *wids;
+
+ points = malloc(sizeof(DDXPointRec) * arc->height);
+ if (!points)
+ return;
+ widths = malloc(sizeof(int) * arc->height);
+ if (!widths) {
+ free(points);
+ return;
+ }
+ miFillArcSetup(arc, &info);
+ MIFILLARCSETUP();
+ if (pGC->miTranslate) {
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ }
+ pts = points;
+ wids = widths;
+ while (y > 0) {
+ MIFILLARCSTEP(slw);
+ ADDSPANS();
+ }
+ (*pGC->ops->FillSpans) (pDraw, pGC, pts - points, points, widths, FALSE);
+ free(widths);
+ free(points);
+}
+
+static void
+miFillEllipseD(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
+{
+ int x, y;
+ int xorg, yorg, dx, dy, slw;
+ double e, yk, xk, ym, xm;
+ miFillArcDRec info;
+ DDXPointPtr points;
+ DDXPointPtr pts;
+ int *widths;
+ int *wids;
+
+ points = malloc(sizeof(DDXPointRec) * arc->height);
+ if (!points)
+ return;
+ widths = malloc(sizeof(int) * arc->height);
+ if (!widths) {
+ free(points);
+ return;
+ }
+ miFillArcDSetup(arc, &info);
+ MIFILLARCSETUP();
+ if (pGC->miTranslate) {
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ }
+ pts = points;
+ wids = widths;
+ while (y > 0) {
+ MIFILLARCSTEP(slw);
+ ADDSPANS();
+ }
+ (*pGC->ops->FillSpans) (pDraw, pGC, pts - points, points, widths, FALSE);
+ free(widths);
+ free(points);
+}
+
+#define ADDSPAN(l,r) \
+ if (r >= l) \
+ { \
+ pts->x = l; \
+ pts->y = ya; \
+ pts++; \
+ *wids++ = r - l + 1; \
+ }
+
+#define ADDSLICESPANS(flip) \
+ if (!flip) \
+ { \
+ ADDSPAN(xl, xr); \
+ } \
+ else \
+ { \
+ xc = xorg - x; \
+ ADDSPAN(xc, xr); \
+ xc += slw - 1; \
+ ADDSPAN(xl, xc); \
+ }
+
+static void
+miFillArcSliceI(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
+{
+ int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
+ int x, y, e;
+ miFillArcRec info;
+ miArcSliceRec slice;
+ int ya, xl, xr, xc;
+ DDXPointPtr points;
+ DDXPointPtr pts;
+ int *widths;
+ int *wids;
+
+ miFillArcSetup(arc, &info);
+ miFillArcSliceSetup(arc, &slice, pGC);
+ MIFILLARCSETUP();
+ slw = arc->height;
+ if (slice.flip_top || slice.flip_bot)
+ slw += (arc->height >> 1) + 1;
+ points = malloc(sizeof(DDXPointRec) * slw);
+ if (!points)
+ return;
+ widths = malloc(sizeof(int) * slw);
+ if (!widths) {
+ free(points);
+ return;
+ }
+ if (pGC->miTranslate) {
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ slice.edge1.x += pDraw->x;
+ slice.edge2.x += pDraw->x;
+ }
+ pts = points;
+ wids = widths;
+ while (y > 0) {
+ MIFILLARCSTEP(slw);
+ MIARCSLICESTEP(slice.edge1);
+ MIARCSLICESTEP(slice.edge2);
+ if (miFillSliceUpper(slice)) {
+ ya = yorg - y;
+ MIARCSLICEUPPER(xl, xr, slice, slw);
+ ADDSLICESPANS(slice.flip_top);
+ }
+ if (miFillSliceLower(slice)) {
+ ya = yorg + y + dy;
+ MIARCSLICELOWER(xl, xr, slice, slw);
+ ADDSLICESPANS(slice.flip_bot);
+ }
+ }
+ (*pGC->ops->FillSpans) (pDraw, pGC, pts - points, points, widths, FALSE);
+ free(widths);
+ free(points);
+}
+
+static void
+miFillArcSliceD(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
+{
+ int x, y;
+ int dx, dy, xorg, yorg, slw;
+ double e, yk, xk, ym, xm;
+ miFillArcDRec info;
+ miArcSliceRec slice;
+ int ya, xl, xr, xc;
+ DDXPointPtr points;
+ DDXPointPtr pts;
+ int *widths;
+ int *wids;
+
+ miFillArcDSetup(arc, &info);
+ miFillArcSliceSetup(arc, &slice, pGC);
+ MIFILLARCSETUP();
+ slw = arc->height;
+ if (slice.flip_top || slice.flip_bot)
+ slw += (arc->height >> 1) + 1;
+ points = malloc(sizeof(DDXPointRec) * slw);
+ if (!points)
+ return;
+ widths = malloc(sizeof(int) * slw);
+ if (!widths) {
+ free(points);
+ return;
+ }
+ if (pGC->miTranslate) {
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ slice.edge1.x += pDraw->x;
+ slice.edge2.x += pDraw->x;
+ }
+ pts = points;
+ wids = widths;
+ while (y > 0) {
+ MIFILLARCSTEP(slw);
+ MIARCSLICESTEP(slice.edge1);
+ MIARCSLICESTEP(slice.edge2);
+ if (miFillSliceUpper(slice)) {
+ ya = yorg - y;
+ MIARCSLICEUPPER(xl, xr, slice, slw);
+ ADDSLICESPANS(slice.flip_top);
+ }
+ if (miFillSliceLower(slice)) {
+ ya = yorg + y + dy;
+ MIARCSLICELOWER(xl, xr, slice, slw);
+ ADDSLICESPANS(slice.flip_bot);
+ }
+ }
+ (*pGC->ops->FillSpans) (pDraw, pGC, pts - points, points, widths, FALSE);
+ free(widths);
+ free(points);
+}
+
+/* MIPOLYFILLARC -- The public entry for the PolyFillArc request.
+ * Since we don't have to worry about overlapping segments, we can just
+ * fill each arc as it comes.
+ */
+void
+miPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+{
+ int i;
+ xArc *arc;
+
+ for (i = narcs, arc = parcs; --i >= 0; arc++) {
+ if (miFillArcEmpty(arc))
+ continue;
+ if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE)) {
+ if (miCanFillArc(arc))
+ miFillEllipseI(pDraw, pGC, arc);
+ else
+ miFillEllipseD(pDraw, pGC, arc);
+ }
+ else {
+ if (miCanFillArc(arc))
+ miFillArcSliceI(pDraw, pGC, arc);
+ else
+ miFillArcSliceD(pDraw, pGC, arc);
+ }
+ }
+}
diff --git a/xorg-server/mi/mifillarc.h b/xorg-server/mi/mifillarc.h
index 11587540f..1478d1850 100644
--- a/xorg-server/mi/mifillarc.h
+++ b/xorg-server/mi/mifillarc.h
@@ -24,7 +24,6 @@ in this Software without prior written authorization from The Open Group.
********************************************************/
-
#ifndef __MIFILLARC_H__
#define __MIFILLARC_H__
@@ -87,12 +86,12 @@ typedef struct _miFillArcD {
#define miFillArcLower(slw) (((y + dy) != 0) && ((slw > 1) || (e != xk)))
typedef struct _miSliceEdge {
- int x;
- int stepx;
- int deltax;
- int e;
- int dy;
- int dx;
+ int x;
+ int stepx;
+ int deltax;
+ int e;
+ int dy;
+ int dx;
} miSliceEdgeRec, *miSliceEdgePtr;
typedef struct _miArcSlice {
@@ -176,15 +175,13 @@ typedef struct _miArcSlice {
#define miFillInArcLower(slw) (((iny + dy) != 0) && \
((slw > 1) || (ine != inxk)))
-extern _X_EXPORT void miFillArcSetup(
- xArc * /*arc*/,
- miFillArcRec * /*info*/
-);
+extern _X_EXPORT void miFillArcSetup(xArc * /*arc */ ,
+ miFillArcRec * /*info */
+ );
-extern _X_EXPORT void miFillArcSliceSetup(
- xArc * /*arc*/,
- miArcSliceRec * /*slice*/,
- GCPtr /*pGC*/
-);
+extern _X_EXPORT void miFillArcSliceSetup(xArc * /*arc */ ,
+ miArcSliceRec * /*slice */ ,
+ GCPtr /*pGC */
+ );
-#endif /* __MIFILLARC_H__ */
+#endif /* __MIFILLARC_H__ */
diff --git a/xorg-server/mi/mifillrct.c b/xorg-server/mi/mifillrct.c
index f2ca4c432..79c4057d7 100644
--- a/xorg-server/mi/mifillrct.c
+++ b/xorg-server/mi/mifillrct.c
@@ -1,143 +1,132 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmap.h"
-#include "mi.h"
-#include "misc.h"
-
-/* mi rectangles
- written by newman, with debts to all and sundry
-*/
-
-/* MIPOLYFILLRECT -- public entry for PolyFillRect request
- * very straight forward: translate rectangles if necessary
- * then call FillSpans to fill each rectangle. We let FillSpans worry about
- * clipping to the destination
- */
-void
-miPolyFillRect(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nrectFill, /* number of rectangles to fill */
- xRectangle *prectInit /* Pointer to first rectangle to fill */
- )
-{
- int i;
- int height;
- int width;
- xRectangle *prect;
- int xorg;
- int yorg;
- int maxheight;
- DDXPointPtr pptFirst;
- DDXPointPtr ppt;
- int *pwFirst;
- int *pw;
-
- if (pGC->miTranslate)
- {
- xorg = pDrawable->x;
- yorg = pDrawable->y;
- prect = prectInit;
- maxheight = 0;
- for (i = 0; i<nrectFill; i++, prect++)
- {
- prect->x += xorg;
- prect->y += yorg;
- maxheight = max(maxheight, prect->height);
- }
- }
- else
- {
- prect = prectInit;
- maxheight = 0;
- for (i = 0; i<nrectFill; i++, prect++)
- maxheight = max(maxheight, prect->height);
- }
-
- pptFirst = malloc(maxheight * sizeof(DDXPointRec));
- pwFirst = malloc(maxheight * sizeof(int));
- if(!pptFirst || !pwFirst)
- {
- free(pwFirst);
- free(pptFirst);
- return;
- }
-
- prect = prectInit;
- while(nrectFill--)
- {
- ppt = pptFirst;
- pw = pwFirst;
- height = prect->height;
- width = prect->width;
- xorg = prect->x;
- yorg = prect->y;
- while(height--)
- {
- *pw++ = width;
- ppt->x = xorg;
- ppt->y = yorg;
- ppt++;
- yorg++;
- }
- (* pGC->ops->FillSpans)(pDrawable, pGC,
- prect->height, pptFirst, pwFirst,
- 1);
- prect++;
- }
- free(pwFirst);
- free(pptFirst);
-}
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xprotostr.h>
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmap.h"
+#include "mi.h"
+#include "misc.h"
+
+/* mi rectangles
+ written by newman, with debts to all and sundry
+*/
+
+/* MIPOLYFILLRECT -- public entry for PolyFillRect request
+ * very straight forward: translate rectangles if necessary
+ * then call FillSpans to fill each rectangle. We let FillSpans worry about
+ * clipping to the destination
+ */
+void
+miPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, /* number of rectangles to fill */
+ xRectangle *prectInit /* Pointer to first rectangle to fill */
+ )
+{
+ int i;
+ int height;
+ int width;
+ xRectangle *prect;
+ int xorg;
+ int yorg;
+ int maxheight;
+ DDXPointPtr pptFirst;
+ DDXPointPtr ppt;
+ int *pwFirst;
+ int *pw;
+
+ if (pGC->miTranslate) {
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ prect = prectInit;
+ maxheight = 0;
+ for (i = 0; i < nrectFill; i++, prect++) {
+ prect->x += xorg;
+ prect->y += yorg;
+ maxheight = max(maxheight, prect->height);
+ }
+ }
+ else {
+ prect = prectInit;
+ maxheight = 0;
+ for (i = 0; i < nrectFill; i++, prect++)
+ maxheight = max(maxheight, prect->height);
+ }
+
+ pptFirst = malloc(maxheight * sizeof(DDXPointRec));
+ pwFirst = malloc(maxheight * sizeof(int));
+ if (!pptFirst || !pwFirst) {
+ free(pwFirst);
+ free(pptFirst);
+ return;
+ }
+
+ prect = prectInit;
+ while (nrectFill--) {
+ ppt = pptFirst;
+ pw = pwFirst;
+ height = prect->height;
+ width = prect->width;
+ xorg = prect->x;
+ yorg = prect->y;
+ while (height--) {
+ *pw++ = width;
+ ppt->x = xorg;
+ ppt->y = yorg;
+ ppt++;
+ yorg++;
+ }
+ (*pGC->ops->FillSpans) (pDrawable, pGC,
+ prect->height, pptFirst, pwFirst, 1);
+ prect++;
+ }
+ free(pwFirst);
+ free(pptFirst);
+}
diff --git a/xorg-server/mi/mifpoly.h b/xorg-server/mi/mifpoly.h
index cc779c946..f853fb46b 100644
--- a/xorg-server/mi/mifpoly.h
+++ b/xorg-server/mi/mifpoly.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -65,38 +64,39 @@ SOFTWARE.
#define FirstEnd 1
#define SecondEnd 2
-#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - for 11o miter cutoff */
-#define D2SECANT 5.21671526231167 /* 1/2*sin(11/2) - max extension per width */
+#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - for 11o miter cutoff */
+#define D2SECANT 5.21671526231167 /* 1/2*sin(11/2) - max extension per width */
-static _X_INLINE int ICEIL(double x)
+static _X_INLINE int
+ICEIL(double x)
{
int _cTmp = x;
- return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1;
+
+ return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp + 1;
}
/* Point with sub-pixel positioning. In this case we use doubles, but
* see mifpolycon.c for other suggestions
*/
typedef struct _SppPoint {
- double x, y;
+ double x, y;
} SppPointRec, *SppPointPtr;
typedef struct _SppArc {
- double x, y, width, height;
- double angle1, angle2;
+ double x, y, width, height;
+ double angle1, angle2;
} SppArcRec, *SppArcPtr;
/* mifpolycon.c */
-extern _X_EXPORT void miFillSppPoly(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*count*/,
- SppPointPtr /*ptsIn*/,
- int /*xTrans*/,
- int /*yTrans*/,
- double /*xFtrans*/,
- double /*yFtrans*/
-);
-
-#endif /* __MIFPOLY_H__ */
+extern _X_EXPORT void miFillSppPoly(DrawablePtr /*dst */ ,
+ GCPtr /*pgc */ ,
+ int /*count */ ,
+ SppPointPtr /*ptsIn */ ,
+ int /*xTrans */ ,
+ int /*yTrans */ ,
+ double /*xFtrans */ ,
+ double /*yFtrans */
+ );
+
+#endif /* __MIFPOLY_H__ */
diff --git a/xorg-server/mi/mifpolycon.c b/xorg-server/mi/mifpolycon.c
index 9d776201c..b1337315b 100644
--- a/xorg-server/mi/mifpolycon.c
+++ b/xorg-server/mi/mifpolycon.c
@@ -1,280 +1,249 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <math.h>
-#include <X11/X.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "mifpoly.h"
-
-static int GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans,
- int *by, int *ty);
-
-/*
- * Written by Todd Newman; April. 1987.
- *
- * Fill a convex polygon. If the given polygon
- * is not convex, then the result is undefined.
- * The algorithm is to order the edges from smallest
- * y to largest by partitioning the array into a left
- * edge list and a right edge list. The algorithm used
- * to traverse each edge is digital differencing analyzer
- * line algorithm with y as the major axis. There's some funny linear
- * interpolation involved because of the subpixel postioning.
- */
-void
-miFillSppPoly(
- DrawablePtr dst,
- GCPtr pgc,
- int count, /* number of points */
- SppPointPtr ptsIn, /* the points */
- int xTrans, int yTrans, /* Translate each point by this */
- double xFtrans,
- double yFtrans /* translate before conversion
- by this amount. This provides
- a mechanism to match rounding
- errors with any shape that must
- meet the polygon exactly.
- */
- )
-{
- double xl = 0.0, xr = 0.0, /* x vals of left and right edges */
- ml = 0.0, /* left edge slope */
- mr = 0.0, /* right edge slope */
- dy, /* delta y */
- i; /* loop counter */
- int y, /* current scanline */
- j,
- imin, /* index of vertex with smallest y */
- ymin, /* y-extents of polygon */
- ymax,
- *width,
- *FirstWidth, /* output buffer */
- *Marked; /* set if this vertex has been used */
- int left, right, /* indices to first endpoints */
- nextleft,
- nextright; /* indices to second endpoints */
- DDXPointPtr ptsOut,
- FirstPoint; /* output buffer */
-
- if (pgc->miTranslate)
- {
- xTrans += dst->x;
- yTrans += dst->y;
- }
-
- imin = GetFPolyYBounds(ptsIn, count, yFtrans, &ymin, &ymax);
-
- y = ymax - ymin + 1;
- if ((count < 3) || (y <= 0))
- return;
- ptsOut = FirstPoint = malloc(sizeof(DDXPointRec) * y);
- width = FirstWidth = malloc(sizeof(int) * y);
- Marked = malloc(sizeof(int) * count);
-
- if(!ptsOut || !width || !Marked)
- {
- free(Marked);
- free(width);
- free(ptsOut);
- return;
- }
-
- for(j = 0; j < count; j++)
- Marked[j] = 0;
- nextleft = nextright = imin;
- Marked[imin] = -1;
- y = ICEIL(ptsIn[nextleft].y + yFtrans);
-
- /*
- * loop through all edges of the polygon
- */
- do
- {
- /* add a left edge if we need to */
- if ((y > (ptsIn[nextleft].y + yFtrans) ||
- ISEQUAL(y, ptsIn[nextleft].y + yFtrans)) &&
- Marked[nextleft] != 1)
- {
- Marked[nextleft]++;
- left = nextleft++;
-
- /* find the next edge, considering the end conditions */
- if (nextleft >= count)
- nextleft = 0;
-
- /* now compute the starting point and slope */
- dy = ptsIn[nextleft].y - ptsIn[left].y;
- if (dy != 0.0)
- {
- ml = (ptsIn[nextleft].x - ptsIn[left].x) / dy;
- dy = y - (ptsIn[left].y + yFtrans);
- xl = (ptsIn[left].x + xFtrans) + ml * max(dy, 0);
- }
- }
-
- /* add a right edge if we need to */
- if ((y > ptsIn[nextright].y + yFtrans) ||
- (ISEQUAL(y, ptsIn[nextright].y + yFtrans)
- && Marked[nextright] != 1))
- {
- Marked[nextright]++;
- right = nextright--;
-
- /* find the next edge, considering the end conditions */
- if (nextright < 0)
- nextright = count - 1;
-
- /* now compute the starting point and slope */
- dy = ptsIn[nextright].y - ptsIn[right].y;
- if (dy != 0.0)
- {
- mr = (ptsIn[nextright].x - ptsIn[right].x) / dy;
- dy = y - (ptsIn[right].y + yFtrans);
- xr = (ptsIn[right].x + xFtrans) + mr * max(dy, 0);
- }
- }
-
-
- /*
- * generate scans to fill while we still have
- * a right edge as well as a left edge.
- */
- i = (min(ptsIn[nextleft].y, ptsIn[nextright].y) + yFtrans) - y;
-
- if (i < EPSILON)
- {
- if(Marked[nextleft] && Marked[nextright])
- {
- /* Arrgh, we're trapped! (no more points)
- * Out, we've got to get out of here before this decadence saps
- * our will completely! */
- break;
- }
- continue;
- }
- else
- {
- j = (int) i;
- if(!j)
- j++;
- }
- while (j > 0)
- {
- int cxl, cxr;
-
- ptsOut->y = (y) + yTrans;
-
- cxl = ICEIL(xl);
- cxr = ICEIL(xr);
- /* reverse the edges if necessary */
- if (xl < xr)
- {
- *(width++) = cxr - cxl;
- (ptsOut++)->x = cxl + xTrans;
- }
- else
- {
- *(width++) = cxl - cxr;
- (ptsOut++)->x = cxr + xTrans;
- }
- y++;
-
- /* increment down the edges */
- xl += ml;
- xr += mr;
- j--;
- }
- } while (y <= ymax);
-
- /* Finally, fill the spans we've collected */
- (*pgc->ops->FillSpans)(dst, pgc,
- ptsOut-FirstPoint, FirstPoint, FirstWidth, 1);
- free(Marked);
- free(FirstWidth);
- free(FirstPoint);
-}
-
-
-/* Find the index of the point with the smallest y.also return the
- * smallest and largest y */
-static
-int
-GetFPolyYBounds(
- SppPointPtr pts,
- int n,
- double yFtrans,
- int *by,
- int *ty)
-{
- SppPointPtr ptMin;
- double ymin, ymax;
- SppPointPtr ptsStart = pts;
-
- ptMin = pts;
- ymin = ymax = (pts++)->y;
-
- while (--n > 0) {
- if (pts->y < ymin)
- {
- ptMin = pts;
- ymin = pts->y;
- }
- if(pts->y > ymax)
- ymax = pts->y;
-
- pts++;
- }
-
- *by = ICEIL(ymin + yFtrans);
- *ty = ICEIL(ymax + yFtrans - 1);
- return ptMin-ptsStart;
-}
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <math.h>
+#include <X11/X.h>
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "mifpoly.h"
+
+static int GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans,
+ int *by, int *ty);
+
+/*
+ * Written by Todd Newman; April. 1987.
+ *
+ * Fill a convex polygon. If the given polygon
+ * is not convex, then the result is undefined.
+ * The algorithm is to order the edges from smallest
+ * y to largest by partitioning the array into a left
+ * edge list and a right edge list. The algorithm used
+ * to traverse each edge is digital differencing analyzer
+ * line algorithm with y as the major axis. There's some funny linear
+ * interpolation involved because of the subpixel postioning.
+ */
+void
+miFillSppPoly(DrawablePtr dst, GCPtr pgc, int count, /* number of points */
+ SppPointPtr ptsIn, /* the points */
+ int xTrans, int yTrans, /* Translate each point by this */
+ double xFtrans, double yFtrans /* translate before conversion
+ by this amount. This provides
+ a mechanism to match rounding
+ errors with any shape that must
+ meet the polygon exactly.
+ */
+ )
+{
+ double xl = 0.0, xr = 0.0, /* x vals of left and right edges */
+ ml = 0.0, /* left edge slope */
+ mr = 0.0, /* right edge slope */
+ dy, /* delta y */
+ i; /* loop counter */
+ int y, /* current scanline */
+ j, imin, /* index of vertex with smallest y */
+ ymin, /* y-extents of polygon */
+ ymax, *width, *FirstWidth, /* output buffer */
+ *Marked; /* set if this vertex has been used */
+ int left, right, /* indices to first endpoints */
+ nextleft, nextright; /* indices to second endpoints */
+ DDXPointPtr ptsOut, FirstPoint; /* output buffer */
+
+ if (pgc->miTranslate) {
+ xTrans += dst->x;
+ yTrans += dst->y;
+ }
+
+ imin = GetFPolyYBounds(ptsIn, count, yFtrans, &ymin, &ymax);
+
+ y = ymax - ymin + 1;
+ if ((count < 3) || (y <= 0))
+ return;
+ ptsOut = FirstPoint = malloc(sizeof(DDXPointRec) * y);
+ width = FirstWidth = malloc(sizeof(int) * y);
+ Marked = malloc(sizeof(int) * count);
+
+ if (!ptsOut || !width || !Marked) {
+ free(Marked);
+ free(width);
+ free(ptsOut);
+ return;
+ }
+
+ for (j = 0; j < count; j++)
+ Marked[j] = 0;
+ nextleft = nextright = imin;
+ Marked[imin] = -1;
+ y = ICEIL(ptsIn[nextleft].y + yFtrans);
+
+ /*
+ * loop through all edges of the polygon
+ */
+ do {
+ /* add a left edge if we need to */
+ if ((y > (ptsIn[nextleft].y + yFtrans) ||
+ ISEQUAL(y, ptsIn[nextleft].y + yFtrans)) &&
+ Marked[nextleft] != 1) {
+ Marked[nextleft]++;
+ left = nextleft++;
+
+ /* find the next edge, considering the end conditions */
+ if (nextleft >= count)
+ nextleft = 0;
+
+ /* now compute the starting point and slope */
+ dy = ptsIn[nextleft].y - ptsIn[left].y;
+ if (dy != 0.0) {
+ ml = (ptsIn[nextleft].x - ptsIn[left].x) / dy;
+ dy = y - (ptsIn[left].y + yFtrans);
+ xl = (ptsIn[left].x + xFtrans) + ml * max(dy, 0);
+ }
+ }
+
+ /* add a right edge if we need to */
+ if ((y > ptsIn[nextright].y + yFtrans) ||
+ (ISEQUAL(y, ptsIn[nextright].y + yFtrans)
+ && Marked[nextright] != 1)) {
+ Marked[nextright]++;
+ right = nextright--;
+
+ /* find the next edge, considering the end conditions */
+ if (nextright < 0)
+ nextright = count - 1;
+
+ /* now compute the starting point and slope */
+ dy = ptsIn[nextright].y - ptsIn[right].y;
+ if (dy != 0.0) {
+ mr = (ptsIn[nextright].x - ptsIn[right].x) / dy;
+ dy = y - (ptsIn[right].y + yFtrans);
+ xr = (ptsIn[right].x + xFtrans) + mr * max(dy, 0);
+ }
+ }
+
+ /*
+ * generate scans to fill while we still have
+ * a right edge as well as a left edge.
+ */
+ i = (min(ptsIn[nextleft].y, ptsIn[nextright].y) + yFtrans) - y;
+
+ if (i < EPSILON) {
+ if (Marked[nextleft] && Marked[nextright]) {
+ /* Arrgh, we're trapped! (no more points)
+ * Out, we've got to get out of here before this decadence saps
+ * our will completely! */
+ break;
+ }
+ continue;
+ }
+ else {
+ j = (int) i;
+ if (!j)
+ j++;
+ }
+ while (j > 0) {
+ int cxl, cxr;
+
+ ptsOut->y = (y) + yTrans;
+
+ cxl = ICEIL(xl);
+ cxr = ICEIL(xr);
+ /* reverse the edges if necessary */
+ if (xl < xr) {
+ *(width++) = cxr - cxl;
+ (ptsOut++)->x = cxl + xTrans;
+ }
+ else {
+ *(width++) = cxl - cxr;
+ (ptsOut++)->x = cxr + xTrans;
+ }
+ y++;
+
+ /* increment down the edges */
+ xl += ml;
+ xr += mr;
+ j--;
+ }
+ } while (y <= ymax);
+
+ /* Finally, fill the spans we've collected */
+ (*pgc->ops->FillSpans) (dst, pgc,
+ ptsOut - FirstPoint, FirstPoint, FirstWidth, 1);
+ free(Marked);
+ free(FirstWidth);
+ free(FirstPoint);
+}
+
+/* Find the index of the point with the smallest y.also return the
+ * smallest and largest y */
+static
+ int
+GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans, int *by, int *ty)
+{
+ SppPointPtr ptMin;
+ double ymin, ymax;
+ SppPointPtr ptsStart = pts;
+
+ ptMin = pts;
+ ymin = ymax = (pts++)->y;
+
+ while (--n > 0) {
+ if (pts->y < ymin) {
+ ptMin = pts;
+ ymin = pts->y;
+ }
+ if (pts->y > ymax)
+ ymax = pts->y;
+
+ pts++;
+ }
+
+ *by = ICEIL(ymin + yFtrans);
+ *ty = ICEIL(ymax + yFtrans - 1);
+ return ptMin - ptsStart;
+}
diff --git a/xorg-server/mi/migc.c b/xorg-server/mi/migc.c
index 50abefcea..c9cdd12af 100644
--- a/xorg-server/mi/migc.c
+++ b/xorg-server/mi/migc.c
@@ -1,249 +1,230 @@
-/*
-
-Copyright 1993, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "migc.h"
-
-/* ARGSUSED */
-void
-miChangeGC(GCPtr pGC, unsigned long mask)
-{
- return;
-}
-
-void
-miDestroyGC(GCPtr pGC)
-{
- if (pGC->pRotatedPixmap)
- (*pGC->pScreen->DestroyPixmap) (pGC->pRotatedPixmap);
- if (pGC->freeCompClip)
- RegionDestroy(pGC->pCompositeClip);
-}
-
-void
-miDestroyClip(GCPtr pGC)
-{
- if (pGC->clientClipType == CT_NONE)
- return;
- else if (pGC->clientClipType == CT_PIXMAP)
- {
- (*pGC->pScreen->DestroyPixmap) ((PixmapPtr) (pGC->clientClip));
- }
- else
- {
- /*
- * we know we'll never have a list of rectangles, since ChangeClip
- * immediately turns them into a region
- */
- RegionDestroy(pGC->clientClip);
- }
- pGC->clientClip = NULL;
- pGC->clientClipType = CT_NONE;
-}
-
-void
-miChangeClip( GCPtr pGC, int type, pointer pvalue, int nrects)
-{
- (*pGC->funcs->DestroyClip) (pGC);
- if (type == CT_PIXMAP)
- {
- /* convert the pixmap to a region */
- pGC->clientClip = (pointer) BitmapToRegion(pGC->pScreen,
- (PixmapPtr) pvalue);
- (*pGC->pScreen->DestroyPixmap) (pvalue);
- }
- else if (type == CT_REGION)
- {
- /* stuff the region in the GC */
- pGC->clientClip = pvalue;
- }
- else if (type != CT_NONE)
- {
- pGC->clientClip = (pointer) RegionFromRects(nrects,
- (xRectangle *) pvalue,
- type);
- free(pvalue);
- }
- pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION : CT_NONE;
- pGC->stateChanges |= GCClipMask;
-}
-
-void
-miCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- RegionPtr prgnNew;
-
- switch (pgcSrc->clientClipType)
- {
- case CT_PIXMAP:
- ((PixmapPtr) pgcSrc->clientClip)->refcnt++;
- /* Fall through !! */
- case CT_NONE:
- (*pgcDst->funcs->ChangeClip) (pgcDst, (int) pgcSrc->clientClipType,
- pgcSrc->clientClip, 0);
- break;
- case CT_REGION:
- prgnNew = RegionCreate(NULL, 1);
- RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
- (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (pointer) prgnNew, 0);
- break;
- }
-}
-
-/* ARGSUSED */
-void
-miCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)
-{
- return;
-}
-
-void
-miComputeCompositeClip( GCPtr pGC, DrawablePtr pDrawable)
-{
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- WindowPtr pWin = (WindowPtr) pDrawable;
- RegionPtr pregWin;
- Bool freeTmpClip, freeCompClip;
-
- if (pGC->subWindowMode == IncludeInferiors)
- {
- pregWin = NotClippedByChildren(pWin);
- freeTmpClip = TRUE;
- }
- else
- {
- pregWin = &pWin->clipList;
- freeTmpClip = FALSE;
- }
- freeCompClip = pGC->freeCompClip;
-
- /*
- * if there is no client clip, we can get by with just keeping the
- * pointer we got, and remembering whether or not should destroy (or
- * maybe re-use) it later. this way, we avoid unnecessary copying of
- * regions. (this wins especially if many clients clip by children
- * and have no client clip.)
- */
- if (pGC->clientClipType == CT_NONE)
- {
- if (freeCompClip)
- RegionDestroy(pGC->pCompositeClip);
- pGC->pCompositeClip = pregWin;
- pGC->freeCompClip = freeTmpClip;
- }
- else
- {
- /*
- * we need one 'real' region to put into the composite clip. if
- * pregWin the current composite clip are real, we can get rid of
- * one. if pregWin is real and the current composite clip isn't,
- * use pregWin for the composite clip. if the current composite
- * clip is real and pregWin isn't, use the current composite
- * clip. if neither is real, create a new region.
- */
-
- RegionTranslate(pGC->clientClip,
- pDrawable->x + pGC->clipOrg.x,
- pDrawable->y + pGC->clipOrg.y);
-
- if (freeCompClip)
- {
- RegionIntersect(pGC->pCompositeClip,
- pregWin, pGC->clientClip);
- if (freeTmpClip)
- RegionDestroy(pregWin);
- }
- else if (freeTmpClip)
- {
- RegionIntersect(pregWin, pregWin, pGC->clientClip);
- pGC->pCompositeClip = pregWin;
- }
- else
- {
- pGC->pCompositeClip = RegionCreate(NullBox, 0);
- RegionIntersect(pGC->pCompositeClip,
- pregWin, pGC->clientClip);
- }
- pGC->freeCompClip = TRUE;
- RegionTranslate(pGC->clientClip,
- -(pDrawable->x + pGC->clipOrg.x),
- -(pDrawable->y + pGC->clipOrg.y));
- }
- } /* end of composite clip for a window */
- else
- {
- BoxRec pixbounds;
-
- /* XXX should we translate by drawable.x/y here ? */
- /* If you want pixmaps in offscreen memory, yes */
- pixbounds.x1 = pDrawable->x;
- pixbounds.y1 = pDrawable->y;
- pixbounds.x2 = pDrawable->x + pDrawable->width;
- pixbounds.y2 = pDrawable->y + pDrawable->height;
-
- if (pGC->freeCompClip)
- {
- RegionReset(pGC->pCompositeClip, &pixbounds);
- }
- else
- {
- pGC->freeCompClip = TRUE;
- pGC->pCompositeClip = RegionCreate(&pixbounds, 1);
- }
-
- if (pGC->clientClipType == CT_REGION)
- {
- if(pDrawable->x || pDrawable->y) {
- RegionTranslate(pGC->clientClip,
- pDrawable->x + pGC->clipOrg.x,
- pDrawable->y + pGC->clipOrg.y);
- RegionIntersect(pGC->pCompositeClip,
- pGC->pCompositeClip, pGC->clientClip);
- RegionTranslate(pGC->clientClip,
- -(pDrawable->x + pGC->clipOrg.x),
- -(pDrawable->y + pGC->clipOrg.y));
- } else {
- RegionTranslate(pGC->pCompositeClip,
- -pGC->clipOrg.x, -pGC->clipOrg.y);
- RegionIntersect(pGC->pCompositeClip,
- pGC->pCompositeClip, pGC->clientClip);
- RegionTranslate(pGC->pCompositeClip,
- pGC->clipOrg.x, pGC->clipOrg.y);
- }
- }
- } /* end of composite clip for pixmap */
-} /* end miComputeCompositeClip */
+/*
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "migc.h"
+
+/* ARGSUSED */
+void
+miChangeGC(GCPtr pGC, unsigned long mask)
+{
+ return;
+}
+
+void
+miDestroyGC(GCPtr pGC)
+{
+ if (pGC->pRotatedPixmap)
+ (*pGC->pScreen->DestroyPixmap) (pGC->pRotatedPixmap);
+ if (pGC->freeCompClip)
+ RegionDestroy(pGC->pCompositeClip);
+}
+
+void
+miDestroyClip(GCPtr pGC)
+{
+ if (pGC->clientClipType == CT_NONE)
+ return;
+ else if (pGC->clientClipType == CT_PIXMAP) {
+ (*pGC->pScreen->DestroyPixmap) ((PixmapPtr) (pGC->clientClip));
+ }
+ else {
+ /*
+ * we know we'll never have a list of rectangles, since ChangeClip
+ * immediately turns them into a region
+ */
+ RegionDestroy(pGC->clientClip);
+ }
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+}
+
+void
+miChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+{
+ (*pGC->funcs->DestroyClip) (pGC);
+ if (type == CT_PIXMAP) {
+ /* convert the pixmap to a region */
+ pGC->clientClip = (pointer) BitmapToRegion(pGC->pScreen,
+ (PixmapPtr) pvalue);
+ (*pGC->pScreen->DestroyPixmap) (pvalue);
+ }
+ else if (type == CT_REGION) {
+ /* stuff the region in the GC */
+ pGC->clientClip = pvalue;
+ }
+ else if (type != CT_NONE) {
+ pGC->clientClip = (pointer) RegionFromRects(nrects,
+ (xRectangle *) pvalue,
+ type);
+ free(pvalue);
+ }
+ pGC->clientClipType = (type != CT_NONE &&
+ pGC->clientClip) ? CT_REGION : CT_NONE;
+ pGC->stateChanges |= GCClipMask;
+}
+
+void
+miCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ RegionPtr prgnNew;
+
+ switch (pgcSrc->clientClipType) {
+ case CT_PIXMAP:
+ ((PixmapPtr) pgcSrc->clientClip)->refcnt++;
+ /* Fall through !! */
+ case CT_NONE:
+ (*pgcDst->funcs->ChangeClip) (pgcDst, (int) pgcSrc->clientClipType,
+ pgcSrc->clientClip, 0);
+ break;
+ case CT_REGION:
+ prgnNew = RegionCreate(NULL, 1);
+ RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
+ (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (pointer) prgnNew, 0);
+ break;
+ }
+}
+
+/* ARGSUSED */
+void
+miCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)
+{
+ return;
+}
+
+void
+miComputeCompositeClip(GCPtr pGC, DrawablePtr pDrawable)
+{
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDrawable;
+ RegionPtr pregWin;
+ Bool freeTmpClip, freeCompClip;
+
+ if (pGC->subWindowMode == IncludeInferiors) {
+ pregWin = NotClippedByChildren(pWin);
+ freeTmpClip = TRUE;
+ }
+ else {
+ pregWin = &pWin->clipList;
+ freeTmpClip = FALSE;
+ }
+ freeCompClip = pGC->freeCompClip;
+
+ /*
+ * if there is no client clip, we can get by with just keeping the
+ * pointer we got, and remembering whether or not should destroy (or
+ * maybe re-use) it later. this way, we avoid unnecessary copying of
+ * regions. (this wins especially if many clients clip by children
+ * and have no client clip.)
+ */
+ if (pGC->clientClipType == CT_NONE) {
+ if (freeCompClip)
+ RegionDestroy(pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
+ }
+ else {
+ /*
+ * we need one 'real' region to put into the composite clip. if
+ * pregWin the current composite clip are real, we can get rid of
+ * one. if pregWin is real and the current composite clip isn't,
+ * use pregWin for the composite clip. if the current composite
+ * clip is real and pregWin isn't, use the current composite
+ * clip. if neither is real, create a new region.
+ */
+
+ RegionTranslate(pGC->clientClip,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+
+ if (freeCompClip) {
+ RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip);
+ if (freeTmpClip)
+ RegionDestroy(pregWin);
+ }
+ else if (freeTmpClip) {
+ RegionIntersect(pregWin, pregWin, pGC->clientClip);
+ pGC->pCompositeClip = pregWin;
+ }
+ else {
+ pGC->pCompositeClip = RegionCreate(NullBox, 0);
+ RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip);
+ }
+ pGC->freeCompClip = TRUE;
+ RegionTranslate(pGC->clientClip,
+ -(pDrawable->x + pGC->clipOrg.x),
+ -(pDrawable->y + pGC->clipOrg.y));
+ }
+ } /* end of composite clip for a window */
+ else {
+ BoxRec pixbounds;
+
+ /* XXX should we translate by drawable.x/y here ? */
+ /* If you want pixmaps in offscreen memory, yes */
+ pixbounds.x1 = pDrawable->x;
+ pixbounds.y1 = pDrawable->y;
+ pixbounds.x2 = pDrawable->x + pDrawable->width;
+ pixbounds.y2 = pDrawable->y + pDrawable->height;
+
+ if (pGC->freeCompClip) {
+ RegionReset(pGC->pCompositeClip, &pixbounds);
+ }
+ else {
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = RegionCreate(&pixbounds, 1);
+ }
+
+ if (pGC->clientClipType == CT_REGION) {
+ if (pDrawable->x || pDrawable->y) {
+ RegionTranslate(pGC->clientClip,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+ RegionIntersect(pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ RegionTranslate(pGC->clientClip,
+ -(pDrawable->x + pGC->clipOrg.x),
+ -(pDrawable->y + pGC->clipOrg.y));
+ }
+ else {
+ RegionTranslate(pGC->pCompositeClip,
+ -pGC->clipOrg.x, -pGC->clipOrg.y);
+ RegionIntersect(pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ RegionTranslate(pGC->pCompositeClip,
+ pGC->clipOrg.x, pGC->clipOrg.y);
+ }
+ }
+ } /* end of composite clip for pixmap */
+} /* end miComputeCompositeClip */
diff --git a/xorg-server/mi/migc.h b/xorg-server/mi/migc.h
index df5805f4d..8c13b2e53 100644
--- a/xorg-server/mi/migc.h
+++ b/xorg-server/mi/migc.h
@@ -26,39 +26,31 @@ from The Open Group.
*/
-
-extern _X_EXPORT void miChangeGC(
- GCPtr /*pGC*/,
- unsigned long /*mask*/
-);
-
-extern _X_EXPORT void miDestroyGC(
- GCPtr /*pGC*/
-);
-
-extern _X_EXPORT void miDestroyClip(
- GCPtr /*pGC*/
-);
-
-extern _X_EXPORT void miChangeClip(
- GCPtr /*pGC*/,
- int /*type*/,
- pointer /*pvalue*/,
- int /*nrects*/
-);
-
-extern _X_EXPORT void miCopyClip(
- GCPtr /*pgcDst*/,
- GCPtr /*pgcSrc*/
-);
-
-extern _X_EXPORT void miCopyGC(
- GCPtr /*pGCSrc*/,
- unsigned long /*changes*/,
- GCPtr /*pGCDst*/
-);
-
-extern _X_EXPORT void miComputeCompositeClip(
- GCPtr /*pGC*/,
- DrawablePtr /*pDrawable*/
-);
+extern _X_EXPORT void miChangeGC(GCPtr /*pGC */ ,
+ unsigned long /*mask */
+ );
+
+extern _X_EXPORT void miDestroyGC(GCPtr /*pGC */
+ );
+
+extern _X_EXPORT void miDestroyClip(GCPtr /*pGC */
+ );
+
+extern _X_EXPORT void miChangeClip(GCPtr /*pGC */ ,
+ int /*type */ ,
+ pointer /*pvalue */ ,
+ int /*nrects */
+ );
+
+extern _X_EXPORT void miCopyClip(GCPtr /*pgcDst */ ,
+ GCPtr /*pgcSrc */
+ );
+
+extern _X_EXPORT void miCopyGC(GCPtr /*pGCSrc */ ,
+ unsigned long /*changes */ ,
+ GCPtr /*pGCDst */
+ );
+
+extern _X_EXPORT void miComputeCompositeClip(GCPtr /*pGC */ ,
+ DrawablePtr /*pDrawable */
+ );
diff --git a/xorg-server/mi/miglblt.c b/xorg-server/mi/miglblt.c
index b93ef5efa..1a70911fa 100644
--- a/xorg-server/mi/miglblt.c
+++ b/xorg-server/mi/miglblt.c
@@ -1,256 +1,232 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmap.h"
-#include "servermd.h"
-#include "mi.h"
-
-/*
- machine-independent glyph blt.
- assumes that glyph bits in snf are written in bytes,
-have same bit order as the server's bitmap format,
-and are byte padded. this corresponds to the snf distributed
-with the sample server.
-
- get a scratch GC.
- in the scratch GC set alu = GXcopy, fg = 1, bg = 0
- allocate a bitmap big enough to hold the largest glyph in the font
- validate the scratch gc with the bitmap
- for each glyph
- carefully put the bits of the glyph in a buffer,
- padded to the server pixmap scanline padding rules
- fake a call to PutImage from the buffer into the bitmap
- use the bitmap in a call to PushPixels
-*/
-
-void
-miPolyGlyphBlt(
- DrawablePtr pDrawable,
- GC *pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci, /* array of character info */
- pointer pglyphBase /* start of array of glyphs */
- )
-{
- int width, height;
- PixmapPtr pPixmap;
- int nbyLine; /* bytes per line of padded pixmap */
- FontPtr pfont;
- GCPtr pGCtmp;
- int i;
- int j;
- unsigned char *pbits; /* buffer for PutImage */
- unsigned char *pb; /* temp pointer into buffer */
- CharInfoPtr pci; /* currect char info */
- unsigned char *pglyph; /* pointer bits in glyph */
- int gWidth, gHeight; /* width and height of glyph */
- int nbyGlyphWidth; /* bytes per scanline of glyph */
- int nbyPadGlyph; /* server padded line of glyph */
-
- ChangeGCVal gcvals[3];
-
- if (pGC->miTranslate)
- {
- x += pDrawable->x;
- y += pDrawable->y;
- }
-
- pfont = pGC->font;
- width = FONTMAXBOUNDS(pfont,rightSideBearing) -
- FONTMINBOUNDS(pfont,leftSideBearing);
- height = FONTMAXBOUNDS(pfont,ascent) +
- FONTMAXBOUNDS(pfont,descent);
-
- pPixmap = (*pDrawable->pScreen->CreatePixmap)(pDrawable->pScreen,
- width, height, 1,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap)
- return;
-
- pGCtmp = GetScratchGC(1, pDrawable->pScreen);
- if (!pGCtmp)
- {
- (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
- return;
- }
-
- gcvals[0].val = GXcopy;
- gcvals[1].val = 1;
- gcvals[2].val = 0;
-
- ChangeGC(NullClient, pGCtmp, GCFunction|GCForeground|GCBackground, gcvals);
-
- nbyLine = BitmapBytePad(width);
- pbits = malloc(height*nbyLine);
- if (!pbits)
- {
- (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
- FreeScratchGC(pGCtmp);
- return;
- }
- while(nglyph--)
- {
- pci = *ppci++;
- pglyph = FONTGLYPHBITS(pglyphBase, pci);
- gWidth = GLYPHWIDTHPIXELS(pci);
- gHeight = GLYPHHEIGHTPIXELS(pci);
- if (gWidth && gHeight)
- {
- nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci);
- nbyPadGlyph = BitmapBytePad(gWidth);
-
- if (nbyGlyphWidth == nbyPadGlyph
-#if GLYPHPADBYTES != 4
- && (((int) pglyph) & 3) == 0
-#endif
- )
- {
- pb = pglyph;
- }
- else
- {
- for (i=0, pb = pbits; i<gHeight; i++, pb = pbits+(i*nbyPadGlyph))
- for (j = 0; j < nbyGlyphWidth; j++)
- *pb++ = *pglyph++;
- pb = pbits;
- }
-
- if ((pGCtmp->serialNumber) != (pPixmap->drawable.serialNumber))
- ValidateGC((DrawablePtr)pPixmap, pGCtmp);
- (*pGCtmp->ops->PutImage)((DrawablePtr)pPixmap, pGCtmp,
- pPixmap->drawable.depth,
- 0, 0, gWidth, gHeight,
- 0, XYBitmap, (char *)pb);
-
- (*pGC->ops->PushPixels)(pGC, pPixmap, pDrawable,
- gWidth, gHeight,
- x + pci->metrics.leftSideBearing,
- y - pci->metrics.ascent);
- }
- x += pci->metrics.characterWidth;
- }
- (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
- free(pbits);
- FreeScratchGC(pGCtmp);
-}
-
-
-void
-miImageGlyphBlt(
- DrawablePtr pDrawable,
- GC *pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci, /* array of character info */
- pointer pglyphBase /* start of array of glyphs */
- )
-{
- ExtentInfoRec info; /* used by QueryGlyphExtents() */
- ChangeGCVal gcvals[3];
- int oldAlu, oldFS;
- unsigned long oldFG;
- xRectangle backrect;
-
- QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
-
- if (info.overallWidth >= 0)
- {
- backrect.x = x;
- backrect.width = info.overallWidth;
- }
- else
- {
- backrect.x = x + info.overallWidth;
- backrect.width = -info.overallWidth;
- }
- backrect.y = y - FONTASCENT(pGC->font);
- backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
-
- oldAlu = pGC->alu;
- oldFG = pGC->fgPixel;
- oldFS = pGC->fillStyle;
-
- /* fill in the background */
- gcvals[0].val = GXcopy;
- gcvals[1].val = pGC->bgPixel;
- gcvals[2].val = FillSolid;
- ChangeGC(NullClient, pGC, GCFunction|GCForeground|GCFillStyle, gcvals);
- ValidateGC(pDrawable, pGC);
- (*pGC->ops->PolyFillRect)(pDrawable, pGC, 1, &backrect);
-
- /* put down the glyphs */
- gcvals[0].val = oldFG;
- ChangeGC(NullClient, pGC, GCForeground, gcvals);
- ValidateGC(pDrawable, pGC);
- (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci,
- pglyphBase);
-
- /* put all the toys away when done playing */
- gcvals[0].val = oldAlu;
- gcvals[1].val = oldFG;
- gcvals[2].val = oldFS;
- ChangeGC(NullClient, pGC, GCFunction|GCForeground|GCFillStyle, gcvals);
- ValidateGC(pDrawable, pGC);
-
-}
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmap.h"
+#include "servermd.h"
+#include "mi.h"
+
+/*
+ machine-independent glyph blt.
+ assumes that glyph bits in snf are written in bytes,
+have same bit order as the server's bitmap format,
+and are byte padded. this corresponds to the snf distributed
+with the sample server.
+
+ get a scratch GC.
+ in the scratch GC set alu = GXcopy, fg = 1, bg = 0
+ allocate a bitmap big enough to hold the largest glyph in the font
+ validate the scratch gc with the bitmap
+ for each glyph
+ carefully put the bits of the glyph in a buffer,
+ padded to the server pixmap scanline padding rules
+ fake a call to PutImage from the buffer into the bitmap
+ use the bitmap in a call to PushPixels
+*/
+
+void
+miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */
+ pointer pglyphBase /* start of array of glyphs */
+ )
+{
+ int width, height;
+ PixmapPtr pPixmap;
+ int nbyLine; /* bytes per line of padded pixmap */
+ FontPtr pfont;
+ GCPtr pGCtmp;
+ int i;
+ int j;
+ unsigned char *pbits; /* buffer for PutImage */
+ unsigned char *pb; /* temp pointer into buffer */
+ CharInfoPtr pci; /* currect char info */
+ unsigned char *pglyph; /* pointer bits in glyph */
+ int gWidth, gHeight; /* width and height of glyph */
+ int nbyGlyphWidth; /* bytes per scanline of glyph */
+ int nbyPadGlyph; /* server padded line of glyph */
+
+ ChangeGCVal gcvals[3];
+
+ if (pGC->miTranslate) {
+ x += pDrawable->x;
+ y += pDrawable->y;
+ }
+
+ pfont = pGC->font;
+ width = FONTMAXBOUNDS(pfont, rightSideBearing) -
+ FONTMINBOUNDS(pfont, leftSideBearing);
+ height = FONTMAXBOUNDS(pfont, ascent) + FONTMAXBOUNDS(pfont, descent);
+
+ pPixmap = (*pDrawable->pScreen->CreatePixmap) (pDrawable->pScreen,
+ width, height, 1,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pPixmap)
+ return;
+
+ pGCtmp = GetScratchGC(1, pDrawable->pScreen);
+ if (!pGCtmp) {
+ (*pDrawable->pScreen->DestroyPixmap) (pPixmap);
+ return;
+ }
+
+ gcvals[0].val = GXcopy;
+ gcvals[1].val = 1;
+ gcvals[2].val = 0;
+
+ ChangeGC(NullClient, pGCtmp, GCFunction | GCForeground | GCBackground,
+ gcvals);
+
+ nbyLine = BitmapBytePad(width);
+ pbits = malloc(height * nbyLine);
+ if (!pbits) {
+ (*pDrawable->pScreen->DestroyPixmap) (pPixmap);
+ FreeScratchGC(pGCtmp);
+ return;
+ }
+ while (nglyph--) {
+ pci = *ppci++;
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ gWidth = GLYPHWIDTHPIXELS(pci);
+ gHeight = GLYPHHEIGHTPIXELS(pci);
+ if (gWidth && gHeight) {
+ nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci);
+ nbyPadGlyph = BitmapBytePad(gWidth);
+
+ if (nbyGlyphWidth == nbyPadGlyph
+#if GLYPHPADBYTES != 4
+ && (((int) pglyph) & 3) == 0
+#endif
+ ) {
+ pb = pglyph;
+ }
+ else {
+ for (i = 0, pb = pbits; i < gHeight;
+ i++, pb = pbits + (i * nbyPadGlyph))
+ for (j = 0; j < nbyGlyphWidth; j++)
+ *pb++ = *pglyph++;
+ pb = pbits;
+ }
+
+ if ((pGCtmp->serialNumber) != (pPixmap->drawable.serialNumber))
+ ValidateGC((DrawablePtr) pPixmap, pGCtmp);
+ (*pGCtmp->ops->PutImage) ((DrawablePtr) pPixmap, pGCtmp,
+ pPixmap->drawable.depth,
+ 0, 0, gWidth, gHeight,
+ 0, XYBitmap, (char *) pb);
+
+ (*pGC->ops->PushPixels) (pGC, pPixmap, pDrawable,
+ gWidth, gHeight,
+ x + pci->metrics.leftSideBearing,
+ y - pci->metrics.ascent);
+ }
+ x += pci->metrics.characterWidth;
+ }
+ (*pDrawable->pScreen->DestroyPixmap) (pPixmap);
+ free(pbits);
+ FreeScratchGC(pGCtmp);
+}
+
+void
+miImageGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */
+ pointer pglyphBase /* start of array of glyphs */
+ )
+{
+ ExtentInfoRec info; /* used by QueryGlyphExtents() */
+ ChangeGCVal gcvals[3];
+ int oldAlu, oldFS;
+ unsigned long oldFG;
+ xRectangle backrect;
+
+ QueryGlyphExtents(pGC->font, ppci, (unsigned long) nglyph, &info);
+
+ if (info.overallWidth >= 0) {
+ backrect.x = x;
+ backrect.width = info.overallWidth;
+ }
+ else {
+ backrect.x = x + info.overallWidth;
+ backrect.width = -info.overallWidth;
+ }
+ backrect.y = y - FONTASCENT(pGC->font);
+ backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
+
+ oldAlu = pGC->alu;
+ oldFG = pGC->fgPixel;
+ oldFS = pGC->fillStyle;
+
+ /* fill in the background */
+ gcvals[0].val = GXcopy;
+ gcvals[1].val = pGC->bgPixel;
+ gcvals[2].val = FillSolid;
+ ChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFillStyle, gcvals);
+ ValidateGC(pDrawable, pGC);
+ (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &backrect);
+
+ /* put down the glyphs */
+ gcvals[0].val = oldFG;
+ ChangeGC(NullClient, pGC, GCForeground, gcvals);
+ ValidateGC(pDrawable, pGC);
+ (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+
+ /* put all the toys away when done playing */
+ gcvals[0].val = oldAlu;
+ gcvals[1].val = oldFG;
+ gcvals[2].val = oldFS;
+ ChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFillStyle, gcvals);
+ ValidateGC(pDrawable, pGC);
+
+}
diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c
index 3076e7b28..462bcfff5 100644
--- a/xorg-server/mi/miinitext.c
+++ b/xorg-server/mi/miinitext.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -94,7 +93,6 @@ SOFTWARE.
#include "micmap.h"
#include "globals.h"
-
extern Bool noTestExtensions;
#ifdef COMPOSITE
@@ -119,6 +117,7 @@ extern Bool noMITShmExtension;
extern Bool noRRExtension;
#endif
extern Bool noRenderExtension;
+
#ifdef XCSECURITY
extern Bool noSecurityExtension;
#endif
@@ -156,8 +155,8 @@ extern Bool noGEExtension;
#ifndef XFree86LOADER
#define INITARGS void
-typedef void (*InitExtension)(INITARGS);
-#else /* XFree86Loader */
+typedef void (*InitExtension) (INITARGS);
+#else /* XFree86Loader */
#include "loaderProcs.h"
#endif
@@ -196,12 +195,14 @@ extern void PanoramiXExtensionInit(INITARGS);
extern void PseudoramiXExtensionInit(INITARGS);
#endif
extern void XInputExtensionInit(INITARGS);
+
#ifdef XTEST
extern void XTestExtensionInit(INITARGS);
#endif
extern void BigReqExtensionInit(INITARGS);
+
#ifdef SCREENSAVER
-extern void ScreenSaverExtensionInit (INITARGS);
+extern void ScreenSaverExtensionInit(INITARGS);
#endif
#ifdef XV
extern void XvExtensionInit(INITARGS);
@@ -210,6 +211,7 @@ extern void XvMCExtensionInit(INITARGS);
extern void SyncExtensionInit(INITARGS);
extern void XkbExtensionInit(INITARGS);
extern void XCMiscExtensionInit(INITARGS);
+
#ifdef XRECORD
extern void RecordExtensionInit(INITARGS);
#endif
@@ -234,7 +236,7 @@ extern void XFree86DGAExtensionInit(INITARGS);
#ifdef GLXEXT
typedef struct __GLXprovider __GLXprovider;
extern __GLXprovider __glXDRISWRastProvider;
-extern void GlxPushProvider(__GLXprovider *impl);
+extern void GlxPushProvider(__GLXprovider * impl);
extern void GlxExtensionInit(INITARGS);
#endif
#ifdef XF86DRI
@@ -244,6 +246,7 @@ extern void XFree86DRIExtensionInit(INITARGS);
extern void DPMSExtensionInit(INITARGS);
#endif
extern void RenderExtensionInit(INITARGS);
+
#ifdef RANDR
extern void RRExtensionInit(INITARGS);
#endif
@@ -272,253 +275,279 @@ typedef struct {
Bool *disablePtr;
} ExtensionToggle;
-static ExtensionToggle ExtensionToggleList[] =
-{
+static ExtensionToggle ExtensionToggleList[] = {
/* sort order is extension name string as shown in xdpyinfo */
- { "Generic Events", &noGEExtension },
+ {"Generic Events", &noGEExtension},
#ifdef COMPOSITE
- { "Composite", &noCompositeExtension },
+ {"Composite", &noCompositeExtension},
#endif
#ifdef DAMAGE
- { "DAMAGE", &noDamageExtension },
+ {"DAMAGE", &noDamageExtension},
#endif
#ifdef DBE
- { "DOUBLE-BUFFER", &noDbeExtension },
+ {"DOUBLE-BUFFER", &noDbeExtension},
#endif
#ifdef DPMSExtension
- { "DPMS", &noDPMSExtension },
+ {"DPMS", &noDPMSExtension},
#endif
#ifdef GLXEXT
- { "GLX", &noGlxExtension },
+ {"GLX", &noGlxExtension},
#endif
#ifdef SCREENSAVER
- { "MIT-SCREEN-SAVER", &noScreenSaverExtension },
+ {"MIT-SCREEN-SAVER", &noScreenSaverExtension},
#endif
#ifdef MITSHM
- { SHMNAME, &noMITShmExtension },
+ {SHMNAME, &noMITShmExtension},
#endif
#ifdef RANDR
- { "RANDR", &noRRExtension },
+ {"RANDR", &noRRExtension},
#endif
- { "RENDER", &noRenderExtension },
+ {"RENDER", &noRenderExtension},
#ifdef XCSECURITY
- { "SECURITY", &noSecurityExtension },
+ {"SECURITY", &noSecurityExtension},
#endif
#ifdef RES
- { "X-Resource", &noResExtension },
+ {"X-Resource", &noResExtension},
#endif
#ifdef XF86BIGFONT
- { "XFree86-Bigfont", &noXFree86BigfontExtension },
+ {"XFree86-Bigfont", &noXFree86BigfontExtension},
#endif
#ifdef XFreeXDGA
- { "XFree86-DGA", &noXFree86DGAExtension },
+ {"XFree86-DGA", &noXFree86DGAExtension},
#endif
#ifdef XF86DRI
- { "XFree86-DRI", &noXFree86DRIExtension },
+ {"XFree86-DRI", &noXFree86DRIExtension},
#endif
#ifdef XF86VIDMODE
- { "XFree86-VidModeExtension", &noXFree86VidModeExtension },
+ {"XFree86-VidModeExtension", &noXFree86VidModeExtension},
#endif
#ifdef XFIXES
- { "XFIXES", &noXFixesExtension },
+ {"XFIXES", &noXFixesExtension},
#endif
#ifdef PANORAMIX
- { "XINERAMA", &noPanoramiXExtension },
+ {"XINERAMA", &noPanoramiXExtension},
#endif
- { "XInputExtension", NULL },
- { "XKEYBOARD", NULL },
+ {"XInputExtension", NULL},
+ {"XKEYBOARD", NULL},
#ifdef XSELINUX
- { "SELinux", &noSELinuxExtension },
+ {"SELinux", &noSELinuxExtension},
#endif
- { "XTEST", &noTestExtensions },
+ {"XTEST", &noTestExtensions},
#ifdef XV
- { "XVideo", &noXvExtension },
+ {"XVideo", &noXvExtension},
#endif
- { NULL, NULL }
+ {NULL, NULL}
};
-Bool EnableDisableExtension(const char *name, Bool enable)
+Bool
+EnableDisableExtension(const char *name, Bool enable)
{
ExtensionToggle *ext = &ExtensionToggleList[0];
for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
- if (strcmp(name, ext->name) == 0) {
- if (ext->disablePtr != NULL) {
- *ext->disablePtr = !enable;
- return TRUE;
- } else {
- /* Extension is always on, impossible to disable */
- return enable; /* okay if they wanted to enable,
- fail if they tried to disable */
- }
- }
+ if (strcmp(name, ext->name) == 0) {
+ if (ext->disablePtr != NULL) {
+ *ext->disablePtr = !enable;
+ return TRUE;
+ }
+ else {
+ /* Extension is always on, impossible to disable */
+ return enable; /* okay if they wanted to enable,
+ fail if they tried to disable */
+ }
+ }
}
return FALSE;
}
-void EnableDisableExtensionError(const char *name, Bool enable)
+void
+EnableDisableExtensionError(const char *name, Bool enable)
{
ExtensionToggle *ext = &ExtensionToggleList[0];
Bool found = FALSE;
for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
- if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) {
- ErrorF("[mi] Extension \"%s\" can not be disabled\n", name);
- found = TRUE;
- break;
- }
+ if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) {
+ ErrorF("[mi] Extension \"%s\" can not be disabled\n", name);
+ found = TRUE;
+ break;
+ }
}
if (found == FALSE)
- ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
+ ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
ErrorF("[mi] Only the following extensions can be run-time %s:\n",
- enable ? "enabled" : "disabled");
+ enable ? "enabled" : "disabled");
for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
- if (ext->disablePtr != NULL) {
- ErrorF("[mi] %s\n", ext->name);
- }
+ if (ext->disablePtr != NULL) {
+ ErrorF("[mi] %s\n", ext->name);
+ }
}
}
#ifndef XFree86LOADER
-/*ARGSUSED*/
-void
+ /*ARGSUSED*/ void
InitExtensions(int argc, char *argv[])
{
- if (!noGEExtension) GEExtensionInit();
+ if (!noGEExtension)
+ GEExtensionInit();
#ifdef PANORAMIX
- if (!noPanoramiXExtension) PanoramiXExtensionInit();
+ if (!noPanoramiXExtension)
+ PanoramiXExtensionInit();
#endif
#ifdef INXQUARTZ
- if(!noPseudoramiXExtension) PseudoramiXExtensionInit();
+ if (!noPseudoramiXExtension)
+ PseudoramiXExtensionInit();
#endif
ShapeExtensionInit();
#ifdef MITSHM
- if (!noMITShmExtension) ShmExtensionInit();
+ if (!noMITShmExtension)
+ ShmExtensionInit();
#endif
XInputExtensionInit();
#ifdef XTEST
- if (!noTestExtensions) XTestExtensionInit();
+ if (!noTestExtensions)
+ XTestExtensionInit();
#endif
BigReqExtensionInit();
#if defined(SCREENSAVER)
- if (!noScreenSaverExtension) ScreenSaverExtensionInit ();
+ if (!noScreenSaverExtension)
+ ScreenSaverExtensionInit();
#endif
#ifdef XV
if (!noXvExtension) {
- XvExtensionInit();
- XvMCExtensionInit();
+ XvExtensionInit();
+ XvMCExtensionInit();
}
#endif
SyncExtensionInit();
XkbExtensionInit();
XCMiscExtensionInit();
#ifdef XRECORD
- if (!noTestExtensions) RecordExtensionInit();
+ if (!noTestExtensions)
+ RecordExtensionInit();
#endif
#ifdef DBE
- if (!noDbeExtension) DbeExtensionInit();
+ if (!noDbeExtension)
+ DbeExtensionInit();
#endif
#ifdef XCSECURITY
- if (!noSecurityExtension) SecurityExtensionInit();
+ if (!noSecurityExtension)
+ SecurityExtensionInit();
#endif
#ifdef XSELINUX
- if (!noSELinuxExtension) SELinuxExtensionInit();
+ if (!noSELinuxExtension)
+ SELinuxExtensionInit();
#endif
#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS)
- if (!noDPMSExtension) DPMSExtensionInit();
+ if (!noDPMSExtension)
+ DPMSExtensionInit();
#endif
#ifdef XF86BIGFONT
- if (!noXFree86BigfontExtension) XFree86BigfontExtensionInit();
+ if (!noXFree86BigfontExtension)
+ XFree86BigfontExtensionInit();
#endif
#if !defined(NO_HW_ONLY_EXTS)
#if defined(XF86VIDMODE)
- if (!noXFree86VidModeExtension) XFree86VidModeExtensionInit();
+ if (!noXFree86VidModeExtension)
+ XFree86VidModeExtensionInit();
#endif
#if defined(XFreeXDGA)
- if (!noXFree86DGAExtension) XFree86DGAExtensionInit();
+ if (!noXFree86DGAExtension)
+ XFree86DGAExtensionInit();
#endif
#ifdef XF86DRI
- if (!noXFree86DRIExtension) XFree86DRIExtensionInit();
+ if (!noXFree86DRIExtension)
+ XFree86DRIExtensionInit();
#endif
#endif
#ifdef XFIXES
/* must be before Render to layer DisplayCursor correctly */
- if (!noXFixesExtension) XFixesExtensionInit();
+ if (!noXFixesExtension)
+ XFixesExtensionInit();
#endif
- if (!noRenderExtension) RenderExtensionInit();
+ if (!noRenderExtension)
+ RenderExtensionInit();
#ifdef RANDR
- if (!noRRExtension) RRExtensionInit();
+ if (!noRRExtension)
+ RRExtensionInit();
#endif
#ifdef RES
- if (!noResExtension) ResExtensionInit();
+ if (!noResExtension)
+ ResExtensionInit();
#endif
#ifdef DMXEXT
- DMXExtensionInit(); /* server-specific extension, cannot be disabled */
+ DMXExtensionInit(); /* server-specific extension, cannot be disabled */
#endif
#ifdef COMPOSITE
- if (!noCompositeExtension) CompositeExtensionInit();
+ if (!noCompositeExtension)
+ CompositeExtensionInit();
#endif
#ifdef DAMAGE
- if (!noDamageExtension) DamageExtensionInit();
+ if (!noDamageExtension)
+ DamageExtensionInit();
#endif
#ifdef GLXEXT
if (serverGeneration == 1)
{
- GlxPushProvider(&__glXDRISWRastProvider);
- glxWinPushNativeProvider();
+ GlxPushProvider(&__glXDRISWRastProvider);
+ glxWinPushNativeProvider();
}
- if (!noGlxExtension) GlxExtensionInit();
+ if (!noGlxExtension)
+ GlxExtensionInit();
+
#endif
}
-#else /* XFree86LOADER */
+#else /* XFree86LOADER */
/* List of built-in (statically linked) extensions */
static ExtensionModule staticExtensions[] = {
- { GEExtensionInit, "Generic Event Extension", &noGEExtension, NULL, NULL},
- { ShapeExtensionInit, "SHAPE", NULL, NULL, NULL },
+ {GEExtensionInit, "Generic Event Extension", &noGEExtension, NULL, NULL},
+ {ShapeExtensionInit, "SHAPE", NULL, NULL, NULL},
#ifdef MITSHM
- { ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL },
+ {ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL},
#endif
- { XInputExtensionInit, "XInputExtension", NULL, NULL, NULL },
+ {XInputExtensionInit, "XInputExtension", NULL, NULL, NULL},
#ifdef XTEST
- { XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL },
+ {XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL},
#endif
- { BigReqExtensionInit, "BIG-REQUESTS", NULL, NULL, NULL },
- { SyncExtensionInit, "SYNC", NULL, NULL, NULL },
- { XkbExtensionInit, XkbName, NULL, NULL, NULL },
- { XCMiscExtensionInit, "XC-MISC", NULL, NULL, NULL },
+ {BigReqExtensionInit, "BIG-REQUESTS", NULL, NULL, NULL},
+ {SyncExtensionInit, "SYNC", NULL, NULL, NULL},
+ {XkbExtensionInit, XkbName, NULL, NULL, NULL},
+ {XCMiscExtensionInit, "XC-MISC", NULL, NULL, NULL},
#ifdef XCSECURITY
- { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
+ {SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL,
+ NULL},
#endif
#ifdef PANORAMIX
- { PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, NULL, NULL },
+ {PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension,
+ NULL, NULL},
#endif
#ifdef XFIXES
/* must be before Render to layer DisplayCursor correctly */
- { XFixesExtensionInit, "XFIXES", &noXFixesExtension, NULL, NULL },
+ {XFixesExtensionInit, "XFIXES", &noXFixesExtension, NULL, NULL},
#endif
#ifdef XF86BIGFONT
- { XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension, NULL, NULL },
+ {XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension,
+ NULL, NULL},
#endif
- { RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL },
+ {RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL},
#ifdef RANDR
- { RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL },
+ {RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL},
#endif
#ifdef COMPOSITE
- { CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL },
+ {CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL},
#endif
#ifdef DAMAGE
- { DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL },
+ {DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL},
#endif
- { NULL, NULL, NULL, NULL, NULL }
+ {NULL, NULL, NULL, NULL, NULL}
};
-
-/*ARGSUSED*/
-void
+
+ /*ARGSUSED*/ void
InitExtensions(int argc, char *argv[])
{
int i;
@@ -526,22 +555,22 @@ InitExtensions(int argc, char *argv[])
static Bool listInitialised = FALSE;
if (!listInitialised) {
- /* Add built-in extensions to the list. */
- for (i = 0; staticExtensions[i].name; i++)
- LoadExtension(&staticExtensions[i], TRUE);
+ /* Add built-in extensions to the list. */
+ for (i = 0; staticExtensions[i].name; i++)
+ LoadExtension(&staticExtensions[i], TRUE);
- /* Sort the extensions according the init dependencies. */
- LoaderSortExtensions();
- listInitialised = TRUE;
+ /* Sort the extensions according the init dependencies. */
+ LoaderSortExtensions();
+ listInitialised = TRUE;
}
for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
- ext = &ExtensionModuleList[i];
- if (ext->initFunc != NULL &&
- (ext->disablePtr == NULL || !*ext->disablePtr)) {
- (ext->initFunc)();
- }
+ ext = &ExtensionModuleList[i];
+ if (ext->initFunc != NULL &&
+ (ext->disablePtr == NULL || !*ext->disablePtr)) {
+ (ext->initFunc) ();
+ }
}
}
-#endif /* XFree86LOADER */
+#endif /* XFree86LOADER */
diff --git a/xorg-server/mi/miline.h b/xorg-server/mi/miline.h
index 0f2fc3374..c1a51c15c 100644
--- a/xorg-server/mi/miline.h
+++ b/xorg-server/mi/miline.h
@@ -1,173 +1,172 @@
-
-/*
-
-Copyright 1994, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-
-#ifndef MILINE_H
-
-#include "screenint.h"
-#include "privates.h"
-
-/*
- * Public definitions used for configuring basic pixelization aspects
- * of the sample implementation line-drawing routines provided in
- * {mfb,mi,cfb*} at run-time.
- */
-
-#define XDECREASING 4
-#define YDECREASING 2
-#define YMAJOR 1
-
-#define OCTANT1 (1 << (YDECREASING))
-#define OCTANT2 (1 << (YDECREASING|YMAJOR))
-#define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR))
-#define OCTANT4 (1 << (XDECREASING|YDECREASING))
-#define OCTANT5 (1 << (XDECREASING))
-#define OCTANT6 (1 << (XDECREASING|YMAJOR))
-#define OCTANT7 (1 << (YMAJOR))
-#define OCTANT8 (1 << (0))
-
-#define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8)
-
-#define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5)
-
-/*
- * Devices can configure the rendering of routines in mi, mfb, and cfb*
- * by specifying a thin line bias to be applied to a particular screen
- * using the following function. The bias parameter is an OR'ing of
- * the appropriate OCTANT constants defined above to indicate which
- * octants to bias a line to prefer an axial step when the Bresenham
- * error term is exactly zero. The octants are mapped as follows:
- *
- * \ | /
- * \ 3 | 2 /
- * \ | /
- * 4 \ | / 1
- * \|/
- * -----------
- * /|\
- * 5 / | \ 8
- * / | \
- * / 6 | 7 \
- * / | \
- *
- * For more information, see "Ambiguities in Incremental Line Rastering,"
- * Jack E. Bresenham, IEEE CG&A, May 1987.
- */
-
-extern _X_EXPORT void miSetZeroLineBias(
- ScreenPtr /* pScreen */,
- unsigned int /* bias */
-);
-
-/*
- * Private definitions needed for drawing thin (zero width) lines
- * Used by the mi, mfb, and all cfb* components.
- */
-
-#define X_AXIS 0
-#define Y_AXIS 1
-
-#define OUT_LEFT 0x08
-#define OUT_RIGHT 0x04
-#define OUT_ABOVE 0x02
-#define OUT_BELOW 0x01
-
-#define OUTCODES(_result, _x, _y, _pbox) \
- if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \
- else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \
- if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \
- else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW;
-
-#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
-{\
- if (x < xmin) outcode |= OUT_LEFT;\
- if (x > xmax) outcode |= OUT_RIGHT;\
- if (y < ymin) outcode |= OUT_ABOVE;\
- if (y > ymax) outcode |= OUT_BELOW;\
-}
-
-#define SWAPINT(i, j) \
-{ int _t = i; i = j; j = _t; }
-
-#define SWAPPT(i, j) \
-{ DDXPointRec _t; _t = i; i = j; j = _t; }
-
-#define SWAPINT_PAIR(x1, y1, x2, y2)\
-{ int t = x1; x1 = x2; x2 = t;\
- t = y1; y1 = y2; y2 = t;\
-}
-
-#define miGetZeroLineBias(_pScreen) ((unsigned long) (unsigned long*)\
- dixLookupPrivate(&(_pScreen)->devPrivates, miZeroLineScreenKey))
-
-#define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \
- (_octant) = 0; \
- (_sx) = (_SX); \
- if (((_adx) = (_x2) - (_x1)) < 0) { \
- (_adx) = -(_adx); \
- (_sx = -(_sx)); \
- (_octant) |= XDECREASING; \
- } \
- (_sy) = (_SY); \
- if (((_ady) = (_y2) - (_y1)) < 0) { \
- (_ady) = -(_ady); \
- (_sy = -(_sy)); \
- (_octant) |= YDECREASING; \
- }
-
-#define SetYMajorOctant(_octant) ((_octant) |= YMAJOR)
-
-#define FIXUP_ERROR(_e, _octant, _bias) \
- (_e) -= (((_bias) >> (_octant)) & 1)
-
-#define IsXMajorOctant(_octant) (!((_octant) & YMAJOR))
-#define IsYMajorOctant(_octant) ((_octant) & YMAJOR)
-#define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING)
-#define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING)
-
-extern _X_EXPORT DevPrivateKeyRec miZeroLineScreenKeyRec;
-#define miZeroLineScreenKey (&miZeroLineScreenKeyRec)
-
-extern _X_EXPORT int miZeroClipLine(
- int /*xmin*/,
- int /*ymin*/,
- int /*xmax*/,
- int /*ymax*/,
- int * /*new_x1*/,
- int * /*new_y1*/,
- int * /*new_x2*/,
- int * /*new_y2*/,
- unsigned int /*adx*/,
- unsigned int /*ady*/,
- int * /*pt1_clipped*/,
- int * /*pt2_clipped*/,
- int /*octant*/,
- unsigned int /*bias*/,
- int /*oc1*/,
- int /*oc2*/
-);
-
-#endif /* MILINE_H */
+
+/*
+
+Copyright 1994, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef MILINE_H
+
+#include "screenint.h"
+#include "privates.h"
+
+/*
+ * Public definitions used for configuring basic pixelization aspects
+ * of the sample implementation line-drawing routines provided in
+ * {mfb,mi,cfb*} at run-time.
+ */
+
+#define XDECREASING 4
+#define YDECREASING 2
+#define YMAJOR 1
+
+#define OCTANT1 (1 << (YDECREASING))
+#define OCTANT2 (1 << (YDECREASING|YMAJOR))
+#define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR))
+#define OCTANT4 (1 << (XDECREASING|YDECREASING))
+#define OCTANT5 (1 << (XDECREASING))
+#define OCTANT6 (1 << (XDECREASING|YMAJOR))
+#define OCTANT7 (1 << (YMAJOR))
+#define OCTANT8 (1 << (0))
+
+#define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8)
+
+#define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5)
+
+/*
+ * Devices can configure the rendering of routines in mi, mfb, and cfb*
+ * by specifying a thin line bias to be applied to a particular screen
+ * using the following function. The bias parameter is an OR'ing of
+ * the appropriate OCTANT constants defined above to indicate which
+ * octants to bias a line to prefer an axial step when the Bresenham
+ * error term is exactly zero. The octants are mapped as follows:
+ *
+ * \ | /
+ * \ 3 | 2 /
+ * \ | /
+ * 4 \ | / 1
+ * \|/
+ * -----------
+ * /|\
+ * 5 / | \ 8
+ * / | \
+ * / 6 | 7 \
+ * / | \
+ *
+ * For more information, see "Ambiguities in Incremental Line Rastering,"
+ * Jack E. Bresenham, IEEE CG&A, May 1987.
+ */
+
+extern _X_EXPORT void miSetZeroLineBias(ScreenPtr /* pScreen */ ,
+ unsigned int /* bias */
+ );
+
+/*
+ * Private definitions needed for drawing thin (zero width) lines
+ * Used by the mi, mfb, and all cfb* components.
+ */
+
+#define X_AXIS 0
+#define Y_AXIS 1
+
+#define OUT_LEFT 0x08
+#define OUT_RIGHT 0x04
+#define OUT_ABOVE 0x02
+#define OUT_BELOW 0x01
+
+#define OUTCODES(_result, _x, _y, _pbox) \
+ if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \
+ else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \
+ if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \
+ else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW;
+
+#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
+{\
+ if (x < xmin) outcode |= OUT_LEFT;\
+ if (x > xmax) outcode |= OUT_RIGHT;\
+ if (y < ymin) outcode |= OUT_ABOVE;\
+ if (y > ymax) outcode |= OUT_BELOW;\
+}
+
+#define SWAPINT(i, j) \
+{ int _t = i; i = j; j = _t; }
+
+#define SWAPPT(i, j) \
+{ DDXPointRec _t; _t = i; i = j; j = _t; }
+
+#define SWAPINT_PAIR(x1, y1, x2, y2)\
+{ int t = x1; x1 = x2; x2 = t;\
+ t = y1; y1 = y2; y2 = t;\
+}
+
+#define miGetZeroLineBias(_pScreen) ((unsigned long) (unsigned long*)\
+ dixLookupPrivate(&(_pScreen)->devPrivates, miZeroLineScreenKey))
+
+#define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \
+ (_octant) = 0; \
+ (_sx) = (_SX); \
+ if (((_adx) = (_x2) - (_x1)) < 0) { \
+ (_adx) = -(_adx); \
+ (_sx = -(_sx)); \
+ (_octant) |= XDECREASING; \
+ } \
+ (_sy) = (_SY); \
+ if (((_ady) = (_y2) - (_y1)) < 0) { \
+ (_ady) = -(_ady); \
+ (_sy = -(_sy)); \
+ (_octant) |= YDECREASING; \
+ }
+
+#define SetYMajorOctant(_octant) ((_octant) |= YMAJOR)
+
+#define FIXUP_ERROR(_e, _octant, _bias) \
+ (_e) -= (((_bias) >> (_octant)) & 1)
+
+#define IsXMajorOctant(_octant) (!((_octant) & YMAJOR))
+#define IsYMajorOctant(_octant) ((_octant) & YMAJOR)
+#define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING)
+#define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING)
+
+extern _X_EXPORT DevPrivateKeyRec miZeroLineScreenKeyRec;
+
+#define miZeroLineScreenKey (&miZeroLineScreenKeyRec)
+
+extern _X_EXPORT int miZeroClipLine(int /*xmin */ ,
+ int /*ymin */ ,
+ int /*xmax */ ,
+ int /*ymax */ ,
+ int * /*new_x1 */ ,
+ int * /*new_y1 */ ,
+ int * /*new_x2 */ ,
+ int * /*new_y2 */ ,
+ unsigned int /*adx */ ,
+ unsigned int /*ady */ ,
+ int * /*pt1_clipped */ ,
+ int * /*pt2_clipped */ ,
+ int /*octant */ ,
+ unsigned int /*bias */ ,
+ int /*oc1 */ ,
+ int /*oc2 */
+ );
+
+#endif /* MILINE_H */
diff --git a/xorg-server/mi/mioverlay.c b/xorg-server/mi/mioverlay.c
index 78f5d787b..a66a71fb5 100644
--- a/xorg-server/mi/mioverlay.c
+++ b/xorg-server/mi/mioverlay.c
@@ -1,1950 +1,1904 @@
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifdef CreateWindow
-#undef CreateWindow
-#endif
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include <X11/extensions/shapeproto.h>
-#include "validate.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "gcstruct.h"
-#include "regionstr.h"
-#include "privates.h"
-#include "mivalidate.h"
-#include "mioverlay.h"
-#include "migc.h"
-
-#include "globals.h"
-
-
-typedef struct {
- RegionRec exposed;
- RegionRec borderExposed;
- RegionPtr borderVisible;
- DDXPointRec oldAbsCorner;
-} miOverlayValDataRec, *miOverlayValDataPtr;
-
-typedef struct _TreeRec {
- WindowPtr pWin;
- struct _TreeRec *parent;
- struct _TreeRec *firstChild;
- struct _TreeRec *lastChild;
- struct _TreeRec *prevSib;
- struct _TreeRec *nextSib;
- RegionRec borderClip;
- RegionRec clipList;
- unsigned visibility;
- miOverlayValDataPtr valdata;
-} miOverlayTreeRec, *miOverlayTreePtr;
-
-typedef struct {
- miOverlayTreePtr tree;
-} miOverlayWindowRec, *miOverlayWindowPtr;
-
-typedef struct {
- CloseScreenProcPtr CloseScreen;
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- RealizeWindowProcPtr RealizeWindow;
- miOverlayTransFunc MakeTransparent;
- miOverlayInOverlayFunc InOverlay;
- Bool underlayMarked;
- Bool copyUnderlay;
-} miOverlayScreenRec, *miOverlayScreenPtr;
-
-static DevPrivateKeyRec miOverlayWindowKeyRec;
-#define miOverlayWindowKey (&miOverlayWindowKeyRec)
-static DevPrivateKeyRec miOverlayScreenKeyRec;
-#define miOverlayScreenKey (&miOverlayScreenKeyRec)
-
-static void RebuildTree(WindowPtr);
-static Bool HasUnderlayChildren(WindowPtr);
-static void MarkUnderlayWindow(WindowPtr);
-static Bool CollectUnderlayChildrenRegions(WindowPtr, RegionPtr);
-
-static Bool miOverlayCloseScreen(int, ScreenPtr);
-static Bool miOverlayCreateWindow(WindowPtr);
-static Bool miOverlayDestroyWindow(WindowPtr);
-static Bool miOverlayUnrealizeWindow(WindowPtr);
-static Bool miOverlayRealizeWindow(WindowPtr);
-static void miOverlayMarkWindow(WindowPtr);
-static void miOverlayReparentWindow(WindowPtr, WindowPtr);
-static void miOverlayRestackWindow(WindowPtr, WindowPtr);
-static Bool miOverlayMarkOverlappedWindows(WindowPtr, WindowPtr, WindowPtr*);
-static void miOverlayMarkUnrealizedWindow(WindowPtr, WindowPtr, Bool);
-static int miOverlayValidateTree(WindowPtr, WindowPtr, VTKind);
-static void miOverlayHandleExposures(WindowPtr);
-static void miOverlayMoveWindow(WindowPtr, int, int, WindowPtr, VTKind);
-static void miOverlayWindowExposures(WindowPtr, RegionPtr, RegionPtr);
-static void miOverlayResizeWindow(WindowPtr, int, int, unsigned int,
- unsigned int, WindowPtr);
-static void miOverlayClearToBackground(WindowPtr, int, int, int, int, Bool);
-
-static void miOverlaySetShape(WindowPtr, int);
-static void miOverlayChangeBorderWidth(WindowPtr, unsigned int);
-
-#define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) ((miOverlayScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, miOverlayScreenKey))
-#define MIOVERLAY_GET_WINDOW_PRIVATE(pWin) ((miOverlayWindowPtr) \
- dixLookupPrivate(&(pWin)->devPrivates, miOverlayWindowKey))
-#define MIOVERLAY_GET_WINDOW_TREE(pWin) \
- (MIOVERLAY_GET_WINDOW_PRIVATE(pWin)->tree)
-
-#define IN_UNDERLAY(w) MIOVERLAY_GET_WINDOW_TREE(w)
-#define IN_OVERLAY(w) !MIOVERLAY_GET_WINDOW_TREE(w)
-
-#define MARK_OVERLAY(w) miMarkWindow(w)
-#define MARK_UNDERLAY(w) MarkUnderlayWindow(w)
-
-#define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \
- HasBorder(w) && \
- (w)->backgroundState == ParentRelative)
-
-Bool
-miInitOverlay(
- ScreenPtr pScreen,
- miOverlayInOverlayFunc inOverlayFunc,
- miOverlayTransFunc transFunc
-){
- miOverlayScreenPtr pScreenPriv;
-
- if(!inOverlayFunc || !transFunc) return FALSE;
-
- if(!dixRegisterPrivateKey(&miOverlayWindowKeyRec, PRIVATE_WINDOW, sizeof(miOverlayWindowRec)))
- return FALSE;
-
- if(!dixRegisterPrivateKey(&miOverlayScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- if(!(pScreenPriv = malloc(sizeof(miOverlayScreenRec))))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv);
-
- pScreenPriv->InOverlay = inOverlayFunc;
- pScreenPriv->MakeTransparent = transFunc;
- pScreenPriv->underlayMarked = FALSE;
-
-
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreenPriv->CreateWindow = pScreen->CreateWindow;
- pScreenPriv->DestroyWindow = pScreen->DestroyWindow;
- pScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow;
- pScreenPriv->RealizeWindow = pScreen->RealizeWindow;
-
- pScreen->CloseScreen = miOverlayCloseScreen;
- pScreen->CreateWindow = miOverlayCreateWindow;
- pScreen->DestroyWindow = miOverlayDestroyWindow;
- pScreen->UnrealizeWindow = miOverlayUnrealizeWindow;
- pScreen->RealizeWindow = miOverlayRealizeWindow;
-
- pScreen->ReparentWindow = miOverlayReparentWindow;
- pScreen->RestackWindow = miOverlayRestackWindow;
- pScreen->MarkOverlappedWindows = miOverlayMarkOverlappedWindows;
- pScreen->MarkUnrealizedWindow = miOverlayMarkUnrealizedWindow;
- pScreen->ValidateTree = miOverlayValidateTree;
- pScreen->HandleExposures = miOverlayHandleExposures;
- pScreen->MoveWindow = miOverlayMoveWindow;
- pScreen->WindowExposures = miOverlayWindowExposures;
- pScreen->ResizeWindow = miOverlayResizeWindow;
- pScreen->MarkWindow = miOverlayMarkWindow;
- pScreen->ClearToBackground = miOverlayClearToBackground;
- pScreen->SetShape = miOverlaySetShape;
- pScreen->ChangeBorderWidth = miOverlayChangeBorderWidth;
-
- return TRUE;
-}
-
-
-static Bool
-miOverlayCloseScreen(int i, ScreenPtr pScreen)
-{
- miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
-
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- pScreen->CreateWindow = pScreenPriv->CreateWindow;
- pScreen->DestroyWindow = pScreenPriv->DestroyWindow;
- pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow;
- pScreen->RealizeWindow = pScreenPriv->RealizeWindow;
-
- free(pScreenPriv);
-
- return (*pScreen->CloseScreen)(i, pScreen);
-}
-
-
-static Bool
-miOverlayCreateWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
- miOverlayWindowPtr pWinPriv = MIOVERLAY_GET_WINDOW_PRIVATE(pWin);
- miOverlayTreePtr pTree = NULL;
- Bool result = TRUE;
-
- pWinPriv->tree = NULL;
-
- if(!pWin->parent || !((*pScreenPriv->InOverlay)(pWin))) {
- if(!(pTree = (miOverlayTreePtr)calloc(1, sizeof(miOverlayTreeRec))))
- return FALSE;
- }
-
- if(pScreenPriv->CreateWindow) {
- pScreen->CreateWindow = pScreenPriv->CreateWindow;
- result = (*pScreen->CreateWindow)(pWin);
- pScreen->CreateWindow = miOverlayCreateWindow;
- }
-
- if (pTree) {
- if(result) {
- pTree->pWin = pWin;
- pTree->visibility = VisibilityNotViewable;
- pWinPriv->tree = pTree;
- if(pWin->parent) {
- RegionNull(&(pTree->borderClip));
- RegionNull(&(pTree->clipList));
- RebuildTree(pWin);
- } else {
- BoxRec fullBox;
- fullBox.x1 = 0;
- fullBox.y1 = 0;
- fullBox.x2 = pScreen->width;
- fullBox.y2 = pScreen->height;
- RegionInit(&(pTree->borderClip), &fullBox, 1);
- RegionInit(&(pTree->clipList), &fullBox, 1);
- }
- } else free(pTree);
- }
-
- return TRUE;
-}
-
-
-static Bool
-miOverlayDestroyWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- Bool result = TRUE;
-
- if (pTree) {
- if(pTree->prevSib)
- pTree->prevSib->nextSib = pTree->nextSib;
- else if(pTree->parent)
- pTree->parent->firstChild = pTree->nextSib;
-
- if(pTree->nextSib)
- pTree->nextSib->prevSib = pTree->prevSib;
- else if(pTree->parent)
- pTree->parent->lastChild = pTree->prevSib;
-
- RegionUninit(&(pTree->borderClip));
- RegionUninit(&(pTree->clipList));
- free(pTree);
- }
-
- if(pScreenPriv->DestroyWindow) {
- pScreen->DestroyWindow = pScreenPriv->DestroyWindow;
- result = (*pScreen->DestroyWindow)(pWin);
- pScreen->DestroyWindow = miOverlayDestroyWindow;
- }
-
- return result;
-}
-
-static Bool
-miOverlayUnrealizeWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- Bool result = TRUE;
-
- if(pTree) pTree->visibility = VisibilityNotViewable;
-
- if(pScreenPriv->UnrealizeWindow) {
- pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow;
- result = (*pScreen->UnrealizeWindow)(pWin);
- pScreen->UnrealizeWindow = miOverlayUnrealizeWindow;
- }
-
- return result;
-}
-
-
-static Bool
-miOverlayRealizeWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
- Bool result = TRUE;
-
- if(pScreenPriv->RealizeWindow) {
- pScreen->RealizeWindow = pScreenPriv->RealizeWindow;
- result = (*pScreen->RealizeWindow)(pWin);
- pScreen->RealizeWindow = miOverlayRealizeWindow;
- }
-
- /* we only need to catch the root window realization */
-
- if(result && !pWin->parent && !((*pScreenPriv->InOverlay)(pWin)))
- {
- BoxRec box;
- box.x1 = box.y1 = 0;
- box.x2 = pWin->drawable.width;
- box.y2 = pWin->drawable.height;
- (*pScreenPriv->MakeTransparent)(pScreen, 1, &box);
- }
-
- return result;
-}
-
-
-static void
-miOverlayReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
-{
- if(IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) {
- /* This could probably be more optimal */
- RebuildTree(pWin->drawable.pScreen->root->firstChild);
- }
-}
-
-static void
-miOverlayRestackWindow(WindowPtr pWin, WindowPtr oldNextSib)
-{
- if(IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) {
- /* This could probably be more optimal */
- RebuildTree(pWin);
- }
-}
-
-
-static Bool
-miOverlayMarkOverlappedWindows(
- WindowPtr pWin,
- WindowPtr pFirst,
- WindowPtr *pLayerWin
-){
- WindowPtr pChild, pLast;
- Bool overMarked, underMarked, doUnderlay, markAll;
- miOverlayTreePtr pTree = NULL, tLast, tChild;
- BoxPtr box;
-
- overMarked = underMarked = markAll = FALSE;
-
- if(pLayerWin) *pLayerWin = pWin; /* hah! */
-
- doUnderlay = (IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin));
-
- box = RegionExtents(&pWin->borderSize);
-
- if((pChild = pFirst)) {
- pLast = pChild->parent->lastChild;
- while (1) {
- if (pChild == pWin) markAll = TRUE;
-
- if(doUnderlay && IN_UNDERLAY(pChild))
- pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
-
- if(pChild->viewable) {
- if (RegionBroken(&pChild->winSize))
- SetWinSize (pChild);
- if (RegionBroken(&pChild->borderSize))
- SetBorderSize (pChild);
-
- if (markAll ||
- RegionContainsRect(&pChild->borderSize, box))
- {
- MARK_OVERLAY(pChild);
- overMarked = TRUE;
- if(doUnderlay && IN_UNDERLAY(pChild)) {
- MARK_UNDERLAY(pChild);
- underMarked = TRUE;
- }
- if (pChild->firstChild) {
- pChild = pChild->firstChild;
- continue;
- }
- }
- }
- while (!pChild->nextSib && (pChild != pLast)) {
- pChild = pChild->parent;
- if(doUnderlay && IN_UNDERLAY(pChild))
- pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
- }
-
- if(pChild == pWin) markAll = FALSE;
-
- if (pChild == pLast) break;
-
- pChild = pChild->nextSib;
- }
- if(overMarked)
- MARK_OVERLAY(pWin->parent);
- }
-
- if(doUnderlay && !pTree) {
- if(!(pTree = MIOVERLAY_GET_WINDOW_TREE(pWin))) {
- pChild = pWin->lastChild;
- while(1) {
- if((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild)))
- break;
-
- if(pChild->lastChild) {
- pChild = pChild->lastChild;
- continue;
- }
-
- while(!pChild->prevSib) pChild = pChild->parent;
-
- pChild = pChild->prevSib;
- }
- }
- }
-
- if(pTree && pTree->nextSib) {
- tChild = pTree->parent->lastChild;
- tLast = pTree->nextSib;
-
- while(1) {
- if(tChild->pWin->viewable) {
- if (RegionBroken(&tChild->pWin->winSize))
- SetWinSize (tChild->pWin);
- if (RegionBroken(&tChild->pWin->borderSize))
- SetBorderSize (tChild->pWin);
-
- if(RegionContainsRect(&(tChild->pWin->borderSize), box))
- {
- MARK_UNDERLAY(tChild->pWin);
- underMarked = TRUE;
- }
- }
-
- if(tChild->lastChild) {
- tChild = tChild->lastChild;
- continue;
- }
-
- while(!tChild->prevSib && (tChild != tLast))
- tChild = tChild->parent;
-
- if(tChild == tLast) break;
-
- tChild = tChild->prevSib;
- }
- }
-
- if(underMarked) {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- MARK_UNDERLAY(pTree->parent->pWin);
- MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->underlayMarked = TRUE;
- }
-
- return underMarked || overMarked;
-}
-
-
-static void
-miOverlayComputeClips(
- WindowPtr pParent,
- RegionPtr universe,
- VTKind kind,
- RegionPtr exposed
-){
- ScreenPtr pScreen = pParent->drawable.pScreen;
- int oldVis, newVis, dx, dy;
- BoxRec borderSize;
- RegionPtr borderVisible;
- RegionRec childUniverse, childUnion;
- miOverlayTreePtr tParent = MIOVERLAY_GET_WINDOW_TREE(pParent);
- miOverlayTreePtr tChild;
- Bool overlap;
-
- borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent);
- borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent);
- dx = (int) pParent->drawable.x + (int) pParent->drawable.width +
- wBorderWidth(pParent);
- if (dx > 32767) dx = 32767;
- borderSize.x2 = dx;
- dy = (int) pParent->drawable.y + (int) pParent->drawable.height +
- wBorderWidth(pParent);
- if (dy > 32767) dy = 32767;
- borderSize.y2 = dy;
-
- oldVis = tParent->visibility;
- switch (RegionContainsRect(universe, &borderSize)) {
- case rgnIN:
- newVis = VisibilityUnobscured;
- break;
- case rgnPART:
- newVis = VisibilityPartiallyObscured;
- {
- RegionPtr pBounding;
-
- if ((pBounding = wBoundingShape (pParent))) {
- switch (miShapedWindowIn (universe, pBounding,
- &borderSize,
- pParent->drawable.x,
- pParent->drawable.y))
- {
- case rgnIN:
- newVis = VisibilityUnobscured;
- break;
- case rgnOUT:
- newVis = VisibilityFullyObscured;
- break;
- }
- }
- }
- break;
- default:
- newVis = VisibilityFullyObscured;
- break;
- }
- tParent->visibility = newVis;
-
- dx = pParent->drawable.x - tParent->valdata->oldAbsCorner.x;
- dy = pParent->drawable.y - tParent->valdata->oldAbsCorner.y;
-
- switch (kind) {
- case VTMap:
- case VTStack:
- case VTUnmap:
- break;
- case VTMove:
- if ((oldVis == newVis) &&
- ((oldVis == VisibilityFullyObscured) ||
- (oldVis == VisibilityUnobscured)))
- {
- tChild = tParent;
- while (1) {
- if (tChild->pWin->viewable) {
- if (tChild->visibility != VisibilityFullyObscured) {
- RegionTranslate(&tChild->borderClip, dx, dy);
- RegionTranslate(&tChild->clipList, dx, dy);
-
- tChild->pWin->drawable.serialNumber =
- NEXT_SERIAL_NUMBER;
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (tChild->pWin, dx, dy);
- }
- if (tChild->valdata) {
- RegionNull(&tChild->valdata->borderExposed);
- if (HasParentRelativeBorder(tChild->pWin)){
- RegionSubtract(&tChild->valdata->borderExposed,
- &tChild->borderClip,
- &tChild->pWin->winSize);
- }
- RegionNull(&tChild->valdata->exposed);
- }
- if (tChild->firstChild) {
- tChild = tChild->firstChild;
- continue;
- }
- }
- while (!tChild->nextSib && (tChild != tParent))
- tChild = tChild->parent;
- if (tChild == tParent)
- break;
- tChild = tChild->nextSib;
- }
- return;
- }
- /* fall through */
- default:
- if (dx || dy) {
- RegionTranslate(&tParent->borderClip, dx, dy);
- RegionTranslate(&tParent->clipList, dx, dy);
- }
- break;
- case VTBroken:
- RegionEmpty(&tParent->borderClip);
- RegionEmpty(&tParent->clipList);
- break;
- }
-
- borderVisible = tParent->valdata->borderVisible;
- RegionNull(&tParent->valdata->borderExposed);
- RegionNull(&tParent->valdata->exposed);
-
- if (HasBorder (pParent)) {
- if (borderVisible) {
- RegionSubtract(exposed, universe, borderVisible);
- RegionDestroy(borderVisible);
- } else
- RegionSubtract(exposed, universe, &tParent->borderClip);
-
- if (HasParentRelativeBorder(pParent) && (dx || dy))
- RegionSubtract(&tParent->valdata->borderExposed,
- universe, &pParent->winSize);
- else
- RegionSubtract(&tParent->valdata->borderExposed,
- exposed, &pParent->winSize);
-
- RegionCopy(&tParent->borderClip, universe);
- RegionIntersect(universe, universe, &pParent->winSize);
- }
- else
- RegionCopy(&tParent->borderClip, universe);
-
- if ((tChild = tParent->firstChild) && pParent->mapped) {
- RegionNull(&childUniverse);
- RegionNull(&childUnion);
-
- for (; tChild; tChild = tChild->nextSib) {
- if (tChild->pWin->viewable)
- RegionAppend(&childUnion, &tChild->pWin->borderSize);
- }
-
- RegionValidate(&childUnion, &overlap);
-
- for (tChild = tParent->firstChild;
- tChild;
- tChild = tChild->nextSib)
- {
- if (tChild->pWin->viewable) {
- if (tChild->valdata) {
- RegionIntersect(&childUniverse, universe,
- &tChild->pWin->borderSize);
- miOverlayComputeClips (tChild->pWin, &childUniverse,
- kind, exposed);
- }
- if (overlap)
- RegionSubtract(universe, universe,
- &tChild->pWin->borderSize);
- }
- }
- if (!overlap)
- RegionSubtract(universe, universe, &childUnion);
- RegionUninit(&childUnion);
- RegionUninit(&childUniverse);
- }
-
- if (oldVis == VisibilityFullyObscured ||
- oldVis == VisibilityNotViewable)
- {
- RegionCopy(&tParent->valdata->exposed, universe);
- }
- else if (newVis != VisibilityFullyObscured &&
- newVis != VisibilityNotViewable)
- {
- RegionSubtract(&tParent->valdata->exposed,
- universe, &tParent->clipList);
- }
-
- /* HACK ALERT - copying contents of regions, instead of regions */
- {
- RegionRec tmp;
-
- tmp = tParent->clipList;
- tParent->clipList = *universe;
- *universe = tmp;
- }
-
- pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pParent, dx, dy);
-}
-
-
-static void
-miOverlayMarkWindow(WindowPtr pWin)
-{
- miOverlayTreePtr pTree = NULL;
- WindowPtr pChild, pGrandChild;
-
- miMarkWindow(pWin);
-
- /* look for UnmapValdata among immediate children */
-
- if(!(pChild = pWin->firstChild)) return;
-
- for( ; pChild; pChild = pChild->nextSib) {
- if(pChild->valdata == UnmapValData) {
- if(IN_UNDERLAY(pChild)) {
- pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
- pTree->valdata = (miOverlayValDataPtr)UnmapValData;
- continue;
- } else {
- if(!(pGrandChild = pChild->firstChild))
- continue;
-
- while(1) {
- if(IN_UNDERLAY(pGrandChild)) {
- pTree = MIOVERLAY_GET_WINDOW_TREE(pGrandChild);
- pTree->valdata = (miOverlayValDataPtr)UnmapValData;
- } else if(pGrandChild->firstChild) {
- pGrandChild = pGrandChild->firstChild;
- continue;
- }
-
- while(!pGrandChild->nextSib && (pGrandChild != pChild))
- pGrandChild = pGrandChild->parent;
-
- if(pChild == pGrandChild) break;
-
- pGrandChild = pGrandChild->nextSib;
- }
- }
- }
- }
-
- if(pTree) {
- MARK_UNDERLAY(pTree->parent->pWin);
- MIOVERLAY_GET_SCREEN_PRIVATE(
- pWin->drawable.pScreen)->underlayMarked = TRUE;
- }
-}
-
-static void
-miOverlayMarkUnrealizedWindow(
- WindowPtr pChild,
- WindowPtr pWin,
- Bool fromConfigure
-){
- if ((pChild != pWin) || fromConfigure) {
- miOverlayTreePtr pTree;
-
- RegionEmpty(&pChild->clipList);
- if (pChild->drawable.pScreen->ClipNotify)
- (* pChild->drawable.pScreen->ClipNotify)(pChild, 0, 0);
- RegionEmpty(&pChild->borderClip);
- if((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
- if(pTree->valdata != (miOverlayValDataPtr)UnmapValData) {
- RegionEmpty(&pTree->clipList);
- RegionEmpty(&pTree->borderClip);
- }
- }
- }
-}
-
-
-static int
-miOverlayValidateTree(
- WindowPtr pParent,
- WindowPtr pChild, /* first child effected */
- VTKind kind
-){
- ScreenPtr pScreen = pParent->drawable.pScreen;
- miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
- RegionRec totalClip, childClip, exposed;
- miOverlayTreePtr tParent, tChild, tWin;
- Bool overlap;
- WindowPtr newParent;
-
- if(!pPriv->underlayMarked)
- goto SKIP_UNDERLAY;
-
- if (!pChild) pChild = pParent->firstChild;
-
- RegionNull(&totalClip);
- RegionNull(&childClip);
- RegionNull(&exposed);
-
- newParent = pParent;
-
- while(IN_OVERLAY(newParent))
- newParent = newParent->parent;
-
- tParent = MIOVERLAY_GET_WINDOW_TREE(newParent);
-
- if(IN_UNDERLAY(pChild))
- tChild = MIOVERLAY_GET_WINDOW_TREE(pChild);
- else
- tChild = tParent->firstChild;
-
- if (RegionBroken(&tParent->clipList) &&
- !RegionBroken(&tParent->borderClip))
- {
- kind = VTBroken;
- RegionCopy(&totalClip, &tParent->borderClip);
- RegionIntersect(&totalClip, &totalClip,
- &tParent->pWin->winSize);
-
- for (tWin = tParent->firstChild; tWin != tChild; tWin = tWin->nextSib) {
- if (tWin->pWin->viewable)
- RegionSubtract(&totalClip, &totalClip,
- &tWin->pWin->borderSize);
- }
- RegionEmpty(&tParent->clipList);
- } else {
- for(tWin = tChild; tWin; tWin = tWin->nextSib) {
- if(tWin->valdata)
- RegionAppend(&totalClip, &tWin->borderClip);
- }
- RegionValidate(&totalClip, &overlap);
- }
-
- if(kind != VTStack)
- RegionUnion(&totalClip, &totalClip, &tParent->clipList);
-
- for(tWin = tChild; tWin; tWin = tWin->nextSib) {
- if(tWin->valdata) {
- if(tWin->pWin->viewable) {
- RegionIntersect(&childClip, &totalClip,
- &tWin->pWin->borderSize);
- miOverlayComputeClips(tWin->pWin, &childClip, kind, &exposed);
- RegionSubtract(&totalClip, &totalClip,
- &tWin->pWin->borderSize);
- } else { /* Means we are unmapping */
- RegionEmpty(&tWin->clipList);
- RegionEmpty(&tWin->borderClip);
- tWin->valdata = NULL;
- }
- }
- }
-
- RegionUninit(&childClip);
-
- if(!((*pPriv->InOverlay)(newParent))) {
- RegionNull(&tParent->valdata->exposed);
- RegionNull(&tParent->valdata->borderExposed);
- }
-
- switch (kind) {
- case VTStack:
- break;
- default:
- if(!((*pPriv->InOverlay)(newParent)))
- RegionSubtract(&tParent->valdata->exposed, &totalClip,
- &tParent->clipList);
- /* fall through */
- case VTMap:
- RegionCopy(&tParent->clipList, &totalClip);
- if(!((*pPriv->InOverlay)(newParent)))
- newParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- break;
- }
-
- RegionUninit(&totalClip);
- RegionUninit(&exposed);
-
-SKIP_UNDERLAY:
-
- miValidateTree(pParent, pChild, kind);
-
- return 1;
-}
-
-
-static void
-miOverlayHandleExposures(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
- WindowPtr pChild;
- ValidatePtr val;
- void (* WindowExposures)(WindowPtr, RegionPtr, RegionPtr);
-
- WindowExposures = pWin->drawable.pScreen->WindowExposures;
- if(pPriv->underlayMarked) {
- miOverlayTreePtr pTree;
- miOverlayValDataPtr mival;
-
- pChild = pWin;
- while(IN_OVERLAY(pChild))
- pChild = pChild->parent;
-
- pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
-
- while (1) {
- if((mival = pTree->valdata)) {
- if(!((*pPriv->InOverlay)(pTree->pWin))) {
- if (RegionNotEmpty(&mival->borderExposed)) {
- miPaintWindow(pTree->pWin, &mival->borderExposed,
- PW_BORDER);
- }
- RegionUninit(&mival->borderExposed);
-
- (*WindowExposures)(pTree->pWin,&mival->exposed,NullRegion);
- RegionUninit(&mival->exposed);
- }
- free(mival);
- pTree->valdata = NULL;
- if (pTree->firstChild) {
- pTree = pTree->firstChild;
- continue;
- }
- }
- while (!pTree->nextSib && (pTree->pWin != pChild))
- pTree = pTree->parent;
- if (pTree->pWin == pChild)
- break;
- pTree = pTree->nextSib;
- }
- pPriv->underlayMarked = FALSE;
- }
-
- pChild = pWin;
- while (1) {
- if ( (val = pChild->valdata) ) {
- if(!((*pPriv->InOverlay)(pChild))) {
- RegionUnion(&val->after.exposed, &val->after.exposed,
- &val->after.borderExposed);
-
- if (RegionNotEmpty(&val->after.exposed)) {
- (*(MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->MakeTransparent))(
- pScreen,
- RegionNumRects(&val->after.exposed),
- RegionRects(&val->after.exposed));
- }
- } else {
- if (RegionNotEmpty(&val->after.borderExposed)) {
- miPaintWindow(pChild, &val->after.borderExposed,
- PW_BORDER);
- }
- (*WindowExposures)(pChild, &val->after.exposed, NullRegion);
- }
- RegionUninit(&val->after.borderExposed);
- RegionUninit(&val->after.exposed);
- free(val);
- pChild->valdata = NULL;
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- break;
- pChild = pChild->nextSib;
- }
-}
-
-
-static void
-miOverlayMoveWindow(
- WindowPtr pWin,
- int x,
- int y,
- WindowPtr pNextSib,
- VTKind kind
-){
- ScreenPtr pScreen = pWin->drawable.pScreen;
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- WindowPtr pParent, windowToValidate;
- Bool WasViewable = (Bool)(pWin->viewable);
- short bw;
- RegionRec overReg, underReg;
- DDXPointRec oldpt;
-
- if (!(pParent = pWin->parent))
- return ;
- bw = wBorderWidth (pWin);
-
- oldpt.x = pWin->drawable.x;
- oldpt.y = pWin->drawable.y;
- if (WasViewable) {
- RegionNull(&overReg);
- RegionNull(&underReg);
- if(pTree) {
- RegionCopy(&overReg, &pWin->borderClip);
- RegionCopy(&underReg, &pTree->borderClip);
- } else {
- RegionCopy(&overReg, &pWin->borderClip);
- CollectUnderlayChildrenRegions(pWin, &underReg);
- }
- (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
- }
- pWin->origin.x = x + (int)bw;
- pWin->origin.y = y + (int)bw;
- x = pWin->drawable.x = pParent->drawable.x + x + (int)bw;
- y = pWin->drawable.y = pParent->drawable.y + y + (int)bw;
-
- SetWinSize (pWin);
- SetBorderSize (pWin);
-
- (*pScreen->PositionWindow)(pWin, x, y);
-
- windowToValidate = MoveWindowInStack(pWin, pNextSib);
-
- ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0);
-
- if (WasViewable) {
- miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
- (*pScreen->MarkOverlappedWindows) (pWin, windowToValidate, NULL);
-
-
- (*pScreen->ValidateTree)(pWin->parent, NullWindow, kind);
- if(RegionNotEmpty(&underReg)) {
- pPriv->copyUnderlay = TRUE;
- (* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, &underReg);
- }
- RegionUninit(&underReg);
- if(RegionNotEmpty(&overReg)) {
- pPriv->copyUnderlay = FALSE;
- (* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, &overReg);
- }
- RegionUninit(&overReg);
- (*pScreen->HandleExposures)(pWin->parent);
-
- if (pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin->parent, NullWindow, kind);
- }
- if (pWin->realized)
- WindowsRestructured ();
-}
-
-#ifndef RECTLIMIT
-#define RECTLIMIT 25
-#endif
-
-static void
-miOverlayWindowExposures(
- WindowPtr pWin,
- RegionPtr prgn,
- RegionPtr other_exposed
-){
- RegionPtr exposures = prgn;
-
- if ((prgn && !RegionNil(prgn)) ||
- (exposures && !RegionNil(exposures)) || other_exposed)
- {
- RegionRec expRec;
- int clientInterested;
-
- clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) &
- ExposureMask;
- if (other_exposed) {
- if (exposures) {
- RegionUnion(other_exposed, exposures, other_exposed);
- if (exposures != prgn)
- RegionDestroy(exposures);
- }
- exposures = other_exposed;
- }
- if (clientInterested && exposures &&
- (RegionNumRects(exposures) > RECTLIMIT))
- {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
- BoxRec box;
-
- box = *RegionExtents(exposures);
- if (exposures == prgn) {
- exposures = &expRec;
- RegionInit(exposures, &box, 1);
- RegionReset(prgn, &box);
- } else {
- RegionReset(exposures, &box);
- RegionUnion(prgn, prgn, exposures);
- }
- /* This is the only reason why we are replacing mi's version
- of this file */
-
- if(!((*pPriv->InOverlay)(pWin))) {
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- RegionIntersect(prgn, prgn, &pTree->clipList);
- } else
- RegionIntersect(prgn, prgn, &pWin->clipList);
- }
- if (prgn && !RegionNil(prgn))
- miPaintWindow(pWin, prgn, PW_BACKGROUND);
- if (clientInterested && exposures && !RegionNil(exposures))
- miSendExposures(pWin, exposures,
- pWin->drawable.x, pWin->drawable.y);
- if (exposures == &expRec) {
- RegionUninit(exposures);
- }
- else if (exposures && exposures != prgn && exposures != other_exposed)
- RegionDestroy(exposures);
- if (prgn)
- RegionEmpty(prgn);
- }
- else if (exposures && exposures != prgn)
- RegionDestroy(exposures);
-}
-
-
-typedef struct {
- RegionPtr over;
- RegionPtr under;
-} miOverlayTwoRegions;
-
-static int
-miOverlayRecomputeExposures (
- WindowPtr pWin,
- pointer value
-){
- miOverlayTwoRegions *pValid = (miOverlayTwoRegions*)value;
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
-
- if (pWin->valdata) {
- /*
- * compute exposed regions of this window
- */
- RegionSubtract(&pWin->valdata->after.exposed,
- &pWin->clipList, pValid->over);
- /*
- * compute exposed regions of the border
- */
- RegionSubtract(&pWin->valdata->after.borderExposed,
- &pWin->borderClip, &pWin->winSize);
- RegionSubtract(&pWin->valdata->after.borderExposed,
- &pWin->valdata->after.borderExposed, pValid->over);
- }
-
- if(pTree && pTree->valdata) {
- RegionSubtract(&pTree->valdata->exposed,
- &pTree->clipList, pValid->under);
- RegionSubtract(&pTree->valdata->borderExposed,
- &pTree->borderClip, &pWin->winSize);
- RegionSubtract(&pTree->valdata->borderExposed,
- &pTree->valdata->borderExposed, pValid->under);
- } else if (!pWin->valdata)
- return WT_NOMATCH;
-
- return WT_WALKCHILDREN;
-}
-
-static void
-miOverlayResizeWindow(
- WindowPtr pWin,
- int x, int y,
- unsigned int w, unsigned int h,
- WindowPtr pSib
-){
- ScreenPtr pScreen = pWin->drawable.pScreen;
- WindowPtr pParent;
- miOverlayTreePtr tChild, pTree;
- Bool WasViewable = (Bool)(pWin->viewable);
- unsigned short width = pWin->drawable.width;
- unsigned short height = pWin->drawable.height;
- short oldx = pWin->drawable.x;
- short oldy = pWin->drawable.y;
- int bw = wBorderWidth (pWin);
- short dw, dh;
- DDXPointRec oldpt;
- RegionPtr oldRegion = NULL, oldRegion2 = NULL;
- WindowPtr pFirstChange;
- WindowPtr pChild;
- RegionPtr gravitate[StaticGravity + 1];
- RegionPtr gravitate2[StaticGravity + 1];
- unsigned g;
- int nx, ny; /* destination x,y */
- int newx, newy; /* new inner window position */
- RegionPtr pRegion = NULL;
- RegionPtr destClip, destClip2;
- RegionPtr oldWinClip = NULL, oldWinClip2 = NULL;
- RegionPtr borderVisible = NullRegion;
- RegionPtr borderVisible2 = NullRegion;
- Bool shrunk = FALSE; /* shrunk in an inner dimension */
- Bool moved = FALSE; /* window position changed */
- Bool doUnderlay;
-
- /* if this is a root window, can't be resized */
- if (!(pParent = pWin->parent))
- return ;
-
- pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- doUnderlay = ((pTree) || HasUnderlayChildren(pWin));
- newx = pParent->drawable.x + x + bw;
- newy = pParent->drawable.y + y + bw;
- if (WasViewable)
- {
- /*
- * save the visible region of the window
- */
- oldRegion = RegionCreate(NullBox, 1);
- RegionCopy(oldRegion, &pWin->winSize);
- if(doUnderlay) {
- oldRegion2 = RegionCreate(NullBox, 1);
- RegionCopy(oldRegion2, &pWin->winSize);
- }
-
- /*
- * categorize child windows into regions to be moved
- */
- for (g = 0; g <= StaticGravity; g++)
- gravitate[g] = gravitate2[g] = NULL;
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
- g = pChild->winGravity;
- if (g != UnmapGravity) {
- if (!gravitate[g])
- gravitate[g] = RegionCreate(NullBox, 1);
- RegionUnion(gravitate[g],
- gravitate[g], &pChild->borderClip);
-
- if(doUnderlay) {
- if (!gravitate2[g])
- gravitate2[g] = RegionCreate(NullBox, 0);
-
- if((tChild = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
- RegionUnion(gravitate2[g],
- gravitate2[g], &tChild->borderClip);
- } else
- CollectUnderlayChildrenRegions(pChild, gravitate2[g]);
- }
- } else {
- UnmapWindow(pChild, TRUE);
- }
- }
- (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
-
-
- oldWinClip = oldWinClip2 = NULL;
- if (pWin->bitGravity != ForgetGravity) {
- oldWinClip = RegionCreate(NullBox, 1);
- RegionCopy(oldWinClip, &pWin->clipList);
- if(pTree) {
- oldWinClip2 = RegionCreate(NullBox, 1);
- RegionCopy(oldWinClip2, &pTree->clipList);
- }
- }
- /*
- * if the window is changing size, borderExposed
- * can't be computed correctly without some help.
- */
- if (pWin->drawable.height > h || pWin->drawable.width > w)
- shrunk = TRUE;
-
- if (newx != oldx || newy != oldy)
- moved = TRUE;
-
- if ((pWin->drawable.height != h || pWin->drawable.width != w) &&
- HasBorder (pWin))
- {
- borderVisible = RegionCreate(NullBox, 1);
- if(pTree)
- borderVisible2 = RegionCreate(NullBox, 1);
- /* for tiled borders, we punt and draw the whole thing */
- if (pWin->borderIsPixel || !moved)
- {
- if (shrunk || moved)
- RegionSubtract(borderVisible,
- &pWin->borderClip,
- &pWin->winSize);
- else
- RegionCopy(borderVisible,
- &pWin->borderClip);
- if(pTree) {
- if (shrunk || moved)
- RegionSubtract(borderVisible,
- &pTree->borderClip,
- &pWin->winSize);
- else
- RegionCopy(borderVisible,
- &pTree->borderClip);
- }
- }
- }
- }
- pWin->origin.x = x + bw;
- pWin->origin.y = y + bw;
- pWin->drawable.height = h;
- pWin->drawable.width = w;
-
- x = pWin->drawable.x = newx;
- y = pWin->drawable.y = newy;
-
- SetWinSize (pWin);
- SetBorderSize (pWin);
-
- dw = (int)w - (int)width;
- dh = (int)h - (int)height;
- ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh);
-
- /* let the hardware adjust background and border pixmaps, if any */
- (*pScreen->PositionWindow)(pWin, x, y);
-
- pFirstChange = MoveWindowInStack(pWin, pSib);
-
- if (WasViewable) {
- pRegion = RegionCreate(NullBox, 1);
-
- (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, NULL);
-
- pWin->valdata->before.resized = TRUE;
- pWin->valdata->before.borderVisible = borderVisible;
- if(pTree)
- pTree->valdata->borderVisible = borderVisible2;
-
-
- (*pScreen->ValidateTree)(pWin->parent, pFirstChange, VTOther);
- /*
- * the entire window is trashed unless bitGravity
- * recovers portions of it
- */
- RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList);
- if(pTree)
- RegionCopy(&pTree->valdata->exposed, &pTree->clipList);
- }
-
- GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny);
-
- if (WasViewable) {
- miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
- miOverlayTwoRegions TwoRegions;
-
- /* avoid the border */
- if (HasBorder (pWin)) {
- int offx, offy, dx, dy;
-
- /* kruft to avoid double translates for each gravity */
- offx = 0;
- offy = 0;
- for (g = 0; g <= StaticGravity; g++) {
- if (!gravitate[g] && !gravitate2[g])
- continue;
-
- /* align winSize to gravitate[g].
- * winSize is in new coordinates,
- * gravitate[g] is still in old coordinates */
- GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny);
-
- dx = (oldx - nx) - offx;
- dy = (oldy - ny) - offy;
- if (dx || dy) {
- RegionTranslate(&pWin->winSize, dx, dy);
- offx += dx;
- offy += dy;
- }
- if(gravitate[g])
- RegionIntersect(gravitate[g], gravitate[g],
- &pWin->winSize);
- if(gravitate2[g])
- RegionIntersect(gravitate2[g], gravitate2[g],
- &pWin->winSize);
- }
- /* get winSize back where it belongs */
- if (offx || offy)
- RegionTranslate(&pWin->winSize, -offx, -offy);
- }
- /*
- * add screen bits to the appropriate bucket
- */
-
- if (oldWinClip2)
- {
- RegionCopy(pRegion, oldWinClip2);
- RegionTranslate(pRegion, nx - oldx, ny - oldy);
- RegionIntersect(oldWinClip2, pRegion, &pTree->clipList);
-
- for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) {
- if (gravitate2[g])
- RegionSubtract(oldWinClip2, oldWinClip2,
- gravitate2[g]);
- }
- RegionTranslate(oldWinClip2, oldx - nx, oldy - ny);
- g = pWin->bitGravity;
- if (!gravitate2[g])
- gravitate2[g] = oldWinClip2;
- else {
- RegionUnion(gravitate2[g],gravitate2[g],oldWinClip2);
- RegionDestroy(oldWinClip2);
- }
- }
-
- if (oldWinClip)
- {
- /*
- * clip to new clipList
- */
- RegionCopy(pRegion, oldWinClip);
- RegionTranslate(pRegion, nx - oldx, ny - oldy);
- RegionIntersect(oldWinClip, pRegion, &pWin->clipList);
- /*
- * don't step on any gravity bits which will be copied after this
- * region. Note -- this assumes that the regions will be copied
- * in gravity order.
- */
- for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) {
- if (gravitate[g])
- RegionSubtract(oldWinClip, oldWinClip,
- gravitate[g]);
- }
- RegionTranslate(oldWinClip, oldx - nx, oldy - ny);
- g = pWin->bitGravity;
- if (!gravitate[g])
- gravitate[g] = oldWinClip;
- else {
- RegionUnion(gravitate[g], gravitate[g], oldWinClip);
- RegionDestroy(oldWinClip);
- }
- }
-
- /*
- * move the bits on the screen
- */
-
- destClip = destClip2 = NULL;
-
- for (g = 0; g <= StaticGravity; g++) {
- if (!gravitate[g] && !gravitate2[g])
- continue;
-
- GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny);
-
- oldpt.x = oldx + (x - nx);
- oldpt.y = oldy + (y - ny);
-
- /* Note that gravitate[g] is *translated* by CopyWindow */
-
- /* only copy the remaining useful bits */
-
- if(gravitate[g])
- RegionIntersect(gravitate[g],
- gravitate[g], oldRegion);
- if(gravitate2[g])
- RegionIntersect(gravitate2[g],
- gravitate2[g], oldRegion2);
-
- /* clip to not overwrite already copied areas */
-
- if (destClip && gravitate[g]) {
- RegionTranslate(destClip, oldpt.x - x, oldpt.y - y);
- RegionSubtract(gravitate[g], gravitate[g], destClip);
- RegionTranslate(destClip, x - oldpt.x, y - oldpt.y);
- }
- if (destClip2 && gravitate2[g]) {
- RegionTranslate(destClip2, oldpt.x - x, oldpt.y - y);
- RegionSubtract(gravitate2[g],gravitate2[g],destClip2);
- RegionTranslate(destClip2, x - oldpt.x, y - oldpt.y);
- }
-
- /* and move those bits */
-
- if (oldpt.x != x || oldpt.y != y) {
- if(gravitate2[g]) {
- pPriv->copyUnderlay = TRUE;
- (*pScreen->CopyWindow)(pWin, oldpt, gravitate2[g]);
- }
- if(gravitate[g]) {
- pPriv->copyUnderlay = FALSE;
- (*pScreen->CopyWindow)(pWin, oldpt, gravitate[g]);
- }
- }
-
- /* remove any overwritten bits from the remaining useful bits */
-
- if(gravitate[g])
- RegionSubtract(oldRegion, oldRegion, gravitate[g]);
- if(gravitate2[g])
- RegionSubtract(oldRegion2, oldRegion2, gravitate2[g]);
-
- /*
- * recompute exposed regions of child windows
- */
-
-
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
- if (pChild->winGravity != g)
- continue;
-
- TwoRegions.over = gravitate[g];
- TwoRegions.under = gravitate2[g];
-
- TraverseTree (pChild, miOverlayRecomputeExposures,
- (pointer)(&TwoRegions));
- }
-
- /*
- * remove the successfully copied regions of the
- * window from its exposed region
- */
-
- if (g == pWin->bitGravity) {
- if(gravitate[g])
- RegionSubtract(&pWin->valdata->after.exposed,
- &pWin->valdata->after.exposed, gravitate[g]);
- if(gravitate2[g] && pTree)
- RegionSubtract(&pTree->valdata->exposed,
- &pTree->valdata->exposed, gravitate2[g]);
- }
- if(gravitate[g]) {
- if (!destClip)
- destClip = gravitate[g];
- else {
- RegionUnion(destClip, destClip, gravitate[g]);
- RegionDestroy(gravitate[g]);
- }
- }
- if(gravitate2[g]) {
- if (!destClip2)
- destClip2 = gravitate2[g];
- else {
- RegionUnion(destClip2, destClip2, gravitate2[g]);
- RegionDestroy(gravitate2[g]);
- }
- }
- }
-
- RegionDestroy(pRegion);
- RegionDestroy(oldRegion);
- if(doUnderlay)
- RegionDestroy(oldRegion2);
- if (destClip)
- RegionDestroy(destClip);
- if (destClip2)
- RegionDestroy(destClip2);
- (*pScreen->HandleExposures)(pWin->parent);
- if (pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin->parent, pFirstChange, VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
-}
-
-
-static void
-miOverlaySetShape(WindowPtr pWin, int kind)
-{
- Bool WasViewable = (Bool)(pWin->viewable);
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- if (kind != ShapeInput) {
- if (WasViewable) {
- (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
-
- if (HasBorder (pWin)) {
- RegionPtr borderVisible;
-
- borderVisible = RegionCreate(NullBox, 1);
- RegionSubtract(borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- pWin->valdata->before.resized = TRUE;
- if(IN_UNDERLAY(pWin)) {
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- RegionPtr borderVisible2;
-
- borderVisible2 = RegionCreate(NULL, 1);
- RegionSubtract(borderVisible2,
- &pTree->borderClip, &pWin->winSize);
- pTree->valdata->borderVisible = borderVisible2;
- }
- }
- }
-
- SetWinSize (pWin);
- SetBorderSize (pWin);
-
- ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
-
- if (WasViewable) {
- (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
-
-
- (*pScreen->ValidateTree)(pWin->parent, NullWindow, VTOther);
- }
-
- if (WasViewable) {
- (*pScreen->HandleExposures)(pWin->parent);
- if (pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin->parent, NullWindow, VTOther);
- }
- }
- if (pWin->realized)
- WindowsRestructured ();
- CheckCursorConfinement(pWin);
-}
-
-
-
-static void
-miOverlayChangeBorderWidth(
- WindowPtr pWin,
- unsigned int width
-){
- int oldwidth;
- ScreenPtr pScreen;
- Bool WasViewable = (Bool)(pWin->viewable);
- Bool HadBorder;
-
- oldwidth = wBorderWidth (pWin);
- if (oldwidth == width)
- return;
- HadBorder = HasBorder(pWin);
- pScreen = pWin->drawable.pScreen;
- if (WasViewable && (width < oldwidth))
- (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
-
- pWin->borderWidth = width;
- SetBorderSize (pWin);
-
- if (WasViewable) {
- if (width > oldwidth) {
- (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
-
- if (HadBorder) {
- RegionPtr borderVisible;
- borderVisible = RegionCreate(NULL, 1);
- RegionSubtract(borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- if(IN_UNDERLAY(pWin)) {
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- RegionPtr borderVisible2;
-
- borderVisible2 = RegionCreate(NULL, 1);
- RegionSubtract(borderVisible2,
- &pTree->borderClip, &pWin->winSize);
- pTree->valdata->borderVisible = borderVisible2;
- }
- }
- }
- (*pScreen->ValidateTree)(pWin->parent, pWin, VTOther);
- (*pScreen->HandleExposures)(pWin->parent);
-
- if (pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin->parent, pWin, VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
-}
-
-/* We need this as an addition since the xf86 common code doesn't
- know about the second tree which is static to this file. */
-
-void
-miOverlaySetRootClip(ScreenPtr pScreen, Bool enable)
-{
- WindowPtr pRoot = pScreen->root;
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pRoot);
-
- MARK_UNDERLAY(pRoot);
-
- if(enable) {
- BoxRec box;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
-
- RegionReset(&pTree->borderClip, &box);
- } else
- RegionEmpty(&pTree->borderClip);
-
- RegionBreak(&pTree->clipList);
-}
-
-static void
-miOverlayClearToBackground(
- WindowPtr pWin,
- int x, int y,
- int w, int h,
- Bool generateExposures
-)
-{
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- BoxRec box;
- RegionRec reg;
- RegionPtr pBSReg = NullRegion;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
- RegionPtr clipList;
- BoxPtr extents;
- int x1, y1, x2, y2;
-
- x1 = pWin->drawable.x + x;
- y1 = pWin->drawable.y + y;
- if (w)
- x2 = x1 + (int) w;
- else
- x2 = x1 + (int) pWin->drawable.width - (int) x;
- if (h)
- y2 = y1 + h;
- else
- y2 = y1 + (int) pWin->drawable.height - (int) y;
-
- clipList = ((*pScreenPriv->InOverlay)(pWin)) ? &pWin->clipList :
- &pTree->clipList;
-
- extents = RegionExtents(clipList);
-
- if (x1 < extents->x1) x1 = extents->x1;
- if (x2 > extents->x2) x2 = extents->x2;
- if (y1 < extents->y1) y1 = extents->y1;
- if (y2 > extents->y2) y2 = extents->y2;
-
- if (x2 <= x1 || y2 <= y1)
- x2 = x1 = y2 = y1 = 0;
-
- box.x1 = x1; box.x2 = x2;
- box.y1 = y1; box.y2 = y2;
-
- RegionInit(&reg, &box, 1);
-
- RegionIntersect(&reg, &reg, clipList);
- if (generateExposures)
- (*pScreen->WindowExposures)(pWin, &reg, pBSReg);
- else if (pWin->backgroundState != None)
- miPaintWindow(pWin, &reg, PW_BACKGROUND);
- RegionUninit(&reg);
- if (pBSReg)
- RegionDestroy(pBSReg);
-}
-
-
-/****************************************************************/
-
-/* not used */
-Bool
-miOverlayGetPrivateClips(
- WindowPtr pWin,
- RegionPtr *borderClip,
- RegionPtr *clipList
-){
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
-
- if(pTree) {
- *borderClip = &(pTree->borderClip);
- *clipList = &(pTree->clipList);
- return TRUE;
- }
-
- *borderClip = *clipList = NULL;
-
- return FALSE;
-}
-
-void
-miOverlaySetTransFunction (
- ScreenPtr pScreen,
- miOverlayTransFunc transFunc
-){
- MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->MakeTransparent = transFunc;
-}
-
-Bool
-miOverlayCopyUnderlay(ScreenPtr pScreen)
-{
- return MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->copyUnderlay;
-}
-
-void
-miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin)
-{
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- RegionPtr pregWin;
- Bool freeTmpClip, freeCompClip;
-
- if(!pTree) {
- miComputeCompositeClip(pGC, &pWin->drawable);
- return;
- }
-
- if (pGC->subWindowMode == IncludeInferiors) {
- pregWin = RegionCreate(NullBox, 1);
- freeTmpClip = TRUE;
- if (pWin->parent || (screenIsSaved != SCREEN_SAVER_ON) ||
- !HasSaverWindow (pGC->pScreen))
- {
- RegionIntersect(pregWin,&pTree->borderClip,&pWin->winSize);
- }
- } else {
- pregWin = &pTree->clipList;
- freeTmpClip = FALSE;
- }
- freeCompClip = pGC->freeCompClip;
- if (pGC->clientClipType == CT_NONE) {
- if (freeCompClip)
- RegionDestroy(pGC->pCompositeClip);
- pGC->pCompositeClip = pregWin;
- pGC->freeCompClip = freeTmpClip;
- } else {
- RegionTranslate(pGC->clientClip,
- pWin->drawable.x + pGC->clipOrg.x,
- pWin->drawable.y + pGC->clipOrg.y);
-
- if (freeCompClip) {
- RegionIntersect(pGC->pCompositeClip,
- pregWin, pGC->clientClip);
- if (freeTmpClip)
- RegionDestroy(pregWin);
- } else if (freeTmpClip) {
- RegionIntersect(pregWin, pregWin, pGC->clientClip);
- pGC->pCompositeClip = pregWin;
- } else {
- pGC->pCompositeClip = RegionCreate(NullBox, 0);
- RegionIntersect(pGC->pCompositeClip,
- pregWin, pGC->clientClip);
- }
- pGC->freeCompClip = TRUE;
- RegionTranslate(pGC->clientClip,
- -(pWin->drawable.x + pGC->clipOrg.x),
- -(pWin->drawable.y + pGC->clipOrg.y));
- }
-}
-
-Bool
-miOverlayCollectUnderlayRegions(
- WindowPtr pWin,
- RegionPtr *region
-){
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
-
- if(pTree) {
- *region = &pTree->borderClip;
- return FALSE;
- }
-
- *region = RegionCreate(NullBox, 0);
-
- CollectUnderlayChildrenRegions(pWin, *region);
-
- return TRUE;
-}
-
-
-static miOverlayTreePtr
-DoLeaf(
- WindowPtr pWin,
- miOverlayTreePtr parent,
- miOverlayTreePtr prevSib
-){
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
-
- pTree->parent = parent;
- pTree->firstChild = NULL;
- pTree->lastChild = NULL;
- pTree->prevSib = prevSib;
- pTree->nextSib = NULL;
-
- if(prevSib)
- prevSib->nextSib = pTree;
-
- if(!parent->firstChild)
- parent->firstChild = parent->lastChild = pTree;
- else if(parent->lastChild == prevSib)
- parent->lastChild = pTree;
-
- return pTree;
-}
-
-static void
-RebuildTree(WindowPtr pWin)
-{
- miOverlayTreePtr parent, prevSib, tChild;
- WindowPtr pChild;
-
- prevSib = tChild = NULL;
-
- pWin = pWin->parent;
-
- while(IN_OVERLAY(pWin))
- pWin = pWin->parent;
-
- parent = MIOVERLAY_GET_WINDOW_TREE(pWin);
-
- pChild = pWin->firstChild;
- parent->firstChild = parent->lastChild = NULL;
-
- while(1) {
- if(IN_UNDERLAY(pChild))
- prevSib = tChild = DoLeaf(pChild, parent, prevSib);
-
- if(pChild->firstChild) {
- if(IN_UNDERLAY(pChild)) {
- parent = tChild;
- prevSib = NULL;
- }
- pChild = pChild->firstChild;
- continue;
- }
-
- while(!pChild->nextSib) {
- pChild = pChild->parent;
- if(pChild == pWin) return;
- if(IN_UNDERLAY(pChild)) {
- prevSib = tChild = MIOVERLAY_GET_WINDOW_TREE(pChild);
- parent = tChild->parent;
- }
- }
-
- pChild = pChild->nextSib;
- }
-}
-
-
-static Bool
-HasUnderlayChildren(WindowPtr pWin)
-{
- WindowPtr pChild;
-
- if(!(pChild = pWin->firstChild))
- return FALSE;
-
- while(1) {
- if(IN_UNDERLAY(pChild))
- return TRUE;
-
- if(pChild->firstChild) {
- pChild = pChild->firstChild;
- continue;
- }
-
- while(!pChild->nextSib && (pWin != pChild))
- pChild = pChild->parent;
-
- if(pChild == pWin) break;
-
- pChild = pChild->nextSib;
- }
-
- return FALSE;
-}
-
-
-static Bool
-CollectUnderlayChildrenRegions(WindowPtr pWin, RegionPtr pReg)
-{
- WindowPtr pChild;
- miOverlayTreePtr pTree;
- Bool hasUnderlay;
-
- if(!(pChild = pWin->firstChild))
- return FALSE;
-
- hasUnderlay = FALSE;
-
- while(1) {
- if((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
- RegionAppend(pReg, &pTree->borderClip);
- hasUnderlay = TRUE;
- } else
- if(pChild->firstChild) {
- pChild = pChild->firstChild;
- continue;
- }
-
- while(!pChild->nextSib && (pWin != pChild))
- pChild = pChild->parent;
-
- if(pChild == pWin) break;
-
- pChild = pChild->nextSib;
- }
-
- if(hasUnderlay) {
- Bool overlap;
- RegionValidate(pReg, &overlap);
- }
-
- return hasUnderlay;
-}
-
-
-static void
-MarkUnderlayWindow(WindowPtr pWin)
-{
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
-
- if(pTree->valdata) return;
- pTree->valdata = (miOverlayValDataPtr)xnfalloc(sizeof(miOverlayValDataRec));
- pTree->valdata->oldAbsCorner.x = pWin->drawable.x;
- pTree->valdata->oldAbsCorner.y = pWin->drawable.y;
- pTree->valdata->borderVisible = NullRegion;
-}
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef CreateWindow
+#undef CreateWindow
+#endif
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include <X11/extensions/shapeproto.h>
+#include "validate.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "gcstruct.h"
+#include "regionstr.h"
+#include "privates.h"
+#include "mivalidate.h"
+#include "mioverlay.h"
+#include "migc.h"
+
+#include "globals.h"
+
+typedef struct {
+ RegionRec exposed;
+ RegionRec borderExposed;
+ RegionPtr borderVisible;
+ DDXPointRec oldAbsCorner;
+} miOverlayValDataRec, *miOverlayValDataPtr;
+
+typedef struct _TreeRec {
+ WindowPtr pWin;
+ struct _TreeRec *parent;
+ struct _TreeRec *firstChild;
+ struct _TreeRec *lastChild;
+ struct _TreeRec *prevSib;
+ struct _TreeRec *nextSib;
+ RegionRec borderClip;
+ RegionRec clipList;
+ unsigned visibility;
+ miOverlayValDataPtr valdata;
+} miOverlayTreeRec, *miOverlayTreePtr;
+
+typedef struct {
+ miOverlayTreePtr tree;
+} miOverlayWindowRec, *miOverlayWindowPtr;
+
+typedef struct {
+ CloseScreenProcPtr CloseScreen;
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ RealizeWindowProcPtr RealizeWindow;
+ miOverlayTransFunc MakeTransparent;
+ miOverlayInOverlayFunc InOverlay;
+ Bool underlayMarked;
+ Bool copyUnderlay;
+} miOverlayScreenRec, *miOverlayScreenPtr;
+
+static DevPrivateKeyRec miOverlayWindowKeyRec;
+
+#define miOverlayWindowKey (&miOverlayWindowKeyRec)
+static DevPrivateKeyRec miOverlayScreenKeyRec;
+
+#define miOverlayScreenKey (&miOverlayScreenKeyRec)
+
+static void RebuildTree(WindowPtr);
+static Bool HasUnderlayChildren(WindowPtr);
+static void MarkUnderlayWindow(WindowPtr);
+static Bool CollectUnderlayChildrenRegions(WindowPtr, RegionPtr);
+
+static Bool miOverlayCloseScreen(int, ScreenPtr);
+static Bool miOverlayCreateWindow(WindowPtr);
+static Bool miOverlayDestroyWindow(WindowPtr);
+static Bool miOverlayUnrealizeWindow(WindowPtr);
+static Bool miOverlayRealizeWindow(WindowPtr);
+static void miOverlayMarkWindow(WindowPtr);
+static void miOverlayReparentWindow(WindowPtr, WindowPtr);
+static void miOverlayRestackWindow(WindowPtr, WindowPtr);
+static Bool miOverlayMarkOverlappedWindows(WindowPtr, WindowPtr, WindowPtr *);
+static void miOverlayMarkUnrealizedWindow(WindowPtr, WindowPtr, Bool);
+static int miOverlayValidateTree(WindowPtr, WindowPtr, VTKind);
+static void miOverlayHandleExposures(WindowPtr);
+static void miOverlayMoveWindow(WindowPtr, int, int, WindowPtr, VTKind);
+static void miOverlayWindowExposures(WindowPtr, RegionPtr, RegionPtr);
+static void miOverlayResizeWindow(WindowPtr, int, int, unsigned int,
+ unsigned int, WindowPtr);
+static void miOverlayClearToBackground(WindowPtr, int, int, int, int, Bool);
+
+static void miOverlaySetShape(WindowPtr, int);
+static void miOverlayChangeBorderWidth(WindowPtr, unsigned int);
+
+#define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) ((miOverlayScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, miOverlayScreenKey))
+#define MIOVERLAY_GET_WINDOW_PRIVATE(pWin) ((miOverlayWindowPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, miOverlayWindowKey))
+#define MIOVERLAY_GET_WINDOW_TREE(pWin) \
+ (MIOVERLAY_GET_WINDOW_PRIVATE(pWin)->tree)
+
+#define IN_UNDERLAY(w) MIOVERLAY_GET_WINDOW_TREE(w)
+#define IN_OVERLAY(w) !MIOVERLAY_GET_WINDOW_TREE(w)
+
+#define MARK_OVERLAY(w) miMarkWindow(w)
+#define MARK_UNDERLAY(w) MarkUnderlayWindow(w)
+
+#define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \
+ HasBorder(w) && \
+ (w)->backgroundState == ParentRelative)
+
+Bool
+miInitOverlay(ScreenPtr pScreen,
+ miOverlayInOverlayFunc inOverlayFunc,
+ miOverlayTransFunc transFunc)
+{
+ miOverlayScreenPtr pScreenPriv;
+
+ if (!inOverlayFunc || !transFunc)
+ return FALSE;
+
+ if (!dixRegisterPrivateKey
+ (&miOverlayWindowKeyRec, PRIVATE_WINDOW, sizeof(miOverlayWindowRec)))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&miOverlayScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ if (!(pScreenPriv = malloc(sizeof(miOverlayScreenRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv);
+
+ pScreenPriv->InOverlay = inOverlayFunc;
+ pScreenPriv->MakeTransparent = transFunc;
+ pScreenPriv->underlayMarked = FALSE;
+
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreenPriv->CreateWindow = pScreen->CreateWindow;
+ pScreenPriv->DestroyWindow = pScreen->DestroyWindow;
+ pScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow;
+ pScreenPriv->RealizeWindow = pScreen->RealizeWindow;
+
+ pScreen->CloseScreen = miOverlayCloseScreen;
+ pScreen->CreateWindow = miOverlayCreateWindow;
+ pScreen->DestroyWindow = miOverlayDestroyWindow;
+ pScreen->UnrealizeWindow = miOverlayUnrealizeWindow;
+ pScreen->RealizeWindow = miOverlayRealizeWindow;
+
+ pScreen->ReparentWindow = miOverlayReparentWindow;
+ pScreen->RestackWindow = miOverlayRestackWindow;
+ pScreen->MarkOverlappedWindows = miOverlayMarkOverlappedWindows;
+ pScreen->MarkUnrealizedWindow = miOverlayMarkUnrealizedWindow;
+ pScreen->ValidateTree = miOverlayValidateTree;
+ pScreen->HandleExposures = miOverlayHandleExposures;
+ pScreen->MoveWindow = miOverlayMoveWindow;
+ pScreen->WindowExposures = miOverlayWindowExposures;
+ pScreen->ResizeWindow = miOverlayResizeWindow;
+ pScreen->MarkWindow = miOverlayMarkWindow;
+ pScreen->ClearToBackground = miOverlayClearToBackground;
+ pScreen->SetShape = miOverlaySetShape;
+ pScreen->ChangeBorderWidth = miOverlayChangeBorderWidth;
+
+ return TRUE;
+}
+
+static Bool
+miOverlayCloseScreen(int i, ScreenPtr pScreen)
+{
+ miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->CreateWindow = pScreenPriv->CreateWindow;
+ pScreen->DestroyWindow = pScreenPriv->DestroyWindow;
+ pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow;
+ pScreen->RealizeWindow = pScreenPriv->RealizeWindow;
+
+ free(pScreenPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static Bool
+miOverlayCreateWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ miOverlayWindowPtr pWinPriv = MIOVERLAY_GET_WINDOW_PRIVATE(pWin);
+ miOverlayTreePtr pTree = NULL;
+ Bool result = TRUE;
+
+ pWinPriv->tree = NULL;
+
+ if (!pWin->parent || !((*pScreenPriv->InOverlay) (pWin))) {
+ if (!(pTree = (miOverlayTreePtr) calloc(1, sizeof(miOverlayTreeRec))))
+ return FALSE;
+ }
+
+ if (pScreenPriv->CreateWindow) {
+ pScreen->CreateWindow = pScreenPriv->CreateWindow;
+ result = (*pScreen->CreateWindow) (pWin);
+ pScreen->CreateWindow = miOverlayCreateWindow;
+ }
+
+ if (pTree) {
+ if (result) {
+ pTree->pWin = pWin;
+ pTree->visibility = VisibilityNotViewable;
+ pWinPriv->tree = pTree;
+ if (pWin->parent) {
+ RegionNull(&(pTree->borderClip));
+ RegionNull(&(pTree->clipList));
+ RebuildTree(pWin);
+ }
+ else {
+ BoxRec fullBox;
+
+ fullBox.x1 = 0;
+ fullBox.y1 = 0;
+ fullBox.x2 = pScreen->width;
+ fullBox.y2 = pScreen->height;
+ RegionInit(&(pTree->borderClip), &fullBox, 1);
+ RegionInit(&(pTree->clipList), &fullBox, 1);
+ }
+ }
+ else
+ free(pTree);
+ }
+
+ return TRUE;
+}
+
+static Bool
+miOverlayDestroyWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+ Bool result = TRUE;
+
+ if (pTree) {
+ if (pTree->prevSib)
+ pTree->prevSib->nextSib = pTree->nextSib;
+ else if (pTree->parent)
+ pTree->parent->firstChild = pTree->nextSib;
+
+ if (pTree->nextSib)
+ pTree->nextSib->prevSib = pTree->prevSib;
+ else if (pTree->parent)
+ pTree->parent->lastChild = pTree->prevSib;
+
+ RegionUninit(&(pTree->borderClip));
+ RegionUninit(&(pTree->clipList));
+ free(pTree);
+ }
+
+ if (pScreenPriv->DestroyWindow) {
+ pScreen->DestroyWindow = pScreenPriv->DestroyWindow;
+ result = (*pScreen->DestroyWindow) (pWin);
+ pScreen->DestroyWindow = miOverlayDestroyWindow;
+ }
+
+ return result;
+}
+
+static Bool
+miOverlayUnrealizeWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+ Bool result = TRUE;
+
+ if (pTree)
+ pTree->visibility = VisibilityNotViewable;
+
+ if (pScreenPriv->UnrealizeWindow) {
+ pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow;
+ result = (*pScreen->UnrealizeWindow) (pWin);
+ pScreen->UnrealizeWindow = miOverlayUnrealizeWindow;
+ }
+
+ return result;
+}
+
+static Bool
+miOverlayRealizeWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ Bool result = TRUE;
+
+ if (pScreenPriv->RealizeWindow) {
+ pScreen->RealizeWindow = pScreenPriv->RealizeWindow;
+ result = (*pScreen->RealizeWindow) (pWin);
+ pScreen->RealizeWindow = miOverlayRealizeWindow;
+ }
+
+ /* we only need to catch the root window realization */
+
+ if (result && !pWin->parent && !((*pScreenPriv->InOverlay) (pWin))) {
+ BoxRec box;
+
+ box.x1 = box.y1 = 0;
+ box.x2 = pWin->drawable.width;
+ box.y2 = pWin->drawable.height;
+ (*pScreenPriv->MakeTransparent) (pScreen, 1, &box);
+ }
+
+ return result;
+}
+
+static void
+miOverlayReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
+{
+ if (IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) {
+ /* This could probably be more optimal */
+ RebuildTree(pWin->drawable.pScreen->root->firstChild);
+ }
+}
+
+static void
+miOverlayRestackWindow(WindowPtr pWin, WindowPtr oldNextSib)
+{
+ if (IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) {
+ /* This could probably be more optimal */
+ RebuildTree(pWin);
+ }
+}
+
+static Bool
+miOverlayMarkOverlappedWindows(WindowPtr pWin,
+ WindowPtr pFirst, WindowPtr *pLayerWin)
+{
+ WindowPtr pChild, pLast;
+ Bool overMarked, underMarked, doUnderlay, markAll;
+ miOverlayTreePtr pTree = NULL, tLast, tChild;
+ BoxPtr box;
+
+ overMarked = underMarked = markAll = FALSE;
+
+ if (pLayerWin)
+ *pLayerWin = pWin; /* hah! */
+
+ doUnderlay = (IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin));
+
+ box = RegionExtents(&pWin->borderSize);
+
+ if ((pChild = pFirst)) {
+ pLast = pChild->parent->lastChild;
+ while (1) {
+ if (pChild == pWin)
+ markAll = TRUE;
+
+ if (doUnderlay && IN_UNDERLAY(pChild))
+ pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
+
+ if (pChild->viewable) {
+ if (RegionBroken(&pChild->winSize))
+ SetWinSize(pChild);
+ if (RegionBroken(&pChild->borderSize))
+ SetBorderSize(pChild);
+
+ if (markAll || RegionContainsRect(&pChild->borderSize, box)) {
+ MARK_OVERLAY(pChild);
+ overMarked = TRUE;
+ if (doUnderlay && IN_UNDERLAY(pChild)) {
+ MARK_UNDERLAY(pChild);
+ underMarked = TRUE;
+ }
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ }
+ while (!pChild->nextSib && (pChild != pLast)) {
+ pChild = pChild->parent;
+ if (doUnderlay && IN_UNDERLAY(pChild))
+ pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
+ }
+
+ if (pChild == pWin)
+ markAll = FALSE;
+
+ if (pChild == pLast)
+ break;
+
+ pChild = pChild->nextSib;
+ }
+ if (overMarked)
+ MARK_OVERLAY(pWin->parent);
+ }
+
+ if (doUnderlay && !pTree) {
+ if (!(pTree = MIOVERLAY_GET_WINDOW_TREE(pWin))) {
+ pChild = pWin->lastChild;
+ while (1) {
+ if ((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild)))
+ break;
+
+ if (pChild->lastChild) {
+ pChild = pChild->lastChild;
+ continue;
+ }
+
+ while (!pChild->prevSib)
+ pChild = pChild->parent;
+
+ pChild = pChild->prevSib;
+ }
+ }
+ }
+
+ if (pTree && pTree->nextSib) {
+ tChild = pTree->parent->lastChild;
+ tLast = pTree->nextSib;
+
+ while (1) {
+ if (tChild->pWin->viewable) {
+ if (RegionBroken(&tChild->pWin->winSize))
+ SetWinSize(tChild->pWin);
+ if (RegionBroken(&tChild->pWin->borderSize))
+ SetBorderSize(tChild->pWin);
+
+ if (RegionContainsRect(&(tChild->pWin->borderSize), box)) {
+ MARK_UNDERLAY(tChild->pWin);
+ underMarked = TRUE;
+ }
+ }
+
+ if (tChild->lastChild) {
+ tChild = tChild->lastChild;
+ continue;
+ }
+
+ while (!tChild->prevSib && (tChild != tLast))
+ tChild = tChild->parent;
+
+ if (tChild == tLast)
+ break;
+
+ tChild = tChild->prevSib;
+ }
+ }
+
+ if (underMarked) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ MARK_UNDERLAY(pTree->parent->pWin);
+ MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->underlayMarked = TRUE;
+ }
+
+ return underMarked || overMarked;
+}
+
+static void
+miOverlayComputeClips(WindowPtr pParent,
+ RegionPtr universe, VTKind kind, RegionPtr exposed)
+{
+ ScreenPtr pScreen = pParent->drawable.pScreen;
+ int oldVis, newVis, dx, dy;
+ BoxRec borderSize;
+ RegionPtr borderVisible;
+ RegionRec childUniverse, childUnion;
+ miOverlayTreePtr tParent = MIOVERLAY_GET_WINDOW_TREE(pParent);
+ miOverlayTreePtr tChild;
+ Bool overlap;
+
+ borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent);
+ borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent);
+ dx = (int) pParent->drawable.x + (int) pParent->drawable.width +
+ wBorderWidth(pParent);
+ if (dx > 32767)
+ dx = 32767;
+ borderSize.x2 = dx;
+ dy = (int) pParent->drawable.y + (int) pParent->drawable.height +
+ wBorderWidth(pParent);
+ if (dy > 32767)
+ dy = 32767;
+ borderSize.y2 = dy;
+
+ oldVis = tParent->visibility;
+ switch (RegionContainsRect(universe, &borderSize)) {
+ case rgnIN:
+ newVis = VisibilityUnobscured;
+ break;
+ case rgnPART:
+ newVis = VisibilityPartiallyObscured;
+ {
+ RegionPtr pBounding;
+
+ if ((pBounding = wBoundingShape(pParent))) {
+ switch (miShapedWindowIn(universe, pBounding,
+ &borderSize,
+ pParent->drawable.x,
+ pParent->drawable.y)) {
+ case rgnIN:
+ newVis = VisibilityUnobscured;
+ break;
+ case rgnOUT:
+ newVis = VisibilityFullyObscured;
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ newVis = VisibilityFullyObscured;
+ break;
+ }
+ tParent->visibility = newVis;
+
+ dx = pParent->drawable.x - tParent->valdata->oldAbsCorner.x;
+ dy = pParent->drawable.y - tParent->valdata->oldAbsCorner.y;
+
+ switch (kind) {
+ case VTMap:
+ case VTStack:
+ case VTUnmap:
+ break;
+ case VTMove:
+ if ((oldVis == newVis) &&
+ ((oldVis == VisibilityFullyObscured) ||
+ (oldVis == VisibilityUnobscured))) {
+ tChild = tParent;
+ while (1) {
+ if (tChild->pWin->viewable) {
+ if (tChild->visibility != VisibilityFullyObscured) {
+ RegionTranslate(&tChild->borderClip, dx, dy);
+ RegionTranslate(&tChild->clipList, dx, dy);
+
+ tChild->pWin->drawable.serialNumber =
+ NEXT_SERIAL_NUMBER;
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (tChild->pWin, dx, dy);
+ }
+ if (tChild->valdata) {
+ RegionNull(&tChild->valdata->borderExposed);
+ if (HasParentRelativeBorder(tChild->pWin)) {
+ RegionSubtract(&tChild->valdata->borderExposed,
+ &tChild->borderClip,
+ &tChild->pWin->winSize);
+ }
+ RegionNull(&tChild->valdata->exposed);
+ }
+ if (tChild->firstChild) {
+ tChild = tChild->firstChild;
+ continue;
+ }
+ }
+ while (!tChild->nextSib && (tChild != tParent))
+ tChild = tChild->parent;
+ if (tChild == tParent)
+ break;
+ tChild = tChild->nextSib;
+ }
+ return;
+ }
+ /* fall through */
+ default:
+ if (dx || dy) {
+ RegionTranslate(&tParent->borderClip, dx, dy);
+ RegionTranslate(&tParent->clipList, dx, dy);
+ }
+ break;
+ case VTBroken:
+ RegionEmpty(&tParent->borderClip);
+ RegionEmpty(&tParent->clipList);
+ break;
+ }
+
+ borderVisible = tParent->valdata->borderVisible;
+ RegionNull(&tParent->valdata->borderExposed);
+ RegionNull(&tParent->valdata->exposed);
+
+ if (HasBorder(pParent)) {
+ if (borderVisible) {
+ RegionSubtract(exposed, universe, borderVisible);
+ RegionDestroy(borderVisible);
+ }
+ else
+ RegionSubtract(exposed, universe, &tParent->borderClip);
+
+ if (HasParentRelativeBorder(pParent) && (dx || dy))
+ RegionSubtract(&tParent->valdata->borderExposed,
+ universe, &pParent->winSize);
+ else
+ RegionSubtract(&tParent->valdata->borderExposed,
+ exposed, &pParent->winSize);
+
+ RegionCopy(&tParent->borderClip, universe);
+ RegionIntersect(universe, universe, &pParent->winSize);
+ }
+ else
+ RegionCopy(&tParent->borderClip, universe);
+
+ if ((tChild = tParent->firstChild) && pParent->mapped) {
+ RegionNull(&childUniverse);
+ RegionNull(&childUnion);
+
+ for (; tChild; tChild = tChild->nextSib) {
+ if (tChild->pWin->viewable)
+ RegionAppend(&childUnion, &tChild->pWin->borderSize);
+ }
+
+ RegionValidate(&childUnion, &overlap);
+
+ for (tChild = tParent->firstChild; tChild; tChild = tChild->nextSib) {
+ if (tChild->pWin->viewable) {
+ if (tChild->valdata) {
+ RegionIntersect(&childUniverse, universe,
+ &tChild->pWin->borderSize);
+ miOverlayComputeClips(tChild->pWin, &childUniverse,
+ kind, exposed);
+ }
+ if (overlap)
+ RegionSubtract(universe, universe,
+ &tChild->pWin->borderSize);
+ }
+ }
+ if (!overlap)
+ RegionSubtract(universe, universe, &childUnion);
+ RegionUninit(&childUnion);
+ RegionUninit(&childUniverse);
+ }
+
+ if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) {
+ RegionCopy(&tParent->valdata->exposed, universe);
+ }
+ else if (newVis != VisibilityFullyObscured &&
+ newVis != VisibilityNotViewable) {
+ RegionSubtract(&tParent->valdata->exposed,
+ universe, &tParent->clipList);
+ }
+
+ /* HACK ALERT - copying contents of regions, instead of regions */
+ {
+ RegionRec tmp;
+
+ tmp = tParent->clipList;
+ tParent->clipList = *universe;
+ *universe = tmp;
+ }
+
+ pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (pParent, dx, dy);
+}
+
+static void
+miOverlayMarkWindow(WindowPtr pWin)
+{
+ miOverlayTreePtr pTree = NULL;
+ WindowPtr pChild, pGrandChild;
+
+ miMarkWindow(pWin);
+
+ /* look for UnmapValdata among immediate children */
+
+ if (!(pChild = pWin->firstChild))
+ return;
+
+ for (; pChild; pChild = pChild->nextSib) {
+ if (pChild->valdata == UnmapValData) {
+ if (IN_UNDERLAY(pChild)) {
+ pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
+ pTree->valdata = (miOverlayValDataPtr) UnmapValData;
+ continue;
+ }
+ else {
+ if (!(pGrandChild = pChild->firstChild))
+ continue;
+
+ while (1) {
+ if (IN_UNDERLAY(pGrandChild)) {
+ pTree = MIOVERLAY_GET_WINDOW_TREE(pGrandChild);
+ pTree->valdata = (miOverlayValDataPtr) UnmapValData;
+ }
+ else if (pGrandChild->firstChild) {
+ pGrandChild = pGrandChild->firstChild;
+ continue;
+ }
+
+ while (!pGrandChild->nextSib && (pGrandChild != pChild))
+ pGrandChild = pGrandChild->parent;
+
+ if (pChild == pGrandChild)
+ break;
+
+ pGrandChild = pGrandChild->nextSib;
+ }
+ }
+ }
+ }
+
+ if (pTree) {
+ MARK_UNDERLAY(pTree->parent->pWin);
+ MIOVERLAY_GET_SCREEN_PRIVATE(pWin->drawable.pScreen)->underlayMarked =
+ TRUE;
+ }
+}
+
+static void
+miOverlayMarkUnrealizedWindow(WindowPtr pChild,
+ WindowPtr pWin, Bool fromConfigure)
+{
+ if ((pChild != pWin) || fromConfigure) {
+ miOverlayTreePtr pTree;
+
+ RegionEmpty(&pChild->clipList);
+ if (pChild->drawable.pScreen->ClipNotify)
+ (*pChild->drawable.pScreen->ClipNotify) (pChild, 0, 0);
+ RegionEmpty(&pChild->borderClip);
+ if ((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
+ if (pTree->valdata != (miOverlayValDataPtr) UnmapValData) {
+ RegionEmpty(&pTree->clipList);
+ RegionEmpty(&pTree->borderClip);
+ }
+ }
+ }
+}
+
+static int
+miOverlayValidateTree(WindowPtr pParent, WindowPtr pChild, /* first child effected */
+ VTKind kind)
+{
+ ScreenPtr pScreen = pParent->drawable.pScreen;
+ miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ RegionRec totalClip, childClip, exposed;
+ miOverlayTreePtr tParent, tChild, tWin;
+ Bool overlap;
+ WindowPtr newParent;
+
+ if (!pPriv->underlayMarked)
+ goto SKIP_UNDERLAY;
+
+ if (!pChild)
+ pChild = pParent->firstChild;
+
+ RegionNull(&totalClip);
+ RegionNull(&childClip);
+ RegionNull(&exposed);
+
+ newParent = pParent;
+
+ while (IN_OVERLAY(newParent))
+ newParent = newParent->parent;
+
+ tParent = MIOVERLAY_GET_WINDOW_TREE(newParent);
+
+ if (IN_UNDERLAY(pChild))
+ tChild = MIOVERLAY_GET_WINDOW_TREE(pChild);
+ else
+ tChild = tParent->firstChild;
+
+ if (RegionBroken(&tParent->clipList) && !RegionBroken(&tParent->borderClip)) {
+ kind = VTBroken;
+ RegionCopy(&totalClip, &tParent->borderClip);
+ RegionIntersect(&totalClip, &totalClip, &tParent->pWin->winSize);
+
+ for (tWin = tParent->firstChild; tWin != tChild; tWin = tWin->nextSib) {
+ if (tWin->pWin->viewable)
+ RegionSubtract(&totalClip, &totalClip, &tWin->pWin->borderSize);
+ }
+ RegionEmpty(&tParent->clipList);
+ }
+ else {
+ for (tWin = tChild; tWin; tWin = tWin->nextSib) {
+ if (tWin->valdata)
+ RegionAppend(&totalClip, &tWin->borderClip);
+ }
+ RegionValidate(&totalClip, &overlap);
+ }
+
+ if (kind != VTStack)
+ RegionUnion(&totalClip, &totalClip, &tParent->clipList);
+
+ for (tWin = tChild; tWin; tWin = tWin->nextSib) {
+ if (tWin->valdata) {
+ if (tWin->pWin->viewable) {
+ RegionIntersect(&childClip, &totalClip,
+ &tWin->pWin->borderSize);
+ miOverlayComputeClips(tWin->pWin, &childClip, kind, &exposed);
+ RegionSubtract(&totalClip, &totalClip, &tWin->pWin->borderSize);
+ }
+ else { /* Means we are unmapping */
+ RegionEmpty(&tWin->clipList);
+ RegionEmpty(&tWin->borderClip);
+ tWin->valdata = NULL;
+ }
+ }
+ }
+
+ RegionUninit(&childClip);
+
+ if (!((*pPriv->InOverlay) (newParent))) {
+ RegionNull(&tParent->valdata->exposed);
+ RegionNull(&tParent->valdata->borderExposed);
+ }
+
+ switch (kind) {
+ case VTStack:
+ break;
+ default:
+ if (!((*pPriv->InOverlay) (newParent)))
+ RegionSubtract(&tParent->valdata->exposed, &totalClip,
+ &tParent->clipList);
+ /* fall through */
+ case VTMap:
+ RegionCopy(&tParent->clipList, &totalClip);
+ if (!((*pPriv->InOverlay) (newParent)))
+ newParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ break;
+ }
+
+ RegionUninit(&totalClip);
+ RegionUninit(&exposed);
+
+ SKIP_UNDERLAY:
+
+ miValidateTree(pParent, pChild, kind);
+
+ return 1;
+}
+
+static void
+miOverlayHandleExposures(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ WindowPtr pChild;
+ ValidatePtr val;
+ void (*WindowExposures) (WindowPtr, RegionPtr, RegionPtr);
+
+ WindowExposures = pWin->drawable.pScreen->WindowExposures;
+ if (pPriv->underlayMarked) {
+ miOverlayTreePtr pTree;
+ miOverlayValDataPtr mival;
+
+ pChild = pWin;
+ while (IN_OVERLAY(pChild))
+ pChild = pChild->parent;
+
+ pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
+
+ while (1) {
+ if ((mival = pTree->valdata)) {
+ if (!((*pPriv->InOverlay) (pTree->pWin))) {
+ if (RegionNotEmpty(&mival->borderExposed)) {
+ miPaintWindow(pTree->pWin, &mival->borderExposed,
+ PW_BORDER);
+ }
+ RegionUninit(&mival->borderExposed);
+
+ (*WindowExposures) (pTree->pWin, &mival->exposed,
+ NullRegion);
+ RegionUninit(&mival->exposed);
+ }
+ free(mival);
+ pTree->valdata = NULL;
+ if (pTree->firstChild) {
+ pTree = pTree->firstChild;
+ continue;
+ }
+ }
+ while (!pTree->nextSib && (pTree->pWin != pChild))
+ pTree = pTree->parent;
+ if (pTree->pWin == pChild)
+ break;
+ pTree = pTree->nextSib;
+ }
+ pPriv->underlayMarked = FALSE;
+ }
+
+ pChild = pWin;
+ while (1) {
+ if ((val = pChild->valdata)) {
+ if (!((*pPriv->InOverlay) (pChild))) {
+ RegionUnion(&val->after.exposed, &val->after.exposed,
+ &val->after.borderExposed);
+
+ if (RegionNotEmpty(&val->after.exposed)) {
+ (*(MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->MakeTransparent))
+ (pScreen, RegionNumRects(&val->after.exposed),
+ RegionRects(&val->after.exposed));
+ }
+ }
+ else {
+ if (RegionNotEmpty(&val->after.borderExposed)) {
+ miPaintWindow(pChild, &val->after.borderExposed, PW_BORDER);
+ }
+ (*WindowExposures) (pChild, &val->after.exposed, NullRegion);
+ }
+ RegionUninit(&val->after.borderExposed);
+ RegionUninit(&val->after.exposed);
+ free(val);
+ pChild->valdata = NULL;
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ break;
+ pChild = pChild->nextSib;
+ }
+}
+
+static void
+miOverlayMoveWindow(WindowPtr pWin,
+ int x, int y, WindowPtr pNextSib, VTKind kind)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+ WindowPtr pParent, windowToValidate;
+ Bool WasViewable = (Bool) (pWin->viewable);
+ short bw;
+ RegionRec overReg, underReg;
+ DDXPointRec oldpt;
+
+ if (!(pParent = pWin->parent))
+ return;
+ bw = wBorderWidth(pWin);
+
+ oldpt.x = pWin->drawable.x;
+ oldpt.y = pWin->drawable.y;
+ if (WasViewable) {
+ RegionNull(&overReg);
+ RegionNull(&underReg);
+ if (pTree) {
+ RegionCopy(&overReg, &pWin->borderClip);
+ RegionCopy(&underReg, &pTree->borderClip);
+ }
+ else {
+ RegionCopy(&overReg, &pWin->borderClip);
+ CollectUnderlayChildrenRegions(pWin, &underReg);
+ }
+ (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL);
+ }
+ pWin->origin.x = x + (int) bw;
+ pWin->origin.y = y + (int) bw;
+ x = pWin->drawable.x = pParent->drawable.x + x + (int) bw;
+ y = pWin->drawable.y = pParent->drawable.y + y + (int) bw;
+
+ SetWinSize(pWin);
+ SetBorderSize(pWin);
+
+ (*pScreen->PositionWindow) (pWin, x, y);
+
+ windowToValidate = MoveWindowInStack(pWin, pNextSib);
+
+ ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0);
+
+ if (WasViewable) {
+ miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+
+ (*pScreen->MarkOverlappedWindows) (pWin, windowToValidate, NULL);
+
+ (*pScreen->ValidateTree) (pWin->parent, NullWindow, kind);
+ if (RegionNotEmpty(&underReg)) {
+ pPriv->copyUnderlay = TRUE;
+ (*pWin->drawable.pScreen->CopyWindow) (pWin, oldpt, &underReg);
+ }
+ RegionUninit(&underReg);
+ if (RegionNotEmpty(&overReg)) {
+ pPriv->copyUnderlay = FALSE;
+ (*pWin->drawable.pScreen->CopyWindow) (pWin, oldpt, &overReg);
+ }
+ RegionUninit(&overReg);
+ (*pScreen->HandleExposures) (pWin->parent);
+
+ if (pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pWin->parent, NullWindow, kind);
+ }
+ if (pWin->realized)
+ WindowsRestructured();
+}
+
+#ifndef RECTLIMIT
+#define RECTLIMIT 25
+#endif
+
+static void
+miOverlayWindowExposures(WindowPtr pWin,
+ RegionPtr prgn, RegionPtr other_exposed)
+{
+ RegionPtr exposures = prgn;
+
+ if ((prgn && !RegionNil(prgn)) ||
+ (exposures && !RegionNil(exposures)) || other_exposed) {
+ RegionRec expRec;
+ int clientInterested;
+
+ clientInterested = (pWin->eventMask | wOtherEventMasks(pWin)) &
+ ExposureMask;
+ if (other_exposed) {
+ if (exposures) {
+ RegionUnion(other_exposed, exposures, other_exposed);
+ if (exposures != prgn)
+ RegionDestroy(exposures);
+ }
+ exposures = other_exposed;
+ }
+ if (clientInterested && exposures &&
+ (RegionNumRects(exposures) > RECTLIMIT)) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ BoxRec box;
+
+ box = *RegionExtents(exposures);
+ if (exposures == prgn) {
+ exposures = &expRec;
+ RegionInit(exposures, &box, 1);
+ RegionReset(prgn, &box);
+ }
+ else {
+ RegionReset(exposures, &box);
+ RegionUnion(prgn, prgn, exposures);
+ }
+ /* This is the only reason why we are replacing mi's version
+ of this file */
+
+ if (!((*pPriv->InOverlay) (pWin))) {
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+
+ RegionIntersect(prgn, prgn, &pTree->clipList);
+ }
+ else
+ RegionIntersect(prgn, prgn, &pWin->clipList);
+ }
+ if (prgn && !RegionNil(prgn))
+ miPaintWindow(pWin, prgn, PW_BACKGROUND);
+ if (clientInterested && exposures && !RegionNil(exposures))
+ miSendExposures(pWin, exposures,
+ pWin->drawable.x, pWin->drawable.y);
+ if (exposures == &expRec) {
+ RegionUninit(exposures);
+ }
+ else if (exposures && exposures != prgn && exposures != other_exposed)
+ RegionDestroy(exposures);
+ if (prgn)
+ RegionEmpty(prgn);
+ }
+ else if (exposures && exposures != prgn)
+ RegionDestroy(exposures);
+}
+
+typedef struct {
+ RegionPtr over;
+ RegionPtr under;
+} miOverlayTwoRegions;
+
+static int
+miOverlayRecomputeExposures(WindowPtr pWin, pointer value)
+{
+ miOverlayTwoRegions *pValid = (miOverlayTwoRegions *) value;
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+
+ if (pWin->valdata) {
+ /*
+ * compute exposed regions of this window
+ */
+ RegionSubtract(&pWin->valdata->after.exposed,
+ &pWin->clipList, pValid->over);
+ /*
+ * compute exposed regions of the border
+ */
+ RegionSubtract(&pWin->valdata->after.borderExposed,
+ &pWin->borderClip, &pWin->winSize);
+ RegionSubtract(&pWin->valdata->after.borderExposed,
+ &pWin->valdata->after.borderExposed, pValid->over);
+ }
+
+ if (pTree && pTree->valdata) {
+ RegionSubtract(&pTree->valdata->exposed,
+ &pTree->clipList, pValid->under);
+ RegionSubtract(&pTree->valdata->borderExposed,
+ &pTree->borderClip, &pWin->winSize);
+ RegionSubtract(&pTree->valdata->borderExposed,
+ &pTree->valdata->borderExposed, pValid->under);
+ }
+ else if (!pWin->valdata)
+ return WT_NOMATCH;
+
+ return WT_WALKCHILDREN;
+}
+
+static void
+miOverlayResizeWindow(WindowPtr pWin,
+ int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr pParent;
+ miOverlayTreePtr tChild, pTree;
+ Bool WasViewable = (Bool) (pWin->viewable);
+ unsigned short width = pWin->drawable.width;
+ unsigned short height = pWin->drawable.height;
+ short oldx = pWin->drawable.x;
+ short oldy = pWin->drawable.y;
+ int bw = wBorderWidth(pWin);
+ short dw, dh;
+ DDXPointRec oldpt;
+ RegionPtr oldRegion = NULL, oldRegion2 = NULL;
+ WindowPtr pFirstChange;
+ WindowPtr pChild;
+ RegionPtr gravitate[StaticGravity + 1];
+ RegionPtr gravitate2[StaticGravity + 1];
+ unsigned g;
+ int nx, ny; /* destination x,y */
+ int newx, newy; /* new inner window position */
+ RegionPtr pRegion = NULL;
+ RegionPtr destClip, destClip2;
+ RegionPtr oldWinClip = NULL, oldWinClip2 = NULL;
+ RegionPtr borderVisible = NullRegion;
+ RegionPtr borderVisible2 = NullRegion;
+ Bool shrunk = FALSE; /* shrunk in an inner dimension */
+ Bool moved = FALSE; /* window position changed */
+ Bool doUnderlay;
+
+ /* if this is a root window, can't be resized */
+ if (!(pParent = pWin->parent))
+ return;
+
+ pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+ doUnderlay = ((pTree) || HasUnderlayChildren(pWin));
+ newx = pParent->drawable.x + x + bw;
+ newy = pParent->drawable.y + y + bw;
+ if (WasViewable) {
+ /*
+ * save the visible region of the window
+ */
+ oldRegion = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion, &pWin->winSize);
+ if (doUnderlay) {
+ oldRegion2 = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion2, &pWin->winSize);
+ }
+
+ /*
+ * categorize child windows into regions to be moved
+ */
+ for (g = 0; g <= StaticGravity; g++)
+ gravitate[g] = gravitate2[g] = NULL;
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
+ g = pChild->winGravity;
+ if (g != UnmapGravity) {
+ if (!gravitate[g])
+ gravitate[g] = RegionCreate(NullBox, 1);
+ RegionUnion(gravitate[g], gravitate[g], &pChild->borderClip);
+
+ if (doUnderlay) {
+ if (!gravitate2[g])
+ gravitate2[g] = RegionCreate(NullBox, 0);
+
+ if ((tChild = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
+ RegionUnion(gravitate2[g],
+ gravitate2[g], &tChild->borderClip);
+ }
+ else
+ CollectUnderlayChildrenRegions(pChild, gravitate2[g]);
+ }
+ }
+ else {
+ UnmapWindow(pChild, TRUE);
+ }
+ }
+ (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL);
+
+ oldWinClip = oldWinClip2 = NULL;
+ if (pWin->bitGravity != ForgetGravity) {
+ oldWinClip = RegionCreate(NullBox, 1);
+ RegionCopy(oldWinClip, &pWin->clipList);
+ if (pTree) {
+ oldWinClip2 = RegionCreate(NullBox, 1);
+ RegionCopy(oldWinClip2, &pTree->clipList);
+ }
+ }
+ /*
+ * if the window is changing size, borderExposed
+ * can't be computed correctly without some help.
+ */
+ if (pWin->drawable.height > h || pWin->drawable.width > w)
+ shrunk = TRUE;
+
+ if (newx != oldx || newy != oldy)
+ moved = TRUE;
+
+ if ((pWin->drawable.height != h || pWin->drawable.width != w) &&
+ HasBorder(pWin)) {
+ borderVisible = RegionCreate(NullBox, 1);
+ if (pTree)
+ borderVisible2 = RegionCreate(NullBox, 1);
+ /* for tiled borders, we punt and draw the whole thing */
+ if (pWin->borderIsPixel || !moved) {
+ if (shrunk || moved)
+ RegionSubtract(borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ else
+ RegionCopy(borderVisible, &pWin->borderClip);
+ if (pTree) {
+ if (shrunk || moved)
+ RegionSubtract(borderVisible,
+ &pTree->borderClip, &pWin->winSize);
+ else
+ RegionCopy(borderVisible, &pTree->borderClip);
+ }
+ }
+ }
+ }
+ pWin->origin.x = x + bw;
+ pWin->origin.y = y + bw;
+ pWin->drawable.height = h;
+ pWin->drawable.width = w;
+
+ x = pWin->drawable.x = newx;
+ y = pWin->drawable.y = newy;
+
+ SetWinSize(pWin);
+ SetBorderSize(pWin);
+
+ dw = (int) w - (int) width;
+ dh = (int) h - (int) height;
+ ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh);
+
+ /* let the hardware adjust background and border pixmaps, if any */
+ (*pScreen->PositionWindow) (pWin, x, y);
+
+ pFirstChange = MoveWindowInStack(pWin, pSib);
+
+ if (WasViewable) {
+ pRegion = RegionCreate(NullBox, 1);
+
+ (*pScreen->MarkOverlappedWindows) (pWin, pFirstChange, NULL);
+
+ pWin->valdata->before.resized = TRUE;
+ pWin->valdata->before.borderVisible = borderVisible;
+ if (pTree)
+ pTree->valdata->borderVisible = borderVisible2;
+
+ (*pScreen->ValidateTree) (pWin->parent, pFirstChange, VTOther);
+ /*
+ * the entire window is trashed unless bitGravity
+ * recovers portions of it
+ */
+ RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList);
+ if (pTree)
+ RegionCopy(&pTree->valdata->exposed, &pTree->clipList);
+ }
+
+ GravityTranslate(x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny);
+
+ if (WasViewable) {
+ miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ miOverlayTwoRegions TwoRegions;
+
+ /* avoid the border */
+ if (HasBorder(pWin)) {
+ int offx, offy, dx, dy;
+
+ /* kruft to avoid double translates for each gravity */
+ offx = 0;
+ offy = 0;
+ for (g = 0; g <= StaticGravity; g++) {
+ if (!gravitate[g] && !gravitate2[g])
+ continue;
+
+ /* align winSize to gravitate[g].
+ * winSize is in new coordinates,
+ * gravitate[g] is still in old coordinates */
+ GravityTranslate(x, y, oldx, oldy, dw, dh, g, &nx, &ny);
+
+ dx = (oldx - nx) - offx;
+ dy = (oldy - ny) - offy;
+ if (dx || dy) {
+ RegionTranslate(&pWin->winSize, dx, dy);
+ offx += dx;
+ offy += dy;
+ }
+ if (gravitate[g])
+ RegionIntersect(gravitate[g], gravitate[g], &pWin->winSize);
+ if (gravitate2[g])
+ RegionIntersect(gravitate2[g], gravitate2[g],
+ &pWin->winSize);
+ }
+ /* get winSize back where it belongs */
+ if (offx || offy)
+ RegionTranslate(&pWin->winSize, -offx, -offy);
+ }
+ /*
+ * add screen bits to the appropriate bucket
+ */
+
+ if (oldWinClip2) {
+ RegionCopy(pRegion, oldWinClip2);
+ RegionTranslate(pRegion, nx - oldx, ny - oldy);
+ RegionIntersect(oldWinClip2, pRegion, &pTree->clipList);
+
+ for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) {
+ if (gravitate2[g])
+ RegionSubtract(oldWinClip2, oldWinClip2, gravitate2[g]);
+ }
+ RegionTranslate(oldWinClip2, oldx - nx, oldy - ny);
+ g = pWin->bitGravity;
+ if (!gravitate2[g])
+ gravitate2[g] = oldWinClip2;
+ else {
+ RegionUnion(gravitate2[g], gravitate2[g], oldWinClip2);
+ RegionDestroy(oldWinClip2);
+ }
+ }
+
+ if (oldWinClip) {
+ /*
+ * clip to new clipList
+ */
+ RegionCopy(pRegion, oldWinClip);
+ RegionTranslate(pRegion, nx - oldx, ny - oldy);
+ RegionIntersect(oldWinClip, pRegion, &pWin->clipList);
+ /*
+ * don't step on any gravity bits which will be copied after this
+ * region. Note -- this assumes that the regions will be copied
+ * in gravity order.
+ */
+ for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) {
+ if (gravitate[g])
+ RegionSubtract(oldWinClip, oldWinClip, gravitate[g]);
+ }
+ RegionTranslate(oldWinClip, oldx - nx, oldy - ny);
+ g = pWin->bitGravity;
+ if (!gravitate[g])
+ gravitate[g] = oldWinClip;
+ else {
+ RegionUnion(gravitate[g], gravitate[g], oldWinClip);
+ RegionDestroy(oldWinClip);
+ }
+ }
+
+ /*
+ * move the bits on the screen
+ */
+
+ destClip = destClip2 = NULL;
+
+ for (g = 0; g <= StaticGravity; g++) {
+ if (!gravitate[g] && !gravitate2[g])
+ continue;
+
+ GravityTranslate(x, y, oldx, oldy, dw, dh, g, &nx, &ny);
+
+ oldpt.x = oldx + (x - nx);
+ oldpt.y = oldy + (y - ny);
+
+ /* Note that gravitate[g] is *translated* by CopyWindow */
+
+ /* only copy the remaining useful bits */
+
+ if (gravitate[g])
+ RegionIntersect(gravitate[g], gravitate[g], oldRegion);
+ if (gravitate2[g])
+ RegionIntersect(gravitate2[g], gravitate2[g], oldRegion2);
+
+ /* clip to not overwrite already copied areas */
+
+ if (destClip && gravitate[g]) {
+ RegionTranslate(destClip, oldpt.x - x, oldpt.y - y);
+ RegionSubtract(gravitate[g], gravitate[g], destClip);
+ RegionTranslate(destClip, x - oldpt.x, y - oldpt.y);
+ }
+ if (destClip2 && gravitate2[g]) {
+ RegionTranslate(destClip2, oldpt.x - x, oldpt.y - y);
+ RegionSubtract(gravitate2[g], gravitate2[g], destClip2);
+ RegionTranslate(destClip2, x - oldpt.x, y - oldpt.y);
+ }
+
+ /* and move those bits */
+
+ if (oldpt.x != x || oldpt.y != y) {
+ if (gravitate2[g]) {
+ pPriv->copyUnderlay = TRUE;
+ (*pScreen->CopyWindow) (pWin, oldpt, gravitate2[g]);
+ }
+ if (gravitate[g]) {
+ pPriv->copyUnderlay = FALSE;
+ (*pScreen->CopyWindow) (pWin, oldpt, gravitate[g]);
+ }
+ }
+
+ /* remove any overwritten bits from the remaining useful bits */
+
+ if (gravitate[g])
+ RegionSubtract(oldRegion, oldRegion, gravitate[g]);
+ if (gravitate2[g])
+ RegionSubtract(oldRegion2, oldRegion2, gravitate2[g]);
+
+ /*
+ * recompute exposed regions of child windows
+ */
+
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
+ if (pChild->winGravity != g)
+ continue;
+
+ TwoRegions.over = gravitate[g];
+ TwoRegions.under = gravitate2[g];
+
+ TraverseTree(pChild, miOverlayRecomputeExposures,
+ (pointer) (&TwoRegions));
+ }
+
+ /*
+ * remove the successfully copied regions of the
+ * window from its exposed region
+ */
+
+ if (g == pWin->bitGravity) {
+ if (gravitate[g])
+ RegionSubtract(&pWin->valdata->after.exposed,
+ &pWin->valdata->after.exposed, gravitate[g]);
+ if (gravitate2[g] && pTree)
+ RegionSubtract(&pTree->valdata->exposed,
+ &pTree->valdata->exposed, gravitate2[g]);
+ }
+ if (gravitate[g]) {
+ if (!destClip)
+ destClip = gravitate[g];
+ else {
+ RegionUnion(destClip, destClip, gravitate[g]);
+ RegionDestroy(gravitate[g]);
+ }
+ }
+ if (gravitate2[g]) {
+ if (!destClip2)
+ destClip2 = gravitate2[g];
+ else {
+ RegionUnion(destClip2, destClip2, gravitate2[g]);
+ RegionDestroy(gravitate2[g]);
+ }
+ }
+ }
+
+ RegionDestroy(pRegion);
+ RegionDestroy(oldRegion);
+ if (doUnderlay)
+ RegionDestroy(oldRegion2);
+ if (destClip)
+ RegionDestroy(destClip);
+ if (destClip2)
+ RegionDestroy(destClip2);
+ (*pScreen->HandleExposures) (pWin->parent);
+ if (pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pWin->parent, pFirstChange, VTOther);
+ }
+ if (pWin->realized)
+ WindowsRestructured();
+}
+
+static void
+miOverlaySetShape(WindowPtr pWin, int kind)
+{
+ Bool WasViewable = (Bool) (pWin->viewable);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (kind != ShapeInput) {
+ if (WasViewable) {
+ (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL);
+
+ if (HasBorder(pWin)) {
+ RegionPtr borderVisible;
+
+ borderVisible = RegionCreate(NullBox, 1);
+ RegionSubtract(borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ pWin->valdata->before.resized = TRUE;
+ if (IN_UNDERLAY(pWin)) {
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+ RegionPtr borderVisible2;
+
+ borderVisible2 = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible2,
+ &pTree->borderClip, &pWin->winSize);
+ pTree->valdata->borderVisible = borderVisible2;
+ }
+ }
+ }
+
+ SetWinSize(pWin);
+ SetBorderSize(pWin);
+
+ ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
+
+ if (WasViewable) {
+ (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL);
+
+ (*pScreen->ValidateTree) (pWin->parent, NullWindow, VTOther);
+ }
+
+ if (WasViewable) {
+ (*pScreen->HandleExposures) (pWin->parent);
+ if (pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pWin->parent, NullWindow,
+ VTOther);
+ }
+ }
+ if (pWin->realized)
+ WindowsRestructured();
+ CheckCursorConfinement(pWin);
+}
+
+static void
+miOverlayChangeBorderWidth(WindowPtr pWin, unsigned int width)
+{
+ int oldwidth;
+ ScreenPtr pScreen;
+ Bool WasViewable = (Bool) (pWin->viewable);
+ Bool HadBorder;
+
+ oldwidth = wBorderWidth(pWin);
+ if (oldwidth == width)
+ return;
+ HadBorder = HasBorder(pWin);
+ pScreen = pWin->drawable.pScreen;
+ if (WasViewable && (width < oldwidth))
+ (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL);
+
+ pWin->borderWidth = width;
+ SetBorderSize(pWin);
+
+ if (WasViewable) {
+ if (width > oldwidth) {
+ (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL);
+
+ if (HadBorder) {
+ RegionPtr borderVisible;
+
+ borderVisible = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ if (IN_UNDERLAY(pWin)) {
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+ RegionPtr borderVisible2;
+
+ borderVisible2 = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible2,
+ &pTree->borderClip, &pWin->winSize);
+ pTree->valdata->borderVisible = borderVisible2;
+ }
+ }
+ }
+ (*pScreen->ValidateTree) (pWin->parent, pWin, VTOther);
+ (*pScreen->HandleExposures) (pWin->parent);
+
+ if (pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pWin->parent, pWin, VTOther);
+ }
+ if (pWin->realized)
+ WindowsRestructured();
+}
+
+/* We need this as an addition since the xf86 common code doesn't
+ know about the second tree which is static to this file. */
+
+void
+miOverlaySetRootClip(ScreenPtr pScreen, Bool enable)
+{
+ WindowPtr pRoot = pScreen->root;
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pRoot);
+
+ MARK_UNDERLAY(pRoot);
+
+ if (enable) {
+ BoxRec box;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+
+ RegionReset(&pTree->borderClip, &box);
+ }
+ else
+ RegionEmpty(&pTree->borderClip);
+
+ RegionBreak(&pTree->clipList);
+}
+
+static void
+miOverlayClearToBackground(WindowPtr pWin,
+ int x, int y, int w, int h, Bool generateExposures)
+{
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+ BoxRec box;
+ RegionRec reg;
+ RegionPtr pBSReg = NullRegion;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ RegionPtr clipList;
+ BoxPtr extents;
+ int x1, y1, x2, y2;
+
+ x1 = pWin->drawable.x + x;
+ y1 = pWin->drawable.y + y;
+ if (w)
+ x2 = x1 + (int) w;
+ else
+ x2 = x1 + (int) pWin->drawable.width - (int) x;
+ if (h)
+ y2 = y1 + h;
+ else
+ y2 = y1 + (int) pWin->drawable.height - (int) y;
+
+ clipList = ((*pScreenPriv->InOverlay) (pWin)) ? &pWin->clipList :
+ &pTree->clipList;
+
+ extents = RegionExtents(clipList);
+
+ if (x1 < extents->x1)
+ x1 = extents->x1;
+ if (x2 > extents->x2)
+ x2 = extents->x2;
+ if (y1 < extents->y1)
+ y1 = extents->y1;
+ if (y2 > extents->y2)
+ y2 = extents->y2;
+
+ if (x2 <= x1 || y2 <= y1)
+ x2 = x1 = y2 = y1 = 0;
+
+ box.x1 = x1;
+ box.x2 = x2;
+ box.y1 = y1;
+ box.y2 = y2;
+
+ RegionInit(&reg, &box, 1);
+
+ RegionIntersect(&reg, &reg, clipList);
+ if (generateExposures)
+ (*pScreen->WindowExposures) (pWin, &reg, pBSReg);
+ else if (pWin->backgroundState != None)
+ miPaintWindow(pWin, &reg, PW_BACKGROUND);
+ RegionUninit(&reg);
+ if (pBSReg)
+ RegionDestroy(pBSReg);
+}
+
+/****************************************************************/
+
+/* not used */
+Bool
+miOverlayGetPrivateClips(WindowPtr pWin,
+ RegionPtr *borderClip, RegionPtr *clipList)
+{
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+
+ if (pTree) {
+ *borderClip = &(pTree->borderClip);
+ *clipList = &(pTree->clipList);
+ return TRUE;
+ }
+
+ *borderClip = *clipList = NULL;
+
+ return FALSE;
+}
+
+void
+miOverlaySetTransFunction(ScreenPtr pScreen, miOverlayTransFunc transFunc)
+{
+ MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->MakeTransparent = transFunc;
+}
+
+Bool
+miOverlayCopyUnderlay(ScreenPtr pScreen)
+{
+ return MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->copyUnderlay;
+}
+
+void
+miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin)
+{
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+ RegionPtr pregWin;
+ Bool freeTmpClip, freeCompClip;
+
+ if (!pTree) {
+ miComputeCompositeClip(pGC, &pWin->drawable);
+ return;
+ }
+
+ if (pGC->subWindowMode == IncludeInferiors) {
+ pregWin = RegionCreate(NullBox, 1);
+ freeTmpClip = TRUE;
+ if (pWin->parent || (screenIsSaved != SCREEN_SAVER_ON) ||
+ !HasSaverWindow(pGC->pScreen)) {
+ RegionIntersect(pregWin, &pTree->borderClip, &pWin->winSize);
+ }
+ }
+ else {
+ pregWin = &pTree->clipList;
+ freeTmpClip = FALSE;
+ }
+ freeCompClip = pGC->freeCompClip;
+ if (pGC->clientClipType == CT_NONE) {
+ if (freeCompClip)
+ RegionDestroy(pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
+ }
+ else {
+ RegionTranslate(pGC->clientClip,
+ pWin->drawable.x + pGC->clipOrg.x,
+ pWin->drawable.y + pGC->clipOrg.y);
+
+ if (freeCompClip) {
+ RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip);
+ if (freeTmpClip)
+ RegionDestroy(pregWin);
+ }
+ else if (freeTmpClip) {
+ RegionIntersect(pregWin, pregWin, pGC->clientClip);
+ pGC->pCompositeClip = pregWin;
+ }
+ else {
+ pGC->pCompositeClip = RegionCreate(NullBox, 0);
+ RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip);
+ }
+ pGC->freeCompClip = TRUE;
+ RegionTranslate(pGC->clientClip,
+ -(pWin->drawable.x + pGC->clipOrg.x),
+ -(pWin->drawable.y + pGC->clipOrg.y));
+ }
+}
+
+Bool
+miOverlayCollectUnderlayRegions(WindowPtr pWin, RegionPtr *region)
+{
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+
+ if (pTree) {
+ *region = &pTree->borderClip;
+ return FALSE;
+ }
+
+ *region = RegionCreate(NullBox, 0);
+
+ CollectUnderlayChildrenRegions(pWin, *region);
+
+ return TRUE;
+}
+
+static miOverlayTreePtr
+DoLeaf(WindowPtr pWin, miOverlayTreePtr parent, miOverlayTreePtr prevSib)
+{
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+
+ pTree->parent = parent;
+ pTree->firstChild = NULL;
+ pTree->lastChild = NULL;
+ pTree->prevSib = prevSib;
+ pTree->nextSib = NULL;
+
+ if (prevSib)
+ prevSib->nextSib = pTree;
+
+ if (!parent->firstChild)
+ parent->firstChild = parent->lastChild = pTree;
+ else if (parent->lastChild == prevSib)
+ parent->lastChild = pTree;
+
+ return pTree;
+}
+
+static void
+RebuildTree(WindowPtr pWin)
+{
+ miOverlayTreePtr parent, prevSib, tChild;
+ WindowPtr pChild;
+
+ prevSib = tChild = NULL;
+
+ pWin = pWin->parent;
+
+ while (IN_OVERLAY(pWin))
+ pWin = pWin->parent;
+
+ parent = MIOVERLAY_GET_WINDOW_TREE(pWin);
+
+ pChild = pWin->firstChild;
+ parent->firstChild = parent->lastChild = NULL;
+
+ while (1) {
+ if (IN_UNDERLAY(pChild))
+ prevSib = tChild = DoLeaf(pChild, parent, prevSib);
+
+ if (pChild->firstChild) {
+ if (IN_UNDERLAY(pChild)) {
+ parent = tChild;
+ prevSib = NULL;
+ }
+ pChild = pChild->firstChild;
+ continue;
+ }
+
+ while (!pChild->nextSib) {
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ return;
+ if (IN_UNDERLAY(pChild)) {
+ prevSib = tChild = MIOVERLAY_GET_WINDOW_TREE(pChild);
+ parent = tChild->parent;
+ }
+ }
+
+ pChild = pChild->nextSib;
+ }
+}
+
+static Bool
+HasUnderlayChildren(WindowPtr pWin)
+{
+ WindowPtr pChild;
+
+ if (!(pChild = pWin->firstChild))
+ return FALSE;
+
+ while (1) {
+ if (IN_UNDERLAY(pChild))
+ return TRUE;
+
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+
+ while (!pChild->nextSib && (pWin != pChild))
+ pChild = pChild->parent;
+
+ if (pChild == pWin)
+ break;
+
+ pChild = pChild->nextSib;
+ }
+
+ return FALSE;
+}
+
+static Bool
+CollectUnderlayChildrenRegions(WindowPtr pWin, RegionPtr pReg)
+{
+ WindowPtr pChild;
+ miOverlayTreePtr pTree;
+ Bool hasUnderlay;
+
+ if (!(pChild = pWin->firstChild))
+ return FALSE;
+
+ hasUnderlay = FALSE;
+
+ while (1) {
+ if ((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
+ RegionAppend(pReg, &pTree->borderClip);
+ hasUnderlay = TRUE;
+ }
+ else if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+
+ while (!pChild->nextSib && (pWin != pChild))
+ pChild = pChild->parent;
+
+ if (pChild == pWin)
+ break;
+
+ pChild = pChild->nextSib;
+ }
+
+ if (hasUnderlay) {
+ Bool overlap;
+
+ RegionValidate(pReg, &overlap);
+ }
+
+ return hasUnderlay;
+}
+
+static void
+MarkUnderlayWindow(WindowPtr pWin)
+{
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+
+ if (pTree->valdata)
+ return;
+ pTree->valdata =
+ (miOverlayValDataPtr) xnfalloc(sizeof(miOverlayValDataRec));
+ pTree->valdata->oldAbsCorner.x = pWin->drawable.x;
+ pTree->valdata->oldAbsCorner.y = pWin->drawable.y;
+ pTree->valdata->borderVisible = NullRegion;
+}
diff --git a/xorg-server/mi/mioverlay.h b/xorg-server/mi/mioverlay.h
index dca65ad37..f7ed027e9 100644
--- a/xorg-server/mi/mioverlay.h
+++ b/xorg-server/mi/mioverlay.h
@@ -6,27 +6,23 @@
#ifndef __MIOVERLAY_H
#define __MIOVERLAY_H
-typedef void (*miOverlayTransFunc)(ScreenPtr, int, BoxPtr);
-typedef Bool (*miOverlayInOverlayFunc)(WindowPtr);
+typedef void (*miOverlayTransFunc) (ScreenPtr, int, BoxPtr);
+typedef Bool (*miOverlayInOverlayFunc) (WindowPtr);
extern _X_EXPORT Bool
-miInitOverlay(
- ScreenPtr pScreen,
- miOverlayInOverlayFunc inOverlay,
- miOverlayTransFunc trans
-);
+
+miInitOverlay(ScreenPtr pScreen,
+ miOverlayInOverlayFunc inOverlay, miOverlayTransFunc trans);
extern _X_EXPORT Bool
-miOverlayGetPrivateClips(
- WindowPtr pWin,
- RegionPtr *borderClip,
- RegionPtr *clipList
-);
-extern _X_EXPORT Bool miOverlayCollectUnderlayRegions(WindowPtr, RegionPtr*);
+miOverlayGetPrivateClips(WindowPtr pWin,
+ RegionPtr *borderClip, RegionPtr *clipList);
+
+extern _X_EXPORT Bool miOverlayCollectUnderlayRegions(WindowPtr, RegionPtr *);
extern _X_EXPORT void miOverlayComputeCompositeClip(GCPtr, WindowPtr);
extern _X_EXPORT Bool miOverlayCopyUnderlay(ScreenPtr);
extern _X_EXPORT void miOverlaySetTransFunction(ScreenPtr, miOverlayTransFunc);
extern _X_EXPORT void miOverlaySetRootClip(ScreenPtr, Bool);
-#endif /* __MIOVERLAY_H */
+#endif /* __MIOVERLAY_H */
diff --git a/xorg-server/mi/mipointer.c b/xorg-server/mi/mipointer.c
index 998c86c15..de6698a37 100644
--- a/xorg-server/mi/mipointer.c
+++ b/xorg-server/mi/mipointer.c
@@ -50,20 +50,20 @@ in this Software without prior written authorization from The Open Group.
#include <dix-config.h>
#endif
-# include <X11/X.h>
-# include <X11/Xmd.h>
-# include <X11/Xproto.h>
-# include "misc.h"
-# include "windowstr.h"
-# include "pixmapstr.h"
-# include "mi.h"
-# include "scrnintstr.h"
-# include "mipointrst.h"
-# include "cursorstr.h"
-# include "dixstruct.h"
-# include "inputstr.h"
-# include "inpututils.h"
-# include "eventstr.h"
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "mi.h"
+#include "scrnintstr.h"
+#include "mipointrst.h"
+#include "cursorstr.h"
+#include "dixstruct.h"
+#include "inputstr.h"
+#include "inpututils.h"
+#include "eventstr.h"
DevPrivateKeyRec miPointerScreenKeyRec;
@@ -78,56 +78,53 @@ DevPrivateKeyRec miPointerPrivKeyRec;
(miPointerPtr)dixLookupPrivate(&(dev)->devPrivates, miPointerPrivKey): \
(miPointerPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miPointerPrivKey))
-static Bool miPointerRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+static Bool miPointerRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor);
-static Bool miPointerUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+static Bool miPointerUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor);
-static Bool miPointerDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+static Bool miPointerDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor);
static void miPointerConstrainCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
- BoxPtr pBox);
+ BoxPtr pBox);
static void miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen,
- CursorPtr pCursor, BoxPtr pHotBox,
+ CursorPtr pCursor, BoxPtr pHotBox,
BoxPtr pTopLeftBox);
-static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
- int x, int y,
- Bool generateEvent);
+static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y, Bool generateEvent);
static Bool miPointerCloseScreen(int index, ScreenPtr pScreen);
-static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen,
- int x, int y);
+static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
-static void miPointerDeviceCleanup(DeviceIntPtr pDev,
- ScreenPtr pScreen);
-static void miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
+static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
+static void miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x,
+ int y);
-static InternalEvent* events; /* for WarpPointer MotionNotifies */
+static InternalEvent *events; /* for WarpPointer MotionNotifies */
Bool
-miPointerInitialize (ScreenPtr pScreen,
- miPointerSpriteFuncPtr spriteFuncs,
- miPointerScreenFuncPtr screenFuncs,
- Bool waitForUpdate)
+miPointerInitialize(ScreenPtr pScreen,
+ miPointerSpriteFuncPtr spriteFuncs,
+ miPointerScreenFuncPtr screenFuncs, Bool waitForUpdate)
{
- miPointerScreenPtr pScreenPriv;
+ miPointerScreenPtr pScreenPriv;
if (!dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0))
- return FALSE;
+ return FALSE;
- pScreenPriv = malloc(sizeof (miPointerScreenRec));
+ pScreenPriv = malloc(sizeof(miPointerScreenRec));
if (!pScreenPriv)
- return FALSE;
+ return FALSE;
pScreenPriv->spriteFuncs = spriteFuncs;
pScreenPriv->screenFuncs = screenFuncs;
/*
* check for uninitialized methods
*/
if (!screenFuncs->EnqueueEvent)
- screenFuncs->EnqueueEvent = mieqEnqueue;
+ screenFuncs->EnqueueEvent = mieqEnqueue;
if (!screenFuncs->NewEventScreen)
- screenFuncs->NewEventScreen = mieqSwitchScreen;
+ screenFuncs->NewEventScreen = mieqSwitchScreen;
pScreenPriv->waitForUpdate = waitForUpdate;
pScreenPriv->showTransparent = FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
@@ -157,7 +154,7 @@ miPointerInitialize (ScreenPtr pScreen,
* @param pScreen The actual screen pointer
*/
static Bool
-miPointerCloseScreen (int index, ScreenPtr pScreen)
+miPointerCloseScreen(int index, ScreenPtr pScreen)
{
SetupScreen(pScreen);
@@ -173,29 +170,29 @@ miPointerCloseScreen (int index, ScreenPtr pScreen)
*/
static Bool
-miPointerRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+miPointerRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
SetupScreen(pScreen);
return (*pScreenPriv->spriteFuncs->RealizeCursor) (pDev, pScreen, pCursor);
}
static Bool
-miPointerUnrealizeCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor)
+miPointerUnrealizeCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen, CursorPtr pCursor)
{
SetupScreen(pScreen);
- return (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pDev, pScreen, pCursor);
+ return (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pDev, pScreen,
+ pCursor);
}
static Bool
-miPointerDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+miPointerDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
miPointerPtr pPointer;
/* return for keyboards */
if (!IsPointerDevice(pDev))
- return FALSE;
+ return FALSE;
pPointer = MIPOINTER(pDev);
@@ -215,7 +212,7 @@ miPointerDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
* @param pScreen Used for copying screen confinement
*/
static void
-miPointerConstrainCursor (DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
+miPointerConstrainCursor(DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
{
miPointerPtr pPointer;
@@ -268,18 +265,18 @@ static Bool
miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y, Bool generateEvent)
{
- SetupScreen (pScreen);
+ SetupScreen(pScreen);
miPointerPtr pPointer = MIPOINTER(pDev);
pPointer->generateEvent = generateEvent;
if (pScreen->ConstrainCursorHarder)
- pScreen->ConstrainCursorHarder(pDev, pScreen, Absolute, &x, &y);
+ pScreen->ConstrainCursorHarder(pDev, pScreen, Absolute, &x, &y);
/* device dependent - must pend signal and call miPointerWarpCursor */
(*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y);
if (!generateEvent)
- miPointerUpdateSprite(pDev);
+ miPointerUpdateSprite(pDev);
return TRUE;
}
@@ -295,7 +292,8 @@ static Bool
miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
miPointerPtr pPointer;
- SetupScreen (pScreen);
+
+ SetupScreen(pScreen);
pPointer = malloc(sizeof(miPointerRec));
if (!pPointer)
@@ -314,8 +312,7 @@ miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
pPointer->y = 0;
pPointer->generateEvent = FALSE;
- if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen)))
- {
+ if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize) (pDev, pScreen))) {
free(pPointer);
return FALSE;
}
@@ -339,12 +336,11 @@ miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
if (!IsMaster(pDev) && !IsFloating(pDev))
return;
- (*pScreenPriv->spriteFuncs->DeviceCursorCleanup)(pDev, pScreen);
+ (*pScreenPriv->spriteFuncs->DeviceCursorCleanup) (pDev, pScreen);
free(dixLookupPrivate(&pDev->devPrivates, miPointerPrivKey));
dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, NULL);
}
-
/**
* Warp the pointer to the given position on the given screen. May generate
* an event, depending on whether we're coming from miPointerSetPosition.
@@ -358,22 +354,21 @@ miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
*/
void
-miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+miPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
miPointerPtr pPointer;
BOOL changedScreen = FALSE;
- SetupScreen (pScreen);
+ SetupScreen(pScreen);
pPointer = MIPOINTER(pDev);
- if (pPointer->pScreen != pScreen)
- {
- (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, TRUE);
+ if (pPointer->pScreen != pScreen) {
+ (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, TRUE);
changedScreen = TRUE;
}
if (pPointer->generateEvent)
- miPointerMove (pDev, pScreen, x, y);
+ miPointerMove(pDev, pScreen, x, y);
else
miPointerMoveNoEvent(pDev, pScreen, x, y);
@@ -382,10 +377,10 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
* (FDO bug #18668) */
if (changedScreen
#ifdef PANORAMIX
- && noPanoramiXExtension
+ && noPanoramiXExtension
#endif
- )
- UpdateSpriteForScreen (pDev, pScreen) ;
+ )
+ UpdateSpriteForScreen(pDev, pScreen);
}
/**
@@ -394,13 +389,13 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
* @param pDev The device to sync
*/
void
-miPointerUpdateSprite (DeviceIntPtr pDev)
+miPointerUpdateSprite(DeviceIntPtr pDev)
{
- ScreenPtr pScreen;
- miPointerScreenPtr pScreenPriv;
- CursorPtr pCursor;
- int x, y, devx, devy;
- miPointerPtr pPointer;
+ ScreenPtr pScreen;
+ miPointerScreenPtr pScreenPriv;
+ CursorPtr pCursor;
+ int x, y, devx, devy;
+ miPointerPtr pPointer;
if (!pDev || !pDev->coreEvents)
return;
@@ -412,60 +407,57 @@ miPointerUpdateSprite (DeviceIntPtr pDev)
pScreen = pPointer->pScreen;
if (!pScreen)
- return;
+ return;
x = pPointer->x;
y = pPointer->y;
devx = pPointer->devx;
devy = pPointer->devy;
- pScreenPriv = GetScreenPrivate (pScreen);
+ pScreenPriv = GetScreenPrivate(pScreen);
/*
* if the cursor has switched screens, disable the sprite
* on the old screen
*/
- if (pScreen != pPointer->pSpriteScreen)
- {
- if (pPointer->pSpriteScreen)
- {
- miPointerScreenPtr pOldPriv;
-
- pOldPriv = GetScreenPrivate (pPointer->pSpriteScreen);
- if (pPointer->pCursor)
- {
- (*pOldPriv->spriteFuncs->SetCursor)
- (pDev, pPointer->pSpriteScreen, NullCursor, 0, 0);
- }
- (*pOldPriv->screenFuncs->CrossScreen) (pPointer->pSpriteScreen, FALSE);
- }
- (*pScreenPriv->screenFuncs->CrossScreen) (pScreen, TRUE);
- (*pScreenPriv->spriteFuncs->SetCursor)
- (pDev, pScreen, pPointer->pCursor, x, y);
- pPointer->devx = x;
- pPointer->devy = y;
- pPointer->pSpriteCursor = pPointer->pCursor;
- pPointer->pSpriteScreen = pScreen;
+ if (pScreen != pPointer->pSpriteScreen) {
+ if (pPointer->pSpriteScreen) {
+ miPointerScreenPtr pOldPriv;
+
+ pOldPriv = GetScreenPrivate(pPointer->pSpriteScreen);
+ if (pPointer->pCursor) {
+ (*pOldPriv->spriteFuncs->SetCursor)
+ (pDev, pPointer->pSpriteScreen, NullCursor, 0, 0);
+ }
+ (*pOldPriv->screenFuncs->CrossScreen) (pPointer->pSpriteScreen,
+ FALSE);
+ }
+ (*pScreenPriv->screenFuncs->CrossScreen) (pScreen, TRUE);
+ (*pScreenPriv->spriteFuncs->SetCursor)
+ (pDev, pScreen, pPointer->pCursor, x, y);
+ pPointer->devx = x;
+ pPointer->devy = y;
+ pPointer->pSpriteCursor = pPointer->pCursor;
+ pPointer->pSpriteScreen = pScreen;
}
/*
* if the cursor has changed, display the new one
*/
- else if (pPointer->pCursor != pPointer->pSpriteCursor)
- {
- pCursor = pPointer->pCursor;
- if (!pCursor || (pCursor->bits->emptyMask && !pScreenPriv->showTransparent))
- pCursor = NullCursor;
- (*pScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, pCursor, x, y);
-
- pPointer->devx = x;
- pPointer->devy = y;
- pPointer->pSpriteCursor = pPointer->pCursor;
+ else if (pPointer->pCursor != pPointer->pSpriteCursor) {
+ pCursor = pPointer->pCursor;
+ if (!pCursor ||
+ (pCursor->bits->emptyMask && !pScreenPriv->showTransparent))
+ pCursor = NullCursor;
+ (*pScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, pCursor, x, y);
+
+ pPointer->devx = x;
+ pPointer->devy = y;
+ pPointer->pSpriteCursor = pPointer->pCursor;
}
- else if (x != devx || y != devy)
- {
- pPointer->devx = x;
- pPointer->devy = y;
- if(pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
- (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
+ else if (x != devx || y != devy) {
+ pPointer->devx = x;
+ pPointer->devy = y;
+ if (pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
}
}
@@ -480,26 +472,26 @@ miPointerUpdateSprite (DeviceIntPtr pDev)
void
miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
{
- miPointerScreenPtr pScreenPriv;
- ScreenPtr pScreen;
- miPointerPtr pPointer;
+ miPointerScreenPtr pScreenPriv;
+ ScreenPtr pScreen;
+ miPointerPtr pPointer;
- pPointer = MIPOINTER(pDev);
+ pPointer = MIPOINTER(pDev);
- pScreen = screenInfo.screens[screen_no];
- pScreenPriv = GetScreenPrivate (pScreen);
- (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, FALSE);
- NewCurrentScreen (pDev, pScreen, x, y);
+ pScreen = screenInfo.screens[screen_no];
+ pScreenPriv = GetScreenPrivate(pScreen);
+ (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, FALSE);
+ NewCurrentScreen(pDev, pScreen, x, y);
- pPointer->limits.x2 = pScreen->width;
- pPointer->limits.y2 = pScreen->height;
+ pPointer->limits.x2 = pScreen->width;
+ pPointer->limits.y2 = pScreen->height;
}
/**
* @return The current screen of the VCP
*/
ScreenPtr
-miPointerCurrentScreen (void)
+miPointerCurrentScreen(void)
{
return miPointerGetScreen(inputInfo.pointer);
}
@@ -511,6 +503,7 @@ ScreenPtr
miPointerGetScreen(DeviceIntPtr pDev)
{
miPointerPtr pPointer = MIPOINTER(pDev);
+
return (pPointer) ? pPointer->pScreen : NULL;
}
@@ -529,13 +522,12 @@ miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait)
return prevWait;
}
-
/* Move the pointer on the current screen, and update the sprite. */
static void
-miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
- int x, int y)
+miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
miPointerPtr pPointer;
+
SetupScreen(pScreen);
pPointer = MIPOINTER(pDev);
@@ -545,12 +537,11 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
* SIGIO. This again leads to allocs during SIGIO which leads to SIGABRT.
*/
if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer
- && !pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen)
- {
- pPointer->devx = x;
- pPointer->devy = y;
- if(pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
- (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
+ &&!pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen) {
+ pPointer->devx = x;
+ pPointer->devy = y;
+ if (pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
}
pPointer->x = x;
@@ -573,15 +564,16 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
* @param[in,out] screeny The y coordinate in desktop coordinates
*/
ScreenPtr
-miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, double *screeny)
+miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
+ double *screeny)
{
- miPointerScreenPtr pScreenPriv;
- ScreenPtr pScreen;
- ScreenPtr newScreen;
- int x, y;
- Bool switch_screen = FALSE;
+ miPointerScreenPtr pScreenPriv;
+ ScreenPtr pScreen;
+ ScreenPtr newScreen;
+ int x, y;
+ Bool switch_screen = FALSE;
- miPointerPtr pPointer;
+ miPointerPtr pPointer;
if (!pDev || !pDev->coreEvents)
return NULL;
@@ -589,7 +581,7 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, double *scree
pPointer = MIPOINTER(pDev);
pScreen = pPointer->pScreen;
if (!pScreen)
- return NULL; /* called before ready */
+ return NULL; /* called before ready */
x = trunc(*screenx);
y = trunc(*screeny);
@@ -601,39 +593,35 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, double *scree
x -= pScreen->x;
y -= pScreen->y;
- if (switch_screen)
- {
- pScreenPriv = GetScreenPrivate (pScreen);
- if (!pPointer->confined)
- {
- newScreen = pScreen;
- (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y);
- if (newScreen != pScreen)
- {
- pScreen = newScreen;
- (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen,
- FALSE);
- /* Smash the confine to the new screen */
+ if (switch_screen) {
+ pScreenPriv = GetScreenPrivate(pScreen);
+ if (!pPointer->confined) {
+ newScreen = pScreen;
+ (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y);
+ if (newScreen != pScreen) {
+ pScreen = newScreen;
+ (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen,
+ FALSE);
+ /* Smash the confine to the new screen */
pPointer->limits.x2 = pScreen->width;
pPointer->limits.y2 = pScreen->height;
- }
- }
+ }
+ }
}
/* Constrain the sprite to the current limits. */
if (x < pPointer->limits.x1)
- x = pPointer->limits.x1;
+ x = pPointer->limits.x1;
if (x >= pPointer->limits.x2)
- x = pPointer->limits.x2 - 1;
+ x = pPointer->limits.x2 - 1;
if (y < pPointer->limits.y1)
- y = pPointer->limits.y1;
+ y = pPointer->limits.y1;
if (y >= pPointer->limits.y2)
- y = pPointer->limits.y2 - 1;
+ y = pPointer->limits.y2 - 1;
if (pScreen->ConstrainCursorHarder)
- pScreen->ConstrainCursorHarder(pDev, pScreen, mode, &x, &y);
+ pScreen->ConstrainCursorHarder(pDev, pScreen, mode, &x, &y);
- if (pPointer->x != x || pPointer->y != y ||
- pPointer->pScreen != pScreen)
+ if (pPointer->x != x || pPointer->y != y || pPointer->pScreen != pScreen)
miPointerMoveNoEvent(pDev, pScreen, x, y);
/* Convert to desktop coordinates again */
@@ -681,7 +669,7 @@ void darwinEvents_unlock(void);
* @param y The y coordinate in per-screen coordinates
*/
void
-miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
int i, nevents;
int valuators[2];
@@ -693,12 +681,10 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
valuators[0] = x;
valuators[1] = y;
- if (!events)
- {
+ if (!events) {
events = InitEventList(GetMaximumEventsNum());
- if (!events)
- {
+ if (!events) {
FatalError("Could not allocate event store.\n");
return;
}
@@ -706,7 +692,8 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
valuator_mask_set_range(&mask, 0, 2, valuators);
nevents = GetPointerEvents(events, pDev, MotionNotify, 0,
- POINTER_SCREEN | POINTER_ABSOLUTE | POINTER_NORAW, &mask);
+ POINTER_SCREEN | POINTER_ABSOLUTE |
+ POINTER_NORAW, &mask);
OsBlockSignals();
#ifdef XQUARTZ
diff --git a/xorg-server/mi/mipointer.h b/xorg-server/mi/mipointer.h
index 45abb5b56..1500e216a 100644
--- a/xorg-server/mi/mipointer.h
+++ b/xorg-server/mi/mipointer.h
@@ -31,124 +31,105 @@ in this Software without prior written authorization from The Open Group.
#include "privates.h"
typedef struct _miPointerSpriteFuncRec {
- Bool (*RealizeCursor)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */,
- CursorPtr /* pCurs */
- );
- Bool (*UnrealizeCursor)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */,
- CursorPtr /* pCurs */
- );
- void (*SetCursor)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */,
- CursorPtr /* pCurs */,
- int /* x */,
- int /* y */
- );
- void (*MoveCursor)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */,
- int /* x */,
- int /* y */
- );
- Bool (*DeviceCursorInitialize)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */
- );
- void (*DeviceCursorCleanup)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */
- );
+ Bool (*RealizeCursor) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /* pScr */ ,
+ CursorPtr /* pCurs */
+ );
+ Bool (*UnrealizeCursor) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /* pScr */ ,
+ CursorPtr /* pCurs */
+ );
+ void (*SetCursor) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /* pScr */ ,
+ CursorPtr /* pCurs */ ,
+ int /* x */ ,
+ int /* y */
+ );
+ void (*MoveCursor) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /* pScr */ ,
+ int /* x */ ,
+ int /* y */
+ );
+ Bool (*DeviceCursorInitialize) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /* pScr */
+ );
+ void (*DeviceCursorCleanup) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /* pScr */
+ );
} miPointerSpriteFuncRec, *miPointerSpriteFuncPtr;
typedef struct _miPointerScreenFuncRec {
- Bool (*CursorOffScreen)(
- ScreenPtr* /* ppScr */,
- int* /* px */,
- int* /* py */
- );
- void (*CrossScreen)(
- ScreenPtr /* pScr */,
- int /* entering */
- );
- void (*WarpCursor)(
- DeviceIntPtr /*pDev*/,
- ScreenPtr /* pScr */,
- int /* x */,
- int /* y */
- );
- void (*EnqueueEvent)(
- DeviceIntPtr /* pDev */,
- InternalEvent* /* event */
- );
- void (*NewEventScreen)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */,
- Bool /* set_dequeue_screen */
- );
+ Bool (*CursorOffScreen) (ScreenPtr * /* ppScr */ ,
+ int * /* px */ ,
+ int * /* py */
+ );
+ void (*CrossScreen) (ScreenPtr /* pScr */ ,
+ int /* entering */
+ );
+ void (*WarpCursor) (DeviceIntPtr /*pDev */ ,
+ ScreenPtr /* pScr */ ,
+ int /* x */ ,
+ int /* y */
+ );
+ void (*EnqueueEvent) (DeviceIntPtr /* pDev */ ,
+ InternalEvent * /* event */
+ );
+ void (*NewEventScreen) (DeviceIntPtr /* pDev */ ,
+ ScreenPtr /* pScr */ ,
+ Bool /* set_dequeue_screen */
+ );
} miPointerScreenFuncRec, *miPointerScreenFuncPtr;
-extern _X_EXPORT Bool miDCInitialize(
- ScreenPtr /*pScreen*/,
- miPointerScreenFuncPtr /*screenFuncs*/
-);
-
-extern _X_EXPORT Bool miPointerInitialize(
- ScreenPtr /*pScreen*/,
- miPointerSpriteFuncPtr /*spriteFuncs*/,
- miPointerScreenFuncPtr /*screenFuncs*/,
- Bool /*waitForUpdate*/
-);
-
-extern _X_EXPORT void miPointerWarpCursor(
- DeviceIntPtr /*pDev*/,
- ScreenPtr /*pScreen*/,
- int /*x*/,
- int /*y*/
-);
+extern _X_EXPORT Bool miDCInitialize(ScreenPtr /*pScreen */ ,
+ miPointerScreenFuncPtr /*screenFuncs */
+ );
+
+extern _X_EXPORT Bool miPointerInitialize(ScreenPtr /*pScreen */ ,
+ miPointerSpriteFuncPtr
+ /*spriteFuncs */ ,
+ miPointerScreenFuncPtr
+ /*screenFuncs */ ,
+ Bool /*waitForUpdate */
+ );
+
+extern _X_EXPORT void miPointerWarpCursor(DeviceIntPtr /*pDev */ ,
+ ScreenPtr /*pScreen */ ,
+ int /*x */ ,
+ int /*y */
+ );
/* Deprecated in favour of miPointerGetScreen. */
-extern _X_EXPORT ScreenPtr miPointerCurrentScreen(
- void
+extern _X_EXPORT ScreenPtr
+miPointerCurrentScreen(void
) _X_DEPRECATED;
-extern _X_EXPORT ScreenPtr miPointerGetScreen(
- DeviceIntPtr pDev);
-extern _X_EXPORT void miPointerSetScreen(
- DeviceIntPtr pDev,
- int screen_num,
- int x,
- int y);
+extern _X_EXPORT ScreenPtr
+miPointerGetScreen(DeviceIntPtr pDev);
+extern _X_EXPORT void
+miPointerSetScreen(DeviceIntPtr pDev, int screen_num, int x, int y);
/* Returns the current cursor position. */
-extern _X_EXPORT void miPointerGetPosition(
- DeviceIntPtr pDev,
- int *x,
- int *y);
+extern _X_EXPORT void
+miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y);
/* Moves the cursor to the specified position. May clip the co-ordinates:
* x and y are modified in-place. */
-extern _X_EXPORT ScreenPtr miPointerSetPosition(
- DeviceIntPtr pDev,
- int mode,
- double *x,
- double *y);
+extern _X_EXPORT ScreenPtr
+miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y);
-extern _X_EXPORT void miPointerUpdateSprite(
- DeviceIntPtr pDev);
+extern _X_EXPORT void
+miPointerUpdateSprite(DeviceIntPtr pDev);
/* Sets whether the sprite should be updated immediately on pointer moves */
-extern _X_EXPORT Bool miPointerSetWaitForUpdate(
- ScreenPtr pScreen,
- Bool wait);
+extern _X_EXPORT Bool
+miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait);
extern _X_EXPORT DevPrivateKeyRec miPointerPrivKeyRec;
+
#define miPointerPrivKey (&miPointerPrivKeyRec)
extern _X_EXPORT DevPrivateKeyRec miPointerScreenKeyRec;
+
#define miPointerScreenKey (&miPointerScreenKeyRec)
-#endif /* MIPOINTER_H */
+#endif /* MIPOINTER_H */
diff --git a/xorg-server/mi/mipoly.c b/xorg-server/mi/mipoly.c
index b3e2c2fb1..07d981845 100644
--- a/xorg-server/mi/mipoly.c
+++ b/xorg-server/mi/mipoly.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -65,60 +64,50 @@ SOFTWARE.
#include "mi.h"
#include "regionstr.h"
-
void
-miFillPolygon( DrawablePtr dst, GCPtr pgc,
- int shape, int mode,
- int count, DDXPointPtr pPts)
+miFillPolygon(DrawablePtr dst, GCPtr pgc,
+ int shape, int mode, int count, DDXPointPtr pPts)
{
- int i;
- int xorg, yorg;
- DDXPointPtr ppt;
+ int i;
+ int xorg, yorg;
+ DDXPointPtr ppt;
if (count == 0)
- return;
+ return;
ppt = pPts;
- if (pgc->miTranslate)
- {
- xorg = dst->x;
- yorg = dst->y;
-
- if (mode == CoordModeOrigin)
- {
- for (i = 0; i<count; i++)
- {
- ppt->x += xorg;
- ppt++->y += yorg;
- }
+ if (pgc->miTranslate) {
+ xorg = dst->x;
+ yorg = dst->y;
+
+ if (mode == CoordModeOrigin) {
+ for (i = 0; i < count; i++) {
+ ppt->x += xorg;
+ ppt++->y += yorg;
+ }
}
- else
- {
- ppt->x += xorg;
- ppt++->y += yorg;
- for (i = 1; i<count; i++)
- {
- ppt->x += (ppt-1)->x;
- ppt->y += (ppt-1)->y;
- ppt++;
- }
+ else {
+ ppt->x += xorg;
+ ppt++->y += yorg;
+ for (i = 1; i < count; i++) {
+ ppt->x += (ppt - 1)->x;
+ ppt->y += (ppt - 1)->y;
+ ppt++;
+ }
}
}
- else
- {
- if (mode == CoordModePrevious)
- {
- ppt++;
- for (i = 1; i<count; i++)
- {
- ppt->x += (ppt-1)->x;
- ppt->y += (ppt-1)->y;
- ppt++;
- }
+ else {
+ if (mode == CoordModePrevious) {
+ ppt++;
+ for (i = 1; i < count; i++) {
+ ppt->x += (ppt - 1)->x;
+ ppt->y += (ppt - 1)->y;
+ ppt++;
+ }
}
}
if (shape == Convex)
- miFillConvexPoly(dst, pgc, count, pPts);
+ miFillConvexPoly(dst, pgc, count, pPts);
else
- miFillGeneralPoly(dst, pgc, count, pPts);
+ miFillGeneralPoly(dst, pgc, count, pPts);
}
diff --git a/xorg-server/mi/mipoly.h b/xorg-server/mi/mipoly.h
index d94796e2f..e37fb48a2 100644
--- a/xorg-server/mi/mipoly.h
+++ b/xorg-server/mi/mipoly.h
@@ -26,7 +26,6 @@ from The Open Group.
*/
-
/*
* fill.h
*
@@ -83,32 +82,29 @@ from The Open Group.
* for the winding number rule
*/
#define CLOCKWISE 1
-#define COUNTERCLOCKWISE -1
+#define COUNTERCLOCKWISE -1
typedef struct _EdgeTableEntry {
- int ymax; /* ycoord at which we exit this edge. */
- BRESINFO bres; /* Bresenham info to run the edge */
- struct _EdgeTableEntry *next; /* next in the list */
- struct _EdgeTableEntry *back; /* for insertion sort */
- struct _EdgeTableEntry *nextWETE; /* for winding num rule */
- int ClockWise; /* flag for winding number rule */
+ int ymax; /* ycoord at which we exit this edge. */
+ BRESINFO bres; /* Bresenham info to run the edge */
+ struct _EdgeTableEntry *next; /* next in the list */
+ struct _EdgeTableEntry *back; /* for insertion sort */
+ struct _EdgeTableEntry *nextWETE; /* for winding num rule */
+ int ClockWise; /* flag for winding number rule */
} EdgeTableEntry;
-
-typedef struct _ScanLineList{
- int scanline; /* the scanline represented */
- EdgeTableEntry *edgelist; /* header node */
- struct _ScanLineList *next; /* next in the list */
+typedef struct _ScanLineList {
+ int scanline; /* the scanline represented */
+ EdgeTableEntry *edgelist; /* header node */
+ struct _ScanLineList *next; /* next in the list */
} ScanLineList;
-
typedef struct {
- int ymax; /* ymax for the polygon */
- int ymin; /* ymin for the polygon */
- ScanLineList scanlines; /* header node */
+ int ymax; /* ymax for the polygon */
+ int ymin; /* ymin for the polygon */
+ ScanLineList scanlines; /* header node */
} EdgeTable;
-
/*
* Here is a struct to help with storage allocation
* so we can allocate a big chunk at a time, and then take
@@ -117,8 +113,8 @@ typedef struct {
#define SLLSPERBLOCK 25
typedef struct _ScanLineListBlock {
- ScanLineList SLLs[SLLSPERBLOCK];
- struct _ScanLineListBlock *next;
+ ScanLineList SLLs[SLLSPERBLOCK];
+ struct _ScanLineListBlock *next;
} ScanLineListBlock;
/*
@@ -126,7 +122,6 @@ typedef struct _ScanLineListBlock {
* to scanlines() : Must be an even number
*/
#define NUMPTSTOBUFFER 200
-
/*
*
@@ -156,7 +151,6 @@ typedef struct _ScanLineListBlock {
} \
}
-
/*
* Evaluate the given edge at the given scanline.
* If the edge has expired, then we leave it and fix up
@@ -180,28 +174,20 @@ typedef struct _ScanLineListBlock {
/* mipolyutil.c */
-extern _X_EXPORT Bool miCreateETandAET(
- int /*count*/,
- DDXPointPtr /*pts*/,
- EdgeTable * /*ET*/,
- EdgeTableEntry * /*AET*/,
- EdgeTableEntry * /*pETEs*/,
- ScanLineListBlock * /*pSLLBlock*/
-);
-
-extern _X_EXPORT void miloadAET(
- EdgeTableEntry * /*AET*/,
- EdgeTableEntry * /*ETEs*/
-);
-
-extern _X_EXPORT void micomputeWAET(
- EdgeTableEntry * /*AET*/
-);
-
-extern _X_EXPORT int miInsertionSort(
- EdgeTableEntry * /*AET*/
-);
-
-extern _X_EXPORT void miFreeStorage(
- ScanLineListBlock * /*pSLLBlock*/
-);
+extern _X_EXPORT Bool miCreateETandAET(int /*count */ ,
+ DDXPointPtr /*pts */ ,
+ EdgeTable * /*ET*/,
+ EdgeTableEntry * /*AET*/,
+ EdgeTableEntry * /*pETEs */ ,
+ ScanLineListBlock * /*pSLLBlock */
+ );
+
+extern _X_EXPORT void miloadAET(EdgeTableEntry * /*AET*/, EdgeTableEntry * /*ETEs */
+ );
+
+extern _X_EXPORT void micomputeWAET(EdgeTableEntry * /*AET*/);
+
+extern _X_EXPORT int miInsertionSort(EdgeTableEntry * /*AET*/);
+
+extern _X_EXPORT void miFreeStorage(ScanLineListBlock * /*pSLLBlock */
+ );
diff --git a/xorg-server/mi/mipolycon.c b/xorg-server/mi/mipolycon.c
index 7c9b47747..e831633fe 100644
--- a/xorg-server/mi/mipolycon.c
+++ b/xorg-server/mi/mipolycon.c
@@ -1,247 +1,235 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "gcstruct.h"
-#include "pixmap.h"
-#include "mi.h"
-#include "miscanfill.h"
-
-static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty);
-
-/*
- * convexpoly.c
- *
- * Written by Brian Kelleher; Dec. 1985.
- *
- * Fill a convex polygon. If the given polygon
- * is not convex, then the result is undefined.
- * The algorithm is to order the edges from smallest
- * y to largest by partitioning the array into a left
- * edge list and a right edge list. The algorithm used
- * to traverse each edge is an extension of Bresenham's
- * line algorithm with y as the major axis.
- * For a derivation of the algorithm, see the author of
- * this code.
- */
-Bool
-miFillConvexPoly(
- DrawablePtr dst,
- GCPtr pgc,
- int count, /* number of points */
- DDXPointPtr ptsIn /* the points */
- )
-{
- int xl = 0, xr = 0; /* x vals of left and right edges */
- int dl = 0, dr = 0; /* decision variables */
- int ml = 0, m1l = 0;/* left edge slope and slope+1 */
- int mr = 0, m1r = 0; /* right edge slope and slope+1 */
- int incr1l = 0, incr2l = 0; /* left edge error increments */
- int incr1r = 0, incr2r = 0; /* right edge error increments */
- int dy; /* delta y */
- int y; /* current scanline */
- int left, right; /* indices to first endpoints */
- int i; /* loop counter */
- int nextleft, nextright; /* indices to second endpoints */
- DDXPointPtr ptsOut, FirstPoint; /* output buffer */
- int *width, *FirstWidth; /* output buffer */
- int imin; /* index of smallest vertex (in y) */
- int ymin; /* y-extents of polygon */
- int ymax;
-
- /*
- * find leftx, bottomy, rightx, topy, and the index
- * of bottomy. Also translate the points.
- */
- imin = getPolyYBounds(ptsIn, count, &ymin, &ymax);
-
- dy = ymax - ymin + 1;
- if ((count < 3) || (dy < 0))
- return TRUE;
- ptsOut = FirstPoint = malloc(sizeof(DDXPointRec)*dy);
- width = FirstWidth = malloc(sizeof(int) * dy);
- if(!FirstPoint || !FirstWidth)
- {
- free(FirstWidth);
- free(FirstPoint);
- return FALSE;
- }
-
- nextleft = nextright = imin;
- y = ptsIn[nextleft].y;
-
- /*
- * loop through all edges of the polygon
- */
- do {
- /*
- * add a left edge if we need to
- */
- if (ptsIn[nextleft].y == y) {
- left = nextleft;
-
- /*
- * find the next edge, considering the end
- * conditions of the array.
- */
- nextleft++;
- if (nextleft >= count)
- nextleft = 0;
-
- /*
- * now compute all of the random information
- * needed to run the iterative algorithm.
- */
- BRESINITPGON(ptsIn[nextleft].y-ptsIn[left].y,
- ptsIn[left].x,ptsIn[nextleft].x,
- xl, dl, ml, m1l, incr1l, incr2l);
- }
-
- /*
- * add a right edge if we need to
- */
- if (ptsIn[nextright].y == y) {
- right = nextright;
-
- /*
- * find the next edge, considering the end
- * conditions of the array.
- */
- nextright--;
- if (nextright < 0)
- nextright = count-1;
-
- /*
- * now compute all of the random information
- * needed to run the iterative algorithm.
- */
- BRESINITPGON(ptsIn[nextright].y-ptsIn[right].y,
- ptsIn[right].x,ptsIn[nextright].x,
- xr, dr, mr, m1r, incr1r, incr2r);
- }
-
- /*
- * generate scans to fill while we still have
- * a right edge as well as a left edge.
- */
- i = min(ptsIn[nextleft].y, ptsIn[nextright].y) - y;
- /* in case we're called with non-convex polygon */
- if(i < 0)
- {
- free(FirstWidth);
- free(FirstPoint);
- return TRUE;
- }
- while (i-- > 0)
- {
- ptsOut->y = y;
-
- /*
- * reverse the edges if necessary
- */
- if (xl < xr)
- {
- *(width++) = xr - xl;
- (ptsOut++)->x = xl;
- }
- else
- {
- *(width++) = xl - xr;
- (ptsOut++)->x = xr;
- }
- y++;
-
- /* increment down the edges */
- BRESINCRPGON(dl, xl, ml, m1l, incr1l, incr2l);
- BRESINCRPGON(dr, xr, mr, m1r, incr1r, incr2r);
- }
- } while (y != ymax);
-
- /*
- * Finally, fill the <remaining> spans
- */
- (*pgc->ops->FillSpans)(dst, pgc,
- ptsOut-FirstPoint,FirstPoint,FirstWidth,
- 1);
- free(FirstWidth);
- free(FirstPoint);
- return TRUE;
-}
-
-
-/*
- * Find the index of the point with the smallest y.
- */
-static int
-getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty)
-{
- DDXPointPtr ptMin;
- int ymin, ymax;
- DDXPointPtr ptsStart = pts;
-
- ptMin = pts;
- ymin = ymax = (pts++)->y;
-
- while (--n > 0) {
- if (pts->y < ymin)
- {
- ptMin = pts;
- ymin = pts->y;
- }
- if(pts->y > ymax)
- ymax = pts->y;
-
- pts++;
- }
-
- *by = ymin;
- *ty = ymax;
- return ptMin-ptsStart;
-}
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "gcstruct.h"
+#include "pixmap.h"
+#include "mi.h"
+#include "miscanfill.h"
+
+static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty);
+
+/*
+ * convexpoly.c
+ *
+ * Written by Brian Kelleher; Dec. 1985.
+ *
+ * Fill a convex polygon. If the given polygon
+ * is not convex, then the result is undefined.
+ * The algorithm is to order the edges from smallest
+ * y to largest by partitioning the array into a left
+ * edge list and a right edge list. The algorithm used
+ * to traverse each edge is an extension of Bresenham's
+ * line algorithm with y as the major axis.
+ * For a derivation of the algorithm, see the author of
+ * this code.
+ */
+Bool
+miFillConvexPoly(DrawablePtr dst, GCPtr pgc, int count, /* number of points */
+ DDXPointPtr ptsIn /* the points */
+ )
+{
+ int xl = 0, xr = 0; /* x vals of left and right edges */
+ int dl = 0, dr = 0; /* decision variables */
+ int ml = 0, m1l = 0; /* left edge slope and slope+1 */
+ int mr = 0, m1r = 0; /* right edge slope and slope+1 */
+ int incr1l = 0, incr2l = 0; /* left edge error increments */
+ int incr1r = 0, incr2r = 0; /* right edge error increments */
+ int dy; /* delta y */
+ int y; /* current scanline */
+ int left, right; /* indices to first endpoints */
+ int i; /* loop counter */
+ int nextleft, nextright; /* indices to second endpoints */
+ DDXPointPtr ptsOut, FirstPoint; /* output buffer */
+ int *width, *FirstWidth; /* output buffer */
+ int imin; /* index of smallest vertex (in y) */
+ int ymin; /* y-extents of polygon */
+ int ymax;
+
+ /*
+ * find leftx, bottomy, rightx, topy, and the index
+ * of bottomy. Also translate the points.
+ */
+ imin = getPolyYBounds(ptsIn, count, &ymin, &ymax);
+
+ dy = ymax - ymin + 1;
+ if ((count < 3) || (dy < 0))
+ return TRUE;
+ ptsOut = FirstPoint = malloc(sizeof(DDXPointRec) * dy);
+ width = FirstWidth = malloc(sizeof(int) * dy);
+ if (!FirstPoint || !FirstWidth) {
+ free(FirstWidth);
+ free(FirstPoint);
+ return FALSE;
+ }
+
+ nextleft = nextright = imin;
+ y = ptsIn[nextleft].y;
+
+ /*
+ * loop through all edges of the polygon
+ */
+ do {
+ /*
+ * add a left edge if we need to
+ */
+ if (ptsIn[nextleft].y == y) {
+ left = nextleft;
+
+ /*
+ * find the next edge, considering the end
+ * conditions of the array.
+ */
+ nextleft++;
+ if (nextleft >= count)
+ nextleft = 0;
+
+ /*
+ * now compute all of the random information
+ * needed to run the iterative algorithm.
+ */
+ BRESINITPGON(ptsIn[nextleft].y - ptsIn[left].y,
+ ptsIn[left].x, ptsIn[nextleft].x,
+ xl, dl, ml, m1l, incr1l, incr2l);
+ }
+
+ /*
+ * add a right edge if we need to
+ */
+ if (ptsIn[nextright].y == y) {
+ right = nextright;
+
+ /*
+ * find the next edge, considering the end
+ * conditions of the array.
+ */
+ nextright--;
+ if (nextright < 0)
+ nextright = count - 1;
+
+ /*
+ * now compute all of the random information
+ * needed to run the iterative algorithm.
+ */
+ BRESINITPGON(ptsIn[nextright].y - ptsIn[right].y,
+ ptsIn[right].x, ptsIn[nextright].x,
+ xr, dr, mr, m1r, incr1r, incr2r);
+ }
+
+ /*
+ * generate scans to fill while we still have
+ * a right edge as well as a left edge.
+ */
+ i = min(ptsIn[nextleft].y, ptsIn[nextright].y) - y;
+ /* in case we're called with non-convex polygon */
+ if (i < 0) {
+ free(FirstWidth);
+ free(FirstPoint);
+ return TRUE;
+ }
+ while (i-- > 0) {
+ ptsOut->y = y;
+
+ /*
+ * reverse the edges if necessary
+ */
+ if (xl < xr) {
+ *(width++) = xr - xl;
+ (ptsOut++)->x = xl;
+ }
+ else {
+ *(width++) = xl - xr;
+ (ptsOut++)->x = xr;
+ }
+ y++;
+
+ /* increment down the edges */
+ BRESINCRPGON(dl, xl, ml, m1l, incr1l, incr2l);
+ BRESINCRPGON(dr, xr, mr, m1r, incr1r, incr2r);
+ }
+ } while (y != ymax);
+
+ /*
+ * Finally, fill the <remaining> spans
+ */
+ (*pgc->ops->FillSpans) (dst, pgc,
+ ptsOut - FirstPoint, FirstPoint, FirstWidth, 1);
+ free(FirstWidth);
+ free(FirstPoint);
+ return TRUE;
+}
+
+/*
+ * Find the index of the point with the smallest y.
+ */
+static int
+getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty)
+{
+ DDXPointPtr ptMin;
+ int ymin, ymax;
+ DDXPointPtr ptsStart = pts;
+
+ ptMin = pts;
+ ymin = ymax = (pts++)->y;
+
+ while (--n > 0) {
+ if (pts->y < ymin) {
+ ptMin = pts;
+ ymin = pts->y;
+ }
+ if (pts->y > ymax)
+ ymax = pts->y;
+
+ pts++;
+ }
+
+ *by = ymin;
+ *ty = ymax;
+ return ptMin - ptsStart;
+}
diff --git a/xorg-server/mi/mipolygen.c b/xorg-server/mi/mipolygen.c
index ce65ca370..2031b42b7 100644
--- a/xorg-server/mi/mipolygen.c
+++ b/xorg-server/mi/mipolygen.c
@@ -1,230 +1,213 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "gcstruct.h"
-#include "miscanfill.h"
-#include "mipoly.h"
-#include "pixmap.h"
-#include "mi.h"
-
-/*
- *
- * Written by Brian Kelleher; Oct. 1985
- *
- * Routine to fill a polygon. Two fill rules are
- * supported: frWINDING and frEVENODD.
- *
- * See fillpoly.h for a complete description of the algorithm.
- */
-
-Bool
-miFillGeneralPoly(
- DrawablePtr dst,
- GCPtr pgc,
- int count, /* number of points */
- DDXPointPtr ptsIn /* the points */
- )
-{
- EdgeTableEntry *pAET; /* the Active Edge Table */
- int y; /* the current scanline */
- int nPts = 0; /* number of pts in buffer */
- EdgeTableEntry *pWETE; /* Winding Edge Table */
- ScanLineList *pSLL; /* Current ScanLineList */
- DDXPointPtr ptsOut; /* ptr to output buffers */
- int *width;
- DDXPointRec FirstPoint[NUMPTSTOBUFFER]; /* the output buffers */
- int FirstWidth[NUMPTSTOBUFFER];
- EdgeTableEntry *pPrevAET; /* previous AET entry */
- EdgeTable ET; /* Edge Table header node */
- EdgeTableEntry AET; /* Active ET header node */
- EdgeTableEntry *pETEs; /* Edge Table Entries buff */
- ScanLineListBlock SLLBlock; /* header for ScanLineList */
- int fixWAET = 0;
-
- if (count < 3)
- return TRUE;
-
- if(!(pETEs = malloc(sizeof(EdgeTableEntry) * count)))
- return FALSE;
- ptsOut = FirstPoint;
- width = FirstWidth;
- if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock))
- {
- free(pETEs);
- return FALSE;
- }
- pSLL = ET.scanlines.next;
-
- if (pgc->fillRule == EvenOddRule)
- {
- /*
- * for each scanline
- */
- for (y = ET.ymin; y < ET.ymax; y++)
- {
- /*
- * Add a new edge to the active edge table when we
- * get to the next edge.
- */
- if (pSLL && y == pSLL->scanline)
- {
- miloadAET(&AET, pSLL->edgelist);
- pSLL = pSLL->next;
- }
- pPrevAET = &AET;
- pAET = AET.next;
-
- /*
- * for each active edge
- */
- while (pAET)
- {
- ptsOut->x = pAET->bres.minor;
- ptsOut++->y = y;
- *width++ = pAET->next->bres.minor - pAET->bres.minor;
- nPts++;
-
- /*
- * send out the buffer when its full
- */
- if (nPts == NUMPTSTOBUFFER)
- {
- (*pgc->ops->FillSpans)(dst, pgc,
- nPts, FirstPoint, FirstWidth,
- 1);
- ptsOut = FirstPoint;
- width = FirstWidth;
- nPts = 0;
- }
- EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
- EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
- }
- miInsertionSort(&AET);
- }
- }
- else /* default to WindingNumber */
- {
- /*
- * for each scanline
- */
- for (y = ET.ymin; y < ET.ymax; y++)
- {
- /*
- * Add a new edge to the active edge table when we
- * get to the next edge.
- */
- if (pSLL && y == pSLL->scanline)
- {
- miloadAET(&AET, pSLL->edgelist);
- micomputeWAET(&AET);
- pSLL = pSLL->next;
- }
- pPrevAET = &AET;
- pAET = AET.next;
- pWETE = pAET;
-
- /*
- * for each active edge
- */
- while (pAET)
- {
- /*
- * if the next edge in the active edge table is
- * also the next edge in the winding active edge
- * table.
- */
- if (pWETE == pAET)
- {
- ptsOut->x = pAET->bres.minor;
- ptsOut++->y = y;
- *width++ = pAET->nextWETE->bres.minor - pAET->bres.minor;
- nPts++;
-
- /*
- * send out the buffer
- */
- if (nPts == NUMPTSTOBUFFER)
- {
- (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint,
- FirstWidth, 1);
- ptsOut = FirstPoint;
- width = FirstWidth;
- nPts = 0;
- }
-
- pWETE = pWETE->nextWETE;
- while (pWETE != pAET)
- EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
- pWETE = pWETE->nextWETE;
- }
- EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
- }
-
- /*
- * reevaluate the Winding active edge table if we
- * just had to resort it or if we just exited an edge.
- */
- if (miInsertionSort(&AET) || fixWAET)
- {
- micomputeWAET(&AET);
- fixWAET = 0;
- }
- }
- }
-
- /*
- * Get any spans that we missed by buffering
- */
- (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1);
- free(pETEs);
- miFreeStorage(SLLBlock.next);
- return TRUE;
-}
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include "gcstruct.h"
+#include "miscanfill.h"
+#include "mipoly.h"
+#include "pixmap.h"
+#include "mi.h"
+
+/*
+ *
+ * Written by Brian Kelleher; Oct. 1985
+ *
+ * Routine to fill a polygon. Two fill rules are
+ * supported: frWINDING and frEVENODD.
+ *
+ * See fillpoly.h for a complete description of the algorithm.
+ */
+
+Bool
+miFillGeneralPoly(DrawablePtr dst, GCPtr pgc, int count, /* number of points */
+ DDXPointPtr ptsIn /* the points */
+ )
+{
+ EdgeTableEntry *pAET; /* the Active Edge Table */
+ int y; /* the current scanline */
+ int nPts = 0; /* number of pts in buffer */
+ EdgeTableEntry *pWETE; /* Winding Edge Table */
+ ScanLineList *pSLL; /* Current ScanLineList */
+ DDXPointPtr ptsOut; /* ptr to output buffers */
+ int *width;
+ DDXPointRec FirstPoint[NUMPTSTOBUFFER]; /* the output buffers */
+ int FirstWidth[NUMPTSTOBUFFER];
+ EdgeTableEntry *pPrevAET; /* previous AET entry */
+ EdgeTable ET; /* Edge Table header node */
+ EdgeTableEntry AET; /* Active ET header node */
+ EdgeTableEntry *pETEs; /* Edge Table Entries buff */
+ ScanLineListBlock SLLBlock; /* header for ScanLineList */
+ int fixWAET = 0;
+
+ if (count < 3)
+ return TRUE;
+
+ if (!(pETEs = malloc(sizeof(EdgeTableEntry) * count)))
+ return FALSE;
+ ptsOut = FirstPoint;
+ width = FirstWidth;
+ if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock)) {
+ free(pETEs);
+ return FALSE;
+ }
+ pSLL = ET.scanlines.next;
+
+ if (pgc->fillRule == EvenOddRule) {
+ /*
+ * for each scanline
+ */
+ for (y = ET.ymin; y < ET.ymax; y++) {
+ /*
+ * Add a new edge to the active edge table when we
+ * get to the next edge.
+ */
+ if (pSLL && y == pSLL->scanline) {
+ miloadAET(&AET, pSLL->edgelist);
+ pSLL = pSLL->next;
+ }
+ pPrevAET = &AET;
+ pAET = AET.next;
+
+ /*
+ * for each active edge
+ */
+ while (pAET) {
+ ptsOut->x = pAET->bres.minor;
+ ptsOut++->y = y;
+ *width++ = pAET->next->bres.minor - pAET->bres.minor;
+ nPts++;
+
+ /*
+ * send out the buffer when its full
+ */
+ if (nPts == NUMPTSTOBUFFER) {
+ (*pgc->ops->FillSpans) (dst, pgc,
+ nPts, FirstPoint, FirstWidth, 1);
+ ptsOut = FirstPoint;
+ width = FirstWidth;
+ nPts = 0;
+ }
+ EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
+ EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
+ }
+ miInsertionSort(&AET);
+ }
+ }
+ else { /* default to WindingNumber */
+
+ /*
+ * for each scanline
+ */
+ for (y = ET.ymin; y < ET.ymax; y++) {
+ /*
+ * Add a new edge to the active edge table when we
+ * get to the next edge.
+ */
+ if (pSLL && y == pSLL->scanline) {
+ miloadAET(&AET, pSLL->edgelist);
+ micomputeWAET(&AET);
+ pSLL = pSLL->next;
+ }
+ pPrevAET = &AET;
+ pAET = AET.next;
+ pWETE = pAET;
+
+ /*
+ * for each active edge
+ */
+ while (pAET) {
+ /*
+ * if the next edge in the active edge table is
+ * also the next edge in the winding active edge
+ * table.
+ */
+ if (pWETE == pAET) {
+ ptsOut->x = pAET->bres.minor;
+ ptsOut++->y = y;
+ *width++ = pAET->nextWETE->bres.minor - pAET->bres.minor;
+ nPts++;
+
+ /*
+ * send out the buffer
+ */
+ if (nPts == NUMPTSTOBUFFER) {
+ (*pgc->ops->FillSpans) (dst, pgc, nPts, FirstPoint,
+ FirstWidth, 1);
+ ptsOut = FirstPoint;
+ width = FirstWidth;
+ nPts = 0;
+ }
+
+ pWETE = pWETE->nextWETE;
+ while (pWETE != pAET)
+ EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
+ pWETE = pWETE->nextWETE;
+ }
+ EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
+ }
+
+ /*
+ * reevaluate the Winding active edge table if we
+ * just had to resort it or if we just exited an edge.
+ */
+ if (miInsertionSort(&AET) || fixWAET) {
+ micomputeWAET(&AET);
+ fixWAET = 0;
+ }
+ }
+ }
+
+ /*
+ * Get any spans that we missed by buffering
+ */
+ (*pgc->ops->FillSpans) (dst, pgc, nPts, FirstPoint, FirstWidth, 1);
+ free(pETEs);
+ miFreeStorage(SLLBlock.next);
+ return TRUE;
+}
diff --git a/xorg-server/mi/mipolypnt.c b/xorg-server/mi/mipolypnt.c
index 29d3e29e1..086502b26 100644
--- a/xorg-server/mi/mipolypnt.c
+++ b/xorg-server/mi/mipolypnt.c
@@ -1,125 +1,112 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "pixmapstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "mi.h"
-
-void
-miPolyPoint(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode, /* Origin or Previous */
- int npt,
- xPoint *pptInit
- )
-{
-
- int xorg;
- int yorg;
- int nptTmp;
- ChangeGCVal fsOld, fsNew;
- int *pwidthInit, *pwidth;
- int i;
- xPoint *ppt;
-
- if(!(pwidthInit = malloc(npt * sizeof(int))))
- return;
-
- /* make pointlist origin relative */
- if (mode == CoordModePrevious)
- {
- ppt = pptInit;
- nptTmp = npt;
- nptTmp--;
- while(nptTmp--)
- {
- ppt++;
- ppt->x += (ppt-1)->x;
- ppt->y += (ppt-1)->y;
- }
- }
-
- if(pGC->miTranslate)
- {
- ppt = pptInit;
- nptTmp = npt;
- xorg = pDrawable->x;
- yorg = pDrawable->y;
- while(nptTmp--)
- {
- ppt->x += xorg;
- ppt++->y += yorg;
- }
- }
-
- fsOld.val = pGC->fillStyle;
- fsNew.val = FillSolid;
- if(pGC->fillStyle != FillSolid)
- {
- ChangeGC(NullClient, pGC, GCFillStyle, &fsNew);
- ValidateGC(pDrawable, pGC);
- }
- pwidth = pwidthInit;
- for(i = 0; i < npt; i++)
- *pwidth++ = 1;
- (*pGC->ops->FillSpans)(pDrawable, pGC, npt, pptInit, pwidthInit, FALSE);
-
- if(fsOld.val != FillSolid)
- {
- ChangeGC(NullClient, pGC, GCFillStyle, &fsOld);
- ValidateGC(pDrawable, pGC);
- }
- free(pwidthInit);
-}
-
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xprotostr.h>
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "mi.h"
+
+void
+miPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, /* Origin or Previous */
+ int npt, xPoint * pptInit)
+{
+
+ int xorg;
+ int yorg;
+ int nptTmp;
+ ChangeGCVal fsOld, fsNew;
+ int *pwidthInit, *pwidth;
+ int i;
+ xPoint *ppt;
+
+ if (!(pwidthInit = malloc(npt * sizeof(int))))
+ return;
+
+ /* make pointlist origin relative */
+ if (mode == CoordModePrevious) {
+ ppt = pptInit;
+ nptTmp = npt;
+ nptTmp--;
+ while (nptTmp--) {
+ ppt++;
+ ppt->x += (ppt - 1)->x;
+ ppt->y += (ppt - 1)->y;
+ }
+ }
+
+ if (pGC->miTranslate) {
+ ppt = pptInit;
+ nptTmp = npt;
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ while (nptTmp--) {
+ ppt->x += xorg;
+ ppt++->y += yorg;
+ }
+ }
+
+ fsOld.val = pGC->fillStyle;
+ fsNew.val = FillSolid;
+ if (pGC->fillStyle != FillSolid) {
+ ChangeGC(NullClient, pGC, GCFillStyle, &fsNew);
+ ValidateGC(pDrawable, pGC);
+ }
+ pwidth = pwidthInit;
+ for (i = 0; i < npt; i++)
+ *pwidth++ = 1;
+ (*pGC->ops->FillSpans) (pDrawable, pGC, npt, pptInit, pwidthInit, FALSE);
+
+ if (fsOld.val != FillSolid) {
+ ChangeGC(NullClient, pGC, GCFillStyle, &fsOld);
+ ValidateGC(pDrawable, pGC);
+ }
+ free(pwidthInit);
+}
diff --git a/xorg-server/mi/mipolyrect.c b/xorg-server/mi/mipolyrect.c
index 8b8810793..a0e88d2f2 100644
--- a/xorg-server/mi/mipolyrect.c
+++ b/xorg-server/mi/mipolyrect.c
@@ -1,187 +1,175 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "pixmap.h"
-#include "mi.h"
-
-void
-miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects)
-{
- int i;
- xRectangle *pR = pRects;
- DDXPointRec rect[5];
- int bound_tmp;
-
-#define MINBOUND(dst,eqn) bound_tmp = eqn; \
- if (bound_tmp < -32768) \
- bound_tmp = -32768; \
- dst = bound_tmp;
-
-#define MAXBOUND(dst,eqn) bound_tmp = eqn; \
- if (bound_tmp > 32767) \
- bound_tmp = 32767; \
- dst = bound_tmp;
-
-#define MAXUBOUND(dst,eqn) bound_tmp = eqn; \
- if (bound_tmp > 65535) \
- bound_tmp = 65535; \
- dst = bound_tmp;
-
- if (pGC->lineStyle == LineSolid && pGC->joinStyle == JoinMiter &&
- pGC->lineWidth != 0)
- {
- xRectangle *tmp, *t;
- int ntmp;
- int offset1, offset2, offset3;
- int x, y, width, height;
-
- ntmp = (nrects << 2);
- offset2 = pGC->lineWidth;
- offset1 = offset2 >> 1;
- offset3 = offset2 - offset1;
- tmp = malloc(ntmp * sizeof (xRectangle));
- if (!tmp)
- return;
- t = tmp;
- for (i = 0; i < nrects; i++)
- {
- x = pR->x;
- y = pR->y;
- width = pR->width;
- height = pR->height;
- pR++;
- if (width == 0 && height == 0)
- {
- rect[0].x = x;
- rect[0].y = y;
- rect[1].x = x;
- rect[1].y = y;
- (*pGC->ops->Polylines)(pDraw, pGC, CoordModeOrigin, 2, rect);
- }
- else if (height < offset2 || width < offset1)
- {
- if (height == 0)
- {
- t->x = x;
- t->width = width;
- }
- else
- {
- MINBOUND (t->x, x - offset1)
- MAXUBOUND (t->width, width + offset2)
- }
- if (width == 0)
- {
- t->y = y;
- t->height = height;
- }
- else
- {
- MINBOUND (t->y, y - offset1)
- MAXUBOUND (t->height, height + offset2)
- }
- t++;
- }
- else
- {
- MINBOUND(t->x, x - offset1)
- MINBOUND(t->y, y - offset1)
- MAXUBOUND(t->width, width + offset2)
- t->height = offset2;
- t++;
- MINBOUND(t->x, x - offset1)
- MAXBOUND(t->y, y + offset3);
- t->width = offset2;
- t->height = height - offset2;
- t++;
- MAXBOUND(t->x, x + width - offset1);
- MAXBOUND(t->y, y + offset3)
- t->width = offset2;
- t->height = height - offset2;
- t++;
- MINBOUND(t->x, x - offset1)
- MAXBOUND(t->y, y + height - offset1)
- MAXUBOUND(t->width, width + offset2)
- t->height = offset2;
- t++;
- }
- }
- (*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp);
- free((pointer) tmp);
- }
- else
- {
-
- for (i=0; i<nrects; i++)
- {
- rect[0].x = pR->x;
- rect[0].y = pR->y;
-
- MAXBOUND(rect[1].x, pR->x + (int) pR->width)
- rect[1].y = rect[0].y;
-
- rect[2].x = rect[1].x;
- MAXBOUND(rect[2].y, pR->y + (int) pR->height);
-
- rect[3].x = rect[0].x;
- rect[3].y = rect[2].y;
-
- rect[4].x = rect[0].x;
- rect[4].y = rect[0].y;
-
- (*pGC->ops->Polylines)(pDraw, pGC, CoordModeOrigin, 5, rect);
- pR++;
- }
- }
-}
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xprotostr.h>
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "pixmap.h"
+#include "mi.h"
+
+void
+miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects)
+{
+ int i;
+ xRectangle *pR = pRects;
+ DDXPointRec rect[5];
+ int bound_tmp;
+
+#define MINBOUND(dst,eqn) bound_tmp = eqn; \
+ if (bound_tmp < -32768) \
+ bound_tmp = -32768; \
+ dst = bound_tmp;
+
+#define MAXBOUND(dst,eqn) bound_tmp = eqn; \
+ if (bound_tmp > 32767) \
+ bound_tmp = 32767; \
+ dst = bound_tmp;
+
+#define MAXUBOUND(dst,eqn) bound_tmp = eqn; \
+ if (bound_tmp > 65535) \
+ bound_tmp = 65535; \
+ dst = bound_tmp;
+
+ if (pGC->lineStyle == LineSolid && pGC->joinStyle == JoinMiter &&
+ pGC->lineWidth != 0) {
+ xRectangle *tmp, *t;
+ int ntmp;
+ int offset1, offset2, offset3;
+ int x, y, width, height;
+
+ ntmp = (nrects << 2);
+ offset2 = pGC->lineWidth;
+ offset1 = offset2 >> 1;
+ offset3 = offset2 - offset1;
+ tmp = malloc(ntmp * sizeof(xRectangle));
+ if (!tmp)
+ return;
+ t = tmp;
+ for (i = 0; i < nrects; i++) {
+ x = pR->x;
+ y = pR->y;
+ width = pR->width;
+ height = pR->height;
+ pR++;
+ if (width == 0 && height == 0) {
+ rect[0].x = x;
+ rect[0].y = y;
+ rect[1].x = x;
+ rect[1].y = y;
+ (*pGC->ops->Polylines) (pDraw, pGC, CoordModeOrigin, 2, rect);
+ }
+ else if (height < offset2 || width < offset1) {
+ if (height == 0) {
+ t->x = x;
+ t->width = width;
+ }
+ else {
+ MINBOUND(t->x, x - offset1)
+ MAXUBOUND(t->width, width + offset2)
+ }
+ if (width == 0) {
+ t->y = y;
+ t->height = height;
+ }
+ else {
+ MINBOUND(t->y, y - offset1)
+ MAXUBOUND(t->height, height + offset2)
+ }
+ t++;
+ }
+ else {
+ MINBOUND(t->x, x - offset1)
+ MINBOUND(t->y, y - offset1)
+ MAXUBOUND(t->width, width + offset2)
+ t->height = offset2;
+ t++;
+ MINBOUND(t->x, x - offset1)
+ MAXBOUND(t->y, y + offset3);
+ t->width = offset2;
+ t->height = height - offset2;
+ t++;
+ MAXBOUND(t->x, x + width - offset1);
+ MAXBOUND(t->y, y + offset3)
+ t->width = offset2;
+ t->height = height - offset2;
+ t++;
+ MINBOUND(t->x, x - offset1)
+ MAXBOUND(t->y, y + height - offset1)
+ MAXUBOUND(t->width, width + offset2)
+ t->height = offset2;
+ t++;
+ }
+ }
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp);
+ free((pointer) tmp);
+ }
+ else {
+
+ for (i = 0; i < nrects; i++) {
+ rect[0].x = pR->x;
+ rect[0].y = pR->y;
+
+ MAXBOUND(rect[1].x, pR->x + (int) pR->width)
+ rect[1].y = rect[0].y;
+
+ rect[2].x = rect[1].x;
+ MAXBOUND(rect[2].y, pR->y + (int) pR->height);
+
+ rect[3].x = rect[0].x;
+ rect[3].y = rect[2].y;
+
+ rect[4].x = rect[0].x;
+ rect[4].y = rect[0].y;
+
+ (*pGC->ops->Polylines) (pDraw, pGC, CoordModeOrigin, 5, rect);
+ pR++;
+ }
+ }
+}
diff --git a/xorg-server/mi/mipolyseg.c b/xorg-server/mi/mipolyseg.c
index bf7f0f92e..d6f18076c 100644
--- a/xorg-server/mi/mipolyseg.c
+++ b/xorg-server/mi/mipolyseg.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -65,15 +64,14 @@ SOFTWARE.
*
*****************************************************************/
-
void
-miPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment *pSegs)
+miPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSegs)
{
int i;
- for (i=0; i<nseg; i++)
- {
- (*pGC->ops->Polylines)(pDraw, pGC, CoordModeOrigin, 2,(DDXPointPtr)pSegs);
- pSegs++;
+ for (i = 0; i < nseg; i++) {
+ (*pGC->ops->Polylines) (pDraw, pGC, CoordModeOrigin, 2,
+ (DDXPointPtr) pSegs);
+ pSegs++;
}
}
diff --git a/xorg-server/mi/mipolytext.c b/xorg-server/mi/mipolytext.c
index 508e0ffa7..02c45882f 100644
--- a/xorg-server/mi/mipolytext.c
+++ b/xorg-server/mi/mipolytext.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -71,34 +70,37 @@ miPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, char *chars)
{
unsigned long n, i;
int w;
- CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
+ CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
- GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
- Linear8Bit, &n, charinfo);
+ GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars,
+ Linear8Bit, &n, charinfo);
w = 0;
- for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
+ for (i = 0; i < n; i++)
+ w += charinfo[i]->metrics.characterWidth;
if (n != 0)
- (*pGC->ops->PolyGlyphBlt)(
- pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
- return x+w;
+ (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, x, y, n, charinfo,
+ FONTGLYPHS(pGC->font));
+ return x + w;
}
int
-miPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, unsigned short *chars)
+miPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ unsigned short *chars)
{
unsigned long n, i;
int w;
- CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
+ CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
- GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, charinfo);
+ GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
w = 0;
- for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
+ for (i = 0; i < n; i++)
+ w += charinfo[i]->metrics.characterWidth;
if (n != 0)
- (*pGC->ops->PolyGlyphBlt)(
- pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
- return x+w;
+ (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, x, y, n, charinfo,
+ FONTGLYPHS(pGC->font));
+ return x + w;
}
void
@@ -106,25 +108,27 @@ miImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, char *chars)
{
unsigned long n;
FontPtr font = pGC->font;
- CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
+ CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
- GetGlyphs(font, (unsigned long)count, (unsigned char *)chars,
- Linear8Bit, &n, charinfo);
- if (n !=0 )
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font));
+ GetGlyphs(font, (unsigned long) count, (unsigned char *) chars,
+ Linear8Bit, &n, charinfo);
+ if (n != 0)
+ (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, x, y, n, charinfo,
+ FONTGLYPHS(font));
}
void
miImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars)
+ int count, unsigned short *chars)
{
unsigned long n;
FontPtr font = pGC->font;
- CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
+ CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
- GetGlyphs(font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, charinfo);
- if (n !=0 )
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font));
+ GetGlyphs(font, (unsigned long) count, (unsigned char *) chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
+ if (n != 0)
+ (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, x, y, n, charinfo,
+ FONTGLYPHS(font));
}
diff --git a/xorg-server/mi/mipolyutil.c b/xorg-server/mi/mipolyutil.c
index e17fb52e4..5e6301d43 100644
--- a/xorg-server/mi/mipolyutil.c
+++ b/xorg-server/mi/mipolyutil.c
@@ -1,385 +1,369 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "regionstr.h"
-#include "gc.h"
-#include "miscanfill.h"
-#include "mipoly.h"
-#include "misc.h" /* MAXINT */
-
-/*
- * fillUtils.c
- *
- * Written by Brian Kelleher; Oct. 1985
- *
- * This module contains all of the utility functions
- * needed to scan convert a polygon.
- *
- */
-
-/*
- * InsertEdgeInET
- *
- * Insert the given edge into the edge table.
- * First we must find the correct bucket in the
- * Edge table, then find the right slot in the
- * bucket. Finally, we can insert it.
- *
- */
-static Bool
-miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline,
- ScanLineListBlock **SLLBlock, int *iSLLBlock)
-{
- EdgeTableEntry *start, *prev;
- ScanLineList *pSLL, *pPrevSLL;
- ScanLineListBlock *tmpSLLBlock;
-
- /*
- * find the right bucket to put the edge into
- */
- pPrevSLL = &ET->scanlines;
- pSLL = pPrevSLL->next;
- while (pSLL && (pSLL->scanline < scanline))
- {
- pPrevSLL = pSLL;
- pSLL = pSLL->next;
- }
-
- /*
- * reassign pSLL (pointer to ScanLineList) if necessary
- */
- if ((!pSLL) || (pSLL->scanline > scanline))
- {
- if (*iSLLBlock > SLLSPERBLOCK-1)
- {
- tmpSLLBlock = malloc(sizeof(ScanLineListBlock));
- if (!tmpSLLBlock)
- return FALSE;
- (*SLLBlock)->next = tmpSLLBlock;
- tmpSLLBlock->next = NULL;
- *SLLBlock = tmpSLLBlock;
- *iSLLBlock = 0;
- }
- pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]);
-
- pSLL->next = pPrevSLL->next;
- pSLL->edgelist = NULL;
- pPrevSLL->next = pSLL;
- }
- pSLL->scanline = scanline;
-
- /*
- * now insert the edge in the right bucket
- */
- prev = NULL;
- start = pSLL->edgelist;
- while (start && (start->bres.minor < ETE->bres.minor))
- {
- prev = start;
- start = start->next;
- }
- ETE->next = start;
-
- if (prev)
- prev->next = ETE;
- else
- pSLL->edgelist = ETE;
- return TRUE;
-}
-
-/*
- * CreateEdgeTable
- *
- * This routine creates the edge table for
- * scan converting polygons.
- * The Edge Table (ET) looks like:
- *
- * EdgeTable
- * --------
- * | ymax | ScanLineLists
- * |scanline|-->------------>-------------->...
- * -------- |scanline| |scanline|
- * |edgelist| |edgelist|
- * --------- ---------
- * | |
- * | |
- * V V
- * list of ETEs list of ETEs
- *
- * where ETE is an EdgeTableEntry data structure,
- * and there is one ScanLineList per scanline at
- * which an edge is initially entered.
- *
- */
-
-Bool
-miCreateETandAET(int count, DDXPointPtr pts, EdgeTable *ET, EdgeTableEntry *AET,
- EdgeTableEntry *pETEs, ScanLineListBlock *pSLLBlock)
-{
- DDXPointPtr top, bottom;
- DDXPointPtr PrevPt, CurrPt;
- int iSLLBlock = 0;
-
- int dy;
-
- if (count < 2) return TRUE;
-
- /*
- * initialize the Active Edge Table
- */
- AET->next = NULL;
- AET->back = NULL;
- AET->nextWETE = NULL;
- AET->bres.minor = MININT;
-
- /*
- * initialize the Edge Table.
- */
- ET->scanlines.next = NULL;
- ET->ymax = MININT;
- ET->ymin = MAXINT;
- pSLLBlock->next = NULL;
-
- PrevPt = &pts[count-1];
-
- /*
- * for each vertex in the array of points.
- * In this loop we are dealing with two vertices at
- * a time -- these make up one edge of the polygon.
- */
- while (count--)
- {
- CurrPt = pts++;
-
- /*
- * find out which point is above and which is below.
- */
- if (PrevPt->y > CurrPt->y)
- {
- bottom = PrevPt, top = CurrPt;
- pETEs->ClockWise = 0;
- }
- else
- {
- bottom = CurrPt, top = PrevPt;
- pETEs->ClockWise = 1;
- }
-
- /*
- * don't add horizontal edges to the Edge table.
- */
- if (bottom->y != top->y)
- {
- pETEs->ymax = bottom->y-1; /* -1 so we don't get last scanline */
-
- /*
- * initialize integer edge algorithm
- */
- dy = bottom->y - top->y;
- BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres);
-
- if (!miInsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock))
- {
- miFreeStorage(pSLLBlock->next);
- return FALSE;
- }
-
- ET->ymax = max(ET->ymax, PrevPt->y);
- ET->ymin = min(ET->ymin, PrevPt->y);
- pETEs++;
- }
-
- PrevPt = CurrPt;
- }
- return TRUE;
-}
-
-/*
- * loadAET
- *
- * This routine moves EdgeTableEntries from the
- * EdgeTable into the Active Edge Table,
- * leaving them sorted by smaller x coordinate.
- *
- */
-
-void
-miloadAET(EdgeTableEntry *AET, EdgeTableEntry *ETEs)
-{
- EdgeTableEntry *pPrevAET;
- EdgeTableEntry *tmp;
-
- pPrevAET = AET;
- AET = AET->next;
- while (ETEs)
- {
- while (AET && (AET->bres.minor < ETEs->bres.minor))
- {
- pPrevAET = AET;
- AET = AET->next;
- }
- tmp = ETEs->next;
- ETEs->next = AET;
- if (AET)
- AET->back = ETEs;
- ETEs->back = pPrevAET;
- pPrevAET->next = ETEs;
- pPrevAET = ETEs;
-
- ETEs = tmp;
- }
-}
-
-/*
- * computeWAET
- *
- * This routine links the AET by the
- * nextWETE (winding EdgeTableEntry) link for
- * use by the winding number rule. The final
- * Active Edge Table (AET) might look something
- * like:
- *
- * AET
- * ---------- --------- ---------
- * |ymax | |ymax | |ymax |
- * | ... | |... | |... |
- * |next |->|next |->|next |->...
- * |nextWETE| |nextWETE| |nextWETE|
- * --------- --------- ^--------
- * | | |
- * V-------------------> V---> ...
- *
- */
-void
-micomputeWAET(EdgeTableEntry *AET)
-{
- EdgeTableEntry *pWETE;
- int inside = 1;
- int isInside = 0;
-
- AET->nextWETE = NULL;
- pWETE = AET;
- AET = AET->next;
- while (AET)
- {
- if (AET->ClockWise)
- isInside++;
- else
- isInside--;
-
- if ((!inside && !isInside) ||
- ( inside && isInside))
- {
- pWETE->nextWETE = AET;
- pWETE = AET;
- inside = !inside;
- }
- AET = AET->next;
- }
- pWETE->nextWETE = NULL;
-}
-
-/*
- * InsertionSort
- *
- * Just a simple insertion sort using
- * pointers and back pointers to sort the Active
- * Edge Table.
- *
- */
-
-int
-miInsertionSort(EdgeTableEntry *AET)
-{
- EdgeTableEntry *pETEchase;
- EdgeTableEntry *pETEinsert;
- EdgeTableEntry *pETEchaseBackTMP;
- int changed = 0;
-
- AET = AET->next;
- while (AET)
- {
- pETEinsert = AET;
- pETEchase = AET;
- while (pETEchase->back->bres.minor > AET->bres.minor)
- pETEchase = pETEchase->back;
-
- AET = AET->next;
- if (pETEchase != pETEinsert)
- {
- pETEchaseBackTMP = pETEchase->back;
- pETEinsert->back->next = AET;
- if (AET)
- AET->back = pETEinsert->back;
- pETEinsert->next = pETEchase;
- pETEchase->back->next = pETEinsert;
- pETEchase->back = pETEinsert;
- pETEinsert->back = pETEchaseBackTMP;
- changed = 1;
- }
- }
- return changed;
-}
-
-/*
- * Clean up our act.
- */
-void
-miFreeStorage(ScanLineListBlock *pSLLBlock)
-{
- ScanLineListBlock *tmpSLLBlock;
-
- while (pSLLBlock)
- {
- tmpSLLBlock = pSLLBlock->next;
- free(pSLLBlock);
- pSLLBlock = tmpSLLBlock;
- }
-}
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "regionstr.h"
+#include "gc.h"
+#include "miscanfill.h"
+#include "mipoly.h"
+#include "misc.h" /* MAXINT */
+
+/*
+ * fillUtils.c
+ *
+ * Written by Brian Kelleher; Oct. 1985
+ *
+ * This module contains all of the utility functions
+ * needed to scan convert a polygon.
+ *
+ */
+
+/*
+ * InsertEdgeInET
+ *
+ * Insert the given edge into the edge table.
+ * First we must find the correct bucket in the
+ * Edge table, then find the right slot in the
+ * bucket. Finally, we can insert it.
+ *
+ */
+static Bool
+miInsertEdgeInET(EdgeTable * ET, EdgeTableEntry * ETE, int scanline,
+ ScanLineListBlock ** SLLBlock, int *iSLLBlock)
+{
+ EdgeTableEntry *start, *prev;
+ ScanLineList *pSLL, *pPrevSLL;
+ ScanLineListBlock *tmpSLLBlock;
+
+ /*
+ * find the right bucket to put the edge into
+ */
+ pPrevSLL = &ET->scanlines;
+ pSLL = pPrevSLL->next;
+ while (pSLL && (pSLL->scanline < scanline)) {
+ pPrevSLL = pSLL;
+ pSLL = pSLL->next;
+ }
+
+ /*
+ * reassign pSLL (pointer to ScanLineList) if necessary
+ */
+ if ((!pSLL) || (pSLL->scanline > scanline)) {
+ if (*iSLLBlock > SLLSPERBLOCK - 1) {
+ tmpSLLBlock = malloc(sizeof(ScanLineListBlock));
+ if (!tmpSLLBlock)
+ return FALSE;
+ (*SLLBlock)->next = tmpSLLBlock;
+ tmpSLLBlock->next = NULL;
+ *SLLBlock = tmpSLLBlock;
+ *iSLLBlock = 0;
+ }
+ pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]);
+
+ pSLL->next = pPrevSLL->next;
+ pSLL->edgelist = NULL;
+ pPrevSLL->next = pSLL;
+ }
+ pSLL->scanline = scanline;
+
+ /*
+ * now insert the edge in the right bucket
+ */
+ prev = NULL;
+ start = pSLL->edgelist;
+ while (start && (start->bres.minor < ETE->bres.minor)) {
+ prev = start;
+ start = start->next;
+ }
+ ETE->next = start;
+
+ if (prev)
+ prev->next = ETE;
+ else
+ pSLL->edgelist = ETE;
+ return TRUE;
+}
+
+/*
+ * CreateEdgeTable
+ *
+ * This routine creates the edge table for
+ * scan converting polygons.
+ * The Edge Table (ET) looks like:
+ *
+ * EdgeTable
+ * --------
+ * | ymax | ScanLineLists
+ * |scanline|-->------------>-------------->...
+ * -------- |scanline| |scanline|
+ * |edgelist| |edgelist|
+ * --------- ---------
+ * | |
+ * | |
+ * V V
+ * list of ETEs list of ETEs
+ *
+ * where ETE is an EdgeTableEntry data structure,
+ * and there is one ScanLineList per scanline at
+ * which an edge is initially entered.
+ *
+ */
+
+Bool
+miCreateETandAET(int count, DDXPointPtr pts, EdgeTable * ET,
+ EdgeTableEntry * AET, EdgeTableEntry * pETEs,
+ ScanLineListBlock * pSLLBlock)
+{
+ DDXPointPtr top, bottom;
+ DDXPointPtr PrevPt, CurrPt;
+ int iSLLBlock = 0;
+
+ int dy;
+
+ if (count < 2)
+ return TRUE;
+
+ /*
+ * initialize the Active Edge Table
+ */
+ AET->next = NULL;
+ AET->back = NULL;
+ AET->nextWETE = NULL;
+ AET->bres.minor = MININT;
+
+ /*
+ * initialize the Edge Table.
+ */
+ ET->scanlines.next = NULL;
+ ET->ymax = MININT;
+ ET->ymin = MAXINT;
+ pSLLBlock->next = NULL;
+
+ PrevPt = &pts[count - 1];
+
+ /*
+ * for each vertex in the array of points.
+ * In this loop we are dealing with two vertices at
+ * a time -- these make up one edge of the polygon.
+ */
+ while (count--) {
+ CurrPt = pts++;
+
+ /*
+ * find out which point is above and which is below.
+ */
+ if (PrevPt->y > CurrPt->y) {
+ bottom = PrevPt, top = CurrPt;
+ pETEs->ClockWise = 0;
+ }
+ else {
+ bottom = CurrPt, top = PrevPt;
+ pETEs->ClockWise = 1;
+ }
+
+ /*
+ * don't add horizontal edges to the Edge table.
+ */
+ if (bottom->y != top->y) {
+ pETEs->ymax = bottom->y - 1; /* -1 so we don't get last scanline */
+
+ /*
+ * initialize integer edge algorithm
+ */
+ dy = bottom->y - top->y;
+ BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres);
+
+ if (!miInsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock)) {
+ miFreeStorage(pSLLBlock->next);
+ return FALSE;
+ }
+
+ ET->ymax = max(ET->ymax, PrevPt->y);
+ ET->ymin = min(ET->ymin, PrevPt->y);
+ pETEs++;
+ }
+
+ PrevPt = CurrPt;
+ }
+ return TRUE;
+}
+
+/*
+ * loadAET
+ *
+ * This routine moves EdgeTableEntries from the
+ * EdgeTable into the Active Edge Table,
+ * leaving them sorted by smaller x coordinate.
+ *
+ */
+
+void
+miloadAET(EdgeTableEntry * AET, EdgeTableEntry * ETEs)
+{
+ EdgeTableEntry *pPrevAET;
+ EdgeTableEntry *tmp;
+
+ pPrevAET = AET;
+ AET = AET->next;
+ while (ETEs) {
+ while (AET && (AET->bres.minor < ETEs->bres.minor)) {
+ pPrevAET = AET;
+ AET = AET->next;
+ }
+ tmp = ETEs->next;
+ ETEs->next = AET;
+ if (AET)
+ AET->back = ETEs;
+ ETEs->back = pPrevAET;
+ pPrevAET->next = ETEs;
+ pPrevAET = ETEs;
+
+ ETEs = tmp;
+ }
+}
+
+/*
+ * computeWAET
+ *
+ * This routine links the AET by the
+ * nextWETE (winding EdgeTableEntry) link for
+ * use by the winding number rule. The final
+ * Active Edge Table (AET) might look something
+ * like:
+ *
+ * AET
+ * ---------- --------- ---------
+ * |ymax | |ymax | |ymax |
+ * | ... | |... | |... |
+ * |next |->|next |->|next |->...
+ * |nextWETE| |nextWETE| |nextWETE|
+ * --------- --------- ^--------
+ * | | |
+ * V-------------------> V---> ...
+ *
+ */
+void
+micomputeWAET(EdgeTableEntry * AET)
+{
+ EdgeTableEntry *pWETE;
+ int inside = 1;
+ int isInside = 0;
+
+ AET->nextWETE = NULL;
+ pWETE = AET;
+ AET = AET->next;
+ while (AET) {
+ if (AET->ClockWise)
+ isInside++;
+ else
+ isInside--;
+
+ if ((!inside && !isInside) || (inside && isInside)) {
+ pWETE->nextWETE = AET;
+ pWETE = AET;
+ inside = !inside;
+ }
+ AET = AET->next;
+ }
+ pWETE->nextWETE = NULL;
+}
+
+/*
+ * InsertionSort
+ *
+ * Just a simple insertion sort using
+ * pointers and back pointers to sort the Active
+ * Edge Table.
+ *
+ */
+
+int
+miInsertionSort(EdgeTableEntry * AET)
+{
+ EdgeTableEntry *pETEchase;
+ EdgeTableEntry *pETEinsert;
+ EdgeTableEntry *pETEchaseBackTMP;
+ int changed = 0;
+
+ AET = AET->next;
+ while (AET) {
+ pETEinsert = AET;
+ pETEchase = AET;
+ while (pETEchase->back->bres.minor > AET->bres.minor)
+ pETEchase = pETEchase->back;
+
+ AET = AET->next;
+ if (pETEchase != pETEinsert) {
+ pETEchaseBackTMP = pETEchase->back;
+ pETEinsert->back->next = AET;
+ if (AET)
+ AET->back = pETEinsert->back;
+ pETEinsert->next = pETEchase;
+ pETEchase->back->next = pETEinsert;
+ pETEchase->back = pETEinsert;
+ pETEinsert->back = pETEchaseBackTMP;
+ changed = 1;
+ }
+ }
+ return changed;
+}
+
+/*
+ * Clean up our act.
+ */
+void
+miFreeStorage(ScanLineListBlock * pSLLBlock)
+{
+ ScanLineListBlock *tmpSLLBlock;
+
+ while (pSLLBlock) {
+ tmpSLLBlock = pSLLBlock->next;
+ free(pSLLBlock);
+ pSLLBlock = tmpSLLBlock;
+ }
+}
diff --git a/xorg-server/mi/mipushpxl.c b/xorg-server/mi/mipushpxl.c
index 9c3d9b342..9a78f4050 100644
--- a/xorg-server/mi/mipushpxl.c
+++ b/xorg-server/mi/mipushpxl.c
@@ -1,271 +1,249 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mi.h"
-#include "servermd.h"
-
-#define NPT 128
-
-/* These were stolen from mfb. They don't really belong here. */
-#define LONG2CHARSSAMEORDER(x) ((MiBits)(x))
-#define LONG2CHARSDIFFORDER( x ) ( ( ( ( x ) & (MiBits)0x000000FF ) << 0x18 ) \
- | ( ( ( x ) & (MiBits)0x0000FF00 ) << 0x08 ) \
- | ( ( ( x ) & (MiBits)0x00FF0000 ) >> 0x08 ) \
- | ( ( ( x ) & (MiBits)0xFF000000 ) >> 0x18 ) )
-
-
-#define PGSZB 4
-#define PPW (PGSZB<<3) /* assuming 8 bits per byte */
-#define PGSZ PPW
-#define PLST (PPW-1)
-#define PIM PLST
-#define PWSH 5
-
-/* miPushPixels -- squeegees the fill style of pGC through pBitMap
- * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may
- * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit
- * is set in the bitmap, the fill style is put onto the drawable using
- * the GC's logical function. The drawable is not changed where the bitmap
- * has a zero bit or outside the area covered by the stencil.
-
-WARNING:
- this code works if the 1-bit deep pixmap format returned by GetSpans
-is the same as the format defined by the mfb code (i.e. 32-bit padding
-per scanline, scanline unit = 32 bits; later, this might mean
-bitsizeof(int) padding and sacnline unit == bitsizeof(int).)
-
- */
-
-/*
- * in order to have both (MSB_FIRST and LSB_FIRST) versions of this
- * in the server, we need to rename one of them
- */
-void
-miPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
- int dx, int dy, int xOrg, int yOrg)
-{
- int h, dxDivPPW, ibEnd;
- MiBits *pwLineStart;
- MiBits *pw, *pwEnd;
- MiBits msk;
- int ib, w;
- int ipt; /* index into above arrays */
- Bool fInBox;
- DDXPointRec pt[NPT], ptThisLine;
- int width[NPT];
-#if 1
- MiBits startmask;
- if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
- if (screenInfo.bitmapBitOrder == LSBFirst)
- startmask = (MiBits)(-1) ^
- LONG2CHARSSAMEORDER((MiBits)(-1) << 1);
- else
- startmask = (MiBits)(-1) ^
- LONG2CHARSSAMEORDER((MiBits)(-1) >> 1);
- else
- if (screenInfo.bitmapBitOrder == LSBFirst)
- startmask = (MiBits)(-1) ^
- LONG2CHARSDIFFORDER((MiBits)(-1) << 1);
- else
- startmask = (MiBits)(-1) ^
- LONG2CHARSDIFFORDER((MiBits)(-1) >> 1);
-#endif
-
- pwLineStart = malloc(BitmapBytePad(dx));
- if (!pwLineStart)
- return;
- ipt = 0;
- dxDivPPW = dx/PPW;
-
- for(h = 0, ptThisLine.x = 0, ptThisLine.y = 0;
- h < dy;
- h++, ptThisLine.y++)
- {
-
- (*pBitMap->drawable.pScreen->GetSpans)((DrawablePtr)pBitMap, dx,
- &ptThisLine, &dx, 1, (char *)pwLineStart);
-
- pw = pwLineStart;
- /* Process all words which are fully in the pixmap */
-
- fInBox = FALSE;
- pwEnd = pwLineStart + dxDivPPW;
- while(pw < pwEnd)
- {
- w = *pw;
-#if 1
- msk = startmask;
-#else
- msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
-#endif
- for(ib = 0; ib < PPW; ib++)
- {
- if(w & msk)
- {
- if(!fInBox)
- {
- pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
- pt[ipt].y = h + yOrg;
- /* start new box */
- fInBox = TRUE;
- }
- }
- else
- {
- if(fInBox)
- {
- width[ipt] = ((pw - pwLineStart) << PWSH) +
- ib + xOrg - pt[ipt].x;
- if (++ipt >= NPT)
- {
- (*pGC->ops->FillSpans)(pDrawable, pGC,
- NPT, pt, width, TRUE);
- ipt = 0;
- }
- /* end box */
- fInBox = FALSE;
- }
- }
-#if 1
- /* This is not quite right, but it'll do for now */
- if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
- if (screenInfo.bitmapBitOrder == LSBFirst)
- msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1);
- else
- msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1);
- else
- if (screenInfo.bitmapBitOrder == LSBFirst)
- msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1);
- else
- msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
-#else
- msk = SCRRIGHT(msk, 1);
-#endif
- }
- pw++;
- }
- ibEnd = dx & PIM;
- if(ibEnd)
- {
- /* Process final partial word on line */
- w = *pw;
-#if 1
- msk = startmask;
-#else
- msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
-#endif
- for(ib = 0; ib < ibEnd; ib++)
- {
- if(w & msk)
- {
- if(!fInBox)
- {
- /* start new box */
- pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
- pt[ipt].y = h + yOrg;
- fInBox = TRUE;
- }
- }
- else
- {
- if(fInBox)
- {
- /* end box */
- width[ipt] = ((pw - pwLineStart) << PWSH) +
- ib + xOrg - pt[ipt].x;
- if (++ipt >= NPT)
- {
- (*pGC->ops->FillSpans)(pDrawable,
- pGC, NPT, pt, width, TRUE);
- ipt = 0;
- }
- fInBox = FALSE;
- }
- }
-#if 1
- /* This is not quite right, but it'll do for now */
- if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
- if (screenInfo.bitmapBitOrder == LSBFirst)
- msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1);
- else
- msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1);
- else
- if (screenInfo.bitmapBitOrder == LSBFirst)
- msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1);
- else
- msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
-#else
- msk = SCRRIGHT(msk, 1);
-#endif
- }
- }
- /* If scanline ended with last bit set, end the box */
- if(fInBox)
- {
- width[ipt] = dx + xOrg - pt[ipt].x;
- if (++ipt >= NPT)
- {
- (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE);
- ipt = 0;
- }
- }
- }
- free(pwLineStart);
- /* Flush any remaining spans */
- if (ipt)
- {
- (*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE);
- }
-}
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mi.h"
+#include "servermd.h"
+
+#define NPT 128
+
+/* These were stolen from mfb. They don't really belong here. */
+#define LONG2CHARSSAMEORDER(x) ((MiBits)(x))
+#define LONG2CHARSDIFFORDER( x ) ( ( ( ( x ) & (MiBits)0x000000FF ) << 0x18 ) \
+ | ( ( ( x ) & (MiBits)0x0000FF00 ) << 0x08 ) \
+ | ( ( ( x ) & (MiBits)0x00FF0000 ) >> 0x08 ) \
+ | ( ( ( x ) & (MiBits)0xFF000000 ) >> 0x18 ) )
+
+#define PGSZB 4
+#define PPW (PGSZB<<3) /* assuming 8 bits per byte */
+#define PGSZ PPW
+#define PLST (PPW-1)
+#define PIM PLST
+#define PWSH 5
+
+/* miPushPixels -- squeegees the fill style of pGC through pBitMap
+ * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may
+ * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit
+ * is set in the bitmap, the fill style is put onto the drawable using
+ * the GC's logical function. The drawable is not changed where the bitmap
+ * has a zero bit or outside the area covered by the stencil.
+
+WARNING:
+ this code works if the 1-bit deep pixmap format returned by GetSpans
+is the same as the format defined by the mfb code (i.e. 32-bit padding
+per scanline, scanline unit = 32 bits; later, this might mean
+bitsizeof(int) padding and sacnline unit == bitsizeof(int).)
+
+ */
+
+/*
+ * in order to have both (MSB_FIRST and LSB_FIRST) versions of this
+ * in the server, we need to rename one of them
+ */
+void
+miPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg)
+{
+ int h, dxDivPPW, ibEnd;
+ MiBits *pwLineStart;
+ MiBits *pw, *pwEnd;
+ MiBits msk;
+ int ib, w;
+ int ipt; /* index into above arrays */
+ Bool fInBox;
+ DDXPointRec pt[NPT], ptThisLine;
+ int width[NPT];
+
+#if 1
+ MiBits startmask;
+
+ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ startmask = (MiBits) (-1) ^ LONG2CHARSSAMEORDER((MiBits) (-1) << 1);
+ else
+ startmask = (MiBits) (-1) ^ LONG2CHARSSAMEORDER((MiBits) (-1) >> 1);
+ else if (screenInfo.bitmapBitOrder == LSBFirst)
+ startmask = (MiBits) (-1) ^ LONG2CHARSDIFFORDER((MiBits) (-1) << 1);
+ else
+ startmask = (MiBits) (-1) ^ LONG2CHARSDIFFORDER((MiBits) (-1) >> 1);
+#endif
+
+ pwLineStart = malloc(BitmapBytePad(dx));
+ if (!pwLineStart)
+ return;
+ ipt = 0;
+ dxDivPPW = dx / PPW;
+
+ for (h = 0, ptThisLine.x = 0, ptThisLine.y = 0; h < dy; h++, ptThisLine.y++) {
+
+ (*pBitMap->drawable.pScreen->GetSpans) ((DrawablePtr) pBitMap, dx,
+ &ptThisLine, &dx, 1,
+ (char *) pwLineStart);
+
+ pw = pwLineStart;
+ /* Process all words which are fully in the pixmap */
+
+ fInBox = FALSE;
+ pwEnd = pwLineStart + dxDivPPW;
+ while (pw < pwEnd) {
+ w = *pw;
+#if 1
+ msk = startmask;
+#else
+ msk = (MiBits) (-1) ^ SCRRIGHT((MiBits) (-1), 1);
+#endif
+ for (ib = 0; ib < PPW; ib++) {
+ if (w & msk) {
+ if (!fInBox) {
+ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
+ pt[ipt].y = h + yOrg;
+ /* start new box */
+ fInBox = TRUE;
+ }
+ }
+ else {
+ if (fInBox) {
+ width[ipt] = ((pw - pwLineStart) << PWSH) +
+ ib + xOrg - pt[ipt].x;
+ if (++ipt >= NPT) {
+ (*pGC->ops->FillSpans) (pDrawable, pGC,
+ NPT, pt, width, TRUE);
+ ipt = 0;
+ }
+ /* end box */
+ fInBox = FALSE;
+ }
+ }
+#if 1
+ /* This is not quite right, but it'll do for now */
+ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk =
+ LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1);
+ else
+ msk =
+ LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1);
+ else if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1);
+ else
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
+#else
+ msk = SCRRIGHT(msk, 1);
+#endif
+ }
+ pw++;
+ }
+ ibEnd = dx & PIM;
+ if (ibEnd) {
+ /* Process final partial word on line */
+ w = *pw;
+#if 1
+ msk = startmask;
+#else
+ msk = (MiBits) (-1) ^ SCRRIGHT((MiBits) (-1), 1);
+#endif
+ for (ib = 0; ib < ibEnd; ib++) {
+ if (w & msk) {
+ if (!fInBox) {
+ /* start new box */
+ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
+ pt[ipt].y = h + yOrg;
+ fInBox = TRUE;
+ }
+ }
+ else {
+ if (fInBox) {
+ /* end box */
+ width[ipt] = ((pw - pwLineStart) << PWSH) +
+ ib + xOrg - pt[ipt].x;
+ if (++ipt >= NPT) {
+ (*pGC->ops->FillSpans) (pDrawable,
+ pGC, NPT, pt, width, TRUE);
+ ipt = 0;
+ }
+ fInBox = FALSE;
+ }
+ }
+#if 1
+ /* This is not quite right, but it'll do for now */
+ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk =
+ LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1);
+ else
+ msk =
+ LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1);
+ else if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1);
+ else
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
+#else
+ msk = SCRRIGHT(msk, 1);
+#endif
+ }
+ }
+ /* If scanline ended with last bit set, end the box */
+ if (fInBox) {
+ width[ipt] = dx + xOrg - pt[ipt].x;
+ if (++ipt >= NPT) {
+ (*pGC->ops->FillSpans) (pDrawable, pGC, NPT, pt, width, TRUE);
+ ipt = 0;
+ }
+ }
+ }
+ free(pwLineStart);
+ /* Flush any remaining spans */
+ if (ipt) {
+ (*pGC->ops->FillSpans) (pDrawable, pGC, ipt, pt, width, TRUE);
+ }
+}
diff --git a/xorg-server/mi/miscrinit.c b/xorg-server/mi/miscrinit.c
index f56083050..2850c8d79 100644
--- a/xorg-server/mi/miscrinit.c
+++ b/xorg-server/mi/miscrinit.c
@@ -1,296 +1,293 @@
-/*
-
-Copyright 1990, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "servermd.h"
-#include "misc.h"
-#include "mi.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "dix.h"
-#include "miline.h"
-#ifdef MITSHM
-#include <X11/extensions/shm.h>
-#include "shmint.h"
-#endif
-
-/* We use this structure to propogate some information from miScreenInit to
- * miCreateScreenResources. miScreenInit allocates the structure, fills it
- * in, and puts it into pScreen->devPrivate. miCreateScreenResources
- * extracts the info and frees the structure. We could've accomplished the
- * same thing by adding fields to the screen structure, but they would have
- * ended up being redundant, and would have exposed this mi implementation
- * detail to the whole server.
- */
-
-typedef struct
-{
- pointer pbits; /* pointer to framebuffer */
- int width; /* delta to add to a framebuffer addr to move one row down */
-} miScreenInitParmsRec, *miScreenInitParmsPtr;
-
-
-/* this plugs into pScreen->ModifyPixmapHeader */
-Bool
-miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData)
-{
- if (!pPixmap)
- return FALSE;
-
- /*
- * If all arguments are specified, reinitialize everything (including
- * validated state).
- */
- if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) &&
- (devKind > 0) && pPixData) {
- pPixmap->drawable.depth = depth;
- pPixmap->drawable.bitsPerPixel = bitsPerPixel;
- pPixmap->drawable.id = 0;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = width;
- pPixmap->drawable.height = height;
- pPixmap->devKind = devKind;
- pPixmap->refcnt = 1;
- pPixmap->devPrivate.ptr = pPixData;
- } else {
- /*
- * Only modify specified fields, keeping all others intact.
- */
-
- if (width > 0)
- pPixmap->drawable.width = width;
-
- if (height > 0)
- pPixmap->drawable.height = height;
-
- if (depth > 0)
- pPixmap->drawable.depth = depth;
-
- if (bitsPerPixel > 0)
- pPixmap->drawable.bitsPerPixel = bitsPerPixel;
- else if ((bitsPerPixel < 0) && (depth > 0))
- pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth);
-
- /*
- * CAVEAT: Non-SI DDXen may use devKind and devPrivate fields for
- * other purposes.
- */
- if (devKind > 0)
- pPixmap->devKind = devKind;
- else if ((devKind < 0) && ((width > 0) || (depth > 0)))
- pPixmap->devKind = PixmapBytePad(pPixmap->drawable.width,
- pPixmap->drawable.depth);
-
- if (pPixData)
- pPixmap->devPrivate.ptr = pPixData;
- }
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- return TRUE;
-}
-
-static Bool
-miCloseScreen (int iScreen, ScreenPtr pScreen)
-{
- return ((*pScreen->DestroyPixmap)((PixmapPtr)pScreen->devPrivate));
-}
-
-/* With the introduction of pixmap privates, the "screen pixmap" can no
- * longer be created in miScreenInit, since all the modules that could
- * possibly ask for pixmap private space have not been initialized at
- * that time. pScreen->CreateScreenResources is called after all
- * possible private-requesting modules have been inited; we create the
- * screen pixmap here.
- */
-Bool
-miCreateScreenResources(ScreenPtr pScreen)
-{
- miScreenInitParmsPtr pScrInitParms;
- pointer value;
-
- pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
-
- /* if width is non-zero, pScreen->devPrivate will be a pixmap
- * else it will just take the value pbits
- */
- if (pScrInitParms->width)
- {
- PixmapPtr pPixmap;
-
- /* create a pixmap with no data, then redirect it to point to
- * the screen
- */
- pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
- if (!pPixmap)
- return FALSE;
-
- if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width,
- pScreen->height, pScreen->rootDepth,
- BitsPerPixel(pScreen->rootDepth),
- PixmapBytePad(pScrInitParms->width, pScreen->rootDepth),
- pScrInitParms->pbits))
- return FALSE;
- value = (pointer)pPixmap;
- }
- else
- {
- value = pScrInitParms->pbits;
- }
- free(pScreen->devPrivate); /* freeing miScreenInitParmsRec */
- pScreen->devPrivate = value; /* pPixmap or pbits */
- return TRUE;
-}
-
-Bool
-miScreenDevPrivateInit(ScreenPtr pScreen, int width, pointer pbits)
-{
- miScreenInitParmsPtr pScrInitParms;
-
- /* Stash pbits and width in a short-lived miScreenInitParmsRec attached
- * to the screen, until CreateScreenResources can put them in the
- * screen pixmap.
- */
- pScrInitParms = malloc(sizeof(miScreenInitParmsRec));
- if (!pScrInitParms)
- return FALSE;
- pScrInitParms->pbits = pbits;
- pScrInitParms->width = width;
- pScreen->devPrivate = (pointer)pScrInitParms;
- return TRUE;
-}
-
-static PixmapPtr
-miGetScreenPixmap(ScreenPtr pScreen)
-{
- return (PixmapPtr)(pScreen->devPrivate);
-}
-
-static void
-miSetScreenPixmap(PixmapPtr pPix)
-{
- if (pPix)
- pPix->drawable.pScreen->devPrivate = (pointer)pPix;
-}
-
-Bool
-miScreenInit(
- ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bits */
- int xsize, int ysize, /* in pixels */
- int dpix, int dpiy, /* dots per inch */
- int width, /* pixel width of frame buffer */
- int rootDepth, /* depth of root window */
- int numDepths, /* number of depths supported */
- DepthRec *depths, /* supported depths */
- VisualID rootVisual, /* root visual */
- int numVisuals, /* number of visuals supported */
- VisualRec *visuals /* supported visuals */
- )
-{
- pScreen->width = xsize;
- pScreen->height = ysize;
- pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10);
- pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10);
- pScreen->numDepths = numDepths;
- pScreen->rootDepth = rootDepth;
- pScreen->allowedDepths = depths;
- pScreen->rootVisual = rootVisual;
- /* defColormap */
- pScreen->minInstalledCmaps = 1;
- pScreen->maxInstalledCmaps = 1;
- pScreen->backingStoreSupport = NotUseful;
- pScreen->saveUnderSupport = NotUseful;
- /* whitePixel, blackPixel */
- pScreen->ModifyPixmapHeader = miModifyPixmapHeader;
- pScreen->CreateScreenResources = miCreateScreenResources;
- pScreen->GetScreenPixmap = miGetScreenPixmap;
- pScreen->SetScreenPixmap = miSetScreenPixmap;
- pScreen->numVisuals = numVisuals;
- pScreen->visuals = visuals;
- if (width)
- {
-#ifdef MITSHM
- ShmRegisterFbFuncs(pScreen);
-#endif
- pScreen->CloseScreen = miCloseScreen;
- }
- /* else CloseScreen */
- /* QueryBestSize, SaveScreen, GetImage, GetSpans */
- pScreen->SourceValidate = (SourceValidateProcPtr) 0;
- /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */
- /* RealizeWindow, UnrealizeWindow */
- pScreen->ValidateTree = miValidateTree;
- pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0;
- pScreen->WindowExposures = miWindowExposures;
- /* CopyWindow */
- pScreen->ClearToBackground = miClearToBackground;
- pScreen->ClipNotify = (ClipNotifyProcPtr) 0;
- pScreen->RestackWindow = (RestackWindowProcPtr) 0;
- /* CreatePixmap, DestroyPixmap */
- /* RealizeFont, UnrealizeFont */
- /* CreateGC */
- /* CreateColormap, DestroyColormap, InstallColormap, UninstallColormap */
- /* ListInstalledColormaps, StoreColors, ResolveColor */
- /* BitmapToRegion */
- pScreen->SendGraphicsExpose = miSendGraphicsExpose;
- pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
- pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA;
- pScreen->blockData = (pointer)0;
- pScreen->wakeupData = (pointer)0;
- pScreen->MarkWindow = miMarkWindow;
- pScreen->MarkOverlappedWindows = miMarkOverlappedWindows;
- pScreen->MoveWindow = miMoveWindow;
- pScreen->ResizeWindow = miSlideAndSizeWindow;
- pScreen->GetLayerWindow = miGetLayerWindow;
- pScreen->HandleExposures = miHandleValidateExposures;
- pScreen->ReparentWindow = (ReparentWindowProcPtr) 0;
- pScreen->ChangeBorderWidth = miChangeBorderWidth;
- pScreen->SetShape = miSetShape;
- pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow;
-
- miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS);
-
- return miScreenDevPrivateInit(pScreen, width, pbits);
-}
-
-DevPrivateKeyRec miZeroLineScreenKeyRec;
-
-void
-miSetZeroLineBias(ScreenPtr pScreen, unsigned int bias)
-{
- if (!dixRegisterPrivateKey(&miZeroLineScreenKeyRec, PRIVATE_SCREEN, 0))
- return;
-
- dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey,
- (unsigned long *)(unsigned long)bias);
-}
+/*
+
+Copyright 1990, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include "servermd.h"
+#include "misc.h"
+#include "mi.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "dix.h"
+#include "miline.h"
+#ifdef MITSHM
+#include <X11/extensions/shm.h>
+#include "shmint.h"
+#endif
+
+/* We use this structure to propogate some information from miScreenInit to
+ * miCreateScreenResources. miScreenInit allocates the structure, fills it
+ * in, and puts it into pScreen->devPrivate. miCreateScreenResources
+ * extracts the info and frees the structure. We could've accomplished the
+ * same thing by adding fields to the screen structure, but they would have
+ * ended up being redundant, and would have exposed this mi implementation
+ * detail to the whole server.
+ */
+
+typedef struct {
+ pointer pbits; /* pointer to framebuffer */
+ int width; /* delta to add to a framebuffer addr to move one row down */
+} miScreenInitParmsRec, *miScreenInitParmsPtr;
+
+/* this plugs into pScreen->ModifyPixmapHeader */
+Bool
+miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
+{
+ if (!pPixmap)
+ return FALSE;
+
+ /*
+ * If all arguments are specified, reinitialize everything (including
+ * validated state).
+ */
+ if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) &&
+ (devKind > 0) && pPixData) {
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = bitsPerPixel;
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->devKind = devKind;
+ pPixmap->refcnt = 1;
+ pPixmap->devPrivate.ptr = pPixData;
+ }
+ else {
+ /*
+ * Only modify specified fields, keeping all others intact.
+ */
+
+ if (width > 0)
+ pPixmap->drawable.width = width;
+
+ if (height > 0)
+ pPixmap->drawable.height = height;
+
+ if (depth > 0)
+ pPixmap->drawable.depth = depth;
+
+ if (bitsPerPixel > 0)
+ pPixmap->drawable.bitsPerPixel = bitsPerPixel;
+ else if ((bitsPerPixel < 0) && (depth > 0))
+ pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth);
+
+ /*
+ * CAVEAT: Non-SI DDXen may use devKind and devPrivate fields for
+ * other purposes.
+ */
+ if (devKind > 0)
+ pPixmap->devKind = devKind;
+ else if ((devKind < 0) && ((width > 0) || (depth > 0)))
+ pPixmap->devKind = PixmapBytePad(pPixmap->drawable.width,
+ pPixmap->drawable.depth);
+
+ if (pPixData)
+ pPixmap->devPrivate.ptr = pPixData;
+ }
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ return TRUE;
+}
+
+static Bool
+miCloseScreen(int iScreen, ScreenPtr pScreen)
+{
+ return ((*pScreen->DestroyPixmap) ((PixmapPtr) pScreen->devPrivate));
+}
+
+/* With the introduction of pixmap privates, the "screen pixmap" can no
+ * longer be created in miScreenInit, since all the modules that could
+ * possibly ask for pixmap private space have not been initialized at
+ * that time. pScreen->CreateScreenResources is called after all
+ * possible private-requesting modules have been inited; we create the
+ * screen pixmap here.
+ */
+Bool
+miCreateScreenResources(ScreenPtr pScreen)
+{
+ miScreenInitParmsPtr pScrInitParms;
+ pointer value;
+
+ pScrInitParms = (miScreenInitParmsPtr) pScreen->devPrivate;
+
+ /* if width is non-zero, pScreen->devPrivate will be a pixmap
+ * else it will just take the value pbits
+ */
+ if (pScrInitParms->width) {
+ PixmapPtr pPixmap;
+
+ /* create a pixmap with no data, then redirect it to point to
+ * the screen
+ */
+ pPixmap =
+ (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0);
+ if (!pPixmap)
+ return FALSE;
+
+ if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScreen->width,
+ pScreen->height,
+ pScreen->rootDepth,
+ BitsPerPixel(pScreen->rootDepth),
+ PixmapBytePad(pScrInitParms->width,
+ pScreen->rootDepth),
+ pScrInitParms->pbits))
+ return FALSE;
+ value = (pointer) pPixmap;
+ }
+ else {
+ value = pScrInitParms->pbits;
+ }
+ free(pScreen->devPrivate); /* freeing miScreenInitParmsRec */
+ pScreen->devPrivate = value; /* pPixmap or pbits */
+ return TRUE;
+}
+
+Bool
+miScreenDevPrivateInit(ScreenPtr pScreen, int width, pointer pbits)
+{
+ miScreenInitParmsPtr pScrInitParms;
+
+ /* Stash pbits and width in a short-lived miScreenInitParmsRec attached
+ * to the screen, until CreateScreenResources can put them in the
+ * screen pixmap.
+ */
+ pScrInitParms = malloc(sizeof(miScreenInitParmsRec));
+ if (!pScrInitParms)
+ return FALSE;
+ pScrInitParms->pbits = pbits;
+ pScrInitParms->width = width;
+ pScreen->devPrivate = (pointer) pScrInitParms;
+ return TRUE;
+}
+
+static PixmapPtr
+miGetScreenPixmap(ScreenPtr pScreen)
+{
+ return (PixmapPtr) (pScreen->devPrivate);
+}
+
+static void
+miSetScreenPixmap(PixmapPtr pPix)
+{
+ if (pPix)
+ pPix->drawable.pScreen->devPrivate = (pointer) pPix;
+}
+
+Bool
+miScreenInit(ScreenPtr pScreen, pointer pbits, /* pointer to screen bits */
+ int xsize, int ysize, /* in pixels */
+ int dpix, int dpiy, /* dots per inch */
+ int width, /* pixel width of frame buffer */
+ int rootDepth, /* depth of root window */
+ int numDepths, /* number of depths supported */
+ DepthRec * depths, /* supported depths */
+ VisualID rootVisual, /* root visual */
+ int numVisuals, /* number of visuals supported */
+ VisualRec * visuals /* supported visuals */
+ )
+{
+ pScreen->width = xsize;
+ pScreen->height = ysize;
+ pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10);
+ pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10);
+ pScreen->numDepths = numDepths;
+ pScreen->rootDepth = rootDepth;
+ pScreen->allowedDepths = depths;
+ pScreen->rootVisual = rootVisual;
+ /* defColormap */
+ pScreen->minInstalledCmaps = 1;
+ pScreen->maxInstalledCmaps = 1;
+ pScreen->backingStoreSupport = NotUseful;
+ pScreen->saveUnderSupport = NotUseful;
+ /* whitePixel, blackPixel */
+ pScreen->ModifyPixmapHeader = miModifyPixmapHeader;
+ pScreen->CreateScreenResources = miCreateScreenResources;
+ pScreen->GetScreenPixmap = miGetScreenPixmap;
+ pScreen->SetScreenPixmap = miSetScreenPixmap;
+ pScreen->numVisuals = numVisuals;
+ pScreen->visuals = visuals;
+ if (width) {
+#ifdef MITSHM
+ ShmRegisterFbFuncs(pScreen);
+#endif
+ pScreen->CloseScreen = miCloseScreen;
+ }
+ /* else CloseScreen */
+ /* QueryBestSize, SaveScreen, GetImage, GetSpans */
+ pScreen->SourceValidate = (SourceValidateProcPtr) 0;
+ /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */
+ /* RealizeWindow, UnrealizeWindow */
+ pScreen->ValidateTree = miValidateTree;
+ pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0;
+ pScreen->WindowExposures = miWindowExposures;
+ /* CopyWindow */
+ pScreen->ClearToBackground = miClearToBackground;
+ pScreen->ClipNotify = (ClipNotifyProcPtr) 0;
+ pScreen->RestackWindow = (RestackWindowProcPtr) 0;
+ /* CreatePixmap, DestroyPixmap */
+ /* RealizeFont, UnrealizeFont */
+ /* CreateGC */
+ /* CreateColormap, DestroyColormap, InstallColormap, UninstallColormap */
+ /* ListInstalledColormaps, StoreColors, ResolveColor */
+ /* BitmapToRegion */
+ pScreen->SendGraphicsExpose = miSendGraphicsExpose;
+ pScreen->BlockHandler = (ScreenBlockHandlerProcPtr) NoopDDA;
+ pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr) NoopDDA;
+ pScreen->blockData = (pointer) 0;
+ pScreen->wakeupData = (pointer) 0;
+ pScreen->MarkWindow = miMarkWindow;
+ pScreen->MarkOverlappedWindows = miMarkOverlappedWindows;
+ pScreen->MoveWindow = miMoveWindow;
+ pScreen->ResizeWindow = miSlideAndSizeWindow;
+ pScreen->GetLayerWindow = miGetLayerWindow;
+ pScreen->HandleExposures = miHandleValidateExposures;
+ pScreen->ReparentWindow = (ReparentWindowProcPtr) 0;
+ pScreen->ChangeBorderWidth = miChangeBorderWidth;
+ pScreen->SetShape = miSetShape;
+ pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow;
+
+ miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS);
+
+ return miScreenDevPrivateInit(pScreen, width, pbits);
+}
+
+DevPrivateKeyRec miZeroLineScreenKeyRec;
+
+void
+miSetZeroLineBias(ScreenPtr pScreen, unsigned int bias)
+{
+ if (!dixRegisterPrivateKey(&miZeroLineScreenKeyRec, PRIVATE_SCREEN, 0))
+ return;
+
+ dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey,
+ (unsigned long *) (unsigned long) bias);
+}
diff --git a/xorg-server/mi/mispans.c b/xorg-server/mi/mispans.c
index 21ba4da4f..0f89880e2 100644
--- a/xorg-server/mi/mispans.c
+++ b/xorg-server/mi/mispans.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -45,7 +44,6 @@ SOFTWARE.
******************************************************************/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -64,168 +62,173 @@ Written by Joel McCormack, Summer 1989.
*/
-
-void miInitSpanGroup(SpanGroup *spanGroup)
+void
+miInitSpanGroup(SpanGroup * spanGroup)
{
spanGroup->size = 0;
spanGroup->count = 0;
spanGroup->group = NULL;
spanGroup->ymin = MAXSHORT;
spanGroup->ymax = MINSHORT;
-} /* InitSpanGroup */
+} /* InitSpanGroup */
#define YMIN(spans) (spans->points[0].y)
#define YMAX(spans) (spans->points[spans->count-1].y)
-static void miSubtractSpans (SpanGroup *spanGroup, Spans *sub)
+static void
+miSubtractSpans(SpanGroup * spanGroup, Spans * sub)
{
- int i, subCount, spansCount;
- int ymin, ymax, xmin, xmax;
- Spans *spans;
- DDXPointPtr subPt, spansPt;
- int *subWid, *spansWid;
- int extra;
+ int i, subCount, spansCount;
+ int ymin, ymax, xmin, xmax;
+ Spans *spans;
+ DDXPointPtr subPt, spansPt;
+ int *subWid, *spansWid;
+ int extra;
ymin = YMIN(sub);
ymax = YMAX(sub);
spans = spanGroup->group;
for (i = spanGroup->count; i; i--, spans++) {
- if (YMIN(spans) <= ymax && ymin <= YMAX(spans)) {
- subCount = sub->count;
- subPt = sub->points;
- subWid = sub->widths;
- spansCount = spans->count;
- spansPt = spans->points;
- spansWid = spans->widths;
- extra = 0;
- for (;;)
- {
- while (spansCount && spansPt->y < subPt->y)
- {
- spansPt++; spansWid++; spansCount--;
- }
- if (!spansCount)
- break;
- while (subCount && subPt->y < spansPt->y)
- {
- subPt++; subWid++; subCount--;
- }
- if (!subCount)
- break;
- if (subPt->y == spansPt->y)
- {
- xmin = subPt->x;
- xmax = xmin + *subWid;
- if (xmin >= spansPt->x + *spansWid || spansPt->x >= xmax)
- {
- ;
- }
- else if (xmin <= spansPt->x)
- {
- if (xmax >= spansPt->x + *spansWid)
- {
- memmove (spansPt, spansPt + 1, sizeof *spansPt * (spansCount - 1));
- memmove (spansWid, spansWid + 1, sizeof *spansWid * (spansCount - 1));
- spansPt--;
- spansWid--;
- spans->count--;
- extra++;
- }
- else
- {
- *spansWid = *spansWid - (xmax - spansPt->x);
- spansPt->x = xmax;
- }
- }
- else
- {
- if (xmax >= spansPt->x + *spansWid)
- {
- *spansWid = xmin - spansPt->x;
- }
- else
- {
- if (!extra) {
- DDXPointPtr newPt;
- int *newwid;
+ if (YMIN(spans) <= ymax && ymin <= YMAX(spans)) {
+ subCount = sub->count;
+ subPt = sub->points;
+ subWid = sub->widths;
+ spansCount = spans->count;
+ spansPt = spans->points;
+ spansWid = spans->widths;
+ extra = 0;
+ for (;;) {
+ while (spansCount && spansPt->y < subPt->y) {
+ spansPt++;
+ spansWid++;
+ spansCount--;
+ }
+ if (!spansCount)
+ break;
+ while (subCount && subPt->y < spansPt->y) {
+ subPt++;
+ subWid++;
+ subCount--;
+ }
+ if (!subCount)
+ break;
+ if (subPt->y == spansPt->y) {
+ xmin = subPt->x;
+ xmax = xmin + *subWid;
+ if (xmin >= spansPt->x + *spansWid || spansPt->x >= xmax) {
+ ;
+ }
+ else if (xmin <= spansPt->x) {
+ if (xmax >= spansPt->x + *spansWid) {
+ memmove(spansPt, spansPt + 1,
+ sizeof *spansPt * (spansCount - 1));
+ memmove(spansWid, spansWid + 1,
+ sizeof *spansWid * (spansCount - 1));
+ spansPt--;
+ spansWid--;
+ spans->count--;
+ extra++;
+ }
+ else {
+ *spansWid = *spansWid - (xmax - spansPt->x);
+ spansPt->x = xmax;
+ }
+ }
+ else {
+ if (xmax >= spansPt->x + *spansWid) {
+ *spansWid = xmin - spansPt->x;
+ }
+ else {
+ if (!extra) {
+ DDXPointPtr newPt;
+ int *newwid;
#define EXTRA 8
- newPt = (DDXPointPtr) realloc(spans->points, (spans->count + EXTRA) * sizeof (DDXPointRec));
- if (!newPt)
- break;
- spansPt = newPt + (spansPt - spans->points);
- spans->points = newPt;
- newwid = (int *) realloc(spans->widths, (spans->count + EXTRA) * sizeof (int));
- if (!newwid)
- break;
- spansWid = newwid + (spansWid - spans->widths);
- spans->widths = newwid;
- extra = EXTRA;
- }
- memmove (spansPt + 1, spansPt, sizeof *spansPt * (spansCount));
- memmove (spansWid + 1, spansWid, sizeof *spansWid * (spansCount));
- spans->count++;
- extra--;
- *spansWid = xmin - spansPt->x;
- spansWid++;
- spansPt++;
- *spansWid = *spansWid - (xmax - spansPt->x);
- spansPt->x = xmax;
- }
- }
- }
- spansPt++; spansWid++; spansCount--;
- }
- }
+ newPt =
+ (DDXPointPtr) realloc(spans->points,
+ (spans->count +
+ EXTRA) *
+ sizeof(DDXPointRec));
+ if (!newPt)
+ break;
+ spansPt = newPt + (spansPt - spans->points);
+ spans->points = newPt;
+ newwid =
+ (int *) realloc(spans->widths,
+ (spans->count +
+ EXTRA) * sizeof(int));
+ if (!newwid)
+ break;
+ spansWid = newwid + (spansWid - spans->widths);
+ spans->widths = newwid;
+ extra = EXTRA;
+ }
+ memmove(spansPt + 1, spansPt,
+ sizeof *spansPt * (spansCount));
+ memmove(spansWid + 1, spansWid,
+ sizeof *spansWid * (spansCount));
+ spans->count++;
+ extra--;
+ *spansWid = xmin - spansPt->x;
+ spansWid++;
+ spansPt++;
+ *spansWid = *spansWid - (xmax - spansPt->x);
+ spansPt->x = xmax;
+ }
+ }
+ }
+ spansPt++;
+ spansWid++;
+ spansCount--;
+ }
+ }
}
}
-void miAppendSpans(SpanGroup *spanGroup, SpanGroup *otherGroup, Spans *spans)
+void
+miAppendSpans(SpanGroup * spanGroup, SpanGroup * otherGroup, Spans * spans)
{
int ymin, ymax;
int spansCount;
spansCount = spans->count;
if (spansCount > 0) {
- if (spanGroup->size == spanGroup->count) {
- spanGroup->size = (spanGroup->size + 8) * 2;
- spanGroup->group = (Spans *)
- realloc(spanGroup->group, sizeof(Spans) * spanGroup->size);
- }
-
- spanGroup->group[spanGroup->count] = *spans;
- (spanGroup->count)++;
- ymin = spans->points[0].y;
- if (ymin < spanGroup->ymin) spanGroup->ymin = ymin;
- ymax = spans->points[spansCount - 1].y;
- if (ymax > spanGroup->ymax) spanGroup->ymax = ymax;
- if (otherGroup &&
- otherGroup->ymin < ymax &&
- ymin < otherGroup->ymax)
- {
- miSubtractSpans (otherGroup, spans);
- }
+ if (spanGroup->size == spanGroup->count) {
+ spanGroup->size = (spanGroup->size + 8) * 2;
+ spanGroup->group = (Spans *)
+ realloc(spanGroup->group, sizeof(Spans) * spanGroup->size);
+ }
+
+ spanGroup->group[spanGroup->count] = *spans;
+ (spanGroup->count)++;
+ ymin = spans->points[0].y;
+ if (ymin < spanGroup->ymin)
+ spanGroup->ymin = ymin;
+ ymax = spans->points[spansCount - 1].y;
+ if (ymax > spanGroup->ymax)
+ spanGroup->ymax = ymax;
+ if (otherGroup && otherGroup->ymin < ymax && ymin < otherGroup->ymax) {
+ miSubtractSpans(otherGroup, spans);
+ }
}
- else
- {
- free(spans->points);
- free(spans->widths);
+ else {
+ free(spans->points);
+ free(spans->widths);
}
-} /* AppendSpans */
+} /* AppendSpans */
-void miFreeSpanGroup(SpanGroup *spanGroup)
+void
+miFreeSpanGroup(SpanGroup * spanGroup)
{
free(spanGroup->group);
}
-static void QuickSortSpansX(
- DDXPointRec points[],
- int widths[],
- int numSpans )
+static void
+QuickSortSpansX(DDXPointRec points[], int widths[], int numSpans)
{
- int x;
- int i, j, m;
- DDXPointPtr r;
+ int x;
+ int i, j, m;
+ DDXPointPtr r;
/* Always called with numSpans > 1 */
/* Sorts only by x, as all y should be the same */
@@ -240,86 +243,87 @@ static void QuickSortSpansX(
}
do {
- if (numSpans < 9) {
- /* Do insertion sort */
- int xprev;
-
- xprev = points[0].x;
- i = 1;
- do { /* while i != numSpans */
- x = points[i].x;
- if (xprev > x) {
- /* points[i] is out of order. Move into proper location. */
- DDXPointRec tpt;
- int tw, k;
-
- for (j = 0; x >= points[j].x; j++) {}
- tpt = points[i];
- tw = widths[i];
- for (k = i; k != j; k--) {
- points[k] = points[k-1];
- widths[k] = widths[k-1];
- }
- points[j] = tpt;
- widths[j] = tw;
- x = points[i].x;
- } /* if out of order */
- xprev = x;
- i++;
- } while (i != numSpans);
- return;
- }
-
- /* Choose partition element, stick in location 0 */
- m = numSpans / 2;
- if (points[m].x > points[0].x) ExchangeSpans(m, 0);
- if (points[m].x > points[numSpans-1].x) ExchangeSpans(m, numSpans-1);
- if (points[m].x > points[0].x) ExchangeSpans(m, 0);
- x = points[0].x;
+ if (numSpans < 9) {
+ /* Do insertion sort */
+ int xprev;
+
+ xprev = points[0].x;
+ i = 1;
+ do { /* while i != numSpans */
+ x = points[i].x;
+ if (xprev > x) {
+ /* points[i] is out of order. Move into proper location. */
+ DDXPointRec tpt;
+ int tw, k;
+
+ for (j = 0; x >= points[j].x; j++) {
+ }
+ tpt = points[i];
+ tw = widths[i];
+ for (k = i; k != j; k--) {
+ points[k] = points[k - 1];
+ widths[k] = widths[k - 1];
+ }
+ points[j] = tpt;
+ widths[j] = tw;
+ x = points[i].x;
+ } /* if out of order */
+ xprev = x;
+ i++;
+ } while (i != numSpans);
+ return;
+ }
+
+ /* Choose partition element, stick in location 0 */
+ m = numSpans / 2;
+ if (points[m].x > points[0].x)
+ ExchangeSpans(m, 0);
+ if (points[m].x > points[numSpans - 1].x)
+ ExchangeSpans(m, numSpans - 1);
+ if (points[m].x > points[0].x)
+ ExchangeSpans(m, 0);
+ x = points[0].x;
/* Partition array */
i = 0;
j = numSpans;
do {
- r = &(points[i]);
- do {
- r++;
- i++;
+ r = &(points[i]);
+ do {
+ r++;
+ i++;
} while (i != numSpans && r->x < x);
- r = &(points[j]);
- do {
- r--;
- j--;
+ r = &(points[j]);
+ do {
+ r--;
+ j--;
} while (x < r->x);
- if (i < j) ExchangeSpans(i, j);
+ if (i < j)
+ ExchangeSpans(i, j);
} while (i < j);
/* Move partition element back to middle */
ExchangeSpans(0, j);
- /* Recurse */
- if (numSpans-j-1 > 1)
- QuickSortSpansX(&points[j+1], &widths[j+1], numSpans-j-1);
+ /* Recurse */
+ if (numSpans - j - 1 > 1)
+ QuickSortSpansX(&points[j + 1], &widths[j + 1], numSpans - j - 1);
numSpans = j;
} while (numSpans > 1);
-} /* QuickSortSpans */
-
+} /* QuickSortSpans */
-static int UniquifySpansX(
- Spans *spans,
- DDXPointRec *newPoints,
- int *newWidths )
+static int
+UniquifySpansX(Spans * spans, DDXPointRec * newPoints, int *newWidths)
{
- int newx1, newx2, oldpt, i, y;
- DDXPointRec *oldPoints;
- int *oldWidths;
- int *startNewWidths;
+ int newx1, newx2, oldpt, i, y;
+ DDXPointRec *oldPoints;
+ int *oldWidths;
+ int *startNewWidths;
/* Always called with numSpans > 1 */
/* Uniquify the spans, and stash them into newPoints and newWidths. Return the
number of unique spans. */
-
startNewWidths = newWidths;
oldPoints = spans->points;
@@ -329,25 +333,27 @@ static int UniquifySpansX(
newx1 = oldPoints->x;
newx2 = newx1 + *oldWidths;
- for (i = spans->count-1; i != 0; i--) {
- oldPoints++;
- oldWidths++;
- oldpt = oldPoints->x;
- if (oldpt > newx2) {
- /* Write current span, start a new one */
- newPoints->x = newx1;
- newPoints->y = y;
- *newWidths = newx2 - newx1;
- newPoints++;
- newWidths++;
- newx1 = oldpt;
- newx2 = oldpt + *oldWidths;
- } else {
- /* extend current span, if old extends beyond new */
- oldpt = oldpt + *oldWidths;
- if (oldpt > newx2) newx2 = oldpt;
- }
- } /* for */
+ for (i = spans->count - 1; i != 0; i--) {
+ oldPoints++;
+ oldWidths++;
+ oldpt = oldPoints->x;
+ if (oldpt > newx2) {
+ /* Write current span, start a new one */
+ newPoints->x = newx1;
+ newPoints->y = y;
+ *newWidths = newx2 - newx1;
+ newPoints++;
+ newWidths++;
+ newx1 = oldpt;
+ newx2 = oldpt + *oldWidths;
+ }
+ else {
+ /* extend current span, if old extends beyond new */
+ oldpt = oldpt + *oldWidths;
+ if (oldpt > newx2)
+ newx2 = oldpt;
+ }
+ } /* for */
/* Write final span */
newPoints->x = newx1;
@@ -355,170 +361,167 @@ static int UniquifySpansX(
newPoints->y = y;
return (newWidths - startNewWidths) + 1;
-} /* UniquifySpansX */
+} /* UniquifySpansX */
static void
-miDisposeSpanGroup (SpanGroup *spanGroup)
+miDisposeSpanGroup(SpanGroup * spanGroup)
{
- int i;
- Spans *spans;
-
- for (i = 0; i < spanGroup->count; i++)
- {
- spans = spanGroup->group + i;
- free(spans->points);
- free(spans->widths);
+ int i;
+ Spans *spans;
+
+ for (i = 0; i < spanGroup->count; i++) {
+ spans = spanGroup->group + i;
+ free(spans->points);
+ free(spans->widths);
}
}
-void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
+void
+miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup)
{
- int i;
- Spans *spans;
- Spans *yspans;
- int *ysizes;
- int ymin, ylength;
+ int i;
+ Spans *spans;
+ Spans *yspans;
+ int *ysizes;
+ int ymin, ylength;
/* Outgoing spans for one big call to FillSpans */
- DDXPointPtr points;
- int *widths;
- int count;
+ DDXPointPtr points;
+ int *widths;
+ int count;
- if (spanGroup->count == 0) return;
+ if (spanGroup->count == 0)
+ return;
if (spanGroup->count == 1) {
- /* Already should be sorted, unique */
- spans = spanGroup->group;
- (*pGC->ops->FillSpans)
- (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE);
- free(spans->points);
- free(spans->widths);
+ /* Already should be sorted, unique */
+ spans = spanGroup->group;
+ (*pGC->ops->FillSpans)
+ (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE);
+ free(spans->points);
+ free(spans->widths);
}
- else
- {
- /* Yuck. Gross. Radix sort into y buckets, then sort x and uniquify */
- /* This seems to be the fastest thing to do. I've tried sorting on
- both x and y at the same time rather than creating into all those
- y buckets, but it was somewhat slower. */
-
- ymin = spanGroup->ymin;
- ylength = spanGroup->ymax - ymin + 1;
-
- /* Allocate Spans for y buckets */
- yspans = malloc(ylength * sizeof(Spans));
- ysizes = malloc(ylength * sizeof (int));
-
- if (!yspans || !ysizes)
- {
- free(yspans);
- free(ysizes);
- miDisposeSpanGroup (spanGroup);
- return;
- }
-
- for (i = 0; i != ylength; i++) {
- ysizes[i] = 0;
- yspans[i].count = 0;
- yspans[i].points = NULL;
- yspans[i].widths = NULL;
- }
-
- /* Go through every single span and put it into the correct bucket */
- count = 0;
- for (i = 0, spans = spanGroup->group;
- i != spanGroup->count;
- i++, spans++) {
- int index;
- int j;
-
- for (j = 0, points = spans->points, widths = spans->widths;
- j != spans->count;
- j++, points++, widths++) {
- index = points->y - ymin;
- if (index >= 0 && index < ylength) {
- Spans *newspans = &(yspans[index]);
- if (newspans->count == ysizes[index]) {
- DDXPointPtr newpoints;
- int *newwidths;
- ysizes[index] = (ysizes[index] + 8) * 2;
- newpoints = (DDXPointPtr) realloc(
- newspans->points,
- ysizes[index] * sizeof(DDXPointRec));
- newwidths = (int *) realloc(
- newspans->widths,
- ysizes[index] * sizeof(int));
- if (!newpoints || !newwidths)
- {
- int i;
-
- for (i = 0; i < ylength; i++)
- {
- free(yspans[i].points);
- free(yspans[i].widths);
- }
- free(yspans);
- free(ysizes);
- free(newpoints);
- free(newwidths);
- miDisposeSpanGroup (spanGroup);
- return;
- }
- newspans->points = newpoints;
- newspans->widths = newwidths;
- }
- newspans->points[newspans->count] = *points;
- newspans->widths[newspans->count] = *widths;
- (newspans->count)++;
- } /* if y value of span in range */
- } /* for j through spans */
- count += spans->count;
- free(spans->points);
- spans->points = NULL;
- free(spans->widths);
- spans->widths = NULL;
- } /* for i thorough Spans */
-
- /* Now sort by x and uniquify each bucket into the final array */
- points = malloc(count * sizeof(DDXPointRec));
- widths = malloc(count * sizeof(int));
- if (!points || !widths)
- {
- int i;
-
- for (i = 0; i < ylength; i++)
- {
- free(yspans[i].points);
- free(yspans[i].widths);
- }
- free(yspans);
- free(ysizes);
- free(points);
- free(widths);
- return;
- }
- count = 0;
- for (i = 0; i != ylength; i++) {
- int ycount = yspans[i].count;
- if (ycount > 0) {
- if (ycount > 1) {
- QuickSortSpansX(yspans[i].points, yspans[i].widths, ycount);
- count += UniquifySpansX
- (&(yspans[i]), &(points[count]), &(widths[count]));
- } else {
- points[count] = yspans[i].points[0];
- widths[count] = yspans[i].widths[0];
- count++;
- }
- free(yspans[i].points);
- free(yspans[i].widths);
- }
- }
-
- (*pGC->ops->FillSpans) (pDraw, pGC, count, points, widths, TRUE);
- free(points);
- free(widths);
- free(yspans);
- free(ysizes); /* use (DE)xalloc for these? */
+ else {
+ /* Yuck. Gross. Radix sort into y buckets, then sort x and uniquify */
+ /* This seems to be the fastest thing to do. I've tried sorting on
+ both x and y at the same time rather than creating into all those
+ y buckets, but it was somewhat slower. */
+
+ ymin = spanGroup->ymin;
+ ylength = spanGroup->ymax - ymin + 1;
+
+ /* Allocate Spans for y buckets */
+ yspans = malloc(ylength * sizeof(Spans));
+ ysizes = malloc(ylength * sizeof(int));
+
+ if (!yspans || !ysizes) {
+ free(yspans);
+ free(ysizes);
+ miDisposeSpanGroup(spanGroup);
+ return;
+ }
+
+ for (i = 0; i != ylength; i++) {
+ ysizes[i] = 0;
+ yspans[i].count = 0;
+ yspans[i].points = NULL;
+ yspans[i].widths = NULL;
+ }
+
+ /* Go through every single span and put it into the correct bucket */
+ count = 0;
+ for (i = 0, spans = spanGroup->group;
+ i != spanGroup->count; i++, spans++) {
+ int index;
+ int j;
+
+ for (j = 0, points = spans->points, widths = spans->widths;
+ j != spans->count; j++, points++, widths++) {
+ index = points->y - ymin;
+ if (index >= 0 && index < ylength) {
+ Spans *newspans = &(yspans[index]);
+
+ if (newspans->count == ysizes[index]) {
+ DDXPointPtr newpoints;
+ int *newwidths;
+
+ ysizes[index] = (ysizes[index] + 8) * 2;
+ newpoints = (DDXPointPtr) realloc(newspans->points,
+ ysizes[index] *
+ sizeof(DDXPointRec));
+ newwidths =
+ (int *) realloc(newspans->widths,
+ ysizes[index] * sizeof(int));
+ if (!newpoints || !newwidths) {
+ int i;
+
+ for (i = 0; i < ylength; i++) {
+ free(yspans[i].points);
+ free(yspans[i].widths);
+ }
+ free(yspans);
+ free(ysizes);
+ free(newpoints);
+ free(newwidths);
+ miDisposeSpanGroup(spanGroup);
+ return;
+ }
+ newspans->points = newpoints;
+ newspans->widths = newwidths;
+ }
+ newspans->points[newspans->count] = *points;
+ newspans->widths[newspans->count] = *widths;
+ (newspans->count)++;
+ } /* if y value of span in range */
+ } /* for j through spans */
+ count += spans->count;
+ free(spans->points);
+ spans->points = NULL;
+ free(spans->widths);
+ spans->widths = NULL;
+ } /* for i thorough Spans */
+
+ /* Now sort by x and uniquify each bucket into the final array */
+ points = malloc(count * sizeof(DDXPointRec));
+ widths = malloc(count * sizeof(int));
+ if (!points || !widths) {
+ int i;
+
+ for (i = 0; i < ylength; i++) {
+ free(yspans[i].points);
+ free(yspans[i].widths);
+ }
+ free(yspans);
+ free(ysizes);
+ free(points);
+ free(widths);
+ return;
+ }
+ count = 0;
+ for (i = 0; i != ylength; i++) {
+ int ycount = yspans[i].count;
+
+ if (ycount > 0) {
+ if (ycount > 1) {
+ QuickSortSpansX(yspans[i].points, yspans[i].widths, ycount);
+ count += UniquifySpansX
+ (&(yspans[i]), &(points[count]), &(widths[count]));
+ }
+ else {
+ points[count] = yspans[i].points[0];
+ widths[count] = yspans[i].widths[0];
+ count++;
+ }
+ free(yspans[i].points);
+ free(yspans[i].widths);
+ }
+ }
+
+ (*pGC->ops->FillSpans) (pDraw, pGC, count, points, widths, TRUE);
+ free(points);
+ free(widths);
+ free(yspans);
+ free(ysizes); /* use (DE)xalloc for these? */
}
spanGroup->count = 0;
diff --git a/xorg-server/mi/mispans.h b/xorg-server/mi/mispans.h
index 5a5f5d2b6..f3148ff19 100644
--- a/xorg-server/mi/mispans.h
+++ b/xorg-server/mi/mispans.h
@@ -1,92 +1,87 @@
-/***********************************************************
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifndef MISPANS_H
-#define MISPANS_H
-
-typedef struct {
- int count; /* number of spans */
- DDXPointPtr points; /* pointer to list of start points */
- int *widths; /* pointer to list of widths */
-} Spans;
-
-typedef struct {
- int size; /* Total number of *Spans allocated */
- int count; /* Number of *Spans actually in group */
- Spans *group; /* List of Spans */
- int ymin, ymax; /* Min, max y values encountered */
-} SpanGroup;
-
-/* Initialize SpanGroup. MUST BE DONE before use. */
-extern _X_EXPORT void miInitSpanGroup(
- SpanGroup * /*spanGroup*/
-);
-
-/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */
-extern _X_EXPORT void miAppendSpans(
- SpanGroup * /*spanGroup*/,
- SpanGroup * /*otherGroup*/,
- Spans * /*spans*/
-);
-
-/* Paint a span group, insuring that each pixel is painted at most once */
-extern _X_EXPORT void miFillUniqueSpanGroup(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- SpanGroup * /*spanGroup*/
-);
-
-/* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */
-extern _X_EXPORT void miFreeSpanGroup(
- SpanGroup * /*spanGroup*/
-);
-
-/* Rops which must use span groups */
-#define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2)
-#define miSpansEasyRop(rop) (!miSpansCarefulRop(rop))
-
-#endif /* MISPANS_H */
+/***********************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef MISPANS_H
+#define MISPANS_H
+
+typedef struct {
+ int count; /* number of spans */
+ DDXPointPtr points; /* pointer to list of start points */
+ int *widths; /* pointer to list of widths */
+} Spans;
+
+typedef struct {
+ int size; /* Total number of *Spans allocated */
+ int count; /* Number of *Spans actually in group */
+ Spans *group; /* List of Spans */
+ int ymin, ymax; /* Min, max y values encountered */
+} SpanGroup;
+
+/* Initialize SpanGroup. MUST BE DONE before use. */
+extern _X_EXPORT void miInitSpanGroup(SpanGroup * /*spanGroup */
+ );
+
+/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */
+extern _X_EXPORT void miAppendSpans(SpanGroup * /*spanGroup */ ,
+ SpanGroup * /*otherGroup */ ,
+ Spans * /*spans */
+ );
+
+/* Paint a span group, insuring that each pixel is painted at most once */
+extern _X_EXPORT void miFillUniqueSpanGroup(DrawablePtr /*pDraw */ ,
+ GCPtr /*pGC */ ,
+ SpanGroup * /*spanGroup */
+ );
+
+/* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */
+extern _X_EXPORT void miFreeSpanGroup(SpanGroup * /*spanGroup */
+ );
+
+/* Rops which must use span groups */
+#define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2)
+#define miSpansEasyRop(rop) (!miSpansCarefulRop(rop))
+
+#endif /* MISPANS_H */
diff --git a/xorg-server/mi/misprite.c b/xorg-server/mi/misprite.c
index f0c008143..db35d667e 100644
--- a/xorg-server/mi/misprite.c
+++ b/xorg-server/mi/misprite.c
@@ -53,16 +53,16 @@ in this Software without prior written authorization from The Open Group.
#include "damage.h"
typedef struct {
- CursorPtr pCursor;
- int x; /* cursor hotspot */
- int y;
- BoxRec saved; /* saved area from the screen */
- Bool isUp; /* cursor in frame buffer */
- Bool shouldBeUp; /* cursor should be displayed */
- WindowPtr pCacheWin; /* window the cursor last seen in */
- Bool isInCacheWin;
- Bool checkPixels; /* check colormap collision */
- ScreenPtr pScreen;
+ CursorPtr pCursor;
+ int x; /* cursor hotspot */
+ int y;
+ BoxRec saved; /* saved area from the screen */
+ Bool isUp; /* cursor in frame buffer */
+ Bool shouldBeUp; /* cursor should be displayed */
+ WindowPtr pCacheWin; /* window the cursor last seen in */
+ Bool isInCacheWin;
+ Bool checkPixels; /* check colormap collision */
+ ScreenPtr pScreen;
} miCursorInfoRec, *miCursorInfoPtr;
/*
@@ -71,32 +71,32 @@ typedef struct {
typedef struct {
/* screen procedures */
- CloseScreenProcPtr CloseScreen;
- GetImageProcPtr GetImage;
- GetSpansProcPtr GetSpans;
- SourceValidateProcPtr SourceValidate;
-
+ CloseScreenProcPtr CloseScreen;
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ SourceValidateProcPtr SourceValidate;
+
/* window procedures */
- CopyWindowProcPtr CopyWindow;
-
+ CopyWindowProcPtr CopyWindow;
+
/* colormap procedures */
- InstallColormapProcPtr InstallColormap;
- StoreColorsProcPtr StoreColors;
-
+ InstallColormapProcPtr InstallColormap;
+ StoreColorsProcPtr StoreColors;
+
/* os layer procedures */
- ScreenBlockHandlerProcPtr BlockHandler;
-
+ ScreenBlockHandlerProcPtr BlockHandler;
+
/* device cursor procedures */
- DeviceCursorInitializeProcPtr DeviceCursorInitialize;
- DeviceCursorCleanupProcPtr DeviceCursorCleanup;
-
- xColorItem colors[2];
- ColormapPtr pInstalledMap;
- ColormapPtr pColormap;
- VisualPtr pVisual;
- DamagePtr pDamage; /* damage tracking structure */
- Bool damageRegistered;
- int numberOfCursors;
+ DeviceCursorInitializeProcPtr DeviceCursorInitialize;
+ DeviceCursorCleanupProcPtr DeviceCursorCleanup;
+
+ xColorItem colors[2];
+ ColormapPtr pInstalledMap;
+ ColormapPtr pColormap;
+ VisualPtr pVisual;
+ DamagePtr pDamage; /* damage tracking structure */
+ Bool damageRegistered;
+ int numberOfCursors;
} miSpriteScreenRec, *miSpriteScreenPtr;
#define SOURCE_COLOR 0
@@ -134,7 +134,6 @@ typedef struct {
#define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \
BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2))
-
#define SPRITE_DEBUG_ENABLE 0
#if SPRITE_DEBUG_ENABLE
#define SPRITE_DEBUG(x) ErrorF x
@@ -151,9 +150,9 @@ static void
miSpriteDisableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv)
{
if (pScreenPriv->damageRegistered) {
- DamageUnregister (&(pScreen->GetScreenPixmap(pScreen)->drawable),
- pScreenPriv->pDamage);
- pScreenPriv->damageRegistered = 0;
+ DamageUnregister(&(pScreen->GetScreenPixmap(pScreen)->drawable),
+ pScreenPriv->pDamage);
+ pScreenPriv->damageRegistered = 0;
}
}
@@ -161,9 +160,9 @@ static void
miSpriteEnableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv)
{
if (!pScreenPriv->damageRegistered) {
- pScreenPriv->damageRegistered = 1;
- DamageRegister (&(pScreen->GetScreenPixmap(pScreen)->drawable),
- pScreenPriv->pDamage);
+ pScreenPriv->damageRegistered = 1;
+ DamageRegister(&(pScreen->GetScreenPixmap(pScreen)->drawable),
+ pScreenPriv->pDamage);
}
}
@@ -184,39 +183,36 @@ miSpriteIsDown(miCursorInfoPtr pDevCursor)
*/
static DevPrivateKeyRec miSpriteScreenKeyRec;
+
#define miSpriteScreenKey (&miSpriteScreenKeyRec)
#define GetSpriteScreen(pScreen) \
(dixLookupPrivate(&(pScreen)->devPrivates, miSpriteScreenKey))
static DevPrivateKeyRec miSpriteDevPrivatesKeyRec;
+
#define miSpriteDevPrivatesKey (&miSpriteDevPrivatesKeyRec)
-static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen);
-static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy,
- int w, int h, unsigned int format,
- unsigned long planemask, char *pdstLine);
-static void miSpriteGetSpans(DrawablePtr pDrawable, int wMax,
- DDXPointPtr ppt, int *pwidth, int nspans,
- char *pdstStart);
-static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y,
- int width, int height,
- unsigned int subWindowMode);
-static void miSpriteCopyWindow (WindowPtr pWindow,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-static void miSpriteBlockHandler(int i, pointer blockData,
- pointer pTimeout,
- pointer pReadMask);
-static void miSpriteInstallColormap(ColormapPtr pMap);
-static void miSpriteStoreColors(ColormapPtr pMap, int ndef,
- xColorItem *pdef);
-
-static void miSpriteComputeSaved(DeviceIntPtr pDev,
- ScreenPtr pScreen);
-
-static Bool miSpriteDeviceCursorInitialize(DeviceIntPtr pDev,
- ScreenPtr pScreen);
-static void miSpriteDeviceCursorCleanup(DeviceIntPtr pDev,
- ScreenPtr pScreen);
+static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen);
+static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy,
+ int w, int h, unsigned int format,
+ unsigned long planemask, char *pdstLine);
+static void miSpriteGetSpans(DrawablePtr pDrawable, int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans,
+ char *pdstStart);
+static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y,
+ int width, int height,
+ unsigned int subWindowMode);
+static void miSpriteCopyWindow(WindowPtr pWindow,
+ DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+static void miSpriteBlockHandler(int i, pointer blockData,
+ pointer pTimeout, pointer pReadMask);
+static void miSpriteInstallColormap(ColormapPtr pMap);
+static void miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef);
+
+static void miSpriteComputeSaved(DeviceIntPtr pDev, ScreenPtr pScreen);
+
+static Bool miSpriteDeviceCursorInitialize(DeviceIntPtr pDev,
+ ScreenPtr pScreen);
+static void miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
#define SCREEN_PROLOGUE(pPriv, pScreen, field) ((pScreen)->field = \
(pPriv)->field)
@@ -249,12 +245,9 @@ miPointerSpriteFuncRec miSpritePointerFuncs = {
* other misc functions
*/
-static void miSpriteRemoveCursor(DeviceIntPtr pDev,
- ScreenPtr pScreen);
-static void miSpriteSaveUnderCursor(DeviceIntPtr pDev,
- ScreenPtr pScreen);
-static void miSpriteRestoreCursor(DeviceIntPtr pDev,
- ScreenPtr pScreen);
+static void miSpriteRemoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen);
+static void miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen);
+static void miSpriteRestoreCursor(DeviceIntPtr pDev, ScreenPtr pScreen);
static void
miSpriteRegisterBlockHandler(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv)
@@ -266,24 +259,21 @@ miSpriteRegisterBlockHandler(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv)
}
static void
-miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
+miSpriteReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
- ScreenPtr pScreen = closure;
- miCursorInfoPtr pCursorInfo;
- DeviceIntPtr pDev;
-
- for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
+ ScreenPtr pScreen = closure;
+ miCursorInfoPtr pCursorInfo;
+ DeviceIntPtr pDev;
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
pCursorInfo = MISPRITE(pDev);
if (pCursorInfo->isUp &&
pCursorInfo->pScreen == pScreen &&
- RegionContainsRect(pRegion, &pCursorInfo->saved) != rgnOUT)
- {
+ RegionContainsRect(pRegion, &pCursorInfo->saved) != rgnOUT) {
SPRITE_DEBUG(("Damage remove\n"));
- miSpriteRemoveCursor (pDev, pScreen);
+ miSpriteRemoveCursor(pDev, pScreen);
}
}
}
@@ -296,41 +286,36 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
*/
Bool
-miSpriteInitialize (ScreenPtr pScreen,
- miPointerScreenFuncPtr screenFuncs)
+miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
{
- miSpriteScreenPtr pScreenPriv;
- VisualPtr pVisual;
+ miSpriteScreenPtr pScreenPriv;
+ VisualPtr pVisual;
- if (!DamageSetup (pScreen))
- return FALSE;
+ if (!DamageSetup(pScreen))
+ return FALSE;
if (!dixRegisterPrivateKey(&miSpriteScreenKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
- if (!dixRegisterPrivateKey(&miSpriteDevPrivatesKeyRec, PRIVATE_DEVICE, sizeof(miCursorInfoRec)))
- return FALSE;
+ if (!dixRegisterPrivateKey
+ (&miSpriteDevPrivatesKeyRec, PRIVATE_DEVICE, sizeof(miCursorInfoRec)))
+ return FALSE;
- pScreenPriv = malloc(sizeof (miSpriteScreenRec));
+ pScreenPriv = malloc(sizeof(miSpriteScreenRec));
if (!pScreenPriv)
- return FALSE;
-
- pScreenPriv->pDamage = DamageCreate (miSpriteReportDamage,
- NULL,
- DamageReportRawRegion,
- TRUE,
- pScreen,
- pScreen);
-
- if (!miPointerInitialize (pScreen, &miSpritePointerFuncs, screenFuncs,TRUE))
- {
- free(pScreenPriv);
- return FALSE;
+ return FALSE;
+
+ pScreenPriv->pDamage = DamageCreate(miSpriteReportDamage,
+ NULL,
+ DamageReportRawRegion,
+ TRUE, pScreen, pScreen);
+
+ if (!miPointerInitialize(pScreen, &miSpritePointerFuncs, screenFuncs, TRUE)) {
+ free(pScreenPriv);
+ return FALSE;
}
for (pVisual = pScreen->visuals;
- pVisual->vid != pScreen->rootVisual;
- pVisual++)
- ;
+ pVisual->vid != pScreen->rootVisual; pVisual++);
pScreenPriv->pVisual = pVisual;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreenPriv->GetImage = pScreen->GetImage;
@@ -382,9 +367,9 @@ miSpriteInitialize (ScreenPtr pScreen,
*/
static Bool
-miSpriteCloseScreen (int i, ScreenPtr pScreen)
+miSpriteCloseScreen(int i, ScreenPtr pScreen)
{
- miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen);
+ miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->GetImage = pScreenPriv->GetImage;
@@ -393,7 +378,7 @@ miSpriteCloseScreen (int i, ScreenPtr pScreen)
pScreen->InstallColormap = pScreenPriv->InstallColormap;
pScreen->StoreColors = pScreenPriv->StoreColors;
- DamageDestroy (pScreenPriv->pDamage);
+ DamageDestroy(pScreenPriv->pDamage);
free(pScreenPriv);
@@ -401,80 +386,66 @@ miSpriteCloseScreen (int i, ScreenPtr pScreen)
}
static void
-miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h,
- unsigned int format, unsigned long planemask,
- char *pdstLine)
+miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planemask, char *pdstLine)
{
- ScreenPtr pScreen = pDrawable->pScreen;
- DeviceIntPtr pDev;
- miCursorInfoPtr pCursorInfo;
- miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
-
- SCREEN_PROLOGUE (pPriv, pScreen, GetImage);
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
- pCursorInfo = MISPRITE(pDev);
- if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
- ORG_OVERLAP(&pCursorInfo->saved,pDrawable->x,pDrawable->y,
- sx, sy, w, h))
- {
- SPRITE_DEBUG (("GetImage remove\n"));
- miSpriteRemoveCursor (pDev, pScreen);
- }
+ ScreenPtr pScreen = pDrawable->pScreen;
+ DeviceIntPtr pDev;
+ miCursorInfoPtr pCursorInfo;
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
+
+ SCREEN_PROLOGUE(pPriv, pScreen, GetImage);
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
+ pCursorInfo = MISPRITE(pDev);
+ if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
+ ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y,
+ sx, sy, w, h)) {
+ SPRITE_DEBUG(("GetImage remove\n"));
+ miSpriteRemoveCursor(pDev, pScreen);
+ }
}
}
}
- (*pScreen->GetImage) (pDrawable, sx, sy, w, h,
- format, planemask, pdstLine);
+ (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine);
- SCREEN_EPILOGUE (pPriv, pScreen, GetImage);
+ SCREEN_EPILOGUE(pPriv, pScreen, GetImage);
}
static void
-miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
- int *pwidth, int nspans, char *pdstStart)
+miSpriteGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart)
{
- ScreenPtr pScreen = pDrawable->pScreen;
- DeviceIntPtr pDev;
- miCursorInfoPtr pCursorInfo;
- miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
-
- SCREEN_PROLOGUE (pPriv, pScreen, GetSpans);
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
+ ScreenPtr pScreen = pDrawable->pScreen;
+ DeviceIntPtr pDev;
+ miCursorInfoPtr pCursorInfo;
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
+
+ SCREEN_PROLOGUE(pPriv, pScreen, GetSpans);
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
pCursorInfo = MISPRITE(pDev);
- if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen)
- {
- DDXPointPtr pts;
- int *widths;
- int nPts;
- int xorg,
- yorg;
+ if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen) {
+ DDXPointPtr pts;
+ int *widths;
+ int nPts;
+ int xorg, yorg;
xorg = pDrawable->x;
yorg = pDrawable->y;
for (pts = ppt, widths = pwidth, nPts = nspans;
- nPts--;
- pts++, widths++)
- {
- if (SPN_OVERLAP(&pCursorInfo->saved,pts->y+yorg,
- pts->x+xorg,*widths))
- {
- SPRITE_DEBUG (("GetSpans remove\n"));
- miSpriteRemoveCursor (pDev, pScreen);
+ nPts--; pts++, widths++) {
+ if (SPN_OVERLAP(&pCursorInfo->saved, pts->y + yorg,
+ pts->x + xorg, *widths)) {
+ SPRITE_DEBUG(("GetSpans remove\n"));
+ miSpriteRemoveCursor(pDev, pScreen);
break;
}
}
@@ -485,110 +456,96 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
(*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
- SCREEN_EPILOGUE (pPriv, pScreen, GetSpans);
+ SCREEN_EPILOGUE(pPriv, pScreen, GetSpans);
}
static void
-miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width,
- int height, unsigned int subWindowMode)
+miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, int width,
+ int height, unsigned int subWindowMode)
{
- ScreenPtr pScreen = pDrawable->pScreen;
- DeviceIntPtr pDev;
- miCursorInfoPtr pCursorInfo;
- miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
-
- SCREEN_PROLOGUE (pPriv, pScreen, SourceValidate);
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
- pCursorInfo = MISPRITE(pDev);
- if (pCursorInfo && pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
- ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y,
- x, y, width, height))
- {
- SPRITE_DEBUG (("SourceValidate remove\n"));
- miSpriteRemoveCursor (pDev, pScreen);
- }
- }
- }
+ ScreenPtr pScreen = pDrawable->pScreen;
+ DeviceIntPtr pDev;
+ miCursorInfoPtr pCursorInfo;
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
+
+ SCREEN_PROLOGUE(pPriv, pScreen, SourceValidate);
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
+ pCursorInfo = MISPRITE(pDev);
+ if (pCursorInfo && pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
+ ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y,
+ x, y, width, height)) {
+ SPRITE_DEBUG(("SourceValidate remove\n"));
+ miSpriteRemoveCursor(pDev, pScreen);
+ }
+ }
+ }
}
if (pScreen->SourceValidate)
- (*pScreen->SourceValidate) (pDrawable, x, y, width, height, subWindowMode);
+ (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
+ subWindowMode);
- SCREEN_EPILOGUE (pPriv, pScreen, SourceValidate);
+ SCREEN_EPILOGUE(pPriv, pScreen, SourceValidate);
}
static void
-miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+miSpriteCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DeviceIntPtr pDev;
- miCursorInfoPtr pCursorInfo;
- miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DeviceIntPtr pDev;
+ miCursorInfoPtr pCursorInfo;
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
- SCREEN_PROLOGUE (pPriv, pScreen, CopyWindow);
+ SCREEN_PROLOGUE(pPriv, pScreen, CopyWindow);
- for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
pCursorInfo = MISPRITE(pDev);
/*
* Damage will take care of destination check
*/
if (pCursorInfo && pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
- RegionContainsRect(prgnSrc, &pCursorInfo->saved) != rgnOUT)
- {
- SPRITE_DEBUG (("CopyWindow remove\n"));
- miSpriteRemoveCursor (pDev, pScreen);
+ RegionContainsRect(prgnSrc, &pCursorInfo->saved) != rgnOUT) {
+ SPRITE_DEBUG(("CopyWindow remove\n"));
+ miSpriteRemoveCursor(pDev, pScreen);
}
}
}
(*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc);
- SCREEN_EPILOGUE (pPriv, pScreen, CopyWindow);
+ SCREEN_EPILOGUE(pPriv, pScreen, CopyWindow);
}
static void
-miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout,
- pointer pReadmask)
+miSpriteBlockHandler(int i, pointer blockData, pointer pTimeout,
+ pointer pReadmask)
{
- ScreenPtr pScreen = screenInfo.screens[i];
- miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
- DeviceIntPtr pDev;
- miCursorInfoPtr pCursorInfo;
- Bool WorkToDo = FALSE;
-
- for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
+ DeviceIntPtr pDev;
+ miCursorInfoPtr pCursorInfo;
+ Bool WorkToDo = FALSE;
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
pCursorInfo = MISPRITE(pDev);
if (pCursorInfo && !pCursorInfo->isUp
- && pCursorInfo->pScreen == pScreen
- && pCursorInfo->shouldBeUp)
- {
- SPRITE_DEBUG (("BlockHandler save"));
- miSpriteSaveUnderCursor (pDev, pScreen);
+ && pCursorInfo->pScreen == pScreen && pCursorInfo->shouldBeUp) {
+ SPRITE_DEBUG(("BlockHandler save"));
+ miSpriteSaveUnderCursor(pDev, pScreen);
}
}
}
- for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
pCursorInfo = MISPRITE(pDev);
if (pCursorInfo && !pCursorInfo->isUp &&
- pCursorInfo->pScreen == pScreen &&
- pCursorInfo->shouldBeUp)
- {
- SPRITE_DEBUG (("BlockHandler restore\n"));
- miSpriteRestoreCursor (pDev, pScreen);
+ pCursorInfo->pScreen == pScreen && pCursorInfo->shouldBeUp) {
+ SPRITE_DEBUG(("BlockHandler restore\n"));
+ miSpriteRestoreCursor(pDev, pScreen);
if (!pCursorInfo->isUp)
WorkToDo = TRUE;
}
@@ -606,10 +563,10 @@ miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout,
}
static void
-miSpriteInstallColormap (ColormapPtr pMap)
+miSpriteInstallColormap(ColormapPtr pMap)
{
- ScreenPtr pScreen = pMap->pScreen;
- miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
+ ScreenPtr pScreen = pMap->pScreen;
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
SCREEN_PROLOGUE(pPriv, pScreen, InstallColormap);
@@ -619,14 +576,12 @@ miSpriteInstallColormap (ColormapPtr pMap)
/* InstallColormap can be called before devices are initialized. */
pPriv->pInstalledMap = pMap;
- if (pPriv->pColormap != pMap)
- {
+ if (pPriv->pColormap != pMap) {
DeviceIntPtr pDev;
- miCursorInfoPtr pCursorInfo;
- for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
+ miCursorInfoPtr pCursorInfo;
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
pCursorInfo = MISPRITE(pDev);
if (pCursorInfo)
{
@@ -641,15 +596,15 @@ miSpriteInstallColormap (ColormapPtr pMap)
}
static void
-miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
+miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef)
{
- ScreenPtr pScreen = pMap->pScreen;
- miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
- int i;
- int updated;
- VisualPtr pVisual;
- DeviceIntPtr pDev;
- miCursorInfoPtr pCursorInfo;
+ ScreenPtr pScreen = pMap->pScreen;
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
+ int i;
+ int updated;
+ VisualPtr pVisual;
+ DeviceIntPtr pDev;
+ miCursorInfoPtr pCursorInfo;
SCREEN_PROLOGUE(pPriv, pScreen, StoreColors);
@@ -657,12 +612,10 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
SCREEN_EPILOGUE(pPriv, pScreen, StoreColors);
- if (pPriv->pColormap == pMap)
- {
+ if (pPriv->pColormap == pMap) {
updated = 0;
pVisual = pMap->pVisual;
- if (pVisual->class == DirectColor)
- {
+ if (pVisual->class == DirectColor) {
/* Direct color - match on any of the subfields */
#define MaskMatch(a,b,mask) (((a) & (pVisual->mask)) == ((b) & (pVisual->mask)))
@@ -679,43 +632,33 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
UpdateDAC(dev, plane,green,greenMask) \
UpdateDAC(dev, plane,blue,blueMask)
- for (i = 0; i < ndef; i++)
- {
- CheckDirect (pPriv, SOURCE_COLOR)
- CheckDirect (pPriv, MASK_COLOR)
+ for (i = 0; i < ndef; i++) {
+ CheckDirect(pPriv, SOURCE_COLOR)
+ CheckDirect(pPriv, MASK_COLOR)
}
}
- else
- {
+ else {
/* PseudoColor/GrayScale - match on exact pixel */
- for (i = 0; i < ndef; i++)
- {
- if (pdef[i].pixel ==
- pPriv->colors[SOURCE_COLOR].pixel)
- {
+ for (i = 0; i < ndef; i++) {
+ if (pdef[i].pixel == pPriv->colors[SOURCE_COLOR].pixel) {
pPriv->colors[SOURCE_COLOR] = pdef[i];
if (++updated == 2)
break;
}
- if (pdef[i].pixel ==
- pPriv->colors[MASK_COLOR].pixel)
- {
+ if (pdef[i].pixel == pPriv->colors[MASK_COLOR].pixel) {
pPriv->colors[MASK_COLOR] = pdef[i];
if (++updated == 2)
break;
}
}
}
- if (updated)
- {
- for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (DevHasCursor(pDev))
- {
+ if (updated) {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (DevHasCursor(pDev)) {
pCursorInfo = MISPRITE(pDev);
pCursorInfo->checkPixels = TRUE;
if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen)
- miSpriteRemoveCursor (pDev, pScreen);
+ miSpriteRemoveCursor(pDev, pScreen);
}
}
}
@@ -723,35 +666,34 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
}
static void
-miSpriteFindColors (miCursorInfoPtr pDevCursor, ScreenPtr pScreen)
+miSpriteFindColors(miCursorInfoPtr pDevCursor, ScreenPtr pScreen)
{
- miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen);
- CursorPtr pCursor;
- xColorItem *sourceColor, *maskColor;
+ miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen);
+ CursorPtr pCursor;
+ xColorItem *sourceColor, *maskColor;
pCursor = pDevCursor->pCursor;
sourceColor = &pScreenPriv->colors[SOURCE_COLOR];
maskColor = &pScreenPriv->colors[MASK_COLOR];
if (pScreenPriv->pColormap != pScreenPriv->pInstalledMap ||
- !(pCursor->foreRed == sourceColor->red &&
- pCursor->foreGreen == sourceColor->green &&
+ !(pCursor->foreRed == sourceColor->red &&
+ pCursor->foreGreen == sourceColor->green &&
pCursor->foreBlue == sourceColor->blue &&
- pCursor->backRed == maskColor->red &&
- pCursor->backGreen == maskColor->green &&
- pCursor->backBlue == maskColor->blue))
- {
- pScreenPriv->pColormap = pScreenPriv->pInstalledMap;
- sourceColor->red = pCursor->foreRed;
- sourceColor->green = pCursor->foreGreen;
- sourceColor->blue = pCursor->foreBlue;
- FakeAllocColor (pScreenPriv->pColormap, sourceColor);
- maskColor->red = pCursor->backRed;
- maskColor->green = pCursor->backGreen;
- maskColor->blue = pCursor->backBlue;
- FakeAllocColor (pScreenPriv->pColormap, maskColor);
- /* "free" the pixels right away, don't let this confuse you */
- FakeFreeColor(pScreenPriv->pColormap, sourceColor->pixel);
- FakeFreeColor(pScreenPriv->pColormap, maskColor->pixel);
+ pCursor->backRed == maskColor->red &&
+ pCursor->backGreen == maskColor->green &&
+ pCursor->backBlue == maskColor->blue)) {
+ pScreenPriv->pColormap = pScreenPriv->pInstalledMap;
+ sourceColor->red = pCursor->foreRed;
+ sourceColor->green = pCursor->foreGreen;
+ sourceColor->blue = pCursor->foreBlue;
+ FakeAllocColor(pScreenPriv->pColormap, sourceColor);
+ maskColor->red = pCursor->backRed;
+ maskColor->green = pCursor->backGreen;
+ maskColor->blue = pCursor->backBlue;
+ FakeAllocColor(pScreenPriv->pColormap, maskColor);
+ /* "free" the pixels right away, don't let this confuse you */
+ FakeFreeColor(pScreenPriv->pColormap, sourceColor->pixel);
+ FakeFreeColor(pScreenPriv->pColormap, maskColor->pixel);
}
pDevCursor->checkPixels = FALSE;
@@ -765,7 +707,7 @@ miSpriteFindColors (miCursorInfoPtr pDevCursor, ScreenPtr pScreen)
#define SPRITE_PAD 8
static Bool
-miSpriteRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+miSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
miCursorInfoPtr pCursorInfo;
@@ -775,7 +717,7 @@ miSpriteRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
pCursorInfo = MISPRITE(pDev);
if (pCursor == pCursorInfo->pCursor)
- pCursorInfo->checkPixels = TRUE;
+ pCursorInfo->checkPixels = TRUE;
return miDCRealizeCursor(pScreen, pCursor);
}
@@ -787,11 +729,11 @@ miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
}
static void
-miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
- CursorPtr pCursor, int x, int y)
+miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor, int x, int y)
{
- miCursorInfoPtr pPointer;
- miSpriteScreenPtr pScreenPriv;
+ miCursorInfoPtr pPointer;
+ miSpriteScreenPtr pScreenPriv;
if (IsFloating(pDev))
return;
@@ -799,55 +741,50 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pPointer = MISPRITE(pDev);
pScreenPriv = GetSpriteScreen(pScreen);
- if (!pCursor)
- {
- if (pPointer->shouldBeUp)
- --pScreenPriv->numberOfCursors;
- pPointer->shouldBeUp = FALSE;
- if (pPointer->isUp)
- miSpriteRemoveCursor (pDev, pScreen);
- if (pScreenPriv->numberOfCursors == 0)
- miSpriteDisableDamage(pScreen, pScreenPriv);
- pPointer->pCursor = 0;
- return;
+ if (!pCursor) {
+ if (pPointer->shouldBeUp)
+ --pScreenPriv->numberOfCursors;
+ pPointer->shouldBeUp = FALSE;
+ if (pPointer->isUp)
+ miSpriteRemoveCursor(pDev, pScreen);
+ if (pScreenPriv->numberOfCursors == 0)
+ miSpriteDisableDamage(pScreen, pScreenPriv);
+ pPointer->pCursor = 0;
+ return;
}
if (!pPointer->shouldBeUp)
- pScreenPriv->numberOfCursors++;
+ pScreenPriv->numberOfCursors++;
pPointer->shouldBeUp = TRUE;
if (!pPointer->isUp)
- miSpriteRegisterBlockHandler(pScreen, pScreenPriv);
+ miSpriteRegisterBlockHandler(pScreen, pScreenPriv);
if (pPointer->x == x &&
- pPointer->y == y &&
- pPointer->pCursor == pCursor &&
- !pPointer->checkPixels)
- {
- return;
+ pPointer->y == y &&
+ pPointer->pCursor == pCursor && !pPointer->checkPixels) {
+ return;
}
pPointer->x = x;
pPointer->y = y;
pPointer->pCacheWin = NullWindow;
- if (pPointer->checkPixels || pPointer->pCursor != pCursor)
- {
- pPointer->pCursor = pCursor;
- miSpriteFindColors (pPointer, pScreen);
+ if (pPointer->checkPixels || pPointer->pCursor != pCursor) {
+ pPointer->pCursor = pCursor;
+ miSpriteFindColors(pPointer, pScreen);
}
if (pPointer->isUp) {
- /* TODO: reimplement flicker-free MoveCursor */
- SPRITE_DEBUG (("SetCursor remove %d\n", pDev->id));
- miSpriteRemoveCursor (pDev, pScreen);
+ /* TODO: reimplement flicker-free MoveCursor */
+ SPRITE_DEBUG(("SetCursor remove %d\n", pDev->id));
+ miSpriteRemoveCursor(pDev, pScreen);
}
- if (!pPointer->isUp && pPointer->pCursor)
- {
- SPRITE_DEBUG (("SetCursor restore %d\n", pDev->id));
+ if (!pPointer->isUp && pPointer->pCursor) {
+ SPRITE_DEBUG(("SetCursor restore %d\n", pDev->id));
miSpriteSaveUnderCursor(pDev, pScreen);
- miSpriteRestoreCursor (pDev, pScreen);
+ miSpriteRestoreCursor(pDev, pScreen);
}
}
static void
-miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+miSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
CursorPtr pCursor;
@@ -856,19 +793,19 @@ miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
pCursor = MISPRITE(pDev)->pCursor;
- miSpriteSetCursor (pDev, pScreen, pCursor, x, y);
+ miSpriteSetCursor(pDev, pScreen, pCursor, x, y);
}
-
static Bool
miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
int ret = miDCDeviceInitialize(pDev, pScreen);
- if (ret)
- {
+ if (ret) {
miCursorInfoPtr pCursorInfo;
- pCursorInfo = dixLookupPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey);
+
+ pCursorInfo =
+ dixLookupPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey);
pCursorInfo->pCursor = NULL;
pCursorInfo->x = 0;
pCursorInfo->y = 0;
@@ -886,7 +823,8 @@ miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
static void
miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- miCursorInfoPtr pCursorInfo = dixLookupPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey);
+ miCursorInfoPtr pCursorInfo =
+ dixLookupPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey);
if (DevHasCursor(pDev))
miDCDeviceCleanup(pDev, pScreen);
@@ -899,16 +837,15 @@ miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
*/
static void
-miSpriteRemoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
+miSpriteRemoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- miSpriteScreenPtr pScreenPriv;
- miCursorInfoPtr pCursorInfo;
-
+ miSpriteScreenPtr pScreenPriv;
+ miCursorInfoPtr pCursorInfo;
if (IsFloating(pDev))
return;
- DamageDrawInternal (pScreen, TRUE);
+ DamageDrawInternal(pScreen, TRUE);
pScreenPriv = GetSpriteScreen(pScreen);
pCursorInfo = MISPRITE(pDev);
@@ -923,12 +860,11 @@ miSpriteRemoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
pCursorInfo->saved.x2 -
pCursorInfo->saved.x1,
pCursorInfo->saved.y2 -
- pCursorInfo->saved.y1))
- {
+ pCursorInfo->saved.y1)) {
miSpriteIsUp(pCursorInfo);
}
miSpriteEnableDamage(pScreen, pScreenPriv);
- DamageDrawInternal (pScreen, FALSE);
+ DamageDrawInternal(pScreen, FALSE);
}
/*
@@ -939,17 +875,17 @@ miSpriteRemoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
static void
miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- miSpriteScreenPtr pScreenPriv;
- miCursorInfoPtr pCursorInfo;
+ miSpriteScreenPtr pScreenPriv;
+ miCursorInfoPtr pCursorInfo;
if (IsFloating(pDev))
return;
- DamageDrawInternal (pScreen, TRUE);
+ DamageDrawInternal(pScreen, TRUE);
pScreenPriv = GetSpriteScreen(pScreen);
pCursorInfo = MISPRITE(pDev);
- miSpriteComputeSaved (pDev, pScreen);
+ miSpriteComputeSaved(pDev, pScreen);
miSpriteDisableDamage(pScreen, pScreenPriv);
@@ -959,53 +895,50 @@ miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
pCursorInfo->saved.y1,
pCursorInfo->saved.x2 -
pCursorInfo->saved.x1,
- pCursorInfo->saved.y2 -
- pCursorInfo->saved.y1);
+ pCursorInfo->saved.y2 - pCursorInfo->saved.y1);
SPRITE_DEBUG(("SaveUnderCursor %d\n", pDev->id));
miSpriteEnableDamage(pScreen, pScreenPriv);
- DamageDrawInternal (pScreen, FALSE);
+ DamageDrawInternal(pScreen, FALSE);
}
-
/*
* Called from the block handler, restores the cursor
* before waiting for something to do.
*/
static void
-miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
+miSpriteRestoreCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- miSpriteScreenPtr pScreenPriv;
- int x, y;
- CursorPtr pCursor;
- miCursorInfoPtr pCursorInfo;
+ miSpriteScreenPtr pScreenPriv;
+ int x, y;
+ CursorPtr pCursor;
+ miCursorInfoPtr pCursorInfo;
if (IsFloating(pDev))
return;
- DamageDrawInternal (pScreen, TRUE);
+ DamageDrawInternal(pScreen, TRUE);
pScreenPriv = GetSpriteScreen(pScreen);
pCursorInfo = MISPRITE(pDev);
- miSpriteComputeSaved (pDev, pScreen);
+ miSpriteComputeSaved(pDev, pScreen);
pCursor = pCursorInfo->pCursor;
- x = pCursorInfo->x - (int)pCursor->bits->xhot;
- y = pCursorInfo->y - (int)pCursor->bits->yhot;
+ x = pCursorInfo->x - (int) pCursor->bits->xhot;
+ y = pCursorInfo->y - (int) pCursor->bits->yhot;
miSpriteDisableDamage(pScreen, pScreenPriv);
SPRITE_DEBUG(("RestoreCursor %d\n", pDev->id));
if (pCursorInfo->checkPixels)
- miSpriteFindColors (pCursorInfo, pScreen);
+ miSpriteFindColors(pCursorInfo, pScreen);
if (miDCPutUpCursor(pDev, pScreen,
- pCursor, x, y,
- pScreenPriv->colors[SOURCE_COLOR].pixel,
- pScreenPriv->colors[MASK_COLOR].pixel))
- {
+ pCursor, x, y,
+ pScreenPriv->colors[SOURCE_COLOR].pixel,
+ pScreenPriv->colors[MASK_COLOR].pixel)) {
miSpriteIsUp(pCursorInfo);
pCursorInfo->pScreen = pScreen;
}
miSpriteEnableDamage(pScreen, pScreenPriv);
- DamageDrawInternal (pScreen, FALSE);
+ DamageDrawInternal(pScreen, FALSE);
}
/*
@@ -1013,11 +946,11 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
*/
static void
-miSpriteComputeSaved (DeviceIntPtr pDev, ScreenPtr pScreen)
+miSpriteComputeSaved(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- int x, y, w, h;
- int wpad, hpad;
- CursorPtr pCursor;
+ int x, y, w, h;
+ int wpad, hpad;
+ CursorPtr pCursor;
miCursorInfoPtr pCursorInfo;
if (IsFloating(pDev))
@@ -1026,8 +959,8 @@ miSpriteComputeSaved (DeviceIntPtr pDev, ScreenPtr pScreen)
pCursorInfo = MISPRITE(pDev);
pCursor = pCursorInfo->pCursor;
- x = pCursorInfo->x - (int)pCursor->bits->xhot;
- y = pCursorInfo->y - (int)pCursor->bits->yhot;
+ x = pCursorInfo->x - (int) pCursor->bits->xhot;
+ y = pCursorInfo->y - (int) pCursor->bits->yhot;
w = pCursor->bits->width;
h = pCursor->bits->height;
wpad = SPRITE_PAD;
@@ -1037,4 +970,3 @@ miSpriteComputeSaved (DeviceIntPtr pDev, ScreenPtr pScreen)
pCursorInfo->saved.x2 = pCursorInfo->saved.x1 + w + wpad * 2;
pCursorInfo->saved.y2 = pCursorInfo->saved.y1 + h + hpad * 2;
}
-
diff --git a/xorg-server/mi/misprite.h b/xorg-server/mi/misprite.h
index 635a6fad7..099cd0e38 100644
--- a/xorg-server/mi/misprite.h
+++ b/xorg-server/mi/misprite.h
@@ -1,50 +1,48 @@
-/*
- * misprite.h
- *
- * software-sprite/sprite drawing interface spec
- *
- * mi versions of these routines exist.
- */
-
-
-/*
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-*/
-
-extern Bool miSpriteInitialize(
- ScreenPtr /*pScreen*/,
- miPointerScreenFuncPtr /*screenFuncs*/
-);
-
-extern Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
-extern Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
-extern Bool miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
- CursorPtr pCursor, int x, int y,
- unsigned long source, unsigned long mask);
-extern Bool miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
- int x, int y, int w, int h);
-extern Bool miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
- int x, int y, int w, int h);
-extern Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
-extern void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
+/*
+ * misprite.h
+ *
+ * software-sprite/sprite drawing interface spec
+ *
+ * mi versions of these routines exist.
+ */
+
+/*
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+
+extern Bool miSpriteInitialize(ScreenPtr /*pScreen */ ,
+ miPointerScreenFuncPtr /*screenFuncs */
+ );
+
+extern Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+extern Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+extern Bool miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor, int x, int y,
+ unsigned long source, unsigned long mask);
+extern Bool miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y, int w, int h);
+extern Bool miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y, int w, int h);
+extern Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
+extern void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
diff --git a/xorg-server/mi/mivaltree.c b/xorg-server/mi/mivaltree.c
index f1de5bfd7..88f9a4084 100644
--- a/xorg-server/mi/mivaltree.c
+++ b/xorg-server/mi/mivaltree.c
@@ -79,15 +79,14 @@ Equipment Corporation.
******************************************************************/
-
/*
* Aug '86: Susan Angebranndt -- original code
* July '87: Adam de Boor -- substantially modified and commented
* Summer '89: Joel McCormack -- so fast you wouldn't believe it possible.
* In particular, much improved code for window mapping and
* circulating.
- * Bob Scheifler -- avoid miComputeClips for unmapped windows,
- * valdata changes
+ * Bob Scheifler -- avoid miComputeClips for unmapped windows,
+ * valdata changes
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -107,68 +106,66 @@ Equipment Corporation.
* Compute the visibility of a shaped window
*/
int
-miShapedWindowIn (RegionPtr universe, RegionPtr bounding,
- BoxPtr rect, int x, int y)
+miShapedWindowIn(RegionPtr universe, RegionPtr bounding,
+ BoxPtr rect, int x, int y)
{
- BoxRec box;
- BoxPtr boundBox;
- int nbox;
- Bool someIn, someOut;
- int t, x1, y1, x2, y2;
-
- nbox = RegionNumRects (bounding);
- boundBox = RegionRects (bounding);
+ BoxRec box;
+ BoxPtr boundBox;
+ int nbox;
+ Bool someIn, someOut;
+ int t, x1, y1, x2, y2;
+
+ nbox = RegionNumRects(bounding);
+ boundBox = RegionRects(bounding);
someIn = someOut = FALSE;
x1 = rect->x1;
y1 = rect->y1;
x2 = rect->x2;
y2 = rect->y2;
- while (nbox--)
- {
- if ((t = boundBox->x1 + x) < x1)
- t = x1;
- box.x1 = t;
- if ((t = boundBox->y1 + y) < y1)
- t = y1;
- box.y1 = t;
- if ((t = boundBox->x2 + x) > x2)
- t = x2;
- box.x2 = t;
- if ((t = boundBox->y2 + y) > y2)
- t = y2;
- box.y2 = t;
- if (box.x1 > box.x2)
- box.x2 = box.x1;
- if (box.y1 > box.y2)
- box.y2 = box.y1;
- switch (RegionContainsRect(universe, &box))
- {
- case rgnIN:
- if (someOut)
- return rgnPART;
- someIn = TRUE;
- break;
- case rgnOUT:
- if (someIn)
- return rgnPART;
- someOut = TRUE;
- break;
- default:
- return rgnPART;
- }
- boundBox++;
+ while (nbox--) {
+ if ((t = boundBox->x1 + x) < x1)
+ t = x1;
+ box.x1 = t;
+ if ((t = boundBox->y1 + y) < y1)
+ t = y1;
+ box.y1 = t;
+ if ((t = boundBox->x2 + x) > x2)
+ t = x2;
+ box.x2 = t;
+ if ((t = boundBox->y2 + y) > y2)
+ t = y2;
+ box.y2 = t;
+ if (box.x1 > box.x2)
+ box.x2 = box.x1;
+ if (box.y1 > box.y2)
+ box.y2 = box.y1;
+ switch (RegionContainsRect(universe, &box)) {
+ case rgnIN:
+ if (someOut)
+ return rgnPART;
+ someIn = TRUE;
+ break;
+ case rgnOUT:
+ if (someIn)
+ return rgnPART;
+ someOut = TRUE;
+ break;
+ default:
+ return rgnPART;
+ }
+ boundBox++;
}
if (someIn)
- return rgnIN;
+ return rgnIN;
return rgnOUT;
}
-static GetRedirectBorderClipProcPtr miGetRedirectBorderClipProc;
-static SetRedirectBorderClipProcPtr miSetRedirectBorderClipProc;
+static GetRedirectBorderClipProcPtr miGetRedirectBorderClipProc;
+static SetRedirectBorderClipProcPtr miSetRedirectBorderClipProc;
void
-miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
- GetRedirectBorderClipProcPtr getBorderClip)
+miRegisterRedirectBorderClipProc(SetRedirectBorderClipProcPtr setBorderClip,
+ GetRedirectBorderClipProcPtr getBorderClip)
{
miSetRedirectBorderClipProc = setBorderClip;
miGetRedirectBorderClipProc = getBorderClip;
@@ -189,7 +186,6 @@ miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
HasBorder(w) && \
(w)->backgroundState == ParentRelative)
-
/*
*-----------------------------------------------------------------------
* miComputeClips --
@@ -207,22 +203,19 @@ miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
*-----------------------------------------------------------------------
*/
static void
-miComputeClips (
- WindowPtr pParent,
- ScreenPtr pScreen,
- RegionPtr universe,
- VTKind kind,
- RegionPtr exposed ) /* for intermediate calculations */
-{
- int dx,
- dy;
- RegionRec childUniverse;
- WindowPtr pChild;
- int oldVis, newVis;
- BoxRec borderSize;
- RegionRec childUnion;
- Bool overlap;
- RegionPtr borderVisible;
+miComputeClips(WindowPtr pParent,
+ ScreenPtr pScreen,
+ RegionPtr universe, VTKind kind, RegionPtr exposed)
+{ /* for intermediate calculations */
+ int dx, dy;
+ RegionRec childUniverse;
+ WindowPtr pChild;
+ int oldVis, newVis;
+ BoxRec borderSize;
+ RegionRec childUnion;
+ Bool overlap;
+ RegionPtr borderVisible;
+
/*
* Figure out the new visibility of this window.
* The extent of the universe should be the same as the extent of
@@ -233,67 +226,65 @@ miComputeClips (
*/
borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent);
borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent);
- dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent);
+ dx = (int) pParent->drawable.x + (int) pParent->drawable.width +
+ wBorderWidth(pParent);
if (dx > 32767)
- dx = 32767;
+ dx = 32767;
borderSize.x2 = dx;
- dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent);
+ dy = (int) pParent->drawable.y + (int) pParent->drawable.height +
+ wBorderWidth(pParent);
if (dy > 32767)
- dy = 32767;
+ dy = 32767;
borderSize.y2 = dy;
#ifdef COMPOSITE
/*
* In redirected drawing case, reset universe to borderSize
*/
- if (pParent->redirectDraw != RedirectDrawNone)
- {
- if (miSetRedirectBorderClipProc)
- {
- if (TreatAsTransparent (pParent))
- RegionEmpty(universe);
- (*miSetRedirectBorderClipProc) (pParent, universe);
- }
- RegionCopy(universe, &pParent->borderSize);
+ if (pParent->redirectDraw != RedirectDrawNone) {
+ if (miSetRedirectBorderClipProc) {
+ if (TreatAsTransparent(pParent))
+ RegionEmpty(universe);
+ (*miSetRedirectBorderClipProc) (pParent, universe);
+ }
+ RegionCopy(universe, &pParent->borderSize);
}
#endif
oldVis = pParent->visibility;
- switch (RegionContainsRect(universe, &borderSize))
- {
- case rgnIN:
- newVis = VisibilityUnobscured;
- break;
- case rgnPART:
- newVis = VisibilityPartiallyObscured;
- {
- RegionPtr pBounding;
-
- if ((pBounding = wBoundingShape (pParent)))
- {
- switch (miShapedWindowIn (universe, pBounding,
- &borderSize,
- pParent->drawable.x,
- pParent->drawable.y))
- {
- case rgnIN:
- newVis = VisibilityUnobscured;
- break;
- case rgnOUT:
- newVis = VisibilityFullyObscured;
- break;
- }
- }
- }
- break;
- default:
- newVis = VisibilityFullyObscured;
- break;
+ switch (RegionContainsRect(universe, &borderSize)) {
+ case rgnIN:
+ newVis = VisibilityUnobscured;
+ break;
+ case rgnPART:
+ newVis = VisibilityPartiallyObscured;
+ {
+ RegionPtr pBounding;
+
+ if ((pBounding = wBoundingShape(pParent))) {
+ switch (miShapedWindowIn(universe, pBounding,
+ &borderSize,
+ pParent->drawable.x,
+ pParent->drawable.y)) {
+ case rgnIN:
+ newVis = VisibilityUnobscured;
+ break;
+ case rgnOUT:
+ newVis = VisibilityFullyObscured;
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ newVis = VisibilityFullyObscured;
+ break;
}
pParent->visibility = newVis;
if (oldVis != newVis &&
- ((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
- SendVisibilityNotify(pParent);
+ ((pParent->
+ eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
+ SendVisibilityNotify(pParent);
if (pParent->valdata==UnmapValData)
return; // return if no valid valdata
@@ -309,74 +300,64 @@ miComputeClips (
case VTMap:
case VTStack:
case VTUnmap:
- break;
+ break;
case VTMove:
- if ((oldVis == newVis) &&
- ((oldVis == VisibilityFullyObscured) ||
- (oldVis == VisibilityUnobscured)))
- {
- pChild = pParent;
- while (1)
- {
- if (pChild->viewable)
- {
- if (pChild->visibility != VisibilityFullyObscured)
- {
- RegionTranslate(&pChild->borderClip,
- dx, dy);
- RegionTranslate(&pChild->clipList,
- dx, dy);
- pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pChild, dx, dy);
-
- }
- if (pChild->valdata)
- {
- RegionNull(&pChild->valdata->after.borderExposed);
- if (HasParentRelativeBorder(pChild))
- {
- RegionSubtract(&pChild->valdata->after.borderExposed,
- &pChild->borderClip,
- &pChild->winSize);
- }
- RegionNull(&pChild->valdata->after.exposed);
- }
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pParent))
- pChild = pChild->parent;
- if (pChild == pParent)
- break;
- pChild = pChild->nextSib;
- }
- return;
- }
- /* fall through */
+ if ((oldVis == newVis) &&
+ ((oldVis == VisibilityFullyObscured) ||
+ (oldVis == VisibilityUnobscured))) {
+ pChild = pParent;
+ while (1) {
+ if (pChild->viewable) {
+ if (pChild->visibility != VisibilityFullyObscured) {
+ RegionTranslate(&pChild->borderClip, dx, dy);
+ RegionTranslate(&pChild->clipList, dx, dy);
+ pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (pChild, dx, dy);
+
+ }
+ if (pChild->valdata) {
+ RegionNull(&pChild->valdata->after.borderExposed);
+ if (HasParentRelativeBorder(pChild)) {
+ RegionSubtract(&pChild->valdata->after.
+ borderExposed, &pChild->borderClip,
+ &pChild->winSize);
+ }
+ RegionNull(&pChild->valdata->after.exposed);
+ }
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pParent))
+ pChild = pChild->parent;
+ if (pChild == pParent)
+ break;
+ pChild = pChild->nextSib;
+ }
+ return;
+ }
+ /* fall through */
default:
- /*
- * To calculate exposures correctly, we have to translate the old
- * borderClip and clipList regions to the window's new location so there
- * is a correspondence between pieces of the new and old clipping regions.
- */
- if (dx || dy)
- {
- /*
- * We translate the old clipList because that will be exposed or copied
- * if gravity is right.
- */
- RegionTranslate(&pParent->borderClip, dx, dy);
- RegionTranslate(&pParent->clipList, dx, dy);
- }
- break;
+ /*
+ * To calculate exposures correctly, we have to translate the old
+ * borderClip and clipList regions to the window's new location so there
+ * is a correspondence between pieces of the new and old clipping regions.
+ */
+ if (dx || dy) {
+ /*
+ * We translate the old clipList because that will be exposed or copied
+ * if gravity is right.
+ */
+ RegionTranslate(&pParent->borderClip, dx, dy);
+ RegionTranslate(&pParent->clipList, dx, dy);
+ }
+ break;
case VTBroken:
- RegionEmpty(&pParent->borderClip);
- RegionEmpty(&pParent->clipList);
- break;
+ RegionEmpty(&pParent->borderClip);
+ RegionEmpty(&pParent->clipList);
+ break;
}
borderVisible = pParent->valdata->before.borderVisible;
@@ -392,103 +373,89 @@ miComputeClips (
* This leaves a region of pieces that weren't exposed before.
*/
- if (HasBorder (pParent))
- {
- if (borderVisible)
- {
- /*
- * when the border changes shape, the old visible portions
- * of the border will be saved by DIX in borderVisible --
- * use that region and destroy it
- */
- RegionSubtract(exposed, universe, borderVisible);
- RegionDestroy(borderVisible);
- }
- else
- {
- RegionSubtract(exposed, universe, &pParent->borderClip);
- }
- if (HasParentRelativeBorder(pParent) && (dx || dy))
- RegionSubtract(&pParent->valdata->after.borderExposed,
- universe,
- &pParent->winSize);
- else
- RegionSubtract(&pParent->valdata->after.borderExposed,
- exposed, &pParent->winSize);
-
- RegionCopy(&pParent->borderClip, universe);
-
- /*
- * To get the right clipList for the parent, and to make doubly sure
- * that no child overlaps the parent's border, we remove the parent's
- * border from the universe before proceeding.
- */
-
- RegionIntersect(universe, universe, &pParent->winSize);
+ if (HasBorder(pParent)) {
+ if (borderVisible) {
+ /*
+ * when the border changes shape, the old visible portions
+ * of the border will be saved by DIX in borderVisible --
+ * use that region and destroy it
+ */
+ RegionSubtract(exposed, universe, borderVisible);
+ RegionDestroy(borderVisible);
+ }
+ else {
+ RegionSubtract(exposed, universe, &pParent->borderClip);
+ }
+ if (HasParentRelativeBorder(pParent) && (dx || dy))
+ RegionSubtract(&pParent->valdata->after.borderExposed,
+ universe, &pParent->winSize);
+ else
+ RegionSubtract(&pParent->valdata->after.borderExposed,
+ exposed, &pParent->winSize);
+
+ RegionCopy(&pParent->borderClip, universe);
+
+ /*
+ * To get the right clipList for the parent, and to make doubly sure
+ * that no child overlaps the parent's border, we remove the parent's
+ * border from the universe before proceeding.
+ */
+
+ RegionIntersect(universe, universe, &pParent->winSize);
}
else
- RegionCopy(&pParent->borderClip, universe);
-
- if ((pChild = pParent->firstChild) && pParent->mapped)
- {
- RegionNull(&childUniverse);
- RegionNull(&childUnion);
- if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
- ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
- (pChild->drawable.x < pParent->lastChild->drawable.x)))
- {
- for (; pChild; pChild = pChild->nextSib)
- {
- if (pChild->viewable && !TreatAsTransparent(pChild))
- RegionAppend(&childUnion, &pChild->borderSize);
- }
- }
- else
- {
- for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib)
- {
- if (pChild->viewable && !TreatAsTransparent(pChild))
- RegionAppend(&childUnion, &pChild->borderSize);
- }
- }
- RegionValidate(&childUnion, &overlap);
-
- for (pChild = pParent->firstChild;
- pChild;
- pChild = pChild->nextSib)
- {
- if (pChild->viewable) {
- /*
- * If the child is viewable, we want to remove its extents
- * from the current universe, but we only re-clip it if
- * it's been marked.
- */
- if (pChild->valdata) {
- /*
- * Figure out the new universe from the child's
- * perspective and recurse.
- */
- RegionIntersect(&childUniverse,
- universe,
- &pChild->borderSize);
- miComputeClips (pChild, pScreen, &childUniverse, kind,
- exposed);
- }
- /*
- * Once the child has been processed, we remove its extents
- * from the current universe, thus denying its space to any
- * other sibling.
- */
- if (overlap && !TreatAsTransparent (pChild))
- RegionSubtract(universe, universe,
- &pChild->borderSize);
- }
- }
- if (!overlap)
- RegionSubtract(universe, universe, &childUnion);
- RegionUninit(&childUnion);
- RegionUninit(&childUniverse);
- } /* if any children */
+ RegionCopy(&pParent->borderClip, universe);
+
+ if ((pChild = pParent->firstChild) && pParent->mapped) {
+ RegionNull(&childUniverse);
+ RegionNull(&childUnion);
+ if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
+ ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
+ (pChild->drawable.x < pParent->lastChild->drawable.x))) {
+ for (; pChild; pChild = pChild->nextSib) {
+ if (pChild->viewable && !TreatAsTransparent(pChild))
+ RegionAppend(&childUnion, &pChild->borderSize);
+ }
+ }
+ else {
+ for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) {
+ if (pChild->viewable && !TreatAsTransparent(pChild))
+ RegionAppend(&childUnion, &pChild->borderSize);
+ }
+ }
+ RegionValidate(&childUnion, &overlap);
+
+ for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) {
+ if (pChild->viewable) {
+ /*
+ * If the child is viewable, we want to remove its extents
+ * from the current universe, but we only re-clip it if
+ * it's been marked.
+ */
+ if (pChild->valdata) {
+ /*
+ * Figure out the new universe from the child's
+ * perspective and recurse.
+ */
+ RegionIntersect(&childUniverse,
+ universe, &pChild->borderSize);
+ miComputeClips(pChild, pScreen, &childUniverse, kind,
+ exposed);
+ }
+ /*
+ * Once the child has been processed, we remove its extents
+ * from the current universe, thus denying its space to any
+ * other sibling.
+ */
+ if (overlap && !TreatAsTransparent(pChild))
+ RegionSubtract(universe, universe, &pChild->borderSize);
+ }
+ }
+ if (!overlap)
+ RegionSubtract(universe, universe, &childUnion);
+ RegionUninit(&childUnion);
+ RegionUninit(&childUniverse);
+ } /* if any children */
/*
* 'universe' now contains the new clipList for the parent window.
@@ -497,25 +464,22 @@ miComputeClips (
* new, just as for the border.
*/
- if (oldVis == VisibilityFullyObscured ||
- oldVis == VisibilityNotViewable)
- {
- RegionCopy(&pParent->valdata->after.exposed, universe);
+ if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) {
+ RegionCopy(&pParent->valdata->after.exposed, universe);
}
else if (newVis != VisibilityFullyObscured &&
- newVis != VisibilityNotViewable)
- {
- RegionSubtract(&pParent->valdata->after.exposed,
- universe, &pParent->clipList);
+ newVis != VisibilityNotViewable) {
+ RegionSubtract(&pParent->valdata->after.exposed,
+ universe, &pParent->clipList);
}
/* HACK ALERT - copying contents of regions, instead of regions */
{
- RegionRec tmp;
+ RegionRec tmp;
- tmp = pParent->clipList;
- pParent->clipList = *universe;
- *universe = tmp;
+ tmp = pParent->clipList;
+ pParent->clipList = *universe;
+ *universe = tmp;
}
#ifdef NOTDEF
@@ -525,36 +489,33 @@ miComputeClips (
pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pParent, dx, dy);
+ (*pScreen->ClipNotify) (pParent, dx, dy);
}
static void
-miTreeObscured(
- WindowPtr pParent )
+miTreeObscured(WindowPtr pParent)
{
- WindowPtr pChild;
- int oldVis;
+ WindowPtr pChild;
+ int oldVis;
pChild = pParent;
- while (1)
- {
- if (pChild->viewable)
- {
- oldVis = pChild->visibility;
- if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
- ((pChild->eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
- SendVisibilityNotify(pChild);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pParent))
- pChild = pChild->parent;
- if (pChild == pParent)
- break;
- pChild = pChild->nextSib;
+ while (1) {
+ if (pChild->viewable) {
+ oldVis = pChild->visibility;
+ if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
+ ((pChild->
+ eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
+ SendVisibilityNotify(pChild);
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pParent))
+ pChild = pChild->parent;
+ if (pChild == pParent)
+ break;
+ pChild = pChild->nextSib;
}
}
@@ -587,33 +548,31 @@ miTreeObscured(
*
*-----------------------------------------------------------------------
*/
-/*ARGSUSED*/
-int
-miValidateTree (
- WindowPtr pParent, /* Parent to validate */
- WindowPtr pChild, /* First child of pParent that was
- * affected */
- VTKind kind /* What kind of configuration caused call */
+ /*ARGSUSED*/ int
+miValidateTree(WindowPtr pParent, /* Parent to validate */
+ WindowPtr pChild, /* First child of pParent that was
+ * affected */
+ VTKind kind /* What kind of configuration caused call */
)
{
- RegionRec totalClip; /* Total clipping region available to
- * the marked children. pParent's clipList
- * merged with the borderClips of all
- * the marked children. */
- RegionRec childClip; /* The new borderClip for the current
- * child */
- RegionRec childUnion; /* the space covered by borderSize for
- * all marked children */
- RegionRec exposed; /* For intermediate calculations */
- ScreenPtr pScreen;
- WindowPtr pWin;
- Bool overlap;
- int viewvals;
- Bool forward;
+ RegionRec totalClip; /* Total clipping region available to
+ * the marked children. pParent's clipList
+ * merged with the borderClips of all
+ * the marked children. */
+ RegionRec childClip; /* The new borderClip for the current
+ * child */
+ RegionRec childUnion; /* the space covered by borderSize for
+ * all marked children */
+ RegionRec exposed; /* For intermediate calculations */
+ ScreenPtr pScreen;
+ WindowPtr pWin;
+ Bool overlap;
+ int viewvals;
+ Bool forward;
pScreen = pParent->drawable.pScreen;
if (pChild == NullWindow)
- pChild = pParent->firstChild;
+ pChild = pParent->firstChild;
RegionNull(&childClip);
RegionNull(&exposed);
@@ -626,74 +585,68 @@ miValidateTree (
*/
RegionNull(&totalClip);
viewvals = 0;
- if (RegionBroken(&pParent->clipList) &&
- !RegionBroken(&pParent->borderClip))
- {
- kind = VTBroken;
- /*
- * When rebuilding clip lists after out of memory,
- * assume everything is busted.
- */
- forward = TRUE;
- RegionCopy(&totalClip, &pParent->borderClip);
- RegionIntersect(&totalClip, &totalClip, &pParent->winSize);
-
- for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib)
- {
- if (pWin->viewable && !TreatAsTransparent (pWin))
- RegionSubtract(&totalClip, &totalClip, &pWin->borderSize);
- }
- for (pWin = pChild; pWin; pWin = pWin->nextSib)
- if (pWin->valdata && pWin->viewable)
- viewvals++;
-
- RegionEmpty(&pParent->clipList);
+ if (RegionBroken(&pParent->clipList) && !RegionBroken(&pParent->borderClip)) {
+ kind = VTBroken;
+ /*
+ * When rebuilding clip lists after out of memory,
+ * assume everything is busted.
+ */
+ forward = TRUE;
+ RegionCopy(&totalClip, &pParent->borderClip);
+ RegionIntersect(&totalClip, &totalClip, &pParent->winSize);
+
+ for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib) {
+ if (pWin->viewable && !TreatAsTransparent(pWin))
+ RegionSubtract(&totalClip, &totalClip, &pWin->borderSize);
+ }
+ for (pWin = pChild; pWin; pWin = pWin->nextSib)
+ if (pWin->valdata && pWin->viewable)
+ viewvals++;
+
+ RegionEmpty(&pParent->clipList);
}
- else
- {
- if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
- ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
- (pChild->drawable.x < pParent->lastChild->drawable.x)))
- {
- forward = TRUE;
- for (pWin = pChild; pWin; pWin = pWin->nextSib)
- {
- if (pWin->valdata)
- {
- RegionPtr pBorderClip = &pWin->borderClip;
+ else {
+ if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
+ ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
+ (pChild->drawable.x < pParent->lastChild->drawable.x))) {
+ forward = TRUE;
+ for (pWin = pChild; pWin; pWin = pWin->nextSib) {
+ if (pWin->valdata) {
+ RegionPtr pBorderClip = &pWin->borderClip;
+
#ifdef COMPOSITE
- if (pWin->redirectDraw != RedirectDrawNone && miGetRedirectBorderClipProc)
- pBorderClip = (*miGetRedirectBorderClipProc)(pWin);
+ if (pWin->redirectDraw != RedirectDrawNone &&
+ miGetRedirectBorderClipProc)
+ pBorderClip = (*miGetRedirectBorderClipProc) (pWin);
#endif
- RegionAppend(&totalClip, pBorderClip );
- if (pWin->viewable)
- viewvals++;
- }
- }
- }
- else
- {
- forward = FALSE;
- pWin = pParent->lastChild;
- while (1)
- {
- if (pWin->valdata)
- {
- RegionPtr pBorderClip = &pWin->borderClip;
+ RegionAppend(&totalClip, pBorderClip);
+ if (pWin->viewable)
+ viewvals++;
+ }
+ }
+ }
+ else {
+ forward = FALSE;
+ pWin = pParent->lastChild;
+ while (1) {
+ if (pWin->valdata) {
+ RegionPtr pBorderClip = &pWin->borderClip;
+
#ifdef COMPOSITE
- if (pWin->redirectDraw != RedirectDrawNone && miGetRedirectBorderClipProc)
- pBorderClip = (*miGetRedirectBorderClipProc)(pWin);
+ if (pWin->redirectDraw != RedirectDrawNone &&
+ miGetRedirectBorderClipProc)
+ pBorderClip = (*miGetRedirectBorderClipProc) (pWin);
#endif
- RegionAppend(&totalClip, pBorderClip );
- if (pWin->viewable)
- viewvals++;
- }
- if (pWin == pChild)
- break;
- pWin = pWin->prevSib;
- }
- }
- RegionValidate(&totalClip, &overlap);
+ RegionAppend(&totalClip, pBorderClip);
+ if (pWin->viewable)
+ viewvals++;
+ }
+ if (pWin == pChild)
+ break;
+ pWin = pWin->prevSib;
+ }
+ }
+ RegionValidate(&totalClip, &overlap);
}
/*
@@ -704,80 +657,68 @@ miValidateTree (
*/
overlap = TRUE;
- if (kind != VTStack)
- {
- RegionUnion(&totalClip, &totalClip, &pParent->clipList);
- if (viewvals > 1)
- {
- /*
- * precompute childUnion to discover whether any of them
- * overlap. This seems redundant, but performance studies
- * have demonstrated that the cost of this loop is
- * lower than the cost of multiple Subtracts in the
- * loop below.
- */
- RegionNull(&childUnion);
- if (forward)
- {
- for (pWin = pChild; pWin; pWin = pWin->nextSib)
- if (pWin->valdata && pWin->viewable && !TreatAsTransparent (pWin))
- RegionAppend(&childUnion,
- &pWin->borderSize);
- }
- else
- {
- pWin = pParent->lastChild;
- while (1)
- {
- if (pWin->valdata && pWin->viewable && !TreatAsTransparent (pWin))
- RegionAppend(&childUnion,
- &pWin->borderSize);
- if (pWin == pChild)
- break;
- pWin = pWin->prevSib;
- }
- }
- RegionValidate(&childUnion, &overlap);
- if (overlap)
- RegionUninit(&childUnion);
- }
+ if (kind != VTStack) {
+ RegionUnion(&totalClip, &totalClip, &pParent->clipList);
+ if (viewvals > 1) {
+ /*
+ * precompute childUnion to discover whether any of them
+ * overlap. This seems redundant, but performance studies
+ * have demonstrated that the cost of this loop is
+ * lower than the cost of multiple Subtracts in the
+ * loop below.
+ */
+ RegionNull(&childUnion);
+ if (forward) {
+ for (pWin = pChild; pWin; pWin = pWin->nextSib)
+ if (pWin->valdata && pWin->viewable &&
+ !TreatAsTransparent(pWin))
+ RegionAppend(&childUnion, &pWin->borderSize);
+ }
+ else {
+ pWin = pParent->lastChild;
+ while (1) {
+ if (pWin->valdata && pWin->viewable &&
+ !TreatAsTransparent(pWin))
+ RegionAppend(&childUnion, &pWin->borderSize);
+ if (pWin == pChild)
+ break;
+ pWin = pWin->prevSib;
+ }
+ }
+ RegionValidate(&childUnion, &overlap);
+ if (overlap)
+ RegionUninit(&childUnion);
+ }
}
- for (pWin = pChild;
- pWin != NullWindow;
- pWin = pWin->nextSib)
- {
- if (pWin->viewable) {
- if (pWin->valdata) {
- RegionIntersect(&childClip,
- &totalClip,
- &pWin->borderSize);
- miComputeClips (pWin, pScreen, &childClip, kind, &exposed);
- if (overlap && !TreatAsTransparent (pWin))
- {
- RegionSubtract(&totalClip,
- &totalClip,
- &pWin->borderSize);
- }
- } else if (pWin->visibility == VisibilityNotViewable) {
- miTreeObscured(pWin);
- }
- } else {
- if (pWin->valdata) {
- RegionEmpty(&pWin->clipList);
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pWin, 0, 0);
- RegionEmpty(&pWin->borderClip);
- pWin->valdata = NULL;
- }
- }
+ for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) {
+ if (pWin->viewable) {
+ if (pWin->valdata) {
+ RegionIntersect(&childClip, &totalClip, &pWin->borderSize);
+ miComputeClips(pWin, pScreen, &childClip, kind, &exposed);
+ if (overlap && !TreatAsTransparent(pWin)) {
+ RegionSubtract(&totalClip, &totalClip, &pWin->borderSize);
+ }
+ }
+ else if (pWin->visibility == VisibilityNotViewable) {
+ miTreeObscured(pWin);
+ }
+ }
+ else {
+ if (pWin->valdata) {
+ RegionEmpty(&pWin->clipList);
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (pWin, 0, 0);
+ RegionEmpty(&pWin->borderClip);
+ pWin->valdata = NULL;
+ }
+ }
}
RegionUninit(&childClip);
- if (!overlap)
- {
- RegionSubtract(&totalClip, &totalClip, &childUnion);
- RegionUninit(&childUnion);
+ if (!overlap) {
+ RegionSubtract(&totalClip, &totalClip, &childUnion);
+ RegionUninit(&childUnion);
}
if (pParent->valdata && pParent->valdata!=UnmapValData)
@@ -792,26 +733,26 @@ miValidateTree (
switch (kind) {
case VTStack:
- break;
+ break;
default:
- /*
- * totalClip contains the new clipList for the parent. Figure out
- * exposures and obscures as per miComputeClips and reset the parent's
- * clipList.
- */
- if (pParent->valdata && pParent->valdata!=UnmapValData)
- RegionSubtract(&pParent->valdata->after.exposed,
- &totalClip, &pParent->clipList);
- /* fall through */
+ /*
+ * totalClip contains the new clipList for the parent. Figure out
+ * exposures and obscures as per miComputeClips and reset the parent's
+ * clipList.
+ */
+ if (pParent->valdata && pParent->valdata!=UnmapValData)
+ RegionSubtract(&pParent->valdata->after.exposed,
+ &totalClip, &pParent->clipList);
+ /* fall through */
case VTMap:
- RegionCopy(&pParent->clipList, &totalClip);
- pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- break;
+ RegionCopy(&pParent->clipList, &totalClip);
+ pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ break;
}
RegionUninit(&totalClip);
RegionUninit(&exposed);
if (pScreen->ClipNotify)
- (*pScreen->ClipNotify) (pParent, 0, 0);
+ (*pScreen->ClipNotify) (pParent, 0, 0);
return 1;
}
diff --git a/xorg-server/mi/miwideline.c b/xorg-server/mi/miwideline.c
index 122566f38..242f3f8b0 100644
--- a/xorg-server/mi/miwideline.c
+++ b/xorg-server/mi/miwideline.c
@@ -41,7 +41,7 @@ from The Open Group.
#ifdef _XOPEN_SOURCE
#include <math.h>
#else
-#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */
+#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */
#include <math.h>
#undef _XOPEN_SOURCE
#endif
@@ -57,16 +57,15 @@ from The Open Group.
#include "mi.h"
static Bool
-InitSpans(Spans *spans, size_t nspans)
+InitSpans(Spans * spans, size_t nspans)
{
- spans->points = malloc(nspans * sizeof (*spans->points));
+ spans->points = malloc(nspans * sizeof(*spans->points));
if (!spans->points)
- return FALSE;
- spans->widths = malloc(nspans * sizeof (*spans->widths));
- if (!spans->widths)
- {
- free(spans->points);
- return FALSE;
+ return FALSE;
+ spans->widths = malloc(nspans * sizeof(*spans->widths));
+ if (!spans->widths) {
+ free(spans->points);
+ return FALSE;
}
return TRUE;
}
@@ -76,399 +75,355 @@ InitSpans(Spans *spans, size_t nspans)
*/
typedef struct _SpanData {
- SpanGroup fgGroup, bgGroup;
+ SpanGroup fgGroup, bgGroup;
} SpanDataRec, *SpanDataPtr;
static void
-AppendSpanGroup(GCPtr pGC, unsigned long pixel, Spans *spanPtr, SpanDataPtr spanData)
+AppendSpanGroup(GCPtr pGC, unsigned long pixel, Spans * spanPtr,
+ SpanDataPtr spanData)
{
SpanGroup *group, *othergroup = NULL;
- if (pixel == pGC->fgPixel)
- {
- group = &spanData->fgGroup;
- if (pGC->lineStyle == LineDoubleDash)
- othergroup = &spanData->bgGroup;
+
+ if (pixel == pGC->fgPixel) {
+ group = &spanData->fgGroup;
+ if (pGC->lineStyle == LineDoubleDash)
+ othergroup = &spanData->bgGroup;
}
- else
- {
- group = &spanData->bgGroup;
- othergroup = &spanData->fgGroup;
+ else {
+ group = &spanData->bgGroup;
+ othergroup = &spanData->fgGroup;
}
- miAppendSpans (group, othergroup, spanPtr);
+ miAppendSpans(group, othergroup, spanPtr);
}
-
static void miLineArc(DrawablePtr pDraw, GCPtr pGC,
- unsigned long pixel, SpanDataPtr spanData,
- LineFacePtr leftFace,
- LineFacePtr rightFace,
- double xorg, double yorg, Bool isInt);
-
+ unsigned long pixel, SpanDataPtr spanData,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace,
+ double xorg, double yorg, Bool isInt);
/*
* spans-based polygon filler
*/
static void
-fillSpans(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, Spans *spans, SpanDataPtr spanData)
+fillSpans(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, Spans * spans,
+ SpanDataPtr spanData)
{
- if (!spanData)
- {
- ChangeGCVal oldPixel, tmpPixel;
- oldPixel.val = pGC->fgPixel;
- if (pixel != oldPixel.val)
- {
- tmpPixel.val = (XID)pixel;
- ChangeGC (NullClient, pGC, GCForeground, &tmpPixel);
- ValidateGC (pDrawable, pGC);
- }
- (*pGC->ops->FillSpans) (pDrawable, pGC, spans->count, spans->points, spans->widths, TRUE);
- free(spans->widths);
- free(spans->points);
- if (pixel != oldPixel.val)
- {
- ChangeGC (NullClient, pGC, GCForeground, &oldPixel);
- ValidateGC (pDrawable, pGC);
- }
+ if (!spanData) {
+ ChangeGCVal oldPixel, tmpPixel;
+
+ oldPixel.val = pGC->fgPixel;
+ if (pixel != oldPixel.val) {
+ tmpPixel.val = (XID) pixel;
+ ChangeGC(NullClient, pGC, GCForeground, &tmpPixel);
+ ValidateGC(pDrawable, pGC);
+ }
+ (*pGC->ops->FillSpans) (pDrawable, pGC, spans->count, spans->points,
+ spans->widths, TRUE);
+ free(spans->widths);
+ free(spans->points);
+ if (pixel != oldPixel.val) {
+ ChangeGC(NullClient, pGC, GCForeground, &oldPixel);
+ ValidateGC(pDrawable, pGC);
+ }
}
else
- AppendSpanGroup (pGC, pixel, spans, spanData);
+ AppendSpanGroup(pGC, pixel, spans, spanData);
}
static void
-miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
- SpanDataPtr spanData, int y, int overall_height,
- PolyEdgePtr left, PolyEdgePtr right,
- int left_count, int right_count)
+miFillPolyHelper(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
+ SpanDataPtr spanData, int y, int overall_height,
+ PolyEdgePtr left, PolyEdgePtr right,
+ int left_count, int right_count)
{
int left_x = 0, left_e = 0;
- int left_stepx = 0;
- int left_signdx = 0;
- int left_dy = 0, left_dx = 0;
+ int left_stepx = 0;
+ int left_signdx = 0;
+ int left_dy = 0, left_dx = 0;
int right_x = 0, right_e = 0;
- int right_stepx = 0;
- int right_signdx = 0;
- int right_dy = 0, right_dx = 0;
+ int right_stepx = 0;
+ int right_signdx = 0;
+ int right_dy = 0, right_dx = 0;
- int height = 0;
- int left_height = 0, right_height = 0;
+ int height = 0;
+ int left_height = 0, right_height = 0;
DDXPointPtr ppt;
- int *pwidth;
- int xorg;
- Spans spanRec;
+ int *pwidth;
+ int xorg;
+ Spans spanRec;
if (!InitSpans(&spanRec, overall_height))
- return;
+ return;
ppt = spanRec.points;
pwidth = spanRec.widths;
xorg = 0;
- if (pGC->miTranslate)
- {
- y += pDrawable->y;
- xorg = pDrawable->x;
- }
- while ((left_count || left_height) &&
- (right_count || right_height))
- {
- if (!left_height && left_count)
- {
- left_height = left->height;
- left_x = left->x;
- left_stepx = left->stepx;
- left_signdx = left->signdx;
- left_e = left->e;
- left_dy = left->dy;
- left_dx = left->dx;
- --left_count;
- ++left;
- }
-
- if (!right_height && right_count)
- {
- right_height = right->height;
- right_x = right->x;
- right_stepx = right->stepx;
- right_signdx = right->signdx;
- right_e = right->e;
- right_dy = right->dy;
- right_dx = right->dx;
- --right_count;
- ++right;
- }
-
- height = left_height;
- if (height > right_height)
- height = right_height;
-
- left_height -= height;
- right_height -= height;
-
- while (--height >= 0)
- {
- if (right_x >= left_x)
- {
- ppt->y = y;
- ppt->x = left_x + xorg;
- ppt++;
- *pwidth++ = right_x - left_x + 1;
- }
- y++;
-
- left_x += left_stepx;
- left_e += left_dx;
- if (left_e > 0)
- {
- left_x += left_signdx;
- left_e -= left_dy;
- }
-
- right_x += right_stepx;
- right_e += right_dx;
- if (right_e > 0)
- {
- right_x += right_signdx;
- right_e -= right_dy;
- }
- }
+ if (pGC->miTranslate) {
+ y += pDrawable->y;
+ xorg = pDrawable->x;
+ }
+ while ((left_count || left_height) && (right_count || right_height)) {
+ if (!left_height && left_count) {
+ left_height = left->height;
+ left_x = left->x;
+ left_stepx = left->stepx;
+ left_signdx = left->signdx;
+ left_e = left->e;
+ left_dy = left->dy;
+ left_dx = left->dx;
+ --left_count;
+ ++left;
+ }
+
+ if (!right_height && right_count) {
+ right_height = right->height;
+ right_x = right->x;
+ right_stepx = right->stepx;
+ right_signdx = right->signdx;
+ right_e = right->e;
+ right_dy = right->dy;
+ right_dx = right->dx;
+ --right_count;
+ ++right;
+ }
+
+ height = left_height;
+ if (height > right_height)
+ height = right_height;
+
+ left_height -= height;
+ right_height -= height;
+
+ while (--height >= 0) {
+ if (right_x >= left_x) {
+ ppt->y = y;
+ ppt->x = left_x + xorg;
+ ppt++;
+ *pwidth++ = right_x - left_x + 1;
+ }
+ y++;
+
+ left_x += left_stepx;
+ left_e += left_dx;
+ if (left_e > 0) {
+ left_x += left_signdx;
+ left_e -= left_dy;
+ }
+
+ right_x += right_stepx;
+ right_e += right_dx;
+ if (right_e > 0) {
+ right_x += right_signdx;
+ right_e -= right_dy;
+ }
+ }
}
spanRec.count = ppt - spanRec.points;
- fillSpans (pDrawable, pGC, pixel, &spanRec, spanData);
+ fillSpans(pDrawable, pGC, pixel, &spanRec, spanData);
}
static void
-miFillRectPolyHelper (
- DrawablePtr pDrawable,
- GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- int x,
- int y,
- int w,
- int h)
+miFillRectPolyHelper(DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData, int x, int y, int w, int h)
{
DDXPointPtr ppt;
- int *pwidth;
- ChangeGCVal oldPixel, tmpPixel;
- Spans spanRec;
- xRectangle rect;
-
- if (!spanData)
- {
- rect.x = x;
- rect.y = y;
- rect.width = w;
- rect.height = h;
- oldPixel.val = pGC->fgPixel;
- if (pixel != oldPixel.val)
- {
- tmpPixel.val = (XID)pixel;
- ChangeGC (NullClient, pGC, GCForeground, &tmpPixel);
- ValidateGC (pDrawable, pGC);
- }
- (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &rect);
- if (pixel != oldPixel.val)
- {
- ChangeGC (NullClient, pGC, GCForeground, &oldPixel);
- ValidateGC (pDrawable, pGC);
- }
- }
- else
- {
- if (!InitSpans(&spanRec, h))
- return;
- ppt = spanRec.points;
- pwidth = spanRec.widths;
-
- if (pGC->miTranslate)
- {
- y += pDrawable->y;
- x += pDrawable->x;
- }
- while (h--)
- {
- ppt->x = x;
- ppt->y = y;
- ppt++;
- *pwidth++ = w;
- y++;
- }
- spanRec.count = ppt - spanRec.points;
- AppendSpanGroup (pGC, pixel, &spanRec, spanData);
+ int *pwidth;
+ ChangeGCVal oldPixel, tmpPixel;
+ Spans spanRec;
+ xRectangle rect;
+
+ if (!spanData) {
+ rect.x = x;
+ rect.y = y;
+ rect.width = w;
+ rect.height = h;
+ oldPixel.val = pGC->fgPixel;
+ if (pixel != oldPixel.val) {
+ tmpPixel.val = (XID) pixel;
+ ChangeGC(NullClient, pGC, GCForeground, &tmpPixel);
+ ValidateGC(pDrawable, pGC);
+ }
+ (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &rect);
+ if (pixel != oldPixel.val) {
+ ChangeGC(NullClient, pGC, GCForeground, &oldPixel);
+ ValidateGC(pDrawable, pGC);
+ }
+ }
+ else {
+ if (!InitSpans(&spanRec, h))
+ return;
+ ppt = spanRec.points;
+ pwidth = spanRec.widths;
+
+ if (pGC->miTranslate) {
+ y += pDrawable->y;
+ x += pDrawable->x;
+ }
+ while (h--) {
+ ppt->x = x;
+ ppt->y = y;
+ ppt++;
+ *pwidth++ = w;
+ y++;
+ }
+ spanRec.count = ppt - spanRec.points;
+ AppendSpanGroup(pGC, pixel, &spanRec, spanData);
}
}
/* static */ int
-miPolyBuildEdge (
- double x0,
- double y0,
- double k, /* x0 * dy - y0 * dx */
- int dx,
- int dy,
- int xi,
- int yi,
- int left,
- PolyEdgePtr edge)
+miPolyBuildEdge(double x0, double y0, double k, /* x0 * dy - y0 * dx */
+ int dx, int dy, int xi, int yi, int left, PolyEdgePtr edge)
{
- int x, y, e;
- int xady;
+ int x, y, e;
+ int xady;
- if (dy < 0)
- {
- dy = -dy;
- dx = -dx;
- k = -k;
+ if (dy < 0) {
+ dy = -dy;
+ dx = -dx;
+ k = -k;
}
#ifdef NOTDEF
{
- double realk, kerror;
- realk = x0 * dy - y0 * dx;
- kerror = fabs (realk - k);
- if (kerror > .1)
- printf ("realk: %g k: %g\n", realk, k);
+ double realk, kerror;
+
+ realk = x0 * dy - y0 * dx;
+ kerror = fabs(realk - k);
+ if (kerror > .1)
+ printf("realk: %g k: %g\n", realk, k);
}
#endif
- y = ICEIL (y0);
- xady = ICEIL (k) + y * dx;
+ y = ICEIL(y0);
+ xady = ICEIL(k) + y * dx;
if (xady <= 0)
- x = - (-xady / dy) - 1;
+ x = -(-xady / dy) - 1;
else
- x = (xady - 1) / dy;
+ x = (xady - 1) / dy;
e = xady - x * dy;
- if (dx >= 0)
- {
- edge->signdx = 1;
- edge->stepx = dx / dy;
- edge->dx = dx % dy;
+ if (dx >= 0) {
+ edge->signdx = 1;
+ edge->stepx = dx / dy;
+ edge->dx = dx % dy;
}
- else
- {
- edge->signdx = -1;
- edge->stepx = - (-dx / dy);
- edge->dx = -dx % dy;
- e = dy - e + 1;
+ else {
+ edge->signdx = -1;
+ edge->stepx = -(-dx / dy);
+ edge->dx = -dx % dy;
+ e = dy - e + 1;
}
edge->dy = dy;
edge->x = x + left + xi;
- edge->e = e - dy; /* bias to compare against 0 instead of dy */
+ edge->e = e - dy; /* bias to compare against 0 instead of dy */
return y + yi;
}
#define StepAround(v, incr, max) (((v) + (incr) < 0) ? (max - 1) : ((v) + (incr) == max) ? 0 : ((v) + (incr)))
/* static */ int
-miPolyBuildPoly (
- PolyVertexPtr vertices,
- PolySlopePtr slopes,
- int count,
- int xi,
- int yi,
- PolyEdgePtr left,
- PolyEdgePtr right,
- int *pnleft,
- int *pnright,
- int *h)
+miPolyBuildPoly(PolyVertexPtr vertices,
+ PolySlopePtr slopes,
+ int count,
+ int xi,
+ int yi,
+ PolyEdgePtr left,
+ PolyEdgePtr right, int *pnleft, int *pnright, int *h)
{
- int top, bottom;
- double miny, maxy;
- int i;
- int j;
- int clockwise;
- int slopeoff;
- int s;
- int nright, nleft;
- int y, lasty = 0, bottomy, topy = 0;
+ int top, bottom;
+ double miny, maxy;
+ int i;
+ int j;
+ int clockwise;
+ int slopeoff;
+ int s;
+ int nright, nleft;
+ int y, lasty = 0, bottomy, topy = 0;
/* find the top of the polygon */
maxy = miny = vertices[0].y;
bottom = top = 0;
- for (i = 1; i < count; i++)
- {
- if (vertices[i].y < miny)
- {
- top = i;
- miny = vertices[i].y;
- }
- if (vertices[i].y >= maxy)
- {
- bottom = i;
- maxy = vertices[i].y;
- }
+ for (i = 1; i < count; i++) {
+ if (vertices[i].y < miny) {
+ top = i;
+ miny = vertices[i].y;
+ }
+ if (vertices[i].y >= maxy) {
+ bottom = i;
+ maxy = vertices[i].y;
+ }
}
clockwise = 1;
slopeoff = 0;
i = top;
- j = StepAround (top, -1, count);
+ j = StepAround(top, -1, count);
- if ((int64_t)slopes[j].dy * slopes[i].dx > (int64_t)slopes[i].dy * slopes[j].dx)
- {
- clockwise = -1;
- slopeoff = -1;
+ if ((int64_t) slopes[j].dy * slopes[i].dx >
+ (int64_t) slopes[i].dy * slopes[j].dx) {
+ clockwise = -1;
+ slopeoff = -1;
}
- bottomy = ICEIL (maxy) + yi;
+ bottomy = ICEIL(maxy) + yi;
nright = 0;
- s = StepAround (top, slopeoff, count);
+ s = StepAround(top, slopeoff, count);
i = top;
- while (i != bottom)
- {
- if (slopes[s].dy != 0)
- {
- y = miPolyBuildEdge (vertices[i].x, vertices[i].y,
- slopes[s].k,
- slopes[s].dx, slopes[s].dy,
- xi, yi, 0,
- &right[nright]);
- if (nright != 0)
- right[nright-1].height = y - lasty;
- else
- topy = y;
- nright++;
- lasty = y;
- }
-
- i = StepAround (i, clockwise, count);
- s = StepAround (s, clockwise, count);
+ while (i != bottom) {
+ if (slopes[s].dy != 0) {
+ y = miPolyBuildEdge(vertices[i].x, vertices[i].y,
+ slopes[s].k,
+ slopes[s].dx, slopes[s].dy,
+ xi, yi, 0, &right[nright]);
+ if (nright != 0)
+ right[nright - 1].height = y - lasty;
+ else
+ topy = y;
+ nright++;
+ lasty = y;
+ }
+
+ i = StepAround(i, clockwise, count);
+ s = StepAround(s, clockwise, count);
}
if (nright != 0)
- right[nright-1].height = bottomy - lasty;
+ right[nright - 1].height = bottomy - lasty;
if (slopeoff == 0)
- slopeoff = -1;
+ slopeoff = -1;
else
- slopeoff = 0;
+ slopeoff = 0;
nleft = 0;
- s = StepAround (top, slopeoff, count);
+ s = StepAround(top, slopeoff, count);
i = top;
- while (i != bottom)
- {
- if (slopes[s].dy != 0)
- {
- y = miPolyBuildEdge (vertices[i].x, vertices[i].y,
- slopes[s].k,
- slopes[s].dx, slopes[s].dy, xi, yi, 1,
- &left[nleft]);
-
- if (nleft != 0)
- left[nleft-1].height = y - lasty;
- nleft++;
- lasty = y;
- }
- i = StepAround (i, -clockwise, count);
- s = StepAround (s, -clockwise, count);
+ while (i != bottom) {
+ if (slopes[s].dy != 0) {
+ y = miPolyBuildEdge(vertices[i].x, vertices[i].y,
+ slopes[s].k,
+ slopes[s].dx, slopes[s].dy, xi, yi, 1,
+ &left[nleft]);
+
+ if (nleft != 0)
+ left[nleft - 1].height = y - lasty;
+ nleft++;
+ lasty = y;
+ }
+ i = StepAround(i, -clockwise, count);
+ s = StepAround(s, -clockwise, count);
}
if (nleft != 0)
- left[nleft-1].height = bottomy - lasty;
+ left[nleft - 1].height = bottomy - lasty;
*pnleft = nleft;
*pnright = nright;
*h = bottomy - topy;
@@ -476,198 +431,177 @@ miPolyBuildPoly (
}
static void
-miLineOnePoint (
- DrawablePtr pDrawable,
- GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- int x,
- int y)
+miLineOnePoint(DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel, SpanDataPtr spanData, int x, int y)
{
DDXPointRec pt;
- int wid;
- unsigned long oldPixel;
-
- MILINESETPIXEL (pDrawable, pGC, pixel, oldPixel);
- if (pGC->fillStyle == FillSolid)
- {
- pt.x = x;
- pt.y = y;
- (*pGC->ops->PolyPoint) (pDrawable, pGC, CoordModeOrigin, 1, &pt);
- }
- else
- {
- wid = 1;
- if (pGC->miTranslate)
- {
- x += pDrawable->x;
- y += pDrawable->y;
- }
- pt.x = x;
- pt.y = y;
- (*pGC->ops->FillSpans) (pDrawable, pGC, 1, &pt, &wid, TRUE);
- }
- MILINERESETPIXEL (pDrawable, pGC, pixel, oldPixel);
+ int wid;
+ unsigned long oldPixel;
+
+ MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel);
+ if (pGC->fillStyle == FillSolid) {
+ pt.x = x;
+ pt.y = y;
+ (*pGC->ops->PolyPoint) (pDrawable, pGC, CoordModeOrigin, 1, &pt);
+ }
+ else {
+ wid = 1;
+ if (pGC->miTranslate) {
+ x += pDrawable->x;
+ y += pDrawable->y;
+ }
+ pt.x = x;
+ pt.y = y;
+ (*pGC->ops->FillSpans) (pDrawable, pGC, 1, &pt, &wid, TRUE);
+ }
+ MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel);
}
static void
-miLineJoin (
- DrawablePtr pDrawable,
- GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- LineFacePtr pLeft,
- LineFacePtr pRight)
+miLineJoin(DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData, LineFacePtr pLeft, LineFacePtr pRight)
{
- double mx = 0, my = 0;
- double denom = 0.0;
- PolyVertexRec vertices[4];
- PolySlopeRec slopes[4];
- int edgecount;
- PolyEdgeRec left[4], right[4];
- int nleft, nright;
- int y, height;
- int swapslopes;
- int joinStyle = pGC->joinStyle;
- int lw = pGC->lineWidth;
+ double mx = 0, my = 0;
+ double denom = 0.0;
+ PolyVertexRec vertices[4];
+ PolySlopeRec slopes[4];
+ int edgecount;
+ PolyEdgeRec left[4], right[4];
+ int nleft, nright;
+ int y, height;
+ int swapslopes;
+ int joinStyle = pGC->joinStyle;
+ int lw = pGC->lineWidth;
if (lw == 1 && !spanData) {
- /* See if one of the lines will draw the joining pixel */
- if (pLeft->dx > 0 || (pLeft->dx == 0 && pLeft->dy > 0))
- return;
- if (pRight->dx > 0 || (pRight->dx == 0 && pRight->dy > 0))
- return;
- if (joinStyle != JoinRound) {
- denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy;
- if (denom == 0)
- return; /* no join to draw */
- }
- if (joinStyle != JoinMiter) {
- miLineOnePoint (pDrawable, pGC, pixel, spanData, pLeft->x, pLeft->y);
- return;
- }
- } else {
- if (joinStyle == JoinRound)
- {
- miLineArc(pDrawable, pGC, pixel, spanData,
- pLeft, pRight,
- (double)0.0, (double)0.0, TRUE);
- return;
- }
- denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy;
- if (denom == 0.0)
- return; /* no join to draw */
+ /* See if one of the lines will draw the joining pixel */
+ if (pLeft->dx > 0 || (pLeft->dx == 0 && pLeft->dy > 0))
+ return;
+ if (pRight->dx > 0 || (pRight->dx == 0 && pRight->dy > 0))
+ return;
+ if (joinStyle != JoinRound) {
+ denom =
+ -pLeft->dx * (double) pRight->dy +
+ pRight->dx * (double) pLeft->dy;
+ if (denom == 0)
+ return; /* no join to draw */
+ }
+ if (joinStyle != JoinMiter) {
+ miLineOnePoint(pDrawable, pGC, pixel, spanData, pLeft->x, pLeft->y);
+ return;
+ }
+ }
+ else {
+ if (joinStyle == JoinRound) {
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ pLeft, pRight, (double) 0.0, (double) 0.0, TRUE);
+ return;
+ }
+ denom =
+ -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy;
+ if (denom == 0.0)
+ return; /* no join to draw */
}
swapslopes = 0;
- if (denom > 0)
- {
- pLeft->xa = -pLeft->xa;
- pLeft->ya = -pLeft->ya;
- pLeft->dx = -pLeft->dx;
- pLeft->dy = -pLeft->dy;
+ if (denom > 0) {
+ pLeft->xa = -pLeft->xa;
+ pLeft->ya = -pLeft->ya;
+ pLeft->dx = -pLeft->dx;
+ pLeft->dy = -pLeft->dy;
}
- else
- {
- swapslopes = 1;
- pRight->xa = -pRight->xa;
- pRight->ya = -pRight->ya;
- pRight->dx = -pRight->dx;
- pRight->dy = -pRight->dy;
+ else {
+ swapslopes = 1;
+ pRight->xa = -pRight->xa;
+ pRight->ya = -pRight->ya;
+ pRight->dx = -pRight->dx;
+ pRight->dy = -pRight->dy;
}
vertices[0].x = pRight->xa;
vertices[0].y = pRight->ya;
slopes[0].dx = -pRight->dy;
- slopes[0].dy = pRight->dx;
+ slopes[0].dy = pRight->dx;
slopes[0].k = 0;
vertices[1].x = 0;
vertices[1].y = 0;
- slopes[1].dx = pLeft->dy;
+ slopes[1].dx = pLeft->dy;
slopes[1].dy = -pLeft->dx;
slopes[1].k = 0;
vertices[2].x = pLeft->xa;
vertices[2].y = pLeft->ya;
- if (joinStyle == JoinMiter)
- {
- my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) -
- pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx )) /
- denom;
- if (pLeft->dy != 0)
- {
- mx = pLeft->xa + (my - pLeft->ya) *
- (double) pLeft->dx / (double) pLeft->dy;
- }
- else
- {
- mx = pRight->xa + (my - pRight->ya) *
- (double) pRight->dx / (double) pRight->dy;
- }
- /* check miter limit */
- if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw)
- joinStyle = JoinBevel;
- }
-
- if (joinStyle == JoinMiter)
- {
- slopes[2].dx = pLeft->dx;
- slopes[2].dy = pLeft->dy;
- slopes[2].k = pLeft->k;
- if (swapslopes)
- {
- slopes[2].dx = -slopes[2].dx;
- slopes[2].dy = -slopes[2].dy;
- slopes[2].k = -slopes[2].k;
- }
- vertices[3].x = mx;
- vertices[3].y = my;
- slopes[3].dx = pRight->dx;
- slopes[3].dy = pRight->dy;
- slopes[3].k = pRight->k;
- if (swapslopes)
- {
- slopes[3].dx = -slopes[3].dx;
- slopes[3].dy = -slopes[3].dy;
- slopes[3].k = -slopes[3].k;
- }
- edgecount = 4;
- }
- else
- {
- double scale, dx, dy, adx, ady;
-
- adx = dx = pRight->xa - pLeft->xa;
- ady = dy = pRight->ya - pLeft->ya;
- if (adx < 0)
- adx = -adx;
- if (ady < 0)
- ady = -ady;
- scale = ady;
- if (adx > ady)
- scale = adx;
- slopes[2].dx = (dx * 65536) / scale;
- slopes[2].dy = (dy * 65536) / scale;
- slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy -
- (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0;
- edgecount = 3;
- }
-
- y = miPolyBuildPoly (vertices, slopes, edgecount, pLeft->x, pLeft->y,
- left, right, &nleft, &nright, &height);
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, height, left, right, nleft, nright);
+ if (joinStyle == JoinMiter) {
+ my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) -
+ pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx)) /
+ denom;
+ if (pLeft->dy != 0) {
+ mx = pLeft->xa + (my - pLeft->ya) *
+ (double) pLeft->dx / (double) pLeft->dy;
+ }
+ else {
+ mx = pRight->xa + (my - pRight->ya) *
+ (double) pRight->dx / (double) pRight->dy;
+ }
+ /* check miter limit */
+ if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw)
+ joinStyle = JoinBevel;
+ }
+
+ if (joinStyle == JoinMiter) {
+ slopes[2].dx = pLeft->dx;
+ slopes[2].dy = pLeft->dy;
+ slopes[2].k = pLeft->k;
+ if (swapslopes) {
+ slopes[2].dx = -slopes[2].dx;
+ slopes[2].dy = -slopes[2].dy;
+ slopes[2].k = -slopes[2].k;
+ }
+ vertices[3].x = mx;
+ vertices[3].y = my;
+ slopes[3].dx = pRight->dx;
+ slopes[3].dy = pRight->dy;
+ slopes[3].k = pRight->k;
+ if (swapslopes) {
+ slopes[3].dx = -slopes[3].dx;
+ slopes[3].dy = -slopes[3].dy;
+ slopes[3].k = -slopes[3].k;
+ }
+ edgecount = 4;
+ }
+ else {
+ double scale, dx, dy, adx, ady;
+
+ adx = dx = pRight->xa - pLeft->xa;
+ ady = dy = pRight->ya - pLeft->ya;
+ if (adx < 0)
+ adx = -adx;
+ if (ady < 0)
+ ady = -ady;
+ scale = ady;
+ if (adx > ady)
+ scale = adx;
+ slopes[2].dx = (dx * 65536) / scale;
+ slopes[2].dy = (dy * 65536) / scale;
+ slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy -
+ (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0;
+ edgecount = 3;
+ }
+
+ y = miPolyBuildPoly(vertices, slopes, edgecount, pLeft->x, pLeft->y,
+ left, right, &nleft, &nright, &height);
+ miFillPolyHelper(pDrawable, pGC, pixel, spanData, y, height, left, right,
+ nleft, nright);
}
static int
-miLineArcI (
- DrawablePtr pDraw,
- GCPtr pGC,
- int xorg,
- int yorg,
- DDXPointPtr points,
- int *widths)
+miLineArcI(DrawablePtr pDraw,
+ GCPtr pGC, int xorg, int yorg, DDXPointPtr points, int *widths)
{
DDXPointPtr tpts, bpts;
int *twids, *bwids;
@@ -675,51 +609,46 @@ miLineArcI (
tpts = points;
twids = widths;
- if (pGC->miTranslate)
- {
- xorg += pDraw->x;
- yorg += pDraw->y;
+ if (pGC->miTranslate) {
+ xorg += pDraw->x;
+ yorg += pDraw->y;
}
slw = pGC->lineWidth;
- if (slw == 1)
- {
- tpts->x = xorg;
- tpts->y = yorg;
- *twids = 1;
- return 1;
+ if (slw == 1) {
+ tpts->x = xorg;
+ tpts->y = yorg;
+ *twids = 1;
+ return 1;
}
bpts = tpts + slw;
bwids = twids + slw;
y = (slw >> 1) + 1;
if (slw & 1)
- e = - ((y << 2) + 3);
+ e = -((y << 2) + 3);
else
- e = - (y << 3);
+ e = -(y << 3);
ex = -4;
x = 0;
- while (y)
- {
- e += (y << 3) - 4;
- while (e >= 0)
- {
- x++;
- e += (ex = -((x << 3) + 4));
- }
- y--;
- slw = (x << 1) + 1;
- if ((e == ex) && (slw > 1))
- slw--;
- tpts->x = xorg - x;
- tpts->y = yorg - y;
- tpts++;
- *twids++ = slw;
- if ((y != 0) && ((slw > 1) || (e != ex)))
- {
- bpts--;
- bpts->x = xorg - x;
- bpts->y = yorg + y;
- *--bwids = slw;
- }
+ while (y) {
+ e += (y << 3) - 4;
+ while (e >= 0) {
+ x++;
+ e += (ex = -((x << 3) + 4));
+ }
+ y--;
+ slw = (x << 1) + 1;
+ if ((e == ex) && (slw > 1))
+ slw--;
+ tpts->x = xorg - x;
+ tpts->y = yorg - y;
+ tpts++;
+ *twids++ = slw;
+ if ((y != 0) && ((slw > 1) || (e != ex))) {
+ bpts--;
+ bpts->x = xorg - x;
+ bpts->y = yorg + y;
+ *--bwids = slw;
+ }
}
return pGC->lineWidth;
}
@@ -748,19 +677,15 @@ miLineArcI (
}
static int
-miLineArcD (
- DrawablePtr pDraw,
- GCPtr pGC,
- double xorg,
- double yorg,
- DDXPointPtr points,
- int *widths,
- PolyEdgePtr edge1,
- int edgey1,
- Bool edgeleft1,
- PolyEdgePtr edge2,
- int edgey2,
- Bool edgeleft2)
+miLineArcD(DrawablePtr pDraw,
+ GCPtr pGC,
+ double xorg,
+ double yorg,
+ DDXPointPtr points,
+ int *widths,
+ PolyEdgePtr edge1,
+ int edgey1,
+ Bool edgeleft1, PolyEdgePtr edge2, int edgey2, Bool edgeleft2)
{
DDXPointPtr pts;
int *wids;
@@ -774,226 +699,204 @@ miLineArcD (
wids = widths;
xbase = floor(xorg);
x0 = xorg - xbase;
- ybase = ICEIL (yorg);
+ ybase = ICEIL(yorg);
y0 = yorg - ybase;
- if (pGC->miTranslate)
- {
- xbase += pDraw->x;
- ybase += pDraw->y;
- edge1->x += pDraw->x;
- edge2->x += pDraw->x;
- edgey1 += pDraw->y;
- edgey2 += pDraw->y;
+ if (pGC->miTranslate) {
+ xbase += pDraw->x;
+ ybase += pDraw->y;
+ edge1->x += pDraw->x;
+ edge2->x += pDraw->x;
+ edgey1 += pDraw->y;
+ edgey2 += pDraw->y;
}
xlk = x0 + x0 + 1.0;
xrk = x0 + x0 - 1.0;
yk = y0 + y0 - 1.0;
- radius = ((double)pGC->lineWidth) / 2.0;
+ radius = ((double) pGC->lineWidth) / 2.0;
y = floor(radius - y0 + 1.0);
ybase -= y;
ymin = ybase;
ymax = 65536;
edge1IsMin = FALSE;
ymin1 = edgey1;
- if (edge1->dy >= 0)
- {
- if (!edge1->dy)
- {
- if (edgeleft1)
- edge1IsMin = TRUE;
- else
- ymax = edgey1;
- edgey1 = 65536;
- }
- else
- {
- if ((edge1->signdx < 0) == edgeleft1)
- edge1IsMin = TRUE;
- }
+ if (edge1->dy >= 0) {
+ if (!edge1->dy) {
+ if (edgeleft1)
+ edge1IsMin = TRUE;
+ else
+ ymax = edgey1;
+ edgey1 = 65536;
+ }
+ else {
+ if ((edge1->signdx < 0) == edgeleft1)
+ edge1IsMin = TRUE;
+ }
}
edge2IsMin = FALSE;
ymin2 = edgey2;
- if (edge2->dy >= 0)
- {
- if (!edge2->dy)
- {
- if (edgeleft2)
- edge2IsMin = TRUE;
- else
- ymax = edgey2;
- edgey2 = 65536;
- }
- else
- {
- if ((edge2->signdx < 0) == edgeleft2)
- edge2IsMin = TRUE;
- }
- }
- if (edge1IsMin)
- {
- ymin = ymin1;
- if (edge2IsMin && ymin1 > ymin2)
- ymin = ymin2;
- } else if (edge2IsMin)
- ymin = ymin2;
+ if (edge2->dy >= 0) {
+ if (!edge2->dy) {
+ if (edgeleft2)
+ edge2IsMin = TRUE;
+ else
+ ymax = edgey2;
+ edgey2 = 65536;
+ }
+ else {
+ if ((edge2->signdx < 0) == edgeleft2)
+ edge2IsMin = TRUE;
+ }
+ }
+ if (edge1IsMin) {
+ ymin = ymin1;
+ if (edge2IsMin && ymin1 > ymin2)
+ ymin = ymin2;
+ }
+ else if (edge2IsMin)
+ ymin = ymin2;
el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0);
er = el + xrk;
xl = 1;
xr = 0;
- if (x0 < 0.5)
- {
- xl = 0;
- el -= xlk;
+ if (x0 < 0.5) {
+ xl = 0;
+ el -= xlk;
}
boty = (y0 < -0.5) ? 1 : 0;
if (ybase + y - boty > ymax)
- boty = ymax - ybase - y;
- while (y > boty)
- {
- k = (y << 1) + yk;
- er += k;
- while (er > 0.0)
- {
- xr++;
- er += xrk - (xr << 1);
- }
- el += k;
- while (el >= 0.0)
- {
- xl--;
- el += (xl << 1) - xlk;
- }
- y--;
- ybase++;
- if (ybase < ymin)
- continue;
- xcl = xl + xbase;
- xcr = xr + xbase;
- CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
- CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
- if (xcr >= xcl)
- {
- pts->x = xcl;
- pts->y = ybase;
- pts++;
- *wids++ = xcr - xcl + 1;
- }
+ boty = ymax - ybase - y;
+ while (y > boty) {
+ k = (y << 1) + yk;
+ er += k;
+ while (er > 0.0) {
+ xr++;
+ er += xrk - (xr << 1);
+ }
+ el += k;
+ while (el >= 0.0) {
+ xl--;
+ el += (xl << 1) - xlk;
+ }
+ y--;
+ ybase++;
+ if (ybase < ymin)
+ continue;
+ xcl = xl + xbase;
+ xcr = xr + xbase;
+ CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
+ CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
+ if (xcr >= xcl) {
+ pts->x = xcl;
+ pts->y = ybase;
+ pts++;
+ *wids++ = xcr - xcl + 1;
+ }
}
er = xrk - (xr << 1) - er;
el = (xl << 1) - xlk - el;
boty = floor(-y0 - radius + 1.0);
if (ybase + y - boty > ymax)
- boty = ymax - ybase - y;
- while (y > boty)
- {
- k = (y << 1) + yk;
- er -= k;
- while ((er >= 0.0) && (xr >= 0))
- {
- xr--;
- er += xrk - (xr << 1);
- }
- el -= k;
- while ((el > 0.0) && (xl <= 0))
- {
- xl++;
- el += (xl << 1) - xlk;
- }
- y--;
- ybase++;
- if (ybase < ymin)
- continue;
- xcl = xl + xbase;
- xcr = xr + xbase;
- CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
- CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
- if (xcr >= xcl)
- {
- pts->x = xcl;
- pts->y = ybase;
- pts++;
- *wids++ = xcr - xcl + 1;
- }
+ boty = ymax - ybase - y;
+ while (y > boty) {
+ k = (y << 1) + yk;
+ er -= k;
+ while ((er >= 0.0) && (xr >= 0)) {
+ xr--;
+ er += xrk - (xr << 1);
+ }
+ el -= k;
+ while ((el > 0.0) && (xl <= 0)) {
+ xl++;
+ el += (xl << 1) - xlk;
+ }
+ y--;
+ ybase++;
+ if (ybase < ymin)
+ continue;
+ xcl = xl + xbase;
+ xcr = xr + xbase;
+ CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
+ CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
+ if (xcr >= xcl) {
+ pts->x = xcl;
+ pts->y = ybase;
+ pts++;
+ *wids++ = xcr - xcl + 1;
+ }
}
return pts - points;
}
static int
-miRoundJoinFace (LineFacePtr face, PolyEdgePtr edge, Bool *leftEdge)
+miRoundJoinFace(LineFacePtr face, PolyEdgePtr edge, Bool *leftEdge)
{
- int y;
- int dx, dy;
- double xa, ya;
- Bool left;
+ int y;
+ int dx, dy;
+ double xa, ya;
+ Bool left;
dx = -face->dy;
dy = face->dx;
xa = face->xa;
ya = face->ya;
left = 1;
- if (ya > 0)
- {
- ya = 0.0;
- xa = 0.0;
+ if (ya > 0) {
+ ya = 0.0;
+ xa = 0.0;
}
- if (dy < 0 || (dy == 0 && dx > 0))
- {
- dx = -dx;
- dy = -dy;
- left = !left;
+ if (dy < 0 || (dy == 0 && dx > 0)) {
+ dx = -dx;
+ dy = -dy;
+ left = !left;
}
if (dx == 0 && dy == 0)
- dy = 1;
- if (dy == 0)
- {
- y = ICEIL (face->ya) + face->y;
- edge->x = -32767;
- edge->stepx = 0;
- edge->signdx = 0;
- edge->e = -1;
- edge->dy = 0;
- edge->dx = 0;
- edge->height = 0;
- }
- else
- {
- y = miPolyBuildEdge (xa, ya, 0.0, dx, dy, face->x, face->y, !left, edge);
- edge->height = 32767;
+ dy = 1;
+ if (dy == 0) {
+ y = ICEIL(face->ya) + face->y;
+ edge->x = -32767;
+ edge->stepx = 0;
+ edge->signdx = 0;
+ edge->e = -1;
+ edge->dy = 0;
+ edge->dx = 0;
+ edge->height = 0;
+ }
+ else {
+ y = miPolyBuildEdge(xa, ya, 0.0, dx, dy, face->x, face->y, !left, edge);
+ edge->height = 32767;
}
*leftEdge = !left;
return y;
}
void
-miRoundJoinClip (LineFacePtr pLeft, LineFacePtr pRight,
- PolyEdgePtr edge1, PolyEdgePtr edge2,
- int *y1, int *y2, Bool *left1, Bool *left2)
+miRoundJoinClip(LineFacePtr pLeft, LineFacePtr pRight,
+ PolyEdgePtr edge1, PolyEdgePtr edge2,
+ int *y1, int *y2, Bool *left1, Bool *left2)
{
- double denom;
+ double denom;
- denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy;
+ denom = -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy;
- if (denom >= 0)
- {
- pLeft->xa = -pLeft->xa;
- pLeft->ya = -pLeft->ya;
+ if (denom >= 0) {
+ pLeft->xa = -pLeft->xa;
+ pLeft->ya = -pLeft->ya;
}
- else
- {
- pRight->xa = -pRight->xa;
- pRight->ya = -pRight->ya;
+ else {
+ pRight->xa = -pRight->xa;
+ pRight->ya = -pRight->ya;
}
- *y1 = miRoundJoinFace (pLeft, edge1, left1);
- *y2 = miRoundJoinFace (pRight, edge2, left2);
+ *y1 = miRoundJoinFace(pLeft, edge1, left1);
+ *y2 = miRoundJoinFace(pRight, edge2, left2);
}
int
-miRoundCapClip (LineFacePtr face, Bool isInt, PolyEdgePtr edge, Bool *leftEdge)
+miRoundCapClip(LineFacePtr face, Bool isInt, PolyEdgePtr edge, Bool *leftEdge)
{
- int y;
- int dx, dy;
- double xa, ya, k;
- Bool left;
+ int y;
+ int dx, dy;
+ double xa, ya, k;
+ Bool left;
dx = -face->dy;
dy = face->dx;
@@ -1001,326 +904,300 @@ miRoundCapClip (LineFacePtr face, Bool isInt, PolyEdgePtr edge, Bool *leftEdge)
ya = face->ya;
k = 0.0;
if (!isInt)
- k = face->k;
+ k = face->k;
left = 1;
- if (dy < 0 || (dy == 0 && dx > 0))
- {
- dx = -dx;
- dy = -dy;
- xa = -xa;
- ya = -ya;
- left = !left;
+ if (dy < 0 || (dy == 0 && dx > 0)) {
+ dx = -dx;
+ dy = -dy;
+ xa = -xa;
+ ya = -ya;
+ left = !left;
}
if (dx == 0 && dy == 0)
- dy = 1;
- if (dy == 0)
- {
- y = ICEIL (face->ya) + face->y;
- edge->x = -32767;
- edge->stepx = 0;
- edge->signdx = 0;
- edge->e = -1;
- edge->dy = 0;
- edge->dx = 0;
- edge->height = 0;
- }
- else
- {
- y = miPolyBuildEdge (xa, ya, k, dx, dy, face->x, face->y, !left, edge);
- edge->height = 32767;
+ dy = 1;
+ if (dy == 0) {
+ y = ICEIL(face->ya) + face->y;
+ edge->x = -32767;
+ edge->stepx = 0;
+ edge->signdx = 0;
+ edge->e = -1;
+ edge->dy = 0;
+ edge->dx = 0;
+ edge->height = 0;
+ }
+ else {
+ y = miPolyBuildEdge(xa, ya, k, dx, dy, face->x, face->y, !left, edge);
+ edge->height = 32767;
}
*leftEdge = !left;
return y;
}
static void
-miLineArc (
- DrawablePtr pDraw,
- GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- LineFacePtr leftFace,
- LineFacePtr rightFace,
- double xorg,
- double yorg,
- Bool isInt)
+miLineArc(DrawablePtr pDraw,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace, double xorg, double yorg, Bool isInt)
{
int xorgi = 0, yorgi = 0;
Spans spanRec;
int n;
- PolyEdgeRec edge1, edge2;
- int edgey1, edgey2;
- Bool edgeleft1, edgeleft2;
+ PolyEdgeRec edge1, edge2;
+ int edgey1, edgey2;
+ Bool edgeleft1, edgeleft2;
- if (isInt)
- {
- xorgi = leftFace ? leftFace->x : rightFace->x;
- yorgi = leftFace ? leftFace->y : rightFace->y;
+ if (isInt) {
+ xorgi = leftFace ? leftFace->x : rightFace->x;
+ yorgi = leftFace ? leftFace->y : rightFace->y;
}
edgey1 = 65536;
edgey2 = 65536;
- edge1.x = 0; /* not used, keep memory checkers happy */
+ edge1.x = 0; /* not used, keep memory checkers happy */
edge1.dy = -1;
- edge2.x = 0; /* not used, keep memory checkers happy */
+ edge2.x = 0; /* not used, keep memory checkers happy */
edge2.dy = -1;
edgeleft1 = FALSE;
edgeleft2 = FALSE;
if ((pGC->lineStyle != LineSolid || pGC->lineWidth > 2) &&
- ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) ||
- (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt)))
- {
- if (isInt)
- {
- xorg = (double) xorgi;
- yorg = (double) yorgi;
- }
- if (leftFace && rightFace)
- {
- miRoundJoinClip (leftFace, rightFace, &edge1, &edge2,
- &edgey1, &edgey2, &edgeleft1, &edgeleft2);
- }
- else if (leftFace)
- {
- edgey1 = miRoundCapClip (leftFace, isInt, &edge1, &edgeleft1);
- }
- else if (rightFace)
- {
- edgey2 = miRoundCapClip (rightFace, isInt, &edge2, &edgeleft2);
- }
- isInt = FALSE;
+ ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) ||
+ (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) {
+ if (isInt) {
+ xorg = (double) xorgi;
+ yorg = (double) yorgi;
+ }
+ if (leftFace && rightFace) {
+ miRoundJoinClip(leftFace, rightFace, &edge1, &edge2,
+ &edgey1, &edgey2, &edgeleft1, &edgeleft2);
+ }
+ else if (leftFace) {
+ edgey1 = miRoundCapClip(leftFace, isInt, &edge1, &edgeleft1);
+ }
+ else if (rightFace) {
+ edgey2 = miRoundCapClip(rightFace, isInt, &edge2, &edgeleft2);
+ }
+ isInt = FALSE;
}
if (!InitSpans(&spanRec, pGC->lineWidth))
- return;
+ return;
if (isInt)
- n = miLineArcI(pDraw, pGC, xorgi, yorgi, spanRec.points, spanRec.widths);
+ n = miLineArcI(pDraw, pGC, xorgi, yorgi, spanRec.points,
+ spanRec.widths);
else
- n = miLineArcD(pDraw, pGC, xorg, yorg, spanRec.points, spanRec.widths,
- &edge1, edgey1, edgeleft1,
- &edge2, edgey2, edgeleft2);
+ n = miLineArcD(pDraw, pGC, xorg, yorg, spanRec.points, spanRec.widths,
+ &edge1, edgey1, edgeleft1, &edge2, edgey2, edgeleft2);
spanRec.count = n;
- fillSpans (pDraw, pGC, pixel, &spanRec, spanData);
+ fillSpans(pDraw, pGC, pixel, &spanRec, spanData);
}
static void
-miLineProjectingCap (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
- SpanDataPtr spanData, LineFacePtr face, Bool isLeft,
- double xorg, double yorg, Bool isInt)
+miLineProjectingCap(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
+ SpanDataPtr spanData, LineFacePtr face, Bool isLeft,
+ double xorg, double yorg, Bool isInt)
{
- int xorgi = 0, yorgi = 0;
- int lw;
- PolyEdgeRec lefts[2], rights[2];
- int lefty, righty, topy, bottomy;
+ int xorgi = 0, yorgi = 0;
+ int lw;
+ PolyEdgeRec lefts[2], rights[2];
+ int lefty, righty, topy, bottomy;
PolyEdgePtr left, right;
- PolyEdgePtr top, bottom;
- double xa,ya;
- double k;
- double xap, yap;
- int dx, dy;
- double projectXoff, projectYoff;
- double maxy;
- int finaly;
-
- if (isInt)
- {
- xorgi = face->x;
- yorgi = face->y;
+ PolyEdgePtr top, bottom;
+ double xa, ya;
+ double k;
+ double xap, yap;
+ int dx, dy;
+ double projectXoff, projectYoff;
+ double maxy;
+ int finaly;
+
+ if (isInt) {
+ xorgi = face->x;
+ yorgi = face->y;
}
lw = pGC->lineWidth;
dx = face->dx;
dy = face->dy;
k = face->k;
- if (dy == 0)
- {
- lefts[0].height = lw;
- lefts[0].x = xorgi;
- if (isLeft)
- lefts[0].x -= (lw >> 1);
- lefts[0].stepx = 0;
- lefts[0].signdx = 1;
- lefts[0].e = -lw;
- lefts[0].dx = 0;
- lefts[0].dy = lw;
- rights[0].height = lw;
- rights[0].x = xorgi;
- if (!isLeft)
- rights[0].x += ((lw + 1) >> 1);
- rights[0].stepx = 0;
- rights[0].signdx = 1;
- rights[0].e = -lw;
- rights[0].dx = 0;
- rights[0].dy = lw;
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, yorgi - (lw >> 1), lw,
- lefts, rights, 1, 1);
- }
- else if (dx == 0)
- {
- if (dy < 0) {
- dy = -dy;
- isLeft = !isLeft;
- }
- topy = yorgi;
- bottomy = yorgi + dy;
- if (isLeft)
- topy -= (lw >> 1);
- else
- bottomy += (lw >> 1);
- lefts[0].height = bottomy - topy;
- lefts[0].x = xorgi - (lw >> 1);
- lefts[0].stepx = 0;
- lefts[0].signdx = 1;
- lefts[0].e = -dy;
- lefts[0].dx = dx;
- lefts[0].dy = dy;
-
- rights[0].height = bottomy - topy;
- rights[0].x = lefts[0].x + (lw-1);
- rights[0].stepx = 0;
- rights[0].signdx = 1;
- rights[0].e = -dy;
- rights[0].dx = dx;
- rights[0].dy = dy;
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy, bottomy - topy, lefts, rights, 1, 1);
- }
- else
- {
- xa = face->xa;
- ya = face->ya;
- projectXoff = -ya;
- projectYoff = xa;
- if (dx < 0)
- {
- right = &rights[1];
- left = &lefts[0];
- top = &rights[0];
- bottom = &lefts[1];
- }
- else
- {
- right = &rights[0];
- left = &lefts[1];
- top = &lefts[0];
- bottom = &rights[1];
- }
- if (isLeft)
- {
- righty = miPolyBuildEdge (xa, ya,
- k, dx, dy, xorgi, yorgi, 0, right);
-
- xa = -xa;
- ya = -ya;
- k = -k;
- lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
- k, dx, dy, xorgi, yorgi, 1, left);
- if (dx > 0)
- {
- ya = -ya;
- xa = -xa;
- }
- xap = xa - projectXoff;
- yap = ya - projectYoff;
- topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
- -dy, dx, xorgi, yorgi, dx > 0, top);
- bottomy = miPolyBuildEdge (xa, ya,
- 0.0, -dy, dx, xorgi, yorgi, dx < 0, bottom);
- maxy = -ya;
- }
- else
- {
- righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
- k, dx, dy, xorgi, yorgi, 0, right);
-
- xa = -xa;
- ya = -ya;
- k = -k;
- lefty = miPolyBuildEdge (xa, ya,
- k, dx, dy, xorgi, yorgi, 1, left);
- if (dx > 0)
- {
- ya = -ya;
- xa = -xa;
- }
- xap = xa - projectXoff;
- yap = ya - projectYoff;
- topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, xorgi, xorgi, dx > 0, top);
- bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
- -dy, dx, xorgi, xorgi, dx < 0, bottom);
- maxy = -ya + projectYoff;
- }
- finaly = ICEIL(maxy) + yorgi;
- if (dx < 0)
- {
- left->height = bottomy - lefty;
- right->height = finaly - righty;
- top->height = righty - topy;
- }
- else
- {
- right->height = bottomy - righty;
- left->height = finaly - lefty;
- top->height = lefty - topy;
- }
- bottom->height = finaly - bottomy;
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy,
- bottom->height + bottomy - topy, lefts, rights, 2, 2);
+ if (dy == 0) {
+ lefts[0].height = lw;
+ lefts[0].x = xorgi;
+ if (isLeft)
+ lefts[0].x -= (lw >> 1);
+ lefts[0].stepx = 0;
+ lefts[0].signdx = 1;
+ lefts[0].e = -lw;
+ lefts[0].dx = 0;
+ lefts[0].dy = lw;
+ rights[0].height = lw;
+ rights[0].x = xorgi;
+ if (!isLeft)
+ rights[0].x += ((lw + 1) >> 1);
+ rights[0].stepx = 0;
+ rights[0].signdx = 1;
+ rights[0].e = -lw;
+ rights[0].dx = 0;
+ rights[0].dy = lw;
+ miFillPolyHelper(pDrawable, pGC, pixel, spanData, yorgi - (lw >> 1), lw,
+ lefts, rights, 1, 1);
+ }
+ else if (dx == 0) {
+ if (dy < 0) {
+ dy = -dy;
+ isLeft = !isLeft;
+ }
+ topy = yorgi;
+ bottomy = yorgi + dy;
+ if (isLeft)
+ topy -= (lw >> 1);
+ else
+ bottomy += (lw >> 1);
+ lefts[0].height = bottomy - topy;
+ lefts[0].x = xorgi - (lw >> 1);
+ lefts[0].stepx = 0;
+ lefts[0].signdx = 1;
+ lefts[0].e = -dy;
+ lefts[0].dx = dx;
+ lefts[0].dy = dy;
+
+ rights[0].height = bottomy - topy;
+ rights[0].x = lefts[0].x + (lw - 1);
+ rights[0].stepx = 0;
+ rights[0].signdx = 1;
+ rights[0].e = -dy;
+ rights[0].dx = dx;
+ rights[0].dy = dy;
+ miFillPolyHelper(pDrawable, pGC, pixel, spanData, topy, bottomy - topy,
+ lefts, rights, 1, 1);
+ }
+ else {
+ xa = face->xa;
+ ya = face->ya;
+ projectXoff = -ya;
+ projectYoff = xa;
+ if (dx < 0) {
+ right = &rights[1];
+ left = &lefts[0];
+ top = &rights[0];
+ bottom = &lefts[1];
+ }
+ else {
+ right = &rights[0];
+ left = &lefts[1];
+ top = &lefts[0];
+ bottom = &rights[1];
+ }
+ if (isLeft) {
+ righty = miPolyBuildEdge(xa, ya, k, dx, dy, xorgi, yorgi, 0, right);
+
+ xa = -xa;
+ ya = -ya;
+ k = -k;
+ lefty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff,
+ k, dx, dy, xorgi, yorgi, 1, left);
+ if (dx > 0) {
+ ya = -ya;
+ xa = -xa;
+ }
+ xap = xa - projectXoff;
+ yap = ya - projectYoff;
+ topy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy,
+ -dy, dx, xorgi, yorgi, dx > 0, top);
+ bottomy = miPolyBuildEdge(xa, ya,
+ 0.0, -dy, dx, xorgi, yorgi, dx < 0,
+ bottom);
+ maxy = -ya;
+ }
+ else {
+ righty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff,
+ k, dx, dy, xorgi, yorgi, 0, right);
+
+ xa = -xa;
+ ya = -ya;
+ k = -k;
+ lefty = miPolyBuildEdge(xa, ya, k, dx, dy, xorgi, yorgi, 1, left);
+ if (dx > 0) {
+ ya = -ya;
+ xa = -xa;
+ }
+ xap = xa - projectXoff;
+ yap = ya - projectYoff;
+ topy =
+ miPolyBuildEdge(xa, ya, 0.0, -dy, dx, xorgi, xorgi, dx > 0,
+ top);
+ bottomy =
+ miPolyBuildEdge(xap, yap, xap * dx + yap * dy, -dy, dx, xorgi,
+ xorgi, dx < 0, bottom);
+ maxy = -ya + projectYoff;
+ }
+ finaly = ICEIL(maxy) + yorgi;
+ if (dx < 0) {
+ left->height = bottomy - lefty;
+ right->height = finaly - righty;
+ top->height = righty - topy;
+ }
+ else {
+ right->height = bottomy - righty;
+ left->height = finaly - lefty;
+ top->height = lefty - topy;
+ }
+ bottom->height = finaly - bottomy;
+ miFillPolyHelper(pDrawable, pGC, pixel, spanData, topy,
+ bottom->height + bottomy - topy, lefts, rights, 2, 2);
}
}
static void
-miWideSegment (
- DrawablePtr pDrawable,
- GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- int x1,
- int y1,
- int x2,
- int y2,
- Bool projectLeft,
- Bool projectRight,
- LineFacePtr leftFace,
- LineFacePtr rightFace)
+miWideSegment(DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ Bool projectLeft,
+ Bool projectRight, LineFacePtr leftFace, LineFacePtr rightFace)
{
- double l, L, r;
- double xa, ya;
- double projectXoff = 0.0, projectYoff = 0.0;
- double k;
- double maxy;
- int x, y;
- int dx, dy;
- int finaly;
+ double l, L, r;
+ double xa, ya;
+ double projectXoff = 0.0, projectYoff = 0.0;
+ double k;
+ double maxy;
+ int x, y;
+ int dx, dy;
+ int finaly;
PolyEdgePtr left, right;
- PolyEdgePtr top, bottom;
- int lefty, righty, topy, bottomy;
- int signdx;
- PolyEdgeRec lefts[2], rights[2];
- LineFacePtr tface;
- int lw = pGC->lineWidth;
+ PolyEdgePtr top, bottom;
+ int lefty, righty, topy, bottomy;
+ int signdx;
+ PolyEdgeRec lefts[2], rights[2];
+ LineFacePtr tface;
+ int lw = pGC->lineWidth;
/* draw top-to-bottom always */
- if (y2 < y1 || (y2 == y1 && x2 < x1))
- {
- x = x1;
- x1 = x2;
- x2 = x;
+ if (y2 < y1 || (y2 == y1 && x2 < x1)) {
+ x = x1;
+ x1 = x2;
+ x2 = x;
- y = y1;
- y1 = y2;
- y2 = y;
+ y = y1;
+ y1 = y2;
+ y2 = y;
- x = projectLeft;
- projectLeft = projectRight;
- projectRight = x;
+ x = projectLeft;
+ projectLeft = projectRight;
+ projectRight = x;
- tface = leftFace;
- leftFace = rightFace;
- rightFace = tface;
+ tface = leftFace;
+ leftFace = rightFace;
+ rightFace = tface;
}
dy = y2 - y1;
signdx = 1;
dx = x2 - x1;
if (dx < 0)
- signdx = -1;
+ signdx = -1;
leftFace->x = x1;
leftFace->y = y1;
@@ -1332,327 +1209,293 @@ miWideSegment (
rightFace->dx = -dx;
rightFace->dy = -dy;
- if (dy == 0)
- {
- rightFace->xa = 0;
- rightFace->ya = (double) lw / 2.0;
- rightFace->k = -(double) (lw * dx) / 2.0;
- leftFace->xa = 0;
- leftFace->ya = -rightFace->ya;
- leftFace->k = rightFace->k;
- x = x1;
- if (projectLeft)
- x -= (lw >> 1);
- y = y1 - (lw >> 1);
- dx = x2 - x;
- if (projectRight)
- dx += ((lw + 1) >> 1);
- dy = lw;
- miFillRectPolyHelper (pDrawable, pGC, pixel, spanData,
- x, y, dx, dy);
- }
- else if (dx == 0)
- {
- leftFace->xa = (double) lw / 2.0;
- leftFace->ya = 0;
- leftFace->k = (double) (lw * dy) / 2.0;
- rightFace->xa = -leftFace->xa;
- rightFace->ya = 0;
- rightFace->k = leftFace->k;
- y = y1;
- if (projectLeft)
- y -= lw >> 1;
- x = x1 - (lw >> 1);
- dy = y2 - y;
- if (projectRight)
- dy += ((lw + 1) >> 1);
- dx = lw;
- miFillRectPolyHelper (pDrawable, pGC, pixel, spanData,
- x, y, dx, dy);
- }
- else
- {
- l = ((double) lw) / 2.0;
- L = hypot ((double) dx, (double) dy);
-
- if (dx < 0)
- {
- right = &rights[1];
- left = &lefts[0];
- top = &rights[0];
- bottom = &lefts[1];
- }
- else
- {
- right = &rights[0];
- left = &lefts[1];
- top = &lefts[0];
- bottom = &rights[1];
- }
- r = l / L;
-
- /* coord of upper bound at integral y */
- ya = -r * dx;
- xa = r * dy;
-
- if (projectLeft | projectRight)
- {
- projectXoff = -ya;
- projectYoff = xa;
- }
-
- /* xa * dy - ya * dx */
- k = l * L;
-
- leftFace->xa = xa;
- leftFace->ya = ya;
- leftFace->k = k;
- rightFace->xa = -xa;
- rightFace->ya = -ya;
- rightFace->k = k;
-
- if (projectLeft)
- righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
- k, dx, dy, x1, y1, 0, right);
- else
- righty = miPolyBuildEdge (xa, ya,
- k, dx, dy, x1, y1, 0, right);
-
- /* coord of lower bound at integral y */
- ya = -ya;
- xa = -xa;
-
- /* xa * dy - ya * dx */
- k = - k;
-
- if (projectLeft)
- lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
- k, dx, dy, x1, y1, 1, left);
- else
- lefty = miPolyBuildEdge (xa, ya,
- k, dx, dy, x1, y1, 1, left);
-
- /* coord of top face at integral y */
-
- if (signdx > 0)
- {
- ya = -ya;
- xa = -xa;
- }
-
- if (projectLeft)
- {
- double xap = xa - projectXoff;
- double yap = ya - projectYoff;
- topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
- -dy, dx, x1, y1, dx > 0, top);
- }
- else
- topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top);
-
- /* coord of bottom face at integral y */
-
- if (projectRight)
- {
- double xap = xa + projectXoff;
- double yap = ya + projectYoff;
- bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
- -dy, dx, x2, y2, dx < 0, bottom);
- maxy = -ya + projectYoff;
- }
- else
- {
- bottomy = miPolyBuildEdge (xa, ya,
- 0.0, -dy, dx, x2, y2, dx < 0, bottom);
- maxy = -ya;
- }
-
- finaly = ICEIL (maxy) + y2;
-
- if (dx < 0)
- {
- left->height = bottomy - lefty;
- right->height = finaly - righty;
- top->height = righty - topy;
- }
- else
- {
- right->height = bottomy - righty;
- left->height = finaly - lefty;
- top->height = lefty - topy;
- }
- bottom->height = finaly - bottomy;
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy,
- bottom->height + bottomy - topy, lefts, rights, 2, 2);
+ if (dy == 0) {
+ rightFace->xa = 0;
+ rightFace->ya = (double) lw / 2.0;
+ rightFace->k = -(double) (lw * dx) / 2.0;
+ leftFace->xa = 0;
+ leftFace->ya = -rightFace->ya;
+ leftFace->k = rightFace->k;
+ x = x1;
+ if (projectLeft)
+ x -= (lw >> 1);
+ y = y1 - (lw >> 1);
+ dx = x2 - x;
+ if (projectRight)
+ dx += ((lw + 1) >> 1);
+ dy = lw;
+ miFillRectPolyHelper(pDrawable, pGC, pixel, spanData, x, y, dx, dy);
+ }
+ else if (dx == 0) {
+ leftFace->xa = (double) lw / 2.0;
+ leftFace->ya = 0;
+ leftFace->k = (double) (lw * dy) / 2.0;
+ rightFace->xa = -leftFace->xa;
+ rightFace->ya = 0;
+ rightFace->k = leftFace->k;
+ y = y1;
+ if (projectLeft)
+ y -= lw >> 1;
+ x = x1 - (lw >> 1);
+ dy = y2 - y;
+ if (projectRight)
+ dy += ((lw + 1) >> 1);
+ dx = lw;
+ miFillRectPolyHelper(pDrawable, pGC, pixel, spanData, x, y, dx, dy);
+ }
+ else {
+ l = ((double) lw) / 2.0;
+ L = hypot((double) dx, (double) dy);
+
+ if (dx < 0) {
+ right = &rights[1];
+ left = &lefts[0];
+ top = &rights[0];
+ bottom = &lefts[1];
+ }
+ else {
+ right = &rights[0];
+ left = &lefts[1];
+ top = &lefts[0];
+ bottom = &rights[1];
+ }
+ r = l / L;
+
+ /* coord of upper bound at integral y */
+ ya = -r * dx;
+ xa = r * dy;
+
+ if (projectLeft | projectRight) {
+ projectXoff = -ya;
+ projectYoff = xa;
+ }
+
+ /* xa * dy - ya * dx */
+ k = l * L;
+
+ leftFace->xa = xa;
+ leftFace->ya = ya;
+ leftFace->k = k;
+ rightFace->xa = -xa;
+ rightFace->ya = -ya;
+ rightFace->k = k;
+
+ if (projectLeft)
+ righty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff,
+ k, dx, dy, x1, y1, 0, right);
+ else
+ righty = miPolyBuildEdge(xa, ya, k, dx, dy, x1, y1, 0, right);
+
+ /* coord of lower bound at integral y */
+ ya = -ya;
+ xa = -xa;
+
+ /* xa * dy - ya * dx */
+ k = -k;
+
+ if (projectLeft)
+ lefty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff,
+ k, dx, dy, x1, y1, 1, left);
+ else
+ lefty = miPolyBuildEdge(xa, ya, k, dx, dy, x1, y1, 1, left);
+
+ /* coord of top face at integral y */
+
+ if (signdx > 0) {
+ ya = -ya;
+ xa = -xa;
+ }
+
+ if (projectLeft) {
+ double xap = xa - projectXoff;
+ double yap = ya - projectYoff;
+
+ topy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy,
+ -dy, dx, x1, y1, dx > 0, top);
+ }
+ else
+ topy = miPolyBuildEdge(xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top);
+
+ /* coord of bottom face at integral y */
+
+ if (projectRight) {
+ double xap = xa + projectXoff;
+ double yap = ya + projectYoff;
+
+ bottomy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy,
+ -dy, dx, x2, y2, dx < 0, bottom);
+ maxy = -ya + projectYoff;
+ }
+ else {
+ bottomy = miPolyBuildEdge(xa, ya,
+ 0.0, -dy, dx, x2, y2, dx < 0, bottom);
+ maxy = -ya;
+ }
+
+ finaly = ICEIL(maxy) + y2;
+
+ if (dx < 0) {
+ left->height = bottomy - lefty;
+ right->height = finaly - righty;
+ top->height = righty - topy;
+ }
+ else {
+ right->height = bottomy - righty;
+ left->height = finaly - lefty;
+ top->height = lefty - topy;
+ }
+ bottom->height = finaly - bottomy;
+ miFillPolyHelper(pDrawable, pGC, pixel, spanData, topy,
+ bottom->height + bottomy - topy, lefts, rights, 2, 2);
}
}
static SpanDataPtr
-miSetupSpanData (GCPtr pGC, SpanDataPtr spanData, int npt)
+miSetupSpanData(GCPtr pGC, SpanDataPtr spanData, int npt)
{
if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop(pGC->alu))
- return (SpanDataPtr) NULL;
+ return (SpanDataPtr) NULL;
if (pGC->lineStyle == LineDoubleDash)
- miInitSpanGroup (&spanData->bgGroup);
- miInitSpanGroup (&spanData->fgGroup);
+ miInitSpanGroup(&spanData->bgGroup);
+ miInitSpanGroup(&spanData->fgGroup);
return spanData;
}
static void
-miCleanupSpanData (DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData)
+miCleanupSpanData(DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData)
{
- if (pGC->lineStyle == LineDoubleDash)
- {
- ChangeGCVal oldPixel, pixel;
- pixel.val = pGC->bgPixel;
- oldPixel.val = pGC->fgPixel;
- if (pixel.val != oldPixel.val)
- {
- ChangeGC (NullClient, pGC, GCForeground, &pixel);
- ValidateGC (pDrawable, pGC);
- }
- miFillUniqueSpanGroup (pDrawable, pGC, &spanData->bgGroup);
- miFreeSpanGroup (&spanData->bgGroup);
- if (pixel.val != oldPixel.val)
- {
- ChangeGC (NullClient, pGC, GCForeground, &oldPixel);
- ValidateGC (pDrawable, pGC);
- }
- }
- miFillUniqueSpanGroup (pDrawable, pGC, &spanData->fgGroup);
- miFreeSpanGroup (&spanData->fgGroup);
+ if (pGC->lineStyle == LineDoubleDash) {
+ ChangeGCVal oldPixel, pixel;
+
+ pixel.val = pGC->bgPixel;
+ oldPixel.val = pGC->fgPixel;
+ if (pixel.val != oldPixel.val) {
+ ChangeGC(NullClient, pGC, GCForeground, &pixel);
+ ValidateGC(pDrawable, pGC);
+ }
+ miFillUniqueSpanGroup(pDrawable, pGC, &spanData->bgGroup);
+ miFreeSpanGroup(&spanData->bgGroup);
+ if (pixel.val != oldPixel.val) {
+ ChangeGC(NullClient, pGC, GCForeground, &oldPixel);
+ ValidateGC(pDrawable, pGC);
+ }
+ }
+ miFillUniqueSpanGroup(pDrawable, pGC, &spanData->fgGroup);
+ miFreeSpanGroup(&spanData->fgGroup);
}
void
-miWideLine (DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr pPts)
+miWideLine(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pPts)
{
- int x1, y1, x2, y2;
- SpanDataRec spanDataRec;
- SpanDataPtr spanData;
- long pixel;
- Bool projectLeft, projectRight;
- LineFaceRec leftFace, rightFace, prevRightFace;
- LineFaceRec firstFace;
- int first;
- Bool somethingDrawn = FALSE;
- Bool selfJoin;
-
- spanData = miSetupSpanData (pGC, &spanDataRec, npt);
+ int x1, y1, x2, y2;
+ SpanDataRec spanDataRec;
+ SpanDataPtr spanData;
+ long pixel;
+ Bool projectLeft, projectRight;
+ LineFaceRec leftFace, rightFace, prevRightFace;
+ LineFaceRec firstFace;
+ int first;
+ Bool somethingDrawn = FALSE;
+ Bool selfJoin;
+
+ spanData = miSetupSpanData(pGC, &spanDataRec, npt);
pixel = pGC->fgPixel;
x2 = pPts->x;
y2 = pPts->y;
first = TRUE;
selfJoin = FALSE;
- if (npt > 1)
- {
- if (mode == CoordModePrevious)
- {
- int nptTmp;
- DDXPointPtr pPtsTmp;
-
- x1 = x2;
- y1 = y2;
- nptTmp = npt;
- pPtsTmp = pPts + 1;
- while (--nptTmp)
- {
- x1 += pPtsTmp->x;
- y1 += pPtsTmp->y;
- ++pPtsTmp;
- }
- if (x2 == x1 && y2 == y1)
- selfJoin = TRUE;
- }
- else if (x2 == pPts[npt-1].x && y2 == pPts[npt-1].y)
- {
- selfJoin = TRUE;
- }
+ if (npt > 1) {
+ if (mode == CoordModePrevious) {
+ int nptTmp;
+ DDXPointPtr pPtsTmp;
+
+ x1 = x2;
+ y1 = y2;
+ nptTmp = npt;
+ pPtsTmp = pPts + 1;
+ while (--nptTmp) {
+ x1 += pPtsTmp->x;
+ y1 += pPtsTmp->y;
+ ++pPtsTmp;
+ }
+ if (x2 == x1 && y2 == y1)
+ selfJoin = TRUE;
+ }
+ else if (x2 == pPts[npt - 1].x && y2 == pPts[npt - 1].y) {
+ selfJoin = TRUE;
+ }
}
projectLeft = pGC->capStyle == CapProjecting && !selfJoin;
projectRight = FALSE;
- while (--npt)
- {
- x1 = x2;
- y1 = y2;
- ++pPts;
- x2 = pPts->x;
- y2 = pPts->y;
- if (mode == CoordModePrevious)
- {
- x2 += x1;
- y2 += y1;
- }
- if (x1 != x2 || y1 != y2)
- {
- somethingDrawn = TRUE;
- if (npt == 1 && pGC->capStyle == CapProjecting && !selfJoin)
- projectRight = TRUE;
- miWideSegment (pDrawable, pGC, pixel, spanData, x1, y1, x2, y2,
- projectLeft, projectRight, &leftFace, &rightFace);
- if (first)
- {
- if (selfJoin)
- firstFace = leftFace;
- else if (pGC->capStyle == CapRound)
- {
- if (pGC->lineWidth == 1 && !spanData)
- miLineOnePoint (pDrawable, pGC, pixel, spanData, x1, y1);
- else
- miLineArc (pDrawable, pGC, pixel, spanData,
- &leftFace, (LineFacePtr) NULL,
- (double)0.0, (double)0.0,
- TRUE);
- }
- }
- else
- {
- miLineJoin (pDrawable, pGC, pixel, spanData, &leftFace,
- &prevRightFace);
- }
- prevRightFace = rightFace;
- first = FALSE;
- projectLeft = FALSE;
- }
- if (npt == 1 && somethingDrawn)
- {
- if (selfJoin)
- miLineJoin (pDrawable, pGC, pixel, spanData, &firstFace,
- &rightFace);
- else if (pGC->capStyle == CapRound)
- {
- if (pGC->lineWidth == 1 && !spanData)
- miLineOnePoint (pDrawable, pGC, pixel, spanData, x2, y2);
- else
- miLineArc (pDrawable, pGC, pixel, spanData,
- (LineFacePtr) NULL, &rightFace,
- (double)0.0, (double)0.0,
- TRUE);
- }
- }
+ while (--npt) {
+ x1 = x2;
+ y1 = y2;
+ ++pPts;
+ x2 = pPts->x;
+ y2 = pPts->y;
+ if (mode == CoordModePrevious) {
+ x2 += x1;
+ y2 += y1;
+ }
+ if (x1 != x2 || y1 != y2) {
+ somethingDrawn = TRUE;
+ if (npt == 1 && pGC->capStyle == CapProjecting && !selfJoin)
+ projectRight = TRUE;
+ miWideSegment(pDrawable, pGC, pixel, spanData, x1, y1, x2, y2,
+ projectLeft, projectRight, &leftFace, &rightFace);
+ if (first) {
+ if (selfJoin)
+ firstFace = leftFace;
+ else if (pGC->capStyle == CapRound) {
+ if (pGC->lineWidth == 1 && !spanData)
+ miLineOnePoint(pDrawable, pGC, pixel, spanData, x1, y1);
+ else
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ &leftFace, (LineFacePtr) NULL,
+ (double) 0.0, (double) 0.0, TRUE);
+ }
+ }
+ else {
+ miLineJoin(pDrawable, pGC, pixel, spanData, &leftFace,
+ &prevRightFace);
+ }
+ prevRightFace = rightFace;
+ first = FALSE;
+ projectLeft = FALSE;
+ }
+ if (npt == 1 && somethingDrawn) {
+ if (selfJoin)
+ miLineJoin(pDrawable, pGC, pixel, spanData, &firstFace,
+ &rightFace);
+ else if (pGC->capStyle == CapRound) {
+ if (pGC->lineWidth == 1 && !spanData)
+ miLineOnePoint(pDrawable, pGC, pixel, spanData, x2, y2);
+ else
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ (LineFacePtr) NULL, &rightFace,
+ (double) 0.0, (double) 0.0, TRUE);
+ }
+ }
}
/* handle crock where all points are coincedent */
- if (!somethingDrawn)
- {
- projectLeft = pGC->capStyle == CapProjecting;
- miWideSegment (pDrawable, pGC, pixel, spanData,
- x2, y2, x2, y2, projectLeft, projectLeft,
- &leftFace, &rightFace);
- if (pGC->capStyle == CapRound)
- {
- miLineArc (pDrawable, pGC, pixel, spanData,
- &leftFace, (LineFacePtr) NULL,
- (double)0.0, (double)0.0,
- TRUE);
- rightFace.dx = -1; /* sleezy hack to make it work */
- miLineArc (pDrawable, pGC, pixel, spanData,
- (LineFacePtr) NULL, &rightFace,
- (double)0.0, (double)0.0,
- TRUE);
- }
+ if (!somethingDrawn) {
+ projectLeft = pGC->capStyle == CapProjecting;
+ miWideSegment(pDrawable, pGC, pixel, spanData,
+ x2, y2, x2, y2, projectLeft, projectLeft,
+ &leftFace, &rightFace);
+ if (pGC->capStyle == CapRound) {
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ &leftFace, (LineFacePtr) NULL,
+ (double) 0.0, (double) 0.0, TRUE);
+ rightFace.dx = -1; /* sleezy hack to make it work */
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ (LineFacePtr) NULL, &rightFace,
+ (double) 0.0, (double) 0.0, TRUE);
+ }
}
if (spanData)
- miCleanupSpanData (pDrawable, pGC, spanData);
+ miCleanupSpanData(pDrawable, pGC, spanData);
}
#define V_TOP 0
@@ -1661,44 +1504,42 @@ miWideLine (DrawablePtr pDrawable, GCPtr pGC,
#define V_LEFT 3
static void
-miWideDashSegment (
- DrawablePtr pDrawable,
- GCPtr pGC,
- SpanDataPtr spanData,
- int *pDashOffset,
- int *pDashIndex,
- int x1,
- int y1,
- int x2,
- int y2,
- Bool projectLeft,
- Bool projectRight,
- LineFacePtr leftFace,
- LineFacePtr rightFace)
+miWideDashSegment(DrawablePtr pDrawable,
+ GCPtr pGC,
+ SpanDataPtr spanData,
+ int *pDashOffset,
+ int *pDashIndex,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ Bool projectLeft,
+ Bool projectRight,
+ LineFacePtr leftFace, LineFacePtr rightFace)
{
- int dashIndex, dashRemain;
- unsigned char *pDash;
- double L, l;
- double k;
- PolyVertexRec vertices[4];
- PolyVertexRec saveRight, saveBottom;
- PolySlopeRec slopes[4];
- PolyEdgeRec left[2], right[2];
- LineFaceRec lcapFace, rcapFace;
- int nleft, nright;
- int h;
- int y;
- int dy, dx;
- unsigned long pixel;
- double LRemain;
- double r;
- double rdx, rdy;
- double dashDx, dashDy;
- double saveK = 0.0;
- Bool first = TRUE;
- double lcenterx, lcentery, rcenterx = 0.0, rcentery = 0.0;
- unsigned long fgPixel, bgPixel;
-
+ int dashIndex, dashRemain;
+ unsigned char *pDash;
+ double L, l;
+ double k;
+ PolyVertexRec vertices[4];
+ PolyVertexRec saveRight, saveBottom;
+ PolySlopeRec slopes[4];
+ PolyEdgeRec left[2], right[2];
+ LineFaceRec lcapFace, rcapFace;
+ int nleft, nright;
+ int h;
+ int y;
+ int dy, dx;
+ unsigned long pixel;
+ double LRemain;
+ double r;
+ double rdx, rdy;
+ double dashDx, dashDy;
+ double saveK = 0.0;
+ Bool first = TRUE;
+ double lcenterx, lcentery, rcenterx = 0.0, rcentery = 0.0;
+ unsigned long fgPixel, bgPixel;
+
dx = x2 - x1;
dy = y2 - y1;
dashIndex = *pDashIndex;
@@ -1706,42 +1547,35 @@ miWideDashSegment (
dashRemain = pDash[dashIndex] - *pDashOffset;
fgPixel = pGC->fgPixel;
bgPixel = pGC->bgPixel;
- if (pGC->fillStyle == FillOpaqueStippled ||
- pGC->fillStyle == FillTiled)
- {
- bgPixel = fgPixel;
+ if (pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled) {
+ bgPixel = fgPixel;
}
l = ((double) pGC->lineWidth) / 2.0;
- if (dx == 0)
- {
- L = dy;
- rdx = 0;
- rdy = l;
- if (dy < 0)
- {
- L = -dy;
- rdy = -l;
- }
- }
- else if (dy == 0)
- {
- L = dx;
- rdx = l;
- rdy = 0;
- if (dx < 0)
- {
- L = -dx;
- rdx = -l;
- }
- }
- else
- {
- L = hypot ((double) dx, (double) dy);
- r = l / L;
-
- rdx = r * dx;
- rdy = r * dy;
+ if (dx == 0) {
+ L = dy;
+ rdx = 0;
+ rdy = l;
+ if (dy < 0) {
+ L = -dy;
+ rdy = -l;
+ }
+ }
+ else if (dy == 0) {
+ L = dx;
+ rdx = l;
+ rdy = 0;
+ if (dx < 0) {
+ L = -dx;
+ rdx = -l;
+ }
+ }
+ else {
+ L = hypot((double) dx, (double) dy);
+ r = l / L;
+
+ rdx = r * dx;
+ rdy = r * dy;
}
k = l * L;
LRemain = L;
@@ -1771,230 +1605,203 @@ miWideDashSegment (
vertices[V_BOTTOM].x = vertices[V_LEFT].x = -rdy;
vertices[V_BOTTOM].y = vertices[V_LEFT].y = rdx;
- if (projectLeft)
- {
- vertices[V_TOP].x -= rdx;
- vertices[V_TOP].y -= rdy;
+ if (projectLeft) {
+ vertices[V_TOP].x -= rdx;
+ vertices[V_TOP].y -= rdy;
- vertices[V_LEFT].x -= rdx;
- vertices[V_LEFT].y -= rdy;
+ vertices[V_LEFT].x -= rdx;
+ vertices[V_LEFT].y -= rdy;
- slopes[V_LEFT].k = rdx * dx + rdy * dy;
+ slopes[V_LEFT].k = rdx * dx + rdy * dy;
}
lcenterx = x1;
lcentery = y1;
- if (pGC->capStyle == CapRound)
- {
- lcapFace.dx = dx;
- lcapFace.dy = dy;
- lcapFace.x = x1;
- lcapFace.y = y1;
-
- rcapFace.dx = -dx;
- rcapFace.dy = -dy;
- rcapFace.x = x1;
- rcapFace.y = y1;
- }
- while (LRemain > dashRemain)
- {
- dashDx = (dashRemain * dx) / L;
- dashDy = (dashRemain * dy) / L;
-
- rcenterx = lcenterx + dashDx;
- rcentery = lcentery + dashDy;
-
- vertices[V_RIGHT].x += dashDx;
- vertices[V_RIGHT].y += dashDy;
-
- vertices[V_BOTTOM].x += dashDx;
- vertices[V_BOTTOM].y += dashDy;
-
- slopes[V_RIGHT].k = vertices[V_RIGHT].x * dx + vertices[V_RIGHT].y * dy;
-
- if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1))
- {
- if (pGC->lineStyle == LineOnOffDash &&
- pGC->capStyle == CapProjecting)
- {
- saveRight = vertices[V_RIGHT];
- saveBottom = vertices[V_BOTTOM];
- saveK = slopes[V_RIGHT].k;
-
- if (!first)
- {
- vertices[V_TOP].x -= rdx;
- vertices[V_TOP].y -= rdy;
-
- vertices[V_LEFT].x -= rdx;
- vertices[V_LEFT].y -= rdy;
-
- slopes[V_LEFT].k = vertices[V_LEFT].x *
- slopes[V_LEFT].dy -
- vertices[V_LEFT].y *
- slopes[V_LEFT].dx;
- }
-
- vertices[V_RIGHT].x += rdx;
- vertices[V_RIGHT].y += rdy;
-
- vertices[V_BOTTOM].x += rdx;
- vertices[V_BOTTOM].y += rdy;
-
- slopes[V_RIGHT].k = vertices[V_RIGHT].x *
- slopes[V_RIGHT].dy -
- vertices[V_RIGHT].y *
- slopes[V_RIGHT].dx;
- }
- y = miPolyBuildPoly (vertices, slopes, 4, x1, y1,
- left, right, &nleft, &nright, &h);
- pixel = (dashIndex & 1) ? bgPixel : fgPixel;
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, h, left, right, nleft, nright);
-
- if (pGC->lineStyle == LineOnOffDash)
- {
- switch (pGC->capStyle)
- {
- case CapProjecting:
- vertices[V_BOTTOM] = saveBottom;
- vertices[V_RIGHT] = saveRight;
- slopes[V_RIGHT].k = saveK;
- break;
- case CapRound:
- if (!first)
- {
- if (dx < 0)
- {
- lcapFace.xa = -vertices[V_LEFT].x;
- lcapFace.ya = -vertices[V_LEFT].y;
- lcapFace.k = slopes[V_LEFT].k;
- }
- else
- {
- lcapFace.xa = vertices[V_TOP].x;
- lcapFace.ya = vertices[V_TOP].y;
- lcapFace.k = -slopes[V_LEFT].k;
- }
- miLineArc (pDrawable, pGC, pixel, spanData,
- &lcapFace, (LineFacePtr) NULL,
- lcenterx, lcentery, FALSE);
- }
- if (dx < 0)
- {
- rcapFace.xa = vertices[V_BOTTOM].x;
- rcapFace.ya = vertices[V_BOTTOM].y;
- rcapFace.k = slopes[V_RIGHT].k;
- }
- else
- {
- rcapFace.xa = -vertices[V_RIGHT].x;
- rcapFace.ya = -vertices[V_RIGHT].y;
- rcapFace.k = -slopes[V_RIGHT].k;
- }
- miLineArc (pDrawable, pGC, pixel, spanData,
- (LineFacePtr) NULL, &rcapFace,
- rcenterx, rcentery, FALSE);
- break;
- }
- }
- }
- LRemain -= dashRemain;
- ++dashIndex;
- if (dashIndex == pGC->numInDashList)
- dashIndex = 0;
- dashRemain = pDash[dashIndex];
-
- lcenterx = rcenterx;
- lcentery = rcentery;
-
- vertices[V_TOP] = vertices[V_RIGHT];
- vertices[V_LEFT] = vertices[V_BOTTOM];
- slopes[V_LEFT].k = -slopes[V_RIGHT].k;
- first = FALSE;
- }
-
- if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1))
- {
- vertices[V_TOP].x -= dx;
- vertices[V_TOP].y -= dy;
-
- vertices[V_LEFT].x -= dx;
- vertices[V_LEFT].y -= dy;
-
- vertices[V_RIGHT].x = rdy;
- vertices[V_RIGHT].y = -rdx;
-
- vertices[V_BOTTOM].x = -rdy;
- vertices[V_BOTTOM].y = rdx;
-
-
- if (projectRight)
- {
- vertices[V_RIGHT].x += rdx;
- vertices[V_RIGHT].y += rdy;
-
- vertices[V_BOTTOM].x += rdx;
- vertices[V_BOTTOM].y += rdy;
- slopes[V_RIGHT].k = vertices[V_RIGHT].x *
- slopes[V_RIGHT].dy -
- vertices[V_RIGHT].y *
- slopes[V_RIGHT].dx;
- }
- else
- slopes[V_RIGHT].k = 0;
-
- if (!first && pGC->lineStyle == LineOnOffDash &&
- pGC->capStyle == CapProjecting)
- {
- vertices[V_TOP].x -= rdx;
- vertices[V_TOP].y -= rdy;
-
- vertices[V_LEFT].x -= rdx;
- vertices[V_LEFT].y -= rdy;
- slopes[V_LEFT].k = vertices[V_LEFT].x *
- slopes[V_LEFT].dy -
- vertices[V_LEFT].y *
- slopes[V_LEFT].dx;
- }
- else
- slopes[V_LEFT].k += dx * dx + dy * dy;
-
-
- y = miPolyBuildPoly (vertices, slopes, 4, x2, y2,
- left, right, &nleft, &nright, &h);
-
- pixel = (dashIndex & 1) ? pGC->bgPixel : pGC->fgPixel;
- miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, h, left, right, nleft, nright);
- if (!first && pGC->lineStyle == LineOnOffDash &&
- pGC->capStyle == CapRound)
- {
- lcapFace.x = x2;
- lcapFace.y = y2;
- if (dx < 0)
- {
- lcapFace.xa = -vertices[V_LEFT].x;
- lcapFace.ya = -vertices[V_LEFT].y;
- lcapFace.k = slopes[V_LEFT].k;
- }
- else
- {
- lcapFace.xa = vertices[V_TOP].x;
- lcapFace.ya = vertices[V_TOP].y;
- lcapFace.k = -slopes[V_LEFT].k;
- }
- miLineArc (pDrawable, pGC, pixel, spanData,
- &lcapFace, (LineFacePtr) NULL,
- rcenterx, rcentery, FALSE);
- }
+ if (pGC->capStyle == CapRound) {
+ lcapFace.dx = dx;
+ lcapFace.dy = dy;
+ lcapFace.x = x1;
+ lcapFace.y = y1;
+
+ rcapFace.dx = -dx;
+ rcapFace.dy = -dy;
+ rcapFace.x = x1;
+ rcapFace.y = y1;
+ }
+ while (LRemain > dashRemain) {
+ dashDx = (dashRemain * dx) / L;
+ dashDy = (dashRemain * dy) / L;
+
+ rcenterx = lcenterx + dashDx;
+ rcentery = lcentery + dashDy;
+
+ vertices[V_RIGHT].x += dashDx;
+ vertices[V_RIGHT].y += dashDy;
+
+ vertices[V_BOTTOM].x += dashDx;
+ vertices[V_BOTTOM].y += dashDy;
+
+ slopes[V_RIGHT].k = vertices[V_RIGHT].x * dx + vertices[V_RIGHT].y * dy;
+
+ if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) {
+ if (pGC->lineStyle == LineOnOffDash &&
+ pGC->capStyle == CapProjecting) {
+ saveRight = vertices[V_RIGHT];
+ saveBottom = vertices[V_BOTTOM];
+ saveK = slopes[V_RIGHT].k;
+
+ if (!first) {
+ vertices[V_TOP].x -= rdx;
+ vertices[V_TOP].y -= rdy;
+
+ vertices[V_LEFT].x -= rdx;
+ vertices[V_LEFT].y -= rdy;
+
+ slopes[V_LEFT].k = vertices[V_LEFT].x *
+ slopes[V_LEFT].dy -
+ vertices[V_LEFT].y * slopes[V_LEFT].dx;
+ }
+
+ vertices[V_RIGHT].x += rdx;
+ vertices[V_RIGHT].y += rdy;
+
+ vertices[V_BOTTOM].x += rdx;
+ vertices[V_BOTTOM].y += rdy;
+
+ slopes[V_RIGHT].k = vertices[V_RIGHT].x *
+ slopes[V_RIGHT].dy -
+ vertices[V_RIGHT].y * slopes[V_RIGHT].dx;
+ }
+ y = miPolyBuildPoly(vertices, slopes, 4, x1, y1,
+ left, right, &nleft, &nright, &h);
+ pixel = (dashIndex & 1) ? bgPixel : fgPixel;
+ miFillPolyHelper(pDrawable, pGC, pixel, spanData, y, h, left, right,
+ nleft, nright);
+
+ if (pGC->lineStyle == LineOnOffDash) {
+ switch (pGC->capStyle) {
+ case CapProjecting:
+ vertices[V_BOTTOM] = saveBottom;
+ vertices[V_RIGHT] = saveRight;
+ slopes[V_RIGHT].k = saveK;
+ break;
+ case CapRound:
+ if (!first) {
+ if (dx < 0) {
+ lcapFace.xa = -vertices[V_LEFT].x;
+ lcapFace.ya = -vertices[V_LEFT].y;
+ lcapFace.k = slopes[V_LEFT].k;
+ }
+ else {
+ lcapFace.xa = vertices[V_TOP].x;
+ lcapFace.ya = vertices[V_TOP].y;
+ lcapFace.k = -slopes[V_LEFT].k;
+ }
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ &lcapFace, (LineFacePtr) NULL,
+ lcenterx, lcentery, FALSE);
+ }
+ if (dx < 0) {
+ rcapFace.xa = vertices[V_BOTTOM].x;
+ rcapFace.ya = vertices[V_BOTTOM].y;
+ rcapFace.k = slopes[V_RIGHT].k;
+ }
+ else {
+ rcapFace.xa = -vertices[V_RIGHT].x;
+ rcapFace.ya = -vertices[V_RIGHT].y;
+ rcapFace.k = -slopes[V_RIGHT].k;
+ }
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ (LineFacePtr) NULL, &rcapFace,
+ rcenterx, rcentery, FALSE);
+ break;
+ }
+ }
+ }
+ LRemain -= dashRemain;
+ ++dashIndex;
+ if (dashIndex == pGC->numInDashList)
+ dashIndex = 0;
+ dashRemain = pDash[dashIndex];
+
+ lcenterx = rcenterx;
+ lcentery = rcentery;
+
+ vertices[V_TOP] = vertices[V_RIGHT];
+ vertices[V_LEFT] = vertices[V_BOTTOM];
+ slopes[V_LEFT].k = -slopes[V_RIGHT].k;
+ first = FALSE;
+ }
+
+ if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) {
+ vertices[V_TOP].x -= dx;
+ vertices[V_TOP].y -= dy;
+
+ vertices[V_LEFT].x -= dx;
+ vertices[V_LEFT].y -= dy;
+
+ vertices[V_RIGHT].x = rdy;
+ vertices[V_RIGHT].y = -rdx;
+
+ vertices[V_BOTTOM].x = -rdy;
+ vertices[V_BOTTOM].y = rdx;
+
+ if (projectRight) {
+ vertices[V_RIGHT].x += rdx;
+ vertices[V_RIGHT].y += rdy;
+
+ vertices[V_BOTTOM].x += rdx;
+ vertices[V_BOTTOM].y += rdy;
+ slopes[V_RIGHT].k = vertices[V_RIGHT].x *
+ slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx;
+ }
+ else
+ slopes[V_RIGHT].k = 0;
+
+ if (!first && pGC->lineStyle == LineOnOffDash &&
+ pGC->capStyle == CapProjecting) {
+ vertices[V_TOP].x -= rdx;
+ vertices[V_TOP].y -= rdy;
+
+ vertices[V_LEFT].x -= rdx;
+ vertices[V_LEFT].y -= rdy;
+ slopes[V_LEFT].k = vertices[V_LEFT].x *
+ slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx;
+ }
+ else
+ slopes[V_LEFT].k += dx * dx + dy * dy;
+
+ y = miPolyBuildPoly(vertices, slopes, 4, x2, y2,
+ left, right, &nleft, &nright, &h);
+
+ pixel = (dashIndex & 1) ? pGC->bgPixel : pGC->fgPixel;
+ miFillPolyHelper(pDrawable, pGC, pixel, spanData, y, h, left, right,
+ nleft, nright);
+ if (!first && pGC->lineStyle == LineOnOffDash &&
+ pGC->capStyle == CapRound) {
+ lcapFace.x = x2;
+ lcapFace.y = y2;
+ if (dx < 0) {
+ lcapFace.xa = -vertices[V_LEFT].x;
+ lcapFace.ya = -vertices[V_LEFT].y;
+ lcapFace.k = slopes[V_LEFT].k;
+ }
+ else {
+ lcapFace.xa = vertices[V_TOP].x;
+ lcapFace.ya = vertices[V_TOP].y;
+ lcapFace.k = -slopes[V_LEFT].k;
+ }
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ &lcapFace, (LineFacePtr) NULL, rcenterx, rcentery, FALSE);
+ }
}
dashRemain = ((double) dashRemain) - LRemain;
- if (dashRemain == 0)
- {
- dashIndex++;
- if (dashIndex == pGC->numInDashList)
- dashIndex = 0;
- dashRemain = pDash[dashIndex];
+ if (dashRemain == 0) {
+ dashIndex++;
+ if (dashIndex == pGC->numInDashList)
+ dashIndex = 0;
+ dashRemain = pDash[dashIndex];
}
leftFace->x = x1;
@@ -2018,180 +1825,161 @@ miWideDashSegment (
}
void
-miWideDash (DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr pPts)
+miWideDash(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pPts)
{
- int x1, y1, x2, y2;
- unsigned long pixel;
- Bool projectLeft, projectRight;
- LineFaceRec leftFace, rightFace, prevRightFace;
- LineFaceRec firstFace;
- int first;
- int dashIndex, dashOffset;
- int prevDashIndex;
- SpanDataRec spanDataRec;
- SpanDataPtr spanData;
- Bool somethingDrawn = FALSE;
- Bool selfJoin;
- Bool endIsFg = FALSE, startIsFg = FALSE;
- Bool firstIsFg = FALSE, prevIsFg = FALSE;
+ int x1, y1, x2, y2;
+ unsigned long pixel;
+ Bool projectLeft, projectRight;
+ LineFaceRec leftFace, rightFace, prevRightFace;
+ LineFaceRec firstFace;
+ int first;
+ int dashIndex, dashOffset;
+ int prevDashIndex;
+ SpanDataRec spanDataRec;
+ SpanDataPtr spanData;
+ Bool somethingDrawn = FALSE;
+ Bool selfJoin;
+ Bool endIsFg = FALSE, startIsFg = FALSE;
+ Bool firstIsFg = FALSE, prevIsFg = FALSE;
#if 0
/* XXX backward compatibility */
- if (pGC->lineWidth == 0)
- {
- miZeroDashLine (pDrawable, pGC, mode, npt, pPts);
- return;
+ if (pGC->lineWidth == 0) {
+ miZeroDashLine(pDrawable, pGC, mode, npt, pPts);
+ return;
}
#endif
- if (pGC->lineStyle == LineDoubleDash &&
- (pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled))
- {
- miWideLine (pDrawable, pGC, mode, npt, pPts);
- return;
+ if (pGC->lineStyle == LineDoubleDash &&
+ (pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled)) {
+ miWideLine(pDrawable, pGC, mode, npt, pPts);
+ return;
}
if (npt == 0)
- return;
- spanData = miSetupSpanData (pGC, &spanDataRec, npt);
+ return;
+ spanData = miSetupSpanData(pGC, &spanDataRec, npt);
x2 = pPts->x;
y2 = pPts->y;
first = TRUE;
selfJoin = FALSE;
- if (mode == CoordModePrevious)
- {
- int nptTmp;
- DDXPointPtr pPtsTmp;
-
- x1 = x2;
- y1 = y2;
- nptTmp = npt;
- pPtsTmp = pPts + 1;
- while (--nptTmp)
- {
- x1 += pPtsTmp->x;
- y1 += pPtsTmp->y;
- ++pPtsTmp;
- }
- if (x2 == x1 && y2 == y1)
- selfJoin = TRUE;
- }
- else if (x2 == pPts[npt-1].x && y2 == pPts[npt-1].y)
- {
- selfJoin = TRUE;
+ if (mode == CoordModePrevious) {
+ int nptTmp;
+ DDXPointPtr pPtsTmp;
+
+ x1 = x2;
+ y1 = y2;
+ nptTmp = npt;
+ pPtsTmp = pPts + 1;
+ while (--nptTmp) {
+ x1 += pPtsTmp->x;
+ y1 += pPtsTmp->y;
+ ++pPtsTmp;
+ }
+ if (x2 == x1 && y2 == y1)
+ selfJoin = TRUE;
+ }
+ else if (x2 == pPts[npt - 1].x && y2 == pPts[npt - 1].y) {
+ selfJoin = TRUE;
}
projectLeft = pGC->capStyle == CapProjecting && !selfJoin;
projectRight = FALSE;
dashIndex = 0;
dashOffset = 0;
- miStepDash ((int)pGC->dashOffset, &dashIndex,
- pGC->dash, (int)pGC->numInDashList, &dashOffset);
- while (--npt)
- {
- x1 = x2;
- y1 = y2;
- ++pPts;
- x2 = pPts->x;
- y2 = pPts->y;
- if (mode == CoordModePrevious)
- {
- x2 += x1;
- y2 += y1;
- }
- if (x1 != x2 || y1 != y2)
- {
- somethingDrawn = TRUE;
- if (npt == 1 && pGC->capStyle == CapProjecting &&
- (!selfJoin || !firstIsFg))
- projectRight = TRUE;
- prevDashIndex = dashIndex;
- miWideDashSegment (pDrawable, pGC, spanData, &dashOffset, &dashIndex,
- x1, y1, x2, y2,
- projectLeft, projectRight, &leftFace, &rightFace);
- startIsFg = !(prevDashIndex & 1);
- endIsFg = (dashIndex & 1) ^ (dashOffset != 0);
- if (pGC->lineStyle == LineDoubleDash || startIsFg)
- {
- pixel = startIsFg ? pGC->fgPixel : pGC->bgPixel;
- if (first || (pGC->lineStyle == LineOnOffDash && !prevIsFg))
- {
- if (first && selfJoin)
- {
- firstFace = leftFace;
- firstIsFg = startIsFg;
- }
- else if (pGC->capStyle == CapRound)
- miLineArc (pDrawable, pGC, pixel, spanData,
- &leftFace, (LineFacePtr) NULL,
- (double)0.0, (double)0.0, TRUE);
- }
- else
- {
- miLineJoin (pDrawable, pGC, pixel, spanData, &leftFace,
- &prevRightFace);
- }
- }
- prevRightFace = rightFace;
- prevIsFg = endIsFg;
- first = FALSE;
- projectLeft = FALSE;
- }
- if (npt == 1 && somethingDrawn)
- {
- if (pGC->lineStyle == LineDoubleDash || endIsFg)
- {
- pixel = endIsFg ? pGC->fgPixel : pGC->bgPixel;
- if (selfJoin && (pGC->lineStyle == LineDoubleDash || firstIsFg))
- {
- miLineJoin (pDrawable, pGC, pixel, spanData, &firstFace,
- &rightFace);
- }
- else
- {
- if (pGC->capStyle == CapRound)
- miLineArc (pDrawable, pGC, pixel, spanData,
- (LineFacePtr) NULL, &rightFace,
- (double)0.0, (double)0.0, TRUE);
- }
- }
- else
- {
- /* glue a cap to the start of the line if
- * we're OnOffDash and ended on odd dash
- */
- if (selfJoin && firstIsFg)
- {
- pixel = pGC->fgPixel;
- if (pGC->capStyle == CapProjecting)
- miLineProjectingCap (pDrawable, pGC, pixel, spanData,
- &firstFace, TRUE,
- (double)0.0, (double)0.0, TRUE);
- else if (pGC->capStyle == CapRound)
- miLineArc (pDrawable, pGC, pixel, spanData,
- &firstFace, (LineFacePtr) NULL,
- (double)0.0, (double)0.0, TRUE);
- }
- }
- }
+ miStepDash((int) pGC->dashOffset, &dashIndex,
+ pGC->dash, (int) pGC->numInDashList, &dashOffset);
+ while (--npt) {
+ x1 = x2;
+ y1 = y2;
+ ++pPts;
+ x2 = pPts->x;
+ y2 = pPts->y;
+ if (mode == CoordModePrevious) {
+ x2 += x1;
+ y2 += y1;
+ }
+ if (x1 != x2 || y1 != y2) {
+ somethingDrawn = TRUE;
+ if (npt == 1 && pGC->capStyle == CapProjecting &&
+ (!selfJoin || !firstIsFg))
+ projectRight = TRUE;
+ prevDashIndex = dashIndex;
+ miWideDashSegment(pDrawable, pGC, spanData, &dashOffset, &dashIndex,
+ x1, y1, x2, y2,
+ projectLeft, projectRight, &leftFace, &rightFace);
+ startIsFg = !(prevDashIndex & 1);
+ endIsFg = (dashIndex & 1) ^ (dashOffset != 0);
+ if (pGC->lineStyle == LineDoubleDash || startIsFg) {
+ pixel = startIsFg ? pGC->fgPixel : pGC->bgPixel;
+ if (first || (pGC->lineStyle == LineOnOffDash && !prevIsFg)) {
+ if (first && selfJoin) {
+ firstFace = leftFace;
+ firstIsFg = startIsFg;
+ }
+ else if (pGC->capStyle == CapRound)
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ &leftFace, (LineFacePtr) NULL,
+ (double) 0.0, (double) 0.0, TRUE);
+ }
+ else {
+ miLineJoin(pDrawable, pGC, pixel, spanData, &leftFace,
+ &prevRightFace);
+ }
+ }
+ prevRightFace = rightFace;
+ prevIsFg = endIsFg;
+ first = FALSE;
+ projectLeft = FALSE;
+ }
+ if (npt == 1 && somethingDrawn) {
+ if (pGC->lineStyle == LineDoubleDash || endIsFg) {
+ pixel = endIsFg ? pGC->fgPixel : pGC->bgPixel;
+ if (selfJoin && (pGC->lineStyle == LineDoubleDash || firstIsFg)) {
+ miLineJoin(pDrawable, pGC, pixel, spanData, &firstFace,
+ &rightFace);
+ }
+ else {
+ if (pGC->capStyle == CapRound)
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ (LineFacePtr) NULL, &rightFace,
+ (double) 0.0, (double) 0.0, TRUE);
+ }
+ }
+ else {
+ /* glue a cap to the start of the line if
+ * we're OnOffDash and ended on odd dash
+ */
+ if (selfJoin && firstIsFg) {
+ pixel = pGC->fgPixel;
+ if (pGC->capStyle == CapProjecting)
+ miLineProjectingCap(pDrawable, pGC, pixel, spanData,
+ &firstFace, TRUE,
+ (double) 0.0, (double) 0.0, TRUE);
+ else if (pGC->capStyle == CapRound)
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ &firstFace, (LineFacePtr) NULL,
+ (double) 0.0, (double) 0.0, TRUE);
+ }
+ }
+ }
}
/* handle crock where all points are coincident */
- if (!somethingDrawn && (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)))
- {
- /* not the same as endIsFg computation above */
- pixel = (dashIndex & 1) ? pGC->bgPixel : pGC->fgPixel;
- switch (pGC->capStyle) {
- case CapRound:
- miLineArc (pDrawable, pGC, pixel, spanData,
- (LineFacePtr) NULL, (LineFacePtr) NULL,
- (double)x2, (double)y2,
- FALSE);
- break;
- case CapProjecting:
- x1 = pGC->lineWidth;
- miFillRectPolyHelper (pDrawable, pGC, pixel, spanData,
- x2 - (x1 >> 1), y2 - (x1 >> 1), x1, x1);
- break;
- }
+ if (!somethingDrawn &&
+ (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1))) {
+ /* not the same as endIsFg computation above */
+ pixel = (dashIndex & 1) ? pGC->bgPixel : pGC->fgPixel;
+ switch (pGC->capStyle) {
+ case CapRound:
+ miLineArc(pDrawable, pGC, pixel, spanData,
+ (LineFacePtr) NULL, (LineFacePtr) NULL,
+ (double) x2, (double) y2, FALSE);
+ break;
+ case CapProjecting:
+ x1 = pGC->lineWidth;
+ miFillRectPolyHelper(pDrawable, pGC, pixel, spanData,
+ x2 - (x1 >> 1), y2 - (x1 >> 1), x1, x1);
+ break;
+ }
}
if (spanData)
- miCleanupSpanData (pDrawable, pGC, spanData);
+ miCleanupSpanData(pDrawable, pGC, spanData);
}
diff --git a/xorg-server/mi/miwideline.h b/xorg-server/mi/miwideline.h
index 05d026a38..110541120 100644
--- a/xorg-server/mi/miwideline.h
+++ b/xorg-server/mi/miwideline.h
@@ -1,120 +1,119 @@
-/*
-
-Copyright 1988, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-/* Author: Keith Packard, MIT X Consortium */
-
-#include "mispans.h"
-#include "mifpoly.h" /* for ICEIL */
-
-/*
- * Polygon edge description for integer wide-line routines
- */
-
-typedef struct _PolyEdge {
- int height; /* number of scanlines to process */
- int x; /* starting x coordinate */
- int stepx; /* fixed integral dx */
- int signdx; /* variable dx sign */
- int e; /* initial error term */
- int dy;
- int dx;
-} PolyEdgeRec, *PolyEdgePtr;
-
-#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */
-
-/*
- * types for general polygon routines
- */
-
-typedef struct _PolyVertex {
- double x, y;
-} PolyVertexRec, *PolyVertexPtr;
-
-typedef struct _PolySlope {
- int dx, dy;
- double k; /* x0 * dy - y0 * dx */
-} PolySlopeRec, *PolySlopePtr;
-
-/*
- * Line face description for caps/joins
- */
-
-typedef struct _LineFace {
- double xa, ya;
- int dx, dy;
- int x, y;
- double k;
-} LineFaceRec, *LineFacePtr;
-
-/*
- * macros for polygon fillers
- */
-
-#define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
- oldPixel = pGC->fgPixel; \
- if (pixel != oldPixel) { \
- ChangeGCVal gcval; \
- gcval.val = pixel; \
- ChangeGC (NullClient, pGC, GCForeground, &gcval); \
- ValidateGC (pDrawable, pGC); \
- } \
-}
-#define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
- if (pixel != oldPixel) { \
- ChangeGCVal gcval; \
- gcval.val = oldPixel; \
- ChangeGC (NullClient, pGC, GCForeground, &gcval); \
- ValidateGC (pDrawable, pGC); \
- } \
-}
-
-extern _X_EXPORT void miRoundJoinClip(
- LineFacePtr /*pLeft*/,
- LineFacePtr /*pRight*/,
- PolyEdgePtr /*edge1*/,
- PolyEdgePtr /*edge2*/,
- int * /*y1*/,
- int * /*y2*/,
- Bool * /*left1*/,
- Bool * /*left2*/
-);
-
-extern _X_EXPORT int miRoundCapClip(
- LineFacePtr /*face*/,
- Bool /*isInt*/,
- PolyEdgePtr /*edge*/,
- Bool * /*leftEdge*/
-);
-
-extern _X_EXPORT int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy,
- int xi, int yi, int left, PolyEdgePtr edge);
-extern _X_EXPORT int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes,
- int count, int xi, int yi, PolyEdgePtr left,
- PolyEdgePtr right, int *pnleft, int *pnright,
- int *h);
-
+/*
+
+Copyright 1988, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+/* Author: Keith Packard, MIT X Consortium */
+
+#include "mispans.h"
+#include "mifpoly.h" /* for ICEIL */
+
+/*
+ * Polygon edge description for integer wide-line routines
+ */
+
+typedef struct _PolyEdge {
+ int height; /* number of scanlines to process */
+ int x; /* starting x coordinate */
+ int stepx; /* fixed integral dx */
+ int signdx; /* variable dx sign */
+ int e; /* initial error term */
+ int dy;
+ int dx;
+} PolyEdgeRec, *PolyEdgePtr;
+
+#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */
+
+/*
+ * types for general polygon routines
+ */
+
+typedef struct _PolyVertex {
+ double x, y;
+} PolyVertexRec, *PolyVertexPtr;
+
+typedef struct _PolySlope {
+ int dx, dy;
+ double k; /* x0 * dy - y0 * dx */
+} PolySlopeRec, *PolySlopePtr;
+
+/*
+ * Line face description for caps/joins
+ */
+
+typedef struct _LineFace {
+ double xa, ya;
+ int dx, dy;
+ int x, y;
+ double k;
+} LineFaceRec, *LineFacePtr;
+
+/*
+ * macros for polygon fillers
+ */
+
+#define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
+ oldPixel = pGC->fgPixel; \
+ if (pixel != oldPixel) { \
+ ChangeGCVal gcval; \
+ gcval.val = pixel; \
+ ChangeGC (NullClient, pGC, GCForeground, &gcval); \
+ ValidateGC (pDrawable, pGC); \
+ } \
+}
+#define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
+ if (pixel != oldPixel) { \
+ ChangeGCVal gcval; \
+ gcval.val = oldPixel; \
+ ChangeGC (NullClient, pGC, GCForeground, &gcval); \
+ ValidateGC (pDrawable, pGC); \
+ } \
+}
+
+extern _X_EXPORT void miRoundJoinClip(LineFacePtr /*pLeft */ ,
+ LineFacePtr /*pRight */ ,
+ PolyEdgePtr /*edge1 */ ,
+ PolyEdgePtr /*edge2 */ ,
+ int * /*y1 */ ,
+ int * /*y2 */ ,
+ Bool * /*left1 */ ,
+ Bool * /*left2 */
+ );
+
+extern _X_EXPORT int miRoundCapClip(LineFacePtr /*face */ ,
+ Bool /*isInt */ ,
+ PolyEdgePtr /*edge */ ,
+ Bool * /*leftEdge */
+ );
+
+extern _X_EXPORT int miPolyBuildEdge(double x0, double y0, double k, int dx,
+ int dy, int xi, int yi, int left,
+ PolyEdgePtr edge);
+extern _X_EXPORT int miPolyBuildPoly(PolyVertexPtr vertices,
+ PolySlopePtr slopes, int count, int xi,
+ int yi, PolyEdgePtr left,
+ PolyEdgePtr right, int *pnleft,
+ int *pnright, int *h);
diff --git a/xorg-server/mi/miwindow.c b/xorg-server/mi/miwindow.c
index 87d474ff2..e341b79de 100644
--- a/xorg-server/mi/miwindow.c
+++ b/xorg-server/mi/miwindow.c
@@ -1,824 +1,760 @@
-
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/extensions/shapeconst.h>
-#include "regionstr.h"
-#include "region.h"
-#include "mi.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "mivalidate.h"
-
-void
-miClearToBackground(WindowPtr pWin,
- int x, int y, int w, int h,
- Bool generateExposures)
-{
- BoxRec box;
- RegionRec reg;
- BoxPtr extents;
- int x1, y1, x2, y2;
-
- /* compute everything using ints to avoid overflow */
-
- x1 = pWin->drawable.x + x;
- y1 = pWin->drawable.y + y;
- if (w)
- x2 = x1 + (int) w;
- else
- x2 = x1 + (int) pWin->drawable.width - (int) x;
- if (h)
- y2 = y1 + h;
- else
- y2 = y1 + (int) pWin->drawable.height - (int) y;
-
- extents = &pWin->clipList.extents;
-
- /* clip the resulting rectangle to the window clipList extents. This
- * makes sure that the result will fit in a box, given that the
- * screen is < 32768 on a side.
- */
-
- if (x1 < extents->x1)
- x1 = extents->x1;
- if (x2 > extents->x2)
- x2 = extents->x2;
- if (y1 < extents->y1)
- y1 = extents->y1;
- if (y2 > extents->y2)
- y2 = extents->y2;
-
- if (x2 <= x1 || y2 <= y1)
- {
- x2 = x1 = 0;
- y2 = y1 = 0;
- }
-
- box.x1 = x1;
- box.x2 = x2;
- box.y1 = y1;
- box.y2 = y2;
-
- RegionInit(&reg, &box, 1);
-
- RegionIntersect(&reg, &reg, &pWin->clipList);
- if (generateExposures)
- (*pWin->drawable.pScreen->WindowExposures)(pWin, &reg, NULL);
- else if (pWin->backgroundState != None)
- miPaintWindow(pWin, &reg, PW_BACKGROUND);
- RegionUninit(&reg);
-}
-
-void
-miMarkWindow(WindowPtr pWin)
-{
- ValidatePtr val;
-
- if (pWin->valdata)
- return;
- val = (ValidatePtr)xnfalloc(sizeof(ValidateRec));
- val->before.oldAbsCorner.x = pWin->drawable.x;
- val->before.oldAbsCorner.y = pWin->drawable.y;
- val->before.borderVisible = NullRegion;
- val->before.resized = FALSE;
- pWin->valdata = val;
-}
-
-Bool
-miMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, WindowPtr *ppLayerWin)
-{
- BoxPtr box;
- WindowPtr pChild, pLast;
- Bool anyMarked = FALSE;
- MarkWindowProcPtr MarkWindow = pWin->drawable.pScreen->MarkWindow;
-
- /* single layered systems are easy */
- if (ppLayerWin) *ppLayerWin = pWin;
-
- if (pWin == pFirst)
- {
- /* Blindly mark pWin and all of its inferiors. This is a slight
- * overkill if there are mapped windows that outside pWin's border,
- * but it's better than wasting time on RectIn checks.
- */
- pChild = pWin;
- while (1)
- {
- if (pChild->viewable)
- {
- if (RegionBroken(&pChild->winSize))
- SetWinSize (pChild);
- if (RegionBroken(&pChild->borderSize))
- SetBorderSize (pChild);
- (* MarkWindow)(pChild);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- break;
- pChild = pChild->nextSib;
- }
- anyMarked = TRUE;
- pFirst = pFirst->nextSib;
- }
- if ( (pChild = pFirst) )
- {
- box = RegionExtents(&pWin->borderSize);
- pLast = pChild->parent->lastChild;
- while (1)
- {
- if (pChild->viewable)
- {
- if (RegionBroken(&pChild->winSize))
- SetWinSize (pChild);
- if (RegionBroken(&pChild->borderSize))
- SetBorderSize (pChild);
- if (RegionContainsRect(&pChild->borderSize, box))
- {
- (* MarkWindow)(pChild);
- anyMarked = TRUE;
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- }
- while (!pChild->nextSib && (pChild != pLast))
- pChild = pChild->parent;
- if (pChild == pLast)
- break;
- pChild = pChild->nextSib;
- }
- }
- if (anyMarked)
- (* MarkWindow)(pWin->parent);
- return anyMarked;
-}
-
-/*****
- * miHandleValidateExposures(pWin)
- * starting at pWin, draw background in any windows that have exposure
- * regions, translate the regions, restore any backing store,
- * and then send any regions still exposed to the client
- *****/
-void
-miHandleValidateExposures(WindowPtr pWin)
-{
- WindowPtr pChild;
- ValidatePtr val;
- WindowExposuresProcPtr WindowExposures;
-
- pChild = pWin;
- WindowExposures = pChild->drawable.pScreen->WindowExposures;
- while (1)
- {
- if ( (val = pChild->valdata) && val!=UnmapValData)
- {
- if (RegionNotEmpty(&val->after.borderExposed))
- miPaintWindow(pChild, &val->after.borderExposed, PW_BORDER);
- RegionUninit(&val->after.borderExposed);
- (*WindowExposures)(pChild, &val->after.exposed, NullRegion);
- RegionUninit(&val->after.exposed);
- free(val);
- pChild->valdata = NULL;
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- break;
- pChild = pChild->nextSib;
- }
-}
-
-void
-miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)
-{
- WindowPtr pParent;
- Bool WasViewable = (Bool)(pWin->viewable);
- short bw;
- RegionPtr oldRegion = NULL;
- DDXPointRec oldpt;
- Bool anyMarked = FALSE;
- ScreenPtr pScreen;
- WindowPtr windowToValidate;
- WindowPtr pLayerWin;
-
- /* if this is a root window, can't be moved */
- if (!(pParent = pWin->parent))
- return ;
- pScreen = pWin->drawable.pScreen;
- bw = wBorderWidth (pWin);
-
- oldpt.x = pWin->drawable.x;
- oldpt.y = pWin->drawable.y;
- if (WasViewable)
- {
- oldRegion = RegionCreate(NullBox, 1);
- RegionCopy(oldRegion, &pWin->borderClip);
- anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin);
- }
- pWin->origin.x = x + (int)bw;
- pWin->origin.y = y + (int)bw;
- x = pWin->drawable.x = pParent->drawable.x + x + (int)bw;
- y = pWin->drawable.y = pParent->drawable.y + y + (int)bw;
-
- SetWinSize (pWin);
- SetBorderSize (pWin);
-
- (*pScreen->PositionWindow)(pWin, x, y);
-
- windowToValidate = MoveWindowInStack(pWin, pNextSib);
-
- ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0);
-
- if (WasViewable)
- {
- if (pLayerWin == pWin)
- anyMarked |= (*pScreen->MarkOverlappedWindows)
- (pWin, windowToValidate, NULL);
- else
- anyMarked |= (*pScreen->MarkOverlappedWindows)
- (pWin, pLayerWin, NULL);
-
-
- if (anyMarked)
- {
- (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, kind);
- (* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, oldRegion);
- RegionDestroy(oldRegion);
- /* XXX need to retile border if ParentRelative origin */
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, kind);
- }
- if (pWin->realized)
- WindowsRestructured ();
-}
-
-
-/*
- * pValid is a region of the screen which has been
- * successfully copied -- recomputed exposed regions for affected windows
- */
-
-static int
-miRecomputeExposures (
- WindowPtr pWin,
- pointer value) /* must conform to VisitWindowProcPtr */
-{
- RegionPtr pValid = (RegionPtr)value;
-
- if (pWin->valdata)
- {
-#ifdef COMPOSITE
- /*
- * Redirected windows are not affected by parent window
- * gravity manipulations, so don't recompute their
- * exposed areas here.
- */
- if (pWin->redirectDraw != RedirectDrawNone)
- return WT_DONTWALKCHILDREN;
-#endif
- /*
- * compute exposed regions of this window
- */
- RegionSubtract(&pWin->valdata->after.exposed,
- &pWin->clipList, pValid);
- /*
- * compute exposed regions of the border
- */
- RegionSubtract(&pWin->valdata->after.borderExposed,
- &pWin->borderClip, &pWin->winSize);
- RegionSubtract(&pWin->valdata->after.borderExposed,
- &pWin->valdata->after.borderExposed, pValid);
- return WT_WALKCHILDREN;
- }
- return WT_NOMATCH;
-}
-
-void
-miSlideAndSizeWindow(WindowPtr pWin,
- int x, int y,
- unsigned int w, unsigned int h,
- WindowPtr pSib)
-{
- WindowPtr pParent;
- Bool WasViewable = (Bool)(pWin->viewable);
- unsigned short width = pWin->drawable.width,
- height = pWin->drawable.height;
- short oldx = pWin->drawable.x,
- oldy = pWin->drawable.y;
- int bw = wBorderWidth (pWin);
- short dw, dh;
- DDXPointRec oldpt;
- RegionPtr oldRegion = NULL;
- Bool anyMarked = FALSE;
- ScreenPtr pScreen;
- WindowPtr pFirstChange;
- WindowPtr pChild;
- RegionPtr gravitate[StaticGravity + 1];
- unsigned g;
- int nx, ny; /* destination x,y */
- int newx, newy; /* new inner window position */
- RegionPtr pRegion = NULL;
- RegionPtr destClip; /* portions of destination already written */
- RegionPtr oldWinClip = NULL; /* old clip list for window */
- RegionPtr borderVisible = NullRegion; /* visible area of the border */
- Bool shrunk = FALSE; /* shrunk in an inner dimension */
- Bool moved = FALSE; /* window position changed */
- WindowPtr pLayerWin;
-
- /* if this is a root window, can't be resized */
- if (!(pParent = pWin->parent))
- return ;
-
- pScreen = pWin->drawable.pScreen;
- newx = pParent->drawable.x + x + bw;
- newy = pParent->drawable.y + y + bw;
- if (WasViewable)
- {
- anyMarked = FALSE;
- /*
- * save the visible region of the window
- */
- oldRegion = RegionCreate(NullBox, 1);
- RegionCopy(oldRegion, &pWin->winSize);
-
- /*
- * categorize child windows into regions to be moved
- */
- for (g = 0; g <= StaticGravity; g++)
- gravitate[g] = (RegionPtr) NULL;
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- g = pChild->winGravity;
- if (g != UnmapGravity)
- {
- if (!gravitate[g])
- gravitate[g] = RegionCreate(NullBox, 1);
- RegionUnion(gravitate[g],
- gravitate[g], &pChild->borderClip);
- }
- else
- {
- UnmapWindow(pChild, TRUE);
- anyMarked = TRUE;
- }
- }
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
- &pLayerWin);
-
- oldWinClip = NULL;
- if (pWin->bitGravity != ForgetGravity)
- {
- oldWinClip = RegionCreate(NullBox, 1);
- RegionCopy(oldWinClip, &pWin->clipList);
- }
- /*
- * if the window is changing size, borderExposed
- * can't be computed correctly without some help.
- */
- if (pWin->drawable.height > h || pWin->drawable.width > w)
- shrunk = TRUE;
-
- if (newx != oldx || newy != oldy)
- moved = TRUE;
-
- if ((pWin->drawable.height != h || pWin->drawable.width != w) &&
- HasBorder (pWin))
- {
- borderVisible = RegionCreate(NullBox, 1);
- /* for tiled borders, we punt and draw the whole thing */
- if (pWin->borderIsPixel || !moved)
- {
- if (shrunk || moved)
- RegionSubtract(borderVisible,
- &pWin->borderClip,
- &pWin->winSize);
- else
- RegionCopy(borderVisible,
- &pWin->borderClip);
- }
- }
- }
- pWin->origin.x = x + bw;
- pWin->origin.y = y + bw;
- pWin->drawable.height = h;
- pWin->drawable.width = w;
-
- x = pWin->drawable.x = newx;
- y = pWin->drawable.y = newy;
-
- SetWinSize (pWin);
- SetBorderSize (pWin);
-
- dw = (int)w - (int)width;
- dh = (int)h - (int)height;
- ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh);
-
- /* let the hardware adjust background and border pixmaps, if any */
- (*pScreen->PositionWindow)(pWin, x, y);
-
- pFirstChange = MoveWindowInStack(pWin, pSib);
-
- if (WasViewable)
- {
- pRegion = RegionCreate(NullBox, 1);
-
- if (pLayerWin == pWin)
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange,
- NULL);
- else
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin,
- NULL);
-
- if (pWin->valdata)
- {
- pWin->valdata->before.resized = TRUE;
- pWin->valdata->before.borderVisible = borderVisible;
- }
-
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, VTOther);
- /*
- * the entire window is trashed unless bitGravity
- * recovers portions of it
- */
- RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList);
- }
-
- GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny);
-
- if (WasViewable)
- {
- /* avoid the border */
- if (HasBorder (pWin))
- {
- int offx, offy, dx, dy;
-
- /* kruft to avoid double translates for each gravity */
- offx = 0;
- offy = 0;
- for (g = 0; g <= StaticGravity; g++)
- {
- if (!gravitate[g])
- continue;
-
- /* align winSize to gravitate[g].
- * winSize is in new coordinates,
- * gravitate[g] is still in old coordinates */
- GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny);
-
- dx = (oldx - nx) - offx;
- dy = (oldy - ny) - offy;
- if (dx || dy)
- {
- RegionTranslate(&pWin->winSize, dx, dy);
- offx += dx;
- offy += dy;
- }
- RegionIntersect(gravitate[g], gravitate[g],
- &pWin->winSize);
- }
- /* get winSize back where it belongs */
- if (offx || offy)
- RegionTranslate(&pWin->winSize, -offx, -offy);
- }
- /*
- * add screen bits to the appropriate bucket
- */
-
- if (oldWinClip)
- {
- /*
- * clip to new clipList
- */
- RegionCopy(pRegion, oldWinClip);
- RegionTranslate(pRegion, nx - oldx, ny - oldy);
- RegionIntersect(oldWinClip, pRegion, &pWin->clipList);
- /*
- * don't step on any gravity bits which will be copied after this
- * region. Note -- this assumes that the regions will be copied
- * in gravity order.
- */
- for (g = pWin->bitGravity + 1; g <= StaticGravity; g++)
- {
- if (gravitate[g])
- RegionSubtract(oldWinClip, oldWinClip,
- gravitate[g]);
- }
- RegionTranslate(oldWinClip, oldx - nx, oldy - ny);
- g = pWin->bitGravity;
- if (!gravitate[g])
- gravitate[g] = oldWinClip;
- else
- {
- RegionUnion(gravitate[g], gravitate[g], oldWinClip);
- RegionDestroy(oldWinClip);
- }
- }
-
- /*
- * move the bits on the screen
- */
-
- destClip = NULL;
-
- for (g = 0; g <= StaticGravity; g++)
- {
- if (!gravitate[g])
- continue;
-
- GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny);
-
- oldpt.x = oldx + (x - nx);
- oldpt.y = oldy + (y - ny);
-
- /* Note that gravitate[g] is *translated* by CopyWindow */
-
- /* only copy the remaining useful bits */
-
- RegionIntersect(gravitate[g], gravitate[g], oldRegion);
-
- /* clip to not overwrite already copied areas */
-
- if (destClip) {
- RegionTranslate(destClip, oldpt.x - x, oldpt.y - y);
- RegionSubtract(gravitate[g], gravitate[g], destClip);
- RegionTranslate(destClip, x - oldpt.x, y - oldpt.y);
- }
-
- /* and move those bits */
-
- if (oldpt.x != x || oldpt.y != y
-#ifdef COMPOSITE
- || pWin->redirectDraw
-#endif
- )
- {
- (*pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, gravitate[g]);
- }
-
- /* remove any overwritten bits from the remaining useful bits */
-
- RegionSubtract(oldRegion, oldRegion, gravitate[g]);
-
- /*
- * recompute exposed regions of child windows
- */
-
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- if (pChild->winGravity != g)
- continue;
- RegionIntersect(pRegion,
- &pChild->borderClip, gravitate[g]);
- TraverseTree (pChild, miRecomputeExposures, (pointer)pRegion);
- }
-
- /*
- * remove the successfully copied regions of the
- * window from its exposed region
- */
-
- if (g == pWin->bitGravity)
- RegionSubtract(&pWin->valdata->after.exposed,
- &pWin->valdata->after.exposed, gravitate[g]);
- if (!destClip)
- destClip = gravitate[g];
- else
- {
- RegionUnion(destClip, destClip, gravitate[g]);
- RegionDestroy(gravitate[g]);
- }
- }
-
- RegionDestroy(oldRegion);
- RegionDestroy(pRegion);
- if (destClip)
- RegionDestroy(destClip);
- if (anyMarked)
- (*pScreen->HandleExposures)(pLayerWin->parent);
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange,
- VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
-}
-
-WindowPtr
-miGetLayerWindow(WindowPtr pWin)
-{
- return pWin->firstChild;
-}
-
-/******
- *
- * miSetShape
- * The border/window shape has changed. Recompute winSize/borderSize
- * and send appropriate exposure events
- */
-
-void
-miSetShape(WindowPtr pWin, int kind)
-{
- Bool WasViewable = (Bool)(pWin->viewable);
- ScreenPtr pScreen = pWin->drawable.pScreen;
- Bool anyMarked = FALSE;
- WindowPtr pLayerWin;
-
- if (kind != ShapeInput) {
- if (WasViewable)
- {
- anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin,
- &pLayerWin);
- if (pWin->valdata)
- {
- if (HasBorder (pWin))
- {
- RegionPtr borderVisible;
-
- borderVisible = RegionCreate(NullBox, 1);
- RegionSubtract(borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- }
- pWin->valdata->before.resized = TRUE;
- }
- }
-
- SetWinSize (pWin);
- SetBorderSize (pWin);
-
- ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
- NULL);
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow,
- VTOther);
- }
-
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pLayerWin->parent);
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow,
- VTOther);
- }
- }
- if (pWin->realized)
- WindowsRestructured ();
- CheckCursorConfinement(pWin);
-}
-
-/* Keeps the same inside(!) origin */
-
-void
-miChangeBorderWidth(WindowPtr pWin, unsigned int width)
-{
- int oldwidth;
- Bool anyMarked = FALSE;
- ScreenPtr pScreen;
- Bool WasViewable = (Bool)(pWin->viewable);
- Bool HadBorder;
- WindowPtr pLayerWin;
-
- oldwidth = wBorderWidth (pWin);
- if (oldwidth == width)
- return;
- HadBorder = HasBorder(pWin);
- pScreen = pWin->drawable.pScreen;
- if (WasViewable && width < oldwidth)
- anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin);
-
- pWin->borderWidth = width;
- SetBorderSize (pWin);
-
- if (WasViewable)
- {
- if (width > oldwidth)
- {
- anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin,
- &pLayerWin);
- /*
- * save the old border visible region to correctly compute
- * borderExposed.
- */
- if (pWin->valdata && HadBorder)
- {
- RegionPtr borderVisible;
- borderVisible = RegionCreate(NULL, 1);
- RegionSubtract(borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- }
- }
-
- if (anyMarked)
- {
- (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTOther);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin,
- VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
-}
-
-void
-miMarkUnrealizedWindow(WindowPtr pChild, WindowPtr pWin, Bool fromConfigure)
-{
- if ((pChild != pWin) || fromConfigure)
- {
- RegionEmpty(&pChild->clipList);
- if (pChild->drawable.pScreen->ClipNotify)
- (* pChild->drawable.pScreen->ClipNotify)(pChild, 0, 0);
- RegionEmpty(&pChild->borderClip);
- }
-}
-
-void
-miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
-{
- WindowPtr pChild;
-
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- if (pChild->drawable.depth == depth)
- RegionUnion(pReg, pReg, &pChild->borderClip);
-
- if (pChild->firstChild)
- miSegregateChildren(pChild, pReg, depth);
- }
-}
+
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/extensions/shapeconst.h>
+#include "regionstr.h"
+#include "region.h"
+#include "mi.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "mivalidate.h"
+
+void
+miClearToBackground(WindowPtr pWin,
+ int x, int y, int w, int h, Bool generateExposures)
+{
+ BoxRec box;
+ RegionRec reg;
+ BoxPtr extents;
+ int x1, y1, x2, y2;
+
+ /* compute everything using ints to avoid overflow */
+
+ x1 = pWin->drawable.x + x;
+ y1 = pWin->drawable.y + y;
+ if (w)
+ x2 = x1 + (int) w;
+ else
+ x2 = x1 + (int) pWin->drawable.width - (int) x;
+ if (h)
+ y2 = y1 + h;
+ else
+ y2 = y1 + (int) pWin->drawable.height - (int) y;
+
+ extents = &pWin->clipList.extents;
+
+ /* clip the resulting rectangle to the window clipList extents. This
+ * makes sure that the result will fit in a box, given that the
+ * screen is < 32768 on a side.
+ */
+
+ if (x1 < extents->x1)
+ x1 = extents->x1;
+ if (x2 > extents->x2)
+ x2 = extents->x2;
+ if (y1 < extents->y1)
+ y1 = extents->y1;
+ if (y2 > extents->y2)
+ y2 = extents->y2;
+
+ if (x2 <= x1 || y2 <= y1) {
+ x2 = x1 = 0;
+ y2 = y1 = 0;
+ }
+
+ box.x1 = x1;
+ box.x2 = x2;
+ box.y1 = y1;
+ box.y2 = y2;
+
+ RegionInit(&reg, &box, 1);
+
+ RegionIntersect(&reg, &reg, &pWin->clipList);
+ if (generateExposures)
+ (*pWin->drawable.pScreen->WindowExposures) (pWin, &reg, NULL);
+ else if (pWin->backgroundState != None)
+ miPaintWindow(pWin, &reg, PW_BACKGROUND);
+ RegionUninit(&reg);
+}
+
+void
+miMarkWindow(WindowPtr pWin)
+{
+ ValidatePtr val;
+
+ if (pWin->valdata)
+ return;
+ val = (ValidatePtr) xnfalloc(sizeof(ValidateRec));
+ val->before.oldAbsCorner.x = pWin->drawable.x;
+ val->before.oldAbsCorner.y = pWin->drawable.y;
+ val->before.borderVisible = NullRegion;
+ val->before.resized = FALSE;
+ pWin->valdata = val;
+}
+
+Bool
+miMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, WindowPtr *ppLayerWin)
+{
+ BoxPtr box;
+ WindowPtr pChild, pLast;
+ Bool anyMarked = FALSE;
+ MarkWindowProcPtr MarkWindow = pWin->drawable.pScreen->MarkWindow;
+
+ /* single layered systems are easy */
+ if (ppLayerWin)
+ *ppLayerWin = pWin;
+
+ if (pWin == pFirst) {
+ /* Blindly mark pWin and all of its inferiors. This is a slight
+ * overkill if there are mapped windows that outside pWin's border,
+ * but it's better than wasting time on RectIn checks.
+ */
+ pChild = pWin;
+ while (1) {
+ if (pChild->viewable) {
+ if (RegionBroken(&pChild->winSize))
+ SetWinSize(pChild);
+ if (RegionBroken(&pChild->borderSize))
+ SetBorderSize(pChild);
+ (*MarkWindow) (pChild);
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ break;
+ pChild = pChild->nextSib;
+ }
+ anyMarked = TRUE;
+ pFirst = pFirst->nextSib;
+ }
+ if ((pChild = pFirst)) {
+ box = RegionExtents(&pWin->borderSize);
+ pLast = pChild->parent->lastChild;
+ while (1) {
+ if (pChild->viewable) {
+ if (RegionBroken(&pChild->winSize))
+ SetWinSize(pChild);
+ if (RegionBroken(&pChild->borderSize))
+ SetBorderSize(pChild);
+ if (RegionContainsRect(&pChild->borderSize, box)) {
+ (*MarkWindow) (pChild);
+ anyMarked = TRUE;
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ }
+ while (!pChild->nextSib && (pChild != pLast))
+ pChild = pChild->parent;
+ if (pChild == pLast)
+ break;
+ pChild = pChild->nextSib;
+ }
+ }
+ if (anyMarked)
+ (*MarkWindow) (pWin->parent);
+ return anyMarked;
+}
+
+/*****
+ * miHandleValidateExposures(pWin)
+ * starting at pWin, draw background in any windows that have exposure
+ * regions, translate the regions, restore any backing store,
+ * and then send any regions still exposed to the client
+ *****/
+void
+miHandleValidateExposures(WindowPtr pWin)
+{
+ WindowPtr pChild;
+ ValidatePtr val;
+ WindowExposuresProcPtr WindowExposures;
+
+ pChild = pWin;
+ WindowExposures = pChild->drawable.pScreen->WindowExposures;
+ while (1) {
+ if ( (val = pChild->valdata) && val!=UnmapValData) {
+ if (RegionNotEmpty(&val->after.borderExposed))
+ miPaintWindow(pChild, &val->after.borderExposed, PW_BORDER);
+ RegionUninit(&val->after.borderExposed);
+ (*WindowExposures) (pChild, &val->after.exposed, NullRegion);
+ RegionUninit(&val->after.exposed);
+ free(val);
+ pChild->valdata = NULL;
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ break;
+ pChild = pChild->nextSib;
+ }
+}
+
+void
+miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)
+{
+ WindowPtr pParent;
+ Bool WasViewable = (Bool) (pWin->viewable);
+ short bw;
+ RegionPtr oldRegion = NULL;
+ DDXPointRec oldpt;
+ Bool anyMarked = FALSE;
+ ScreenPtr pScreen;
+ WindowPtr windowToValidate;
+ WindowPtr pLayerWin;
+
+ /* if this is a root window, can't be moved */
+ if (!(pParent = pWin->parent))
+ return;
+ pScreen = pWin->drawable.pScreen;
+ bw = wBorderWidth(pWin);
+
+ oldpt.x = pWin->drawable.x;
+ oldpt.y = pWin->drawable.y;
+ if (WasViewable) {
+ oldRegion = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion, &pWin->borderClip);
+ anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin);
+ }
+ pWin->origin.x = x + (int) bw;
+ pWin->origin.y = y + (int) bw;
+ x = pWin->drawable.x = pParent->drawable.x + x + (int) bw;
+ y = pWin->drawable.y = pParent->drawable.y + y + (int) bw;
+
+ SetWinSize(pWin);
+ SetBorderSize(pWin);
+
+ (*pScreen->PositionWindow) (pWin, x, y);
+
+ windowToValidate = MoveWindowInStack(pWin, pNextSib);
+
+ ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0);
+
+ if (WasViewable) {
+ if (pLayerWin == pWin)
+ anyMarked |= (*pScreen->MarkOverlappedWindows)
+ (pWin, windowToValidate, NULL);
+ else
+ anyMarked |= (*pScreen->MarkOverlappedWindows)
+ (pWin, pLayerWin, NULL);
+
+ if (anyMarked) {
+ (*pScreen->ValidateTree) (pLayerWin->parent, NullWindow, kind);
+ (*pWin->drawable.pScreen->CopyWindow) (pWin, oldpt, oldRegion);
+ RegionDestroy(oldRegion);
+ /* XXX need to retile border if ParentRelative origin */
+ (*pScreen->HandleExposures) (pLayerWin->parent);
+ }
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pLayerWin->parent, NullWindow, kind);
+ }
+ if (pWin->realized)
+ WindowsRestructured();
+}
+
+/*
+ * pValid is a region of the screen which has been
+ * successfully copied -- recomputed exposed regions for affected windows
+ */
+
+static int
+miRecomputeExposures(WindowPtr pWin, pointer value)
+{ /* must conform to VisitWindowProcPtr */
+ RegionPtr pValid = (RegionPtr) value;
+
+ if (pWin->valdata) {
+#ifdef COMPOSITE
+ /*
+ * Redirected windows are not affected by parent window
+ * gravity manipulations, so don't recompute their
+ * exposed areas here.
+ */
+ if (pWin->redirectDraw != RedirectDrawNone)
+ return WT_DONTWALKCHILDREN;
+#endif
+ /*
+ * compute exposed regions of this window
+ */
+ RegionSubtract(&pWin->valdata->after.exposed, &pWin->clipList, pValid);
+ /*
+ * compute exposed regions of the border
+ */
+ RegionSubtract(&pWin->valdata->after.borderExposed,
+ &pWin->borderClip, &pWin->winSize);
+ RegionSubtract(&pWin->valdata->after.borderExposed,
+ &pWin->valdata->after.borderExposed, pValid);
+ return WT_WALKCHILDREN;
+ }
+ return WT_NOMATCH;
+}
+
+void
+miSlideAndSizeWindow(WindowPtr pWin,
+ int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib)
+{
+ WindowPtr pParent;
+ Bool WasViewable = (Bool) (pWin->viewable);
+ unsigned short width = pWin->drawable.width, height = pWin->drawable.height;
+ short oldx = pWin->drawable.x, oldy = pWin->drawable.y;
+ int bw = wBorderWidth(pWin);
+ short dw, dh;
+ DDXPointRec oldpt;
+ RegionPtr oldRegion = NULL;
+ Bool anyMarked = FALSE;
+ ScreenPtr pScreen;
+ WindowPtr pFirstChange;
+ WindowPtr pChild;
+ RegionPtr gravitate[StaticGravity + 1];
+ unsigned g;
+ int nx, ny; /* destination x,y */
+ int newx, newy; /* new inner window position */
+ RegionPtr pRegion = NULL;
+ RegionPtr destClip; /* portions of destination already written */
+ RegionPtr oldWinClip = NULL; /* old clip list for window */
+ RegionPtr borderVisible = NullRegion; /* visible area of the border */
+ Bool shrunk = FALSE; /* shrunk in an inner dimension */
+ Bool moved = FALSE; /* window position changed */
+ WindowPtr pLayerWin;
+
+ /* if this is a root window, can't be resized */
+ if (!(pParent = pWin->parent))
+ return;
+
+ pScreen = pWin->drawable.pScreen;
+ newx = pParent->drawable.x + x + bw;
+ newy = pParent->drawable.y + y + bw;
+ if (WasViewable) {
+ anyMarked = FALSE;
+ /*
+ * save the visible region of the window
+ */
+ oldRegion = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion, &pWin->winSize);
+
+ /*
+ * categorize child windows into regions to be moved
+ */
+ for (g = 0; g <= StaticGravity; g++)
+ gravitate[g] = (RegionPtr) NULL;
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
+ g = pChild->winGravity;
+ if (g != UnmapGravity) {
+ if (!gravitate[g])
+ gravitate[g] = RegionCreate(NullBox, 1);
+ RegionUnion(gravitate[g], gravitate[g], &pChild->borderClip);
+ }
+ else {
+ UnmapWindow(pChild, TRUE);
+ anyMarked = TRUE;
+ }
+ }
+ anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin);
+
+ oldWinClip = NULL;
+ if (pWin->bitGravity != ForgetGravity) {
+ oldWinClip = RegionCreate(NullBox, 1);
+ RegionCopy(oldWinClip, &pWin->clipList);
+ }
+ /*
+ * if the window is changing size, borderExposed
+ * can't be computed correctly without some help.
+ */
+ if (pWin->drawable.height > h || pWin->drawable.width > w)
+ shrunk = TRUE;
+
+ if (newx != oldx || newy != oldy)
+ moved = TRUE;
+
+ if ((pWin->drawable.height != h || pWin->drawable.width != w) &&
+ HasBorder(pWin)) {
+ borderVisible = RegionCreate(NullBox, 1);
+ /* for tiled borders, we punt and draw the whole thing */
+ if (pWin->borderIsPixel || !moved) {
+ if (shrunk || moved)
+ RegionSubtract(borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ else
+ RegionCopy(borderVisible, &pWin->borderClip);
+ }
+ }
+ }
+ pWin->origin.x = x + bw;
+ pWin->origin.y = y + bw;
+ pWin->drawable.height = h;
+ pWin->drawable.width = w;
+
+ x = pWin->drawable.x = newx;
+ y = pWin->drawable.y = newy;
+
+ SetWinSize(pWin);
+ SetBorderSize(pWin);
+
+ dw = (int) w - (int) width;
+ dh = (int) h - (int) height;
+ ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh);
+
+ /* let the hardware adjust background and border pixmaps, if any */
+ (*pScreen->PositionWindow) (pWin, x, y);
+
+ pFirstChange = MoveWindowInStack(pWin, pSib);
+
+ if (WasViewable) {
+ pRegion = RegionCreate(NullBox, 1);
+
+ if (pLayerWin == pWin)
+ anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pFirstChange,
+ NULL);
+ else
+ anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pLayerWin,
+ NULL);
+
+ if (pWin->valdata) {
+ pWin->valdata->before.resized = TRUE;
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+
+ if (anyMarked)
+ (*pScreen->ValidateTree) (pLayerWin->parent, pFirstChange, VTOther);
+ /*
+ * the entire window is trashed unless bitGravity
+ * recovers portions of it
+ */
+ RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList);
+ }
+
+ GravityTranslate(x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny);
+
+ if (WasViewable) {
+ /* avoid the border */
+ if (HasBorder(pWin)) {
+ int offx, offy, dx, dy;
+
+ /* kruft to avoid double translates for each gravity */
+ offx = 0;
+ offy = 0;
+ for (g = 0; g <= StaticGravity; g++) {
+ if (!gravitate[g])
+ continue;
+
+ /* align winSize to gravitate[g].
+ * winSize is in new coordinates,
+ * gravitate[g] is still in old coordinates */
+ GravityTranslate(x, y, oldx, oldy, dw, dh, g, &nx, &ny);
+
+ dx = (oldx - nx) - offx;
+ dy = (oldy - ny) - offy;
+ if (dx || dy) {
+ RegionTranslate(&pWin->winSize, dx, dy);
+ offx += dx;
+ offy += dy;
+ }
+ RegionIntersect(gravitate[g], gravitate[g], &pWin->winSize);
+ }
+ /* get winSize back where it belongs */
+ if (offx || offy)
+ RegionTranslate(&pWin->winSize, -offx, -offy);
+ }
+ /*
+ * add screen bits to the appropriate bucket
+ */
+
+ if (oldWinClip) {
+ /*
+ * clip to new clipList
+ */
+ RegionCopy(pRegion, oldWinClip);
+ RegionTranslate(pRegion, nx - oldx, ny - oldy);
+ RegionIntersect(oldWinClip, pRegion, &pWin->clipList);
+ /*
+ * don't step on any gravity bits which will be copied after this
+ * region. Note -- this assumes that the regions will be copied
+ * in gravity order.
+ */
+ for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) {
+ if (gravitate[g])
+ RegionSubtract(oldWinClip, oldWinClip, gravitate[g]);
+ }
+ RegionTranslate(oldWinClip, oldx - nx, oldy - ny);
+ g = pWin->bitGravity;
+ if (!gravitate[g])
+ gravitate[g] = oldWinClip;
+ else {
+ RegionUnion(gravitate[g], gravitate[g], oldWinClip);
+ RegionDestroy(oldWinClip);
+ }
+ }
+
+ /*
+ * move the bits on the screen
+ */
+
+ destClip = NULL;
+
+ for (g = 0; g <= StaticGravity; g++) {
+ if (!gravitate[g])
+ continue;
+
+ GravityTranslate(x, y, oldx, oldy, dw, dh, g, &nx, &ny);
+
+ oldpt.x = oldx + (x - nx);
+ oldpt.y = oldy + (y - ny);
+
+ /* Note that gravitate[g] is *translated* by CopyWindow */
+
+ /* only copy the remaining useful bits */
+
+ RegionIntersect(gravitate[g], gravitate[g], oldRegion);
+
+ /* clip to not overwrite already copied areas */
+
+ if (destClip) {
+ RegionTranslate(destClip, oldpt.x - x, oldpt.y - y);
+ RegionSubtract(gravitate[g], gravitate[g], destClip);
+ RegionTranslate(destClip, x - oldpt.x, y - oldpt.y);
+ }
+
+ /* and move those bits */
+
+ if (oldpt.x != x || oldpt.y != y
+#ifdef COMPOSITE
+ || pWin->redirectDraw
+#endif
+ ) {
+ (*pWin->drawable.pScreen->CopyWindow) (pWin, oldpt,
+ gravitate[g]);
+ }
+
+ /* remove any overwritten bits from the remaining useful bits */
+
+ RegionSubtract(oldRegion, oldRegion, gravitate[g]);
+
+ /*
+ * recompute exposed regions of child windows
+ */
+
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
+ if (pChild->winGravity != g)
+ continue;
+ RegionIntersect(pRegion, &pChild->borderClip, gravitate[g]);
+ TraverseTree(pChild, miRecomputeExposures, (pointer) pRegion);
+ }
+
+ /*
+ * remove the successfully copied regions of the
+ * window from its exposed region
+ */
+
+ if (g == pWin->bitGravity)
+ RegionSubtract(&pWin->valdata->after.exposed,
+ &pWin->valdata->after.exposed, gravitate[g]);
+ if (!destClip)
+ destClip = gravitate[g];
+ else {
+ RegionUnion(destClip, destClip, gravitate[g]);
+ RegionDestroy(gravitate[g]);
+ }
+ }
+
+ RegionDestroy(oldRegion);
+ RegionDestroy(pRegion);
+ if (destClip)
+ RegionDestroy(destClip);
+ if (anyMarked)
+ (*pScreen->HandleExposures) (pLayerWin->parent);
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pLayerWin->parent, pFirstChange,
+ VTOther);
+ }
+ if (pWin->realized)
+ WindowsRestructured();
+}
+
+WindowPtr
+miGetLayerWindow(WindowPtr pWin)
+{
+ return pWin->firstChild;
+}
+
+/******
+ *
+ * miSetShape
+ * The border/window shape has changed. Recompute winSize/borderSize
+ * and send appropriate exposure events
+ */
+
+void
+miSetShape(WindowPtr pWin, int kind)
+{
+ Bool WasViewable = (Bool) (pWin->viewable);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool anyMarked = FALSE;
+ WindowPtr pLayerWin;
+
+ if (kind != ShapeInput) {
+ if (WasViewable) {
+ anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pWin,
+ &pLayerWin);
+ if (pWin->valdata) {
+ if (HasBorder(pWin)) {
+ RegionPtr borderVisible;
+
+ borderVisible = RegionCreate(NullBox, 1);
+ RegionSubtract(borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ pWin->valdata->before.resized = TRUE;
+ }
+ }
+
+ SetWinSize(pWin);
+ SetBorderSize(pWin);
+
+ ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
+
+ if (WasViewable) {
+ anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pWin, NULL);
+
+ if (anyMarked)
+ (*pScreen->ValidateTree) (pLayerWin->parent, NullWindow,
+ VTOther);
+ }
+
+ if (WasViewable) {
+ if (anyMarked)
+ (*pScreen->HandleExposures) (pLayerWin->parent);
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pLayerWin->parent, NullWindow,
+ VTOther);
+ }
+ }
+ if (pWin->realized)
+ WindowsRestructured();
+ CheckCursorConfinement(pWin);
+}
+
+/* Keeps the same inside(!) origin */
+
+void
+miChangeBorderWidth(WindowPtr pWin, unsigned int width)
+{
+ int oldwidth;
+ Bool anyMarked = FALSE;
+ ScreenPtr pScreen;
+ Bool WasViewable = (Bool) (pWin->viewable);
+ Bool HadBorder;
+ WindowPtr pLayerWin;
+
+ oldwidth = wBorderWidth(pWin);
+ if (oldwidth == width)
+ return;
+ HadBorder = HasBorder(pWin);
+ pScreen = pWin->drawable.pScreen;
+ if (WasViewable && width < oldwidth)
+ anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin);
+
+ pWin->borderWidth = width;
+ SetBorderSize(pWin);
+
+ if (WasViewable) {
+ if (width > oldwidth) {
+ anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pWin,
+ &pLayerWin);
+ /*
+ * save the old border visible region to correctly compute
+ * borderExposed.
+ */
+ if (pWin->valdata && HadBorder) {
+ RegionPtr borderVisible;
+
+ borderVisible = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ }
+
+ if (anyMarked) {
+ (*pScreen->ValidateTree) (pLayerWin->parent, pLayerWin, VTOther);
+ (*pScreen->HandleExposures) (pLayerWin->parent);
+ }
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pLayerWin->parent, pLayerWin,
+ VTOther);
+ }
+ if (pWin->realized)
+ WindowsRestructured();
+}
+
+void
+miMarkUnrealizedWindow(WindowPtr pChild, WindowPtr pWin, Bool fromConfigure)
+{
+ if ((pChild != pWin) || fromConfigure) {
+ RegionEmpty(&pChild->clipList);
+ if (pChild->drawable.pScreen->ClipNotify)
+ (*pChild->drawable.pScreen->ClipNotify) (pChild, 0, 0);
+ RegionEmpty(&pChild->borderClip);
+ }
+}
+
+void
+miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
+{
+ WindowPtr pChild;
+
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
+ if (pChild->drawable.depth == depth)
+ RegionUnion(pReg, pReg, &pChild->borderClip);
+
+ if (pChild->firstChild)
+ miSegregateChildren(pChild, pReg, depth);
+ }
+}
diff --git a/xorg-server/mi/mizerarc.c b/xorg-server/mi/mizerarc.c
index 713d0bd04..9dac180d1 100644
--- a/xorg-server/mi/mizerarc.c
+++ b/xorg-server/mi/mizerarc.c
@@ -1,848 +1,767 @@
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Author: Bob Scheifler, MIT X Consortium
-
-********************************************************/
-
-
-/* Derived from:
- * "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
- * by M. L. V. Pitteway
- * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <math.h>
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "mi.h"
-#include "mizerarc.h"
-
-#define FULLCIRCLE (360 * 64)
-#define OCTANT (45 * 64)
-#define QUADRANT (90 * 64)
-#define HALFCIRCLE (180 * 64)
-#define QUADRANT3 (270 * 64)
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define Dsin(d) ((d) == 0 ? 0.0 : ((d) == QUADRANT ? 1.0 : \
- ((d) == HALFCIRCLE ? 0.0 : \
- ((d) == QUADRANT3 ? -1.0 : sin((double)d*(M_PI/11520.0))))))
-
-#define Dcos(d) ((d) == 0 ? 1.0 : ((d) == QUADRANT ? 0.0 : \
- ((d) == HALFCIRCLE ? -1.0 : \
- ((d) == QUADRANT3 ? 0.0 : cos((double)d*(M_PI/11520.0))))))
-
-#define EPSILON45 64
-
-typedef struct {
- int skipStart;
- int haveStart;
- DDXPointRec startPt;
- int haveLast;
- int skipLast;
- DDXPointRec endPt;
- int dashIndex;
- int dashOffset;
- int dashIndexInit;
- int dashOffsetInit;
-} DashInfo;
-
-static miZeroArcPtRec oob = {65536, 65536, 0};
-
-/*
- * (x - l)^2 / (W/2)^2 + (y + H/2)^2 / (H/2)^2 = 1
- *
- * where l is either 0 or .5
- *
- * alpha = 4(W^2)
- * beta = 4(H^2)
- * gamma = 0
- * u = 2(W^2)H
- * v = 4(H^2)l
- * k = -4(H^2)(l^2)
- *
- */
-
-Bool
-miZeroArcSetup(xArc *arc, miZeroArcRec *info, Bool ok360)
-{
- int l;
- int angle1, angle2;
- int startseg, endseg;
- int startAngle, endAngle;
- int i, overlap;
- miZeroArcPtRec start, end;
-
- l = arc->width & 1;
- if (arc->width == arc->height)
- {
- info->alpha = 4;
- info->beta = 4;
- info->k1 = -8;
- info->k3 = -16;
- info->b = 12;
- info->a = (arc->width << 2) - 12;
- info->d = 17 - (arc->width << 1);
- if (l)
- {
- info->b -= 4;
- info->a += 4;
- info->d -= 7;
- }
- }
- else if (!arc->width || !arc->height)
- {
- info->alpha = 0;
- info->beta = 0;
- info->k1 = 0;
- info->k3 = 0;
- info->a = -(int)arc->height;
- info->b = 0;
- info->d = -1;
- }
- else
- {
- /* initial conditions */
- info->alpha = (arc->width * arc->width) << 2;
- info->beta = (arc->height * arc->height) << 2;
- info->k1 = info->beta << 1;
- info->k3 = info->k1 + (info->alpha << 1);
- info->b = l ? 0 : -info->beta;
- info->a = info->alpha * arc->height;
- info->d = info->b - (info->a >> 1) - (info->alpha >> 2);
- if (l)
- info->d -= info->beta >> 2;
- info->a -= info->b;
- /* take first step, d < 0 always */
- info->b -= info->k1;
- info->a += info->k1;
- info->d += info->b;
- /* octant change, b < 0 always */
- info->k1 = -info->k1;
- info->k3 = -info->k3;
- info->b = -info->b;
- info->d = info->b - info->a - info->d;
- info->a = info->a - (info->b << 1);
- }
- info->dx = 1;
- info->dy = 0;
- info->w = (arc->width + 1) >> 1;
- info->h = arc->height >> 1;
- info->xorg = arc->x + (arc->width >> 1);
- info->yorg = arc->y;
- info->xorgo = info->xorg + l;
- info->yorgo = info->yorg + arc->height;
- if (!arc->width)
- {
- if (!arc->height)
- {
- info->x = 0;
- info->y = 0;
- info->initialMask = 0;
- info->startAngle = 0;
- info->endAngle = 0;
- info->start = oob;
- info->end = oob;
- return FALSE;
- }
- info->x = 0;
- info->y = 1;
- }
- else
- {
- info->x = 1;
- info->y = 0;
- }
- angle1 = arc->angle1;
- angle2 = arc->angle2;
- if ((angle1 == 0) && (angle2 >= FULLCIRCLE))
- {
- startAngle = 0;
- endAngle = 0;
- }
- else
- {
- if (angle2 > FULLCIRCLE)
- angle2 = FULLCIRCLE;
- else if (angle2 < -FULLCIRCLE)
- angle2 = -FULLCIRCLE;
- if (angle2 < 0)
- {
- startAngle = angle1 + angle2;
- endAngle = angle1;
- }
- else
- {
- startAngle = angle1;
- endAngle = angle1 + angle2;
- }
- if (startAngle < 0)
- startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE;
- if (startAngle >= FULLCIRCLE)
- startAngle = startAngle % FULLCIRCLE;
- if (endAngle < 0)
- endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE;
- if (endAngle >= FULLCIRCLE)
- endAngle = endAngle % FULLCIRCLE;
- }
- info->startAngle = startAngle;
- info->endAngle = endAngle;
- if (ok360 && (startAngle == endAngle) && arc->angle2 &&
- arc->width && arc->height)
- {
- info->initialMask = 0xf;
- info->start = oob;
- info->end = oob;
- return TRUE;
- }
- startseg = startAngle / OCTANT;
- if (!arc->height || (((startseg + 1) & 2) && arc->width))
- {
- start.x = Dcos(startAngle) * ((arc->width + 1) / 2.0);
- if (start.x < 0)
- start.x = -start.x;
- start.y = -1;
- }
- else
- {
- start.y = Dsin(startAngle) * (arc->height / 2.0);
- if (start.y < 0)
- start.y = -start.y;
- start.y = info->h - start.y;
- start.x = 65536;
- }
- endseg = endAngle / OCTANT;
- if (!arc->height || (((endseg + 1) & 2) && arc->width))
- {
- end.x = Dcos(endAngle) * ((arc->width + 1) / 2.0);
- if (end.x < 0)
- end.x = -end.x;
- end.y = -1;
- }
- else
- {
- end.y = Dsin(endAngle) * (arc->height / 2.0);
- if (end.y < 0)
- end.y = -end.y;
- end.y = info->h - end.y;
- end.x = 65536;
- }
- info->firstx = start.x;
- info->firsty = start.y;
- info->initialMask = 0;
- overlap = arc->angle2 && (endAngle <= startAngle);
- for (i = 0; i < 4; i++)
- {
- if (overlap ?
- ((i * QUADRANT <= endAngle) || ((i + 1) * QUADRANT > startAngle)) :
- ((i * QUADRANT <= endAngle) && ((i + 1) * QUADRANT > startAngle)))
- info->initialMask |= (1 << i);
- }
- start.mask = info->initialMask;
- end.mask = info->initialMask;
- startseg >>= 1;
- endseg >>= 1;
- overlap = overlap && (endseg == startseg);
- if (start.x != end.x || start.y != end.y || !overlap)
- {
- if (startseg & 1)
- {
- if (!overlap)
- info->initialMask &= ~(1 << startseg);
- if (start.x > end.x || start.y > end.y)
- end.mask &= ~(1 << startseg);
- }
- else
- {
- start.mask &= ~(1 << startseg);
- if (((start.x < end.x || start.y < end.y) ||
- (start.x == end.x && start.y == end.y && (endseg & 1))) &&
- !overlap)
- end.mask &= ~(1 << startseg);
- }
- if (endseg & 1)
- {
- end.mask &= ~(1 << endseg);
- if (((start.x > end.x || start.y > end.y) ||
- (start.x == end.x && start.y == end.y && !(startseg & 1))) &&
- !overlap)
- start.mask &= ~(1 << endseg);
- }
- else
- {
- if (!overlap)
- info->initialMask &= ~(1 << endseg);
- if (start.x < end.x || start.y < end.y)
- start.mask &= ~(1 << endseg);
- }
- }
- /* take care of case when start and stop are both near 45 */
- /* handle here rather than adding extra code to pixelization loops */
- if (startAngle &&
- ((start.y < 0 && end.y >= 0) || (start.y >= 0 && end.y < 0)))
- {
- i = (startAngle + OCTANT) % OCTANT;
- if (i < EPSILON45 || i > OCTANT - EPSILON45)
- {
- i = (endAngle + OCTANT) % OCTANT;
- if (i < EPSILON45 || i > OCTANT - EPSILON45)
- {
- if (start.y < 0)
- {
- i = Dsin(startAngle) * (arc->height / 2.0);
- if (i < 0)
- i = -i;
- if (info->h - i == end.y)
- start.mask = end.mask;
- }
- else
- {
- i = Dsin(endAngle) * (arc->height / 2.0);
- if (i < 0)
- i = -i;
- if (info->h - i == start.y)
- end.mask = start.mask;
- }
- }
- }
- }
- if (startseg & 1)
- {
- info->start = start;
- info->end = oob;
- }
- else
- {
- info->end = start;
- info->start = oob;
- }
- if (endseg & 1)
- {
- info->altend = end;
- if (info->altend.x < info->end.x || info->altend.y < info->end.y)
- {
- miZeroArcPtRec tmp;
- tmp = info->altend;
- info->altend = info->end;
- info->end = tmp;
- }
- info->altstart = oob;
- }
- else
- {
- info->altstart = end;
- if (info->altstart.x < info->start.x ||
- info->altstart.y < info->start.y)
- {
- miZeroArcPtRec tmp;
- tmp = info->altstart;
- info->altstart = info->start;
- info->start = tmp;
- }
- info->altend = oob;
- }
- if (!info->start.x || !info->start.y)
- {
- info->initialMask = info->start.mask;
- info->start = info->altstart;
- }
- if (!arc->width && (arc->height == 1))
- {
- /* kludge! */
- info->initialMask |= info->end.mask;
- info->initialMask |= info->initialMask << 1;
- info->end.x = 0;
- info->end.mask = 0;
- }
- return FALSE;
-}
-
-#define Pixelate(xval,yval) \
- { \
- pts->x = xval; \
- pts->y = yval; \
- pts++; \
- }
-
-#define DoPix(idx,xval,yval) if (mask & (1 << idx)) Pixelate(xval, yval);
-
-static DDXPointPtr
-miZeroArcPts(xArc *arc, DDXPointPtr pts)
-{
- miZeroArcRec info;
- int x, y, a, b, d, mask;
- int k1, k3, dx, dy;
- Bool do360;
-
- do360 = miZeroArcSetup(arc, &info, TRUE);
- MIARCSETUP();
- mask = info.initialMask;
- if (!(arc->width & 1))
- {
- DoPix(1, info.xorgo, info.yorg);
- DoPix(3, info.xorgo, info.yorgo);
- }
- if (!info.end.x || !info.end.y)
- {
- mask = info.end.mask;
- info.end = info.altend;
- }
- if (do360 && (arc->width == arc->height) && !(arc->width & 1))
- {
- int yorgh = info.yorg + info.h;
- int xorghp = info.xorg + info.h;
- int xorghn = info.xorg - info.h;
-
- while (1)
- {
- Pixelate(info.xorg + x, info.yorg + y);
- Pixelate(info.xorg - x, info.yorg + y);
- Pixelate(info.xorg - x, info.yorgo - y);
- Pixelate(info.xorg + x, info.yorgo - y);
- if (a < 0)
- break;
- Pixelate(xorghp - y, yorgh - x);
- Pixelate(xorghn + y, yorgh - x);
- Pixelate(xorghn + y, yorgh + x);
- Pixelate(xorghp - y, yorgh + x);
- MIARCCIRCLESTEP(;);
- }
- if (x > 1 && pts[-1].x == pts[-5].x && pts[-1].y == pts[-5].y)
- pts -= 4;
- x = info.w;
- y = info.h;
- }
- else if (do360)
- {
- while (y < info.h || x < info.w)
- {
- MIARCOCTANTSHIFT(;);
- Pixelate(info.xorg + x, info.yorg + y);
- Pixelate(info.xorgo - x, info.yorg + y);
- Pixelate(info.xorgo - x, info.yorgo - y);
- Pixelate(info.xorg + x, info.yorgo - y);
- MIARCSTEP(;,;);
- }
- }
- else
- {
- while (y < info.h || x < info.w)
- {
- MIARCOCTANTSHIFT(;);
- if ((x == info.start.x) || (y == info.start.y))
- {
- mask = info.start.mask;
- info.start = info.altstart;
- }
- DoPix(0, info.xorg + x, info.yorg + y);
- DoPix(1, info.xorgo - x, info.yorg + y);
- DoPix(2, info.xorgo - x, info.yorgo - y);
- DoPix(3, info.xorg + x, info.yorgo - y);
- if ((x == info.end.x) || (y == info.end.y))
- {
- mask = info.end.mask;
- info.end = info.altend;
- }
- MIARCSTEP(;,;);
- }
- }
- if ((x == info.start.x) || (y == info.start.y))
- mask = info.start.mask;
- DoPix(0, info.xorg + x, info.yorg + y);
- DoPix(2, info.xorgo - x, info.yorgo - y);
- if (arc->height & 1)
- {
- DoPix(1, info.xorgo - x, info.yorg + y);
- DoPix(3, info.xorg + x, info.yorgo - y);
- }
- return pts;
-}
-
-#undef DoPix
-#define DoPix(idx,xval,yval) \
- if (mask & (1 << idx)) \
- { \
- arcPts[idx]->x = xval; \
- arcPts[idx]->y = yval; \
- arcPts[idx]++; \
- }
-
-static void
-miZeroArcDashPts(
- GCPtr pGC,
- xArc *arc,
- DashInfo *dinfo,
- DDXPointPtr points,
- int maxPts,
- DDXPointPtr *evenPts,
- DDXPointPtr *oddPts )
-{
- miZeroArcRec info;
- int x, y, a, b, d, mask;
- int k1, k3, dx, dy;
- int dashRemaining;
- DDXPointPtr arcPts[4];
- DDXPointPtr startPts[5], endPts[5];
- int deltas[5];
- DDXPointPtr startPt, pt, lastPt, pts;
- int i, j, delta, ptsdelta, seg, startseg;
-
- for (i = 0; i < 4; i++)
- arcPts[i] = points + (i * maxPts);
- (void)miZeroArcSetup(arc, &info, FALSE);
- MIARCSETUP();
- mask = info.initialMask;
- startseg = info.startAngle / QUADRANT;
- startPt = arcPts[startseg];
- if (!(arc->width & 1))
- {
- DoPix(1, info.xorgo, info.yorg);
- DoPix(3, info.xorgo, info.yorgo);
- }
- if (!info.end.x || !info.end.y)
- {
- mask = info.end.mask;
- info.end = info.altend;
- }
- while (y < info.h || x < info.w)
- {
- MIARCOCTANTSHIFT(;);
- if ((x == info.firstx) || (y == info.firsty))
- startPt = arcPts[startseg];
- if ((x == info.start.x) || (y == info.start.y))
- {
- mask = info.start.mask;
- info.start = info.altstart;
- }
- DoPix(0, info.xorg + x, info.yorg + y);
- DoPix(1, info.xorgo - x, info.yorg + y);
- DoPix(2, info.xorgo - x, info.yorgo - y);
- DoPix(3, info.xorg + x, info.yorgo - y);
- if ((x == info.end.x) || (y == info.end.y))
- {
- mask = info.end.mask;
- info.end = info.altend;
- }
- MIARCSTEP(;,;);
- }
- if ((x == info.firstx) || (y == info.firsty))
- startPt = arcPts[startseg];
- if ((x == info.start.x) || (y == info.start.y))
- mask = info.start.mask;
- DoPix(0, info.xorg + x, info.yorg + y);
- DoPix(2, info.xorgo - x, info.yorgo - y);
- if (arc->height & 1)
- {
- DoPix(1, info.xorgo - x, info.yorg + y);
- DoPix(3, info.xorg + x, info.yorgo - y);
- }
- for (i = 0; i < 4; i++)
- {
- seg = (startseg + i) & 3;
- pt = points + (seg * maxPts);
- if (seg & 1)
- {
- startPts[i] = pt;
- endPts[i] = arcPts[seg];
- deltas[i] = 1;
- }
- else
- {
- startPts[i] = arcPts[seg] - 1;
- endPts[i] = pt - 1;
- deltas[i] = -1;
- }
- }
- startPts[4] = startPts[0];
- endPts[4] = startPt;
- startPts[0] = startPt;
- if (startseg & 1)
- {
- if (startPts[4] != endPts[4])
- endPts[4]--;
- deltas[4] = 1;
- }
- else
- {
- if (startPts[0] > startPts[4])
- startPts[0]--;
- if (startPts[4] < endPts[4])
- endPts[4]--;
- deltas[4] = -1;
- }
- if (arc->angle2 < 0)
- {
- DDXPointPtr tmps, tmpe;
- int tmpd;
-
- tmpd = deltas[0];
- tmps = startPts[0] - tmpd;
- tmpe = endPts[0] - tmpd;
- startPts[0] = endPts[4] - deltas[4];
- endPts[0] = startPts[4] - deltas[4];
- deltas[0] = -deltas[4];
- startPts[4] = tmpe;
- endPts[4] = tmps;
- deltas[4] = -tmpd;
- tmpd = deltas[1];
- tmps = startPts[1] - tmpd;
- tmpe = endPts[1] - tmpd;
- startPts[1] = endPts[3] - deltas[3];
- endPts[1] = startPts[3] - deltas[3];
- deltas[1] = -deltas[3];
- startPts[3] = tmpe;
- endPts[3] = tmps;
- deltas[3] = -tmpd;
- tmps = startPts[2] - deltas[2];
- startPts[2] = endPts[2] - deltas[2];
- endPts[2] = tmps;
- deltas[2] = -deltas[2];
- }
- for (i = 0; i < 5 && startPts[i] == endPts[i]; i++)
- ;
- if (i == 5)
- return;
- pt = startPts[i];
- for (j = 4; startPts[j] == endPts[j]; j--)
- ;
- lastPt = endPts[j] - deltas[j];
- if (dinfo->haveLast &&
- (pt->x == dinfo->endPt.x) && (pt->y == dinfo->endPt.y))
- {
- startPts[i] += deltas[i];
- }
- else
- {
- dinfo->dashIndex = dinfo->dashIndexInit;
- dinfo->dashOffset = dinfo->dashOffsetInit;
- }
- if (!dinfo->skipStart && (info.startAngle != info.endAngle))
- {
- dinfo->startPt = *pt;
- dinfo->haveStart = TRUE;
- }
- else if (!dinfo->skipLast && dinfo->haveStart &&
- (lastPt->x == dinfo->startPt.x) &&
- (lastPt->y == dinfo->startPt.y) &&
- (lastPt != startPts[i]))
- endPts[j] = lastPt;
- if (info.startAngle != info.endAngle)
- {
- dinfo->haveLast = TRUE;
- dinfo->endPt = *lastPt;
- }
- dashRemaining = pGC->dash[dinfo->dashIndex] - dinfo->dashOffset;
- for (i = 0; i < 5; i++)
- {
- pt = startPts[i];
- lastPt = endPts[i];
- delta = deltas[i];
- while (pt != lastPt)
- {
- if (dinfo->dashIndex & 1)
- {
- pts = *oddPts;
- ptsdelta = -1;
- }
- else
- {
- pts = *evenPts;
- ptsdelta = 1;
- }
- while ((pt != lastPt) && --dashRemaining >= 0)
- {
- *pts = *pt;
- pts += ptsdelta;
- pt += delta;
- }
- if (dinfo->dashIndex & 1)
- *oddPts = pts;
- else
- *evenPts = pts;
- if (dashRemaining <= 0)
- {
- if (++(dinfo->dashIndex) == pGC->numInDashList)
- dinfo->dashIndex = 0;
- dashRemaining = pGC->dash[dinfo->dashIndex];
- }
- }
- }
- dinfo->dashOffset = pGC->dash[dinfo->dashIndex] - dashRemaining;
-}
-
-void
-miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
-{
- int maxPts = 0;
- int n, maxw = 0;
- xArc *arc;
- int i;
- DDXPointPtr points, pts, oddPts = NULL;
- DDXPointPtr pt;
- int numPts;
- Bool dospans;
- int *widths = NULL;
- XID fgPixel = pGC->fgPixel;
- DashInfo dinfo;
-
- for (arc = parcs, i = narcs; --i >= 0; arc++)
- {
- if (!miCanZeroArc(arc))
- miPolyArc(pDraw, pGC, 1, arc);
- else
- {
- if (arc->width > arc->height)
- n = arc->width + (arc->height >> 1);
- else
- n = arc->height + (arc->width >> 1);
- if (n > maxPts)
- maxPts = n;
- }
- }
- if (!maxPts)
- return;
- numPts = maxPts << 2;
- dospans = (pGC->fillStyle != FillSolid);
- if (dospans)
- {
- widths = malloc(sizeof(int) * numPts);
- if (!widths)
- return;
- maxw = 0;
- }
- if (pGC->lineStyle != LineSolid)
- {
- numPts <<= 1;
- dinfo.haveStart = FALSE;
- dinfo.skipStart = FALSE;
- dinfo.haveLast = FALSE;
- dinfo.dashIndexInit = 0;
- dinfo.dashOffsetInit = 0;
- miStepDash((int)pGC->dashOffset, &dinfo.dashIndexInit,
- (unsigned char *) pGC->dash, (int)pGC->numInDashList,
- &dinfo.dashOffsetInit);
- }
- points = malloc(sizeof(DDXPointRec) * numPts);
- if (!points)
- {
- if (dospans)
- {
- free(widths);
- }
- return;
- }
- for (arc = parcs, i = narcs; --i >= 0; arc++)
- {
- if (miCanZeroArc(arc))
- {
- if (pGC->lineStyle == LineSolid)
- pts = miZeroArcPts(arc, points);
- else
- {
- pts = points;
- oddPts = &points[(numPts >> 1) - 1];
- dinfo.skipLast = i;
- miZeroArcDashPts(pGC, arc, &dinfo,
- oddPts + 1, maxPts, &pts, &oddPts);
- dinfo.skipStart = TRUE;
- }
- n = pts - points;
- if (!dospans)
- (*pGC->ops->PolyPoint)(pDraw, pGC, CoordModeOrigin, n, points);
- else
- {
- if (n > maxw)
- {
- while (maxw < n)
- widths[maxw++] = 1;
- }
- if (pGC->miTranslate)
- {
- for (pt = points; pt != pts; pt++)
- {
- pt->x += pDraw->x;
- pt->y += pDraw->y;
- }
- }
- (*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, FALSE);
- }
- if (pGC->lineStyle != LineDoubleDash)
- continue;
- if ((pGC->fillStyle == FillSolid) ||
- (pGC->fillStyle == FillStippled))
- {
- ChangeGCVal gcval;
- gcval.val = pGC->bgPixel;
- ChangeGC(NullClient, pGC, GCForeground, &gcval);
- ValidateGC(pDraw, pGC);
- }
- pts = &points[numPts >> 1];
- oddPts++;
- n = pts - oddPts;
- if (!dospans)
- (*pGC->ops->PolyPoint)(pDraw, pGC, CoordModeOrigin, n, oddPts);
- else
- {
- if (n > maxw)
- {
- while (maxw < n)
- widths[maxw++] = 1;
- }
- if (pGC->miTranslate)
- {
- for (pt = oddPts; pt != pts; pt++)
- {
- pt->x += pDraw->x;
- pt->y += pDraw->y;
- }
- }
- (*pGC->ops->FillSpans)(pDraw, pGC, n, oddPts, widths, FALSE);
- }
- if ((pGC->fillStyle == FillSolid) ||
- (pGC->fillStyle == FillStippled))
- {
- ChangeGCVal gcval;
- gcval.val = fgPixel;
- ChangeGC(NullClient, pGC, GCForeground, &gcval);
- ValidateGC(pDraw, pGC);
- }
- }
- }
- free(points);
- if (dospans)
- {
- free(widths);
- }
-}
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Bob Scheifler, MIT X Consortium
+
+********************************************************/
+
+/* Derived from:
+ * "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
+ * by M. L. V. Pitteway
+ * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <math.h>
+#include <X11/X.h>
+#include <X11/Xprotostr.h>
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "mi.h"
+#include "mizerarc.h"
+
+#define FULLCIRCLE (360 * 64)
+#define OCTANT (45 * 64)
+#define QUADRANT (90 * 64)
+#define HALFCIRCLE (180 * 64)
+#define QUADRANT3 (270 * 64)
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#define Dsin(d) ((d) == 0 ? 0.0 : ((d) == QUADRANT ? 1.0 : \
+ ((d) == HALFCIRCLE ? 0.0 : \
+ ((d) == QUADRANT3 ? -1.0 : sin((double)d*(M_PI/11520.0))))))
+
+#define Dcos(d) ((d) == 0 ? 1.0 : ((d) == QUADRANT ? 0.0 : \
+ ((d) == HALFCIRCLE ? -1.0 : \
+ ((d) == QUADRANT3 ? 0.0 : cos((double)d*(M_PI/11520.0))))))
+
+#define EPSILON45 64
+
+typedef struct {
+ int skipStart;
+ int haveStart;
+ DDXPointRec startPt;
+ int haveLast;
+ int skipLast;
+ DDXPointRec endPt;
+ int dashIndex;
+ int dashOffset;
+ int dashIndexInit;
+ int dashOffsetInit;
+} DashInfo;
+
+static miZeroArcPtRec oob = { 65536, 65536, 0 };
+
+/*
+ * (x - l)^2 / (W/2)^2 + (y + H/2)^2 / (H/2)^2 = 1
+ *
+ * where l is either 0 or .5
+ *
+ * alpha = 4(W^2)
+ * beta = 4(H^2)
+ * gamma = 0
+ * u = 2(W^2)H
+ * v = 4(H^2)l
+ * k = -4(H^2)(l^2)
+ *
+ */
+
+Bool
+miZeroArcSetup(xArc * arc, miZeroArcRec * info, Bool ok360)
+{
+ int l;
+ int angle1, angle2;
+ int startseg, endseg;
+ int startAngle, endAngle;
+ int i, overlap;
+ miZeroArcPtRec start, end;
+
+ l = arc->width & 1;
+ if (arc->width == arc->height) {
+ info->alpha = 4;
+ info->beta = 4;
+ info->k1 = -8;
+ info->k3 = -16;
+ info->b = 12;
+ info->a = (arc->width << 2) - 12;
+ info->d = 17 - (arc->width << 1);
+ if (l) {
+ info->b -= 4;
+ info->a += 4;
+ info->d -= 7;
+ }
+ }
+ else if (!arc->width || !arc->height) {
+ info->alpha = 0;
+ info->beta = 0;
+ info->k1 = 0;
+ info->k3 = 0;
+ info->a = -(int) arc->height;
+ info->b = 0;
+ info->d = -1;
+ }
+ else {
+ /* initial conditions */
+ info->alpha = (arc->width * arc->width) << 2;
+ info->beta = (arc->height * arc->height) << 2;
+ info->k1 = info->beta << 1;
+ info->k3 = info->k1 + (info->alpha << 1);
+ info->b = l ? 0 : -info->beta;
+ info->a = info->alpha * arc->height;
+ info->d = info->b - (info->a >> 1) - (info->alpha >> 2);
+ if (l)
+ info->d -= info->beta >> 2;
+ info->a -= info->b;
+ /* take first step, d < 0 always */
+ info->b -= info->k1;
+ info->a += info->k1;
+ info->d += info->b;
+ /* octant change, b < 0 always */
+ info->k1 = -info->k1;
+ info->k3 = -info->k3;
+ info->b = -info->b;
+ info->d = info->b - info->a - info->d;
+ info->a = info->a - (info->b << 1);
+ }
+ info->dx = 1;
+ info->dy = 0;
+ info->w = (arc->width + 1) >> 1;
+ info->h = arc->height >> 1;
+ info->xorg = arc->x + (arc->width >> 1);
+ info->yorg = arc->y;
+ info->xorgo = info->xorg + l;
+ info->yorgo = info->yorg + arc->height;
+ if (!arc->width) {
+ if (!arc->height) {
+ info->x = 0;
+ info->y = 0;
+ info->initialMask = 0;
+ info->startAngle = 0;
+ info->endAngle = 0;
+ info->start = oob;
+ info->end = oob;
+ return FALSE;
+ }
+ info->x = 0;
+ info->y = 1;
+ }
+ else {
+ info->x = 1;
+ info->y = 0;
+ }
+ angle1 = arc->angle1;
+ angle2 = arc->angle2;
+ if ((angle1 == 0) && (angle2 >= FULLCIRCLE)) {
+ startAngle = 0;
+ endAngle = 0;
+ }
+ else {
+ if (angle2 > FULLCIRCLE)
+ angle2 = FULLCIRCLE;
+ else if (angle2 < -FULLCIRCLE)
+ angle2 = -FULLCIRCLE;
+ if (angle2 < 0) {
+ startAngle = angle1 + angle2;
+ endAngle = angle1;
+ }
+ else {
+ startAngle = angle1;
+ endAngle = angle1 + angle2;
+ }
+ if (startAngle < 0)
+ startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE;
+ if (startAngle >= FULLCIRCLE)
+ startAngle = startAngle % FULLCIRCLE;
+ if (endAngle < 0)
+ endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE;
+ if (endAngle >= FULLCIRCLE)
+ endAngle = endAngle % FULLCIRCLE;
+ }
+ info->startAngle = startAngle;
+ info->endAngle = endAngle;
+ if (ok360 && (startAngle == endAngle) && arc->angle2 &&
+ arc->width && arc->height) {
+ info->initialMask = 0xf;
+ info->start = oob;
+ info->end = oob;
+ return TRUE;
+ }
+ startseg = startAngle / OCTANT;
+ if (!arc->height || (((startseg + 1) & 2) && arc->width)) {
+ start.x = Dcos(startAngle) * ((arc->width + 1) / 2.0);
+ if (start.x < 0)
+ start.x = -start.x;
+ start.y = -1;
+ }
+ else {
+ start.y = Dsin(startAngle) * (arc->height / 2.0);
+ if (start.y < 0)
+ start.y = -start.y;
+ start.y = info->h - start.y;
+ start.x = 65536;
+ }
+ endseg = endAngle / OCTANT;
+ if (!arc->height || (((endseg + 1) & 2) && arc->width)) {
+ end.x = Dcos(endAngle) * ((arc->width + 1) / 2.0);
+ if (end.x < 0)
+ end.x = -end.x;
+ end.y = -1;
+ }
+ else {
+ end.y = Dsin(endAngle) * (arc->height / 2.0);
+ if (end.y < 0)
+ end.y = -end.y;
+ end.y = info->h - end.y;
+ end.x = 65536;
+ }
+ info->firstx = start.x;
+ info->firsty = start.y;
+ info->initialMask = 0;
+ overlap = arc->angle2 && (endAngle <= startAngle);
+ for (i = 0; i < 4; i++) {
+ if (overlap ?
+ ((i * QUADRANT <= endAngle) || ((i + 1) * QUADRANT > startAngle)) :
+ ((i * QUADRANT <= endAngle) && ((i + 1) * QUADRANT > startAngle)))
+ info->initialMask |= (1 << i);
+ }
+ start.mask = info->initialMask;
+ end.mask = info->initialMask;
+ startseg >>= 1;
+ endseg >>= 1;
+ overlap = overlap && (endseg == startseg);
+ if (start.x != end.x || start.y != end.y || !overlap) {
+ if (startseg & 1) {
+ if (!overlap)
+ info->initialMask &= ~(1 << startseg);
+ if (start.x > end.x || start.y > end.y)
+ end.mask &= ~(1 << startseg);
+ }
+ else {
+ start.mask &= ~(1 << startseg);
+ if (((start.x < end.x || start.y < end.y) ||
+ (start.x == end.x && start.y == end.y && (endseg & 1))) &&
+ !overlap)
+ end.mask &= ~(1 << startseg);
+ }
+ if (endseg & 1) {
+ end.mask &= ~(1 << endseg);
+ if (((start.x > end.x || start.y > end.y) ||
+ (start.x == end.x && start.y == end.y && !(startseg & 1))) &&
+ !overlap)
+ start.mask &= ~(1 << endseg);
+ }
+ else {
+ if (!overlap)
+ info->initialMask &= ~(1 << endseg);
+ if (start.x < end.x || start.y < end.y)
+ start.mask &= ~(1 << endseg);
+ }
+ }
+ /* take care of case when start and stop are both near 45 */
+ /* handle here rather than adding extra code to pixelization loops */
+ if (startAngle &&
+ ((start.y < 0 && end.y >= 0) || (start.y >= 0 && end.y < 0))) {
+ i = (startAngle + OCTANT) % OCTANT;
+ if (i < EPSILON45 || i > OCTANT - EPSILON45) {
+ i = (endAngle + OCTANT) % OCTANT;
+ if (i < EPSILON45 || i > OCTANT - EPSILON45) {
+ if (start.y < 0) {
+ i = Dsin(startAngle) * (arc->height / 2.0);
+ if (i < 0)
+ i = -i;
+ if (info->h - i == end.y)
+ start.mask = end.mask;
+ }
+ else {
+ i = Dsin(endAngle) * (arc->height / 2.0);
+ if (i < 0)
+ i = -i;
+ if (info->h - i == start.y)
+ end.mask = start.mask;
+ }
+ }
+ }
+ }
+ if (startseg & 1) {
+ info->start = start;
+ info->end = oob;
+ }
+ else {
+ info->end = start;
+ info->start = oob;
+ }
+ if (endseg & 1) {
+ info->altend = end;
+ if (info->altend.x < info->end.x || info->altend.y < info->end.y) {
+ miZeroArcPtRec tmp;
+
+ tmp = info->altend;
+ info->altend = info->end;
+ info->end = tmp;
+ }
+ info->altstart = oob;
+ }
+ else {
+ info->altstart = end;
+ if (info->altstart.x < info->start.x ||
+ info->altstart.y < info->start.y) {
+ miZeroArcPtRec tmp;
+
+ tmp = info->altstart;
+ info->altstart = info->start;
+ info->start = tmp;
+ }
+ info->altend = oob;
+ }
+ if (!info->start.x || !info->start.y) {
+ info->initialMask = info->start.mask;
+ info->start = info->altstart;
+ }
+ if (!arc->width && (arc->height == 1)) {
+ /* kludge! */
+ info->initialMask |= info->end.mask;
+ info->initialMask |= info->initialMask << 1;
+ info->end.x = 0;
+ info->end.mask = 0;
+ }
+ return FALSE;
+}
+
+#define Pixelate(xval,yval) \
+ { \
+ pts->x = xval; \
+ pts->y = yval; \
+ pts++; \
+ }
+
+#define DoPix(idx,xval,yval) if (mask & (1 << idx)) Pixelate(xval, yval);
+
+static DDXPointPtr
+miZeroArcPts(xArc * arc, DDXPointPtr pts)
+{
+ miZeroArcRec info;
+ int x, y, a, b, d, mask;
+ int k1, k3, dx, dy;
+ Bool do360;
+
+ do360 = miZeroArcSetup(arc, &info, TRUE);
+ MIARCSETUP();
+ mask = info.initialMask;
+ if (!(arc->width & 1)) {
+ DoPix(1, info.xorgo, info.yorg);
+ DoPix(3, info.xorgo, info.yorgo);
+ }
+ if (!info.end.x || !info.end.y) {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ if (do360 && (arc->width == arc->height) && !(arc->width & 1)) {
+ int yorgh = info.yorg + info.h;
+ int xorghp = info.xorg + info.h;
+ int xorghn = info.xorg - info.h;
+
+ while (1) {
+ Pixelate(info.xorg + x, info.yorg + y);
+ Pixelate(info.xorg - x, info.yorg + y);
+ Pixelate(info.xorg - x, info.yorgo - y);
+ Pixelate(info.xorg + x, info.yorgo - y);
+ if (a < 0)
+ break;
+ Pixelate(xorghp - y, yorgh - x);
+ Pixelate(xorghn + y, yorgh - x);
+ Pixelate(xorghn + y, yorgh + x);
+ Pixelate(xorghp - y, yorgh + x);
+ MIARCCIRCLESTEP(;
+ );
+ }
+ if (x > 1 && pts[-1].x == pts[-5].x && pts[-1].y == pts[-5].y)
+ pts -= 4;
+ x = info.w;
+ y = info.h;
+ }
+ else if (do360) {
+ while (y < info.h || x < info.w) {
+ MIARCOCTANTSHIFT(;
+ );
+ Pixelate(info.xorg + x, info.yorg + y);
+ Pixelate(info.xorgo - x, info.yorg + y);
+ Pixelate(info.xorgo - x, info.yorgo - y);
+ Pixelate(info.xorg + x, info.yorgo - y);
+ MIARCSTEP(;
+ ,;
+ );
+ }
+ }
+ else {
+ while (y < info.h || x < info.w) {
+ MIARCOCTANTSHIFT(;
+ );
+ if ((x == info.start.x) || (y == info.start.y)) {
+ mask = info.start.mask;
+ info.start = info.altstart;
+ }
+ DoPix(0, info.xorg + x, info.yorg + y);
+ DoPix(1, info.xorgo - x, info.yorg + y);
+ DoPix(2, info.xorgo - x, info.yorgo - y);
+ DoPix(3, info.xorg + x, info.yorgo - y);
+ if ((x == info.end.x) || (y == info.end.y)) {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ MIARCSTEP(;
+ ,;
+ );
+ }
+ }
+ if ((x == info.start.x) || (y == info.start.y))
+ mask = info.start.mask;
+ DoPix(0, info.xorg + x, info.yorg + y);
+ DoPix(2, info.xorgo - x, info.yorgo - y);
+ if (arc->height & 1) {
+ DoPix(1, info.xorgo - x, info.yorg + y);
+ DoPix(3, info.xorg + x, info.yorgo - y);
+ }
+ return pts;
+}
+
+#undef DoPix
+#define DoPix(idx,xval,yval) \
+ if (mask & (1 << idx)) \
+ { \
+ arcPts[idx]->x = xval; \
+ arcPts[idx]->y = yval; \
+ arcPts[idx]++; \
+ }
+
+static void
+miZeroArcDashPts(GCPtr pGC,
+ xArc * arc,
+ DashInfo * dinfo,
+ DDXPointPtr points,
+ int maxPts, DDXPointPtr * evenPts, DDXPointPtr * oddPts)
+{
+ miZeroArcRec info;
+ int x, y, a, b, d, mask;
+ int k1, k3, dx, dy;
+ int dashRemaining;
+ DDXPointPtr arcPts[4];
+ DDXPointPtr startPts[5], endPts[5];
+ int deltas[5];
+ DDXPointPtr startPt, pt, lastPt, pts;
+ int i, j, delta, ptsdelta, seg, startseg;
+
+ for (i = 0; i < 4; i++)
+ arcPts[i] = points + (i * maxPts);
+ (void) miZeroArcSetup(arc, &info, FALSE);
+ MIARCSETUP();
+ mask = info.initialMask;
+ startseg = info.startAngle / QUADRANT;
+ startPt = arcPts[startseg];
+ if (!(arc->width & 1)) {
+ DoPix(1, info.xorgo, info.yorg);
+ DoPix(3, info.xorgo, info.yorgo);
+ }
+ if (!info.end.x || !info.end.y) {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ while (y < info.h || x < info.w) {
+ MIARCOCTANTSHIFT(;
+ );
+ if ((x == info.firstx) || (y == info.firsty))
+ startPt = arcPts[startseg];
+ if ((x == info.start.x) || (y == info.start.y)) {
+ mask = info.start.mask;
+ info.start = info.altstart;
+ }
+ DoPix(0, info.xorg + x, info.yorg + y);
+ DoPix(1, info.xorgo - x, info.yorg + y);
+ DoPix(2, info.xorgo - x, info.yorgo - y);
+ DoPix(3, info.xorg + x, info.yorgo - y);
+ if ((x == info.end.x) || (y == info.end.y)) {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ MIARCSTEP(;
+ ,;
+ );
+ }
+ if ((x == info.firstx) || (y == info.firsty))
+ startPt = arcPts[startseg];
+ if ((x == info.start.x) || (y == info.start.y))
+ mask = info.start.mask;
+ DoPix(0, info.xorg + x, info.yorg + y);
+ DoPix(2, info.xorgo - x, info.yorgo - y);
+ if (arc->height & 1) {
+ DoPix(1, info.xorgo - x, info.yorg + y);
+ DoPix(3, info.xorg + x, info.yorgo - y);
+ }
+ for (i = 0; i < 4; i++) {
+ seg = (startseg + i) & 3;
+ pt = points + (seg * maxPts);
+ if (seg & 1) {
+ startPts[i] = pt;
+ endPts[i] = arcPts[seg];
+ deltas[i] = 1;
+ }
+ else {
+ startPts[i] = arcPts[seg] - 1;
+ endPts[i] = pt - 1;
+ deltas[i] = -1;
+ }
+ }
+ startPts[4] = startPts[0];
+ endPts[4] = startPt;
+ startPts[0] = startPt;
+ if (startseg & 1) {
+ if (startPts[4] != endPts[4])
+ endPts[4]--;
+ deltas[4] = 1;
+ }
+ else {
+ if (startPts[0] > startPts[4])
+ startPts[0]--;
+ if (startPts[4] < endPts[4])
+ endPts[4]--;
+ deltas[4] = -1;
+ }
+ if (arc->angle2 < 0) {
+ DDXPointPtr tmps, tmpe;
+ int tmpd;
+
+ tmpd = deltas[0];
+ tmps = startPts[0] - tmpd;
+ tmpe = endPts[0] - tmpd;
+ startPts[0] = endPts[4] - deltas[4];
+ endPts[0] = startPts[4] - deltas[4];
+ deltas[0] = -deltas[4];
+ startPts[4] = tmpe;
+ endPts[4] = tmps;
+ deltas[4] = -tmpd;
+ tmpd = deltas[1];
+ tmps = startPts[1] - tmpd;
+ tmpe = endPts[1] - tmpd;
+ startPts[1] = endPts[3] - deltas[3];
+ endPts[1] = startPts[3] - deltas[3];
+ deltas[1] = -deltas[3];
+ startPts[3] = tmpe;
+ endPts[3] = tmps;
+ deltas[3] = -tmpd;
+ tmps = startPts[2] - deltas[2];
+ startPts[2] = endPts[2] - deltas[2];
+ endPts[2] = tmps;
+ deltas[2] = -deltas[2];
+ }
+ for (i = 0; i < 5 && startPts[i] == endPts[i]; i++);
+ if (i == 5)
+ return;
+ pt = startPts[i];
+ for (j = 4; startPts[j] == endPts[j]; j--);
+ lastPt = endPts[j] - deltas[j];
+ if (dinfo->haveLast &&
+ (pt->x == dinfo->endPt.x) && (pt->y == dinfo->endPt.y)) {
+ startPts[i] += deltas[i];
+ }
+ else {
+ dinfo->dashIndex = dinfo->dashIndexInit;
+ dinfo->dashOffset = dinfo->dashOffsetInit;
+ }
+ if (!dinfo->skipStart && (info.startAngle != info.endAngle)) {
+ dinfo->startPt = *pt;
+ dinfo->haveStart = TRUE;
+ }
+ else if (!dinfo->skipLast && dinfo->haveStart &&
+ (lastPt->x == dinfo->startPt.x) &&
+ (lastPt->y == dinfo->startPt.y) && (lastPt != startPts[i]))
+ endPts[j] = lastPt;
+ if (info.startAngle != info.endAngle) {
+ dinfo->haveLast = TRUE;
+ dinfo->endPt = *lastPt;
+ }
+ dashRemaining = pGC->dash[dinfo->dashIndex] - dinfo->dashOffset;
+ for (i = 0; i < 5; i++) {
+ pt = startPts[i];
+ lastPt = endPts[i];
+ delta = deltas[i];
+ while (pt != lastPt) {
+ if (dinfo->dashIndex & 1) {
+ pts = *oddPts;
+ ptsdelta = -1;
+ }
+ else {
+ pts = *evenPts;
+ ptsdelta = 1;
+ }
+ while ((pt != lastPt) && --dashRemaining >= 0) {
+ *pts = *pt;
+ pts += ptsdelta;
+ pt += delta;
+ }
+ if (dinfo->dashIndex & 1)
+ *oddPts = pts;
+ else
+ *evenPts = pts;
+ if (dashRemaining <= 0) {
+ if (++(dinfo->dashIndex) == pGC->numInDashList)
+ dinfo->dashIndex = 0;
+ dashRemaining = pGC->dash[dinfo->dashIndex];
+ }
+ }
+ }
+ dinfo->dashOffset = pGC->dash[dinfo->dashIndex] - dashRemaining;
+}
+
+void
+miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+{
+ int maxPts = 0;
+ int n, maxw = 0;
+ xArc *arc;
+ int i;
+ DDXPointPtr points, pts, oddPts = NULL;
+ DDXPointPtr pt;
+ int numPts;
+ Bool dospans;
+ int *widths = NULL;
+ XID fgPixel = pGC->fgPixel;
+ DashInfo dinfo;
+
+ for (arc = parcs, i = narcs; --i >= 0; arc++) {
+ if (!miCanZeroArc(arc))
+ miPolyArc(pDraw, pGC, 1, arc);
+ else {
+ if (arc->width > arc->height)
+ n = arc->width + (arc->height >> 1);
+ else
+ n = arc->height + (arc->width >> 1);
+ if (n > maxPts)
+ maxPts = n;
+ }
+ }
+ if (!maxPts)
+ return;
+ numPts = maxPts << 2;
+ dospans = (pGC->fillStyle != FillSolid);
+ if (dospans) {
+ widths = malloc(sizeof(int) * numPts);
+ if (!widths)
+ return;
+ maxw = 0;
+ }
+ if (pGC->lineStyle != LineSolid) {
+ numPts <<= 1;
+ dinfo.haveStart = FALSE;
+ dinfo.skipStart = FALSE;
+ dinfo.haveLast = FALSE;
+ dinfo.dashIndexInit = 0;
+ dinfo.dashOffsetInit = 0;
+ miStepDash((int) pGC->dashOffset, &dinfo.dashIndexInit,
+ (unsigned char *) pGC->dash, (int) pGC->numInDashList,
+ &dinfo.dashOffsetInit);
+ }
+ points = malloc(sizeof(DDXPointRec) * numPts);
+ if (!points) {
+ if (dospans) {
+ free(widths);
+ }
+ return;
+ }
+ for (arc = parcs, i = narcs; --i >= 0; arc++) {
+ if (miCanZeroArc(arc)) {
+ if (pGC->lineStyle == LineSolid)
+ pts = miZeroArcPts(arc, points);
+ else {
+ pts = points;
+ oddPts = &points[(numPts >> 1) - 1];
+ dinfo.skipLast = i;
+ miZeroArcDashPts(pGC, arc, &dinfo,
+ oddPts + 1, maxPts, &pts, &oddPts);
+ dinfo.skipStart = TRUE;
+ }
+ n = pts - points;
+ if (!dospans)
+ (*pGC->ops->PolyPoint) (pDraw, pGC, CoordModeOrigin, n, points);
+ else {
+ if (n > maxw) {
+ while (maxw < n)
+ widths[maxw++] = 1;
+ }
+ if (pGC->miTranslate) {
+ for (pt = points; pt != pts; pt++) {
+ pt->x += pDraw->x;
+ pt->y += pDraw->y;
+ }
+ }
+ (*pGC->ops->FillSpans) (pDraw, pGC, n, points, widths, FALSE);
+ }
+ if (pGC->lineStyle != LineDoubleDash)
+ continue;
+ if ((pGC->fillStyle == FillSolid) ||
+ (pGC->fillStyle == FillStippled)) {
+ ChangeGCVal gcval;
+
+ gcval.val = pGC->bgPixel;
+ ChangeGC(NullClient, pGC, GCForeground, &gcval);
+ ValidateGC(pDraw, pGC);
+ }
+ pts = &points[numPts >> 1];
+ oddPts++;
+ n = pts - oddPts;
+ if (!dospans)
+ (*pGC->ops->PolyPoint) (pDraw, pGC, CoordModeOrigin, n, oddPts);
+ else {
+ if (n > maxw) {
+ while (maxw < n)
+ widths[maxw++] = 1;
+ }
+ if (pGC->miTranslate) {
+ for (pt = oddPts; pt != pts; pt++) {
+ pt->x += pDraw->x;
+ pt->y += pDraw->y;
+ }
+ }
+ (*pGC->ops->FillSpans) (pDraw, pGC, n, oddPts, widths, FALSE);
+ }
+ if ((pGC->fillStyle == FillSolid) ||
+ (pGC->fillStyle == FillStippled)) {
+ ChangeGCVal gcval;
+
+ gcval.val = fgPixel;
+ ChangeGC(NullClient, pGC, GCForeground, &gcval);
+ ValidateGC(pDraw, pGC);
+ }
+ }
+ }
+ free(points);
+ if (dospans) {
+ free(widths);
+ }
+}
diff --git a/xorg-server/mi/mizerarc.h b/xorg-server/mi/mizerarc.h
index 1612a525b..165e281ed 100644
--- a/xorg-server/mi/mizerarc.h
+++ b/xorg-server/mi/mizerarc.h
@@ -24,7 +24,6 @@ in this Software without prior written authorization from The Open Group.
********************************************************/
-
typedef struct {
int x;
int y;
@@ -119,8 +118,7 @@ typedef struct {
/* mizerarc.c */
-extern _X_EXPORT Bool miZeroArcSetup(
- xArc * /*arc*/,
- miZeroArcRec * /*info*/,
- Bool /*ok360*/
-);
+extern _X_EXPORT Bool miZeroArcSetup(xArc * /*arc */ ,
+ miZeroArcRec * /*info */ ,
+ Bool /*ok360 */
+ );
diff --git a/xorg-server/mi/mizerclip.c b/xorg-server/mi/mizerclip.c
index fb1e25fe4..d05bf6788 100644
--- a/xorg-server/mi/mizerclip.c
+++ b/xorg-server/mi/mizerclip.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -362,18 +361,18 @@ the numerator is therefore (2^32 - 1), which does not overflow an unsigned
/* Bit codes for the terms of the 16 clipping equations defined below. */
#define T_2NDX (1 << 0)
-#define T_2MDY (0) /* implicit term */
+#define T_2MDY (0) /* implicit term */
#define T_DXNOTY (1 << 1)
-#define T_DYNOTX (0) /* implicit term */
+#define T_DYNOTX (0) /* implicit term */
#define T_SUBDXORY (1 << 2)
-#define T_ADDDX (T_DXNOTY) /* composite term */
-#define T_SUBDX (T_DXNOTY | T_SUBDXORY) /* composite term */
-#define T_ADDDY (T_DYNOTX) /* composite term */
-#define T_SUBDY (T_DYNOTX | T_SUBDXORY) /* composite term */
+#define T_ADDDX (T_DXNOTY) /* composite term */
+#define T_SUBDX (T_DXNOTY | T_SUBDXORY) /* composite term */
+#define T_ADDDY (T_DYNOTX) /* composite term */
+#define T_SUBDY (T_DYNOTX | T_SUBDXORY) /* composite term */
#define T_BIASSUBONE (1 << 3)
-#define T_SUBBIAS (0) /* implicit term */
+#define T_SUBBIAS (0) /* implicit term */
#define T_DIV2DX (1 << 4)
-#define T_DIV2DY (0) /* implicit term */
+#define T_DIV2DY (0) /* implicit term */
#define T_ADDONE (1 << 5)
/* Bit masks defining the 16 equations used in miZeroClipLine. */
@@ -409,8 +408,7 @@ miZeroClipLine(int xmin, int ymin, int xmax, int ymax,
int *new_x1, int *new_y1, int *new_x2, int *new_y2,
unsigned int adx, unsigned int ady,
int *pt1_clipped, int *pt2_clipped,
- int octant, unsigned int bias,
- int oc1, int oc2)
+ int octant, unsigned int bias, int oc1, int oc2)
{
int swapped = 0;
int clipDone = 0;
@@ -433,188 +431,174 @@ miZeroClipLine(int xmin, int ymin, int xmax, int ymax,
xmajor = IsXMajorOctant(octant);
bias = ((bias >> octant) & 1);
- while (1)
- {
- if ((oc1 & oc2) != 0) /* trivial reject */
- {
- clipDone = -1;
- clip1 = oc1;
- clip2 = oc2;
- break;
- }
- else if ((oc1 | oc2) == 0) /* trivial accept */
- {
- clipDone = 1;
- if (swapped)
- {
- SWAPINT_PAIR(x1, y1, x2, y2);
- SWAPINT(clip1, clip2);
- }
- break;
+ while (1) {
+ if ((oc1 & oc2) != 0) { /* trivial reject */
+ clipDone = -1;
+ clip1 = oc1;
+ clip2 = oc2;
+ break;
+ }
+ else if ((oc1 | oc2) == 0) { /* trivial accept */
+ clipDone = 1;
+ if (swapped) {
+ SWAPINT_PAIR(x1, y1, x2, y2);
+ SWAPINT(clip1, clip2);
+ }
+ break;
}
- else /* have to clip */
- {
- /* only clip one point at a time */
- if (oc1 == 0)
- {
- SWAPINT_PAIR(x1, y1, x2, y2);
- SWAPINT_PAIR(x1_orig, y1_orig, x2_orig, y2_orig);
- SWAPINT(oc1, oc2);
- SWAPINT(clip1, clip2);
- swapped = !swapped;
- }
-
- clip1 |= oc1;
- if (oc1 & OUT_LEFT)
- {
- negslope = IsYDecreasingOctant(octant);
- utmp = xmin - x1_orig;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN2 : EQN1;
- else
- eqn = (swapped) ? EQN4 : EQN3;
- anchorval = y1_orig;
- }
- else /* clip based on far endpt */
- {
- utmp = x2_orig - xmin;
- if (xmajor)
- eqn = (swapped) ? EQN1B : EQN2B;
- else
- eqn = (swapped) ? EQN3B : EQN4B;
- anchorval = y2_orig;
- negslope = !negslope;
- }
- x1 = xmin;
- }
- else if (oc1 & OUT_ABOVE)
- {
- negslope = IsXDecreasingOctant(octant);
- utmp = ymin - y1_orig;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN6 : EQN5;
- else
- eqn = (swapped) ? EQN8 : EQN7;
- anchorval = x1_orig;
- }
- else /* clip based on far endpt */
- {
- utmp = y2_orig - ymin;
- if (xmajor)
- eqn = (swapped) ? EQN5B : EQN6B;
- else
- eqn = (swapped) ? EQN7B : EQN8B;
- anchorval = x2_orig;
- negslope = !negslope;
- }
- y1 = ymin;
- }
- else if (oc1 & OUT_RIGHT)
- {
- negslope = IsYDecreasingOctant(octant);
- utmp = x1_orig - xmax;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN2 : EQN1;
- else
- eqn = (swapped) ? EQN4 : EQN3;
- anchorval = y1_orig;
- }
- else /* clip based on far endpt */
- {
- /*
- * Technically since the equations can handle
- * utmp == 32768, this overflow code isn't
- * needed since X11 protocol can't generate
- * a line which goes more than 32768 pixels
- * to the right of a clip rectangle.
- */
- utmp = xmax - x2_orig;
- if (xmajor)
- eqn = (swapped) ? EQN1B : EQN2B;
- else
- eqn = (swapped) ? EQN3B : EQN4B;
- anchorval = y2_orig;
- negslope = !negslope;
- }
- x1 = xmax;
- }
- else if (oc1 & OUT_BELOW)
- {
- negslope = IsXDecreasingOctant(octant);
- utmp = y1_orig - ymax;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN6 : EQN5;
- else
- eqn = (swapped) ? EQN8 : EQN7;
- anchorval = x1_orig;
- }
- else /* clip based on far endpt */
- {
- /*
- * Technically since the equations can handle
- * utmp == 32768, this overflow code isn't
- * needed since X11 protocol can't generate
- * a line which goes more than 32768 pixels
- * below the bottom of a clip rectangle.
- */
- utmp = ymax - y2_orig;
- if (xmajor)
- eqn = (swapped) ? EQN5B : EQN6B;
- else
- eqn = (swapped) ? EQN7B : EQN8B;
- anchorval = x2_orig;
- negslope = !negslope;
- }
- y1 = ymax;
- }
-
- if (swapped)
- negslope = !negslope;
-
- utmp <<= 1; /* utmp = 2N or 2M */
- if (eqn & T_2NDX)
- utmp = (utmp * adx);
- else /* (eqn & T_2MDY) */
- utmp = (utmp * ady);
- if (eqn & T_DXNOTY)
- if (eqn & T_SUBDXORY)
- utmp -= adx;
- else
- utmp += adx;
- else /* (eqn & T_DYNOTX) */
- if (eqn & T_SUBDXORY)
- utmp -= ady;
- else
- utmp += ady;
- if (eqn & T_BIASSUBONE)
- utmp += bias - 1;
- else /* (eqn & T_SUBBIAS) */
- utmp -= bias;
- if (eqn & T_DIV2DX)
- utmp /= (adx << 1);
- else /* (eqn & T_DIV2DY) */
- utmp /= (ady << 1);
- if (eqn & T_ADDONE)
- utmp++;
-
- if (negslope)
- utmp = -utmp;
-
- if (eqn & T_2NDX) /* We are calculating X steps */
- x1 = anchorval + utmp;
- else /* else, Y steps */
- y1 = anchorval + utmp;
-
- oc1 = 0;
- MIOUTCODES(oc1, x1, y1, xmin, ymin, xmax, ymax);
+ else { /* have to clip */
+
+ /* only clip one point at a time */
+ if (oc1 == 0) {
+ SWAPINT_PAIR(x1, y1, x2, y2);
+ SWAPINT_PAIR(x1_orig, y1_orig, x2_orig, y2_orig);
+ SWAPINT(oc1, oc2);
+ SWAPINT(clip1, clip2);
+ swapped = !swapped;
+ }
+
+ clip1 |= oc1;
+ if (oc1 & OUT_LEFT) {
+ negslope = IsYDecreasingOctant(octant);
+ utmp = xmin - x1_orig;
+ if (utmp <= 32767) { /* clip based on near endpt */
+ if (xmajor)
+ eqn = (swapped) ? EQN2 : EQN1;
+ else
+ eqn = (swapped) ? EQN4 : EQN3;
+ anchorval = y1_orig;
+ }
+ else { /* clip based on far endpt */
+
+ utmp = x2_orig - xmin;
+ if (xmajor)
+ eqn = (swapped) ? EQN1B : EQN2B;
+ else
+ eqn = (swapped) ? EQN3B : EQN4B;
+ anchorval = y2_orig;
+ negslope = !negslope;
+ }
+ x1 = xmin;
+ }
+ else if (oc1 & OUT_ABOVE) {
+ negslope = IsXDecreasingOctant(octant);
+ utmp = ymin - y1_orig;
+ if (utmp <= 32767) { /* clip based on near endpt */
+ if (xmajor)
+ eqn = (swapped) ? EQN6 : EQN5;
+ else
+ eqn = (swapped) ? EQN8 : EQN7;
+ anchorval = x1_orig;
+ }
+ else { /* clip based on far endpt */
+
+ utmp = y2_orig - ymin;
+ if (xmajor)
+ eqn = (swapped) ? EQN5B : EQN6B;
+ else
+ eqn = (swapped) ? EQN7B : EQN8B;
+ anchorval = x2_orig;
+ negslope = !negslope;
+ }
+ y1 = ymin;
+ }
+ else if (oc1 & OUT_RIGHT) {
+ negslope = IsYDecreasingOctant(octant);
+ utmp = x1_orig - xmax;
+ if (utmp <= 32767) { /* clip based on near endpt */
+ if (xmajor)
+ eqn = (swapped) ? EQN2 : EQN1;
+ else
+ eqn = (swapped) ? EQN4 : EQN3;
+ anchorval = y1_orig;
+ }
+ else { /* clip based on far endpt */
+
+ /*
+ * Technically since the equations can handle
+ * utmp == 32768, this overflow code isn't
+ * needed since X11 protocol can't generate
+ * a line which goes more than 32768 pixels
+ * to the right of a clip rectangle.
+ */
+ utmp = xmax - x2_orig;
+ if (xmajor)
+ eqn = (swapped) ? EQN1B : EQN2B;
+ else
+ eqn = (swapped) ? EQN3B : EQN4B;
+ anchorval = y2_orig;
+ negslope = !negslope;
+ }
+ x1 = xmax;
+ }
+ else if (oc1 & OUT_BELOW) {
+ negslope = IsXDecreasingOctant(octant);
+ utmp = y1_orig - ymax;
+ if (utmp <= 32767) { /* clip based on near endpt */
+ if (xmajor)
+ eqn = (swapped) ? EQN6 : EQN5;
+ else
+ eqn = (swapped) ? EQN8 : EQN7;
+ anchorval = x1_orig;
+ }
+ else { /* clip based on far endpt */
+
+ /*
+ * Technically since the equations can handle
+ * utmp == 32768, this overflow code isn't
+ * needed since X11 protocol can't generate
+ * a line which goes more than 32768 pixels
+ * below the bottom of a clip rectangle.
+ */
+ utmp = ymax - y2_orig;
+ if (xmajor)
+ eqn = (swapped) ? EQN5B : EQN6B;
+ else
+ eqn = (swapped) ? EQN7B : EQN8B;
+ anchorval = x2_orig;
+ negslope = !negslope;
+ }
+ y1 = ymax;
+ }
+
+ if (swapped)
+ negslope = !negslope;
+
+ utmp <<= 1; /* utmp = 2N or 2M */
+ if (eqn & T_2NDX)
+ utmp = (utmp * adx);
+ else /* (eqn & T_2MDY) */
+ utmp = (utmp * ady);
+ if (eqn & T_DXNOTY)
+ if (eqn & T_SUBDXORY)
+ utmp -= adx;
+ else
+ utmp += adx;
+ else /* (eqn & T_DYNOTX) */ if (eqn & T_SUBDXORY)
+ utmp -= ady;
+ else
+ utmp += ady;
+ if (eqn & T_BIASSUBONE)
+ utmp += bias - 1;
+ else /* (eqn & T_SUBBIAS) */
+ utmp -= bias;
+ if (eqn & T_DIV2DX)
+ utmp /= (adx << 1);
+ else /* (eqn & T_DIV2DY) */
+ utmp /= (ady << 1);
+ if (eqn & T_ADDONE)
+ utmp++;
+
+ if (negslope)
+ utmp = -utmp;
+
+ if (eqn & T_2NDX) /* We are calculating X steps */
+ x1 = anchorval + utmp;
+ else /* else, Y steps */
+ y1 = anchorval + utmp;
+
+ oc1 = 0;
+ MIOUTCODES(oc1, x1, y1, xmin, ymin, xmax, ymax);
}
}
@@ -622,7 +606,7 @@ miZeroClipLine(int xmin, int ymin, int xmax, int ymax,
*new_y1 = y1;
*new_x2 = x2;
*new_y2 = y2;
-
+
*pt1_clipped = clip1;
*pt2_clipped = clip2;
diff --git a/xorg-server/mi/mizerline.c b/xorg-server/mi/mizerline.c
index 7077b5198..90798dbdf 100644
--- a/xorg-server/mi/mizerline.c
+++ b/xorg-server/mi/mizerline.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -98,15 +97,12 @@ SOFTWARE.
}
void
-miZeroLine(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode, /* Origin or Previous */
- int npt, /* number of points */
- DDXPointPtr pptInit)
+miZeroLine(DrawablePtr pDraw, GCPtr pGC, int mode, /* Origin or Previous */
+ int npt, /* number of points */
+ DDXPointPtr pptInit)
{
int Nspans, current_y = 0;
- DDXPointPtr ppt;
+ DDXPointPtr ppt;
DDXPointPtr pspanInit, spans;
int *pwidthInit, *widths, list_len;
int xleft, ytop, xright, ybottom;
@@ -122,21 +118,20 @@ miZeroLine(
int adx, ady;
int octant;
unsigned int bias = miGetZeroLineBias(pDraw->pScreen);
- int e, e1, e2, e3; /* Bresenham error terms */
- int length; /* length of lines == # of pixels on major axis */
+ int e, e1, e2, e3; /* Bresenham error terms */
+ int length; /* length of lines == # of pixels on major axis */
- xleft = pDraw->x;
- ytop = pDraw->y;
- xright = pDraw->x + pDraw->width - 1;
+ xleft = pDraw->x;
+ ytop = pDraw->y;
+ xright = pDraw->x + pDraw->width - 1;
ybottom = pDraw->y + pDraw->height - 1;
- if (!pGC->miTranslate)
- {
- /* do everything in drawable-relative coordinates */
- xleft = 0;
- ytop = 0;
- xright -= pDraw->x;
- ybottom -= pDraw->y;
+ if (!pGC->miTranslate) {
+ /* do everything in drawable-relative coordinates */
+ xleft = 0;
+ ytop = 0;
+ xright -= pDraw->x;
+ ybottom -= pDraw->y;
}
/* it doesn't matter whether we're in drawable or screen coordinates,
@@ -144,9 +139,9 @@ miZeroLine(
* range of a DDXPointRec component.
*/
if (xright > MAX_COORDINATE)
- xright = MAX_COORDINATE;
+ xright = MAX_COORDINATE;
if (ybottom > MAX_COORDINATE)
- ybottom = MAX_COORDINATE;
+ ybottom = MAX_COORDINATE;
/* since we're clipping to the drawable's boundaries & coordinate
* space boundaries, we're guaranteed that the larger of width/height
@@ -158,24 +153,23 @@ miZeroLine(
pspanInit = malloc(list_len * sizeof(DDXPointRec));
pwidthInit = malloc(list_len * sizeof(int));
if (!pspanInit || !pwidthInit) {
- free(pspanInit);
- free(pwidthInit);
- return;
+ free(pspanInit);
+ free(pwidthInit);
+ return;
}
Nspans = 0;
new_span = TRUE;
- spans = pspanInit - 1;
+ spans = pspanInit - 1;
widths = pwidthInit - 1;
ppt = pptInit;
xstart = ppt->x;
ystart = ppt->y;
- if (pGC->miTranslate)
- {
- xstart += pDraw->x;
- ystart += pDraw->y;
+ if (pGC->miTranslate) {
+ xstart += pDraw->x;
+ ystart += pDraw->y;
}
-
+
/* x2, y2, oc2 copied to x1, y1, oc1 at top of loop to simplify
* iteration logic
*/
@@ -184,166 +178,154 @@ miZeroLine(
oc2 = 0;
MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom);
- while (--npt > 0)
- {
- if (Nspans > 0)
- (*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit,
- pwidthInit, FALSE);
- Nspans = 0;
- new_span = TRUE;
- spans = pspanInit - 1;
- widths = pwidthInit - 1;
-
- x1 = x2;
- y1 = y2;
- oc1 = oc2;
- ++ppt;
-
- x2 = ppt->x;
- y2 = ppt->y;
- if (pGC->miTranslate && (mode != CoordModePrevious))
- {
- x2 += pDraw->x;
- y2 += pDraw->y;
- }
- else if (mode == CoordModePrevious)
- {
- x2 += x1;
- y2 += y1;
- }
-
- oc2 = 0;
- MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom);
-
- CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
-
- if (adx > ady)
- {
- e1 = ady << 1;
- e2 = e1 - (adx << 1);
- e = e1 - adx;
- length = adx; /* don't draw endpoint in main loop */
-
- FIXUP_ERROR(e, octant, bias);
-
- new_x1 = x1;
- new_y1 = y1;
- new_x2 = x2;
- new_y2 = y2;
- pt1_clipped = 0;
- pt2_clipped = 0;
-
- if ((oc1 | oc2) != 0)
- {
- result = miZeroClipLine(xleft, ytop, xright, ybottom,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady,
- &pt1_clipped, &pt2_clipped,
- octant, bias, oc1, oc2);
- if (result == -1)
- continue;
-
- length = abs(new_x2 - new_x1);
-
- /* if we've clipped the endpoint, always draw the full length
- * of the segment, because then the capstyle doesn't matter
- */
- if (pt2_clipped)
- length++;
-
- if (pt1_clipped)
- {
- /* must calculate new error terms */
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
- e += (clipdy * e2) + ((clipdx - clipdy) * e1);
- }
- }
-
- /* draw the segment */
-
- x = new_x1;
- y = new_y1;
-
- e3 = e2 - e1;
- e = e - e1;
-
- while (length--)
- {
- MI_OUTPUT_POINT(x, y);
- e += e1;
- if (e >= 0)
- {
- y += signdy;
- e += e3;
- }
- x += signdx;
- }
- }
- else /* Y major line */
- {
- e1 = adx << 1;
- e2 = e1 - (ady << 1);
- e = e1 - ady;
- length = ady; /* don't draw endpoint in main loop */
-
- SetYMajorOctant(octant);
- FIXUP_ERROR(e, octant, bias);
-
- new_x1 = x1;
- new_y1 = y1;
- new_x2 = x2;
- new_y2 = y2;
- pt1_clipped = 0;
- pt2_clipped = 0;
-
- if ((oc1 | oc2) != 0)
- {
- result = miZeroClipLine(xleft, ytop, xright, ybottom,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady,
- &pt1_clipped, &pt2_clipped,
- octant, bias, oc1, oc2);
- if (result == -1)
- continue;
-
- length = abs(new_y2 - new_y1);
-
- /* if we've clipped the endpoint, always draw the full length
- * of the segment, because then the capstyle doesn't matter
- */
- if (pt2_clipped)
- length++;
-
- if (pt1_clipped)
- {
- /* must calculate new error terms */
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
- e += (clipdx * e2) + ((clipdy - clipdx) * e1);
- }
- }
-
- /* draw the segment */
-
- x = new_x1;
- y = new_y1;
-
- e3 = e2 - e1;
- e = e - e1;
-
- while (length--)
- {
- MI_OUTPUT_POINT(x, y);
- e += e1;
- if (e >= 0)
- {
- x += signdx;
- e += e3;
- }
- y += signdy;
- }
- }
+ while (--npt > 0) {
+ if (Nspans > 0)
+ (*pGC->ops->FillSpans) (pDraw, pGC, Nspans, pspanInit,
+ pwidthInit, FALSE);
+ Nspans = 0;
+ new_span = TRUE;
+ spans = pspanInit - 1;
+ widths = pwidthInit - 1;
+
+ x1 = x2;
+ y1 = y2;
+ oc1 = oc2;
+ ++ppt;
+
+ x2 = ppt->x;
+ y2 = ppt->y;
+ if (pGC->miTranslate && (mode != CoordModePrevious)) {
+ x2 += pDraw->x;
+ y2 += pDraw->y;
+ }
+ else if (mode == CoordModePrevious) {
+ x2 += x1;
+ y2 += y1;
+ }
+
+ oc2 = 0;
+ MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom);
+
+ CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
+
+ if (adx > ady) {
+ e1 = ady << 1;
+ e2 = e1 - (adx << 1);
+ e = e1 - adx;
+ length = adx; /* don't draw endpoint in main loop */
+
+ FIXUP_ERROR(e, octant, bias);
+
+ new_x1 = x1;
+ new_y1 = y1;
+ new_x2 = x2;
+ new_y2 = y2;
+ pt1_clipped = 0;
+ pt2_clipped = 0;
+
+ if ((oc1 | oc2) != 0) {
+ result = miZeroClipLine(xleft, ytop, xright, ybottom,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady,
+ &pt1_clipped, &pt2_clipped,
+ octant, bias, oc1, oc2);
+ if (result == -1)
+ continue;
+
+ length = abs(new_x2 - new_x1);
+
+ /* if we've clipped the endpoint, always draw the full length
+ * of the segment, because then the capstyle doesn't matter
+ */
+ if (pt2_clipped)
+ length++;
+
+ if (pt1_clipped) {
+ /* must calculate new error terms */
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+ e += (clipdy * e2) + ((clipdx - clipdy) * e1);
+ }
+ }
+
+ /* draw the segment */
+
+ x = new_x1;
+ y = new_y1;
+
+ e3 = e2 - e1;
+ e = e - e1;
+
+ while (length--) {
+ MI_OUTPUT_POINT(x, y);
+ e += e1;
+ if (e >= 0) {
+ y += signdy;
+ e += e3;
+ }
+ x += signdx;
+ }
+ }
+ else { /* Y major line */
+
+ e1 = adx << 1;
+ e2 = e1 - (ady << 1);
+ e = e1 - ady;
+ length = ady; /* don't draw endpoint in main loop */
+
+ SetYMajorOctant(octant);
+ FIXUP_ERROR(e, octant, bias);
+
+ new_x1 = x1;
+ new_y1 = y1;
+ new_x2 = x2;
+ new_y2 = y2;
+ pt1_clipped = 0;
+ pt2_clipped = 0;
+
+ if ((oc1 | oc2) != 0) {
+ result = miZeroClipLine(xleft, ytop, xright, ybottom,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady,
+ &pt1_clipped, &pt2_clipped,
+ octant, bias, oc1, oc2);
+ if (result == -1)
+ continue;
+
+ length = abs(new_y2 - new_y1);
+
+ /* if we've clipped the endpoint, always draw the full length
+ * of the segment, because then the capstyle doesn't matter
+ */
+ if (pt2_clipped)
+ length++;
+
+ if (pt1_clipped) {
+ /* must calculate new error terms */
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+ e += (clipdx * e2) + ((clipdy - clipdx) * e1);
+ }
+ }
+
+ /* draw the segment */
+
+ x = new_x1;
+ y = new_y1;
+
+ e3 = e2 - e1;
+ e = e - e1;
+
+ while (length--) {
+ MI_OUTPUT_POINT(x, y);
+ e += e1;
+ if (e >= 0) {
+ x += signdx;
+ e += e3;
+ }
+ y += signdy;
+ }
+ }
}
/* only do the capnotlast check on the last segment
@@ -351,31 +333,26 @@ miZeroLine(
* point is the same as the first point, do not draw it, unless the
* line is degenerate
*/
- if ( (! pt2_clipped) && (pGC->capStyle != CapNotLast) &&
- (((xstart != x2) || (ystart != y2)) || (ppt == pptInit + 1)))
- {
- MI_OUTPUT_POINT(x, y);
- }
+ if ((!pt2_clipped) && (pGC->capStyle != CapNotLast) &&
+ (((xstart != x2) || (ystart != y2)) || (ppt == pptInit + 1))) {
+ MI_OUTPUT_POINT(x, y);
+ }
if (Nspans > 0)
- (*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit,
- pwidthInit, FALSE);
+ (*pGC->ops->FillSpans) (pDraw, pGC, Nspans, pspanInit,
+ pwidthInit, FALSE);
free(pwidthInit);
free(pspanInit);
}
void
-miZeroDashLine(
- DrawablePtr dst,
- GCPtr pgc,
- int mode,
- int nptInit, /* number of points in polyline */
- DDXPointRec *pptInit /* points in the polyline */
- )
+miZeroDashLine(DrawablePtr dst, GCPtr pgc, int mode, int nptInit, /* number of points in polyline */
+ DDXPointRec * pptInit /* points in the polyline */
+ )
{
/* XXX kludge until real zero-width dash code is written */
pgc->lineWidth = 1;
- miWideDash (dst, pgc, mode, nptInit, pptInit);
+ miWideDash(dst, pgc, mode, nptInit, pptInit);
pgc->lineWidth = 0;
}
diff --git a/xorg-server/miext/cw/cw.c b/xorg-server/miext/cw/cw.c
index db06209d9..87ced2f6a 100644
--- a/xorg-server/miext/cw/cw.c
+++ b/xorg-server/miext/cw/cw.c
@@ -1,527 +1,524 @@
-/*
- * Copyright © 2004 Eric Anholt
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Eric Anholt not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Eric Anholt makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "cw.h"
-
-#define CW_DEBUG 1
-
-#if CW_DEBUG
-#define CW_ASSERT(x) do { \
- if (!(x)) { \
- ErrorF("composite wrapper: assertion failed at %s:%d\n", __FUNC__, \
- __LINE__); \
- } \
-} while (0)
-#else
-#define CW_ASSERT(x) do {} while (0)
-#endif
-
-DevPrivateKeyRec cwGCKeyRec;
-DevPrivateKeyRec cwScreenKeyRec;
-DevPrivateKeyRec cwWindowKeyRec;
-DevPrivateKeyRec cwPictureKeyRec;
-
-extern GCOps cwGCOps;
-
-static Bool
-cwCloseScreen (int i, ScreenPtr pScreen);
-
-static void
-cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable);
-static void
-cwChangeGC(GCPtr pGC, unsigned long mask);
-static void
-cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
-static void
-cwDestroyGC(GCPtr pGC);
-static void
-cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
-static void
-cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
-static void
-cwDestroyClip(GCPtr pGC);
-
-GCFuncs cwGCFuncs = {
- cwValidateGC,
- cwChangeGC,
- cwCopyGC,
- cwDestroyGC,
- cwChangeClip,
- cwDestroyClip,
- cwCopyClip,
-};
-
-/* Find the real drawable to draw to, and provide offsets that will translate
- * window coordinates to backing pixmap coordinates.
- */
-DrawablePtr
-cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off)
-{
- PixmapPtr pPixmap;
-
- if (pDrawable->type == DRAWABLE_WINDOW &&
- (pPixmap = getCwPixmap ((WindowPtr) pDrawable)))
- {
- *x_off = pDrawable->x - pPixmap->screen_x;
- *y_off = pDrawable->y - pPixmap->screen_y;
- return &pPixmap->drawable;
- } else {
- *x_off = *y_off = 0;
- return pDrawable;
- }
-}
-
-#define FUNC_PROLOGUE(pGC, pPriv) do { \
- (pGC)->funcs = (pPriv)->wrapFuncs; \
- (pGC)->ops = (pPriv)->wrapOps; \
-} while (0)
-
-#define FUNC_EPILOGUE(pGC, pPriv) do { \
- (pPriv)->wrapFuncs = (pGC)->funcs; \
- (pPriv)->wrapOps = (pGC)->ops; \
- (pGC)->funcs = &cwGCFuncs; \
- (pGC)->ops = &cwGCOps; \
-} while (0)
-
-
-static Bool
-cwCreateBackingGC(GCPtr pGC, DrawablePtr pDrawable)
-{
- cwGCRec *pPriv = getCwGC(pGC);
- int status, x_off, y_off;
- XID noexpose = xFalse;
- DrawablePtr pBackingDrawable;
-
- pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
- pPriv->pBackingGC = CreateGC(pBackingDrawable, GCGraphicsExposures,
- &noexpose, &status, (XID)0, serverClient);
- if (status != Success)
- return FALSE;
-
- pPriv->serialNumber = 0;
- pPriv->stateChanges = GCAllBits;
-
- return TRUE;
-}
-
-static void
-cwDestroyBackingGC(GCPtr pGC)
-{
- cwGCPtr pPriv;
-
- pPriv = (cwGCPtr) getCwGC (pGC);
-
- if (pPriv->pBackingGC) {
- FreeGC(pPriv->pBackingGC, (XID)0);
- pPriv->pBackingGC = NULL;
- }
-}
-
-static void
-cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
-{
- GCPtr pBackingGC;
- cwGCPtr pPriv;
- DrawablePtr pBackingDrawable;
- int x_off, y_off;
-
- pPriv = (cwGCPtr) getCwGC (pGC);
-
- FUNC_PROLOGUE(pGC, pPriv);
-
- /*
- * Must call ValidateGC to ensure pGC->pCompositeClip is valid
- */
- (*pGC->funcs->ValidateGC)(pGC, stateChanges, pDrawable);
-
- if (!cwDrawableIsRedirWindow(pDrawable)) {
- cwDestroyBackingGC(pGC);
- FUNC_EPILOGUE(pGC, pPriv);
- return;
- } else {
- if (!pPriv->pBackingGC && !cwCreateBackingGC(pGC, pDrawable)) {
- FUNC_EPILOGUE(pGC, pPriv);
- return;
- }
- }
-
- pBackingGC = pPriv->pBackingGC;
- pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
-
- pPriv->stateChanges |= stateChanges;
-
- /*
- * Copy the composite clip into the backing GC if either
- * the drawable clip list has changed or the client has changed
- * the client clip data
- */
- if (pDrawable->serialNumber != pPriv->serialNumber ||
- (pPriv->stateChanges & (GCClipXOrigin|GCClipYOrigin|GCClipMask)))
- {
- ChangeGCVal vals[2];
- RegionPtr pCompositeClip;
-
- pCompositeClip = RegionCreate(NULL, 0);
- RegionCopy(pCompositeClip, pGC->pCompositeClip);
-
- /* Either the drawable has changed, or the clip list in the drawable has
- * changed. Copy the new clip list over and set the new translated
- * offset for it.
- */
-
- (*pBackingGC->funcs->ChangeClip) (pBackingGC, CT_REGION,
- (pointer) pCompositeClip, 0);
-
- vals[0].val = x_off - pDrawable->x;
- vals[1].val = y_off - pDrawable->y;
- ChangeGC(NullClient, pBackingGC,
- (GCClipXOrigin | GCClipYOrigin), vals);
-
- pPriv->serialNumber = pDrawable->serialNumber;
- /*
- * Mask off any client clip changes to make sure
- * the clip list set above remains in effect
- */
- pPriv->stateChanges &= ~(GCClipXOrigin|GCClipYOrigin|GCClipMask);
- }
-
- if (pPriv->stateChanges) {
- CopyGC(pGC, pBackingGC, pPriv->stateChanges);
- pPriv->stateChanges = 0;
- }
-
- if ((pGC->patOrg.x + x_off) != pBackingGC->patOrg.x ||
- (pGC->patOrg.y + y_off) != pBackingGC->patOrg.y)
- {
- ChangeGCVal vals[2];
- vals[0].val = pGC->patOrg.x + x_off;
- vals[1].val = pGC->patOrg.y + y_off;
- ChangeGC(NullClient, pBackingGC,
- (GCTileStipXOrigin | GCTileStipYOrigin), vals);
- }
-
- ValidateGC(pBackingDrawable, pBackingGC);
-
- FUNC_EPILOGUE(pGC, pPriv);
-}
-
-static void
-cwChangeGC(GCPtr pGC, unsigned long mask)
-{
- cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
-
- FUNC_PROLOGUE(pGC, pPriv);
-
- (*pGC->funcs->ChangeGC) (pGC, mask);
-
- FUNC_EPILOGUE(pGC, pPriv);
-}
-
-static void
-cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
-{
- cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGCDst->devPrivates, cwGCKey);
-
- FUNC_PROLOGUE(pGCDst, pPriv);
-
- (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
-
- FUNC_EPILOGUE(pGCDst, pPriv);
-}
-
-static void
-cwDestroyGC(GCPtr pGC)
-{
- cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
-
- FUNC_PROLOGUE(pGC, pPriv);
-
- cwDestroyBackingGC(pGC);
-
- (*pGC->funcs->DestroyGC) (pGC);
-
- /* leave it unwrapped */
-}
-
-static void
-cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
-{
- cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
-
- FUNC_PROLOGUE(pGC, pPriv);
-
- (*pGC->funcs->ChangeClip)(pGC, type, pvalue, nrects);
-
- FUNC_EPILOGUE(pGC, pPriv);
-}
-
-static void
-cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pgcDst->devPrivates, cwGCKey);
-
- FUNC_PROLOGUE(pgcDst, pPriv);
-
- (*pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
-
- FUNC_EPILOGUE(pgcDst, pPriv);
-}
-
-static void
-cwDestroyClip(GCPtr pGC)
-{
- cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
-
- FUNC_PROLOGUE(pGC, pPriv);
-
- (*pGC->funcs->DestroyClip)(pGC);
-
- FUNC_EPILOGUE(pGC, pPriv);
-}
-
-/*
- * Screen wrappers.
- */
-
-#define SCREEN_PROLOGUE(pScreen, field) \
- ((pScreen)->field = getCwScreen(pScreen)->field)
-
-#define SCREEN_EPILOGUE(pScreen, field, wrapper) do { \
- getCwScreen(pScreen)->field = (pScreen)->field; \
- (pScreen)->field = (wrapper); \
-} while (0)
-
-static Bool
-cwCreateGC(GCPtr pGC)
-{
- cwGCPtr pPriv = getCwGC(pGC);
- ScreenPtr pScreen = pGC->pScreen;
- Bool ret;
-
- SCREEN_PROLOGUE(pScreen, CreateGC);
-
- if ( (ret = (*pScreen->CreateGC)(pGC)) )
- FUNC_EPILOGUE(pGC, pPriv);
-
- SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC);
-
- return ret;
-}
-
-static void
-cwGetImage(DrawablePtr pSrc, int x, int y, int w, int h, unsigned int format,
- unsigned long planemask, char *pdstLine)
-{
- ScreenPtr pScreen = pSrc->pScreen;
- DrawablePtr pBackingDrawable;
- int src_off_x, src_off_y;
-
- SCREEN_PROLOGUE(pScreen, GetImage);
-
- pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y);
-
- CW_OFFSET_XY_SRC(x, y);
-
- (*pScreen->GetImage)(pBackingDrawable, x, y, w, h, format, planemask,
- pdstLine);
-
- SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage);
-}
-
-static void
-cwGetSpans(DrawablePtr pSrc, int wMax, DDXPointPtr ppt, int *pwidth,
- int nspans, char *pdstStart)
-{
- ScreenPtr pScreen = pSrc->pScreen;
- DrawablePtr pBackingDrawable;
- int i;
- int src_off_x, src_off_y;
-
- SCREEN_PROLOGUE(pScreen, GetSpans);
-
- pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y);
-
- for (i = 0; i < nspans; i++)
- CW_OFFSET_XY_SRC(ppt[i].x, ppt[i].y);
-
- (*pScreen->GetSpans)(pBackingDrawable, wMax, ppt, pwidth, nspans,
- pdstStart);
-
- SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans);
-}
-
-
-static void
-cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- SCREEN_PROLOGUE(pScreen, CopyWindow);
-
- if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) {
- (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
- } else {
- GCPtr pGC;
- BoxPtr pExtents;
- int x_off, y_off;
- int dx, dy;
- PixmapPtr pBackingPixmap;
- RegionPtr pClip;
- int src_x, src_y, dst_x, dst_y, w, h;
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
-
- pExtents = RegionExtents(prgnSrc);
-
- pBackingPixmap = (PixmapPtr) cwGetBackingDrawable((DrawablePtr)pWin,
- &x_off, &y_off);
-
- src_x = pExtents->x1 - pBackingPixmap->screen_x;
- src_y = pExtents->y1 - pBackingPixmap->screen_y;
- w = pExtents->x2 - pExtents->x1;
- h = pExtents->y2 - pExtents->y1;
- dst_x = src_x - dx;
- dst_y = src_y - dy;
-
- /* Translate region (as required by API) */
- RegionTranslate(prgnSrc, -dx, -dy);
-
- pGC = GetScratchGC(pBackingPixmap->drawable.depth, pScreen);
- /*
- * Copy region to GC as clip, aligning as dest clip
- */
- pClip = RegionCreate(NULL, 0);
- RegionIntersect(pClip, &pWin->borderClip, prgnSrc);
- RegionTranslate(pClip,
- -pBackingPixmap->screen_x,
- -pBackingPixmap->screen_y);
-
- (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
-
- ValidateGC(&pBackingPixmap->drawable, pGC);
-
- (*pGC->ops->CopyArea) (&pBackingPixmap->drawable,
- &pBackingPixmap->drawable, pGC,
- src_x, src_y, w, h, dst_x, dst_y);
-
- (*pGC->funcs->DestroyClip) (pGC);
-
- FreeScratchGC(pGC);
- }
-
- SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
-}
-
-static PixmapPtr
-cwGetWindowPixmap (WindowPtr pWin)
-{
- PixmapPtr pPixmap = getCwPixmap (pWin);
-
- if (!pPixmap)
- {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- SCREEN_PROLOGUE(pScreen, GetWindowPixmap);
- if (pScreen->GetWindowPixmap)
- pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);
- }
- return pPixmap;
-}
-
-static void
-cwSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
-
- if (pPixmap == (*pScreen->GetScreenPixmap) (pScreen))
- pPixmap = NULL;
- setCwPixmap (pWindow, pPixmap);
-}
-
-/* Screen initialization/teardown */
-void
-miInitializeCompositeWrapper(ScreenPtr pScreen)
-{
- cwScreenPtr pScreenPriv;
- Bool has_render = GetPictureScreenIfSet(pScreen) != NULL;
-
- if (!dixRegisterPrivateKey(&cwScreenKeyRec, PRIVATE_SCREEN, 0))
- return;
-
- if (!dixRegisterPrivateKey(&cwGCKeyRec, PRIVATE_GC, sizeof(cwGCRec)))
- return;
-
- if (!dixRegisterPrivateKey(&cwWindowKeyRec, PRIVATE_WINDOW, 0))
- return;
-
- if (!dixRegisterPrivateKey(&cwPictureKeyRec, PRIVATE_PICTURE, 0))
- return;
-
- pScreenPriv = malloc(sizeof(cwScreenRec));
- if (!pScreenPriv)
- return;
-
- dixSetPrivate(&pScreen->devPrivates, cwScreenKey, pScreenPriv);
-
- SCREEN_EPILOGUE(pScreen, CloseScreen, cwCloseScreen);
- SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage);
- SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans);
- SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC);
- SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
-
- SCREEN_EPILOGUE(pScreen, SetWindowPixmap, cwSetWindowPixmap);
- SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);
-
- if (has_render)
- cwInitializeRender(pScreen);
-}
-
-static Bool
-cwCloseScreen (int i, ScreenPtr pScreen)
-{
- cwScreenPtr pScreenPriv;
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
- pScreenPriv = (cwScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- cwScreenKey);
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- pScreen->GetImage = pScreenPriv->GetImage;
- pScreen->GetSpans = pScreenPriv->GetSpans;
- pScreen->CreateGC = pScreenPriv->CreateGC;
- pScreen->CopyWindow = pScreenPriv->CopyWindow;
-
- if (ps)
- cwFiniRender(pScreen);
-
- free((pointer)pScreenPriv);
-
- return (*pScreen->CloseScreen)(i, pScreen);
-}
+/*
+ * Copyright © 2004 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "cw.h"
+
+#define CW_DEBUG 1
+
+#if CW_DEBUG
+#define CW_ASSERT(x) do { \
+ if (!(x)) { \
+ ErrorF("composite wrapper: assertion failed at %s:%d\n", __FUNC__, \
+ __LINE__); \
+ } \
+} while (0)
+#else
+#define CW_ASSERT(x) do {} while (0)
+#endif
+
+DevPrivateKeyRec cwGCKeyRec;
+DevPrivateKeyRec cwScreenKeyRec;
+DevPrivateKeyRec cwWindowKeyRec;
+DevPrivateKeyRec cwPictureKeyRec;
+
+extern GCOps cwGCOps;
+
+static Bool
+ cwCloseScreen(int i, ScreenPtr pScreen);
+
+static void
+ cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable);
+static void
+ cwChangeGC(GCPtr pGC, unsigned long mask);
+static void
+ cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void
+ cwDestroyGC(GCPtr pGC);
+static void
+ cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+static void
+ cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+static void
+ cwDestroyClip(GCPtr pGC);
+
+GCFuncs cwGCFuncs = {
+ cwValidateGC,
+ cwChangeGC,
+ cwCopyGC,
+ cwDestroyGC,
+ cwChangeClip,
+ cwDestroyClip,
+ cwCopyClip,
+};
+
+/* Find the real drawable to draw to, and provide offsets that will translate
+ * window coordinates to backing pixmap coordinates.
+ */
+DrawablePtr
+cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off)
+{
+ PixmapPtr pPixmap;
+
+ if (pDrawable->type == DRAWABLE_WINDOW &&
+ (pPixmap = getCwPixmap((WindowPtr) pDrawable))) {
+ *x_off = pDrawable->x - pPixmap->screen_x;
+ *y_off = pDrawable->y - pPixmap->screen_y;
+ return &pPixmap->drawable;
+ }
+ else {
+ *x_off = *y_off = 0;
+ return pDrawable;
+ }
+}
+
+#define FUNC_PROLOGUE(pGC, pPriv) do { \
+ (pGC)->funcs = (pPriv)->wrapFuncs; \
+ (pGC)->ops = (pPriv)->wrapOps; \
+} while (0)
+
+#define FUNC_EPILOGUE(pGC, pPriv) do { \
+ (pPriv)->wrapFuncs = (pGC)->funcs; \
+ (pPriv)->wrapOps = (pGC)->ops; \
+ (pGC)->funcs = &cwGCFuncs; \
+ (pGC)->ops = &cwGCOps; \
+} while (0)
+
+static Bool
+cwCreateBackingGC(GCPtr pGC, DrawablePtr pDrawable)
+{
+ cwGCRec *pPriv = getCwGC(pGC);
+ int status, x_off, y_off;
+ XID noexpose = xFalse;
+ DrawablePtr pBackingDrawable;
+
+ pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
+ pPriv->pBackingGC = CreateGC(pBackingDrawable, GCGraphicsExposures,
+ &noexpose, &status, (XID) 0, serverClient);
+ if (status != Success)
+ return FALSE;
+
+ pPriv->serialNumber = 0;
+ pPriv->stateChanges = GCAllBits;
+
+ return TRUE;
+}
+
+static void
+cwDestroyBackingGC(GCPtr pGC)
+{
+ cwGCPtr pPriv;
+
+ pPriv = (cwGCPtr) getCwGC(pGC);
+
+ if (pPriv->pBackingGC) {
+ FreeGC(pPriv->pBackingGC, (XID) 0);
+ pPriv->pBackingGC = NULL;
+ }
+}
+
+static void
+cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
+{
+ GCPtr pBackingGC;
+ cwGCPtr pPriv;
+ DrawablePtr pBackingDrawable;
+ int x_off, y_off;
+
+ pPriv = (cwGCPtr) getCwGC(pGC);
+
+ FUNC_PROLOGUE(pGC, pPriv);
+
+ /*
+ * Must call ValidateGC to ensure pGC->pCompositeClip is valid
+ */
+ (*pGC->funcs->ValidateGC) (pGC, stateChanges, pDrawable);
+
+ if (!cwDrawableIsRedirWindow(pDrawable)) {
+ cwDestroyBackingGC(pGC);
+ FUNC_EPILOGUE(pGC, pPriv);
+ return;
+ }
+ else {
+ if (!pPriv->pBackingGC && !cwCreateBackingGC(pGC, pDrawable)) {
+ FUNC_EPILOGUE(pGC, pPriv);
+ return;
+ }
+ }
+
+ pBackingGC = pPriv->pBackingGC;
+ pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
+
+ pPriv->stateChanges |= stateChanges;
+
+ /*
+ * Copy the composite clip into the backing GC if either
+ * the drawable clip list has changed or the client has changed
+ * the client clip data
+ */
+ if (pDrawable->serialNumber != pPriv->serialNumber ||
+ (pPriv->stateChanges & (GCClipXOrigin | GCClipYOrigin | GCClipMask))) {
+ ChangeGCVal vals[2];
+ RegionPtr pCompositeClip;
+
+ pCompositeClip = RegionCreate(NULL, 0);
+ RegionCopy(pCompositeClip, pGC->pCompositeClip);
+
+ /* Either the drawable has changed, or the clip list in the drawable has
+ * changed. Copy the new clip list over and set the new translated
+ * offset for it.
+ */
+
+ (*pBackingGC->funcs->ChangeClip) (pBackingGC, CT_REGION,
+ (pointer) pCompositeClip, 0);
+
+ vals[0].val = x_off - pDrawable->x;
+ vals[1].val = y_off - pDrawable->y;
+ ChangeGC(NullClient, pBackingGC, (GCClipXOrigin | GCClipYOrigin), vals);
+
+ pPriv->serialNumber = pDrawable->serialNumber;
+ /*
+ * Mask off any client clip changes to make sure
+ * the clip list set above remains in effect
+ */
+ pPriv->stateChanges &= ~(GCClipXOrigin | GCClipYOrigin | GCClipMask);
+ }
+
+ if (pPriv->stateChanges) {
+ CopyGC(pGC, pBackingGC, pPriv->stateChanges);
+ pPriv->stateChanges = 0;
+ }
+
+ if ((pGC->patOrg.x + x_off) != pBackingGC->patOrg.x ||
+ (pGC->patOrg.y + y_off) != pBackingGC->patOrg.y) {
+ ChangeGCVal vals[2];
+
+ vals[0].val = pGC->patOrg.x + x_off;
+ vals[1].val = pGC->patOrg.y + y_off;
+ ChangeGC(NullClient, pBackingGC,
+ (GCTileStipXOrigin | GCTileStipYOrigin), vals);
+ }
+
+ ValidateGC(pBackingDrawable, pBackingGC);
+
+ FUNC_EPILOGUE(pGC, pPriv);
+}
+
+static void
+cwChangeGC(GCPtr pGC, unsigned long mask)
+{
+ cwGCPtr pPriv = (cwGCPtr) dixLookupPrivate(&pGC->devPrivates, cwGCKey);
+
+ FUNC_PROLOGUE(pGC, pPriv);
+
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+
+ FUNC_EPILOGUE(pGC, pPriv);
+}
+
+static void
+cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
+{
+ cwGCPtr pPriv = (cwGCPtr) dixLookupPrivate(&pGCDst->devPrivates, cwGCKey);
+
+ FUNC_PROLOGUE(pGCDst, pPriv);
+
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+
+ FUNC_EPILOGUE(pGCDst, pPriv);
+}
+
+static void
+cwDestroyGC(GCPtr pGC)
+{
+ cwGCPtr pPriv = (cwGCPtr) dixLookupPrivate(&pGC->devPrivates, cwGCKey);
+
+ FUNC_PROLOGUE(pGC, pPriv);
+
+ cwDestroyBackingGC(pGC);
+
+ (*pGC->funcs->DestroyGC) (pGC);
+
+ /* leave it unwrapped */
+}
+
+static void
+cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+{
+ cwGCPtr pPriv = (cwGCPtr) dixLookupPrivate(&pGC->devPrivates, cwGCKey);
+
+ FUNC_PROLOGUE(pGC, pPriv);
+
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+
+ FUNC_EPILOGUE(pGC, pPriv);
+}
+
+static void
+cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ cwGCPtr pPriv = (cwGCPtr) dixLookupPrivate(&pgcDst->devPrivates, cwGCKey);
+
+ FUNC_PROLOGUE(pgcDst, pPriv);
+
+ (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
+
+ FUNC_EPILOGUE(pgcDst, pPriv);
+}
+
+static void
+cwDestroyClip(GCPtr pGC)
+{
+ cwGCPtr pPriv = (cwGCPtr) dixLookupPrivate(&pGC->devPrivates, cwGCKey);
+
+ FUNC_PROLOGUE(pGC, pPriv);
+
+ (*pGC->funcs->DestroyClip) (pGC);
+
+ FUNC_EPILOGUE(pGC, pPriv);
+}
+
+/*
+ * Screen wrappers.
+ */
+
+#define SCREEN_PROLOGUE(pScreen, field) \
+ ((pScreen)->field = getCwScreen(pScreen)->field)
+
+#define SCREEN_EPILOGUE(pScreen, field, wrapper) do { \
+ getCwScreen(pScreen)->field = (pScreen)->field; \
+ (pScreen)->field = (wrapper); \
+} while (0)
+
+static Bool
+cwCreateGC(GCPtr pGC)
+{
+ cwGCPtr pPriv = getCwGC(pGC);
+ ScreenPtr pScreen = pGC->pScreen;
+ Bool ret;
+
+ SCREEN_PROLOGUE(pScreen, CreateGC);
+
+ if ((ret = (*pScreen->CreateGC) (pGC)))
+ FUNC_EPILOGUE(pGC, pPriv);
+
+ SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC);
+
+ return ret;
+}
+
+static void
+cwGetImage(DrawablePtr pSrc, int x, int y, int w, int h, unsigned int format,
+ unsigned long planemask, char *pdstLine)
+{
+ ScreenPtr pScreen = pSrc->pScreen;
+ DrawablePtr pBackingDrawable;
+ int src_off_x, src_off_y;
+
+ SCREEN_PROLOGUE(pScreen, GetImage);
+
+ pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y);
+
+ CW_OFFSET_XY_SRC(x, y);
+
+ (*pScreen->GetImage) (pBackingDrawable, x, y, w, h, format, planemask,
+ pdstLine);
+
+ SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage);
+}
+
+static void
+cwGetSpans(DrawablePtr pSrc, int wMax, DDXPointPtr ppt, int *pwidth,
+ int nspans, char *pdstStart)
+{
+ ScreenPtr pScreen = pSrc->pScreen;
+ DrawablePtr pBackingDrawable;
+ int i;
+ int src_off_x, src_off_y;
+
+ SCREEN_PROLOGUE(pScreen, GetSpans);
+
+ pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y);
+
+ for (i = 0; i < nspans; i++)
+ CW_OFFSET_XY_SRC(ppt[i].x, ppt[i].y);
+
+ (*pScreen->GetSpans) (pBackingDrawable, wMax, ppt, pwidth, nspans,
+ pdstStart);
+
+ SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans);
+}
+
+static void
+cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ SCREEN_PROLOGUE(pScreen, CopyWindow);
+
+ if (!cwDrawableIsRedirWindow((DrawablePtr) pWin)) {
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ }
+ else {
+ GCPtr pGC;
+ BoxPtr pExtents;
+ int x_off, y_off;
+ int dx, dy;
+ PixmapPtr pBackingPixmap;
+ RegionPtr pClip;
+ int src_x, src_y, dst_x, dst_y, w, h;
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+
+ pExtents = RegionExtents(prgnSrc);
+
+ pBackingPixmap = (PixmapPtr) cwGetBackingDrawable((DrawablePtr) pWin,
+ &x_off, &y_off);
+
+ src_x = pExtents->x1 - pBackingPixmap->screen_x;
+ src_y = pExtents->y1 - pBackingPixmap->screen_y;
+ w = pExtents->x2 - pExtents->x1;
+ h = pExtents->y2 - pExtents->y1;
+ dst_x = src_x - dx;
+ dst_y = src_y - dy;
+
+ /* Translate region (as required by API) */
+ RegionTranslate(prgnSrc, -dx, -dy);
+
+ pGC = GetScratchGC(pBackingPixmap->drawable.depth, pScreen);
+ /*
+ * Copy region to GC as clip, aligning as dest clip
+ */
+ pClip = RegionCreate(NULL, 0);
+ RegionIntersect(pClip, &pWin->borderClip, prgnSrc);
+ RegionTranslate(pClip,
+ -pBackingPixmap->screen_x, -pBackingPixmap->screen_y);
+
+ (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
+
+ ValidateGC(&pBackingPixmap->drawable, pGC);
+
+ (*pGC->ops->CopyArea) (&pBackingPixmap->drawable,
+ &pBackingPixmap->drawable, pGC,
+ src_x, src_y, w, h, dst_x, dst_y);
+
+ (*pGC->funcs->DestroyClip) (pGC);
+
+ FreeScratchGC(pGC);
+ }
+
+ SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
+}
+
+static PixmapPtr
+cwGetWindowPixmap(WindowPtr pWin)
+{
+ PixmapPtr pPixmap = getCwPixmap(pWin);
+
+ if (!pPixmap) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ SCREEN_PROLOGUE(pScreen, GetWindowPixmap);
+ if (pScreen->GetWindowPixmap)
+ pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);
+ }
+ return pPixmap;
+}
+
+static void
+cwSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+
+ if (pPixmap == (*pScreen->GetScreenPixmap) (pScreen))
+ pPixmap = NULL;
+ setCwPixmap(pWindow, pPixmap);
+}
+
+/* Screen initialization/teardown */
+void
+miInitializeCompositeWrapper(ScreenPtr pScreen)
+{
+ cwScreenPtr pScreenPriv;
+ Bool has_render = GetPictureScreenIfSet(pScreen) != NULL;
+
+ if (!dixRegisterPrivateKey(&cwScreenKeyRec, PRIVATE_SCREEN, 0))
+ return;
+
+ if (!dixRegisterPrivateKey(&cwGCKeyRec, PRIVATE_GC, sizeof(cwGCRec)))
+ return;
+
+ if (!dixRegisterPrivateKey(&cwWindowKeyRec, PRIVATE_WINDOW, 0))
+ return;
+
+ if (!dixRegisterPrivateKey(&cwPictureKeyRec, PRIVATE_PICTURE, 0))
+ return;
+
+ pScreenPriv = malloc(sizeof(cwScreenRec));
+ if (!pScreenPriv)
+ return;
+
+ dixSetPrivate(&pScreen->devPrivates, cwScreenKey, pScreenPriv);
+
+ SCREEN_EPILOGUE(pScreen, CloseScreen, cwCloseScreen);
+ SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage);
+ SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans);
+ SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC);
+ SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
+
+ SCREEN_EPILOGUE(pScreen, SetWindowPixmap, cwSetWindowPixmap);
+ SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);
+
+ if (has_render)
+ cwInitializeRender(pScreen);
+}
+
+static Bool
+cwCloseScreen(int i, ScreenPtr pScreen)
+{
+ cwScreenPtr pScreenPriv;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+
+ pScreenPriv = (cwScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+ cwScreenKey);
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->GetImage = pScreenPriv->GetImage;
+ pScreen->GetSpans = pScreenPriv->GetSpans;
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+ pScreen->CopyWindow = pScreenPriv->CopyWindow;
+
+ if (ps)
+ cwFiniRender(pScreen);
+
+ free((pointer) pScreenPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
diff --git a/xorg-server/miext/cw/cw_ops.c b/xorg-server/miext/cw/cw_ops.c
index 9ae56cb6c..ccc558074 100644
--- a/xorg-server/miext/cw/cw_ops.c
+++ b/xorg-server/miext/cw/cw_ops.c
@@ -65,76 +65,75 @@ extern GCFuncs cwGCFuncs;
*/
static void cwFillSpans(DrawablePtr pDst, GCPtr pGC, int nInit,
- DDXPointPtr pptInit, int *pwidthInit, int fSorted);
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted);
static void cwSetSpans(DrawablePtr pDst, GCPtr pGC, char *psrc,
- DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
static void cwPutImage(DrawablePtr pDst, GCPtr pGC, int depth,
- int x, int y, int w, int h, int leftPad, int format,
- char *pBits);
+ int x, int y, int w, int h, int leftPad, int format,
+ char *pBits);
static RegionPtr cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h,
- int dstx, int dsty);
+ int srcx, int srcy, int w, int h,
+ int dstx, int dsty);
static RegionPtr cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h,
- int dstx, int dsty, unsigned long plane);
+ int srcx, int srcy, int w, int h,
+ int dstx, int dsty, unsigned long plane);
static void cwPolyPoint(DrawablePtr pDst, GCPtr pGC, int mode, int npt,
- xPoint *pptInit);
+ xPoint * pptInit);
static void cwPolylines(DrawablePtr pDst, GCPtr pGC, int mode, int npt,
- DDXPointPtr pptInit);
+ DDXPointPtr pptInit);
static void cwPolySegment(DrawablePtr pDst, GCPtr pGC, int nseg,
- xSegment *pSegs);
+ xSegment * pSegs);
static void cwPolyRectangle(DrawablePtr pDst, GCPtr pGC,
- int nrects, xRectangle *pRects);
-static void cwPolyArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *parcs);
+ int nrects, xRectangle *pRects);
+static void cwPolyArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc * parcs);
static void cwFillPolygon(DrawablePtr pDst, GCPtr pGC, int shape, int mode,
- int count, DDXPointPtr pPts);
+ int count, DDXPointPtr pPts);
static void cwPolyFillRect(DrawablePtr pDst, GCPtr pGC,
- int nrectFill, xRectangle *prectInit);
-static void cwPolyFillArc(DrawablePtr pDst, GCPtr pGC,
- int narcs, xArc *parcs);
+ int nrectFill, xRectangle *prectInit);
+static void cwPolyFillArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc * parcs);
static int cwPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
- int count, char *chars);
+ int count, char *chars);
static int cwPolyText16(DrawablePtr pDst, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
+ int count, unsigned short *chars);
static void cwImageText8(DrawablePtr pDst, GCPtr pGC, int x, int y,
- int count, char *chars);
+ int count, char *chars);
static void cwImageText16(DrawablePtr pDst, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
+ int count, unsigned short *chars);
static void cwImageGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y,
- unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase);
+ unsigned int nglyph, CharInfoPtr * ppci,
+ pointer pglyphBase);
static void cwPolyGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y,
- unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase);
+ unsigned int nglyph, CharInfoPtr * ppci,
+ pointer pglyphBase);
static void cwPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
- int w, int h, int x, int y);
+ int w, int h, int x, int y);
GCOps cwGCOps = {
- cwFillSpans,
- cwSetSpans,
- cwPutImage,
- cwCopyArea,
- cwCopyPlane,
- cwPolyPoint,
- cwPolylines,
- cwPolySegment,
- cwPolyRectangle,
- cwPolyArc,
- cwFillPolygon,
- cwPolyFillRect,
- cwPolyFillArc,
- cwPolyText8,
- cwPolyText16,
- cwImageText8,
- cwImageText16,
- cwImageGlyphBlt,
- cwPolyGlyphBlt,
- cwPushPixels
+ cwFillSpans,
+ cwSetSpans,
+ cwPutImage,
+ cwCopyArea,
+ cwCopyPlane,
+ cwPolyPoint,
+ cwPolylines,
+ cwPolySegment,
+ cwPolyRectangle,
+ cwPolyArc,
+ cwFillPolygon,
+ cwPolyFillRect,
+ cwPolyFillArc,
+ cwPolyText8,
+ cwPolyText16,
+ cwImageText8,
+ cwImageText16,
+ cwImageGlyphBlt,
+ cwPolyGlyphBlt,
+ cwPushPixels
};
static void
cwFillSpans(DrawablePtr pDst, GCPtr pGC, int nspans, DDXPointPtr ppt,
- int *pwidth, int fSorted)
+ int *pwidth, int fSorted)
{
SETUP_BACKING_DST(pDst, pGC);
@@ -142,15 +141,15 @@ cwFillSpans(DrawablePtr pDst, GCPtr pGC, int nspans, DDXPointPtr ppt,
CW_OFFSET_XYPOINTS(ppt, nspans);
- (*pBackingGC->ops->FillSpans)(pBackingDst, pBackingGC, nspans, ppt,
- pwidth, fSorted);
+ (*pBackingGC->ops->FillSpans) (pBackingDst, pBackingGC, nspans, ppt,
+ pwidth, fSorted);
EPILOGUE(pGC);
}
static void
cwSetSpans(DrawablePtr pDst, GCPtr pGC, char *psrc, DDXPointPtr ppt,
- int *pwidth, int nspans, int fSorted)
+ int *pwidth, int nspans, int fSorted)
{
SETUP_BACKING_DST(pDst, pGC);
@@ -158,15 +157,15 @@ cwSetSpans(DrawablePtr pDst, GCPtr pGC, char *psrc, DDXPointPtr ppt,
CW_OFFSET_XYPOINTS(ppt, nspans);
- (*pBackingGC->ops->SetSpans)(pBackingDst, pBackingGC, psrc, ppt, pwidth,
- nspans, fSorted);
+ (*pBackingGC->ops->SetSpans) (pBackingDst, pBackingGC, psrc, ppt, pwidth,
+ nspans, fSorted);
EPILOGUE(pGC);
}
static void
cwPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, int w, int h,
- int leftPad, int format, char *pBits)
+ int leftPad, int format, char *pBits)
{
SETUP_BACKING_DST(pDst, pGC);
@@ -174,18 +173,19 @@ cwPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, int w, int h,
CW_OFFSET_XY_DST(x, y);
- (*pBackingGC->ops->PutImage)(pBackingDst, pBackingGC, depth, x, y, w, h,
- leftPad, format, pBits);
+ (*pBackingGC->ops->PutImage) (pBackingDst, pBackingGC, depth, x, y, w, h,
+ leftPad, format, pBits);
EPILOGUE(pGC);
}
static RegionPtr
cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
- int w, int h, int dstx, int dsty)
+ int w, int h, int dstx, int dsty)
{
- int odstx, odsty;
- int osrcx, osrcy;
+ int odstx, odsty;
+ int osrcx, osrcy;
+
SETUP_BACKING_DST(pDst, pGC);
SETUP_BACKING_SRC(pSrc, pGC);
@@ -198,23 +198,22 @@ cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
CW_OFFSET_XY_DST(dstx, dsty);
CW_OFFSET_XY_SRC(srcx, srcy);
- (*pBackingGC->ops->CopyArea)(pBackingSrc, pBackingDst,
- pBackingGC, srcx, srcy, w, h,
- dstx, dsty);
-
+ (*pBackingGC->ops->CopyArea) (pBackingSrc, pBackingDst,
+ pBackingGC, srcx, srcy, w, h, dstx, dsty);
+
EPILOGUE(pGC);
return miHandleExposures(pSrc, pDst, pGC,
- osrcx, osrcy, w, h,
- odstx, odsty, 0);
+ osrcx, osrcy, w, h, odstx, odsty, 0);
}
static RegionPtr
cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
- int w, int h, int dstx, int dsty, unsigned long plane)
+ int w, int h, int dstx, int dsty, unsigned long plane)
{
- int odstx, odsty;
- int osrcx, osrcy;
+ int odstx, odsty;
+ int osrcx, osrcy;
+
SETUP_BACKING_DST(pDst, pGC);
SETUP_BACKING_SRC(pSrc, pGC);
@@ -227,30 +226,29 @@ cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
CW_OFFSET_XY_DST(dstx, dsty);
CW_OFFSET_XY_SRC(srcx, srcy);
- (*pBackingGC->ops->CopyPlane)(pBackingSrc, pBackingDst,
- pBackingGC, srcx, srcy, w, h,
- dstx, dsty, plane);
+ (*pBackingGC->ops->CopyPlane) (pBackingSrc, pBackingDst,
+ pBackingGC, srcx, srcy, w, h,
+ dstx, dsty, plane);
EPILOGUE(pGC);
return miHandleExposures(pSrc, pDst, pGC,
- osrcx, osrcy, w, h,
- odstx, odsty, plane);
+ osrcx, osrcy, w, h, odstx, odsty, plane);
}
static void
-cwPolyPoint(DrawablePtr pDst, GCPtr pGC, int mode, int npt, xPoint *ppt)
+cwPolyPoint(DrawablePtr pDst, GCPtr pGC, int mode, int npt, xPoint * ppt)
{
SETUP_BACKING_DST(pDst, pGC);
PROLOGUE(pGC);
if (mode == CoordModeOrigin)
- CW_OFFSET_XYPOINTS(ppt, npt);
+ CW_OFFSET_XYPOINTS(ppt, npt);
else
- CW_OFFSET_XYPOINTS(ppt, 1);
+ CW_OFFSET_XYPOINTS(ppt, 1);
- (*pBackingGC->ops->PolyPoint)(pBackingDst, pBackingGC, mode, npt, ppt);
+ (*pBackingGC->ops->PolyPoint) (pBackingDst, pBackingGC, mode, npt, ppt);
EPILOGUE(pGC);
}
@@ -263,17 +261,17 @@ cwPolylines(DrawablePtr pDst, GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
PROLOGUE(pGC);
if (mode == CoordModeOrigin)
- CW_OFFSET_XYPOINTS(ppt, npt);
+ CW_OFFSET_XYPOINTS(ppt, npt);
else
- CW_OFFSET_XYPOINTS(ppt, 1);
+ CW_OFFSET_XYPOINTS(ppt, 1);
- (*pBackingGC->ops->Polylines)(pBackingDst, pBackingGC, mode, npt, ppt);
+ (*pBackingGC->ops->Polylines) (pBackingDst, pBackingGC, mode, npt, ppt);
EPILOGUE(pGC);
}
static void
-cwPolySegment(DrawablePtr pDst, GCPtr pGC, int nseg, xSegment *pSegs)
+cwPolySegment(DrawablePtr pDst, GCPtr pGC, int nseg, xSegment * pSegs)
{
SETUP_BACKING_DST(pDst, pGC);
@@ -281,7 +279,7 @@ cwPolySegment(DrawablePtr pDst, GCPtr pGC, int nseg, xSegment *pSegs)
CW_OFFSET_XYPOINTS(pSegs, nseg * 2);
- (*pBackingGC->ops->PolySegment)(pBackingDst, pBackingGC, nseg, pSegs);
+ (*pBackingGC->ops->PolySegment) (pBackingDst, pBackingGC, nseg, pSegs);
EPILOGUE(pGC);
}
@@ -295,13 +293,13 @@ cwPolyRectangle(DrawablePtr pDst, GCPtr pGC, int nrects, xRectangle *pRects)
CW_OFFSET_RECTS(pRects, nrects);
- (*pBackingGC->ops->PolyRectangle)(pBackingDst, pBackingGC, nrects, pRects);
+ (*pBackingGC->ops->PolyRectangle) (pBackingDst, pBackingGC, nrects, pRects);
EPILOGUE(pGC);
}
static void
-cwPolyArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *pArcs)
+cwPolyArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc * pArcs)
{
SETUP_BACKING_DST(pDst, pGC);
@@ -309,26 +307,26 @@ cwPolyArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *pArcs)
CW_OFFSET_RECTS(pArcs, narcs);
- (*pBackingGC->ops->PolyArc)(pBackingDst, pBackingGC, narcs, pArcs);
+ (*pBackingGC->ops->PolyArc) (pBackingDst, pBackingGC, narcs, pArcs);
EPILOGUE(pGC);
}
static void
cwFillPolygon(DrawablePtr pDst, GCPtr pGC, int shape, int mode, int npt,
- DDXPointPtr ppt)
+ DDXPointPtr ppt)
{
SETUP_BACKING_DST(pDst, pGC);
PROLOGUE(pGC);
if (mode == CoordModeOrigin)
- CW_OFFSET_XYPOINTS(ppt, npt);
+ CW_OFFSET_XYPOINTS(ppt, npt);
else
- CW_OFFSET_XYPOINTS(ppt, 1);
+ CW_OFFSET_XYPOINTS(ppt, 1);
- (*pBackingGC->ops->FillPolygon)(pBackingDst, pBackingGC, shape, mode, npt,
- ppt);
+ (*pBackingGC->ops->FillPolygon) (pBackingDst, pBackingGC, shape, mode, npt,
+ ppt);
EPILOGUE(pGC);
}
@@ -342,13 +340,13 @@ cwPolyFillRect(DrawablePtr pDst, GCPtr pGC, int nrects, xRectangle *pRects)
CW_OFFSET_RECTS(pRects, nrects);
- (*pBackingGC->ops->PolyFillRect)(pBackingDst, pBackingGC, nrects, pRects);
+ (*pBackingGC->ops->PolyFillRect) (pBackingDst, pBackingGC, nrects, pRects);
EPILOGUE(pGC);
}
static void
-cwPolyFillArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *parcs)
+cwPolyFillArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc * parcs)
{
SETUP_BACKING_DST(pDst, pGC);
@@ -356,7 +354,7 @@ cwPolyFillArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *parcs)
CW_OFFSET_RECTS(parcs, narcs);
- (*pBackingGC->ops->PolyFillArc)(pBackingDst, pBackingGC, narcs, parcs);
+ (*pBackingGC->ops->PolyFillArc) (pBackingDst, pBackingGC, narcs, parcs);
EPILOGUE(pGC);
}
@@ -365,14 +363,15 @@ static int
cwPolyText8(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, char *chars)
{
int result;
+
SETUP_BACKING_DST(pDst, pGC);
PROLOGUE(pGC);
CW_OFFSET_XY_DST(x, y);
- result = (*pBackingGC->ops->PolyText8)(pBackingDst, pBackingGC, x, y,
- count, chars);
+ result = (*pBackingGC->ops->PolyText8) (pBackingDst, pBackingGC, x, y,
+ count, chars);
EPILOGUE(pGC);
@@ -381,17 +380,18 @@ cwPolyText8(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, char *chars)
static int
cwPolyText16(DrawablePtr pDst, GCPtr pGC, int x, int y, int count,
- unsigned short *chars)
+ unsigned short *chars)
{
int result;
+
SETUP_BACKING_DST(pDst, pGC);
PROLOGUE(pGC);
CW_OFFSET_XY_DST(x, y);
- result = (*pBackingGC->ops->PolyText16)(pBackingDst, pBackingGC, x, y,
- count, chars);
+ result = (*pBackingGC->ops->PolyText16) (pBackingDst, pBackingGC, x, y,
+ count, chars);
EPILOGUE(pGC);
return result;
@@ -406,15 +406,15 @@ cwImageText8(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, char *chars)
CW_OFFSET_XY_DST(x, y);
- (*pBackingGC->ops->ImageText8)(pBackingDst, pBackingGC, x, y, count,
- chars);
+ (*pBackingGC->ops->ImageText8) (pBackingDst, pBackingGC, x, y, count,
+ chars);
EPILOGUE(pGC);
}
static void
cwImageText16(DrawablePtr pDst, GCPtr pGC, int x, int y, int count,
- unsigned short *chars)
+ unsigned short *chars)
{
SETUP_BACKING_DST(pDst, pGC);
@@ -422,15 +422,15 @@ cwImageText16(DrawablePtr pDst, GCPtr pGC, int x, int y, int count,
CW_OFFSET_XY_DST(x, y);
- (*pBackingGC->ops->ImageText16)(pBackingDst, pBackingGC, x, y, count,
- chars);
+ (*pBackingGC->ops->ImageText16) (pBackingDst, pBackingGC, x, y, count,
+ chars);
EPILOGUE(pGC);
}
static void
cwImageGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
+ CharInfoPtr * ppci, pointer pglyphBase)
{
SETUP_BACKING_DST(pDst, pGC);
@@ -438,15 +438,15 @@ cwImageGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y, unsigned int nglyph,
CW_OFFSET_XY_DST(x, y);
- (*pBackingGC->ops->ImageGlyphBlt)(pBackingDst, pBackingGC, x, y, nglyph,
- ppci, pglyphBase);
+ (*pBackingGC->ops->ImageGlyphBlt) (pBackingDst, pBackingGC, x, y, nglyph,
+ ppci, pglyphBase);
EPILOGUE(pGC);
}
static void
cwPolyGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
+ CharInfoPtr * ppci, pointer pglyphBase)
{
SETUP_BACKING_DST(pDst, pGC);
@@ -454,15 +454,15 @@ cwPolyGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y, unsigned int nglyph,
CW_OFFSET_XY_DST(x, y);
- (*pBackingGC->ops->PolyGlyphBlt)(pBackingDst, pBackingGC, x, y, nglyph,
- ppci, pglyphBase);
+ (*pBackingGC->ops->PolyGlyphBlt) (pBackingDst, pBackingGC, x, y, nglyph,
+ ppci, pglyphBase);
EPILOGUE(pGC);
}
static void
cwPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h,
- int x, int y)
+ int x, int y)
{
SETUP_BACKING_DST(pDst, pGC);
@@ -470,9 +470,8 @@ cwPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h,
CW_OFFSET_XY_DST(x, y);
- (*pBackingGC->ops->PushPixels)(pBackingGC, pBitMap, pBackingDst, w, h,
- x, y);
+ (*pBackingGC->ops->PushPixels) (pBackingGC, pBitMap, pBackingDst, w, h,
+ x, y);
EPILOGUE(pGC);
}
-
diff --git a/xorg-server/miext/cw/cw_render.c b/xorg-server/miext/cw/cw_render.c
index 25601f3e2..059d686fb 100644
--- a/xorg-server/miext/cw/cw_render.c
+++ b/xorg-server/miext/cw/cw_render.c
@@ -1,405 +1,383 @@
-/*
- * Copyright © 2004 Eric Anholt
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Eric Anholt not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Eric Anholt makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "cw.h"
-
-#define cwPsDecl(pScreen) \
- PictureScreenPtr ps = GetPictureScreen (pScreen); \
- cwScreenPtr pCwScreen = getCwScreen (pScreen)
-
-#define cwPicturePrivate \
- cwPicturePtr pPicturePrivate = getCwPicture(pPicture)
-
-#define cwSrcPictureDecl \
- int src_picture_x_off, src_picture_y_off; \
- PicturePtr pBackingSrcPicture = cwGetBackingPicture(pSrcPicture, \
- &src_picture_x_off,\
- &src_picture_y_off)
-
-#define cwDstPictureDecl \
- int dst_picture_x_off, dst_picture_y_off; \
- PicturePtr pBackingDstPicture = cwGetBackingPicture(pDstPicture, \
- &dst_picture_x_off,\
- &dst_picture_y_off)
-
-#define cwMskPictureDecl \
- int msk_picture_x_off = 0, msk_picture_y_off = 0; \
- PicturePtr pBackingMskPicture = (!pMskPicture ? 0 : \
- cwGetBackingPicture(pMskPicture, \
- &msk_picture_x_off,\
- &msk_picture_y_off))
-
-#define cwPsUnwrap(elt) { \
- ps->elt = pCwScreen->elt; \
-}
-
-#define cwPsWrap(elt,func) { \
- pCwScreen->elt = ps->elt; \
- ps->elt = func; \
-}
-
-static cwPicturePtr
-cwCreatePicturePrivate (PicturePtr pPicture)
-{
- WindowPtr pWindow = (WindowPtr) pPicture->pDrawable;
- PixmapPtr pPixmap = getCwPixmap (pWindow);
- int error;
- cwPicturePtr pPicturePrivate;
-
- pPicturePrivate = malloc(sizeof (cwPictureRec));
- if (!pPicturePrivate)
- return NULL;
-
- pPicturePrivate->pBackingPicture = CreatePicture (0, &pPixmap->drawable,
- pPicture->pFormat,
- 0, 0, serverClient,
- &error);
- if (!pPicturePrivate->pBackingPicture)
- {
- free(pPicturePrivate);
- return NULL;
- }
-
- /*
- * Ensure that this serial number does not match the window's
- */
- pPicturePrivate->serialNumber = pPixmap->drawable.serialNumber;
- pPicturePrivate->stateChanges = (1 << (CPLastBit + 1)) - 1;
-
- setCwPicture(pPicture, pPicturePrivate);
-
- return pPicturePrivate;
-}
-
-static void
-cwDestroyPicturePrivate (PicturePtr pPicture)
-{
- cwPicturePrivate;
-
- if (pPicturePrivate)
- {
- if (pPicturePrivate->pBackingPicture)
- FreePicture (pPicturePrivate->pBackingPicture, 0);
- free(pPicturePrivate);
- setCwPicture(pPicture, NULL);
- }
-}
-
-static PicturePtr
-cwGetBackingPicture (PicturePtr pPicture, int *x_off, int *y_off)
-{
- cwPicturePrivate;
-
- if (pPicturePrivate)
- {
- DrawablePtr pDrawable = pPicture->pDrawable;
- WindowPtr pWindow = (WindowPtr) pDrawable;
- PixmapPtr pPixmap = getCwPixmap (pWindow);
-
- *x_off = pDrawable->x - pPixmap->screen_x;
- *y_off = pDrawable->y - pPixmap->screen_y;
-
- return pPicturePrivate->pBackingPicture;
- }
- else
- {
- *x_off = *y_off = 0;
- return pPicture;
- }
-}
-
-static void
-cwDestroyPicture (PicturePtr pPicture)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- cwPsDecl(pScreen);
-
- cwPsUnwrap(DestroyPicture);
- cwDestroyPicturePrivate (pPicture);
- (*ps->DestroyPicture) (pPicture);
- cwPsWrap(DestroyPicture, cwDestroyPicture);
-}
-
-static void
-cwChangePicture (PicturePtr pPicture, Mask mask)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- cwPsDecl(pScreen);
- cwPicturePtr pPicturePrivate = getCwPicture(pPicture);
-
- cwPsUnwrap(ChangePicture);
- (*ps->ChangePicture) (pPicture, mask);
- if (pPicturePrivate)
- pPicturePrivate->stateChanges |= mask;
- cwPsWrap(ChangePicture, cwChangePicture);
-}
-
-
-static void
-cwValidatePicture (PicturePtr pPicture,
- Mask mask)
-{
- DrawablePtr pDrawable = pPicture->pDrawable;
- ScreenPtr pScreen = pDrawable->pScreen;
- cwPsDecl(pScreen);
- cwPicturePrivate;
-
- cwPsUnwrap(ValidatePicture);
-
- /*
- * Must call ValidatePicture to ensure pPicture->pCompositeClip is valid
- */
- (*ps->ValidatePicture) (pPicture, mask);
-
- if (!cwDrawableIsRedirWindow (pDrawable))
- {
- if (pPicturePrivate)
- cwDestroyPicturePrivate (pPicture);
- }
- else
- {
- PicturePtr pBackingPicture;
- DrawablePtr pBackingDrawable;
- int x_off, y_off;
-
- pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
-
- if (pPicturePrivate &&
- pPicturePrivate->pBackingPicture->pDrawable != pBackingDrawable)
- {
- cwDestroyPicturePrivate (pPicture);
- pPicturePrivate = 0;
- }
-
- if (!pPicturePrivate)
- {
- pPicturePrivate = cwCreatePicturePrivate (pPicture);
- if (!pPicturePrivate)
- {
- cwPsWrap(ValidatePicture, cwValidatePicture);
- return;
- }
- }
-
- pBackingPicture = pPicturePrivate->pBackingPicture;
-
- /*
- * Always copy transform and filters because there's no
- * indication of when they've changed
- */
- SetPictureTransform(pBackingPicture, pPicture->transform);
-
- if (pBackingPicture->filter != pPicture->filter ||
- pPicture->filter_nparams > 0)
- {
- char *filter = PictureGetFilterName (pPicture->filter);
-
- SetPictureFilter(pBackingPicture,
- filter, strlen (filter),
- pPicture->filter_params,
- pPicture->filter_nparams);
- }
-
- pPicturePrivate->stateChanges |= mask;
-
- if (pPicturePrivate->serialNumber != pDrawable->serialNumber ||
- (pPicturePrivate->stateChanges & (CPClipXOrigin|CPClipYOrigin|CPClipMask)))
- {
- SetPictureClipRegion (pBackingPicture,
- x_off - pDrawable->x,
- y_off - pDrawable->y,
- pPicture->pCompositeClip);
-
- pPicturePrivate->serialNumber = pDrawable->serialNumber;
- pPicturePrivate->stateChanges &= ~(CPClipXOrigin | CPClipYOrigin | CPClipMask);
- }
-
- CopyPicture(pPicture, pPicturePrivate->stateChanges, pBackingPicture);
-
- ValidatePicture (pBackingPicture);
- }
- cwPsWrap(ValidatePicture, cwValidatePicture);
-}
-
-static void
-cwComposite (CARD8 op,
- PicturePtr pSrcPicture,
- PicturePtr pMskPicture,
- PicturePtr pDstPicture,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMsk,
- INT16 yMsk,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
- cwPsDecl(pScreen);
- cwSrcPictureDecl;
- cwMskPictureDecl;
- cwDstPictureDecl;
-
- cwPsUnwrap(Composite);
- (*ps->Composite) (op, pBackingSrcPicture, pBackingMskPicture, pBackingDstPicture,
- xSrc + src_picture_x_off, ySrc + src_picture_y_off,
- xMsk + msk_picture_x_off, yMsk + msk_picture_y_off,
- xDst + dst_picture_x_off, yDst + dst_picture_y_off,
- width, height);
- cwPsWrap(Composite, cwComposite);
-}
-
-static void
-cwCompositeRects (CARD8 op,
- PicturePtr pDstPicture,
- xRenderColor *color,
- int nRect,
- xRectangle *rects)
-{
- ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
- cwPsDecl(pScreen);
- cwDstPictureDecl;
- int i;
-
- cwPsUnwrap(CompositeRects);
- for (i = 0; i < nRect; i++)
- {
- rects[i].x += dst_picture_x_off;
- rects[i].y += dst_picture_y_off;
- }
- (*ps->CompositeRects) (op, pBackingDstPicture, color, nRect, rects);
- cwPsWrap(CompositeRects, cwCompositeRects);
-}
-
-static void
-cwTrapezoids (CARD8 op,
- PicturePtr pSrcPicture,
- PicturePtr pDstPicture,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps)
-{
- ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
- cwPsDecl(pScreen);
- cwSrcPictureDecl;
- cwDstPictureDecl;
- int i;
-
- cwPsUnwrap(Trapezoids);
- if (dst_picture_x_off || dst_picture_y_off) {
- for (i = 0; i < ntrap; i++)
- {
- traps[i].top += dst_picture_y_off << 16;
- traps[i].bottom += dst_picture_y_off << 16;
- traps[i].left.p1.x += dst_picture_x_off << 16;
- traps[i].left.p1.y += dst_picture_y_off << 16;
- traps[i].left.p2.x += dst_picture_x_off << 16;
- traps[i].left.p2.y += dst_picture_y_off << 16;
- traps[i].right.p1.x += dst_picture_x_off << 16;
- traps[i].right.p1.y += dst_picture_y_off << 16;
- traps[i].right.p2.x += dst_picture_x_off << 16;
- traps[i].right.p2.y += dst_picture_y_off << 16;
- }
- }
- (*ps->Trapezoids) (op, pBackingSrcPicture, pBackingDstPicture, maskFormat,
- xSrc + src_picture_x_off, ySrc + src_picture_y_off,
- ntrap, traps);
- cwPsWrap(Trapezoids, cwTrapezoids);
-}
-
-static void
-cwTriangles (CARD8 op,
- PicturePtr pSrcPicture,
- PicturePtr pDstPicture,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntri,
- xTriangle *tris)
-{
- ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
- cwPsDecl(pScreen);
- cwSrcPictureDecl;
- cwDstPictureDecl;
- int i;
-
- cwPsUnwrap(Triangles);
- if (dst_picture_x_off || dst_picture_y_off) {
- for (i = 0; i < ntri; i++)
- {
- tris[i].p1.x += dst_picture_x_off << 16;
- tris[i].p1.y += dst_picture_y_off << 16;
- tris[i].p2.x += dst_picture_x_off << 16;
- tris[i].p2.y += dst_picture_y_off << 16;
- tris[i].p3.x += dst_picture_x_off << 16;
- tris[i].p3.y += dst_picture_y_off << 16;
- }
- }
- (*ps->Triangles) (op, pBackingSrcPicture, pBackingDstPicture, maskFormat,
- xSrc + src_picture_x_off, ySrc + src_picture_y_off,
- ntri, tris);
- cwPsWrap(Triangles, cwTriangles);
-}
-
-void
-cwInitializeRender (ScreenPtr pScreen)
-{
- cwPsDecl (pScreen);
-
- cwPsWrap(DestroyPicture, cwDestroyPicture);
- cwPsWrap(ChangePicture, cwChangePicture);
- cwPsWrap(ValidatePicture, cwValidatePicture);
- cwPsWrap(Composite, cwComposite);
- cwPsWrap(CompositeRects, cwCompositeRects);
- cwPsWrap(Trapezoids, cwTrapezoids);
- cwPsWrap(Triangles, cwTriangles);
- /* There is no need to wrap AddTraps as far as we can tell. AddTraps can
- * only be done on alpha-only pictures, and we won't be getting
- * alpha-only window pictures, so there's no need to translate.
- */
-}
-
-void
-cwFiniRender (ScreenPtr pScreen)
-{
- cwPsDecl (pScreen);
-
- cwPsUnwrap(DestroyPicture);
- cwPsUnwrap(ChangePicture);
- cwPsUnwrap(ValidatePicture);
- cwPsUnwrap(Composite);
- cwPsUnwrap(CompositeRects);
- cwPsUnwrap(Trapezoids);
- cwPsUnwrap(Triangles);
-}
-
+/*
+ * Copyright © 2004 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "cw.h"
+
+#define cwPsDecl(pScreen) \
+ PictureScreenPtr ps = GetPictureScreen (pScreen); \
+ cwScreenPtr pCwScreen = getCwScreen (pScreen)
+
+#define cwPicturePrivate \
+ cwPicturePtr pPicturePrivate = getCwPicture(pPicture)
+
+#define cwSrcPictureDecl \
+ int src_picture_x_off, src_picture_y_off; \
+ PicturePtr pBackingSrcPicture = cwGetBackingPicture(pSrcPicture, \
+ &src_picture_x_off,\
+ &src_picture_y_off)
+
+#define cwDstPictureDecl \
+ int dst_picture_x_off, dst_picture_y_off; \
+ PicturePtr pBackingDstPicture = cwGetBackingPicture(pDstPicture, \
+ &dst_picture_x_off,\
+ &dst_picture_y_off)
+
+#define cwMskPictureDecl \
+ int msk_picture_x_off = 0, msk_picture_y_off = 0; \
+ PicturePtr pBackingMskPicture = (!pMskPicture ? 0 : \
+ cwGetBackingPicture(pMskPicture, \
+ &msk_picture_x_off,\
+ &msk_picture_y_off))
+
+#define cwPsUnwrap(elt) { \
+ ps->elt = pCwScreen->elt; \
+}
+
+#define cwPsWrap(elt,func) { \
+ pCwScreen->elt = ps->elt; \
+ ps->elt = func; \
+}
+
+static cwPicturePtr
+cwCreatePicturePrivate(PicturePtr pPicture)
+{
+ WindowPtr pWindow = (WindowPtr) pPicture->pDrawable;
+ PixmapPtr pPixmap = getCwPixmap(pWindow);
+ int error;
+ cwPicturePtr pPicturePrivate;
+
+ pPicturePrivate = malloc(sizeof(cwPictureRec));
+ if (!pPicturePrivate)
+ return NULL;
+
+ pPicturePrivate->pBackingPicture = CreatePicture(0, &pPixmap->drawable,
+ pPicture->pFormat,
+ 0, 0, serverClient,
+ &error);
+ if (!pPicturePrivate->pBackingPicture) {
+ free(pPicturePrivate);
+ return NULL;
+ }
+
+ /*
+ * Ensure that this serial number does not match the window's
+ */
+ pPicturePrivate->serialNumber = pPixmap->drawable.serialNumber;
+ pPicturePrivate->stateChanges = (1 << (CPLastBit + 1)) - 1;
+
+ setCwPicture(pPicture, pPicturePrivate);
+
+ return pPicturePrivate;
+}
+
+static void
+cwDestroyPicturePrivate(PicturePtr pPicture)
+{
+ cwPicturePrivate;
+
+ if (pPicturePrivate) {
+ if (pPicturePrivate->pBackingPicture)
+ FreePicture(pPicturePrivate->pBackingPicture, 0);
+ free(pPicturePrivate);
+ setCwPicture(pPicture, NULL);
+ }
+}
+
+static PicturePtr
+cwGetBackingPicture(PicturePtr pPicture, int *x_off, int *y_off)
+{
+ cwPicturePrivate;
+
+ if (pPicturePrivate) {
+ DrawablePtr pDrawable = pPicture->pDrawable;
+ WindowPtr pWindow = (WindowPtr) pDrawable;
+ PixmapPtr pPixmap = getCwPixmap(pWindow);
+
+ *x_off = pDrawable->x - pPixmap->screen_x;
+ *y_off = pDrawable->y - pPixmap->screen_y;
+
+ return pPicturePrivate->pBackingPicture;
+ }
+ else {
+ *x_off = *y_off = 0;
+ return pPicture;
+ }
+}
+
+static void
+cwDestroyPicture(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+
+ cwPsDecl(pScreen);
+
+ cwPsUnwrap(DestroyPicture);
+ cwDestroyPicturePrivate(pPicture);
+ (*ps->DestroyPicture) (pPicture);
+ cwPsWrap(DestroyPicture, cwDestroyPicture);
+}
+
+static void
+cwChangePicture(PicturePtr pPicture, Mask mask)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+
+ cwPsDecl(pScreen);
+ cwPicturePtr pPicturePrivate = getCwPicture(pPicture);
+
+ cwPsUnwrap(ChangePicture);
+ (*ps->ChangePicture) (pPicture, mask);
+ if (pPicturePrivate)
+ pPicturePrivate->stateChanges |= mask;
+ cwPsWrap(ChangePicture, cwChangePicture);
+}
+
+static void
+cwValidatePicture(PicturePtr pPicture, Mask mask)
+{
+ DrawablePtr pDrawable = pPicture->pDrawable;
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ cwPsDecl(pScreen);
+ cwPicturePrivate;
+
+ cwPsUnwrap(ValidatePicture);
+
+ /*
+ * Must call ValidatePicture to ensure pPicture->pCompositeClip is valid
+ */
+ (*ps->ValidatePicture) (pPicture, mask);
+
+ if (!cwDrawableIsRedirWindow(pDrawable)) {
+ if (pPicturePrivate)
+ cwDestroyPicturePrivate(pPicture);
+ }
+ else {
+ PicturePtr pBackingPicture;
+ DrawablePtr pBackingDrawable;
+ int x_off, y_off;
+
+ pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
+
+ if (pPicturePrivate &&
+ pPicturePrivate->pBackingPicture->pDrawable != pBackingDrawable) {
+ cwDestroyPicturePrivate(pPicture);
+ pPicturePrivate = 0;
+ }
+
+ if (!pPicturePrivate) {
+ pPicturePrivate = cwCreatePicturePrivate(pPicture);
+ if (!pPicturePrivate) {
+ cwPsWrap(ValidatePicture, cwValidatePicture);
+ return;
+ }
+ }
+
+ pBackingPicture = pPicturePrivate->pBackingPicture;
+
+ /*
+ * Always copy transform and filters because there's no
+ * indication of when they've changed
+ */
+ SetPictureTransform(pBackingPicture, pPicture->transform);
+
+ if (pBackingPicture->filter != pPicture->filter ||
+ pPicture->filter_nparams > 0) {
+ char *filter = PictureGetFilterName(pPicture->filter);
+
+ SetPictureFilter(pBackingPicture,
+ filter, strlen(filter),
+ pPicture->filter_params, pPicture->filter_nparams);
+ }
+
+ pPicturePrivate->stateChanges |= mask;
+
+ if (pPicturePrivate->serialNumber != pDrawable->serialNumber ||
+ (pPicturePrivate->
+ stateChanges & (CPClipXOrigin | CPClipYOrigin | CPClipMask))) {
+ SetPictureClipRegion(pBackingPicture, x_off - pDrawable->x,
+ y_off - pDrawable->y,
+ pPicture->pCompositeClip);
+
+ pPicturePrivate->serialNumber = pDrawable->serialNumber;
+ pPicturePrivate->stateChanges &=
+ ~(CPClipXOrigin | CPClipYOrigin | CPClipMask);
+ }
+
+ CopyPicture(pPicture, pPicturePrivate->stateChanges, pBackingPicture);
+
+ ValidatePicture(pBackingPicture);
+ }
+ cwPsWrap(ValidatePicture, cwValidatePicture);
+}
+
+static void
+cwComposite(CARD8 op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMskPicture,
+ PicturePtr pDstPicture,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMsk,
+ INT16 yMsk, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
+
+ cwPsDecl(pScreen);
+ cwSrcPictureDecl;
+ cwMskPictureDecl;
+ cwDstPictureDecl;
+
+ cwPsUnwrap(Composite);
+ (*ps->Composite) (op, pBackingSrcPicture, pBackingMskPicture,
+ pBackingDstPicture, xSrc + src_picture_x_off,
+ ySrc + src_picture_y_off, xMsk + msk_picture_x_off,
+ yMsk + msk_picture_y_off, xDst + dst_picture_x_off,
+ yDst + dst_picture_y_off, width, height);
+ cwPsWrap(Composite, cwComposite);
+}
+
+static void
+cwCompositeRects(CARD8 op,
+ PicturePtr pDstPicture,
+ xRenderColor * color, int nRect, xRectangle *rects)
+{
+ ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
+
+ cwPsDecl(pScreen);
+ cwDstPictureDecl;
+ int i;
+
+ cwPsUnwrap(CompositeRects);
+ for (i = 0; i < nRect; i++) {
+ rects[i].x += dst_picture_x_off;
+ rects[i].y += dst_picture_y_off;
+ }
+ (*ps->CompositeRects) (op, pBackingDstPicture, color, nRect, rects);
+ cwPsWrap(CompositeRects, cwCompositeRects);
+}
+
+static void
+cwTrapezoids(CARD8 op,
+ PicturePtr pSrcPicture,
+ PicturePtr pDstPicture,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps)
+{
+ ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
+
+ cwPsDecl(pScreen);
+ cwSrcPictureDecl;
+ cwDstPictureDecl;
+ int i;
+
+ cwPsUnwrap(Trapezoids);
+ if (dst_picture_x_off || dst_picture_y_off) {
+ for (i = 0; i < ntrap; i++) {
+ traps[i].top += dst_picture_y_off << 16;
+ traps[i].bottom += dst_picture_y_off << 16;
+ traps[i].left.p1.x += dst_picture_x_off << 16;
+ traps[i].left.p1.y += dst_picture_y_off << 16;
+ traps[i].left.p2.x += dst_picture_x_off << 16;
+ traps[i].left.p2.y += dst_picture_y_off << 16;
+ traps[i].right.p1.x += dst_picture_x_off << 16;
+ traps[i].right.p1.y += dst_picture_y_off << 16;
+ traps[i].right.p2.x += dst_picture_x_off << 16;
+ traps[i].right.p2.y += dst_picture_y_off << 16;
+ }
+ }
+ (*ps->Trapezoids) (op, pBackingSrcPicture, pBackingDstPicture, maskFormat,
+ xSrc + src_picture_x_off, ySrc + src_picture_y_off,
+ ntrap, traps);
+ cwPsWrap(Trapezoids, cwTrapezoids);
+}
+
+static void
+cwTriangles(CARD8 op,
+ PicturePtr pSrcPicture,
+ PicturePtr pDstPicture,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntri, xTriangle * tris)
+{
+ ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
+
+ cwPsDecl(pScreen);
+ cwSrcPictureDecl;
+ cwDstPictureDecl;
+ int i;
+
+ cwPsUnwrap(Triangles);
+ if (dst_picture_x_off || dst_picture_y_off) {
+ for (i = 0; i < ntri; i++) {
+ tris[i].p1.x += dst_picture_x_off << 16;
+ tris[i].p1.y += dst_picture_y_off << 16;
+ tris[i].p2.x += dst_picture_x_off << 16;
+ tris[i].p2.y += dst_picture_y_off << 16;
+ tris[i].p3.x += dst_picture_x_off << 16;
+ tris[i].p3.y += dst_picture_y_off << 16;
+ }
+ }
+ (*ps->Triangles) (op, pBackingSrcPicture, pBackingDstPicture, maskFormat,
+ xSrc + src_picture_x_off, ySrc + src_picture_y_off,
+ ntri, tris);
+ cwPsWrap(Triangles, cwTriangles);
+}
+
+void
+cwInitializeRender(ScreenPtr pScreen)
+{
+ cwPsDecl(pScreen);
+
+ cwPsWrap(DestroyPicture, cwDestroyPicture);
+ cwPsWrap(ChangePicture, cwChangePicture);
+ cwPsWrap(ValidatePicture, cwValidatePicture);
+ cwPsWrap(Composite, cwComposite);
+ cwPsWrap(CompositeRects, cwCompositeRects);
+ cwPsWrap(Trapezoids, cwTrapezoids);
+ cwPsWrap(Triangles, cwTriangles);
+ /* There is no need to wrap AddTraps as far as we can tell. AddTraps can
+ * only be done on alpha-only pictures, and we won't be getting
+ * alpha-only window pictures, so there's no need to translate.
+ */
+}
+
+void
+cwFiniRender(ScreenPtr pScreen)
+{
+ cwPsDecl(pScreen);
+
+ cwPsUnwrap(DestroyPicture);
+ cwPsUnwrap(ChangePicture);
+ cwPsUnwrap(ValidatePicture);
+ cwPsUnwrap(Composite);
+ cwPsUnwrap(CompositeRects);
+ cwPsUnwrap(Trapezoids);
+ cwPsUnwrap(Triangles);
+}
diff --git a/xorg-server/miext/damage/damage.c b/xorg-server/miext/damage/damage.c
index 224f5e074..780162a8d 100644
--- a/xorg-server/miext/damage/damage.c
+++ b/xorg-server/miext/damage/damage.c
@@ -71,41 +71,43 @@
#define pixmapDamage(pPixmap) damagePixPriv(pPixmap)
static DevPrivateKeyRec damageScrPrivateKeyRec;
+
#define damageScrPrivateKey (&damageScrPrivateKeyRec)
static DevPrivateKeyRec damagePixPrivateKeyRec;
+
#define damagePixPrivateKey (&damagePixPrivateKeyRec)
static DevPrivateKeyRec damageGCPrivateKeyRec;
+
#define damageGCPrivateKey (&damageGCPrivateKeyRec)
static DevPrivateKeyRec damageWinPrivateKeyRec;
+
#define damageWinPrivateKey (&damageWinPrivateKeyRec)
static DamagePtr *
-getDrawableDamageRef (DrawablePtr pDrawable)
+getDrawableDamageRef(DrawablePtr pDrawable)
{
- PixmapPtr pPixmap;
-
- if (WindowDrawable(pDrawable->type))
- {
- ScreenPtr pScreen = pDrawable->pScreen;
+ PixmapPtr pPixmap;
- pPixmap = 0;
- if (pScreen->GetWindowPixmap
+ if (WindowDrawable(pDrawable->type)) {
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ pPixmap = 0;
+ if (pScreen->GetWindowPixmap
#ifdef ROOTLESS_WORKAROUND
- && ((WindowPtr)pDrawable)->viewable
+ && ((WindowPtr) pDrawable)->viewable
#endif
- )
- pPixmap = (*pScreen->GetWindowPixmap) ((WindowPtr)pDrawable);
+ )
+ pPixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
- if (!pPixmap)
- {
- damageScrPriv(pScreen);
+ if (!pPixmap) {
+ damageScrPriv(pScreen);
- return &pScrPriv->pScreenDamage;
- }
+ return &pScrPriv->pScreenDamage;
+ }
}
else
- pPixmap = (PixmapPtr) pDrawable;
- return getPixmapDamageRef (pPixmap);
+ pPixmap = (PixmapPtr) pDrawable;
+ return getPixmapDamageRef(pPixmap);
}
#define getDrawableDamage(pDrawable) (*getDrawableDamageRef (pDrawable))
@@ -121,7 +123,8 @@ getDrawableDamageRef (DrawablePtr pDrawable)
dixLookupPrivateAddr(&(pWindow)->devPrivates, damageWinPrivateKey)
static void
-damageReportDamagePostRendering (DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pDamageRegion)
+damageReportDamagePostRendering(DamagePtr pDamage, RegionPtr pOldDamage,
+ RegionPtr pDamageRegion)
{
BoxRec tmpBox;
RegionRec tmpRegion, newDamage;
@@ -131,32 +134,34 @@ damageReportDamagePostRendering (DamagePtr pDamage, RegionPtr pOldDamage, Region
switch (pDamage->damageLevel) {
case DamageReportRawRegion:
- (*pDamage->damageReportPostRendering) (pDamage, pDamageRegion, pDamage->closure);
- break;
+ (*pDamage->damageReportPostRendering) (pDamage, pDamageRegion,
+ pDamage->closure);
+ break;
case DamageReportDeltaRegion:
- RegionNull(&tmpRegion);
- RegionSubtract(&tmpRegion, pDamageRegion, pOldDamage);
- if (RegionNotEmpty(&tmpRegion)) {
- (*pDamage->damageReportPostRendering) (pDamage, &tmpRegion, pDamage->closure);
- }
- RegionUninit(&tmpRegion);
- break;
+ RegionNull(&tmpRegion);
+ RegionSubtract(&tmpRegion, pDamageRegion, pOldDamage);
+ if (RegionNotEmpty(&tmpRegion)) {
+ (*pDamage->damageReportPostRendering) (pDamage, &tmpRegion,
+ pDamage->closure);
+ }
+ RegionUninit(&tmpRegion);
+ break;
case DamageReportBoundingBox:
- tmpBox = *RegionExtents(pOldDamage);
- if (!BOX_SAME (&tmpBox, RegionExtents(&newDamage))) {
- (*pDamage->damageReportPostRendering) (pDamage, &newDamage,
- pDamage->closure);
- }
- break;
+ tmpBox = *RegionExtents(pOldDamage);
+ if (!BOX_SAME(&tmpBox, RegionExtents(&newDamage))) {
+ (*pDamage->damageReportPostRendering) (pDamage, &newDamage,
+ pDamage->closure);
+ }
+ break;
case DamageReportNonEmpty:
- was_empty = !RegionNotEmpty(pOldDamage);
- if (was_empty && RegionNotEmpty(&newDamage)) {
- (*pDamage->damageReportPostRendering) (pDamage, &newDamage,
- pDamage->closure);
- }
- break;
+ was_empty = !RegionNotEmpty(pOldDamage);
+ if (was_empty && RegionNotEmpty(&newDamage)) {
+ (*pDamage->damageReportPostRendering) (pDamage, &newDamage,
+ pDamage->closure);
+ }
+ break;
case DamageReportNone:
- break;
+ break;
}
RegionUninit(&newDamage);
@@ -164,217 +169,215 @@ damageReportDamagePostRendering (DamagePtr pDamage, RegionPtr pOldDamage, Region
#if DAMAGE_DEBUG_ENABLE
static void
-_damageRegionAppend (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, int subWindowMode, const char *where)
+_damageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
+ int subWindowMode, const char *where)
#define damageRegionAppend(d,r,c,m) _damageRegionAppend(d,r,c,m,__FUNCTION__)
#else
static void
-damageRegionAppend (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
- int subWindowMode)
+damageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
+ int subWindowMode)
#endif
{
- ScreenPtr pScreen = pDrawable->pScreen;
+ ScreenPtr pScreen = pDrawable->pScreen;
+
damageScrPriv(pScreen);
drawableDamage(pDrawable);
- DamagePtr pNext;
- RegionRec clippedRec;
- RegionPtr pDamageRegion;
- RegionRec pixClip;
- int draw_x, draw_y;
+ DamagePtr pNext;
+ RegionRec clippedRec;
+ RegionPtr pDamageRegion;
+ RegionRec pixClip;
+ int draw_x, draw_y;
+
#ifdef COMPOSITE
- int screen_x = 0, screen_y = 0;
+ int screen_x = 0, screen_y = 0;
#endif
/* short circuit for empty regions */
if (!RegionNotEmpty(pRegion))
- return;
-
+ return;
+
#ifdef COMPOSITE
/*
* When drawing to a pixmap which is storing window contents,
* the region presented is in pixmap relative coordinates which
* need to be converted to screen relative coordinates
*/
- if (pDrawable->type != DRAWABLE_WINDOW)
- {
- screen_x = ((PixmapPtr) pDrawable)->screen_x - pDrawable->x;
- screen_y = ((PixmapPtr) pDrawable)->screen_y - pDrawable->y;
+ if (pDrawable->type != DRAWABLE_WINDOW) {
+ screen_x = ((PixmapPtr) pDrawable)->screen_x - pDrawable->x;
+ screen_y = ((PixmapPtr) pDrawable)->screen_y - pDrawable->y;
}
if (screen_x || screen_y)
RegionTranslate(pRegion, screen_x, screen_y);
#endif
-
+
if (pDrawable->type == DRAWABLE_WINDOW &&
- ((WindowPtr)(pDrawable))->backingStore == NotUseful)
- {
- if (subWindowMode == ClipByChildren)
- {
- RegionIntersect(pRegion, pRegion,
- &((WindowPtr)(pDrawable))->clipList);
- }
- else if (subWindowMode == IncludeInferiors)
- {
- RegionPtr pTempRegion =
- NotClippedByChildren((WindowPtr)(pDrawable));
- RegionIntersect(pRegion, pRegion, pTempRegion);
- RegionDestroy(pTempRegion);
- }
- /* If subWindowMode is set to an invalid value, don't perform
- * any drawable-based clipping. */
+ ((WindowPtr) (pDrawable))->backingStore == NotUseful) {
+ if (subWindowMode == ClipByChildren) {
+ RegionIntersect(pRegion, pRegion,
+ &((WindowPtr) (pDrawable))->clipList);
+ }
+ else if (subWindowMode == IncludeInferiors) {
+ RegionPtr pTempRegion =
+ NotClippedByChildren((WindowPtr) (pDrawable));
+ RegionIntersect(pRegion, pRegion, pTempRegion);
+ RegionDestroy(pTempRegion);
+ }
+ /* If subWindowMode is set to an invalid value, don't perform
+ * any drawable-based clipping. */
}
-
RegionNull(&clippedRec);
- for (; pDamage; pDamage = pNext)
- {
- pNext = pDamage->pNext;
- /*
- * Check for internal damage and don't send events
- */
- if (pScrPriv->internalLevel > 0 && !pDamage->isInternal)
- {
- DAMAGE_DEBUG (("non internal damage, skipping at %d\n",
- pScrPriv->internalLevel));
- continue;
- }
- /*
- * Check for unrealized windows
- */
- if (pDamage->pDrawable->type == DRAWABLE_WINDOW &&
- !((WindowPtr) (pDamage->pDrawable))->realized)
- {
- continue;
- }
-
- draw_x = pDamage->pDrawable->x;
- draw_y = pDamage->pDrawable->y;
+ for (; pDamage; pDamage = pNext) {
+ pNext = pDamage->pNext;
+ /*
+ * Check for internal damage and don't send events
+ */
+ if (pScrPriv->internalLevel > 0 && !pDamage->isInternal) {
+ DAMAGE_DEBUG(("non internal damage, skipping at %d\n",
+ pScrPriv->internalLevel));
+ continue;
+ }
+ /*
+ * Check for unrealized windows
+ */
+ if (pDamage->pDrawable->type == DRAWABLE_WINDOW &&
+ !((WindowPtr) (pDamage->pDrawable))->realized) {
+ continue;
+ }
+
+ draw_x = pDamage->pDrawable->x;
+ draw_y = pDamage->pDrawable->y;
#ifdef COMPOSITE
- /*
- * Need to move everyone to screen coordinates
- * XXX what about off-screen pixmaps with non-zero x/y?
- */
- if (!WindowDrawable(pDamage->pDrawable->type))
- {
- draw_x += ((PixmapPtr) pDamage->pDrawable)->screen_x;
- draw_y += ((PixmapPtr) pDamage->pDrawable)->screen_y;
- }
+ /*
+ * Need to move everyone to screen coordinates
+ * XXX what about off-screen pixmaps with non-zero x/y?
+ */
+ if (!WindowDrawable(pDamage->pDrawable->type)) {
+ draw_x += ((PixmapPtr) pDamage->pDrawable)->screen_x;
+ draw_y += ((PixmapPtr) pDamage->pDrawable)->screen_y;
+ }
#endif
-
- /*
- * Clip against border or pixmap bounds
- */
-
- pDamageRegion = pRegion;
- if (clip || pDamage->pDrawable != pDrawable)
- {
- pDamageRegion = &clippedRec;
- if (pDamage->pDrawable->type == DRAWABLE_WINDOW) {
- RegionIntersect(pDamageRegion, pRegion,
- &((WindowPtr)(pDamage->pDrawable))->borderClip);
- } else {
- BoxRec box;
- box.x1 = draw_x;
- box.y1 = draw_y;
- box.x2 = draw_x + pDamage->pDrawable->width;
- box.y2 = draw_y + pDamage->pDrawable->height;
- RegionInit(&pixClip, &box, 1);
- RegionIntersect(pDamageRegion, pRegion, &pixClip);
- RegionUninit(&pixClip);
- }
- /*
- * Short circuit empty results
- */
- if (!RegionNotEmpty(pDamageRegion))
- continue;
- }
-
- DAMAGE_DEBUG (("%s %d x %d +%d +%d (target 0x%lx monitor 0x%lx)\n",
- where,
- pDamageRegion->extents.x2 - pDamageRegion->extents.x1,
- pDamageRegion->extents.y2 - pDamageRegion->extents.y1,
- pDamageRegion->extents.x1, pDamageRegion->extents.y1,
- pDrawable->id, pDamage->pDrawable->id));
-
- /*
- * Move region to target coordinate space
- */
- if (draw_x || draw_y)
- RegionTranslate(pDamageRegion, -draw_x, -draw_y);
-
- /* Store damage region if needed after submission. */
- if (pDamage->reportAfter || pDamage->damageMarker)
- RegionUnion(&pDamage->pendingDamage,
- &pDamage->pendingDamage, pDamageRegion);
-
- /* Duplicate current damage if needed. */
- if (pDamage->damageMarker)
- RegionCopy(&pDamage->backupDamage, &pDamage->damage);
-
- /* Report damage now, if desired. */
- if (!pDamage->reportAfter) {
- if (pDamage->damageReport)
- DamageReportDamage (pDamage, pDamageRegion);
- else
- RegionUnion(&pDamage->damage,
- &pDamage->damage, pDamageRegion);
- }
-
- /*
- * translate original region back
- */
- if (pDamageRegion == pRegion && (draw_x || draw_y))
- RegionTranslate(pDamageRegion, draw_x, draw_y);
+
+ /*
+ * Clip against border or pixmap bounds
+ */
+
+ pDamageRegion = pRegion;
+ if (clip || pDamage->pDrawable != pDrawable) {
+ pDamageRegion = &clippedRec;
+ if (pDamage->pDrawable->type == DRAWABLE_WINDOW) {
+ RegionIntersect(pDamageRegion, pRegion,
+ &((WindowPtr) (pDamage->pDrawable))->
+ borderClip);
+ }
+ else {
+ BoxRec box;
+
+ box.x1 = draw_x;
+ box.y1 = draw_y;
+ box.x2 = draw_x + pDamage->pDrawable->width;
+ box.y2 = draw_y + pDamage->pDrawable->height;
+ RegionInit(&pixClip, &box, 1);
+ RegionIntersect(pDamageRegion, pRegion, &pixClip);
+ RegionUninit(&pixClip);
+ }
+ /*
+ * Short circuit empty results
+ */
+ if (!RegionNotEmpty(pDamageRegion))
+ continue;
+ }
+
+ DAMAGE_DEBUG(("%s %d x %d +%d +%d (target 0x%lx monitor 0x%lx)\n",
+ where,
+ pDamageRegion->extents.x2 - pDamageRegion->extents.x1,
+ pDamageRegion->extents.y2 - pDamageRegion->extents.y1,
+ pDamageRegion->extents.x1, pDamageRegion->extents.y1,
+ pDrawable->id, pDamage->pDrawable->id));
+
+ /*
+ * Move region to target coordinate space
+ */
+ if (draw_x || draw_y)
+ RegionTranslate(pDamageRegion, -draw_x, -draw_y);
+
+ /* Store damage region if needed after submission. */
+ if (pDamage->reportAfter || pDamage->damageMarker)
+ RegionUnion(&pDamage->pendingDamage,
+ &pDamage->pendingDamage, pDamageRegion);
+
+ /* Duplicate current damage if needed. */
+ if (pDamage->damageMarker)
+ RegionCopy(&pDamage->backupDamage, &pDamage->damage);
+
+ /* Report damage now, if desired. */
+ if (!pDamage->reportAfter) {
+ if (pDamage->damageReport)
+ DamageReportDamage(pDamage, pDamageRegion);
+ else
+ RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion);
+ }
+
+ /*
+ * translate original region back
+ */
+ if (pDamageRegion == pRegion && (draw_x || draw_y))
+ RegionTranslate(pDamageRegion, draw_x, draw_y);
}
#ifdef COMPOSITE
if (screen_x || screen_y)
- RegionTranslate(pRegion, -screen_x, -screen_y);
+ RegionTranslate(pRegion, -screen_x, -screen_y);
#endif
-
+
RegionUninit(&clippedRec);
}
static void
-damageRegionProcessPending (DrawablePtr pDrawable)
+damageRegionProcessPending(DrawablePtr pDrawable)
{
drawableDamage(pDrawable);
- for (; pDamage != NULL; pDamage = pDamage->pNext)
- {
- /* submit damage marker whenever possible. */
- if (pDamage->damageMarker)
- (*pDamage->damageMarker) (pDrawable, pDamage, &pDamage->backupDamage, &pDamage->pendingDamage, pDamage->closure);
- if (pDamage->reportAfter) {
- /* It's possible that there is only interest in postRendering reporting. */
- if (pDamage->damageReport)
- DamageReportDamage (pDamage, &pDamage->pendingDamage);
- else
- RegionUnion(&pDamage->damage, &pDamage->damage,
- &pDamage->pendingDamage);
- }
-
- if (pDamage->reportAfter || pDamage->damageMarker)
- RegionEmpty(&pDamage->pendingDamage);
- if (pDamage->damageMarker)
- RegionEmpty(&pDamage->backupDamage);
+ for (; pDamage != NULL; pDamage = pDamage->pNext) {
+ /* submit damage marker whenever possible. */
+ if (pDamage->damageMarker)
+ (*pDamage->damageMarker) (pDrawable, pDamage,
+ &pDamage->backupDamage,
+ &pDamage->pendingDamage,
+ pDamage->closure);
+ if (pDamage->reportAfter) {
+ /* It's possible that there is only interest in postRendering reporting. */
+ if (pDamage->damageReport)
+ DamageReportDamage(pDamage, &pDamage->pendingDamage);
+ else
+ RegionUnion(&pDamage->damage, &pDamage->damage,
+ &pDamage->pendingDamage);
+ }
+
+ if (pDamage->reportAfter || pDamage->damageMarker)
+ RegionEmpty(&pDamage->pendingDamage);
+ if (pDamage->damageMarker)
+ RegionEmpty(&pDamage->backupDamage);
}
-
+
}
#if DAMAGE_DEBUG_ENABLE
#define damageDamageBox(d,b,m) _damageDamageBox(d,b,m,__FUNCTION__)
static void
-_damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode, const char *where)
+_damageDamageBox(DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode,
+ const char *where)
#else
static void
-damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode)
+damageDamageBox(DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode)
#endif
{
- RegionRec region;
+ RegionRec region;
RegionInit(&region, pBox, 1);
#if DAMAGE_DEBUG_ENABLE
- _damageRegionAppend (pDrawable, &region, TRUE, subWindowMode, where);
+ _damageRegionAppend(pDrawable, &region, TRUE, subWindowMode, where);
#else
- damageRegionAppend (pDrawable, &region, TRUE, subWindowMode);
+ damageRegionAppend(pDrawable, &region, TRUE, subWindowMode);
#endif
RegionUninit(&region);
}
@@ -398,17 +401,18 @@ static Bool
damageCreateGC(GCPtr pGC)
{
ScreenPtr pScreen = pGC->pScreen;
+
damageScrPriv(pScreen);
damageGCPriv(pGC);
Bool ret;
- unwrap (pScrPriv, pScreen, CreateGC);
- if((ret = (*pScreen->CreateGC) (pGC))) {
- pGCPriv->ops = NULL;
- pGCPriv->funcs = pGC->funcs;
- pGC->funcs = &damageGCFuncs;
+ unwrap(pScrPriv, pScreen, CreateGC);
+ if ((ret = (*pScreen->CreateGC) (pGC))) {
+ pGCPriv->ops = NULL;
+ pGCPriv->funcs = pGC->funcs;
+ pGC->funcs = &damageGCFuncs;
}
- wrap (pScrPriv, pScreen, CreateGC, damageCreateGC);
+ wrap(pScrPriv, pScreen, CreateGC, damageCreateGC);
return ret;
}
@@ -433,68 +437,60 @@ damageCreateGC(GCPtr pGC)
if (pGCPriv->ops) wrap(pGCPriv, pGC, ops, &damageGCOps)
static void
-damageValidateGC(GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable)
+damageValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
- DAMAGE_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ValidateGC)(pGC, changes, pDrawable);
- pGCPriv->ops = pGC->ops; /* just so it's not NULL */
- DAMAGE_GC_FUNC_EPILOGUE (pGC);
+ DAMAGE_GC_FUNC_PROLOGUE(pGC);
+ (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);
+ pGCPriv->ops = pGC->ops; /* just so it's not NULL */
+ DAMAGE_GC_FUNC_EPILOGUE(pGC);
}
static void
damageDestroyGC(GCPtr pGC)
{
- DAMAGE_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->DestroyGC)(pGC);
- DAMAGE_GC_FUNC_EPILOGUE (pGC);
+ DAMAGE_GC_FUNC_PROLOGUE(pGC);
+ (*pGC->funcs->DestroyGC) (pGC);
+ DAMAGE_GC_FUNC_EPILOGUE(pGC);
}
static void
-damageChangeGC (GCPtr pGC,
- unsigned long mask)
+damageChangeGC(GCPtr pGC, unsigned long mask)
{
- DAMAGE_GC_FUNC_PROLOGUE (pGC);
+ DAMAGE_GC_FUNC_PROLOGUE(pGC);
(*pGC->funcs->ChangeGC) (pGC, mask);
- DAMAGE_GC_FUNC_EPILOGUE (pGC);
+ DAMAGE_GC_FUNC_EPILOGUE(pGC);
}
static void
-damageCopyGC (GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst)
+damageCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
{
- DAMAGE_GC_FUNC_PROLOGUE (pGCDst);
+ DAMAGE_GC_FUNC_PROLOGUE(pGCDst);
(*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- DAMAGE_GC_FUNC_EPILOGUE (pGCDst);
+ DAMAGE_GC_FUNC_EPILOGUE(pGCDst);
}
static void
-damageChangeClip (GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects)
+damageChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
{
- DAMAGE_GC_FUNC_PROLOGUE (pGC);
+ DAMAGE_GC_FUNC_PROLOGUE(pGC);
(*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- DAMAGE_GC_FUNC_EPILOGUE (pGC);
+ DAMAGE_GC_FUNC_EPILOGUE(pGC);
}
static void
damageCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
{
- DAMAGE_GC_FUNC_PROLOGUE (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- DAMAGE_GC_FUNC_EPILOGUE (pgcDst);
+ DAMAGE_GC_FUNC_PROLOGUE(pgcDst);
+ (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
+ DAMAGE_GC_FUNC_EPILOGUE(pgcDst);
}
static void
damageDestroyClip(GCPtr pGC)
{
- DAMAGE_GC_FUNC_PROLOGUE (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- DAMAGE_GC_FUNC_EPILOGUE (pGC);
+ DAMAGE_GC_FUNC_PROLOGUE(pGC);
+ (*pGC->funcs->DestroyClip) (pGC);
+ DAMAGE_GC_FUNC_EPILOGUE(pGC);
}
#define TRIM_BOX(box, pGC) if (pGC->pCompositeClip) { \
@@ -531,825 +527,767 @@ damageDestroyClip(GCPtr pGC)
if(box.y1 < extents->y1) box.y1 = extents->y1; \
if(box.y2 > extents->y2) box.y2 = extents->y2; \
}
-
+
#define checkPictureDamage(p) (getDrawableDamage(p->pDrawable) && \
RegionNotEmpty(p->pCompositeClip))
static void
-damageComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+damageComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
damageScrPriv(pScreen);
- if (checkPictureDamage (pDst))
- {
- BoxRec box;
-
- box.x1 = xDst + pDst->pDrawable->x;
- box.y1 = yDst + pDst->pDrawable->y;
- box.x2 = box.x1 + width;
- box.y2 = box.y1 + height;
- TRIM_PICTURE_BOX(box, pDst);
- if (BOX_NOT_EMPTY(box))
- damageDamageBox (pDst->pDrawable, &box, pDst->subWindowMode);
+ if (checkPictureDamage(pDst)) {
+ BoxRec box;
+
+ box.x1 = xDst + pDst->pDrawable->x;
+ box.y1 = yDst + pDst->pDrawable->y;
+ box.x2 = box.x1 + width;
+ box.y2 = box.y1 + height;
+ TRIM_PICTURE_BOX(box, pDst);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDst->pDrawable, &box, pDst->subWindowMode);
}
- unwrap (pScrPriv, ps, Composite);
+ unwrap(pScrPriv, ps, Composite);
(*ps->Composite) (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
- damageRegionProcessPending (pDst->pDrawable);
- wrap (pScrPriv, ps, Composite, damageComposite);
+ pSrc,
+ pMask,
+ pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
+ damageRegionProcessPending(pDst->pDrawable);
+ wrap(pScrPriv, ps, Composite, damageComposite);
}
static void
-damageGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+damageGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
damageScrPriv(pScreen);
- if (checkPictureDamage (pDst))
- {
- int nlistTmp = nlist;
- GlyphListPtr listTmp = list;
- GlyphPtr *glyphsTmp = glyphs;
- int x, y;
- int n;
- GlyphPtr glyph;
- BoxRec box;
- int x1, y1, x2, y2;
-
- box.x1 = 32767;
- box.y1 = 32767;
- box.x2 = -32767;
- box.y2 = -32767;
- x = pDst->pDrawable->x;
- y = pDst->pDrawable->y;
- while (nlistTmp--)
- {
- x += listTmp->xOff;
- y += listTmp->yOff;
- n = listTmp->len;
- while (n--)
- {
- glyph = *glyphsTmp++;
- x1 = x - glyph->info.x;
- y1 = y - glyph->info.y;
- x2 = x1 + glyph->info.width;
- y2 = y1 + glyph->info.height;
- if (x1 < box.x1)
- box.x1 = x1;
- if (y1 < box.y1)
- box.y1 = y1;
- if (x2 > box.x2)
- box.x2 = x2;
- if (y2 > box.y2)
- box.y2 = y2;
- x += glyph->info.xOff;
- y += glyph->info.yOff;
- }
- listTmp++;
- }
- TRIM_PICTURE_BOX (box, pDst);
- if (BOX_NOT_EMPTY(box))
- damageDamageBox (pDst->pDrawable, &box, pDst->subWindowMode);
+ if (checkPictureDamage(pDst)) {
+ int nlistTmp = nlist;
+ GlyphListPtr listTmp = list;
+ GlyphPtr *glyphsTmp = glyphs;
+ int x, y;
+ int n;
+ GlyphPtr glyph;
+ BoxRec box;
+ int x1, y1, x2, y2;
+
+ box.x1 = 32767;
+ box.y1 = 32767;
+ box.x2 = -32767;
+ box.y2 = -32767;
+ x = pDst->pDrawable->x;
+ y = pDst->pDrawable->y;
+ while (nlistTmp--) {
+ x += listTmp->xOff;
+ y += listTmp->yOff;
+ n = listTmp->len;
+ while (n--) {
+ glyph = *glyphsTmp++;
+ x1 = x - glyph->info.x;
+ y1 = y - glyph->info.y;
+ x2 = x1 + glyph->info.width;
+ y2 = y1 + glyph->info.height;
+ if (x1 < box.x1)
+ box.x1 = x1;
+ if (y1 < box.y1)
+ box.y1 = y1;
+ if (x2 > box.x2)
+ box.x2 = x2;
+ if (y2 > box.y2)
+ box.y2 = y2;
+ x += glyph->info.xOff;
+ y += glyph->info.yOff;
+ }
+ listTmp++;
+ }
+ TRIM_PICTURE_BOX(box, pDst);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDst->pDrawable, &box, pDst->subWindowMode);
}
- unwrap (pScrPriv, ps, Glyphs);
+ unwrap(pScrPriv, ps, Glyphs);
(*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
- damageRegionProcessPending (pDst->pDrawable);
- wrap (pScrPriv, ps, Glyphs, damageGlyphs);
+ damageRegionProcessPending(pDst->pDrawable);
+ wrap(pScrPriv, ps, Glyphs, damageGlyphs);
}
static void
-damageAddTraps (PicturePtr pPicture,
- INT16 x_off,
- INT16 y_off,
- int ntrap,
- xTrap *traps)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+damageAddTraps(PicturePtr pPicture,
+ INT16 x_off, INT16 y_off, int ntrap, xTrap * traps)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
damageScrPriv(pScreen);
- if (checkPictureDamage (pPicture))
- {
- BoxRec box;
- int i;
- int x, y;
- xTrap *t = traps;
-
- box.x1 = 32767;
- box.y1 = 32767;
- box.x2 = -32767;
- box.y2 = -32767;
- x = pPicture->pDrawable->x + x_off;
- y = pPicture->pDrawable->y + y_off;
- for (i = 0; i < ntrap; i++)
- {
- pixman_fixed_t l = min (t->top.l, t->bot.l);
- pixman_fixed_t r = max (t->top.r, t->bot.r);
- int x1 = x + pixman_fixed_to_int (l);
- int x2 = x + pixman_fixed_to_int (pixman_fixed_ceil (r));
- int y1 = y + pixman_fixed_to_int (t->top.y);
- int y2 = y + pixman_fixed_to_int (pixman_fixed_ceil (t->bot.y));
-
- if (x1 < box.x1)
- box.x1 = x1;
- if (x2 > box.x2)
- box.x2 = x2;
- if (y1 < box.y1)
- box.y1 = y1;
- if (y2 > box.y2)
- box.y2 = y2;
- }
- TRIM_PICTURE_BOX (box, pPicture);
- if (BOX_NOT_EMPTY(box))
- damageDamageBox (pPicture->pDrawable, &box, pPicture->subWindowMode);
+ if (checkPictureDamage(pPicture)) {
+ BoxRec box;
+ int i;
+ int x, y;
+ xTrap *t = traps;
+
+ box.x1 = 32767;
+ box.y1 = 32767;
+ box.x2 = -32767;
+ box.y2 = -32767;
+ x = pPicture->pDrawable->x + x_off;
+ y = pPicture->pDrawable->y + y_off;
+ for (i = 0; i < ntrap; i++) {
+ pixman_fixed_t l = min(t->top.l, t->bot.l);
+ pixman_fixed_t r = max(t->top.r, t->bot.r);
+ int x1 = x + pixman_fixed_to_int(l);
+ int x2 = x + pixman_fixed_to_int(pixman_fixed_ceil(r));
+ int y1 = y + pixman_fixed_to_int(t->top.y);
+ int y2 = y + pixman_fixed_to_int(pixman_fixed_ceil(t->bot.y));
+
+ if (x1 < box.x1)
+ box.x1 = x1;
+ if (x2 > box.x2)
+ box.x2 = x2;
+ if (y1 < box.y1)
+ box.y1 = y1;
+ if (y2 > box.y2)
+ box.y2 = y2;
+ }
+ TRIM_PICTURE_BOX(box, pPicture);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pPicture->pDrawable, &box, pPicture->subWindowMode);
}
- unwrap (pScrPriv, ps, AddTraps);
+ unwrap(pScrPriv, ps, AddTraps);
(*ps->AddTraps) (pPicture, x_off, y_off, ntrap, traps);
- damageRegionProcessPending (pPicture->pDrawable);
- wrap (pScrPriv, ps, AddTraps, damageAddTraps);
+ damageRegionProcessPending(pPicture->pDrawable);
+ wrap(pScrPriv, ps, AddTraps, damageAddTraps);
}
/**********************************************************/
-
static void
damageFillSpans(DrawablePtr pDrawable,
- GC *pGC,
- int npt,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted)
+ GC * pGC, int npt, DDXPointPtr ppt, int *pwidth, int fSorted)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (npt && checkGCDamage (pDrawable, pGC))
- {
- int nptTmp = npt;
- DDXPointPtr pptTmp = ppt;
- int *pwidthTmp = pwidth;
- BoxRec box;
-
- box.x1 = pptTmp->x;
- box.x2 = box.x1 + *pwidthTmp;
- box.y2 = box.y1 = pptTmp->y;
-
- while(--nptTmp)
- {
- pptTmp++;
- pwidthTmp++;
- if(box.x1 > pptTmp->x) box.x1 = pptTmp->x;
- if(box.x2 < (pptTmp->x + *pwidthTmp))
- box.x2 = pptTmp->x + *pwidthTmp;
- if(box.y1 > pptTmp->y) box.y1 = pptTmp->y;
- else if(box.y2 < pptTmp->y) box.y2 = pptTmp->y;
- }
-
- box.y2++;
-
- if(!pGC->miTranslate) {
- TRANSLATE_BOX(box, pDrawable);
+ if (npt && checkGCDamage(pDrawable, pGC)) {
+ int nptTmp = npt;
+ DDXPointPtr pptTmp = ppt;
+ int *pwidthTmp = pwidth;
+ BoxRec box;
+
+ box.x1 = pptTmp->x;
+ box.x2 = box.x1 + *pwidthTmp;
+ box.y2 = box.y1 = pptTmp->y;
+
+ while (--nptTmp) {
+ pptTmp++;
+ pwidthTmp++;
+ if (box.x1 > pptTmp->x)
+ box.x1 = pptTmp->x;
+ if (box.x2 < (pptTmp->x + *pwidthTmp))
+ box.x2 = pptTmp->x + *pwidthTmp;
+ if (box.y1 > pptTmp->y)
+ box.y1 = pptTmp->y;
+ else if (box.y2 < pptTmp->y)
+ box.y2 = pptTmp->y;
}
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ box.y2++;
+
+ if (!pGC->miTranslate) {
+ TRANSLATE_BOX(box, pDrawable);
+ }
+ TRIM_BOX(box, pGC);
+
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
-
- (*pGC->ops->FillSpans)(pDrawable, pGC, npt, ppt, pwidth, fSorted);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->FillSpans) (pDrawable, pGC, npt, ppt, pwidth, fSorted);
+
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
-damageSetSpans(DrawablePtr pDrawable,
- GCPtr pGC,
- char *pcharsrc,
- DDXPointPtr ppt,
- int *pwidth,
- int npt,
- int fSorted)
+damageSetSpans(DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pcharsrc,
+ DDXPointPtr ppt, int *pwidth, int npt, int fSorted)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (npt && checkGCDamage (pDrawable, pGC))
- {
- DDXPointPtr pptTmp = ppt;
- int *pwidthTmp = pwidth;
- int nptTmp = npt;
- BoxRec box;
-
- box.x1 = pptTmp->x;
- box.x2 = box.x1 + *pwidthTmp;
- box.y2 = box.y1 = pptTmp->y;
-
- while(--nptTmp)
- {
- pptTmp++;
- pwidthTmp++;
- if(box.x1 > pptTmp->x) box.x1 = pptTmp->x;
- if(box.x2 < (pptTmp->x + *pwidthTmp))
- box.x2 = pptTmp->x + *pwidthTmp;
- if(box.y1 > pptTmp->y) box.y1 = pptTmp->y;
- else if(box.y2 < pptTmp->y) box.y2 = pptTmp->y;
- }
-
- box.y2++;
-
- if(!pGC->miTranslate) {
- TRANSLATE_BOX(box, pDrawable);
+ if (npt && checkGCDamage(pDrawable, pGC)) {
+ DDXPointPtr pptTmp = ppt;
+ int *pwidthTmp = pwidth;
+ int nptTmp = npt;
+ BoxRec box;
+
+ box.x1 = pptTmp->x;
+ box.x2 = box.x1 + *pwidthTmp;
+ box.y2 = box.y1 = pptTmp->y;
+
+ while (--nptTmp) {
+ pptTmp++;
+ pwidthTmp++;
+ if (box.x1 > pptTmp->x)
+ box.x1 = pptTmp->x;
+ if (box.x2 < (pptTmp->x + *pwidthTmp))
+ box.x2 = pptTmp->x + *pwidthTmp;
+ if (box.y1 > pptTmp->y)
+ box.y1 = pptTmp->y;
+ else if (box.y2 < pptTmp->y)
+ box.y2 = pptTmp->y;
}
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ box.y2++;
+
+ if (!pGC->miTranslate) {
+ TRANSLATE_BOX(box, pDrawable);
+ }
+ TRIM_BOX(box, pGC);
+
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
- (*pGC->ops->SetSpans)(pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->SetSpans) (pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
-damagePutImage(DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage)
+damagePutImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y, int w, int h, int leftPad, int format, char *pImage)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (checkGCDamage (pDrawable, pGC))
- {
- BoxRec box;
-
- box.x1 = x + pDrawable->x;
- box.x2 = box.x1 + w;
- box.y1 = y + pDrawable->y;
- box.y2 = box.y1 + h;
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ if (checkGCDamage(pDrawable, pGC)) {
+ BoxRec box;
+
+ box.x1 = x + pDrawable->x;
+ box.x2 = box.x1 + w;
+ box.y1 = y + pDrawable->y;
+ box.y2 = box.y1 + h;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
- (*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static RegionPtr
-damageCopyArea(DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx,
- int srcy,
- int width,
- int height,
- int dstx,
- int dsty)
+damageCopyArea(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC * pGC,
+ int srcx, int srcy, int width, int height, int dstx, int dsty)
{
RegionPtr ret;
+
DAMAGE_GC_OP_PROLOGUE(pGC, pDst);
-
- if (checkGCDamage (pDst, pGC))
- {
- BoxRec box;
-
- box.x1 = dstx + pDst->x;
- box.x2 = box.x1 + width;
- box.y1 = dsty + pDst->y;
- box.y2 = box.y1 + height;
-
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDst, &box, pGC->subWindowMode);
+
+ if (checkGCDamage(pDst, pGC)) {
+ BoxRec box;
+
+ box.x1 = dstx + pDst->x;
+ box.x2 = box.x1 + width;
+ box.y1 = dsty + pDst->y;
+ box.y2 = box.y1 + height;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDst, &box, pGC->subWindowMode);
}
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
- damageRegionProcessPending (pDst);
+ ret = (*pGC->ops->CopyArea) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ damageRegionProcessPending(pDst);
DAMAGE_GC_OP_EPILOGUE(pGC, pDst);
return ret;
}
static RegionPtr
-damageCopyPlane(DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx,
- int srcy,
- int width,
- int height,
- int dstx,
- int dsty,
- unsigned long bitPlane)
+damageCopyPlane(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height, int dstx, int dsty, unsigned long bitPlane)
{
RegionPtr ret;
+
DAMAGE_GC_OP_PROLOGUE(pGC, pDst);
- if (checkGCDamage (pDst, pGC))
- {
- BoxRec box;
+ if (checkGCDamage(pDst, pGC)) {
+ BoxRec box;
- box.x1 = dstx + pDst->x;
- box.x2 = box.x1 + width;
- box.y1 = dsty + pDst->y;
- box.y2 = box.y1 + height;
+ box.x1 = dstx + pDst->x;
+ box.x2 = box.x1 + width;
+ box.y1 = dsty + pDst->y;
+ box.y2 = box.y1 + height;
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDst, &box, pGC->subWindowMode);
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDst, &box, pGC->subWindowMode);
}
- ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
- damageRegionProcessPending (pDst);
+ ret = (*pGC->ops->CopyPlane) (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ bitPlane);
+ damageRegionProcessPending(pDst);
DAMAGE_GC_OP_EPILOGUE(pGC, pDst);
return ret;
}
static void
damagePolyPoint(DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *ppt)
+ GCPtr pGC, int mode, int npt, xPoint * ppt)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (npt && checkGCDamage (pDrawable, pGC))
- {
- BoxRec box;
- int nptTmp = npt;
- xPoint *pptTmp = ppt;
-
- box.x2 = box.x1 = pptTmp->x;
- box.y2 = box.y1 = pptTmp->y;
-
- /* this could be slow if the points were spread out */
-
- while(--nptTmp)
- {
- pptTmp++;
- if(box.x1 > pptTmp->x) box.x1 = pptTmp->x;
- else if(box.x2 < pptTmp->x) box.x2 = pptTmp->x;
- if(box.y1 > pptTmp->y) box.y1 = pptTmp->y;
- else if(box.y2 < pptTmp->y) box.y2 = pptTmp->y;
- }
+ if (npt && checkGCDamage(pDrawable, pGC)) {
+ BoxRec box;
+ int nptTmp = npt;
+ xPoint *pptTmp = ppt;
+
+ box.x2 = box.x1 = pptTmp->x;
+ box.y2 = box.y1 = pptTmp->y;
+
+ /* this could be slow if the points were spread out */
+
+ while (--nptTmp) {
+ pptTmp++;
+ if (box.x1 > pptTmp->x)
+ box.x1 = pptTmp->x;
+ else if (box.x2 < pptTmp->x)
+ box.x2 = pptTmp->x;
+ if (box.y1 > pptTmp->y)
+ box.y1 = pptTmp->y;
+ else if (box.y2 < pptTmp->y)
+ box.y2 = pptTmp->y;
+ }
- box.x2++;
- box.y2++;
+ box.x2++;
+ box.y2++;
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
- (*pGC->ops->PolyPoint)(pDrawable, pGC, mode, npt, ppt);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, ppt);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
damagePolylines(DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
+ GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (npt && checkGCDamage (pDrawable, pGC))
- {
- int nptTmp = npt;
- DDXPointPtr pptTmp = ppt;
- BoxRec box;
- int extra = pGC->lineWidth >> 1;
-
- box.x2 = box.x1 = pptTmp->x;
- box.y2 = box.y1 = pptTmp->y;
-
- if(nptTmp > 1)
- {
- if(pGC->joinStyle == JoinMiter)
- extra = 6 * pGC->lineWidth;
- else if(pGC->capStyle == CapProjecting)
- extra = pGC->lineWidth;
+ if (npt && checkGCDamage(pDrawable, pGC)) {
+ int nptTmp = npt;
+ DDXPointPtr pptTmp = ppt;
+ BoxRec box;
+ int extra = pGC->lineWidth >> 1;
+
+ box.x2 = box.x1 = pptTmp->x;
+ box.y2 = box.y1 = pptTmp->y;
+
+ if (nptTmp > 1) {
+ if (pGC->joinStyle == JoinMiter)
+ extra = 6 * pGC->lineWidth;
+ else if (pGC->capStyle == CapProjecting)
+ extra = pGC->lineWidth;
}
- if(mode == CoordModePrevious)
- {
- int x = box.x1;
- int y = box.y1;
- while(--nptTmp)
- {
- pptTmp++;
- x += pptTmp->x;
- y += pptTmp->y;
- if(box.x1 > x) box.x1 = x;
- else if(box.x2 < x) box.x2 = x;
- if(box.y1 > y) box.y1 = y;
- else if(box.y2 < y) box.y2 = y;
- }
- }
- else
- {
- while(--nptTmp)
- {
- pptTmp++;
- if(box.x1 > pptTmp->x) box.x1 = pptTmp->x;
- else if(box.x2 < pptTmp->x) box.x2 = pptTmp->x;
- if(box.y1 > pptTmp->y) box.y1 = pptTmp->y;
- else if(box.y2 < pptTmp->y) box.y2 = pptTmp->y;
- }
- }
-
- box.x2++;
- box.y2++;
-
- if(extra)
- {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
+ if (mode == CoordModePrevious) {
+ int x = box.x1;
+ int y = box.y1;
+
+ while (--nptTmp) {
+ pptTmp++;
+ x += pptTmp->x;
+ y += pptTmp->y;
+ if (box.x1 > x)
+ box.x1 = x;
+ else if (box.x2 < x)
+ box.x2 = x;
+ if (box.y1 > y)
+ box.y1 = y;
+ else if (box.y2 < y)
+ box.y2 = y;
+ }
}
+ else {
+ while (--nptTmp) {
+ pptTmp++;
+ if (box.x1 > pptTmp->x)
+ box.x1 = pptTmp->x;
+ else if (box.x2 < pptTmp->x)
+ box.x2 = pptTmp->x;
+ if (box.y1 > pptTmp->y)
+ box.y1 = pptTmp->y;
+ else if (box.y2 < pptTmp->y)
+ box.y2 = pptTmp->y;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
- (*pGC->ops->Polylines)(pDrawable, pGC, mode, npt, ppt);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, ppt);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
-damagePolySegment(DrawablePtr pDrawable,
- GCPtr pGC,
- int nSeg,
- xSegment *pSeg)
+damagePolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSeg, xSegment * pSeg)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (nSeg && checkGCDamage (pDrawable, pGC))
- {
- BoxRec box;
- int extra = pGC->lineWidth;
- int nsegTmp = nSeg;
- xSegment *pSegTmp = pSeg;
-
- if(pGC->capStyle != CapProjecting)
- extra >>= 1;
-
- if(pSegTmp->x2 > pSegTmp->x1) {
- box.x1 = pSegTmp->x1;
- box.x2 = pSegTmp->x2;
- } else {
- box.x2 = pSegTmp->x1;
- box.x1 = pSegTmp->x2;
- }
-
- if(pSegTmp->y2 > pSegTmp->y1) {
- box.y1 = pSegTmp->y1;
- box.y2 = pSegTmp->y2;
- } else {
- box.y2 = pSegTmp->y1;
- box.y1 = pSegTmp->y2;
- }
-
- while(--nsegTmp)
- {
- pSegTmp++;
- if(pSegTmp->x2 > pSegTmp->x1)
- {
- if(pSegTmp->x1 < box.x1) box.x1 = pSegTmp->x1;
- if(pSegTmp->x2 > box.x2) box.x2 = pSegTmp->x2;
- }
- else
- {
- if(pSegTmp->x2 < box.x1) box.x1 = pSegTmp->x2;
- if(pSegTmp->x1 > box.x2) box.x2 = pSegTmp->x1;
- }
- if(pSegTmp->y2 > pSegTmp->y1)
- {
- if(pSegTmp->y1 < box.y1) box.y1 = pSegTmp->y1;
- if(pSegTmp->y2 > box.y2) box.y2 = pSegTmp->y2;
- }
- else
- {
- if(pSegTmp->y2 < box.y1) box.y1 = pSegTmp->y2;
- if(pSegTmp->y1 > box.y2) box.y2 = pSegTmp->y1;
- }
- }
-
- box.x2++;
- box.y2++;
-
- if(extra)
- {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
+ if (nSeg && checkGCDamage(pDrawable, pGC)) {
+ BoxRec box;
+ int extra = pGC->lineWidth;
+ int nsegTmp = nSeg;
+ xSegment *pSegTmp = pSeg;
+
+ if (pGC->capStyle != CapProjecting)
+ extra >>= 1;
+
+ if (pSegTmp->x2 > pSegTmp->x1) {
+ box.x1 = pSegTmp->x1;
+ box.x2 = pSegTmp->x2;
+ }
+ else {
+ box.x2 = pSegTmp->x1;
+ box.x1 = pSegTmp->x2;
+ }
+
+ if (pSegTmp->y2 > pSegTmp->y1) {
+ box.y1 = pSegTmp->y1;
+ box.y2 = pSegTmp->y2;
+ }
+ else {
+ box.y2 = pSegTmp->y1;
+ box.y1 = pSegTmp->y2;
+ }
+
+ while (--nsegTmp) {
+ pSegTmp++;
+ if (pSegTmp->x2 > pSegTmp->x1) {
+ if (pSegTmp->x1 < box.x1)
+ box.x1 = pSegTmp->x1;
+ if (pSegTmp->x2 > box.x2)
+ box.x2 = pSegTmp->x2;
+ }
+ else {
+ if (pSegTmp->x2 < box.x1)
+ box.x1 = pSegTmp->x2;
+ if (pSegTmp->x1 > box.x2)
+ box.x2 = pSegTmp->x1;
+ }
+ if (pSegTmp->y2 > pSegTmp->y1) {
+ if (pSegTmp->y1 < box.y1)
+ box.y1 = pSegTmp->y1;
+ if (pSegTmp->y2 > box.y2)
+ box.y2 = pSegTmp->y2;
+ }
+ else {
+ if (pSegTmp->y2 < box.y1)
+ box.y1 = pSegTmp->y2;
+ if (pSegTmp->y1 > box.y2)
+ box.y2 = pSegTmp->y1;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
}
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
- (*pGC->ops->PolySegment)(pDrawable, pGC, nSeg, pSeg);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->PolySegment) (pDrawable, pGC, nSeg, pSeg);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
-damagePolyRectangle(DrawablePtr pDrawable,
- GCPtr pGC,
- int nRects,
- xRectangle *pRects)
+damagePolyRectangle(DrawablePtr pDrawable,
+ GCPtr pGC, int nRects, xRectangle *pRects)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (nRects && checkGCDamage (pDrawable, pGC))
- {
- BoxRec box;
- int offset1, offset2, offset3;
- int nRectsTmp = nRects;
- xRectangle *pRectsTmp = pRects;
-
- offset2 = pGC->lineWidth;
- if(!offset2) offset2 = 1;
- offset1 = offset2 >> 1;
- offset3 = offset2 - offset1;
-
- while(nRectsTmp--)
- {
- box.x1 = pRectsTmp->x - offset1;
- box.y1 = pRectsTmp->y - offset1;
- box.x2 = box.x1 + pRectsTmp->width + offset2;
- box.y2 = box.y1 + offset2;
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
-
- box.x1 = pRectsTmp->x - offset1;
- box.y1 = pRectsTmp->y + offset3;
- box.x2 = box.x1 + offset2;
- box.y2 = box.y1 + pRectsTmp->height - offset2;
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
-
- box.x1 = pRectsTmp->x + pRectsTmp->width - offset1;
- box.y1 = pRectsTmp->y + offset3;
- box.x2 = box.x1 + offset2;
- box.y2 = box.y1 + pRectsTmp->height - offset2;
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
-
- box.x1 = pRectsTmp->x - offset1;
- box.y1 = pRectsTmp->y + pRectsTmp->height - offset1;
- box.x2 = box.x1 + pRectsTmp->width + offset2;
- box.y2 = box.y1 + offset2;
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
-
- pRectsTmp++;
- }
+ if (nRects && checkGCDamage(pDrawable, pGC)) {
+ BoxRec box;
+ int offset1, offset2, offset3;
+ int nRectsTmp = nRects;
+ xRectangle *pRectsTmp = pRects;
+
+ offset2 = pGC->lineWidth;
+ if (!offset2)
+ offset2 = 1;
+ offset1 = offset2 >> 1;
+ offset3 = offset2 - offset1;
+
+ while (nRectsTmp--) {
+ box.x1 = pRectsTmp->x - offset1;
+ box.y1 = pRectsTmp->y - offset1;
+ box.x2 = box.x1 + pRectsTmp->width + offset2;
+ box.y2 = box.y1 + offset2;
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
+
+ box.x1 = pRectsTmp->x - offset1;
+ box.y1 = pRectsTmp->y + offset3;
+ box.x2 = box.x1 + offset2;
+ box.y2 = box.y1 + pRectsTmp->height - offset2;
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
+
+ box.x1 = pRectsTmp->x + pRectsTmp->width - offset1;
+ box.y1 = pRectsTmp->y + offset3;
+ box.x2 = box.x1 + offset2;
+ box.y2 = box.y1 + pRectsTmp->height - offset2;
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
+
+ box.x1 = pRectsTmp->x - offset1;
+ box.y1 = pRectsTmp->y + pRectsTmp->height - offset1;
+ box.x2 = box.x1 + pRectsTmp->width + offset2;
+ box.y2 = box.y1 + offset2;
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
+
+ pRectsTmp++;
+ }
}
- (*pGC->ops->PolyRectangle)(pDrawable, pGC, nRects, pRects);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->PolyRectangle) (pDrawable, pGC, nRects, pRects);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
-damagePolyArc(DrawablePtr pDrawable,
- GCPtr pGC,
- int nArcs,
- xArc *pArcs)
+damagePolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc * pArcs)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (nArcs && checkGCDamage (pDrawable, pGC))
- {
- int extra = pGC->lineWidth >> 1;
- BoxRec box;
- int nArcsTmp = nArcs;
- xArc *pArcsTmp = pArcs;
-
- box.x1 = pArcsTmp->x;
- box.x2 = box.x1 + pArcsTmp->width;
- box.y1 = pArcsTmp->y;
- box.y2 = box.y1 + pArcsTmp->height;
-
- while(--nArcsTmp)
- {
- pArcsTmp++;
- if(box.x1 > pArcsTmp->x)
- box.x1 = pArcsTmp->x;
- if(box.x2 < (pArcsTmp->x + pArcsTmp->width))
- box.x2 = pArcsTmp->x + pArcsTmp->width;
- if(box.y1 > pArcsTmp->y)
- box.y1 = pArcsTmp->y;
- if(box.y2 < (pArcsTmp->y + pArcsTmp->height))
- box.y2 = pArcsTmp->y + pArcsTmp->height;
+ if (nArcs && checkGCDamage(pDrawable, pGC)) {
+ int extra = pGC->lineWidth >> 1;
+ BoxRec box;
+ int nArcsTmp = nArcs;
+ xArc *pArcsTmp = pArcs;
+
+ box.x1 = pArcsTmp->x;
+ box.x2 = box.x1 + pArcsTmp->width;
+ box.y1 = pArcsTmp->y;
+ box.y2 = box.y1 + pArcsTmp->height;
+
+ while (--nArcsTmp) {
+ pArcsTmp++;
+ if (box.x1 > pArcsTmp->x)
+ box.x1 = pArcsTmp->x;
+ if (box.x2 < (pArcsTmp->x + pArcsTmp->width))
+ box.x2 = pArcsTmp->x + pArcsTmp->width;
+ if (box.y1 > pArcsTmp->y)
+ box.y1 = pArcsTmp->y;
+ if (box.y2 < (pArcsTmp->y + pArcsTmp->height))
+ box.y2 = pArcsTmp->y + pArcsTmp->height;
}
- if(extra)
- {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
}
- box.x2++;
- box.y2++;
+ box.x2++;
+ box.y2++;
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
- (*pGC->ops->PolyArc)(pDrawable, pGC, nArcs, pArcs);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->PolyArc) (pDrawable, pGC, nArcs, pArcs);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
-damageFillPolygon(DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int npt,
- DDXPointPtr ppt)
+damageFillPolygon(DrawablePtr pDrawable,
+ GCPtr pGC, int shape, int mode, int npt, DDXPointPtr ppt)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (npt > 2 && checkGCDamage (pDrawable, pGC))
- {
- DDXPointPtr pptTmp = ppt;
- int nptTmp = npt;
- BoxRec box;
-
- box.x2 = box.x1 = pptTmp->x;
- box.y2 = box.y1 = pptTmp->y;
-
- if(mode != CoordModeOrigin)
- {
- int x = box.x1;
- int y = box.y1;
- while(--nptTmp)
- {
- pptTmp++;
- x += pptTmp->x;
- y += pptTmp->y;
- if(box.x1 > x) box.x1 = x;
- else if(box.x2 < x) box.x2 = x;
- if(box.y1 > y) box.y1 = y;
- else if(box.y2 < y) box.y2 = y;
- }
- }
- else
- {
- while(--nptTmp)
- {
- pptTmp++;
- if(box.x1 > pptTmp->x) box.x1 = pptTmp->x;
- else if(box.x2 < pptTmp->x) box.x2 = pptTmp->x;
- if(box.y1 > pptTmp->y) box.y1 = pptTmp->y;
- else if(box.y2 < pptTmp->y) box.y2 = pptTmp->y;
- }
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ if (npt > 2 && checkGCDamage(pDrawable, pGC)) {
+ DDXPointPtr pptTmp = ppt;
+ int nptTmp = npt;
+ BoxRec box;
+
+ box.x2 = box.x1 = pptTmp->x;
+ box.y2 = box.y1 = pptTmp->y;
+
+ if (mode != CoordModeOrigin) {
+ int x = box.x1;
+ int y = box.y1;
+
+ while (--nptTmp) {
+ pptTmp++;
+ x += pptTmp->x;
+ y += pptTmp->y;
+ if (box.x1 > x)
+ box.x1 = x;
+ else if (box.x2 < x)
+ box.x2 = x;
+ if (box.y1 > y)
+ box.y1 = y;
+ else if (box.y2 < y)
+ box.y2 = y;
+ }
+ }
+ else {
+ while (--nptTmp) {
+ pptTmp++;
+ if (box.x1 > pptTmp->x)
+ box.x1 = pptTmp->x;
+ else if (box.x2 < pptTmp->x)
+ box.x2 = pptTmp->x;
+ if (box.y1 > pptTmp->y)
+ box.y1 = pptTmp->y;
+ else if (box.y2 < pptTmp->y)
+ box.y2 = pptTmp->y;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
-
- (*pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, npt, ppt);
- damageRegionProcessPending (pDrawable);
+
+ (*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, npt, ppt);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
-
static void
-damagePolyFillRect(DrawablePtr pDrawable,
- GCPtr pGC,
- int nRects,
- xRectangle *pRects)
+damagePolyFillRect(DrawablePtr pDrawable,
+ GCPtr pGC, int nRects, xRectangle *pRects)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (nRects && checkGCDamage (pDrawable, pGC))
- {
- BoxRec box;
- xRectangle *pRectsTmp = pRects;
- int nRectsTmp = nRects;
-
- box.x1 = pRectsTmp->x;
- box.x2 = box.x1 + (short)pRectsTmp->width;
- box.y1 = pRectsTmp->y;
- box.y2 = box.y1 + (short)pRectsTmp->height;
-
- while(--nRectsTmp)
- {
- pRectsTmp++;
- if(box.x1 > pRectsTmp->x) box.x1 = pRectsTmp->x;
- if(box.x2 < (pRectsTmp->x + pRectsTmp->width))
- box.x2 = pRectsTmp->x + pRectsTmp->width;
- if(box.y1 > pRectsTmp->y) box.y1 = pRectsTmp->y;
- if(box.y2 < (pRectsTmp->y + pRectsTmp->height))
- box.y2 = pRectsTmp->y + pRectsTmp->height;
- }
-
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ if (nRects && checkGCDamage(pDrawable, pGC)) {
+ BoxRec box;
+ xRectangle *pRectsTmp = pRects;
+ int nRectsTmp = nRects;
+
+ box.x1 = pRectsTmp->x;
+ box.x2 = box.x1 + (short)pRectsTmp->width;
+ box.y1 = pRectsTmp->y;
+ box.y2 = box.y1 + (short)pRectsTmp->height;
+
+ while (--nRectsTmp) {
+ pRectsTmp++;
+ if (box.x1 > pRectsTmp->x)
+ box.x1 = pRectsTmp->x;
+ if (box.x2 < (pRectsTmp->x + pRectsTmp->width))
+ box.x2 = pRectsTmp->x + pRectsTmp->width;
+ if (box.y1 > pRectsTmp->y)
+ box.y1 = pRectsTmp->y;
+ if (box.y2 < (pRectsTmp->y + pRectsTmp->height))
+ box.y2 = pRectsTmp->y + pRectsTmp->height;
+ }
+
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
- (*pGC->ops->PolyFillRect)(pDrawable, pGC, nRects, pRects);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->PolyFillRect) (pDrawable, pGC, nRects, pRects);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
-
static void
-damagePolyFillArc(DrawablePtr pDrawable,
- GCPtr pGC,
- int nArcs,
- xArc *pArcs)
+damagePolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc * pArcs)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (nArcs && checkGCDamage (pDrawable, pGC))
- {
- BoxRec box;
- int nArcsTmp = nArcs;
- xArc *pArcsTmp = pArcs;
-
- box.x1 = pArcsTmp->x;
- box.x2 = box.x1 + pArcsTmp->width;
- box.y1 = pArcsTmp->y;
- box.y2 = box.y1 + pArcsTmp->height;
-
- while(--nArcsTmp)
- {
- pArcsTmp++;
- if(box.x1 > pArcsTmp->x)
- box.x1 = pArcsTmp->x;
- if(box.x2 < (pArcsTmp->x + pArcsTmp->width))
- box.x2 = pArcsTmp->x + pArcsTmp->width;
- if(box.y1 > pArcsTmp->y)
- box.y1 = pArcsTmp->y;
- if(box.y2 < (pArcsTmp->y + pArcsTmp->height))
- box.y2 = pArcsTmp->y + pArcsTmp->height;
+ if (nArcs && checkGCDamage(pDrawable, pGC)) {
+ BoxRec box;
+ int nArcsTmp = nArcs;
+ xArc *pArcsTmp = pArcs;
+
+ box.x1 = pArcsTmp->x;
+ box.x2 = box.x1 + pArcsTmp->width;
+ box.y1 = pArcsTmp->y;
+ box.y2 = box.y1 + pArcsTmp->height;
+
+ while (--nArcsTmp) {
+ pArcsTmp++;
+ if (box.x1 > pArcsTmp->x)
+ box.x1 = pArcsTmp->x;
+ if (box.x2 < (pArcsTmp->x + pArcsTmp->width))
+ box.x2 = pArcsTmp->x + pArcsTmp->width;
+ if (box.y1 > pArcsTmp->y)
+ box.y1 = pArcsTmp->y;
+ if (box.y2 < (pArcsTmp->y + pArcsTmp->height))
+ box.y2 = pArcsTmp->y + pArcsTmp->height;
}
- TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
- (*pGC->ops->PolyFillArc)(pDrawable, pGC, nArcs, pArcs);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->PolyFillArc) (pDrawable, pGC, nArcs, pArcs);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1359,37 +1297,34 @@ damagePolyFillArc(DrawablePtr pDrawable,
*/
static void
-damageDamageChars (DrawablePtr pDrawable,
- FontPtr font,
- int x,
- int y,
- unsigned int n,
- CharInfoPtr *charinfo,
- Bool imageblt,
- int subWindowMode)
-{
- ExtentInfoRec extents;
- BoxRec box;
+damageDamageChars(DrawablePtr pDrawable,
+ FontPtr font,
+ int x,
+ int y,
+ unsigned int n,
+ CharInfoPtr * charinfo, Bool imageblt, int subWindowMode)
+{
+ ExtentInfoRec extents;
+ BoxRec box;
QueryGlyphExtents(font, charinfo, n, &extents);
- if (imageblt)
- {
- if (extents.overallWidth > extents.overallRight)
- extents.overallRight = extents.overallWidth;
- if (extents.overallWidth < extents.overallLeft)
- extents.overallLeft = extents.overallWidth;
- if (extents.overallLeft > 0)
- extents.overallLeft = 0;
- if (extents.fontAscent > extents.overallAscent)
- extents.overallAscent = extents.fontAscent;
- if (extents.fontDescent > extents.overallDescent)
- extents.overallDescent = extents.fontDescent;
+ if (imageblt) {
+ if (extents.overallWidth > extents.overallRight)
+ extents.overallRight = extents.overallWidth;
+ if (extents.overallWidth < extents.overallLeft)
+ extents.overallLeft = extents.overallWidth;
+ if (extents.overallLeft > 0)
+ extents.overallLeft = 0;
+ if (extents.fontAscent > extents.overallAscent)
+ extents.overallAscent = extents.fontAscent;
+ if (extents.fontDescent > extents.overallDescent)
+ extents.overallDescent = extents.fontDescent;
}
box.x1 = x + extents.overallLeft;
box.y1 = y - extents.overallAscent;
box.x2 = x + extents.overallRight;
box.y2 = y + extents.overallDescent;
- damageDamageBox (pDrawable, &box, subWindowMode);
+ damageDamageBox(pDrawable, &box, subWindowMode);
}
/*
@@ -1400,46 +1335,45 @@ damageDamageChars (DrawablePtr pDrawable,
#define TT_POLY16 2
#define TT_IMAGE16 3
-static int
-damageText (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned long count,
- char *chars,
- FontEncoding fontEncoding,
- Bool textType)
-{
- CharInfoPtr *charinfo;
- CharInfoPtr *info;
- unsigned long i;
- unsigned int n;
- int w;
- Bool imageblt;
+static int
+damageText(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned long count,
+ char *chars, FontEncoding fontEncoding, Bool textType)
+{
+ CharInfoPtr *charinfo;
+ CharInfoPtr *info;
+ unsigned long i;
+ unsigned int n;
+ int w;
+ Bool imageblt;
imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16);
charinfo = malloc(count * sizeof(CharInfoPtr));
if (!charinfo)
- return x;
+ return x;
- GetGlyphs(pGC->font, count, (unsigned char *)chars,
- fontEncoding, &i, charinfo);
- n = (unsigned int)i;
+ GetGlyphs(pGC->font, count, (unsigned char *) chars,
+ fontEncoding, &i, charinfo);
+ n = (unsigned int) i;
w = 0;
if (!imageblt)
- for (info = charinfo; i--; info++)
- w += (*info)->metrics.characterWidth;
+ for (info = charinfo; i--; info++)
+ w += (*info)->metrics.characterWidth;
if (n != 0) {
- damageDamageChars (pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, n,
- charinfo, imageblt, pGC->subWindowMode);
- if (imageblt)
- (*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, n, charinfo,
- FONTGLYPHS(pGC->font));
- else
- (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, n, charinfo,
- FONTGLYPHS(pGC->font));
+ damageDamageChars(pDrawable, pGC->font, x + pDrawable->x,
+ y + pDrawable->y, n, charinfo, imageblt,
+ pGC->subWindowMode);
+ if (imageblt)
+ (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, n, charinfo,
+ FONTGLYPHS(pGC->font));
+ else
+ (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, n, charinfo,
+ FONTGLYPHS(pGC->font));
}
free(charinfo);
return x + w;
@@ -1447,238 +1381,206 @@ damageText (DrawablePtr pDrawable,
static int
damagePolyText8(DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars)
+ GCPtr pGC, int x, int y, int count, char *chars)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (checkGCDamage (pDrawable, pGC))
- x = damageText (pDrawable, pGC, x, y, (unsigned long) count, chars,
- Linear8Bit, TT_POLY8);
+ if (checkGCDamage(pDrawable, pGC))
+ x = damageText(pDrawable, pGC, x, y, (unsigned long) count, chars,
+ Linear8Bit, TT_POLY8);
else
- x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars);
- damageRegionProcessPending (pDrawable);
+ x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x;
}
static int
-damagePolyText16(DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars)
+damagePolyText16(DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (checkGCDamage (pDrawable, pGC))
- x = damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
- FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
- TT_POLY16);
+ if (checkGCDamage(pDrawable, pGC))
+ x = damageText(pDrawable, pGC, x, y, (unsigned long) count,
+ (char *) chars,
+ FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
+ TT_POLY16);
else
- x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars);
- damageRegionProcessPending (pDrawable);
+ x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x;
}
static void
-damageImageText8(DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars)
+damageImageText8(DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, char *chars)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (checkGCDamage (pDrawable, pGC))
- damageText (pDrawable, pGC, x, y, (unsigned long) count, chars,
- Linear8Bit, TT_IMAGE8);
+ if (checkGCDamage(pDrawable, pGC))
+ damageText(pDrawable, pGC, x, y, (unsigned long) count, chars,
+ Linear8Bit, TT_IMAGE8);
else
- (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
-damageImageText16(DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars)
+damageImageText16(DrawablePtr pDrawable,
+ GCPtr pGC, int x, int y, int count, unsigned short *chars)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (checkGCDamage (pDrawable, pGC))
- damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
- FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
- TT_IMAGE16);
+ if (checkGCDamage(pDrawable, pGC))
+ damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
+ FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
+ TT_IMAGE16);
else
- (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
-
static void
-damageImageGlyphBlt(DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
+damageImageGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- damageDamageChars (pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y,
- nglyph, ppci, TRUE, pGC->subWindowMode);
- (*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph,
- ppci, pglyphBase);
- damageRegionProcessPending (pDrawable);
+ damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y,
+ nglyph, ppci, TRUE, pGC->subWindowMode);
+ (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
-damagePolyGlyphBlt(DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
+damagePolyGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- damageDamageChars (pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y,
- nglyph, ppci, FALSE, pGC->subWindowMode);
- (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph,
- ppci, pglyphBase);
- damageRegionProcessPending (pDrawable);
+ damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y,
+ nglyph, ppci, FALSE, pGC->subWindowMode);
+ (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
-damagePushPixels(GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDrawable,
- int dx,
- int dy,
- int xOrg,
- int yOrg)
+damagePushPixels(GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if(checkGCDamage (pDrawable, pGC))
- {
- BoxRec box;
+ if (checkGCDamage(pDrawable, pGC)) {
+ BoxRec box;
box.x1 = xOrg;
box.y1 = yOrg;
- if(!pGC->miTranslate) {
- box.x1 += pDrawable->x;
- box.y1 += pDrawable->y;
+ if (!pGC->miTranslate) {
+ box.x1 += pDrawable->x;
+ box.y1 += pDrawable->y;
}
- box.x2 = box.x1 + dx;
- box.y2 = box.y1 + dy;
+ box.x2 = box.x1 + dx;
+ box.y2 = box.y1 + dy;
- TRIM_BOX(box, pGC);
- if(BOX_NOT_EMPTY(box))
- damageDamageBox (pDrawable, &box, pGC->subWindowMode);
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox(pDrawable, &box, pGC->subWindowMode);
}
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg);
- damageRegionProcessPending (pDrawable);
+ (*pGC->ops->PushPixels) (pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg);
+ damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
static void
-damageRemoveDamage (DamagePtr *pPrev, DamagePtr pDamage)
-{
- while (*pPrev)
- {
- if (*pPrev == pDamage)
- {
- *pPrev = pDamage->pNext;
- return;
- }
- pPrev = &(*pPrev)->pNext;
+damageRemoveDamage(DamagePtr * pPrev, DamagePtr pDamage)
+{
+ while (*pPrev) {
+ if (*pPrev == pDamage) {
+ *pPrev = pDamage->pNext;
+ return;
+ }
+ pPrev = &(*pPrev)->pNext;
}
#if DAMAGE_VALIDATE_ENABLE
- ErrorF ("Damage not on list\n");
- OsAbort ();
+ ErrorF("Damage not on list\n");
+ OsAbort();
#endif
}
static void
-damageInsertDamage (DamagePtr *pPrev, DamagePtr pDamage)
+damageInsertDamage(DamagePtr * pPrev, DamagePtr pDamage)
{
#if DAMAGE_VALIDATE_ENABLE
- DamagePtr pOld;
+ DamagePtr pOld;
for (pOld = *pPrev; pOld; pOld = pOld->pNext)
- if (pOld == pDamage) {
- ErrorF ("Damage already on list\n");
- OsAbort ();
- }
+ if (pOld == pDamage) {
+ ErrorF("Damage already on list\n");
+ OsAbort();
+ }
#endif
pDamage->pNext = *pPrev;
*pPrev = pDamage;
}
static Bool
-damageDestroyPixmap (PixmapPtr pPixmap)
+damageDestroyPixmap(PixmapPtr pPixmap)
{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
damageScrPriv(pScreen);
- if (pPixmap->refcnt == 1)
- {
- DamagePtr *pPrev = getPixmapDamageRef (pPixmap);
- DamagePtr pDamage;
-
- while ((pDamage = *pPrev))
- {
- damageRemoveDamage (pPrev, pDamage);
- if (!pDamage->isWindow)
- DamageDestroy (pDamage);
- }
+ if (pPixmap->refcnt == 1) {
+ DamagePtr *pPrev = getPixmapDamageRef(pPixmap);
+ DamagePtr pDamage;
+
+ while ((pDamage = *pPrev)) {
+ damageRemoveDamage(pPrev, pDamage);
+ if (!pDamage->isWindow)
+ DamageDestroy(pDamage);
+ }
}
- unwrap (pScrPriv, pScreen, DestroyPixmap);
+ unwrap(pScrPriv, pScreen, DestroyPixmap);
(*pScreen->DestroyPixmap) (pPixmap);
- wrap (pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
+ wrap(pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
return TRUE;
}
static void
-damageCopyWindow(WindowPtr pWindow,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
+damageCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
ScreenPtr pScreen = pWindow->drawable.pScreen;
+
damageScrPriv(pScreen);
- if (getWindowDamage (pWindow))
- {
- int dx = pWindow->drawable.x - ptOldOrg.x;
- int dy = pWindow->drawable.y - ptOldOrg.y;
-
- /*
- * The region comes in source relative, but the damage occurs
- * at the destination location. Translate back and forth.
- */
- RegionTranslate(prgnSrc, dx, dy);
- damageRegionAppend (&pWindow->drawable, prgnSrc, FALSE, -1);
- RegionTranslate(prgnSrc, -dx, -dy);
+ if (getWindowDamage(pWindow)) {
+ int dx = pWindow->drawable.x - ptOldOrg.x;
+ int dy = pWindow->drawable.y - ptOldOrg.y;
+
+ /*
+ * The region comes in source relative, but the damage occurs
+ * at the destination location. Translate back and forth.
+ */
+ RegionTranslate(prgnSrc, dx, dy);
+ damageRegionAppend(&pWindow->drawable, prgnSrc, FALSE, -1);
+ RegionTranslate(prgnSrc, -dx, -dy);
}
- unwrap (pScrPriv, pScreen, CopyWindow);
+ unwrap(pScrPriv, pScreen, CopyWindow);
(*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc);
- damageRegionProcessPending (&pWindow->drawable);
- wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow);
+ damageRegionProcessPending(&pWindow->drawable);
+ wrap(pScrPriv, pScreen, CopyWindow, damageCopyWindow);
}
static GCOps damageGCOps = {
@@ -1695,66 +1597,63 @@ static GCOps damageGCOps = {
};
static void
-damageSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
+damageSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
{
- DamagePtr pDamage;
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DamagePtr pDamage;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+
damageScrPriv(pScreen);
- if ((pDamage = damageGetWinPriv(pWindow)))
- {
- PixmapPtr pOldPixmap = (*pScreen->GetWindowPixmap) (pWindow);
- DamagePtr *pPrev = getPixmapDamageRef(pOldPixmap);
-
- while (pDamage)
- {
- damageRemoveDamage (pPrev, pDamage);
- pDamage = pDamage->pNextWin;
- }
+ if ((pDamage = damageGetWinPriv(pWindow))) {
+ PixmapPtr pOldPixmap = (*pScreen->GetWindowPixmap) (pWindow);
+ DamagePtr *pPrev = getPixmapDamageRef(pOldPixmap);
+
+ while (pDamage) {
+ damageRemoveDamage(pPrev, pDamage);
+ pDamage = pDamage->pNextWin;
+ }
}
- unwrap (pScrPriv, pScreen, SetWindowPixmap);
+ unwrap(pScrPriv, pScreen, SetWindowPixmap);
(*pScreen->SetWindowPixmap) (pWindow, pPixmap);
- wrap (pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
- if ((pDamage = damageGetWinPriv(pWindow)))
- {
- DamagePtr *pPrev = getPixmapDamageRef(pPixmap);
-
- while (pDamage)
- {
- damageInsertDamage (pPrev, pDamage);
- pDamage = pDamage->pNextWin;
- }
+ wrap(pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
+ if ((pDamage = damageGetWinPriv(pWindow))) {
+ DamagePtr *pPrev = getPixmapDamageRef(pPixmap);
+
+ while (pDamage) {
+ damageInsertDamage(pPrev, pDamage);
+ pDamage = pDamage->pNextWin;
+ }
}
}
static Bool
-damageDestroyWindow (WindowPtr pWindow)
+damageDestroyWindow(WindowPtr pWindow)
{
- DamagePtr pDamage;
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- Bool ret;
+ DamagePtr pDamage;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ Bool ret;
+
damageScrPriv(pScreen);
- while ((pDamage = damageGetWinPriv(pWindow)))
- {
- DamageUnregister (&pWindow->drawable, pDamage);
- DamageDestroy (pDamage);
+ while ((pDamage = damageGetWinPriv(pWindow))) {
+ DamageUnregister(&pWindow->drawable, pDamage);
+ DamageDestroy(pDamage);
}
- unwrap (pScrPriv, pScreen, DestroyWindow);
+ unwrap(pScrPriv, pScreen, DestroyWindow);
ret = (*pScreen->DestroyWindow) (pWindow);
- wrap (pScrPriv, pScreen, DestroyWindow, damageDestroyWindow);
+ wrap(pScrPriv, pScreen, DestroyWindow, damageDestroyWindow);
return ret;
}
static Bool
-damageCloseScreen (int i, ScreenPtr pScreen)
+damageCloseScreen(int i, ScreenPtr pScreen)
{
damageScrPriv(pScreen);
- unwrap (pScrPriv, pScreen, DestroyPixmap);
- unwrap (pScrPriv, pScreen, CreateGC);
- unwrap (pScrPriv, pScreen, CopyWindow);
- unwrap (pScrPriv, pScreen, CloseScreen);
+ unwrap(pScrPriv, pScreen, DestroyPixmap);
+ unwrap(pScrPriv, pScreen, CreateGC);
+ unwrap(pScrPriv, pScreen, CopyWindow);
+ unwrap(pScrPriv, pScreen, CloseScreen);
free(pScrPriv);
return (*pScreen->CloseScreen) (i, pScreen);
}
@@ -1762,19 +1661,23 @@ damageCloseScreen (int i, ScreenPtr pScreen)
/**
* Default implementations of the damage management functions.
*/
-void miDamageCreate (DamagePtr pDamage)
+void
+miDamageCreate(DamagePtr pDamage)
{
}
-void miDamageRegister (DrawablePtr pDrawable, DamagePtr pDamage)
+void
+miDamageRegister(DrawablePtr pDrawable, DamagePtr pDamage)
{
}
-void miDamageUnregister (DrawablePtr pDrawable, DamagePtr pDamage)
+void
+miDamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage)
{
}
-void miDamageDestroy (DamagePtr pDamage)
+void
+miDamageDestroy(DamagePtr pDamage)
{
}
@@ -1783,46 +1686,48 @@ void miDamageDestroy (DamagePtr pDamage)
*/
Bool
-DamageSetup (ScreenPtr pScreen)
+DamageSetup(ScreenPtr pScreen)
{
- DamageScrPrivPtr pScrPriv;
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ DamageScrPrivPtr pScrPriv;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+
const DamageScreenFuncsRec miFuncs = {
- miDamageCreate, miDamageRegister, miDamageUnregister, miDamageDestroy
+ miDamageCreate, miDamageRegister, miDamageUnregister, miDamageDestroy
};
if (!dixRegisterPrivateKey(&damageScrPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (dixLookupPrivate(&pScreen->devPrivates, damageScrPrivateKey))
- return TRUE;
+ return TRUE;
- if (!dixRegisterPrivateKey(&damageGCPrivateKeyRec, PRIVATE_GC, sizeof(DamageGCPrivRec)))
- return FALSE;
+ if (!dixRegisterPrivateKey
+ (&damageGCPrivateKeyRec, PRIVATE_GC, sizeof(DamageGCPrivRec)))
+ return FALSE;
if (!dixRegisterPrivateKey(&damagePixPrivateKeyRec, PRIVATE_PIXMAP, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&damageWinPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ return FALSE;
- pScrPriv = malloc(sizeof (DamageScrPrivRec));
+ pScrPriv = malloc(sizeof(DamageScrPrivRec));
if (!pScrPriv)
- return FALSE;
+ return FALSE;
pScrPriv->internalLevel = 0;
pScrPriv->pScreenDamage = 0;
- wrap (pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
- wrap (pScrPriv, pScreen, CreateGC, damageCreateGC);
- wrap (pScrPriv, pScreen, DestroyWindow, damageDestroyWindow);
- wrap (pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
- wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow);
- wrap (pScrPriv, pScreen, CloseScreen, damageCloseScreen);
+ wrap(pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
+ wrap(pScrPriv, pScreen, CreateGC, damageCreateGC);
+ wrap(pScrPriv, pScreen, DestroyWindow, damageDestroyWindow);
+ wrap(pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
+ wrap(pScrPriv, pScreen, CopyWindow, damageCopyWindow);
+ wrap(pScrPriv, pScreen, CloseScreen, damageCloseScreen);
if (ps) {
- wrap (pScrPriv, ps, Glyphs, damageGlyphs);
- wrap (pScrPriv, ps, Composite, damageComposite);
- wrap (pScrPriv, ps, AddTraps, damageAddTraps);
+ wrap(pScrPriv, ps, Glyphs, damageGlyphs);
+ wrap(pScrPriv, ps, Composite, damageComposite);
+ wrap(pScrPriv, ps, AddTraps, damageAddTraps);
}
pScrPriv->funcs = miFuncs;
@@ -1832,24 +1737,22 @@ DamageSetup (ScreenPtr pScreen)
}
DamagePtr
-DamageCreate (DamageReportFunc damageReport,
- DamageDestroyFunc damageDestroy,
- DamageReportLevel damageLevel,
- Bool isInternal,
- ScreenPtr pScreen,
- void *closure)
+DamageCreate(DamageReportFunc damageReport,
+ DamageDestroyFunc damageDestroy,
+ DamageReportLevel damageLevel,
+ Bool isInternal, ScreenPtr pScreen, void *closure)
{
damageScrPriv(pScreen);
- DamagePtr pDamage;
+ DamagePtr pDamage;
pDamage = dixAllocateObjectWithPrivates(DamageRec, PRIVATE_DAMAGE);
if (!pDamage)
- return 0;
+ return 0;
pDamage->pNext = 0;
pDamage->pNextWin = 0;
RegionNull(&pDamage->damage);
RegionNull(&pDamage->pendingDamage);
-
+
pDamage->damageLevel = damageLevel;
pDamage->isInternal = isInternal;
pDamage->closure = closure;
@@ -1869,101 +1772,99 @@ DamageCreate (DamageReportFunc damageReport,
}
void
-DamageRegister (DrawablePtr pDrawable,
- DamagePtr pDamage)
+DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage)
{
ScreenPtr pScreen = pDrawable->pScreen;
+
damageScrPriv(pScreen);
#if DAMAGE_VALIDATE_ENABLE
- if (pDrawable->pScreen != pDamage->pScreen)
- {
- ErrorF ("DamageRegister called with mismatched screens\n");
- OsAbort ();
+ if (pDrawable->pScreen != pDamage->pScreen) {
+ ErrorF("DamageRegister called with mismatched screens\n");
+ OsAbort();
}
#endif
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- WindowPtr pWindow = (WindowPtr) pDrawable;
- winDamageRef(pWindow);
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWindow = (WindowPtr) pDrawable;
+
+ winDamageRef(pWindow);
#if DAMAGE_VALIDATE_ENABLE
- DamagePtr pOld;
-
- for (pOld = *pPrev; pOld; pOld = pOld->pNextWin)
- if (pOld == pDamage) {
- ErrorF ("Damage already on window list\n");
- OsAbort ();
- }
+ DamagePtr pOld;
+
+ for (pOld = *pPrev; pOld; pOld = pOld->pNextWin)
+ if (pOld == pDamage) {
+ ErrorF("Damage already on window list\n");
+ OsAbort();
+ }
#endif
- pDamage->pNextWin = *pPrev;
- *pPrev = pDamage;
- pDamage->isWindow = TRUE;
+ pDamage->pNextWin = *pPrev;
+ *pPrev = pDamage;
+ pDamage->isWindow = TRUE;
}
else
- pDamage->isWindow = FALSE;
+ pDamage->isWindow = FALSE;
pDamage->pDrawable = pDrawable;
- damageInsertDamage (getDrawableDamageRef (pDrawable), pDamage);
+ damageInsertDamage(getDrawableDamageRef(pDrawable), pDamage);
(*pScrPriv->funcs.Register) (pDrawable, pDamage);
}
void
-DamageDrawInternal (ScreenPtr pScreen, Bool enable)
+DamageDrawInternal(ScreenPtr pScreen, Bool enable)
{
- damageScrPriv (pScreen);
+ damageScrPriv(pScreen);
pScrPriv->internalLevel += enable ? 1 : -1;
}
void
-DamageUnregister (DrawablePtr pDrawable,
- DamagePtr pDamage)
+DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage)
{
ScreenPtr pScreen = pDrawable->pScreen;
+
damageScrPriv(pScreen);
(*pScrPriv->funcs.Unregister) (pDrawable, pDamage);
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- WindowPtr pWindow = (WindowPtr) pDrawable;
- winDamageRef (pWindow);
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWindow = (WindowPtr) pDrawable;
+
+ winDamageRef(pWindow);
#if DAMAGE_VALIDATE_ENABLE
- int found = 0;
+ int found = 0;
#endif
- while (*pPrev)
- {
- if (*pPrev == pDamage)
- {
- *pPrev = pDamage->pNextWin;
+ while (*pPrev) {
+ if (*pPrev == pDamage) {
+ *pPrev = pDamage->pNextWin;
#if DAMAGE_VALIDATE_ENABLE
- found = 1;
+ found = 1;
#endif
- break;
- }
- pPrev = &(*pPrev)->pNextWin;
- }
+ break;
+ }
+ pPrev = &(*pPrev)->pNextWin;
+ }
#if DAMAGE_VALIDATE_ENABLE
- if (!found) {
- ErrorF ("Damage not on window list\n");
- OsAbort ();
- }
+ if (!found) {
+ ErrorF("Damage not on window list\n");
+ OsAbort();
+ }
#endif
}
pDamage->pDrawable = 0;
- damageRemoveDamage (getDrawableDamageRef (pDrawable), pDamage);
+ damageRemoveDamage(getDrawableDamageRef(pDrawable), pDamage);
}
void
-DamageDestroy (DamagePtr pDamage)
+DamageDestroy(DamagePtr pDamage)
{
ScreenPtr pScreen = pDamage->pScreen;
+
damageScrPriv(pScreen);
if (pDamage->damageDestroy)
- (*pDamage->damageDestroy) (pDamage, pDamage->closure);
+ (*pDamage->damageDestroy) (pDamage, pDamage->closure);
(*pScrPriv->funcs.Destroy) (pDamage);
RegionUninit(&pDamage->damage);
RegionUninit(&pDamage->pendingDamage);
@@ -1971,115 +1872,113 @@ DamageDestroy (DamagePtr pDamage)
}
Bool
-DamageSubtract (DamagePtr pDamage,
- const RegionPtr pRegion)
+DamageSubtract(DamagePtr pDamage, const RegionPtr pRegion)
{
- RegionPtr pClip;
- RegionRec pixmapClip;
- DrawablePtr pDrawable = pDamage->pDrawable;
-
+ RegionPtr pClip;
+ RegionRec pixmapClip;
+ DrawablePtr pDrawable = pDamage->pDrawable;
+
RegionSubtract(&pDamage->damage, &pDamage->damage, pRegion);
- if (pDrawable)
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
- pClip = &((WindowPtr) pDrawable)->borderClip;
- else
- {
- BoxRec box;
-
- box.x1 = pDrawable->x;
- box.y1 = pDrawable->y;
- box.x2 = pDrawable->x + pDrawable->width;
- box.y2 = pDrawable->y + pDrawable->height;
- RegionInit(&pixmapClip, &box, 1);
- pClip = &pixmapClip;
- }
- RegionTranslate(&pDamage->damage, pDrawable->x, pDrawable->y);
- RegionIntersect(&pDamage->damage, &pDamage->damage, pClip);
- RegionTranslate(&pDamage->damage, -pDrawable->x, -pDrawable->y);
- if (pDrawable->type != DRAWABLE_WINDOW)
- RegionUninit(&pixmapClip);
+ if (pDrawable) {
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ pClip = &((WindowPtr) pDrawable)->borderClip;
+ else {
+ BoxRec box;
+
+ box.x1 = pDrawable->x;
+ box.y1 = pDrawable->y;
+ box.x2 = pDrawable->x + pDrawable->width;
+ box.y2 = pDrawable->y + pDrawable->height;
+ RegionInit(&pixmapClip, &box, 1);
+ pClip = &pixmapClip;
+ }
+ RegionTranslate(&pDamage->damage, pDrawable->x, pDrawable->y);
+ RegionIntersect(&pDamage->damage, &pDamage->damage, pClip);
+ RegionTranslate(&pDamage->damage, -pDrawable->x, -pDrawable->y);
+ if (pDrawable->type != DRAWABLE_WINDOW)
+ RegionUninit(&pixmapClip);
}
return RegionNotEmpty(&pDamage->damage);
}
void
-DamageEmpty (DamagePtr pDamage)
+DamageEmpty(DamagePtr pDamage)
{
RegionEmpty(&pDamage->damage);
}
RegionPtr
-DamageRegion (DamagePtr pDamage)
+DamageRegion(DamagePtr pDamage)
{
return &pDamage->damage;
}
RegionPtr
-DamagePendingRegion (DamagePtr pDamage)
+DamagePendingRegion(DamagePtr pDamage)
{
return &pDamage->pendingDamage;
}
void
-DamageRegionAppend (DrawablePtr pDrawable, RegionPtr pRegion)
+DamageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion)
{
- damageRegionAppend (pDrawable, pRegion, FALSE, -1);
+ damageRegionAppend(pDrawable, pRegion, FALSE, -1);
}
void
-DamageRegionProcessPending (DrawablePtr pDrawable)
+DamageRegionProcessPending(DrawablePtr pDrawable)
{
- damageRegionProcessPending (pDrawable);
+ damageRegionProcessPending(pDrawable);
}
/* If a damage marker is provided, then this function must be called after rendering is done. */
/* Please do call back so any future enhancements can assume this function is called. */
/* There are no strict timing requirements for calling this function, just as soon as (is cheaply) possible. */
void
-DamageRegionRendered (DrawablePtr pDrawable, DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pRegion)
+DamageRegionRendered(DrawablePtr pDrawable, DamagePtr pDamage,
+ RegionPtr pOldDamage, RegionPtr pRegion)
{
if (pDamage->damageReportPostRendering)
- damageReportDamagePostRendering (pDamage, pOldDamage, pRegion);
+ damageReportDamagePostRendering(pDamage, pOldDamage, pRegion);
}
/* This call is very odd, i'm leaving it intact for API sake, but please don't use it. */
void
-DamageDamageRegion (DrawablePtr pDrawable,
- const RegionPtr pRegion)
+DamageDamageRegion(DrawablePtr pDrawable, const RegionPtr pRegion)
{
- damageRegionAppend (pDrawable, pRegion, FALSE, -1);
+ damageRegionAppend(pDrawable, pRegion, FALSE, -1);
/* Go back and report this damage for DamagePtrs with reportAfter set, since
* this call isn't part of an in-progress drawing op in the call chain and
* the DDX probably just wants to know about it right away.
*/
- damageRegionProcessPending (pDrawable);
+ damageRegionProcessPending(pDrawable);
}
void
-DamageSetReportAfterOp (DamagePtr pDamage, Bool reportAfter)
+DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter)
{
pDamage->reportAfter = reportAfter;
}
void
-DamageSetPostRenderingFunctions(DamagePtr pDamage, DamageReportFunc damageReportPostRendering,
- DamageMarkerFunc damageMarker)
+DamageSetPostRenderingFunctions(DamagePtr pDamage,
+ DamageReportFunc damageReportPostRendering,
+ DamageMarkerFunc damageMarker)
{
pDamage->damageReportPostRendering = damageReportPostRendering;
pDamage->damageMarker = damageMarker;
}
DamageScreenFuncsPtr
-DamageGetScreenFuncs (ScreenPtr pScreen)
+DamageGetScreenFuncs(ScreenPtr pScreen)
{
damageScrPriv(pScreen);
return &pScrPriv->funcs;
}
void
-DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion)
+DamageReportDamage(DamagePtr pDamage, RegionPtr pDamageRegion)
{
BoxRec tmpBox;
RegionRec tmpRegion;
@@ -2087,42 +1986,36 @@ DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion)
switch (pDamage->damageLevel) {
case DamageReportRawRegion:
- RegionUnion(&pDamage->damage, &pDamage->damage,
- pDamageRegion);
- (*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure);
- break;
+ RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion);
+ (*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure);
+ break;
case DamageReportDeltaRegion:
- RegionNull(&tmpRegion);
- RegionSubtract(&tmpRegion, pDamageRegion, &pDamage->damage);
- if (RegionNotEmpty(&tmpRegion)) {
- RegionUnion(&pDamage->damage, &pDamage->damage,
- pDamageRegion);
- (*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure);
- }
- RegionUninit(&tmpRegion);
- break;
+ RegionNull(&tmpRegion);
+ RegionSubtract(&tmpRegion, pDamageRegion, &pDamage->damage);
+ if (RegionNotEmpty(&tmpRegion)) {
+ RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion);
+ (*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure);
+ }
+ RegionUninit(&tmpRegion);
+ break;
case DamageReportBoundingBox:
- tmpBox = *RegionExtents(&pDamage->damage);
- RegionUnion(&pDamage->damage, &pDamage->damage,
- pDamageRegion);
- if (!BOX_SAME (&tmpBox, RegionExtents(&pDamage->damage))) {
- (*pDamage->damageReport) (pDamage, &pDamage->damage,
- pDamage->closure);
- }
- break;
+ tmpBox = *RegionExtents(&pDamage->damage);
+ RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion);
+ if (!BOX_SAME(&tmpBox, RegionExtents(&pDamage->damage))) {
+ (*pDamage->damageReport) (pDamage, &pDamage->damage,
+ pDamage->closure);
+ }
+ break;
case DamageReportNonEmpty:
- was_empty = !RegionNotEmpty(&pDamage->damage);
- RegionUnion(&pDamage->damage, &pDamage->damage,
- pDamageRegion);
- if (was_empty && RegionNotEmpty(&pDamage->damage)) {
- (*pDamage->damageReport) (pDamage, &pDamage->damage,
- pDamage->closure);
- }
- break;
+ was_empty = !RegionNotEmpty(&pDamage->damage);
+ RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion);
+ if (was_empty && RegionNotEmpty(&pDamage->damage)) {
+ (*pDamage->damageReport) (pDamage, &pDamage->damage,
+ pDamage->closure);
+ }
+ break;
case DamageReportNone:
- RegionUnion(&pDamage->damage, &pDamage->damage,
- pDamageRegion);
- break;
+ RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion);
+ break;
}
}
-
diff --git a/xorg-server/miext/damage/damage.h b/xorg-server/miext/damage/damage.h
index 0c7fc316c..c2c313a15 100644
--- a/xorg-server/miext/damage/damage.h
+++ b/xorg-server/miext/damage/damage.h
@@ -27,7 +27,7 @@
#ifndef _DAMAGE_H_
#define _DAMAGE_H_
-typedef struct _damage *DamagePtr;
+typedef struct _damage *DamagePtr;
typedef enum _damageReportLevel {
DamageReportRawRegion,
@@ -37,11 +37,15 @@ typedef enum _damageReportLevel {
DamageReportNone
} DamageReportLevel;
-typedef void (*DamageReportFunc) (DamagePtr pDamage, RegionPtr pRegion, void *closure);
+typedef void (*DamageReportFunc) (DamagePtr pDamage, RegionPtr pRegion,
+ void *closure);
typedef void (*DamageDestroyFunc) (DamagePtr pDamage, void *closure);
+
/* It's the responsibility of the driver to duplicate both regions. */
/* At some point DamageRegionRendered() must be called. */
-typedef void (*DamageMarkerFunc) (DrawablePtr pDrawable, DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pRegion, void *closure);
+typedef void (*DamageMarkerFunc) (DrawablePtr pDrawable, DamagePtr pDamage,
+ RegionPtr pOldDamage, RegionPtr pRegion,
+ void *closure);
typedef void (*DamageScreenCreateFunc) (DamagePtr);
typedef void (*DamageScreenRegisterFunc) (DrawablePtr, DamagePtr);
@@ -49,84 +53,81 @@ typedef void (*DamageScreenUnregisterFunc) (DrawablePtr, DamagePtr);
typedef void (*DamageScreenDestroyFunc) (DamagePtr);
typedef struct _damageScreenFuncs {
- DamageScreenCreateFunc Create;
- DamageScreenRegisterFunc Register;
- DamageScreenUnregisterFunc Unregister;
- DamageScreenDestroyFunc Destroy;
+ DamageScreenCreateFunc Create;
+ DamageScreenRegisterFunc Register;
+ DamageScreenUnregisterFunc Unregister;
+ DamageScreenDestroyFunc Destroy;
} DamageScreenFuncsRec, *DamageScreenFuncsPtr;
-extern _X_EXPORT void miDamageCreate (DamagePtr);
-extern _X_EXPORT void miDamageRegister (DrawablePtr, DamagePtr);
-extern _X_EXPORT void miDamageUnregister (DrawablePtr, DamagePtr);
-extern _X_EXPORT void miDamageDestroy (DamagePtr);
+extern _X_EXPORT void miDamageCreate(DamagePtr);
+extern _X_EXPORT void miDamageRegister(DrawablePtr, DamagePtr);
+extern _X_EXPORT void miDamageUnregister(DrawablePtr, DamagePtr);
+extern _X_EXPORT void miDamageDestroy(DamagePtr);
extern _X_EXPORT Bool
-DamageSetup (ScreenPtr pScreen);
-
+ DamageSetup(ScreenPtr pScreen);
+
extern _X_EXPORT DamagePtr
-DamageCreate (DamageReportFunc damageReport,
- DamageDestroyFunc damageDestroy,
- DamageReportLevel damageLevel,
- Bool isInternal,
- ScreenPtr pScreen,
- void * closure);
+DamageCreate(DamageReportFunc damageReport,
+ DamageDestroyFunc damageDestroy,
+ DamageReportLevel damageLevel,
+ Bool isInternal, ScreenPtr pScreen, void *closure);
extern _X_EXPORT void
-DamageDrawInternal (ScreenPtr pScreen, Bool enable);
+ DamageDrawInternal(ScreenPtr pScreen, Bool enable);
extern _X_EXPORT void
-DamageRegister (DrawablePtr pDrawable,
- DamagePtr pDamage);
+ DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage);
extern _X_EXPORT void
-DamageUnregister (DrawablePtr pDrawable,
- DamagePtr pDamage);
+ DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage);
extern _X_EXPORT void
-DamageDestroy (DamagePtr pDamage);
+ DamageDestroy(DamagePtr pDamage);
extern _X_EXPORT Bool
-DamageSubtract (DamagePtr pDamage,
- const RegionPtr pRegion);
+ DamageSubtract(DamagePtr pDamage, const RegionPtr pRegion);
extern _X_EXPORT void
-DamageEmpty (DamagePtr pDamage);
+ DamageEmpty(DamagePtr pDamage);
extern _X_EXPORT RegionPtr
-DamageRegion (DamagePtr pDamage);
+ DamageRegion(DamagePtr pDamage);
extern _X_EXPORT RegionPtr
-DamagePendingRegion (DamagePtr pDamage);
+ DamagePendingRegion(DamagePtr pDamage);
/* In case of rendering, call this before the submitting the commands. */
extern _X_EXPORT void
-DamageRegionAppend (DrawablePtr pDrawable, RegionPtr pRegion);
+ DamageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion);
/* Call this directly after the rendering operation has been submitted. */
extern _X_EXPORT void
-DamageRegionProcessPending (DrawablePtr pDrawable);
+ DamageRegionProcessPending(DrawablePtr pDrawable);
/* Call this some time after rendering is done, only relevant when a damageMarker is provided. */
extern _X_EXPORT void
-DamageRegionRendered (DrawablePtr pDrawable, DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pRegion);
+
+DamageRegionRendered(DrawablePtr pDrawable, DamagePtr pDamage,
+ RegionPtr pOldDamage, RegionPtr pRegion);
/* Call this when you create a new Damage and you wish to send an initial damage message (to it). */
extern _X_EXPORT void
-DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion);
+ DamageReportDamage(DamagePtr pDamage, RegionPtr pDamageRegion);
/* Avoid using this call, it only exists for API compatibility. */
extern _X_EXPORT void
-DamageDamageRegion (DrawablePtr pDrawable,
- const RegionPtr pRegion);
+ DamageDamageRegion(DrawablePtr pDrawable, const RegionPtr pRegion);
extern _X_EXPORT void
-DamageSetReportAfterOp (DamagePtr pDamage, Bool reportAfter);
+ DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter);
extern _X_EXPORT void
-DamageSetPostRenderingFunctions(DamagePtr pDamage, DamageReportFunc damageReportPostRendering,
- DamageMarkerFunc damageMarker);
-extern _X_EXPORT DamageScreenFuncsPtr
-DamageGetScreenFuncs (ScreenPtr);
+DamageSetPostRenderingFunctions(DamagePtr pDamage,
+ DamageReportFunc damageReportPostRendering,
+ DamageMarkerFunc damageMarker);
+
+extern _X_EXPORT DamageScreenFuncsPtr DamageGetScreenFuncs(ScreenPtr);
-#endif /* _DAMAGE_H_ */
+#endif /* _DAMAGE_H_ */
diff --git a/xorg-server/miext/rootless/rootless.h b/xorg-server/miext/rootless/rootless.h
index 757e4d372..a3f38b633 100644
--- a/xorg-server/miext/rootless/rootless.h
+++ b/xorg-server/miext/rootless/rootless.h
@@ -1,368 +1,363 @@
-/*
- * External interface to generic rootless mode
- */
-/*
- * Copyright (c) 2001 Greg Parker. All Rights Reserved.
- * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _ROOTLESS_H
-#define _ROOTLESS_H
-
-#include "rootlessConfig.h"
-#include "mi.h"
-#include "gcstruct.h"
-
-/*
- Each top-level rootless window has a one-to-one correspondence to a physical
- on-screen window. The physical window is refered to as a "frame".
- */
-
-typedef void * RootlessFrameID;
-
-/*
- * RootlessWindowRec
- * This structure stores the per-frame data used by the rootless code.
- * Each top-level X window has one RootlessWindowRec associated with it.
- */
-typedef struct _RootlessWindowRec {
- // Position and size includes the window border
- // Position is in per-screen coordinates
- int x, y;
- unsigned int width, height;
- unsigned int borderWidth;
- int level;
-
- RootlessFrameID wid; // implementation specific frame id
- WindowPtr win; // underlying X window
-
- // Valid only when drawing (ie. is_drawing is set)
- char *pixelData;
- int bytesPerRow;
-
- PixmapPtr pixmap;
-
- unsigned int is_drawing :1; // Currently drawing?
- unsigned int is_reorder_pending :1;
- unsigned int is_offscreen :1;
- unsigned int is_obscured :1;
-} RootlessWindowRec, *RootlessWindowPtr;
-
-
-/* Offset for screen-local to global coordinate transforms */
-extern int rootlessGlobalOffsetX;
-extern int rootlessGlobalOffsetY;
-
-/* The minimum number of bytes or pixels for which to use the
- implementation's accelerated functions. */
-extern unsigned int rootless_CopyBytes_threshold;
-extern unsigned int rootless_CopyWindow_threshold;
-
-/* Gravity for window contents during resizing */
-enum rl_gravity_enum {
- RL_GRAVITY_NONE = 0, /* no gravity, fill everything */
- RL_GRAVITY_NORTH_WEST = 1, /* anchor to top-left corner */
- RL_GRAVITY_NORTH_EAST = 2, /* anchor to top-right corner */
- RL_GRAVITY_SOUTH_EAST = 3, /* anchor to bottom-right corner */
- RL_GRAVITY_SOUTH_WEST = 4, /* anchor to bottom-left corner */
-};
-
-
-/*------------------------------------------
- Rootless Implementation Functions
- ------------------------------------------*/
-
-/*
- * Create a new frame.
- * The frame is created unmapped.
- *
- * pFrame RootlessWindowPtr for this frame should be completely
- * initialized before calling except for pFrame->wid, which
- * is set by this function.
- * pScreen Screen on which to place the new frame
- * newX, newY Position of the frame.
- * pNewShape Shape for the frame (in frame-local coordinates). NULL for
- * unshaped frames.
- */
-typedef Bool (*RootlessCreateFrameProc)
- (RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, int newY,
- RegionPtr pNewShape);
-
-/*
- * Destroy a frame.
- * Drawing is stopped and all updates are flushed before this is called.
- *
- * wid Frame id
- */
-typedef void (*RootlessDestroyFrameProc)
- (RootlessFrameID wid);
-
-/*
- * Move a frame on screen.
- * Drawing is stopped and all updates are flushed before this is called.
- *
- * wid Frame id
- * pScreen Screen to move the new frame to
- * newX, newY New position of the frame
- */
-typedef void (*RootlessMoveFrameProc)
- (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
-
-/*
- * Resize and move a frame.
- * Drawing is stopped and all updates are flushed before this is called.
- *
- * wid Frame id
- * pScreen Screen to move the new frame to
- * newX, newY New position of the frame
- * newW, newH New size of the frame
- * gravity Gravity for window contents (rl_gravity_enum). This is always
- * RL_GRAVITY_NONE unless ROOTLESS_RESIZE_GRAVITY is set.
- */
-typedef void (*RootlessResizeFrameProc)
- (RootlessFrameID wid, ScreenPtr pScreen,
- int newX, int newY, unsigned int newW, unsigned int newH,
- unsigned int gravity);
-
-/*
- * Change frame ordering (AKA stacking, layering).
- * Drawing is stopped before this is called. Unmapped frames are mapped by
- * setting their ordering.
- *
- * wid Frame id
- * nextWid Frame id of frame that is now above this one or NULL if this
- * frame is at the top.
- */
-typedef void (*RootlessRestackFrameProc)
- (RootlessFrameID wid, RootlessFrameID nextWid);
-
-/*
- * Change frame's shape.
- * Drawing is stopped before this is called.
- *
- * wid Frame id
- * pNewShape New shape for the frame (in frame-local coordinates)
- * or NULL if now unshaped.
- */
-typedef void (*RootlessReshapeFrameProc)
- (RootlessFrameID wid, RegionPtr pNewShape);
-
-/*
- * Unmap a frame.
- *
- * wid Frame id
- */
-typedef void (*RootlessUnmapFrameProc)
- (RootlessFrameID wid);
-
-/*
- * Start drawing to a frame.
- * Prepare a frame for direct access to its backing buffer.
- *
- * wid Frame id
- * pixelData Address of the backing buffer (returned)
- * bytesPerRow Width in bytes of the backing buffer (returned)
- */
-typedef void (*RootlessStartDrawingProc)
- (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
-
-/*
- * Stop drawing to a frame.
- * No drawing to the frame's backing buffer will occur until drawing
- * is started again.
- *
- * wid Frame id
- * flush Flush drawing updates for this frame to the screen.
- */
-typedef void (*RootlessStopDrawingProc)
- (RootlessFrameID wid, Bool flush);
-
-/*
- * Flush drawing updates to the screen.
- * Drawing is stopped before this is called.
- *
- * wid Frame id
- * pDamage Region containing all the changed pixels in frame-lcoal
- * coordinates. This is clipped to the window's clip.
- */
-typedef void (*RootlessUpdateRegionProc)
- (RootlessFrameID wid, RegionPtr pDamage);
-
-/*
- * Mark damaged rectangles as requiring redisplay to screen.
- *
- * wid Frame id
- * nrects Number of damaged rectangles
- * rects Array of damaged rectangles in frame-local coordinates
- * shift_x, Vector to shift rectangles by
- * shift_y
- */
-typedef void (*RootlessDamageRectsProc)
- (RootlessFrameID wid, int nrects, const BoxRec *rects,
- int shift_x, int shift_y);
-
-/*
- * Switch the window associated with a frame. (Optional)
- * When a framed window is reparented, the frame is resized and set to
- * use the new top-level parent. If defined this function will be called
- * afterwards for implementation specific bookkeeping.
- *
- * pFrame Frame whose window has switched
- * oldWin Previous window wrapped by this frame
- */
-typedef void (*RootlessSwitchWindowProc)
- (RootlessWindowPtr pFrame, WindowPtr oldWin);
-
-/*
- * Check if window should be reordered. (Optional)
- * The underlying window system may animate windows being ordered in.
- * We want them to be mapped but remain ordered out until the animation
- * completes. If defined this function will be called to check if a
- * framed window should be reordered now. If this function returns
- * FALSE, the window will still be mapped from the X11 perspective, but
- * the RestackFrame function will not be called for its frame.
- *
- * pFrame Frame to reorder
- */
-typedef Bool (*RootlessDoReorderWindowProc)
- (RootlessWindowPtr pFrame);
-
-/*
- * Copy bytes. (Optional)
- * Source and destinate may overlap and the right thing should happen.
- *
- * width Bytes to copy per row
- * height Number of rows
- * src Source data
- * srcRowBytes Width of source in bytes
- * dst Destination data
- * dstRowBytes Width of destination in bytes
- */
-typedef void (*RootlessCopyBytesProc)
- (unsigned int width, unsigned int height,
- const void *src, unsigned int srcRowBytes,
- void *dst, unsigned int dstRowBytes);
-
-/*
- * Copy area in frame to another part of frame. (Optional)
- *
- * wid Frame id
- * dstNrects Number of rectangles to copy
- * dstRects Array of rectangles to copy
- * dx, dy Number of pixels away to copy area
- */
-typedef void (*RootlessCopyWindowProc)
- (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
- int dx, int dy);
-
-
-typedef void (*RootlessHideWindowProc)
- (RootlessFrameID wid);
-
-typedef void (*RootlessUpdateColormapProc)
- (RootlessFrameID wid, ScreenPtr pScreen);
-
-/*
- * Rootless implementation function list
- */
-typedef struct _RootlessFrameProcs {
- RootlessCreateFrameProc CreateFrame;
- RootlessDestroyFrameProc DestroyFrame;
-
- RootlessMoveFrameProc MoveFrame;
- RootlessResizeFrameProc ResizeFrame;
- RootlessRestackFrameProc RestackFrame;
- RootlessReshapeFrameProc ReshapeFrame;
- RootlessUnmapFrameProc UnmapFrame;
-
- RootlessStartDrawingProc StartDrawing;
- RootlessStopDrawingProc StopDrawing;
- RootlessUpdateRegionProc UpdateRegion;
- RootlessDamageRectsProc DamageRects;
-
- /* Optional frame functions */
- RootlessSwitchWindowProc SwitchWindow;
- RootlessDoReorderWindowProc DoReorderWindow;
- RootlessHideWindowProc HideWindow;
- RootlessUpdateColormapProc UpdateColormap;
-
- /* Optional acceleration functions */
- RootlessCopyBytesProc CopyBytes;
- RootlessCopyWindowProc CopyWindow;
-} RootlessFrameProcsRec, *RootlessFrameProcsPtr;
-
-
-/*
- * Initialize rootless mode on the given screen.
- */
-Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs);
-
-/*
- * Return the frame ID for the physical window displaying the given window.
- *
- * create If true and the window has no frame, attempt to create one
- */
-RootlessFrameID RootlessFrameForWindow(WindowPtr pWin, Bool create);
-
-/*
- * Return the top-level parent of a window.
- * The root is the top-level parent of itself, even though the root is
- * not otherwise considered to be a top-level window.
- */
-WindowPtr TopLevelParent(WindowPtr pWindow);
-
-/*
- * Prepare a window for direct access to its backing buffer.
- */
-void RootlessStartDrawing(WindowPtr pWindow);
-
-/*
- * Finish drawing to a window's backing buffer.
- *
- * flush If true, damaged areas are flushed to the screen.
- */
-void RootlessStopDrawing(WindowPtr pWindow, Bool flush);
-
-/*
- * Alocate a new screen pixmap.
- * miCreateScreenResources does not do this properly with a null
- * framebuffer pointer.
- */
-void RootlessUpdateScreenPixmap(ScreenPtr pScreen);
-
-/*
- * Reposition all windows on a screen to their correct positions.
- */
-void RootlessRepositionWindows(ScreenPtr pScreen);
-
-/*
- * Bring all windows to the front of the native stack
- */
-void RootlessOrderAllWindows (Bool include_unhitable);
-#endif /* _ROOTLESS_H */
+/*
+ * External interface to generic rootless mode
+ */
+/*
+ * Copyright (c) 2001 Greg Parker. All Rights Reserved.
+ * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _ROOTLESS_H
+#define _ROOTLESS_H
+
+#include "rootlessConfig.h"
+#include "mi.h"
+#include "gcstruct.h"
+
+/*
+ Each top-level rootless window has a one-to-one correspondence to a physical
+ on-screen window. The physical window is refered to as a "frame".
+ */
+
+typedef void *RootlessFrameID;
+
+/*
+ * RootlessWindowRec
+ * This structure stores the per-frame data used by the rootless code.
+ * Each top-level X window has one RootlessWindowRec associated with it.
+ */
+typedef struct _RootlessWindowRec {
+ // Position and size includes the window border
+ // Position is in per-screen coordinates
+ int x, y;
+ unsigned int width, height;
+ unsigned int borderWidth;
+ int level;
+
+ RootlessFrameID wid; // implementation specific frame id
+ WindowPtr win; // underlying X window
+
+ // Valid only when drawing (ie. is_drawing is set)
+ char *pixelData;
+ int bytesPerRow;
+
+ PixmapPtr pixmap;
+
+ unsigned int is_drawing:1; // Currently drawing?
+ unsigned int is_reorder_pending:1;
+ unsigned int is_offscreen:1;
+ unsigned int is_obscured:1;
+} RootlessWindowRec, *RootlessWindowPtr;
+
+/* Offset for screen-local to global coordinate transforms */
+extern int rootlessGlobalOffsetX;
+extern int rootlessGlobalOffsetY;
+
+/* The minimum number of bytes or pixels for which to use the
+ implementation's accelerated functions. */
+extern unsigned int rootless_CopyBytes_threshold;
+extern unsigned int rootless_CopyWindow_threshold;
+
+/* Gravity for window contents during resizing */
+enum rl_gravity_enum {
+ RL_GRAVITY_NONE = 0, /* no gravity, fill everything */
+ RL_GRAVITY_NORTH_WEST = 1, /* anchor to top-left corner */
+ RL_GRAVITY_NORTH_EAST = 2, /* anchor to top-right corner */
+ RL_GRAVITY_SOUTH_EAST = 3, /* anchor to bottom-right corner */
+ RL_GRAVITY_SOUTH_WEST = 4, /* anchor to bottom-left corner */
+};
+
+/*------------------------------------------
+ Rootless Implementation Functions
+ ------------------------------------------*/
+
+/*
+ * Create a new frame.
+ * The frame is created unmapped.
+ *
+ * pFrame RootlessWindowPtr for this frame should be completely
+ * initialized before calling except for pFrame->wid, which
+ * is set by this function.
+ * pScreen Screen on which to place the new frame
+ * newX, newY Position of the frame.
+ * pNewShape Shape for the frame (in frame-local coordinates). NULL for
+ * unshaped frames.
+ */
+typedef Bool (*RootlessCreateFrameProc)
+ (RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, int newY,
+ RegionPtr pNewShape);
+
+/*
+ * Destroy a frame.
+ * Drawing is stopped and all updates are flushed before this is called.
+ *
+ * wid Frame id
+ */
+typedef void (*RootlessDestroyFrameProc)
+ (RootlessFrameID wid);
+
+/*
+ * Move a frame on screen.
+ * Drawing is stopped and all updates are flushed before this is called.
+ *
+ * wid Frame id
+ * pScreen Screen to move the new frame to
+ * newX, newY New position of the frame
+ */
+typedef void (*RootlessMoveFrameProc)
+ (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
+
+/*
+ * Resize and move a frame.
+ * Drawing is stopped and all updates are flushed before this is called.
+ *
+ * wid Frame id
+ * pScreen Screen to move the new frame to
+ * newX, newY New position of the frame
+ * newW, newH New size of the frame
+ * gravity Gravity for window contents (rl_gravity_enum). This is always
+ * RL_GRAVITY_NONE unless ROOTLESS_RESIZE_GRAVITY is set.
+ */
+typedef void (*RootlessResizeFrameProc)
+ (RootlessFrameID wid, ScreenPtr pScreen,
+ int newX, int newY, unsigned int newW, unsigned int newH,
+ unsigned int gravity);
+
+/*
+ * Change frame ordering (AKA stacking, layering).
+ * Drawing is stopped before this is called. Unmapped frames are mapped by
+ * setting their ordering.
+ *
+ * wid Frame id
+ * nextWid Frame id of frame that is now above this one or NULL if this
+ * frame is at the top.
+ */
+typedef void (*RootlessRestackFrameProc)
+ (RootlessFrameID wid, RootlessFrameID nextWid);
+
+/*
+ * Change frame's shape.
+ * Drawing is stopped before this is called.
+ *
+ * wid Frame id
+ * pNewShape New shape for the frame (in frame-local coordinates)
+ * or NULL if now unshaped.
+ */
+typedef void (*RootlessReshapeFrameProc)
+ (RootlessFrameID wid, RegionPtr pNewShape);
+
+/*
+ * Unmap a frame.
+ *
+ * wid Frame id
+ */
+typedef void (*RootlessUnmapFrameProc)
+ (RootlessFrameID wid);
+
+/*
+ * Start drawing to a frame.
+ * Prepare a frame for direct access to its backing buffer.
+ *
+ * wid Frame id
+ * pixelData Address of the backing buffer (returned)
+ * bytesPerRow Width in bytes of the backing buffer (returned)
+ */
+typedef void (*RootlessStartDrawingProc)
+ (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
+
+/*
+ * Stop drawing to a frame.
+ * No drawing to the frame's backing buffer will occur until drawing
+ * is started again.
+ *
+ * wid Frame id
+ * flush Flush drawing updates for this frame to the screen.
+ */
+typedef void (*RootlessStopDrawingProc)
+ (RootlessFrameID wid, Bool flush);
+
+/*
+ * Flush drawing updates to the screen.
+ * Drawing is stopped before this is called.
+ *
+ * wid Frame id
+ * pDamage Region containing all the changed pixels in frame-lcoal
+ * coordinates. This is clipped to the window's clip.
+ */
+typedef void (*RootlessUpdateRegionProc)
+ (RootlessFrameID wid, RegionPtr pDamage);
+
+/*
+ * Mark damaged rectangles as requiring redisplay to screen.
+ *
+ * wid Frame id
+ * nrects Number of damaged rectangles
+ * rects Array of damaged rectangles in frame-local coordinates
+ * shift_x, Vector to shift rectangles by
+ * shift_y
+ */
+typedef void (*RootlessDamageRectsProc)
+ (RootlessFrameID wid, int nrects, const BoxRec * rects,
+ int shift_x, int shift_y);
+
+/*
+ * Switch the window associated with a frame. (Optional)
+ * When a framed window is reparented, the frame is resized and set to
+ * use the new top-level parent. If defined this function will be called
+ * afterwards for implementation specific bookkeeping.
+ *
+ * pFrame Frame whose window has switched
+ * oldWin Previous window wrapped by this frame
+ */
+typedef void (*RootlessSwitchWindowProc)
+ (RootlessWindowPtr pFrame, WindowPtr oldWin);
+
+/*
+ * Check if window should be reordered. (Optional)
+ * The underlying window system may animate windows being ordered in.
+ * We want them to be mapped but remain ordered out until the animation
+ * completes. If defined this function will be called to check if a
+ * framed window should be reordered now. If this function returns
+ * FALSE, the window will still be mapped from the X11 perspective, but
+ * the RestackFrame function will not be called for its frame.
+ *
+ * pFrame Frame to reorder
+ */
+typedef Bool (*RootlessDoReorderWindowProc)
+ (RootlessWindowPtr pFrame);
+
+/*
+ * Copy bytes. (Optional)
+ * Source and destinate may overlap and the right thing should happen.
+ *
+ * width Bytes to copy per row
+ * height Number of rows
+ * src Source data
+ * srcRowBytes Width of source in bytes
+ * dst Destination data
+ * dstRowBytes Width of destination in bytes
+ */
+typedef void (*RootlessCopyBytesProc)
+ (unsigned int width, unsigned int height,
+ const void *src, unsigned int srcRowBytes,
+ void *dst, unsigned int dstRowBytes);
+
+/*
+ * Copy area in frame to another part of frame. (Optional)
+ *
+ * wid Frame id
+ * dstNrects Number of rectangles to copy
+ * dstRects Array of rectangles to copy
+ * dx, dy Number of pixels away to copy area
+ */
+typedef void (*RootlessCopyWindowProc)
+ (RootlessFrameID wid, int dstNrects, const BoxRec * dstRects, int dx, int dy);
+
+typedef void (*RootlessHideWindowProc)
+ (RootlessFrameID wid);
+
+typedef void (*RootlessUpdateColormapProc)
+ (RootlessFrameID wid, ScreenPtr pScreen);
+
+/*
+ * Rootless implementation function list
+ */
+typedef struct _RootlessFrameProcs {
+ RootlessCreateFrameProc CreateFrame;
+ RootlessDestroyFrameProc DestroyFrame;
+
+ RootlessMoveFrameProc MoveFrame;
+ RootlessResizeFrameProc ResizeFrame;
+ RootlessRestackFrameProc RestackFrame;
+ RootlessReshapeFrameProc ReshapeFrame;
+ RootlessUnmapFrameProc UnmapFrame;
+
+ RootlessStartDrawingProc StartDrawing;
+ RootlessStopDrawingProc StopDrawing;
+ RootlessUpdateRegionProc UpdateRegion;
+ RootlessDamageRectsProc DamageRects;
+
+ /* Optional frame functions */
+ RootlessSwitchWindowProc SwitchWindow;
+ RootlessDoReorderWindowProc DoReorderWindow;
+ RootlessHideWindowProc HideWindow;
+ RootlessUpdateColormapProc UpdateColormap;
+
+ /* Optional acceleration functions */
+ RootlessCopyBytesProc CopyBytes;
+ RootlessCopyWindowProc CopyWindow;
+} RootlessFrameProcsRec, *RootlessFrameProcsPtr;
+
+/*
+ * Initialize rootless mode on the given screen.
+ */
+Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs);
+
+/*
+ * Return the frame ID for the physical window displaying the given window.
+ *
+ * create If true and the window has no frame, attempt to create one
+ */
+RootlessFrameID RootlessFrameForWindow(WindowPtr pWin, Bool create);
+
+/*
+ * Return the top-level parent of a window.
+ * The root is the top-level parent of itself, even though the root is
+ * not otherwise considered to be a top-level window.
+ */
+WindowPtr TopLevelParent(WindowPtr pWindow);
+
+/*
+ * Prepare a window for direct access to its backing buffer.
+ */
+void RootlessStartDrawing(WindowPtr pWindow);
+
+/*
+ * Finish drawing to a window's backing buffer.
+ *
+ * flush If true, damaged areas are flushed to the screen.
+ */
+void RootlessStopDrawing(WindowPtr pWindow, Bool flush);
+
+/*
+ * Alocate a new screen pixmap.
+ * miCreateScreenResources does not do this properly with a null
+ * framebuffer pointer.
+ */
+void RootlessUpdateScreenPixmap(ScreenPtr pScreen);
+
+/*
+ * Reposition all windows on a screen to their correct positions.
+ */
+void RootlessRepositionWindows(ScreenPtr pScreen);
+
+/*
+ * Bring all windows to the front of the native stack
+ */
+void RootlessOrderAllWindows(Bool include_unhitable);
+#endif /* _ROOTLESS_H */
diff --git a/xorg-server/miext/rootless/rootlessCommon.c b/xorg-server/miext/rootless/rootlessCommon.c
index 3ea3e5970..d8f43bd1b 100644
--- a/xorg-server/miext/rootless/rootlessCommon.c
+++ b/xorg-server/miext/rootless/rootlessCommon.c
@@ -1,448 +1,460 @@
-/*
- * Common rootless definitions and code
- */
-/*
- * Copyright (c) 2001 Greg Parker. All Rights Reserved.
- * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved.
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stddef.h> /* For NULL */
-#include <limits.h> /* For CHAR_BIT */
-
-#include "rootlessCommon.h"
-#include "colormapst.h"
-
-unsigned int rootless_CopyBytes_threshold = 0;
-unsigned int rootless_CopyWindow_threshold = 0;
-int rootlessGlobalOffsetX = 0;
-int rootlessGlobalOffsetY = 0;
-
-RegionRec rootlessHugeRoot = {{-32767, -32767, 32767, 32767}, NULL};
-
-/* Following macro from miregion.c */
-
-/* true iff two Boxes overlap */
-#define EXTENTCHECK(r1,r2) \
- (!( ((r1)->x2 <= (r2)->x1) || \
- ((r1)->x1 >= (r2)->x2) || \
- ((r1)->y2 <= (r2)->y1) || \
- ((r1)->y1 >= (r2)->y2) ) )
-
-
-/*
- * TopLevelParent
- * Returns the top-level parent of pWindow.
- * The root is the top-level parent of itself, even though the root is
- * not otherwise considered to be a top-level window.
- */
-WindowPtr
-TopLevelParent(WindowPtr pWindow)
-{
- WindowPtr top;
-
- if (IsRoot(pWindow))
- return pWindow;
-
- top = pWindow;
- while (top && ! IsTopLevel(top))
- top = top->parent;
-
- return top;
-}
-
-
-/*
- * IsFramedWindow
- * Returns TRUE if this window is visible inside a frame
- * (e.g. it is visible and has a top-level or root parent)
- */
-Bool
-IsFramedWindow(WindowPtr pWin)
-{
- WindowPtr top;
-
- if (!dixPrivateKeyRegistered(&rootlessWindowPrivateKeyRec))
- return FALSE;
-
- if (!pWin->realized)
- return FALSE;
- top = TopLevelParent(pWin);
-
- return (top && WINREC(top));
-}
-
-Bool
-RootlessResolveColormap (ScreenPtr pScreen, int first_color,
- int n_colors, uint32_t *colors)
-{
- int last, i;
- ColormapPtr map;
-
- map = RootlessGetColormap (pScreen);
- if (map == NULL || map->class != PseudoColor) return FALSE;
-
- last = min (map->pVisual->ColormapEntries, first_color + n_colors);
- for (i = max (0, first_color); i < last; i++) {
- Entry *ent = map->red + i;
- uint16_t red, green, blue;
-
- if (!ent->refcnt) continue;
- if (ent->fShared) {
- red = ent->co.shco.red->color;
- green = ent->co.shco.green->color;
- blue = ent->co.shco.blue->color;
- } else {
- red = ent->co.local.red;
- green = ent->co.local.green;
- blue = ent->co.local.blue;
- }
-
- colors[i - first_color] = (0xFF000000UL
- | ((uint32_t) red & 0xff00) << 8
- | (green & 0xff00)
- | (blue >> 8));
- }
-
- return TRUE;
-}
-
-
-/*
- * RootlessStartDrawing
- * Prepare a window for direct access to its backing buffer.
- * Each top-level parent has a Pixmap representing its backing buffer,
- * which all of its children inherit.
- */
-void RootlessStartDrawing(WindowPtr pWindow)
-{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- WindowPtr top = TopLevelParent(pWindow);
- RootlessWindowRec *winRec;
- PixmapPtr curPixmap;
-
- if (top == NULL)
- return;
- winRec = WINREC(top);
- if (winRec == NULL)
- return;
-
- // Make sure the window's top-level parent is prepared for drawing.
- if (!winRec->is_drawing) {
- int bw = wBorderWidth(top);
-
- SCREENREC(pScreen)->imp->StartDrawing(winRec->wid, &winRec->pixelData,
- &winRec->bytesPerRow);
-
- winRec->pixmap =
- GetScratchPixmapHeader(pScreen, winRec->width, winRec->height,
- top->drawable.depth,
- top->drawable.bitsPerPixel,
- winRec->bytesPerRow,
- winRec->pixelData);
- SetPixmapBaseToScreen(winRec->pixmap,
- top->drawable.x - bw, top->drawable.y - bw);
-
- winRec->is_drawing = TRUE;
- }
-
- curPixmap = pScreen->GetWindowPixmap(pWindow);
- if (curPixmap == winRec->pixmap)
- {
- RL_DEBUG_MSG("Window %p already has winRec->pixmap %p; not pushing\n", pWindow, winRec->pixmap);
- }
- else
- {
- PixmapPtr oldPixmap = dixLookupPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey);
- if (oldPixmap != NULL)
- {
- if (oldPixmap == curPixmap)
- RL_DEBUG_MSG("Window %p's curPixmap %p is the same as its oldPixmap; strange\n", pWindow, curPixmap);
- else
- RL_DEBUG_MSG("Window %p's existing oldPixmap %p being lost!\n", pWindow, oldPixmap);
- }
- dixSetPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey, curPixmap);
- pScreen->SetWindowPixmap(pWindow, winRec->pixmap);
- }
-}
-
-
-/*
- * RootlessStopDrawing
- * Stop drawing to a window's backing buffer. If flush is true,
- * damaged regions are flushed to the screen.
- */
-static int RestorePreDrawingPixmapVisitor(WindowPtr pWindow, pointer data)
-{
- RootlessWindowRec *winRec = (RootlessWindowRec*)data;
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- PixmapPtr exPixmap = pScreen->GetWindowPixmap(pWindow);
- PixmapPtr oldPixmap = dixLookupPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey);
- if (oldPixmap == NULL)
- {
- if (exPixmap == winRec->pixmap)
- RL_DEBUG_MSG("Window %p appears to be in drawing mode (ex-pixmap %p equals winRec->pixmap, which is being freed) but has no oldPixmap!\n", pWindow, exPixmap);
- }
- else
- {
- if (exPixmap != winRec->pixmap)
- RL_DEBUG_MSG("Window %p appears to be in drawing mode (oldPixmap %p) but ex-pixmap %p not winRec->pixmap %p!\n", pWindow, oldPixmap, exPixmap, winRec->pixmap);
- if (oldPixmap == winRec->pixmap)
- RL_DEBUG_MSG("Window %p's oldPixmap %p is winRec->pixmap, which has just been freed!\n", pWindow, oldPixmap);
- pScreen->SetWindowPixmap(pWindow, oldPixmap);
- dixSetPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey, NULL);
- }
- return WT_WALKCHILDREN;
-}
-
-void RootlessStopDrawing(WindowPtr pWindow, Bool flush)
-{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- WindowPtr top = TopLevelParent(pWindow);
- RootlessWindowRec *winRec;
-
- if (top == NULL)
- return;
- winRec = WINREC(top);
- if (winRec == NULL)
- return;
-
- if (winRec->is_drawing) {
- SCREENREC(pScreen)->imp->StopDrawing(winRec->wid, flush);
-
- FreeScratchPixmapHeader(winRec->pixmap);
- TraverseTree(top, RestorePreDrawingPixmapVisitor, (pointer)winRec);
- winRec->pixmap = NULL;
-
- winRec->is_drawing = FALSE;
- }
- else if (flush) {
- SCREENREC(pScreen)->imp->UpdateRegion(winRec->wid, NULL);
- }
-
- if (flush && winRec->is_reorder_pending) {
- winRec->is_reorder_pending = FALSE;
- RootlessReorderWindow(pWindow);
- }
-}
-
-
-/*
- * RootlessDamageRegion
- * Mark a damaged region as requiring redisplay to screen.
- * pRegion is in GLOBAL coordinates.
- */
-void
-RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion)
-{
- RootlessWindowRec *winRec;
- RegionRec clipped;
- WindowPtr pTop;
- BoxPtr b1, b2;
-
- RL_DEBUG_MSG("Damaged win 0x%x ", pWindow);
-
- pTop = TopLevelParent(pWindow);
- if (pTop == NULL)
- return;
-
- winRec = WINREC(pTop);
- if (winRec == NULL)
- return;
-
- /* We need to intersect the drawn region with the clip of the window
- to avoid marking places we didn't actually draw (which can cause
- problems when the window has an extra client-side backing store)
-
- But this is a costly operation and since we'll normally just be
- drawing inside the clip, go to some lengths to avoid the general
- case intersection. */
-
- b1 = RegionExtents(&pWindow->borderClip);
- b2 = RegionExtents(pRegion);
-
- if (EXTENTCHECK(b1, b2)) {
- /* Regions may overlap. */
-
- if (RegionNumRects(pRegion) == 1) {
- int in;
-
- /* Damaged region only has a single rect, so we can
- just compare that against the region */
-
- in = RegionContainsRect(&pWindow->borderClip,
- RegionRects (pRegion));
- if (in == rgnIN) {
- /* clip totally contains pRegion */
-
- SCREENREC(pWindow->drawable.pScreen)->imp->
- DamageRects(winRec->wid,
- RegionNumRects(pRegion),
- RegionRects(pRegion),
- -winRec->x, -winRec->y);
-
- RootlessQueueRedisplay(pTop->drawable.pScreen);
- goto out;
- }
- else if (in == rgnOUT) {
- /* clip doesn't contain pRegion */
-
- goto out;
- }
- }
-
- /* clip overlaps pRegion, need to intersect */
-
- RegionNull(&clipped);
- RegionIntersect(&clipped, &pWindow->borderClip, pRegion);
-
- SCREENREC(pWindow->drawable.pScreen)->imp->
- DamageRects(winRec->wid,
- RegionNumRects(&clipped),
- RegionRects(&clipped),
- -winRec->x, -winRec->y);
-
- RegionUninit(&clipped);
-
- RootlessQueueRedisplay(pTop->drawable.pScreen);
- }
-
-out:
-#ifdef ROOTLESSDEBUG
- {
- BoxRec *box = RegionRects(pRegion), *end;
- int numBox = RegionNumRects(pRegion);
-
- for (end = box+numBox; box < end; box++) {
- RL_DEBUG_MSG("Damage rect: %i, %i, %i, %i\n",
- box->x1, box->x2, box->y1, box->y2);
- }
- }
-#endif
- return;
-}
-
-
-/*
- * RootlessDamageBox
- * Mark a damaged box as requiring redisplay to screen.
- * pRegion is in GLOBAL coordinates.
- */
-void
-RootlessDamageBox(WindowPtr pWindow, BoxPtr pBox)
-{
- RegionRec region;
-
- RegionInit(&region, pBox, 1);
-
- RootlessDamageRegion(pWindow, &region);
-
- RegionUninit(&region); /* no-op */
-}
-
-
-/*
- * RootlessDamageRect
- * Mark a damaged rectangle as requiring redisplay to screen.
- * (x, y, w, h) is in window-local coordinates.
- */
-void
-RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h)
-{
- BoxRec box;
- RegionRec region;
-
- x += pWindow->drawable.x;
- y += pWindow->drawable.y;
-
- box.x1 = x;
- box.x2 = x + w;
- box.y1 = y;
- box.y2 = y + h;
-
- RegionInit(&region, &box, 1);
-
- RootlessDamageRegion(pWindow, &region);
-
- RegionUninit(&region); /* no-op */
-}
-
-
-/*
- * RootlessRedisplay
- * Stop drawing and redisplay the damaged region of a window.
- */
-void
-RootlessRedisplay(WindowPtr pWindow)
-{
- RootlessStopDrawing(pWindow, TRUE);
-}
-
-
-/*
- * RootlessRepositionWindows
- * Reposition all windows on a screen to their correct positions.
- */
-void
-RootlessRepositionWindows(ScreenPtr pScreen)
-{
- WindowPtr root = pScreen->root;
- WindowPtr win;
-
- if (root != NULL) {
- RootlessRepositionWindow(root);
-
- for (win = root->firstChild; win; win = win->nextSib) {
- if (WINREC(win) != NULL)
- RootlessRepositionWindow(win);
- }
- }
-}
-
-
-/*
- * RootlessRedisplayScreen
- * Walk every window on a screen and redisplay the damaged regions.
- */
-void
-RootlessRedisplayScreen(ScreenPtr pScreen)
-{
- WindowPtr root = pScreen->root;
-
- if (root != NULL) {
- WindowPtr win;
-
- RootlessRedisplay(root);
- for (win = root->firstChild; win; win = win->nextSib) {
- if (WINREC(win) != NULL) {
- RootlessRedisplay(win);
- }
- }
- }
-}
+/*
+ * Common rootless definitions and code
+ */
+/*
+ * Copyright (c) 2001 Greg Parker. All Rights Reserved.
+ * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved.
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stddef.h> /* For NULL */
+#include <limits.h> /* For CHAR_BIT */
+
+#include "rootlessCommon.h"
+#include "colormapst.h"
+
+unsigned int rootless_CopyBytes_threshold = 0;
+unsigned int rootless_CopyWindow_threshold = 0;
+int rootlessGlobalOffsetX = 0;
+int rootlessGlobalOffsetY = 0;
+
+RegionRec rootlessHugeRoot = { {-32767, -32767, 32767, 32767}, NULL };
+
+/* Following macro from miregion.c */
+
+/* true iff two Boxes overlap */
+#define EXTENTCHECK(r1,r2) \
+ (!( ((r1)->x2 <= (r2)->x1) || \
+ ((r1)->x1 >= (r2)->x2) || \
+ ((r1)->y2 <= (r2)->y1) || \
+ ((r1)->y1 >= (r2)->y2) ) )
+
+/*
+ * TopLevelParent
+ * Returns the top-level parent of pWindow.
+ * The root is the top-level parent of itself, even though the root is
+ * not otherwise considered to be a top-level window.
+ */
+WindowPtr
+TopLevelParent(WindowPtr pWindow)
+{
+ WindowPtr top;
+
+ if (IsRoot(pWindow))
+ return pWindow;
+
+ top = pWindow;
+ while (top && !IsTopLevel(top))
+ top = top->parent;
+
+ return top;
+}
+
+/*
+ * IsFramedWindow
+ * Returns TRUE if this window is visible inside a frame
+ * (e.g. it is visible and has a top-level or root parent)
+ */
+Bool
+IsFramedWindow(WindowPtr pWin)
+{
+ WindowPtr top;
+
+ if (!dixPrivateKeyRegistered(&rootlessWindowPrivateKeyRec))
+ return FALSE;
+
+ if (!pWin->realized)
+ return FALSE;
+ top = TopLevelParent(pWin);
+
+ return (top && WINREC(top));
+}
+
+Bool
+RootlessResolveColormap(ScreenPtr pScreen, int first_color,
+ int n_colors, uint32_t * colors)
+{
+ int last, i;
+ ColormapPtr map;
+
+ map = RootlessGetColormap(pScreen);
+ if (map == NULL || map->class != PseudoColor)
+ return FALSE;
+
+ last = min(map->pVisual->ColormapEntries, first_color + n_colors);
+ for (i = max(0, first_color); i < last; i++) {
+ Entry *ent = map->red + i;
+ uint16_t red, green, blue;
+
+ if (!ent->refcnt)
+ continue;
+ if (ent->fShared) {
+ red = ent->co.shco.red->color;
+ green = ent->co.shco.green->color;
+ blue = ent->co.shco.blue->color;
+ }
+ else {
+ red = ent->co.local.red;
+ green = ent->co.local.green;
+ blue = ent->co.local.blue;
+ }
+
+ colors[i - first_color] = (0xFF000000UL
+ | ((uint32_t) red & 0xff00) << 8
+ | (green & 0xff00)
+ | (blue >> 8));
+ }
+
+ return TRUE;
+}
+
+/*
+ * RootlessStartDrawing
+ * Prepare a window for direct access to its backing buffer.
+ * Each top-level parent has a Pixmap representing its backing buffer,
+ * which all of its children inherit.
+ */
+void
+RootlessStartDrawing(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ WindowPtr top = TopLevelParent(pWindow);
+ RootlessWindowRec *winRec;
+ PixmapPtr curPixmap;
+
+ if (top == NULL)
+ return;
+ winRec = WINREC(top);
+ if (winRec == NULL)
+ return;
+
+ // Make sure the window's top-level parent is prepared for drawing.
+ if (!winRec->is_drawing) {
+ int bw = wBorderWidth(top);
+
+ SCREENREC(pScreen)->imp->StartDrawing(winRec->wid, &winRec->pixelData,
+ &winRec->bytesPerRow);
+
+ winRec->pixmap =
+ GetScratchPixmapHeader(pScreen, winRec->width, winRec->height,
+ top->drawable.depth,
+ top->drawable.bitsPerPixel,
+ winRec->bytesPerRow, winRec->pixelData);
+ SetPixmapBaseToScreen(winRec->pixmap,
+ top->drawable.x - bw, top->drawable.y - bw);
+
+ winRec->is_drawing = TRUE;
+ }
+
+ curPixmap = pScreen->GetWindowPixmap(pWindow);
+ if (curPixmap == winRec->pixmap) {
+ RL_DEBUG_MSG("Window %p already has winRec->pixmap %p; not pushing\n",
+ pWindow, winRec->pixmap);
+ }
+ else {
+ PixmapPtr oldPixmap =
+ dixLookupPrivate(&pWindow->devPrivates,
+ rootlessWindowOldPixmapPrivateKey);
+ if (oldPixmap != NULL) {
+ if (oldPixmap == curPixmap)
+ RL_DEBUG_MSG
+ ("Window %p's curPixmap %p is the same as its oldPixmap; strange\n",
+ pWindow, curPixmap);
+ else
+ RL_DEBUG_MSG("Window %p's existing oldPixmap %p being lost!\n",
+ pWindow, oldPixmap);
+ }
+ dixSetPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey,
+ curPixmap);
+ pScreen->SetWindowPixmap(pWindow, winRec->pixmap);
+ }
+}
+
+/*
+ * RootlessStopDrawing
+ * Stop drawing to a window's backing buffer. If flush is true,
+ * damaged regions are flushed to the screen.
+ */
+static int
+RestorePreDrawingPixmapVisitor(WindowPtr pWindow, pointer data)
+{
+ RootlessWindowRec *winRec = (RootlessWindowRec *) data;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ PixmapPtr exPixmap = pScreen->GetWindowPixmap(pWindow);
+ PixmapPtr oldPixmap =
+ dixLookupPrivate(&pWindow->devPrivates,
+ rootlessWindowOldPixmapPrivateKey);
+ if (oldPixmap == NULL) {
+ if (exPixmap == winRec->pixmap)
+ RL_DEBUG_MSG
+ ("Window %p appears to be in drawing mode (ex-pixmap %p equals winRec->pixmap, which is being freed) but has no oldPixmap!\n",
+ pWindow, exPixmap);
+ }
+ else {
+ if (exPixmap != winRec->pixmap)
+ RL_DEBUG_MSG
+ ("Window %p appears to be in drawing mode (oldPixmap %p) but ex-pixmap %p not winRec->pixmap %p!\n",
+ pWindow, oldPixmap, exPixmap, winRec->pixmap);
+ if (oldPixmap == winRec->pixmap)
+ RL_DEBUG_MSG
+ ("Window %p's oldPixmap %p is winRec->pixmap, which has just been freed!\n",
+ pWindow, oldPixmap);
+ pScreen->SetWindowPixmap(pWindow, oldPixmap);
+ dixSetPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey,
+ NULL);
+ }
+ return WT_WALKCHILDREN;
+}
+
+void
+RootlessStopDrawing(WindowPtr pWindow, Bool flush)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ WindowPtr top = TopLevelParent(pWindow);
+ RootlessWindowRec *winRec;
+
+ if (top == NULL)
+ return;
+ winRec = WINREC(top);
+ if (winRec == NULL)
+ return;
+
+ if (winRec->is_drawing) {
+ SCREENREC(pScreen)->imp->StopDrawing(winRec->wid, flush);
+
+ FreeScratchPixmapHeader(winRec->pixmap);
+ TraverseTree(top, RestorePreDrawingPixmapVisitor, (pointer) winRec);
+ winRec->pixmap = NULL;
+
+ winRec->is_drawing = FALSE;
+ }
+ else if (flush) {
+ SCREENREC(pScreen)->imp->UpdateRegion(winRec->wid, NULL);
+ }
+
+ if (flush && winRec->is_reorder_pending) {
+ winRec->is_reorder_pending = FALSE;
+ RootlessReorderWindow(pWindow);
+ }
+}
+
+/*
+ * RootlessDamageRegion
+ * Mark a damaged region as requiring redisplay to screen.
+ * pRegion is in GLOBAL coordinates.
+ */
+void
+RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion)
+{
+ RootlessWindowRec *winRec;
+ RegionRec clipped;
+ WindowPtr pTop;
+ BoxPtr b1, b2;
+
+ RL_DEBUG_MSG("Damaged win 0x%x ", pWindow);
+
+ pTop = TopLevelParent(pWindow);
+ if (pTop == NULL)
+ return;
+
+ winRec = WINREC(pTop);
+ if (winRec == NULL)
+ return;
+
+ /* We need to intersect the drawn region with the clip of the window
+ to avoid marking places we didn't actually draw (which can cause
+ problems when the window has an extra client-side backing store)
+
+ But this is a costly operation and since we'll normally just be
+ drawing inside the clip, go to some lengths to avoid the general
+ case intersection. */
+
+ b1 = RegionExtents(&pWindow->borderClip);
+ b2 = RegionExtents(pRegion);
+
+ if (EXTENTCHECK(b1, b2)) {
+ /* Regions may overlap. */
+
+ if (RegionNumRects(pRegion) == 1) {
+ int in;
+
+ /* Damaged region only has a single rect, so we can
+ just compare that against the region */
+
+ in = RegionContainsRect(&pWindow->borderClip, RegionRects(pRegion));
+ if (in == rgnIN) {
+ /* clip totally contains pRegion */
+
+ SCREENREC(pWindow->drawable.pScreen)->imp->DamageRects(winRec->
+ wid,
+ RegionNumRects
+ (pRegion),
+ RegionRects
+ (pRegion),
+ -winRec->
+ x,
+ -winRec->
+ y);
+
+ RootlessQueueRedisplay(pTop->drawable.pScreen);
+ goto out;
+ }
+ else if (in == rgnOUT) {
+ /* clip doesn't contain pRegion */
+
+ goto out;
+ }
+ }
+
+ /* clip overlaps pRegion, need to intersect */
+
+ RegionNull(&clipped);
+ RegionIntersect(&clipped, &pWindow->borderClip, pRegion);
+
+ SCREENREC(pWindow->drawable.pScreen)->imp->DamageRects(winRec->wid,
+ RegionNumRects
+ (&clipped),
+ RegionRects
+ (&clipped),
+ -winRec->x,
+ -winRec->y);
+
+ RegionUninit(&clipped);
+
+ RootlessQueueRedisplay(pTop->drawable.pScreen);
+ }
+
+ out:
+#ifdef ROOTLESSDEBUG
+ {
+ BoxRec *box = RegionRects(pRegion), *end;
+ int numBox = RegionNumRects(pRegion);
+
+ for (end = box + numBox; box < end; box++) {
+ RL_DEBUG_MSG("Damage rect: %i, %i, %i, %i\n",
+ box->x1, box->x2, box->y1, box->y2);
+ }
+ }
+#endif
+ return;
+}
+
+/*
+ * RootlessDamageBox
+ * Mark a damaged box as requiring redisplay to screen.
+ * pRegion is in GLOBAL coordinates.
+ */
+void
+RootlessDamageBox(WindowPtr pWindow, BoxPtr pBox)
+{
+ RegionRec region;
+
+ RegionInit(&region, pBox, 1);
+
+ RootlessDamageRegion(pWindow, &region);
+
+ RegionUninit(&region); /* no-op */
+}
+
+/*
+ * RootlessDamageRect
+ * Mark a damaged rectangle as requiring redisplay to screen.
+ * (x, y, w, h) is in window-local coordinates.
+ */
+void
+RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h)
+{
+ BoxRec box;
+ RegionRec region;
+
+ x += pWindow->drawable.x;
+ y += pWindow->drawable.y;
+
+ box.x1 = x;
+ box.x2 = x + w;
+ box.y1 = y;
+ box.y2 = y + h;
+
+ RegionInit(&region, &box, 1);
+
+ RootlessDamageRegion(pWindow, &region);
+
+ RegionUninit(&region); /* no-op */
+}
+
+/*
+ * RootlessRedisplay
+ * Stop drawing and redisplay the damaged region of a window.
+ */
+void
+RootlessRedisplay(WindowPtr pWindow)
+{
+ RootlessStopDrawing(pWindow, TRUE);
+}
+
+/*
+ * RootlessRepositionWindows
+ * Reposition all windows on a screen to their correct positions.
+ */
+void
+RootlessRepositionWindows(ScreenPtr pScreen)
+{
+ WindowPtr root = pScreen->root;
+ WindowPtr win;
+
+ if (root != NULL) {
+ RootlessRepositionWindow(root);
+
+ for (win = root->firstChild; win; win = win->nextSib) {
+ if (WINREC(win) != NULL)
+ RootlessRepositionWindow(win);
+ }
+ }
+}
+
+/*
+ * RootlessRedisplayScreen
+ * Walk every window on a screen and redisplay the damaged regions.
+ */
+void
+RootlessRedisplayScreen(ScreenPtr pScreen)
+{
+ WindowPtr root = pScreen->root;
+
+ if (root != NULL) {
+ WindowPtr win;
+
+ RootlessRedisplay(root);
+ for (win = root->firstChild; win; win = win->nextSib) {
+ if (WINREC(win) != NULL) {
+ RootlessRedisplay(win);
+ }
+ }
+ }
+}
diff --git a/xorg-server/miext/rootless/rootlessGC.c b/xorg-server/miext/rootless/rootlessGC.c
index 2af251ee6..526709350 100644
--- a/xorg-server/miext/rootless/rootlessGC.c
+++ b/xorg-server/miext/rootless/rootlessGC.c
@@ -1,1463 +1,1490 @@
-/*
- * Graphics Context support for generic rootless X server
- */
-/*
- * Copyright (c) 2001 Greg Parker. All Rights Reserved.
- * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved.
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stddef.h> /* For NULL */
-#include "mi.h"
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "dixfontstr.h"
-#include "mivalidate.h"
-#include "fb.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "rootlessCommon.h"
-
-#ifdef _MSC_VER
-#define inline __inline
-#endif
-
-// GC functions
-static void RootlessValidateGC(GCPtr pGC, unsigned long changes,
- DrawablePtr pDrawable);
-static void RootlessChangeGC(GCPtr pGC, unsigned long mask);
-static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
-static void RootlessDestroyGC(GCPtr pGC);
-static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue,
- int nrects);
-static void RootlessDestroyClip(GCPtr pGC);
-static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
-
-Bool RootlessCreateGC(GCPtr pGC);
-
-GCFuncs rootlessGCFuncs = {
- RootlessValidateGC,
- RootlessChangeGC,
- RootlessCopyGC,
- RootlessDestroyGC,
- RootlessChangeClip,
- RootlessDestroyClip,
- RootlessCopyClip,
-};
-
-// GC operations
-static void RootlessFillSpans(DrawablePtr dst, GCPtr pGC, int nInit,
- DDXPointPtr pptInit, int *pwidthInit,
- int sorted);
-static void RootlessSetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc,
- DDXPointPtr pptInit, int *pwidthInit,
- int nspans, int sorted);
-static void RootlessPutImage(DrawablePtr dst, GCPtr pGC,
- int depth, int x, int y, int w, int h,
- int leftPad, int format, char *pBits);
-static RegionPtr RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
- int srcx, int srcy, int w, int h,
- int dstx, int dsty);
-static RegionPtr RootlessCopyPlane(DrawablePtr pSrc, DrawablePtr dst,
- GCPtr pGC, int srcx, int srcy,
- int w, int h, int dstx, int dsty,
- unsigned long plane);
-static void RootlessPolyPoint(DrawablePtr dst, GCPtr pGC,
- int mode, int npt, DDXPointPtr pptInit);
-static void RootlessPolylines(DrawablePtr dst, GCPtr pGC,
- int mode, int npt, DDXPointPtr pptInit);
-static void RootlessPolySegment(DrawablePtr dst, GCPtr pGC,
- int nseg, xSegment *pSeg);
-static void RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC,
- int nRects, xRectangle *pRects);
-static void RootlessPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc *parcs);
-static void RootlessFillPolygon(DrawablePtr dst, GCPtr pGC,
- int shape, int mode, int count,
- DDXPointPtr pptInit);
-static void RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC,
- int nRectsInit, xRectangle *pRectsInit);
-static void RootlessPolyFillArc(DrawablePtr dst, GCPtr pGC,
- int narcsInit, xArc *parcsInit);
-static int RootlessPolyText8(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, char *chars);
-static int RootlessPolyText16(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, unsigned short *chars);
-static void RootlessImageText8(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, char *chars);
-static void RootlessImageText16(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, unsigned short *chars);
-static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
- int x, int y, unsigned int nglyphInit,
- CharInfoPtr *ppciInit, pointer unused);
-static void RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
-static void RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
- int dx, int dy, int xOrg, int yOrg);
-
-
-static GCOps rootlessGCOps = {
- RootlessFillSpans,
- RootlessSetSpans,
- RootlessPutImage,
- RootlessCopyArea,
- RootlessCopyPlane,
- RootlessPolyPoint,
- RootlessPolylines,
- RootlessPolySegment,
- RootlessPolyRectangle,
- RootlessPolyArc,
- RootlessFillPolygon,
- RootlessPolyFillRect,
- RootlessPolyFillArc,
- RootlessPolyText8,
- RootlessPolyText16,
- RootlessImageText8,
- RootlessImageText16,
- RootlessImageGlyphBlt,
- RootlessPolyGlyphBlt,
- RootlessPushPixels
-};
-
-/*
- If ROOTLESS_PROTECT_ALPHA is set, we have to make sure that the alpha
- channel of the on screen windows is always opaque. fb makes this harder
- than it would otherwise be by noticing that a planemask of 0x00ffffff
- includes all bits when depth==24, and so it "optimizes" the planemask to
- 0xffffffff. We work around this by temporarily setting depth=bpp while
- changing the GC.
-
- So the normal situation (in 32 bit mode) is that the planemask is
- 0x00ffffff and thus fb leaves the alpha channel alone. The rootless
- implementation is responsible for setting the alpha channel opaque
- initially.
-
- Unfortunately drawing with a planemask that doesn't have all bits set
- normally causes fb to fall off its fastest paths when blitting and
- filling. So we try to recognize when we can relax the planemask back to
- 0xffffffff, and do that for the duration of the drawing operation,
- setting the alpha channel in fg/bg pixels to opaque at the same time. We
- can do this when drawing op is GXcopy. We can also do this when copying
- from another window since its alpha channel must also be opaque.
-
- The three macros below are used to implement this. Drawing ops that can
- potentially have their planemask relaxed look like:
-
- OP {
- GC_SAVE(gc);
- GCOP_UNWRAP(gc);
-
- ...
-
- if (canAccelxxx(..) && otherwise-suitable)
- GC_UNSET_PM(gc, dst);
-
- gc->funcs->OP(gc, ...);
-
- GC_RESTORE(gc, dst);
- GCOP_WRAP(gc);
- }
-
- */
-
-#define GC_SAVE(pGC) \
- unsigned long _save_fg = (pGC)->fgPixel; \
- unsigned long _save_bg = (pGC)->bgPixel; \
- unsigned long _save_pm = (pGC)->planemask; \
- Bool _changed = FALSE
-
-#define GC_RESTORE(pGC, pDraw) \
- do { \
- if (_changed) { \
- unsigned int depth = (pDraw)->depth; \
- (pGC)->fgPixel = _save_fg; \
- (pGC)->bgPixel = _save_bg; \
- (pGC)->planemask = _save_pm; \
- (pDraw)->depth = (pDraw)->bitsPerPixel; \
- VALIDATE_GC(pGC, GCForeground | GCBackground | \
- GCPlaneMask, pDraw); \
- (pDraw)->depth = depth; \
- } \
- } while (0)
-
-#define GC_UNSET_PM(pGC, pDraw) \
- do { \
- unsigned int mask = RootlessAlphaMask ((pDraw)->bitsPerPixel); \
- if (((pGC)->planemask & mask) != mask) { \
- unsigned int depth = (pDraw)->depth; \
- (pGC)->fgPixel |= mask; \
- (pGC)->bgPixel |= mask; \
- (pGC)->planemask |= mask; \
- (pDraw)->depth = (pDraw)->bitsPerPixel; \
- VALIDATE_GC(pGC, GCForeground | \
- GCBackground | GCPlaneMask, pDraw); \
- (pDraw)->depth = depth; \
- _changed = TRUE; \
- } \
- } while (0)
-
-#define VALIDATE_GC(pGC, changes, pDrawable) \
- do { \
- pGC->funcs->ValidateGC(pGC, changes, pDrawable); \
- if (((WindowPtr) pDrawable)->viewable) { \
- gcrec->originalOps = pGC->ops; \
- } \
- } while(0)
-
-static RootlessWindowRec *
-canAccelBlit (DrawablePtr pDraw, GCPtr pGC)
-{
- WindowPtr pTop;
- RootlessWindowRec *winRec;
- unsigned int pm;
-
- if (pGC->alu != GXcopy)
- return NULL;
-
- if (pDraw->type != DRAWABLE_WINDOW)
- return NULL;
-
- pm = ~RootlessAlphaMask(pDraw->bitsPerPixel);
- if ((pGC->planemask & pm) != pm)
- return NULL;
-
- pTop = TopLevelParent((WindowPtr) pDraw);
- if (pTop == NULL)
- return NULL;
-
- winRec = WINREC(pTop);
- if (winRec == NULL)
- return NULL;
-
- return winRec;
-}
-
-static inline RootlessWindowRec *
-canAccelFill(DrawablePtr pDraw, GCPtr pGC)
-{
- if (pGC->fillStyle != FillSolid)
- return NULL;
-
- return canAccelBlit(pDraw, pGC);
-}
-
-
-/*
- * Screen function to create a graphics context
- */
-Bool
-RootlessCreateGC(GCPtr pGC)
-{
- RootlessGCRec *gcrec;
- RootlessScreenRec *s;
- Bool result;
-
- SCREEN_UNWRAP(pGC->pScreen, CreateGC);
- s = SCREENREC(pGC->pScreen);
- result = s->CreateGC(pGC);
-
- gcrec = (RootlessGCRec *)
- dixLookupPrivate(&pGC->devPrivates, rootlessGCPrivateKey);
- gcrec->originalOps = NULL; // don't wrap ops yet
- gcrec->originalFuncs = pGC->funcs;
- pGC->funcs = &rootlessGCFuncs;
-
- SCREEN_WRAP(pGC->pScreen, CreateGC);
- return result;
-}
-
-
-/*
- * GC funcs
- *
- * These wrap lower level GC funcs.
- * ValidateGC wraps the GC ops iff dest is viewable.
- * All the others just unwrap and call.
- */
-
-// GCFUNC_UNRAP assumes funcs have been wrapped and
-// does not assume ops have been wrapped
-#define GCFUNC_UNWRAP(pGC) \
- RootlessGCRec *gcrec = (RootlessGCRec *) \
- dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \
- (pGC)->funcs = gcrec->originalFuncs; \
- if (gcrec->originalOps) { \
- (pGC)->ops = gcrec->originalOps; \
-}
-
-#define GCFUNC_WRAP(pGC) \
- gcrec->originalFuncs = (pGC)->funcs; \
- (pGC)->funcs = &rootlessGCFuncs; \
- if (gcrec->originalOps) { \
- gcrec->originalOps = (pGC)->ops; \
- (pGC)->ops = &rootlessGCOps; \
-}
-
-
-static void
-RootlessValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
-{
- GCFUNC_UNWRAP(pGC);
-
- gcrec->originalOps = NULL;
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
-#ifdef ROOTLESS_PROTECT_ALPHA
- unsigned int depth = pDrawable->depth;
-
- // We force a planemask so fb doesn't overwrite the alpha channel.
- // Left to its own devices, fb will optimize away the planemask.
- pDrawable->depth = pDrawable->bitsPerPixel;
- pGC->planemask &= ~RootlessAlphaMask(pDrawable->bitsPerPixel);
- VALIDATE_GC(pGC, changes | GCPlaneMask, pDrawable);
- pDrawable->depth = depth;
-#else
- VALIDATE_GC(pGC, changes, pDrawable);
-#endif
- } else {
- pGC->funcs->ValidateGC(pGC, changes, pDrawable);
- }
-
- GCFUNC_WRAP(pGC);
-}
-
-static void RootlessChangeGC(GCPtr pGC, unsigned long mask)
-{
- GCFUNC_UNWRAP(pGC);
- pGC->funcs->ChangeGC(pGC, mask);
- GCFUNC_WRAP(pGC);
-}
-
-static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
-{
- GCFUNC_UNWRAP(pGCDst);
- pGCDst->funcs->CopyGC(pGCSrc, mask, pGCDst);
- GCFUNC_WRAP(pGCDst);
-}
-
-static void RootlessDestroyGC(GCPtr pGC)
-{
- GCFUNC_UNWRAP(pGC);
- pGC->funcs->DestroyGC(pGC);
- GCFUNC_WRAP(pGC);
-}
-
-static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
-{
- GCFUNC_UNWRAP(pGC);
- pGC->funcs->ChangeClip(pGC, type, pvalue, nrects);
- GCFUNC_WRAP(pGC);
-}
-
-static void RootlessDestroyClip(GCPtr pGC)
-{
- GCFUNC_UNWRAP(pGC);
- pGC->funcs->DestroyClip(pGC);
- GCFUNC_WRAP(pGC);
-}
-
-static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- GCFUNC_UNWRAP(pgcDst);
- pgcDst->funcs->CopyClip(pgcDst, pgcSrc);
- GCFUNC_WRAP(pgcDst);
-}
-
-
-/*
- * GC ops
- *
- * We can't use shadowfb because shadowfb assumes one pixmap
- * and our root window is a special case.
- * However, much of this code is copied from shadowfb.
- */
-
-// assumes both funcs and ops are wrapped
-#define GCOP_UNWRAP(pGC) \
- RootlessGCRec *gcrec = (RootlessGCRec *) \
- dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \
- GCFuncs *saveFuncs = pGC->funcs; \
- (pGC)->funcs = gcrec->originalFuncs; \
- (pGC)->ops = gcrec->originalOps;
-
-#define GCOP_WRAP(pGC) \
- gcrec->originalOps = (pGC)->ops; \
- (pGC)->funcs = saveFuncs; \
- (pGC)->ops = &rootlessGCOps;
-
-static void
-RootlessFillSpans(DrawablePtr dst, GCPtr pGC, int nInit,
- DDXPointPtr pptInit, int *pwidthInit, int sorted)
-{
- GC_SAVE(pGC);
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("fill spans start ");
-
- if (nInit <= 0) {
- pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted);
- } else {
- DDXPointPtr ppt = pptInit;
- int *pwidth = pwidthInit;
- int i = nInit;
- BoxRec box;
-
- box.x1 = ppt->x;
- box.x2 = box.x1 + *pwidth;
- box.y2 = box.y1 = ppt->y;
-
- while (--i) {
- ppt++;
- pwidth++;
- if (box.x1 > ppt->x)
- box.x1 = ppt->x;
- if (box.x2 < (ppt->x + *pwidth))
- box.x2 = ppt->x + *pwidth;
- if (box.y1 > ppt->y)
- box.y1 = ppt->y;
- else if (box.y2 < ppt->y)
- box.y2 = ppt->y;
- }
-
- box.y2++;
-
- RootlessStartDrawing((WindowPtr) dst);
-
- if (canAccelFill(dst, pGC))
- {
- GC_UNSET_PM(pGC, dst);
- }
-
- pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted);
-
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- }
-
- GC_RESTORE(pGC, dst);
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("fill spans end\n");
-}
-
-static void
-RootlessSetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc,
- DDXPointPtr pptInit, int *pwidthInit,
- int nspans, int sorted)
-{
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("set spans start ");
-
- if (nspans <= 0) {
- pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit,
- nspans, sorted);
- } else {
- DDXPointPtr ppt = pptInit;
- int *pwidth = pwidthInit;
- int i = nspans;
- BoxRec box;
-
- box.x1 = ppt->x;
- box.x2 = box.x1 + *pwidth;
- box.y2 = box.y1 = ppt->y;
-
- while (--i) {
- ppt++;
- pwidth++;
- if (box.x1 > ppt->x)
- box.x1 = ppt->x;
- if (box.x2 < (ppt->x + *pwidth))
- box.x2 = ppt->x + *pwidth;
- if (box.y1 > ppt->y)
- box.y1 = ppt->y;
- else if (box.y2 < ppt->y)
- box.y2 = ppt->y;
- }
-
- box.y2++;
-
- RootlessStartDrawing((WindowPtr) dst);
- pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit,
- nspans, sorted);
-
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- }
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("set spans end\n");
-}
-
-static void
-RootlessPutImage(DrawablePtr dst, GCPtr pGC,
- int depth, int x, int y, int w, int h,
- int leftPad, int format, char *pBits)
-{
- BoxRec box;
-
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("put image start ");
-
- RootlessStartDrawing((WindowPtr) dst);
- pGC->ops->PutImage(dst, pGC, depth, x,y,w,h, leftPad, format, pBits);
-
- box.x1 = x + dst->x;
- box.x2 = box.x1 + w;
- box.y1 = y + dst->y;
- box.y2 = box.y1 + h;
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("put image end\n");
-}
-
-/* changed area is *dest* rect */
-static RegionPtr
-RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
- int srcx, int srcy, int w, int h,
- int dstx, int dsty)
-{
- RegionPtr result;
- BoxRec box;
-
- GC_SAVE(pGC);
- GCOP_UNWRAP(pGC);
-
- RL_DEBUG_MSG("copy area start (src 0x%x, dst 0x%x)", pSrc, dst);
-
- if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr)pSrc)) {
- /* If both source and dest are windows, and we're doing
- a simple copy operation, we can remove the alpha-protecting
- planemask (since source has opaque alpha as well) */
-
- if (canAccelBlit(pSrc, pGC))
- {
- GC_UNSET_PM(pGC, dst);
- }
-
- RootlessStartDrawing((WindowPtr) pSrc);
- }
- RootlessStartDrawing((WindowPtr) dst);
- result = pGC->ops->CopyArea(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty);
-
- box.x1 = dstx + dst->x;
- box.x2 = box.x1 + w;
- box.y1 = dsty + dst->y;
- box.y2 = box.y1 + h;
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
-
- GC_RESTORE(pGC, dst);
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("copy area end\n");
- return result;
-}
-
-/* changed area is *dest* rect */
-static RegionPtr RootlessCopyPlane(DrawablePtr pSrc, DrawablePtr dst,
- GCPtr pGC, int srcx, int srcy,
- int w, int h, int dstx, int dsty,
- unsigned long plane)
-{
- RegionPtr result;
- BoxRec box;
-
- GCOP_UNWRAP(pGC);
-
- RL_DEBUG_MSG("copy plane start ");
-
- if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr)pSrc)) {
- RootlessStartDrawing((WindowPtr) pSrc);
- }
- RootlessStartDrawing((WindowPtr) dst);
- result = pGC->ops->CopyPlane(pSrc, dst, pGC, srcx, srcy, w, h,
- dstx, dsty, plane);
-
- box.x1 = dstx + dst->x;
- box.x2 = box.x1 + w;
- box.y1 = dsty + dst->y;
- box.y2 = box.y1 + h;
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("copy plane end\n");
- return result;
-}
-
-// Options for size of changed area:
-// 0 = box per point
-// 1 = big box around all points
-// 2 = accumulate point in 20 pixel radius
-#define ROOTLESS_CHANGED_AREA 1
-#define abs(a) ((a) > 0 ? (a) : -(a))
-
-/* changed area is box around all points */
-static void RootlessPolyPoint(DrawablePtr dst, GCPtr pGC,
- int mode, int npt, DDXPointPtr pptInit)
-{
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("polypoint start ");
-
- RootlessStartDrawing((WindowPtr) dst);
- pGC->ops->PolyPoint(dst, pGC, mode, npt, pptInit);
-
- if (npt > 0) {
-#if ROOTLESS_CHANGED_AREA==0
- // box per point
- BoxRec box;
-
- while (npt) {
- box.x1 = pptInit->x;
- box.y1 = pptInit->y;
- box.x2 = box.x1 + 1;
- box.y2 = box.y1 + 1;
-
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
-
- npt--;
- pptInit++;
- }
-
-#elif ROOTLESS_CHANGED_AREA==1
- // one big box
- BoxRec box;
-
- box.x2 = box.x1 = pptInit->x;
- box.y2 = box.y1 = pptInit->y;
- while (--npt) {
- pptInit++;
- if (box.x1 > pptInit->x)
- box.x1 = pptInit->x;
- else if (box.x2 < pptInit->x)
- box.x2 = pptInit->x;
- if (box.y1 > pptInit->y)
- box.y1 = pptInit->y;
- else if (box.y2 < pptInit->y)
- box.y2 = pptInit->y;
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
-
-#elif ROOTLESS_CHANGED_AREA==2
- // clever(?) method: accumulate point in 20-pixel radius
- BoxRec box;
- int firstx, firsty;
-
- box.x2 = box.x1 = firstx = pptInit->x;
- box.y2 = box.y1 = firsty = pptInit->y;
- while (--npt) {
- pptInit++;
- if (abs(pptInit->x - firstx) > 20 ||
- abs(pptInit->y - firsty) > 20) {
- box.x2++;
- box.y2++;
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- box.x2 = box.x1 = firstx = pptInit->x;
- box.y2 = box.y1 = firsty = pptInit->y;
- } else {
- if (box.x1 > pptInit->x) box.x1 = pptInit->x;
- else if (box.x2 < pptInit->x) box.x2 = pptInit->x;
- if (box.y1 > pptInit->y) box.y1 = pptInit->y;
- else if (box.y2 < pptInit->y) box.y2 = pptInit->y;
- }
- }
- box.x2++;
- box.y2++;
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox((WindowPtr) dst, &box);
-#endif /* ROOTLESS_CHANGED_AREA */
- }
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("polypoint end\n");
-}
-
-#undef ROOTLESS_CHANGED_AREA
-
-/* changed area is box around each line */
-static void RootlessPolylines(DrawablePtr dst, GCPtr pGC,
- int mode, int npt, DDXPointPtr pptInit)
-{
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("poly lines start ");
-
- RootlessStartDrawing((WindowPtr) dst);
- pGC->ops->Polylines(dst, pGC, mode, npt, pptInit);
-
- if (npt > 0) {
- BoxRec box;
- int extra = pGC->lineWidth >> 1;
-
- box.x2 = box.x1 = pptInit->x;
- box.y2 = box.y1 = pptInit->y;
-
- if (npt > 1) {
- if (pGC->joinStyle == JoinMiter)
- extra = 6 * pGC->lineWidth;
- else if (pGC->capStyle == CapProjecting)
- extra = pGC->lineWidth;
- }
-
- if (mode == CoordModePrevious) {
- int x = box.x1;
- int y = box.y1;
-
- while (--npt) {
- pptInit++;
- x += pptInit->x;
- y += pptInit->y;
- if (box.x1 > x)
- box.x1 = x;
- else if (box.x2 < x)
- box.x2 = x;
- if (box.y1 > y)
- box.y1 = y;
- else if (box.y2 < y)
- box.y2 = y;
- }
- } else {
- while (--npt) {
- pptInit++;
- if (box.x1 > pptInit->x)
- box.x1 = pptInit->x;
- else if (box.x2 < pptInit->x)
- box.x2 = pptInit->x;
- if (box.y1 > pptInit->y)
- box.y1 = pptInit->y;
- else if (box.y2 < pptInit->y)
- box.y2 = pptInit->y;
- }
- }
-
- box.x2++;
- box.y2++;
-
- if (extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- }
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("poly lines end\n");
-}
-
-/* changed area is box around each line segment */
-static void RootlessPolySegment(DrawablePtr dst, GCPtr pGC,
- int nseg, xSegment *pSeg)
-{
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("poly segment start (win 0x%x)", dst);
-
- RootlessStartDrawing((WindowPtr) dst);
- pGC->ops->PolySegment(dst, pGC, nseg, pSeg);
-
- if (nseg > 0) {
- BoxRec box;
- int extra = pGC->lineWidth;
-
- if (pGC->capStyle != CapProjecting)
- extra >>= 1;
-
- if (pSeg->x2 > pSeg->x1) {
- box.x1 = pSeg->x1;
- box.x2 = pSeg->x2;
- } else {
- box.x2 = pSeg->x1;
- box.x1 = pSeg->x2;
- }
-
- if (pSeg->y2 > pSeg->y1) {
- box.y1 = pSeg->y1;
- box.y2 = pSeg->y2;
- } else {
- box.y2 = pSeg->y1;
- box.y1 = pSeg->y2;
- }
-
- while (--nseg) {
- pSeg++;
- if (pSeg->x2 > pSeg->x1) {
- if (pSeg->x1 < box.x1) box.x1 = pSeg->x1;
- if (pSeg->x2 > box.x2) box.x2 = pSeg->x2;
- } else {
- if (pSeg->x2 < box.x1) box.x1 = pSeg->x2;
- if (pSeg->x1 > box.x2) box.x2 = pSeg->x1;
- }
- if (pSeg->y2 > pSeg->y1) {
- if (pSeg->y1 < box.y1) box.y1 = pSeg->y1;
- if (pSeg->y2 > box.y2) box.y2 = pSeg->y2;
- } else {
- if (pSeg->y2 < box.y1) box.y1 = pSeg->y2;
- if (pSeg->y1 > box.y2) box.y2 = pSeg->y1;
- }
- }
-
- box.x2++;
- box.y2++;
-
- if (extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- }
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("poly segment end\n");
-}
-
-/* changed area is box around each line (not entire rects) */
-static void RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC,
- int nRects, xRectangle *pRects)
-{
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("poly rectangle start ");
-
- RootlessStartDrawing((WindowPtr) dst);
- pGC->ops->PolyRectangle(dst, pGC, nRects, pRects);
-
- if (nRects > 0) {
- BoxRec box;
- int offset1, offset2, offset3;
-
- offset2 = pGC->lineWidth;
- if (!offset2) offset2 = 1;
- offset1 = offset2 >> 1;
- offset3 = offset2 - offset1;
-
- while (nRects--) {
- box.x1 = pRects->x - offset1;
- box.y1 = pRects->y - offset1;
- box.x2 = box.x1 + pRects->width + offset2;
- box.y2 = box.y1 + offset2;
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
-
- box.x1 = pRects->x - offset1;
- box.y1 = pRects->y + offset3;
- box.x2 = box.x1 + offset2;
- box.y2 = box.y1 + pRects->height - offset2;
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
-
- box.x1 = pRects->x + pRects->width - offset1;
- box.y1 = pRects->y + offset3;
- box.x2 = box.x1 + offset2;
- box.y2 = box.y1 + pRects->height - offset2;
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
-
- box.x1 = pRects->x - offset1;
- box.y1 = pRects->y + pRects->height - offset1;
- box.x2 = box.x1 + pRects->width + offset2;
- box.y2 = box.y1 + offset2;
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
-
- pRects++;
- }
- }
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("poly rectangle end\n");
-}
-
-
-/* changed area is box around each arc (assumes all arcs are 360 degrees) */
-static void RootlessPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc *parcs)
-{
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("poly arc start ");
-
- RootlessStartDrawing((WindowPtr) dst);
- pGC->ops->PolyArc(dst, pGC, narcs, parcs);
-
- if (narcs > 0) {
- int extra = pGC->lineWidth >> 1;
- BoxRec box;
-
- box.x1 = parcs->x;
- box.x2 = box.x1 + parcs->width;
- box.y1 = parcs->y;
- box.y2 = box.y1 + parcs->height;
-
- /* should I break these up instead ? */
-
- while (--narcs) {
- parcs++;
- if (box.x1 > parcs->x)
- box.x1 = parcs->x;
- if (box.x2 < (parcs->x + parcs->width))
- box.x2 = parcs->x + parcs->width;
- if (box.y1 > parcs->y)
- box.y1 = parcs->y;
- if (box.y2 < (parcs->y + parcs->height))
- box.y2 = parcs->y + parcs->height;
- }
-
- if (extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- }
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("poly arc end\n");
-}
-
-
-/* changed area is box around each poly */
-static void RootlessFillPolygon(DrawablePtr dst, GCPtr pGC,
- int shape, int mode, int count,
- DDXPointPtr pptInit)
-{
- GC_SAVE(pGC);
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("fill poly start (win 0x%x, fillStyle 0x%x)", dst,
- pGC->fillStyle);
-
- if (count <= 2) {
- pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit);
- } else {
- DDXPointPtr ppt = pptInit;
- int i = count;
- BoxRec box;
-
- box.x2 = box.x1 = ppt->x;
- box.y2 = box.y1 = ppt->y;
-
- if (mode != CoordModeOrigin) {
- int x = box.x1;
- int y = box.y1;
-
- while (--i) {
- ppt++;
- x += ppt->x;
- y += ppt->y;
- if (box.x1 > x)
- box.x1 = x;
- else if (box.x2 < x)
- box.x2 = x;
- if (box.y1 > y)
- box.y1 = y;
- else if (box.y2 < y)
- box.y2 = y;
- }
- } else {
- while (--i) {
- ppt++;
- if (box.x1 > ppt->x)
- box.x1 = ppt->x;
- else if (box.x2 < ppt->x)
- box.x2 = ppt->x;
- if (box.y1 > ppt->y)
- box.y1 = ppt->y;
- else if (box.y2 < ppt->y)
- box.y2 = ppt->y;
- }
- }
-
- box.x2++;
- box.y2++;
-
- RootlessStartDrawing((WindowPtr) dst);
-
- if (canAccelFill(dst, pGC))
- {
- GC_UNSET_PM(pGC, dst);
- }
-
- pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit);
-
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- }
-
- GC_RESTORE(pGC, dst);
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("fill poly end\n");
-}
-
-/* changed area is the rects */
-static void RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC,
- int nRectsInit, xRectangle *pRectsInit)
-{
- GC_SAVE(pGC);
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("fill rect start (win 0x%x, fillStyle 0x%x)", dst,
- pGC->fillStyle);
-
- if (nRectsInit <= 0) {
- pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit);
- } else {
- BoxRec box;
- xRectangle *pRects = pRectsInit;
- int nRects = nRectsInit;
-
- box.x1 = pRects->x;
- box.x2 = box.x1 + pRects->width;
- box.y1 = pRects->y;
- box.y2 = box.y1 + pRects->height;
-
- while (--nRects) {
- pRects++;
- if (box.x1 > pRects->x)
- box.x1 = pRects->x;
- if (box.x2 < (pRects->x + pRects->width))
- box.x2 = pRects->x + pRects->width;
- if (box.y1 > pRects->y)
- box.y1 = pRects->y;
- if (box.y2 < (pRects->y + pRects->height))
- box.y2 = pRects->y + pRects->height;
- }
-
- RootlessStartDrawing((WindowPtr) dst);
-
- if (canAccelFill(dst, pGC))
- {
- GC_UNSET_PM(pGC, dst);
- }
-
- pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit);
-
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- }
-
- GC_RESTORE(pGC, dst);
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("fill rect end\n");
-}
-
-
-/* changed area is box around each arc (assuming arcs are all 360 degrees) */
-static void RootlessPolyFillArc(DrawablePtr dst, GCPtr pGC,
- int narcsInit, xArc *parcsInit)
-{
- GC_SAVE(pGC);
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("fill arc start ");
-
- if (narcsInit > 0) {
- BoxRec box;
- int narcs = narcsInit;
- xArc *parcs = parcsInit;
-
- box.x1 = parcs->x;
- box.x2 = box.x1 + parcs->width;
- box.y1 = parcs->y;
- box.y2 = box.y1 + parcs->height;
-
- /* should I break these up instead ? */
-
- while (--narcs) {
- parcs++;
- if (box.x1 > parcs->x)
- box.x1 = parcs->x;
- if (box.x2 < (parcs->x + parcs->width))
- box.x2 = parcs->x + parcs->width;
- if (box.y1 > parcs->y)
- box.y1 = parcs->y;
- if (box.y2 < (parcs->y + parcs->height))
- box.y2 = parcs->y + parcs->height;
- }
-
- RootlessStartDrawing((WindowPtr) dst);
-
- if (canAccelFill(dst, pGC))
- {
- GC_UNSET_PM(pGC, dst);
- }
-
- pGC->ops->PolyFillArc(dst, pGC, narcsInit, parcsInit);
-
- TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- } else {
- pGC->ops->PolyFillArc(dst, pGC, narcsInit, parcsInit);
- }
-
- GC_RESTORE(pGC, dst);
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("fill arc end\n");
-}
-
-
-static void RootlessImageText8(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, char *chars)
-{
- GC_SAVE(pGC);
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("imagetext8 start ");
-
- if (count > 0) {
- int top, bot, Min, Max;
- BoxRec box;
-
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
- if (Min > 0) Min = 0;
- Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
- if (Max < 0) Max = 0;
-
- /* ugh */
- box.x1 = dst->x + x + Min +
- FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = dst->x + x + Max +
- FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- box.y1 = dst->y + y - top;
- box.y2 = dst->y + y + bot;
-
- RootlessStartDrawing((WindowPtr) dst);
-
- if (canAccelFill(dst, pGC))
- {
- GC_UNSET_PM(pGC, dst);
- }
-
- pGC->ops->ImageText8(dst, pGC, x, y, count, chars);
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- } else {
- pGC->ops->ImageText8(dst, pGC, x, y, count, chars);
- }
-
- GC_RESTORE(pGC, dst);
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("imagetext8 end\n");
-}
-
-static int RootlessPolyText8(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, char *chars)
-{
- int width; // the result, sorta
-
- GCOP_UNWRAP(pGC);
-
- RL_DEBUG_MSG("polytext8 start ");
-
- RootlessStartDrawing((WindowPtr) dst);
- width = pGC->ops->PolyText8(dst, pGC, x, y, count, chars);
- width -= x;
-
- if (width > 0) {
- BoxRec box;
-
- /* ugh */
- box.x1 = dst->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = dst->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- if (count > 1) {
- if (width > 0) box.x2 += width;
- else box.x1 += width;
- }
-
- box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent);
- box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent);
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- }
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("polytext8 end\n");
- return width + x;
-}
-
-static void RootlessImageText16(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, unsigned short *chars)
-{
- GC_SAVE(pGC);
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("imagetext16 start ");
-
- if (count > 0) {
- int top, bot, Min, Max;
- BoxRec box;
-
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
- if (Min > 0) Min = 0;
- Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
- if (Max < 0) Max = 0;
-
- /* ugh */
- box.x1 = dst->x + x + Min +
- FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = dst->x + x + Max +
- FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- box.y1 = dst->y + y - top;
- box.y2 = dst->y + y + bot;
-
- RootlessStartDrawing((WindowPtr) dst);
-
- if (canAccelFill(dst, pGC))
- {
- GC_UNSET_PM(pGC, dst);
- }
-
- pGC->ops->ImageText16(dst, pGC, x, y, count, chars);
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- } else {
- pGC->ops->ImageText16(dst, pGC, x, y, count, chars);
- }
-
- GC_RESTORE(pGC, dst);
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("imagetext16 end\n");
-}
-
-static int RootlessPolyText16(DrawablePtr dst, GCPtr pGC,
- int x, int y, int count, unsigned short *chars)
-{
- int width; // the result, sorta
-
- GCOP_UNWRAP(pGC);
-
- RL_DEBUG_MSG("polytext16 start ");
-
- RootlessStartDrawing((WindowPtr) dst);
- width = pGC->ops->PolyText16(dst, pGC, x, y, count, chars);
- width -= x;
-
- if (width > 0) {
- BoxRec box;
-
- /* ugh */
- box.x1 = dst->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = dst->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- if (count > 1) {
- if (width > 0) box.x2 += width;
- else box.x1 += width;
- }
-
- box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent);
- box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent);
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- }
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("polytext16 end\n");
- return width + x;
-}
-
-static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
- int x, int y, unsigned int nglyphInit,
- CharInfoPtr *ppciInit, pointer unused)
-{
- GC_SAVE(pGC);
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("imageglyph start ");
-
- if (nglyphInit > 0) {
- int top, bot, width = 0;
- BoxRec box;
- unsigned int nglyph = nglyphInit;
- CharInfoPtr *ppci = ppciInit;
-
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- box.x1 = ppci[0]->metrics.leftSideBearing;
- if (box.x1 > 0) box.x1 = 0;
- box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing -
- ppci[nglyph - 1]->metrics.characterWidth;
- if (box.x2 < 0) box.x2 = 0;
-
- box.x2 += dst->x + x;
- box.x1 += dst->x + x;
-
- while (nglyph--) {
- width += (*ppci)->metrics.characterWidth;
- ppci++;
- }
-
- if (width > 0)
- box.x2 += width;
- else
- box.x1 += width;
-
- box.y1 = dst->y + y - top;
- box.y2 = dst->y + y + bot;
-
- RootlessStartDrawing((WindowPtr) dst);
-
- if (canAccelFill(dst, pGC))
- {
- GC_UNSET_PM(pGC, dst);
- }
-
- pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyphInit, ppciInit, unused);
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- } else {
- pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyphInit, ppciInit, unused);
- }
-
- GC_RESTORE(pGC, dst);
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("imageglyph end\n");
-}
-
-static void RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
-{
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("polyglyph start ");
-
- RootlessStartDrawing((WindowPtr) dst);
- pGC->ops->PolyGlyphBlt(dst, pGC, x, y, nglyph, ppci, pglyphBase);
-
- if (nglyph > 0) {
- BoxRec box;
-
- /* ugh */
- box.x1 = dst->x + x + ppci[0]->metrics.leftSideBearing;
- box.x2 = dst->x + x + ppci[nglyph - 1]->metrics.rightSideBearing;
-
- if (nglyph > 1) {
- int width = 0;
-
- while (--nglyph) {
- width += (*ppci)->metrics.characterWidth;
- ppci++;
- }
-
- if (width > 0) box.x2 += width;
- else box.x1 += width;
- }
-
- box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent);
- box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent);
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
- }
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("polyglyph end\n");
-}
-
-
-/* changed area is in dest */
-static void
-RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
- int dx, int dy, int xOrg, int yOrg)
-{
- BoxRec box;
-
- GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("push pixels start ");
-
- RootlessStartDrawing((WindowPtr) dst);
- pGC->ops->PushPixels(pGC, pBitMap, dst, dx, dy, xOrg, yOrg);
-
- box.x1 = xOrg + dst->x;
- box.x2 = box.x1 + dx;
- box.y1 = yOrg + dst->y;
- box.y2 = box.y1 + dy;
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box))
- RootlessDamageBox ((WindowPtr) dst, &box);
-
- GCOP_WRAP(pGC);
- RL_DEBUG_MSG("push pixels end\n");
-}
+/*
+ * Graphics Context support for generic rootless X server
+ */
+/*
+ * Copyright (c) 2001 Greg Parker. All Rights Reserved.
+ * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved.
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stddef.h> /* For NULL */
+#include "mi.h"
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "dixfontstr.h"
+#include "mivalidate.h"
+#include "fb.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "rootlessCommon.h"
+
+#ifdef _MSC_VER
+#define inline __inline
+#endif
+// GC functions
+static void RootlessValidateGC(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDrawable);
+static void RootlessChangeGC(GCPtr pGC, unsigned long mask);
+static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void RootlessDestroyGC(GCPtr pGC);
+static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+static void RootlessDestroyClip(GCPtr pGC);
+static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+
+Bool RootlessCreateGC(GCPtr pGC);
+
+GCFuncs rootlessGCFuncs = {
+ RootlessValidateGC,
+ RootlessChangeGC,
+ RootlessCopyGC,
+ RootlessDestroyGC,
+ RootlessChangeClip,
+ RootlessDestroyClip,
+ RootlessCopyClip,
+};
+
+// GC operations
+static void RootlessFillSpans(DrawablePtr dst, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int sorted);
+static void RootlessSetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc,
+ DDXPointPtr pptInit, int *pwidthInit,
+ int nspans, int sorted);
+static void RootlessPutImage(DrawablePtr dst, GCPtr pGC,
+ int depth, int x, int y, int w, int h,
+ int leftPad, int format, char *pBits);
+static RegionPtr RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
+ int srcx, int srcy, int w, int h,
+ int dstx, int dsty);
+static RegionPtr RootlessCopyPlane(DrawablePtr pSrc, DrawablePtr dst,
+ GCPtr pGC, int srcx, int srcy,
+ int w, int h, int dstx, int dsty,
+ unsigned long plane);
+static void RootlessPolyPoint(DrawablePtr dst, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit);
+static void RootlessPolylines(DrawablePtr dst, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit);
+static void RootlessPolySegment(DrawablePtr dst, GCPtr pGC,
+ int nseg, xSegment * pSeg);
+static void RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC,
+ int nRects, xRectangle *pRects);
+static void RootlessPolyArc(DrawablePtr dst, GCPtr pGC, int narcs,
+ xArc * parcs);
+static void RootlessFillPolygon(DrawablePtr dst, GCPtr pGC, int shape, int mode,
+ int count, DDXPointPtr pptInit);
+static void RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC, int nRectsInit,
+ xRectangle *pRectsInit);
+static void RootlessPolyFillArc(DrawablePtr dst, GCPtr pGC, int narcsInit,
+ xArc * parcsInit);
+static int RootlessPolyText8(DrawablePtr dst, GCPtr pGC, int x, int y,
+ int count, char *chars);
+static int RootlessPolyText16(DrawablePtr dst, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+static void RootlessImageText8(DrawablePtr dst, GCPtr pGC, int x, int y,
+ int count, char *chars);
+static void RootlessImageText16(DrawablePtr dst, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y,
+ unsigned int nglyphInit,
+ CharInfoPtr * ppciInit, pointer unused);
+static void RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y,
+ unsigned int nglyph, CharInfoPtr * ppci,
+ pointer pglyphBase);
+static void RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
+ int dx, int dy, int xOrg, int yOrg);
+
+static GCOps rootlessGCOps = {
+ RootlessFillSpans,
+ RootlessSetSpans,
+ RootlessPutImage,
+ RootlessCopyArea,
+ RootlessCopyPlane,
+ RootlessPolyPoint,
+ RootlessPolylines,
+ RootlessPolySegment,
+ RootlessPolyRectangle,
+ RootlessPolyArc,
+ RootlessFillPolygon,
+ RootlessPolyFillRect,
+ RootlessPolyFillArc,
+ RootlessPolyText8,
+ RootlessPolyText16,
+ RootlessImageText8,
+ RootlessImageText16,
+ RootlessImageGlyphBlt,
+ RootlessPolyGlyphBlt,
+ RootlessPushPixels
+};
+
+/*
+ If ROOTLESS_PROTECT_ALPHA is set, we have to make sure that the alpha
+ channel of the on screen windows is always opaque. fb makes this harder
+ than it would otherwise be by noticing that a planemask of 0x00ffffff
+ includes all bits when depth==24, and so it "optimizes" the planemask to
+ 0xffffffff. We work around this by temporarily setting depth=bpp while
+ changing the GC.
+
+ So the normal situation (in 32 bit mode) is that the planemask is
+ 0x00ffffff and thus fb leaves the alpha channel alone. The rootless
+ implementation is responsible for setting the alpha channel opaque
+ initially.
+
+ Unfortunately drawing with a planemask that doesn't have all bits set
+ normally causes fb to fall off its fastest paths when blitting and
+ filling. So we try to recognize when we can relax the planemask back to
+ 0xffffffff, and do that for the duration of the drawing operation,
+ setting the alpha channel in fg/bg pixels to opaque at the same time. We
+ can do this when drawing op is GXcopy. We can also do this when copying
+ from another window since its alpha channel must also be opaque.
+
+ The three macros below are used to implement this. Drawing ops that can
+ potentially have their planemask relaxed look like:
+
+ OP {
+ GC_SAVE(gc);
+ GCOP_UNWRAP(gc);
+
+ ...
+
+ if (canAccelxxx(..) && otherwise-suitable)
+ GC_UNSET_PM(gc, dst);
+
+ gc->funcs->OP(gc, ...);
+
+ GC_RESTORE(gc, dst);
+ GCOP_WRAP(gc);
+ }
+
+ */
+
+#define GC_SAVE(pGC) \
+ unsigned long _save_fg = (pGC)->fgPixel; \
+ unsigned long _save_bg = (pGC)->bgPixel; \
+ unsigned long _save_pm = (pGC)->planemask; \
+ Bool _changed = FALSE
+
+#define GC_RESTORE(pGC, pDraw) \
+ do { \
+ if (_changed) { \
+ unsigned int depth = (pDraw)->depth; \
+ (pGC)->fgPixel = _save_fg; \
+ (pGC)->bgPixel = _save_bg; \
+ (pGC)->planemask = _save_pm; \
+ (pDraw)->depth = (pDraw)->bitsPerPixel; \
+ VALIDATE_GC(pGC, GCForeground | GCBackground | \
+ GCPlaneMask, pDraw); \
+ (pDraw)->depth = depth; \
+ } \
+ } while (0)
+
+#define GC_UNSET_PM(pGC, pDraw) \
+ do { \
+ unsigned int mask = RootlessAlphaMask ((pDraw)->bitsPerPixel); \
+ if (((pGC)->planemask & mask) != mask) { \
+ unsigned int depth = (pDraw)->depth; \
+ (pGC)->fgPixel |= mask; \
+ (pGC)->bgPixel |= mask; \
+ (pGC)->planemask |= mask; \
+ (pDraw)->depth = (pDraw)->bitsPerPixel; \
+ VALIDATE_GC(pGC, GCForeground | \
+ GCBackground | GCPlaneMask, pDraw); \
+ (pDraw)->depth = depth; \
+ _changed = TRUE; \
+ } \
+ } while (0)
+
+#define VALIDATE_GC(pGC, changes, pDrawable) \
+ do { \
+ pGC->funcs->ValidateGC(pGC, changes, pDrawable); \
+ if (((WindowPtr) pDrawable)->viewable) { \
+ gcrec->originalOps = pGC->ops; \
+ } \
+ } while(0)
+
+static RootlessWindowRec *
+canAccelBlit(DrawablePtr pDraw, GCPtr pGC)
+{
+ WindowPtr pTop;
+ RootlessWindowRec *winRec;
+ unsigned int pm;
+
+ if (pGC->alu != GXcopy)
+ return NULL;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return NULL;
+
+ pm = ~RootlessAlphaMask(pDraw->bitsPerPixel);
+ if ((pGC->planemask & pm) != pm)
+ return NULL;
+
+ pTop = TopLevelParent((WindowPtr) pDraw);
+ if (pTop == NULL)
+ return NULL;
+
+ winRec = WINREC(pTop);
+ if (winRec == NULL)
+ return NULL;
+
+ return winRec;
+}
+
+static inline RootlessWindowRec *
+canAccelFill(DrawablePtr pDraw, GCPtr pGC)
+{
+ if (pGC->fillStyle != FillSolid)
+ return NULL;
+
+ return canAccelBlit(pDraw, pGC);
+}
+
+/*
+ * Screen function to create a graphics context
+ */
+Bool
+RootlessCreateGC(GCPtr pGC)
+{
+ RootlessGCRec *gcrec;
+ RootlessScreenRec *s;
+ Bool result;
+
+ SCREEN_UNWRAP(pGC->pScreen, CreateGC);
+ s = SCREENREC(pGC->pScreen);
+ result = s->CreateGC(pGC);
+
+ gcrec = (RootlessGCRec *)
+ dixLookupPrivate(&pGC->devPrivates, rootlessGCPrivateKey);
+ gcrec->originalOps = NULL; // don't wrap ops yet
+ gcrec->originalFuncs = pGC->funcs;
+ pGC->funcs = &rootlessGCFuncs;
+
+ SCREEN_WRAP(pGC->pScreen, CreateGC);
+ return result;
+}
+
+/*
+ * GC funcs
+ *
+ * These wrap lower level GC funcs.
+ * ValidateGC wraps the GC ops iff dest is viewable.
+ * All the others just unwrap and call.
+ */
+
+// GCFUNC_UNRAP assumes funcs have been wrapped and
+// does not assume ops have been wrapped
+#define GCFUNC_UNWRAP(pGC) \
+ RootlessGCRec *gcrec = (RootlessGCRec *) \
+ dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \
+ (pGC)->funcs = gcrec->originalFuncs; \
+ if (gcrec->originalOps) { \
+ (pGC)->ops = gcrec->originalOps; \
+}
+
+#define GCFUNC_WRAP(pGC) \
+ gcrec->originalFuncs = (pGC)->funcs; \
+ (pGC)->funcs = &rootlessGCFuncs; \
+ if (gcrec->originalOps) { \
+ gcrec->originalOps = (pGC)->ops; \
+ (pGC)->ops = &rootlessGCOps; \
+}
+
+static void
+RootlessValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
+{
+ GCFUNC_UNWRAP(pGC);
+
+ gcrec->originalOps = NULL;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+#ifdef ROOTLESS_PROTECT_ALPHA
+ unsigned int depth = pDrawable->depth;
+
+ // We force a planemask so fb doesn't overwrite the alpha channel.
+ // Left to its own devices, fb will optimize away the planemask.
+ pDrawable->depth = pDrawable->bitsPerPixel;
+ pGC->planemask &= ~RootlessAlphaMask(pDrawable->bitsPerPixel);
+ VALIDATE_GC(pGC, changes | GCPlaneMask, pDrawable);
+ pDrawable->depth = depth;
+#else
+ VALIDATE_GC(pGC, changes, pDrawable);
+#endif
+ }
+ else {
+ pGC->funcs->ValidateGC(pGC, changes, pDrawable);
+ }
+
+ GCFUNC_WRAP(pGC);
+}
+
+static void
+RootlessChangeGC(GCPtr pGC, unsigned long mask)
+{
+ GCFUNC_UNWRAP(pGC);
+ pGC->funcs->ChangeGC(pGC, mask);
+ GCFUNC_WRAP(pGC);
+}
+
+static void
+RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
+{
+ GCFUNC_UNWRAP(pGCDst);
+ pGCDst->funcs->CopyGC(pGCSrc, mask, pGCDst);
+ GCFUNC_WRAP(pGCDst);
+}
+
+static void
+RootlessDestroyGC(GCPtr pGC)
+{
+ GCFUNC_UNWRAP(pGC);
+ pGC->funcs->DestroyGC(pGC);
+ GCFUNC_WRAP(pGC);
+}
+
+static void
+RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+{
+ GCFUNC_UNWRAP(pGC);
+ pGC->funcs->ChangeClip(pGC, type, pvalue, nrects);
+ GCFUNC_WRAP(pGC);
+}
+
+static void
+RootlessDestroyClip(GCPtr pGC)
+{
+ GCFUNC_UNWRAP(pGC);
+ pGC->funcs->DestroyClip(pGC);
+ GCFUNC_WRAP(pGC);
+}
+
+static void
+RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ GCFUNC_UNWRAP(pgcDst);
+ pgcDst->funcs->CopyClip(pgcDst, pgcSrc);
+ GCFUNC_WRAP(pgcDst);
+}
+
+/*
+ * GC ops
+ *
+ * We can't use shadowfb because shadowfb assumes one pixmap
+ * and our root window is a special case.
+ * However, much of this code is copied from shadowfb.
+ */
+
+// assumes both funcs and ops are wrapped
+#define GCOP_UNWRAP(pGC) \
+ RootlessGCRec *gcrec = (RootlessGCRec *) \
+ dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \
+ GCFuncs *saveFuncs = pGC->funcs; \
+ (pGC)->funcs = gcrec->originalFuncs; \
+ (pGC)->ops = gcrec->originalOps;
+
+#define GCOP_WRAP(pGC) \
+ gcrec->originalOps = (pGC)->ops; \
+ (pGC)->funcs = saveFuncs; \
+ (pGC)->ops = &rootlessGCOps;
+
+static void
+RootlessFillSpans(DrawablePtr dst, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int sorted)
+{
+ GC_SAVE(pGC);
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("fill spans start ");
+
+ if (nInit <= 0) {
+ pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted);
+ }
+ else {
+ DDXPointPtr ppt = pptInit;
+ int *pwidth = pwidthInit;
+ int i = nInit;
+ BoxRec box;
+
+ box.x1 = ppt->x;
+ box.x2 = box.x1 + *pwidth;
+ box.y2 = box.y1 = ppt->y;
+
+ while (--i) {
+ ppt++;
+ pwidth++;
+ if (box.x1 > ppt->x)
+ box.x1 = ppt->x;
+ if (box.x2 < (ppt->x + *pwidth))
+ box.x2 = ppt->x + *pwidth;
+ if (box.y1 > ppt->y)
+ box.y1 = ppt->y;
+ else if (box.y2 < ppt->y)
+ box.y2 = ppt->y;
+ }
+
+ box.y2++;
+
+ RootlessStartDrawing((WindowPtr) dst);
+
+ if (canAccelFill(dst, pGC)) {
+ GC_UNSET_PM(pGC, dst);
+ }
+
+ pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted);
+
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+
+ GC_RESTORE(pGC, dst);
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("fill spans end\n");
+}
+
+static void
+RootlessSetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc,
+ DDXPointPtr pptInit, int *pwidthInit, int nspans, int sorted)
+{
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("set spans start ");
+
+ if (nspans <= 0) {
+ pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit, nspans, sorted);
+ }
+ else {
+ DDXPointPtr ppt = pptInit;
+ int *pwidth = pwidthInit;
+ int i = nspans;
+ BoxRec box;
+
+ box.x1 = ppt->x;
+ box.x2 = box.x1 + *pwidth;
+ box.y2 = box.y1 = ppt->y;
+
+ while (--i) {
+ ppt++;
+ pwidth++;
+ if (box.x1 > ppt->x)
+ box.x1 = ppt->x;
+ if (box.x2 < (ppt->x + *pwidth))
+ box.x2 = ppt->x + *pwidth;
+ if (box.y1 > ppt->y)
+ box.y1 = ppt->y;
+ else if (box.y2 < ppt->y)
+ box.y2 = ppt->y;
+ }
+
+ box.y2++;
+
+ RootlessStartDrawing((WindowPtr) dst);
+ pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit, nspans, sorted);
+
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("set spans end\n");
+}
+
+static void
+RootlessPutImage(DrawablePtr dst, GCPtr pGC,
+ int depth, int x, int y, int w, int h,
+ int leftPad, int format, char *pBits)
+{
+ BoxRec box;
+
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("put image start ");
+
+ RootlessStartDrawing((WindowPtr) dst);
+ pGC->ops->PutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pBits);
+
+ box.x1 = x + dst->x;
+ box.x2 = box.x1 + w;
+ box.y1 = y + dst->y;
+ box.y2 = box.y1 + h;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("put image end\n");
+}
+
+/* changed area is *dest* rect */
+static RegionPtr
+RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ RegionPtr result;
+ BoxRec box;
+
+ GC_SAVE(pGC);
+ GCOP_UNWRAP(pGC);
+
+ RL_DEBUG_MSG("copy area start (src 0x%x, dst 0x%x)", pSrc, dst);
+
+ if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr) pSrc)) {
+ /* If both source and dest are windows, and we're doing
+ a simple copy operation, we can remove the alpha-protecting
+ planemask (since source has opaque alpha as well) */
+
+ if (canAccelBlit(pSrc, pGC)) {
+ GC_UNSET_PM(pGC, dst);
+ }
+
+ RootlessStartDrawing((WindowPtr) pSrc);
+ }
+ RootlessStartDrawing((WindowPtr) dst);
+ result = pGC->ops->CopyArea(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty);
+
+ box.x1 = dstx + dst->x;
+ box.x2 = box.x1 + w;
+ box.y1 = dsty + dst->y;
+ box.y2 = box.y1 + h;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+
+ GC_RESTORE(pGC, dst);
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("copy area end\n");
+ return result;
+}
+
+/* changed area is *dest* rect */
+static RegionPtr
+RootlessCopyPlane(DrawablePtr pSrc, DrawablePtr dst,
+ GCPtr pGC, int srcx, int srcy,
+ int w, int h, int dstx, int dsty, unsigned long plane)
+{
+ RegionPtr result;
+ BoxRec box;
+
+ GCOP_UNWRAP(pGC);
+
+ RL_DEBUG_MSG("copy plane start ");
+
+ if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr) pSrc)) {
+ RootlessStartDrawing((WindowPtr) pSrc);
+ }
+ RootlessStartDrawing((WindowPtr) dst);
+ result = pGC->ops->CopyPlane(pSrc, dst, pGC, srcx, srcy, w, h,
+ dstx, dsty, plane);
+
+ box.x1 = dstx + dst->x;
+ box.x2 = box.x1 + w;
+ box.y1 = dsty + dst->y;
+ box.y2 = box.y1 + h;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("copy plane end\n");
+ return result;
+}
+
+// Options for size of changed area:
+// 0 = box per point
+// 1 = big box around all points
+// 2 = accumulate point in 20 pixel radius
+#define ROOTLESS_CHANGED_AREA 1
+#define abs(a) ((a) > 0 ? (a) : -(a))
+
+/* changed area is box around all points */
+static void
+RootlessPolyPoint(DrawablePtr dst, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit)
+{
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("polypoint start ");
+
+ RootlessStartDrawing((WindowPtr) dst);
+ pGC->ops->PolyPoint(dst, pGC, mode, npt, pptInit);
+
+ if (npt > 0) {
+#if ROOTLESS_CHANGED_AREA==0
+ // box per point
+ BoxRec box;
+
+ while (npt) {
+ box.x1 = pptInit->x;
+ box.y1 = pptInit->y;
+ box.x2 = box.x1 + 1;
+ box.y2 = box.y1 + 1;
+
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+
+ npt--;
+ pptInit++;
+ }
+
+#elif ROOTLESS_CHANGED_AREA==1
+ // one big box
+ BoxRec box;
+
+ box.x2 = box.x1 = pptInit->x;
+ box.y2 = box.y1 = pptInit->y;
+ while (--npt) {
+ pptInit++;
+ if (box.x1 > pptInit->x)
+ box.x1 = pptInit->x;
+ else if (box.x2 < pptInit->x)
+ box.x2 = pptInit->x;
+ if (box.y1 > pptInit->y)
+ box.y1 = pptInit->y;
+ else if (box.y2 < pptInit->y)
+ box.y2 = pptInit->y;
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+
+#elif ROOTLESS_CHANGED_AREA==2
+ // clever(?) method: accumulate point in 20-pixel radius
+ BoxRec box;
+ int firstx, firsty;
+
+ box.x2 = box.x1 = firstx = pptInit->x;
+ box.y2 = box.y1 = firsty = pptInit->y;
+ while (--npt) {
+ pptInit++;
+ if (abs(pptInit->x - firstx) > 20 || abs(pptInit->y - firsty) > 20) {
+ box.x2++;
+ box.y2++;
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ box.x2 = box.x1 = firstx = pptInit->x;
+ box.y2 = box.y1 = firsty = pptInit->y;
+ }
+ else {
+ if (box.x1 > pptInit->x)
+ box.x1 = pptInit->x;
+ else if (box.x2 < pptInit->x)
+ box.x2 = pptInit->x;
+ if (box.y1 > pptInit->y)
+ box.y1 = pptInit->y;
+ else if (box.y2 < pptInit->y)
+ box.y2 = pptInit->y;
+ }
+ }
+ box.x2++;
+ box.y2++;
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+#endif /* ROOTLESS_CHANGED_AREA */
+ }
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("polypoint end\n");
+}
+
+#undef ROOTLESS_CHANGED_AREA
+
+/* changed area is box around each line */
+static void
+RootlessPolylines(DrawablePtr dst, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit)
+{
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("poly lines start ");
+
+ RootlessStartDrawing((WindowPtr) dst);
+ pGC->ops->Polylines(dst, pGC, mode, npt, pptInit);
+
+ if (npt > 0) {
+ BoxRec box;
+ int extra = pGC->lineWidth >> 1;
+
+ box.x2 = box.x1 = pptInit->x;
+ box.y2 = box.y1 = pptInit->y;
+
+ if (npt > 1) {
+ if (pGC->joinStyle == JoinMiter)
+ extra = 6 * pGC->lineWidth;
+ else if (pGC->capStyle == CapProjecting)
+ extra = pGC->lineWidth;
+ }
+
+ if (mode == CoordModePrevious) {
+ int x = box.x1;
+ int y = box.y1;
+
+ while (--npt) {
+ pptInit++;
+ x += pptInit->x;
+ y += pptInit->y;
+ if (box.x1 > x)
+ box.x1 = x;
+ else if (box.x2 < x)
+ box.x2 = x;
+ if (box.y1 > y)
+ box.y1 = y;
+ else if (box.y2 < y)
+ box.y2 = y;
+ }
+ }
+ else {
+ while (--npt) {
+ pptInit++;
+ if (box.x1 > pptInit->x)
+ box.x1 = pptInit->x;
+ else if (box.x2 < pptInit->x)
+ box.x2 = pptInit->x;
+ if (box.y1 > pptInit->y)
+ box.y1 = pptInit->y;
+ else if (box.y2 < pptInit->y)
+ box.y2 = pptInit->y;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("poly lines end\n");
+}
+
+/* changed area is box around each line segment */
+static void
+RootlessPolySegment(DrawablePtr dst, GCPtr pGC, int nseg, xSegment * pSeg)
+{
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("poly segment start (win 0x%x)", dst);
+
+ RootlessStartDrawing((WindowPtr) dst);
+ pGC->ops->PolySegment(dst, pGC, nseg, pSeg);
+
+ if (nseg > 0) {
+ BoxRec box;
+ int extra = pGC->lineWidth;
+
+ if (pGC->capStyle != CapProjecting)
+ extra >>= 1;
+
+ if (pSeg->x2 > pSeg->x1) {
+ box.x1 = pSeg->x1;
+ box.x2 = pSeg->x2;
+ }
+ else {
+ box.x2 = pSeg->x1;
+ box.x1 = pSeg->x2;
+ }
+
+ if (pSeg->y2 > pSeg->y1) {
+ box.y1 = pSeg->y1;
+ box.y2 = pSeg->y2;
+ }
+ else {
+ box.y2 = pSeg->y1;
+ box.y1 = pSeg->y2;
+ }
+
+ while (--nseg) {
+ pSeg++;
+ if (pSeg->x2 > pSeg->x1) {
+ if (pSeg->x1 < box.x1)
+ box.x1 = pSeg->x1;
+ if (pSeg->x2 > box.x2)
+ box.x2 = pSeg->x2;
+ }
+ else {
+ if (pSeg->x2 < box.x1)
+ box.x1 = pSeg->x2;
+ if (pSeg->x1 > box.x2)
+ box.x2 = pSeg->x1;
+ }
+ if (pSeg->y2 > pSeg->y1) {
+ if (pSeg->y1 < box.y1)
+ box.y1 = pSeg->y1;
+ if (pSeg->y2 > box.y2)
+ box.y2 = pSeg->y2;
+ }
+ else {
+ if (pSeg->y2 < box.y1)
+ box.y1 = pSeg->y2;
+ if (pSeg->y1 > box.y2)
+ box.y2 = pSeg->y1;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("poly segment end\n");
+}
+
+/* changed area is box around each line (not entire rects) */
+static void
+RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC,
+ int nRects, xRectangle *pRects)
+{
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("poly rectangle start ");
+
+ RootlessStartDrawing((WindowPtr) dst);
+ pGC->ops->PolyRectangle(dst, pGC, nRects, pRects);
+
+ if (nRects > 0) {
+ BoxRec box;
+ int offset1, offset2, offset3;
+
+ offset2 = pGC->lineWidth;
+ if (!offset2)
+ offset2 = 1;
+ offset1 = offset2 >> 1;
+ offset3 = offset2 - offset1;
+
+ while (nRects--) {
+ box.x1 = pRects->x - offset1;
+ box.y1 = pRects->y - offset1;
+ box.x2 = box.x1 + pRects->width + offset2;
+ box.y2 = box.y1 + offset2;
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+
+ box.x1 = pRects->x - offset1;
+ box.y1 = pRects->y + offset3;
+ box.x2 = box.x1 + offset2;
+ box.y2 = box.y1 + pRects->height - offset2;
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+
+ box.x1 = pRects->x + pRects->width - offset1;
+ box.y1 = pRects->y + offset3;
+ box.x2 = box.x1 + offset2;
+ box.y2 = box.y1 + pRects->height - offset2;
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+
+ box.x1 = pRects->x - offset1;
+ box.y1 = pRects->y + pRects->height - offset1;
+ box.x2 = box.x1 + pRects->width + offset2;
+ box.y2 = box.y1 + offset2;
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+
+ pRects++;
+ }
+ }
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("poly rectangle end\n");
+}
+
+/* changed area is box around each arc (assumes all arcs are 360 degrees) */
+static void
+RootlessPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc * parcs)
+{
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("poly arc start ");
+
+ RootlessStartDrawing((WindowPtr) dst);
+ pGC->ops->PolyArc(dst, pGC, narcs, parcs);
+
+ if (narcs > 0) {
+ int extra = pGC->lineWidth >> 1;
+ BoxRec box;
+
+ box.x1 = parcs->x;
+ box.x2 = box.x1 + parcs->width;
+ box.y1 = parcs->y;
+ box.y2 = box.y1 + parcs->height;
+
+ /* should I break these up instead ? */
+
+ while (--narcs) {
+ parcs++;
+ if (box.x1 > parcs->x)
+ box.x1 = parcs->x;
+ if (box.x2 < (parcs->x + parcs->width))
+ box.x2 = parcs->x + parcs->width;
+ if (box.y1 > parcs->y)
+ box.y1 = parcs->y;
+ if (box.y2 < (parcs->y + parcs->height))
+ box.y2 = parcs->y + parcs->height;
+ }
+
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("poly arc end\n");
+}
+
+/* changed area is box around each poly */
+static void
+RootlessFillPolygon(DrawablePtr dst, GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr pptInit)
+{
+ GC_SAVE(pGC);
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("fill poly start (win 0x%x, fillStyle 0x%x)", dst,
+ pGC->fillStyle);
+
+ if (count <= 2) {
+ pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit);
+ }
+ else {
+ DDXPointPtr ppt = pptInit;
+ int i = count;
+ BoxRec box;
+
+ box.x2 = box.x1 = ppt->x;
+ box.y2 = box.y1 = ppt->y;
+
+ if (mode != CoordModeOrigin) {
+ int x = box.x1;
+ int y = box.y1;
+
+ while (--i) {
+ ppt++;
+ x += ppt->x;
+ y += ppt->y;
+ if (box.x1 > x)
+ box.x1 = x;
+ else if (box.x2 < x)
+ box.x2 = x;
+ if (box.y1 > y)
+ box.y1 = y;
+ else if (box.y2 < y)
+ box.y2 = y;
+ }
+ }
+ else {
+ while (--i) {
+ ppt++;
+ if (box.x1 > ppt->x)
+ box.x1 = ppt->x;
+ else if (box.x2 < ppt->x)
+ box.x2 = ppt->x;
+ if (box.y1 > ppt->y)
+ box.y1 = ppt->y;
+ else if (box.y2 < ppt->y)
+ box.y2 = ppt->y;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ RootlessStartDrawing((WindowPtr) dst);
+
+ if (canAccelFill(dst, pGC)) {
+ GC_UNSET_PM(pGC, dst);
+ }
+
+ pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit);
+
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+
+ GC_RESTORE(pGC, dst);
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("fill poly end\n");
+}
+
+/* changed area is the rects */
+static void
+RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit)
+{
+ GC_SAVE(pGC);
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("fill rect start (win 0x%x, fillStyle 0x%x)", dst,
+ pGC->fillStyle);
+
+ if (nRectsInit <= 0) {
+ pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit);
+ }
+ else {
+ BoxRec box;
+ xRectangle *pRects = pRectsInit;
+ int nRects = nRectsInit;
+
+ box.x1 = pRects->x;
+ box.x2 = box.x1 + pRects->width;
+ box.y1 = pRects->y;
+ box.y2 = box.y1 + pRects->height;
+
+ while (--nRects) {
+ pRects++;
+ if (box.x1 > pRects->x)
+ box.x1 = pRects->x;
+ if (box.x2 < (pRects->x + pRects->width))
+ box.x2 = pRects->x + pRects->width;
+ if (box.y1 > pRects->y)
+ box.y1 = pRects->y;
+ if (box.y2 < (pRects->y + pRects->height))
+ box.y2 = pRects->y + pRects->height;
+ }
+
+ RootlessStartDrawing((WindowPtr) dst);
+
+ if (canAccelFill(dst, pGC)) {
+ GC_UNSET_PM(pGC, dst);
+ }
+
+ pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit);
+
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+
+ GC_RESTORE(pGC, dst);
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("fill rect end\n");
+}
+
+/* changed area is box around each arc (assuming arcs are all 360 degrees) */
+static void
+RootlessPolyFillArc(DrawablePtr dst, GCPtr pGC, int narcsInit, xArc * parcsInit)
+{
+ GC_SAVE(pGC);
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("fill arc start ");
+
+ if (narcsInit > 0) {
+ BoxRec box;
+ int narcs = narcsInit;
+ xArc *parcs = parcsInit;
+
+ box.x1 = parcs->x;
+ box.x2 = box.x1 + parcs->width;
+ box.y1 = parcs->y;
+ box.y2 = box.y1 + parcs->height;
+
+ /* should I break these up instead ? */
+
+ while (--narcs) {
+ parcs++;
+ if (box.x1 > parcs->x)
+ box.x1 = parcs->x;
+ if (box.x2 < (parcs->x + parcs->width))
+ box.x2 = parcs->x + parcs->width;
+ if (box.y1 > parcs->y)
+ box.y1 = parcs->y;
+ if (box.y2 < (parcs->y + parcs->height))
+ box.y2 = parcs->y + parcs->height;
+ }
+
+ RootlessStartDrawing((WindowPtr) dst);
+
+ if (canAccelFill(dst, pGC)) {
+ GC_UNSET_PM(pGC, dst);
+ }
+
+ pGC->ops->PolyFillArc(dst, pGC, narcsInit, parcsInit);
+
+ TRIM_AND_TRANSLATE_BOX(box, dst, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+ else {
+ pGC->ops->PolyFillArc(dst, pGC, narcsInit, parcsInit);
+ }
+
+ GC_RESTORE(pGC, dst);
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("fill arc end\n");
+}
+
+static void
+RootlessImageText8(DrawablePtr dst, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ GC_SAVE(pGC);
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("imagetext8 start ");
+
+ if (count > 0) {
+ int top, bot, Min, Max;
+ BoxRec box;
+
+ top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
+ bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
+
+ Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
+ if (Min > 0)
+ Min = 0;
+ Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
+ if (Max < 0)
+ Max = 0;
+
+ /* ugh */
+ box.x1 = dst->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing);
+ box.x2 = dst->x + x + Max + FONTMAXBOUNDS(pGC->font, rightSideBearing);
+
+ box.y1 = dst->y + y - top;
+ box.y2 = dst->y + y + bot;
+
+ RootlessStartDrawing((WindowPtr) dst);
+
+ if (canAccelFill(dst, pGC)) {
+ GC_UNSET_PM(pGC, dst);
+ }
+
+ pGC->ops->ImageText8(dst, pGC, x, y, count, chars);
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+ else {
+ pGC->ops->ImageText8(dst, pGC, x, y, count, chars);
+ }
+
+ GC_RESTORE(pGC, dst);
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("imagetext8 end\n");
+}
+
+static int
+RootlessPolyText8(DrawablePtr dst, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ int width; // the result, sorta
+
+ GCOP_UNWRAP(pGC);
+
+ RL_DEBUG_MSG("polytext8 start ");
+
+ RootlessStartDrawing((WindowPtr) dst);
+ width = pGC->ops->PolyText8(dst, pGC, x, y, count, chars);
+ width -= x;
+
+ if (width > 0) {
+ BoxRec box;
+
+ /* ugh */
+ box.x1 = dst->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing);
+ box.x2 = dst->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing);
+
+ if (count > 1) {
+ if (width > 0)
+ box.x2 += width;
+ else
+ box.x1 += width;
+ }
+
+ box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent);
+ box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent);
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("polytext8 end\n");
+ return width + x;
+}
+
+static void
+RootlessImageText16(DrawablePtr dst, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ GC_SAVE(pGC);
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("imagetext16 start ");
+
+ if (count > 0) {
+ int top, bot, Min, Max;
+ BoxRec box;
+
+ top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
+ bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
+
+ Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
+ if (Min > 0)
+ Min = 0;
+ Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
+ if (Max < 0)
+ Max = 0;
+
+ /* ugh */
+ box.x1 = dst->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing);
+ box.x2 = dst->x + x + Max + FONTMAXBOUNDS(pGC->font, rightSideBearing);
+
+ box.y1 = dst->y + y - top;
+ box.y2 = dst->y + y + bot;
+
+ RootlessStartDrawing((WindowPtr) dst);
+
+ if (canAccelFill(dst, pGC)) {
+ GC_UNSET_PM(pGC, dst);
+ }
+
+ pGC->ops->ImageText16(dst, pGC, x, y, count, chars);
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+ else {
+ pGC->ops->ImageText16(dst, pGC, x, y, count, chars);
+ }
+
+ GC_RESTORE(pGC, dst);
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("imagetext16 end\n");
+}
+
+static int
+RootlessPolyText16(DrawablePtr dst, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ int width; // the result, sorta
+
+ GCOP_UNWRAP(pGC);
+
+ RL_DEBUG_MSG("polytext16 start ");
+
+ RootlessStartDrawing((WindowPtr) dst);
+ width = pGC->ops->PolyText16(dst, pGC, x, y, count, chars);
+ width -= x;
+
+ if (width > 0) {
+ BoxRec box;
+
+ /* ugh */
+ box.x1 = dst->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing);
+ box.x2 = dst->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing);
+
+ if (count > 1) {
+ if (width > 0)
+ box.x2 += width;
+ else
+ box.x1 += width;
+ }
+
+ box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent);
+ box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent);
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("polytext16 end\n");
+ return width + x;
+}
+
+static void
+RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
+ int x, int y, unsigned int nglyphInit,
+ CharInfoPtr * ppciInit, pointer unused)
+{
+ GC_SAVE(pGC);
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("imageglyph start ");
+
+ if (nglyphInit > 0) {
+ int top, bot, width = 0;
+ BoxRec box;
+ unsigned int nglyph = nglyphInit;
+ CharInfoPtr *ppci = ppciInit;
+
+ top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
+ bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
+
+ box.x1 = ppci[0]->metrics.leftSideBearing;
+ if (box.x1 > 0)
+ box.x1 = 0;
+ box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing -
+ ppci[nglyph - 1]->metrics.characterWidth;
+ if (box.x2 < 0)
+ box.x2 = 0;
+
+ box.x2 += dst->x + x;
+ box.x1 += dst->x + x;
+
+ while (nglyph--) {
+ width += (*ppci)->metrics.characterWidth;
+ ppci++;
+ }
+
+ if (width > 0)
+ box.x2 += width;
+ else
+ box.x1 += width;
+
+ box.y1 = dst->y + y - top;
+ box.y2 = dst->y + y + bot;
+
+ RootlessStartDrawing((WindowPtr) dst);
+
+ if (canAccelFill(dst, pGC)) {
+ GC_UNSET_PM(pGC, dst);
+ }
+
+ pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyphInit, ppciInit, unused);
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+ else {
+ pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyphInit, ppciInit, unused);
+ }
+
+ GC_RESTORE(pGC, dst);
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("imageglyph end\n");
+}
+
+static void
+RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
+{
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("polyglyph start ");
+
+ RootlessStartDrawing((WindowPtr) dst);
+ pGC->ops->PolyGlyphBlt(dst, pGC, x, y, nglyph, ppci, pglyphBase);
+
+ if (nglyph > 0) {
+ BoxRec box;
+
+ /* ugh */
+ box.x1 = dst->x + x + ppci[0]->metrics.leftSideBearing;
+ box.x2 = dst->x + x + ppci[nglyph - 1]->metrics.rightSideBearing;
+
+ if (nglyph > 1) {
+ int width = 0;
+
+ while (--nglyph) {
+ width += (*ppci)->metrics.characterWidth;
+ ppci++;
+ }
+
+ if (width > 0)
+ box.x2 += width;
+ else
+ box.x1 += width;
+ }
+
+ box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent);
+ box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent);
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+ }
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("polyglyph end\n");
+}
+
+/* changed area is in dest */
+static void
+RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
+ int dx, int dy, int xOrg, int yOrg)
+{
+ BoxRec box;
+
+ GCOP_UNWRAP(pGC);
+ RL_DEBUG_MSG("push pixels start ");
+
+ RootlessStartDrawing((WindowPtr) dst);
+ pGC->ops->PushPixels(pGC, pBitMap, dst, dx, dy, xOrg, yOrg);
+
+ box.x1 = xOrg + dst->x;
+ box.x2 = box.x1 + dx;
+ box.y1 = yOrg + dst->y;
+ box.y2 = box.y1 + dy;
+
+ TRIM_BOX(box, pGC);
+ if (BOX_NOT_EMPTY(box))
+ RootlessDamageBox((WindowPtr) dst, &box);
+
+ GCOP_WRAP(pGC);
+ RL_DEBUG_MSG("push pixels end\n");
+}
diff --git a/xorg-server/miext/rootless/rootlessScreen.c b/xorg-server/miext/rootless/rootlessScreen.c
index c8557066e..ecc72ea92 100644
--- a/xorg-server/miext/rootless/rootlessScreen.c
+++ b/xorg-server/miext/rootless/rootlessScreen.c
@@ -29,7 +29,6 @@
* use or other dealings in this Software without prior written authorization.
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -83,10 +82,10 @@ RootlessUpdateScreenPixmap(ScreenPtr pScreen)
PixmapPtr pPix;
unsigned int rowbytes;
- pPix = (*pScreen->GetScreenPixmap)(pScreen);
+ pPix = (*pScreen->GetScreenPixmap) (pScreen);
if (pPix == NULL) {
- pPix = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
- (*pScreen->SetScreenPixmap)(pPix);
+ pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0);
+ (*pScreen->SetScreenPixmap) (pPix);
}
rowbytes = PixmapBytePad(pScreen->width, pScreen->rootDepth);
@@ -111,7 +110,6 @@ RootlessUpdateScreenPixmap(ScreenPtr pScreen)
}
}
-
/*
* RootlessCreateScreenResources
* Rootless implementations typically set a null framebuffer pointer, which
@@ -125,7 +123,7 @@ RootlessCreateScreenResources(ScreenPtr pScreen)
SCREEN_UNWRAP(pScreen, CreateScreenResources);
if (pScreen->CreateScreenResources != NULL)
- ret = (*pScreen->CreateScreenResources)(pScreen);
+ ret = (*pScreen->CreateScreenResources) (pScreen);
SCREEN_WRAP(pScreen, CreateScreenResources);
@@ -139,7 +137,6 @@ RootlessCreateScreenResources(ScreenPtr pScreen)
return ret;
}
-
static Bool
RootlessCloseScreen(int i, ScreenPtr pScreen)
{
@@ -160,12 +157,12 @@ RootlessCloseScreen(int i, ScreenPtr pScreen)
return pScreen->CloseScreen(i, pScreen);
}
-
static void
RootlessGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
unsigned int format, unsigned long planeMask, char *pdstLine)
{
ScreenPtr pScreen = pDrawable->pScreen;
+
SCREEN_UNWRAP(pScreen, GetImage);
if (pDrawable->type == DRAWABLE_WINDOW) {
@@ -177,7 +174,7 @@ RootlessGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
RootlessRedisplayScreen(pScreen);
// RedisplayScreen stops drawing, so we need to start it again
- RootlessStartDrawing((WindowPtr)pDrawable);
+ RootlessStartDrawing((WindowPtr) pDrawable);
/* Check that we have some place to read from. */
winRec = WINREC(TopLevelParent((WindowPtr) pDrawable));
@@ -194,10 +191,10 @@ RootlessGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
x1 = x0 + w;
y1 = y0 + h;
- x0 = max (x0, winRec->x);
- y0 = max (y0, winRec->y);
- x1 = min (x1, winRec->x + winRec->width);
- y1 = min (y1, winRec->y + winRec->height);
+ x0 = max(x0, winRec->x);
+ y0 = max(y0, winRec->y);
+ x1 = min(x1, winRec->x + winRec->width);
+ y1 = min(y1, winRec->y + winRec->height);
sx = x0 - pDrawable->x;
sy = y0 - pDrawable->y;
@@ -210,11 +207,10 @@ RootlessGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
pScreen->GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
-out:
+ out:
SCREEN_WRAP(pScreen, GetImage);
}
-
/*
* RootlessSourceValidate
* CopyArea and CopyPlane use a GC tied to the destination drawable.
@@ -228,48 +224,50 @@ RootlessSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h,
{
SCREEN_UNWRAP(pDrawable->pScreen, SourceValidate);
if (pDrawable->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDrawable;
+ WindowPtr pWin = (WindowPtr) pDrawable;
+
RootlessStartDrawing(pWin);
}
if (pDrawable->pScreen->SourceValidate) {
- pDrawable->pScreen->SourceValidate(pDrawable, x, y, w, h, subWindowMode);
+ pDrawable->pScreen->SourceValidate(pDrawable, x, y, w, h,
+ subWindowMode);
}
SCREEN_WRAP(pDrawable->pScreen, SourceValidate);
}
static void
RootlessComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
PictureScreenPtr ps = GetPictureScreen(pScreen);
WindowPtr srcWin, dstWin, maskWin = NULL;
- if (pMask) { // pMask can be NULL
- maskWin = (pMask->pDrawable && pMask->pDrawable->type == DRAWABLE_WINDOW) ?
- (WindowPtr)pMask->pDrawable : NULL;
+ if (pMask) { // pMask can be NULL
+ maskWin = (pMask->pDrawable &&
+ pMask->pDrawable->type ==
+ DRAWABLE_WINDOW) ? (WindowPtr) pMask->pDrawable : NULL;
}
- srcWin = (pSrc->pDrawable && pSrc->pDrawable->type == DRAWABLE_WINDOW) ?
- (WindowPtr)pSrc->pDrawable : NULL;
- dstWin = (pDst->pDrawable->type == DRAWABLE_WINDOW) ?
- (WindowPtr)pDst->pDrawable : NULL;
+ srcWin = (pSrc->pDrawable && pSrc->pDrawable->type == DRAWABLE_WINDOW) ?
+ (WindowPtr) pSrc->pDrawable : NULL;
+ dstWin = (pDst->pDrawable->type == DRAWABLE_WINDOW) ?
+ (WindowPtr) pDst->pDrawable : NULL;
// SCREEN_UNWRAP(ps, Composite);
ps->Composite = SCREENREC(pScreen)->Composite;
- if (srcWin && IsFramedWindow(srcWin))
+ if (srcWin && IsFramedWindow(srcWin))
RootlessStartDrawing(srcWin);
if (maskWin && IsFramedWindow(maskWin))
RootlessStartDrawing(maskWin);
- if (dstWin && IsFramedWindow(dstWin))
+ if (dstWin && IsFramedWindow(dstWin))
RootlessStartDrawing(dstWin);
ps->Composite(op, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask,
- xDst, yDst, width, height);
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
- if (dstWin && IsFramedWindow(dstWin)) {
+ if (dstWin && IsFramedWindow(dstWin)) {
RootlessDamageRect(dstWin, xDst, yDst, width, height);
}
@@ -277,11 +275,10 @@ RootlessComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
// SCREEN_WRAP(ps, Composite);
}
-
static void
RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int nlist, GlyphListPtr list, GlyphPtr *glyphs)
+ int nlist, GlyphListPtr list, GlyphPtr * glyphs)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
PictureScreenPtr ps = GetPictureScreen(pScreen);
@@ -291,12 +288,14 @@ RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
WindowPtr srcWin, dstWin;
srcWin = (pSrc->pDrawable && pSrc->pDrawable->type == DRAWABLE_WINDOW) ?
- (WindowPtr)pSrc->pDrawable : NULL;
+ (WindowPtr) pSrc->pDrawable : NULL;
dstWin = (pDst->pDrawable->type == DRAWABLE_WINDOW) ?
- (WindowPtr)pDst->pDrawable : NULL;
+ (WindowPtr) pDst->pDrawable : NULL;
- if (srcWin && IsFramedWindow(srcWin)) RootlessStartDrawing(srcWin);
- if (dstWin && IsFramedWindow(dstWin)) RootlessStartDrawing(dstWin);
+ if (srcWin && IsFramedWindow(srcWin))
+ RootlessStartDrawing(srcWin);
+ if (dstWin && IsFramedWindow(dstWin))
+ RootlessStartDrawing(dstWin);
//SCREEN_UNWRAP(ps, Glyphs);
ps->Glyphs = SCREENREC(pScreen)->Glyphs;
@@ -340,10 +339,10 @@ RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
x2 = x1 + glyph->info.width;
y2 = y1 + glyph->info.height;
- box.x1 = max (box.x1, x1);
- box.y1 = max (box.y1, y1);
- box.x2 = max (box.x2, x2);
- box.y2 = max (box.y2, y2);
+ box.x1 = max(box.x1, x1);
+ box.y1 = max(box.y1, y1);
+ box.x2 = max(box.x2, x2);
+ box.y2 = max(box.y2, y2);
x += glyph->info.xOff;
y += glyph->info.yOff;
@@ -356,7 +355,6 @@ RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
}
}
-
/*
* RootlessValidateTree
* ValidateTree is modified in two ways:
@@ -378,7 +376,8 @@ RootlessValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
if (IsRoot(pParent)) {
RL_DEBUG_MSG("custom ");
result = RootlessMiValidateTree(pParent, pChild, kind);
- } else {
+ }
+ else {
HUGE_ROOT(pParent);
result = pScreen->ValidateTree(pParent, pChild, kind);
NORMAL_ROOT(pParent);
@@ -390,7 +389,6 @@ RootlessValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
return result;
}
-
/*
* RootlessMarkOverlappedWindows
* MarkOverlappedWindows is modified to ignore overlapping
@@ -403,6 +401,7 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst,
RegionRec saveRoot;
Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen;
+
SCREEN_UNWRAP(pScreen, MarkOverlappedWindows);
RL_DEBUG_MSG("MARKOVERLAPPEDWINDOWS start ");
@@ -412,7 +411,7 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst,
RL_DEBUG_MSG("is root not marking ");
result = FALSE;
}
- else if (! IsTopLevel(pWin)) {
+ else if (!IsTopLevel(pWin)) {
// not top-level window - mark normally
result = pScreen->MarkOverlappedWindows(pWin, pFirst, ppLayerWin);
}
@@ -426,7 +425,8 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst,
RL_DEBUG_MSG("is top level! ");
/* single layered systems are easy */
- if (ppLayerWin) *ppLayerWin = pWin;
+ if (ppLayerWin)
+ *ppLayerWin = pWin;
if (pWin == pFirst) {
/* Blindly mark pWin and all of its inferiors. This is a slight
@@ -437,10 +437,10 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst,
while (1) {
if (pChild->viewable) {
if (RegionBroken(&pChild->winSize))
- SetWinSize (pChild);
+ SetWinSize(pChild);
if (RegionBroken(&pChild->borderSize))
- SetBorderSize (pChild);
- (* MarkWindow)(pChild);
+ SetBorderSize(pChild);
+ (*MarkWindow) (pChild);
if (pChild->firstChild) {
pChild = pChild->firstChild;
continue;
@@ -455,7 +455,7 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst,
anyMarked = TRUE;
}
if (anyMarked)
- (* MarkWindow)(pWin->parent);
+ (*MarkWindow) (pWin->parent);
result = anyMarked;
}
NORMAL_ROOT(pWin);
@@ -465,94 +465,94 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst,
return result;
}
-static void expose_1 (WindowPtr pWin) {
+static void
+expose_1(WindowPtr pWin)
+{
WindowPtr pChild;
-
+
if (!pWin->realized)
return;
-
+
miPaintWindow(pWin, &pWin->borderClip, PW_BACKGROUND);
-
+
/* FIXME: comments in windowstr.h indicate that borderClip doesn't
- include subwindow visibility. But I'm not so sure.. so we may
- be exposing too much.. */
-
- miSendExposures (pWin, &pWin->borderClip,
- pWin->drawable.x, pWin->drawable.y);
-
+ include subwindow visibility. But I'm not so sure.. so we may
+ be exposing too much.. */
+
+ miSendExposures(pWin, &pWin->borderClip,
+ pWin->drawable.x, pWin->drawable.y);
+
for (pChild = pWin->firstChild; pChild != NULL; pChild = pChild->nextSib)
- expose_1 (pChild);
+ expose_1(pChild);
}
void
-RootlessScreenExpose (ScreenPtr pScreen)
+RootlessScreenExpose(ScreenPtr pScreen)
{
- expose_1 (pScreen->root);
+ expose_1(pScreen->root);
}
-
ColormapPtr
-RootlessGetColormap (ScreenPtr pScreen)
+RootlessGetColormap(ScreenPtr pScreen)
{
- RootlessScreenRec *s = SCREENREC (pScreen);
+ RootlessScreenRec *s = SCREENREC(pScreen);
- return s->colormap;
+ return s->colormap;
}
static void
-RootlessInstallColormap (ColormapPtr pMap)
+RootlessInstallColormap(ColormapPtr pMap)
{
- ScreenPtr pScreen = pMap->pScreen;
- RootlessScreenRec *s = SCREENREC (pScreen);
+ ScreenPtr pScreen = pMap->pScreen;
+ RootlessScreenRec *s = SCREENREC(pScreen);
- SCREEN_UNWRAP(pScreen, InstallColormap);
+ SCREEN_UNWRAP(pScreen, InstallColormap);
- if (s->colormap != pMap) {
- s->colormap = pMap;
- s->colormap_changed = TRUE;
- RootlessQueueRedisplay (pScreen);
- }
+ if (s->colormap != pMap) {
+ s->colormap = pMap;
+ s->colormap_changed = TRUE;
+ RootlessQueueRedisplay(pScreen);
+ }
- pScreen->InstallColormap (pMap);
+ pScreen->InstallColormap(pMap);
- SCREEN_WRAP (pScreen, InstallColormap);
+ SCREEN_WRAP(pScreen, InstallColormap);
}
static void
-RootlessUninstallColormap (ColormapPtr pMap)
+RootlessUninstallColormap(ColormapPtr pMap)
{
- ScreenPtr pScreen = pMap->pScreen;
- RootlessScreenRec *s = SCREENREC (pScreen);
+ ScreenPtr pScreen = pMap->pScreen;
+ RootlessScreenRec *s = SCREENREC(pScreen);
- SCREEN_UNWRAP(pScreen, UninstallColormap);
+ SCREEN_UNWRAP(pScreen, UninstallColormap);
- if (s->colormap == pMap)
- s->colormap = NULL;
+ if (s->colormap == pMap)
+ s->colormap = NULL;
- pScreen->UninstallColormap (pMap);
+ pScreen->UninstallColormap(pMap);
- SCREEN_WRAP(pScreen, UninstallColormap);
+ SCREEN_WRAP(pScreen, UninstallColormap);
}
static void
-RootlessStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
+RootlessStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef)
{
- ScreenPtr pScreen = pMap->pScreen;
- RootlessScreenRec *s = SCREENREC (pScreen);
+ ScreenPtr pScreen = pMap->pScreen;
+ RootlessScreenRec *s = SCREENREC(pScreen);
- SCREEN_UNWRAP(pScreen, StoreColors);
+ SCREEN_UNWRAP(pScreen, StoreColors);
- if (s->colormap == pMap && ndef > 0) {
- s->colormap_changed = TRUE;
- RootlessQueueRedisplay (pScreen);
- }
+ if (s->colormap == pMap && ndef > 0) {
+ s->colormap_changed = TRUE;
+ RootlessQueueRedisplay(pScreen);
+ }
- pScreen->StoreColors (pMap, ndef, pdef);
+ pScreen->StoreColors(pMap, ndef, pdef);
- SCREEN_WRAP(pScreen, StoreColors);
+ SCREEN_WRAP(pScreen, StoreColors);
}
-
static CARD32
RootlessRedisplayCallback(OsTimerPtr timer, CARD32 time, void *arg)
{
@@ -576,7 +576,6 @@ RootlessRedisplayCallback(OsTimerPtr timer, CARD32 time, void *arg)
return ROOTLESS_REDISPLAY_DELAY;
}
-
/*
* RootlessQueueRedisplay
* Queue a redisplay after a timer delay to ensure we do not redisplay
@@ -594,12 +593,10 @@ RootlessQueueRedisplay(ScreenPtr pScreen)
screenRec->redisplay_timer = TimerSet(screenRec->redisplay_timer,
0, ROOTLESS_REDISPLAY_DELAY,
- RootlessRedisplayCallback,
- screenRec);
+ RootlessRedisplayCallback, screenRec);
screenRec->redisplay_timer_set = TRUE;
}
-
/*
* RootlessBlockHandler
* If the redisplay timer has expired, flush drawing before blocking
@@ -618,30 +615,31 @@ RootlessBlockHandler(pointer pbdata, OSTimePtr pTimeout, pointer pReadmask)
}
}
-
static void
RootlessWakeupHandler(pointer data, int i, pointer LastSelectMask)
{
// nothing here
}
-
static Bool
RootlessAllocatePrivates(ScreenPtr pScreen)
{
RootlessScreenRec *s;
- if (!dixRegisterPrivateKey(&rootlessGCPrivateKeyRec, PRIVATE_GC, sizeof(RootlessGCRec)))
+ if (!dixRegisterPrivateKey
+ (&rootlessGCPrivateKeyRec, PRIVATE_GC, sizeof(RootlessGCRec)))
return FALSE;
if (!dixRegisterPrivateKey(&rootlessScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
if (!dixRegisterPrivateKey(&rootlessWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
return FALSE;
- if (!dixRegisterPrivateKey(&rootlessWindowOldPixmapPrivateKeyRec, PRIVATE_WINDOW, 0))
+ if (!dixRegisterPrivateKey
+ (&rootlessWindowOldPixmapPrivateKeyRec, PRIVATE_WINDOW, 0))
return FALSE;
s = malloc(sizeof(RootlessScreenRec));
- if (! s) return FALSE;
+ if (!s)
+ return FALSE;
SETSCREENREC(pScreen, s);
s->pixmap_data = NULL;
@@ -653,7 +651,6 @@ RootlessAllocatePrivates(ScreenPtr pScreen)
return TRUE;
}
-
static void
RootlessWrap(ScreenPtr pScreen)
{
@@ -696,6 +693,7 @@ RootlessWrap(ScreenPtr pScreen)
{
// Composite and Glyphs don't use normal screen wrapping
PictureScreenPtr ps = GetPictureScreen(pScreen);
+
s->Composite = ps->Composite;
ps->Composite = RootlessComposite;
s->Glyphs = ps->Glyphs;
@@ -707,13 +705,13 @@ RootlessWrap(ScreenPtr pScreen)
#undef WRAP
}
-
/*
* RootlessInit
* Called by the rootless implementation to initialize the rootless layer.
* Rootless wraps lots of stuff and needs a bunch of devPrivates.
*/
-Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs)
+Bool
+RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs)
{
RootlessScreenRec *s;
@@ -730,25 +728,24 @@ Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs)
if (!RegisterBlockAndWakeupHandlers(RootlessBlockHandler,
RootlessWakeupHandler,
- (pointer) pScreen))
- {
+ (pointer) pScreen)) {
return FALSE;
}
return TRUE;
}
-void RootlessUpdateRooted (Bool state) {
+void
+RootlessUpdateRooted(Bool state)
+{
int i;
-
- if (!state)
- {
+
+ if (!state) {
for (i = 0; i < screenInfo.numScreens; i++)
- RootlessDisableRoot (screenInfo.screens[i]);
+ RootlessDisableRoot(screenInfo.screens[i]);
}
- else
- {
+ else {
for (i = 0; i < screenInfo.numScreens; i++)
- RootlessEnableRoot (screenInfo.screens[i]);
+ RootlessEnableRoot(screenInfo.screens[i]);
}
}
diff --git a/xorg-server/miext/rootless/rootlessValTree.c b/xorg-server/miext/rootless/rootlessValTree.c
index 9aa881423..730d2917e 100644
--- a/xorg-server/miext/rootless/rootlessValTree.c
+++ b/xorg-server/miext/rootless/rootlessValTree.c
@@ -86,14 +86,14 @@ Equipment Corporation.
* Summer '89: Joel McCormack -- so fast you wouldn't believe it possible.
* In particular, much improved code for window mapping and
* circulating.
- * Bob Scheifler -- avoid miComputeClips for unmapped windows,
- * valdata changes
+ * Bob Scheifler -- avoid miComputeClips for unmapped windows,
+ * valdata changes
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include <stddef.h> /* For NULL */
+#include <stddef.h> /* For NULL */
#include <X11/X.h>
#include "scrnintstr.h"
#include "validate.h"
@@ -104,65 +104,63 @@ Equipment Corporation.
#include "globals.h"
-int RootlessMiValidateTree (WindowPtr pRoot, WindowPtr pChild, VTKind kind);
+int RootlessMiValidateTree(WindowPtr pRoot, WindowPtr pChild, VTKind kind);
/*
* Compute the visibility of a shaped window
*/
static int
-RootlessShapedWindowIn (RegionPtr universe,
- RegionPtr bounding, BoxPtr rect, int x, int y)
+RootlessShapedWindowIn(RegionPtr universe,
+ RegionPtr bounding, BoxPtr rect, int x, int y)
{
- BoxRec box;
- register BoxPtr boundBox;
- int nbox;
- Bool someIn, someOut;
+ BoxRec box;
+ register BoxPtr boundBox;
+ int nbox;
+ Bool someIn, someOut;
register int t, x1, y1, x2, y2;
- nbox = RegionNumRects (bounding);
- boundBox = RegionRects (bounding);
+ nbox = RegionNumRects(bounding);
+ boundBox = RegionRects(bounding);
someIn = someOut = FALSE;
x1 = rect->x1;
y1 = rect->y1;
x2 = rect->x2;
y2 = rect->y2;
- while (nbox--)
- {
- if ((t = boundBox->x1 + x) < x1)
- t = x1;
- box.x1 = t;
- if ((t = boundBox->y1 + y) < y1)
- t = y1;
- box.y1 = t;
- if ((t = boundBox->x2 + x) > x2)
- t = x2;
- box.x2 = t;
- if ((t = boundBox->y2 + y) > y2)
- t = y2;
- box.y2 = t;
- if (box.x1 > box.x2)
- box.x2 = box.x1;
- if (box.y1 > box.y2)
- box.y2 = box.y1;
- switch (RegionContainsRect(universe, &box))
- {
- case rgnIN:
- if (someOut)
- return rgnPART;
- someIn = TRUE;
- break;
- case rgnOUT:
- if (someIn)
- return rgnPART;
- someOut = TRUE;
- break;
- default:
- return rgnPART;
- }
- boundBox++;
+ while (nbox--) {
+ if ((t = boundBox->x1 + x) < x1)
+ t = x1;
+ box.x1 = t;
+ if ((t = boundBox->y1 + y) < y1)
+ t = y1;
+ box.y1 = t;
+ if ((t = boundBox->x2 + x) > x2)
+ t = x2;
+ box.x2 = t;
+ if ((t = boundBox->y2 + y) > y2)
+ t = y2;
+ box.y2 = t;
+ if (box.x1 > box.x2)
+ box.x2 = box.x1;
+ if (box.y1 > box.y2)
+ box.y2 = box.y1;
+ switch (RegionContainsRect(universe, &box)) {
+ case rgnIN:
+ if (someOut)
+ return rgnPART;
+ someIn = TRUE;
+ break;
+ case rgnOUT:
+ if (someIn)
+ return rgnPART;
+ someOut = TRUE;
+ break;
+ default:
+ return rgnPART;
+ }
+ boundBox++;
}
if (someIn)
- return rgnIN;
+ return rgnIN;
return rgnOUT;
}
@@ -170,7 +168,6 @@ RootlessShapedWindowIn (RegionPtr universe,
HasBorder(w) && \
(w)->backgroundState == ParentRelative)
-
/*
*-----------------------------------------------------------------------
* RootlessComputeClips --
@@ -188,18 +185,18 @@ RootlessShapedWindowIn (RegionPtr universe,
*-----------------------------------------------------------------------
*/
static void
-RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
- RegionPtr universe, VTKind kind, RegionPtr exposed)
+RootlessComputeClips(WindowPtr pParent, ScreenPtr pScreen,
+ RegionPtr universe, VTKind kind, RegionPtr exposed)
{
- int dx,
- dy;
- RegionRec childUniverse;
- register WindowPtr pChild;
- int oldVis, newVis;
- BoxRec borderSize;
- RegionRec childUnion;
- Bool overlap;
- RegionPtr borderVisible;
+ int dx, dy;
+ RegionRec childUniverse;
+ register WindowPtr pChild;
+ int oldVis, newVis;
+ BoxRec borderSize;
+ RegionRec childUnion;
+ Bool overlap;
+ RegionPtr borderVisible;
+
/*
* Figure out the new visibility of this window.
* The extent of the universe should be the same as the extent of
@@ -210,52 +207,52 @@ RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
*/
borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent);
borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent);
- dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent);
+ dx = (int) pParent->drawable.x + (int) pParent->drawable.width +
+ wBorderWidth(pParent);
if (dx > 32767)
- dx = 32767;
+ dx = 32767;
borderSize.x2 = dx;
- dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent);
+ dy = (int) pParent->drawable.y + (int) pParent->drawable.height +
+ wBorderWidth(pParent);
if (dy > 32767)
- dy = 32767;
+ dy = 32767;
borderSize.y2 = dy;
oldVis = pParent->visibility;
- switch (RegionContainsRect(universe, &borderSize))
- {
+ switch (RegionContainsRect(universe, &borderSize)) {
case rgnIN:
- newVis = VisibilityUnobscured;
- break;
- case rgnPART:
- newVis = VisibilityPartiallyObscured;
- {
- RegionPtr pBounding;
-
- if ((pBounding = wBoundingShape (pParent)))
- {
- switch (RootlessShapedWindowIn (universe,
- pBounding, &borderSize,
- pParent->drawable.x,
- pParent->drawable.y))
- {
- case rgnIN:
- newVis = VisibilityUnobscured;
- break;
- case rgnOUT:
- newVis = VisibilityFullyObscured;
- break;
- }
- }
- }
- break;
- default:
- newVis = VisibilityFullyObscured;
- break;
+ newVis = VisibilityUnobscured;
+ break;
+ case rgnPART:
+ newVis = VisibilityPartiallyObscured;
+ {
+ RegionPtr pBounding;
+
+ if ((pBounding = wBoundingShape(pParent))) {
+ switch (RootlessShapedWindowIn(universe,
+ pBounding, &borderSize,
+ pParent->drawable.x,
+ pParent->drawable.y)) {
+ case rgnIN:
+ newVis = VisibilityUnobscured;
+ break;
+ case rgnOUT:
+ newVis = VisibilityFullyObscured;
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ newVis = VisibilityFullyObscured;
+ break;
}
pParent->visibility = newVis;
if (oldVis != newVis &&
- ((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
- SendVisibilityNotify(pParent);
+ ((pParent->
+ eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
+ SendVisibilityNotify(pParent);
dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x;
dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y;
@@ -268,74 +265,64 @@ RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
case VTMap:
case VTStack:
case VTUnmap:
- break;
+ break;
case VTMove:
- if ((oldVis == newVis) &&
- ((oldVis == VisibilityFullyObscured) ||
- (oldVis == VisibilityUnobscured)))
- {
- pChild = pParent;
- while (1)
- {
- if (pChild->viewable)
- {
- if (pChild->visibility != VisibilityFullyObscured)
- {
- RegionTranslate(&pChild->borderClip,
- dx, dy);
- RegionTranslate(&pChild->clipList,
- dx, dy);
- pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pChild, dx, dy);
-
- }
- if (pChild->valdata)
- {
- RegionNull(&pChild->valdata->after.borderExposed);
- if (HasParentRelativeBorder(pChild))
- {
- RegionSubtract(&pChild->valdata->after.borderExposed,
- &pChild->borderClip,
- &pChild->winSize);
- }
- RegionNull(&pChild->valdata->after.exposed);
- }
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pParent))
- pChild = pChild->parent;
- if (pChild == pParent)
- break;
- pChild = pChild->nextSib;
- }
- return;
- }
- /* fall through */
+ if ((oldVis == newVis) &&
+ ((oldVis == VisibilityFullyObscured) ||
+ (oldVis == VisibilityUnobscured))) {
+ pChild = pParent;
+ while (1) {
+ if (pChild->viewable) {
+ if (pChild->visibility != VisibilityFullyObscured) {
+ RegionTranslate(&pChild->borderClip, dx, dy);
+ RegionTranslate(&pChild->clipList, dx, dy);
+ pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (pChild, dx, dy);
+
+ }
+ if (pChild->valdata) {
+ RegionNull(&pChild->valdata->after.borderExposed);
+ if (HasParentRelativeBorder(pChild)) {
+ RegionSubtract(&pChild->valdata->after.
+ borderExposed, &pChild->borderClip,
+ &pChild->winSize);
+ }
+ RegionNull(&pChild->valdata->after.exposed);
+ }
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pParent))
+ pChild = pChild->parent;
+ if (pChild == pParent)
+ break;
+ pChild = pChild->nextSib;
+ }
+ return;
+ }
+ /* fall through */
default:
- /*
- * To calculate exposures correctly, we have to translate the old
- * borderClip and clipList regions to the window's new location so there
- * is a correspondence between pieces of the new and old clipping regions.
- */
- if (dx || dy)
- {
- /*
- * We translate the old clipList because that will be exposed or copied
- * if gravity is right.
- */
- RegionTranslate(&pParent->borderClip, dx, dy);
- RegionTranslate(&pParent->clipList, dx, dy);
- }
- break;
+ /*
+ * To calculate exposures correctly, we have to translate the old
+ * borderClip and clipList regions to the window's new location so there
+ * is a correspondence between pieces of the new and old clipping regions.
+ */
+ if (dx || dy) {
+ /*
+ * We translate the old clipList because that will be exposed or copied
+ * if gravity is right.
+ */
+ RegionTranslate(&pParent->borderClip, dx, dy);
+ RegionTranslate(&pParent->clipList, dx, dy);
+ }
+ break;
case VTBroken:
- RegionEmpty(&pParent->borderClip);
- RegionEmpty(&pParent->clipList);
- break;
+ RegionEmpty(&pParent->borderClip);
+ RegionEmpty(&pParent->clipList);
+ break;
}
borderVisible = pParent->valdata->before.borderVisible;
@@ -351,104 +338,91 @@ RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
* This leaves a region of pieces that weren't exposed before.
*/
- if (HasBorder (pParent))
- {
- if (borderVisible)
- {
- /*
- * when the border changes shape, the old visible portions
- * of the border will be saved by DIX in borderVisible --
- * use that region and destroy it
- */
- RegionSubtract(exposed, universe, borderVisible);
- RegionDestroy(borderVisible);
- }
- else
- {
- RegionSubtract(exposed, universe, &pParent->borderClip);
- }
- if (HasParentRelativeBorder(pParent) && (dx || dy)) {
- RegionSubtract(&pParent->valdata->after.borderExposed,
- universe,
- &pParent->winSize);
- } else {
- RegionSubtract(&pParent->valdata->after.borderExposed,
- exposed, &pParent->winSize);
- }
-
- RegionCopy(&pParent->borderClip, universe);
-
- /*
- * To get the right clipList for the parent, and to make doubly sure
- * that no child overlaps the parent's border, we remove the parent's
- * border from the universe before proceeding.
- */
-
- RegionIntersect(universe, universe, &pParent->winSize);
+ if (HasBorder(pParent)) {
+ if (borderVisible) {
+ /*
+ * when the border changes shape, the old visible portions
+ * of the border will be saved by DIX in borderVisible --
+ * use that region and destroy it
+ */
+ RegionSubtract(exposed, universe, borderVisible);
+ RegionDestroy(borderVisible);
+ }
+ else {
+ RegionSubtract(exposed, universe, &pParent->borderClip);
+ }
+ if (HasParentRelativeBorder(pParent) && (dx || dy)) {
+ RegionSubtract(&pParent->valdata->after.borderExposed,
+ universe, &pParent->winSize);
+ }
+ else {
+ RegionSubtract(&pParent->valdata->after.borderExposed,
+ exposed, &pParent->winSize);
+ }
+
+ RegionCopy(&pParent->borderClip, universe);
+
+ /*
+ * To get the right clipList for the parent, and to make doubly sure
+ * that no child overlaps the parent's border, we remove the parent's
+ * border from the universe before proceeding.
+ */
+
+ RegionIntersect(universe, universe, &pParent->winSize);
}
else
- RegionCopy(&pParent->borderClip, universe);
-
- if ((pChild = pParent->firstChild) && pParent->mapped)
- {
- RegionNull(&childUniverse);
- RegionNull(&childUnion);
- if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
- ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
- (pChild->drawable.x < pParent->lastChild->drawable.x)))
- {
- for (; pChild; pChild = pChild->nextSib)
- {
- if (pChild->viewable)
- RegionAppend(&childUnion, &pChild->borderSize);
- }
- }
- else
- {
- for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib)
- {
- if (pChild->viewable)
- RegionAppend(&childUnion, &pChild->borderSize);
- }
- }
- RegionValidate(&childUnion, &overlap);
-
- for (pChild = pParent->firstChild;
- pChild;
- pChild = pChild->nextSib)
- {
- if (pChild->viewable) {
- /*
- * If the child is viewable, we want to remove its extents
- * from the current universe, but we only re-clip it if
- * it's been marked.
- */
- if (pChild->valdata) {
- /*
- * Figure out the new universe from the child's
- * perspective and recurse.
- */
- RegionIntersect(&childUniverse,
- universe,
- &pChild->borderSize);
- RootlessComputeClips (pChild, pScreen, &childUniverse,
- kind, exposed);
- }
- /*
- * Once the child has been processed, we remove its extents
- * from the current universe, thus denying its space to any
- * other sibling.
- */
- if (overlap)
- RegionSubtract(universe, universe,
- &pChild->borderSize);
- }
- }
- if (!overlap)
- RegionSubtract(universe, universe, &childUnion);
- RegionUninit(&childUnion);
- RegionUninit(&childUniverse);
- } /* if any children */
+ RegionCopy(&pParent->borderClip, universe);
+
+ if ((pChild = pParent->firstChild) && pParent->mapped) {
+ RegionNull(&childUniverse);
+ RegionNull(&childUnion);
+ if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
+ ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
+ (pChild->drawable.x < pParent->lastChild->drawable.x))) {
+ for (; pChild; pChild = pChild->nextSib) {
+ if (pChild->viewable)
+ RegionAppend(&childUnion, &pChild->borderSize);
+ }
+ }
+ else {
+ for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) {
+ if (pChild->viewable)
+ RegionAppend(&childUnion, &pChild->borderSize);
+ }
+ }
+ RegionValidate(&childUnion, &overlap);
+
+ for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) {
+ if (pChild->viewable) {
+ /*
+ * If the child is viewable, we want to remove its extents
+ * from the current universe, but we only re-clip it if
+ * it's been marked.
+ */
+ if (pChild->valdata) {
+ /*
+ * Figure out the new universe from the child's
+ * perspective and recurse.
+ */
+ RegionIntersect(&childUniverse,
+ universe, &pChild->borderSize);
+ RootlessComputeClips(pChild, pScreen, &childUniverse,
+ kind, exposed);
+ }
+ /*
+ * Once the child has been processed, we remove its extents
+ * from the current universe, thus denying its space to any
+ * other sibling.
+ */
+ if (overlap)
+ RegionSubtract(universe, universe, &pChild->borderSize);
+ }
+ }
+ if (!overlap)
+ RegionSubtract(universe, universe, &childUnion);
+ RegionUninit(&childUnion);
+ RegionUninit(&childUniverse);
+ } /* if any children */
/*
* 'universe' now contains the new clipList for the parent window.
@@ -457,25 +431,22 @@ RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
* new, just as for the border.
*/
- if (oldVis == VisibilityFullyObscured ||
- oldVis == VisibilityNotViewable)
- {
- RegionCopy(&pParent->valdata->after.exposed, universe);
+ if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) {
+ RegionCopy(&pParent->valdata->after.exposed, universe);
}
else if (newVis != VisibilityFullyObscured &&
- newVis != VisibilityNotViewable)
- {
- RegionSubtract(&pParent->valdata->after.exposed,
- universe, &pParent->clipList);
+ newVis != VisibilityNotViewable) {
+ RegionSubtract(&pParent->valdata->after.exposed,
+ universe, &pParent->clipList);
}
/* HACK ALERT - copying contents of regions, instead of regions */
{
- RegionRec tmp;
+ RegionRec tmp;
- tmp = pParent->clipList;
- pParent->clipList = *universe;
- *universe = tmp;
+ tmp = pParent->clipList;
+ pParent->clipList = *universe;
+ *universe = tmp;
}
#ifdef NOTDEF
@@ -485,35 +456,33 @@ RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pParent, dx, dy);
+ (*pScreen->ClipNotify) (pParent, dx, dy);
}
static void
RootlessTreeObscured(WindowPtr pParent)
{
register WindowPtr pChild;
- register int oldVis;
+ register int oldVis;
pChild = pParent;
- while (1)
- {
- if (pChild->viewable)
- {
- oldVis = pChild->visibility;
- if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
- ((pChild->eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
- SendVisibilityNotify(pChild);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pParent))
- pChild = pChild->parent;
- if (pChild == pParent)
- break;
- pChild = pChild->nextSib;
+ while (1) {
+ if (pChild->viewable) {
+ oldVis = pChild->visibility;
+ if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
+ ((pChild->
+ eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
+ SendVisibilityNotify(pChild);
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pParent))
+ pChild = pChild->parent;
+ if (pChild == pParent)
+ break;
+ pChild = pChild->nextSib;
}
}
@@ -551,31 +520,30 @@ RootlessTreeObscured(WindowPtr pParent)
We need to make sure top-level windows don't clip each other,
and that top-level windows aren't clipped to the root window.
*/
-/*ARGSUSED*/
+ /*ARGSUSED*/
// fixme this is ugly
// Xprint/ValTree.c doesn't work, but maybe that method can?
-int
-RootlessMiValidateTree (WindowPtr pRoot, /* Parent to validate */
- WindowPtr pChild, /* First child of pRoot that was
- * affected */
- VTKind kind /* What kind of configuration caused call */)
+ int
+RootlessMiValidateTree(WindowPtr pRoot, /* Parent to validate */
+ WindowPtr pChild, /* First child of pRoot that was
+ * affected */
+ VTKind kind /* What kind of configuration caused call */
+ )
{
- RegionRec childClip; /* The new borderClip for the current
- * child */
- RegionRec exposed; /* For intermediate calculations */
- register ScreenPtr pScreen;
- register WindowPtr pWin;
+ RegionRec childClip; /* The new borderClip for the current
+ * child */
+ RegionRec exposed; /* For intermediate calculations */
+ register ScreenPtr pScreen;
+ register WindowPtr pWin;
pScreen = pRoot->drawable.pScreen;
if (pChild == NullWindow)
- pChild = pRoot->firstChild;
+ pChild = pRoot->firstChild;
RegionNull(&childClip);
RegionNull(&exposed);
- if (RegionBroken(&pRoot->clipList) &&
- !RegionBroken(&pRoot->borderClip))
- {
+ if (RegionBroken(&pRoot->clipList) && !RegionBroken(&pRoot->borderClip)) {
// fixme this might not work, but hopefully doesn't happen anyway.
kind = VTBroken;
RegionEmpty(&pRoot->clipList);
@@ -588,22 +556,21 @@ RootlessMiValidateTree (WindowPtr pRoot, /* Parent to validate */
* childClip is always reset to that child's size.
*/
- for (pWin = pChild;
- pWin != NullWindow;
- pWin = pWin->nextSib)
- {
+ for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) {
if (pWin->viewable) {
if (pWin->valdata) {
RegionCopy(&childClip, &pWin->borderSize);
- RootlessComputeClips (pWin, pScreen, &childClip, kind, &exposed);
- } else if (pWin->visibility == VisibilityNotViewable) {
+ RootlessComputeClips(pWin, pScreen, &childClip, kind, &exposed);
+ }
+ else if (pWin->visibility == VisibilityNotViewable) {
RootlessTreeObscured(pWin);
}
- } else {
+ }
+ else {
if (pWin->valdata) {
RegionEmpty(&pWin->clipList);
if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pWin, 0, 0);
+ (*pScreen->ClipNotify) (pWin, 0, 0);
RegionEmpty(&pWin->borderClip);
pWin->valdata = NULL;
}
diff --git a/xorg-server/miext/rootless/rootlessWindow.c b/xorg-server/miext/rootless/rootlessWindow.c
index 4c7f7b044..cf1611c1e 100644
--- a/xorg-server/miext/rootless/rootlessWindow.c
+++ b/xorg-server/miext/rootless/rootlessWindow.c
@@ -1,1645 +1,1644 @@
-/*
- * Rootless window management
- */
-/*
- * Copyright (c) 2001 Greg Parker. All Rights Reserved.
- * Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stddef.h> /* For NULL */
-#include <limits.h> /* For CHAR_BIT */
-#include <assert.h>
-#include <X11/Xatom.h>
-#ifdef __APPLE__
-#include <Xplugin.h>
-#include "mi.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-//#include <X11/extensions/applewm.h>
-extern int darwinMainScreenX, darwinMainScreenY;
-extern Bool no_configure_window;
-#endif
-#include "fb.h"
-
-#include "rootlessCommon.h"
-#include "rootlessWindow.h"
-
-#ifdef _MSC_VER
-#define inline __inline
-#include "xplugin.h"
-extern int darwinMainScreenX, darwinMainScreenY;
-#endif
-
-#define SCREEN_TO_GLOBAL_X \
- (pScreen->x + rootlessGlobalOffsetX)
-#define SCREEN_TO_GLOBAL_Y \
- (pScreen->y + rootlessGlobalOffsetY)
-
-#define DEFINE_ATOM_HELPER(func,atom_name) \
- static Atom func (void) { \
- static unsigned int generation = 0; \
- static Atom atom; \
- if (generation != serverGeneration) { \
- generation = serverGeneration; \
- atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \
- } \
- return atom; \
- }
-
-DEFINE_ATOM_HELPER (xa_native_window_id, "_NATIVE_WINDOW_ID")
-
-static Bool windows_hidden;
-// TODO - abstract xp functions
-
-#ifdef __APPLE__
-
-// XXX: identical to x_cvt_vptr_to_uint ?
-#define MAKE_WINDOW_ID(x) ((xp_window_id)((size_t)(x)))
-
-void
-RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state)
-{
- RootlessWindowRec *winRec;
-
- if (pWin == NULL) return;
-
- winRec = WINREC (pWin);
- if (winRec == NULL) return;
-
- winRec->is_offscreen = ((state & XP_WINDOW_STATE_OFFSCREEN) != 0);
- winRec->is_obscured = ((state & XP_WINDOW_STATE_OBSCURED) != 0);
- pWin->rootlessUnhittable = winRec->is_offscreen;
-}
-
-void RootlessNativeWindowMoved (WindowPtr pWin) {
- xp_box bounds;
- int sx, sy, err;
- XID vlist[2];
- Mask mask;
- ClientPtr pClient;
- RootlessWindowRec *winRec;
-
- winRec = WINREC(pWin);
-
- if (xp_get_window_bounds (MAKE_WINDOW_ID(winRec->wid), &bounds) != Success) return;
-
- sx = pWin->drawable.pScreen->x + darwinMainScreenX;
- sy = pWin->drawable.pScreen->y + darwinMainScreenY;
-
- /* Fake up a ConfigureWindow packet to resize the window to the current bounds. */
- vlist[0] = (INT16) bounds.x1 - sx;
- vlist[1] = (INT16) bounds.y1 - sy;
- mask = CWX | CWY;
-
- /* pretend we're the owner of the window! */
- err = dixLookupClient(&pClient, pWin->drawable.id, serverClient, DixUnknownAccess);
- if(err != Success) {
- ErrorF("RootlessNativeWindowMoved(): Failed to lookup window: 0x%x\n", (unsigned int)pWin->drawable.id);
- return;
- }
-
- /* Don't want to do anything to the physical window (avoids
- notification-response feedback loops) */
-
- no_configure_window = TRUE;
- ConfigureWindow (pWin, mask, vlist, pClient);
- no_configure_window = FALSE;
-}
-
-#endif /* __APPLE__ */
-
-/*
- * RootlessCreateWindow
- * For now, don't create a physical window until either the window is
- * realized, or we really need it (e.g. to attach VRAM surfaces to).
- * Do reset the window size so it's not clipped by the root window.
- */
-Bool
-RootlessCreateWindow(WindowPtr pWin)
-{
- Bool result;
- RegionRec saveRoot;
-
- SETWINREC(pWin, NULL);
- dixSetPrivate(&pWin->devPrivates, rootlessWindowOldPixmapPrivateKey, NULL);
-
- SCREEN_UNWRAP(pWin->drawable.pScreen, CreateWindow);
-
- if (!IsRoot(pWin)) {
- /* win/border size set by DIX, not by wrapped CreateWindow, so
- correct it here. Don't HUGE_ROOT when pWin is the root! */
-
- HUGE_ROOT(pWin);
- SetWinSize(pWin);
- SetBorderSize(pWin);
- }
-
- result = pWin->drawable.pScreen->CreateWindow(pWin);
-
- if (pWin->parent) {
- NORMAL_ROOT(pWin);
- }
-
- SCREEN_WRAP(pWin->drawable.pScreen, CreateWindow);
-
- return result;
-}
-
-
-/*
- * RootlessDestroyFrame
- * Destroy the physical window associated with the given window.
- */
-static void
-RootlessDestroyFrame(WindowPtr pWin, RootlessWindowPtr winRec)
-{
- SCREENREC(pWin->drawable.pScreen)->imp->DestroyFrame(winRec->wid);
- free(winRec);
- SETWINREC(pWin, NULL);
-}
-
-
-/*
- * RootlessDestroyWindow
- * Destroy the physical window associated with the given window.
- */
-Bool
-RootlessDestroyWindow(WindowPtr pWin)
-{
- RootlessWindowRec *winRec = WINREC(pWin);
- Bool result;
-
- if (winRec != NULL) {
- RootlessDestroyFrame(pWin, winRec);
- }
-
- SCREEN_UNWRAP(pWin->drawable.pScreen, DestroyWindow);
- result = pWin->drawable.pScreen->DestroyWindow(pWin);
- SCREEN_WRAP(pWin->drawable.pScreen, DestroyWindow);
-
- return result;
-}
-
-
-
-static Bool
-RootlessGetShape(WindowPtr pWin, RegionPtr pShape)
-{
- if (wBoundingShape(pWin) == NULL)
- return FALSE;
-
- /* wBoundingShape is relative to *inner* origin of window.
- Translate by borderWidth to get the outside-relative position. */
-
- RegionNull(pShape);
- RegionCopy(pShape, wBoundingShape(pWin));
- RegionTranslate(pShape, pWin->borderWidth, pWin->borderWidth);
-
- return TRUE;
-}
-
-
-/*
- * RootlessReshapeFrame
- * Set the frame shape.
- */
-static void RootlessReshapeFrame(WindowPtr pWin)
-{
- RootlessWindowRec *winRec = WINREC(pWin);
- RegionRec newShape;
- RegionPtr pShape;
-
- // If the window is not yet framed, do nothing
- if (winRec == NULL)
- return;
-
- if (IsRoot(pWin))
- return;
-
- RootlessStopDrawing(pWin, FALSE);
-
- pShape = RootlessGetShape(pWin, &newShape) ? &newShape : NULL;
-
-#ifdef ROOTLESSDEBUG
- RL_DEBUG_MSG("reshaping...");
- if (pShape != NULL) {
- RL_DEBUG_MSG("numrects %d, extents %d %d %d %d ",
- RegionNumRects(&newShape),
- newShape.extents.x1, newShape.extents.y1,
- newShape.extents.x2, newShape.extents.y2);
- } else {
- RL_DEBUG_MSG("no shape ");
- }
-#endif
-
- SCREENREC(pWin->drawable.pScreen)->imp->ReshapeFrame(winRec->wid, pShape);
-
- if (pShape != NULL)
- RegionUninit(&newShape);
-}
-
-
-/*
- * RootlessSetShape
- * Shape is usually set before a window is mapped and the window will
- * not have a frame associated with it. In this case, the frame will be
- * shaped when the window is framed.
- */
-void
-RootlessSetShape(WindowPtr pWin, int kind)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- SCREEN_UNWRAP(pScreen, SetShape);
- pScreen->SetShape(pWin, kind);
- SCREEN_WRAP(pScreen, SetShape);
-
- RootlessReshapeFrame(pWin);
-}
-
-
-
-/* Disallow ParentRelative background on top-level windows
- because the root window doesn't really have the right background.
- */
-Bool
-RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask)
-{
- Bool result;
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- RL_DEBUG_MSG("change window attributes start ");
-
- SCREEN_UNWRAP(pScreen, ChangeWindowAttributes);
- result = pScreen->ChangeWindowAttributes(pWin, vmask);
- SCREEN_WRAP(pScreen, ChangeWindowAttributes);
-
- if (WINREC(pWin)) {
- // disallow ParentRelative background state
- if (pWin->backgroundState == ParentRelative) {
- XID pixel = 0;
- ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient);
- }
- }
-
- RL_DEBUG_MSG("change window attributes end\n");
- return result;
-}
-
-
-/*
- * RootlessPositionWindow
- * This is a hook for when DIX moves or resizes a window.
- * Update the frame position now although the physical window is moved
- * in RootlessMoveWindow. (x, y) are *inside* position. After this,
- * mi and fb are expecting the pixmap to be at the new location.
- */
-Bool
-RootlessPositionWindow(WindowPtr pWin, int x, int y)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RootlessWindowRec *winRec = WINREC(pWin);
- Bool result;
-
- RL_DEBUG_MSG("positionwindow start (win 0x%x @ %i, %i)\n", pWin, x, y);
-
- if (winRec) {
- if (winRec->is_drawing) {
- // Reset frame's pixmap and move it to the new position.
- int bw = wBorderWidth(pWin);
-
- winRec->pixmap->devPrivate.ptr = winRec->pixelData;
- SetPixmapBaseToScreen(winRec->pixmap, x - bw, y - bw);
- }
- }
-
- SCREEN_UNWRAP(pScreen, PositionWindow);
- result = pScreen->PositionWindow(pWin, x, y);
- SCREEN_WRAP(pScreen, PositionWindow);
-
- RL_DEBUG_MSG("positionwindow end\n");
- return result;
-}
-
-
-/*
- * RootlessInitializeFrame
- * Initialize some basic attributes of the frame. Note that winRec
- * may already have valid data in it, so don't overwrite anything
- * valuable.
- */
-static void
-RootlessInitializeFrame(WindowPtr pWin, RootlessWindowRec *winRec)
-{
- DrawablePtr d = &pWin->drawable;
- int bw = wBorderWidth(pWin);
-
- winRec->win = pWin;
-
- winRec->x = d->x - bw;
- winRec->y = d->y - bw;
- winRec->width = d->width + 2*bw;
- winRec->height = d->height + 2*bw;
- winRec->borderWidth = bw;
-}
-
-/*
- * RootlessEnsureFrame
- * Make sure the given window is framed. If the window doesn't have a
- * physical window associated with it, attempt to create one. If that
- * is unsuccessful, return NULL.
- */
-static RootlessWindowRec *
-RootlessEnsureFrame(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RootlessWindowRec *winRec;
- RegionRec shape;
- RegionPtr pShape = NULL;
-
- if (WINREC(pWin) != NULL)
- return WINREC(pWin);
-
- if (!IsTopLevel(pWin) && !IsRoot(pWin))
- return NULL;
-
- if (pWin->drawable.class != InputOutput)
- return NULL;
-
- winRec = malloc(sizeof(RootlessWindowRec));
-
- if (!winRec)
- return NULL;
-
- RootlessInitializeFrame(pWin, winRec);
-
- winRec->is_drawing = FALSE;
- winRec->is_reorder_pending = FALSE;
- winRec->pixmap = NULL;
- winRec->wid = NULL;
- winRec->level = 0;
-
- SETWINREC(pWin, winRec);
-
- // Set the frame's shape if the window is shaped
- if (RootlessGetShape(pWin, &shape))
- pShape = &shape;
-
- RL_DEBUG_MSG("creating frame ");
-
- if (!SCREENREC(pScreen)->imp->CreateFrame(winRec, pScreen,
- winRec->x + SCREEN_TO_GLOBAL_X,
- winRec->y + SCREEN_TO_GLOBAL_Y,
- pShape))
- {
- RL_DEBUG_MSG("implementation failed to create frame!\n");
- free(winRec);
- SETWINREC(pWin, NULL);
- return NULL;
- }
-
- if (pWin->drawable.depth == 8)
- RootlessFlushWindowColormap(pWin);
-
- if (pShape != NULL)
- RegionUninit(&shape);
-
- return winRec;
-}
-
-
-/*
- * RootlessRealizeWindow
- * The frame is usually created here and not in CreateWindow so that
- * windows do not eat memory until they are realized.
- */
-Bool
-RootlessRealizeWindow(WindowPtr pWin)
-{
- Bool result;
- RegionRec saveRoot;
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- RL_DEBUG_MSG("realizewindow start (win 0x%x) ", pWin);
-
- if ((IsTopLevel(pWin) && pWin->drawable.class == InputOutput)) {
- RootlessWindowRec *winRec;
-
- winRec = RootlessEnsureFrame(pWin);
- if (winRec == NULL)
- return FALSE;
-
- winRec->is_reorder_pending = TRUE;
-
- RL_DEBUG_MSG("Top level window ");
-
- // Disallow ParentRelative background state on top-level windows.
- // This might have been set before the window was mapped.
- if (pWin->backgroundState == ParentRelative) {
- XID pixel = 0;
- ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient);
- }
- }
-
- if (!IsRoot(pWin)) HUGE_ROOT(pWin);
- SCREEN_UNWRAP(pScreen, RealizeWindow);
- result = pScreen->RealizeWindow(pWin);
- SCREEN_WRAP(pScreen, RealizeWindow);
- if (!IsRoot(pWin)) NORMAL_ROOT(pWin);
-
- RL_DEBUG_MSG("realizewindow end\n");
- return result;
-}
-
-
-/*
- * RootlessFrameForWindow
- * Returns the frame ID for the physical window displaying the given window.
- * If CREATE is true and the window has no frame, attempt to create one.
- */
-RootlessFrameID
-RootlessFrameForWindow(WindowPtr pWin, Bool create)
-{
- WindowPtr pTopWin;
- RootlessWindowRec *winRec;
-
- pTopWin = TopLevelParent(pWin);
- if (pTopWin == NULL)
- return NULL;
-
- winRec = WINREC(pTopWin);
-
- if (winRec == NULL && create && pWin->drawable.class == InputOutput) {
- winRec = RootlessEnsureFrame(pTopWin);
- }
-
- if (winRec == NULL)
- return NULL;
-
- return winRec->wid;
-}
-
-
-/*
- * RootlessUnrealizeWindow
- * Unmap the physical window.
- */
-Bool
-RootlessUnrealizeWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RootlessWindowRec *winRec = WINREC(pWin);
- Bool result;
-
- RL_DEBUG_MSG("unrealizewindow start ");
-
- if (winRec) {
- RootlessStopDrawing(pWin, FALSE);
-
- SCREENREC(pScreen)->imp->UnmapFrame(winRec->wid);
-
- winRec->is_reorder_pending = FALSE;
- }
-
- SCREEN_UNWRAP(pScreen, UnrealizeWindow);
- result = pScreen->UnrealizeWindow(pWin);
- SCREEN_WRAP(pScreen, UnrealizeWindow);
-
- RL_DEBUG_MSG("unrealizewindow end\n");
- return result;
-}
-
-
-/*
- * RootlessReorderWindow
- * Reorder the frame associated with the given window so that it's
- * physically above the window below it in the X stacking order.
- */
-void
-RootlessReorderWindow(WindowPtr pWin)
-{
- RootlessWindowRec *winRec = WINREC(pWin);
-
- if (pWin->realized && winRec != NULL && !winRec->is_reorder_pending && !windows_hidden) {
- WindowPtr newPrevW;
- RootlessWindowRec *newPrev;
- RootlessFrameID newPrevID;
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- /* Check if the implementation wants the frame to not be reordered
- even though the X11 window is restacked. This can be useful if
- frames are ordered-in with animation so that the reordering is not
- done until the animation is complete. */
- if (SCREENREC(pScreen)->imp->DoReorderWindow) {
- if (!SCREENREC(pScreen)->imp->DoReorderWindow(winRec))
- return;
- }
-
- RootlessStopDrawing(pWin, FALSE);
-
- /* Find the next window above this one that has a mapped frame.
- * Only include cases where the windows are in the same category of
- * hittability to ensure offscreen windows dont get restacked
- * relative to onscreen ones (but that the offscreen ones maintain
- * their stacking order if they are explicitly asked to Reorder
- */
-
- newPrevW = pWin->prevSib;
- while (newPrevW && (WINREC(newPrevW) == NULL || !newPrevW->realized || newPrevW->rootlessUnhittable != pWin->rootlessUnhittable))
- newPrevW = newPrevW->prevSib;
-
- newPrev = newPrevW != NULL ? WINREC(newPrevW) : NULL;
- newPrevID = newPrev != NULL ? newPrev->wid : 0;
-
- /* If it exists, reorder the frame above us first. */
-
- if (newPrev && newPrev->is_reorder_pending) {
- newPrev->is_reorder_pending = FALSE;
- RootlessReorderWindow(newPrevW);
- }
-
- SCREENREC(pScreen)->imp->RestackFrame(winRec->wid, newPrevID);
- }
-}
-
-
-/*
- * RootlessRestackWindow
- * This is a hook for when DIX changes the window stacking order.
- * The window has already been inserted into its new position in the
- * DIX window stack. We need to change the order of the physical
- * window to match.
- */
-void
-RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib)
-{
- RegionRec saveRoot;
- RootlessWindowRec *winRec = WINREC(pWin);
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- RL_DEBUG_MSG("restackwindow start ");
- if (winRec)
- RL_DEBUG_MSG("restack top level \n");
-
- HUGE_ROOT(pWin);
- SCREEN_UNWRAP(pScreen, RestackWindow);
-
- if (pScreen->RestackWindow)
- pScreen->RestackWindow(pWin, pOldNextSib);
-
- SCREEN_WRAP(pScreen, RestackWindow);
- NORMAL_ROOT(pWin);
-
- if (winRec && pWin->viewable) {
- RootlessReorderWindow(pWin);
- }
-
- RL_DEBUG_MSG("restackwindow end\n");
-}
-
-/*
- * Specialized window copy procedures
- */
-
-// Globals needed during window resize and move.
-static pointer gResizeDeathBits = NULL;
-static int gResizeDeathCount = 0;
-static PixmapPtr gResizeDeathPix[2] = {NULL, NULL};
-static BoxRec gResizeDeathBounds[2];
-static CopyWindowProcPtr gResizeOldCopyWindowProc = NULL;
-
-/*
- * RootlessNoCopyWindow
- * CopyWindow() that doesn't do anything. For MoveWindow() of
- * top-level windows.
- */
-static void
-RootlessNoCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
-{
- // some code expects the region to be translated
- int dx = ptOldOrg.x - pWin->drawable.x;
- int dy = ptOldOrg.y - pWin->drawable.y;
-
- RL_DEBUG_MSG("ROOTLESSNOCOPYWINDOW ");
-
- RegionTranslate(prgnSrc, -dx, -dy);
-}
-
-
-/*
- * RootlessResizeCopyWindow
- * CopyWindow used during ResizeWindow for gravity moves. Based on
- * fbCopyWindow. The original always draws on the root pixmap, which
- * we don't have. Instead, draw on the parent window's pixmap.
- * Resize version: the old location's pixels are in gResizeCopyWindowSource.
- */
-static void
-RootlessResizeCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RegionRec rgnDst;
- int dx, dy;
-
- RL_DEBUG_MSG("resizecopywindowFB start (win 0x%x) ", pWin);
-
- /* Don't unwrap pScreen->CopyWindow.
- The bogus rewrap with RootlessCopyWindow causes a crash if
- CopyWindow is called again during the same resize. */
-
- if (gResizeDeathCount == 0)
- return;
-
- RootlessStartDrawing(pWin);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- RegionTranslate(prgnSrc, -dx, -dy);
- RegionNull(&rgnDst);
- RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
-
- if (gResizeDeathCount == 1) {
- /* Simple case, we only have a single source pixmap. */
-
- miCopyRegion(&gResizeDeathPix[0]->drawable,
- &pScreen->GetWindowPixmap(pWin)->drawable, 0,
- &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
- }
- else {
- int i;
- RegionRec clip, clipped;
-
- /* More complex case, N source pixmaps (usually two). So we
- intersect the destination with each source and copy those bits. */
-
- for (i = 0; i < gResizeDeathCount; i++) {
- RegionInit(&clip, gResizeDeathBounds + 0, 1);
- RegionNull(&clipped);
- RegionIntersect(&rgnDst, &clip, &clipped);
-
- miCopyRegion(&gResizeDeathPix[i]->drawable,
- &pScreen->GetWindowPixmap(pWin)->drawable, 0,
- &clipped, dx, dy, fbCopyWindowProc, 0, 0);
-
- RegionUninit(&clipped);
- RegionUninit(&clip);
- }
- }
-
- /* Don't update - resize will update everything */
- RegionUninit(&rgnDst);
-
- fbValidateDrawable(&pWin->drawable);
-
- RL_DEBUG_MSG("resizecopywindowFB end\n");
-}
-
-
-/*
- * RootlessCopyWindow
- * Update *new* location of window. Old location is redrawn with
- * miPaintWindow. Cloned from fbCopyWindow.
- * The original always draws on the root pixmap, which we don't have.
- * Instead, draw on the parent window's pixmap.
- */
-void
-RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RegionRec rgnDst;
- int dx, dy;
- BoxPtr extents;
- int area;
-
- RL_DEBUG_MSG("copywindowFB start (win 0x%x) ", pWin);
-
- SCREEN_UNWRAP(pScreen, CopyWindow);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- RegionTranslate(prgnSrc, -dx, -dy);
-
- RegionNull(&rgnDst);
- RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
-
- extents = RegionExtents(&rgnDst);
- area = (extents->x2 - extents->x1) * (extents->y2 - extents->y1);
-
- /* If the area exceeds threshold, use the implementation's
- accelerated version. */
- if (area > rootless_CopyWindow_threshold &&
- SCREENREC(pScreen)->imp->CopyWindow)
- {
- RootlessWindowRec *winRec;
- WindowPtr top;
-
- top = TopLevelParent(pWin);
- if (top == NULL) {
- RL_DEBUG_MSG("no parent\n");
- goto out;
- }
-
- winRec = WINREC(top);
- if (winRec == NULL) {
- RL_DEBUG_MSG("not framed\n");
- goto out;
- }
-
- /* Move region to window local coords */
- RegionTranslate(&rgnDst, -winRec->x, -winRec->y);
-
- RootlessStopDrawing(pWin, FALSE);
-
- SCREENREC(pScreen)->imp->CopyWindow(winRec->wid,
- RegionNumRects(&rgnDst),
- RegionRects(&rgnDst),
- dx, dy);
- }
- else {
- RootlessStartDrawing(pWin);
-
- miCopyRegion((DrawablePtr) pWin, (DrawablePtr) pWin,
- 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
-
- /* prgnSrc has been translated to dst position */
- RootlessDamageRegion(pWin, prgnSrc);
- }
-
-out:
- RegionUninit(&rgnDst);
- fbValidateDrawable(&pWin->drawable);
-
- SCREEN_WRAP(pScreen, CopyWindow);
-
- RL_DEBUG_MSG("copywindowFB end\n");
-}
-
-
-/*
- * Window resize procedures
- */
-
-enum {
- WIDTH_SMALLER = 1,
- HEIGHT_SMALLER = 2,
-};
-
-
-/*
- * ResizeWeighting
- * Choose gravity to avoid local copies. Do that by looking for
- * a corner that doesn't move _relative to the screen_.
- */
-static inline unsigned int
-ResizeWeighting(int oldX1, int oldY1, int oldX2, int oldY2, int oldBW,
- int newX1, int newY1, int newX2, int newY2, int newBW)
-{
-#ifdef ROOTLESS_RESIZE_GRAVITY
- if (newBW != oldBW)
- return RL_GRAVITY_NONE;
-
- if (newX1 == oldX1 && newY1 == oldY1)
- return RL_GRAVITY_NORTH_WEST;
- else if (newX1 == oldX1 && newY2 == oldY2)
- return RL_GRAVITY_SOUTH_WEST;
- else if (newX2 == oldX2 && newY2 == oldY2)
- return RL_GRAVITY_SOUTH_EAST;
- else if (newX2 == oldX2 && newY1 == oldY1)
- return RL_GRAVITY_NORTH_EAST;
- else
- return RL_GRAVITY_NONE;
-#else
- return RL_GRAVITY_NONE;
-#endif
-}
-
-
-/*
- * StartFrameResize
- * Prepare to resize a top-level window. The old window's pixels are
- * saved and the implementation is told to change the window size.
- * (x,y,w,h) is outer frame of window (outside border)
- */
-static Bool
-StartFrameResize(WindowPtr pWin, Bool gravity,
- int oldX, int oldY, int oldW, int oldH, int oldBW,
- int newX, int newY, int newW, int newH, int newBW)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RootlessWindowRec *winRec = WINREC(pWin);
- Bool need_window_source = FALSE, resize_after = FALSE;
-
- BoxRec rect;
- int oldX2, newX2;
- int oldY2, newY2;
- unsigned int weight;
-
- oldX2 = oldX + oldW, newX2 = newX + newW;
- oldY2 = oldY + oldH, newY2 = newY + newH;
-
- /* Decide which resize weighting to use */
- weight = ResizeWeighting(oldX, oldY, oldW, oldH, oldBW,
- newX, newY, newW, newH, newBW);
-
- /* Compute intersection between old and new rects */
- rect.x1 = max(oldX, newX);
- rect.y1 = max(oldY, newY);
- rect.x2 = min(oldX2, newX2);
- rect.y2 = min(oldY2, newY2);
-
- RL_DEBUG_MSG("RESIZE TOPLEVEL WINDOW with gravity %i ", gravity);
- RL_DEBUG_MSG("%d %d %d %d %d %d %d %d %d %d\n",
- oldX, oldY, oldW, oldH, oldBW,
- newX, newY, newW, newH, newBW);
-
- RootlessRedisplay(pWin);
-
- /* If gravity is true, then we need to have a way of recovering all
- the original bits in the window for when X rearranges the contents
- based on the various gravity settings. The obvious way is to just
- snapshot the entire backing store before resizing it, but that
- it slow on large windows.
-
- So the optimization here is to use the implementation's resize
- weighting options (if available) to allow us to reason about what
- is left in the backing store after the resize. We can then only
- copy what won't be there after the resize, and do a two-stage copy
- operation.
-
- Most of these optimizations are only applied when the top-left
- corner of the window is fixed, since that's the common case. They
- could probably be extended with some thought. */
-
- gResizeDeathCount = 0;
-
- if (gravity && weight == RL_GRAVITY_NORTH_WEST) {
- unsigned int code = 0;
-
- /* Top left corner is anchored. We never need to copy the
- entire window. */
-
- need_window_source = TRUE;
-
- /* These comparisons were chosen to avoid setting bits when the sizes
- are the same. (So the fastest case automatically gets taken when
- dimensions are unchanging.) */
-
- if (newW < oldW)
- code |= WIDTH_SMALLER;
- if (newH < oldH)
- code |= HEIGHT_SMALLER;
-
- if (((code ^ (code >> 1)) & 1) == 0) {
- /* Both dimensions are either getting larger, or both
- are getting smaller. No need to copy anything. */
-
- if (code == (WIDTH_SMALLER | HEIGHT_SMALLER)) {
- /* Since the window is getting smaller, we can do gravity
- repair on it with it's current size, then resize it
- afterwards. */
-
- resize_after = TRUE;
- }
-
- gResizeDeathCount = 1;
- }
- else {
- unsigned int copy_rowbytes, Bpp;
- unsigned int copy_rect_width, copy_rect_height;
- BoxRec copy_rect;
-
- /* We can get away with a partial copy. 'rect' is the
- intersection between old and new bounds, so copy
- everything to the right of or below the intersection. */
-
- RootlessStartDrawing(pWin);
-
- if (code == WIDTH_SMALLER) {
- copy_rect.x1 = rect.x2;
- copy_rect.y1 = rect.y1;
- copy_rect.x2 = oldX2;
- copy_rect.y2 = oldY2;
- }
- else if (code == HEIGHT_SMALLER) {
- copy_rect.x1 = rect.x1;
- copy_rect.y1 = rect.y2;
- copy_rect.x2 = oldX2;
- copy_rect.y2 = oldY2;
- }
- else
- OsAbort();
-
- Bpp = winRec->win->drawable.bitsPerPixel / 8;
- copy_rect_width = copy_rect.x2 - copy_rect.x1;
- copy_rect_height = copy_rect.y2 - copy_rect.y1;
- copy_rowbytes = ((copy_rect_width * Bpp) + 31) & ~31;
- gResizeDeathBits = malloc(copy_rowbytes
- * copy_rect_height);
-
- if (copy_rect_width * copy_rect_height >
- rootless_CopyBytes_threshold &&
- SCREENREC(pScreen)->imp->CopyBytes)
- {
- SCREENREC(pScreen)->imp->CopyBytes(
- copy_rect_width * Bpp, copy_rect_height,
- ((char *) winRec->pixelData)
- + ((copy_rect.y1 - oldY) * winRec->bytesPerRow)
- + (copy_rect.x1 - oldX) * Bpp, winRec->bytesPerRow,
- gResizeDeathBits, copy_rowbytes);
- } else {
- fbBlt((FbBits *) (winRec->pixelData
- + ((copy_rect.y1 - oldY) * winRec->bytesPerRow)
- + (copy_rect.x1 - oldX) * Bpp),
- winRec->bytesPerRow / sizeof(FbBits), 0,
- (FbBits *) gResizeDeathBits,
- copy_rowbytes / sizeof(FbBits), 0,
- copy_rect_width * Bpp, copy_rect_height,
- GXcopy, FB_ALLONES, Bpp, 0, 0);
- }
-
- gResizeDeathBounds[1] = copy_rect;
- gResizeDeathPix[1]
- = GetScratchPixmapHeader(pScreen, copy_rect_width,
- copy_rect_height,
- winRec->win->drawable.depth,
- winRec->win->drawable.bitsPerPixel,
- winRec->bytesPerRow,
- (void *) gResizeDeathBits);
-
- SetPixmapBaseToScreen(gResizeDeathPix[1],
- copy_rect.x1, copy_rect.y1);
-
- gResizeDeathCount = 2;
- }
- }
- else if (gravity) {
- /* The general case. Just copy everything. */
- BoxRec tmpBoxRec={oldX, oldY, oldX2, oldY2};
-
- RootlessStartDrawing(pWin);
-
- gResizeDeathBits = malloc(winRec->bytesPerRow * winRec->height);
-
- memcpy(gResizeDeathBits, winRec->pixelData,
- winRec->bytesPerRow * winRec->height);
-
- gResizeDeathBounds[0] = tmpBoxRec;
- gResizeDeathPix[0]
- = GetScratchPixmapHeader(pScreen, winRec->width,
- winRec->height,
- winRec->win->drawable.depth,
- winRec->win->drawable.bitsPerPixel,
- winRec->bytesPerRow,
- (void *) gResizeDeathBits);
-
- SetPixmapBaseToScreen(gResizeDeathPix[0], oldX, oldY);
- gResizeDeathCount = 1;
- }
-
- RootlessStopDrawing(pWin, FALSE);
-
- winRec->x = newX;
- winRec->y = newY;
- winRec->width = newW;
- winRec->height = newH;
- winRec->borderWidth = newBW;
-
- /* Unless both dimensions are getting smaller, Resize the frame
- before doing gravity repair */
-
- if (!resize_after) {
- SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen,
- newX + SCREEN_TO_GLOBAL_X,
- newY + SCREEN_TO_GLOBAL_Y,
- newW, newH, weight);
- }
-
- RootlessStartDrawing(pWin);
-
- /* If necessary, create a source pixmap pointing at the current
- window bits. */
-
- if (need_window_source) {
- BoxRec tmpBoxRec={oldX, oldY, oldX2, oldY2};
- gResizeDeathBounds[0] = tmpBoxRec;
- gResizeDeathPix[0]
- = GetScratchPixmapHeader(pScreen, oldW, oldH,
- winRec->win->drawable.depth,
- winRec->win->drawable.bitsPerPixel,
- winRec->bytesPerRow, winRec->pixelData);
-
- SetPixmapBaseToScreen(gResizeDeathPix[0], oldX, oldY);
- }
-
- /* Use custom CopyWindow when moving gravity bits around
- ResizeWindow assumes the old window contents are in the same
- pixmap, but here they're in deathPix instead. */
-
- if (gravity) {
- gResizeOldCopyWindowProc = pScreen->CopyWindow;
- pScreen->CopyWindow = RootlessResizeCopyWindow;
- }
-
- /* If we can't rely on the window server preserving the bits we
- need in the position we need, copy the pixels in the
- intersection from src to dst. ResizeWindow assumes these pixels
- are already present when making gravity adjustments. pWin
- currently has new-sized pixmap but is in old position.
-
- FIXME: border width change! (?) */
-
- if (gravity && weight == RL_GRAVITY_NONE) {
- PixmapPtr src, dst;
-
- assert(gResizeDeathCount == 1);
-
- src = gResizeDeathPix[0];
- dst = pScreen->GetWindowPixmap(pWin);
-
- RL_DEBUG_MSG("Resize copy rect %d %d %d %d\n",
- rect.x1, rect.y1, rect.x2, rect.y2);
-
- /* rect is the intersection of the old location and new location */
- if (BOX_NOT_EMPTY(rect) && src != NULL && dst != NULL) {
- /* The window drawable still has the old frame position, which
- means that DST doesn't actually point at the origin of our
- physical backing store when adjusted by the drawable.x,y
- position. So sneakily adjust it temporarily while copying.. */
-
- ((PixmapPtr) dst)->devPrivate.ptr = winRec->pixelData;
- SetPixmapBaseToScreen(dst, newX, newY);
-
- fbCopyWindowProc(&src->drawable, &dst->drawable, NULL,
- &rect, 1, 0, 0, FALSE, FALSE, 0, 0);
-
- ((PixmapPtr) dst)->devPrivate.ptr = winRec->pixelData;
- SetPixmapBaseToScreen(dst, oldX, oldY);
- }
- }
-
- return resize_after;
-}
-
-
-static void
-FinishFrameResize(WindowPtr pWin, Bool gravity, int oldX, int oldY,
- unsigned int oldW, unsigned int oldH, unsigned int oldBW,
- int newX, int newY, unsigned int newW, unsigned int newH,
- unsigned int newBW, Bool resize_now)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RootlessWindowRec *winRec = WINREC(pWin);
- int i;
-
- RootlessStopDrawing(pWin, FALSE);
-
- if (resize_now) {
- unsigned int weight;
-
- /* We didn't resize anything earlier, so do it now, now that
- we've finished gravitating the bits. */
-
- weight = ResizeWeighting(oldX, oldY, oldW, oldH, oldBW,
- newX, newY, newW, newH, newBW);
-
- SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen,
- newX + SCREEN_TO_GLOBAL_X,
- newY + SCREEN_TO_GLOBAL_Y,
- newW, newH, weight);
- }
-
- /* Redraw everything. FIXME: there must be times when we don't need
- to do this. Perhaps when top-left weighting and no gravity? */
-
- RootlessDamageRect(pWin, -newBW, -newBW, newW, newH);
-
- for (i = 0; i < 2; i++) {
- if (gResizeDeathPix[i] != NULL) {
- FreeScratchPixmapHeader(gResizeDeathPix[i]);
- gResizeDeathPix[i] = NULL;
- }
- }
-
- free(gResizeDeathBits);
- gResizeDeathBits = NULL;
-
- if (gravity) {
- pScreen->CopyWindow = gResizeOldCopyWindowProc;
- }
-}
-
-
-/*
- * RootlessMoveWindow
- * If kind==VTOther, window border is resizing (and borderWidth is
- * already changed!!@#$) This case works like window resize, not move.
- */
-void
-RootlessMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
-{
- RootlessWindowRec *winRec = WINREC(pWin);
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CopyWindowProcPtr oldCopyWindowProc = NULL;
- int oldX = 0, oldY = 0, newX = 0, newY = 0;
- unsigned int oldW = 0, oldH = 0, oldBW = 0;
- unsigned int newW = 0, newH = 0, newBW = 0;
- Bool resize_after = FALSE;
- RegionRec saveRoot;
-
- RL_DEBUG_MSG("movewindow start \n");
-
- if (winRec) {
- if (kind == VTMove) {
- oldX = winRec->x;
- oldY = winRec->y;
- RootlessRedisplay(pWin);
- RootlessStartDrawing(pWin);
- } else {
- RL_DEBUG_MSG("movewindow border resizing ");
-
- oldBW = winRec->borderWidth;
- oldX = winRec->x;
- oldY = winRec->y;
- oldW = winRec->width;
- oldH = winRec->height;
-
- newBW = wBorderWidth(pWin);
- newX = x;
- newY = y;
- newW = pWin->drawable.width + 2*newBW;
- newH = pWin->drawable.height + 2*newBW;
-
- resize_after = StartFrameResize(pWin, FALSE,
- oldX, oldY, oldW, oldH, oldBW,
- newX, newY, newW, newH, newBW);
- }
- }
-
- HUGE_ROOT(pWin);
- SCREEN_UNWRAP(pScreen, MoveWindow);
-
- if (winRec) {
- oldCopyWindowProc = pScreen->CopyWindow;
- pScreen->CopyWindow = RootlessNoCopyWindow;
- }
- pScreen->MoveWindow(pWin, x, y, pSib, kind);
- if (winRec) {
- pScreen->CopyWindow = oldCopyWindowProc;
- }
-
- NORMAL_ROOT(pWin);
- SCREEN_WRAP(pScreen, MoveWindow);
-
- if (winRec) {
- if (kind == VTMove) {
- winRec->x = x;
- winRec->y = y;
- RootlessStopDrawing(pWin, FALSE);
- SCREENREC(pScreen)->imp->MoveFrame(winRec->wid, pScreen,
- x + SCREEN_TO_GLOBAL_X,
- y + SCREEN_TO_GLOBAL_Y);
- } else {
- FinishFrameResize(pWin, FALSE, oldX, oldY, oldW, oldH, oldBW,
- newX, newY, newW, newH, newBW, resize_after);
- }
- }
-
- RL_DEBUG_MSG("movewindow end\n");
-}
-
-
-/*
- * RootlessResizeWindow
- * Note: (x, y, w, h) as passed to this procedure don't match the frame
- * definition. (x,y) is corner of very outer edge, *outside* border.
- * w,h is width and height *inside* border, *ignoring* border width.
- * The rect (x, y, w, h) doesn't mean anything. (x, y, w+2*bw, h+2*bw)
- * is total rect and (x+bw, y+bw, w, h) is inner rect.
- */
-void
-RootlessResizeWindow(WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib)
-{
- RootlessWindowRec *winRec = WINREC(pWin);
- ScreenPtr pScreen = pWin->drawable.pScreen;
- int oldX = 0, oldY = 0, newX = 0, newY = 0;
- unsigned int oldW = 0, oldH = 0, oldBW = 0, newW = 0, newH = 0, newBW = 0;
- Bool resize_after = FALSE;
- RegionRec saveRoot;
-
- RL_DEBUG_MSG("resizewindow start (win 0x%x) ", pWin);
-
- if(pWin->parent) {
- if (winRec) {
- oldBW = winRec->borderWidth;
- oldX = winRec->x;
- oldY = winRec->y;
- oldW = winRec->width;
- oldH = winRec->height;
-
- newBW = oldBW;
- newX = x;
- newY = y;
- newW = w + 2*newBW;
- newH = h + 2*newBW;
-
- resize_after = StartFrameResize(pWin, TRUE,
- oldX, oldY, oldW, oldH, oldBW,
- newX, newY, newW, newH, newBW);
- }
-
- HUGE_ROOT(pWin);
- SCREEN_UNWRAP(pScreen, ResizeWindow);
- pScreen->ResizeWindow(pWin, x, y, w, h, pSib);
- SCREEN_WRAP(pScreen, ResizeWindow);
- NORMAL_ROOT(pWin);
-
- if (winRec) {
- FinishFrameResize(pWin, TRUE, oldX, oldY, oldW, oldH, oldBW,
- newX, newY, newW, newH, newBW, resize_after);
- }
- } else {
- /* Special case for resizing the root window */
- BoxRec box;
-
- pWin->drawable.x = x;
- pWin->drawable.y = y;
- pWin->drawable.width = w;
- pWin->drawable.height = h;
-
- box.x1 = x; box.y1 = y;
- box.x2 = x + w; box.y2 = y + h;
- RegionUninit(&pWin->winSize);
- RegionInit(&pWin->winSize, &box, 1);
- RegionCopy(&pWin->borderSize, &pWin->winSize);
- RegionCopy(&pWin->clipList, &pWin->winSize);
- RegionCopy(&pWin->borderClip, &pWin->winSize);
-
- if (winRec) {
- SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen,
- x + SCREEN_TO_GLOBAL_X,
- y + SCREEN_TO_GLOBAL_Y,
- w, h, RL_GRAVITY_NONE);
- }
-
- miSendExposures(pWin, &pWin->borderClip,
- pWin->drawable.x, pWin->drawable.y);
- }
-
- RL_DEBUG_MSG("resizewindow end\n");
-}
-
-
-/*
- * RootlessRepositionWindow
- * Called by the implementation when a window needs to be repositioned to
- * its correct location on the screen. This routine is typically needed
- * due to changes in the underlying window system, such as a screen layout
- * change.
- */
-void
-RootlessRepositionWindow(WindowPtr pWin)
-{
- RootlessWindowRec *winRec = WINREC(pWin);
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- if (winRec == NULL)
- return;
-
- RootlessStopDrawing(pWin, FALSE);
- SCREENREC(pScreen)->imp->MoveFrame(winRec->wid, pScreen,
- winRec->x + SCREEN_TO_GLOBAL_X,
- winRec->y + SCREEN_TO_GLOBAL_Y);
-
- RootlessReorderWindow(pWin);
-}
-
-
-/*
- * RootlessReparentWindow
- * Called after a window has been reparented. Generally windows are not
- * framed until they are mapped. However, a window may be framed early by the
- * implementation calling RootlessFrameForWindow. (e.g. this could be needed
- * to attach a VRAM surface to it.) If the window is subsequently reparented
- * by the window manager before being mapped, we need to give the frame to
- * the new top-level window.
- */
-void
-RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RootlessWindowRec *winRec = WINREC(pWin);
- WindowPtr pTopWin;
-
- /* Check that window is not top-level now, but used to be. */
- if (IsRoot(pWin) || IsRoot(pWin->parent)
- || IsTopLevel(pWin) || winRec == NULL)
- {
- goto out;
- }
-
- /* If the formerly top-level window has a frame, we want to give the
- frame to its new top-level parent. If we can't do that, we'll just
- have to jettison it... */
-
- pTopWin = TopLevelParent(pWin);
- assert(pTopWin != pWin);
-
- pWin->rootlessUnhittable = FALSE;
-
- DeleteProperty (serverClient, pWin, xa_native_window_id ());
-
- if (WINREC(pTopWin) != NULL) {
- /* We're screwed. */
- RootlessDestroyFrame(pWin, winRec);
- } else {
- if (!pTopWin->realized && pWin->realized) {
- SCREENREC(pScreen)->imp->UnmapFrame(winRec->wid);
- }
-
- /* Switch the frame record from one to the other. */
-
- SETWINREC(pWin, NULL);
- SETWINREC(pTopWin, winRec);
-
- RootlessInitializeFrame(pTopWin, winRec);
- RootlessReshapeFrame(pTopWin);
-
- SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen,
- winRec->x + SCREEN_TO_GLOBAL_X,
- winRec->y + SCREEN_TO_GLOBAL_Y,
- winRec->width, winRec->height,
- RL_GRAVITY_NONE);
-
- if (SCREENREC(pScreen)->imp->SwitchWindow) {
- SCREENREC(pScreen)->imp->SwitchWindow(winRec, pWin);
- }
-
- if (pTopWin->realized && !pWin->realized)
- winRec->is_reorder_pending = TRUE;
- }
-
-out:
- if (SCREENREC(pScreen)->ReparentWindow) {
- SCREEN_UNWRAP(pScreen, ReparentWindow);
- pScreen->ReparentWindow(pWin, pPriorParent);
- SCREEN_WRAP(pScreen, ReparentWindow);
- }
-}
-
-
-void
-RootlessFlushWindowColormap (WindowPtr pWin)
-{
- RootlessWindowRec *winRec = WINREC (pWin);
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- if (winRec == NULL)
- return;
-
- RootlessStopDrawing (pWin, FALSE);
-
- if (SCREENREC(pScreen)->imp->UpdateColormap)
- SCREENREC(pScreen)->imp->UpdateColormap(winRec->wid, pScreen);
-}
-
-/*
- * RootlessChangeBorderWidth
- * FIXME: untested!
- * pWin inside corner stays the same; pWin->drawable.[xy] stays the same
- * Frame moves and resizes.
- */
-void
-RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width)
-{
- RegionRec saveRoot;
- Bool resize_after = FALSE;
-
- RL_DEBUG_MSG("change border width ");
-
- if (width != wBorderWidth(pWin)) {
- RootlessWindowRec *winRec = WINREC(pWin);
- int oldX = 0, oldY = 0, newX = 0, newY = 0;
- unsigned int oldW = 0, oldH = 0, oldBW = 0;
- unsigned int newW = 0, newH = 0, newBW = 0;
-
- if (winRec) {
- oldBW = winRec->borderWidth;
- oldX = winRec->x;
- oldY = winRec->y;
- oldW = winRec->width;
- oldH = winRec->height;
-
- newBW = width;
- newX = pWin->drawable.x - newBW;
- newY = pWin->drawable.y - newBW;
- newW = pWin->drawable.width + 2*newBW;
- newH = pWin->drawable.height + 2*newBW;
-
- resize_after = StartFrameResize(pWin, FALSE,
- oldX, oldY, oldW, oldH, oldBW,
- newX, newY, newW, newH, newBW);
- }
-
- HUGE_ROOT(pWin);
- SCREEN_UNWRAP(pWin->drawable.pScreen, ChangeBorderWidth);
- pWin->drawable.pScreen->ChangeBorderWidth(pWin, width);
- SCREEN_WRAP(pWin->drawable.pScreen, ChangeBorderWidth);
- NORMAL_ROOT(pWin);
-
- if (winRec) {
- FinishFrameResize(pWin, FALSE, oldX, oldY, oldW, oldH, oldBW,
- newX, newY, newW, newH, newBW, resize_after);
- }
- }
-
- RL_DEBUG_MSG("change border width end\n");
-}
-
-/*
- * RootlessOrderAllWindows
- * Brings all X11 windows to the top of the window stack
- * (i.e in front of Aqua windows) -- called when X11.app is given focus
- */
-void
-RootlessOrderAllWindows (Bool include_unhitable)
-{
- int i;
- WindowPtr pWin;
-
- if (windows_hidden)
- return;
-
- RL_DEBUG_MSG("RootlessOrderAllWindows() ");
- for (i = 0; i < screenInfo.numScreens; i++) {
- if (screenInfo.screens[i] == NULL) continue;
- pWin = screenInfo.screens[i]->root;
- if (pWin == NULL) continue;
-
- for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) {
- if (!pWin->realized) continue;
- if (RootlessEnsureFrame(pWin) == NULL) continue;
- if (!include_unhitable && pWin->rootlessUnhittable) continue;
- RootlessReorderWindow (pWin);
- }
- }
- RL_DEBUG_MSG("RootlessOrderAllWindows() done");
-}
-
-void
-RootlessEnableRoot (ScreenPtr pScreen)
-{
- WindowPtr pRoot;
- pRoot = pScreen->root;
-
- RootlessEnsureFrame (pRoot);
- (*pScreen->ClearToBackground) (pRoot, 0, 0, 0, 0, TRUE);
- RootlessReorderWindow (pRoot);
-}
-
-void
-RootlessDisableRoot (ScreenPtr pScreen)
-{
- WindowPtr pRoot;
- RootlessWindowRec *winRec;
-
- pRoot = pScreen->root;
- winRec = WINREC (pRoot);
-
- if (NULL == winRec)
- return;
-
- RootlessDestroyFrame (pRoot, winRec);
- DeleteProperty (serverClient, pRoot, xa_native_window_id ());
-}
-
-void
-RootlessHideAllWindows (void)
-{
- int i;
- ScreenPtr pScreen;
- WindowPtr pWin;
- RootlessWindowRec *winRec;
-
- if (windows_hidden)
- return;
-
- windows_hidden = TRUE;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- if (pScreen == NULL)
- continue;
- pWin = pScreen->root;
- if (pWin == NULL)
- continue;
-
- for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib)
- {
- if (!pWin->realized)
- continue;
-
- RootlessStopDrawing (pWin, FALSE);
-
- winRec = WINREC (pWin);
- if (winRec != NULL)
- {
- if (SCREENREC(pScreen)->imp->HideWindow)
- SCREENREC(pScreen)->imp->HideWindow(winRec->wid);
- }
- }
- }
-}
-
-void
-RootlessShowAllWindows (void)
-{
- int i;
- ScreenPtr pScreen;
- WindowPtr pWin;
- RootlessWindowRec *winRec;
-
- if (!windows_hidden)
- return;
-
- windows_hidden = FALSE;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- if (pScreen == NULL)
- continue;
- pWin = pScreen->root;
- if (pWin == NULL)
- continue;
-
- for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib)
- {
- if (!pWin->realized)
- continue;
-
- winRec = RootlessEnsureFrame (pWin);
- if (winRec == NULL)
- continue;
-
- RootlessReorderWindow (pWin);
- }
-
- RootlessScreenExpose (pScreen);
- }
-}
-
-/*
- * SetPixmapOfAncestors
- * Set the Pixmaps on all ParentRelative windows up the ancestor chain.
- */
-void
-RootlessSetPixmapOfAncestors(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- WindowPtr topWin = TopLevelParent(pWin);
- RootlessWindowRec *topWinRec = WINREC(topWin);
-
- while (pWin->backgroundState == ParentRelative) {
- if (pWin == topWin) {
- // disallow ParentRelative background state on top level
- XID pixel = 0;
- ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient);
- RL_DEBUG_MSG("Cleared ParentRelative on 0x%x.\n", pWin);
- break;
- }
-
- pWin = pWin->parent;
- pScreen->SetWindowPixmap(pWin, topWinRec->pixmap);
- }
-}
-
+/*
+ * Rootless window management
+ */
+/*
+ * Copyright (c) 2001 Greg Parker. All Rights Reserved.
+ * Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stddef.h> /* For NULL */
+#include <limits.h> /* For CHAR_BIT */
+#include <assert.h>
+#include <X11/Xatom.h>
+#ifdef __APPLE__
+#include <Xplugin.h>
+#include "mi.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+//#include <X11/extensions/applewm.h>
+extern int darwinMainScreenX, darwinMainScreenY;
+extern Bool no_configure_window;
+#endif
+#include "fb.h"
+
+#include "rootlessCommon.h"
+#include "rootlessWindow.h"
+
+#ifdef _MSC_VER
+#define inline __inline
+#include "xplugin.h"
+extern int darwinMainScreenX, darwinMainScreenY;
+#endif
+
+#define SCREEN_TO_GLOBAL_X \
+ (pScreen->x + rootlessGlobalOffsetX)
+#define SCREEN_TO_GLOBAL_Y \
+ (pScreen->y + rootlessGlobalOffsetY)
+
+#define DEFINE_ATOM_HELPER(func,atom_name) \
+ static Atom func (void) { \
+ static unsigned int generation = 0; \
+ static Atom atom; \
+ if (generation != serverGeneration) { \
+ generation = serverGeneration; \
+ atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \
+ } \
+ return atom; \
+ }
+
+DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID")
+
+static Bool windows_hidden;
+
+// TODO - abstract xp functions
+
+#ifdef __APPLE__
+
+// XXX: identical to x_cvt_vptr_to_uint ?
+#define MAKE_WINDOW_ID(x) ((xp_window_id)((size_t)(x)))
+
+void
+RootlessNativeWindowStateChanged(WindowPtr pWin, unsigned int state)
+{
+ RootlessWindowRec *winRec;
+
+ if (pWin == NULL)
+ return;
+
+ winRec = WINREC(pWin);
+ if (winRec == NULL)
+ return;
+
+ winRec->is_offscreen = ((state & XP_WINDOW_STATE_OFFSCREEN) != 0);
+ winRec->is_obscured = ((state & XP_WINDOW_STATE_OBSCURED) != 0);
+ pWin->rootlessUnhittable = winRec->is_offscreen;
+}
+
+void
+RootlessNativeWindowMoved(WindowPtr pWin)
+{
+ xp_box bounds;
+ int sx, sy, err;
+ XID vlist[2];
+ Mask mask;
+ ClientPtr pClient;
+ RootlessWindowRec *winRec;
+
+ winRec = WINREC(pWin);
+
+ if (xp_get_window_bounds(MAKE_WINDOW_ID(winRec->wid), &bounds) != Success)
+ return;
+
+ sx = pWin->drawable.pScreen->x + darwinMainScreenX;
+ sy = pWin->drawable.pScreen->y + darwinMainScreenY;
+
+ /* Fake up a ConfigureWindow packet to resize the window to the current bounds. */
+ vlist[0] = (INT16) bounds.x1 - sx;
+ vlist[1] = (INT16) bounds.y1 - sy;
+ mask = CWX | CWY;
+
+ /* pretend we're the owner of the window! */
+ err =
+ dixLookupClient(&pClient, pWin->drawable.id, serverClient,
+ DixUnknownAccess);
+ if (err != Success) {
+ ErrorF("RootlessNativeWindowMoved(): Failed to lookup window: 0x%x\n",
+ (unsigned int) pWin->drawable.id);
+ return;
+ }
+
+ /* Don't want to do anything to the physical window (avoids
+ notification-response feedback loops) */
+
+ no_configure_window = TRUE;
+ ConfigureWindow(pWin, mask, vlist, pClient);
+ no_configure_window = FALSE;
+}
+
+#endif /* __APPLE__ */
+
+/*
+ * RootlessCreateWindow
+ * For now, don't create a physical window until either the window is
+ * realized, or we really need it (e.g. to attach VRAM surfaces to).
+ * Do reset the window size so it's not clipped by the root window.
+ */
+Bool
+RootlessCreateWindow(WindowPtr pWin)
+{
+ Bool result;
+ RegionRec saveRoot;
+
+ SETWINREC(pWin, NULL);
+ dixSetPrivate(&pWin->devPrivates, rootlessWindowOldPixmapPrivateKey, NULL);
+
+ SCREEN_UNWRAP(pWin->drawable.pScreen, CreateWindow);
+
+ if (!IsRoot(pWin)) {
+ /* win/border size set by DIX, not by wrapped CreateWindow, so
+ correct it here. Don't HUGE_ROOT when pWin is the root! */
+
+ HUGE_ROOT(pWin);
+ SetWinSize(pWin);
+ SetBorderSize(pWin);
+ }
+
+ result = pWin->drawable.pScreen->CreateWindow(pWin);
+
+ if (pWin->parent) {
+ NORMAL_ROOT(pWin);
+ }
+
+ SCREEN_WRAP(pWin->drawable.pScreen, CreateWindow);
+
+ return result;
+}
+
+/*
+ * RootlessDestroyFrame
+ * Destroy the physical window associated with the given window.
+ */
+static void
+RootlessDestroyFrame(WindowPtr pWin, RootlessWindowPtr winRec)
+{
+ SCREENREC(pWin->drawable.pScreen)->imp->DestroyFrame(winRec->wid);
+ free(winRec);
+ SETWINREC(pWin, NULL);
+}
+
+/*
+ * RootlessDestroyWindow
+ * Destroy the physical window associated with the given window.
+ */
+Bool
+RootlessDestroyWindow(WindowPtr pWin)
+{
+ RootlessWindowRec *winRec = WINREC(pWin);
+ Bool result;
+
+ if (winRec != NULL) {
+ RootlessDestroyFrame(pWin, winRec);
+ }
+
+ SCREEN_UNWRAP(pWin->drawable.pScreen, DestroyWindow);
+ result = pWin->drawable.pScreen->DestroyWindow(pWin);
+ SCREEN_WRAP(pWin->drawable.pScreen, DestroyWindow);
+
+ return result;
+}
+
+static Bool
+RootlessGetShape(WindowPtr pWin, RegionPtr pShape)
+{
+ if (wBoundingShape(pWin) == NULL)
+ return FALSE;
+
+ /* wBoundingShape is relative to *inner* origin of window.
+ Translate by borderWidth to get the outside-relative position. */
+
+ RegionNull(pShape);
+ RegionCopy(pShape, wBoundingShape(pWin));
+ RegionTranslate(pShape, pWin->borderWidth, pWin->borderWidth);
+
+ return TRUE;
+}
+
+/*
+ * RootlessReshapeFrame
+ * Set the frame shape.
+ */
+static void
+RootlessReshapeFrame(WindowPtr pWin)
+{
+ RootlessWindowRec *winRec = WINREC(pWin);
+ RegionRec newShape;
+ RegionPtr pShape;
+
+ // If the window is not yet framed, do nothing
+ if (winRec == NULL)
+ return;
+
+ if (IsRoot(pWin))
+ return;
+
+ RootlessStopDrawing(pWin, FALSE);
+
+ pShape = RootlessGetShape(pWin, &newShape) ? &newShape : NULL;
+
+#ifdef ROOTLESSDEBUG
+ RL_DEBUG_MSG("reshaping...");
+ if (pShape != NULL) {
+ RL_DEBUG_MSG("numrects %d, extents %d %d %d %d ",
+ RegionNumRects(&newShape),
+ newShape.extents.x1, newShape.extents.y1,
+ newShape.extents.x2, newShape.extents.y2);
+ }
+ else {
+ RL_DEBUG_MSG("no shape ");
+ }
+#endif
+
+ SCREENREC(pWin->drawable.pScreen)->imp->ReshapeFrame(winRec->wid, pShape);
+
+ if (pShape != NULL)
+ RegionUninit(&newShape);
+}
+
+/*
+ * RootlessSetShape
+ * Shape is usually set before a window is mapped and the window will
+ * not have a frame associated with it. In this case, the frame will be
+ * shaped when the window is framed.
+ */
+void
+RootlessSetShape(WindowPtr pWin, int kind)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ SCREEN_UNWRAP(pScreen, SetShape);
+ pScreen->SetShape(pWin, kind);
+ SCREEN_WRAP(pScreen, SetShape);
+
+ RootlessReshapeFrame(pWin);
+}
+
+/* Disallow ParentRelative background on top-level windows
+ because the root window doesn't really have the right background.
+ */
+Bool
+RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask)
+{
+ Bool result;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ RL_DEBUG_MSG("change window attributes start ");
+
+ SCREEN_UNWRAP(pScreen, ChangeWindowAttributes);
+ result = pScreen->ChangeWindowAttributes(pWin, vmask);
+ SCREEN_WRAP(pScreen, ChangeWindowAttributes);
+
+ if (WINREC(pWin)) {
+ // disallow ParentRelative background state
+ if (pWin->backgroundState == ParentRelative) {
+ XID pixel = 0;
+
+ ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient);
+ }
+ }
+
+ RL_DEBUG_MSG("change window attributes end\n");
+ return result;
+}
+
+/*
+ * RootlessPositionWindow
+ * This is a hook for when DIX moves or resizes a window.
+ * Update the frame position now although the physical window is moved
+ * in RootlessMoveWindow. (x, y) are *inside* position. After this,
+ * mi and fb are expecting the pixmap to be at the new location.
+ */
+Bool
+RootlessPositionWindow(WindowPtr pWin, int x, int y)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RootlessWindowRec *winRec = WINREC(pWin);
+ Bool result;
+
+ RL_DEBUG_MSG("positionwindow start (win 0x%x @ %i, %i)\n", pWin, x, y);
+
+ if (winRec) {
+ if (winRec->is_drawing) {
+ // Reset frame's pixmap and move it to the new position.
+ int bw = wBorderWidth(pWin);
+
+ winRec->pixmap->devPrivate.ptr = winRec->pixelData;
+ SetPixmapBaseToScreen(winRec->pixmap, x - bw, y - bw);
+ }
+ }
+
+ SCREEN_UNWRAP(pScreen, PositionWindow);
+ result = pScreen->PositionWindow(pWin, x, y);
+ SCREEN_WRAP(pScreen, PositionWindow);
+
+ RL_DEBUG_MSG("positionwindow end\n");
+ return result;
+}
+
+/*
+ * RootlessInitializeFrame
+ * Initialize some basic attributes of the frame. Note that winRec
+ * may already have valid data in it, so don't overwrite anything
+ * valuable.
+ */
+static void
+RootlessInitializeFrame(WindowPtr pWin, RootlessWindowRec * winRec)
+{
+ DrawablePtr d = &pWin->drawable;
+ int bw = wBorderWidth(pWin);
+
+ winRec->win = pWin;
+
+ winRec->x = d->x - bw;
+ winRec->y = d->y - bw;
+ winRec->width = d->width + 2 * bw;
+ winRec->height = d->height + 2 * bw;
+ winRec->borderWidth = bw;
+}
+
+/*
+ * RootlessEnsureFrame
+ * Make sure the given window is framed. If the window doesn't have a
+ * physical window associated with it, attempt to create one. If that
+ * is unsuccessful, return NULL.
+ */
+static RootlessWindowRec *
+RootlessEnsureFrame(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RootlessWindowRec *winRec;
+ RegionRec shape;
+ RegionPtr pShape = NULL;
+
+ if (WINREC(pWin) != NULL)
+ return WINREC(pWin);
+
+ if (!IsTopLevel(pWin) && !IsRoot(pWin))
+ return NULL;
+
+ if (pWin->drawable.class != InputOutput)
+ return NULL;
+
+ winRec = malloc(sizeof(RootlessWindowRec));
+
+ if (!winRec)
+ return NULL;
+
+ RootlessInitializeFrame(pWin, winRec);
+
+ winRec->is_drawing = FALSE;
+ winRec->is_reorder_pending = FALSE;
+ winRec->pixmap = NULL;
+ winRec->wid = NULL;
+ winRec->level = 0;
+
+ SETWINREC(pWin, winRec);
+
+ // Set the frame's shape if the window is shaped
+ if (RootlessGetShape(pWin, &shape))
+ pShape = &shape;
+
+ RL_DEBUG_MSG("creating frame ");
+
+ if (!SCREENREC(pScreen)->imp->CreateFrame(winRec, pScreen,
+ winRec->x + SCREEN_TO_GLOBAL_X,
+ winRec->y + SCREEN_TO_GLOBAL_Y,
+ pShape)) {
+ RL_DEBUG_MSG("implementation failed to create frame!\n");
+ free(winRec);
+ SETWINREC(pWin, NULL);
+ return NULL;
+ }
+
+ if (pWin->drawable.depth == 8)
+ RootlessFlushWindowColormap(pWin);
+
+ if (pShape != NULL)
+ RegionUninit(&shape);
+
+ return winRec;
+}
+
+/*
+ * RootlessRealizeWindow
+ * The frame is usually created here and not in CreateWindow so that
+ * windows do not eat memory until they are realized.
+ */
+Bool
+RootlessRealizeWindow(WindowPtr pWin)
+{
+ Bool result;
+ RegionRec saveRoot;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ RL_DEBUG_MSG("realizewindow start (win 0x%x) ", pWin);
+
+ if ((IsTopLevel(pWin) && pWin->drawable.class == InputOutput)) {
+ RootlessWindowRec *winRec;
+
+ winRec = RootlessEnsureFrame(pWin);
+ if (winRec == NULL)
+ return FALSE;
+
+ winRec->is_reorder_pending = TRUE;
+
+ RL_DEBUG_MSG("Top level window ");
+
+ // Disallow ParentRelative background state on top-level windows.
+ // This might have been set before the window was mapped.
+ if (pWin->backgroundState == ParentRelative) {
+ XID pixel = 0;
+
+ ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient);
+ }
+ }
+
+ if (!IsRoot(pWin))
+ HUGE_ROOT(pWin);
+ SCREEN_UNWRAP(pScreen, RealizeWindow);
+ result = pScreen->RealizeWindow(pWin);
+ SCREEN_WRAP(pScreen, RealizeWindow);
+ if (!IsRoot(pWin))
+ NORMAL_ROOT(pWin);
+
+ RL_DEBUG_MSG("realizewindow end\n");
+ return result;
+}
+
+/*
+ * RootlessFrameForWindow
+ * Returns the frame ID for the physical window displaying the given window.
+ * If CREATE is true and the window has no frame, attempt to create one.
+ */
+RootlessFrameID
+RootlessFrameForWindow(WindowPtr pWin, Bool create)
+{
+ WindowPtr pTopWin;
+ RootlessWindowRec *winRec;
+
+ pTopWin = TopLevelParent(pWin);
+ if (pTopWin == NULL)
+ return NULL;
+
+ winRec = WINREC(pTopWin);
+
+ if (winRec == NULL && create && pWin->drawable.class == InputOutput) {
+ winRec = RootlessEnsureFrame(pTopWin);
+ }
+
+ if (winRec == NULL)
+ return NULL;
+
+ return winRec->wid;
+}
+
+/*
+ * RootlessUnrealizeWindow
+ * Unmap the physical window.
+ */
+Bool
+RootlessUnrealizeWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RootlessWindowRec *winRec = WINREC(pWin);
+ Bool result;
+
+ RL_DEBUG_MSG("unrealizewindow start ");
+
+ if (winRec) {
+ RootlessStopDrawing(pWin, FALSE);
+
+ SCREENREC(pScreen)->imp->UnmapFrame(winRec->wid);
+
+ winRec->is_reorder_pending = FALSE;
+ }
+
+ SCREEN_UNWRAP(pScreen, UnrealizeWindow);
+ result = pScreen->UnrealizeWindow(pWin);
+ SCREEN_WRAP(pScreen, UnrealizeWindow);
+
+ RL_DEBUG_MSG("unrealizewindow end\n");
+ return result;
+}
+
+/*
+ * RootlessReorderWindow
+ * Reorder the frame associated with the given window so that it's
+ * physically above the window below it in the X stacking order.
+ */
+void
+RootlessReorderWindow(WindowPtr pWin)
+{
+ RootlessWindowRec *winRec = WINREC(pWin);
+
+ if (pWin->realized && winRec != NULL && !winRec->is_reorder_pending &&
+ !windows_hidden) {
+ WindowPtr newPrevW;
+ RootlessWindowRec *newPrev;
+ RootlessFrameID newPrevID;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ /* Check if the implementation wants the frame to not be reordered
+ even though the X11 window is restacked. This can be useful if
+ frames are ordered-in with animation so that the reordering is not
+ done until the animation is complete. */
+ if (SCREENREC(pScreen)->imp->DoReorderWindow) {
+ if (!SCREENREC(pScreen)->imp->DoReorderWindow(winRec))
+ return;
+ }
+
+ RootlessStopDrawing(pWin, FALSE);
+
+ /* Find the next window above this one that has a mapped frame.
+ * Only include cases where the windows are in the same category of
+ * hittability to ensure offscreen windows dont get restacked
+ * relative to onscreen ones (but that the offscreen ones maintain
+ * their stacking order if they are explicitly asked to Reorder
+ */
+
+ newPrevW = pWin->prevSib;
+ while (newPrevW &&
+ (WINREC(newPrevW) == NULL || !newPrevW->realized ||
+ newPrevW->rootlessUnhittable != pWin->rootlessUnhittable))
+ newPrevW = newPrevW->prevSib;
+
+ newPrev = newPrevW != NULL ? WINREC(newPrevW) : NULL;
+ newPrevID = newPrev != NULL ? newPrev->wid : 0;
+
+ /* If it exists, reorder the frame above us first. */
+
+ if (newPrev && newPrev->is_reorder_pending) {
+ newPrev->is_reorder_pending = FALSE;
+ RootlessReorderWindow(newPrevW);
+ }
+
+ SCREENREC(pScreen)->imp->RestackFrame(winRec->wid, newPrevID);
+ }
+}
+
+/*
+ * RootlessRestackWindow
+ * This is a hook for when DIX changes the window stacking order.
+ * The window has already been inserted into its new position in the
+ * DIX window stack. We need to change the order of the physical
+ * window to match.
+ */
+void
+RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib)
+{
+ RegionRec saveRoot;
+ RootlessWindowRec *winRec = WINREC(pWin);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ RL_DEBUG_MSG("restackwindow start ");
+ if (winRec)
+ RL_DEBUG_MSG("restack top level \n");
+
+ HUGE_ROOT(pWin);
+ SCREEN_UNWRAP(pScreen, RestackWindow);
+
+ if (pScreen->RestackWindow)
+ pScreen->RestackWindow(pWin, pOldNextSib);
+
+ SCREEN_WRAP(pScreen, RestackWindow);
+ NORMAL_ROOT(pWin);
+
+ if (winRec && pWin->viewable) {
+ RootlessReorderWindow(pWin);
+ }
+
+ RL_DEBUG_MSG("restackwindow end\n");
+}
+
+/*
+ * Specialized window copy procedures
+ */
+
+// Globals needed during window resize and move.
+static pointer gResizeDeathBits = NULL;
+static int gResizeDeathCount = 0;
+static PixmapPtr gResizeDeathPix[2] = { NULL, NULL };
+
+static BoxRec gResizeDeathBounds[2];
+static CopyWindowProcPtr gResizeOldCopyWindowProc = NULL;
+
+/*
+ * RootlessNoCopyWindow
+ * CopyWindow() that doesn't do anything. For MoveWindow() of
+ * top-level windows.
+ */
+static void
+RootlessNoCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ // some code expects the region to be translated
+ int dx = ptOldOrg.x - pWin->drawable.x;
+ int dy = ptOldOrg.y - pWin->drawable.y;
+
+ RL_DEBUG_MSG("ROOTLESSNOCOPYWINDOW ");
+
+ RegionTranslate(prgnSrc, -dx, -dy);
+}
+
+/*
+ * RootlessResizeCopyWindow
+ * CopyWindow used during ResizeWindow for gravity moves. Based on
+ * fbCopyWindow. The original always draws on the root pixmap, which
+ * we don't have. Instead, draw on the parent window's pixmap.
+ * Resize version: the old location's pixels are in gResizeCopyWindowSource.
+ */
+static void
+RootlessResizeCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RegionRec rgnDst;
+ int dx, dy;
+
+ RL_DEBUG_MSG("resizecopywindowFB start (win 0x%x) ", pWin);
+
+ /* Don't unwrap pScreen->CopyWindow.
+ The bogus rewrap with RootlessCopyWindow causes a crash if
+ CopyWindow is called again during the same resize. */
+
+ if (gResizeDeathCount == 0)
+ return;
+
+ RootlessStartDrawing(pWin);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ RegionTranslate(prgnSrc, -dx, -dy);
+ RegionNull(&rgnDst);
+ RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
+
+ if (gResizeDeathCount == 1) {
+ /* Simple case, we only have a single source pixmap. */
+
+ miCopyRegion(&gResizeDeathPix[0]->drawable,
+ &pScreen->GetWindowPixmap(pWin)->drawable, 0,
+ &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
+ }
+ else {
+ int i;
+ RegionRec clip, clipped;
+
+ /* More complex case, N source pixmaps (usually two). So we
+ intersect the destination with each source and copy those bits. */
+
+ for (i = 0; i < gResizeDeathCount; i++) {
+ RegionInit(&clip, gResizeDeathBounds + 0, 1);
+ RegionNull(&clipped);
+ RegionIntersect(&rgnDst, &clip, &clipped);
+
+ miCopyRegion(&gResizeDeathPix[i]->drawable,
+ &pScreen->GetWindowPixmap(pWin)->drawable, 0,
+ &clipped, dx, dy, fbCopyWindowProc, 0, 0);
+
+ RegionUninit(&clipped);
+ RegionUninit(&clip);
+ }
+ }
+
+ /* Don't update - resize will update everything */
+ RegionUninit(&rgnDst);
+
+ fbValidateDrawable(&pWin->drawable);
+
+ RL_DEBUG_MSG("resizecopywindowFB end\n");
+}
+
+/*
+ * RootlessCopyWindow
+ * Update *new* location of window. Old location is redrawn with
+ * miPaintWindow. Cloned from fbCopyWindow.
+ * The original always draws on the root pixmap, which we don't have.
+ * Instead, draw on the parent window's pixmap.
+ */
+void
+RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RegionRec rgnDst;
+ int dx, dy;
+ BoxPtr extents;
+ int area;
+
+ RL_DEBUG_MSG("copywindowFB start (win 0x%x) ", pWin);
+
+ SCREEN_UNWRAP(pScreen, CopyWindow);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ RegionTranslate(prgnSrc, -dx, -dy);
+
+ RegionNull(&rgnDst);
+ RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
+
+ extents = RegionExtents(&rgnDst);
+ area = (extents->x2 - extents->x1) * (extents->y2 - extents->y1);
+
+ /* If the area exceeds threshold, use the implementation's
+ accelerated version. */
+ if (area > rootless_CopyWindow_threshold &&
+ SCREENREC(pScreen)->imp->CopyWindow) {
+ RootlessWindowRec *winRec;
+ WindowPtr top;
+
+ top = TopLevelParent(pWin);
+ if (top == NULL) {
+ RL_DEBUG_MSG("no parent\n");
+ goto out;
+ }
+
+ winRec = WINREC(top);
+ if (winRec == NULL) {
+ RL_DEBUG_MSG("not framed\n");
+ goto out;
+ }
+
+ /* Move region to window local coords */
+ RegionTranslate(&rgnDst, -winRec->x, -winRec->y);
+
+ RootlessStopDrawing(pWin, FALSE);
+
+ SCREENREC(pScreen)->imp->CopyWindow(winRec->wid,
+ RegionNumRects(&rgnDst),
+ RegionRects(&rgnDst), dx, dy);
+ }
+ else {
+ RootlessStartDrawing(pWin);
+
+ miCopyRegion((DrawablePtr) pWin, (DrawablePtr) pWin,
+ 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
+
+ /* prgnSrc has been translated to dst position */
+ RootlessDamageRegion(pWin, prgnSrc);
+ }
+
+ out:
+ RegionUninit(&rgnDst);
+ fbValidateDrawable(&pWin->drawable);
+
+ SCREEN_WRAP(pScreen, CopyWindow);
+
+ RL_DEBUG_MSG("copywindowFB end\n");
+}
+
+/*
+ * Window resize procedures
+ */
+
+enum {
+ WIDTH_SMALLER = 1,
+ HEIGHT_SMALLER = 2,
+};
+
+/*
+ * ResizeWeighting
+ * Choose gravity to avoid local copies. Do that by looking for
+ * a corner that doesn't move _relative to the screen_.
+ */
+static inline unsigned int
+ResizeWeighting(int oldX1, int oldY1, int oldX2, int oldY2, int oldBW,
+ int newX1, int newY1, int newX2, int newY2, int newBW)
+{
+#ifdef ROOTLESS_RESIZE_GRAVITY
+ if (newBW != oldBW)
+ return RL_GRAVITY_NONE;
+
+ if (newX1 == oldX1 && newY1 == oldY1)
+ return RL_GRAVITY_NORTH_WEST;
+ else if (newX1 == oldX1 && newY2 == oldY2)
+ return RL_GRAVITY_SOUTH_WEST;
+ else if (newX2 == oldX2 && newY2 == oldY2)
+ return RL_GRAVITY_SOUTH_EAST;
+ else if (newX2 == oldX2 && newY1 == oldY1)
+ return RL_GRAVITY_NORTH_EAST;
+ else
+ return RL_GRAVITY_NONE;
+#else
+ return RL_GRAVITY_NONE;
+#endif
+}
+
+/*
+ * StartFrameResize
+ * Prepare to resize a top-level window. The old window's pixels are
+ * saved and the implementation is told to change the window size.
+ * (x,y,w,h) is outer frame of window (outside border)
+ */
+static Bool
+StartFrameResize(WindowPtr pWin, Bool gravity,
+ int oldX, int oldY, int oldW, int oldH, int oldBW,
+ int newX, int newY, int newW, int newH, int newBW)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RootlessWindowRec *winRec = WINREC(pWin);
+ Bool need_window_source = FALSE, resize_after = FALSE;
+
+ BoxRec rect;
+ int oldX2, newX2;
+ int oldY2, newY2;
+ unsigned int weight;
+
+ oldX2 = oldX + oldW, newX2 = newX + newW;
+ oldY2 = oldY + oldH, newY2 = newY + newH;
+
+ /* Decide which resize weighting to use */
+ weight = ResizeWeighting(oldX, oldY, oldW, oldH, oldBW,
+ newX, newY, newW, newH, newBW);
+
+ /* Compute intersection between old and new rects */
+ rect.x1 = max(oldX, newX);
+ rect.y1 = max(oldY, newY);
+ rect.x2 = min(oldX2, newX2);
+ rect.y2 = min(oldY2, newY2);
+
+ RL_DEBUG_MSG("RESIZE TOPLEVEL WINDOW with gravity %i ", gravity);
+ RL_DEBUG_MSG("%d %d %d %d %d %d %d %d %d %d\n",
+ oldX, oldY, oldW, oldH, oldBW, newX, newY, newW, newH, newBW);
+
+ RootlessRedisplay(pWin);
+
+ /* If gravity is true, then we need to have a way of recovering all
+ the original bits in the window for when X rearranges the contents
+ based on the various gravity settings. The obvious way is to just
+ snapshot the entire backing store before resizing it, but that
+ it slow on large windows.
+
+ So the optimization here is to use the implementation's resize
+ weighting options (if available) to allow us to reason about what
+ is left in the backing store after the resize. We can then only
+ copy what won't be there after the resize, and do a two-stage copy
+ operation.
+
+ Most of these optimizations are only applied when the top-left
+ corner of the window is fixed, since that's the common case. They
+ could probably be extended with some thought. */
+
+ gResizeDeathCount = 0;
+
+ if (gravity && weight == RL_GRAVITY_NORTH_WEST) {
+ unsigned int code = 0;
+
+ /* Top left corner is anchored. We never need to copy the
+ entire window. */
+
+ need_window_source = TRUE;
+
+ /* These comparisons were chosen to avoid setting bits when the sizes
+ are the same. (So the fastest case automatically gets taken when
+ dimensions are unchanging.) */
+
+ if (newW < oldW)
+ code |= WIDTH_SMALLER;
+ if (newH < oldH)
+ code |= HEIGHT_SMALLER;
+
+ if (((code ^ (code >> 1)) & 1) == 0) {
+ /* Both dimensions are either getting larger, or both
+ are getting smaller. No need to copy anything. */
+
+ if (code == (WIDTH_SMALLER | HEIGHT_SMALLER)) {
+ /* Since the window is getting smaller, we can do gravity
+ repair on it with it's current size, then resize it
+ afterwards. */
+
+ resize_after = TRUE;
+ }
+
+ gResizeDeathCount = 1;
+ }
+ else {
+ unsigned int copy_rowbytes, Bpp;
+ unsigned int copy_rect_width, copy_rect_height;
+ BoxRec copy_rect;
+
+ /* We can get away with a partial copy. 'rect' is the
+ intersection between old and new bounds, so copy
+ everything to the right of or below the intersection. */
+
+ RootlessStartDrawing(pWin);
+
+ if (code == WIDTH_SMALLER) {
+ copy_rect.x1 = rect.x2;
+ copy_rect.y1 = rect.y1;
+ copy_rect.x2 = oldX2;
+ copy_rect.y2 = oldY2;
+ }
+ else if (code == HEIGHT_SMALLER) {
+ copy_rect.x1 = rect.x1;
+ copy_rect.y1 = rect.y2;
+ copy_rect.x2 = oldX2;
+ copy_rect.y2 = oldY2;
+ }
+ else
+ OsAbort();
+
+ Bpp = winRec->win->drawable.bitsPerPixel / 8;
+ copy_rect_width = copy_rect.x2 - copy_rect.x1;
+ copy_rect_height = copy_rect.y2 - copy_rect.y1;
+ copy_rowbytes = ((copy_rect_width * Bpp) + 31) & ~31;
+ gResizeDeathBits = malloc(copy_rowbytes * copy_rect_height);
+
+ if (copy_rect_width * copy_rect_height >
+ rootless_CopyBytes_threshold &&
+ SCREENREC(pScreen)->imp->CopyBytes) {
+ SCREENREC(pScreen)->imp->CopyBytes(copy_rect_width * Bpp,
+ copy_rect_height,
+ ((char *) winRec->pixelData)
+ +
+ ((copy_rect.y1 -
+ oldY) *
+ winRec->bytesPerRow)
+ + (copy_rect.x1 -
+ oldX) * Bpp,
+ winRec->bytesPerRow,
+ gResizeDeathBits,
+ copy_rowbytes);
+ }
+ else {
+ fbBlt((FbBits *) (winRec->pixelData
+ +
+ ((copy_rect.y1 - oldY) * winRec->bytesPerRow)
+ + (copy_rect.x1 - oldX) * Bpp),
+ winRec->bytesPerRow / sizeof(FbBits), 0,
+ (FbBits *) gResizeDeathBits,
+ copy_rowbytes / sizeof(FbBits), 0, copy_rect_width * Bpp,
+ copy_rect_height, GXcopy, FB_ALLONES, Bpp, 0, 0);
+ }
+
+ gResizeDeathBounds[1] = copy_rect;
+ gResizeDeathPix[1]
+ = GetScratchPixmapHeader(pScreen, copy_rect_width,
+ copy_rect_height,
+ winRec->win->drawable.depth,
+ winRec->win->drawable.bitsPerPixel,
+ winRec->bytesPerRow,
+ (void *) gResizeDeathBits);
+
+ SetPixmapBaseToScreen(gResizeDeathPix[1],
+ copy_rect.x1, copy_rect.y1);
+
+ gResizeDeathCount = 2;
+ }
+ }
+ else if (gravity) {
+ /* The general case. Just copy everything. */
+ BoxRec tmpBoxRec={oldX, oldY, oldX2, oldY2};
+
+ RootlessStartDrawing(pWin);
+
+ gResizeDeathBits = malloc(winRec->bytesPerRow * winRec->height);
+
+ memcpy(gResizeDeathBits, winRec->pixelData,
+ winRec->bytesPerRow * winRec->height);
+
+ gResizeDeathBounds[0] = tmpBoxRec;
+ gResizeDeathPix[0]
+ = GetScratchPixmapHeader(pScreen, winRec->width,
+ winRec->height,
+ winRec->win->drawable.depth,
+ winRec->win->drawable.bitsPerPixel,
+ winRec->bytesPerRow,
+ (void *) gResizeDeathBits);
+
+ SetPixmapBaseToScreen(gResizeDeathPix[0], oldX, oldY);
+ gResizeDeathCount = 1;
+ }
+
+ RootlessStopDrawing(pWin, FALSE);
+
+ winRec->x = newX;
+ winRec->y = newY;
+ winRec->width = newW;
+ winRec->height = newH;
+ winRec->borderWidth = newBW;
+
+ /* Unless both dimensions are getting smaller, Resize the frame
+ before doing gravity repair */
+
+ if (!resize_after) {
+ SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen,
+ newX + SCREEN_TO_GLOBAL_X,
+ newY + SCREEN_TO_GLOBAL_Y,
+ newW, newH, weight);
+ }
+
+ RootlessStartDrawing(pWin);
+
+ /* If necessary, create a source pixmap pointing at the current
+ window bits. */
+
+ if (need_window_source) {
+ BoxRec tmpBoxRec={oldX, oldY, oldX2, oldY2};
+ gResizeDeathBounds[0] = tmpBoxRec;
+ gResizeDeathPix[0]
+ = GetScratchPixmapHeader(pScreen, oldW, oldH,
+ winRec->win->drawable.depth,
+ winRec->win->drawable.bitsPerPixel,
+ winRec->bytesPerRow, winRec->pixelData);
+
+ SetPixmapBaseToScreen(gResizeDeathPix[0], oldX, oldY);
+ }
+
+ /* Use custom CopyWindow when moving gravity bits around
+ ResizeWindow assumes the old window contents are in the same
+ pixmap, but here they're in deathPix instead. */
+
+ if (gravity) {
+ gResizeOldCopyWindowProc = pScreen->CopyWindow;
+ pScreen->CopyWindow = RootlessResizeCopyWindow;
+ }
+
+ /* If we can't rely on the window server preserving the bits we
+ need in the position we need, copy the pixels in the
+ intersection from src to dst. ResizeWindow assumes these pixels
+ are already present when making gravity adjustments. pWin
+ currently has new-sized pixmap but is in old position.
+
+ FIXME: border width change! (?) */
+
+ if (gravity && weight == RL_GRAVITY_NONE) {
+ PixmapPtr src, dst;
+
+ assert(gResizeDeathCount == 1);
+
+ src = gResizeDeathPix[0];
+ dst = pScreen->GetWindowPixmap(pWin);
+
+ RL_DEBUG_MSG("Resize copy rect %d %d %d %d\n",
+ rect.x1, rect.y1, rect.x2, rect.y2);
+
+ /* rect is the intersection of the old location and new location */
+ if (BOX_NOT_EMPTY(rect) && src != NULL && dst != NULL) {
+ /* The window drawable still has the old frame position, which
+ means that DST doesn't actually point at the origin of our
+ physical backing store when adjusted by the drawable.x,y
+ position. So sneakily adjust it temporarily while copying.. */
+
+ ((PixmapPtr) dst)->devPrivate.ptr = winRec->pixelData;
+ SetPixmapBaseToScreen(dst, newX, newY);
+
+ fbCopyWindowProc(&src->drawable, &dst->drawable, NULL,
+ &rect, 1, 0, 0, FALSE, FALSE, 0, 0);
+
+ ((PixmapPtr) dst)->devPrivate.ptr = winRec->pixelData;
+ SetPixmapBaseToScreen(dst, oldX, oldY);
+ }
+ }
+
+ return resize_after;
+}
+
+static void
+FinishFrameResize(WindowPtr pWin, Bool gravity, int oldX, int oldY,
+ unsigned int oldW, unsigned int oldH, unsigned int oldBW,
+ int newX, int newY, unsigned int newW, unsigned int newH,
+ unsigned int newBW, Bool resize_now)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RootlessWindowRec *winRec = WINREC(pWin);
+ int i;
+
+ RootlessStopDrawing(pWin, FALSE);
+
+ if (resize_now) {
+ unsigned int weight;
+
+ /* We didn't resize anything earlier, so do it now, now that
+ we've finished gravitating the bits. */
+
+ weight = ResizeWeighting(oldX, oldY, oldW, oldH, oldBW,
+ newX, newY, newW, newH, newBW);
+
+ SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen,
+ newX + SCREEN_TO_GLOBAL_X,
+ newY + SCREEN_TO_GLOBAL_Y,
+ newW, newH, weight);
+ }
+
+ /* Redraw everything. FIXME: there must be times when we don't need
+ to do this. Perhaps when top-left weighting and no gravity? */
+
+ RootlessDamageRect(pWin, -newBW, -newBW, newW, newH);
+
+ for (i = 0; i < 2; i++) {
+ if (gResizeDeathPix[i] != NULL) {
+ FreeScratchPixmapHeader(gResizeDeathPix[i]);
+ gResizeDeathPix[i] = NULL;
+ }
+ }
+
+ free(gResizeDeathBits);
+ gResizeDeathBits = NULL;
+
+ if (gravity) {
+ pScreen->CopyWindow = gResizeOldCopyWindowProc;
+ }
+}
+
+/*
+ * RootlessMoveWindow
+ * If kind==VTOther, window border is resizing (and borderWidth is
+ * already changed!!@#$) This case works like window resize, not move.
+ */
+void
+RootlessMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
+{
+ RootlessWindowRec *winRec = WINREC(pWin);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CopyWindowProcPtr oldCopyWindowProc = NULL;
+ int oldX = 0, oldY = 0, newX = 0, newY = 0;
+ unsigned int oldW = 0, oldH = 0, oldBW = 0;
+ unsigned int newW = 0, newH = 0, newBW = 0;
+ Bool resize_after = FALSE;
+ RegionRec saveRoot;
+
+ RL_DEBUG_MSG("movewindow start \n");
+
+ if (winRec) {
+ if (kind == VTMove) {
+ oldX = winRec->x;
+ oldY = winRec->y;
+ RootlessRedisplay(pWin);
+ RootlessStartDrawing(pWin);
+ }
+ else {
+ RL_DEBUG_MSG("movewindow border resizing ");
+
+ oldBW = winRec->borderWidth;
+ oldX = winRec->x;
+ oldY = winRec->y;
+ oldW = winRec->width;
+ oldH = winRec->height;
+
+ newBW = wBorderWidth(pWin);
+ newX = x;
+ newY = y;
+ newW = pWin->drawable.width + 2 * newBW;
+ newH = pWin->drawable.height + 2 * newBW;
+
+ resize_after = StartFrameResize(pWin, FALSE,
+ oldX, oldY, oldW, oldH, oldBW,
+ newX, newY, newW, newH, newBW);
+ }
+ }
+
+ HUGE_ROOT(pWin);
+ SCREEN_UNWRAP(pScreen, MoveWindow);
+
+ if (winRec) {
+ oldCopyWindowProc = pScreen->CopyWindow;
+ pScreen->CopyWindow = RootlessNoCopyWindow;
+ }
+ pScreen->MoveWindow(pWin, x, y, pSib, kind);
+ if (winRec) {
+ pScreen->CopyWindow = oldCopyWindowProc;
+ }
+
+ NORMAL_ROOT(pWin);
+ SCREEN_WRAP(pScreen, MoveWindow);
+
+ if (winRec) {
+ if (kind == VTMove) {
+ winRec->x = x;
+ winRec->y = y;
+ RootlessStopDrawing(pWin, FALSE);
+ SCREENREC(pScreen)->imp->MoveFrame(winRec->wid, pScreen,
+ x + SCREEN_TO_GLOBAL_X,
+ y + SCREEN_TO_GLOBAL_Y);
+ }
+ else {
+ FinishFrameResize(pWin, FALSE, oldX, oldY, oldW, oldH, oldBW,
+ newX, newY, newW, newH, newBW, resize_after);
+ }
+ }
+
+ RL_DEBUG_MSG("movewindow end\n");
+}
+
+/*
+ * RootlessResizeWindow
+ * Note: (x, y, w, h) as passed to this procedure don't match the frame
+ * definition. (x,y) is corner of very outer edge, *outside* border.
+ * w,h is width and height *inside* border, *ignoring* border width.
+ * The rect (x, y, w, h) doesn't mean anything. (x, y, w+2*bw, h+2*bw)
+ * is total rect and (x+bw, y+bw, w, h) is inner rect.
+ */
+void
+RootlessResizeWindow(WindowPtr pWin, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib)
+{
+ RootlessWindowRec *winRec = WINREC(pWin);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ int oldX = 0, oldY = 0, newX = 0, newY = 0;
+ unsigned int oldW = 0, oldH = 0, oldBW = 0, newW = 0, newH = 0, newBW = 0;
+ Bool resize_after = FALSE;
+ RegionRec saveRoot;
+
+ RL_DEBUG_MSG("resizewindow start (win 0x%x) ", pWin);
+
+ if (pWin->parent) {
+ if (winRec) {
+ oldBW = winRec->borderWidth;
+ oldX = winRec->x;
+ oldY = winRec->y;
+ oldW = winRec->width;
+ oldH = winRec->height;
+
+ newBW = oldBW;
+ newX = x;
+ newY = y;
+ newW = w + 2 * newBW;
+ newH = h + 2 * newBW;
+
+ resize_after = StartFrameResize(pWin, TRUE,
+ oldX, oldY, oldW, oldH, oldBW,
+ newX, newY, newW, newH, newBW);
+ }
+
+ HUGE_ROOT(pWin);
+ SCREEN_UNWRAP(pScreen, ResizeWindow);
+ pScreen->ResizeWindow(pWin, x, y, w, h, pSib);
+ SCREEN_WRAP(pScreen, ResizeWindow);
+ NORMAL_ROOT(pWin);
+
+ if (winRec) {
+ FinishFrameResize(pWin, TRUE, oldX, oldY, oldW, oldH, oldBW,
+ newX, newY, newW, newH, newBW, resize_after);
+ }
+ }
+ else {
+ /* Special case for resizing the root window */
+ BoxRec box;
+
+ pWin->drawable.x = x;
+ pWin->drawable.y = y;
+ pWin->drawable.width = w;
+ pWin->drawable.height = h;
+
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = x + w;
+ box.y2 = y + h;
+ RegionUninit(&pWin->winSize);
+ RegionInit(&pWin->winSize, &box, 1);
+ RegionCopy(&pWin->borderSize, &pWin->winSize);
+ RegionCopy(&pWin->clipList, &pWin->winSize);
+ RegionCopy(&pWin->borderClip, &pWin->winSize);
+
+ if (winRec) {
+ SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen,
+ x + SCREEN_TO_GLOBAL_X,
+ y + SCREEN_TO_GLOBAL_Y,
+ w, h, RL_GRAVITY_NONE);
+ }
+
+ miSendExposures(pWin, &pWin->borderClip,
+ pWin->drawable.x, pWin->drawable.y);
+ }
+
+ RL_DEBUG_MSG("resizewindow end\n");
+}
+
+/*
+ * RootlessRepositionWindow
+ * Called by the implementation when a window needs to be repositioned to
+ * its correct location on the screen. This routine is typically needed
+ * due to changes in the underlying window system, such as a screen layout
+ * change.
+ */
+void
+RootlessRepositionWindow(WindowPtr pWin)
+{
+ RootlessWindowRec *winRec = WINREC(pWin);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (winRec == NULL)
+ return;
+
+ RootlessStopDrawing(pWin, FALSE);
+ SCREENREC(pScreen)->imp->MoveFrame(winRec->wid, pScreen,
+ winRec->x + SCREEN_TO_GLOBAL_X,
+ winRec->y + SCREEN_TO_GLOBAL_Y);
+
+ RootlessReorderWindow(pWin);
+}
+
+/*
+ * RootlessReparentWindow
+ * Called after a window has been reparented. Generally windows are not
+ * framed until they are mapped. However, a window may be framed early by the
+ * implementation calling RootlessFrameForWindow. (e.g. this could be needed
+ * to attach a VRAM surface to it.) If the window is subsequently reparented
+ * by the window manager before being mapped, we need to give the frame to
+ * the new top-level window.
+ */
+void
+RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RootlessWindowRec *winRec = WINREC(pWin);
+ WindowPtr pTopWin;
+
+ /* Check that window is not top-level now, but used to be. */
+ if (IsRoot(pWin) || IsRoot(pWin->parent)
+ || IsTopLevel(pWin) || winRec == NULL) {
+ goto out;
+ }
+
+ /* If the formerly top-level window has a frame, we want to give the
+ frame to its new top-level parent. If we can't do that, we'll just
+ have to jettison it... */
+
+ pTopWin = TopLevelParent(pWin);
+ assert(pTopWin != pWin);
+
+ pWin->rootlessUnhittable = FALSE;
+
+ DeleteProperty(serverClient, pWin, xa_native_window_id());
+
+ if (WINREC(pTopWin) != NULL) {
+ /* We're screwed. */
+ RootlessDestroyFrame(pWin, winRec);
+ }
+ else {
+ if (!pTopWin->realized && pWin->realized) {
+ SCREENREC(pScreen)->imp->UnmapFrame(winRec->wid);
+ }
+
+ /* Switch the frame record from one to the other. */
+
+ SETWINREC(pWin, NULL);
+ SETWINREC(pTopWin, winRec);
+
+ RootlessInitializeFrame(pTopWin, winRec);
+ RootlessReshapeFrame(pTopWin);
+
+ SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen,
+ winRec->x + SCREEN_TO_GLOBAL_X,
+ winRec->y + SCREEN_TO_GLOBAL_Y,
+ winRec->width, winRec->height,
+ RL_GRAVITY_NONE);
+
+ if (SCREENREC(pScreen)->imp->SwitchWindow) {
+ SCREENREC(pScreen)->imp->SwitchWindow(winRec, pWin);
+ }
+
+ if (pTopWin->realized && !pWin->realized)
+ winRec->is_reorder_pending = TRUE;
+ }
+
+ out:
+ if (SCREENREC(pScreen)->ReparentWindow) {
+ SCREEN_UNWRAP(pScreen, ReparentWindow);
+ pScreen->ReparentWindow(pWin, pPriorParent);
+ SCREEN_WRAP(pScreen, ReparentWindow);
+ }
+}
+
+void
+RootlessFlushWindowColormap(WindowPtr pWin)
+{
+ RootlessWindowRec *winRec = WINREC(pWin);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (winRec == NULL)
+ return;
+
+ RootlessStopDrawing(pWin, FALSE);
+
+ if (SCREENREC(pScreen)->imp->UpdateColormap)
+ SCREENREC(pScreen)->imp->UpdateColormap(winRec->wid, pScreen);
+}
+
+/*
+ * RootlessChangeBorderWidth
+ * FIXME: untested!
+ * pWin inside corner stays the same; pWin->drawable.[xy] stays the same
+ * Frame moves and resizes.
+ */
+void
+RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width)
+{
+ RegionRec saveRoot;
+ Bool resize_after = FALSE;
+
+ RL_DEBUG_MSG("change border width ");
+
+ if (width != wBorderWidth(pWin)) {
+ RootlessWindowRec *winRec = WINREC(pWin);
+ int oldX = 0, oldY = 0, newX = 0, newY = 0;
+ unsigned int oldW = 0, oldH = 0, oldBW = 0;
+ unsigned int newW = 0, newH = 0, newBW = 0;
+
+ if (winRec) {
+ oldBW = winRec->borderWidth;
+ oldX = winRec->x;
+ oldY = winRec->y;
+ oldW = winRec->width;
+ oldH = winRec->height;
+
+ newBW = width;
+ newX = pWin->drawable.x - newBW;
+ newY = pWin->drawable.y - newBW;
+ newW = pWin->drawable.width + 2 * newBW;
+ newH = pWin->drawable.height + 2 * newBW;
+
+ resize_after = StartFrameResize(pWin, FALSE,
+ oldX, oldY, oldW, oldH, oldBW,
+ newX, newY, newW, newH, newBW);
+ }
+
+ HUGE_ROOT(pWin);
+ SCREEN_UNWRAP(pWin->drawable.pScreen, ChangeBorderWidth);
+ pWin->drawable.pScreen->ChangeBorderWidth(pWin, width);
+ SCREEN_WRAP(pWin->drawable.pScreen, ChangeBorderWidth);
+ NORMAL_ROOT(pWin);
+
+ if (winRec) {
+ FinishFrameResize(pWin, FALSE, oldX, oldY, oldW, oldH, oldBW,
+ newX, newY, newW, newH, newBW, resize_after);
+ }
+ }
+
+ RL_DEBUG_MSG("change border width end\n");
+}
+
+/*
+ * RootlessOrderAllWindows
+ * Brings all X11 windows to the top of the window stack
+ * (i.e in front of Aqua windows) -- called when X11.app is given focus
+ */
+void
+RootlessOrderAllWindows(Bool include_unhitable)
+{
+ int i;
+ WindowPtr pWin;
+
+ if (windows_hidden)
+ return;
+
+ RL_DEBUG_MSG("RootlessOrderAllWindows() ");
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ if (screenInfo.screens[i] == NULL)
+ continue;
+ pWin = screenInfo.screens[i]->root;
+ if (pWin == NULL)
+ continue;
+
+ for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) {
+ if (!pWin->realized)
+ continue;
+ if (RootlessEnsureFrame(pWin) == NULL)
+ continue;
+ if (!include_unhitable && pWin->rootlessUnhittable)
+ continue;
+ RootlessReorderWindow(pWin);
+ }
+ }
+ RL_DEBUG_MSG("RootlessOrderAllWindows() done");
+}
+
+void
+RootlessEnableRoot(ScreenPtr pScreen)
+{
+ WindowPtr pRoot;
+
+ pRoot = pScreen->root;
+
+ RootlessEnsureFrame(pRoot);
+ (*pScreen->ClearToBackground) (pRoot, 0, 0, 0, 0, TRUE);
+ RootlessReorderWindow(pRoot);
+}
+
+void
+RootlessDisableRoot(ScreenPtr pScreen)
+{
+ WindowPtr pRoot;
+ RootlessWindowRec *winRec;
+
+ pRoot = pScreen->root;
+ winRec = WINREC(pRoot);
+
+ if (NULL == winRec)
+ return;
+
+ RootlessDestroyFrame(pRoot, winRec);
+ DeleteProperty(serverClient, pRoot, xa_native_window_id());
+}
+
+void
+RootlessHideAllWindows(void)
+{
+ int i;
+ ScreenPtr pScreen;
+ WindowPtr pWin;
+ RootlessWindowRec *winRec;
+
+ if (windows_hidden)
+ return;
+
+ windows_hidden = TRUE;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if (pScreen == NULL)
+ continue;
+ pWin = pScreen->root;
+ if (pWin == NULL)
+ continue;
+
+ for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) {
+ if (!pWin->realized)
+ continue;
+
+ RootlessStopDrawing(pWin, FALSE);
+
+ winRec = WINREC(pWin);
+ if (winRec != NULL) {
+ if (SCREENREC(pScreen)->imp->HideWindow)
+ SCREENREC(pScreen)->imp->HideWindow(winRec->wid);
+ }
+ }
+ }
+}
+
+void
+RootlessShowAllWindows(void)
+{
+ int i;
+ ScreenPtr pScreen;
+ WindowPtr pWin;
+ RootlessWindowRec *winRec;
+
+ if (!windows_hidden)
+ return;
+
+ windows_hidden = FALSE;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if (pScreen == NULL)
+ continue;
+ pWin = pScreen->root;
+ if (pWin == NULL)
+ continue;
+
+ for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) {
+ if (!pWin->realized)
+ continue;
+
+ winRec = RootlessEnsureFrame(pWin);
+ if (winRec == NULL)
+ continue;
+
+ RootlessReorderWindow(pWin);
+ }
+
+ RootlessScreenExpose(pScreen);
+ }
+}
+
+/*
+ * SetPixmapOfAncestors
+ * Set the Pixmaps on all ParentRelative windows up the ancestor chain.
+ */
+void
+RootlessSetPixmapOfAncestors(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr topWin = TopLevelParent(pWin);
+ RootlessWindowRec *topWinRec = WINREC(topWin);
+
+ while (pWin->backgroundState == ParentRelative) {
+ if (pWin == topWin) {
+ // disallow ParentRelative background state on top level
+ XID pixel = 0;
+
+ ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient);
+ RL_DEBUG_MSG("Cleared ParentRelative on 0x%x.\n", pWin);
+ break;
+ }
+
+ pWin = pWin->parent;
+ pScreen->SetWindowPixmap(pWin, topWinRec->pixmap);
+ }
+}
diff --git a/xorg-server/miext/rootless/rootlessWindow.h b/xorg-server/miext/rootless/rootlessWindow.h
index 2da96e661..d3955fc89 100644
--- a/xorg-server/miext/rootless/rootlessWindow.h
+++ b/xorg-server/miext/rootless/rootlessWindow.h
@@ -1,60 +1,63 @@
-/*
- * Rootless window management
- */
-/*
- * Copyright (c) 2001 Greg Parker. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _ROOTLESSWINDOW_H
-#define _ROOTLESSWINDOW_H
-
-#include "rootlessCommon.h"
-
-Bool RootlessCreateWindow(WindowPtr pWin);
-Bool RootlessDestroyWindow(WindowPtr pWin);
-
-void RootlessSetShape(WindowPtr pWin, int kind);
-
-Bool RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask);
-Bool RootlessPositionWindow(WindowPtr pWin, int x, int y);
-Bool RootlessRealizeWindow(WindowPtr pWin);
-Bool RootlessUnrealizeWindow(WindowPtr pWin);
-void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib);
-void RootlessCopyWindow(WindowPtr pWin,DDXPointRec ptOldOrg,RegionPtr prgnSrc);
-void RootlessMoveWindow(WindowPtr pWin,int x,int y,WindowPtr pSib,VTKind kind);
-void RootlessResizeWindow(WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib);
-void RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent);
-void RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width);
-#ifdef __APPLE__
-void RootlessNativeWindowMoved (WindowPtr pWin);
-void RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state);
-#endif
-
-#endif
+/*
+ * Rootless window management
+ */
+/*
+ * Copyright (c) 2001 Greg Parker. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _ROOTLESSWINDOW_H
+#define _ROOTLESSWINDOW_H
+
+#include "rootlessCommon.h"
+
+Bool RootlessCreateWindow(WindowPtr pWin);
+Bool RootlessDestroyWindow(WindowPtr pWin);
+
+void RootlessSetShape(WindowPtr pWin, int kind);
+
+Bool RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask);
+Bool RootlessPositionWindow(WindowPtr pWin, int x, int y);
+Bool RootlessRealizeWindow(WindowPtr pWin);
+Bool RootlessUnrealizeWindow(WindowPtr pWin);
+void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib);
+void RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+void RootlessMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib,
+ VTKind kind);
+void RootlessResizeWindow(WindowPtr pWin, int x, int y, unsigned int w,
+ unsigned int h, WindowPtr pSib);
+void RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent);
+void RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width);
+
+#ifdef __APPLE__
+void RootlessNativeWindowMoved(WindowPtr pWin);
+void RootlessNativeWindowStateChanged(WindowPtr pWin, unsigned int state);
+#endif
+
+#endif
diff --git a/xorg-server/miext/shadow/shadow.c b/xorg-server/miext/shadow/shadow.c
index 95f11cd21..d2ba68497 100644
--- a/xorg-server/miext/shadow/shadow.c
+++ b/xorg-server/miext/shadow/shadow.c
@@ -37,6 +37,7 @@
#include "shadow.h"
static DevPrivateKeyRec shadowScrPrivateKeyRec;
+
#define shadowScrPrivateKey (&shadowScrPrivateKeyRec)
#define wrap(priv, real, mem) {\
@@ -55,11 +56,11 @@ shadowRedisplay(ScreenPtr pScreen)
RegionPtr pRegion;
if (!pBuf || !pBuf->pDamage || !pBuf->update)
- return;
+ return;
pRegion = DamageRegion(pBuf->pDamage);
if (RegionNotEmpty(pRegion)) {
- (*pBuf->update)(pScreen, pBuf);
- DamageEmpty(pBuf->pDamage);
+ (*pBuf->update) (pScreen, pBuf);
+ DamageEmpty(pBuf->pDamage);
}
}
@@ -78,14 +79,15 @@ shadowWakeupHandler(pointer data, int i, pointer LastSelectMask)
static void
shadowGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
- unsigned int format, unsigned long planeMask, char *pdstLine)
+ unsigned int format, unsigned long planeMask, char *pdstLine)
{
ScreenPtr pScreen = pDrawable->pScreen;
+
shadowBuf(pScreen);
/* Many apps use GetImage to sync with the visable frame buffer */
if (pDrawable->type == DRAWABLE_WINDOW)
- shadowRedisplay(pScreen);
+ shadowRedisplay(pScreen);
unwrap(pBuf, pScreen, GetImage);
pScreen->GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
wrap(pBuf, pScreen, GetImage);
@@ -103,10 +105,10 @@ shadowCloseScreen(int i, ScreenPtr pScreen)
shadowRemove(pScreen, pBuf->pPixmap);
DamageDestroy(pBuf->pDamage);
#ifdef BACKWARDS_COMPATIBILITY
- RegionUninit(&pBuf->damage); /* bc */
+ RegionUninit(&pBuf->damage); /* bc */
#endif
if (pBuf->pPixmap)
- pScreen->DestroyPixmap(pBuf->pPixmap);
+ pScreen->DestroyPixmap(pBuf->pPixmap);
free(pBuf);
return pScreen->CloseScreen(i, pScreen);
}
@@ -117,7 +119,7 @@ shadowReportFunc(DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
ScreenPtr pScreen = closure;
shadowBufPtr pBuf = (shadowBufPtr)
- dixLookupPrivate(&pScreen->devPrivates, shadowScrPrivateKey);
+ dixLookupPrivate(&pScreen->devPrivates, shadowScrPrivateKey);
/* Register the damaged region, use DamageReportNone below when we
* want to break BC below... */
@@ -137,28 +139,26 @@ shadowSetup(ScreenPtr pScreen)
shadowBufPtr pBuf;
if (!dixRegisterPrivateKey(&shadowScrPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (!DamageSetup(pScreen))
- return FALSE;
+ return FALSE;
pBuf = malloc(sizeof(shadowBufRec));
if (!pBuf)
- return FALSE;
+ return FALSE;
#ifdef BACKWARDS_COMPATIBILITY
- pBuf->pDamage = DamageCreate((DamageReportFunc)shadowReportFunc,
- (DamageDestroyFunc)NULL,
- DamageReportRawRegion,
- TRUE, pScreen, pScreen);
+ pBuf->pDamage = DamageCreate((DamageReportFunc) shadowReportFunc,
+ (DamageDestroyFunc) NULL,
+ DamageReportRawRegion, TRUE, pScreen, pScreen);
#else
- pBuf->pDamage = DamageCreate((DamageReportFunc)NULL,
- (DamageDestroyFunc)NULL,
- DamageReportNone,
- TRUE, pScreen, pScreen);
+ pBuf->pDamage = DamageCreate((DamageReportFunc) NULL,
+ (DamageDestroyFunc) NULL,
+ DamageReportNone, TRUE, pScreen, pScreen);
#endif
if (!pBuf->pDamage) {
- free(pBuf);
- return FALSE;
+ free(pBuf);
+ return FALSE;
}
wrap(pBuf, pScreen, CloseScreen);
@@ -169,7 +169,7 @@ shadowSetup(ScreenPtr pScreen)
pBuf->closure = 0;
pBuf->randr = 0;
#ifdef BACKWARDS_COMPATIBILITY
- RegionNull(&pBuf->damage); /* bc */
+ RegionNull(&pBuf->damage); /* bc */
#endif
dixSetPrivate(&pScreen->devPrivates, shadowScrPrivateKey, pBuf);
@@ -178,13 +178,13 @@ shadowSetup(ScreenPtr pScreen)
Bool
shadowAdd(ScreenPtr pScreen, PixmapPtr pPixmap, ShadowUpdateProc update,
- ShadowWindowProc window, int randr, void *closure)
+ ShadowWindowProc window, int randr, void *closure)
{
shadowBuf(pScreen);
if (!RegisterBlockAndWakeupHandlers(shadowBlockHandler, shadowWakeupHandler,
- (pointer)pScreen))
- return FALSE;
+ (pointer) pScreen))
+ return FALSE;
/*
* Map simple rotation values to bitmasks; fortunately,
@@ -192,17 +192,17 @@ shadowAdd(ScreenPtr pScreen, PixmapPtr pPixmap, ShadowUpdateProc update,
*/
switch (randr) {
case 0:
- randr = SHADOW_ROTATE_0;
- break;
+ randr = SHADOW_ROTATE_0;
+ break;
case 90:
- randr = SHADOW_ROTATE_90;
- break;
+ randr = SHADOW_ROTATE_90;
+ break;
case 180:
- randr = SHADOW_ROTATE_180;
- break;
+ randr = SHADOW_ROTATE_180;
+ break;
case 270:
- randr = SHADOW_ROTATE_270;
- break;
+ randr = SHADOW_ROTATE_270;
+ break;
}
pBuf->update = update;
pBuf->window = window;
@@ -219,31 +219,31 @@ shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap)
shadowBuf(pScreen);
if (pBuf->pPixmap) {
- DamageUnregister(&pBuf->pPixmap->drawable, pBuf->pDamage);
- pBuf->update = 0;
- pBuf->window = 0;
- pBuf->randr = 0;
- pBuf->closure = 0;
- pBuf->pPixmap = 0;
+ DamageUnregister(&pBuf->pPixmap->drawable, pBuf->pDamage);
+ pBuf->update = 0;
+ pBuf->window = 0;
+ pBuf->randr = 0;
+ pBuf->closure = 0;
+ pBuf->pPixmap = 0;
}
RemoveBlockAndWakeupHandlers(shadowBlockHandler, shadowWakeupHandler,
- (pointer) pScreen);
+ (pointer) pScreen);
}
Bool
shadowInit(ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window)
{
PixmapPtr pPixmap;
-
+
pPixmap = pScreen->CreatePixmap(pScreen, pScreen->width, pScreen->height,
- pScreen->rootDepth, 0);
+ pScreen->rootDepth, 0);
if (!pPixmap)
- return FALSE;
-
+ return FALSE;
+
if (!shadowSetup(pScreen)) {
- pScreen->DestroyPixmap(pPixmap);
- return FALSE;
+ pScreen->DestroyPixmap(pPixmap);
+ return FALSE;
}
shadowAdd(pScreen, pPixmap, update, window, SHADOW_ROTATE_0, 0);
diff --git a/xorg-server/miext/shadow/shadow.h b/xorg-server/miext/shadow/shadow.h
index f4473052d..83de22ccc 100644
--- a/xorg-server/miext/shadow/shadow.h
+++ b/xorg-server/miext/shadow/shadow.h
@@ -30,35 +30,32 @@
#include "damage.h"
#include "damagestr.h"
-typedef struct _shadowBuf *shadowBufPtr;
+typedef struct _shadowBuf *shadowBufPtr;
-typedef void (*ShadowUpdateProc) (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+typedef void (*ShadowUpdateProc) (ScreenPtr pScreen, shadowBufPtr pBuf);
#define SHADOW_WINDOW_RELOCATE 1
#define SHADOW_WINDOW_READ 2
#define SHADOW_WINDOW_WRITE 4
-typedef void *(*ShadowWindowProc) (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure);
+typedef void *(*ShadowWindowProc) (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode, CARD32 *size, void *closure);
/* BC hack: do not move the damage member. see shadow.c for explanation. */
typedef struct _shadowBuf {
- DamagePtr pDamage;
- ShadowUpdateProc update;
- ShadowWindowProc window;
- RegionRec damage;
- PixmapPtr pPixmap;
- void *closure;
- int randr;
+ DamagePtr pDamage;
+ ShadowUpdateProc update;
+ ShadowWindowProc window;
+ RegionRec damage;
+ PixmapPtr pPixmap;
+ void *closure;
+ int randr;
/* screen wrappers */
- GetImageProcPtr GetImage;
- CloseScreenProcPtr CloseScreen;
+ GetImageProcPtr GetImage;
+ CloseScreenProcPtr CloseScreen;
} shadowBufRec;
/* Match defines from randr extension */
@@ -77,105 +74,86 @@ extern _X_EXPORT DevPrivateKey shadowScrPrivateKey;
#define shadowGetBuf(pScr) ((shadowBufPtr) \
dixLookupPrivate(&(pScr)->devPrivates, shadowScrPrivateKey))
#define shadowBuf(pScr) shadowBufPtr pBuf = shadowGetBuf(pScr)
-#define shadowDamage(pBuf) DamageRegion(pBuf->pDamage)
+#define shadowDamage(pBuf) DamageRegion(pBuf->pDamage)
extern _X_EXPORT Bool
-shadowSetup (ScreenPtr pScreen);
+ shadowSetup(ScreenPtr pScreen);
extern _X_EXPORT Bool
-shadowAdd (ScreenPtr pScreen,
- PixmapPtr pPixmap,
- ShadowUpdateProc update,
- ShadowWindowProc window,
- int randr,
- void *closure);
+
+shadowAdd(ScreenPtr pScreen,
+ PixmapPtr pPixmap,
+ ShadowUpdateProc update,
+ ShadowWindowProc window, int randr, void *closure);
extern _X_EXPORT void
-shadowRemove (ScreenPtr pScreen, PixmapPtr pPixmap);
+ shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap);
extern _X_EXPORT Bool
-shadowInit (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window);
-extern _X_EXPORT void *
-shadowAlloc (int width, int height, int bpp);
+shadowInit(ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window);
+
+extern _X_EXPORT void *shadowAlloc(int width, int height, int bpp);
extern _X_EXPORT void
-shadowUpdatePacked (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdatePlanar4 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdatePlanar4(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdatePlanar4x8 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdatePlanar4x8(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotatePacked (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotatePacked(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate8_90 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate8_90(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate16_90 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate16_90(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate16_90YX (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate16_90YX(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate32_90 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate32_90(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate8_180 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate8_180(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate16_180 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate16_180(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate32_180 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate32_180(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate8_270 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate8_270(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate16_270 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate16_270(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate16_270YX (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate16_270YX(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate32_270 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate32_270(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate8 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate8(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate16 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate16(ScreenPtr pScreen, shadowBufPtr pBuf);
extern _X_EXPORT void
-shadowUpdateRotate32 (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ shadowUpdateRotate32(ScreenPtr pScreen, shadowBufPtr pBuf);
-typedef void (* shadowUpdateProc)(ScreenPtr, shadowBufPtr);
+typedef void (*shadowUpdateProc) (ScreenPtr, shadowBufPtr);
extern _X_EXPORT shadowUpdateProc shadowUpdatePackedWeak(void);
extern _X_EXPORT shadowUpdateProc shadowUpdatePlanar4Weak(void);
extern _X_EXPORT shadowUpdateProc shadowUpdatePlanar4x8Weak(void);
extern _X_EXPORT shadowUpdateProc shadowUpdateRotatePackedWeak(void);
-#endif /* _SHADOW_H_ */
+#endif /* _SHADOW_H_ */
diff --git a/xorg-server/miext/shadow/shpacked.c b/xorg-server/miext/shadow/shpacked.c
index c37dca175..d2b2e5e24 100644
--- a/xorg-server/miext/shadow/shpacked.c
+++ b/xorg-server/miext/shadow/shpacked.c
@@ -41,78 +41,76 @@
#include "fb.h"
void
-shadowUpdatePacked (ScreenPtr pScreen,
- shadowBufPtr pBuf)
+shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- RegionPtr damage = shadowDamage (pBuf);
- PixmapPtr pShadow = pBuf->pPixmap;
- int nbox = RegionNumRects (damage);
- BoxPtr pbox = RegionRects (damage);
- FbBits *shaBase, *shaLine, *sha;
- FbStride shaStride;
- int scrBase, scrLine, scr;
- int shaBpp;
- _X_UNUSED int shaXoff, shaYoff;
- int x, y, w, h, width;
- int i;
- FbBits *winBase = NULL, *win;
- CARD32 winSize;
+ RegionPtr damage = shadowDamage(pBuf);
+ PixmapPtr pShadow = pBuf->pPixmap;
+ int nbox = RegionNumRects(damage);
+ BoxPtr pbox = RegionRects(damage);
+ FbBits *shaBase, *shaLine, *sha;
+ FbStride shaStride;
+ int scrBase, scrLine, scr;
+ int shaBpp;
+ _X_UNUSED int shaXoff, shaYoff;
+ int x, y, w, h, width;
+ int i;
+ FbBits *winBase = NULL, *win;
+ CARD32 winSize;
- fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff);
- while (nbox--)
- {
- x = pbox->x1 * shaBpp;
- y = pbox->y1;
- w = (pbox->x2 - pbox->x1) * shaBpp;
- h = pbox->y2 - pbox->y1;
+ fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
+ shaYoff);
+ while (nbox--) {
+ x = pbox->x1 * shaBpp;
+ y = pbox->y1;
+ w = (pbox->x2 - pbox->x1) * shaBpp;
+ h = pbox->y2 - pbox->y1;
- scrLine = (x >> FB_SHIFT);
- shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
-
- x &= FB_MASK;
- w = (w + x + FB_MASK) >> FB_SHIFT;
-
- while (h--)
- {
- winSize = 0;
- scrBase = 0;
- width = w;
- scr = scrLine;
- sha = shaLine;
- while (width) {
- /* how much remains in this window */
- i = scrBase + winSize - scr;
- if (i <= 0 || scr < scrBase)
- {
- winBase = (FbBits *) (*pBuf->window) (pScreen,
- y,
- scr * sizeof (FbBits),
- SHADOW_WINDOW_WRITE,
- &winSize,
- pBuf->closure);
- if(!winBase)
- return;
- scrBase = scr;
- winSize /= sizeof (FbBits);
- i = winSize;
- }
- win = winBase + (scr - scrBase);
- if (i > width)
- i = width;
- width -= i;
- scr += i;
+ scrLine = (x >> FB_SHIFT);
+ shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
+
+ x &= FB_MASK;
+ w = (w + x + FB_MASK) >> FB_SHIFT;
+
+ while (h--) {
+ winSize = 0;
+ scrBase = 0;
+ width = w;
+ scr = scrLine;
+ sha = shaLine;
+ while (width) {
+ /* how much remains in this window */
+ i = scrBase + winSize - scr;
+ if (i <= 0 || scr < scrBase) {
+ winBase = (FbBits *) (*pBuf->window) (pScreen,
+ y,
+ scr * sizeof(FbBits),
+ SHADOW_WINDOW_WRITE,
+ &winSize,
+ pBuf->closure);
+ if (!winBase)
+ return;
+ scrBase = scr;
+ winSize /= sizeof(FbBits);
+ i = winSize;
+ }
+ win = winBase + (scr - scrBase);
+ if (i > width)
+ i = width;
+ width -= i;
+ scr += i;
#define PickBit(a,i) (((a) >> (i)) & 1)
- memcpy(win, sha, i * sizeof(FbBits));
- sha += i;
- }
- shaLine += shaStride;
- y++;
- }
- pbox++;
+ memcpy(win, sha, i * sizeof(FbBits));
+ sha += i;
+ }
+ shaLine += shaStride;
+ y++;
+ }
+ pbox++;
}
}
shadowUpdateProc
-shadowUpdatePackedWeak(void) {
+shadowUpdatePackedWeak(void)
+{
return shadowUpdatePacked;
}
diff --git a/xorg-server/miext/shadow/shplanar.c b/xorg-server/miext/shadow/shplanar.c
index 350405186..4f6542cb6 100644
--- a/xorg-server/miext/shadow/shplanar.c
+++ b/xorg-server/miext/shadow/shplanar.c
@@ -44,7 +44,7 @@
* 32 4-bit pixels per write
*/
-#define PL_SHIFT 7
+#define PL_SHIFT 7
#define PL_UNIT (1 << PL_SHIFT)
#define PL_MASK (PL_UNIT - 1)
@@ -87,94 +87,94 @@
#endif
void
-shadowUpdatePlanar4 (ScreenPtr pScreen,
- shadowBufPtr pBuf)
+shadowUpdatePlanar4(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- RegionPtr damage = shadowDamage (pBuf);
- PixmapPtr pShadow = pBuf->pPixmap;
- int nbox = RegionNumRects (damage);
- BoxPtr pbox = RegionRects (damage);
- CARD32 *shaBase, *shaLine, *sha;
- FbStride shaStride;
- int scrBase, scrLine, scr;
- int shaBpp;
- _X_UNUSED int shaXoff, shaYoff;
- int x, y, w, h, width;
- int i;
- CARD32 *winBase = NULL, *win;
- CARD32 winSize;
- int plane;
- CARD32 m,m5,m6;
- CARD8 s1, s2, s3, s4;
+ RegionPtr damage = shadowDamage(pBuf);
+ PixmapPtr pShadow = pBuf->pPixmap;
+ int nbox = RegionNumRects(damage);
+ BoxPtr pbox = RegionRects(damage);
+ CARD32 *shaBase, *shaLine, *sha;
+ FbStride shaStride;
+ int scrBase, scrLine, scr;
+ int shaBpp;
+ _X_UNUSED int shaXoff, shaYoff;
+ int x, y, w, h, width;
+ int i;
+ CARD32 *winBase = NULL, *win;
+ CARD32 winSize;
+ int plane;
+ CARD32 m, m5, m6;
+ CARD8 s1, s2, s3, s4;
- fbGetStipDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff);
- while (nbox--)
- {
- x = (pbox->x1) * shaBpp;
- y = (pbox->y1);
- w = (pbox->x2 - pbox->x1) * shaBpp;
- h = pbox->y2 - pbox->y1;
+ fbGetStipDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
+ shaYoff);
+ while (nbox--) {
+ x = (pbox->x1) * shaBpp;
+ y = (pbox->y1);
+ w = (pbox->x2 - pbox->x1) * shaBpp;
+ h = pbox->y2 - pbox->y1;
- w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT;
- x &= ~PL_MASK;
-
- scrLine = (x >> PL_SHIFT);
- shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
-
- while (h--)
- {
- for (plane = 0; plane < 4; plane++)
- {
- width = w;
- scr = scrLine;
- sha = shaLine;
- winSize = 0;
- scrBase = 0;
- while (width) {
- /* how much remains in this window */
- i = scrBase + winSize - scr;
- if (i <= 0 || scr < scrBase)
- {
- winBase = (CARD32 *) (*pBuf->window) (pScreen,
- y,
- (scr << 4) | (plane),
- SHADOW_WINDOW_WRITE,
- &winSize,
- pBuf->closure);
- if(!winBase)
- return;
- winSize >>= 2;
- scrBase = scr;
- i = winSize;
- }
- win = winBase + (scr - scrBase);
- if (i > width)
- i = width;
- width -= i;
- scr += i;
-
- while (i--)
- {
- GetBits(plane,0,s1);
- GetBits(plane,1,s2);
- GetBits(plane,2,s3);
- GetBits(plane,3,s4);
- *win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24);
- sha += 4;
- }
- }
- }
- shaLine += shaStride;
- y++;
- }
- pbox++;
+ w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT;
+ x &= ~PL_MASK;
+
+ scrLine = (x >> PL_SHIFT);
+ shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
+
+ while (h--) {
+ for (plane = 0; plane < 4; plane++) {
+ width = w;
+ scr = scrLine;
+ sha = shaLine;
+ winSize = 0;
+ scrBase = 0;
+ while (width) {
+ /* how much remains in this window */
+ i = scrBase + winSize - scr;
+ if (i <= 0 || scr < scrBase) {
+ winBase = (CARD32 *) (*pBuf->window) (pScreen,
+ y,
+ (scr << 4) |
+ (plane),
+ SHADOW_WINDOW_WRITE,
+ &winSize,
+ pBuf->closure);
+ if (!winBase)
+ return;
+ winSize >>= 2;
+ scrBase = scr;
+ i = winSize;
+ }
+ win = winBase + (scr - scrBase);
+ if (i > width)
+ i = width;
+ width -= i;
+ scr += i;
+
+ while (i--) {
+ GetBits(plane, 0, s1);
+ GetBits(plane, 1, s2);
+ GetBits(plane, 2, s3);
+ GetBits(plane, 3, s4);
+ *win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24);
+ sha += 4;
+ }
+ }
+ }
+ shaLine += shaStride;
+ y++;
+ }
+ pbox++;
}
}
-shadowUpdateProc shadowUpdatePlanar4Weak(void) {
+shadowUpdateProc
+shadowUpdatePlanar4Weak(void)
+{
return shadowUpdatePlanar4;
}
-shadowUpdateProc shadowUpdatePlanar4x8Weak(void) {
+shadowUpdateProc
+shadowUpdatePlanar4x8Weak(void)
+{
return shadowUpdatePlanar4x8;
}
diff --git a/xorg-server/miext/shadow/shplanar8.c b/xorg-server/miext/shadow/shplanar8.c
index d0648147a..214fa9aac 100644
--- a/xorg-server/miext/shadow/shplanar8.c
+++ b/xorg-server/miext/shadow/shplanar8.c
@@ -90,86 +90,81 @@
#endif
void
-shadowUpdatePlanar4x8 (ScreenPtr pScreen,
- shadowBufPtr pBuf)
+shadowUpdatePlanar4x8(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- RegionPtr damage = shadowDamage (pBuf);
- PixmapPtr pShadow = pBuf->pPixmap;
- int nbox = RegionNumRects (damage);
- BoxPtr pbox = RegionRects (damage);
- CARD32 *shaBase, *shaLine, *sha;
- CARD8 s1, s2, s3, s4;
- FbStride shaStride;
- int scrBase, scrLine, scr;
- int shaBpp;
- _X_UNUSED int shaXoff, shaYoff;
- int x, y, w, h, width;
- int i;
- CARD32 *winBase = NULL, *win;
- CARD32 winSize;
- int plane;
+ RegionPtr damage = shadowDamage(pBuf);
+ PixmapPtr pShadow = pBuf->pPixmap;
+ int nbox = RegionNumRects(damage);
+ BoxPtr pbox = RegionRects(damage);
+ CARD32 *shaBase, *shaLine, *sha;
+ CARD8 s1, s2, s3, s4;
+ FbStride shaStride;
+ int scrBase, scrLine, scr;
+ int shaBpp;
+ _X_UNUSED int shaXoff, shaYoff;
+ int x, y, w, h, width;
+ int i;
+ CARD32 *winBase = NULL, *win;
+ CARD32 winSize;
+ int plane;
- fbGetStipDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff);
- while (nbox--)
- {
- x = pbox->x1 * shaBpp;
- y = pbox->y1;
- w = (pbox->x2 - pbox->x1) * shaBpp;
- h = pbox->y2 - pbox->y1;
+ fbGetStipDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
+ shaYoff);
+ while (nbox--) {
+ x = pbox->x1 * shaBpp;
+ y = pbox->y1;
+ w = (pbox->x2 - pbox->x1) * shaBpp;
+ h = pbox->y2 - pbox->y1;
- w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT;
- x &= ~PL_MASK;
-
- scrLine = (x >> PL_SHIFT);
- shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
-
- while (h--)
- {
- for (plane = 0; plane < 4; plane++)
- {
- width = w;
- scr = scrLine;
- sha = shaLine;
- winSize = 0;
- scrBase = 0;
- while (width) {
- /* how much remains in this window */
- i = scrBase + winSize - scr;
- if (i <= 0 || scr < scrBase)
- {
- winBase = (CARD32 *) (*pBuf->window) (pScreen,
- y,
- (scr << 4) | (plane),
- SHADOW_WINDOW_WRITE,
- &winSize,
- pBuf->closure);
- if(!winBase)
- return;
- winSize >>= 2;
- scrBase = scr;
- i = winSize;
- }
- win = winBase + (scr - scrBase);
- if (i > width)
- i = width;
- width -= i;
- scr += i;
-
- while (i--)
- {
- GetBits(plane,0,s1);
- GetBits(plane,2,s2);
- GetBits(plane,4,s3);
- GetBits(plane,6,s4);
- *win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24);
- sha += 8;
- }
- }
- }
- shaLine += shaStride;
- y++;
- }
- pbox++;
+ w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT;
+ x &= ~PL_MASK;
+
+ scrLine = (x >> PL_SHIFT);
+ shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
+
+ while (h--) {
+ for (plane = 0; plane < 4; plane++) {
+ width = w;
+ scr = scrLine;
+ sha = shaLine;
+ winSize = 0;
+ scrBase = 0;
+ while (width) {
+ /* how much remains in this window */
+ i = scrBase + winSize - scr;
+ if (i <= 0 || scr < scrBase) {
+ winBase = (CARD32 *) (*pBuf->window) (pScreen,
+ y,
+ (scr << 4) |
+ (plane),
+ SHADOW_WINDOW_WRITE,
+ &winSize,
+ pBuf->closure);
+ if (!winBase)
+ return;
+ winSize >>= 2;
+ scrBase = scr;
+ i = winSize;
+ }
+ win = winBase + (scr - scrBase);
+ if (i > width)
+ i = width;
+ width -= i;
+ scr += i;
+
+ while (i--) {
+ GetBits(plane, 0, s1);
+ GetBits(plane, 2, s2);
+ GetBits(plane, 4, s3);
+ GetBits(plane, 6, s4);
+ *win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24);
+ sha += 8;
+ }
+ }
+ }
+ shaLine += shaStride;
+ y++;
+ }
+ pbox++;
}
}
-
diff --git a/xorg-server/miext/shadow/shrotate.c b/xorg-server/miext/shadow/shrotate.c
index 090120387..779a905d2 100644
--- a/xorg-server/miext/shadow/shrotate.c
+++ b/xorg-server/miext/shadow/shrotate.c
@@ -49,265 +49,256 @@
#define BOTTOM_TO_TOP -2
void
-shadowUpdateRotatePacked (ScreenPtr pScreen,
- shadowBufPtr pBuf)
+shadowUpdateRotatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- RegionPtr damage = shadowDamage (pBuf);
- PixmapPtr pShadow = pBuf->pPixmap;
- int nbox = RegionNumRects (damage);
- BoxPtr pbox = RegionRects (damage);
- FbBits *shaBits;
- FbStride shaStride;
- int shaBpp;
- _X_UNUSED int shaXoff, shaYoff;
- int box_x1, box_x2, box_y1, box_y2;
- int sha_x1 = 0, sha_y1 = 0;
- int scr_x1 = 0, scr_x2 = 0, scr_y1 = 0, scr_y2 = 0, scr_w, scr_h;
- int scr_x, scr_y;
- int w;
- int pixelsPerBits;
- int pixelsMask;
- FbStride shaStepOverY = 0, shaStepDownY = 0;
- FbStride shaStepOverX = 0, shaStepDownX = 0;
- FbBits *shaLine, *sha;
- int shaHeight = pShadow->drawable.height;
- int shaWidth = pShadow->drawable.width;
- FbBits shaMask;
- int shaFirstShift, shaShift;
- int o_x_dir;
- int o_y_dir;
- int x_dir;
- int y_dir;
+ RegionPtr damage = shadowDamage(pBuf);
+ PixmapPtr pShadow = pBuf->pPixmap;
+ int nbox = RegionNumRects(damage);
+ BoxPtr pbox = RegionRects(damage);
+ FbBits *shaBits;
+ FbStride shaStride;
+ int shaBpp;
+ _X_UNUSED int shaXoff, shaYoff;
+ int box_x1, box_x2, box_y1, box_y2;
+ int sha_x1 = 0, sha_y1 = 0;
+ int scr_x1 = 0, scr_x2 = 0, scr_y1 = 0, scr_y2 = 0, scr_w, scr_h;
+ int scr_x, scr_y;
+ int w;
+ int pixelsPerBits;
+ int pixelsMask;
+ FbStride shaStepOverY = 0, shaStepDownY = 0;
+ FbStride shaStepOverX = 0, shaStepDownX = 0;
+ FbBits *shaLine, *sha;
+ int shaHeight = pShadow->drawable.height;
+ int shaWidth = pShadow->drawable.width;
+ FbBits shaMask;
+ int shaFirstShift, shaShift;
+ int o_x_dir;
+ int o_y_dir;
+ int x_dir;
+ int y_dir;
- fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff);
- pixelsPerBits = (sizeof (FbBits) * 8) / shaBpp;
+ fbGetDrawable(&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff,
+ shaYoff);
+ pixelsPerBits = (sizeof(FbBits) * 8) / shaBpp;
pixelsMask = ~(pixelsPerBits - 1);
- shaMask = FbBitsMask (FB_UNIT-shaBpp, shaBpp);
+ shaMask = FbBitsMask(FB_UNIT - shaBpp, shaBpp);
/*
* Compute rotation related constants to walk the shadow
*/
o_x_dir = LEFT_TO_RIGHT;
o_y_dir = TOP_TO_BOTTOM;
if (pBuf->randr & SHADOW_REFLECT_X)
- o_x_dir = -o_x_dir;
+ o_x_dir = -o_x_dir;
if (pBuf->randr & SHADOW_REFLECT_Y)
- o_y_dir = -o_y_dir;
+ o_y_dir = -o_y_dir;
switch (pBuf->randr & (SHADOW_ROTATE_ALL)) {
- case SHADOW_ROTATE_0: /* upper left shadow -> upper left screen */
+ case SHADOW_ROTATE_0: /* upper left shadow -> upper left screen */
default:
- x_dir = o_x_dir;
- y_dir = o_y_dir;
- break;
- case SHADOW_ROTATE_90: /* upper right shadow -> upper left screen */
- x_dir = o_y_dir;
- y_dir = -o_x_dir;
- break;
- case SHADOW_ROTATE_180: /* lower right shadow -> upper left screen */
- x_dir = -o_x_dir;
- y_dir = -o_y_dir;
- break;
- case SHADOW_ROTATE_270: /* lower left shadow -> upper left screen */
- x_dir = -o_y_dir;
- y_dir = o_x_dir;
- break;
+ x_dir = o_x_dir;
+ y_dir = o_y_dir;
+ break;
+ case SHADOW_ROTATE_90: /* upper right shadow -> upper left screen */
+ x_dir = o_y_dir;
+ y_dir = -o_x_dir;
+ break;
+ case SHADOW_ROTATE_180: /* lower right shadow -> upper left screen */
+ x_dir = -o_x_dir;
+ y_dir = -o_y_dir;
+ break;
+ case SHADOW_ROTATE_270: /* lower left shadow -> upper left screen */
+ x_dir = -o_y_dir;
+ y_dir = o_x_dir;
+ break;
}
switch (x_dir) {
case LEFT_TO_RIGHT:
- shaStepOverX = shaBpp;
- shaStepOverY = 0;
- break;
+ shaStepOverX = shaBpp;
+ shaStepOverY = 0;
+ break;
case TOP_TO_BOTTOM:
- shaStepOverX = 0;
- shaStepOverY = shaStride;
- break;
+ shaStepOverX = 0;
+ shaStepOverY = shaStride;
+ break;
case RIGHT_TO_LEFT:
- shaStepOverX = -shaBpp;
- shaStepOverY = 0;
- break;
+ shaStepOverX = -shaBpp;
+ shaStepOverY = 0;
+ break;
case BOTTOM_TO_TOP:
- shaStepOverX = 0;
- shaStepOverY = -shaStride;
- break;
+ shaStepOverX = 0;
+ shaStepOverY = -shaStride;
+ break;
}
switch (y_dir) {
case TOP_TO_BOTTOM:
- shaStepDownX = 0;
- shaStepDownY = shaStride;
- break;
+ shaStepDownX = 0;
+ shaStepDownY = shaStride;
+ break;
case RIGHT_TO_LEFT:
- shaStepDownX = -shaBpp;
- shaStepDownY = 0;
- break;
+ shaStepDownX = -shaBpp;
+ shaStepDownY = 0;
+ break;
case BOTTOM_TO_TOP:
- shaStepDownX = 0;
- shaStepDownY = -shaStride;
- break;
+ shaStepDownX = 0;
+ shaStepDownY = -shaStride;
+ break;
case LEFT_TO_RIGHT:
- shaStepDownX = shaBpp;
- shaStepDownY = 0;
- break;
+ shaStepDownX = shaBpp;
+ shaStepDownY = 0;
+ break;
}
-
- while (nbox--)
- {
+
+ while (nbox--) {
box_x1 = pbox->x1;
box_y1 = pbox->y1;
box_x2 = pbox->x2;
box_y2 = pbox->y2;
pbox++;
- /*
- * Compute screen and shadow locations for this box
- */
- switch (x_dir) {
- case LEFT_TO_RIGHT:
- scr_x1 = box_x1 & pixelsMask;
- scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask;
-
- sha_x1 = scr_x1;
- break;
- case TOP_TO_BOTTOM:
- scr_x1 = box_y1 & pixelsMask;
- scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask;
+ /*
+ * Compute screen and shadow locations for this box
+ */
+ switch (x_dir) {
+ case LEFT_TO_RIGHT:
+ scr_x1 = box_x1 & pixelsMask;
+ scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask;
+
+ sha_x1 = scr_x1;
+ break;
+ case TOP_TO_BOTTOM:
+ scr_x1 = box_y1 & pixelsMask;
+ scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask;
+
+ sha_y1 = scr_x1;
+ break;
+ case RIGHT_TO_LEFT:
+ scr_x1 = (shaWidth - box_x2) & pixelsMask;
+ scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask;
+
+ sha_x1 = (shaWidth - scr_x1 - 1);
+ break;
+ case BOTTOM_TO_TOP:
+ scr_x1 = (shaHeight - box_y2) & pixelsMask;
+ scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask;
- sha_y1 = scr_x1;
- break;
- case RIGHT_TO_LEFT:
- scr_x1 = (shaWidth - box_x2) & pixelsMask;
- scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask;
+ sha_y1 = (shaHeight - scr_x1 - 1);
+ break;
+ }
+ switch (y_dir) {
+ case TOP_TO_BOTTOM:
+ scr_y1 = box_y1;
+ scr_y2 = box_y2;
- sha_x1 = (shaWidth - scr_x1 - 1);
- break;
- case BOTTOM_TO_TOP:
- scr_x1 = (shaHeight - box_y2) & pixelsMask;
- scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask;
-
- sha_y1 = (shaHeight - scr_x1 - 1);
- break;
- }
- switch (y_dir) {
- case TOP_TO_BOTTOM:
- scr_y1 = box_y1;
- scr_y2 = box_y2;
+ sha_y1 = scr_y1;
+ break;
+ case RIGHT_TO_LEFT:
+ scr_y1 = (shaWidth - box_x2);
+ scr_y2 = (shaWidth - box_x1);
- sha_y1 = scr_y1;
- break;
- case RIGHT_TO_LEFT:
- scr_y1 = (shaWidth - box_x2);
- scr_y2 = (shaWidth - box_x1);
+ sha_x1 = box_x2 - 1;
+ break;
+ case BOTTOM_TO_TOP:
+ scr_y1 = shaHeight - box_y2;
+ scr_y2 = shaHeight - box_y1;
- sha_x1 = box_x2 - 1;
- break;
- case BOTTOM_TO_TOP:
- scr_y1 = shaHeight - box_y2;
- scr_y2 = shaHeight - box_y1;
-
- sha_y1 = box_y2 - 1;
- break;
- case LEFT_TO_RIGHT:
- scr_y1 = box_x1;
- scr_y2 = box_x2;
+ sha_y1 = box_y2 - 1;
+ break;
+ case LEFT_TO_RIGHT:
+ scr_y1 = box_x1;
+ scr_y2 = box_x2;
- sha_x1 = box_x1;
- break;
- }
- scr_w = ((scr_x2 - scr_x1) * shaBpp) >> FB_SHIFT;
- scr_h = scr_y2 - scr_y1;
- scr_y = scr_y1;
+ sha_x1 = box_x1;
+ break;
+ }
+ scr_w = ((scr_x2 - scr_x1) * shaBpp) >> FB_SHIFT;
+ scr_h = scr_y2 - scr_y1;
+ scr_y = scr_y1;
- /* shift amount for first pixel on screen */
- shaFirstShift = FB_UNIT - ((sha_x1 * shaBpp) & FB_MASK) - shaBpp;
-
- /* pointer to shadow data first placed on screen */
- shaLine = (shaBits +
- sha_y1 * shaStride +
- ((sha_x1 * shaBpp) >> FB_SHIFT));
+ /* shift amount for first pixel on screen */
+ shaFirstShift = FB_UNIT - ((sha_x1 * shaBpp) & FB_MASK) - shaBpp;
- /*
- * Copy the bits, always write across the physical frame buffer
- * to take advantage of write combining.
- */
- while (scr_h--)
- {
- int p;
- FbBits bits;
- FbBits *win;
- int i;
- CARD32 winSize;
-
- sha = shaLine;
- shaShift = shaFirstShift;
- w = scr_w;
- scr_x = scr_x1 * shaBpp >> FB_SHIFT;
+ /* pointer to shadow data first placed on screen */
+ shaLine = (shaBits +
+ sha_y1 * shaStride + ((sha_x1 * shaBpp) >> FB_SHIFT));
- while (w)
- {
- /*
- * Map some of this line
- */
- win = (FbBits *) (*pBuf->window) (pScreen,
- scr_y,
- scr_x << 2,
- SHADOW_WINDOW_WRITE,
- &winSize,
- pBuf->closure);
- i = (winSize >> 2);
- if (i > w)
- i = w;
- w -= i;
- scr_x += i;
- /*
- * Copy the portion of the line mapped
- */
- while (i--)
- {
- bits = 0;
- p = pixelsPerBits;
- /*
- * Build one word of output from multiple inputs
- *
- * Note that for 90/270 rotations, this will walk
- * down the shadow hitting each scanline once.
- * This is probably not very efficient.
- */
- while (p--)
- {
- bits = FbScrLeft(bits, shaBpp);
- bits |= FbScrRight (*sha, shaShift) & shaMask;
+ /*
+ * Copy the bits, always write across the physical frame buffer
+ * to take advantage of write combining.
+ */
+ while (scr_h--) {
+ int p;
+ FbBits bits;
+ FbBits *win;
+ int i;
+ CARD32 winSize;
- shaShift -= shaStepOverX;
- if (shaShift >= FB_UNIT)
- {
- shaShift -= FB_UNIT;
- sha--;
- }
- else if (shaShift < 0)
- {
- shaShift += FB_UNIT;
- sha++;
- }
- sha += shaStepOverY;
- }
- *win++ = bits;
- }
- }
- scr_y++;
- shaFirstShift -= shaStepDownX;
- if (shaFirstShift >= FB_UNIT)
- {
- shaFirstShift -= FB_UNIT;
- shaLine--;
- }
- else if (shaFirstShift < 0)
- {
- shaFirstShift += FB_UNIT;
- shaLine++;
- }
- shaLine += shaStepDownY;
- }
+ sha = shaLine;
+ shaShift = shaFirstShift;
+ w = scr_w;
+ scr_x = scr_x1 * shaBpp >> FB_SHIFT;
+
+ while (w) {
+ /*
+ * Map some of this line
+ */
+ win = (FbBits *) (*pBuf->window) (pScreen,
+ scr_y,
+ scr_x << 2,
+ SHADOW_WINDOW_WRITE,
+ &winSize, pBuf->closure);
+ i = (winSize >> 2);
+ if (i > w)
+ i = w;
+ w -= i;
+ scr_x += i;
+ /*
+ * Copy the portion of the line mapped
+ */
+ while (i--) {
+ bits = 0;
+ p = pixelsPerBits;
+ /*
+ * Build one word of output from multiple inputs
+ *
+ * Note that for 90/270 rotations, this will walk
+ * down the shadow hitting each scanline once.
+ * This is probably not very efficient.
+ */
+ while (p--) {
+ bits = FbScrLeft(bits, shaBpp);
+ bits |= FbScrRight(*sha, shaShift) & shaMask;
+
+ shaShift -= shaStepOverX;
+ if (shaShift >= FB_UNIT) {
+ shaShift -= FB_UNIT;
+ sha--;
+ }
+ else if (shaShift < 0) {
+ shaShift += FB_UNIT;
+ sha++;
+ }
+ sha += shaStepOverY;
+ }
+ *win++ = bits;
+ }
+ }
+ scr_y++;
+ shaFirstShift -= shaStepDownX;
+ if (shaFirstShift >= FB_UNIT) {
+ shaFirstShift -= FB_UNIT;
+ shaLine--;
+ }
+ else if (shaFirstShift < 0) {
+ shaFirstShift += FB_UNIT;
+ shaLine++;
+ }
+ shaLine += shaStepDownY;
+ }
}
}
-shadowUpdateProc shadowUpdateRotatePackedWeak(void) {
+shadowUpdateProc
+shadowUpdateRotatePackedWeak(void)
+{
return shadowUpdateRotatePacked;
}
diff --git a/xorg-server/miext/shadow/shrotpack.h b/xorg-server/miext/shadow/shrotpack.h
index 16afff184..b1cb30d5c 100644
--- a/xorg-server/miext/shadow/shrotpack.h
+++ b/xorg-server/miext/shadow/shrotpack.h
@@ -94,72 +94,76 @@
#endif
void
-FUNC (ScreenPtr pScreen,
- shadowBufPtr pBuf)
+FUNC(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- RegionPtr damage = shadowDamage (pBuf);
- PixmapPtr pShadow = pBuf->pPixmap;
- int nbox = RegionNumRects (damage);
- BoxPtr pbox = RegionRects (damage);
- FbBits *shaBits;
- Data *shaBase, *shaLine, *sha;
- FbStride shaStride;
- int scrBase, scrLine, scr;
- int shaBpp;
- _X_UNUSED int shaXoff, shaYoff;
- int x, y, w, h, width;
- int i;
- Data *winBase = NULL, *win;
- CARD32 winSize;
-
- fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff);
+ RegionPtr damage = shadowDamage(pBuf);
+ PixmapPtr pShadow = pBuf->pPixmap;
+ int nbox = RegionNumRects(damage);
+ BoxPtr pbox = RegionRects(damage);
+ FbBits *shaBits;
+ Data *shaBase, *shaLine, *sha;
+ FbStride shaStride;
+ int scrBase, scrLine, scr;
+ int shaBpp;
+ _X_UNUSED int shaXoff, shaYoff;
+ int x, y, w, h, width;
+ int i;
+ Data *winBase = NULL, *win;
+ CARD32 winSize;
+
+ fbGetDrawable(&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff,
+ shaYoff);
shaBase = (Data *) shaBits;
- shaStride = shaStride * sizeof (FbBits) / sizeof (Data);
+ shaStride = shaStride * sizeof(FbBits) / sizeof(Data);
#if (DANDEBUG > 1)
- ErrorF ("-> Entering Shadow Update:\r\n |- Origins: pShadow=%x, pScreen=%x, damage=%x\r\n |- Metrics: shaStride=%d, shaBase=%x, shaBpp=%d\r\n | \n", pShadow, pScreen, damage, shaStride, shaBase, shaBpp);
+ ErrorF
+ ("-> Entering Shadow Update:\r\n |- Origins: pShadow=%x, pScreen=%x, damage=%x\r\n |- Metrics: shaStride=%d, shaBase=%x, shaBpp=%d\r\n | \n",
+ pShadow, pScreen, damage, shaStride, shaBase, shaBpp);
#endif
- while (nbox--)
- {
+ while (nbox--) {
x = pbox->x1;
y = pbox->y1;
w = (pbox->x2 - pbox->x1);
h = pbox->y2 - pbox->y1;
-
+
#if (DANDEBUG > 2)
- ErrorF (" |-> Redrawing box - Metrics: X=%d, Y=%d, Width=%d, Height=%d\n", x, y, w, h);
+ ErrorF
+ (" |-> Redrawing box - Metrics: X=%d, Y=%d, Width=%d, Height=%d\n",
+ x, y, w, h);
#endif
- scrLine = SCRLEFT(x,y,w,h);
- shaLine = shaBase + FIRSTSHA(x,y,w,h);
-
- while (STEPDOWN(x,y,w,h))
- {
+ scrLine = SCRLEFT(x, y, w, h);
+ shaLine = shaBase + FIRSTSHA(x, y, w, h);
+
+ while (STEPDOWN(x, y, w, h)) {
winSize = 0;
scrBase = 0;
- width = SCRWIDTH(x,y,w,h);
+ width = SCRWIDTH(x, y, w, h);
scr = scrLine;
sha = shaLine;
#if (DANDEBUG > 3)
- ErrorF (" | |-> StepDown - Metrics: width=%d, scr=%x, sha=%x\n", width, scr, sha);
+ ErrorF(" | |-> StepDown - Metrics: width=%d, scr=%x, sha=%x\n",
+ width, scr, sha);
#endif
- while (width)
- {
+ while (width) {
/* how much remains in this window */
i = scrBase + winSize - scr;
- if (i <= 0 || scr < scrBase)
- {
+ if (i <= 0 || scr < scrBase) {
winBase = (Data *) (*pBuf->window) (pScreen,
- SCRY(x,y,w,h),
- scr * sizeof (Data),
- SHADOW_WINDOW_WRITE,
- &winSize,
- pBuf->closure);
- if(!winBase)
+ SCRY(x, y, w, h),
+ scr * sizeof(Data),
+ SHADOW_WINDOW_WRITE,
+ &winSize,
+ pBuf->closure);
+ if (!winBase)
return;
scrBase = scr;
- winSize /= sizeof (Data);
+ winSize /= sizeof(Data);
i = winSize;
#if(DANDEBUG > 4)
- ErrorF (" | | |-> Starting New Line - Metrics: winBase=%x, scrBase=%x, winSize=%d\r\n | | | Xstride=%d, Ystride=%d, w=%d h=%d\n", winBase, scrBase, winSize, SHASTEPX(shaStride), SHASTEPY(shaStride), w, h);
+ ErrorF
+ (" | | |-> Starting New Line - Metrics: winBase=%x, scrBase=%x, winSize=%d\r\n | | | Xstride=%d, Ystride=%d, w=%d h=%d\n",
+ winBase, scrBase, winSize, SHASTEPX(shaStride),
+ SHASTEPY(shaStride), w, h);
#endif
}
win = winBase + (scr - scrBase);
@@ -168,20 +172,23 @@ FUNC (ScreenPtr pScreen,
width -= i;
scr += i;
#if(DANDEBUG > 5)
- ErrorF (" | | |-> Writing Line - Metrics: win=%x, sha=%x\n", win, sha);
+ ErrorF
+ (" | | |-> Writing Line - Metrics: win=%x, sha=%x\n",
+ win, sha);
#endif
- while (i--)
- {
+ while (i--) {
#if(DANDEBUG > 6)
- ErrorF (" | | |-> Writing Pixel - Metrics: win=%x, sha=%d, remaining=%d\n", win, sha, i);
+ ErrorF
+ (" | | |-> Writing Pixel - Metrics: win=%x, sha=%d, remaining=%d\n",
+ win, sha, i);
#endif
*win++ = *sha;
sha += SHASTEPX(shaStride);
- } /* i */
- } /* width */
+ } /* i */
+ } /* width */
shaLine += SHASTEPY(shaStride);
- NEXTY(x,y,w,h);
- } /* STEPDOWN */
+ NEXTY(x, y, w, h);
+ } /* STEPDOWN */
pbox++;
- } /* nbox */
+ } /* nbox */
}
diff --git a/xorg-server/miext/shadow/shrotpackYX.h b/xorg-server/miext/shadow/shrotpackYX.h
index d7b01ec2a..57fcf22fa 100644
--- a/xorg-server/miext/shadow/shrotpackYX.h
+++ b/xorg-server/miext/shadow/shrotpackYX.h
@@ -54,107 +54,102 @@
#endif
void
-FUNC (ScreenPtr pScreen,
- shadowBufPtr pBuf);
+ FUNC(ScreenPtr pScreen, shadowBufPtr pBuf);
void
-FUNC (ScreenPtr pScreen,
- shadowBufPtr pBuf)
+FUNC(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- RegionPtr damage = shadowDamage(pBuf);
- PixmapPtr pShadow = pBuf->pPixmap;
- int nbox = RegionNumRects (damage);
- BoxPtr pbox = RegionRects (damage);
- FbBits *shaBits;
- Data *shaBase, *shaLine, *sha;
- FbStride shaStride, winStride;
- int shaBpp;
- _X_UNUSED int shaXoff, shaYoff;
- int x, y, w, h;
- Data *winBase, *win, *winLine;
- CARD32 winSize;
-
- fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff);
+ RegionPtr damage = shadowDamage(pBuf);
+ PixmapPtr pShadow = pBuf->pPixmap;
+ int nbox = RegionNumRects(damage);
+ BoxPtr pbox = RegionRects(damage);
+ FbBits *shaBits;
+ Data *shaBase, *shaLine, *sha;
+ FbStride shaStride, winStride;
+ int shaBpp;
+ _X_UNUSED int shaXoff, shaYoff;
+ int x, y, w, h;
+ Data *winBase, *win, *winLine;
+ CARD32 winSize;
+
+ fbGetDrawable(&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff,
+ shaYoff);
shaBase = (Data *) shaBits;
- shaStride = shaStride * sizeof (FbBits) / sizeof (Data);
+ shaStride = shaStride * sizeof(FbBits) / sizeof(Data);
winBase = (Data *) (*pBuf->window) (pScreen, 0, 0,
- SHADOW_WINDOW_WRITE,
- &winSize, pBuf->closure);
+ SHADOW_WINDOW_WRITE,
+ &winSize, pBuf->closure);
winStride = (Data *) (*pBuf->window) (pScreen, 1, 0,
- SHADOW_WINDOW_WRITE,
- &winSize, pBuf->closure) - winBase;
+ SHADOW_WINDOW_WRITE,
+ &winSize, pBuf->closure) - winBase;
- while (nbox--)
- {
+ while (nbox--) {
x = pbox->x1;
y = pbox->y1;
w = (pbox->x2 - pbox->x1);
h = pbox->y2 - pbox->y1;
- shaLine = shaBase + (y * shaStride) + x;
+ shaLine = shaBase + (y * shaStride) + x;
#ifdef PREFETCH
- __builtin_prefetch (shaLine);
+ __builtin_prefetch(shaLine);
#endif
- winLine = winBase + WINSTART(x, y);
+ winLine = winBase + WINSTART(x, y);
- while (h--)
- {
- sha = shaLine;
- win = winLine;
+ while (h--) {
+ sha = shaLine;
+ win = winLine;
- while (sha < (shaLine + w - 16))
- {
+ while (sha < (shaLine + w - 16)) {
#ifdef PREFETCH
- __builtin_prefetch (sha + shaStride);
+ __builtin_prefetch(sha + shaStride);
#endif
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
-
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
-
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
-
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
- *win = *sha++;
- win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
+ *win = *sha++;
+ win += WINSTEPX(winStride);
}
- while (sha < (shaLine + w))
- {
- *win = *sha++;
- win += WINSTEPX(winStride);
+ while (sha < (shaLine + w)) {
+ *win = *sha++;
+ win += WINSTEPX(winStride);
}
- y++;
- shaLine += shaStride;
- winLine += WINSTEPY();
+ y++;
+ shaLine += shaStride;
+ winLine += WINSTEPY();
}
pbox++;
- } /* nbox */
+ } /* nbox */
}
diff --git a/xorg-server/miext/sync/misync.c b/xorg-server/miext/sync/misync.c
index f3b711d58..b1e2a36f7 100644
--- a/xorg-server/miext/sync/misync.c
+++ b/xorg-server/miext/sync/misync.c
@@ -1,200 +1,201 @@
-/*
- * Copyright © 2010 NVIDIA Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "scrnintstr.h"
-#include "misync.h"
-#include "misyncstr.h"
-
-static DevPrivateKeyRec syncScreenPrivateKeyRec;
-static DevPrivateKey syncScreenPrivateKey = &syncScreenPrivateKeyRec;
-
-#define SYNC_SCREEN_PRIV(pScreen) \
- (SyncScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, \
- syncScreenPrivateKey)
-
-typedef struct _syncScreenPriv {
- /* Wrappable sync-specific screen functions */
- SyncScreenFuncsRec funcs;
-
- /* Wrapped screen functions */
- CloseScreenProcPtr CloseScreen;
-} SyncScreenPrivRec, *SyncScreenPrivPtr;
-
-/* Default implementations of the sync screen functions */
-void
-miSyncScreenCreateFence(ScreenPtr pScreen, SyncFence* pFence,
- Bool initially_triggered)
-{
- (void)pScreen;
-
- pFence->triggered = initially_triggered;
-}
-
-void miSyncScreenDestroyFence(ScreenPtr pScreen, SyncFence* pFence)
-{
- (void)pScreen;
- (void)pFence;
-}
-
-/* Default implementations of the per-object functions */
-static void
-miSyncFenceSetTriggered(SyncFence* pFence)
-{
- pFence->triggered = TRUE;
-}
-
-static void
-miSyncFenceReset(SyncFence* pFence)
-{
- pFence->triggered = FALSE;
-}
-
-static Bool
-miSyncFenceCheckTriggered(SyncFence* pFence)
-{
- return pFence->triggered;
-}
-
-static void
-miSyncFenceAddTrigger(SyncTrigger* pTrigger)
-{
- (void)pTrigger;
-
- return;
-}
-
-static void
-miSyncFenceDeleteTrigger(SyncTrigger* pTrigger)
-{
- (void)pTrigger;
-
- return;
-}
-
-/* Machine independent portion of the fence sync object implementation */
-void
-miSyncInitFence(ScreenPtr pScreen, SyncFence* pFence, Bool initially_triggered)
-{
- SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
- static const SyncFenceFuncsRec miSyncFenceFuncs = {
- &miSyncFenceSetTriggered,
- &miSyncFenceReset,
- &miSyncFenceCheckTriggered,
- &miSyncFenceAddTrigger,
- &miSyncFenceDeleteTrigger
- };
-
- pFence->pScreen = pScreen;
- pFence->funcs = miSyncFenceFuncs;
-
- pScreenPriv->funcs.CreateFence(pScreen, pFence, initially_triggered);
-}
-
-void
-miSyncDestroyFence(SyncFence* pFence)
-{
- ScreenPtr pScreen = pFence->pScreen;
- SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
- SyncTriggerList *ptl, *pNext;
-
- pFence->sync.beingDestroyed = TRUE;
- /* tell all the fence's triggers that the counter has been destroyed */
- for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext)
- {
- (*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger);
- pNext = ptl->next;
- free(ptl); /* destroy the trigger list as we go */
- }
-
- pScreenPriv->funcs.DestroyFence(pScreen, pFence);
-
- dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE);
-}
-
-void
-miSyncTriggerFence(SyncFence* pFence)
-{
- SyncTriggerList *ptl, *pNext;
- CARD64 unused;
-
- pFence->funcs.SetTriggered(pFence);
-
- XSyncIntToValue(&unused, 0L);
-
- /* run through triggers to see if any fired */
- for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext)
- {
- pNext = ptl->next;
- if ((*ptl->pTrigger->CheckTrigger)(ptl->pTrigger, unused))
- (*ptl->pTrigger->TriggerFired)(ptl->pTrigger);
- }
-}
-
-SyncScreenFuncsPtr miSyncGetScreenFuncs(ScreenPtr pScreen)
-{
- SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
-
- return &pScreenPriv->funcs;
-}
-
-static Bool
-SyncCloseScreen (int i, ScreenPtr pScreen)
-{
- SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
-
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
-
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-Bool
-miSyncSetup(ScreenPtr pScreen)
-{
- SyncScreenPrivPtr pScreenPriv;
-
- static const SyncScreenFuncsRec miSyncScreenFuncs = {
- &miSyncScreenCreateFence,
- &miSyncScreenDestroyFence
- };
-
- if (dixPrivateKeyRegistered(syncScreenPrivateKey))
- return TRUE;
-
- if (!dixRegisterPrivateKey(syncScreenPrivateKey, PRIVATE_SCREEN,
- sizeof(SyncScreenPrivRec)))
- return FALSE;
-
- pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
-
- pScreenPriv->funcs = miSyncScreenFuncs;
-
- /* Wrap CloseScreen to clean up */
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = SyncCloseScreen;
-
- return TRUE;
-}
+/*
+ * Copyright © 2010 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "scrnintstr.h"
+#include "misync.h"
+#include "misyncstr.h"
+
+static DevPrivateKeyRec syncScreenPrivateKeyRec;
+static DevPrivateKey syncScreenPrivateKey = &syncScreenPrivateKeyRec;
+
+#define SYNC_SCREEN_PRIV(pScreen) \
+ (SyncScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, \
+ syncScreenPrivateKey)
+
+typedef struct _syncScreenPriv {
+ /* Wrappable sync-specific screen functions */
+ SyncScreenFuncsRec funcs;
+
+ /* Wrapped screen functions */
+ CloseScreenProcPtr CloseScreen;
+} SyncScreenPrivRec, *SyncScreenPrivPtr;
+
+/* Default implementations of the sync screen functions */
+void
+miSyncScreenCreateFence(ScreenPtr pScreen, SyncFence * pFence,
+ Bool initially_triggered)
+{
+ (void) pScreen;
+
+ pFence->triggered = initially_triggered;
+}
+
+void
+miSyncScreenDestroyFence(ScreenPtr pScreen, SyncFence * pFence)
+{
+ (void) pScreen;
+ (void) pFence;
+}
+
+/* Default implementations of the per-object functions */
+static void
+miSyncFenceSetTriggered(SyncFence * pFence)
+{
+ pFence->triggered = TRUE;
+}
+
+static void
+miSyncFenceReset(SyncFence * pFence)
+{
+ pFence->triggered = FALSE;
+}
+
+static Bool
+miSyncFenceCheckTriggered(SyncFence * pFence)
+{
+ return pFence->triggered;
+}
+
+static void
+miSyncFenceAddTrigger(SyncTrigger * pTrigger)
+{
+ (void) pTrigger;
+
+ return;
+}
+
+static void
+miSyncFenceDeleteTrigger(SyncTrigger * pTrigger)
+{
+ (void) pTrigger;
+
+ return;
+}
+
+/* Machine independent portion of the fence sync object implementation */
+void
+miSyncInitFence(ScreenPtr pScreen, SyncFence * pFence, Bool initially_triggered)
+{
+ SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
+
+ static const SyncFenceFuncsRec miSyncFenceFuncs = {
+ &miSyncFenceSetTriggered,
+ &miSyncFenceReset,
+ &miSyncFenceCheckTriggered,
+ &miSyncFenceAddTrigger,
+ &miSyncFenceDeleteTrigger
+ };
+
+ pFence->pScreen = pScreen;
+ pFence->funcs = miSyncFenceFuncs;
+
+ pScreenPriv->funcs.CreateFence(pScreen, pFence, initially_triggered);
+}
+
+void
+miSyncDestroyFence(SyncFence * pFence)
+{
+ ScreenPtr pScreen = pFence->pScreen;
+ SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
+ SyncTriggerList *ptl, *pNext;
+
+ pFence->sync.beingDestroyed = TRUE;
+ /* tell all the fence's triggers that the counter has been destroyed */
+ for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext) {
+ (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger);
+ pNext = ptl->next;
+ free(ptl); /* destroy the trigger list as we go */
+ }
+
+ pScreenPriv->funcs.DestroyFence(pScreen, pFence);
+
+ dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE);
+}
+
+void
+miSyncTriggerFence(SyncFence * pFence)
+{
+ SyncTriggerList *ptl, *pNext;
+ CARD64 unused;
+
+ pFence->funcs.SetTriggered(pFence);
+
+ XSyncIntToValue(&unused, 0L);
+
+ /* run through triggers to see if any fired */
+ for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext) {
+ pNext = ptl->next;
+ if ((*ptl->pTrigger->CheckTrigger) (ptl->pTrigger, unused))
+ (*ptl->pTrigger->TriggerFired) (ptl->pTrigger);
+ }
+}
+
+SyncScreenFuncsPtr
+miSyncGetScreenFuncs(ScreenPtr pScreen)
+{
+ SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
+
+ return &pScreenPriv->funcs;
+}
+
+static Bool
+SyncCloseScreen(int i, ScreenPtr pScreen)
+{
+ SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+Bool
+miSyncSetup(ScreenPtr pScreen)
+{
+ SyncScreenPrivPtr pScreenPriv;
+
+ static const SyncScreenFuncsRec miSyncScreenFuncs = {
+ &miSyncScreenCreateFence,
+ &miSyncScreenDestroyFence
+ };
+
+ if (dixPrivateKeyRegistered(syncScreenPrivateKey))
+ return TRUE;
+
+ if (!dixRegisterPrivateKey(syncScreenPrivateKey, PRIVATE_SCREEN,
+ sizeof(SyncScreenPrivRec)))
+ return FALSE;
+
+ pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
+
+ pScreenPriv->funcs = miSyncScreenFuncs;
+
+ /* Wrap CloseScreen to clean up */
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = SyncCloseScreen;
+
+ return TRUE;
+}
diff --git a/xorg-server/miext/sync/misync.h b/xorg-server/miext/sync/misync.h
index 644309324..deebb82bc 100644
--- a/xorg-server/miext/sync/misync.h
+++ b/xorg-server/miext/sync/misync.h
@@ -1,77 +1,79 @@
-/*
- * Copyright © 2010 NVIDIA Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _MISYNC_H_
-#define _MISYNC_H_
-
-typedef struct _SyncFence SyncFence;
-typedef struct _SyncTrigger SyncTrigger;
-
-typedef void (*SyncScreenCreateFenceFunc) (ScreenPtr pScreen,
- SyncFence* pFence,
- Bool initially_triggered);
-typedef void (*SyncScreenDestroyFenceFunc) (ScreenPtr pScreen,
- SyncFence* pFence);
-
-typedef struct _syncScreenFuncs {
- SyncScreenCreateFenceFunc CreateFence;
- SyncScreenDestroyFenceFunc DestroyFence;
-} SyncScreenFuncsRec, *SyncScreenFuncsPtr;
-
-extern _X_EXPORT void
-miSyncScreenCreateFence(ScreenPtr pScreen, SyncFence* pFence,
- Bool initially_triggered);
-extern _X_EXPORT void
-miSyncScreenDestroyFence(ScreenPtr pScreen, SyncFence* pFence);
-
-typedef void (*SyncFenceSetTriggeredFunc) (SyncFence* pFence);
-typedef void (*SyncFenceResetFunc) (SyncFence* pFence);
-typedef Bool (*SyncFenceCheckTriggeredFunc) (SyncFence* pFence);
-typedef void (*SyncFenceAddTriggerFunc) (SyncTrigger* pTrigger);
-typedef void (*SyncFenceDeleteTriggerFunc) (SyncTrigger* pTrigger);
-
-typedef struct _syncFenceFuncs {
- SyncFenceSetTriggeredFunc SetTriggered;
- SyncFenceResetFunc Reset;
- SyncFenceCheckTriggeredFunc CheckTriggered;
- SyncFenceAddTriggerFunc AddTrigger;
- SyncFenceDeleteTriggerFunc DeleteTrigger;
-} SyncFenceFuncsRec, *SyncFenceFuncsPtr;
-
-extern _X_EXPORT void
-miSyncInitFence(ScreenPtr pScreen, SyncFence* pFence, Bool initially_triggered);
-extern _X_EXPORT void
-miSyncDestroyFence(SyncFence* pFence);
-extern _X_EXPORT void
-miSyncTriggerFence(SyncFence* pFence);
-
-extern _X_EXPORT SyncScreenFuncsPtr
-miSyncGetScreenFuncs(ScreenPtr pScreen);
-extern _X_EXPORT Bool
-miSyncSetup(ScreenPtr pScreen);
-
-#endif /* _MISYNC_H_ */
+/*
+ * Copyright © 2010 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _MISYNC_H_
+#define _MISYNC_H_
+
+typedef struct _SyncFence SyncFence;
+typedef struct _SyncTrigger SyncTrigger;
+
+typedef void (*SyncScreenCreateFenceFunc) (ScreenPtr pScreen,
+ SyncFence * pFence,
+ Bool initially_triggered);
+typedef void (*SyncScreenDestroyFenceFunc) (ScreenPtr pScreen,
+ SyncFence * pFence);
+
+typedef struct _syncScreenFuncs {
+ SyncScreenCreateFenceFunc CreateFence;
+ SyncScreenDestroyFenceFunc DestroyFence;
+} SyncScreenFuncsRec, *SyncScreenFuncsPtr;
+
+extern _X_EXPORT void
+
+miSyncScreenCreateFence(ScreenPtr pScreen, SyncFence * pFence,
+ Bool initially_triggered);
+extern _X_EXPORT void
+ miSyncScreenDestroyFence(ScreenPtr pScreen, SyncFence * pFence);
+
+typedef void (*SyncFenceSetTriggeredFunc) (SyncFence * pFence);
+typedef void (*SyncFenceResetFunc) (SyncFence * pFence);
+typedef Bool (*SyncFenceCheckTriggeredFunc) (SyncFence * pFence);
+typedef void (*SyncFenceAddTriggerFunc) (SyncTrigger * pTrigger);
+typedef void (*SyncFenceDeleteTriggerFunc) (SyncTrigger * pTrigger);
+
+typedef struct _syncFenceFuncs {
+ SyncFenceSetTriggeredFunc SetTriggered;
+ SyncFenceResetFunc Reset;
+ SyncFenceCheckTriggeredFunc CheckTriggered;
+ SyncFenceAddTriggerFunc AddTrigger;
+ SyncFenceDeleteTriggerFunc DeleteTrigger;
+} SyncFenceFuncsRec, *SyncFenceFuncsPtr;
+
+extern _X_EXPORT void
+
+miSyncInitFence(ScreenPtr pScreen, SyncFence * pFence,
+ Bool initially_triggered);
+extern _X_EXPORT void
+ miSyncDestroyFence(SyncFence * pFence);
+extern _X_EXPORT void
+ miSyncTriggerFence(SyncFence * pFence);
+
+extern _X_EXPORT SyncScreenFuncsPtr miSyncGetScreenFuncs(ScreenPtr pScreen);
+extern _X_EXPORT Bool
+ miSyncSetup(ScreenPtr pScreen);
+
+#endif /* _MISYNC_H_ */
diff --git a/xorg-server/miext/sync/misyncstr.h b/xorg-server/miext/sync/misyncstr.h
index 9b0f24365..e19256fee 100644
--- a/xorg-server/miext/sync/misyncstr.h
+++ b/xorg-server/miext/sync/misyncstr.h
@@ -1,86 +1,82 @@
-/*
- * Copyright © 2010 NVIDIA Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _MISYNCSTR_H_
-#define _MISYNCSTR_H_
-
-#include "dix.h"
-#include <X11/extensions/syncconst.h>
-
-#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
-
-/* Sync object types */
-#define SYNC_COUNTER 0
-#define SYNC_FENCE 1
-
-typedef struct _SyncObject {
- ClientPtr client; /* Owning client. 0 for system counters */
- struct _SyncTriggerList *pTriglist; /* list of triggers */
- XID id; /* resource ID */
- unsigned char type; /* SYNC_* */
- Bool beingDestroyed; /* in process of going away */
-} SyncObject;
-
-typedef struct _SyncCounter {
- SyncObject sync; /* Common sync object data */
- CARD64 value; /* counter value */
- struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
-} SyncCounter;
-
-struct _SyncFence {
- SyncObject sync; /* Common sync object data */
- ScreenPtr pScreen; /* Screen of this fence object */
- SyncFenceFuncsRec funcs; /* Funcs for performing ops on fence */
- Bool triggered; /* fence state */
- PrivateRec *devPrivates; /* driver-specific per-fence data */
-};
-
-struct _SyncTrigger {
- SyncObject *pSync;
- CARD64 wait_value; /* wait value */
- unsigned int value_type; /* Absolute or Relative */
- unsigned int test_type; /* transition or Comparision type */
- CARD64 test_value; /* trigger event threshold value */
- Bool (*CheckTrigger)(
- struct _SyncTrigger * /*pTrigger*/,
- CARD64 /*newval*/
- );
- void (*TriggerFired)(
- struct _SyncTrigger * /*pTrigger*/
- );
- void (*CounterDestroyed)(
- struct _SyncTrigger * /*pTrigger*/
- );
-};
-
-typedef struct _SyncTriggerList {
- SyncTrigger *pTrigger;
- struct _SyncTriggerList *next;
-} SyncTriggerList;
-
-#endif /* _MISYNCSTR_H_ */
-
+/*
+ * Copyright © 2010 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _MISYNCSTR_H_
+#define _MISYNCSTR_H_
+
+#include "dix.h"
+#include <X11/extensions/syncconst.h>
+
+#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
+
+/* Sync object types */
+#define SYNC_COUNTER 0
+#define SYNC_FENCE 1
+
+typedef struct _SyncObject {
+ ClientPtr client; /* Owning client. 0 for system counters */
+ struct _SyncTriggerList *pTriglist; /* list of triggers */
+ XID id; /* resource ID */
+ unsigned char type; /* SYNC_* */
+ Bool beingDestroyed; /* in process of going away */
+} SyncObject;
+
+typedef struct _SyncCounter {
+ SyncObject sync; /* Common sync object data */
+ CARD64 value; /* counter value */
+ struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
+} SyncCounter;
+
+struct _SyncFence {
+ SyncObject sync; /* Common sync object data */
+ ScreenPtr pScreen; /* Screen of this fence object */
+ SyncFenceFuncsRec funcs; /* Funcs for performing ops on fence */
+ Bool triggered; /* fence state */
+ PrivateRec *devPrivates; /* driver-specific per-fence data */
+};
+
+struct _SyncTrigger {
+ SyncObject *pSync;
+ CARD64 wait_value; /* wait value */
+ unsigned int value_type; /* Absolute or Relative */
+ unsigned int test_type; /* transition or Comparision type */
+ CARD64 test_value; /* trigger event threshold value */
+ Bool (*CheckTrigger) (struct _SyncTrigger * /*pTrigger */ ,
+ CARD64 /*newval */
+ );
+ void (*TriggerFired) (struct _SyncTrigger * /*pTrigger */
+ );
+ void (*CounterDestroyed) (struct _SyncTrigger * /*pTrigger */
+ );
+};
+
+typedef struct _SyncTriggerList {
+ SyncTrigger *pTrigger;
+ struct _SyncTriggerList *next;
+} SyncTriggerList;
+
+#endif /* _MISYNCSTR_H_ */
diff --git a/xorg-server/os/WaitFor.c b/xorg-server/os/WaitFor.c
index ddfa14903..6c8ede29d 100644
--- a/xorg-server/os/WaitFor.c
+++ b/xorg-server/os/WaitFor.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -45,7 +44,6 @@ SOFTWARE.
******************************************************************/
-
/*****************************************************************
* OS Dependent input routines:
*
@@ -61,7 +59,7 @@ SOFTWARE.
#ifdef WIN32
#include <X11/Xwinsock.h>
#endif
-#include <X11/Xos.h> /* for strings, fcntl, time */
+#include <X11/Xos.h> /* for strings, fcntl, time */
#include <errno.h>
#include <stdio.h>
#include <X11/X.h>
@@ -100,12 +98,12 @@ mffs(fd_mask mask)
{
int i;
- if (!mask) return 0;
+ if (!mask)
+ return 0;
i = 1;
- while (!(mask & 1))
- {
- i++;
- mask >>= 1;
+ while (!(mask & 1)) {
+ i++;
+ mask >>= 1;
}
return i;
}
@@ -115,11 +113,11 @@ mffs(fd_mask mask)
#endif
struct _OsTimerRec {
- OsTimerPtr next;
- CARD32 expires;
- CARD32 delta;
- OsTimerCallback callback;
- pointer arg;
+ OsTimerPtr next;
+ CARD32 expires;
+ CARD32 delta;
+ OsTimerCallback callback;
+ pointer arg;
};
static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev);
@@ -156,7 +154,7 @@ WaitForSomething(int *pClientsReady)
static int nready;
fd_set devicesReadable;
CARD32 now = 0;
- Bool someReady = FALSE;
+ Bool someReady = FALSE;
FD_ZERO(&clientsReadable);
@@ -166,235 +164,214 @@ WaitForSomething(int *pClientsReady)
/* We need a while loop here to handle
crashed connections and the screen saver timeout */
- while (1)
- {
- /* deal with any blocked jobs */
- if (workQueue)
- ProcessWorkQueue();
- if (XFD_ANYSET (&ClientsWithInput))
- {
- if (!SmartScheduleDisable)
- {
- someReady = TRUE;
- waittime.tv_sec = 0;
- waittime.tv_usec = 0;
- wt = &waittime;
- }
- else
- {
- XFD_COPYSET (&ClientsWithInput, &clientsReadable);
- break;
- }
- }
- if (someReady)
- {
- XFD_COPYSET(&AllSockets, &LastSelectMask);
- XFD_UNSET(&LastSelectMask, &ClientsWithInput);
- }
- else
- {
- wt = NULL;
- if (timers)
- {
- now = GetTimeInMillis();
- timeout = timers->expires - now;
- if (timeout > 0 && timeout > timers->delta + 250) {
- /* time has rewound. reset the timers. */
- CheckAllTimers();
+ while (1) {
+ /* deal with any blocked jobs */
+ if (workQueue)
+ ProcessWorkQueue();
+ if (XFD_ANYSET(&ClientsWithInput)) {
+ if (!SmartScheduleDisable) {
+ someReady = TRUE;
+ waittime.tv_sec = 0;
+ waittime.tv_usec = 0;
+ wt = &waittime;
+ }
+ else {
+ XFD_COPYSET(&ClientsWithInput, &clientsReadable);
+ break;
}
+ }
+ if (someReady) {
+ XFD_COPYSET(&AllSockets, &LastSelectMask);
+ XFD_UNSET(&LastSelectMask, &ClientsWithInput);
+ }
+ else {
+ wt = NULL;
+ if (timers) {
+ now = GetTimeInMillis();
+ timeout = timers->expires - now;
+ if (timeout > 0 && timeout > timers->delta + 250) {
+ /* time has rewound. reset the timers. */
+ CheckAllTimers();
+ }
+
+ if (timers) {
+ timeout = timers->expires - now;
+ if (timeout < 0)
+ timeout = 0;
+ waittime.tv_sec = timeout / MILLI_PER_SECOND;
+ waittime.tv_usec = (timeout % MILLI_PER_SECOND) *
+ (1000000 / MILLI_PER_SECOND);
+ wt = &waittime;
+ }
+ }
+ if (!wt)
+ {
+ wt = &waittime;
+ waittime.tv_sec = 0;
+ waittime.tv_usec = 100;
+ }
+ XFD_COPYSET(&AllSockets, &LastSelectMask);
+ }
- if (timers) {
- timeout = timers->expires - now;
- if (timeout < 0)
- timeout = 0;
- waittime.tv_sec = timeout / MILLI_PER_SECOND;
- waittime.tv_usec = (timeout % MILLI_PER_SECOND) *
- (1000000 / MILLI_PER_SECOND);
- wt = &waittime;
- }
- }
- if (!wt)
- {
- wt = &waittime;
- waittime.tv_sec = 0;
- waittime.tv_usec = 100;
- }
- XFD_COPYSET(&AllSockets, &LastSelectMask);
- }
-
- BlockHandler((pointer)&wt, (pointer)&LastSelectMask);
- if (NewOutputPending)
- FlushAllOutput();
- /* keep this check close to select() call to minimize race */
- if (dispatchException)
- i = -1;
- else if (AnyClientsWriteBlocked)
- {
- XFD_COPYSET(&ClientsWriteBlocked, &clientsWritable);
- i = Select (MaxClients, &LastSelectMask, &clientsWritable, NULL, wt);
- }
- else
- {
- i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt);
- }
- selecterr = GetErrno();
- WakeupHandler(i, (pointer)&LastSelectMask);
- if (i <= 0) /* An error or timeout occurred */
- {
- if (dispatchException)
- return 0;
- if (i < 0)
- {
- if (selecterr == EBADF) /* Some client disconnected */
- {
- CheckConnections ();
- if (! XFD_ANYSET (&AllClients))
- return 0;
- }
- else if (selecterr == EINVAL)
- {
- FatalError("WaitForSomething(): select: %s\n",
- strerror(selecterr));
+ BlockHandler((pointer) &wt, (pointer) &LastSelectMask);
+ if (NewOutputPending)
+ FlushAllOutput();
+ /* keep this check close to select() call to minimize race */
+ if (dispatchException)
+ i = -1;
+ else if (AnyClientsWriteBlocked) {
+ XFD_COPYSET(&ClientsWriteBlocked, &clientsWritable);
+ i = Select(MaxClients, &LastSelectMask, &clientsWritable, NULL, wt);
+ }
+ else {
+ i = Select(MaxClients, &LastSelectMask, NULL, NULL, wt);
+ }
+ selecterr = GetErrno();
+ WakeupHandler(i, (pointer) &LastSelectMask);
+ if (i <= 0) { /* An error or timeout occurred */
+ if (dispatchException)
+ return 0;
+ if (i < 0) {
+ if (selecterr == EBADF) { /* Some client disconnected */
+ CheckConnections();
+ if (!XFD_ANYSET(&AllClients))
+ return 0;
+ }
+ else if (selecterr == EINVAL) {
+ FatalError("WaitForSomething(): select: %s\n",
+ strerror(selecterr));
+ }
+ else if (selecterr != EINTR && selecterr != EAGAIN) {
+ ErrorF("WaitForSomething(): select: %s\n",
+ strerror(selecterr));
+ }
+ }
+ else if (someReady) {
+ /*
+ * If no-one else is home, bail quickly
+ */
+ XFD_COPYSET(&ClientsWithInput, &LastSelectMask);
+ XFD_COPYSET(&ClientsWithInput, &clientsReadable);
+ break;
}
- else if (selecterr != EINTR && selecterr != EAGAIN)
- {
- ErrorF("WaitForSomething(): select: %s\n",
- strerror(selecterr));
- }
- }
- else if (someReady)
- {
- /*
- * If no-one else is home, bail quickly
- */
- XFD_COPYSET(&ClientsWithInput, &LastSelectMask);
- XFD_COPYSET(&ClientsWithInput, &clientsReadable);
- break;
- }
- if (*checkForInput[0] != *checkForInput[1])
- return 0;
-
- if (timers)
- {
+ if (*checkForInput[0] != *checkForInput[1])
+ return 0;
+
+ if (timers) {
int expired = 0;
- now = GetTimeInMillis();
- if ((int) (timers->expires - now) <= 0)
- expired = 1;
- while (timers && (int) (timers->expires - now) <= 0)
- DoTimer(timers, now, &timers);
+ now = GetTimeInMillis();
+ if ((int) (timers->expires - now) <= 0)
+ expired = 1;
+
+ while (timers && (int) (timers->expires - now) <= 0)
+ DoTimer(timers, now, &timers);
if (expired)
return 0;
- }
- }
- else
- {
- fd_set tmp_set;
-
- if (*checkForInput[0] == *checkForInput[1]) {
- if (timers)
- {
+ }
+ }
+ else {
+ fd_set tmp_set;
+
+ if (*checkForInput[0] == *checkForInput[1]) {
+ if (timers) {
int expired = 0;
- now = GetTimeInMillis();
- if ((int) (timers->expires - now) <= 0)
- expired = 1;
- while (timers && (int) (timers->expires - now) <= 0)
- DoTimer(timers, now, &timers);
+ now = GetTimeInMillis();
+ if ((int) (timers->expires - now) <= 0)
+ expired = 1;
+
+ while (timers && (int) (timers->expires - now) <= 0)
+ DoTimer(timers, now, &timers);
if (expired)
return 0;
- }
- }
- if (someReady)
- XFD_ORSET(&LastSelectMask, &ClientsWithInput, &LastSelectMask);
- if (AnyClientsWriteBlocked && XFD_ANYSET (&clientsWritable))
- {
- NewOutputPending = TRUE;
- XFD_ORSET(&OutputPending, &clientsWritable, &OutputPending);
- XFD_UNSET(&ClientsWriteBlocked, &clientsWritable);
- if (! XFD_ANYSET(&ClientsWriteBlocked))
- AnyClientsWriteBlocked = FALSE;
- }
-
- XFD_ANDSET(&devicesReadable, &LastSelectMask, &EnabledDevices);
- XFD_ANDSET(&clientsReadable, &LastSelectMask, &AllClients);
- XFD_ANDSET(&tmp_set, &LastSelectMask, &WellKnownConnections);
- if (XFD_ANYSET(&tmp_set))
- QueueWorkProc(EstablishNewConnections, NULL,
- (pointer)&LastSelectMask);
-
- if (XFD_ANYSET (&devicesReadable) || XFD_ANYSET (&clientsReadable))
- break;
- /* check here for DDXes that queue events during Block/Wakeup */
- if (*checkForInput[0] != *checkForInput[1])
- return 0;
- }
+ }
+ }
+ if (someReady)
+ XFD_ORSET(&LastSelectMask, &ClientsWithInput, &LastSelectMask);
+ if (AnyClientsWriteBlocked && XFD_ANYSET(&clientsWritable)) {
+ NewOutputPending = TRUE;
+ XFD_ORSET(&OutputPending, &clientsWritable, &OutputPending);
+ XFD_UNSET(&ClientsWriteBlocked, &clientsWritable);
+ if (!XFD_ANYSET(&ClientsWriteBlocked))
+ AnyClientsWriteBlocked = FALSE;
+ }
+
+ XFD_ANDSET(&devicesReadable, &LastSelectMask, &EnabledDevices);
+ XFD_ANDSET(&clientsReadable, &LastSelectMask, &AllClients);
+ XFD_ANDSET(&tmp_set, &LastSelectMask, &WellKnownConnections);
+ if (XFD_ANYSET(&tmp_set))
+ QueueWorkProc(EstablishNewConnections, NULL,
+ (pointer) &LastSelectMask);
+
+ if (XFD_ANYSET(&devicesReadable) || XFD_ANYSET(&clientsReadable))
+ break;
+ /* check here for DDXes that queue events during Block/Wakeup */
+ if (*checkForInput[0] != *checkForInput[1])
+ return 0;
+ }
}
nready = 0;
- if (XFD_ANYSET (&clientsReadable))
- {
+ if (XFD_ANYSET(&clientsReadable)) {
#ifndef WIN32
- for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
- {
- int highest_priority = 0;
+ for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
+ int highest_priority = 0;
- while (clientsReadable.fds_bits[i])
- {
- int client_priority, client_index;
+ while (clientsReadable.fds_bits[i]) {
+ int client_priority, client_index;
- curclient = mffs (clientsReadable.fds_bits[i]) - 1;
- client_index = /* raphael: modified */
- ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))];
+ curclient = mffs(clientsReadable.fds_bits[i]) - 1;
+ client_index = /* raphael: modified */
+ ConnectionTranslation[curclient +
+ (i * (sizeof(fd_mask) * 8))];
#else
- int highest_priority = 0;
- fd_set savedClientsReadable;
- XFD_COPYSET(&clientsReadable, &savedClientsReadable);
- for (i = 0; i < XFD_SETCOUNT(&savedClientsReadable); i++)
- {
- int client_priority, client_index;
-
- curclient = XFD_FD(&savedClientsReadable, i);
- client_index = GetConnectionTranslation(curclient);
+ int highest_priority = 0;
+ fd_set savedClientsReadable;
+
+ XFD_COPYSET(&clientsReadable, &savedClientsReadable);
+ for (i = 0; i < XFD_SETCOUNT(&savedClientsReadable); i++) {
+ int client_priority, client_index;
+
+ curclient = XFD_FD(&savedClientsReadable, i);
+ client_index = GetConnectionTranslation(curclient);
#endif
- /* We implement "strict" priorities.
- * Only the highest priority client is returned to
- * dix. If multiple clients at the same priority are
- * ready, they are all returned. This means that an
- * aggressive client could take over the server.
- * This was not considered a big problem because
- * aggressive clients can hose the server in so many
- * other ways :)
- */
- client_priority = clients[client_index]->priority;
- if (nready == 0 || client_priority > highest_priority)
- {
- /* Either we found the first client, or we found
- * a client whose priority is greater than all others
- * that have been found so far. Either way, we want
- * to initialize the list of clients to contain just
- * this client.
- */
- pClientsReady[0] = client_index;
- highest_priority = client_priority;
- nready = 1;
- }
- /* the following if makes sure that multiple same-priority
- * clients get batched together
- */
- else if (client_priority == highest_priority)
- {
- pClientsReady[nready++] = client_index;
- }
+ /* We implement "strict" priorities.
+ * Only the highest priority client is returned to
+ * dix. If multiple clients at the same priority are
+ * ready, they are all returned. This means that an
+ * aggressive client could take over the server.
+ * This was not considered a big problem because
+ * aggressive clients can hose the server in so many
+ * other ways :)
+ */
+ client_priority = clients[client_index]->priority;
+ if (nready == 0 || client_priority > highest_priority) {
+ /* Either we found the first client, or we found
+ * a client whose priority is greater than all others
+ * that have been found so far. Either way, we want
+ * to initialize the list of clients to contain just
+ * this client.
+ */
+ pClientsReady[0] = client_index;
+ highest_priority = client_priority;
+ nready = 1;
+ }
+ /* the following if makes sure that multiple same-priority
+ * clients get batched together
+ */
+ else if (client_priority == highest_priority) {
+ pClientsReady[nready++] = client_index;
+ }
#ifndef WIN32
- clientsReadable.fds_bits[i] &= ~(((fd_mask)1L) << curclient);
- }
+ clientsReadable.fds_bits[i] &= ~(((fd_mask) 1L) << curclient);
+ }
#else
- FD_CLR(curclient, &clientsReadable);
+ FD_CLR(curclient, &clientsReadable);
#endif
- }
+ }
}
if (nready)
@@ -411,7 +388,7 @@ CheckAllTimers(void)
OsTimerPtr timer;
CARD32 now;
-start:
+ start:
now = GetTimeInMillis();
for (timer = timers; timer; timer = timer->next) {
@@ -429,60 +406,54 @@ DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev)
*prev = timer->next;
timer->next = NULL;
- newTime = (*timer->callback)(timer, now, timer->arg);
+ newTime = (*timer->callback) (timer, now, timer->arg);
if (newTime)
- TimerSet(timer, 0, newTime, timer->callback, timer->arg);
+ TimerSet(timer, 0, newTime, timer->callback, timer->arg);
}
OsTimerPtr
-TimerSet(OsTimerPtr timer, int flags, CARD32 millis,
- OsTimerCallback func, pointer arg)
+TimerSet(OsTimerPtr timer, int flags, CARD32 millis,
+ OsTimerCallback func, pointer arg)
{
register OsTimerPtr *prev;
CARD32 now = GetTimeInMillis();
- if (!timer)
- {
- timer = malloc(sizeof(struct _OsTimerRec));
- if (!timer)
- return NULL;
+ if (!timer) {
+ timer = malloc(sizeof(struct _OsTimerRec));
+ if (!timer)
+ return NULL;
}
- else
- {
- for (prev = &timers; *prev; prev = &(*prev)->next)
- {
- if (*prev == timer)
- {
- *prev = timer->next;
- if (flags & TimerForceOld)
- (void)(*timer->callback)(timer, now, timer->arg);
- break;
- }
- }
+ else {
+ for (prev = &timers; *prev; prev = &(*prev)->next) {
+ if (*prev == timer) {
+ *prev = timer->next;
+ if (flags & TimerForceOld)
+ (void) (*timer->callback) (timer, now, timer->arg);
+ break;
+ }
+ }
}
if (!millis)
- return timer;
+ return timer;
if (flags & TimerAbsolute) {
timer->delta = millis - now;
}
else {
timer->delta = millis;
- millis += now;
+ millis += now;
}
timer->expires = millis;
timer->callback = func;
timer->arg = arg;
- if ((int) (millis - now) <= 0)
- {
- timer->next = NULL;
- millis = (*timer->callback)(timer, now, timer->arg);
- if (!millis)
- return timer;
+ if ((int) (millis - now) <= 0) {
+ timer->next = NULL;
+ millis = (*timer->callback) (timer, now, timer->arg);
+ if (!millis)
+ return timer;
}
for (prev = &timers;
- *prev && (int) ((*prev)->expires - millis) <= 0;
- prev = &(*prev)->next)
- ;
+ *prev && (int) ((*prev)->expires - millis) <= 0;
+ prev = &(*prev)->next);
timer->next = *prev;
*prev = timer;
return timer;
@@ -493,32 +464,27 @@ TimerForce(OsTimerPtr timer)
{
OsTimerPtr *prev;
- for (prev = &timers; *prev; prev = &(*prev)->next)
- {
- if (*prev == timer)
- {
- DoTimer(timer, GetTimeInMillis(), prev);
- return TRUE;
- }
+ for (prev = &timers; *prev; prev = &(*prev)->next) {
+ if (*prev == timer) {
+ DoTimer(timer, GetTimeInMillis(), prev);
+ return TRUE;
+ }
}
return FALSE;
}
-
void
TimerCancel(OsTimerPtr timer)
{
OsTimerPtr *prev;
if (!timer)
- return;
- for (prev = &timers; *prev; prev = &(*prev)->next)
- {
- if (*prev == timer)
- {
- *prev = timer->next;
- break;
- }
+ return;
+ for (prev = &timers; *prev; prev = &(*prev)->next) {
+ if (*prev == timer) {
+ *prev = timer->next;
+ break;
+ }
}
}
@@ -526,7 +492,7 @@ void
TimerFree(OsTimerPtr timer)
{
if (!timer)
- return;
+ return;
TimerCancel(timer);
free(timer);
}
@@ -537,7 +503,7 @@ TimerCheck(void)
CARD32 now = GetTimeInMillis();
while (timers && (int) (timers->expires - now) <= 0)
- DoTimer(timers, now, &timers);
+ DoTimer(timers, now, &timers);
}
void
@@ -545,10 +511,9 @@ TimerInit(void)
{
OsTimerPtr timer;
- while ((timer = timers))
- {
- timers = timer->next;
- free(timer);
+ while ((timer = timers)) {
+ timers = timer->next;
+ free(timer);
}
}
@@ -569,27 +534,26 @@ NextDPMSTimeout(INT32 timeout)
* Return the amount of time remaining until we should set
* the next power level. Fallthroughs are intentional.
*/
- switch (DPMSPowerLevel)
- {
- case DPMSModeOn:
- DPMS_CHECK_TIMEOUT(DPMSStandbyTime)
+ switch (DPMSPowerLevel) {
+ case DPMSModeOn:
+ DPMS_CHECK_TIMEOUT(DPMSStandbyTime)
- case DPMSModeStandby:
- DPMS_CHECK_TIMEOUT(DPMSSuspendTime)
+ case DPMSModeStandby:
+ DPMS_CHECK_TIMEOUT(DPMSSuspendTime)
- case DPMSModeSuspend:
- DPMS_CHECK_TIMEOUT(DPMSOffTime)
+ case DPMSModeSuspend:
+ DPMS_CHECK_TIMEOUT(DPMSOffTime)
- default: /* DPMSModeOff */
- return 0;
+ default: /* DPMSModeOff */
+ return 0;
}
}
-#endif /* DPMSExtension */
+#endif /* DPMSExtension */
static CARD32
-ScreenSaverTimeoutExpire(OsTimerPtr timer,CARD32 now,pointer arg)
+ScreenSaverTimeoutExpire(OsTimerPtr timer, CARD32 now, pointer arg)
{
- INT32 timeout = now - lastDeviceEventTime.milliseconds;
+ INT32 timeout = now - lastDeviceEventTime[XIAllDevices].milliseconds;
CARD32 nextTimeout = 0;
#ifdef DPMSExtension
@@ -597,13 +561,12 @@ ScreenSaverTimeoutExpire(OsTimerPtr timer,CARD32 now,pointer arg)
* Check each mode lowest to highest, since a lower mode can
* have the same timeout as a higher one.
*/
- if (DPMSEnabled)
- {
- DPMS_CHECK_MODE(DPMSModeOff, DPMSOffTime)
- DPMS_CHECK_MODE(DPMSModeSuspend, DPMSSuspendTime)
- DPMS_CHECK_MODE(DPMSModeStandby, DPMSStandbyTime)
+ if (DPMSEnabled) {
+ DPMS_CHECK_MODE(DPMSModeOff, DPMSOffTime)
+ DPMS_CHECK_MODE(DPMSModeSuspend, DPMSSuspendTime)
+ DPMS_CHECK_MODE(DPMSModeStandby, DPMSStandbyTime)
- nextTimeout = NextDPMSTimeout(timeout);
+ nextTimeout = NextDPMSTimeout(timeout);
}
/*
@@ -611,27 +574,24 @@ ScreenSaverTimeoutExpire(OsTimerPtr timer,CARD32 now,pointer arg)
* power saving mode
*/
if (DPMSPowerLevel != DPMSModeOn)
- return nextTimeout;
-#endif /* DPMSExtension */
+ return nextTimeout;
+#endif /* DPMSExtension */
if (!ScreenSaverTime)
- return nextTimeout;
+ return nextTimeout;
- if (timeout < ScreenSaverTime)
- {
- return nextTimeout > 0 ?
- min(ScreenSaverTime - timeout, nextTimeout) :
- ScreenSaverTime - timeout;
+ if (timeout < ScreenSaverTime) {
+ return nextTimeout > 0 ?
+ min(ScreenSaverTime - timeout, nextTimeout) :
+ ScreenSaverTime - timeout;
}
- ResetOsBuffers(); /* not ideal, but better than nothing */
+ ResetOsBuffers(); /* not ideal, but better than nothing */
dixSaveScreens(serverClient, SCREEN_SAVER_ON, ScreenSaverActive);
- if (ScreenSaverInterval > 0)
- {
- nextTimeout = nextTimeout > 0 ?
- min(ScreenSaverInterval, nextTimeout) :
- ScreenSaverInterval;
+ if (ScreenSaverInterval > 0) {
+ nextTimeout = nextTimeout > 0 ?
+ min(ScreenSaverInterval, nextTimeout) : ScreenSaverInterval;
}
return nextTimeout;
@@ -643,8 +603,8 @@ void
FreeScreenSaverTimer(void)
{
if (ScreenSaverTimer) {
- TimerFree(ScreenSaverTimer);
- ScreenSaverTimer = NULL;
+ TimerFree(ScreenSaverTimer);
+ ScreenSaverTimer = NULL;
}
}
@@ -654,28 +614,24 @@ SetScreenSaverTimer(void)
CARD32 timeout = 0;
#ifdef DPMSExtension
- if (DPMSEnabled)
- {
- /*
- * A higher DPMS level has a timeout that's either less
- * than or equal to that of a lower DPMS level.
- */
- if (DPMSStandbyTime > 0)
- timeout = DPMSStandbyTime;
-
- else if (DPMSSuspendTime > 0)
- timeout = DPMSSuspendTime;
-
- else if (DPMSOffTime > 0)
- timeout = DPMSOffTime;
+ if (DPMSEnabled) {
+ /*
+ * A higher DPMS level has a timeout that's either less
+ * than or equal to that of a lower DPMS level.
+ */
+ if (DPMSStandbyTime > 0)
+ timeout = DPMSStandbyTime;
+
+ else if (DPMSSuspendTime > 0)
+ timeout = DPMSSuspendTime;
+
+ else if (DPMSOffTime > 0)
+ timeout = DPMSOffTime;
}
#endif
- if (ScreenSaverTime > 0)
- {
- timeout = timeout > 0 ?
- min(ScreenSaverTime, timeout) :
- ScreenSaverTime;
+ if (ScreenSaverTime > 0) {
+ timeout = timeout > 0 ? min(ScreenSaverTime, timeout) : ScreenSaverTime;
}
#ifdef SCREENSAVER
@@ -683,11 +639,10 @@ SetScreenSaverTimer(void)
#else
if (timeout) {
#endif
- ScreenSaverTimer = TimerSet(ScreenSaverTimer, 0, timeout,
- ScreenSaverTimeoutExpire, NULL);
+ ScreenSaverTimer = TimerSet(ScreenSaverTimer, 0, timeout,
+ ScreenSaverTimeoutExpire, NULL);
}
else if (ScreenSaverTimer) {
- FreeScreenSaverTimer();
+ FreeScreenSaverTimer();
}
}
-
diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c
index 0ec8ebdf7..71af6e7c9 100644
--- a/xorg-server/os/access.c
+++ b/xorg-server/os/access.c
@@ -102,28 +102,28 @@ SOFTWARE.
#include <sys/ioctl.h>
#include <ctype.h>
-#if defined(TCPCONN) || defined(STREAMSCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN)
#include <netinet/in.h>
-#endif /* TCPCONN || STREAMSCONN */
+#endif /* TCPCONN || STREAMSCONN */
#ifdef HAVE_GETPEERUCRED
-# include <ucred.h>
-# ifdef sun
-# include <zone.h>
-# endif
+#include <ucred.h>
+#ifdef sun
+#include <zone.h>
+#endif
#endif
#if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__)
-# include <sys/utsname.h>
+#include <sys/utsname.h>
#endif
#if defined(SYSV) && defined(__i386__)
-# include <sys/stream.h>
+#include <sys/stream.h>
#endif
#ifdef __GNU__
#undef SIOCGIFCONF
#include <netdb.h>
-#else /*!__GNU__*/
-# include <net/if.h>
+#else /*!__GNU__ */
+#include <net/if.h>
#endif /*__GNU__ */
#ifdef SVR4
@@ -163,8 +163,7 @@ SOFTWARE.
/* #endif */
#endif
-#endif /* WIN32 */
-
+#endif /* WIN32 */
#define X_INCLUDE_NETDB_H
#include <X11/Xos_r.h>
@@ -181,18 +180,18 @@ Bool defeatAccessControl = FALSE;
(length) == (host)->len &&\
!memcmp (address, (host)->addr, length))
-static int ConvertAddr(struct sockaddr * /*saddr*/,
- int * /*len*/,
- pointer * /*addr*/);
+static int ConvertAddr(struct sockaddr * /*saddr */ ,
+ int * /*len */ ,
+ pointer * /*addr */ );
-static int CheckAddr(int /*family*/,
- const void * /*pAddr*/,
- unsigned /*length*/);
+static int CheckAddr(int /*family */ ,
+ const void * /*pAddr */ ,
+ unsigned /*length */ );
-static Bool NewHost(int /*family*/,
- const void * /*addr*/,
- int /*len*/,
- int /* addingLocalHosts */);
+static Bool NewHost(int /*family */ ,
+ const void * /*addr */ ,
+ int /*len */ ,
+ int /* addingLocalHosts */ );
/* XFree86 bug #156: To keep track of which hosts were explicitly requested in
/etc/X<display>.hosts, we've added a requested field to the HOST struct,
@@ -202,11 +201,11 @@ static Bool NewHost(int /*family*/,
local host entries when stronger authentication is turned on. */
typedef struct _host {
- short family;
- short len;
- unsigned char *addr;
- struct _host *next;
- int requested;
+ short family;
+ short len;
+ unsigned char *addr;
+ struct _host *next;
+ int requested;
} HOST;
#define MakeHost(h,l) (h)=malloc(sizeof *(h)+(l));\
@@ -227,9 +226,9 @@ static int ActiveInterfaces = 0;
void match_interface(u_long u_lQuery);
/* FamilyServerInterpreted implementation */
-static Bool siAddrMatch(int family, pointer addr, int len, HOST *host,
- ClientPtr client);
-static int siCheckAddr(const char *addrString, int length);
+static Bool siAddrMatch(int family, pointer addr, int len, HOST * host,
+ ClientPtr client);
+static int siCheckAddr(const char *addrString, int length);
static void siTypesInitialize(void);
#if NTDDI_VERSION < NTDDI_VISTA
@@ -316,12 +315,11 @@ int inet_pton(int af, const char *src, void *dst)
*/
void
-EnableLocalHost (void)
+EnableLocalHost(void)
{
- if (!UsingXdmcp)
- {
- LocalHostEnabled = TRUE;
- AddLocalHosts ();
+ if (!UsingXdmcp) {
+ LocalHostEnabled = TRUE;
+ AddLocalHosts();
}
}
@@ -329,15 +327,16 @@ EnableLocalHost (void)
* called when authorization is enabled to keep us secure
*/
void
-DisableLocalHost (void)
+DisableLocalHost(void)
{
HOST *self;
- if (!LocalHostRequested) /* Fix for XFree86 bug #156 */
- LocalHostEnabled = FALSE;
+ if (!LocalHostRequested) /* Fix for XFree86 bug #156 */
+ LocalHostEnabled = FALSE;
for (self = selfhosts; self; self = self->next) {
- if (!self->requested) /* Fix for XFree86 bug #156 */
- (void) RemoveHost ((ClientPtr)NULL, self->family, self->len, (pointer)self->addr);
+ if (!self->requested) /* Fix for XFree86 bug #156 */
+ (void) RemoveHost((ClientPtr) NULL, self->family, self->len,
+ (pointer) self->addr);
}
}
@@ -347,19 +346,18 @@ DisableLocalHost (void)
*/
void
-AccessUsingXdmcp (void)
+AccessUsingXdmcp(void)
{
UsingXdmcp = TRUE;
LocalHostEnabled = FALSE;
}
-
#if defined(SVR4) && !defined(sun) && defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF)
/* Deal with different SIOCGIFCONF ioctl semantics on these OSs */
static int
-ifioctl (int fd, int cmd, char *arg)
+ifioctl(int fd, int cmd, char *arg)
{
struct strioctl ioc;
int ret;
@@ -367,20 +365,18 @@ ifioctl (int fd, int cmd, char *arg)
memset((char *) &ioc, 0, sizeof(ioc));
ioc.ic_cmd = cmd;
ioc.ic_timout = 0;
- if (cmd == SIOCGIFCONF)
- {
- ioc.ic_len = ((struct ifconf *) arg)->ifc_len;
- ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf;
+ if (cmd == SIOCGIFCONF) {
+ ioc.ic_len = ((struct ifconf *) arg)->ifc_len;
+ ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf;
}
- else
- {
- ioc.ic_len = sizeof(struct ifreq);
- ioc.ic_dp = arg;
+ else {
+ ioc.ic_len = sizeof(struct ifreq);
+ ioc.ic_dp = arg;
}
ret = ioctl(fd, I_STR, (char *) &ioc);
if (ret >= 0 && cmd == SIOCGIFCONF)
#ifdef SVR4
- ((struct ifconf *) arg)->ifc_len = ioc.ic_len;
+ ((struct ifconf *) arg)->ifc_len = ioc.ic_len;
#endif
return ret;
}
@@ -395,23 +391,23 @@ ifioctl (int fd, int cmd, char *arg)
* for this fd and add them to the selfhosts list.
*/
-#if !defined(SIOCGIFCONF)
+#if !defined(SIOCGIFCONF)
void
-DefineSelf (int fd, const int protocol)
+DefineSelf(int fd, const int protocol)
{
#if !defined(TCPCONN) && !defined(STREAMSCONN) && !defined(UNIXCONN)
return;
#else
- int len;
- caddr_t addr;
- int family;
- register HOST *host;
+ int len;
+ caddr_t addr;
+ int family;
+ register HOST *host;
#ifndef WIN32
struct utsname name;
#else
struct {
- char nodename[512];
+ char nodename[512];
} name;
HOST ha;
struct addrinfo *addresses;
@@ -419,19 +415,20 @@ DefineSelf (int fd, const int protocol)
struct addrinfo hints;
#endif
- register struct hostent *hp;
+ register struct hostent *hp;
union {
- struct sockaddr sa;
- struct sockaddr_in in;
+ struct sockaddr sa;
+ struct sockaddr_in in;
#if defined(IPv6) && defined(AF_INET6)
- struct sockaddr_in6 in6;
+ struct sockaddr_in6 in6;
#endif
} saddr;
-
- struct sockaddr_in *inetaddr;
- struct sockaddr_in6 *inet6addr;
+
+ struct sockaddr_in *inetaddr;
+ struct sockaddr_in6 *inet6addr;
struct sockaddr_in broad_addr;
+
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
#endif
@@ -454,52 +451,52 @@ DefineSelf (int fd, const int protocol)
if (getaddrinfo(name.nodename, NULL, &hints, &addresses) != 0) goto CarryOnTheOldWay;
if (protocol == 6) ErrorF ("DefineSelf - %s has IPv%d addresses...\n",
- name.nodename, protocol);
+ name.nodename, protocol);
for (a = addresses; a != NULL; a = a->ai_next) {
- char ad[INET6_ADDRSTRLEN];
- ha.family = a->ai_family;
- if (a->ai_family == AF_INET6) {
- ha.addr = (unsigned char *)
- &((struct sockaddr_in6 *) a->ai_addr)->sin6_addr;
- ha.len =
- sizeof (((struct sockaddr_in6 *) a->ai_addr)->sin6_addr);
- } else {
- ha.addr = (unsigned char *)
- &((struct sockaddr_in *) a->ai_addr)->sin_addr;
- ha.len =
- sizeof (((struct sockaddr_in *) a->ai_addr)->sin_addr);
- }
- inet_ntop(ha.family, ha.addr, ad, sizeof(ad));
-
- if (ha.family == AF_INET6) {
- ErrorF(" %s", ad);
- saddr.sa.sa_family = AF_INET6;
- inet6addr = (struct sockaddr_in6 *) (&(saddr.sa));
- memcpy (&(inet6addr->sin6_addr), ha.addr, ha.len);
- len = sizeof(saddr.in6);
- family = ConvertAddr (&(saddr.sa), &len, (pointer *)&addr);
- if ( family != -1 && family != FamilyLocal ) {
- for (host = selfhosts;
- host && !addrEqual (family, addr, len, host);
- host = host->next) ;
- if (!host) {
- /* add this host to the host list. */
- MakeHost(host,len)
- if (host) {
- host->family = family;
- host->len = len;
- memcpy (host->addr, addr, len);
- host->next = selfhosts;
- selfhosts = host;
- }
- if (family == FamilyInternet6 &&
- !(IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))) {
- XdmcpRegisterConnection (family, (char *)addr, len);
- }
- }
- }
- }
+ char ad[INET6_ADDRSTRLEN];
+ ha.family = a->ai_family;
+ if (a->ai_family == AF_INET6) {
+ ha.addr = (unsigned char *)
+ &((struct sockaddr_in6 *) a->ai_addr)->sin6_addr;
+ ha.len =
+ sizeof (((struct sockaddr_in6 *) a->ai_addr)->sin6_addr);
+ } else {
+ ha.addr = (unsigned char *)
+ &((struct sockaddr_in *) a->ai_addr)->sin_addr;
+ ha.len =
+ sizeof (((struct sockaddr_in *) a->ai_addr)->sin_addr);
+ }
+ inet_ntop(ha.family, ha.addr, ad, sizeof(ad));
+
+ if (ha.family == AF_INET6) {
+ ErrorF(" %s", ad);
+ saddr.sa.sa_family = AF_INET6;
+ inet6addr = (struct sockaddr_in6 *) (&(saddr.sa));
+ memcpy (&(inet6addr->sin6_addr), ha.addr, ha.len);
+ len = sizeof(saddr.in6);
+ family = ConvertAddr (&(saddr.sa), &len, (pointer *)&addr);
+ if ( family != -1 && family != FamilyLocal ) {
+ for (host = selfhosts;
+ host && !addrEqual (family, addr, len, host);
+ host = host->next) ;
+ if (!host) {
+ /* add this host to the host list. */
+ MakeHost(host,len)
+ if (host) {
+ host->family = family;
+ host->len = len;
+ memcpy (host->addr, addr, len);
+ host->next = selfhosts;
+ selfhosts = host;
+ }
+ if (family == FamilyInternet6 &&
+ !(IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))) {
+ XdmcpRegisterConnection (family, (char *)addr, len);
+ }
+ }
+ }
+ }
}
if (protocol == 6) ErrorF ("\n");
freeaddrinfo(addresses);
@@ -508,120 +505,111 @@ DefineSelf (int fd, const int protocol)
CarryOnTheOldWay:
hp = _XGethostbyname(name.nodename, hparams);
- if (hp != NULL)
- {
- int i = 0, j = 0;
- IN_ADDR Inter;
- saddr.sa.sa_family = hp->h_addrtype;
- switch (hp->h_addrtype) {
- case AF_INET:
- if (protocol == 6) return; /* We should not be here: gethostbyname() is useless with inet6! */
- inetaddr = (struct sockaddr_in *) (&(saddr.sa));
- if (!pInterfaces) match_interface(0);
- if (ActiveInterfaces && pInterfaces && *pInterfaces)
- {
- ErrorF ("DefineSelf - %s has %d usable IPv%d interface%s...\n address%s",
- name.nodename, ActiveInterfaces, protocol,
- ActiveInterfaces==1 ? "" : "s",
- ActiveInterfaces==1 ? "" : "es");
- for (i = 0; hp->h_addr_list[i]; i++)
- {
- Inter.S_un.S_addr = *(u_long *)hp->h_addr_list[i];
- ErrorF(" %s", inet_ntoa(Inter));
- if (*pInterfaces == *(u_long *)hp->h_addr_list[i]) j = i;
- }
- ErrorF ("\n");
- }
- break;
+ if (hp != NULL) {
+ int i = 0, j = 0;
+ IN_ADDR Inter;
+ saddr.sa.sa_family = hp->h_addrtype;
+ switch (hp->h_addrtype) {
+ case AF_INET:
+ if (protocol == 6) return; /* We should not be here: gethostbyname() is useless with inet6! */
+ inetaddr = (struct sockaddr_in *) (&(saddr.sa));
+ if (!pInterfaces) match_interface(0);
+ if (ActiveInterfaces && pInterfaces && *pInterfaces)
+ {
+ ErrorF ("DefineSelf - %s has %d usable IPv%d interface%s...\n address%s",
+ name.nodename, ActiveInterfaces, protocol,
+ ActiveInterfaces==1 ? "" : "s",
+ ActiveInterfaces==1 ? "" : "es");
+ for (i = 0; hp->h_addr_list[i]; i++)
+ {
+ Inter.S_un.S_addr = *(u_long *)hp->h_addr_list[i];
+ ErrorF(" %s", inet_ntoa(Inter));
+ if (*pInterfaces == *(u_long *)hp->h_addr_list[i]) j = i;
+ }
+ ErrorF ("\n");
+ }
+ break;
#if 0 /* We never used to get here and AF_INET6 is now processed by getaddrinfo() */
- case AF_INET6:
- inet6addr = (struct sockaddr_in6 *) (&(saddr.sa));
- memcpy ( &(inet6addr->sin6_addr), hp->h_addr, hp->h_length);
- len = sizeof(saddr.in6);
- break;
-#endif
- default:
- goto DefineLocalHost;
- }
+ case AF_INET6:
+ inet6addr = (struct sockaddr_in6 *) (&(saddr.sa));
+ memcpy(&(inet6addr->sin6_addr), hp->h_addr, hp->h_length);
+ len = sizeof(saddr.in6);
+ break;
+#endif
+ default:
+ goto DefineLocalHost;
+ }
- for (i = -1; i < 0 || hp->h_addr_list[i]; i++)
- {
- if (i < 0) memcpy ( &(inetaddr->sin_addr), hp->h_addr_list[j], hp->h_length);
- else if (i == j) continue;
- else memcpy ( &(inetaddr->sin_addr), hp->h_addr_list[i], hp->h_length);
- len = sizeof(saddr.sa);
- family = ConvertAddr ( &(saddr.sa), &len, (pointer *)&addr);
- if ( family != -1 && family != FamilyLocal )
- {
- for (host = selfhosts;
- host && !addrEqual (family, addr, len, host);
- host = host->next) ;
- if (!host)
- {
- /* add this host to the host list. */
- MakeHost(host,len)
- if (host)
- {
- host->family = family;
- host->len = len;
- memcpy ( host->addr, addr, len);
- host->next = selfhosts;
- selfhosts = host;
- }
- #ifdef XDMCP
- /*
- * If this is an Internet Address, but not the localhost
- * address (127.0.0.1), nor the bogus address (0.0.0.0),
- * register it.
- */
- if (family == FamilyInternet &&
- !(len == 4 &&
- ((addr[0] == 127) ||
- (addr[0] == 0 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 0)))
- )
- {
- XdmcpRegisterConnection (family, (char *)addr, len);
- broad_addr = *inetaddr;
- ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr =
- htonl (INADDR_BROADCAST);
- XdmcpRegisterBroadcastAddress ((struct sockaddr_in *)
- &broad_addr);
- }
- #if defined(IPv6) && defined(AF_INET6)
- else if (family == FamilyInternet6 &&
- !(IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr)))
- {
- XdmcpRegisterConnection (family, (char *)addr, len);
- }
- #endif
+ for (i = -1; i < 0 || hp->h_addr_list[i]; i++)
+ {
+ if (i < 0) memcpy ( &(inetaddr->sin_addr), hp->h_addr_list[j], hp->h_length);
+ else if (i == j) continue;
+ else memcpy ( &(inetaddr->sin_addr), hp->h_addr_list[i], hp->h_length);
+ len = sizeof(saddr.sa);
+ family = ConvertAddr(&(saddr.sa), &len, (pointer *) &addr);
+ if ( family != -1 && family != FamilyLocal ) {
+ for (host = selfhosts;
+ host && !addrEqual (family, addr, len, host);
+ host = host->next) ;
+ if (!host) {
+ /* add this host to the host list. */
+ MakeHost(host,len)
+ if (host) {
+ host->family = family;
+ host->len = len;
+ memcpy ( host->addr, addr, len);
+ host->next = selfhosts;
+ selfhosts = host;
+ }
+ #ifdef XDMCP
+ /*
+ * If this is an Internet Address, but not the localhost
+ * address (127.0.0.1), nor the bogus address (0.0.0.0),
+ * register it.
+ */
+ if (family == FamilyInternet &&
+ !(len == 4 &&
+ ((addr[0] == 127) ||
+ (addr[0] == 0 && addr[1] == 0 &&
+ addr[2] == 0 && addr[3] == 0)))
+ ) {
+ XdmcpRegisterConnection (family, (char *)addr, len);
+ broad_addr = *inetaddr;
+ ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr =
+ htonl(INADDR_BROADCAST);
+ XdmcpRegisterBroadcastAddress ((struct sockaddr_in *)
+ &broad_addr);
+ }
+ #if defined(IPv6) && defined(AF_INET6)
+ else if (family == FamilyInternet6 &&
+ !(IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))) {
+ XdmcpRegisterConnection (family, (char *)addr, len);
+ }
+ #endif
- #endif /* XDMCP */
- }
- }
- }
+ #endif /* XDMCP */
+ }
+ }
+ }
}
/*
* now add a host of family FamilyLocalHost...
*/
-DefineLocalHost:
+ DefineLocalHost:
free(pInterfaces);
for (host = selfhosts;
- host && !addrEqual(FamilyLocalHost, "", 0, host);
- host = host->next);
- if (!host)
- {
- MakeHost(host, 0);
- if (host)
- {
- host->family = FamilyLocalHost;
- host->len = 0;
- /* Nothing to store in host->addr */
- host->next = selfhosts;
- selfhosts = host;
- }
+ host && !addrEqual(FamilyLocalHost, "", 0, host); host = host->next);
+ if (!host) {
+ MakeHost(host, 0);
+ if (host) {
+ host->family = FamilyLocalHost;
+ host->len = 0;
+ /* Nothing to store in host->addr */
+ host->next = selfhosts;
+ selfhosts = host;
+ }
}
-#endif /* !TCPCONN && !STREAMSCONN && !UNIXCONN */
+#endif /* !TCPCONN && !STREAMSCONN && !UNIXCONN */
}
#else
@@ -651,58 +639,60 @@ static void
in6_fillscopeid(struct sockaddr_in6 *sin6)
{
#if defined(__KAME__)
- if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
- sin6->sin6_scope_id =
- ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]);
- sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0;
- }
+ if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
+ sin6->sin6_scope_id =
+ ntohs(*(u_int16_t *) & sin6->sin6_addr.s6_addr[2]);
+ sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0;
+ }
#endif
}
#endif
void
-DefineSelf (int fd)
+DefineSelf(int fd)
{
#ifndef HAVE_GETIFADDRS
- char *cp, *cplim;
-# ifdef USE_SIOCGLIFCONF
+ char *cp, *cplim;
+
+#ifdef USE_SIOCGLIFCONF
struct sockaddr_storage buf[16];
- struct lifconf ifc;
+ struct lifconf ifc;
register struct lifreq *ifr;
-# ifdef SIOCGLIFNUM
- struct lifnum ifn;
-# endif
-# else /* !USE_SIOCGLIFCONF */
- char buf[2048];
- struct ifconf ifc;
+
+#ifdef SIOCGLIFNUM
+ struct lifnum ifn;
+#endif
+#else /* !USE_SIOCGLIFCONF */
+ char buf[2048];
+ struct ifconf ifc;
register struct ifreq *ifr;
-# endif
- void * bufptr = buf;
-#else /* HAVE_GETIFADDRS */
- struct ifaddrs * ifap, *ifr;
-#endif
- int len;
- unsigned char * addr;
- int family;
- register HOST *host;
-
+#endif
+ void *bufptr = buf;
+#else /* HAVE_GETIFADDRS */
+ struct ifaddrs *ifap, *ifr;
+#endif
+ int len;
+ unsigned char *addr;
+ int family;
+ register HOST *host;
+
#ifndef HAVE_GETIFADDRS
len = sizeof(buf);
#ifdef USE_SIOCGLIFCONF
-
+
#ifdef SIOCGLIFNUM
ifn.lifn_family = AF_UNSPEC;
ifn.lifn_flags = 0;
- if (ioctl (fd, SIOCGLIFNUM, (char *) &ifn) < 0)
- ErrorF ("Getting interface count: %s\n", strerror(errno));
+ if (ioctl(fd, SIOCGLIFNUM, (char *) &ifn) < 0)
+ ErrorF("Getting interface count: %s\n", strerror(errno));
if (len < (ifn.lifn_count * sizeof(struct lifreq))) {
- len = ifn.lifn_count * sizeof(struct lifreq);
- bufptr = malloc(len);
+ len = ifn.lifn_count * sizeof(struct lifreq);
+ bufptr = malloc(len);
}
#endif
-
+
ifc.lifc_family = AF_UNSPEC;
ifc.lifc_flags = 0;
ifc.lifc_len = len;
@@ -714,7 +704,7 @@ DefineSelf (int fd)
#define IFR_IFR_ADDR ifr->lifr_addr
#define IFR_IFR_NAME ifr->lifr_name
-#else /* Use SIOCGIFCONF */
+#else /* Use SIOCGIFCONF */
ifc.ifc_len = len;
ifc.ifc_buf = bufptr;
@@ -725,248 +715,233 @@ DefineSelf (int fd)
#define IFR_IFR_NAME ifr->ifr_name
#endif
- if (ifioctl (fd, IFC_IOCTL_REQ, (pointer) &ifc) < 0)
- ErrorF ("Getting interface configuration (4): %s\n", strerror(errno));
+ if (ifioctl(fd, IFC_IOCTL_REQ, (pointer) &ifc) < 0)
+ ErrorF("Getting interface configuration (4): %s\n", strerror(errno));
cplim = (char *) IFC_IFC_REQ + IFC_IFC_LEN;
-
- for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size (ifr))
- {
- ifr = (ifr_type *) cp;
- len = ifraddr_size (IFR_IFR_ADDR);
- family = ConvertAddr ((struct sockaddr *) &IFR_IFR_ADDR,
- &len, (pointer *)&addr);
+
+ for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size(ifr)) {
+ ifr = (ifr_type *) cp;
+ len = ifraddr_size(IFR_IFR_ADDR);
+ family = ConvertAddr((struct sockaddr *) &IFR_IFR_ADDR,
+ &len, (pointer *) &addr);
if (family == -1 || family == FamilyLocal)
- continue;
+ continue;
#if defined(IPv6) && defined(AF_INET6)
- if (family == FamilyInternet6)
- in6_fillscopeid((struct sockaddr_in6 *)&IFR_IFR_ADDR);
+ if (family == FamilyInternet6)
+ in6_fillscopeid((struct sockaddr_in6 *) &IFR_IFR_ADDR);
#endif
for (host = selfhosts;
- host && !addrEqual (family, addr, len, host);
- host = host->next)
- ;
+ host && !addrEqual(family, addr, len, host); host = host->next);
if (host)
- continue;
- MakeHost(host,len)
- if (host)
- {
- host->family = family;
- host->len = len;
- memcpy(host->addr, addr, len);
- host->next = selfhosts;
- selfhosts = host;
- }
+ continue;
+ MakeHost(host, len)
+ if (host) {
+ host->family = family;
+ host->len = len;
+ memcpy(host->addr, addr, len);
+ host->next = selfhosts;
+ selfhosts = host;
+ }
#ifdef XDMCP
- {
+ {
#ifdef USE_SIOCGLIFCONF
- struct sockaddr_storage broad_addr;
+ struct sockaddr_storage broad_addr;
#else
- struct sockaddr broad_addr;
+ struct sockaddr broad_addr;
#endif
- /*
- * If this isn't an Internet Address, don't register it.
- */
- if (family != FamilyInternet
+ /*
+ * If this isn't an Internet Address, don't register it.
+ */
+ if (family != FamilyInternet
#if defined(IPv6) && defined(AF_INET6)
- && family != FamilyInternet6
-#endif
- )
- continue;
-
- /*
- * ignore 'localhost' entries as they're not useful
- * on the other end of the wire
- */
- if (family == FamilyInternet &&
- addr[0] == 127 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 1)
- continue;
+ && family != FamilyInternet6
+#endif
+ )
+ continue;
+
+ /*
+ * ignore 'localhost' entries as they're not useful
+ * on the other end of the wire
+ */
+ if (family == FamilyInternet &&
+ addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1)
+ continue;
#if defined(IPv6) && defined(AF_INET6)
- else if (family == FamilyInternet6 &&
- IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))
- continue;
+ else if (family == FamilyInternet6 &&
+ IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
+ continue;
#endif
- /*
- * Ignore '0.0.0.0' entries as they are
- * returned by some OSes for unconfigured NICs but they are
- * not useful on the other end of the wire.
- */
- if (len == 4 &&
- addr[0] == 0 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 0)
- continue;
+ /*
+ * Ignore '0.0.0.0' entries as they are
+ * returned by some OSes for unconfigured NICs but they are
+ * not useful on the other end of the wire.
+ */
+ if (len == 4 &&
+ addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && addr[3] == 0)
+ continue;
- XdmcpRegisterConnection (family, (char *)addr, len);
+ XdmcpRegisterConnection(family, (char *) addr, len);
#if defined(IPv6) && defined(AF_INET6)
- /* IPv6 doesn't support broadcasting, so we drop out here */
- if (family == FamilyInternet6)
- continue;
+ /* IPv6 doesn't support broadcasting, so we drop out here */
+ if (family == FamilyInternet6)
+ continue;
#endif
- broad_addr = IFR_IFR_ADDR;
+ broad_addr = IFR_IFR_ADDR;
- ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr =
- htonl (INADDR_BROADCAST);
+ ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr =
+ htonl(INADDR_BROADCAST);
#if defined(USE_SIOCGLIFCONF) && defined(SIOCGLIFBRDADDR)
- {
- struct lifreq broad_req;
-
- broad_req = *ifr;
- if (ioctl (fd, SIOCGLIFFLAGS, (char *) &broad_req) != -1 &&
- (broad_req.lifr_flags & IFF_BROADCAST) &&
- (broad_req.lifr_flags & IFF_UP)
- )
- {
- broad_req = *ifr;
- if (ioctl (fd, SIOCGLIFBRDADDR, &broad_req) != -1)
- broad_addr = broad_req.lifr_broadaddr;
- else
- continue;
- }
- else
- continue;
- }
+ {
+ struct lifreq broad_req;
+
+ broad_req = *ifr;
+ if (ioctl(fd, SIOCGLIFFLAGS, (char *) &broad_req) != -1 &&
+ (broad_req.lifr_flags & IFF_BROADCAST) &&
+ (broad_req.lifr_flags & IFF_UP)
+ ) {
+ broad_req = *ifr;
+ if (ioctl(fd, SIOCGLIFBRDADDR, &broad_req) != -1)
+ broad_addr = broad_req.lifr_broadaddr;
+ else
+ continue;
+ }
+ else
+ continue;
+ }
#elif defined(SIOCGIFBRDADDR)
- {
- struct ifreq broad_req;
-
- broad_req = *ifr;
- if (ifioctl (fd, SIOCGIFFLAGS, (pointer) &broad_req) != -1 &&
- (broad_req.ifr_flags & IFF_BROADCAST) &&
- (broad_req.ifr_flags & IFF_UP)
- )
- {
- broad_req = *ifr;
- if (ifioctl (fd, SIOCGIFBRDADDR, (pointer) &broad_req) != -1)
- broad_addr = broad_req.ifr_addr;
- else
- continue;
- }
- else
- continue;
- }
-#endif /* SIOCGIFBRDADDR */
- XdmcpRegisterBroadcastAddress ((struct sockaddr_in *) &broad_addr);
- }
-#endif /* XDMCP */
+ {
+ struct ifreq broad_req;
+
+ broad_req = *ifr;
+ if (ifioctl(fd, SIOCGIFFLAGS, (pointer) &broad_req) != -1 &&
+ (broad_req.ifr_flags & IFF_BROADCAST) &&
+ (broad_req.ifr_flags & IFF_UP)
+ ) {
+ broad_req = *ifr;
+ if (ifioctl(fd, SIOCGIFBRDADDR, (pointer) &broad_req) != -1)
+ broad_addr = broad_req.ifr_addr;
+ else
+ continue;
+ }
+ else
+ continue;
+ }
+#endif /* SIOCGIFBRDADDR */
+ XdmcpRegisterBroadcastAddress((struct sockaddr_in *) &broad_addr);
+ }
+#endif /* XDMCP */
}
if (bufptr != buf)
- free(bufptr);
-#else /* HAVE_GETIFADDRS */
+ free(bufptr);
+#else /* HAVE_GETIFADDRS */
if (getifaddrs(&ifap) < 0) {
- ErrorF("Warning: getifaddrs returns %s\n", strerror(errno));
- return;
+ ErrorF("Warning: getifaddrs returns %s\n", strerror(errno));
+ return;
}
for (ifr = ifap; ifr != NULL; ifr = ifr->ifa_next) {
if (!ifr->ifa_addr)
continue;
- len = sizeof(*(ifr->ifa_addr));
- family = ConvertAddr((struct sockaddr *) ifr->ifa_addr, &len,
- (pointer *)&addr);
- if (family == -1 || family == FamilyLocal)
- continue;
+ len = sizeof(*(ifr->ifa_addr));
+ family = ConvertAddr((struct sockaddr *) ifr->ifa_addr, &len,
+ (pointer *) &addr);
+ if (family == -1 || family == FamilyLocal)
+ continue;
#if defined(IPv6) && defined(AF_INET6)
- if (family == FamilyInternet6)
- in6_fillscopeid((struct sockaddr_in6 *)ifr->ifa_addr);
-#endif
-
- for (host = selfhosts;
- host != NULL && !addrEqual(family, addr, len, host);
- host = host->next)
- ;
- if (host != NULL)
- continue;
- MakeHost(host, len);
- if (host != NULL) {
- host->family = family;
- host->len = len;
- memcpy(host->addr, addr, len);
- host->next = selfhosts;
- selfhosts = host;
- }
+ if (family == FamilyInternet6)
+ in6_fillscopeid((struct sockaddr_in6 *) ifr->ifa_addr);
+#endif
+
+ for (host = selfhosts;
+ host != NULL && !addrEqual(family, addr, len, host);
+ host = host->next);
+ if (host != NULL)
+ continue;
+ MakeHost(host, len);
+ if (host != NULL) {
+ host->family = family;
+ host->len = len;
+ memcpy(host->addr, addr, len);
+ host->next = selfhosts;
+ selfhosts = host;
+ }
#ifdef XDMCP
- {
- /*
- * If this isn't an Internet Address, don't register it.
- */
- if (family != FamilyInternet
+ {
+ /*
+ * If this isn't an Internet Address, don't register it.
+ */
+ if (family != FamilyInternet
#if defined(IPv6) && defined(AF_INET6)
- && family != FamilyInternet6
-#endif
- )
- continue;
-
- /*
- * ignore 'localhost' entries as they're not useful
- * on the other end of the wire
- */
- if (ifr->ifa_flags & IFF_LOOPBACK)
- continue;
-
- if (family == FamilyInternet &&
- addr[0] == 127 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 1)
- continue;
-
- /*
- * Ignore '0.0.0.0' entries as they are
- * returned by some OSes for unconfigured NICs but they are
- * not useful on the other end of the wire.
- */
- if (len == 4 &&
- addr[0] == 0 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 0)
- continue;
+ && family != FamilyInternet6
+#endif
+ )
+ continue;
+
+ /*
+ * ignore 'localhost' entries as they're not useful
+ * on the other end of the wire
+ */
+ if (ifr->ifa_flags & IFF_LOOPBACK)
+ continue;
+
+ if (family == FamilyInternet &&
+ addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1)
+ continue;
+
+ /*
+ * Ignore '0.0.0.0' entries as they are
+ * returned by some OSes for unconfigured NICs but they are
+ * not useful on the other end of the wire.
+ */
+ if (len == 4 &&
+ addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && addr[3] == 0)
+ continue;
#if defined(IPv6) && defined(AF_INET6)
- else if (family == FamilyInternet6 &&
- IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))
- continue;
+ else if (family == FamilyInternet6 &&
+ IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
+ continue;
#endif
- XdmcpRegisterConnection(family, (char *)addr, len);
+ XdmcpRegisterConnection(family, (char *) addr, len);
#if defined(IPv6) && defined(AF_INET6)
- if (family == FamilyInternet6)
- /* IPv6 doesn't support broadcasting, so we drop out here */
- continue;
-#endif
- if ((ifr->ifa_flags & IFF_BROADCAST) &&
- (ifr->ifa_flags & IFF_UP) &&
- ifr->ifa_broadaddr)
- XdmcpRegisterBroadcastAddress(
- (struct sockaddr_in *) ifr->ifa_broadaddr);
- else
- continue;
- }
-#endif /* XDMCP */
-
- } /* for */
+ if (family == FamilyInternet6)
+ /* IPv6 doesn't support broadcasting, so we drop out here */
+ continue;
+#endif
+ if ((ifr->ifa_flags & IFF_BROADCAST) &&
+ (ifr->ifa_flags & IFF_UP) && ifr->ifa_broadaddr)
+ XdmcpRegisterBroadcastAddress((struct sockaddr_in *) ifr->
+ ifa_broadaddr);
+ else
+ continue;
+ }
+#endif /* XDMCP */
+
+ } /* for */
freeifaddrs(ifap);
-#endif /* HAVE_GETIFADDRS */
+#endif /* HAVE_GETIFADDRS */
/*
* add something of FamilyLocalHost
*/
for (host = selfhosts;
- host && !addrEqual(FamilyLocalHost, "", 0, host);
- host = host->next);
- if (!host)
- {
- MakeHost(host, 0);
- if (host)
- {
- host->family = FamilyLocalHost;
- host->len = 0;
- /* Nothing to store in host->addr */
- host->next = selfhosts;
- selfhosts = host;
- }
+ host && !addrEqual(FamilyLocalHost, "", 0, host); host = host->next);
+ if (!host) {
+ MakeHost(host, 0);
+ if (host) {
+ host->family = FamilyLocalHost;
+ host->len = 0;
+ /* Nothing to store in host->addr */
+ host->next = selfhosts;
+ selfhosts = host;
+ }
}
}
-#endif /* hpux && !HAVE_IFREQ */
+#endif /* hpux && !HAVE_IFREQ */
#ifdef XDMCP
void
@@ -976,17 +951,16 @@ AugmentSelf(pointer from, int len)
pointer addr;
register HOST *host;
- family = ConvertAddr(from, &len, (pointer *)&addr);
+ family = ConvertAddr(from, &len, (pointer *) &addr);
if (family == -1 || family == FamilyLocal)
- return;
- for (host = selfhosts; host; host = host->next)
- {
- if (addrEqual(family, addr, len, host))
- return;
+ return;
+ for (host = selfhosts; host; host = host->next) {
+ if (addrEqual(family, addr, len, host))
+ return;
}
- MakeHost(host,len)
- if (!host)
- return;
+ MakeHost(host, len)
+ if (!host)
+ return;
host->family = family;
host->len = len;
memcpy(host->addr, addr, len);
@@ -996,188 +970,180 @@ AugmentSelf(pointer from, int len)
#endif
void
-AddLocalHosts (void)
+AddLocalHosts(void)
{
- HOST *self;
+ HOST *self;
for (self = selfhosts; self; self = self->next)
- /* Fix for XFree86 bug #156: pass addingLocal = TRUE to
- * NewHost to tell that we are adding the default local
- * host entries and not to flag the entries as being
- * explicitely requested */
- (void) NewHost (self->family, self->addr, self->len, TRUE);
+ /* Fix for XFree86 bug #156: pass addingLocal = TRUE to
+ * NewHost to tell that we are adding the default local
+ * host entries and not to flag the entries as being
+ * explicitely requested */
+ (void) NewHost(self->family, self->addr, self->len, TRUE);
}
/* Reset access control list to initial hosts */
void
-ResetHosts (char *display)
+ResetHosts(char *display)
{
- register HOST *host;
- char lhostname[120], ohostname[120];
- char *hostname = ohostname;
- char fname[PATH_MAX + 1];
- int fnamelen;
- FILE *fd;
- char *ptr;
- int i, hostlen;
+ register HOST *host;
+ char lhostname[120], ohostname[120];
+ char *hostname = ohostname;
+ char fname[PATH_MAX + 1];
+ int fnamelen;
+ FILE *fd;
+ char *ptr;
+ int i, hostlen;
+
#if (defined(TCPCONN) || defined(STREAMSCONN) ) && \
(!defined(IPv6) || !defined(AF_INET6))
union {
- struct sockaddr sa;
+ struct sockaddr sa;
#if defined(TCPCONN) || defined(STREAMSCONN)
- struct sockaddr_in in;
-#endif /* TCPCONN || STREAMSCONN */
- } saddr;
+ struct sockaddr_in in;
+#endif /* TCPCONN || STREAMSCONN */
+ } saddr;
#endif
- int family = 0;
- pointer addr;
- int len;
+ int family = 0;
+ pointer addr;
+ int len;
siTypesInitialize();
AccessEnabled = defeatAccessControl ? FALSE : DEFAULT_ACCESS_CONTROL;
LocalHostEnabled = FALSE;
- while ((host = validhosts) != 0)
- {
+ while ((host = validhosts) != 0) {
validhosts = host->next;
- FreeHost (host);
+ FreeHost(host);
}
#define ETC_HOST_PREFIX "/etc/X"
#define ETC_HOST_SUFFIX ".hosts"
fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) +
- strlen(display) + 1;
+ strlen(display) + 1;
if (fnamelen > sizeof(fname))
- FatalError("Display name `%s' is too long\n", display);
+ FatalError("Display name `%s' is too long\n", display);
#ifdef __MINGW32__
snprintf(fname, sizeof(fname), "%s%s" ETC_HOST_SUFFIX, getenv("XHOSTPREFIX"),
- display);
+ display);
#else
- snprintf(fname, sizeof(fname), ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX,
- display);
-#endif
-
- if ((fd = fopen (fname, "r")) != 0)
- {
- while (fgets (ohostname, sizeof (ohostname), fd))
- {
- family = FamilyWild;
- if (*ohostname == '#')
- continue;
- if ((ptr = strchr(ohostname, '\n')) != 0)
- *ptr = 0;
- hostlen = strlen(ohostname) + 1;
- for (i = 0; i < hostlen; i++)
- lhostname[i] = tolower(ohostname[i]);
- hostname = ohostname;
- if (!strncmp("local:", lhostname, 6))
- {
- family = FamilyLocalHost;
- NewHost(family, "", 0, FALSE);
- LocalHostRequested = TRUE; /* Fix for XFree86 bug #156 */
- }
+ snprintf(fname, sizeof(fname), ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX,
+ display);
+#endif
+
+ if ((fd = fopen(fname, "r")) != 0) {
+ while (fgets(ohostname, sizeof(ohostname), fd)) {
+ family = FamilyWild;
+ if (*ohostname == '#')
+ continue;
+ if ((ptr = strchr(ohostname, '\n')) != 0)
+ *ptr = 0;
+ hostlen = strlen(ohostname) + 1;
+ for (i = 0; i < hostlen; i++)
+ lhostname[i] = tolower(ohostname[i]);
+ hostname = ohostname;
+ if (!strncmp("local:", lhostname, 6)) {
+ family = FamilyLocalHost;
+ NewHost(family, "", 0, FALSE);
+ LocalHostRequested = TRUE; /* Fix for XFree86 bug #156 */
+ }
#if defined(TCPCONN) || defined(STREAMSCONN)
- else if (!strncmp("inet:", lhostname, 5))
- {
- family = FamilyInternet;
- hostname = ohostname + 5;
- }
+ else if (!strncmp("inet:", lhostname, 5)) {
+ family = FamilyInternet;
+ hostname = ohostname + 5;
+ }
#if defined(IPv6) && defined(AF_INET6)
- else if (!strncmp("inet6:", lhostname, 6))
- {
- family = FamilyInternet6;
- hostname = ohostname + 6;
- }
+ else if (!strncmp("inet6:", lhostname, 6)) {
+ family = FamilyInternet6;
+ hostname = ohostname + 6;
+ }
#endif
#endif
#ifdef SECURE_RPC
- else if (!strncmp("nis:", lhostname, 4))
- {
- family = FamilyNetname;
- hostname = ohostname + 4;
- }
-#endif
- else if (!strncmp("si:", lhostname, 3))
- {
- family = FamilyServerInterpreted;
- hostname = ohostname + 3;
- hostlen -= 3;
- }
-
-
- if (family == FamilyServerInterpreted)
- {
- len = siCheckAddr(hostname, hostlen);
- if (len >= 0) {
- NewHost(family, hostname, len, FALSE);
- }
- }
- else
+ else if (!strncmp("nis:", lhostname, 4)) {
+ family = FamilyNetname;
+ hostname = ohostname + 4;
+ }
+#endif
+ else if (!strncmp("si:", lhostname, 3)) {
+ family = FamilyServerInterpreted;
+ hostname = ohostname + 3;
+ hostlen -= 3;
+ }
+
+ if (family == FamilyServerInterpreted) {
+ len = siCheckAddr(hostname, hostlen);
+ if (len >= 0) {
+ NewHost(family, hostname, len, FALSE);
+ }
+ }
+ else
#ifdef SECURE_RPC
- if ((family == FamilyNetname) || (strchr(hostname, '@')))
- {
- SecureRPCInit ();
- (void) NewHost (FamilyNetname, hostname, strlen (hostname), FALSE);
- }
- else
-#endif /* SECURE_RPC */
+ if ((family == FamilyNetname) || (strchr(hostname, '@'))) {
+ SecureRPCInit();
+ (void) NewHost(FamilyNetname, hostname, strlen(hostname),
+ FALSE);
+ }
+ else
+#endif /* SECURE_RPC */
#if defined(TCPCONN) || defined(STREAMSCONN)
- {
-#if defined(IPv6) && defined(AF_INET6)
- if ( (family == FamilyInternet) || (family == FamilyInternet6) ||
- (family == FamilyWild) )
{
- struct addrinfo *addresses;
- struct addrinfo *a;
- struct addrinfo hints;
- int f;
-
- memset( &hints, 0, sizeof(hints) );
- if (family == FamilyInternet) hints.ai_family = AF_INET;
- else if (family == FamilyInternet6) hints.ai_family = AF_INET6;
- if (getaddrinfo(hostname, NULL, &hints, &addresses) == 0) {
- for (a = addresses ; a != NULL ; a = a->ai_next) {
- len = a->ai_addrlen;
- f = ConvertAddr(a->ai_addr,&len,(pointer *)&addr);
- if ( (family == f) ||
- ((family == FamilyWild) && (f != -1)) ) {
- NewHost(f, addr, len, FALSE);
- }
- }
- freeaddrinfo(addresses);
- }
- }
+#if defined(IPv6) && defined(AF_INET6)
+ if ((family == FamilyInternet) || (family == FamilyInternet6) ||
+ (family == FamilyWild)) {
+ struct addrinfo *addresses;
+ struct addrinfo *a;
+ struct addrinfo hints;
+ int f;
+
+ memset( &hints, 0, sizeof(hints) );
+ if (family == FamilyInternet) hints.ai_family = AF_INET;
+ else if (family == FamilyInternet6) hints.ai_family = AF_INET6;
+ if (getaddrinfo(hostname, NULL, &hints, &addresses) == 0) {
+ for (a = addresses; a != NULL; a = a->ai_next) {
+ len = a->ai_addrlen;
+ f = ConvertAddr(a->ai_addr, &len,
+ (pointer *) &addr);
+ if ((family == f) ||
+ ((family == FamilyWild) && (f != -1))) {
+ NewHost(f, addr, len, FALSE);
+ }
+ }
+ freeaddrinfo(addresses);
+ }
+ }
#else
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
- _Xgethostbynameparams hparams;
-#endif
- register struct hostent *hp;
-
- /* host name */
- if ((family == FamilyInternet &&
- ((hp = _XGethostbyname(hostname, hparams)) != 0)) ||
- ((hp = _XGethostbyname(hostname, hparams)) != 0))
- {
- saddr.sa.sa_family = hp->h_addrtype;
- len = sizeof(saddr.sa);
- if ((family = ConvertAddr (&saddr.sa, &len, (pointer *)&addr)) != -1)
- {
-#ifdef h_addr /* new 4.3bsd version of gethostent */
- char **list;
-
- /* iterate over the addresses */
- for (list = hp->h_addr_list; *list; list++)
- (void) NewHost (family, (pointer)*list, len, FALSE);
+ _Xgethostbynameparams hparams;
+#endif
+ register struct hostent *hp;
+
+ /* host name */
+ if ((family == FamilyInternet &&
+ ((hp = _XGethostbyname(hostname, hparams)) != 0)) ||
+ ((hp = _XGethostbyname(hostname, hparams)) != 0)) {
+ saddr.sa.sa_family = hp->h_addrtype;
+ len = sizeof(saddr.sa);
+ if ((family =
+ ConvertAddr(&saddr.sa, &len,
+ (pointer *) &addr)) != -1) {
+#ifdef h_addr /* new 4.3bsd version of gethostent */
+ char **list;
+
+ /* iterate over the addresses */
+ for (list = hp->h_addr_list; *list; list++)
+ (void) NewHost(family, (pointer) *list, len, FALSE);
#else
- (void) NewHost (family, (pointer)hp->h_addr, len, FALSE);
-#endif
- }
- }
-#endif /* IPv6 */
- }
-#endif /* TCPCONN || STREAMSCONN */
- family = FamilyWild;
+ (void) NewHost(family, (pointer) hp->h_addr, len,
+ FALSE);
+#endif
+ }
+ }
+#endif /* IPv6 */
+ }
+#endif /* TCPCONN || STREAMSCONN */
+ family = FamilyWild;
}
- fclose (fd);
+ fclose(fd);
}
}
@@ -1185,46 +1151,43 @@ ResetHosts (char *display)
Bool
ComputeLocalClient(ClientPtr client)
{
- int alen, family, notused;
- Xtransaddr *from = NULL;
- pointer addr;
- register HOST *host;
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
+ int alen, family, notused;
+ Xtransaddr *from = NULL;
+ pointer addr;
+ register HOST *host;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
if (!oc->trans_conn)
return FALSE;
- if (!_XSERVTransGetPeerAddr (oc->trans_conn, &notused, &alen, &from))
- {
- family = ConvertAddr ((struct sockaddr *) from,
- &alen, (pointer *)&addr);
- if (family == -1)
- {
- free(from);
- return FALSE;
- }
- if (family == FamilyLocal)
- {
- free(from);
- return TRUE;
- }
- for (host = selfhosts; host; host = host->next)
- {
- if (addrEqual (family, addr, alen, host)) {
- free(from);
- return TRUE;
- }
- }
- free(from);
+ if (!_XSERVTransGetPeerAddr(oc->trans_conn, &notused, &alen, &from)) {
+ family = ConvertAddr((struct sockaddr *) from,
+ &alen, (pointer *) &addr);
+ if (family == -1) {
+ free(from);
+ return FALSE;
+ }
+ if (family == FamilyLocal) {
+ free(from);
+ return TRUE;
+ }
+ for (host = selfhosts; host; host = host->next) {
+ if (addrEqual(family, addr, alen, host)) {
+ free(from);
+ return TRUE;
+ }
+ }
+ free(from);
}
return FALSE;
}
-Bool LocalClient(ClientPtr client)
+Bool
+LocalClient(ClientPtr client)
{
if (!client->osPrivate)
return FALSE;
- return ((OsCommPtr)client->osPrivate)->local_client;
+ return ((OsCommPtr) client->osPrivate)->local_client;
}
/*
@@ -1239,17 +1202,17 @@ LocalClientCred(ClientPtr client, int *pUid, int *pGid)
int ret = GetLocalClientCreds(client, &lcc);
if (ret == 0) {
-#ifdef HAVE_GETZONEID /* only local if in the same zone */
- if ((lcc->fieldsSet & LCC_ZID_SET) && (lcc->zoneid != getzoneid())) {
- FreeLocalClientCreds(lcc);
- return -1;
- }
-#endif
- if ((lcc->fieldsSet & LCC_UID_SET) && (pUid != NULL))
- *pUid = lcc->euid;
- if ((lcc->fieldsSet & LCC_GID_SET) && (pGid != NULL))
- *pGid = lcc->egid;
- FreeLocalClientCreds(lcc);
+#ifdef HAVE_GETZONEID /* only local if in the same zone */
+ if ((lcc->fieldsSet & LCC_ZID_SET) && (lcc->zoneid != getzoneid())) {
+ FreeLocalClientCreds(lcc);
+ return -1;
+ }
+#endif
+ if ((lcc->fieldsSet & LCC_UID_SET) && (pUid != NULL))
+ *pUid = lcc->euid;
+ if ((lcc->fieldsSet & LCC_GID_SET) && (pGid != NULL))
+ *pGid = lcc->egid;
+ FreeLocalClientCreds(lcc);
}
return ret;
}
@@ -1262,12 +1225,13 @@ LocalClientCred(ClientPtr client, int *pUid, int *pGid)
* Used by AuthAudit to log who local connections came from
*/
int
-GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp)
+GetLocalClientCreds(ClientPtr client, LocalClientCredRec ** lccp)
{
#if defined(HAVE_GETPEEREID) || defined(HAVE_GETPEERUCRED) || defined(SO_PEERCRED)
int fd;
XtransConnInfo ci;
LocalClientCredRec *lcc;
+
#ifdef HAVE_GETPEEREID
uid_t uid;
gid_t gid;
@@ -1280,28 +1244,28 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp)
#endif
if (client == NULL)
- return -1;
- ci = ((OsCommPtr)client->osPrivate)->trans_conn;
+ return -1;
+ ci = ((OsCommPtr) client->osPrivate)->trans_conn;
#if !(defined(sun) && defined(HAVE_GETPEERUCRED))
/* Most implementations can only determine peer credentials for Unix
* domain sockets - Solaris getpeerucred can work with a bit more, so
* we just let it tell us if the connection type is supported or not
*/
if (!_XSERVTransIsLocal(ci)) {
- return -1;
+ return -1;
}
#endif
*lccp = calloc(1, sizeof(LocalClientCredRec));
if (*lccp == NULL)
- return -1;
+ return -1;
lcc = *lccp;
-
+
fd = _XSERVTransGetConnectionNumber(ci);
#ifdef HAVE_GETPEEREID
if (getpeereid(fd, &uid, &gid) == -1) {
- FreeLocalClientCreds(lcc);
- return -1;
+ FreeLocalClientCreds(lcc);
+ return -1;
}
lcc->euid = uid;
lcc->egid = gid;
@@ -1309,43 +1273,46 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp)
return 0;
#elif defined(HAVE_GETPEERUCRED)
if (getpeerucred(fd, &peercred) < 0) {
- FreeLocalClientCreds(lcc);
- return -1;
+ FreeLocalClientCreds(lcc);
+ return -1;
}
lcc->euid = ucred_geteuid(peercred);
if (lcc->euid != -1)
- lcc->fieldsSet |= LCC_UID_SET;
+ lcc->fieldsSet |= LCC_UID_SET;
lcc->egid = ucred_getegid(peercred);
if (lcc->egid != -1)
- lcc->fieldsSet |= LCC_GID_SET;
+ lcc->fieldsSet |= LCC_GID_SET;
lcc->pid = ucred_getpid(peercred);
if (lcc->pid != -1)
- lcc->fieldsSet |= LCC_PID_SET;
+ lcc->fieldsSet |= LCC_PID_SET;
#ifdef HAVE_GETZONEID
lcc->zoneid = ucred_getzoneid(peercred);
if (lcc->zoneid != -1)
- lcc->fieldsSet |= LCC_ZID_SET;
+ lcc->fieldsSet |= LCC_ZID_SET;
#endif
lcc->nSuppGids = ucred_getgroups(peercred, &gids);
if (lcc->nSuppGids > 0) {
- lcc->pSuppGids = calloc(lcc->nSuppGids, sizeof(int));
- if (lcc->pSuppGids == NULL) {
- lcc->nSuppGids = 0;
- } else {
- int i;
- for (i = 0 ; i < lcc->nSuppGids; i++) {
- (lcc->pSuppGids)[i] = (int) gids[i];
- }
- }
- } else {
- lcc->nSuppGids = 0;
+ lcc->pSuppGids = calloc(lcc->nSuppGids, sizeof(int));
+ if (lcc->pSuppGids == NULL) {
+ lcc->nSuppGids = 0;
+ }
+ else {
+ int i;
+
+ for (i = 0; i < lcc->nSuppGids; i++) {
+ (lcc->pSuppGids)[i] = (int) gids[i];
+ }
+ }
+ }
+ else {
+ lcc->nSuppGids = 0;
}
ucred_free(peercred);
return 0;
#elif defined(SO_PEERCRED)
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) == -1) {
- FreeLocalClientCreds(lcc);
- return -1;
+ FreeLocalClientCreds(lcc);
+ return -1;
}
lcc->euid = peercred.uid;
lcc->egid = peercred.gid;
@@ -1361,13 +1328,13 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp)
}
void
-FreeLocalClientCreds(LocalClientCredRec *lcc)
+FreeLocalClientCreds(LocalClientCredRec * lcc)
{
if (lcc != NULL) {
- if (lcc->nSuppGids > 0) {
- free(lcc->pSuppGids);
- }
- free(lcc);
+ if (lcc->nSuppGids > 0) {
+ free(lcc->pSuppGids);
+ }
+ free(lcc);
}
}
@@ -1377,12 +1344,12 @@ AuthorizedClient(ClientPtr client)
int rc;
if (!client || defeatAccessControl)
- return Success;
+ return Success;
/* untrusted clients can't change host access */
rc = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
if (rc != Success)
- return rc;
+ return rc;
return LocalClient(client) ? Success : BadAccess;
}
@@ -1391,26 +1358,24 @@ AuthorizedClient(ClientPtr client)
* called from the dispatcher */
int
-AddHost (ClientPtr client,
- int family,
- unsigned length, /* of bytes in pAddr */
- const void * pAddr)
+AddHost(ClientPtr client, int family, unsigned length, /* of bytes in pAddr */
+ const void *pAddr)
{
int rc, len;
rc = AuthorizedClient(client);
if (rc != Success)
- return rc;
+ return rc;
switch (family) {
case FamilyLocalHost:
- len = length;
- LocalHostEnabled = TRUE;
- break;
+ len = length;
+ LocalHostEnabled = TRUE;
+ break;
#ifdef SECURE_RPC
case FamilyNetname:
- len = length;
- SecureRPCInit ();
- break;
+ len = length;
+ SecureRPCInit();
+ break;
#endif
case FamilyInternet:
#if defined(IPv6) && defined(AF_INET6)
@@ -1419,66 +1384,59 @@ AddHost (ClientPtr client,
case FamilyDECnet:
case FamilyChaos:
case FamilyServerInterpreted:
- if ((len = CheckAddr (family, pAddr, length)) < 0)
- {
- client->errorValue = length;
- return BadValue;
- }
- break;
+ if ((len = CheckAddr(family, pAddr, length)) < 0) {
+ client->errorValue = length;
+ return BadValue;
+ }
+ break;
case FamilyLocal:
default:
- client->errorValue = family;
- return BadValue;
+ client->errorValue = family;
+ return BadValue;
}
- if (NewHost (family, pAddr, len, FALSE))
- return Success;
+ if (NewHost(family, pAddr, len, FALSE))
+ return Success;
return BadAlloc;
}
Bool
-ForEachHostInFamily (int family,
- Bool (*func)(
- unsigned char * /* addr */,
- short /* len */,
- pointer /* closure */),
- pointer closure)
+ForEachHostInFamily(int family, Bool (*func) (unsigned char * /* addr */ ,
+ short /* len */ ,
+ pointer /* closure */ ),
+ pointer closure)
{
- HOST *host;
+ HOST *host;
for (host = validhosts; host; host = host->next)
- if (family == host->family && func (host->addr, host->len, closure))
- return TRUE;
+ if (family == host->family && func(host->addr, host->len, closure))
+ return TRUE;
return FALSE;
}
/* Add a host to the access control list. This is the internal interface
* called when starting or resetting the server */
static Bool
-NewHost (int family,
- const void * addr,
- int len,
- int addingLocalHosts)
+NewHost(int family, const void *addr, int len, int addingLocalHosts)
{
register HOST *host;
if (family == FamilyLocal) return TRUE; /* No FamilyLocal in Vcxsrv */
+ for (host = validhosts; host; host = host->next) {
- for (host = validhosts; host; host = host->next)
- {
- if (addrEqual (family, addr, len, host))
- return TRUE;
- }
- if (!addingLocalHosts) { /* Fix for XFree86 bug #156 */
- for (host = selfhosts; host; host = host->next) {
- if (addrEqual (family, addr, len, host)) {
- host->requested = TRUE;
- break;
- }
- }
+ if (addrEqual(family, addr, len, host))
+ return TRUE;
}
- MakeHost(host,len)
- if (!host)
- return FALSE;
+ if (!addingLocalHosts) { /* Fix for XFree86 bug #156 */
+ for (host = selfhosts; host; host = host->next) {
+ if (addrEqual(family, addr, len, host)) {
+ host->requested = TRUE;
+ break;
+ }
+ }
+ }
+ MakeHost(host, len)
+ if (!host)
+ return FALSE;
host->family = family;
host->len = len;
memcpy(host->addr, addr, len);
@@ -1490,27 +1448,24 @@ NewHost (int family,
/* Remove a host from the access control list */
int
-RemoveHost (
- ClientPtr client,
- int family,
- unsigned length, /* of bytes in pAddr */
- pointer pAddr)
+RemoveHost(ClientPtr client, int family, unsigned length, /* of bytes in pAddr */
+ pointer pAddr)
{
int rc, len;
- register HOST *host, **prev;
+ register HOST *host, **prev;
rc = AuthorizedClient(client);
if (rc != Success)
- return rc;
+ return rc;
switch (family) {
case FamilyLocalHost:
- len = length;
- LocalHostEnabled = FALSE;
- break;
+ len = length;
+ LocalHostEnabled = FALSE;
+ break;
#ifdef SECURE_RPC
case FamilyNetname:
- len = length;
- break;
+ len = length;
+ break;
#endif
case FamilyInternet:
#if defined(IPv6) && defined(AF_INET6)
@@ -1519,67 +1474,57 @@ RemoveHost (
case FamilyDECnet:
case FamilyChaos:
case FamilyServerInterpreted:
- if ((len = CheckAddr (family, pAddr, length)) < 0)
- {
- client->errorValue = length;
+ if ((len = CheckAddr(family, pAddr, length)) < 0) {
+ client->errorValue = length;
return BadValue;
- }
- break;
+ }
+ break;
case FamilyLocal:
default:
- client->errorValue = family;
+ client->errorValue = family;
return BadValue;
}
for (prev = &validhosts;
- (host = *prev) && (!addrEqual (family, pAddr, len, host));
- prev = &host->next)
- ;
- if (host)
- {
+ (host = *prev) && (!addrEqual(family, pAddr, len, host));
+ prev = &host->next);
+ if (host) {
*prev = host->next;
- FreeHost (host);
+ FreeHost(host);
}
return Success;
}
/* Get all hosts in the access control list */
int
-GetHosts (
- pointer *data,
- int *pnHosts,
- int *pLen,
- BOOL *pEnabled)
+GetHosts(pointer *data, int *pnHosts, int *pLen, BOOL * pEnabled)
{
- int len;
- register int n = 0;
+ int len;
+ register int n = 0;
register unsigned char *ptr;
- register HOST *host;
- int nHosts = 0;
+ register HOST *host;
+ int nHosts = 0;
*pEnabled = AccessEnabled ? EnableAccess : DisableAccess;
- for (host = validhosts; host; host = host->next)
- {
- nHosts++;
- n += pad_to_int32(host->len) + sizeof(xHostEntry);
+ for (host = validhosts; host; host = host->next) {
+ nHosts++;
+ n += pad_to_int32(host->len) + sizeof(xHostEntry);
}
- if (n)
- {
+ if (n) {
*data = ptr = malloc(n);
- if (!ptr)
- {
- return BadAlloc;
- }
- for (host = validhosts; host; host = host->next)
- {
- len = host->len;
- ((xHostEntry *)ptr)->family = host->family;
- ((xHostEntry *)ptr)->length = len;
- ptr += sizeof(xHostEntry);
- memcpy (ptr, host->addr, len);
- ptr += pad_to_int32(len);
+ if (!ptr) {
+ return BadAlloc;
}
- } else {
- *data = NULL;
+ for (host = validhosts; host; host = host->next) {
+ len = host->len;
+ ((xHostEntry *) ptr)->family = host->family;
+ ((xHostEntry *) ptr)->length = len;
+ ptr += sizeof(xHostEntry);
+ memcpy(ptr, host->addr, len);
+ ptr += pad_to_int32(len);
+ }
+ }
+ else {
+ *data = NULL;
}
*pnHosts = nHosts;
*pLen = n;
@@ -1588,37 +1533,32 @@ GetHosts (
/* Check for valid address family and length, and return address length. */
-/*ARGSUSED*/
-static int
-CheckAddr (
- int family,
- const void * pAddr,
- unsigned length)
+ /*ARGSUSED*/ static int
+CheckAddr(int family, const void *pAddr, unsigned length)
{
- int len;
+ int len;
- switch (family)
- {
+ switch (family) {
#if defined(TCPCONN) || defined(STREAMSCONN)
- case FamilyInternet:
- if (length == sizeof (struct in_addr))
- len = length;
- else
- len = -1;
+ case FamilyInternet:
+ if (length == sizeof(struct in_addr))
+ len = length;
+ else
+ len = -1;
break;
#if defined(IPv6) && defined(AF_INET6)
- case FamilyInternet6:
- if (length == sizeof (struct in6_addr))
- len = length;
- else
- len = -1;
+ case FamilyInternet6:
+ if (length == sizeof(struct in6_addr))
+ len = length;
+ else
+ len = -1;
break;
#endif
-#endif
- case FamilyServerInterpreted:
- len = siCheckAddr(pAddr, length);
- break;
- default:
+#endif
+ case FamilyServerInterpreted:
+ len = siCheckAddr(pAddr, length);
+ break;
+ default:
len = -1;
}
return len;
@@ -1628,65 +1568,55 @@ CheckAddr (
* Returns 1 if host is invalid, 0 if we've found it. */
int
-InvalidHost (
- register struct sockaddr *saddr,
- int len,
- ClientPtr client)
+InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client)
{
- int family;
- pointer addr;
- register HOST *selfhost, *host;
+ int family;
+ pointer addr;
+ register HOST *selfhost, *host;
- if (!AccessEnabled) /* just let them in */
+ if (!AccessEnabled) /* just let them in */
return 0;
- family = ConvertAddr (saddr, &len, (pointer *)&addr);
+ family = ConvertAddr(saddr, &len, (pointer *) &addr);
if (family == -1)
return 1;
- if (family == FamilyLocal)
- {
- if (!LocalHostEnabled)
- {
- /*
- * check to see if any local address is enabled. This
- * implicitly enables local connections.
- */
- for (selfhost = selfhosts; selfhost; selfhost=selfhost->next)
- {
- for (host = validhosts; host; host=host->next)
- {
- if (addrEqual (selfhost->family, selfhost->addr,
- selfhost->len, host))
- return 0;
- }
- }
- } else
- return 0;
+ if (family == FamilyLocal) {
+ if (!LocalHostEnabled) {
+ /*
+ * check to see if any local address is enabled. This
+ * implicitly enables local connections.
+ */
+ for (selfhost = selfhosts; selfhost; selfhost = selfhost->next) {
+ for (host = validhosts; host; host = host->next) {
+ if (addrEqual(selfhost->family, selfhost->addr,
+ selfhost->len, host))
+ return 0;
+ }
+ }
+ }
+ else
+ return 0;
}
- for (host = validhosts; host; host = host->next)
- {
- if (host->family == FamilyServerInterpreted) {
- if (siAddrMatch (family, addr, len, host, client)) {
- return 0;
- }
- } else {
- if (addrEqual (family, addr, len, host))
- return 0;
- }
+ for (host = validhosts; host; host = host->next) {
+ if (host->family == FamilyServerInterpreted) {
+ if (siAddrMatch(family, addr, len, host, client)) {
+ return 0;
+ }
+ }
+ else {
+ if (addrEqual(family, addr, len, host))
+ return 0;
+ }
}
return 1;
}
static int
-ConvertAddr (
- register struct sockaddr *saddr,
- int *len,
- pointer *addr)
+ConvertAddr(register struct sockaddr *saddr, int *len, pointer *addr)
{
if (*len == 0)
return FamilyLocal;
- switch (saddr->sa_family)
- {
+ switch (saddr->sa_family) {
case AF_UNSPEC:
#if defined(UNIXCONN) || defined(LOCALCONN)
case AF_UNIX:
@@ -1695,25 +1625,27 @@ ConvertAddr (
#if defined(TCPCONN) || defined(STREAMSCONN)
case AF_INET:
#ifdef WIN32
- if (16777343 == *(long*)&((struct sockaddr_in *) saddr)->sin_addr)
+ if (16777343 == *(long *) &((struct sockaddr_in *) saddr)->sin_addr)
return FamilyLocal;
#endif
- *len = sizeof (struct in_addr);
+ *len = sizeof(struct in_addr);
*addr = (pointer) &(((struct sockaddr_in *) saddr)->sin_addr);
return FamilyInternet;
#if defined(IPv6) && defined(AF_INET6)
- case AF_INET6:
+ case AF_INET6:
{
- struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) saddr;
- if (IN6_IS_ADDR_V4MAPPED(&(saddr6->sin6_addr))) {
- *len = sizeof (struct in_addr);
- *addr = (pointer) &(saddr6->sin6_addr.s6_addr[12]);
- return FamilyInternet;
- } else {
- *len = sizeof (struct in6_addr);
- *addr = (pointer) &(saddr6->sin6_addr);
- return FamilyInternet6;
- }
+ struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) saddr;
+
+ if (IN6_IS_ADDR_V4MAPPED(&(saddr6->sin6_addr))) {
+ *len = sizeof(struct in_addr);
+ *addr = (pointer) &(saddr6->sin6_addr.s6_addr[12]);
+ return FamilyInternet;
+ }
+ else {
+ *len = sizeof(struct in6_addr);
+ *addr = (pointer) &(saddr6->sin6_addr);
+ return FamilyInternet6;
+ }
}
#endif
#endif
@@ -1723,13 +1655,12 @@ ConvertAddr (
}
int
-ChangeAccessControl(
- ClientPtr client,
- int fEnabled)
+ChangeAccessControl(ClientPtr client, int fEnabled)
{
int rc = AuthorizedClient(client);
+
if (rc != Success)
- return rc;
+ return rc;
AccessEnabled = fEnabled;
return Success;
}
@@ -1759,47 +1690,48 @@ GetAccessControl(void)
* future to enable loading additional host types, but that was not done for
* the initial implementation.
*/
-typedef Bool (*siAddrMatchFunc)(int family, pointer addr, int len,
- const char *siAddr, int siAddrlen, ClientPtr client, void *siTypePriv);
-typedef int (*siCheckAddrFunc)(const char *addrString, int length,
- void *siTypePriv);
+typedef Bool (*siAddrMatchFunc) (int family, pointer addr, int len,
+ const char *siAddr, int siAddrlen,
+ ClientPtr client, void *siTypePriv);
+typedef int (*siCheckAddrFunc) (const char *addrString, int length,
+ void *siTypePriv);
struct siType {
- struct siType * next;
- const char * typeName;
- siAddrMatchFunc addrMatch;
- siCheckAddrFunc checkAddr;
- void * typePriv; /* Private data for type routines */
+ struct siType *next;
+ const char *typeName;
+ siAddrMatchFunc addrMatch;
+ siCheckAddrFunc checkAddr;
+ void *typePriv; /* Private data for type routines */
};
static struct siType *siTypeList;
static int
siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch,
- siCheckAddrFunc checkAddr, void *typePriv)
+ siCheckAddrFunc checkAddr, void *typePriv)
{
struct siType *s, *p;
if ((typeName == NULL) || (addrMatch == NULL) || (checkAddr == NULL))
- return BadValue;
-
- for (s = siTypeList, p = NULL; s != NULL ; p = s, s = s->next) {
- if (strcmp(typeName, s->typeName) == 0) {
- s->addrMatch = addrMatch;
- s->checkAddr = checkAddr;
- s->typePriv = typePriv;
- return Success;
- }
+ return BadValue;
+
+ for (s = siTypeList, p = NULL; s != NULL; p = s, s = s->next) {
+ if (strcmp(typeName, s->typeName) == 0) {
+ s->addrMatch = addrMatch;
+ s->checkAddr = checkAddr;
+ s->typePriv = typePriv;
+ return Success;
+ }
}
s = malloc(sizeof(struct siType));
if (s == NULL)
- return BadAlloc;
+ return BadAlloc;
if (p == NULL)
- siTypeList = s;
+ siTypeList = s;
else
- p->next = s;
+ p->next = s;
s->next = NULL;
s->typeName = typeName;
@@ -1810,8 +1742,8 @@ siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch,
}
/* Checks to see if a host matches a server-interpreted host entry */
-static Bool
-siAddrMatch(int family, pointer addr, int len, HOST *host, ClientPtr client)
+static Bool
+siAddrMatch(int family, pointer addr, int len, HOST * host, ClientPtr client)
{
Bool matches = FALSE;
struct siType *s;
@@ -1820,19 +1752,19 @@ siAddrMatch(int family, pointer addr, int len, HOST *host, ClientPtr client)
valueString = (const char *) memchr(host->addr, '\0', host->len);
if (valueString != NULL) {
- for (s = siTypeList; s != NULL ; s = s->next) {
- if (strcmp((char *) host->addr, s->typeName) == 0) {
- addrlen = host->len - (strlen((char *)host->addr) + 1);
- matches = s->addrMatch(family, addr, len,
- valueString + 1, addrlen, client, s->typePriv);
- break;
- }
- }
+ for (s = siTypeList; s != NULL; s = s->next) {
+ if (strcmp((char *) host->addr, s->typeName) == 0) {
+ addrlen = host->len - (strlen((char *) host->addr) + 1);
+ matches = s->addrMatch(family, addr, len,
+ valueString + 1, addrlen, client,
+ s->typePriv);
+ break;
+ }
+ }
#ifdef FAMILY_SI_DEBUG
- ErrorF(
- "Xserver: siAddrMatch(): type = %s, value = %*.*s -- %s\n",
- host->addr, addrlen, addrlen, valueString + 1,
- (matches) ? "accepted" : "rejected");
+ ErrorF("Xserver: siAddrMatch(): type = %s, value = %*.*s -- %s\n",
+ host->addr, addrlen, addrlen, valueString + 1,
+ (matches) ? "accepted" : "rejected");
#endif
}
return matches;
@@ -1850,43 +1782,44 @@ siCheckAddr(const char *addrString, int length)
to separate the address type from the address value. */
valueString = (const char *) memchr(addrString, '\0', length);
if (valueString != NULL) {
- /* Make sure the first string is a recognized address type,
- * and the second string is a valid address of that type.
- */
- typelen = strlen(addrString) + 1;
- addrlen = length - typelen;
-
- for (s = siTypeList; s != NULL ; s = s->next) {
- if (strcmp(addrString, s->typeName) == 0) {
- len = s->checkAddr(valueString + 1, addrlen, s->typePriv);
- if (len >= 0) {
- len += typelen;
- }
- break;
- }
- }
+ /* Make sure the first string is a recognized address type,
+ * and the second string is a valid address of that type.
+ */
+ typelen = strlen(addrString) + 1;
+ addrlen = length - typelen;
+
+ for (s = siTypeList; s != NULL; s = s->next) {
+ if (strcmp(addrString, s->typeName) == 0) {
+ len = s->checkAddr(valueString + 1, addrlen, s->typePriv);
+ if (len >= 0) {
+ len += typelen;
+ }
+ break;
+ }
+ }
#ifdef FAMILY_SI_DEBUG
- {
- const char *resultMsg;
-
- if (s == NULL) {
- resultMsg = "type not registered";
- } else {
- if (len == -1)
- resultMsg = "rejected";
- else
- resultMsg = "accepted";
- }
-
- ErrorF("Xserver: siCheckAddr(): type = %s, value = %*.*s, len = %d -- %s\n",
- addrString, addrlen, addrlen, valueString + 1, len, resultMsg);
- }
+ {
+ const char *resultMsg;
+
+ if (s == NULL) {
+ resultMsg = "type not registered";
+ }
+ else {
+ if (len == -1)
+ resultMsg = "rejected";
+ else
+ resultMsg = "accepted";
+ }
+
+ ErrorF
+ ("Xserver: siCheckAddr(): type = %s, value = %*.*s, len = %d -- %s\n",
+ addrString, addrlen, addrlen, valueString + 1, len, resultMsg);
+ }
#endif
}
return len;
}
-
/***
* Hostname server-interpreted host type
*
@@ -1901,18 +1834,19 @@ siCheckAddr(const char *addrString, int length)
*/
#ifdef NI_MAXHOST
-# define SI_HOSTNAME_MAXLEN NI_MAXHOST
+#define SI_HOSTNAME_MAXLEN NI_MAXHOST
#else
-# ifdef MAXHOSTNAMELEN
-# define SI_HOSTNAME_MAXLEN MAXHOSTNAMELEN
-# else
-# define SI_HOSTNAME_MAXLEN 256
-# endif
+#ifdef MAXHOSTNAMELEN
+#define SI_HOSTNAME_MAXLEN MAXHOSTNAMELEN
+#else
+#define SI_HOSTNAME_MAXLEN 256
+#endif
#endif
-static Bool
+static Bool
siHostnameAddrMatch(int family, pointer addr, int len,
- const char *siAddr, int siAddrLen, ClientPtr client, void *typePriv)
+ const char *siAddr, int siAddrLen, ClientPtr client,
+ void *typePriv)
{
Bool res = FALSE;
@@ -1922,78 +1856,78 @@ siHostnameAddrMatch(int family, pointer addr, int len,
*/
#if defined(IPv6) && defined(AF_INET6)
if ((family == FamilyInternet) || (family == FamilyInternet6)) {
- char hostname[SI_HOSTNAME_MAXLEN];
- struct addrinfo *addresses;
- struct addrinfo *a;
- struct addrinfo hints;
- int f, hostaddrlen;
- pointer hostaddr;
-
- if (siAddrLen >= sizeof(hostname))
- return FALSE;
-
- strlcpy(hostname, siAddr, siAddrLen + 1);
-
- memset( &hints, 0, sizeof(hints) );
- if (family == FamilyInternet) hints.ai_family = AF_INET;
- else if (family == FamilyInternet6) hints.ai_family = AF_INET6;
- if (getaddrinfo(hostname, NULL, &hints, &addresses) == 0) {
- for (a = addresses ; a != NULL ; a = a->ai_next) {
- hostaddrlen = a->ai_addrlen;
- f = ConvertAddr(a->ai_addr,&hostaddrlen,&hostaddr);
- if ((f == family) && (len == hostaddrlen) &&
- (memcmp (addr, hostaddr, len) == 0) ) {
- res = TRUE;
- break;
- }
- }
- freeaddrinfo(addresses);
- }
+ char hostname[SI_HOSTNAME_MAXLEN];
+ struct addrinfo *addresses;
+ struct addrinfo *a;
+ struct addrinfo hints;
+ int f, hostaddrlen;
+ pointer hostaddr;
+
+ if (siAddrLen >= sizeof(hostname))
+ return FALSE;
+
+ strlcpy(hostname, siAddr, siAddrLen + 1);
+
+ memset( &hints, 0, sizeof(hints) );
+ if (family == FamilyInternet) hints.ai_family = AF_INET;
+ else if (family == FamilyInternet6) hints.ai_family = AF_INET6;
+ if (getaddrinfo(hostname, NULL, &hints, &addresses) == 0) {
+ for (a = addresses; a != NULL; a = a->ai_next) {
+ hostaddrlen = a->ai_addrlen;
+ f = ConvertAddr(a->ai_addr, &hostaddrlen, &hostaddr);
+ if ((f == family) && (len == hostaddrlen) &&
+ (memcmp(addr, hostaddr, len) == 0)) {
+ res = TRUE;
+ break;
+ }
+ }
+ freeaddrinfo(addresses);
+ }
}
-#else /* IPv6 not supported, use gethostbyname instead for IPv4 */
+#else /* IPv6 not supported, use gethostbyname instead for IPv4 */
if (family == FamilyInternet) {
- register struct hostent *hp;
+ register struct hostent *hp;
+
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
- _Xgethostbynameparams hparams;
+ _Xgethostbynameparams hparams;
#endif
- char hostname[SI_HOSTNAME_MAXLEN];
- int f, hostaddrlen;
- pointer hostaddr;
- const char **addrlist;
+ char hostname[SI_HOSTNAME_MAXLEN];
+ int f, hostaddrlen;
+ pointer hostaddr;
+ const char **addrlist;
- if (siAddrLen >= sizeof(hostname))
- return FALSE;
+ if (siAddrLen >= sizeof(hostname))
+ return FALSE;
- strlcpy(hostname, siAddr, siAddrLen + 1);
+ strlcpy(hostname, siAddr, siAddrLen + 1);
- if ((hp = _XGethostbyname(hostname, hparams)) != NULL) {
-#ifdef h_addr /* new 4.3bsd version of gethostent */
- /* iterate over the addresses */
- for (addrlist = (const char **)hp->h_addr_list; *addrlist; addrlist++)
+ if ((hp = _XGethostbyname(hostname, hparams)) != NULL) {
+#ifdef h_addr /* new 4.3bsd version of gethostent */
+ /* iterate over the addresses */
+ for (addrlist = (const char **)hp->h_addr_list; *addrlist; addrlist++)
#else
- addrlist = &hp->h_addr;
-#endif
- {
- struct sockaddr_in sin;
-
- sin.sin_family = hp->h_addrtype;
- memcpy ( &(sin.sin_addr), *addrlist, hp->h_length);
- hostaddrlen = sizeof(sin);
- f = ConvertAddr ((struct sockaddr *)&sin,
- &hostaddrlen, &hostaddr);
- if ((f == family) && (len == hostaddrlen) &&
- (memcmp (addr, hostaddr, len) == 0) ) {
- res = TRUE;
- break;
- }
- }
+ addrlist = &hp->h_addr;
+#endif
+ {
+ struct sockaddr_in sin;
+
+ sin.sin_family = hp->h_addrtype;
+ memcpy(&(sin.sin_addr), *addrlist, hp->h_length);
+ hostaddrlen = sizeof(sin);
+ f = ConvertAddr((struct sockaddr *) &sin,
+ &hostaddrlen, &hostaddr);
+ if ((f == family) && (len == hostaddrlen) &&
+ (memcmp(addr, hostaddr, len) == 0)) {
+ res = TRUE;
+ break;
+ }
+ }
}
}
#endif
return res;
}
-
static int
siHostnameCheckAddr(const char *valueString, int length, void *typePriv)
{
@@ -2005,38 +1939,44 @@ siHostnameCheckAddr(const char *valueString, int length, void *typePriv)
int i;
Bool dotAllowed = FALSE;
Bool dashAllowed = FALSE;
-
+
if ((length <= 0) || (length >= SI_HOSTNAME_MAXLEN)) {
- len = -1;
- } else {
- for (i = 0; i < length; i++) {
- char c = valueString[i];
-
- if (c == 0x2E) { /* '.' */
- if (dotAllowed == FALSE) {
- len = -1;
- break;
- } else {
- dotAllowed = FALSE;
- dashAllowed = FALSE;
- }
- } else if (c == 0x2D) { /* '-' */
- if (dashAllowed == FALSE) {
- len = -1;
- break;
- } else {
- dotAllowed = FALSE;
- }
- } else if (((c >= 0x30) && (c <= 0x3A)) /* 0-9 */ ||
- ((c >= 0x61) && (c <= 0x7A)) /* a-z */ ||
- ((c >= 0x41) && (c <= 0x5A)) /* A-Z */) {
- dotAllowed = TRUE;
- dashAllowed = TRUE;
- } else { /* Invalid character */
- len = -1;
- break;
- }
- }
+ len = -1;
+ }
+ else {
+ for (i = 0; i < length; i++) {
+ char c = valueString[i];
+
+ if (c == 0x2E) { /* '.' */
+ if (dotAllowed == FALSE) {
+ len = -1;
+ break;
+ }
+ else {
+ dotAllowed = FALSE;
+ dashAllowed = FALSE;
+ }
+ }
+ else if (c == 0x2D) { /* '-' */
+ if (dashAllowed == FALSE) {
+ len = -1;
+ break;
+ }
+ else {
+ dotAllowed = FALSE;
+ }
+ }
+ else if (((c >= 0x30) && (c <= 0x3A)) /* 0-9 */ ||
+ ((c >= 0x61) && (c <= 0x7A)) /* a-z */ ||
+ ((c >= 0x41) && (c <= 0x5A)) /* A-Z */ ) {
+ dotAllowed = TRUE;
+ dashAllowed = TRUE;
+ }
+ else { /* Invalid character */
+ len = -1;
+ break;
+ }
+ }
}
return len;
}
@@ -2056,28 +1996,30 @@ siHostnameCheckAddr(const char *valueString, int length, void *typePriv)
*/
#define SI_IPv6_MAXLEN INET6_ADDRSTRLEN
-static Bool
+static Bool
siIPv6AddrMatch(int family, pointer addr, int len,
- const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv)
+ const char *siAddr, int siAddrlen, ClientPtr client,
+ void *typePriv)
{
struct in6_addr addr6;
char addrbuf[SI_IPv6_MAXLEN];
if ((family != FamilyInternet6) || (len != sizeof(addr6)))
- return FALSE;
+ return FALSE;
memcpy(addrbuf, siAddr, siAddrlen);
addrbuf[siAddrlen] = '\0';
if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) {
- perror("inet_pton");
- return FALSE;
+ perror("inet_pton");
+ return FALSE;
}
if (memcmp(addr, &addr6, len) == 0) {
- return TRUE;
- } else {
- return FALSE;
+ return TRUE;
+ }
+ else {
+ return FALSE;
}
}
@@ -2088,29 +2030,32 @@ siIPv6CheckAddr(const char *addrString, int length, void *typePriv)
/* Minimum length is 3 (smallest legal address is "::1") */
if (length < 3) {
- /* Address is too short! */
- len = -1;
- } else if (length >= SI_IPv6_MAXLEN) {
- /* Address is too long! */
- len = -1;
- } else {
- /* Assume inet_pton is sufficient validation */
- struct in6_addr addr6;
- char addrbuf[SI_IPv6_MAXLEN];
-
- memcpy(addrbuf, addrString, length);
- addrbuf[length] = '\0';
-
- if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) {
- perror("inet_pton");
- len = -1;
- } else {
- len = length;
- }
+ /* Address is too short! */
+ len = -1;
+ }
+ else if (length >= SI_IPv6_MAXLEN) {
+ /* Address is too long! */
+ len = -1;
+ }
+ else {
+ /* Assume inet_pton is sufficient validation */
+ struct in6_addr addr6;
+ char addrbuf[SI_IPv6_MAXLEN];
+
+ memcpy(addrbuf, addrString, length);
+ addrbuf[length] = '\0';
+
+ if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) {
+ perror("inet_pton");
+ len = -1;
+ }
+ else {
+ len = length;
+ }
}
return len;
}
-#endif /* IPv6 */
+#endif /* IPv6 */
#if !defined(NO_LOCAL_CLIENT_CRED)
/***
@@ -2139,85 +2084,90 @@ siLocalCredGetId(const char *addr, int len, siLocalCredPrivPtr lcPriv, int *id)
char *addrbuf = malloc(len + 1);
if (addrbuf == NULL) {
- return FALSE;
+ return FALSE;
}
memcpy(addrbuf, addr, len);
addrbuf[len] = '\0';
- if (addr[0] == '#') { /* numeric id */
- char *cp;
- errno = 0;
- *id = strtol(addrbuf + 1, &cp, 0);
- if ((errno == 0) && (cp != (addrbuf+1))) {
- parsedOK = TRUE;
- }
- } else { /* non-numeric name */
- if (lcPriv->credType == LOCAL_USER) {
- struct passwd *pw = getpwnam(addrbuf);
-
- if (pw != NULL) {
- *id = (int) pw->pw_uid;
- parsedOK = TRUE;
- }
- } else { /* group */
- struct group *gr = getgrnam(addrbuf);
-
- if (gr != NULL) {
- *id = (int) gr->gr_gid;
- parsedOK = TRUE;
- }
- }
+ if (addr[0] == '#') { /* numeric id */
+ char *cp;
+
+ errno = 0;
+ *id = strtol(addrbuf + 1, &cp, 0);
+ if ((errno == 0) && (cp != (addrbuf + 1))) {
+ parsedOK = TRUE;
+ }
+ }
+ else { /* non-numeric name */
+ if (lcPriv->credType == LOCAL_USER) {
+ struct passwd *pw = getpwnam(addrbuf);
+
+ if (pw != NULL) {
+ *id = (int) pw->pw_uid;
+ parsedOK = TRUE;
+ }
+ }
+ else { /* group */
+ struct group *gr = getgrnam(addrbuf);
+
+ if (gr != NULL) {
+ *id = (int) gr->gr_gid;
+ parsedOK = TRUE;
+ }
+ }
}
free(addrbuf);
return parsedOK;
}
-static Bool
+static Bool
siLocalCredAddrMatch(int family, pointer addr, int len,
- const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv)
+ const char *siAddr, int siAddrlen, ClientPtr client,
+ void *typePriv)
{
int siAddrId;
LocalClientCredRec *lcc;
siLocalCredPrivPtr lcPriv = (siLocalCredPrivPtr) typePriv;
if (GetLocalClientCreds(client, &lcc) == -1) {
- return FALSE;
+ return FALSE;
}
-#ifdef HAVE_GETZONEID /* Ensure process is in the same zone */
+#ifdef HAVE_GETZONEID /* Ensure process is in the same zone */
if ((lcc->fieldsSet & LCC_ZID_SET) && (lcc->zoneid != getzoneid())) {
- FreeLocalClientCreds(lcc);
- return FALSE;
+ FreeLocalClientCreds(lcc);
+ return FALSE;
}
#endif
if (siLocalCredGetId(siAddr, siAddrlen, lcPriv, &siAddrId) == FALSE) {
- FreeLocalClientCreds(lcc);
- return FALSE;
+ FreeLocalClientCreds(lcc);
+ return FALSE;
}
if (lcPriv->credType == LOCAL_USER) {
- if ((lcc->fieldsSet & LCC_UID_SET) && (lcc->euid == siAddrId)) {
- FreeLocalClientCreds(lcc);
- return TRUE;
- }
- } else {
- if ((lcc->fieldsSet & LCC_GID_SET) && (lcc->egid == siAddrId)) {
- FreeLocalClientCreds(lcc);
- return TRUE;
- }
- if (lcc->pSuppGids != NULL) {
- int i;
-
- for (i = 0 ; i < lcc->nSuppGids; i++) {
- if (lcc->pSuppGids[i] == siAddrId) {
- FreeLocalClientCreds(lcc);
- return TRUE;
- }
- }
- }
+ if ((lcc->fieldsSet & LCC_UID_SET) && (lcc->euid == siAddrId)) {
+ FreeLocalClientCreds(lcc);
+ return TRUE;
+ }
+ }
+ else {
+ if ((lcc->fieldsSet & LCC_GID_SET) && (lcc->egid == siAddrId)) {
+ FreeLocalClientCreds(lcc);
+ return TRUE;
+ }
+ if (lcc->pSuppGids != NULL) {
+ int i;
+
+ for (i = 0; i < lcc->nSuppGids; i++) {
+ if (lcc->pSuppGids[i] == siAddrId) {
+ FreeLocalClientCreds(lcc);
+ return TRUE;
+ }
+ }
+ }
}
FreeLocalClientCreds(lcc);
return FALSE;
@@ -2229,13 +2179,13 @@ siLocalCredCheckAddr(const char *addrString, int length, void *typePriv)
int len = length;
int id;
- if (siLocalCredGetId(addrString, length,
- (siLocalCredPrivPtr)typePriv, &id) == FALSE) {
- len = -1;
+ if (siLocalCredGetId(addrString, length,
+ (siLocalCredPrivPtr) typePriv, &id) == FALSE) {
+ len = -1;
}
return len;
}
-#endif /* localuser */
+#endif /* localuser */
static void
siTypesInitialize(void)
@@ -2245,10 +2195,10 @@ siTypesInitialize(void)
siTypeAdd("ipv6", siIPv6AddrMatch, siIPv6CheckAddr, NULL);
#endif
#if !defined(NO_LOCAL_CLIENT_CRED)
- siTypeAdd("localuser", siLocalCredAddrMatch, siLocalCredCheckAddr,
- &siLocalUserPriv);
- siTypeAdd("localgroup", siLocalCredAddrMatch, siLocalCredCheckAddr,
- &siLocalGroupPriv);
+ siTypeAdd("localuser", siLocalCredAddrMatch, siLocalCredCheckAddr,
+ &siLocalUserPriv);
+ siTypeAdd("localgroup", siLocalCredAddrMatch, siLocalCredCheckAddr,
+ &siLocalGroupPriv);
#endif
}
@@ -2263,39 +2213,39 @@ void match_interface(u_long u_lQuery)
int nNumInterfaces, i, j = 0;
if (WSAStartup(MAKEWORD(2,2), &w) != 0)
- return;
+ return;
sd = WSASocket(AF_INET, SOCK_DGRAM, 0, 0, 0, 0);
if (sd == INVALID_SOCKET)
{
- WSACleanup();
- return;
+ WSACleanup();
+ return;
}
if (WSAIoctl(sd, SIO_GET_INTERFACE_LIST, 0, 0, &InterfaceList, sizeof(InterfaceList), &nBytesReturned, 0, 0) == SOCKET_ERROR)
{
- closesocket(sd);
- WSACleanup();
- return;
+ closesocket(sd);
+ WSACleanup();
+ return;
}
nNumInterfaces = (int)(nBytesReturned/sizeof(INTERFACE_INFO));
pInterfaces = malloc(25*sizeof(u_long));
for (i = 0; i < nNumInterfaces; ++i)
{
- pAddress = &InterfaceList[i].iiAddress.AddressIn;
- u_lAddress = pAddress->sin_addr.S_un.S_addr;
-
- pNetmask = &InterfaceList[i].iiNetmask.AddressIn;
- u_lNetmask = pNetmask->sin_addr.S_un.S_addr;
-
- u_lFlags = InterfaceList[i].iiFlags;
- if ((u_lFlags & IFF_UP) && !(u_lFlags & IFF_LOOPBACK))
- {
- if ((u_lAddress & u_lNetmask) == (u_lQuery & u_lNetmask)) j = i;
- *(pInterfaces + ActiveInterfaces) = u_lAddress;
- ActiveInterfaces++;
- }
+ pAddress = &InterfaceList[i].iiAddress.AddressIn;
+ u_lAddress = pAddress->sin_addr.S_un.S_addr;
+
+ pNetmask = &InterfaceList[i].iiNetmask.AddressIn;
+ u_lNetmask = pNetmask->sin_addr.S_un.S_addr;
+
+ u_lFlags = InterfaceList[i].iiFlags;
+ if ((u_lFlags & IFF_UP) && !(u_lFlags & IFF_LOOPBACK))
+ {
+ if ((u_lAddress & u_lNetmask) == (u_lQuery & u_lNetmask)) j = i;
+ *(pInterfaces + ActiveInterfaces) = u_lAddress;
+ ActiveInterfaces++;
+ }
}
tempAddress = *pInterfaces;
*pInterfaces = *(pInterfaces + j);
diff --git a/xorg-server/os/auth.c b/xorg-server/os/auth.c
index 12a44b4d6..b95786bee 100644
--- a/xorg-server/os/auth.c
+++ b/xorg-server/os/auth.c
@@ -35,60 +35,60 @@ from The Open Group.
#include <dix-config.h>
#endif
-# include <X11/X.h>
-# include <X11/Xauth.h>
-# include "misc.h"
-# include "osdep.h"
-# include "dixstruct.h"
-# include <sys/types.h>
-# include <sys/stat.h>
+#include <X11/X.h>
+#include <X11/Xauth.h>
+#include "misc.h"
+#include "osdep.h"
+#include "dixstruct.h"
+#include <sys/types.h>
+#include <sys/stat.h>
#ifdef WIN32
#include <X11/Xw32defs.h>
#endif
struct protocol {
- unsigned short name_length;
- const char *name;
- AuthAddCFunc Add; /* new authorization data */
- AuthCheckFunc Check; /* verify client authorization data */
- AuthRstCFunc Reset; /* delete all authorization data entries */
- AuthToIDFunc ToID; /* convert cookie to ID */
- AuthFromIDFunc FromID; /* convert ID to cookie */
- AuthRemCFunc Remove; /* remove a specific cookie */
+ unsigned short name_length;
+ const char *name;
+ AuthAddCFunc Add; /* new authorization data */
+ AuthCheckFunc Check; /* verify client authorization data */
+ AuthRstCFunc Reset; /* delete all authorization data entries */
+ AuthToIDFunc ToID; /* convert cookie to ID */
+ AuthFromIDFunc FromID; /* convert ID to cookie */
+ AuthRemCFunc Remove; /* remove a specific cookie */
#ifdef XCSECURITY
- AuthGenCFunc Generate;
+ AuthGenCFunc Generate;
#endif
};
-static struct protocol protocols[] = {
-{ (unsigned short) 18, "MIT-MAGIC-COOKIE-1",
- MitAddCookie, MitCheckCookie, MitResetCookie,
- MitToID, MitFromID, MitRemoveCookie,
+static struct protocol protocols[] = {
+ {(unsigned short) 18, "MIT-MAGIC-COOKIE-1",
+ MitAddCookie, MitCheckCookie, MitResetCookie,
+ MitToID, MitFromID, MitRemoveCookie,
#ifdef XCSECURITY
- MitGenerateCookie
+ MitGenerateCookie
#endif
-},
+ },
#ifdef HASXDMAUTH
-{ (unsigned short) 19, "XDM-AUTHORIZATION-1",
- XdmAddCookie, XdmCheckCookie, XdmResetCookie,
- XdmToID, XdmFromID, XdmRemoveCookie,
+ {(unsigned short) 19, "XDM-AUTHORIZATION-1",
+ XdmAddCookie, XdmCheckCookie, XdmResetCookie,
+ XdmToID, XdmFromID, XdmRemoveCookie,
#ifdef XCSECURITY
- NULL
+ NULL
#endif
-},
+ },
#endif
#ifdef SECURE_RPC
-{ (unsigned short) 9, "SUN-DES-1",
- SecureRPCAdd, SecureRPCCheck, SecureRPCReset,
- SecureRPCToID, SecureRPCFromID,SecureRPCRemove,
+ {(unsigned short) 9, "SUN-DES-1",
+ SecureRPCAdd, SecureRPCCheck, SecureRPCReset,
+ SecureRPCToID, SecureRPCFromID, SecureRPCRemove,
#ifdef XCSECURITY
- NULL
+ NULL
#endif
-},
+ },
#endif
};
-# define NUM_AUTHORIZATION (sizeof (protocols) /\
+#define NUM_AUTHORIZATION (sizeof (protocols) /\
sizeof (struct protocol))
/*
@@ -96,47 +96,46 @@ static struct protocol protocols[] = {
* specified authorization file
*/
-static char *authorization_file = (char *)NULL;
+static char *authorization_file = (char *) NULL;
static Bool ShouldLoadAuth = TRUE;
void
-InitAuthorization (char *file_name)
+InitAuthorization(char *file_name)
{
authorization_file = file_name;
}
static int
-LoadAuthorization (void)
+LoadAuthorization(void)
{
- FILE *f;
- Xauth *auth;
- int i;
- int count = 0;
+ FILE *f;
+ Xauth *auth;
+ int i;
+ int count = 0;
ShouldLoadAuth = FALSE;
if (!authorization_file)
- return 0;
+ return 0;
- f = Fopen (authorization_file, "r");
+ f = Fopen(authorization_file, "r");
if (!f)
- return -1;
-
- while ((auth = XauReadAuth (f)) != 0) {
- for (i = 0; i < NUM_AUTHORIZATION; i++) {
- if (protocols[i].name_length == auth->name_length &&
- memcmp (protocols[i].name, auth->name, (int) auth->name_length) == 0 &&
- protocols[i].Add)
- {
- ++count;
- (*protocols[i].Add) (auth->data_length, auth->data,
- FakeClientID(0));
- }
- }
- XauDisposeAuth (auth);
+ return -1;
+
+ while ((auth = XauReadAuth(f)) != 0) {
+ for (i = 0; i < NUM_AUTHORIZATION; i++) {
+ if (protocols[i].name_length == auth->name_length &&
+ memcmp(protocols[i].name, auth->name,
+ (int) auth->name_length) == 0 && protocols[i].Add) {
+ ++count;
+ (*protocols[i].Add) (auth->data_length, auth->data,
+ FakeClientID(0));
+ }
+ }
+ XauDisposeAuth(auth);
}
- Fclose (f);
+ Fclose(f);
return count;
}
@@ -146,146 +145,134 @@ LoadAuthorization (void)
* schemes supported by the display
*/
void
-RegisterAuthorizations (void)
+RegisterAuthorizations(void)
{
- int i;
+ int i;
for (i = 0; i < NUM_AUTHORIZATION; i++)
- XdmcpRegisterAuthorization (protocols[i].name,
- (int)protocols[i].name_length);
+ XdmcpRegisterAuthorization(protocols[i].name,
+ (int) protocols[i].name_length);
}
#endif
XID
-CheckAuthorization (
- unsigned int name_length,
- const char *name,
- unsigned int data_length,
- const char *data,
- ClientPtr client,
- const char **reason) /* failure message. NULL for default msg */
-{
- int i;
+CheckAuthorization(unsigned int name_length,
+ const char *name,
+ unsigned int data_length,
+ const char *data, ClientPtr client, const char **reason)
+{ /* failure message. NULL for default msg */
+ int i;
struct stat buf;
static time_t lastmod = 0;
static Bool loaded = FALSE;
- if (!authorization_file || stat(authorization_file, &buf))
- {
- if (lastmod != 0) {
- lastmod = 0;
- ShouldLoadAuth = TRUE; /* stat lost, so force reload */
- }
+ if (!authorization_file || stat(authorization_file, &buf)) {
+ if (lastmod != 0) {
+ lastmod = 0;
+ ShouldLoadAuth = TRUE; /* stat lost, so force reload */
+ }
}
- else if (buf.st_mtime > lastmod)
- {
- lastmod = buf.st_mtime;
- ShouldLoadAuth = TRUE;
+ else if (buf.st_mtime > lastmod) {
+ lastmod = buf.st_mtime;
+ ShouldLoadAuth = TRUE;
}
- if (ShouldLoadAuth)
- {
- int loadauth = LoadAuthorization();
-
- /*
- * If the authorization file has at least one entry for this server,
- * disable local host access. (loadauth > 0)
- *
- * If there are zero entries (either initially or when the
- * authorization file is later reloaded), or if a valid
- * authorization file was never loaded, enable local host access.
- * (loadauth == 0 || !loaded)
- *
- * If the authorization file was loaded initially (with valid
- * entries for this server), and reloading it later fails, don't
- * change anything. (loadauth == -1 && loaded)
- */
-
- if (loadauth > 0)
- {
- DisableLocalHost(); /* got at least one */
- loaded = TRUE;
- }
- else if (loadauth == 0 || !loaded)
- EnableLocalHost ();
+ if (ShouldLoadAuth) {
+ int loadauth = LoadAuthorization();
+
+ /*
+ * If the authorization file has at least one entry for this server,
+ * disable local host access. (loadauth > 0)
+ *
+ * If there are zero entries (either initially or when the
+ * authorization file is later reloaded), or if a valid
+ * authorization file was never loaded, enable local host access.
+ * (loadauth == 0 || !loaded)
+ *
+ * If the authorization file was loaded initially (with valid
+ * entries for this server), and reloading it later fails, don't
+ * change anything. (loadauth == -1 && loaded)
+ */
+
+ if (loadauth > 0) {
+ DisableLocalHost(); /* got at least one */
+ loaded = TRUE;
+ }
+ else if (loadauth == 0 || !loaded)
+ EnableLocalHost();
}
if (name_length) {
- for (i = 0; i < NUM_AUTHORIZATION; i++) {
- if (protocols[i].name_length == name_length &&
- memcmp (protocols[i].name, name, (int) name_length) == 0)
- {
- return (*protocols[i].Check) (data_length, data, client, reason);
- }
- *reason = "Protocol not supported by server\n";
- }
- } else *reason = "No protocol specified\n";
+ for (i = 0; i < NUM_AUTHORIZATION; i++) {
+ if (protocols[i].name_length == name_length &&
+ memcmp(protocols[i].name, name, (int) name_length) == 0) {
+ return (*protocols[i].Check) (data_length, data, client,
+ reason);
+ }
+ *reason = "Protocol not supported by server\n";
+ }
+ }
+ else
+ *reason = "No protocol specified\n";
return (XID) ~0L;
}
void
-ResetAuthorization (void)
+ResetAuthorization(void)
{
- int i;
+ int i;
for (i = 0; i < NUM_AUTHORIZATION; i++)
- if (protocols[i].Reset)
- (*protocols[i].Reset)();
+ if (protocols[i].Reset)
+ (*protocols[i].Reset) ();
ShouldLoadAuth = TRUE;
}
int
-AuthorizationFromID (
- XID id,
- unsigned short *name_lenp,
- const char **namep,
- unsigned short *data_lenp,
- char **datap)
+AuthorizationFromID(XID id,
+ unsigned short *name_lenp,
+ const char **namep, unsigned short *data_lenp, char **datap)
{
- int i;
+ int i;
for (i = 0; i < NUM_AUTHORIZATION; i++) {
- if (protocols[i].FromID &&
- (*protocols[i].FromID) (id, data_lenp, datap)) {
- *name_lenp = protocols[i].name_length;
- *namep = protocols[i].name;
- return 1;
- }
+ if (protocols[i].FromID &&
+ (*protocols[i].FromID) (id, data_lenp, datap)) {
+ *name_lenp = protocols[i].name_length;
+ *namep = protocols[i].name;
+ return 1;
+ }
}
return 0;
}
int
-RemoveAuthorization (
- unsigned short name_length,
- const char *name,
- unsigned short data_length,
- const char *data)
+RemoveAuthorization(unsigned short name_length,
+ const char *name,
+ unsigned short data_length, const char *data)
{
- int i;
+ int i;
for (i = 0; i < NUM_AUTHORIZATION; i++) {
- if (protocols[i].name_length == name_length &&
- memcmp (protocols[i].name, name, (int) name_length) == 0 &&
- protocols[i].Remove)
- {
- return (*protocols[i].Remove) (data_length, data);
- }
+ if (protocols[i].name_length == name_length &&
+ memcmp(protocols[i].name, name, (int) name_length) == 0 &&
+ protocols[i].Remove) {
+ return (*protocols[i].Remove) (data_length, data);
+ }
}
return 0;
}
int
-AddAuthorization (unsigned name_length, const char *name,
- unsigned data_length, char *data)
+AddAuthorization(unsigned name_length, const char *name,
+ unsigned data_length, char *data)
{
- int i;
+ int i;
for (i = 0; i < NUM_AUTHORIZATION; i++) {
- if (protocols[i].name_length == name_length &&
- memcmp (protocols[i].name, name, (int) name_length) == 0 &&
- protocols[i].Add)
- {
- return (*protocols[i].Add) (data_length, data, FakeClientID(0));
- }
+ if (protocols[i].name_length == name_length &&
+ memcmp(protocols[i].name, name, (int) name_length) == 0 &&
+ protocols[i].Add) {
+ return (*protocols[i].Add) (data_length, data, FakeClientID(0));
+ }
}
return 0;
}
@@ -293,30 +280,28 @@ AddAuthorization (unsigned name_length, const char *name,
#ifdef XCSECURITY
XID
-GenerateAuthorization(
- unsigned name_length,
- const char *name,
- unsigned data_length,
- const char *data,
- unsigned *data_length_return,
- char **data_return)
+GenerateAuthorization(unsigned name_length,
+ const char *name,
+ unsigned data_length,
+ const char *data,
+ unsigned *data_length_return, char **data_return)
{
- int i;
+ int i;
for (i = 0; i < NUM_AUTHORIZATION; i++) {
- if (protocols[i].name_length == name_length &&
- memcmp (protocols[i].name, name, (int) name_length) == 0 &&
- protocols[i].Generate)
- {
- return (*protocols[i].Generate) (data_length, data,
- FakeClientID(0), data_length_return, data_return);
- }
+ if (protocols[i].name_length == name_length &&
+ memcmp(protocols[i].name, name, (int) name_length) == 0 &&
+ protocols[i].Generate) {
+ return (*protocols[i].Generate) (data_length, data,
+ FakeClientID(0),
+ data_length_return, data_return);
+ }
}
return -1;
}
void
-GenerateRandomData (int len, char *buf)
+GenerateRandomData(int len, char *buf)
{
#ifdef _MSC_VER
static HANDLE hAdvApi32;
@@ -337,4 +322,4 @@ GenerateRandomData (int len, char *buf)
#endif
}
-#endif /* XCSECURITY */
+#endif /* XCSECURITY */
diff --git a/xorg-server/os/backtrace.c b/xorg-server/os/backtrace.c
index edaeb17c7..81348f417 100644
--- a/xorg-server/os/backtrace.c
+++ b/xorg-server/os/backtrace.c
@@ -37,53 +37,61 @@
#include <dlfcn.h>
#include <execinfo.h>
-void xorg_backtrace(void)
+void
+xorg_backtrace(void)
{
void *array[64];
const char *mod;
int size, i;
Dl_info info;
+
ErrorF("\n");
ErrorF("Backtrace:\n");
size = backtrace(array, 64);
for (i = 0; i < size; i++) {
- int rc = dladdr(array[i], &info);
- if (rc == 0) {
- ErrorF("%d: ?? [%p]\n", i, array[i]);
- continue;
- }
- mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname : "(vdso)";
- if (info.dli_saddr)
- ErrorF("%d: %s (%s+0x%lx) [%p]\n", i, mod,
- info.dli_sname, (long unsigned int)((char *) array[i] - (char *) info.dli_saddr), array[i]);
- else
- ErrorF("%d: %s (%p+0x%lx) [%p]\n", i, mod,
- info.dli_fbase, (long unsigned int)((char *) array[i] - (char *) info.dli_fbase), array[i]);
+ int rc = dladdr(array[i], &info);
+
+ if (rc == 0) {
+ ErrorF("%d: ?? [%p]\n", i, array[i]);
+ continue;
+ }
+ mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname : "(vdso)";
+ if (info.dli_saddr)
+ ErrorF("%d: %s (%s+0x%lx) [%p]\n", i, mod,
+ info.dli_sname,
+ (long unsigned int) ((char *) array[i] -
+ (char *) info.dli_saddr), array[i]);
+ else
+ ErrorF("%d: %s (%p+0x%lx) [%p]\n", i, mod,
+ info.dli_fbase,
+ (long unsigned int) ((char *) array[i] -
+ (char *) info.dli_fbase), array[i]);
}
ErrorF("\n");
}
-#else /* not glibc or glibc < 2.1 */
+#else /* not glibc or glibc < 2.1 */
-# if defined(sun) && defined(__SVR4)
-# define HAVE_PSTACK
-# endif
+#if defined(sun) && defined(__SVR4)
+#define HAVE_PSTACK
+#endif
-# if defined(HAVE_WALKCONTEXT) /* Solaris 9 & later */
+#if defined(HAVE_WALKCONTEXT) /* Solaris 9 & later */
-# include <ucontext.h>
-# include <signal.h>
-# include <dlfcn.h>
-# include <sys/elf.h>
+#include <ucontext.h>
+#include <signal.h>
+#include <dlfcn.h>
+#include <sys/elf.h>
#ifdef _LP64
-# define ElfSym Elf64_Sym
+#define ElfSym Elf64_Sym
#else
-# define ElfSym Elf32_Sym
+#define ElfSym Elf32_Sym
#endif
/* Called for each frame on the stack to print it's contents */
-static int xorg_backtrace_frame(uintptr_t pc, int signo, void *arg)
+static int
+xorg_backtrace_frame(uintptr_t pc, int signo, void *arg)
{
Dl_info dlinfo;
ElfSym *dlsym;
@@ -91,13 +99,13 @@ static int xorg_backtrace_frame(uintptr_t pc, int signo, void *arg)
int depth = *((int *) arg);
if (signo) {
- char signame[SIG2STR_MAX];
+ char signame[SIG2STR_MAX];
- if (sig2str(signo, signame) != 0) {
- strcpy(signame, "unknown");
- }
+ if (sig2str(signo, signame) != 0) {
+ strcpy(signame, "unknown");
+ }
- ErrorF("** Signal %d (%s)\n", signo, signame);
+ ErrorF("** Signal %d (%s)\n", signo, signame);
}
snprintf(header, sizeof(header), "%d: 0x%lx", depth, pc);
@@ -105,118 +113,127 @@ static int xorg_backtrace_frame(uintptr_t pc, int signo, void *arg)
/* Ask system dynamic loader for info on the address */
if (dladdr1((void *) pc, &dlinfo, (void **) &dlsym, RTLD_DL_SYMENT)) {
- unsigned long offset = pc - (uintptr_t) dlinfo.dli_saddr;
- const char *symname;
-
- if (offset < dlsym->st_size) { /* inside a function */
- symname = dlinfo.dli_sname;
- } else { /* found which file it was in, but not which function */
- symname = "<section start>";
- offset = pc - (uintptr_t)dlinfo.dli_fbase;
- }
- ErrorF("%s: %s:%s+0x%lx\n", header, dlinfo.dli_fname,
- symname, offset);
-
- } else {
- /* Couldn't find symbol info from system dynamic loader, should
- * probably poke elfloader here, but haven't written that code yet,
- * so we just print the pc.
- */
- ErrorF("%s\n", header);
+ unsigned long offset = pc - (uintptr_t) dlinfo.dli_saddr;
+ const char *symname;
+
+ if (offset < dlsym->st_size) { /* inside a function */
+ symname = dlinfo.dli_sname;
+ }
+ else { /* found which file it was in, but not which function */
+ symname = "<section start>";
+ offset = pc - (uintptr_t) dlinfo.dli_fbase;
+ }
+ ErrorF("%s: %s:%s+0x%lx\n", header, dlinfo.dli_fname, symname, offset);
+
+ }
+ else {
+ /* Couldn't find symbol info from system dynamic loader, should
+ * probably poke elfloader here, but haven't written that code yet,
+ * so we just print the pc.
+ */
+ ErrorF("%s\n", header);
}
return 0;
}
-# endif /* HAVE_WALKCONTEXT */
+#endif /* HAVE_WALKCONTEXT */
-# ifdef HAVE_PSTACK
-static int xorg_backtrace_pstack(void) {
+#ifdef HAVE_PSTACK
+static int
+xorg_backtrace_pstack(void)
+{
pid_t kidpid;
int pipefd[2];
if (pipe(pipefd) != 0) {
- return -1;
+ return -1;
}
kidpid = fork1();
if (kidpid == -1) {
- /* ERROR */
- return -1;
- } else if (kidpid == 0) {
- /* CHILD */
- char parent[16];
-
- seteuid(0);
- close(STDIN_FILENO);
- close(STDOUT_FILENO);
- dup2(pipefd[1],STDOUT_FILENO);
- closefrom(STDERR_FILENO);
-
- snprintf(parent, sizeof(parent), "%d", getppid());
- execle("/usr/bin/pstack", "pstack", parent, NULL);
- exit(1);
- } else {
- /* PARENT */
- char btline[256];
- int kidstat;
- int bytesread;
- int done = 0;
-
- close(pipefd[1]);
-
- while (!done) {
- bytesread = read(pipefd[0], btline, sizeof(btline) - 1);
-
- if (bytesread > 0) {
- btline[bytesread] = 0;
- ErrorF("%s", btline);
- }
- else if ((bytesread < 0) ||
- ((errno != EINTR) && (errno != EAGAIN)))
- done = 1;
- }
- close(pipefd[0]);
- waitpid(kidpid, &kidstat, 0);
- if (kidstat != 0)
- return -1;
+ /* ERROR */
+ return -1;
+ }
+ else if (kidpid == 0) {
+ /* CHILD */
+ char parent[16];
+
+ seteuid(0);
+ close(STDIN_FILENO);
+ close(STDOUT_FILENO);
+ dup2(pipefd[1], STDOUT_FILENO);
+ closefrom(STDERR_FILENO);
+
+ snprintf(parent, sizeof(parent), "%d", getppid());
+ execle("/usr/bin/pstack", "pstack", parent, NULL);
+ exit(1);
+ }
+ else {
+ /* PARENT */
+ char btline[256];
+ int kidstat;
+ int bytesread;
+ int done = 0;
+
+ close(pipefd[1]);
+
+ while (!done) {
+ bytesread = read(pipefd[0], btline, sizeof(btline) - 1);
+
+ if (bytesread > 0) {
+ btline[bytesread] = 0;
+ ErrorF("%s", btline);
+ }
+ else if ((bytesread < 0) || ((errno != EINTR) && (errno != EAGAIN)))
+ done = 1;
+ }
+ close(pipefd[0]);
+ waitpid(kidpid, &kidstat, 0);
+ if (kidstat != 0)
+ return -1;
}
return 0;
}
-# endif /* HAVE_PSTACK */
-
+#endif /* HAVE_PSTACK */
-# if defined(HAVE_PSTACK) || defined(HAVE_WALKCONTEXT)
+#if defined(HAVE_PSTACK) || defined(HAVE_WALKCONTEXT)
-void xorg_backtrace(void) {
+void
+xorg_backtrace(void)
+{
ErrorF("\n");
ErrorF("Backtrace:\n");
-# ifdef HAVE_PSTACK
+#ifdef HAVE_PSTACK
/* First try fork/exec of pstack - otherwise fall back to walkcontext
pstack is preferred since it can print names of non-exported functions */
if (xorg_backtrace_pstack() < 0)
-# endif
+#endif
{
-# ifdef HAVE_WALKCONTEXT
- ucontext_t u;
- int depth = 1;
-
- if (getcontext(&u) == 0)
- walkcontext(&u, xorg_backtrace_frame, &depth);
- else
-# endif
- ErrorF("Failed to get backtrace info: %s\n", strerror(errno));
+#ifdef HAVE_WALKCONTEXT
+ ucontext_t u;
+ int depth = 1;
+
+ if (getcontext(&u) == 0)
+ walkcontext(&u, xorg_backtrace_frame, &depth);
+ else
+#endif
+ ErrorF("Failed to get backtrace info: %s\n", strerror(errno));
}
ErrorF("\n");
}
-# else
+#else
/* Default fallback if we can't find any way to get a backtrace */
-void xorg_backtrace(void) { return; }
+void
+xorg_backtrace(void)
+{
+ return;
+}
-# endif
+#endif
#endif
diff --git a/xorg-server/os/client.c b/xorg-server/os/client.c
index fbccf22ed..ef5e3935d 100644
--- a/xorg-server/os/client.c
+++ b/xorg-server/os/client.c
@@ -85,7 +85,8 @@
*
* @see GetClientPid
*/
-pid_t DetermineClientPid(struct _Client *client)
+pid_t
+DetermineClientPid(struct _Client * client)
{
LocalClientCredRec *lcc = NULL;
pid_t pid = -1;
@@ -96,8 +97,7 @@ pid_t DetermineClientPid(struct _Client *client)
if (client == serverClient)
return getpid();
- if (GetLocalClientCreds(client, &lcc) != -1)
- {
+ if (GetLocalClientCreds(client, &lcc) != -1) {
if (lcc->fieldsSet & LCC_PID_SET)
pid = lcc->pid;
FreeLocalClientCreds(lcc);
@@ -127,7 +127,8 @@ pid_t DetermineClientPid(struct _Client *client)
*
* @see GetClientCmdName/Args
*/
-void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
+void
+DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
{
char path[PATH_MAX + 1];
int totsize = 0;
@@ -141,20 +142,18 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
if (pid == -1)
return;
-#ifdef __sun /* Solaris */
+#ifdef __sun /* Solaris */
/* Solaris does not support /proc/pid/cmdline, but makes information
* similar to what ps shows available in a binary structure in the
* /proc/pid/psinfo file. */
if (snprintf(path, sizeof(path), "/proc/%d/psinfo", pid) < 0)
return;
fd = open(path, O_RDONLY);
- if (fd < 0)
- {
- ErrorF ("Failed to open %s: %s\n", path, strerror(errno));
+ if (fd < 0) {
+ ErrorF("Failed to open %s: %s\n", path, strerror(errno));
return;
}
- else
- {
+ else {
psinfo_t psinfo = { 0 };
char *sp;
@@ -170,7 +169,7 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
* the file that was exec'ed, thus cutting off many long gnome
* command names, or returning "isapython2.6" for all python scripts.
*/
- psinfo.pr_psargs[PRARGSZ-1] = '\0';
+ psinfo.pr_psargs[PRARGSZ - 1] = '\0';
sp = strchr(psinfo.pr_psargs, ' ');
if (sp)
*sp++ = '\0';
@@ -184,36 +183,37 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
#elif defined(__OpenBSD__)
/* on OpenBSD use kvm_getargv() */
{
- kvm_t *kd;
- char errbuf[_POSIX2_LINE_MAX];
- char **argv;
- struct kinfo_proc *kp;
- size_t len = 0;
- int i, n;
-
- kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, errbuf);
- if (kd == NULL)
- return;
- kp = kvm_getprocs(kd, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), &n);
- if (n != 1)
- return;
- argv = kvm_getargv(kd, kp, 0);
- *cmdname = strdup(argv[0]);
- i = 1;
- while (argv[i] != NULL) {
- len += strlen(argv[i]) + 1;
- i++;
- }
- *cmdargs = calloc(1, len);
- i = 1;
- while (argv[i] != NULL) {
- strlcat(*cmdargs, argv[i], len);
- strlcat(*cmdargs, " ", len);
- i++;
- }
- kvm_close(kd);
+ kvm_t *kd;
+ char errbuf[_POSIX2_LINE_MAX];
+ char **argv;
+ struct kinfo_proc *kp;
+ size_t len = 0;
+ int i, n;
+
+ kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, errbuf);
+ if (kd == NULL)
+ return;
+ kp = kvm_getprocs(kd, KERN_PROC_PID, pid, sizeof(struct kinfo_proc),
+ &n);
+ if (n != 1)
+ return;
+ argv = kvm_getargv(kd, kp, 0);
+ *cmdname = strdup(argv[0]);
+ i = 1;
+ while (argv[i] != NULL) {
+ len += strlen(argv[i]) + 1;
+ i++;
+ }
+ *cmdargs = calloc(1, len);
+ i = 1;
+ while (argv[i] != NULL) {
+ strlcat(*cmdargs, argv[i], len);
+ strlcat(*cmdargs, " ", len);
+ i++;
+ }
+ kvm_close(kd);
}
-#else /* Linux using /proc/pid/cmdline */
+#else /* Linux using /proc/pid/cmdline */
/* Check if /proc/pid/cmdline exists. It's not supported on all
* operating systems. */
@@ -232,26 +232,24 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
path[totsize - 1] = '\0';
/* Contruct the process name without arguments. */
- if (cmdname)
- {
+ if (cmdname) {
*cmdname = strdup(path);
}
/* Construct the arguments for client process. */
- if (cmdargs)
- {
+ if (cmdargs) {
int cmdsize = strlen(path) + 1;
int argsize = totsize - cmdsize;
char *args = NULL;
if (argsize > 0)
args = malloc(argsize);
- if (args)
- {
+ if (args) {
int i = 0;
- for (i = 0; i < (argsize - 1); ++i)
- {
+
+ for (i = 0; i < (argsize - 1); ++i) {
const char c = path[cmdsize + i];
+
args[i] = (c == '\0') ? ' ' : c;
}
args[argsize - 1] = '\0';
@@ -266,7 +264,8 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
*
* @param[in] client Recently connected client.
*/
-void ReserveClientIds(struct _Client *client)
+void
+ReserveClientIds(struct _Client *client)
{
#ifdef CLIENTIDS
if (client == NullClient)
@@ -279,7 +278,8 @@ void ReserveClientIds(struct _Client *client)
client->clientIds->pid = DetermineClientPid(client);
if (client->clientIds->pid != -1)
- DetermineClientCmd(client->clientIds->pid, &client->clientIds->cmdname, &client->clientIds->cmdargs);
+ DetermineClientCmd(client->clientIds->pid, &client->clientIds->cmdname,
+ &client->clientIds->cmdargs);
DebugF("client(%lx): Reserved pid(%d).\n",
(unsigned long) client->clientAsMask, client->clientIds->pid);
@@ -287,7 +287,7 @@ void ReserveClientIds(struct _Client *client)
(unsigned long) client->clientAsMask,
client->clientIds->cmdname ? client->clientIds->cmdname : "NULL",
client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL");
-#endif /* CLIENTIDS */
+#endif /* CLIENTIDS */
}
/**
@@ -296,7 +296,8 @@ void ReserveClientIds(struct _Client *client)
*
* @param[in] client Recently disconnected client.
*/
-void ReleaseClientIds(struct _Client *client)
+void
+ReleaseClientIds(struct _Client *client)
{
#ifdef CLIENTIDS
if (client == NullClient)
@@ -312,11 +313,11 @@ void ReleaseClientIds(struct _Client *client)
client->clientIds->cmdname ? client->clientIds->cmdname : "NULL",
client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL");
- free((void *) client->clientIds->cmdname); /* const char * */
- free((void *) client->clientIds->cmdargs); /* const char * */
+ free((void *) client->clientIds->cmdname); /* const char * */
+ free((void *) client->clientIds->cmdargs); /* const char * */
free(client->clientIds);
client->clientIds = NULL;
-#endif /* CLIENTIDS */
+#endif /* CLIENTIDS */
}
/**
@@ -331,7 +332,8 @@ void ReleaseClientIds(struct _Client *client)
*
* @see DetermineClientPid
*/
-pid_t GetClientPid(struct _Client *client)
+pid_t
+GetClientPid(struct _Client *client)
{
if (client == NullClient)
return -1;
@@ -356,7 +358,8 @@ pid_t GetClientPid(struct _Client *client)
*
* @see DetermineClientCmd
*/
-const char *GetClientCmdName(struct _Client *client)
+const char *
+GetClientCmdName(struct _Client *client)
{
if (client == NullClient)
return NULL;
@@ -381,7 +384,8 @@ const char *GetClientCmdName(struct _Client *client)
*
* @see DetermineClientCmd
*/
-const char *GetClientCmdArgs(struct _Client *client)
+const char *
+GetClientCmdArgs(struct _Client *client)
{
if (client == NullClient)
return NULL;
diff --git a/xorg-server/os/connection.c b/xorg-server/os/connection.c
index 578640dda..53a6ca005 100644
--- a/xorg-server/os/connection.c
+++ b/xorg-server/os/connection.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -86,28 +85,26 @@ SOFTWARE.
#ifndef WIN32
#include <sys/socket.h>
-
-
#if defined(TCPCONN) || defined(STREAMSCONN)
-# include <netinet/in.h>
-# include <arpa/inet.h>
-# ifdef apollo
-# ifndef NO_TCP_H
-# include <netinet/tcp.h>
-# endif
-# else
-# ifdef CSRG_BASED
-# include <sys/param.h>
-# endif
-# include <netinet/tcp.h>
-# endif
-# include <arpa/inet.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#ifdef apollo
+#ifndef NO_TCP_H
+#include <netinet/tcp.h>
+#endif
+#else
+#ifdef CSRG_BASED
+#include <sys/param.h>
+#endif
+#include <netinet/tcp.h>
+#endif
+#include <arpa/inet.h>
#endif
#include <sys/uio.h>
-#endif /* WIN32 */
-#include "misc.h" /* for typedef of pointer */
+#endif /* WIN32 */
+#include "misc.h" /* for typedef of pointer */
#include "osdep.h"
#include <X11/Xpoll.h>
#include "opaque.h"
@@ -120,42 +117,42 @@ typedef int pid_t;
#define Pid_t pid_t
-
#ifdef HAVE_GETPEERUCRED
-# include <ucred.h>
-# include <zone.h>
+#include <ucred.h>
+#include <zone.h>
#endif
#ifdef XSERVER_DTRACE
-# include <sys/types.h>
+#include <sys/types.h>
typedef const char *string;
-# ifndef HAVE_GETPEERUCRED
-# define zoneid_t int
-# endif
-# include "../dix/Xserver-dtrace.h"
+
+#ifndef HAVE_GETPEERUCRED
+#define zoneid_t int
+#endif
+#include "../dix/Xserver-dtrace.h"
#endif
-static int lastfdesc; /* maximum file descriptor */
+static int lastfdesc; /* maximum file descriptor */
-fd_set WellKnownConnections; /* Listener mask */
-fd_set EnabledDevices; /* mask for input devices that are on */
-fd_set AllSockets; /* select on this */
-fd_set AllClients; /* available clients */
-fd_set LastSelectMask; /* mask returned from last select call */
-fd_set ClientsWithInput; /* clients with FULL requests in buffer */
-fd_set ClientsWriteBlocked; /* clients who cannot receive output */
-fd_set OutputPending; /* clients with reply/event data ready to go */
+fd_set WellKnownConnections; /* Listener mask */
+fd_set EnabledDevices; /* mask for input devices that are on */
+fd_set AllSockets; /* select on this */
+fd_set AllClients; /* available clients */
+fd_set LastSelectMask; /* mask returned from last select call */
+fd_set ClientsWithInput; /* clients with FULL requests in buffer */
+fd_set ClientsWriteBlocked; /* clients who cannot receive output */
+fd_set OutputPending; /* clients with reply/event data ready to go */
int MaxClients = 0;
-Bool NewOutputPending; /* not yet attempted to write some new output */
-Bool AnyClientsWriteBlocked; /* true if some client blocked on write */
+Bool NewOutputPending; /* not yet attempted to write some new output */
+Bool AnyClientsWriteBlocked; /* true if some client blocked on write */
#if !defined(_MSC_VER)
-static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
+static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
static Pid_t ParentProcess;
#endif
-Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or
- equivalent) will send SIGCONT back. */
-Bool PartialNetwork; /* continue even if unable to bind all addrs */
+Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or
+ equivalent) will send SIGCONT back. */
+Bool PartialNetwork; /* continue even if unable to bind all addrs */
static Bool debug_conns = FALSE;
@@ -189,16 +186,18 @@ struct _ct_node {
struct _ct_node *ct_head[256];
-void InitConnectionTranslation(void)
+void
+InitConnectionTranslation(void)
{
memset(ct_head, 0, sizeof(ct_head));
}
-int GetConnectionTranslation(int conn)
+int
+GetConnectionTranslation(int conn)
{
struct _ct_node *node = ct_head[conn & 0xff];
- while (node != NULL)
- {
+
+ while (node != NULL) {
if (node->key == conn)
return node->value;
node = node->next;
@@ -206,16 +205,16 @@ int GetConnectionTranslation(int conn)
return 0;
}
-void SetConnectionTranslation(int conn, int client)
+void
+SetConnectionTranslation(int conn, int client)
{
struct _ct_node **node = ct_head + (conn & 0xff);
- if (client == 0) /* remove entry */
- {
- while (*node != NULL)
- {
- if ((*node)->key == conn)
- {
+
+ if (client == 0) { /* remove entry */
+ while (*node != NULL) {
+ if ((*node)->key == conn) {
struct _ct_node *temp = *node;
+
*node = (*node)->next;
free(temp);
return;
@@ -223,12 +222,10 @@ void SetConnectionTranslation(int conn, int client)
node = &((*node)->next);
}
return;
- } else
- {
- while (*node != NULL)
- {
- if ((*node)->key == conn)
- {
+ }
+ else {
+ while (*node != NULL) {
+ if ((*node)->key == conn) {
(*node)->value = client;
return;
}
@@ -242,15 +239,17 @@ void SetConnectionTranslation(int conn, int client)
}
}
-void ClearConnectionTranslation(void)
+void
+ClearConnectionTranslation(void)
{
unsigned i;
- for (i = 0; i < 256; i++)
- {
+
+ for (i = 0; i < 256; i++) {
struct _ct_node *node = ct_head[i];
- while (node != NULL)
- {
+
+ while (node != NULL) {
struct _ct_node *temp = node;
+
node = node->next;
free(temp);
}
@@ -258,21 +257,21 @@ void ClearConnectionTranslation(void)
}
#endif
-static XtransConnInfo *ListenTransConns = NULL;
-static int *ListenTransFds = NULL;
-static int ListenTransCount;
+static XtransConnInfo *ListenTransConns = NULL;
+static int *ListenTransFds = NULL;
+static int ListenTransCount;
-static void ErrorConnMax(XtransConnInfo /* trans_conn */);
+static void ErrorConnMax(XtransConnInfo /* trans_conn */ );
static XtransConnInfo
-lookup_trans_conn (int fd)
+lookup_trans_conn(int fd)
{
- if (ListenTransFds)
- {
- int i;
- for (i = 0; i < ListenTransCount; i++)
- if (ListenTransFds[i] == fd)
- return ListenTransConns[i];
+ if (ListenTransFds) {
+ int i;
+
+ for (i = 0; i < ListenTransCount; i++)
+ if (ListenTransFds[i] == fd)
+ return ListenTransConns[i];
}
return NULL;
@@ -310,28 +309,27 @@ InitConnectionLimits(void)
#ifdef HAVE_GETDTABLESIZE
if (lastfdesc < 0)
- lastfdesc = getdtablesize() - 1;
+ lastfdesc = getdtablesize() - 1;
#endif
#ifdef _NFILE
if (lastfdesc < 0)
- lastfdesc = _NFILE - 1;
+ lastfdesc = _NFILE - 1;
#endif
-#endif /* __CYGWIN__ */
+#endif /* __CYGWIN__ */
/* This is the fallback */
if (lastfdesc < 0)
- lastfdesc = MAXSOCKS;
+ lastfdesc = MAXSOCKS;
if (lastfdesc > MAXSELECT)
- lastfdesc = MAXSELECT;
+ lastfdesc = MAXSELECT;
- if (lastfdesc > MAXCLIENTS)
- {
- lastfdesc = MAXCLIENTS;
- if (debug_conns)
- ErrorF( "REACHED MAXIMUM CLIENTS LIMIT %d\n", MAXCLIENTS);
+ if (lastfdesc > MAXCLIENTS) {
+ lastfdesc = MAXCLIENTS;
+ if (debug_conns)
+ ErrorF("REACHED MAXIMUM CLIENTS LIMIT %d\n", MAXCLIENTS);
}
MaxClients = lastfdesc;
@@ -341,7 +339,7 @@ InitConnectionLimits(void)
#if !defined(WIN32)
if (!ConnectionTranslation)
- ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1));
+ ConnectionTranslation = (int *) xnfalloc(sizeof(int) * (lastfdesc + 1));
#else
InitConnectionTranslation();
#endif
@@ -365,11 +363,12 @@ InitParentProcess(void)
{
#if !defined(WIN32)
OsSigHandlerPtr handler;
- handler = OsSignal (SIGUSR1, SIG_IGN);
- if ( handler == SIG_IGN)
- RunFromSmartParent = TRUE;
+
+ handler = OsSignal(SIGUSR1, SIG_IGN);
+ if (handler == SIG_IGN)
+ RunFromSmartParent = TRUE;
OsSignal(SIGUSR1, handler);
- ParentProcess = getppid ();
+ ParentProcess = getppid();
#endif
}
@@ -378,12 +377,12 @@ NotifyParentProcess(void)
{
#if !defined(WIN32)
if (RunFromSmartParent) {
- if (ParentProcess > 1) {
- kill (ParentProcess, SIGUSR1);
- }
+ if (ParentProcess > 1) {
+ kill(ParentProcess, SIGUSR1);
+ }
}
if (RunFromSigStopParent)
- raise (SIGSTOP);
+ raise(SIGSTOP);
#endif
}
@@ -395,9 +394,9 @@ NotifyParentProcess(void)
void
CreateWellKnownSockets(void)
{
- int i;
- int partial;
- char port[20];
+ int i;
+ int partial;
+ char port[20];
FD_ZERO(&AllSockets);
FD_ZERO(&AllClients);
@@ -405,111 +404,105 @@ CreateWellKnownSockets(void)
FD_ZERO(&ClientsWithInput);
#if !defined(WIN32)
- for (i=0; i<MaxClients; i++) ConnectionTranslation[i] = 0;
+ for (i = 0; i < MaxClients; i++)
+ ConnectionTranslation[i] = 0;
#else
ClearConnectionTranslation();
#endif
- FD_ZERO (&WellKnownConnections);
+ FD_ZERO(&WellKnownConnections);
- snprintf (port, sizeof(port), "%d", atoi (display));
+ snprintf(port, sizeof(port), "%d", atoi(display));
- if ((_XSERVTransMakeAllCOTSServerListeners (port, &partial,
- &ListenTransCount, &ListenTransConns) >= 0) &&
- (ListenTransCount >= 1))
- {
- if (!PartialNetwork && partial)
- {
- FatalError ("Failed to establish all listening sockets");
- }
- else
- {
- ListenTransFds = malloc(ListenTransCount * sizeof (int));
-
- for (i = ListenTransCount; i > 0; i--)
- {
- int fd = _XSERVTransGetConnectionNumber (ListenTransConns[i-1]);
-
- ListenTransFds[i-1] = fd;
- FD_SET (fd, &WellKnownConnections);
-
- if (!_XSERVTransIsLocal (ListenTransConns[i-1]))
- {
- int protocol = 0;
- if (!strcmp("inet", ListenTransConns[i-1]->transptr->TransName)) protocol = 4;
- else if (!strcmp("inet6", ListenTransConns[i-1]->transptr->TransName)) protocol = 6;
- DefineSelf (fd, protocol);
- }
- }
- }
+ if ((_XSERVTransMakeAllCOTSServerListeners(port, &partial,
+ &ListenTransCount,
+ &ListenTransConns) >= 0) &&
+ (ListenTransCount >= 1)) {
+ if (!PartialNetwork && partial) {
+ FatalError("Failed to establish all listening sockets");
+ }
+ else {
+ ListenTransFds = malloc(ListenTransCount * sizeof(int));
+
+ for (i = ListenTransCount; i > 0; i--) {
+ int fd = _XSERVTransGetConnectionNumber (ListenTransConns[i-1]);
+
+ ListenTransFds[i-1] = fd;
+ FD_SET(fd, &WellKnownConnections);
+
+ if (!_XSERVTransIsLocal (ListenTransConns[i-1])) {
+ int protocol = 0;
+ if (!strcmp("inet", ListenTransConns[i-1]->transptr->TransName)) protocol = 4;
+ else if (!strcmp("inet6", ListenTransConns[i-1]->transptr->TransName)) protocol = 6;
+ DefineSelf (fd, protocol);
+ }
+ }
+ }
}
- if (!XFD_ANYSET (&WellKnownConnections))
- FatalError ("Cannot establish any listening sockets - Make sure an X server isn't already running");
+ if (!XFD_ANYSET(&WellKnownConnections))
+ FatalError
+ ("Cannot establish any listening sockets - Make sure an X server isn't already running");
#if !defined(WIN32)
- OsSignal (SIGPIPE, SIG_IGN);
- OsSignal (SIGHUP, AutoResetServer);
+ OsSignal(SIGPIPE, SIG_IGN);
+ OsSignal(SIGHUP, AutoResetServer);
#endif
- OsSignal (SIGINT, GiveUp);
- OsSignal (SIGTERM, GiveUp);
- XFD_COPYSET (&WellKnownConnections, &AllSockets);
+ OsSignal(SIGINT, GiveUp);
+ OsSignal(SIGTERM, GiveUp);
+ XFD_COPYSET(&WellKnownConnections, &AllSockets);
ResetHosts(display);
InitParentProcess();
#ifdef XDMCP
- XdmcpInit ();
+ XdmcpInit();
#endif
}
void
-ResetWellKnownSockets (void)
+ResetWellKnownSockets(void)
{
int i;
ResetOsBuffers();
- for (i = 0; i < ListenTransCount; i++)
- {
- int status = _XSERVTransResetListener (ListenTransConns[i]);
-
- if (status != TRANS_RESET_NOOP)
- {
- if (status == TRANS_RESET_FAILURE)
- {
- /*
- * ListenTransConns[i] freed by xtrans.
- * Remove it from out list.
- */
-
- FD_CLR (ListenTransFds[i], &WellKnownConnections);
- ListenTransFds[i] = ListenTransFds[ListenTransCount - 1];
- ListenTransConns[i] = ListenTransConns[ListenTransCount - 1];
- ListenTransCount -= 1;
- i -= 1;
- }
- else if (status == TRANS_RESET_NEW_FD)
- {
- /*
- * A new file descriptor was allocated (the old one was closed)
- */
-
- int newfd = _XSERVTransGetConnectionNumber (ListenTransConns[i]);
-
- FD_CLR (ListenTransFds[i], &WellKnownConnections);
- ListenTransFds[i] = newfd;
- FD_SET(newfd, &WellKnownConnections);
- }
- }
+ for (i = 0; i < ListenTransCount; i++) {
+ int status = _XSERVTransResetListener(ListenTransConns[i]);
+
+ if (status != TRANS_RESET_NOOP) {
+ if (status == TRANS_RESET_FAILURE) {
+ /*
+ * ListenTransConns[i] freed by xtrans.
+ * Remove it from out list.
+ */
+
+ FD_CLR(ListenTransFds[i], &WellKnownConnections);
+ ListenTransFds[i] = ListenTransFds[ListenTransCount - 1];
+ ListenTransConns[i] = ListenTransConns[ListenTransCount - 1];
+ ListenTransCount -= 1;
+ i -= 1;
+ }
+ else if (status == TRANS_RESET_NEW_FD) {
+ /*
+ * A new file descriptor was allocated (the old one was closed)
+ */
+
+ int newfd = _XSERVTransGetConnectionNumber(ListenTransConns[i]);
+
+ FD_CLR(ListenTransFds[i], &WellKnownConnections);
+ ListenTransFds[i] = newfd;
+ FD_SET(newfd, &WellKnownConnections);
+ }
+ }
}
- ResetAuthorization ();
+ ResetAuthorization();
ResetHosts(display);
/*
* restart XDMCP
*/
#ifdef XDMCP
- XdmcpReset ();
+ XdmcpReset();
#endif
}
@@ -519,17 +512,18 @@ CloseWellKnownConnections(void)
int i;
for (i = 0; i < ListenTransCount; i++)
- _XSERVTransClose (ListenTransConns[i]);
+ _XSERVTransClose(ListenTransConns[i]);
}
static void
-AuthAudit (ClientPtr client, Bool letin,
- struct sockaddr *saddr, int len,
- unsigned int proto_n, char *auth_proto, int auth_id)
+AuthAudit(ClientPtr client, Bool letin,
+ struct sockaddr *saddr, int len,
+ unsigned int proto_n, char *auth_proto, int auth_id)
{
char addr[128];
char client_uid_string[64];
LocalClientCredRec *lcc;
+
#ifdef XSERVER_DTRACE
pid_t client_pid = -1;
zoneid_t client_zid = -1;
@@ -538,93 +532,93 @@ AuthAudit (ClientPtr client, Bool letin,
if (!len)
strlcpy(addr, "local host", sizeof(addr));
else
- switch (saddr->sa_family)
- {
- case AF_UNSPEC:
+ switch (saddr->sa_family) {
+ case AF_UNSPEC:
#if defined(UNIXCONN) || defined(LOCALCONN)
- case AF_UNIX:
+ case AF_UNIX:
#endif
- strlcpy(addr, "local host", sizeof(addr));
- break;
+ strlcpy(addr, "local host", sizeof(addr));
+ break;
#if defined(TCPCONN) || defined(STREAMSCONN)
- case AF_INET:
- snprintf(addr, sizeof(addr), "IP %s",
- inet_ntoa(((struct sockaddr_in *) saddr)->sin_addr));
- break;
+ case AF_INET:
+ snprintf(addr, sizeof(addr), "IP %s",
+ inet_ntoa(((struct sockaddr_in *) saddr)->sin_addr));
+ break;
#if defined(IPv6) && defined(AF_INET6)
- case AF_INET6: {
- char ipaddr[INET6_ADDRSTRLEN];
- inet_ntop(AF_INET6, &((struct sockaddr_in6 *) saddr)->sin6_addr,
- ipaddr, sizeof(ipaddr));
- snprintf(addr, sizeof(addr), "IP %s", ipaddr);
- }
- break;
+ case AF_INET6:{
+ char ipaddr[INET6_ADDRSTRLEN];
+
+ inet_ntop(AF_INET6, &((struct sockaddr_in6 *) saddr)->sin6_addr,
+ ipaddr, sizeof(ipaddr));
+ snprintf(addr, sizeof(addr), "IP %s", ipaddr);
+ }
+ break;
#endif
#endif
- default:
- strlcpy(addr, "unknown address", sizeof(addr));
- }
+ default:
+ strlcpy(addr, "unknown address", sizeof(addr));
+ }
if (GetLocalClientCreds(client, &lcc) != -1) {
- int slen; /* length written to client_uid_string */
-
- strcpy(client_uid_string, " ( ");
- slen = 3;
-
- if (lcc->fieldsSet & LCC_UID_SET) {
- snprintf(client_uid_string + slen,
- sizeof(client_uid_string) - slen,
- "uid=%ld ", (long) lcc->euid);
- slen = strlen(client_uid_string);
- }
-
- if (lcc->fieldsSet & LCC_GID_SET) {
- snprintf(client_uid_string + slen,
- sizeof(client_uid_string) - slen,
- "gid=%ld ", (long) lcc->egid);
- slen = strlen(client_uid_string);
- }
-
- if (lcc->fieldsSet & LCC_PID_SET) {
-#ifdef XSERVER_DTRACE
- client_pid = lcc->pid;
+ int slen; /* length written to client_uid_string */
+
+ strcpy(client_uid_string, " ( ");
+ slen = 3;
+
+ if (lcc->fieldsSet & LCC_UID_SET) {
+ snprintf(client_uid_string + slen,
+ sizeof(client_uid_string) - slen,
+ "uid=%ld ", (long) lcc->euid);
+ slen = strlen(client_uid_string);
+ }
+
+ if (lcc->fieldsSet & LCC_GID_SET) {
+ snprintf(client_uid_string + slen,
+ sizeof(client_uid_string) - slen,
+ "gid=%ld ", (long) lcc->egid);
+ slen = strlen(client_uid_string);
+ }
+
+ if (lcc->fieldsSet & LCC_PID_SET) {
+#ifdef XSERVER_DTRACE
+ client_pid = lcc->pid;
#endif
- snprintf(client_uid_string + slen,
- sizeof(client_uid_string) - slen,
- "pid=%ld ", (long) lcc->pid);
- slen = strlen(client_uid_string);
- }
-
- if (lcc->fieldsSet & LCC_ZID_SET) {
+ snprintf(client_uid_string + slen,
+ sizeof(client_uid_string) - slen,
+ "pid=%ld ", (long) lcc->pid);
+ slen = strlen(client_uid_string);
+ }
+
+ if (lcc->fieldsSet & LCC_ZID_SET) {
#ifdef XSERVER_DTRACE
- client_zid = lcc->zoneid;
-#endif
- snprintf(client_uid_string + slen,
- sizeof(client_uid_string) - slen,
- "zoneid=%ld ", (long) lcc->zoneid);
- slen = strlen(client_uid_string);
- }
-
- snprintf(client_uid_string + slen, sizeof(client_uid_string) - slen,
- ")");
- FreeLocalClientCreds(lcc);
+ client_zid = lcc->zoneid;
+#endif
+ snprintf(client_uid_string + slen,
+ sizeof(client_uid_string) - slen,
+ "zoneid=%ld ", (long) lcc->zoneid);
+ slen = strlen(client_uid_string);
+ }
+
+ snprintf(client_uid_string + slen, sizeof(client_uid_string) - slen,
+ ")");
+ FreeLocalClientCreds(lcc);
}
else {
- client_uid_string[0] = '\0';
+ client_uid_string[0] = '\0';
}
-
+
#ifdef XSERVER_DTRACE
XSERVER_CLIENT_AUTH(client->index, addr, client_pid, client_zid);
#endif
if (auditTrailLevel > 1) {
- if (proto_n)
- AuditF("client %d %s from %s%s\n Auth name: %.*s ID: %d\n",
- client->index, letin ? "connected" : "rejected", addr,
- client_uid_string, (int)proto_n, auth_proto, auth_id);
- else
- AuditF("client %d %s from %s%s\n",
- client->index, letin ? "connected" : "rejected", addr,
- client_uid_string);
+ if (proto_n)
+ AuditF("client %d %s from %s%s\n Auth name: %.*s ID: %d\n",
+ client->index, letin ? "connected" : "rejected", addr,
+ client_uid_string, (int) proto_n, auth_proto, auth_id);
+ else
+ AuditF("client %d %s from %s%s\n",
+ client->index, letin ? "connected" : "rejected", addr,
+ client_uid_string);
}
}
@@ -633,12 +627,11 @@ XID
AuthorizationIDOfClient(ClientPtr client)
{
if (client->osPrivate)
- return ((OsCommPtr)client->osPrivate)->auth_id;
+ return ((OsCommPtr) client->osPrivate)->auth_id;
else
- return None;
+ return None;
}
-
/*****************************************************************
* ClientAuthorized
*
@@ -659,58 +652,58 @@ AuthorizationIDOfClient(ClientPtr client)
*****************************************************************/
const char *
-ClientAuthorized(ClientPtr client,
- unsigned int proto_n, char *auth_proto,
- unsigned int string_n, char *auth_string)
+ClientAuthorized(ClientPtr client,
+ unsigned int proto_n, char *auth_proto,
+ unsigned int string_n, char *auth_string)
{
- OsCommPtr priv;
- Xtransaddr *from = NULL;
- int family;
- int fromlen;
- XID auth_id;
- const char *reason = NULL;
- XtransConnInfo trans_conn;
-
- priv = (OsCommPtr)client->osPrivate;
+ OsCommPtr priv;
+ Xtransaddr *from = NULL;
+ int family;
+ int fromlen;
+ XID auth_id;
+ const char *reason = NULL;
+ XtransConnInfo trans_conn;
+
+ priv = (OsCommPtr) client->osPrivate;
trans_conn = priv->trans_conn;
/* Allow any client to connect without authorization on a launchd socket,
because it is securely created -- this prevents a race condition on launch */
- if(trans_conn->flags & TRANS_NOXAUTH) {
+ if (trans_conn->flags & TRANS_NOXAUTH) {
auth_id = (XID) 0L;
- } else {
- auth_id = CheckAuthorization (proto_n, auth_proto, string_n, auth_string, client, &reason);
+ }
+ else {
+ auth_id =
+ CheckAuthorization(proto_n, auth_proto, string_n, auth_string,
+ client, &reason);
}
- if (auth_id == (XID) ~0L)
- {
- if (_XSERVTransGetPeerAddr(trans_conn, &family, &fromlen, &from) != -1)
- {
- if (InvalidHost ((struct sockaddr *) from, fromlen, client))
- AuthAudit(client, FALSE, (struct sockaddr *) from,
- fromlen, proto_n, auth_proto, auth_id);
- else
- {
- auth_id = (XID) 0;
+ if (auth_id == (XID) ~0L) {
+ if (_XSERVTransGetPeerAddr(trans_conn, &family, &fromlen, &from) != -1) {
+ if (InvalidHost((struct sockaddr *) from, fromlen, client))
+ AuthAudit(client, FALSE, (struct sockaddr *) from,
+ fromlen, proto_n, auth_proto, auth_id);
+ else {
+ auth_id = (XID) 0;
#ifdef XSERVER_DTRACE
- if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
+ if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
#else
- if (auditTrailLevel > 1)
+ if (auditTrailLevel > 1)
#endif
- AuthAudit(client, TRUE,
- (struct sockaddr *) from, fromlen,
- proto_n, auth_proto, auth_id);
- }
-
- free(from);
- }
-
- if (auth_id == (XID) ~0L) {
- if (reason)
- return reason;
- else
- return "Client is not authorized to connect to Server";
- }
+ AuthAudit(client, TRUE,
+ (struct sockaddr *) from, fromlen,
+ proto_n, auth_proto, auth_id);
+ }
+
+ free(from);
+ }
+
+ if (auth_id == (XID) ~0L) {
+ if (reason)
+ return reason;
+ else
+ return "Client is not authorized to connect to Server";
+ }
}
#ifdef XSERVER_DTRACE
else if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
@@ -718,14 +711,12 @@ ClientAuthorized(ClientPtr client,
else if (auditTrailLevel > 1)
#endif
{
- if (_XSERVTransGetPeerAddr (trans_conn,
- &family, &fromlen, &from) != -1)
- {
- AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen,
- proto_n, auth_proto, auth_id);
-
- free(from);
- }
+ if (_XSERVTransGetPeerAddr(trans_conn, &family, &fromlen, &from) != -1) {
+ AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen,
+ proto_n, auth_proto, auth_id);
+
+ free(from);
+ }
}
priv->auth_id = auth_id;
priv->conn_time = 0;
@@ -733,7 +724,7 @@ ClientAuthorized(ClientPtr client,
#ifdef XDMCP
/* indicate to Xdmcp protocol that we've opened new client */
XdmcpOpenDisplay(priv->fd);
-#endif /* XDMCP */
+#endif /* XDMCP */
XaceHook(XACE_AUTH_AVAIL, client, auth_id);
@@ -743,36 +734,35 @@ ClientAuthorized(ClientPtr client,
* true purpose of the selfhosts list is to see who may change the
* access control list.
*/
- return((char *)NULL);
+ return ((char *) NULL);
}
static ClientPtr
-AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
+AllocNewConnection(XtransConnInfo trans_conn, int fd, CARD32 conn_time)
{
- OsCommPtr oc;
- ClientPtr client;
-
+ OsCommPtr oc;
+ ClientPtr client;
+
if (
#ifndef WIN32
- fd >= lastfdesc
+ fd >= lastfdesc
#else
- XFD_SETCOUNT(&AllClients) >= MaxClients
+ XFD_SETCOUNT(&AllClients) >= MaxClients
#endif
- )
- return NullClient;
+ )
+ return NullClient;
oc = malloc(sizeof(OsCommRec));
if (!oc)
- return NullClient;
+ return NullClient;
oc->trans_conn = trans_conn;
oc->fd = fd;
- oc->input = (ConnectionInputPtr)NULL;
- oc->output = (ConnectionOutputPtr)NULL;
+ oc->input = (ConnectionInputPtr) NULL;
+ oc->output = (ConnectionOutputPtr) NULL;
oc->auth_id = None;
oc->conn_time = conn_time;
- if (!(client = NextAvailableClient((pointer)oc)))
- {
- free(oc);
- return NullClient;
+ if (!(client = NextAvailableClient((pointer) oc))) {
+ free(oc);
+ return NullClient;
}
oc->local_client = ComputeLocalClient(client);
#if !defined(WIN32)
@@ -780,24 +770,22 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
#else
SetConnectionTranslation(fd, client->index);
#endif
- if (GrabInProgress)
- {
+ if (GrabInProgress) {
FD_SET(fd, &SavedAllClients);
FD_SET(fd, &SavedAllSockets);
}
- else
- {
+ else {
FD_SET(fd, &AllClients);
FD_SET(fd, &AllSockets);
}
#ifdef DEBUG
ErrorF("AllocNewConnection: client index = %d, socket fd = %d\n",
- client->index, fd);
+ client->index, fd);
#endif
#ifdef XSERVER_DTRACE
XSERVER_CLIENT_CONNECT(client->index, fd);
-#endif
+#endif
return client;
}
@@ -809,90 +797,85 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
* and AllSockets.
*****************/
-/*ARGSUSED*/
-Bool
+ /*ARGSUSED*/ Bool
EstablishNewConnections(ClientPtr clientUnused, pointer closure)
{
- fd_set readyconnections; /* set of listeners that are ready */
- int curconn; /* fd of listener that's ready */
- register int newconn; /* fd of new client */
+ fd_set readyconnections; /* set of listeners that are ready */
+ int curconn; /* fd of listener that's ready */
+ register int newconn; /* fd of new client */
CARD32 connect_time;
register int i;
register ClientPtr client;
register OsCommPtr oc;
fd_set tmask;
- XFD_ANDSET (&tmask, (fd_set*)closure, &WellKnownConnections);
+ XFD_ANDSET(&tmask, (fd_set *) closure, &WellKnownConnections);
XFD_COPYSET(&tmask, &readyconnections);
if (!XFD_ANYSET(&readyconnections))
- return TRUE;
+ return TRUE;
connect_time = GetTimeInMillis();
/* kill off stragglers */
- for (i=1; i<currentMaxClients; i++)
- {
- if ((client = clients[i]))
- {
- oc = (OsCommPtr)(client->osPrivate);
- if ((oc && (oc->conn_time != 0) &&
- (connect_time - oc->conn_time) >= TimeOutValue) ||
- (client->noClientException != Success && !client->clientGone))
- CloseDownClient(client);
- }
+ for (i = 1; i < currentMaxClients; i++) {
+ if ((client = clients[i])) {
+ oc = (OsCommPtr) (client->osPrivate);
+ if ((oc && (oc->conn_time != 0) &&
+ (connect_time - oc->conn_time) >= TimeOutValue) ||
+ (client->noClientException != Success && !client->clientGone))
+ CloseDownClient(client);
+ }
}
#ifndef WIN32
- for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++)
- {
- while (readyconnections.fds_bits[i])
+ for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
+ while (readyconnections.fds_bits[i])
#else
- for (i = 0; i < XFD_SETCOUNT(&readyconnections); i++)
+ for (i = 0; i < XFD_SETCOUNT(&readyconnections); i++)
#endif
- {
- XtransConnInfo trans_conn, new_trans_conn;
- int status;
+ {
+ XtransConnInfo trans_conn, new_trans_conn;
+ int status;
#ifndef WIN32
- curconn = mffs (readyconnections.fds_bits[i]) - 1;
- readyconnections.fds_bits[i] &= ~((fd_mask)1 << curconn);
- curconn += (i * (sizeof(fd_mask)*8));
+ curconn = mffs(readyconnections.fds_bits[i]) - 1;
+ readyconnections.fds_bits[i] &= ~((fd_mask) 1 << curconn);
+ curconn += (i * (sizeof(fd_mask) * 8));
#else
- curconn = XFD_FD(&readyconnections, i);
+ curconn = XFD_FD(&readyconnections, i);
#endif
- if ((trans_conn = lookup_trans_conn (curconn)) == NULL)
- continue;
+ if ((trans_conn = lookup_trans_conn(curconn)) == NULL)
+ continue;
- if ((new_trans_conn = _XSERVTransAccept (trans_conn, &status)) == NULL)
- continue;
+ if ((new_trans_conn = _XSERVTransAccept(trans_conn, &status)) == NULL)
+ continue;
- newconn = _XSERVTransGetConnectionNumber (new_trans_conn);
+ newconn = _XSERVTransGetConnectionNumber(new_trans_conn);
+
+ if (newconn < lastfdesc) {
+ int clientid;
- if (newconn < lastfdesc)
- {
- int clientid;
#if !defined(WIN32)
- clientid = ConnectionTranslation[newconn];
+ clientid = ConnectionTranslation[newconn];
#else
- clientid = GetConnectionTranslation(newconn);
+ clientid = GetConnectionTranslation(newconn);
#endif
- if(clientid && (client = clients[clientid]))
- CloseDownClient(client);
- }
+ if (clientid && (client = clients[clientid]))
+ CloseDownClient(client);
+ }
- _XSERVTransSetOption(new_trans_conn, TRANS_NONBLOCKING, 1);
+ _XSERVTransSetOption(new_trans_conn, TRANS_NONBLOCKING, 1);
- if(trans_conn->flags & TRANS_NOXAUTH)
- new_trans_conn->flags = new_trans_conn->flags | TRANS_NOXAUTH;
+ if (trans_conn->flags & TRANS_NOXAUTH)
+ new_trans_conn->flags = new_trans_conn->flags | TRANS_NOXAUTH;
- if (!AllocNewConnection (new_trans_conn, newconn, connect_time))
- {
- ErrorConnMax(new_trans_conn);
- _XSERVTransClose(new_trans_conn);
- }
- }
-#ifndef WIN32
+ if (!AllocNewConnection(new_trans_conn, newconn, connect_time)) {
+ ErrorConnMax(new_trans_conn);
+ _XSERVTransClose(new_trans_conn);
+ }
}
+#ifndef WIN32
+}
#endif
- return TRUE;
+return TRUE;
}
#define NOROOM "Maximum number of clients reached"
@@ -902,12 +885,12 @@ EstablishNewConnections(ClientPtr clientUnused, pointer closure)
* Fail a connection due to lack of client or file descriptor space
************/
-#define BOTIMEOUT 200 /* in milliseconds */
+#define BOTIMEOUT 200 /* in milliseconds */
static void
ErrorConnMax(XtransConnInfo trans_conn)
{
- int fd = _XSERVTransGetConnectionNumber (trans_conn);
+ int fd = _XSERVTransGetConnectionNumber(trans_conn);
xConnSetupPrefix csp;
char pad[3];
struct iovec iov[3];
@@ -919,33 +902,31 @@ ErrorConnMax(XtransConnInfo trans_conn)
/* if these seems like a lot of trouble to go to, it probably is */
waittime.tv_sec = BOTIMEOUT / MILLI_PER_SECOND;
waittime.tv_usec = (BOTIMEOUT % MILLI_PER_SECOND) *
- (1000000 / MILLI_PER_SECOND);
+ (1000000 / MILLI_PER_SECOND);
FD_ZERO(&mask);
FD_SET(fd, &mask);
- (void)Select(fd + 1, &mask, NULL, NULL, &waittime);
+ (void) Select(fd + 1, &mask, NULL, NULL, &waittime);
/* try to read the byte-order of the connection */
- (void)_XSERVTransRead(trans_conn, &byteOrder, 1);
- if ((byteOrder == 'l') || (byteOrder == 'B'))
- {
- csp.success = xFalse;
- csp.lengthReason = sizeof(NOROOM) - 1;
- csp.length = (sizeof(NOROOM) + 2) >> 2;
- csp.majorVersion = X_PROTOCOL;
- csp.minorVersion = X_PROTOCOL_REVISION;
- if (((*(char *) &whichbyte) && (byteOrder == 'B')) ||
- (!(*(char *) &whichbyte) && (byteOrder == 'l')))
- {
- swaps(&csp.majorVersion);
- swaps(&csp.minorVersion);
- swaps(&csp.length);
- }
- iov[0].iov_len = sz_xConnSetupPrefix;
- iov[0].iov_base = (char *) &csp;
- iov[1].iov_len = csp.lengthReason;
- iov[1].iov_base = NOROOM;
- iov[2].iov_len = (4 - (csp.lengthReason & 3)) & 3;
- iov[2].iov_base = pad;
- (void)_XSERVTransWritev(trans_conn, iov, 3);
+ (void) _XSERVTransRead(trans_conn, &byteOrder, 1);
+ if ((byteOrder == 'l') || (byteOrder == 'B')) {
+ csp.success = xFalse;
+ csp.lengthReason = sizeof(NOROOM) - 1;
+ csp.length = (sizeof(NOROOM) + 2) >> 2;
+ csp.majorVersion = X_PROTOCOL;
+ csp.minorVersion = X_PROTOCOL_REVISION;
+ if (((*(char *) &whichbyte) && (byteOrder == 'B')) ||
+ (!(*(char *) &whichbyte) && (byteOrder == 'l'))) {
+ swaps(&csp.majorVersion);
+ swaps(&csp.minorVersion);
+ swaps(&csp.length);
+ }
+ iov[0].iov_len = sz_xConnSetupPrefix;
+ iov[0].iov_base = (char *) &csp;
+ iov[1].iov_len = csp.lengthReason;
+ iov[1].iov_base = NOROOM;
+ iov[2].iov_len = (4 - (csp.lengthReason & 3)) & 3;
+ iov[2].iov_base = pad;
+ (void) _XSERVTransWritev(trans_conn, iov, 3);
}
}
@@ -960,27 +941,26 @@ CloseDownFileDescriptor(OsCommPtr oc)
int connection = oc->fd;
if (oc->trans_conn) {
- _XSERVTransDisconnect(oc->trans_conn);
- _XSERVTransClose(oc->trans_conn);
+ _XSERVTransDisconnect(oc->trans_conn);
+ _XSERVTransClose(oc->trans_conn);
}
#ifndef WIN32
ConnectionTranslation[connection] = 0;
#else
SetConnectionTranslation(connection, 0);
-#endif
+#endif
FD_CLR(connection, &AllSockets);
FD_CLR(connection, &AllClients);
FD_CLR(connection, &ClientsWithInput);
FD_CLR(connection, &GrabImperviousClients);
- if (GrabInProgress)
- {
- FD_CLR(connection, &SavedAllSockets);
- FD_CLR(connection, &SavedAllClients);
- FD_CLR(connection, &SavedClientsWithInput);
+ if (GrabInProgress) {
+ FD_CLR(connection, &SavedAllSockets);
+ FD_CLR(connection, &SavedAllClients);
+ FD_CLR(connection, &SavedClientsWithInput);
}
FD_CLR(connection, &ClientsWriteBlocked);
if (!XFD_ANYSET(&ClientsWriteBlocked))
- AnyClientsWriteBlocked = FALSE;
+ AnyClientsWriteBlocked = FALSE;
FD_CLR(connection, &OutputPending);
}
@@ -997,14 +977,15 @@ void
CheckConnections(void)
{
#ifndef WIN32
- fd_mask mask;
- int curoff;
+ fd_mask mask;
+ int curoff;
#endif
- fd_set tmask;
- int curclient;
- int i;
- struct timeval notime;
+ fd_set tmask;
+ int curclient;
+ int i;
+ struct timeval notime;
int r;
+
#ifdef WIN32
fd_set savedAllSockets;
unsigned j;
@@ -1014,47 +995,42 @@ CheckConnections(void)
notime.tv_usec = 0;
#ifndef WIN32
- for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
- {
- mask = AllClients.fds_bits[i];
- while (mask)
- {
- curoff = mffs (mask) - 1;
- curclient = curoff + (i * (sizeof(fd_mask)*8));
+ for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
+ mask = AllClients.fds_bits[i];
+ while (mask) {
+ curoff = mffs(mask) - 1;
+ curclient = curoff + (i * (sizeof(fd_mask) * 8));
FD_ZERO(&tmask);
FD_SET(curclient, &tmask);
do {
- r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
+ r = Select(curclient + 1, &tmask, NULL, NULL, &notime);
} while (r < 0 && (errno == EINTR || errno == EAGAIN));
if (r < 0)
if (ConnectionTranslation[curclient] > 0)
CloseDownClient(clients[ConnectionTranslation[curclient]]);
- mask &= ~((fd_mask)1 << curoff);
- }
- }
+ mask &= ~((fd_mask) 1 << curoff);
+ }
+ }
#else
/* First test AllSockets and then AllClients are valid sockets */
XFD_COPYSET(&AllSockets, &savedAllSockets);
- for (j=0; j<2; j++)
- {
- for (i = 0; i < XFD_SETCOUNT(&savedAllSockets); i++)
- {
- curclient = XFD_FD(&savedAllSockets, i);
- FD_ZERO(&tmask);
- FD_SET(curclient, &tmask);
- do {
- r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
- } while (r == SOCKET_ERROR && (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEWOULDBLOCK));
- if (r < 0)
- if (GetConnectionTranslation(curclient) > 0)
- CloseDownClient(clients[GetConnectionTranslation(curclient)]);
- }
- XFD_COPYSET(&AllClients, &savedAllSockets);
- }
+ for (j=0; j<2; j++) {
+ for (i = 0; i < XFD_SETCOUNT(&savedAllSockets); i++) {
+ curclient = XFD_FD(&savedAllSockets, i);
+ FD_ZERO(&tmask);
+ FD_SET(curclient, &tmask);
+ do {
+ r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
+ } while (r == SOCKET_ERROR && (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEWOULDBLOCK));
+ if (r < 0)
+ if (GetConnectionTranslation(curclient) > 0)
+ CloseDownClient(clients[GetConnectionTranslation(curclient)]);
+ }
+ XFD_COPYSET(&AllClients, &savedAllSockets);
+ }
#endif
}
-
/*****************
* CloseDownConnection
* Delete client from AllClients and free resources
@@ -1063,26 +1039,26 @@ CheckConnections(void)
void
CloseDownConnection(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
if (FlushCallback)
- CallCallbacks(&FlushCallback, NULL);
+ CallCallbacks(&FlushCallback, NULL);
#ifdef DEBUG
ErrorF("CloseDownConnection: client index = %d, socket fd = %d\n",
- client->index, oc->fd);
+ client->index, oc->fd);
#endif
if (oc->output && oc->output->count)
- FlushClient(client, oc, (char *)NULL, 0);
+ FlushClient(client, oc, (char *) NULL, 0);
#ifdef XDMCP
XdmcpCloseDisplay(oc->fd);
#endif
CloseDownFileDescriptor(oc);
FreeOsBuffers(oc);
free(client->osPrivate);
- client->osPrivate = (pointer)NULL;
+ client->osPrivate = (pointer) NULL;
if (auditTrailLevel > 1)
- AuditF("client %d disconnected\n", client->index);
+ AuditF("client %d disconnected\n", client->index);
}
void
@@ -1090,7 +1066,7 @@ AddGeneralSocket(int fd)
{
FD_SET(fd, &AllSockets);
if (GrabInProgress)
- FD_SET(fd, &SavedAllSockets);
+ FD_SET(fd, &SavedAllSockets);
}
void
@@ -1105,7 +1081,7 @@ RemoveGeneralSocket(int fd)
{
FD_CLR(fd, &AllSockets);
if (GrabInProgress)
- FD_CLR(fd, &SavedAllSockets);
+ FD_CLR(fd, &SavedAllSockets);
}
void
@@ -1128,31 +1104,29 @@ RemoveEnabledDevice(int fd)
int
OnlyListenToOneClient(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
int rc, connection = oc->fd;
rc = XaceHook(XACE_SERVER_ACCESS, client, DixGrabAccess);
if (rc != Success)
- return rc;
-
- if (! GrabInProgress)
- {
- XFD_COPYSET(&ClientsWithInput, &SavedClientsWithInput);
- XFD_ANDSET(&ClientsWithInput,
- &ClientsWithInput, &GrabImperviousClients);
- if (FD_ISSET(connection, &SavedClientsWithInput))
- {
- FD_CLR(connection, &SavedClientsWithInput);
- FD_SET(connection, &ClientsWithInput);
- }
- XFD_UNSET(&SavedClientsWithInput, &GrabImperviousClients);
- XFD_COPYSET(&AllSockets, &SavedAllSockets);
- XFD_COPYSET(&AllClients, &SavedAllClients);
- XFD_UNSET(&AllSockets, &AllClients);
- XFD_ANDSET(&AllClients, &AllClients, &GrabImperviousClients);
- FD_SET(connection, &AllClients);
- XFD_ORSET(&AllSockets, &AllSockets, &AllClients);
- GrabInProgress = client->index;
+ return rc;
+
+ if (!GrabInProgress) {
+ XFD_COPYSET(&ClientsWithInput, &SavedClientsWithInput);
+ XFD_ANDSET(&ClientsWithInput,
+ &ClientsWithInput, &GrabImperviousClients);
+ if (FD_ISSET(connection, &SavedClientsWithInput)) {
+ FD_CLR(connection, &SavedClientsWithInput);
+ FD_SET(connection, &ClientsWithInput);
+ }
+ XFD_UNSET(&SavedClientsWithInput, &GrabImperviousClients);
+ XFD_COPYSET(&AllSockets, &SavedAllSockets);
+ XFD_COPYSET(&AllClients, &SavedAllClients);
+ XFD_UNSET(&AllSockets, &AllClients);
+ XFD_ANDSET(&AllClients, &AllClients, &GrabImperviousClients);
+ FD_SET(connection, &AllClients);
+ XFD_ORSET(&AllSockets, &AllSockets, &AllClients);
+ GrabInProgress = client->index;
}
return rc;
}
@@ -1165,13 +1139,12 @@ OnlyListenToOneClient(ClientPtr client)
void
ListenToAllClients(void)
{
- if (GrabInProgress)
- {
- XFD_ORSET(&AllSockets, &AllSockets, &SavedAllSockets);
- XFD_ORSET(&AllClients, &AllClients, &SavedAllClients);
- XFD_ORSET(&ClientsWithInput, &ClientsWithInput, &SavedClientsWithInput);
- GrabInProgress = 0;
- }
+ if (GrabInProgress) {
+ XFD_ORSET(&AllSockets, &AllSockets, &SavedAllSockets);
+ XFD_ORSET(&AllClients, &AllClients, &SavedAllClients);
+ XFD_ORSET(&ClientsWithInput, &ClientsWithInput, &SavedClientsWithInput);
+ GrabInProgress = 0;
+ }
}
/****************
@@ -1181,36 +1154,34 @@ ListenToAllClients(void)
****************/
void
-IgnoreClient (ClientPtr client)
+IgnoreClient(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
int connection = oc->fd;
client->ignoreCount++;
if (client->ignoreCount > 1)
- return;
+ return;
isItTimeToYield = TRUE;
- if (!GrabInProgress || FD_ISSET(connection, &AllClients))
- {
- if (FD_ISSET (connection, &ClientsWithInput))
- FD_SET(connection, &IgnoredClientsWithInput);
- else
- FD_CLR(connection, &IgnoredClientsWithInput);
- FD_CLR(connection, &ClientsWithInput);
- FD_CLR(connection, &AllSockets);
- FD_CLR(connection, &AllClients);
- FD_CLR(connection, &LastSelectMask);
+ if (!GrabInProgress || FD_ISSET(connection, &AllClients)) {
+ if (FD_ISSET(connection, &ClientsWithInput))
+ FD_SET(connection, &IgnoredClientsWithInput);
+ else
+ FD_CLR(connection, &IgnoredClientsWithInput);
+ FD_CLR(connection, &ClientsWithInput);
+ FD_CLR(connection, &AllSockets);
+ FD_CLR(connection, &AllClients);
+ FD_CLR(connection, &LastSelectMask);
}
- else
- {
- if (FD_ISSET (connection, &SavedClientsWithInput))
- FD_SET(connection, &IgnoredClientsWithInput);
- else
- FD_CLR(connection, &IgnoredClientsWithInput);
- FD_CLR(connection, &SavedClientsWithInput);
- FD_CLR(connection, &SavedAllSockets);
- FD_CLR(connection, &SavedAllClients);
+ else {
+ if (FD_ISSET(connection, &SavedClientsWithInput))
+ FD_SET(connection, &IgnoredClientsWithInput);
+ else
+ FD_CLR(connection, &IgnoredClientsWithInput);
+ FD_CLR(connection, &SavedClientsWithInput);
+ FD_CLR(connection, &SavedAllSockets);
+ FD_CLR(connection, &SavedAllClients);
}
}
@@ -1220,30 +1191,28 @@ IgnoreClient (ClientPtr client)
****************/
void
-AttendClient (ClientPtr client)
+AttendClient(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
int connection = oc->fd;
client->ignoreCount--;
if (client->ignoreCount)
- return;
+ return;
if (!GrabInProgress || GrabInProgress == client->index ||
- FD_ISSET(connection, &GrabImperviousClients))
- {
- FD_SET(connection, &AllClients);
- FD_SET(connection, &AllSockets);
- FD_SET(connection, &LastSelectMask);
- if (FD_ISSET (connection, &IgnoredClientsWithInput))
- FD_SET(connection, &ClientsWithInput);
+ FD_ISSET(connection, &GrabImperviousClients)) {
+ FD_SET(connection, &AllClients);
+ FD_SET(connection, &AllSockets);
+ FD_SET(connection, &LastSelectMask);
+ if (FD_ISSET(connection, &IgnoredClientsWithInput))
+ FD_SET(connection, &ClientsWithInput);
}
- else
- {
- FD_SET(connection, &SavedAllClients);
- FD_SET(connection, &SavedAllSockets);
- if (FD_ISSET(connection, &IgnoredClientsWithInput))
- FD_SET(connection, &SavedClientsWithInput);
+ else {
+ FD_SET(connection, &SavedAllClients);
+ FD_SET(connection, &SavedAllSockets);
+ if (FD_ISSET(connection, &IgnoredClientsWithInput))
+ FD_SET(connection, &SavedClientsWithInput);
}
}
@@ -1252,17 +1221,17 @@ AttendClient (ClientPtr client)
void
MakeClientGrabImpervious(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
int connection = oc->fd;
FD_SET(connection, &GrabImperviousClients);
- if (ServerGrabCallback)
- {
- ServerGrabInfoRec grabinfo;
- grabinfo.client = client;
- grabinfo.grabstate = CLIENT_IMPERVIOUS;
- CallCallbacks(&ServerGrabCallback, &grabinfo);
+ if (ServerGrabCallback) {
+ ServerGrabInfoRec grabinfo;
+
+ grabinfo.client = client;
+ grabinfo.grabstate = CLIENT_IMPERVIOUS;
+ CallCallbacks(&ServerGrabCallback, &grabinfo);
}
}
@@ -1271,42 +1240,43 @@ MakeClientGrabImpervious(ClientPtr client)
void
MakeClientGrabPervious(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
int connection = oc->fd;
FD_CLR(connection, &GrabImperviousClients);
- if (GrabInProgress && (GrabInProgress != client->index))
- {
- if (FD_ISSET(connection, &ClientsWithInput))
- {
- FD_SET(connection, &SavedClientsWithInput);
- FD_CLR(connection, &ClientsWithInput);
- }
- FD_CLR(connection, &AllSockets);
- FD_CLR(connection, &AllClients);
- isItTimeToYield = TRUE;
+ if (GrabInProgress && (GrabInProgress != client->index)) {
+ if (FD_ISSET(connection, &ClientsWithInput)) {
+ FD_SET(connection, &SavedClientsWithInput);
+ FD_CLR(connection, &ClientsWithInput);
+ }
+ FD_CLR(connection, &AllSockets);
+ FD_CLR(connection, &AllClients);
+ isItTimeToYield = TRUE;
}
- if (ServerGrabCallback)
- {
- ServerGrabInfoRec grabinfo;
- grabinfo.client = client;
- grabinfo.grabstate = CLIENT_PERVIOUS;
- CallCallbacks(&ServerGrabCallback, &grabinfo);
+ if (ServerGrabCallback) {
+ ServerGrabInfoRec grabinfo;
+
+ grabinfo.client = client;
+ grabinfo.grabstate = CLIENT_PERVIOUS;
+ CallCallbacks(&ServerGrabCallback, &grabinfo);
}
}
#ifdef XQUARTZ
/* Add a fd (from launchd) to our listeners */
-void ListenOnOpenFD(int fd, int noxauth) {
+void
+ListenOnOpenFD(int fd, int noxauth)
+{
char port[256];
XtransConnInfo ciptr;
const char *display_env = getenv("DISPLAY");
- if(display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) {
+ if (display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) {
/* Make the path the launchd socket if our DISPLAY is set right */
strcpy(port, display_env);
- } else {
+ }
+ else {
/* Just some default so things don't break and die. */
snprintf(port, sizeof(port), ":%d", atoi(display));
}
@@ -1315,25 +1285,29 @@ void ListenOnOpenFD(int fd, int noxauth) {
* TRANS_SOCKET_LOCAL_INDEX = 5 from Xtrans.c
*/
ciptr = _XSERVTransReopenCOTSServer(5, fd, port);
- if(ciptr == NULL) {
+ if (ciptr == NULL) {
ErrorF("Got NULL while trying to Reopen launchd port.\n");
return;
}
-
- if(noxauth)
+
+ if (noxauth)
ciptr->flags = ciptr->flags | TRANS_NOXAUTH;
/* Allocate space to store it */
- ListenTransFds = (int *) realloc(ListenTransFds, (ListenTransCount + 1) * sizeof (int));
- ListenTransConns = (XtransConnInfo *) realloc(ListenTransConns, (ListenTransCount + 1) * sizeof (XtransConnInfo));
-
+ ListenTransFds =
+ (int *) realloc(ListenTransFds, (ListenTransCount + 1) * sizeof(int));
+ ListenTransConns =
+ (XtransConnInfo *) realloc(ListenTransConns,
+ (ListenTransCount +
+ 1) * sizeof(XtransConnInfo));
+
/* Store it */
ListenTransConns[ListenTransCount] = ciptr;
ListenTransFds[ListenTransCount] = fd;
FD_SET(fd, &WellKnownConnections);
FD_SET(fd, &AllSockets);
-
+
/* Increment the count */
ListenTransCount++;
diff --git a/xorg-server/os/io.c b/xorg-server/os/io.c
index 13098f1ee..84757294b 100644
--- a/xorg-server/os/io.c
+++ b/xorg-server/os/io.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -43,7 +42,6 @@ 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.
-
******************************************************************/
/*****************************************************************
* i/o functions
@@ -81,8 +79,8 @@ SOFTWARE.
#include "dixstruct.h"
#include "misc.h"
-CallbackListPtr ReplyCallback;
-CallbackListPtr FlushCallback;
+CallbackListPtr ReplyCallback;
+CallbackListPtr FlushCallback;
static ConnectionInputPtr AllocateInputBuffer(void);
static ConnectionOutputPtr AllocateOutputBuffer(void);
@@ -92,15 +90,15 @@ static ConnectionOutputPtr AllocateOutputBuffer(void);
*/
#ifndef WIN32
#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
-#else /* WIN32 The socket errorcodes differ from the normal errors*/
+#else /* WIN32 The socket errorcodes differ from the normal errors */
#define ETEST(err) (err == EAGAIN || err == WSAEWOULDBLOCK)
#endif
static Bool CriticalOutputPending;
static int timesThisConnection = 0;
-static ConnectionInputPtr FreeInputs = (ConnectionInputPtr)NULL;
-static ConnectionOutputPtr FreeOutputs = (ConnectionOutputPtr)NULL;
-static OsCommPtr AvailableInput = (OsCommPtr)NULL;
+static ConnectionInputPtr FreeInputs = (ConnectionInputPtr) NULL;
+static ConnectionOutputPtr FreeOutputs = (ConnectionOutputPtr) NULL;
+static OsCommPtr AvailableInput = (OsCommPtr) NULL;
#define get_req_len(req,cli) ((cli)->swapped ? \
lswaps((req)->length) : (req)->length)
@@ -145,7 +143,6 @@ static OsCommPtr AvailableInput = (OsCommPtr)NULL;
* counts CARD32's.
*/
-
/*****************************************************************
* ReadRequestFromClient
* Returns one request in client->requestBuffer. The request
@@ -195,7 +192,7 @@ YieldControlDeath(void)
int
ReadRequestFromClient(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
ConnectionInputPtr oci = oc->input;
int fd = oc->fd;
unsigned int gotnow, needed;
@@ -210,40 +207,34 @@ ReadRequestFromClient(ClientPtr client)
* times). This was done to save memory.
*/
- if (AvailableInput)
- {
- if (AvailableInput != oc)
- {
- register ConnectionInputPtr aci = AvailableInput->input;
- if (aci->size > BUFWATERMARK)
- {
- free(aci->buffer);
- free(aci);
- }
- else
- {
- aci->next = FreeInputs;
- FreeInputs = aci;
- }
- AvailableInput->input = (ConnectionInputPtr)NULL;
- }
- AvailableInput = (OsCommPtr)NULL;
+ if (AvailableInput) {
+ if (AvailableInput != oc) {
+ register ConnectionInputPtr aci = AvailableInput->input;
+
+ if (aci->size > BUFWATERMARK) {
+ free(aci->buffer);
+ free(aci);
+ }
+ else {
+ aci->next = FreeInputs;
+ FreeInputs = aci;
+ }
+ AvailableInput->input = (ConnectionInputPtr) NULL;
+ }
+ AvailableInput = (OsCommPtr) NULL;
}
/* make sure we have an input buffer */
- if (!oci)
- {
- if ((oci = FreeInputs))
- {
- FreeInputs = oci->next;
- }
- else if (!(oci = AllocateInputBuffer()))
- {
- YieldControlDeath();
- return -1;
- }
- oc->input = oci;
+ if (!oci) {
+ if ((oci = FreeInputs)) {
+ FreeInputs = oci->next;
+ }
+ else if (!(oci = AllocateInputBuffer())) {
+ YieldControlDeath();
+ return -1;
+ }
+ oc->input = oci;
}
/* advance to start of next request */
@@ -255,182 +246,164 @@ ReadRequestFromClient(ClientPtr client)
gotnow = oci->bufcnt + oci->buffer - oci->bufptr;
if (oci->ignoreBytes > 0) {
- if (oci->ignoreBytes > oci->size)
- needed = oci->size;
- else
- needed = oci->ignoreBytes;
+ if (oci->ignoreBytes > oci->size)
+ needed = oci->size;
+ else
+ needed = oci->ignoreBytes;
}
- else if (gotnow < sizeof(xReq))
- {
- /* We don't have an entire xReq yet. Can't tell how big
- * the request will be until we get the whole xReq.
- */
- needed = sizeof(xReq);
- need_header = TRUE;
+ else if (gotnow < sizeof(xReq)) {
+ /* We don't have an entire xReq yet. Can't tell how big
+ * the request will be until we get the whole xReq.
+ */
+ needed = sizeof(xReq);
+ need_header = TRUE;
}
- else
- {
- /* We have a whole xReq. We can tell how big the whole
- * request will be unless it is a Big Request.
- */
- request = (xReq *)oci->bufptr;
- needed = get_req_len(request, client);
- if (!needed && client->big_requests)
- {
- /* It's a Big Request. */
- move_header = TRUE;
- if (gotnow < sizeof(xBigReq))
- {
- /* Still need more data to tell just how big. */
- needed = bytes_to_int32(sizeof(xBigReq)); /* needed is in CARD32s now */
- need_header = TRUE;
- }
- else
- needed = get_big_req_len(request, client);
- }
- client->req_len = needed;
- needed <<= 2; /* needed is in bytes now */
+ else {
+ /* We have a whole xReq. We can tell how big the whole
+ * request will be unless it is a Big Request.
+ */
+ request = (xReq *) oci->bufptr;
+ needed = get_req_len(request, client);
+ if (!needed && client->big_requests) {
+ /* It's a Big Request. */
+ move_header = TRUE;
+ if (gotnow < sizeof(xBigReq)) {
+ /* Still need more data to tell just how big. */
+ needed = bytes_to_int32(sizeof(xBigReq)); /* needed is in CARD32s now */
+ need_header = TRUE;
+ }
+ else
+ needed = get_big_req_len(request, client);
+ }
+ client->req_len = needed;
+ needed <<= 2; /* needed is in bytes now */
}
- if (gotnow < needed)
- {
- /* Need to read more data, either so that we can get a
- * complete xReq (if need_header is TRUE), a complete
- * xBigReq (if move_header is TRUE), or the rest of the
- * request (if need_header and move_header are both FALSE).
- */
-
- oci->lenLastReq = 0;
- if (needed > maxBigRequestSize << 2)
- {
- /* request is too big for us to handle */
- /*
- * Mark the rest of it as needing to be ignored, and then return
- * the full size. Dispatch() will turn it into a BadLength error.
- */
- oci->ignoreBytes = needed - gotnow;
- oci->lenLastReq = gotnow;
- return needed;
- }
- if ((gotnow == 0) ||
- ((oci->bufptr - oci->buffer + needed) > oci->size))
- {
- /* no data, or the request is too big to fit in the buffer */
-
- if ((gotnow > 0) && (oci->bufptr != oci->buffer))
- /* save the data we've already read */
- memmove(oci->buffer, oci->bufptr, gotnow);
- if (needed > oci->size)
- {
- /* make buffer bigger to accomodate request */
- char *ibuf;
-
- ibuf = (char *)realloc(oci->buffer, needed);
- if (!ibuf)
- {
- YieldControlDeath();
- return -1;
- }
- oci->size = needed;
- oci->buffer = ibuf;
- }
- oci->bufptr = oci->buffer;
- oci->bufcnt = gotnow;
- }
- /* XXX this is a workaround. This function is sometimes called
- * after the trans_conn has been freed. In this case trans_conn
- * will be null. Really ought to restructure things so that we
- * never get here in those circumstances.
- */
- if (!oc->trans_conn)
- {
- /* treat as if an error occured on the read, which is what
- * used to happen
- */
- YieldControlDeath();
- return -1;
- }
- result = _XSERVTransRead(oc->trans_conn, oci->buffer + oci->bufcnt,
- oci->size - oci->bufcnt);
- if (result <= 0)
- {
- if ((result < 0) && ETEST(errno))
- {
+ if (gotnow < needed) {
+ /* Need to read more data, either so that we can get a
+ * complete xReq (if need_header is TRUE), a complete
+ * xBigReq (if move_header is TRUE), or the rest of the
+ * request (if need_header and move_header are both FALSE).
+ */
+
+ oci->lenLastReq = 0;
+ if (needed > maxBigRequestSize << 2) {
+ /* request is too big for us to handle */
+ /*
+ * Mark the rest of it as needing to be ignored, and then return
+ * the full size. Dispatch() will turn it into a BadLength error.
+ */
+ oci->ignoreBytes = needed - gotnow;
+ oci->lenLastReq = gotnow;
+ return needed;
+ }
+ if ((gotnow == 0) || ((oci->bufptr - oci->buffer + needed) > oci->size)) {
+ /* no data, or the request is too big to fit in the buffer */
+
+ if ((gotnow > 0) && (oci->bufptr != oci->buffer))
+ /* save the data we've already read */
+ memmove(oci->buffer, oci->bufptr, gotnow);
+ if (needed > oci->size) {
+ /* make buffer bigger to accomodate request */
+ char *ibuf;
+
+ ibuf = (char *) realloc(oci->buffer, needed);
+ if (!ibuf) {
+ YieldControlDeath();
+ return -1;
+ }
+ oci->size = needed;
+ oci->buffer = ibuf;
+ }
+ oci->bufptr = oci->buffer;
+ oci->bufcnt = gotnow;
+ }
+ /* XXX this is a workaround. This function is sometimes called
+ * after the trans_conn has been freed. In this case trans_conn
+ * will be null. Really ought to restructure things so that we
+ * never get here in those circumstances.
+ */
+ if (!oc->trans_conn) {
+ /* treat as if an error occured on the read, which is what
+ * used to happen
+ */
+ YieldControlDeath();
+ return -1;
+ }
+ result = _XSERVTransRead(oc->trans_conn, oci->buffer + oci->bufcnt,
+ oci->size - oci->bufcnt);
+ if (result <= 0) {
+ if ((result < 0) && ETEST(errno)) {
#if defined(SVR4) && defined(__i386__) && !defined(sun)
- if (0)
+ if (0)
#endif
- {
- YieldControlNoInput(fd);
- return 0;
- }
- }
- YieldControlDeath();
- return -1;
- }
- oci->bufcnt += result;
- gotnow += result;
- /* free up some space after huge requests */
- if ((oci->size > BUFWATERMARK) &&
- (oci->bufcnt < BUFSIZE) && (needed < BUFSIZE))
- {
- char *ibuf;
-
- ibuf = (char *)realloc(oci->buffer, BUFSIZE);
- if (ibuf)
- {
- oci->size = BUFSIZE;
- oci->buffer = ibuf;
- oci->bufptr = ibuf + oci->bufcnt - gotnow;
- }
- }
- if (need_header && gotnow >= needed)
- {
- /* We wanted an xReq, now we've gotten it. */
- request = (xReq *)oci->bufptr;
- needed = get_req_len(request, client);
- if (!needed && client->big_requests)
- {
- move_header = TRUE;
- if (gotnow < sizeof(xBigReq))
- needed = bytes_to_int32(sizeof(xBigReq));
- else
- needed = get_big_req_len(request, client);
- }
- client->req_len = needed;
- needed <<= 2;
- }
- if (gotnow < needed)
- {
- /* Still don't have enough; punt. */
- YieldControlNoInput(fd);
- return 0;
- }
+ {
+ YieldControlNoInput(fd);
+ return 0;
+ }
+ }
+ YieldControlDeath();
+ return -1;
+ }
+ oci->bufcnt += result;
+ gotnow += result;
+ /* free up some space after huge requests */
+ if ((oci->size > BUFWATERMARK) &&
+ (oci->bufcnt < BUFSIZE) && (needed < BUFSIZE)) {
+ char *ibuf;
+
+ ibuf = (char *) realloc(oci->buffer, BUFSIZE);
+ if (ibuf) {
+ oci->size = BUFSIZE;
+ oci->buffer = ibuf;
+ oci->bufptr = ibuf + oci->bufcnt - gotnow;
+ }
+ }
+ if (need_header && gotnow >= needed) {
+ /* We wanted an xReq, now we've gotten it. */
+ request = (xReq *) oci->bufptr;
+ needed = get_req_len(request, client);
+ if (!needed && client->big_requests) {
+ move_header = TRUE;
+ if (gotnow < sizeof(xBigReq))
+ needed = bytes_to_int32(sizeof(xBigReq));
+ else
+ needed = get_big_req_len(request, client);
+ }
+ client->req_len = needed;
+ needed <<= 2;
+ }
+ if (gotnow < needed) {
+ /* Still don't have enough; punt. */
+ YieldControlNoInput(fd);
+ return 0;
+ }
}
- if (needed == 0)
- {
- if (client->big_requests)
- needed = sizeof(xBigReq);
- else
- needed = sizeof(xReq);
+ if (needed == 0) {
+ if (client->big_requests)
+ needed = sizeof(xBigReq);
+ else
+ needed = sizeof(xReq);
}
/* If there are bytes to ignore, ignore them now. */
if (oci->ignoreBytes > 0) {
- assert(needed == oci->ignoreBytes || needed == oci->size);
- /*
- * The _XSERVTransRead call above may return more or fewer bytes than we
- * want to ignore. Ignore the smaller of the two sizes.
- */
- if (gotnow < needed) {
- oci->ignoreBytes -= gotnow;
- oci->bufptr += gotnow;
- gotnow = 0;
- } else {
- oci->ignoreBytes -= needed;
- oci->bufptr += needed;
- gotnow -= needed;
- }
- needed = 0;
+ assert(needed == oci->ignoreBytes || needed == oci->size);
+ /*
+ * The _XSERVTransRead call above may return more or fewer bytes than we
+ * want to ignore. Ignore the smaller of the two sizes.
+ */
+ if (gotnow < needed) {
+ oci->ignoreBytes -= gotnow;
+ oci->bufptr += gotnow;
+ gotnow = 0;
+ }
+ else {
+ oci->ignoreBytes -= needed;
+ oci->bufptr += needed;
+ gotnow -= needed;
+ }
+ needed = 0;
}
oci->lenLastReq = needed;
@@ -444,50 +417,47 @@ ReadRequestFromClient(ClientPtr client)
*/
gotnow -= needed;
- if (gotnow >= sizeof(xReq))
- {
- request = (xReq *)(oci->bufptr + needed);
- if (gotnow >= (result = (get_req_len(request, client) << 2))
- && (result ||
- (client->big_requests &&
- (gotnow >= sizeof(xBigReq) &&
- gotnow >= (get_big_req_len(request, client) << 2))))
- )
- FD_SET(fd, &ClientsWithInput);
- else
- {
- if (!SmartScheduleDisable)
- FD_CLR(fd, &ClientsWithInput);
- else
- YieldControlNoInput(fd);
- }
+ if (gotnow >= sizeof(xReq)) {
+ request = (xReq *) (oci->bufptr + needed);
+ if (gotnow >= (result = (get_req_len(request, client) << 2))
+ && (result ||
+ (client->big_requests &&
+ (gotnow >= sizeof(xBigReq) &&
+ gotnow >= (get_big_req_len(request, client) << 2))))
+ )
+ FD_SET(fd, &ClientsWithInput);
+ else {
+ if (!SmartScheduleDisable)
+ FD_CLR(fd, &ClientsWithInput);
+ else
+ YieldControlNoInput(fd);
+ }
}
- else
- {
- if (!gotnow)
- AvailableInput = oc;
- if (!SmartScheduleDisable)
- FD_CLR(fd, &ClientsWithInput);
- else
- YieldControlNoInput(fd);
+ else {
+ if (!gotnow)
+ AvailableInput = oc;
+ if (!SmartScheduleDisable)
+ FD_CLR(fd, &ClientsWithInput);
+ else
+ YieldControlNoInput(fd);
}
if (SmartScheduleDisable)
- if (++timesThisConnection >= MAX_TIMES_PER)
- YieldControl();
- if (move_header)
- {
- request = (xReq *)oci->bufptr;
- oci->bufptr += (sizeof(xBigReq) - sizeof(xReq));
- *(xReq *)oci->bufptr = *request;
- oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq));
- client->req_len -= bytes_to_int32(sizeof(xBigReq) - sizeof(xReq));
+ if (++timesThisConnection >= MAX_TIMES_PER)
+ YieldControl();
+ if (move_header) {
+ request = (xReq *) oci->bufptr;
+ oci->bufptr += (sizeof(xBigReq) - sizeof(xReq));
+ *(xReq *) oci->bufptr = *request;
+ oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq));
+ client->req_len -= bytes_to_int32(sizeof(xBigReq) - sizeof(xReq));
}
- client->requestBuffer = (pointer)oci->bufptr;
+ client->requestBuffer = (pointer) oci->bufptr;
#ifdef DEBUG_COMMUNICATION
{
- xReq *req = client->requestBuffer;
- ErrorF("REQUEST: ClientIDX: %i, type: 0x%x data: 0x%x len: %i\n",
- client->index,req->reqType,req->data,req->length);
+ xReq *req = client->requestBuffer;
+
+ ErrorF("REQUEST: ClientIDX: %i, type: 0x%x data: 0x%x len: %i\n",
+ client->index, req->reqType, req->data, req->length);
}
#endif
return needed;
@@ -502,68 +472,62 @@ ReadRequestFromClient(ClientPtr client)
Bool
InsertFakeRequest(ClientPtr client, char *data, int count)
{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
ConnectionInputPtr oci = oc->input;
int fd = oc->fd;
int gotnow, moveup;
- if (AvailableInput)
- {
- if (AvailableInput != oc)
- {
- ConnectionInputPtr aci = AvailableInput->input;
- if (aci->size > BUFWATERMARK)
- {
- free(aci->buffer);
- free(aci);
- }
- else
- {
- aci->next = FreeInputs;
- FreeInputs = aci;
- }
- AvailableInput->input = (ConnectionInputPtr)NULL;
- }
- AvailableInput = (OsCommPtr)NULL;
+ if (AvailableInput) {
+ if (AvailableInput != oc) {
+ ConnectionInputPtr aci = AvailableInput->input;
+
+ if (aci->size > BUFWATERMARK) {
+ free(aci->buffer);
+ free(aci);
+ }
+ else {
+ aci->next = FreeInputs;
+ FreeInputs = aci;
+ }
+ AvailableInput->input = (ConnectionInputPtr) NULL;
+ }
+ AvailableInput = (OsCommPtr) NULL;
}
- if (!oci)
- {
- if ((oci = FreeInputs))
- FreeInputs = oci->next;
- else if (!(oci = AllocateInputBuffer()))
- return FALSE;
- oc->input = oci;
+ if (!oci) {
+ if ((oci = FreeInputs))
+ FreeInputs = oci->next;
+ else if (!(oci = AllocateInputBuffer()))
+ return FALSE;
+ oc->input = oci;
}
oci->bufptr += oci->lenLastReq;
oci->lenLastReq = 0;
gotnow = oci->bufcnt + oci->buffer - oci->bufptr;
- if ((gotnow + count) > oci->size)
- {
- char *ibuf;
-
- ibuf = (char *)realloc(oci->buffer, gotnow + count);
- if (!ibuf)
- return FALSE;
- oci->size = gotnow + count;
- oci->buffer = ibuf;
- oci->bufptr = ibuf + oci->bufcnt - gotnow;
+ if ((gotnow + count) > oci->size) {
+ char *ibuf;
+
+ ibuf = (char *) realloc(oci->buffer, gotnow + count);
+ if (!ibuf)
+ return FALSE;
+ oci->size = gotnow + count;
+ oci->buffer = ibuf;
+ oci->bufptr = ibuf + oci->bufcnt - gotnow;
}
moveup = count - (oci->bufptr - oci->buffer);
- if (moveup > 0)
- {
- if (gotnow > 0)
- memmove(oci->bufptr + moveup, oci->bufptr, gotnow);
- oci->bufptr += moveup;
- oci->bufcnt += moveup;
+ if (moveup > 0) {
+ if (gotnow > 0)
+ memmove(oci->bufptr + moveup, oci->bufptr, gotnow);
+ oci->bufptr += moveup;
+ oci->bufcnt += moveup;
}
memmove(oci->bufptr - count, data, count);
oci->bufptr -= count;
gotnow += count;
if ((gotnow >= sizeof(xReq)) &&
- (gotnow >= (int)(get_req_len((xReq *)oci->bufptr, client) << 2)))
- FD_SET(fd, &ClientsWithInput);
+ (gotnow >= (int) (get_req_len((xReq *) oci->bufptr, client) << 2)))
+ FD_SET(fd, &ClientsWithInput);
else
- YieldControlNoInput(fd);
+ YieldControlNoInput(fd);
return TRUE;
}
@@ -576,51 +540,45 @@ InsertFakeRequest(ClientPtr client, char *data, int count)
void
ResetCurrentRequest(ClientPtr client)
{
- OsCommPtr oc = (OsCommPtr)client->osPrivate;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
register ConnectionInputPtr oci = oc->input;
int fd = oc->fd;
register xReq *request;
int gotnow, needed;
+
if (AvailableInput == oc)
- AvailableInput = (OsCommPtr)NULL;
+ AvailableInput = (OsCommPtr) NULL;
oci->lenLastReq = 0;
gotnow = oci->bufcnt + oci->buffer - oci->bufptr;
- if (gotnow < sizeof(xReq))
- {
- YieldControlNoInput(fd);
+ if (gotnow < sizeof(xReq)) {
+ YieldControlNoInput(fd);
}
- else
- {
- request = (xReq *)oci->bufptr;
- needed = get_req_len(request, client);
- if (!needed && client->big_requests)
- {
- oci->bufptr -= sizeof(xBigReq) - sizeof(xReq);
- *(xReq *)oci->bufptr = *request;
- ((xBigReq *)oci->bufptr)->length = client->req_len;
- if (client->swapped)
- {
- swapl(&((xBigReq *)oci->bufptr)->length);
- }
- }
- if (gotnow >= (needed << 2))
- {
- if (FD_ISSET(fd, &AllClients))
- {
- FD_SET(fd, &ClientsWithInput);
- }
- else
- {
- FD_SET(fd, &IgnoredClientsWithInput);
- }
- YieldControl();
- }
- else
- YieldControlNoInput(fd);
+ else {
+ request = (xReq *) oci->bufptr;
+ needed = get_req_len(request, client);
+ if (!needed && client->big_requests) {
+ oci->bufptr -= sizeof(xBigReq) - sizeof(xReq);
+ *(xReq *) oci->bufptr = *request;
+ ((xBigReq *) oci->bufptr)->length = client->req_len;
+ if (client->swapped) {
+ swapl(&((xBigReq *) oci->bufptr)->length);
+ }
+ }
+ if (gotnow >= (needed << 2)) {
+ if (FD_ISSET(fd, &AllClients)) {
+ FD_SET(fd, &ClientsWithInput);
+ }
+ else {
+ FD_SET(fd, &IgnoredClientsWithInput);
+ }
+ YieldControl();
+ }
+ else
+ YieldControlNoInput(fd);
}
}
-static const int padlength[4] = {0, 3, 2, 1};
+static const int padlength[4] = { 0, 3, 2, 1 };
/********************
* FlushAllOutput()
@@ -636,19 +594,20 @@ void
FlushAllOutput(void)
{
register int index, base;
- register fd_mask mask; /* raphael */
+ register fd_mask mask; /* raphael */
OsCommPtr oc;
register ClientPtr client;
Bool newoutput = NewOutputPending;
+
#if defined(WIN32)
fd_set newOutputPending;
#endif
if (FlushCallback)
- CallCallbacks(&FlushCallback, NULL);
+ CallCallbacks(&FlushCallback, NULL);
if (!newoutput)
- return;
+ return;
/*
* It may be that some client still has critical output pending,
@@ -659,57 +618,54 @@ FlushAllOutput(void)
NewOutputPending = FALSE;
#ifndef WIN32
- for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++)
- {
- mask = OutputPending.fds_bits[ base ];
- OutputPending.fds_bits[ base ] = 0;
- while (mask)
- {
- index = ffs(mask) - 1;
- mask &= ~lowbit(mask);
- if ((index = ConnectionTranslation[(base * (sizeof(fd_mask)*8)) + index]) == 0)
- continue;
- client = clients[index];
- if (client->clientGone)
- continue;
- oc = (OsCommPtr)client->osPrivate;
- if (FD_ISSET(oc->fd, &ClientsWithInput))
- {
- FD_SET(oc->fd, &OutputPending); /* set the bit again */
- NewOutputPending = TRUE;
- }
- else
- (void)FlushClient(client, oc, (char *)NULL, 0);
- }
+ for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++) {
+ mask = OutputPending.fds_bits[base];
+ OutputPending.fds_bits[base] = 0;
+ while (mask) {
+ index = ffs(mask) - 1;
+ mask &= ~lowbit(mask);
+ if ((index =
+ ConnectionTranslation[(base * (sizeof(fd_mask) * 8)) +
+ index]) == 0)
+ continue;
+ client = clients[index];
+ if (client->clientGone)
+ continue;
+ oc = (OsCommPtr) client->osPrivate;
+ if (FD_ISSET(oc->fd, &ClientsWithInput)) {
+ FD_SET(oc->fd, &OutputPending); /* set the bit again */
+ NewOutputPending = TRUE;
+ }
+ else
+ (void) FlushClient(client, oc, (char *) NULL, 0);
+ }
}
-#else /* WIN32 */
+#else /* WIN32 */
FD_ZERO(&newOutputPending);
- for (base = 0; base < XFD_SETCOUNT(&OutputPending); base++)
- {
- index = XFD_FD(&OutputPending, base);
- if ((index = GetConnectionTranslation(index)) == 0)
- continue;
- client = clients[index];
- if (client->clientGone)
- continue;
- oc = (OsCommPtr)client->osPrivate;
- if (FD_ISSET(oc->fd, &ClientsWithInput))
- {
- FD_SET(oc->fd, &newOutputPending); /* set the bit again */
- NewOutputPending = TRUE;
- }
- else
- (void)FlushClient(client, oc, (char *)NULL, 0);
+ for (base = 0; base < XFD_SETCOUNT(&OutputPending); base++) {
+ index = XFD_FD(&OutputPending, base);
+ if ((index = GetConnectionTranslation(index)) == 0)
+ continue;
+ client = clients[index];
+ if (client->clientGone)
+ continue;
+ oc = (OsCommPtr) client->osPrivate;
+ if (FD_ISSET(oc->fd, &ClientsWithInput)) {
+ FD_SET(oc->fd, &newOutputPending); /* set the bit again */
+ NewOutputPending = TRUE;
+ }
+ else
+ (void) FlushClient(client, oc, (char *) NULL, 0);
}
XFD_COPYSET(&newOutputPending, &OutputPending);
-#endif /* WIN32 */
+#endif /* WIN32 */
}
void
FlushIfCriticalOutputPending(void)
{
if (CriticalOutputPending)
- FlushAllOutput();
+ FlushAllOutput();
}
void
@@ -730,139 +686,135 @@ SetCriticalOutputPending(void)
*****************/
int
-WriteToClient (ClientPtr who, int count, const void *__buf)
+WriteToClient(ClientPtr who, int count, const void *__buf)
{
OsCommPtr oc;
ConnectionOutputPtr oco;
int padBytes;
const char *buf = __buf;
+
#ifdef DEBUG_COMMUNICATION
Bool multicount = FALSE;
#endif
if (!count || !who || who == serverClient || who->clientGone)
- return 0;
+ return 0;
oc = who->osPrivate;
oco = oc->output;
#ifdef DEBUG_COMMUNICATION
{
- char info[128];
- xError *err;
- xGenericReply *rep;
- xEvent *ev;
-
- if (!who->replyBytesRemaining) {
- switch(buf[0]) {
- case X_Reply:
- rep = (xGenericReply*)buf;
- if (rep->sequenceNumber == who->sequence) {
- snprintf(info,127,"Xreply: type: 0x%x data: 0x%x "
- "len: %i seq#: 0x%x", rep->type, rep->data1,
- rep->length, rep->sequenceNumber);
- multicount = TRUE;
- }
- break;
- case X_Error:
- err = (xError*)buf;
- snprintf(info,127,"Xerror: Code: 0x%x resID: 0x%x maj: 0x%x "
- "min: %x", err->errorCode,err->resourceID,
- err->minorCode,err->majorCode);
- break;
- default:
- if ((buf[0] & 0x7f) == KeymapNotify)
- snprintf(info,127,"KeymapNotifyEvent: %i",buf[0]);
- else {
- ev = (xEvent*)buf;
- snprintf(info,127,"XEvent: type: 0x%x detail: 0x%x "
- "seq#: 0x%x", ev->u.u.type, ev->u.u.detail,
- ev->u.u.sequenceNumber);
- }
- }
- ErrorF("REPLY: ClientIDX: %i %s\n",who->index, info);
- } else
- multicount = TRUE;
+ char info[128];
+ xError *err;
+ xGenericReply *rep;
+ xEvent *ev;
+
+ if (!who->replyBytesRemaining) {
+ switch (buf[0]) {
+ case X_Reply:
+ rep = (xGenericReply *) buf;
+ if (rep->sequenceNumber == who->sequence) {
+ snprintf(info, 127, "Xreply: type: 0x%x data: 0x%x "
+ "len: %i seq#: 0x%x", rep->type, rep->data1,
+ rep->length, rep->sequenceNumber);
+ multicount = TRUE;
+ }
+ break;
+ case X_Error:
+ err = (xError *) buf;
+ snprintf(info, 127, "Xerror: Code: 0x%x resID: 0x%x maj: 0x%x "
+ "min: %x", err->errorCode, err->resourceID,
+ err->minorCode, err->majorCode);
+ break;
+ default:
+ if ((buf[0] & 0x7f) == KeymapNotify)
+ snprintf(info, 127, "KeymapNotifyEvent: %i", buf[0]);
+ else {
+ ev = (xEvent *) buf;
+ snprintf(info, 127, "XEvent: type: 0x%x detail: 0x%x "
+ "seq#: 0x%x", ev->u.u.type, ev->u.u.detail,
+ ev->u.u.sequenceNumber);
+ }
+ }
+ ErrorF("REPLY: ClientIDX: %i %s\n", who->index, info);
+ }
+ else
+ multicount = TRUE;
}
#endif
- if (!oco)
- {
- if ((oco = FreeOutputs))
- {
- FreeOutputs = oco->next;
- }
- else if (!(oco = AllocateOutputBuffer()))
- {
- if (oc->trans_conn) {
- _XSERVTransDisconnect(oc->trans_conn);
- _XSERVTransClose(oc->trans_conn);
- oc->trans_conn = NULL;
- }
- MarkClientException(who);
- return -1;
- }
- oc->output = oco;
+ if (!oco) {
+ if ((oco = FreeOutputs)) {
+ FreeOutputs = oco->next;
+ }
+ else if (!(oco = AllocateOutputBuffer())) {
+ if (oc->trans_conn) {
+ _XSERVTransDisconnect(oc->trans_conn);
+ _XSERVTransClose(oc->trans_conn);
+ oc->trans_conn = NULL;
+ }
+ MarkClientException(who);
+ return -1;
+ }
+ oc->output = oco;
}
padBytes = padlength[count & 3];
- if(ReplyCallback)
- {
+ if (ReplyCallback) {
ReplyInfoRec replyinfo;
- replyinfo.client = who;
- replyinfo.replyData = buf;
- replyinfo.dataLenBytes = count + padBytes;
- replyinfo.padBytes = padBytes;
- if (who->replyBytesRemaining)
- { /* still sending data of an earlier reply */
- who->replyBytesRemaining -= count + padBytes;
- replyinfo.startOfReply = FALSE;
- replyinfo.bytesRemaining = who->replyBytesRemaining;
- CallCallbacks((&ReplyCallback), (pointer)&replyinfo);
- }
- else if (who->clientState == ClientStateRunning
- && buf[0] == X_Reply)
- { /* start of new reply */
- CARD32 replylen;
- unsigned long bytesleft;
-
- replylen = ((const xGenericReply *)buf)->length;
- if (who->swapped)
- swapl(&replylen);
- bytesleft = (replylen * 4) + SIZEOF(xReply) - count - padBytes;
- replyinfo.startOfReply = TRUE;
- replyinfo.bytesRemaining = who->replyBytesRemaining = bytesleft;
- CallCallbacks((&ReplyCallback), (pointer)&replyinfo);
- }
+ replyinfo.client = who;
+ replyinfo.replyData = buf;
+ replyinfo.dataLenBytes = count + padBytes;
+ replyinfo.padBytes = padBytes;
+ if (who->replyBytesRemaining) { /* still sending data of an earlier reply */
+ who->replyBytesRemaining -= count + padBytes;
+ replyinfo.startOfReply = FALSE;
+ replyinfo.bytesRemaining = who->replyBytesRemaining;
+ CallCallbacks((&ReplyCallback), (pointer) &replyinfo);
+ }
+ else if (who->clientState == ClientStateRunning && buf[0] == X_Reply) { /* start of new reply */
+ CARD32 replylen;
+ unsigned long bytesleft;
+
+ replylen = ((const xGenericReply *) buf)->length;
+ if (who->swapped)
+ swapl(&replylen);
+ bytesleft = (replylen * 4) + SIZEOF(xReply) - count - padBytes;
+ replyinfo.startOfReply = TRUE;
+ replyinfo.bytesRemaining = who->replyBytesRemaining = bytesleft;
+ CallCallbacks((&ReplyCallback), (pointer) &replyinfo);
+ }
}
#ifdef DEBUG_COMMUNICATION
else if (multicount) {
- if (who->replyBytesRemaining) {
- who->replyBytesRemaining -= (count + padBytes);
- } else {
- CARD32 replylen;
- replylen = ((xGenericReply *)buf)->length;
- who->replyBytesRemaining =
- (replylen * 4) + SIZEOF(xReply) - count - padBytes;
- }
+ if (who->replyBytesRemaining) {
+ who->replyBytesRemaining -= (count + padBytes);
+ }
+ else {
+ CARD32 replylen;
+
+ replylen = ((xGenericReply *) buf)->length;
+ who->replyBytesRemaining =
+ (replylen * 4) + SIZEOF(xReply) - count - padBytes;
+ }
}
#endif
- if (oco->count + count + padBytes > oco->size)
- {
- FD_CLR(oc->fd, &OutputPending);
- if(!XFD_ANYSET(&OutputPending)) {
- CriticalOutputPending = FALSE;
- NewOutputPending = FALSE;
- }
+ if (oco->count + count + padBytes > oco->size) {
+ FD_CLR(oc->fd, &OutputPending);
+ if (!XFD_ANYSET(&OutputPending)) {
+ CriticalOutputPending = FALSE;
+ NewOutputPending = FALSE;
+ }
- if (FlushCallback)
- CallCallbacks(&FlushCallback, NULL);
+ if (FlushCallback)
+ CallCallbacks(&FlushCallback, NULL);
- return FlushClient(who, oc, buf, count);
+ return FlushClient(who, oc, buf, count);
}
NewOutputPending = TRUE;
FD_SET(oc->fd, &OutputPending);
- memmove((char *)oco->buf + oco->count, buf, count);
+ memmove((char *) oco->buf + oco->count, buf, count);
oco->count += count + padBytes;
return count;
}
@@ -892,30 +844,30 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
long todo;
if (!oco)
- return 0;
+ return 0;
written = 0;
padsize = padlength[extraCount & 3];
notWritten = oco->count + extraCount + padsize;
todo = notWritten;
while (notWritten) {
- long before = written; /* amount of whole thing written */
- long remain = todo; /* amount to try this time, <= notWritten */
- int i = 0;
- long len;
-
- /* You could be very general here and have "in" and "out" iovecs
- * and write a loop without using a macro, but what the heck. This
- * translates to:
- *
- * how much of this piece is new?
- * if more new then we are trying this time, clamp
- * if nothing new
- * then bump down amount already written, for next piece
- * else put new stuff in iovec, will need all of next piece
- *
- * Note that todo had better be at least 1 or else we'll end up
- * writing 0 iovecs.
- */
+ long before = written; /* amount of whole thing written */
+ long remain = todo; /* amount to try this time, <= notWritten */
+ int i = 0;
+ long len;
+
+ /* You could be very general here and have "in" and "out" iovecs
+ * and write a loop without using a macro, but what the heck. This
+ * translates to:
+ *
+ * how much of this piece is new?
+ * if more new then we are trying this time, clamp
+ * if nothing new
+ * then bump down amount already written, for next piece
+ * else put new stuff in iovec, will need all of next piece
+ *
+ * Note that todo had better be at least 1 or else we'll end up
+ * writing 0 iovecs.
+ */
#define InsertIOV(pointer, length) \
len = (length) - before; \
if (len > remain) \
@@ -930,121 +882,106 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
before = 0; \
}
- InsertIOV ((char *)oco->buf, oco->count)
- InsertIOV ((char *)extraBuf, extraCount)
- InsertIOV (padBuffer, padsize)
-
- errno = 0;
- if (trans_conn && (len = _XSERVTransWritev(trans_conn, iov, i)) >= 0)
- {
- written += len;
- notWritten -= len;
- todo = notWritten;
- }
- else if (ETEST(errno)
-#ifdef SUNSYSV /* check for another brain-damaged OS bug */
- || (errno == 0)
+ InsertIOV((char *) oco->buf, oco->count)
+ InsertIOV((char *) extraBuf, extraCount)
+ InsertIOV(padBuffer, padsize)
+
+ errno = 0;
+ if (trans_conn && (len = _XSERVTransWritev(trans_conn, iov, i)) >= 0) {
+ written += len;
+ notWritten -= len;
+ todo = notWritten;
+ }
+ else if (ETEST(errno)
+#ifdef SUNSYSV /* check for another brain-damaged OS bug */
+ || (errno == 0)
#endif
-#ifdef EMSGSIZE /* check for another brain-damaged OS bug */
- || ((errno == EMSGSIZE) && (todo == 1))
+#ifdef EMSGSIZE /* check for another brain-damaged OS bug */
+ || ((errno == EMSGSIZE) && (todo == 1))
#endif
- )
- {
- /* If we've arrived here, then the client is stuffed to the gills
- and not ready to accept more. Make a note of it and buffer
- the rest. */
- errno=0;
- FD_SET(connection, &ClientsWriteBlocked);
- AnyClientsWriteBlocked = TRUE;
-
- if (written < oco->count)
- {
- if (written > 0)
- {
- oco->count -= written;
- memmove((char *)oco->buf,
- (char *)oco->buf + written,
- oco->count);
- written = 0;
- }
- }
- else
- {
- written -= oco->count;
- oco->count = 0;
- }
-
- if (notWritten > oco->size)
- {
- unsigned char *obuf;
-
- obuf = (unsigned char *)realloc(oco->buf,
- notWritten + BUFSIZE);
- if (!obuf)
- {
- _XSERVTransDisconnect(oc->trans_conn);
- _XSERVTransClose(oc->trans_conn);
- oc->trans_conn = NULL;
- MarkClientException(who);
- oco->count = 0;
- return -1;
- }
- oco->size = notWritten + BUFSIZE;
- oco->buf = obuf;
- }
-
- /* If the amount written extended into the padBuffer, then the
- difference "extraCount - written" may be less than 0 */
- if ((len = extraCount - written) > 0)
- memmove ((char *)oco->buf + oco->count,
- extraBuf + written,
- len);
-
- oco->count = notWritten; /* this will include the pad */
- /* return only the amount explicitly requested */
- return extraCount;
- }
-#ifdef EMSGSIZE /* check for another brain-damaged OS bug */
- else if (errno == EMSGSIZE)
- {
- todo >>= 1;
- }
+ ) {
+ /* If we've arrived here, then the client is stuffed to the gills
+ and not ready to accept more. Make a note of it and buffer
+ the rest. */
+ errno=0;
+ FD_SET(connection, &ClientsWriteBlocked);
+ AnyClientsWriteBlocked = TRUE;
+
+ if (written < oco->count) {
+ if (written > 0) {
+ oco->count -= written;
+ memmove((char *) oco->buf,
+ (char *) oco->buf + written, oco->count);
+ written = 0;
+ }
+ }
+ else {
+ written -= oco->count;
+ oco->count = 0;
+ }
+
+ if (notWritten > oco->size) {
+ unsigned char *obuf;
+
+ obuf = (unsigned char *) realloc(oco->buf,
+ notWritten + BUFSIZE);
+ if (!obuf) {
+ _XSERVTransDisconnect(oc->trans_conn);
+ _XSERVTransClose(oc->trans_conn);
+ oc->trans_conn = NULL;
+ MarkClientException(who);
+ oco->count = 0;
+ return -1;
+ }
+ oco->size = notWritten + BUFSIZE;
+ oco->buf = obuf;
+ }
+
+ /* If the amount written extended into the padBuffer, then the
+ difference "extraCount - written" may be less than 0 */
+ if ((len = extraCount - written) > 0)
+ memmove((char *) oco->buf + oco->count,
+ extraBuf + written, len);
+
+ oco->count = notWritten; /* this will include the pad */
+ /* return only the amount explicitly requested */
+ return extraCount;
+ }
+#ifdef EMSGSIZE /* check for another brain-damaged OS bug */
+ else if (errno == EMSGSIZE) {
+ todo >>= 1;
+ }
#endif
- else
- {
- if (oc->trans_conn)
- {
- _XSERVTransDisconnect(oc->trans_conn);
- _XSERVTransClose(oc->trans_conn);
- oc->trans_conn = NULL;
- }
- MarkClientException(who);
- oco->count = 0;
- return -1;
- }
+ else {
+ if (oc->trans_conn) {
+ _XSERVTransDisconnect(oc->trans_conn);
+ _XSERVTransClose(oc->trans_conn);
+ oc->trans_conn = NULL;
+ }
+ MarkClientException(who);
+ oco->count = 0;
+ return -1;
+ }
}
/* everything was flushed out */
oco->count = 0;
/* check to see if this client was write blocked */
- if (AnyClientsWriteBlocked)
- {
- FD_CLR(oc->fd, &ClientsWriteBlocked);
- if (! XFD_ANYSET(&ClientsWriteBlocked))
- AnyClientsWriteBlocked = FALSE;
+ if (AnyClientsWriteBlocked) {
+ FD_CLR(oc->fd, &ClientsWriteBlocked);
+ if (!XFD_ANYSET(&ClientsWriteBlocked))
+ AnyClientsWriteBlocked = FALSE;
}
- if (oco->size > BUFWATERMARK)
- {
- free(oco->buf);
- free(oco);
+ if (oco->size > BUFWATERMARK) {
+ free(oco->buf);
+ free(oco);
}
- else
- {
- oco->next = FreeOutputs;
- FreeOutputs = oco;
+ else {
+ oco->next = FreeOutputs;
+ FreeOutputs = oco;
}
- oc->output = (ConnectionOutputPtr)NULL;
- return extraCount; /* return only the amount explicitly requested */
+ oc->output = (ConnectionOutputPtr) NULL;
+ return extraCount; /* return only the amount explicitly requested */
}
static ConnectionInputPtr
@@ -1054,12 +991,11 @@ AllocateInputBuffer(void)
oci = malloc(sizeof(ConnectionInput));
if (!oci)
- return NULL;
+ return NULL;
oci->buffer = malloc(BUFSIZE);
- if (!oci->buffer)
- {
- free(oci);
- return NULL;
+ if (!oci->buffer) {
+ free(oci);
+ return NULL;
}
oci->size = BUFSIZE;
oci->bufptr = oci->buffer;
@@ -1076,12 +1012,11 @@ AllocateOutputBuffer(void)
oco = malloc(sizeof(ConnectionOutput));
if (!oco)
- return NULL;
+ return NULL;
oco->buf = calloc(1, BUFSIZE);
- if (!oco->buf)
- {
- free(oco);
- return NULL;
+ if (!oco->buf) {
+ free(oco);
+ return NULL;
}
oco->size = BUFSIZE;
oco->count = 0;
@@ -1095,36 +1030,30 @@ FreeOsBuffers(OsCommPtr oc)
ConnectionOutputPtr oco;
if (AvailableInput == oc)
- AvailableInput = (OsCommPtr)NULL;
- if ((oci = oc->input))
- {
- if (FreeInputs)
- {
- free(oci->buffer);
- free(oci);
- }
- else
- {
- FreeInputs = oci;
- oci->next = (ConnectionInputPtr)NULL;
- oci->bufptr = oci->buffer;
- oci->bufcnt = 0;
- oci->lenLastReq = 0;
- }
+ AvailableInput = (OsCommPtr) NULL;
+ if ((oci = oc->input)) {
+ if (FreeInputs) {
+ free(oci->buffer);
+ free(oci);
+ }
+ else {
+ FreeInputs = oci;
+ oci->next = (ConnectionInputPtr) NULL;
+ oci->bufptr = oci->buffer;
+ oci->bufcnt = 0;
+ oci->lenLastReq = 0;
+ }
}
- if ((oco = oc->output))
- {
- if (FreeOutputs)
- {
- free(oco->buf);
- free(oco);
- }
- else
- {
- FreeOutputs = oco;
- oco->next = (ConnectionOutputPtr)NULL;
- oco->count = 0;
- }
+ if ((oco = oc->output)) {
+ if (FreeOutputs) {
+ free(oco->buf);
+ free(oco);
+ }
+ else {
+ FreeOutputs = oco;
+ oco->next = (ConnectionOutputPtr) NULL;
+ oco->count = 0;
+ }
}
}
@@ -1134,16 +1063,14 @@ ResetOsBuffers(void)
ConnectionInputPtr oci;
ConnectionOutputPtr oco;
- while ((oci = FreeInputs))
- {
- FreeInputs = oci->next;
- free(oci->buffer);
- free(oci);
+ while ((oci = FreeInputs)) {
+ FreeInputs = oci->next;
+ free(oci->buffer);
+ free(oci);
}
- while ((oco = FreeOutputs))
- {
- FreeOutputs = oco->next;
- free(oco->buf);
- free(oco);
+ while ((oco = FreeOutputs)) {
+ FreeOutputs = oco->next;
+ free(oco->buf);
+ free(oco);
}
}
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index cf0e01518..ca29442f8 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -24,7 +24,6 @@ not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
Copyright 1994 Quarterdeck Office Systems.
@@ -76,7 +75,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
* authorization from the copyright holder(s) and author(s).
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -86,7 +84,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <time.h>
#include <sys/stat.h>
#include <stdarg.h>
-#include <stdlib.h> /* for malloc() */
+#include <stdlib.h> /* for malloc() */
#include "input.h"
#include "site.h"
@@ -112,7 +110,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#endif
#ifdef DDXOSVERRORF
-void (*OsVendorVErrorFProc)(const char *, va_list args) = NULL;
+void (*OsVendorVErrorFProc) (const char *, va_list args) = NULL;
#endif
static FILE *logFile = NULL;
@@ -129,13 +127,15 @@ static Bool needBuffer = TRUE;
#ifdef __APPLE__
#include <AvailabilityMacros.h>
-static char __crashreporter_info_buff__[4096] = {0};
-static const char *__crashreporter_info__ __attribute__((__used__)) = &__crashreporter_info_buff__[0];
+static char __crashreporter_info_buff__[4096] = { 0 };
+
+static const char *__crashreporter_info__ __attribute__ ((__used__)) =
+ &__crashreporter_info_buff__[0];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
// This is actually a toolchain requirement, but I'm not sure the correct check,
// but it should be fine to just only include it for Leopard and later. This line
// just tells the linker to never strip this symbol (such as for space optimization)
-asm (".desc ___crashreporter_info__, 0x10");
+asm(".desc ___crashreporter_info__, 0x10");
#endif
#endif
@@ -170,6 +170,9 @@ asm (".desc ___crashreporter_info__, 0x10");
#ifndef X_NOT_IMPLEMENTED_STRING
#define X_NOT_IMPLEMENTED_STRING "(NI)"
#endif
+#ifndef X_DEBUG_STRING
+#define X_DEBUG_STRING "(DB)"
+#endif
#ifndef X_NONE_STRING
#define X_NONE_STRING ""
#endif
@@ -189,39 +192,39 @@ LogInit(const char *fname, const char *backup)
char *logFileName = NULL;
if (fname && *fname) {
- if (asprintf(&logFileName, fname, display) == -1)
- FatalError("Cannot allocate space for the log file name\n");
-
- if (backup && *backup) {
- struct stat buf;
-
- if (!stat(logFileName, &buf) && S_ISREG(buf.st_mode)) {
- char *suffix;
- char *oldLog;
-
- if ((asprintf(&suffix, backup, display) == -1) ||
- (asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
- FatalError("Cannot allocate space for the log file name\n");
- free(suffix);
- if (rename(logFileName, oldLog) == -1) {
- FatalError("Cannot move old log file \"%s\" to \"%s\"\n",
- logFileName, oldLog);
- }
- free(oldLog);
- }
- }
- if ((logFile = fopen(logFileName, "w")) == NULL)
- FatalError("Cannot open log file \"%s\"\n", logFileName);
- setvbuf(logFile, NULL, _IONBF, 0);
-
- /* Flush saved log information. */
- if (saveBuffer && bufferSize > 0) {
- fwrite(saveBuffer, bufferPos, 1, logFile);
- fflush(logFile);
+ if (asprintf(&logFileName, fname, display) == -1)
+ FatalError("Cannot allocate space for the log file name\n");
+
+ if (backup && *backup) {
+ struct stat buf;
+
+ if (!stat(logFileName, &buf) && S_ISREG(buf.st_mode)) {
+ char *suffix;
+ char *oldLog;
+
+ if ((asprintf(&suffix, backup, display) == -1) ||
+ (asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
+ FatalError("Cannot allocate space for the log file name\n");
+ free(suffix);
+ if (rename(logFileName, oldLog) == -1) {
+ FatalError("Cannot move old log file \"%s\" to \"%s\"\n",
+ logFileName, oldLog);
+ }
+ free(oldLog);
+ }
+ }
+ if ((logFile = fopen(logFileName, "w")) == NULL)
+ FatalError("Cannot open log file \"%s\"\n", logFileName);
+ setvbuf(logFile, NULL, _IONBF, 0);
+
+ /* Flush saved log information. */
+ if (saveBuffer && bufferSize > 0) {
+ fwrite(saveBuffer, bufferPos, 1, logFile);
+ fflush(logFile);
#ifndef WIN32
- fsync(fileno(logFile));
+ fsync(fileno(logFile));
#endif
- }
+ }
}
/*
@@ -229,9 +232,9 @@ LogInit(const char *fname, const char *backup)
* needed.
*/
if (saveBuffer && bufferSize > 0) {
- free(saveBuffer); /* Must be free(), not free() */
- saveBuffer = NULL;
- bufferSize = 0;
+ free(saveBuffer); /* Must be free(), not free() */
+ saveBuffer = NULL;
+ bufferSize = 0;
}
needBuffer = FALSE;
@@ -242,10 +245,10 @@ void
LogClose(enum ExitCode error)
{
if (logFile) {
- ErrorF("Server terminated %s (%d). Closing log file.\n",
- (error == EXIT_NO_ERROR) ? "successfully" : "with error", error);
- fclose(logFile);
- logFile = NULL;
+ ErrorF("Server terminated %s (%d). Closing log file.\n",
+ (error == EXIT_NO_ERROR) ? "successfully" : "with error", error);
+ fclose(logFile);
+ logFile = NULL;
}
}
@@ -254,19 +257,19 @@ LogSetParameter(LogParameter param, int value)
{
switch (param) {
case XLOG_FLUSH:
- logFlush = value ? TRUE : FALSE;
- return TRUE;
+ logFlush = value ? TRUE : FALSE;
+ return TRUE;
case XLOG_SYNC:
- logSync = value ? TRUE : FALSE;
- return TRUE;
+ logSync = value ? TRUE : FALSE;
+ return TRUE;
case XLOG_VERBOSITY:
- logVerbosity = value;
- return TRUE;
+ logVerbosity = value;
+ return TRUE;
case XLOG_FILE_VERBOSITY:
- logFileVerbosity = value;
- return TRUE;
+ logFileVerbosity = value;
+ return TRUE;
default:
- return FALSE;
+ return FALSE;
}
}
@@ -280,10 +283,10 @@ LogVWrite(int verb, const char *f, va_list args)
static Bool newline = TRUE;
if (newline) {
- sprintf(tmpBuffer, "[%10.3f] ", GetTimeInMillis() / 1000.0);
- len = strlen(tmpBuffer);
- if (logFile)
- fwrite(tmpBuffer, len, 1, logFile);
+ sprintf(tmpBuffer, "[%10.3f] ", GetTimeInMillis() / 1000.0);
+ len = strlen(tmpBuffer);
+ if (logFile)
+ fwrite(tmpBuffer, len, 1, logFile);
}
/*
@@ -292,35 +295,36 @@ LogVWrite(int verb, const char *f, va_list args)
* stream(s).
*/
if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) {
- vsnprintf(tmpBuffer, sizeof(tmpBuffer)-1, f, args);
+ vsnprintf(tmpBuffer, sizeof(tmpBuffer)-1, f, args);
tmpBuffer[sizeof(tmpBuffer)-1]=0;
- len = strlen(tmpBuffer);
+ len = strlen(tmpBuffer);
}
- newline = (tmpBuffer[len-1] == '\n');
+ newline = (tmpBuffer[len - 1] == '\n');
if ((verb < 0 || logVerbosity >= verb) && len > 0)
- fwrite(tmpBuffer, len, 1, stderr);
+ fwrite(tmpBuffer, len, 1, stderr);
if ((verb < 0 || logFileVerbosity >= verb) && len > 0) {
- if (logFile) {
- fwrite(tmpBuffer, len, 1, logFile);
- if (logFlush) {
- fflush(logFile);
+ if (logFile) {
+ fwrite(tmpBuffer, len, 1, logFile);
+ if (logFlush) {
+ fflush(logFile);
#ifndef WIN32
- if (logSync)
- fsync(fileno(logFile));
+ if (logSync)
+ fsync(fileno(logFile));
#endif
- }
- } else if (needBuffer) {
- if (len > bufferUnused) {
- bufferSize += 1024;
- bufferUnused += 1024;
- saveBuffer = realloc(saveBuffer, bufferSize);
- if (!saveBuffer)
- FatalError("realloc() failed while saving log messages\n");
- }
- bufferUnused -= len;
- memcpy(saveBuffer + bufferPos, tmpBuffer, len);
- bufferPos += len;
- }
+ }
+ }
+ else if (needBuffer) {
+ if (len > bufferUnused) {
+ bufferSize += 1024;
+ bufferUnused += 1024;
+ saveBuffer = realloc(saveBuffer, bufferSize);
+ if (!saveBuffer)
+ FatalError("realloc() failed while saving log messages\n");
+ }
+ bufferUnused -= len;
+ memcpy(saveBuffer + bufferPos, tmpBuffer, len);
+ bufferPos += len;
+ }
}
}
@@ -340,36 +344,38 @@ static const char *
LogMessageTypeVerbString(MessageType type, int verb)
{
if (type == X_ERROR)
- verb = 0;
+ verb = 0;
if (logVerbosity < verb && logFileVerbosity < verb)
- return NULL;
+ return NULL;
switch (type) {
case X_PROBED:
- return X_PROBE_STRING;
+ return X_PROBE_STRING;
case X_CONFIG:
- return X_CONFIG_STRING;
+ return X_CONFIG_STRING;
case X_DEFAULT:
- return X_DEFAULT_STRING;
+ return X_DEFAULT_STRING;
case X_CMDLINE:
- return X_CMDLINE_STRING;
+ return X_CMDLINE_STRING;
case X_NOTICE:
- return X_NOTICE_STRING;
+ return X_NOTICE_STRING;
case X_ERROR:
- return X_ERROR_STRING;
+ return X_ERROR_STRING;
case X_WARNING:
- return X_WARNING_STRING;
+ return X_WARNING_STRING;
case X_INFO:
- return X_INFO_STRING;
+ return X_INFO_STRING;
case X_NOT_IMPLEMENTED:
- return X_NOT_IMPLEMENTED_STRING;
+ return X_NOT_IMPLEMENTED_STRING;
case X_UNKNOWN:
- return X_UNKNOWN_STRING;
+ return X_UNKNOWN_STRING;
case X_NONE:
- return X_NONE_STRING;
+ return X_NONE_STRING;
+ case X_DEBUG:
+ return X_DEBUG_STRING;
default:
- return X_UNKNOWN_STRING;
+ return X_UNKNOWN_STRING;
}
}
@@ -382,7 +388,7 @@ LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
type_str = LogMessageTypeVerbString(type, verb);
if (!type_str)
- return;
+ return;
/* if type_str is not "", prepend it and ' ', to format */
if (type_str[0] == '\0')
@@ -417,10 +423,9 @@ LogMessage(MessageType type, const char *format, ...)
va_end(ap);
}
-
void
LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
- va_list msg_args, const char *hdr_format, va_list hdr_args)
+ va_list msg_args, const char *hdr_format, va_list hdr_args)
{
const char *type_str;
char tmpFormat[1024];
@@ -430,29 +435,29 @@ LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
type_str = LogMessageTypeVerbString(type, verb);
if (!type_str)
- return;
+ return;
/* if type_str != "", copy it and ' ' to tmpFormat; set p after ' ' */
p = tmpFormat;
if (type_str[0] != '\0')
- p += snprintf(tmpFormat, sizeof(tmpFormat), "%s ", type_str);
+ p += snprintf(tmpFormat, sizeof(tmpFormat), "%s ", type_str);
/* append as much of hdr as fits after type_str (if there was one) */
left = tmpFormat_end - p;
if (left > 1)
- p += vsnprintf(p, left, hdr_format, hdr_args);
+ p += vsnprintf(p, left, hdr_format, hdr_args);
/* append as much of msg_format as will fit after hdr */
left = tmpFormat_end - p;
if (left > 1)
- snprintf(p, left, "%s", msg_format);
+ snprintf(p, left, "%s", msg_format);
LogVWrite(verb, tmpFormat, msg_args);
}
void
LogHdrMessageVerb(MessageType type, int verb, const char *msg_format,
- va_list msg_args, const char *hdr_format, ...)
+ va_list msg_args, const char *hdr_format, ...)
{
va_list hdr_args;
@@ -463,7 +468,7 @@ LogHdrMessageVerb(MessageType type, int verb, const char *msg_format,
void
LogHdrMessage(MessageType type, const char *msg_format, va_list msg_args,
- const char *hdr_format, ...)
+ const char *hdr_format, ...)
{
va_list hdr_args;
@@ -473,7 +478,8 @@ LogHdrMessage(MessageType type, const char *msg_format, va_list msg_args,
}
void
-AbortServer(void) _X_NORETURN;
+AbortServer(void)
+ _X_NORETURN;
void
AbortServer(void)
@@ -487,13 +493,13 @@ AbortServer(void)
AbortDDX(EXIT_ERR_ABORT);
fflush(stderr);
if (CoreDump)
- OsAbort();
- exit (1);
+ OsAbort();
+ exit(1);
}
#define AUDIT_PREFIX "AUDIT: %s: %ld: "
#ifndef AUDIT_TIMEOUT
-#define AUDIT_TIMEOUT ((CARD32)(120 * 1000)) /* 2 mn */
+#define AUDIT_TIMEOUT ((CARD32)(120 * 1000)) /* 2 mn */
#endif
static int nrepeat = 0;
@@ -504,10 +510,10 @@ void
FreeAuditTimer(void)
{
if (auditTimer != NULL) {
- /* Force output of pending messages */
- TimerForce(auditTimer);
- TimerFree(auditTimer);
- auditTimer = NULL;
+ /* Force output of pending messages */
+ TimerForce(auditTimer);
+ TimerFree(auditTimer);
+ auditTimer = NULL;
}
}
@@ -522,17 +528,17 @@ AuditPrefix(void)
time(&tm);
autime = ctime(&tm);
if ((s = strchr(autime, '\n')))
- *s = '\0';
+ *s = '\0';
len = strlen(AUDIT_PREFIX) + strlen(autime) + 10 + 1;
tmpBuf = malloc(len);
if (!tmpBuf)
- return NULL;
- snprintf(tmpBuf, len, AUDIT_PREFIX, autime, (unsigned long)getpid());
+ return NULL;
+ snprintf(tmpBuf, len, AUDIT_PREFIX, autime, (unsigned long) getpid());
return tmpBuf;
}
void
-AuditF(const char * f, ...)
+AuditF(const char *f, ...)
{
va_list args;
@@ -548,16 +554,17 @@ AuditFlush(OsTimerPtr timer, CARD32 now, pointer arg)
char *prefix;
if (nrepeat > 0) {
- prefix = AuditPrefix();
- ErrorF("%slast message repeated %d times\n",
- prefix != NULL ? prefix : "", nrepeat);
- nrepeat = 0;
- free(prefix);
- return AUDIT_TIMEOUT;
- } else {
- /* if the timer expires without anything to print, flush the message */
- oldlen = -1;
- return 0;
+ prefix = AuditPrefix();
+ ErrorF("%slast message repeated %d times\n",
+ prefix != NULL ? prefix : "", nrepeat);
+ nrepeat = 0;
+ free(prefix);
+ return AUDIT_TIMEOUT;
+ }
+ else {
+ /* if the timer expires without anything to print, flush the message */
+ oldlen = -1;
+ return 0;
}
}
@@ -573,17 +580,18 @@ VAuditF(const char *f, va_list args)
len = vsnprintf(buf, sizeof(buf), f, args);
if (len == oldlen && strcmp(buf, oldbuf) == 0) {
- /* Message already seen */
- nrepeat++;
- } else {
- /* new message */
- if (auditTimer != NULL)
- TimerForce(auditTimer);
- ErrorF("%s%s", prefix != NULL ? prefix : "", buf);
- strncpy(oldbuf, buf, sizeof(oldbuf));
- oldlen = len;
- nrepeat = 0;
- auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL);
+ /* Message already seen */
+ nrepeat++;
+ }
+ else {
+ /* new message */
+ if (auditTimer != NULL)
+ TimerForce(auditTimer);
+ ErrorF("%s%s", prefix != NULL ? prefix : "", buf);
+ strncpy(oldbuf, buf, sizeof(oldbuf));
+ oldlen = len;
+ nrepeat = 0;
+ auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL);
}
free(prefix);
}
@@ -597,16 +605,18 @@ FatalError(const char *f, ...)
static Bool beenhere = FALSE;
if (beenhere)
- ErrorF("\nFatalError re-entered, aborting\n");
+ ErrorF("\nFatalError re-entered, aborting\n");
else
- ErrorF("\nFatal server error:\n");
+ ErrorF("\nFatal server error:\n");
va_start(args, f);
#ifdef __APPLE__
{
va_list args2;
+
va_copy(args2, args);
- (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, args2);
+ (void) vsnprintf(__crashreporter_info_buff__,
+ sizeof(__crashreporter_info_buff__), f, args2);
va_end(args2);
}
#endif
@@ -617,30 +627,30 @@ FatalError(const char *f, ...)
va_end(args);
ErrorF("\n");
if (!beenhere)
- OsVendorFatalError();
+ OsVendorFatalError();
if (!beenhere) {
- beenhere = TRUE;
- AbortServer();
- } else
- OsAbort();
- /*NOTREACHED*/
-}
+ beenhere = TRUE;
+ AbortServer();
+ }
+ else
+ OsAbort();
+ /*NOTREACHED*/}
void
VErrorF(const char *f, va_list args)
{
#ifdef DDXOSVERRORF
if (OsVendorVErrorFProc)
- OsVendorVErrorFProc(f, args);
+ OsVendorVErrorFProc(f, args);
else
- LogVWrite(-1, f, args);
+ LogVWrite(-1, f, args);
#else
LogVWrite(-1, f, args);
#endif
}
void
-ErrorF(const char * f, ...)
+ErrorF(const char *f, ...)
{
va_list args;
@@ -665,4 +675,3 @@ LogPrintMarkers(void)
LogMessageVerb(X_NOT_IMPLEMENTED, 0, "not implemented, ");
LogMessageVerb(X_UNKNOWN, 0, "unknown.\n");
}
-
diff --git a/xorg-server/os/mitauth.c b/xorg-server/os/mitauth.c
index 477736ee8..768a52a22 100644
--- a/xorg-server/os/mitauth.c
+++ b/xorg-server/os/mitauth.c
@@ -41,27 +41,24 @@ from The Open Group.
#include "dixstruct.h"
static struct auth {
- struct auth *next;
- unsigned short len;
- char *data;
- XID id;
+ struct auth *next;
+ unsigned short len;
+ char *data;
+ XID id;
} *mit_auth;
int
-MitAddCookie (
- unsigned short data_length,
- const char *data,
- XID id)
+MitAddCookie(unsigned short data_length, const char *data, XID id)
{
- struct auth *new;
+ struct auth *new;
- new = malloc(sizeof (struct auth));
+ new = malloc(sizeof(struct auth));
if (!new)
- return 0;
+ return 0;
new->data = malloc((unsigned) data_length);
if (!new->data) {
- free(new);
- return 0;
+ free(new);
+ return 0;
}
new->next = mit_auth;
mit_auth = new;
@@ -72,126 +69,110 @@ MitAddCookie (
}
XID
-MitCheckCookie (
- unsigned short data_length,
- const char *data,
- ClientPtr client,
- const char **reason)
+MitCheckCookie(unsigned short data_length,
+ const char *data, ClientPtr client, const char **reason)
{
- struct auth *auth;
+ struct auth *auth;
- for (auth = mit_auth; auth; auth=auth->next) {
+ for (auth = mit_auth; auth; auth = auth->next) {
if (data_length == auth->len &&
- memcmp (data, auth->data, (int) data_length) == 0)
- return auth->id;
+ memcmp(data, auth->data, (int) data_length) == 0)
+ return auth->id;
}
*reason = "Invalid MIT-MAGIC-COOKIE-1 key";
return (XID) -1;
}
int
-MitResetCookie (void)
+MitResetCookie(void)
{
- struct auth *auth, *next;
+ struct auth *auth, *next;
- for (auth = mit_auth; auth; auth=next) {
- next = auth->next;
- free(auth->data);
- free(auth);
+ for (auth = mit_auth; auth; auth = next) {
+ next = auth->next;
+ free(auth->data);
+ free(auth);
}
mit_auth = 0;
return 0;
}
XID
-MitToID (
- unsigned short data_length,
- char *data)
+MitToID(unsigned short data_length, char *data)
{
- struct auth *auth;
+ struct auth *auth;
- for (auth = mit_auth; auth; auth=auth->next) {
- if (data_length == auth->len &&
- memcmp (data, auth->data, data_length) == 0)
- return auth->id;
+ for (auth = mit_auth; auth; auth = auth->next) {
+ if (data_length == auth->len &&
+ memcmp(data, auth->data, data_length) == 0)
+ return auth->id;
}
return (XID) -1;
}
int
-MitFromID (
- XID id,
- unsigned short *data_lenp,
- char **datap)
+MitFromID(XID id, unsigned short *data_lenp, char **datap)
{
- struct auth *auth;
-
- for (auth = mit_auth; auth; auth=auth->next) {
- if (id == auth->id) {
- *data_lenp = auth->len;
- *datap = auth->data;
- return 1;
- }
+ struct auth *auth;
+
+ for (auth = mit_auth; auth; auth = auth->next) {
+ if (id == auth->id) {
+ *data_lenp = auth->len;
+ *datap = auth->data;
+ return 1;
+ }
}
return 0;
}
int
-MitRemoveCookie (
- unsigned short data_length,
- const char *data)
+MitRemoveCookie(unsigned short data_length, const char *data)
{
- struct auth *auth, *prev;
+ struct auth *auth, *prev;
prev = 0;
- for (auth = mit_auth; auth; prev = auth, auth=auth->next) {
- if (data_length == auth->len &&
- memcmp (data, auth->data, data_length) == 0)
- {
- if (prev)
- prev->next = auth->next;
- else
- mit_auth = auth->next;
- free(auth->data);
- free(auth);
- return 1;
- }
+ for (auth = mit_auth; auth; prev = auth, auth = auth->next) {
+ if (data_length == auth->len &&
+ memcmp(data, auth->data, data_length) == 0) {
+ if (prev)
+ prev->next = auth->next;
+ else
+ mit_auth = auth->next;
+ free(auth->data);
+ free(auth);
+ return 1;
+ }
}
return 0;
}
#ifdef XCSECURITY
-static char cookie[16]; /* 128 bits */
+static char cookie[16]; /* 128 bits */
XID
-MitGenerateCookie (
- unsigned data_length,
- const char *data,
- XID id,
- unsigned *data_length_return,
- char **data_return)
+MitGenerateCookie(unsigned data_length,
+ const char *data,
+ XID id, unsigned *data_length_return, char **data_return)
{
int i = 0;
int status;
- while (data_length--)
- {
- cookie[i++] += *data++;
- if (i >= sizeof (cookie)) i = 0;
+ while (data_length--) {
+ cookie[i++] += *data++;
+ if (i >= sizeof(cookie))
+ i = 0;
}
- GenerateRandomData(sizeof (cookie), cookie);
- status = MitAddCookie(sizeof (cookie), cookie, id);
- if (!status)
- {
- id = -1;
+ GenerateRandomData(sizeof(cookie), cookie);
+ status = MitAddCookie(sizeof(cookie), cookie, id);
+ if (!status) {
+ id = -1;
}
- else
- {
- *data_return = cookie;
- *data_length_return = sizeof (cookie);
+ else {
+ *data_return = cookie;
+ *data_length_return = sizeof(cookie);
}
return id;
}
-#endif /* XCSECURITY */
+#endif /* XCSECURITY */
diff --git a/xorg-server/os/oscolor.c b/xorg-server/os/oscolor.c
index 7f6b93880..a7573d28b 100644
--- a/xorg-server/os/oscolor.c
+++ b/xorg-server/os/oscolor.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -53,1554 +52,1547 @@ SOFTWARE.
#include "os.h"
typedef struct _builtinColor {
- unsigned char red;
- unsigned char green;
- unsigned char blue;
- unsigned short name;
+ unsigned char red;
+ unsigned char green;
+ unsigned char blue;
+ unsigned short name;
} BuiltinColor;
static const char BuiltinColorNames[] = {
"alice blue\0"
- "AliceBlue\0"
- "antique white\0"
- "AntiqueWhite\0"
- "AntiqueWhite1\0"
- "AntiqueWhite2\0"
- "AntiqueWhite3\0"
- "AntiqueWhite4\0"
- "aquamarine\0"
- "aquamarine1\0"
- "aquamarine2\0"
- "aquamarine3\0"
- "aquamarine4\0"
- "azure\0"
- "azure1\0"
- "azure2\0"
- "azure3\0"
- "azure4\0"
- "beige\0"
- "bisque\0"
- "bisque1\0"
- "bisque2\0"
- "bisque3\0"
- "bisque4\0"
- "black\0"
- "blanched almond\0"
- "BlanchedAlmond\0"
- "blue\0"
- "blue violet\0"
- "blue1\0"
- "blue2\0"
- "blue3\0"
- "blue4\0"
- "BlueViolet\0"
- "brown\0"
- "brown1\0"
- "brown2\0"
- "brown3\0"
- "brown4\0"
- "burlywood\0"
- "burlywood1\0"
- "burlywood2\0"
- "burlywood3\0"
- "burlywood4\0"
- "cadet blue\0"
- "CadetBlue\0"
- "CadetBlue1\0"
- "CadetBlue2\0"
- "CadetBlue3\0"
- "CadetBlue4\0"
- "chartreuse\0"
- "chartreuse1\0"
- "chartreuse2\0"
- "chartreuse3\0"
- "chartreuse4\0"
- "chocolate\0"
- "chocolate1\0"
- "chocolate2\0"
- "chocolate3\0"
- "chocolate4\0"
- "coral\0"
- "coral1\0"
- "coral2\0"
- "coral3\0"
- "coral4\0"
- "cornflower blue\0"
- "CornflowerBlue\0"
- "cornsilk\0"
- "cornsilk1\0"
- "cornsilk2\0"
- "cornsilk3\0"
- "cornsilk4\0"
- "cyan\0"
- "cyan1\0"
- "cyan2\0"
- "cyan3\0"
- "cyan4\0"
- "dark blue\0"
- "dark cyan\0"
- "dark goldenrod\0"
- "dark gray\0"
- "dark green\0"
- "dark grey\0"
- "dark khaki\0"
- "dark magenta\0"
- "dark olive green\0"
- "dark orange\0"
- "dark orchid\0"
- "dark red\0"
- "dark salmon\0"
- "dark sea green\0"
- "dark slate blue\0"
- "dark slate gray\0"
- "dark slate grey\0"
- "dark turquoise\0"
- "dark violet\0"
- "DarkBlue\0"
- "DarkCyan\0"
- "DarkGoldenrod\0"
- "DarkGoldenrod1\0"
- "DarkGoldenrod2\0"
- "DarkGoldenrod3\0"
- "DarkGoldenrod4\0"
- "DarkGray\0"
- "DarkGreen\0"
- "DarkGrey\0"
- "DarkKhaki\0"
- "DarkMagenta\0"
- "DarkOliveGreen\0"
- "DarkOliveGreen1\0"
- "DarkOliveGreen2\0"
- "DarkOliveGreen3\0"
- "DarkOliveGreen4\0"
- "DarkOrange\0"
- "DarkOrange1\0"
- "DarkOrange2\0"
- "DarkOrange3\0"
- "DarkOrange4\0"
- "DarkOrchid\0"
- "DarkOrchid1\0"
- "DarkOrchid2\0"
- "DarkOrchid3\0"
- "DarkOrchid4\0"
- "DarkRed\0"
- "DarkSalmon\0"
- "DarkSeaGreen\0"
- "DarkSeaGreen1\0"
- "DarkSeaGreen2\0"
- "DarkSeaGreen3\0"
- "DarkSeaGreen4\0"
- "DarkSlateBlue\0"
- "DarkSlateGray\0"
- "DarkSlateGray1\0"
- "DarkSlateGray2\0"
- "DarkSlateGray3\0"
- "DarkSlateGray4\0"
- "DarkSlateGrey\0"
- "DarkTurquoise\0"
- "DarkViolet\0"
- "deep pink\0"
- "deep sky blue\0"
- "DeepPink\0"
- "DeepPink1\0"
- "DeepPink2\0"
- "DeepPink3\0"
- "DeepPink4\0"
- "DeepSkyBlue\0"
- "DeepSkyBlue1\0"
- "DeepSkyBlue2\0"
- "DeepSkyBlue3\0"
- "DeepSkyBlue4\0"
- "dim gray\0"
- "dim grey\0"
- "DimGray\0"
- "DimGrey\0"
- "dodger blue\0"
- "DodgerBlue\0"
- "DodgerBlue1\0"
- "DodgerBlue2\0"
- "DodgerBlue3\0"
- "DodgerBlue4\0"
- "firebrick\0"
- "firebrick1\0"
- "firebrick2\0"
- "firebrick3\0"
- "firebrick4\0"
- "floral white\0"
- "FloralWhite\0"
- "forest green\0"
- "ForestGreen\0"
- "gainsboro\0"
- "ghost white\0"
- "GhostWhite\0"
- "gold\0"
- "gold1\0"
- "gold2\0"
- "gold3\0"
- "gold4\0"
- "goldenrod\0"
- "goldenrod1\0"
- "goldenrod2\0"
- "goldenrod3\0"
- "goldenrod4\0"
- "gray\0"
- "gray0\0"
- "gray1\0"
- "gray10\0"
- "gray100\0"
- "gray11\0"
- "gray12\0"
- "gray13\0"
- "gray14\0"
- "gray15\0"
- "gray16\0"
- "gray17\0"
- "gray18\0"
- "gray19\0"
- "gray2\0"
- "gray20\0"
- "gray21\0"
- "gray22\0"
- "gray23\0"
- "gray24\0"
- "gray25\0"
- "gray26\0"
- "gray27\0"
- "gray28\0"
- "gray29\0"
- "gray3\0"
- "gray30\0"
- "gray31\0"
- "gray32\0"
- "gray33\0"
- "gray34\0"
- "gray35\0"
- "gray36\0"
- "gray37\0"
- "gray38\0"
- "gray39\0"
- "gray4\0"
- "gray40\0"
- "gray41\0"
- "gray42\0"
- "gray43\0"
- "gray44\0"
- "gray45\0"
- "gray46\0"
- "gray47\0"
- "gray48\0"
- "gray49\0"
- "gray5\0"
- "gray50\0"
- "gray51\0"
- "gray52\0"
- "gray53\0"
- "gray54\0"
- "gray55\0"
- "gray56\0"
- "gray57\0"
- "gray58\0"
- "gray59\0"
- "gray6\0"
- "gray60\0"
- "gray61\0"
- "gray62\0"
- "gray63\0"
- "gray64\0"
- "gray65\0"
- "gray66\0"
- "gray67\0"
- "gray68\0"
- "gray69\0"
- "gray7\0"
- "gray70\0"
- "gray71\0"
- "gray72\0"
- "gray73\0"
- "gray74\0"
- "gray75\0"
- "gray76\0"
- "gray77\0"
- "gray78\0"
- "gray79\0"
- "gray8\0"
- "gray80\0"
- "gray81\0"
- "gray82\0"
- "gray83\0"
- "gray84\0"
- "gray85\0"
- "gray86\0"
- "gray87\0"
- "gray88\0"
- "gray89\0"
- "gray9\0"
- "gray90\0"
- "gray91\0"
- "gray92\0"
- "gray93\0"
- "gray94\0"
- "gray95\0"
- "gray96\0"
- "gray97\0"
- "gray98\0"
- "gray99\0"
- "green\0"
- "green yellow\0"
- "green1\0"
- "green2\0"
- "green3\0"
- "green4\0"
- "GreenYellow\0"
- "grey\0"
- "grey0\0"
- "grey1\0"
- "grey10\0"
- "grey100\0"
- "grey11\0"
- "grey12\0"
- "grey13\0"
- "grey14\0"
- "grey15\0"
- "grey16\0"
- "grey17\0"
- "grey18\0"
- "grey19\0"
- "grey2\0"
- "grey20\0"
- "grey21\0"
- "grey22\0"
- "grey23\0"
- "grey24\0"
- "grey25\0"
- "grey26\0"
- "grey27\0"
- "grey28\0"
- "grey29\0"
- "grey3\0"
- "grey30\0"
- "grey31\0"
- "grey32\0"
- "grey33\0"
- "grey34\0"
- "grey35\0"
- "grey36\0"
- "grey37\0"
- "grey38\0"
- "grey39\0"
- "grey4\0"
- "grey40\0"
- "grey41\0"
- "grey42\0"
- "grey43\0"
- "grey44\0"
- "grey45\0"
- "grey46\0"
- "grey47\0"
- "grey48\0"
- "grey49\0"
- "grey5\0"
- "grey50\0"
- "grey51\0"
- "grey52\0"
- "grey53\0"
- "grey54\0"
- "grey55\0"
- "grey56\0"
- "grey57\0"
- "grey58\0"
- "grey59\0"
- "grey6\0"
- "grey60\0"
- "grey61\0"
- "grey62\0"
- "grey63\0"
- "grey64\0"
- "grey65\0"
- "grey66\0"
- "grey67\0"
- "grey68\0"
- "grey69\0"
- "grey7\0"
- "grey70\0"
- "grey71\0"
- "grey72\0"
- "grey73\0"
- "grey74\0"
- "grey75\0"
- "grey76\0"
- "grey77\0"
- "grey78\0"
- "grey79\0"
- "grey8\0"
- "grey80\0"
- "grey81\0"
- "grey82\0"
- "grey83\0"
- "grey84\0"
- "grey85\0"
- "grey86\0"
- "grey87\0"
- "grey88\0"
- "grey89\0"
- "grey9\0"
- "grey90\0"
- "grey91\0"
- "grey92\0"
- "grey93\0"
- "grey94\0"
- "grey95\0"
- "grey96\0"
- "grey97\0"
- "grey98\0"
- "grey99\0"
- "honeydew\0"
- "honeydew1\0"
- "honeydew2\0"
- "honeydew3\0"
- "honeydew4\0"
- "hot pink\0"
- "HotPink\0"
- "HotPink1\0"
- "HotPink2\0"
- "HotPink3\0"
- "HotPink4\0"
- "indian red\0"
- "IndianRed\0"
- "IndianRed1\0"
- "IndianRed2\0"
- "IndianRed3\0"
- "IndianRed4\0"
- "ivory\0"
- "ivory1\0"
- "ivory2\0"
- "ivory3\0"
- "ivory4\0"
- "khaki\0"
- "khaki1\0"
- "khaki2\0"
- "khaki3\0"
- "khaki4\0"
- "lavender\0"
- "lavender blush\0"
- "LavenderBlush\0"
- "LavenderBlush1\0"
- "LavenderBlush2\0"
- "LavenderBlush3\0"
- "LavenderBlush4\0"
- "lawn green\0"
- "LawnGreen\0"
- "lemon chiffon\0"
- "LemonChiffon\0"
- "LemonChiffon1\0"
- "LemonChiffon2\0"
- "LemonChiffon3\0"
- "LemonChiffon4\0"
- "light blue\0"
- "light coral\0"
- "light cyan\0"
- "light goldenrod\0"
- "light goldenrod yellow\0"
- "light gray\0"
- "light green\0"
- "light grey\0"
- "light pink\0"
- "light salmon\0"
- "light sea green\0"
- "light sky blue\0"
- "light slate blue\0"
- "light slate gray\0"
- "light slate grey\0"
- "light steel blue\0"
- "light yellow\0"
- "LightBlue\0"
- "LightBlue1\0"
- "LightBlue2\0"
- "LightBlue3\0"
- "LightBlue4\0"
- "LightCoral\0"
- "LightCyan\0"
- "LightCyan1\0"
- "LightCyan2\0"
- "LightCyan3\0"
- "LightCyan4\0"
- "LightGoldenrod\0"
- "LightGoldenrod1\0"
- "LightGoldenrod2\0"
- "LightGoldenrod3\0"
- "LightGoldenrod4\0"
- "LightGoldenrodYellow\0"
- "LightGray\0"
- "LightGreen\0"
- "LightGrey\0"
- "LightPink\0"
- "LightPink1\0"
- "LightPink2\0"
- "LightPink3\0"
- "LightPink4\0"
- "LightSalmon\0"
- "LightSalmon1\0"
- "LightSalmon2\0"
- "LightSalmon3\0"
- "LightSalmon4\0"
- "LightSeaGreen\0"
- "LightSkyBlue\0"
- "LightSkyBlue1\0"
- "LightSkyBlue2\0"
- "LightSkyBlue3\0"
- "LightSkyBlue4\0"
- "LightSlateBlue\0"
- "LightSlateGray\0"
- "LightSlateGrey\0"
- "LightSteelBlue\0"
- "LightSteelBlue1\0"
- "LightSteelBlue2\0"
- "LightSteelBlue3\0"
- "LightSteelBlue4\0"
- "LightYellow\0"
- "LightYellow1\0"
- "LightYellow2\0"
- "LightYellow3\0"
- "LightYellow4\0"
- "lime green\0"
- "LimeGreen\0"
- "linen\0"
- "magenta\0"
- "magenta1\0"
- "magenta2\0"
- "magenta3\0"
- "magenta4\0"
- "maroon\0"
- "maroon1\0"
- "maroon2\0"
- "maroon3\0"
- "maroon4\0"
- "medium aquamarine\0"
- "medium blue\0"
- "medium orchid\0"
- "medium purple\0"
- "medium sea green\0"
- "medium slate blue\0"
- "medium spring green\0"
- "medium turquoise\0"
- "medium violet red\0"
- "MediumAquamarine\0"
- "MediumBlue\0"
- "MediumOrchid\0"
- "MediumOrchid1\0"
- "MediumOrchid2\0"
- "MediumOrchid3\0"
- "MediumOrchid4\0"
- "MediumPurple\0"
- "MediumPurple1\0"
- "MediumPurple2\0"
- "MediumPurple3\0"
- "MediumPurple4\0"
- "MediumSeaGreen\0"
- "MediumSlateBlue\0"
- "MediumSpringGreen\0"
- "MediumTurquoise\0"
- "MediumVioletRed\0"
- "midnight blue\0"
- "MidnightBlue\0"
- "mint cream\0"
- "MintCream\0"
- "misty rose\0"
- "MistyRose\0"
- "MistyRose1\0"
- "MistyRose2\0"
- "MistyRose3\0"
- "MistyRose4\0"
- "moccasin\0"
- "navajo white\0"
- "NavajoWhite\0"
- "NavajoWhite1\0"
- "NavajoWhite2\0"
- "NavajoWhite3\0"
- "NavajoWhite4\0"
- "navy\0"
- "navy blue\0"
- "NavyBlue\0"
- "old lace\0"
- "OldLace\0"
- "olive drab\0"
- "OliveDrab\0"
- "OliveDrab1\0"
- "OliveDrab2\0"
- "OliveDrab3\0"
- "OliveDrab4\0"
- "orange\0"
- "orange red\0"
- "orange1\0"
- "orange2\0"
- "orange3\0"
- "orange4\0"
- "OrangeRed\0"
- "OrangeRed1\0"
- "OrangeRed2\0"
- "OrangeRed3\0"
- "OrangeRed4\0"
- "orchid\0"
- "orchid1\0"
- "orchid2\0"
- "orchid3\0"
- "orchid4\0"
- "pale goldenrod\0"
- "pale green\0"
- "pale turquoise\0"
- "pale violet red\0"
- "PaleGoldenrod\0"
- "PaleGreen\0"
- "PaleGreen1\0"
- "PaleGreen2\0"
- "PaleGreen3\0"
- "PaleGreen4\0"
- "PaleTurquoise\0"
- "PaleTurquoise1\0"
- "PaleTurquoise2\0"
- "PaleTurquoise3\0"
- "PaleTurquoise4\0"
- "PaleVioletRed\0"
- "PaleVioletRed1\0"
- "PaleVioletRed2\0"
- "PaleVioletRed3\0"
- "PaleVioletRed4\0"
- "papaya whip\0"
- "PapayaWhip\0"
- "peach puff\0"
- "PeachPuff\0"
- "PeachPuff1\0"
- "PeachPuff2\0"
- "PeachPuff3\0"
- "PeachPuff4\0"
- "peru\0"
- "pink\0"
- "pink1\0"
- "pink2\0"
- "pink3\0"
- "pink4\0"
- "plum\0"
- "plum1\0"
- "plum2\0"
- "plum3\0"
- "plum4\0"
- "powder blue\0"
- "PowderBlue\0"
- "purple\0"
- "purple1\0"
- "purple2\0"
- "purple3\0"
- "purple4\0"
- "red\0"
- "red1\0"
- "red2\0"
- "red3\0"
- "red4\0"
- "rosy brown\0"
- "RosyBrown\0"
- "RosyBrown1\0"
- "RosyBrown2\0"
- "RosyBrown3\0"
- "RosyBrown4\0"
- "royal blue\0"
- "RoyalBlue\0"
- "RoyalBlue1\0"
- "RoyalBlue2\0"
- "RoyalBlue3\0"
- "RoyalBlue4\0"
- "saddle brown\0"
- "SaddleBrown\0"
- "salmon\0"
- "salmon1\0"
- "salmon2\0"
- "salmon3\0"
- "salmon4\0"
- "sandy brown\0"
- "SandyBrown\0"
- "sea green\0"
- "SeaGreen\0"
- "SeaGreen1\0"
- "SeaGreen2\0"
- "SeaGreen3\0"
- "SeaGreen4\0"
- "seashell\0"
- "seashell1\0"
- "seashell2\0"
- "seashell3\0"
- "seashell4\0"
- "sienna\0"
- "sienna1\0"
- "sienna2\0"
- "sienna3\0"
- "sienna4\0"
- "sky blue\0"
- "SkyBlue\0"
- "SkyBlue1\0"
- "SkyBlue2\0"
- "SkyBlue3\0"
- "SkyBlue4\0"
- "slate blue\0"
- "slate gray\0"
- "slate grey\0"
- "SlateBlue\0"
- "SlateBlue1\0"
- "SlateBlue2\0"
- "SlateBlue3\0"
- "SlateBlue4\0"
- "SlateGray\0"
- "SlateGray1\0"
- "SlateGray2\0"
- "SlateGray3\0"
- "SlateGray4\0"
- "SlateGrey\0"
- "snow\0"
- "snow1\0"
- "snow2\0"
- "snow3\0"
- "snow4\0"
- "spring green\0"
- "SpringGreen\0"
- "SpringGreen1\0"
- "SpringGreen2\0"
- "SpringGreen3\0"
- "SpringGreen4\0"
- "steel blue\0"
- "SteelBlue\0"
- "SteelBlue1\0"
- "SteelBlue2\0"
- "SteelBlue3\0"
- "SteelBlue4\0"
- "tan\0"
- "tan1\0"
- "tan2\0"
- "tan3\0"
- "tan4\0"
- "thistle\0"
- "thistle1\0"
- "thistle2\0"
- "thistle3\0"
- "thistle4\0"
- "tomato\0"
- "tomato1\0"
- "tomato2\0"
- "tomato3\0"
- "tomato4\0"
- "turquoise\0"
- "turquoise1\0"
- "turquoise2\0"
- "turquoise3\0"
- "turquoise4\0"
- "violet\0"
- "violet red\0"
- "VioletRed\0"
- "VioletRed1\0"
- "VioletRed2\0"
- "VioletRed3\0"
- "VioletRed4\0"
- "wheat\0"
- "wheat1\0"
- "wheat2\0"
- "wheat3\0"
- "wheat4\0"
- "white\0"
- "white smoke\0"
- "WhiteSmoke\0"
- "yellow\0"
- "yellow green\0"
- "yellow1\0"
- "yellow2\0"
- "yellow3\0"
- "yellow4\0"
- "YellowGreen\0"
+ "AliceBlue\0"
+ "antique white\0"
+ "AntiqueWhite\0"
+ "AntiqueWhite1\0"
+ "AntiqueWhite2\0"
+ "AntiqueWhite3\0"
+ "AntiqueWhite4\0"
+ "aquamarine\0"
+ "aquamarine1\0"
+ "aquamarine2\0"
+ "aquamarine3\0"
+ "aquamarine4\0"
+ "azure\0"
+ "azure1\0"
+ "azure2\0"
+ "azure3\0"
+ "azure4\0"
+ "beige\0"
+ "bisque\0"
+ "bisque1\0"
+ "bisque2\0"
+ "bisque3\0"
+ "bisque4\0"
+ "black\0"
+ "blanched almond\0"
+ "BlanchedAlmond\0"
+ "blue\0"
+ "blue violet\0"
+ "blue1\0"
+ "blue2\0"
+ "blue3\0"
+ "blue4\0"
+ "BlueViolet\0"
+ "brown\0"
+ "brown1\0"
+ "brown2\0"
+ "brown3\0"
+ "brown4\0"
+ "burlywood\0"
+ "burlywood1\0"
+ "burlywood2\0"
+ "burlywood3\0"
+ "burlywood4\0"
+ "cadet blue\0"
+ "CadetBlue\0"
+ "CadetBlue1\0"
+ "CadetBlue2\0"
+ "CadetBlue3\0"
+ "CadetBlue4\0"
+ "chartreuse\0"
+ "chartreuse1\0"
+ "chartreuse2\0"
+ "chartreuse3\0"
+ "chartreuse4\0"
+ "chocolate\0"
+ "chocolate1\0"
+ "chocolate2\0"
+ "chocolate3\0"
+ "chocolate4\0"
+ "coral\0"
+ "coral1\0"
+ "coral2\0"
+ "coral3\0"
+ "coral4\0"
+ "cornflower blue\0"
+ "CornflowerBlue\0"
+ "cornsilk\0"
+ "cornsilk1\0"
+ "cornsilk2\0"
+ "cornsilk3\0"
+ "cornsilk4\0"
+ "cyan\0"
+ "cyan1\0"
+ "cyan2\0"
+ "cyan3\0"
+ "cyan4\0"
+ "dark blue\0"
+ "dark cyan\0"
+ "dark goldenrod\0"
+ "dark gray\0"
+ "dark green\0"
+ "dark grey\0"
+ "dark khaki\0"
+ "dark magenta\0"
+ "dark olive green\0"
+ "dark orange\0"
+ "dark orchid\0"
+ "dark red\0"
+ "dark salmon\0"
+ "dark sea green\0"
+ "dark slate blue\0"
+ "dark slate gray\0"
+ "dark slate grey\0"
+ "dark turquoise\0"
+ "dark violet\0"
+ "DarkBlue\0"
+ "DarkCyan\0"
+ "DarkGoldenrod\0"
+ "DarkGoldenrod1\0"
+ "DarkGoldenrod2\0"
+ "DarkGoldenrod3\0"
+ "DarkGoldenrod4\0"
+ "DarkGray\0"
+ "DarkGreen\0"
+ "DarkGrey\0"
+ "DarkKhaki\0"
+ "DarkMagenta\0"
+ "DarkOliveGreen\0"
+ "DarkOliveGreen1\0"
+ "DarkOliveGreen2\0"
+ "DarkOliveGreen3\0"
+ "DarkOliveGreen4\0"
+ "DarkOrange\0"
+ "DarkOrange1\0"
+ "DarkOrange2\0"
+ "DarkOrange3\0"
+ "DarkOrange4\0"
+ "DarkOrchid\0"
+ "DarkOrchid1\0"
+ "DarkOrchid2\0"
+ "DarkOrchid3\0"
+ "DarkOrchid4\0"
+ "DarkRed\0"
+ "DarkSalmon\0"
+ "DarkSeaGreen\0"
+ "DarkSeaGreen1\0"
+ "DarkSeaGreen2\0"
+ "DarkSeaGreen3\0"
+ "DarkSeaGreen4\0"
+ "DarkSlateBlue\0"
+ "DarkSlateGray\0"
+ "DarkSlateGray1\0"
+ "DarkSlateGray2\0"
+ "DarkSlateGray3\0"
+ "DarkSlateGray4\0"
+ "DarkSlateGrey\0"
+ "DarkTurquoise\0"
+ "DarkViolet\0"
+ "deep pink\0"
+ "deep sky blue\0"
+ "DeepPink\0"
+ "DeepPink1\0"
+ "DeepPink2\0"
+ "DeepPink3\0"
+ "DeepPink4\0"
+ "DeepSkyBlue\0"
+ "DeepSkyBlue1\0"
+ "DeepSkyBlue2\0"
+ "DeepSkyBlue3\0"
+ "DeepSkyBlue4\0"
+ "dim gray\0"
+ "dim grey\0"
+ "DimGray\0"
+ "DimGrey\0"
+ "dodger blue\0"
+ "DodgerBlue\0"
+ "DodgerBlue1\0"
+ "DodgerBlue2\0"
+ "DodgerBlue3\0"
+ "DodgerBlue4\0"
+ "firebrick\0"
+ "firebrick1\0"
+ "firebrick2\0"
+ "firebrick3\0"
+ "firebrick4\0"
+ "floral white\0"
+ "FloralWhite\0"
+ "forest green\0"
+ "ForestGreen\0"
+ "gainsboro\0"
+ "ghost white\0"
+ "GhostWhite\0"
+ "gold\0"
+ "gold1\0"
+ "gold2\0"
+ "gold3\0"
+ "gold4\0"
+ "goldenrod\0"
+ "goldenrod1\0"
+ "goldenrod2\0"
+ "goldenrod3\0"
+ "goldenrod4\0"
+ "gray\0"
+ "gray0\0"
+ "gray1\0"
+ "gray10\0"
+ "gray100\0"
+ "gray11\0"
+ "gray12\0"
+ "gray13\0"
+ "gray14\0"
+ "gray15\0"
+ "gray16\0"
+ "gray17\0"
+ "gray18\0"
+ "gray19\0"
+ "gray2\0"
+ "gray20\0"
+ "gray21\0"
+ "gray22\0"
+ "gray23\0"
+ "gray24\0"
+ "gray25\0"
+ "gray26\0"
+ "gray27\0"
+ "gray28\0"
+ "gray29\0"
+ "gray3\0"
+ "gray30\0"
+ "gray31\0"
+ "gray32\0"
+ "gray33\0"
+ "gray34\0"
+ "gray35\0"
+ "gray36\0"
+ "gray37\0"
+ "gray38\0"
+ "gray39\0"
+ "gray4\0"
+ "gray40\0"
+ "gray41\0"
+ "gray42\0"
+ "gray43\0"
+ "gray44\0"
+ "gray45\0"
+ "gray46\0"
+ "gray47\0"
+ "gray48\0"
+ "gray49\0"
+ "gray5\0"
+ "gray50\0"
+ "gray51\0"
+ "gray52\0"
+ "gray53\0"
+ "gray54\0"
+ "gray55\0"
+ "gray56\0"
+ "gray57\0"
+ "gray58\0"
+ "gray59\0"
+ "gray6\0"
+ "gray60\0"
+ "gray61\0"
+ "gray62\0"
+ "gray63\0"
+ "gray64\0"
+ "gray65\0"
+ "gray66\0"
+ "gray67\0"
+ "gray68\0"
+ "gray69\0"
+ "gray7\0"
+ "gray70\0"
+ "gray71\0"
+ "gray72\0"
+ "gray73\0"
+ "gray74\0"
+ "gray75\0"
+ "gray76\0"
+ "gray77\0"
+ "gray78\0"
+ "gray79\0"
+ "gray8\0"
+ "gray80\0"
+ "gray81\0"
+ "gray82\0"
+ "gray83\0"
+ "gray84\0"
+ "gray85\0"
+ "gray86\0"
+ "gray87\0"
+ "gray88\0"
+ "gray89\0"
+ "gray9\0"
+ "gray90\0"
+ "gray91\0"
+ "gray92\0"
+ "gray93\0"
+ "gray94\0"
+ "gray95\0"
+ "gray96\0"
+ "gray97\0"
+ "gray98\0"
+ "gray99\0"
+ "green\0"
+ "green yellow\0"
+ "green1\0"
+ "green2\0"
+ "green3\0"
+ "green4\0"
+ "GreenYellow\0"
+ "grey\0"
+ "grey0\0"
+ "grey1\0"
+ "grey10\0"
+ "grey100\0"
+ "grey11\0"
+ "grey12\0"
+ "grey13\0"
+ "grey14\0"
+ "grey15\0"
+ "grey16\0"
+ "grey17\0"
+ "grey18\0"
+ "grey19\0"
+ "grey2\0"
+ "grey20\0"
+ "grey21\0"
+ "grey22\0"
+ "grey23\0"
+ "grey24\0"
+ "grey25\0"
+ "grey26\0"
+ "grey27\0"
+ "grey28\0"
+ "grey29\0"
+ "grey3\0"
+ "grey30\0"
+ "grey31\0"
+ "grey32\0"
+ "grey33\0"
+ "grey34\0"
+ "grey35\0"
+ "grey36\0"
+ "grey37\0"
+ "grey38\0"
+ "grey39\0"
+ "grey4\0"
+ "grey40\0"
+ "grey41\0"
+ "grey42\0"
+ "grey43\0"
+ "grey44\0"
+ "grey45\0"
+ "grey46\0"
+ "grey47\0"
+ "grey48\0"
+ "grey49\0"
+ "grey5\0"
+ "grey50\0"
+ "grey51\0"
+ "grey52\0"
+ "grey53\0"
+ "grey54\0"
+ "grey55\0"
+ "grey56\0"
+ "grey57\0"
+ "grey58\0"
+ "grey59\0"
+ "grey6\0"
+ "grey60\0"
+ "grey61\0"
+ "grey62\0"
+ "grey63\0"
+ "grey64\0"
+ "grey65\0"
+ "grey66\0"
+ "grey67\0"
+ "grey68\0"
+ "grey69\0"
+ "grey7\0"
+ "grey70\0"
+ "grey71\0"
+ "grey72\0"
+ "grey73\0"
+ "grey74\0"
+ "grey75\0"
+ "grey76\0"
+ "grey77\0"
+ "grey78\0"
+ "grey79\0"
+ "grey8\0"
+ "grey80\0"
+ "grey81\0"
+ "grey82\0"
+ "grey83\0"
+ "grey84\0"
+ "grey85\0"
+ "grey86\0"
+ "grey87\0"
+ "grey88\0"
+ "grey89\0"
+ "grey9\0"
+ "grey90\0"
+ "grey91\0"
+ "grey92\0"
+ "grey93\0"
+ "grey94\0"
+ "grey95\0"
+ "grey96\0"
+ "grey97\0"
+ "grey98\0"
+ "grey99\0"
+ "honeydew\0"
+ "honeydew1\0"
+ "honeydew2\0"
+ "honeydew3\0"
+ "honeydew4\0"
+ "hot pink\0"
+ "HotPink\0"
+ "HotPink1\0"
+ "HotPink2\0"
+ "HotPink3\0"
+ "HotPink4\0"
+ "indian red\0"
+ "IndianRed\0"
+ "IndianRed1\0"
+ "IndianRed2\0"
+ "IndianRed3\0"
+ "IndianRed4\0"
+ "ivory\0"
+ "ivory1\0"
+ "ivory2\0"
+ "ivory3\0"
+ "ivory4\0"
+ "khaki\0"
+ "khaki1\0"
+ "khaki2\0"
+ "khaki3\0"
+ "khaki4\0"
+ "lavender\0"
+ "lavender blush\0"
+ "LavenderBlush\0"
+ "LavenderBlush1\0"
+ "LavenderBlush2\0"
+ "LavenderBlush3\0"
+ "LavenderBlush4\0"
+ "lawn green\0"
+ "LawnGreen\0"
+ "lemon chiffon\0"
+ "LemonChiffon\0"
+ "LemonChiffon1\0"
+ "LemonChiffon2\0"
+ "LemonChiffon3\0"
+ "LemonChiffon4\0"
+ "light blue\0"
+ "light coral\0"
+ "light cyan\0"
+ "light goldenrod\0"
+ "light goldenrod yellow\0"
+ "light gray\0"
+ "light green\0"
+ "light grey\0"
+ "light pink\0"
+ "light salmon\0"
+ "light sea green\0"
+ "light sky blue\0"
+ "light slate blue\0"
+ "light slate gray\0"
+ "light slate grey\0"
+ "light steel blue\0"
+ "light yellow\0"
+ "LightBlue\0"
+ "LightBlue1\0"
+ "LightBlue2\0"
+ "LightBlue3\0"
+ "LightBlue4\0"
+ "LightCoral\0"
+ "LightCyan\0"
+ "LightCyan1\0"
+ "LightCyan2\0"
+ "LightCyan3\0"
+ "LightCyan4\0"
+ "LightGoldenrod\0"
+ "LightGoldenrod1\0"
+ "LightGoldenrod2\0"
+ "LightGoldenrod3\0"
+ "LightGoldenrod4\0"
+ "LightGoldenrodYellow\0"
+ "LightGray\0"
+ "LightGreen\0"
+ "LightGrey\0"
+ "LightPink\0"
+ "LightPink1\0"
+ "LightPink2\0"
+ "LightPink3\0"
+ "LightPink4\0"
+ "LightSalmon\0"
+ "LightSalmon1\0"
+ "LightSalmon2\0"
+ "LightSalmon3\0"
+ "LightSalmon4\0"
+ "LightSeaGreen\0"
+ "LightSkyBlue\0"
+ "LightSkyBlue1\0"
+ "LightSkyBlue2\0"
+ "LightSkyBlue3\0"
+ "LightSkyBlue4\0"
+ "LightSlateBlue\0"
+ "LightSlateGray\0"
+ "LightSlateGrey\0"
+ "LightSteelBlue\0"
+ "LightSteelBlue1\0"
+ "LightSteelBlue2\0"
+ "LightSteelBlue3\0"
+ "LightSteelBlue4\0"
+ "LightYellow\0"
+ "LightYellow1\0"
+ "LightYellow2\0"
+ "LightYellow3\0"
+ "LightYellow4\0"
+ "lime green\0"
+ "LimeGreen\0"
+ "linen\0"
+ "magenta\0"
+ "magenta1\0"
+ "magenta2\0"
+ "magenta3\0"
+ "magenta4\0"
+ "maroon\0"
+ "maroon1\0"
+ "maroon2\0"
+ "maroon3\0"
+ "maroon4\0"
+ "medium aquamarine\0"
+ "medium blue\0"
+ "medium orchid\0"
+ "medium purple\0"
+ "medium sea green\0"
+ "medium slate blue\0"
+ "medium spring green\0"
+ "medium turquoise\0"
+ "medium violet red\0"
+ "MediumAquamarine\0"
+ "MediumBlue\0"
+ "MediumOrchid\0"
+ "MediumOrchid1\0"
+ "MediumOrchid2\0"
+ "MediumOrchid3\0"
+ "MediumOrchid4\0"
+ "MediumPurple\0"
+ "MediumPurple1\0"
+ "MediumPurple2\0"
+ "MediumPurple3\0"
+ "MediumPurple4\0"
+ "MediumSeaGreen\0"
+ "MediumSlateBlue\0"
+ "MediumSpringGreen\0"
+ "MediumTurquoise\0"
+ "MediumVioletRed\0"
+ "midnight blue\0"
+ "MidnightBlue\0"
+ "mint cream\0"
+ "MintCream\0"
+ "misty rose\0"
+ "MistyRose\0"
+ "MistyRose1\0"
+ "MistyRose2\0"
+ "MistyRose3\0"
+ "MistyRose4\0"
+ "moccasin\0"
+ "navajo white\0"
+ "NavajoWhite\0"
+ "NavajoWhite1\0"
+ "NavajoWhite2\0"
+ "NavajoWhite3\0"
+ "NavajoWhite4\0"
+ "navy\0"
+ "navy blue\0"
+ "NavyBlue\0"
+ "old lace\0"
+ "OldLace\0"
+ "olive drab\0"
+ "OliveDrab\0"
+ "OliveDrab1\0"
+ "OliveDrab2\0"
+ "OliveDrab3\0"
+ "OliveDrab4\0"
+ "orange\0"
+ "orange red\0"
+ "orange1\0"
+ "orange2\0"
+ "orange3\0"
+ "orange4\0"
+ "OrangeRed\0"
+ "OrangeRed1\0"
+ "OrangeRed2\0"
+ "OrangeRed3\0"
+ "OrangeRed4\0"
+ "orchid\0"
+ "orchid1\0"
+ "orchid2\0"
+ "orchid3\0"
+ "orchid4\0"
+ "pale goldenrod\0"
+ "pale green\0"
+ "pale turquoise\0"
+ "pale violet red\0"
+ "PaleGoldenrod\0"
+ "PaleGreen\0"
+ "PaleGreen1\0"
+ "PaleGreen2\0"
+ "PaleGreen3\0"
+ "PaleGreen4\0"
+ "PaleTurquoise\0"
+ "PaleTurquoise1\0"
+ "PaleTurquoise2\0"
+ "PaleTurquoise3\0"
+ "PaleTurquoise4\0"
+ "PaleVioletRed\0"
+ "PaleVioletRed1\0"
+ "PaleVioletRed2\0"
+ "PaleVioletRed3\0"
+ "PaleVioletRed4\0"
+ "papaya whip\0"
+ "PapayaWhip\0"
+ "peach puff\0"
+ "PeachPuff\0"
+ "PeachPuff1\0"
+ "PeachPuff2\0"
+ "PeachPuff3\0"
+ "PeachPuff4\0"
+ "peru\0"
+ "pink\0"
+ "pink1\0"
+ "pink2\0"
+ "pink3\0"
+ "pink4\0"
+ "plum\0"
+ "plum1\0"
+ "plum2\0"
+ "plum3\0"
+ "plum4\0"
+ "powder blue\0"
+ "PowderBlue\0"
+ "purple\0"
+ "purple1\0"
+ "purple2\0"
+ "purple3\0"
+ "purple4\0"
+ "red\0"
+ "red1\0"
+ "red2\0"
+ "red3\0"
+ "red4\0"
+ "rosy brown\0"
+ "RosyBrown\0"
+ "RosyBrown1\0"
+ "RosyBrown2\0"
+ "RosyBrown3\0"
+ "RosyBrown4\0"
+ "royal blue\0"
+ "RoyalBlue\0"
+ "RoyalBlue1\0"
+ "RoyalBlue2\0"
+ "RoyalBlue3\0"
+ "RoyalBlue4\0"
+ "saddle brown\0"
+ "SaddleBrown\0"
+ "salmon\0"
+ "salmon1\0"
+ "salmon2\0"
+ "salmon3\0"
+ "salmon4\0"
+ "sandy brown\0"
+ "SandyBrown\0"
+ "sea green\0"
+ "SeaGreen\0"
+ "SeaGreen1\0"
+ "SeaGreen2\0"
+ "SeaGreen3\0"
+ "SeaGreen4\0"
+ "seashell\0"
+ "seashell1\0"
+ "seashell2\0"
+ "seashell3\0"
+ "seashell4\0"
+ "sienna\0"
+ "sienna1\0"
+ "sienna2\0"
+ "sienna3\0"
+ "sienna4\0"
+ "sky blue\0"
+ "SkyBlue\0"
+ "SkyBlue1\0"
+ "SkyBlue2\0"
+ "SkyBlue3\0"
+ "SkyBlue4\0"
+ "slate blue\0"
+ "slate gray\0"
+ "slate grey\0"
+ "SlateBlue\0"
+ "SlateBlue1\0"
+ "SlateBlue2\0"
+ "SlateBlue3\0"
+ "SlateBlue4\0"
+ "SlateGray\0"
+ "SlateGray1\0"
+ "SlateGray2\0"
+ "SlateGray3\0"
+ "SlateGray4\0"
+ "SlateGrey\0"
+ "snow\0"
+ "snow1\0"
+ "snow2\0"
+ "snow3\0"
+ "snow4\0"
+ "spring green\0"
+ "SpringGreen\0"
+ "SpringGreen1\0"
+ "SpringGreen2\0"
+ "SpringGreen3\0"
+ "SpringGreen4\0"
+ "steel blue\0"
+ "SteelBlue\0"
+ "SteelBlue1\0"
+ "SteelBlue2\0"
+ "SteelBlue3\0"
+ "SteelBlue4\0"
+ "tan\0"
+ "tan1\0"
+ "tan2\0"
+ "tan3\0"
+ "tan4\0"
+ "thistle\0"
+ "thistle1\0"
+ "thistle2\0"
+ "thistle3\0"
+ "thistle4\0"
+ "tomato\0"
+ "tomato1\0"
+ "tomato2\0"
+ "tomato3\0"
+ "tomato4\0"
+ "turquoise\0"
+ "turquoise1\0"
+ "turquoise2\0"
+ "turquoise3\0"
+ "turquoise4\0"
+ "violet\0"
+ "violet red\0"
+ "VioletRed\0"
+ "VioletRed1\0"
+ "VioletRed2\0"
+ "VioletRed3\0"
+ "VioletRed4\0"
+ "wheat\0"
+ "wheat1\0"
+ "wheat2\0"
+ "wheat3\0"
+ "wheat4\0"
+ "white\0"
+ "white smoke\0"
+ "WhiteSmoke\0"
+ "yellow\0"
+ "yellow green\0"
+ "yellow1\0" "yellow2\0" "yellow3\0" "yellow4\0" "YellowGreen\0"
};
static const BuiltinColor BuiltinColors[] = {
- { 240, 248, 255, 0 }, /* alice blue */
- { 240, 248, 255, 11 }, /* AliceBlue */
- { 250, 235, 215, 21 }, /* antique white */
- { 250, 235, 215, 35 }, /* AntiqueWhite */
- { 255, 239, 219, 48 }, /* AntiqueWhite1 */
- { 238, 223, 204, 62 }, /* AntiqueWhite2 */
- { 205, 192, 176, 76 }, /* AntiqueWhite3 */
- { 139, 131, 120, 90 }, /* AntiqueWhite4 */
- { 127, 255, 212, 104 }, /* aquamarine */
- { 127, 255, 212, 115 }, /* aquamarine1 */
- { 118, 238, 198, 127 }, /* aquamarine2 */
- { 102, 205, 170, 139 }, /* aquamarine3 */
- { 69, 139, 116, 151 }, /* aquamarine4 */
- { 240, 255, 255, 163 }, /* azure */
- { 240, 255, 255, 169 }, /* azure1 */
- { 224, 238, 238, 176 }, /* azure2 */
- { 193, 205, 205, 183 }, /* azure3 */
- { 131, 139, 139, 190 }, /* azure4 */
- { 245, 245, 220, 197 }, /* beige */
- { 255, 228, 196, 203 }, /* bisque */
- { 255, 228, 196, 210 }, /* bisque1 */
- { 238, 213, 183, 218 }, /* bisque2 */
- { 205, 183, 158, 226 }, /* bisque3 */
- { 139, 125, 107, 234 }, /* bisque4 */
- { 0, 0, 0, 242 }, /* black */
- { 255, 235, 205, 248 }, /* blanched almond */
- { 255, 235, 205, 264 }, /* BlanchedAlmond */
- { 0, 0, 255, 279 }, /* blue */
- { 138, 43, 226, 284 }, /* blue violet */
- { 0, 0, 255, 296 }, /* blue1 */
- { 0, 0, 238, 302 }, /* blue2 */
- { 0, 0, 205, 308 }, /* blue3 */
- { 0, 0, 139, 314 }, /* blue4 */
- { 138, 43, 226, 320 }, /* BlueViolet */
- { 165, 42, 42, 331 }, /* brown */
- { 255, 64, 64, 337 }, /* brown1 */
- { 238, 59, 59, 344 }, /* brown2 */
- { 205, 51, 51, 351 }, /* brown3 */
- { 139, 35, 35, 358 }, /* brown4 */
- { 222, 184, 135, 365 }, /* burlywood */
- { 255, 211, 155, 375 }, /* burlywood1 */
- { 238, 197, 145, 386 }, /* burlywood2 */
- { 205, 170, 125, 397 }, /* burlywood3 */
- { 139, 115, 85, 408 }, /* burlywood4 */
- { 95, 158, 160, 419 }, /* cadet blue */
- { 95, 158, 160, 430 }, /* CadetBlue */
- { 152, 245, 255, 440 }, /* CadetBlue1 */
- { 142, 229, 238, 451 }, /* CadetBlue2 */
- { 122, 197, 205, 462 }, /* CadetBlue3 */
- { 83, 134, 139, 473 }, /* CadetBlue4 */
- { 127, 255, 0, 484 }, /* chartreuse */
- { 127, 255, 0, 495 }, /* chartreuse1 */
- { 118, 238, 0, 507 }, /* chartreuse2 */
- { 102, 205, 0, 519 }, /* chartreuse3 */
- { 69, 139, 0, 531 }, /* chartreuse4 */
- { 210, 105, 30, 543 }, /* chocolate */
- { 255, 127, 36, 553 }, /* chocolate1 */
- { 238, 118, 33, 564 }, /* chocolate2 */
- { 205, 102, 29, 575 }, /* chocolate3 */
- { 139, 69, 19, 586 }, /* chocolate4 */
- { 255, 127, 80, 597 }, /* coral */
- { 255, 114, 86, 603 }, /* coral1 */
- { 238, 106, 80, 610 }, /* coral2 */
- { 205, 91, 69, 617 }, /* coral3 */
- { 139, 62, 47, 624 }, /* coral4 */
- { 100, 149, 237, 631 }, /* cornflower blue */
- { 100, 149, 237, 647 }, /* CornflowerBlue */
- { 255, 248, 220, 662 }, /* cornsilk */
- { 255, 248, 220, 671 }, /* cornsilk1 */
- { 238, 232, 205, 681 }, /* cornsilk2 */
- { 205, 200, 177, 691 }, /* cornsilk3 */
- { 139, 136, 120, 701 }, /* cornsilk4 */
- { 0, 255, 255, 711 }, /* cyan */
- { 0, 255, 255, 716 }, /* cyan1 */
- { 0, 238, 238, 722 }, /* cyan2 */
- { 0, 205, 205, 728 }, /* cyan3 */
- { 0, 139, 139, 734 }, /* cyan4 */
- { 0, 0, 139, 740 }, /* dark blue */
- { 0, 139, 139, 750 }, /* dark cyan */
- { 184, 134, 11, 760 }, /* dark goldenrod */
- { 169, 169, 169, 775 }, /* dark gray */
- { 0, 100, 0, 785 }, /* dark green */
- { 169, 169, 169, 796 }, /* dark grey */
- { 189, 183, 107, 806 }, /* dark khaki */
- { 139, 0, 139, 817 }, /* dark magenta */
- { 85, 107, 47, 830 }, /* dark olive green */
- { 255, 140, 0, 847 }, /* dark orange */
- { 153, 50, 204, 859 }, /* dark orchid */
- { 139, 0, 0, 871 }, /* dark red */
- { 233, 150, 122, 880 }, /* dark salmon */
- { 143, 188, 143, 892 }, /* dark sea green */
- { 72, 61, 139, 907 }, /* dark slate blue */
- { 47, 79, 79, 923 }, /* dark slate gray */
- { 47, 79, 79, 939 }, /* dark slate grey */
- { 0, 206, 209, 955 }, /* dark turquoise */
- { 148, 0, 211, 970 }, /* dark violet */
- { 0, 0, 139, 982 }, /* DarkBlue */
- { 0, 139, 139, 991 }, /* DarkCyan */
- { 184, 134, 11, 1000 }, /* DarkGoldenrod */
- { 255, 185, 15, 1014 }, /* DarkGoldenrod1 */
- { 238, 173, 14, 1029 }, /* DarkGoldenrod2 */
- { 205, 149, 12, 1044 }, /* DarkGoldenrod3 */
- { 139, 101, 8, 1059 }, /* DarkGoldenrod4 */
- { 169, 169, 169, 1074 }, /* DarkGray */
- { 0, 100, 0, 1083 }, /* DarkGreen */
- { 169, 169, 169, 1093 }, /* DarkGrey */
- { 189, 183, 107, 1102 }, /* DarkKhaki */
- { 139, 0, 139, 1112 }, /* DarkMagenta */
- { 85, 107, 47, 1124 }, /* DarkOliveGreen */
- { 202, 255, 112, 1139 }, /* DarkOliveGreen1 */
- { 188, 238, 104, 1155 }, /* DarkOliveGreen2 */
- { 162, 205, 90, 1171 }, /* DarkOliveGreen3 */
- { 110, 139, 61, 1187 }, /* DarkOliveGreen4 */
- { 255, 140, 0, 1203 }, /* DarkOrange */
- { 255, 127, 0, 1214 }, /* DarkOrange1 */
- { 238, 118, 0, 1226 }, /* DarkOrange2 */
- { 205, 102, 0, 1238 }, /* DarkOrange3 */
- { 139, 69, 0, 1250 }, /* DarkOrange4 */
- { 153, 50, 204, 1262 }, /* DarkOrchid */
- { 191, 62, 255, 1273 }, /* DarkOrchid1 */
- { 178, 58, 238, 1285 }, /* DarkOrchid2 */
- { 154, 50, 205, 1297 }, /* DarkOrchid3 */
- { 104, 34, 139, 1309 }, /* DarkOrchid4 */
- { 139, 0, 0, 1321 }, /* DarkRed */
- { 233, 150, 122, 1329 }, /* DarkSalmon */
- { 143, 188, 143, 1340 }, /* DarkSeaGreen */
- { 193, 255, 193, 1353 }, /* DarkSeaGreen1 */
- { 180, 238, 180, 1367 }, /* DarkSeaGreen2 */
- { 155, 205, 155, 1381 }, /* DarkSeaGreen3 */
- { 105, 139, 105, 1395 }, /* DarkSeaGreen4 */
- { 72, 61, 139, 1409 }, /* DarkSlateBlue */
- { 47, 79, 79, 1423 }, /* DarkSlateGray */
- { 151, 255, 255, 1437 }, /* DarkSlateGray1 */
- { 141, 238, 238, 1452 }, /* DarkSlateGray2 */
- { 121, 205, 205, 1467 }, /* DarkSlateGray3 */
- { 82, 139, 139, 1482 }, /* DarkSlateGray4 */
- { 47, 79, 79, 1497 }, /* DarkSlateGrey */
- { 0, 206, 209, 1511 }, /* DarkTurquoise */
- { 148, 0, 211, 1525 }, /* DarkViolet */
- { 255, 20, 147, 1536 }, /* deep pink */
- { 0, 191, 255, 1546 }, /* deep sky blue */
- { 255, 20, 147, 1560 }, /* DeepPink */
- { 255, 20, 147, 1569 }, /* DeepPink1 */
- { 238, 18, 137, 1579 }, /* DeepPink2 */
- { 205, 16, 118, 1589 }, /* DeepPink3 */
- { 139, 10, 80, 1599 }, /* DeepPink4 */
- { 0, 191, 255, 1609 }, /* DeepSkyBlue */
- { 0, 191, 255, 1621 }, /* DeepSkyBlue1 */
- { 0, 178, 238, 1634 }, /* DeepSkyBlue2 */
- { 0, 154, 205, 1647 }, /* DeepSkyBlue3 */
- { 0, 104, 139, 1660 }, /* DeepSkyBlue4 */
- { 105, 105, 105, 1673 }, /* dim gray */
- { 105, 105, 105, 1682 }, /* dim grey */
- { 105, 105, 105, 1691 }, /* DimGray */
- { 105, 105, 105, 1699 }, /* DimGrey */
- { 30, 144, 255, 1707 }, /* dodger blue */
- { 30, 144, 255, 1719 }, /* DodgerBlue */
- { 30, 144, 255, 1730 }, /* DodgerBlue1 */
- { 28, 134, 238, 1742 }, /* DodgerBlue2 */
- { 24, 116, 205, 1754 }, /* DodgerBlue3 */
- { 16, 78, 139, 1766 }, /* DodgerBlue4 */
- { 178, 34, 34, 1778 }, /* firebrick */
- { 255, 48, 48, 1788 }, /* firebrick1 */
- { 238, 44, 44, 1799 }, /* firebrick2 */
- { 205, 38, 38, 1810 }, /* firebrick3 */
- { 139, 26, 26, 1821 }, /* firebrick4 */
- { 255, 250, 240, 1832 }, /* floral white */
- { 255, 250, 240, 1845 }, /* FloralWhite */
- { 34, 139, 34, 1857 }, /* forest green */
- { 34, 139, 34, 1870 }, /* ForestGreen */
- { 220, 220, 220, 1882 }, /* gainsboro */
- { 248, 248, 255, 1892 }, /* ghost white */
- { 248, 248, 255, 1904 }, /* GhostWhite */
- { 255, 215, 0, 1915 }, /* gold */
- { 255, 215, 0, 1920 }, /* gold1 */
- { 238, 201, 0, 1926 }, /* gold2 */
- { 205, 173, 0, 1932 }, /* gold3 */
- { 139, 117, 0, 1938 }, /* gold4 */
- { 218, 165, 32, 1944 }, /* goldenrod */
- { 255, 193, 37, 1954 }, /* goldenrod1 */
- { 238, 180, 34, 1965 }, /* goldenrod2 */
- { 205, 155, 29, 1976 }, /* goldenrod3 */
- { 139, 105, 20, 1987 }, /* goldenrod4 */
- { 190, 190, 190, 1998 }, /* gray */
- { 0, 0, 0, 2003 }, /* gray0 */
- { 3, 3, 3, 2009 }, /* gray1 */
- { 26, 26, 26, 2015 }, /* gray10 */
- { 255, 255, 255, 2022 }, /* gray100 */
- { 28, 28, 28, 2030 }, /* gray11 */
- { 31, 31, 31, 2037 }, /* gray12 */
- { 33, 33, 33, 2044 }, /* gray13 */
- { 36, 36, 36, 2051 }, /* gray14 */
- { 38, 38, 38, 2058 }, /* gray15 */
- { 41, 41, 41, 2065 }, /* gray16 */
- { 43, 43, 43, 2072 }, /* gray17 */
- { 46, 46, 46, 2079 }, /* gray18 */
- { 48, 48, 48, 2086 }, /* gray19 */
- { 5, 5, 5, 2093 }, /* gray2 */
- { 51, 51, 51, 2099 }, /* gray20 */
- { 54, 54, 54, 2106 }, /* gray21 */
- { 56, 56, 56, 2113 }, /* gray22 */
- { 59, 59, 59, 2120 }, /* gray23 */
- { 61, 61, 61, 2127 }, /* gray24 */
- { 64, 64, 64, 2134 }, /* gray25 */
- { 66, 66, 66, 2141 }, /* gray26 */
- { 69, 69, 69, 2148 }, /* gray27 */
- { 71, 71, 71, 2155 }, /* gray28 */
- { 74, 74, 74, 2162 }, /* gray29 */
- { 8, 8, 8, 2169 }, /* gray3 */
- { 77, 77, 77, 2175 }, /* gray30 */
- { 79, 79, 79, 2182 }, /* gray31 */
- { 82, 82, 82, 2189 }, /* gray32 */
- { 84, 84, 84, 2196 }, /* gray33 */
- { 87, 87, 87, 2203 }, /* gray34 */
- { 89, 89, 89, 2210 }, /* gray35 */
- { 92, 92, 92, 2217 }, /* gray36 */
- { 94, 94, 94, 2224 }, /* gray37 */
- { 97, 97, 97, 2231 }, /* gray38 */
- { 99, 99, 99, 2238 }, /* gray39 */
- { 10, 10, 10, 2245 }, /* gray4 */
- { 102, 102, 102, 2251 }, /* gray40 */
- { 105, 105, 105, 2258 }, /* gray41 */
- { 107, 107, 107, 2265 }, /* gray42 */
- { 110, 110, 110, 2272 }, /* gray43 */
- { 112, 112, 112, 2279 }, /* gray44 */
- { 115, 115, 115, 2286 }, /* gray45 */
- { 117, 117, 117, 2293 }, /* gray46 */
- { 120, 120, 120, 2300 }, /* gray47 */
- { 122, 122, 122, 2307 }, /* gray48 */
- { 125, 125, 125, 2314 }, /* gray49 */
- { 13, 13, 13, 2321 }, /* gray5 */
- { 127, 127, 127, 2327 }, /* gray50 */
- { 130, 130, 130, 2334 }, /* gray51 */
- { 133, 133, 133, 2341 }, /* gray52 */
- { 135, 135, 135, 2348 }, /* gray53 */
- { 138, 138, 138, 2355 }, /* gray54 */
- { 140, 140, 140, 2362 }, /* gray55 */
- { 143, 143, 143, 2369 }, /* gray56 */
- { 145, 145, 145, 2376 }, /* gray57 */
- { 148, 148, 148, 2383 }, /* gray58 */
- { 150, 150, 150, 2390 }, /* gray59 */
- { 15, 15, 15, 2397 }, /* gray6 */
- { 153, 153, 153, 2403 }, /* gray60 */
- { 156, 156, 156, 2410 }, /* gray61 */
- { 158, 158, 158, 2417 }, /* gray62 */
- { 161, 161, 161, 2424 }, /* gray63 */
- { 163, 163, 163, 2431 }, /* gray64 */
- { 166, 166, 166, 2438 }, /* gray65 */
- { 168, 168, 168, 2445 }, /* gray66 */
- { 171, 171, 171, 2452 }, /* gray67 */
- { 173, 173, 173, 2459 }, /* gray68 */
- { 176, 176, 176, 2466 }, /* gray69 */
- { 18, 18, 18, 2473 }, /* gray7 */
- { 179, 179, 179, 2479 }, /* gray70 */
- { 181, 181, 181, 2486 }, /* gray71 */
- { 184, 184, 184, 2493 }, /* gray72 */
- { 186, 186, 186, 2500 }, /* gray73 */
- { 189, 189, 189, 2507 }, /* gray74 */
- { 191, 191, 191, 2514 }, /* gray75 */
- { 194, 194, 194, 2521 }, /* gray76 */
- { 196, 196, 196, 2528 }, /* gray77 */
- { 199, 199, 199, 2535 }, /* gray78 */
- { 201, 201, 201, 2542 }, /* gray79 */
- { 20, 20, 20, 2549 }, /* gray8 */
- { 204, 204, 204, 2555 }, /* gray80 */
- { 207, 207, 207, 2562 }, /* gray81 */
- { 209, 209, 209, 2569 }, /* gray82 */
- { 212, 212, 212, 2576 }, /* gray83 */
- { 214, 214, 214, 2583 }, /* gray84 */
- { 217, 217, 217, 2590 }, /* gray85 */
- { 219, 219, 219, 2597 }, /* gray86 */
- { 222, 222, 222, 2604 }, /* gray87 */
- { 224, 224, 224, 2611 }, /* gray88 */
- { 227, 227, 227, 2618 }, /* gray89 */
- { 23, 23, 23, 2625 }, /* gray9 */
- { 229, 229, 229, 2631 }, /* gray90 */
- { 232, 232, 232, 2638 }, /* gray91 */
- { 235, 235, 235, 2645 }, /* gray92 */
- { 237, 237, 237, 2652 }, /* gray93 */
- { 240, 240, 240, 2659 }, /* gray94 */
- { 242, 242, 242, 2666 }, /* gray95 */
- { 245, 245, 245, 2673 }, /* gray96 */
- { 247, 247, 247, 2680 }, /* gray97 */
- { 250, 250, 250, 2687 }, /* gray98 */
- { 252, 252, 252, 2694 }, /* gray99 */
- { 0, 255, 0, 2701 }, /* green */
- { 173, 255, 47, 2707 }, /* green yellow */
- { 0, 255, 0, 2720 }, /* green1 */
- { 0, 238, 0, 2727 }, /* green2 */
- { 0, 205, 0, 2734 }, /* green3 */
- { 0, 139, 0, 2741 }, /* green4 */
- { 173, 255, 47, 2748 }, /* GreenYellow */
- { 190, 190, 190, 2760 }, /* grey */
- { 0, 0, 0, 2765 }, /* grey0 */
- { 3, 3, 3, 2771 }, /* grey1 */
- { 26, 26, 26, 2777 }, /* grey10 */
- { 255, 255, 255, 2784 }, /* grey100 */
- { 28, 28, 28, 2792 }, /* grey11 */
- { 31, 31, 31, 2799 }, /* grey12 */
- { 33, 33, 33, 2806 }, /* grey13 */
- { 36, 36, 36, 2813 }, /* grey14 */
- { 38, 38, 38, 2820 }, /* grey15 */
- { 41, 41, 41, 2827 }, /* grey16 */
- { 43, 43, 43, 2834 }, /* grey17 */
- { 46, 46, 46, 2841 }, /* grey18 */
- { 48, 48, 48, 2848 }, /* grey19 */
- { 5, 5, 5, 2855 }, /* grey2 */
- { 51, 51, 51, 2861 }, /* grey20 */
- { 54, 54, 54, 2868 }, /* grey21 */
- { 56, 56, 56, 2875 }, /* grey22 */
- { 59, 59, 59, 2882 }, /* grey23 */
- { 61, 61, 61, 2889 }, /* grey24 */
- { 64, 64, 64, 2896 }, /* grey25 */
- { 66, 66, 66, 2903 }, /* grey26 */
- { 69, 69, 69, 2910 }, /* grey27 */
- { 71, 71, 71, 2917 }, /* grey28 */
- { 74, 74, 74, 2924 }, /* grey29 */
- { 8, 8, 8, 2931 }, /* grey3 */
- { 77, 77, 77, 2937 }, /* grey30 */
- { 79, 79, 79, 2944 }, /* grey31 */
- { 82, 82, 82, 2951 }, /* grey32 */
- { 84, 84, 84, 2958 }, /* grey33 */
- { 87, 87, 87, 2965 }, /* grey34 */
- { 89, 89, 89, 2972 }, /* grey35 */
- { 92, 92, 92, 2979 }, /* grey36 */
- { 94, 94, 94, 2986 }, /* grey37 */
- { 97, 97, 97, 2993 }, /* grey38 */
- { 99, 99, 99, 3000 }, /* grey39 */
- { 10, 10, 10, 3007 }, /* grey4 */
- { 102, 102, 102, 3013 }, /* grey40 */
- { 105, 105, 105, 3020 }, /* grey41 */
- { 107, 107, 107, 3027 }, /* grey42 */
- { 110, 110, 110, 3034 }, /* grey43 */
- { 112, 112, 112, 3041 }, /* grey44 */
- { 115, 115, 115, 3048 }, /* grey45 */
- { 117, 117, 117, 3055 }, /* grey46 */
- { 120, 120, 120, 3062 }, /* grey47 */
- { 122, 122, 122, 3069 }, /* grey48 */
- { 125, 125, 125, 3076 }, /* grey49 */
- { 13, 13, 13, 3083 }, /* grey5 */
- { 127, 127, 127, 3089 }, /* grey50 */
- { 130, 130, 130, 3096 }, /* grey51 */
- { 133, 133, 133, 3103 }, /* grey52 */
- { 135, 135, 135, 3110 }, /* grey53 */
- { 138, 138, 138, 3117 }, /* grey54 */
- { 140, 140, 140, 3124 }, /* grey55 */
- { 143, 143, 143, 3131 }, /* grey56 */
- { 145, 145, 145, 3138 }, /* grey57 */
- { 148, 148, 148, 3145 }, /* grey58 */
- { 150, 150, 150, 3152 }, /* grey59 */
- { 15, 15, 15, 3159 }, /* grey6 */
- { 153, 153, 153, 3165 }, /* grey60 */
- { 156, 156, 156, 3172 }, /* grey61 */
- { 158, 158, 158, 3179 }, /* grey62 */
- { 161, 161, 161, 3186 }, /* grey63 */
- { 163, 163, 163, 3193 }, /* grey64 */
- { 166, 166, 166, 3200 }, /* grey65 */
- { 168, 168, 168, 3207 }, /* grey66 */
- { 171, 171, 171, 3214 }, /* grey67 */
- { 173, 173, 173, 3221 }, /* grey68 */
- { 176, 176, 176, 3228 }, /* grey69 */
- { 18, 18, 18, 3235 }, /* grey7 */
- { 179, 179, 179, 3241 }, /* grey70 */
- { 181, 181, 181, 3248 }, /* grey71 */
- { 184, 184, 184, 3255 }, /* grey72 */
- { 186, 186, 186, 3262 }, /* grey73 */
- { 189, 189, 189, 3269 }, /* grey74 */
- { 191, 191, 191, 3276 }, /* grey75 */
- { 194, 194, 194, 3283 }, /* grey76 */
- { 196, 196, 196, 3290 }, /* grey77 */
- { 199, 199, 199, 3297 }, /* grey78 */
- { 201, 201, 201, 3304 }, /* grey79 */
- { 20, 20, 20, 3311 }, /* grey8 */
- { 204, 204, 204, 3317 }, /* grey80 */
- { 207, 207, 207, 3324 }, /* grey81 */
- { 209, 209, 209, 3331 }, /* grey82 */
- { 212, 212, 212, 3338 }, /* grey83 */
- { 214, 214, 214, 3345 }, /* grey84 */
- { 217, 217, 217, 3352 }, /* grey85 */
- { 219, 219, 219, 3359 }, /* grey86 */
- { 222, 222, 222, 3366 }, /* grey87 */
- { 224, 224, 224, 3373 }, /* grey88 */
- { 227, 227, 227, 3380 }, /* grey89 */
- { 23, 23, 23, 3387 }, /* grey9 */
- { 229, 229, 229, 3393 }, /* grey90 */
- { 232, 232, 232, 3400 }, /* grey91 */
- { 235, 235, 235, 3407 }, /* grey92 */
- { 237, 237, 237, 3414 }, /* grey93 */
- { 240, 240, 240, 3421 }, /* grey94 */
- { 242, 242, 242, 3428 }, /* grey95 */
- { 245, 245, 245, 3435 }, /* grey96 */
- { 247, 247, 247, 3442 }, /* grey97 */
- { 250, 250, 250, 3449 }, /* grey98 */
- { 252, 252, 252, 3456 }, /* grey99 */
- { 240, 255, 240, 3463 }, /* honeydew */
- { 240, 255, 240, 3472 }, /* honeydew1 */
- { 224, 238, 224, 3482 }, /* honeydew2 */
- { 193, 205, 193, 3492 }, /* honeydew3 */
- { 131, 139, 131, 3502 }, /* honeydew4 */
- { 255, 105, 180, 3512 }, /* hot pink */
- { 255, 105, 180, 3521 }, /* HotPink */
- { 255, 110, 180, 3529 }, /* HotPink1 */
- { 238, 106, 167, 3538 }, /* HotPink2 */
- { 205, 96, 144, 3547 }, /* HotPink3 */
- { 139, 58, 98, 3556 }, /* HotPink4 */
- { 205, 92, 92, 3565 }, /* indian red */
- { 205, 92, 92, 3576 }, /* IndianRed */
- { 255, 106, 106, 3586 }, /* IndianRed1 */
- { 238, 99, 99, 3597 }, /* IndianRed2 */
- { 205, 85, 85, 3608 }, /* IndianRed3 */
- { 139, 58, 58, 3619 }, /* IndianRed4 */
- { 255, 255, 240, 3630 }, /* ivory */
- { 255, 255, 240, 3636 }, /* ivory1 */
- { 238, 238, 224, 3643 }, /* ivory2 */
- { 205, 205, 193, 3650 }, /* ivory3 */
- { 139, 139, 131, 3657 }, /* ivory4 */
- { 240, 230, 140, 3664 }, /* khaki */
- { 255, 246, 143, 3670 }, /* khaki1 */
- { 238, 230, 133, 3677 }, /* khaki2 */
- { 205, 198, 115, 3684 }, /* khaki3 */
- { 139, 134, 78, 3691 }, /* khaki4 */
- { 230, 230, 250, 3698 }, /* lavender */
- { 255, 240, 245, 3707 }, /* lavender blush */
- { 255, 240, 245, 3722 }, /* LavenderBlush */
- { 255, 240, 245, 3736 }, /* LavenderBlush1 */
- { 238, 224, 229, 3751 }, /* LavenderBlush2 */
- { 205, 193, 197, 3766 }, /* LavenderBlush3 */
- { 139, 131, 134, 3781 }, /* LavenderBlush4 */
- { 124, 252, 0, 3796 }, /* lawn green */
- { 124, 252, 0, 3807 }, /* LawnGreen */
- { 255, 250, 205, 3817 }, /* lemon chiffon */
- { 255, 250, 205, 3831 }, /* LemonChiffon */
- { 255, 250, 205, 3844 }, /* LemonChiffon1 */
- { 238, 233, 191, 3858 }, /* LemonChiffon2 */
- { 205, 201, 165, 3872 }, /* LemonChiffon3 */
- { 139, 137, 112, 3886 }, /* LemonChiffon4 */
- { 173, 216, 230, 3900 }, /* light blue */
- { 240, 128, 128, 3911 }, /* light coral */
- { 224, 255, 255, 3923 }, /* light cyan */
- { 238, 221, 130, 3934 }, /* light goldenrod */
- { 250, 250, 210, 3950 }, /* light goldenrod yellow */
- { 211, 211, 211, 3973 }, /* light gray */
- { 144, 238, 144, 3984 }, /* light green */
- { 211, 211, 211, 3996 }, /* light grey */
- { 255, 182, 193, 4007 }, /* light pink */
- { 255, 160, 122, 4018 }, /* light salmon */
- { 32, 178, 170, 4031 }, /* light sea green */
- { 135, 206, 250, 4047 }, /* light sky blue */
- { 132, 112, 255, 4062 }, /* light slate blue */
- { 119, 136, 153, 4079 }, /* light slate gray */
- { 119, 136, 153, 4096 }, /* light slate grey */
- { 176, 196, 222, 4113 }, /* light steel blue */
- { 255, 255, 224, 4130 }, /* light yellow */
- { 173, 216, 230, 4143 }, /* LightBlue */
- { 191, 239, 255, 4153 }, /* LightBlue1 */
- { 178, 223, 238, 4164 }, /* LightBlue2 */
- { 154, 192, 205, 4175 }, /* LightBlue3 */
- { 104, 131, 139, 4186 }, /* LightBlue4 */
- { 240, 128, 128, 4197 }, /* LightCoral */
- { 224, 255, 255, 4208 }, /* LightCyan */
- { 224, 255, 255, 4218 }, /* LightCyan1 */
- { 209, 238, 238, 4229 }, /* LightCyan2 */
- { 180, 205, 205, 4240 }, /* LightCyan3 */
- { 122, 139, 139, 4251 }, /* LightCyan4 */
- { 238, 221, 130, 4262 }, /* LightGoldenrod */
- { 255, 236, 139, 4277 }, /* LightGoldenrod1 */
- { 238, 220, 130, 4293 }, /* LightGoldenrod2 */
- { 205, 190, 112, 4309 }, /* LightGoldenrod3 */
- { 139, 129, 76, 4325 }, /* LightGoldenrod4 */
- { 250, 250, 210, 4341 }, /* LightGoldenrodYellow */
- { 211, 211, 211, 4362 }, /* LightGray */
- { 144, 238, 144, 4372 }, /* LightGreen */
- { 211, 211, 211, 4383 }, /* LightGrey */
- { 255, 182, 193, 4393 }, /* LightPink */
- { 255, 174, 185, 4403 }, /* LightPink1 */
- { 238, 162, 173, 4414 }, /* LightPink2 */
- { 205, 140, 149, 4425 }, /* LightPink3 */
- { 139, 95, 101, 4436 }, /* LightPink4 */
- { 255, 160, 122, 4447 }, /* LightSalmon */
- { 255, 160, 122, 4459 }, /* LightSalmon1 */
- { 238, 149, 114, 4472 }, /* LightSalmon2 */
- { 205, 129, 98, 4485 }, /* LightSalmon3 */
- { 139, 87, 66, 4498 }, /* LightSalmon4 */
- { 32, 178, 170, 4511 }, /* LightSeaGreen */
- { 135, 206, 250, 4525 }, /* LightSkyBlue */
- { 176, 226, 255, 4538 }, /* LightSkyBlue1 */
- { 164, 211, 238, 4552 }, /* LightSkyBlue2 */
- { 141, 182, 205, 4566 }, /* LightSkyBlue3 */
- { 96, 123, 139, 4580 }, /* LightSkyBlue4 */
- { 132, 112, 255, 4594 }, /* LightSlateBlue */
- { 119, 136, 153, 4609 }, /* LightSlateGray */
- { 119, 136, 153, 4624 }, /* LightSlateGrey */
- { 176, 196, 222, 4639 }, /* LightSteelBlue */
- { 202, 225, 255, 4654 }, /* LightSteelBlue1 */
- { 188, 210, 238, 4670 }, /* LightSteelBlue2 */
- { 162, 181, 205, 4686 }, /* LightSteelBlue3 */
- { 110, 123, 139, 4702 }, /* LightSteelBlue4 */
- { 255, 255, 224, 4718 }, /* LightYellow */
- { 255, 255, 224, 4730 }, /* LightYellow1 */
- { 238, 238, 209, 4743 }, /* LightYellow2 */
- { 205, 205, 180, 4756 }, /* LightYellow3 */
- { 139, 139, 122, 4769 }, /* LightYellow4 */
- { 50, 205, 50, 4782 }, /* lime green */
- { 50, 205, 50, 4793 }, /* LimeGreen */
- { 250, 240, 230, 4803 }, /* linen */
- { 255, 0, 255, 4809 }, /* magenta */
- { 255, 0, 255, 4817 }, /* magenta1 */
- { 238, 0, 238, 4826 }, /* magenta2 */
- { 205, 0, 205, 4835 }, /* magenta3 */
- { 139, 0, 139, 4844 }, /* magenta4 */
- { 176, 48, 96, 4853 }, /* maroon */
- { 255, 52, 179, 4860 }, /* maroon1 */
- { 238, 48, 167, 4868 }, /* maroon2 */
- { 205, 41, 144, 4876 }, /* maroon3 */
- { 139, 28, 98, 4884 }, /* maroon4 */
- { 102, 205, 170, 4892 }, /* medium aquamarine */
- { 0, 0, 205, 4910 }, /* medium blue */
- { 186, 85, 211, 4922 }, /* medium orchid */
- { 147, 112, 219, 4936 }, /* medium purple */
- { 60, 179, 113, 4950 }, /* medium sea green */
- { 123, 104, 238, 4967 }, /* medium slate blue */
- { 0, 250, 154, 4985 }, /* medium spring green */
- { 72, 209, 204, 5005 }, /* medium turquoise */
- { 199, 21, 133, 5022 }, /* medium violet red */
- { 102, 205, 170, 5040 }, /* MediumAquamarine */
- { 0, 0, 205, 5057 }, /* MediumBlue */
- { 186, 85, 211, 5068 }, /* MediumOrchid */
- { 224, 102, 255, 5081 }, /* MediumOrchid1 */
- { 209, 95, 238, 5095 }, /* MediumOrchid2 */
- { 180, 82, 205, 5109 }, /* MediumOrchid3 */
- { 122, 55, 139, 5123 }, /* MediumOrchid4 */
- { 147, 112, 219, 5137 }, /* MediumPurple */
- { 171, 130, 255, 5150 }, /* MediumPurple1 */
- { 159, 121, 238, 5164 }, /* MediumPurple2 */
- { 137, 104, 205, 5178 }, /* MediumPurple3 */
- { 93, 71, 139, 5192 }, /* MediumPurple4 */
- { 60, 179, 113, 5206 }, /* MediumSeaGreen */
- { 123, 104, 238, 5221 }, /* MediumSlateBlue */
- { 0, 250, 154, 5237 }, /* MediumSpringGreen */
- { 72, 209, 204, 5255 }, /* MediumTurquoise */
- { 199, 21, 133, 5271 }, /* MediumVioletRed */
- { 25, 25, 112, 5287 }, /* midnight blue */
- { 25, 25, 112, 5301 }, /* MidnightBlue */
- { 245, 255, 250, 5314 }, /* mint cream */
- { 245, 255, 250, 5325 }, /* MintCream */
- { 255, 228, 225, 5335 }, /* misty rose */
- { 255, 228, 225, 5346 }, /* MistyRose */
- { 255, 228, 225, 5356 }, /* MistyRose1 */
- { 238, 213, 210, 5367 }, /* MistyRose2 */
- { 205, 183, 181, 5378 }, /* MistyRose3 */
- { 139, 125, 123, 5389 }, /* MistyRose4 */
- { 255, 228, 181, 5400 }, /* moccasin */
- { 255, 222, 173, 5409 }, /* navajo white */
- { 255, 222, 173, 5422 }, /* NavajoWhite */
- { 255, 222, 173, 5434 }, /* NavajoWhite1 */
- { 238, 207, 161, 5447 }, /* NavajoWhite2 */
- { 205, 179, 139, 5460 }, /* NavajoWhite3 */
- { 139, 121, 94, 5473 }, /* NavajoWhite4 */
- { 0, 0, 128, 5486 }, /* navy */
- { 0, 0, 128, 5491 }, /* navy blue */
- { 0, 0, 128, 5501 }, /* NavyBlue */
- { 253, 245, 230, 5510 }, /* old lace */
- { 253, 245, 230, 5519 }, /* OldLace */
- { 107, 142, 35, 5527 }, /* olive drab */
- { 107, 142, 35, 5538 }, /* OliveDrab */
- { 192, 255, 62, 5548 }, /* OliveDrab1 */
- { 179, 238, 58, 5559 }, /* OliveDrab2 */
- { 154, 205, 50, 5570 }, /* OliveDrab3 */
- { 105, 139, 34, 5581 }, /* OliveDrab4 */
- { 255, 165, 0, 5592 }, /* orange */
- { 255, 69, 0, 5599 }, /* orange red */
- { 255, 165, 0, 5610 }, /* orange1 */
- { 238, 154, 0, 5618 }, /* orange2 */
- { 205, 133, 0, 5626 }, /* orange3 */
- { 139, 90, 0, 5634 }, /* orange4 */
- { 255, 69, 0, 5642 }, /* OrangeRed */
- { 255, 69, 0, 5652 }, /* OrangeRed1 */
- { 238, 64, 0, 5663 }, /* OrangeRed2 */
- { 205, 55, 0, 5674 }, /* OrangeRed3 */
- { 139, 37, 0, 5685 }, /* OrangeRed4 */
- { 218, 112, 214, 5696 }, /* orchid */
- { 255, 131, 250, 5703 }, /* orchid1 */
- { 238, 122, 233, 5711 }, /* orchid2 */
- { 205, 105, 201, 5719 }, /* orchid3 */
- { 139, 71, 137, 5727 }, /* orchid4 */
- { 238, 232, 170, 5735 }, /* pale goldenrod */
- { 152, 251, 152, 5750 }, /* pale green */
- { 175, 238, 238, 5761 }, /* pale turquoise */
- { 219, 112, 147, 5776 }, /* pale violet red */
- { 238, 232, 170, 5792 }, /* PaleGoldenrod */
- { 152, 251, 152, 5806 }, /* PaleGreen */
- { 154, 255, 154, 5816 }, /* PaleGreen1 */
- { 144, 238, 144, 5827 }, /* PaleGreen2 */
- { 124, 205, 124, 5838 }, /* PaleGreen3 */
- { 84, 139, 84, 5849 }, /* PaleGreen4 */
- { 175, 238, 238, 5860 }, /* PaleTurquoise */
- { 187, 255, 255, 5874 }, /* PaleTurquoise1 */
- { 174, 238, 238, 5889 }, /* PaleTurquoise2 */
- { 150, 205, 205, 5904 }, /* PaleTurquoise3 */
- { 102, 139, 139, 5919 }, /* PaleTurquoise4 */
- { 219, 112, 147, 5934 }, /* PaleVioletRed */
- { 255, 130, 171, 5948 }, /* PaleVioletRed1 */
- { 238, 121, 159, 5963 }, /* PaleVioletRed2 */
- { 205, 104, 137, 5978 }, /* PaleVioletRed3 */
- { 139, 71, 93, 5993 }, /* PaleVioletRed4 */
- { 255, 239, 213, 6008 }, /* papaya whip */
- { 255, 239, 213, 6020 }, /* PapayaWhip */
- { 255, 218, 185, 6031 }, /* peach puff */
- { 255, 218, 185, 6042 }, /* PeachPuff */
- { 255, 218, 185, 6052 }, /* PeachPuff1 */
- { 238, 203, 173, 6063 }, /* PeachPuff2 */
- { 205, 175, 149, 6074 }, /* PeachPuff3 */
- { 139, 119, 101, 6085 }, /* PeachPuff4 */
- { 205, 133, 63, 6096 }, /* peru */
- { 255, 192, 203, 6101 }, /* pink */
- { 255, 181, 197, 6106 }, /* pink1 */
- { 238, 169, 184, 6112 }, /* pink2 */
- { 205, 145, 158, 6118 }, /* pink3 */
- { 139, 99, 108, 6124 }, /* pink4 */
- { 221, 160, 221, 6130 }, /* plum */
- { 255, 187, 255, 6135 }, /* plum1 */
- { 238, 174, 238, 6141 }, /* plum2 */
- { 205, 150, 205, 6147 }, /* plum3 */
- { 139, 102, 139, 6153 }, /* plum4 */
- { 176, 224, 230, 6159 }, /* powder blue */
- { 176, 224, 230, 6171 }, /* PowderBlue */
- { 160, 32, 240, 6182 }, /* purple */
- { 155, 48, 255, 6189 }, /* purple1 */
- { 145, 44, 238, 6197 }, /* purple2 */
- { 125, 38, 205, 6205 }, /* purple3 */
- { 85, 26, 139, 6213 }, /* purple4 */
- { 255, 0, 0, 6221 }, /* red */
- { 255, 0, 0, 6225 }, /* red1 */
- { 238, 0, 0, 6230 }, /* red2 */
- { 205, 0, 0, 6235 }, /* red3 */
- { 139, 0, 0, 6240 }, /* red4 */
- { 188, 143, 143, 6245 }, /* rosy brown */
- { 188, 143, 143, 6256 }, /* RosyBrown */
- { 255, 193, 193, 6266 }, /* RosyBrown1 */
- { 238, 180, 180, 6277 }, /* RosyBrown2 */
- { 205, 155, 155, 6288 }, /* RosyBrown3 */
- { 139, 105, 105, 6299 }, /* RosyBrown4 */
- { 65, 105, 225, 6310 }, /* royal blue */
- { 65, 105, 225, 6321 }, /* RoyalBlue */
- { 72, 118, 255, 6331 }, /* RoyalBlue1 */
- { 67, 110, 238, 6342 }, /* RoyalBlue2 */
- { 58, 95, 205, 6353 }, /* RoyalBlue3 */
- { 39, 64, 139, 6364 }, /* RoyalBlue4 */
- { 139, 69, 19, 6375 }, /* saddle brown */
- { 139, 69, 19, 6388 }, /* SaddleBrown */
- { 250, 128, 114, 6400 }, /* salmon */
- { 255, 140, 105, 6407 }, /* salmon1 */
- { 238, 130, 98, 6415 }, /* salmon2 */
- { 205, 112, 84, 6423 }, /* salmon3 */
- { 139, 76, 57, 6431 }, /* salmon4 */
- { 244, 164, 96, 6439 }, /* sandy brown */
- { 244, 164, 96, 6451 }, /* SandyBrown */
- { 46, 139, 87, 6462 }, /* sea green */
- { 46, 139, 87, 6472 }, /* SeaGreen */
- { 84, 255, 159, 6481 }, /* SeaGreen1 */
- { 78, 238, 148, 6491 }, /* SeaGreen2 */
- { 67, 205, 128, 6501 }, /* SeaGreen3 */
- { 46, 139, 87, 6511 }, /* SeaGreen4 */
- { 255, 245, 238, 6521 }, /* seashell */
- { 255, 245, 238, 6530 }, /* seashell1 */
- { 238, 229, 222, 6540 }, /* seashell2 */
- { 205, 197, 191, 6550 }, /* seashell3 */
- { 139, 134, 130, 6560 }, /* seashell4 */
- { 160, 82, 45, 6570 }, /* sienna */
- { 255, 130, 71, 6577 }, /* sienna1 */
- { 238, 121, 66, 6585 }, /* sienna2 */
- { 205, 104, 57, 6593 }, /* sienna3 */
- { 139, 71, 38, 6601 }, /* sienna4 */
- { 135, 206, 235, 6609 }, /* sky blue */
- { 135, 206, 235, 6618 }, /* SkyBlue */
- { 135, 206, 255, 6626 }, /* SkyBlue1 */
- { 126, 192, 238, 6635 }, /* SkyBlue2 */
- { 108, 166, 205, 6644 }, /* SkyBlue3 */
- { 74, 112, 139, 6653 }, /* SkyBlue4 */
- { 106, 90, 205, 6662 }, /* slate blue */
- { 112, 128, 144, 6673 }, /* slate gray */
- { 112, 128, 144, 6684 }, /* slate grey */
- { 106, 90, 205, 6695 }, /* SlateBlue */
- { 131, 111, 255, 6705 }, /* SlateBlue1 */
- { 122, 103, 238, 6716 }, /* SlateBlue2 */
- { 105, 89, 205, 6727 }, /* SlateBlue3 */
- { 71, 60, 139, 6738 }, /* SlateBlue4 */
- { 112, 128, 144, 6749 }, /* SlateGray */
- { 198, 226, 255, 6759 }, /* SlateGray1 */
- { 185, 211, 238, 6770 }, /* SlateGray2 */
- { 159, 182, 205, 6781 }, /* SlateGray3 */
- { 108, 123, 139, 6792 }, /* SlateGray4 */
- { 112, 128, 144, 6803 }, /* SlateGrey */
- { 255, 250, 250, 6813 }, /* snow */
- { 255, 250, 250, 6818 }, /* snow1 */
- { 238, 233, 233, 6824 }, /* snow2 */
- { 205, 201, 201, 6830 }, /* snow3 */
- { 139, 137, 137, 6836 }, /* snow4 */
- { 0, 255, 127, 6842 }, /* spring green */
- { 0, 255, 127, 6855 }, /* SpringGreen */
- { 0, 255, 127, 6867 }, /* SpringGreen1 */
- { 0, 238, 118, 6880 }, /* SpringGreen2 */
- { 0, 205, 102, 6893 }, /* SpringGreen3 */
- { 0, 139, 69, 6906 }, /* SpringGreen4 */
- { 70, 130, 180, 6919 }, /* steel blue */
- { 70, 130, 180, 6930 }, /* SteelBlue */
- { 99, 184, 255, 6940 }, /* SteelBlue1 */
- { 92, 172, 238, 6951 }, /* SteelBlue2 */
- { 79, 148, 205, 6962 }, /* SteelBlue3 */
- { 54, 100, 139, 6973 }, /* SteelBlue4 */
- { 210, 180, 140, 6984 }, /* tan */
- { 255, 165, 79, 6988 }, /* tan1 */
- { 238, 154, 73, 6993 }, /* tan2 */
- { 205, 133, 63, 6998 }, /* tan3 */
- { 139, 90, 43, 7003 }, /* tan4 */
- { 216, 191, 216, 7008 }, /* thistle */
- { 255, 225, 255, 7016 }, /* thistle1 */
- { 238, 210, 238, 7025 }, /* thistle2 */
- { 205, 181, 205, 7034 }, /* thistle3 */
- { 139, 123, 139, 7043 }, /* thistle4 */
- { 255, 99, 71, 7052 }, /* tomato */
- { 255, 99, 71, 7059 }, /* tomato1 */
- { 238, 92, 66, 7067 }, /* tomato2 */
- { 205, 79, 57, 7075 }, /* tomato3 */
- { 139, 54, 38, 7083 }, /* tomato4 */
- { 64, 224, 208, 7091 }, /* turquoise */
- { 0, 245, 255, 7101 }, /* turquoise1 */
- { 0, 229, 238, 7112 }, /* turquoise2 */
- { 0, 197, 205, 7123 }, /* turquoise3 */
- { 0, 134, 139, 7134 }, /* turquoise4 */
- { 238, 130, 238, 7145 }, /* violet */
- { 208, 32, 144, 7152 }, /* violet red */
- { 208, 32, 144, 7163 }, /* VioletRed */
- { 255, 62, 150, 7173 }, /* VioletRed1 */
- { 238, 58, 140, 7184 }, /* VioletRed2 */
- { 205, 50, 120, 7195 }, /* VioletRed3 */
- { 139, 34, 82, 7206 }, /* VioletRed4 */
- { 245, 222, 179, 7217 }, /* wheat */
- { 255, 231, 186, 7223 }, /* wheat1 */
- { 238, 216, 174, 7230 }, /* wheat2 */
- { 205, 186, 150, 7237 }, /* wheat3 */
- { 139, 126, 102, 7244 }, /* wheat4 */
- { 255, 255, 255, 7251 }, /* white */
- { 245, 245, 245, 7257 }, /* white smoke */
- { 245, 245, 245, 7269 }, /* WhiteSmoke */
- { 255, 255, 0, 7280 }, /* yellow */
- { 154, 205, 50, 7287 }, /* yellow green */
- { 255, 255, 0, 7300 }, /* yellow1 */
- { 238, 238, 0, 7308 }, /* yellow2 */
- { 205, 205, 0, 7316 }, /* yellow3 */
- { 139, 139, 0, 7324 }, /* yellow4 */
- { 154, 205, 50, 7332 }, /* YellowGreen */
+ {240, 248, 255, 0}, /* alice blue */
+ {240, 248, 255, 11}, /* AliceBlue */
+ {250, 235, 215, 21}, /* antique white */
+ {250, 235, 215, 35}, /* AntiqueWhite */
+ {255, 239, 219, 48}, /* AntiqueWhite1 */
+ {238, 223, 204, 62}, /* AntiqueWhite2 */
+ {205, 192, 176, 76}, /* AntiqueWhite3 */
+ {139, 131, 120, 90}, /* AntiqueWhite4 */
+ {127, 255, 212, 104}, /* aquamarine */
+ {127, 255, 212, 115}, /* aquamarine1 */
+ {118, 238, 198, 127}, /* aquamarine2 */
+ {102, 205, 170, 139}, /* aquamarine3 */
+ {69, 139, 116, 151}, /* aquamarine4 */
+ {240, 255, 255, 163}, /* azure */
+ {240, 255, 255, 169}, /* azure1 */
+ {224, 238, 238, 176}, /* azure2 */
+ {193, 205, 205, 183}, /* azure3 */
+ {131, 139, 139, 190}, /* azure4 */
+ {245, 245, 220, 197}, /* beige */
+ {255, 228, 196, 203}, /* bisque */
+ {255, 228, 196, 210}, /* bisque1 */
+ {238, 213, 183, 218}, /* bisque2 */
+ {205, 183, 158, 226}, /* bisque3 */
+ {139, 125, 107, 234}, /* bisque4 */
+ {0, 0, 0, 242}, /* black */
+ {255, 235, 205, 248}, /* blanched almond */
+ {255, 235, 205, 264}, /* BlanchedAlmond */
+ {0, 0, 255, 279}, /* blue */
+ {138, 43, 226, 284}, /* blue violet */
+ {0, 0, 255, 296}, /* blue1 */
+ {0, 0, 238, 302}, /* blue2 */
+ {0, 0, 205, 308}, /* blue3 */
+ {0, 0, 139, 314}, /* blue4 */
+ {138, 43, 226, 320}, /* BlueViolet */
+ {165, 42, 42, 331}, /* brown */
+ {255, 64, 64, 337}, /* brown1 */
+ {238, 59, 59, 344}, /* brown2 */
+ {205, 51, 51, 351}, /* brown3 */
+ {139, 35, 35, 358}, /* brown4 */
+ {222, 184, 135, 365}, /* burlywood */
+ {255, 211, 155, 375}, /* burlywood1 */
+ {238, 197, 145, 386}, /* burlywood2 */
+ {205, 170, 125, 397}, /* burlywood3 */
+ {139, 115, 85, 408}, /* burlywood4 */
+ {95, 158, 160, 419}, /* cadet blue */
+ {95, 158, 160, 430}, /* CadetBlue */
+ {152, 245, 255, 440}, /* CadetBlue1 */
+ {142, 229, 238, 451}, /* CadetBlue2 */
+ {122, 197, 205, 462}, /* CadetBlue3 */
+ {83, 134, 139, 473}, /* CadetBlue4 */
+ {127, 255, 0, 484}, /* chartreuse */
+ {127, 255, 0, 495}, /* chartreuse1 */
+ {118, 238, 0, 507}, /* chartreuse2 */
+ {102, 205, 0, 519}, /* chartreuse3 */
+ {69, 139, 0, 531}, /* chartreuse4 */
+ {210, 105, 30, 543}, /* chocolate */
+ {255, 127, 36, 553}, /* chocolate1 */
+ {238, 118, 33, 564}, /* chocolate2 */
+ {205, 102, 29, 575}, /* chocolate3 */
+ {139, 69, 19, 586}, /* chocolate4 */
+ {255, 127, 80, 597}, /* coral */
+ {255, 114, 86, 603}, /* coral1 */
+ {238, 106, 80, 610}, /* coral2 */
+ {205, 91, 69, 617}, /* coral3 */
+ {139, 62, 47, 624}, /* coral4 */
+ {100, 149, 237, 631}, /* cornflower blue */
+ {100, 149, 237, 647}, /* CornflowerBlue */
+ {255, 248, 220, 662}, /* cornsilk */
+ {255, 248, 220, 671}, /* cornsilk1 */
+ {238, 232, 205, 681}, /* cornsilk2 */
+ {205, 200, 177, 691}, /* cornsilk3 */
+ {139, 136, 120, 701}, /* cornsilk4 */
+ {0, 255, 255, 711}, /* cyan */
+ {0, 255, 255, 716}, /* cyan1 */
+ {0, 238, 238, 722}, /* cyan2 */
+ {0, 205, 205, 728}, /* cyan3 */
+ {0, 139, 139, 734}, /* cyan4 */
+ {0, 0, 139, 740}, /* dark blue */
+ {0, 139, 139, 750}, /* dark cyan */
+ {184, 134, 11, 760}, /* dark goldenrod */
+ {169, 169, 169, 775}, /* dark gray */
+ {0, 100, 0, 785}, /* dark green */
+ {169, 169, 169, 796}, /* dark grey */
+ {189, 183, 107, 806}, /* dark khaki */
+ {139, 0, 139, 817}, /* dark magenta */
+ {85, 107, 47, 830}, /* dark olive green */
+ {255, 140, 0, 847}, /* dark orange */
+ {153, 50, 204, 859}, /* dark orchid */
+ {139, 0, 0, 871}, /* dark red */
+ {233, 150, 122, 880}, /* dark salmon */
+ {143, 188, 143, 892}, /* dark sea green */
+ {72, 61, 139, 907}, /* dark slate blue */
+ {47, 79, 79, 923}, /* dark slate gray */
+ {47, 79, 79, 939}, /* dark slate grey */
+ {0, 206, 209, 955}, /* dark turquoise */
+ {148, 0, 211, 970}, /* dark violet */
+ {0, 0, 139, 982}, /* DarkBlue */
+ {0, 139, 139, 991}, /* DarkCyan */
+ {184, 134, 11, 1000}, /* DarkGoldenrod */
+ {255, 185, 15, 1014}, /* DarkGoldenrod1 */
+ {238, 173, 14, 1029}, /* DarkGoldenrod2 */
+ {205, 149, 12, 1044}, /* DarkGoldenrod3 */
+ {139, 101, 8, 1059}, /* DarkGoldenrod4 */
+ {169, 169, 169, 1074}, /* DarkGray */
+ {0, 100, 0, 1083}, /* DarkGreen */
+ {169, 169, 169, 1093}, /* DarkGrey */
+ {189, 183, 107, 1102}, /* DarkKhaki */
+ {139, 0, 139, 1112}, /* DarkMagenta */
+ {85, 107, 47, 1124}, /* DarkOliveGreen */
+ {202, 255, 112, 1139}, /* DarkOliveGreen1 */
+ {188, 238, 104, 1155}, /* DarkOliveGreen2 */
+ {162, 205, 90, 1171}, /* DarkOliveGreen3 */
+ {110, 139, 61, 1187}, /* DarkOliveGreen4 */
+ {255, 140, 0, 1203}, /* DarkOrange */
+ {255, 127, 0, 1214}, /* DarkOrange1 */
+ {238, 118, 0, 1226}, /* DarkOrange2 */
+ {205, 102, 0, 1238}, /* DarkOrange3 */
+ {139, 69, 0, 1250}, /* DarkOrange4 */
+ {153, 50, 204, 1262}, /* DarkOrchid */
+ {191, 62, 255, 1273}, /* DarkOrchid1 */
+ {178, 58, 238, 1285}, /* DarkOrchid2 */
+ {154, 50, 205, 1297}, /* DarkOrchid3 */
+ {104, 34, 139, 1309}, /* DarkOrchid4 */
+ {139, 0, 0, 1321}, /* DarkRed */
+ {233, 150, 122, 1329}, /* DarkSalmon */
+ {143, 188, 143, 1340}, /* DarkSeaGreen */
+ {193, 255, 193, 1353}, /* DarkSeaGreen1 */
+ {180, 238, 180, 1367}, /* DarkSeaGreen2 */
+ {155, 205, 155, 1381}, /* DarkSeaGreen3 */
+ {105, 139, 105, 1395}, /* DarkSeaGreen4 */
+ {72, 61, 139, 1409}, /* DarkSlateBlue */
+ {47, 79, 79, 1423}, /* DarkSlateGray */
+ {151, 255, 255, 1437}, /* DarkSlateGray1 */
+ {141, 238, 238, 1452}, /* DarkSlateGray2 */
+ {121, 205, 205, 1467}, /* DarkSlateGray3 */
+ {82, 139, 139, 1482}, /* DarkSlateGray4 */
+ {47, 79, 79, 1497}, /* DarkSlateGrey */
+ {0, 206, 209, 1511}, /* DarkTurquoise */
+ {148, 0, 211, 1525}, /* DarkViolet */
+ {255, 20, 147, 1536}, /* deep pink */
+ {0, 191, 255, 1546}, /* deep sky blue */
+ {255, 20, 147, 1560}, /* DeepPink */
+ {255, 20, 147, 1569}, /* DeepPink1 */
+ {238, 18, 137, 1579}, /* DeepPink2 */
+ {205, 16, 118, 1589}, /* DeepPink3 */
+ {139, 10, 80, 1599}, /* DeepPink4 */
+ {0, 191, 255, 1609}, /* DeepSkyBlue */
+ {0, 191, 255, 1621}, /* DeepSkyBlue1 */
+ {0, 178, 238, 1634}, /* DeepSkyBlue2 */
+ {0, 154, 205, 1647}, /* DeepSkyBlue3 */
+ {0, 104, 139, 1660}, /* DeepSkyBlue4 */
+ {105, 105, 105, 1673}, /* dim gray */
+ {105, 105, 105, 1682}, /* dim grey */
+ {105, 105, 105, 1691}, /* DimGray */
+ {105, 105, 105, 1699}, /* DimGrey */
+ {30, 144, 255, 1707}, /* dodger blue */
+ {30, 144, 255, 1719}, /* DodgerBlue */
+ {30, 144, 255, 1730}, /* DodgerBlue1 */
+ {28, 134, 238, 1742}, /* DodgerBlue2 */
+ {24, 116, 205, 1754}, /* DodgerBlue3 */
+ {16, 78, 139, 1766}, /* DodgerBlue4 */
+ {178, 34, 34, 1778}, /* firebrick */
+ {255, 48, 48, 1788}, /* firebrick1 */
+ {238, 44, 44, 1799}, /* firebrick2 */
+ {205, 38, 38, 1810}, /* firebrick3 */
+ {139, 26, 26, 1821}, /* firebrick4 */
+ {255, 250, 240, 1832}, /* floral white */
+ {255, 250, 240, 1845}, /* FloralWhite */
+ {34, 139, 34, 1857}, /* forest green */
+ {34, 139, 34, 1870}, /* ForestGreen */
+ {220, 220, 220, 1882}, /* gainsboro */
+ {248, 248, 255, 1892}, /* ghost white */
+ {248, 248, 255, 1904}, /* GhostWhite */
+ {255, 215, 0, 1915}, /* gold */
+ {255, 215, 0, 1920}, /* gold1 */
+ {238, 201, 0, 1926}, /* gold2 */
+ {205, 173, 0, 1932}, /* gold3 */
+ {139, 117, 0, 1938}, /* gold4 */
+ {218, 165, 32, 1944}, /* goldenrod */
+ {255, 193, 37, 1954}, /* goldenrod1 */
+ {238, 180, 34, 1965}, /* goldenrod2 */
+ {205, 155, 29, 1976}, /* goldenrod3 */
+ {139, 105, 20, 1987}, /* goldenrod4 */
+ {190, 190, 190, 1998}, /* gray */
+ {0, 0, 0, 2003}, /* gray0 */
+ {3, 3, 3, 2009}, /* gray1 */
+ {26, 26, 26, 2015}, /* gray10 */
+ {255, 255, 255, 2022}, /* gray100 */
+ {28, 28, 28, 2030}, /* gray11 */
+ {31, 31, 31, 2037}, /* gray12 */
+ {33, 33, 33, 2044}, /* gray13 */
+ {36, 36, 36, 2051}, /* gray14 */
+ {38, 38, 38, 2058}, /* gray15 */
+ {41, 41, 41, 2065}, /* gray16 */
+ {43, 43, 43, 2072}, /* gray17 */
+ {46, 46, 46, 2079}, /* gray18 */
+ {48, 48, 48, 2086}, /* gray19 */
+ {5, 5, 5, 2093}, /* gray2 */
+ {51, 51, 51, 2099}, /* gray20 */
+ {54, 54, 54, 2106}, /* gray21 */
+ {56, 56, 56, 2113}, /* gray22 */
+ {59, 59, 59, 2120}, /* gray23 */
+ {61, 61, 61, 2127}, /* gray24 */
+ {64, 64, 64, 2134}, /* gray25 */
+ {66, 66, 66, 2141}, /* gray26 */
+ {69, 69, 69, 2148}, /* gray27 */
+ {71, 71, 71, 2155}, /* gray28 */
+ {74, 74, 74, 2162}, /* gray29 */
+ {8, 8, 8, 2169}, /* gray3 */
+ {77, 77, 77, 2175}, /* gray30 */
+ {79, 79, 79, 2182}, /* gray31 */
+ {82, 82, 82, 2189}, /* gray32 */
+ {84, 84, 84, 2196}, /* gray33 */
+ {87, 87, 87, 2203}, /* gray34 */
+ {89, 89, 89, 2210}, /* gray35 */
+ {92, 92, 92, 2217}, /* gray36 */
+ {94, 94, 94, 2224}, /* gray37 */
+ {97, 97, 97, 2231}, /* gray38 */
+ {99, 99, 99, 2238}, /* gray39 */
+ {10, 10, 10, 2245}, /* gray4 */
+ {102, 102, 102, 2251}, /* gray40 */
+ {105, 105, 105, 2258}, /* gray41 */
+ {107, 107, 107, 2265}, /* gray42 */
+ {110, 110, 110, 2272}, /* gray43 */
+ {112, 112, 112, 2279}, /* gray44 */
+ {115, 115, 115, 2286}, /* gray45 */
+ {117, 117, 117, 2293}, /* gray46 */
+ {120, 120, 120, 2300}, /* gray47 */
+ {122, 122, 122, 2307}, /* gray48 */
+ {125, 125, 125, 2314}, /* gray49 */
+ {13, 13, 13, 2321}, /* gray5 */
+ {127, 127, 127, 2327}, /* gray50 */
+ {130, 130, 130, 2334}, /* gray51 */
+ {133, 133, 133, 2341}, /* gray52 */
+ {135, 135, 135, 2348}, /* gray53 */
+ {138, 138, 138, 2355}, /* gray54 */
+ {140, 140, 140, 2362}, /* gray55 */
+ {143, 143, 143, 2369}, /* gray56 */
+ {145, 145, 145, 2376}, /* gray57 */
+ {148, 148, 148, 2383}, /* gray58 */
+ {150, 150, 150, 2390}, /* gray59 */
+ {15, 15, 15, 2397}, /* gray6 */
+ {153, 153, 153, 2403}, /* gray60 */
+ {156, 156, 156, 2410}, /* gray61 */
+ {158, 158, 158, 2417}, /* gray62 */
+ {161, 161, 161, 2424}, /* gray63 */
+ {163, 163, 163, 2431}, /* gray64 */
+ {166, 166, 166, 2438}, /* gray65 */
+ {168, 168, 168, 2445}, /* gray66 */
+ {171, 171, 171, 2452}, /* gray67 */
+ {173, 173, 173, 2459}, /* gray68 */
+ {176, 176, 176, 2466}, /* gray69 */
+ {18, 18, 18, 2473}, /* gray7 */
+ {179, 179, 179, 2479}, /* gray70 */
+ {181, 181, 181, 2486}, /* gray71 */
+ {184, 184, 184, 2493}, /* gray72 */
+ {186, 186, 186, 2500}, /* gray73 */
+ {189, 189, 189, 2507}, /* gray74 */
+ {191, 191, 191, 2514}, /* gray75 */
+ {194, 194, 194, 2521}, /* gray76 */
+ {196, 196, 196, 2528}, /* gray77 */
+ {199, 199, 199, 2535}, /* gray78 */
+ {201, 201, 201, 2542}, /* gray79 */
+ {20, 20, 20, 2549}, /* gray8 */
+ {204, 204, 204, 2555}, /* gray80 */
+ {207, 207, 207, 2562}, /* gray81 */
+ {209, 209, 209, 2569}, /* gray82 */
+ {212, 212, 212, 2576}, /* gray83 */
+ {214, 214, 214, 2583}, /* gray84 */
+ {217, 217, 217, 2590}, /* gray85 */
+ {219, 219, 219, 2597}, /* gray86 */
+ {222, 222, 222, 2604}, /* gray87 */
+ {224, 224, 224, 2611}, /* gray88 */
+ {227, 227, 227, 2618}, /* gray89 */
+ {23, 23, 23, 2625}, /* gray9 */
+ {229, 229, 229, 2631}, /* gray90 */
+ {232, 232, 232, 2638}, /* gray91 */
+ {235, 235, 235, 2645}, /* gray92 */
+ {237, 237, 237, 2652}, /* gray93 */
+ {240, 240, 240, 2659}, /* gray94 */
+ {242, 242, 242, 2666}, /* gray95 */
+ {245, 245, 245, 2673}, /* gray96 */
+ {247, 247, 247, 2680}, /* gray97 */
+ {250, 250, 250, 2687}, /* gray98 */
+ {252, 252, 252, 2694}, /* gray99 */
+ {0, 255, 0, 2701}, /* green */
+ {173, 255, 47, 2707}, /* green yellow */
+ {0, 255, 0, 2720}, /* green1 */
+ {0, 238, 0, 2727}, /* green2 */
+ {0, 205, 0, 2734}, /* green3 */
+ {0, 139, 0, 2741}, /* green4 */
+ {173, 255, 47, 2748}, /* GreenYellow */
+ {190, 190, 190, 2760}, /* grey */
+ {0, 0, 0, 2765}, /* grey0 */
+ {3, 3, 3, 2771}, /* grey1 */
+ {26, 26, 26, 2777}, /* grey10 */
+ {255, 255, 255, 2784}, /* grey100 */
+ {28, 28, 28, 2792}, /* grey11 */
+ {31, 31, 31, 2799}, /* grey12 */
+ {33, 33, 33, 2806}, /* grey13 */
+ {36, 36, 36, 2813}, /* grey14 */
+ {38, 38, 38, 2820}, /* grey15 */
+ {41, 41, 41, 2827}, /* grey16 */
+ {43, 43, 43, 2834}, /* grey17 */
+ {46, 46, 46, 2841}, /* grey18 */
+ {48, 48, 48, 2848}, /* grey19 */
+ {5, 5, 5, 2855}, /* grey2 */
+ {51, 51, 51, 2861}, /* grey20 */
+ {54, 54, 54, 2868}, /* grey21 */
+ {56, 56, 56, 2875}, /* grey22 */
+ {59, 59, 59, 2882}, /* grey23 */
+ {61, 61, 61, 2889}, /* grey24 */
+ {64, 64, 64, 2896}, /* grey25 */
+ {66, 66, 66, 2903}, /* grey26 */
+ {69, 69, 69, 2910}, /* grey27 */
+ {71, 71, 71, 2917}, /* grey28 */
+ {74, 74, 74, 2924}, /* grey29 */
+ {8, 8, 8, 2931}, /* grey3 */
+ {77, 77, 77, 2937}, /* grey30 */
+ {79, 79, 79, 2944}, /* grey31 */
+ {82, 82, 82, 2951}, /* grey32 */
+ {84, 84, 84, 2958}, /* grey33 */
+ {87, 87, 87, 2965}, /* grey34 */
+ {89, 89, 89, 2972}, /* grey35 */
+ {92, 92, 92, 2979}, /* grey36 */
+ {94, 94, 94, 2986}, /* grey37 */
+ {97, 97, 97, 2993}, /* grey38 */
+ {99, 99, 99, 3000}, /* grey39 */
+ {10, 10, 10, 3007}, /* grey4 */
+ {102, 102, 102, 3013}, /* grey40 */
+ {105, 105, 105, 3020}, /* grey41 */
+ {107, 107, 107, 3027}, /* grey42 */
+ {110, 110, 110, 3034}, /* grey43 */
+ {112, 112, 112, 3041}, /* grey44 */
+ {115, 115, 115, 3048}, /* grey45 */
+ {117, 117, 117, 3055}, /* grey46 */
+ {120, 120, 120, 3062}, /* grey47 */
+ {122, 122, 122, 3069}, /* grey48 */
+ {125, 125, 125, 3076}, /* grey49 */
+ {13, 13, 13, 3083}, /* grey5 */
+ {127, 127, 127, 3089}, /* grey50 */
+ {130, 130, 130, 3096}, /* grey51 */
+ {133, 133, 133, 3103}, /* grey52 */
+ {135, 135, 135, 3110}, /* grey53 */
+ {138, 138, 138, 3117}, /* grey54 */
+ {140, 140, 140, 3124}, /* grey55 */
+ {143, 143, 143, 3131}, /* grey56 */
+ {145, 145, 145, 3138}, /* grey57 */
+ {148, 148, 148, 3145}, /* grey58 */
+ {150, 150, 150, 3152}, /* grey59 */
+ {15, 15, 15, 3159}, /* grey6 */
+ {153, 153, 153, 3165}, /* grey60 */
+ {156, 156, 156, 3172}, /* grey61 */
+ {158, 158, 158, 3179}, /* grey62 */
+ {161, 161, 161, 3186}, /* grey63 */
+ {163, 163, 163, 3193}, /* grey64 */
+ {166, 166, 166, 3200}, /* grey65 */
+ {168, 168, 168, 3207}, /* grey66 */
+ {171, 171, 171, 3214}, /* grey67 */
+ {173, 173, 173, 3221}, /* grey68 */
+ {176, 176, 176, 3228}, /* grey69 */
+ {18, 18, 18, 3235}, /* grey7 */
+ {179, 179, 179, 3241}, /* grey70 */
+ {181, 181, 181, 3248}, /* grey71 */
+ {184, 184, 184, 3255}, /* grey72 */
+ {186, 186, 186, 3262}, /* grey73 */
+ {189, 189, 189, 3269}, /* grey74 */
+ {191, 191, 191, 3276}, /* grey75 */
+ {194, 194, 194, 3283}, /* grey76 */
+ {196, 196, 196, 3290}, /* grey77 */
+ {199, 199, 199, 3297}, /* grey78 */
+ {201, 201, 201, 3304}, /* grey79 */
+ {20, 20, 20, 3311}, /* grey8 */
+ {204, 204, 204, 3317}, /* grey80 */
+ {207, 207, 207, 3324}, /* grey81 */
+ {209, 209, 209, 3331}, /* grey82 */
+ {212, 212, 212, 3338}, /* grey83 */
+ {214, 214, 214, 3345}, /* grey84 */
+ {217, 217, 217, 3352}, /* grey85 */
+ {219, 219, 219, 3359}, /* grey86 */
+ {222, 222, 222, 3366}, /* grey87 */
+ {224, 224, 224, 3373}, /* grey88 */
+ {227, 227, 227, 3380}, /* grey89 */
+ {23, 23, 23, 3387}, /* grey9 */
+ {229, 229, 229, 3393}, /* grey90 */
+ {232, 232, 232, 3400}, /* grey91 */
+ {235, 235, 235, 3407}, /* grey92 */
+ {237, 237, 237, 3414}, /* grey93 */
+ {240, 240, 240, 3421}, /* grey94 */
+ {242, 242, 242, 3428}, /* grey95 */
+ {245, 245, 245, 3435}, /* grey96 */
+ {247, 247, 247, 3442}, /* grey97 */
+ {250, 250, 250, 3449}, /* grey98 */
+ {252, 252, 252, 3456}, /* grey99 */
+ {240, 255, 240, 3463}, /* honeydew */
+ {240, 255, 240, 3472}, /* honeydew1 */
+ {224, 238, 224, 3482}, /* honeydew2 */
+ {193, 205, 193, 3492}, /* honeydew3 */
+ {131, 139, 131, 3502}, /* honeydew4 */
+ {255, 105, 180, 3512}, /* hot pink */
+ {255, 105, 180, 3521}, /* HotPink */
+ {255, 110, 180, 3529}, /* HotPink1 */
+ {238, 106, 167, 3538}, /* HotPink2 */
+ {205, 96, 144, 3547}, /* HotPink3 */
+ {139, 58, 98, 3556}, /* HotPink4 */
+ {205, 92, 92, 3565}, /* indian red */
+ {205, 92, 92, 3576}, /* IndianRed */
+ {255, 106, 106, 3586}, /* IndianRed1 */
+ {238, 99, 99, 3597}, /* IndianRed2 */
+ {205, 85, 85, 3608}, /* IndianRed3 */
+ {139, 58, 58, 3619}, /* IndianRed4 */
+ {255, 255, 240, 3630}, /* ivory */
+ {255, 255, 240, 3636}, /* ivory1 */
+ {238, 238, 224, 3643}, /* ivory2 */
+ {205, 205, 193, 3650}, /* ivory3 */
+ {139, 139, 131, 3657}, /* ivory4 */
+ {240, 230, 140, 3664}, /* khaki */
+ {255, 246, 143, 3670}, /* khaki1 */
+ {238, 230, 133, 3677}, /* khaki2 */
+ {205, 198, 115, 3684}, /* khaki3 */
+ {139, 134, 78, 3691}, /* khaki4 */
+ {230, 230, 250, 3698}, /* lavender */
+ {255, 240, 245, 3707}, /* lavender blush */
+ {255, 240, 245, 3722}, /* LavenderBlush */
+ {255, 240, 245, 3736}, /* LavenderBlush1 */
+ {238, 224, 229, 3751}, /* LavenderBlush2 */
+ {205, 193, 197, 3766}, /* LavenderBlush3 */
+ {139, 131, 134, 3781}, /* LavenderBlush4 */
+ {124, 252, 0, 3796}, /* lawn green */
+ {124, 252, 0, 3807}, /* LawnGreen */
+ {255, 250, 205, 3817}, /* lemon chiffon */
+ {255, 250, 205, 3831}, /* LemonChiffon */
+ {255, 250, 205, 3844}, /* LemonChiffon1 */
+ {238, 233, 191, 3858}, /* LemonChiffon2 */
+ {205, 201, 165, 3872}, /* LemonChiffon3 */
+ {139, 137, 112, 3886}, /* LemonChiffon4 */
+ {173, 216, 230, 3900}, /* light blue */
+ {240, 128, 128, 3911}, /* light coral */
+ {224, 255, 255, 3923}, /* light cyan */
+ {238, 221, 130, 3934}, /* light goldenrod */
+ {250, 250, 210, 3950}, /* light goldenrod yellow */
+ {211, 211, 211, 3973}, /* light gray */
+ {144, 238, 144, 3984}, /* light green */
+ {211, 211, 211, 3996}, /* light grey */
+ {255, 182, 193, 4007}, /* light pink */
+ {255, 160, 122, 4018}, /* light salmon */
+ {32, 178, 170, 4031}, /* light sea green */
+ {135, 206, 250, 4047}, /* light sky blue */
+ {132, 112, 255, 4062}, /* light slate blue */
+ {119, 136, 153, 4079}, /* light slate gray */
+ {119, 136, 153, 4096}, /* light slate grey */
+ {176, 196, 222, 4113}, /* light steel blue */
+ {255, 255, 224, 4130}, /* light yellow */
+ {173, 216, 230, 4143}, /* LightBlue */
+ {191, 239, 255, 4153}, /* LightBlue1 */
+ {178, 223, 238, 4164}, /* LightBlue2 */
+ {154, 192, 205, 4175}, /* LightBlue3 */
+ {104, 131, 139, 4186}, /* LightBlue4 */
+ {240, 128, 128, 4197}, /* LightCoral */
+ {224, 255, 255, 4208}, /* LightCyan */
+ {224, 255, 255, 4218}, /* LightCyan1 */
+ {209, 238, 238, 4229}, /* LightCyan2 */
+ {180, 205, 205, 4240}, /* LightCyan3 */
+ {122, 139, 139, 4251}, /* LightCyan4 */
+ {238, 221, 130, 4262}, /* LightGoldenrod */
+ {255, 236, 139, 4277}, /* LightGoldenrod1 */
+ {238, 220, 130, 4293}, /* LightGoldenrod2 */
+ {205, 190, 112, 4309}, /* LightGoldenrod3 */
+ {139, 129, 76, 4325}, /* LightGoldenrod4 */
+ {250, 250, 210, 4341}, /* LightGoldenrodYellow */
+ {211, 211, 211, 4362}, /* LightGray */
+ {144, 238, 144, 4372}, /* LightGreen */
+ {211, 211, 211, 4383}, /* LightGrey */
+ {255, 182, 193, 4393}, /* LightPink */
+ {255, 174, 185, 4403}, /* LightPink1 */
+ {238, 162, 173, 4414}, /* LightPink2 */
+ {205, 140, 149, 4425}, /* LightPink3 */
+ {139, 95, 101, 4436}, /* LightPink4 */
+ {255, 160, 122, 4447}, /* LightSalmon */
+ {255, 160, 122, 4459}, /* LightSalmon1 */
+ {238, 149, 114, 4472}, /* LightSalmon2 */
+ {205, 129, 98, 4485}, /* LightSalmon3 */
+ {139, 87, 66, 4498}, /* LightSalmon4 */
+ {32, 178, 170, 4511}, /* LightSeaGreen */
+ {135, 206, 250, 4525}, /* LightSkyBlue */
+ {176, 226, 255, 4538}, /* LightSkyBlue1 */
+ {164, 211, 238, 4552}, /* LightSkyBlue2 */
+ {141, 182, 205, 4566}, /* LightSkyBlue3 */
+ {96, 123, 139, 4580}, /* LightSkyBlue4 */
+ {132, 112, 255, 4594}, /* LightSlateBlue */
+ {119, 136, 153, 4609}, /* LightSlateGray */
+ {119, 136, 153, 4624}, /* LightSlateGrey */
+ {176, 196, 222, 4639}, /* LightSteelBlue */
+ {202, 225, 255, 4654}, /* LightSteelBlue1 */
+ {188, 210, 238, 4670}, /* LightSteelBlue2 */
+ {162, 181, 205, 4686}, /* LightSteelBlue3 */
+ {110, 123, 139, 4702}, /* LightSteelBlue4 */
+ {255, 255, 224, 4718}, /* LightYellow */
+ {255, 255, 224, 4730}, /* LightYellow1 */
+ {238, 238, 209, 4743}, /* LightYellow2 */
+ {205, 205, 180, 4756}, /* LightYellow3 */
+ {139, 139, 122, 4769}, /* LightYellow4 */
+ {50, 205, 50, 4782}, /* lime green */
+ {50, 205, 50, 4793}, /* LimeGreen */
+ {250, 240, 230, 4803}, /* linen */
+ {255, 0, 255, 4809}, /* magenta */
+ {255, 0, 255, 4817}, /* magenta1 */
+ {238, 0, 238, 4826}, /* magenta2 */
+ {205, 0, 205, 4835}, /* magenta3 */
+ {139, 0, 139, 4844}, /* magenta4 */
+ {176, 48, 96, 4853}, /* maroon */
+ {255, 52, 179, 4860}, /* maroon1 */
+ {238, 48, 167, 4868}, /* maroon2 */
+ {205, 41, 144, 4876}, /* maroon3 */
+ {139, 28, 98, 4884}, /* maroon4 */
+ {102, 205, 170, 4892}, /* medium aquamarine */
+ {0, 0, 205, 4910}, /* medium blue */
+ {186, 85, 211, 4922}, /* medium orchid */
+ {147, 112, 219, 4936}, /* medium purple */
+ {60, 179, 113, 4950}, /* medium sea green */
+ {123, 104, 238, 4967}, /* medium slate blue */
+ {0, 250, 154, 4985}, /* medium spring green */
+ {72, 209, 204, 5005}, /* medium turquoise */
+ {199, 21, 133, 5022}, /* medium violet red */
+ {102, 205, 170, 5040}, /* MediumAquamarine */
+ {0, 0, 205, 5057}, /* MediumBlue */
+ {186, 85, 211, 5068}, /* MediumOrchid */
+ {224, 102, 255, 5081}, /* MediumOrchid1 */
+ {209, 95, 238, 5095}, /* MediumOrchid2 */
+ {180, 82, 205, 5109}, /* MediumOrchid3 */
+ {122, 55, 139, 5123}, /* MediumOrchid4 */
+ {147, 112, 219, 5137}, /* MediumPurple */
+ {171, 130, 255, 5150}, /* MediumPurple1 */
+ {159, 121, 238, 5164}, /* MediumPurple2 */
+ {137, 104, 205, 5178}, /* MediumPurple3 */
+ {93, 71, 139, 5192}, /* MediumPurple4 */
+ {60, 179, 113, 5206}, /* MediumSeaGreen */
+ {123, 104, 238, 5221}, /* MediumSlateBlue */
+ {0, 250, 154, 5237}, /* MediumSpringGreen */
+ {72, 209, 204, 5255}, /* MediumTurquoise */
+ {199, 21, 133, 5271}, /* MediumVioletRed */
+ {25, 25, 112, 5287}, /* midnight blue */
+ {25, 25, 112, 5301}, /* MidnightBlue */
+ {245, 255, 250, 5314}, /* mint cream */
+ {245, 255, 250, 5325}, /* MintCream */
+ {255, 228, 225, 5335}, /* misty rose */
+ {255, 228, 225, 5346}, /* MistyRose */
+ {255, 228, 225, 5356}, /* MistyRose1 */
+ {238, 213, 210, 5367}, /* MistyRose2 */
+ {205, 183, 181, 5378}, /* MistyRose3 */
+ {139, 125, 123, 5389}, /* MistyRose4 */
+ {255, 228, 181, 5400}, /* moccasin */
+ {255, 222, 173, 5409}, /* navajo white */
+ {255, 222, 173, 5422}, /* NavajoWhite */
+ {255, 222, 173, 5434}, /* NavajoWhite1 */
+ {238, 207, 161, 5447}, /* NavajoWhite2 */
+ {205, 179, 139, 5460}, /* NavajoWhite3 */
+ {139, 121, 94, 5473}, /* NavajoWhite4 */
+ {0, 0, 128, 5486}, /* navy */
+ {0, 0, 128, 5491}, /* navy blue */
+ {0, 0, 128, 5501}, /* NavyBlue */
+ {253, 245, 230, 5510}, /* old lace */
+ {253, 245, 230, 5519}, /* OldLace */
+ {107, 142, 35, 5527}, /* olive drab */
+ {107, 142, 35, 5538}, /* OliveDrab */
+ {192, 255, 62, 5548}, /* OliveDrab1 */
+ {179, 238, 58, 5559}, /* OliveDrab2 */
+ {154, 205, 50, 5570}, /* OliveDrab3 */
+ {105, 139, 34, 5581}, /* OliveDrab4 */
+ {255, 165, 0, 5592}, /* orange */
+ {255, 69, 0, 5599}, /* orange red */
+ {255, 165, 0, 5610}, /* orange1 */
+ {238, 154, 0, 5618}, /* orange2 */
+ {205, 133, 0, 5626}, /* orange3 */
+ {139, 90, 0, 5634}, /* orange4 */
+ {255, 69, 0, 5642}, /* OrangeRed */
+ {255, 69, 0, 5652}, /* OrangeRed1 */
+ {238, 64, 0, 5663}, /* OrangeRed2 */
+ {205, 55, 0, 5674}, /* OrangeRed3 */
+ {139, 37, 0, 5685}, /* OrangeRed4 */
+ {218, 112, 214, 5696}, /* orchid */
+ {255, 131, 250, 5703}, /* orchid1 */
+ {238, 122, 233, 5711}, /* orchid2 */
+ {205, 105, 201, 5719}, /* orchid3 */
+ {139, 71, 137, 5727}, /* orchid4 */
+ {238, 232, 170, 5735}, /* pale goldenrod */
+ {152, 251, 152, 5750}, /* pale green */
+ {175, 238, 238, 5761}, /* pale turquoise */
+ {219, 112, 147, 5776}, /* pale violet red */
+ {238, 232, 170, 5792}, /* PaleGoldenrod */
+ {152, 251, 152, 5806}, /* PaleGreen */
+ {154, 255, 154, 5816}, /* PaleGreen1 */
+ {144, 238, 144, 5827}, /* PaleGreen2 */
+ {124, 205, 124, 5838}, /* PaleGreen3 */
+ {84, 139, 84, 5849}, /* PaleGreen4 */
+ {175, 238, 238, 5860}, /* PaleTurquoise */
+ {187, 255, 255, 5874}, /* PaleTurquoise1 */
+ {174, 238, 238, 5889}, /* PaleTurquoise2 */
+ {150, 205, 205, 5904}, /* PaleTurquoise3 */
+ {102, 139, 139, 5919}, /* PaleTurquoise4 */
+ {219, 112, 147, 5934}, /* PaleVioletRed */
+ {255, 130, 171, 5948}, /* PaleVioletRed1 */
+ {238, 121, 159, 5963}, /* PaleVioletRed2 */
+ {205, 104, 137, 5978}, /* PaleVioletRed3 */
+ {139, 71, 93, 5993}, /* PaleVioletRed4 */
+ {255, 239, 213, 6008}, /* papaya whip */
+ {255, 239, 213, 6020}, /* PapayaWhip */
+ {255, 218, 185, 6031}, /* peach puff */
+ {255, 218, 185, 6042}, /* PeachPuff */
+ {255, 218, 185, 6052}, /* PeachPuff1 */
+ {238, 203, 173, 6063}, /* PeachPuff2 */
+ {205, 175, 149, 6074}, /* PeachPuff3 */
+ {139, 119, 101, 6085}, /* PeachPuff4 */
+ {205, 133, 63, 6096}, /* peru */
+ {255, 192, 203, 6101}, /* pink */
+ {255, 181, 197, 6106}, /* pink1 */
+ {238, 169, 184, 6112}, /* pink2 */
+ {205, 145, 158, 6118}, /* pink3 */
+ {139, 99, 108, 6124}, /* pink4 */
+ {221, 160, 221, 6130}, /* plum */
+ {255, 187, 255, 6135}, /* plum1 */
+ {238, 174, 238, 6141}, /* plum2 */
+ {205, 150, 205, 6147}, /* plum3 */
+ {139, 102, 139, 6153}, /* plum4 */
+ {176, 224, 230, 6159}, /* powder blue */
+ {176, 224, 230, 6171}, /* PowderBlue */
+ {160, 32, 240, 6182}, /* purple */
+ {155, 48, 255, 6189}, /* purple1 */
+ {145, 44, 238, 6197}, /* purple2 */
+ {125, 38, 205, 6205}, /* purple3 */
+ {85, 26, 139, 6213}, /* purple4 */
+ {255, 0, 0, 6221}, /* red */
+ {255, 0, 0, 6225}, /* red1 */
+ {238, 0, 0, 6230}, /* red2 */
+ {205, 0, 0, 6235}, /* red3 */
+ {139, 0, 0, 6240}, /* red4 */
+ {188, 143, 143, 6245}, /* rosy brown */
+ {188, 143, 143, 6256}, /* RosyBrown */
+ {255, 193, 193, 6266}, /* RosyBrown1 */
+ {238, 180, 180, 6277}, /* RosyBrown2 */
+ {205, 155, 155, 6288}, /* RosyBrown3 */
+ {139, 105, 105, 6299}, /* RosyBrown4 */
+ {65, 105, 225, 6310}, /* royal blue */
+ {65, 105, 225, 6321}, /* RoyalBlue */
+ {72, 118, 255, 6331}, /* RoyalBlue1 */
+ {67, 110, 238, 6342}, /* RoyalBlue2 */
+ {58, 95, 205, 6353}, /* RoyalBlue3 */
+ {39, 64, 139, 6364}, /* RoyalBlue4 */
+ {139, 69, 19, 6375}, /* saddle brown */
+ {139, 69, 19, 6388}, /* SaddleBrown */
+ {250, 128, 114, 6400}, /* salmon */
+ {255, 140, 105, 6407}, /* salmon1 */
+ {238, 130, 98, 6415}, /* salmon2 */
+ {205, 112, 84, 6423}, /* salmon3 */
+ {139, 76, 57, 6431}, /* salmon4 */
+ {244, 164, 96, 6439}, /* sandy brown */
+ {244, 164, 96, 6451}, /* SandyBrown */
+ {46, 139, 87, 6462}, /* sea green */
+ {46, 139, 87, 6472}, /* SeaGreen */
+ {84, 255, 159, 6481}, /* SeaGreen1 */
+ {78, 238, 148, 6491}, /* SeaGreen2 */
+ {67, 205, 128, 6501}, /* SeaGreen3 */
+ {46, 139, 87, 6511}, /* SeaGreen4 */
+ {255, 245, 238, 6521}, /* seashell */
+ {255, 245, 238, 6530}, /* seashell1 */
+ {238, 229, 222, 6540}, /* seashell2 */
+ {205, 197, 191, 6550}, /* seashell3 */
+ {139, 134, 130, 6560}, /* seashell4 */
+ {160, 82, 45, 6570}, /* sienna */
+ {255, 130, 71, 6577}, /* sienna1 */
+ {238, 121, 66, 6585}, /* sienna2 */
+ {205, 104, 57, 6593}, /* sienna3 */
+ {139, 71, 38, 6601}, /* sienna4 */
+ {135, 206, 235, 6609}, /* sky blue */
+ {135, 206, 235, 6618}, /* SkyBlue */
+ {135, 206, 255, 6626}, /* SkyBlue1 */
+ {126, 192, 238, 6635}, /* SkyBlue2 */
+ {108, 166, 205, 6644}, /* SkyBlue3 */
+ {74, 112, 139, 6653}, /* SkyBlue4 */
+ {106, 90, 205, 6662}, /* slate blue */
+ {112, 128, 144, 6673}, /* slate gray */
+ {112, 128, 144, 6684}, /* slate grey */
+ {106, 90, 205, 6695}, /* SlateBlue */
+ {131, 111, 255, 6705}, /* SlateBlue1 */
+ {122, 103, 238, 6716}, /* SlateBlue2 */
+ {105, 89, 205, 6727}, /* SlateBlue3 */
+ {71, 60, 139, 6738}, /* SlateBlue4 */
+ {112, 128, 144, 6749}, /* SlateGray */
+ {198, 226, 255, 6759}, /* SlateGray1 */
+ {185, 211, 238, 6770}, /* SlateGray2 */
+ {159, 182, 205, 6781}, /* SlateGray3 */
+ {108, 123, 139, 6792}, /* SlateGray4 */
+ {112, 128, 144, 6803}, /* SlateGrey */
+ {255, 250, 250, 6813}, /* snow */
+ {255, 250, 250, 6818}, /* snow1 */
+ {238, 233, 233, 6824}, /* snow2 */
+ {205, 201, 201, 6830}, /* snow3 */
+ {139, 137, 137, 6836}, /* snow4 */
+ {0, 255, 127, 6842}, /* spring green */
+ {0, 255, 127, 6855}, /* SpringGreen */
+ {0, 255, 127, 6867}, /* SpringGreen1 */
+ {0, 238, 118, 6880}, /* SpringGreen2 */
+ {0, 205, 102, 6893}, /* SpringGreen3 */
+ {0, 139, 69, 6906}, /* SpringGreen4 */
+ {70, 130, 180, 6919}, /* steel blue */
+ {70, 130, 180, 6930}, /* SteelBlue */
+ {99, 184, 255, 6940}, /* SteelBlue1 */
+ {92, 172, 238, 6951}, /* SteelBlue2 */
+ {79, 148, 205, 6962}, /* SteelBlue3 */
+ {54, 100, 139, 6973}, /* SteelBlue4 */
+ {210, 180, 140, 6984}, /* tan */
+ {255, 165, 79, 6988}, /* tan1 */
+ {238, 154, 73, 6993}, /* tan2 */
+ {205, 133, 63, 6998}, /* tan3 */
+ {139, 90, 43, 7003}, /* tan4 */
+ {216, 191, 216, 7008}, /* thistle */
+ {255, 225, 255, 7016}, /* thistle1 */
+ {238, 210, 238, 7025}, /* thistle2 */
+ {205, 181, 205, 7034}, /* thistle3 */
+ {139, 123, 139, 7043}, /* thistle4 */
+ {255, 99, 71, 7052}, /* tomato */
+ {255, 99, 71, 7059}, /* tomato1 */
+ {238, 92, 66, 7067}, /* tomato2 */
+ {205, 79, 57, 7075}, /* tomato3 */
+ {139, 54, 38, 7083}, /* tomato4 */
+ {64, 224, 208, 7091}, /* turquoise */
+ {0, 245, 255, 7101}, /* turquoise1 */
+ {0, 229, 238, 7112}, /* turquoise2 */
+ {0, 197, 205, 7123}, /* turquoise3 */
+ {0, 134, 139, 7134}, /* turquoise4 */
+ {238, 130, 238, 7145}, /* violet */
+ {208, 32, 144, 7152}, /* violet red */
+ {208, 32, 144, 7163}, /* VioletRed */
+ {255, 62, 150, 7173}, /* VioletRed1 */
+ {238, 58, 140, 7184}, /* VioletRed2 */
+ {205, 50, 120, 7195}, /* VioletRed3 */
+ {139, 34, 82, 7206}, /* VioletRed4 */
+ {245, 222, 179, 7217}, /* wheat */
+ {255, 231, 186, 7223}, /* wheat1 */
+ {238, 216, 174, 7230}, /* wheat2 */
+ {205, 186, 150, 7237}, /* wheat3 */
+ {139, 126, 102, 7244}, /* wheat4 */
+ {255, 255, 255, 7251}, /* white */
+ {245, 245, 245, 7257}, /* white smoke */
+ {245, 245, 245, 7269}, /* WhiteSmoke */
+ {255, 255, 0, 7280}, /* yellow */
+ {154, 205, 50, 7287}, /* yellow green */
+ {255, 255, 0, 7300}, /* yellow1 */
+ {238, 238, 0, 7308}, /* yellow2 */
+ {205, 205, 0, 7316}, /* yellow3 */
+ {139, 139, 0, 7324}, /* yellow4 */
+ {154, 205, 50, 7332}, /* YellowGreen */
};
#define NUM_BUILTIN_COLORS (sizeof (BuiltinColors) / sizeof (BuiltinColors[0]))
Bool
-OsLookupColor(int screen,
- char *name,
- unsigned int len,
- unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue)
+OsLookupColor(int screen,
+ char *name,
+ unsigned int len,
+ unsigned short *pred,
+ unsigned short *pgreen, unsigned short *pblue)
{
- const BuiltinColor *c;
- int low, mid, high;
- int r;
+ const BuiltinColor *c;
+ int low, mid, high;
+ int r;
low = 0;
high = NUM_BUILTIN_COLORS - 1;
- while (high >= low)
- {
- mid = (low + high) / 2;
- c = &BuiltinColors[mid];
- r = strncasecmp (&BuiltinColorNames[c->name], name, len);
- if (r == 0 && len == strlen (&BuiltinColorNames[c->name]))
- {
- *pred = c->red * 0x101;
- *pgreen = c->green * 0x101;
- *pblue = c->blue * 0x101;
- return TRUE;
- }
- if (r < 0)
- low = mid + 1;
- else
- high = mid - 1;
+ while (high >= low) {
+ mid = (low + high) / 2;
+ c = &BuiltinColors[mid];
+ r = strncasecmp(&BuiltinColorNames[c->name], name, len);
+ if (r == 0 && len == strlen(&BuiltinColorNames[c->name])) {
+ *pred = c->red * 0x101;
+ *pgreen = c->green * 0x101;
+ *pblue = c->blue * 0x101;
+ return TRUE;
+ }
+ if (r < 0)
+ low = mid + 1;
+ else
+ high = mid - 1;
}
return FALSE;
}
diff --git a/xorg-server/os/osdep.h b/xorg-server/os/osdep.h
index 70e2a0726..fff088701 100644
--- a/xorg-server/os/osdep.h
+++ b/xorg-server/os/osdep.h
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -102,17 +101,17 @@ SOFTWARE.
#include <stddef.h>
#if defined(XDMCP) || defined(HASXDMAUTH)
-typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
-typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
-typedef Bool (*AddAuthorFunc)(unsigned name_length, const char *name,
- unsigned data_length, char *data);
+typedef Bool (*ValidatorFunc) (ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
+typedef Bool (*GeneratorFunc) (ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
+typedef Bool (*AddAuthorFunc) (unsigned name_length, const char *name,
+ unsigned data_length, char *data);
#endif
typedef struct _connectionInput {
struct _connectionInput *next;
char *buffer; /* contains current client input */
char *bufptr; /* pointer to current start of data */
- int bufcnt; /* count of bytes in buffer */
+ int bufcnt; /* count of bytes in buffer */
int lenLastReq;
int size;
unsigned int ignoreBytes; /* bytes to ignore before the next request */
@@ -151,30 +150,29 @@ typedef int (*AuthRstCFunc) (AuthRstCArgs);
#define AuthToIDArgs unsigned short data_length, char *data
typedef XID (*AuthToIDFunc) (AuthToIDArgs);
-typedef void (*OsCloseFunc)(ClientPtr);
+typedef void (*OsCloseFunc) (ClientPtr);
-typedef int (*OsFlushFunc)(ClientPtr who, struct _osComm * oc, char* extraBuf, int extraCount);
+typedef int (*OsFlushFunc) (ClientPtr who, struct _osComm * oc, char *extraBuf,
+ int extraCount);
typedef struct _osComm {
int fd;
ConnectionInputPtr input;
ConnectionOutputPtr output;
- XID auth_id; /* authorization id */
- CARD32 conn_time; /* timestamp if not established, else 0 */
+ XID auth_id; /* authorization id */
+ CARD32 conn_time; /* timestamp if not established, else 0 */
struct _XtransConnInfo *trans_conn; /* transport connection object */
Bool local_client;
} OsCommRec, *OsCommPtr;
-extern int FlushClient(
- ClientPtr /*who*/,
- OsCommPtr /*oc*/,
- const void * /*extraBuf*/,
- int /*extraCount*/
-);
+extern int FlushClient(ClientPtr /*who */ ,
+ OsCommPtr /*oc */ ,
+ const void * /*extraBuf */ ,
+ int /*extraCount */
+ );
-extern void FreeOsBuffers(
- OsCommPtr /*oc*/
-);
+extern void FreeOsBuffers(OsCommPtr /*oc */
+ );
#include "dix.h"
@@ -195,7 +193,7 @@ extern int GetConnectionTranslation(int conn);
extern void SetConnectionTranslation(int conn, int client);
extern void ClearConnectionTranslation(void);
#endif
-
+
extern Bool NewOutputPending;
extern Bool AnyClientsWriteBlocked;
@@ -212,67 +210,63 @@ extern int mffs(fd_mask);
extern Bool ComputeLocalClient(ClientPtr client);
/* in auth.c */
-extern void GenerateRandomData (int len, char *buf);
+extern void GenerateRandomData(int len, char *buf);
/* in mitauth.c */
-extern XID MitCheckCookie (AuthCheckArgs);
-extern XID MitGenerateCookie (AuthGenCArgs);
-extern XID MitToID (AuthToIDArgs);
-extern int MitAddCookie (AuthAddCArgs);
-extern int MitFromID (AuthFromIDArgs);
-extern int MitRemoveCookie (AuthRemCArgs);
-extern int MitResetCookie (AuthRstCArgs);
+extern XID MitCheckCookie(AuthCheckArgs);
+extern XID MitGenerateCookie(AuthGenCArgs);
+extern XID MitToID(AuthToIDArgs);
+extern int MitAddCookie(AuthAddCArgs);
+extern int MitFromID(AuthFromIDArgs);
+extern int MitRemoveCookie(AuthRemCArgs);
+extern int MitResetCookie(AuthRstCArgs);
/* in xdmauth.c */
#ifdef HASXDMAUTH
-extern XID XdmCheckCookie (AuthCheckArgs);
-extern XID XdmToID (AuthToIDArgs);
-extern int XdmAddCookie (AuthAddCArgs);
-extern int XdmFromID (AuthFromIDArgs);
-extern int XdmRemoveCookie (AuthRemCArgs);
-extern int XdmResetCookie (AuthRstCArgs);
+extern XID XdmCheckCookie(AuthCheckArgs);
+extern XID XdmToID(AuthToIDArgs);
+extern int XdmAddCookie(AuthAddCArgs);
+extern int XdmFromID(AuthFromIDArgs);
+extern int XdmRemoveCookie(AuthRemCArgs);
+extern int XdmResetCookie(AuthRstCArgs);
#endif
/* in rpcauth.c */
#ifdef SECURE_RPC
-extern void SecureRPCInit (AuthInitArgs);
-extern XID SecureRPCCheck (AuthCheckArgs);
-extern XID SecureRPCToID (AuthToIDArgs);
-extern int SecureRPCAdd (AuthAddCArgs);
-extern int SecureRPCFromID (AuthFromIDArgs);
-extern int SecureRPCRemove (AuthRemCArgs);
-extern int SecureRPCReset (AuthRstCArgs);
+extern void SecureRPCInit(AuthInitArgs);
+extern XID SecureRPCCheck(AuthCheckArgs);
+extern XID SecureRPCToID(AuthToIDArgs);
+extern int SecureRPCAdd(AuthAddCArgs);
+extern int SecureRPCFromID(AuthFromIDArgs);
+extern int SecureRPCRemove(AuthRemCArgs);
+extern int SecureRPCReset(AuthRstCArgs);
#endif
#ifdef XDMCP
/* in xdmcp.c */
-extern void XdmcpUseMsg (void);
+extern void XdmcpUseMsg(void);
extern int XdmcpOptions(int argc, char **argv, int i);
-extern void XdmcpRegisterConnection (
- int type,
- const char *address,
- int addrlen);
-extern void XdmcpRegisterAuthorizations (void);
-extern void XdmcpRegisterAuthorization (const char *name, int namelen);
-extern void XdmcpInit (void);
-extern void XdmcpReset (void);
+extern void XdmcpRegisterConnection(int type, const char *address, int addrlen);
+extern void XdmcpRegisterAuthorizations(void);
+extern void XdmcpRegisterAuthorization(const char *name, int namelen);
+extern void XdmcpInit(void);
+extern void XdmcpReset(void);
extern void XdmcpOpenDisplay(int sock);
extern void XdmcpCloseDisplay(int sock);
-extern void XdmcpRegisterAuthentication (
- const char *name,
- int namelen,
- const char *data,
- int datalen,
- ValidatorFunc Validator,
- GeneratorFunc Generator,
- AddAuthorFunc AddAuth);
+extern void XdmcpRegisterAuthentication(const char *name,
+ int namelen,
+ const char *data,
+ int datalen,
+ ValidatorFunc Validator,
+ GeneratorFunc Generator,
+ AddAuthorFunc AddAuth);
struct sockaddr_in;
-extern void XdmcpRegisterBroadcastAddress (const struct sockaddr_in *addr);
+extern void XdmcpRegisterBroadcastAddress(const struct sockaddr_in *addr);
#endif
#ifdef HASXDMAUTH
-extern void XdmAuthenticationInit (const char *cookie, int cookie_length);
+extern void XdmAuthenticationInit(const char *cookie, int cookie_length);
#endif
-#endif /* _OSDEP_H_ */
+#endif /* _OSDEP_H_ */
diff --git a/xorg-server/os/osinit.c b/xorg-server/os/osinit.c
index cd9c7641e..4c444a04f 100644
--- a/xorg-server/os/osinit.c
+++ b/xorg-server/os/osinit.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -57,7 +56,7 @@ SOFTWARE.
#include <signal.h>
#include <errno.h>
#ifdef HAVE_DLFCN_H
-# include <dlfcn.h>
+#include <dlfcn.h>
#endif
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
@@ -67,8 +66,7 @@ SOFTWARE.
#include "dixstruct.h"
-
-#if !defined(SYSV) && !defined(WIN32)
+#if !defined(SYSV) && !defined(WIN32)
#include <sys/resource.h>
#endif
@@ -77,6 +75,7 @@ SOFTWARE.
#endif
extern char *display;
+
#ifdef RLIMIT_DATA
int limitDataSpace = -1;
#endif
@@ -105,191 +104,190 @@ OsRegisterSigWrapper(OsSigWrapperPtr newSigWrapper)
*/
static void
#ifdef SA_SIGINFO
-OsSigHandler(int signo, siginfo_t *sip, void *unused)
+OsSigHandler(int signo, siginfo_t * sip, void *unused)
#else
OsSigHandler(int signo)
#endif
{
#ifdef RTLD_DI_SETSIGNAL
- const char *dlerr = dlerror();
+ const char *dlerr = dlerror();
- if (dlerr) {
- LogMessage(X_ERROR, "Dynamic loader error: %s\n", dlerr);
- }
-#endif /* RTLD_DI_SETSIGNAL */
+ if (dlerr) {
+ LogMessage(X_ERROR, "Dynamic loader error: %s\n", dlerr);
+ }
+#endif /* RTLD_DI_SETSIGNAL */
- if (OsSigWrapper != NULL) {
- if (OsSigWrapper(signo) == 0) {
- /* ddx handled signal and wants us to continue */
- return;
- }
- }
+ if (OsSigWrapper != NULL) {
+ if (OsSigWrapper(signo) == 0) {
+ /* ddx handled signal and wants us to continue */
+ return;
+ }
+ }
- /* log, cleanup, and abort */
- xorg_backtrace();
+ /* log, cleanup, and abort */
+ xorg_backtrace();
#ifdef SA_SIGINFO
- if (sip->si_code == SI_USER) {
- ErrorF("Recieved signal %d sent by process %ld, uid %ld\n",
- signo, (long) sip->si_pid, (long) sip->si_uid);
- } else {
- switch (signo) {
- case SIGSEGV:
- case SIGBUS:
- case SIGILL:
- case SIGFPE:
- ErrorF("%s at address %p\n", strsignal(signo), sip->si_addr);
- }
- }
+ if (sip->si_code == SI_USER) {
+ ErrorF("Recieved signal %d sent by process %ld, uid %ld\n",
+ signo, (long) sip->si_pid, (long) sip->si_uid);
+ }
+ else {
+ switch (signo) {
+ case SIGSEGV:
+ case SIGBUS:
+ case SIGILL:
+ case SIGFPE:
+ ErrorF("%s at address %p\n", strsignal(signo), sip->si_addr);
+ }
+ }
#endif
- FatalError("Caught signal %d (%s). Server aborting\n",
- signo, strsignal(signo));
+ FatalError("Caught signal %d (%s). Server aborting\n",
+ signo, strsignal(signo));
}
void
OsInit(void)
{
static Bool been_here = FALSE;
- static const char* devnull = "/dev/null";
+ static const char *devnull = "/dev/null";
char fname[PATH_MAX];
if (!been_here) {
#ifndef _MSC_VER
- struct sigaction act, oact;
- int i;
- int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
- SIGSYS,
- SIGXCPU,
- SIGXFSZ,
+ struct sigaction act, oact;
+ int i;
+
+ int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
+ SIGSYS,
+ SIGXCPU,
+ SIGXFSZ,
#ifdef SIGEMT
- SIGEMT,
+ SIGEMT,
#endif
- 0 /* must be last */ };
- sigemptyset(&act.sa_mask);
+ 0 /* must be last */
+ };
+ sigemptyset(&act.sa_mask);
#ifdef SA_SIGINFO
- act.sa_sigaction = OsSigHandler;
- act.sa_flags = SA_SIGINFO;
+ act.sa_sigaction = OsSigHandler;
+ act.sa_flags = SA_SIGINFO;
#else
act.sa_handler = OsSigHandler;
act.sa_flags = 0;
#endif
- for (i = 0; siglist[i] != 0; i++) {
- if (sigaction(siglist[i], &act, &oact)) {
- ErrorF("failed to install signal handler for signal %d: %s\n",
- siglist[i], strerror(errno));
- }
- }
+ for (i = 0; siglist[i] != 0; i++) {
+ if (sigaction(siglist[i], &act, &oact)) {
+ ErrorF("failed to install signal handler for signal %d: %s\n",
+ siglist[i], strerror(errno));
+ }
+ }
#ifdef HAVE_BACKTRACE
- /*
- * initialize the backtracer, since the ctor calls dlopen(), which
- * calls malloc(), which isn't signal-safe.
- */
- do {
- void *array;
- backtrace(&array, 1);
- } while (0);
+ /*
+ * initialize the backtracer, since the ctor calls dlopen(), which
+ * calls malloc(), which isn't signal-safe.
+ */
+ do {
+ void *array;
+
+ backtrace(&array, 1);
+ } while (0);
#endif
#ifdef RTLD_DI_SETSIGNAL
- /* Tell runtime linker to send a signal we can catch instead of SIGKILL
- * for failures to load libraries/modules at runtime so we can clean up
- * after ourselves.
- */
- int failure_signal = SIGQUIT;
- dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal);
+ /* Tell runtime linker to send a signal we can catch instead of SIGKILL
+ * for failures to load libraries/modules at runtime so we can clean up
+ * after ourselves.
+ */
+ int failure_signal = SIGQUIT;
+
+ dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal);
#endif
#endif
-#if !defined(__CYGWIN__)
- fclose(stdin);
- fclose(stdout);
+#if !defined(__CYGWIN__)
+ fclose(stdin);
+ fclose(stdout);
#endif
- /*
- * If a write of zero bytes to stderr returns non-zero, i.e. -1,
- * then writing to stderr failed, and we'll write somewhere else
- * instead. (Apparently this never happens in the Real World.)
- */
- if (write (2, fname, 0) == -1)
- {
- FILE *err;
-
- if (strlen (display) + strlen (ADMPATH) + 1 < sizeof fname)
- snprintf (fname, sizeof(fname), ADMPATH, display);
- else
- strcpy (fname, devnull);
- /*
- * uses stdio to avoid os dependencies here,
- * a real os would use
- * open (fname, O_WRONLY|O_APPEND|O_CREAT, 0666)
- */
- if (!(err = fopen (fname, "a+")))
- err = fopen (devnull, "w");
- if (err && (fileno(err) != 2)) {
- dup2 (fileno (err), 2);
- fclose (err);
- }
+ /*
+ * If a write of zero bytes to stderr returns non-zero, i.e. -1,
+ * then writing to stderr failed, and we'll write somewhere else
+ * instead. (Apparently this never happens in the Real World.)
+ */
+ if (write(2, fname, 0) == -1) {
+ FILE *err;
+
+ if (strlen(display) + strlen(ADMPATH) + 1 < sizeof fname)
+ snprintf(fname, sizeof(fname), ADMPATH, display);
+ else
+ strcpy(fname, devnull);
+ /*
+ * uses stdio to avoid os dependencies here,
+ * a real os would use
+ * open (fname, O_WRONLY|O_APPEND|O_CREAT, 0666)
+ */
+ if (!(err = fopen(fname, "a+")))
+ err = fopen(devnull, "w");
+ if (err && (fileno(err) != 2)) {
+ dup2(fileno(err), 2);
+ fclose(err);
+ }
#if defined(SYSV) || defined(SVR4) || defined(WIN32) || defined(__CYGWIN__)
- {
- static char buf[BUFSIZ];
- setvbuf (stderr, buf, _IOLBF, BUFSIZ);
- }
+ {
+ static char buf[BUFSIZ];
+
+ setvbuf(stderr, buf, _IOLBF, BUFSIZ);
+ }
#else
- setlinebuf(stderr);
+ setlinebuf(stderr);
#endif
- }
+ }
#ifndef _MSC_VER
- if (getpgrp () == 0)
- setpgid (0, 0);
+ if (getpgrp() == 0)
+ setpgid(0, 0);
#endif
#ifdef RLIMIT_DATA
- if (limitDataSpace >= 0)
- {
- struct rlimit rlim;
-
- if (!getrlimit(RLIMIT_DATA, &rlim))
- {
- if ((limitDataSpace > 0) && (limitDataSpace < rlim.rlim_max))
- rlim.rlim_cur = limitDataSpace;
- else
- rlim.rlim_cur = rlim.rlim_max;
- (void)setrlimit(RLIMIT_DATA, &rlim);
- }
- }
+ if (limitDataSpace >= 0) {
+ struct rlimit rlim;
+
+ if (!getrlimit(RLIMIT_DATA, &rlim)) {
+ if ((limitDataSpace > 0) && (limitDataSpace < rlim.rlim_max))
+ rlim.rlim_cur = limitDataSpace;
+ else
+ rlim.rlim_cur = rlim.rlim_max;
+ (void) setrlimit(RLIMIT_DATA, &rlim);
+ }
+ }
#endif
#ifdef RLIMIT_STACK
- if (limitStackSpace >= 0)
- {
- struct rlimit rlim;
-
- if (!getrlimit(RLIMIT_STACK, &rlim))
- {
- if ((limitStackSpace > 0) && (limitStackSpace < rlim.rlim_max))
- rlim.rlim_cur = limitStackSpace;
- else
- rlim.rlim_cur = rlim.rlim_max;
- (void)setrlimit(RLIMIT_STACK, &rlim);
- }
- }
+ if (limitStackSpace >= 0) {
+ struct rlimit rlim;
+
+ if (!getrlimit(RLIMIT_STACK, &rlim)) {
+ if ((limitStackSpace > 0) && (limitStackSpace < rlim.rlim_max))
+ rlim.rlim_cur = limitStackSpace;
+ else
+ rlim.rlim_cur = rlim.rlim_max;
+ (void) setrlimit(RLIMIT_STACK, &rlim);
+ }
+ }
#endif
#ifdef RLIMIT_NOFILE
- if (limitNoFile >= 0)
- {
- struct rlimit rlim;
-
- if (!getrlimit(RLIMIT_NOFILE, &rlim))
- {
- if ((limitNoFile > 0) && (limitNoFile < rlim.rlim_max))
- rlim.rlim_cur = limitNoFile;
- else
- rlim.rlim_cur = rlim.rlim_max;
- (void)setrlimit(RLIMIT_NOFILE, &rlim);
- }
- }
+ if (limitNoFile >= 0) {
+ struct rlimit rlim;
+
+ if (!getrlimit(RLIMIT_NOFILE, &rlim)) {
+ if ((limitNoFile > 0) && (limitNoFile < rlim.rlim_max))
+ rlim.rlim_cur = limitNoFile;
+ else
+ rlim.rlim_cur = rlim.rlim_max;
+ (void) setrlimit(RLIMIT_NOFILE, &rlim);
+ }
+ }
#endif
- LockServer();
- been_here = TRUE;
+ LockServer();
+ been_here = TRUE;
}
TimerInit();
OsVendorInit();
@@ -298,14 +296,13 @@ OsInit(void)
* log file name if logging to a file is desired.
*/
LogInit(NULL, NULL);
- SmartScheduleInit ();
+ SmartScheduleInit();
}
void
OsCleanup(Bool terminating)
{
- if (terminating)
- {
- UnlockServer();
+ if (terminating) {
+ UnlockServer();
}
}
diff --git a/xorg-server/os/rpcauth.c b/xorg-server/os/rpcauth.c
index 63b97b675..bd219acfa 100644
--- a/xorg-server/os/rpcauth.c
+++ b/xorg-server/os/rpcauth.c
@@ -31,7 +31,6 @@ from The Open Group.
* Author: Mayank Choudhary, Sun Microsystems
*/
-
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -54,29 +53,29 @@ extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
static enum auth_stat why;
-static char *
+static char *
authdes_ezdecode(const char *inmsg, int len)
{
- struct rpc_msg msg;
- char cred_area[MAX_AUTH_BYTES];
- char verf_area[MAX_AUTH_BYTES];
- char *temp_inmsg;
- struct svc_req r;
- bool_t res0, res1;
- XDR xdr;
- SVCXPRT xprt;
+ struct rpc_msg msg;
+ char cred_area[MAX_AUTH_BYTES];
+ char verf_area[MAX_AUTH_BYTES];
+ char *temp_inmsg;
+ struct svc_req r;
+ bool_t res0, res1;
+ XDR xdr;
+ SVCXPRT xprt;
temp_inmsg = malloc(len);
memmove(temp_inmsg, inmsg, len);
- memset((char *)&msg, 0, sizeof(msg));
- memset((char *)&r, 0, sizeof(r));
+ memset((char *) &msg, 0, sizeof(msg));
+ memset((char *) &r, 0, sizeof(r));
memset(cred_area, 0, sizeof(cred_area));
memset(verf_area, 0, sizeof(verf_area));
msg.rm_call.cb_cred.oa_base = cred_area;
msg.rm_call.cb_verf.oa_base = verf_area;
- why = AUTH_FAILED;
+ why = AUTH_FAILED;
xdrmem_create(&xdr, temp_inmsg, len, XDR_DECODE);
if ((r.rq_clntcred = malloc(MAX_AUTH_BYTES)) == NULL)
@@ -84,14 +83,14 @@ authdes_ezdecode(const char *inmsg, int len)
r.rq_xprt = &xprt;
/* decode into msg */
- res0 = xdr_opaque_auth(&xdr, &(msg.rm_call.cb_cred));
+ res0 = xdr_opaque_auth(&xdr, &(msg.rm_call.cb_cred));
res1 = xdr_opaque_auth(&xdr, &(msg.rm_call.cb_verf));
- if ( ! (res0 && res1) )
- goto bad2;
+ if (!(res0 && res1))
+ goto bad2;
/* do the authentication */
- r.rq_cred = msg.rm_call.cb_cred; /* read by opaque stuff */
+ r.rq_cred = msg.rm_call.cb_cred; /* read by opaque stuff */
if (r.rq_cred.oa_flavor != AUTH_DES) {
why = AUTH_TOOWEAK;
goto bad2;
@@ -101,94 +100,92 @@ authdes_ezdecode(const char *inmsg, int len)
#else
if ((why = _authenticate(&r, &msg)) != AUTH_OK) {
#endif
- goto bad2;
+ goto bad2;
}
- return (((struct authdes_cred *) r.rq_clntcred)->adc_fullname.name);
+ return (((struct authdes_cred *) r.rq_clntcred)->adc_fullname.name);
-bad2:
+ bad2:
free(r.rq_clntcred);
-bad1:
- return ((char *)0); /* ((struct authdes_cred *) NULL); */
+ bad1:
+ return ((char *) 0); /* ((struct authdes_cred *) NULL); */
}
-static XID rpc_id = (XID) ~0L;
+static XID rpc_id = (XID) ~0L;
static Bool
-CheckNetName (
- unsigned char *addr,
- short len,
- pointer closure
-)
+CheckNetName(unsigned char *addr, short len, pointer closure)
{
- return (len == strlen ((char *) closure) &&
- strncmp ((char *) addr, (char *) closure, len) == 0);
+ return (len == strlen((char *) closure) &&
+ strncmp((char *) addr, (char *) closure, len) == 0);
}
-static char rpc_error[MAXNETNAMELEN+50];
+static char rpc_error[MAXNETNAMELEN + 50];
_X_HIDDEN XID
-SecureRPCCheck (unsigned short data_length, const char *data,
- ClientPtr client, const char **reason)
+SecureRPCCheck(unsigned short data_length, const char *data,
+ ClientPtr client, const char **reason)
{
char *fullname;
-
+
if (rpc_id == (XID) ~0L) {
- *reason = "Secure RPC authorization not initialized";
- } else {
- fullname = authdes_ezdecode(data, data_length);
- if (fullname == (char *)0) {
- snprintf(rpc_error, sizeof(rpc_error),
- "Unable to authenticate secure RPC client (why=%d)", why);
- *reason = rpc_error;
- } else {
- if (ForEachHostInFamily (FamilyNetname, CheckNetName, fullname))
- return rpc_id;
- snprintf(rpc_error, sizeof(rpc_error),
- "Principal \"%s\" is not authorized to connect", fullname);
- *reason = rpc_error;
- }
+ *reason = "Secure RPC authorization not initialized";
+ }
+ else {
+ fullname = authdes_ezdecode(data, data_length);
+ if (fullname == (char *) 0) {
+ snprintf(rpc_error, sizeof(rpc_error),
+ "Unable to authenticate secure RPC client (why=%d)", why);
+ *reason = rpc_error;
+ }
+ else {
+ if (ForEachHostInFamily(FamilyNetname, CheckNetName, fullname))
+ return rpc_id;
+ snprintf(rpc_error, sizeof(rpc_error),
+ "Principal \"%s\" is not authorized to connect", fullname);
+ *reason = rpc_error;
+ }
}
return (XID) ~0L;
}
-
+
_X_HIDDEN void
-SecureRPCInit (void)
+SecureRPCInit(void)
{
if (rpc_id == ~0L)
- AddAuthorization (9, "SUN-DES-1", 0, (char *) 0);
+ AddAuthorization(9, "SUN-DES-1", 0, (char *) 0);
}
_X_HIDDEN int
-SecureRPCAdd (unsigned short data_length, const char *data, XID id)
+SecureRPCAdd(unsigned short data_length, const char *data, XID id)
{
if (data_length)
- AddHost ((pointer) 0, FamilyNetname, data_length, data);
+ AddHost((pointer) 0, FamilyNetname, data_length, data);
rpc_id = id;
return 1;
}
_X_HIDDEN int
-SecureRPCReset (void)
+SecureRPCReset(void)
{
rpc_id = (XID) ~0L;
return 1;
}
_X_HIDDEN XID
-SecureRPCToID (unsigned short data_length, char *data)
+SecureRPCToID(unsigned short data_length, char *data)
{
return rpc_id;
}
_X_HIDDEN int
-SecureRPCFromID (XID id, unsigned short *data_lenp, char **datap)
+SecureRPCFromID(XID id, unsigned short *data_lenp, char **datap)
{
return 0;
}
_X_HIDDEN int
-SecureRPCRemove (unsigned short data_length, const char *data)
+SecureRPCRemove(unsigned short data_length, const char *data)
{
return 0;
}
-#endif /* SECURE_RPC */
+#endif /* SECURE_RPC */
diff --git a/xorg-server/os/strlcpy.c b/xorg-server/os/strlcpy.c
index 7ffb64cd6..52e7203b2 100644
--- a/xorg-server/os/strlcpy.c
+++ b/xorg-server/os/strlcpy.c
@@ -31,26 +31,25 @@
size_t
strlcpy(char *dst, const char *src, size_t siz)
{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
+ register char *d = dst;
+ register const char *s = src;
+ register size_t n = siz;
- /* Copy as many bytes as will fit */
- if (n != 0 && --n != 0) {
- do {
- if ((*d++ = *s++) == 0)
- break;
- } while (--n != 0);
- }
+ /* Copy as many bytes as will fit */
+ if (n != 0 && --n != 0) {
+ do {
+ if ((*d++ = *s++) == 0)
+ break;
+ } while (--n != 0);
+ }
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0) {
- if (siz != 0)
- *d = '\0'; /* NUL-terminate dst */
- while (*s++)
- ;
- }
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++);
+ }
- return s - src - 1; /* count does not include NUL */
+ return s - src - 1; /* count does not include NUL */
}
#endif
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index d7e88c708..dbed76132 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -24,7 +24,6 @@ not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
Copyright 1994 Quarterdeck Office Systems.
@@ -99,19 +98,19 @@ __stdcall unsigned long GetTickCount(void);
#ifndef WIN32
#include <sys/wait.h>
#endif
-#if !defined(SYSV) && !defined(WIN32)
+#if !defined(SYSV) && !defined(WIN32)
#include <sys/resource.h>
#endif
#include <sys/stat.h>
-#include <ctype.h> /* for isspace */
+#include <ctype.h> /* for isspace */
#include <stdarg.h>
-#include <stdlib.h> /* for malloc() */
+#include <stdlib.h> /* for malloc() */
#if defined(TCPCONN) || defined(STREAMSCONN)
-# ifndef WIN32
-# include <netdb.h>
-# endif
+#ifndef WIN32
+#include <netdb.h>
+#endif
#endif
#include "opaque.h"
@@ -123,6 +122,7 @@ __stdcall unsigned long GetTickCount(void);
#include "picture.h"
Bool noTestExtensions;
+
#ifdef COMPOSITE
Bool noCompositeExtension = FALSE;
#endif
@@ -150,6 +150,7 @@ Bool noMITShmExtension = FALSE;
Bool noRRExtension = FALSE;
#endif
Bool noRenderExtension = FALSE;
+
#ifdef XCSECURITY
Bool noSecurityExtension = FALSE;
#endif
@@ -222,11 +223,11 @@ OsSignal(int sig, OsSigHandlerPtr handler)
sigemptyset(&act.sa_mask);
if (handler != SIG_IGN)
- sigaddset(&act.sa_mask, sig);
+ sigaddset(&act.sa_mask, sig);
act.sa_flags = 0;
act.sa_handler = handler;
if (sigaction(sig, &act, &oact))
- perror("sigaction");
+ perror("sigaction");
return oact.sa_handler;
#endif
}
@@ -267,121 +268,123 @@ LockServer(void)
FatalError("Server is already active for display %d\n", atoi(display));
}
#else
- char tmp[PATH_MAX], pid_str[12];
- int lfd, i, haslock, l_pid, t;
- const char *tmppath = LOCK_DIR;
- int len;
- char port[20];
-
- if (nolock) return;
- /*
- * Path names
- */
- snprintf(port, sizeof(port), "%d", atoi(display));
- len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) :
- strlen(LOCK_TMP_PREFIX);
- len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1;
- if (len > sizeof(LockFile))
- FatalError("Display name `%s' is too long\n", port);
- (void)sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
- (void)sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
-
- /*
- * Create a temporary file containing our PID. Attempt three times
- * to create the file.
- */
- StillLocking = TRUE;
- i = 0;
- do {
- i++;
- lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644);
- if (lfd < 0)
- sleep(2);
- else
- break;
- } while (i < 3);
- if (lfd < 0) {
- unlink(tmp);
+ char tmp[PATH_MAX], pid_str[12];
+ int lfd, i, haslock, l_pid, t;
+ const char *tmppath = LOCK_DIR;
+ int len;
+ char port[20];
+
+ if (nolock)
+ return;
+ /*
+ * Path names
+ */
+ snprintf(port, sizeof(port), "%d", atoi(display));
+ len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) :
+ strlen(LOCK_TMP_PREFIX);
+ len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1;
+ if (len > sizeof(LockFile))
+ FatalError("Display name `%s' is too long\n", port);
+ (void) sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
+ (void) sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
+
+ /*
+ * Create a temporary file containing our PID. Attempt three times
+ * to create the file.
+ */
+ StillLocking = TRUE;
i = 0;
do {
- i++;
- lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644);
- if (lfd < 0)
- sleep(2);
- else
- break;
+ i++;
+ lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644);
+ if (lfd < 0)
+ sleep(2);
+ else
+ break;
} while (i < 3);
- }
- if (lfd < 0)
- FatalError("Could not create lock file in %s\n", tmp);
- snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long)getpid());
- (void) write(lfd, pid_str, 11);
- (void) fchmod(lfd, 0444);
- (void) close(lfd);
-
- /*
- * OK. Now the tmp file exists. Try three times to move it in place
- * for the lock.
- */
- i = 0;
- haslock = 0;
- while ((!haslock) && (i++ < 3)) {
- haslock = (link(tmp,LockFile) == 0);
- if (haslock) {
- /*
- * We're done.
- */
- break;
- }
- else {
- /*
- * Read the pid from the existing file
- */
- lfd = open(LockFile, O_RDONLY|O_NOFOLLOW);
- if (lfd < 0) {
+ if (lfd < 0) {
unlink(tmp);
- FatalError("Can't read lock file %s\n", LockFile);
- }
- pid_str[0] = '\0';
- if (read(lfd, pid_str, 11) != 11) {
- /*
- * Bogus lock file.
- */
- unlink(LockFile);
- close(lfd);
- continue;
- }
- pid_str[11] = '\0';
- sscanf(pid_str, "%d", &l_pid);
- close(lfd);
-
- /*
- * Now try to kill the PID to see if it exists.
- */
- errno = 0;
- t = kill(l_pid, 0);
- if ((t< 0) && (errno == ESRCH)) {
- /*
- * Stale lock file.
- */
- unlink(LockFile);
- continue;
- }
- else if (((t < 0) && (errno == EPERM)) || (t == 0)) {
- /*
- * Process is still active.
- */
- unlink(tmp);
- FatalError("Server is already active for display %s\n%s %s\n%s\n",
- port, "\tIf this server is no longer running, remove",
- LockFile, "\tand start again.");
- }
+ i = 0;
+ do {
+ i++;
+ lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644);
+ if (lfd < 0)
+ sleep(2);
+ else
+ break;
+ } while (i < 3);
}
- }
- unlink(tmp);
- if (!haslock)
- FatalError("Could not create server lock file: %s\n", LockFile);
- StillLocking = FALSE;
+ if (lfd < 0)
+ FatalError("Could not create lock file in %s\n", tmp);
+ snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long) getpid());
+ (void) write(lfd, pid_str, 11);
+ (void) fchmod(lfd, 0444);
+ (void) close(lfd);
+
+ /*
+ * OK. Now the tmp file exists. Try three times to move it in place
+ * for the lock.
+ */
+ i = 0;
+ haslock = 0;
+ while ((!haslock) && (i++ < 3)) {
+ haslock = (link(tmp, LockFile) == 0);
+ if (haslock) {
+ /*
+ * We're done.
+ */
+ break;
+ }
+ else {
+ /*
+ * Read the pid from the existing file
+ */
+ lfd = open(LockFile, O_RDONLY | O_NOFOLLOW);
+ if (lfd < 0) {
+ unlink(tmp);
+ FatalError("Can't read lock file %s\n", LockFile);
+ }
+ pid_str[0] = '\0';
+ if (read(lfd, pid_str, 11) != 11) {
+ /*
+ * Bogus lock file.
+ */
+ unlink(LockFile);
+ close(lfd);
+ continue;
+ }
+ pid_str[11] = '\0';
+ sscanf(pid_str, "%d", &l_pid);
+ close(lfd);
+
+ /*
+ * Now try to kill the PID to see if it exists.
+ */
+ errno = 0;
+ t = kill(l_pid, 0);
+ if ((t < 0) && (errno == ESRCH)) {
+ /*
+ * Stale lock file.
+ */
+ unlink(LockFile);
+ continue;
+ }
+ else if (((t < 0) && (errno == EPERM)) || (t == 0)) {
+ /*
+ * Process is still active.
+ */
+ unlink(tmp);
+ FatalError
+ ("Server is already active for display %s\n%s %s\n%s\n",
+ port, "\tIf this server is no longer running, remove",
+ LockFile, "\tand start again.");
+ }
+ }
+ }
+ unlink(tmp);
+ if (!haslock)
+ FatalError("Could not create server lock file: %s\n", LockFile);
+ StillLocking = FALSE;
#endif
}
@@ -392,18 +395,19 @@ LockServer(void)
void
UnlockServer(void)
{
- if (nolock) return;
+ if (nolock)
+ return;
- if (!StillLocking){
+ if (!StillLocking) {
- (void) unlink(LockFile);
- }
+ (void) unlink(LockFile);
+ }
}
/* Force connections to close on SIGHUP from init */
void
-AutoResetServer (int sig)
+AutoResetServer(int sig)
{
int olderrno = errno;
@@ -426,9 +430,9 @@ GiveUp(int sig)
#if (defined WIN32 && defined __MINGW32__) || defined(__CYGWIN__)
CARD32
-GetTimeInMillis (void)
+GetTimeInMillis(void)
{
- return GetTickCount ();
+ return GetTickCount();
}
#else
CARD32
@@ -439,6 +443,7 @@ GetTimeInMillis(void)
#ifdef MONOTONIC_CLOCK
struct timespec tp;
static clockid_t clockid;
+
if (!clockid) {
#ifdef CLOCK_MONOTONIC_COARSE
if (clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 &&
@@ -457,35 +462,33 @@ GetTimeInMillis(void)
#endif
X_GETTIMEOFDAY(&tv);
- return(tv.tv_sec * 1000) + (tv.tv_usec / 1000);
+ return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}
#endif
void
-AdjustWaitForDelay (pointer waitTime, unsigned long newdelay)
+AdjustWaitForDelay(pointer waitTime, unsigned long newdelay)
{
- static struct timeval delay_val;
- struct timeval **wt = (struct timeval **) waitTime;
- unsigned long olddelay;
-
- if (*wt == NULL)
- {
- delay_val.tv_sec = newdelay / 1000;
- delay_val.tv_usec = 1000 * (newdelay % 1000);
- *wt = &delay_val;
+ static struct timeval delay_val;
+ struct timeval **wt = (struct timeval **) waitTime;
+ unsigned long olddelay;
+
+ if (*wt == NULL) {
+ delay_val.tv_sec = newdelay / 1000;
+ delay_val.tv_usec = 1000 * (newdelay % 1000);
+ *wt = &delay_val;
}
- else
- {
- olddelay = (*wt)->tv_sec * 1000 + (*wt)->tv_usec / 1000;
- if (newdelay < olddelay)
- {
- (*wt)->tv_sec = newdelay / 1000;
- (*wt)->tv_usec = 1000 * (newdelay % 1000);
- }
+ else {
+ olddelay = (*wt)->tv_sec * 1000 + (*wt)->tv_usec / 1000;
+ if (newdelay < olddelay) {
+ (*wt)->tv_sec = newdelay / 1000;
+ (*wt)->tv_usec = 1000 * (newdelay % 1000);
+ }
}
}
-void UseMsg(void)
+void
+UseMsg(void)
{
ErrorF("Usage...\nVcxsrv [:<display>] [option]\n\n");
ErrorF(":display-number\n\tVcxsrv runs as the given display-number, which defaults to 0.\n");
@@ -493,8 +496,8 @@ void UseMsg(void)
ErrorF("-a # default pointer acceleration (factor)\n");
ErrorF("-ac disable access control restrictions\n");
- ErrorF("-audit int set audit trail level\n");
- ErrorF("-auth file select authorization file\n");
+ ErrorF("-audit int set audit trail level\n");
+ ErrorF("-auth file select authorization file\n");
ErrorF("-br create root window with black background\n");
ErrorF("+bs enable any backing store support\n");
ErrorF("-bs disable any backing store support\n");
@@ -509,7 +512,8 @@ void UseMsg(void)
#ifdef DPMSExtension
ErrorF("-dpms disables VESA DPMS monitor control\n");
#endif
- ErrorF("-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs\n");
+ ErrorF
+ ("-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs\n");
ErrorF("-f # bell base (0-100)\n");
ErrorF("-fc string cursor font\n");
ErrorF("-fn string default font name\n");
@@ -547,7 +551,8 @@ void UseMsg(void)
ErrorF("+xinerama Enable XINERAMA extension\n");
ErrorF("-xinerama Disable XINERAMA extension\n");
#endif
- ErrorF("-dumbSched Disable smart scheduling, enable old behavior\n");
+ ErrorF
+ ("-dumbSched Disable smart scheduling, enable old behavior\n");
ErrorF("-schedInterval int Set scheduler interval in msec\n");
ErrorF("+extension name Enable extension\n");
ErrorF("-extension name Disable extension\n");
@@ -565,14 +570,19 @@ void UseMsg(void)
* not contain a "/" and not start with a "-".
* --kvajk
*/
-static int
+static int
VerifyDisplayName(const char *d)
{
- if ( d == (char *)0 ) return 0; /* null */
- if ( *d == '\0' ) return 0; /* empty */
- if ( *d == '-' ) return 0; /* could be confused for an option */
- if ( *d == '.' ) return 0; /* must not equal "." or ".." */
- if ( strchr(d, '/') != (char *)0 ) return 0; /* very important!!! */
+ if (d == (char *) 0)
+ return 0; /* null */
+ if (*d == '\0')
+ return 0; /* empty */
+ if (*d == '-')
+ return 0; /* could be confused for an option */
+ if (*d == '.')
+ return 0; /* must not equal "." or ".." */
+ if (strchr(d, '/') != (char *) 0)
+ return 0; /* very important!!! */
return 1;
}
@@ -594,388 +604,340 @@ ProcessCommandLine(int argc, char *argv[])
PartialNetwork = TRUE;
#endif
- for ( i = 1; i < argc; i++ )
- {
- /* call ddx first, so it can peek/override if it wants */
- if((skip = ddxProcessArgument(argc, argv, i)))
- {
- i += (skip - 1);
- }
- else if(argv[i][0] == ':')
- {
- /* initialize display */
- display = argv[i];
- display++;
- if( ! VerifyDisplayName( display ) ) {
+ for (i = 1; i < argc; i++) {
+ /* call ddx first, so it can peek/override if it wants */
+ if ((skip = ddxProcessArgument(argc, argv, i))) {
+ i += (skip - 1);
+ }
+ else if (argv[i][0] == ':') {
+ /* initialize display */
+ display = argv[i];
+ display++;
+ if (!VerifyDisplayName(display)) {
ErrorF("Bad display name: %s\n", display);
UseMsg();
- FatalError("Bad display name, exiting: %s\n", display);
+ FatalError("Bad display name, exiting: %s\n", display);
}
- }
- else if ( strcmp( argv[i], "-a") == 0)
- {
- if(++i < argc)
- defaultPointerControl.num = atoi(argv[i]);
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-ac") == 0)
- {
- defeatAccessControl = TRUE;
- }
- else if ( strcmp( argv[i], "-audit") == 0)
- {
- if(++i < argc)
- auditTrailLevel = atoi(argv[i]);
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-auth") == 0)
- {
- if(++i < argc)
- InitAuthorization (argv[i]);
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-br") == 0) ; /* default */
- else if ( strcmp( argv[i], "+bs") == 0)
- enableBackingStore = TRUE;
- else if ( strcmp( argv[i], "-bs") == 0)
- disableBackingStore = TRUE;
- else if ( strcmp( argv[i], "-cc") == 0)
- {
- if(++i < argc)
- defaultColorVisualClass = atoi(argv[i]);
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-core") == 0)
- {
+ }
+ else if (strcmp(argv[i], "-a") == 0) {
+ if (++i < argc)
+ defaultPointerControl.num = atoi(argv[i]);
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-ac") == 0) {
+ defeatAccessControl = TRUE;
+ }
+ else if (strcmp(argv[i], "-audit") == 0) {
+ if (++i < argc)
+ auditTrailLevel = atoi(argv[i]);
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-auth") == 0) {
+ if (++i < argc)
+ InitAuthorization(argv[i]);
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-br") == 0); /* default */
+ else if (strcmp(argv[i], "+bs") == 0)
+ enableBackingStore = TRUE;
+ else if (strcmp(argv[i], "-bs") == 0)
+ disableBackingStore = TRUE;
+ else if (strcmp(argv[i], "-cc") == 0) {
+ if (++i < argc)
+ defaultColorVisualClass = atoi(argv[i]);
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-core") == 0) {
#if !defined(WIN32) || !defined(__MINGW32__)
- struct rlimit core_limit;
- getrlimit (RLIMIT_CORE, &core_limit);
- core_limit.rlim_cur = core_limit.rlim_max;
- setrlimit (RLIMIT_CORE, &core_limit);
-#endif
- CoreDump = TRUE;
- }
- else if ( strcmp( argv[i], "-nocursor") == 0)
- {
+ struct rlimit core_limit;
+
+ getrlimit(RLIMIT_CORE, &core_limit);
+ core_limit.rlim_cur = core_limit.rlim_max;
+ setrlimit(RLIMIT_CORE, &core_limit);
+#endif
+ CoreDump = TRUE;
+ }
+ else if (strcmp(argv[i], "-nocursor") == 0) {
EnableCursor = FALSE;
}
- else if ( strcmp( argv[i], "-dpi") == 0)
- {
- if(++i < argc)
+ else if (strcmp(argv[i], "-dpi") == 0) {
+ if (++i < argc)
#ifdef _MSC_VER
- {
- if (strcmp(argv[i], "auto") == 0)
- {
- HDC hdc = GetDC(NULL);
- if (hdc)
- {
- int dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
- monitorResolution = dpiY;
- ReleaseDC(NULL, hdc);
- }
- }
- else if (isdigit(*argv[i])) /* Naively prevent a crash if not numeric */
- monitorResolution = atoi(argv[i]);
- }
+ {
+ if (strcmp(argv[i], "auto") == 0)
+ {
+ HDC hdc = GetDC(NULL);
+ if (hdc)
+ {
+ int dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
+ monitorResolution = dpiY;
+ ReleaseDC(NULL, hdc);
+ }
+ }
+ else if (isdigit(*argv[i])) /* Naively prevent a crash if not numeric */
+ monitorResolution = atoi(argv[i]);
+ }
#else
- monitorResolution = atoi(argv[i]);
+ monitorResolution = atoi(argv[i]);
#endif
- else
- UseMsg();
- }
+ else
+ UseMsg();
+ }
#ifdef DPMSExtension
- else if ( strcmp( argv[i], "dpms") == 0)
- /* ignored for compatibility */ ;
- else if ( strcmp( argv[i], "-dpms") == 0)
- DPMSDisabledSwitch = TRUE;
-#endif
- else if ( strcmp( argv[i], "-deferglyphs") == 0)
- {
- if(++i >= argc || !ParseGlyphCachingMode(argv[i]))
- UseMsg();
- }
- else if ( strcmp( argv[i], "-f") == 0)
- {
- if(++i < argc)
- defaultKeyboardControl.bell = atoi(argv[i]);
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-fc") == 0)
- {
- if(++i < argc)
- defaultCursorFont = argv[i];
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-fn") == 0)
- {
- if(++i < argc)
- defaultTextFont = argv[i];
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-fp") == 0)
- {
- if(++i < argc)
- {
- defaultFontPath = argv[i];
- }
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-help") == 0)
- {
- UseMsg();
- exit(0);
- }
- else if ( (skip=XkbProcessArguments(argc,argv,i))!=0 ) {
- if (skip>0)
- i+= skip-1;
- else UseMsg();
- }
+ else if (strcmp(argv[i], "dpms") == 0)
+ /* ignored for compatibility */ ;
+ else if (strcmp(argv[i], "-dpms") == 0)
+ DPMSDisabledSwitch = TRUE;
+#endif
+ else if (strcmp(argv[i], "-deferglyphs") == 0) {
+ if (++i >= argc || !ParseGlyphCachingMode(argv[i]))
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-f") == 0) {
+ if (++i < argc)
+ defaultKeyboardControl.bell = atoi(argv[i]);
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-fc") == 0) {
+ if (++i < argc)
+ defaultCursorFont = argv[i];
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-fn") == 0) {
+ if (++i < argc)
+ defaultTextFont = argv[i];
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-fp") == 0) {
+ if (++i < argc) {
+ defaultFontPath = argv[i];
+ }
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-help") == 0) {
+ UseMsg();
+ exit(0);
+ }
+ else if ((skip = XkbProcessArguments(argc, argv, i)) != 0) {
+ if (skip > 0)
+ i += skip - 1;
+ else
+ UseMsg();
+ }
#ifdef RLIMIT_DATA
- else if ( strcmp( argv[i], "-ld") == 0)
- {
- if(++i < argc)
- {
- limitDataSpace = atoi(argv[i]);
- if (limitDataSpace > 0)
- limitDataSpace *= 1024;
- }
- else
- UseMsg();
- }
+ else if (strcmp(argv[i], "-ld") == 0) {
+ if (++i < argc) {
+ limitDataSpace = atoi(argv[i]);
+ if (limitDataSpace > 0)
+ limitDataSpace *= 1024;
+ }
+ else
+ UseMsg();
+ }
#endif
#ifdef RLIMIT_NOFILE
- else if ( strcmp( argv[i], "-lf") == 0)
- {
- if(++i < argc)
- limitNoFile = atoi(argv[i]);
- else
- UseMsg();
- }
+ else if (strcmp(argv[i], "-lf") == 0) {
+ if (++i < argc)
+ limitNoFile = atoi(argv[i]);
+ else
+ UseMsg();
+ }
#endif
#ifdef RLIMIT_STACK
- else if ( strcmp( argv[i], "-ls") == 0)
- {
- if(++i < argc)
- {
- limitStackSpace = atoi(argv[i]);
- if (limitStackSpace > 0)
- limitStackSpace *= 1024;
- }
- else
- UseMsg();
- }
-#endif
- else if ( strcmp ( argv[i], "-nolock") == 0)
- {
+ else if (strcmp(argv[i], "-ls") == 0) {
+ if (++i < argc) {
+ limitStackSpace = atoi(argv[i]);
+ if (limitStackSpace > 0)
+ limitStackSpace *= 1024;
+ }
+ else
+ UseMsg();
+ }
+#endif
+ else if (strcmp(argv[i], "-nolock") == 0) {
#if !defined(WIN32) && !defined(__CYGWIN__)
- if (getuid() != 0)
- ErrorF("Warning: the -nolock option can only be used by root\n");
- else
-#endif
- nolock = TRUE;
- }
- else if ( strcmp( argv[i], "-nolisten") == 0)
- {
- if(++i < argc) {
- if (_XSERVTransNoListen(argv[i]))
- FatalError ("Failed to disable listen for %s transport",
- argv[i]);
- } else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-noreset") == 0)
- {
- dispatchExceptionAtReset = 0;
- }
- else if ( strcmp( argv[i], "-reset") == 0)
- {
- dispatchExceptionAtReset = DE_RESET;
- }
- else if ( strcmp( argv[i], "-p") == 0)
- {
- if(++i < argc)
- defaultScreenSaverInterval = ((CARD32)atoi(argv[i])) *
- MILLI_PER_MIN;
- else
- UseMsg();
- }
- else if (strcmp(argv[i], "-pogo") == 0)
- {
- dispatchException = DE_TERMINATE;
- }
- else if ( strcmp( argv[i], "-pn") == 0)
- PartialNetwork = TRUE;
- else if ( strcmp( argv[i], "-nopn") == 0)
- PartialNetwork = FALSE;
- else if ( strcmp( argv[i], "r") == 0)
- defaultKeyboardControl.autoRepeat = TRUE;
- else if ( strcmp( argv[i], "-r") == 0)
- defaultKeyboardControl.autoRepeat = FALSE;
- else if ( strcmp( argv[i], "-retro") == 0)
- party_like_its_1989 = TRUE;
- else if ( strcmp( argv[i], "-s") == 0)
- {
- if(++i < argc)
- defaultScreenSaverTime = ((CARD32)atoi(argv[i])) *
- MILLI_PER_MIN;
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-seat") == 0)
- {
- if(++i < argc)
- SeatId = argv[i];
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-t") == 0)
- {
- if(++i < argc)
- defaultPointerControl.threshold = atoi(argv[i]);
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-terminate") == 0)
- {
- dispatchExceptionAtReset = DE_TERMINATE;
- }
- else if ( strcmp( argv[i], "-to") == 0)
- {
- if(++i < argc)
- TimeOutValue = ((CARD32)atoi(argv[i])) * MILLI_PER_SECOND;
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-tst") == 0)
- {
- noTestExtensions = TRUE;
- }
- else if ( strcmp( argv[i], "-wm") == 0)
- defaultBackingStore = WhenMapped;
- else if ( strcmp( argv[i], "-wr") == 0)
+ if (getuid() != 0)
+ ErrorF
+ ("Warning: the -nolock option can only be used by root\n");
+ else
+#endif
+ nolock = TRUE;
+ }
+ else if (strcmp(argv[i], "-nolisten") == 0) {
+ if (++i < argc) {
+ if (_XSERVTransNoListen(argv[i]))
+ FatalError("Failed to disable listen for %s transport",
+ argv[i]);
+ }
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-noreset") == 0) {
+ dispatchExceptionAtReset = 0;
+ }
+ else if (strcmp(argv[i], "-reset") == 0) {
+ dispatchExceptionAtReset = DE_RESET;
+ }
+ else if (strcmp(argv[i], "-p") == 0) {
+ if (++i < argc)
+ defaultScreenSaverInterval = ((CARD32) atoi(argv[i])) *
+ MILLI_PER_MIN;
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-pogo") == 0) {
+ dispatchException = DE_TERMINATE;
+ }
+ else if (strcmp(argv[i], "-pn") == 0)
+ PartialNetwork = TRUE;
+ else if (strcmp(argv[i], "-nopn") == 0)
+ PartialNetwork = FALSE;
+ else if (strcmp(argv[i], "r") == 0)
+ defaultKeyboardControl.autoRepeat = TRUE;
+ else if (strcmp(argv[i], "-r") == 0)
+ defaultKeyboardControl.autoRepeat = FALSE;
+ else if (strcmp(argv[i], "-retro") == 0)
+ party_like_its_1989 = TRUE;
+ else if (strcmp(argv[i], "-s") == 0) {
+ if (++i < argc)
+ defaultScreenSaverTime = ((CARD32) atoi(argv[i])) *
+ MILLI_PER_MIN;
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-seat") == 0) {
+ if (++i < argc)
+ SeatId = argv[i];
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-t") == 0) {
+ if (++i < argc)
+ defaultPointerControl.threshold = atoi(argv[i]);
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-terminate") == 0) {
+ dispatchExceptionAtReset = DE_TERMINATE;
+ }
+ else if (strcmp(argv[i], "-to") == 0) {
+ if (++i < argc)
+ TimeOutValue = ((CARD32) atoi(argv[i])) * MILLI_PER_SECOND;
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-tst") == 0) {
+ noTestExtensions = TRUE;
+ }
+ else if (strcmp(argv[i], "-wm") == 0)
+ defaultBackingStore = WhenMapped;
+ else if (strcmp(argv[i], "-wr") == 0)
whiteRoot = TRUE;
- else if ( strcmp( argv[i], "-background") == 0) {
- if(++i < argc) {
- if (!strcmp ( argv[i], "none"))
+ else if (strcmp(argv[i], "-background") == 0) {
+ if (++i < argc) {
+ if (!strcmp(argv[i], "none"))
bgNoneRoot = TRUE;
else
UseMsg();
}
}
- else if ( strcmp( argv[i], "-maxbigreqsize") == 0) {
- if(++i < argc) {
- long reqSizeArg = atol(argv[i]);
-
- /* Request size > 128MB does not make much sense... */
- if( reqSizeArg > 0L && reqSizeArg < 128L ) {
- maxBigRequestSize = (reqSizeArg * 1048576L) - 1L;
- }
- else
- {
- UseMsg();
- }
- }
- else
- {
- UseMsg();
- }
- }
+ else if (strcmp(argv[i], "-maxbigreqsize") == 0) {
+ if (++i < argc) {
+ long reqSizeArg = atol(argv[i]);
+
+ /* Request size > 128MB does not make much sense... */
+ if (reqSizeArg > 0L && reqSizeArg < 128L) {
+ maxBigRequestSize = (reqSizeArg * 1048576L) - 1L;
+ }
+ else {
+ UseMsg();
+ }
+ }
+ else {
+ UseMsg();
+ }
+ }
#ifdef PANORAMIX
- else if ( strcmp( argv[i], "+xinerama") == 0){
- noPanoramiXExtension = FALSE;
- }
- else if ( strcmp( argv[i], "-xinerama") == 0){
- noPanoramiXExtension = TRUE;
- }
- else if ( strcmp( argv[i], "-disablexineramaextension") == 0){
- PanoramiXExtensionDisabledHack = TRUE;
- }
-#endif
- else if ( strcmp( argv[i], "-I") == 0)
- {
- /* ignore all remaining arguments */
- break;
- }
- else if (strncmp (argv[i], "tty", 3) == 0)
- {
+ else if (strcmp(argv[i], "+xinerama") == 0) {
+ noPanoramiXExtension = FALSE;
+ }
+ else if (strcmp(argv[i], "-xinerama") == 0) {
+ noPanoramiXExtension = TRUE;
+ }
+ else if (strcmp(argv[i], "-disablexineramaextension") == 0) {
+ PanoramiXExtensionDisabledHack = TRUE;
+ }
+#endif
+ else if (strcmp(argv[i], "-I") == 0) {
+ /* ignore all remaining arguments */
+ break;
+ }
+ else if (strncmp(argv[i], "tty", 3) == 0) {
/* init supplies us with this useless information */
- }
+ }
#ifdef XDMCP
- else if ((skip = XdmcpOptions(argc, argv, i)) != i)
- {
- i = skip - 1;
- }
-#endif
- else if ( strcmp( argv[i], "-dumbSched") == 0)
- {
- SmartScheduleDisable = TRUE;
- }
- else if ( strcmp( argv[i], "-schedInterval") == 0)
- {
- if (++i < argc)
- {
- SmartScheduleInterval = atoi(argv[i]);
- SmartScheduleSlice = SmartScheduleInterval;
- }
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-schedMax") == 0)
- {
- if (++i < argc)
- {
- SmartScheduleMaxSlice = atoi(argv[i]);
- }
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-render" ) == 0)
- {
- if (++i < argc)
- {
- int policy = PictureParseCmapPolicy (argv[i]);
-
- if (policy != PictureCmapPolicyInvalid)
- PictureCmapPolicy = policy;
- else
- UseMsg ();
- }
- else
- UseMsg ();
- }
- else if ( strcmp( argv[i], "+extension") == 0)
- {
- if (++i < argc)
- {
- if (!EnableDisableExtension(argv[i], TRUE))
- EnableDisableExtensionError(argv[i], TRUE);
- }
- else
- UseMsg();
- }
- else if ( strcmp( argv[i], "-extension") == 0)
- {
- if (++i < argc)
- {
- if (!EnableDisableExtension(argv[i], FALSE))
- EnableDisableExtensionError(argv[i], FALSE);
- }
- else
- UseMsg();
- }
- else
- {
- ErrorF("Unrecognized option: %s\n", argv[i]);
- UseMsg();
- FatalError("Unrecognized option: %s\n", argv[i]);
+ else if ((skip = XdmcpOptions(argc, argv, i)) != i) {
+ i = skip - 1;
+ }
+#endif
+ else if (strcmp(argv[i], "-dumbSched") == 0) {
+ SmartScheduleDisable = TRUE;
+ }
+ else if (strcmp(argv[i], "-schedInterval") == 0) {
+ if (++i < argc) {
+ SmartScheduleInterval = atoi(argv[i]);
+ SmartScheduleSlice = SmartScheduleInterval;
+ }
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-schedMax") == 0) {
+ if (++i < argc) {
+ SmartScheduleMaxSlice = atoi(argv[i]);
+ }
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-render") == 0) {
+ if (++i < argc) {
+ int policy = PictureParseCmapPolicy(argv[i]);
+
+ if (policy != PictureCmapPolicyInvalid)
+ PictureCmapPolicy = policy;
+ else
+ UseMsg();
+ }
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "+extension") == 0) {
+ if (++i < argc) {
+ if (!EnableDisableExtension(argv[i], TRUE))
+ EnableDisableExtensionError(argv[i], TRUE);
+ }
+ else
+ UseMsg();
+ }
+ else if (strcmp(argv[i], "-extension") == 0) {
+ if (++i < argc) {
+ if (!EnableDisableExtension(argv[i], FALSE))
+ EnableDisableExtensionError(argv[i], FALSE);
+ }
+ else
+ UseMsg();
+ }
+ else {
+ ErrorF("Unrecognized option: %s\n", argv[i]);
+ UseMsg();
+ FatalError("Unrecognized option: %s\n", argv[i]);
}
}
}
@@ -990,61 +952,63 @@ set_font_authorizations(char **authorizations, int *authlen, pointer client)
static char *result = NULL;
static char *p = NULL;
- if (p == NULL)
- {
- char hname[1024], *hnameptr;
- unsigned int len;
+ if (p == NULL) {
+ char hname[1024], *hnameptr;
+ unsigned int len;
+
#if defined(IPv6) && defined(AF_INET6)
- struct addrinfo hints, *ai = NULL;
+ struct addrinfo hints, *ai = NULL;
#else
- struct hostent *host;
+ struct hostent *host;
+
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
- _Xgethostbynameparams hparams;
+ _Xgethostbynameparams hparams;
#endif
#endif
- gethostname(hname, 1024);
+ gethostname(hname, 1024);
#if defined(IPv6) && defined(AF_INET6)
- memset(&hints, 0, sizeof(hints));
- hints.ai_flags = AI_CANONNAME;
- if (getaddrinfo(hname, NULL, &hints, &ai) == 0) {
- hnameptr = ai->ai_canonname;
- } else {
- hnameptr = hname;
- }
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_flags = AI_CANONNAME;
+ if (getaddrinfo(hname, NULL, &hints, &ai) == 0) {
+ hnameptr = ai->ai_canonname;
+ }
+ else {
+ hnameptr = hname;
+ }
#else
- host = _XGethostbyname(hname, hparams);
- if (host == NULL)
- hnameptr = hname;
- else
- hnameptr = host->h_name;
+ host = _XGethostbyname(hname, hparams);
+ if (host == NULL)
+ hnameptr = hname;
+ else
+ hnameptr = host->h_name;
#endif
- len = strlen(hnameptr) + 1;
- result = malloc(len + sizeof(AUTHORIZATION_NAME) + 4);
+ len = strlen(hnameptr) + 1;
+ result = malloc(len + sizeof(AUTHORIZATION_NAME) + 4);
- p = result;
+ p = result;
*p++ = sizeof(AUTHORIZATION_NAME) >> 8;
*p++ = sizeof(AUTHORIZATION_NAME) & 0xff;
*p++ = (len) >> 8;
*p++ = (len & 0xff);
- memmove(p, AUTHORIZATION_NAME, sizeof(AUTHORIZATION_NAME));
- p += sizeof(AUTHORIZATION_NAME);
- memmove(p, hnameptr, len);
- p += len;
+ memmove(p, AUTHORIZATION_NAME, sizeof(AUTHORIZATION_NAME));
+ p += sizeof(AUTHORIZATION_NAME);
+ memmove(p, hnameptr, len);
+ p += len;
#if defined(IPv6) && defined(AF_INET6)
- if (ai) {
- freeaddrinfo(ai);
- }
+ if (ai) {
+ freeaddrinfo(ai);
+ }
#endif
}
*authlen = p - result;
*authorizations = result;
return 1;
-#else /* TCPCONN */
+#else /* TCPCONN */
return 0;
-#endif /* TCPCONN */
+#endif /* TCPCONN */
}
void *
@@ -1057,9 +1021,9 @@ Xalloc(unsigned long amount)
*
* -- Mikhail Gusarov
*/
- if ((long)amount <= 0)
- ErrorF("Warning: Xalloc: "
- "requesting unpleasantly large amount of memory: %lu bytes.\n",
+ if ((long) amount <= 0)
+ ErrorF("Warning: Xalloc: "
+ "requesting unpleasantly large amount of memory: %lu bytes.\n",
amount);
return malloc(amount);
@@ -1069,6 +1033,7 @@ void *
XNFalloc(unsigned long amount)
{
void *ptr = malloc(amount);
+
if (!ptr)
FatalError("Out of memory");
return ptr;
@@ -1084,6 +1049,7 @@ void *
XNFcalloc(unsigned long amount)
{
void *ret = calloc(1, amount);
+
if (!ret)
FatalError("XNFcalloc: Out of memory");
return ret;
@@ -1099,9 +1065,9 @@ Xrealloc(void *ptr, unsigned long amount)
*
* -- Mikhail Gusarov
*/
- if ((long)amount <= 0)
- ErrorF("Warning: Xrealloc: "
- "requesting unpleasantly large amount of memory: %lu bytes.\n",
+ if ((long) amount <= 0)
+ ErrorF("Warning: Xrealloc: "
+ "requesting unpleasantly large amount of memory: %lu bytes.\n",
amount);
return realloc(ptr, amount);
@@ -1111,8 +1077,9 @@ void *
XNFrealloc(void *ptr, unsigned long amount)
{
void *ret = realloc(ptr, amount);
+
if (!ret)
- FatalError("XNFrealloc: Out of memory");
+ FatalError("XNFrealloc: Out of memory");
return ret;
}
@@ -1122,12 +1089,11 @@ Xfree(void *ptr)
free(ptr);
}
-
char *
Xstrdup(const char *s)
{
if (s == NULL)
- return NULL;
+ return NULL;
return strdup(s);
}
@@ -1137,32 +1103,32 @@ XNFstrdup(const char *s)
char *ret;
if (s == NULL)
- return NULL;
+ return NULL;
ret = strdup(s);
if (!ret)
- FatalError("XNFstrdup: Out of memory");
+ FatalError("XNFstrdup: Out of memory");
return ret;
}
void
-SmartScheduleStopTimer (void)
+SmartScheduleStopTimer(void)
{
#ifdef _MSC_VER
if (SmartScheduleDisable)
- return;
+ return;
DeleteTimerQueueTimer(s_hSmartScheduleTimerQueue, s_hSmartScheduleTimer, NULL);
s_hSmartScheduleTimer=NULL;
#else
- struct itimerval timer;
-
+ struct itimerval timer;
+
if (SmartScheduleDisable)
- return;
+ return;
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = 0;
timer.it_value.tv_sec = 0;
timer.it_value.tv_usec = 0;
- (void) setitimer (ITIMER_REAL, &timer, 0);
+ (void) setitimer(ITIMER_REAL, &timer, 0);
#endif
}
@@ -1177,105 +1143,102 @@ static void SmartScheduleTimer (int sig)
void
-SmartScheduleStartTimer (void)
+SmartScheduleStartTimer(void)
{
#ifdef _MSC_VER
if (SmartScheduleDisable)
- return;
+ return;
if (!CreateTimerQueueTimer( &s_hSmartScheduleTimer, s_hSmartScheduleTimerQueue, SmartScheduleTimer, NULL
, SmartScheduleInterval, SmartScheduleInterval, WT_EXECUTEONLYONCE|WT_EXECUTEINPERSISTENTTHREAD))
{
DWORD Error=GetLastError();
ErrorF("Error starting timer, smart scheduling disabled: 0x%x (%d)\n",Error,Error);
- CloseHandle(s_hSmartScheduleTimer);
- SmartScheduleDisable = TRUE;
- return;
+ CloseHandle(s_hSmartScheduleTimer);
+ SmartScheduleDisable = TRUE;
+ return;
}
#else
- struct itimerval timer;
-
+ struct itimerval timer;
+
if (SmartScheduleDisable)
- return;
+ return;
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = SmartScheduleInterval * 1000;
timer.it_value.tv_sec = 0;
timer.it_value.tv_usec = SmartScheduleInterval * 1000;
- setitimer (ITIMER_REAL, &timer, 0);
+ setitimer(ITIMER_REAL, &timer, 0);
#endif
}
void
-SmartScheduleInit (void)
+SmartScheduleInit(void)
{
#ifdef _MSC_VER
if (SmartScheduleDisable)
- return;
+ return;
s_hSmartScheduleTimerQueue = CreateTimerQueue();
if (!s_hSmartScheduleTimerQueue)
{
DWORD Error=GetLastError();
ErrorF("Error creating timer, smart scheduling disabled: 0x%x (%d)\n",Error,Error);
- SmartScheduleDisable = TRUE;
+ SmartScheduleDisable = TRUE;
}
#else
- struct sigaction act;
+ struct sigaction act;
if (SmartScheduleDisable)
- return;
+ return;
memset((char *) &act, 0, sizeof(struct sigaction));
/* Set up the timer signal function */
act.sa_handler = SmartScheduleTimer;
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGALRM);
- if (sigaction (SIGALRM, &act, 0) < 0)
- {
- perror ("sigaction for smart scheduler");
- SmartScheduleDisable = TRUE;
+ sigemptyset(&act.sa_mask);
+ sigaddset(&act.sa_mask, SIGALRM);
+ if (sigaction(SIGALRM, &act, 0) < 0) {
+ perror("sigaction for smart scheduler");
+ SmartScheduleDisable = TRUE;
}
#endif
}
#ifdef SIG_BLOCK
-static sigset_t PreviousSignalMask;
-static int BlockedSignalCount;
+static sigset_t PreviousSignalMask;
+static int BlockedSignalCount;
#endif
void
-OsBlockSignals (void)
+OsBlockSignals(void)
{
#ifdef SIG_BLOCK
- if (BlockedSignalCount++ == 0)
- {
- sigset_t set;
-
- sigemptyset (&set);
- sigaddset (&set, SIGALRM);
- sigaddset (&set, SIGVTALRM);
+ if (BlockedSignalCount++ == 0) {
+ sigset_t set;
+
+ sigemptyset(&set);
+ sigaddset(&set, SIGALRM);
+ sigaddset(&set, SIGVTALRM);
#ifdef SIGWINCH
- sigaddset (&set, SIGWINCH);
+ sigaddset(&set, SIGWINCH);
#endif
#ifdef SIGIO
- sigaddset (&set, SIGIO);
+ sigaddset(&set, SIGIO);
#endif
- sigaddset (&set, SIGTSTP);
- sigaddset (&set, SIGTTIN);
- sigaddset (&set, SIGTTOU);
- sigaddset (&set, SIGCHLD);
- sigprocmask (SIG_BLOCK, &set, &PreviousSignalMask);
+ sigaddset(&set, SIGTSTP);
+ sigaddset(&set, SIGTTIN);
+ sigaddset(&set, SIGTTOU);
+ sigaddset(&set, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &set, &PreviousSignalMask);
}
#endif
}
void
-OsReleaseSignals (void)
+OsReleaseSignals(void)
{
#ifdef SIG_BLOCK
- if (--BlockedSignalCount == 0)
- {
- sigprocmask (SIG_SETMASK, &PreviousSignalMask, 0);
+ if (--BlockedSignalCount == 0) {
+ sigprocmask(SIG_SETMASK, &PreviousSignalMask, 0);
}
#endif
}
@@ -1286,7 +1249,7 @@ OsReleaseSignals (void)
*/
void
-OsAbort (void)
+OsAbort(void)
{
#ifndef __APPLE__
OsBlockSignals();
@@ -1309,39 +1272,39 @@ int
System(const char *command)
{
int pid, p;
- void (*csig)(int);
+ void (*csig) (int);
int status;
if (!command)
- return 1;
+ return 1;
csig = signal(SIGCHLD, SIG_DFL);
if (csig == SIG_ERR) {
- perror("signal");
- return -1;
+ perror("signal");
+ return -1;
}
DebugF("System: `%s'\n", command);
switch (pid = fork()) {
- case -1: /* error */
- p = -1;
- case 0: /* child */
- if (setgid(getgid()) == -1)
- _exit(127);
- if (setuid(getuid()) == -1)
- _exit(127);
- execl("/bin/sh", "sh", "-c", command, (char *)NULL);
- _exit(127);
- default: /* parent */
- do {
- p = waitpid(pid, &status, 0);
- } while (p == -1 && errno == EINTR);
-
+ case -1: /* error */
+ p = -1;
+ case 0: /* child */
+ if (setgid(getgid()) == -1)
+ _exit(127);
+ if (setuid(getuid()) == -1)
+ _exit(127);
+ execl("/bin/sh", "sh", "-c", command, (char *) NULL);
+ _exit(127);
+ default: /* parent */
+ do {
+ p = waitpid(pid, &status, 0);
+ } while (p == -1 && errno == EINTR);
+
}
if (signal(SIGCHLD, csig) == SIG_ERR) {
- perror("signal");
- return -1;
+ perror("signal");
+ return -1;
}
return p == -1 ? -1 : status;
@@ -1353,7 +1316,7 @@ static struct pid {
int pid;
} *pidlist;
-OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */
+OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */
pointer
Popen(const char *command, const char *type)
@@ -1363,71 +1326,73 @@ Popen(const char *command, const char *type)
int pdes[2], pid;
if (command == NULL || type == NULL)
- return NULL;
+ return NULL;
if ((*type != 'r' && *type != 'w') || type[1])
- return NULL;
+ return NULL;
if ((cur = malloc(sizeof(struct pid))) == NULL)
- return NULL;
+ return NULL;
if (pipe(pdes) < 0) {
- free(cur);
- return NULL;
+ free(cur);
+ return NULL;
}
/* Ignore the smart scheduler while this is going on */
old_alarm = OsSignal(SIGALRM, SIG_IGN);
if (old_alarm == SIG_ERR) {
- close(pdes[0]);
- close(pdes[1]);
- free(cur);
- perror("signal");
- return NULL;
+ close(pdes[0]);
+ close(pdes[1]);
+ free(cur);
+ perror("signal");
+ return NULL;
}
switch (pid = fork()) {
- case -1: /* error */
- close(pdes[0]);
- close(pdes[1]);
- free(cur);
- if (OsSignal(SIGALRM, old_alarm) == SIG_ERR)
- perror("signal");
- return NULL;
- case 0: /* child */
- if (setgid(getgid()) == -1)
- _exit(127);
- if (setuid(getuid()) == -1)
- _exit(127);
- if (*type == 'r') {
- if (pdes[1] != 1) {
- /* stdout */
- dup2(pdes[1], 1);
- close(pdes[1]);
- }
- close(pdes[0]);
- } else {
- if (pdes[0] != 0) {
- /* stdin */
- dup2(pdes[0], 0);
- close(pdes[0]);
- }
- close(pdes[1]);
- }
- execl("/bin/sh", "sh", "-c", command, (char *)NULL);
- _exit(127);
+ case -1: /* error */
+ close(pdes[0]);
+ close(pdes[1]);
+ free(cur);
+ if (OsSignal(SIGALRM, old_alarm) == SIG_ERR)
+ perror("signal");
+ return NULL;
+ case 0: /* child */
+ if (setgid(getgid()) == -1)
+ _exit(127);
+ if (setuid(getuid()) == -1)
+ _exit(127);
+ if (*type == 'r') {
+ if (pdes[1] != 1) {
+ /* stdout */
+ dup2(pdes[1], 1);
+ close(pdes[1]);
+ }
+ close(pdes[0]);
+ }
+ else {
+ if (pdes[0] != 0) {
+ /* stdin */
+ dup2(pdes[0], 0);
+ close(pdes[0]);
+ }
+ close(pdes[1]);
+ }
+ execl("/bin/sh", "sh", "-c", command, (char *) NULL);
+ _exit(127);
}
/* Avoid EINTR during stdio calls */
- OsBlockSignals ();
-
+ OsBlockSignals();
+
/* parent */
if (*type == 'r') {
- iop = fdopen(pdes[0], type);
- close(pdes[1]);
- } else {
- iop = fdopen(pdes[1], type);
- close(pdes[0]);
+ iop = fdopen(pdes[0], type);
+ close(pdes[1]);
+ }
+ else {
+ iop = fdopen(pdes[1], type);
+ close(pdes[0]);
}
cur->fp = iop;
@@ -1445,64 +1410,67 @@ pointer
Fopen(const char *file, const char *type)
{
FILE *iop;
+
#ifndef HAS_SAVED_IDS_AND_SETEUID
struct pid *cur;
int pdes[2], pid;
if (file == NULL || type == NULL)
- return NULL;
+ return NULL;
if ((*type != 'r' && *type != 'w') || type[1])
- return NULL;
+ return NULL;
if ((cur = malloc(sizeof(struct pid))) == NULL)
- return NULL;
+ return NULL;
if (pipe(pdes) < 0) {
- free(cur);
- return NULL;
+ free(cur);
+ return NULL;
}
switch (pid = fork()) {
- case -1: /* error */
- close(pdes[0]);
- close(pdes[1]);
- free(cur);
- return NULL;
- case 0: /* child */
- if (setgid(getgid()) == -1)
- _exit(127);
- if (setuid(getuid()) == -1)
- _exit(127);
- if (*type == 'r') {
- if (pdes[1] != 1) {
- /* stdout */
- dup2(pdes[1], 1);
- close(pdes[1]);
- }
- close(pdes[0]);
- } else {
- if (pdes[0] != 0) {
- /* stdin */
- dup2(pdes[0], 0);
- close(pdes[0]);
- }
- close(pdes[1]);
- }
- execl("/bin/cat", "cat", file, (char *)NULL);
- _exit(127);
+ case -1: /* error */
+ close(pdes[0]);
+ close(pdes[1]);
+ free(cur);
+ return NULL;
+ case 0: /* child */
+ if (setgid(getgid()) == -1)
+ _exit(127);
+ if (setuid(getuid()) == -1)
+ _exit(127);
+ if (*type == 'r') {
+ if (pdes[1] != 1) {
+ /* stdout */
+ dup2(pdes[1], 1);
+ close(pdes[1]);
+ }
+ close(pdes[0]);
+ }
+ else {
+ if (pdes[0] != 0) {
+ /* stdin */
+ dup2(pdes[0], 0);
+ close(pdes[0]);
+ }
+ close(pdes[1]);
+ }
+ execl("/bin/cat", "cat", file, (char *) NULL);
+ _exit(127);
}
/* Avoid EINTR during stdio calls */
- OsBlockSignals ();
-
+ OsBlockSignals();
+
/* parent */
if (*type == 'r') {
- iop = fdopen(pdes[0], type);
- close(pdes[1]);
- } else {
- iop = fdopen(pdes[1], type);
- close(pdes[0]);
+ iop = fdopen(pdes[0], type);
+ close(pdes[1]);
+ }
+ else {
+ iop = fdopen(pdes[1], type);
+ close(pdes[0]);
}
cur->fp = iop;
@@ -1518,18 +1486,18 @@ Fopen(const char *file, const char *type)
ruid = getuid();
euid = geteuid();
-
+
if (seteuid(ruid) == -1) {
- return NULL;
+ return NULL;
}
iop = fopen(file, type);
if (seteuid(euid) == -1) {
- fclose(iop);
- return NULL;
+ fclose(iop);
+ return NULL;
}
return iop;
-#endif /* HAS_SAVED_IDS_AND_SETEUID */
+#endif /* HAS_SAVED_IDS_AND_SETEUID */
}
int
@@ -1543,27 +1511,27 @@ Pclose(pointer iop)
fclose(iop);
for (last = NULL, cur = pidlist; cur; last = cur, cur = cur->next)
- if (cur->fp == iop)
- break;
+ if (cur->fp == iop)
+ break;
if (cur == NULL)
- return -1;
+ return -1;
do {
- pid = waitpid(cur->pid, &pstat, 0);
+ pid = waitpid(cur->pid, &pstat, 0);
} while (pid == -1 && errno == EINTR);
if (last == NULL)
- pidlist = cur->next;
+ pidlist = cur->next;
else
- last->next = cur->next;
+ last->next = cur->next;
free(cur);
/* allow EINTR again */
- OsReleaseSignals ();
-
+ OsReleaseSignals();
+
if (old_alarm && OsSignal(SIGALRM, old_alarm) == SIG_ERR) {
- perror("signal");
- return -1;
+ perror("signal");
+ return -1;
}
return pid == -1 ? -1 : pstat;
@@ -1579,8 +1547,7 @@ Fclose(pointer iop)
#endif
}
-#endif /* !WIN32 */
-
+#endif /* !WIN32 */
/*
* CheckUserParameters: check for long command line arguments and long
@@ -1611,7 +1578,6 @@ Fclose(pointer iop)
#define NO_OUTPUT_PIPES 0
#endif
-
/* Check args and env only if running setuid (euid == 0 && euid != uid) ? */
#ifndef CHECK_EUID
#ifndef WIN32
@@ -1631,7 +1597,7 @@ Fclose(pointer iop)
#define MAX_ARG_LENGTH 128
#define MAX_ENV_LENGTH 2048
-#define MAX_ENV_PATH_LENGTH 2048 /* Limit for *PATH and TERMCAP */
+#define MAX_ENV_PATH_LENGTH 2048 /* Limit for *PATH and TERMCAP */
#if USE_ISPRINT
#include <ctype.h>
@@ -1669,115 +1635,116 @@ CheckUserParameters(int argc, char **argv, char **envp)
if (geteuid() == 0 && getuid() != geteuid())
#endif
{
- /* Check each argv[] */
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-fp") == 0)
- {
- i++; /* continue with next argument. skip the length check */
- if (i >= argc)
- break;
- } else
- {
- if (strlen(argv[i]) > MAX_ARG_LENGTH) {
- bad = ArgTooLong;
- break;
- }
- }
- a = argv[i];
- while (*a) {
- if (checkPrintable(*a) == 0) {
- bad = UnprintableArg;
- break;
- }
- a++;
- }
- if (bad)
- break;
- }
- if (!bad) {
- /* Check each envp[] */
- for (i = 0; envp[i]; i++) {
-
- /* Check for bad environment variables and values */
+ /* Check each argv[] */
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-fp") == 0) {
+ i++; /* continue with next argument. skip the length check */
+ if (i >= argc)
+ break;
+ }
+ else {
+ if (strlen(argv[i]) > MAX_ARG_LENGTH) {
+ bad = ArgTooLong;
+ break;
+ }
+ }
+ a = argv[i];
+ while (*a) {
+ if (checkPrintable(*a) == 0) {
+ bad = UnprintableArg;
+ break;
+ }
+ a++;
+ }
+ if (bad)
+ break;
+ }
+ if (!bad) {
+ /* Check each envp[] */
+ for (i = 0; envp[i]; i++) {
+
+ /* Check for bad environment variables and values */
#if REMOVE_ENV_LD
- while (envp[i] && (strncmp(envp[i], "LD", 2) == 0)) {
- for (j = i; envp[j]; j++) {
- envp[j] = envp[j+1];
- }
- }
-#endif
- if (envp[i] && (strlen(envp[i]) > MAX_ENV_LENGTH)) {
+ while (envp[i] && (strncmp(envp[i], "LD", 2) == 0)) {
+ for (j = i; envp[j]; j++) {
+ envp[j] = envp[j + 1];
+ }
+ }
+#endif
+ if (envp[i] && (strlen(envp[i]) > MAX_ENV_LENGTH)) {
#if REMOVE_LONG_ENV
- for (j = i; envp[j]; j++) {
- envp[j] = envp[j+1];
- }
- i--;
+ for (j = i; envp[j]; j++) {
+ envp[j] = envp[j + 1];
+ }
+ i--;
#else
- char *eq;
- int len;
-
- eq = strchr(envp[i], '=');
- if (!eq)
- continue;
- len = eq - envp[i];
- e = strndup(envp[i], len);
- if (!e) {
- bad = InternalError;
- break;
- }
- if (len >= 4 &&
- (strcmp(e + len - 4, "PATH") == 0 ||
- strcmp(e, "TERMCAP") == 0)) {
- if (strlen(envp[i]) > MAX_ENV_PATH_LENGTH) {
- bad = EnvTooLong;
- break;
- } else {
- free(e);
- }
- } else {
- bad = EnvTooLong;
- break;
- }
-#endif
- }
- }
- }
+ char *eq;
+ int len;
+
+ eq = strchr(envp[i], '=');
+ if (!eq)
+ continue;
+ len = eq - envp[i];
+ e = strndup(envp[i], len);
+ if (!e) {
+ bad = InternalError;
+ break;
+ }
+ if (len >= 4 &&
+ (strcmp(e + len - 4, "PATH") == 0 ||
+ strcmp(e, "TERMCAP") == 0)) {
+ if (strlen(envp[i]) > MAX_ENV_PATH_LENGTH) {
+ bad = EnvTooLong;
+ break;
+ }
+ else {
+ free(e);
+ }
+ }
+ else {
+ bad = EnvTooLong;
+ break;
+ }
+#endif
+ }
+ }
+ }
#if NO_OUTPUT_PIPES
- if (!bad) {
- struct stat buf;
+ if (!bad) {
+ struct stat buf;
- if (fstat(fileno(stdout), &buf) == 0 && S_ISFIFO(buf.st_mode))
- bad = OutputIsPipe;
- if (fstat(fileno(stderr), &buf) == 0 && S_ISFIFO(buf.st_mode))
- bad = OutputIsPipe;
- }
+ if (fstat(fileno(stdout), &buf) == 0 && S_ISFIFO(buf.st_mode))
+ bad = OutputIsPipe;
+ if (fstat(fileno(stderr), &buf) == 0 && S_ISFIFO(buf.st_mode))
+ bad = OutputIsPipe;
+ }
#endif
}
switch (bad) {
case NotBad:
- return;
+ return;
case UnsafeArg:
- ErrorF("Command line argument number %d is unsafe\n", i);
- break;
+ ErrorF("Command line argument number %d is unsafe\n", i);
+ break;
case ArgTooLong:
- ErrorF("Command line argument number %d is too long\n", i);
- break;
+ ErrorF("Command line argument number %d is too long\n", i);
+ break;
case UnprintableArg:
- ErrorF("Command line argument number %d contains unprintable"
- " characters\n", i);
- break;
+ ErrorF("Command line argument number %d contains unprintable"
+ " characters\n", i);
+ break;
case EnvTooLong:
- ErrorF("Environment variable `%s' is too long\n", e);
- break;
+ ErrorF("Environment variable `%s' is too long\n", e);
+ break;
case OutputIsPipe:
- ErrorF("Stdout and/or stderr is a pipe\n");
- break;
+ ErrorF("Stdout and/or stderr is a pipe\n");
+ break;
case InternalError:
- ErrorF("Internal Error\n");
- break;
+ ErrorF("Internal Error\n");
+ break;
default:
- ErrorF("Unknown error\n");
- break;
+ ErrorF("Unknown error\n");
+ break;
}
FatalError("X server aborted because of unsafe environment\n");
}
@@ -1792,15 +1759,15 @@ CheckUserParameters(int argc, char **argv, char **envp)
#include <security/pam_appl.h>
#include <security/pam_misc.h>
#include <pwd.h>
-#endif /* USE_PAM */
+#endif /* USE_PAM */
void
CheckUserAuthorization(void)
{
#ifdef USE_PAM
static struct pam_conv conv = {
- misc_conv,
- NULL
+ misc_conv,
+ NULL
};
pam_handle_t *pamh = NULL;
@@ -1808,31 +1775,31 @@ CheckUserAuthorization(void)
int retval;
if (getuid() != geteuid()) {
- pw = getpwuid(getuid());
- if (pw == NULL)
- FatalError("getpwuid() failed for uid %d\n", getuid());
-
- retval = pam_start("xserver", pw->pw_name, &conv, &pamh);
- if (retval != PAM_SUCCESS)
- FatalError("pam_start() failed.\n"
- "\tMissing or mangled PAM config file or module?\n");
-
- retval = pam_authenticate(pamh, 0);
- if (retval != PAM_SUCCESS) {
- pam_end(pamh, retval);
- FatalError("PAM authentication failed, cannot start X server.\n"
- "\tPerhaps you do not have console ownership?\n");
- }
-
- retval = pam_acct_mgmt(pamh, 0);
- if (retval != PAM_SUCCESS) {
- pam_end(pamh, retval);
- FatalError("PAM authentication failed, cannot start X server.\n"
- "\tPerhaps you do not have console ownership?\n");
- }
-
- /* this is not a session, so do not do session management */
- pam_end(pamh, PAM_SUCCESS);
+ pw = getpwuid(getuid());
+ if (pw == NULL)
+ FatalError("getpwuid() failed for uid %d\n", getuid());
+
+ retval = pam_start("xserver", pw->pw_name, &conv, &pamh);
+ if (retval != PAM_SUCCESS)
+ FatalError("pam_start() failed.\n"
+ "\tMissing or mangled PAM config file or module?\n");
+
+ retval = pam_authenticate(pamh, 0);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ FatalError("PAM authentication failed, cannot start X server.\n"
+ "\tPerhaps you do not have console ownership?\n");
+ }
+
+ retval = pam_acct_mgmt(pamh, 0);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ FatalError("PAM authentication failed, cannot start X server.\n"
+ "\tPerhaps you do not have console ownership?\n");
+ }
+
+ /* this is not a session, so do not do session management */
+ pam_end(pamh, PAM_SUCCESS);
}
#endif
}
@@ -1841,7 +1808,7 @@ CheckUserAuthorization(void)
* Tokenize a string into a NULL terminated array of strings. Always returns
* an allocated array unless an error occurs.
*/
-char**
+char **
xstrtokenize(const char *str, const char *separators)
{
char **list, **nlist;
@@ -1869,7 +1836,7 @@ xstrtokenize(const char *str, const char *separators)
free(tmp);
return list;
-error:
+ error:
free(tmp);
for (n = 0; n < num; n++)
free(list[n]);
diff --git a/xorg-server/os/xdmauth.c b/xorg-server/os/xdmauth.c
index 733fda504..28584d2e8 100644
--- a/xorg-server/os/xdmauth.c
+++ b/xorg-server/os/xdmauth.c
@@ -58,390 +58,380 @@ static Bool authFromXDMCP;
/* XDM-AUTHENTICATION-1 */
-static XdmAuthKeyRec privateKey;
+static XdmAuthKeyRec privateKey;
static char XdmAuthenticationName[] = "XDM-AUTHENTICATION-1";
+
#define XdmAuthenticationNameLen (sizeof XdmAuthenticationName - 1)
-static XdmAuthKeyRec rho;
+static XdmAuthKeyRec rho;
-static Bool
-XdmAuthenticationValidator (ARRAY8Ptr privateData, ARRAY8Ptr incomingData,
- xdmOpCode packet_type)
+static Bool
+XdmAuthenticationValidator(ARRAY8Ptr privateData, ARRAY8Ptr incomingData,
+ xdmOpCode packet_type)
{
- XdmAuthKeyPtr incoming;
+ XdmAuthKeyPtr incoming;
- XdmcpUnwrap (incomingData->data, (unsigned char *)&privateKey,
- incomingData->data,incomingData->length);
+ XdmcpUnwrap(incomingData->data, (unsigned char *) &privateKey,
+ incomingData->data, incomingData->length);
if (packet_type == ACCEPT) {
- if (incomingData->length != 8)
- return FALSE;
- incoming = (XdmAuthKeyPtr) incomingData->data;
- XdmcpDecrementKey (incoming);
- return XdmcpCompareKeys (incoming, &rho);
+ if (incomingData->length != 8)
+ return FALSE;
+ incoming = (XdmAuthKeyPtr) incomingData->data;
+ XdmcpDecrementKey(incoming);
+ return XdmcpCompareKeys(incoming, &rho);
}
return FALSE;
}
static Bool
-XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData,
- xdmOpCode packet_type)
+XdmAuthenticationGenerator(ARRAY8Ptr privateData, ARRAY8Ptr outgoingData,
+ xdmOpCode packet_type)
{
outgoingData->length = 0;
outgoingData->data = 0;
if (packet_type == REQUEST) {
- if (XdmcpAllocARRAY8 (outgoingData, 8))
- XdmcpWrap ((unsigned char *)&rho, (unsigned char *)&privateKey,
- outgoingData->data, 8);
+ if (XdmcpAllocARRAY8(outgoingData, 8))
+ XdmcpWrap((unsigned char *) &rho, (unsigned char *) &privateKey,
+ outgoingData->data, 8);
}
return TRUE;
}
static Bool
-XdmAuthenticationAddAuth (int name_len, const char *name,
- int data_len, char *data)
+XdmAuthenticationAddAuth(int name_len, const char *name,
+ int data_len, char *data)
{
- Bool ret;
- XdmcpUnwrap ((unsigned char *)data, (unsigned char *)&privateKey,
- (unsigned char *)data, data_len);
+ Bool ret;
+
+ XdmcpUnwrap((unsigned char *) data, (unsigned char *) &privateKey,
+ (unsigned char *) data, data_len);
authFromXDMCP = TRUE;
- ret = AddAuthorization (name_len, name, data_len, data);
+ ret = AddAuthorization(name_len, name, data_len, data);
authFromXDMCP = FALSE;
return ret;
}
-
#define atox(c) ('0' <= c && c <= '9' ? c - '0' : \
'a' <= c && c <= 'f' ? c - 'a' + 10 : \
'A' <= c && c <= 'F' ? c - 'A' + 10 : -1)
static int
-HexToBinary (const char *in, char *out, int len)
+HexToBinary(const char *in, char *out, int len)
{
- int top, bottom;
-
- while (len > 0)
- {
- top = atox(in[0]);
- if (top == -1)
- return 0;
- bottom = atox(in[1]);
- if (bottom == -1)
- return 0;
- *out++ = (top << 4) | bottom;
- in += 2;
- len -= 2;
+ int top, bottom;
+
+ while (len > 0) {
+ top = atox(in[0]);
+ if (top == -1)
+ return 0;
+ bottom = atox(in[1]);
+ if (bottom == -1)
+ return 0;
+ *out++ = (top << 4) | bottom;
+ in += 2;
+ len -= 2;
}
if (len)
- return 0;
+ return 0;
*out++ = '\0';
return 1;
}
void
-XdmAuthenticationInit (const char *cookie, int cookie_len)
+XdmAuthenticationInit(const char *cookie, int cookie_len)
{
memset(privateKey.data, 0, 8);
- if (!strncmp (cookie, "0x", 2) || !strncmp (cookie, "0X", 2))
- {
- if (cookie_len > 2 + 2 * 8)
- cookie_len = 2 + 2 * 8;
- HexToBinary (cookie + 2, (char *)privateKey.data, cookie_len - 2);
+ if (!strncmp(cookie, "0x", 2) || !strncmp(cookie, "0X", 2)) {
+ if (cookie_len > 2 + 2 * 8)
+ cookie_len = 2 + 2 * 8;
+ HexToBinary(cookie + 2, (char *) privateKey.data, cookie_len - 2);
}
- else
- {
- if (cookie_len > 7)
- cookie_len = 7;
- memmove (privateKey.data + 1, cookie, cookie_len);
+ else {
+ if (cookie_len > 7)
+ cookie_len = 7;
+ memmove(privateKey.data + 1, cookie, cookie_len);
}
- XdmcpGenerateKey (&rho);
- XdmcpRegisterAuthentication (XdmAuthenticationName, XdmAuthenticationNameLen,
- (char *)&rho,
- sizeof (rho),
- (ValidatorFunc)XdmAuthenticationValidator,
- (GeneratorFunc)XdmAuthenticationGenerator,
- (AddAuthorFunc)XdmAuthenticationAddAuth);
+ XdmcpGenerateKey(&rho);
+ XdmcpRegisterAuthentication(XdmAuthenticationName, XdmAuthenticationNameLen,
+ (char *) &rho,
+ sizeof(rho),
+ (ValidatorFunc) XdmAuthenticationValidator,
+ (GeneratorFunc) XdmAuthenticationGenerator,
+ (AddAuthorFunc) XdmAuthenticationAddAuth);
}
-#endif /* XDMCP */
+#endif /* XDMCP */
/* XDM-AUTHORIZATION-1 */
typedef struct _XdmAuthorization {
- struct _XdmAuthorization *next;
- XdmAuthKeyRec rho;
- XdmAuthKeyRec key;
- XID id;
+ struct _XdmAuthorization *next;
+ XdmAuthKeyRec rho;
+ XdmAuthKeyRec key;
+ XID id;
} XdmAuthorizationRec, *XdmAuthorizationPtr;
static XdmAuthorizationPtr xdmAuth;
typedef struct _XdmClientAuth {
- struct _XdmClientAuth *next;
- XdmAuthKeyRec rho;
- char client[6];
- long time;
+ struct _XdmClientAuth *next;
+ XdmAuthKeyRec rho;
+ char client[6];
+ long time;
} XdmClientAuthRec, *XdmClientAuthPtr;
-static XdmClientAuthPtr xdmClients;
-static long clockOffset;
-static Bool gotClock;
+static XdmClientAuthPtr xdmClients;
+static long clockOffset;
+static Bool gotClock;
#define TwentyMinutes (20 * 60)
#define TwentyFiveMinutes (25 * 60)
static Bool
-XdmClientAuthCompare (const XdmClientAuthPtr a, const XdmClientAuthPtr b)
+XdmClientAuthCompare(const XdmClientAuthPtr a, const XdmClientAuthPtr b)
{
- int i;
+ int i;
- if (!XdmcpCompareKeys (&a->rho, &b->rho))
- return FALSE;
+ if (!XdmcpCompareKeys(&a->rho, &b->rho))
+ return FALSE;
for (i = 0; i < 6; i++)
- if (a->client[i] != b->client[i])
- return FALSE;
+ if (a->client[i] != b->client[i])
+ return FALSE;
return a->time == b->time;
}
static void
-XdmClientAuthDecode (const unsigned char *plain, XdmClientAuthPtr auth)
+XdmClientAuthDecode(const unsigned char *plain, XdmClientAuthPtr auth)
{
- int i, j;
+ int i, j;
j = 0;
- for (i = 0; i < 8; i++)
- {
- auth->rho.data[i] = plain[j];
- ++j;
+ for (i = 0; i < 8; i++) {
+ auth->rho.data[i] = plain[j];
+ ++j;
}
- for (i = 0; i < 6; i++)
- {
- auth->client[i] = plain[j];
- ++j;
+ for (i = 0; i < 6; i++) {
+ auth->client[i] = plain[j];
+ ++j;
}
auth->time = 0;
- for (i = 0; i < 4; i++)
- {
- auth->time |= plain[j] << ((3 - i) << 3);
- j++;
+ for (i = 0; i < 4; i++) {
+ auth->time |= plain[j] << ((3 - i) << 3);
+ j++;
}
}
static void
-XdmClientAuthTimeout (long now)
+XdmClientAuthTimeout(long now)
{
- XdmClientAuthPtr client, next, prev;
+ XdmClientAuthPtr client, next, prev;
prev = 0;
- for (client = xdmClients; client; client=next)
- {
- next = client->next;
- if (abs (now - client->time) > TwentyFiveMinutes)
- {
- if (prev)
- prev->next = next;
- else
- xdmClients = next;
- free(client);
- }
- else
- prev = client;
+ for (client = xdmClients; client; client = next) {
+ next = client->next;
+ if (abs(now - client->time) > TwentyFiveMinutes) {
+ if (prev)
+ prev->next = next;
+ else
+ xdmClients = next;
+ free(client);
+ }
+ else
+ prev = client;
}
}
static XdmClientAuthPtr
-XdmAuthorizationValidate (unsigned char *plain, int length,
- XdmAuthKeyPtr rho, ClientPtr xclient, const char **reason)
+XdmAuthorizationValidate(unsigned char *plain, int length,
+ XdmAuthKeyPtr rho, ClientPtr xclient,
+ const char **reason)
{
- XdmClientAuthPtr client, existing;
- long now;
- int i;
+ XdmClientAuthPtr client, existing;
+ long now;
+ int i;
if (length != (192 / 8)) {
- if (reason)
- *reason = "Bad XDM authorization key length";
- return NULL;
+ if (reason)
+ *reason = "Bad XDM authorization key length";
+ return NULL;
}
- client = malloc(sizeof (XdmClientAuthRec));
+ client = malloc(sizeof(XdmClientAuthRec));
if (!client)
- return NULL;
- XdmClientAuthDecode (plain, client);
- if (!XdmcpCompareKeys (&client->rho, rho))
- {
- free(client);
- if (reason)
- *reason = "Invalid XDM-AUTHORIZATION-1 key (failed key comparison)";
- return NULL;
+ return NULL;
+ XdmClientAuthDecode(plain, client);
+ if (!XdmcpCompareKeys(&client->rho, rho)) {
+ free(client);
+ if (reason)
+ *reason = "Invalid XDM-AUTHORIZATION-1 key (failed key comparison)";
+ return NULL;
}
for (i = 18; i < 24; i++)
- if (plain[i] != 0) {
- free(client);
- if (reason)
- *reason = "Invalid XDM-AUTHORIZATION-1 key (failed NULL check)";
- return NULL;
- }
+ if (plain[i] != 0) {
+ free(client);
+ if (reason)
+ *reason = "Invalid XDM-AUTHORIZATION-1 key (failed NULL check)";
+ return NULL;
+ }
if (xclient) {
- int family, addr_len;
- Xtransaddr *addr;
+ int family, addr_len;
+ Xtransaddr *addr;
- if (_XSERVTransGetPeerAddr(((OsCommPtr)xclient->osPrivate)->trans_conn,
- &family, &addr_len, &addr) == 0
- && _XSERVTransConvertAddress(&family, &addr_len, &addr) == 0) {
+ if (_XSERVTransGetPeerAddr(((OsCommPtr) xclient->osPrivate)->trans_conn,
+ &family, &addr_len, &addr) == 0
+ && _XSERVTransConvertAddress(&family, &addr_len, &addr) == 0) {
#if defined(TCPCONN) || defined(STREAMSCONN)
- if (family == FamilyInternet &&
- memcmp((char *)addr, client->client, 4) != 0) {
- free(client);
- free(addr);
- if (reason)
- *reason = "Invalid XDM-AUTHORIZATION-1 key (failed address comparison)";
- return NULL;
-
- }
+ if (family == FamilyInternet &&
+ memcmp((char *) addr, client->client, 4) != 0) {
+ free(client);
+ free(addr);
+ if (reason)
+ *reason =
+ "Invalid XDM-AUTHORIZATION-1 key (failed address comparison)";
+ return NULL;
+
+ }
#endif
- free(addr);
- }
+ free(addr);
+ }
}
now = time(0);
- if (!gotClock)
- {
- clockOffset = client->time - now;
- gotClock = TRUE;
+ if (!gotClock) {
+ clockOffset = client->time - now;
+ gotClock = TRUE;
}
now += clockOffset;
- XdmClientAuthTimeout (now);
- if (abs (client->time - now) > TwentyMinutes)
- {
- free(client);
- if (reason)
- *reason = "Excessive XDM-AUTHORIZATION-1 time offset";
- return NULL;
+ XdmClientAuthTimeout(now);
+ if (abs(client->time - now) > TwentyMinutes) {
+ free(client);
+ if (reason)
+ *reason = "Excessive XDM-AUTHORIZATION-1 time offset";
+ return NULL;
}
- for (existing = xdmClients; existing; existing=existing->next)
- {
- if (XdmClientAuthCompare (existing, client))
- {
- free(client);
- if (reason)
- *reason = "XDM authorization key matches an existing client!";
- return NULL;
- }
+ for (existing = xdmClients; existing; existing = existing->next) {
+ if (XdmClientAuthCompare(existing, client)) {
+ free(client);
+ if (reason)
+ *reason = "XDM authorization key matches an existing client!";
+ return NULL;
+ }
}
return client;
}
int
-XdmAddCookie (unsigned short data_length, const char *data, XID id)
+XdmAddCookie(unsigned short data_length, const char *data, XID id)
{
- XdmAuthorizationPtr new;
- unsigned char *rho_bits, *key_bits;
+ XdmAuthorizationPtr new;
+ unsigned char *rho_bits, *key_bits;
- switch (data_length)
- {
- case 16: /* auth from files is 16 bytes long */
+ switch (data_length) {
+ case 16: /* auth from files is 16 bytes long */
#ifdef XDMCP
- if (authFromXDMCP)
- {
- /* R5 xdm sent bogus authorization data in the accept packet,
- * but we can recover */
- rho_bits = rho.data;
- key_bits = (unsigned char *) data;
- key_bits[0] = '\0';
- }
- else
+ if (authFromXDMCP) {
+ /* R5 xdm sent bogus authorization data in the accept packet,
+ * but we can recover */
+ rho_bits = rho.data;
+ key_bits = (unsigned char *) data;
+ key_bits[0] = '\0';
+ }
+ else
#endif
- {
- rho_bits = (unsigned char *) data;
- key_bits = (unsigned char *) (data + 8);
- }
- break;
+ {
+ rho_bits = (unsigned char *) data;
+ key_bits = (unsigned char *) (data + 8);
+ }
+ break;
#ifdef XDMCP
- case 8: /* auth from XDMCP is 8 bytes long */
- rho_bits = rho.data;
- key_bits = (unsigned char *) data;
- break;
+ case 8: /* auth from XDMCP is 8 bytes long */
+ rho_bits = rho.data;
+ key_bits = (unsigned char *) data;
+ break;
#endif
default:
- return 0;
+ return 0;
}
/* the first octet of the key must be zero */
if (key_bits[0] != '\0')
- return 0;
- new = malloc(sizeof (XdmAuthorizationRec));
+ return 0;
+ new = malloc(sizeof(XdmAuthorizationRec));
if (!new)
- return 0;
+ return 0;
new->next = xdmAuth;
xdmAuth = new;
- memmove (new->key.data, key_bits, (int) 8);
- memmove (new->rho.data, rho_bits, (int) 8);
+ memmove(new->key.data, key_bits, (int) 8);
+ memmove(new->rho.data, rho_bits, (int) 8);
new->id = id;
return 1;
}
XID
-XdmCheckCookie (unsigned short cookie_length, const char *cookie,
- ClientPtr xclient, const char **reason)
+XdmCheckCookie(unsigned short cookie_length, const char *cookie,
+ ClientPtr xclient, const char **reason)
{
- XdmAuthorizationPtr auth;
- XdmClientAuthPtr client;
- unsigned char *plain;
+ XdmAuthorizationPtr auth;
+ XdmClientAuthPtr client;
+ unsigned char *plain;
/* Auth packets must be a multiple of 8 bytes long */
if (cookie_length & 7)
- return (XID) -1;
+ return (XID) -1;
plain = malloc(cookie_length);
if (!plain)
- return (XID) -1;
- for (auth = xdmAuth; auth; auth=auth->next) {
- XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length);
- if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, xclient, reason)) != NULL)
- {
- client->next = xdmClients;
- xdmClients = client;
- free(plain);
- return auth->id;
- }
+ return (XID) -1;
+ for (auth = xdmAuth; auth; auth = auth->next) {
+ XdmcpUnwrap((unsigned char *) cookie, (unsigned char *) &auth->key,
+ plain, cookie_length);
+ if ((client =
+ XdmAuthorizationValidate(plain, cookie_length, &auth->rho, xclient,
+ reason)) != NULL) {
+ client->next = xdmClients;
+ xdmClients = client;
+ free(plain);
+ return auth->id;
+ }
}
free(plain);
return (XID) -1;
}
int
-XdmResetCookie (void)
+XdmResetCookie(void)
{
- XdmAuthorizationPtr auth, next_auth;
- XdmClientAuthPtr client, next_client;
+ XdmAuthorizationPtr auth, next_auth;
+ XdmClientAuthPtr client, next_client;
- for (auth = xdmAuth; auth; auth=next_auth)
- {
- next_auth = auth->next;
- free(auth);
+ for (auth = xdmAuth; auth; auth = next_auth) {
+ next_auth = auth->next;
+ free(auth);
}
xdmAuth = 0;
- for (client = xdmClients; client; client=next_client)
- {
- next_client = client->next;
- free(client);
+ for (client = xdmClients; client; client = next_client) {
+ next_client = client->next;
+ free(client);
}
xdmClients = (XdmClientAuthPtr) 0;
return 1;
}
XID
-XdmToID (unsigned short cookie_length, char *cookie)
+XdmToID(unsigned short cookie_length, char *cookie)
{
- XdmAuthorizationPtr auth;
- XdmClientAuthPtr client;
- unsigned char *plain;
+ XdmAuthorizationPtr auth;
+ XdmClientAuthPtr client;
+ unsigned char *plain;
plain = malloc(cookie_length);
if (!plain)
- return (XID) -1;
- for (auth = xdmAuth; auth; auth=auth->next) {
- XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length);
- if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) != NULL)
- {
- free(client);
- free(cookie);
- free(plain);
- return auth->id;
- }
+ return (XID) -1;
+ for (auth = xdmAuth; auth; auth = auth->next) {
+ XdmcpUnwrap((unsigned char *) cookie, (unsigned char *) &auth->key,
+ plain, cookie_length);
+ if ((client =
+ XdmAuthorizationValidate(plain, cookie_length, &auth->rho, NULL,
+ NULL)) != NULL) {
+ free(client);
+ free(cookie);
+ free(plain);
+ return auth->id;
+ }
}
free(cookie);
free(plain);
@@ -449,49 +439,47 @@ XdmToID (unsigned short cookie_length, char *cookie)
}
int
-XdmFromID (XID id, unsigned short *data_lenp, char **datap)
+XdmFromID(XID id, unsigned short *data_lenp, char **datap)
{
- XdmAuthorizationPtr auth;
-
- for (auth = xdmAuth; auth; auth=auth->next) {
- if (id == auth->id) {
- *data_lenp = 16;
- *datap = (char *) &auth->rho;
- return 1;
- }
+ XdmAuthorizationPtr auth;
+
+ for (auth = xdmAuth; auth; auth = auth->next) {
+ if (id == auth->id) {
+ *data_lenp = 16;
+ *datap = (char *) &auth->rho;
+ return 1;
+ }
}
return 0;
}
int
-XdmRemoveCookie (unsigned short data_length, const char *data)
+XdmRemoveCookie(unsigned short data_length, const char *data)
{
- XdmAuthorizationPtr auth;
- XdmAuthKeyPtr key_bits, rho_bits;
+ XdmAuthorizationPtr auth;
+ XdmAuthKeyPtr key_bits, rho_bits;
- switch (data_length)
- {
+ switch (data_length) {
case 16:
- rho_bits = (XdmAuthKeyPtr) data;
- key_bits = (XdmAuthKeyPtr) (data + 8);
- break;
+ rho_bits = (XdmAuthKeyPtr) data;
+ key_bits = (XdmAuthKeyPtr) (data + 8);
+ break;
#ifdef XDMCP
case 8:
- rho_bits = &rho;
- key_bits = (XdmAuthKeyPtr) data;
- break;
+ rho_bits = &rho;
+ key_bits = (XdmAuthKeyPtr) data;
+ break;
#endif
default:
- return 0;
+ return 0;
}
- for (auth = xdmAuth; auth; auth=auth->next) {
- if (XdmcpCompareKeys (rho_bits, &auth->rho) &&
- XdmcpCompareKeys (key_bits, &auth->key))
- {
- xdmAuth = auth->next;
- free(auth);
- return 1;
- }
+ for (auth = xdmAuth; auth; auth = auth->next) {
+ if (XdmcpCompareKeys(rho_bits, &auth->rho) &&
+ XdmcpCompareKeys(key_bits, &auth->key)) {
+ xdmAuth = auth->next;
+ free(auth);
+ return 1;
+ }
}
return 0;
}
diff --git a/xorg-server/os/xdmcp.c b/xorg-server/os/xdmcp.c
index 37b51f6b2..6c5ebca5c 100644
--- a/xorg-server/os/xdmcp.c
+++ b/xorg-server/os/xdmcp.c
@@ -64,27 +64,29 @@ static const char *defaultDisplayClass = COMPILEDDISPLAYCLASS;
extern void match_interface(u_long u_lQuery);
-static int xdmcpSocket, sessionSocket;
-static xdmcp_states state;
+static int xdmcpSocket, sessionSocket;
+static xdmcp_states state;
+
#if defined(IPv6) && defined(AF_INET6)
-static int xdmcpSocket6;
+static int xdmcpSocket6;
static struct sockaddr_storage req_sockaddr;
#else
-static struct sockaddr_in req_sockaddr;
+static struct sockaddr_in req_sockaddr;
#endif
-static int req_socklen;
-static CARD32 SessionID;
-static CARD32 timeOutTime;
-static int timeOutRtx;
-static CARD32 defaultKeepaliveDormancy = XDM_DEF_DORMANCY;
-static CARD32 keepaliveDormancy = XDM_DEF_DORMANCY;
-static CARD16 DisplayNumber;
-static xdmcp_states XDM_INIT_STATE = XDM_OFF;
+static int req_socklen;
+static CARD32 SessionID;
+static CARD32 timeOutTime;
+static int timeOutRtx;
+static CARD32 defaultKeepaliveDormancy = XDM_DEF_DORMANCY;
+static CARD32 keepaliveDormancy = XDM_DEF_DORMANCY;
+static CARD16 DisplayNumber;
+static xdmcp_states XDM_INIT_STATE = XDM_OFF;
+
#ifdef HASXDMAUTH
-static char *xdmAuthCookie;
+static char *xdmAuthCookie;
#endif
-static XdmcpBuffer buffer;
+static XdmcpBuffer buffer;
#if defined(IPv6) && defined(AF_INET6)
@@ -115,8 +117,8 @@ static struct addrinfo *mgrAddrFirst;
#endif
-static SOCKADDR_TYPE ManagerAddress;
-static SOCKADDR_TYPE FromAddress;
+static SOCKADDR_TYPE ManagerAddress;
+static SOCKADDR_TYPE FromAddress;
#ifdef SOCKLEN_FIELD
#define ManagerAddressLen SOCKLEN_FIELD(ManagerAddress)
@@ -127,67 +129,61 @@ static SOCKLEN_TYPE ManagerAddressLen, FromAddressLen;
#if defined(IPv6) && defined(AF_INET6)
static struct multicastinfo {
- struct multicastinfo *next;
- struct addrinfo *ai;
- int hops;
+ struct multicastinfo *next;
+ struct addrinfo *ai;
+ int hops;
} *mcastlist;
#endif
-static void XdmcpAddHost(
- const struct sockaddr *from,
- int fromlen,
- ARRAY8Ptr AuthenticationName,
- ARRAY8Ptr hostname,
- ARRAY8Ptr status);
+static void XdmcpAddHost(const struct sockaddr *from,
+ int fromlen,
+ ARRAY8Ptr AuthenticationName,
+ ARRAY8Ptr hostname, ARRAY8Ptr status);
-static void XdmcpSelectHost(
- const struct sockaddr *host_sockaddr,
- int host_len,
- ARRAY8Ptr AuthenticationName);
+static void XdmcpSelectHost(const struct sockaddr *host_sockaddr,
+ int host_len, ARRAY8Ptr AuthenticationName);
static void get_xdmcp_sock(void);
static void send_query_msg(void);
-static void recv_willing_msg(
- struct sockaddr * /*from*/,
- int /*fromlen*/,
- unsigned /*length*/);
+static void recv_willing_msg(struct sockaddr * /*from */ ,
+ int /*fromlen */ ,
+ unsigned /*length */ );
static void send_request_msg(void);
-static void recv_accept_msg(unsigned /*length*/);
+static void recv_accept_msg(unsigned /*length */ );
-static void recv_decline_msg(unsigned /*length*/);
+static void recv_decline_msg(unsigned /*length */ );
static void send_manage_msg(void);
-static void recv_refuse_msg(unsigned /*length*/);
+static void recv_refuse_msg(unsigned /*length */ );
-static void recv_failed_msg(unsigned /*length*/);
+static void recv_failed_msg(unsigned /*length */ );
static void send_keepalive_msg(void);
-static void recv_alive_msg(unsigned /*length*/);
+static void recv_alive_msg(unsigned /*length */ );
+
+static void XdmcpFatal(const char * /*type */ ,
+ ARRAY8Ptr /*status */ );
-static void XdmcpFatal(
- const char * /*type*/,
- ARRAY8Ptr /*status*/);
-
-static void XdmcpWarning(const char * /*str*/);
+static void XdmcpWarning(const char * /*str */ );
-static void get_manager_by_name(
- int /*argc*/,
- char ** /*argv*/,
- int /*i*/);
+static void get_manager_by_name(int /*argc */ ,
+ char ** /*argv */ ,
+ int /*i */ );
-static void get_fromaddr_by_name(int /*argc*/, char ** /*argv*/, int /*i*/);
+static void get_fromaddr_by_name(int /*argc */ , char ** /*argv */ ,
+ int /*i */ );
#if defined(IPv6) && defined(AF_INET6)
-static int get_mcast_options(int /*argc*/, char ** /*argv*/, int /*i*/);
+static int get_mcast_options(int /*argc */ , char ** /*argv */ , int /*i */ );
#endif
-static void receive_packet(int /*socketfd*/);
+static void receive_packet(int /*socketfd */ );
static void send_packet(void);
@@ -195,15 +191,13 @@ static void timeout(void);
static void restart(void);
-static void XdmcpBlockHandler(
- pointer /*data*/,
- struct timeval ** /*wt*/,
- pointer /*LastSelectMask*/);
+static void XdmcpBlockHandler(pointer /*data */ ,
+ struct timeval ** /*wt */ ,
+ pointer /*LastSelectMask */ );
-static void XdmcpWakeupHandler(
- pointer /*data*/,
- int /*i*/,
- pointer /*LastSelectMask*/);
+static void XdmcpWakeupHandler(pointer /*data */ ,
+ int /*i */ ,
+ pointer /*LastSelectMask */ );
#define XSERV_t
#define TRANS_SERVER
@@ -217,23 +211,23 @@ static void XdmcpWakeupHandler(
static ARRAY8 ManufacturerDisplayID;
static void
-XdmcpRegisterManufacturerDisplayID (const char *name, int length)
+XdmcpRegisterManufacturerDisplayID(const char *name, int length)
{
- int i;
+ int i;
- XdmcpDisposeARRAY8 (&ManufacturerDisplayID);
- if (!XdmcpAllocARRAY8 (&ManufacturerDisplayID, length))
- return;
+ XdmcpDisposeARRAY8(&ManufacturerDisplayID);
+ if (!XdmcpAllocARRAY8(&ManufacturerDisplayID, length))
+ return;
for (i = 0; i < length; i++)
- ManufacturerDisplayID.data[i] = (CARD8) name[i];
+ ManufacturerDisplayID.data[i] = (CARD8) name[i];
}
-static unsigned short xdm_udp_port = XDM_UDP_PORT;
-static Bool OneSession = FALSE;
-static const char *xdm_from = NULL;
+static unsigned short xdm_udp_port = XDM_UDP_PORT;
+static Bool OneSession = FALSE;
+static const char *xdm_from = NULL;
void
-XdmcpUseMsg (void)
+XdmcpUseMsg(void)
{
ErrorF("-query host-name contact named host for XDMCP\n");
ErrorF("-broadcast broadcast for XDMCP\n");
@@ -242,7 +236,8 @@ XdmcpUseMsg (void)
#endif
ErrorF("-indirect host-name contact named host for indirect XDMCP\n");
ErrorF("-port port-num UDP port number to send messages to\n");
- ErrorF("-from local-address specify the local address to connect from\n");
+ ErrorF
+ ("-from local-address specify the local address to connect from\n");
ErrorF("-once Terminate server after one session\n");
ErrorF("-class display-class specify display class to send in manage\n");
#ifdef HASXDMAUTH
@@ -251,71 +246,71 @@ XdmcpUseMsg (void)
ErrorF("-displayID display-id manufacturer display ID for request\n");
}
-int
+int
XdmcpOptions(int argc, char **argv, int i)
{
if (strcmp(argv[i], "-query") == 0) {
- get_manager_by_name(argc, argv, i++);
- XDM_INIT_STATE = XDM_QUERY;
- AccessUsingXdmcp ();
- return i + 1;
+ get_manager_by_name(argc, argv, i++);
+ XDM_INIT_STATE = XDM_QUERY;
+ AccessUsingXdmcp();
+ return i + 1;
}
if (strcmp(argv[i], "-broadcast") == 0) {
- XDM_INIT_STATE = XDM_BROADCAST;
- AccessUsingXdmcp ();
- return i + 1;
+ XDM_INIT_STATE = XDM_BROADCAST;
+ AccessUsingXdmcp();
+ return i + 1;
}
#if defined(IPv6) && defined(AF_INET6)
if (strcmp(argv[i], "-multicast") == 0) {
- i = get_mcast_options(argc, argv, ++i);
- XDM_INIT_STATE = XDM_MULTICAST;
- AccessUsingXdmcp ();
- return i + 1;
+ i = get_mcast_options(argc, argv, ++i);
+ XDM_INIT_STATE = XDM_MULTICAST;
+ AccessUsingXdmcp();
+ return i + 1;
}
#endif
if (strcmp(argv[i], "-indirect") == 0) {
- get_manager_by_name(argc, argv, i++);
- XDM_INIT_STATE = XDM_INDIRECT;
- AccessUsingXdmcp ();
- return i + 1;
+ get_manager_by_name(argc, argv, i++);
+ XDM_INIT_STATE = XDM_INDIRECT;
+ AccessUsingXdmcp();
+ return i + 1;
}
if (strcmp(argv[i], "-port") == 0) {
- if (++i == argc) {
- FatalError("Xserver: missing port number in command line\n");
- }
- xdm_udp_port = (unsigned short) atoi(argv[i]);
- return i + 1;
+ if (++i == argc) {
+ FatalError("Xserver: missing port number in command line\n");
+ }
+ xdm_udp_port = (unsigned short) atoi(argv[i]);
+ return i + 1;
}
if (strcmp(argv[i], "-from") == 0) {
- get_fromaddr_by_name(argc, argv, ++i);
- return i + 1;
+ get_fromaddr_by_name(argc, argv, ++i);
+ return i + 1;
}
if (strcmp(argv[i], "-once") == 0) {
- OneSession = TRUE;
- return i + 1;
+ OneSession = TRUE;
+ return i + 1;
}
if (strcmp(argv[i], "-class") == 0) {
- if (++i == argc) {
- FatalError("Xserver: missing class name in command line\n");
- }
- defaultDisplayClass = argv[i];
- return i + 1;
+ if (++i == argc) {
+ FatalError("Xserver: missing class name in command line\n");
+ }
+ defaultDisplayClass = argv[i];
+ return i + 1;
}
#ifdef HASXDMAUTH
if (strcmp(argv[i], "-cookie") == 0) {
- if (++i == argc) {
- FatalError("Xserver: missing cookie data in command line\n");
- }
- xdmAuthCookie = argv[i];
- return i + 1;
+ if (++i == argc) {
+ FatalError("Xserver: missing cookie data in command line\n");
+ }
+ xdmAuthCookie = argv[i];
+ return i + 1;
}
#endif
if (strcmp(argv[i], "-displayID") == 0) {
- if (++i == argc) {
- FatalError("Xserver: missing displayID in command line\n");
- }
- XdmcpRegisterManufacturerDisplayID (argv[i], strlen (argv[i]));
- return i + 1;
+ if (++i == argc) {
+ FatalError("Xserver: missing displayID in command line\n");
+ }
+ XdmcpRegisterManufacturerDisplayID(argv[i], strlen(argv[i]));
+ return i + 1;
}
return i;
}
@@ -326,7 +321,6 @@ XdmcpOptions(int argc, char **argv, int i)
* state machine.
*/
-
/*
* Save all broadcast addresses away so BroadcastQuery
* packets get sent everywhere
@@ -335,22 +329,23 @@ XdmcpOptions(int argc, char **argv, int i)
#define MAX_BROADCAST 10
/* This stays sockaddr_in since IPv6 doesn't support broadcast */
-static struct sockaddr_in BroadcastAddresses[MAX_BROADCAST];
-static int NumBroadcastAddresses;
+static struct sockaddr_in BroadcastAddresses[MAX_BROADCAST];
+static int NumBroadcastAddresses;
void
-XdmcpRegisterBroadcastAddress (const struct sockaddr_in *addr)
+XdmcpRegisterBroadcastAddress(const struct sockaddr_in *addr)
{
- struct sockaddr_in *bcast;
+ struct sockaddr_in *bcast;
+
if (NumBroadcastAddresses >= MAX_BROADCAST)
- return;
+ return;
bcast = &BroadcastAddresses[NumBroadcastAddresses++];
- memset(bcast, 0, sizeof (struct sockaddr_in));
+ memset(bcast, 0, sizeof(struct sockaddr_in));
#ifdef BSD44SOCKETS
bcast->sin_len = addr->sin_len;
#endif
bcast->sin_family = addr->sin_family;
- bcast->sin_port = htons (xdm_udp_port);
+ bcast->sin_port = htons(xdm_udp_port);
bcast->sin_addr = addr->sin_addr;
}
@@ -360,59 +355,59 @@ XdmcpRegisterBroadcastAddress (const struct sockaddr_in *addr)
* the specified authentication type
*/
-static ARRAYofARRAY8 AuthenticationNames, AuthenticationDatas;
+static ARRAYofARRAY8 AuthenticationNames, AuthenticationDatas;
typedef struct _AuthenticationFuncs {
- ValidatorFunc Validator;
- GeneratorFunc Generator;
- AddAuthorFunc AddAuth;
+ ValidatorFunc Validator;
+ GeneratorFunc Generator;
+ AddAuthorFunc AddAuth;
} AuthenticationFuncsRec, *AuthenticationFuncsPtr;
-static AuthenticationFuncsPtr AuthenticationFuncsList;
+static AuthenticationFuncsPtr AuthenticationFuncsList;
void
-XdmcpRegisterAuthentication (
- const char *name,
- int namelen,
- const char *data,
- int datalen,
- ValidatorFunc Validator,
- GeneratorFunc Generator,
- AddAuthorFunc AddAuth)
+XdmcpRegisterAuthentication(const char *name,
+ int namelen,
+ const char *data,
+ int datalen,
+ ValidatorFunc Validator,
+ GeneratorFunc Generator, AddAuthorFunc AddAuth)
{
- int i;
- ARRAY8 AuthenticationName, AuthenticationData;
- static AuthenticationFuncsPtr newFuncs;
-
- if (!XdmcpAllocARRAY8 (&AuthenticationName, namelen))
- return;
- if (!XdmcpAllocARRAY8 (&AuthenticationData, datalen))
- {
- XdmcpDisposeARRAY8 (&AuthenticationName);
- return;
+ int i;
+ ARRAY8 AuthenticationName, AuthenticationData;
+ static AuthenticationFuncsPtr newFuncs;
+
+ if (!XdmcpAllocARRAY8(&AuthenticationName, namelen))
+ return;
+ if (!XdmcpAllocARRAY8(&AuthenticationData, datalen)) {
+ XdmcpDisposeARRAY8(&AuthenticationName);
+ return;
}
for (i = 0; i < namelen; i++)
- AuthenticationName.data[i] = name[i];
+ AuthenticationName.data[i] = name[i];
for (i = 0; i < datalen; i++)
- AuthenticationData.data[i] = data[i];
- if (!(XdmcpReallocARRAYofARRAY8 (&AuthenticationNames,
- AuthenticationNames.length + 1) &&
- XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas,
- AuthenticationDatas.length + 1) &&
- (newFuncs = malloc((AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec)))))
- {
- XdmcpDisposeARRAY8 (&AuthenticationName);
- XdmcpDisposeARRAY8 (&AuthenticationData);
- return;
+ AuthenticationData.data[i] = data[i];
+ if (!(XdmcpReallocARRAYofARRAY8(&AuthenticationNames,
+ AuthenticationNames.length + 1) &&
+ XdmcpReallocARRAYofARRAY8(&AuthenticationDatas,
+ AuthenticationDatas.length + 1) &&
+ (newFuncs =
+ malloc((AuthenticationNames.length +
+ 1) * sizeof(AuthenticationFuncsRec))))) {
+ XdmcpDisposeARRAY8(&AuthenticationName);
+ XdmcpDisposeARRAY8(&AuthenticationData);
+ return;
}
for (i = 0; i < AuthenticationNames.length - 1; i++)
- newFuncs[i] = AuthenticationFuncsList[i];
- newFuncs[AuthenticationNames.length-1].Validator = Validator;
- newFuncs[AuthenticationNames.length-1].Generator = Generator;
- newFuncs[AuthenticationNames.length-1].AddAuth = AddAuth;
+ newFuncs[i] = AuthenticationFuncsList[i];
+ newFuncs[AuthenticationNames.length - 1].Validator = Validator;
+ newFuncs[AuthenticationNames.length - 1].Generator = Generator;
+ newFuncs[AuthenticationNames.length - 1].AddAuth = AddAuth;
free(AuthenticationFuncsList);
AuthenticationFuncsList = newFuncs;
- AuthenticationNames.data[AuthenticationNames.length-1] = AuthenticationName;
- AuthenticationDatas.data[AuthenticationDatas.length-1] = AuthenticationData;
+ AuthenticationNames.data[AuthenticationNames.length - 1] =
+ AuthenticationName;
+ AuthenticationDatas.data[AuthenticationDatas.length - 1] =
+ AuthenticationData;
}
/*
@@ -420,104 +415,103 @@ XdmcpRegisterAuthentication (
* set by the manager of the host to be connected to.
*/
-static ARRAY8 noAuthenticationName = {(CARD16) 0, (CARD8Ptr) 0};
-static ARRAY8 noAuthenticationData = {(CARD16) 0, (CARD8Ptr) 0};
-static ARRAY8Ptr AuthenticationName = &noAuthenticationName;
-static ARRAY8Ptr AuthenticationData = &noAuthenticationData;
-static AuthenticationFuncsPtr AuthenticationFuncs;
+static ARRAY8 noAuthenticationName = { (CARD16) 0, (CARD8Ptr) 0 };
+static ARRAY8 noAuthenticationData = { (CARD16) 0, (CARD8Ptr) 0 };
+
+static ARRAY8Ptr AuthenticationName = &noAuthenticationName;
+static ARRAY8Ptr AuthenticationData = &noAuthenticationData;
+static AuthenticationFuncsPtr AuthenticationFuncs;
static void
-XdmcpSetAuthentication (const ARRAY8Ptr name)
+XdmcpSetAuthentication(const ARRAY8Ptr name)
{
- int i;
+ int i;
for (i = 0; i < AuthenticationNames.length; i++)
- if (XdmcpARRAY8Equal (&AuthenticationNames.data[i], name))
- {
- AuthenticationName = &AuthenticationNames.data[i];
- AuthenticationData = &AuthenticationDatas.data[i];
- AuthenticationFuncs = &AuthenticationFuncsList[i];
- break;
- }
+ if (XdmcpARRAY8Equal(&AuthenticationNames.data[i], name)) {
+ AuthenticationName = &AuthenticationNames.data[i];
+ AuthenticationData = &AuthenticationDatas.data[i];
+ AuthenticationFuncs = &AuthenticationFuncsList[i];
+ break;
+ }
}
/*
* Register the host address for the display
*/
-static ARRAY16 ConnectionTypes;
-static ARRAYofARRAY8 ConnectionAddresses;
-static long xdmcpGeneration;
+static ARRAY16 ConnectionTypes;
+static ARRAYofARRAY8 ConnectionAddresses;
+static long xdmcpGeneration;
void
-XdmcpRegisterConnection (
- int type,
- const char *address,
- int addrlen)
+XdmcpRegisterConnection(int type, const char *address, int addrlen)
{
- int i;
- CARD8 *newAddress;
+ int i;
+ CARD8 *newAddress;
- if (xdmcpGeneration != serverGeneration)
- {
- XdmcpDisposeARRAY16 (&ConnectionTypes);
- XdmcpDisposeARRAYofARRAY8 (&ConnectionAddresses);
- xdmcpGeneration = serverGeneration;
+ if (xdmcpGeneration != serverGeneration) {
+ XdmcpDisposeARRAY16(&ConnectionTypes);
+ XdmcpDisposeARRAYofARRAY8(&ConnectionAddresses);
+ xdmcpGeneration = serverGeneration;
}
- if (xdm_from != NULL) { /* Only register the requested address */
- const void *regAddr = address;
- const void *fromAddr = NULL;
- int regAddrlen = addrlen;
-
- if (addrlen == sizeof(struct in_addr)) {
- if (SOCKADDR_FAMILY(FromAddress) == AF_INET) {
- fromAddr = &((struct sockaddr_in *)&FromAddress)->sin_addr;
- }
+ if (xdm_from != NULL) { /* Only register the requested address */
+ const void *regAddr = address;
+ const void *fromAddr = NULL;
+ int regAddrlen = addrlen;
+
+ if (addrlen == sizeof(struct in_addr)) {
+ if (SOCKADDR_FAMILY(FromAddress) == AF_INET) {
+ fromAddr = &((struct sockaddr_in *) &FromAddress)->sin_addr;
+ }
#if defined(IPv6) && defined(AF_INET6)
- else if ((SOCKADDR_FAMILY(FromAddress) == AF_INET6) &&
- IN6_IS_ADDR_V4MAPPED(
- &((struct sockaddr_in6 *)&FromAddress)->sin6_addr)) {
- fromAddr = &((struct sockaddr_in6 *)&FromAddress)->sin6_addr.s6_addr[12];
- }
+ else if ((SOCKADDR_FAMILY(FromAddress) == AF_INET6) &&
+ IN6_IS_ADDR_V4MAPPED(&
+ ((struct sockaddr_in6 *)
+ &FromAddress)->sin6_addr)) {
+ fromAddr =
+ &((struct sockaddr_in6 *) &FromAddress)->sin6_addr.
+ s6_addr[12];
+ }
#endif
- }
+ }
#if defined(IPv6) && defined(AF_INET6)
- else if (addrlen == sizeof(struct in6_addr)) {
- if (SOCKADDR_FAMILY(FromAddress) == AF_INET6) {
- fromAddr = &((struct sockaddr_in6 *)&FromAddress)->sin6_addr;
- } else if ((SOCKADDR_FAMILY(FromAddress) == AF_INET) &&
- IN6_IS_ADDR_V4MAPPED((const struct in6_addr *) address)) {
- fromAddr = &((struct sockaddr_in *)&FromAddress)->sin_addr;
- regAddr = &((struct sockaddr_in6 *)&address)->sin6_addr.s6_addr[12];
- regAddrlen = sizeof(struct in_addr);
- }
- }
+ else if (addrlen == sizeof(struct in6_addr)) {
+ if (SOCKADDR_FAMILY(FromAddress) == AF_INET6) {
+ fromAddr = &((struct sockaddr_in6 *) &FromAddress)->sin6_addr;
+ }
+ else if ((SOCKADDR_FAMILY(FromAddress) == AF_INET) &&
+ IN6_IS_ADDR_V4MAPPED((const struct in6_addr *) address)) {
+ fromAddr = &((struct sockaddr_in *) &FromAddress)->sin_addr;
+ regAddr =
+ &((struct sockaddr_in6 *) &address)->sin6_addr.s6_addr[12];
+ regAddrlen = sizeof(struct in_addr);
+ }
+ }
#endif
- if (!fromAddr || memcmp(regAddr, fromAddr, regAddrlen) != 0) {
- return;
- }
+ if (!fromAddr || memcmp(regAddr, fromAddr, regAddrlen) != 0) {
+ return;
+ }
}
if (ConnectionAddresses.length + 1 == 256)
- return;
- newAddress = malloc(addrlen * sizeof (CARD8));
+ return;
+ newAddress = malloc(addrlen * sizeof(CARD8));
if (!newAddress)
- return;
- if (!XdmcpReallocARRAY16 (&ConnectionTypes, ConnectionTypes.length + 1))
- {
- free(newAddress);
- return;
+ return;
+ if (!XdmcpReallocARRAY16(&ConnectionTypes, ConnectionTypes.length + 1)) {
+ free(newAddress);
+ return;
}
- if (!XdmcpReallocARRAYofARRAY8 (&ConnectionAddresses,
- ConnectionAddresses.length + 1))
- {
- free(newAddress);
- return;
+ if (!XdmcpReallocARRAYofARRAY8(&ConnectionAddresses,
+ ConnectionAddresses.length + 1)) {
+ free(newAddress);
+ return;
}
ConnectionTypes.data[ConnectionTypes.length - 1] = (CARD16) type;
for (i = 0; i < addrlen; i++)
- newAddress[i] = address[i];
- ConnectionAddresses.data[ConnectionAddresses.length-1].data = newAddress;
- ConnectionAddresses.data[ConnectionAddresses.length-1].length = addrlen;
+ newAddress[i] = address[i];
+ ConnectionAddresses.data[ConnectionAddresses.length - 1].data = newAddress;
+ ConnectionAddresses.data[ConnectionAddresses.length - 1].length = addrlen;
}
/*
@@ -525,51 +519,51 @@ XdmcpRegisterConnection (
* to the manager.
*/
-static ARRAYofARRAY8 AuthorizationNames;
+static ARRAYofARRAY8 AuthorizationNames;
void
-XdmcpRegisterAuthorizations (void)
+XdmcpRegisterAuthorizations(void)
{
- XdmcpDisposeARRAYofARRAY8 (&AuthorizationNames);
- RegisterAuthorizations ();
+ XdmcpDisposeARRAYofARRAY8(&AuthorizationNames);
+ RegisterAuthorizations();
}
void
-XdmcpRegisterAuthorization (const char *name, int namelen)
+XdmcpRegisterAuthorization(const char *name, int namelen)
{
- ARRAY8 authName;
- int i;
+ ARRAY8 authName;
+ int i;
- authName.data = malloc(namelen * sizeof (CARD8));
+ authName.data = malloc(namelen * sizeof(CARD8));
if (!authName.data)
- return;
- if (!XdmcpReallocARRAYofARRAY8 (&AuthorizationNames, AuthorizationNames.length +1))
- {
- free(authName.data);
- return;
+ return;
+ if (!XdmcpReallocARRAYofARRAY8
+ (&AuthorizationNames, AuthorizationNames.length + 1)) {
+ free(authName.data);
+ return;
}
for (i = 0; i < namelen; i++)
- authName.data[i] = (CARD8) name[i];
+ authName.data[i] = (CARD8) name[i];
authName.length = namelen;
- AuthorizationNames.data[AuthorizationNames.length-1] = authName;
+ AuthorizationNames.data[AuthorizationNames.length - 1] = authName;
}
/*
* Register the DisplayClass string
*/
-static ARRAY8 DisplayClass;
+static ARRAY8 DisplayClass;
static void
-XdmcpRegisterDisplayClass (const char *name, int length)
+XdmcpRegisterDisplayClass(const char *name, int length)
{
- int i;
+ int i;
- XdmcpDisposeARRAY8 (&DisplayClass);
- if (!XdmcpAllocARRAY8 (&DisplayClass, length))
- return;
+ XdmcpDisposeARRAY8(&DisplayClass);
+ if (!XdmcpAllocARRAY8(&DisplayClass, length))
+ return;
for (i = 0; i < length; i++)
- DisplayClass.data[i] = (CARD8) name[i];
+ DisplayClass.data[i] = (CARD8) name[i];
}
/*
@@ -577,23 +571,23 @@ XdmcpRegisterDisplayClass (const char *name, int length)
* number, set up the state machine
*/
-void
+void
XdmcpInit(void)
{
state = XDM_INIT_STATE;
#ifdef HASXDMAUTH
if (xdmAuthCookie)
- XdmAuthenticationInit (xdmAuthCookie, strlen (xdmAuthCookie));
+ XdmAuthenticationInit(xdmAuthCookie, strlen(xdmAuthCookie));
#endif
- if (state != XDM_OFF)
- {
- XdmcpRegisterAuthorizations();
- XdmcpRegisterDisplayClass (defaultDisplayClass, strlen (defaultDisplayClass));
- AccessUsingXdmcp();
- RegisterBlockAndWakeupHandlers (XdmcpBlockHandler, XdmcpWakeupHandler,
- (pointer) 0);
- timeOutRtx = 0;
- DisplayNumber = (CARD16) atoi(display);
+ if (state != XDM_OFF) {
+ XdmcpRegisterAuthorizations();
+ XdmcpRegisterDisplayClass(defaultDisplayClass,
+ strlen(defaultDisplayClass));
+ AccessUsingXdmcp();
+ RegisterBlockAndWakeupHandlers(XdmcpBlockHandler, XdmcpWakeupHandler,
+ (pointer) 0);
+ timeOutRtx = 0;
+ DisplayNumber = (CARD16) atoi(display);
if (ConnectionTypes.length>1 && xdm_from==NULL)
{
unsigned i=0;
@@ -620,21 +614,20 @@ XdmcpInit(void)
sprintf(ErrorMessage+strlen(ErrorMessage),"Please specify the ip-address you want to use with -from\n");
FatalError(ErrorMessage);
}
- get_xdmcp_sock();
- send_packet();
+ get_xdmcp_sock();
+ send_packet();
}
}
void
-XdmcpReset (void)
+XdmcpReset(void)
{
state = XDM_INIT_STATE;
- if (state != XDM_OFF)
- {
- RegisterBlockAndWakeupHandlers (XdmcpBlockHandler, XdmcpWakeupHandler,
- (pointer) 0);
- timeOutRtx = 0;
- send_packet();
+ if (state != XDM_OFF) {
+ RegisterBlockAndWakeupHandlers(XdmcpBlockHandler, XdmcpWakeupHandler,
+ (pointer) 0);
+ timeOutRtx = 0;
+ send_packet();
}
}
@@ -648,22 +641,22 @@ void
XdmcpOpenDisplay(int sock)
{
if (state != XDM_AWAIT_MANAGE_RESPONSE)
- return;
+ return;
state = XDM_RUN_SESSION;
sessionSocket = sock;
}
-void
+void
XdmcpCloseDisplay(int sock)
{
if ((state != XDM_RUN_SESSION && state != XDM_AWAIT_ALIVE_RESPONSE)
- || sessionSocket != sock)
- return;
+ || sessionSocket != sock)
+ return;
state = XDM_INIT_STATE;
if (OneSession)
- dispatchException |= DE_TERMINATE;
+ dispatchException |= DE_TERMINATE;
else
- dispatchException |= DE_RESET;
+ dispatchException |= DE_RESET;
isItTimeToYield = TRUE;
}
@@ -674,29 +667,26 @@ XdmcpCloseDisplay(int sock)
* dynamically while starting up
*/
-/*ARGSUSED*/
-static void
-XdmcpBlockHandler(
- pointer data, /* unused */
- struct timeval **wt,
- pointer pReadmask)
+ /*ARGSUSED*/ static void
+XdmcpBlockHandler(pointer data, /* unused */
+ struct timeval **wt, pointer pReadmask)
{
- fd_set *LastSelectMask = (fd_set*)pReadmask;
+ fd_set *LastSelectMask = (fd_set *) pReadmask;
CARD32 millisToGo;
if (state == XDM_OFF)
- return;
+ return;
FD_SET(xdmcpSocket, LastSelectMask);
#if defined(IPv6) && defined(AF_INET6)
if (xdmcpSocket6 >= 0)
- FD_SET(xdmcpSocket6, LastSelectMask);
+ FD_SET(xdmcpSocket6, LastSelectMask);
#endif
if (timeOutTime == 0)
- return;
+ return;
millisToGo = timeOutTime - GetTimeInMillis();
if ((int) millisToGo <= 0)
- millisToGo = 1;
- AdjustWaitForDelay (wt, millisToGo);
+ millisToGo = 1;
+ AdjustWaitForDelay(wt, millisToGo);
}
/*
@@ -705,40 +695,33 @@ XdmcpBlockHandler(
* process them appropriately
*/
-/*ARGSUSED*/
-static void
-XdmcpWakeupHandler(
- pointer data, /* unused */
- int i,
- pointer pReadmask)
+ /*ARGSUSED*/ static void
+XdmcpWakeupHandler(pointer data, /* unused */
+ int i, pointer pReadmask)
{
- fd_set* LastSelectMask = (fd_set*)pReadmask;
- fd_set devicesReadable;
+ fd_set *LastSelectMask = (fd_set *) pReadmask;
+ fd_set devicesReadable;
if (state == XDM_OFF)
- return;
- if (i > 0)
- {
- if (FD_ISSET(xdmcpSocket, LastSelectMask))
- {
- receive_packet(xdmcpSocket);
- FD_CLR(xdmcpSocket, LastSelectMask);
- }
+ return;
+ if (i > 0) {
+ if (FD_ISSET(xdmcpSocket, LastSelectMask)) {
+ receive_packet(xdmcpSocket);
+ FD_CLR(xdmcpSocket, LastSelectMask);
+ }
#if defined(IPv6) && defined(AF_INET6)
- if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, LastSelectMask))
- {
- receive_packet(xdmcpSocket6);
- FD_CLR(xdmcpSocket6, LastSelectMask);
- }
+ if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, LastSelectMask)) {
+ receive_packet(xdmcpSocket6);
+ FD_CLR(xdmcpSocket6, LastSelectMask);
+ }
#endif
- XFD_ANDSET(&devicesReadable, LastSelectMask, &EnabledDevices);
- if (XFD_ANYSET(&devicesReadable))
- {
- if (state == XDM_AWAIT_USER_INPUT)
- restart();
- else if (state == XDM_RUN_SESSION)
- keepaliveDormancy = defaultKeepaliveDormancy;
- }
+ XFD_ANDSET(&devicesReadable, LastSelectMask, &EnabledDevices);
+ if (XFD_ANYSET(&devicesReadable)) {
+ if (state == XDM_AWAIT_USER_INPUT)
+ restart();
+ else if (state == XDM_RUN_SESSION)
+ keepaliveDormancy = defaultKeepaliveDormancy;
+ }
}
}
@@ -748,15 +731,13 @@ XdmcpWakeupHandler(
*/
static void
-XdmcpSelectHost(
- const struct sockaddr *host_sockaddr,
- int host_len,
- ARRAY8Ptr AuthenticationName)
+XdmcpSelectHost(const struct sockaddr *host_sockaddr,
+ int host_len, ARRAY8Ptr AuthenticationName)
{
state = XDM_START_CONNECTION;
memmove(&req_sockaddr, host_sockaddr, host_len);
req_socklen = host_len;
- XdmcpSetAuthentication (AuthenticationName);
+ XdmcpSetAuthentication(AuthenticationName);
send_packet();
}
@@ -797,14 +778,10 @@ void XdmcpHostSelected(int HostIdx)
}
#endif
-/*ARGSUSED*/
-static void
-XdmcpAddHost(
- const struct sockaddr *from,
- int fromlen,
- ARRAY8Ptr AuthenticationName,
- ARRAY8Ptr hostname,
- ARRAY8Ptr status)
+ /*ARGSUSED*/ static void
+XdmcpAddHost(const struct sockaddr *from,
+ int fromlen,
+ ARRAY8Ptr AuthenticationName, ARRAY8Ptr hostname, ARRAY8Ptr status)
{
#ifdef _MSC_VER
char szHostName[100];
@@ -842,7 +819,7 @@ XdmcpAddHost(
* do the appropriate thing
*/
-static ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" };
+static ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" };
static void
receive_packet(int socketfd)
@@ -853,43 +830,43 @@ receive_packet(int socketfd)
struct sockaddr_in from;
#endif
int fromlen = sizeof(from);
- XdmcpHeader header;
+ XdmcpHeader header;
/* read message off socket */
- if (!XdmcpFill (socketfd, &buffer, (XdmcpNetaddr) &from, &fromlen))
- return;
+ if (!XdmcpFill(socketfd, &buffer, (XdmcpNetaddr) & from, &fromlen))
+ return;
/* reset retransmission backoff */
timeOutRtx = 0;
- if (!XdmcpReadHeader (&buffer, &header))
- return;
+ if (!XdmcpReadHeader(&buffer, &header))
+ return;
if (header.version != XDM_PROTOCOL_VERSION)
- return;
+ return;
switch (header.opcode) {
case WILLING:
- recv_willing_msg((struct sockaddr *) &from, fromlen, header.length);
- break;
+ recv_willing_msg((struct sockaddr *) &from, fromlen, header.length);
+ break;
case UNWILLING:
- XdmcpFatal("Manager unwilling", &UnwillingMessage);
- break;
+ XdmcpFatal("Manager unwilling", &UnwillingMessage);
+ break;
case ACCEPT:
- recv_accept_msg(header.length);
- break;
+ recv_accept_msg(header.length);
+ break;
case DECLINE:
- recv_decline_msg(header.length);
- break;
+ recv_decline_msg(header.length);
+ break;
case REFUSE:
- recv_refuse_msg(header.length);
- break;
+ recv_refuse_msg(header.length);
+ break;
case FAILED:
- recv_failed_msg(header.length);
- break;
+ recv_failed_msg(header.length);
+ break;
case ALIVE:
- recv_alive_msg(header.length);
- break;
+ recv_alive_msg(header.length);
+ break;
}
}
@@ -901,6 +878,7 @@ static void
send_packet(void)
{
int rtx;
+
switch (state) {
case XDM_QUERY:
case XDM_BROADCAST:
@@ -908,23 +886,23 @@ send_packet(void)
#if defined(IPv6) && defined(AF_INET6)
case XDM_MULTICAST:
#endif
- send_query_msg();
- break;
+ send_query_msg();
+ break;
case XDM_START_CONNECTION:
- send_request_msg();
- break;
+ send_request_msg();
+ break;
case XDM_MANAGE:
- send_manage_msg();
- break;
+ send_manage_msg();
+ break;
case XDM_KEEPALIVE:
- send_keepalive_msg();
- break;
+ send_keepalive_msg();
+ break;
default:
- break;
+ break;
}
rtx = (XDM_MIN_RTX << timeOutRtx);
if (rtx > XDM_MAX_RTX)
- rtx = XDM_MAX_RTX;
+ rtx = XDM_MAX_RTX;
timeOutTime = GetTimeInMillis() + rtx * 1000;
}
@@ -934,9 +912,9 @@ send_packet(void)
*/
static void
-XdmcpDeadSession (const char *reason)
+XdmcpDeadSession(const char *reason)
{
- ErrorF ("XDM: %s, declaring session dead\n", reason);
+ ErrorF("XDM: %s, declaring session dead\n", reason);
state = XDM_INIT_STATE;
isItTimeToYield = TRUE;
dispatchException |= DE_RESET;
@@ -953,67 +931,65 @@ static void
timeout(void)
{
timeOutRtx++;
- if (state == XDM_AWAIT_ALIVE_RESPONSE && timeOutRtx >= XDM_KA_RTX_LIMIT )
- {
- XdmcpDeadSession ("too many keepalive retransmissions");
- return;
+ if (state == XDM_AWAIT_ALIVE_RESPONSE && timeOutRtx >= XDM_KA_RTX_LIMIT) {
+ XdmcpDeadSession("too many keepalive retransmissions");
+ return;
}
- else if (timeOutRtx >= XDM_RTX_LIMIT)
- {
- /* Quit if "-once" specified, otherwise reset and try again. */
+ else if (timeOutRtx >= XDM_RTX_LIMIT) {
+ /* Quit if "-once" specified, otherwise reset and try again. */
if (OneSession) {
- dispatchException |= DE_TERMINATE;
- ErrorF("XDM: too many retransmissions\n");
- } else {
- XdmcpDeadSession("too many retransmissions");
- }
- return;
+ dispatchException |= DE_TERMINATE;
+ ErrorF("XDM: too many retransmissions\n");
+ }
+ else {
+ XdmcpDeadSession("too many retransmissions");
+ }
+ return;
}
#if defined(IPv6) && defined(AF_INET6)
if (state == XDM_COLLECT_QUERY || state == XDM_COLLECT_INDIRECT_QUERY) {
- /* Try next address */
- for (mgrAddr = mgrAddr->ai_next; ; mgrAddr = mgrAddr->ai_next) {
- if (mgrAddr == NULL) {
- mgrAddr = mgrAddrFirst;
- }
- if (mgrAddr->ai_family == AF_INET
- || mgrAddr->ai_family == AF_INET6)
- break;
- }
+ /* Try next address */
+ for (mgrAddr = mgrAddr->ai_next;; mgrAddr = mgrAddr->ai_next) {
+ if (mgrAddr == NULL) {
+ mgrAddr = mgrAddrFirst;
+ }
+ if (mgrAddr->ai_family == AF_INET || mgrAddr->ai_family == AF_INET6)
+ break;
+ }
#ifndef SIN6_LEN
- ManagerAddressLen = mgrAddr->ai_addrlen;
+ ManagerAddressLen = mgrAddr->ai_addrlen;
#endif
- memcpy(&ManagerAddress, mgrAddr->ai_addr, mgrAddr->ai_addrlen);
+ memcpy(&ManagerAddress, mgrAddr->ai_addr, mgrAddr->ai_addrlen);
}
#endif
switch (state) {
case XDM_COLLECT_QUERY:
- state = XDM_QUERY;
- break;
+ state = XDM_QUERY;
+ break;
case XDM_COLLECT_BROADCAST_QUERY:
- state = XDM_BROADCAST;
- break;
+ state = XDM_BROADCAST;
+ break;
#if defined(IPv6) && defined(AF_INET6)
case XDM_COLLECT_MULTICAST_QUERY:
- state = XDM_MULTICAST;
- break;
+ state = XDM_MULTICAST;
+ break;
#endif
case XDM_COLLECT_INDIRECT_QUERY:
- state = XDM_INDIRECT;
- break;
+ state = XDM_INDIRECT;
+ break;
case XDM_AWAIT_REQUEST_RESPONSE:
- state = XDM_START_CONNECTION;
- break;
+ state = XDM_START_CONNECTION;
+ break;
case XDM_AWAIT_MANAGE_RESPONSE:
- state = XDM_MANAGE;
- break;
+ state = XDM_MANAGE;
+ break;
case XDM_AWAIT_ALIVE_RESPONSE:
- state = XDM_KEEPALIVE;
- break;
+ state = XDM_KEEPALIVE;
+ break;
default:
- break;
+ break;
}
send_packet();
}
@@ -1027,26 +1003,26 @@ restart(void)
}
static int
-XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type)
+XdmcpCheckAuthentication(ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type)
{
- return (XdmcpARRAY8Equal (Name, AuthenticationName) &&
- (AuthenticationName->length == 0 ||
- (*AuthenticationFuncs->Validator) (AuthenticationData, Data, packet_type)));
+ return (XdmcpARRAY8Equal(Name, AuthenticationName) &&
+ (AuthenticationName->length == 0 ||
+ (*AuthenticationFuncs->Validator) (AuthenticationData, Data,
+ packet_type)));
}
static int
-XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data)
+XdmcpAddAuthorization(ARRAY8Ptr name, ARRAY8Ptr data)
{
AddAuthorFunc AddAuth;
if (AuthenticationFuncs && AuthenticationFuncs->AddAuth)
- AddAuth = AuthenticationFuncs->AddAuth;
+ AddAuth = AuthenticationFuncs->AddAuth;
else
- AddAuth = AddAuthorization;
- return (*AddAuth) ((unsigned short)name->length,
- (char *)name->data,
- (unsigned short)data->length,
- (char *)data->data);
+ AddAuth = AddAuthorization;
+ return (*AddAuth) ((unsigned short) name->length,
+ (char *) name->data,
+ (unsigned short) data->length, (char *) data->data);
}
/*
@@ -1061,507 +1037,484 @@ get_xdmcp_sock(void)
struct netconfig *nconf;
if ((xdmcpSocket = t_open("/dev/udp", O_RDWR, 0)) < 0) {
- XdmcpWarning("t_open() of /dev/udp failed");
- return;
+ XdmcpWarning("t_open() of /dev/udp failed");
+ return;
}
- if( t_bind(xdmcpSocket,NULL,NULL) < 0 ) {
- XdmcpWarning("UDP socket creation failed");
- t_error("t_bind(xdmcpSocket) failed" );
- t_close(xdmcpSocket);
- return;
+ if (t_bind(xdmcpSocket, NULL, NULL) < 0) {
+ XdmcpWarning("UDP socket creation failed");
+ t_error("t_bind(xdmcpSocket) failed");
+ t_close(xdmcpSocket);
+ return;
}
/*
* This part of the code looks contrived. It will actually fit in nicely
* when the CLTS part of Xtrans is implemented.
*/
-
- if( (nconf=getnetconfigent("udp")) == NULL ) {
- XdmcpWarning("UDP socket creation failed: getnetconfigent()");
- t_unbind(xdmcpSocket);
- t_close(xdmcpSocket);
- return;
+
+ if ((nconf = getnetconfigent("udp")) == NULL) {
+ XdmcpWarning("UDP socket creation failed: getnetconfigent()");
+ t_unbind(xdmcpSocket);
+ t_close(xdmcpSocket);
+ return;
}
-
- if( netdir_options(nconf, ND_SET_BROADCAST, xdmcpSocket, NULL) ) {
- XdmcpWarning("UDP set broadcast option failed: netdir_options()");
- freenetconfigent(nconf);
- t_unbind(xdmcpSocket);
- t_close(xdmcpSocket);
- return;
+
+ if (netdir_options(nconf, ND_SET_BROADCAST, xdmcpSocket, NULL)) {
+ XdmcpWarning("UDP set broadcast option failed: netdir_options()");
+ freenetconfigent(nconf);
+ t_unbind(xdmcpSocket);
+ t_close(xdmcpSocket);
+ return;
}
-
+
freenetconfigent(nconf);
#else
int soopts = 1;
#if defined(IPv6) && defined(AF_INET6)
if ((xdmcpSocket6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
- XdmcpWarning("INET6 UDP socket creation failed");
+ XdmcpWarning("INET6 UDP socket creation failed");
#endif
if ((xdmcpSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- XdmcpWarning("UDP socket creation failed");
+ XdmcpWarning("UDP socket creation failed");
#ifdef SO_BROADCAST
- else if (setsockopt(xdmcpSocket, SOL_SOCKET, SO_BROADCAST, (char *)&soopts,
- sizeof(soopts)) < 0)
- XdmcpWarning("UDP set broadcast socket-option failed");
-#endif /* SO_BROADCAST */
+ else if (setsockopt(xdmcpSocket, SOL_SOCKET, SO_BROADCAST, (char *) &soopts,
+ sizeof(soopts)) < 0)
+ XdmcpWarning("UDP set broadcast socket-option failed");
+#endif /* SO_BROADCAST */
if (xdm_from)
{
if (xdmcpSocket >= 0 && SOCKADDR_FAMILY(FromAddress)==AF_INET) {
- if (bind(xdmcpSocket, (struct sockaddr *)&FromAddress,
- FromAddressLen) < 0) {
- FatalError("Xserver: failed to bind to -from address: %s error %d\n", xdm_from, WSAGetLastError());
- }
+ if (bind(xdmcpSocket, (struct sockaddr *) &FromAddress,
+ FromAddressLen) < 0) {
+ FatalError("Xserver: failed to bind to -from address: %s error %d\n", xdm_from, WSAGetLastError());
+ }
}
else if (xdmcpSocket6 >= 0 && SOCKADDR_FAMILY(FromAddress)==AF_INET6) {
- if (bind(xdmcpSocket6, (struct sockaddr *)&FromAddress,
- FromAddressLen) < 0) {
- FatalError("Xserver: failed to bind to -from address: %s error %d\n", xdm_from, WSAGetLastError());
- }
+ if (bind(xdmcpSocket6, (struct sockaddr *)&FromAddress,
+ FromAddressLen) < 0) {
+ FatalError("Xserver: failed to bind to -from address: %s error %d\n", xdm_from, WSAGetLastError());
+ }
}
}
-#endif /* STREAMSCONN */
+#endif /* STREAMSCONN */
}
static void
send_query_msg(void)
{
- XdmcpHeader header;
- Bool broadcast = FALSE;
+ XdmcpHeader header;
+ Bool broadcast = FALSE;
+
#if defined(IPv6) && defined(AF_INET6)
- Bool multicast = FALSE;
+ Bool multicast = FALSE;
#endif
- int i;
- int socketfd = xdmcpSocket;
+ int i;
+ int socketfd = xdmcpSocket;
header.version = XDM_PROTOCOL_VERSION;
- switch(state){
+ switch (state) {
case XDM_QUERY:
- header.opcode = (CARD16) QUERY;
- state = XDM_COLLECT_QUERY;
- break;
+ header.opcode = (CARD16) QUERY;
+ state = XDM_COLLECT_QUERY;
+ break;
case XDM_BROADCAST:
- header.opcode = (CARD16) BROADCAST_QUERY;
- state = XDM_COLLECT_BROADCAST_QUERY;
- broadcast = TRUE;
- break;
+ header.opcode = (CARD16) BROADCAST_QUERY;
+ state = XDM_COLLECT_BROADCAST_QUERY;
+ broadcast = TRUE;
+ break;
#if defined(IPv6) && defined(AF_INET6)
case XDM_MULTICAST:
- header.opcode = (CARD16) BROADCAST_QUERY;
- state = XDM_COLLECT_MULTICAST_QUERY;
- multicast = TRUE;
- break;
+ header.opcode = (CARD16) BROADCAST_QUERY;
+ state = XDM_COLLECT_MULTICAST_QUERY;
+ multicast = TRUE;
+ break;
#endif
case XDM_INDIRECT:
- header.opcode = (CARD16) INDIRECT_QUERY;
- state = XDM_COLLECT_INDIRECT_QUERY;
- break;
+ header.opcode = (CARD16) INDIRECT_QUERY;
+ state = XDM_COLLECT_INDIRECT_QUERY;
+ break;
default:
- break;
+ break;
}
header.length = 1;
for (i = 0; i < AuthenticationNames.length; i++)
- header.length += 2 + AuthenticationNames.data[i].length;
+ header.length += 2 + AuthenticationNames.data[i].length;
- XdmcpWriteHeader (&buffer, &header);
- XdmcpWriteARRAYofARRAY8 (&buffer, &AuthenticationNames);
- if (broadcast)
- {
- int i;
+ XdmcpWriteHeader(&buffer, &header);
+ XdmcpWriteARRAYofARRAY8(&buffer, &AuthenticationNames);
+ if (broadcast) {
+ int i;
- for (i = 0; i < NumBroadcastAddresses; i++)
- XdmcpFlush (xdmcpSocket, &buffer, (XdmcpNetaddr) &BroadcastAddresses[i],
- sizeof (struct sockaddr_in));
+ for (i = 0; i < NumBroadcastAddresses; i++)
+ XdmcpFlush(xdmcpSocket, &buffer,
+ (XdmcpNetaddr) & BroadcastAddresses[i],
+ sizeof(struct sockaddr_in));
}
#if defined(IPv6) && defined(AF_INET6)
- else if (multicast)
- {
- struct multicastinfo *mcl;
- struct addrinfo *ai;
-
- for (mcl = mcastlist; mcl != NULL; mcl = mcl->next) {
- for (ai = mcl->ai ; ai != NULL; ai = ai->ai_next) {
- if (ai->ai_family == AF_INET) {
- int hopflag = mcl->hops;
- socketfd = xdmcpSocket;
- setsockopt(socketfd, IPPROTO_IP, IP_MULTICAST_TTL,
- (char*)&hopflag, sizeof(hopflag));
- } else if (ai->ai_family == AF_INET6) {
- int hopflag6 = mcl->hops;
- socketfd = xdmcpSocket6;
- setsockopt(socketfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
- (char*)&hopflag6, sizeof(hopflag6));
- } else {
- continue;
- }
- XdmcpFlush (socketfd, &buffer,
- (XdmcpNetaddr) ai->ai_addr, ai->ai_addrlen);
- break;
- }
- }
+ else if (multicast) {
+ struct multicastinfo *mcl;
+ struct addrinfo *ai;
+
+ for (mcl = mcastlist; mcl != NULL; mcl = mcl->next) {
+ for (ai = mcl->ai; ai != NULL; ai = ai->ai_next) {
+ if (ai->ai_family == AF_INET) {
+ int hopflag = mcl->hops;
+
+ socketfd = xdmcpSocket;
+ setsockopt(socketfd, IPPROTO_IP, IP_MULTICAST_TTL,
+ (char*)&hopflag, sizeof(hopflag));
+ }
+ else if (ai->ai_family == AF_INET6) {
+ int hopflag6 = mcl->hops;
+
+ socketfd = xdmcpSocket6;
+ setsockopt(socketfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
+ (char*)&hopflag6, sizeof(hopflag6));
+ }
+ else {
+ continue;
+ }
+ XdmcpFlush(socketfd, &buffer,
+ (XdmcpNetaddr) ai->ai_addr, ai->ai_addrlen);
+ break;
+ }
+ }
}
#endif
- else
- {
+ else {
#if defined(IPv6) && defined(AF_INET6)
- if (SOCKADDR_FAMILY(ManagerAddress) == AF_INET6)
- socketfd = xdmcpSocket6;
-#endif
- XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &ManagerAddress,
- ManagerAddressLen);
+ if (SOCKADDR_FAMILY(ManagerAddress) == AF_INET6)
+ socketfd = xdmcpSocket6;
+#endif
+ XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) & ManagerAddress,
+ ManagerAddressLen);
}
}
static void
-recv_willing_msg(
- struct sockaddr *from,
- int fromlen,
- unsigned length)
+recv_willing_msg(struct sockaddr *from, int fromlen, unsigned length)
{
- ARRAY8 authenticationName;
- ARRAY8 hostname;
- ARRAY8 status;
+ ARRAY8 authenticationName;
+ ARRAY8 hostname;
+ ARRAY8 status;
authenticationName.data = 0;
hostname.data = 0;
status.data = 0;
- if (XdmcpReadARRAY8 (&buffer, &authenticationName) &&
- XdmcpReadARRAY8 (&buffer, &hostname) &&
- XdmcpReadARRAY8 (&buffer, &status))
- {
- if (length == 6 + authenticationName.length +
- hostname.length + status.length)
- {
- switch (state)
- {
- case XDM_COLLECT_QUERY:
- XdmcpSelectHost(from, fromlen, &authenticationName);
- break;
- case XDM_COLLECT_BROADCAST_QUERY:
+ if (XdmcpReadARRAY8(&buffer, &authenticationName) &&
+ XdmcpReadARRAY8(&buffer, &hostname) &&
+ XdmcpReadARRAY8(&buffer, &status)) {
+ if (length == 6 + authenticationName.length +
+ hostname.length + status.length) {
+ switch (state) {
+ case XDM_COLLECT_QUERY:
+ XdmcpSelectHost(from, fromlen, &authenticationName);
+ break;
+ case XDM_COLLECT_BROADCAST_QUERY:
#if defined(IPv6) && defined(AF_INET6)
- case XDM_COLLECT_MULTICAST_QUERY:
+ case XDM_COLLECT_MULTICAST_QUERY:
#endif
- case XDM_COLLECT_INDIRECT_QUERY:
- XdmcpAddHost(from, fromlen, &authenticationName, &hostname, &status);
- break;
- default:
- break;
- }
- }
+ case XDM_COLLECT_INDIRECT_QUERY:
+ XdmcpAddHost(from, fromlen, &authenticationName, &hostname,
+ &status);
+ break;
+ default:
+ break;
+ }
+ }
}
- XdmcpDisposeARRAY8 (&authenticationName);
- XdmcpDisposeARRAY8 (&hostname);
- XdmcpDisposeARRAY8 (&status);
+ XdmcpDisposeARRAY8(&authenticationName);
+ XdmcpDisposeARRAY8(&hostname);
+ XdmcpDisposeARRAY8(&status);
}
static void
send_request_msg(void)
{
- XdmcpHeader header;
- int length;
- int i;
- CARD16 XdmcpConnectionType;
- ARRAY8 authenticationData;
- int socketfd = xdmcpSocket;
-
- switch (SOCKADDR_FAMILY(ManagerAddress))
- {
- case AF_INET: XdmcpConnectionType=FamilyInternet; break;
+ XdmcpHeader header;
+ int length;
+ int i;
+ CARD16 XdmcpConnectionType;
+ ARRAY8 authenticationData;
+ int socketfd = xdmcpSocket;
+
+ switch (SOCKADDR_FAMILY(ManagerAddress)) {
+ case AF_INET:
+ XdmcpConnectionType = FamilyInternet;
+ break;
#if defined(IPv6) && defined(AF_INET6)
- case AF_INET6: XdmcpConnectionType=FamilyInternet6; break;
+ case AF_INET6:
+ XdmcpConnectionType = FamilyInternet6;
+ break;
#endif
- default: XdmcpConnectionType=0xffff; break;
+ default:
+ XdmcpConnectionType = 0xffff;
+ break;
}
header.version = XDM_PROTOCOL_VERSION;
header.opcode = (CARD16) REQUEST;
- length = 2; /* display number */
- length += 1 + 2 * ConnectionTypes.length; /* connection types */
- length += 1; /* connection addresses */
+ length = 2; /* display number */
+ length += 1 + 2 * ConnectionTypes.length; /* connection types */
+ length += 1; /* connection addresses */
for (i = 0; i < ConnectionAddresses.length; i++)
- length += 2 + ConnectionAddresses.data[i].length;
+ length += 2 + ConnectionAddresses.data[i].length;
authenticationData.length = 0;
authenticationData.data = 0;
- if (AuthenticationFuncs)
- {
- (*AuthenticationFuncs->Generator) (AuthenticationData,
- &authenticationData,
- REQUEST);
+ if (AuthenticationFuncs) {
+ (*AuthenticationFuncs->Generator) (AuthenticationData,
+ &authenticationData, REQUEST);
}
- length += 2 + AuthenticationName->length; /* authentication name */
- length += 2 + authenticationData.length; /* authentication data */
- length += 1; /* authorization names */
+ length += 2 + AuthenticationName->length; /* authentication name */
+ length += 2 + authenticationData.length; /* authentication data */
+ length += 1; /* authorization names */
for (i = 0; i < AuthorizationNames.length; i++)
- length += 2 + AuthorizationNames.data[i].length;
- length += 2 + ManufacturerDisplayID.length; /* display ID */
+ length += 2 + AuthorizationNames.data[i].length;
+ length += 2 + ManufacturerDisplayID.length; /* display ID */
header.length = length;
- if (!XdmcpWriteHeader (&buffer, &header))
- {
- XdmcpDisposeARRAY8 (&authenticationData);
- return;
+ if (!XdmcpWriteHeader(&buffer, &header)) {
+ XdmcpDisposeARRAY8(&authenticationData);
+ return;
}
- XdmcpWriteCARD16 (&buffer, DisplayNumber);
- XdmcpWriteCARD8 (&buffer, ConnectionTypes.length);
-
- /* The connection array is send reordered, so that connections of */
- /* the same address type as the XDMCP manager connection are send */
- /* first. This works around a bug in xdm. mario@klebsch.de */
- for (i = 0; i < (int)ConnectionTypes.length; i++)
- if (ConnectionTypes.data[i]==XdmcpConnectionType)
- XdmcpWriteCARD16 (&buffer, ConnectionTypes.data[i]);
- for (i = 0; i < (int)ConnectionTypes.length; i++)
- if (ConnectionTypes.data[i]!=XdmcpConnectionType)
- XdmcpWriteCARD16 (&buffer, ConnectionTypes.data[i]);
-
- XdmcpWriteCARD8 (&buffer, ConnectionAddresses.length);
- for (i = 0; i < (int)ConnectionAddresses.length; i++)
- if ( (i<ConnectionTypes.length) &&
- (ConnectionTypes.data[i]==XdmcpConnectionType) )
- XdmcpWriteARRAY8 (&buffer, &ConnectionAddresses.data[i]);
- for (i = 0; i < (int)ConnectionAddresses.length; i++)
- if ( (i>=ConnectionTypes.length) ||
- (ConnectionTypes.data[i]!=XdmcpConnectionType) )
- XdmcpWriteARRAY8 (&buffer, &ConnectionAddresses.data[i]);
-
- XdmcpWriteARRAY8 (&buffer, AuthenticationName);
- XdmcpWriteARRAY8 (&buffer, &authenticationData);
- XdmcpDisposeARRAY8 (&authenticationData);
- XdmcpWriteARRAYofARRAY8 (&buffer, &AuthorizationNames);
- XdmcpWriteARRAY8 (&buffer, &ManufacturerDisplayID);
+ XdmcpWriteCARD16(&buffer, DisplayNumber);
+ XdmcpWriteCARD8(&buffer, ConnectionTypes.length);
+
+ /* The connection array is send reordered, so that connections of */
+ /* the same address type as the XDMCP manager connection are send */
+ /* first. This works around a bug in xdm. mario@klebsch.de */
+ for (i = 0; i < (int) ConnectionTypes.length; i++)
+ if (ConnectionTypes.data[i] == XdmcpConnectionType)
+ XdmcpWriteCARD16(&buffer, ConnectionTypes.data[i]);
+ for (i = 0; i < (int) ConnectionTypes.length; i++)
+ if (ConnectionTypes.data[i] != XdmcpConnectionType)
+ XdmcpWriteCARD16(&buffer, ConnectionTypes.data[i]);
+
+ XdmcpWriteCARD8(&buffer, ConnectionAddresses.length);
+ for (i = 0; i < (int) ConnectionAddresses.length; i++)
+ if ((i < ConnectionTypes.length) &&
+ (ConnectionTypes.data[i] == XdmcpConnectionType))
+ XdmcpWriteARRAY8(&buffer, &ConnectionAddresses.data[i]);
+ for (i = 0; i < (int) ConnectionAddresses.length; i++)
+ if ((i >= ConnectionTypes.length) ||
+ (ConnectionTypes.data[i] != XdmcpConnectionType))
+ XdmcpWriteARRAY8(&buffer, &ConnectionAddresses.data[i]);
+
+ XdmcpWriteARRAY8(&buffer, AuthenticationName);
+ XdmcpWriteARRAY8(&buffer, &authenticationData);
+ XdmcpDisposeARRAY8(&authenticationData);
+ XdmcpWriteARRAYofARRAY8(&buffer, &AuthorizationNames);
+ XdmcpWriteARRAY8(&buffer, &ManufacturerDisplayID);
#if defined(IPv6) && defined(AF_INET6)
if (SOCKADDR_FAMILY(req_sockaddr) == AF_INET6)
- socketfd = xdmcpSocket6;
+ socketfd = xdmcpSocket6;
#endif
- if (XdmcpFlush (socketfd, &buffer,
- (XdmcpNetaddr) &req_sockaddr, req_socklen))
- state = XDM_AWAIT_REQUEST_RESPONSE;
+ if (XdmcpFlush(socketfd, &buffer,
+ (XdmcpNetaddr) & req_sockaddr, req_socklen))
+ state = XDM_AWAIT_REQUEST_RESPONSE;
}
static void
recv_accept_msg(unsigned length)
{
- CARD32 AcceptSessionID;
- ARRAY8 AcceptAuthenticationName, AcceptAuthenticationData;
- ARRAY8 AcceptAuthorizationName, AcceptAuthorizationData;
+ CARD32 AcceptSessionID;
+ ARRAY8 AcceptAuthenticationName, AcceptAuthenticationData;
+ ARRAY8 AcceptAuthorizationName, AcceptAuthorizationData;
if (state != XDM_AWAIT_REQUEST_RESPONSE)
- return;
+ return;
AcceptAuthenticationName.data = 0;
AcceptAuthenticationData.data = 0;
AcceptAuthorizationName.data = 0;
AcceptAuthorizationData.data = 0;
- if (XdmcpReadCARD32 (&buffer, &AcceptSessionID) &&
- XdmcpReadARRAY8 (&buffer, &AcceptAuthenticationName) &&
- XdmcpReadARRAY8 (&buffer, &AcceptAuthenticationData) &&
- XdmcpReadARRAY8 (&buffer, &AcceptAuthorizationName) &&
- XdmcpReadARRAY8 (&buffer, &AcceptAuthorizationData))
- {
- if (length == 12 + AcceptAuthenticationName.length +
- AcceptAuthenticationData.length +
- AcceptAuthorizationName.length +
- AcceptAuthorizationData.length)
- {
- if (!XdmcpCheckAuthentication (&AcceptAuthenticationName,
- &AcceptAuthenticationData, ACCEPT))
- {
- XdmcpFatal ("Authentication Failure", &AcceptAuthenticationName);
- }
- /* permit access control manipulations from this host */
- AugmentSelf (&req_sockaddr, req_socklen);
- /* if the authorization specified in the packet fails
- * to be acceptable, enable the local addresses
- */
- if (!XdmcpAddAuthorization (&AcceptAuthorizationName,
- &AcceptAuthorizationData))
- {
- AddLocalHosts ();
- }
- SessionID = AcceptSessionID;
- state = XDM_MANAGE;
- send_packet();
- }
+ if (XdmcpReadCARD32(&buffer, &AcceptSessionID) &&
+ XdmcpReadARRAY8(&buffer, &AcceptAuthenticationName) &&
+ XdmcpReadARRAY8(&buffer, &AcceptAuthenticationData) &&
+ XdmcpReadARRAY8(&buffer, &AcceptAuthorizationName) &&
+ XdmcpReadARRAY8(&buffer, &AcceptAuthorizationData)) {
+ if (length == 12 + AcceptAuthenticationName.length +
+ AcceptAuthenticationData.length +
+ AcceptAuthorizationName.length + AcceptAuthorizationData.length) {
+ if (!XdmcpCheckAuthentication(&AcceptAuthenticationName,
+ &AcceptAuthenticationData, ACCEPT)) {
+ XdmcpFatal("Authentication Failure", &AcceptAuthenticationName);
+ }
+ /* permit access control manipulations from this host */
+ AugmentSelf(&req_sockaddr, req_socklen);
+ /* if the authorization specified in the packet fails
+ * to be acceptable, enable the local addresses
+ */
+ if (!XdmcpAddAuthorization(&AcceptAuthorizationName,
+ &AcceptAuthorizationData)) {
+ AddLocalHosts();
+ }
+ SessionID = AcceptSessionID;
+ state = XDM_MANAGE;
+ send_packet();
+ }
}
- XdmcpDisposeARRAY8 (&AcceptAuthenticationName);
- XdmcpDisposeARRAY8 (&AcceptAuthenticationData);
- XdmcpDisposeARRAY8 (&AcceptAuthorizationName);
- XdmcpDisposeARRAY8 (&AcceptAuthorizationData);
+ XdmcpDisposeARRAY8(&AcceptAuthenticationName);
+ XdmcpDisposeARRAY8(&AcceptAuthenticationData);
+ XdmcpDisposeARRAY8(&AcceptAuthorizationName);
+ XdmcpDisposeARRAY8(&AcceptAuthorizationData);
}
static void
recv_decline_msg(unsigned length)
{
- ARRAY8 status, DeclineAuthenticationName, DeclineAuthenticationData;
+ ARRAY8 status, DeclineAuthenticationName, DeclineAuthenticationData;
status.data = 0;
DeclineAuthenticationName.data = 0;
DeclineAuthenticationData.data = 0;
- if (XdmcpReadARRAY8 (&buffer, &status) &&
- XdmcpReadARRAY8 (&buffer, &DeclineAuthenticationName) &&
- XdmcpReadARRAY8 (&buffer, &DeclineAuthenticationData))
- {
- if (length == 6 + status.length +
- DeclineAuthenticationName.length +
- DeclineAuthenticationData.length &&
- XdmcpCheckAuthentication (&DeclineAuthenticationName,
- &DeclineAuthenticationData, DECLINE))
- {
- XdmcpFatal ("Session declined", &status);
- }
+ if (XdmcpReadARRAY8(&buffer, &status) &&
+ XdmcpReadARRAY8(&buffer, &DeclineAuthenticationName) &&
+ XdmcpReadARRAY8(&buffer, &DeclineAuthenticationData)) {
+ if (length == 6 + status.length +
+ DeclineAuthenticationName.length +
+ DeclineAuthenticationData.length &&
+ XdmcpCheckAuthentication(&DeclineAuthenticationName,
+ &DeclineAuthenticationData, DECLINE)) {
+ XdmcpFatal("Session declined", &status);
+ }
}
- XdmcpDisposeARRAY8 (&status);
- XdmcpDisposeARRAY8 (&DeclineAuthenticationName);
- XdmcpDisposeARRAY8 (&DeclineAuthenticationData);
+ XdmcpDisposeARRAY8(&status);
+ XdmcpDisposeARRAY8(&DeclineAuthenticationName);
+ XdmcpDisposeARRAY8(&DeclineAuthenticationData);
}
static void
send_manage_msg(void)
{
- XdmcpHeader header;
+ XdmcpHeader header;
int socketfd = xdmcpSocket;
header.version = XDM_PROTOCOL_VERSION;
header.opcode = (CARD16) MANAGE;
header.length = 8 + DisplayClass.length;
- if (!XdmcpWriteHeader (&buffer, &header))
- return;
- XdmcpWriteCARD32 (&buffer, SessionID);
- XdmcpWriteCARD16 (&buffer, DisplayNumber);
- XdmcpWriteARRAY8 (&buffer, &DisplayClass);
+ if (!XdmcpWriteHeader(&buffer, &header))
+ return;
+ XdmcpWriteCARD32(&buffer, SessionID);
+ XdmcpWriteCARD16(&buffer, DisplayNumber);
+ XdmcpWriteARRAY8(&buffer, &DisplayClass);
state = XDM_AWAIT_MANAGE_RESPONSE;
#if defined(IPv6) && defined(AF_INET6)
if (SOCKADDR_FAMILY(req_sockaddr) == AF_INET6)
- socketfd = xdmcpSocket6;
+ socketfd = xdmcpSocket6;
#endif
- XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen);
+ XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) & req_sockaddr, req_socklen);
}
static void
recv_refuse_msg(unsigned length)
{
- CARD32 RefusedSessionID;
+ CARD32 RefusedSessionID;
if (state != XDM_AWAIT_MANAGE_RESPONSE)
- return;
+ return;
if (length != 4)
- return;
- if (XdmcpReadCARD32 (&buffer, &RefusedSessionID))
- {
- if (RefusedSessionID == SessionID)
- {
- state = XDM_START_CONNECTION;
- send_packet();
- }
+ return;
+ if (XdmcpReadCARD32(&buffer, &RefusedSessionID)) {
+ if (RefusedSessionID == SessionID) {
+ state = XDM_START_CONNECTION;
+ send_packet();
+ }
}
}
static void
recv_failed_msg(unsigned length)
{
- CARD32 FailedSessionID;
- ARRAY8 status;
+ CARD32 FailedSessionID;
+ ARRAY8 status;
if (state != XDM_AWAIT_MANAGE_RESPONSE)
- return;
+ return;
status.data = 0;
- if (XdmcpReadCARD32 (&buffer, &FailedSessionID) &&
- XdmcpReadARRAY8 (&buffer, &status))
- {
- if (length == 6 + status.length &&
- SessionID == FailedSessionID)
- {
- XdmcpFatal ("Session failed", &status);
- }
+ if (XdmcpReadCARD32(&buffer, &FailedSessionID) &&
+ XdmcpReadARRAY8(&buffer, &status)) {
+ if (length == 6 + status.length && SessionID == FailedSessionID) {
+ XdmcpFatal("Session failed", &status);
+ }
}
- XdmcpDisposeARRAY8 (&status);
+ XdmcpDisposeARRAY8(&status);
}
static void
send_keepalive_msg(void)
{
- XdmcpHeader header;
+ XdmcpHeader header;
int socketfd = xdmcpSocket;
header.version = XDM_PROTOCOL_VERSION;
header.opcode = (CARD16) KEEPALIVE;
header.length = 6;
- XdmcpWriteHeader (&buffer, &header);
- XdmcpWriteCARD16 (&buffer, DisplayNumber);
- XdmcpWriteCARD32 (&buffer, SessionID);
+ XdmcpWriteHeader(&buffer, &header);
+ XdmcpWriteCARD16(&buffer, DisplayNumber);
+ XdmcpWriteCARD32(&buffer, SessionID);
state = XDM_AWAIT_ALIVE_RESPONSE;
#if defined(IPv6) && defined(AF_INET6)
if (SOCKADDR_FAMILY(req_sockaddr) == AF_INET6)
- socketfd = xdmcpSocket6;
+ socketfd = xdmcpSocket6;
#endif
- XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen);
+ XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) & req_sockaddr, req_socklen);
}
static void
-recv_alive_msg (unsigned length)
+recv_alive_msg(unsigned length)
{
- CARD8 SessionRunning;
- CARD32 AliveSessionID;
+ CARD8 SessionRunning;
+ CARD32 AliveSessionID;
if (state != XDM_AWAIT_ALIVE_RESPONSE)
- return;
+ return;
if (length != 5)
- return;
- if (XdmcpReadCARD8 (&buffer, &SessionRunning) &&
- XdmcpReadCARD32 (&buffer, &AliveSessionID))
- {
- if (SessionRunning && AliveSessionID == SessionID)
- {
- /* backoff dormancy period */
- state = XDM_RUN_SESSION;
- if ((GetTimeInMillis() - lastDeviceEventTime.milliseconds) >
- keepaliveDormancy * 1000)
- {
- keepaliveDormancy <<= 1;
- if (keepaliveDormancy > XDM_MAX_DORMANCY)
- keepaliveDormancy = XDM_MAX_DORMANCY;
- }
- timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000;
- }
- else
- {
- XdmcpDeadSession ("Alive response indicates session dead");
- }
+ return;
+ if (XdmcpReadCARD8(&buffer, &SessionRunning) &&
+ XdmcpReadCARD32(&buffer, &AliveSessionID)) {
+ if (SessionRunning && AliveSessionID == SessionID) {
+ /* backoff dormancy period */
+ state = XDM_RUN_SESSION;
+ if ((GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds) >
+ keepaliveDormancy * 1000) {
+ keepaliveDormancy <<= 1;
+ if (keepaliveDormancy > XDM_MAX_DORMANCY)
+ keepaliveDormancy = XDM_MAX_DORMANCY;
+ }
+ timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000;
+ }
+ else {
+ XdmcpDeadSession("Alive response indicates session dead");
+ }
}
}
-static void
-XdmcpFatal (
- const char *type,
- ARRAY8Ptr status)
+static void
+XdmcpFatal(const char *type, ARRAY8Ptr status)
{
- FatalError ("XDMCP fatal error: %s %*.*s\n", type,
- status->length, status->length, status->data);
+ FatalError("XDMCP fatal error: %s %*.*s\n", type,
+ status->length, status->length, status->data);
}
-static void
+static void
XdmcpWarning(const char *str)
{
ErrorF("XDMCP warning: %s\n", str);
}
static void
-get_addr_by_name(
- const char *argtype,
- const char *namestr,
- int port,
- int socktype,
- SOCKADDR_TYPE *addr,
- SOCKLEN_TYPE *addrlen
+get_addr_by_name(const char *argtype,
+ const char *namestr,
+ int port,
+ int socktype, SOCKADDR_TYPE * addr, SOCKLEN_TYPE * addrlen
#if defined(IPv6) && defined(AF_INET6)
- ,
- struct addrinfo **aip,
- struct addrinfo **aifirstp
+ , struct addrinfo **aip, struct addrinfo **aifirstp
#endif
)
{
@@ -1580,111 +1533,106 @@ get_addr_by_name(
hints.ai_socktype = socktype;
if (port == 0) {
- pport = NULL;
- } else if (port > 0 && port < 65535) {
- snprintf(portstr, sizeof(portstr), "%d", port);
- } else {
- FatalError("Xserver: port out of range: %d\n", port);
+ pport = NULL;
+ }
+ else if (port > 0 && port < 65535) {
+ snprintf(portstr, sizeof(portstr), "%d", port);
+ }
+ else {
+ FatalError("Xserver: port out of range: %d\n", port);
}
if (*aifirstp != NULL) {
- freeaddrinfo(*aifirstp);
- *aifirstp = NULL;
+ freeaddrinfo(*aifirstp);
+ *aifirstp = NULL;
}
if ((gaierr = getaddrinfo(namestr, pport, &hints, aifirstp)) == 0) {
- for (ai = *aifirstp; ai != NULL; ai = ai->ai_next) {
- if (ai->ai_family == AF_INET || ai->ai_family == AF_INET6)
- break;
- }
- if ((ai == NULL) || (ai->ai_addrlen > sizeof(SOCKADDR_TYPE))) {
- FatalError ("Xserver: %s host %s not on supported network type\n",
- argtype, namestr);
- } else {
- *aip = ai;
- *addrlen = ai->ai_addrlen;
- memcpy(addr, ai->ai_addr, ai->ai_addrlen);
- }
- } else {
- FatalError("Xserver: %s: %s %s\n", gai_strerror(gaierr), argtype, namestr);
- }
+ for (ai = *aifirstp; ai != NULL; ai = ai->ai_next) {
+ if (ai->ai_family == AF_INET || ai->ai_family == AF_INET6)
+ break;
+ }
+ if ((ai == NULL) || (ai->ai_addrlen > sizeof(SOCKADDR_TYPE))) {
+ FatalError("Xserver: %s host %s not on supported network type\n",
+ argtype, namestr);
+ }
+ else {
+ *aip = ai;
+ *addrlen = ai->ai_addrlen;
+ memcpy(addr, ai->ai_addr, ai->ai_addrlen);
+ }
+ }
+ else {
+ FatalError("Xserver: %s: %s %s\n", gai_strerror(gaierr), argtype,
+ namestr);
+ }
#else
struct hostent *hep;
+
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
#endif
- if (!(hep = _XGethostbyname(namestr, hparams)))
- {
- FatalError("Xserver: %s unknown host: %s\n", argtype, namestr);
+ if (!(hep = _XGethostbyname(namestr, hparams))) {
+ FatalError("Xserver: %s unknown host: %s\n", argtype, namestr);
}
- if (hep->h_length == sizeof (struct in_addr))
- {
- memmove(&addr->sin_addr, hep->h_addr, hep->h_length);
- *addrlen = sizeof(struct sockaddr_in);
- addr->sin_family = AF_INET;
- addr->sin_port = htons (port);
+ if (hep->h_length == sizeof(struct in_addr)) {
+ memmove(&addr->sin_addr, hep->h_addr, hep->h_length);
+ *addrlen = sizeof(struct sockaddr_in);
+ addr->sin_family = AF_INET;
+ addr->sin_port = htons(port);
}
- else
- {
- FatalError("Xserver: %s host on strange network %s\n", argtype, namestr);
+ else {
+ FatalError("Xserver: %s host on strange network %s\n", argtype,
+ namestr);
}
#endif
}
static void
-get_manager_by_name(
- int argc,
- char **argv,
- int i)
+get_manager_by_name(int argc, char **argv, int i)
{
PSOCKADDR_IN queryAddr = NULL;
u_long u_lqueryAddr = 0;
- if ((i + 1) == argc)
- {
- FatalError("Xserver: missing %s host name in command line\n", argv[i]);
+ if ((i + 1) == argc) {
+
+ FatalError("Xserver: missing %s host name in command line\n", argv[i]);
}
- get_addr_by_name(argv[i], argv[i+1], xdm_udp_port, SOCK_DGRAM,
- &ManagerAddress, &ManagerAddressLen
+ get_addr_by_name(argv[i], argv[i + 1], xdm_udp_port, SOCK_DGRAM,
+ &ManagerAddress, &ManagerAddressLen
#if defined(IPv6) && defined(AF_INET6)
- , &mgrAddr, &mgrAddrFirst
+ , &mgrAddr, &mgrAddrFirst
#endif
- );
+ );
queryAddr = (PSOCKADDR_IN)&ManagerAddress;
u_lqueryAddr = queryAddr->sin_addr.S_un.S_addr;
match_interface(u_lqueryAddr);
}
-
static void
-get_fromaddr_by_name(
- int argc,
- char **argv,
- int i)
+get_fromaddr_by_name(int argc, char **argv, int i)
{
#if defined(IPv6) && defined(AF_INET6)
struct addrinfo *ai = NULL;
struct addrinfo *aifirst = NULL;
#endif
- if (i == argc)
- {
- FatalError("Xserver: missing -from host name in command line\n");
+ if (i == argc) {
+ FatalError("Xserver: missing -from host name in command line\n");
}
get_addr_by_name("-from", argv[i], 0, 0, &FromAddress, &FromAddressLen
#if defined(IPv6) && defined(AF_INET6)
- , &ai, &aifirst
+ , &ai, &aifirst
#endif
- );
+ );
#if defined(IPv6) && defined(AF_INET6)
if (aifirst != NULL)
- freeaddrinfo(aifirst);
+ freeaddrinfo(aifirst);
#endif
xdm_from = argv[i];
}
-
#if defined(IPv6) && defined(AF_INET6)
static int
get_mcast_options(int argc, char **argv, int i)
@@ -1697,61 +1645,65 @@ get_mcast_options(int argc, char **argv, int i)
struct addrinfo *ai, *firstai;
if ((i < argc) && (argv[i][0] != '-') && (argv[i][0] != '+')) {
- address = argv[i++];
- if ((i < argc) && (argv[i][0] != '-') && (argv[i][0] != '+')) {
- hopcount = strtol(argv[i++], NULL, 10);
- if ((hopcount < 1) || (hopcount > 255)) {
- FatalError("Xserver: multicast hop count out of range: %d\n",
- hopcount);
- }
- }
+ address = argv[i++];
+ if ((i < argc) && (argv[i][0] != '-') && (argv[i][0] != '+')) {
+ hopcount = strtol(argv[i++], NULL, 10);
+ if ((hopcount < 1) || (hopcount > 255)) {
+ FatalError("Xserver: multicast hop count out of range: %d\n",
+ hopcount);
+ }
+ }
}
if (xdm_udp_port > 0 && xdm_udp_port < 65535) {
- snprintf(portstr, sizeof(portstr), "%d", xdm_udp_port);
- } else {
- FatalError("Xserver: port out of range: %d\n", xdm_udp_port);
+ snprintf(portstr, sizeof(portstr), "%d", xdm_udp_port);
+ }
+ else {
+ FatalError("Xserver: port out of range: %d\n", xdm_udp_port);
}
memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_DGRAM;
if ((gaierr = getaddrinfo(address, portstr, &hints, &firstai)) == 0) {
- for (ai = firstai; ai != NULL; ai = ai->ai_next) {
- if (((ai->ai_family == AF_INET) &&
- IN_MULTICAST(((struct sockaddr_in *) ai->ai_addr)
- ->sin_addr.s_addr))
- || ((ai->ai_family == AF_INET6) &&
- IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *) ai->ai_addr)
- ->sin6_addr)))
- break;
- }
- if (ai == NULL) {
- FatalError ("Xserver: address not supported multicast type %s\n",
- address);
- } else {
- struct multicastinfo *mcastinfo, *mcl;
-
- mcastinfo = malloc(sizeof(struct multicastinfo));
- mcastinfo->next = NULL;
- mcastinfo->ai = firstai;
- mcastinfo->hops = hopcount;
-
- if (mcastlist == NULL) {
- mcastlist = mcastinfo;
- } else {
- for (mcl = mcastlist; mcl->next != NULL; mcl = mcl->next) {
- /* Do nothing - just find end of list */
- }
- mcl->next = mcastinfo;
- }
- }
- } else {
- FatalError("Xserver: %s: %s\n", gai_strerror(gaierr), address);
- }
+ for (ai = firstai; ai != NULL; ai = ai->ai_next) {
+ if (((ai->ai_family == AF_INET) &&
+ IN_MULTICAST(((struct sockaddr_in *) ai->ai_addr)
+ ->sin_addr.s_addr))
+ || ((ai->ai_family == AF_INET6) &&
+ IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *) ai->ai_addr)
+ ->sin6_addr)))
+ break;
+ }
+ if (ai == NULL) {
+ FatalError("Xserver: address not supported multicast type %s\n",
+ address);
+ }
+ else {
+ struct multicastinfo *mcastinfo, *mcl;
+
+ mcastinfo = malloc(sizeof(struct multicastinfo));
+ mcastinfo->next = NULL;
+ mcastinfo->ai = firstai;
+ mcastinfo->hops = hopcount;
+
+ if (mcastlist == NULL) {
+ mcastlist = mcastinfo;
+ }
+ else {
+ for (mcl = mcastlist; mcl->next != NULL; mcl = mcl->next) {
+ /* Do nothing - just find end of list */
+ }
+ mcl->next = mcastinfo;
+ }
+ }
+ }
+ else {
+ FatalError("Xserver: %s: %s\n", gai_strerror(gaierr), address);
+ }
return i;
}
#endif
#else
-static int xdmcp_non_empty; /* avoid complaint by ranlib */
-#endif /* XDMCP */
+static int xdmcp_non_empty; /* avoid complaint by ranlib */
+#endif /* XDMCP */
diff --git a/xorg-server/os/xprintf.c b/xorg-server/os/xprintf.c
index fecaa1443..226e68c2b 100644
--- a/xorg-server/os/xprintf.c
+++ b/xorg-server/os/xprintf.c
@@ -68,20 +68,20 @@
#include <string.h>
#ifdef asprintf
-# undef asprintf
+#undef asprintf
#endif
#ifdef vasprintf
-# undef vasprintf
+#undef vasprintf
#endif
#ifndef va_copy
-# ifdef __va_copy
-# define va_copy __va_copy
-# else
-# ifndef _MSC_VER
-# error "no working va_copy was found"
-# endif
-# endif
+#ifdef __va_copy
+#define va_copy __va_copy
+#else
+#ifndef _MSC_VER
+#error "no working va_copy was found"
+#endif
+#endif
#endif
/**
@@ -95,7 +95,7 @@
* @return size of allocated buffer, or -1 on error.
*/
int
-Xvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va)
+Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va)
{
#ifdef HAVE_VASPRINTF
return vasprintf(ret, format, va);
@@ -123,7 +123,7 @@ Xvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va)
}
#ifndef HAVE_VASPRINTF
-# define vasprintf Xvasprintf
+#define vasprintf Xvasprintf
#endif
/**
@@ -137,10 +137,11 @@ Xvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va)
* @return size of allocated buffer, or -1 on error.
*/
int
-Xasprintf(char ** ret, const char * _X_RESTRICT_KYWD format, ...)
+Xasprintf(char **ret, const char *_X_RESTRICT_KYWD format, ...)
{
int size;
va_list va;
+
va_start(va, format);
size = vasprintf(ret, format, va);
va_end(va);
@@ -159,11 +160,12 @@ Xasprintf(char ** ret, const char * _X_RESTRICT_KYWD format, ...)
* @return size of allocated buffer
*/
int
-XNFvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va)
+XNFvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va)
{
int size = vasprintf(ret, format, va);
+
if ((size == -1) || (*ret == NULL)) {
- FatalError("XNFvasprintf failed: %s", strerror(errno));
+ FatalError("XNFvasprintf failed: %s", strerror(errno));
}
return size;
}
@@ -180,10 +182,11 @@ XNFvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va)
* @return size of allocated buffer
*/
int
-XNFasprintf(char ** ret, const char * _X_RESTRICT_KYWD format, ...)
+XNFasprintf(char **ret, const char *_X_RESTRICT_KYWD format, ...)
{
int size;
va_list va;
+
va_start(va, format);
size = XNFvasprintf(ret, format, va);
va_end(va);
@@ -197,18 +200,20 @@ Xvprintf(const char *format, va_list va)
char *ret;
if (vasprintf(&ret, format, va) == -1)
- ret = NULL;
+ ret = NULL;
return ret;
}
-char *Xprintf(const char *format, ...)
+char *
+Xprintf(const char *format, ...)
{
char *ret;
va_list va;
+
va_start(va, format);
if (vasprintf(&ret, format, va) == -1)
- ret = NULL;
+ ret = NULL;
va_end(va);
return ret;
}
@@ -223,10 +228,12 @@ XNFvprintf(const char *format, va_list va)
return ret;
}
-char *XNFprintf(const char *format, ...)
+char *
+XNFprintf(const char *format, ...)
{
char *ret;
va_list va;
+
va_start(va, format);
XNFvasprintf(&ret, format, va);
va_end(va);
diff --git a/xorg-server/os/xsha1.c b/xorg-server/os/xsha1.c
index 518745b4c..dccce74b6 100644
--- a/xorg-server/os/xsha1.c
+++ b/xorg-server/os/xsha1.c
@@ -1,168 +1,195 @@
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "os.h"
-#include "xsha1.h"
-
-#if defined(HAVE_SHA1_IN_LIBMD) /* Use libmd for SHA1 */ \
- || defined(HAVE_SHA1_IN_LIBC) /* Use libc for SHA1 */
-
-# include <sha1.h>
-
-void *x_sha1_init(void)
-{
- SHA1_CTX *ctx = malloc(sizeof(*ctx));
- if (!ctx)
- return NULL;
- SHA1Init(ctx);
- return ctx;
-}
-
-int x_sha1_update(void *ctx, void *data, int size)
-{
- SHA1_CTX *sha1_ctx = ctx;
- SHA1Update(sha1_ctx, data, size);
- return 1;
-}
-
-int x_sha1_final(void *ctx, unsigned char result[20])
-{
- SHA1_CTX *sha1_ctx = ctx;
- SHA1Final(result, sha1_ctx);
- free(sha1_ctx);
- return 1;
-}
-
-#elif defined(HAVE_SHA1_IN_COMMONCRYPTO) /* Use CommonCrypto for SHA1 */
-
-#include <CommonCrypto/CommonDigest.h>
-
-void *x_sha1_init(void)
-{
- CC_SHA1_CTX *ctx = malloc(sizeof(*ctx));
- if (!ctx)
- return NULL;
- CC_SHA1_Init(ctx);
- return ctx;
-}
-
-int x_sha1_update(void *ctx, void *data, int size)
-{
- CC_SHA1_CTX *sha1_ctx = ctx;
- CC_SHA1_Update(sha1_ctx, data, size);
- return 1;
-}
-
-int x_sha1_final(void *ctx, unsigned char result[20])
-{
- CC_SHA1_CTX *sha1_ctx = ctx;
- CC_SHA1_Final(result, sha1_ctx);
- free(sha1_ctx);
- return 1;
-}
-
-#elif defined(HAVE_SHA1_IN_LIBGCRYPT) /* Use libgcrypt for SHA1 */
-
-# include <gcrypt.h>
-
-void *x_sha1_init(void)
-{
- static int init;
- gcry_md_hd_t h;
- gcry_error_t err;
-
- if (!init) {
- if (!gcry_check_version(NULL))
- return NULL;
- gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
- gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
- init = 1;
- }
-
- err = gcry_md_open(&h, GCRY_MD_SHA1, 0);
- if (err)
- return NULL;
- return h;
-}
-
-int x_sha1_update(void *ctx, void *data, int size)
-{
- gcry_md_hd_t h = ctx;
- gcry_md_write(h, data, size);
- return 1;
-}
-
-int x_sha1_final(void *ctx, unsigned char result[20])
-{
- gcry_md_hd_t h = ctx;
- memcpy(result, gcry_md_read(h, GCRY_MD_SHA1), 20);
- gcry_md_close(h);
- return 1;
-}
-
-#elif defined(HAVE_SHA1_IN_LIBSHA1) /* Use libsha1 */
-
-# include <libsha1.h>
-
-void *x_sha1_init(void)
-{
- sha1_ctx *ctx = malloc(sizeof(*ctx));
- if(!ctx)
- return NULL;
- sha1_begin(ctx);
- return ctx;
-}
-
-int x_sha1_update(void *ctx, void *data, int size)
-{
- sha1_hash(data, size, ctx);
- return 1;
-}
-
-int x_sha1_final(void *ctx, unsigned char result[20])
-{
- sha1_end(result, ctx);
- free(ctx);
- return 1;
-}
-
-#else /* Use OpenSSL's libcrypto */
-
-# include <stddef.h> /* buggy openssl/sha.h wants size_t */
-# include <openssl/sha.h>
-
-void *x_sha1_init(void)
-{
- int ret;
- SHA_CTX *ctx = malloc(sizeof(*ctx));
- if (!ctx)
- return NULL;
- ret = SHA1_Init(ctx);
- if (!ret) {
- free(ctx);
- return NULL;
- }
- return ctx;
-}
-
-int x_sha1_update(void *ctx, void *data, int size)
-{
- int ret;
- SHA_CTX *sha_ctx = ctx;
- ret = SHA1_Update(sha_ctx, data, size);
- if (!ret)
- free(sha_ctx);
- return ret;
-}
-
-int x_sha1_final(void *ctx, unsigned char result[20])
-{
- int ret;
- SHA_CTX *sha_ctx = ctx;
- ret = SHA1_Final(result, sha_ctx);
- free(sha_ctx);
- return ret;
-}
-
-#endif
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "os.h"
+#include "xsha1.h"
+
+#if defined(HAVE_SHA1_IN_LIBMD) /* Use libmd for SHA1 */ \
+ || defined(HAVE_SHA1_IN_LIBC) /* Use libc for SHA1 */
+
+#include <sha1.h>
+
+void *
+x_sha1_init(void)
+{
+ SHA1_CTX *ctx = malloc(sizeof(*ctx));
+
+ if (!ctx)
+ return NULL;
+ SHA1Init(ctx);
+ return ctx;
+}
+
+int
+x_sha1_update(void *ctx, void *data, int size)
+{
+ SHA1_CTX *sha1_ctx = ctx;
+
+ SHA1Update(sha1_ctx, data, size);
+ return 1;
+}
+
+int
+x_sha1_final(void *ctx, unsigned char result[20])
+{
+ SHA1_CTX *sha1_ctx = ctx;
+
+ SHA1Final(result, sha1_ctx);
+ free(sha1_ctx);
+ return 1;
+}
+
+#elif defined(HAVE_SHA1_IN_COMMONCRYPTO) /* Use CommonCrypto for SHA1 */
+
+#include <CommonCrypto/CommonDigest.h>
+
+void *
+x_sha1_init(void)
+{
+ CC_SHA1_CTX *ctx = malloc(sizeof(*ctx));
+
+ if (!ctx)
+ return NULL;
+ CC_SHA1_Init(ctx);
+ return ctx;
+}
+
+int
+x_sha1_update(void *ctx, void *data, int size)
+{
+ CC_SHA1_CTX *sha1_ctx = ctx;
+
+ CC_SHA1_Update(sha1_ctx, data, size);
+ return 1;
+}
+
+int
+x_sha1_final(void *ctx, unsigned char result[20])
+{
+ CC_SHA1_CTX *sha1_ctx = ctx;
+
+ CC_SHA1_Final(result, sha1_ctx);
+ free(sha1_ctx);
+ return 1;
+}
+
+#elif defined(HAVE_SHA1_IN_LIBGCRYPT) /* Use libgcrypt for SHA1 */
+
+#include <gcrypt.h>
+
+void *
+x_sha1_init(void)
+{
+ static int init;
+ gcry_md_hd_t h;
+ gcry_error_t err;
+
+ if (!init) {
+ if (!gcry_check_version(NULL))
+ return NULL;
+ gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
+ gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
+ init = 1;
+ }
+
+ err = gcry_md_open(&h, GCRY_MD_SHA1, 0);
+ if (err)
+ return NULL;
+ return h;
+}
+
+int
+x_sha1_update(void *ctx, void *data, int size)
+{
+ gcry_md_hd_t h = ctx;
+
+ gcry_md_write(h, data, size);
+ return 1;
+}
+
+int
+x_sha1_final(void *ctx, unsigned char result[20])
+{
+ gcry_md_hd_t h = ctx;
+
+ memcpy(result, gcry_md_read(h, GCRY_MD_SHA1), 20);
+ gcry_md_close(h);
+ return 1;
+}
+
+#elif defined(HAVE_SHA1_IN_LIBSHA1) /* Use libsha1 */
+
+#include <libsha1.h>
+
+void *
+x_sha1_init(void)
+{
+ sha1_ctx *ctx = malloc(sizeof(*ctx));
+
+ if (!ctx)
+ return NULL;
+ sha1_begin(ctx);
+ return ctx;
+}
+
+int
+x_sha1_update(void *ctx, void *data, int size)
+{
+ sha1_hash(data, size, ctx);
+ return 1;
+}
+
+int
+x_sha1_final(void *ctx, unsigned char result[20])
+{
+ sha1_end(result, ctx);
+ free(ctx);
+ return 1;
+}
+
+#else /* Use OpenSSL's libcrypto */
+
+#include <stddef.h> /* buggy openssl/sha.h wants size_t */
+#include <openssl/sha.h>
+
+void *
+x_sha1_init(void)
+{
+ int ret;
+ SHA_CTX *ctx = malloc(sizeof(*ctx));
+
+ if (!ctx)
+ return NULL;
+ ret = SHA1_Init(ctx);
+ if (!ret) {
+ free(ctx);
+ return NULL;
+ }
+ return ctx;
+}
+
+int
+x_sha1_update(void *ctx, void *data, int size)
+{
+ int ret;
+ SHA_CTX *sha_ctx = ctx;
+
+ ret = SHA1_Update(sha_ctx, data, size);
+ if (!ret)
+ free(sha_ctx);
+ return ret;
+}
+
+int
+x_sha1_final(void *ctx, unsigned char result[20])
+{
+ int ret;
+ SHA_CTX *sha_ctx = ctx;
+
+ ret = SHA1_Final(result, sha_ctx);
+ free(sha_ctx);
+ return ret;
+}
+
+#endif
diff --git a/xorg-server/os/xstrans.c b/xorg-server/os/xstrans.c
index 3d20c4d3d..b902dc41b 100644
--- a/xorg-server/os/xstrans.c
+++ b/xorg-server/os/xstrans.c
@@ -5,7 +5,9 @@
#include <X11/Xfuncproto.h>
/* ErrorF is used by xtrans */
-/* extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2); */
+/*extern _X_EXPORT void
+ErrorF(const char *f, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);*/
#define TRANS_REOPEN
#define TRANS_SERVER
diff --git a/xorg-server/randr/randr.c b/xorg-server/randr/randr.c
index 1551c63b1..9f3df5fbe 100644
--- a/xorg-server/randr/randr.c
+++ b/xorg-server/randr/randr.c
@@ -1,504 +1,494 @@
-/*
- * Copyright © 2000 Compaq Computer Corporation
- * Copyright © 2002 Hewlett-Packard Company
- * Copyright © 2006 Intel Corporation
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- *
- * Author: Jim Gettys, Hewlett-Packard Company, Inc.
- * Keith Packard, Intel Corporation
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "randrstr.h"
-
-/* From render.h */
-#ifndef SubPixelUnknown
-#define SubPixelUnknown 0
-#endif
-
-#define RR_VALIDATE
-static int RRNScreens;
-
-#define wrap(priv,real,mem,func) {\
- priv->mem = real->mem; \
- real->mem = func; \
-}
-
-#define unwrap(priv,real,mem) {\
- real->mem = priv->mem; \
-}
-
-static int ProcRRDispatch (ClientPtr pClient);
-static int SProcRRDispatch (ClientPtr pClient);
-
-int RREventBase;
-int RRErrorBase;
-RESTYPE RRClientType, RREventType; /* resource types for event masks */
-DevPrivateKeyRec RRClientPrivateKeyRec;
-
-DevPrivateKeyRec rrPrivKeyRec;
-
-static void
-RRClientCallback (CallbackListPtr *list,
- pointer closure,
- pointer data)
-{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- rrClientPriv(pClient);
- RRTimesPtr pTimes = (RRTimesPtr) (pRRClient + 1);
- int i;
-
- pRRClient->major_version = 0;
- pRRClient->minor_version = 0;
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen = screenInfo.screens[i];
- rrScrPriv(pScreen);
-
- if (pScrPriv)
- {
- pTimes[i].setTime = pScrPriv->lastSetTime;
- pTimes[i].configTime = pScrPriv->lastConfigTime;
- }
- }
-}
-
-static Bool
-RRCloseScreen (int i, ScreenPtr pScreen)
-{
- rrScrPriv(pScreen);
- int j;
-
- unwrap (pScrPriv, pScreen, CloseScreen);
- for (j = pScrPriv->numCrtcs - 1; j >= 0; j--)
- RRCrtcDestroy (pScrPriv->crtcs[j]);
- for (j = pScrPriv->numOutputs - 1; j >= 0; j--)
- RROutputDestroy (pScrPriv->outputs[j]);
-
- free(pScrPriv->crtcs);
- free(pScrPriv->outputs);
- free(pScrPriv);
- RRNScreens -= 1; /* ok, one fewer screen with RandR running */
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-static void
-SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent *from,
- xRRScreenChangeNotifyEvent *to)
-{
- to->type = from->type;
- to->rotation = from->rotation;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->timestamp, to->timestamp);
- cpswapl(from->configTimestamp, to->configTimestamp);
- cpswapl(from->root, to->root);
- cpswapl(from->window, to->window);
- cpswaps(from->sizeID, to->sizeID);
- cpswaps(from->subpixelOrder, to->subpixelOrder);
- cpswaps(from->widthInPixels, to->widthInPixels);
- cpswaps(from->heightInPixels, to->heightInPixels);
- cpswaps(from->widthInMillimeters, to->widthInMillimeters);
- cpswaps(from->heightInMillimeters, to->heightInMillimeters);
-}
-
-static void
-SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent *from,
- xRRCrtcChangeNotifyEvent *to)
-{
- to->type = from->type;
- to->subCode = from->subCode;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->timestamp, to->timestamp);
- cpswapl(from->window, to->window);
- cpswapl(from->crtc, to->crtc);
- cpswapl(from->mode, to->mode);
- cpswaps(from->rotation, to->rotation);
- /* pad1 */
- cpswaps(from->x, to->x);
- cpswaps(from->y, to->y);
- cpswaps(from->width, to->width);
- cpswaps(from->height, to->height);
-}
-
-static void
-SRROutputChangeNotifyEvent(xRROutputChangeNotifyEvent *from,
- xRROutputChangeNotifyEvent *to)
-{
- to->type = from->type;
- to->subCode = from->subCode;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->timestamp, to->timestamp);
- cpswapl(from->configTimestamp, to->configTimestamp);
- cpswapl(from->window, to->window);
- cpswapl(from->output, to->output);
- cpswapl(from->crtc, to->crtc);
- cpswapl(from->mode, to->mode);
- cpswaps(from->rotation, to->rotation);
- to->connection = from->connection;
- to->subpixelOrder = from->subpixelOrder;
-}
-
-static void
-SRROutputPropertyNotifyEvent(xRROutputPropertyNotifyEvent *from,
- xRROutputPropertyNotifyEvent *to)
-{
- to->type = from->type;
- to->subCode = from->subCode;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->window, to->window);
- cpswapl(from->output, to->output);
- cpswapl(from->atom, to->atom);
- cpswapl(from->timestamp, to->timestamp);
- to->state = from->state;
- /* pad1 */
- /* pad2 */
- /* pad3 */
- /* pad4 */
-}
-
-static void
-SRRNotifyEvent (xEvent *from,
- xEvent *to)
-{
- switch (from->u.u.detail) {
- case RRNotify_CrtcChange:
- SRRCrtcChangeNotifyEvent ((xRRCrtcChangeNotifyEvent *) from,
- (xRRCrtcChangeNotifyEvent *) to);
- break;
- case RRNotify_OutputChange:
- SRROutputChangeNotifyEvent ((xRROutputChangeNotifyEvent *) from,
- (xRROutputChangeNotifyEvent *) to);
- break;
- case RRNotify_OutputProperty:
- SRROutputPropertyNotifyEvent ((xRROutputPropertyNotifyEvent *) from,
- (xRROutputPropertyNotifyEvent *) to);
- break;
- default:
- break;
- }
-}
-
-static int RRGeneration;
-
-Bool RRInit (void)
-{
- if (RRGeneration != serverGeneration)
- {
- if (!RRModeInit ())
- return FALSE;
- if (!RRCrtcInit ())
- return FALSE;
- if (!RROutputInit ())
- return FALSE;
- RRGeneration = serverGeneration;
- }
- if (!dixRegisterPrivateKey(&rrPrivKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- return TRUE;
-}
-
-Bool RRScreenInit(ScreenPtr pScreen)
-{
- rrScrPrivPtr pScrPriv;
-
- if (!RRInit ())
- return FALSE;
-
- pScrPriv = (rrScrPrivPtr) calloc(1, sizeof (rrScrPrivRec));
- if (!pScrPriv)
- return FALSE;
-
- SetRRScreen(pScreen, pScrPriv);
-
- /*
- * Calling function best set these function vectors
- */
- pScrPriv->rrGetInfo = 0;
- pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width;
- pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height;
-
- pScrPriv->width = pScreen->width;
- pScrPriv->height = pScreen->height;
- pScrPriv->mmWidth = pScreen->mmWidth;
- pScrPriv->mmHeight = pScreen->mmHeight;
-#if RANDR_12_INTERFACE
- pScrPriv->rrScreenSetSize = NULL;
- pScrPriv->rrCrtcSet = NULL;
- pScrPriv->rrCrtcSetGamma = NULL;
-#endif
-#if RANDR_10_INTERFACE
- pScrPriv->rrSetConfig = 0;
- pScrPriv->rotations = RR_Rotate_0;
- pScrPriv->reqWidth = pScreen->width;
- pScrPriv->reqHeight = pScreen->height;
- pScrPriv->nSizes = 0;
- pScrPriv->pSizes = NULL;
- pScrPriv->rotation = RR_Rotate_0;
- pScrPriv->rate = 0;
- pScrPriv->size = 0;
-#endif
-
- /*
- * This value doesn't really matter -- any client must call
- * GetScreenInfo before reading it which will automatically update
- * the time
- */
- pScrPriv->lastSetTime = currentTime;
- pScrPriv->lastConfigTime = currentTime;
-
- wrap (pScrPriv, pScreen, CloseScreen, RRCloseScreen);
-
- pScreen->ConstrainCursorHarder = RRConstrainCursorHarder;
-
- pScrPriv->numOutputs = 0;
- pScrPriv->outputs = NULL;
- pScrPriv->numCrtcs = 0;
- pScrPriv->crtcs = NULL;
-
- RRNScreens += 1; /* keep count of screens that implement randr */
- return TRUE;
-}
-
-/*ARGSUSED*/
-static int
-RRFreeClient (pointer data, XID id)
-{
- RREventPtr pRREvent;
- WindowPtr pWin;
- RREventPtr *pHead, pCur, pPrev;
-
- pRREvent = (RREventPtr) data;
- pWin = pRREvent->window;
- dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- RREventType, serverClient, DixDestroyAccess);
- if (pHead) {
- pPrev = 0;
- for (pCur = *pHead; pCur && pCur != pRREvent; pCur=pCur->next)
- pPrev = pCur;
- if (pCur)
- {
- if (pPrev)
- pPrev->next = pRREvent->next;
- else
- *pHead = pRREvent->next;
- }
- }
- free((pointer) pRREvent);
- return 1;
-}
-
-/*ARGSUSED*/
-static int
-RRFreeEvents (pointer data, XID id)
-{
- RREventPtr *pHead, pCur, pNext;
-
- pHead = (RREventPtr *) data;
- for (pCur = *pHead; pCur; pCur = pNext) {
- pNext = pCur->next;
- FreeResource (pCur->clientResource, RRClientType);
- free((pointer) pCur);
- }
- free((pointer) pHead);
- return 1;
-}
-
-void
-RRExtensionInit (void)
-{
- ExtensionEntry *extEntry;
-
- if (RRNScreens == 0) return;
-
- if (!dixRegisterPrivateKey(&RRClientPrivateKeyRec, PRIVATE_CLIENT,
- sizeof (RRClientRec) +
- screenInfo.numScreens * sizeof (RRTimesRec)))
- return;
- if (!AddCallback (&ClientStateCallback, RRClientCallback, 0))
- return;
-
- RRClientType = CreateNewResourceType(RRFreeClient, "RandRClient");
- if (!RRClientType)
- return;
- RREventType = CreateNewResourceType(RRFreeEvents, "RandREvent");
- if (!RREventType)
- return;
- extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors,
- ProcRRDispatch, SProcRRDispatch,
- NULL, StandardMinorOpcode);
- if (!extEntry)
- return;
- RRErrorBase = extEntry->errorBase;
- RREventBase = extEntry->eventBase;
- EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr)
- SRRScreenChangeNotifyEvent;
- EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
- SRRNotifyEvent;
-
- RRModeInitErrorValue();
- RRCrtcInitErrorValue();
- RROutputInitErrorValue();
-
-#ifdef PANORAMIX
- RRXineramaExtensionInit();
-#endif
-}
-
-static int
-TellChanged (WindowPtr pWin, pointer value)
-{
- RREventPtr *pHead, pRREvent;
- ClientPtr client;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- rrScrPriv(pScreen);
- int i;
-
- dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- RREventType, serverClient, DixReadAccess);
- if (!pHead)
- return WT_WALKCHILDREN;
-
- for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
- {
- client = pRREvent->client;
- if (client == serverClient || client->clientGone)
- continue;
-
- if (pRREvent->mask & RRScreenChangeNotifyMask)
- RRDeliverScreenEvent (client, pWin, pScreen);
-
- if (pRREvent->mask & RRCrtcChangeNotifyMask)
- {
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- RRCrtcPtr crtc = pScrPriv->crtcs[i];
- if (crtc->changed)
- RRDeliverCrtcEvent (client, pWin, crtc);
- }
- }
-
- if (pRREvent->mask & RROutputChangeNotifyMask)
- {
- for (i = 0; i < pScrPriv->numOutputs; i++)
- {
- RROutputPtr output = pScrPriv->outputs[i];
- if (output->changed)
- RRDeliverOutputEvent (client, pWin, output);
- }
- }
- }
- return WT_WALKCHILDREN;
-}
-
-/*
- * Something changed; send events and adjust pointer position
- */
-void
-RRTellChanged (ScreenPtr pScreen)
-{
- rrScrPriv (pScreen);
- int i;
-
- if (pScrPriv->changed)
- {
- UpdateCurrentTime ();
- if (pScrPriv->configChanged)
- {
- pScrPriv->lastConfigTime = currentTime;
- pScrPriv->configChanged = FALSE;
- }
- pScrPriv->changed = FALSE;
- WalkTree (pScreen, TellChanged, (pointer) pScreen);
- for (i = 0; i < pScrPriv->numOutputs; i++)
- pScrPriv->outputs[i]->changed = FALSE;
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- pScrPriv->crtcs[i]->changed = FALSE;
- if (pScrPriv->layoutChanged)
- {
- pScrPriv->layoutChanged = FALSE;
- RRPointerScreenConfigured (pScreen);
- RRSendConfigNotify (pScreen);
- }
- }
-}
-
-/*
- * Return the first output which is connected to an active CRTC
- * Used in emulating 1.0 behaviour
- */
-RROutputPtr
-RRFirstOutput (ScreenPtr pScreen)
-{
- rrScrPriv(pScreen);
- RROutputPtr output;
- int i, j;
-
- if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
- return pScrPriv->primaryOutput;
-
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- RRCrtcPtr crtc = pScrPriv->crtcs[i];
- for (j = 0; j < pScrPriv->numOutputs; j++)
- {
- output = pScrPriv->outputs[j];
- if (output->crtc == crtc)
- return output;
- }
- }
- return NULL;
-}
-
-CARD16
-RRVerticalRefresh (xRRModeInfo *mode)
-{
- CARD32 refresh;
- CARD32 dots = mode->hTotal * mode->vTotal;
- if (!dots)
- return 0;
- refresh = (mode->dotClock + dots/2) / dots;
- if (refresh > 0xffff)
- refresh = 0xffff;
- return (CARD16) refresh;
-}
-
-static int
-ProcRRDispatch (ClientPtr client)
-{
- REQUEST(xReq);
- if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
- return BadRequest;
- return (*ProcRandrVector[stuff->data]) (client);
-}
-
-static int
-SProcRRDispatch (ClientPtr client)
-{
- REQUEST(xReq);
- if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
- return BadRequest;
- return (*SProcRandrVector[stuff->data]) (client);
-}
-
+/*
+ * Copyright © 2000 Compaq Computer Corporation
+ * Copyright © 2002 Hewlett-Packard Company
+ * Copyright © 2006 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author: Jim Gettys, Hewlett-Packard Company, Inc.
+ * Keith Packard, Intel Corporation
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "randrstr.h"
+
+/* From render.h */
+#ifndef SubPixelUnknown
+#define SubPixelUnknown 0
+#endif
+
+#define RR_VALIDATE
+static int RRNScreens;
+
+#define wrap(priv,real,mem,func) {\
+ priv->mem = real->mem; \
+ real->mem = func; \
+}
+
+#define unwrap(priv,real,mem) {\
+ real->mem = priv->mem; \
+}
+
+static int ProcRRDispatch(ClientPtr pClient);
+static int SProcRRDispatch(ClientPtr pClient);
+
+int RREventBase;
+int RRErrorBase;
+RESTYPE RRClientType, RREventType; /* resource types for event masks */
+DevPrivateKeyRec RRClientPrivateKeyRec;
+
+DevPrivateKeyRec rrPrivKeyRec;
+
+static void
+RRClientCallback(CallbackListPtr *list, pointer closure, pointer data)
+{
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+
+ rrClientPriv(pClient);
+ RRTimesPtr pTimes = (RRTimesPtr) (pRRClient + 1);
+ int i;
+
+ pRRClient->major_version = 0;
+ pRRClient->minor_version = 0;
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ rrScrPriv(pScreen);
+
+ if (pScrPriv) {
+ pTimes[i].setTime = pScrPriv->lastSetTime;
+ pTimes[i].configTime = pScrPriv->lastConfigTime;
+ }
+ }
+}
+
+static Bool
+RRCloseScreen(int i, ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+ int j;
+
+ unwrap(pScrPriv, pScreen, CloseScreen);
+ for (j = pScrPriv->numCrtcs - 1; j >= 0; j--)
+ RRCrtcDestroy(pScrPriv->crtcs[j]);
+ for (j = pScrPriv->numOutputs - 1; j >= 0; j--)
+ RROutputDestroy(pScrPriv->outputs[j]);
+
+ free(pScrPriv->crtcs);
+ free(pScrPriv->outputs);
+ free(pScrPriv);
+ RRNScreens -= 1; /* ok, one fewer screen with RandR running */
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static void
+SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent * from,
+ xRRScreenChangeNotifyEvent * to)
+{
+ to->type = from->type;
+ to->rotation = from->rotation;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->configTimestamp, to->configTimestamp);
+ cpswapl(from->root, to->root);
+ cpswapl(from->window, to->window);
+ cpswaps(from->sizeID, to->sizeID);
+ cpswaps(from->subpixelOrder, to->subpixelOrder);
+ cpswaps(from->widthInPixels, to->widthInPixels);
+ cpswaps(from->heightInPixels, to->heightInPixels);
+ cpswaps(from->widthInMillimeters, to->widthInMillimeters);
+ cpswaps(from->heightInMillimeters, to->heightInMillimeters);
+}
+
+static void
+SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent * from,
+ xRRCrtcChangeNotifyEvent * to)
+{
+ to->type = from->type;
+ to->subCode = from->subCode;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->window, to->window);
+ cpswapl(from->crtc, to->crtc);
+ cpswapl(from->mode, to->mode);
+ cpswaps(from->rotation, to->rotation);
+ /* pad1 */
+ cpswaps(from->x, to->x);
+ cpswaps(from->y, to->y);
+ cpswaps(from->width, to->width);
+ cpswaps(from->height, to->height);
+}
+
+static void
+SRROutputChangeNotifyEvent(xRROutputChangeNotifyEvent * from,
+ xRROutputChangeNotifyEvent * to)
+{
+ to->type = from->type;
+ to->subCode = from->subCode;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->configTimestamp, to->configTimestamp);
+ cpswapl(from->window, to->window);
+ cpswapl(from->output, to->output);
+ cpswapl(from->crtc, to->crtc);
+ cpswapl(from->mode, to->mode);
+ cpswaps(from->rotation, to->rotation);
+ to->connection = from->connection;
+ to->subpixelOrder = from->subpixelOrder;
+}
+
+static void
+SRROutputPropertyNotifyEvent(xRROutputPropertyNotifyEvent * from,
+ xRROutputPropertyNotifyEvent * to)
+{
+ to->type = from->type;
+ to->subCode = from->subCode;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->window, to->window);
+ cpswapl(from->output, to->output);
+ cpswapl(from->atom, to->atom);
+ cpswapl(from->timestamp, to->timestamp);
+ to->state = from->state;
+ /* pad1 */
+ /* pad2 */
+ /* pad3 */
+ /* pad4 */
+}
+
+static void
+SRRNotifyEvent(xEvent *from, xEvent *to)
+{
+ switch (from->u.u.detail) {
+ case RRNotify_CrtcChange:
+ SRRCrtcChangeNotifyEvent((xRRCrtcChangeNotifyEvent *) from,
+ (xRRCrtcChangeNotifyEvent *) to);
+ break;
+ case RRNotify_OutputChange:
+ SRROutputChangeNotifyEvent((xRROutputChangeNotifyEvent *) from,
+ (xRROutputChangeNotifyEvent *) to);
+ break;
+ case RRNotify_OutputProperty:
+ SRROutputPropertyNotifyEvent((xRROutputPropertyNotifyEvent *) from,
+ (xRROutputPropertyNotifyEvent *) to);
+ break;
+ default:
+ break;
+ }
+}
+
+static int RRGeneration;
+
+Bool
+RRInit(void)
+{
+ if (RRGeneration != serverGeneration) {
+ if (!RRModeInit())
+ return FALSE;
+ if (!RRCrtcInit())
+ return FALSE;
+ if (!RROutputInit())
+ return FALSE;
+ RRGeneration = serverGeneration;
+ }
+ if (!dixRegisterPrivateKey(&rrPrivKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+RRScreenInit(ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRInit())
+ return FALSE;
+
+ pScrPriv = (rrScrPrivPtr) calloc(1, sizeof(rrScrPrivRec));
+ if (!pScrPriv)
+ return FALSE;
+
+ SetRRScreen(pScreen, pScrPriv);
+
+ /*
+ * Calling function best set these function vectors
+ */
+ pScrPriv->rrGetInfo = 0;
+ pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width;
+ pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height;
+
+ pScrPriv->width = pScreen->width;
+ pScrPriv->height = pScreen->height;
+ pScrPriv->mmWidth = pScreen->mmWidth;
+ pScrPriv->mmHeight = pScreen->mmHeight;
+#if RANDR_12_INTERFACE
+ pScrPriv->rrScreenSetSize = NULL;
+ pScrPriv->rrCrtcSet = NULL;
+ pScrPriv->rrCrtcSetGamma = NULL;
+#endif
+#if RANDR_10_INTERFACE
+ pScrPriv->rrSetConfig = 0;
+ pScrPriv->rotations = RR_Rotate_0;
+ pScrPriv->reqWidth = pScreen->width;
+ pScrPriv->reqHeight = pScreen->height;
+ pScrPriv->nSizes = 0;
+ pScrPriv->pSizes = NULL;
+ pScrPriv->rotation = RR_Rotate_0;
+ pScrPriv->rate = 0;
+ pScrPriv->size = 0;
+#endif
+
+ /*
+ * This value doesn't really matter -- any client must call
+ * GetScreenInfo before reading it which will automatically update
+ * the time
+ */
+ pScrPriv->lastSetTime = currentTime;
+ pScrPriv->lastConfigTime = currentTime;
+
+ wrap(pScrPriv, pScreen, CloseScreen, RRCloseScreen);
+
+ pScreen->ConstrainCursorHarder = RRConstrainCursorHarder;
+
+ pScrPriv->numOutputs = 0;
+ pScrPriv->outputs = NULL;
+ pScrPriv->numCrtcs = 0;
+ pScrPriv->crtcs = NULL;
+
+ RRNScreens += 1; /* keep count of screens that implement randr */
+ return TRUE;
+}
+
+ /*ARGSUSED*/ static int
+RRFreeClient(pointer data, XID id)
+{
+ RREventPtr pRREvent;
+ WindowPtr pWin;
+ RREventPtr *pHead, pCur, pPrev;
+
+ pRREvent = (RREventPtr) data;
+ pWin = pRREvent->window;
+ dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ RREventType, serverClient, DixDestroyAccess);
+ if (pHead) {
+ pPrev = 0;
+ for (pCur = *pHead; pCur && pCur != pRREvent; pCur = pCur->next)
+ pPrev = pCur;
+ if (pCur) {
+ if (pPrev)
+ pPrev->next = pRREvent->next;
+ else
+ *pHead = pRREvent->next;
+ }
+ }
+ free((pointer) pRREvent);
+ return 1;
+}
+
+ /*ARGSUSED*/ static int
+RRFreeEvents(pointer data, XID id)
+{
+ RREventPtr *pHead, pCur, pNext;
+
+ pHead = (RREventPtr *) data;
+ for (pCur = *pHead; pCur; pCur = pNext) {
+ pNext = pCur->next;
+ FreeResource(pCur->clientResource, RRClientType);
+ free((pointer) pCur);
+ }
+ free((pointer) pHead);
+ return 1;
+}
+
+void
+RRExtensionInit(void)
+{
+ ExtensionEntry *extEntry;
+
+ if (RRNScreens == 0)
+ return;
+
+ if (!dixRegisterPrivateKey(&RRClientPrivateKeyRec, PRIVATE_CLIENT,
+ sizeof(RRClientRec) +
+ screenInfo.numScreens * sizeof(RRTimesRec)))
+ return;
+ if (!AddCallback(&ClientStateCallback, RRClientCallback, 0))
+ return;
+
+ RRClientType = CreateNewResourceType(RRFreeClient, "RandRClient");
+ if (!RRClientType)
+ return;
+ RREventType = CreateNewResourceType(RRFreeEvents, "RandREvent");
+ if (!RREventType)
+ return;
+ extEntry = AddExtension(RANDR_NAME, RRNumberEvents, RRNumberErrors,
+ ProcRRDispatch, SProcRRDispatch,
+ NULL, StandardMinorOpcode);
+ if (!extEntry)
+ return;
+ RRErrorBase = extEntry->errorBase;
+ RREventBase = extEntry->eventBase;
+ EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr)
+ SRRScreenChangeNotifyEvent;
+ EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
+ SRRNotifyEvent;
+
+ RRModeInitErrorValue();
+ RRCrtcInitErrorValue();
+ RROutputInitErrorValue();
+
+#ifdef PANORAMIX
+ RRXineramaExtensionInit();
+#endif
+}
+
+static int
+TellChanged(WindowPtr pWin, pointer value)
+{
+ RREventPtr *pHead, pRREvent;
+ ClientPtr client;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ rrScrPriv(pScreen);
+ int i;
+
+ dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ RREventType, serverClient, DixReadAccess);
+ if (!pHead)
+ return WT_WALKCHILDREN;
+
+ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) {
+ client = pRREvent->client;
+ if (client == serverClient || client->clientGone)
+ continue;
+
+ if (pRREvent->mask & RRScreenChangeNotifyMask)
+ RRDeliverScreenEvent(client, pWin, pScreen);
+
+ if (pRREvent->mask & RRCrtcChangeNotifyMask) {
+ for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ RRCrtcPtr crtc = pScrPriv->crtcs[i];
+
+ if (crtc->changed)
+ RRDeliverCrtcEvent(client, pWin, crtc);
+ }
+ }
+
+ if (pRREvent->mask & RROutputChangeNotifyMask) {
+ for (i = 0; i < pScrPriv->numOutputs; i++) {
+ RROutputPtr output = pScrPriv->outputs[i];
+
+ if (output->changed)
+ RRDeliverOutputEvent(client, pWin, output);
+ }
+ }
+ }
+ return WT_WALKCHILDREN;
+}
+
+/*
+ * Something changed; send events and adjust pointer position
+ */
+void
+RRTellChanged(ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+ int i;
+
+ if (pScrPriv->changed) {
+ UpdateCurrentTime();
+ if (pScrPriv->configChanged) {
+ pScrPriv->lastConfigTime = currentTime;
+ pScrPriv->configChanged = FALSE;
+ }
+ pScrPriv->changed = FALSE;
+ WalkTree(pScreen, TellChanged, (pointer) pScreen);
+ for (i = 0; i < pScrPriv->numOutputs; i++)
+ pScrPriv->outputs[i]->changed = FALSE;
+ for (i = 0; i < pScrPriv->numCrtcs; i++)
+ pScrPriv->crtcs[i]->changed = FALSE;
+ if (pScrPriv->layoutChanged) {
+ pScrPriv->layoutChanged = FALSE;
+ RRPointerScreenConfigured(pScreen);
+ RRSendConfigNotify(pScreen);
+ }
+ }
+}
+
+/*
+ * Return the first output which is connected to an active CRTC
+ * Used in emulating 1.0 behaviour
+ */
+RROutputPtr
+RRFirstOutput(ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+ RROutputPtr output;
+ int i, j;
+
+ if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
+ return pScrPriv->primaryOutput;
+
+ for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ RRCrtcPtr crtc = pScrPriv->crtcs[i];
+
+ for (j = 0; j < pScrPriv->numOutputs; j++) {
+ output = pScrPriv->outputs[j];
+ if (output->crtc == crtc)
+ return output;
+ }
+ }
+ return NULL;
+}
+
+CARD16
+RRVerticalRefresh(xRRModeInfo * mode)
+{
+ CARD32 refresh;
+ CARD32 dots = mode->hTotal * mode->vTotal;
+
+ if (!dots)
+ return 0;
+ refresh = (mode->dotClock + dots / 2) / dots;
+ if (refresh > 0xffff)
+ refresh = 0xffff;
+ return (CARD16) refresh;
+}
+
+static int
+ProcRRDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
+ return BadRequest;
+ return (*ProcRandrVector[stuff->data]) (client);
+}
+
+static int
+SProcRRDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
+ return BadRequest;
+ return (*SProcRandrVector[stuff->data]) (client);
+}
diff --git a/xorg-server/randr/randrstr.h b/xorg-server/randr/randrstr.h
index 842e0e05b..273885de7 100644
--- a/xorg-server/randr/randrstr.h
+++ b/xorg-server/randr/randrstr.h
@@ -47,191 +47,181 @@
#include "rrtransform.h"
#include <X11/extensions/randr.h>
#include <X11/extensions/randrproto.h>
-#include <X11/extensions/render.h> /* we share subpixel order information */
+#include <X11/extensions/render.h> /* we share subpixel order information */
#include "picturestr.h"
#include <X11/Xfuncproto.h>
/* required for ABI compatibility for now */
#define RANDR_10_INTERFACE 1
#define RANDR_12_INTERFACE 1
-#define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */
+#define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */
#define RANDR_GET_CRTC_INTERFACE 1
#define RANDR_INTERFACE_VERSION 0x0103
-typedef XID RRMode;
-typedef XID RROutput;
-typedef XID RRCrtc;
+typedef XID RRMode;
+typedef XID RROutput;
+typedef XID RRCrtc;
-extern _X_EXPORT int RREventBase, RRErrorBase;
+extern _X_EXPORT int RREventBase, RRErrorBase;
+
+extern _X_EXPORT int (*ProcRandrVector[RRNumberRequests]) (ClientPtr);
+extern _X_EXPORT int (*SProcRandrVector[RRNumberRequests]) (ClientPtr);
-extern _X_EXPORT int (*ProcRandrVector[RRNumberRequests])(ClientPtr);
-extern _X_EXPORT int (*SProcRandrVector[RRNumberRequests])(ClientPtr);
-
/*
* Modeline for a monitor. Name follows directly after this struct
*/
#define RRModeName(pMode) ((char *) (pMode + 1))
-typedef struct _rrMode RRModeRec, *RRModePtr;
-typedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr;
-typedef struct _rrProperty RRPropertyRec, *RRPropertyPtr;
-typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
-typedef struct _rrOutput RROutputRec, *RROutputPtr;
+typedef struct _rrMode RRModeRec, *RRModePtr;
+typedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr;
+typedef struct _rrProperty RRPropertyRec, *RRPropertyPtr;
+typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
+typedef struct _rrOutput RROutputRec, *RROutputPtr;
struct _rrMode {
- int refcnt;
- xRRModeInfo mode;
- char *name;
- ScreenPtr userScreen;
+ int refcnt;
+ xRRModeInfo mode;
+ char *name;
+ ScreenPtr userScreen;
};
struct _rrPropertyValue {
- Atom type; /* ignored by server */
- short format; /* format of data for swapping - 8,16,32 */
- long size; /* size of data in (format/8) bytes */
- pointer data; /* private to client */
+ Atom type; /* ignored by server */
+ short format; /* format of data for swapping - 8,16,32 */
+ long size; /* size of data in (format/8) bytes */
+ pointer data; /* private to client */
};
struct _rrProperty {
- RRPropertyPtr next;
- ATOM propertyName;
- Bool is_pending;
- Bool range;
- Bool immutable;
- int num_valid;
- INT32 *valid_values;
- RRPropertyValueRec current, pending;
+ RRPropertyPtr next;
+ ATOM propertyName;
+ Bool is_pending;
+ Bool range;
+ Bool immutable;
+ int num_valid;
+ INT32 *valid_values;
+ RRPropertyValueRec current, pending;
};
struct _rrCrtc {
- RRCrtc id;
- ScreenPtr pScreen;
- RRModePtr mode;
- int x, y;
- Rotation rotation;
- Rotation rotations;
- Bool changed;
- int numOutputs;
- RROutputPtr *outputs;
- int gammaSize;
- CARD16 *gammaRed;
- CARD16 *gammaBlue;
- CARD16 *gammaGreen;
- void *devPrivate;
- Bool transforms;
- RRTransformRec client_pending_transform;
- RRTransformRec client_current_transform;
- PictTransform transform;
+ RRCrtc id;
+ ScreenPtr pScreen;
+ RRModePtr mode;
+ int x, y;
+ Rotation rotation;
+ Rotation rotations;
+ Bool changed;
+ int numOutputs;
+ RROutputPtr *outputs;
+ int gammaSize;
+ CARD16 *gammaRed;
+ CARD16 *gammaBlue;
+ CARD16 *gammaGreen;
+ void *devPrivate;
+ Bool transforms;
+ RRTransformRec client_pending_transform;
+ RRTransformRec client_current_transform;
+ PictTransform transform;
struct pict_f_transform f_transform;
struct pict_f_transform f_inverse;
};
struct _rrOutput {
- RROutput id;
- ScreenPtr pScreen;
- char *name;
- int nameLength;
- CARD8 connection;
- CARD8 subpixelOrder;
- int mmWidth;
- int mmHeight;
- RRCrtcPtr crtc;
- int numCrtcs;
- RRCrtcPtr *crtcs;
- int numClones;
- RROutputPtr *clones;
- int numModes;
- int numPreferred;
- RRModePtr *modes;
- int numUserModes;
- RRModePtr *userModes;
- Bool changed;
- RRPropertyPtr properties;
- Bool pendingProperties;
- void *devPrivate;
+ RROutput id;
+ ScreenPtr pScreen;
+ char *name;
+ int nameLength;
+ CARD8 connection;
+ CARD8 subpixelOrder;
+ int mmWidth;
+ int mmHeight;
+ RRCrtcPtr crtc;
+ int numCrtcs;
+ RRCrtcPtr *crtcs;
+ int numClones;
+ RROutputPtr *clones;
+ int numModes;
+ int numPreferred;
+ RRModePtr *modes;
+ int numUserModes;
+ RRModePtr *userModes;
+ Bool changed;
+ RRPropertyPtr properties;
+ Bool pendingProperties;
+ void *devPrivate;
};
#if RANDR_12_INTERFACE
-typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight);
-
-typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
- RRCrtcPtr crtc,
- RRModePtr mode,
- int x,
- int y,
- Rotation rotation,
- int numOutputs,
- RROutputPtr *outputs);
-
-typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen,
- RRCrtcPtr crtc);
-
-typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen,
- RRCrtcPtr crtc);
-
-typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
- RROutputPtr output,
- Atom property,
- RRPropertyValuePtr value);
-
-typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen,
- RROutputPtr output,
- RRModePtr mode);
-
-typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen,
- RRModePtr mode);
+typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth, CARD32 mmHeight);
+
+typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
+ RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y,
+ Rotation rotation,
+ int numOutputs, RROutputPtr * outputs);
+
+typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);
+
+typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);
+
+typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
+ RROutputPtr output,
+ Atom property,
+ RRPropertyValuePtr value);
+
+typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen,
+ RROutputPtr output,
+ RRModePtr mode);
+
+typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen, RRModePtr mode);
#endif
#if RANDR_13_INTERFACE
-typedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen,
- RROutputPtr output,
- Atom property);
-typedef Bool (*RRGetPanningProcPtr) (ScreenPtr pScrn,
- RRCrtcPtr crtc,
- BoxPtr totalArea,
- BoxPtr trackingArea,
- INT16 *border);
-typedef Bool (*RRSetPanningProcPtr) (ScreenPtr pScrn,
- RRCrtcPtr crtc,
- BoxPtr totalArea,
- BoxPtr trackingArea,
- INT16 *border);
-
-#endif /* RANDR_13_INTERFACE */
-
-typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations);
-typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen);
+typedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen,
+ RROutputPtr output, Atom property);
+typedef Bool (*RRGetPanningProcPtr) (ScreenPtr pScrn,
+ RRCrtcPtr crtc,
+ BoxPtr totalArea,
+ BoxPtr trackingArea, INT16 *border);
+typedef Bool (*RRSetPanningProcPtr) (ScreenPtr pScrn,
+ RRCrtcPtr crtc,
+ BoxPtr totalArea,
+ BoxPtr trackingArea, INT16 *border);
+
+#endif /* RANDR_13_INTERFACE */
+
+typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation * rotations);
+typedef Bool (*RRCloseScreenProcPtr) (int i, ScreenPtr pscreen);
/* These are for 1.0 compatibility */
-
+
typedef struct _rrRefresh {
- CARD16 rate;
- RRModePtr mode;
+ CARD16 rate;
+ RRModePtr mode;
} RRScreenRate, *RRScreenRatePtr;
typedef struct _rrScreenSize {
- int id;
- short width, height;
- short mmWidth, mmHeight;
- int nRates;
+ int id;
+ short width, height;
+ short mmWidth, mmHeight;
+ int nRates;
RRScreenRatePtr pRates;
} RRScreenSize, *RRScreenSizePtr;
#ifdef RANDR_10_INTERFACE
-typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize);
+typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate, RRScreenSizePtr pSize);
#endif
-
typedef struct _rrScrPriv {
/*
@@ -239,68 +229,69 @@ typedef struct _rrScrPriv {
* as they initialize
*/
#if RANDR_10_INTERFACE
- RRSetConfigProcPtr rrSetConfig;
+ RRSetConfigProcPtr rrSetConfig;
#endif
- RRGetInfoProcPtr rrGetInfo;
+ RRGetInfoProcPtr rrGetInfo;
#if RANDR_12_INTERFACE
- RRScreenSetSizeProcPtr rrScreenSetSize;
- RRCrtcSetProcPtr rrCrtcSet;
- RRCrtcSetGammaProcPtr rrCrtcSetGamma;
- RRCrtcGetGammaProcPtr rrCrtcGetGamma;
- RROutputSetPropertyProcPtr rrOutputSetProperty;
- RROutputValidateModeProcPtr rrOutputValidateMode;
- RRModeDestroyProcPtr rrModeDestroy;
+ RRScreenSetSizeProcPtr rrScreenSetSize;
+ RRCrtcSetProcPtr rrCrtcSet;
+ RRCrtcSetGammaProcPtr rrCrtcSetGamma;
+ RRCrtcGetGammaProcPtr rrCrtcGetGamma;
+ RROutputSetPropertyProcPtr rrOutputSetProperty;
+ RROutputValidateModeProcPtr rrOutputValidateMode;
+ RRModeDestroyProcPtr rrModeDestroy;
#endif
#if RANDR_13_INTERFACE
- RROutputGetPropertyProcPtr rrOutputGetProperty;
- RRGetPanningProcPtr rrGetPanning;
- RRSetPanningProcPtr rrSetPanning;
+ RROutputGetPropertyProcPtr rrOutputGetProperty;
+ RRGetPanningProcPtr rrGetPanning;
+ RRSetPanningProcPtr rrSetPanning;
#endif
-
+
/*
* Private part of the structure; not considered part of the ABI
*/
- TimeStamp lastSetTime; /* last changed by client */
- TimeStamp lastConfigTime; /* possible configs changed */
- RRCloseScreenProcPtr CloseScreen;
+ TimeStamp lastSetTime; /* last changed by client */
+ TimeStamp lastConfigTime; /* possible configs changed */
+ RRCloseScreenProcPtr CloseScreen;
- Bool changed; /* some config changed */
- Bool configChanged; /* configuration changed */
- Bool layoutChanged; /* screen layout changed */
+ Bool changed; /* some config changed */
+ Bool configChanged; /* configuration changed */
+ Bool layoutChanged; /* screen layout changed */
- CARD16 minWidth, minHeight;
- CARD16 maxWidth, maxHeight;
- CARD16 width, height; /* last known screen size */
- CARD16 mmWidth, mmHeight; /* last known screen size */
+ CARD16 minWidth, minHeight;
+ CARD16 maxWidth, maxHeight;
+ CARD16 width, height; /* last known screen size */
+ CARD16 mmWidth, mmHeight; /* last known screen size */
- int numOutputs;
- RROutputPtr *outputs;
- RROutputPtr primaryOutput;
+ int numOutputs;
+ RROutputPtr *outputs;
+ RROutputPtr primaryOutput;
- int numCrtcs;
- RRCrtcPtr *crtcs;
+ int numCrtcs;
+ RRCrtcPtr *crtcs;
/* Last known pointer position */
- RRCrtcPtr pointerCrtc;
+ RRCrtcPtr pointerCrtc;
#ifdef RANDR_10_INTERFACE
/*
* Configuration information
*/
- Rotation rotations;
- CARD16 reqWidth, reqHeight;
-
- int nSizes;
- RRScreenSizePtr pSizes;
-
- Rotation rotation;
- int rate;
- int size;
+ Rotation rotations;
+ CARD16 reqWidth, reqHeight;
+
+ int nSizes;
+ RRScreenSizePtr pSizes;
+
+ Rotation rotation;
+ int rate;
+ int size;
#endif
- Bool discontiguous;
+ Bool discontiguous;
} rrScrPrivRec, *rrScrPrivPtr;
extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
+
#define rrPrivKey (&rrPrivKeyRec)
#define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey))
@@ -318,26 +309,27 @@ extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
typedef struct _RREvent *RREventPtr;
typedef struct _RREvent {
- RREventPtr next;
- ClientPtr client;
- WindowPtr window;
- XID clientResource;
- int mask;
+ RREventPtr next;
+ ClientPtr client;
+ WindowPtr window;
+ XID clientResource;
+ int mask;
} RREventRec;
typedef struct _RRTimes {
- TimeStamp setTime;
- TimeStamp configTime;
+ TimeStamp setTime;
+ TimeStamp configTime;
} RRTimesRec, *RRTimesPtr;
typedef struct _RRClient {
- int major_version;
- int minor_version;
+ int major_version;
+ int minor_version;
/* RRTimesRec times[0]; */
} RRClientRec, *RRClientPtr;
-extern _X_EXPORT RESTYPE RRClientType, RREventType; /* resource types for event masks */
+extern _X_EXPORT RESTYPE RRClientType, RREventType; /* resource types for event masks */
extern _X_EXPORT DevPrivateKeyRec RRClientPrivateKeyRec;
+
#define RRClientPrivateKey (&RRClientPrivateKeyRec)
extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
@@ -376,18 +368,17 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
/* Initialize the extension */
extern _X_EXPORT void
-RRExtensionInit (void);
+ RRExtensionInit(void);
#ifdef RANDR_12_INTERFACE
/*
* Set the range of sizes for the screen
*/
extern _X_EXPORT void
-RRScreenSetSizeRange (ScreenPtr pScreen,
- CARD16 minWidth,
- CARD16 minHeight,
- CARD16 maxWidth,
- CARD16 maxHeight);
+
+RRScreenSetSizeRange(ScreenPtr pScreen,
+ CARD16 minWidth,
+ CARD16 minHeight, CARD16 maxWidth, CARD16 maxHeight);
#endif
/* rrscreen.c */
@@ -397,75 +388,72 @@ RRScreenSetSizeRange (ScreenPtr pScreen,
* the size of the screen
*/
extern _X_EXPORT void
-RRScreenSizeNotify (ScreenPtr pScreen);
+ RRScreenSizeNotify(ScreenPtr pScreen);
/*
* Request that the screen be resized
*/
extern _X_EXPORT Bool
-RRScreenSizeSet (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight);
+
+RRScreenSizeSet(ScreenPtr pScreen,
+ CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight);
/*
* Send ConfigureNotify event to root window when 'something' happens
*/
extern _X_EXPORT void
-RRSendConfigNotify (ScreenPtr pScreen);
-
+ RRSendConfigNotify(ScreenPtr pScreen);
+
/*
* screen dispatch
*/
extern _X_EXPORT int
-ProcRRGetScreenSizeRange (ClientPtr client);
+ ProcRRGetScreenSizeRange(ClientPtr client);
extern _X_EXPORT int
-ProcRRSetScreenSize (ClientPtr client);
+ ProcRRSetScreenSize(ClientPtr client);
extern _X_EXPORT int
-ProcRRGetScreenResources (ClientPtr client);
+ ProcRRGetScreenResources(ClientPtr client);
extern _X_EXPORT int
-ProcRRGetScreenResourcesCurrent (ClientPtr client);
+ ProcRRGetScreenResourcesCurrent(ClientPtr client);
extern _X_EXPORT int
-ProcRRSetScreenConfig (ClientPtr client);
+ ProcRRSetScreenConfig(ClientPtr client);
extern _X_EXPORT int
-ProcRRGetScreenInfo (ClientPtr client);
+ ProcRRGetScreenInfo(ClientPtr client);
/*
* Deliver a ScreenNotify event
*/
extern _X_EXPORT void
-RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
-
+ RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
+
/* randr.c */
/*
* Send all pending events
*/
extern _X_EXPORT void
-RRTellChanged (ScreenPtr pScreen);
+ RRTellChanged(ScreenPtr pScreen);
/*
* Poll the driver for changed information
*/
extern _X_EXPORT Bool
-RRGetInfo (ScreenPtr pScreen, Bool force_query);
+ RRGetInfo(ScreenPtr pScreen, Bool force_query);
-extern _X_EXPORT Bool RRInit (void);
+extern _X_EXPORT Bool RRInit(void);
extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen);
-extern _X_EXPORT RROutputPtr
-RRFirstOutput (ScreenPtr pScreen);
+extern _X_EXPORT RROutputPtr RRFirstOutput(ScreenPtr pScreen);
extern _X_EXPORT CARD16
-RRVerticalRefresh (xRRModeInfo *mode);
+ RRVerticalRefresh(xRRModeInfo * mode);
-#ifdef RANDR_10_INTERFACE
+#ifdef RANDR_10_INTERFACE
/*
* This is the old interface, deprecated but left
* around for compatibility
@@ -476,31 +464,24 @@ RRVerticalRefresh (xRRModeInfo *mode);
*/
extern _X_EXPORT RRScreenSizePtr
-RRRegisterSize (ScreenPtr pScreen,
- short width,
- short height,
- short mmWidth,
- short mmHeight);
+RRRegisterSize(ScreenPtr pScreen,
+ short width, short height, short mmWidth, short mmHeight);
extern _X_EXPORT Bool
-RRRegisterRate (ScreenPtr pScreen,
- RRScreenSizePtr pSize,
- int rate);
+ RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate);
/*
* Finally, set the current configuration of the screen
*/
extern _X_EXPORT void
-RRSetCurrentConfig (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize);
-extern _X_EXPORT Rotation
-RRGetRotation (ScreenPtr pScreen);
+RRSetCurrentConfig(ScreenPtr pScreen,
+ Rotation rotation, int rate, RRScreenSizePtr pSize);
+
+extern _X_EXPORT Rotation RRGetRotation(ScreenPtr pScreen);
-#endif
+#endif
/* rrcrtc.c */
@@ -509,72 +490,65 @@ RRGetRotation (ScreenPtr pScreen);
* some position or size element changed
*/
extern _X_EXPORT void
-RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged);
+ RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged);
/*
* Create a CRTC
*/
-extern _X_EXPORT RRCrtcPtr
-RRCrtcCreate (ScreenPtr pScreen, void *devPrivate);
+extern _X_EXPORT RRCrtcPtr RRCrtcCreate(ScreenPtr pScreen, void *devPrivate);
/*
* Set the allowed rotations on a CRTC
*/
extern _X_EXPORT void
-RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations);
+ RRCrtcSetRotations(RRCrtcPtr crtc, Rotation rotations);
/*
* Set whether transforms are allowed on a CRTC
*/
extern _X_EXPORT void
-RRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms);
+ RRCrtcSetTransformSupport(RRCrtcPtr crtc, Bool transforms);
/*
* Notify the extension that the Crtc has been reconfigured,
* the driver calls this whenever it has updated the mode
*/
extern _X_EXPORT Bool
-RRCrtcNotify (RRCrtcPtr crtc,
- RRModePtr mode,
- int x,
- int y,
- Rotation rotation,
- RRTransformPtr transform,
- int numOutputs,
- RROutputPtr *outputs);
+
+RRCrtcNotify(RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y,
+ Rotation rotation,
+ RRTransformPtr transform, int numOutputs, RROutputPtr * outputs);
extern _X_EXPORT void
-RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
-
+ RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
+
/*
* Request that the Crtc be reconfigured
*/
extern _X_EXPORT Bool
-RRCrtcSet (RRCrtcPtr crtc,
- RRModePtr mode,
- int x,
- int y,
- Rotation rotation,
- int numOutput,
- RROutputPtr *outputs);
+
+RRCrtcSet(RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y, Rotation rotation, int numOutput, RROutputPtr * outputs);
/*
* Request that the Crtc gamma be changed
*/
extern _X_EXPORT Bool
-RRCrtcGammaSet (RRCrtcPtr crtc,
- CARD16 *red,
- CARD16 *green,
- CARD16 *blue);
+ RRCrtcGammaSet(RRCrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue);
/*
* Request current gamma back from the DDX (if possible).
* This includes gamma size.
*/
-
+
extern _X_EXPORT Bool
-RRCrtcGammaGet(RRCrtcPtr crtc);
+ RRCrtcGammaGet(RRCrtcPtr crtc);
/*
* Notify the extension that the Crtc gamma has been changed
@@ -583,15 +557,14 @@ RRCrtcGammaGet(RRCrtcPtr crtc);
*/
extern _X_EXPORT Bool
-RRCrtcGammaNotify (RRCrtcPtr crtc);
+ RRCrtcGammaNotify(RRCrtcPtr crtc);
/*
* Set the size of the gamma table at server startup time
*/
extern _X_EXPORT Bool
-RRCrtcGammaSetSize (RRCrtcPtr crtc,
- int size);
+ RRCrtcGammaSetSize(RRCrtcPtr crtc, int size);
/*
* Return the area of the frame buffer scanned out by the crtc,
@@ -599,7 +572,7 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
*/
extern _X_EXPORT void
-RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
+ RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
/*
* Compute the complete transformation matrix including
@@ -609,145 +582,138 @@ RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
* Return TRUE if the resulting transform is not a simple translation.
*/
extern _X_EXPORT Bool
-RRTransformCompute (int x,
- int y,
- int width,
- int height,
- Rotation rotation,
- RRTransformPtr rr_transform,
- PictTransformPtr transform,
- struct pict_f_transform *f_transform,
- struct pict_f_transform *f_inverse);
+RRTransformCompute(int x,
+ int y,
+ int width,
+ int height,
+ Rotation rotation,
+ RRTransformPtr rr_transform,
+ PictTransformPtr transform,
+ struct pict_f_transform *f_transform,
+ struct pict_f_transform *f_inverse);
/*
* Return crtc transform
*/
-extern _X_EXPORT RRTransformPtr
-RRCrtcGetTransform (RRCrtcPtr crtc);
+extern _X_EXPORT RRTransformPtr RRCrtcGetTransform(RRCrtcPtr crtc);
/*
* Check whether the pending and current transforms are the same
*/
extern _X_EXPORT Bool
-RRCrtcPendingTransform (RRCrtcPtr crtc);
+ RRCrtcPendingTransform(RRCrtcPtr crtc);
/*
* Destroy a Crtc at shutdown
*/
extern _X_EXPORT void
-RRCrtcDestroy (RRCrtcPtr crtc);
-
+ RRCrtcDestroy(RRCrtcPtr crtc);
/*
* Set the pending CRTC transformation
*/
extern _X_EXPORT int
-RRCrtcTransformSet (RRCrtcPtr crtc,
- PictTransformPtr transform,
- struct pict_f_transform *f_transform,
- struct pict_f_transform *f_inverse,
- char *filter,
- int filter_len,
- xFixed *params,
- int nparams);
+
+RRCrtcTransformSet(RRCrtcPtr crtc,
+ PictTransformPtr transform,
+ struct pict_f_transform *f_transform,
+ struct pict_f_transform *f_inverse,
+ char *filter, int filter_len, xFixed * params, int nparams);
/*
* Initialize crtc type
*/
extern _X_EXPORT Bool
-RRCrtcInit (void);
+ RRCrtcInit(void);
/*
* Initialize crtc type error value
*/
extern _X_EXPORT void
-RRCrtcInitErrorValue (void);
+ RRCrtcInitErrorValue(void);
/*
* Crtc dispatch
*/
extern _X_EXPORT int
-ProcRRGetCrtcInfo (ClientPtr client);
+ ProcRRGetCrtcInfo(ClientPtr client);
extern _X_EXPORT int
-ProcRRSetCrtcConfig (ClientPtr client);
+ ProcRRSetCrtcConfig(ClientPtr client);
extern _X_EXPORT int
-ProcRRGetCrtcGammaSize (ClientPtr client);
+ ProcRRGetCrtcGammaSize(ClientPtr client);
extern _X_EXPORT int
-ProcRRGetCrtcGamma (ClientPtr client);
+ ProcRRGetCrtcGamma(ClientPtr client);
extern _X_EXPORT int
-ProcRRSetCrtcGamma (ClientPtr client);
+ ProcRRSetCrtcGamma(ClientPtr client);
extern _X_EXPORT int
-ProcRRSetCrtcTransform (ClientPtr client);
+ ProcRRSetCrtcTransform(ClientPtr client);
extern _X_EXPORT int
-ProcRRGetCrtcTransform (ClientPtr client);
+ ProcRRGetCrtcTransform(ClientPtr client);
int
-ProcRRGetPanning (ClientPtr client);
+ ProcRRGetPanning(ClientPtr client);
int
-ProcRRSetPanning (ClientPtr client);
+ ProcRRSetPanning(ClientPtr client);
void
-RRConstrainCursorHarder (DeviceIntPtr, ScreenPtr, int, int *, int *);
+ RRConstrainCursorHarder(DeviceIntPtr, ScreenPtr, int, int *, int *);
/* rrdispatch.c */
extern _X_EXPORT Bool
-RRClientKnowsRates (ClientPtr pClient);
+ RRClientKnowsRates(ClientPtr pClient);
/* rrmode.c */
/*
* Find, and if necessary, create a mode
*/
-extern _X_EXPORT RRModePtr
-RRModeGet (xRRModeInfo *modeInfo,
- const char *name);
+extern _X_EXPORT RRModePtr RRModeGet(xRRModeInfo * modeInfo, const char *name);
/*
* Destroy a mode.
*/
extern _X_EXPORT void
-RRModeDestroy (RRModePtr mode);
+ RRModeDestroy(RRModePtr mode);
/*
* Return a list of modes that are valid for some output in pScreen
*/
-extern _X_EXPORT RRModePtr *
-RRModesForScreen (ScreenPtr pScreen, int *num_ret);
-
+extern _X_EXPORT RRModePtr *RRModesForScreen(ScreenPtr pScreen, int *num_ret);
+
/*
* Initialize mode type
*/
extern _X_EXPORT Bool
-RRModeInit (void);
+ RRModeInit(void);
/*
* Initialize mode type error value
*/
extern _X_EXPORT void
-RRModeInitErrorValue (void);
-
+ RRModeInitErrorValue(void);
+
extern _X_EXPORT int
-ProcRRCreateMode (ClientPtr client);
+ ProcRRCreateMode(ClientPtr client);
extern _X_EXPORT int
-ProcRRDestroyMode (ClientPtr client);
+ ProcRRDestroyMode(ClientPtr client);
extern _X_EXPORT int
-ProcRRAddOutputMode (ClientPtr client);
+ ProcRRAddOutputMode(ClientPtr client);
extern _X_EXPORT int
-ProcRRDeleteOutputMode (ClientPtr client);
+ ProcRRDeleteOutputMode(ClientPtr client);
/* rroutput.c */
@@ -758,143 +724,132 @@ ProcRRDeleteOutputMode (ClientPtr client);
* (which crtc is in use)
*/
extern _X_EXPORT void
-RROutputChanged (RROutputPtr output, Bool configChanged);
+ RROutputChanged(RROutputPtr output, Bool configChanged);
/*
* Create an output
*/
extern _X_EXPORT RROutputPtr
-RROutputCreate (ScreenPtr pScreen,
- const char *name,
- int nameLength,
- void *devPrivate);
+RROutputCreate(ScreenPtr pScreen,
+ const char *name, int nameLength, void *devPrivate);
/*
* Notify extension that output parameters have been changed
*/
extern _X_EXPORT Bool
-RROutputSetClones (RROutputPtr output,
- RROutputPtr *clones,
- int numClones);
+ RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones);
extern _X_EXPORT Bool
-RROutputSetModes (RROutputPtr output,
- RRModePtr *modes,
- int numModes,
- int numPreferred);
+
+RROutputSetModes(RROutputPtr output,
+ RRModePtr * modes, int numModes, int numPreferred);
extern _X_EXPORT int
-RROutputAddUserMode (RROutputPtr output,
- RRModePtr mode);
+ RROutputAddUserMode(RROutputPtr output, RRModePtr mode);
extern _X_EXPORT int
-RROutputDeleteUserMode (RROutputPtr output,
- RRModePtr mode);
+ RROutputDeleteUserMode(RROutputPtr output, RRModePtr mode);
extern _X_EXPORT Bool
-RROutputSetCrtcs (RROutputPtr output,
- RRCrtcPtr *crtcs,
- int numCrtcs);
+ RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs);
extern _X_EXPORT Bool
-RROutputSetConnection (RROutputPtr output,
- CARD8 connection);
+ RROutputSetConnection(RROutputPtr output, CARD8 connection);
extern _X_EXPORT Bool
-RROutputSetSubpixelOrder (RROutputPtr output,
- int subpixelOrder);
+ RROutputSetSubpixelOrder(RROutputPtr output, int subpixelOrder);
extern _X_EXPORT Bool
-RROutputSetPhysicalSize (RROutputPtr output,
- int mmWidth,
- int mmHeight);
+ RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight);
extern _X_EXPORT void
-RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
+ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
extern _X_EXPORT void
-RROutputDestroy (RROutputPtr output);
+ RROutputDestroy(RROutputPtr output);
extern _X_EXPORT int
-ProcRRGetOutputInfo (ClientPtr client);
+ ProcRRGetOutputInfo(ClientPtr client);
extern _X_EXPORT int
-ProcRRSetOutputPrimary (ClientPtr client);
+ ProcRRSetOutputPrimary(ClientPtr client);
extern _X_EXPORT int
-ProcRRGetOutputPrimary (ClientPtr client);
+ ProcRRGetOutputPrimary(ClientPtr client);
/*
* Initialize output type
*/
extern _X_EXPORT Bool
-RROutputInit (void);
+ RROutputInit(void);
/*
* Initialize output type error value
*/
extern _X_EXPORT void
-RROutputInitErrorValue (void);
-
+ RROutputInitErrorValue(void);
+
/* rrpointer.c */
extern _X_EXPORT void
-RRPointerMoved (ScreenPtr pScreen, int x, int y);
+ RRPointerMoved(ScreenPtr pScreen, int x, int y);
extern _X_EXPORT void
-RRPointerScreenConfigured (ScreenPtr pScreen);
+ RRPointerScreenConfigured(ScreenPtr pScreen);
/* rrproperty.c */
extern _X_EXPORT void
-RRDeleteAllOutputProperties (RROutputPtr output);
+ RRDeleteAllOutputProperties(RROutputPtr output);
extern _X_EXPORT RRPropertyValuePtr
-RRGetOutputProperty (RROutputPtr output, Atom property, Bool pending);
+RRGetOutputProperty(RROutputPtr output, Atom property, Bool pending);
extern _X_EXPORT RRPropertyPtr
-RRQueryOutputProperty (RROutputPtr output, Atom property);
-
+RRQueryOutputProperty(RROutputPtr output, Atom property);
+
extern _X_EXPORT void
-RRDeleteOutputProperty (RROutputPtr output, Atom property);
+ RRDeleteOutputProperty(RROutputPtr output, Atom property);
extern _X_EXPORT Bool
-RRPostPendingProperties (RROutputPtr output);
-
+ RRPostPendingProperties(RROutputPtr output);
+
extern _X_EXPORT int
-RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
- int format, int mode, unsigned long len,
- pointer value, Bool sendevent, Bool pending);
+
+RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
+ int format, int mode, unsigned long len,
+ pointer value, Bool sendevent, Bool pending);
extern _X_EXPORT int
-RRConfigureOutputProperty (RROutputPtr output, Atom property,
- Bool pending, Bool range, Bool immutable,
- int num_values, INT32 *values);
+
+RRConfigureOutputProperty(RROutputPtr output, Atom property,
+ Bool pending, Bool range, Bool immutable,
+ int num_values, INT32 *values);
extern _X_EXPORT int
-ProcRRChangeOutputProperty (ClientPtr client);
+ ProcRRChangeOutputProperty(ClientPtr client);
extern _X_EXPORT int
-ProcRRGetOutputProperty (ClientPtr client);
+ ProcRRGetOutputProperty(ClientPtr client);
extern _X_EXPORT int
-ProcRRListOutputProperties (ClientPtr client);
+ ProcRRListOutputProperties(ClientPtr client);
extern _X_EXPORT int
-ProcRRQueryOutputProperty (ClientPtr client);
+ ProcRRQueryOutputProperty(ClientPtr client);
extern _X_EXPORT int
-ProcRRConfigureOutputProperty (ClientPtr client);
+ ProcRRConfigureOutputProperty(ClientPtr client);
extern _X_EXPORT int
-ProcRRDeleteOutputProperty (ClientPtr client);
+ ProcRRDeleteOutputProperty(ClientPtr client);
/* rrxinerama.c */
#ifdef XINERAMA
extern _X_EXPORT void
-RRXineramaExtensionInit(void);
+ RRXineramaExtensionInit(void);
#endif
-#endif /* _RANDRSTR_H_ */
+#endif /* _RANDRSTR_H_ */
/*
diff --git a/xorg-server/randr/rrcrtc.c b/xorg-server/randr/rrcrtc.c
index 13dd7da7c..36caa5822 100644
--- a/xorg-server/randr/rrcrtc.c
+++ b/xorg-server/randr/rrcrtc.c
@@ -25,27 +25,26 @@
#include "swaprep.h"
#include "mipointer.h"
-RESTYPE RRCrtcType;
+RESTYPE RRCrtcType;
/*
* Notify the CRTC of some change
*/
void
-RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged)
+RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged)
{
- ScreenPtr pScreen = crtc->pScreen;
+ ScreenPtr pScreen = crtc->pScreen;
crtc->changed = TRUE;
- if (pScreen)
- {
- rrScrPriv(pScreen);
-
- pScrPriv->changed = TRUE;
- /*
- * Send ConfigureNotify on any layout change
- */
- if (layoutChanged)
- pScrPriv->layoutChanged = TRUE;
+ if (pScreen) {
+ rrScrPriv(pScreen);
+
+ pScrPriv->changed = TRUE;
+ /*
+ * Send ConfigureNotify on any layout change
+ */
+ if (layoutChanged)
+ pScrPriv->layoutChanged = TRUE;
}
}
@@ -53,31 +52,31 @@ RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged)
* Create a CRTC
*/
RRCrtcPtr
-RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
+RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
{
- RRCrtcPtr crtc;
- RRCrtcPtr *crtcs;
- rrScrPrivPtr pScrPriv;
+ RRCrtcPtr crtc;
+ RRCrtcPtr *crtcs;
+ rrScrPrivPtr pScrPriv;
if (!RRInit())
- return NULL;
-
+ return NULL;
+
pScrPriv = rrGetScrPriv(pScreen);
/* make space for the crtc pointer */
if (pScrPriv->numCrtcs)
- crtcs = realloc(pScrPriv->crtcs,
- (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr));
+ crtcs = realloc(pScrPriv->crtcs,
+ (pScrPriv->numCrtcs + 1) * sizeof(RRCrtcPtr));
else
- crtcs = malloc(sizeof (RRCrtcPtr));
+ crtcs = malloc(sizeof(RRCrtcPtr));
if (!crtcs)
- return FALSE;
+ return FALSE;
pScrPriv->crtcs = crtcs;
-
- crtc = calloc(1, sizeof (RRCrtcRec));
+
+ crtc = calloc(1, sizeof(RRCrtcRec));
if (!crtc)
- return NULL;
- crtc->id = FakeClientID (0);
+ return NULL;
+ crtc->id = FakeClientID(0);
crtc->pScreen = pScreen;
crtc->mode = NULL;
crtc->x = 0;
@@ -90,19 +89,19 @@ RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
crtc->gammaRed = crtc->gammaBlue = crtc->gammaGreen = NULL;
crtc->changed = FALSE;
crtc->devPrivate = devPrivate;
- RRTransformInit (&crtc->client_pending_transform);
- RRTransformInit (&crtc->client_current_transform);
- pixman_transform_init_identity (&crtc->transform);
- pixman_f_transform_init_identity (&crtc->f_transform);
- pixman_f_transform_init_identity (&crtc->f_inverse);
+ RRTransformInit(&crtc->client_pending_transform);
+ RRTransformInit(&crtc->client_current_transform);
+ pixman_transform_init_identity(&crtc->transform);
+ pixman_f_transform_init_identity(&crtc->f_transform);
+ pixman_f_transform_init_identity(&crtc->f_inverse);
- if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc))
- return NULL;
+ if (!AddResource(crtc->id, RRCrtcType, (pointer) crtc))
+ return NULL;
/* attach the screen and crtc together */
crtc->pScreen = pScreen;
pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
-
+
return crtc;
}
@@ -110,7 +109,7 @@ RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
* Set the allowed rotations on a CRTC
*/
void
-RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations)
+RRCrtcSetRotations(RRCrtcPtr crtc, Rotation rotations)
{
crtc->rotations = rotations;
}
@@ -119,7 +118,7 @@ RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations)
* Set whether transforms are allowed on a CRTC
*/
void
-RRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms)
+RRCrtcSetTransformSupport(RRCrtcPtr crtc, Bool transforms)
{
crtc->transforms = transforms;
}
@@ -129,167 +128,153 @@ RRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms)
* the driver calls this whenever it has updated the mode
*/
Bool
-RRCrtcNotify (RRCrtcPtr crtc,
- RRModePtr mode,
- int x,
- int y,
- Rotation rotation,
- RRTransformPtr transform,
- int numOutputs,
- RROutputPtr *outputs)
+RRCrtcNotify(RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y,
+ Rotation rotation,
+ RRTransformPtr transform, int numOutputs, RROutputPtr * outputs)
{
- int i, j;
-
+ int i, j;
+
/*
* Check to see if any of the new outputs were
* not in the old list and mark them as changed
*/
- for (i = 0; i < numOutputs; i++)
- {
- for (j = 0; j < crtc->numOutputs; j++)
- if (outputs[i] == crtc->outputs[j])
- break;
- if (j == crtc->numOutputs)
- {
- outputs[i]->crtc = crtc;
- RROutputChanged (outputs[i], FALSE);
- RRCrtcChanged (crtc, FALSE);
- }
+ for (i = 0; i < numOutputs; i++) {
+ for (j = 0; j < crtc->numOutputs; j++)
+ if (outputs[i] == crtc->outputs[j])
+ break;
+ if (j == crtc->numOutputs) {
+ outputs[i]->crtc = crtc;
+ RROutputChanged(outputs[i], FALSE);
+ RRCrtcChanged(crtc, FALSE);
+ }
}
/*
* Check to see if any of the old outputs are
* not in the new list and mark them as changed
*/
- for (j = 0; j < crtc->numOutputs; j++)
- {
- for (i = 0; i < numOutputs; i++)
- if (outputs[i] == crtc->outputs[j])
- break;
- if (i == numOutputs)
- {
- if (crtc->outputs[j]->crtc == crtc)
- crtc->outputs[j]->crtc = NULL;
- RROutputChanged (crtc->outputs[j], FALSE);
- RRCrtcChanged (crtc, FALSE);
- }
+ for (j = 0; j < crtc->numOutputs; j++) {
+ for (i = 0; i < numOutputs; i++)
+ if (outputs[i] == crtc->outputs[j])
+ break;
+ if (i == numOutputs) {
+ if (crtc->outputs[j]->crtc == crtc)
+ crtc->outputs[j]->crtc = NULL;
+ RROutputChanged(crtc->outputs[j], FALSE);
+ RRCrtcChanged(crtc, FALSE);
+ }
}
/*
* Reallocate the crtc output array if necessary
*/
- if (numOutputs != crtc->numOutputs)
- {
- RROutputPtr *newoutputs;
-
- if (numOutputs)
- {
- if (crtc->numOutputs)
- newoutputs = realloc(crtc->outputs,
- numOutputs * sizeof (RROutputPtr));
- else
- newoutputs = malloc(numOutputs * sizeof (RROutputPtr));
- if (!newoutputs)
- return FALSE;
- }
- else
- {
- free(crtc->outputs);
- newoutputs = NULL;
- }
- crtc->outputs = newoutputs;
- crtc->numOutputs = numOutputs;
+ if (numOutputs != crtc->numOutputs) {
+ RROutputPtr *newoutputs;
+
+ if (numOutputs) {
+ if (crtc->numOutputs)
+ newoutputs = realloc(crtc->outputs,
+ numOutputs * sizeof(RROutputPtr));
+ else
+ newoutputs = malloc(numOutputs * sizeof(RROutputPtr));
+ if (!newoutputs)
+ return FALSE;
+ }
+ else {
+ free(crtc->outputs);
+ newoutputs = NULL;
+ }
+ crtc->outputs = newoutputs;
+ crtc->numOutputs = numOutputs;
}
/*
* Copy the new list of outputs into the crtc
*/
- memcpy (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr));
+ memcpy(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr));
/*
* Update remaining crtc fields
*/
- if (mode != crtc->mode)
- {
- if (crtc->mode)
- RRModeDestroy (crtc->mode);
- crtc->mode = mode;
- if (mode != NULL)
- mode->refcnt++;
- RRCrtcChanged (crtc, TRUE);
+ if (mode != crtc->mode) {
+ if (crtc->mode)
+ RRModeDestroy(crtc->mode);
+ crtc->mode = mode;
+ if (mode != NULL)
+ mode->refcnt++;
+ RRCrtcChanged(crtc, TRUE);
}
- if (x != crtc->x)
- {
- crtc->x = x;
- RRCrtcChanged (crtc, TRUE);
+ if (x != crtc->x) {
+ crtc->x = x;
+ RRCrtcChanged(crtc, TRUE);
}
- if (y != crtc->y)
- {
- crtc->y = y;
- RRCrtcChanged (crtc, TRUE);
+ if (y != crtc->y) {
+ crtc->y = y;
+ RRCrtcChanged(crtc, TRUE);
}
- if (rotation != crtc->rotation)
- {
- crtc->rotation = rotation;
- RRCrtcChanged (crtc, TRUE);
+ if (rotation != crtc->rotation) {
+ crtc->rotation = rotation;
+ RRCrtcChanged(crtc, TRUE);
}
- if (!RRTransformEqual (transform, &crtc->client_current_transform)) {
- RRTransformCopy (&crtc->client_current_transform, transform);
- RRCrtcChanged (crtc, TRUE);
+ if (!RRTransformEqual(transform, &crtc->client_current_transform)) {
+ RRTransformCopy(&crtc->client_current_transform, transform);
+ RRCrtcChanged(crtc, TRUE);
}
- if (crtc->changed && mode)
- {
- RRTransformCompute (x, y,
- mode->mode.width, mode->mode.height,
- rotation,
- &crtc->client_current_transform,
- &crtc->transform, &crtc->f_transform,
- &crtc->f_inverse);
+ if (crtc->changed && mode) {
+ RRTransformCompute(x, y,
+ mode->mode.width, mode->mode.height,
+ rotation,
+ &crtc->client_current_transform,
+ &crtc->transform, &crtc->f_transform,
+ &crtc->f_inverse);
}
return TRUE;
}
void
-RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
+RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- rrScrPriv (pScreen);
- xRRCrtcChangeNotifyEvent ce;
- RRModePtr mode = crtc->mode;
-
+
+ rrScrPriv(pScreen);
+ xRRCrtcChangeNotifyEvent ce;
+ RRModePtr mode = crtc->mode;
+
ce.type = RRNotify + RREventBase;
ce.subCode = RRNotify_CrtcChange;
ce.timestamp = pScrPriv->lastSetTime.milliseconds;
ce.window = pWin->drawable.id;
ce.crtc = crtc->id;
ce.rotation = crtc->rotation;
- if (mode)
- {
- ce.mode = mode->mode.id;
- ce.x = crtc->x;
- ce.y = crtc->y;
- ce.width = mode->mode.width;
- ce.height = mode->mode.height;
+ if (mode) {
+ ce.mode = mode->mode.id;
+ ce.x = crtc->x;
+ ce.y = crtc->y;
+ ce.width = mode->mode.width;
+ ce.height = mode->mode.height;
}
- else
- {
- ce.mode = None;
- ce.x = 0;
- ce.y = 0;
- ce.width = 0;
- ce.height = 0;
+ else {
+ ce.mode = None;
+ ce.x = 0;
+ ce.y = 0;
+ ce.width = 0;
+ ce.height = 0;
}
- WriteEventsToClient (client, 1, (xEvent *) &ce);
+ WriteEventsToClient(client, 1, (xEvent *) &ce);
}
static Bool
-RRCrtcPendingProperties (RRCrtcPtr crtc)
+RRCrtcPendingProperties(RRCrtcPtr crtc)
{
- ScreenPtr pScreen = crtc->pScreen;
+ ScreenPtr pScreen = crtc->pScreen;
+
rrScrPriv(pScreen);
- int o;
+ int o;
- for (o = 0; o < pScrPriv->numOutputs; o++)
- {
- RROutputPtr output = pScrPriv->outputs[o];
- if (output->crtc == crtc && output->pendingProperties)
- return TRUE;
+ for (o = 0; o < pScrPriv->numOutputs; o++) {
+ RROutputPtr output = pScrPriv->outputs[o];
+
+ if (output->crtc == crtc && output->pendingProperties)
+ return TRUE;
}
return FALSE;
}
@@ -304,14 +289,14 @@ crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom)
case RR_Rotate_0:
case RR_Rotate_180:
default:
- *right = crtc->x + crtc->mode->mode.width;
- *bottom = crtc->y + crtc->mode->mode.height;
- return;
+ *right = crtc->x + crtc->mode->mode.width;
+ *bottom = crtc->y + crtc->mode->mode.height;
+ return;
case RR_Rotate_90:
case RR_Rotate_270:
- *right = crtc->x + crtc->mode->mode.height;
- *bottom = crtc->y + crtc->mode->mode.width;
- return;
+ *right = crtc->x + crtc->mode->mode.height;
+ *bottom = crtc->y + crtc->mode->mode.width;
+ return;
}
}
@@ -322,7 +307,7 @@ crtcs_adjacent(const RRCrtcPtr a, const RRCrtcPtr b)
/* left, right, top, bottom... */
int al, ar, at, ab;
int bl, br, bt, bb;
- int cl, cr, ct, cb; /* the overlap, if any */
+ int cl, cr, ct, cb; /* the overlap, if any */
crtc_bounds(a, &al, &ar, &at, &ab);
crtc_bounds(b, &bl, &br, &bt, &bb);
@@ -337,9 +322,10 @@ crtcs_adjacent(const RRCrtcPtr a, const RRCrtcPtr b)
/* Depth-first search and mark all CRTCs reachable from cur */
static void
-mark_crtcs (rrScrPrivPtr pScrPriv, int *reachable, int cur)
+mark_crtcs(rrScrPrivPtr pScrPriv, int *reachable, int cur)
{
int i;
+
reachable[cur] = TRUE;
for (i = 0; i < pScrPriv->numCrtcs; ++i) {
if (reachable[i] || !pScrPriv->crtcs[i]->mode)
@@ -350,13 +336,14 @@ mark_crtcs (rrScrPrivPtr pScrPriv, int *reachable, int cur)
}
static void
-RRComputeContiguity (ScreenPtr pScreen)
+RRComputeContiguity(ScreenPtr pScreen)
{
rrScrPriv(pScreen);
Bool discontiguous = TRUE;
int i, n = pScrPriv->numCrtcs;
int *reachable = calloc(n, sizeof(int));
+
if (!reachable)
goto out;
@@ -375,7 +362,7 @@ RRComputeContiguity (ScreenPtr pScreen)
discontiguous = FALSE;
-out:
+ out:
free(reachable);
pScrPriv->discontiguous = discontiguous;
}
@@ -384,96 +371,87 @@ out:
* Request that the Crtc be reconfigured
*/
Bool
-RRCrtcSet (RRCrtcPtr crtc,
- RRModePtr mode,
- int x,
- int y,
- Rotation rotation,
- int numOutputs,
- RROutputPtr *outputs)
+RRCrtcSet(RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y, Rotation rotation, int numOutputs, RROutputPtr * outputs)
{
- ScreenPtr pScreen = crtc->pScreen;
- Bool ret = FALSE;
- Bool recompute = TRUE;
+ ScreenPtr pScreen = crtc->pScreen;
+ Bool ret = FALSE;
+ Bool recompute = TRUE;
+
rrScrPriv(pScreen);
/* See if nothing changed */
if (crtc->mode == mode &&
- crtc->x == x &&
- crtc->y == y &&
- crtc->rotation == rotation &&
- crtc->numOutputs == numOutputs &&
- !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) &&
- !RRCrtcPendingProperties (crtc) &&
- !RRCrtcPendingTransform (crtc))
- {
- recompute = FALSE;
- ret = TRUE;
+ crtc->x == x &&
+ crtc->y == y &&
+ crtc->rotation == rotation &&
+ crtc->numOutputs == numOutputs &&
+ !memcmp(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr)) &&
+ !RRCrtcPendingProperties(crtc) && !RRCrtcPendingTransform(crtc)) {
+ recompute = FALSE;
+ ret = TRUE;
}
- else
- {
+ else {
#if RANDR_12_INTERFACE
- if (pScrPriv->rrCrtcSet)
- {
- ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
- rotation, numOutputs, outputs);
- }
- else
+ if (pScrPriv->rrCrtcSet) {
+ ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
+ rotation, numOutputs, outputs);
+ }
+ else
#endif
- {
+ {
#if RANDR_10_INTERFACE
- if (pScrPriv->rrSetConfig)
- {
- RRScreenSize size;
- RRScreenRate rate;
-
- if (!mode)
- {
- RRCrtcNotify (crtc, NULL, x, y, rotation, NULL, 0, NULL);
- ret = TRUE;
- }
- else
- {
- size.width = mode->mode.width;
- size.height = mode->mode.height;
- if (outputs[0]->mmWidth && outputs[0]->mmHeight)
- {
- size.mmWidth = outputs[0]->mmWidth;
- size.mmHeight = outputs[0]->mmHeight;
- }
- else
- {
- size.mmWidth = pScreen->mmWidth;
- size.mmHeight = pScreen->mmHeight;
- }
- size.nRates = 1;
- rate.rate = RRVerticalRefresh (&mode->mode);
- size.pRates = &rate;
- ret = (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate, &size);
- /*
- * Old 1.0 interface tied screen size to mode size
- */
- if (ret)
- {
- RRCrtcNotify (crtc, mode, x, y, rotation, NULL, 1, outputs);
- RRScreenSizeNotify (pScreen);
- }
- }
- }
+ if (pScrPriv->rrSetConfig) {
+ RRScreenSize size;
+ RRScreenRate rate;
+
+ if (!mode) {
+ RRCrtcNotify(crtc, NULL, x, y, rotation, NULL, 0, NULL);
+ ret = TRUE;
+ }
+ else {
+ size.width = mode->mode.width;
+ size.height = mode->mode.height;
+ if (outputs[0]->mmWidth && outputs[0]->mmHeight) {
+ size.mmWidth = outputs[0]->mmWidth;
+ size.mmHeight = outputs[0]->mmHeight;
+ }
+ else {
+ size.mmWidth = pScreen->mmWidth;
+ size.mmHeight = pScreen->mmHeight;
+ }
+ size.nRates = 1;
+ rate.rate = RRVerticalRefresh(&mode->mode);
+ size.pRates = &rate;
+ ret =
+ (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate,
+ &size);
+ /*
+ * Old 1.0 interface tied screen size to mode size
+ */
+ if (ret) {
+ RRCrtcNotify(crtc, mode, x, y, rotation, NULL, 1,
+ outputs);
+ RRScreenSizeNotify(pScreen);
+ }
+ }
+ }
#endif
- }
- if (ret)
- {
- int o;
- RRTellChanged (pScreen);
-
- for (o = 0; o < numOutputs; o++)
- RRPostPendingProperties (outputs[o]);
- }
+ }
+ if (ret) {
+ int o;
+
+ RRTellChanged(pScreen);
+
+ for (o = 0; o < numOutputs; o++)
+ RRPostPendingProperties(outputs[o]);
+ }
}
if (recompute)
- RRComputeContiguity(pScreen);
+ RRComputeContiguity(pScreen);
return ret;
}
@@ -482,12 +460,12 @@ RRCrtcSet (RRCrtcPtr crtc,
* Return crtc transform
*/
RRTransformPtr
-RRCrtcGetTransform (RRCrtcPtr crtc)
+RRCrtcGetTransform(RRCrtcPtr crtc)
{
- RRTransformPtr transform = &crtc->client_pending_transform;
+ RRTransformPtr transform = &crtc->client_pending_transform;
- if (pixman_transform_is_identity (&transform->transform))
- return NULL;
+ if (pixman_transform_is_identity(&transform->transform))
+ return NULL;
return transform;
}
@@ -495,47 +473,44 @@ RRCrtcGetTransform (RRCrtcPtr crtc)
* Check whether the pending and current transforms are the same
*/
Bool
-RRCrtcPendingTransform (RRCrtcPtr crtc)
+RRCrtcPendingTransform(RRCrtcPtr crtc)
{
- return memcmp (&crtc->client_current_transform.transform,
- &crtc->client_pending_transform.transform,
- sizeof (PictTransform)) != 0;
+ return memcmp(&crtc->client_current_transform.transform,
+ &crtc->client_pending_transform.transform,
+ sizeof(PictTransform)) != 0;
}
/*
* Destroy a Crtc at shutdown
*/
void
-RRCrtcDestroy (RRCrtcPtr crtc)
+RRCrtcDestroy(RRCrtcPtr crtc)
{
- FreeResource (crtc->id, 0);
+ FreeResource(crtc->id, 0);
}
static int
-RRCrtcDestroyResource (pointer value, XID pid)
+RRCrtcDestroyResource(pointer value, XID pid)
{
- RRCrtcPtr crtc = (RRCrtcPtr) value;
- ScreenPtr pScreen = crtc->pScreen;
+ RRCrtcPtr crtc = (RRCrtcPtr) value;
+ ScreenPtr pScreen = crtc->pScreen;
- if (pScreen)
- {
- rrScrPriv(pScreen);
- int i;
-
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- if (pScrPriv->crtcs[i] == crtc)
- {
- memmove (pScrPriv->crtcs + i, pScrPriv->crtcs + i + 1,
- (pScrPriv->numCrtcs - (i + 1)) * sizeof (RRCrtcPtr));
- --pScrPriv->numCrtcs;
- break;
- }
- }
+ if (pScreen) {
+ rrScrPriv(pScreen);
+ int i;
+
+ for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ if (pScrPriv->crtcs[i] == crtc) {
+ memmove(pScrPriv->crtcs + i, pScrPriv->crtcs + i + 1,
+ (pScrPriv->numCrtcs - (i + 1)) * sizeof(RRCrtcPtr));
+ --pScrPriv->numCrtcs;
+ break;
+ }
+ }
}
free(crtc->gammaRed);
if (crtc->mode)
- RRModeDestroy (crtc->mode);
+ RRModeDestroy(crtc->mode);
free(crtc);
return 1;
}
@@ -545,25 +520,22 @@ RRCrtcDestroyResource (pointer value, XID pid)
*/
Bool
-RRCrtcGammaSet (RRCrtcPtr crtc,
- CARD16 *red,
- CARD16 *green,
- CARD16 *blue)
+RRCrtcGammaSet(RRCrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue)
{
- Bool ret = TRUE;
+ Bool ret = TRUE;
+
#if RANDR_12_INTERFACE
- ScreenPtr pScreen = crtc->pScreen;
+ ScreenPtr pScreen = crtc->pScreen;
#endif
-
- memcpy (crtc->gammaRed, red, crtc->gammaSize * sizeof (CARD16));
- memcpy (crtc->gammaGreen, green, crtc->gammaSize * sizeof (CARD16));
- memcpy (crtc->gammaBlue, blue, crtc->gammaSize * sizeof (CARD16));
+
+ memcpy(crtc->gammaRed, red, crtc->gammaSize * sizeof(CARD16));
+ memcpy(crtc->gammaGreen, green, crtc->gammaSize * sizeof(CARD16));
+ memcpy(crtc->gammaBlue, blue, crtc->gammaSize * sizeof(CARD16));
#if RANDR_12_INTERFACE
- if (pScreen)
- {
- rrScrPriv(pScreen);
- if (pScrPriv->rrCrtcSetGamma)
- ret = (*pScrPriv->rrCrtcSetGamma) (pScreen, crtc);
+ if (pScreen) {
+ rrScrPriv(pScreen);
+ if (pScrPriv->rrCrtcSetGamma)
+ ret = (*pScrPriv->rrCrtcSetGamma) (pScreen, crtc);
}
#endif
return ret;
@@ -577,13 +549,13 @@ Bool
RRCrtcGammaGet(RRCrtcPtr crtc)
{
Bool ret = TRUE;
+
#if RANDR_12_INTERFACE
- ScreenPtr pScreen = crtc->pScreen;
+ ScreenPtr pScreen = crtc->pScreen;
#endif
#if RANDR_12_INTERFACE
- if (pScreen)
- {
+ if (pScreen) {
rrScrPriv(pScreen);
if (pScrPriv->rrCrtcGetGamma)
ret = (*pScrPriv->rrCrtcGetGamma) (pScreen, crtc);
@@ -599,21 +571,21 @@ RRCrtcGammaGet(RRCrtcPtr crtc)
*/
Bool
-RRCrtcGammaNotify (RRCrtcPtr crtc)
+RRCrtcGammaNotify(RRCrtcPtr crtc)
{
- return TRUE; /* not much going on here */
+ return TRUE; /* not much going on here */
}
static void
-RRModeGetScanoutSize (RRModePtr mode, PictTransformPtr transform,
- int *width, int *height)
+RRModeGetScanoutSize(RRModePtr mode, PictTransformPtr transform,
+ int *width, int *height)
{
- BoxRec box;
+ BoxRec box;
if (mode == NULL) {
- *width = 0;
- *height = 0;
- return;
+ *width = 0;
+ *height = 0;
+ return;
}
box.x1 = 0;
@@ -621,7 +593,7 @@ RRModeGetScanoutSize (RRModePtr mode, PictTransformPtr transform,
box.x2 = mode->mode.width;
box.y2 = mode->mode.height;
- pixman_transform_bounds (transform, &box);
+ pixman_transform_bounds(transform, &box);
*width = box.x2 - box.x1;
*height = box.y2 - box.y1;
}
@@ -632,7 +604,7 @@ RRModeGetScanoutSize (RRModePtr mode, PictTransformPtr transform,
void
RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height)
{
- RRModeGetScanoutSize (crtc->mode, &crtc->transform, width, height);
+ RRModeGetScanoutSize(crtc->mode, &crtc->transform, width, height);
}
/*
@@ -640,25 +612,23 @@ RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height)
*/
Bool
-RRCrtcGammaSetSize (RRCrtcPtr crtc,
- int size)
+RRCrtcGammaSetSize(RRCrtcPtr crtc, int size)
{
- CARD16 *gamma;
+ CARD16 *gamma;
if (size == crtc->gammaSize)
- return TRUE;
- if (size)
- {
- gamma = malloc(size * 3 * sizeof (CARD16));
- if (!gamma)
- return FALSE;
+ return TRUE;
+ if (size) {
+ gamma = malloc(size * 3 * sizeof(CARD16));
+ if (!gamma)
+ return FALSE;
}
else
- gamma = NULL;
+ gamma = NULL;
free(crtc->gammaRed);
crtc->gammaRed = gamma;
crtc->gammaGreen = gamma + size;
- crtc->gammaBlue = gamma + size*2;
+ crtc->gammaBlue = gamma + size * 2;
crtc->gammaSize = size;
return TRUE;
}
@@ -668,47 +638,40 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
*/
int
-RRCrtcTransformSet (RRCrtcPtr crtc,
- PictTransformPtr transform,
- struct pixman_f_transform *f_transform,
- struct pixman_f_transform *f_inverse,
- char *filter_name,
- int filter_len,
- xFixed *params,
- int nparams)
+RRCrtcTransformSet(RRCrtcPtr crtc,
+ PictTransformPtr transform,
+ struct pixman_f_transform *f_transform,
+ struct pixman_f_transform *f_inverse,
+ char *filter_name,
+ int filter_len, xFixed * params, int nparams)
{
- PictFilterPtr filter = NULL;
- int width = 0, height = 0;
+ PictFilterPtr filter = NULL;
+ int width = 0, height = 0;
if (!crtc->transforms)
- return BadValue;
-
- if (filter_len)
- {
- filter = PictureFindFilter (crtc->pScreen,
- filter_name,
- filter_len);
- if (!filter)
- return BadName;
- if (filter->ValidateParams)
- {
- if (!filter->ValidateParams (crtc->pScreen, filter->id,
- params, nparams, &width, &height))
- return BadMatch;
- }
- else {
- width = filter->width;
- height = filter->height;
- }
+ return BadValue;
+
+ if (filter_len) {
+ filter = PictureFindFilter(crtc->pScreen, filter_name, filter_len);
+ if (!filter)
+ return BadName;
+ if (filter->ValidateParams) {
+ if (!filter->ValidateParams(crtc->pScreen, filter->id,
+ params, nparams, &width, &height))
+ return BadMatch;
+ }
+ else {
+ width = filter->width;
+ height = filter->height;
+ }
}
- else
- {
- if (nparams)
- return BadMatch;
+ else {
+ if (nparams)
+ return BadMatch;
}
- if (!RRTransformSetFilter (&crtc->client_pending_transform,
- filter, params, nparams, width, height))
- return BadAlloc;
+ if (!RRTransformSetFilter(&crtc->client_pending_transform,
+ filter, params, nparams, width, height))
+ return BadAlloc;
crtc->client_pending_transform.transform = *transform;
crtc->client_pending_transform.f_transform = *f_transform;
@@ -720,12 +683,12 @@ RRCrtcTransformSet (RRCrtcPtr crtc,
* Initialize crtc type
*/
Bool
-RRCrtcInit (void)
+RRCrtcInit(void)
{
- RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC");
+ RRCrtcType = CreateNewResourceType(RRCrtcDestroyResource, "CRTC");
if (!RRCrtcType)
- return FALSE;
-
+ return FALSE;
+
return TRUE;
}
@@ -739,22 +702,22 @@ RRCrtcInitErrorValue(void)
}
int
-ProcRRGetCrtcInfo (ClientPtr client)
+ProcRRGetCrtcInfo(ClientPtr client)
{
REQUEST(xRRGetCrtcInfoReq);
- xRRGetCrtcInfoReply rep;
- RRCrtcPtr crtc;
- CARD8 *extra;
- unsigned long extraLen;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- RRModePtr mode;
- RROutput *outputs;
- RROutput *possible;
- int i, j, k;
- int width, height;
- BoxRec panned_area;
-
+ xRRGetCrtcInfoReply rep;
+ RRCrtcPtr crtc;
+ CARD8 *extra;
+ unsigned long extraLen;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ RRModePtr mode;
+ RROutput *outputs;
+ RROutput *possible;
+ int i, j, k;
+ int width, height;
+ BoxRec panned_area;
+
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
@@ -765,28 +728,27 @@ ProcRRGetCrtcInfo (ClientPtr client)
pScrPriv = rrGetScrPriv(pScreen);
mode = crtc->mode;
-
+
rep.type = X_Reply;
rep.status = RRSetConfigSuccess;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
if (pScrPriv->rrGetPanning &&
- pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) &&
- (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
+ pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
+ (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
{
- rep.x = panned_area.x1;
- rep.y = panned_area.y1;
- rep.width = panned_area.x2 - panned_area.x1;
- rep.height = panned_area.y2 - panned_area.y1;
+ rep.x = panned_area.x1;
+ rep.y = panned_area.y1;
+ rep.width = panned_area.x2 - panned_area.x1;
+ rep.height = panned_area.y2 - panned_area.y1;
}
- else
- {
- RRCrtcGetScanoutSize (crtc, &width, &height);
- rep.x = crtc->x;
- rep.y = crtc->y;
- rep.width = width;
- rep.height = height;
+ else {
+ RRCrtcGetScanoutSize(crtc, &width, &height);
+ rep.x = crtc->x;
+ rep.y = crtc->y;
+ rep.width = width;
+ rep.height = height;
}
rep.mode = mode ? mode->mode.id : 0;
rep.rotation = crtc->rotation;
@@ -794,178 +756,162 @@ ProcRRGetCrtcInfo (ClientPtr client)
rep.nOutput = crtc->numOutputs;
k = 0;
for (i = 0; i < pScrPriv->numOutputs; i++)
- for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
- if (pScrPriv->outputs[i]->crtcs[j] == crtc)
- k++;
+ for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
+ if (pScrPriv->outputs[i]->crtcs[j] == crtc)
+ k++;
rep.nPossibleOutput = k;
-
+
rep.length = rep.nOutput + rep.nPossibleOutput;
extraLen = rep.length << 2;
- if (extraLen)
- {
- extra = malloc(extraLen);
- if (!extra)
- return BadAlloc;
+ if (extraLen) {
+ extra = malloc(extraLen);
+ if (!extra)
+ return BadAlloc;
}
else
- extra = NULL;
+ extra = NULL;
outputs = (RROutput *) extra;
possible = (RROutput *) (outputs + rep.nOutput);
-
- for (i = 0; i < crtc->numOutputs; i++)
- {
- outputs[i] = crtc->outputs[i]->id;
- if (client->swapped)
- swapl(&outputs[i]);
+
+ for (i = 0; i < crtc->numOutputs; i++) {
+ outputs[i] = crtc->outputs[i]->id;
+ if (client->swapped)
+ swapl(&outputs[i]);
}
k = 0;
for (i = 0; i < pScrPriv->numOutputs; i++)
- for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
- if (pScrPriv->outputs[i]->crtcs[j] == crtc)
- {
- possible[k] = pScrPriv->outputs[i]->id;
- if (client->swapped)
- swapl(&possible[k]);
- k++;
- }
-
+ for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
+ if (pScrPriv->outputs[i]->crtcs[j] == crtc) {
+ possible[k] = pScrPriv->outputs[i]->id;
+ if (client->swapped)
+ swapl(&possible[k]);
+ k++;
+ }
+
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.timestamp);
- swaps(&rep.x);
- swaps(&rep.y);
- swaps(&rep.width);
- swaps(&rep.height);
- swapl(&rep.mode);
- swaps(&rep.rotation);
- swaps(&rep.rotations);
- swaps(&rep.nOutput);
- swaps(&rep.nPossibleOutput);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.timestamp);
+ swaps(&rep.x);
+ swaps(&rep.y);
+ swaps(&rep.width);
+ swaps(&rep.height);
+ swapl(&rep.mode);
+ swaps(&rep.rotation);
+ swaps(&rep.rotations);
+ swaps(&rep.nOutput);
+ swaps(&rep.nPossibleOutput);
}
- WriteToClient(client, sizeof(xRRGetCrtcInfoReply), (char *)&rep);
- if (extraLen)
- {
- WriteToClient (client, extraLen, (char *) extra);
- free(extra);
+ WriteToClient(client, sizeof(xRRGetCrtcInfoReply), (char *) &rep);
+ if (extraLen) {
+ WriteToClient(client, extraLen, (char *) extra);
+ free(extra);
}
-
+
return Success;
}
int
-ProcRRSetCrtcConfig (ClientPtr client)
+ProcRRSetCrtcConfig(ClientPtr client)
{
REQUEST(xRRSetCrtcConfigReq);
- xRRSetCrtcConfigReply rep;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- RRCrtcPtr crtc;
- RRModePtr mode;
- int numOutputs;
- RROutputPtr *outputs = NULL;
- RROutput *outputIds;
- TimeStamp configTime;
- TimeStamp time;
- Rotation rotation;
- int rc, i, j;
-
+ xRRSetCrtcConfigReply rep;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ RRCrtcPtr crtc;
+ RRModePtr mode;
+ int numOutputs;
+ RROutputPtr *outputs = NULL;
+ RROutput *outputIds;
+ TimeStamp configTime;
+ TimeStamp time;
+ Rotation rotation;
+ int rc, i, j;
+
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
- numOutputs = (stuff->length - bytes_to_int32(SIZEOF (xRRSetCrtcConfigReq)));
-
+ numOutputs = (stuff->length - bytes_to_int32(SIZEOF(xRRSetCrtcConfigReq)));
+
VERIFY_RR_CRTC(stuff->crtc, crtc, DixSetAttrAccess);
- if (stuff->mode == None)
- {
- mode = NULL;
- if (numOutputs > 0)
- return BadMatch;
+ if (stuff->mode == None) {
+ mode = NULL;
+ if (numOutputs > 0)
+ return BadMatch;
}
- else
- {
- VERIFY_RR_MODE(stuff->mode, mode, DixSetAttrAccess);
- if (numOutputs == 0)
- return BadMatch;
+ else {
+ VERIFY_RR_MODE(stuff->mode, mode, DixSetAttrAccess);
+ if (numOutputs == 0)
+ return BadMatch;
}
- if (numOutputs)
- {
- outputs = malloc(numOutputs * sizeof (RROutputPtr));
- if (!outputs)
- return BadAlloc;
+ if (numOutputs) {
+ outputs = malloc(numOutputs * sizeof(RROutputPtr));
+ if (!outputs)
+ return BadAlloc;
}
else
- outputs = NULL;
-
+ outputs = NULL;
+
outputIds = (RROutput *) (stuff + 1);
- for (i = 0; i < numOutputs; i++)
- {
- rc = dixLookupResourceByType((pointer *)(outputs + i), outputIds[i],
- RROutputType, client, DixSetAttrAccess);
- if (rc != Success)
- {
- free(outputs);
- return rc;
- }
- /* validate crtc for this output */
- for (j = 0; j < outputs[i]->numCrtcs; j++)
- if (outputs[i]->crtcs[j] == crtc)
- break;
- if (j == outputs[i]->numCrtcs)
- {
- free(outputs);
- return BadMatch;
- }
- /* validate mode for this output */
- for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++)
- {
- RRModePtr m = (j < outputs[i]->numModes ?
- outputs[i]->modes[j] :
- outputs[i]->userModes[j - outputs[i]->numModes]);
- if (m == mode)
- break;
- }
- if (j == outputs[i]->numModes + outputs[i]->numUserModes)
- {
- free(outputs);
- return BadMatch;
- }
+ for (i = 0; i < numOutputs; i++) {
+ rc = dixLookupResourceByType((pointer *) (outputs + i), outputIds[i],
+ RROutputType, client, DixSetAttrAccess);
+ if (rc != Success) {
+ free(outputs);
+ return rc;
+ }
+ /* validate crtc for this output */
+ for (j = 0; j < outputs[i]->numCrtcs; j++)
+ if (outputs[i]->crtcs[j] == crtc)
+ break;
+ if (j == outputs[i]->numCrtcs) {
+ free(outputs);
+ return BadMatch;
+ }
+ /* validate mode for this output */
+ for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++) {
+ RRModePtr m = (j < outputs[i]->numModes ?
+ outputs[i]->modes[j] :
+ outputs[i]->userModes[j - outputs[i]->numModes]);
+ if (m == mode)
+ break;
+ }
+ if (j == outputs[i]->numModes + outputs[i]->numUserModes) {
+ free(outputs);
+ return BadMatch;
+ }
}
/* validate clones */
- for (i = 0; i < numOutputs; i++)
- {
- for (j = 0; j < numOutputs; j++)
- {
- int k;
- if (i == j)
- continue;
- for (k = 0; k < outputs[i]->numClones; k++)
- {
- if (outputs[i]->clones[k] == outputs[j])
- break;
- }
- if (k == outputs[i]->numClones)
- {
- free(outputs);
- return BadMatch;
- }
- }
+ for (i = 0; i < numOutputs; i++) {
+ for (j = 0; j < numOutputs; j++) {
+ int k;
+
+ if (i == j)
+ continue;
+ for (k = 0; k < outputs[i]->numClones; k++) {
+ if (outputs[i]->clones[k] == outputs[j])
+ break;
+ }
+ if (k == outputs[i]->numClones) {
+ free(outputs);
+ return BadMatch;
+ }
+ }
}
pScreen = crtc->pScreen;
pScrPriv = rrGetScrPriv(pScreen);
-
+
time = ClientTimeToServerTime(stuff->timestamp);
configTime = ClientTimeToServerTime(stuff->configTimestamp);
-
- if (!pScrPriv)
- {
- time = currentTime;
- rep.status = RRSetConfigFailed;
- goto sendReply;
+
+ if (!pScrPriv) {
+ time = currentTime;
+ rep.status = RRSetConfigFailed;
+ goto sendReply;
}
-
+
/*
* Validate requested rotation
*/
@@ -977,108 +923,102 @@ ProcRRSetCrtcConfig (ClientPtr client)
case RR_Rotate_90:
case RR_Rotate_180:
case RR_Rotate_270:
- break;
+ break;
default:
- /*
- * Invalid rotation
- */
- client->errorValue = stuff->rotation;
- free(outputs);
- return BadValue;
+ /*
+ * Invalid rotation
+ */
+ client->errorValue = stuff->rotation;
+ free(outputs);
+ return BadValue;
}
- if (mode)
- {
- if ((~crtc->rotations) & rotation)
- {
- /*
- * requested rotation or reflection not supported by screen
- */
- client->errorValue = stuff->rotation;
- free(outputs);
- return BadMatch;
- }
-
+ if (mode) {
+ if ((~crtc->rotations) & rotation) {
+ /*
+ * requested rotation or reflection not supported by screen
+ */
+ client->errorValue = stuff->rotation;
+ free(outputs);
+ return BadMatch;
+ }
+
#ifdef RANDR_12_INTERFACE
- /*
- * Check screen size bounds if the DDX provides a 1.2 interface
- * for setting screen size. Else, assume the CrtcSet sets
- * the size along with the mode. If the driver supports transforms,
- * then it must allow crtcs to display a subset of the screen, so
- * only do this check for drivers without transform support.
- */
- if (pScrPriv->rrScreenSetSize && !crtc->transforms)
- {
- int source_width;
- int source_height;
- PictTransform transform;
- struct pixman_f_transform f_transform, f_inverse;
-
- RRTransformCompute (stuff->x, stuff->y,
- mode->mode.width, mode->mode.height,
- rotation,
- &crtc->client_pending_transform,
- &transform, &f_transform, &f_inverse);
-
- RRModeGetScanoutSize (mode, &transform, &source_width, &source_height);
- if (stuff->x + source_width > pScreen->width)
- {
- client->errorValue = stuff->x;
- free(outputs);
- return BadValue;
- }
-
- if (stuff->y + source_height > pScreen->height)
- {
- client->errorValue = stuff->y;
- free(outputs);
- return BadValue;
- }
- }
+ /*
+ * Check screen size bounds if the DDX provides a 1.2 interface
+ * for setting screen size. Else, assume the CrtcSet sets
+ * the size along with the mode. If the driver supports transforms,
+ * then it must allow crtcs to display a subset of the screen, so
+ * only do this check for drivers without transform support.
+ */
+ if (pScrPriv->rrScreenSetSize && !crtc->transforms) {
+ int source_width;
+ int source_height;
+ PictTransform transform;
+ struct pixman_f_transform f_transform, f_inverse;
+
+ RRTransformCompute(stuff->x, stuff->y,
+ mode->mode.width, mode->mode.height,
+ rotation,
+ &crtc->client_pending_transform,
+ &transform, &f_transform, &f_inverse);
+
+ RRModeGetScanoutSize(mode, &transform, &source_width,
+ &source_height);
+ if (stuff->x + source_width > pScreen->width) {
+ client->errorValue = stuff->x;
+ free(outputs);
+ return BadValue;
+ }
+
+ if (stuff->y + source_height > pScreen->height) {
+ client->errorValue = stuff->y;
+ free(outputs);
+ return BadValue;
+ }
+ }
#endif
}
-
- if (!RRCrtcSet (crtc, mode, stuff->x, stuff->y,
- rotation, numOutputs, outputs))
- {
- rep.status = RRSetConfigFailed;
- goto sendReply;
+
+ if (!RRCrtcSet(crtc, mode, stuff->x, stuff->y,
+ rotation, numOutputs, outputs)) {
+ rep.status = RRSetConfigFailed;
+ goto sendReply;
}
rep.status = RRSetConfigSuccess;
pScrPriv->lastSetTime = time;
-
-sendReply:
+
+ sendReply:
free(outputs);
-
+
rep.type = X_Reply;
/* rep.status has already been filled in */
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.newTimestamp);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.newTimestamp);
}
- WriteToClient(client, sizeof(xRRSetCrtcConfigReply), (char *)&rep);
-
+ WriteToClient(client, sizeof(xRRSetCrtcConfigReply), (char *) &rep);
+
return Success;
}
int
-ProcRRGetPanning (ClientPtr client)
+ProcRRGetPanning(ClientPtr client)
{
REQUEST(xRRGetPanningReq);
- xRRGetPanningReply rep;
- RRCrtcPtr crtc;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- BoxRec total;
- BoxRec tracking;
- INT16 border[4];
-
+ xRRGetPanningReply rep;
+ RRCrtcPtr crtc;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ BoxRec total;
+ BoxRec tracking;
+ INT16 border[4];
+
REQUEST_SIZE_MATCH(xRRGetPanningReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
@@ -1089,7 +1029,7 @@ ProcRRGetPanning (ClientPtr client)
pScrPriv = rrGetScrPriv(pScreen);
if (!pScrPriv)
- return RRErrorBase + BadRRCrtc;
+ return RRErrorBase + BadRRCrtc;
memset(&rep, 0, sizeof(rep));
rep.type = X_Reply;
@@ -1099,55 +1039,55 @@ ProcRRGetPanning (ClientPtr client)
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
if (pScrPriv->rrGetPanning &&
- pScrPriv->rrGetPanning (pScreen, crtc, &total, &tracking, border)) {
- rep.left = total.x1;
- rep.top = total.y1;
- rep.width = total.x2 - total.x1;
- rep.height = total.y2 - total.y1;
- rep.track_left = tracking.x1;
- rep.track_top = tracking.y1;
- rep.track_width = tracking.x2 - tracking.x1;
- rep.track_height = tracking.y2 - tracking.y1;
- rep.border_left = border[0];
- rep.border_top = border[1];
- rep.border_right = border[2];
- rep.border_bottom = border[3];
+ pScrPriv->rrGetPanning(pScreen, crtc, &total, &tracking, border)) {
+ rep.left = total.x1;
+ rep.top = total.y1;
+ rep.width = total.x2 - total.x1;
+ rep.height = total.y2 - total.y1;
+ rep.track_left = tracking.x1;
+ rep.track_top = tracking.y1;
+ rep.track_width = tracking.x2 - tracking.x1;
+ rep.track_height = tracking.y2 - tracking.y1;
+ rep.border_left = border[0];
+ rep.border_top = border[1];
+ rep.border_right = border[2];
+ rep.border_bottom = border[3];
}
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.timestamp);
- swaps(&rep.left);
- swaps(&rep.top);
- swaps(&rep.width);
- swaps(&rep.height);
- swaps(&rep.track_left);
- swaps(&rep.track_top);
- swaps(&rep.track_width);
- swaps(&rep.track_height);
- swaps(&rep.border_left);
- swaps(&rep.border_top);
- swaps(&rep.border_right);
- swaps(&rep.border_bottom);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.timestamp);
+ swaps(&rep.left);
+ swaps(&rep.top);
+ swaps(&rep.width);
+ swaps(&rep.height);
+ swaps(&rep.track_left);
+ swaps(&rep.track_top);
+ swaps(&rep.track_width);
+ swaps(&rep.track_height);
+ swaps(&rep.border_left);
+ swaps(&rep.border_top);
+ swaps(&rep.border_right);
+ swaps(&rep.border_bottom);
}
- WriteToClient(client, sizeof(xRRGetPanningReply), (char *)&rep);
+ WriteToClient(client, sizeof(xRRGetPanningReply), (char *) &rep);
return Success;
}
int
-ProcRRSetPanning (ClientPtr client)
+ProcRRSetPanning(ClientPtr client)
{
REQUEST(xRRSetPanningReq);
- xRRSetPanningReply rep;
- RRCrtcPtr crtc;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- TimeStamp time;
- BoxRec total;
- BoxRec tracking;
- INT16 border[4];
-
+ xRRSetPanningReply rep;
+ RRCrtcPtr crtc;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ TimeStamp time;
+ BoxRec total;
+ BoxRec tracking;
+ INT16 border[4];
+
REQUEST_SIZE_MATCH(xRRSetPanningReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
@@ -1158,57 +1098,57 @@ ProcRRSetPanning (ClientPtr client)
pScrPriv = rrGetScrPriv(pScreen);
if (!pScrPriv) {
- time = currentTime;
- rep.status = RRSetConfigFailed;
- goto sendReply;
+ time = currentTime;
+ rep.status = RRSetConfigFailed;
+ goto sendReply;
}
-
+
time = ClientTimeToServerTime(stuff->timestamp);
-
+
if (!pScrPriv->rrGetPanning)
- return RRErrorBase + BadRRCrtc;
+ return RRErrorBase + BadRRCrtc;
- total.x1 = stuff->left;
- total.y1 = stuff->top;
- total.x2 = total.x1 + stuff->width;
- total.y2 = total.y1 + stuff->height;
+ total.x1 = stuff->left;
+ total.y1 = stuff->top;
+ total.x2 = total.x1 + stuff->width;
+ total.y2 = total.y1 + stuff->height;
tracking.x1 = stuff->track_left;
tracking.y1 = stuff->track_top;
tracking.x2 = tracking.x1 + stuff->track_width;
tracking.y2 = tracking.y1 + stuff->track_height;
- border[0] = stuff->border_left;
- border[1] = stuff->border_top;
- border[2] = stuff->border_right;
- border[3] = stuff->border_bottom;
+ border[0] = stuff->border_left;
+ border[1] = stuff->border_top;
+ border[2] = stuff->border_right;
+ border[3] = stuff->border_bottom;
- if (! pScrPriv->rrSetPanning (pScreen, crtc, &total, &tracking, border))
- return BadMatch;
+ if (!pScrPriv->rrSetPanning(pScreen, crtc, &total, &tracking, border))
+ return BadMatch;
pScrPriv->lastSetTime = time;
rep.status = RRSetConfigSuccess;
-sendReply:
+ sendReply:
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.newTimestamp);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.newTimestamp);
}
- WriteToClient(client, sizeof(xRRSetPanningReply), (char *)&rep);
+ WriteToClient(client, sizeof(xRRSetPanningReply), (char *) &rep);
return Success;
}
int
-ProcRRGetCrtcGammaSize (ClientPtr client)
+ProcRRGetCrtcGammaSize(ClientPtr client)
{
REQUEST(xRRGetCrtcGammaSizeReq);
- xRRGetCrtcGammaSizeReply reply;
- RRCrtcPtr crtc;
+ xRRGetCrtcGammaSizeReply reply;
+ RRCrtcPtr crtc;
REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
@@ -1222,23 +1162,23 @@ ProcRRGetCrtcGammaSize (ClientPtr client)
reply.length = 0;
reply.size = crtc->gammaSize;
if (client->swapped) {
- swaps(&reply.sequenceNumber);
- swapl(&reply.length);
- swaps(&reply.size);
+ swaps(&reply.sequenceNumber);
+ swapl(&reply.length);
+ swaps(&reply.size);
}
- WriteToClient (client, sizeof (xRRGetCrtcGammaSizeReply), (char *) &reply);
+ WriteToClient(client, sizeof(xRRGetCrtcGammaSizeReply), (char *) &reply);
return Success;
}
int
-ProcRRGetCrtcGamma (ClientPtr client)
+ProcRRGetCrtcGamma(ClientPtr client)
{
REQUEST(xRRGetCrtcGammaReq);
- xRRGetCrtcGammaReply reply;
- RRCrtcPtr crtc;
- unsigned long len;
- char *extra = NULL;
-
+ xRRGetCrtcGammaReply reply;
+ RRCrtcPtr crtc;
+ unsigned long len;
+ char *extra = NULL;
+
REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
@@ -1247,11 +1187,11 @@ ProcRRGetCrtcGamma (ClientPtr client)
return RRErrorBase + BadRRCrtc;
len = crtc->gammaSize * 3 * 2;
-
+
if (crtc->gammaSize) {
- extra = malloc(len);
- if (!extra)
- return BadAlloc;
+ extra = malloc(len);
+ if (!extra)
+ return BadAlloc;
}
reply.type = X_Reply;
@@ -1259,44 +1199,43 @@ ProcRRGetCrtcGamma (ClientPtr client)
reply.length = bytes_to_int32(len);
reply.size = crtc->gammaSize;
if (client->swapped) {
- swaps(&reply.sequenceNumber);
- swapl(&reply.length);
- swaps(&reply.size);
+ swaps(&reply.sequenceNumber);
+ swapl(&reply.length);
+ swaps(&reply.size);
}
- WriteToClient (client, sizeof (xRRGetCrtcGammaReply), (char *) &reply);
- if (crtc->gammaSize)
- {
- memcpy(extra, crtc->gammaRed, len);
- client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write;
- WriteSwappedDataToClient (client, len, extra);
- free(extra);
+ WriteToClient(client, sizeof(xRRGetCrtcGammaReply), (char *) &reply);
+ if (crtc->gammaSize) {
+ memcpy(extra, crtc->gammaRed, len);
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
+ WriteSwappedDataToClient(client, len, extra);
+ free(extra);
}
return Success;
}
int
-ProcRRSetCrtcGamma (ClientPtr client)
+ProcRRSetCrtcGamma(ClientPtr client)
{
REQUEST(xRRSetCrtcGammaReq);
- RRCrtcPtr crtc;
- unsigned long len;
- CARD16 *red, *green, *blue;
-
+ RRCrtcPtr crtc;
+ unsigned long len;
+ CARD16 *red, *green, *blue;
+
REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- len = client->req_len - bytes_to_int32(sizeof (xRRSetCrtcGammaReq));
+
+ len = client->req_len - bytes_to_int32(sizeof(xRRSetCrtcGammaReq));
if (len < (stuff->size * 3 + 1) >> 1)
- return BadLength;
+ return BadLength;
if (stuff->size != crtc->gammaSize)
- return BadMatch;
-
+ return BadMatch;
+
red = (CARD16 *) (stuff + 1);
green = red + crtc->gammaSize;
blue = green + crtc->gammaSize;
-
- RRCrtcGammaSet (crtc, red, green, blue);
+
+ RRCrtcGammaSet(crtc, red, green, blue);
return Success;
}
@@ -1304,111 +1243,110 @@ ProcRRSetCrtcGamma (ClientPtr client)
/* Version 1.3 additions */
int
-ProcRRSetCrtcTransform (ClientPtr client)
+ProcRRSetCrtcTransform(ClientPtr client)
{
REQUEST(xRRSetCrtcTransformReq);
- RRCrtcPtr crtc;
- PictTransform transform;
+ RRCrtcPtr crtc;
+ PictTransform transform;
struct pixman_f_transform f_transform, f_inverse;
- char *filter;
- int nbytes;
- xFixed *params;
- int nparams;
+ char *filter;
+ int nbytes;
+ xFixed *params;
+ int nparams;
REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
- PictTransform_from_xRenderTransform (&transform, &stuff->transform);
- pixman_f_transform_from_pixman_transform (&f_transform, &transform);
- if (!pixman_f_transform_invert (&f_inverse, &f_transform))
- return BadMatch;
+ PictTransform_from_xRenderTransform(&transform, &stuff->transform);
+ pixman_f_transform_from_pixman_transform(&f_transform, &transform);
+ if (!pixman_f_transform_invert(&f_inverse, &f_transform))
+ return BadMatch;
filter = (char *) (stuff + 1);
nbytes = stuff->nbytesFilter;
params = (xFixed *) (filter + pad_to_int32(nbytes));
nparams = ((xFixed *) stuff + client->req_len) - params;
if (nparams < 0)
- return BadLength;
+ return BadLength;
- return RRCrtcTransformSet (crtc, &transform, &f_transform, &f_inverse,
- filter, nbytes, params, nparams);
+ return RRCrtcTransformSet(crtc, &transform, &f_transform, &f_inverse,
+ filter, nbytes, params, nparams);
}
-
#define CrtcTransformExtra (SIZEOF(xRRGetCrtcTransformReply) - 32)
-
+
static int
-transform_filter_length (RRTransformPtr transform)
+transform_filter_length(RRTransformPtr transform)
{
- int nbytes, nparams;
+ int nbytes, nparams;
if (transform->filter == NULL)
- return 0;
- nbytes = strlen (transform->filter->name);
+ return 0;
+ nbytes = strlen(transform->filter->name);
nparams = transform->nparams;
- return pad_to_int32(nbytes) + (nparams * sizeof (xFixed));
+ return pad_to_int32(nbytes) + (nparams * sizeof(xFixed));
}
static int
-transform_filter_encode (ClientPtr client, char *output,
- CARD16 *nbytesFilter,
- CARD16 *nparamsFilter,
- RRTransformPtr transform)
+transform_filter_encode(ClientPtr client, char *output,
+ CARD16 *nbytesFilter,
+ CARD16 *nparamsFilter, RRTransformPtr transform)
{
- int nbytes, nparams;
+ int nbytes, nparams;
if (transform->filter == NULL) {
- *nbytesFilter = 0;
- *nparamsFilter = 0;
- return 0;
+ *nbytesFilter = 0;
+ *nparamsFilter = 0;
+ return 0;
}
- nbytes = strlen (transform->filter->name);
+ nbytes = strlen(transform->filter->name);
nparams = transform->nparams;
*nbytesFilter = nbytes;
*nparamsFilter = nparams;
- memcpy (output, transform->filter->name, nbytes);
+ memcpy(output, transform->filter->name, nbytes);
while ((nbytes & 3) != 0)
- output[nbytes++] = 0;
- memcpy (output + nbytes, transform->params, nparams * sizeof (xFixed));
+ output[nbytes++] = 0;
+ memcpy(output + nbytes, transform->params, nparams * sizeof(xFixed));
if (client->swapped) {
- swaps(nbytesFilter);
- swaps(nparamsFilter);
- SwapLongs ((CARD32 *) (output + nbytes), nparams);
+ swaps(nbytesFilter);
+ swaps(nparamsFilter);
+ SwapLongs((CARD32 *) (output + nbytes), nparams);
}
- nbytes += nparams * sizeof (xFixed);
+ nbytes += nparams * sizeof(xFixed);
return nbytes;
}
static void
-transform_encode (ClientPtr client, xRenderTransform *wire, PictTransform *pict)
+transform_encode(ClientPtr client, xRenderTransform * wire,
+ PictTransform * pict)
{
- xRenderTransform_from_PictTransform (wire, pict);
+ xRenderTransform_from_PictTransform(wire, pict);
if (client->swapped)
- SwapLongs ((CARD32 *) wire, bytes_to_int32(sizeof(xRenderTransform)));
+ SwapLongs((CARD32 *) wire, bytes_to_int32(sizeof(xRenderTransform)));
}
int
-ProcRRGetCrtcTransform (ClientPtr client)
+ProcRRGetCrtcTransform(ClientPtr client)
{
REQUEST(xRRGetCrtcTransformReq);
- xRRGetCrtcTransformReply *reply;
- RRCrtcPtr crtc;
- int nextra;
- RRTransformPtr current, pending;
- char *extra;
+ xRRGetCrtcTransformReply *reply;
+ RRCrtcPtr crtc;
+ int nextra;
+ RRTransformPtr current, pending;
+ char *extra;
- REQUEST_SIZE_MATCH (xRRGetCrtcTransformReq);
+ REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
pending = &crtc->client_pending_transform;
current = &crtc->client_current_transform;
- nextra = (transform_filter_length (pending) +
- transform_filter_length (current));
+ nextra = (transform_filter_length(pending) +
+ transform_filter_length(current));
- reply = malloc(sizeof (xRRGetCrtcTransformReply) + nextra);
+ reply = malloc(sizeof(xRRGetCrtcTransformReply) + nextra);
if (!reply)
- return BadAlloc;
+ return BadAlloc;
extra = (char *) (reply + 1);
reply->type = X_Reply;
@@ -1417,75 +1355,75 @@ ProcRRGetCrtcTransform (ClientPtr client)
reply->hasTransforms = crtc->transforms;
- transform_encode (client, &reply->pendingTransform, &pending->transform);
- extra += transform_filter_encode (client, extra,
- &reply->pendingNbytesFilter,
- &reply->pendingNparamsFilter,
- pending);
+ transform_encode(client, &reply->pendingTransform, &pending->transform);
+ extra += transform_filter_encode(client, extra,
+ &reply->pendingNbytesFilter,
+ &reply->pendingNparamsFilter, pending);
- transform_encode (client, &reply->currentTransform, &current->transform);
- extra += transform_filter_encode (client, extra,
- &reply->currentNbytesFilter,
- &reply->currentNparamsFilter,
- current);
+ transform_encode(client, &reply->currentTransform, &current->transform);
+ extra += transform_filter_encode(client, extra,
+ &reply->currentNbytesFilter,
+ &reply->currentNparamsFilter, current);
if (client->swapped) {
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
}
- WriteToClient (client, sizeof (xRRGetCrtcTransformReply) + nextra, (char *) reply);
+ WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra,
+ (char *) reply);
free(reply);
return Success;
}
void
-RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr pScreen, int mode, int *x, int *y)
+RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr pScreen, int mode, int *x,
+ int *y)
{
- rrScrPriv (pScreen);
+ rrScrPriv(pScreen);
int i;
/* intentional dead space -> let it float */
if (pScrPriv->discontiguous)
- return;
+ return;
/* if we're moving inside a crtc, we're fine */
for (i = 0; i < pScrPriv->numCrtcs; i++) {
- RRCrtcPtr crtc = pScrPriv->crtcs[i];
+ RRCrtcPtr crtc = pScrPriv->crtcs[i];
- int left, right, top, bottom;
+ int left, right, top, bottom;
- if (!crtc->mode)
- continue;
+ if (!crtc->mode)
+ continue;
- crtc_bounds(crtc, &left, &right, &top, &bottom);
+ crtc_bounds(crtc, &left, &right, &top, &bottom);
- if ((*x >= left) && (*x < right) && (*y >= top) && (*y < bottom))
- return;
+ if ((*x >= left) && (*x < right) && (*y >= top) && (*y < bottom))
+ return;
}
/* if we're trying to escape, clamp to the CRTC we're coming from */
for (i = 0; i < pScrPriv->numCrtcs; i++) {
- RRCrtcPtr crtc = pScrPriv->crtcs[i];
- int nx, ny;
- int left, right, top, bottom;
-
- if (!crtc->mode)
- continue;
-
- crtc_bounds(crtc, &left, &right, &top, &bottom);
- miPointerGetPosition(pDev, &nx, &ny);
-
- if ((nx >= left) && (nx < right) && (ny >= top) && (ny < bottom)) {
- if (*x < left)
- *x = left;
- if (*x >= right)
- *x = right - 1;
- if (*y < top)
- *y = top;
- if (*y >= bottom)
- *y = bottom - 1;
-
- return;
- }
+ RRCrtcPtr crtc = pScrPriv->crtcs[i];
+ int nx, ny;
+ int left, right, top, bottom;
+
+ if (!crtc->mode)
+ continue;
+
+ crtc_bounds(crtc, &left, &right, &top, &bottom);
+ miPointerGetPosition(pDev, &nx, &ny);
+
+ if ((nx >= left) && (nx < right) && (ny >= top) && (ny < bottom)) {
+ if (*x < left)
+ *x = left;
+ if (*x >= right)
+ *x = right - 1;
+ if (*y < top)
+ *y = top;
+ if (*y >= bottom)
+ *y = bottom - 1;
+
+ return;
+ }
}
}
diff --git a/xorg-server/randr/rrdispatch.c b/xorg-server/randr/rrdispatch.c
index 5a6a85287..85cf03738 100644
--- a/xorg-server/randr/rrdispatch.c
+++ b/xorg-server/randr/rrdispatch.c
@@ -24,7 +24,7 @@
#include "protocol-versions.h"
Bool
-RRClientKnowsRates (ClientPtr pClient)
+RRClientKnowsRates(ClientPtr pClient)
{
rrClientPriv(pClient);
@@ -33,9 +33,9 @@ RRClientKnowsRates (ClientPtr pClient)
}
static int
-ProcRRQueryVersion (ClientPtr client)
+ProcRRQueryVersion(ClientPtr client)
{
- xRRQueryVersionReply rep = {0};
+ xRRQueryVersionReply rep = { 0 };
REQUEST(xRRQueryVersionReq);
rrClientPriv(client);
@@ -47,209 +47,198 @@ ProcRRQueryVersion (ClientPtr client)
rep.sequenceNumber = client->sequence;
if (version_compare(stuff->majorVersion, stuff->minorVersion,
- SERVER_RANDR_MAJOR_VERSION, SERVER_RANDR_MINOR_VERSION) < 0)
- {
- rep.majorVersion = stuff->majorVersion;
- rep.minorVersion = stuff->minorVersion;
- } else
- {
+ SERVER_RANDR_MAJOR_VERSION,
+ SERVER_RANDR_MINOR_VERSION) < 0) {
+ rep.majorVersion = stuff->majorVersion;
+ rep.minorVersion = stuff->minorVersion;
+ }
+ else {
rep.majorVersion = SERVER_RANDR_MAJOR_VERSION;
rep.minorVersion = SERVER_RANDR_MINOR_VERSION;
}
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xRRQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xRRQueryVersionReply), (char *) &rep);
return Success;
}
static int
-ProcRRSelectInput (ClientPtr client)
+ProcRRSelectInput(ClientPtr client)
{
REQUEST(xRRSelectInputReq);
rrClientPriv(client);
- RRTimesPtr pTimes;
- WindowPtr pWin;
- RREventPtr pRREvent, *pHead;
- XID clientResource;
- int rc;
+ RRTimesPtr pTimes;
+ WindowPtr pWin;
+ RREventPtr pRREvent, *pHead;
+ XID clientResource;
+ int rc;
REQUEST_SIZE_MATCH(xRRSelectInputReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
if (rc != Success)
- return rc;
- rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- RREventType, client, DixWriteAccess);
+ return rc;
+ rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ RREventType, client, DixWriteAccess);
if (rc != Success && rc != BadValue)
- return rc;
-
- if (stuff->enable & (RRScreenChangeNotifyMask|
- RRCrtcChangeNotifyMask|
- RROutputChangeNotifyMask|
- RROutputPropertyNotifyMask))
- {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- rrScrPriv (pScreen);
-
- pRREvent = NULL;
- if (pHead)
- {
- /* check for existing entry. */
- for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
- if (pRREvent->client == client)
- break;
- }
-
- if (!pRREvent)
- {
- /* build the entry */
- pRREvent = (RREventPtr) malloc(sizeof (RREventRec));
- if (!pRREvent)
- return BadAlloc;
- pRREvent->next = 0;
- pRREvent->client = client;
- pRREvent->window = pWin;
- pRREvent->mask = stuff->enable;
- /*
- * add a resource that will be deleted when
- * the client goes away
- */
- clientResource = FakeClientID (client->index);
- pRREvent->clientResource = clientResource;
- if (!AddResource (clientResource, RRClientType, (pointer)pRREvent))
- return BadAlloc;
- /*
- * create a resource to contain a pointer to the list
- * of clients selecting input. This must be indirect as
- * the list may be arbitrarily rearranged which cannot be
- * done through the resource database.
- */
- if (!pHead)
- {
- pHead = (RREventPtr *) malloc(sizeof (RREventPtr));
- if (!pHead ||
- !AddResource (pWin->drawable.id, RREventType, (pointer)pHead))
- {
- FreeResource (clientResource, RT_NONE);
- return BadAlloc;
- }
- *pHead = 0;
- }
- pRREvent->next = *pHead;
- *pHead = pRREvent;
- }
- /*
- * Now see if the client needs an event
- */
- if (pScrPriv)
- {
- pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum];
- if (CompareTimeStamps (pTimes->setTime,
- pScrPriv->lastSetTime) != 0 ||
- CompareTimeStamps (pTimes->configTime,
- pScrPriv->lastConfigTime) != 0)
- {
- if (pRREvent->mask & RRScreenChangeNotifyMask)
- {
- RRDeliverScreenEvent (client, pWin, pScreen);
- }
-
- if (pRREvent->mask & RRCrtcChangeNotifyMask)
- {
- int i;
-
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- RRDeliverCrtcEvent (client, pWin, pScrPriv->crtcs[i]);
- }
- }
-
- if (pRREvent->mask & RROutputChangeNotifyMask)
- {
- int i;
-
- for (i = 0; i < pScrPriv->numOutputs; i++)
- {
- RRDeliverOutputEvent (client, pWin, pScrPriv->outputs[i]);
- }
- }
-
- /* We don't check for RROutputPropertyNotifyMask, as randrproto.txt doesn't
- * say if there ought to be notifications of changes to output properties
- * if those changes occurred before the time RRSelectInput is called.
- */
- }
- }
+ return rc;
+
+ if (stuff->enable & (RRScreenChangeNotifyMask |
+ RRCrtcChangeNotifyMask |
+ RROutputChangeNotifyMask |
+ RROutputPropertyNotifyMask)) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ rrScrPriv(pScreen);
+
+ pRREvent = NULL;
+ if (pHead) {
+ /* check for existing entry. */
+ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
+ if (pRREvent->client == client)
+ break;
+ }
+
+ if (!pRREvent) {
+ /* build the entry */
+ pRREvent = (RREventPtr) malloc(sizeof(RREventRec));
+ if (!pRREvent)
+ return BadAlloc;
+ pRREvent->next = 0;
+ pRREvent->client = client;
+ pRREvent->window = pWin;
+ pRREvent->mask = stuff->enable;
+ /*
+ * add a resource that will be deleted when
+ * the client goes away
+ */
+ clientResource = FakeClientID(client->index);
+ pRREvent->clientResource = clientResource;
+ if (!AddResource(clientResource, RRClientType, (pointer) pRREvent))
+ return BadAlloc;
+ /*
+ * create a resource to contain a pointer to the list
+ * of clients selecting input. This must be indirect as
+ * the list may be arbitrarily rearranged which cannot be
+ * done through the resource database.
+ */
+ if (!pHead) {
+ pHead = (RREventPtr *) malloc(sizeof(RREventPtr));
+ if (!pHead ||
+ !AddResource(pWin->drawable.id, RREventType,
+ (pointer) pHead)) {
+ FreeResource(clientResource, RT_NONE);
+ return BadAlloc;
+ }
+ *pHead = 0;
+ }
+ pRREvent->next = *pHead;
+ *pHead = pRREvent;
+ }
+ /*
+ * Now see if the client needs an event
+ */
+ if (pScrPriv) {
+ pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum];
+ if (CompareTimeStamps(pTimes->setTime,
+ pScrPriv->lastSetTime) != 0 ||
+ CompareTimeStamps(pTimes->configTime,
+ pScrPriv->lastConfigTime) != 0) {
+ if (pRREvent->mask & RRScreenChangeNotifyMask) {
+ RRDeliverScreenEvent(client, pWin, pScreen);
+ }
+
+ if (pRREvent->mask & RRCrtcChangeNotifyMask) {
+ int i;
+
+ for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ RRDeliverCrtcEvent(client, pWin, pScrPriv->crtcs[i]);
+ }
+ }
+
+ if (pRREvent->mask & RROutputChangeNotifyMask) {
+ int i;
+
+ for (i = 0; i < pScrPriv->numOutputs; i++) {
+ RRDeliverOutputEvent(client, pWin,
+ pScrPriv->outputs[i]);
+ }
+ }
+
+ /* We don't check for RROutputPropertyNotifyMask, as randrproto.txt doesn't
+ * say if there ought to be notifications of changes to output properties
+ * if those changes occurred before the time RRSelectInput is called.
+ */
+ }
+ }
}
- else if (stuff->enable == 0)
- {
- /* delete the interest */
- if (pHead) {
- RREventPtr pNewRREvent = 0;
- for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) {
- if (pRREvent->client == client)
- break;
- pNewRREvent = pRREvent;
- }
- if (pRREvent) {
- FreeResource (pRREvent->clientResource, RRClientType);
- if (pNewRREvent)
- pNewRREvent->next = pRREvent->next;
- else
- *pHead = pRREvent->next;
- free(pRREvent);
- }
- }
+ else if (stuff->enable == 0) {
+ /* delete the interest */
+ if (pHead) {
+ RREventPtr pNewRREvent = 0;
+
+ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) {
+ if (pRREvent->client == client)
+ break;
+ pNewRREvent = pRREvent;
+ }
+ if (pRREvent) {
+ FreeResource(pRREvent->clientResource, RRClientType);
+ if (pNewRREvent)
+ pNewRREvent->next = pRREvent->next;
+ else
+ *pHead = pRREvent->next;
+ free(pRREvent);
+ }
+ }
}
- else
- {
- client->errorValue = stuff->enable;
- return BadValue;
+ else {
+ client->errorValue = stuff->enable;
+ return BadValue;
}
return Success;
}
-int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = {
- ProcRRQueryVersion, /* 0 */
+int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = {
+ ProcRRQueryVersion, /* 0 */
/* we skip 1 to make old clients fail pretty immediately */
- NULL, /* 1 ProcRandrOldGetScreenInfo */
+ NULL, /* 1 ProcRandrOldGetScreenInfo */
/* V1.0 apps share the same set screen config request id */
- ProcRRSetScreenConfig, /* 2 */
- NULL, /* 3 ProcRandrOldScreenChangeSelectInput */
+ ProcRRSetScreenConfig, /* 2 */
+ NULL, /* 3 ProcRandrOldScreenChangeSelectInput */
/* 3 used to be ScreenChangeSelectInput; deprecated */
- ProcRRSelectInput, /* 4 */
- ProcRRGetScreenInfo, /* 5 */
+ ProcRRSelectInput, /* 4 */
+ ProcRRGetScreenInfo, /* 5 */
/* V1.2 additions */
- ProcRRGetScreenSizeRange, /* 6 */
- ProcRRSetScreenSize, /* 7 */
- ProcRRGetScreenResources, /* 8 */
- ProcRRGetOutputInfo, /* 9 */
- ProcRRListOutputProperties, /* 10 */
- ProcRRQueryOutputProperty, /* 11 */
- ProcRRConfigureOutputProperty, /* 12 */
- ProcRRChangeOutputProperty, /* 13 */
- ProcRRDeleteOutputProperty, /* 14 */
- ProcRRGetOutputProperty, /* 15 */
- ProcRRCreateMode, /* 16 */
- ProcRRDestroyMode, /* 17 */
- ProcRRAddOutputMode, /* 18 */
- ProcRRDeleteOutputMode, /* 19 */
- ProcRRGetCrtcInfo, /* 20 */
- ProcRRSetCrtcConfig, /* 21 */
- ProcRRGetCrtcGammaSize, /* 22 */
- ProcRRGetCrtcGamma, /* 23 */
- ProcRRSetCrtcGamma, /* 24 */
+ ProcRRGetScreenSizeRange, /* 6 */
+ ProcRRSetScreenSize, /* 7 */
+ ProcRRGetScreenResources, /* 8 */
+ ProcRRGetOutputInfo, /* 9 */
+ ProcRRListOutputProperties, /* 10 */
+ ProcRRQueryOutputProperty, /* 11 */
+ ProcRRConfigureOutputProperty, /* 12 */
+ ProcRRChangeOutputProperty, /* 13 */
+ ProcRRDeleteOutputProperty, /* 14 */
+ ProcRRGetOutputProperty, /* 15 */
+ ProcRRCreateMode, /* 16 */
+ ProcRRDestroyMode, /* 17 */
+ ProcRRAddOutputMode, /* 18 */
+ ProcRRDeleteOutputMode, /* 19 */
+ ProcRRGetCrtcInfo, /* 20 */
+ ProcRRSetCrtcConfig, /* 21 */
+ ProcRRGetCrtcGammaSize, /* 22 */
+ ProcRRGetCrtcGamma, /* 23 */
+ ProcRRSetCrtcGamma, /* 24 */
/* V1.3 additions */
- ProcRRGetScreenResourcesCurrent, /* 25 */
- ProcRRSetCrtcTransform, /* 26 */
- ProcRRGetCrtcTransform, /* 27 */
- ProcRRGetPanning, /* 28 */
- ProcRRSetPanning, /* 29 */
- ProcRRSetOutputPrimary, /* 30 */
- ProcRRGetOutputPrimary, /* 31 */
+ ProcRRGetScreenResourcesCurrent, /* 25 */
+ ProcRRSetCrtcTransform, /* 26 */
+ ProcRRGetCrtcTransform, /* 27 */
+ ProcRRGetPanning, /* 28 */
+ ProcRRSetPanning, /* 29 */
+ ProcRRSetOutputPrimary, /* 30 */
+ ProcRRGetOutputPrimary, /* 31 */
};
-
diff --git a/xorg-server/randr/rrinfo.c b/xorg-server/randr/rrinfo.c
index 02aea5245..114ec3471 100644
--- a/xorg-server/randr/rrinfo.c
+++ b/xorg-server/randr/rrinfo.c
@@ -24,46 +24,45 @@
#ifdef RANDR_10_INTERFACE
static RRModePtr
-RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
+RROldModeAdd(RROutputPtr output, RRScreenSizePtr size, int refresh)
{
- ScreenPtr pScreen = output->pScreen;
+ ScreenPtr pScreen = output->pScreen;
+
rrScrPriv(pScreen);
- xRRModeInfo modeInfo;
- char name[100];
- RRModePtr mode;
- int i;
- RRModePtr *modes;
-
- memset (&modeInfo, '\0', sizeof (modeInfo));
- snprintf (name, sizeof(name), "%dx%d", size->width, size->height);
-
+ xRRModeInfo modeInfo;
+ char name[100];
+ RRModePtr mode;
+ int i;
+ RRModePtr *modes;
+
+ memset(&modeInfo, '\0', sizeof(modeInfo));
+ snprintf(name, sizeof(name), "%dx%d", size->width, size->height);
+
modeInfo.width = size->width;
modeInfo.height = size->height;
modeInfo.hTotal = size->width;
modeInfo.vTotal = size->height;
modeInfo.dotClock = ((CARD32) size->width * (CARD32) size->height *
- (CARD32) refresh);
- modeInfo.nameLength = strlen (name);
- mode = RRModeGet (&modeInfo, name);
+ (CARD32) refresh);
+ modeInfo.nameLength = strlen(name);
+ mode = RRModeGet(&modeInfo, name);
if (!mode)
- return NULL;
+ return NULL;
for (i = 0; i < output->numModes; i++)
- if (output->modes[i] == mode)
- {
- RRModeDestroy (mode);
- return mode;
- }
-
+ if (output->modes[i] == mode) {
+ RRModeDestroy(mode);
+ return mode;
+ }
+
if (output->numModes)
- modes = realloc(output->modes,
- (output->numModes + 1) * sizeof (RRModePtr));
+ modes = realloc(output->modes,
+ (output->numModes + 1) * sizeof(RRModePtr));
else
- modes = malloc(sizeof (RRModePtr));
- if (!modes)
- {
- RRModeDestroy (mode);
- FreeResource (mode->mode.id, 0);
- return NULL;
+ modes = malloc(sizeof(RRModePtr));
+ if (!modes) {
+ RRModeDestroy(mode);
+ FreeResource(mode->mode.id, 0);
+ return NULL;
}
modes[output->numModes++] = mode;
output->modes = modes;
@@ -74,101 +73,95 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
}
static void
-RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
+RRScanOldConfig(ScreenPtr pScreen, Rotation rotations)
{
rrScrPriv(pScreen);
- RROutputPtr output;
- RRCrtcPtr crtc;
- RRModePtr mode, newMode = NULL;
- int i;
- CARD16 minWidth = MAXSHORT, minHeight = MAXSHORT;
- CARD16 maxWidth = 0, maxHeight = 0;
-
+ RROutputPtr output;
+ RRCrtcPtr crtc;
+ RRModePtr mode, newMode = NULL;
+ int i;
+ CARD16 minWidth = MAXSHORT, minHeight = MAXSHORT;
+ CARD16 maxWidth = 0, maxHeight = 0;
+
/*
* First time through, create a crtc and output and hook
* them together
*/
- if (pScrPriv->numOutputs == 0 &&
- pScrPriv->numCrtcs == 0)
- {
- crtc = RRCrtcCreate (pScreen, NULL);
- if (!crtc)
- return;
- output = RROutputCreate (pScreen, "default", 7, NULL);
- if (!output)
- return;
- RROutputSetCrtcs (output, &crtc, 1);
- RROutputSetConnection (output, RR_Connected);
- RROutputSetSubpixelOrder (output, PictureGetSubpixelOrder (pScreen));
+ if (pScrPriv->numOutputs == 0 && pScrPriv->numCrtcs == 0) {
+ crtc = RRCrtcCreate(pScreen, NULL);
+ if (!crtc)
+ return;
+ output = RROutputCreate(pScreen, "default", 7, NULL);
+ if (!output)
+ return;
+ RROutputSetCrtcs(output, &crtc, 1);
+ RROutputSetConnection(output, RR_Connected);
+ RROutputSetSubpixelOrder(output, PictureGetSubpixelOrder(pScreen));
}
output = pScrPriv->outputs[0];
if (!output)
- return;
+ return;
crtc = pScrPriv->crtcs[0];
if (!crtc)
- return;
+ return;
/* check rotations */
- if (rotations != crtc->rotations)
- {
+ if (rotations != crtc->rotations) {
crtc->rotations = rotations;
- crtc->changed = TRUE;
- pScrPriv->changed = TRUE;
+ crtc->changed = TRUE;
+ pScrPriv->changed = TRUE;
}
-
+
/* regenerate mode list */
- for (i = 0; i < pScrPriv->nSizes; i++)
- {
- RRScreenSizePtr size = &pScrPriv->pSizes[i];
- int r;
-
- if (size->nRates)
- {
- for (r = 0; r < size->nRates; r++)
- {
- mode = RROldModeAdd (output, size, size->pRates[r].rate);
- if (i == pScrPriv->size &&
- size->pRates[r].rate == pScrPriv->rate)
- {
- newMode = mode;
- }
- }
- free(size->pRates);
- }
- else
- {
- mode = RROldModeAdd (output, size, 0);
- if (i == pScrPriv->size)
- newMode = mode;
- }
+ for (i = 0; i < pScrPriv->nSizes; i++) {
+ RRScreenSizePtr size = &pScrPriv->pSizes[i];
+ int r;
+
+ if (size->nRates) {
+ for (r = 0; r < size->nRates; r++) {
+ mode = RROldModeAdd(output, size, size->pRates[r].rate);
+ if (i == pScrPriv->size &&
+ size->pRates[r].rate == pScrPriv->rate) {
+ newMode = mode;
+ }
+ }
+ free(size->pRates);
+ }
+ else {
+ mode = RROldModeAdd(output, size, 0);
+ if (i == pScrPriv->size)
+ newMode = mode;
+ }
}
if (pScrPriv->nSizes)
- free(pScrPriv->pSizes);
+ free(pScrPriv->pSizes);
pScrPriv->pSizes = NULL;
pScrPriv->nSizes = 0;
-
+
/* find size bounds */
- for (i = 0; i < output->numModes + output->numUserModes; i++)
- {
- RRModePtr mode = (i < output->numModes ?
- output->modes[i] :
- output->userModes[i-output->numModes]);
- CARD16 width = mode->mode.width;
- CARD16 height = mode->mode.height;
-
- if (width < minWidth) minWidth = width;
- if (width > maxWidth) maxWidth = width;
- if (height < minHeight) minHeight = height;
- if (height > maxHeight) maxHeight = height;
+ for (i = 0; i < output->numModes + output->numUserModes; i++) {
+ RRModePtr mode = (i < output->numModes ?
+ output->modes[i] :
+ output->userModes[i - output->numModes]);
+ CARD16 width = mode->mode.width;
+ CARD16 height = mode->mode.height;
+
+ if (width < minWidth)
+ minWidth = width;
+ if (width > maxWidth)
+ maxWidth = width;
+ if (height < minHeight)
+ minHeight = height;
+ if (height > maxHeight)
+ maxHeight = height;
}
- RRScreenSetSizeRange (pScreen, minWidth, minHeight, maxWidth, maxHeight);
+ RRScreenSetSizeRange(pScreen, minWidth, minHeight, maxWidth, maxHeight);
/* notice current mode */
if (newMode)
- RRCrtcNotify (crtc, newMode, 0, 0, pScrPriv->rotation,
- NULL, 1, &output);
+ RRCrtcNotify(crtc, newMode, 0, 0, pScrPriv->rotation, NULL, 1, &output);
}
#endif
@@ -176,37 +169,37 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
* Poll the driver for changed information
*/
Bool
-RRGetInfo (ScreenPtr pScreen, Bool force_query)
+RRGetInfo(ScreenPtr pScreen, Bool force_query)
{
- rrScrPriv (pScreen);
- Rotation rotations;
- int i;
+ rrScrPriv(pScreen);
+ Rotation rotations;
+ int i;
/* Return immediately if we don't need to re-query and we already have the
* information.
*/
if (!force_query) {
- if (pScrPriv->numCrtcs != 0 || pScrPriv->numOutputs != 0)
- return TRUE;
+ if (pScrPriv->numCrtcs != 0 || pScrPriv->numOutputs != 0)
+ return TRUE;
}
for (i = 0; i < pScrPriv->numOutputs; i++)
- pScrPriv->outputs[i]->changed = FALSE;
+ pScrPriv->outputs[i]->changed = FALSE;
for (i = 0; i < pScrPriv->numCrtcs; i++)
- pScrPriv->crtcs[i]->changed = FALSE;
-
+ pScrPriv->crtcs[i]->changed = FALSE;
+
rotations = 0;
pScrPriv->changed = FALSE;
pScrPriv->configChanged = FALSE;
-
+
if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations))
- return FALSE;
+ return FALSE;
#if RANDR_10_INTERFACE
if (pScrPriv->nSizes)
- RRScanOldConfig (pScreen, rotations);
+ RRScanOldConfig(pScreen, rotations);
#endif
- RRTellChanged (pScreen);
+ RRTellChanged(pScreen);
return TRUE;
}
@@ -214,25 +207,22 @@ RRGetInfo (ScreenPtr pScreen, Bool force_query)
* Register the range of sizes for the screen
*/
void
-RRScreenSetSizeRange (ScreenPtr pScreen,
- CARD16 minWidth,
- CARD16 minHeight,
- CARD16 maxWidth,
- CARD16 maxHeight)
+RRScreenSetSizeRange(ScreenPtr pScreen,
+ CARD16 minWidth,
+ CARD16 minHeight, CARD16 maxWidth, CARD16 maxHeight)
{
- rrScrPriv (pScreen);
+ rrScrPriv(pScreen);
if (!pScrPriv)
- return;
+ return;
if (pScrPriv->minWidth == minWidth && pScrPriv->minHeight == minHeight &&
- pScrPriv->maxWidth == maxWidth && pScrPriv->maxHeight == maxHeight)
- {
- return;
+ pScrPriv->maxWidth == maxWidth && pScrPriv->maxHeight == maxHeight) {
+ return;
}
-
- pScrPriv->minWidth = minWidth;
+
+ pScrPriv->minWidth = minWidth;
pScrPriv->minHeight = minHeight;
- pScrPriv->maxWidth = maxWidth;
+ pScrPriv->maxWidth = maxWidth;
pScrPriv->maxHeight = maxHeight;
pScrPriv->changed = TRUE;
pScrPriv->configChanged = TRUE;
@@ -240,73 +230,67 @@ RRScreenSetSizeRange (ScreenPtr pScreen,
#ifdef RANDR_10_INTERFACE
static Bool
-RRScreenSizeMatches (RRScreenSizePtr a,
- RRScreenSizePtr b)
+RRScreenSizeMatches(RRScreenSizePtr a, RRScreenSizePtr b)
{
if (a->width != b->width)
- return FALSE;
+ return FALSE;
if (a->height != b->height)
- return FALSE;
+ return FALSE;
if (a->mmWidth != b->mmWidth)
- return FALSE;
+ return FALSE;
if (a->mmHeight != b->mmHeight)
- return FALSE;
+ return FALSE;
return TRUE;
}
RRScreenSizePtr
-RRRegisterSize (ScreenPtr pScreen,
- short width,
- short height,
- short mmWidth,
- short mmHeight)
+RRRegisterSize(ScreenPtr pScreen,
+ short width, short height, short mmWidth, short mmHeight)
{
- rrScrPriv (pScreen);
- int i;
- RRScreenSize tmp;
+ rrScrPriv(pScreen);
+ int i;
+ RRScreenSize tmp;
RRScreenSizePtr pNew;
if (!pScrPriv)
- return 0;
-
+ return 0;
+
tmp.id = 0;
tmp.width = width;
- tmp.height= height;
+ tmp.height = height;
tmp.mmWidth = mmWidth;
tmp.mmHeight = mmHeight;
tmp.pRates = 0;
tmp.nRates = 0;
for (i = 0; i < pScrPriv->nSizes; i++)
- if (RRScreenSizeMatches (&tmp, &pScrPriv->pSizes[i]))
- return &pScrPriv->pSizes[i];
+ if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i]))
+ return &pScrPriv->pSizes[i];
pNew = realloc(pScrPriv->pSizes,
- (pScrPriv->nSizes + 1) * sizeof (RRScreenSize));
+ (pScrPriv->nSizes + 1) * sizeof(RRScreenSize));
if (!pNew)
- return 0;
+ return 0;
pNew[pScrPriv->nSizes++] = tmp;
pScrPriv->pSizes = pNew;
- return &pNew[pScrPriv->nSizes-1];
+ return &pNew[pScrPriv->nSizes - 1];
}
-Bool RRRegisterRate (ScreenPtr pScreen,
- RRScreenSizePtr pSize,
- int rate)
+Bool
+RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate)
{
rrScrPriv(pScreen);
- int i;
+ int i;
RRScreenRatePtr pNew, pRate;
if (!pScrPriv)
- return FALSE;
-
+ return FALSE;
+
for (i = 0; i < pSize->nRates; i++)
- if (pSize->pRates[i].rate == rate)
- return TRUE;
+ if (pSize->pRates[i].rate == rate)
+ return TRUE;
- pNew = realloc(pSize->pRates,
- (pSize->nRates + 1) * sizeof (RRScreenRate));
+ pNew = realloc(pSize->pRates, (pSize->nRates + 1) * sizeof(RRScreenRate));
if (!pNew)
- return FALSE;
+ return FALSE;
pRate = &pNew[pSize->nRates++];
pRate->rate = rate;
pSize->pRates = pNew;
@@ -316,24 +300,22 @@ Bool RRRegisterRate (ScreenPtr pScreen,
Rotation
RRGetRotation(ScreenPtr pScreen)
{
- RROutputPtr output = RRFirstOutput (pScreen);
+ RROutputPtr output = RRFirstOutput(pScreen);
if (!output)
- return RR_Rotate_0;
+ return RR_Rotate_0;
return output->crtc->rotation;
}
void
-RRSetCurrentConfig (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize)
+RRSetCurrentConfig(ScreenPtr pScreen,
+ Rotation rotation, int rate, RRScreenSizePtr pSize)
{
- rrScrPriv (pScreen);
+ rrScrPriv(pScreen);
if (!pScrPriv)
- return;
+ return;
pScrPriv->size = pSize - pScrPriv->pSizes;
pScrPriv->rotation = rotation;
pScrPriv->rate = rate;
diff --git a/xorg-server/randr/rrmode.c b/xorg-server/randr/rrmode.c
index 63a2d2a74..b637c06b9 100644
--- a/xorg-server/randr/rrmode.c
+++ b/xorg-server/randr/rrmode.c
@@ -22,69 +22,78 @@
#include "randrstr.h"
-RESTYPE RRModeType;
+RESTYPE RRModeType;
static Bool
-RRModeEqual (xRRModeInfo *a, xRRModeInfo *b)
+RRModeEqual(xRRModeInfo * a, xRRModeInfo * b)
{
- if (a->width != b->width) return FALSE;
- if (a->height != b->height) return FALSE;
- if (a->dotClock != b->dotClock) return FALSE;
- if (a->hSyncStart != b->hSyncStart) return FALSE;
- if (a->hSyncEnd != b->hSyncEnd) return FALSE;
- if (a->hTotal != b->hTotal) return FALSE;
- if (a->hSkew != b->hSkew) return FALSE;
- if (a->vSyncStart != b->vSyncStart) return FALSE;
- if (a->vSyncEnd != b->vSyncEnd) return FALSE;
- if (a->vTotal != b->vTotal) return FALSE;
- if (a->nameLength != b->nameLength) return FALSE;
- if (a->modeFlags != b->modeFlags) return FALSE;
+ if (a->width != b->width)
+ return FALSE;
+ if (a->height != b->height)
+ return FALSE;
+ if (a->dotClock != b->dotClock)
+ return FALSE;
+ if (a->hSyncStart != b->hSyncStart)
+ return FALSE;
+ if (a->hSyncEnd != b->hSyncEnd)
+ return FALSE;
+ if (a->hTotal != b->hTotal)
+ return FALSE;
+ if (a->hSkew != b->hSkew)
+ return FALSE;
+ if (a->vSyncStart != b->vSyncStart)
+ return FALSE;
+ if (a->vSyncEnd != b->vSyncEnd)
+ return FALSE;
+ if (a->vTotal != b->vTotal)
+ return FALSE;
+ if (a->nameLength != b->nameLength)
+ return FALSE;
+ if (a->modeFlags != b->modeFlags)
+ return FALSE;
return TRUE;
}
/*
* Keep a list so it's easy to find modes in the resource database.
*/
-static int num_modes;
-static RRModePtr *modes;
+static int num_modes;
+static RRModePtr *modes;
static RRModePtr
-RRModeCreate (xRRModeInfo *modeInfo,
- const char *name,
- ScreenPtr userScreen)
+RRModeCreate(xRRModeInfo * modeInfo, const char *name, ScreenPtr userScreen)
{
- RRModePtr mode, *newModes;
-
- if (!RRInit ())
- return NULL;
+ RRModePtr mode, *newModes;
- mode = malloc(sizeof (RRModeRec) + modeInfo->nameLength + 1);
+ if (!RRInit())
+ return NULL;
+
+ mode = malloc(sizeof(RRModeRec) + modeInfo->nameLength + 1);
if (!mode)
- return NULL;
+ return NULL;
mode->refcnt = 1;
mode->mode = *modeInfo;
mode->name = (char *) (mode + 1);
- memcpy (mode->name, name, modeInfo->nameLength);
+ memcpy(mode->name, name, modeInfo->nameLength);
mode->name[modeInfo->nameLength] = '\0';
mode->userScreen = userScreen;
if (num_modes)
- newModes = realloc(modes, (num_modes + 1) * sizeof (RRModePtr));
+ newModes = realloc(modes, (num_modes + 1) * sizeof(RRModePtr));
else
- newModes = malloc(sizeof (RRModePtr));
+ newModes = malloc(sizeof(RRModePtr));
- if (!newModes)
- {
- free(mode);
- return NULL;
+ if (!newModes) {
+ free(mode);
+ return NULL;
}
mode->mode.id = FakeClientID(0);
- if (!AddResource (mode->mode.id, RRModeType, (pointer) mode))
- return NULL;
+ if (!AddResource(mode->mode.id, RRModeType, (pointer) mode))
+ return NULL;
modes = newModes;
modes[num_modes++] = mode;
-
+
/*
* give the caller a reference to this mode
*/
@@ -93,170 +102,155 @@ RRModeCreate (xRRModeInfo *modeInfo,
}
static RRModePtr
-RRModeFindByName (const char *name,
- CARD16 nameLength)
+RRModeFindByName(const char *name, CARD16 nameLength)
{
- int i;
- RRModePtr mode;
-
- for (i = 0; i < num_modes; i++)
- {
- mode = modes[i];
- if (mode->mode.nameLength == nameLength &&
- !memcmp (name, mode->name, nameLength))
- {
- return mode;
- }
+ int i;
+ RRModePtr mode;
+
+ for (i = 0; i < num_modes; i++) {
+ mode = modes[i];
+ if (mode->mode.nameLength == nameLength &&
+ !memcmp(name, mode->name, nameLength)) {
+ return mode;
+ }
}
return NULL;
}
RRModePtr
-RRModeGet (xRRModeInfo *modeInfo,
- const char *name)
+RRModeGet(xRRModeInfo * modeInfo, const char *name)
{
- int i;
-
- for (i = 0; i < num_modes; i++)
- {
- RRModePtr mode = modes[i];
- if (RRModeEqual (&mode->mode, modeInfo) &&
- !memcmp (name, mode->name, modeInfo->nameLength))
- {
- ++mode->refcnt;
- return mode;
- }
+ int i;
+
+ for (i = 0; i < num_modes; i++) {
+ RRModePtr mode = modes[i];
+
+ if (RRModeEqual(&mode->mode, modeInfo) &&
+ !memcmp(name, mode->name, modeInfo->nameLength)) {
+ ++mode->refcnt;
+ return mode;
+ }
}
- return RRModeCreate (modeInfo, name, NULL);
+ return RRModeCreate(modeInfo, name, NULL);
}
static RRModePtr
-RRModeCreateUser (ScreenPtr pScreen,
- xRRModeInfo *modeInfo,
- const char *name,
- int *error)
+RRModeCreateUser(ScreenPtr pScreen,
+ xRRModeInfo * modeInfo, const char *name, int *error)
{
- RRModePtr mode;
+ RRModePtr mode;
- mode = RRModeFindByName (name, modeInfo->nameLength);
- if (mode)
- {
- *error = BadName;
- return NULL;
+ mode = RRModeFindByName(name, modeInfo->nameLength);
+ if (mode) {
+ *error = BadName;
+ return NULL;
}
-
- mode = RRModeCreate (modeInfo, name, pScreen);
- if (!mode)
- {
- *error = BadAlloc;
- return NULL;
+
+ mode = RRModeCreate(modeInfo, name, pScreen);
+ if (!mode) {
+ *error = BadAlloc;
+ return NULL;
}
*error = Success;
return mode;
}
RRModePtr *
-RRModesForScreen (ScreenPtr pScreen, int *num_ret)
+RRModesForScreen(ScreenPtr pScreen, int *num_ret)
{
rrScrPriv(pScreen);
- int o, c, m;
- RRModePtr *screen_modes;
- int num_screen_modes = 0;
+ int o, c, m;
+ RRModePtr *screen_modes;
+ int num_screen_modes = 0;
- screen_modes = malloc((num_modes ? num_modes : 1) * sizeof (RRModePtr));
+ screen_modes = malloc((num_modes ? num_modes : 1) * sizeof(RRModePtr));
if (!screen_modes)
- return NULL;
-
+ return NULL;
+
/*
* Add modes from all outputs
*/
- for (o = 0; o < pScrPriv->numOutputs; o++)
- {
- RROutputPtr output = pScrPriv->outputs[o];
- int m, n;
-
- for (m = 0; m < output->numModes + output->numUserModes; m++)
- {
- RRModePtr mode = (m < output->numModes ?
- output->modes[m] :
- output->userModes[m-output->numModes]);
- for (n = 0; n < num_screen_modes; n++)
- if (screen_modes[n] == mode)
- break;
- if (n == num_screen_modes)
- screen_modes[num_screen_modes++] = mode;
- }
+ for (o = 0; o < pScrPriv->numOutputs; o++) {
+ RROutputPtr output = pScrPriv->outputs[o];
+ int m, n;
+
+ for (m = 0; m < output->numModes + output->numUserModes; m++) {
+ RRModePtr mode = (m < output->numModes ?
+ output->modes[m] :
+ output->userModes[m - output->numModes]);
+ for (n = 0; n < num_screen_modes; n++)
+ if (screen_modes[n] == mode)
+ break;
+ if (n == num_screen_modes)
+ screen_modes[num_screen_modes++] = mode;
+ }
}
/*
* Add modes from all crtcs. The goal is to
* make sure all available and active modes
* are visible to the client
*/
- for (c = 0; c < pScrPriv->numCrtcs; c++)
- {
- RRCrtcPtr crtc = pScrPriv->crtcs[c];
- RRModePtr mode = crtc->mode;
- int n;
-
- if (!mode) continue;
- for (n = 0; n < num_screen_modes; n++)
- if (screen_modes[n] == mode)
- break;
- if (n == num_screen_modes)
- screen_modes[num_screen_modes++] = mode;
+ for (c = 0; c < pScrPriv->numCrtcs; c++) {
+ RRCrtcPtr crtc = pScrPriv->crtcs[c];
+ RRModePtr mode = crtc->mode;
+ int n;
+
+ if (!mode)
+ continue;
+ for (n = 0; n < num_screen_modes; n++)
+ if (screen_modes[n] == mode)
+ break;
+ if (n == num_screen_modes)
+ screen_modes[num_screen_modes++] = mode;
}
/*
* Add all user modes for this screen
*/
- for (m = 0; m < num_modes; m++)
- {
- RRModePtr mode = modes[m];
- int n;
-
- if (mode->userScreen != pScreen)
- continue;
- for (n = 0; n < num_screen_modes; n++)
- if (screen_modes[n] == mode)
- break;
- if (n == num_screen_modes)
- screen_modes[num_screen_modes++] = mode;
+ for (m = 0; m < num_modes; m++) {
+ RRModePtr mode = modes[m];
+ int n;
+
+ if (mode->userScreen != pScreen)
+ continue;
+ for (n = 0; n < num_screen_modes; n++)
+ if (screen_modes[n] == mode)
+ break;
+ if (n == num_screen_modes)
+ screen_modes[num_screen_modes++] = mode;
}
-
+
*num_ret = num_screen_modes;
return screen_modes;
}
void
-RRModeDestroy (RRModePtr mode)
+RRModeDestroy(RRModePtr mode)
{
- int m;
-
+ int m;
+
if (--mode->refcnt > 0)
- return;
- for (m = 0; m < num_modes; m++)
- {
- if (modes[m] == mode)
- {
- memmove (modes + m, modes + m + 1,
- (num_modes - m - 1) * sizeof (RRModePtr));
- num_modes--;
- if (!num_modes)
- {
- free(modes);
- modes = NULL;
- }
- break;
- }
+ return;
+ for (m = 0; m < num_modes; m++) {
+ if (modes[m] == mode) {
+ memmove(modes + m, modes + m + 1,
+ (num_modes - m - 1) * sizeof(RRModePtr));
+ num_modes--;
+ if (!num_modes) {
+ free(modes);
+ modes = NULL;
+ }
+ break;
+ }
}
-
+
free(mode);
}
static int
-RRModeDestroyResource (pointer value, XID pid)
+RRModeDestroyResource(pointer value, XID pid)
{
- RRModeDestroy ((RRModePtr) value);
+ RRModeDestroy((RRModePtr) value);
return 1;
}
@@ -264,14 +258,14 @@ RRModeDestroyResource (pointer value, XID pid)
* Initialize mode type
*/
Bool
-RRModeInit (void)
+RRModeInit(void)
{
- assert (num_modes == 0);
- assert (modes == NULL);
- RRModeType = CreateNewResourceType (RRModeDestroyResource, "MODE");
+ assert(num_modes == 0);
+ assert(modes == NULL);
+ RRModeType = CreateNewResourceType(RRModeDestroyResource, "MODE");
if (!RRModeType)
- return FALSE;
-
+ return FALSE;
+
return TRUE;
}
@@ -285,97 +279,96 @@ RRModeInitErrorValue(void)
}
int
-ProcRRCreateMode (ClientPtr client)
+ProcRRCreateMode(ClientPtr client)
{
REQUEST(xRRCreateModeReq);
- xRRCreateModeReply rep = {0};
- WindowPtr pWin;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- xRRModeInfo *modeInfo;
- long units_after;
- char *name;
- int error, rc;
- RRModePtr mode;
-
- REQUEST_AT_LEAST_SIZE (xRRCreateModeReq);
+ xRRCreateModeReply rep = { 0 };
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ xRRModeInfo *modeInfo;
+ long units_after;
+ char *name;
+ int error, rc;
+ RRModePtr mode;
+
+ REQUEST_AT_LEAST_SIZE(xRRCreateModeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
-
+
modeInfo = &stuff->modeInfo;
name = (char *) (stuff + 1);
- units_after = (stuff->length - bytes_to_int32(sizeof (xRRCreateModeReq)));
+ units_after = (stuff->length - bytes_to_int32(sizeof(xRRCreateModeReq)));
/* check to make sure requested name fits within the data provided */
if (bytes_to_int32(modeInfo->nameLength) > units_after)
- return BadLength;
+ return BadLength;
- mode = RRModeCreateUser (pScreen, modeInfo, name, &error);
+ mode = RRModeCreateUser(pScreen, modeInfo, name, &error);
if (!mode)
- return error;
+ return error;
rep.type = X_Reply;
rep.pad0 = 0;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.mode = mode->mode.id;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.mode);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.mode);
}
- WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep);
+ WriteToClient(client, sizeof(xRRCreateModeReply), (char *) &rep);
/* Drop out reference to this mode */
- RRModeDestroy (mode);
+ RRModeDestroy(mode);
return Success;
}
int
-ProcRRDestroyMode (ClientPtr client)
+ProcRRDestroyMode(ClientPtr client)
{
REQUEST(xRRDestroyModeReq);
- RRModePtr mode;
-
+ RRModePtr mode;
+
REQUEST_SIZE_MATCH(xRRDestroyModeReq);
VERIFY_RR_MODE(stuff->mode, mode, DixDestroyAccess);
if (!mode->userScreen)
- return BadMatch;
+ return BadMatch;
if (mode->refcnt > 1)
- return BadAccess;
- FreeResource (stuff->mode, 0);
+ return BadAccess;
+ FreeResource(stuff->mode, 0);
return Success;
}
int
-ProcRRAddOutputMode (ClientPtr client)
+ProcRRAddOutputMode(ClientPtr client)
{
REQUEST(xRRAddOutputModeReq);
- RRModePtr mode;
- RROutputPtr output;
-
+ RRModePtr mode;
+ RROutputPtr output;
+
REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess);
-
- return RROutputAddUserMode (output, mode);
+
+ return RROutputAddUserMode(output, mode);
}
int
-ProcRRDeleteOutputMode (ClientPtr client)
+ProcRRDeleteOutputMode(ClientPtr client)
{
REQUEST(xRRDeleteOutputModeReq);
- RRModePtr mode;
- RROutputPtr output;
-
+ RRModePtr mode;
+ RROutputPtr output;
+
REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess);
-
- return RROutputDeleteUserMode (output, mode);
+
+ return RROutputDeleteUserMode(output, mode);
}
diff --git a/xorg-server/randr/rroutput.c b/xorg-server/randr/rroutput.c
index b57be198f..0890c55b5 100644
--- a/xorg-server/randr/rroutput.c
+++ b/xorg-server/randr/rroutput.c
@@ -23,23 +23,22 @@
#include "randrstr.h"
-RESTYPE RROutputType;
+RESTYPE RROutputType;
/*
* Notify the output of some change
*/
void
-RROutputChanged (RROutputPtr output, Bool configChanged)
+RROutputChanged(RROutputPtr output, Bool configChanged)
{
- ScreenPtr pScreen = output->pScreen;
-
+ ScreenPtr pScreen = output->pScreen;
+
output->changed = TRUE;
- if (pScreen)
- {
- rrScrPriv (pScreen);
- pScrPriv->changed = TRUE;
- if (configChanged)
- pScrPriv->configChanged = TRUE;
+ if (pScreen) {
+ rrScrPriv(pScreen);
+ pScrPriv->changed = TRUE;
+ if (configChanged)
+ pScrPriv->configChanged = TRUE;
}
}
@@ -48,38 +47,36 @@ RROutputChanged (RROutputPtr output, Bool configChanged)
*/
RROutputPtr
-RROutputCreate (ScreenPtr pScreen,
- const char *name,
- int nameLength,
- void *devPrivate)
+RROutputCreate(ScreenPtr pScreen,
+ const char *name, int nameLength, void *devPrivate)
{
- RROutputPtr output;
- RROutputPtr *outputs;
- rrScrPrivPtr pScrPriv;
+ RROutputPtr output;
+ RROutputPtr *outputs;
+ rrScrPrivPtr pScrPriv;
if (!RRInit())
- return NULL;
-
+ return NULL;
+
pScrPriv = rrGetScrPriv(pScreen);
if (pScrPriv->numOutputs)
- outputs = realloc(pScrPriv->outputs,
- (pScrPriv->numOutputs + 1) * sizeof (RROutputPtr));
+ outputs = realloc(pScrPriv->outputs,
+ (pScrPriv->numOutputs + 1) * sizeof(RROutputPtr));
else
- outputs = malloc(sizeof (RROutputPtr));
+ outputs = malloc(sizeof(RROutputPtr));
if (!outputs)
- return FALSE;
+ return FALSE;
pScrPriv->outputs = outputs;
-
- output = malloc(sizeof (RROutputRec) + nameLength + 1);
+
+ output = malloc(sizeof(RROutputRec) + nameLength + 1);
if (!output)
- return NULL;
- output->id = FakeClientID (0);
+ return NULL;
+ output->id = FakeClientID(0);
output->pScreen = pScreen;
output->name = (char *) (output + 1);
output->nameLength = nameLength;
- memcpy (output->name, name, nameLength);
+ memcpy(output->name, name, nameLength);
output->name[nameLength] = '\0';
output->connection = RR_UnknownConnection;
output->subpixelOrder = SubPixelUnknown;
@@ -99,9 +96,9 @@ RROutputCreate (ScreenPtr pScreen,
output->pendingProperties = FALSE;
output->changed = FALSE;
output->devPrivate = devPrivate;
-
- if (!AddResource (output->id, RROutputType, (pointer) output))
- return NULL;
+
+ if (!AddResource(output->id, RROutputType, (pointer) output))
+ return NULL;
pScrPriv->outputs[pScrPriv->numOutputs++] = output;
return output;
@@ -111,300 +108,273 @@ RROutputCreate (ScreenPtr pScreen,
* Notify extension that output parameters have been changed
*/
Bool
-RROutputSetClones (RROutputPtr output,
- RROutputPtr *clones,
- int numClones)
+RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones)
{
- RROutputPtr *newClones;
- int i;
-
- if (numClones == output->numClones)
- {
- for (i = 0; i < numClones; i++)
- if (output->clones[i] != clones[i])
- break;
- if (i == numClones)
- return TRUE;
+ RROutputPtr *newClones;
+ int i;
+
+ if (numClones == output->numClones) {
+ for (i = 0; i < numClones; i++)
+ if (output->clones[i] != clones[i])
+ break;
+ if (i == numClones)
+ return TRUE;
}
- if (numClones)
- {
- newClones = malloc(numClones * sizeof (RROutputPtr));
- if (!newClones)
- return FALSE;
+ if (numClones) {
+ newClones = malloc(numClones * sizeof(RROutputPtr));
+ if (!newClones)
+ return FALSE;
}
else
- newClones = NULL;
+ newClones = NULL;
free(output->clones);
- memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
+ memcpy(newClones, clones, numClones * sizeof(RROutputPtr));
output->clones = newClones;
output->numClones = numClones;
- RROutputChanged (output, TRUE);
+ RROutputChanged(output, TRUE);
return TRUE;
}
Bool
-RROutputSetModes (RROutputPtr output,
- RRModePtr *modes,
- int numModes,
- int numPreferred)
+RROutputSetModes(RROutputPtr output,
+ RRModePtr * modes, int numModes, int numPreferred)
{
- RRModePtr *newModes;
- int i;
-
- if (numModes == output->numModes && numPreferred == output->numPreferred)
- {
- for (i = 0; i < numModes; i++)
- if (output->modes[i] != modes[i])
- break;
- if (i == numModes)
- {
- for (i = 0; i < numModes; i++)
- RRModeDestroy (modes[i]);
- return TRUE;
- }
+ RRModePtr *newModes;
+ int i;
+
+ if (numModes == output->numModes && numPreferred == output->numPreferred) {
+ for (i = 0; i < numModes; i++)
+ if (output->modes[i] != modes[i])
+ break;
+ if (i == numModes) {
+ for (i = 0; i < numModes; i++)
+ RRModeDestroy(modes[i]);
+ return TRUE;
+ }
}
- if (numModes)
- {
- newModes = malloc(numModes * sizeof (RRModePtr));
- if (!newModes)
- return FALSE;
+ if (numModes) {
+ newModes = malloc(numModes * sizeof(RRModePtr));
+ if (!newModes)
+ return FALSE;
}
else
- newModes = NULL;
- if (output->modes)
- {
- for (i = 0; i < output->numModes; i++)
- RRModeDestroy (output->modes[i]);
- free(output->modes);
+ newModes = NULL;
+ if (output->modes) {
+ for (i = 0; i < output->numModes; i++)
+ RRModeDestroy(output->modes[i]);
+ free(output->modes);
}
- memcpy (newModes, modes, numModes * sizeof (RRModePtr));
+ memcpy(newModes, modes, numModes * sizeof(RRModePtr));
output->modes = newModes;
output->numModes = numModes;
output->numPreferred = numPreferred;
- RROutputChanged (output, TRUE);
+ RROutputChanged(output, TRUE);
return TRUE;
}
int
-RROutputAddUserMode (RROutputPtr output,
- RRModePtr mode)
+RROutputAddUserMode(RROutputPtr output, RRModePtr mode)
{
- int m;
- ScreenPtr pScreen = output->pScreen;
+ int m;
+ ScreenPtr pScreen = output->pScreen;
+
rrScrPriv(pScreen);
- RRModePtr *newModes;
+ RRModePtr *newModes;
/* Check to see if this mode is already listed for this output */
- for (m = 0; m < output->numModes + output->numUserModes; m++)
- {
- RRModePtr e = (m < output->numModes ?
- output->modes[m] :
- output->userModes[m - output->numModes]);
- if (mode == e)
- return Success;
+ for (m = 0; m < output->numModes + output->numUserModes; m++) {
+ RRModePtr e = (m < output->numModes ?
+ output->modes[m] :
+ output->userModes[m - output->numModes]);
+ if (mode == e)
+ return Success;
}
/* Check with the DDX to see if this mode is OK */
if (pScrPriv->rrOutputValidateMode)
- if (!pScrPriv->rrOutputValidateMode (pScreen, output, mode))
- return BadMatch;
+ if (!pScrPriv->rrOutputValidateMode(pScreen, output, mode))
+ return BadMatch;
if (output->userModes)
- newModes = realloc(output->userModes,
- (output->numUserModes + 1) * sizeof (RRModePtr));
+ newModes = realloc(output->userModes,
+ (output->numUserModes + 1) * sizeof(RRModePtr));
else
- newModes = malloc(sizeof (RRModePtr));
+ newModes = malloc(sizeof(RRModePtr));
if (!newModes)
- return BadAlloc;
+ return BadAlloc;
output->userModes = newModes;
output->userModes[output->numUserModes++] = mode;
++mode->refcnt;
- RROutputChanged (output, TRUE);
- RRTellChanged (pScreen);
+ RROutputChanged(output, TRUE);
+ RRTellChanged(pScreen);
return Success;
}
int
-RROutputDeleteUserMode (RROutputPtr output,
- RRModePtr mode)
+RROutputDeleteUserMode(RROutputPtr output, RRModePtr mode)
{
- int m;
-
+ int m;
+
/* Find this mode in the user mode list */
- for (m = 0; m < output->numUserModes; m++)
- {
- RRModePtr e = output->userModes[m];
+ for (m = 0; m < output->numUserModes; m++) {
+ RRModePtr e = output->userModes[m];
- if (mode == e)
- break;
+ if (mode == e)
+ break;
}
/* Not there, access error */
if (m == output->numUserModes)
- return BadAccess;
+ return BadAccess;
/* make sure the mode isn't active for this output */
if (output->crtc && output->crtc->mode == mode)
- return BadMatch;
+ return BadMatch;
- memmove (output->userModes + m, output->userModes + m + 1,
- (output->numUserModes - m - 1) * sizeof (RRModePtr));
+ memmove(output->userModes + m, output->userModes + m + 1,
+ (output->numUserModes - m - 1) * sizeof(RRModePtr));
output->numUserModes--;
- RRModeDestroy (mode);
+ RRModeDestroy(mode);
return Success;
}
Bool
-RROutputSetCrtcs (RROutputPtr output,
- RRCrtcPtr *crtcs,
- int numCrtcs)
+RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs)
{
- RRCrtcPtr *newCrtcs;
- int i;
-
- if (numCrtcs == output->numCrtcs)
- {
- for (i = 0; i < numCrtcs; i++)
- if (output->crtcs[i] != crtcs[i])
- break;
- if (i == numCrtcs)
- return TRUE;
+ RRCrtcPtr *newCrtcs;
+ int i;
+
+ if (numCrtcs == output->numCrtcs) {
+ for (i = 0; i < numCrtcs; i++)
+ if (output->crtcs[i] != crtcs[i])
+ break;
+ if (i == numCrtcs)
+ return TRUE;
}
- if (numCrtcs)
- {
- newCrtcs = malloc(numCrtcs * sizeof (RRCrtcPtr));
- if (!newCrtcs)
- return FALSE;
+ if (numCrtcs) {
+ newCrtcs = malloc(numCrtcs * sizeof(RRCrtcPtr));
+ if (!newCrtcs)
+ return FALSE;
}
else
- newCrtcs = NULL;
+ newCrtcs = NULL;
free(output->crtcs);
- memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
+ memcpy(newCrtcs, crtcs, numCrtcs * sizeof(RRCrtcPtr));
output->crtcs = newCrtcs;
output->numCrtcs = numCrtcs;
- RROutputChanged (output, TRUE);
+ RROutputChanged(output, TRUE);
return TRUE;
}
Bool
-RROutputSetConnection (RROutputPtr output,
- CARD8 connection)
+RROutputSetConnection(RROutputPtr output, CARD8 connection)
{
if (output->connection == connection)
- return TRUE;
+ return TRUE;
output->connection = connection;
- RROutputChanged (output, TRUE);
+ RROutputChanged(output, TRUE);
return TRUE;
}
Bool
-RROutputSetSubpixelOrder (RROutputPtr output,
- int subpixelOrder)
+RROutputSetSubpixelOrder(RROutputPtr output, int subpixelOrder)
{
if (output->subpixelOrder == subpixelOrder)
- return TRUE;
+ return TRUE;
output->subpixelOrder = subpixelOrder;
- RROutputChanged (output, FALSE);
+ RROutputChanged(output, FALSE);
return TRUE;
}
Bool
-RROutputSetPhysicalSize (RROutputPtr output,
- int mmWidth,
- int mmHeight)
+RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight)
{
if (output->mmWidth == mmWidth && output->mmHeight == mmHeight)
- return TRUE;
+ return TRUE;
output->mmWidth = mmWidth;
output->mmHeight = mmHeight;
- RROutputChanged (output, FALSE);
+ RROutputChanged(output, FALSE);
return TRUE;
}
-
void
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- rrScrPriv (pScreen);
- xRROutputChangeNotifyEvent oe;
- RRCrtcPtr crtc = output->crtc;
- RRModePtr mode = crtc ? crtc->mode : 0;
-
+
+ rrScrPriv(pScreen);
+ xRROutputChangeNotifyEvent oe;
+ RRCrtcPtr crtc = output->crtc;
+ RRModePtr mode = crtc ? crtc->mode : 0;
+
oe.type = RRNotify + RREventBase;
oe.subCode = RRNotify_OutputChange;
oe.timestamp = pScrPriv->lastSetTime.milliseconds;
oe.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
oe.window = pWin->drawable.id;
oe.output = output->id;
- if (crtc)
- {
- oe.crtc = crtc->id;
- oe.mode = mode ? mode->mode.id : None;
- oe.rotation = crtc->rotation;
+ if (crtc) {
+ oe.crtc = crtc->id;
+ oe.mode = mode ? mode->mode.id : None;
+ oe.rotation = crtc->rotation;
}
- else
- {
- oe.crtc = None;
- oe.mode = None;
- oe.rotation = RR_Rotate_0;
+ else {
+ oe.crtc = None;
+ oe.mode = None;
+ oe.rotation = RR_Rotate_0;
}
oe.connection = output->connection;
oe.subpixelOrder = output->subpixelOrder;
- WriteEventsToClient (client, 1, (xEvent *) &oe);
+ WriteEventsToClient(client, 1, (xEvent *) &oe);
}
/*
* Destroy a Output at shutdown
*/
void
-RROutputDestroy (RROutputPtr output)
+RROutputDestroy(RROutputPtr output)
{
- FreeResource (output->id, 0);
+ FreeResource(output->id, 0);
}
static int
-RROutputDestroyResource (pointer value, XID pid)
+RROutputDestroyResource(pointer value, XID pid)
{
- RROutputPtr output = (RROutputPtr) value;
- ScreenPtr pScreen = output->pScreen;
- int m;
-
- if (pScreen)
- {
- rrScrPriv(pScreen);
- int i;
-
- if (pScrPriv->primaryOutput == output)
- pScrPriv->primaryOutput = NULL;
-
- for (i = 0; i < pScrPriv->numOutputs; i++)
- {
- if (pScrPriv->outputs[i] == output)
- {
- memmove (pScrPriv->outputs + i, pScrPriv->outputs + i + 1,
- (pScrPriv->numOutputs - (i + 1)) * sizeof (RROutputPtr));
- --pScrPriv->numOutputs;
- break;
- }
- }
+ RROutputPtr output = (RROutputPtr) value;
+ ScreenPtr pScreen = output->pScreen;
+ int m;
+
+ if (pScreen) {
+ rrScrPriv(pScreen);
+ int i;
+
+ if (pScrPriv->primaryOutput == output)
+ pScrPriv->primaryOutput = NULL;
+
+ for (i = 0; i < pScrPriv->numOutputs; i++) {
+ if (pScrPriv->outputs[i] == output) {
+ memmove(pScrPriv->outputs + i, pScrPriv->outputs + i + 1,
+ (pScrPriv->numOutputs - (i + 1)) * sizeof(RROutputPtr));
+ --pScrPriv->numOutputs;
+ break;
+ }
+ }
}
- if (output->modes)
- {
- for (m = 0; m < output->numModes; m++)
- RRModeDestroy (output->modes[m]);
- free(output->modes);
+ if (output->modes) {
+ for (m = 0; m < output->numModes; m++)
+ RRModeDestroy(output->modes[m]);
+ free(output->modes);
}
-
+
for (m = 0; m < output->numUserModes; m++)
- RRModeDestroy (output->userModes[m]);
+ RRModeDestroy(output->userModes[m]);
free(output->userModes);
free(output->crtcs);
free(output->clones);
- RRDeleteAllOutputProperties (output);
+ RRDeleteAllOutputProperties(output);
free(output);
return 1;
}
@@ -413,11 +383,11 @@ RROutputDestroyResource (pointer value, XID pid)
* Initialize output type
*/
Bool
-RROutputInit (void)
+RROutputInit(void)
{
- RROutputType = CreateNewResourceType (RROutputDestroyResource, "OUTPUT");
+ RROutputType = CreateNewResourceType(RROutputDestroyResource, "OUTPUT");
if (!RROutputType)
- return FALSE;
+ return FALSE;
return TRUE;
}
@@ -434,21 +404,21 @@ RROutputInitErrorValue(void)
#define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32)
int
-ProcRRGetOutputInfo (ClientPtr client)
+ProcRRGetOutputInfo(ClientPtr client)
{
REQUEST(xRRGetOutputInfoReq);
- xRRGetOutputInfoReply rep;
- RROutputPtr output;
- CARD8 *extra;
- unsigned long extraLen;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- RRCrtc *crtcs;
- RRMode *modes;
- RROutput *clones;
- char *name;
- int i;
-
+ xRRGetOutputInfoReply rep;
+ RROutputPtr output;
+ CARD8 *extra;
+ unsigned long extraLen;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ RRCrtc *crtcs;
+ RRMode *modes;
+ RROutput *clones;
+ char *name;
+ int i;
+
REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
@@ -469,88 +439,81 @@ ProcRRGetOutputInfo (ClientPtr client)
rep.nPreferred = output->numPreferred;
rep.nClones = output->numClones;
rep.nameLength = output->nameLength;
-
+
extraLen = ((output->numCrtcs +
- output->numModes + output->numUserModes +
- output->numClones +
- bytes_to_int32(rep.nameLength)) << 2);
-
- if (extraLen)
- {
- rep.length += bytes_to_int32(extraLen);
- extra = malloc(extraLen);
- if (!extra)
- return BadAlloc;
+ output->numModes + output->numUserModes +
+ output->numClones + bytes_to_int32(rep.nameLength)) << 2);
+
+ if (extraLen) {
+ rep.length += bytes_to_int32(extraLen);
+ extra = malloc(extraLen);
+ if (!extra)
+ return BadAlloc;
}
else
- extra = NULL;
+ extra = NULL;
crtcs = (RRCrtc *) extra;
modes = (RRMode *) (crtcs + output->numCrtcs);
clones = (RROutput *) (modes + output->numModes + output->numUserModes);
name = (char *) (clones + output->numClones);
-
- for (i = 0; i < output->numCrtcs; i++)
- {
- crtcs[i] = output->crtcs[i]->id;
- if (client->swapped)
- swapl(&crtcs[i]);
+
+ for (i = 0; i < output->numCrtcs; i++) {
+ crtcs[i] = output->crtcs[i]->id;
+ if (client->swapped)
+ swapl(&crtcs[i]);
}
- for (i = 0; i < output->numModes + output->numUserModes; i++)
- {
- if (i < output->numModes)
- modes[i] = output->modes[i]->mode.id;
- else
- modes[i] = output->userModes[i - output->numModes]->mode.id;
- if (client->swapped)
- swapl(&modes[i]);
+ for (i = 0; i < output->numModes + output->numUserModes; i++) {
+ if (i < output->numModes)
+ modes[i] = output->modes[i]->mode.id;
+ else
+ modes[i] = output->userModes[i - output->numModes]->mode.id;
+ if (client->swapped)
+ swapl(&modes[i]);
}
- for (i = 0; i < output->numClones; i++)
- {
- clones[i] = output->clones[i]->id;
- if (client->swapped)
- swapl(&clones[i]);
+ for (i = 0; i < output->numClones; i++) {
+ clones[i] = output->clones[i]->id;
+ if (client->swapped)
+ swapl(&clones[i]);
}
- memcpy (name, output->name, output->nameLength);
+ memcpy(name, output->name, output->nameLength);
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.timestamp);
- swapl(&rep.crtc);
- swapl(&rep.mmWidth);
- swapl(&rep.mmHeight);
- swaps(&rep.nCrtcs);
- swaps(&rep.nModes);
- swaps(&rep.nClones);
- swaps(&rep.nameLength);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.timestamp);
+ swapl(&rep.crtc);
+ swapl(&rep.mmWidth);
+ swapl(&rep.mmHeight);
+ swaps(&rep.nCrtcs);
+ swaps(&rep.nModes);
+ swaps(&rep.nClones);
+ swaps(&rep.nameLength);
}
- WriteToClient(client, sizeof(xRRGetOutputInfoReply), (char *)&rep);
- if (extraLen)
- {
- WriteToClient (client, extraLen, (char *) extra);
- free(extra);
+ WriteToClient(client, sizeof(xRRGetOutputInfoReply), (char *) &rep);
+ if (extraLen) {
+ WriteToClient(client, extraLen, (char *) extra);
+ free(extra);
}
-
+
return Success;
}
static void
-RRSetPrimaryOutput(ScreenPtr pScreen, rrScrPrivPtr pScrPriv,
- RROutputPtr output)
+RRSetPrimaryOutput(ScreenPtr pScreen, rrScrPrivPtr pScrPriv, RROutputPtr output)
{
if (pScrPriv->primaryOutput == output)
- return;
+ return;
/* clear the old primary */
if (pScrPriv->primaryOutput) {
- RROutputChanged(pScrPriv->primaryOutput, 0);
- pScrPriv->primaryOutput = NULL;
+ RROutputChanged(pScrPriv->primaryOutput, 0);
+ pScrPriv->primaryOutput = NULL;
}
/* set the new primary */
if (output) {
- pScrPriv->primaryOutput = output;
- RROutputChanged(output, 0);
+ pScrPriv->primaryOutput = output;
+ RROutputChanged(output, 0);
}
pScrPriv->layoutChanged = TRUE;
@@ -571,15 +534,15 @@ ProcRRSetOutputPrimary(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (stuff->output) {
- VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
- if (output->pScreen != pWin->drawable.pScreen) {
- client->errorValue = stuff->window;
- return BadMatch;
- }
+ if (output->pScreen != pWin->drawable.pScreen) {
+ client->errorValue = stuff->window;
+ return BadMatch;
+ }
}
pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
@@ -602,11 +565,11 @@ ProcRRGetOutputPrimary(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
if (pScrPriv)
- primary = pScrPriv->primaryOutput;
+ primary = pScrPriv->primaryOutput;
memset(&rep, 0, sizeof(rep));
rep.type = X_Reply;
@@ -614,8 +577,8 @@ ProcRRGetOutputPrimary(ClientPtr client)
rep.output = primary ? primary->id : None;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.output);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.output);
}
WriteToClient(client, sizeof(xRRGetOutputPrimaryReply), &rep);
diff --git a/xorg-server/randr/rrpointer.c b/xorg-server/randr/rrpointer.c
index 6b934c0c6..ec803e9d1 100644
--- a/xorg-server/randr/rrpointer.c
+++ b/xorg-server/randr/rrpointer.c
@@ -32,19 +32,19 @@
*/
static Bool
-RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y)
+RRCrtcContainsPosition(RRCrtcPtr crtc, int x, int y)
{
- RRModePtr mode = crtc->mode;
- int scan_width, scan_height;
+ RRModePtr mode = crtc->mode;
+ int scan_width, scan_height;
if (!mode)
- return FALSE;
+ return FALSE;
- RRCrtcGetScanoutSize (crtc, &scan_width, &scan_height);
+ RRCrtcGetScanoutSize(crtc, &scan_width, &scan_height);
if (crtc->x <= x && x < crtc->x + scan_width &&
- crtc->y <= y && y < crtc->y + scan_height)
- return TRUE;
+ crtc->y <= y && y < crtc->y + scan_height)
+ return TRUE;
return FALSE;
}
@@ -52,81 +52,79 @@ RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y)
* Find the CRTC nearest the specified position, ignoring 'skip'
*/
static void
-RRPointerToNearestCrtc (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, RRCrtcPtr skip)
+RRPointerToNearestCrtc(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
+ RRCrtcPtr skip)
{
- rrScrPriv (pScreen);
- int c;
- RRCrtcPtr nearest = NULL;
- int best = 0;
- int best_dx = 0, best_dy = 0;
-
- for (c = 0; c < pScrPriv->numCrtcs; c++)
- {
- RRCrtcPtr crtc = pScrPriv->crtcs[c];
- RRModePtr mode = crtc->mode;
- int dx, dy;
- int dist;
- int scan_width, scan_height;
-
- if (!mode)
- continue;
- if (crtc == skip)
- continue;
-
- RRCrtcGetScanoutSize (crtc, &scan_width, &scan_height);
-
- if (x < crtc->x)
- dx = crtc->x - x;
- else if (x > crtc->x + scan_width)
- dx = x - (crtc->x + scan_width);
- else
- dx = 0;
- if (y < crtc->y)
- dy = crtc->y - x;
- else if (y > crtc->y + scan_height)
- dy = y - (crtc->y + scan_height);
- else
- dy = 0;
- dist = dx + dy;
- if (!nearest || dist < best)
- {
- nearest = crtc;
- best_dx = dx;
- best_dy = dy;
- }
+ rrScrPriv(pScreen);
+ int c;
+ RRCrtcPtr nearest = NULL;
+ int best = 0;
+ int best_dx = 0, best_dy = 0;
+
+ for (c = 0; c < pScrPriv->numCrtcs; c++) {
+ RRCrtcPtr crtc = pScrPriv->crtcs[c];
+ RRModePtr mode = crtc->mode;
+ int dx, dy;
+ int dist;
+ int scan_width, scan_height;
+
+ if (!mode)
+ continue;
+ if (crtc == skip)
+ continue;
+
+ RRCrtcGetScanoutSize(crtc, &scan_width, &scan_height);
+
+ if (x < crtc->x)
+ dx = crtc->x - x;
+ else if (x > crtc->x + scan_width)
+ dx = x - (crtc->x + scan_width);
+ else
+ dx = 0;
+ if (y < crtc->y)
+ dy = crtc->y - x;
+ else if (y > crtc->y + scan_height)
+ dy = y - (crtc->y + scan_height);
+ else
+ dy = 0;
+ dist = dx + dy;
+ if (!nearest || dist < best) {
+ nearest = crtc;
+ best_dx = dx;
+ best_dy = dy;
+ }
}
if (best_dx || best_dy)
- (*pScreen->SetCursorPosition) (pDev, pScreen, x + best_dx, y + best_dy, TRUE);
+ (*pScreen->SetCursorPosition) (pDev, pScreen, x + best_dx, y + best_dy,
+ TRUE);
pScrPriv->pointerCrtc = nearest;
}
void
-RRPointerMoved (ScreenPtr pScreen, int x, int y)
+RRPointerMoved(ScreenPtr pScreen, int x, int y)
{
- rrScrPriv (pScreen);
- RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc;
- int c;
+ rrScrPriv(pScreen);
+ RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc;
+ int c;
/* Check last known CRTC */
- if (pointerCrtc && RRCrtcContainsPosition (pointerCrtc, x, y))
- return;
-
+ if (pointerCrtc && RRCrtcContainsPosition(pointerCrtc, x, y))
+ return;
+
/* Check all CRTCs */
- for (c = 0; c < pScrPriv->numCrtcs; c++)
- {
- RRCrtcPtr crtc = pScrPriv->crtcs[c];
-
- if (RRCrtcContainsPosition (crtc, x, y))
- {
- /* Remember containing CRTC */
- pScrPriv->pointerCrtc = crtc;
- return;
- }
+ for (c = 0; c < pScrPriv->numCrtcs; c++) {
+ RRCrtcPtr crtc = pScrPriv->crtcs[c];
+
+ if (RRCrtcContainsPosition(crtc, x, y)) {
+ /* Remember containing CRTC */
+ pScrPriv->pointerCrtc = crtc;
+ return;
+ }
}
/* None contain pointer, find nearest */
ErrorF("RRPointerMoved: Untested, may cause \"bogus pointer event\"\n");
- RRPointerToNearestCrtc (inputInfo.pointer, pScreen, x, y, pointerCrtc);
+ RRPointerToNearestCrtc(inputInfo.pointer, pScreen, x, y, pointerCrtc);
}
/*
@@ -134,24 +132,21 @@ RRPointerMoved (ScreenPtr pScreen, int x, int y)
* CRTC
*/
void
-RRPointerScreenConfigured (ScreenPtr pScreen)
+RRPointerScreenConfigured(ScreenPtr pScreen)
{
- WindowPtr pRoot;
- ScreenPtr pCurrentScreen;
- int x, y;
+ WindowPtr pRoot;
+ ScreenPtr pCurrentScreen;
+ int x, y;
DeviceIntPtr pDev;
- for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
- {
- if (IsPointerDevice(pDev))
- {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if (IsPointerDevice(pDev)) {
pRoot = GetCurrentRootWindow(pDev);
pCurrentScreen = pRoot ? pRoot->drawable.pScreen : NULL;
- if (pScreen == pCurrentScreen)
- {
+ if (pScreen == pCurrentScreen) {
GetSpritePosition(pDev, &x, &y);
- RRPointerToNearestCrtc (pDev, pScreen, x, y, NULL);
+ RRPointerToNearestCrtc(pDev, pScreen, x, y, NULL);
}
}
}
diff --git a/xorg-server/randr/rrproperty.c b/xorg-server/randr/rrproperty.c
index d0a90203b..75948fccb 100644
--- a/xorg-server/randr/rrproperty.c
+++ b/xorg-server/randr/rrproperty.c
@@ -30,31 +30,31 @@ DeliverPropertyEvent(WindowPtr pWin, void *value)
xRROutputPropertyNotifyEvent *event = value;
RREventPtr *pHead, pRREvent;
- dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- RREventType, serverClient, DixReadAccess);
+ dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ RREventType, serverClient, DixReadAccess);
if (!pHead)
- return WT_WALKCHILDREN;
+ return WT_WALKCHILDREN;
- for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
- {
- if (!(pRREvent->mask & RROutputPropertyNotifyMask))
- continue;
+ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) {
+ if (!(pRREvent->mask & RROutputPropertyNotifyMask))
+ continue;
- event->window = pRREvent->window->drawable.id;
- WriteEventsToClient(pRREvent->client, 1, (xEvent *)event);
+ event->window = pRREvent->window->drawable.id;
+ WriteEventsToClient(pRREvent->client, 1, (xEvent *) event);
}
return WT_WALKCHILDREN;
}
-static void RRDeliverPropertyEvent(ScreenPtr pScreen, xEvent *event)
+static void
+RRDeliverPropertyEvent(ScreenPtr pScreen, xEvent *event)
{
if (!(dispatchException & (DE_RESET | DE_TERMINATE)))
- WalkTree(pScreen, DeliverPropertyEvent, event);
+ WalkTree(pScreen, DeliverPropertyEvent, event);
}
static void
-RRDestroyOutputProperty (RRPropertyPtr prop)
+RRDestroyOutputProperty(RRPropertyPtr prop)
{
free(prop->valid_values);
free(prop->current.data);
@@ -63,9 +63,10 @@ RRDestroyOutputProperty (RRPropertyPtr prop)
}
static void
-RRDeleteProperty(RROutputRec *output, RRPropertyRec *prop)
+RRDeleteProperty(RROutputRec * output, RRPropertyRec * prop)
{
xRROutputPropertyNotifyEvent event;
+
event.type = RREventBase + RRNotify;
event.subCode = RRNotify_OutputProperty;
event.output = output->id;
@@ -73,7 +74,7 @@ RRDeleteProperty(RROutputRec *output, RRPropertyRec *prop)
event.atom = prop->propertyName;
event.timestamp = currentTime.milliseconds;
- RRDeliverPropertyEvent(output->pScreen, (xEvent *)&event);
+ RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event);
RRDestroyOutputProperty(prop);
}
@@ -84,13 +85,13 @@ RRDeleteAllOutputProperties(RROutputPtr output)
RRPropertyPtr prop, next;
for (prop = output->properties; prop; prop = next) {
- next = prop->next;
+ next = prop->next;
RRDeleteProperty(output, prop);
}
}
static void
-RRInitOutputPropertyValue (RRPropertyValuePtr property_value)
+RRInitOutputPropertyValue(RRPropertyValuePtr property_value)
{
property_value->type = None;
property_value->format = 0;
@@ -99,13 +100,13 @@ RRInitOutputPropertyValue (RRPropertyValuePtr property_value)
}
static RRPropertyPtr
-RRCreateOutputProperty (Atom property)
+RRCreateOutputProperty(Atom property)
{
- RRPropertyPtr prop;
+ RRPropertyPtr prop;
- prop = (RRPropertyPtr)malloc(sizeof(RRPropertyRec));
+ prop = (RRPropertyPtr) malloc(sizeof(RRPropertyRec));
if (!prop)
- return NULL;
+ return NULL;
prop->next = NULL;
prop->propertyName = property;
prop->is_pending = FALSE;
@@ -113,8 +114,8 @@ RRCreateOutputProperty (Atom property)
prop->immutable = FALSE;
prop->num_valid = 0;
prop->valid_values = NULL;
- RRInitOutputPropertyValue (&prop->current);
- RRInitOutputPropertyValue (&prop->pending);
+ RRInitOutputPropertyValue(&prop->current);
+ RRInitOutputPropertyValue(&prop->pending);
return prop;
}
@@ -124,7 +125,7 @@ RRDeleteOutputProperty(RROutputPtr output, Atom property)
RRPropertyRec *prop, **prev;
for (prev = &output->properties; (prop = *prev); prev = &(prop->next))
- if (prop->propertyName == property) {
+ if (prop->propertyName == property) {
*prev = prop->next;
RRDeleteProperty(output, prop);
return;
@@ -132,240 +133,230 @@ RRDeleteOutputProperty(RROutputPtr output, Atom property)
}
int
-RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
- int format, int mode, unsigned long len,
- pointer value, Bool sendevent, Bool pending)
+RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
+ int format, int mode, unsigned long len,
+ pointer value, Bool sendevent, Bool pending)
{
- RRPropertyPtr prop;
- xRROutputPropertyNotifyEvent event;
- rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen);
- int size_in_bytes;
- int total_size;
- unsigned long total_len;
- RRPropertyValuePtr prop_value;
- RRPropertyValueRec new_value;
- Bool add = FALSE;
+ RRPropertyPtr prop;
+ xRROutputPropertyNotifyEvent event;
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen);
+ int size_in_bytes;
+ int total_size;
+ unsigned long total_len;
+ RRPropertyValuePtr prop_value;
+ RRPropertyValueRec new_value;
+ Bool add = FALSE;
size_in_bytes = format >> 3;
/* first see if property already exists */
- prop = RRQueryOutputProperty (output, property);
- if (!prop) /* just add to list */
- {
- prop = RRCreateOutputProperty (property);
- if (!prop)
- return BadAlloc;
- add = TRUE;
- mode = PropModeReplace;
+ prop = RRQueryOutputProperty(output, property);
+ if (!prop) { /* just add to list */
+ prop = RRCreateOutputProperty(property);
+ if (!prop)
+ return BadAlloc;
+ add = TRUE;
+ mode = PropModeReplace;
}
if (pending && prop->is_pending)
- prop_value = &prop->pending;
+ prop_value = &prop->pending;
else
- prop_value = &prop->current;
+ prop_value = &prop->current;
/* To append or prepend to a property the request format and type
- must match those of the already defined property. The
- existing format and type are irrelevant when using the mode
- "PropModeReplace" since they will be written over. */
+ must match those of the already defined property. The
+ existing format and type are irrelevant when using the mode
+ "PropModeReplace" since they will be written over. */
if ((format != prop_value->format) && (mode != PropModeReplace))
- return BadMatch;
+ return BadMatch;
if ((prop_value->type != type) && (mode != PropModeReplace))
- return BadMatch;
+ return BadMatch;
new_value = *prop_value;
if (mode == PropModeReplace)
- total_len = len;
+ total_len = len;
else
- total_len = prop_value->size + len;
-
- if (mode == PropModeReplace || len > 0)
- {
- pointer new_data = NULL, old_data = NULL;
-
- total_size = total_len * size_in_bytes;
- new_value.data = (pointer)malloc(total_size);
- if (!new_value.data && total_size)
- {
- if (add)
- RRDestroyOutputProperty (prop);
- return BadAlloc;
- }
- new_value.size = len;
- new_value.type = type;
- new_value.format = format;
-
- switch (mode) {
- case PropModeReplace:
- new_data = new_value.data;
- old_data = NULL;
- break;
- case PropModeAppend:
- new_data = (pointer) (((char *) new_value.data) +
- (prop_value->size * size_in_bytes));
- old_data = new_value.data;
- break;
- case PropModePrepend:
- new_data = new_value.data;
- old_data = (pointer) (((char *) new_value.data) +
- (prop_value->size * size_in_bytes));
- break;
- }
- if (new_data)
- memcpy ((char *) new_data, (char *) value, len * size_in_bytes);
- if (old_data)
- memcpy ((char *) old_data, (char *) prop_value->data,
- prop_value->size * size_in_bytes);
-
- if (pending && pScrPriv->rrOutputSetProperty &&
- !pScrPriv->rrOutputSetProperty(output->pScreen, output,
- prop->propertyName, &new_value))
- {
- free(new_value.data);
- return BadValue;
- }
- free(prop_value->data);
- *prop_value = new_value;
- }
-
- else if (len == 0)
- {
- /* do nothing */
- }
-
- if (add)
- {
- prop->next = output->properties;
- output->properties = prop;
+ total_len = prop_value->size + len;
+
+ if (mode == PropModeReplace || len > 0) {
+ pointer new_data = NULL, old_data = NULL;
+
+ total_size = total_len * size_in_bytes;
+ new_value.data = (pointer) malloc(total_size);
+ if (!new_value.data && total_size) {
+ if (add)
+ RRDestroyOutputProperty(prop);
+ return BadAlloc;
+ }
+ new_value.size = len;
+ new_value.type = type;
+ new_value.format = format;
+
+ switch (mode) {
+ case PropModeReplace:
+ new_data = new_value.data;
+ old_data = NULL;
+ break;
+ case PropModeAppend:
+ new_data = (pointer) (((char *) new_value.data) +
+ (prop_value->size * size_in_bytes));
+ old_data = new_value.data;
+ break;
+ case PropModePrepend:
+ new_data = new_value.data;
+ old_data = (pointer) (((char *) new_value.data) +
+ (prop_value->size * size_in_bytes));
+ break;
+ }
+ if (new_data)
+ memcpy((char *) new_data, (char *) value, len * size_in_bytes);
+ if (old_data)
+ memcpy((char *) old_data, (char *) prop_value->data,
+ prop_value->size * size_in_bytes);
+
+ if (pending && pScrPriv->rrOutputSetProperty &&
+ !pScrPriv->rrOutputSetProperty(output->pScreen, output,
+ prop->propertyName, &new_value)) {
+ free(new_value.data);
+ return BadValue;
+ }
+ free(prop_value->data);
+ *prop_value = new_value;
+ }
+
+ else if (len == 0) {
+ /* do nothing */
+ }
+
+ if (add) {
+ prop->next = output->properties;
+ output->properties = prop;
}
if (pending && prop->is_pending)
- output->pendingProperties = TRUE;
-
- if (sendevent)
- {
- event.type = RREventBase + RRNotify;
- event.subCode = RRNotify_OutputProperty;
- event.output = output->id;
- event.state = PropertyNewValue;
- event.atom = prop->propertyName;
- event.timestamp = currentTime.milliseconds;
- RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
+ output->pendingProperties = TRUE;
+
+ if (sendevent) {
+ event.type = RREventBase + RRNotify;
+ event.subCode = RRNotify_OutputProperty;
+ event.output = output->id;
+ event.state = PropertyNewValue;
+ event.atom = prop->propertyName;
+ event.timestamp = currentTime.milliseconds;
+ RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event);
}
return Success;
}
Bool
-RRPostPendingProperties (RROutputPtr output)
+RRPostPendingProperties(RROutputPtr output)
{
- RRPropertyValuePtr pending_value;
- RRPropertyValuePtr current_value;
- RRPropertyPtr property;
- Bool ret = TRUE;
+ RRPropertyValuePtr pending_value;
+ RRPropertyValuePtr current_value;
+ RRPropertyPtr property;
+ Bool ret = TRUE;
if (!output->pendingProperties)
- return TRUE;
-
+ return TRUE;
+
output->pendingProperties = FALSE;
- for (property = output->properties; property; property = property->next)
- {
- /* Skip non-pending properties */
- if (!property->is_pending)
- continue;
-
- pending_value = &property->pending;
- current_value = &property->current;
-
- /*
- * If the pending and current values are equal, don't mark it
- * as changed (which would deliver an event)
- */
- if (pending_value->type == current_value->type &&
- pending_value->format == current_value->format &&
- pending_value->size == current_value->size &&
- !memcmp (pending_value->data, current_value->data,
- pending_value->size * (pending_value->format / 8)))
- continue;
-
- if (RRChangeOutputProperty (output, property->propertyName,
- pending_value->type, pending_value->format,
- PropModeReplace, pending_value->size,
- pending_value->data, TRUE,
- FALSE) != Success)
- ret = FALSE;
+ for (property = output->properties; property; property = property->next) {
+ /* Skip non-pending properties */
+ if (!property->is_pending)
+ continue;
+
+ pending_value = &property->pending;
+ current_value = &property->current;
+
+ /*
+ * If the pending and current values are equal, don't mark it
+ * as changed (which would deliver an event)
+ */
+ if (pending_value->type == current_value->type &&
+ pending_value->format == current_value->format &&
+ pending_value->size == current_value->size &&
+ !memcmp(pending_value->data, current_value->data,
+ pending_value->size * (pending_value->format / 8)))
+ continue;
+
+ if (RRChangeOutputProperty(output, property->propertyName,
+ pending_value->type, pending_value->format,
+ PropModeReplace, pending_value->size,
+ pending_value->data, TRUE, FALSE) != Success)
+ ret = FALSE;
}
return ret;
}
RRPropertyPtr
-RRQueryOutputProperty (RROutputPtr output, Atom property)
+RRQueryOutputProperty(RROutputPtr output, Atom property)
{
- RRPropertyPtr prop;
-
+ RRPropertyPtr prop;
+
for (prop = output->properties; prop; prop = prop->next)
- if (prop->propertyName == property)
- return prop;
+ if (prop->propertyName == property)
+ return prop;
return NULL;
}
-
+
RRPropertyValuePtr
-RRGetOutputProperty (RROutputPtr output, Atom property, Bool pending)
+RRGetOutputProperty(RROutputPtr output, Atom property, Bool pending)
{
- RRPropertyPtr prop = RRQueryOutputProperty (output, property);
- rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen);
+ RRPropertyPtr prop = RRQueryOutputProperty(output, property);
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen);
if (!prop)
- return NULL;
+ return NULL;
if (pending && prop->is_pending)
- return &prop->pending;
+ return &prop->pending;
else {
#if RANDR_13_INTERFACE
- /* If we can, try to update the property value first */
- if (pScrPriv->rrOutputGetProperty)
- pScrPriv->rrOutputGetProperty(output->pScreen, output,
- prop->propertyName);
+ /* If we can, try to update the property value first */
+ if (pScrPriv->rrOutputGetProperty)
+ pScrPriv->rrOutputGetProperty(output->pScreen, output,
+ prop->propertyName);
#endif
- return &prop->current;
+ return &prop->current;
}
}
int
-RRConfigureOutputProperty (RROutputPtr output, Atom property,
- Bool pending, Bool range, Bool immutable,
- int num_values, INT32 *values)
+RRConfigureOutputProperty(RROutputPtr output, Atom property,
+ Bool pending, Bool range, Bool immutable,
+ int num_values, INT32 *values)
{
- RRPropertyPtr prop = RRQueryOutputProperty (output, property);
- Bool add = FALSE;
- INT32 *new_values;
+ RRPropertyPtr prop = RRQueryOutputProperty(output, property);
+ Bool add = FALSE;
+ INT32 *new_values;
+
+ if (!prop) {
+ prop = RRCreateOutputProperty(property);
+ if (!prop)
+ return BadAlloc;
+ add = TRUE;
+ }
+ else if (prop->immutable && !immutable)
+ return BadAccess;
- if (!prop)
- {
- prop = RRCreateOutputProperty (property);
- if (!prop)
- return BadAlloc;
- add = TRUE;
- } else if (prop->immutable && !immutable)
- return BadAccess;
-
/*
* ranges must have even number of values
*/
if (range && (num_values & 1))
- return BadMatch;
+ return BadMatch;
- new_values = malloc(num_values * sizeof (INT32));
+ new_values = malloc(num_values * sizeof(INT32));
if (!new_values && num_values)
- return BadAlloc;
+ return BadAlloc;
if (num_values)
- memcpy (new_values, values, num_values * sizeof (INT32));
-
+ memcpy(new_values, values, num_values * sizeof(INT32));
+
/*
* Property moving from pending to non-pending
* loses any pending values
*/
- if (prop->is_pending && !pending)
- {
- free(prop->pending.data);
- RRInitOutputPropertyValue (&prop->pending);
+ if (prop->is_pending && !pending) {
+ free(prop->pending.data);
+ RRInitOutputPropertyValue(&prop->pending);
}
prop->is_pending = pending;
@@ -376,51 +367,49 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
prop->valid_values = new_values;
if (add) {
- prop->next = output->properties;
- output->properties = prop;
+ prop->next = output->properties;
+ output->properties = prop;
}
return Success;
}
int
-ProcRRListOutputProperties (ClientPtr client)
+ProcRRListOutputProperties(ClientPtr client)
{
REQUEST(xRRListOutputPropertiesReq);
- Atom *pAtoms = NULL, *temppAtoms;
- xRRListOutputPropertiesReply rep;
- int numProps = 0;
- RROutputPtr output;
- RRPropertyPtr prop;
-
+ Atom *pAtoms = NULL, *temppAtoms;
+ xRRListOutputPropertiesReply rep;
+ int numProps = 0;
+ RROutputPtr output;
+ RRPropertyPtr prop;
+
REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
for (prop = output->properties; prop; prop = prop->next)
- numProps++;
+ numProps++;
if (numProps)
- if(!(pAtoms = (Atom *)malloc(numProps * sizeof(Atom))))
+ if (!(pAtoms = (Atom *) malloc(numProps * sizeof(Atom))))
return BadAlloc;
rep.type = X_Reply;
rep.length = bytes_to_int32(numProps * sizeof(Atom));
rep.sequenceNumber = client->sequence;
rep.nAtoms = numProps;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.nAtoms);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.nAtoms);
}
temppAtoms = pAtoms;
for (prop = output->properties; prop; prop = prop->next)
- *temppAtoms++ = prop->propertyName;
+ *temppAtoms++ = prop->propertyName;
- WriteToClient(client, sizeof(xRRListOutputPropertiesReply), (char*)&rep);
- if (numProps)
- {
- client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
+ WriteToClient(client, sizeof(xRRListOutputPropertiesReply), (char *) &rep);
+ if (numProps) {
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
free(pAtoms);
}
@@ -428,26 +417,26 @@ ProcRRListOutputProperties (ClientPtr client)
}
int
-ProcRRQueryOutputProperty (ClientPtr client)
+ProcRRQueryOutputProperty(ClientPtr client)
{
REQUEST(xRRQueryOutputPropertyReq);
- xRRQueryOutputPropertyReply rep;
- RROutputPtr output;
- RRPropertyPtr prop;
+ xRRQueryOutputPropertyReply rep;
+ RROutputPtr output;
+ RRPropertyPtr prop;
char *extra = NULL;
-
+
REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
-
- prop = RRQueryOutputProperty (output, stuff->property);
+
+ prop = RRQueryOutputProperty(output, stuff->property);
if (!prop)
- return BadName;
-
+ return BadName;
+
if (prop->num_valid) {
- extra = malloc(prop->num_valid * sizeof(INT32));
- if (!extra)
- return BadAlloc;
+ extra = malloc(prop->num_valid * sizeof(INT32));
+ if (!extra)
+ return BadAlloc;
}
rep.type = X_Reply;
rep.length = prop->num_valid;
@@ -455,124 +444,116 @@ ProcRRQueryOutputProperty (ClientPtr client)
rep.pending = prop->is_pending;
rep.range = prop->range;
rep.immutable = prop->immutable;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- }
- WriteToClient (client, sizeof (xRRQueryOutputPropertyReply), (char*)&rep);
- if (prop->num_valid)
- {
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ }
+ WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), (char *) &rep);
+ if (prop->num_valid) {
memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32));
- client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32),
- extra);
+ extra);
free(extra);
}
return Success;
}
int
-ProcRRConfigureOutputProperty (ClientPtr client)
+ProcRRConfigureOutputProperty(ClientPtr client)
{
REQUEST(xRRConfigureOutputPropertyReq);
- RROutputPtr output;
- int num_valid;
-
+ RROutputPtr output;
+ int num_valid;
+
REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq);
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
-
- num_valid = stuff->length - bytes_to_int32(sizeof (xRRConfigureOutputPropertyReq));
- return RRConfigureOutputProperty (output, stuff->property,
- stuff->pending, stuff->range,
- FALSE, num_valid,
- (INT32 *) (stuff + 1));
+
+ num_valid =
+ stuff->length - bytes_to_int32(sizeof(xRRConfigureOutputPropertyReq));
+ return RRConfigureOutputProperty(output, stuff->property, stuff->pending,
+ stuff->range, FALSE, num_valid,
+ (INT32 *) (stuff + 1));
}
int
-ProcRRChangeOutputProperty (ClientPtr client)
+ProcRRChangeOutputProperty(ClientPtr client)
{
REQUEST(xRRChangeOutputPropertyReq);
- RROutputPtr output;
- char format, mode;
- unsigned long len;
- int sizeInBytes;
- int totalSize;
- int err;
+ RROutputPtr output;
+ char format, mode;
+ unsigned long len;
+ int sizeInBytes;
+ int totalSize;
+ int err;
REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq);
UpdateCurrentTime();
format = stuff->format;
mode = stuff->mode;
if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
- (mode != PropModePrepend))
- {
- client->errorValue = mode;
- return BadValue;
- }
- if ((format != 8) && (format != 16) && (format != 32))
- {
- client->errorValue = format;
+ (mode != PropModePrepend)) {
+ client->errorValue = mode;
+ return BadValue;
+ }
+ if ((format != 8) && (format != 16) && (format != 32)) {
+ client->errorValue = format;
return BadValue;
}
len = stuff->nUnits;
if (len > bytes_to_int32((0xffffffff - sizeof(xChangePropertyReq))))
- return BadLength;
- sizeInBytes = format>>3;
+ return BadLength;
+ sizeInBytes = format >> 3;
totalSize = len * sizeInBytes;
REQUEST_FIXED_SIZE(xRRChangeOutputPropertyReq, totalSize);
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
-
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
+
+ if (!ValidAtom(stuff->property)) {
+ client->errorValue = stuff->property;
+ return BadAtom;
}
- if (!ValidAtom(stuff->type))
- {
- client->errorValue = stuff->type;
- return BadAtom;
+ if (!ValidAtom(stuff->type)) {
+ client->errorValue = stuff->type;
+ return BadAtom;
}
err = RRChangeOutputProperty(output, stuff->property,
- stuff->type, (int)format,
- (int)mode, len, (pointer)&stuff[1], TRUE, TRUE);
+ stuff->type, (int) format,
+ (int) mode, len, (pointer) &stuff[1], TRUE,
+ TRUE);
if (err != Success)
- return err;
+ return err;
else
- return Success;
+ return Success;
}
int
-ProcRRDeleteOutputProperty (ClientPtr client)
+ProcRRDeleteOutputProperty(ClientPtr client)
{
REQUEST(xRRDeleteOutputPropertyReq);
- RROutputPtr output;
- RRPropertyPtr prop;
+ RROutputPtr output;
+ RRPropertyPtr prop;
REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
UpdateCurrentTime();
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
+ if (!ValidAtom(stuff->property)) {
+ client->errorValue = stuff->property;
+ return BadAtom;
}
prop = RRQueryOutputProperty(output, stuff->property);
- if (!prop)
- {
- client->errorValue = stuff->property;
- return BadName;
+ if (!prop) {
+ client->errorValue = stuff->property;
+ return BadName;
}
- if (prop->immutable)
- {
- client->errorValue = stuff->property;
- return BadAccess;
+ if (prop->immutable) {
+ client->errorValue = stuff->property;
+ return BadAccess;
}
RRDeleteOutputProperty(output, stuff->property);
@@ -580,162 +561,156 @@ ProcRRDeleteOutputProperty (ClientPtr client)
}
int
-ProcRRGetOutputProperty (ClientPtr client)
+ProcRRGetOutputProperty(ClientPtr client)
{
REQUEST(xRRGetOutputPropertyReq);
- RRPropertyPtr prop, *prev;
- RRPropertyValuePtr prop_value;
- unsigned long n, len, ind;
- RROutputPtr output;
- xRRGetOutputPropertyReply reply;
- char *extra = NULL;
+ RRPropertyPtr prop, *prev;
+ RRPropertyValuePtr prop_value;
+ unsigned long n, len, ind;
+ RROutputPtr output;
+ xRRGetOutputPropertyReply reply;
+ char *extra = NULL;
REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
if (stuff->delete)
- UpdateCurrentTime();
+ UpdateCurrentTime();
VERIFY_RR_OUTPUT(stuff->output, output,
- stuff->delete ? DixWriteAccess : DixReadAccess);
+ stuff->delete ? DixWriteAccess : DixReadAccess);
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
+ if (!ValidAtom(stuff->property)) {
+ client->errorValue = stuff->property;
+ return BadAtom;
}
- if ((stuff->delete != xTrue) && (stuff->delete != xFalse))
- {
- client->errorValue = stuff->delete;
- return BadValue;
+ if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) {
+ client->errorValue = stuff->delete;
+ return BadValue;
}
- if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type))
- {
- client->errorValue = stuff->type;
- return BadAtom;
+ if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) {
+ client->errorValue = stuff->type;
+ return BadAtom;
}
for (prev = &output->properties; (prop = *prev); prev = &prop->next)
- if (prop->propertyName == stuff->property)
- break;
+ if (prop->propertyName == stuff->property)
+ break;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
- if (!prop)
- {
- reply.nItems = 0;
- reply.length = 0;
- reply.bytesAfter = 0;
- reply.propertyType = None;
- reply.format = 0;
- if (client->swapped) {
- swaps(&reply.sequenceNumber);
- swapl(&reply.length);
- swapl(&reply.propertyType);
- swapl(&reply.bytesAfter);
- swapl(&reply.nItems);
- }
- WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
- return Success;
+ if (!prop) {
+ reply.nItems = 0;
+ reply.length = 0;
+ reply.bytesAfter = 0;
+ reply.propertyType = None;
+ reply.format = 0;
+ if (client->swapped) {
+ swaps(&reply.sequenceNumber);
+ swapl(&reply.length);
+ swapl(&reply.propertyType);
+ swapl(&reply.bytesAfter);
+ swapl(&reply.nItems);
+ }
+ WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
+ return Success;
}
if (prop->immutable && stuff->delete)
- return BadAccess;
+ return BadAccess;
prop_value = RRGetOutputProperty(output, stuff->property, stuff->pending);
if (!prop_value)
- return BadAtom;
+ return BadAtom;
/* If the request type and actual type don't match. Return the
- property information, but not the data. */
-
- if (((stuff->type != prop_value->type) &&
- (stuff->type != AnyPropertyType))
- )
- {
- reply.bytesAfter = prop_value->size;
- reply.format = prop_value->format;
- reply.length = 0;
- reply.nItems = 0;
- reply.propertyType = prop_value->type;
- if (client->swapped) {
- swaps(&reply.sequenceNumber);
- swapl(&reply.length);
- swapl(&reply.propertyType);
- swapl(&reply.bytesAfter);
- swapl(&reply.nItems);
- }
- WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
- return Success;
+ property information, but not the data. */
+
+ if (((stuff->type != prop_value->type) && (stuff->type != AnyPropertyType))
+ ) {
+ reply.bytesAfter = prop_value->size;
+ reply.format = prop_value->format;
+ reply.length = 0;
+ reply.nItems = 0;
+ reply.propertyType = prop_value->type;
+ if (client->swapped) {
+ swaps(&reply.sequenceNumber);
+ swapl(&reply.length);
+ swapl(&reply.propertyType);
+ swapl(&reply.bytesAfter);
+ swapl(&reply.nItems);
+ }
+ WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
+ return Success;
}
/*
* Return type, format, value to client
*/
- n = (prop_value->format/8) * prop_value->size; /* size (bytes) of prop */
- ind = stuff->longOffset << 2;
+ n = (prop_value->format / 8) * prop_value->size; /* size (bytes) of prop */
+ ind = stuff->longOffset << 2;
- /* If longOffset is invalid such that it causes "len" to
- be negative, it's a value error. */
+ /* If longOffset is invalid such that it causes "len" to
+ be negative, it's a value error. */
- if (n < ind)
- {
- client->errorValue = stuff->longOffset;
- return BadValue;
+ if (n < ind) {
+ client->errorValue = stuff->longOffset;
+ return BadValue;
}
len = min(n - ind, 4 * stuff->longLength);
if (len) {
- extra = malloc(len);
- if (!extra)
- return BadAlloc;
+ extra = malloc(len);
+ if (!extra)
+ return BadAlloc;
}
reply.bytesAfter = n - (ind + len);
reply.format = prop_value->format;
reply.length = bytes_to_int32(len);
if (prop_value->format)
- reply.nItems = len / (prop_value->format / 8);
+ reply.nItems = len / (prop_value->format / 8);
else
- reply.nItems = 0;
+ reply.nItems = 0;
reply.propertyType = prop_value->type;
- if (stuff->delete && (reply.bytesAfter == 0))
- {
- xRROutputPropertyNotifyEvent event;
+ if (stuff->delete && (reply.bytesAfter == 0)) {
+ xRROutputPropertyNotifyEvent event;
- event.type = RREventBase + RRNotify;
- event.subCode = RRNotify_OutputProperty;
- event.output = output->id;
- event.state = PropertyDelete;
- event.atom = prop->propertyName;
- event.timestamp = currentTime.milliseconds;
- RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
+ event.type = RREventBase + RRNotify;
+ event.subCode = RRNotify_OutputProperty;
+ event.output = output->id;
+ event.state = PropertyDelete;
+ event.atom = prop->propertyName;
+ event.timestamp = currentTime.milliseconds;
+ RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event);
}
if (client->swapped) {
- swaps(&reply.sequenceNumber);
- swapl(&reply.length);
- swapl(&reply.propertyType);
- swapl(&reply.bytesAfter);
- swapl(&reply.nItems);
+ swaps(&reply.sequenceNumber);
+ swapl(&reply.length);
+ swapl(&reply.propertyType);
+ swapl(&reply.bytesAfter);
+ swapl(&reply.nItems);
}
WriteToClient(client, sizeof(xGenericReply), &reply);
- if (len)
- {
- memcpy(extra, (char *)prop_value->data + ind, len);
- switch (reply.format) {
- case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
- case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
- default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
- }
- WriteSwappedDataToClient(client, len,
- extra);
- free(extra);
- }
-
- if (stuff->delete && (reply.bytesAfter == 0))
- { /* delete the Property */
- *prev = prop->next;
- RRDestroyOutputProperty (prop);
+ if (len) {
+ memcpy(extra, (char *) prop_value->data + ind, len);
+ switch (reply.format) {
+ case 32:
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
+ break;
+ case 16:
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
+ break;
+ default:
+ client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
+ break;
+ }
+ WriteSwappedDataToClient(client, len, extra);
+ free(extra);
+ }
+
+ if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */
+ *prev = prop->next;
+ RRDestroyOutputProperty(prop);
}
return Success;
}
-
diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c
index ab4675734..f570afaf4 100644
--- a/xorg-server/randr/rrscreen.c
+++ b/xorg-server/randr/rrscreen.c
@@ -22,47 +22,44 @@
#include "randrstr.h"
-static const int padlength[4] = {0, 3, 2, 1};
+static const int padlength[4] = { 0, 3, 2, 1 };
static CARD16
-RR10CurrentSizeID (ScreenPtr pScreen);
+ RR10CurrentSizeID(ScreenPtr pScreen);
/*
* Edit connection information block so that new clients
* see the current screen size on connect
*/
static void
-RREditConnectionInfo (ScreenPtr pScreen)
+RREditConnectionInfo(ScreenPtr pScreen)
{
- xConnSetup *connSetup;
- char *vendor;
- xPixmapFormat *formats;
- xWindowRoot *root;
- xDepth *depth;
- xVisualType *visual;
- int screen = 0;
- int d;
+ xConnSetup *connSetup;
+ char *vendor;
+ xPixmapFormat *formats;
+ xWindowRoot *root;
+ xDepth *depth;
+ xVisualType *visual;
+ int screen = 0;
+ int d;
connSetup = (xConnSetup *) ConnectionInfo;
- vendor = (char *) connSetup + sizeof (xConnSetup);
+ vendor = (char *) connSetup + sizeof(xConnSetup);
formats = (xPixmapFormat *) ((char *) vendor +
- connSetup->nbytesVendor +
- padlength[connSetup->nbytesVendor & 3]);
+ connSetup->nbytesVendor +
+ padlength[connSetup->nbytesVendor & 3]);
root = (xWindowRoot *) ((char *) formats +
- sizeof (xPixmapFormat) * screenInfo.numPixmapFormats);
- while (screen != pScreen->myNum)
- {
- depth = (xDepth *) ((char *) root +
- sizeof (xWindowRoot));
- for (d = 0; d < root->nDepths; d++)
- {
- visual = (xVisualType *) ((char *) depth +
- sizeof (xDepth));
- depth = (xDepth *) ((char *) visual +
- depth->nVisuals * sizeof (xVisualType));
- }
- root = (xWindowRoot *) ((char *) depth);
- screen++;
+ sizeof(xPixmapFormat) *
+ screenInfo.numPixmapFormats);
+ while (screen != pScreen->myNum) {
+ depth = (xDepth *) ((char *) root + sizeof(xWindowRoot));
+ for (d = 0; d < root->nDepths; d++) {
+ visual = (xVisualType *) ((char *) depth + sizeof(xDepth));
+ depth = (xDepth *) ((char *) visual +
+ depth->nVisuals * sizeof(xVisualType));
+ }
+ root = (xWindowRoot *) ((char *) depth);
+ screen++;
}
root->pixWidth = pScreen->width;
root->pixHeight = pScreen->height;
@@ -71,10 +68,10 @@ RREditConnectionInfo (ScreenPtr pScreen)
}
void
-RRSendConfigNotify (ScreenPtr pScreen)
+RRSendConfigNotify(ScreenPtr pScreen)
{
- WindowPtr pWin = pScreen->root;
- xEvent event;
+ WindowPtr pWin = pScreen->root;
+ xEvent event;
event.u.u.type = ConfigureNotify;
event.u.configureNotify.window = pWin->drawable.id;
@@ -83,45 +80,46 @@ RRSendConfigNotify (ScreenPtr pScreen)
event.u.configureNotify.y = 0;
/* XXX xinerama stuff ? */
-
+
event.u.configureNotify.width = pWin->drawable.width;
event.u.configureNotify.height = pWin->drawable.height;
- event.u.configureNotify.borderWidth = wBorderWidth (pWin);
+ event.u.configureNotify.borderWidth = wBorderWidth(pWin);
event.u.configureNotify.override = pWin->overrideRedirect;
DeliverEvents(pWin, &event, 1, NullWindow);
}
void
-RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
+RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
{
- rrScrPriv (pScreen);
- xRRScreenChangeNotifyEvent se;
- RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL;
- WindowPtr pRoot = pScreen->root;
-
+ rrScrPriv(pScreen);
+ xRRScreenChangeNotifyEvent se;
+ RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL;
+ WindowPtr pRoot = pScreen->root;
+
se.type = RRScreenChangeNotify + RREventBase;
se.rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0);
se.timestamp = pScrPriv->lastSetTime.milliseconds;
se.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
- se.root = pRoot->drawable.id;
+ se.root = pRoot->drawable.id;
se.window = pWin->drawable.id;
- se.subpixelOrder = PictureGetSubpixelOrder (pScreen);
+ se.subpixelOrder = PictureGetSubpixelOrder(pScreen);
- se.sizeID = RR10CurrentSizeID (pScreen);
+ se.sizeID = RR10CurrentSizeID(pScreen);
if (se.rotation & (RR_Rotate_90 | RR_Rotate_270)) {
- se.widthInPixels = pScreen->height;
- se.heightInPixels = pScreen->width;
- se.widthInMillimeters = pScreen->mmHeight;
- se.heightInMillimeters = pScreen->mmWidth;
- } else {
- se.widthInPixels = pScreen->width;
- se.heightInPixels = pScreen->height;
- se.widthInMillimeters = pScreen->mmWidth;
- se.heightInMillimeters = pScreen->mmHeight;
- }
-
- WriteEventsToClient (client, 1, (xEvent *) &se);
+ se.widthInPixels = pScreen->height;
+ se.heightInPixels = pScreen->width;
+ se.widthInMillimeters = pScreen->mmHeight;
+ se.heightInMillimeters = pScreen->mmWidth;
+ }
+ else {
+ se.widthInPixels = pScreen->width;
+ se.heightInPixels = pScreen->height;
+ se.widthInMillimeters = pScreen->mmWidth;
+ se.heightInMillimeters = pScreen->mmHeight;
+ }
+
+ WriteEventsToClient(client, 1, (xEvent *) &se);
}
/*
@@ -130,7 +128,7 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
* the size of the screen
*/
void
-RRScreenSizeNotify (ScreenPtr pScreen)
+RRScreenSizeNotify(ScreenPtr pScreen)
{
rrScrPriv(pScreen);
/*
@@ -138,11 +136,11 @@ RRScreenSizeNotify (ScreenPtr pScreen)
* pixel size
*/
if (pScrPriv->width == pScreen->width &&
- pScrPriv->height == pScreen->height &&
- pScrPriv->mmWidth == pScreen->mmWidth &&
- pScrPriv->mmHeight == pScreen->mmHeight)
- return;
-
+ pScrPriv->height == pScreen->height &&
+ pScrPriv->mmWidth == pScreen->mmWidth &&
+ pScrPriv->mmHeight == pScreen->mmHeight)
+ return;
+
pScrPriv->width = pScreen->width;
pScrPriv->height = pScreen->height;
pScrPriv->mmWidth = pScreen->mmWidth;
@@ -150,41 +148,35 @@ RRScreenSizeNotify (ScreenPtr pScreen)
pScrPriv->changed = TRUE;
/* pScrPriv->sizeChanged = TRUE; */
- RRTellChanged (pScreen);
- RRSendConfigNotify (pScreen);
- RREditConnectionInfo (pScreen);
-
- RRPointerScreenConfigured (pScreen);
+ RRTellChanged(pScreen);
+ RRSendConfigNotify(pScreen);
+ RREditConnectionInfo(pScreen);
+
+ RRPointerScreenConfigured(pScreen);
/*
* Fix pointer bounds and location
*/
- ScreenRestructured (pScreen);
+ ScreenRestructured(pScreen);
}
/*
* Request that the screen be resized
*/
Bool
-RRScreenSizeSet (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight)
+RRScreenSizeSet(ScreenPtr pScreen,
+ CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight)
{
rrScrPriv(pScreen);
#if RANDR_12_INTERFACE
- if (pScrPriv->rrScreenSetSize)
- {
- return (*pScrPriv->rrScreenSetSize) (pScreen,
- width, height,
- mmWidth, mmHeight);
+ if (pScrPriv->rrScreenSetSize) {
+ return (*pScrPriv->rrScreenSetSize) (pScreen,
+ width, height, mmWidth, mmHeight);
}
#endif
#if RANDR_10_INTERFACE
- if (pScrPriv->rrSetConfig)
- {
- return TRUE; /* can't set size separately */
+ if (pScrPriv->rrSetConfig) {
+ return TRUE; /* can't set size separately */
}
#endif
return FALSE;
@@ -194,114 +186,105 @@ RRScreenSizeSet (ScreenPtr pScreen,
* Retrieve valid screen size range
*/
int
-ProcRRGetScreenSizeRange (ClientPtr client)
+ProcRRGetScreenSizeRange(ClientPtr client)
{
REQUEST(xRRGetScreenSizeRangeReq);
- xRRGetScreenSizeRangeReply rep;
- WindowPtr pWin;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- int rc;
-
+ xRRGetScreenSizeRangeReply rep;
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ int rc;
+
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
-
+
rep.type = X_Reply;
rep.pad = 0;
rep.sequenceNumber = client->sequence;
rep.length = 0;
-
- if (pScrPriv)
- {
- if (!RRGetInfo (pScreen, FALSE))
- return BadAlloc;
- rep.minWidth = pScrPriv->minWidth;
- rep.minHeight = pScrPriv->minHeight;
- rep.maxWidth = pScrPriv->maxWidth;
- rep.maxHeight = pScrPriv->maxHeight;
+
+ if (pScrPriv) {
+ if (!RRGetInfo(pScreen, FALSE))
+ return BadAlloc;
+ rep.minWidth = pScrPriv->minWidth;
+ rep.minHeight = pScrPriv->minHeight;
+ rep.maxWidth = pScrPriv->maxWidth;
+ rep.maxHeight = pScrPriv->maxHeight;
}
- else
- {
- rep.maxWidth = rep.minWidth = pScreen->width;
- rep.maxHeight = rep.minHeight = pScreen->height;
- }
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.minWidth);
- swaps(&rep.minHeight);
- swaps(&rep.maxWidth);
- swaps(&rep.maxHeight);
- }
- WriteToClient(client, sizeof(xRRGetScreenSizeRangeReply), (char *)&rep);
+ else {
+ rep.maxWidth = rep.minWidth = pScreen->width;
+ rep.maxHeight = rep.minHeight = pScreen->height;
+ }
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.minWidth);
+ swaps(&rep.minHeight);
+ swaps(&rep.maxWidth);
+ swaps(&rep.maxHeight);
+ }
+ WriteToClient(client, sizeof(xRRGetScreenSizeRangeReply), (char *) &rep);
return Success;
}
int
-ProcRRSetScreenSize (ClientPtr client)
+ProcRRSetScreenSize(ClientPtr client)
{
REQUEST(xRRSetScreenSizeReq);
- WindowPtr pWin;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- int i, rc;
-
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ int i, rc;
+
REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
- if (stuff->width < pScrPriv->minWidth || pScrPriv->maxWidth < stuff->width)
- {
- client->errorValue = stuff->width;
- return BadValue;
- }
- if (stuff->height < pScrPriv->minHeight ||
- pScrPriv->maxHeight < stuff->height)
- {
- client->errorValue = stuff->height;
- return BadValue;
- }
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- RRCrtcPtr crtc = pScrPriv->crtcs[i];
- RRModePtr mode = crtc->mode;
- if (mode)
- {
- int source_width = mode->mode.width;
- int source_height = mode->mode.height;
- Rotation rotation = crtc->rotation;
-
- if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270)
- {
- source_width = mode->mode.height;
- source_height = mode->mode.width;
- }
-
- if (crtc->x + source_width > stuff->width ||
- crtc->y + source_height > stuff->height)
- return BadMatch;
- }
- }
- if (stuff->widthInMillimeters == 0 || stuff->heightInMillimeters == 0)
- {
- client->errorValue = 0;
- return BadValue;
- }
- if (!RRScreenSizeSet (pScreen,
- stuff->width, stuff->height,
- stuff->widthInMillimeters,
- stuff->heightInMillimeters))
- {
- return BadMatch;
+ if (stuff->width < pScrPriv->minWidth || pScrPriv->maxWidth < stuff->width) {
+ client->errorValue = stuff->width;
+ return BadValue;
+ }
+ if (stuff->height < pScrPriv->minHeight ||
+ pScrPriv->maxHeight < stuff->height) {
+ client->errorValue = stuff->height;
+ return BadValue;
+ }
+ for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ RRCrtcPtr crtc = pScrPriv->crtcs[i];
+ RRModePtr mode = crtc->mode;
+
+ if (mode) {
+ int source_width = mode->mode.width;
+ int source_height = mode->mode.height;
+ Rotation rotation = crtc->rotation;
+
+ if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270) {
+ source_width = mode->mode.height;
+ source_height = mode->mode.width;
+ }
+
+ if (crtc->x + source_width > stuff->width ||
+ crtc->y + source_height > stuff->height)
+ return BadMatch;
+ }
+ }
+ if (stuff->widthInMillimeters == 0 || stuff->heightInMillimeters == 0) {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ if (!RRScreenSizeSet(pScreen,
+ stuff->width, stuff->height,
+ stuff->widthInMillimeters,
+ stuff->heightInMillimeters)) {
+ return BadMatch;
}
return Success;
}
@@ -310,494 +293,464 @@ static int
rrGetScreenResources(ClientPtr client, Bool query)
{
REQUEST(xRRGetScreenResourcesReq);
- xRRGetScreenResourcesReply rep;
- WindowPtr pWin;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- CARD8 *extra;
- unsigned long extraLen;
- int i, rc, has_primary = 0;
- RRCrtc *crtcs;
- RROutput *outputs;
- xRRModeInfo *modeinfos;
- CARD8 *names;
-
+ xRRGetScreenResourcesReply rep;
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ CARD8 *extra;
+ unsigned long extraLen;
+ int i, rc, has_primary = 0;
+ RRCrtc *crtcs;
+ RROutput *outputs;
+ xRRModeInfo *modeinfos;
+ CARD8 *names;
+
REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
-
+ return rc;
+
pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
rep.pad = 0;
-
+
if (query && pScrPriv)
- if (!RRGetInfo (pScreen, query))
- return BadAlloc;
-
- if (!pScrPriv)
- {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.timestamp = currentTime.milliseconds;
- rep.configTimestamp = currentTime.milliseconds;
- rep.nCrtcs = 0;
- rep.nOutputs = 0;
- rep.nModes = 0;
- rep.nbytesNames = 0;
- extra = NULL;
- extraLen = 0;
+ if (!RRGetInfo(pScreen, query))
+ return BadAlloc;
+
+ if (!pScrPriv) {
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.timestamp = currentTime.milliseconds;
+ rep.configTimestamp = currentTime.milliseconds;
+ rep.nCrtcs = 0;
+ rep.nOutputs = 0;
+ rep.nModes = 0;
+ rep.nbytesNames = 0;
+ extra = NULL;
+ extraLen = 0;
}
- else
- {
- RRModePtr *modes;
- int num_modes;
-
- modes = RRModesForScreen (pScreen, &num_modes);
- if (!modes)
- return BadAlloc;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.timestamp = pScrPriv->lastSetTime.milliseconds;
- rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
- rep.nCrtcs = pScrPriv->numCrtcs;
- rep.nOutputs = pScrPriv->numOutputs;
- rep.nModes = num_modes;
- rep.nbytesNames = 0;
-
- for (i = 0; i < num_modes; i++)
- rep.nbytesNames += modes[i]->mode.nameLength;
-
- rep.length = (pScrPriv->numCrtcs +
- pScrPriv->numOutputs +
- num_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) +
- bytes_to_int32(rep.nbytesNames));
-
- extraLen = rep.length << 2;
- if (extraLen)
- {
- extra = malloc(extraLen);
- if (!extra)
- {
- free(modes);
- return BadAlloc;
- }
- }
- else
- extra = NULL;
-
- crtcs = (RRCrtc *) extra;
- outputs = (RROutput *) (crtcs + pScrPriv->numCrtcs);
- modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs);
- names = (CARD8 *) (modeinfos + num_modes);
-
- if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
- {
- has_primary = 1;
- crtcs[0] = pScrPriv->primaryOutput->crtc->id;
- if (client->swapped)
- swapl(&crtcs[0]);
- }
-
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- if (has_primary &&
- pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
- {
- has_primary = 0;
- continue;
- }
- crtcs[i + has_primary] = pScrPriv->crtcs[i]->id;
- if (client->swapped)
- swapl(&crtcs[i + has_primary]);
- }
-
- for (i = 0; i < pScrPriv->numOutputs; i++)
- {
- outputs[i] = pScrPriv->outputs[i]->id;
- if (client->swapped)
- swapl(&outputs[i]);
- }
-
- for (i = 0; i < num_modes; i++)
- {
- RRModePtr mode = modes[i];
- modeinfos[i] = mode->mode;
- if (client->swapped)
- {
- swapl(&modeinfos[i].id);
- swaps(&modeinfos[i].width);
- swaps(&modeinfos[i].height);
- swapl(&modeinfos[i].dotClock);
- swaps(&modeinfos[i].hSyncStart);
- swaps(&modeinfos[i].hSyncEnd);
- swaps(&modeinfos[i].hTotal);
- swaps(&modeinfos[i].hSkew);
- swaps(&modeinfos[i].vSyncStart);
- swaps(&modeinfos[i].vSyncEnd);
- swaps(&modeinfos[i].vTotal);
- swaps(&modeinfos[i].nameLength);
- swapl(&modeinfos[i].modeFlags);
- }
- memcpy (names, mode->name,
- mode->mode.nameLength);
- names += mode->mode.nameLength;
- }
+ else {
+ RRModePtr *modes;
+ int num_modes;
+
+ modes = RRModesForScreen(pScreen, &num_modes);
+ if (!modes)
+ return BadAlloc;
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.timestamp = pScrPriv->lastSetTime.milliseconds;
+ rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
+ rep.nCrtcs = pScrPriv->numCrtcs;
+ rep.nOutputs = pScrPriv->numOutputs;
+ rep.nModes = num_modes;
+ rep.nbytesNames = 0;
+
+ for (i = 0; i < num_modes; i++)
+ rep.nbytesNames += modes[i]->mode.nameLength;
+
+ rep.length = (pScrPriv->numCrtcs +
+ pScrPriv->numOutputs +
+ num_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) +
+ bytes_to_int32(rep.nbytesNames));
+
+ extraLen = rep.length << 2;
+ if (extraLen) {
+ extra = malloc(extraLen);
+ if (!extra) {
+ free(modes);
+ return BadAlloc;
+ }
+ }
+ else
+ extra = NULL;
+
+ crtcs = (RRCrtc *) extra;
+ outputs = (RROutput *) (crtcs + pScrPriv->numCrtcs);
+ modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs);
+ names = (CARD8 *) (modeinfos + num_modes);
+
+ if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) {
+ has_primary = 1;
+ crtcs[0] = pScrPriv->primaryOutput->crtc->id;
+ if (client->swapped)
+ swapl(&crtcs[0]);
+ }
+
+ for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ if (has_primary &&
+ pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i]) {
+ has_primary = 0;
+ continue;
+ }
+ crtcs[i + has_primary] = pScrPriv->crtcs[i]->id;
+ if (client->swapped)
+ swapl(&crtcs[i + has_primary]);
+ }
+
+ for (i = 0; i < pScrPriv->numOutputs; i++) {
+ outputs[i] = pScrPriv->outputs[i]->id;
+ if (client->swapped)
+ swapl(&outputs[i]);
+ }
+
+ for (i = 0; i < num_modes; i++) {
+ RRModePtr mode = modes[i];
+
+ modeinfos[i] = mode->mode;
+ if (client->swapped) {
+ swapl(&modeinfos[i].id);
+ swaps(&modeinfos[i].width);
+ swaps(&modeinfos[i].height);
+ swapl(&modeinfos[i].dotClock);
+ swaps(&modeinfos[i].hSyncStart);
+ swaps(&modeinfos[i].hSyncEnd);
+ swaps(&modeinfos[i].hTotal);
+ swaps(&modeinfos[i].hSkew);
+ swaps(&modeinfos[i].vSyncStart);
+ swaps(&modeinfos[i].vSyncEnd);
+ swaps(&modeinfos[i].vTotal);
+ swaps(&modeinfos[i].nameLength);
+ swapl(&modeinfos[i].modeFlags);
+ }
+ memcpy(names, mode->name, mode->mode.nameLength);
+ names += mode->mode.nameLength;
+ }
free(modes);
- assert (bytes_to_int32((char *) names - (char *) extra) == rep.length);
+ assert(bytes_to_int32((char *) names - (char *) extra) == rep.length);
}
-
+
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.timestamp);
- swapl(&rep.configTimestamp);
- swaps(&rep.nCrtcs);
- swaps(&rep.nOutputs);
- swaps(&rep.nModes);
- swaps(&rep.nbytesNames);
- }
- WriteToClient(client, sizeof(xRRGetScreenResourcesReply), (char *)&rep);
- if (extraLen)
- {
- WriteToClient (client, extraLen, (char *) extra);
- free(extra);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.timestamp);
+ swapl(&rep.configTimestamp);
+ swaps(&rep.nCrtcs);
+ swaps(&rep.nOutputs);
+ swaps(&rep.nModes);
+ swaps(&rep.nbytesNames);
+ }
+ WriteToClient(client, sizeof(xRRGetScreenResourcesReply), (char *) &rep);
+ if (extraLen) {
+ WriteToClient(client, extraLen, (char *) extra);
+ free(extra);
}
return Success;
}
int
-ProcRRGetScreenResources (ClientPtr client)
+ProcRRGetScreenResources(ClientPtr client)
{
return rrGetScreenResources(client, TRUE);
}
-
+
int
-ProcRRGetScreenResourcesCurrent (ClientPtr client)
+ProcRRGetScreenResourcesCurrent(ClientPtr client)
{
return rrGetScreenResources(client, FALSE);
}
typedef struct _RR10Data {
RRScreenSizePtr sizes;
- int nsize;
- int nrefresh;
- int size;
- CARD16 refresh;
+ int nsize;
+ int nrefresh;
+ int size;
+ CARD16 refresh;
} RR10DataRec, *RR10DataPtr;
/*
* Convert 1.2 monitor data into 1.0 screen data
*/
static RR10DataPtr
-RR10GetData (ScreenPtr pScreen, RROutputPtr output)
+RR10GetData(ScreenPtr pScreen, RROutputPtr output)
{
- RR10DataPtr data;
+ RR10DataPtr data;
RRScreenSizePtr size;
- int nmode = output->numModes + output->numUserModes;
- int o, os, l, r;
+ int nmode = output->numModes + output->numUserModes;
+ int o, os, l, r;
RRScreenRatePtr refresh;
- CARD16 vRefresh;
- RRModePtr mode;
- Bool *used;
+ CARD16 vRefresh;
+ RRModePtr mode;
+ Bool *used;
/* Make sure there is plenty of space for any combination */
- data = malloc (sizeof (RR10DataRec) +
- sizeof (RRScreenSize) * nmode +
- sizeof (RRScreenRate) * nmode +
- sizeof (Bool) * nmode);
+ data = malloc(sizeof(RR10DataRec) +
+ sizeof(RRScreenSize) * nmode +
+ sizeof(RRScreenRate) * nmode + sizeof(Bool) * nmode);
if (!data)
- return NULL;
+ return NULL;
size = (RRScreenSizePtr) (data + 1);
refresh = (RRScreenRatePtr) (size + nmode);
used = (Bool *) (refresh + nmode);
- memset (used, '\0', sizeof (Bool) * nmode);
+ memset(used, '\0', sizeof(Bool) * nmode);
data->sizes = size;
data->nsize = 0;
data->nrefresh = 0;
data->size = 0;
data->refresh = 0;
-
+
/*
* find modes not yet listed
*/
- for (o = 0; o < output->numModes + output->numUserModes; o++)
- {
- if (used[o]) continue;
-
- if (o < output->numModes)
- mode = output->modes[o];
- else
- mode = output->userModes[o - output->numModes];
-
- l = data->nsize;
- size[l].id = data->nsize;
- size[l].width = mode->mode.width;
- size[l].height = mode->mode.height;
- if (output->mmWidth && output->mmHeight) {
- size[l].mmWidth = output->mmWidth;
- size[l].mmHeight = output->mmHeight;
- } else {
- size[l].mmWidth = pScreen->mmWidth;
- size[l].mmHeight = pScreen->mmHeight;
- }
- size[l].nRates = 0;
- size[l].pRates = &refresh[data->nrefresh];
- data->nsize++;
-
- /*
- * Find all modes with matching size
- */
- for (os = o; os < output->numModes + output->numUserModes; os++)
- {
- if (os < output->numModes)
- mode = output->modes[os];
- else
- mode = output->userModes[os - output->numModes];
- if (mode->mode.width == size[l].width &&
- mode->mode.height == size[l].height)
- {
- vRefresh = RRVerticalRefresh (&mode->mode);
- used[os] = TRUE;
-
- for (r = 0; r < size[l].nRates; r++)
- if (vRefresh == size[l].pRates[r].rate)
- break;
- if (r == size[l].nRates)
- {
- size[l].pRates[r].rate = vRefresh;
- size[l].pRates[r].mode = mode;
- size[l].nRates++;
- data->nrefresh++;
- }
- if (mode == output->crtc->mode)
- {
- data->size = l;
- data->refresh = vRefresh;
- }
- }
- }
+ for (o = 0; o < output->numModes + output->numUserModes; o++) {
+ if (used[o])
+ continue;
+
+ if (o < output->numModes)
+ mode = output->modes[o];
+ else
+ mode = output->userModes[o - output->numModes];
+
+ l = data->nsize;
+ size[l].id = data->nsize;
+ size[l].width = mode->mode.width;
+ size[l].height = mode->mode.height;
+ if (output->mmWidth && output->mmHeight) {
+ size[l].mmWidth = output->mmWidth;
+ size[l].mmHeight = output->mmHeight;
+ }
+ else {
+ size[l].mmWidth = pScreen->mmWidth;
+ size[l].mmHeight = pScreen->mmHeight;
+ }
+ size[l].nRates = 0;
+ size[l].pRates = &refresh[data->nrefresh];
+ data->nsize++;
+
+ /*
+ * Find all modes with matching size
+ */
+ for (os = o; os < output->numModes + output->numUserModes; os++) {
+ if (os < output->numModes)
+ mode = output->modes[os];
+ else
+ mode = output->userModes[os - output->numModes];
+ if (mode->mode.width == size[l].width &&
+ mode->mode.height == size[l].height) {
+ vRefresh = RRVerticalRefresh(&mode->mode);
+ used[os] = TRUE;
+
+ for (r = 0; r < size[l].nRates; r++)
+ if (vRefresh == size[l].pRates[r].rate)
+ break;
+ if (r == size[l].nRates) {
+ size[l].pRates[r].rate = vRefresh;
+ size[l].pRates[r].mode = mode;
+ size[l].nRates++;
+ data->nrefresh++;
+ }
+ if (mode == output->crtc->mode) {
+ data->size = l;
+ data->refresh = vRefresh;
+ }
+ }
+ }
}
return data;
}
int
-ProcRRGetScreenInfo (ClientPtr client)
+ProcRRGetScreenInfo(ClientPtr client)
{
REQUEST(xRRGetScreenInfoReq);
- xRRGetScreenInfoReply rep;
- WindowPtr pWin;
- int rc;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- CARD8 *extra;
- unsigned long extraLen;
- RROutputPtr output;
+ xRRGetScreenInfoReply rep;
+ WindowPtr pWin;
+ int rc;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ CARD8 *extra;
+ unsigned long extraLen;
+ RROutputPtr output;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
rep.pad = 0;
-
+
if (pScrPriv)
- if (!RRGetInfo (pScreen, TRUE))
- return BadAlloc;
-
- output = RRFirstOutput (pScreen);
-
- if (!pScrPriv || !output)
- {
- rep.type = X_Reply;
- rep.setOfRotations = RR_Rotate_0;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.root = pWin->drawable.pScreen->root->drawable.id;
- rep.timestamp = currentTime.milliseconds;
- rep.configTimestamp = currentTime.milliseconds;
- rep.nSizes = 0;
- rep.sizeID = 0;
- rep.rotation = RR_Rotate_0;
- rep.rate = 0;
- rep.nrateEnts = 0;
- extra = 0;
- extraLen = 0;
+ if (!RRGetInfo(pScreen, TRUE))
+ return BadAlloc;
+
+ output = RRFirstOutput(pScreen);
+
+ if (!pScrPriv || !output) {
+ rep.type = X_Reply;
+ rep.setOfRotations = RR_Rotate_0;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.root = pWin->drawable.pScreen->root->drawable.id;
+ rep.timestamp = currentTime.milliseconds;
+ rep.configTimestamp = currentTime.milliseconds;
+ rep.nSizes = 0;
+ rep.sizeID = 0;
+ rep.rotation = RR_Rotate_0;
+ rep.rate = 0;
+ rep.nrateEnts = 0;
+ extra = 0;
+ extraLen = 0;
}
- else
- {
- int i, j;
- xScreenSizes *size;
- CARD16 *rates;
- CARD8 *data8;
- Bool has_rate = RRClientKnowsRates (client);
- RR10DataPtr pData;
- RRScreenSizePtr pSize;
-
- pData = RR10GetData (pScreen, output);
- if (!pData)
- return BadAlloc;
-
- rep.type = X_Reply;
- rep.setOfRotations = output->crtc->rotations;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.root = pWin->drawable.pScreen->root->drawable.id;
- rep.timestamp = pScrPriv->lastSetTime.milliseconds;
- rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
- rep.rotation = output->crtc->rotation;
- rep.nSizes = pData->nsize;
+ else {
+ int i, j;
+ xScreenSizes *size;
+ CARD16 *rates;
+ CARD8 *data8;
+ Bool has_rate = RRClientKnowsRates(client);
+ RR10DataPtr pData;
+ RRScreenSizePtr pSize;
+
+ pData = RR10GetData(pScreen, output);
+ if (!pData)
+ return BadAlloc;
+
+ rep.type = X_Reply;
+ rep.setOfRotations = output->crtc->rotations;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.root = pWin->drawable.pScreen->root->drawable.id;
+ rep.timestamp = pScrPriv->lastSetTime.milliseconds;
+ rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
+ rep.rotation = output->crtc->rotation;
+ rep.nSizes = pData->nsize;
rep.nrateEnts = pData->nrefresh + pData->nsize;
- rep.sizeID = pData->size;
- rep.rate = pData->refresh;
-
- extraLen = rep.nSizes * sizeof (xScreenSizes);
- if (has_rate)
- extraLen += rep.nrateEnts * sizeof (CARD16);
-
- if (extraLen)
- {
- extra = (CARD8 *) malloc(extraLen);
- if (!extra)
- {
- free(pData);
- return BadAlloc;
- }
- }
- else
- extra = NULL;
-
- /*
- * First comes the size information
- */
- size = (xScreenSizes *) extra;
- rates = (CARD16 *) (size + rep.nSizes);
- for (i = 0; i < pData->nsize; i++)
- {
- pSize = &pData->sizes[i];
- size->widthInPixels = pSize->width;
- size->heightInPixels = pSize->height;
- size->widthInMillimeters = pSize->mmWidth;
- size->heightInMillimeters = pSize->mmHeight;
- if (client->swapped)
- {
- swaps(&size->widthInPixels);
- swaps(&size->heightInPixels);
- swaps(&size->widthInMillimeters);
- swaps(&size->heightInMillimeters);
- }
- size++;
- if (has_rate)
- {
- *rates = pSize->nRates;
- if (client->swapped)
- {
- swaps(rates);
- }
- rates++;
- for (j = 0; j < pSize->nRates; j++)
- {
- *rates = pSize->pRates[j].rate;
- if (client->swapped)
- {
- swaps(rates);
- }
- rates++;
- }
- }
- }
+ rep.sizeID = pData->size;
+ rep.rate = pData->refresh;
+
+ extraLen = rep.nSizes * sizeof(xScreenSizes);
+ if (has_rate)
+ extraLen += rep.nrateEnts * sizeof(CARD16);
+
+ if (extraLen) {
+ extra = (CARD8 *) malloc(extraLen);
+ if (!extra) {
+ free(pData);
+ return BadAlloc;
+ }
+ }
+ else
+ extra = NULL;
+
+ /*
+ * First comes the size information
+ */
+ size = (xScreenSizes *) extra;
+ rates = (CARD16 *) (size + rep.nSizes);
+ for (i = 0; i < pData->nsize; i++) {
+ pSize = &pData->sizes[i];
+ size->widthInPixels = pSize->width;
+ size->heightInPixels = pSize->height;
+ size->widthInMillimeters = pSize->mmWidth;
+ size->heightInMillimeters = pSize->mmHeight;
+ if (client->swapped) {
+ swaps(&size->widthInPixels);
+ swaps(&size->heightInPixels);
+ swaps(&size->widthInMillimeters);
+ swaps(&size->heightInMillimeters);
+ }
+ size++;
+ if (has_rate) {
+ *rates = pSize->nRates;
+ if (client->swapped) {
+ swaps(rates);
+ }
+ rates++;
+ for (j = 0; j < pSize->nRates; j++) {
+ *rates = pSize->pRates[j].rate;
+ if (client->swapped) {
+ swaps(rates);
+ }
+ rates++;
+ }
+ }
+ }
free(pData);
-
- data8 = (CARD8 *) rates;
- if (data8 - (CARD8 *) extra != extraLen)
- FatalError ("RRGetScreenInfo bad extra len %ld != %ld\n",
- (unsigned long)(data8 - (CARD8 *) extra), extraLen);
- rep.length = bytes_to_int32(extraLen);
+ data8 = (CARD8 *) rates;
+
+ if (data8 - (CARD8 *) extra != extraLen)
+ FatalError("RRGetScreenInfo bad extra len %ld != %ld\n",
+ (unsigned long) (data8 - (CARD8 *) extra), extraLen);
+ rep.length = bytes_to_int32(extraLen);
}
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.timestamp);
- swaps(&rep.rotation);
- swaps(&rep.nSizes);
- swaps(&rep.sizeID);
- swaps(&rep.rate);
- swaps(&rep.nrateEnts);
- }
- WriteToClient(client, sizeof(xRRGetScreenInfoReply), (char *)&rep);
- if (extraLen)
- {
- WriteToClient (client, extraLen, (char *) extra);
- free(extra);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.timestamp);
+ swaps(&rep.rotation);
+ swaps(&rep.nSizes);
+ swaps(&rep.sizeID);
+ swaps(&rep.rate);
+ swaps(&rep.nrateEnts);
+ }
+ WriteToClient(client, sizeof(xRRGetScreenInfoReply), (char *) &rep);
+ if (extraLen) {
+ WriteToClient(client, extraLen, (char *) extra);
+ free(extra);
}
return Success;
}
int
-ProcRRSetScreenConfig (ClientPtr client)
+ProcRRSetScreenConfig(ClientPtr client)
{
REQUEST(xRRSetScreenConfigReq);
xRRSetScreenConfigReply rep;
- DrawablePtr pDraw;
- int rc;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- TimeStamp time;
- int i;
- Rotation rotation;
- int rate;
- Bool has_rate;
- RROutputPtr output;
- RRCrtcPtr crtc;
- RRModePtr mode;
- RR10DataPtr pData = NULL;
- RRScreenSizePtr pSize;
- int width, height;
-
- UpdateCurrentTime ();
-
- if (RRClientKnowsRates (client))
- {
- REQUEST_SIZE_MATCH (xRRSetScreenConfigReq);
- has_rate = TRUE;
+ DrawablePtr pDraw;
+ int rc;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ TimeStamp time;
+ int i;
+ Rotation rotation;
+ int rate;
+ Bool has_rate;
+ RROutputPtr output;
+ RRCrtcPtr crtc;
+ RRModePtr mode;
+ RR10DataPtr pData = NULL;
+ RRScreenSizePtr pSize;
+ int width, height;
+
+ UpdateCurrentTime();
+
+ if (RRClientKnowsRates(client)) {
+ REQUEST_SIZE_MATCH(xRRSetScreenConfigReq);
+ has_rate = TRUE;
}
- else
- {
- REQUEST_SIZE_MATCH (xRR1_0SetScreenConfigReq);
- has_rate = FALSE;
+ else {
+ REQUEST_SIZE_MATCH(xRR1_0SetScreenConfigReq);
+ has_rate = FALSE;
}
-
+
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
if (rc != Success)
- return rc;
+ return rc;
pScreen = pDraw->pScreen;
pScrPriv = rrGetScrPriv(pScreen);
-
+
time = ClientTimeToServerTime(stuff->timestamp);
-
- if (!pScrPriv)
- {
- time = currentTime;
- rep.status = RRSetConfigFailed;
- goto sendReply;
- }
- if (!RRGetInfo (pScreen, FALSE))
- return BadAlloc;
-
- output = RRFirstOutput (pScreen);
- if (!output)
- {
- time = currentTime;
- rep.status = RRSetConfigFailed;
- goto sendReply;
+
+ if (!pScrPriv) {
+ time = currentTime;
+ rep.status = RRSetConfigFailed;
+ goto sendReply;
+ }
+ if (!RRGetInfo(pScreen, FALSE))
+ return BadAlloc;
+
+ output = RRFirstOutput(pScreen);
+ if (!output) {
+ time = currentTime;
+ rep.status = RRSetConfigFailed;
+ goto sendReply;
}
crtc = output->crtc;
@@ -811,27 +764,25 @@ ProcRRSetScreenConfig (ClientPtr client)
* timestamp, so using CompareTimeStamps here would cause randr to suddenly
* stop working after several hours have passed (freedesktop bug #6502).
*/
- if (stuff->configTimestamp != pScrPriv->lastConfigTime.milliseconds)
- {
- rep.status = RRSetConfigInvalidConfigTime;
- goto sendReply;
+ if (stuff->configTimestamp != pScrPriv->lastConfigTime.milliseconds) {
+ rep.status = RRSetConfigInvalidConfigTime;
+ goto sendReply;
}
-
- pData = RR10GetData (pScreen, output);
+
+ pData = RR10GetData(pScreen, output);
if (!pData)
- return BadAlloc;
-
- if (stuff->sizeID >= pData->nsize)
- {
- /*
- * Invalid size ID
- */
- client->errorValue = stuff->sizeID;
- free(pData);
- return BadValue;
+ return BadAlloc;
+
+ if (stuff->sizeID >= pData->nsize) {
+ /*
+ * Invalid size ID
+ */
+ client->errorValue = stuff->sizeID;
+ free(pData);
+ return BadValue;
}
pSize = &pData->sizes[stuff->sizeID];
-
+
/*
* Validate requested rotation
*/
@@ -843,63 +794,58 @@ ProcRRSetScreenConfig (ClientPtr client)
case RR_Rotate_90:
case RR_Rotate_180:
case RR_Rotate_270:
- break;
+ break;
default:
- /*
- * Invalid rotation
- */
- client->errorValue = stuff->rotation;
- free(pData);
- return BadValue;
+ /*
+ * Invalid rotation
+ */
+ client->errorValue = stuff->rotation;
+ free(pData);
+ return BadValue;
}
- if ((~crtc->rotations) & rotation)
- {
- /*
- * requested rotation or reflection not supported by screen
- */
- client->errorValue = stuff->rotation;
- free(pData);
- return BadMatch;
+ if ((~crtc->rotations) & rotation) {
+ /*
+ * requested rotation or reflection not supported by screen
+ */
+ client->errorValue = stuff->rotation;
+ free(pData);
+ return BadMatch;
}
/*
* Validate requested refresh
*/
if (has_rate)
- rate = (int) stuff->rate;
+ rate = (int) stuff->rate;
else
- rate = 0;
-
- if (rate)
- {
- for (i = 0; i < pSize->nRates; i++)
- {
- if (pSize->pRates[i].rate == rate)
- break;
- }
- if (i == pSize->nRates)
- {
- /*
- * Invalid rate
- */
- client->errorValue = rate;
- free(pData);
- return BadValue;
- }
- mode = pSize->pRates[i].mode;
+ rate = 0;
+
+ if (rate) {
+ for (i = 0; i < pSize->nRates; i++) {
+ if (pSize->pRates[i].rate == rate)
+ break;
+ }
+ if (i == pSize->nRates) {
+ /*
+ * Invalid rate
+ */
+ client->errorValue = rate;
+ free(pData);
+ return BadValue;
+ }
+ mode = pSize->pRates[i].mode;
}
else
- mode = pSize->pRates[0].mode;
-
+ mode = pSize->pRates[0].mode;
+
/*
* Make sure the requested set-time is not older than
* the last set-time
*/
- if (CompareTimeStamps (time, pScrPriv->lastSetTime) < 0)
- {
- rep.status = RRSetConfigInvalidTime;
- goto sendReply;
+ if (CompareTimeStamps(time, pScrPriv->lastSetTime) < 0) {
+ rep.status = RRSetConfigInvalidTime;
+ goto sendReply;
}
/*
@@ -909,58 +855,53 @@ ProcRRSetScreenConfig (ClientPtr client)
width = mode->mode.width;
height = mode->mode.height;
if (width < pScrPriv->minWidth || pScrPriv->maxWidth < width) {
- client->errorValue = width;
- free(pData);
- return BadValue;
+ client->errorValue = width;
+ free(pData);
+ return BadValue;
}
if (height < pScrPriv->minHeight || pScrPriv->maxHeight < height) {
- client->errorValue = height;
- free(pData);
- return BadValue;
- }
-
- if (rotation & (RR_Rotate_90|RR_Rotate_270))
- {
- width = mode->mode.height;
- height = mode->mode.width;
- }
-
- if (width != pScreen->width || height != pScreen->height)
- {
- int c;
-
- for (c = 0; c < pScrPriv->numCrtcs; c++)
- {
- if (!RRCrtcSet (pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0,
- 0, NULL))
- {
- rep.status = RRSetConfigFailed;
- /* XXX recover from failure */
- goto sendReply;
- }
- }
- if (!RRScreenSizeSet (pScreen, width, height,
- pScreen->mmWidth, pScreen->mmHeight))
- {
- rep.status = RRSetConfigFailed;
- /* XXX recover from failure */
- goto sendReply;
- }
- }
-
- if (!RRCrtcSet (crtc, mode, 0, 0, stuff->rotation, 1, &output))
- rep.status = RRSetConfigFailed;
+ client->errorValue = height;
+ free(pData);
+ return BadValue;
+ }
+
+ if (rotation & (RR_Rotate_90 | RR_Rotate_270)) {
+ width = mode->mode.height;
+ height = mode->mode.width;
+ }
+
+ if (width != pScreen->width || height != pScreen->height) {
+ int c;
+
+ for (c = 0; c < pScrPriv->numCrtcs; c++) {
+ if (!RRCrtcSet(pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0,
+ 0, NULL)) {
+ rep.status = RRSetConfigFailed;
+ /* XXX recover from failure */
+ goto sendReply;
+ }
+ }
+ if (!RRScreenSizeSet(pScreen, width, height,
+ pScreen->mmWidth, pScreen->mmHeight)) {
+ rep.status = RRSetConfigFailed;
+ /* XXX recover from failure */
+ goto sendReply;
+ }
+ }
+
+ if (!RRCrtcSet(crtc, mode, 0, 0, stuff->rotation, 1, &output))
+ rep.status = RRSetConfigFailed;
else {
- pScrPriv->lastSetTime = time;
- rep.status = RRSetConfigSuccess;
+ pScrPriv->lastSetTime = time;
+ rep.status = RRSetConfigSuccess;
}
/*
* XXX Configure other crtcs to mirror as much as possible
*/
-
-sendReply:
-
+
+ sendReply:
+
free(pData);
rep.type = X_Reply;
@@ -972,40 +913,38 @@ sendReply:
rep.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds;
rep.root = pDraw->pScreen->root->drawable.id;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.newTimestamp);
- swapl(&rep.newConfigTimestamp);
- swapl(&rep.root);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.newTimestamp);
+ swapl(&rep.newConfigTimestamp);
+ swapl(&rep.root);
}
- WriteToClient(client, sizeof(xRRSetScreenConfigReply), (char *)&rep);
+ WriteToClient(client, sizeof(xRRSetScreenConfigReply), (char *) &rep);
return Success;
}
static CARD16
-RR10CurrentSizeID (ScreenPtr pScreen)
+RR10CurrentSizeID(ScreenPtr pScreen)
{
- CARD16 sizeID = 0xffff;
- RROutputPtr output = RRFirstOutput (pScreen);
-
- if (output)
- {
- RR10DataPtr data = RR10GetData (pScreen, output);
- if (data)
- {
- int i;
- for (i = 0; i < data->nsize; i++)
- if (data->sizes[i].width == pScreen->width &&
- data->sizes[i].height == pScreen->height)
- {
- sizeID = (CARD16) i;
- break;
- }
- free(data);
- }
+ CARD16 sizeID = 0xffff;
+ RROutputPtr output = RRFirstOutput(pScreen);
+
+ if (output) {
+ RR10DataPtr data = RR10GetData(pScreen, output);
+
+ if (data) {
+ int i;
+
+ for (i = 0; i < data->nsize; i++)
+ if (data->sizes[i].width == pScreen->width &&
+ data->sizes[i].height == pScreen->height) {
+ sizeID = (CARD16) i;
+ break;
+ }
+ free(data);
+ }
}
return sizeID;
}
diff --git a/xorg-server/randr/rrsdispatch.c b/xorg-server/randr/rrsdispatch.c
index 543fc9022..9968c7f81 100644
--- a/xorg-server/randr/rrsdispatch.c
+++ b/xorg-server/randr/rrsdispatch.c
@@ -23,7 +23,7 @@
#include "randrstr.h"
static int
-SProcRRQueryVersion (ClientPtr client)
+SProcRRQueryVersion(ClientPtr client)
{
REQUEST(xRRQueryVersionReq);
@@ -34,7 +34,7 @@ SProcRRQueryVersion (ClientPtr client)
}
static int
-SProcRRGetScreenInfo (ClientPtr client)
+SProcRRGetScreenInfo(ClientPtr client)
{
REQUEST(xRRGetScreenInfoReq);
@@ -44,20 +44,18 @@ SProcRRGetScreenInfo (ClientPtr client)
}
static int
-SProcRRSetScreenConfig (ClientPtr client)
+SProcRRSetScreenConfig(ClientPtr client)
{
REQUEST(xRRSetScreenConfigReq);
- if (RRClientKnowsRates (client))
- {
- REQUEST_SIZE_MATCH (xRRSetScreenConfigReq);
- swaps(&stuff->rate);
+ if (RRClientKnowsRates(client)) {
+ REQUEST_SIZE_MATCH(xRRSetScreenConfigReq);
+ swaps(&stuff->rate);
}
- else
- {
- REQUEST_SIZE_MATCH (xRR1_0SetScreenConfigReq);
+ else {
+ REQUEST_SIZE_MATCH(xRR1_0SetScreenConfigReq);
}
-
+
swaps(&stuff->length);
swapl(&stuff->drawable);
swapl(&stuff->timestamp);
@@ -67,7 +65,7 @@ SProcRRSetScreenConfig (ClientPtr client)
}
static int
-SProcRRSelectInput (ClientPtr client)
+SProcRRSelectInput(ClientPtr client)
{
REQUEST(xRRSelectInputReq);
@@ -78,7 +76,7 @@ SProcRRSelectInput (ClientPtr client)
}
static int
-SProcRRGetScreenSizeRange (ClientPtr client)
+SProcRRGetScreenSizeRange(ClientPtr client)
{
REQUEST(xRRGetScreenSizeRangeReq);
@@ -89,7 +87,7 @@ SProcRRGetScreenSizeRange (ClientPtr client)
}
static int
-SProcRRSetScreenSize (ClientPtr client)
+SProcRRSetScreenSize(ClientPtr client)
{
REQUEST(xRRSetScreenSizeReq);
@@ -104,7 +102,7 @@ SProcRRSetScreenSize (ClientPtr client)
}
static int
-SProcRRGetScreenResources (ClientPtr client)
+SProcRRGetScreenResources(ClientPtr client)
{
REQUEST(xRRGetScreenResourcesReq);
@@ -115,7 +113,7 @@ SProcRRGetScreenResources (ClientPtr client)
}
static int
-SProcRRGetOutputInfo (ClientPtr client)
+SProcRRGetOutputInfo(ClientPtr client)
{
REQUEST(xRRGetOutputInfoReq);
@@ -127,7 +125,7 @@ SProcRRGetOutputInfo (ClientPtr client)
}
static int
-SProcRRListOutputProperties (ClientPtr client)
+SProcRRListOutputProperties(ClientPtr client)
{
REQUEST(xRRListOutputPropertiesReq);
@@ -138,7 +136,7 @@ SProcRRListOutputProperties (ClientPtr client)
}
static int
-SProcRRQueryOutputProperty (ClientPtr client)
+SProcRRQueryOutputProperty(ClientPtr client)
{
REQUEST(xRRQueryOutputPropertyReq);
@@ -150,7 +148,7 @@ SProcRRQueryOutputProperty (ClientPtr client)
}
static int
-SProcRRConfigureOutputProperty (ClientPtr client)
+SProcRRConfigureOutputProperty(ClientPtr client)
{
REQUEST(xRRConfigureOutputPropertyReq);
@@ -162,37 +160,37 @@ SProcRRConfigureOutputProperty (ClientPtr client)
}
static int
-SProcRRChangeOutputProperty (ClientPtr client)
+SProcRRChangeOutputProperty(ClientPtr client)
{
REQUEST(xRRChangeOutputPropertyReq);
- REQUEST_AT_LEAST_SIZE (xRRChangeOutputPropertyReq);
+ REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq);
swaps(&stuff->length);
swapl(&stuff->output);
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->nUnits);
- switch(stuff->format) {
- case 8:
- break;
- case 16:
- SwapRestS(stuff);
- break;
- case 32:
- SwapRestL(stuff);
- break;
- default:
- client->errorValue = stuff->format;
- return BadValue;
+ switch (stuff->format) {
+ case 8:
+ break;
+ case 16:
+ SwapRestS(stuff);
+ break;
+ case 32:
+ SwapRestL(stuff);
+ break;
+ default:
+ client->errorValue = stuff->format;
+ return BadValue;
}
return (*ProcRandrVector[stuff->randrReqType]) (client);
}
static int
-SProcRRDeleteOutputProperty (ClientPtr client)
+SProcRRDeleteOutputProperty(ClientPtr client)
{
REQUEST(xRRDeleteOutputPropertyReq);
-
+
REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
swaps(&stuff->length);
swapl(&stuff->output);
@@ -201,7 +199,7 @@ SProcRRDeleteOutputProperty (ClientPtr client)
}
static int
-SProcRRGetOutputProperty (ClientPtr client)
+SProcRRGetOutputProperty(ClientPtr client)
{
REQUEST(xRRGetOutputPropertyReq);
@@ -216,9 +214,10 @@ SProcRRGetOutputProperty (ClientPtr client)
}
static int
-SProcRRCreateMode (ClientPtr client)
+SProcRRCreateMode(ClientPtr client)
{
xRRModeInfo *modeinfo;
+
REQUEST(xRRCreateModeReq);
REQUEST_AT_LEAST_SIZE(xRRCreateModeReq);
@@ -242,7 +241,7 @@ SProcRRCreateMode (ClientPtr client)
}
static int
-SProcRRDestroyMode (ClientPtr client)
+SProcRRDestroyMode(ClientPtr client)
{
REQUEST(xRRDestroyModeReq);
@@ -253,7 +252,7 @@ SProcRRDestroyMode (ClientPtr client)
}
static int
-SProcRRAddOutputMode (ClientPtr client)
+SProcRRAddOutputMode(ClientPtr client)
{
REQUEST(xRRAddOutputModeReq);
@@ -265,7 +264,7 @@ SProcRRAddOutputMode (ClientPtr client)
}
static int
-SProcRRDeleteOutputMode (ClientPtr client)
+SProcRRDeleteOutputMode(ClientPtr client)
{
REQUEST(xRRDeleteOutputModeReq);
@@ -277,7 +276,7 @@ SProcRRDeleteOutputMode (ClientPtr client)
}
static int
-SProcRRGetCrtcInfo (ClientPtr client)
+SProcRRGetCrtcInfo(ClientPtr client)
{
REQUEST(xRRGetCrtcInfoReq);
@@ -289,7 +288,7 @@ SProcRRGetCrtcInfo (ClientPtr client)
}
static int
-SProcRRSetCrtcConfig (ClientPtr client)
+SProcRRSetCrtcConfig(ClientPtr client)
{
REQUEST(xRRSetCrtcConfigReq);
@@ -307,7 +306,7 @@ SProcRRSetCrtcConfig (ClientPtr client)
}
static int
-SProcRRGetCrtcGammaSize (ClientPtr client)
+SProcRRGetCrtcGammaSize(ClientPtr client)
{
REQUEST(xRRGetCrtcGammaSizeReq);
@@ -318,7 +317,7 @@ SProcRRGetCrtcGammaSize (ClientPtr client)
}
static int
-SProcRRGetCrtcGamma (ClientPtr client)
+SProcRRGetCrtcGamma(ClientPtr client)
{
REQUEST(xRRGetCrtcGammaReq);
@@ -329,7 +328,7 @@ SProcRRGetCrtcGamma (ClientPtr client)
}
static int
-SProcRRSetCrtcGamma (ClientPtr client)
+SProcRRSetCrtcGamma(ClientPtr client)
{
REQUEST(xRRSetCrtcGammaReq);
@@ -342,30 +341,32 @@ SProcRRSetCrtcGamma (ClientPtr client)
}
static int
-SProcRRSetCrtcTransform (ClientPtr client)
+SProcRRSetCrtcTransform(ClientPtr client)
{
int nparams;
char *filter;
CARD32 *params;
+
REQUEST(xRRSetCrtcTransformReq);
REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
swaps(&stuff->length);
swapl(&stuff->crtc);
- SwapLongs((CARD32 *)&stuff->transform, bytes_to_int32(sizeof(xRenderTransform)));
+ SwapLongs((CARD32 *) &stuff->transform,
+ bytes_to_int32(sizeof(xRenderTransform)));
swaps(&stuff->nbytesFilter);
- filter = (char *)(stuff + 1);
+ filter = (char *) (stuff + 1);
params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter));
nparams = ((CARD32 *) stuff + client->req_len) - params;
if (nparams < 0)
- return BadLength;
+ return BadLength;
SwapLongs(params, nparams);
return (*ProcRandrVector[stuff->randrReqType]) (client);
}
static int
-SProcRRGetCrtcTransform (ClientPtr client)
+SProcRRGetCrtcTransform(ClientPtr client)
{
REQUEST(xRRGetCrtcTransformReq);
@@ -376,10 +377,10 @@ SProcRRGetCrtcTransform (ClientPtr client)
}
static int
-SProcRRGetPanning (ClientPtr client)
+SProcRRGetPanning(ClientPtr client)
{
REQUEST(xRRGetPanningReq);
-
+
REQUEST_SIZE_MATCH(xRRGetPanningReq);
swaps(&stuff->length);
swapl(&stuff->crtc);
@@ -387,10 +388,10 @@ SProcRRGetPanning (ClientPtr client)
}
static int
-SProcRRSetPanning (ClientPtr client)
+SProcRRSetPanning(ClientPtr client)
{
REQUEST(xRRSetPanningReq);
-
+
REQUEST_SIZE_MATCH(xRRSetPanningReq);
swaps(&stuff->length);
swapl(&stuff->crtc);
@@ -411,7 +412,7 @@ SProcRRSetPanning (ClientPtr client)
}
static int
-SProcRRSetOutputPrimary (ClientPtr client)
+SProcRRSetOutputPrimary(ClientPtr client)
{
REQUEST(xRRSetOutputPrimaryReq);
@@ -419,57 +420,56 @@ SProcRRSetOutputPrimary (ClientPtr client)
swaps(&stuff->length);
swapl(&stuff->window);
swapl(&stuff->output);
- return ProcRandrVector[stuff->randrReqType](client);
+ return ProcRandrVector[stuff->randrReqType] (client);
}
static int
-SProcRRGetOutputPrimary (ClientPtr client)
+SProcRRGetOutputPrimary(ClientPtr client)
{
REQUEST(xRRGetOutputPrimaryReq);
REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
swaps(&stuff->length);
swapl(&stuff->window);
- return ProcRandrVector[stuff->randrReqType](client);
+ return ProcRandrVector[stuff->randrReqType] (client);
}
-int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
- SProcRRQueryVersion, /* 0 */
+int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {
+ SProcRRQueryVersion, /* 0 */
/* we skip 1 to make old clients fail pretty immediately */
- NULL, /* 1 SProcRandrOldGetScreenInfo */
+ NULL, /* 1 SProcRandrOldGetScreenInfo */
/* V1.0 apps share the same set screen config request id */
- SProcRRSetScreenConfig, /* 2 */
- NULL, /* 3 SProcRandrOldScreenChangeSelectInput */
+ SProcRRSetScreenConfig, /* 2 */
+ NULL, /* 3 SProcRandrOldScreenChangeSelectInput */
/* 3 used to be ScreenChangeSelectInput; deprecated */
- SProcRRSelectInput, /* 4 */
- SProcRRGetScreenInfo, /* 5 */
+ SProcRRSelectInput, /* 4 */
+ SProcRRGetScreenInfo, /* 5 */
/* V1.2 additions */
- SProcRRGetScreenSizeRange, /* 6 */
- SProcRRSetScreenSize, /* 7 */
- SProcRRGetScreenResources, /* 8 */
- SProcRRGetOutputInfo, /* 9 */
- SProcRRListOutputProperties,/* 10 */
- SProcRRQueryOutputProperty, /* 11 */
- SProcRRConfigureOutputProperty, /* 12 */
- SProcRRChangeOutputProperty,/* 13 */
- SProcRRDeleteOutputProperty,/* 14 */
- SProcRRGetOutputProperty, /* 15 */
- SProcRRCreateMode, /* 16 */
- SProcRRDestroyMode, /* 17 */
- SProcRRAddOutputMode, /* 18 */
- SProcRRDeleteOutputMode, /* 19 */
- SProcRRGetCrtcInfo, /* 20 */
- SProcRRSetCrtcConfig, /* 21 */
- SProcRRGetCrtcGammaSize, /* 22 */
- SProcRRGetCrtcGamma, /* 23 */
- SProcRRSetCrtcGamma, /* 24 */
+ SProcRRGetScreenSizeRange, /* 6 */
+ SProcRRSetScreenSize, /* 7 */
+ SProcRRGetScreenResources, /* 8 */
+ SProcRRGetOutputInfo, /* 9 */
+ SProcRRListOutputProperties, /* 10 */
+ SProcRRQueryOutputProperty, /* 11 */
+ SProcRRConfigureOutputProperty, /* 12 */
+ SProcRRChangeOutputProperty, /* 13 */
+ SProcRRDeleteOutputProperty, /* 14 */
+ SProcRRGetOutputProperty, /* 15 */
+ SProcRRCreateMode, /* 16 */
+ SProcRRDestroyMode, /* 17 */
+ SProcRRAddOutputMode, /* 18 */
+ SProcRRDeleteOutputMode, /* 19 */
+ SProcRRGetCrtcInfo, /* 20 */
+ SProcRRSetCrtcConfig, /* 21 */
+ SProcRRGetCrtcGammaSize, /* 22 */
+ SProcRRGetCrtcGamma, /* 23 */
+ SProcRRSetCrtcGamma, /* 24 */
/* V1.3 additions */
- SProcRRGetScreenResources, /* 25 GetScreenResourcesCurrent */
- SProcRRSetCrtcTransform, /* 26 */
- SProcRRGetCrtcTransform, /* 27 */
- SProcRRGetPanning, /* 28 */
- SProcRRSetPanning, /* 29 */
- SProcRRSetOutputPrimary, /* 30 */
- SProcRRGetOutputPrimary, /* 31 */
+ SProcRRGetScreenResources, /* 25 GetScreenResourcesCurrent */
+ SProcRRSetCrtcTransform, /* 26 */
+ SProcRRGetCrtcTransform, /* 27 */
+ SProcRRGetPanning, /* 28 */
+ SProcRRSetPanning, /* 29 */
+ SProcRRSetOutputPrimary, /* 30 */
+ SProcRRGetOutputPrimary, /* 31 */
};
-
diff --git a/xorg-server/randr/rrtransform.c b/xorg-server/randr/rrtransform.c
index e1620498b..f93181d2e 100644
--- a/xorg-server/randr/rrtransform.c
+++ b/xorg-server/randr/rrtransform.c
@@ -24,63 +24,59 @@
#include "rrtransform.h"
void
-RRTransformInit (RRTransformPtr transform)
+RRTransformInit(RRTransformPtr transform)
{
- pixman_transform_init_identity (&transform->transform);
- pixman_f_transform_init_identity (&transform->f_transform);
- pixman_f_transform_init_identity (&transform->f_inverse);
+ pixman_transform_init_identity(&transform->transform);
+ pixman_f_transform_init_identity(&transform->f_transform);
+ pixman_f_transform_init_identity(&transform->f_inverse);
transform->filter = NULL;
transform->params = NULL;
transform->nparams = 0;
}
void
-RRTransformFini (RRTransformPtr transform)
+RRTransformFini(RRTransformPtr transform)
{
free(transform->params);
}
Bool
-RRTransformEqual (RRTransformPtr a, RRTransformPtr b)
+RRTransformEqual(RRTransformPtr a, RRTransformPtr b)
{
- if (a && pixman_transform_is_identity (&a->transform))
- a = NULL;
- if (b && pixman_transform_is_identity (&b->transform))
- b = NULL;
+ if (a && pixman_transform_is_identity(&a->transform))
+ a = NULL;
+ if (b && pixman_transform_is_identity(&b->transform))
+ b = NULL;
if (a == NULL && b == NULL)
- return TRUE;
+ return TRUE;
if (a == NULL || b == NULL)
- return FALSE;
- if (memcmp (&a->transform, &b->transform, sizeof (a->transform)) != 0)
- return FALSE;
+ return FALSE;
+ if (memcmp(&a->transform, &b->transform, sizeof(a->transform)) != 0)
+ return FALSE;
if (a->filter != b->filter)
- return FALSE;
+ return FALSE;
if (a->nparams != b->nparams)
- return FALSE;
- if (memcmp (a->params, b->params, a->nparams * sizeof (xFixed)) != 0)
- return FALSE;
+ return FALSE;
+ if (memcmp(a->params, b->params, a->nparams * sizeof(xFixed)) != 0)
+ return FALSE;
return TRUE;
}
Bool
-RRTransformSetFilter (RRTransformPtr dst,
- PictFilterPtr filter,
- xFixed *params,
- int nparams,
- int width,
- int height)
+RRTransformSetFilter(RRTransformPtr dst,
+ PictFilterPtr filter,
+ xFixed * params, int nparams, int width, int height)
{
- xFixed *new_params;
+ xFixed *new_params;
- if (nparams)
- {
- new_params = malloc(nparams * sizeof (xFixed));
- if (!new_params)
- return FALSE;
- memcpy (new_params, params, nparams * sizeof (xFixed));
+ if (nparams) {
+ new_params = malloc(nparams * sizeof(xFixed));
+ if (!new_params)
+ return FALSE;
+ memcpy(new_params, params, nparams * sizeof(xFixed));
}
else
- new_params = NULL;
+ new_params = NULL;
free(dst->params);
dst->filter = filter;
dst->params = new_params;
@@ -91,27 +87,26 @@ RRTransformSetFilter (RRTransformPtr dst,
}
Bool
-RRTransformCopy (RRTransformPtr dst, RRTransformPtr src)
+RRTransformCopy(RRTransformPtr dst, RRTransformPtr src)
{
- if (src && pixman_transform_is_identity (&src->transform))
- src = NULL;
+ if (src && pixman_transform_is_identity(&src->transform))
+ src = NULL;
- if (src)
- {
- if (!RRTransformSetFilter (dst, src->filter,
- src->params, src->nparams, src->width, src->height))
- return FALSE;
- dst->transform = src->transform;
- dst->f_transform = src->f_transform;
- dst->f_inverse = src->f_inverse;
+ if (src) {
+ if (!RRTransformSetFilter(dst, src->filter,
+ src->params, src->nparams, src->width,
+ src->height))
+ return FALSE;
+ dst->transform = src->transform;
+ dst->f_transform = src->f_transform;
+ dst->f_inverse = src->f_inverse;
}
- else
- {
- if (!RRTransformSetFilter (dst, NULL, NULL, 0, 0, 0))
- return FALSE;
- pixman_transform_init_identity (&dst->transform);
- pixman_f_transform_init_identity (&dst->f_transform);
- pixman_f_transform_init_identity (&dst->f_inverse);
+ else {
+ if (!RRTransformSetFilter(dst, NULL, NULL, 0, 0, 0))
+ return FALSE;
+ pixman_transform_init_identity(&dst->transform);
+ pixman_f_transform_init_identity(&dst->f_transform);
+ pixman_f_transform_init_identity(&dst->f_inverse);
}
return TRUE;
}
@@ -125,13 +120,13 @@ RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
int i, j;
for (j = 0; j < 3; j++)
- for (i = 0; i < 3; i++)
- if ((v = abs (f_transform->m[j][i])) > max)
- max = v;
+ for (i = 0; i < 3; i++)
+ if ((v = abs(f_transform->m[j][i])) > max)
+ max = v;
scale = limit / max;
for (j = 0; j < 3; j++)
- for (i = 0; i < 3; i++)
- f_transform->m[j][i] *= scale;
+ for (i = 0; i < 3; i++)
+ f_transform->m[j][i] *= scale;
}
/*
@@ -142,142 +137,161 @@ RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
* Return TRUE if the resulting transform is not a simple translation.
*/
Bool
-RRTransformCompute (int x,
- int y,
- int width,
- int height,
- Rotation rotation,
- RRTransformPtr rr_transform,
-
- PictTransformPtr transform,
- struct pixman_f_transform *f_transform,
- struct pixman_f_transform *f_inverse)
+RRTransformCompute(int x,
+ int y,
+ int width,
+ int height,
+ Rotation rotation,
+ RRTransformPtr rr_transform,
+ PictTransformPtr transform,
+ struct pixman_f_transform *f_transform,
+ struct pixman_f_transform *f_inverse)
{
- PictTransform t_transform, inverse;
+ PictTransform t_transform, inverse;
struct pixman_f_transform tf_transform, tf_inverse;
- Bool overflow = FALSE;
+ Bool overflow = FALSE;
+
+ if (!transform)
+ transform = &t_transform;
+ if (!f_transform)
+ f_transform = &tf_transform;
+ if (!f_inverse)
+ f_inverse = &tf_inverse;
+
+ pixman_transform_init_identity(transform);
+ pixman_transform_init_identity(&inverse);
+ pixman_f_transform_init_identity(f_transform);
+ pixman_f_transform_init_identity(f_inverse);
+ if (rotation != RR_Rotate_0) {
+ double f_rot_cos, f_rot_sin, f_rot_dx, f_rot_dy;
+ double f_scale_x, f_scale_y, f_scale_dx, f_scale_dy;
+ xFixed rot_cos, rot_sin, rot_dx, rot_dy;
+ xFixed scale_x, scale_y, scale_dx, scale_dy;
- if (!transform) transform = &t_transform;
- if (!f_transform) f_transform = &tf_transform;
- if (!f_inverse) f_inverse = &tf_inverse;
+ /* rotation */
+ switch (rotation & 0xf) {
+ default:
+ case RR_Rotate_0:
+ f_rot_cos = 1;
+ f_rot_sin = 0;
+ f_rot_dx = 0;
+ f_rot_dy = 0;
+ rot_cos = F(1);
+ rot_sin = F(0);
+ rot_dx = F(0);
+ rot_dy = F(0);
+ break;
+ case RR_Rotate_90:
+ f_rot_cos = 0;
+ f_rot_sin = 1;
+ f_rot_dx = height;
+ f_rot_dy = 0;
+ rot_cos = F(0);
+ rot_sin = F(1);
+ rot_dx = F(height);
+ rot_dy = F(0);
+ break;
+ case RR_Rotate_180:
+ f_rot_cos = -1;
+ f_rot_sin = 0;
+ f_rot_dx = width;
+ f_rot_dy = height;
+ rot_cos = F(-1);
+ rot_sin = F(0);
+ rot_dx = F(width);
+ rot_dy = F(height);
+ break;
+ case RR_Rotate_270:
+ f_rot_cos = 0;
+ f_rot_sin = -1;
+ f_rot_dx = 0;
+ f_rot_dy = width;
+ rot_cos = F(0);
+ rot_sin = F(-1);
+ rot_dx = F(0);
+ rot_dy = F(width);
+ break;
+ }
- pixman_transform_init_identity (transform);
- pixman_transform_init_identity (&inverse);
- pixman_f_transform_init_identity (f_transform);
- pixman_f_transform_init_identity (f_inverse);
- if (rotation != RR_Rotate_0)
- {
- double f_rot_cos, f_rot_sin, f_rot_dx, f_rot_dy;
- double f_scale_x, f_scale_y, f_scale_dx, f_scale_dy;
- xFixed rot_cos, rot_sin, rot_dx, rot_dy;
- xFixed scale_x, scale_y, scale_dx, scale_dy;
+ pixman_transform_rotate(transform, &inverse, rot_cos, rot_sin);
+ pixman_transform_translate(transform, &inverse, rot_dx, rot_dy);
+ pixman_f_transform_rotate(f_transform, f_inverse, f_rot_cos, f_rot_sin);
+ pixman_f_transform_translate(f_transform, f_inverse, f_rot_dx,
+ f_rot_dy);
- /* rotation */
- switch (rotation & 0xf) {
- default:
- case RR_Rotate_0:
- f_rot_cos = 1; f_rot_sin = 0;
- f_rot_dx = 0; f_rot_dy = 0;
- rot_cos = F ( 1); rot_sin = F ( 0);
- rot_dx = F ( 0); rot_dy = F ( 0);
- break;
- case RR_Rotate_90:
- f_rot_cos = 0; f_rot_sin = 1;
- f_rot_dx = height; f_rot_dy = 0;
- rot_cos = F ( 0); rot_sin = F ( 1);
- rot_dx = F ( height); rot_dy = F (0);
- break;
- case RR_Rotate_180:
- f_rot_cos = -1; f_rot_sin = 0;
- f_rot_dx = width; f_rot_dy = height;
- rot_cos = F (-1); rot_sin = F ( 0);
- rot_dx = F (width); rot_dy = F ( height);
- break;
- case RR_Rotate_270:
- f_rot_cos = 0; f_rot_sin = -1;
- f_rot_dx = 0; f_rot_dy = width;
- rot_cos = F ( 0); rot_sin = F (-1);
- rot_dx = F ( 0); rot_dy = F ( width);
- break;
- }
-
- pixman_transform_rotate (transform, &inverse, rot_cos, rot_sin);
- pixman_transform_translate (transform, &inverse, rot_dx, rot_dy);
- pixman_f_transform_rotate (f_transform, f_inverse, f_rot_cos, f_rot_sin);
- pixman_f_transform_translate (f_transform, f_inverse, f_rot_dx, f_rot_dy);
+ /* reflection */
+ f_scale_x = 1;
+ f_scale_dx = 0;
+ f_scale_y = 1;
+ f_scale_dy = 0;
+ scale_x = F(1);
+ scale_dx = 0;
+ scale_y = F(1);
+ scale_dy = 0;
+ if (rotation & RR_Reflect_X) {
+ f_scale_x = -1;
+ scale_x = F(-1);
+ if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
+ f_scale_dx = width;
+ scale_dx = F(width);
+ }
+ else {
+ f_scale_dx = height;
+ scale_dx = F(height);
+ }
+ }
+ if (rotation & RR_Reflect_Y) {
+ f_scale_y = -1;
+ scale_y = F(-1);
+ if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
+ f_scale_dy = height;
+ scale_dy = F(height);
+ }
+ else {
+ f_scale_dy = width;
+ scale_dy = F(width);
+ }
+ }
- /* reflection */
- f_scale_x = 1;
- f_scale_dx = 0;
- f_scale_y = 1;
- f_scale_dy = 0;
- scale_x = F (1);
- scale_dx = 0;
- scale_y = F (1);
- scale_dy = 0;
- if (rotation & RR_Reflect_X)
- {
- f_scale_x = -1;
- scale_x = F(-1);
- if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
- f_scale_dx = width;
- scale_dx = F(width);
- } else {
- f_scale_dx = height;
- scale_dx = F(height);
- }
- }
- if (rotation & RR_Reflect_Y)
- {
- f_scale_y = -1;
- scale_y = F(-1);
- if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
- f_scale_dy = height;
- scale_dy = F(height);
- } else {
- f_scale_dy = width;
- scale_dy = F(width);
- }
- }
-
- pixman_transform_scale (transform, &inverse, scale_x, scale_y);
- pixman_f_transform_scale (f_transform, f_inverse, f_scale_x, f_scale_y);
- pixman_transform_translate (transform, &inverse, scale_dx, scale_dy);
- pixman_f_transform_translate (f_transform, f_inverse, f_scale_dx, f_scale_dy);
+ pixman_transform_scale(transform, &inverse, scale_x, scale_y);
+ pixman_f_transform_scale(f_transform, f_inverse, f_scale_x, f_scale_y);
+ pixman_transform_translate(transform, &inverse, scale_dx, scale_dy);
+ pixman_f_transform_translate(f_transform, f_inverse, f_scale_dx,
+ f_scale_dy);
}
-
+
#ifdef RANDR_12_INTERFACE
- if (rr_transform)
- {
- if (!pixman_transform_multiply (transform, &rr_transform->transform, transform))
- overflow = TRUE;
- pixman_f_transform_multiply (f_transform, &rr_transform->f_transform, f_transform);
- pixman_f_transform_multiply (f_inverse, f_inverse, &rr_transform->f_inverse);
+ if (rr_transform) {
+ if (!pixman_transform_multiply
+ (transform, &rr_transform->transform, transform))
+ overflow = TRUE;
+ pixman_f_transform_multiply(f_transform, &rr_transform->f_transform,
+ f_transform);
+ pixman_f_transform_multiply(f_inverse, f_inverse,
+ &rr_transform->f_inverse);
}
#endif
/*
* Compute the class of the resulting transform
*/
- if (!overflow && pixman_transform_is_identity (transform))
- {
- pixman_transform_init_translate (transform, F ( x), F ( y));
+ if (!overflow && pixman_transform_is_identity(transform)) {
+ pixman_transform_init_translate(transform, F(x), F(y));
- pixman_f_transform_init_translate (f_transform, x, y);
- pixman_f_transform_init_translate (f_inverse, -x, -y);
- return FALSE;
+ pixman_f_transform_init_translate(f_transform, x, y);
+ pixman_f_transform_init_translate(f_inverse, -x, -y);
+ return FALSE;
}
- else
- {
- pixman_f_transform_translate (f_transform, f_inverse, x, y);
- if (!pixman_transform_translate (transform, &inverse, F(x), F(y)))
- overflow = TRUE;
- if (overflow)
- {
- struct pixman_f_transform f_scaled;
- f_scaled = *f_transform;
- RRTransformRescale(&f_scaled, 16384.0);
- pixman_transform_from_pixman_f_transform(transform, &f_scaled);
- }
- return TRUE;
+ else {
+ pixman_f_transform_translate(f_transform, f_inverse, x, y);
+ if (!pixman_transform_translate(transform, &inverse, F(x), F(y)))
+ overflow = TRUE;
+ if (overflow) {
+ struct pixman_f_transform f_scaled;
+
+ f_scaled = *f_transform;
+ RRTransformRescale(&f_scaled, 16384.0);
+ pixman_transform_from_pixman_f_transform(transform, &f_scaled);
+ }
+ return TRUE;
}
}
diff --git a/xorg-server/randr/rrtransform.h b/xorg-server/randr/rrtransform.h
index 561762dfe..efce7e0d7 100644
--- a/xorg-server/randr/rrtransform.h
+++ b/xorg-server/randr/rrtransform.h
@@ -26,50 +26,47 @@
#include <X11/extensions/randr.h>
#include "picturestr.h"
-typedef struct _rrTransform RRTransformRec, *RRTransformPtr;
+typedef struct _rrTransform RRTransformRec, *RRTransformPtr;
struct _rrTransform {
- PictTransform transform;
+ PictTransform transform;
struct pict_f_transform f_transform;
struct pict_f_transform f_inverse;
- PictFilterPtr filter;
- xFixed *params;
- int nparams;
- int width;
- int height;
+ PictFilterPtr filter;
+ xFixed *params;
+ int nparams;
+ int width;
+ int height;
};
extern _X_EXPORT void
-RRTransformInit (RRTransformPtr transform);
+ RRTransformInit(RRTransformPtr transform);
extern _X_EXPORT void
-RRTransformFini (RRTransformPtr transform);
+ RRTransformFini(RRTransformPtr transform);
extern _X_EXPORT Bool
-RRTransformEqual (RRTransformPtr a, RRTransformPtr b);
+ RRTransformEqual(RRTransformPtr a, RRTransformPtr b);
extern _X_EXPORT Bool
-RRTransformSetFilter (RRTransformPtr dst,
- PictFilterPtr filter,
- xFixed *params,
- int nparams,
- int width,
- int height);
-extern _X_EXPORT Bool
-RRTransformCopy (RRTransformPtr dst, RRTransformPtr src);
+RRTransformSetFilter(RRTransformPtr dst,
+ PictFilterPtr filter,
+ xFixed * params, int nparams, int width, int height);
extern _X_EXPORT Bool
-RRTransformCompute (int x,
- int y,
- int width,
- int height,
- Rotation rotation,
- RRTransformPtr rr_transform,
+ RRTransformCopy(RRTransformPtr dst, RRTransformPtr src);
- PictTransformPtr transform,
- struct pict_f_transform *f_transform,
- struct pict_f_transform *f_inverse);
+extern _X_EXPORT Bool
+RRTransformCompute(int x,
+ int y,
+ int width,
+ int height,
+ Rotation rotation,
+ RRTransformPtr rr_transform,
+ PictTransformPtr transform,
+ struct pict_f_transform *f_transform,
+ struct pict_f_transform *f_inverse);
-#endif /* _RRTRANSFORM_H_ */
+#endif /* _RRTRANSFORM_H_ */
diff --git a/xorg-server/randr/rrxinerama.c b/xorg-server/randr/rrxinerama.c
index 6d4519043..aa8a61eee 100644
--- a/xorg-server/randr/rrxinerama.c
+++ b/xorg-server/randr/rrxinerama.c
@@ -89,7 +89,7 @@ static int SProcRRXineramaDispatch(ClientPtr client);
int
ProcRRXineramaQueryVersion(ClientPtr client)
{
- xPanoramiXQueryVersionReply rep;
+ xPanoramiXQueryVersionReply rep;
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
rep.type = X_Reply;
@@ -97,13 +97,13 @@ ProcRRXineramaQueryVersion(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION;
rep.minorVersion = SERVER_RRXINERAMA_MINOR_VERSION;
- if(client->swapped) {
+ if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *) &rep);
return Success;
}
@@ -111,24 +111,23 @@ int
ProcRRXineramaGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
- WindowPtr pWin;
- xPanoramiXGetStateReply rep;
- register int rc;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- Bool active = FALSE;
+ WindowPtr pWin;
+ xPanoramiXGetStateReply rep;
+ register int rc;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ Bool active = FALSE;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
- if(rc != Success)
- return rc;
+ if (rc != Success)
+ return rc;
pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
- if (pScrPriv)
- {
- /* XXX do we need more than this? */
- active = TRUE;
+ if (pScrPriv) {
+ /* XXX do we need more than this? */
+ active = TRUE;
}
rep.type = X_Reply;
@@ -136,67 +135,66 @@ ProcRRXineramaGetState(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.state = active;
rep.window = stuff->window;
- if(client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.window);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.window);
}
- WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep);
+ WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *) &rep);
return Success;
}
static Bool
-RRXineramaCrtcActive (RRCrtcPtr crtc)
+RRXineramaCrtcActive(RRCrtcPtr crtc)
{
return crtc->mode != NULL && crtc->numOutputs > 0;
}
static int
-RRXineramaScreenCount (ScreenPtr pScreen)
+RRXineramaScreenCount(ScreenPtr pScreen)
{
- int i, n;
-
+ int i, n;
+
n = 0;
- if (rrGetScrPriv (pScreen))
- {
- rrScrPriv(pScreen);
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- if (RRXineramaCrtcActive (pScrPriv->crtcs[i]))
- n++;
+ if (rrGetScrPriv(pScreen)) {
+ rrScrPriv(pScreen);
+ for (i = 0; i < pScrPriv->numCrtcs; i++)
+ if (RRXineramaCrtcActive(pScrPriv->crtcs[i]))
+ n++;
}
return n;
}
static Bool
-RRXineramaScreenActive (ScreenPtr pScreen)
+RRXineramaScreenActive(ScreenPtr pScreen)
{
- return RRXineramaScreenCount (pScreen) > 0;
+ return RRXineramaScreenCount(pScreen) > 0;
}
int
ProcRRXineramaGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
- WindowPtr pWin;
- xPanoramiXGetScreenCountReply rep;
- register int rc;
+ WindowPtr pWin;
+ xPanoramiXGetScreenCountReply rep;
+ register int rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
-
+ return rc;
+
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.ScreenCount = RRXineramaScreenCount (pWin->drawable.pScreen);
+ rep.ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen);
rep.window = stuff->window;
- if(client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.window);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.window);
}
- WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
+ WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *) &rep);
return Success;
}
@@ -204,42 +202,42 @@ int
ProcRRXineramaGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
- WindowPtr pWin, pRoot;
- ScreenPtr pScreen;
- xPanoramiXGetScreenSizeReply rep;
- register int rc;
+ WindowPtr pWin, pRoot;
+ ScreenPtr pScreen;
+ xPanoramiXGetScreenSizeReply rep;
+ register int rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
pScreen = pWin->drawable.pScreen;
pRoot = pScreen->root;
-
+
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.width = pRoot->drawable.width;
+ rep.width = pRoot->drawable.width;
rep.height = pRoot->drawable.height;
rep.window = stuff->window;
rep.screen = stuff->screen;
- if(client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.width);
- swapl(&rep.height);
- swapl(&rep.window);
- swapl(&rep.screen);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.width);
+ swapl(&rep.height);
+ swapl(&rep.window);
+ swapl(&rep.screen);
}
- WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
+ WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep);
return Success;
}
int
ProcRRXineramaIsActive(ClientPtr client)
{
- xXineramaIsActiveReply rep;
+ xXineramaIsActiveReply rep;
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
@@ -247,11 +245,11 @@ ProcRRXineramaIsActive(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.state = RRXineramaScreenActive (screenInfo.screens[RR_XINERAMA_SCREEN]);
- if(client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.state);
+ rep.state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.state);
}
WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
return Success;
@@ -262,79 +260,80 @@ RRXineramaWriteCrtc(ClientPtr client, RRCrtcPtr crtc)
{
xXineramaScreenInfo scratch;
- if (RRXineramaCrtcActive (crtc))
- {
- ScreenPtr pScreen = crtc->pScreen;
- rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
- BoxRec panned_area;
-
- /* Check to see if crtc is panned and return the full area when applicable. */
- if (pScrPriv && pScrPriv->rrGetPanning &&
- pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) &&
- (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) {
- scratch.x_org = panned_area.x1;
- scratch.y_org = panned_area.y1;
- scratch.width = panned_area.x2 - panned_area.x1;
- scratch.height = panned_area.y2 - panned_area.y1;
- } else {
- int width, height;
- RRCrtcGetScanoutSize (crtc, &width, &height);
- scratch.x_org = crtc->x;
- scratch.y_org = crtc->y;
- scratch.width = width;
- scratch.height = height;
- }
- if(client->swapped) {
- swaps(&scratch.x_org);
- swaps(&scratch.y_org);
- swaps(&scratch.width);
- swaps(&scratch.height);
- }
- WriteToClient(client, sz_XineramaScreenInfo, &scratch);
+ if (RRXineramaCrtcActive(crtc)) {
+ ScreenPtr pScreen = crtc->pScreen;
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
+ BoxRec panned_area;
+
+ /* Check to see if crtc is panned and return the full area when applicable. */
+ if (pScrPriv && pScrPriv->rrGetPanning &&
+ pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
+ (panned_area.x2 > panned_area.x1) &&
+ (panned_area.y2 > panned_area.y1)) {
+ scratch.x_org = panned_area.x1;
+ scratch.y_org = panned_area.y1;
+ scratch.width = panned_area.x2 - panned_area.x1;
+ scratch.height = panned_area.y2 - panned_area.y1;
+ }
+ else {
+ int width, height;
+
+ RRCrtcGetScanoutSize(crtc, &width, &height);
+ scratch.x_org = crtc->x;
+ scratch.y_org = crtc->y;
+ scratch.width = width;
+ scratch.height = height;
+ }
+ if (client->swapped) {
+ swaps(&scratch.x_org);
+ swaps(&scratch.y_org);
+ swaps(&scratch.width);
+ swaps(&scratch.height);
+ }
+ WriteToClient(client, sz_XineramaScreenInfo, &scratch);
}
}
int
ProcRRXineramaQueryScreens(ClientPtr client)
{
- xXineramaQueryScreensReply rep;
- ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN];
+ xXineramaQueryScreensReply rep;
+ ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN];
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
- if (RRXineramaScreenActive (pScreen))
- RRGetInfo (pScreen, FALSE);
+ if (RRXineramaScreenActive(pScreen))
+ RRGetInfo(pScreen, FALSE);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.number = RRXineramaScreenCount (pScreen);
+ rep.number = RRXineramaScreenCount(pScreen);
rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
- if(client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.number);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.number);
}
- WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *)&rep);
-
- if(rep.number) {
- rrScrPriv(pScreen);
- int i;
- int has_primary = 0;
-
- if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) {
- has_primary = 1;
- RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc);
- }
-
- for(i = 0; i < pScrPriv->numCrtcs; i++) {
- if (has_primary &&
- pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
- {
- has_primary = 0;
- continue;
- }
- RRXineramaWriteCrtc(client, pScrPriv->crtcs[i]);
- }
+ WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep);
+
+ if (rep.number) {
+ rrScrPriv(pScreen);
+ int i;
+ int has_primary = 0;
+
+ if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) {
+ has_primary = 1;
+ RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc);
+ }
+
+ for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ if (has_primary &&
+ pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i]) {
+ has_primary = 0;
+ continue;
+ }
+ RRXineramaWriteCrtc(client, pScrPriv->crtcs[i]);
+ }
}
return Success;
@@ -345,18 +344,18 @@ ProcRRXineramaDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
- case X_PanoramiXQueryVersion:
- return ProcRRXineramaQueryVersion(client);
- case X_PanoramiXGetState:
- return ProcRRXineramaGetState(client);
- case X_PanoramiXGetScreenCount:
- return ProcRRXineramaGetScreenCount(client);
- case X_PanoramiXGetScreenSize:
- return ProcRRXineramaGetScreenSize(client);
- case X_XineramaIsActive:
- return ProcRRXineramaIsActive(client);
- case X_XineramaQueryScreens:
- return ProcRRXineramaQueryScreens(client);
+ case X_PanoramiXQueryVersion:
+ return ProcRRXineramaQueryVersion(client);
+ case X_PanoramiXGetState:
+ return ProcRRXineramaGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return ProcRRXineramaGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return ProcRRXineramaGetScreenSize(client);
+ case X_XineramaIsActive:
+ return ProcRRXineramaIsActive(client);
+ case X_XineramaQueryScreens:
+ return ProcRRXineramaQueryScreens(client);
}
return BadRequest;
}
@@ -364,11 +363,11 @@ ProcRRXineramaDispatch(ClientPtr client)
/* SProc */
static int
-SProcRRXineramaQueryVersion (ClientPtr client)
+SProcRRXineramaQueryVersion(ClientPtr client)
{
REQUEST(xPanoramiXQueryVersionReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
return ProcRRXineramaQueryVersion(client);
}
@@ -426,18 +425,18 @@ SProcRRXineramaDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
- case X_PanoramiXQueryVersion:
- return SProcRRXineramaQueryVersion(client);
- case X_PanoramiXGetState:
- return SProcRRXineramaGetState(client);
- case X_PanoramiXGetScreenCount:
- return SProcRRXineramaGetScreenCount(client);
- case X_PanoramiXGetScreenSize:
- return SProcRRXineramaGetScreenSize(client);
- case X_XineramaIsActive:
- return SProcRRXineramaIsActive(client);
- case X_XineramaQueryScreens:
- return SProcRRXineramaQueryScreens(client);
+ case X_PanoramiXQueryVersion:
+ return SProcRRXineramaQueryVersion(client);
+ case X_PanoramiXGetState:
+ return SProcRRXineramaGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return SProcRRXineramaGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return SProcRRXineramaGetScreenSize(client);
+ case X_XineramaIsActive:
+ return SProcRRXineramaIsActive(client);
+ case X_XineramaQueryScreens:
+ return SProcRRXineramaQueryScreens(client);
}
return BadRequest;
}
@@ -446,8 +445,8 @@ void
RRXineramaExtensionInit(void)
{
#ifdef PANORAMIX
- if(!noPanoramiXExtension)
- return;
+ if (!noPanoramiXExtension)
+ return;
#endif
/*
@@ -456,11 +455,9 @@ RRXineramaExtensionInit(void)
* screen, just don't even try.
*/
if (screenInfo.numScreens > 1)
- return;
+ return;
- (void) AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0,
- ProcRRXineramaDispatch,
- SProcRRXineramaDispatch,
- NULL,
- StandardMinorOpcode);
+ (void) AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
+ ProcRRXineramaDispatch,
+ SProcRRXineramaDispatch, NULL, StandardMinorOpcode);
}
diff --git a/xorg-server/record/record.c b/xorg-server/record/record.c
index b956b4ab8..8a38118cd 100644
--- a/xorg-server/record/record.c
+++ b/xorg-server/record/record.c
@@ -45,7 +45,6 @@ and Jim Haggerty of Metheus.
#include "eventconvert.h"
#include "scrnintstr.h"
-
#include <stdio.h>
#include <assert.h>
@@ -58,7 +57,7 @@ and Jim Haggerty of Metheus.
#include "protocol-versions.h"
-static RESTYPE RTContext; /* internal resource type for Record contexts */
+static RESTYPE RTContext; /* internal resource type for Record contexts */
/* How many bytes of protocol data to buffer in a context. Don't set to less
* than 32.
@@ -68,16 +67,16 @@ static RESTYPE RTContext; /* internal resource type for Record contexts */
/* Record Context structure */
typedef struct {
- XID id; /* resource id of context */
- ClientPtr pRecordingClient; /* client that has context enabled */
- struct _RecordClientsAndProtocolRec *pListOfRCAP; /* all registered info */
- ClientPtr pBufClient; /* client whose protocol is in replyBuffer*/
- unsigned int continuedReply:1; /* recording a reply that is split up? */
- char elemHeaders; /* element header flags (time/seq no.) */
- char bufCategory; /* category of protocol in replyBuffer */
- int numBufBytes; /* number of bytes in replyBuffer */
- char replyBuffer[REPLY_BUF_SIZE]; /* buffered recorded protocol */
- int inFlush; /* are we inside RecordFlushReplyBuffer */
+ XID id; /* resource id of context */
+ ClientPtr pRecordingClient; /* client that has context enabled */
+ struct _RecordClientsAndProtocolRec *pListOfRCAP; /* all registered info */
+ ClientPtr pBufClient; /* client whose protocol is in replyBuffer */
+ unsigned int continuedReply:1; /* recording a reply that is split up? */
+ char elemHeaders; /* element header flags (time/seq no.) */
+ char bufCategory; /* category of protocol in replyBuffer */
+ int numBufBytes; /* number of bytes in replyBuffer */
+ char replyBuffer[REPLY_BUF_SIZE]; /* buffered recorded protocol */
+ int inFlush; /* are we inside RecordFlushReplyBuffer */
} RecordContextRec, *RecordContextPtr;
/* RecordMinorOpRec - to hold minor opcode selections for extension requests
@@ -85,15 +84,14 @@ typedef struct {
*/
typedef union {
- int count; /* first element of array: how many "major" structs to follow */
- struct { /* rest of array elements are this */
- short first; /* first major opcode */
- short last; /* last major opcode */
- RecordSetPtr pMinOpSet; /* minor opcode set for above major range */
+ int count; /* first element of array: how many "major" structs to follow */
+ struct { /* rest of array elements are this */
+ short first; /* first major opcode */
+ short last; /* last major opcode */
+ RecordSetPtr pMinOpSet; /* minor opcode set for above major range */
} major;
} RecordMinorOpRec, *RecordMinorOpPtr;
-
/* RecordClientsAndProtocolRec, nicknamed RCAP - holds all the client and
* protocol selections passed in a single CreateContext or RegisterClients.
* Generally, a context will have one of these from the create and an
@@ -102,21 +100,21 @@ typedef union {
*/
typedef struct _RecordClientsAndProtocolRec {
- RecordContextPtr pContext; /* context that owns this RCAP */
- struct _RecordClientsAndProtocolRec *pNextRCAP; /* next RCAP on context */
- RecordSetPtr pRequestMajorOpSet; /* requests to record */
- RecordMinorOpPtr pRequestMinOpInfo; /* extension requests to record */
- RecordSetPtr pReplyMajorOpSet; /* replies to record */
- RecordMinorOpPtr pReplyMinOpInfo; /* extension replies to record */
- RecordSetPtr pDeviceEventSet; /* device events to record */
- RecordSetPtr pDeliveredEventSet; /* delivered events to record */
- RecordSetPtr pErrorSet; /* errors to record */
- XID * pClientIDs; /* array of clients to record */
- short numClients; /* number of clients in pClientIDs */
- short sizeClients; /* size of pClientIDs array */
- unsigned int clientStarted:1; /* record new client connections? */
- unsigned int clientDied:1; /* record client disconnections? */
- unsigned int clientIDsSeparatelyAllocated:1; /* pClientIDs malloced? */
+ RecordContextPtr pContext; /* context that owns this RCAP */
+ struct _RecordClientsAndProtocolRec *pNextRCAP; /* next RCAP on context */
+ RecordSetPtr pRequestMajorOpSet; /* requests to record */
+ RecordMinorOpPtr pRequestMinOpInfo; /* extension requests to record */
+ RecordSetPtr pReplyMajorOpSet; /* replies to record */
+ RecordMinorOpPtr pReplyMinOpInfo; /* extension replies to record */
+ RecordSetPtr pDeviceEventSet; /* device events to record */
+ RecordSetPtr pDeliveredEventSet; /* delivered events to record */
+ RecordSetPtr pErrorSet; /* errors to record */
+ XID *pClientIDs; /* array of clients to record */
+ short numClients; /* number of clients in pClientIDs */
+ short sizeClients; /* size of pClientIDs array */
+ unsigned int clientStarted:1; /* record new client connections? */
+ unsigned int clientDied:1; /* record client disconnections? */
+ unsigned int clientIDsSeparatelyAllocated:1; /* pClientIDs malloced? */
} RecordClientsAndProtocolRec, *RecordClientsAndProtocolPtr;
/* how much bigger to make pRCAP->pClientIDs when reallocing */
@@ -137,10 +135,9 @@ static int numEnabledRCAPs;
return rc; \
}
-static int RecordDeleteContext(
- pointer /*value*/,
- XID /*id*/
-);
+static int RecordDeleteContext(pointer /*value */ ,
+ XID /*id */
+ );
void RecordExtensionInit(void);
@@ -151,24 +148,24 @@ void RecordExtensionInit(void);
/* To make declarations less obfuscated, have a typedef for a pointer to a
* Proc function.
*/
-typedef int (*ProcFunctionPtr)(
- ClientPtr /*pClient*/
-);
+typedef int (*ProcFunctionPtr) (ClientPtr /*pClient */
+ );
/* Record client private. Generally a client only has one of these if
* any of its requests are being recorded.
*/
typedef struct {
/* ptr to client's proc vector before Record stuck its nose in */
- ProcFunctionPtr *originalVector;
-
+ ProcFunctionPtr *originalVector;
+
/* proc vector with pointers for recorded requests redirected to the
* function RecordARequest
*/
- ProcFunctionPtr recordVector[256];
+ ProcFunctionPtr recordVector[256];
} RecordClientPrivateRec, *RecordClientPrivatePtr;
static DevPrivateKeyRec RecordClientPrivateKeyRec;
+
#define RecordClientPrivateKey (&RecordClientPrivateKeyRec)
/* RecordClientPrivatePtr RecordClientPrivate(ClientPtr)
@@ -176,7 +173,6 @@ static DevPrivateKeyRec RecordClientPrivateKeyRec;
*/
#define RecordClientPrivate(_pClient) (RecordClientPrivatePtr) \
dixLookupPrivate(&(_pClient)->devPrivates, RecordClientPrivateKey)
-
/***************************************************************************/
@@ -184,7 +180,7 @@ static DevPrivateKeyRec RecordClientPrivateKeyRec;
static RecordContextPtr *ppAllContexts;
-static int numContexts;/* number of contexts in ppAllContexts */
+static int numContexts; /* number of contexts in ppAllContexts */
/* number of currently enabled contexts. All enabled contexts are bunched
* up at the front of the ppAllContexts array, from ppAllContexts[0] to
@@ -210,14 +206,12 @@ RecordFindContextOnAllContexts(RecordContextPtr pContext)
int i;
assert(numContexts >= numEnabledContexts);
- for (i = 0; i < numContexts; i++)
- {
- if (ppAllContexts[i] == pContext)
- return i;
+ for (i = 0; i < numContexts; i++) {
+ if (ppAllContexts[i] == pContext)
+ return i;
}
return -1;
-} /* RecordFindContextOnAllContexts */
-
+} /* RecordFindContextOnAllContexts */
/***************************************************************************/
@@ -238,28 +232,23 @@ RecordFindContextOnAllContexts(RecordContextPtr pContext)
* data1/len1).
*/
static void
-RecordFlushReplyBuffer(
- RecordContextPtr pContext,
- pointer data1,
- int len1,
- pointer data2,
- int len2
-)
+RecordFlushReplyBuffer(RecordContextPtr pContext,
+ pointer data1, int len1, pointer data2, int len2)
{
- if (!pContext->pRecordingClient || pContext->pRecordingClient->clientGone || pContext->inFlush)
- return;
+ if (!pContext->pRecordingClient || pContext->pRecordingClient->clientGone ||
+ pContext->inFlush)
+ return;
++pContext->inFlush;
if (pContext->numBufBytes)
- WriteToClient(pContext->pRecordingClient, pContext->numBufBytes,
- (char *)pContext->replyBuffer);
+ WriteToClient(pContext->pRecordingClient, pContext->numBufBytes,
+ (char *) pContext->replyBuffer);
pContext->numBufBytes = 0;
if (len1)
- WriteToClient(pContext->pRecordingClient, len1, (char *)data1);
+ WriteToClient(pContext->pRecordingClient, len1, (char *) data1);
if (len2)
- WriteToClient(pContext->pRecordingClient, len2, (char *)data2);
+ WriteToClient(pContext->pRecordingClient, len2, (char *) data2);
--pContext->inFlush;
-} /* RecordFlushReplyBuffer */
-
+} /* RecordFlushReplyBuffer */
/* RecordAProtocolElement
*
@@ -291,7 +280,8 @@ RecordFlushReplyBuffer(
*/
static void
RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient,
- int category, pointer data, int datalen, int padlen, int futurelen)
+ int category, pointer data, int datalen, int padlen,
+ int futurelen)
{
CARD32 elemHeaderData[2];
int numElemHeaders = 0;
@@ -300,121 +290,112 @@ RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient,
Bool gotServerTime = FALSE;
int replylen;
- if (futurelen >= 0)
- { /* start of new protocol element */
- xRecordEnableContextReply *pRep = (xRecordEnableContextReply *)
- pContext->replyBuffer;
- if (pContext->pBufClient != pClient ||
- pContext->bufCategory != category)
- {
- RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
- pContext->pBufClient = pClient;
- pContext->bufCategory = category;
- }
-
- if (!pContext->numBufBytes)
- {
- serverTime = GetTimeInMillis();
- gotServerTime = TRUE;
- pRep->type = X_Reply;
- pRep->category = category;
- pRep->sequenceNumber = pContext->pRecordingClient->sequence;
- pRep->length = 0;
- pRep->elementHeader = pContext->elemHeaders;
- pRep->serverTime = serverTime;
- if (pClient)
- {
- pRep->clientSwapped =
- (pClient->swapped != recordingClientSwapped);
- pRep->idBase = pClient->clientAsMask;
- pRep->recordedSequenceNumber = pClient->sequence;
- }
- else /* it's a device event, StartOfData, or EndOfData */
- {
- pRep->clientSwapped = (category != XRecordFromServer) &&
- recordingClientSwapped;
- pRep->idBase = 0;
- pRep->recordedSequenceNumber = 0;
- }
-
- if (recordingClientSwapped)
- {
- swaps(&pRep->sequenceNumber);
- swapl(&pRep->length);
- swapl(&pRep->idBase);
- swapl(&pRep->serverTime);
- swapl(&pRep->recordedSequenceNumber);
- }
- pContext->numBufBytes = SIZEOF(xRecordEnableContextReply);
- }
-
- /* generate element headers if needed */
-
- if ( ( (pContext->elemHeaders & XRecordFromClientTime)
- && category == XRecordFromClient)
- ||
- ( (pContext->elemHeaders & XRecordFromServerTime)
- && category == XRecordFromServer))
- {
- if (gotServerTime)
- elemHeaderData[numElemHeaders] = serverTime;
- else
- elemHeaderData[numElemHeaders] = GetTimeInMillis();
- if (recordingClientSwapped)
- swapl(&elemHeaderData[numElemHeaders]);
- numElemHeaders++;
- }
-
- if ( (pContext->elemHeaders & XRecordFromClientSequence)
- &&
- (category == XRecordFromClient || category == XRecordClientDied))
- {
- elemHeaderData[numElemHeaders] = pClient->sequence;
- if (recordingClientSwapped)
- swapl(&elemHeaderData[numElemHeaders]);
- numElemHeaders++;
- }
-
- /* adjust reply length */
-
- replylen = pRep->length;
- if (recordingClientSwapped) swapl(&replylen);
- replylen += numElemHeaders + bytes_to_int32(datalen) +
+ if (futurelen >= 0) { /* start of new protocol element */
+ xRecordEnableContextReply *pRep = (xRecordEnableContextReply *)
+ pContext->replyBuffer;
+
+ if (pContext->pBufClient != pClient ||
+ pContext->bufCategory != category) {
+ RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
+ pContext->pBufClient = pClient;
+ pContext->bufCategory = category;
+ }
+
+ if (!pContext->numBufBytes) {
+ serverTime = GetTimeInMillis();
+ gotServerTime = TRUE;
+ pRep->type = X_Reply;
+ pRep->category = category;
+ pRep->sequenceNumber = pContext->pRecordingClient->sequence;
+ pRep->length = 0;
+ pRep->elementHeader = pContext->elemHeaders;
+ pRep->serverTime = serverTime;
+ if (pClient) {
+ pRep->clientSwapped =
+ (pClient->swapped != recordingClientSwapped);
+ pRep->idBase = pClient->clientAsMask;
+ pRep->recordedSequenceNumber = pClient->sequence;
+ }
+ else { /* it's a device event, StartOfData, or EndOfData */
+
+ pRep->clientSwapped = (category != XRecordFromServer) &&
+ recordingClientSwapped;
+ pRep->idBase = 0;
+ pRep->recordedSequenceNumber = 0;
+ }
+
+ if (recordingClientSwapped) {
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swapl(&pRep->idBase);
+ swapl(&pRep->serverTime);
+ swapl(&pRep->recordedSequenceNumber);
+ }
+ pContext->numBufBytes = SIZEOF(xRecordEnableContextReply);
+ }
+
+ /* generate element headers if needed */
+
+ if (((pContext->elemHeaders & XRecordFromClientTime)
+ && category == XRecordFromClient)
+ || ((pContext->elemHeaders & XRecordFromServerTime)
+ && category == XRecordFromServer)) {
+ if (gotServerTime)
+ elemHeaderData[numElemHeaders] = serverTime;
+ else
+ elemHeaderData[numElemHeaders] = GetTimeInMillis();
+ if (recordingClientSwapped)
+ swapl(&elemHeaderData[numElemHeaders]);
+ numElemHeaders++;
+ }
+
+ if ((pContext->elemHeaders & XRecordFromClientSequence)
+ && (category == XRecordFromClient || category == XRecordClientDied)) {
+ elemHeaderData[numElemHeaders] = pClient->sequence;
+ if (recordingClientSwapped)
+ swapl(&elemHeaderData[numElemHeaders]);
+ numElemHeaders++;
+ }
+
+ /* adjust reply length */
+
+ replylen = pRep->length;
+ if (recordingClientSwapped)
+ swapl(&replylen);
+ replylen += numElemHeaders + bytes_to_int32(datalen) +
bytes_to_int32(futurelen);
- if (recordingClientSwapped) swapl(&replylen);
- pRep->length = replylen;
- } /* end if not continued reply */
+ if (recordingClientSwapped)
+ swapl(&replylen);
+ pRep->length = replylen;
+ } /* end if not continued reply */
numElemHeaders *= 4;
/* if space available >= space needed, buffer the data */
- if (REPLY_BUF_SIZE - pContext->numBufBytes >= datalen + numElemHeaders)
- {
- if (numElemHeaders)
- {
- memcpy(pContext->replyBuffer + pContext->numBufBytes,
- elemHeaderData, numElemHeaders);
- pContext->numBufBytes += numElemHeaders;
- }
- if (datalen)
- {
- static char padBuffer[3]; /* as in FlushClient */
- memcpy(pContext->replyBuffer + pContext->numBufBytes,
- data, datalen - padlen);
- pContext->numBufBytes += datalen - padlen;
- memcpy(pContext->replyBuffer + pContext->numBufBytes,
- padBuffer, padlen);
- pContext->numBufBytes += padlen;
- }
+ if (REPLY_BUF_SIZE - pContext->numBufBytes >= datalen + numElemHeaders) {
+ if (numElemHeaders) {
+ memcpy(pContext->replyBuffer + pContext->numBufBytes,
+ elemHeaderData, numElemHeaders);
+ pContext->numBufBytes += numElemHeaders;
+ }
+ if (datalen) {
+ static char padBuffer[3]; /* as in FlushClient */
+
+ memcpy(pContext->replyBuffer + pContext->numBufBytes,
+ data, datalen - padlen);
+ pContext->numBufBytes += datalen - padlen;
+ memcpy(pContext->replyBuffer + pContext->numBufBytes,
+ padBuffer, padlen);
+ pContext->numBufBytes += padlen;
+ }
}
- else
- {
- RecordFlushReplyBuffer(pContext, (pointer)elemHeaderData,
- numElemHeaders, (pointer)data, datalen - padlen);
+ else {
+ RecordFlushReplyBuffer(pContext, (pointer) elemHeaderData,
+ numElemHeaders, (pointer) data,
+ datalen - padlen);
}
-} /* RecordAProtocolElement */
-
+} /* RecordAProtocolElement */
/* RecordFindClientOnContext
*
@@ -434,30 +415,24 @@ RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient,
* Side Effects: none.
*/
static RecordClientsAndProtocolPtr
-RecordFindClientOnContext(
- RecordContextPtr pContext,
- XID clientspec,
- int *pposition
-)
+RecordFindClientOnContext(RecordContextPtr pContext,
+ XID clientspec, int *pposition)
{
RecordClientsAndProtocolPtr pRCAP;
- for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
- {
- int i;
- for (i = 0; i < pRCAP->numClients; i++)
- {
- if (pRCAP->pClientIDs[i] == clientspec)
- {
- if (pposition)
- *pposition = i;
- return pRCAP;
- }
- }
+ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP) {
+ int i;
+
+ for (i = 0; i < pRCAP->numClients; i++) {
+ if (pRCAP->pClientIDs[i] == clientspec) {
+ if (pposition)
+ *pposition = i;
+ return pRCAP;
+ }
+ }
}
return NULL;
-} /* RecordFindClientOnContext */
-
+} /* RecordFindClientOnContext */
/* RecordABigRequest
*
@@ -475,7 +450,7 @@ RecordFindClientOnContext(
* Note: this function exists mainly to make RecordARequest smaller.
*/
static void
-RecordABigRequest(RecordContextPtr pContext, ClientPtr client, xReq *stuff)
+RecordABigRequest(RecordContextPtr pContext, ClientPtr client, xReq * stuff)
{
CARD32 bigLength;
int bytesLeft;
@@ -489,21 +464,22 @@ RecordABigRequest(RecordContextPtr pContext, ClientPtr client, xReq *stuff)
/* record the request header */
bytesLeft = client->req_len << 2;
RecordAProtocolElement(pContext, client, XRecordFromClient,
- (pointer)stuff, SIZEOF(xReq), 0, bytesLeft);
+ (pointer) stuff, SIZEOF(xReq), 0, bytesLeft);
/* reinsert the extended length field that was squished out */
bigLength = client->req_len + bytes_to_int32(sizeof(bigLength));
if (client->swapped)
- swapl(&bigLength);
+ swapl(&bigLength);
RecordAProtocolElement(pContext, client, XRecordFromClient,
- (pointer)&bigLength, sizeof(bigLength), 0, /* continuation */ -1);
+ (pointer) &bigLength, sizeof(bigLength), 0,
+ /* continuation */ -1);
bytesLeft -= sizeof(bigLength);
/* record the rest of the request after the length */
RecordAProtocolElement(pContext, client, XRecordFromClient,
- (pointer)(stuff + 1), bytesLeft, 0, /* continuation */ -1);
-} /* RecordABigRequest */
-
+ (pointer) (stuff + 1), bytesLeft, 0,
+ /* continuation */ -1);
+} /* RecordABigRequest */
/* RecordARequest
*
@@ -529,60 +505,57 @@ RecordARequest(ClientPtr client)
RecordClientsAndProtocolPtr pRCAP;
int i;
RecordClientPrivatePtr pClientPriv;
+
REQUEST(xReq);
int majorop;
majorop = stuff->reqType;
- for (i = 0; i < numEnabledContexts; i++)
- {
- pContext = ppAllContexts[i];
- pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask,
- NULL);
- if (pRCAP && pRCAP->pRequestMajorOpSet &&
- RecordIsMemberOfSet(pRCAP->pRequestMajorOpSet, majorop))
- {
- if (majorop <= 127)
- { /* core request */
-
- if (stuff->length == 0)
- RecordABigRequest(pContext, client, stuff);
- else
- RecordAProtocolElement(pContext, client, XRecordFromClient,
- (pointer)stuff, client->req_len << 2, 0, 0);
- }
- else /* extension, check minor opcode */
- {
- int minorop = client->minorOp;
- int numMinOpInfo;
- RecordMinorOpPtr pMinorOpInfo = pRCAP->pRequestMinOpInfo;
-
- assert (pMinorOpInfo);
- numMinOpInfo = pMinorOpInfo->count;
- pMinorOpInfo++;
- assert (numMinOpInfo);
- for ( ; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++)
- {
- if (majorop >= pMinorOpInfo->major.first &&
- majorop <= pMinorOpInfo->major.last &&
- RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet,
- minorop))
- {
- if (stuff->length == 0)
- RecordABigRequest(pContext, client, stuff);
- else
- RecordAProtocolElement(pContext, client,
- XRecordFromClient, (pointer)stuff,
- client->req_len << 2, 0, 0);
- break;
- }
- } /* end for each minor op info */
- } /* end extension request */
- } /* end this RCAP wants this major opcode */
- } /* end for each context */
+ for (i = 0; i < numEnabledContexts; i++) {
+ pContext = ppAllContexts[i];
+ pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask, NULL);
+ if (pRCAP && pRCAP->pRequestMajorOpSet &&
+ RecordIsMemberOfSet(pRCAP->pRequestMajorOpSet, majorop)) {
+ if (majorop <= 127) { /* core request */
+
+ if (stuff->length == 0)
+ RecordABigRequest(pContext, client, stuff);
+ else
+ RecordAProtocolElement(pContext, client, XRecordFromClient,
+ (pointer) stuff,
+ client->req_len << 2, 0, 0);
+ }
+ else { /* extension, check minor opcode */
+
+ int minorop = client->minorOp;
+ int numMinOpInfo;
+ RecordMinorOpPtr pMinorOpInfo = pRCAP->pRequestMinOpInfo;
+
+ assert(pMinorOpInfo);
+ numMinOpInfo = pMinorOpInfo->count;
+ pMinorOpInfo++;
+ assert(numMinOpInfo);
+ for (; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++) {
+ if (majorop >= pMinorOpInfo->major.first &&
+ majorop <= pMinorOpInfo->major.last &&
+ RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet,
+ minorop)) {
+ if (stuff->length == 0)
+ RecordABigRequest(pContext, client, stuff);
+ else
+ RecordAProtocolElement(pContext, client,
+ XRecordFromClient,
+ (pointer) stuff,
+ client->req_len << 2, 0, 0);
+ break;
+ }
+ } /* end for each minor op info */
+ } /* end extension request */
+ } /* end this RCAP wants this major opcode */
+ } /* end for each context */
pClientPriv = RecordClientPrivate(client);
assert(pClientPriv);
- return (* pClientPriv->originalVector[majorop])(client);
-} /* RecordARequest */
+ return (*pClientPriv->originalVector[majorop]) (client);
+} /* RecordARequest */
/* RecordAReply
*
@@ -609,65 +582,63 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
RecordContextPtr pContext;
RecordClientsAndProtocolPtr pRCAP;
int eci;
- ReplyInfoRec *pri = (ReplyInfoRec *)calldata;
+ ReplyInfoRec *pri = (ReplyInfoRec *) calldata;
ClientPtr client = pri->client;
- for (eci = 0; eci < numEnabledContexts; eci++)
- {
- pContext = ppAllContexts[eci];
- pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask,
- NULL);
- if (pRCAP)
- {
- int majorop = client->majorOp;
- if (pContext->continuedReply)
- {
- RecordAProtocolElement(pContext, client, XRecordFromServer,
- (pointer)pri->replyData, pri->dataLenBytes,
- pri->padBytes, /* continuation */ -1);
- if (!pri->bytesRemaining)
- pContext->continuedReply = 0;
- }
- else if (pri->startOfReply && pRCAP->pReplyMajorOpSet &&
- RecordIsMemberOfSet(pRCAP->pReplyMajorOpSet, majorop))
- {
- if (majorop <= 127)
- { /* core reply */
- RecordAProtocolElement(pContext, client, XRecordFromServer,
- (pointer)pri->replyData, pri->dataLenBytes, 0, pri->bytesRemaining);
- if (pri->bytesRemaining)
- pContext->continuedReply = 1;
- }
- else /* extension, check minor opcode */
- {
- int minorop = client->minorOp;
- int numMinOpInfo;
- RecordMinorOpPtr pMinorOpInfo = pRCAP->pReplyMinOpInfo;
- assert (pMinorOpInfo);
- numMinOpInfo = pMinorOpInfo->count;
- pMinorOpInfo++;
- assert (numMinOpInfo);
- for ( ; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++)
- {
- if (majorop >= pMinorOpInfo->major.first &&
- majorop <= pMinorOpInfo->major.last &&
- RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet,
- minorop))
- {
- RecordAProtocolElement(pContext, client,
- XRecordFromServer, (pointer)pri->replyData,
- pri->dataLenBytes, 0, pri->bytesRemaining);
- if (pri->bytesRemaining)
- pContext->continuedReply = 1;
- break;
- }
- } /* end for each minor op info */
- } /* end extension reply */
- } /* end continued reply vs. start of reply */
- } /* end client is registered on this context */
- } /* end for each context */
-} /* RecordAReply */
-
+ for (eci = 0; eci < numEnabledContexts; eci++) {
+ pContext = ppAllContexts[eci];
+ pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask, NULL);
+ if (pRCAP) {
+ int majorop = client->majorOp;
+
+ if (pContext->continuedReply) {
+ RecordAProtocolElement(pContext, client, XRecordFromServer,
+ (pointer) pri->replyData,
+ pri->dataLenBytes, pri->padBytes,
+ /* continuation */ -1);
+ if (!pri->bytesRemaining)
+ pContext->continuedReply = 0;
+ }
+ else if (pri->startOfReply && pRCAP->pReplyMajorOpSet &&
+ RecordIsMemberOfSet(pRCAP->pReplyMajorOpSet, majorop)) {
+ if (majorop <= 127) { /* core reply */
+ RecordAProtocolElement(pContext, client, XRecordFromServer,
+ (pointer) pri->replyData,
+ pri->dataLenBytes, 0,
+ pri->bytesRemaining);
+ if (pri->bytesRemaining)
+ pContext->continuedReply = 1;
+ }
+ else { /* extension, check minor opcode */
+
+ int minorop = client->minorOp;
+ int numMinOpInfo;
+ RecordMinorOpPtr pMinorOpInfo = pRCAP->pReplyMinOpInfo;
+
+ assert(pMinorOpInfo);
+ numMinOpInfo = pMinorOpInfo->count;
+ pMinorOpInfo++;
+ assert(numMinOpInfo);
+ for (; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++) {
+ if (majorop >= pMinorOpInfo->major.first &&
+ majorop <= pMinorOpInfo->major.last &&
+ RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet,
+ minorop)) {
+ RecordAProtocolElement(pContext, client,
+ XRecordFromServer,
+ (pointer) pri->replyData,
+ pri->dataLenBytes, 0,
+ pri->bytesRemaining);
+ if (pri->bytesRemaining)
+ pContext->continuedReply = 1;
+ break;
+ }
+ } /* end for each minor op info */
+ } /* end extension reply */
+ } /* end continued reply vs. start of reply */
+ } /* end client is registered on this context */
+ } /* end for each context */
+} /* RecordAReply */
/* RecordADeliveredEventOrError
*
@@ -685,109 +656,101 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
* it for this client.
*/
static void
-RecordADeliveredEventOrError(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+RecordADeliveredEventOrError(CallbackListPtr *pcbl, pointer nulldata,
+ pointer calldata)
{
- EventInfoRec *pei = (EventInfoRec *)calldata;
+ EventInfoRec *pei = (EventInfoRec *) calldata;
RecordContextPtr pContext;
RecordClientsAndProtocolPtr pRCAP;
- int eci; /* enabled context index */
+ int eci; /* enabled context index */
ClientPtr pClient = pei->client;
- for (eci = 0; eci < numEnabledContexts; eci++)
- {
- pContext = ppAllContexts[eci];
- pRCAP = RecordFindClientOnContext(pContext, pClient->clientAsMask,
- NULL);
- if (pRCAP && (pRCAP->pDeliveredEventSet || pRCAP->pErrorSet))
- {
- int ev; /* event index */
- xEvent *pev = pei->events;
- for (ev = 0; ev < pei->count; ev++, pev++)
- {
- int recordit = 0;
- if (pRCAP->pErrorSet)
- {
- recordit = RecordIsMemberOfSet(pRCAP->pErrorSet,
- ((xError *)(pev))->errorCode);
- }
- else if (pRCAP->pDeliveredEventSet)
- {
- recordit = RecordIsMemberOfSet(pRCAP->pDeliveredEventSet,
- pev->u.u.type & 0177);
- }
- if (recordit)
- {
- xEvent swappedEvent;
- xEvent *pEvToRecord = pev;
-
- if (pClient->swapped)
- {
- (*EventSwapVector[pev->u.u.type & 0177])
- (pev, &swappedEvent);
- pEvToRecord = &swappedEvent;
-
- }
- RecordAProtocolElement(pContext, pClient,
- XRecordFromServer, pEvToRecord, SIZEOF(xEvent), 0, 0);
- }
- } /* end for each event */
- } /* end this client is on this context */
- } /* end for each enabled context */
-} /* RecordADeliveredEventOrError */
-
+ for (eci = 0; eci < numEnabledContexts; eci++) {
+ pContext = ppAllContexts[eci];
+ pRCAP = RecordFindClientOnContext(pContext, pClient->clientAsMask,
+ NULL);
+ if (pRCAP && (pRCAP->pDeliveredEventSet || pRCAP->pErrorSet)) {
+ int ev; /* event index */
+ xEvent *pev = pei->events;
+
+ for (ev = 0; ev < pei->count; ev++, pev++) {
+ int recordit = 0;
+
+ if (pRCAP->pErrorSet) {
+ recordit = RecordIsMemberOfSet(pRCAP->pErrorSet,
+ ((xError *) (pev))->
+ errorCode);
+ }
+ else if (pRCAP->pDeliveredEventSet) {
+ recordit = RecordIsMemberOfSet(pRCAP->pDeliveredEventSet,
+ pev->u.u.type & 0177);
+ }
+ if (recordit) {
+ xEvent swappedEvent;
+ xEvent *pEvToRecord = pev;
+
+ if (pClient->swapped) {
+ (*EventSwapVector[pev->u.u.type & 0177])
+ (pev, &swappedEvent);
+ pEvToRecord = &swappedEvent;
+
+ }
+ RecordAProtocolElement(pContext, pClient,
+ XRecordFromServer, pEvToRecord,
+ SIZEOF(xEvent), 0, 0);
+ }
+ } /* end for each event */
+ } /* end this client is on this context */
+ } /* end for each enabled context */
+} /* RecordADeliveredEventOrError */
static void
RecordSendProtocolEvents(RecordClientsAndProtocolPtr pRCAP,
- RecordContextPtr pContext,
- xEvent* pev, int count)
+ RecordContextPtr pContext, xEvent *pev, int count)
{
- int ev; /* event index */
-
- for (ev = 0; ev < count; ev++, pev++)
- {
- if (RecordIsMemberOfSet(pRCAP->pDeviceEventSet,
- pev->u.u.type & 0177))
- {
- xEvent swappedEvent;
- xEvent *pEvToRecord = pev;
+ int ev; /* event index */
+
+ for (ev = 0; ev < count; ev++, pev++) {
+ if (RecordIsMemberOfSet(pRCAP->pDeviceEventSet, pev->u.u.type & 0177)) {
+ xEvent swappedEvent;
+ xEvent *pEvToRecord = pev;
+
#ifdef PANORAMIX
- xEvent shiftedEvent;
-
- if (!noPanoramiXExtension &&
- (pev->u.u.type == MotionNotify ||
- pev->u.u.type == ButtonPress ||
- pev->u.u.type == ButtonRelease ||
- pev->u.u.type == KeyPress ||
- pev->u.u.type == KeyRelease)) {
- int scr = XineramaGetCursorScreen(inputInfo.pointer);
- memcpy(&shiftedEvent, pev, sizeof(xEvent));
- shiftedEvent.u.keyButtonPointer.rootX +=
- screenInfo.screens[scr]->x -
- screenInfo.screens[0]->x;
- shiftedEvent.u.keyButtonPointer.rootY +=
- screenInfo.screens[scr]->y -
- screenInfo.screens[0]->y;
- pEvToRecord = &shiftedEvent;
- }
-#endif /* PANORAMIX */
-
- if (pContext->pRecordingClient->swapped)
- {
- (*EventSwapVector[pEvToRecord->u.u.type & 0177])
- (pEvToRecord, &swappedEvent);
- pEvToRecord = &swappedEvent;
- }
-
- RecordAProtocolElement(pContext, NULL,
- XRecordFromServer, pEvToRecord, SIZEOF(xEvent), 0, 0);
- /* make sure device events get flushed in the absence
- * of other client activity
- */
- SetCriticalOutputPending();
- }
- } /* end for each event */
-
-} /* RecordADeviceEvent */
+ xEvent shiftedEvent;
+
+ if (!noPanoramiXExtension &&
+ (pev->u.u.type == MotionNotify ||
+ pev->u.u.type == ButtonPress ||
+ pev->u.u.type == ButtonRelease ||
+ pev->u.u.type == KeyPress || pev->u.u.type == KeyRelease)) {
+ int scr = XineramaGetCursorScreen(inputInfo.pointer);
+
+ memcpy(&shiftedEvent, pev, sizeof(xEvent));
+ shiftedEvent.u.keyButtonPointer.rootX +=
+ screenInfo.screens[scr]->x - screenInfo.screens[0]->x;
+ shiftedEvent.u.keyButtonPointer.rootY +=
+ screenInfo.screens[scr]->y - screenInfo.screens[0]->y;
+ pEvToRecord = &shiftedEvent;
+ }
+#endif /* PANORAMIX */
+
+ if (pContext->pRecordingClient->swapped) {
+ (*EventSwapVector[pEvToRecord->u.u.type & 0177])
+ (pEvToRecord, &swappedEvent);
+ pEvToRecord = &swappedEvent;
+ }
+
+ RecordAProtocolElement(pContext, NULL,
+ XRecordFromServer, pEvToRecord,
+ SIZEOF(xEvent), 0, 0);
+ /* make sure device events get flushed in the absence
+ * of other client activity
+ */
+ SetCriticalOutputPending();
+ }
+ } /* end for each event */
+
+} /* RecordADeviceEvent */
/* RecordADeviceEvent
*
@@ -806,40 +769,36 @@ RecordSendProtocolEvents(RecordClientsAndProtocolPtr pRCAP,
static void
RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
{
- DeviceEventInfoRec *pei = (DeviceEventInfoRec *)calldata;
+ DeviceEventInfoRec *pei = (DeviceEventInfoRec *) calldata;
RecordContextPtr pContext;
RecordClientsAndProtocolPtr pRCAP;
- int eci; /* enabled context index */
-
- for (eci = 0; eci < numEnabledContexts; eci++)
- {
- pContext = ppAllContexts[eci];
- for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
- {
- if (pRCAP->pDeviceEventSet)
- {
- int count;
- xEvent *xi_events = NULL;
-
- /* TODO check return values */
- if (IsMaster(pei->device))
- {
- xEvent *core_events;
- EventToCore(pei->event, &core_events, &count);
- RecordSendProtocolEvents(pRCAP, pContext, core_events,
+ int eci; /* enabled context index */
+
+ for (eci = 0; eci < numEnabledContexts; eci++) {
+ pContext = ppAllContexts[eci];
+ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP) {
+ if (pRCAP->pDeviceEventSet) {
+ int count;
+ xEvent *xi_events = NULL;
+
+ /* TODO check return values */
+ if (IsMaster(pei->device)) {
+ xEvent *core_events;
+
+ EventToCore(pei->event, &core_events, &count);
+ RecordSendProtocolEvents(pRCAP, pContext, core_events,
count);
- free(core_events);
- }
-
- EventToXI(pei->event, &xi_events, &count);
- RecordSendProtocolEvents(pRCAP, pContext, xi_events, count);
- free(xi_events);
- } /* end this RCAP selects device events */
- } /* end for each RCAP on this context */
- } /* end for each enabled context */
+ free(core_events);
+ }
+
+ EventToXI(pei->event, &xi_events, &count);
+ RecordSendProtocolEvents(pRCAP, pContext, xi_events, count);
+ free(xi_events);
+ } /* end this RCAP selects device events */
+ } /* end for each RCAP on this context */
+ } /* end for each enabled context */
}
-
/* RecordFlushAllContexts
*
* Arguments:
@@ -853,29 +812,24 @@ RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
* the recording clients.
*/
static void
-RecordFlushAllContexts(
- CallbackListPtr *pcbl,
- pointer nulldata,
- pointer calldata
-)
+RecordFlushAllContexts(CallbackListPtr *pcbl,
+ pointer nulldata, pointer calldata)
{
- int eci; /* enabled context index */
+ int eci; /* enabled context index */
RecordContextPtr pContext;
- for (eci = 0; eci < numEnabledContexts; eci++)
- {
- pContext = ppAllContexts[eci];
-
- /* In most cases we leave it to RecordFlushReplyBuffer to make
- * this check, but this function could be called very often, so we
- * check before calling hoping to save the function call cost
- * most of the time.
- */
- if (pContext->numBufBytes)
- RecordFlushReplyBuffer(ppAllContexts[eci], NULL, 0, NULL, 0);
- }
-} /* RecordFlushAllContexts */
+ for (eci = 0; eci < numEnabledContexts; eci++) {
+ pContext = ppAllContexts[eci];
+ /* In most cases we leave it to RecordFlushReplyBuffer to make
+ * this check, but this function could be called very often, so we
+ * check before calling hoping to save the function call cost
+ * most of the time.
+ */
+ if (pContext->numBufBytes)
+ RecordFlushReplyBuffer(ppAllContexts[eci], NULL, 0, NULL, 0);
+ }
+} /* RecordFlushAllContexts */
/* RecordInstallHooks
*
@@ -902,70 +856,65 @@ RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
XID client;
if (oneclient)
- client = oneclient;
+ client = oneclient;
else
- client = pRCAP->numClients ? pRCAP->pClientIDs[i++] : 0;
-
- while (client)
- {
- if (client != XRecordFutureClients)
- {
- if (pRCAP->pRequestMajorOpSet)
- {
- RecordSetIteratePtr pIter = NULL;
- RecordSetInterval interval;
- ClientPtr pClient = clients[CLIENT_ID(client)];
-
- if (pClient && !RecordClientPrivate(pClient))
- {
- RecordClientPrivatePtr pClientPriv;
- /* no Record proc vector; allocate one */
- pClientPriv = (RecordClientPrivatePtr)
- malloc(sizeof(RecordClientPrivateRec));
- if (!pClientPriv)
- return BadAlloc;
- /* copy old proc vector to new */
- memcpy(pClientPriv->recordVector, pClient->requestVector,
- sizeof (pClientPriv->recordVector));
- pClientPriv->originalVector = pClient->requestVector;
- dixSetPrivate(&pClient->devPrivates,
- RecordClientPrivateKey, pClientPriv);
- pClient->requestVector = pClientPriv->recordVector;
- }
- while ((pIter = RecordIterateSet(pRCAP->pRequestMajorOpSet,
- pIter, &interval)))
- {
- unsigned int j;
- for (j = interval.first; j <= interval.last; j++)
- pClient->requestVector[j] = RecordARequest;
- }
- }
- }
- if (oneclient)
- client = 0;
- else
- client = (i < pRCAP->numClients) ? pRCAP->pClientIDs[i++] : 0;
+ client = pRCAP->numClients ? pRCAP->pClientIDs[i++] : 0;
+
+ while (client) {
+ if (client != XRecordFutureClients) {
+ if (pRCAP->pRequestMajorOpSet) {
+ RecordSetIteratePtr pIter = NULL;
+ RecordSetInterval interval;
+ ClientPtr pClient = clients[CLIENT_ID(client)];
+
+ if (pClient && !RecordClientPrivate(pClient)) {
+ RecordClientPrivatePtr pClientPriv;
+
+ /* no Record proc vector; allocate one */
+ pClientPriv = (RecordClientPrivatePtr)
+ malloc(sizeof(RecordClientPrivateRec));
+ if (!pClientPriv)
+ return BadAlloc;
+ /* copy old proc vector to new */
+ memcpy(pClientPriv->recordVector, pClient->requestVector,
+ sizeof(pClientPriv->recordVector));
+ pClientPriv->originalVector = pClient->requestVector;
+ dixSetPrivate(&pClient->devPrivates,
+ RecordClientPrivateKey, pClientPriv);
+ pClient->requestVector = pClientPriv->recordVector;
+ }
+ while ((pIter = RecordIterateSet(pRCAP->pRequestMajorOpSet,
+ pIter, &interval))) {
+ unsigned int j;
+
+ for (j = interval.first; j <= interval.last; j++)
+ pClient->requestVector[j] = RecordARequest;
+ }
+ }
+ }
+ if (oneclient)
+ client = 0;
+ else
+ client = (i < pRCAP->numClients) ? pRCAP->pClientIDs[i++] : 0;
}
assert(numEnabledRCAPs >= 0);
- if (!oneclient && ++numEnabledRCAPs == 1)
- { /* we're enabling the first context */
- if (!AddCallback(&EventCallback, RecordADeliveredEventOrError, NULL))
- return BadAlloc;
- if (!AddCallback(&DeviceEventCallback, RecordADeviceEvent, NULL))
- return BadAlloc;
- if (!AddCallback(&ReplyCallback, RecordAReply, NULL))
- return BadAlloc;
- if (!AddCallback(&FlushCallback, RecordFlushAllContexts, NULL))
- return BadAlloc;
- /* Alternate context flushing scheme: delete the line above
- * and call RegisterBlockAndWakeupHandlers here passing
- * RecordFlushAllContexts. Is this any better?
- */
+ if (!oneclient && ++numEnabledRCAPs == 1) { /* we're enabling the first context */
+ if (!AddCallback(&EventCallback, RecordADeliveredEventOrError, NULL))
+ return BadAlloc;
+ if (!AddCallback(&DeviceEventCallback, RecordADeviceEvent, NULL))
+ return BadAlloc;
+ if (!AddCallback(&ReplyCallback, RecordAReply, NULL))
+ return BadAlloc;
+ if (!AddCallback(&FlushCallback, RecordFlushAllContexts, NULL))
+ return BadAlloc;
+ /* Alternate context flushing scheme: delete the line above
+ * and call RegisterBlockAndWakeupHandlers here passing
+ * RecordFlushAllContexts. Is this any better?
+ */
}
return Success;
-} /* RecordInstallHooks */
-
+} /* RecordInstallHooks */
/* RecordUninstallHooks
*
@@ -992,82 +941,75 @@ RecordUninstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
XID client;
if (oneclient)
- client = oneclient;
+ client = oneclient;
else
- client = pRCAP->numClients ? pRCAP->pClientIDs[i++] : 0;
-
- while (client)
- {
- if (client != XRecordFutureClients)
- {
- if (pRCAP->pRequestMajorOpSet)
- {
- ClientPtr pClient = clients[CLIENT_ID(client)];
- int c;
- Bool otherRCAPwantsProcVector = FALSE;
- RecordClientPrivatePtr pClientPriv = NULL;
-
- assert (pClient);
- pClientPriv = RecordClientPrivate(pClient);
- assert (pClientPriv);
- memcpy(pClientPriv->recordVector, pClientPriv->originalVector,
- sizeof (pClientPriv->recordVector));
-
- for (c = 0; c < numEnabledContexts; c++)
- {
- RecordClientsAndProtocolPtr pOtherRCAP;
- RecordContextPtr pContext = ppAllContexts[c];
-
- if (pContext == pRCAP->pContext) continue;
- pOtherRCAP = RecordFindClientOnContext(pContext, client,
- NULL);
- if (pOtherRCAP && pOtherRCAP->pRequestMajorOpSet)
- {
- RecordSetIteratePtr pIter = NULL;
- RecordSetInterval interval;
-
- otherRCAPwantsProcVector = TRUE;
- while ((pIter = RecordIterateSet(
- pOtherRCAP->pRequestMajorOpSet,
- pIter, &interval)))
- {
- unsigned int j;
- for (j = interval.first; j <= interval.last; j++)
- pClient->requestVector[j] = RecordARequest;
- }
- }
- }
- if (!otherRCAPwantsProcVector)
- { /* nobody needs it, so free it */
- pClient->requestVector = pClientPriv->originalVector;
- dixSetPrivate(&pClient->devPrivates,
- RecordClientPrivateKey, NULL);
- free(pClientPriv);
- }
- } /* end if this RCAP specifies any requests */
- } /* end if not future clients */
- if (oneclient)
- client = 0;
- else
- client = (i < pRCAP->numClients) ? pRCAP->pClientIDs[i++] : 0;
+ client = pRCAP->numClients ? pRCAP->pClientIDs[i++] : 0;
+
+ while (client) {
+ if (client != XRecordFutureClients) {
+ if (pRCAP->pRequestMajorOpSet) {
+ ClientPtr pClient = clients[CLIENT_ID(client)];
+ int c;
+ Bool otherRCAPwantsProcVector = FALSE;
+ RecordClientPrivatePtr pClientPriv = NULL;
+
+ assert(pClient);
+ pClientPriv = RecordClientPrivate(pClient);
+ assert(pClientPriv);
+ memcpy(pClientPriv->recordVector, pClientPriv->originalVector,
+ sizeof(pClientPriv->recordVector));
+
+ for (c = 0; c < numEnabledContexts; c++) {
+ RecordClientsAndProtocolPtr pOtherRCAP;
+ RecordContextPtr pContext = ppAllContexts[c];
+
+ if (pContext == pRCAP->pContext)
+ continue;
+ pOtherRCAP = RecordFindClientOnContext(pContext, client,
+ NULL);
+ if (pOtherRCAP && pOtherRCAP->pRequestMajorOpSet) {
+ RecordSetIteratePtr pIter = NULL;
+ RecordSetInterval interval;
+
+ otherRCAPwantsProcVector = TRUE;
+ while ((pIter =
+ RecordIterateSet(pOtherRCAP->pRequestMajorOpSet,
+ pIter, &interval))) {
+ unsigned int j;
+
+ for (j = interval.first; j <= interval.last; j++)
+ pClient->requestVector[j] = RecordARequest;
+ }
+ }
+ }
+ if (!otherRCAPwantsProcVector) { /* nobody needs it, so free it */
+ pClient->requestVector = pClientPriv->originalVector;
+ dixSetPrivate(&pClient->devPrivates,
+ RecordClientPrivateKey, NULL);
+ free(pClientPriv);
+ }
+ } /* end if this RCAP specifies any requests */
+ } /* end if not future clients */
+ if (oneclient)
+ client = 0;
+ else
+ client = (i < pRCAP->numClients) ? pRCAP->pClientIDs[i++] : 0;
}
assert(numEnabledRCAPs >= 1);
- if (!oneclient && --numEnabledRCAPs == 0)
- { /* we're disabling the last context */
- DeleteCallback(&EventCallback, RecordADeliveredEventOrError, NULL);
- DeleteCallback(&DeviceEventCallback, RecordADeviceEvent, NULL);
- DeleteCallback(&ReplyCallback, RecordAReply, NULL);
- DeleteCallback(&FlushCallback, RecordFlushAllContexts, NULL);
- /* Alternate context flushing scheme: delete the line above
- * and call RemoveBlockAndWakeupHandlers here passing
- * RecordFlushAllContexts. Is this any better?
- */
- /* Having deleted the callback, call it one last time. -gildea */
- RecordFlushAllContexts(&FlushCallback, NULL, NULL);
+ if (!oneclient && --numEnabledRCAPs == 0) { /* we're disabling the last context */
+ DeleteCallback(&EventCallback, RecordADeliveredEventOrError, NULL);
+ DeleteCallback(&DeviceEventCallback, RecordADeviceEvent, NULL);
+ DeleteCallback(&ReplyCallback, RecordAReply, NULL);
+ DeleteCallback(&FlushCallback, RecordFlushAllContexts, NULL);
+ /* Alternate context flushing scheme: delete the line above
+ * and call RemoveBlockAndWakeupHandlers here passing
+ * RecordFlushAllContexts. Is this any better?
+ */
+ /* Having deleted the callback, call it one last time. -gildea */
+ RecordFlushAllContexts(&FlushCallback, NULL, NULL);
}
-} /* RecordUninstallHooks */
-
+} /* RecordUninstallHooks */
/* RecordDeleteClientFromRCAP
*
@@ -1089,32 +1031,29 @@ static void
RecordDeleteClientFromRCAP(RecordClientsAndProtocolPtr pRCAP, int position)
{
if (pRCAP->pContext->pRecordingClient)
- RecordUninstallHooks(pRCAP, pRCAP->pClientIDs[position]);
+ RecordUninstallHooks(pRCAP, pRCAP->pClientIDs[position]);
if (position != pRCAP->numClients - 1)
- pRCAP->pClientIDs[position] = pRCAP->pClientIDs[pRCAP->numClients - 1];
- if (--pRCAP->numClients == 0)
- { /* no more clients; remove RCAP from context's list */
- RecordContextPtr pContext = pRCAP->pContext;
- if (pContext->pRecordingClient)
- RecordUninstallHooks(pRCAP, 0);
- if (pContext->pListOfRCAP == pRCAP)
- pContext->pListOfRCAP = pRCAP->pNextRCAP;
- else
- {
- RecordClientsAndProtocolPtr prevRCAP;
- for (prevRCAP = pContext->pListOfRCAP;
- prevRCAP->pNextRCAP != pRCAP;
- prevRCAP = prevRCAP->pNextRCAP)
- ;
- prevRCAP->pNextRCAP = pRCAP->pNextRCAP;
- }
- /* free the RCAP */
- if (pRCAP->clientIDsSeparatelyAllocated)
- free(pRCAP->pClientIDs);
- free(pRCAP);
+ pRCAP->pClientIDs[position] = pRCAP->pClientIDs[pRCAP->numClients - 1];
+ if (--pRCAP->numClients == 0) { /* no more clients; remove RCAP from context's list */
+ RecordContextPtr pContext = pRCAP->pContext;
+
+ if (pContext->pRecordingClient)
+ RecordUninstallHooks(pRCAP, 0);
+ if (pContext->pListOfRCAP == pRCAP)
+ pContext->pListOfRCAP = pRCAP->pNextRCAP;
+ else {
+ RecordClientsAndProtocolPtr prevRCAP;
+
+ for (prevRCAP = pContext->pListOfRCAP;
+ prevRCAP->pNextRCAP != pRCAP; prevRCAP = prevRCAP->pNextRCAP);
+ prevRCAP->pNextRCAP = pRCAP->pNextRCAP;
+ }
+ /* free the RCAP */
+ if (pRCAP->clientIDsSeparatelyAllocated)
+ free(pRCAP->pClientIDs);
+ free(pRCAP);
}
-} /* RecordDeleteClientFromRCAP */
-
+} /* RecordDeleteClientFromRCAP */
/* RecordAddClientToRCAP
*
@@ -1135,35 +1074,33 @@ RecordDeleteClientFromRCAP(RecordClientsAndProtocolPtr pRCAP, int position)
static void
RecordAddClientToRCAP(RecordClientsAndProtocolPtr pRCAP, XID clientspec)
{
- if (pRCAP->numClients == pRCAP->sizeClients)
- {
- if (pRCAP->clientIDsSeparatelyAllocated)
- {
- XID *pNewIDs = (XID *)realloc(pRCAP->pClientIDs,
- (pRCAP->sizeClients + CLIENT_ARRAY_GROWTH_INCREMENT) *
- sizeof(XID));
- if (!pNewIDs)
- return;
- pRCAP->pClientIDs = pNewIDs;
- pRCAP->sizeClients += CLIENT_ARRAY_GROWTH_INCREMENT;
- }
- else
- {
- XID *pNewIDs = (XID *)malloc((pRCAP->sizeClients +
- CLIENT_ARRAY_GROWTH_INCREMENT) * sizeof(XID));
- if (!pNewIDs)
- return;
- memcpy(pNewIDs, pRCAP->pClientIDs, pRCAP->numClients *sizeof(XID));
- pRCAP->pClientIDs = pNewIDs;
- pRCAP->sizeClients += CLIENT_ARRAY_GROWTH_INCREMENT;
- pRCAP->clientIDsSeparatelyAllocated = 1;
- }
+ if (pRCAP->numClients == pRCAP->sizeClients) {
+ if (pRCAP->clientIDsSeparatelyAllocated) {
+ XID *pNewIDs = (XID *) realloc(pRCAP->pClientIDs,
+ (pRCAP->sizeClients +
+ CLIENT_ARRAY_GROWTH_INCREMENT) *
+ sizeof(XID));
+ if (!pNewIDs)
+ return;
+ pRCAP->pClientIDs = pNewIDs;
+ pRCAP->sizeClients += CLIENT_ARRAY_GROWTH_INCREMENT;
+ }
+ else {
+ XID *pNewIDs = (XID *) malloc((pRCAP->sizeClients +
+ CLIENT_ARRAY_GROWTH_INCREMENT) *
+ sizeof(XID));
+ if (!pNewIDs)
+ return;
+ memcpy(pNewIDs, pRCAP->pClientIDs, pRCAP->numClients * sizeof(XID));
+ pRCAP->pClientIDs = pNewIDs;
+ pRCAP->sizeClients += CLIENT_ARRAY_GROWTH_INCREMENT;
+ pRCAP->clientIDsSeparatelyAllocated = 1;
+ }
}
pRCAP->pClientIDs[pRCAP->numClients++] = clientspec;
if (pRCAP->pContext->pRecordingClient)
- RecordInstallHooks(pRCAP, clientspec);
-} /* RecordDeleteClientFromRCAP */
-
+ RecordInstallHooks(pRCAP, clientspec);
+} /* RecordDeleteClientFromRCAP */
/* RecordDeleteClientFromContext
*
@@ -1185,9 +1122,8 @@ RecordDeleteClientFromContext(RecordContextPtr pContext, XID clientspec)
int position;
if ((pRCAP = RecordFindClientOnContext(pContext, clientspec, &position)))
- RecordDeleteClientFromRCAP(pRCAP, position);
-} /* RecordDeleteClientFromContext */
-
+ RecordDeleteClientFromRCAP(pRCAP, position);
+} /* RecordDeleteClientFromContext */
/* RecordSanityCheckClientSpecifiers
*
@@ -1202,38 +1138,36 @@ RecordDeleteClientFromContext(RecordContextPtr pContext, XID clientspec)
* Side Effects: none.
*/
static int
-RecordSanityCheckClientSpecifiers(ClientPtr client, XID *clientspecs, int nspecs, XID errorspec)
+RecordSanityCheckClientSpecifiers(ClientPtr client, XID *clientspecs,
+ int nspecs, XID errorspec)
{
int i;
int clientIndex;
int rc;
pointer value;
- for (i = 0; i < nspecs; i++)
- {
- if (clientspecs[i] == XRecordCurrentClients ||
- clientspecs[i] == XRecordFutureClients ||
- clientspecs[i] == XRecordAllClients)
- continue;
- if (errorspec && (CLIENT_BITS(clientspecs[i]) == errorspec) )
- return BadMatch;
- clientIndex = CLIENT_ID(clientspecs[i]);
- if (clientIndex && clients[clientIndex] &&
- clients[clientIndex]->clientState == ClientStateRunning)
- {
- if (clientspecs[i] == clients[clientIndex]->clientAsMask)
- continue;
+ for (i = 0; i < nspecs; i++) {
+ if (clientspecs[i] == XRecordCurrentClients ||
+ clientspecs[i] == XRecordFutureClients ||
+ clientspecs[i] == XRecordAllClients)
+ continue;
+ if (errorspec && (CLIENT_BITS(clientspecs[i]) == errorspec))
+ return BadMatch;
+ clientIndex = CLIENT_ID(clientspecs[i]);
+ if (clientIndex && clients[clientIndex] &&
+ clients[clientIndex]->clientState == ClientStateRunning) {
+ if (clientspecs[i] == clients[clientIndex]->clientAsMask)
+ continue;
rc = dixLookupResourceByClass(&value, clientspecs[i], RC_ANY,
client, DixGetAttrAccess);
if (rc != Success)
return rc;
- }
- else
- return BadMatch;
+ }
+ else
+ return BadMatch;
}
return Success;
-} /* RecordSanityCheckClientSpecifiers */
-
+} /* RecordSanityCheckClientSpecifiers */
/* RecordCanonicalizeClientSpecifiers
*
@@ -1265,7 +1199,8 @@ RecordSanityCheckClientSpecifiers(ClientPtr client, XID *clientspecs, int nspecs
* pClientspecs may be modified in place.
*/
static XID *
-RecordCanonicalizeClientSpecifiers(XID *pClientspecs, int *pNumClientspecs, XID excludespec)
+RecordCanonicalizeClientSpecifiers(XID *pClientspecs, int *pNumClientspecs,
+ XID excludespec)
{
int i;
int numClients = *pNumClientspecs;
@@ -1274,54 +1209,50 @@ RecordCanonicalizeClientSpecifiers(XID *pClientspecs, int *pNumClientspecs, XID
* client id bits. This makes searching for a particular client simpler
* (and faster.)
*/
- for (i = 0; i < numClients; i++)
- {
- XID cs = pClientspecs[i];
- if (cs > XRecordAllClients)
- pClientspecs[i] = CLIENT_BITS(cs);
+ for (i = 0; i < numClients; i++) {
+ XID cs = pClientspecs[i];
+
+ if (cs > XRecordAllClients)
+ pClientspecs[i] = CLIENT_BITS(cs);
}
- for (i = 0; i < numClients; i++)
- {
- if (pClientspecs[i] == XRecordAllClients ||
- pClientspecs[i] == XRecordCurrentClients)
- { /* expand All/Current */
- int j, nc;
- XID *pCanon = (XID *)malloc(sizeof(XID) * (currentMaxClients + 1));
- if (!pCanon) return NULL;
- for (nc = 0, j = 1; j < currentMaxClients; j++)
- {
- ClientPtr client = clients[j];
- if (client != NullClient &&
- client->clientState == ClientStateRunning &&
- client->clientAsMask != excludespec)
- {
- pCanon[nc++] = client->clientAsMask;
- }
- }
- if (pClientspecs[i] == XRecordAllClients)
- pCanon[nc++] = XRecordFutureClients;
- *pNumClientspecs = nc;
- return pCanon;
- }
- else /* not All or Current */
- {
- int j;
- for (j = i + 1; j < numClients; )
- {
- if (pClientspecs[i] == pClientspecs[j])
- {
- pClientspecs[j] = pClientspecs[--numClients];
- }
- else
- j++;
- }
- }
- } /* end for each clientspec */
+ for (i = 0; i < numClients; i++) {
+ if (pClientspecs[i] == XRecordAllClients || pClientspecs[i] == XRecordCurrentClients) { /* expand All/Current */
+ int j, nc;
+ XID *pCanon = (XID *) malloc(sizeof(XID) * (currentMaxClients + 1));
+
+ if (!pCanon)
+ return NULL;
+ for (nc = 0, j = 1; j < currentMaxClients; j++) {
+ ClientPtr client = clients[j];
+
+ if (client != NullClient &&
+ client->clientState == ClientStateRunning &&
+ client->clientAsMask != excludespec) {
+ pCanon[nc++] = client->clientAsMask;
+ }
+ }
+ if (pClientspecs[i] == XRecordAllClients)
+ pCanon[nc++] = XRecordFutureClients;
+ *pNumClientspecs = nc;
+ return pCanon;
+ }
+ else { /* not All or Current */
+
+ int j;
+
+ for (j = i + 1; j < numClients;) {
+ if (pClientspecs[i] == pClientspecs[j]) {
+ pClientspecs[j] = pClientspecs[--numClients];
+ }
+ else
+ j++;
+ }
+ }
+ } /* end for each clientspec */
*pNumClientspecs = numClients;
return pClientspecs;
-} /* RecordCanonicalizeClientSpecifiers */
-
+} /* RecordCanonicalizeClientSpecifiers */
/****************************************************************************/
@@ -1344,8 +1275,7 @@ static int
RecordPadAlign(int size, int align)
{
return (align - (size & (align - 1))) & (align - 1);
-} /* RecordPadAlign */
-
+} /* RecordPadAlign */
/* RecordSanityCheckRegisterClients
*
@@ -1362,7 +1292,8 @@ RecordPadAlign(int size, int align)
* Side Effects: none.
*/
static int
-RecordSanityCheckRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegisterClientsReq *stuff)
+RecordSanityCheckRegisterClients(RecordContextPtr pContext, ClientPtr client,
+ xRecordRegisterClientsReq * stuff)
{
int err;
xRecordRange *pRange;
@@ -1370,119 +1301,107 @@ RecordSanityCheckRegisterClients(RecordContextPtr pContext, ClientPtr client, xR
XID recordingClient;
if (((client->req_len << 2) - SIZEOF(xRecordRegisterClientsReq)) !=
- 4 * stuff->nClients + SIZEOF(xRecordRange) * stuff->nRanges)
- return BadLength;
+ 4 * stuff->nClients + SIZEOF(xRecordRange) * stuff->nRanges)
+ return BadLength;
if (stuff->elementHeader &
- ~(XRecordFromClientSequence|XRecordFromClientTime|XRecordFromServerTime))
- {
- client->errorValue = stuff->elementHeader;
- return BadValue;
+ ~(XRecordFromClientSequence | XRecordFromClientTime |
+ XRecordFromServerTime)) {
+ client->errorValue = stuff->elementHeader;
+ return BadValue;
}
recordingClient = pContext->pRecordingClient ?
- pContext->pRecordingClient->clientAsMask : 0;
- err = RecordSanityCheckClientSpecifiers(client, (XID *)&stuff[1],
- stuff->nClients, recordingClient);
- if (err != Success) return err;
-
- pRange = (xRecordRange *)(((XID *)&stuff[1]) + stuff->nClients);
- for (i = 0; i < stuff->nRanges; i++, pRange++)
- {
- if (pRange->coreRequestsFirst > pRange->coreRequestsLast)
- {
- client->errorValue = pRange->coreRequestsFirst;
- return BadValue;
- }
- if (pRange->coreRepliesFirst > pRange->coreRepliesLast)
- {
- client->errorValue = pRange->coreRepliesFirst;
- return BadValue;
- }
- if ((pRange->extRequestsMajorFirst || pRange->extRequestsMajorLast) &&
- (pRange->extRequestsMajorFirst < 128 ||
- pRange->extRequestsMajorLast < 128 ||
- pRange->extRequestsMajorFirst > pRange->extRequestsMajorLast))
- {
- client->errorValue = pRange->extRequestsMajorFirst;
- return BadValue;
- }
- if (pRange->extRequestsMinorFirst > pRange->extRequestsMinorLast)
- {
- client->errorValue = pRange->extRequestsMinorFirst;
- return BadValue;
- }
- if ((pRange->extRepliesMajorFirst || pRange->extRepliesMajorLast) &&
- (pRange->extRepliesMajorFirst < 128 ||
- pRange->extRepliesMajorLast < 128 ||
- pRange->extRepliesMajorFirst > pRange->extRepliesMajorLast))
- {
- client->errorValue = pRange->extRepliesMajorFirst;
- return BadValue;
- }
- if (pRange->extRepliesMinorFirst > pRange->extRepliesMinorLast)
- {
- client->errorValue = pRange->extRepliesMinorFirst;
- return BadValue;
- }
- if ((pRange->deliveredEventsFirst || pRange->deliveredEventsLast) &&
- (pRange->deliveredEventsFirst < 2 ||
- pRange->deliveredEventsLast < 2 ||
- pRange->deliveredEventsFirst > pRange->deliveredEventsLast))
- {
- client->errorValue = pRange->deliveredEventsFirst;
- return BadValue;
- }
- if ((pRange->deviceEventsFirst || pRange->deviceEventsLast) &&
- (pRange->deviceEventsFirst < 2 ||
- pRange->deviceEventsLast < 2 ||
- pRange->deviceEventsFirst > pRange->deviceEventsLast))
- {
- client->errorValue = pRange->deviceEventsFirst;
- return BadValue;
- }
- if (pRange->errorsFirst > pRange->errorsLast)
- {
- client->errorValue = pRange->errorsFirst;
- return BadValue;
- }
- if (pRange->clientStarted != xFalse && pRange->clientStarted != xTrue)
- {
- client->errorValue = pRange->clientStarted;
- return BadValue;
- }
- if (pRange->clientDied != xFalse && pRange->clientDied != xTrue)
- {
- client->errorValue = pRange->clientDied;
- return BadValue;
- }
- } /* end for each range */
+ pContext->pRecordingClient->clientAsMask : 0;
+ err = RecordSanityCheckClientSpecifiers(client, (XID *) &stuff[1],
+ stuff->nClients, recordingClient);
+ if (err != Success)
+ return err;
+
+ pRange = (xRecordRange *) (((XID *) &stuff[1]) + stuff->nClients);
+ for (i = 0; i < stuff->nRanges; i++, pRange++) {
+ if (pRange->coreRequestsFirst > pRange->coreRequestsLast) {
+ client->errorValue = pRange->coreRequestsFirst;
+ return BadValue;
+ }
+ if (pRange->coreRepliesFirst > pRange->coreRepliesLast) {
+ client->errorValue = pRange->coreRepliesFirst;
+ return BadValue;
+ }
+ if ((pRange->extRequestsMajorFirst || pRange->extRequestsMajorLast) &&
+ (pRange->extRequestsMajorFirst < 128 ||
+ pRange->extRequestsMajorLast < 128 ||
+ pRange->extRequestsMajorFirst > pRange->extRequestsMajorLast)) {
+ client->errorValue = pRange->extRequestsMajorFirst;
+ return BadValue;
+ }
+ if (pRange->extRequestsMinorFirst > pRange->extRequestsMinorLast) {
+ client->errorValue = pRange->extRequestsMinorFirst;
+ return BadValue;
+ }
+ if ((pRange->extRepliesMajorFirst || pRange->extRepliesMajorLast) &&
+ (pRange->extRepliesMajorFirst < 128 ||
+ pRange->extRepliesMajorLast < 128 ||
+ pRange->extRepliesMajorFirst > pRange->extRepliesMajorLast)) {
+ client->errorValue = pRange->extRepliesMajorFirst;
+ return BadValue;
+ }
+ if (pRange->extRepliesMinorFirst > pRange->extRepliesMinorLast) {
+ client->errorValue = pRange->extRepliesMinorFirst;
+ return BadValue;
+ }
+ if ((pRange->deliveredEventsFirst || pRange->deliveredEventsLast) &&
+ (pRange->deliveredEventsFirst < 2 ||
+ pRange->deliveredEventsLast < 2 ||
+ pRange->deliveredEventsFirst > pRange->deliveredEventsLast)) {
+ client->errorValue = pRange->deliveredEventsFirst;
+ return BadValue;
+ }
+ if ((pRange->deviceEventsFirst || pRange->deviceEventsLast) &&
+ (pRange->deviceEventsFirst < 2 ||
+ pRange->deviceEventsLast < 2 ||
+ pRange->deviceEventsFirst > pRange->deviceEventsLast)) {
+ client->errorValue = pRange->deviceEventsFirst;
+ return BadValue;
+ }
+ if (pRange->errorsFirst > pRange->errorsLast) {
+ client->errorValue = pRange->errorsFirst;
+ return BadValue;
+ }
+ if (pRange->clientStarted != xFalse && pRange->clientStarted != xTrue) {
+ client->errorValue = pRange->clientStarted;
+ return BadValue;
+ }
+ if (pRange->clientDied != xFalse && pRange->clientDied != xTrue) {
+ client->errorValue = pRange->clientDied;
+ return BadValue;
+ }
+ } /* end for each range */
return Success;
-} /* end RecordSanityCheckRegisterClients */
+} /* end RecordSanityCheckRegisterClients */
/* This is a tactical structure used to gather information about all the sets
* (RecordSetPtr) that need to be created for an RCAP in the process of
* digesting a list of RECORDRANGEs (converting it to the internal
* representation).
*/
-typedef struct
-{
- int nintervals; /* number of intervals in following array */
- RecordSetInterval *intervals; /* array of intervals for this set */
- int size; /* size of intevals array; >= nintervals */
- int align; /* alignment restriction for set */
- int offset; /* where to store set pointer rel. to start of RCAP */
- short first, last; /* if for extension, major opcode interval */
+typedef struct {
+ int nintervals; /* number of intervals in following array */
+ RecordSetInterval *intervals; /* array of intervals for this set */
+ int size; /* size of intevals array; >= nintervals */
+ int align; /* alignment restriction for set */
+ int offset; /* where to store set pointer rel. to start of RCAP */
+ short first, last; /* if for extension, major opcode interval */
} SetInfoRec, *SetInfoPtr;
/* These constant are used to index into an array of SetInfoRec. */
-enum {REQ, /* set info for requests */
- REP, /* set info for replies */
- ERR, /* set info for errors */
- DEV, /* set info for device events */
- DLEV, /* set info for delivered events */
- PREDEFSETS}; /* number of predefined array entries */
-
+enum { REQ, /* set info for requests */
+ REP, /* set info for replies */
+ ERR, /* set info for errors */
+ DEV, /* set info for device events */
+ DLEV, /* set info for delivered events */
+ PREDEFSETS
+}; /* number of predefined array entries */
/* RecordAllocIntervals
*
@@ -1501,14 +1420,13 @@ RecordAllocIntervals(SetInfoPtr psi, int nIntervals)
{
assert(!psi->intervals);
psi->intervals = (RecordSetInterval *)
- malloc(nIntervals * sizeof(RecordSetInterval));
+ malloc(nIntervals * sizeof(RecordSetInterval));
if (!psi->intervals)
- return BadAlloc;
+ return BadAlloc;
memset(psi->intervals, 0, nIntervals * sizeof(RecordSetInterval));
psi->size = nIntervals;
return Success;
-} /* end RecordAllocIntervals */
-
+} /* end RecordAllocIntervals */
/* RecordConvertRangesToIntervals
*
@@ -1534,66 +1452,57 @@ RecordAllocIntervals(SetInfoPtr psi, int nIntervals)
* increased accordingly.
*/
static int
-RecordConvertRangesToIntervals(
- SetInfoPtr psi,
- xRecordRange *pRanges,
- int nRanges,
- int byteoffset,
- SetInfoPtr pExtSetInfo,
- int *pnExtSetInfo
-)
+RecordConvertRangesToIntervals(SetInfoPtr psi,
+ xRecordRange * pRanges,
+ int nRanges,
+ int byteoffset,
+ SetInfoPtr pExtSetInfo, int *pnExtSetInfo)
{
int i;
CARD8 *pCARD8;
int first, last;
int err;
- for (i = 0; i < nRanges; i++, pRanges++)
- {
- pCARD8 = ((CARD8 *)pRanges) + byteoffset;
- first = pCARD8[0];
- last = pCARD8[1];
- if (first || last)
- {
- if (!psi->intervals)
- {
- err = RecordAllocIntervals(psi, 2 * (nRanges - i));
- if (err != Success)
- return err;
- }
- psi->intervals[psi->nintervals].first = first;
- psi->intervals[psi->nintervals].last = last;
- psi->nintervals++;
- assert(psi->nintervals <= psi->size);
- if (pExtSetInfo)
- {
- SetInfoPtr pesi = pExtSetInfo;
- CARD16 *pCARD16 = (CARD16 *)(pCARD8 + 2);
- int j;
-
- for (j = 0; j < *pnExtSetInfo; j++, pesi++)
- {
- if ( (first == pesi->first) && (last == pesi->last) )
- break;
- }
- if (j == *pnExtSetInfo)
- {
- err = RecordAllocIntervals(pesi, 2 * (nRanges - i));
- if (err != Success)
- return err;
- pesi->first = first;
- pesi->last = last;
- (*pnExtSetInfo)++;
- }
- pesi->intervals[pesi->nintervals].first = pCARD16[0];
- pesi->intervals[pesi->nintervals].last = pCARD16[1];
- pesi->nintervals++;
- assert(pesi->nintervals <= pesi->size);
- }
- }
+ for (i = 0; i < nRanges; i++, pRanges++) {
+ pCARD8 = ((CARD8 *) pRanges) + byteoffset;
+ first = pCARD8[0];
+ last = pCARD8[1];
+ if (first || last) {
+ if (!psi->intervals) {
+ err = RecordAllocIntervals(psi, 2 * (nRanges - i));
+ if (err != Success)
+ return err;
+ }
+ psi->intervals[psi->nintervals].first = first;
+ psi->intervals[psi->nintervals].last = last;
+ psi->nintervals++;
+ assert(psi->nintervals <= psi->size);
+ if (pExtSetInfo) {
+ SetInfoPtr pesi = pExtSetInfo;
+ CARD16 *pCARD16 = (CARD16 *) (pCARD8 + 2);
+ int j;
+
+ for (j = 0; j < *pnExtSetInfo; j++, pesi++) {
+ if ((first == pesi->first) && (last == pesi->last))
+ break;
+ }
+ if (j == *pnExtSetInfo) {
+ err = RecordAllocIntervals(pesi, 2 * (nRanges - i));
+ if (err != Success)
+ return err;
+ pesi->first = first;
+ pesi->last = last;
+ (*pnExtSetInfo)++;
+ }
+ pesi->intervals[pesi->nintervals].first = pCARD16[0];
+ pesi->intervals[pesi->nintervals].last = pCARD16[1];
+ pesi->nintervals++;
+ assert(pesi->nintervals <= pesi->size);
+ }
+ }
}
return Success;
-} /* end RecordConvertRangesToIntervals */
+} /* end RecordConvertRangesToIntervals */
#define offset_of(_structure, _field) \
((char *)(& (_structure . _field)) - (char *)(&_structure))
@@ -1619,7 +1528,8 @@ RecordConvertRangesToIntervals(
* to record the new clients and protocol.
*/
static int
-RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegisterClientsReq *stuff)
+RecordRegisterClients(RecordContextPtr pContext, ClientPtr client,
+ xRecordRegisterClientsReq * stuff)
{
int err;
int i;
@@ -1645,84 +1555,98 @@ RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegist
err = RecordSanityCheckRegisterClients(pContext, client, stuff);
if (err != Success)
- return err;
+ return err;
/* if element headers changed, flush buffer */
-
- if (pContext->elemHeaders != stuff->elementHeader)
- {
- RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
- pContext->elemHeaders = stuff->elementHeader;
+
+ if (pContext->elemHeaders != stuff->elementHeader) {
+ RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
+ pContext->elemHeaders = stuff->elementHeader;
}
nClients = stuff->nClients;
if (!nClients)
- /* if empty clients list, we're done. */
- return Success;
+ /* if empty clients list, we're done. */
+ return Success;
recordingClient = pContext->pRecordingClient ?
- pContext->pRecordingClient->clientAsMask : 0;
- pCanonClients = RecordCanonicalizeClientSpecifiers((XID *)&stuff[1],
- &nClients, recordingClient);
+ pContext->pRecordingClient->clientAsMask : 0;
+ pCanonClients = RecordCanonicalizeClientSpecifiers((XID *) &stuff[1],
+ &nClients,
+ recordingClient);
if (!pCanonClients)
- return BadAlloc;
+ return BadAlloc;
/* We may have to create as many as one set for each "predefined"
* protocol types, plus one per range for extension reuests, plus one per
* range for extension replies.
*/
maxSets = PREDEFSETS + 2 * stuff->nRanges;
- si = (SetInfoPtr)malloc(sizeof(SetInfoRec) * maxSets);
- if (!si)
- {
- err = BadAlloc;
- goto bailout;
+ si = (SetInfoPtr) malloc(sizeof(SetInfoRec) * maxSets);
+ if (!si) {
+ err = BadAlloc;
+ goto bailout;
}
memset(si, 0, sizeof(SetInfoRec) * maxSets);
/* theoretically you must do this because NULL may not be all-bits-zero */
for (i = 0; i < maxSets; i++)
- si[i].intervals = NULL;
+ si[i].intervals = NULL;
pExtReqSets = si + PREDEFSETS;
pExtRepSets = pExtReqSets + stuff->nRanges;
- pRanges = (xRecordRange *)(((XID *)&stuff[1]) + stuff->nClients);
+ pRanges = (xRecordRange *) (((XID *) &stuff[1]) + stuff->nClients);
err = RecordConvertRangesToIntervals(&si[REQ], pRanges, stuff->nRanges,
- offset_of(rr, coreRequestsFirst), NULL, NULL);
- if (err != Success) goto bailout;
+ offset_of(rr, coreRequestsFirst), NULL,
+ NULL);
+ if (err != Success)
+ goto bailout;
err = RecordConvertRangesToIntervals(&si[REQ], pRanges, stuff->nRanges,
- offset_of(rr, extRequestsMajorFirst), pExtReqSets, &nExtReqSets);
- if (err != Success) goto bailout;
+ offset_of(rr, extRequestsMajorFirst),
+ pExtReqSets, &nExtReqSets);
+ if (err != Success)
+ goto bailout;
err = RecordConvertRangesToIntervals(&si[REP], pRanges, stuff->nRanges,
- offset_of(rr, coreRepliesFirst), NULL, NULL);
- if (err != Success) goto bailout;
+ offset_of(rr, coreRepliesFirst), NULL,
+ NULL);
+ if (err != Success)
+ goto bailout;
err = RecordConvertRangesToIntervals(&si[REP], pRanges, stuff->nRanges,
- offset_of(rr, extRepliesMajorFirst), pExtRepSets, &nExtRepSets);
- if (err != Success) goto bailout;
+ offset_of(rr, extRepliesMajorFirst),
+ pExtRepSets, &nExtRepSets);
+ if (err != Success)
+ goto bailout;
err = RecordConvertRangesToIntervals(&si[ERR], pRanges, stuff->nRanges,
- offset_of(rr, errorsFirst), NULL, NULL);
- if (err != Success) goto bailout;
+ offset_of(rr, errorsFirst), NULL,
+ NULL);
+ if (err != Success)
+ goto bailout;
err = RecordConvertRangesToIntervals(&si[DLEV], pRanges, stuff->nRanges,
- offset_of(rr, deliveredEventsFirst), NULL, NULL);
- if (err != Success) goto bailout;
+ offset_of(rr, deliveredEventsFirst),
+ NULL, NULL);
+ if (err != Success)
+ goto bailout;
err = RecordConvertRangesToIntervals(&si[DEV], pRanges, stuff->nRanges,
- offset_of(rr, deviceEventsFirst), NULL, NULL);
- if (err != Success) goto bailout;
+ offset_of(rr, deviceEventsFirst), NULL,
+ NULL);
+ if (err != Success)
+ goto bailout;
/* collect client-started and client-died */
- for (i = 0; i < stuff->nRanges; i++)
- {
- if (pRanges[i].clientStarted) clientStarted = TRUE;
- if (pRanges[i].clientDied) clientDied = TRUE;
+ for (i = 0; i < stuff->nRanges; i++) {
+ if (pRanges[i].clientStarted)
+ clientStarted = TRUE;
+ if (pRanges[i].clientDied)
+ clientDied = TRUE;
}
/* We now have all the information collected to create all the sets,
@@ -1737,154 +1661,152 @@ RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegist
clientListOffset = totRCAPsize + pad;
totRCAPsize += pad + sizeClients * sizeof(XID);
- if (nExtReqSets)
- {
- pad = RecordPadAlign(totRCAPsize, sizeof(RecordSetPtr));
- extReqSetsOffset = totRCAPsize + pad;
- totRCAPsize += pad + (nExtReqSets + 1) * sizeof(RecordMinorOpRec);
+ if (nExtReqSets) {
+ pad = RecordPadAlign(totRCAPsize, sizeof(RecordSetPtr));
+ extReqSetsOffset = totRCAPsize + pad;
+ totRCAPsize += pad + (nExtReqSets + 1) * sizeof(RecordMinorOpRec);
}
- if (nExtRepSets)
- {
- pad = RecordPadAlign(totRCAPsize, sizeof(RecordSetPtr));
- extRepSetsOffset = totRCAPsize + pad;
- totRCAPsize += pad + (nExtRepSets + 1) * sizeof(RecordMinorOpRec);
+ if (nExtRepSets) {
+ pad = RecordPadAlign(totRCAPsize, sizeof(RecordSetPtr));
+ extRepSetsOffset = totRCAPsize + pad;
+ totRCAPsize += pad + (nExtRepSets + 1) * sizeof(RecordMinorOpRec);
}
- for (i = 0; i < maxSets; i++)
- {
- if (si[i].nintervals)
- {
- si[i].size = RecordSetMemoryRequirements(
- si[i].intervals, si[i].nintervals, &si[i].align);
- pad = RecordPadAlign(totRCAPsize, si[i].align);
- si[i].offset = pad + totRCAPsize;
- totRCAPsize += pad + si[i].size;
- }
+ for (i = 0; i < maxSets; i++) {
+ if (si[i].nintervals) {
+ si[i].size =
+ RecordSetMemoryRequirements(si[i].intervals, si[i].nintervals,
+ &si[i].align);
+ pad = RecordPadAlign(totRCAPsize, si[i].align);
+ si[i].offset = pad + totRCAPsize;
+ totRCAPsize += pad + si[i].size;
+ }
}
/* allocate memory for the whole RCAP */
- pRCAP = (RecordClientsAndProtocolPtr)malloc(totRCAPsize);
- if (!pRCAP)
- {
- err = BadAlloc;
- goto bailout;
+ pRCAP = (RecordClientsAndProtocolPtr) malloc(totRCAPsize);
+ if (!pRCAP) {
+ err = BadAlloc;
+ goto bailout;
}
/* fill in the RCAP */
pRCAP->pContext = pContext;
- pRCAP->pClientIDs = (XID *)((char *)pRCAP + clientListOffset);
- pRCAP->numClients = nClients;
+ pRCAP->pClientIDs = (XID *) ((char *) pRCAP + clientListOffset);
+ pRCAP->numClients = nClients;
pRCAP->sizeClients = sizeClients;
pRCAP->clientIDsSeparatelyAllocated = 0;
- for (i = 0; i < nClients; i++)
- {
- RecordDeleteClientFromContext(pContext, pCanonClients[i]);
- pRCAP->pClientIDs[i] = pCanonClients[i];
+ for (i = 0; i < nClients; i++) {
+ RecordDeleteClientFromContext(pContext, pCanonClients[i]);
+ pRCAP->pClientIDs[i] = pCanonClients[i];
}
/* create all the sets */
- if (si[REQ].intervals)
- {
- pRCAP->pRequestMajorOpSet =
- RecordCreateSet(si[REQ].intervals, si[REQ].nintervals,
- (RecordSetPtr)((char *)pRCAP + si[REQ].offset), si[REQ].size);
+ if (si[REQ].intervals) {
+ pRCAP->pRequestMajorOpSet =
+ RecordCreateSet(si[REQ].intervals, si[REQ].nintervals,
+ (RecordSetPtr) ((char *) pRCAP + si[REQ].offset),
+ si[REQ].size);
}
- else pRCAP->pRequestMajorOpSet = NULL;
+ else
+ pRCAP->pRequestMajorOpSet = NULL;
- if (si[REP].intervals)
- {
- pRCAP->pReplyMajorOpSet =
- RecordCreateSet(si[REP].intervals, si[REP].nintervals,
- (RecordSetPtr)((char *)pRCAP + si[REP].offset), si[REP].size);
+ if (si[REP].intervals) {
+ pRCAP->pReplyMajorOpSet =
+ RecordCreateSet(si[REP].intervals, si[REP].nintervals,
+ (RecordSetPtr) ((char *) pRCAP + si[REP].offset),
+ si[REP].size);
}
- else pRCAP->pReplyMajorOpSet = NULL;
+ else
+ pRCAP->pReplyMajorOpSet = NULL;
- if (si[ERR].intervals)
- {
- pRCAP->pErrorSet =
- RecordCreateSet(si[ERR].intervals, si[ERR].nintervals,
- (RecordSetPtr)((char *)pRCAP + si[ERR].offset), si[ERR].size);
+ if (si[ERR].intervals) {
+ pRCAP->pErrorSet =
+ RecordCreateSet(si[ERR].intervals, si[ERR].nintervals,
+ (RecordSetPtr) ((char *) pRCAP + si[ERR].offset),
+ si[ERR].size);
}
- else pRCAP->pErrorSet = NULL;
+ else
+ pRCAP->pErrorSet = NULL;
- if (si[DEV].intervals)
- {
- pRCAP->pDeviceEventSet =
- RecordCreateSet(si[DEV].intervals, si[DEV].nintervals,
- (RecordSetPtr)((char *)pRCAP + si[DEV].offset), si[DEV].size);
+ if (si[DEV].intervals) {
+ pRCAP->pDeviceEventSet =
+ RecordCreateSet(si[DEV].intervals, si[DEV].nintervals,
+ (RecordSetPtr) ((char *) pRCAP + si[DEV].offset),
+ si[DEV].size);
}
- else pRCAP->pDeviceEventSet = NULL;
+ else
+ pRCAP->pDeviceEventSet = NULL;
- if (si[DLEV].intervals)
- {
- pRCAP->pDeliveredEventSet =
- RecordCreateSet(si[DLEV].intervals, si[DLEV].nintervals,
- (RecordSetPtr)((char *)pRCAP + si[DLEV].offset), si[DLEV].size);
+ if (si[DLEV].intervals) {
+ pRCAP->pDeliveredEventSet =
+ RecordCreateSet(si[DLEV].intervals, si[DLEV].nintervals,
+ (RecordSetPtr) ((char *) pRCAP + si[DLEV].offset),
+ si[DLEV].size);
}
- else pRCAP->pDeliveredEventSet = NULL;
-
- if (nExtReqSets)
- {
- pRCAP->pRequestMinOpInfo = (RecordMinorOpPtr)
- ((char *)pRCAP + extReqSetsOffset);
- pRCAP->pRequestMinOpInfo[0].count = nExtReqSets;
- for (i = 0; i < nExtReqSets; i++, pExtReqSets++)
- {
- pRCAP->pRequestMinOpInfo[i+1].major.first = pExtReqSets->first;
- pRCAP->pRequestMinOpInfo[i+1].major.last = pExtReqSets->last;
- pRCAP->pRequestMinOpInfo[i+1].major.pMinOpSet =
- RecordCreateSet(pExtReqSets->intervals,
- pExtReqSets->nintervals,
- (RecordSetPtr)((char *)pRCAP + pExtReqSets->offset),
- pExtReqSets->size);
- }
+ else
+ pRCAP->pDeliveredEventSet = NULL;
+
+ if (nExtReqSets) {
+ pRCAP->pRequestMinOpInfo = (RecordMinorOpPtr)
+ ((char *) pRCAP + extReqSetsOffset);
+ pRCAP->pRequestMinOpInfo[0].count = nExtReqSets;
+ for (i = 0; i < nExtReqSets; i++, pExtReqSets++) {
+ pRCAP->pRequestMinOpInfo[i + 1].major.first = pExtReqSets->first;
+ pRCAP->pRequestMinOpInfo[i + 1].major.last = pExtReqSets->last;
+ pRCAP->pRequestMinOpInfo[i + 1].major.pMinOpSet =
+ RecordCreateSet(pExtReqSets->intervals,
+ pExtReqSets->nintervals,
+ (RecordSetPtr) ((char *) pRCAP +
+ pExtReqSets->offset),
+ pExtReqSets->size);
+ }
}
- else pRCAP->pRequestMinOpInfo = NULL;
-
- if (nExtRepSets)
- {
- pRCAP->pReplyMinOpInfo = (RecordMinorOpPtr)
- ((char *)pRCAP + extRepSetsOffset);
- pRCAP->pReplyMinOpInfo[0].count = nExtRepSets;
- for (i = 0; i < nExtRepSets; i++, pExtRepSets++)
- {
- pRCAP->pReplyMinOpInfo[i+1].major.first = pExtRepSets->first;
- pRCAP->pReplyMinOpInfo[i+1].major.last = pExtRepSets->last;
- pRCAP->pReplyMinOpInfo[i+1].major.pMinOpSet =
- RecordCreateSet(pExtRepSets->intervals,
- pExtRepSets->nintervals,
- (RecordSetPtr)((char *)pRCAP + pExtRepSets->offset),
- pExtRepSets->size);
- }
+ else
+ pRCAP->pRequestMinOpInfo = NULL;
+
+ if (nExtRepSets) {
+ pRCAP->pReplyMinOpInfo = (RecordMinorOpPtr)
+ ((char *) pRCAP + extRepSetsOffset);
+ pRCAP->pReplyMinOpInfo[0].count = nExtRepSets;
+ for (i = 0; i < nExtRepSets; i++, pExtRepSets++) {
+ pRCAP->pReplyMinOpInfo[i + 1].major.first = pExtRepSets->first;
+ pRCAP->pReplyMinOpInfo[i + 1].major.last = pExtRepSets->last;
+ pRCAP->pReplyMinOpInfo[i + 1].major.pMinOpSet =
+ RecordCreateSet(pExtRepSets->intervals,
+ pExtRepSets->nintervals,
+ (RecordSetPtr) ((char *) pRCAP +
+ pExtRepSets->offset),
+ pExtRepSets->size);
+ }
}
- else pRCAP->pReplyMinOpInfo = NULL;
+ else
+ pRCAP->pReplyMinOpInfo = NULL;
pRCAP->clientStarted = clientStarted;
- pRCAP->clientDied = clientDied;
+ pRCAP->clientDied = clientDied;
/* link the RCAP onto the context */
pRCAP->pNextRCAP = pContext->pListOfRCAP;
pContext->pListOfRCAP = pRCAP;
- if (pContext->pRecordingClient) /* context enabled */
- RecordInstallHooks(pRCAP, 0);
+ if (pContext->pRecordingClient) /* context enabled */
+ RecordInstallHooks(pRCAP, 0);
-bailout:
- if (si)
- {
- for (i = 0; i < maxSets; i++)
- free(si[i].intervals);
- free(si);
+ bailout:
+ if (si) {
+ for (i = 0; i < maxSets; i++)
+ free(si[i].intervals);
+ free(si);
}
- if (pCanonClients && pCanonClients != (XID *)&stuff[1])
- free(pCanonClients);
+ if (pCanonClients && pCanonClients != (XID *) &stuff[1])
+ free(pCanonClients);
return err;
-} /* RecordRegisterClients */
-
+} /* RecordRegisterClients */
/* Proc functions all take a client argument, execute the request in
* client->requestBuffer, and return a protocol error status.
@@ -1894,25 +1816,23 @@ static int
ProcRecordQueryVersion(ClientPtr client)
{
/* REQUEST(xRecordQueryVersionReq); */
- xRecordQueryVersionReply rep;
+ xRecordQueryVersionReply rep;
REQUEST_SIZE_MATCH(xRecordQueryVersionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = SERVER_RECORD_MAJOR_VERSION;
- rep.minorVersion = SERVER_RECORD_MINOR_VERSION;
- if(client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.majorVersion = SERVER_RECORD_MAJOR_VERSION;
+ rep.minorVersion = SERVER_RECORD_MINOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- (void)WriteToClient(client, sizeof(xRecordQueryVersionReply),
- (char *)&rep);
+ (void) WriteToClient(client, sizeof(xRecordQueryVersionReply),
+ (char *) &rep);
return Success;
-} /* ProcRecordQueryVersion */
-
+} /* ProcRecordQueryVersion */
static int
ProcRecordCreateContext(ClientPtr client)
@@ -1925,16 +1845,16 @@ ProcRecordCreateContext(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq);
LEGAL_NEW_RESOURCE(stuff->context, client);
- pContext = (RecordContextPtr)malloc(sizeof(RecordContextRec));
+ pContext = (RecordContextPtr) malloc(sizeof(RecordContextRec));
if (!pContext)
- goto bailout;
+ goto bailout;
/* make sure there is room in ppAllContexts to store the new context */
ppNewAllContexts = (RecordContextPtr *)
- realloc(ppAllContexts, sizeof(RecordContextPtr) * (numContexts + 1));
+ realloc(ppAllContexts, sizeof(RecordContextPtr) * (numContexts + 1));
if (!ppNewAllContexts)
- goto bailout;
+ goto bailout;
ppAllContexts = ppNewAllContexts;
pContext->id = stuff->context;
@@ -1948,44 +1868,42 @@ ProcRecordCreateContext(ClientPtr client)
pContext->inFlush = 0;
err = RecordRegisterClients(pContext, client,
- (xRecordRegisterClientsReq *)stuff);
+ (xRecordRegisterClientsReq *) stuff);
if (err != Success)
- goto bailout;
+ goto bailout;
- if (AddResource(pContext->id, RTContext, pContext))
- {
- ppAllContexts[numContexts++] = pContext;
- return Success;
+ if (AddResource(pContext->id, RTContext, pContext)) {
+ ppAllContexts[numContexts++] = pContext;
+ return Success;
}
- else
- {
- RecordDeleteContext((pointer)pContext, pContext->id);
- return BadAlloc;
+ else {
+ RecordDeleteContext((pointer) pContext, pContext->id);
+ return BadAlloc;
}
-bailout:
+ bailout:
free(pContext);
return err;
-} /* ProcRecordCreateContext */
-
+} /* ProcRecordCreateContext */
static int
ProcRecordRegisterClients(ClientPtr client)
{
RecordContextPtr pContext;
+
REQUEST(xRecordRegisterClientsReq);
REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq);
VERIFY_CONTEXT(pContext, stuff->context, client);
return RecordRegisterClients(pContext, client, stuff);
-} /* ProcRecordRegisterClients */
-
+} /* ProcRecordRegisterClients */
static int
ProcRecordUnregisterClients(ClientPtr client)
{
RecordContextPtr pContext;
int err;
+
REQUEST(xRecordUnregisterClientsReq);
XID *pCanonClients;
int nClients;
@@ -1993,29 +1911,27 @@ ProcRecordUnregisterClients(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xRecordUnregisterClientsReq);
if ((client->req_len << 2) - SIZEOF(xRecordUnregisterClientsReq) !=
- 4 * stuff->nClients)
- return BadLength;
+ 4 * stuff->nClients)
+ return BadLength;
VERIFY_CONTEXT(pContext, stuff->context, client);
- err = RecordSanityCheckClientSpecifiers(client, (XID *)&stuff[1],
- stuff->nClients, 0);
+ err = RecordSanityCheckClientSpecifiers(client, (XID *) &stuff[1],
+ stuff->nClients, 0);
if (err != Success)
- return err;
+ return err;
nClients = stuff->nClients;
- pCanonClients = RecordCanonicalizeClientSpecifiers((XID *)&stuff[1],
- &nClients, 0);
+ pCanonClients = RecordCanonicalizeClientSpecifiers((XID *) &stuff[1],
+ &nClients, 0);
if (!pCanonClients)
- return BadAlloc;
+ return BadAlloc;
- for (i = 0; i < nClients; i++)
- {
- RecordDeleteClientFromContext(pContext, pCanonClients[i]);
+ for (i = 0; i < nClients; i++) {
+ RecordDeleteClientFromContext(pContext, pCanonClients[i]);
}
- if (pCanonClients != (XID *)&stuff[1])
- free(pCanonClients);
+ if (pCanonClients != (XID *) &stuff[1])
+ free(pCanonClients);
return Success;
-} /* ProcRecordUnregisterClients */
-
+} /* ProcRecordUnregisterClients */
/****************************************************************************/
@@ -2026,12 +1942,11 @@ ProcRecordUnregisterClients(ClientPtr client)
*/
typedef struct {
- xRecordRange *pRanges; /* array of xRecordRanges for one RCAP */
- int size; /* number of elements in pRanges, >= nRanges */
- int nRanges; /* number of occupied element of pRanges */
+ xRecordRange *pRanges; /* array of xRecordRanges for one RCAP */
+ int size; /* number of elements in pRanges, >= nRanges */
+ int nRanges; /* number of occupied element of pRanges */
} GetContextRangeInfoRec, *GetContextRangeInfoPtr;
-
/* RecordAllocRanges
*
* Arguments:
@@ -2050,22 +1965,22 @@ RecordAllocRanges(GetContextRangeInfoPtr pri, int nRanges)
{
int newsize;
xRecordRange *pNewRange;
+
#define SZINCR 8
newsize = max(pri->size + SZINCR, nRanges);
- pNewRange = (xRecordRange *)realloc(pri->pRanges,
- newsize * sizeof(xRecordRange));
+ pNewRange = (xRecordRange *) realloc(pri->pRanges,
+ newsize * sizeof(xRecordRange));
if (!pNewRange)
- return BadAlloc;
+ return BadAlloc;
pri->pRanges = pNewRange;
pri->size = newsize;
memset(&pri->pRanges[pri->size - SZINCR], 0, SZINCR * sizeof(xRecordRange));
if (pri->nRanges < nRanges)
- pri->nRanges = nRanges;
+ pri->nRanges = nRanges;
return Success;
-} /* RecordAllocRanges */
-
+} /* RecordAllocRanges */
/* RecordConvertSetToRanges
*
@@ -2090,14 +2005,10 @@ RecordAllocRanges(GetContextRangeInfoPtr pri, int nRanges)
* more than the index of the last xRecordRange that was touched.
*/
static int
-RecordConvertSetToRanges(
- RecordSetPtr pSet,
- GetContextRangeInfoPtr pri,
- int byteoffset,
- Bool card8,
- unsigned int imax,
- int *pStartIndex
-)
+RecordConvertSetToRanges(RecordSetPtr pSet,
+ GetContextRangeInfoPtr pri,
+ int byteoffset,
+ Bool card8, unsigned int imax, int *pStartIndex)
{
int nRanges;
RecordSetIteratePtr pIter = NULL;
@@ -2107,41 +2018,38 @@ RecordConvertSetToRanges(
int err;
if (!pSet)
- return Success;
+ return Success;
nRanges = pStartIndex ? *pStartIndex : 0;
- while ((pIter = RecordIterateSet(pSet, pIter, &interval)))
- {
- if (interval.first > imax) break;
- if (interval.last > imax) interval.last = imax;
- nRanges++;
- if (nRanges > pri->size)
- {
- err = RecordAllocRanges(pri, nRanges);
- if (err != Success)
- return err;
- }
- else
- pri->nRanges = max(pri->nRanges, nRanges);
- if (card8)
- {
- pCARD8 = ((CARD8 *)&pri->pRanges[nRanges-1]) + byteoffset;
- *pCARD8++ = interval.first;
- *pCARD8 = interval.last;
- }
- else
- {
- pCARD16 = (CARD16 *)
- (((char *)&pri->pRanges[nRanges-1]) + byteoffset);
- *pCARD16++ = interval.first;
- *pCARD16 = interval.last;
- }
+ while ((pIter = RecordIterateSet(pSet, pIter, &interval))) {
+ if (interval.first > imax)
+ break;
+ if (interval.last > imax)
+ interval.last = imax;
+ nRanges++;
+ if (nRanges > pri->size) {
+ err = RecordAllocRanges(pri, nRanges);
+ if (err != Success)
+ return err;
+ }
+ else
+ pri->nRanges = max(pri->nRanges, nRanges);
+ if (card8) {
+ pCARD8 = ((CARD8 *) &pri->pRanges[nRanges - 1]) + byteoffset;
+ *pCARD8++ = interval.first;
+ *pCARD8 = interval.last;
+ }
+ else {
+ pCARD16 = (CARD16 *)
+ (((char *) &pri->pRanges[nRanges - 1]) + byteoffset);
+ *pCARD16++ = interval.first;
+ *pCARD16 = interval.last;
+ }
}
if (pStartIndex)
- *pStartIndex = nRanges;
+ *pStartIndex = nRanges;
return Success;
-} /* RecordConvertSetToRanges */
-
+} /* RecordConvertSetToRanges */
/* RecordConvertMinorOpInfoToRanges
*
@@ -2159,11 +2067,8 @@ RecordConvertSetToRanges(
* byteoffset is filled in with the information from pMinOpInfo.
*/
static int
-RecordConvertMinorOpInfoToRanges(
- RecordMinorOpPtr pMinOpInfo,
- GetContextRangeInfoPtr pri,
- int byteoffset
-)
+RecordConvertMinorOpInfoToRanges(RecordMinorOpPtr pMinOpInfo,
+ GetContextRangeInfoPtr pri, int byteoffset)
{
int nsets;
int start;
@@ -2171,28 +2076,28 @@ RecordConvertMinorOpInfoToRanges(
int err;
if (!pMinOpInfo)
- return Success;
+ return Success;
nsets = pMinOpInfo->count;
pMinOpInfo++;
start = 0;
- for (i = 0; i < nsets; i++)
- {
- int j, s;
- s = start;
- err = RecordConvertSetToRanges(pMinOpInfo[i].major.pMinOpSet, pri,
- byteoffset + 2, FALSE, 65535, &start);
- if (err != Success) return err;
- for (j = s; j < start; j++)
- {
- CARD8 *pCARD8 = ((CARD8 *)&pri->pRanges[j]) + byteoffset;
- *pCARD8++ = pMinOpInfo[i].major.first;
- *pCARD8 = pMinOpInfo[i].major.last;
- }
+ for (i = 0; i < nsets; i++) {
+ int j, s;
+
+ s = start;
+ err = RecordConvertSetToRanges(pMinOpInfo[i].major.pMinOpSet, pri,
+ byteoffset + 2, FALSE, 65535, &start);
+ if (err != Success)
+ return err;
+ for (j = s; j < start; j++) {
+ CARD8 *pCARD8 = ((CARD8 *) &pri->pRanges[j]) + byteoffset;
+
+ *pCARD8++ = pMinOpInfo[i].major.first;
+ *pCARD8 = pMinOpInfo[i].major.last;
+ }
}
return Success;
-} /* RecordConvertMinorOpInfoToRanges */
-
+} /* RecordConvertMinorOpInfoToRanges */
/* RecordSwapRanges
*
@@ -2206,23 +2111,23 @@ RecordConvertMinorOpInfoToRanges(
* The 16 bit fields of each xRecordRange are byte swapped.
*/
static void
-RecordSwapRanges(xRecordRange *pRanges, int nRanges)
+RecordSwapRanges(xRecordRange * pRanges, int nRanges)
{
int i;
- for (i = 0; i < nRanges; i++, pRanges++)
- {
- swaps(&pRanges->extRequestsMinorFirst);
- swaps(&pRanges->extRequestsMinorLast);
- swaps(&pRanges->extRepliesMinorFirst);
- swaps(&pRanges->extRepliesMinorLast);
- }
-} /* RecordSwapRanges */
+ for (i = 0; i < nRanges; i++, pRanges++) {
+ swaps(&pRanges->extRequestsMinorFirst);
+ swaps(&pRanges->extRequestsMinorLast);
+ swaps(&pRanges->extRepliesMinorFirst);
+ swaps(&pRanges->extRepliesMinorLast);
+ }
+} /* RecordSwapRanges */
static int
ProcRecordGetContext(ClientPtr client)
{
RecordContextPtr pContext;
+
REQUEST(xRecordGetContextReq);
xRecordGetContextReply rep;
RecordClientsAndProtocolPtr pRCAP;
@@ -2238,19 +2143,19 @@ ProcRecordGetContext(ClientPtr client)
/* how many RCAPs are there on this context? */
for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
- nRCAPs++;
+ nRCAPs++;
/* allocate and initialize space for record range info */
- pRangeInfo = (GetContextRangeInfoPtr)malloc(
- nRCAPs * sizeof(GetContextRangeInfoRec));
+ pRangeInfo =
+ (GetContextRangeInfoPtr) malloc(nRCAPs *
+ sizeof(GetContextRangeInfoRec));
if (!pRangeInfo && nRCAPs > 0)
- return BadAlloc;
- for (i = 0; i < nRCAPs; i++)
- {
- pRangeInfo[i].pRanges = NULL;
- pRangeInfo[i].size = 0;
- pRangeInfo[i].nRanges = 0;
+ return BadAlloc;
+ for (i = 0; i < nRCAPs; i++) {
+ pRangeInfo[i].pRanges = NULL;
+ pRangeInfo[i].size = 0;
+ pRangeInfo[i].nRanges = 0;
}
/* convert the RCAP (internal) representation of the recorded protocol
@@ -2259,46 +2164,57 @@ ProcRecordGetContext(ClientPtr client)
*/
for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
- pRCAP;
- pRCAP = pRCAP->pNextRCAP, pri++)
- {
- xRecordRange rr;
-
- err = RecordConvertSetToRanges(pRCAP->pRequestMajorOpSet, pri,
- offset_of(rr, coreRequestsFirst), TRUE, 127, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertSetToRanges(pRCAP->pReplyMajorOpSet, pri,
- offset_of(rr, coreRepliesFirst), TRUE, 127, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertSetToRanges(pRCAP->pDeliveredEventSet, pri,
- offset_of(rr, deliveredEventsFirst), TRUE, 255, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertSetToRanges(pRCAP->pDeviceEventSet, pri,
- offset_of(rr, deviceEventsFirst), TRUE, 255, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertSetToRanges(pRCAP->pErrorSet, pri,
- offset_of(rr, errorsFirst), TRUE, 255, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertMinorOpInfoToRanges(pRCAP->pRequestMinOpInfo,
- pri, offset_of(rr, extRequestsMajorFirst));
- if (err != Success) goto bailout;
-
- err = RecordConvertMinorOpInfoToRanges(pRCAP->pReplyMinOpInfo,
- pri, offset_of(rr, extRepliesMajorFirst));
- if (err != Success) goto bailout;
-
- if (pRCAP->clientStarted || pRCAP->clientDied)
- {
- if (pri->nRanges == 0)
- RecordAllocRanges(pri, 1);
- pri->pRanges[0].clientStarted = pRCAP->clientStarted;
- pri->pRanges[0].clientDied = pRCAP->clientDied;
- }
+ pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) {
+ xRecordRange rr;
+
+ err = RecordConvertSetToRanges(pRCAP->pRequestMajorOpSet, pri,
+ offset_of(rr, coreRequestsFirst), TRUE,
+ 127, NULL);
+ if (err != Success)
+ goto bailout;
+
+ err = RecordConvertSetToRanges(pRCAP->pReplyMajorOpSet, pri,
+ offset_of(rr, coreRepliesFirst), TRUE,
+ 127, NULL);
+ if (err != Success)
+ goto bailout;
+
+ err = RecordConvertSetToRanges(pRCAP->pDeliveredEventSet, pri,
+ offset_of(rr, deliveredEventsFirst),
+ TRUE, 255, NULL);
+ if (err != Success)
+ goto bailout;
+
+ err = RecordConvertSetToRanges(pRCAP->pDeviceEventSet, pri,
+ offset_of(rr, deviceEventsFirst), TRUE,
+ 255, NULL);
+ if (err != Success)
+ goto bailout;
+
+ err = RecordConvertSetToRanges(pRCAP->pErrorSet, pri,
+ offset_of(rr, errorsFirst), TRUE, 255,
+ NULL);
+ if (err != Success)
+ goto bailout;
+
+ err = RecordConvertMinorOpInfoToRanges(pRCAP->pRequestMinOpInfo,
+ pri, offset_of(rr,
+ extRequestsMajorFirst));
+ if (err != Success)
+ goto bailout;
+
+ err = RecordConvertMinorOpInfoToRanges(pRCAP->pReplyMinOpInfo,
+ pri, offset_of(rr,
+ extRepliesMajorFirst));
+ if (err != Success)
+ goto bailout;
+
+ if (pRCAP->clientStarted || pRCAP->clientDied) {
+ if (pri->nRanges == 0)
+ RecordAllocRanges(pri, 1);
+ pri->pRanges[0].clientStarted = pRCAP->clientStarted;
+ pri->pRanges[0].clientDied = pRCAP->clientDied;
+ }
}
/* calculate number of clients and reply length */
@@ -2306,68 +2222,61 @@ ProcRecordGetContext(ClientPtr client)
rep.nClients = 0;
rep.length = 0;
for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
- pRCAP;
- pRCAP = pRCAP->pNextRCAP, pri++)
- {
- rep.nClients += pRCAP->numClients;
- rep.length += pRCAP->numClients *
- ( bytes_to_int32(sizeof(xRecordClientInfo)) +
- pri->nRanges * bytes_to_int32(sizeof(xRecordRange)));
+ pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) {
+ rep.nClients += pRCAP->numClients;
+ rep.length += pRCAP->numClients *
+ (bytes_to_int32(sizeof(xRecordClientInfo)) +
+ pri->nRanges * bytes_to_int32(sizeof(xRecordRange)));
}
/* write the reply header */
rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
+ rep.sequenceNumber = client->sequence;
rep.enabled = pContext->pRecordingClient != NULL;
rep.elementHeader = pContext->elemHeaders;
- if(client->swapped)
- {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.nClients);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.nClients);
}
- (void)WriteToClient(client, sizeof(xRecordGetContextReply),
- (char *)&rep);
+ (void) WriteToClient(client, sizeof(xRecordGetContextReply), (char *) &rep);
/* write all the CLIENT_INFOs */
for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
- pRCAP;
- pRCAP = pRCAP->pNextRCAP, pri++)
- {
- xRecordClientInfo rci;
- rci.nRanges = pri->nRanges;
- if (client->swapped)
- {
- swapl(&rci.nRanges);
- RecordSwapRanges(pri->pRanges, pri->nRanges);
- }
- for (i = 0; i < pRCAP->numClients; i++)
- {
- rci.clientResource = pRCAP->pClientIDs[i];
- if (client->swapped) swapl(&rci.clientResource);
- WriteToClient(client, sizeof(xRecordClientInfo), (char *)&rci);
- WriteToClient(client, sizeof(xRecordRange) * pri->nRanges,
- (char *)pri->pRanges);
- }
+ pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) {
+ xRecordClientInfo rci;
+
+ rci.nRanges = pri->nRanges;
+ if (client->swapped) {
+ swapl(&rci.nRanges);
+ RecordSwapRanges(pri->pRanges, pri->nRanges);
+ }
+ for (i = 0; i < pRCAP->numClients; i++) {
+ rci.clientResource = pRCAP->pClientIDs[i];
+ if (client->swapped)
+ swapl(&rci.clientResource);
+ WriteToClient(client, sizeof(xRecordClientInfo), (char *) &rci);
+ WriteToClient(client, sizeof(xRecordRange) * pri->nRanges,
+ (char *) pri->pRanges);
+ }
}
err = Success;
-bailout:
- for (i = 0; i < nRCAPs; i++)
- {
- free(pRangeInfo[i].pRanges);
+ bailout:
+ for (i = 0; i < nRCAPs; i++) {
+ free(pRangeInfo[i].pRanges);
}
free(pRangeInfo);
return err;
-} /* ProcRecordGetContext */
-
+} /* ProcRecordGetContext */
static int
ProcRecordEnableContext(ClientPtr client)
{
RecordContextPtr pContext;
+
REQUEST(xRecordEnableContextReq);
int i;
RecordClientsAndProtocolPtr pRCAP;
@@ -2375,24 +2284,23 @@ ProcRecordEnableContext(ClientPtr client)
REQUEST_SIZE_MATCH(xRecordGetContextReq);
VERIFY_CONTEXT(pContext, stuff->context, client);
if (pContext->pRecordingClient)
- return BadMatch; /* already enabled */
+ return BadMatch; /* already enabled */
/* install record hooks for each RCAP */
- for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
- {
- int err = RecordInstallHooks(pRCAP, 0);
- if (err != Success)
- { /* undo the previous installs */
- RecordClientsAndProtocolPtr pUninstallRCAP;
- for (pUninstallRCAP = pContext->pListOfRCAP;
- pUninstallRCAP != pRCAP;
- pUninstallRCAP = pUninstallRCAP->pNextRCAP)
- {
- RecordUninstallHooks(pUninstallRCAP, 0);
- }
- return err;
- }
+ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP) {
+ int err = RecordInstallHooks(pRCAP, 0);
+
+ if (err != Success) { /* undo the previous installs */
+ RecordClientsAndProtocolPtr pUninstallRCAP;
+
+ for (pUninstallRCAP = pContext->pListOfRCAP;
+ pUninstallRCAP != pRCAP;
+ pUninstallRCAP = pUninstallRCAP->pNextRCAP) {
+ RecordUninstallHooks(pUninstallRCAP, 0);
+ }
+ return err;
+ }
}
/* Disallow further request processing on this connection until
@@ -2403,17 +2311,16 @@ ProcRecordEnableContext(ClientPtr client)
/* Don't allow the data connection to record itself; unregister it. */
RecordDeleteClientFromContext(pContext,
- pContext->pRecordingClient->clientAsMask);
+ pContext->pRecordingClient->clientAsMask);
/* move the newly enabled context to the front part of ppAllContexts,
* where all the enabled contexts are
*/
i = RecordFindContextOnAllContexts(pContext);
assert(i >= numEnabledContexts);
- if (i != numEnabledContexts)
- {
- ppAllContexts[i] = ppAllContexts[numEnabledContexts];
- ppAllContexts[numEnabledContexts] = pContext;
+ if (i != numEnabledContexts) {
+ ppAllContexts[i] = ppAllContexts[numEnabledContexts];
+ ppAllContexts[numEnabledContexts] = pContext;
}
++numEnabledContexts;
@@ -2423,8 +2330,7 @@ ProcRecordEnableContext(ClientPtr client)
RecordAProtocolElement(pContext, NULL, XRecordStartOfData, NULL, 0, 0, 0);
RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
return Success;
-} /* ProcRecordEnableContext */
-
+} /* ProcRecordEnableContext */
/* RecordDisableContext
*
@@ -2448,18 +2354,17 @@ RecordDisableContext(RecordContextPtr pContext)
RecordClientsAndProtocolPtr pRCAP;
int i;
- if (!pContext->pRecordingClient) return;
- if (!pContext->pRecordingClient->clientGone)
- {
- RecordAProtocolElement(pContext, NULL, XRecordEndOfData, NULL, 0, 0, 0);
- RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
- /* Re-enable request processing on this connection. */
- AttendClient(pContext->pRecordingClient);
+ if (!pContext->pRecordingClient)
+ return;
+ if (!pContext->pRecordingClient->clientGone) {
+ RecordAProtocolElement(pContext, NULL, XRecordEndOfData, NULL, 0, 0, 0);
+ RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
+ /* Re-enable request processing on this connection. */
+ AttendClient(pContext->pRecordingClient);
}
- for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
- {
- RecordUninstallHooks(pRCAP, 0);
+ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP) {
+ RecordUninstallHooks(pRCAP, 0);
}
pContext->pRecordingClient = NULL;
@@ -2468,29 +2373,27 @@ RecordDisableContext(RecordContextPtr pContext)
* where all the disabled contexts are
*/
i = RecordFindContextOnAllContexts(pContext);
- assert( (i != -1) && (i < numEnabledContexts) );
- if (i != (numEnabledContexts - 1) )
- {
- ppAllContexts[i] = ppAllContexts[numEnabledContexts-1];
- ppAllContexts[numEnabledContexts-1] = pContext;
+ assert((i != -1) && (i < numEnabledContexts));
+ if (i != (numEnabledContexts - 1)) {
+ ppAllContexts[i] = ppAllContexts[numEnabledContexts - 1];
+ ppAllContexts[numEnabledContexts - 1] = pContext;
}
--numEnabledContexts;
assert(numEnabledContexts >= 0);
-} /* RecordDisableContext */
-
+} /* RecordDisableContext */
static int
ProcRecordDisableContext(ClientPtr client)
{
RecordContextPtr pContext;
+
REQUEST(xRecordDisableContextReq);
REQUEST_SIZE_MATCH(xRecordDisableContextReq);
VERIFY_CONTEXT(pContext, stuff->context, client);
RecordDisableContext(pContext);
return Success;
-} /* ProcRecordDisableContext */
-
+} /* ProcRecordDisableContext */
/* RecordDeleteContext
*
@@ -2508,7 +2411,7 @@ static int
RecordDeleteContext(pointer value, XID id)
{
int i;
- RecordContextPtr pContext = (RecordContextPtr)value;
+ RecordContextPtr pContext = (RecordContextPtr) value;
RecordClientsAndProtocolPtr pRCAP;
RecordDisableContext(pContext);
@@ -2517,74 +2420,68 @@ RecordDeleteContext(pointer value, XID id)
* As a result, the RCAPs will be freed.
*/
- while ((pRCAP = pContext->pListOfRCAP))
- {
- int numClients = pRCAP->numClients;
- /* when the last client is deleted, the RCAP will go away. */
- while(numClients--)
- {
- RecordDeleteClientFromRCAP(pRCAP, numClients);
- }
+ while ((pRCAP = pContext->pListOfRCAP)) {
+ int numClients = pRCAP->numClients;
+
+ /* when the last client is deleted, the RCAP will go away. */
+ while (numClients--) {
+ RecordDeleteClientFromRCAP(pRCAP, numClients);
+ }
}
/* remove context from AllContexts list */
- if (-1 != (i = RecordFindContextOnAllContexts(pContext)))
- {
- ppAllContexts[i] = ppAllContexts[numContexts - 1];
- if (--numContexts == 0)
- {
- free(ppAllContexts);
- ppAllContexts = NULL;
- }
+ if (-1 != (i = RecordFindContextOnAllContexts(pContext))) {
+ ppAllContexts[i] = ppAllContexts[numContexts - 1];
+ if (--numContexts == 0) {
+ free(ppAllContexts);
+ ppAllContexts = NULL;
+ }
}
free(pContext);
return Success;
-} /* RecordDeleteContext */
-
+} /* RecordDeleteContext */
static int
ProcRecordFreeContext(ClientPtr client)
{
RecordContextPtr pContext;
+
REQUEST(xRecordFreeContextReq);
REQUEST_SIZE_MATCH(xRecordFreeContextReq);
VERIFY_CONTEXT(pContext, stuff->context, client);
FreeResource(stuff->context, RT_NONE);
return Success;
-} /* ProcRecordFreeContext */
-
+} /* ProcRecordFreeContext */
static int
ProcRecordDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
- case X_RecordQueryVersion:
- return ProcRecordQueryVersion(client);
- case X_RecordCreateContext:
- return ProcRecordCreateContext(client);
- case X_RecordRegisterClients:
- return ProcRecordRegisterClients(client);
- case X_RecordUnregisterClients:
- return ProcRecordUnregisterClients(client);
- case X_RecordGetContext:
- return ProcRecordGetContext(client);
- case X_RecordEnableContext:
- return ProcRecordEnableContext(client);
- case X_RecordDisableContext:
- return ProcRecordDisableContext(client);
- case X_RecordFreeContext:
- return ProcRecordFreeContext(client);
- default:
- return BadRequest;
+ switch (stuff->data) {
+ case X_RecordQueryVersion:
+ return ProcRecordQueryVersion(client);
+ case X_RecordCreateContext:
+ return ProcRecordCreateContext(client);
+ case X_RecordRegisterClients:
+ return ProcRecordRegisterClients(client);
+ case X_RecordUnregisterClients:
+ return ProcRecordUnregisterClients(client);
+ case X_RecordGetContext:
+ return ProcRecordGetContext(client);
+ case X_RecordEnableContext:
+ return ProcRecordEnableContext(client);
+ case X_RecordDisableContext:
+ return ProcRecordDisableContext(client);
+ case X_RecordFreeContext:
+ return ProcRecordFreeContext(client);
+ default:
+ return BadRequest;
}
-} /* ProcRecordDispatch */
-
+} /* ProcRecordDispatch */
static int
SProcRecordQueryVersion(ClientPtr client)
@@ -2596,11 +2493,10 @@ SProcRecordQueryVersion(ClientPtr client)
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcRecordQueryVersion(client);
-} /* SProcRecordQueryVersion */
-
+} /* SProcRecordQueryVersion */
static int
-SwapCreateRegister(xRecordRegisterClientsReq *stuff)
+SwapCreateRegister(xRecordRegisterClientsReq * stuff)
{
int i;
XID *pClientID;
@@ -2608,48 +2504,46 @@ SwapCreateRegister(xRecordRegisterClientsReq *stuff)
swapl(&stuff->context);
swapl(&stuff->nClients);
swapl(&stuff->nRanges);
- pClientID = (XID *)&stuff[1];
- if (stuff->nClients > stuff->length - bytes_to_int32(sz_xRecordRegisterClientsReq))
- return BadLength;
- for (i = 0; i < stuff->nClients; i++, pClientID++)
- {
- swapl(pClientID);
+ pClientID = (XID *) &stuff[1];
+ if (stuff->nClients >
+ stuff->length - bytes_to_int32(sz_xRecordRegisterClientsReq))
+ return BadLength;
+ for (i = 0; i < stuff->nClients; i++, pClientID++) {
+ swapl(pClientID);
}
- if (stuff->nRanges > stuff->length - bytes_to_int32(sz_xRecordRegisterClientsReq)
- - stuff->nClients)
- return BadLength;
- RecordSwapRanges((xRecordRange *)pClientID, stuff->nRanges);
+ if (stuff->nRanges >
+ stuff->length - bytes_to_int32(sz_xRecordRegisterClientsReq)
+ - stuff->nClients)
+ return BadLength;
+ RecordSwapRanges((xRecordRange *) pClientID, stuff->nRanges);
return Success;
-} /* SwapCreateRegister */
-
+} /* SwapCreateRegister */
static int
SProcRecordCreateContext(ClientPtr client)
{
REQUEST(xRecordCreateContextReq);
- int status;
+ int status;
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq);
- if ((status = SwapCreateRegister((pointer)stuff)) != Success)
- return status;
+ if ((status = SwapCreateRegister((pointer) stuff)) != Success)
+ return status;
return ProcRecordCreateContext(client);
-} /* SProcRecordCreateContext */
-
+} /* SProcRecordCreateContext */
static int
SProcRecordRegisterClients(ClientPtr client)
{
REQUEST(xRecordRegisterClientsReq);
- int status;
+ int status;
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq);
- if ((status = SwapCreateRegister((pointer)stuff)) != Success)
- return status;
+ if ((status = SwapCreateRegister((pointer) stuff)) != Success)
+ return status;
return ProcRecordRegisterClients(client);
-} /* SProcRecordRegisterClients */
-
+} /* SProcRecordRegisterClients */
static int
SProcRecordUnregisterClients(ClientPtr client)
@@ -2662,8 +2556,7 @@ SProcRecordUnregisterClients(ClientPtr client)
swapl(&stuff->nClients);
SwapRestL(stuff);
return ProcRecordUnregisterClients(client);
-} /* SProcRecordUnregisterClients */
-
+} /* SProcRecordUnregisterClients */
static int
SProcRecordGetContext(ClientPtr client)
@@ -2674,7 +2567,7 @@ SProcRecordGetContext(ClientPtr client)
REQUEST_SIZE_MATCH(xRecordGetContextReq);
swapl(&stuff->context);
return ProcRecordGetContext(client);
-} /* SProcRecordGetContext */
+} /* SProcRecordGetContext */
static int
SProcRecordEnableContext(ClientPtr client)
@@ -2685,8 +2578,7 @@ SProcRecordEnableContext(ClientPtr client)
REQUEST_SIZE_MATCH(xRecordEnableContextReq);
swapl(&stuff->context);
return ProcRecordEnableContext(client);
-} /* SProcRecordEnableContext */
-
+} /* SProcRecordEnableContext */
static int
SProcRecordDisableContext(ClientPtr client)
@@ -2697,8 +2589,7 @@ SProcRecordDisableContext(ClientPtr client)
REQUEST_SIZE_MATCH(xRecordDisableContextReq);
swapl(&stuff->context);
return ProcRecordDisableContext(client);
-} /* SProcRecordDisableContext */
-
+} /* SProcRecordDisableContext */
static int
SProcRecordFreeContext(ClientPtr client)
@@ -2709,36 +2600,34 @@ SProcRecordFreeContext(ClientPtr client)
REQUEST_SIZE_MATCH(xRecordFreeContextReq);
swapl(&stuff->context);
return ProcRecordFreeContext(client);
-} /* SProcRecordFreeContext */
-
+} /* SProcRecordFreeContext */
static int
SProcRecordDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
- case X_RecordQueryVersion:
- return SProcRecordQueryVersion(client);
- case X_RecordCreateContext:
- return SProcRecordCreateContext(client);
- case X_RecordRegisterClients:
- return SProcRecordRegisterClients(client);
- case X_RecordUnregisterClients:
- return SProcRecordUnregisterClients(client);
- case X_RecordGetContext:
- return SProcRecordGetContext(client);
- case X_RecordEnableContext:
- return SProcRecordEnableContext(client);
- case X_RecordDisableContext:
- return SProcRecordDisableContext(client);
- case X_RecordFreeContext:
- return SProcRecordFreeContext(client);
- default:
- return BadRequest;
+ switch (stuff->data) {
+ case X_RecordQueryVersion:
+ return SProcRecordQueryVersion(client);
+ case X_RecordCreateContext:
+ return SProcRecordCreateContext(client);
+ case X_RecordRegisterClients:
+ return SProcRecordRegisterClients(client);
+ case X_RecordUnregisterClients:
+ return SProcRecordUnregisterClients(client);
+ case X_RecordGetContext:
+ return SProcRecordGetContext(client);
+ case X_RecordEnableContext:
+ return SProcRecordEnableContext(client);
+ case X_RecordDisableContext:
+ return SProcRecordDisableContext(client);
+ case X_RecordFreeContext:
+ return SProcRecordFreeContext(client);
+ default:
+ return BadRequest;
}
-} /* SProcRecordDispatch */
+} /* SProcRecordDispatch */
/* RecordConnectionSetupInfo
*
@@ -2753,34 +2642,35 @@ SProcRecordDispatch(ClientPtr client)
* The connection setup info is sent to the recording client.
*/
static void
-RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec *pci)
+RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec * pci)
{
int prefixsize = SIZEOF(xConnSetupPrefix);
int restsize = pci->prefix->length * 4;
- if (pci->client->swapped)
- {
- char *pConnSetup = (char *)malloc(prefixsize + restsize);
- if (!pConnSetup)
- return;
- SwapConnSetupPrefix(pci->prefix, (xConnSetupPrefix*)pConnSetup);
- SwapConnSetupInfo((char*)pci->setup, (char*)(pConnSetup + prefixsize));
- RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
- (pointer)pConnSetup, prefixsize + restsize, 0, 0);
- free(pConnSetup);
+ if (pci->client->swapped) {
+ char *pConnSetup = (char *) malloc(prefixsize + restsize);
+
+ if (!pConnSetup)
+ return;
+ SwapConnSetupPrefix(pci->prefix, (xConnSetupPrefix *) pConnSetup);
+ SwapConnSetupInfo((char *) pci->setup,
+ (char *) (pConnSetup + prefixsize));
+ RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
+ (pointer) pConnSetup, prefixsize + restsize, 0,
+ 0);
+ free(pConnSetup);
}
- else
- {
- /* don't alloc and copy as in the swapped case; just send the
- * data in two pieces
- */
- RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
- (pointer)pci->prefix, prefixsize, 0, restsize);
- RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
- (pointer)pci->setup, restsize, 0, /* continuation */ -1);
+ else {
+ /* don't alloc and copy as in the swapped case; just send the
+ * data in two pieces
+ */
+ RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
+ (pointer) pci->prefix, prefixsize, 0, restsize);
+ RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
+ (pointer) pci->setup, restsize, 0,
+ /* continuation */ -1);
}
-} /* RecordConnectionSetupInfo */
-
+} /* RecordConnectionSetupInfo */
/* RecordDeleteContext
*
@@ -2806,67 +2696,65 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec *pci)
*/
static void
-RecordAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+RecordAClientStateChange(CallbackListPtr *pcbl, pointer nulldata,
+ pointer calldata)
{
- NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
+ NewClientInfoRec *pci = (NewClientInfoRec *) calldata;
int i;
ClientPtr pClient = pci->client;
RecordContextPtr *ppAllContextsCopy = NULL;
int numContextsCopy = 0;
- switch (pClient->clientState)
- {
- case ClientStateRunning: /* new client */
- for (i = 0; i < numContexts; i++)
- {
- RecordClientsAndProtocolPtr pRCAP;
- RecordContextPtr pContext = ppAllContexts[i];
-
- if ((pRCAP = RecordFindClientOnContext(pContext,
- XRecordFutureClients, NULL)))
- {
- RecordAddClientToRCAP(pRCAP, pClient->clientAsMask);
- if (pContext->pRecordingClient && pRCAP->clientStarted)
- RecordConnectionSetupInfo(pContext, pci);
- }
- }
- break;
+ switch (pClient->clientState) {
+ case ClientStateRunning: /* new client */
+ for (i = 0; i < numContexts; i++) {
+ RecordClientsAndProtocolPtr pRCAP;
+ RecordContextPtr pContext = ppAllContexts[i];
+
+ if ((pRCAP = RecordFindClientOnContext(pContext,
+ XRecordFutureClients, NULL)))
+ {
+ RecordAddClientToRCAP(pRCAP, pClient->clientAsMask);
+ if (pContext->pRecordingClient && pRCAP->clientStarted)
+ RecordConnectionSetupInfo(pContext, pci);
+ }
+ }
+ break;
case ClientStateGone:
- case ClientStateRetained: /* client disconnected */
+ case ClientStateRetained: /* client disconnected */
/* RecordDisableContext modifies contents of ppAllContexts. */
- numContextsCopy = numContexts;
- ppAllContextsCopy = malloc(numContextsCopy * sizeof(RecordContextPtr));
- assert(ppAllContextsCopy);
- memcpy(ppAllContextsCopy, ppAllContexts, numContextsCopy * sizeof(RecordContextPtr));
-
- for (i = 0; i < numContextsCopy; i++)
- {
- RecordClientsAndProtocolPtr pRCAP;
- RecordContextPtr pContext = ppAllContextsCopy[i];
- int pos;
-
- if (pContext->pRecordingClient == pClient)
- RecordDisableContext(pContext);
- if ((pRCAP = RecordFindClientOnContext(pContext,
- pClient->clientAsMask, &pos)))
- {
- if (pContext->pRecordingClient && pRCAP->clientDied)
- RecordAProtocolElement(pContext, pClient,
- XRecordClientDied, NULL, 0, 0, 0);
- RecordDeleteClientFromRCAP(pRCAP, pos);
- }
- }
-
- free(ppAllContextsCopy);
- break;
+ numContextsCopy = numContexts;
+ ppAllContextsCopy = malloc(numContextsCopy * sizeof(RecordContextPtr));
+ assert(ppAllContextsCopy);
+ memcpy(ppAllContextsCopy, ppAllContexts,
+ numContextsCopy * sizeof(RecordContextPtr));
+
+ for (i = 0; i < numContextsCopy; i++) {
+ RecordClientsAndProtocolPtr pRCAP;
+ RecordContextPtr pContext = ppAllContextsCopy[i];
+ int pos;
+
+ if (pContext->pRecordingClient == pClient)
+ RecordDisableContext(pContext);
+ if ((pRCAP = RecordFindClientOnContext(pContext,
+ pClient->clientAsMask,
+ &pos))) {
+ if (pContext->pRecordingClient && pRCAP->clientDied)
+ RecordAProtocolElement(pContext, pClient,
+ XRecordClientDied, NULL, 0, 0, 0);
+ RecordDeleteClientFromRCAP(pRCAP, pos);
+ }
+ }
+
+ free(ppAllContextsCopy);
+ break;
default:
- break;
- } /* end switch on client state */
-} /* RecordAClientStateChange */
-
+ break;
+ } /* end switch on client state */
+} /* RecordAClientStateChange */
/* RecordCloseDown
*
@@ -2880,11 +2768,10 @@ RecordAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer callda
*
*/
static void
-RecordCloseDown(ExtensionEntry *extEntry)
+RecordCloseDown(ExtensionEntry * extEntry)
{
DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL);
-} /* RecordCloseDown */
-
+} /* RecordCloseDown */
/* RecordExtensionInit
*
@@ -2895,14 +2782,14 @@ RecordCloseDown(ExtensionEntry *extEntry)
* Side Effects:
* Enables the RECORD extension if possible.
*/
-void
+void
RecordExtensionInit(void)
{
ExtensionEntry *extentry;
RTContext = CreateNewResourceType(RecordDeleteContext, "RecordContext");
if (!RTContext)
- return;
+ return;
if (!dixRegisterPrivateKey(RecordClientPrivateKey, PRIVATE_CLIENT, 0))
return;
@@ -2911,17 +2798,16 @@ RecordExtensionInit(void)
numContexts = numEnabledContexts = numEnabledRCAPs = 0;
if (!AddCallback(&ClientStateCallback, RecordAClientStateChange, NULL))
- return;
+ return;
extentry = AddExtension(RECORD_NAME, RecordNumEvents, RecordNumErrors,
- ProcRecordDispatch, SProcRecordDispatch,
- RecordCloseDown, StandardMinorOpcode);
- if (!extentry)
- {
- DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL);
- return;
+ ProcRecordDispatch, SProcRecordDispatch,
+ RecordCloseDown, StandardMinorOpcode);
+ if (!extentry) {
+ DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL);
+ return;
}
- SetResourceTypeErrorValue(RTContext, extentry->errorBase + XRecordBadContext);
-
-} /* RecordExtensionInit */
+ SetResourceTypeErrorValue(RTContext,
+ extentry->errorBase + XRecordBadContext);
+} /* RecordExtensionInit */
diff --git a/xorg-server/record/set.c b/xorg-server/record/set.c
index d4bb4f2cc..34faa617e 100644
--- a/xorg-server/record/set.c
+++ b/xorg-server/record/set.c
@@ -1,431 +1,425 @@
-/*
-
-Copyright 1995, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-/*
-
- See the header set.h for a description of the set ADT.
-
- Implementation Strategy
-
- A bit vector is an obvious choice to represent the set, but may take
- too much memory, depending on the numerically largest member in the
- set. One expected common case is for the client to ask for *all*
- protocol. This means it would ask for minor opcodes 0 through 65535.
- Representing this as a bit vector takes 8K -- and there may be
- multiple minor opcode intervals, as many as one per major (extension)
- opcode). In such cases, a list-of-intervals representation would be
- preferable to reduce memory consumption. Both representations will be
- implemented, and RecordCreateSet will decide heuristically which one
- to use based on the set members.
-
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "set.h"
-
-static int
-maxMemberInInterval(RecordSetInterval *pIntervals, int nIntervals)
-{
- int i;
- int maxMember = -1;
- for (i = 0; i < nIntervals; i++)
- {
- if (maxMember < (int)pIntervals[i].last)
- maxMember = pIntervals[i].last;
- }
- return maxMember;
-}
-
-static void
-NoopDestroySet(RecordSetPtr pSet)
-{
-}
-
-/***************************************************************************/
-
-/* set operations for bit vector representation */
-
-typedef struct {
- RecordSetRec baseSet;
- int maxMember;
- /* followed by the bit vector itself */
-} BitVectorSet, *BitVectorSetPtr;
-
-#define BITS_PER_LONG (sizeof(unsigned long) * 8)
-
-static void
-BitVectorDestroySet(RecordSetPtr pSet)
-{
- free(pSet);
-}
-
-static unsigned long
-BitVectorIsMemberOfSet(RecordSetPtr pSet, int pm)
-{
- BitVectorSetPtr pbvs = (BitVectorSetPtr)pSet;
- unsigned long *pbitvec;
-
- if ((int)pm > pbvs->maxMember) return FALSE;
- pbitvec = (unsigned long *)(&pbvs[1]);
- return (pbitvec[pm / BITS_PER_LONG] & ((unsigned long)1 << (pm % BITS_PER_LONG)));
-}
-
-
-static int
-BitVectorFindBit(RecordSetPtr pSet, int iterbit, Bool bitval)
-{
- BitVectorSetPtr pbvs = (BitVectorSetPtr)pSet;
- unsigned long *pbitvec = (unsigned long *)(&pbvs[1]);
- int startlong;
- int startbit;
- int walkbit;
- int maxMember;
- unsigned long skipval;
- unsigned long bits;
- unsigned long usefulbits;
-
- startlong = iterbit / BITS_PER_LONG;
- pbitvec += startlong;
- startbit = startlong * BITS_PER_LONG;
- skipval = bitval ? 0L : ~0L;
- maxMember = pbvs->maxMember;
-
-
- if (startbit > maxMember) return -1;
- bits = *pbitvec;
- usefulbits = ~(((unsigned long)1 << (iterbit - startbit)) - 1);
- if ( (bits & usefulbits) == (skipval & usefulbits) )
- {
- pbitvec++;
- startbit += BITS_PER_LONG;
-
- while (startbit <= maxMember && *pbitvec == skipval)
- {
- pbitvec++;
- startbit += BITS_PER_LONG;
- }
- if (startbit > maxMember) return -1;
- }
-
- walkbit = (startbit < iterbit) ? iterbit - startbit : 0;
-
- bits = *pbitvec;
- while (walkbit < BITS_PER_LONG && ((!(bits & ((unsigned long)1 << walkbit))) == bitval))
- walkbit++;
-
- return startbit + walkbit;
-}
-
-
-static RecordSetIteratePtr
-BitVectorIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter,
- RecordSetInterval *pInterval)
-{
- int iterbit = (int)(long)pIter;
- int b;
-
- b = BitVectorFindBit(pSet, iterbit, TRUE);
- if (b == -1) return (RecordSetIteratePtr)0;
- pInterval->first = b;
-
- b = BitVectorFindBit(pSet, b, FALSE);
- pInterval->last = (b < 0) ? ((BitVectorSetPtr)pSet)->maxMember : b - 1;
- return (RecordSetIteratePtr)(long)(pInterval->last + 1);
-}
-
-static RecordSetOperations BitVectorSetOperations = {
- BitVectorDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet };
-
-static RecordSetOperations BitVectorNoFreeOperations = {
- NoopDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet };
-
-static int
-BitVectorSetMemoryRequirements(RecordSetInterval *pIntervals, int nIntervals,
- int maxMember, int *alignment)
-{
- int nlongs;
-
- *alignment = sizeof(unsigned long);
- nlongs = (maxMember + BITS_PER_LONG) / BITS_PER_LONG;
- return (sizeof(BitVectorSet) + nlongs * sizeof(unsigned long));
-}
-
-static RecordSetPtr
-BitVectorCreateSet(RecordSetInterval *pIntervals, int nIntervals,
- void *pMem, int memsize)
-{
- BitVectorSetPtr pbvs;
- int i, j;
- unsigned long *pbitvec;
-
- /* allocate all storage needed by this set in one chunk */
-
- if (pMem)
- {
- memset(pMem, 0, memsize);
- pbvs = (BitVectorSetPtr)pMem;
- pbvs->baseSet.ops = &BitVectorNoFreeOperations;
- }
- else
- {
- pbvs = (BitVectorSetPtr)calloc(1, memsize);
- if (!pbvs) return NULL;
- pbvs->baseSet.ops = &BitVectorSetOperations;
- }
-
- pbvs->maxMember = maxMemberInInterval(pIntervals, nIntervals);
-
- /* fill in the set */
-
- pbitvec = (unsigned long *)(&pbvs[1]);
- for (i = 0; i < nIntervals; i++)
- {
- for (j = pIntervals[i].first; j <= (int)pIntervals[i].last; j++)
- {
- pbitvec[j/BITS_PER_LONG] |= ((unsigned long)1 << (j % BITS_PER_LONG));
- }
- }
- return (RecordSetPtr)pbvs;
-}
-
-
-/***************************************************************************/
-
-/* set operations for interval list representation */
-
-typedef struct {
- RecordSetRec baseSet;
- int nIntervals;
- /* followed by the intervals (RecordSetInterval) */
-} IntervalListSet, *IntervalListSetPtr;
-
-static void
-IntervalListDestroySet(RecordSetPtr pSet)
-{
- free(pSet);
-}
-
-static unsigned long
-IntervalListIsMemberOfSet(RecordSetPtr pSet, int pm)
-{
- IntervalListSetPtr prls = (IntervalListSetPtr)pSet;
- RecordSetInterval *pInterval = (RecordSetInterval *)(&prls[1]);
- int hi, lo, probe;
-
- /* binary search */
- lo = 0; hi = prls->nIntervals - 1;
- while (lo <= hi)
- {
- probe = (hi + lo) / 2;
- if (pm >= pInterval[probe].first && pm <= pInterval[probe].last) return 1;
- else if (pm < pInterval[probe].first) hi = probe - 1;
- else lo = probe + 1;
- }
- return 0;
-}
-
-
-static RecordSetIteratePtr
-IntervalListIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter,
- RecordSetInterval *pIntervalReturn)
-{
- RecordSetInterval *pInterval = (RecordSetInterval *)pIter;
- IntervalListSetPtr prls = (IntervalListSetPtr)pSet;
-
- if (pInterval == NULL)
- {
- pInterval = (RecordSetInterval *)(&prls[1]);
- }
-
- if ( (pInterval - (RecordSetInterval *)(&prls[1])) < prls->nIntervals )
- {
- *pIntervalReturn = *pInterval;
- return (RecordSetIteratePtr)(++pInterval);
- }
- else
- return (RecordSetIteratePtr)NULL;
-}
-
-static RecordSetOperations IntervalListSetOperations = {
- IntervalListDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet };
-
-static RecordSetOperations IntervalListNoFreeOperations = {
- NoopDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet };
-
-static int
-IntervalListMemoryRequirements(RecordSetInterval *pIntervals, int nIntervals,
- int maxMember, int *alignment)
-{
- *alignment = sizeof(unsigned long);
- return sizeof(IntervalListSet) + nIntervals * sizeof(RecordSetInterval);
-}
-
-static RecordSetPtr
-IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals,
- void *pMem, int memsize)
-{
- IntervalListSetPtr prls;
- int i, j, k;
- RecordSetInterval *stackIntervals = NULL;
- CARD16 first;
-
- if (nIntervals > 0)
- {
- stackIntervals = (RecordSetInterval *)malloc(
- sizeof(RecordSetInterval) * nIntervals);
- if (!stackIntervals) return NULL;
-
- /* sort intervals, store in stackIntervals (insertion sort) */
-
- for (i = 0; i < nIntervals; i++)
- {
- first = pIntervals[i].first;
- for (j = 0; j < i; j++)
- {
- if (first < stackIntervals[j].first)
- break;
- }
- for (k = i; k > j; k--)
- {
- stackIntervals[k] = stackIntervals[k-1];
- }
- stackIntervals[j] = pIntervals[i];
- }
-
- /* merge abutting/overlapping intervals */
-
- for (i = 0; i < nIntervals - 1; )
- {
- if ( (stackIntervals[i].last + (unsigned int)1) <
- stackIntervals[i + 1].first)
- {
- i++; /* disjoint intervals */
- }
- else
- {
- stackIntervals[i].last = max(stackIntervals[i].last,
- stackIntervals[i + 1].last);
- nIntervals--;
- for (j = i + 1; j < nIntervals; j++)
- stackIntervals[j] = stackIntervals[j + 1];
- }
- }
- }
-
- /* allocate and fill in set structure */
-
- if (pMem)
- {
- prls = (IntervalListSetPtr)pMem;
- prls->baseSet.ops = &IntervalListNoFreeOperations;
- }
- else
- {
- prls = (IntervalListSetPtr)
- malloc(sizeof(IntervalListSet) + nIntervals * sizeof(RecordSetInterval));
- if (!prls) goto bailout;
- prls->baseSet.ops = &IntervalListSetOperations;
- }
- memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
- prls->nIntervals = nIntervals;
-bailout:
- free(stackIntervals);
- return (RecordSetPtr)prls;
-}
-
-typedef RecordSetPtr (*RecordCreateSetProcPtr)(
- RecordSetInterval *pIntervals,
- int nIntervals,
- void *pMem,
- int memsize
-);
-
-static int
-_RecordSetMemoryRequirements(RecordSetInterval *pIntervals, int nIntervals,
- int *alignment,
- RecordCreateSetProcPtr *ppCreateSet)
-{
- int bmsize, rlsize, bma, rla;
- int maxMember;
-
- /* find maximum member of set so we know how big to make the bit vector */
- maxMember = maxMemberInInterval(pIntervals, nIntervals);
-
- bmsize = BitVectorSetMemoryRequirements(pIntervals, nIntervals, maxMember,
- &bma);
- rlsize = IntervalListMemoryRequirements(pIntervals, nIntervals, maxMember,
- &rla);
- if ( ( (nIntervals > 1) && (maxMember <= 255) )
- || (bmsize < rlsize) )
- {
- *alignment = bma;
- *ppCreateSet = BitVectorCreateSet;
- return bmsize;
- }
- else
- {
- *alignment = rla;
- *ppCreateSet = IntervalListCreateSet;
- return rlsize;
- }
-}
-
-/***************************************************************************/
-
-/* user-visible functions */
-
-int
-RecordSetMemoryRequirements(RecordSetInterval *pIntervals, int nIntervals, int *alignment)
-{
- RecordCreateSetProcPtr pCreateSet;
- return _RecordSetMemoryRequirements(pIntervals, nIntervals, alignment,
- &pCreateSet);
-}
-
-RecordSetPtr
-RecordCreateSet(RecordSetInterval *pIntervals, int nIntervals, void *pMem, int memsize)
-{
- RecordCreateSetProcPtr pCreateSet;
- int alignment;
- int size;
-
- size = _RecordSetMemoryRequirements(pIntervals, nIntervals, &alignment,
- &pCreateSet);
- if (pMem)
- {
- if ( ((long)pMem & (alignment-1) ) || memsize < size)
- return NULL;
- }
- return (*pCreateSet)(pIntervals, nIntervals, pMem, size);
-}
+/*
+
+Copyright 1995, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+/*
+
+ See the header set.h for a description of the set ADT.
+
+ Implementation Strategy
+
+ A bit vector is an obvious choice to represent the set, but may take
+ too much memory, depending on the numerically largest member in the
+ set. One expected common case is for the client to ask for *all*
+ protocol. This means it would ask for minor opcodes 0 through 65535.
+ Representing this as a bit vector takes 8K -- and there may be
+ multiple minor opcode intervals, as many as one per major (extension)
+ opcode). In such cases, a list-of-intervals representation would be
+ preferable to reduce memory consumption. Both representations will be
+ implemented, and RecordCreateSet will decide heuristically which one
+ to use based on the set members.
+
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "set.h"
+
+static int
+maxMemberInInterval(RecordSetInterval * pIntervals, int nIntervals)
+{
+ int i;
+ int maxMember = -1;
+
+ for (i = 0; i < nIntervals; i++) {
+ if (maxMember < (int) pIntervals[i].last)
+ maxMember = pIntervals[i].last;
+ }
+ return maxMember;
+}
+
+static void
+NoopDestroySet(RecordSetPtr pSet)
+{
+}
+
+/***************************************************************************/
+
+/* set operations for bit vector representation */
+
+typedef struct {
+ RecordSetRec baseSet;
+ int maxMember;
+ /* followed by the bit vector itself */
+} BitVectorSet, *BitVectorSetPtr;
+
+#define BITS_PER_LONG (sizeof(unsigned long) * 8)
+
+static void
+BitVectorDestroySet(RecordSetPtr pSet)
+{
+ free(pSet);
+}
+
+static unsigned long
+BitVectorIsMemberOfSet(RecordSetPtr pSet, int pm)
+{
+ BitVectorSetPtr pbvs = (BitVectorSetPtr) pSet;
+ unsigned long *pbitvec;
+
+ if ((int) pm > pbvs->maxMember)
+ return FALSE;
+ pbitvec = (unsigned long *) (&pbvs[1]);
+ return (pbitvec[pm / BITS_PER_LONG] &
+ ((unsigned long) 1 << (pm % BITS_PER_LONG)));
+}
+
+static int
+BitVectorFindBit(RecordSetPtr pSet, int iterbit, Bool bitval)
+{
+ BitVectorSetPtr pbvs = (BitVectorSetPtr) pSet;
+ unsigned long *pbitvec = (unsigned long *) (&pbvs[1]);
+ int startlong;
+ int startbit;
+ int walkbit;
+ int maxMember;
+ unsigned long skipval;
+ unsigned long bits;
+ unsigned long usefulbits;
+
+ startlong = iterbit / BITS_PER_LONG;
+ pbitvec += startlong;
+ startbit = startlong * BITS_PER_LONG;
+ skipval = bitval ? 0L : ~0L;
+ maxMember = pbvs->maxMember;
+
+ if (startbit > maxMember)
+ return -1;
+ bits = *pbitvec;
+ usefulbits = ~(((unsigned long) 1 << (iterbit - startbit)) - 1);
+ if ((bits & usefulbits) == (skipval & usefulbits)) {
+ pbitvec++;
+ startbit += BITS_PER_LONG;
+
+ while (startbit <= maxMember && *pbitvec == skipval) {
+ pbitvec++;
+ startbit += BITS_PER_LONG;
+ }
+ if (startbit > maxMember)
+ return -1;
+ }
+
+ walkbit = (startbit < iterbit) ? iterbit - startbit : 0;
+
+ bits = *pbitvec;
+ while (walkbit < BITS_PER_LONG &&
+ ((!(bits & ((unsigned long) 1 << walkbit))) == bitval))
+ walkbit++;
+
+ return startbit + walkbit;
+}
+
+static RecordSetIteratePtr
+BitVectorIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter,
+ RecordSetInterval * pInterval)
+{
+ int iterbit = (int) (long) pIter;
+ int b;
+
+ b = BitVectorFindBit(pSet, iterbit, TRUE);
+ if (b == -1)
+ return (RecordSetIteratePtr) 0;
+ pInterval->first = b;
+
+ b = BitVectorFindBit(pSet, b, FALSE);
+ pInterval->last = (b < 0) ? ((BitVectorSetPtr) pSet)->maxMember : b - 1;
+ return (RecordSetIteratePtr) (long) (pInterval->last + 1);
+}
+
+static RecordSetOperations BitVectorSetOperations = {
+ BitVectorDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet
+};
+
+static RecordSetOperations BitVectorNoFreeOperations = {
+ NoopDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet
+};
+
+static int
+BitVectorSetMemoryRequirements(RecordSetInterval * pIntervals, int nIntervals,
+ int maxMember, int *alignment)
+{
+ int nlongs;
+
+ *alignment = sizeof(unsigned long);
+ nlongs = (maxMember + BITS_PER_LONG) / BITS_PER_LONG;
+ return (sizeof(BitVectorSet) + nlongs * sizeof(unsigned long));
+}
+
+static RecordSetPtr
+BitVectorCreateSet(RecordSetInterval * pIntervals, int nIntervals,
+ void *pMem, int memsize)
+{
+ BitVectorSetPtr pbvs;
+ int i, j;
+ unsigned long *pbitvec;
+
+ /* allocate all storage needed by this set in one chunk */
+
+ if (pMem) {
+ memset(pMem, 0, memsize);
+ pbvs = (BitVectorSetPtr) pMem;
+ pbvs->baseSet.ops = &BitVectorNoFreeOperations;
+ }
+ else {
+ pbvs = (BitVectorSetPtr) calloc(1, memsize);
+ if (!pbvs)
+ return NULL;
+ pbvs->baseSet.ops = &BitVectorSetOperations;
+ }
+
+ pbvs->maxMember = maxMemberInInterval(pIntervals, nIntervals);
+
+ /* fill in the set */
+
+ pbitvec = (unsigned long *) (&pbvs[1]);
+ for (i = 0; i < nIntervals; i++) {
+ for (j = pIntervals[i].first; j <= (int) pIntervals[i].last; j++) {
+ pbitvec[j / BITS_PER_LONG] |=
+ ((unsigned long) 1 << (j % BITS_PER_LONG));
+ }
+ }
+ return (RecordSetPtr) pbvs;
+}
+
+/***************************************************************************/
+
+/* set operations for interval list representation */
+
+typedef struct {
+ RecordSetRec baseSet;
+ int nIntervals;
+ /* followed by the intervals (RecordSetInterval) */
+} IntervalListSet, *IntervalListSetPtr;
+
+static void
+IntervalListDestroySet(RecordSetPtr pSet)
+{
+ free(pSet);
+}
+
+static unsigned long
+IntervalListIsMemberOfSet(RecordSetPtr pSet, int pm)
+{
+ IntervalListSetPtr prls = (IntervalListSetPtr) pSet;
+ RecordSetInterval *pInterval = (RecordSetInterval *) (&prls[1]);
+ int hi, lo, probe;
+
+ /* binary search */
+ lo = 0;
+ hi = prls->nIntervals - 1;
+ while (lo <= hi) {
+ probe = (hi + lo) / 2;
+ if (pm >= pInterval[probe].first && pm <= pInterval[probe].last)
+ return 1;
+ else if (pm < pInterval[probe].first)
+ hi = probe - 1;
+ else
+ lo = probe + 1;
+ }
+ return 0;
+}
+
+static RecordSetIteratePtr
+IntervalListIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter,
+ RecordSetInterval * pIntervalReturn)
+{
+ RecordSetInterval *pInterval = (RecordSetInterval *) pIter;
+ IntervalListSetPtr prls = (IntervalListSetPtr) pSet;
+
+ if (pInterval == NULL) {
+ pInterval = (RecordSetInterval *) (&prls[1]);
+ }
+
+ if ((pInterval - (RecordSetInterval *) (&prls[1])) < prls->nIntervals) {
+ *pIntervalReturn = *pInterval;
+ return (RecordSetIteratePtr) (++pInterval);
+ }
+ else
+ return (RecordSetIteratePtr) NULL;
+}
+
+static RecordSetOperations IntervalListSetOperations = {
+ IntervalListDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet
+};
+
+static RecordSetOperations IntervalListNoFreeOperations = {
+ NoopDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet
+};
+
+static int
+IntervalListMemoryRequirements(RecordSetInterval * pIntervals, int nIntervals,
+ int maxMember, int *alignment)
+{
+ *alignment = sizeof(unsigned long);
+ return sizeof(IntervalListSet) + nIntervals * sizeof(RecordSetInterval);
+}
+
+static RecordSetPtr
+IntervalListCreateSet(RecordSetInterval * pIntervals, int nIntervals,
+ void *pMem, int memsize)
+{
+ IntervalListSetPtr prls;
+ int i, j, k;
+ RecordSetInterval *stackIntervals = NULL;
+ CARD16 first;
+
+ if (nIntervals > 0) {
+ stackIntervals =
+ (RecordSetInterval *) malloc(sizeof(RecordSetInterval) *
+ nIntervals);
+ if (!stackIntervals)
+ return NULL;
+
+ /* sort intervals, store in stackIntervals (insertion sort) */
+
+ for (i = 0; i < nIntervals; i++) {
+ first = pIntervals[i].first;
+ for (j = 0; j < i; j++) {
+ if (first < stackIntervals[j].first)
+ break;
+ }
+ for (k = i; k > j; k--) {
+ stackIntervals[k] = stackIntervals[k - 1];
+ }
+ stackIntervals[j] = pIntervals[i];
+ }
+
+ /* merge abutting/overlapping intervals */
+
+ for (i = 0; i < nIntervals - 1;) {
+ if ((stackIntervals[i].last + (unsigned int) 1) <
+ stackIntervals[i + 1].first) {
+ i++; /* disjoint intervals */
+ }
+ else {
+ stackIntervals[i].last = max(stackIntervals[i].last,
+ stackIntervals[i + 1].last);
+ nIntervals--;
+ for (j = i + 1; j < nIntervals; j++)
+ stackIntervals[j] = stackIntervals[j + 1];
+ }
+ }
+ }
+
+ /* allocate and fill in set structure */
+
+ if (pMem) {
+ prls = (IntervalListSetPtr) pMem;
+ prls->baseSet.ops = &IntervalListNoFreeOperations;
+ }
+ else {
+ prls = (IntervalListSetPtr)
+ malloc(sizeof(IntervalListSet) +
+ nIntervals * sizeof(RecordSetInterval));
+ if (!prls)
+ goto bailout;
+ prls->baseSet.ops = &IntervalListSetOperations;
+ }
+ memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
+ prls->nIntervals = nIntervals;
+ bailout:
+ free(stackIntervals);
+ return (RecordSetPtr) prls;
+}
+
+typedef RecordSetPtr(*RecordCreateSetProcPtr) (RecordSetInterval * pIntervals,
+ int nIntervals,
+ void *pMem, int memsize);
+
+static int
+_RecordSetMemoryRequirements(RecordSetInterval * pIntervals, int nIntervals,
+ int *alignment,
+ RecordCreateSetProcPtr * ppCreateSet)
+{
+ int bmsize, rlsize, bma, rla;
+ int maxMember;
+
+ /* find maximum member of set so we know how big to make the bit vector */
+ maxMember = maxMemberInInterval(pIntervals, nIntervals);
+
+ bmsize = BitVectorSetMemoryRequirements(pIntervals, nIntervals, maxMember,
+ &bma);
+ rlsize = IntervalListMemoryRequirements(pIntervals, nIntervals, maxMember,
+ &rla);
+ if (((nIntervals > 1) && (maxMember <= 255))
+ || (bmsize < rlsize)) {
+ *alignment = bma;
+ *ppCreateSet = BitVectorCreateSet;
+ return bmsize;
+ }
+ else {
+ *alignment = rla;
+ *ppCreateSet = IntervalListCreateSet;
+ return rlsize;
+ }
+}
+
+/***************************************************************************/
+
+/* user-visible functions */
+
+int
+RecordSetMemoryRequirements(RecordSetInterval * pIntervals, int nIntervals,
+ int *alignment)
+{
+ RecordCreateSetProcPtr pCreateSet;
+
+ return _RecordSetMemoryRequirements(pIntervals, nIntervals, alignment,
+ &pCreateSet);
+}
+
+RecordSetPtr
+RecordCreateSet(RecordSetInterval * pIntervals, int nIntervals, void *pMem,
+ int memsize)
+{
+ RecordCreateSetProcPtr pCreateSet;
+ int alignment;
+ int size;
+
+ size = _RecordSetMemoryRequirements(pIntervals, nIntervals, &alignment,
+ &pCreateSet);
+ if (pMem) {
+ if (((long) pMem & (alignment - 1)) || memsize < size)
+ return NULL;
+ }
+ return (*pCreateSet) (pIntervals, nIntervals, pMem, size);
+}
diff --git a/xorg-server/record/set.h b/xorg-server/record/set.h
index 3246a16ed..74ddda75b 100644
--- a/xorg-server/record/set.h
+++ b/xorg-server/record/set.h
@@ -57,7 +57,7 @@ typedef struct {
CARD16 last;
} RecordSetInterval;
-typedef struct _RecordSetRec *RecordSetPtr; /* primary set type */
+typedef struct _RecordSetRec *RecordSetPtr; /* primary set type */
typedef void *RecordSetIteratePtr;
@@ -65,18 +65,11 @@ typedef void *RecordSetIteratePtr;
set users should never declare a variable of this type.
*/
typedef struct {
- void (*DestroySet)(
- RecordSetPtr pSet
-);
- unsigned long (*IsMemberOfSet)(
- RecordSetPtr pSet,
- int possible_member
-);
- RecordSetIteratePtr (*IterateSet)(
- RecordSetPtr pSet,
- RecordSetIteratePtr pIter,
- RecordSetInterval *interval
-);
+ void (*DestroySet) (RecordSetPtr pSet);
+ unsigned long (*IsMemberOfSet) (RecordSetPtr pSet, int possible_member);
+ RecordSetIteratePtr(*IterateSet) (RecordSetPtr pSet,
+ RecordSetIteratePtr pIter,
+ RecordSetInterval * interval);
} RecordSetOperations;
/* "base class" for sets.
@@ -86,12 +79,8 @@ typedef struct _RecordSetRec {
RecordSetOperations *ops;
} RecordSetRec;
-RecordSetPtr RecordCreateSet(
- RecordSetInterval *intervals,
- int nintervals,
- void *pMem,
- int memsize
-);
+RecordSetPtr RecordCreateSet(RecordSetInterval * intervals,
+ int nintervals, void *pMem, int memsize);
/*
RecordCreateSet creates and returns a new set having members specified
by intervals and nintervals. nintervals is the number of RecordSetInterval
@@ -104,11 +93,10 @@ RecordSetPtr RecordCreateSet(
to resource constraints.
*/
-int RecordSetMemoryRequirements(
- RecordSetInterval * /*pIntervals*/,
- int /*nintervals*/,
- int * /*alignment*/
-);
+int RecordSetMemoryRequirements(RecordSetInterval * /*pIntervals */ ,
+ int /*nintervals */ ,
+ int * /*alignment */
+ );
#define RecordDestroySet(_pSet) \
/* void */ (*_pSet->ops->DestroySet)(/* RecordSetPtr */ _pSet)
@@ -119,7 +107,7 @@ int RecordSetMemoryRequirements(
#define RecordIsMemberOfSet(_pSet, _m) \
/* unsigned long */ (*_pSet->ops->IsMemberOfSet)(/* RecordSetPtr */ _pSet, \
- /* int */ _m)
+ /* int */ _m)
/*
RecordIsMemberOfSet returns a non-zero value if _m is a member of
_pSet, else it returns zero.
diff --git a/xorg-server/render/animcur.c b/xorg-server/render/animcur.c
index 8d4a9c2ef..485c068fe 100644
--- a/xorg-server/render/animcur.c
+++ b/xorg-server/render/animcur.c
@@ -48,35 +48,36 @@
#include "xace.h"
typedef struct _AnimCurElt {
- CursorPtr pCursor; /* cursor to show */
- CARD32 delay; /* in ms */
+ CursorPtr pCursor; /* cursor to show */
+ CARD32 delay; /* in ms */
} AnimCurElt;
typedef struct _AnimCur {
- int nelt; /* number of elements in the elts array */
- AnimCurElt *elts; /* actually allocated right after the structure */
+ int nelt; /* number of elements in the elts array */
+ AnimCurElt *elts; /* actually allocated right after the structure */
} AnimCurRec, *AnimCurPtr;
typedef struct _AnimScrPriv {
- CloseScreenProcPtr CloseScreen;
+ CloseScreenProcPtr CloseScreen;
- ScreenBlockHandlerProcPtr BlockHandler;
+ ScreenBlockHandlerProcPtr BlockHandler;
- CursorLimitsProcPtr CursorLimits;
- DisplayCursorProcPtr DisplayCursor;
- SetCursorPositionProcPtr SetCursorPosition;
- RealizeCursorProcPtr RealizeCursor;
- UnrealizeCursorProcPtr UnrealizeCursor;
- RecolorCursorProcPtr RecolorCursor;
+ CursorLimitsProcPtr CursorLimits;
+ DisplayCursorProcPtr DisplayCursor;
+ SetCursorPositionProcPtr SetCursorPosition;
+ RealizeCursorProcPtr RealizeCursor;
+ UnrealizeCursorProcPtr UnrealizeCursor;
+ RecolorCursorProcPtr RecolorCursor;
} AnimCurScreenRec, *AnimCurScreenPtr;
static unsigned char empty[4];
-static CursorBits animCursorBits = {
+static CursorBits animCursorBits = {
empty, empty, 2, 1, 1, 0, 0, 1
};
static DevPrivateKeyRec AnimCurScreenPrivateKeyRec;
+
#define AnimCurScreenPrivateKey (&AnimCurScreenPrivateKeyRec)
#define IsAnimCur(c) ((c) && ((c)->bits == &animCursorBits))
@@ -87,12 +88,11 @@ static DevPrivateKeyRec AnimCurScreenPrivateKeyRec;
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
#define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
-
static Bool
-AnimCurCloseScreen (int index, ScreenPtr pScreen)
+AnimCurCloseScreen(int index, ScreenPtr pScreen)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Bool ret;
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ Bool ret;
Unwrap(as, pScreen, CloseScreen);
@@ -102,35 +102,30 @@ AnimCurCloseScreen (int index, ScreenPtr pScreen)
Unwrap(as, pScreen, RealizeCursor);
Unwrap(as, pScreen, UnrealizeCursor);
Unwrap(as, pScreen, RecolorCursor);
- SetAnimCurScreen(pScreen,0);
+ SetAnimCurScreen(pScreen, 0);
ret = (*pScreen->CloseScreen) (index, pScreen);
free(as);
return ret;
}
-static void
-AnimCurCursorLimits (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor,
- BoxPtr pHotBox,
- BoxPtr pTopLeftBox)
+static void
+AnimCurCursorLimits(DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor, BoxPtr pHotBox, BoxPtr pTopLeftBox)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Unwrap (as, pScreen, CursorLimits);
- if (IsAnimCur(pCursor))
- {
- AnimCurPtr ac = GetAnimCur(pCursor);
+ Unwrap(as, pScreen, CursorLimits);
+ if (IsAnimCur(pCursor)) {
+ AnimCurPtr ac = GetAnimCur(pCursor);
- (*pScreen->CursorLimits) (pDev, pScreen, ac->elts[0].pCursor,
- pHotBox, pTopLeftBox);
+ (*pScreen->CursorLimits) (pDev, pScreen, ac->elts[0].pCursor,
+ pHotBox, pTopLeftBox);
}
- else
- {
- (*pScreen->CursorLimits) (pDev, pScreen, pCursor,
- pHotBox, pTopLeftBox);
+ else {
+ (*pScreen->CursorLimits) (pDev, pScreen, pCursor, pHotBox, pTopLeftBox);
}
- Wrap (as, pScreen, CursorLimits, AnimCurCursorLimits);
+ Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits);
}
/*
@@ -140,209 +135,188 @@ AnimCurCursorLimits (DeviceIntPtr pDev,
*/
static void
-AnimCurScreenBlockHandler (int screenNum,
- pointer blockData,
- pointer pTimeout,
- pointer pReadmask)
+AnimCurScreenBlockHandler(int screenNum,
+ pointer blockData,
+ pointer pTimeout, pointer pReadmask)
{
- ScreenPtr pScreen = screenInfo.screens[screenNum];
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- DeviceIntPtr dev;
- Bool activeDevice = FALSE;
- CARD32 now = 0,
- soonest = ~0; /* earliest time to wakeup again */
-
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen)
- {
- if (!activeDevice) {
- now = GetTimeInMillis ();
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ DeviceIntPtr dev;
+ Bool activeDevice = FALSE;
+ CARD32 now = 0, soonest = ~0; /* earliest time to wakeup again */
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen) {
+ if (!activeDevice) {
+ now = GetTimeInMillis();
activeDevice = TRUE;
}
- if ((INT32) (now - dev->spriteInfo->anim.time) >= 0)
- {
- AnimCurPtr ac = GetAnimCur(dev->spriteInfo->anim.pCursor);
- int elt = (dev->spriteInfo->anim.elt + 1) % ac->nelt;
- DisplayCursorProcPtr DisplayCursor;
-
- /*
- * Not a simple Unwrap/Wrap as this
- * isn't called along the DisplayCursor
- * wrapper chain.
- */
- DisplayCursor = pScreen->DisplayCursor;
- pScreen->DisplayCursor = as->DisplayCursor;
- (void) (*pScreen->DisplayCursor) (dev,
- pScreen,
- ac->elts[elt].pCursor);
- as->DisplayCursor = pScreen->DisplayCursor;
- pScreen->DisplayCursor = DisplayCursor;
-
- dev->spriteInfo->anim.elt = elt;
- dev->spriteInfo->anim.time = now + ac->elts[elt].delay;
- }
-
- if (soonest > dev->spriteInfo->anim.time)
- soonest = dev->spriteInfo->anim.time;
- }
+ if ((INT32) (now - dev->spriteInfo->anim.time) >= 0) {
+ AnimCurPtr ac = GetAnimCur(dev->spriteInfo->anim.pCursor);
+ int elt = (dev->spriteInfo->anim.elt + 1) % ac->nelt;
+ DisplayCursorProcPtr DisplayCursor;
+
+ /*
+ * Not a simple Unwrap/Wrap as this
+ * isn't called along the DisplayCursor
+ * wrapper chain.
+ */
+ DisplayCursor = pScreen->DisplayCursor;
+ pScreen->DisplayCursor = as->DisplayCursor;
+ (void) (*pScreen->DisplayCursor) (dev,
+ pScreen,
+ ac->elts[elt].pCursor);
+ as->DisplayCursor = pScreen->DisplayCursor;
+ pScreen->DisplayCursor = DisplayCursor;
+
+ dev->spriteInfo->anim.elt = elt;
+ dev->spriteInfo->anim.time = now + ac->elts[elt].delay;
+ }
+
+ if (soonest > dev->spriteInfo->anim.time)
+ soonest = dev->spriteInfo->anim.time;
+ }
}
if (activeDevice)
- AdjustWaitForDelay (pTimeout, soonest - now);
+ AdjustWaitForDelay(pTimeout, soonest - now);
- Unwrap (as, pScreen, BlockHandler);
+ Unwrap(as, pScreen, BlockHandler);
(*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
if (activeDevice)
- Wrap (as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
+ Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
else
as->BlockHandler = NULL;
}
static Bool
-AnimCurDisplayCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor)
+AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Bool ret;
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ Bool ret;
if (IsFloating(pDev))
- return FALSE;
+ return FALSE;
- Unwrap (as, pScreen, DisplayCursor);
- if (IsAnimCur(pCursor))
- {
- if (pCursor != pDev->spriteInfo->anim.pCursor)
- {
- AnimCurPtr ac = GetAnimCur(pCursor);
+ Unwrap(as, pScreen, DisplayCursor);
+ if (IsAnimCur(pCursor)) {
+ if (pCursor != pDev->spriteInfo->anim.pCursor) {
+ AnimCurPtr ac = GetAnimCur(pCursor);
- ret = (*pScreen->DisplayCursor)
+ ret = (*pScreen->DisplayCursor)
(pDev, pScreen, ac->elts[0].pCursor);
- if (ret)
- {
- pDev->spriteInfo->anim.elt = 0;
- pDev->spriteInfo->anim.time = GetTimeInMillis () + ac->elts[0].delay;
- pDev->spriteInfo->anim.pCursor = pCursor;
- pDev->spriteInfo->anim.pScreen = pScreen;
-
- if (!as->BlockHandler)
- Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
- }
- }
- else
- ret = TRUE;
+ if (ret) {
+ pDev->spriteInfo->anim.elt = 0;
+ pDev->spriteInfo->anim.time =
+ GetTimeInMillis() + ac->elts[0].delay;
+ pDev->spriteInfo->anim.pCursor = pCursor;
+ pDev->spriteInfo->anim.pScreen = pScreen;
+
+ if (!as->BlockHandler)
+ Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
+ }
+ }
+ else
+ ret = TRUE;
}
- else
- {
- pDev->spriteInfo->anim.pCursor = 0;
- pDev->spriteInfo->anim.pScreen = 0;
- ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
+ else {
+ pDev->spriteInfo->anim.pCursor = 0;
+ pDev->spriteInfo->anim.pScreen = 0;
+ ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
}
- Wrap (as, pScreen, DisplayCursor, AnimCurDisplayCursor);
+ Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor);
return ret;
}
static Bool
-AnimCurSetCursorPosition (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- int x,
- int y,
- Bool generateEvent)
+AnimCurSetCursorPosition(DeviceIntPtr pDev,
+ ScreenPtr pScreen, int x, int y, Bool generateEvent)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Bool ret;
-
- Unwrap (as, pScreen, SetCursorPosition);
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ Bool ret;
+
+ Unwrap(as, pScreen, SetCursorPosition);
if (pDev->spriteInfo->anim.pCursor) {
- pDev->spriteInfo->anim.pScreen = pScreen;
+ pDev->spriteInfo->anim.pScreen = pScreen;
- if (!as->BlockHandler)
- Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
+ if (!as->BlockHandler)
+ Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
}
ret = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
- Wrap (as, pScreen, SetCursorPosition, AnimCurSetCursorPosition);
+ Wrap(as, pScreen, SetCursorPosition, AnimCurSetCursorPosition);
return ret;
}
-static Bool
-AnimCurRealizeCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor)
+static Bool
+AnimCurRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Bool ret;
-
- Unwrap (as, pScreen, RealizeCursor);
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ Bool ret;
+
+ Unwrap(as, pScreen, RealizeCursor);
if (IsAnimCur(pCursor))
- ret = TRUE;
+ ret = TRUE;
else
- ret = (*pScreen->RealizeCursor) (pDev, pScreen, pCursor);
- Wrap (as, pScreen, RealizeCursor, AnimCurRealizeCursor);
+ ret = (*pScreen->RealizeCursor) (pDev, pScreen, pCursor);
+ Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor);
return ret;
}
-static Bool
-AnimCurUnrealizeCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor)
+static Bool
+AnimCurUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Bool ret;
-
- Unwrap (as, pScreen, UnrealizeCursor);
- if (IsAnimCur(pCursor))
- {
- AnimCurPtr ac = GetAnimCur(pCursor);
- int i;
-
- if (pScreen->myNum == 0)
- for (i = 0; i < ac->nelt; i++)
- FreeCursor (ac->elts[i].pCursor, 0);
- ret = TRUE;
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ Bool ret;
+
+ Unwrap(as, pScreen, UnrealizeCursor);
+ if (IsAnimCur(pCursor)) {
+ AnimCurPtr ac = GetAnimCur(pCursor);
+ int i;
+
+ if (pScreen->myNum == 0)
+ for (i = 0; i < ac->nelt; i++)
+ FreeCursor(ac->elts[i].pCursor, 0);
+ ret = TRUE;
}
else
- ret = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor);
- Wrap (as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
+ ret = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor);
+ Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
return ret;
}
static void
-AnimCurRecolorCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor,
- Bool displayed)
+AnimCurRecolorCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen, CursorPtr pCursor, Bool displayed)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
-
- Unwrap (as, pScreen, RecolorCursor);
- if (IsAnimCur(pCursor))
- {
- AnimCurPtr ac = GetAnimCur(pCursor);
- int i;
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+
+ Unwrap(as, pScreen, RecolorCursor);
+ if (IsAnimCur(pCursor)) {
+ AnimCurPtr ac = GetAnimCur(pCursor);
+ int i;
for (i = 0; i < ac->nelt; i++)
- (*pScreen->RecolorCursor) (pDev, pScreen, ac->elts[i].pCursor,
- displayed &&
- pDev->spriteInfo->anim.elt == i);
+ (*pScreen->RecolorCursor) (pDev, pScreen, ac->elts[i].pCursor,
+ displayed &&
+ pDev->spriteInfo->anim.elt == i);
}
else
- (*pScreen->RecolorCursor) (pDev, pScreen, pCursor, displayed);
- Wrap (as, pScreen, RecolorCursor, AnimCurRecolorCursor);
+ (*pScreen->RecolorCursor) (pDev, pScreen, pCursor, displayed);
+ Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor);
}
Bool
-AnimCurInit (ScreenPtr pScreen)
+AnimCurInit(ScreenPtr pScreen)
{
- AnimCurScreenPtr as;
+ AnimCurScreenPtr as;
if (!dixRegisterPrivateKey(&AnimCurScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
- as = (AnimCurScreenPtr) malloc(sizeof (AnimCurScreenRec));
+ as = (AnimCurScreenPtr) malloc(sizeof(AnimCurScreenRec));
if (!as)
- return FALSE;
+ return FALSE;
Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen);
as->BlockHandler = NULL;
@@ -353,38 +327,39 @@ AnimCurInit (ScreenPtr pScreen)
Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor);
Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor);
- SetAnimCurScreen(pScreen,as);
+ SetAnimCurScreen(pScreen, as);
return TRUE;
}
int
-AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid)
+AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
+ CursorPtr *ppCursor, ClientPtr client, XID cid)
{
- CursorPtr pCursor;
- int rc, i;
- AnimCurPtr ac;
+ CursorPtr pCursor;
+ int rc, i;
+ AnimCurPtr ac;
for (i = 0; i < screenInfo.numScreens; i++)
- if (!GetAnimCurScreen (screenInfo.screens[i]))
- return BadImplementation;
+ if (!GetAnimCurScreen(screenInfo.screens[i]))
+ return BadImplementation;
for (i = 0; i < ncursor; i++)
- if (IsAnimCur (cursors[i]))
- return BadMatch;
-
+ if (IsAnimCur(cursors[i]))
+ return BadMatch;
+
pCursor = (CursorPtr) calloc(CURSOR_REC_SIZE +
- sizeof (AnimCurRec) +
- ncursor * sizeof (AnimCurElt), 1);
+ sizeof(AnimCurRec) +
+ ncursor * sizeof(AnimCurElt), 1);
if (!pCursor)
- return BadAlloc;
+ return BadAlloc;
dixInitPrivates(pCursor, pCursor + 1, PRIVATE_CURSOR);
pCursor->bits = &animCursorBits;
pCursor->refcnt = 1;
-
+
pCursor->foreRed = cursors[0]->foreRed;
pCursor->foreGreen = cursors[0]->foreGreen;
pCursor->foreBlue = cursors[0]->foreBlue;
-
+
pCursor->backRed = cursors[0]->backRed;
pCursor->backGreen = cursors[0]->backGreen;
pCursor->backBlue = cursors[0]->backBlue;
@@ -393,28 +368,27 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor,
- RT_NONE, NULL, DixCreateAccess);
+ RT_NONE, NULL, DixCreateAccess);
if (rc != Success) {
- dixFiniPrivates(pCursor, PRIVATE_CURSOR);
- free(pCursor);
- return rc;
+ dixFiniPrivates(pCursor, PRIVATE_CURSOR);
+ free(pCursor);
+ return rc;
}
-
+
/*
* Fill in the AnimCurRec
*/
animCursorBits.refcnt++;
- ac = GetAnimCur (pCursor);
+ ac = GetAnimCur(pCursor);
ac->nelt = ncursor;
ac->elts = (AnimCurElt *) (ac + 1);
-
- for (i = 0; i < ncursor; i++)
- {
- cursors[i]->refcnt++;
- ac->elts[i].pCursor = cursors[i];
- ac->elts[i].delay = deltas[i];
+
+ for (i = 0; i < ncursor; i++) {
+ cursors[i]->refcnt++;
+ ac->elts[i].pCursor = cursors[i];
+ ac->elts[i].delay = deltas[i];
}
-
+
*ppCursor = pCursor;
return Success;
}
diff --git a/xorg-server/render/filter.c b/xorg-server/render/filter.c
index c513ee8f9..8c401ee5d 100644
--- a/xorg-server/render/filter.c
+++ b/xorg-server/render/filter.c
@@ -40,40 +40,39 @@
#include "picturestr.h"
static char **filterNames;
-static int nfilterNames;
+static int nfilterNames;
/*
* standard but not required filters don't have constant indices
*/
int
-PictureGetFilterId (const char *filter, int len, Bool makeit)
+PictureGetFilterId(const char *filter, int len, Bool makeit)
{
- int i;
- char *name;
- char **names;
+ int i;
+ char *name;
+ char **names;
if (len < 0)
- len = strlen (filter);
+ len = strlen(filter);
for (i = 0; i < nfilterNames; i++)
- if (!CompareISOLatin1Lowered ((const unsigned char *) filterNames[i], -1,
- (const unsigned char *) filter, len))
- return i;
+ if (!CompareISOLatin1Lowered((const unsigned char *) filterNames[i], -1,
+ (const unsigned char *) filter, len))
+ return i;
if (!makeit)
- return -1;
+ return -1;
name = malloc(len + 1);
if (!name)
- return -1;
- memcpy (name, filter, len);
+ return -1;
+ memcpy(name, filter, len);
name[len] = '\0';
if (filterNames)
- names = realloc(filterNames, (nfilterNames + 1) * sizeof (char *));
+ names = realloc(filterNames, (nfilterNames + 1) * sizeof(char *));
else
- names = malloc(sizeof (char *));
- if (!names)
- {
- free(name);
- return -1;
+ names = malloc(sizeof(char *));
+ if (!names) {
+ free(name);
+ return -1;
}
filterNames = names;
i = nfilterNames++;
@@ -82,77 +81,78 @@ PictureGetFilterId (const char *filter, int len, Bool makeit)
}
static Bool
-PictureSetDefaultIds (void)
+PictureSetDefaultIds(void)
{
/* careful here -- this list must match the #define values */
- if (PictureGetFilterId (FilterNearest, -1, TRUE) != PictFilterNearest)
- return FALSE;
- if (PictureGetFilterId (FilterBilinear, -1, TRUE) != PictFilterBilinear)
- return FALSE;
+ if (PictureGetFilterId(FilterNearest, -1, TRUE) != PictFilterNearest)
+ return FALSE;
+ if (PictureGetFilterId(FilterBilinear, -1, TRUE) != PictFilterBilinear)
+ return FALSE;
- if (PictureGetFilterId (FilterFast, -1, TRUE) != PictFilterFast)
- return FALSE;
- if (PictureGetFilterId (FilterGood, -1, TRUE) != PictFilterGood)
- return FALSE;
- if (PictureGetFilterId (FilterBest, -1, TRUE) != PictFilterBest)
- return FALSE;
+ if (PictureGetFilterId(FilterFast, -1, TRUE) != PictFilterFast)
+ return FALSE;
+ if (PictureGetFilterId(FilterGood, -1, TRUE) != PictFilterGood)
+ return FALSE;
+ if (PictureGetFilterId(FilterBest, -1, TRUE) != PictFilterBest)
+ return FALSE;
- if (PictureGetFilterId (FilterConvolution, -1, TRUE) != PictFilterConvolution)
- return FALSE;
+ if (PictureGetFilterId(FilterConvolution, -1, TRUE) !=
+ PictFilterConvolution)
+ return FALSE;
return TRUE;
}
char *
-PictureGetFilterName (int id)
+PictureGetFilterName(int id)
{
if (0 <= id && id < nfilterNames)
- return filterNames[id];
+ return filterNames[id];
else
- return 0;
+ return 0;
}
static void
-PictureFreeFilterIds (void)
+PictureFreeFilterIds(void)
{
- int i;
+ int i;
for (i = 0; i < nfilterNames; i++)
- free(filterNames[i]);
+ free(filterNames[i]);
free(filterNames);
nfilterNames = 0;
filterNames = 0;
}
int
-PictureAddFilter (ScreenPtr pScreen,
- const char *filter,
- PictFilterValidateParamsProcPtr ValidateParams,
- int width,
- int height)
+PictureAddFilter(ScreenPtr pScreen,
+ const char *filter,
+ PictFilterValidateParamsProcPtr ValidateParams,
+ int width, int height)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- int id = PictureGetFilterId (filter, -1, TRUE);
- int i;
- PictFilterPtr filters;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ int id = PictureGetFilterId(filter, -1, TRUE);
+ int i;
+ PictFilterPtr filters;
if (id < 0)
- return -1;
+ return -1;
/*
* It's an error to attempt to reregister a filter
*/
for (i = 0; i < ps->nfilters; i++)
- if (ps->filters[i].id == id)
- return -1;
+ if (ps->filters[i].id == id)
+ return -1;
if (ps->filters)
- filters = realloc(ps->filters, (ps->nfilters + 1) * sizeof (PictFilterRec));
+ filters =
+ realloc(ps->filters, (ps->nfilters + 1) * sizeof(PictFilterRec));
else
- filters = malloc(sizeof (PictFilterRec));
+ filters = malloc(sizeof(PictFilterRec));
if (!filters)
- return -1;
+ return -1;
ps->filters = filters;
i = ps->nfilters++;
- ps->filters[i].name = PictureGetFilterName (id);
+ ps->filters[i].name = PictureGetFilterName(id);
ps->filters[i].id = id;
ps->filters[i].ValidateParams = ValidateParams;
ps->filters[i].width = width;
@@ -161,79 +161,76 @@ PictureAddFilter (ScreenPtr pScreen,
}
Bool
-PictureSetFilterAlias (ScreenPtr pScreen, const char *filter, const char *alias)
+PictureSetFilterAlias(ScreenPtr pScreen, const char *filter, const char *alias)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- int filter_id = PictureGetFilterId (filter, -1, FALSE);
- int alias_id = PictureGetFilterId (alias, -1, TRUE);
- int i;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ int filter_id = PictureGetFilterId(filter, -1, FALSE);
+ int alias_id = PictureGetFilterId(alias, -1, TRUE);
+ int i;
if (filter_id < 0 || alias_id < 0)
- return FALSE;
+ return FALSE;
for (i = 0; i < ps->nfilterAliases; i++)
- if (ps->filterAliases[i].alias_id == alias_id)
- break;
- if (i == ps->nfilterAliases)
- {
- PictFilterAliasPtr aliases;
-
- if (ps->filterAliases)
- aliases = realloc(ps->filterAliases,
- (ps->nfilterAliases + 1) *
- sizeof (PictFilterAliasRec));
- else
- aliases = malloc(sizeof (PictFilterAliasRec));
- if (!aliases)
- return FALSE;
- ps->filterAliases = aliases;
- ps->filterAliases[i].alias = PictureGetFilterName (alias_id);
- ps->filterAliases[i].alias_id = alias_id;
- ps->nfilterAliases++;
+ if (ps->filterAliases[i].alias_id == alias_id)
+ break;
+ if (i == ps->nfilterAliases) {
+ PictFilterAliasPtr aliases;
+
+ if (ps->filterAliases)
+ aliases = realloc(ps->filterAliases,
+ (ps->nfilterAliases + 1) *
+ sizeof(PictFilterAliasRec));
+ else
+ aliases = malloc(sizeof(PictFilterAliasRec));
+ if (!aliases)
+ return FALSE;
+ ps->filterAliases = aliases;
+ ps->filterAliases[i].alias = PictureGetFilterName(alias_id);
+ ps->filterAliases[i].alias_id = alias_id;
+ ps->nfilterAliases++;
}
ps->filterAliases[i].filter_id = filter_id;
return TRUE;
}
PictFilterPtr
-PictureFindFilter (ScreenPtr pScreen, char *name, int len)
+PictureFindFilter(ScreenPtr pScreen, char *name, int len)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- int id = PictureGetFilterId (name, len, FALSE);
- int i;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ int id = PictureGetFilterId(name, len, FALSE);
+ int i;
if (id < 0)
- return 0;
+ return 0;
/* Check for an alias, allow them to recurse */
for (i = 0; i < ps->nfilterAliases; i++)
- if (ps->filterAliases[i].alias_id == id)
- {
- id = ps->filterAliases[i].filter_id;
- i = 0;
- }
+ if (ps->filterAliases[i].alias_id == id) {
+ id = ps->filterAliases[i].filter_id;
+ i = 0;
+ }
/* find the filter */
for (i = 0; i < ps->nfilters; i++)
- if (ps->filters[i].id == id)
- return &ps->filters[i];
+ if (ps->filters[i].id == id)
+ return &ps->filters[i];
return 0;
}
static Bool
-convolutionFilterValidateParams (ScreenPtr pScreen,
- int filter,
- xFixed *params,
- int nparams,
- int *width,
- int *height)
+convolutionFilterValidateParams(ScreenPtr pScreen,
+ int filter,
+ xFixed * params,
+ int nparams, int *width, int *height)
{
- int w, h;
+ int w, h;
+
if (nparams < 3)
return FALSE;
- if (xFixedFrac (params[0]) || xFixedFrac (params[1]))
+ if (xFixedFrac(params[0]) || xFixedFrac(params[1]))
return FALSE;
- w = xFixedToInt (params[0]);
- h = xFixedToInt (params[1]);
+ w = xFixedToInt(params[0]);
+ h = xFixedToInt(params[1]);
nparams -= 2;
if (w * h > nparams)
@@ -244,117 +241,117 @@ convolutionFilterValidateParams (ScreenPtr pScreen,
return TRUE;
}
-
Bool
-PictureSetDefaultFilters (ScreenPtr pScreen)
+PictureSetDefaultFilters(ScreenPtr pScreen)
{
if (!filterNames)
- if (!PictureSetDefaultIds ())
- return FALSE;
- if (PictureAddFilter (pScreen, FilterNearest, 0, 1, 1) < 0)
- return FALSE;
- if (PictureAddFilter (pScreen, FilterBilinear, 0, 2, 2) < 0)
- return FALSE;
-
- if (!PictureSetFilterAlias (pScreen, FilterNearest, FilterFast))
- return FALSE;
- if (!PictureSetFilterAlias (pScreen, FilterBilinear, FilterGood))
- return FALSE;
- if (!PictureSetFilterAlias (pScreen, FilterBilinear, FilterBest))
- return FALSE;
-
- if (PictureAddFilter (pScreen, FilterConvolution, convolutionFilterValidateParams, 0, 0) < 0)
+ if (!PictureSetDefaultIds())
+ return FALSE;
+ if (PictureAddFilter(pScreen, FilterNearest, 0, 1, 1) < 0)
+ return FALSE;
+ if (PictureAddFilter(pScreen, FilterBilinear, 0, 2, 2) < 0)
+ return FALSE;
+
+ if (!PictureSetFilterAlias(pScreen, FilterNearest, FilterFast))
+ return FALSE;
+ if (!PictureSetFilterAlias(pScreen, FilterBilinear, FilterGood))
+ return FALSE;
+ if (!PictureSetFilterAlias(pScreen, FilterBilinear, FilterBest))
+ return FALSE;
+
+ if (PictureAddFilter
+ (pScreen, FilterConvolution, convolutionFilterValidateParams, 0, 0) < 0)
return FALSE;
return TRUE;
}
void
-PictureResetFilters (ScreenPtr pScreen)
+PictureResetFilters(ScreenPtr pScreen)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
free(ps->filters);
free(ps->filterAliases);
- PictureFreeFilterIds ();
+ PictureFreeFilterIds();
}
int
-SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams)
+SetPictureFilter(PicturePtr pPicture, char *name, int len, xFixed * params,
+ int nparams)
{
- PictFilterPtr pFilter;
- ScreenPtr pScreen;
+ PictFilterPtr pFilter;
+ ScreenPtr pScreen;
if (pPicture->pDrawable != NULL)
- pScreen = pPicture->pDrawable->pScreen;
+ pScreen = pPicture->pDrawable->pScreen;
else
- pScreen = screenInfo.screens[0];
+ pScreen = screenInfo.screens[0];
- pFilter = PictureFindFilter (pScreen, name, len);
+ pFilter = PictureFindFilter(pScreen, name, len);
if (!pFilter)
- return BadName;
-
- if (pPicture->pDrawable == NULL)
- {
- int s;
- /* For source pictures, the picture isn't tied to a screen. So, ensure
- * that all screens can handle a filter we set for the picture.
- */
- for (s = 1; s < screenInfo.numScreens; s++)
- {
- PictFilterPtr pScreenFilter;
- pScreenFilter = PictureFindFilter (screenInfo.screens[s],
- name, len);
- if (!pScreenFilter || pScreenFilter->id != pFilter->id)
- return BadMatch;
- }
+ return BadName;
+
+ if (pPicture->pDrawable == NULL) {
+ int s;
+
+ /* For source pictures, the picture isn't tied to a screen. So, ensure
+ * that all screens can handle a filter we set for the picture.
+ */
+ for (s = 1; s < screenInfo.numScreens; s++) {
+ PictFilterPtr pScreenFilter;
+
+ pScreenFilter = PictureFindFilter(screenInfo.screens[s], name, len);
+ if (!pScreenFilter || pScreenFilter->id != pFilter->id)
+ return BadMatch;
+ }
}
- return SetPicturePictFilter (pPicture, pFilter, params, nparams);
+ return SetPicturePictFilter(pPicture, pFilter, params, nparams);
}
int
-SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter,
- xFixed *params, int nparams)
+SetPicturePictFilter(PicturePtr pPicture, PictFilterPtr pFilter,
+ xFixed * params, int nparams)
{
- ScreenPtr pScreen;
- int i;
+ ScreenPtr pScreen;
+ int i;
if (pPicture->pDrawable)
- pScreen = pPicture->pDrawable->pScreen;
+ pScreen = pPicture->pDrawable->pScreen;
else
- pScreen = screenInfo.screens[0];
+ pScreen = screenInfo.screens[0];
+
+ if (pFilter->ValidateParams) {
+ int width, height;
- if (pFilter->ValidateParams)
- {
- int width, height;
- if (!(*pFilter->ValidateParams) (pScreen, pFilter->id, params, nparams, &width, &height))
- return BadMatch;
+ if (!(*pFilter->ValidateParams)
+ (pScreen, pFilter->id, params, nparams, &width, &height))
+ return BadMatch;
}
else if (nparams)
- return BadMatch;
-
- if (nparams != pPicture->filter_nparams)
- {
- xFixed *new_params = malloc(nparams * sizeof (xFixed));
- if (!new_params && nparams)
- return BadAlloc;
- free(pPicture->filter_params);
- pPicture->filter_params = new_params;
- pPicture->filter_nparams = nparams;
+ return BadMatch;
+
+ if (nparams != pPicture->filter_nparams) {
+ xFixed *new_params = malloc(nparams * sizeof(xFixed));
+
+ if (!new_params && nparams)
+ return BadAlloc;
+ free(pPicture->filter_params);
+ pPicture->filter_params = new_params;
+ pPicture->filter_nparams = nparams;
}
for (i = 0; i < nparams; i++)
- pPicture->filter_params[i] = params[i];
+ pPicture->filter_params[i] = params[i];
pPicture->filter = pFilter->id;
- if (pPicture->pDrawable)
- {
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- int result;
+ if (pPicture->pDrawable) {
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ int result;
- result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
- params, nparams);
- return result;
+ result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
+ params, nparams);
+ return result;
}
return Success;
}
diff --git a/xorg-server/render/glyph.c b/xorg-server/render/glyph.c
index ab20da625..a143e9eb5 100644
--- a/xorg-server/render/glyph.c
+++ b/xorg-server/render/glyph.c
@@ -1,748 +1,686 @@
-/*
- *
- * Copyright © 2000 SuSE, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "xsha1.h"
-
-#include "misc.h"
-#include "scrnintstr.h"
-#include "os.h"
-#include "regionstr.h"
-#include "validate.h"
-#include "windowstr.h"
-#include "input.h"
-#include "resource.h"
-#include "colormapst.h"
-#include "cursorstr.h"
-#include "dixstruct.h"
-#include "gcstruct.h"
-#include "servermd.h"
-#include "picturestr.h"
-#include "glyphstr.h"
-#include "mipict.h"
-
-/*
- * From Knuth -- a good choice for hash/rehash values is p, p-2 where
- * p and p-2 are both prime. These tables are sized to have an extra 10%
- * free to avoid exponential performance degradation as the hash table fills
- */
-static GlyphHashSetRec glyphHashSets[] = {
- { 32, 43, 41 },
- { 64, 73, 71 },
- { 128, 151, 149 },
- { 256, 283, 281 },
- { 512, 571, 569 },
- { 1024, 1153, 1151 },
- { 2048, 2269, 2267 },
- { 4096, 4519, 4517 },
- { 8192, 9013, 9011 },
- { 16384, 18043, 18041 },
- { 32768, 36109, 36107 },
- { 65536, 72091, 72089 },
- { 131072, 144409, 144407 },
- { 262144, 288361, 288359 },
- { 524288, 576883, 576881 },
- { 1048576, 1153459, 1153457 },
- { 2097152, 2307163, 2307161 },
- { 4194304, 4613893, 4613891 },
- { 8388608, 9227641, 9227639 },
- { 16777216, 18455029, 18455027 },
- { 33554432, 36911011, 36911009 },
- { 67108864, 73819861, 73819859 },
- { 134217728, 147639589, 147639587 },
- { 268435456, 295279081, 295279079 },
- { 536870912, 590559793, 590559791 }
-};
-
-#define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0]))
-
-static const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 };
-
-static GlyphHashRec globalGlyphs[GlyphFormatNum];
-
-void
-GlyphUninit (ScreenPtr pScreen)
-{
- PictureScreenPtr ps = GetPictureScreen (pScreen);
- GlyphPtr glyph;
- int fdepth, i;
- int scrno = pScreen->myNum;
-
- for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++)
- {
- if (!globalGlyphs[fdepth].hashSet)
- continue;
-
- for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++)
- {
- glyph = globalGlyphs[fdepth].table[i].glyph;
- if (glyph && glyph != DeletedGlyph)
- {
- if (GlyphPicture(glyph)[scrno])
- {
- FreePicture ((pointer) GlyphPicture (glyph)[scrno], 0);
- GlyphPicture(glyph)[scrno] = NULL;
- }
- (*ps->UnrealizeGlyph) (pScreen, glyph);
- }
- }
- }
-}
-
-GlyphHashSetPtr
-FindGlyphHashSet (CARD32 filled)
-{
- int i;
-
- for (i = 0; i < NGLYPHHASHSETS; i++)
- if (glyphHashSets[i].entries >= filled)
- return &glyphHashSets[i];
- return 0;
-}
-
-GlyphRefPtr
-FindGlyphRef (GlyphHashPtr hash,
- CARD32 signature,
- Bool match,
- unsigned char sha1[20])
-{
- CARD32 elt, step, s;
- GlyphPtr glyph;
- GlyphRefPtr table, gr, del;
- CARD32 tableSize = hash->hashSet->size;
-
- table = hash->table;
- elt = signature % tableSize;
- step = 0;
- del = 0;
- for (;;)
- {
- gr = &table[elt];
- s = gr->signature;
- glyph = gr->glyph;
- if (!glyph)
- {
- if (del)
- gr = del;
- break;
- }
- if (glyph == DeletedGlyph)
- {
- if (!del)
- del = gr;
- else if (gr == del)
- break;
- }
- else if (s == signature &&
- (!match ||
- memcmp (glyph->sha1, sha1, 20) == 0))
- {
- break;
- }
- if (!step)
- {
- step = signature % hash->hashSet->rehash;
- if (!step)
- step = 1;
- }
- elt += step;
- if (elt >= tableSize)
- elt -= tableSize;
- }
- return gr;
-}
-
-int
-HashGlyph (xGlyphInfo *gi,
- CARD8 *bits,
- unsigned long size,
- unsigned char sha1[20])
-{
- void *ctx = x_sha1_init();
- int success;
-
- if (!ctx)
- return BadAlloc;
-
- success = x_sha1_update(ctx, gi, sizeof(xGlyphInfo));
- if (!success)
- return BadAlloc;
- success = x_sha1_update(ctx, bits, size);
- if (!success)
- return BadAlloc;
- success = x_sha1_final(ctx, sha1);
- if (!success)
- return BadAlloc;
- return Success;
-}
-
-GlyphPtr
-FindGlyphByHash (unsigned char sha1[20], int format)
-{
- GlyphRefPtr gr;
- CARD32 signature = *(CARD32 *) sha1;
-
- if (!globalGlyphs[format].hashSet)
- return NULL;
-
- gr = FindGlyphRef (&globalGlyphs[format],
- signature, TRUE, sha1);
-
- if (gr->glyph && gr->glyph != DeletedGlyph)
- return gr->glyph;
- else
- return NULL;
-}
-
-#ifdef CHECK_DUPLICATES
-void
-DuplicateRef (GlyphPtr glyph, char *where)
-{
- ErrorF ("Duplicate Glyph 0x%x from %s\n", glyph, where);
-}
-
-void
-CheckDuplicates (GlyphHashPtr hash, char *where)
-{
- GlyphPtr g;
- int i, j;
-
- for (i = 0; i < hash->hashSet->size; i++)
- {
- g = hash->table[i].glyph;
- if (!g || g == DeletedGlyph)
- continue;
- for (j = i + 1; j < hash->hashSet->size; j++)
- if (hash->table[j].glyph == g)
- DuplicateRef (g, where);
- }
-}
-#else
-#define CheckDuplicates(a,b)
-#define DuplicateRef(a,b)
-#endif
-
-static void
-FreeGlyphPicture(GlyphPtr glyph)
-{
- PictureScreenPtr ps;
- int i;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen = screenInfo.screens[i];
-
- if (GlyphPicture(glyph)[i])
- FreePicture ((pointer) GlyphPicture (glyph)[i], 0);
-
- ps = GetPictureScreenIfSet (pScreen);
- if (ps)
- (*ps->UnrealizeGlyph) (pScreen, glyph);
- }
-}
-
-
-void
-FreeGlyph (GlyphPtr glyph, int format)
-{
- CheckDuplicates (&globalGlyphs[format], "FreeGlyph");
- if (--glyph->refcnt == 0)
- {
- GlyphRefPtr gr;
- int i;
- int first;
- CARD32 signature;
-
- first = -1;
- for (i = 0; i < globalGlyphs[format].hashSet->size; i++)
- if (globalGlyphs[format].table[i].glyph == glyph)
- {
- if (first != -1)
- DuplicateRef (glyph, "FreeGlyph check");
- first = i;
- }
-
- signature = *(CARD32 *) glyph->sha1;
- gr = FindGlyphRef (&globalGlyphs[format], signature,
- TRUE, glyph->sha1);
- if (gr - globalGlyphs[format].table != first)
- DuplicateRef (glyph, "Found wrong one");
- if (gr->glyph && gr->glyph != DeletedGlyph)
- {
- gr->glyph = DeletedGlyph;
- gr->signature = 0;
- globalGlyphs[format].tableEntries--;
- }
-
- FreeGlyphPicture(glyph);
- dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
- }
-}
-
-void
-AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id)
-{
- GlyphRefPtr gr;
- CARD32 signature;
-
- CheckDuplicates (&globalGlyphs[glyphSet->fdepth], "AddGlyph top global");
- /* Locate existing matching glyph */
- signature = *(CARD32 *) glyph->sha1;
- gr = FindGlyphRef (&globalGlyphs[glyphSet->fdepth], signature,
- TRUE, glyph->sha1);
- if (gr->glyph && gr->glyph != DeletedGlyph && gr->glyph != glyph)
- {
- FreeGlyphPicture(glyph);
- dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
- glyph = gr->glyph;
- }
- else if (gr->glyph != glyph)
- {
- gr->glyph = glyph;
- gr->signature = signature;
- globalGlyphs[glyphSet->fdepth].tableEntries++;
- }
-
- /* Insert/replace glyphset value */
- gr = FindGlyphRef (&glyphSet->hash, id, FALSE, 0);
- ++glyph->refcnt;
- if (gr->glyph && gr->glyph != DeletedGlyph)
- FreeGlyph (gr->glyph, glyphSet->fdepth);
- else
- glyphSet->hash.tableEntries++;
- gr->glyph = glyph;
- gr->signature = id;
- CheckDuplicates (&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom");
-}
-
-Bool
-DeleteGlyph (GlyphSetPtr glyphSet, Glyph id)
-{
- GlyphRefPtr gr;
- GlyphPtr glyph;
-
- gr = FindGlyphRef (&glyphSet->hash, id, FALSE, 0);
- glyph = gr->glyph;
- if (glyph && glyph != DeletedGlyph)
- {
- gr->glyph = DeletedGlyph;
- glyphSet->hash.tableEntries--;
- FreeGlyph (glyph, glyphSet->fdepth);
- return TRUE;
- }
- return FALSE;
-}
-
-GlyphPtr
-FindGlyph (GlyphSetPtr glyphSet, Glyph id)
-{
- GlyphPtr glyph;
-
- glyph = FindGlyphRef (&glyphSet->hash, id, FALSE, 0)->glyph;
- if (glyph == DeletedGlyph)
- glyph = 0;
- return glyph;
-}
-
-GlyphPtr
-AllocateGlyph (xGlyphInfo *gi, int fdepth)
-{
- PictureScreenPtr ps;
- int size;
- GlyphPtr glyph;
- int i;
- int head_size;
-
- head_size = sizeof (GlyphRec) + screenInfo.numScreens * sizeof (PicturePtr);
- size = (head_size + dixPrivatesSize(PRIVATE_GLYPH));
- glyph = (GlyphPtr) malloc (size);
- if (!glyph)
- return 0;
- glyph->refcnt = 0;
- glyph->size = size + sizeof (xGlyphInfo);
- glyph->info = *gi;
- dixInitPrivates(glyph, (char *) glyph + head_size, PRIVATE_GLYPH);
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- GlyphPicture(glyph)[i] = NULL;
- ps = GetPictureScreenIfSet (screenInfo.screens[i]);
-
- if (ps)
- {
- if (!(*ps->RealizeGlyph) (screenInfo.screens[i], glyph))
- goto bail;
- }
- }
-
- return glyph;
-
-bail:
- while (i--)
- {
- ps = GetPictureScreenIfSet (screenInfo.screens[i]);
- if (ps)
- (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph);
- }
-
- dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
- return 0;
-}
-
-Bool
-AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet)
-{
- hash->table = calloc(hashSet->size, sizeof (GlyphRefRec));
- if (!hash->table)
- return FALSE;
- hash->hashSet = hashSet;
- hash->tableEntries = 0;
- return TRUE;
-}
-
-Bool
-ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global)
-{
- CARD32 tableEntries;
- GlyphHashSetPtr hashSet;
- GlyphHashRec newHash;
- GlyphRefPtr gr;
- GlyphPtr glyph;
- int i;
- int oldSize;
- CARD32 s;
-
- tableEntries = hash->tableEntries + change;
- hashSet = FindGlyphHashSet (tableEntries);
- if (hashSet == hash->hashSet)
- return TRUE;
- if (global)
- CheckDuplicates (hash, "ResizeGlyphHash top");
- if (!AllocateGlyphHash (&newHash, hashSet))
- return FALSE;
- if (hash->table)
- {
- oldSize = hash->hashSet->size;
- for (i = 0; i < oldSize; i++)
- {
- glyph = hash->table[i].glyph;
- if (glyph && glyph != DeletedGlyph)
- {
- s = hash->table[i].signature;
- gr = FindGlyphRef (&newHash, s, global, glyph->sha1);
- gr->signature = s;
- gr->glyph = glyph;
- ++newHash.tableEntries;
- }
- }
- free(hash->table);
- }
- *hash = newHash;
- if (global)
- CheckDuplicates (hash, "ResizeGlyphHash bottom");
- return TRUE;
-}
-
-Bool
-ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change)
-{
- return (ResizeGlyphHash (&glyphSet->hash, change, FALSE) &&
- ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], change, TRUE));
-}
-
-GlyphSetPtr
-AllocateGlyphSet (int fdepth, PictFormatPtr format)
-{
- GlyphSetPtr glyphSet;
-
- if (!globalGlyphs[fdepth].hashSet)
- {
- if (!AllocateGlyphHash (&globalGlyphs[fdepth], &glyphHashSets[0]))
- return FALSE;
- }
-
- glyphSet = dixAllocateObjectWithPrivates(GlyphSetRec, PRIVATE_GLYPHSET);
- if (!glyphSet)
- return FALSE;
-
- if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0]))
- {
- free(glyphSet);
- return FALSE;
- }
- glyphSet->refcnt = 1;
- glyphSet->fdepth = fdepth;
- glyphSet->format = format;
- return glyphSet;
-}
-
-int
-FreeGlyphSet (pointer value,
- XID gid)
-{
- GlyphSetPtr glyphSet = (GlyphSetPtr) value;
-
- if (--glyphSet->refcnt == 0)
- {
- CARD32 i, tableSize = glyphSet->hash.hashSet->size;
- GlyphRefPtr table = glyphSet->hash.table;
- GlyphPtr glyph;
-
- for (i = 0; i < tableSize; i++)
- {
- glyph = table[i].glyph;
- if (glyph && glyph != DeletedGlyph)
- FreeGlyph (glyph, glyphSet->fdepth);
- }
- if (!globalGlyphs[glyphSet->fdepth].tableEntries)
- {
- free(globalGlyphs[glyphSet->fdepth].table);
- globalGlyphs[glyphSet->fdepth].table = 0;
- globalGlyphs[glyphSet->fdepth].hashSet = 0;
- }
- else
- ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], 0, TRUE);
- free(table);
- dixFreeObjectWithPrivates(glyphSet, PRIVATE_GLYPHSET);
- }
- return Success;
-}
-
-static void
-GlyphExtents (int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs,
- BoxPtr extents)
-{
- int x1, x2, y1, y2;
- int n;
- GlyphPtr glyph;
- int x, y;
-
- x = 0;
- y = 0;
- extents->x1 = MAXSHORT;
- extents->x2 = MINSHORT;
- extents->y1 = MAXSHORT;
- extents->y2 = MINSHORT;
- while (nlist--)
- {
- x += list->xOff;
- y += list->yOff;
- n = list->len;
- list++;
- while (n--)
- {
- glyph = *glyphs++;
- x1 = x - glyph->info.x;
- if (x1 < MINSHORT)
- x1 = MINSHORT;
- y1 = y - glyph->info.y;
- if (y1 < MINSHORT)
- y1 = MINSHORT;
- x2 = x1 + glyph->info.width;
- if (x2 > MAXSHORT)
- x2 = MAXSHORT;
- y2 = y1 + glyph->info.height;
- if (y2 > MAXSHORT)
- y2 = MAXSHORT;
- if (x1 < extents->x1)
- extents->x1 = x1;
- if (x2 > extents->x2)
- extents->x2 = x2;
- if (y1 < extents->y1)
- extents->y1 = y1;
- if (y2 > extents->y2)
- extents->y2 = y2;
- x += glyph->info.xOff;
- y += glyph->info.yOff;
- }
- }
-}
-
-#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
-
-void
-CompositeGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr lists,
- GlyphPtr *glyphs)
-{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
- (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists, glyphs);
-}
-
-Bool
-miRealizeGlyph (ScreenPtr pScreen,
- GlyphPtr glyph)
-{
- return TRUE;
-}
-
-void
-miUnrealizeGlyph (ScreenPtr pScreen,
- GlyphPtr glyph)
-{
-}
-
-void
-miGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
- PicturePtr pPicture;
- PixmapPtr pMaskPixmap = 0;
- PicturePtr pMask;
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- int width = 0, height = 0;
- int x, y;
- int xDst = list->xOff, yDst = list->yOff;
- int n;
- GlyphPtr glyph;
- int error;
- BoxRec extents = {0, 0, 0, 0};
- CARD32 component_alpha;
-
- if (maskFormat)
- {
- GCPtr pGC;
- xRectangle rect;
-
- GlyphExtents (nlist, list, glyphs, &extents);
-
- if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
- return;
- width = extents.x2 - extents.x1;
- height = extents.y2 - extents.y1;
- pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
- maskFormat->depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pMaskPixmap)
- return;
- component_alpha = NeedsComponent(maskFormat->format);
- pMask = CreatePicture (0, &pMaskPixmap->drawable,
- maskFormat, CPComponentAlpha, &component_alpha,
- serverClient, &error);
- if (!pMask)
- {
- (*pScreen->DestroyPixmap) (pMaskPixmap);
- return;
- }
- pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
- ValidateGC (&pMaskPixmap->drawable, pGC);
- rect.x = 0;
- rect.y = 0;
- rect.width = width;
- rect.height = height;
- (*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
- FreeScratchGC (pGC);
- x = -extents.x1;
- y = -extents.y1;
- }
- else
- {
- pMask = pDst;
- x = 0;
- y = 0;
- }
- while (nlist--)
- {
- x += list->xOff;
- y += list->yOff;
- n = list->len;
- while (n--)
- {
- glyph = *glyphs++;
- pPicture = GlyphPicture (glyph)[pScreen->myNum];
-
- if (pPicture)
- {
- if (maskFormat)
- {
- CompositePicture (PictOpAdd,
- pPicture,
- None,
- pMask,
- 0, 0,
- 0, 0,
- x - glyph->info.x,
- y - glyph->info.y,
- glyph->info.width,
- glyph->info.height);
- }
- else
- {
- CompositePicture (op,
- pSrc,
- pPicture,
- pDst,
- xSrc + (x - glyph->info.x) - xDst,
- ySrc + (y - glyph->info.y) - yDst,
- 0, 0,
- x - glyph->info.x,
- y - glyph->info.y,
- glyph->info.width,
- glyph->info.height);
- }
- }
-
- x += glyph->info.xOff;
- y += glyph->info.yOff;
- }
- list++;
- }
- if (maskFormat)
- {
- x = extents.x1;
- y = extents.y1;
- CompositePicture (op,
- pSrc,
- pMask,
- pDst,
- xSrc + x - xDst,
- ySrc + y - yDst,
- 0, 0,
- x, y,
- width, height);
- FreePicture ((pointer) pMask, (XID) 0);
- (*pScreen->DestroyPixmap) (pMaskPixmap);
- }
-}
+/*
+ *
+ * Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xsha1.h"
+
+#include "misc.h"
+#include "scrnintstr.h"
+#include "os.h"
+#include "regionstr.h"
+#include "validate.h"
+#include "windowstr.h"
+#include "input.h"
+#include "resource.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "dixstruct.h"
+#include "gcstruct.h"
+#include "servermd.h"
+#include "picturestr.h"
+#include "glyphstr.h"
+#include "mipict.h"
+
+/*
+ * From Knuth -- a good choice for hash/rehash values is p, p-2 where
+ * p and p-2 are both prime. These tables are sized to have an extra 10%
+ * free to avoid exponential performance degradation as the hash table fills
+ */
+static GlyphHashSetRec glyphHashSets[] = {
+ {32, 43, 41},
+ {64, 73, 71},
+ {128, 151, 149},
+ {256, 283, 281},
+ {512, 571, 569},
+ {1024, 1153, 1151},
+ {2048, 2269, 2267},
+ {4096, 4519, 4517},
+ {8192, 9013, 9011},
+ {16384, 18043, 18041},
+ {32768, 36109, 36107},
+ {65536, 72091, 72089},
+ {131072, 144409, 144407},
+ {262144, 288361, 288359},
+ {524288, 576883, 576881},
+ {1048576, 1153459, 1153457},
+ {2097152, 2307163, 2307161},
+ {4194304, 4613893, 4613891},
+ {8388608, 9227641, 9227639},
+ {16777216, 18455029, 18455027},
+ {33554432, 36911011, 36911009},
+ {67108864, 73819861, 73819859},
+ {134217728, 147639589, 147639587},
+ {268435456, 295279081, 295279079},
+ {536870912, 590559793, 590559791}
+};
+
+#define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0]))
+
+static const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 };
+
+static GlyphHashRec globalGlyphs[GlyphFormatNum];
+
+void
+GlyphUninit(ScreenPtr pScreen)
+{
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ GlyphPtr glyph;
+ int fdepth, i;
+ int scrno = pScreen->myNum;
+
+ for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++) {
+ if (!globalGlyphs[fdepth].hashSet)
+ continue;
+
+ for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++) {
+ glyph = globalGlyphs[fdepth].table[i].glyph;
+ if (glyph && glyph != DeletedGlyph) {
+ if (GlyphPicture(glyph)[scrno]) {
+ FreePicture((pointer) GlyphPicture(glyph)[scrno], 0);
+ GlyphPicture(glyph)[scrno] = NULL;
+ }
+ (*ps->UnrealizeGlyph) (pScreen, glyph);
+ }
+ }
+ }
+}
+
+GlyphHashSetPtr
+FindGlyphHashSet(CARD32 filled)
+{
+ int i;
+
+ for (i = 0; i < NGLYPHHASHSETS; i++)
+ if (glyphHashSets[i].entries >= filled)
+ return &glyphHashSets[i];
+ return 0;
+}
+
+GlyphRefPtr
+FindGlyphRef(GlyphHashPtr hash,
+ CARD32 signature, Bool match, unsigned char sha1[20])
+{
+ CARD32 elt, step, s;
+ GlyphPtr glyph;
+ GlyphRefPtr table, gr, del;
+ CARD32 tableSize = hash->hashSet->size;
+
+ table = hash->table;
+ elt = signature % tableSize;
+ step = 0;
+ del = 0;
+ for (;;) {
+ gr = &table[elt];
+ s = gr->signature;
+ glyph = gr->glyph;
+ if (!glyph) {
+ if (del)
+ gr = del;
+ break;
+ }
+ if (glyph == DeletedGlyph) {
+ if (!del)
+ del = gr;
+ else if (gr == del)
+ break;
+ }
+ else if (s == signature &&
+ (!match || memcmp(glyph->sha1, sha1, 20) == 0)) {
+ break;
+ }
+ if (!step) {
+ step = signature % hash->hashSet->rehash;
+ if (!step)
+ step = 1;
+ }
+ elt += step;
+ if (elt >= tableSize)
+ elt -= tableSize;
+ }
+ return gr;
+}
+
+int
+HashGlyph(xGlyphInfo * gi,
+ CARD8 *bits, unsigned long size, unsigned char sha1[20])
+{
+ void *ctx = x_sha1_init();
+ int success;
+
+ if (!ctx)
+ return BadAlloc;
+
+ success = x_sha1_update(ctx, gi, sizeof(xGlyphInfo));
+ if (!success)
+ return BadAlloc;
+ success = x_sha1_update(ctx, bits, size);
+ if (!success)
+ return BadAlloc;
+ success = x_sha1_final(ctx, sha1);
+ if (!success)
+ return BadAlloc;
+ return Success;
+}
+
+GlyphPtr
+FindGlyphByHash(unsigned char sha1[20], int format)
+{
+ GlyphRefPtr gr;
+ CARD32 signature = *(CARD32 *) sha1;
+
+ if (!globalGlyphs[format].hashSet)
+ return NULL;
+
+ gr = FindGlyphRef(&globalGlyphs[format], signature, TRUE, sha1);
+
+ if (gr->glyph && gr->glyph != DeletedGlyph)
+ return gr->glyph;
+ else
+ return NULL;
+}
+
+#ifdef CHECK_DUPLICATES
+void
+DuplicateRef(GlyphPtr glyph, char *where)
+{
+ ErrorF("Duplicate Glyph 0x%x from %s\n", glyph, where);
+}
+
+void
+CheckDuplicates(GlyphHashPtr hash, char *where)
+{
+ GlyphPtr g;
+ int i, j;
+
+ for (i = 0; i < hash->hashSet->size; i++) {
+ g = hash->table[i].glyph;
+ if (!g || g == DeletedGlyph)
+ continue;
+ for (j = i + 1; j < hash->hashSet->size; j++)
+ if (hash->table[j].glyph == g)
+ DuplicateRef(g, where);
+ }
+}
+#else
+#define CheckDuplicates(a,b)
+#define DuplicateRef(a,b)
+#endif
+
+static void
+FreeGlyphPicture(GlyphPtr glyph)
+{
+ PictureScreenPtr ps;
+ int i;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ if (GlyphPicture(glyph)[i])
+ FreePicture((pointer) GlyphPicture(glyph)[i], 0);
+
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps)
+ (*ps->UnrealizeGlyph) (pScreen, glyph);
+ }
+}
+
+void
+FreeGlyph(GlyphPtr glyph, int format)
+{
+ CheckDuplicates(&globalGlyphs[format], "FreeGlyph");
+ if (--glyph->refcnt == 0) {
+ GlyphRefPtr gr;
+ int i;
+ int first;
+ CARD32 signature;
+
+ first = -1;
+ for (i = 0; i < globalGlyphs[format].hashSet->size; i++)
+ if (globalGlyphs[format].table[i].glyph == glyph) {
+ if (first != -1)
+ DuplicateRef(glyph, "FreeGlyph check");
+ first = i;
+ }
+
+ signature = *(CARD32 *) glyph->sha1;
+ gr = FindGlyphRef(&globalGlyphs[format], signature, TRUE, glyph->sha1);
+ if (gr - globalGlyphs[format].table != first)
+ DuplicateRef(glyph, "Found wrong one");
+ if (gr->glyph && gr->glyph != DeletedGlyph) {
+ gr->glyph = DeletedGlyph;
+ gr->signature = 0;
+ globalGlyphs[format].tableEntries--;
+ }
+
+ FreeGlyphPicture(glyph);
+ dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
+ }
+}
+
+void
+AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id)
+{
+ GlyphRefPtr gr;
+ CARD32 signature;
+
+ CheckDuplicates(&globalGlyphs[glyphSet->fdepth], "AddGlyph top global");
+ /* Locate existing matching glyph */
+ signature = *(CARD32 *) glyph->sha1;
+ gr = FindGlyphRef(&globalGlyphs[glyphSet->fdepth], signature,
+ TRUE, glyph->sha1);
+ if (gr->glyph && gr->glyph != DeletedGlyph && gr->glyph != glyph) {
+ FreeGlyphPicture(glyph);
+ dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
+ glyph = gr->glyph;
+ }
+ else if (gr->glyph != glyph) {
+ gr->glyph = glyph;
+ gr->signature = signature;
+ globalGlyphs[glyphSet->fdepth].tableEntries++;
+ }
+
+ /* Insert/replace glyphset value */
+ gr = FindGlyphRef(&glyphSet->hash, id, FALSE, 0);
+ ++glyph->refcnt;
+ if (gr->glyph && gr->glyph != DeletedGlyph)
+ FreeGlyph(gr->glyph, glyphSet->fdepth);
+ else
+ glyphSet->hash.tableEntries++;
+ gr->glyph = glyph;
+ gr->signature = id;
+ CheckDuplicates(&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom");
+}
+
+Bool
+DeleteGlyph(GlyphSetPtr glyphSet, Glyph id)
+{
+ GlyphRefPtr gr;
+ GlyphPtr glyph;
+
+ gr = FindGlyphRef(&glyphSet->hash, id, FALSE, 0);
+ glyph = gr->glyph;
+ if (glyph && glyph != DeletedGlyph) {
+ gr->glyph = DeletedGlyph;
+ glyphSet->hash.tableEntries--;
+ FreeGlyph(glyph, glyphSet->fdepth);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+GlyphPtr
+FindGlyph(GlyphSetPtr glyphSet, Glyph id)
+{
+ GlyphPtr glyph;
+
+ glyph = FindGlyphRef(&glyphSet->hash, id, FALSE, 0)->glyph;
+ if (glyph == DeletedGlyph)
+ glyph = 0;
+ return glyph;
+}
+
+GlyphPtr
+AllocateGlyph(xGlyphInfo * gi, int fdepth)
+{
+ PictureScreenPtr ps;
+ int size;
+ GlyphPtr glyph;
+ int i;
+ int head_size;
+
+ head_size = sizeof(GlyphRec) + screenInfo.numScreens * sizeof(PicturePtr);
+ size = (head_size + dixPrivatesSize(PRIVATE_GLYPH));
+ glyph = (GlyphPtr) malloc(size);
+ if (!glyph)
+ return 0;
+ glyph->refcnt = 0;
+ glyph->size = size + sizeof(xGlyphInfo);
+ glyph->info = *gi;
+ dixInitPrivates(glyph, (char *) glyph + head_size, PRIVATE_GLYPH);
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ GlyphPicture(glyph)[i] = NULL;
+ ps = GetPictureScreenIfSet(screenInfo.screens[i]);
+
+ if (ps) {
+ if (!(*ps->RealizeGlyph) (screenInfo.screens[i], glyph))
+ goto bail;
+ }
+ }
+
+ return glyph;
+
+ bail:
+ while (i--) {
+ ps = GetPictureScreenIfSet(screenInfo.screens[i]);
+ if (ps)
+ (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph);
+ }
+
+ dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
+ return 0;
+}
+
+Bool
+AllocateGlyphHash(GlyphHashPtr hash, GlyphHashSetPtr hashSet)
+{
+ hash->table = calloc(hashSet->size, sizeof(GlyphRefRec));
+ if (!hash->table)
+ return FALSE;
+ hash->hashSet = hashSet;
+ hash->tableEntries = 0;
+ return TRUE;
+}
+
+Bool
+ResizeGlyphHash(GlyphHashPtr hash, CARD32 change, Bool global)
+{
+ CARD32 tableEntries;
+ GlyphHashSetPtr hashSet;
+ GlyphHashRec newHash;
+ GlyphRefPtr gr;
+ GlyphPtr glyph;
+ int i;
+ int oldSize;
+ CARD32 s;
+
+ tableEntries = hash->tableEntries + change;
+ hashSet = FindGlyphHashSet(tableEntries);
+ if (hashSet == hash->hashSet)
+ return TRUE;
+ if (global)
+ CheckDuplicates(hash, "ResizeGlyphHash top");
+ if (!AllocateGlyphHash(&newHash, hashSet))
+ return FALSE;
+ if (hash->table) {
+ oldSize = hash->hashSet->size;
+ for (i = 0; i < oldSize; i++) {
+ glyph = hash->table[i].glyph;
+ if (glyph && glyph != DeletedGlyph) {
+ s = hash->table[i].signature;
+ gr = FindGlyphRef(&newHash, s, global, glyph->sha1);
+
+ gr->signature = s;
+ gr->glyph = glyph;
+ ++newHash.tableEntries;
+ }
+ }
+ free(hash->table);
+ }
+ *hash = newHash;
+ if (global)
+ CheckDuplicates(hash, "ResizeGlyphHash bottom");
+ return TRUE;
+}
+
+Bool
+ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change)
+{
+ return (ResizeGlyphHash(&glyphSet->hash, change, FALSE) &&
+ ResizeGlyphHash(&globalGlyphs[glyphSet->fdepth], change, TRUE));
+}
+
+GlyphSetPtr
+AllocateGlyphSet(int fdepth, PictFormatPtr format)
+{
+ GlyphSetPtr glyphSet;
+
+ if (!globalGlyphs[fdepth].hashSet) {
+ if (!AllocateGlyphHash(&globalGlyphs[fdepth], &glyphHashSets[0]))
+ return FALSE;
+ }
+
+ glyphSet = dixAllocateObjectWithPrivates(GlyphSetRec, PRIVATE_GLYPHSET);
+ if (!glyphSet)
+ return FALSE;
+
+ if (!AllocateGlyphHash(&glyphSet->hash, &glyphHashSets[0])) {
+ free(glyphSet);
+ return FALSE;
+ }
+ glyphSet->refcnt = 1;
+ glyphSet->fdepth = fdepth;
+ glyphSet->format = format;
+ return glyphSet;
+}
+
+int
+FreeGlyphSet(pointer value, XID gid)
+{
+ GlyphSetPtr glyphSet = (GlyphSetPtr) value;
+
+ if (--glyphSet->refcnt == 0) {
+ CARD32 i, tableSize = glyphSet->hash.hashSet->size;
+ GlyphRefPtr table = glyphSet->hash.table;
+ GlyphPtr glyph;
+
+ for (i = 0; i < tableSize; i++) {
+ glyph = table[i].glyph;
+ if (glyph && glyph != DeletedGlyph)
+ FreeGlyph(glyph, glyphSet->fdepth);
+ }
+ if (!globalGlyphs[glyphSet->fdepth].tableEntries) {
+ free(globalGlyphs[glyphSet->fdepth].table);
+ globalGlyphs[glyphSet->fdepth].table = 0;
+ globalGlyphs[glyphSet->fdepth].hashSet = 0;
+ }
+ else
+ ResizeGlyphHash(&globalGlyphs[glyphSet->fdepth], 0, TRUE);
+ free(table);
+ dixFreeObjectWithPrivates(glyphSet, PRIVATE_GLYPHSET);
+ }
+ return Success;
+}
+
+static void
+GlyphExtents(int nlist, GlyphListPtr list, GlyphPtr * glyphs, BoxPtr extents)
+{
+ int x1, x2, y1, y2;
+ int n;
+ GlyphPtr glyph;
+ int x, y;
+
+ x = 0;
+ y = 0;
+ extents->x1 = MAXSHORT;
+ extents->x2 = MINSHORT;
+ extents->y1 = MAXSHORT;
+ extents->y2 = MINSHORT;
+ while (nlist--) {
+ x += list->xOff;
+ y += list->yOff;
+ n = list->len;
+ list++;
+ while (n--) {
+ glyph = *glyphs++;
+ x1 = x - glyph->info.x;
+ if (x1 < MINSHORT)
+ x1 = MINSHORT;
+ y1 = y - glyph->info.y;
+ if (y1 < MINSHORT)
+ y1 = MINSHORT;
+ x2 = x1 + glyph->info.width;
+ if (x2 > MAXSHORT)
+ x2 = MAXSHORT;
+ y2 = y1 + glyph->info.height;
+ if (y2 > MAXSHORT)
+ y2 = MAXSHORT;
+ if (x1 < extents->x1)
+ extents->x1 = x1;
+ if (x2 > extents->x2)
+ extents->x2 = x2;
+ if (y1 < extents->y1)
+ extents->y1 = y1;
+ if (y2 > extents->y2)
+ extents->y2 = y2;
+ x += glyph->info.xOff;
+ y += glyph->info.yOff;
+ }
+ }
+}
+
+#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
+
+void
+CompositeGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr lists, GlyphPtr * glyphs)
+{
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+
+ ValidatePicture(pSrc);
+ ValidatePicture(pDst);
+ (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists,
+ glyphs);
+}
+
+Bool
+miRealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph)
+{
+ return TRUE;
+}
+
+void
+miUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph)
+{
+}
+
+void
+miGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
+{
+ PicturePtr pPicture;
+ PixmapPtr pMaskPixmap = 0;
+ PicturePtr pMask;
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ int width = 0, height = 0;
+ int x, y;
+ int xDst = list->xOff, yDst = list->yOff;
+ int n;
+ GlyphPtr glyph;
+ int error;
+ BoxRec extents = { 0, 0, 0, 0 };
+ CARD32 component_alpha;
+
+ if (maskFormat) {
+ GCPtr pGC;
+ xRectangle rect;
+
+ GlyphExtents(nlist, list, glyphs, &extents);
+
+ if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
+ return;
+ width = extents.x2 - extents.x1;
+ height = extents.y2 - extents.y1;
+ pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
+ maskFormat->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pMaskPixmap)
+ return;
+ component_alpha = NeedsComponent(maskFormat->format);
+ pMask = CreatePicture(0, &pMaskPixmap->drawable,
+ maskFormat, CPComponentAlpha, &component_alpha,
+ serverClient, &error);
+ if (!pMask) {
+ (*pScreen->DestroyPixmap) (pMaskPixmap);
+ return;
+ }
+ pGC = GetScratchGC(pMaskPixmap->drawable.depth, pScreen);
+ ValidateGC(&pMaskPixmap->drawable, pGC);
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = width;
+ rect.height = height;
+ (*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
+ FreeScratchGC(pGC);
+ x = -extents.x1;
+ y = -extents.y1;
+ }
+ else {
+ pMask = pDst;
+ x = 0;
+ y = 0;
+ }
+ while (nlist--) {
+ x += list->xOff;
+ y += list->yOff;
+ n = list->len;
+ while (n--) {
+ glyph = *glyphs++;
+ pPicture = GlyphPicture(glyph)[pScreen->myNum];
+
+ if (pPicture) {
+ if (maskFormat) {
+ CompositePicture(PictOpAdd,
+ pPicture,
+ None,
+ pMask,
+ 0, 0,
+ 0, 0,
+ x - glyph->info.x,
+ y - glyph->info.y,
+ glyph->info.width, glyph->info.height);
+ }
+ else {
+ CompositePicture(op,
+ pSrc,
+ pPicture,
+ pDst,
+ xSrc + (x - glyph->info.x) - xDst,
+ ySrc + (y - glyph->info.y) - yDst,
+ 0, 0,
+ x - glyph->info.x,
+ y - glyph->info.y,
+ glyph->info.width, glyph->info.height);
+ }
+ }
+
+ x += glyph->info.xOff;
+ y += glyph->info.yOff;
+ }
+ list++;
+ }
+ if (maskFormat) {
+ x = extents.x1;
+ y = extents.y1;
+ CompositePicture(op,
+ pSrc,
+ pMask,
+ pDst,
+ xSrc + x - xDst,
+ ySrc + y - yDst, 0, 0, x, y, width, height);
+ FreePicture((pointer) pMask, (XID) 0);
+ (*pScreen->DestroyPixmap) (pMaskPixmap);
+ }
+}
diff --git a/xorg-server/render/glyphstr.h b/xorg-server/render/glyphstr.h
index 49b4b54dd..cbc4751f0 100644
--- a/xorg-server/render/glyphstr.h
+++ b/xorg-server/render/glyphstr.h
@@ -40,41 +40,41 @@
#define GlyphFormatNum 5
typedef struct _Glyph {
- CARD32 refcnt;
- PrivateRec *devPrivates;
- unsigned char sha1[20];
- CARD32 size; /* info + bitmap */
- xGlyphInfo info;
+ CARD32 refcnt;
+ PrivateRec *devPrivates;
+ unsigned char sha1[20];
+ CARD32 size; /* info + bitmap */
+ xGlyphInfo info;
/* per-screen pixmaps follow */
} GlyphRec, *GlyphPtr;
#define GlyphPicture(glyph) ((PicturePtr *) ((glyph) + 1))
typedef struct _GlyphRef {
- CARD32 signature;
- GlyphPtr glyph;
+ CARD32 signature;
+ GlyphPtr glyph;
} GlyphRefRec, *GlyphRefPtr;
#define DeletedGlyph ((GlyphPtr) 1)
typedef struct _GlyphHashSet {
- CARD32 entries;
- CARD32 size;
- CARD32 rehash;
+ CARD32 entries;
+ CARD32 size;
+ CARD32 rehash;
} GlyphHashSetRec, *GlyphHashSetPtr;
typedef struct _GlyphHash {
- GlyphRefPtr table;
+ GlyphRefPtr table;
GlyphHashSetPtr hashSet;
- CARD32 tableEntries;
+ CARD32 tableEntries;
} GlyphHashRec, *GlyphHashPtr;
typedef struct _GlyphSet {
- CARD32 refcnt;
- int fdepth;
- PictFormatPtr format;
- GlyphHashRec hash;
- PrivateRec *devPrivates;
+ CARD32 refcnt;
+ int fdepth;
+ PictFormatPtr format;
+ GlyphHashRec hash;
+ PrivateRec *devPrivates;
} GlyphSetRec, *GlyphSetPtr;
#define GlyphSetGetPrivate(pGlyphSet,k) \
@@ -84,64 +84,53 @@ typedef struct _GlyphSet {
dixSetPrivate(&(pGlyphSet)->devPrivates, k, ptr)
typedef struct _GlyphList {
- INT16 xOff;
- INT16 yOff;
- CARD8 len;
- PictFormatPtr format;
+ INT16 xOff;
+ INT16 yOff;
+ CARD8 len;
+ PictFormatPtr format;
} GlyphListRec, *GlyphListPtr;
extern _X_EXPORT void
-GlyphUninit (ScreenPtr pScreen);
+ GlyphUninit(ScreenPtr pScreen);
-extern _X_EXPORT GlyphHashSetPtr
-FindGlyphHashSet (CARD32 filled);
+extern _X_EXPORT GlyphHashSetPtr FindGlyphHashSet(CARD32 filled);
extern _X_EXPORT GlyphRefPtr
-FindGlyphRef (GlyphHashPtr hash,
- CARD32 signature,
- Bool match,
- unsigned char sha1[20]);
+FindGlyphRef(GlyphHashPtr hash,
+ CARD32 signature, Bool match, unsigned char sha1[20]);
-extern _X_EXPORT GlyphPtr
-FindGlyphByHash (unsigned char sha1[20], int format);
+extern _X_EXPORT GlyphPtr FindGlyphByHash(unsigned char sha1[20], int format);
extern _X_EXPORT int
-HashGlyph (xGlyphInfo *gi,
- CARD8 *bits,
- unsigned long size,
- unsigned char sha1[20]);
+
+HashGlyph(xGlyphInfo * gi,
+ CARD8 *bits, unsigned long size, unsigned char sha1[20]);
extern _X_EXPORT void
-FreeGlyph (GlyphPtr glyph, int format);
+ FreeGlyph(GlyphPtr glyph, int format);
extern _X_EXPORT void
-AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id);
+ AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id);
extern _X_EXPORT Bool
-DeleteGlyph (GlyphSetPtr glyphSet, Glyph id);
+ DeleteGlyph(GlyphSetPtr glyphSet, Glyph id);
-extern _X_EXPORT GlyphPtr
-FindGlyph (GlyphSetPtr glyphSet, Glyph id);
+extern _X_EXPORT GlyphPtr FindGlyph(GlyphSetPtr glyphSet, Glyph id);
-extern _X_EXPORT GlyphPtr
-AllocateGlyph (xGlyphInfo *gi, int format);
+extern _X_EXPORT GlyphPtr AllocateGlyph(xGlyphInfo * gi, int format);
extern _X_EXPORT Bool
-AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet);
+ AllocateGlyphHash(GlyphHashPtr hash, GlyphHashSetPtr hashSet);
extern _X_EXPORT Bool
-ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global);
+ ResizeGlyphHash(GlyphHashPtr hash, CARD32 change, Bool global);
extern _X_EXPORT Bool
-ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change);
+ ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change);
-extern _X_EXPORT GlyphSetPtr
-AllocateGlyphSet (int fdepth, PictFormatPtr format);
+extern _X_EXPORT GlyphSetPtr AllocateGlyphSet(int fdepth, PictFormatPtr format);
extern _X_EXPORT int
-FreeGlyphSet (pointer value,
- XID gid);
-
-
+ FreeGlyphSet(pointer value, XID gid);
-#endif /* _GLYPHSTR_H_ */
+#endif /* _GLYPHSTR_H_ */
diff --git a/xorg-server/render/matrix.c b/xorg-server/render/matrix.c
index eccb90270..83cd66c43 100644
--- a/xorg-server/render/matrix.c
+++ b/xorg-server/render/matrix.c
@@ -40,8 +40,8 @@
#include "picturestr.h"
void
-PictTransform_from_xRenderTransform (PictTransformPtr pict,
- xRenderTransform *render)
+PictTransform_from_xRenderTransform(PictTransformPtr pict,
+ xRenderTransform * render)
{
pict->matrix[0][0] = render->matrix11;
pict->matrix[0][1] = render->matrix12;
@@ -57,8 +57,8 @@ PictTransform_from_xRenderTransform (PictTransformPtr pict,
}
void
-xRenderTransform_from_PictTransform (xRenderTransform *render,
- PictTransformPtr pict)
+xRenderTransform_from_PictTransform(xRenderTransform * render,
+ PictTransformPtr pict)
{
render->matrix11 = pict->matrix[0][0];
render->matrix12 = pict->matrix[0][1];
@@ -74,15 +74,13 @@ xRenderTransform_from_PictTransform (xRenderTransform *render,
}
Bool
-PictureTransformPoint (PictTransformPtr transform,
- PictVectorPtr vector)
+PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector)
{
- return pixman_transform_point(transform, vector);
+ return pixman_transform_point(transform, vector);
}
Bool
-PictureTransformPoint3d (PictTransformPtr transform,
- PictVectorPtr vector)
+PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector)
{
- return pixman_transform_point_3d(transform, vector);
+ return pixman_transform_point_3d(transform, vector);
}
diff --git a/xorg-server/render/miindex.c b/xorg-server/render/miindex.c
index 23c871ba1..0375e8f88 100644
--- a/xorg-server/render/miindex.c
+++ b/xorg-server/render/miindex.c
@@ -1,352 +1,332 @@
-/*
- *
- * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _MIINDEX_H_
-#define _MIINDEX_H_
-
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "picturestr.h"
-#include "mipict.h"
-#include "colormapst.h"
-
-#define NUM_CUBE_LEVELS 4
-#define NUM_GRAY_LEVELS 13
-
-static Bool
-miBuildRenderColormap (ColormapPtr pColormap, Pixel *pixels, int *nump)
-{
- int r, g, b;
- unsigned short red, green, blue;
- Pixel pixel;
- Bool used[MI_MAX_INDEXED];
- int needed;
- int policy;
- int cube, gray;
- int i, n;
-
- if (pColormap->mid != pColormap->pScreen->defColormap)
- {
- policy = PictureCmapPolicyAll;
- }
- else
- {
- int avail = pColormap->pVisual->ColormapEntries;
- policy = PictureCmapPolicy;
- if (policy == PictureCmapPolicyDefault)
- {
- if (avail >= 256 && (pColormap->pVisual->class|DynamicClass) == PseudoColor)
- policy = PictureCmapPolicyColor;
- else if (avail >= 64)
- policy = PictureCmapPolicyGray;
- else
- policy = PictureCmapPolicyMono;
- }
- }
- /*
- * Make sure enough cells are free for the chosen policy
- */
- for (;;)
- {
- switch (policy) {
- case PictureCmapPolicyAll:
- needed = 0;
- break;
- case PictureCmapPolicyColor:
- needed = 71;
- break;
- case PictureCmapPolicyGray:
- needed = 11;
- break;
- case PictureCmapPolicyMono:
- default:
- needed = 0;
- break;
- }
- if (needed <= pColormap->freeRed)
- break;
- policy--;
- }
-
- /*
- * Compute size of cube and gray ramps
- */
- cube = gray = 0;
- switch (policy) {
- case PictureCmapPolicyAll:
- /*
- * Allocate as big a cube as possible
- */
- if ((pColormap->pVisual->class|DynamicClass) == PseudoColor)
- {
- for (cube = 1; cube * cube * cube < pColormap->pVisual->ColormapEntries; cube++)
- ;
- cube--;
- if (cube == 1)
- cube = 0;
- }
- else
- cube = 0;
- /*
- * Figure out how many gray levels to use so that they
- * line up neatly with the cube
- */
- if (cube)
- {
- needed = pColormap->pVisual->ColormapEntries - (cube*cube*cube);
- /* levels to fill in with */
- gray = needed / (cube - 1);
- /* total levels */
- gray = (gray + 1) * (cube - 1) + 1;
- }
- else
- gray = pColormap->pVisual->ColormapEntries;
- break;
-
- case PictureCmapPolicyColor:
- cube = NUM_CUBE_LEVELS;
- /* fall through ... */
- case PictureCmapPolicyGray:
- gray = NUM_GRAY_LEVELS;
- break;
- case PictureCmapPolicyMono:
- default:
- gray = 2;
- break;
- }
-
- memset (used, '\0', pColormap->pVisual->ColormapEntries * sizeof (Bool));
- for (r = 0; r < cube; r++)
- for (g = 0; g < cube; g++)
- for (b = 0; b < cube; b++)
- {
- pixel = 0;
- red = (r * 65535 + (cube-1)/2) / (cube - 1);
- green = (g * 65535 + (cube-1)/2) / (cube - 1);
- blue = (b * 65535 + (cube-1)/2) / (cube - 1);
- if (AllocColor (pColormap, &red, &green,
- &blue, &pixel, 0) != Success)
- return FALSE;
- used[pixel] = TRUE;
- }
- for (g = 0; g < gray; g++)
- {
- pixel = 0;
- red = green = blue = (g * 65535 + (gray-1)/2) / (gray - 1);
- if (AllocColor (pColormap, &red, &green, &blue, &pixel, 0) != Success)
- return FALSE;
- used[pixel] = TRUE;
- }
- n = 0;
- for (i = 0; i < pColormap->pVisual->ColormapEntries; i++)
- if (used[i])
- pixels[n++] = i;
-
- *nump = n;
-
- return TRUE;
-}
-
-/* 0 <= red, green, blue < 32 */
-static Pixel
-FindBestColor (miIndexedPtr pIndexed, Pixel *pixels, int num,
- int red, int green, int blue)
-{
- Pixel best = pixels[0];
- int bestDist = 1 << 30;
- int dist;
- int dr, dg, db;
- while (num--)
- {
- Pixel pixel = *pixels++;
- CARD32 v = pIndexed->rgba[pixel];
-
- dr = ((v >> 19) & 0x1f);
- dg = ((v >> 11) & 0x1f);
- db = ((v >> 3) & 0x1f);
- dr = dr - red;
- dg = dg - green;
- db = db - blue;
- dist = dr * dr + dg * dg + db * db;
- if (dist < bestDist)
- {
- bestDist = dist;
- best = pixel;
- }
- }
- return best;
-}
-
-/* 0 <= gray < 32768 */
-static Pixel
-FindBestGray (miIndexedPtr pIndexed, Pixel *pixels, int num, int gray)
-{
- Pixel best = pixels[0];
- int bestDist = 1 << 30;
- int dist;
- int dr;
- int r;
-
- while (num--)
- {
- Pixel pixel = *pixels++;
- CARD32 v = pIndexed->rgba[pixel];
-
- r = v & 0xff;
- r = r | (r << 8);
- dr = gray - (r >> 1);
- dist = dr * dr;
- if (dist < bestDist)
- {
- bestDist = dist;
- best = pixel;
- }
- }
- return best;
-}
-
-Bool
-miInitIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat)
-{
- ColormapPtr pColormap = pFormat->index.pColormap;
- VisualPtr pVisual = pColormap->pVisual;
- miIndexedPtr pIndexed;
- Pixel pixels[MI_MAX_INDEXED];
- xrgb rgb[MI_MAX_INDEXED];
- int num;
- int i;
- Pixel p, r, g, b;
-
- if (pVisual->ColormapEntries > MI_MAX_INDEXED)
- return FALSE;
-
- if (pVisual->class & DynamicClass)
- {
- if (!miBuildRenderColormap (pColormap, pixels, &num))
- return FALSE;
- }
- else
- {
- num = pVisual->ColormapEntries;
- for (p = 0; p < num; p++)
- pixels[p] = p;
- }
-
- pIndexed = malloc(sizeof (miIndexedRec));
- if (!pIndexed)
- return FALSE;
-
- pFormat->index.nvalues = num;
- pFormat->index.pValues = malloc(num * sizeof (xIndexValue));
- if (!pFormat->index.pValues)
- {
- free(pIndexed);
- return FALSE;
- }
-
-
- /*
- * Build mapping from pixel value to ARGB
- */
- QueryColors (pColormap, num, pixels, rgb, serverClient);
- for (i = 0; i < num; i++)
- {
- p = pixels[i];
- pFormat->index.pValues[i].pixel = p;
- pFormat->index.pValues[i].red = rgb[i].red;
- pFormat->index.pValues[i].green = rgb[i].green;
- pFormat->index.pValues[i].blue = rgb[i].blue;
- pFormat->index.pValues[i].alpha = 0xffff;
- pIndexed->rgba[p] = (0xff000000 |
- ((rgb[i].red & 0xff00) << 8) |
- ((rgb[i].green & 0xff00) ) |
- ((rgb[i].blue & 0xff00) >> 8));
- }
-
- /*
- * Build mapping from RGB to pixel value. This could probably be
- * done a bit quicker...
- */
- switch (pVisual->class | DynamicClass) {
- case GrayScale:
- pIndexed->color = FALSE;
- for (r = 0; r < 32768; r++)
- pIndexed->ent[r] = FindBestGray (pIndexed, pixels, num, r);
- break;
- case PseudoColor:
- pIndexed->color = TRUE;
- p = 0;
- for (r = 0; r < 32; r++)
- for (g = 0; g < 32; g++)
- for (b = 0; b < 32; b++)
- {
- pIndexed->ent[p] = FindBestColor (pIndexed, pixels, num,
- r, g, b);
- p++;
- }
- break;
- }
- pFormat->index.devPrivate = pIndexed;
- return TRUE;
-}
-
-void
-miCloseIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat)
-{
- free(pFormat->index.devPrivate);
- pFormat->index.devPrivate = NULL;
- free(pFormat->index.pValues);
- pFormat->index.pValues = NULL;
-}
-
-void
-miUpdateIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat,
- int ndef,
- xColorItem *pdef)
-{
- miIndexedPtr pIndexed = pFormat->index.devPrivate;
-
- if (pIndexed)
- {
- while (ndef--)
- {
- pIndexed->rgba[pdef->pixel] = (0xff000000 |
- ((pdef->red & 0xff00) << 8) |
- ((pdef->green & 0xff00) ) |
- ((pdef->blue & 0xff00) >> 8));
- pdef++;
- }
- }
-}
-
-#endif /* _MIINDEX_H_ */
+/*
+ *
+ * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _MIINDEX_H_
+#define _MIINDEX_H_
+
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "picturestr.h"
+#include "mipict.h"
+#include "colormapst.h"
+
+#define NUM_CUBE_LEVELS 4
+#define NUM_GRAY_LEVELS 13
+
+static Bool
+miBuildRenderColormap(ColormapPtr pColormap, Pixel * pixels, int *nump)
+{
+ int r, g, b;
+ unsigned short red, green, blue;
+ Pixel pixel;
+ Bool used[MI_MAX_INDEXED];
+ int needed;
+ int policy;
+ int cube, gray;
+ int i, n;
+
+ if (pColormap->mid != pColormap->pScreen->defColormap) {
+ policy = PictureCmapPolicyAll;
+ }
+ else {
+ int avail = pColormap->pVisual->ColormapEntries;
+
+ policy = PictureCmapPolicy;
+ if (policy == PictureCmapPolicyDefault) {
+ if (avail >= 256 &&
+ (pColormap->pVisual->class | DynamicClass) == PseudoColor)
+ policy = PictureCmapPolicyColor;
+ else if (avail >= 64)
+ policy = PictureCmapPolicyGray;
+ else
+ policy = PictureCmapPolicyMono;
+ }
+ }
+ /*
+ * Make sure enough cells are free for the chosen policy
+ */
+ for (;;) {
+ switch (policy) {
+ case PictureCmapPolicyAll:
+ needed = 0;
+ break;
+ case PictureCmapPolicyColor:
+ needed = 71;
+ break;
+ case PictureCmapPolicyGray:
+ needed = 11;
+ break;
+ case PictureCmapPolicyMono:
+ default:
+ needed = 0;
+ break;
+ }
+ if (needed <= pColormap->freeRed)
+ break;
+ policy--;
+ }
+
+ /*
+ * Compute size of cube and gray ramps
+ */
+ cube = gray = 0;
+ switch (policy) {
+ case PictureCmapPolicyAll:
+ /*
+ * Allocate as big a cube as possible
+ */
+ if ((pColormap->pVisual->class | DynamicClass) == PseudoColor) {
+ for (cube = 1;
+ cube * cube * cube < pColormap->pVisual->ColormapEntries;
+ cube++);
+ cube--;
+ if (cube == 1)
+ cube = 0;
+ }
+ else
+ cube = 0;
+ /*
+ * Figure out how many gray levels to use so that they
+ * line up neatly with the cube
+ */
+ if (cube) {
+ needed = pColormap->pVisual->ColormapEntries - (cube * cube * cube);
+ /* levels to fill in with */
+ gray = needed / (cube - 1);
+ /* total levels */
+ gray = (gray + 1) * (cube - 1) + 1;
+ }
+ else
+ gray = pColormap->pVisual->ColormapEntries;
+ break;
+
+ case PictureCmapPolicyColor:
+ cube = NUM_CUBE_LEVELS;
+ /* fall through ... */
+ case PictureCmapPolicyGray:
+ gray = NUM_GRAY_LEVELS;
+ break;
+ case PictureCmapPolicyMono:
+ default:
+ gray = 2;
+ break;
+ }
+
+ memset(used, '\0', pColormap->pVisual->ColormapEntries * sizeof(Bool));
+ for (r = 0; r < cube; r++)
+ for (g = 0; g < cube; g++)
+ for (b = 0; b < cube; b++) {
+ pixel = 0;
+ red = (r * 65535 + (cube - 1) / 2) / (cube - 1);
+ green = (g * 65535 + (cube - 1) / 2) / (cube - 1);
+ blue = (b * 65535 + (cube - 1) / 2) / (cube - 1);
+ if (AllocColor(pColormap, &red, &green,
+ &blue, &pixel, 0) != Success)
+ return FALSE;
+ used[pixel] = TRUE;
+ }
+ for (g = 0; g < gray; g++) {
+ pixel = 0;
+ red = green = blue = (g * 65535 + (gray - 1) / 2) / (gray - 1);
+ if (AllocColor(pColormap, &red, &green, &blue, &pixel, 0) != Success)
+ return FALSE;
+ used[pixel] = TRUE;
+ }
+ n = 0;
+ for (i = 0; i < pColormap->pVisual->ColormapEntries; i++)
+ if (used[i])
+ pixels[n++] = i;
+
+ *nump = n;
+
+ return TRUE;
+}
+
+/* 0 <= red, green, blue < 32 */
+static Pixel
+FindBestColor(miIndexedPtr pIndexed, Pixel * pixels, int num,
+ int red, int green, int blue)
+{
+ Pixel best = pixels[0];
+ int bestDist = 1 << 30;
+ int dist;
+ int dr, dg, db;
+
+ while (num--) {
+ Pixel pixel = *pixels++;
+ CARD32 v = pIndexed->rgba[pixel];
+
+ dr = ((v >> 19) & 0x1f);
+ dg = ((v >> 11) & 0x1f);
+ db = ((v >> 3) & 0x1f);
+ dr = dr - red;
+ dg = dg - green;
+ db = db - blue;
+ dist = dr * dr + dg * dg + db * db;
+ if (dist < bestDist) {
+ bestDist = dist;
+ best = pixel;
+ }
+ }
+ return best;
+}
+
+/* 0 <= gray < 32768 */
+static Pixel
+FindBestGray(miIndexedPtr pIndexed, Pixel * pixels, int num, int gray)
+{
+ Pixel best = pixels[0];
+ int bestDist = 1 << 30;
+ int dist;
+ int dr;
+ int r;
+
+ while (num--) {
+ Pixel pixel = *pixels++;
+ CARD32 v = pIndexed->rgba[pixel];
+
+ r = v & 0xff;
+ r = r | (r << 8);
+ dr = gray - (r >> 1);
+ dist = dr * dr;
+ if (dist < bestDist) {
+ bestDist = dist;
+ best = pixel;
+ }
+ }
+ return best;
+}
+
+Bool
+miInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
+{
+ ColormapPtr pColormap = pFormat->index.pColormap;
+ VisualPtr pVisual = pColormap->pVisual;
+ miIndexedPtr pIndexed;
+ Pixel pixels[MI_MAX_INDEXED];
+ xrgb rgb[MI_MAX_INDEXED];
+ int num;
+ int i;
+ Pixel p, r, g, b;
+
+ if (pVisual->ColormapEntries > MI_MAX_INDEXED)
+ return FALSE;
+
+ if (pVisual->class & DynamicClass) {
+ if (!miBuildRenderColormap(pColormap, pixels, &num))
+ return FALSE;
+ }
+ else {
+ num = pVisual->ColormapEntries;
+ for (p = 0; p < num; p++)
+ pixels[p] = p;
+ }
+
+ pIndexed = malloc(sizeof(miIndexedRec));
+ if (!pIndexed)
+ return FALSE;
+
+ pFormat->index.nvalues = num;
+ pFormat->index.pValues = malloc(num * sizeof(xIndexValue));
+ if (!pFormat->index.pValues) {
+ free(pIndexed);
+ return FALSE;
+ }
+
+ /*
+ * Build mapping from pixel value to ARGB
+ */
+ QueryColors(pColormap, num, pixels, rgb, serverClient);
+ for (i = 0; i < num; i++) {
+ p = pixels[i];
+ pFormat->index.pValues[i].pixel = p;
+ pFormat->index.pValues[i].red = rgb[i].red;
+ pFormat->index.pValues[i].green = rgb[i].green;
+ pFormat->index.pValues[i].blue = rgb[i].blue;
+ pFormat->index.pValues[i].alpha = 0xffff;
+ pIndexed->rgba[p] = (0xff000000 |
+ ((rgb[i].red & 0xff00) << 8) |
+ ((rgb[i].green & 0xff00)) |
+ ((rgb[i].blue & 0xff00) >> 8));
+ }
+
+ /*
+ * Build mapping from RGB to pixel value. This could probably be
+ * done a bit quicker...
+ */
+ switch (pVisual->class | DynamicClass) {
+ case GrayScale:
+ pIndexed->color = FALSE;
+ for (r = 0; r < 32768; r++)
+ pIndexed->ent[r] = FindBestGray(pIndexed, pixels, num, r);
+ break;
+ case PseudoColor:
+ pIndexed->color = TRUE;
+ p = 0;
+ for (r = 0; r < 32; r++)
+ for (g = 0; g < 32; g++)
+ for (b = 0; b < 32; b++) {
+ pIndexed->ent[p] = FindBestColor(pIndexed, pixels, num,
+ r, g, b);
+ p++;
+ }
+ break;
+ }
+ pFormat->index.devPrivate = pIndexed;
+ return TRUE;
+}
+
+void
+miCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
+{
+ free(pFormat->index.devPrivate);
+ pFormat->index.devPrivate = NULL;
+ free(pFormat->index.pValues);
+ pFormat->index.pValues = NULL;
+}
+
+void
+miUpdateIndexed(ScreenPtr pScreen,
+ PictFormatPtr pFormat, int ndef, xColorItem * pdef)
+{
+ miIndexedPtr pIndexed = pFormat->index.devPrivate;
+
+ if (pIndexed) {
+ while (ndef--) {
+ pIndexed->rgba[pdef->pixel] = (0xff000000 |
+ ((pdef->red & 0xff00) << 8) |
+ ((pdef->green & 0xff00)) |
+ ((pdef->blue & 0xff00) >> 8));
+ pdef++;
+ }
+ }
+}
+
+#endif /* _MIINDEX_H_ */
diff --git a/xorg-server/render/mipict.c b/xorg-server/render/mipict.c
index caa76e396..421df5aa8 100644
--- a/xorg-server/render/mipict.c
+++ b/xorg-server/render/mipict.c
@@ -34,76 +34,72 @@
#include "mipict.h"
int
-miCreatePicture (PicturePtr pPicture)
+miCreatePicture(PicturePtr pPicture)
{
return Success;
}
void
-miDestroyPicture (PicturePtr pPicture)
+miDestroyPicture(PicturePtr pPicture)
{
if (pPicture->freeCompClip)
- RegionDestroy(pPicture->pCompositeClip);
+ RegionDestroy(pPicture->pCompositeClip);
}
void
-miDestroyPictureClip (PicturePtr pPicture)
+miDestroyPictureClip(PicturePtr pPicture)
{
switch (pPicture->clientClipType) {
case CT_NONE:
- return;
+ return;
case CT_PIXMAP:
- (*pPicture->pDrawable->pScreen->DestroyPixmap) ((PixmapPtr) (pPicture->clientClip));
- break;
+ (*pPicture->pDrawable->pScreen->
+ DestroyPixmap) ((PixmapPtr) (pPicture->clientClip));
+ break;
default:
- /*
- * we know we'll never have a list of rectangles, since ChangeClip
- * immediately turns them into a region
- */
- RegionDestroy(pPicture->clientClip);
- break;
+ /*
+ * we know we'll never have a list of rectangles, since ChangeClip
+ * immediately turns them into a region
+ */
+ RegionDestroy(pPicture->clientClip);
+ break;
}
pPicture->clientClip = NULL;
pPicture->clientClipType = CT_NONE;
-}
+}
int
-miChangePictureClip (PicturePtr pPicture,
- int type,
- pointer value,
- int n)
+miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n)
{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- pointer clientClip;
- int clientClipType;
-
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ pointer clientClip;
+ int clientClipType;
+
switch (type) {
case CT_PIXMAP:
- /* convert the pixmap to a region */
- clientClip = (pointer) BitmapToRegion(pScreen, (PixmapPtr) value);
- if (!clientClip)
- return BadAlloc;
- clientClipType = CT_REGION;
- (*pScreen->DestroyPixmap) ((PixmapPtr) value);
- break;
+ /* convert the pixmap to a region */
+ clientClip = (pointer) BitmapToRegion(pScreen, (PixmapPtr) value);
+ if (!clientClip)
+ return BadAlloc;
+ clientClipType = CT_REGION;
+ (*pScreen->DestroyPixmap) ((PixmapPtr) value);
+ break;
case CT_REGION:
- clientClip = value;
- clientClipType = CT_REGION;
- break;
+ clientClip = value;
+ clientClipType = CT_REGION;
+ break;
case CT_NONE:
- clientClip = 0;
- clientClipType = CT_NONE;
- break;
+ clientClip = 0;
+ clientClipType = CT_NONE;
+ break;
default:
- clientClip = (pointer) RegionFromRects(n,
- (xRectangle *) value,
- type);
- if (!clientClip)
- return BadAlloc;
- clientClipType = CT_REGION;
- free(value);
- break;
+ clientClip = (pointer) RegionFromRects(n, (xRectangle *) value, type);
+ if (!clientClip)
+ return BadAlloc;
+ clientClipType = CT_REGION;
+ free(value);
+ break;
}
(*ps->DestroyPictureClip) (pPicture);
pPicture->clientClip = clientClip;
@@ -113,149 +109,137 @@ miChangePictureClip (PicturePtr pPicture,
}
void
-miChangePicture (PicturePtr pPicture,
- Mask mask)
+miChangePicture(PicturePtr pPicture, Mask mask)
{
return;
}
void
-miValidatePicture (PicturePtr pPicture,
- Mask mask)
+miValidatePicture(PicturePtr pPicture, Mask mask)
{
- DrawablePtr pDrawable = pPicture->pDrawable;
-
- if ((mask & (CPClipXOrigin|CPClipYOrigin|CPClipMask|CPSubwindowMode)) ||
- (pDrawable->serialNumber != (pPicture->serialNumber & DRAWABLE_SERIAL_BITS)))
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- WindowPtr pWin = (WindowPtr) pDrawable;
- RegionPtr pregWin;
- Bool freeTmpClip, freeCompClip;
-
- if (pPicture->subWindowMode == IncludeInferiors)
- {
- pregWin = NotClippedByChildren(pWin);
- freeTmpClip = TRUE;
- }
- else
- {
- pregWin = &pWin->clipList;
- freeTmpClip = FALSE;
- }
- freeCompClip = pPicture->freeCompClip;
-
- /*
- * if there is no client clip, we can get by with just keeping the
- * pointer we got, and remembering whether or not should destroy
- * (or maybe re-use) it later. this way, we avoid unnecessary
- * copying of regions. (this wins especially if many clients clip
- * by children and have no client clip.)
- */
- if (pPicture->clientClipType == CT_NONE)
- {
- if (freeCompClip)
- RegionDestroy(pPicture->pCompositeClip);
- pPicture->pCompositeClip = pregWin;
- pPicture->freeCompClip = freeTmpClip;
- }
- else
- {
- /*
- * we need one 'real' region to put into the composite clip. if
- * pregWin the current composite clip are real, we can get rid of
- * one. if pregWin is real and the current composite clip isn't,
- * use pregWin for the composite clip. if the current composite
- * clip is real and pregWin isn't, use the current composite
- * clip. if neither is real, create a new region.
- */
-
- RegionTranslate(pPicture->clientClip,
- pDrawable->x + pPicture->clipOrigin.x,
- pDrawable->y + pPicture->clipOrigin.y);
-
- if (freeCompClip)
- {
- RegionIntersect(pPicture->pCompositeClip,
- pregWin, pPicture->clientClip);
- if (freeTmpClip)
- RegionDestroy(pregWin);
- }
- else if (freeTmpClip)
- {
- RegionIntersect(pregWin, pregWin, pPicture->clientClip);
- pPicture->pCompositeClip = pregWin;
- }
- else
- {
- pPicture->pCompositeClip = RegionCreate(NullBox, 0);
- RegionIntersect(pPicture->pCompositeClip,
- pregWin, pPicture->clientClip);
- }
- pPicture->freeCompClip = TRUE;
- RegionTranslate(pPicture->clientClip,
- -(pDrawable->x + pPicture->clipOrigin.x),
- -(pDrawable->y + pPicture->clipOrigin.y));
- }
- } /* end of composite clip for a window */
- else
- {
- BoxRec pixbounds;
-
- /* XXX should we translate by drawable.x/y here ? */
- /* If you want pixmaps in offscreen memory, yes */
- pixbounds.x1 = pDrawable->x;
- pixbounds.y1 = pDrawable->y;
- pixbounds.x2 = pDrawable->x + pDrawable->width;
- pixbounds.y2 = pDrawable->y + pDrawable->height;
-
- if (pPicture->freeCompClip)
- {
- RegionReset(pPicture->pCompositeClip, &pixbounds);
- }
- else
- {
- pPicture->freeCompClip = TRUE;
- pPicture->pCompositeClip = RegionCreate(&pixbounds, 1);
- }
-
- if (pPicture->clientClipType == CT_REGION)
- {
- if(pDrawable->x || pDrawable->y) {
- RegionTranslate(pPicture->clientClip,
- pDrawable->x + pPicture->clipOrigin.x,
- pDrawable->y + pPicture->clipOrigin.y);
- RegionIntersect(pPicture->pCompositeClip,
- pPicture->pCompositeClip, pPicture->clientClip);
- RegionTranslate(pPicture->clientClip,
- -(pDrawable->x + pPicture->clipOrigin.x),
- -(pDrawable->y + pPicture->clipOrigin.y));
- } else {
- RegionTranslate(pPicture->pCompositeClip,
- -pPicture->clipOrigin.x, -pPicture->clipOrigin.y);
- RegionIntersect(pPicture->pCompositeClip,
- pPicture->pCompositeClip, pPicture->clientClip);
- RegionTranslate(pPicture->pCompositeClip,
- pPicture->clipOrigin.x, pPicture->clipOrigin.y);
- }
- }
- } /* end of composite clip for pixmap */
+ DrawablePtr pDrawable = pPicture->pDrawable;
+
+ if ((mask & (CPClipXOrigin | CPClipYOrigin | CPClipMask | CPSubwindowMode))
+ || (pDrawable->serialNumber !=
+ (pPicture->serialNumber & DRAWABLE_SERIAL_BITS))) {
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDrawable;
+ RegionPtr pregWin;
+ Bool freeTmpClip, freeCompClip;
+
+ if (pPicture->subWindowMode == IncludeInferiors) {
+ pregWin = NotClippedByChildren(pWin);
+ freeTmpClip = TRUE;
+ }
+ else {
+ pregWin = &pWin->clipList;
+ freeTmpClip = FALSE;
+ }
+ freeCompClip = pPicture->freeCompClip;
+
+ /*
+ * if there is no client clip, we can get by with just keeping the
+ * pointer we got, and remembering whether or not should destroy
+ * (or maybe re-use) it later. this way, we avoid unnecessary
+ * copying of regions. (this wins especially if many clients clip
+ * by children and have no client clip.)
+ */
+ if (pPicture->clientClipType == CT_NONE) {
+ if (freeCompClip)
+ RegionDestroy(pPicture->pCompositeClip);
+ pPicture->pCompositeClip = pregWin;
+ pPicture->freeCompClip = freeTmpClip;
+ }
+ else {
+ /*
+ * we need one 'real' region to put into the composite clip. if
+ * pregWin the current composite clip are real, we can get rid of
+ * one. if pregWin is real and the current composite clip isn't,
+ * use pregWin for the composite clip. if the current composite
+ * clip is real and pregWin isn't, use the current composite
+ * clip. if neither is real, create a new region.
+ */
+
+ RegionTranslate(pPicture->clientClip,
+ pDrawable->x + pPicture->clipOrigin.x,
+ pDrawable->y + pPicture->clipOrigin.y);
+
+ if (freeCompClip) {
+ RegionIntersect(pPicture->pCompositeClip,
+ pregWin, pPicture->clientClip);
+ if (freeTmpClip)
+ RegionDestroy(pregWin);
+ }
+ else if (freeTmpClip) {
+ RegionIntersect(pregWin, pregWin, pPicture->clientClip);
+ pPicture->pCompositeClip = pregWin;
+ }
+ else {
+ pPicture->pCompositeClip = RegionCreate(NullBox, 0);
+ RegionIntersect(pPicture->pCompositeClip,
+ pregWin, pPicture->clientClip);
+ }
+ pPicture->freeCompClip = TRUE;
+ RegionTranslate(pPicture->clientClip,
+ -(pDrawable->x + pPicture->clipOrigin.x),
+ -(pDrawable->y + pPicture->clipOrigin.y));
+ }
+ } /* end of composite clip for a window */
+ else {
+ BoxRec pixbounds;
+
+ /* XXX should we translate by drawable.x/y here ? */
+ /* If you want pixmaps in offscreen memory, yes */
+ pixbounds.x1 = pDrawable->x;
+ pixbounds.y1 = pDrawable->y;
+ pixbounds.x2 = pDrawable->x + pDrawable->width;
+ pixbounds.y2 = pDrawable->y + pDrawable->height;
+
+ if (pPicture->freeCompClip) {
+ RegionReset(pPicture->pCompositeClip, &pixbounds);
+ }
+ else {
+ pPicture->freeCompClip = TRUE;
+ pPicture->pCompositeClip = RegionCreate(&pixbounds, 1);
+ }
+
+ if (pPicture->clientClipType == CT_REGION) {
+ if (pDrawable->x || pDrawable->y) {
+ RegionTranslate(pPicture->clientClip,
+ pDrawable->x + pPicture->clipOrigin.x,
+ pDrawable->y + pPicture->clipOrigin.y);
+ RegionIntersect(pPicture->pCompositeClip,
+ pPicture->pCompositeClip,
+ pPicture->clientClip);
+ RegionTranslate(pPicture->clientClip,
+ -(pDrawable->x + pPicture->clipOrigin.x),
+ -(pDrawable->y + pPicture->clipOrigin.y));
+ }
+ else {
+ RegionTranslate(pPicture->pCompositeClip,
+ -pPicture->clipOrigin.x,
+ -pPicture->clipOrigin.y);
+ RegionIntersect(pPicture->pCompositeClip,
+ pPicture->pCompositeClip,
+ pPicture->clientClip);
+ RegionTranslate(pPicture->pCompositeClip,
+ pPicture->clipOrigin.x,
+ pPicture->clipOrigin.y);
+ }
+ }
+ } /* end of composite clip for pixmap */
}
}
int
-miChangePictureTransform (PicturePtr pPicture,
- PictTransform *transform)
+miChangePictureTransform(PicturePtr pPicture, PictTransform * transform)
{
return Success;
}
int
-miChangePictureFilter (PicturePtr pPicture,
- int filter,
- xFixed *params,
- int nparams)
+miChangePictureFilter(PicturePtr pPicture,
+ int filter, xFixed * params, int nparams)
{
return Success;
}
@@ -263,96 +247,85 @@ miChangePictureFilter (PicturePtr pPicture,
#define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v))
static __inline pixman_bool_t
-miClipPictureReg (pixman_region16_t * pRegion,
- pixman_region16_t * pClip,
- int dx,
- int dy)
+miClipPictureReg(pixman_region16_t * pRegion,
+ pixman_region16_t * pClip, int dx, int dy)
{
if (pixman_region_n_rects(pRegion) == 1 &&
- pixman_region_n_rects(pClip) == 1)
- {
- pixman_box16_t * pRbox = pixman_region_rectangles(pRegion, NULL);
- pixman_box16_t * pCbox = pixman_region_rectangles(pClip, NULL);
- int v;
-
- if (pRbox->x1 < (v = pCbox->x1 + dx))
- pRbox->x1 = BOUND(v);
- if (pRbox->x2 > (v = pCbox->x2 + dx))
- pRbox->x2 = BOUND(v);
- if (pRbox->y1 < (v = pCbox->y1 + dy))
- pRbox->y1 = BOUND(v);
- if (pRbox->y2 > (v = pCbox->y2 + dy))
- pRbox->y2 = BOUND(v);
- if (pRbox->x1 >= pRbox->x2 ||
- pRbox->y1 >= pRbox->y2)
- {
- pixman_region_init (pRegion);
- }
+ pixman_region_n_rects(pClip) == 1) {
+ pixman_box16_t *pRbox = pixman_region_rectangles(pRegion, NULL);
+ pixman_box16_t *pCbox = pixman_region_rectangles(pClip, NULL);
+ int v;
+
+ if (pRbox->x1 < (v = pCbox->x1 + dx))
+ pRbox->x1 = BOUND(v);
+ if (pRbox->x2 > (v = pCbox->x2 + dx))
+ pRbox->x2 = BOUND(v);
+ if (pRbox->y1 < (v = pCbox->y1 + dy))
+ pRbox->y1 = BOUND(v);
+ if (pRbox->y2 > (v = pCbox->y2 + dy))
+ pRbox->y2 = BOUND(v);
+ if (pRbox->x1 >= pRbox->x2 || pRbox->y1 >= pRbox->y2) {
+ pixman_region_init(pRegion);
+ }
}
- else if (!pixman_region_not_empty (pClip))
- return FALSE;
- else
- {
- if (dx || dy)
- pixman_region_translate (pRegion, -dx, -dy);
- if (!pixman_region_intersect (pRegion, pRegion, pClip))
- return FALSE;
- if (dx || dy)
- pixman_region_translate(pRegion, dx, dy);
+ else if (!pixman_region_not_empty(pClip))
+ return FALSE;
+ else {
+ if (dx || dy)
+ pixman_region_translate(pRegion, -dx, -dy);
+ if (!pixman_region_intersect(pRegion, pRegion, pClip))
+ return FALSE;
+ if (dx || dy)
+ pixman_region_translate(pRegion, dx, dy);
}
return pixman_region_not_empty(pRegion);
}
static inline Bool
-miClipPictureSrc (RegionPtr pRegion,
- PicturePtr pPicture,
- int dx,
- int dy)
+miClipPictureSrc(RegionPtr pRegion, PicturePtr pPicture, int dx, int dy)
{
- if (pPicture->clientClipType != CT_NONE)
- {
- Bool result;
-
- pixman_region_translate ( pPicture->clientClip,
- pPicture->clipOrigin.x + dx,
- pPicture->clipOrigin.y + dy);
-
- result = RegionIntersect(pRegion, pRegion, pPicture->clientClip);
-
- pixman_region_translate ( pPicture->clientClip,
- - (pPicture->clipOrigin.x + dx),
- - (pPicture->clipOrigin.y + dy));
-
- if (!result)
- return FALSE;
+ if (pPicture->clientClipType != CT_NONE) {
+ Bool result;
+
+ pixman_region_translate(pPicture->clientClip,
+ pPicture->clipOrigin.x + dx,
+ pPicture->clipOrigin.y + dy);
+
+ result = RegionIntersect(pRegion, pRegion, pPicture->clientClip);
+
+ pixman_region_translate(pPicture->clientClip,
+ -(pPicture->clipOrigin.x + dx),
+ -(pPicture->clipOrigin.y + dy));
+
+ if (!result)
+ return FALSE;
}
return TRUE;
}
static void
-SourceValidateOnePicture (PicturePtr pPicture)
+SourceValidateOnePicture(PicturePtr pPicture)
{
- DrawablePtr pDrawable = pPicture->pDrawable;
- ScreenPtr pScreen;
+ DrawablePtr pDrawable = pPicture->pDrawable;
+ ScreenPtr pScreen;
if (!pDrawable)
return;
pScreen = pDrawable->pScreen;
- if (pScreen->SourceValidate)
- {
- pScreen->SourceValidate (
- pDrawable, 0, 0, pDrawable->width, pDrawable->height, pPicture->subWindowMode);
+ if (pScreen->SourceValidate) {
+ pScreen->SourceValidate(pDrawable, 0, 0, pDrawable->width,
+ pDrawable->height, pPicture->subWindowMode);
}
}
void
-miCompositeSourceValidate (PicturePtr pPicture)
+miCompositeSourceValidate(PicturePtr pPicture)
{
- SourceValidateOnePicture (pPicture);
+ SourceValidateOnePicture(pPicture);
if (pPicture->alphaMap)
- SourceValidateOnePicture (pPicture->alphaMap);
+ SourceValidateOnePicture(pPicture->alphaMap);
}
/*
@@ -361,21 +334,18 @@ miCompositeSourceValidate (PicturePtr pPicture)
*/
Bool
-miComputeCompositeRegion (RegionPtr pRegion,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+miComputeCompositeRegion(RegionPtr pRegion,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
-
- int v;
+
+ int v;
pRegion->extents.x1 = xDst;
v = xDst + width;
@@ -386,254 +356,226 @@ miComputeCompositeRegion (RegionPtr pRegion,
pRegion->data = 0;
/* Check for empty operation */
if (pRegion->extents.x1 >= pRegion->extents.x2 ||
- pRegion->extents.y1 >= pRegion->extents.y2)
- {
- pixman_region_init (pRegion);
- return FALSE;
+ pRegion->extents.y1 >= pRegion->extents.y2) {
+ pixman_region_init(pRegion);
+ return FALSE;
}
/* clip against dst */
- if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0))
- {
- pixman_region_fini (pRegion);
- return FALSE;
+ if (!miClipPictureReg(pRegion, pDst->pCompositeClip, 0, 0)) {
+ pixman_region_fini(pRegion);
+ return FALSE;
}
- if (pDst->alphaMap)
- {
- if (!miClipPictureReg (pRegion, pDst->alphaMap->pCompositeClip,
- -pDst->alphaOrigin.x,
- -pDst->alphaOrigin.y))
- {
- pixman_region_fini (pRegion);
- return FALSE;
- }
+ if (pDst->alphaMap) {
+ if (!miClipPictureReg(pRegion, pDst->alphaMap->pCompositeClip,
+ -pDst->alphaOrigin.x, -pDst->alphaOrigin.y)) {
+ pixman_region_fini(pRegion);
+ return FALSE;
+ }
}
/* clip against src */
- if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
- {
- pixman_region_fini (pRegion);
- return FALSE;
+ if (!miClipPictureSrc(pRegion, pSrc, xDst - xSrc, yDst - ySrc)) {
+ pixman_region_fini(pRegion);
+ return FALSE;
}
- if (pSrc->alphaMap)
- {
- if (!miClipPictureSrc (pRegion, pSrc->alphaMap,
- xDst - (xSrc - pSrc->alphaOrigin.x),
- yDst - (ySrc - pSrc->alphaOrigin.y)))
- {
- pixman_region_fini (pRegion);
- return FALSE;
- }
+ if (pSrc->alphaMap) {
+ if (!miClipPictureSrc(pRegion, pSrc->alphaMap,
+ xDst - (xSrc - pSrc->alphaOrigin.x),
+ yDst - (ySrc - pSrc->alphaOrigin.y))) {
+ pixman_region_fini(pRegion);
+ return FALSE;
+ }
}
/* clip against mask */
- if (pMask)
- {
- if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
- {
- pixman_region_fini (pRegion);
- return FALSE;
- }
- if (pMask->alphaMap)
- {
- if (!miClipPictureSrc (pRegion, pMask->alphaMap,
- xDst - (xMask - pMask->alphaOrigin.x),
- yDst - (yMask - pMask->alphaOrigin.y)))
- {
- pixman_region_fini (pRegion);
- return FALSE;
- }
- }
+ if (pMask) {
+ if (!miClipPictureSrc(pRegion, pMask, xDst - xMask, yDst - yMask)) {
+ pixman_region_fini(pRegion);
+ return FALSE;
+ }
+ if (pMask->alphaMap) {
+ if (!miClipPictureSrc(pRegion, pMask->alphaMap,
+ xDst - (xMask - pMask->alphaOrigin.x),
+ yDst - (yMask - pMask->alphaOrigin.y))) {
+ pixman_region_fini(pRegion);
+ return FALSE;
+ }
+ }
}
-
- miCompositeSourceValidate (pSrc);
+ miCompositeSourceValidate(pSrc);
if (pMask)
- miCompositeSourceValidate (pMask);
+ miCompositeSourceValidate(pMask);
return TRUE;
}
void
-miRenderColorToPixel (PictFormatPtr format,
- xRenderColor *color,
- CARD32 *pixel)
+miRenderColorToPixel(PictFormatPtr format, xRenderColor * color, CARD32 *pixel)
{
- CARD32 r, g, b, a;
- miIndexedPtr pIndexed;
+ CARD32 r, g, b, a;
+ miIndexedPtr pIndexed;
switch (format->type) {
case PictTypeDirect:
- r = color->red >> (16 - Ones (format->direct.redMask));
- g = color->green >> (16 - Ones (format->direct.greenMask));
- b = color->blue >> (16 - Ones (format->direct.blueMask));
- a = color->alpha >> (16 - Ones (format->direct.alphaMask));
- r = r << format->direct.red;
- g = g << format->direct.green;
- b = b << format->direct.blue;
- a = a << format->direct.alpha;
- *pixel = r|g|b|a;
- break;
+ r = color->red >> (16 - Ones(format->direct.redMask));
+ g = color->green >> (16 - Ones(format->direct.greenMask));
+ b = color->blue >> (16 - Ones(format->direct.blueMask));
+ a = color->alpha >> (16 - Ones(format->direct.alphaMask));
+ r = r << format->direct.red;
+ g = g << format->direct.green;
+ b = b << format->direct.blue;
+ a = a << format->direct.alpha;
+ *pixel = r | g | b | a;
+ break;
case PictTypeIndexed:
- pIndexed = (miIndexedPtr) (format->index.devPrivate);
- if (pIndexed->color)
- {
- r = color->red >> 11;
- g = color->green >> 11;
- b = color->blue >> 11;
- *pixel = miIndexToEnt15 (pIndexed, (r << 10) | (g << 5) | b);
- }
- else
- {
- r = color->red >> 8;
- g = color->green >> 8;
- b = color->blue >> 8;
- *pixel = miIndexToEntY24 (pIndexed, (r << 16) | (g << 8) | b);
- }
- break;
+ pIndexed = (miIndexedPtr) (format->index.devPrivate);
+ if (pIndexed->color) {
+ r = color->red >> 11;
+ g = color->green >> 11;
+ b = color->blue >> 11;
+ *pixel = miIndexToEnt15(pIndexed, (r << 10) | (g << 5) | b);
+ }
+ else {
+ r = color->red >> 8;
+ g = color->green >> 8;
+ b = color->blue >> 8;
+ *pixel = miIndexToEntY24(pIndexed, (r << 16) | (g << 8) | b);
+ }
+ break;
}
}
static CARD16
-miFillColor (CARD32 pixel, int bits)
+miFillColor(CARD32 pixel, int bits)
{
- while (bits < 16)
- {
- pixel |= pixel << bits;
- bits <<= 1;
+ while (bits < 16) {
+ pixel |= pixel << bits;
+ bits <<= 1;
}
return (CARD16) pixel;
}
Bool
-miIsSolidAlpha (PicturePtr pSrc)
+miIsSolidAlpha(PicturePtr pSrc)
{
- ScreenPtr pScreen;
- char line[1];
+ ScreenPtr pScreen;
+ char line[1];
if (!pSrc->pDrawable)
return FALSE;
pScreen = pSrc->pDrawable->pScreen;
-
+
/* Alpha-only */
- if (PICT_FORMAT_TYPE (pSrc->format) != PICT_TYPE_A)
- return FALSE;
+ if (PICT_FORMAT_TYPE(pSrc->format) != PICT_TYPE_A)
+ return FALSE;
/* repeat */
if (!pSrc->repeat)
- return FALSE;
+ return FALSE;
/* 1x1 */
if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1)
- return FALSE;
+ return FALSE;
line[0] = 1;
(*pScreen->GetImage) (pSrc->pDrawable, 0, 0, 1, 1, ZPixmap, ~0L, line);
switch (pSrc->pDrawable->bitsPerPixel) {
case 1:
- return (CARD8) line[0] == 1 || (CARD8) line[0] == 0x80;
+ return (CARD8) line[0] == 1 || (CARD8) line[0] == 0x80;
case 4:
- return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0;
+ return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0;
case 8:
- return (CARD8) line[0] == 0xff;
+ return (CARD8) line[0] == 0xff;
default:
- return FALSE;
+ return FALSE;
}
}
void
-miRenderPixelToColor (PictFormatPtr format,
- CARD32 pixel,
- xRenderColor *color)
+miRenderPixelToColor(PictFormatPtr format, CARD32 pixel, xRenderColor * color)
{
- CARD32 r, g, b, a;
- miIndexedPtr pIndexed;
-
+ CARD32 r, g, b, a;
+ miIndexedPtr pIndexed;
+
switch (format->type) {
case PictTypeDirect:
- r = (pixel >> format->direct.red) & format->direct.redMask;
- g = (pixel >> format->direct.green) & format->direct.greenMask;
- b = (pixel >> format->direct.blue) & format->direct.blueMask;
- a = (pixel >> format->direct.alpha) & format->direct.alphaMask;
- color->red = miFillColor (r, Ones (format->direct.redMask));
- color->green = miFillColor (g, Ones (format->direct.greenMask));
- color->blue = miFillColor (b, Ones (format->direct.blueMask));
- color->alpha = miFillColor (a, Ones (format->direct.alphaMask));
- break;
+ r = (pixel >> format->direct.red) & format->direct.redMask;
+ g = (pixel >> format->direct.green) & format->direct.greenMask;
+ b = (pixel >> format->direct.blue) & format->direct.blueMask;
+ a = (pixel >> format->direct.alpha) & format->direct.alphaMask;
+ color->red = miFillColor(r, Ones(format->direct.redMask));
+ color->green = miFillColor(g, Ones(format->direct.greenMask));
+ color->blue = miFillColor(b, Ones(format->direct.blueMask));
+ color->alpha = miFillColor(a, Ones(format->direct.alphaMask));
+ break;
case PictTypeIndexed:
- pIndexed = (miIndexedPtr) (format->index.devPrivate);
- pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED-1)];
- r = (pixel >> 16) & 0xff;
- g = (pixel >> 8) & 0xff;
- b = (pixel ) & 0xff;
- color->red = miFillColor (r, 8);
- color->green = miFillColor (g, 8);
- color->blue = miFillColor (b, 8);
- color->alpha = 0xffff;
- break;
+ pIndexed = (miIndexedPtr) (format->index.devPrivate);
+ pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED - 1)];
+ r = (pixel >> 16) & 0xff;
+ g = (pixel >> 8) & 0xff;
+ b = (pixel) & 0xff;
+ color->red = miFillColor(r, 8);
+ color->green = miFillColor(g, 8);
+ color->blue = miFillColor(b, 8);
+ color->alpha = 0xffff;
+ break;
}
}
void
-miTriStrip (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points)
+miTriStrip(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points)
{
- xTriangle *tris, *tri;
- int ntri;
+ xTriangle *tris, *tri;
+ int ntri;
ntri = npoints - 2;
- tris = malloc(ntri * sizeof (xTriangle));
+ tris = malloc(ntri * sizeof(xTriangle));
if (!tris)
return;
- for (tri = tris; npoints >= 3; npoints--, points++, tri++)
- {
+ for (tri = tris; npoints >= 3; npoints--, points++, tri++) {
tri->p1 = points[0];
tri->p2 = points[1];
tri->p3 = points[2];
}
- CompositeTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
+ CompositeTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
free(tris);
}
void
-miTriFan (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points)
+miTriFan(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points)
{
- xTriangle *tris, *tri;
- xPointFixed *first;
- int ntri;
+ xTriangle *tris, *tri;
+ xPointFixed *first;
+ int ntri;
ntri = npoints - 2;
- tris = malloc(ntri * sizeof (xTriangle));
+ tris = malloc(ntri * sizeof(xTriangle));
if (!tris)
- return;
+ return;
first = points++;
- for (tri = tris; npoints >= 3; npoints--, points++, tri++)
- {
- tri->p1 = *first;
- tri->p2 = points[0];
- tri->p3 = points[1];
+ for (tri = tris; npoints >= 3; npoints--, points++, tri++) {
+ tri->p1 = *first;
+ tri->p2 = points[0];
+ tri->p3 = points[1];
}
- CompositeTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
+ CompositeTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
free(tris);
}
Bool
-miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{
- PictureScreenPtr ps;
-
- if (!PictureInit (pScreen, formats, nformats))
- return FALSE;
+ PictureScreenPtr ps;
+
+ if (!PictureInit(pScreen, formats, nformats))
+ return FALSE;
ps = GetPictureScreen(pScreen);
ps->CreatePicture = miCreatePicture;
ps->DestroyPicture = miDestroyPicture;
@@ -650,18 +592,18 @@ miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->UnrealizeGlyph = miUnrealizeGlyph;
/* MI rendering routines */
- ps->Composite = 0; /* requires DDX support */
- ps->Glyphs = miGlyphs;
- ps->CompositeRects = miCompositeRects;
- ps->Trapezoids = 0;
- ps->Triangles = 0;
-
- ps->RasterizeTrapezoid = 0; /* requires DDX support */
- ps->AddTraps = 0; /* requires DDX support */
- ps->AddTriangles = 0; /* requires DDX support */
-
- ps->TriStrip = miTriStrip; /* converts call to CompositeTriangles */
- ps->TriFan = miTriFan;
+ ps->Composite = 0; /* requires DDX support */
+ ps->Glyphs = miGlyphs;
+ ps->CompositeRects = miCompositeRects;
+ ps->Trapezoids = 0;
+ ps->Triangles = 0;
+
+ ps->RasterizeTrapezoid = 0; /* requires DDX support */
+ ps->AddTraps = 0; /* requires DDX support */
+ ps->AddTriangles = 0; /* requires DDX support */
+
+ ps->TriStrip = miTriStrip; /* converts call to CompositeTriangles */
+ ps->TriFan = miTriFan;
return TRUE;
}
diff --git a/xorg-server/render/mipict.h b/xorg-server/render/mipict.h
index 4399a6fad..943622888 100644
--- a/xorg-server/render/mipict.h
+++ b/xorg-server/render/mipict.h
@@ -27,16 +27,16 @@
#include "picturestr.h"
-#define MI_MAX_INDEXED 256 /* XXX depth must be <= 8 */
+#define MI_MAX_INDEXED 256 /* XXX depth must be <= 8 */
#if MI_MAX_INDEXED <= 256
typedef CARD8 miIndexType;
#endif
typedef struct _miIndexed {
- Bool color;
- CARD32 rgba[MI_MAX_INDEXED];
- miIndexType ent[32768];
+ Bool color;
+ CARD32 rgba[MI_MAX_INDEXED];
+ miIndexType ent[32768];
} miIndexedRec, *miIndexedPtr;
#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
@@ -48,138 +48,113 @@ typedef struct _miIndexed {
#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
extern _X_EXPORT int
-miCreatePicture (PicturePtr pPicture);
+ miCreatePicture(PicturePtr pPicture);
extern _X_EXPORT void
-miDestroyPicture (PicturePtr pPicture);
+ miDestroyPicture(PicturePtr pPicture);
extern _X_EXPORT void
-miDestroyPictureClip (PicturePtr pPicture);
+ miDestroyPictureClip(PicturePtr pPicture);
extern _X_EXPORT int
-miChangePictureClip (PicturePtr pPicture,
- int type,
- pointer value,
- int n);
+ miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n);
extern _X_EXPORT void
-miChangePicture (PicturePtr pPicture,
- Mask mask);
+ miChangePicture(PicturePtr pPicture, Mask mask);
extern _X_EXPORT void
-miValidatePicture (PicturePtr pPicture,
- Mask mask);
+ miValidatePicture(PicturePtr pPicture, Mask mask);
extern _X_EXPORT int
-miChangePictureTransform (PicturePtr pPicture,
- PictTransform *transform);
+ miChangePictureTransform(PicturePtr pPicture, PictTransform * transform);
extern _X_EXPORT int
-miChangePictureFilter (PicturePtr pPicture,
- int filter,
- xFixed *params,
- int nparams);
+
+miChangePictureFilter(PicturePtr pPicture,
+ int filter, xFixed * params, int nparams);
extern _X_EXPORT void
-miCompositeSourceValidate (PicturePtr pPicture);
+ miCompositeSourceValidate(PicturePtr pPicture);
extern _X_EXPORT Bool
-miComputeCompositeRegion (RegionPtr pRegion,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
+
+miComputeCompositeRegion(RegionPtr pRegion,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
extern _X_EXPORT Bool
-miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
+ miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
extern _X_EXPORT Bool
-miRealizeGlyph (ScreenPtr pScreen,
- GlyphPtr glyph);
+ miRealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph);
extern _X_EXPORT void
-miUnrealizeGlyph (ScreenPtr pScreen,
- GlyphPtr glyph);
+ miUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph);
extern _X_EXPORT void
-miGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
+
+miGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
extern _X_EXPORT void
-miRenderColorToPixel (PictFormatPtr pPict,
- xRenderColor *color,
- CARD32 *pixel);
+ miRenderColorToPixel(PictFormatPtr pPict, xRenderColor * color, CARD32 *pixel);
extern _X_EXPORT void
-miRenderPixelToColor (PictFormatPtr pPict,
- CARD32 pixel,
- xRenderColor *color);
+ miRenderPixelToColor(PictFormatPtr pPict, CARD32 pixel, xRenderColor * color);
extern _X_EXPORT Bool
-miIsSolidAlpha (PicturePtr pSrc);
+ miIsSolidAlpha(PicturePtr pSrc);
extern _X_EXPORT void
-miCompositeRects (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects);
+
+miCompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color, int nRect, xRectangle *rects);
extern _X_EXPORT void
-miTriStrip (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points);
+
+miTriStrip(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
extern _X_EXPORT void
-miTriFan (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points);
+
+miTriFan(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
extern _X_EXPORT void
-miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box);
+ miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box);
extern _X_EXPORT void
-miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds);
-
+ miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds);
+
extern _X_EXPORT void
-miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds);
+ miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds);
extern _X_EXPORT Bool
-miInitIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat);
+ miInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
extern _X_EXPORT void
-miCloseIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat);
+ miCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
extern _X_EXPORT void
-miUpdateIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat,
- int ndef,
- xColorItem *pdef);
-#endif /* _MIPICT_H_ */
+miUpdateIndexed(ScreenPtr pScreen,
+ PictFormatPtr pFormat, int ndef, xColorItem * pdef);
+
+#endif /* _MIPICT_H_ */
diff --git a/xorg-server/render/mirect.c b/xorg-server/render/mirect.c
index d0becd578..357d52860 100644
--- a/xorg-server/render/mirect.c
+++ b/xorg-server/render/mirect.c
@@ -1,185 +1,168 @@
-/*
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "picturestr.h"
-#include "mipict.h"
-
-static void
-miColorRects (PicturePtr pDst,
- PicturePtr pClipPict,
- xRenderColor *color,
- int nRect,
- xRectangle *rects,
- int xoff,
- int yoff)
-{
- CARD32 pixel;
- GCPtr pGC;
- ChangeGCVal tmpval[5];
- RegionPtr pClip;
- unsigned long mask;
-
- miRenderColorToPixel (pDst->pFormat, color, &pixel);
-
- pGC = GetScratchGC (pDst->pDrawable->depth, pDst->pDrawable->pScreen);
- if (!pGC)
- return;
- tmpval[0].val = GXcopy;
- tmpval[1].val = pixel;
- tmpval[2].val = pDst->subWindowMode;
- mask = GCFunction | GCForeground | GCSubwindowMode;
- if (pClipPict->clientClipType == CT_REGION)
- {
- tmpval[3].val = pDst->clipOrigin.x - xoff;
- tmpval[4].val = pDst->clipOrigin.y - yoff;
- mask |= GCClipXOrigin|GCClipYOrigin;
-
- pClip = RegionCreate(NULL, 1);
- RegionCopy(pClip,
- (RegionPtr) pClipPict->clientClip);
- (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
- }
-
- ChangeGC (NullClient, pGC, mask, tmpval);
- ValidateGC (pDst->pDrawable, pGC);
- if (xoff || yoff)
- {
- int i;
- for (i = 0; i < nRect; i++)
- {
- rects[i].x -= xoff;
- rects[i].y -= yoff;
- }
- }
- (*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects);
- if (xoff || yoff)
- {
- int i;
- for (i = 0; i < nRect; i++)
- {
- rects[i].x += xoff;
- rects[i].y += yoff;
- }
- }
- FreeScratchGC (pGC);
-}
-
-void
-miCompositeRects (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
-
- if (color->alpha == 0xffff)
- {
- if (op == PictOpOver)
- op = PictOpSrc;
- }
- if (op == PictOpClear)
- color->red = color->green = color->blue = color->alpha = 0;
-
- if (op == PictOpSrc || op == PictOpClear)
- {
- miColorRects (pDst, pDst, color, nRect, rects, 0, 0);
- if (pDst->alphaMap)
- miColorRects (pDst->alphaMap, pDst,
- color, nRect, rects,
- pDst->alphaOrigin.x,
- pDst->alphaOrigin.y);
- }
- else
- {
- PictFormatPtr rgbaFormat;
- PixmapPtr pPixmap;
- PicturePtr pSrc;
- xRectangle one;
- int error;
- Pixel pixel;
- GCPtr pGC;
- ChangeGCVal gcvals[2];
- XID tmpval[1];
-
- rgbaFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
- if (!rgbaFormat)
- goto bail1;
-
- pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, rgbaFormat->depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap)
- goto bail2;
-
- miRenderColorToPixel (rgbaFormat, color, &pixel);
-
- pGC = GetScratchGC (rgbaFormat->depth, pScreen);
- if (!pGC)
- goto bail3;
- gcvals[0].val = GXcopy;
- gcvals[1].val = pixel;
-
- ChangeGC (NullClient, pGC, GCFunction | GCForeground, gcvals);
- ValidateGC (&pPixmap->drawable, pGC);
- one.x = 0;
- one.y = 0;
- one.width = 1;
- one.height = 1;
- (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one);
-
- tmpval[0] = xTrue;
- pSrc = CreatePicture (0, &pPixmap->drawable, rgbaFormat,
- CPRepeat, tmpval, serverClient, &error);
-
- if (!pSrc)
- goto bail4;
-
- while (nRect--)
- {
- CompositePicture (op, pSrc, 0, pDst, 0, 0, 0, 0,
- rects->x,
- rects->y,
- rects->width,
- rects->height);
- rects++;
- }
-
- FreePicture ((pointer) pSrc, 0);
-bail4:
- FreeScratchGC (pGC);
-bail3:
- (*pScreen->DestroyPixmap) (pPixmap);
-bail2:
-bail1:
- ;
- }
-}
+/*
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "picturestr.h"
+#include "mipict.h"
+
+static void
+miColorRects(PicturePtr pDst,
+ PicturePtr pClipPict,
+ xRenderColor * color,
+ int nRect, xRectangle *rects, int xoff, int yoff)
+{
+ CARD32 pixel;
+ GCPtr pGC;
+ ChangeGCVal tmpval[5];
+ RegionPtr pClip;
+ unsigned long mask;
+
+ miRenderColorToPixel(pDst->pFormat, color, &pixel);
+
+ pGC = GetScratchGC(pDst->pDrawable->depth, pDst->pDrawable->pScreen);
+ if (!pGC)
+ return;
+ tmpval[0].val = GXcopy;
+ tmpval[1].val = pixel;
+ tmpval[2].val = pDst->subWindowMode;
+ mask = GCFunction | GCForeground | GCSubwindowMode;
+ if (pClipPict->clientClipType == CT_REGION) {
+ tmpval[3].val = pDst->clipOrigin.x - xoff;
+ tmpval[4].val = pDst->clipOrigin.y - yoff;
+ mask |= GCClipXOrigin | GCClipYOrigin;
+
+ pClip = RegionCreate(NULL, 1);
+ RegionCopy(pClip, (RegionPtr) pClipPict->clientClip);
+ (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
+ }
+
+ ChangeGC(NullClient, pGC, mask, tmpval);
+ ValidateGC(pDst->pDrawable, pGC);
+ if (xoff || yoff) {
+ int i;
+
+ for (i = 0; i < nRect; i++) {
+ rects[i].x -= xoff;
+ rects[i].y -= yoff;
+ }
+ }
+ (*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects);
+ if (xoff || yoff) {
+ int i;
+
+ for (i = 0; i < nRect; i++) {
+ rects[i].x += xoff;
+ rects[i].y += yoff;
+ }
+ }
+ FreeScratchGC(pGC);
+}
+
+void
+miCompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color, int nRect, xRectangle *rects)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+
+ if (color->alpha == 0xffff) {
+ if (op == PictOpOver)
+ op = PictOpSrc;
+ }
+ if (op == PictOpClear)
+ color->red = color->green = color->blue = color->alpha = 0;
+
+ if (op == PictOpSrc || op == PictOpClear) {
+ miColorRects(pDst, pDst, color, nRect, rects, 0, 0);
+ if (pDst->alphaMap)
+ miColorRects(pDst->alphaMap, pDst,
+ color, nRect, rects,
+ pDst->alphaOrigin.x, pDst->alphaOrigin.y);
+ }
+ else {
+ PictFormatPtr rgbaFormat;
+ PixmapPtr pPixmap;
+ PicturePtr pSrc;
+ xRectangle one;
+ int error;
+ Pixel pixel;
+ GCPtr pGC;
+ ChangeGCVal gcvals[2];
+ XID tmpval[1];
+
+ rgbaFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8);
+ if (!rgbaFormat)
+ goto bail1;
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, rgbaFormat->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pPixmap)
+ goto bail2;
+
+ miRenderColorToPixel(rgbaFormat, color, &pixel);
+
+ pGC = GetScratchGC(rgbaFormat->depth, pScreen);
+ if (!pGC)
+ goto bail3;
+ gcvals[0].val = GXcopy;
+ gcvals[1].val = pixel;
+
+ ChangeGC(NullClient, pGC, GCFunction | GCForeground, gcvals);
+ ValidateGC(&pPixmap->drawable, pGC);
+ one.x = 0;
+ one.y = 0;
+ one.width = 1;
+ one.height = 1;
+ (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one);
+
+ tmpval[0] = xTrue;
+ pSrc = CreatePicture(0, &pPixmap->drawable, rgbaFormat,
+ CPRepeat, tmpval, serverClient, &error);
+
+ if (!pSrc)
+ goto bail4;
+
+ while (nRect--) {
+ CompositePicture(op, pSrc, 0, pDst, 0, 0, 0, 0,
+ rects->x, rects->y, rects->width, rects->height);
+ rects++;
+ }
+
+ FreePicture((pointer) pSrc, 0);
+ bail4:
+ FreeScratchGC(pGC);
+ bail3:
+ (*pScreen->DestroyPixmap) (pPixmap);
+ bail2:
+ bail1:
+ ;
+ }
+}
diff --git a/xorg-server/render/mitrap.c b/xorg-server/render/mitrap.c
index 445f23630..17b6dcd1c 100644
--- a/xorg-server/render/mitrap.c
+++ b/xorg-server/render/mitrap.c
@@ -35,45 +35,47 @@
#include "mipict.h"
static xFixed
-miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
+miLineFixedX(xLineFixed * l, xFixed y, Bool ceil)
{
- xFixed dx = l->p2.x - l->p1.x;
- xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
- xFixed dy = l->p2.y - l->p1.y;
+ xFixed dx = l->p2.x - l->p1.x;
+ xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
+ xFixed dy = l->p2.y - l->p1.y;
+
if (ceil)
- ex += (dy - 1);
+ ex += (dy - 1);
return l->p1.x + (xFixed) (ex / dy);
}
void
-miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box)
+miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box)
{
box->y1 = MAXSHORT;
box->y2 = MINSHORT;
box->x1 = MAXSHORT;
box->x2 = MINSHORT;
- for (; ntrap; ntrap--, traps++)
- {
- INT16 x1, y1, x2, y2;
+ for (; ntrap; ntrap--, traps++) {
+ INT16 x1, y1, x2, y2;
+
+ if (!xTrapezoidValid(traps))
+ continue;
+ y1 = xFixedToInt(traps->top);
+ if (y1 < box->y1)
+ box->y1 = y1;
+
+ y2 = xFixedToInt(xFixedCeil(traps->bottom));
+ if (y2 > box->y2)
+ box->y2 = y2;
+
+ x1 = xFixedToInt(min(miLineFixedX(&traps->left, traps->top, FALSE),
+ miLineFixedX(&traps->left, traps->bottom, FALSE)));
+ if (x1 < box->x1)
+ box->x1 = x1;
- if (!xTrapezoidValid(traps))
- continue;
- y1 = xFixedToInt (traps->top);
- if (y1 < box->y1)
- box->y1 = y1;
-
- y2 = xFixedToInt (xFixedCeil (traps->bottom));
- if (y2 > box->y2)
- box->y2 = y2;
-
- x1 = xFixedToInt (min (miLineFixedX (&traps->left, traps->top, FALSE),
- miLineFixedX (&traps->left, traps->bottom, FALSE)));
- if (x1 < box->x1)
- box->x1 = x1;
-
- x2 = xFixedToInt (xFixedCeil (max (miLineFixedX (&traps->right, traps->top, TRUE),
- miLineFixedX (&traps->right, traps->bottom, TRUE))));
- if (x2 > box->x2)
- box->x2 = x2;
+ x2 = xFixedToInt(xFixedCeil
+ (max
+ (miLineFixedX(&traps->right, traps->top, TRUE),
+ miLineFixedX(&traps->right, traps->bottom, TRUE))));
+ if (x2 > box->x2)
+ box->x2 = x2;
}
}
diff --git a/xorg-server/render/mitri.c b/xorg-server/render/mitri.c
index 8c5298e25..922f22a6a 100644
--- a/xorg-server/render/mitri.c
+++ b/xorg-server/render/mitri.c
@@ -1,68 +1,67 @@
-/*
- *
- * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "picturestr.h"
-#include "mipict.h"
-
-void
-miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds)
-{
- bounds->x1 = xFixedToInt (points->x);
- bounds->x2 = xFixedToInt (xFixedCeil (points->x));
- bounds->y1 = xFixedToInt (points->y);
- bounds->y2 = xFixedToInt (xFixedCeil (points->y));
- points++;
- npoint--;
- while (npoint-- > 0)
- {
- INT16 x1 = xFixedToInt (points->x);
- INT16 x2 = xFixedToInt (xFixedCeil (points->x));
- INT16 y1 = xFixedToInt (points->y);
- INT16 y2 = xFixedToInt (xFixedCeil (points->y));
-
- if (x1 < bounds->x1)
- bounds->x1 = x1;
- else if (x2 > bounds->x2)
- bounds->x2 = x2;
- if (y1 < bounds->y1)
- bounds->y1 = y1;
- else if (y2 > bounds->y2)
- bounds->y2 = y2;
- points++;
- }
-}
-
-void
-miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds)
-{
- miPointFixedBounds (ntri * 3, (xPointFixed *) tris, bounds);
-}
+/*
+ *
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "picturestr.h"
+#include "mipict.h"
+
+void
+miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds)
+{
+ bounds->x1 = xFixedToInt(points->x);
+ bounds->x2 = xFixedToInt(xFixedCeil(points->x));
+ bounds->y1 = xFixedToInt(points->y);
+ bounds->y2 = xFixedToInt(xFixedCeil(points->y));
+ points++;
+ npoint--;
+ while (npoint-- > 0) {
+ INT16 x1 = xFixedToInt(points->x);
+ INT16 x2 = xFixedToInt(xFixedCeil(points->x));
+ INT16 y1 = xFixedToInt(points->y);
+ INT16 y2 = xFixedToInt(xFixedCeil(points->y));
+
+ if (x1 < bounds->x1)
+ bounds->x1 = x1;
+ else if (x2 > bounds->x2)
+ bounds->x2 = x2;
+ if (y1 < bounds->y1)
+ bounds->y1 = y1;
+ else if (y2 > bounds->y2)
+ bounds->y2 = y2;
+ points++;
+ }
+}
+
+void
+miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds)
+{
+ miPointFixedBounds(ntri * 3, (xPointFixed *) tris, bounds);
+}
diff --git a/xorg-server/render/picture.c b/xorg-server/render/picture.c
index f13459665..2fd13fc37 100644
--- a/xorg-server/render/picture.c
+++ b/xorg-server/render/picture.c
@@ -44,26 +44,25 @@
DevPrivateKeyRec PictureScreenPrivateKeyRec;
DevPrivateKeyRec PictureWindowPrivateKeyRec;
-static int PictureGeneration;
-RESTYPE PictureType;
-RESTYPE PictFormatType;
-RESTYPE GlyphSetType;
-int PictureCmapPolicy = PictureCmapPolicyDefault;
+static int PictureGeneration;
+RESTYPE PictureType;
+RESTYPE PictFormatType;
+RESTYPE GlyphSetType;
+int PictureCmapPolicy = PictureCmapPolicyDefault;
Bool
-PictureDestroyWindow (WindowPtr pWindow)
+PictureDestroyWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- PicturePtr pPicture;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- Bool ret;
-
- while ((pPicture = GetPictureWindow(pWindow)))
- {
- SetPictureWindow(pWindow, pPicture->pNext);
- if (pPicture->id)
- FreeResource (pPicture->id, PictureType);
- FreePicture ((pointer) pPicture, pPicture->id);
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ PicturePtr pPicture;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ Bool ret;
+
+ while ((pPicture = GetPictureWindow(pWindow))) {
+ SetPictureWindow(pWindow, pPicture->pNext);
+ if (pPicture->id)
+ FreeResource(pPicture->id, PictureType);
+ FreePicture((pointer) pPicture, pPicture->id);
}
pScreen->DestroyWindow = ps->DestroyWindow;
ret = (*pScreen->DestroyWindow) (pWindow);
@@ -73,19 +72,19 @@ PictureDestroyWindow (WindowPtr pWindow)
}
Bool
-PictureCloseScreen (int index, ScreenPtr pScreen)
+PictureCloseScreen(int index, ScreenPtr pScreen)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- Bool ret;
- int n;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ Bool ret;
+ int n;
pScreen->CloseScreen = ps->CloseScreen;
ret = (*pScreen->CloseScreen) (index, pScreen);
- PictureResetFilters (pScreen);
+ PictureResetFilters(pScreen);
for (n = 0; n < ps->nformats; n++)
- if (ps->formats[n].type == PictTypeIndexed)
- (*ps->CloseIndexed) (pScreen, &ps->formats[n]);
- GlyphUninit (pScreen);
+ if (ps->formats[n].type == PictTypeIndexed)
+ (*ps->CloseIndexed) (pScreen, &ps->formats[n]);
+ GlyphUninit(pScreen);
SetPictureScreen(pScreen, 0);
free(ps->formats);
free(ps);
@@ -93,66 +92,59 @@ PictureCloseScreen (int index, ScreenPtr pScreen)
}
void
-PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef)
+PictureStoreColors(ColormapPtr pColormap, int ndef, xColorItem * pdef)
{
- ScreenPtr pScreen = pColormap->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+ ScreenPtr pScreen = pColormap->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
pScreen->StoreColors = ps->StoreColors;
(*pScreen->StoreColors) (pColormap, ndef, pdef);
ps->StoreColors = pScreen->StoreColors;
pScreen->StoreColors = PictureStoreColors;
- if (pColormap->class == PseudoColor || pColormap->class == GrayScale)
- {
- PictFormatPtr format = ps->formats;
- int nformats = ps->nformats;
-
- while (nformats--)
- {
- if (format->type == PictTypeIndexed &&
- format->index.pColormap == pColormap)
- {
- (*ps->UpdateIndexed) (pScreen, format, ndef, pdef);
- break;
- }
- format++;
- }
+ if (pColormap->class == PseudoColor || pColormap->class == GrayScale) {
+ PictFormatPtr format = ps->formats;
+ int nformats = ps->nformats;
+
+ while (nformats--) {
+ if (format->type == PictTypeIndexed &&
+ format->index.pColormap == pColormap) {
+ (*ps->UpdateIndexed) (pScreen, format, ndef, pdef);
+ break;
+ }
+ format++;
+ }
}
}
static int
-visualDepth (ScreenPtr pScreen, VisualPtr pVisual)
+visualDepth(ScreenPtr pScreen, VisualPtr pVisual)
{
- int d, v;
- DepthPtr pDepth;
-
- for (d = 0; d < pScreen->numDepths; d++)
- {
- pDepth = &pScreen->allowedDepths[d];
- for (v = 0; v < pDepth->numVids; v++)
- if (pDepth->vids[v] == pVisual->vid)
- return pDepth->depth;
+ int d, v;
+ DepthPtr pDepth;
+
+ for (d = 0; d < pScreen->numDepths; d++) {
+ pDepth = &pScreen->allowedDepths[d];
+ for (v = 0; v < pDepth->numVids; v++)
+ if (pDepth->vids[v] == pVisual->vid)
+ return pDepth->depth;
}
return 0;
}
typedef struct _formatInit {
- CARD32 format;
- CARD8 depth;
+ CARD32 format;
+ CARD8 depth;
} FormatInitRec, *FormatInitPtr;
static int
-addFormat (FormatInitRec formats[256],
- int nformat,
- CARD32 format,
- CARD8 depth)
+addFormat(FormatInitRec formats[256], int nformat, CARD32 format, CARD8 depth)
{
- int n;
+ int n;
for (n = 0; n < nformat; n++)
- if (formats[n].format == format && formats[n].depth == depth)
- return nformat;
+ if (formats[n].format == format && formats[n].depth == depth)
+ return nformat;
formats[nformat].format = format;
formats[nformat].depth = depth;
return ++nformat;
@@ -161,20 +153,20 @@ addFormat (FormatInitRec formats[256],
#define Mask(n) ((1 << (n)) - 1)
PictFormatPtr
-PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
+PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp)
{
- int nformats, f;
- PictFormatPtr pFormats;
- FormatInitRec formats[1024];
- CARD32 format;
- CARD8 depth;
- VisualPtr pVisual;
- int v;
- int bpp;
- int type;
- int r, g, b;
- int d;
- DepthPtr pDepth;
+ int nformats, f;
+ PictFormatPtr pFormats;
+ FormatInitRec formats[1024];
+ CARD32 format;
+ CARD8 depth;
+ VisualPtr pVisual;
+ int v;
+ int bpp;
+ int type;
+ int r, g, b;
+ int d;
+ DepthPtr pDepth;
nformats = 0;
/* formats required by protocol */
@@ -182,13 +174,11 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
formats[nformats].depth = 1;
nformats++;
formats[nformats].format = PICT_FORMAT(BitsPerPixel(8),
- PICT_TYPE_A,
- 8, 0, 0, 0);
+ PICT_TYPE_A, 8, 0, 0, 0);
formats[nformats].depth = 8;
nformats++;
formats[nformats].format = PICT_FORMAT(BitsPerPixel(4),
- PICT_TYPE_A,
- 4, 0, 0, 0);
+ PICT_TYPE_A, 4, 0, 0, 0);
formats[nformats].depth = 4;
nformats++;
formats[nformats].format = PICT_a8r8g8b8;
@@ -205,233 +195,233 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
nformats++;
/* now look through the depths and visuals adding other formats */
- for (v = 0; v < pScreen->numVisuals; v++)
- {
- pVisual = &pScreen->visuals[v];
- depth = visualDepth (pScreen, pVisual);
- if (!depth)
- continue;
- bpp = BitsPerPixel (depth);
- switch (pVisual->class) {
- case DirectColor:
- case TrueColor:
- r = Ones (pVisual->redMask);
- g = Ones (pVisual->greenMask);
- b = Ones (pVisual->blueMask);
- type = PICT_TYPE_OTHER;
- /*
- * Current rendering code supports only three direct formats,
- * fields must be packed together at the bottom of the pixel
- */
- if (pVisual->offsetBlue == 0 &&
- pVisual->offsetGreen == b &&
- pVisual->offsetRed == b + g)
- {
- type = PICT_TYPE_ARGB;
- }
- else if (pVisual->offsetRed == 0 &&
- pVisual->offsetGreen == r &&
- pVisual->offsetBlue == r + g)
- {
- type = PICT_TYPE_ABGR;
- }
- else if (pVisual->offsetRed == pVisual->offsetGreen - r &&
- pVisual->offsetGreen == pVisual->offsetBlue - g &&
- pVisual->offsetBlue == bpp - b)
- {
- type = PICT_TYPE_BGRA;
- }
- if (type != PICT_TYPE_OTHER)
- {
- format = PICT_FORMAT(bpp, type, 0, r, g, b);
- nformats = addFormat (formats, nformats, format, depth);
- }
- break;
- case StaticColor:
- case PseudoColor:
- format = PICT_VISFORMAT (bpp, PICT_TYPE_COLOR, v);
- nformats = addFormat (formats, nformats, format, depth);
- break;
- case StaticGray:
- case GrayScale:
- format = PICT_VISFORMAT (bpp, PICT_TYPE_GRAY, v);
- nformats = addFormat (formats, nformats, format, depth);
- break;
- }
+ for (v = 0; v < pScreen->numVisuals; v++) {
+ pVisual = &pScreen->visuals[v];
+ depth = visualDepth(pScreen, pVisual);
+ if (!depth)
+ continue;
+ bpp = BitsPerPixel(depth);
+ switch (pVisual->class) {
+ case DirectColor:
+ case TrueColor:
+ r = Ones(pVisual->redMask);
+ g = Ones(pVisual->greenMask);
+ b = Ones(pVisual->blueMask);
+ type = PICT_TYPE_OTHER;
+ /*
+ * Current rendering code supports only three direct formats,
+ * fields must be packed together at the bottom of the pixel
+ */
+ if (pVisual->offsetBlue == 0 &&
+ pVisual->offsetGreen == b && pVisual->offsetRed == b + g) {
+ type = PICT_TYPE_ARGB;
+ }
+ else if (pVisual->offsetRed == 0 &&
+ pVisual->offsetGreen == r &&
+ pVisual->offsetBlue == r + g) {
+ type = PICT_TYPE_ABGR;
+ }
+ else if (pVisual->offsetRed == pVisual->offsetGreen - r &&
+ pVisual->offsetGreen == pVisual->offsetBlue - g &&
+ pVisual->offsetBlue == bpp - b) {
+ type = PICT_TYPE_BGRA;
+ }
+ if (type != PICT_TYPE_OTHER) {
+ format = PICT_FORMAT(bpp, type, 0, r, g, b);
+ nformats = addFormat(formats, nformats, format, depth);
+ }
+ break;
+ case StaticColor:
+ case PseudoColor:
+ format = PICT_VISFORMAT(bpp, PICT_TYPE_COLOR, v);
+ nformats = addFormat(formats, nformats, format, depth);
+ break;
+ case StaticGray:
+ case GrayScale:
+ format = PICT_VISFORMAT(bpp, PICT_TYPE_GRAY, v);
+ nformats = addFormat(formats, nformats, format, depth);
+ break;
+ }
}
/*
* Walk supported depths and add useful Direct formats
*/
- for (d = 0; d < pScreen->numDepths; d++)
- {
- pDepth = &pScreen->allowedDepths[d];
- bpp = BitsPerPixel (pDepth->depth);
- format = 0;
- switch (bpp) {
- case 16:
- /* depth 12 formats */
- if (pDepth->depth >= 12)
- {
- nformats = addFormat (formats, nformats,
- PICT_x4r4g4b4, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x4b4g4r4, pDepth->depth);
- }
- /* depth 15 formats */
- if (pDepth->depth >= 15)
- {
- nformats = addFormat (formats, nformats,
- PICT_x1r5g5b5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x1b5g5r5, pDepth->depth);
- }
- /* depth 16 formats */
- if (pDepth->depth >= 16)
- {
- nformats = addFormat (formats, nformats,
- PICT_a1r5g5b5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_a1b5g5r5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_r5g6b5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_b5g6r5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_a4r4g4b4, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_a4b4g4r4, pDepth->depth);
- }
- break;
- case 24:
- if (pDepth->depth >= 24)
- {
- nformats = addFormat (formats, nformats,
- PICT_r8g8b8, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_b8g8r8, pDepth->depth);
- }
- break;
- case 32:
- if (pDepth->depth >= 24)
- {
- nformats = addFormat (formats, nformats,
- PICT_x8r8g8b8, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x8b8g8r8, pDepth->depth);
- }
- if (pDepth->depth >= 30)
- {
- nformats = addFormat (formats, nformats,
- PICT_a2r10g10b10, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x2r10g10b10, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_a2b10g10r10, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x2b10g10r10, pDepth->depth);
- }
- break;
- }
+ for (d = 0; d < pScreen->numDepths; d++) {
+ pDepth = &pScreen->allowedDepths[d];
+ bpp = BitsPerPixel(pDepth->depth);
+ format = 0;
+ switch (bpp) {
+ case 16:
+ /* depth 12 formats */
+ if (pDepth->depth >= 12) {
+ nformats = addFormat(formats, nformats,
+ PICT_x4r4g4b4, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_x4b4g4r4, pDepth->depth);
+ }
+ /* depth 15 formats */
+ if (pDepth->depth >= 15) {
+ nformats = addFormat(formats, nformats,
+ PICT_x1r5g5b5, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_x1b5g5r5, pDepth->depth);
+ }
+ /* depth 16 formats */
+ if (pDepth->depth >= 16) {
+ nformats = addFormat(formats, nformats,
+ PICT_a1r5g5b5, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_a1b5g5r5, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_r5g6b5, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_b5g6r5, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_a4r4g4b4, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_a4b4g4r4, pDepth->depth);
+ }
+ break;
+ case 24:
+ if (pDepth->depth >= 24) {
+ nformats = addFormat(formats, nformats,
+ PICT_r8g8b8, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_b8g8r8, pDepth->depth);
+ }
+ break;
+ case 32:
+ if (pDepth->depth >= 24) {
+ nformats = addFormat(formats, nformats,
+ PICT_x8r8g8b8, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_x8b8g8r8, pDepth->depth);
+ }
+ if (pDepth->depth >= 30) {
+ nformats = addFormat(formats, nformats,
+ PICT_a2r10g10b10, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_x2r10g10b10, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_a2b10g10r10, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_x2b10g10r10, pDepth->depth);
+ }
+ break;
+ }
}
-
- pFormats = calloc(nformats, sizeof (PictFormatRec));
+ pFormats = calloc(nformats, sizeof(PictFormatRec));
if (!pFormats)
- return 0;
- for (f = 0; f < nformats; f++)
- {
- pFormats[f].id = FakeClientID (0);
- pFormats[f].depth = formats[f].depth;
- format = formats[f].format;
- pFormats[f].format = format;
- switch (PICT_FORMAT_TYPE(format)) {
- case PICT_TYPE_ARGB:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
- if (pFormats[f].direct.alphaMask)
- pFormats[f].direct.alpha = (PICT_FORMAT_R(format) +
- PICT_FORMAT_G(format) +
- PICT_FORMAT_B(format));
-
- pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format));
- pFormats[f].direct.red = (PICT_FORMAT_G(format) +
- PICT_FORMAT_B(format));
-
- pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format));
- pFormats[f].direct.green = PICT_FORMAT_B(format);
-
- pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format));
- pFormats[f].direct.blue = 0;
- break;
-
- case PICT_TYPE_ABGR:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
- if (pFormats[f].direct.alphaMask)
- pFormats[f].direct.alpha = (PICT_FORMAT_B(format) +
- PICT_FORMAT_G(format) +
- PICT_FORMAT_R(format));
-
- pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format));
- pFormats[f].direct.blue = (PICT_FORMAT_G(format) +
- PICT_FORMAT_R(format));
-
- pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format));
- pFormats[f].direct.green = PICT_FORMAT_R(format);
-
- pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format));
- pFormats[f].direct.red = 0;
- break;
-
- case PICT_TYPE_BGRA:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format));
- pFormats[f].direct.blue = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format));
-
- pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format));
- pFormats[f].direct.green = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
- PICT_FORMAT_G(format));
-
- pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format));
- pFormats[f].direct.red = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
- PICT_FORMAT_G(format) - PICT_FORMAT_R(format));
-
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
- pFormats[f].direct.alpha = 0;
- break;
-
- case PICT_TYPE_A:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.alpha = 0;
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
-
- /* remaining fields already set to zero */
- break;
-
- case PICT_TYPE_COLOR:
- case PICT_TYPE_GRAY:
- pFormats[f].type = PictTypeIndexed;
- pFormats[f].index.vid = pScreen->visuals[PICT_FORMAT_VIS(format)].vid;
- break;
- }
+ return 0;
+ for (f = 0; f < nformats; f++) {
+ pFormats[f].id = FakeClientID(0);
+ pFormats[f].depth = formats[f].depth;
+ format = formats[f].format;
+ pFormats[f].format = format;
+ switch (PICT_FORMAT_TYPE(format)) {
+ case PICT_TYPE_ARGB:
+ pFormats[f].type = PictTypeDirect;
+
+ pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format));
+
+ if (pFormats[f].direct.alphaMask)
+ pFormats[f].direct.alpha = (PICT_FORMAT_R(format) +
+ PICT_FORMAT_G(format) +
+ PICT_FORMAT_B(format));
+
+ pFormats[f].direct.redMask = Mask (PICT_FORMAT_R(format));
+
+ pFormats[f].direct.red = (PICT_FORMAT_G(format) +
+ PICT_FORMAT_B(format));
+
+ pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G(format));
+
+ pFormats[f].direct.green = PICT_FORMAT_B(format);
+
+ pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B(format));
+
+ pFormats[f].direct.blue = 0;
+ break;
+
+ case PICT_TYPE_ABGR:
+ pFormats[f].type = PictTypeDirect;
+
+ pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format));
+
+ if (pFormats[f].direct.alphaMask)
+ pFormats[f].direct.alpha = (PICT_FORMAT_B(format) +
+ PICT_FORMAT_G(format) +
+ PICT_FORMAT_R(format));
+
+ pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B(format));
+
+ pFormats[f].direct.blue = (PICT_FORMAT_G(format) +
+ PICT_FORMAT_R(format));
+
+ pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G(format));
+
+ pFormats[f].direct.green = PICT_FORMAT_R(format);
+
+ pFormats[f].direct.redMask = Mask (PICT_FORMAT_R(format));
+
+ pFormats[f].direct.red = 0;
+ break;
+
+ case PICT_TYPE_BGRA:
+ pFormats[f].type = PictTypeDirect;
+
+ pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B(format));
+
+ pFormats[f].direct.blue =
+ (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format));
+
+ pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G(format));
+
+ pFormats[f].direct.green =
+ (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
+ PICT_FORMAT_G(format));
+
+ pFormats[f].direct.redMask = Mask (PICT_FORMAT_R(format));
+
+ pFormats[f].direct.red =
+ (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
+ PICT_FORMAT_G(format) - PICT_FORMAT_R(format));
+
+ pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format));
+
+ pFormats[f].direct.alpha = 0;
+ break;
+
+ case PICT_TYPE_A:
+ pFormats[f].type = PictTypeDirect;
+
+ pFormats[f].direct.alpha = 0;
+ pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format));
+
+ /* remaining fields already set to zero */
+ break;
+
+ case PICT_TYPE_COLOR:
+ case PICT_TYPE_GRAY:
+ pFormats[f].type = PictTypeIndexed;
+ pFormats[f].index.vid =
+ pScreen->visuals[PICT_FORMAT_VIS(format)].vid;
+ break;
+ }
}
*nformatp = nformats;
return pFormats;
}
static VisualPtr
-PictureFindVisual (ScreenPtr pScreen, VisualID visual)
+PictureFindVisual(ScreenPtr pScreen, VisualID visual)
{
- int i;
- VisualPtr pVisual;
+ int i;
+ VisualPtr pVisual;
+
for (i = 0, pVisual = pScreen->visuals;
- i < pScreen->numVisuals;
- i++, pVisual++)
- {
+ i < pScreen->numVisuals; i++, pVisual++) {
if (pVisual->vid == visual)
return pVisual;
}
@@ -444,88 +434,89 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
if (format->type != PictTypeIndexed || format->index.pColormap)
- return TRUE;
+ return TRUE;
if (format->index.vid == pScreen->rootVisual) {
- dixLookupResourceByType((pointer *)&format->index.pColormap,
- pScreen->defColormap, RT_COLORMAP,
- serverClient, DixGetAttrAccess);
- } else {
- VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
- if (CreateColormap(FakeClientID (0), pScreen, pVisual,
- &format->index.pColormap, AllocNone, 0)
- != Success)
- return FALSE;
+ dixLookupResourceByType((pointer *) &format->index.pColormap,
+ pScreen->defColormap, RT_COLORMAP,
+ serverClient, DixGetAttrAccess);
+ }
+ else {
+ VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
+
+ if (CreateColormap(FakeClientID(0), pScreen, pVisual,
+ &format->index.pColormap, AllocNone, 0)
+ != Success)
+ return FALSE;
}
if (!ps->InitIndexed(pScreen, format))
- return FALSE;
+ return FALSE;
return TRUE;
}
static Bool
-PictureInitIndexedFormats (ScreenPtr pScreen)
+PictureInitIndexedFormats(ScreenPtr pScreen)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
- PictFormatPtr format;
- int nformat;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictFormatPtr format;
+ int nformat;
if (!ps)
- return FALSE;
+ return FALSE;
format = ps->formats;
nformat = ps->nformats;
while (nformat--)
- if (!PictureInitIndexedFormat(pScreen, format++))
- return FALSE;
+ if (!PictureInitIndexedFormat(pScreen, format++))
+ return FALSE;
return TRUE;
}
Bool
-PictureFinishInit (void)
+PictureFinishInit(void)
{
- int s;
+ int s;
- for (s = 0; s < screenInfo.numScreens; s++)
- {
- if (!PictureInitIndexedFormats (screenInfo.screens[s]))
- return FALSE;
- (void) AnimCurInit (screenInfo.screens[s]);
+ for (s = 0; s < screenInfo.numScreens; s++) {
+ if (!PictureInitIndexedFormats(screenInfo.screens[s]))
+ return FALSE;
+ (void) AnimCurInit(screenInfo.screens[s]);
}
return TRUE;
}
Bool
-PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel)
+PictureSetSubpixelOrder(ScreenPtr pScreen, int subpixel)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
if (!ps)
- return FALSE;
+ return FALSE;
ps->subpixel = subpixel;
return TRUE;
-
+
}
int
-PictureGetSubpixelOrder (ScreenPtr pScreen)
+PictureGetSubpixelOrder(ScreenPtr pScreen)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
if (!ps)
- return SubPixelUnknown;
+ return SubPixelUnknown;
return ps->subpixel;
}
-
+
PictFormatPtr
-PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual)
+PictureMatchVisual(ScreenPtr pScreen, int depth, VisualPtr pVisual)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
- PictFormatPtr format;
- int nformat;
- int type;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictFormatPtr format;
+ int nformat;
+ int type;
if (!ps)
- return 0;
+ return 0;
format = ps->formats;
nformat = ps->nformats;
switch (pVisual->class) {
@@ -533,158 +524,146 @@ PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual)
case GrayScale:
case StaticColor:
case PseudoColor:
- type = PictTypeIndexed;
- break;
+ type = PictTypeIndexed;
+ break;
case TrueColor:
case DirectColor:
- type = PictTypeDirect;
- break;
+ type = PictTypeDirect;
+ break;
default:
- return 0;
+ return 0;
}
- while (nformat--)
- {
- if (format->depth == depth && format->type == type)
- {
- if (type == PictTypeIndexed)
- {
- if (format->index.vid == pVisual->vid)
- return format;
- }
- else
- {
- if (format->direct.redMask << format->direct.red ==
- pVisual->redMask &&
- format->direct.greenMask << format->direct.green ==
- pVisual->greenMask &&
- format->direct.blueMask << format->direct.blue ==
- pVisual->blueMask)
- {
- return format;
- }
- }
- }
- format++;
+ while (nformat--) {
+ if (format->depth == depth && format->type == type) {
+ if (type == PictTypeIndexed) {
+ if (format->index.vid == pVisual->vid)
+ return format;
+ }
+ else {
+ if (format->direct.redMask << format->direct.red ==
+ pVisual->redMask &&
+ format->direct.greenMask << format->direct.green ==
+ pVisual->greenMask &&
+ format->direct.blueMask << format->direct.blue ==
+ pVisual->blueMask) {
+ return format;
+ }
+ }
+ }
+ format++;
}
return 0;
}
PictFormatPtr
-PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 f)
+PictureMatchFormat(ScreenPtr pScreen, int depth, CARD32 f)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
- PictFormatPtr format;
- int nformat;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictFormatPtr format;
+ int nformat;
if (!ps)
- return 0;
+ return 0;
format = ps->formats;
nformat = ps->nformats;
- while (nformat--)
- {
- if (format->depth == depth && format->format == (f & 0xffffff))
- return format;
- format++;
+ while (nformat--) {
+ if (format->depth == depth && format->format == (f & 0xffffff))
+ return format;
+ format++;
}
return 0;
}
int
-PictureParseCmapPolicy (const char *name)
+PictureParseCmapPolicy(const char *name)
{
- if ( strcmp (name, "default" ) == 0)
- return PictureCmapPolicyDefault;
- else if ( strcmp (name, "mono" ) == 0)
- return PictureCmapPolicyMono;
- else if ( strcmp (name, "gray" ) == 0)
- return PictureCmapPolicyGray;
- else if ( strcmp (name, "color" ) == 0)
- return PictureCmapPolicyColor;
- else if ( strcmp (name, "all" ) == 0)
- return PictureCmapPolicyAll;
+ if (strcmp(name, "default") == 0)
+ return PictureCmapPolicyDefault;
+ else if (strcmp(name, "mono") == 0)
+ return PictureCmapPolicyMono;
+ else if (strcmp(name, "gray") == 0)
+ return PictureCmapPolicyGray;
+ else if (strcmp(name, "color") == 0)
+ return PictureCmapPolicyColor;
+ else if (strcmp(name, "all") == 0)
+ return PictureCmapPolicyAll;
else
- return PictureCmapPolicyInvalid;
+ return PictureCmapPolicyInvalid;
}
Bool
-PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{
- PictureScreenPtr ps;
- int n;
- CARD32 type, a, r, g, b;
-
- if (PictureGeneration != serverGeneration)
- {
- PictureType = CreateNewResourceType (FreePicture, "PICTURE");
- if (!PictureType)
- return FALSE;
- PictFormatType = CreateNewResourceType (FreePictFormat, "PICTFORMAT");
- if (!PictFormatType)
- return FALSE;
- GlyphSetType = CreateNewResourceType (FreeGlyphSet, "GLYPHSET");
- if (!GlyphSetType)
- return FALSE;
- PictureGeneration = serverGeneration;
+ PictureScreenPtr ps;
+ int n;
+ CARD32 type, a, r, g, b;
+
+ if (PictureGeneration != serverGeneration) {
+ PictureType = CreateNewResourceType(FreePicture, "PICTURE");
+ if (!PictureType)
+ return FALSE;
+ PictFormatType = CreateNewResourceType(FreePictFormat, "PICTFORMAT");
+ if (!PictFormatType)
+ return FALSE;
+ GlyphSetType = CreateNewResourceType(FreeGlyphSet, "GLYPHSET");
+ if (!GlyphSetType)
+ return FALSE;
+ PictureGeneration = serverGeneration;
}
if (!dixRegisterPrivateKey(&PictureScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&PictureWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ return FALSE;
- if (!formats)
- {
- formats = PictureCreateDefaultFormats (pScreen, &nformats);
- if (!formats)
- return FALSE;
+ if (!formats) {
+ formats = PictureCreateDefaultFormats(pScreen, &nformats);
+ if (!formats)
+ return FALSE;
}
- for (n = 0; n < nformats; n++)
- {
- if (!AddResource (formats[n].id, PictFormatType, (pointer) (formats+n)))
- {
- free(formats);
- return FALSE;
- }
- if (formats[n].type == PictTypeIndexed)
- {
- VisualPtr pVisual = PictureFindVisual (pScreen, formats[n].index.vid);
- if ((pVisual->class | DynamicClass) == PseudoColor)
- type = PICT_TYPE_COLOR;
- else
- type = PICT_TYPE_GRAY;
- a = r = g = b = 0;
- }
- else
- {
- if ((formats[n].direct.redMask|
- formats[n].direct.blueMask|
- formats[n].direct.greenMask) == 0)
- type = PICT_TYPE_A;
- else if (formats[n].direct.red > formats[n].direct.blue)
- type = PICT_TYPE_ARGB;
- else if (formats[n].direct.red == 0)
- type = PICT_TYPE_ABGR;
- else
- type = PICT_TYPE_BGRA;
- a = Ones (formats[n].direct.alphaMask);
- r = Ones (formats[n].direct.redMask);
- g = Ones (formats[n].direct.greenMask);
- b = Ones (formats[n].direct.blueMask);
- }
- formats[n].format = PICT_FORMAT(0,type,a,r,g,b);
+ for (n = 0; n < nformats; n++) {
+ if (!AddResource
+ (formats[n].id, PictFormatType, (pointer) (formats + n))) {
+ free(formats);
+ return FALSE;
+ }
+ if (formats[n].type == PictTypeIndexed) {
+ VisualPtr pVisual =
+ PictureFindVisual(pScreen, formats[n].index.vid);
+ if ((pVisual->class | DynamicClass) == PseudoColor)
+ type = PICT_TYPE_COLOR;
+ else
+ type = PICT_TYPE_GRAY;
+ a = r = g = b = 0;
+ }
+ else {
+ if ((formats[n].direct.redMask |
+ formats[n].direct.blueMask | formats[n].direct.greenMask) == 0)
+ type = PICT_TYPE_A;
+ else if (formats[n].direct.red > formats[n].direct.blue)
+ type = PICT_TYPE_ARGB;
+ else if (formats[n].direct.red == 0)
+ type = PICT_TYPE_ABGR;
+ else
+ type = PICT_TYPE_BGRA;
+ a = Ones(formats[n].direct.alphaMask);
+ r = Ones(formats[n].direct.redMask);
+ g = Ones(formats[n].direct.greenMask);
+ b = Ones(formats[n].direct.blueMask);
+ }
+ formats[n].format = PICT_FORMAT(0, type, a, r, g, b);
}
- ps = (PictureScreenPtr) malloc(sizeof (PictureScreenRec));
- if (!ps)
- {
- free(formats);
- return FALSE;
+ ps = (PictureScreenPtr) malloc(sizeof(PictureScreenRec));
+ if (!ps) {
+ free(formats);
+ return FALSE;
}
SetPictureScreen(pScreen, ps);
ps->formats = formats;
ps->fallback = formats;
ps->nformats = nformats;
-
+
ps->filters = 0;
ps->nfilters = 0;
ps->filterAliases = 0;
@@ -699,20 +678,19 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
pScreen->CloseScreen = PictureCloseScreen;
pScreen->StoreColors = PictureStoreColors;
- if (!PictureSetDefaultFilters (pScreen))
- {
- PictureResetFilters (pScreen);
- SetPictureScreen(pScreen, 0);
- free(formats);
- free(ps);
- return FALSE;
+ if (!PictureSetDefaultFilters(pScreen)) {
+ PictureResetFilters(pScreen);
+ SetPictureScreen(pScreen, 0);
+ free(formats);
+ free(ps);
+ return FALSE;
}
return TRUE;
}
void
-SetPictureToDefaults (PicturePtr pPicture)
+SetPictureToDefaults(PicturePtr pPicture)
{
pPicture->refcnt = 1;
pPicture->repeat = 0;
@@ -735,7 +713,7 @@ SetPictureToDefaults (PicturePtr pPicture)
pPicture->transform = 0;
- pPicture->filter = PictureGetFilterId (FilterNearest, -1, TRUE);
+ pPicture->filter = PictureGetFilterId(FilterNearest, -1, TRUE);
pPicture->filter_params = 0;
pPicture->filter_nparams = 0;
@@ -745,22 +723,18 @@ SetPictureToDefaults (PicturePtr pPicture)
}
PicturePtr
-CreatePicture (Picture pid,
- DrawablePtr pDrawable,
- PictFormatPtr pFormat,
- Mask vmask,
- XID *vlist,
- ClientPtr client,
- int *error)
+CreatePicture(Picture pid,
+ DrawablePtr pDrawable,
+ PictFormatPtr pFormat,
+ Mask vmask, XID *vlist, ClientPtr client, int *error)
{
- PicturePtr pPicture;
- PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen);
+ PicturePtr pPicture;
+ PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen);
pPicture = dixAllocateObjectWithPrivates(PictureRec, PRIVATE_PICTURE);
- if (!pPicture)
- {
- *error = BadAlloc;
- return 0;
+ if (!pPicture) {
+ *error = BadAlloc;
+ return 0;
}
pPicture->id = pid;
@@ -770,49 +744,46 @@ CreatePicture (Picture pid,
/* security creation/labeling check */
*error = XaceHook(XACE_RESOURCE_ACCESS, client, pid, PictureType, pPicture,
- RT_PIXMAP, pDrawable, DixCreateAccess|DixSetAttrAccess);
+ RT_PIXMAP, pDrawable, DixCreateAccess | DixSetAttrAccess);
if (*error != Success)
- goto out;
+ goto out;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- ++((PixmapPtr)pDrawable)->refcnt;
- pPicture->pNext = 0;
+ if (pDrawable->type == DRAWABLE_PIXMAP) {
+ ++((PixmapPtr) pDrawable)->refcnt;
+ pPicture->pNext = 0;
}
- else
- {
- pPicture->pNext = GetPictureWindow(((WindowPtr) pDrawable));
- SetPictureWindow(((WindowPtr) pDrawable), pPicture);
+ else {
+ pPicture->pNext = GetPictureWindow(((WindowPtr) pDrawable));
+ SetPictureWindow(((WindowPtr) pDrawable), pPicture);
}
- SetPictureToDefaults (pPicture);
-
+ SetPictureToDefaults(pPicture);
+
if (vmask)
- *error = ChangePicture (pPicture, vmask, vlist, 0, client);
+ *error = ChangePicture(pPicture, vmask, vlist, 0, client);
else
- *error = Success;
+ *error = Success;
if (*error == Success)
- *error = (*ps->CreatePicture) (pPicture);
-out:
- if (*error != Success)
- {
- FreePicture (pPicture, (XID) 0);
- pPicture = 0;
+ *error = (*ps->CreatePicture) (pPicture);
+ out:
+ if (*error != Success) {
+ FreePicture(pPicture, (XID) 0);
+ pPicture = 0;
}
return pPicture;
}
-static CARD32 xRenderColorToCard32(xRenderColor c)
+static CARD32
+xRenderColorToCard32(xRenderColor c)
{
return
(c.alpha >> 8 << 24) |
- (c.red >> 8 << 16) |
- (c.green & 0xff00) |
- (c.blue >> 8);
+ (c.red >> 8 << 16) | (c.green & 0xff00) | (c.blue >> 8);
}
-static void initGradient(SourcePictPtr pGradient, int stopCount,
- xFixed *stopPoints, xRenderColor *stopColors, int *error)
+static void
+initGradient(SourcePictPtr pGradient, int stopCount,
+ xFixed * stopPoints, xRenderColor * stopColors, int *error)
{
int i;
xFixed dpos;
@@ -824,14 +795,14 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
dpos = -1;
for (i = 0; i < stopCount; ++i) {
- if (stopPoints[i] < dpos || stopPoints[i] > (1<<16)) {
+ if (stopPoints[i] < dpos || stopPoints[i] > (1 << 16)) {
*error = BadValue;
return;
}
dpos = stopPoints[i];
}
- pGradient->gradient.stops = malloc(stopCount*sizeof(PictGradientStop));
+ pGradient->gradient.stops = malloc(stopCount * sizeof(PictGradientStop));
if (!pGradient->gradient.stops) {
*error = BadAlloc;
return;
@@ -845,9 +816,11 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
}
}
-static PicturePtr createSourcePicture(void)
+static PicturePtr
+createSourcePicture(void)
{
PicturePtr pPicture;
+
pPicture = dixAllocateObjectWithPrivates(PictureRec, PRIVATE_PICTURE);
pPicture->pDrawable = 0;
pPicture->pFormat = 0;
@@ -859,9 +832,10 @@ static PicturePtr createSourcePicture(void)
}
PicturePtr
-CreateSolidPicture (Picture pid, xRenderColor *color, int *error)
+CreateSolidPicture(Picture pid, xRenderColor * color, int *error)
{
PicturePtr pPicture;
+
pPicture = createSourcePicture();
if (!pPicture) {
*error = BadAlloc;
@@ -881,8 +855,9 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error)
}
PicturePtr
-CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2,
- int nStops, xFixed *stops, xRenderColor *colors, int *error)
+CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2,
+ int nStops, xFixed * stops, xRenderColor * colors,
+ int *error)
{
PicturePtr pPicture;
@@ -918,9 +893,10 @@ CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2,
}
PicturePtr
-CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer,
- xFixed innerRadius, xFixed outerRadius,
- int nStops, xFixed *stops, xRenderColor *colors, int *error)
+CreateRadialGradientPicture(Picture pid, xPointFixed * inner,
+ xPointFixed * outer, xFixed innerRadius,
+ xFixed outerRadius, int nStops, xFixed * stops,
+ xRenderColor * colors, int *error)
{
PicturePtr pPicture;
PictRadialGradient *radial;
@@ -952,7 +928,7 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
radial->c2.x = outer->x;
radial->c2.y = outer->y;
radial->c2.radius = outerRadius;
-
+
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
free(pPicture);
@@ -962,8 +938,9 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
}
PicturePtr
-CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle,
- int nStops, xFixed *stops, xRenderColor *colors, int *error)
+CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle,
+ int nStops, xFixed * stops, xRenderColor * colors,
+ int *error)
{
PicturePtr pPicture;
@@ -1003,226 +980,214 @@ CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle,
#define NEXT_PTR(_type) ((_type) ulist++->ptr)
int
-ChangePicture (PicturePtr pPicture,
- Mask vmask,
- XID *vlist,
- DevUnion *ulist,
- ClientPtr client)
+ChangePicture(PicturePtr pPicture,
+ Mask vmask, XID *vlist, DevUnion *ulist, ClientPtr client)
{
ScreenPtr pScreen = pPicture->pDrawable ? pPicture->pDrawable->pScreen : 0;
PictureScreenPtr ps = pScreen ? GetPictureScreen(pScreen) : 0;
- BITS32 index2;
- int error = 0;
- BITS32 maskQ;
-
+ BITS32 index2;
+ int error = 0;
+ BITS32 maskQ;
+
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
maskQ = vmask;
- while (vmask && !error)
- {
- index2 = (BITS32) lowbit (vmask);
- vmask &= ~index2;
- pPicture->stateChanges |= index2;
- switch (index2)
- {
- case CPRepeat:
- {
- unsigned int newr;
- newr = NEXT_VAL(unsigned int);
- if (newr <= RepeatReflect)
- {
- pPicture->repeat = (newr != RepeatNone);
- pPicture->repeatType = newr;
- }
- else
- {
- client->errorValue = newr;
- error = BadValue;
- }
- }
- break;
- case CPAlphaMap:
- {
- PicturePtr pAlpha;
-
- if (vlist)
- {
- Picture pid = NEXT_VAL(Picture);
-
- if (pid == None)
- pAlpha = 0;
- else
- {
- error = dixLookupResourceByType((pointer *)&pAlpha, pid,
- PictureType, client,
- DixReadAccess);
- if (error != Success)
- {
- client->errorValue = pid;
- break;
- }
- if (pAlpha->pDrawable == NULL ||
- pAlpha->pDrawable->type != DRAWABLE_PIXMAP)
- {
- client->errorValue = pid;
- error = BadMatch;
- break;
- }
- }
- }
- else
- pAlpha = NEXT_PTR(PicturePtr);
- if (!error)
- {
- if (pAlpha && pAlpha->pDrawable->type == DRAWABLE_PIXMAP)
- pAlpha->refcnt++;
- if (pPicture->alphaMap)
- FreePicture ((pointer) pPicture->alphaMap, (XID) 0);
- pPicture->alphaMap = pAlpha;
- }
- }
- break;
- case CPAlphaXOrigin:
- pPicture->alphaOrigin.x = NEXT_VAL(INT16);
- break;
- case CPAlphaYOrigin:
- pPicture->alphaOrigin.y = NEXT_VAL(INT16);
- break;
- case CPClipXOrigin:
- pPicture->clipOrigin.x = NEXT_VAL(INT16);
- break;
- case CPClipYOrigin:
- pPicture->clipOrigin.y = NEXT_VAL(INT16);
- break;
- case CPClipMask:
- {
- Pixmap pid;
- PixmapPtr pPixmap;
- int clipType;
- if (!pScreen)
- return BadDrawable;
-
- if (vlist)
- {
- pid = NEXT_VAL(Pixmap);
- if (pid == None)
- {
- clipType = CT_NONE;
- pPixmap = NullPixmap;
- }
- else
- {
- clipType = CT_PIXMAP;
- error = dixLookupResourceByType((pointer *)&pPixmap, pid,
- RT_PIXMAP, client,
- DixReadAccess);
- if (error != Success)
- {
- client->errorValue = pid;
- break;
- }
- }
- }
- else
- {
- pPixmap = NEXT_PTR(PixmapPtr);
- if (pPixmap)
- clipType = CT_PIXMAP;
- else
- clipType = CT_NONE;
- }
-
- if (pPixmap)
- {
- if ((pPixmap->drawable.depth != 1) ||
- (pPixmap->drawable.pScreen != pScreen))
- {
- error = BadMatch;
- break;
- }
- else
- {
- clipType = CT_PIXMAP;
- pPixmap->refcnt++;
- }
- }
- error = (*ps->ChangePictureClip)(pPicture, clipType,
- (pointer)pPixmap, 0);
- break;
- }
- case CPGraphicsExposure:
- {
- unsigned int newe;
- newe = NEXT_VAL(unsigned int);
- if (newe <= xTrue)
- pPicture->graphicsExposures = newe;
- else
- {
- client->errorValue = newe;
- error = BadValue;
- }
- }
- break;
- case CPSubwindowMode:
- {
- unsigned int news;
- news = NEXT_VAL(unsigned int);
- if (news == ClipByChildren || news == IncludeInferiors)
- pPicture->subWindowMode = news;
- else
- {
- client->errorValue = news;
- error = BadValue;
- }
- }
- break;
- case CPPolyEdge:
- {
- unsigned int newe;
- newe = NEXT_VAL(unsigned int);
- if (newe == PolyEdgeSharp || newe == PolyEdgeSmooth)
- pPicture->polyEdge = newe;
- else
- {
- client->errorValue = newe;
- error = BadValue;
- }
- }
- break;
- case CPPolyMode:
- {
- unsigned int newm;
- newm = NEXT_VAL(unsigned int);
- if (newm == PolyModePrecise || newm == PolyModeImprecise)
- pPicture->polyMode = newm;
- else
- {
- client->errorValue = newm;
- error = BadValue;
- }
- }
- break;
- case CPDither:
- (void) NEXT_VAL(Atom); /* unimplemented */
- break;
- case CPComponentAlpha:
- {
- unsigned int newca;
-
- newca = NEXT_VAL (unsigned int);
- if (newca <= xTrue)
- pPicture->componentAlpha = newca;
- else
- {
- client->errorValue = newca;
- error = BadValue;
- }
- }
- break;
- default:
- client->errorValue = maskQ;
- error = BadValue;
- break;
- }
+ while (vmask && !error) {
+ index2 = (BITS32) lowbit(vmask);
+ vmask &= ~index2;
+ pPicture->stateChanges |= index2;
+ switch (index2) {
+ case CPRepeat:
+ {
+ unsigned int newr;
+ newr = NEXT_VAL(unsigned int);
+
+ if (newr <= RepeatReflect) {
+ pPicture->repeat = (newr != RepeatNone);
+ pPicture->repeatType = newr;
+ }
+ else {
+ client->errorValue = newr;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPAlphaMap:
+ {
+ PicturePtr pAlpha;
+
+ if (vlist) {
+ Picture pid = NEXT_VAL(Picture);
+
+ if (pid == None)
+ pAlpha = 0;
+ else {
+ error = dixLookupResourceByType((pointer *) &pAlpha, pid,
+ PictureType, client,
+ DixReadAccess);
+ if (error != Success) {
+ client->errorValue = pid;
+ break;
+ }
+ if (pAlpha->pDrawable == NULL ||
+ pAlpha->pDrawable->type != DRAWABLE_PIXMAP) {
+ client->errorValue = pid;
+ error = BadMatch;
+ break;
+ }
+ }
+ }
+ else
+ pAlpha = NEXT_PTR(PicturePtr);
+ if (!error) {
+ if (pAlpha && pAlpha->pDrawable->type == DRAWABLE_PIXMAP)
+ pAlpha->refcnt++;
+ if (pPicture->alphaMap)
+ FreePicture((pointer) pPicture->alphaMap, (XID) 0);
+ pPicture->alphaMap = pAlpha;
+ }
+ }
+ break;
+ case CPAlphaXOrigin:
+ pPicture->alphaOrigin.x = NEXT_VAL(INT16);
+
+ break;
+ case CPAlphaYOrigin:
+ pPicture->alphaOrigin.y = NEXT_VAL(INT16);
+
+ break;
+ case CPClipXOrigin:
+ pPicture->clipOrigin.x = NEXT_VAL(INT16);
+
+ break;
+ case CPClipYOrigin:
+ pPicture->clipOrigin.y = NEXT_VAL(INT16);
+
+ break;
+ case CPClipMask:
+ {
+ Pixmap pid;
+ PixmapPtr pPixmap;
+ int clipType;
+
+ if (!pScreen)
+ return BadDrawable;
+
+ if (vlist) {
+ pid = NEXT_VAL(Pixmap);
+ if (pid == None) {
+ clipType = CT_NONE;
+ pPixmap = NullPixmap;
+ }
+ else {
+ clipType = CT_PIXMAP;
+ error = dixLookupResourceByType((pointer *) &pPixmap, pid,
+ RT_PIXMAP, client,
+ DixReadAccess);
+ if (error != Success) {
+ client->errorValue = pid;
+ break;
+ }
+ }
+ }
+ else {
+ pPixmap = NEXT_PTR(PixmapPtr);
+
+ if (pPixmap)
+ clipType = CT_PIXMAP;
+ else
+ clipType = CT_NONE;
+ }
+
+ if (pPixmap) {
+ if ((pPixmap->drawable.depth != 1) ||
+ (pPixmap->drawable.pScreen != pScreen)) {
+ error = BadMatch;
+ break;
+ }
+ else {
+ clipType = CT_PIXMAP;
+ pPixmap->refcnt++;
+ }
+ }
+ error = (*ps->ChangePictureClip) (pPicture, clipType,
+ (pointer) pPixmap, 0);
+ break;
+ }
+ case CPGraphicsExposure:
+ {
+ unsigned int newe;
+ newe = NEXT_VAL(unsigned int);
+
+ if (newe <= xTrue)
+ pPicture->graphicsExposures = newe;
+ else {
+ client->errorValue = newe;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPSubwindowMode:
+ {
+ unsigned int news;
+ news = NEXT_VAL(unsigned int);
+
+ if (news == ClipByChildren || news == IncludeInferiors)
+ pPicture->subWindowMode = news;
+ else {
+ client->errorValue = news;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPPolyEdge:
+ {
+ unsigned int newe;
+ newe = NEXT_VAL(unsigned int);
+
+ if (newe == PolyEdgeSharp || newe == PolyEdgeSmooth)
+ pPicture->polyEdge = newe;
+ else {
+ client->errorValue = newe;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPPolyMode:
+ {
+ unsigned int newm;
+ newm = NEXT_VAL(unsigned int);
+
+ if (newm == PolyModePrecise || newm == PolyModeImprecise)
+ pPicture->polyMode = newm;
+ else {
+ client->errorValue = newm;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPDither:
+ (void) NEXT_VAL(Atom); /* unimplemented */
+
+ break;
+ case CPComponentAlpha:
+ {
+ unsigned int newca;
+
+ newca = NEXT_VAL(unsigned int);
+
+ if (newca <= xTrue)
+ pPicture->componentAlpha = newca;
+ else {
+ client->errorValue = newca;
+ error = BadValue;
+ }
+ }
+ break;
+ default:
+ client->errorValue = maskQ;
+ error = BadValue;
+ break;
+ }
}
if (ps)
(*ps->ChangePicture) (pPicture, maskQ);
@@ -1230,77 +1195,66 @@ ChangePicture (PicturePtr pPicture,
}
int
-SetPictureClipRects (PicturePtr pPicture,
- int xOrigin,
- int yOrigin,
- int nRect,
- xRectangle *rects)
+SetPictureClipRects(PicturePtr pPicture,
+ int xOrigin, int yOrigin, int nRect, xRectangle *rects)
{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- RegionPtr clientClip;
- int result;
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ RegionPtr clientClip;
+ int result;
clientClip = RegionFromRects(nRect, rects, CT_UNSORTED);
if (!clientClip)
- return BadAlloc;
- result =(*ps->ChangePictureClip) (pPicture, CT_REGION,
- (pointer) clientClip, 0);
- if (result == Success)
- {
- pPicture->clipOrigin.x = xOrigin;
- pPicture->clipOrigin.y = yOrigin;
- pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask;
- pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ return BadAlloc;
+ result = (*ps->ChangePictureClip) (pPicture, CT_REGION,
+ (pointer) clientClip, 0);
+ if (result == Success) {
+ pPicture->clipOrigin.x = xOrigin;
+ pPicture->clipOrigin.y = yOrigin;
+ pPicture->stateChanges |= CPClipXOrigin | CPClipYOrigin | CPClipMask;
+ pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
}
return result;
}
int
-SetPictureClipRegion (PicturePtr pPicture,
- int xOrigin,
- int yOrigin,
- RegionPtr pRegion)
+SetPictureClipRegion(PicturePtr pPicture,
+ int xOrigin, int yOrigin, RegionPtr pRegion)
{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- RegionPtr clientClip;
- int result;
- int type;
-
- if (pRegion)
- {
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ RegionPtr clientClip;
+ int result;
+ int type;
+
+ if (pRegion) {
type = CT_REGION;
clientClip = RegionCreate(RegionExtents(pRegion),
RegionNumRects(pRegion));
if (!clientClip)
return BadAlloc;
- if (!RegionCopy(clientClip, pRegion))
- {
+ if (!RegionCopy(clientClip, pRegion)) {
RegionDestroy(clientClip);
return BadAlloc;
}
}
- else
- {
+ else {
type = CT_NONE;
clientClip = 0;
}
- result =(*ps->ChangePictureClip) (pPicture, type,
- (pointer) clientClip, 0);
- if (result == Success)
- {
+ result = (*ps->ChangePictureClip) (pPicture, type, (pointer) clientClip, 0);
+ if (result == Success) {
pPicture->clipOrigin.x = xOrigin;
pPicture->clipOrigin.y = yOrigin;
- pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask;
+ pPicture->stateChanges |= CPClipXOrigin | CPClipYOrigin | CPClipMask;
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
}
return result;
}
static Bool
-transformIsIdentity(PictTransform *t)
+transformIsIdentity(PictTransform * t)
{
return ((t->matrix[0][0] == t->matrix[1][1]) &&
(t->matrix[0][0] == t->matrix[2][2]) &&
@@ -1309,50 +1263,44 @@ transformIsIdentity(PictTransform *t)
(t->matrix[0][2] == 0) &&
(t->matrix[1][0] == 0) &&
(t->matrix[1][2] == 0) &&
- (t->matrix[2][0] == 0) &&
- (t->matrix[2][1] == 0));
+ (t->matrix[2][0] == 0) && (t->matrix[2][1] == 0));
}
int
-SetPictureTransform (PicturePtr pPicture,
- PictTransform *transform)
+SetPictureTransform(PicturePtr pPicture, PictTransform * transform)
{
- if (transform && transformIsIdentity (transform))
- transform = 0;
-
- if (transform)
- {
- if (!pPicture->transform)
- {
- pPicture->transform = (PictTransform *) malloc(sizeof (PictTransform));
- if (!pPicture->transform)
- return BadAlloc;
- }
- *pPicture->transform = *transform;
+ if (transform && transformIsIdentity(transform))
+ transform = 0;
+
+ if (transform) {
+ if (!pPicture->transform) {
+ pPicture->transform =
+ (PictTransform *) malloc(sizeof(PictTransform));
+ if (!pPicture->transform)
+ return BadAlloc;
+ }
+ *pPicture->transform = *transform;
}
- else
- {
- free(pPicture->transform);
- pPicture->transform = NULL;
+ else {
+ free(pPicture->transform);
+ pPicture->transform = NULL;
}
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
if (pPicture->pDrawable != NULL) {
- int result;
- PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
+ int result;
+ PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
- result = (*ps->ChangePictureTransform) (pPicture, transform);
+ result = (*ps->ChangePictureTransform) (pPicture, transform);
- return result;
+ return result;
}
return Success;
}
void
-CopyPicture (PicturePtr pSrc,
- Mask mask,
- PicturePtr pDst)
+CopyPicture(PicturePtr pSrc, Mask mask, PicturePtr pDst)
{
PictureScreenPtr ps = GetPictureScreen(pSrc->pDrawable->pScreen);
Mask origMask = mask;
@@ -1361,155 +1309,145 @@ CopyPicture (PicturePtr pSrc,
pDst->stateChanges |= mask;
while (mask) {
- Mask bit = lowbit(mask);
-
- switch (bit)
- {
- case CPRepeat:
- pDst->repeat = pSrc->repeat;
- pDst->repeatType = pSrc->repeatType;
- break;
- case CPAlphaMap:
- if (pSrc->alphaMap && pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP)
- pSrc->alphaMap->refcnt++;
- if (pDst->alphaMap)
- FreePicture ((pointer) pDst->alphaMap, (XID) 0);
- pDst->alphaMap = pSrc->alphaMap;
- break;
- case CPAlphaXOrigin:
- pDst->alphaOrigin.x = pSrc->alphaOrigin.x;
- break;
- case CPAlphaYOrigin:
- pDst->alphaOrigin.y = pSrc->alphaOrigin.y;
- break;
- case CPClipXOrigin:
- pDst->clipOrigin.x = pSrc->clipOrigin.x;
- break;
- case CPClipYOrigin:
- pDst->clipOrigin.y = pSrc->clipOrigin.y;
- break;
- case CPClipMask:
- switch (pSrc->clientClipType) {
- case CT_NONE:
- (*ps->ChangePictureClip)(pDst, CT_NONE, NULL, 0);
- break;
- case CT_REGION:
- if (!pSrc->clientClip) {
- (*ps->ChangePictureClip)(pDst, CT_NONE, NULL, 0);
- } else {
- RegionPtr clientClip;
- RegionPtr srcClientClip = (RegionPtr)pSrc->clientClip;
-
- clientClip = RegionCreate(
- RegionExtents(srcClientClip),
- RegionNumRects(srcClientClip));
- (*ps->ChangePictureClip)(pDst, CT_REGION, clientClip, 0);
- }
- break;
- default:
- /* XXX: CT_PIXMAP unimplemented */
- break;
- }
- break;
- case CPGraphicsExposure:
- pDst->graphicsExposures = pSrc->graphicsExposures;
- break;
- case CPPolyEdge:
- pDst->polyEdge = pSrc->polyEdge;
- break;
- case CPPolyMode:
- pDst->polyMode = pSrc->polyMode;
- break;
- case CPDither:
- break;
- case CPComponentAlpha:
- pDst->componentAlpha = pSrc->componentAlpha;
- break;
- }
- mask &= ~bit;
+ Mask bit = lowbit(mask);
+
+ switch (bit) {
+ case CPRepeat:
+ pDst->repeat = pSrc->repeat;
+ pDst->repeatType = pSrc->repeatType;
+ break;
+ case CPAlphaMap:
+ if (pSrc->alphaMap &&
+ pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP)
+ pSrc->alphaMap->refcnt++;
+ if (pDst->alphaMap)
+ FreePicture((pointer) pDst->alphaMap, (XID) 0);
+ pDst->alphaMap = pSrc->alphaMap;
+ break;
+ case CPAlphaXOrigin:
+ pDst->alphaOrigin.x = pSrc->alphaOrigin.x;
+ break;
+ case CPAlphaYOrigin:
+ pDst->alphaOrigin.y = pSrc->alphaOrigin.y;
+ break;
+ case CPClipXOrigin:
+ pDst->clipOrigin.x = pSrc->clipOrigin.x;
+ break;
+ case CPClipYOrigin:
+ pDst->clipOrigin.y = pSrc->clipOrigin.y;
+ break;
+ case CPClipMask:
+ switch (pSrc->clientClipType) {
+ case CT_NONE:
+ (*ps->ChangePictureClip) (pDst, CT_NONE, NULL, 0);
+ break;
+ case CT_REGION:
+ if (!pSrc->clientClip) {
+ (*ps->ChangePictureClip) (pDst, CT_NONE, NULL, 0);
+ }
+ else {
+ RegionPtr clientClip;
+ RegionPtr srcClientClip = (RegionPtr) pSrc->clientClip;
+
+ clientClip = RegionCreate(RegionExtents(srcClientClip),
+ RegionNumRects(srcClientClip));
+ (*ps->ChangePictureClip) (pDst, CT_REGION, clientClip, 0);
+ }
+ break;
+ default:
+ /* XXX: CT_PIXMAP unimplemented */
+ break;
+ }
+ break;
+ case CPGraphicsExposure:
+ pDst->graphicsExposures = pSrc->graphicsExposures;
+ break;
+ case CPPolyEdge:
+ pDst->polyEdge = pSrc->polyEdge;
+ break;
+ case CPPolyMode:
+ pDst->polyMode = pSrc->polyMode;
+ break;
+ case CPDither:
+ break;
+ case CPComponentAlpha:
+ pDst->componentAlpha = pSrc->componentAlpha;
+ break;
+ }
+ mask &= ~bit;
}
- (*ps->ChangePicture)(pDst, origMask);
+ (*ps->ChangePicture) (pDst, origMask);
}
static void
-ValidateOnePicture (PicturePtr pPicture)
+ValidateOnePicture(PicturePtr pPicture)
{
- if (pPicture->pDrawable && pPicture->serialNumber != pPicture->pDrawable->serialNumber)
- {
- PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
+ if (pPicture->pDrawable &&
+ pPicture->serialNumber != pPicture->pDrawable->serialNumber) {
+ PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
- (*ps->ValidatePicture) (pPicture, pPicture->stateChanges);
- pPicture->stateChanges = 0;
- pPicture->serialNumber = pPicture->pDrawable->serialNumber;
+ (*ps->ValidatePicture) (pPicture, pPicture->stateChanges);
+ pPicture->stateChanges = 0;
+ pPicture->serialNumber = pPicture->pDrawable->serialNumber;
}
}
void
ValidatePicture(PicturePtr pPicture)
{
- ValidateOnePicture (pPicture);
+ ValidateOnePicture(pPicture);
if (pPicture->alphaMap)
- ValidateOnePicture (pPicture->alphaMap);
+ ValidateOnePicture(pPicture->alphaMap);
}
int
-FreePicture (pointer value,
- XID pid)
+FreePicture(pointer value, XID pid)
{
- PicturePtr pPicture = (PicturePtr) value;
+ PicturePtr pPicture = (PicturePtr) value;
- if (--pPicture->refcnt == 0)
- {
- free(pPicture->transform);
+ if (--pPicture->refcnt == 0) {
+ free(pPicture->transform);
- if (pPicture->pSourcePict)
- {
- if (pPicture->pSourcePict->type != SourcePictTypeSolidFill)
- free(pPicture->pSourcePict->linear.stops);
+ if (pPicture->pSourcePict) {
+ if (pPicture->pSourcePict->type != SourcePictTypeSolidFill)
+ free(pPicture->pSourcePict->linear.stops);
- free(pPicture->pSourcePict);
- }
+ free(pPicture->pSourcePict);
+ }
+
+ if (pPicture->pDrawable) {
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
- if (pPicture->pDrawable)
- {
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
if (pPicture->alphaMap)
- FreePicture ((pointer) pPicture->alphaMap, (XID) 0);
+ FreePicture((pointer) pPicture->alphaMap, (XID) 0);
(*ps->DestroyPicture) (pPicture);
(*ps->DestroyPictureClip) (pPicture);
- if (pPicture->pDrawable->type == DRAWABLE_WINDOW)
- {
- WindowPtr pWindow = (WindowPtr) pPicture->pDrawable;
- PicturePtr *pPrev;
-
- for (pPrev = (PicturePtr *)dixLookupPrivateAddr
- (&pWindow->devPrivates, PictureWindowPrivateKey);
- *pPrev;
- pPrev = &(*pPrev)->pNext)
- {
- if (*pPrev == pPicture)
- {
+ if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWindow = (WindowPtr) pPicture->pDrawable;
+ PicturePtr *pPrev;
+
+ for (pPrev = (PicturePtr *) dixLookupPrivateAddr
+ (&pWindow->devPrivates, PictureWindowPrivateKey);
+ *pPrev; pPrev = &(*pPrev)->pNext) {
+ if (*pPrev == pPicture) {
*pPrev = pPicture->pNext;
break;
}
}
}
- else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP)
- {
- (*pScreen->DestroyPixmap) ((PixmapPtr)pPicture->pDrawable);
+ else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP) {
+ (*pScreen->DestroyPixmap) ((PixmapPtr) pPicture->pDrawable);
}
}
- dixFreeObjectWithPrivates(pPicture, PRIVATE_PICTURE);
+ dixFreeObjectWithPrivates(pPicture, PRIVATE_PICTURE);
}
return Success;
}
int
-FreePictFormat (pointer pPictFormat,
- XID pid)
+FreePictFormat(pointer pPictFormat, XID pid)
{
return Success;
}
@@ -1521,8 +1459,8 @@ FreePictFormat (pointer pPictFormat,
* being careful to avoid these cases.
*/
static CARD8
-ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc, CARD16 width, CARD16 height)
+ReduceCompositeOp(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, CARD16 width, CARD16 height)
{
Bool no_src_alpha, no_dst_alpha;
@@ -1533,228 +1471,197 @@ ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
* picture.
*/
no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) &&
- PICT_FORMAT_A(pSrc->format) == 0 &&
- (pSrc->repeatType != RepeatNone ||
- (!pSrc->transform &&
- xSrc >= 0 && ySrc >= 0 &&
- xSrc + width <= pSrc->pDrawable->width &&
- ySrc + height <= pSrc->pDrawable->height)) &&
- pSrc->alphaMap == NULL &&
- pMask == NULL;
+ PICT_FORMAT_A(pSrc->format) == 0 &&
+ (pSrc->repeatType != RepeatNone ||
+ (!pSrc->transform &&
+ xSrc >= 0 && ySrc >= 0 &&
+ xSrc + width <= pSrc->pDrawable->width &&
+ ySrc + height <= pSrc->pDrawable->height)) &&
+ pSrc->alphaMap == NULL && pMask == NULL;
no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) &&
- PICT_FORMAT_A(pDst->format) == 0 &&
- pDst->alphaMap == NULL;
+ PICT_FORMAT_A(pDst->format) == 0 && pDst->alphaMap == NULL;
/* TODO, maybe: Conjoint and Disjoint op reductions? */
-
+
/* Deal with simplifications where the source alpha is always 1. */
- if (no_src_alpha)
- {
- switch (op) {
- case PictOpOver:
- op = PictOpSrc;
- break;
- case PictOpInReverse:
- op = PictOpDst;
- break;
- case PictOpOutReverse:
- op = PictOpClear;
- break;
- case PictOpAtop:
- op = PictOpIn;
- break;
- case PictOpAtopReverse:
- op = PictOpOverReverse;
- break;
- case PictOpXor:
- op = PictOpOut;
- break;
- default:
- break;
- }
+ if (no_src_alpha) {
+ switch (op) {
+ case PictOpOver:
+ op = PictOpSrc;
+ break;
+ case PictOpInReverse:
+ op = PictOpDst;
+ break;
+ case PictOpOutReverse:
+ op = PictOpClear;
+ break;
+ case PictOpAtop:
+ op = PictOpIn;
+ break;
+ case PictOpAtopReverse:
+ op = PictOpOverReverse;
+ break;
+ case PictOpXor:
+ op = PictOpOut;
+ break;
+ default:
+ break;
+ }
}
/* Deal with simplifications when the destination alpha is always 1 */
- if (no_dst_alpha)
- {
- switch (op) {
- case PictOpOverReverse:
- op = PictOpDst;
- break;
- case PictOpIn:
- op = PictOpSrc;
- break;
- case PictOpOut:
- op = PictOpClear;
- break;
- case PictOpAtop:
- op = PictOpOver;
- break;
- case PictOpXor:
- op = PictOpOutReverse;
- break;
- default:
- break;
- }
+ if (no_dst_alpha) {
+ switch (op) {
+ case PictOpOverReverse:
+ op = PictOpDst;
+ break;
+ case PictOpIn:
+ op = PictOpSrc;
+ break;
+ case PictOpOut:
+ op = PictOpClear;
+ break;
+ case PictOpAtop:
+ op = PictOpOver;
+ break;
+ case PictOpXor:
+ op = PictOpOutReverse;
+ break;
+ default:
+ break;
+ }
}
/* Reduce some con/disjoint ops to the basic names. */
switch (op) {
case PictOpDisjointClear:
case PictOpConjointClear:
- op = PictOpClear;
- break;
+ op = PictOpClear;
+ break;
case PictOpDisjointSrc:
case PictOpConjointSrc:
- op = PictOpSrc;
- break;
+ op = PictOpSrc;
+ break;
case PictOpDisjointDst:
case PictOpConjointDst:
- op = PictOpDst;
- break;
+ op = PictOpDst;
+ break;
default:
- break;
+ break;
}
return op;
}
void
-CompositePicture (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+CompositePicture(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+
+ ValidatePicture(pSrc);
if (pMask)
- ValidatePicture (pMask);
- ValidatePicture (pDst);
+ ValidatePicture(pMask);
+ ValidatePicture(pDst);
- op = ReduceCompositeOp (op, pSrc, pMask, pDst, xSrc, ySrc, width, height);
+ op = ReduceCompositeOp(op, pSrc, pMask, pDst, xSrc, ySrc, width, height);
if (op == PictOpDst)
- return;
+ return;
(*ps->Composite) (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
+ pSrc,
+ pMask,
+ pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
}
void
-CompositeRects (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects)
+CompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color, int nRect, xRectangle *rects)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pDst);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+
+ ValidatePicture(pDst);
(*ps->CompositeRects) (op, pDst, color, nRect, rects);
}
void
-CompositeTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps)
+CompositeTrapezoids(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+
+ ValidatePicture(pSrc);
+ ValidatePicture(pDst);
(*ps->Trapezoids) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, traps);
}
void
-CompositeTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntriangles,
- xTriangle *triangles)
+CompositeTriangles(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int ntriangles, xTriangle * triangles)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
- (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntriangles, triangles);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+
+ ValidatePicture(pSrc);
+ ValidatePicture(pDst);
+ (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntriangles,
+ triangles);
}
void
-CompositeTriStrip (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points)
+CompositeTriStrip(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
if (npoints < 3)
return;
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
+ ValidatePicture(pSrc);
+ ValidatePicture(pDst);
(*ps->TriStrip) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points);
}
void
-CompositeTriFan (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points)
+CompositeTriFan(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
if (npoints < 3)
- return;
+ return;
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
+ ValidatePicture(pSrc);
+ ValidatePicture(pDst);
(*ps->TriFan) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points);
}
void
-AddTraps (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntrap,
- xTrap *traps)
+AddTraps(PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntrap, xTrap * traps)
{
- PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
-
- ValidatePicture (pPicture);
+ PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
+
+ ValidatePicture(pPicture);
(*ps->AddTraps) (pPicture, xOff, yOff, ntrap, traps);
}
-
diff --git a/xorg-server/render/picturestr.h b/xorg-server/render/picturestr.h
index 9b376710e..cd4ec498c 100644
--- a/xorg-server/render/picturestr.h
+++ b/xorg-server/render/picturestr.h
@@ -30,27 +30,27 @@
#include "privates.h"
typedef struct _DirectFormat {
- CARD16 red, redMask;
- CARD16 green, greenMask;
- CARD16 blue, blueMask;
- CARD16 alpha, alphaMask;
+ CARD16 red, redMask;
+ CARD16 green, greenMask;
+ CARD16 blue, blueMask;
+ CARD16 alpha, alphaMask;
} DirectFormatRec;
typedef struct _IndexFormat {
- VisualID vid;
- ColormapPtr pColormap;
- int nvalues;
- xIndexValue *pValues;
- void *devPrivate;
+ VisualID vid;
+ ColormapPtr pColormap;
+ int nvalues;
+ xIndexValue *pValues;
+ void *devPrivate;
} IndexFormatRec;
typedef struct _PictFormat {
- CARD32 id;
- CARD32 format; /* except bpp */
- unsigned char type;
- unsigned char depth;
+ CARD32 id;
+ CARD32 format; /* except bpp */
+ unsigned char type;
+ unsigned char depth;
DirectFormatRec direct;
- IndexFormatRec index;
+ IndexFormatRec index;
} PictFormatRec;
typedef struct pixman_vector PictVector, *PictVectorPtr;
@@ -121,53 +121,53 @@ typedef union _SourcePict {
} SourcePict, *SourcePictPtr;
typedef struct _Picture {
- DrawablePtr pDrawable;
- PictFormatPtr pFormat;
- PictFormatShort format; /* PICT_FORMAT */
- int refcnt;
- CARD32 id;
- unsigned int repeat : 1;
- unsigned int graphicsExposures : 1;
- unsigned int subWindowMode : 1;
- unsigned int polyEdge : 1;
- unsigned int polyMode : 1;
- unsigned int freeCompClip : 1;
- unsigned int clientClipType : 2;
- unsigned int componentAlpha : 1;
- unsigned int repeatType : 2;
- unsigned int filter : 3;
- unsigned int stateChanges : CPLastBit;
- unsigned int unused : 18 - CPLastBit;
-
- PicturePtr pNext; /* chain on same drawable */
-
- PicturePtr alphaMap;
- DDXPointRec alphaOrigin;
-
- DDXPointRec clipOrigin;
- pointer clientClip;
-
- unsigned long serialNumber;
-
- RegionPtr pCompositeClip;
-
- PrivateRec *devPrivates;
-
- PictTransform *transform;
-
- SourcePictPtr pSourcePict;
- xFixed *filter_params;
- int filter_nparams;
+ DrawablePtr pDrawable;
+ PictFormatPtr pFormat;
+ PictFormatShort format; /* PICT_FORMAT */
+ int refcnt;
+ CARD32 id;
+ unsigned int repeat:1;
+ unsigned int graphicsExposures:1;
+ unsigned int subWindowMode:1;
+ unsigned int polyEdge:1;
+ unsigned int polyMode:1;
+ unsigned int freeCompClip:1;
+ unsigned int clientClipType:2;
+ unsigned int componentAlpha:1;
+ unsigned int repeatType:2;
+ unsigned int filter:3;
+ unsigned int stateChanges:CPLastBit;
+ unsigned int unused:18 - CPLastBit;
+
+ PicturePtr pNext; /* chain on same drawable */
+
+ PicturePtr alphaMap;
+ DDXPointRec alphaOrigin;
+
+ DDXPointRec clipOrigin;
+ pointer clientClip;
+
+ unsigned long serialNumber;
+
+ RegionPtr pCompositeClip;
+
+ PrivateRec *devPrivates;
+
+ PictTransform *transform;
+
+ SourcePictPtr pSourcePict;
+ xFixed *filter_params;
+ int filter_nparams;
} PictureRec;
typedef Bool (*PictFilterValidateParamsProcPtr) (ScreenPtr pScreen, int id,
- xFixed *params, int nparams,
- int *width, int *height);
+ xFixed * params, int nparams,
+ int *width, int *height);
typedef struct {
- char *name;
- int id;
+ char *name;
+ int id;
PictFilterValidateParamsProcPtr ValidateParams;
- int width, height;
+ int width, height;
} PictFilterRec, *PictFilterPtr;
#define PictFilterNearest 0
@@ -181,205 +181,180 @@ typedef struct {
/* if you add an 8th filter, expand the filter bitfield above */
typedef struct {
- char *alias;
- int alias_id;
- int filter_id;
+ char *alias;
+ int alias_id;
+ int filter_id;
} PictFilterAliasRec, *PictFilterAliasPtr;
-typedef int (*CreatePictureProcPtr) (PicturePtr pPicture);
-typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture);
-typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture,
- int clipType,
- pointer value,
- int n);
-typedef void (*DestroyPictureClipProcPtr)(PicturePtr pPicture);
-
-typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture,
- PictTransform *transform);
-
-typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture,
- int filter,
- xFixed *params,
- int nparams);
-
-typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture);
-
-typedef void (*ChangePictureProcPtr) (PicturePtr pPicture,
- Mask mask);
-typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture,
- Mask mask);
-typedef void (*CompositeProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-typedef void (*GlyphsProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlists,
- GlyphListPtr lists,
- GlyphPtr *glyphs);
-
-typedef void (*CompositeRectsProcPtr) (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects);
-
-typedef void (*RasterizeTrapezoidProcPtr)(PicturePtr pMask,
- xTrapezoid *trap,
- int x_off,
- int y_off);
-
-typedef void (*TrapezoidsProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps);
-
-typedef void (*TrianglesProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntri,
- xTriangle *tris);
-
-typedef void (*TriStripProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoint,
- xPointFixed *points);
-
-typedef void (*TriFanProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoint,
- xPointFixed *points);
-
-typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen,
- PictFormatPtr pFormat);
-
-typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen,
- PictFormatPtr pFormat);
-
-typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen,
- PictFormatPtr pFormat,
- int ndef,
- xColorItem *pdef);
-
-typedef void (*AddTrapsProcPtr) (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntrap,
- xTrap *traps);
-
-typedef void (*AddTrianglesProcPtr) (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntri,
- xTriangle *tris);
-
-typedef Bool (*RealizeGlyphProcPtr) (ScreenPtr pScreen,
- GlyphPtr glyph);
-
-typedef void (*UnrealizeGlyphProcPtr) (ScreenPtr pScreen,
- GlyphPtr glyph);
+typedef int (*CreatePictureProcPtr) (PicturePtr pPicture);
+typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture);
+typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture,
+ int clipType, pointer value, int n);
+typedef void (*DestroyPictureClipProcPtr) (PicturePtr pPicture);
+
+typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture,
+ PictTransform * transform);
+
+typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture,
+ int filter,
+ xFixed * params, int nparams);
+
+typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture);
+
+typedef void (*ChangePictureProcPtr) (PicturePtr pPicture, Mask mask);
+typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture, Mask mask);
+typedef void (*CompositeProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height);
+
+typedef void (*GlyphsProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlists,
+ GlyphListPtr lists, GlyphPtr * glyphs);
+
+typedef void (*CompositeRectsProcPtr) (CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color,
+ int nRect, xRectangle *rects);
+
+typedef void (*RasterizeTrapezoidProcPtr) (PicturePtr pMask,
+ xTrapezoid * trap,
+ int x_off, int y_off);
+
+typedef void (*TrapezoidsProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int ntrap, xTrapezoid * traps);
+
+typedef void (*TrianglesProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int ntri, xTriangle * tris);
+
+typedef void (*TriStripProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int npoint, xPointFixed * points);
+
+typedef void (*TriFanProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int npoint, xPointFixed * points);
+
+typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat);
+
+typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat);
+
+typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen,
+ PictFormatPtr pFormat,
+ int ndef, xColorItem * pdef);
+
+typedef void (*AddTrapsProcPtr) (PicturePtr pPicture,
+ INT16 xOff,
+ INT16 yOff, int ntrap, xTrap * traps);
+
+typedef void (*AddTrianglesProcPtr) (PicturePtr pPicture,
+ INT16 xOff,
+ INT16 yOff, int ntri, xTriangle * tris);
+
+typedef Bool (*RealizeGlyphProcPtr) (ScreenPtr pScreen, GlyphPtr glyph);
+
+typedef void (*UnrealizeGlyphProcPtr) (ScreenPtr pScreen, GlyphPtr glyph);
typedef struct _PictureScreen {
- PictFormatPtr formats;
- PictFormatPtr fallback;
- int nformats;
+ PictFormatPtr formats;
+ PictFormatPtr fallback;
+ int nformats;
- CreatePictureProcPtr CreatePicture;
- DestroyPictureProcPtr DestroyPicture;
- ChangePictureClipProcPtr ChangePictureClip;
- DestroyPictureClipProcPtr DestroyPictureClip;
+ CreatePictureProcPtr CreatePicture;
+ DestroyPictureProcPtr DestroyPicture;
+ ChangePictureClipProcPtr ChangePictureClip;
+ DestroyPictureClipProcPtr DestroyPictureClip;
- ChangePictureProcPtr ChangePicture;
- ValidatePictureProcPtr ValidatePicture;
+ ChangePictureProcPtr ChangePicture;
+ ValidatePictureProcPtr ValidatePicture;
- CompositeProcPtr Composite;
- GlyphsProcPtr Glyphs; /* unused */
- CompositeRectsProcPtr CompositeRects;
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs; /* unused */
+ CompositeRectsProcPtr CompositeRects;
- DestroyWindowProcPtr DestroyWindow;
- CloseScreenProcPtr CloseScreen;
+ DestroyWindowProcPtr DestroyWindow;
+ CloseScreenProcPtr CloseScreen;
- StoreColorsProcPtr StoreColors;
+ StoreColorsProcPtr StoreColors;
- InitIndexedProcPtr InitIndexed;
- CloseIndexedProcPtr CloseIndexed;
- UpdateIndexedProcPtr UpdateIndexed;
+ InitIndexedProcPtr InitIndexed;
+ CloseIndexedProcPtr CloseIndexed;
+ UpdateIndexedProcPtr UpdateIndexed;
- int subpixel;
+ int subpixel;
- PictFilterPtr filters;
- int nfilters;
- PictFilterAliasPtr filterAliases;
- int nfilterAliases;
+ PictFilterPtr filters;
+ int nfilters;
+ PictFilterAliasPtr filterAliases;
+ int nfilterAliases;
/**
* Called immediately after a picture's transform is changed through the
* SetPictureTransform request. Not called for source-only pictures.
*/
- ChangePictureTransformProcPtr ChangePictureTransform;
+ ChangePictureTransformProcPtr ChangePictureTransform;
/**
* Called immediately after a picture's transform is changed through the
* SetPictureFilter request. Not called for source-only pictures.
*/
- ChangePictureFilterProcPtr ChangePictureFilter;
+ ChangePictureFilterProcPtr ChangePictureFilter;
- DestroyPictureFilterProcPtr DestroyPictureFilter;
+ DestroyPictureFilterProcPtr DestroyPictureFilter;
- TrapezoidsProcPtr Trapezoids;
- TrianglesProcPtr Triangles;
+ TrapezoidsProcPtr Trapezoids;
+ TrianglesProcPtr Triangles;
- RasterizeTrapezoidProcPtr RasterizeTrapezoid;
+ RasterizeTrapezoidProcPtr RasterizeTrapezoid;
- AddTrianglesProcPtr AddTriangles;
+ AddTrianglesProcPtr AddTriangles;
- AddTrapsProcPtr AddTraps;
+ AddTrapsProcPtr AddTraps;
- RealizeGlyphProcPtr RealizeGlyph;
- UnrealizeGlyphProcPtr UnrealizeGlyph;
+ RealizeGlyphProcPtr RealizeGlyph;
+ UnrealizeGlyphProcPtr UnrealizeGlyph;
#define PICTURE_SCREEN_VERSION 2
- TriStripProcPtr TriStrip;
- TriFanProcPtr TriFan;
+ TriStripProcPtr TriStrip;
+ TriFanProcPtr TriFan;
} PictureScreenRec, *PictureScreenPtr;
extern _X_EXPORT DevPrivateKeyRec PictureScreenPrivateKeyRec;
+
#define PictureScreenPrivateKey (&PictureScreenPrivateKeyRec)
extern _X_EXPORT DevPrivateKeyRec PictureWindowPrivateKeyRec;
+
#define PictureWindowPrivateKey (&PictureWindowPrivateKeyRec)
-extern _X_EXPORT RESTYPE PictureType;
-extern _X_EXPORT RESTYPE PictFormatType;
-extern _X_EXPORT RESTYPE GlyphSetType;
+extern _X_EXPORT RESTYPE PictureType;
+extern _X_EXPORT RESTYPE PictFormatType;
+extern _X_EXPORT RESTYPE GlyphSetType;
#define GetPictureScreen(s) ((PictureScreenPtr)dixLookupPrivate(&(s)->devPrivates, PictureScreenPrivateKey))
#define GetPictureScreenIfSet(s) (dixPrivateKeyRegistered(PictureScreenPrivateKey) ? GetPictureScreen(s) : NULL)
@@ -403,247 +378,216 @@ extern _X_EXPORT RESTYPE GlyphSetType;
} \
extern _X_EXPORT Bool
-PictureDestroyWindow (WindowPtr pWindow);
+ PictureDestroyWindow(WindowPtr pWindow);
extern _X_EXPORT Bool
-PictureCloseScreen (int Index, ScreenPtr pScreen);
+ PictureCloseScreen(int Index, ScreenPtr pScreen);
extern _X_EXPORT void
-PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef);
+ PictureStoreColors(ColormapPtr pColormap, int ndef, xColorItem * pdef);
extern _X_EXPORT Bool
-PictureInitIndexedFormat (ScreenPtr pScreen, PictFormatPtr format);
+ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format);
extern _X_EXPORT Bool
-PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel);
+ PictureSetSubpixelOrder(ScreenPtr pScreen, int subpixel);
extern _X_EXPORT int
-PictureGetSubpixelOrder (ScreenPtr pScreen);
+ PictureGetSubpixelOrder(ScreenPtr pScreen);
extern _X_EXPORT PictFormatPtr
-PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp);
+PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp);
extern _X_EXPORT PictFormatPtr
-PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual);
+PictureMatchVisual(ScreenPtr pScreen, int depth, VisualPtr pVisual);
extern _X_EXPORT PictFormatPtr
-PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 format);
+PictureMatchFormat(ScreenPtr pScreen, int depth, CARD32 format);
extern _X_EXPORT Bool
-PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
+ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
extern _X_EXPORT int
-PictureGetFilterId (const char *filter, int len, Bool makeit);
+ PictureGetFilterId(const char *filter, int len, Bool makeit);
-extern _X_EXPORT char *
-PictureGetFilterName (int id);
+extern _X_EXPORT char *PictureGetFilterName(int id);
extern _X_EXPORT int
-PictureAddFilter (ScreenPtr pScreen,
- const char *filter,
- PictFilterValidateParamsProcPtr ValidateParams,
- int width,
- int height);
+
+PictureAddFilter(ScreenPtr pScreen,
+ const char *filter,
+ PictFilterValidateParamsProcPtr ValidateParams,
+ int width, int height);
extern _X_EXPORT Bool
-PictureSetFilterAlias (ScreenPtr pScreen, const char *filter, const char *alias);
+
+PictureSetFilterAlias(ScreenPtr pScreen, const char *filter, const char *alias);
extern _X_EXPORT Bool
-PictureSetDefaultFilters (ScreenPtr pScreen);
+ PictureSetDefaultFilters(ScreenPtr pScreen);
extern _X_EXPORT void
-PictureResetFilters (ScreenPtr pScreen);
+ PictureResetFilters(ScreenPtr pScreen);
extern _X_EXPORT PictFilterPtr
-PictureFindFilter (ScreenPtr pScreen, char *name, int len);
+PictureFindFilter(ScreenPtr pScreen, char *name, int len);
extern _X_EXPORT int
-SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter,
- xFixed *params, int nparams);
+
+SetPicturePictFilter(PicturePtr pPicture, PictFilterPtr pFilter,
+ xFixed * params, int nparams);
extern _X_EXPORT int
-SetPictureFilter (PicturePtr pPicture, char *name, int len,
- xFixed *params, int nparams);
+
+SetPictureFilter(PicturePtr pPicture, char *name, int len,
+ xFixed * params, int nparams);
extern _X_EXPORT Bool
-PictureFinishInit (void);
+ PictureFinishInit(void);
extern _X_EXPORT void
-SetPictureToDefaults (PicturePtr pPicture);
+ SetPictureToDefaults(PicturePtr pPicture);
extern _X_EXPORT PicturePtr
-CreatePicture (Picture pid,
- DrawablePtr pDrawable,
- PictFormatPtr pFormat,
- Mask mask,
- XID *list,
- ClientPtr client,
- int *error);
+CreatePicture(Picture pid,
+ DrawablePtr pDrawable,
+ PictFormatPtr pFormat,
+ Mask mask, XID *list, ClientPtr client, int *error);
extern _X_EXPORT int
-ChangePicture (PicturePtr pPicture,
- Mask vmask,
- XID *vlist,
- DevUnion *ulist,
- ClientPtr client);
+
+ChangePicture(PicturePtr pPicture,
+ Mask vmask, XID *vlist, DevUnion *ulist, ClientPtr client);
extern _X_EXPORT int
-SetPictureClipRects (PicturePtr pPicture,
- int xOrigin,
- int yOrigin,
- int nRect,
- xRectangle *rects);
+
+SetPictureClipRects(PicturePtr pPicture,
+ int xOrigin, int yOrigin, int nRect, xRectangle *rects);
extern _X_EXPORT int
-SetPictureClipRegion (PicturePtr pPicture,
- int xOrigin,
- int yOrigin,
- RegionPtr pRegion);
+
+SetPictureClipRegion(PicturePtr pPicture,
+ int xOrigin, int yOrigin, RegionPtr pRegion);
extern _X_EXPORT int
-SetPictureTransform (PicturePtr pPicture,
- PictTransform *transform);
+ SetPictureTransform(PicturePtr pPicture, PictTransform * transform);
extern _X_EXPORT void
-CopyPicture (PicturePtr pSrc,
- Mask mask,
- PicturePtr pDst);
+ CopyPicture(PicturePtr pSrc, Mask mask, PicturePtr pDst);
extern _X_EXPORT void
-ValidatePicture(PicturePtr pPicture);
+ ValidatePicture(PicturePtr pPicture);
extern _X_EXPORT int
-FreePicture (pointer pPicture,
- XID pid);
+ FreePicture(pointer pPicture, XID pid);
extern _X_EXPORT int
-FreePictFormat (pointer pPictFormat,
- XID pid);
+ FreePictFormat(pointer pPictFormat, XID pid);
extern _X_EXPORT void
-CompositePicture (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
+
+CompositePicture(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
extern _X_EXPORT void
-CompositeGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr lists,
- GlyphPtr *glyphs);
+
+CompositeGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr lists, GlyphPtr * glyphs);
extern _X_EXPORT void
-CompositeRects (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects);
+
+CompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color, int nRect, xRectangle *rects);
extern _X_EXPORT void
-CompositeTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps);
+
+CompositeTrapezoids(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps);
extern _X_EXPORT void
-CompositeTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntriangles,
- xTriangle *triangles);
+
+CompositeTriangles(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int ntriangles, xTriangle * triangles);
extern _X_EXPORT void
-CompositeTriStrip (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points);
+
+CompositeTriStrip(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
extern _X_EXPORT void
-CompositeTriFan (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points);
-extern _X_EXPORT void RenderExtensionInit (void);
+CompositeTriFan(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
+
+extern _X_EXPORT void RenderExtensionInit(void);
Bool
-AnimCurInit (ScreenPtr pScreen);
+ AnimCurInit(ScreenPtr pScreen);
int
-AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid);
+
+AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
+ CursorPtr *ppCursor, ClientPtr client, XID cid);
extern _X_EXPORT void
-AddTraps (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntraps,
- xTrap *traps);
+
+AddTraps(PicturePtr pPicture,
+ INT16 xOff, INT16 yOff, int ntraps, xTrap * traps);
extern _X_EXPORT PicturePtr
-CreateSolidPicture (Picture pid,
- xRenderColor *color,
- int *error);
+CreateSolidPicture(Picture pid, xRenderColor * color, int *error);
extern _X_EXPORT PicturePtr
-CreateLinearGradientPicture (Picture pid,
- xPointFixed *p1,
- xPointFixed *p2,
- int nStops,
- xFixed *stops,
- xRenderColor *colors,
- int *error);
+CreateLinearGradientPicture(Picture pid,
+ xPointFixed * p1,
+ xPointFixed * p2,
+ int nStops,
+ xFixed * stops, xRenderColor * colors, int *error);
extern _X_EXPORT PicturePtr
-CreateRadialGradientPicture (Picture pid,
- xPointFixed *inner,
- xPointFixed *outer,
- xFixed innerRadius,
- xFixed outerRadius,
- int nStops,
- xFixed *stops,
- xRenderColor *colors,
- int *error);
+CreateRadialGradientPicture(Picture pid,
+ xPointFixed * inner,
+ xPointFixed * outer,
+ xFixed innerRadius,
+ xFixed outerRadius,
+ int nStops,
+ xFixed * stops, xRenderColor * colors, int *error);
extern _X_EXPORT PicturePtr
-CreateConicalGradientPicture (Picture pid,
- xPointFixed *center,
- xFixed angle,
- int nStops,
- xFixed *stops,
- xRenderColor *colors,
- int *error);
+CreateConicalGradientPicture(Picture pid,
+ xPointFixed * center,
+ xFixed angle,
+ int nStops,
+ xFixed * stops, xRenderColor * colors, int *error);
#ifdef PANORAMIX
-extern _X_EXPORT void PanoramiXRenderInit (void);
-extern _X_EXPORT void PanoramiXRenderReset (void);
+extern _X_EXPORT void PanoramiXRenderInit(void);
+extern _X_EXPORT void PanoramiXRenderReset(void);
#endif
/*
@@ -651,19 +595,19 @@ extern _X_EXPORT void PanoramiXRenderReset (void);
*/
extern _X_EXPORT void
-PictTransform_from_xRenderTransform (PictTransformPtr pict,
- xRenderTransform *render);
+
+PictTransform_from_xRenderTransform(PictTransformPtr pict,
+ xRenderTransform * render);
extern _X_EXPORT void
-xRenderTransform_from_PictTransform (xRenderTransform *render,
- PictTransformPtr pict);
+
+xRenderTransform_from_PictTransform(xRenderTransform * render,
+ PictTransformPtr pict);
extern _X_EXPORT Bool
-PictureTransformPoint (PictTransformPtr transform,
- PictVectorPtr vector);
+ PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector);
extern _X_EXPORT Bool
-PictureTransformPoint3d (PictTransformPtr transform,
- PictVectorPtr vector);
+ PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector);
-#endif /* _PICTURESTR_H_ */
+#endif /* _PICTURESTR_H_ */
diff --git a/xorg-server/render/render.c b/xorg-server/render/render.c
index d82e09959..344ca75e2 100644
--- a/xorg-server/render/render.c
+++ b/xorg-server/render/render.c
@@ -54,213 +54,209 @@
#include <stdint.h>
-static int ProcRenderQueryVersion (ClientPtr pClient);
-static int ProcRenderQueryPictFormats (ClientPtr pClient);
-static int ProcRenderQueryPictIndexValues (ClientPtr pClient);
-static int ProcRenderQueryDithers (ClientPtr pClient);
-static int ProcRenderCreatePicture (ClientPtr pClient);
-static int ProcRenderChangePicture (ClientPtr pClient);
-static int ProcRenderSetPictureClipRectangles (ClientPtr pClient);
-static int ProcRenderFreePicture (ClientPtr pClient);
-static int ProcRenderComposite (ClientPtr pClient);
-static int ProcRenderScale (ClientPtr pClient);
-static int ProcRenderTrapezoids (ClientPtr pClient);
-static int ProcRenderTriangles (ClientPtr pClient);
-static int ProcRenderTriStrip (ClientPtr pClient);
-static int ProcRenderTriFan (ClientPtr pClient);
-static int ProcRenderColorTrapezoids (ClientPtr pClient);
-static int ProcRenderColorTriangles (ClientPtr pClient);
-static int ProcRenderTransform (ClientPtr pClient);
-static int ProcRenderCreateGlyphSet (ClientPtr pClient);
-static int ProcRenderReferenceGlyphSet (ClientPtr pClient);
-static int ProcRenderFreeGlyphSet (ClientPtr pClient);
-static int ProcRenderAddGlyphs (ClientPtr pClient);
-static int ProcRenderAddGlyphsFromPicture (ClientPtr pClient);
-static int ProcRenderFreeGlyphs (ClientPtr pClient);
-static int ProcRenderCompositeGlyphs (ClientPtr pClient);
-static int ProcRenderFillRectangles (ClientPtr pClient);
-static int ProcRenderCreateCursor (ClientPtr pClient);
-static int ProcRenderSetPictureTransform (ClientPtr pClient);
-static int ProcRenderQueryFilters (ClientPtr pClient);
-static int ProcRenderSetPictureFilter (ClientPtr pClient);
-static int ProcRenderCreateAnimCursor (ClientPtr pClient);
-static int ProcRenderAddTraps (ClientPtr pClient);
-static int ProcRenderCreateSolidFill (ClientPtr pClient);
-static int ProcRenderCreateLinearGradient (ClientPtr pClient);
-static int ProcRenderCreateRadialGradient (ClientPtr pClient);
-static int ProcRenderCreateConicalGradient (ClientPtr pClient);
-
-static int ProcRenderDispatch (ClientPtr pClient);
-
-static int SProcRenderQueryVersion (ClientPtr pClient);
-static int SProcRenderQueryPictFormats (ClientPtr pClient);
-static int SProcRenderQueryPictIndexValues (ClientPtr pClient);
-static int SProcRenderQueryDithers (ClientPtr pClient);
-static int SProcRenderCreatePicture (ClientPtr pClient);
-static int SProcRenderChangePicture (ClientPtr pClient);
-static int SProcRenderSetPictureClipRectangles (ClientPtr pClient);
-static int SProcRenderFreePicture (ClientPtr pClient);
-static int SProcRenderComposite (ClientPtr pClient);
-static int SProcRenderScale (ClientPtr pClient);
-static int SProcRenderTrapezoids (ClientPtr pClient);
-static int SProcRenderTriangles (ClientPtr pClient);
-static int SProcRenderTriStrip (ClientPtr pClient);
-static int SProcRenderTriFan (ClientPtr pClient);
-static int SProcRenderColorTrapezoids (ClientPtr pClient);
-static int SProcRenderColorTriangles (ClientPtr pClient);
-static int SProcRenderTransform (ClientPtr pClient);
-static int SProcRenderCreateGlyphSet (ClientPtr pClient);
-static int SProcRenderReferenceGlyphSet (ClientPtr pClient);
-static int SProcRenderFreeGlyphSet (ClientPtr pClient);
-static int SProcRenderAddGlyphs (ClientPtr pClient);
-static int SProcRenderAddGlyphsFromPicture (ClientPtr pClient);
-static int SProcRenderFreeGlyphs (ClientPtr pClient);
-static int SProcRenderCompositeGlyphs (ClientPtr pClient);
-static int SProcRenderFillRectangles (ClientPtr pClient);
-static int SProcRenderCreateCursor (ClientPtr pClient);
-static int SProcRenderSetPictureTransform (ClientPtr pClient);
-static int SProcRenderQueryFilters (ClientPtr pClient);
-static int SProcRenderSetPictureFilter (ClientPtr pClient);
-static int SProcRenderCreateAnimCursor (ClientPtr pClient);
-static int SProcRenderAddTraps (ClientPtr pClient);
-static int SProcRenderCreateSolidFill (ClientPtr pClient);
-static int SProcRenderCreateLinearGradient (ClientPtr pClient);
-static int SProcRenderCreateRadialGradient (ClientPtr pClient);
-static int SProcRenderCreateConicalGradient (ClientPtr pClient);
-
-static int SProcRenderDispatch (ClientPtr pClient);
-
-int (*ProcRenderVector[RenderNumberRequests])(ClientPtr) = {
- ProcRenderQueryVersion,
- ProcRenderQueryPictFormats,
- ProcRenderQueryPictIndexValues,
- ProcRenderQueryDithers,
- ProcRenderCreatePicture,
- ProcRenderChangePicture,
- ProcRenderSetPictureClipRectangles,
- ProcRenderFreePicture,
- ProcRenderComposite,
- ProcRenderScale,
- ProcRenderTrapezoids,
- ProcRenderTriangles,
- ProcRenderTriStrip,
- ProcRenderTriFan,
- ProcRenderColorTrapezoids,
- ProcRenderColorTriangles,
- ProcRenderTransform,
- ProcRenderCreateGlyphSet,
- ProcRenderReferenceGlyphSet,
- ProcRenderFreeGlyphSet,
- ProcRenderAddGlyphs,
- ProcRenderAddGlyphsFromPicture,
- ProcRenderFreeGlyphs,
- ProcRenderCompositeGlyphs,
- ProcRenderCompositeGlyphs,
- ProcRenderCompositeGlyphs,
- ProcRenderFillRectangles,
- ProcRenderCreateCursor,
- ProcRenderSetPictureTransform,
- ProcRenderQueryFilters,
- ProcRenderSetPictureFilter,
- ProcRenderCreateAnimCursor,
- ProcRenderAddTraps,
- ProcRenderCreateSolidFill,
- ProcRenderCreateLinearGradient,
- ProcRenderCreateRadialGradient,
- ProcRenderCreateConicalGradient
-};
-
-int (*SProcRenderVector[RenderNumberRequests])(ClientPtr) = {
- SProcRenderQueryVersion,
- SProcRenderQueryPictFormats,
- SProcRenderQueryPictIndexValues,
- SProcRenderQueryDithers,
- SProcRenderCreatePicture,
- SProcRenderChangePicture,
- SProcRenderSetPictureClipRectangles,
- SProcRenderFreePicture,
- SProcRenderComposite,
- SProcRenderScale,
- SProcRenderTrapezoids,
- SProcRenderTriangles,
- SProcRenderTriStrip,
- SProcRenderTriFan,
- SProcRenderColorTrapezoids,
- SProcRenderColorTriangles,
- SProcRenderTransform,
- SProcRenderCreateGlyphSet,
- SProcRenderReferenceGlyphSet,
- SProcRenderFreeGlyphSet,
- SProcRenderAddGlyphs,
- SProcRenderAddGlyphsFromPicture,
- SProcRenderFreeGlyphs,
- SProcRenderCompositeGlyphs,
- SProcRenderCompositeGlyphs,
- SProcRenderCompositeGlyphs,
- SProcRenderFillRectangles,
- SProcRenderCreateCursor,
- SProcRenderSetPictureTransform,
- SProcRenderQueryFilters,
- SProcRenderSetPictureFilter,
- SProcRenderCreateAnimCursor,
- SProcRenderAddTraps,
- SProcRenderCreateSolidFill,
- SProcRenderCreateLinearGradient,
- SProcRenderCreateRadialGradient,
- SProcRenderCreateConicalGradient
-};
-
-int RenderErrBase;
+static int ProcRenderQueryVersion(ClientPtr pClient);
+static int ProcRenderQueryPictFormats(ClientPtr pClient);
+static int ProcRenderQueryPictIndexValues(ClientPtr pClient);
+static int ProcRenderQueryDithers(ClientPtr pClient);
+static int ProcRenderCreatePicture(ClientPtr pClient);
+static int ProcRenderChangePicture(ClientPtr pClient);
+static int ProcRenderSetPictureClipRectangles(ClientPtr pClient);
+static int ProcRenderFreePicture(ClientPtr pClient);
+static int ProcRenderComposite(ClientPtr pClient);
+static int ProcRenderScale(ClientPtr pClient);
+static int ProcRenderTrapezoids(ClientPtr pClient);
+static int ProcRenderTriangles(ClientPtr pClient);
+static int ProcRenderTriStrip(ClientPtr pClient);
+static int ProcRenderTriFan(ClientPtr pClient);
+static int ProcRenderColorTrapezoids(ClientPtr pClient);
+static int ProcRenderColorTriangles(ClientPtr pClient);
+static int ProcRenderTransform(ClientPtr pClient);
+static int ProcRenderCreateGlyphSet(ClientPtr pClient);
+static int ProcRenderReferenceGlyphSet(ClientPtr pClient);
+static int ProcRenderFreeGlyphSet(ClientPtr pClient);
+static int ProcRenderAddGlyphs(ClientPtr pClient);
+static int ProcRenderAddGlyphsFromPicture(ClientPtr pClient);
+static int ProcRenderFreeGlyphs(ClientPtr pClient);
+static int ProcRenderCompositeGlyphs(ClientPtr pClient);
+static int ProcRenderFillRectangles(ClientPtr pClient);
+static int ProcRenderCreateCursor(ClientPtr pClient);
+static int ProcRenderSetPictureTransform(ClientPtr pClient);
+static int ProcRenderQueryFilters(ClientPtr pClient);
+static int ProcRenderSetPictureFilter(ClientPtr pClient);
+static int ProcRenderCreateAnimCursor(ClientPtr pClient);
+static int ProcRenderAddTraps(ClientPtr pClient);
+static int ProcRenderCreateSolidFill(ClientPtr pClient);
+static int ProcRenderCreateLinearGradient(ClientPtr pClient);
+static int ProcRenderCreateRadialGradient(ClientPtr pClient);
+static int ProcRenderCreateConicalGradient(ClientPtr pClient);
+
+static int ProcRenderDispatch(ClientPtr pClient);
+
+static int SProcRenderQueryVersion(ClientPtr pClient);
+static int SProcRenderQueryPictFormats(ClientPtr pClient);
+static int SProcRenderQueryPictIndexValues(ClientPtr pClient);
+static int SProcRenderQueryDithers(ClientPtr pClient);
+static int SProcRenderCreatePicture(ClientPtr pClient);
+static int SProcRenderChangePicture(ClientPtr pClient);
+static int SProcRenderSetPictureClipRectangles(ClientPtr pClient);
+static int SProcRenderFreePicture(ClientPtr pClient);
+static int SProcRenderComposite(ClientPtr pClient);
+static int SProcRenderScale(ClientPtr pClient);
+static int SProcRenderTrapezoids(ClientPtr pClient);
+static int SProcRenderTriangles(ClientPtr pClient);
+static int SProcRenderTriStrip(ClientPtr pClient);
+static int SProcRenderTriFan(ClientPtr pClient);
+static int SProcRenderColorTrapezoids(ClientPtr pClient);
+static int SProcRenderColorTriangles(ClientPtr pClient);
+static int SProcRenderTransform(ClientPtr pClient);
+static int SProcRenderCreateGlyphSet(ClientPtr pClient);
+static int SProcRenderReferenceGlyphSet(ClientPtr pClient);
+static int SProcRenderFreeGlyphSet(ClientPtr pClient);
+static int SProcRenderAddGlyphs(ClientPtr pClient);
+static int SProcRenderAddGlyphsFromPicture(ClientPtr pClient);
+static int SProcRenderFreeGlyphs(ClientPtr pClient);
+static int SProcRenderCompositeGlyphs(ClientPtr pClient);
+static int SProcRenderFillRectangles(ClientPtr pClient);
+static int SProcRenderCreateCursor(ClientPtr pClient);
+static int SProcRenderSetPictureTransform(ClientPtr pClient);
+static int SProcRenderQueryFilters(ClientPtr pClient);
+static int SProcRenderSetPictureFilter(ClientPtr pClient);
+static int SProcRenderCreateAnimCursor(ClientPtr pClient);
+static int SProcRenderAddTraps(ClientPtr pClient);
+static int SProcRenderCreateSolidFill(ClientPtr pClient);
+static int SProcRenderCreateLinearGradient(ClientPtr pClient);
+static int SProcRenderCreateRadialGradient(ClientPtr pClient);
+static int SProcRenderCreateConicalGradient(ClientPtr pClient);
+
+static int SProcRenderDispatch(ClientPtr pClient);
+
+int (*ProcRenderVector[RenderNumberRequests]) (ClientPtr) = {
+ProcRenderQueryVersion,
+ ProcRenderQueryPictFormats,
+ ProcRenderQueryPictIndexValues,
+ ProcRenderQueryDithers,
+ ProcRenderCreatePicture,
+ ProcRenderChangePicture,
+ ProcRenderSetPictureClipRectangles,
+ ProcRenderFreePicture,
+ ProcRenderComposite,
+ ProcRenderScale,
+ ProcRenderTrapezoids,
+ ProcRenderTriangles,
+ ProcRenderTriStrip,
+ ProcRenderTriFan,
+ ProcRenderColorTrapezoids,
+ ProcRenderColorTriangles,
+ ProcRenderTransform,
+ ProcRenderCreateGlyphSet,
+ ProcRenderReferenceGlyphSet,
+ ProcRenderFreeGlyphSet,
+ ProcRenderAddGlyphs,
+ ProcRenderAddGlyphsFromPicture,
+ ProcRenderFreeGlyphs,
+ ProcRenderCompositeGlyphs,
+ ProcRenderCompositeGlyphs,
+ ProcRenderCompositeGlyphs,
+ ProcRenderFillRectangles,
+ ProcRenderCreateCursor,
+ ProcRenderSetPictureTransform,
+ ProcRenderQueryFilters,
+ ProcRenderSetPictureFilter,
+ ProcRenderCreateAnimCursor,
+ ProcRenderAddTraps,
+ ProcRenderCreateSolidFill,
+ ProcRenderCreateLinearGradient,
+ ProcRenderCreateRadialGradient, ProcRenderCreateConicalGradient};
+
+int (*SProcRenderVector[RenderNumberRequests]) (ClientPtr) = {
+SProcRenderQueryVersion,
+ SProcRenderQueryPictFormats,
+ SProcRenderQueryPictIndexValues,
+ SProcRenderQueryDithers,
+ SProcRenderCreatePicture,
+ SProcRenderChangePicture,
+ SProcRenderSetPictureClipRectangles,
+ SProcRenderFreePicture,
+ SProcRenderComposite,
+ SProcRenderScale,
+ SProcRenderTrapezoids,
+ SProcRenderTriangles,
+ SProcRenderTriStrip,
+ SProcRenderTriFan,
+ SProcRenderColorTrapezoids,
+ SProcRenderColorTriangles,
+ SProcRenderTransform,
+ SProcRenderCreateGlyphSet,
+ SProcRenderReferenceGlyphSet,
+ SProcRenderFreeGlyphSet,
+ SProcRenderAddGlyphs,
+ SProcRenderAddGlyphsFromPicture,
+ SProcRenderFreeGlyphs,
+ SProcRenderCompositeGlyphs,
+ SProcRenderCompositeGlyphs,
+ SProcRenderCompositeGlyphs,
+ SProcRenderFillRectangles,
+ SProcRenderCreateCursor,
+ SProcRenderSetPictureTransform,
+ SProcRenderQueryFilters,
+ SProcRenderSetPictureFilter,
+ SProcRenderCreateAnimCursor,
+ SProcRenderAddTraps,
+ SProcRenderCreateSolidFill,
+ SProcRenderCreateLinearGradient,
+ SProcRenderCreateRadialGradient, SProcRenderCreateConicalGradient};
+
+int RenderErrBase;
static DevPrivateKeyRec RenderClientPrivateKeyRec;
+
#define RenderClientPrivateKey (&RenderClientPrivateKeyRec )
typedef struct _RenderClient {
- int major_version;
- int minor_version;
+ int major_version;
+ int minor_version;
} RenderClientRec, *RenderClientPtr;
#define GetRenderClient(pClient) ((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RenderClientPrivateKey))
static void
-RenderClientCallback (CallbackListPtr *list,
- pointer closure,
- pointer data)
+RenderClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- RenderClientPtr pRenderClient = GetRenderClient (pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ RenderClientPtr pRenderClient = GetRenderClient(pClient);
pRenderClient->major_version = 0;
pRenderClient->minor_version = 0;
}
#ifdef PANORAMIX
-RESTYPE XRT_PICTURE;
+RESTYPE XRT_PICTURE;
#endif
void
-RenderExtensionInit (void)
+RenderExtensionInit(void)
{
ExtensionEntry *extEntry;
if (!PictureType)
- return;
- if (!PictureFinishInit ())
- return;
- if (!dixRegisterPrivateKey(&RenderClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(RenderClientRec)))
- return;
- if (!AddCallback (&ClientStateCallback, RenderClientCallback, 0))
- return;
-
- extEntry = AddExtension (RENDER_NAME, 0, RenderNumberErrors,
- ProcRenderDispatch, SProcRenderDispatch,
- NULL, StandardMinorOpcode);
+ return;
+ if (!PictureFinishInit())
+ return;
+ if (!dixRegisterPrivateKey
+ (&RenderClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(RenderClientRec)))
+ return;
+ if (!AddCallback(&ClientStateCallback, RenderClientCallback, 0))
+ return;
+
+ extEntry = AddExtension(RENDER_NAME, 0, RenderNumberErrors,
+ ProcRenderDispatch, SProcRenderDispatch,
+ NULL, StandardMinorOpcode);
if (!extEntry)
- return;
+ return;
RenderErrBase = extEntry->errorBase;
#ifdef PANORAMIX
if (XRT_PICTURE)
- SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
+ SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
#endif
SetResourceTypeErrorValue(PictureType, RenderErrBase + BadPicture);
SetResourceTypeErrorValue(PictFormatType, RenderErrBase + BadPictFormat);
@@ -268,10 +264,11 @@ RenderExtensionInit (void)
}
static int
-ProcRenderQueryVersion (ClientPtr client)
+ProcRenderQueryVersion(ClientPtr client)
{
- RenderClientPtr pRenderClient = GetRenderClient (client);
+ RenderClientPtr pRenderClient = GetRenderClient(client);
xRenderQueryVersionReply rep;
+
REQUEST(xRenderQueryVersionReq);
pRenderClient->major_version = stuff->majorVersion;
@@ -284,110 +281,106 @@ ProcRenderQueryVersion (ClientPtr client)
rep.sequenceNumber = client->sequence;
if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
- (SERVER_RENDER_MAJOR_VERSION * 1000 + SERVER_RENDER_MINOR_VERSION))
- {
- rep.majorVersion = stuff->majorVersion;
- rep.minorVersion = stuff->minorVersion;
- } else
- {
- rep.majorVersion = SERVER_RENDER_MAJOR_VERSION;
- rep.minorVersion = SERVER_RENDER_MINOR_VERSION;
+ (SERVER_RENDER_MAJOR_VERSION * 1000 + SERVER_RENDER_MINOR_VERSION)) {
+ rep.majorVersion = stuff->majorVersion;
+ rep.minorVersion = stuff->minorVersion;
+ }
+ else {
+ rep.majorVersion = SERVER_RENDER_MAJOR_VERSION;
+ rep.minorVersion = SERVER_RENDER_MINOR_VERSION;
}
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xRenderQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xRenderQueryVersionReply), (char *) &rep);
return Success;
}
static VisualPtr
-findVisual (ScreenPtr pScreen, VisualID vid)
+findVisual(ScreenPtr pScreen, VisualID vid)
{
- VisualPtr pVisual;
- int v;
+ VisualPtr pVisual;
+ int v;
- for (v = 0; v < pScreen->numVisuals; v++)
- {
- pVisual = pScreen->visuals + v;
- if (pVisual->vid == vid)
- return pVisual;
+ for (v = 0; v < pScreen->numVisuals; v++) {
+ pVisual = pScreen->visuals + v;
+ if (pVisual->vid == vid)
+ return pVisual;
}
return 0;
}
static int
-ProcRenderQueryPictFormats (ClientPtr client)
-{
- RenderClientPtr pRenderClient = GetRenderClient (client);
- xRenderQueryPictFormatsReply *reply;
- xPictScreen *pictScreen;
- xPictDepth *pictDepth;
- xPictVisual *pictVisual;
- xPictFormInfo *pictForm;
- CARD32 *pictSubpixel;
- ScreenPtr pScreen;
- VisualPtr pVisual;
- DepthPtr pDepth;
- int v, d;
- PictureScreenPtr ps;
- PictFormatPtr pFormat;
- int nformat;
- int ndepth;
- int nvisual;
- int rlength;
- int s;
- int numScreens;
- int numSubpixel;
+ProcRenderQueryPictFormats(ClientPtr client)
+{
+ RenderClientPtr pRenderClient = GetRenderClient(client);
+ xRenderQueryPictFormatsReply *reply;
+ xPictScreen *pictScreen;
+ xPictDepth *pictDepth;
+ xPictVisual *pictVisual;
+ xPictFormInfo *pictForm;
+ CARD32 *pictSubpixel;
+ ScreenPtr pScreen;
+ VisualPtr pVisual;
+ DepthPtr pDepth;
+ int v, d;
+ PictureScreenPtr ps;
+ PictFormatPtr pFormat;
+ int nformat;
+ int ndepth;
+ int nvisual;
+ int rlength;
+ int s;
+ int numScreens;
+ int numSubpixel;
+
/* REQUEST(xRenderQueryPictFormatsReq); */
REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq);
#ifdef PANORAMIX
if (noPanoramiXExtension)
- numScreens = screenInfo.numScreens;
- else
- numScreens = ((xConnSetup *)ConnectionInfo)->numRoots;
+ numScreens = screenInfo.numScreens;
+ else
+ numScreens = ((xConnSetup *) ConnectionInfo)->numRoots;
#else
numScreens = screenInfo.numScreens;
#endif
ndepth = nformat = nvisual = 0;
- for (s = 0; s < numScreens; s++)
- {
- pScreen = screenInfo.screens[s];
- for (d = 0; d < pScreen->numDepths; d++)
- {
- pDepth = pScreen->allowedDepths + d;
- ++ndepth;
-
- for (v = 0; v < pDepth->numVids; v++)
- {
- pVisual = findVisual (pScreen, pDepth->vids[v]);
- if (pVisual && PictureMatchVisual (pScreen, pDepth->depth, pVisual))
- ++nvisual;
- }
- }
- ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- nformat += ps->nformats;
+ for (s = 0; s < numScreens; s++) {
+ pScreen = screenInfo.screens[s];
+ for (d = 0; d < pScreen->numDepths; d++) {
+ pDepth = pScreen->allowedDepths + d;
+ ++ndepth;
+
+ for (v = 0; v < pDepth->numVids; v++) {
+ pVisual = findVisual(pScreen, pDepth->vids[v]);
+ if (pVisual &&
+ PictureMatchVisual(pScreen, pDepth->depth, pVisual))
+ ++nvisual;
+ }
+ }
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps)
+ nformat += ps->nformats;
}
if (pRenderClient->major_version == 0 && pRenderClient->minor_version < 6)
- numSubpixel = 0;
+ numSubpixel = 0;
else
- numSubpixel = numScreens;
-
- rlength = (sizeof (xRenderQueryPictFormatsReply) +
- nformat * sizeof (xPictFormInfo) +
- numScreens * sizeof (xPictScreen) +
- ndepth * sizeof (xPictDepth) +
- nvisual * sizeof (xPictVisual) +
- numSubpixel * sizeof (CARD32));
+ numSubpixel = numScreens;
+
+ rlength = (sizeof(xRenderQueryPictFormatsReply) +
+ nformat * sizeof(xPictFormInfo) +
+ numScreens * sizeof(xPictScreen) +
+ ndepth * sizeof(xPictDepth) +
+ nvisual * sizeof(xPictVisual) + numSubpixel * sizeof(CARD32));
reply = (xRenderQueryPictFormatsReply *) calloc(1, rlength);
if (!reply)
- return BadAlloc;
+ return BadAlloc;
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
@@ -396,130 +389,116 @@ ProcRenderQueryPictFormats (ClientPtr client)
reply->numDepths = ndepth;
reply->numVisuals = nvisual;
reply->numSubpixel = numSubpixel;
-
+
pictForm = (xPictFormInfo *) (reply + 1);
-
- for (s = 0; s < numScreens; s++)
- {
- pScreen = screenInfo.screens[s];
- ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- {
- for (nformat = 0, pFormat = ps->formats;
- nformat < ps->nformats;
- nformat++, pFormat++)
- {
- pictForm->id = pFormat->id;
- pictForm->type = pFormat->type;
- pictForm->depth = pFormat->depth;
- pictForm->direct.red = pFormat->direct.red;
- pictForm->direct.redMask = pFormat->direct.redMask;
- pictForm->direct.green = pFormat->direct.green;
- pictForm->direct.greenMask = pFormat->direct.greenMask;
- pictForm->direct.blue = pFormat->direct.blue;
- pictForm->direct.blueMask = pFormat->direct.blueMask;
- pictForm->direct.alpha = pFormat->direct.alpha;
- pictForm->direct.alphaMask = pFormat->direct.alphaMask;
- if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap)
- pictForm->colormap = pFormat->index.pColormap->mid;
- else
- pictForm->colormap = None;
- if (client->swapped)
- {
- swapl(&pictForm->id);
- swaps(&pictForm->direct.red);
- swaps(&pictForm->direct.redMask);
- swaps(&pictForm->direct.green);
- swaps(&pictForm->direct.greenMask);
- swaps(&pictForm->direct.blue);
- swaps(&pictForm->direct.blueMask);
- swaps(&pictForm->direct.alpha);
- swaps(&pictForm->direct.alphaMask);
- swapl(&pictForm->colormap);
- }
- pictForm++;
- }
- }
- }
-
+
+ for (s = 0; s < numScreens; s++) {
+ pScreen = screenInfo.screens[s];
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps) {
+ for (nformat = 0, pFormat = ps->formats;
+ nformat < ps->nformats; nformat++, pFormat++) {
+ pictForm->id = pFormat->id;
+ pictForm->type = pFormat->type;
+ pictForm->depth = pFormat->depth;
+ pictForm->direct.red = pFormat->direct.red;
+ pictForm->direct.redMask = pFormat->direct.redMask;
+ pictForm->direct.green = pFormat->direct.green;
+ pictForm->direct.greenMask = pFormat->direct.greenMask;
+ pictForm->direct.blue = pFormat->direct.blue;
+ pictForm->direct.blueMask = pFormat->direct.blueMask;
+ pictForm->direct.alpha = pFormat->direct.alpha;
+ pictForm->direct.alphaMask = pFormat->direct.alphaMask;
+ if (pFormat->type == PictTypeIndexed &&
+ pFormat->index.pColormap)
+ pictForm->colormap = pFormat->index.pColormap->mid;
+ else
+ pictForm->colormap = None;
+ if (client->swapped) {
+ swapl(&pictForm->id);
+ swaps(&pictForm->direct.red);
+ swaps(&pictForm->direct.redMask);
+ swaps(&pictForm->direct.green);
+ swaps(&pictForm->direct.greenMask);
+ swaps(&pictForm->direct.blue);
+ swaps(&pictForm->direct.blueMask);
+ swaps(&pictForm->direct.alpha);
+ swaps(&pictForm->direct.alphaMask);
+ swapl(&pictForm->colormap);
+ }
+ pictForm++;
+ }
+ }
+ }
+
pictScreen = (xPictScreen *) pictForm;
- for (s = 0; s < numScreens; s++)
- {
- pScreen = screenInfo.screens[s];
- pictDepth = (xPictDepth *) (pictScreen + 1);
- ndepth = 0;
- for (d = 0; d < pScreen->numDepths; d++)
- {
- pictVisual = (xPictVisual *) (pictDepth + 1);
- pDepth = pScreen->allowedDepths + d;
-
- nvisual = 0;
- for (v = 0; v < pDepth->numVids; v++)
- {
- pVisual = findVisual (pScreen, pDepth->vids[v]);
- if (pVisual && (pFormat = PictureMatchVisual (pScreen,
- pDepth->depth,
- pVisual)))
- {
- pictVisual->visual = pVisual->vid;
- pictVisual->format = pFormat->id;
- if (client->swapped)
- {
- swapl(&pictVisual->visual);
- swapl(&pictVisual->format);
- }
- pictVisual++;
- nvisual++;
- }
- }
- pictDepth->depth = pDepth->depth;
- pictDepth->nPictVisuals = nvisual;
- if (client->swapped)
- {
- swaps(&pictDepth->nPictVisuals);
- }
- ndepth++;
- pictDepth = (xPictDepth *) pictVisual;
- }
- pictScreen->nDepth = ndepth;
- ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- pictScreen->fallback = ps->fallback->id;
- else
- pictScreen->fallback = 0;
- if (client->swapped)
- {
- swapl(&pictScreen->nDepth);
- swapl(&pictScreen->fallback);
- }
- pictScreen = (xPictScreen *) pictDepth;
+ for (s = 0; s < numScreens; s++) {
+ pScreen = screenInfo.screens[s];
+ pictDepth = (xPictDepth *) (pictScreen + 1);
+ ndepth = 0;
+ for (d = 0; d < pScreen->numDepths; d++) {
+ pictVisual = (xPictVisual *) (pictDepth + 1);
+ pDepth = pScreen->allowedDepths + d;
+
+ nvisual = 0;
+ for (v = 0; v < pDepth->numVids; v++) {
+ pVisual = findVisual(pScreen, pDepth->vids[v]);
+ if (pVisual && (pFormat = PictureMatchVisual(pScreen,
+ pDepth->depth,
+ pVisual))) {
+ pictVisual->visual = pVisual->vid;
+ pictVisual->format = pFormat->id;
+ if (client->swapped) {
+ swapl(&pictVisual->visual);
+ swapl(&pictVisual->format);
+ }
+ pictVisual++;
+ nvisual++;
+ }
+ }
+ pictDepth->depth = pDepth->depth;
+ pictDepth->nPictVisuals = nvisual;
+ if (client->swapped) {
+ swaps(&pictDepth->nPictVisuals);
+ }
+ ndepth++;
+ pictDepth = (xPictDepth *) pictVisual;
+ }
+ pictScreen->nDepth = ndepth;
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps)
+ pictScreen->fallback = ps->fallback->id;
+ else
+ pictScreen->fallback = 0;
+ if (client->swapped) {
+ swapl(&pictScreen->nDepth);
+ swapl(&pictScreen->fallback);
+ }
+ pictScreen = (xPictScreen *) pictDepth;
}
pictSubpixel = (CARD32 *) pictScreen;
-
- for (s = 0; s < numSubpixel; s++)
- {
- pScreen = screenInfo.screens[s];
- ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- *pictSubpixel = ps->subpixel;
- else
- *pictSubpixel = SubPixelUnknown;
- if (client->swapped)
- {
- swapl(pictSubpixel);
- }
- ++pictSubpixel;
- }
-
- if (client->swapped)
- {
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swapl(&reply->numFormats);
- swapl(&reply->numScreens);
- swapl(&reply->numDepths);
- swapl(&reply->numVisuals);
- swapl(&reply->numSubpixel);
+
+ for (s = 0; s < numSubpixel; s++) {
+ pScreen = screenInfo.screens[s];
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps)
+ *pictSubpixel = ps->subpixel;
+ else
+ *pictSubpixel = SubPixelUnknown;
+ if (client->swapped) {
+ swapl(pictSubpixel);
+ }
+ ++pictSubpixel;
+ }
+
+ if (client->swapped) {
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
+ swapl(&reply->numFormats);
+ swapl(&reply->numScreens);
+ swapl(&reply->numDepths);
+ swapl(&reply->numVisuals);
+ swapl(&reply->numSubpixel);
}
WriteToClient(client, rlength, (char *) reply);
free(reply);
@@ -527,34 +506,34 @@ ProcRenderQueryPictFormats (ClientPtr client)
}
static int
-ProcRenderQueryPictIndexValues (ClientPtr client)
+ProcRenderQueryPictIndexValues(ClientPtr client)
{
- PictFormatPtr pFormat;
- int rc, num;
- int rlength;
- int i;
+ PictFormatPtr pFormat;
+ int rc, num;
+ int rlength;
+ int i;
+
REQUEST(xRenderQueryPictIndexValuesReq);
xRenderQueryPictIndexValuesReply *reply;
- xIndexValue *values;
+ xIndexValue *values;
REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq);
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format,
- PictFormatType, client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->format,
+ PictFormatType, client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
- if (pFormat->type != PictTypeIndexed)
- {
- client->errorValue = stuff->format;
- return BadMatch;
+ if (pFormat->type != PictTypeIndexed) {
+ client->errorValue = stuff->format;
+ return BadMatch;
}
num = pFormat->index.nvalues;
- rlength = (sizeof (xRenderQueryPictIndexValuesReply) +
- num * sizeof(xIndexValue));
+ rlength = (sizeof(xRenderQueryPictIndexValuesReply) +
+ num * sizeof(xIndexValue));
reply = (xRenderQueryPictIndexValuesReply *) malloc(rlength);
if (!reply)
- return BadAlloc;
+ return BadAlloc;
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
@@ -562,22 +541,20 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
reply->numIndexValues = num;
values = (xIndexValue *) (reply + 1);
-
- memcpy (reply + 1, pFormat->index.pValues, num * sizeof (xIndexValue));
-
- if (client->swapped)
- {
- for (i = 0; i < num; i++)
- {
- swapl(&values[i].pixel);
- swaps(&values[i].red);
- swaps(&values[i].green);
- swaps(&values[i].blue);
- swaps(&values[i].alpha);
- }
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swapl(&reply->numIndexValues);
+
+ memcpy(reply + 1, pFormat->index.pValues, num * sizeof(xIndexValue));
+
+ if (client->swapped) {
+ for (i = 0; i < num; i++) {
+ swapl(&values[i].pixel);
+ swaps(&values[i].red);
+ swaps(&values[i].green);
+ swaps(&values[i].blue);
+ swaps(&values[i].alpha);
+ }
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
+ swapl(&reply->numIndexValues);
}
WriteToClient(client, rlength, (char *) reply);
@@ -586,409 +563,411 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
}
static int
-ProcRenderQueryDithers (ClientPtr client)
+ProcRenderQueryDithers(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderCreatePicture (ClientPtr client)
+ProcRenderCreatePicture(ClientPtr client)
{
- PicturePtr pPicture;
- DrawablePtr pDrawable;
- PictFormatPtr pFormat;
- int len, error, rc;
+ PicturePtr pPicture;
+ DrawablePtr pDrawable;
+ PictFormatPtr pFormat;
+ int len, error, rc;
+
REQUEST(xRenderCreatePictureReq);
REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq);
LEGAL_NEW_RESOURCE(stuff->pid, client);
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess|DixAddAccess);
+ DixReadAccess | DixAddAccess);
if (rc != Success)
- return rc;
+ return rc;
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format,
- PictFormatType, client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->format,
+ PictFormatType, client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
if (pFormat->depth != pDrawable->depth)
- return BadMatch;
+ return BadMatch;
len = client->req_len - bytes_to_int32(sizeof(xRenderCreatePictureReq));
if (Ones(stuff->mask) != len)
- return BadLength;
-
- pPicture = CreatePicture (stuff->pid,
- pDrawable,
- pFormat,
- stuff->mask,
- (XID *) (stuff + 1),
- client,
- &error);
+ return BadLength;
+
+ pPicture = CreatePicture(stuff->pid,
+ pDrawable,
+ pFormat,
+ stuff->mask, (XID *) (stuff + 1), client, &error);
if (!pPicture)
- return error;
- if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
- return BadAlloc;
+ return error;
+ if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+ return BadAlloc;
return Success;
}
static int
-ProcRenderChangePicture (ClientPtr client)
+ProcRenderChangePicture(ClientPtr client)
{
- PicturePtr pPicture;
+ PicturePtr pPicture;
+
REQUEST(xRenderChangePictureReq);
int len;
REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
len = client->req_len - bytes_to_int32(sizeof(xRenderChangePictureReq));
if (Ones(stuff->mask) != len)
- return BadLength;
-
- return ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1),
- (DevUnion *) 0, client);
+ return BadLength;
+
+ return ChangePicture(pPicture, stuff->mask, (XID *) (stuff + 1),
+ (DevUnion *) 0, client);
}
static int
-ProcRenderSetPictureClipRectangles (ClientPtr client)
+ProcRenderSetPictureClipRectangles(ClientPtr client)
{
REQUEST(xRenderSetPictureClipRectanglesReq);
- PicturePtr pPicture;
- int nr;
+ PicturePtr pPicture;
+ int nr;
REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
if (!pPicture->pDrawable)
return BadDrawable;
nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq);
if (nr & 4)
- return BadLength;
+ return BadLength;
nr >>= 3;
- return SetPictureClipRects (pPicture,
- stuff->xOrigin, stuff->yOrigin,
- nr, (xRectangle *) &stuff[1]);
+ return SetPictureClipRects(pPicture,
+ stuff->xOrigin, stuff->yOrigin,
+ nr, (xRectangle *) &stuff[1]);
}
static int
-ProcRenderFreePicture (ClientPtr client)
+ProcRenderFreePicture(ClientPtr client)
{
- PicturePtr pPicture;
+ PicturePtr pPicture;
+
REQUEST(xRenderFreePictureReq);
REQUEST_SIZE_MATCH(xRenderFreePictureReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixDestroyAccess);
- FreeResource (stuff->picture, RT_NONE);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixDestroyAccess);
+ FreeResource(stuff->picture, RT_NONE);
return Success;
}
static Bool
-PictOpValid (CARD8 op)
+PictOpValid(CARD8 op)
{
- if (/*PictOpMinimum <= op && */ op <= PictOpMaximum)
- return TRUE;
+ if ( /*PictOpMinimum <= op && */ op <= PictOpMaximum)
+ return TRUE;
if (PictOpDisjointMinimum <= op && op <= PictOpDisjointMaximum)
- return TRUE;
+ return TRUE;
if (PictOpConjointMinimum <= op && op <= PictOpConjointMaximum)
- return TRUE;
+ return TRUE;
if (PictOpBlendMinimum <= op && op <= PictOpBlendMaximum)
- return TRUE;
+ return TRUE;
return FALSE;
}
static int
-ProcRenderComposite (ClientPtr client)
+ProcRenderComposite(ClientPtr client)
{
- PicturePtr pSrc, pMask, pDst;
+ PicturePtr pSrc, pMask, pDst;
+
REQUEST(xRenderCompositeReq);
REQUEST_SIZE_MATCH(xRenderCompositeReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
}
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess);
- if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) ||
- (pMask && pMask->pDrawable && pDst->pDrawable->pScreen != pMask->pDrawable->pScreen))
- return BadMatch;
- CompositePicture (stuff->op,
- pSrc,
- pMask,
- pDst,
- stuff->xSrc,
- stuff->ySrc,
- stuff->xMask,
- stuff->yMask,
- stuff->xDst,
- stuff->yDst,
- stuff->width,
- stuff->height);
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_ALPHA(pMask, stuff->mask, client, DixReadAccess);
+ if ((pSrc->pDrawable &&
+ pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) || (pMask &&
+ pMask->
+ pDrawable &&
+ pDst->
+ pDrawable->
+ pScreen !=
+ pMask->
+ pDrawable->
+ pScreen))
+ return BadMatch;
+ CompositePicture(stuff->op,
+ pSrc,
+ pMask,
+ pDst,
+ stuff->xSrc,
+ stuff->ySrc,
+ stuff->xMask,
+ stuff->yMask,
+ stuff->xDst, stuff->yDst, stuff->width, stuff->height);
return Success;
}
static int
-ProcRenderScale (ClientPtr client)
+ProcRenderScale(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderTrapezoids (ClientPtr client)
+ProcRenderTrapezoids(ClientPtr client)
{
- int rc, ntraps;
- PicturePtr pSrc, pDst;
- PictFormatPtr pFormat;
+ int rc, ntraps;
+ PicturePtr pSrc, pDst;
+ PictFormatPtr pFormat;
+
REQUEST(xRenderTrapezoidsReq);
REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
}
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
- return BadMatch;
- if (stuff->maskFormat)
- {
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
- PictFormatType, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ return BadMatch;
+ if (stuff->maskFormat) {
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+ PictFormatType, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
- pFormat = 0;
- ntraps = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
- if (ntraps % sizeof (xTrapezoid))
- return BadLength;
- ntraps /= sizeof (xTrapezoid);
+ pFormat = 0;
+ ntraps = (client->req_len << 2) - sizeof(xRenderTrapezoidsReq);
+ if (ntraps % sizeof(xTrapezoid))
+ return BadLength;
+ ntraps /= sizeof(xTrapezoid);
if (ntraps)
- CompositeTrapezoids (stuff->op, pSrc, pDst, pFormat,
- stuff->xSrc, stuff->ySrc,
- ntraps, (xTrapezoid *) &stuff[1]);
+ CompositeTrapezoids(stuff->op, pSrc, pDst, pFormat,
+ stuff->xSrc, stuff->ySrc,
+ ntraps, (xTrapezoid *) &stuff[1]);
return Success;
}
static int
-ProcRenderTriangles (ClientPtr client)
+ProcRenderTriangles(ClientPtr client)
{
- int rc, ntris;
- PicturePtr pSrc, pDst;
- PictFormatPtr pFormat;
+ int rc, ntris;
+ PicturePtr pSrc, pDst;
+ PictFormatPtr pFormat;
+
REQUEST(xRenderTrianglesReq);
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
}
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
- return BadMatch;
- if (stuff->maskFormat)
- {
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
- PictFormatType, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ return BadMatch;
+ if (stuff->maskFormat) {
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+ PictFormatType, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
- pFormat = 0;
- ntris = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
- if (ntris % sizeof (xTriangle))
- return BadLength;
- ntris /= sizeof (xTriangle);
+ pFormat = 0;
+ ntris = (client->req_len << 2) - sizeof(xRenderTrianglesReq);
+ if (ntris % sizeof(xTriangle))
+ return BadLength;
+ ntris /= sizeof(xTriangle);
if (ntris)
- CompositeTriangles (stuff->op, pSrc, pDst, pFormat,
- stuff->xSrc, stuff->ySrc,
- ntris, (xTriangle *) &stuff[1]);
+ CompositeTriangles(stuff->op, pSrc, pDst, pFormat,
+ stuff->xSrc, stuff->ySrc,
+ ntris, (xTriangle *) &stuff[1]);
return Success;
}
static int
-ProcRenderTriStrip (ClientPtr client)
+ProcRenderTriStrip(ClientPtr client)
{
- int rc, npoints;
- PicturePtr pSrc, pDst;
- PictFormatPtr pFormat;
+ int rc, npoints;
+ PicturePtr pSrc, pDst;
+ PictFormatPtr pFormat;
+
REQUEST(xRenderTrianglesReq);
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
}
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
- return BadMatch;
- if (stuff->maskFormat)
- {
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
- PictFormatType, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ return BadMatch;
+ if (stuff->maskFormat) {
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+ PictFormatType, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
- pFormat = 0;
- npoints = ((client->req_len << 2) - sizeof (xRenderTriStripReq));
+ pFormat = 0;
+ npoints = ((client->req_len << 2) - sizeof(xRenderTriStripReq));
if (npoints & 4)
- return BadLength;
+ return BadLength;
npoints >>= 3;
if (npoints >= 3)
- CompositeTriStrip (stuff->op, pSrc, pDst, pFormat,
- stuff->xSrc, stuff->ySrc,
- npoints, (xPointFixed *) &stuff[1]);
+ CompositeTriStrip(stuff->op, pSrc, pDst, pFormat,
+ stuff->xSrc, stuff->ySrc,
+ npoints, (xPointFixed *) &stuff[1]);
return Success;
}
static int
-ProcRenderTriFan (ClientPtr client)
+ProcRenderTriFan(ClientPtr client)
{
- int rc, npoints;
- PicturePtr pSrc, pDst;
- PictFormatPtr pFormat;
+ int rc, npoints;
+ PicturePtr pSrc, pDst;
+ PictFormatPtr pFormat;
+
REQUEST(xRenderTrianglesReq);
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
}
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
- return BadMatch;
- if (stuff->maskFormat)
- {
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
- PictFormatType, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ return BadMatch;
+ if (stuff->maskFormat) {
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+ PictFormatType, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
- pFormat = 0;
- npoints = ((client->req_len << 2) - sizeof (xRenderTriStripReq));
+ pFormat = 0;
+ npoints = ((client->req_len << 2) - sizeof(xRenderTriStripReq));
if (npoints & 4)
- return BadLength;
+ return BadLength;
npoints >>= 3;
if (npoints >= 3)
- CompositeTriFan (stuff->op, pSrc, pDst, pFormat,
- stuff->xSrc, stuff->ySrc,
- npoints, (xPointFixed *) &stuff[1]);
+ CompositeTriFan(stuff->op, pSrc, pDst, pFormat,
+ stuff->xSrc, stuff->ySrc,
+ npoints, (xPointFixed *) &stuff[1]);
return Success;
}
static int
-ProcRenderColorTrapezoids (ClientPtr client)
+ProcRenderColorTrapezoids(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderColorTriangles (ClientPtr client)
+ProcRenderColorTriangles(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderTransform (ClientPtr client)
+ProcRenderTransform(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderCreateGlyphSet (ClientPtr client)
+ProcRenderCreateGlyphSet(ClientPtr client)
{
- GlyphSetPtr glyphSet;
- PictFormatPtr format;
- int rc, f;
+ GlyphSetPtr glyphSet;
+ PictFormatPtr format;
+ int rc, f;
+
REQUEST(xRenderCreateGlyphSetReq);
REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq);
LEGAL_NEW_RESOURCE(stuff->gsid, client);
- rc = dixLookupResourceByType((pointer *)&format, stuff->format,
- PictFormatType, client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &format, stuff->format,
+ PictFormatType, client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (format->depth) {
case 1:
- f = GlyphFormat1;
- break;
+ f = GlyphFormat1;
+ break;
case 4:
- f = GlyphFormat4;
- break;
+ f = GlyphFormat4;
+ break;
case 8:
- f = GlyphFormat8;
- break;
+ f = GlyphFormat8;
+ break;
case 16:
- f = GlyphFormat16;
- break;
+ f = GlyphFormat16;
+ break;
case 32:
- f = GlyphFormat32;
- break;
+ f = GlyphFormat32;
+ break;
default:
- return BadMatch;
+ return BadMatch;
}
if (format->type != PictTypeDirect)
- return BadMatch;
- glyphSet = AllocateGlyphSet (f, format);
+ return BadMatch;
+ glyphSet = AllocateGlyphSet(f, format);
if (!glyphSet)
- return BadAlloc;
+ return BadAlloc;
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->gsid, GlyphSetType,
- glyphSet, RT_NONE, NULL, DixCreateAccess);
+ glyphSet, RT_NONE, NULL, DixCreateAccess);
if (rc != Success)
- return rc;
- if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet))
- return BadAlloc;
+ return rc;
+ if (!AddResource(stuff->gsid, GlyphSetType, (pointer) glyphSet))
+ return BadAlloc;
return Success;
}
static int
-ProcRenderReferenceGlyphSet (ClientPtr client)
+ProcRenderReferenceGlyphSet(ClientPtr client)
{
- GlyphSetPtr glyphSet;
+ GlyphSetPtr glyphSet;
int rc;
+
REQUEST(xRenderReferenceGlyphSetReq);
REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq);
LEGAL_NEW_RESOURCE(stuff->gsid, client);
- rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->existing, GlyphSetType,
- client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->existing;
- return rc;
+ rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->existing,
+ GlyphSetType, client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->existing;
+ return rc;
}
glyphSet->refcnt++;
- if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet))
- return BadAlloc;
+ if (!AddResource(stuff->gsid, GlyphSetType, (pointer) glyphSet))
+ return BadAlloc;
return Success;
}
@@ -996,616 +975,576 @@ ProcRenderReferenceGlyphSet (ClientPtr client)
#define NLOCALGLYPH 256
static int
-ProcRenderFreeGlyphSet (ClientPtr client)
+ProcRenderFreeGlyphSet(ClientPtr client)
{
- GlyphSetPtr glyphSet;
+ GlyphSetPtr glyphSet;
int rc;
+
REQUEST(xRenderFreeGlyphSetReq);
REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
- rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
- client, DixDestroyAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->glyphset;
- return rc;
+ rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+ GlyphSetType, client, DixDestroyAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->glyphset;
+ return rc;
}
- FreeResource (stuff->glyphset, RT_NONE);
+ FreeResource(stuff->glyphset, RT_NONE);
return Success;
}
typedef struct _GlyphNew {
- Glyph id;
- GlyphPtr glyph;
- Bool found;
- unsigned char sha1[20];
+ Glyph id;
+ GlyphPtr glyph;
+ Bool found;
+ unsigned char sha1[20];
} GlyphNewRec, *GlyphNewPtr;
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
static int
-ProcRenderAddGlyphs (ClientPtr client)
+ProcRenderAddGlyphs(ClientPtr client)
{
- GlyphSetPtr glyphSet;
+ GlyphSetPtr glyphSet;
+
REQUEST(xRenderAddGlyphsReq);
- GlyphNewRec glyphsLocal[NLOCALGLYPH];
- GlyphNewPtr glyphsBase, glyphs, glyph_new;
- int remain, nglyphs;
- CARD32 *gids;
- xGlyphInfo *gi;
- CARD8 *bits;
- unsigned int size;
- int err;
- int i, screen;
- PicturePtr pSrc = NULL, pDst = NULL;
- PixmapPtr pSrcPix = NULL, pDstPix = NULL;
- CARD32 component_alpha;
+ GlyphNewRec glyphsLocal[NLOCALGLYPH];
+ GlyphNewPtr glyphsBase, glyphs, glyph_new;
+ int remain, nglyphs;
+ CARD32 *gids;
+ xGlyphInfo *gi;
+ CARD8 *bits;
+ unsigned int size;
+ int err;
+ int i, screen;
+ PicturePtr pSrc = NULL, pDst = NULL;
+ PixmapPtr pSrcPix = NULL, pDstPix = NULL;
+ CARD32 component_alpha;
REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
- err = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
- client, DixAddAccess);
- if (err != Success)
- {
- client->errorValue = stuff->glyphset;
- return err;
+ err =
+ dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+ GlyphSetType, client, DixAddAccess);
+ if (err != Success) {
+ client->errorValue = stuff->glyphset;
+ return err;
}
err = BadAlloc;
nglyphs = stuff->nglyphs;
if (nglyphs > UINT32_MAX / sizeof(GlyphNewRec))
- return BadAlloc;
+ return BadAlloc;
- component_alpha = NeedsComponent (glyphSet->format->format);
+ component_alpha = NeedsComponent(glyphSet->format->format);
if (nglyphs <= NLOCALGLYPH) {
- memset (glyphsLocal, 0, sizeof (glyphsLocal));
- glyphsBase = glyphsLocal;
+ memset(glyphsLocal, 0, sizeof(glyphsLocal));
+ glyphsBase = glyphsLocal;
}
- else
- {
- glyphsBase = (GlyphNewPtr)calloc(nglyphs, sizeof (GlyphNewRec));
- if (!glyphsBase)
- return BadAlloc;
+ else {
+ glyphsBase = (GlyphNewPtr) calloc(nglyphs, sizeof(GlyphNewRec));
+ if (!glyphsBase)
+ return BadAlloc;
}
- remain = (client->req_len << 2) - sizeof (xRenderAddGlyphsReq);
+ remain = (client->req_len << 2) - sizeof(xRenderAddGlyphsReq);
glyphs = glyphsBase;
gids = (CARD32 *) (stuff + 1);
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
- remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+ remain -= (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs;
/* protect against bad nglyphs */
- if (gi < ((xGlyphInfo *)stuff) ||
- gi > ((xGlyphInfo *)((CARD32 *)stuff + client->req_len)) ||
- bits < ((CARD8 *)stuff) ||
- bits > ((CARD8 *)((CARD32 *)stuff + client->req_len))) {
+ if (gi < ((xGlyphInfo *) stuff) ||
+ gi > ((xGlyphInfo *) ((CARD32 *) stuff + client->req_len)) ||
+ bits < ((CARD8 *) stuff) ||
+ bits > ((CARD8 *) ((CARD32 *) stuff + client->req_len))) {
err = BadLength;
goto bail;
}
- for (i = 0; i < nglyphs; i++)
- {
- size_t padded_width;
- glyph_new = &glyphs[i];
-
- padded_width = PixmapBytePad (gi[i].width,
- glyphSet->format->depth);
-
- if (gi[i].height && padded_width > (UINT32_MAX - sizeof(GlyphRec))/gi[i].height)
- break;
-
- size = gi[i].height * padded_width;
- if (remain < size)
- break;
-
- err = HashGlyph (&gi[i], bits, size, glyph_new->sha1);
- if (err)
- goto bail;
-
- glyph_new->glyph = FindGlyphByHash (glyph_new->sha1,
- glyphSet->fdepth);
-
- if (glyph_new->glyph && glyph_new->glyph != DeletedGlyph)
- {
- glyph_new->found = TRUE;
- }
- else
- {
- GlyphPtr glyph;
-
- glyph_new->found = FALSE;
- glyph_new->glyph = glyph = AllocateGlyph (&gi[i], glyphSet->fdepth);
- if (! glyph)
- {
- err = BadAlloc;
- goto bail;
- }
-
- for (screen = 0; screen < screenInfo.numScreens; screen++)
- {
- int width = gi[i].width;
- int height = gi[i].height;
- int depth = glyphSet->format->depth;
- ScreenPtr pScreen;
- int error;
-
- /* Skip work if it's invisibly small anyway */
- if (!width || !height)
- break;
-
- pScreen = screenInfo.screens[screen];
- pSrcPix = GetScratchPixmapHeader (pScreen,
- width, height,
- depth, depth,
- -1, bits);
- if (! pSrcPix)
- {
- err = BadAlloc;
- goto bail;
- }
-
- pSrc = CreatePicture (0, &pSrcPix->drawable,
- glyphSet->format, 0, NULL,
- serverClient, &error);
- if (! pSrc)
- {
- err = BadAlloc;
- goto bail;
- }
-
- pDstPix = (pScreen->CreatePixmap) (pScreen,
- width, height, depth,
- CREATE_PIXMAP_USAGE_GLYPH_PICTURE);
-
- if (!pDstPix)
- {
- err = BadAlloc;
- goto bail;
- }
-
- GlyphPicture (glyph)[screen] = pDst =
- CreatePicture (0, &pDstPix->drawable,
- glyphSet->format,
- CPComponentAlpha, &component_alpha,
- serverClient, &error);
-
- /* The picture takes a reference to the pixmap, so we
- drop ours. */
- (pScreen->DestroyPixmap) (pDstPix);
- pDstPix = NULL;
-
- if (! pDst)
- {
- err = BadAlloc;
- goto bail;
- }
-
- CompositePicture (PictOpSrc,
- pSrc,
- None,
- pDst,
- 0, 0,
- 0, 0,
- 0, 0,
- width, height);
-
- FreePicture ((pointer) pSrc, 0);
- pSrc = NULL;
- FreeScratchPixmapHeader (pSrcPix);
- pSrcPix = NULL;
- }
-
- memcpy (glyph_new->glyph->sha1, glyph_new->sha1, 20);
- }
-
- glyph_new->id = gids[i];
-
- if (size & 3)
- size += 4 - (size & 3);
- bits += size;
- remain -= size;
- }
- if (remain || i < nglyphs)
- {
- err = BadLength;
- goto bail;
- }
- if (!ResizeGlyphSet (glyphSet, nglyphs))
- {
- err = BadAlloc;
- goto bail;
+ for (i = 0; i < nglyphs; i++) {
+ size_t padded_width;
+
+ glyph_new = &glyphs[i];
+
+ padded_width = PixmapBytePad(gi[i].width, glyphSet->format->depth);
+
+ if (gi[i].height &&
+ padded_width > (UINT32_MAX - sizeof(GlyphRec)) / gi[i].height)
+ break;
+
+ size = gi[i].height * padded_width;
+ if (remain < size)
+ break;
+
+ err = HashGlyph(&gi[i], bits, size, glyph_new->sha1);
+ if (err)
+ goto bail;
+
+ glyph_new->glyph = FindGlyphByHash(glyph_new->sha1, glyphSet->fdepth);
+
+ if (glyph_new->glyph && glyph_new->glyph != DeletedGlyph) {
+ glyph_new->found = TRUE;
+ }
+ else {
+ GlyphPtr glyph;
+
+ glyph_new->found = FALSE;
+ glyph_new->glyph = glyph = AllocateGlyph(&gi[i], glyphSet->fdepth);
+ if (!glyph) {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ for (screen = 0; screen < screenInfo.numScreens; screen++) {
+ int width = gi[i].width;
+ int height = gi[i].height;
+ int depth = glyphSet->format->depth;
+ ScreenPtr pScreen;
+ int error;
+
+ /* Skip work if it's invisibly small anyway */
+ if (!width || !height)
+ break;
+
+ pScreen = screenInfo.screens[screen];
+ pSrcPix = GetScratchPixmapHeader(pScreen,
+ width, height,
+ depth, depth, -1, bits);
+ if (!pSrcPix) {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ pSrc = CreatePicture(0, &pSrcPix->drawable,
+ glyphSet->format, 0, NULL,
+ serverClient, &error);
+ if (!pSrc) {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ pDstPix = (pScreen->CreatePixmap) (pScreen,
+ width, height, depth,
+ CREATE_PIXMAP_USAGE_GLYPH_PICTURE);
+
+ if (!pDstPix) {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ GlyphPicture(glyph)[screen] = pDst =
+ CreatePicture(0, &pDstPix->drawable,
+ glyphSet->format,
+ CPComponentAlpha, &component_alpha,
+ serverClient, &error);
+
+ /* The picture takes a reference to the pixmap, so we
+ drop ours. */
+ (pScreen->DestroyPixmap) (pDstPix);
+ pDstPix = NULL;
+
+ if (!pDst) {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ CompositePicture(PictOpSrc,
+ pSrc,
+ None, pDst, 0, 0, 0, 0, 0, 0, width, height);
+
+ FreePicture((pointer) pSrc, 0);
+ pSrc = NULL;
+ FreeScratchPixmapHeader(pSrcPix);
+ pSrcPix = NULL;
+ }
+
+ memcpy(glyph_new->glyph->sha1, glyph_new->sha1, 20);
+ }
+
+ glyph_new->id = gids[i];
+
+ if (size & 3)
+ size += 4 - (size & 3);
+ bits += size;
+ remain -= size;
+ }
+ if (remain || i < nglyphs) {
+ err = BadLength;
+ goto bail;
+ }
+ if (!ResizeGlyphSet(glyphSet, nglyphs)) {
+ err = BadAlloc;
+ goto bail;
}
for (i = 0; i < nglyphs; i++)
- AddGlyph (glyphSet, glyphs[i].glyph, glyphs[i].id);
+ AddGlyph(glyphSet, glyphs[i].glyph, glyphs[i].id);
if (glyphsBase != glyphsLocal)
- free(glyphsBase);
+ free(glyphsBase);
return Success;
-bail:
+ bail:
if (pSrc)
- FreePicture ((pointer) pSrc, 0);
+ FreePicture((pointer) pSrc, 0);
if (pSrcPix)
- FreeScratchPixmapHeader (pSrcPix);
+ FreeScratchPixmapHeader(pSrcPix);
for (i = 0; i < nglyphs; i++)
- if (glyphs[i].glyph && ! glyphs[i].found)
- free(glyphs[i].glyph);
+ if (glyphs[i].glyph && !glyphs[i].found)
+ free(glyphs[i].glyph);
if (glyphsBase != glyphsLocal)
- free(glyphsBase);
+ free(glyphsBase);
return err;
}
static int
-ProcRenderAddGlyphsFromPicture (ClientPtr client)
+ProcRenderAddGlyphsFromPicture(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderFreeGlyphs (ClientPtr client)
+ProcRenderFreeGlyphs(ClientPtr client)
{
REQUEST(xRenderFreeGlyphsReq);
- GlyphSetPtr glyphSet;
- int rc, nglyph;
- CARD32 *gids;
- CARD32 glyph;
+ GlyphSetPtr glyphSet;
+ int rc, nglyph;
+ CARD32 *gids;
+ CARD32 glyph;
REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
- rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
- client, DixRemoveAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->glyphset;
- return rc;
- }
- nglyph = bytes_to_int32((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq));
+ rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+ GlyphSetType, client, DixRemoveAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->glyphset;
+ return rc;
+ }
+ nglyph =
+ bytes_to_int32((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq));
gids = (CARD32 *) (stuff + 1);
- while (nglyph-- > 0)
- {
- glyph = *gids++;
- if (!DeleteGlyph (glyphSet, glyph))
- {
- client->errorValue = glyph;
- return RenderErrBase + BadGlyph;
- }
+ while (nglyph-- > 0) {
+ glyph = *gids++;
+ if (!DeleteGlyph(glyphSet, glyph)) {
+ client->errorValue = glyph;
+ return RenderErrBase + BadGlyph;
+ }
}
return Success;
}
static int
-ProcRenderCompositeGlyphs (ClientPtr client)
-{
- GlyphSetPtr glyphSet;
- GlyphSet gs;
- PicturePtr pSrc, pDst;
- PictFormatPtr pFormat;
- GlyphListRec listsLocal[NLOCALDELTA];
- GlyphListPtr lists, listsBase;
- GlyphPtr glyphsLocal[NLOCALGLYPH];
- Glyph glyph;
- GlyphPtr *glyphs, *glyphsBase;
- xGlyphElt *elt;
- CARD8 *buffer, *end;
- int nglyph;
- int nlist;
- int space;
- int size;
- int rc, n;
-
+ProcRenderCompositeGlyphs(ClientPtr client)
+{
+ GlyphSetPtr glyphSet;
+ GlyphSet gs;
+ PicturePtr pSrc, pDst;
+ PictFormatPtr pFormat;
+ GlyphListRec listsLocal[NLOCALDELTA];
+ GlyphListPtr lists, listsBase;
+ GlyphPtr glyphsLocal[NLOCALGLYPH];
+ Glyph glyph;
+ GlyphPtr *glyphs, *glyphsBase;
+ xGlyphElt *elt;
+ CARD8 *buffer, *end;
+ int nglyph;
+ int nlist;
+ int space;
+ int size;
+ int rc, n;
+
REQUEST(xRenderCompositeGlyphsReq);
REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq);
switch (stuff->renderReqType) {
- default: size = 1; break;
- case X_RenderCompositeGlyphs16: size = 2; break;
- case X_RenderCompositeGlyphs32: size = 4; break;
- }
-
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
- }
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ default:
+ size = 1;
+ break;
+ case X_RenderCompositeGlyphs16:
+ size = 2;
+ break;
+ case X_RenderCompositeGlyphs32:
+ size = 4;
+ break;
+ }
+
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
+ }
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
- return BadMatch;
- if (stuff->maskFormat)
- {
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
- PictFormatType, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ return BadMatch;
+ if (stuff->maskFormat) {
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+ PictFormatType, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
- pFormat = 0;
+ pFormat = 0;
- rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset,
- GlyphSetType, client, DixUseAccess);
+ rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+ GlyphSetType, client, DixUseAccess);
if (rc != Success)
- return rc;
+ return rc;
buffer = (CARD8 *) (stuff + 1);
end = (CARD8 *) stuff + (client->req_len << 2);
nglyph = 0;
nlist = 0;
- while (buffer + sizeof (xGlyphElt) < end)
- {
- elt = (xGlyphElt *) buffer;
- buffer += sizeof (xGlyphElt);
-
- if (elt->len == 0xff)
- {
- buffer += 4;
- }
- else
- {
- nlist++;
- nglyph += elt->len;
- space = size * elt->len;
- if (space & 3)
- space += 4 - (space & 3);
- buffer += space;
- }
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *) buffer;
+ buffer += sizeof(xGlyphElt);
+
+ if (elt->len == 0xff) {
+ buffer += 4;
+ }
+ else {
+ nlist++;
+ nglyph += elt->len;
+ space = size * elt->len;
+ if (space & 3)
+ space += 4 - (space & 3);
+ buffer += space;
+ }
}
if (nglyph <= NLOCALGLYPH)
- glyphsBase = glyphsLocal;
- else
- {
- glyphsBase = (GlyphPtr *) malloc(nglyph * sizeof (GlyphPtr));
- if (!glyphsBase)
- return BadAlloc;
+ glyphsBase = glyphsLocal;
+ else {
+ glyphsBase = (GlyphPtr *) malloc(nglyph * sizeof(GlyphPtr));
+ if (!glyphsBase)
+ return BadAlloc;
}
if (nlist <= NLOCALDELTA)
- listsBase = listsLocal;
- else
- {
- listsBase = (GlyphListPtr) malloc(nlist * sizeof (GlyphListRec));
- if (!listsBase) {
- rc = BadAlloc;
- goto bail;
- }
+ listsBase = listsLocal;
+ else {
+ listsBase = (GlyphListPtr) malloc(nlist * sizeof(GlyphListRec));
+ if (!listsBase) {
+ rc = BadAlloc;
+ goto bail;
+ }
}
buffer = (CARD8 *) (stuff + 1);
glyphs = glyphsBase;
lists = listsBase;
- while (buffer + sizeof (xGlyphElt) < end)
- {
- elt = (xGlyphElt *) buffer;
- buffer += sizeof (xGlyphElt);
-
- if (elt->len == 0xff)
- {
- if (buffer + sizeof (GlyphSet) < end)
- {
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *) buffer;
+ buffer += sizeof(xGlyphElt);
+
+ if (elt->len == 0xff) {
+ if (buffer + sizeof(GlyphSet) < end) {
memcpy(&gs, buffer, sizeof(GlyphSet));
- rc = dixLookupResourceByType((pointer *)&glyphSet, gs,
- GlyphSetType, client,
- DixUseAccess);
- if (rc != Success)
- goto bail;
- }
- buffer += 4;
- }
- else
- {
- lists->xOff = elt->deltax;
- lists->yOff = elt->deltay;
- lists->format = glyphSet->format;
- lists->len = 0;
- n = elt->len;
- while (n--)
- {
- if (buffer + size <= end)
- {
- switch (size) {
- case 1:
- glyph = *((CARD8 *)buffer); break;
- case 2:
- glyph = *((CARD16 *)buffer); break;
- case 4:
- default:
- glyph = *((CARD32 *)buffer); break;
- }
- if ((*glyphs = FindGlyph (glyphSet, glyph)))
- {
- lists->len++;
- glyphs++;
- }
- }
- buffer += size;
- }
- space = size * elt->len;
- if (space & 3)
- buffer += 4 - (space & 3);
- lists++;
- }
+ rc = dixLookupResourceByType((pointer *) &glyphSet, gs,
+ GlyphSetType, client,
+ DixUseAccess);
+ if (rc != Success)
+ goto bail;
+ }
+ buffer += 4;
+ }
+ else {
+ lists->xOff = elt->deltax;
+ lists->yOff = elt->deltay;
+ lists->format = glyphSet->format;
+ lists->len = 0;
+ n = elt->len;
+ while (n--) {
+ if (buffer + size <= end) {
+ switch (size) {
+ case 1:
+ glyph = *((CARD8 *) buffer);
+ break;
+ case 2:
+ glyph = *((CARD16 *) buffer);
+ break;
+ case 4:
+ default:
+ glyph = *((CARD32 *) buffer);
+ break;
+ }
+ if ((*glyphs = FindGlyph(glyphSet, glyph))) {
+ lists->len++;
+ glyphs++;
+ }
+ }
+ buffer += size;
+ }
+ space = size * elt->len;
+ if (space & 3)
+ buffer += 4 - (space & 3);
+ lists++;
+ }
}
if (buffer > end) {
- rc = BadLength;
- goto bail;
- }
-
- CompositeGlyphs (stuff->op,
- pSrc,
- pDst,
- pFormat,
- stuff->xSrc,
- stuff->ySrc,
- nlist,
- listsBase,
- glyphsBase);
+ rc = BadLength;
+ goto bail;
+ }
+
+ CompositeGlyphs(stuff->op,
+ pSrc,
+ pDst,
+ pFormat,
+ stuff->xSrc, stuff->ySrc, nlist, listsBase, glyphsBase);
rc = Success;
-bail:
+ bail:
if (glyphsBase != glyphsLocal)
- free(glyphsBase);
+ free(glyphsBase);
if (listsBase != listsLocal)
- free(listsBase);
+ free(listsBase);
return rc;
}
static int
-ProcRenderFillRectangles (ClientPtr client)
+ProcRenderFillRectangles(ClientPtr client)
{
- PicturePtr pDst;
- int things;
+ PicturePtr pDst;
+ int things;
+
REQUEST(xRenderFillRectanglesReq);
-
- REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
- }
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+
+ REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq);
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
+ }
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
-
+
things = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq);
if (things & 4)
- return BadLength;
+ return BadLength;
things >>= 3;
-
- CompositeRects (stuff->op,
- pDst,
- &stuff->color,
- things,
- (xRectangle *) &stuff[1]);
-
+
+ CompositeRects(stuff->op,
+ pDst, &stuff->color, things, (xRectangle *) &stuff[1]);
+
return Success;
}
static void
-RenderSetBit (unsigned char *line, int x, int bit)
+RenderSetBit(unsigned char *line, int x, int bit)
{
- unsigned char mask;
-
+ unsigned char mask;
+
if (screenInfo.bitmapBitOrder == LSBFirst)
- mask = (1 << (x & 7));
+ mask = (1 << (x & 7));
else
- mask = (0x80 >> (x & 7));
+ mask = (0x80 >> (x & 7));
/* XXX assumes byte order is host byte order */
line += (x >> 3);
if (bit)
- *line |= mask;
+ *line |= mask;
else
- *line &= ~mask;
+ *line &= ~mask;
}
#define DITHER_DIM 2
static CARD32 orderedDither[DITHER_DIM][DITHER_DIM] = {
- { 1, 3, },
- { 4, 2, },
+ {1, 3,},
+ {4, 2,},
};
#define DITHER_SIZE ((sizeof orderedDither / sizeof orderedDither[0][0]) + 1)
static int
-ProcRenderCreateCursor (ClientPtr client)
+ProcRenderCreateCursor(ClientPtr client)
{
REQUEST(xRenderCreateCursorReq);
- PicturePtr pSrc;
- ScreenPtr pScreen;
- unsigned short width, height;
- CARD32 *argbbits, *argb;
- unsigned char *srcbits, *srcline;
- unsigned char *mskbits, *mskline;
- int stride;
- int x, y;
- int nbytes_mono;
+ PicturePtr pSrc;
+ ScreenPtr pScreen;
+ unsigned short width, height;
+ CARD32 *argbbits, *argb;
+ unsigned char *srcbits, *srcline;
+ unsigned char *mskbits, *mskline;
+ int stride;
+ int x, y;
+ int nbytes_mono;
CursorMetricRec cm;
- CursorPtr pCursor;
- CARD32 twocolor[3];
- int rc, ncolor;
+ CursorPtr pCursor;
+ CARD32 twocolor[3];
+ int rc, ncolor;
- REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
+ REQUEST_SIZE_MATCH(xRenderCreateCursorReq);
LEGAL_NEW_RESOURCE(stuff->cid, client);
-
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
if (!pSrc->pDrawable)
return BadDrawable;
pScreen = pSrc->pDrawable->pScreen;
width = pSrc->pDrawable->width;
height = pSrc->pDrawable->height;
- if (height && width > UINT32_MAX/(height*sizeof(CARD32)))
- return BadAlloc;
- if ( stuff->x > width
- || stuff->y > height )
- return BadMatch;
- argbbits = malloc(width * height * sizeof (CARD32));
+ if (height && width > UINT32_MAX / (height * sizeof(CARD32)))
+ return BadAlloc;
+ if (stuff->x > width || stuff->y > height)
+ return BadMatch;
+ argbbits = malloc(width * height * sizeof(CARD32));
if (!argbbits)
- return BadAlloc;
-
+ return BadAlloc;
+
stride = BitmapBytePad(width);
- nbytes_mono = stride*height;
+ nbytes_mono = stride * height;
srcbits = calloc(1, nbytes_mono);
- if (!srcbits)
- {
- free(argbbits);
- return BadAlloc;
+ if (!srcbits) {
+ free(argbbits);
+ return BadAlloc;
}
mskbits = calloc(1, nbytes_mono);
- if (!mskbits)
- {
- free(argbbits);
- free(srcbits);
- return BadAlloc;
- }
-
- if (pSrc->format == PICT_a8r8g8b8)
- {
- (*pScreen->GetImage) (pSrc->pDrawable,
- 0, 0, width, height, ZPixmap,
- 0xffffffff, (pointer) argbbits);
- }
- else
- {
- PixmapPtr pPixmap;
- PicturePtr pPicture;
- PictFormatPtr pFormat;
- int error;
-
- pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
- if (!pFormat)
- {
- free(argbbits);
- free(srcbits);
- free(mskbits);
- return BadImplementation;
- }
- pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap)
- {
- free(argbbits);
- free(srcbits);
- free(mskbits);
- return BadAlloc;
- }
- pPicture = CreatePicture (0, &pPixmap->drawable, pFormat, 0, 0,
- client, &error);
- if (!pPicture)
- {
- free(argbbits);
- free(srcbits);
- free(mskbits);
- return error;
- }
- (*pScreen->DestroyPixmap) (pPixmap);
- CompositePicture (PictOpSrc,
- pSrc, 0, pPicture,
- 0, 0, 0, 0, 0, 0, width, height);
- (*pScreen->GetImage) (pPicture->pDrawable,
- 0, 0, width, height, ZPixmap,
- 0xffffffff, (pointer) argbbits);
- FreePicture (pPicture, 0);
+ if (!mskbits) {
+ free(argbbits);
+ free(srcbits);
+ return BadAlloc;
+ }
+
+ if (pSrc->format == PICT_a8r8g8b8) {
+ (*pScreen->GetImage) (pSrc->pDrawable,
+ 0, 0, width, height, ZPixmap,
+ 0xffffffff, (pointer) argbbits);
+ }
+ else {
+ PixmapPtr pPixmap;
+ PicturePtr pPicture;
+ PictFormatPtr pFormat;
+ int error;
+
+ pFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8);
+ if (!pFormat) {
+ free(argbbits);
+ free(srcbits);
+ free(mskbits);
+ return BadImplementation;
+ }
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pPixmap) {
+ free(argbbits);
+ free(srcbits);
+ free(mskbits);
+ return BadAlloc;
+ }
+ pPicture = CreatePicture(0, &pPixmap->drawable, pFormat, 0, 0,
+ client, &error);
+ if (!pPicture) {
+ free(argbbits);
+ free(srcbits);
+ free(mskbits);
+ return error;
+ }
+ (*pScreen->DestroyPixmap) (pPixmap);
+ CompositePicture(PictOpSrc,
+ pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height);
+ (*pScreen->GetImage) (pPicture->pDrawable,
+ 0, 0, width, height, ZPixmap,
+ 0xffffffff, (pointer) argbbits);
+ FreePicture(pPicture, 0);
}
/*
* Check whether the cursor can be directly supported by
@@ -1613,314 +1552,300 @@ ProcRenderCreateCursor (ClientPtr client)
*/
ncolor = 0;
argb = argbbits;
- for (y = 0; ncolor <= 2 && y < height; y++)
- {
- for (x = 0; ncolor <= 2 && x < width; x++)
- {
- CARD32 p = *argb++;
- CARD32 a = (p >> 24);
-
- if (a == 0) /* transparent */
- continue;
- if (a == 0xff) /* opaque */
- {
- int n;
- for (n = 0; n < ncolor; n++)
- if (p == twocolor[n])
- break;
- if (n == ncolor)
- twocolor[ncolor++] = p;
- }
- else
- ncolor = 3;
- }
- }
-
+ for (y = 0; ncolor <= 2 && y < height; y++) {
+ for (x = 0; ncolor <= 2 && x < width; x++) {
+ CARD32 p = *argb++;
+ CARD32 a = (p >> 24);
+
+ if (a == 0) /* transparent */
+ continue;
+ if (a == 0xff) { /* opaque */
+ int n;
+
+ for (n = 0; n < ncolor; n++)
+ if (p == twocolor[n])
+ break;
+ if (n == ncolor)
+ twocolor[ncolor++] = p;
+ }
+ else
+ ncolor = 3;
+ }
+ }
+
/*
* Convert argb image to two plane cursor
*/
srcline = srcbits;
mskline = mskbits;
argb = argbbits;
- for (y = 0; y < height; y++)
- {
- for (x = 0; x < width; x++)
- {
- CARD32 p = *argb++;
-
- if (ncolor <= 2)
- {
- CARD32 a = ((p >> 24));
-
- RenderSetBit (mskline, x, a != 0);
- RenderSetBit (srcline, x, a != 0 && p == twocolor[0]);
- }
- else
- {
- CARD32 a = ((p >> 24) * DITHER_SIZE + 127) / 255;
- CARD32 i = ((CvtR8G8B8toY15(p) >> 7) * DITHER_SIZE + 127) / 255;
- CARD32 d = orderedDither[y&(DITHER_DIM-1)][x&(DITHER_DIM-1)];
- /* Set mask from dithered alpha value */
- RenderSetBit(mskline, x, a > d);
- /* Set src from dithered intensity value */
- RenderSetBit(srcline, x, a > d && i <= d);
- }
- }
- srcline += stride;
- mskline += stride;
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ CARD32 p = *argb++;
+
+ if (ncolor <= 2) {
+ CARD32 a = ((p >> 24));
+
+ RenderSetBit(mskline, x, a != 0);
+ RenderSetBit(srcline, x, a != 0 && p == twocolor[0]);
+ }
+ else {
+ CARD32 a = ((p >> 24) * DITHER_SIZE + 127) / 255;
+ CARD32 i = ((CvtR8G8B8toY15(p) >> 7) * DITHER_SIZE + 127) / 255;
+ CARD32 d =
+ orderedDither[y & (DITHER_DIM - 1)][x & (DITHER_DIM - 1)];
+ /* Set mask from dithered alpha value */
+ RenderSetBit(mskline, x, a > d);
+ /* Set src from dithered intensity value */
+ RenderSetBit(srcline, x, a > d && i <= d);
+ }
+ }
+ srcline += stride;
+ mskline += stride;
}
/*
* Dither to white and black if the cursor has more than two colors
*/
- if (ncolor > 2)
- {
- twocolor[0] = 0xff000000;
- twocolor[1] = 0xffffffff;
+ if (ncolor > 2) {
+ twocolor[0] = 0xff000000;
+ twocolor[1] = 0xffffffff;
}
- else
- {
- free(argbbits);
- argbbits = 0;
+ else {
+ free(argbbits);
+ argbbits = 0;
}
-
+
#define GetByte(p,s) (((p) >> (s)) & 0xff)
#define GetColor(p,s) (GetByte(p,s) | (GetByte(p,s) << 8))
-
+
cm.width = width;
cm.height = height;
cm.xhot = stuff->x;
cm.yhot = stuff->y;
rc = AllocARGBCursor(srcbits, mskbits, argbbits, &cm,
- GetColor(twocolor[0], 16),
- GetColor(twocolor[0], 8),
- GetColor(twocolor[0], 0),
- GetColor(twocolor[1], 16),
- GetColor(twocolor[1], 8),
- GetColor(twocolor[1], 0),
- &pCursor, client, stuff->cid);
+ GetColor(twocolor[0], 16),
+ GetColor(twocolor[0], 8),
+ GetColor(twocolor[0], 0),
+ GetColor(twocolor[1], 16),
+ GetColor(twocolor[1], 8),
+ GetColor(twocolor[1], 0),
+ &pCursor, client, stuff->cid);
if (rc != Success)
- goto bail;
- if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) {
- rc = BadAlloc;
- goto bail;
+ goto bail;
+ if (!AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor)) {
+ rc = BadAlloc;
+ goto bail;
}
return Success;
-bail:
+ bail:
free(srcbits);
free(mskbits);
return rc;
}
static int
-ProcRenderSetPictureTransform (ClientPtr client)
+ProcRenderSetPictureTransform(ClientPtr client)
{
REQUEST(xRenderSetPictureTransformReq);
- PicturePtr pPicture;
+ PicturePtr pPicture;
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
- return SetPictureTransform (pPicture, (PictTransform *) &stuff->transform);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
+ return SetPictureTransform(pPicture, (PictTransform *) &stuff->transform);
}
static int
-ProcRenderQueryFilters (ClientPtr client)
+ProcRenderQueryFilters(ClientPtr client)
{
- REQUEST (xRenderQueryFiltersReq);
- DrawablePtr pDrawable;
- xRenderQueryFiltersReply *reply;
- int nbytesName;
- int nnames;
- ScreenPtr pScreen;
- PictureScreenPtr ps;
- int i, j, len, total_bytes, rc;
- INT16 *aliases;
- char *names;
+ REQUEST(xRenderQueryFiltersReq);
+ DrawablePtr pDrawable;
+ xRenderQueryFiltersReply *reply;
+ int nbytesName;
+ int nnames;
+ ScreenPtr pScreen;
+ PictureScreenPtr ps;
+ int i, j, len, total_bytes, rc;
+ INT16 *aliases;
+ char *names;
REQUEST_SIZE_MATCH(xRenderQueryFiltersReq);
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
-
+ return rc;
+
pScreen = pDrawable->pScreen;
nbytesName = 0;
nnames = 0;
ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- {
- for (i = 0; i < ps->nfilters; i++)
- nbytesName += 1 + strlen (ps->filters[i].name);
- for (i = 0; i < ps->nfilterAliases; i++)
- nbytesName += 1 + strlen (ps->filterAliases[i].alias);
- nnames = ps->nfilters + ps->nfilterAliases;
+ if (ps) {
+ for (i = 0; i < ps->nfilters; i++)
+ nbytesName += 1 + strlen(ps->filters[i].name);
+ for (i = 0; i < ps->nfilterAliases; i++)
+ nbytesName += 1 + strlen(ps->filterAliases[i].alias);
+ nnames = ps->nfilters + ps->nfilterAliases;
}
len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);
- total_bytes = sizeof (xRenderQueryFiltersReply) + (len << 2);
+ total_bytes = sizeof(xRenderQueryFiltersReply) + (len << 2);
reply = (xRenderQueryFiltersReply *) malloc(total_bytes);
if (!reply)
- return BadAlloc;
+ return BadAlloc;
aliases = (INT16 *) (reply + 1);
names = (char *) (aliases + ((nnames + 1) & ~1));
-
+
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = len;
reply->numAliases = nnames;
reply->numFilters = nnames;
- if (ps)
- {
-
- /* fill in alias values */
- for (i = 0; i < ps->nfilters; i++)
- aliases[i] = FilterAliasNone;
- for (i = 0; i < ps->nfilterAliases; i++)
- {
- for (j = 0; j < ps->nfilters; j++)
- if (ps->filterAliases[i].filter_id == ps->filters[j].id)
- break;
- if (j == ps->nfilters)
- {
- for (j = 0; j < ps->nfilterAliases; j++)
- if (ps->filterAliases[i].filter_id ==
- ps->filterAliases[j].alias_id)
- {
- break;
- }
- if (j == ps->nfilterAliases)
- j = FilterAliasNone;
- else
- j = j + ps->nfilters;
- }
- aliases[i + ps->nfilters] = j;
- }
-
- /* fill in filter names */
- for (i = 0; i < ps->nfilters; i++)
- {
- j = strlen (ps->filters[i].name);
- *names++ = j;
- memcpy (names, ps->filters[i].name, j);
- names += j;
- }
-
- /* fill in filter alias names */
- for (i = 0; i < ps->nfilterAliases; i++)
- {
- j = strlen (ps->filterAliases[i].alias);
- *names++ = j;
- memcpy (names, ps->filterAliases[i].alias, j);
- names += j;
- }
- }
-
- if (client->swapped)
- {
- for (i = 0; i < reply->numAliases; i++)
- {
- swaps(&aliases[i]);
- }
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swapl(&reply->numAliases);
- swapl(&reply->numFilters);
+ if (ps) {
+
+ /* fill in alias values */
+ for (i = 0; i < ps->nfilters; i++)
+ aliases[i] = FilterAliasNone;
+ for (i = 0; i < ps->nfilterAliases; i++) {
+ for (j = 0; j < ps->nfilters; j++)
+ if (ps->filterAliases[i].filter_id == ps->filters[j].id)
+ break;
+ if (j == ps->nfilters) {
+ for (j = 0; j < ps->nfilterAliases; j++)
+ if (ps->filterAliases[i].filter_id ==
+ ps->filterAliases[j].alias_id) {
+ break;
+ }
+ if (j == ps->nfilterAliases)
+ j = FilterAliasNone;
+ else
+ j = j + ps->nfilters;
+ }
+ aliases[i + ps->nfilters] = j;
+ }
+
+ /* fill in filter names */
+ for (i = 0; i < ps->nfilters; i++) {
+ j = strlen(ps->filters[i].name);
+ *names++ = j;
+ memcpy(names, ps->filters[i].name, j);
+ names += j;
+ }
+
+ /* fill in filter alias names */
+ for (i = 0; i < ps->nfilterAliases; i++) {
+ j = strlen(ps->filterAliases[i].alias);
+ *names++ = j;
+ memcpy(names, ps->filterAliases[i].alias, j);
+ names += j;
+ }
+ }
+
+ if (client->swapped) {
+ for (i = 0; i < reply->numAliases; i++) {
+ swaps(&aliases[i]);
+ }
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
+ swapl(&reply->numAliases);
+ swapl(&reply->numFilters);
}
WriteToClient(client, total_bytes, (char *) reply);
free(reply);
-
+
return Success;
}
static int
-ProcRenderSetPictureFilter (ClientPtr client)
+ProcRenderSetPictureFilter(ClientPtr client)
{
- REQUEST (xRenderSetPictureFilterReq);
- PicturePtr pPicture;
- int result;
- xFixed *params;
- int nparams;
- char *name;
-
- REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
+ REQUEST(xRenderSetPictureFilterReq);
+ PicturePtr pPicture;
+ int result;
+ xFixed *params;
+ int nparams;
+ char *name;
+
+ REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
name = (char *) (stuff + 1);
params = (xFixed *) (name + pad_to_int32(stuff->nbytes));
nparams = ((xFixed *) stuff + client->req_len) - params;
- result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams);
+ result = SetPictureFilter(pPicture, name, stuff->nbytes, params, nparams);
return result;
}
static int
-ProcRenderCreateAnimCursor (ClientPtr client)
+ProcRenderCreateAnimCursor(ClientPtr client)
{
REQUEST(xRenderCreateAnimCursorReq);
- CursorPtr *cursors;
- CARD32 *deltas;
- CursorPtr pCursor;
- int ncursor;
- xAnimCursorElt *elt;
- int i;
- int ret;
+ CursorPtr *cursors;
+ CARD32 *deltas;
+ CursorPtr pCursor;
+ int ncursor;
+ xAnimCursorElt *elt;
+ int i;
+ int ret;
REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq);
LEGAL_NEW_RESOURCE(stuff->cid, client);
if (client->req_len & 1)
- return BadLength;
- ncursor = (client->req_len - (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
- cursors = malloc(ncursor * (sizeof (CursorPtr) + sizeof (CARD32)));
+ return BadLength;
+ ncursor =
+ (client->req_len -
+ (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
+ cursors = malloc(ncursor * (sizeof(CursorPtr) + sizeof(CARD32)));
if (!cursors)
- return BadAlloc;
+ return BadAlloc;
deltas = (CARD32 *) (cursors + ncursor);
elt = (xAnimCursorElt *) (stuff + 1);
- for (i = 0; i < ncursor; i++)
- {
- ret = dixLookupResourceByType((pointer *)(cursors + i), elt->cursor,
- RT_CURSOR, client, DixReadAccess);
- if (ret != Success)
- {
- free(cursors);
- return ret;
- }
- deltas[i] = elt->delay;
- elt++;
- }
- ret = AnimCursorCreate (cursors, deltas, ncursor, &pCursor, client,
- stuff->cid);
+ for (i = 0; i < ncursor; i++) {
+ ret = dixLookupResourceByType((pointer *) (cursors + i), elt->cursor,
+ RT_CURSOR, client, DixReadAccess);
+ if (ret != Success) {
+ free(cursors);
+ return ret;
+ }
+ deltas[i] = elt->delay;
+ elt++;
+ }
+ ret = AnimCursorCreate(cursors, deltas, ncursor, &pCursor, client,
+ stuff->cid);
free(cursors);
if (ret != Success)
- return ret;
-
- if (AddResource (stuff->cid, RT_CURSOR, (pointer)pCursor))
- return Success;
+ return ret;
+
+ if (AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor))
+ return Success;
return BadAlloc;
}
static int
-ProcRenderAddTraps (ClientPtr client)
+ProcRenderAddTraps(ClientPtr client)
{
- int ntraps;
- PicturePtr pPicture;
+ int ntraps;
+ PicturePtr pPicture;
+
REQUEST(xRenderAddTrapsReq);
REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
if (!pPicture->pDrawable)
return BadDrawable;
- ntraps = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
- if (ntraps % sizeof (xTrap))
- return BadLength;
- ntraps /= sizeof (xTrap);
+ ntraps = (client->req_len << 2) - sizeof(xRenderAddTrapsReq);
+ if (ntraps % sizeof(xTrap))
+ return BadLength;
+ ntraps /= sizeof(xTrap);
if (ntraps)
- AddTraps (pPicture,
- stuff->xOff, stuff->yOff,
- ntraps, (xTrap *) &stuff[1]);
+ AddTraps(pPicture,
+ stuff->xOff, stuff->yOff, ntraps, (xTrap *) &stuff[1]);
return Success;
}
-static int ProcRenderCreateSolidFill(ClientPtr client)
+static int
+ProcRenderCreateSolidFill(ClientPtr client)
{
- PicturePtr pPicture;
- int error = 0;
+ PicturePtr pPicture;
+ int error = 0;
+
REQUEST(xRenderCreateSolidFillReq);
REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
@@ -1929,24 +1854,26 @@ static int ProcRenderCreateSolidFill(ClientPtr client)
pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error);
if (!pPicture)
- return error;
+ return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
- pPicture, RT_NONE, NULL, DixCreateAccess);
+ pPicture, RT_NONE, NULL, DixCreateAccess);
if (error != Success)
- return error;
- if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
- return BadAlloc;
+ return error;
+ if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+ return BadAlloc;
return Success;
}
-static int ProcRenderCreateLinearGradient (ClientPtr client)
+static int
+ProcRenderCreateLinearGradient(ClientPtr client)
{
- PicturePtr pPicture;
- int len;
- int error = 0;
- xFixed *stops;
- xRenderColor *colors;
+ PicturePtr pPicture;
+ int len;
+ int error = 0;
+ xFixed *stops;
+ xRenderColor *colors;
+
REQUEST(xRenderCreateLinearGradientReq);
REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
@@ -1954,35 +1881,38 @@ static int ProcRenderCreateLinearGradient (ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->pid, client);
len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
- if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
- return BadLength;
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
+ return BadLength;
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- stops = (xFixed *)(stuff + 1);
- colors = (xRenderColor *)(stops + stuff->nStops);
+ stops = (xFixed *) (stuff + 1);
+ colors = (xRenderColor *) (stops + stuff->nStops);
- pPicture = CreateLinearGradientPicture (stuff->pid, &stuff->p1, &stuff->p2,
- stuff->nStops, stops, colors, &error);
+ pPicture = CreateLinearGradientPicture(stuff->pid, &stuff->p1, &stuff->p2,
+ stuff->nStops, stops, colors,
+ &error);
if (!pPicture)
- return error;
+ return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
- pPicture, RT_NONE, NULL, DixCreateAccess);
+ pPicture, RT_NONE, NULL, DixCreateAccess);
if (error != Success)
- return error;
- if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
- return BadAlloc;
+ return error;
+ if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+ return BadAlloc;
return Success;
}
-static int ProcRenderCreateRadialGradient (ClientPtr client)
+static int
+ProcRenderCreateRadialGradient(ClientPtr client)
{
- PicturePtr pPicture;
- int len;
- int error = 0;
- xFixed *stops;
- xRenderColor *colors;
+ PicturePtr pPicture;
+ int len;
+ int error = 0;
+ xFixed *stops;
+ xRenderColor *colors;
+
REQUEST(xRenderCreateRadialGradientReq);
REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
@@ -1990,34 +1920,37 @@ static int ProcRenderCreateRadialGradient (ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->pid, client);
len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- stops = (xFixed *)(stuff + 1);
- colors = (xRenderColor *)(stops + stuff->nStops);
+ stops = (xFixed *) (stuff + 1);
+ colors = (xRenderColor *) (stops + stuff->nStops);
- pPicture = CreateRadialGradientPicture (stuff->pid, &stuff->inner, &stuff->outer,
- stuff->inner_radius, stuff->outer_radius,
- stuff->nStops, stops, colors, &error);
+ pPicture =
+ CreateRadialGradientPicture(stuff->pid, &stuff->inner, &stuff->outer,
+ stuff->inner_radius, stuff->outer_radius,
+ stuff->nStops, stops, colors, &error);
if (!pPicture)
- return error;
+ return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
- pPicture, RT_NONE, NULL, DixCreateAccess);
+ pPicture, RT_NONE, NULL, DixCreateAccess);
if (error != Success)
- return error;
- if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
- return BadAlloc;
+ return error;
+ if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+ return BadAlloc;
return Success;
}
-static int ProcRenderCreateConicalGradient (ClientPtr client)
+static int
+ProcRenderCreateConicalGradient(ClientPtr client)
{
- PicturePtr pPicture;
- int len;
- int error = 0;
- xFixed *stops;
- xRenderColor *colors;
+ PicturePtr pPicture;
+ int len;
+ int error = 0;
+ xFixed *stops;
+ xRenderColor *colors;
+
REQUEST(xRenderCreateConicalGradientReq);
REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
@@ -2025,51 +1958,51 @@ static int ProcRenderCreateConicalGradient (ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->pid, client);
len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- stops = (xFixed *)(stuff + 1);
- colors = (xRenderColor *)(stops + stuff->nStops);
+ stops = (xFixed *) (stuff + 1);
+ colors = (xRenderColor *) (stops + stuff->nStops);
- pPicture = CreateConicalGradientPicture (stuff->pid, &stuff->center, stuff->angle,
- stuff->nStops, stops, colors, &error);
+ pPicture =
+ CreateConicalGradientPicture(stuff->pid, &stuff->center, stuff->angle,
+ stuff->nStops, stops, colors, &error);
if (!pPicture)
- return error;
+ return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
- pPicture, RT_NONE, NULL, DixCreateAccess);
+ pPicture, RT_NONE, NULL, DixCreateAccess);
if (error != Success)
- return error;
- if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
- return BadAlloc;
+ return error;
+ if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+ return BadAlloc;
return Success;
}
-
static int
-ProcRenderDispatch (ClientPtr client)
+ProcRenderDispatch(ClientPtr client)
{
REQUEST(xReq);
-
+
if (stuff->data < RenderNumberRequests)
- return (*ProcRenderVector[stuff->data]) (client);
+ return (*ProcRenderVector[stuff->data]) (client);
else
- return BadRequest;
+ return BadRequest;
}
static int
-SProcRenderQueryVersion (ClientPtr client)
+SProcRenderQueryVersion(ClientPtr client)
{
REQUEST(xRenderQueryVersionReq);
swaps(&stuff->length);
swapl(&stuff->majorVersion);
swapl(&stuff->minorVersion);
- return (*ProcRenderVector[stuff->renderReqType])(client);
+ return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderQueryPictFormats (ClientPtr client)
+SProcRenderQueryPictFormats(ClientPtr client)
{
REQUEST(xRenderQueryPictFormatsReq);
swaps(&stuff->length);
@@ -2077,7 +2010,7 @@ SProcRenderQueryPictFormats (ClientPtr client)
}
static int
-SProcRenderQueryPictIndexValues (ClientPtr client)
+SProcRenderQueryPictIndexValues(ClientPtr client)
{
REQUEST(xRenderQueryPictIndexValuesReq);
swaps(&stuff->length);
@@ -2086,13 +2019,13 @@ SProcRenderQueryPictIndexValues (ClientPtr client)
}
static int
-SProcRenderQueryDithers (ClientPtr client)
+SProcRenderQueryDithers(ClientPtr client)
{
return BadImplementation;
}
static int
-SProcRenderCreatePicture (ClientPtr client)
+SProcRenderCreatePicture(ClientPtr client)
{
REQUEST(xRenderCreatePictureReq);
swaps(&stuff->length);
@@ -2105,7 +2038,7 @@ SProcRenderCreatePicture (ClientPtr client)
}
static int
-SProcRenderChangePicture (ClientPtr client)
+SProcRenderChangePicture(ClientPtr client)
{
REQUEST(xRenderChangePictureReq);
swaps(&stuff->length);
@@ -2116,7 +2049,7 @@ SProcRenderChangePicture (ClientPtr client)
}
static int
-SProcRenderSetPictureClipRectangles (ClientPtr client)
+SProcRenderSetPictureClipRectangles(ClientPtr client)
{
REQUEST(xRenderSetPictureClipRectanglesReq);
swaps(&stuff->length);
@@ -2128,7 +2061,7 @@ SProcRenderSetPictureClipRectangles (ClientPtr client)
}
static int
-SProcRenderFreePicture (ClientPtr client)
+SProcRenderFreePicture(ClientPtr client)
{
REQUEST(xRenderFreePictureReq);
swaps(&stuff->length);
@@ -2137,7 +2070,7 @@ SProcRenderFreePicture (ClientPtr client)
}
static int
-SProcRenderComposite (ClientPtr client)
+SProcRenderComposite(ClientPtr client)
{
REQUEST(xRenderCompositeReq);
swaps(&stuff->length);
@@ -2156,7 +2089,7 @@ SProcRenderComposite (ClientPtr client)
}
static int
-SProcRenderScale (ClientPtr client)
+SProcRenderScale(ClientPtr client)
{
REQUEST(xRenderScaleReq);
swaps(&stuff->length);
@@ -2174,7 +2107,7 @@ SProcRenderScale (ClientPtr client)
}
static int
-SProcRenderTrapezoids (ClientPtr client)
+SProcRenderTrapezoids(ClientPtr client)
{
REQUEST(xRenderTrapezoidsReq);
@@ -2190,7 +2123,7 @@ SProcRenderTrapezoids (ClientPtr client)
}
static int
-SProcRenderTriangles (ClientPtr client)
+SProcRenderTriangles(ClientPtr client)
{
REQUEST(xRenderTrianglesReq);
@@ -2206,7 +2139,7 @@ SProcRenderTriangles (ClientPtr client)
}
static int
-SProcRenderTriStrip (ClientPtr client)
+SProcRenderTriStrip(ClientPtr client)
{
REQUEST(xRenderTriStripReq);
@@ -2222,7 +2155,7 @@ SProcRenderTriStrip (ClientPtr client)
}
static int
-SProcRenderTriFan (ClientPtr client)
+SProcRenderTriFan(ClientPtr client)
{
REQUEST(xRenderTriFanReq);
@@ -2238,25 +2171,25 @@ SProcRenderTriFan (ClientPtr client)
}
static int
-SProcRenderColorTrapezoids (ClientPtr client)
+SProcRenderColorTrapezoids(ClientPtr client)
{
return BadImplementation;
}
static int
-SProcRenderColorTriangles (ClientPtr client)
+SProcRenderColorTriangles(ClientPtr client)
{
return BadImplementation;
}
static int
-SProcRenderTransform (ClientPtr client)
+SProcRenderTransform(ClientPtr client)
{
return BadImplementation;
}
static int
-SProcRenderCreateGlyphSet (ClientPtr client)
+SProcRenderCreateGlyphSet(ClientPtr client)
{
REQUEST(xRenderCreateGlyphSetReq);
swaps(&stuff->length);
@@ -2266,17 +2199,17 @@ SProcRenderCreateGlyphSet (ClientPtr client)
}
static int
-SProcRenderReferenceGlyphSet (ClientPtr client)
+SProcRenderReferenceGlyphSet(ClientPtr client)
{
REQUEST(xRenderReferenceGlyphSetReq);
swaps(&stuff->length);
swapl(&stuff->gsid);
swapl(&stuff->existing);
- return (*ProcRenderVector[stuff->renderReqType]) (client);
+ return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderFreeGlyphSet (ClientPtr client)
+SProcRenderFreeGlyphSet(ClientPtr client)
{
REQUEST(xRenderFreeGlyphSetReq);
swaps(&stuff->length);
@@ -2285,46 +2218,46 @@ SProcRenderFreeGlyphSet (ClientPtr client)
}
static int
-SProcRenderAddGlyphs (ClientPtr client)
+SProcRenderAddGlyphs(ClientPtr client)
{
register int i;
- CARD32 *gids;
- void *end;
+ CARD32 *gids;
+ void *end;
xGlyphInfo *gi;
+
REQUEST(xRenderAddGlyphsReq);
swaps(&stuff->length);
swapl(&stuff->glyphset);
swapl(&stuff->nglyphs);
if (stuff->nglyphs & 0xe0000000)
- return BadLength;
+ return BadLength;
end = (CARD8 *) stuff + (client->req_len << 2);
gids = (CARD32 *) (stuff + 1);
gi = (xGlyphInfo *) (gids + stuff->nglyphs);
if ((char *) end - (char *) (gids + stuff->nglyphs) < 0)
- return BadLength;
+ return BadLength;
if ((char *) end - (char *) (gi + stuff->nglyphs) < 0)
- return BadLength;
- for (i = 0; i < stuff->nglyphs; i++)
- {
- swapl(&gids[i]);
- swaps(&gi[i].width);
- swaps(&gi[i].height);
- swaps(&gi[i].x);
- swaps(&gi[i].y);
- swaps(&gi[i].xOff);
- swaps(&gi[i].yOff);
+ return BadLength;
+ for (i = 0; i < stuff->nglyphs; i++) {
+ swapl(&gids[i]);
+ swaps(&gi[i].width);
+ swaps(&gi[i].height);
+ swaps(&gi[i].x);
+ swaps(&gi[i].y);
+ swaps(&gi[i].xOff);
+ swaps(&gi[i].yOff);
}
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderAddGlyphsFromPicture (ClientPtr client)
+SProcRenderAddGlyphsFromPicture(ClientPtr client)
{
return BadImplementation;
}
static int
-SProcRenderFreeGlyphs (ClientPtr client)
+SProcRenderFreeGlyphs(ClientPtr client)
{
REQUEST(xRenderFreeGlyphsReq);
swaps(&stuff->length);
@@ -2334,23 +2267,29 @@ SProcRenderFreeGlyphs (ClientPtr client)
}
static int
-SProcRenderCompositeGlyphs (ClientPtr client)
+SProcRenderCompositeGlyphs(ClientPtr client)
{
- xGlyphElt *elt;
- CARD8 *buffer;
- CARD8 *end;
- int space;
- int i;
- int size;
-
+ xGlyphElt *elt;
+ CARD8 *buffer;
+ CARD8 *end;
+ int space;
+ int i;
+ int size;
+
REQUEST(xRenderCompositeGlyphsReq);
-
+
switch (stuff->renderReqType) {
- default: size = 1; break;
- case X_RenderCompositeGlyphs16: size = 2; break;
- case X_RenderCompositeGlyphs32: size = 4; break;
+ default:
+ size = 1;
+ break;
+ case X_RenderCompositeGlyphs16:
+ size = 2;
+ break;
+ case X_RenderCompositeGlyphs32:
+ size = 4;
+ break;
}
-
+
swaps(&stuff->length);
swapl(&stuff->src);
swapl(&stuff->dst);
@@ -2360,55 +2299,50 @@ SProcRenderCompositeGlyphs (ClientPtr client)
swaps(&stuff->ySrc);
buffer = (CARD8 *) (stuff + 1);
end = (CARD8 *) stuff + (client->req_len << 2);
- while (buffer + sizeof (xGlyphElt) < end)
- {
- elt = (xGlyphElt *) buffer;
- buffer += sizeof (xGlyphElt);
-
- swaps(&elt->deltax);
- swaps(&elt->deltay);
-
- i = elt->len;
- if (i == 0xff)
- {
- swapl((int *)buffer);
- buffer += 4;
- }
- else
- {
- space = size * i;
- switch (size) {
- case 1:
- buffer += i;
- break;
- case 2:
- while (i--)
- {
- swaps((short *)buffer);
- buffer += 2;
- }
- break;
- case 4:
- while (i--)
- {
- swapl((int *)buffer);
- buffer += 4;
- }
- break;
- }
- if (space & 3)
- buffer += 4 - (space & 3);
- }
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *) buffer;
+ buffer += sizeof(xGlyphElt);
+
+ swaps(&elt->deltax);
+ swaps(&elt->deltay);
+
+ i = elt->len;
+ if (i == 0xff) {
+ swapl((int *) buffer);
+ buffer += 4;
+ }
+ else {
+ space = size * i;
+ switch (size) {
+ case 1:
+ buffer += i;
+ break;
+ case 2:
+ while (i--) {
+ swaps((short *) buffer);
+ buffer += 2;
+ }
+ break;
+ case 4:
+ while (i--) {
+ swapl((int *) buffer);
+ buffer += 4;
+ }
+ break;
+ }
+ if (space & 3)
+ buffer += 4 - (space & 3);
+ }
}
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderFillRectangles (ClientPtr client)
+SProcRenderFillRectangles(ClientPtr client)
{
REQUEST(xRenderFillRectanglesReq);
- REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
+ REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq);
swaps(&stuff->length);
swapl(&stuff->dst);
swaps(&stuff->color.red);
@@ -2418,13 +2352,13 @@ SProcRenderFillRectangles (ClientPtr client)
SwapRestS(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
-
+
static int
-SProcRenderCreateCursor (ClientPtr client)
+SProcRenderCreateCursor(ClientPtr client)
{
REQUEST(xRenderCreateCursorReq);
- REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
-
+ REQUEST_SIZE_MATCH(xRenderCreateCursorReq);
+
swaps(&stuff->length);
swapl(&stuff->cid);
swapl(&stuff->src);
@@ -2432,9 +2366,9 @@ SProcRenderCreateCursor (ClientPtr client)
swaps(&stuff->y);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
-
+
static int
-SProcRenderSetPictureTransform (ClientPtr client)
+SProcRenderSetPictureTransform(ClientPtr client)
{
REQUEST(xRenderSetPictureTransformReq);
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
@@ -2454,33 +2388,33 @@ SProcRenderSetPictureTransform (ClientPtr client)
}
static int
-SProcRenderQueryFilters (ClientPtr client)
+SProcRenderQueryFilters(ClientPtr client)
{
- REQUEST (xRenderQueryFiltersReq);
- REQUEST_SIZE_MATCH (xRenderQueryFiltersReq);
+ REQUEST(xRenderQueryFiltersReq);
+ REQUEST_SIZE_MATCH(xRenderQueryFiltersReq);
swaps(&stuff->length);
swapl(&stuff->drawable);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
-
+
static int
-SProcRenderSetPictureFilter (ClientPtr client)
+SProcRenderSetPictureFilter(ClientPtr client)
{
- REQUEST (xRenderSetPictureFilterReq);
- REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq);
+ REQUEST(xRenderSetPictureFilterReq);
+ REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
swaps(&stuff->length);
swapl(&stuff->picture);
swaps(&stuff->nbytes);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
-
+
static int
-SProcRenderCreateAnimCursor (ClientPtr client)
+SProcRenderCreateAnimCursor(ClientPtr client)
{
- REQUEST (xRenderCreateAnimCursorReq);
- REQUEST_AT_LEAST_SIZE (xRenderCreateAnimCursorReq);
+ REQUEST(xRenderCreateAnimCursorReq);
+ REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq);
swaps(&stuff->length);
swapl(&stuff->cid);
@@ -2489,10 +2423,10 @@ SProcRenderCreateAnimCursor (ClientPtr client)
}
static int
-SProcRenderAddTraps (ClientPtr client)
+SProcRenderAddTraps(ClientPtr client)
{
- REQUEST (xRenderAddTrapsReq);
- REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq);
+ REQUEST(xRenderAddTrapsReq);
+ REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq);
swaps(&stuff->length);
swapl(&stuff->picture);
@@ -2505,8 +2439,8 @@ SProcRenderAddTraps (ClientPtr client)
static int
SProcRenderCreateSolidFill(ClientPtr client)
{
- REQUEST (xRenderCreateSolidFillReq);
- REQUEST_AT_LEAST_SIZE (xRenderCreateSolidFillReq);
+ REQUEST(xRenderCreateSolidFillReq);
+ REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
swaps(&stuff->length);
swapl(&stuff->pid);
@@ -2517,29 +2451,32 @@ SProcRenderCreateSolidFill(ClientPtr client)
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
-static void swapStops(void *stuff, int num)
+static void
+swapStops(void *stuff, int num)
{
int i;
CARD32 *stops;
CARD16 *colors;
- stops = (CARD32 *)(stuff);
+
+ stops = (CARD32 *) (stuff);
for (i = 0; i < num; ++i) {
swapl(stops);
++stops;
}
- colors = (CARD16 *)(stops);
- for (i = 0; i < 4*num; ++i) {
+ colors = (CARD16 *) (stops);
+ for (i = 0; i < 4 * num; ++i) {
swaps(colors);
++colors;
}
}
static int
-SProcRenderCreateLinearGradient (ClientPtr client)
+SProcRenderCreateLinearGradient(ClientPtr client)
{
int len;
- REQUEST (xRenderCreateLinearGradientReq);
- REQUEST_AT_LEAST_SIZE (xRenderCreateLinearGradientReq);
+
+ REQUEST(xRenderCreateLinearGradientReq);
+ REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
swaps(&stuff->length);
swapl(&stuff->pid);
@@ -2550,22 +2487,23 @@ SProcRenderCreateLinearGradient (ClientPtr client)
swapl(&stuff->nStops);
len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
- if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
- return BadLength;
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
+ return BadLength;
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- swapStops(stuff+1, stuff->nStops);
+ swapStops(stuff + 1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderCreateRadialGradient (ClientPtr client)
+SProcRenderCreateRadialGradient(ClientPtr client)
{
int len;
- REQUEST (xRenderCreateRadialGradientReq);
- REQUEST_AT_LEAST_SIZE (xRenderCreateRadialGradientReq);
+
+ REQUEST(xRenderCreateRadialGradientReq);
+ REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
swaps(&stuff->length);
swapl(&stuff->pid);
@@ -2578,22 +2516,23 @@ SProcRenderCreateRadialGradient (ClientPtr client)
swapl(&stuff->nStops);
len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
- if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
- return BadLength;
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
+ return BadLength;
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- swapStops(stuff+1, stuff->nStops);
+ swapStops(stuff + 1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderCreateConicalGradient (ClientPtr client)
+SProcRenderCreateConicalGradient(ClientPtr client)
{
int len;
- REQUEST (xRenderCreateConicalGradientReq);
- REQUEST_AT_LEAST_SIZE (xRenderCreateConicalGradientReq);
+
+ REQUEST(xRenderCreateConicalGradientReq);
+ REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
swaps(&stuff->length);
swapl(&stuff->pid);
@@ -2603,25 +2542,25 @@ SProcRenderCreateConicalGradient (ClientPtr client)
swapl(&stuff->nStops);
len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
- if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
- return BadLength;
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
+ return BadLength;
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- swapStops(stuff+1, stuff->nStops);
+ swapStops(stuff + 1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderDispatch (ClientPtr client)
+SProcRenderDispatch(ClientPtr client)
{
REQUEST(xReq);
-
+
if (stuff->data < RenderNumberRequests)
- return (*SProcRenderVector[stuff->data]) (client);
+ return (*SProcRenderVector[stuff->data]) (client);
else
- return BadRequest;
+ return BadRequest;
}
#ifdef PANORAMIX
@@ -2640,133 +2579,143 @@ SProcRenderDispatch (ClientPtr client)
} \
} \
-int (*PanoramiXSaveRenderVector[RenderNumberRequests])(ClientPtr);
+int (*PanoramiXSaveRenderVector[RenderNumberRequests]) (ClientPtr);
static int
-PanoramiXRenderCreatePicture (ClientPtr client)
+PanoramiXRenderCreatePicture(ClientPtr client)
{
REQUEST(xRenderCreatePictureReq);
- PanoramiXRes *refDraw, *newPict;
- int result, j;
+ PanoramiXRes *refDraw, *newPict;
+ int result, j;
REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq);
- result = dixLookupResourceByClass((pointer *)&refDraw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
- if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ return (result == BadValue) ? BadDrawable : result;
+ if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPict->type = XRT_PICTURE;
panoramix_setup_ids(newPict, client, stuff->pid);
-
+
if (refDraw->type == XRT_WINDOW &&
- stuff->drawable == screenInfo.screens[0]->root->drawable.id)
- {
- newPict->u.pict.root = TRUE;
+ stuff->drawable == screenInfo.screens[0]->root->drawable.id) {
+ newPict->u.pict.root = TRUE;
}
else
- newPict->u.pict.root = FALSE;
-
+ newPict->u.pict.root = FALSE;
+
FOR_NSCREENS_BACKWARD(j) {
- stuff->pid = newPict->info[j].id;
- stuff->drawable = refDraw->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderCreatePicture]) (client);
- if(result != Success) break;
+ stuff->pid = newPict->info[j].id;
+ stuff->drawable = refDraw->info[j].id;
+ result = (*PanoramiXSaveRenderVector[X_RenderCreatePicture]) (client);
+ if (result != Success)
+ break;
}
if (result == Success)
- AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
- else
- free(newPict);
+ AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
+ else
+ free(newPict);
return result;
}
static int
-PanoramiXRenderChangePicture (ClientPtr client)
+PanoramiXRenderChangePicture(ClientPtr client)
{
- PanoramiXRes *pict;
- int result = Success, j;
+ PanoramiXRes *pict;
+ int result = Success, j;
+
REQUEST(xRenderChangePictureReq);
REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
-
+
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
-
+
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
result = (*PanoramiXSaveRenderVector[X_RenderChangePicture]) (client);
- if(result != Success) break;
+ if (result != Success)
+ break;
}
return result;
}
static int
-PanoramiXRenderSetPictureClipRectangles (ClientPtr client)
+PanoramiXRenderSetPictureClipRectangles(ClientPtr client)
{
REQUEST(xRenderSetPictureClipRectanglesReq);
- int result = Success, j;
- PanoramiXRes *pict;
+ int result = Success, j;
+ PanoramiXRes *pict;
REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
-
+
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
-
+
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderSetPictureClipRectangles]) (client);
- if(result != Success) break;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderSetPictureClipRectangles])
+ (client);
+ if (result != Success)
+ break;
}
return result;
}
static int
-PanoramiXRenderSetPictureTransform (ClientPtr client)
+PanoramiXRenderSetPictureTransform(ClientPtr client)
{
REQUEST(xRenderSetPictureTransformReq);
- int result = Success, j;
- PanoramiXRes *pict;
+ int result = Success, j;
+ PanoramiXRes *pict;
REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq);
-
+
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
-
+
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderSetPictureTransform]) (client);
- if(result != Success) break;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderSetPictureTransform]) (client);
+ if (result != Success)
+ break;
}
return result;
}
static int
-PanoramiXRenderSetPictureFilter (ClientPtr client)
+PanoramiXRenderSetPictureFilter(ClientPtr client)
{
REQUEST(xRenderSetPictureFilterReq);
- int result = Success, j;
- PanoramiXRes *pict;
+ int result = Success, j;
+ PanoramiXRes *pict;
REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
-
+
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
-
+
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderSetPictureFilter]) (client);
- if(result != Success) break;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderSetPictureFilter]) (client);
+ if (result != Success)
+ break;
}
return result;
}
static int
-PanoramiXRenderFreePicture (ClientPtr client)
+PanoramiXRenderFreePicture(ClientPtr client)
{
PanoramiXRes *pict;
- int result = Success, j;
+ int result = Success, j;
+
REQUEST(xRenderFreePictureReq);
REQUEST_SIZE_MATCH(xRenderFreePictureReq);
@@ -2774,146 +2723,144 @@ PanoramiXRenderFreePicture (ClientPtr client)
client->errorValue = stuff->picture;
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess);
-
FOR_NSCREENS_BACKWARD(j) {
- stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderFreePicture]) (client);
- if(result != Success) break;
+ stuff->picture = pict->info[j].id;
+ result = (*PanoramiXSaveRenderVector[X_RenderFreePicture]) (client);
+ if (result != Success)
+ break;
}
/* Since ProcRenderFreePicture is using FreeResource, it will free
- our resource for us on the last pass through the loop above */
-
+ our resource for us on the last pass through the loop above */
+
return result;
}
static int
-PanoramiXRenderComposite (ClientPtr client)
+PanoramiXRenderComposite(ClientPtr client)
{
- PanoramiXRes *src, *msk, *dst;
- int result = Success, j;
- xRenderCompositeReq orig;
+ PanoramiXRes *src, *msk, *dst;
+ int result = Success, j;
+ xRenderCompositeReq orig;
+
REQUEST(xRenderCompositeReq);
REQUEST_SIZE_MATCH(xRenderCompositeReq);
-
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
+
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_ALPHA(msk, stuff->mask, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
orig = *stuff;
-
+
FOR_NSCREENS_FORWARD(j) {
- stuff->src = src->info[j].id;
- if (src->u.pict.root)
- {
- stuff->xSrc = orig.xSrc - screenInfo.screens[j]->x;
- stuff->ySrc = orig.ySrc - screenInfo.screens[j]->y;
- }
- stuff->dst = dst->info[j].id;
- if (dst->u.pict.root)
- {
- stuff->xDst = orig.xDst - screenInfo.screens[j]->x;
- stuff->yDst = orig.yDst - screenInfo.screens[j]->y;
- }
- if (msk)
- {
- stuff->mask = msk->info[j].id;
- if (msk->u.pict.root)
- {
- stuff->xMask = orig.xMask - screenInfo.screens[j]->x;
- stuff->yMask = orig.yMask - screenInfo.screens[j]->y;
- }
- }
- result = (*PanoramiXSaveRenderVector[X_RenderComposite]) (client);
- if(result != Success) break;
+ stuff->src = src->info[j].id;
+ if (src->u.pict.root) {
+ stuff->xSrc = orig.xSrc - screenInfo.screens[j]->x;
+ stuff->ySrc = orig.ySrc - screenInfo.screens[j]->y;
+ }
+ stuff->dst = dst->info[j].id;
+ if (dst->u.pict.root) {
+ stuff->xDst = orig.xDst - screenInfo.screens[j]->x;
+ stuff->yDst = orig.yDst - screenInfo.screens[j]->y;
+ }
+ if (msk) {
+ stuff->mask = msk->info[j].id;
+ if (msk->u.pict.root) {
+ stuff->xMask = orig.xMask - screenInfo.screens[j]->x;
+ stuff->yMask = orig.yMask - screenInfo.screens[j]->y;
+ }
+ }
+ result = (*PanoramiXSaveRenderVector[X_RenderComposite]) (client);
+ if (result != Success)
+ break;
}
return result;
}
static int
-PanoramiXRenderCompositeGlyphs (ClientPtr client)
+PanoramiXRenderCompositeGlyphs(ClientPtr client)
{
- PanoramiXRes *src, *dst;
- int result = Success, j;
+ PanoramiXRes *src, *dst;
+ int result = Success, j;
+
REQUEST(xRenderCompositeGlyphsReq);
- xGlyphElt origElt, *elt;
- INT16 xSrc, ySrc;
+ xGlyphElt origElt, *elt;
+ INT16 xSrc, ySrc;
REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq);
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
- if (client->req_len << 2 >= (sizeof (xRenderCompositeGlyphsReq) +
- sizeof (xGlyphElt)))
- {
- elt = (xGlyphElt *) (stuff + 1);
- origElt = *elt;
- xSrc = stuff->xSrc;
- ySrc = stuff->ySrc;
- FOR_NSCREENS_FORWARD(j) {
- stuff->src = src->info[j].id;
- if (src->u.pict.root)
- {
- stuff->xSrc = xSrc - screenInfo.screens[j]->x;
- stuff->ySrc = ySrc - screenInfo.screens[j]->y;
- }
- stuff->dst = dst->info[j].id;
- if (dst->u.pict.root)
- {
- elt->deltax = origElt.deltax - screenInfo.screens[j]->x;
- elt->deltay = origElt.deltay - screenInfo.screens[j]->y;
- }
- result = (*PanoramiXSaveRenderVector[stuff->renderReqType]) (client);
- if(result != Success) break;
- }
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
+ if (client->req_len << 2 >= (sizeof(xRenderCompositeGlyphsReq) +
+ sizeof(xGlyphElt))) {
+ elt = (xGlyphElt *) (stuff + 1);
+ origElt = *elt;
+ xSrc = stuff->xSrc;
+ ySrc = stuff->ySrc;
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->src = src->info[j].id;
+ if (src->u.pict.root) {
+ stuff->xSrc = xSrc - screenInfo.screens[j]->x;
+ stuff->ySrc = ySrc - screenInfo.screens[j]->y;
+ }
+ stuff->dst = dst->info[j].id;
+ if (dst->u.pict.root) {
+ elt->deltax = origElt.deltax - screenInfo.screens[j]->x;
+ elt->deltay = origElt.deltay - screenInfo.screens[j]->y;
+ }
+ result =
+ (*PanoramiXSaveRenderVector[stuff->renderReqType]) (client);
+ if (result != Success)
+ break;
+ }
}
return result;
}
static int
-PanoramiXRenderFillRectangles (ClientPtr client)
+PanoramiXRenderFillRectangles(ClientPtr client)
{
- PanoramiXRes *dst;
- int result = Success, j;
+ PanoramiXRes *dst;
+ int result = Success, j;
+
REQUEST(xRenderFillRectanglesReq);
- char *extra;
- int extra_len;
-
- REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
- extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
- if (extra_len &&
- (extra = (char *) malloc(extra_len)))
- {
- memcpy (extra, stuff + 1, extra_len);
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- if (dst->u.pict.root)
- {
- int x_off = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[j]->y;
-
- if(x_off || y_off) {
- xRectangle *rects = (xRectangle *) (stuff + 1);
- int i = extra_len / sizeof (xRectangle);
-
- while (i--)
- {
- rects->x -= x_off;
- rects->y -= y_off;
- rects++;
- }
- }
- }
- stuff->dst = dst->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
- if(result != Success) break;
- }
- free(extra);
+ char *extra;
+ int extra_len;
+
+ REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+ extra_len = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq);
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ if (dst->u.pict.root) {
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+
+ if (x_off || y_off) {
+ xRectangle *rects = (xRectangle *) (stuff + 1);
+ int i = extra_len / sizeof(xRectangle);
+
+ while (i--) {
+ rects->x -= x_off;
+ rects->y -= y_off;
+ rects++;
+ }
+ }
+ }
+ stuff->dst = dst->info[j].id;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
+ if (result != Success)
+ break;
+ }
+ free(extra);
}
return result;
@@ -2922,57 +2869,58 @@ PanoramiXRenderFillRectangles (ClientPtr client)
static int
PanoramiXRenderTrapezoids(ClientPtr client)
{
- PanoramiXRes *src, *dst;
- int result = Success, j;
+ PanoramiXRes *src, *dst;
+ int result = Success, j;
+
REQUEST(xRenderTrapezoidsReq);
- char *extra;
- int extra_len;
-
- REQUEST_AT_LEAST_SIZE (xRenderTrapezoidsReq);
-
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
- extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
-
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- if (dst->u.pict.root) {
- int x_off = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[j]->y;
-
- if(x_off || y_off) {
- xTrapezoid *trap = (xTrapezoid *) (stuff + 1);
- int i = extra_len / sizeof (xTrapezoid);
-
- while (i--) {
- trap->top -= y_off;
- trap->bottom -= y_off;
- trap->left.p1.x -= x_off;
- trap->left.p1.y -= y_off;
- trap->left.p2.x -= x_off;
- trap->left.p2.y -= y_off;
- trap->right.p1.x -= x_off;
- trap->right.p1.y -= y_off;
- trap->right.p2.x -= x_off;
- trap->right.p2.y -= y_off;
- trap++;
- }
- }
- }
-
+ char *extra;
+ int extra_len;
+
+ REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq);
+
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
+ extra_len = (client->req_len << 2) - sizeof(xRenderTrapezoidsReq);
+
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ if (dst->u.pict.root) {
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+
+ if (x_off || y_off) {
+ xTrapezoid *trap = (xTrapezoid *) (stuff + 1);
+ int i = extra_len / sizeof(xTrapezoid);
+
+ while (i--) {
+ trap->top -= y_off;
+ trap->bottom -= y_off;
+ trap->left.p1.x -= x_off;
+ trap->left.p1.y -= y_off;
+ trap->left.p2.x -= x_off;
+ trap->left.p2.y -= y_off;
+ trap->right.p1.x -= x_off;
+ trap->right.p1.y -= y_off;
+ trap->right.p2.x -= x_off;
+ trap->right.p2.y -= y_off;
+ trap++;
+ }
+ }
+ }
+
stuff->src = src->info[j].id;
stuff->dst = dst->info[j].id;
- result =
- (*PanoramiXSaveRenderVector[X_RenderTrapezoids]) (client);
+ result = (*PanoramiXSaveRenderVector[X_RenderTrapezoids]) (client);
+
+ if (result != Success)
+ break;
+ }
- if(result != Success) break;
- }
-
free(extra);
}
@@ -2982,53 +2930,54 @@ PanoramiXRenderTrapezoids(ClientPtr client)
static int
PanoramiXRenderTriangles(ClientPtr client)
{
- PanoramiXRes *src, *dst;
- int result = Success, j;
+ PanoramiXRes *src, *dst;
+ int result = Success, j;
+
REQUEST(xRenderTrianglesReq);
- char *extra;
- int extra_len;
-
- REQUEST_AT_LEAST_SIZE (xRenderTrianglesReq);
-
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
- extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
-
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- if (dst->u.pict.root) {
- int x_off = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[j]->y;
-
- if(x_off || y_off) {
- xTriangle *tri = (xTriangle *) (stuff + 1);
- int i = extra_len / sizeof (xTriangle);
-
- while (i--) {
- tri->p1.x -= x_off;
- tri->p1.y -= y_off;
- tri->p2.x -= x_off;
- tri->p2.y -= y_off;
- tri->p3.x -= x_off;
- tri->p3.y -= y_off;
- tri++;
- }
- }
- }
-
+ char *extra;
+ int extra_len;
+
+ REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
+
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
+ extra_len = (client->req_len << 2) - sizeof(xRenderTrianglesReq);
+
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ if (dst->u.pict.root) {
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+
+ if (x_off || y_off) {
+ xTriangle *tri = (xTriangle *) (stuff + 1);
+ int i = extra_len / sizeof(xTriangle);
+
+ while (i--) {
+ tri->p1.x -= x_off;
+ tri->p1.y -= y_off;
+ tri->p2.x -= x_off;
+ tri->p2.y -= y_off;
+ tri->p3.x -= x_off;
+ tri->p3.y -= y_off;
+ tri++;
+ }
+ }
+ }
+
stuff->src = src->info[j].id;
stuff->dst = dst->info[j].id;
- result =
- (*PanoramiXSaveRenderVector[X_RenderTriangles]) (client);
+ result = (*PanoramiXSaveRenderVector[X_RenderTriangles]) (client);
+
+ if (result != Success)
+ break;
+ }
- if(result != Success) break;
- }
-
free(extra);
}
@@ -3038,49 +2987,50 @@ PanoramiXRenderTriangles(ClientPtr client)
static int
PanoramiXRenderTriStrip(ClientPtr client)
{
- PanoramiXRes *src, *dst;
- int result = Success, j;
+ PanoramiXRes *src, *dst;
+ int result = Success, j;
+
REQUEST(xRenderTriStripReq);
- char *extra;
- int extra_len;
-
- REQUEST_AT_LEAST_SIZE (xRenderTriStripReq);
-
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
- extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
-
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- if (dst->u.pict.root) {
- int x_off = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[j]->y;
-
- if(x_off || y_off) {
- xPointFixed *fixed = (xPointFixed *) (stuff + 1);
- int i = extra_len / sizeof (xPointFixed);
-
- while (i--) {
- fixed->x -= x_off;
- fixed->y -= y_off;
- fixed++;
- }
- }
- }
-
+ char *extra;
+ int extra_len;
+
+ REQUEST_AT_LEAST_SIZE(xRenderTriStripReq);
+
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
+ extra_len = (client->req_len << 2) - sizeof(xRenderTriStripReq);
+
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ if (dst->u.pict.root) {
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+
+ if (x_off || y_off) {
+ xPointFixed *fixed = (xPointFixed *) (stuff + 1);
+ int i = extra_len / sizeof(xPointFixed);
+
+ while (i--) {
+ fixed->x -= x_off;
+ fixed->y -= y_off;
+ fixed++;
+ }
+ }
+ }
+
stuff->src = src->info[j].id;
stuff->dst = dst->info[j].id;
- result =
- (*PanoramiXSaveRenderVector[X_RenderTriStrip]) (client);
+ result = (*PanoramiXSaveRenderVector[X_RenderTriStrip]) (client);
+
+ if (result != Success)
+ break;
+ }
- if(result != Success) break;
- }
-
free(extra);
}
@@ -3090,49 +3040,50 @@ PanoramiXRenderTriStrip(ClientPtr client)
static int
PanoramiXRenderTriFan(ClientPtr client)
{
- PanoramiXRes *src, *dst;
- int result = Success, j;
+ PanoramiXRes *src, *dst;
+ int result = Success, j;
+
REQUEST(xRenderTriFanReq);
- char *extra;
- int extra_len;
-
- REQUEST_AT_LEAST_SIZE (xRenderTriFanReq);
-
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
- extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
-
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- if (dst->u.pict.root) {
- int x_off = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[j]->y;
-
- if(x_off || y_off) {
- xPointFixed *fixed = (xPointFixed *) (stuff + 1);
- int i = extra_len / sizeof (xPointFixed);
-
- while (i--) {
- fixed->x -= x_off;
- fixed->y -= y_off;
- fixed++;
- }
- }
- }
-
+ char *extra;
+ int extra_len;
+
+ REQUEST_AT_LEAST_SIZE(xRenderTriFanReq);
+
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
+ extra_len = (client->req_len << 2) - sizeof(xRenderTriFanReq);
+
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ if (dst->u.pict.root) {
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+
+ if (x_off || y_off) {
+ xPointFixed *fixed = (xPointFixed *) (stuff + 1);
+ int i = extra_len / sizeof(xPointFixed);
+
+ while (i--) {
+ fixed->x -= x_off;
+ fixed->y -= y_off;
+ fixed++;
+ }
+ }
+ }
+
stuff->src = src->info[j].id;
stuff->dst = dst->info[j].id;
- result =
- (*PanoramiXSaveRenderVector[X_RenderTriFan]) (client);
+ result = (*PanoramiXSaveRenderVector[X_RenderTriFan]) (client);
+
+ if (result != Success)
+ break;
+ }
- if(result != Success) break;
- }
-
free(extra);
}
@@ -3140,186 +3091,199 @@ PanoramiXRenderTriFan(ClientPtr client)
}
static int
-PanoramiXRenderAddTraps (ClientPtr client)
+PanoramiXRenderAddTraps(ClientPtr client)
{
- PanoramiXRes *picture;
- int result = Success, j;
+ PanoramiXRes *picture;
+ int result = Success, j;
+
REQUEST(xRenderAddTrapsReq);
- char *extra;
- int extra_len;
- INT16 x_off, y_off;
-
- REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq);
- VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess);
- extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
- if (extra_len &&
- (extra = (char *) malloc(extra_len)))
- {
- memcpy (extra, stuff + 1, extra_len);
- x_off = stuff->xOff;
- y_off = stuff->yOff;
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- stuff->picture = picture->info[j].id;
-
- if (picture->u.pict.root)
- {
- stuff->xOff = x_off + screenInfo.screens[j]->x;
- stuff->yOff = y_off + screenInfo.screens[j]->y;
- }
- result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
- if(result != Success) break;
- }
- free(extra);
+ char *extra;
+ int extra_len;
+ INT16 x_off, y_off;
+
+ REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq);
+ VERIFY_XIN_PICTURE(picture, stuff->picture, client, DixWriteAccess);
+ extra_len = (client->req_len << 2) - sizeof(xRenderAddTrapsReq);
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+ x_off = stuff->xOff;
+ y_off = stuff->yOff;
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ stuff->picture = picture->info[j].id;
+
+ if (picture->u.pict.root) {
+ stuff->xOff = x_off + screenInfo.screens[j]->x;
+ stuff->yOff = y_off + screenInfo.screens[j]->y;
+ }
+ result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
+ if (result != Success)
+ break;
+ }
+ free(extra);
}
return result;
}
static int
-PanoramiXRenderCreateSolidFill (ClientPtr client)
+PanoramiXRenderCreateSolidFill(ClientPtr client)
{
REQUEST(xRenderCreateSolidFillReq);
- PanoramiXRes *newPict;
- int result = Success, j;
+ PanoramiXRes *newPict;
+ int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
- if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPict->type = XRT_PICTURE;
panoramix_setup_ids(newPict, client, stuff->pid);
newPict->u.pict.root = FALSE;
-
+
FOR_NSCREENS_BACKWARD(j) {
- stuff->pid = newPict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderCreateSolidFill]) (client);
- if(result != Success) break;
+ stuff->pid = newPict->info[j].id;
+ result = (*PanoramiXSaveRenderVector[X_RenderCreateSolidFill]) (client);
+ if (result != Success)
+ break;
}
if (result == Success)
- AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
+ AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
- free(newPict);
+ free(newPict);
return result;
}
static int
-PanoramiXRenderCreateLinearGradient (ClientPtr client)
+PanoramiXRenderCreateLinearGradient(ClientPtr client)
{
REQUEST(xRenderCreateLinearGradientReq);
- PanoramiXRes *newPict;
- int result = Success, j;
+ PanoramiXRes *newPict;
+ int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
- if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPict->type = XRT_PICTURE;
panoramix_setup_ids(newPict, client, stuff->pid);
newPict->u.pict.root = FALSE;
FOR_NSCREENS_BACKWARD(j) {
- stuff->pid = newPict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderCreateLinearGradient]) (client);
- if(result != Success) break;
+ stuff->pid = newPict->info[j].id;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderCreateLinearGradient]) (client);
+ if (result != Success)
+ break;
}
if (result == Success)
- AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
+ AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
- free(newPict);
+ free(newPict);
return result;
}
static int
-PanoramiXRenderCreateRadialGradient (ClientPtr client)
+PanoramiXRenderCreateRadialGradient(ClientPtr client)
{
REQUEST(xRenderCreateRadialGradientReq);
- PanoramiXRes *newPict;
- int result = Success, j;
+ PanoramiXRes *newPict;
+ int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
- if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPict->type = XRT_PICTURE;
panoramix_setup_ids(newPict, client, stuff->pid);
newPict->u.pict.root = FALSE;
FOR_NSCREENS_BACKWARD(j) {
- stuff->pid = newPict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderCreateRadialGradient]) (client);
- if(result != Success) break;
+ stuff->pid = newPict->info[j].id;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderCreateRadialGradient]) (client);
+ if (result != Success)
+ break;
}
if (result == Success)
- AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
+ AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
- free(newPict);
+ free(newPict);
return result;
}
static int
-PanoramiXRenderCreateConicalGradient (ClientPtr client)
+PanoramiXRenderCreateConicalGradient(ClientPtr client)
{
REQUEST(xRenderCreateConicalGradientReq);
- PanoramiXRes *newPict;
- int result = Success, j;
+ PanoramiXRes *newPict;
+ int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
- if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPict->type = XRT_PICTURE;
panoramix_setup_ids(newPict, client, stuff->pid);
newPict->u.pict.root = FALSE;
FOR_NSCREENS_BACKWARD(j) {
- stuff->pid = newPict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderCreateConicalGradient]) (client);
- if(result != Success) break;
+ stuff->pid = newPict->info[j].id;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderCreateConicalGradient])
+ (client);
+ if (result != Success)
+ break;
}
if (result == Success)
- AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
+ AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
- free(newPict);
+ free(newPict);
return result;
}
void
-PanoramiXRenderInit (void)
+PanoramiXRenderInit(void)
{
- int i;
-
- XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource,
- "XineramaPicture");
+ int i;
+
+ XRT_PICTURE = CreateNewResourceType(XineramaDeleteResource,
+ "XineramaPicture");
if (RenderErrBase)
- SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
+ SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
for (i = 0; i < RenderNumberRequests; i++)
- PanoramiXSaveRenderVector[i] = ProcRenderVector[i];
+ PanoramiXSaveRenderVector[i] = ProcRenderVector[i];
/*
* Stuff in Xinerama aware request processing hooks
*/
ProcRenderVector[X_RenderCreatePicture] = PanoramiXRenderCreatePicture;
ProcRenderVector[X_RenderChangePicture] = PanoramiXRenderChangePicture;
- ProcRenderVector[X_RenderSetPictureTransform] = PanoramiXRenderSetPictureTransform;
- ProcRenderVector[X_RenderSetPictureFilter] = PanoramiXRenderSetPictureFilter;
- ProcRenderVector[X_RenderSetPictureClipRectangles] = PanoramiXRenderSetPictureClipRectangles;
+ ProcRenderVector[X_RenderSetPictureTransform] =
+ PanoramiXRenderSetPictureTransform;
+ ProcRenderVector[X_RenderSetPictureFilter] =
+ PanoramiXRenderSetPictureFilter;
+ ProcRenderVector[X_RenderSetPictureClipRectangles] =
+ PanoramiXRenderSetPictureClipRectangles;
ProcRenderVector[X_RenderFreePicture] = PanoramiXRenderFreePicture;
ProcRenderVector[X_RenderComposite] = PanoramiXRenderComposite;
ProcRenderVector[X_RenderCompositeGlyphs8] = PanoramiXRenderCompositeGlyphs;
- ProcRenderVector[X_RenderCompositeGlyphs16] = PanoramiXRenderCompositeGlyphs;
- ProcRenderVector[X_RenderCompositeGlyphs32] = PanoramiXRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs16] =
+ PanoramiXRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs32] =
+ PanoramiXRenderCompositeGlyphs;
ProcRenderVector[X_RenderFillRectangles] = PanoramiXRenderFillRectangles;
ProcRenderVector[X_RenderTrapezoids] = PanoramiXRenderTrapezoids;
@@ -3329,18 +3293,22 @@ PanoramiXRenderInit (void)
ProcRenderVector[X_RenderAddTraps] = PanoramiXRenderAddTraps;
ProcRenderVector[X_RenderCreateSolidFill] = PanoramiXRenderCreateSolidFill;
- ProcRenderVector[X_RenderCreateLinearGradient] = PanoramiXRenderCreateLinearGradient;
- ProcRenderVector[X_RenderCreateRadialGradient] = PanoramiXRenderCreateRadialGradient;
- ProcRenderVector[X_RenderCreateConicalGradient] = PanoramiXRenderCreateConicalGradient;
+ ProcRenderVector[X_RenderCreateLinearGradient] =
+ PanoramiXRenderCreateLinearGradient;
+ ProcRenderVector[X_RenderCreateRadialGradient] =
+ PanoramiXRenderCreateRadialGradient;
+ ProcRenderVector[X_RenderCreateConicalGradient] =
+ PanoramiXRenderCreateConicalGradient;
}
void
-PanoramiXRenderReset (void)
+PanoramiXRenderReset(void)
{
- int i;
+ int i;
+
for (i = 0; i < RenderNumberRequests; i++)
- ProcRenderVector[i] = PanoramiXSaveRenderVector[i];
+ ProcRenderVector[i] = PanoramiXSaveRenderVector[i];
RenderErrBase = 0;
}
-#endif /* PANORAMIX */
+#endif /* PANORAMIX */
diff --git a/xorg-server/test/ddxstubs.c b/xorg-server/test/ddxstubs.c
index baf2a7a50..a214b9637 100644
--- a/xorg-server/test/ddxstubs.c
+++ b/xorg-server/test/ddxstubs.c
@@ -33,34 +33,52 @@
#include "input.h"
#include "mi.h"
-void DDXRingBell(int volume, int pitch, int duration) {
+void
+DDXRingBell(int volume, int pitch, int duration)
+{
}
-void ProcessInputEvents(void) {
+void
+ProcessInputEvents(void)
+{
mieqProcessInputEvents();
}
-void OsVendorInit(void) {
+void
+OsVendorInit(void)
+{
}
-void OsVendorFatalError(void) {
+void
+OsVendorFatalError(void)
+{
}
-void AbortDDX(enum ExitCode error) {
+void
+AbortDDX(enum ExitCode error)
+{
OsAbort();
}
-void ddxUseMsg(void) {
+void
+ddxUseMsg(void)
+{
}
-int ddxProcessArgument(int argc, char *argv[], int i) {
+int
+ddxProcessArgument(int argc, char *argv[], int i)
+{
return 0;
}
-void ddxGiveUp( enum ExitCode error ) {
+void
+ddxGiveUp(enum ExitCode error)
+{
}
-Bool LegalModifier(unsigned int key, DeviceIntPtr pDev) {
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
return TRUE;
}
@@ -76,16 +94,20 @@ int darwinMainScreenY = 0;
BOOL no_configure_window = FALSE;
-void darwinEvents_lock(void) {
+void
+darwinEvents_lock(void)
+{
}
-void darwinEvents_unlock(void) {
+void
+darwinEvents_unlock(void)
+{
}
#endif
#ifdef DDXBEFORERESET
void
-ddxBeforeReset(void) {
+ddxBeforeReset(void)
+{
}
#endif
-
diff --git a/xorg-server/test/fixes.c b/xorg-server/test/fixes.c
index 8c804ba26..7807c73ce 100644
--- a/xorg-server/test/fixes.c
+++ b/xorg-server/test/fixes.c
@@ -42,13 +42,12 @@ _fixes_test_direction(struct PointerBarrier *barrier, int d[4], int permitted)
blocking = barrier_is_blocking_direction(barrier, dir);
assert(blocking);
- for (j = 0; j <= BarrierNegativeY; j++)
- {
- for (i = 0; i <= BarrierNegativeY; i++)
- {
+ for (j = 0; j <= BarrierNegativeY; j++) {
+ for (i = 0; i <= BarrierNegativeY; i++) {
barrier->directions |= 1 << i;
blocking = barrier_is_blocking_direction(barrier, dir);
- assert((barrier->directions & permitted) == permitted ? !blocking : blocking);
+ assert((barrier->directions & permitted) ==
+ permitted ? !blocking : blocking);
}
}
@@ -63,14 +62,14 @@ fixes_pointer_barrier_direction_test(void)
int y = 100;
int directions[8][4] = {
- { x, y, x, y + 100}, /* S */
- { x + 50, y, x - 50, y + 100}, /* SW */
- { x + 100, y, x, y}, /* W */
- { x + 100, y + 50, x, y - 50}, /* NW */
- { x, y + 100, x, y}, /* N */
- { x - 50, y + 100, x + 50, y}, /* NE */
- { x, y, x + 100, y}, /* E */
- { x, y - 50, x + 100, y + 50}, /* SE */
+ {x, y, x, y + 100}, /* S */
+ {x + 50, y, x - 50, y + 100}, /* SW */
+ {x + 100, y, x, y}, /* W */
+ {x + 100, y + 50, x, y - 50}, /* NW */
+ {x, y + 100, x, y}, /* N */
+ {x - 50, y + 100, x + 50, y}, /* NE */
+ {x, y, x + 100, y}, /* E */
+ {x, y - 50, x + 100, y + 50}, /* SE */
};
barrier.x1 = x;
@@ -78,20 +77,21 @@ fixes_pointer_barrier_direction_test(void)
barrier.y1 = y - 50;
barrier.y2 = y + 49;
-
_fixes_test_direction(&barrier, directions[0], BarrierPositiveY);
- _fixes_test_direction(&barrier, directions[1], BarrierPositiveY | BarrierNegativeX);
+ _fixes_test_direction(&barrier, directions[1],
+ BarrierPositiveY | BarrierNegativeX);
_fixes_test_direction(&barrier, directions[2], BarrierNegativeX);
- _fixes_test_direction(&barrier, directions[3], BarrierNegativeY | BarrierNegativeX);
+ _fixes_test_direction(&barrier, directions[3],
+ BarrierNegativeY | BarrierNegativeX);
_fixes_test_direction(&barrier, directions[4], BarrierNegativeY);
- _fixes_test_direction(&barrier, directions[5], BarrierPositiveX | BarrierNegativeY);
+ _fixes_test_direction(&barrier, directions[5],
+ BarrierPositiveX | BarrierNegativeY);
_fixes_test_direction(&barrier, directions[6], BarrierPositiveX);
- _fixes_test_direction(&barrier, directions[7], BarrierPositiveY | BarrierPositiveX);
-
+ _fixes_test_direction(&barrier, directions[7],
+ BarrierPositiveY | BarrierPositiveX);
}
-
static void
fixes_pointer_barriers_test(void)
{
@@ -123,7 +123,7 @@ fixes_pointer_barriers_test(void)
/* across, but outside of y range */
x1 = x + 1;
- x2 = x -1;
+ x2 = x - 1;
y1 = y + 100;
y2 = y + 100;
assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
@@ -184,7 +184,6 @@ fixes_pointer_barriers_test(void)
y2 = y + 100;
assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
-
/* horizontal barrier */
barrier.x1 = x - 50;
barrier.x2 = x + 50;
@@ -207,7 +206,7 @@ fixes_pointer_barriers_test(void)
x1 = x + 100;
x2 = x + 100;
y1 = y + 1;
- y2 = y -1;
+ y2 = y - 1;
assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
/* across, diagonally */
@@ -268,14 +267,15 @@ fixes_pointer_barriers_test(void)
}
-static void fixes_pointer_barrier_clamp_test(void)
+static void
+fixes_pointer_barrier_clamp_test(void)
{
struct PointerBarrier barrier;
int x = 100;
int y = 100;
- int cx, cy; /* clamped */
+ int cx, cy; /* clamped */
/* vert barrier */
barrier.x1 = x;
@@ -316,7 +316,8 @@ static void fixes_pointer_barrier_clamp_test(void)
assert(cy == barrier.y1);
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
fixes_pointer_barriers_test();
diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c
index e0291417f..90ab9aea3 100644
--- a/xorg-server/test/input.c
+++ b/xorg-server/test/input.c
@@ -49,7 +49,8 @@
*
* Result: All axes set to default values (usually 0).
*/
-static void dix_init_valuators(void)
+static void
+dix_init_valuators(void)
{
DeviceIntRec dev;
ValuatorClassPtr val;
@@ -58,9 +59,8 @@ static void dix_init_valuators(void)
int i;
Atom atoms[MAX_VALUATORS] = { 0 };
-
memset(&dev, 0, sizeof(DeviceIntRec));
- dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */
+ dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */
assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE);
assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute));
@@ -71,8 +71,7 @@ static void dix_init_valuators(void)
assert(val->numMotionEvents == 0);
assert(val->axisVal);
- for (i = 0; i < num_axes; i++)
- {
+ for (i = 0; i < num_axes; i++) {
assert(val->axisVal[i] == 0);
assert(val->axes->min_value == NO_AXIS_LIMITS);
assert(val->axes->max_value == NO_AXIS_LIMITS);
@@ -82,39 +81,51 @@ static void dix_init_valuators(void)
assert(dev.last.numValuators == num_axes);
/* invalid increment */
- assert(SetScrollValuator(&dev, 0, SCROLL_TYPE_VERTICAL, 0.0, SCROLL_FLAG_NONE) == FALSE);
+ assert(SetScrollValuator
+ (&dev, 0, SCROLL_TYPE_VERTICAL, 0.0, SCROLL_FLAG_NONE) == FALSE);
/* invalid type */
- assert(SetScrollValuator(&dev, 0, SCROLL_TYPE_VERTICAL - 1, 1.0, SCROLL_FLAG_NONE) == FALSE);
- assert(SetScrollValuator(&dev, 0, SCROLL_TYPE_HORIZONTAL + 1, 1.0, SCROLL_FLAG_NONE) == FALSE);
+ assert(SetScrollValuator
+ (&dev, 0, SCROLL_TYPE_VERTICAL - 1, 1.0, SCROLL_FLAG_NONE) == FALSE);
+ assert(SetScrollValuator
+ (&dev, 0, SCROLL_TYPE_HORIZONTAL + 1, 1.0,
+ SCROLL_FLAG_NONE) == FALSE);
/* invalid axisnum */
- assert(SetScrollValuator(&dev, 2, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE) == FALSE);
+ assert(SetScrollValuator
+ (&dev, 2, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE) == FALSE);
/* valid */
- assert(SetScrollValuator(&dev, 0, SCROLL_TYPE_VERTICAL, 3.0, SCROLL_FLAG_NONE) == TRUE);
+ assert(SetScrollValuator
+ (&dev, 0, SCROLL_TYPE_VERTICAL, 3.0, SCROLL_FLAG_NONE) == TRUE);
axis = &dev.valuator->axes[0];
assert(axis->scroll.increment == 3.0);
assert(axis->scroll.type == SCROLL_TYPE_VERTICAL);
assert(axis->scroll.flags == 0);
/* valid */
- assert(SetScrollValuator(&dev, 1, SCROLL_TYPE_HORIZONTAL, 2.0, SCROLL_FLAG_NONE) == TRUE);
+ assert(SetScrollValuator
+ (&dev, 1, SCROLL_TYPE_HORIZONTAL, 2.0, SCROLL_FLAG_NONE) == TRUE);
axis = &dev.valuator->axes[1];
assert(axis->scroll.increment == 2.0);
assert(axis->scroll.type == SCROLL_TYPE_HORIZONTAL);
assert(axis->scroll.flags == 0);
/* can add another non-preffered axis */
- assert(SetScrollValuator(&dev, 1, SCROLL_TYPE_VERTICAL, 5.0, SCROLL_FLAG_NONE) == TRUE);
- assert(SetScrollValuator(&dev, 0, SCROLL_TYPE_HORIZONTAL, 5.0, SCROLL_FLAG_NONE) == TRUE);
+ assert(SetScrollValuator
+ (&dev, 1, SCROLL_TYPE_VERTICAL, 5.0, SCROLL_FLAG_NONE) == TRUE);
+ assert(SetScrollValuator
+ (&dev, 0, SCROLL_TYPE_HORIZONTAL, 5.0, SCROLL_FLAG_NONE) == TRUE);
/* can overwrite with Preferred */
- assert(SetScrollValuator(&dev, 1, SCROLL_TYPE_VERTICAL, 5.5, SCROLL_FLAG_PREFERRED) == TRUE);
+ assert(SetScrollValuator
+ (&dev, 1, SCROLL_TYPE_VERTICAL, 5.5, SCROLL_FLAG_PREFERRED) == TRUE);
axis = &dev.valuator->axes[1];
assert(axis->scroll.increment == 5.5);
assert(axis->scroll.type == SCROLL_TYPE_VERTICAL);
assert(axis->scroll.flags == SCROLL_FLAG_PREFERRED);
- assert(SetScrollValuator(&dev, 0, SCROLL_TYPE_HORIZONTAL, 8.8, SCROLL_FLAG_PREFERRED) == TRUE);
+ assert(SetScrollValuator
+ (&dev, 0, SCROLL_TYPE_HORIZONTAL, 8.8,
+ SCROLL_FLAG_PREFERRED) == TRUE);
axis = &dev.valuator->axes[0];
assert(axis->scroll.increment == 8.8);
assert(axis->scroll.type == SCROLL_TYPE_HORIZONTAL);
@@ -122,17 +133,19 @@ static void dix_init_valuators(void)
/* can overwrite as none */
assert(SetScrollValuator(&dev, 0, SCROLL_TYPE_NONE, 5.0,
- SCROLL_FLAG_NONE) == TRUE);
+ SCROLL_FLAG_NONE) == TRUE);
axis = &dev.valuator->axes[0];
assert(axis->scroll.type == SCROLL_TYPE_NONE);
/* can overwrite axis with new settings */
- assert(SetScrollValuator(&dev, 0, SCROLL_TYPE_VERTICAL, 5.0, SCROLL_FLAG_NONE) == TRUE);
+ assert(SetScrollValuator
+ (&dev, 0, SCROLL_TYPE_VERTICAL, 5.0, SCROLL_FLAG_NONE) == TRUE);
axis = &dev.valuator->axes[0];
assert(axis->scroll.type == SCROLL_TYPE_VERTICAL);
assert(axis->scroll.increment == 5.0);
assert(axis->scroll.flags == SCROLL_FLAG_NONE);
- assert(SetScrollValuator(&dev, 0, SCROLL_TYPE_VERTICAL, 3.0, SCROLL_FLAG_NONE) == TRUE);
+ assert(SetScrollValuator
+ (&dev, 0, SCROLL_TYPE_VERTICAL, 3.0, SCROLL_FLAG_NONE) == TRUE);
assert(axis->scroll.type == SCROLL_TYPE_VERTICAL);
assert(axis->scroll.increment == 3.0);
assert(axis->scroll.flags == SCROLL_FLAG_NONE);
@@ -140,7 +153,8 @@ static void dix_init_valuators(void)
/* just check the known success cases, and that error cases set the client's
* error value correctly. */
-static void dix_check_grab_values(void)
+static void
+dix_check_grab_values(void)
{
ClientRec client;
GrabParameters param;
@@ -195,7 +209,6 @@ static void dix_check_grab_values(void)
assert(client.errorValue == param.modifiers);
assert(client.errorValue == (1 << 13));
-
param.modifiers = AnyModifier;
param.ownerEvents = TRUE;
rc = CheckGrabValues(&client, &param);
@@ -208,12 +221,12 @@ static void dix_check_grab_values(void)
assert(client.errorValue == 3);
}
-
/**
* Convert various internal events to the matching core event and verify the
* parameters.
*/
-static void dix_event_to_core(int type)
+static void
+dix_event_to_core(int type)
{
DeviceEvent ev;
xEvent *core;
@@ -249,41 +262,41 @@ static void dix_event_to_core(int type)
state = 0;
detail = 0;
- ev.header = 0xFF;
- ev.length = sizeof(DeviceEvent);
- ev.time = time;
- ev.root_y = x;
- ev.root_x = y;
+ ev.header = 0xFF;
+ ev.length = sizeof(DeviceEvent);
+ ev.time = time;
+ ev.root_y = x;
+ ev.root_x = y;
SetBit(ev.valuators.mask, 0);
SetBit(ev.valuators.mask, 1);
- ev.root = ROOT_WINDOW_ID;
+ ev.root = ROOT_WINDOW_ID;
ev.corestate = state;
ev.detail.key = detail;
ev.type = type;
ev.detail.key = 0;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
test_event();
x = 1;
y = 2;
ev.root_x = x;
ev.root_y = y;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
test_event();
x = 0x7FFF;
y = 0x7FFF;
ev.root_x = x;
ev.root_y = y;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
test_event();
- x = 0x8000; /* too high */
- y = 0x8000; /* too high */
+ x = 0x8000; /* too high */
+ y = 0x8000; /* too high */
ev.root_x = x;
ev.root_y = y;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
assert(rc == Success);
assert(core);
assert(count == 1);
@@ -296,34 +309,34 @@ static void dix_event_to_core(int type)
ev.root_y = y;
time = 0;
ev.time = time;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
test_event();
detail = 1;
ev.detail.key = detail;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
test_event();
- detail = 0xFF; /* highest value */
+ detail = 0xFF; /* highest value */
ev.detail.key = detail;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
test_event();
- detail = 0xFFF; /* too big */
+ detail = 0xFFF; /* too big */
ev.detail.key = detail;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
assert(rc == BadMatch);
- detail = 0xFF; /* too big */
+ detail = 0xFF; /* too big */
ev.detail.key = detail;
- state = 0xFFFF; /* highest value */
+ state = 0xFFFF; /* highest value */
ev.corestate = state;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
test_event();
- state = 0x10000; /* too big */
+ state = 0x10000; /* too big */
ev.corestate = state;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
assert(rc == Success);
assert(core);
assert(count == 1);
@@ -333,22 +346,24 @@ static void dix_event_to_core(int type)
#undef test_event
}
-static void dix_event_to_core_fail(int evtype, int expected_rc)
+static void
+dix_event_to_core_fail(int evtype, int expected_rc)
{
DeviceEvent ev;
xEvent *core;
int rc;
int count;
- ev.header = 0xFF;
- ev.length = sizeof(DeviceEvent);
+ ev.header = 0xFF;
+ ev.length = sizeof(DeviceEvent);
- ev.type = evtype;
- rc = EventToCore((InternalEvent*)&ev, &core, &count);
+ ev.type = evtype;
+ rc = EventToCore((InternalEvent *) &ev, &core, &count);
assert(rc == expected_rc);
}
-static void dix_event_to_core_conversion(void)
+static void
+dix_event_to_core_conversion(void)
{
dix_event_to_core_fail(0, BadImplementation);
dix_event_to_core_fail(1, BadImplementation);
@@ -370,11 +385,12 @@ _dix_test_xi_convert(DeviceEvent *ev, int expected_rc, int expected_count)
int count = 0;
int rc;
- rc = EventToXI((InternalEvent*)ev, &xi, &count);
+ rc = EventToXI((InternalEvent *) ev, &xi, &count);
assert(rc == expected_rc);
assert(count >= expected_count);
- if (count > 0){
- deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer*)xi;
+ if (count > 0) {
+ deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer *) xi;
+
assert(kbp->type == IEventBase + ev->type);
assert(kbp->detail == ev->detail.key);
assert(kbp->time == ev->time);
@@ -390,12 +406,12 @@ _dix_test_xi_convert(DeviceEvent *ev, int expected_rc, int expected_count)
assert(kbp->same_screen == FALSE);
while (--count > 0) {
- deviceValuator *v = (deviceValuator*)&xi[count];
+ deviceValuator *v = (deviceValuator *) & xi[count];
+
assert(v->type == DeviceValuator);
assert(v->num_valuators <= 6);
}
-
free(xi);
}
}
@@ -406,9 +422,10 @@ _dix_test_xi_convert(DeviceEvent *ev, int expected_rc, int expected_count)
* - right number of events generated
* - extra events are valuators
*/
-static void dix_event_to_xi1_conversion(void)
+static void
+dix_event_to_xi1_conversion(void)
{
- DeviceEvent ev = {0};
+ DeviceEvent ev = { 0 };
int time;
int x, y;
int state;
@@ -417,16 +434,16 @@ static void dix_event_to_xi1_conversion(void)
int deviceid;
IEventBase = 80;
- DeviceValuator = IEventBase - 1;
- DeviceKeyPress = IEventBase + ET_KeyPress;
- DeviceKeyRelease = IEventBase + ET_KeyRelease;
- DeviceButtonPress = IEventBase + ET_ButtonPress;
+ DeviceValuator = IEventBase - 1;
+ DeviceKeyPress = IEventBase + ET_KeyPress;
+ DeviceKeyRelease = IEventBase + ET_KeyRelease;
+ DeviceButtonPress = IEventBase + ET_ButtonPress;
DeviceButtonRelease = IEventBase + ET_ButtonRelease;
- DeviceMotionNotify = IEventBase + ET_Motion;
- DeviceFocusIn = IEventBase + ET_FocusIn;
- DeviceFocusOut = IEventBase + ET_FocusOut;
- ProximityIn = IEventBase + ET_ProximityIn;
- ProximityOut = IEventBase + ET_ProximityOut;
+ DeviceMotionNotify = IEventBase + ET_Motion;
+ DeviceFocusIn = IEventBase + ET_FocusIn;
+ DeviceFocusOut = IEventBase + ET_FocusOut;
+ ProximityIn = IEventBase + ET_ProximityIn;
+ ProximityOut = IEventBase + ET_ProximityOut;
/* EventToXI callocs */
x = 0;
@@ -436,39 +453,53 @@ static void dix_event_to_xi1_conversion(void)
detail = 0;
deviceid = 4;
- ev.header = 0xFF;
+ ev.header = 0xFF;
- ev.header = 0xFF;
- ev.length = sizeof(DeviceEvent);
- ev.time = time;
- ev.root_y = x;
- ev.root_x = y;
+ ev.header = 0xFF;
+ ev.length = sizeof(DeviceEvent);
+ ev.time = time;
+ ev.root_y = x;
+ ev.root_x = y;
SetBit(ev.valuators.mask, 0);
SetBit(ev.valuators.mask, 1);
- ev.root = ROOT_WINDOW_ID;
- ev.corestate = state;
- ev.detail.key = detail;
- ev.deviceid = deviceid;
+ ev.root = ROOT_WINDOW_ID;
+ ev.corestate = state;
+ ev.detail.key = detail;
+ ev.deviceid = deviceid;
/* test all types for bad match */
- ev.type = ET_KeyPress; _dix_test_xi_convert(&ev, Success, 1);
- ev.type = ET_KeyRelease; _dix_test_xi_convert(&ev, Success, 1);
- ev.type = ET_ButtonPress; _dix_test_xi_convert(&ev, Success, 1);
- ev.type = ET_ButtonRelease; _dix_test_xi_convert(&ev, Success, 1);
- ev.type = ET_Motion; _dix_test_xi_convert(&ev, Success, 1);
- ev.type = ET_ProximityIn; _dix_test_xi_convert(&ev, Success, 1);
- ev.type = ET_ProximityOut; _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_KeyPress;
+ _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_KeyRelease;
+ _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_ButtonPress;
+ _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_ButtonRelease;
+ _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_Motion;
+ _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_ProximityIn;
+ _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_ProximityOut;
+ _dix_test_xi_convert(&ev, Success, 1);
/* No axes */
ClearBit(ev.valuators.mask, 0);
ClearBit(ev.valuators.mask, 1);
- ev.type = ET_KeyPress; _dix_test_xi_convert(&ev, Success, 1);
- ev.type = ET_KeyRelease; _dix_test_xi_convert(&ev, Success, 1);
- ev.type = ET_ButtonPress; _dix_test_xi_convert(&ev, Success, 1);
- ev.type = ET_ButtonRelease; _dix_test_xi_convert(&ev, Success, 1);
- ev.type = ET_Motion; _dix_test_xi_convert(&ev, BadMatch, 0);
- ev.type = ET_ProximityIn; _dix_test_xi_convert(&ev, BadMatch, 0);
- ev.type = ET_ProximityOut; _dix_test_xi_convert(&ev, BadMatch, 0);
+ ev.type = ET_KeyPress;
+ _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_KeyRelease;
+ _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_ButtonPress;
+ _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_ButtonRelease;
+ _dix_test_xi_convert(&ev, Success, 1);
+ ev.type = ET_Motion;
+ _dix_test_xi_convert(&ev, BadMatch, 0);
+ ev.type = ET_ProximityIn;
+ _dix_test_xi_convert(&ev, BadMatch, 0);
+ ev.type = ET_ProximityOut;
+ _dix_test_xi_convert(&ev, BadMatch, 0);
/* more than 6 axes → 2 valuator events */
SetBit(ev.valuators.mask, 0);
@@ -478,14 +509,20 @@ static void dix_event_to_xi1_conversion(void)
SetBit(ev.valuators.mask, 4);
SetBit(ev.valuators.mask, 5);
SetBit(ev.valuators.mask, 6);
- ev.type = ET_KeyPress; _dix_test_xi_convert(&ev, Success, 2);
- ev.type = ET_KeyRelease; _dix_test_xi_convert(&ev, Success, 2);
- ev.type = ET_ButtonPress; _dix_test_xi_convert(&ev, Success, 2);
- ev.type = ET_ButtonRelease; _dix_test_xi_convert(&ev, Success, 2);
- ev.type = ET_Motion; _dix_test_xi_convert(&ev, Success, 2);
- ev.type = ET_ProximityIn; _dix_test_xi_convert(&ev, Success, 2);
- ev.type = ET_ProximityOut; _dix_test_xi_convert(&ev, Success, 2);
-
+ ev.type = ET_KeyPress;
+ _dix_test_xi_convert(&ev, Success, 2);
+ ev.type = ET_KeyRelease;
+ _dix_test_xi_convert(&ev, Success, 2);
+ ev.type = ET_ButtonPress;
+ _dix_test_xi_convert(&ev, Success, 2);
+ ev.type = ET_ButtonRelease;
+ _dix_test_xi_convert(&ev, Success, 2);
+ ev.type = ET_Motion;
+ _dix_test_xi_convert(&ev, Success, 2);
+ ev.type = ET_ProximityIn;
+ _dix_test_xi_convert(&ev, Success, 2);
+ ev.type = ET_ProximityOut;
+ _dix_test_xi_convert(&ev, Success, 2);
/* keycode too high */
ev.type = ET_KeyPress;
@@ -499,8 +536,8 @@ static void dix_event_to_xi1_conversion(void)
_dix_test_xi_convert(&ev, Success, 0);
}
-
-static void xi2_struct_sizes(void)
+static void
+xi2_struct_sizes(void)
{
#define compare(req) \
assert(sizeof(req) == sz_##req);
@@ -529,8 +566,8 @@ static void xi2_struct_sizes(void)
#undef compare
}
-
-static void dix_grab_matching(void)
+static void
+dix_grab_matching(void)
{
DeviceIntRec xi_all_devices, xi_all_master_devices, dev1, dev2;
GrabRec a, b;
@@ -891,36 +928,44 @@ static void dix_grab_matching(void)
assert(rc == TRUE);
}
-static void test_bits_to_byte(int i)
+static void
+test_bits_to_byte(int i)
{
- int expected_bytes;
- expected_bytes = (i + 7)/8;
+ int expected_bytes;
+
+ expected_bytes = (i + 7) / 8;
- assert(bits_to_bytes(i) >= i/8);
- assert((bits_to_bytes(i) * 8) - i <= 7);
- assert(expected_bytes == bits_to_bytes(i));
+ assert(bits_to_bytes(i) >= i / 8);
+ assert((bits_to_bytes(i) * 8) - i <= 7);
+ assert(expected_bytes == bits_to_bytes(i));
}
-static void test_bytes_to_int32(int i)
+static void
+test_bytes_to_int32(int i)
{
- int expected_4byte;
- expected_4byte = (i + 3)/4;
+ int expected_4byte;
+
+ expected_4byte = (i + 3) / 4;
- assert(bytes_to_int32(i) <= i);
- assert((bytes_to_int32(i) * 4) - i <= 3);
- assert(expected_4byte == bytes_to_int32(i));
+ assert(bytes_to_int32(i) <= i);
+ assert((bytes_to_int32(i) * 4) - i <= 3);
+ assert(expected_4byte == bytes_to_int32(i));
}
-static void test_pad_to_int32(int i)
+static void
+test_pad_to_int32(int i)
{
- int expected_bytes;
- expected_bytes = ((i + 3)/4) * 4;
+ int expected_bytes;
+
+ expected_bytes = ((i + 3) / 4) * 4;
- assert(pad_to_int32(i) >= i);
- assert(pad_to_int32(i) - i <= 3);
- assert(expected_bytes == pad_to_int32(i));
+ assert(pad_to_int32(i) >= i);
+ assert(pad_to_int32(i) - i <= 3);
+ assert(expected_bytes == pad_to_int32(i));
}
-static void include_byte_padding_macros(void)
+
+static void
+include_byte_padding_macros(void)
{
printf("Testing bits_to_bytes()\n");
@@ -969,7 +1014,8 @@ static void include_byte_padding_macros(void)
test_pad_to_int32(INT_MAX - 3);
}
-static void xi_unregister_handlers(void)
+static void
+xi_unregister_handlers(void)
{
DeviceIntRec dev;
int handler;
@@ -985,7 +1031,7 @@ static void xi_unregister_handlers(void)
printf("Unlinking from front.\n");
- XIUnregisterPropertyHandler(&dev, 4); /* NOOP */
+ XIUnregisterPropertyHandler(&dev, 4); /* NOOP */
assert(dev.properties.handlers->id == 3);
XIUnregisterPropertyHandler(&dev, 3);
assert(dev.properties.handlers->id == 2);
@@ -1000,7 +1046,7 @@ static void xi_unregister_handlers(void)
assert(handler == 5);
handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL);
assert(handler == 6);
- XIUnregisterPropertyHandler(&dev, 3); /* NOOP */
+ XIUnregisterPropertyHandler(&dev, 3); /* NOOP */
assert(dev.properties.handlers->next->next->next == NULL);
XIUnregisterPropertyHandler(&dev, 4);
assert(dev.properties.handlers->next->next == NULL);
@@ -1018,12 +1064,12 @@ static void xi_unregister_handlers(void)
XIDeleteAllDeviceProperties(&dev);
assert(dev.properties.handlers == NULL);
- XIUnregisterPropertyHandler(&dev, 7); /* NOOP */
+ XIUnregisterPropertyHandler(&dev, 7); /* NOOP */
}
-static void cmp_attr_fields(InputAttributes *attr1,
- InputAttributes *attr2)
+static void
+cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2)
{
char **tags1, **tags2;
@@ -1031,47 +1077,46 @@ static void cmp_attr_fields(InputAttributes *attr1,
assert(attr1 != attr2);
assert(attr1->flags == attr2->flags);
- if (attr1->product != NULL)
- {
+ if (attr1->product != NULL) {
assert(attr1->product != attr2->product);
assert(strcmp(attr1->product, attr2->product) == 0);
- } else
+ }
+ else
assert(attr2->product == NULL);
- if (attr1->vendor != NULL)
- {
+ if (attr1->vendor != NULL) {
assert(attr1->vendor != attr2->vendor);
assert(strcmp(attr1->vendor, attr2->vendor) == 0);
- } else
+ }
+ else
assert(attr2->vendor == NULL);
- if (attr1->device != NULL)
- {
+ if (attr1->device != NULL) {
assert(attr1->device != attr2->device);
assert(strcmp(attr1->device, attr2->device) == 0);
- } else
+ }
+ else
assert(attr2->device == NULL);
- if (attr1->pnp_id != NULL)
- {
+ if (attr1->pnp_id != NULL) {
assert(attr1->pnp_id != attr2->pnp_id);
assert(strcmp(attr1->pnp_id, attr2->pnp_id) == 0);
- } else
+ }
+ else
assert(attr2->pnp_id == NULL);
- if (attr1->usb_id != NULL)
- {
+ if (attr1->usb_id != NULL) {
assert(attr1->usb_id != attr2->usb_id);
assert(strcmp(attr1->usb_id, attr2->usb_id) == 0);
- } else
+ }
+ else
assert(attr2->usb_id == NULL);
tags1 = attr1->tags;
tags2 = attr2->tags;
/* if we don't have any tags, skip the tag checking bits */
- if (!tags1)
- {
+ if (!tags1) {
assert(!tags2);
return;
}
@@ -1081,8 +1126,7 @@ static void cmp_attr_fields(InputAttributes *attr1,
assert(*tags2);
/* check for identical content, but duplicated */
- while (*tags1)
- {
+ while (*tags1) {
assert(*tags1 != *tags2);
assert(strcmp(*tags1, *tags2) == 0);
tags1++;
@@ -1094,8 +1138,7 @@ static void cmp_attr_fields(InputAttributes *attr1,
/* check for not sharing memory */
tags1 = attr1->tags;
- while (*tags1)
- {
+ while (*tags1) {
tags2 = attr2->tags;
while (*tags2)
assert(*tags1 != *tags2++);
@@ -1104,11 +1147,12 @@ static void cmp_attr_fields(InputAttributes *attr1,
}
}
-static void dix_input_attributes(void)
+static void
+dix_input_attributes(void)
{
- InputAttributes orig = {0};
+ InputAttributes orig = { 0 };
InputAttributes *new;
- char *tags[4] = {"tag1", "tag2", "tag2", NULL};
+ char *tags[4] = { "tag1", "tag2", "tag2", NULL };
new = DuplicateInputAttributes(NULL);
assert(!new);
@@ -1152,7 +1196,8 @@ static void dix_input_attributes(void)
FreeInputAttributes(new);
}
-static void dix_input_valuator_masks(void)
+static void
+dix_input_valuator_masks(void)
{
ValuatorMask *mask = NULL, *copy;
int nvaluators = MAX_VALUATORS;
@@ -1161,8 +1206,7 @@ static void dix_input_valuator_masks(void)
int i;
int first_val, num_vals;
- for (i = 0; i < nvaluators; i++)
- {
+ for (i = 0; i < nvaluators; i++) {
valuators[i] = i + 0.5;
val_ranged[i] = i;
}
@@ -1172,8 +1216,7 @@ static void dix_input_valuator_masks(void)
assert(valuator_mask_size(mask) == 0);
assert(valuator_mask_num_valuators(mask) == 0);
- for (i = 0; i < nvaluators; i++)
- {
+ for (i = 0; i < nvaluators; i++) {
assert(!valuator_mask_isset(mask, i));
valuator_mask_set_double(mask, i, valuators[i]);
assert(valuator_mask_isset(mask, i));
@@ -1183,8 +1226,7 @@ static void dix_input_valuator_masks(void)
assert(valuator_mask_num_valuators(mask) == i + 1);
}
- for (i = 0; i < nvaluators; i++)
- {
+ for (i = 0; i < nvaluators; i++) {
assert(valuator_mask_isset(mask, i));
valuator_mask_unset(mask, i);
/* we're removing valuators from the front, so size should stay the
@@ -1207,19 +1249,18 @@ static void dix_input_valuator_masks(void)
valuator_mask_set_range(mask, first_val, num_vals, val_ranged);
assert(valuator_mask_size(mask) == first_val + num_vals);
assert(valuator_mask_num_valuators(mask) == num_vals);
- for (i = 0; i < nvaluators; i++)
- {
+ for (i = 0; i < nvaluators; i++) {
double val;
- if (i < first_val || i >= first_val + num_vals)
- {
+
+ if (i < first_val || i >= first_val + num_vals) {
assert(!valuator_mask_isset(mask, i));
assert(!valuator_mask_fetch_double(mask, i, &val));
- } else
- {
+ }
+ else {
assert(valuator_mask_isset(mask, i));
assert(valuator_mask_get(mask, i) == val_ranged[i - first_val]);
assert(valuator_mask_get_double(mask, i) ==
- val_ranged[i - first_val]);
+ val_ranged[i - first_val]);
assert(valuator_mask_fetch_double(mask, i, &val));
assert(val_ranged[i - first_val] == val);
}
@@ -1229,11 +1270,12 @@ static void dix_input_valuator_masks(void)
valuator_mask_copy(copy, mask);
assert(mask != copy);
assert(valuator_mask_size(mask) == valuator_mask_size(copy));
- assert(valuator_mask_num_valuators(mask) == valuator_mask_num_valuators(copy));
+ assert(valuator_mask_num_valuators(mask) ==
+ valuator_mask_num_valuators(copy));
- for (i = 0; i < nvaluators; i++)
- {
+ for (i = 0; i < nvaluators; i++) {
double a, b;
+
assert(valuator_mask_isset(mask, i) == valuator_mask_isset(copy, i));
if (!valuator_mask_isset(mask, i))
@@ -1241,7 +1283,7 @@ static void dix_input_valuator_masks(void)
assert(valuator_mask_get(mask, i) == valuator_mask_get(copy, i));
assert(valuator_mask_get_double(mask, i) ==
- valuator_mask_get_double(copy, i));
+ valuator_mask_get_double(copy, i));
assert(valuator_mask_fetch_double(mask, i, &a));
assert(valuator_mask_fetch_double(copy, i, &b));
assert(a == b);
@@ -1251,7 +1293,8 @@ static void dix_input_valuator_masks(void)
assert(mask == NULL);
}
-static void dix_valuator_mode(void)
+static void
+dix_valuator_mode(void)
{
DeviceIntRec dev;
const int num_axes = MAX_VALUATORS;
@@ -1259,13 +1302,12 @@ static void dix_valuator_mode(void)
Atom atoms[MAX_VALUATORS] = { 0 };
memset(&dev, 0, sizeof(DeviceIntRec));
- dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */
+ dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */
assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE);
assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute));
- for (i = 0; i < num_axes; i++)
- {
+ for (i = 0; i < num_axes; i++) {
assert(valuator_get_mode(&dev, i) == Absolute);
valuator_set_mode(&dev, i, Relative);
assert(dev.valuator->axes[i].mode == Relative);
@@ -1281,17 +1323,17 @@ static void dix_valuator_mode(void)
assert(valuator_get_mode(&dev, i) == Relative);
}
-static void include_bit_test_macros(void)
+static void
+include_bit_test_macros(void)
{
uint8_t mask[9] = { 0 };
int i;
- for (i = 0; i < sizeof(mask)/sizeof(mask[0]); i++)
- {
+ for (i = 0; i < sizeof(mask) / sizeof(mask[0]); i++) {
assert(BitIsOn(mask, i) == 0);
SetBit(mask, i);
assert(BitIsOn(mask, i) == 1);
- assert(!!(mask[i/8] & (1 << (i % 8))));
+ assert(! !(mask[i / 8] & (1 << (i % 8))));
assert(CountBits(mask, sizeof(mask)) == 1);
ClearBit(mask, i);
assert(BitIsOn(mask, i) == 0);
@@ -1301,29 +1343,30 @@ static void include_bit_test_macros(void)
/**
* Ensure that val->axisVal and val->axes are aligned on doubles.
*/
-static void dix_valuator_alloc(void)
+static void
+dix_valuator_alloc(void)
{
ValuatorClassPtr v = NULL;
int num_axes = 0;
- while (num_axes < 5)
- {
+ while (num_axes < 5) {
v = AllocValuatorClass(v, num_axes);
assert(v);
assert(v->numAxes == num_axes);
#if !defined(__i386__) && !defined(__sh__)
/* must be double-aligned on 64 bit */
- assert(((void*)v->axisVal - (void*)v) % sizeof(double) == 0);
- assert(((void*)v->axes - (void*)v) % sizeof(double) == 0);
+ assert(((void *) v->axisVal - (void *) v) % sizeof(double) == 0);
+ assert(((void *) v->axes - (void *) v) % sizeof(double) == 0);
#endif
- num_axes ++;
+ num_axes++;
}
free(v);
}
-static void dix_get_master(void)
+static void
+dix_get_master(void)
{
DeviceIntRec vcp, vck;
DeviceIntRec ptr, kbd;
@@ -1396,8 +1439,8 @@ static void dix_get_master(void)
assert(GetMaster(&floating, POINTER_OR_FLOAT) == &floating);
}
-
-static void input_option_test(void)
+static void
+input_option_test(void)
{
InputOption *list = NULL;
InputOption *opt;
@@ -1559,6 +1602,7 @@ static void
dix_double_fp_conversion(void)
{
uint32_t i;
+
printf("Testing double to FP1616/FP3232 conversions\n");
_test_double_fp16_values(0);
@@ -1622,25 +1666,28 @@ dix_double_fp_conversion(void)
static uint32_t mieq_test_event_last_processed;
static void
-mieq_test_event_handler(int screenNum, InternalEvent *ie, DeviceIntPtr dev) {
- RawDeviceEvent *e = (RawDeviceEvent *)ie;
+mieq_test_event_handler(int screenNum, InternalEvent *ie, DeviceIntPtr dev)
+{
+ RawDeviceEvent *e = (RawDeviceEvent *) ie;
assert(e->type == ET_RawMotion);
assert(e->flags > mieq_test_event_last_processed);
mieq_test_event_last_processed = e->flags;
}
-static void _mieq_test_generate_events(uint32_t start, uint32_t count) {
+static void
+_mieq_test_generate_events(uint32_t start, uint32_t count)
+{
count += start;
while (start < count) {
- RawDeviceEvent e = {0};
+ RawDeviceEvent e = { 0 };
e.header = ET_Internal;
e.type = ET_RawMotion;
e.length = sizeof(e);
e.time = GetTimeInMillis();
e.flags = start;
- mieqEnqueue(NULL, (InternalEvent*)&e);
+ mieqEnqueue(NULL, (InternalEvent *) &e);
start++;
}
@@ -1649,7 +1696,8 @@ static void _mieq_test_generate_events(uint32_t start, uint32_t count) {
#define mieq_test_generate_events(c) { _mieq_test_generate_events(next, c); next += c; }
static void
-mieq_test(void) {
+mieq_test(void)
+{
uint32_t next = 1;
mieq_test_event_last_processed = 0;
@@ -1696,7 +1744,8 @@ process_input_proc(InternalEvent *ev, DeviceIntPtr device)
}
static void
-dix_enqueue_events(void) {
+dix_enqueue_events(void)
+{
#define NEVENTS 5
DeviceIntRec dev;
InternalEvent ev[NEVENTS];
@@ -1723,8 +1772,7 @@ dix_enqueue_events(void) {
/* to reset process_input_proc */
ev[0].any.header = 0xac;
- for (i = 0; i < NEVENTS; i++)
- {
+ for (i = 0; i < NEVENTS; i++) {
ev[i].any.length = sizeof(*ev);
ev[i].any.type = i;
EnqueueEvent(&ev[i], &dev);
@@ -1740,7 +1788,6 @@ dix_enqueue_events(void) {
PlayReleasedEvents();
assert(!xorg_list_is_empty(&syncEvents.pending));
-
dev.deviceGrab.sync.frozen = 0;
PlayReleasedEvents();
assert(xorg_list_is_empty(&syncEvents.pending));
@@ -1748,8 +1795,8 @@ dix_enqueue_events(void) {
inputInfo.devices = NULL;
}
-
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
dix_enqueue_events();
dix_double_fp_conversion();
diff --git a/xorg-server/test/list.c b/xorg-server/test/list.c
index 14bc74a08..82d232706 100644
--- a/xorg-server/test/list.c
+++ b/xorg-server/test/list.c
@@ -66,7 +66,7 @@ test_xorg_list_init(void)
static void
test_xorg_list_add(void)
{
- struct parent parent = {0};
+ struct parent parent = { 0 };
struct child child[3];
struct child *c;
@@ -76,22 +76,25 @@ test_xorg_list_add(void)
assert(!xorg_list_is_empty(&parent.children));
c = xorg_list_first_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
/* note: xorg_list_add prepends */
xorg_list_add(&child[1].node, &parent.children);
c = xorg_list_first_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
xorg_list_add(&child[2].node, &parent.children);
c = xorg_list_first_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
};
static void
test_xorg_list_append(void)
{
- struct parent parent = {0};
+ struct parent parent = { 0 };
struct child child[3];
struct child *c;
int i;
@@ -102,20 +105,26 @@ test_xorg_list_append(void)
assert(!xorg_list_is_empty(&parent.children));
c = xorg_list_first_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
c = xorg_list_last_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
xorg_list_append(&child[1].node, &parent.children);
c = xorg_list_first_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
c = xorg_list_last_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
xorg_list_append(&child[2].node, &parent.children);
c = xorg_list_first_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
c = xorg_list_last_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
i = 0;
@@ -127,7 +136,7 @@ test_xorg_list_append(void)
static void
test_xorg_list_del(void)
{
- struct parent parent = {0};
+ struct parent parent = { 0 };
struct child child[3];
struct child *c;
@@ -147,6 +156,7 @@ test_xorg_list_del(void)
xorg_list_add(&child[1].node, &parent.children);
c = xorg_list_first_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
/* delete first node */
@@ -154,12 +164,14 @@ test_xorg_list_del(void)
assert(!xorg_list_is_empty(&parent.children));
assert(xorg_list_is_empty(&child[1].node));
c = xorg_list_first_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
/* delete last node */
xorg_list_add(&child[1].node, &parent.children);
xorg_list_del(&child[0].node);
c = xorg_list_first_entry(&parent.children, struct child, node);
+
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
/* delete list head */
@@ -173,7 +185,7 @@ test_xorg_list_del(void)
static void
test_xorg_list_for_each(void)
{
- struct parent parent = {0};
+ struct parent parent = { 0 };
struct child child[3];
struct child *c;
int i = 0;
@@ -194,7 +206,7 @@ test_xorg_list_for_each(void)
assert(xorg_list_is_empty(&parent.children));
xorg_list_for_each_entry(c, &parent.children, node) {
- assert(0); /* we must not get here */
+ assert(0); /* we must not get here */
}
}
@@ -226,29 +238,27 @@ test_nt_list_append(void)
struct foo *foo = calloc(10, sizeof(struct foo));
struct foo *item;
- for (item = foo, i = 1; i <= 10; i++, item++)
- {
- item->a = i;
- item->b = i * 2;
- nt_list_init(item, next);
+ for (item = foo, i = 1; i <= 10; i++, item++) {
+ item->a = i;
+ item->b = i * 2;
+ nt_list_init(item, next);
- if (item != foo)
- nt_list_append(item, foo, struct foo, next);
+ if (item != foo)
+ nt_list_append(item, foo, struct foo, next);
}
/* Test using nt_list_next */
- for (item = foo, i = 1; i <= 10; i++, item = nt_list_next(item, next))
- {
- assert(item->a = i);
- assert(item->b = i * 2);
+ for (item = foo, i = 1; i <= 10; i++, item = nt_list_next(item, next)) {
+ assert(item->a = i);
+ assert(item->b = i * 2);
}
/* Test using nt_list_for_each_entry */
i = 1;
nt_list_for_each_entry(item, foo, next) {
- assert(item->a = i);
- assert(item->b = i * 2);
- i++;
+ assert(item->a = i);
+ assert(item->b = i * 2);
+ i++;
}
assert(i == 11);
}
@@ -264,27 +274,25 @@ test_nt_list_insert(void)
foo->b = 20;
nt_list_init(foo, next);
- for (item = &foo[1], i = 9; i > 0; i--, item++)
- {
- item->a = i;
- item->b = i * 2;
- nt_list_init(item, next);
- nt_list_insert(item, foo, struct foo, next);
+ for (item = &foo[1], i = 9; i > 0; i--, item++) {
+ item->a = i;
+ item->b = i * 2;
+ nt_list_init(item, next);
+ nt_list_insert(item, foo, struct foo, next);
}
/* Test using nt_list_next */
- for (item = foo, i = 10; i > 0; i--, item = nt_list_next(item, next))
- {
- assert(item->a = i);
- assert(item->b = i * 2);
+ for (item = foo, i = 10; i > 0; i--, item = nt_list_next(item, next)) {
+ assert(item->a = i);
+ assert(item->b = i * 2);
}
/* Test using nt_list_for_each_entry */
i = 1;
nt_list_for_each_entry(item, foo, next) {
- assert(item->a = i);
- assert(item->b = i * 2);
- i++;
+ assert(item->a = i);
+ assert(item->b = i * 2);
+ i++;
}
assert(i == 11);
}
@@ -300,55 +308,58 @@ test_nt_list_delete(void)
nt_list_init(empty_list, next);
nt_list_del(empty_list, empty_list, struct foo, next);
+
assert(!empty_list);
- for (item = foo, i = 1; i <= 10; i++, item++)
- {
- item->a = i;
- item->b = i * 2;
- nt_list_init(item, next);
+ for (item = foo, i = 1; i <= 10; i++, item++) {
+ item->a = i;
+ item->b = i * 2;
+ nt_list_init(item, next);
- if (item != foo)
- nt_list_append(item, foo, struct foo, next);
+ if (item != foo)
+ nt_list_append(item, foo, struct foo, next);
}
i = 0;
nt_list_for_each_entry(item, foo, next) {
- i++;
+ i++;
}
assert(i == 10);
/* delete last item */
nt_list_del(&foo[9], foo, struct foo, next);
+
i = 0;
nt_list_for_each_entry(item, foo, next) {
- assert(item->a != 10); /* element 10 is gone now */
- i++;
+ assert(item->a != 10); /* element 10 is gone now */
+ i++;
}
- assert(i == 9); /* 9 elements left */
+ assert(i == 9); /* 9 elements left */
/* delete second item */
nt_list_del(foo->next, foo, struct foo, next);
+
assert(foo->next->a == 3);
i = 0;
nt_list_for_each_entry(item, foo, next) {
- assert(item->a != 10); /* element 10 is gone now */
- assert(item->a != 2); /* element 2 is gone now */
- i++;
+ assert(item->a != 10); /* element 10 is gone now */
+ assert(item->a != 2); /* element 2 is gone now */
+ i++;
}
- assert(i == 8); /* 9 elements left */
+ assert(i == 8); /* 9 elements left */
item = foo;
/* delete first item */
nt_list_del(foo, foo, struct foo, next);
+
assert(item != foo);
assert(item->next == NULL);
assert(foo->a == 3);
assert(foo->next->a == 4);
nt_list_for_each_entry_safe(item, tmp, foo, next) {
- nt_list_del(item, foo, struct foo, next);
+ nt_list_del(item, foo, struct foo, next);
}
assert(!foo);
@@ -357,7 +368,8 @@ test_nt_list_delete(void)
free(list);
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
test_xorg_list_init();
test_xorg_list_add();
diff --git a/xorg-server/test/misc.c b/xorg-server/test/misc.c
index 1f6cb9a94..dd792e692 100644
--- a/xorg-server/test/misc.c
+++ b/xorg-server/test/misc.c
@@ -31,7 +31,8 @@
ScreenInfo screenInfo;
-static void dix_version_compare(void)
+static void
+dix_version_compare(void)
{
int rc;
@@ -57,7 +58,8 @@ static void dix_version_compare(void)
assert(rc < 0);
}
-static void dix_update_desktop_dimensions(void)
+static void
+dix_update_desktop_dimensions(void)
{
int i;
int x, y, w, h;
@@ -129,7 +131,6 @@ static void dix_update_desktop_dimensions(void)
set_screen(3, 0, 3 * h, w, h);
assert_dimensions(x, y, w, 4 * h);
-
/* x overlap */
screenInfo.numScreens = 2;
set_screen(0, 0, 0, w2, h2);
@@ -154,7 +155,8 @@ static void dix_update_desktop_dimensions(void)
assert_dimensions(-w2, -h2, w2, h2);
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
dix_version_compare();
dix_update_desktop_dimensions();
diff --git a/xorg-server/test/string.c b/xorg-server/test/string.c
index e3a5adb6d..93867e04a 100644
--- a/xorg-server/test/string.c
+++ b/xorg-server/test/string.c
@@ -37,20 +37,20 @@
#include <string.h>
#undef strndup
#define strndup my_strndup
-char *
-strndup(const char *str, size_t n);
+char *strndup(const char *str, size_t n);
#include "../os/strndup.c"
-static void strndup_checks(void)
+static void
+strndup_checks(void)
{
- const char *sample="0123456789abcdef";
+ const char *sample = "0123456789abcdef";
char *allofit;
char *firsthalf = strndup(sample, 8);
char *secondhalf = strndup(sample + 8, 8);
- assert(strcmp(firsthalf, "01234567") == 0);
+ assert(strcmp(firsthalf, "01234567") == 0);
assert(strcmp(secondhalf, "89abcdef") == 0);
free(firsthalf);
@@ -61,7 +61,8 @@ static void strndup_checks(void)
free(allofit);
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
strndup_checks();
diff --git a/xorg-server/test/touch.c b/xorg-server/test/touch.c
index 88955cbc1..2ec535b43 100644
--- a/xorg-server/test/touch.c
+++ b/xorg-server/test/touch.c
@@ -30,7 +30,8 @@
#include "assert.h"
#include "scrnintstr.h"
-static void touch_grow_queue(void)
+static void
+touch_grow_queue(void)
{
DeviceIntRec dev;
ValuatorClassRec val;
@@ -60,12 +61,13 @@ static void touch_grow_queue(void)
assert(TouchBeginDDXTouch(&dev, 1234) == NULL);
ProcessWorkQueue();
- new_size = size + size/2 + 1;
+ new_size = size + size / 2 + 1;
assert(dev.last.num_touches == new_size);
/* make sure we haven't touched those */
for (i = 0; i < size; i++) {
DDXTouchPointInfoPtr t = &dev.last.touches[i];
+
assert(t->active == TRUE);
assert(t->ddx_id == i);
assert(t->client_id == i * 2);
@@ -74,13 +76,15 @@ static void touch_grow_queue(void)
/* make sure those are zero-initialized */
for (i = size; i < new_size; i++) {
DDXTouchPointInfoPtr t = &dev.last.touches[i];
+
assert(t->active == FALSE);
assert(t->client_id == 0);
assert(t->ddx_id == 0);
}
}
-static void touch_find_ddxid(void)
+static void
+touch_find_ddxid(void)
{
DeviceIntRec dev;
DDXTouchPointInfoPtr ti;
@@ -99,12 +103,10 @@ static void touch_find_ddxid(void)
inputInfo.devices = &dev;
assert(dev.last.touches);
-
dev.last.touches[0].active = TRUE;
dev.last.touches[0].ddx_id = 10;
dev.last.touches[0].client_id = 20;
-
/* existing */
ti = TouchFindByDDXID(&dev, 10, FALSE);
assert(ti == &dev.last.touches[0]);
@@ -118,7 +120,7 @@ static void touch_find_ddxid(void)
ti = TouchFindByDDXID(&dev, 10, FALSE);
assert(ti == NULL);
- /* create on number 2*/
+ /* create on number 2 */
dev.last.touches[0].active = TRUE;
ti = TouchFindByDDXID(&dev, 20, TRUE);
@@ -148,7 +150,8 @@ static void touch_find_ddxid(void)
assert(ti == &dev.last.touches[size]);
}
-static void touch_begin_ddxtouch(void)
+static void
+touch_begin_ddxtouch(void)
{
DeviceIntRec dev;
DDXTouchPointInfoPtr ti;
@@ -191,7 +194,8 @@ static void touch_begin_ddxtouch(void)
last_client_id = ti->client_id;
}
-static void touch_begin_touch(void)
+static void
+touch_begin_touch(void)
{
DeviceIntRec dev;
TouchClassRec touch;
@@ -231,10 +235,11 @@ static void touch_begin_touch(void)
assert(touch.num_touches == 1);
}
-static void touch_init(void)
+static void
+touch_init(void)
{
DeviceIntRec dev;
- Atom labels[2] = {0};
+ Atom labels[2] = { 0 };
int rc;
SpriteInfoRec sprite;
ScreenRec screen;
@@ -256,9 +261,8 @@ static void touch_init(void)
assert(dev.touch);
}
-
-
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
touch_grow_queue();
touch_find_ddxid();
diff --git a/xorg-server/test/xfree86.c b/xorg-server/test/xfree86.c
index 448aa915e..f9892e68e 100644
--- a/xorg-server/test/xfree86.c
+++ b/xorg-server/test/xfree86.c
@@ -27,7 +27,6 @@
#include <assert.h>
-
#include "xf86.h"
#include "xf86Parser.h"
@@ -36,11 +35,8 @@ xfree86_option_list_duplicate(void)
{
XF86OptionPtr options;
XF86OptionPtr duplicate;
- const char *o1 = "foo",
- *o2 = "bar",
- *v1 = "one",
- *v2 = "two";
- const char *o_null= "NULL";
+ const char *o1 = "foo", *o2 = "bar", *v1 = "one", *v2 = "two";
+ const char *o_null = "NULL";
char *val1, *val2;
XF86OptionPtr a, b;
@@ -78,10 +74,10 @@ static void
xfree86_add_comment(void)
{
char *current = NULL, *comment;
- char compare[1024] = {0};
+ char compare[1024] = { 0 };
comment = "# foo";
- current = xf86addComment(current, comment);
+ current = xf86addComment(current, comment);
strcpy(compare, comment);
strcat(compare, "\n");
@@ -90,7 +86,7 @@ xfree86_add_comment(void)
/* this used to overflow */
strcpy(current, "\n");
comment = "foobar\n";
- current = xf86addComment(current, comment);
+ current = xf86addComment(current, comment);
strcpy(compare, "\n#");
strcat(compare, comment);
assert(!strcmp(current, compare));
@@ -98,7 +94,8 @@ xfree86_add_comment(void)
free(current);
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
xfree86_option_list_duplicate();
xfree86_add_comment();
diff --git a/xorg-server/test/xi2/protocol-common.c b/xorg-server/test/xi2/protocol-common.c
index 27edfe516..32c056797 100644
--- a/xorg-server/test/xi2/protocol-common.c
+++ b/xorg-server/test/xi2/protocol-common.c
@@ -26,9 +26,9 @@
#endif
#include <stdint.h>
-#include "extinit.h" /* for XInputExtensionInit */
+#include "extinit.h" /* for XInputExtensionInit */
#include "exglobals.h"
-#include "xkbsrv.h" /* for XkbInitPrivates */
+#include "xkbsrv.h" /* for XkbInitPrivates */
#include "xserver-properties.h"
#include <X11/extensions/XI2.h>
@@ -44,9 +44,11 @@ void *userdata;
extern int CorePointerProc(DeviceIntPtr pDev, int what);
extern int CoreKeyboardProc(DeviceIntPtr pDev, int what);
-static void fake_init_sprite(DeviceIntPtr dev)
+static void
+fake_init_sprite(DeviceIntPtr dev)
{
SpritePtr sprite;
+
sprite = dev->spriteInfo->sprite;
sprite->spriteTraceSize = 10;
@@ -73,32 +75,32 @@ TestPointerProc(DeviceIntPtr pDev, int what)
#define NAXES 4
BYTE map[NBUTTONS + 1];
int i = 0;
- Atom btn_labels[NBUTTONS] = {0};
- Atom axes_labels[NAXES] = {0};
+ Atom btn_labels[NBUTTONS] = { 0 };
+ Atom axes_labels[NAXES] = { 0 };
switch (what) {
case DEVICE_INIT:
for (i = 1; i <= NBUTTONS; i++)
map[i] = i;
- btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
- btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
- btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
- btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
- btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
- btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
- btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
- /* don't know about the rest */
-
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_VSCROLL);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HSCROLL);
-
- if (!InitPointerDeviceStruct((DevicePtr)pDev, map, NBUTTONS, btn_labels,
- (PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), NAXES, axes_labels))
- {
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ /* don't know about the rest */
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_VSCROLL);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HSCROLL);
+
+ if (!InitPointerDeviceStruct
+ ((DevicePtr) pDev, map, NBUTTONS, btn_labels,
+ (PtrCtrlProcPtr) NoopDDA, GetMotionHistorySize(), NAXES,
+ axes_labels)) {
ErrorF("Could not initialize device '%s'. Out of memory.\n",
pDev->name);
return BadAlloc;
@@ -110,7 +112,8 @@ TestPointerProc(DeviceIntPtr pDev, int what)
/* protocol-xiquerydevice.c relies on these increment */
SetScrollValuator(pDev, 2, SCROLL_TYPE_VERTICAL, 2.4, SCROLL_FLAG_NONE);
- SetScrollValuator(pDev, 3, SCROLL_TYPE_HORIZONTAL, 3.5, SCROLL_FLAG_PREFERRED);
+ SetScrollValuator(pDev, 3, SCROLL_TYPE_HORIZONTAL, 3.5,
+ SCROLL_FLAG_PREFERRED);
break;
case DEVICE_CLOSE:
@@ -125,11 +128,13 @@ TestPointerProc(DeviceIntPtr pDev, int what)
#undef NBUTTONS
#undef NAXES
}
+
/**
* Create and init 2 master devices (VCP + VCK) and two slave devices, one
* default mouse, one default keyboard.
*/
-struct devices init_devices(void)
+struct devices
+init_devices(void)
{
ClientRec client;
struct devices devices;
@@ -139,6 +144,7 @@ struct devices init_devices(void)
AllocDevicePair(&client, "Virtual core", &devices.vcp, &devices.vck,
CorePointerProc, CoreKeyboardProc, TRUE);
inputInfo.pointer = devices.vcp;
+
inputInfo.keyboard = devices.vck;
ActivateDevice(devices.vcp, FALSE);
ActivateDevice(devices.vck, FALSE);
@@ -161,9 +167,9 @@ struct devices init_devices(void)
return devices;
}
-
/* Create minimal client, with the given buffer and len as request buffer */
-ClientRec init_client(int len, void *data)
+ClientRec
+init_client(int len, void *data)
{
ClientRec client = { 0 };
@@ -181,13 +187,13 @@ ClientRec init_client(int len, void *data)
return client;
}
-void init_window(WindowPtr window, WindowPtr parent, int id)
+void
+init_window(WindowPtr window, WindowPtr parent, int id)
{
memset(window, 0, sizeof(*window));
window->drawable.id = id;
- if (parent)
- {
+ if (parent) {
window->drawable.x = 30;
window->drawable.y = 50;
window->drawable.width = 100;
@@ -202,9 +208,20 @@ extern DevPrivateKeyRec miPointerScreenKeyRec;
extern DevPrivateKeyRec miPointerPrivKeyRec;
/* Needed for the screen setup, otherwise we crash during sprite initialization */
-static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
-static Bool set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event) { return TRUE; }
-void init_simple(void)
+static Bool
+device_cursor_init(DeviceIntPtr dev, ScreenPtr screen)
+{
+ return TRUE;
+}
+
+static Bool
+set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event)
+{
+ return TRUE;
+}
+
+void
+init_simple(void)
{
screenInfo.numScreens = 1;
screenInfo.screens[0] = &screen;
@@ -219,7 +236,8 @@ void init_simple(void)
dixResetPrivates();
InitAtoms();
XkbInitPrivates();
- dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec));
+ dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT,
+ sizeof(XIClientRec));
dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0);
dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0);
XInputExtensionInit();
@@ -230,10 +248,10 @@ void init_simple(void)
devices = init_devices();
}
-void __wrap_WriteToClient(ClientPtr client, int len, void *data)
+void
+__wrap_WriteToClient(ClientPtr client, int len, void *data)
{
assert(reply_handler != NULL);
- (*reply_handler)(client, len, data, userdata);
+ (*reply_handler) (client, len, data, userdata);
}
-
diff --git a/xorg-server/test/xi2/protocol-common.h b/xorg-server/test/xi2/protocol-common.h
index b55f57c05..04a1e8990 100644
--- a/xorg-server/test/xi2/protocol-common.h
+++ b/xorg-server/test/xi2/protocol-common.h
@@ -53,7 +53,6 @@ extern int BadDevice;
(req)->length = (sz_x##type##Req >> 2); \
}
-
/* Various defines used in the tests. Some tests may use different values
* than these defaults */
/* default client index */
@@ -72,10 +71,8 @@ extern int BadDevice;
#define SPRITE_X 100
#define SPRITE_Y 200
-
/* Various structs used throughout the tests */
-
/* The default devices struct, contains one pointer + keyboard and the
* matching master devices. Initialize with init_devices() if needed. */
struct devices {
@@ -97,20 +94,23 @@ extern struct devices devices;
* test-specific userdata, passed into the reply handler.
*/
extern void *userdata;
+
/**
* The reply handler called from WriteToClient. Set this handler if you need
* to check the reply values.
*/
-void (*reply_handler)(ClientPtr client, int len, char *data, void *userdata);
+void (*reply_handler) (ClientPtr client, int len, char *data, void *userdata);
/**
* The default screen used for the windows. Initialized by init_simple().
*/
extern ScreenRec screen;
+
/**
* Semi-initialized root window. initialized by init().
*/
extern WindowRec root;
+
/**
* Semi-initialized top-level window. initialized by init().
*/
@@ -122,16 +122,19 @@ extern WindowRec window;
* Usually not needed if you call ::init_simple.
*/
struct devices init_devices(void);
+
/**
* Init a mostly zeroed out client with default values for index and mask.
*/
ClientRec init_client(int request_len, void *request_data);
+
/**
* Init a mostly zeroed out window with the given window ID.
* Usually not needed if you call ::init_simple which sets up root and
* window.
*/
void init_window(WindowPtr window, WindowPtr parent, int id);
+
/**
* Create a very simple setup that provides the minimum values for most
* tests, including a screen, the root and client window and the default
@@ -141,13 +144,14 @@ void init_simple(void);
/* Declarations for various overrides in the test files. */
void __wrap_WriteToClient(ClientPtr client, int len, void *data);
-int __wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len, unsigned char* mask);
-int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access);
-int __real_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access);
+int __wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len,
+ unsigned char *mask);
+int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client,
+ Mask access);
+int __real_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client,
+ Mask access);
Bool __wrap_AddResource(XID id, RESTYPE type, pointer value);
int __wrap_dixLookupClient(ClientPtr *c, XID id, ClientPtr client, Mask access);
int __real_dixLookupClient(ClientPtr *c, XID id, ClientPtr client, Mask access);
-
-#endif /* PROTOCOL_COMMON_H */
-
+#endif /* PROTOCOL_COMMON_H */
diff --git a/xorg-server/test/xi2/protocol-eventconvert.c b/xorg-server/test/xi2/protocol-eventconvert.c
index bf1493c05..1188e8b25 100644
--- a/xorg-server/test/xi2/protocol-eventconvert.c
+++ b/xorg-server/test/xi2/protocol-eventconvert.c
@@ -33,8 +33,8 @@
#include "inpututils.h"
#include <X11/extensions/XI2proto.h>
-static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
- BOOL swap)
+static void
+test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent * out, BOOL swap)
{
int i;
unsigned char *ptr;
@@ -44,8 +44,7 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
int len;
uint32_t flagmask = 0;
- if (swap)
- {
+ if (swap) {
swaps(&out->sequenceNumber);
swapl(&out->length);
swaps(&out->evtype);
@@ -56,14 +55,14 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
swapl(&out->flags);
}
-
assert(out->type == GenericEvent);
- assert(out->extension == 0); /* IReqCode defaults to 0 */
+ assert(out->extension == 0); /* IReqCode defaults to 0 */
assert(out->evtype == GetXI2Type(in->type));
assert(out->time == in->time);
assert(out->detail == in->detail.button);
assert(out->deviceid == in->deviceid);
- assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask))));
+ assert(out->valuators_len >=
+ bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask))));
switch (in->type) {
case ET_RawMotion:
@@ -76,14 +75,13 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
}
assert((out->flags & ~flagmask) == 0);
- ptr = (unsigned char*)&out[1];
+ ptr = (unsigned char *) &out[1];
bits_set = 0;
- for (i = 0; out->valuators_len && i < sizeof(in->valuators.mask) * 8; i++)
- {
+ for (i = 0; out->valuators_len && i < sizeof(in->valuators.mask) * 8; i++) {
if (i >= MAX_VALUATORS)
- assert (!XIMaskIsSet(in->valuators.mask, i));
- assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
+ assert(!XIMaskIsSet(in->valuators.mask, i));
+ assert(XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
if (XIMaskIsSet(in->valuators.mask, i))
bits_set++;
}
@@ -96,21 +94,21 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
nvals = 0;
- for (i = 0; out->valuators_len && i < MAX_VALUATORS; i++)
- {
- assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
- if (XIMaskIsSet(in->valuators.mask, i))
- {
+ for (i = 0; out->valuators_len && i < MAX_VALUATORS; i++) {
+ assert(XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
+ if (XIMaskIsSet(in->valuators.mask, i)) {
FP3232 vi, vo;
- value = (FP3232*)(((unsigned char*)&out[1]) + out->valuators_len * 4);
+
+ value =
+ (FP3232 *) (((unsigned char *) &out[1]) +
+ out->valuators_len * 4);
value += nvals;
vi = double_to_fp3232(in->valuators.data[i]);
vo.integral = value->integral;
vo.frac = value->frac;
- if (swap)
- {
+ if (swap) {
swapl(&vo.integral);
swapl(&vo.frac);
}
@@ -124,8 +122,7 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
vo.integral = raw_value->integral;
vo.frac = raw_value->frac;
- if (swap)
- {
+ if (swap) {
swapl(&vo.integral);
swapl(&vo.frac);
}
@@ -138,25 +135,27 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
}
}
-static void test_XIRawEvent(RawDeviceEvent *in)
+static void
+test_XIRawEvent(RawDeviceEvent *in)
{
xXIRawEvent *out, *swapped;
int rc;
- rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
+ rc = EventToXI2((InternalEvent *) in, (xEvent **) &out);
assert(rc == Success);
test_values_XIRawEvent(in, out, FALSE);
swapped = calloc(1, sizeof(xEvent) + out->length * 4);
- XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped);
+ XI2EventSwap((xGenericEvent *) out, (xGenericEvent *) swapped);
test_values_XIRawEvent(in, swapped, TRUE);
free(out);
free(swapped);
}
-static void test_convert_XIFocusEvent(void)
+static void
+test_convert_XIFocusEvent(void)
{
xEvent *out;
DeviceEvent in;
@@ -164,29 +163,29 @@ static void test_convert_XIFocusEvent(void)
in.header = ET_Internal;
in.type = ET_Enter;
- rc = EventToXI2((InternalEvent*)&in, &out);
+ rc = EventToXI2((InternalEvent *) &in, &out);
assert(rc == Success);
assert(out == NULL);
in.header = ET_Internal;
in.type = ET_FocusIn;
- rc = EventToXI2((InternalEvent*)&in, &out);
+ rc = EventToXI2((InternalEvent *) &in, &out);
assert(rc == Success);
assert(out == NULL);
in.header = ET_Internal;
in.type = ET_FocusOut;
- rc = EventToXI2((InternalEvent*)&in, &out);
+ rc = EventToXI2((InternalEvent *) &in, &out);
assert(rc == BadImplementation);
in.header = ET_Internal;
in.type = ET_Leave;
- rc = EventToXI2((InternalEvent*)&in, &out);
+ rc = EventToXI2((InternalEvent *) &in, &out);
assert(rc == BadImplementation);
}
-
-static void test_convert_XIRawEvent(void)
+static void
+test_convert_XIRawEvent(void)
{
RawDeviceEvent in;
int i;
@@ -244,15 +243,13 @@ static void test_convert_XIRawEvent(void)
in.deviceid = ~0 & 0xFF;
test_XIRawEvent(&in);
- for (i = 0; i < MAX_VALUATORS; i++)
- {
+ for (i = 0; i < MAX_VALUATORS; i++) {
XISetMask(in.valuators.mask, i);
test_XIRawEvent(&in);
XIClearMask(in.valuators.mask, i);
}
- for (i = 0; i < MAX_VALUATORS; i++)
- {
+ for (i = 0; i < MAX_VALUATORS; i++) {
XISetMask(in.valuators.mask, i);
in.valuators.data[i] = i + (i * 0.0010);
@@ -261,15 +258,14 @@ static void test_convert_XIRawEvent(void)
XIClearMask(in.valuators.mask, i);
}
- for (i = 0; i < MAX_VALUATORS; i++)
- {
+ for (i = 0; i < MAX_VALUATORS; i++) {
XISetMask(in.valuators.mask, i);
test_XIRawEvent(&in);
}
}
-static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
- BOOL swap)
+static void
+test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent * out, BOOL swap)
{
int buttons, valuators;
int i;
@@ -301,7 +297,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
swapl(&out->flags);
}
- assert(out->extension == 0); /* IReqCode defaults to 0 */
+ assert(out->extension == 0); /* IReqCode defaults to 0 */
assert(out->evtype == GetXI2Type(in->type));
assert(out->time == in->time);
assert(out->detail == in->detail.button);
@@ -311,17 +307,17 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
assert(out->sourceid == in->sourceid);
switch (in->type) {
- case ET_ButtonPress:
- case ET_Motion:
- case ET_ButtonRelease:
- flagmask = XIPointerEmulated;
- break;
- case ET_KeyPress:
- flagmask = XIKeyRepeat;
- break;
- default:
- flagmask = 0;
- break;
+ case ET_ButtonPress:
+ case ET_Motion:
+ case ET_ButtonRelease:
+ flagmask = XIPointerEmulated;
+ break;
+ case ET_KeyPress:
+ flagmask = XIKeyRepeat;
+ break;
+ default:
+ flagmask = 0;
+ break;
}
assert((out->flags & ~flagmask) == 0);
@@ -339,27 +335,24 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
assert(out->group.locked_group == in->group.locked);
assert(out->group.effective_group == in->group.effective);
- assert(out->event_x == 0); /* set in FixUpEventFromWindow */
- assert(out->event_y == 0); /* set in FixUpEventFromWindow */
+ assert(out->event_x == 0); /* set in FixUpEventFromWindow */
+ assert(out->event_y == 0); /* set in FixUpEventFromWindow */
assert(out->root_x == FP1616(in->root_x, in->root_x_frac));
assert(out->root_y == FP1616(in->root_y, in->root_y_frac));
buttons = 0;
- for (i = 0; i < bits_to_bytes(sizeof(in->buttons)); i++)
- {
- if (XIMaskIsSet(in->buttons, i))
- {
+ for (i = 0; i < bits_to_bytes(sizeof(in->buttons)); i++) {
+ if (XIMaskIsSet(in->buttons, i)) {
assert(out->buttons_len >= bytes_to_int32(bits_to_bytes(i)));
buttons++;
}
}
- ptr = (unsigned char*)&out[1];
+ ptr = (unsigned char *) &out[1];
for (i = 0; i < sizeof(in->buttons) * 8; i++)
assert(XIMaskIsSet(in->buttons, i) == XIMaskIsSet(ptr, i));
-
valuators = 0;
for (i = 0; i < MAX_VALUATORS; i++)
if (XIMaskIsSet(in->valuators.mask, i))
@@ -368,10 +361,9 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(valuators)));
ptr += out->buttons_len * 4;
- values = (FP3232*)(ptr + out->valuators_len * 4);
+ values = (FP3232 *) (ptr + out->valuators_len * 4);
for (i = 0; i < sizeof(in->valuators.mask) * 8 ||
- i < (out->valuators_len * 4) * 8; i++)
- {
+ i < (out->valuators_len * 4) * 8; i++) {
if (i >= MAX_VALUATORS)
assert(!XIMaskIsSet(in->valuators.mask, i) && !XIMaskIsSet(ptr, i));
else if (i > sizeof(in->valuators.mask) * 8)
@@ -379,23 +371,19 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
else if (i > out->valuators_len * 4 * 8)
assert(!XIMaskIsSet(in->valuators.mask, i));
else {
- assert(XIMaskIsSet(in->valuators.mask, i) ==
- XIMaskIsSet(ptr, i));
+ assert(XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
- if (XIMaskIsSet(ptr, i))
- {
+ if (XIMaskIsSet(ptr, i)) {
FP3232 vi, vo;
vi = double_to_fp3232(in->valuators.data[i]);
vo = *values;
- if (swap)
- {
+ if (swap) {
swapl(&vo.integral);
swapl(&vo.frac);
}
-
assert(vi.integral == vo.integral);
assert(vi.frac == vo.frac);
values++;
@@ -404,25 +392,27 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
}
}
-static void test_XIDeviceEvent(DeviceEvent *in)
+static void
+test_XIDeviceEvent(DeviceEvent *in)
{
xXIDeviceEvent *out, *swapped;
int rc;
- rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
+ rc = EventToXI2((InternalEvent *) in, (xEvent **) &out);
assert(rc == Success);
test_values_XIDeviceEvent(in, out, FALSE);
swapped = calloc(1, sizeof(xEvent) + out->length * 4);
- XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped);
+ XI2EventSwap((xGenericEvent *) out, (xGenericEvent *) swapped);
test_values_XIDeviceEvent(in, swapped, TRUE);
free(out);
free(swapped);
}
-static void test_convert_XIDeviceEvent(void)
+static void
+test_convert_XIDeviceEvent(void)
{
DeviceEvent in;
int i;
@@ -432,23 +422,23 @@ static void test_convert_XIDeviceEvent(void)
in.header = ET_Internal;
in.type = ET_Motion;
in.length = sizeof(DeviceEvent);
- in.time = 0;
- in.deviceid = 1;
- in.sourceid = 2;
- in.root = 3;
- in.root_x = 4;
- in.root_x_frac = 5;
- in.root_y = 6;
- in.root_y_frac = 7;
- in.detail.button = 8;
- in.mods.base = 9;
- in.mods.latched = 10;
- in.mods.locked = 11;
- in.mods.effective = 11;
- in.group.base = 12;
- in.group.latched = 13;
- in.group.locked = 14;
- in.group.effective = 15;
+ in.time = 0;
+ in.deviceid = 1;
+ in.sourceid = 2;
+ in.root = 3;
+ in.root_x = 4;
+ in.root_x_frac = 5;
+ in.root_y = 6;
+ in.root_y_frac = 7;
+ in.detail.button = 8;
+ in.mods.base = 9;
+ in.mods.latched = 10;
+ in.mods.locked = 11;
+ in.mods.effective = 11;
+ in.group.base = 12;
+ in.group.latched = 13;
+ in.group.locked = 14;
+ in.group.effective = 15;
test_XIDeviceEvent(&in);
@@ -599,28 +589,24 @@ static void test_convert_XIDeviceEvent(void)
in.mods.effective = ~0 & 0xFF;
test_XIDeviceEvent(&in);
- for (i = 0; i < sizeof(in.buttons) * 8; i++)
- {
+ for (i = 0; i < sizeof(in.buttons) * 8; i++) {
XISetMask(in.buttons, i);
test_XIDeviceEvent(&in);
XIClearMask(in.buttons, i);
}
- for (i = 0; i < sizeof(in.buttons) * 8; i++)
- {
+ for (i = 0; i < sizeof(in.buttons) * 8; i++) {
XISetMask(in.buttons, i);
test_XIDeviceEvent(&in);
}
- for (i = 0; i < MAX_VALUATORS; i++)
- {
+ for (i = 0; i < MAX_VALUATORS; i++) {
XISetMask(in.valuators.mask, i);
test_XIDeviceEvent(&in);
XIClearMask(in.valuators.mask, i);
}
- for (i = 0; i < MAX_VALUATORS; i++)
- {
+ for (i = 0; i < MAX_VALUATORS; i++) {
XISetMask(in.valuators.mask, i);
in.valuators.data[i] = i + (i * 0.0020);
@@ -628,22 +614,20 @@ static void test_convert_XIDeviceEvent(void)
XIClearMask(in.valuators.mask, i);
}
- for (i = 0; i < MAX_VALUATORS; i++)
- {
+ for (i = 0; i < MAX_VALUATORS; i++) {
XISetMask(in.valuators.mask, i);
test_XIDeviceEvent(&in);
}
}
-static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
- xXIDeviceChangedEvent *out,
- BOOL swap)
+static void
+test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
+ xXIDeviceChangedEvent * out, BOOL swap)
{
int i, j;
unsigned char *ptr;
- if (swap)
- {
+ if (swap) {
swaps(&out->sequenceNumber);
swapl(&out->length);
swaps(&out->evtype);
@@ -654,114 +638,106 @@ static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
}
assert(out->type == GenericEvent);
- assert(out->extension == 0); /* IReqCode defaults to 0 */
+ assert(out->extension == 0); /* IReqCode defaults to 0 */
assert(out->evtype == GetXI2Type(in->type));
assert(out->time == in->time);
assert(out->deviceid == in->deviceid);
assert(out->sourceid == in->sourceid);
- ptr = (unsigned char*)&out[1];
- for (i = 0; i < out->num_classes; i++)
- {
- xXIAnyInfo* any = (xXIAnyInfo*)ptr;
+ ptr = (unsigned char *) &out[1];
+ for (i = 0; i < out->num_classes; i++) {
+ xXIAnyInfo *any = (xXIAnyInfo *) ptr;
- if (swap)
- {
+ if (swap) {
swaps(&any->length);
swaps(&any->type);
swaps(&any->sourceid);
}
- switch(any->type)
+ switch (any->type) {
+ case XIButtonClass:
{
- case XIButtonClass:
- {
- xXIButtonInfo *b = (xXIButtonInfo*)any;
- Atom *names;
-
- if (swap)
- {
- swaps(&b->num_buttons);
- }
-
- assert(b->length ==
- bytes_to_int32(sizeof(xXIButtonInfo)) +
- bytes_to_int32(bits_to_bytes(b->num_buttons)) +
- b->num_buttons);
- assert(b->num_buttons == in->buttons.num_buttons);
-
- names = (Atom*)((char*)&b[1] +
- pad_to_int32(bits_to_bytes(b->num_buttons)));
- for (j = 0; j < b->num_buttons; j++)
- {
- if (swap)
- {
- swapl(&names[j]);
- }
- assert(names[j] == in->buttons.names[j]);
- }
- }
- break;
- case XIKeyClass:
- {
- xXIKeyInfo *k = (xXIKeyInfo*)any;
- uint32_t *kc;
-
- if (swap)
- {
- swaps(&k->num_keycodes);
- }
-
- assert(k->length ==
- bytes_to_int32(sizeof(xXIKeyInfo)) +
- k->num_keycodes);
- assert(k->num_keycodes == in->keys.max_keycode -
- in->keys.min_keycode + 1);
-
- kc = (uint32_t*)&k[1];
- for (j = 0; j < k->num_keycodes; j++)
- {
- if (swap)
- {
- swapl(&kc[j]);
- }
- assert(kc[j] >= in->keys.min_keycode);
- assert(kc[j] <= in->keys.max_keycode);
- }
+ xXIButtonInfo *b = (xXIButtonInfo *) any;
+ Atom *names;
+
+ if (swap) {
+ swaps(&b->num_buttons);
+ }
+
+ assert(b->length ==
+ bytes_to_int32(sizeof(xXIButtonInfo)) +
+ bytes_to_int32(bits_to_bytes(b->num_buttons)) +
+ b->num_buttons);
+ assert(b->num_buttons == in->buttons.num_buttons);
+
+ names = (Atom *) ((char *) &b[1] +
+ pad_to_int32(bits_to_bytes(b->num_buttons)));
+ for (j = 0; j < b->num_buttons; j++) {
+ if (swap) {
+ swapl(&names[j]);
}
- break;
- case XIValuatorClass:
- {
- xXIValuatorInfo *v = (xXIValuatorInfo*)any;
- assert(v->length ==
- bytes_to_int32(sizeof(xXIValuatorInfo)));
+ assert(names[j] == in->buttons.names[j]);
+ }
+ }
+ break;
+ case XIKeyClass:
+ {
+ xXIKeyInfo *k = (xXIKeyInfo *) any;
+ uint32_t *kc;
+ if (swap) {
+ swaps(&k->num_keycodes);
+ }
+
+ assert(k->length ==
+ bytes_to_int32(sizeof(xXIKeyInfo)) + k->num_keycodes);
+ assert(k->num_keycodes == in->keys.max_keycode -
+ in->keys.min_keycode + 1);
+
+ kc = (uint32_t *) & k[1];
+ for (j = 0; j < k->num_keycodes; j++) {
+ if (swap) {
+ swapl(&kc[j]);
}
+ assert(kc[j] >= in->keys.min_keycode);
+ assert(kc[j] <= in->keys.max_keycode);
+ }
+ }
+ break;
+ case XIValuatorClass:
+ {
+ xXIValuatorInfo *v = (xXIValuatorInfo *) any;
+
+ assert(v->length == bytes_to_int32(sizeof(xXIValuatorInfo)));
+
+ }
+ break;
+ case XIScrollClass:
+ {
+ xXIScrollInfo *s = (xXIScrollInfo *) any;
+
+ assert(s->length == bytes_to_int32(sizeof(xXIScrollInfo)));
+
+ assert(s->sourceid == in->sourceid);
+ assert(s->number < in->num_valuators);
+ switch (s->type) {
+ case XIScrollTypeVertical:
+ assert(in->valuators[s->number].scroll.type ==
+ SCROLL_TYPE_VERTICAL);
break;
- case XIScrollClass:
- {
- xXIScrollInfo *s = (xXIScrollInfo*)any;
- assert(s->length ==
- bytes_to_int32(sizeof(xXIScrollInfo)));
-
- assert(s->sourceid == in->sourceid);
- assert(s->number < in->num_valuators);
- switch(s->type)
- {
- case XIScrollTypeVertical:
- assert(in->valuators[s->number].scroll.type == SCROLL_TYPE_VERTICAL);
- break;
- case XIScrollTypeHorizontal:
- assert(in->valuators[s->number].scroll.type == SCROLL_TYPE_HORIZONTAL);
- break;
- }
- if (s->flags & XIScrollFlagPreferred)
- assert(in->valuators[s->number].scroll.flags & SCROLL_FLAG_PREFERRED);
- }
- default:
- printf("Invalid class type.\n\n");
- assert(1);
+ case XIScrollTypeHorizontal:
+ assert(in->valuators[s->number].scroll.type ==
+ SCROLL_TYPE_HORIZONTAL);
break;
+ }
+ if (s->flags & XIScrollFlagPreferred)
+ assert(in->valuators[s->number].scroll.
+ flags & SCROLL_FLAG_PREFERRED);
+ }
+ default:
+ printf("Invalid class type.\n\n");
+ assert(1);
+ break;
}
ptr += any->length * 4;
@@ -769,25 +745,27 @@ static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
}
-static void test_XIDeviceChangedEvent(DeviceChangedEvent *in)
+static void
+test_XIDeviceChangedEvent(DeviceChangedEvent *in)
{
xXIDeviceChangedEvent *out, *swapped;
int rc;
- rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
+ rc = EventToXI2((InternalEvent *) in, (xEvent **) &out);
assert(rc == Success);
test_values_XIDeviceChangedEvent(in, out, FALSE);
swapped = calloc(1, sizeof(xEvent) + out->length * 4);
- XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped);
+ XI2EventSwap((xGenericEvent *) out, (xGenericEvent *) swapped);
test_values_XIDeviceChangedEvent(in, swapped, TRUE);
free(out);
free(swapped);
}
-static void test_convert_XIDeviceChangedEvent(void)
+static void
+test_convert_XIDeviceChangedEvent(void)
{
DeviceChangedEvent in;
int i;
@@ -796,12 +774,14 @@ static void test_convert_XIDeviceChangedEvent(void)
in.header = ET_Internal;
in.type = ET_DeviceChanged;
in.length = sizeof(DeviceChangedEvent);
- in.time = 0;
- in.deviceid = 1;
- in.sourceid = 2;
- in.masterid = 3;
- in.num_valuators = 4;
- in.flags = DEVCHANGE_SLAVE_SWITCH | DEVCHANGE_POINTER_EVENT | DEVCHANGE_KEYBOARD_EVENT;
+ in.time = 0;
+ in.deviceid = 1;
+ in.sourceid = 2;
+ in.masterid = 3;
+ in.num_valuators = 4;
+ in.flags =
+ DEVCHANGE_SLAVE_SWITCH | DEVCHANGE_POINTER_EVENT |
+ DEVCHANGE_KEYBOARD_EVENT;
for (i = 0; i < MAX_BUTTONS; i++)
in.buttons.names[i] = i + 10;
@@ -859,8 +839,8 @@ static void test_convert_XIDeviceChangedEvent(void)
in.keys.max_keycode = 1 << 8;
test_XIDeviceChangedEvent(&in);
- in.keys.max_keycode = 0xFFFC; /* highest range, above that the length
- field gives up */
+ in.keys.max_keycode = 0xFFFC; /* highest range, above that the length
+ field gives up */
test_XIDeviceChangedEvent(&in);
in.keys.min_keycode = 1 << 8;
@@ -880,8 +860,7 @@ static void test_convert_XIDeviceChangedEvent(void)
in.num_valuators = MAX_VALUATORS;
test_XIDeviceChangedEvent(&in);
- for (i = 0; i < MAX_VALUATORS; i++)
- {
+ for (i = 0; i < MAX_VALUATORS; i++) {
in.valuators[i].min = 0;
in.valuators[i].max = 0;
test_XIDeviceChangedEvent(&in);
@@ -917,11 +896,9 @@ static void test_convert_XIDeviceChangedEvent(void)
static void
test_values_XITouchOwnershipEvent(TouchOwnershipEvent *in,
- xXITouchOwnershipEvent *out,
- BOOL swap)
+ xXITouchOwnershipEvent * out, BOOL swap)
{
- if (swap)
- {
+ if (swap) {
swaps(&out->sequenceNumber);
swapl(&out->length);
swaps(&out->evtype);
@@ -936,7 +913,7 @@ test_values_XITouchOwnershipEvent(TouchOwnershipEvent *in,
}
assert(out->type == GenericEvent);
- assert(out->extension == 0); /* IReqCode defaults to 0 */
+ assert(out->extension == 0); /* IReqCode defaults to 0 */
assert(out->evtype == GetXI2Type(in->type));
assert(out->time == in->time);
assert(out->deviceid == in->deviceid);
@@ -951,13 +928,13 @@ test_XITouchOwnershipEvent(TouchOwnershipEvent *in)
xXITouchOwnershipEvent *out, *swapped;
int rc;
- rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
+ rc = EventToXI2((InternalEvent *) in, (xEvent **) &out);
assert(rc == Success);
test_values_XITouchOwnershipEvent(in, out, FALSE);
swapped = calloc(1, sizeof(xEvent) + out->length * 4);
- XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped);
+ XI2EventSwap((xGenericEvent *) out, (xGenericEvent *) swapped);
test_values_XITouchOwnershipEvent(in, swapped, TRUE);
free(out);
free(swapped);
@@ -970,47 +947,45 @@ test_convert_XITouchOwnershipEvent(void)
long i;
memset(&in, 0, sizeof(in));
- in.header = ET_Internal;
- in.type = ET_TouchOwnership;
- in.length = sizeof(in);
- in.time = 0;
- in.deviceid = 1;
- in.sourceid = 2;
- in.touchid = 0;
- in.reason = 0;
- in.resource = 0;
- in.flags = 0;
+ in.header = ET_Internal;
+ in.type = ET_TouchOwnership;
+ in.length = sizeof(in);
+ in.time = 0;
+ in.deviceid = 1;
+ in.sourceid = 2;
+ in.touchid = 0;
+ in.reason = 0;
+ in.resource = 0;
+ in.flags = 0;
test_XITouchOwnershipEvent(&in);
- in.flags = XIAcceptTouch;
+ in.flags = XIAcceptTouch;
test_XITouchOwnershipEvent(&in);
- in.flags = XIRejectTouch;
+ in.flags = XIRejectTouch;
test_XITouchOwnershipEvent(&in);
- for (i = 1; i <= 0xFFFF; i <<= 1)
- {
+ for (i = 1; i <= 0xFFFF; i <<= 1) {
in.deviceid = i;
test_XITouchOwnershipEvent(&in);
}
- for (i = 1; i <= 0xFFFF; i <<= 1)
- {
+ for (i = 1; i <= 0xFFFF; i <<= 1) {
in.sourceid = i;
test_XITouchOwnershipEvent(&in);
}
- for (i = 1; ; i <<= 1)
- {
+ for (i = 1;; i <<= 1) {
in.touchid = i;
test_XITouchOwnershipEvent(&in);
- if (i == ((long)1 << 31))
- break;
+ if (i == ((long) 1 << 31))
+ break;
}
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
test_convert_XIRawEvent();
test_convert_XIFocusEvent();
diff --git a/xorg-server/test/xi2/protocol-xigetclientpointer.c b/xorg-server/test/xi2/protocol-xigetclientpointer.c
index aec58908d..28eb8d32a 100644
--- a/xorg-server/test/xi2/protocol-xigetclientpointer.c
+++ b/xorg-server/test/xi2/protocol-xigetclientpointer.c
@@ -49,13 +49,14 @@ struct {
static ClientRec client_window;
static ClientRec client_request;
-int __wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
+int
+__wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client,
+ Mask access)
{
if (rid == ROOT_WINDOW_ID)
return BadWindow;
- if (rid == CLIENT_WINDOW_ID)
- {
+ if (rid == CLIENT_WINDOW_ID) {
*pClient = &client_window;
return Success;
}
@@ -63,13 +64,12 @@ int __wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask a
return __real_dixLookupClient(pClient, rid, client, access);
}
-
-static void reply_XIGetClientPointer(ClientPtr client, int len, char *data, void *userdata)
+static void
+reply_XIGetClientPointer(ClientPtr client, int len, char *data, void *userdata)
{
- xXIGetClientPointerReply *rep = (xXIGetClientPointerReply*)data;
+ xXIGetClientPointerReply *rep = (xXIGetClientPointerReply *) data;
- if (client->swapped)
- {
+ if (client->swapped) {
swapl(&rep->length);
swaps(&rep->sequenceNumber);
swaps(&rep->deviceid);
@@ -82,7 +82,9 @@ static void reply_XIGetClientPointer(ClientPtr client, int len, char *data, void
assert(rep->deviceid == test_data.dev->id);
}
-static void request_XIGetClientPointer(ClientPtr client, xXIGetClientPointerReq* req, int error)
+static void
+request_XIGetClientPointer(ClientPtr client, xXIGetClientPointerReq * req,
+ int error)
{
int rc;
@@ -105,7 +107,8 @@ static void request_XIGetClientPointer(ClientPtr client, xXIGetClientPointerReq*
}
-static void test_XIGetClientPointer(void)
+static void
+test_XIGetClientPointer(void)
{
xXIGetClientPointerReq request;
@@ -113,7 +116,6 @@ static void test_XIGetClientPointer(void)
request.win = CLIENT_WINDOW_ID;
-
reply_handler = reply_XIGetClientPointer;
client_request = init_client(request.length, &request);
@@ -149,7 +151,8 @@ static void test_XIGetClientPointer(void)
request_XIGetClientPointer(&client_request, &request, Success);
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
init_simple();
client_window = init_client(0, NULL);
diff --git a/xorg-server/test/xi2/protocol-xigetselectedevents.c b/xorg-server/test/xi2/protocol-xigetselectedevents.c
index a78fb2655..fc33aa554 100644
--- a/xorg-server/test/xi2/protocol-xigetselectedevents.c
+++ b/xorg-server/test/xi2/protocol-xigetselectedevents.c
@@ -42,20 +42,21 @@
#include <X11/extensions/XI2proto.h>
#include "inputstr.h"
#include "windowstr.h"
-#include "extinit.h" /* for XInputExtensionInit */
+#include "extinit.h" /* for XInputExtensionInit */
#include "scrnintstr.h"
#include "xiselectev.h"
#include "exevents.h"
#include "protocol-common.h"
-static void reply_XIGetSelectedEvents(ClientPtr client, int len, char *data, void *userdata);
-static void reply_XIGetSelectedEvents_data(ClientPtr client, int len, char *data, void *userdata);
-
+static void reply_XIGetSelectedEvents(ClientPtr client, int len, char *data,
+ void *userdata);
+static void reply_XIGetSelectedEvents_data(ClientPtr client, int len,
+ char *data, void *userdata);
struct {
int num_masks_expected;
- unsigned char mask[MAXDEVICES][XI2LASTEVENT]; /* intentionally bigger */
+ unsigned char mask[MAXDEVICES][XI2LASTEVENT]; /* intentionally bigger */
int mask_len;
} test_data;
@@ -64,14 +65,14 @@ struct {
* fake client window. If the requested ID is neither of those wanted,
* return whatever the real dixLookupWindow does.
*/
-int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
+int
+__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
{
- if (id == root.drawable.id)
- {
+ if (id == root.drawable.id) {
*win = &root;
return Success;
- } else if (id == window.drawable.id)
- {
+ }
+ else if (id == window.drawable.id) {
*win = &window;
return Success;
}
@@ -80,17 +81,18 @@ int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access
}
/* AddResource is called from XISetSEventMask, we don't need this */
-Bool __wrap_AddResource(XID id, RESTYPE type, pointer value)
+Bool
+__wrap_AddResource(XID id, RESTYPE type, pointer value)
{
return TRUE;
}
-static void reply_XIGetSelectedEvents(ClientPtr client, int len, char *data, void *userdata)
+static void
+reply_XIGetSelectedEvents(ClientPtr client, int len, char *data, void *userdata)
{
- xXIGetSelectedEventsReply *rep = (xXIGetSelectedEventsReply*)data;
+ xXIGetSelectedEventsReply *rep = (xXIGetSelectedEventsReply *) data;
- if (client->swapped)
- {
+ if (client->swapped) {
swapl(&rep->length);
swaps(&rep->sequenceNumber);
swaps(&rep->num_masks);
@@ -103,39 +105,41 @@ static void reply_XIGetSelectedEvents(ClientPtr client, int len, char *data, voi
reply_handler = reply_XIGetSelectedEvents_data;
}
-static void reply_XIGetSelectedEvents_data(ClientPtr client, int len, char *data, void *userdata)
+static void
+reply_XIGetSelectedEvents_data(ClientPtr client, int len, char *data,
+ void *userdata)
{
int i;
xXIEventMask *mask;
unsigned char *bitmask;
- mask = (xXIEventMask*)data;
- for (i = 0; i < test_data.num_masks_expected; i++)
- {
- if (client->swapped)
- {
+ mask = (xXIEventMask *) data;
+ for (i = 0; i < test_data.num_masks_expected; i++) {
+ if (client->swapped) {
swaps(&mask->deviceid);
swaps(&mask->mask_len);
}
assert(mask->deviceid < 6);
- assert(mask->mask_len <= (((XI2LASTEVENT + 8)/8) + 3)/4) ;
+ assert(mask->mask_len <= (((XI2LASTEVENT + 8) / 8) + 3) / 4);
- bitmask = (unsigned char*)&mask[1];
+ bitmask = (unsigned char *) &mask[1];
assert(memcmp(bitmask,
- test_data.mask[mask->deviceid],
- mask->mask_len * 4) == 0);
+ test_data.mask[mask->deviceid], mask->mask_len * 4) == 0);
- mask = (xXIEventMask*)((char*)mask + mask->mask_len * 4 + sizeof(xXIEventMask));
+ mask =
+ (xXIEventMask *) ((char *) mask + mask->mask_len * 4 +
+ sizeof(xXIEventMask));
}
-
}
-static void request_XIGetSelectedEvents(xXIGetSelectedEventsReq* req, int error)
+static void
+request_XIGetSelectedEvents(xXIGetSelectedEventsReq * req, int error)
{
int rc;
ClientRec client;
+
client = init_client(req->length, req);
reply_handler = reply_XIGetSelectedEvents;
@@ -151,7 +155,8 @@ static void request_XIGetSelectedEvents(xXIGetSelectedEventsReq* req, int error)
assert(rc == error);
}
-static void test_XIGetSelectedEvents(void)
+static void
+test_XIGetSelectedEvents(void)
{
int i, j;
xXIGetSelectedEventsReq request;
@@ -174,42 +179,37 @@ static void test_XIGetSelectedEvents(void)
request.win = CLIENT_WINDOW_ID;
request_XIGetSelectedEvents(&request, Success);
- memset(test_data.mask, 0,
- sizeof(test_data.mask));
+ memset(test_data.mask, 0, sizeof(test_data.mask));
printf("Testing for valid masks\n");
- memset(&dev, 0, sizeof(dev)); /* dev->id is enough for XISetEventMask */
+ memset(&dev, 0, sizeof(dev)); /* dev->id is enough for XISetEventMask */
request.win = ROOT_WINDOW_ID;
/* devices 6 - MAXDEVICES don't exist, they mustn't be included in the
* reply even if a mask is set */
- for (j = 0; j < MAXDEVICES; j++)
- {
+ for (j = 0; j < MAXDEVICES; j++) {
test_data.num_masks_expected = min(j + 1, devices.num_devices + 2);
dev.id = j;
mask = test_data.mask[j];
/* bits one-by-one */
- for (i = 0; i < XI2LASTEVENT; i++)
- {
+ for (i = 0; i < XI2LASTEVENT; i++) {
SetBit(mask, i);
- XISetEventMask(&dev, &root, &client, (i + 8)/8, mask);
+ XISetEventMask(&dev, &root, &client, (i + 8) / 8, mask);
request_XIGetSelectedEvents(&request, Success);
ClearBit(mask, i);
}
/* all valid mask bits */
- for (i = 0; i < XI2LASTEVENT; i++)
- {
+ for (i = 0; i < XI2LASTEVENT; i++) {
SetBit(mask, i);
- XISetEventMask(&dev, &root, &client, (i + 8)/8, mask);
+ XISetEventMask(&dev, &root, &client, (i + 8) / 8, mask);
request_XIGetSelectedEvents(&request, Success);
}
}
printf("Testing removing all masks\n");
/* Unset all masks one-by-one */
- for (j = MAXDEVICES - 1; j >= 0; j--)
- {
+ for (j = MAXDEVICES - 1; j >= 0; j--) {
if (j < devices.num_devices + 2)
test_data.num_masks_expected--;
@@ -223,7 +223,8 @@ static void test_XIGetSelectedEvents(void)
}
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
init_simple();
@@ -231,4 +232,3 @@ int main(int argc, char** argv)
return 0;
}
-
diff --git a/xorg-server/test/xi2/protocol-xipassivegrabdevice.c b/xorg-server/test/xi2/protocol-xipassivegrabdevice.c
index b405556be..53c65bda6 100644
--- a/xorg-server/test/xi2/protocol-xipassivegrabdevice.c
+++ b/xorg-server/test/xi2/protocol-xipassivegrabdevice.c
@@ -41,26 +41,29 @@
#include "protocol-common.h"
static ClientRec client_request;
+
#define N_MODS 7
-static uint32_t modifiers[N_MODS] = {1, 2, 3, 4, 5, 6, 7};
+static uint32_t modifiers[N_MODS] = { 1, 2, 3, 4, 5, 6, 7 };
struct test_data {
int num_modifiers;
} testdata;
-int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
- int button, GrabParameters *param, enum InputLevel grabtype,
+int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev,
+ DeviceIntPtr modifier_device, int button,
+ GrabParameters *param, enum InputLevel grabtype,
GrabMask *mask);
-static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data, void *userdata);
+static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len,
+ char *data, void *userdata);
-int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
+int
+__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
{
- if (id == root.drawable.id)
- {
+ if (id == root.drawable.id) {
*win = &root;
return Success;
- } else if (id == window.drawable.id)
- {
+ }
+ else if (id == window.drawable.id) {
*win = &window;
return Success;
}
@@ -68,9 +71,11 @@ int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access
return __real_dixLookupWindow(win, id, client, access);
}
-int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
- int button, GrabParameters *param, enum InputLevel grabtype,
- GrabMask *mask)
+int
+__wrap_GrabButton(ClientPtr client, DeviceIntPtr dev,
+ DeviceIntPtr modifier_device, int button,
+ GrabParameters *param, enum InputLevel grabtype,
+ GrabMask *mask)
{
/* Fail every odd modifier */
if (param->modifiers % 2)
@@ -79,12 +84,12 @@ int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_
return Success;
}
-static void reply_XIPassiveGrabDevice(ClientPtr client, int len, char *data, void *userdata)
+static void
+reply_XIPassiveGrabDevice(ClientPtr client, int len, char *data, void *userdata)
{
- xXIPassiveGrabDeviceReply *rep = (xXIPassiveGrabDeviceReply*)data;
+ xXIPassiveGrabDeviceReply *rep = (xXIPassiveGrabDeviceReply *) data;
- if (client->swapped)
- {
+ if (client->swapped) {
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_modifiers);
@@ -100,14 +105,15 @@ static void reply_XIPassiveGrabDevice(ClientPtr client, int len, char *data, voi
reply_handler = reply_XIPassiveGrabDevice_data;
}
-static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data, void *userdata)
+static void
+reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data,
+ void *userdata)
{
int i;
- xXIGrabModifierInfo *mods = (xXIGrabModifierInfo*)data;
+ xXIGrabModifierInfo *mods = (xXIGrabModifierInfo *) data;
- for (i = 0; i < testdata.num_modifiers; i++, mods++)
- {
+ for (i = 0; i < testdata.num_modifiers; i++, mods++) {
if (client->swapped)
swapl(&mods->modifiers);
@@ -115,7 +121,7 @@ static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data
* above */
assert(mods->modifiers > 0);
assert(mods->modifiers <= 7);
- assert(mods->modifiers % 2 == 1); /* because we fail odd ones */
+ assert(mods->modifiers % 2 == 1); /* because we fail odd ones */
assert(mods->status != Success);
assert(mods->pad0 == 0);
assert(mods->pad1 == 0);
@@ -124,7 +130,9 @@ static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data
reply_handler = reply_XIPassiveGrabDevice;
}
-static void request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq* req, int error, int errval)
+static void
+request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req,
+ int error, int errval)
{
int rc;
int modifiers;
@@ -146,9 +154,9 @@ static void request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceRe
swaps(&req->num_modifiers);
swaps(&req->mask_len);
- while(modifiers--)
- {
- CARD32 *mod = ((CARD32*)(req + 1)) + modifiers;
+ while (modifiers--) {
+ CARD32 *mod = ((CARD32 *) (req + 1)) + modifiers;
+
swapl(mod);
}
@@ -159,11 +167,12 @@ static void request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceRe
assert(client_request.errorValue == errval);
}
-static unsigned char *data[4096]; /* the request buffer */
-static void test_XIPassiveGrabDevice(void)
+static unsigned char *data[4096]; /* the request buffer */
+static void
+test_XIPassiveGrabDevice(void)
{
int i;
- xXIPassiveGrabDeviceReq *request = (xXIPassiveGrabDeviceReq*)data;
+ xXIPassiveGrabDeviceReq *request = (xXIPassiveGrabDeviceReq *) data;
unsigned char *mask;
request_init(request, XIPassiveGrabDevice);
@@ -175,34 +184,38 @@ static void test_XIPassiveGrabDevice(void)
printf("Testing invalid device\n");
request->deviceid = 12;
- request_XIPassiveGrabDevice(&client_request, request, BadDevice, request->deviceid);
+ request_XIPassiveGrabDevice(&client_request, request, BadDevice,
+ request->deviceid);
request->deviceid = XIAllMasterDevices;
printf("Testing invalid grab types\n");
- for (i = XIGrabtypeTouchBegin + 1; i < 0xFF; i++)
- {
+ for (i = XIGrabtypeTouchBegin + 1; i < 0xFF; i++) {
request->grab_type = i;
- request_XIPassiveGrabDevice(&client_request, request, BadValue, request->grab_type);
+ request_XIPassiveGrabDevice(&client_request, request, BadValue,
+ request->grab_type);
}
printf("Testing invalid grab type + detail combinations\n");
request->grab_type = XIGrabtypeEnter;
request->detail = 1;
- request_XIPassiveGrabDevice(&client_request, request, BadValue, request->detail);
+ request_XIPassiveGrabDevice(&client_request, request, BadValue,
+ request->detail);
request->grab_type = XIGrabtypeFocusIn;
- request_XIPassiveGrabDevice(&client_request, request, BadValue, request->detail);
+ request_XIPassiveGrabDevice(&client_request, request, BadValue,
+ request->detail);
request->detail = 0;
printf("Testing invalid masks\n");
- mask = (unsigned char*)&request[1];
+ mask = (unsigned char *) &request[1];
request->mask_len = bytes_to_int32(XI2LASTEVENT + 1);
request->length += request->mask_len;
SetBit(mask, XI2LASTEVENT + 1);
- request_XIPassiveGrabDevice(&client_request, request, BadValue, XI2LASTEVENT + 1);
+ request_XIPassiveGrabDevice(&client_request, request, BadValue,
+ XI2LASTEVENT + 1);
ClearBit(mask, XI2LASTEVENT + 1);
@@ -217,11 +230,13 @@ static void test_XIPassiveGrabDevice(void)
/* some modifiers */
request->num_modifiers = N_MODS;
request->length += N_MODS;
- memcpy((uint32_t*)(request + 1) + request->mask_len, modifiers, sizeof(modifiers));
+ memcpy((uint32_t *) (request + 1) + request->mask_len, modifiers,
+ sizeof(modifiers));
request_XIPassiveGrabDevice(&client_request, request, Success, 0);
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
init_simple();
diff --git a/xorg-server/test/xi2/protocol-xiquerydevice.c b/xorg-server/test/xi2/protocol-xiquerydevice.c
index 569aea93a..5e59e8084 100644
--- a/xorg-server/test/xi2/protocol-xiquerydevice.c
+++ b/xorg-server/test/xi2/protocol-xiquerydevice.c
@@ -53,17 +53,19 @@ struct test_data {
int num_devices_in_reply;
};
-static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *userdata);
-static void reply_XIQueryDevice(ClientPtr client, int len, char* data, void *userdata);
+static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data,
+ void *userdata);
+static void reply_XIQueryDevice(ClientPtr client, int len, char *data,
+ void *userdata);
/* reply handling for the first bytes that constitute the reply */
-static void reply_XIQueryDevice(ClientPtr client, int len, char* data, void *userdata)
+static void
+reply_XIQueryDevice(ClientPtr client, int len, char *data, void *userdata)
{
- xXIQueryDeviceReply *rep = (xXIQueryDeviceReply*)data;
- struct test_data *querydata = (struct test_data*)userdata;
+ xXIQueryDeviceReply *rep = (xXIQueryDeviceReply *) data;
+ struct test_data *querydata = (struct test_data *) userdata;
- if (client->swapped)
- {
+ if (client->swapped) {
swapl(&rep->length);
swaps(&rep->sequenceNumber);
swaps(&rep->num_devices);
@@ -83,19 +85,18 @@ static void reply_XIQueryDevice(ClientPtr client, int len, char* data, void *use
}
/* reply handling for the trailing bytes that constitute the device info */
-static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *userdata)
+static void
+reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *userdata)
{
int i, j;
- struct test_data *querydata = (struct test_data*)userdata;
+ struct test_data *querydata = (struct test_data *) userdata;
DeviceIntPtr dev;
- xXIDeviceInfo *info = (xXIDeviceInfo*)data;
+ xXIDeviceInfo *info = (xXIDeviceInfo *) data;
xXIAnyInfo *any;
- for (i = 0; i < querydata->num_devices_in_reply; i++)
- {
- if (client->swapped)
- {
+ for (i = 0; i < querydata->num_devices_in_reply; i++) {
+ if (client->swapped) {
swaps(&info->deviceid);
swaps(&info->attachment);
swaps(&info->use);
@@ -106,179 +107,173 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
if (querydata->which_device > XIAllMasterDevices)
assert(info->deviceid == querydata->which_device);
- assert(info->deviceid >= 2); /* 0 and 1 is reserved */
-
-
- switch(info->deviceid)
- {
- case 2: /* VCP */
- dev = devices.vcp;
- assert(info->use == XIMasterPointer);
- assert(info->attachment == devices.vck->id);
- assert(info->num_classes == 3); /* 2 axes + button */
- break;
- case 3: /* VCK */
- dev = devices.vck;
- assert(info->use == XIMasterKeyboard);
- assert(info->attachment == devices.vcp->id);
- assert(info->num_classes == 1);
- break;
- case 4: /* mouse */
- dev = devices.mouse;
- assert(info->use == XISlavePointer);
- assert(info->attachment == devices.vcp->id);
- assert(info->num_classes == 7); /* 4 axes + button + 2 scroll*/
- break;
- case 5: /* keyboard */
- dev = devices.kbd;
- assert(info->use == XISlaveKeyboard);
- assert(info->attachment == devices.vck->id);
- assert(info->num_classes == 1);
- break;
-
- default:
- /* We shouldn't get here */
- assert(0);
- break;
+ assert(info->deviceid >= 2); /* 0 and 1 is reserved */
+
+ switch (info->deviceid) {
+ case 2: /* VCP */
+ dev = devices.vcp;
+ assert(info->use == XIMasterPointer);
+ assert(info->attachment == devices.vck->id);
+ assert(info->num_classes == 3); /* 2 axes + button */
+ break;
+ case 3: /* VCK */
+ dev = devices.vck;
+ assert(info->use == XIMasterKeyboard);
+ assert(info->attachment == devices.vcp->id);
+ assert(info->num_classes == 1);
+ break;
+ case 4: /* mouse */
+ dev = devices.mouse;
+ assert(info->use == XISlavePointer);
+ assert(info->attachment == devices.vcp->id);
+ assert(info->num_classes == 7); /* 4 axes + button + 2 scroll */
+ break;
+ case 5: /* keyboard */
+ dev = devices.kbd;
+ assert(info->use == XISlaveKeyboard);
+ assert(info->attachment == devices.vck->id);
+ assert(info->num_classes == 1);
+ break;
+
+ default:
+ /* We shouldn't get here */
+ assert(0);
+ break;
}
assert(info->enabled == dev->enabled);
assert(info->name_len == strlen(dev->name));
- assert(strncmp((char*)&info[1], dev->name, info->name_len) == 0);
+ assert(strncmp((char *) &info[1], dev->name, info->name_len) == 0);
- any = (xXIAnyInfo*)((char*)&info[1] + ((info->name_len + 3)/4) * 4);
- for (j = 0; j < info->num_classes; j++)
- {
- if (client->swapped)
- {
+ any =
+ (xXIAnyInfo *) ((char *) &info[1] + ((info->name_len + 3) / 4) * 4);
+ for (j = 0; j < info->num_classes; j++) {
+ if (client->swapped) {
swaps(&any->type);
swaps(&any->length);
swaps(&any->sourceid);
}
- switch(info->deviceid)
+ switch (info->deviceid) {
+ case 3: /* VCK and kbd have the same properties */
+ case 5:
+ {
+ int k;
+ xXIKeyInfo *ki = (xXIKeyInfo *) any;
+ XkbDescPtr xkb = devices.vck->key->xkbInfo->desc;
+ uint32_t *kc;
+
+ if (client->swapped)
+ swaps(&ki->num_keycodes);
+
+ assert(any->type == XIKeyClass);
+ assert(ki->num_keycodes ==
+ (xkb->max_key_code - xkb->min_key_code + 1));
+ assert(any->length == (2 + ki->num_keycodes));
+
+ kc = (uint32_t *) & ki[1];
+ for (k = 0; k < ki->num_keycodes; k++, kc++) {
+ if (client->swapped)
+ swapl(kc);
+
+ assert(*kc >= xkb->min_key_code);
+ assert(*kc <= xkb->max_key_code);
+ }
+ break;
+ }
+ case 4:
{
- case 3: /* VCK and kbd have the same properties */
- case 5:
- {
- int k;
- xXIKeyInfo *ki = (xXIKeyInfo*)any;
- XkbDescPtr xkb = devices.vck->key->xkbInfo->desc;
- uint32_t *kc;
-
- if (client->swapped)
- swaps(&ki->num_keycodes);
-
- assert(any->type == XIKeyClass);
- assert(ki->num_keycodes == (xkb->max_key_code - xkb->min_key_code + 1));
- assert(any->length == (2 + ki->num_keycodes));
-
- kc = (uint32_t*)&ki[1];
- for (k = 0; k < ki->num_keycodes; k++, kc++)
- {
- if (client->swapped)
- swapl(kc);
-
- assert(*kc >= xkb->min_key_code);
- assert(*kc <= xkb->max_key_code);
- }
- break;
+ assert(any->type == XIButtonClass ||
+ any->type == XIValuatorClass ||
+ any->type == XIScrollClass);
+
+ if (any->type == XIScrollClass) {
+ xXIScrollInfo *si = (xXIScrollInfo *) any;
+
+ if (client->swapped) {
+ swaps(&si->number);
+ swaps(&si->scroll_type);
+ swapl(&si->increment.integral);
+ swapl(&si->increment.frac);
}
- case 4:
- {
- assert(any->type == XIButtonClass ||
- any->type == XIValuatorClass ||
- any->type == XIScrollClass);
-
- if (any->type == XIScrollClass)
- {
- xXIScrollInfo *si = (xXIScrollInfo*)any;
-
- if (client->swapped)
- {
- swaps(&si->number);
- swaps(&si->scroll_type);
- swapl(&si->increment.integral);
- swapl(&si->increment.frac);
- }
- assert(si->length == 6);
- assert(si->number == 2 || si->number == 3);
- if (si->number == 2) {
- assert(si->scroll_type == XIScrollTypeVertical);
- assert(!si->flags);
- }
- if (si->number == 3) {
- assert(si->scroll_type == XIScrollTypeHorizontal);
- assert(si->flags & XIScrollFlagPreferred);
- assert(!(si->flags & ~XIScrollFlagPreferred));
- }
-
- assert(si->increment.integral == si->number);
- /* protocol-common.c sets up increments of 2.4 and 3.5 */
- assert(si->increment.frac > 0.3 * (1ULL << 32));
- assert(si->increment.frac < 0.6 * (1ULL << 32));
- }
-
+ assert(si->length == 6);
+ assert(si->number == 2 || si->number == 3);
+ if (si->number == 2) {
+ assert(si->scroll_type == XIScrollTypeVertical);
+ assert(!si->flags);
}
- /* fall through */
- case 2: /* VCP and mouse have the same properties except for scroll */
- {
- if (info->deviceid == 2 ) /* VCP */
- assert(any->type == XIButtonClass ||
- any->type == XIValuatorClass);
-
- if (any->type == XIButtonClass)
- {
- int len;
- xXIButtonInfo *bi = (xXIButtonInfo*)any;
-
- if (client->swapped)
- swaps(&bi->num_buttons);
-
- assert(bi->num_buttons == devices.vcp->button->numButtons);
-
- len = 2 + bi->num_buttons + bytes_to_int32(bits_to_bytes(bi->num_buttons));
- assert(bi->length == len);
- } else if (any->type == XIValuatorClass)
- {
- xXIValuatorInfo *vi = (xXIValuatorInfo*)any;
-
- if (client->swapped)
- {
- swaps(&vi->number);
- swapl(&vi->label);
- swapl(&vi->min.integral);
- swapl(&vi->min.frac);
- swapl(&vi->max.integral);
- swapl(&vi->max.frac);
- swapl(&vi->resolution);
- }
-
- assert(vi->length == 11);
- assert(vi->number >= 0 && vi->number < 4);
- if (info->deviceid == 2) /* VCP */
- assert(vi->number < 2);
-
- assert(vi->mode == XIModeRelative);
- /* device was set up as relative, so standard
- * values here. */
- assert(vi->min.integral == -1);
- assert(vi->min.frac == 0);
- assert(vi->max.integral == -1);
- assert(vi->max.frac == 0);
- assert(vi->resolution == 0);
- }
+ if (si->number == 3) {
+ assert(si->scroll_type == XIScrollTypeHorizontal);
+ assert(si->flags & XIScrollFlagPreferred);
+ assert(!(si->flags & ~XIScrollFlagPreferred));
}
- break;
+
+ assert(si->increment.integral == si->number);
+ /* protocol-common.c sets up increments of 2.4 and 3.5 */
+ assert(si->increment.frac > 0.3 * (1ULL << 32));
+ assert(si->increment.frac < 0.6 * (1ULL << 32));
+ }
+
}
- any = (xXIAnyInfo*)(((char*)any) + any->length * 4);
+ /* fall through */
+ case 2: /* VCP and mouse have the same properties except for scroll */
+ {
+ if (info->deviceid == 2) /* VCP */
+ assert(any->type == XIButtonClass ||
+ any->type == XIValuatorClass);
+
+ if (any->type == XIButtonClass) {
+ int len;
+ xXIButtonInfo *bi = (xXIButtonInfo *) any;
+
+ if (client->swapped)
+ swaps(&bi->num_buttons);
+
+ assert(bi->num_buttons == devices.vcp->button->numButtons);
+
+ len =
+ 2 + bi->num_buttons +
+ bytes_to_int32(bits_to_bytes(bi->num_buttons));
+ assert(bi->length == len);
+ }
+ else if (any->type == XIValuatorClass) {
+ xXIValuatorInfo *vi = (xXIValuatorInfo *) any;
+
+ if (client->swapped) {
+ swaps(&vi->number);
+ swapl(&vi->label);
+ swapl(&vi->min.integral);
+ swapl(&vi->min.frac);
+ swapl(&vi->max.integral);
+ swapl(&vi->max.frac);
+ swapl(&vi->resolution);
+ }
+
+ assert(vi->length == 11);
+ assert(vi->number >= 0 && vi->number < 4);
+ if (info->deviceid == 2) /* VCP */
+ assert(vi->number < 2);
+
+ assert(vi->mode == XIModeRelative);
+ /* device was set up as relative, so standard
+ * values here. */
+ assert(vi->min.integral == -1);
+ assert(vi->min.frac == 0);
+ assert(vi->max.integral == -1);
+ assert(vi->max.frac == 0);
+ assert(vi->resolution == 0);
+ }
+ }
+ break;
+ }
+ any = (xXIAnyInfo *) (((char *) any) + any->length * 4);
}
- info = (xXIDeviceInfo*)any;
+ info = (xXIDeviceInfo *) any;
}
}
-static void request_XIQueryDevice(struct test_data *querydata,
- int deviceid, int error)
+static void
+request_XIQueryDevice(struct test_data *querydata, int deviceid, int error)
{
int rc;
ClientRec client;
@@ -309,7 +304,8 @@ static void request_XIQueryDevice(struct test_data *querydata,
assert(client.errorValue == deviceid);
}
-static void test_XIQueryDevice(void)
+static void
+test_XIQueryDevice(void)
{
int i;
xXIQueryDeviceReq request;
@@ -332,12 +328,12 @@ static void test_XIQueryDevice(void)
for (i = 6; i <= 0xFFFF; i++)
request_XIQueryDevice(&data, i, BadDevice);
-
reply_handler = NULL;
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
init_simple();
@@ -345,4 +341,3 @@ int main(int argc, char** argv)
return 0;
}
-
diff --git a/xorg-server/test/xi2/protocol-xiquerypointer.c b/xorg-server/test/xi2/protocol-xiquerypointer.c
index 65346ab5d..4756a6b2e 100644
--- a/xorg-server/test/xi2/protocol-xiquerypointer.c
+++ b/xorg-server/test/xi2/protocol-xiquerypointer.c
@@ -49,20 +49,19 @@ static struct {
WindowPtr win;
} test_data;
-
/* dixLookupWindow requires a lot of setup not necessary for this test.
* Simple wrapper that returns either one of the fake root window or the
* fake client window. If the requested ID is neither of those wanted,
* return whatever the real dixLookupWindow does.
*/
-int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
+int
+__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
{
- if (id == root.drawable.id)
- {
+ if (id == root.drawable.id) {
*win = &root;
return Success;
- } else if (id == window.drawable.id)
- {
+ }
+ else if (id == window.drawable.id) {
*win = &window;
return Success;
}
@@ -70,17 +69,16 @@ int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access
return __real_dixLookupWindow(win, id, client, access);
}
-static void reply_XIQueryPointer(ClientPtr client, int len, char *data,
- void *userdata)
+static void
+reply_XIQueryPointer(ClientPtr client, int len, char *data, void *userdata)
{
- xXIQueryPointerReply *rep = (xXIQueryPointerReply*)data;
+ xXIQueryPointerReply *rep = (xXIQueryPointerReply *) data;
SpritePtr sprite;
if (!rep->repType)
return;
- if (client->swapped)
- {
+ if (client->swapped) {
swapl(&rep->length);
swaps(&rep->sequenceNumber);
swapl(&rep->root);
@@ -101,13 +99,12 @@ static void reply_XIQueryPointer(ClientPtr client, int len, char *data,
assert((rep->root_x >> 16) == sprite->hot.x);
assert((rep->root_y >> 16) == sprite->hot.y);
- if (test_data.win == &root)
- {
+ if (test_data.win == &root) {
assert(rep->root_x == rep->win_x);
assert(rep->root_y == rep->win_y);
assert(rep->child == window.drawable.id);
- } else
- {
+ }
+ else {
int x, y;
x = sprite->hot.x - window.drawable.x;
@@ -118,18 +115,19 @@ static void reply_XIQueryPointer(ClientPtr client, int len, char *data,
assert(rep->child == None);
}
-
assert(rep->same_screen == xTrue);
reply_handler = reply_XIQueryPointer_data;
}
-static void reply_XIQueryPointer_data(ClientPtr client, int len, char *data, void *userdata)
+static void
+reply_XIQueryPointer_data(ClientPtr client, int len, char *data, void *userdata)
{
reply_handler = reply_XIQueryPointer;
}
-static void request_XIQueryPointer(ClientPtr client, xXIQueryPointerReq* req, int error)
+static void
+request_XIQueryPointer(ClientPtr client, xXIQueryPointerReq * req, int error)
{
int rc;
@@ -149,7 +147,8 @@ static void request_XIQueryPointer(ClientPtr client, xXIQueryPointerReq* req, in
assert(client_request.errorValue == req->deviceid);
}
-static void test_XIQueryPointer(void)
+static void
+test_XIQueryPointer(void)
{
int i;
xXIQueryPointerReq request;
@@ -182,12 +181,11 @@ static void test_XIQueryPointer(void)
request_XIQueryPointer(&client_request, &request, BadDevice);
test_data.dev = devices.mouse;
- devices.mouse->master = NULL; /* Float, kind-of */
+ devices.mouse->master = NULL; /* Float, kind-of */
request.deviceid = devices.mouse->id;
request_XIQueryPointer(&client_request, &request, Success);
- for (i = devices.kbd->id + 1; i <= 0xFFFF; i++)
- {
+ for (i = devices.kbd->id + 1; i <= 0xFFFF; i++) {
request.deviceid = i;
request_XIQueryPointer(&client_request, &request, BadDevice);
}
@@ -204,7 +202,8 @@ static void test_XIQueryPointer(void)
request_XIQueryPointer(&client_request, &request, Success);
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
init_simple();
diff --git a/xorg-server/test/xi2/protocol-xiqueryversion.c b/xorg-server/test/xi2/protocol-xiqueryversion.c
index d60d16b9d..3d50fa888 100644
--- a/xorg-server/test/xi2/protocol-xiqueryversion.c
+++ b/xorg-server/test/xi2/protocol-xiqueryversion.c
@@ -41,7 +41,7 @@
#include <X11/Xproto.h>
#include <X11/extensions/XI2proto.h>
#include "inputstr.h"
-#include "extinit.h" /* for XInputExtensionInit */
+#include "extinit.h" /* for XInputExtensionInit */
#include "scrnintstr.h"
#include "xiqueryversion.h"
@@ -56,14 +56,14 @@ struct test_data {
int minor_server;
};
-static void reply_XIQueryVersion(ClientPtr client, int len, char* data, void *userdata)
+static void
+reply_XIQueryVersion(ClientPtr client, int len, char *data, void *userdata)
{
- xXIQueryVersionReply *rep = (xXIQueryVersionReply*)data;
- struct test_data *versions = (struct test_data*)userdata;
+ xXIQueryVersionReply *rep = (xXIQueryVersionReply *) data;
+ struct test_data *versions = (struct test_data *) userdata;
unsigned int sver, cver, ver;
- if (client->swapped)
- {
+ if (client->swapped) {
swapl(&rep->length);
swaps(&rep->sequenceNumber);
swaps(&rep->major_version);
@@ -88,7 +88,8 @@ static void reply_XIQueryVersion(ClientPtr client, int len, char* data, void *us
*
* Test is run normal, then for a swapped client.
*/
-static void request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int error)
+static void
+request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int error)
{
int rc;
struct test_data versions;
@@ -97,7 +98,7 @@ static void request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int e
request_init(&request, XIQueryVersion);
client = init_client(request.length, &request);
- userdata = (void*)&versions;
+ userdata = (void *) &versions;
/* Change the server to support smaj.smin */
XIVersion.major_version = smaj;
@@ -126,7 +127,8 @@ static void request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int e
/* Client version less than 2.0 must return BadValue, all other combinations
* Success */
-static void test_XIQueryVersion(void)
+static void
+test_XIQueryVersion(void)
{
reply_handler = reply_XIQueryVersion;
@@ -159,9 +161,9 @@ static void test_XIQueryVersion(void)
for (smaj = 2; smaj <= 0xFFFF; smaj++)
for (smin = 0; smin <= 0xFFFF; smin++)
for (cmin = 0; cmin <= 0xFFFF; cmin++)
- for (cmaj = 0; cmaj <= 0xFFFF; cmaj++)
- {
+ for (cmaj = 0; cmaj <= 0xFFFF; cmaj++) {
int error = (cmaj < 2) ? BadValue : Success;
+
request_XIQueryVersion(smaj, smin, cmaj, cmin, error);
}
@@ -170,7 +172,8 @@ static void test_XIQueryVersion(void)
reply_handler = NULL;
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
init_simple();
diff --git a/xorg-server/test/xi2/protocol-xiselectevents.c b/xorg-server/test/xi2/protocol-xiselectevents.c
index 0390858b1..4daba8775 100644
--- a/xorg-server/test/xi2/protocol-xiselectevents.c
+++ b/xorg-server/test/xi2/protocol-xiselectevents.c
@@ -53,15 +53,17 @@
#include <X11/extensions/XI2proto.h>
#include "inputstr.h"
#include "windowstr.h"
-#include "extinit.h" /* for XInputExtensionInit */
+#include "extinit.h" /* for XInputExtensionInit */
#include "scrnintstr.h"
#include "xiselectev.h"
#include "protocol-common.h"
-static unsigned char *data[4096 * 20]; /* the request data buffer */
+static unsigned char *data[4096 * 20]; /* the request data buffer */
-int __wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len, unsigned char* mask)
+int
+__wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len,
+ unsigned char *mask)
{
return Success;
}
@@ -71,14 +73,14 @@ int __wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len, unsigned cha
* fake client window. If the requested ID is neither of those wanted,
* return whatever the real dixLookupWindow does.
*/
-int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
+int
+__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
{
- if (id == root.drawable.id)
- {
+ if (id == root.drawable.id) {
*win = &root;
return Success;
- } else if (id == window.drawable.id)
- {
+ }
+ else if (id == window.drawable.id) {
*win = &window;
return Success;
}
@@ -86,20 +88,19 @@ int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access
return __real_dixLookupWindow(win, id, client, access);
}
-
-static void request_XISelectEvent(xXISelectEventsReq *req, int error)
+static void
+request_XISelectEvent(xXISelectEventsReq * req, int error)
{
int i;
int rc;
ClientRec client;
xXIEventMask *mask, *next;
- req->length = (sz_xXISelectEventsReq/4);
- mask = (xXIEventMask*)&req[1];
- for (i = 0; i < req->num_masks; i++)
- {
- req->length += sizeof(xXIEventMask)/4 + mask->mask_len;
- mask = (xXIEventMask*)((char*)&mask[1] + mask->mask_len * 4);
+ req->length = (sz_xXISelectEventsReq / 4);
+ mask = (xXIEventMask *) & req[1];
+ for (i = 0; i < req->num_masks; i++) {
+ req->length += sizeof(xXIEventMask) / 4 + mask->mask_len;
+ mask = (xXIEventMask *) ((char *) &mask[1] + mask->mask_len * 4);
}
client = init_client(req->length, req);
@@ -109,10 +110,9 @@ static void request_XISelectEvent(xXISelectEventsReq *req, int error)
client.swapped = TRUE;
- mask = (xXIEventMask*)&req[1];
- for (i = 0; i < req->num_masks; i++)
- {
- next = (xXIEventMask*)((char*)&mask[1] + mask->mask_len * 4);
+ mask = (xXIEventMask *) & req[1];
+ for (i = 0; i < req->num_masks; i++) {
+ next = (xXIEventMask *) ((char *) &mask[1] + mask->mask_len * 4);
swaps(&mask->deviceid);
swaps(&mask->mask_len);
mask = next;
@@ -125,41 +125,41 @@ static void request_XISelectEvent(xXISelectEventsReq *req, int error)
assert(rc == error);
}
-static void _set_bit(unsigned char *bits, int bit)
+static void
+_set_bit(unsigned char *bits, int bit)
{
SetBit(bits, bit);
- if (bit >= XI_TouchBegin && bit <= XI_TouchOwnership)
- {
+ if (bit >= XI_TouchBegin && bit <= XI_TouchOwnership) {
SetBit(bits, XI_TouchBegin);
SetBit(bits, XI_TouchUpdate);
SetBit(bits, XI_TouchEnd);
}
}
-static void _clear_bit(unsigned char *bits, int bit)
+static void
+_clear_bit(unsigned char *bits, int bit)
{
ClearBit(bits, bit);
- if (bit >= XI_TouchBegin && bit <= XI_TouchOwnership)
- {
+ if (bit >= XI_TouchBegin && bit <= XI_TouchOwnership) {
ClearBit(bits, XI_TouchBegin);
ClearBit(bits, XI_TouchUpdate);
ClearBit(bits, XI_TouchEnd);
}
}
-static void request_XISelectEvents_masks(xXISelectEventsReq *req)
+static void
+request_XISelectEvents_masks(xXISelectEventsReq * req)
{
int i, j;
xXIEventMask *mask;
- int nmasks = (XI2LASTEVENT + 7)/8;
+ int nmasks = (XI2LASTEVENT + 7) / 8;
unsigned char *bits;
- mask = (xXIEventMask*)&req[1];
+ mask = (xXIEventMask *) & req[1];
req->win = ROOT_WINDOW_ID;
/* if a clients submits more than 100 masks, consider it insane and untested */
- for (i = 1; i <= 1000; i++)
- {
+ for (i = 1; i <= 1000; i++) {
req->num_masks = i;
mask->deviceid = XIAllDevices;
@@ -174,11 +174,10 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
* Test setting each valid mask bit, while leaving unneeded bits 0.
* -> Success
*/
- bits = (unsigned char*)&mask[1];
- mask->mask_len = (nmasks + 3)/4 * 10;
+ bits = (unsigned char *) &mask[1];
+ mask->mask_len = (nmasks + 3) / 4 * 10;
memset(bits, 0, mask->mask_len * 4);
- for (j = 0; j <= XI2LASTEVENT; j++)
- {
+ for (j = 0; j <= XI2LASTEVENT; j++) {
_set_bit(bits, j);
request_XISelectEvent(req, Success);
_clear_bit(bits, j);
@@ -189,12 +188,11 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
* Test setting all valid mask bits, while leaving unneeded bits 0.
* -> Success
*/
- bits = (unsigned char*)&mask[1];
- mask->mask_len = (nmasks + 3)/4 * 10;
+ bits = (unsigned char *) &mask[1];
+ mask->mask_len = (nmasks + 3) / 4 * 10;
memset(bits, 0, mask->mask_len * 4);
- for (j = 0; j <= XI2LASTEVENT; j++)
- {
+ for (j = 0; j <= XI2LASTEVENT; j++) {
_set_bit(bits, j);
request_XISelectEvent(req, Success);
}
@@ -203,12 +201,11 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
* mask is larger than needed for XI2LASTEVENT. If any unneeded bit
* is set -> BadValue
*/
- bits = (unsigned char*)&mask[1];
- mask->mask_len = (nmasks + 3)/4 * 10;
+ bits = (unsigned char *) &mask[1];
+ mask->mask_len = (nmasks + 3) / 4 * 10;
memset(bits, 0, mask->mask_len * 4);
- for (j = XI2LASTEVENT + 1; j < mask->mask_len * 4; j++)
- {
+ for (j = XI2LASTEVENT + 1; j < mask->mask_len * 4; j++) {
_set_bit(bits, j);
request_XISelectEvent(req, BadValue);
_clear_bit(bits, j);
@@ -217,11 +214,10 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
/* Test 4:
* Mask len is a sensible length, only valid bits are set -> Success
*/
- bits = (unsigned char*)&mask[1];
- mask->mask_len = (nmasks + 3)/4;
+ bits = (unsigned char *) &mask[1];
+ mask->mask_len = (nmasks + 3) / 4;
memset(bits, 0, mask->mask_len * 4);
- for (j = 0; j <= XI2LASTEVENT; j++)
- {
+ for (j = 0; j <= XI2LASTEVENT; j++) {
_set_bit(bits, j);
request_XISelectEvent(req, Success);
}
@@ -230,14 +226,13 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
* HierarchyChanged bit is BadValue for devices other than
* XIAllDevices
*/
- bits = (unsigned char*)&mask[1];
- mask->mask_len = (nmasks + 3)/4;
+ bits = (unsigned char *) &mask[1];
+ mask->mask_len = (nmasks + 3) / 4;
memset(bits, 0, mask->mask_len * 4);
SetBit(bits, XI_HierarchyChanged);
mask->deviceid = XIAllDevices;
request_XISelectEvent(req, Success);
- for (j = 1; j < devices.num_devices; j++)
- {
+ for (j = 1; j < devices.num_devices; j++) {
mask->deviceid = j;
request_XISelectEvent(req, BadValue);
}
@@ -245,28 +240,31 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
/* Test 6:
* All bits set minus hierarchy changed bit -> Success
*/
- bits = (unsigned char*)&mask[1];
- mask->mask_len = (nmasks + 3)/4;
+ bits = (unsigned char *) &mask[1];
+ mask->mask_len = (nmasks + 3) / 4;
memset(bits, 0, mask->mask_len * 4);
for (j = 0; j <= XI2LASTEVENT; j++)
_set_bit(bits, j);
_clear_bit(bits, XI_HierarchyChanged);
- for (j = 1; j < 6; j++)
- {
+ for (j = 1; j < 6; j++) {
mask->deviceid = j;
request_XISelectEvent(req, Success);
}
- mask = (xXIEventMask*)((char*)mask + sizeof(xXIEventMask) + mask->mask_len * 4);
+ mask =
+ (xXIEventMask *) ((char *) mask + sizeof(xXIEventMask) +
+ mask->mask_len * 4);
}
}
-static void test_XISelectEvents(void)
+static void
+test_XISelectEvents(void)
{
int i;
xXIEventMask *mask;
xXISelectEventsReq *req;
- req = (xXISelectEventsReq*)data;
+
+ req = (xXISelectEventsReq *) data;
request_init(req, XISelectEvents);
@@ -313,16 +311,15 @@ static void test_XISelectEvents(void)
req->num_masks = 1;
printf("Triggering bogus mask length error\n");
- mask = (xXIEventMask*)&req[1];
+ mask = (xXIEventMask *) & req[1];
mask->deviceid = 0;
mask->mask_len = 0xFFFF;
request_XISelectEvent(req, BadLength);
/* testing various device ids */
printf("Testing existing device ids.\n");
- for (i = 0; i < 6; i++)
- {
- mask = (xXIEventMask*)&req[1];
+ for (i = 0; i < 6; i++) {
+ mask = (xXIEventMask *) & req[1];
mask->deviceid = i;
mask->mask_len = 1;
req->win = ROOT_WINDOW_ID;
@@ -331,11 +328,10 @@ static void test_XISelectEvents(void)
}
printf("Testing non-existing device ids.\n");
- for (i = 6; i <= 0xFFFF; i++)
- {
+ for (i = 6; i <= 0xFFFF; i++) {
req->win = ROOT_WINDOW_ID;
req->num_masks = 1;
- mask = (xXIEventMask*)&req[1];
+ mask = (xXIEventMask *) & req[1];
mask->deviceid = i;
mask->mask_len = 1;
request_XISelectEvent(req, BadDevice);
@@ -344,7 +340,8 @@ static void test_XISelectEvents(void)
request_XISelectEvents_masks(req);
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
init_simple();
@@ -352,4 +349,3 @@ int main(int argc, char** argv)
return 0;
}
-
diff --git a/xorg-server/test/xi2/protocol-xisetclientpointer.c b/xorg-server/test/xi2/protocol-xisetclientpointer.c
index d9620e336..51db4ac69 100644
--- a/xorg-server/test/xi2/protocol-xisetclientpointer.c
+++ b/xorg-server/test/xi2/protocol-xisetclientpointer.c
@@ -40,7 +40,7 @@
#include <X11/extensions/XI2proto.h>
#include "inputstr.h"
#include "windowstr.h"
-#include "extinit.h" /* for XInputExtensionInit */
+#include "extinit.h" /* for XInputExtensionInit */
#include "scrnintstr.h"
#include "xisetclientpointer.h"
#include "exevents.h"
@@ -50,13 +50,14 @@
static ClientRec client_window;
static ClientRec client_request;
-int __wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
+int
+__wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client,
+ Mask access)
{
if (rid == ROOT_WINDOW_ID)
return BadWindow;
- if (rid == CLIENT_WINDOW_ID)
- {
+ if (rid == CLIENT_WINDOW_ID) {
*pClient = &client_window;
return Success;
}
@@ -64,9 +65,11 @@ int __wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask a
return __real_dixLookupClient(pClient, rid, client, access);
}
-static void request_XISetClientPointer(xXISetClientPointerReq* req, int error)
+static void
+request_XISetClientPointer(xXISetClientPointerReq * req, int error)
{
int rc;
+
client_request = init_client(req->length, req);
rc = ProcXISetClientPointer(&client_request);
@@ -87,7 +90,8 @@ static void request_XISetClientPointer(xXISetClientPointerReq* req, int error)
}
-static void test_XISetClientPointer(void)
+static void
+test_XISetClientPointer(void)
{
int i;
xXISetClientPointerReq request;
@@ -113,8 +117,7 @@ static void test_XISetClientPointer(void)
assert(client_window.clientPtr->id == 2);
printf("Testing BadDevice error for all other devices.\n");
- for (i = 4; i <= 0xFFFF; i++)
- {
+ for (i = 4; i <= 0xFFFF; i++) {
request.deviceid = i;
request_XISetClientPointer(&request, BadDevice);
}
@@ -132,8 +135,8 @@ static void test_XISetClientPointer(void)
}
-
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
init_simple();
client_window = init_client(0, NULL);
diff --git a/xorg-server/test/xi2/protocol-xiwarppointer.c b/xorg-server/test/xi2/protocol-xiwarppointer.c
index 2b40f63f9..c279ac413 100644
--- a/xorg-server/test/xi2/protocol-xiwarppointer.c
+++ b/xorg-server/test/xi2/protocol-xiwarppointer.c
@@ -48,14 +48,14 @@ static int expected_y = SPRITE_Y;
* fake client window. If the requested ID is neither of those wanted,
* return whatever the real dixLookupWindow does.
*/
-int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
+int
+__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
{
- if (id == root.drawable.id)
- {
+ if (id == root.drawable.id) {
*win = &root;
return Success;
- } else if (id == window.drawable.id)
- {
+ }
+ else if (id == window.drawable.id) {
*win = &window;
return Success;
}
@@ -66,17 +66,17 @@ int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access
/**
* This function overrides the one in the screen rec.
*/
-static Bool ScreenSetCursorPosition(DeviceIntPtr dev, ScreenPtr screen,
- int x, int y, Bool generateEvent)
+static Bool
+ScreenSetCursorPosition(DeviceIntPtr dev, ScreenPtr screen,
+ int x, int y, Bool generateEvent)
{
assert(x == expected_x);
assert(y == expected_y);
return TRUE;
}
-
-static void request_XIWarpPointer(ClientPtr client, xXIWarpPointerReq* req,
- int error)
+static void
+request_XIWarpPointer(ClientPtr client, xXIWarpPointerReq * req, int error)
{
int rc;
@@ -87,8 +87,7 @@ static void request_XIWarpPointer(ClientPtr client, xXIWarpPointerReq* req,
assert(client->errorValue == req->deviceid);
else if (rc == BadWindow)
assert(client->errorValue == req->dst_win ||
- client->errorValue == req->src_win);
-
+ client->errorValue == req->src_win);
client->swapped = TRUE;
@@ -109,12 +108,13 @@ static void request_XIWarpPointer(ClientPtr client, xXIWarpPointerReq* req,
assert(client->errorValue == req->deviceid);
else if (rc == BadWindow)
assert(client->errorValue == req->dst_win ||
- client->errorValue == req->src_win);
+ client->errorValue == req->src_win);
client->swapped = FALSE;
}
-static void test_XIWarpPointer(void)
+static void
+test_XIWarpPointer(void)
{
int i;
ClientRec client_request;
@@ -143,12 +143,11 @@ static void test_XIWarpPointer(void)
request.deviceid = devices.kbd->id;
request_XIWarpPointer(&client_request, &request, BadDevice);
- devices.mouse->master = NULL; /* Float, kind-of */
+ devices.mouse->master = NULL; /* Float, kind-of */
request.deviceid = devices.mouse->id;
request_XIWarpPointer(&client_request, &request, Success);
- for (i = devices.kbd->id + 1; i <= 0xFFFF; i++)
- {
+ for (i = devices.kbd->id + 1; i <= 0xFFFF; i++) {
request.deviceid = i;
request_XIWarpPointer(&client_request, &request, BadDevice);
}
@@ -161,10 +160,10 @@ static void test_XIWarpPointer(void)
request_XIWarpPointer(&client_request, &request, Success);
request.src_win = root.drawable.id;
- request.dst_win = 0xFFFF; /* invalid window */
+ request.dst_win = 0xFFFF; /* invalid window */
request_XIWarpPointer(&client_request, &request, BadWindow);
- request.src_win = 0xFFFF; /* invalid window */
+ request.src_win = 0xFFFF; /* invalid window */
request.dst_win = root.drawable.id;
request_XIWarpPointer(&client_request, &request, BadWindow);
@@ -200,7 +199,8 @@ static void test_XIWarpPointer(void)
/* FIXME: src_x/y checks */
}
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
init_simple();
screen.SetCursorPosition = ScreenSetCursorPosition;
diff --git a/xorg-server/test/xi2/xi2.c b/xorg-server/test/xi2/xi2.c
index 5143caff8..6ee705293 100644
--- a/xorg-server/test/xi2/xi2.c
+++ b/xorg-server/test/xi2/xi2.c
@@ -30,10 +30,10 @@
#include "inputstr.h"
#include "assert.h"
-static void xi2mask_test(void)
+static void
+xi2mask_test(void)
{
- XI2Mask *xi2mask = NULL,
- *mergemask = NULL;
+ XI2Mask *xi2mask = NULL, *mergemask = NULL;
unsigned char *mask;
DeviceIntRec dev;
int i;
@@ -51,12 +51,14 @@ static void xi2mask_test(void)
/* ensure zeros */
for (i = 0; i < xi2mask_num_masks(xi2mask); i++) {
const unsigned char *m = xi2mask_get_one_mask(xi2mask, i);
+
assert(memcmp(mask, m, xi2mask_mask_size(xi2mask)) == 0);
}
/* set various bits */
for (i = 0; i < xi2mask_num_masks(xi2mask); i++) {
const unsigned char *m;
+
xi2mask_set(xi2mask, i, i);
dev.id = i;
@@ -71,6 +73,7 @@ static void xi2mask_test(void)
/* ensure zeros one-by-one */
for (i = 0; i < xi2mask_num_masks(xi2mask); i++) {
const unsigned char *m = xi2mask_get_one_mask(xi2mask, i);
+
assert(memcmp(mask, m, xi2mask_mask_size(xi2mask)) != 0);
xi2mask_zero(xi2mask, i);
assert(memcmp(mask, m, xi2mask_mask_size(xi2mask)) == 0);
@@ -83,11 +86,13 @@ static void xi2mask_test(void)
for (i = 0; i < xi2mask_num_masks(xi2mask); i++) {
const unsigned char *m = xi2mask_get_one_mask(xi2mask, i);
+
assert(memcmp(mask, m, xi2mask_mask_size(xi2mask)) == 0);
}
for (i = 0; i < xi2mask_num_masks(xi2mask); i++) {
const unsigned char *m;
+
SetBit(mask, i);
xi2mask_set_one_mask(xi2mask, i, mask, xi2mask_mask_size(xi2mask));
m = xi2mask_get_one_mask(xi2mask, i);
@@ -105,6 +110,7 @@ static void xi2mask_test(void)
xi2mask_merge(xi2mask, mergemask);
for (i = 0; i < xi2mask_num_masks(mergemask); i++) {
const unsigned char *m = xi2mask_get_one_mask(xi2mask, i);
+
SetBit(mask, i);
SetBit(mask, i * 2);
assert(memcmp(mask, m, xi2mask_mask_size(xi2mask)) == 0);
@@ -120,8 +126,8 @@ static void xi2mask_test(void)
free(mask);
}
-
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
xi2mask_test();
diff --git a/xorg-server/test/xkb.c b/xorg-server/test/xkb.c
index 421153cd1..955e72dff 100644
--- a/xorg-server/test/xkb.c
+++ b/xorg-server/test/xkb.c
@@ -55,12 +55,12 @@
*
* Result: RMLVO defaults are the same as obtained.
*/
-static void xkb_get_rules_test(void)
+static void
+xkb_get_rules_test(void)
{
- XkbRMLVOSet rmlvo = { NULL};
+ XkbRMLVOSet rmlvo = { NULL };
XkbGetRulesDflts(&rmlvo);
-
assert(rmlvo.rules);
assert(rmlvo.model);
assert(rmlvo.layout);
@@ -79,7 +79,8 @@ static void xkb_get_rules_test(void)
* Compare obtained ruleset with the built-in defaults.
* Result: RMLVO defaults are the same as obtained.
*/
-static void xkb_set_rules_test(void)
+static void
+xkb_set_rules_test(void)
{
XkbRMLVOSet rmlvo = {
.rules = "test-rules",
@@ -107,7 +108,6 @@ static void xkb_set_rules_test(void)
assert(strcmp(rmlvo.options, rmlvo_new.options) == 0);
}
-
/**
* Get the default RMLVO set.
* Set the default RMLVO set.
@@ -116,7 +116,8 @@ static void xkb_set_rules_test(void)
*
* Result: RMLVO set obtained is the same as previously set.
*/
-static void xkb_set_get_rules_test(void)
+static void
+xkb_set_get_rules_test(void)
{
/* This test failed before XkbGetRulesDftlts changed to strdup.
We test this twice because the first time using XkbGetRulesDflts we obtain
@@ -158,8 +159,8 @@ static void xkb_set_get_rules_test(void)
assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0);
}
-
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
xkb_set_get_rules_test();
xkb_get_rules_test();
diff --git a/xorg-server/test/xtest.c b/xorg-server/test/xtest.c
index 2ab46505f..aeca669d8 100644
--- a/xorg-server/test/xtest.c
+++ b/xorg-server/test/xtest.c
@@ -40,9 +40,14 @@
extern DeviceIntPtr xtestpointer, xtestkeyboard;
/* Needed for the screen setup, otherwise we crash during sprite initialization */
-static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
+static Bool
+device_cursor_init(DeviceIntPtr dev, ScreenPtr screen)
+{
+ return TRUE;
+}
-static void xtest_init_devices(void)
+static void
+xtest_init_devices(void)
{
ScreenRec screen;
@@ -68,8 +73,10 @@ static void xtest_init_devices(void)
assert(IsXTestDevice(xtestpointer, NULL));
assert(IsXTestDevice(xtestkeyboard, NULL));
assert(IsXTestDevice(xtestpointer, inputInfo.pointer));
+
assert(IsXTestDevice(xtestkeyboard, inputInfo.keyboard));
assert(GetXTestDevice(inputInfo.pointer) == xtestpointer);
+
assert(GetXTestDevice(inputInfo.keyboard) == xtestkeyboard);
}
@@ -77,7 +84,8 @@ static void xtest_init_devices(void)
* Each xtest devices has a property attached marking it. This property
* cannot be changed.
*/
-static void xtest_properties(void)
+static void
+xtest_properties(void)
{
int rc;
char value = 1;
@@ -93,21 +101,20 @@ static void xtest_properties(void)
assert(prop != NULL);
rc = XIChangeDeviceProperty(xtestpointer, xtest_prop,
- XA_INTEGER, 8, PropModeReplace, 1, &value, FALSE);
+ XA_INTEGER, 8, PropModeReplace, 1, &value,
+ FALSE);
assert(rc == BadAccess);
rc = XIChangeDeviceProperty(xtestkeyboard, xtest_prop,
- XA_INTEGER, 8, PropModeReplace, 1, &value, FALSE);
+ XA_INTEGER, 8, PropModeReplace, 1, &value,
+ FALSE);
assert(rc == BadAccess);
}
-
-
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
xtest_init_devices();
xtest_properties();
return 0;
}
-
-
diff --git a/xorg-server/xfixes/cursor.c b/xorg-server/xfixes/cursor.c
index 686ed4949..1f1b0c209 100644
--- a/xorg-server/xfixes/cursor.c
+++ b/xorg-server/xfixes/cursor.c
@@ -59,16 +59,17 @@
#include "xace.h"
#include "list.h"
-static RESTYPE CursorClientType;
-static RESTYPE CursorHideCountType;
-static RESTYPE CursorWindowType;
-RESTYPE PointerBarrierType;
-static CursorPtr CursorCurrent[MAXDEVICES];
+static RESTYPE CursorClientType;
+static RESTYPE CursorHideCountType;
+static RESTYPE CursorWindowType;
+RESTYPE PointerBarrierType;
+static CursorPtr CursorCurrent[MAXDEVICES];
static DevPrivateKeyRec CursorScreenPrivateKeyRec;
+
#define CursorScreenPrivateKey (&CursorScreenPrivateKeyRec)
-static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
+static void deleteCursorHideCountsForScreen(ScreenPtr pScreen);
#define VERIFY_CURSOR(pCursor, cursor, client, access) \
do { \
@@ -88,14 +89,14 @@ static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
typedef struct _CursorEvent *CursorEventPtr;
typedef struct _CursorEvent {
- CursorEventPtr next;
- CARD32 eventMask;
- ClientPtr pClient;
- WindowPtr pWindow;
- XID clientResource;
+ CursorEventPtr next;
+ CARD32 eventMask;
+ ClientPtr pClient;
+ WindowPtr pWindow;
+ XID clientResource;
} CursorEventRec;
-static CursorEventPtr cursorEvents;
+static CursorEventPtr cursorEvents;
/*
* Each screen has a list of clients which have requested
@@ -106,11 +107,11 @@ static CursorEventPtr cursorEvents;
typedef struct _CursorHideCountRec *CursorHideCountPtr;
typedef struct _CursorHideCountRec {
- CursorHideCountPtr pNext;
- ClientPtr pClient;
- ScreenPtr pScreen;
- int hideCount;
- XID resource;
+ CursorHideCountPtr pNext;
+ ClientPtr pClient;
+ ScreenPtr pScreen;
+ int hideCount;
+ XID resource;
} CursorHideCountRec;
typedef struct PointerBarrierClient *PointerBarrierClientPtr;
@@ -126,11 +127,11 @@ struct PointerBarrierClient {
*/
typedef struct _CursorScreen {
- DisplayCursorProcPtr DisplayCursor;
- CloseScreenProcPtr CloseScreen;
+ DisplayCursorProcPtr DisplayCursor;
+ CloseScreenProcPtr CloseScreen;
ConstrainCursorHarderProcPtr ConstrainCursorHarder;
- CursorHideCountPtr pCursorHideCounts;
- struct xorg_list barriers;
+ CursorHideCountPtr pCursorHideCounts;
+ struct xorg_list barriers;
} CursorScreenRec, *CursorScreenPtr;
#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
@@ -145,66 +146,63 @@ static Bool CursorVisible = FALSE;
Bool EnableCursor = TRUE;
static Bool
-CursorDisplayCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor)
+CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- CursorScreenPtr cs = GetCursorScreen(pScreen);
- Bool ret;
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
+ Bool ret;
DisplayCursorProcPtr backupProc;
- Unwrap (cs, pScreen, DisplayCursor, backupProc);
+ Unwrap(cs, pScreen, DisplayCursor, backupProc);
/*
* Have to check ConnectionInfo to distinguish client requests from
* initial root window setup. Not a great way to do it, I admit.
*/
if (ConnectionInfo)
- CursorVisible = EnableCursor;
+ CursorVisible = EnableCursor;
if (cs->pCursorHideCounts != NULL || !CursorVisible) {
- ret = (*pScreen->DisplayCursor) (pDev, pScreen, NullCursor);
- } else {
- ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
+ ret = (*pScreen->DisplayCursor) (pDev, pScreen, NullCursor);
+ }
+ else {
+ ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
}
- if (pCursor != CursorCurrent[pDev->id])
- {
- CursorEventPtr e;
-
- CursorCurrent[pDev->id] = pCursor;
- for (e = cursorEvents; e; e = e->next)
- {
- if ((e->eventMask & XFixesDisplayCursorNotifyMask))
- {
- xXFixesCursorNotifyEvent ev;
- ev.type = XFixesEventBase + XFixesCursorNotify;
- ev.subtype = XFixesDisplayCursorNotify;
- ev.window = e->pWindow->drawable.id;
- ev.cursorSerial = pCursor ? pCursor->serialNumber : 0;
- ev.timestamp = currentTime.milliseconds;
- ev.name = pCursor ? pCursor->name : None;
- WriteEventsToClient (e->pClient, 1, (xEvent *) &ev);
- }
- }
+ if (pCursor != CursorCurrent[pDev->id]) {
+ CursorEventPtr e;
+
+ CursorCurrent[pDev->id] = pCursor;
+ for (e = cursorEvents; e; e = e->next) {
+ if ((e->eventMask & XFixesDisplayCursorNotifyMask)) {
+ xXFixesCursorNotifyEvent ev;
+
+ ev.type = XFixesEventBase + XFixesCursorNotify;
+ ev.subtype = XFixesDisplayCursorNotify;
+ ev.window = e->pWindow->drawable.id;
+ ev.cursorSerial = pCursor ? pCursor->serialNumber : 0;
+ ev.timestamp = currentTime.milliseconds;
+ ev.name = pCursor ? pCursor->name : None;
+ WriteEventsToClient(e->pClient, 1, (xEvent *) &ev);
+ }
+ }
}
- Wrap (cs, pScreen, DisplayCursor, backupProc);
+ Wrap(cs, pScreen, DisplayCursor, backupProc);
return ret;
}
static Bool
-CursorCloseScreen (int index, ScreenPtr pScreen)
+CursorCloseScreen(int index, ScreenPtr pScreen)
{
- CursorScreenPtr cs = GetCursorScreen (pScreen);
- Bool ret;
- _X_UNUSED CloseScreenProcPtr close_proc;
- _X_UNUSED DisplayCursorProcPtr display_proc;
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
+ Bool ret;
+ _X_UNUSED CloseScreenProcPtr close_proc;
+ _X_UNUSED DisplayCursorProcPtr display_proc;
ConstrainCursorHarderProcPtr constrain_proc;
- Unwrap (cs, pScreen, CloseScreen, close_proc);
- Unwrap (cs, pScreen, DisplayCursor, display_proc);
- Unwrap (cs, pScreen, ConstrainCursorHarder, constrain_proc);
+ Unwrap(cs, pScreen, CloseScreen, close_proc);
+ Unwrap(cs, pScreen, DisplayCursor, display_proc);
+ Unwrap(cs, pScreen, ConstrainCursorHarder, constrain_proc);
deleteCursorHideCountsForScreen(pScreen);
ret = (*pScreen->CloseScreen) (index, pScreen);
free(cs);
@@ -214,102 +212,92 @@ CursorCloseScreen (int index, ScreenPtr pScreen)
#define CursorAllEvents (XFixesDisplayCursorNotifyMask)
static int
-XFixesSelectCursorInput (ClientPtr pClient,
- WindowPtr pWindow,
- CARD32 eventMask)
+XFixesSelectCursorInput(ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask)
{
- CursorEventPtr *prev, e;
+ CursorEventPtr *prev, e;
pointer val;
int rc;
- for (prev = &cursorEvents; (e = *prev); prev = &e->next)
- {
- if (e->pClient == pClient &&
- e->pWindow == pWindow)
- {
- break;
- }
+ for (prev = &cursorEvents; (e = *prev); prev = &e->next) {
+ if (e->pClient == pClient && e->pWindow == pWindow) {
+ break;
+ }
}
- if (!eventMask)
- {
- if (e)
- {
- FreeResource (e->clientResource, 0);
- }
- return Success;
+ if (!eventMask) {
+ if (e) {
+ FreeResource(e->clientResource, 0);
+ }
+ return Success;
}
- if (!e)
- {
- e = (CursorEventPtr) malloc(sizeof (CursorEventRec));
- if (!e)
- return BadAlloc;
-
- e->next = 0;
- e->pClient = pClient;
- e->pWindow = pWindow;
- e->clientResource = FakeClientID(pClient->index);
-
- /*
- * Add a resource hanging from the window to
- * catch window destroy
- */
- rc = dixLookupResourceByType( &val, pWindow->drawable.id,
- CursorWindowType, serverClient,
- DixGetAttrAccess);
- if (rc != Success)
- if (!AddResource (pWindow->drawable.id, CursorWindowType,
- (pointer) pWindow))
- {
- free(e);
- return BadAlloc;
- }
-
- if (!AddResource (e->clientResource, CursorClientType, (pointer) e))
- return BadAlloc;
-
- *prev = e;
+ if (!e) {
+ e = (CursorEventPtr) malloc(sizeof(CursorEventRec));
+ if (!e)
+ return BadAlloc;
+
+ e->next = 0;
+ e->pClient = pClient;
+ e->pWindow = pWindow;
+ e->clientResource = FakeClientID(pClient->index);
+
+ /*
+ * Add a resource hanging from the window to
+ * catch window destroy
+ */
+ rc = dixLookupResourceByType(&val, pWindow->drawable.id,
+ CursorWindowType, serverClient,
+ DixGetAttrAccess);
+ if (rc != Success)
+ if (!AddResource(pWindow->drawable.id, CursorWindowType,
+ (pointer) pWindow)) {
+ free(e);
+ return BadAlloc;
+ }
+
+ if (!AddResource(e->clientResource, CursorClientType, (pointer) e))
+ return BadAlloc;
+
+ *prev = e;
}
e->eventMask = eventMask;
return Success;
}
int
-ProcXFixesSelectCursorInput (ClientPtr client)
+ProcXFixesSelectCursorInput(ClientPtr client)
{
- REQUEST (xXFixesSelectCursorInputReq);
- WindowPtr pWin;
- int rc;
+ REQUEST(xXFixesSelectCursorInputReq);
+ WindowPtr pWin;
+ int rc;
- REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq);
+ REQUEST_SIZE_MATCH(xXFixesSelectCursorInputReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
- if (stuff->eventMask & ~CursorAllEvents)
- {
- client->errorValue = stuff->eventMask;
- return BadValue;
+ if (stuff->eventMask & ~CursorAllEvents) {
+ client->errorValue = stuff->eventMask;
+ return BadValue;
}
- return XFixesSelectCursorInput (client, pWin, stuff->eventMask);
+ return XFixesSelectCursorInput(client, pWin, stuff->eventMask);
}
static int
-GetBit (unsigned char *line, int x)
+GetBit(unsigned char *line, int x)
{
- unsigned char mask;
-
+ unsigned char mask;
+
if (screenInfo.bitmapBitOrder == LSBFirst)
- mask = (1 << (x & 7));
+ mask = (1 << (x & 7));
else
- mask = (0x80 >> (x & 7));
+ mask = (0x80 >> (x & 7));
/* XXX assumes byte order is host byte order */
line += (x >> 3);
if (*line & mask)
- return 1;
+ return 1;
return 0;
}
int
-SProcXFixesSelectCursorInput (ClientPtr client)
+SProcXFixesSelectCursorInput(ClientPtr client)
{
REQUEST(xXFixesSelectCursorInputReq);
@@ -318,91 +306,85 @@ SProcXFixesSelectCursorInput (ClientPtr client)
swapl(&stuff->eventMask);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-
+
void
-SXFixesCursorNotifyEvent (xXFixesCursorNotifyEvent *from,
- xXFixesCursorNotifyEvent *to)
+SXFixesCursorNotifyEvent(xXFixesCursorNotifyEvent * from,
+ xXFixesCursorNotifyEvent * to)
{
to->type = from->type;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->window, to->window);
- cpswapl (from->cursorSerial, to->cursorSerial);
- cpswapl (from->timestamp, to->timestamp);
- cpswapl (from->name, to->name);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->window, to->window);
+ cpswapl(from->cursorSerial, to->cursorSerial);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->name, to->name);
}
static void
-CopyCursorToImage (CursorPtr pCursor, CARD32 *image)
+CopyCursorToImage(CursorPtr pCursor, CARD32 *image)
{
int width = pCursor->bits->width;
int height = pCursor->bits->height;
int npixels = width * height;
-
+
#ifdef ARGB_CURSOR
if (pCursor->bits->argb)
- memcpy (image, pCursor->bits->argb, npixels * sizeof (CARD32));
+ memcpy(image, pCursor->bits->argb, npixels * sizeof(CARD32));
else
#endif
{
- unsigned char *srcLine = pCursor->bits->source;
- unsigned char *mskLine = pCursor->bits->mask;
- int stride = BitmapBytePad (width);
- int x, y;
- CARD32 fg, bg;
-
- fg = (0xff000000 |
- ((pCursor->foreRed & 0xff00) << 8) |
- (pCursor->foreGreen & 0xff00) |
- (pCursor->foreBlue >> 8));
- bg = (0xff000000 |
- ((pCursor->backRed & 0xff00) << 8) |
- (pCursor->backGreen & 0xff00) |
- (pCursor->backBlue >> 8));
- for (y = 0; y < height; y++)
- {
- for (x = 0; x < width; x++)
- {
- if (GetBit (mskLine, x))
- {
- if (GetBit (srcLine, x))
- *image++ = fg;
- else
- *image++ = bg;
- }
- else
- *image++ = 0;
- }
- srcLine += stride;
- mskLine += stride;
- }
+ unsigned char *srcLine = pCursor->bits->source;
+ unsigned char *mskLine = pCursor->bits->mask;
+ int stride = BitmapBytePad(width);
+ int x, y;
+ CARD32 fg, bg;
+
+ fg = (0xff000000 |
+ ((pCursor->foreRed & 0xff00) << 8) |
+ (pCursor->foreGreen & 0xff00) | (pCursor->foreBlue >> 8));
+ bg = (0xff000000 |
+ ((pCursor->backRed & 0xff00) << 8) |
+ (pCursor->backGreen & 0xff00) | (pCursor->backBlue >> 8));
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ if (GetBit(mskLine, x)) {
+ if (GetBit(srcLine, x))
+ *image++ = fg;
+ else
+ *image++ = bg;
+ }
+ else
+ *image++ = 0;
+ }
+ srcLine += stride;
+ mskLine += stride;
+ }
}
}
int
-ProcXFixesGetCursorImage (ClientPtr client)
+ProcXFixesGetCursorImage(ClientPtr client)
{
/* REQUEST(xXFixesGetCursorImageReq); */
- xXFixesGetCursorImageReply *rep;
- CursorPtr pCursor;
- CARD32 *image;
- int npixels, width, height, rc, x, y;
+ xXFixesGetCursorImageReply *rep;
+ CursorPtr pCursor;
+ CARD32 *image;
+ int npixels, width, height, rc, x, y;
REQUEST_SIZE_MATCH(xXFixesGetCursorImageReq);
pCursor = CursorCurrent[PickPointer(client)->id];
if (!pCursor)
- return BadCursor;
+ return BadCursor;
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR,
- pCursor, RT_NONE, NULL, DixReadAccess);
+ pCursor, RT_NONE, NULL, DixReadAccess);
if (rc != Success)
- return rc;
- GetSpritePosition (PickPointer(client), &x, &y);
+ return rc;
+ GetSpritePosition(PickPointer(client), &x, &y);
width = pCursor->bits->width;
height = pCursor->bits->height;
npixels = width * height;
- rep = malloc(sizeof (xXFixesGetCursorImageReply) +
- npixels * sizeof (CARD32));
+ rep = malloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32));
if (!rep)
- return BadAlloc;
+ return BadAlloc;
rep->type = X_Reply;
rep->sequenceNumber = client->sequence;
@@ -412,32 +394,31 @@ ProcXFixesGetCursorImage (ClientPtr client)
rep->x = x;
rep->y = y;
rep->xhot = pCursor->bits->xhot;
- rep->yhot = pCursor->bits->yhot;
+ rep->yhot = pCursor->bits->yhot;
rep->cursorSerial = pCursor->serialNumber;
image = (CARD32 *) (rep + 1);
- CopyCursorToImage (pCursor, image);
- if (client->swapped)
- {
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swaps(&rep->x);
- swaps(&rep->y);
- swaps(&rep->width);
- swaps(&rep->height);
- swaps(&rep->xhot);
- swaps(&rep->yhot);
- swapl(&rep->cursorSerial);
- SwapLongs (image, npixels);
+ CopyCursorToImage(pCursor, image);
+ if (client->swapped) {
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->x);
+ swaps(&rep->y);
+ swaps(&rep->width);
+ swaps(&rep->height);
+ swaps(&rep->xhot);
+ swaps(&rep->yhot);
+ swapl(&rep->cursorSerial);
+ SwapLongs(image, npixels);
}
- WriteToClient(client, sizeof (xXFixesGetCursorImageReply) +
- (npixels << 2), (char *) rep);
+ WriteToClient(client, sizeof(xXFixesGetCursorImageReply) +
+ (npixels << 2), (char *) rep);
free(rep);
return Success;
}
int
-SProcXFixesGetCursorImage (ClientPtr client)
+SProcXFixesGetCursorImage(ClientPtr client)
{
REQUEST(xXFixesGetCursorImageReq);
swaps(&stuff->length);
@@ -445,26 +426,27 @@ SProcXFixesGetCursorImage (ClientPtr client)
}
int
-ProcXFixesSetCursorName (ClientPtr client)
+ProcXFixesSetCursorName(ClientPtr client)
{
CursorPtr pCursor;
char *tchar;
+
REQUEST(xXFixesSetCursorNameReq);
Atom atom;
REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq);
VERIFY_CURSOR(pCursor, stuff->cursor, client, DixSetAttrAccess);
tchar = (char *) &stuff[1];
- atom = MakeAtom (tchar, stuff->nbytes, TRUE);
+ atom = MakeAtom(tchar, stuff->nbytes, TRUE);
if (atom == BAD_RESOURCE)
- return BadAlloc;
-
+ return BadAlloc;
+
pCursor->name = atom;
return Success;
}
int
-SProcXFixesSetCursorName (ClientPtr client)
+SProcXFixesSetCursorName(ClientPtr client)
{
REQUEST(xXFixesSetCursorNameReq);
@@ -476,10 +458,11 @@ SProcXFixesSetCursorName (ClientPtr client)
}
int
-ProcXFixesGetCursorName (ClientPtr client)
+ProcXFixesGetCursorName(ClientPtr client)
{
- CursorPtr pCursor;
- xXFixesGetCursorNameReply reply;
+ CursorPtr pCursor;
+ xXFixesGetCursorNameReply reply;
+
REQUEST(xXFixesGetCursorNameReq);
const char *str;
int len;
@@ -487,31 +470,30 @@ ProcXFixesGetCursorName (ClientPtr client)
REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq);
VERIFY_CURSOR(pCursor, stuff->cursor, client, DixGetAttrAccess);
if (pCursor->name)
- str = NameForAtom (pCursor->name);
+ str = NameForAtom(pCursor->name);
else
- str = "";
- len = strlen (str);
-
+ str = "";
+ len = strlen(str);
+
reply.type = X_Reply;
reply.length = bytes_to_int32(len);
reply.sequenceNumber = client->sequence;
reply.atom = pCursor->name;
reply.nbytes = len;
- if (client->swapped)
- {
- swaps(&reply.sequenceNumber);
- swapl(&reply.length);
- swapl(&reply.atom);
- swaps(&reply.nbytes);
+ if (client->swapped) {
+ swaps(&reply.sequenceNumber);
+ swapl(&reply.length);
+ swapl(&reply.atom);
+ swaps(&reply.nbytes);
}
WriteReplyToClient(client, sizeof(xXFixesGetCursorNameReply), &reply);
WriteToClient(client, len, str);
-
+
return Success;
}
int
-SProcXFixesGetCursorName (ClientPtr client)
+SProcXFixesGetCursorName(ClientPtr client)
{
REQUEST(xXFixesGetCursorNameReq);
@@ -522,37 +504,37 @@ SProcXFixesGetCursorName (ClientPtr client)
}
int
-ProcXFixesGetCursorImageAndName (ClientPtr client)
+ProcXFixesGetCursorImageAndName(ClientPtr client)
{
/* REQUEST(xXFixesGetCursorImageAndNameReq); */
- xXFixesGetCursorImageAndNameReply *rep;
- CursorPtr pCursor;
- CARD32 *image;
- int npixels;
- const char *name;
- int nbytes, nbytesRound;
- int width, height;
- int rc, x, y;
+ xXFixesGetCursorImageAndNameReply *rep;
+ CursorPtr pCursor;
+ CARD32 *image;
+ int npixels;
+ const char *name;
+ int nbytes, nbytesRound;
+ int width, height;
+ int rc, x, y;
REQUEST_SIZE_MATCH(xXFixesGetCursorImageAndNameReq);
pCursor = CursorCurrent[PickPointer(client)->id];
if (!pCursor)
- return BadCursor;
+ return BadCursor;
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR,
- pCursor, RT_NONE, NULL, DixReadAccess|DixGetAttrAccess);
+ pCursor, RT_NONE, NULL, DixReadAccess | DixGetAttrAccess);
if (rc != Success)
- return rc;
- GetSpritePosition (PickPointer(client), &x, &y);
+ return rc;
+ GetSpritePosition(PickPointer(client), &x, &y);
width = pCursor->bits->width;
height = pCursor->bits->height;
npixels = width * height;
- name = pCursor->name ? NameForAtom (pCursor->name) : "";
- nbytes = strlen (name);
+ name = pCursor->name ? NameForAtom(pCursor->name) : "";
+ nbytes = strlen(name);
nbytesRound = pad_to_int32(nbytes);
- rep = malloc(sizeof (xXFixesGetCursorImageAndNameReply) +
- npixels * sizeof (CARD32) + nbytesRound);
+ rep = malloc(sizeof(xXFixesGetCursorImageAndNameReply) +
+ npixels * sizeof(CARD32) + nbytesRound);
if (!rep)
- return BadAlloc;
+ return BadAlloc;
rep->type = X_Reply;
rep->sequenceNumber = client->sequence;
@@ -562,37 +544,36 @@ ProcXFixesGetCursorImageAndName (ClientPtr client)
rep->x = x;
rep->y = y;
rep->xhot = pCursor->bits->xhot;
- rep->yhot = pCursor->bits->yhot;
+ rep->yhot = pCursor->bits->yhot;
rep->cursorSerial = pCursor->serialNumber;
rep->cursorName = pCursor->name;
rep->nbytes = nbytes;
image = (CARD32 *) (rep + 1);
- CopyCursorToImage (pCursor, image);
- memcpy ((image + npixels), name, nbytes);
- if (client->swapped)
- {
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swaps(&rep->x);
- swaps(&rep->y);
- swaps(&rep->width);
- swaps(&rep->height);
- swaps(&rep->xhot);
- swaps(&rep->yhot);
- swapl(&rep->cursorSerial);
- swapl(&rep->cursorName);
- swaps(&rep->nbytes);
- SwapLongs (image, npixels);
+ CopyCursorToImage(pCursor, image);
+ memcpy((image + npixels), name, nbytes);
+ if (client->swapped) {
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->x);
+ swaps(&rep->y);
+ swaps(&rep->width);
+ swaps(&rep->height);
+ swaps(&rep->xhot);
+ swaps(&rep->yhot);
+ swapl(&rep->cursorSerial);
+ swapl(&rep->cursorName);
+ swaps(&rep->nbytes);
+ SwapLongs(image, npixels);
}
- WriteToClient(client, sizeof (xXFixesGetCursorImageAndNameReply) +
- (npixels << 2) + nbytesRound, (char *) rep);
+ WriteToClient(client, sizeof(xXFixesGetCursorImageAndNameReply) +
+ (npixels << 2) + nbytesRound, (char *) rep);
free(rep);
return Success;
}
int
-SProcXFixesGetCursorImageAndName (ClientPtr client)
+SProcXFixesGetCursorImageAndName(ClientPtr client)
{
REQUEST(xXFixesGetCursorImageAndNameReq);
swaps(&stuff->length);
@@ -613,66 +594,61 @@ typedef struct {
pointer closure;
} ReplaceCursorLookupRec, *ReplaceCursorLookupPtr;
-static const RESTYPE CursorRestypes[] = {
+static const RESTYPE CursorRestypes[] = {
RT_WINDOW, RT_PASSIVEGRAB, RT_CURSOR
};
#define NUM_CURSOR_RESTYPES (sizeof (CursorRestypes) / sizeof (CursorRestypes[0]))
static Bool
-ReplaceCursorLookup (pointer value, XID id, pointer closure)
+ReplaceCursorLookup(pointer value, XID id, pointer closure)
{
- ReplaceCursorLookupPtr rcl = (ReplaceCursorLookupPtr) closure;
- WindowPtr pWin;
- GrabPtr pGrab;
- CursorPtr pCursor = 0, *pCursorRef = 0;
- XID cursor = 0;
+ ReplaceCursorLookupPtr rcl = (ReplaceCursorLookupPtr) closure;
+ WindowPtr pWin;
+ GrabPtr pGrab;
+ CursorPtr pCursor = 0, *pCursorRef = 0;
+ XID cursor = 0;
switch (rcl->type) {
case RT_WINDOW:
- pWin = (WindowPtr) value;
- if (pWin->optional)
- {
- pCursorRef = &pWin->optional->cursor;
- pCursor = *pCursorRef;
- }
- break;
+ pWin = (WindowPtr) value;
+ if (pWin->optional) {
+ pCursorRef = &pWin->optional->cursor;
+ pCursor = *pCursorRef;
+ }
+ break;
case RT_PASSIVEGRAB:
- pGrab = (GrabPtr) value;
- pCursorRef = &pGrab->cursor;
- pCursor = *pCursorRef;
- break;
+ pGrab = (GrabPtr) value;
+ pCursorRef = &pGrab->cursor;
+ pCursor = *pCursorRef;
+ break;
case RT_CURSOR:
- pCursorRef = 0;
- pCursor = (CursorPtr) value;
- cursor = id;
- break;
+ pCursorRef = 0;
+ pCursor = (CursorPtr) value;
+ cursor = id;
+ break;
}
- if (pCursor && pCursor != rcl->pNew)
- {
- if ((*rcl->testCursor) (pCursor, rcl->closure))
- {
- rcl->pNew->refcnt++;
- /* either redirect reference or update resource database */
- if (pCursorRef)
- *pCursorRef = rcl->pNew;
- else
- ChangeResourceValue (id, RT_CURSOR, rcl->pNew);
- FreeCursor (pCursor, cursor);
- }
+ if (pCursor && pCursor != rcl->pNew) {
+ if ((*rcl->testCursor) (pCursor, rcl->closure)) {
+ rcl->pNew->refcnt++;
+ /* either redirect reference or update resource database */
+ if (pCursorRef)
+ *pCursorRef = rcl->pNew;
+ else
+ ChangeResourceValue(id, RT_CURSOR, rcl->pNew);
+ FreeCursor(pCursor, cursor);
+ }
}
- return FALSE; /* keep walking */
+ return FALSE; /* keep walking */
}
static void
-ReplaceCursor (CursorPtr pCursor,
- TestCursorFunc testCursor,
- pointer closure)
+ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, pointer closure)
{
- int clientIndex;
+ int clientIndex;
int resIndex;
- ReplaceCursorLookupRec rcl;
-
+ ReplaceCursorLookupRec rcl;
+
/*
* Cursors exist only in the resource database, windows and grabs.
* All of these are always pointed at by the resource database. Walk
@@ -683,50 +659,48 @@ ReplaceCursor (CursorPtr pCursor,
rcl.closure = closure;
/* for each client */
- for (clientIndex = 0; clientIndex < currentMaxClients; clientIndex++)
- {
- if (!clients[clientIndex])
- continue;
- for (resIndex = 0; resIndex < NUM_CURSOR_RESTYPES; resIndex++)
- {
- rcl.type = CursorRestypes[resIndex];
- /*
- * This function walks the entire client resource database
- */
- LookupClientResourceComplex (clients[clientIndex],
- rcl.type,
- ReplaceCursorLookup,
- (pointer) &rcl);
- }
+ for (clientIndex = 0; clientIndex < currentMaxClients; clientIndex++) {
+ if (!clients[clientIndex])
+ continue;
+ for (resIndex = 0; resIndex < NUM_CURSOR_RESTYPES; resIndex++) {
+ rcl.type = CursorRestypes[resIndex];
+ /*
+ * This function walks the entire client resource database
+ */
+ LookupClientResourceComplex(clients[clientIndex],
+ rcl.type,
+ ReplaceCursorLookup, (pointer) &rcl);
+ }
}
/* this "knows" that WindowHasNewCursor doesn't depend on it's argument */
- WindowHasNewCursor (screenInfo.screens[0]->root);
+ WindowHasNewCursor(screenInfo.screens[0]->root);
}
-static Bool
-TestForCursor (CursorPtr pCursor, pointer closure)
+static Bool
+TestForCursor(CursorPtr pCursor, pointer closure)
{
return (pCursor == (CursorPtr) closure);
}
int
-ProcXFixesChangeCursor (ClientPtr client)
+ProcXFixesChangeCursor(ClientPtr client)
{
- CursorPtr pSource, pDestination;
+ CursorPtr pSource, pDestination;
+
REQUEST(xXFixesChangeCursorReq);
REQUEST_SIZE_MATCH(xXFixesChangeCursorReq);
- VERIFY_CURSOR (pSource, stuff->source, client,
- DixReadAccess|DixGetAttrAccess);
- VERIFY_CURSOR (pDestination, stuff->destination, client,
- DixWriteAccess|DixSetAttrAccess);
+ VERIFY_CURSOR(pSource, stuff->source, client,
+ DixReadAccess | DixGetAttrAccess);
+ VERIFY_CURSOR(pDestination, stuff->destination, client,
+ DixWriteAccess | DixSetAttrAccess);
- ReplaceCursor (pSource, TestForCursor, (pointer) pDestination);
+ ReplaceCursor(pSource, TestForCursor, (pointer) pDestination);
return Success;
}
int
-SProcXFixesChangeCursor (ClientPtr client)
+SProcXFixesChangeCursor(ClientPtr client)
{
REQUEST(xXFixesChangeCursorReq);
@@ -738,37 +712,39 @@ SProcXFixesChangeCursor (ClientPtr client)
}
static Bool
-TestForCursorName (CursorPtr pCursor, pointer closure)
+TestForCursorName(CursorPtr pCursor, pointer closure)
{
Atom *pName = closure;
+
return pCursor->name == *pName;
}
int
-ProcXFixesChangeCursorByName (ClientPtr client)
+ProcXFixesChangeCursorByName(ClientPtr client)
{
- CursorPtr pSource;
- Atom name;
- char *tchar;
+ CursorPtr pSource;
+ Atom name;
+ char *tchar;
+
REQUEST(xXFixesChangeCursorByNameReq);
REQUEST_FIXED_SIZE(xXFixesChangeCursorByNameReq, stuff->nbytes);
VERIFY_CURSOR(pSource, stuff->source, client,
- DixReadAccess|DixGetAttrAccess);
+ DixReadAccess | DixGetAttrAccess);
tchar = (char *) &stuff[1];
- name = MakeAtom (tchar, stuff->nbytes, FALSE);
+ name = MakeAtom(tchar, stuff->nbytes, FALSE);
if (name)
- ReplaceCursor (pSource, TestForCursorName, &name);
+ ReplaceCursor(pSource, TestForCursorName, &name);
return Success;
}
int
-SProcXFixesChangeCursorByName (ClientPtr client)
+SProcXFixesChangeCursorByName(ClientPtr client)
{
REQUEST(xXFixesChangeCursorByNameReq);
swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE (xXFixesChangeCursorByNameReq);
+ REQUEST_AT_LEAST_SIZE(xXFixesChangeCursorByNameReq);
swapl(&stuff->source);
swaps(&stuff->nbytes);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
@@ -782,29 +758,29 @@ SProcXFixesChangeCursorByName (ClientPtr client)
/* Return the screen's hide-counts list element for the given client */
static CursorHideCountPtr
-findCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
+findCursorHideCount(ClientPtr pClient, ScreenPtr pScreen)
{
- CursorScreenPtr cs = GetCursorScreen(pScreen);
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
CursorHideCountPtr pChc;
for (pChc = cs->pCursorHideCounts; pChc != NULL; pChc = pChc->pNext) {
- if (pChc->pClient == pClient) {
- return pChc;
- }
+ if (pChc->pClient == pClient) {
+ return pChc;
+ }
}
- return NULL;
+ return NULL;
}
static int
-createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
+createCursorHideCount(ClientPtr pClient, ScreenPtr pScreen)
{
- CursorScreenPtr cs = GetCursorScreen(pScreen);
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
CursorHideCountPtr pChc;
pChc = (CursorHideCountPtr) malloc(sizeof(CursorHideCountRec));
if (pChc == NULL) {
- return BadAlloc;
+ return BadAlloc;
}
pChc->pClient = pClient;
pChc->pScreen = pScreen;
@@ -812,15 +788,14 @@ createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
pChc->resource = FakeClientID(pClient->index);
pChc->pNext = cs->pCursorHideCounts;
cs->pCursorHideCounts = pChc;
-
+
/*
* Create a resource for this element so it can be deleted
* when the client goes away.
*/
- if (!AddResource (pChc->resource, CursorHideCountType,
- (pointer) pChc)) {
- free(pChc);
- return BadAlloc;
+ if (!AddResource(pChc->resource, CursorHideCountType, (pointer) pChc)) {
+ free(pChc);
+ return BadAlloc;
}
return Success;
@@ -830,26 +805,27 @@ createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
* Delete the given hide-counts list element from its screen list.
*/
static void
-deleteCursorHideCount (CursorHideCountPtr pChcToDel, ScreenPtr pScreen)
+deleteCursorHideCount(CursorHideCountPtr pChcToDel, ScreenPtr pScreen)
{
- CursorScreenPtr cs = GetCursorScreen(pScreen);
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
CursorHideCountPtr pChc, pNext;
CursorHideCountPtr pChcLast = NULL;
pChc = cs->pCursorHideCounts;
while (pChc != NULL) {
- pNext = pChc->pNext;
- if (pChc == pChcToDel) {
- free(pChc);
- if (pChcLast == NULL) {
- cs->pCursorHideCounts = pNext;
- } else {
- pChcLast->pNext = pNext;
- }
- return;
- }
- pChcLast = pChc;
- pChc = pNext;
+ pNext = pChc->pNext;
+ if (pChc == pChcToDel) {
+ free(pChc);
+ if (pChcLast == NULL) {
+ cs->pCursorHideCounts = pNext;
+ }
+ else {
+ pChcLast->pNext = pNext;
+ }
+ return;
+ }
+ pChcLast = pChc;
+ pChc = pNext;
}
}
@@ -857,35 +833,36 @@ deleteCursorHideCount (CursorHideCountPtr pChcToDel, ScreenPtr pScreen)
* Delete all the hide-counts list elements for this screen.
*/
static void
-deleteCursorHideCountsForScreen (ScreenPtr pScreen)
+deleteCursorHideCountsForScreen(ScreenPtr pScreen)
{
- CursorScreenPtr cs = GetCursorScreen(pScreen);
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
CursorHideCountPtr pChc, pTmp;
pChc = cs->pCursorHideCounts;
while (pChc != NULL) {
- pTmp = pChc->pNext;
- FreeResource(pChc->resource, 0);
- pChc = pTmp;
+ pTmp = pChc->pNext;
+ FreeResource(pChc->resource, 0);
+ pChc = pTmp;
}
- cs->pCursorHideCounts = NULL;
+ cs->pCursorHideCounts = NULL;
}
-int
-ProcXFixesHideCursor (ClientPtr client)
+int
+ProcXFixesHideCursor(ClientPtr client)
{
WindowPtr pWin;
CursorHideCountPtr pChc;
+
REQUEST(xXFixesHideCursorReq);
int ret;
- REQUEST_SIZE_MATCH (xXFixesHideCursorReq);
+ REQUEST_SIZE_MATCH(xXFixesHideCursorReq);
- ret = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
- client, DixGetAttrAccess);
+ ret = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW,
+ client, DixGetAttrAccess);
if (ret != Success) {
- client->errorValue = stuff->window;
- return ret;
+ client->errorValue = stuff->window;
+ return ret;
}
/*
@@ -895,8 +872,8 @@ ProcXFixesHideCursor (ClientPtr client)
pChc = findCursorHideCount(client, pWin->drawable.pScreen);
if (pChc != NULL) {
- pChc->hideCount++;
- return Success;
+ pChc->hideCount++;
+ return Success;
}
/*
@@ -904,50 +881,52 @@ ProcXFixesHideCursor (ClientPtr client)
* for this screen.
*/
ret = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
- DixHideAccess);
+ DixHideAccess);
if (ret != Success)
- return ret;
+ return ret;
ret = createCursorHideCount(client, pWin->drawable.pScreen);
if (ret == Success) {
- DeviceIntPtr dev;
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (IsMaster(dev) && IsPointerDevice(dev))
- CursorDisplayCursor(dev, pWin->drawable.pScreen, CursorCurrent[dev->id]);
- }
+ DeviceIntPtr dev;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (IsMaster(dev) && IsPointerDevice(dev))
+ CursorDisplayCursor(dev, pWin->drawable.pScreen,
+ CursorCurrent[dev->id]);
+ }
}
return ret;
}
-int
-SProcXFixesHideCursor (ClientPtr client)
+int
+SProcXFixesHideCursor(ClientPtr client)
{
REQUEST(xXFixesHideCursorReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesHideCursorReq);
+ REQUEST_SIZE_MATCH(xXFixesHideCursorReq);
swapl(&stuff->window);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-int
-ProcXFixesShowCursor (ClientPtr client)
+int
+ProcXFixesShowCursor(ClientPtr client)
{
WindowPtr pWin;
CursorHideCountPtr pChc;
int rc;
+
REQUEST(xXFixesShowCursorReq);
- REQUEST_SIZE_MATCH (xXFixesShowCursorReq);
+ REQUEST_SIZE_MATCH(xXFixesShowCursorReq);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
- client, DixGetAttrAccess);
+ rc = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW,
+ client, DixGetAttrAccess);
if (rc != Success) {
- client->errorValue = stuff->window;
- return rc;
+ client->errorValue = stuff->window;
+ return rc;
}
/*
@@ -956,61 +935,58 @@ ProcXFixesShowCursor (ClientPtr client)
*/
pChc = findCursorHideCount(client, pWin->drawable.pScreen);
if (pChc == NULL) {
- return BadMatch;
+ return BadMatch;
}
rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
- DixShowAccess);
+ DixShowAccess);
if (rc != Success)
- return rc;
+ return rc;
pChc->hideCount--;
if (pChc->hideCount <= 0) {
- FreeResource(pChc->resource, 0);
+ FreeResource(pChc->resource, 0);
}
return Success;
}
-int
-SProcXFixesShowCursor (ClientPtr client)
+int
+SProcXFixesShowCursor(ClientPtr client)
{
REQUEST(xXFixesShowCursorReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesShowCursorReq);
+ REQUEST_SIZE_MATCH(xXFixesShowCursorReq);
swapl(&stuff->window);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
static int
-CursorFreeClient (pointer data, XID id)
+CursorFreeClient(pointer data, XID id)
{
- CursorEventPtr old = (CursorEventPtr) data;
- CursorEventPtr *prev, e;
-
- for (prev = &cursorEvents; (e = *prev); prev = &e->next)
- {
- if (e == old)
- {
- *prev = e->next;
- free(e);
- break;
- }
+ CursorEventPtr old = (CursorEventPtr) data;
+ CursorEventPtr *prev, e;
+
+ for (prev = &cursorEvents; (e = *prev); prev = &e->next) {
+ if (e == old) {
+ *prev = e->next;
+ free(e);
+ break;
+ }
}
return 1;
}
static int
-CursorFreeHideCount (pointer data, XID id)
+CursorFreeHideCount(pointer data, XID id)
{
CursorHideCountPtr pChc = (CursorHideCountPtr) data;
ScreenPtr pScreen = pChc->pScreen;
DeviceIntPtr dev;
deleteCursorHideCount(pChc, pChc->pScreen);
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
if (IsMaster(dev) && IsPointerDevice(dev))
CursorDisplayCursor(dev, pScreen, CursorCurrent[dev->id]);
}
@@ -1019,18 +995,16 @@ CursorFreeHideCount (pointer data, XID id)
}
static int
-CursorFreeWindow (pointer data, XID id)
+CursorFreeWindow(pointer data, XID id)
{
- WindowPtr pWindow = (WindowPtr) data;
- CursorEventPtr e, next;
+ WindowPtr pWindow = (WindowPtr) data;
+ CursorEventPtr e, next;
- for (e = cursorEvents; e; e = next)
- {
- next = e->next;
- if (e->pWindow == pWindow)
- {
- FreeResource (e->clientResource, 0);
- }
+ for (e = cursorEvents; e; e = next) {
+ next = e->next;
+ if (e->pWindow == pWindow) {
+ FreeResource(e->clientResource, 0);
+ }
}
return 1;
}
@@ -1058,13 +1032,13 @@ barrier_get_direction(int x1, int y1, int x2, int y2)
/* which way are we trying to go */
if (x2 > x1)
- direction |= BarrierPositiveX;
+ direction |= BarrierPositiveX;
if (x2 < x1)
- direction |= BarrierNegativeX;
+ direction |= BarrierNegativeX;
if (y2 > y1)
- direction |= BarrierPositiveY;
+ direction |= BarrierPositiveY;
if (y2 < y1)
- direction |= BarrierNegativeY;
+ direction |= BarrierNegativeY;
return direction;
}
@@ -1078,7 +1052,8 @@ barrier_get_direction(int x1, int y1, int x2, int y2)
* otherwise.
*/
BOOL
-barrier_is_blocking_direction(const struct PointerBarrier *barrier, int direction)
+barrier_is_blocking_direction(const struct PointerBarrier * barrier,
+ int direction)
{
/* Barriers define which way is ok, not which way is blocking */
return (barrier->directions & direction) != direction;
@@ -1098,9 +1073,8 @@ barrier_is_blocking_direction(const struct PointerBarrier *barrier, int directio
* @return TRUE if the barrier intersects with the given vector
*/
BOOL
-barrier_is_blocking(const struct PointerBarrier *barrier,
- int x1, int y1, int x2, int y2,
- double *distance)
+barrier_is_blocking(const struct PointerBarrier * barrier,
+ int x1, int y1, int x2, int y2, double *distance)
{
BOOL rc = FALSE;
float ua, ub, ud;
@@ -1109,48 +1083,49 @@ barrier_is_blocking(const struct PointerBarrier *barrier,
/* Algorithm below doesn't handle edge cases well, hence the extra
* checks. */
if (barrier_is_vertical(barrier)) {
- /* handle immediate barrier adjacency, moving away */
- if (dir & BarrierPositiveX && x1 == barrier->x1)
- return FALSE;
- if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1))
- return FALSE;
- /* startpoint adjacent to barrier, moving towards -> block */
- if (x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
- *distance = 0;
- return TRUE;
- }
- } else {
- /* handle immediate barrier adjacency, moving away */
- if (dir & BarrierPositiveY && y1 == barrier->y1)
- return FALSE;
- if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1))
- return FALSE;
- /* startpoint adjacent to barrier, moving towards -> block */
- if (y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
- *distance = 0;
- return TRUE;
+ /* handle immediate barrier adjacency, moving away */
+ if (dir & BarrierPositiveX && x1 == barrier->x1)
+ return FALSE;
+ if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1))
+ return FALSE;
+ /* startpoint adjacent to barrier, moving towards -> block */
+ if (x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
+ *distance = 0;
+ return TRUE;
+ }
+ }
+ else {
+ /* handle immediate barrier adjacency, moving away */
+ if (dir & BarrierPositiveY && y1 == barrier->y1)
+ return FALSE;
+ if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1))
+ return FALSE;
+ /* startpoint adjacent to barrier, moving towards -> block */
+ if (y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
+ *distance = 0;
+ return TRUE;
}
}
/* not an edge case, compute distance */
ua = 0;
- ud = (barrier->y2 - barrier->y1) * (x2 - x1) - (barrier->x2 - barrier->x1) * (y2 - y1);
+ ud = (barrier->y2 - barrier->y1) * (x2 - x1) - (barrier->x2 -
+ barrier->x1) * (y2 - y1);
if (ud != 0) {
- ua = ((barrier->x2 - barrier->x1) * (y1 - barrier->y1) -
- (barrier->y2 - barrier->y1) * (x1 - barrier->x1)) / ud;
- ub = ((x2 - x1) * (y1 - barrier->y1) -
- (y2 - y1) * (x1 - barrier->x1)) / ud;
- if (ua < 0 || ua > 1 || ub < 0 || ub > 1)
- ua = 0;
+ ua = ((barrier->x2 - barrier->x1) * (y1 - barrier->y1) -
+ (barrier->y2 - barrier->y1) * (x1 - barrier->x1)) / ud;
+ ub = ((x2 - x1) * (y1 - barrier->y1) -
+ (y2 - y1) * (x1 - barrier->x1)) / ud;
+ if (ua < 0 || ua > 1 || ub < 0 || ub > 1)
+ ua = 0;
}
- if (ua > 0 && ua <= 1)
- {
- double ix = barrier->x1 + ua * (barrier->x2 - barrier->x1);
- double iy = barrier->y1 + ua * (barrier->y2 - barrier->y1);
+ if (ua > 0 && ua <= 1) {
+ double ix = barrier->x1 + ua * (barrier->x2 - barrier->x1);
+ double iy = barrier->y1 + ua * (barrier->y2 - barrier->y1);
- *distance = sqrt(pow(x1 - ix, 2) + pow(y1 - iy, 2));
- rc = TRUE;
+ *distance = sqrt(pow(x1 - ix, 2) + pow(y1 - iy, 2));
+ rc = TRUE;
}
return rc;
@@ -1166,29 +1141,27 @@ barrier_is_blocking(const struct PointerBarrier *barrier,
* @param y2 Y end coordinate of movement vector
* @return The barrier nearest to the movement origin that blocks this movement.
*/
-static struct PointerBarrier*
+static struct PointerBarrier *
barrier_find_nearest(CursorScreenPtr cs, int dir,
- int x1, int y1, int x2, int y2)
+ int x1, int y1, int x2, int y2)
{
struct PointerBarrierClient *c = NULL;
struct PointerBarrier *nearest = NULL;
- double min_distance = INT_MAX; /* can't get higher than that in X anyway */
+ double min_distance = INT_MAX; /* can't get higher than that in X anyway */
xorg_list_for_each_entry(c, &cs->barriers, entry) {
- struct PointerBarrier *b = &c->barrier;
- double distance;
-
- if (!barrier_is_blocking_direction(b, dir))
- continue;
-
- if (barrier_is_blocking(b, x1, y1, x2, y2, &distance))
- {
- if (min_distance > distance)
- {
- min_distance = distance;
- nearest = b;
- }
- }
+ struct PointerBarrier *b = &c->barrier;
+ double distance;
+
+ if (!barrier_is_blocking_direction(b, dir))
+ continue;
+
+ if (barrier_is_blocking(b, x1, y1, x2, y2, &distance)) {
+ if (min_distance > distance) {
+ min_distance = distance;
+ nearest = b;
+ }
+ }
}
return nearest;
@@ -1203,117 +1176,120 @@ barrier_find_nearest(CursorScreenPtr cs, int dir,
* @param[out] y The clamped x coordinate.
*/
void
-barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, int *y)
+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
+ int *y)
{
- if (barrier_is_vertical(barrier))
- {
- if ((dir & BarrierNegativeX) & ~barrier->directions)
- *x = barrier->x1;
- if ((dir & BarrierPositiveX) & ~barrier->directions)
- *x = barrier->x1 - 1;
+ if (barrier_is_vertical(barrier)) {
+ if ((dir & BarrierNegativeX) & ~barrier->directions)
+ *x = barrier->x1;
+ if ((dir & BarrierPositiveX) & ~barrier->directions)
+ *x = barrier->x1 - 1;
}
- if (barrier_is_horizontal(barrier))
- {
- if ((dir & BarrierNegativeY) & ~barrier->directions)
- *y = barrier->y1;
- if ((dir & BarrierPositiveY) & ~barrier->directions)
- *y = barrier->y1 - 1;
+ if (barrier_is_horizontal(barrier)) {
+ if ((dir & BarrierNegativeY) & ~barrier->directions)
+ *y = barrier->y1;
+ if ((dir & BarrierPositiveY) & ~barrier->directions)
+ *y = barrier->y1 - 1;
}
}
static void
-CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x, int *y)
+CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
+ int *x, int *y)
{
CursorScreenPtr cs = GetCursorScreen(screen);
- if (!xorg_list_is_empty(&cs->barriers) && !IsFloating(dev) && mode == Relative) {
- int ox, oy;
- int dir;
- struct PointerBarrier *nearest = NULL;
-
- /* where are we coming from */
- miPointerGetPosition(dev, &ox, &oy);
-
- /* How this works:
- * Given the origin and the movement vector, get the nearest barrier
- * to the origin that is blocking the movement.
- * Clamp to that barrier.
- * Then, check from the clamped intersection to the original
- * destination, again finding the nearest barrier and clamping.
- */
- dir = barrier_get_direction(ox, oy, *x, *y);
-
- nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
- if (nearest) {
- barrier_clamp_to_barrier(nearest, dir, x, y);
-
- if (barrier_is_vertical(nearest)) {
- dir &= ~(BarrierNegativeX | BarrierPositiveX);
- ox = *x;
- } else if (barrier_is_horizontal(nearest)) {
- dir &= ~(BarrierNegativeY | BarrierPositiveY);
- oy = *y;
- }
-
- nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
- if (nearest) {
- barrier_clamp_to_barrier(nearest, dir, x, y);
- }
- }
+ if (!xorg_list_is_empty(&cs->barriers) && !IsFloating(dev) &&
+ mode == Relative) {
+ int ox, oy;
+ int dir;
+ struct PointerBarrier *nearest = NULL;
+
+ /* where are we coming from */
+ miPointerGetPosition(dev, &ox, &oy);
+
+ /* How this works:
+ * Given the origin and the movement vector, get the nearest barrier
+ * to the origin that is blocking the movement.
+ * Clamp to that barrier.
+ * Then, check from the clamped intersection to the original
+ * destination, again finding the nearest barrier and clamping.
+ */
+ dir = barrier_get_direction(ox, oy, *x, *y);
+
+ nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
+ if (nearest) {
+ barrier_clamp_to_barrier(nearest, dir, x, y);
+
+ if (barrier_is_vertical(nearest)) {
+ dir &= ~(BarrierNegativeX | BarrierPositiveX);
+ ox = *x;
+ }
+ else if (barrier_is_horizontal(nearest)) {
+ dir &= ~(BarrierNegativeY | BarrierPositiveY);
+ oy = *y;
+ }
+
+ nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
+ if (nearest) {
+ barrier_clamp_to_barrier(nearest, dir, x, y);
+ }
+ }
}
if (cs->ConstrainCursorHarder) {
- screen->ConstrainCursorHarder = cs->ConstrainCursorHarder;
- screen->ConstrainCursorHarder(dev, screen, mode, x, y);
- screen->ConstrainCursorHarder = CursorConstrainCursorHarder;
+ screen->ConstrainCursorHarder = cs->ConstrainCursorHarder;
+ screen->ConstrainCursorHarder(dev, screen, mode, x, y);
+ screen->ConstrainCursorHarder = CursorConstrainCursorHarder;
}
}
static struct PointerBarrierClient *
CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
- xXFixesCreatePointerBarrierReq *stuff)
+ xXFixesCreatePointerBarrierReq * stuff)
{
CursorScreenPtr cs = GetCursorScreen(screen);
struct PointerBarrierClient *ret = malloc(sizeof(*ret));
if (ret) {
- ret->screen = screen;
- ret->barrier.x1 = min(stuff->x1, stuff->x2);
- ret->barrier.x2 = max(stuff->x1, stuff->x2);
- ret->barrier.y1 = min(stuff->y1, stuff->y2);
- ret->barrier.y2 = max(stuff->y1, stuff->y2);
- ret->barrier.directions = stuff->directions & 0x0f;
- if (barrier_is_horizontal(&ret->barrier))
- ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
- if (barrier_is_vertical(&ret->barrier))
- ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
- xorg_list_add(&ret->entry, &cs->barriers);
+ ret->screen = screen;
+ ret->barrier.x1 = min(stuff->x1, stuff->x2);
+ ret->barrier.x2 = max(stuff->x1, stuff->x2);
+ ret->barrier.y1 = min(stuff->y1, stuff->y2);
+ ret->barrier.y2 = max(stuff->y1, stuff->y2);
+ ret->barrier.directions = stuff->directions & 0x0f;
+ if (barrier_is_horizontal(&ret->barrier))
+ ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
+ if (barrier_is_vertical(&ret->barrier))
+ ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
+ xorg_list_add(&ret->entry, &cs->barriers);
}
return ret;
}
int
-ProcXFixesCreatePointerBarrier (ClientPtr client)
+ProcXFixesCreatePointerBarrier(ClientPtr client)
{
int err;
WindowPtr pWin;
struct PointerBarrierClient *barrier;
struct PointerBarrier b;
- REQUEST (xXFixesCreatePointerBarrierReq);
+
+ REQUEST(xXFixesCreatePointerBarrierReq);
REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
LEGAL_NEW_RESOURCE(stuff->barrier, client);
err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
if (err != Success) {
- client->errorValue = stuff->window;
- return err;
+ client->errorValue = stuff->window;
+ return err;
}
/* This sure does need fixing. */
if (stuff->num_devices)
- return BadImplementation;
+ return BadImplementation;
b.x1 = stuff->x1;
b.x2 = stuff->x2;
@@ -1321,24 +1297,24 @@ ProcXFixesCreatePointerBarrier (ClientPtr client)
b.y2 = stuff->y2;
if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b))
- return BadValue;
+ return BadValue;
/* no 0-sized barriers */
if (barrier_is_horizontal(&b) && barrier_is_vertical(&b))
- return BadValue;
+ return BadValue;
if (!(barrier = CreatePointerBarrierClient(pWin->drawable.pScreen,
- client, stuff)))
- return BadAlloc;
+ client, stuff)))
+ return BadAlloc;
if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier))
- return BadAlloc;
+ return BadAlloc;
return Success;
}
int
-SProcXFixesCreatePointerBarrier (ClientPtr client)
+SProcXFixesCreatePointerBarrier(ClientPtr client)
{
REQUEST(xXFixesCreatePointerBarrierReq);
@@ -1351,7 +1327,7 @@ SProcXFixesCreatePointerBarrier (ClientPtr client)
swaps(&stuff->x2);
swaps(&stuff->y2);
swapl(&stuff->directions);
- return ProcXFixesVector[stuff->xfixesReqType](client);
+ return ProcXFixesVector[stuff->xfixesReqType] (client);
}
static int
@@ -1362,15 +1338,16 @@ CursorFreeBarrier(void *data, XID id)
CursorScreenPtr cs;
barrier = container_of(data, struct PointerBarrierClient, barrier);
+
screen = barrier->screen;
cs = GetCursorScreen(screen);
/* find and unlink from the screen private */
xorg_list_for_each_entry(b, &cs->barriers, entry) {
- if (b == barrier) {
- xorg_list_del(&b->entry);
- break;
- }
+ if (b == barrier) {
+ xorg_list_del(&b->entry);
+ break;
+ }
}
free(barrier);
@@ -1378,20 +1355,20 @@ CursorFreeBarrier(void *data, XID id)
}
int
-ProcXFixesDestroyPointerBarrier (ClientPtr client)
+ProcXFixesDestroyPointerBarrier(ClientPtr client)
{
int err;
void *barrier;
- REQUEST (xXFixesDestroyPointerBarrierReq);
+
+ REQUEST(xXFixesDestroyPointerBarrierReq);
REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
- err = dixLookupResourceByType((void **)&barrier, stuff->barrier,
- PointerBarrierType, client,
- DixDestroyAccess);
+ err = dixLookupResourceByType((void **) &barrier, stuff->barrier,
+ PointerBarrierType, client, DixDestroyAccess);
if (err != Success) {
- client->errorValue = stuff->barrier;
- return err;
+ client->errorValue = stuff->barrier;
+ return err;
}
FreeResource(stuff->barrier, RT_NONE);
@@ -1399,52 +1376,50 @@ ProcXFixesDestroyPointerBarrier (ClientPtr client)
}
int
-SProcXFixesDestroyPointerBarrier (ClientPtr client)
+SProcXFixesDestroyPointerBarrier(ClientPtr client)
{
REQUEST(xXFixesDestroyPointerBarrierReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
swapl(&stuff->barrier);
- return ProcXFixesVector[stuff->xfixesReqType](client);
+ return ProcXFixesVector[stuff->xfixesReqType] (client);
}
Bool
-XFixesCursorInit (void)
+XFixesCursorInit(void)
{
- int i;
+ int i;
if (party_like_its_1989)
- CursorVisible = EnableCursor;
-
- if (!dixRegisterPrivateKey(&CursorScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ CursorVisible = EnableCursor;
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen = screenInfo.screens[i];
- CursorScreenPtr cs;
-
- cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec));
- if (!cs)
- return FALSE;
- xorg_list_init(&cs->barriers);
- Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
- Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor);
- Wrap (cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);
- cs->pCursorHideCounts = NULL;
- SetCursorScreen (pScreen, cs);
+ if (!dixRegisterPrivateKey(&CursorScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ CursorScreenPtr cs;
+
+ cs = (CursorScreenPtr) calloc(1, sizeof(CursorScreenRec));
+ if (!cs)
+ return FALSE;
+ xorg_list_init(&cs->barriers);
+ Wrap(cs, pScreen, CloseScreen, CursorCloseScreen);
+ Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor);
+ Wrap(cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);
+ cs->pCursorHideCounts = NULL;
+ SetCursorScreen(pScreen, cs);
}
CursorClientType = CreateNewResourceType(CursorFreeClient,
- "XFixesCursorClient");
+ "XFixesCursorClient");
CursorHideCountType = CreateNewResourceType(CursorFreeHideCount,
- "XFixesCursorHideCount");
+ "XFixesCursorHideCount");
CursorWindowType = CreateNewResourceType(CursorFreeWindow,
- "XFixesCursorWindow");
+ "XFixesCursorWindow");
PointerBarrierType = CreateNewResourceType(CursorFreeBarrier,
- "XFixesPointerBarrier");
+ "XFixesPointerBarrier");
return CursorClientType && CursorHideCountType && CursorWindowType &&
- PointerBarrierType;
+ PointerBarrierType;
}
-
diff --git a/xorg-server/xfixes/region.c b/xorg-server/xfixes/region.c
index 4c2263702..624109de1 100644
--- a/xorg-server/xfixes/region.c
+++ b/xorg-server/xfixes/region.c
@@ -28,6 +28,7 @@
#include "scrnintstr.h"
#include <picturestr.h>
extern int RenderErrBase;
+
#include <regionstr.h>
#include <gcstruct.h>
#include <window.h>
@@ -35,31 +36,31 @@ extern int RenderErrBase;
RESTYPE RegionResType;
static int
-RegionResFree (pointer data, XID id)
+RegionResFree(pointer data, XID id)
{
- RegionPtr pRegion = (RegionPtr) data;
+ RegionPtr pRegion = (RegionPtr) data;
RegionDestroy(pRegion);
return Success;
}
RegionPtr
-XFixesRegionCopy (RegionPtr pRegion)
+XFixesRegionCopy(RegionPtr pRegion)
{
- RegionPtr pNew = RegionCreate(RegionExtents(pRegion),
- RegionNumRects(pRegion));
+ RegionPtr pNew = RegionCreate(RegionExtents(pRegion),
+ RegionNumRects(pRegion));
+
if (!pNew)
- return 0;
- if (!RegionCopy(pNew, pRegion))
- {
- RegionDestroy(pNew);
- return 0;
+ return 0;
+ if (!RegionCopy(pNew, pRegion)) {
+ RegionDestroy(pNew);
+ return 0;
}
return pNew;
}
Bool
-XFixesRegionInit (void)
+XFixesRegionInit(void)
{
RegionResType = CreateNewResourceType(RegionResFree, "XFixesRegion");
@@ -67,34 +68,35 @@ XFixesRegionInit (void)
}
int
-ProcXFixesCreateRegion (ClientPtr client)
+ProcXFixesCreateRegion(ClientPtr client)
{
- int things;
- RegionPtr pRegion;
- REQUEST (xXFixesCreateRegionReq);
-
+ int things;
+ RegionPtr pRegion;
+
+ REQUEST(xXFixesCreateRegionReq);
+
REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
-
- things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+
+ things = (client->req_len << 2) - sizeof(xXFixesCreateRegionReq);
if (things & 4)
- return BadLength;
+ return BadLength;
things >>= 3;
pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
if (!pRegion)
- return BadAlloc;
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+ return BadAlloc;
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegion (ClientPtr client)
+SProcXFixesCreateRegion(ClientPtr client)
{
REQUEST(xXFixesCreateRegionReq);
-
+
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);
swapl(&stuff->region);
@@ -103,221 +105,221 @@ SProcXFixesCreateRegion (ClientPtr client)
}
int
-ProcXFixesCreateRegionFromBitmap (ClientPtr client)
+ProcXFixesCreateRegionFromBitmap(ClientPtr client)
{
- RegionPtr pRegion;
- PixmapPtr pPixmap;
+ RegionPtr pRegion;
+ PixmapPtr pPixmap;
int rc;
- REQUEST (xXFixesCreateRegionFromBitmapReq);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
+ REQUEST(xXFixesCreateRegionFromBitmapReq);
- rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->bitmap, RT_PIXMAP,
- client, DixReadAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->bitmap;
- return rc;
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+
+ rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->bitmap, RT_PIXMAP,
+ client, DixReadAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->bitmap;
+ return rc;
}
if (pPixmap->drawable.depth != 1)
- return BadMatch;
+ return BadMatch;
pRegion = BitmapToRegion(pPixmap->drawable.pScreen, pPixmap);
if (!pRegion)
- return BadAlloc;
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+ return BadAlloc;
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromBitmap (ClientPtr client)
+SProcXFixesCreateRegionFromBitmap(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromBitmapReq);
+ REQUEST(xXFixesCreateRegionFromBitmapReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
swapl(&stuff->region);
swapl(&stuff->bitmap);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesCreateRegionFromWindow (ClientPtr client)
+ProcXFixesCreateRegionFromWindow(ClientPtr client)
{
- RegionPtr pRegion;
- Bool copy = TRUE;
- WindowPtr pWin;
+ RegionPtr pRegion;
+ Bool copy = TRUE;
+ WindowPtr pWin;
int rc;
- REQUEST (xXFixesCreateRegionFromWindowReq);
-
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
- client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- return rc;
+
+ REQUEST(xXFixesCreateRegionFromWindowReq);
+
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+ rc = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW,
+ client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->window;
+ return rc;
}
switch (stuff->kind) {
case WindowRegionBounding:
- pRegion = wBoundingShape(pWin);
- if (!pRegion)
- {
- pRegion = CreateBoundingShape (pWin);
- copy = FALSE;
- }
- break;
+ pRegion = wBoundingShape(pWin);
+ if (!pRegion) {
+ pRegion = CreateBoundingShape(pWin);
+ copy = FALSE;
+ }
+ break;
case WindowRegionClip:
- pRegion = wClipShape(pWin);
- if (!pRegion)
- {
- pRegion = CreateClipShape (pWin);
- copy = FALSE;
- }
- break;
+ pRegion = wClipShape(pWin);
+ if (!pRegion) {
+ pRegion = CreateClipShape(pWin);
+ copy = FALSE;
+ }
+ break;
default:
- client->errorValue = stuff->kind;
- return BadValue;
+ client->errorValue = stuff->kind;
+ return BadValue;
}
if (copy && pRegion)
- pRegion = XFixesRegionCopy (pRegion);
+ pRegion = XFixesRegionCopy(pRegion);
if (!pRegion)
- return BadAlloc;
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+ return BadAlloc;
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromWindow (ClientPtr client)
+SProcXFixesCreateRegionFromWindow(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromWindowReq);
+ REQUEST(xXFixesCreateRegionFromWindowReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
swapl(&stuff->region);
swapl(&stuff->window);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesCreateRegionFromGC (ClientPtr client)
+ProcXFixesCreateRegionFromGC(ClientPtr client)
{
- RegionPtr pRegion, pClip;
- GCPtr pGC;
- int rc;
- REQUEST (xXFixesCreateRegionFromGCReq);
+ RegionPtr pRegion, pClip;
+ GCPtr pGC;
+ int rc;
+
+ REQUEST(xXFixesCreateRegionFromGCReq);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
rc = dixLookupGC(&pGC, stuff->gc, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
-
+ return rc;
+
switch (pGC->clientClipType) {
case CT_PIXMAP:
- pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
case CT_REGION:
- pClip = (RegionPtr) pGC->clientClip;
- pRegion = XFixesRegionCopy (pClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pClip = (RegionPtr) pGC->clientClip;
+ pRegion = XFixesRegionCopy(pClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
default:
- return BadImplementation; /* assume sane server bits */
+ return BadImplementation; /* assume sane server bits */
}
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromGC (ClientPtr client)
+SProcXFixesCreateRegionFromGC(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromGCReq);
+ REQUEST(xXFixesCreateRegionFromGCReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq);
swapl(&stuff->region);
swapl(&stuff->gc);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesCreateRegionFromPicture (ClientPtr client)
+ProcXFixesCreateRegionFromPicture(ClientPtr client)
{
- RegionPtr pRegion;
- PicturePtr pPicture;
- REQUEST (xXFixesCreateRegionFromPictureReq);
+ RegionPtr pRegion;
+ PicturePtr pPicture;
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
+ REQUEST(xXFixesCreateRegionFromPictureReq);
+
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess);
-
+
switch (pPicture->clientClipType) {
case CT_PIXMAP:
- pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
- (PixmapPtr) pPicture->clientClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
+ (PixmapPtr) pPicture->clientClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
case CT_REGION:
- pRegion = XFixesRegionCopy ((RegionPtr) pPicture->clientClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pRegion = XFixesRegionCopy((RegionPtr) pPicture->clientClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
default:
- return BadImplementation; /* assume sane server bits */
+ return BadImplementation; /* assume sane server bits */
}
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromPicture (ClientPtr client)
+SProcXFixesCreateRegionFromPicture(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromPictureReq);
+ REQUEST(xXFixesCreateRegionFromPictureReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq);
swapl(&stuff->region);
swapl(&stuff->picture);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesDestroyRegion (ClientPtr client)
+ProcXFixesDestroyRegion(ClientPtr client)
{
- REQUEST (xXFixesDestroyRegionReq);
- RegionPtr pRegion;
+ REQUEST(xXFixesDestroyRegionReq);
+ RegionPtr pRegion;
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
- FreeResource (stuff->region, RT_NONE);
+ FreeResource(stuff->region, RT_NONE);
return Success;
}
int
-SProcXFixesDestroyRegion (ClientPtr client)
+SProcXFixesDestroyRegion(ClientPtr client)
{
- REQUEST (xXFixesDestroyRegionReq);
+ REQUEST(xXFixesDestroyRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
@@ -326,36 +328,36 @@ SProcXFixesDestroyRegion (ClientPtr client)
}
int
-ProcXFixesSetRegion (ClientPtr client)
+ProcXFixesSetRegion(ClientPtr client)
{
- int things;
- RegionPtr pRegion, pNew;
- REQUEST (xXFixesSetRegionReq);
+ int things;
+ RegionPtr pRegion, pNew;
+
+ REQUEST(xXFixesSetRegionReq);
REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
-
- things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq);
+
+ things = (client->req_len << 2) - sizeof(xXFixesCreateRegionReq);
if (things & 4)
- return BadLength;
+ return BadLength;
things >>= 3;
pNew = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
if (!pNew)
- return BadAlloc;
- if (!RegionCopy(pRegion, pNew))
- {
- RegionDestroy(pNew);
- return BadAlloc;
+ return BadAlloc;
+ if (!RegionCopy(pRegion, pNew)) {
+ RegionDestroy(pNew);
+ return BadAlloc;
}
RegionDestroy(pNew);
return Success;
}
int
-SProcXFixesSetRegion (ClientPtr client)
+SProcXFixesSetRegion(ClientPtr client)
{
- REQUEST (xXFixesSetRegionReq);
+ REQUEST(xXFixesSetRegionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq);
@@ -365,24 +367,25 @@ SProcXFixesSetRegion (ClientPtr client)
}
int
-ProcXFixesCopyRegion (ClientPtr client)
+ProcXFixesCopyRegion(ClientPtr client)
{
- RegionPtr pSource, pDestination;
- REQUEST (xXFixesCopyRegionReq);
-
+ RegionPtr pSource, pDestination;
+
+ REQUEST(xXFixesCopyRegionReq);
+
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
-
+
if (!RegionCopy(pDestination, pSource))
- return BadAlloc;
+ return BadAlloc;
return Success;
}
int
-SProcXFixesCopyRegion (ClientPtr client)
+SProcXFixesCopyRegion(ClientPtr client)
{
- REQUEST (xXFixesCopyRegionReq);
+ REQUEST(xXFixesCopyRegionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq);
@@ -392,41 +395,42 @@ SProcXFixesCopyRegion (ClientPtr client)
}
int
-ProcXFixesCombineRegion (ClientPtr client)
+ProcXFixesCombineRegion(ClientPtr client)
{
- RegionPtr pSource1, pSource2, pDestination;
- REQUEST (xXFixesCombineRegionReq);
+ RegionPtr pSource1, pSource2, pDestination;
- REQUEST_SIZE_MATCH (xXFixesCombineRegionReq);
+ REQUEST(xXFixesCombineRegionReq);
+
+ REQUEST_SIZE_MATCH(xXFixesCombineRegionReq);
VERIFY_REGION(pSource1, stuff->source1, client, DixReadAccess);
VERIFY_REGION(pSource2, stuff->source2, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
-
+
switch (stuff->xfixesReqType) {
case X_XFixesUnionRegion:
- if (!RegionUnion(pDestination, pSource1, pSource2))
- return BadAlloc;
- break;
+ if (!RegionUnion(pDestination, pSource1, pSource2))
+ return BadAlloc;
+ break;
case X_XFixesIntersectRegion:
- if (!RegionIntersect(pDestination, pSource1, pSource2))
- return BadAlloc;
- break;
+ if (!RegionIntersect(pDestination, pSource1, pSource2))
+ return BadAlloc;
+ break;
case X_XFixesSubtractRegion:
- if (!RegionSubtract(pDestination, pSource1, pSource2))
- return BadAlloc;
- break;
+ if (!RegionSubtract(pDestination, pSource1, pSource2))
+ return BadAlloc;
+ break;
}
-
+
return Success;
}
int
-SProcXFixesCombineRegion (ClientPtr client)
+SProcXFixesCombineRegion(ClientPtr client)
{
- REQUEST (xXFixesCombineRegionReq);
+ REQUEST(xXFixesCombineRegionReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCombineRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesCombineRegionReq);
swapl(&stuff->source1);
swapl(&stuff->source2);
swapl(&stuff->destination);
@@ -434,10 +438,11 @@ SProcXFixesCombineRegion (ClientPtr client)
}
int
-ProcXFixesInvertRegion (ClientPtr client)
+ProcXFixesInvertRegion(ClientPtr client)
{
- RegionPtr pSource, pDestination;
- BoxRec bounds;
+ RegionPtr pSource, pDestination;
+ BoxRec bounds;
+
REQUEST(xXFixesInvertRegionReq);
REQUEST_SIZE_MATCH(xXFixesInvertRegionReq);
@@ -448,23 +453,23 @@ ProcXFixesInvertRegion (ClientPtr client)
bounds.x1 = stuff->x;
bounds.y1 = stuff->y;
if ((int) stuff->x + (int) stuff->width > MAXSHORT)
- bounds.x2 = MAXSHORT;
+ bounds.x2 = MAXSHORT;
else
- bounds.x2 = stuff->x + stuff->width;
-
+ bounds.x2 = stuff->x + stuff->width;
+
if ((int) stuff->y + (int) stuff->height > MAXSHORT)
- bounds.y2 = MAXSHORT;
+ bounds.y2 = MAXSHORT;
else
- bounds.y2 = stuff->y + stuff->height;
+ bounds.y2 = stuff->y + stuff->height;
if (!RegionInverse(pDestination, pSource, &bounds))
- return BadAlloc;
+ return BadAlloc;
return Success;
}
int
-SProcXFixesInvertRegion (ClientPtr client)
+SProcXFixesInvertRegion(ClientPtr client)
{
REQUEST(xXFixesInvertRegionReq);
@@ -480,9 +485,10 @@ SProcXFixesInvertRegion (ClientPtr client)
}
int
-ProcXFixesTranslateRegion (ClientPtr client)
+ProcXFixesTranslateRegion(ClientPtr client)
{
- RegionPtr pRegion;
+ RegionPtr pRegion;
+
REQUEST(xXFixesTranslateRegionReq);
REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq);
@@ -493,7 +499,7 @@ ProcXFixesTranslateRegion (ClientPtr client)
}
int
-SProcXFixesTranslateRegion (ClientPtr client)
+SProcXFixesTranslateRegion(ClientPtr client)
{
REQUEST(xXFixesTranslateRegionReq);
@@ -506,9 +512,10 @@ SProcXFixesTranslateRegion (ClientPtr client)
}
int
-ProcXFixesRegionExtents (ClientPtr client)
+ProcXFixesRegionExtents(ClientPtr client)
{
- RegionPtr pSource, pDestination;
+ RegionPtr pSource, pDestination;
+
REQUEST(xXFixesRegionExtentsReq);
REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq);
@@ -521,10 +528,10 @@ ProcXFixesRegionExtents (ClientPtr client)
}
int
-SProcXFixesRegionExtents (ClientPtr client)
+SProcXFixesRegionExtents(ClientPtr client)
{
REQUEST(xXFixesRegionExtentsReq);
-
+
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq);
swapl(&stuff->source);
@@ -533,27 +540,27 @@ SProcXFixesRegionExtents (ClientPtr client)
}
int
-ProcXFixesFetchRegion (ClientPtr client)
+ProcXFixesFetchRegion(ClientPtr client)
{
- RegionPtr pRegion;
+ RegionPtr pRegion;
xXFixesFetchRegionReply *reply;
- xRectangle *pRect;
- BoxPtr pExtent;
- BoxPtr pBox;
- int i, nBox;
+ xRectangle *pRect;
+ BoxPtr pExtent;
+ BoxPtr pBox;
+ int i, nBox;
+
REQUEST(xXFixesFetchRegionReq);
REQUEST_SIZE_MATCH(xXFixesFetchRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);
pExtent = RegionExtents(pRegion);
- pBox = RegionRects (pRegion);
- nBox = RegionNumRects (pRegion);
-
- reply = malloc(sizeof (xXFixesFetchRegionReply) +
- nBox * sizeof (xRectangle));
+ pBox = RegionRects(pRegion);
+ nBox = RegionNumRects(pRegion);
+
+ reply = malloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle));
if (!reply)
- return BadAlloc;
+ return BadAlloc;
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = nBox << 1;
@@ -563,31 +570,29 @@ ProcXFixesFetchRegion (ClientPtr client)
reply->height = pExtent->y2 - pExtent->y1;
pRect = (xRectangle *) (reply + 1);
- for (i = 0; i < nBox; i++)
- {
- pRect[i].x = pBox[i].x1;
- pRect[i].y = pBox[i].y1;
- pRect[i].width = pBox[i].x2 - pBox[i].x1;
- pRect[i].height = pBox[i].y2 - pBox[i].y1;
+ for (i = 0; i < nBox; i++) {
+ pRect[i].x = pBox[i].x1;
+ pRect[i].y = pBox[i].y1;
+ pRect[i].width = pBox[i].x2 - pBox[i].x1;
+ pRect[i].height = pBox[i].y2 - pBox[i].y1;
}
- if (client->swapped)
- {
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swaps(&reply->x);
- swaps(&reply->y);
- swaps(&reply->width);
- swaps(&reply->height);
- SwapShorts ((INT16 *) pRect, nBox * 4);
+ if (client->swapped) {
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
+ swaps(&reply->x);
+ swaps(&reply->y);
+ swaps(&reply->width);
+ swaps(&reply->height);
+ SwapShorts((INT16 *) pRect, nBox * 4);
}
- (void) WriteToClient(client, sizeof (xXFixesFetchRegionReply) +
- nBox * sizeof (xRectangle), (char *) reply);
+ (void) WriteToClient(client, sizeof(xXFixesFetchRegionReply) +
+ nBox * sizeof(xRectangle), (char *) reply);
free(reply);
return Success;
}
int
-SProcXFixesFetchRegion (ClientPtr client)
+SProcXFixesFetchRegion(ClientPtr client)
{
REQUEST(xXFixesFetchRegionReq);
@@ -598,38 +603,39 @@ SProcXFixesFetchRegion (ClientPtr client)
}
int
-ProcXFixesSetGCClipRegion (ClientPtr client)
+ProcXFixesSetGCClipRegion(ClientPtr client)
{
- GCPtr pGC;
- RegionPtr pRegion;
- ChangeGCVal vals[2];
- int rc;
+ GCPtr pGC;
+ RegionPtr pRegion;
+ ChangeGCVal vals[2];
+ int rc;
+
REQUEST(xXFixesSetGCClipRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
rc = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
- VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, DixReadAccess);
+ VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
- if (pRegion)
- {
- pRegion = XFixesRegionCopy (pRegion);
- if (!pRegion)
- return BadAlloc;
+ if (pRegion) {
+ pRegion = XFixesRegionCopy(pRegion);
+ if (!pRegion)
+ return BadAlloc;
}
-
+
vals[0].val = stuff->xOrigin;
vals[1].val = stuff->yOrigin;
- ChangeGC (NullClient, pGC, GCClipXOrigin|GCClipYOrigin, vals);
- (*pGC->funcs->ChangeClip)(pGC, pRegion ? CT_REGION : CT_NONE, (pointer)pRegion, 0);
+ ChangeGC(NullClient, pGC, GCClipXOrigin | GCClipYOrigin, vals);
+ (*pGC->funcs->ChangeClip) (pGC, pRegion ? CT_REGION : CT_NONE,
+ (pointer) pRegion, 0);
return Success;
}
int
-SProcXFixesSetGCClipRegion (ClientPtr client)
+SProcXFixesSetGCClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetGCClipRegionReq);
@@ -642,87 +648,84 @@ SProcXFixesSetGCClipRegion (ClientPtr client)
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-typedef RegionPtr (*CreateDftPtr)(WindowPtr pWin);
+typedef RegionPtr (*CreateDftPtr) (WindowPtr pWin);
int
-ProcXFixesSetWindowShapeRegion (ClientPtr client)
+ProcXFixesSetWindowShapeRegion(ClientPtr client)
{
- WindowPtr pWin;
- RegionPtr pRegion;
- RegionPtr *pDestRegion;
+ WindowPtr pWin;
+ RegionPtr pRegion;
+ RegionPtr *pDestRegion;
int rc;
+
REQUEST(xXFixesSetWindowShapeRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->dest, RT_WINDOW,
- client, DixSetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->dest;
- return rc;
+ rc = dixLookupResourceByType((pointer *) &pWin, stuff->dest, RT_WINDOW,
+ client, DixSetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->dest;
+ return rc;
}
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess);
switch (stuff->destKind) {
case ShapeBounding:
case ShapeClip:
case ShapeInput:
- break;
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
- if (pRegion)
- {
- pRegion = XFixesRegionCopy (pRegion);
- if (!pRegion)
- return BadAlloc;
- if (!pWin->optional)
- MakeWindowOptional (pWin);
- switch (stuff->destKind) {
- default:
- case ShapeBounding:
- pDestRegion = &pWin->optional->boundingShape;
- break;
- case ShapeClip:
- pDestRegion = &pWin->optional->clipShape;
- break;
- case ShapeInput:
- pDestRegion = &pWin->optional->inputShape;
- break;
- }
- if (stuff->xOff || stuff->yOff)
- RegionTranslate(pRegion, stuff->xOff, stuff->yOff);
+ if (pRegion) {
+ pRegion = XFixesRegionCopy(pRegion);
+ if (!pRegion)
+ return BadAlloc;
+ if (!pWin->optional)
+ MakeWindowOptional(pWin);
+ switch (stuff->destKind) {
+ default:
+ case ShapeBounding:
+ pDestRegion = &pWin->optional->boundingShape;
+ break;
+ case ShapeClip:
+ pDestRegion = &pWin->optional->clipShape;
+ break;
+ case ShapeInput:
+ pDestRegion = &pWin->optional->inputShape;
+ break;
+ }
+ if (stuff->xOff || stuff->yOff)
+ RegionTranslate(pRegion, stuff->xOff, stuff->yOff);
}
- else
- {
- if (pWin->optional)
- {
- switch (stuff->destKind) {
- default:
- case ShapeBounding:
- pDestRegion = &pWin->optional->boundingShape;
- break;
- case ShapeClip:
- pDestRegion = &pWin->optional->clipShape;
- break;
- case ShapeInput:
- pDestRegion = &pWin->optional->inputShape;
- break;
- }
- }
- else
- pDestRegion = &pRegion; /* a NULL region pointer */
+ else {
+ if (pWin->optional) {
+ switch (stuff->destKind) {
+ default:
+ case ShapeBounding:
+ pDestRegion = &pWin->optional->boundingShape;
+ break;
+ case ShapeClip:
+ pDestRegion = &pWin->optional->clipShape;
+ break;
+ case ShapeInput:
+ pDestRegion = &pWin->optional->inputShape;
+ break;
+ }
+ }
+ else
+ pDestRegion = &pRegion; /* a NULL region pointer */
}
if (*pDestRegion)
- RegionDestroy(*pDestRegion);
+ RegionDestroy(*pDestRegion);
*pDestRegion = pRegion;
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
- SendShapeNotify (pWin, stuff->destKind);
+ SendShapeNotify(pWin, stuff->destKind);
return Success;
}
int
-SProcXFixesSetWindowShapeRegion (ClientPtr client)
+SProcXFixesSetWindowShapeRegion(ClientPtr client)
{
REQUEST(xXFixesSetWindowShapeRegionReq);
@@ -736,27 +739,28 @@ SProcXFixesSetWindowShapeRegion (ClientPtr client)
}
int
-ProcXFixesSetPictureClipRegion (ClientPtr client)
+ProcXFixesSetPictureClipRegion(ClientPtr client)
{
- PicturePtr pPicture;
- RegionPtr pRegion;
+ PicturePtr pPicture;
+ RegionPtr pRegion;
+
REQUEST(xXFixesSetPictureClipRegionReq);
-
- REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
+
+ REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
-
- return SetPictureClipRegion (pPicture, stuff->xOrigin, stuff->yOrigin,
- pRegion);
+
+ return SetPictureClipRegion(pPicture, stuff->xOrigin, stuff->yOrigin,
+ pRegion);
}
int
-SProcXFixesSetPictureClipRegion (ClientPtr client)
+SProcXFixesSetPictureClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetPictureClipRegionReq);
-
+
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
swapl(&stuff->picture);
swapl(&stuff->region);
swaps(&stuff->xOrigin);
@@ -765,52 +769,51 @@ SProcXFixesSetPictureClipRegion (ClientPtr client)
}
int
-ProcXFixesExpandRegion (ClientPtr client)
+ProcXFixesExpandRegion(ClientPtr client)
{
- RegionPtr pSource, pDestination;
- REQUEST (xXFixesExpandRegionReq);
- BoxPtr pTmp;
- BoxPtr pSrc;
- int nBoxes;
- int i;
+ RegionPtr pSource, pDestination;
+
+ REQUEST(xXFixesExpandRegionReq);
+ BoxPtr pTmp;
+ BoxPtr pSrc;
+ int nBoxes;
+ int i;
- REQUEST_SIZE_MATCH (xXFixesExpandRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesExpandRegionReq);
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
-
+
nBoxes = RegionNumRects(pSource);
pSrc = RegionRects(pSource);
- if (nBoxes)
- {
- pTmp = malloc(nBoxes * sizeof (BoxRec));
- if (!pTmp)
- return BadAlloc;
- for (i = 0; i < nBoxes; i++)
- {
- pTmp[i].x1 = pSrc[i].x1 - stuff->left;
- pTmp[i].x2 = pSrc[i].x2 + stuff->right;
- pTmp[i].y1 = pSrc[i].y1 - stuff->top;
- pTmp[i].y2 = pSrc[i].y2 + stuff->bottom;
- }
- RegionEmpty(pDestination);
- for (i = 0; i < nBoxes; i++)
- {
- RegionRec r;
- RegionInit(&r, &pTmp[i], 0);
- RegionUnion(pDestination, pDestination, &r);
- }
- free(pTmp);
+ if (nBoxes) {
+ pTmp = malloc(nBoxes * sizeof(BoxRec));
+ if (!pTmp)
+ return BadAlloc;
+ for (i = 0; i < nBoxes; i++) {
+ pTmp[i].x1 = pSrc[i].x1 - stuff->left;
+ pTmp[i].x2 = pSrc[i].x2 + stuff->right;
+ pTmp[i].y1 = pSrc[i].y1 - stuff->top;
+ pTmp[i].y2 = pSrc[i].y2 + stuff->bottom;
+ }
+ RegionEmpty(pDestination);
+ for (i = 0; i < nBoxes; i++) {
+ RegionRec r;
+
+ RegionInit(&r, &pTmp[i], 0);
+ RegionUnion(pDestination, pDestination, &r);
+ }
+ free(pTmp);
}
return Success;
}
int
-SProcXFixesExpandRegion (ClientPtr client)
+SProcXFixesExpandRegion(ClientPtr client)
{
- REQUEST (xXFixesExpandRegionReq);
+ REQUEST(xXFixesExpandRegionReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesExpandRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesExpandRegionReq);
swapl(&stuff->source);
swapl(&stuff->destination);
swaps(&stuff->left);
@@ -825,73 +828,80 @@ SProcXFixesExpandRegion (ClientPtr client)
#include "panoramiXsrv.h"
int
-PanoramiXFixesSetGCClipRegion (ClientPtr client)
+PanoramiXFixesSetGCClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetGCClipRegionReq);
- int result = Success, j;
- PanoramiXRes *gc;
+ int result = Success, j;
+ PanoramiXRes *gc;
+
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
- if ((result = dixLookupResourceByType((void **)&gc, stuff->gc, XRT_GC,
- client, DixWriteAccess))) {
- client->errorValue = stuff->gc;
- return result;
+ if ((result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
+ client, DixWriteAccess))) {
+ client->errorValue = stuff->gc;
+ return result;
}
FOR_NSCREENS_BACKWARD(j) {
stuff->gc = gc->info[j].id;
result = (*PanoramiXSaveXFixesVector[X_XFixesSetGCClipRegion]) (client);
- if(result != Success) break;
+ if (result != Success)
+ break;
}
return result;
}
int
-PanoramiXFixesSetWindowShapeRegion (ClientPtr client)
+PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
{
- int result = Success, j;
- PanoramiXRes *win;
+ int result = Success, j;
+ PanoramiXRes *win;
+
REQUEST(xXFixesSetWindowShapeRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
- if ((result = dixLookupResourceByType((void **)&win, stuff->dest,
- XRT_WINDOW, client,
- DixWriteAccess))) {
- client->errorValue = stuff->dest;
- return result;
+ if ((result = dixLookupResourceByType((void **) &win, stuff->dest,
+ XRT_WINDOW, client,
+ DixWriteAccess))) {
+ client->errorValue = stuff->dest;
+ return result;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->dest = win->info[j].id;
- result = (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
- if(result != Success) break;
+ stuff->dest = win->info[j].id;
+ result =
+ (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
+ if (result != Success)
+ break;
}
return result;
}
int
-PanoramiXFixesSetPictureClipRegion (ClientPtr client)
+PanoramiXFixesSetPictureClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetPictureClipRegionReq);
- int result = Success, j;
- PanoramiXRes *pict;
+ int result = Success, j;
+ PanoramiXRes *pict;
- REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
- if ((result = dixLookupResourceByType((void **)&pict, stuff->picture,
- XRT_PICTURE, client,
- DixWriteAccess))) {
- client->errorValue = stuff->picture;
- return result;
+ if ((result = dixLookupResourceByType((void **) &pict, stuff->picture,
+ XRT_PICTURE, client,
+ DixWriteAccess))) {
+ client->errorValue = stuff->picture;
+ return result;
}
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
- if(result != Success) break;
+ result =
+ (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
+ if (result != Success)
+ break;
}
return result;
diff --git a/xorg-server/xfixes/saveset.c b/xorg-server/xfixes/saveset.c
index ba959c22b..eb3f6589e 100644
--- a/xorg-server/xfixes/saveset.c
+++ b/xorg-server/xfixes/saveset.c
@@ -29,31 +29,29 @@
int
ProcXFixesChangeSaveSet(ClientPtr client)
{
- Bool toRoot, map;
- int result;
- WindowPtr pWin;
+ Bool toRoot, map;
+ int result;
+ WindowPtr pWin;
+
REQUEST(xXFixesChangeSaveSetReq);
-
+
REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq);
result = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
if (result != Success)
return result;
if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
return BadMatch;
- if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete))
- {
- client->errorValue = stuff->mode;
- return BadValue;
+ if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete)) {
+ client->errorValue = stuff->mode;
+ return BadValue;
}
- if ((stuff->target != SaveSetNearest) && (stuff->target != SaveSetRoot))
- {
- client->errorValue = stuff->target;
- return BadValue;
+ if ((stuff->target != SaveSetNearest) && (stuff->target != SaveSetRoot)) {
+ client->errorValue = stuff->target;
+ return BadValue;
}
- if ((stuff->map != SaveSetMap) && (stuff->map != SaveSetUnmap))
- {
- client->errorValue = stuff->map;
- return BadValue;
+ if ((stuff->map != SaveSetMap) && (stuff->map != SaveSetUnmap)) {
+ client->errorValue = stuff->map;
+ return BadValue;
}
toRoot = (stuff->target == SaveSetRoot);
map = (stuff->map == SaveSetMap);
@@ -67,5 +65,5 @@ SProcXFixesChangeSaveSet(ClientPtr client)
swaps(&stuff->length);
swapl(&stuff->window);
- return (*ProcXFixesVector[stuff->xfixesReqType])(client);
+ return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
diff --git a/xorg-server/xfixes/select.c b/xorg-server/xfixes/select.c
index 2bf13f3fd..a896846a7 100644
--- a/xorg-server/xfixes/select.c
+++ b/xorg-server/xfixes/select.c
@@ -27,8 +27,8 @@
#include "xfixesint.h"
#include "xace.h"
-static RESTYPE SelectionClientType, SelectionWindowType;
-static Bool SelectionCallbackRegistered = FALSE;
+static RESTYPE SelectionClientType, SelectionWindowType;
+static Bool SelectionCallbackRegistered = FALSE;
/*
* There is a global list of windows selecting for selection events
@@ -40,83 +40,76 @@ static Bool SelectionCallbackRegistered = FALSE;
typedef struct _SelectionEvent *SelectionEventPtr;
typedef struct _SelectionEvent {
- SelectionEventPtr next;
- Atom selection;
- CARD32 eventMask;
- ClientPtr pClient;
- WindowPtr pWindow;
- XID clientResource;
+ SelectionEventPtr next;
+ Atom selection;
+ CARD32 eventMask;
+ ClientPtr pClient;
+ WindowPtr pWindow;
+ XID clientResource;
} SelectionEventRec;
-static SelectionEventPtr selectionEvents;
+static SelectionEventPtr selectionEvents;
static void
-XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args)
+XFixesSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args)
{
- SelectionEventPtr e;
- SelectionInfoRec *info = (SelectionInfoRec *) args;
- Selection *selection = info->selection;
- int subtype;
- CARD32 eventMask;
-
+ SelectionEventPtr e;
+ SelectionInfoRec *info = (SelectionInfoRec *) args;
+ Selection *selection = info->selection;
+ int subtype;
+ CARD32 eventMask;
+
switch (info->kind) {
case SelectionSetOwner:
- subtype = XFixesSetSelectionOwnerNotify;
- eventMask = XFixesSetSelectionOwnerNotifyMask;
- break;
+ subtype = XFixesSetSelectionOwnerNotify;
+ eventMask = XFixesSetSelectionOwnerNotifyMask;
+ break;
case SelectionWindowDestroy:
- subtype = XFixesSelectionWindowDestroyNotify;
- eventMask = XFixesSelectionWindowDestroyNotifyMask;
- break;
+ subtype = XFixesSelectionWindowDestroyNotify;
+ eventMask = XFixesSelectionWindowDestroyNotifyMask;
+ break;
case SelectionClientClose:
- subtype = XFixesSelectionClientCloseNotify;
- eventMask = XFixesSelectionClientCloseNotifyMask;
- break;
+ subtype = XFixesSelectionClientCloseNotify;
+ eventMask = XFixesSelectionClientCloseNotifyMask;
+ break;
default:
- return;
+ return;
}
- for (e = selectionEvents; e; e = e->next)
- {
- if (e->selection == selection->selection &&
- (e->eventMask & eventMask))
- {
- xXFixesSelectionNotifyEvent ev;
+ for (e = selectionEvents; e; e = e->next) {
+ if (e->selection == selection->selection && (e->eventMask & eventMask)) {
+ xXFixesSelectionNotifyEvent ev;
- memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent));
- ev.type = XFixesEventBase + XFixesSelectionNotify;
- ev.subtype = subtype;
- ev.window = e->pWindow->drawable.id;
- if (subtype == XFixesSetSelectionOwnerNotify)
- ev.owner = selection->window;
- else
- ev.owner = 0;
- ev.selection = e->selection;
- ev.timestamp = currentTime.milliseconds;
- ev.selectionTimestamp = selection->lastTimeChanged.milliseconds;
- WriteEventsToClient (e->pClient, 1, (xEvent *) &ev);
- }
+ memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent));
+ ev.type = XFixesEventBase + XFixesSelectionNotify;
+ ev.subtype = subtype;
+ ev.window = e->pWindow->drawable.id;
+ if (subtype == XFixesSetSelectionOwnerNotify)
+ ev.owner = selection->window;
+ else
+ ev.owner = 0;
+ ev.selection = e->selection;
+ ev.timestamp = currentTime.milliseconds;
+ ev.selectionTimestamp = selection->lastTimeChanged.milliseconds;
+ WriteEventsToClient(e->pClient, 1, (xEvent *) &ev);
+ }
}
}
static Bool
-CheckSelectionCallback (void)
+CheckSelectionCallback(void)
{
- if (selectionEvents)
- {
- if (!SelectionCallbackRegistered)
- {
- if (!AddCallback (&SelectionCallback, XFixesSelectionCallback, NULL))
- return FALSE;
- SelectionCallbackRegistered = TRUE;
- }
+ if (selectionEvents) {
+ if (!SelectionCallbackRegistered) {
+ if (!AddCallback(&SelectionCallback, XFixesSelectionCallback, NULL))
+ return FALSE;
+ SelectionCallbackRegistered = TRUE;
+ }
}
- else
- {
- if (SelectionCallbackRegistered)
- {
- DeleteCallback (&SelectionCallback, XFixesSelectionCallback, NULL);
- SelectionCallbackRegistered = FALSE;
- }
+ else {
+ if (SelectionCallbackRegistered) {
+ DeleteCallback(&SelectionCallback, XFixesSelectionCallback, NULL);
+ SelectionCallbackRegistered = FALSE;
+ }
}
return TRUE;
}
@@ -126,99 +119,88 @@ CheckSelectionCallback (void)
XFixesSelectionClientCloseNotifyMask)
static int
-XFixesSelectSelectionInput (ClientPtr pClient,
- Atom selection,
- WindowPtr pWindow,
- CARD32 eventMask)
+XFixesSelectSelectionInput(ClientPtr pClient,
+ Atom selection, WindowPtr pWindow, CARD32 eventMask)
{
pointer val;
int rc;
- SelectionEventPtr *prev, e;
+ SelectionEventPtr *prev, e;
rc = XaceHook(XACE_SELECTION_ACCESS, pClient, selection, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
- for (prev = &selectionEvents; (e = *prev); prev = &e->next)
- {
- if (e->selection == selection &&
- e->pClient == pClient &&
- e->pWindow == pWindow)
- {
- break;
- }
+ for (prev = &selectionEvents; (e = *prev); prev = &e->next) {
+ if (e->selection == selection &&
+ e->pClient == pClient && e->pWindow == pWindow) {
+ break;
+ }
}
- if (!eventMask)
- {
- if (e)
- {
- FreeResource (e->clientResource, 0);
- }
- return Success;
+ if (!eventMask) {
+ if (e) {
+ FreeResource(e->clientResource, 0);
+ }
+ return Success;
}
- if (!e)
- {
- e = (SelectionEventPtr) malloc(sizeof (SelectionEventRec));
- if (!e)
- return BadAlloc;
+ if (!e) {
+ e = (SelectionEventPtr) malloc(sizeof(SelectionEventRec));
+ if (!e)
+ return BadAlloc;
- e->next = 0;
- e->selection = selection;
- e->pClient = pClient;
- e->pWindow = pWindow;
- e->clientResource = FakeClientID(pClient->index);
+ e->next = 0;
+ e->selection = selection;
+ e->pClient = pClient;
+ e->pWindow = pWindow;
+ e->clientResource = FakeClientID(pClient->index);
- /*
- * Add a resource hanging from the window to
- * catch window destroy
- */
- rc = dixLookupResourceByType (&val, pWindow->drawable.id,
- SelectionWindowType, serverClient,
- DixGetAttrAccess);
- if (rc != Success)
- if (!AddResource (pWindow->drawable.id, SelectionWindowType,
- (pointer) pWindow))
- {
- free(e);
- return BadAlloc;
- }
+ /*
+ * Add a resource hanging from the window to
+ * catch window destroy
+ */
+ rc = dixLookupResourceByType(&val, pWindow->drawable.id,
+ SelectionWindowType, serverClient,
+ DixGetAttrAccess);
+ if (rc != Success)
+ if (!AddResource(pWindow->drawable.id, SelectionWindowType,
+ (pointer) pWindow)) {
+ free(e);
+ return BadAlloc;
+ }
- if (!AddResource (e->clientResource, SelectionClientType, (pointer) e))
- return BadAlloc;
+ if (!AddResource(e->clientResource, SelectionClientType, (pointer) e))
+ return BadAlloc;
- *prev = e;
- if (!CheckSelectionCallback ())
- {
- FreeResource (e->clientResource, 0);
- return BadAlloc;
- }
+ *prev = e;
+ if (!CheckSelectionCallback()) {
+ FreeResource(e->clientResource, 0);
+ return BadAlloc;
+ }
}
e->eventMask = eventMask;
return Success;
}
int
-ProcXFixesSelectSelectionInput (ClientPtr client)
+ProcXFixesSelectSelectionInput(ClientPtr client)
{
- REQUEST (xXFixesSelectSelectionInputReq);
- WindowPtr pWin;
- int rc;
+ REQUEST(xXFixesSelectSelectionInputReq);
+ WindowPtr pWin;
+ int rc;
- REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq);
+ REQUEST_SIZE_MATCH(xXFixesSelectSelectionInputReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
- if (stuff->eventMask & ~SelectionAllEvents)
- {
- client->errorValue = stuff->eventMask;
- return BadValue;
+ if (stuff->eventMask & ~SelectionAllEvents) {
+ client->errorValue = stuff->eventMask;
+ return BadValue;
}
- return XFixesSelectSelectionInput (client, stuff->selection,
- pWin, stuff->eventMask);
+ return XFixesSelectSelectionInput(client, stuff->selection,
+ pWin, stuff->eventMask);
}
int
-SProcXFixesSelectSelectionInput (ClientPtr client)
+SProcXFixesSelectSelectionInput(ClientPtr client)
{
REQUEST(xXFixesSelectSelectionInputReq);
@@ -226,64 +208,60 @@ SProcXFixesSelectSelectionInput (ClientPtr client)
swapl(&stuff->window);
swapl(&stuff->selection);
swapl(&stuff->eventMask);
- return (*ProcXFixesVector[stuff->xfixesReqType])(client);
+ return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-
+
void
-SXFixesSelectionNotifyEvent (xXFixesSelectionNotifyEvent *from,
- xXFixesSelectionNotifyEvent *to)
+SXFixesSelectionNotifyEvent(xXFixesSelectionNotifyEvent * from,
+ xXFixesSelectionNotifyEvent * to)
{
to->type = from->type;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->window, to->window);
- cpswapl (from->owner, to->owner);
- cpswapl (from->selection, to->selection);
- cpswapl (from->timestamp, to->timestamp);
- cpswapl (from->selectionTimestamp, to->selectionTimestamp);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->window, to->window);
+ cpswapl(from->owner, to->owner);
+ cpswapl(from->selection, to->selection);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->selectionTimestamp, to->selectionTimestamp);
}
static int
-SelectionFreeClient (pointer data, XID id)
+SelectionFreeClient(pointer data, XID id)
{
- SelectionEventPtr old = (SelectionEventPtr) data;
- SelectionEventPtr *prev, e;
-
- for (prev = &selectionEvents; (e = *prev); prev = &e->next)
- {
- if (e == old)
- {
- *prev = e->next;
- free(e);
- CheckSelectionCallback ();
- break;
- }
+ SelectionEventPtr old = (SelectionEventPtr) data;
+ SelectionEventPtr *prev, e;
+
+ for (prev = &selectionEvents; (e = *prev); prev = &e->next) {
+ if (e == old) {
+ *prev = e->next;
+ free(e);
+ CheckSelectionCallback();
+ break;
+ }
}
return 1;
}
static int
-SelectionFreeWindow (pointer data, XID id)
+SelectionFreeWindow(pointer data, XID id)
{
- WindowPtr pWindow = (WindowPtr) data;
- SelectionEventPtr e, next;
+ WindowPtr pWindow = (WindowPtr) data;
+ SelectionEventPtr e, next;
- for (e = selectionEvents; e; e = next)
- {
- next = e->next;
- if (e->pWindow == pWindow)
- {
- FreeResource (e->clientResource, 0);
- }
+ for (e = selectionEvents; e; e = next) {
+ next = e->next;
+ if (e->pWindow == pWindow) {
+ FreeResource(e->clientResource, 0);
+ }
}
return 1;
}
Bool
-XFixesSelectionInit (void)
+XFixesSelectionInit(void)
{
SelectionClientType = CreateNewResourceType(SelectionFreeClient,
- "XFixesSelectionClient");
+ "XFixesSelectionClient");
SelectionWindowType = CreateNewResourceType(SelectionFreeWindow,
- "XFixesSelectionWindow");
+ "XFixesSelectionWindow");
return SelectionClientType && SelectionWindowType;
}
diff --git a/xorg-server/xfixes/xfixes.c b/xorg-server/xfixes/xfixes.c
index 96d33c00b..f80230fd3 100644
--- a/xorg-server/xfixes/xfixes.c
+++ b/xorg-server/xfixes/xfixes.c
@@ -49,18 +49,20 @@
#include "xfixesint.h"
#include "protocol-versions.h"
-static unsigned char XFixesReqCode;
-int XFixesEventBase;
-int XFixesErrorBase;
+static unsigned char XFixesReqCode;
+int XFixesEventBase;
+int XFixesErrorBase;
static DevPrivateKeyRec XFixesClientPrivateKeyRec;
+
#define XFixesClientPrivateKey (&XFixesClientPrivateKeyRec)
static int
ProcXFixesQueryVersion(ClientPtr client)
{
- XFixesClientPtr pXFixesClient = GetXFixesClient (client);
+ XFixesClientPtr pXFixesClient = GetXFixesClient(client);
xXFixesQueryVersionReply rep;
+
REQUEST(xXFixesQueryVersionReq);
REQUEST_SIZE_MATCH(xXFixesQueryVersionReq);
@@ -70,90 +72,86 @@ ProcXFixesQueryVersion(ClientPtr client)
rep.sequenceNumber = client->sequence;
if (version_compare(stuff->majorVersion, stuff->minorVersion,
- SERVER_XFIXES_MAJOR_VERSION, SERVER_XFIXES_MAJOR_VERSION) < 0)
- {
- rep.majorVersion = stuff->majorVersion;
- rep.minorVersion = stuff->minorVersion;
- } else {
- rep.majorVersion = SERVER_XFIXES_MAJOR_VERSION;
+ SERVER_XFIXES_MAJOR_VERSION,
+ SERVER_XFIXES_MAJOR_VERSION) < 0) {
+ rep.majorVersion = stuff->majorVersion;
+ rep.minorVersion = stuff->minorVersion;
+ }
+ else {
+ rep.majorVersion = SERVER_XFIXES_MAJOR_VERSION;
rep.minorVersion = SERVER_XFIXES_MINOR_VERSION;
}
pXFixesClient->major_version = rep.majorVersion;
pXFixesClient->minor_version = rep.minorVersion;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xXFixesQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXFixesQueryVersionReply), (char *) &rep);
return Success;
}
/* Major version controls available requests */
static const int version_requests[] = {
- X_XFixesQueryVersion, /* before client sends QueryVersion */
- X_XFixesGetCursorImage, /* Version 1 */
- X_XFixesChangeCursorByName, /* Version 2 */
- X_XFixesExpandRegion, /* Version 3 */
- X_XFixesShowCursor, /* Version 4 */
- X_XFixesDestroyPointerBarrier, /* Version 5 */
+ X_XFixesQueryVersion, /* before client sends QueryVersion */
+ X_XFixesGetCursorImage, /* Version 1 */
+ X_XFixesChangeCursorByName, /* Version 2 */
+ X_XFixesExpandRegion, /* Version 3 */
+ X_XFixesShowCursor, /* Version 4 */
+ X_XFixesDestroyPointerBarrier, /* Version 5 */
};
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
-
-int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
+
+int (*ProcXFixesVector[XFixesNumberRequests]) (ClientPtr) = {
/*************** Version 1 ******************/
ProcXFixesQueryVersion,
- ProcXFixesChangeSaveSet,
- ProcXFixesSelectSelectionInput,
- ProcXFixesSelectCursorInput,
- ProcXFixesGetCursorImage,
+ ProcXFixesChangeSaveSet,
+ ProcXFixesSelectSelectionInput,
+ ProcXFixesSelectCursorInput, ProcXFixesGetCursorImage,
/*************** Version 2 ******************/
- ProcXFixesCreateRegion,
- ProcXFixesCreateRegionFromBitmap,
- ProcXFixesCreateRegionFromWindow,
- ProcXFixesCreateRegionFromGC,
- ProcXFixesCreateRegionFromPicture,
- ProcXFixesDestroyRegion,
- ProcXFixesSetRegion,
- ProcXFixesCopyRegion,
- ProcXFixesCombineRegion,
- ProcXFixesCombineRegion,
- ProcXFixesCombineRegion,
- ProcXFixesInvertRegion,
- ProcXFixesTranslateRegion,
- ProcXFixesRegionExtents,
- ProcXFixesFetchRegion,
- ProcXFixesSetGCClipRegion,
- ProcXFixesSetWindowShapeRegion,
- ProcXFixesSetPictureClipRegion,
- ProcXFixesSetCursorName,
- ProcXFixesGetCursorName,
- ProcXFixesGetCursorImageAndName,
- ProcXFixesChangeCursor,
- ProcXFixesChangeCursorByName,
+ ProcXFixesCreateRegion,
+ ProcXFixesCreateRegionFromBitmap,
+ ProcXFixesCreateRegionFromWindow,
+ ProcXFixesCreateRegionFromGC,
+ ProcXFixesCreateRegionFromPicture,
+ ProcXFixesDestroyRegion,
+ ProcXFixesSetRegion,
+ ProcXFixesCopyRegion,
+ ProcXFixesCombineRegion,
+ ProcXFixesCombineRegion,
+ ProcXFixesCombineRegion,
+ ProcXFixesInvertRegion,
+ ProcXFixesTranslateRegion,
+ ProcXFixesRegionExtents,
+ ProcXFixesFetchRegion,
+ ProcXFixesSetGCClipRegion,
+ ProcXFixesSetWindowShapeRegion,
+ ProcXFixesSetPictureClipRegion,
+ ProcXFixesSetCursorName,
+ ProcXFixesGetCursorName,
+ ProcXFixesGetCursorImageAndName,
+ ProcXFixesChangeCursor, ProcXFixesChangeCursorByName,
/*************** Version 3 ******************/
- ProcXFixesExpandRegion,
+ ProcXFixesExpandRegion,
/*************** Version 4 ****************/
- ProcXFixesHideCursor,
- ProcXFixesShowCursor,
+ ProcXFixesHideCursor, ProcXFixesShowCursor,
/*************** Version 5 ****************/
- ProcXFixesCreatePointerBarrier,
- ProcXFixesDestroyPointerBarrier,
-};
+ProcXFixesCreatePointerBarrier, ProcXFixesDestroyPointerBarrier,};
static int
-ProcXFixesDispatch (ClientPtr client)
+ProcXFixesDispatch(ClientPtr client)
{
REQUEST(xXFixesReq);
- XFixesClientPtr pXFixesClient = GetXFixesClient (client);
+ XFixesClientPtr pXFixesClient = GetXFixesClient(client);
if (pXFixesClient->major_version >= NUM_VERSION_REQUESTS)
- return BadRequest;
+ return BadRequest;
if (stuff->xfixesReqType > version_requests[pXFixesClient->major_version])
- return BadRequest;
+ return BadRequest;
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
@@ -168,74 +166,66 @@ SProcXFixesQueryVersion(ClientPtr client)
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
+static int (*SProcXFixesVector[XFixesNumberRequests]) (ClientPtr) = {
/*************** Version 1 ******************/
SProcXFixesQueryVersion,
- SProcXFixesChangeSaveSet,
- SProcXFixesSelectSelectionInput,
- SProcXFixesSelectCursorInput,
- SProcXFixesGetCursorImage,
+ SProcXFixesChangeSaveSet,
+ SProcXFixesSelectSelectionInput,
+ SProcXFixesSelectCursorInput, SProcXFixesGetCursorImage,
/*************** Version 2 ******************/
- SProcXFixesCreateRegion,
- SProcXFixesCreateRegionFromBitmap,
- SProcXFixesCreateRegionFromWindow,
- SProcXFixesCreateRegionFromGC,
- SProcXFixesCreateRegionFromPicture,
- SProcXFixesDestroyRegion,
- SProcXFixesSetRegion,
- SProcXFixesCopyRegion,
- SProcXFixesCombineRegion,
- SProcXFixesCombineRegion,
- SProcXFixesCombineRegion,
- SProcXFixesInvertRegion,
- SProcXFixesTranslateRegion,
- SProcXFixesRegionExtents,
- SProcXFixesFetchRegion,
- SProcXFixesSetGCClipRegion,
- SProcXFixesSetWindowShapeRegion,
- SProcXFixesSetPictureClipRegion,
- SProcXFixesSetCursorName,
- SProcXFixesGetCursorName,
- SProcXFixesGetCursorImageAndName,
- SProcXFixesChangeCursor,
- SProcXFixesChangeCursorByName,
+ SProcXFixesCreateRegion,
+ SProcXFixesCreateRegionFromBitmap,
+ SProcXFixesCreateRegionFromWindow,
+ SProcXFixesCreateRegionFromGC,
+ SProcXFixesCreateRegionFromPicture,
+ SProcXFixesDestroyRegion,
+ SProcXFixesSetRegion,
+ SProcXFixesCopyRegion,
+ SProcXFixesCombineRegion,
+ SProcXFixesCombineRegion,
+ SProcXFixesCombineRegion,
+ SProcXFixesInvertRegion,
+ SProcXFixesTranslateRegion,
+ SProcXFixesRegionExtents,
+ SProcXFixesFetchRegion,
+ SProcXFixesSetGCClipRegion,
+ SProcXFixesSetWindowShapeRegion,
+ SProcXFixesSetPictureClipRegion,
+ SProcXFixesSetCursorName,
+ SProcXFixesGetCursorName,
+ SProcXFixesGetCursorImageAndName,
+ SProcXFixesChangeCursor, SProcXFixesChangeCursorByName,
/*************** Version 3 ******************/
- SProcXFixesExpandRegion,
+ SProcXFixesExpandRegion,
/*************** Version 4 ****************/
- SProcXFixesHideCursor,
- SProcXFixesShowCursor,
+ SProcXFixesHideCursor, SProcXFixesShowCursor,
/*************** Version 5 ****************/
- SProcXFixesCreatePointerBarrier,
- SProcXFixesDestroyPointerBarrier,
-};
+SProcXFixesCreatePointerBarrier, SProcXFixesDestroyPointerBarrier,};
static int
-SProcXFixesDispatch (ClientPtr client)
+SProcXFixesDispatch(ClientPtr client)
{
REQUEST(xXFixesReq);
if (stuff->xfixesReqType >= XFixesNumberRequests)
- return BadRequest;
+ return BadRequest;
return (*SProcXFixesVector[stuff->xfixesReqType]) (client);
}
static void
-XFixesClientCallback (CallbackListPtr *list,
- pointer closure,
- pointer data)
+XFixesClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- XFixesClientPtr pXFixesClient = GetXFixesClient (pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ XFixesClientPtr pXFixesClient = GetXFixesClient(pClient);
pXFixesClient->major_version = 0;
pXFixesClient->minor_version = 0;
}
-/*ARGSUSED*/
-static void
-XFixesResetProc (ExtensionEntry *extEntry)
+ /*ARGSUSED*/ static void
+XFixesResetProc(ExtensionEntry * extEntry)
{
- DeleteCallback (&ClientStateCallback, XFixesClientCallback, 0);
+ DeleteCallback(&ClientStateCallback, XFixesClientCallback, 0);
}
void
@@ -243,56 +233,58 @@ XFixesExtensionInit(void)
{
ExtensionEntry *extEntry;
- if (!dixRegisterPrivateKey(&XFixesClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (XFixesClientRec)))
- return;
- if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0))
- return;
-
- if (XFixesSelectionInit() && XFixesCursorInit () && XFixesRegionInit () &&
- (extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents,
- XFixesNumberErrors,
- ProcXFixesDispatch, SProcXFixesDispatch,
- XFixesResetProc, StandardMinorOpcode)) != 0)
- {
- XFixesReqCode = (unsigned char)extEntry->base;
- XFixesEventBase = extEntry->eventBase;
- XFixesErrorBase = extEntry->errorBase;
- EventSwapVector[XFixesEventBase + XFixesSelectionNotify] =
- (EventSwapPtr) SXFixesSelectionNotifyEvent;
- EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
- (EventSwapPtr) SXFixesCursorNotifyEvent;
- SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion);
- SetResourceTypeErrorValue(PointerBarrierType,
- XFixesErrorBase + BadBarrier);
+ if (!dixRegisterPrivateKey
+ (&XFixesClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XFixesClientRec)))
+ return;
+ if (!AddCallback(&ClientStateCallback, XFixesClientCallback, 0))
+ return;
+
+ if (XFixesSelectionInit() && XFixesCursorInit() && XFixesRegionInit() &&
+ (extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents,
+ XFixesNumberErrors,
+ ProcXFixesDispatch, SProcXFixesDispatch,
+ XFixesResetProc, StandardMinorOpcode)) != 0) {
+ XFixesReqCode = (unsigned char) extEntry->base;
+ XFixesEventBase = extEntry->eventBase;
+ XFixesErrorBase = extEntry->errorBase;
+ EventSwapVector[XFixesEventBase + XFixesSelectionNotify] =
+ (EventSwapPtr) SXFixesSelectionNotifyEvent;
+ EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
+ (EventSwapPtr) SXFixesCursorNotifyEvent;
+ SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion);
+ SetResourceTypeErrorValue(PointerBarrierType,
+ XFixesErrorBase + BadBarrier);
}
}
#ifdef PANORAMIX
-int (*PanoramiXSaveXFixesVector[XFixesNumberRequests])(ClientPtr);
+int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
void
-PanoramiXFixesInit (void)
+PanoramiXFixesInit(void)
{
int i;
for (i = 0; i < XFixesNumberRequests; i++)
- PanoramiXSaveXFixesVector[i] = ProcXFixesVector[i];
+ PanoramiXSaveXFixesVector[i] = ProcXFixesVector[i];
/*
* Stuff in Xinerama aware request processing hooks
*/
ProcXFixesVector[X_XFixesSetGCClipRegion] = PanoramiXFixesSetGCClipRegion;
- ProcXFixesVector[X_XFixesSetWindowShapeRegion] = PanoramiXFixesSetWindowShapeRegion;
- ProcXFixesVector[X_XFixesSetPictureClipRegion] = PanoramiXFixesSetPictureClipRegion;
+ ProcXFixesVector[X_XFixesSetWindowShapeRegion] =
+ PanoramiXFixesSetWindowShapeRegion;
+ ProcXFixesVector[X_XFixesSetPictureClipRegion] =
+ PanoramiXFixesSetPictureClipRegion;
}
void
-PanoramiXFixesReset (void)
+PanoramiXFixesReset(void)
{
int i;
for (i = 0; i < XFixesNumberRequests; i++)
- ProcXFixesVector[i] = PanoramiXSaveXFixesVector[i];
+ ProcXFixesVector[i] = PanoramiXSaveXFixesVector[i];
}
#endif
diff --git a/xorg-server/xfixes/xfixes.h b/xorg-server/xfixes/xfixes.h
index 5765e64b5..19af09f7d 100644
--- a/xorg-server/xfixes/xfixes.h
+++ b/xorg-server/xfixes/xfixes.h
@@ -50,23 +50,22 @@ extern _X_EXPORT int XFixesErrorBase;
}
extern _X_EXPORT RegionPtr
-XFixesRegionCopy (RegionPtr pRegion);
+ XFixesRegionCopy(RegionPtr pRegion);
struct PointerBarrier {
CARD16 x1, x2, y1, y2;
CARD32 directions;
};
-
extern int
-barrier_get_direction(int, int, int, int);
-extern BOOL
-barrier_is_blocking(const struct PointerBarrier*, int, int, int, int, double*);
+ barrier_get_direction(int, int, int, int);
extern BOOL
-barrier_is_blocking_direction(const struct PointerBarrier*, int);
+barrier_is_blocking(const struct PointerBarrier *, int, int, int, int,
+ double *);
+extern BOOL barrier_is_blocking_direction(const struct PointerBarrier *, int);
extern void
-barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, int *y);
-
+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
+ int *y);
-#endif /* _XFIXES_H_ */
+#endif /* _XFIXES_H_ */
diff --git a/xorg-server/xkb/XKBAlloc.c b/xorg-server/xkb/XKBAlloc.c
index b70ac1705..20e0459af 100644
--- a/xorg-server/xkb/XKBAlloc.c
+++ b/xorg-server/xkb/XKBAlloc.c
@@ -40,75 +40,76 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***===================================================================***/
-/*ARGSUSED*/
-Status
-XkbAllocCompatMap(XkbDescPtr xkb,unsigned which,unsigned nSI)
+ /*ARGSUSED*/ Status
+XkbAllocCompatMap(XkbDescPtr xkb, unsigned which, unsigned nSI)
{
-XkbCompatMapPtr compat;
-XkbSymInterpretRec *prev_interpret;
+ XkbCompatMapPtr compat;
+ XkbSymInterpretRec *prev_interpret;
if (!xkb)
- return BadMatch;
+ return BadMatch;
if (xkb->compat) {
- if (xkb->compat->size_si>=nSI)
- return Success;
- compat= xkb->compat;
- compat->size_si= nSI;
- if (compat->sym_interpret==NULL)
- compat->num_si= 0;
- prev_interpret = compat->sym_interpret;
- compat->sym_interpret= realloc(compat->sym_interpret,
- nSI * sizeof(XkbSymInterpretRec));
- if (compat->sym_interpret==NULL) {
- free(prev_interpret);
- compat->size_si= compat->num_si= 0;
- return BadAlloc;
- }
- if (compat->num_si!=0) {
- memset(&compat->sym_interpret[compat->num_si], 0,
- (compat->size_si - compat->num_si) * sizeof(XkbSymInterpretRec));
- }
- return Success;
+ if (xkb->compat->size_si >= nSI)
+ return Success;
+ compat = xkb->compat;
+ compat->size_si = nSI;
+ if (compat->sym_interpret == NULL)
+ compat->num_si = 0;
+ prev_interpret = compat->sym_interpret;
+ compat->sym_interpret = realloc(compat->sym_interpret,
+ nSI * sizeof(XkbSymInterpretRec));
+ if (compat->sym_interpret == NULL) {
+ free(prev_interpret);
+ compat->size_si = compat->num_si = 0;
+ return BadAlloc;
+ }
+ if (compat->num_si != 0) {
+ memset(&compat->sym_interpret[compat->num_si], 0,
+ (compat->size_si -
+ compat->num_si) * sizeof(XkbSymInterpretRec));
+ }
+ return Success;
}
- compat= calloc(1, sizeof(XkbCompatMapRec));
- if (compat==NULL)
- return BadAlloc;
- if (nSI>0) {
- compat->sym_interpret= calloc(nSI, sizeof(XkbSymInterpretRec));
- if (!compat->sym_interpret) {
- free(compat);
- return BadAlloc;
- }
+ compat = calloc(1, sizeof(XkbCompatMapRec));
+ if (compat == NULL)
+ return BadAlloc;
+ if (nSI > 0) {
+ compat->sym_interpret = calloc(nSI, sizeof(XkbSymInterpretRec));
+ if (!compat->sym_interpret) {
+ free(compat);
+ return BadAlloc;
+ }
}
- compat->size_si= nSI;
- compat->num_si= 0;
- memset((char *)&compat->groups[0], 0, XkbNumKbdGroups*sizeof(XkbModsRec));
- xkb->compat= compat;
+ compat->size_si = nSI;
+ compat->num_si = 0;
+ memset((char *) &compat->groups[0], 0,
+ XkbNumKbdGroups * sizeof(XkbModsRec));
+ xkb->compat = compat;
return Success;
}
-
void
-XkbFreeCompatMap(XkbDescPtr xkb,unsigned which,Bool freeMap)
+XkbFreeCompatMap(XkbDescPtr xkb, unsigned which, Bool freeMap)
{
-register XkbCompatMapPtr compat;
+ register XkbCompatMapPtr compat;
- if ((xkb==NULL)||(xkb->compat==NULL))
- return;
- compat= xkb->compat;
+ if ((xkb == NULL) || (xkb->compat == NULL))
+ return;
+ compat = xkb->compat;
if (freeMap)
- which= XkbAllCompatMask;
- if (which&XkbGroupCompatMask)
- memset((char *)&compat->groups[0], 0, XkbNumKbdGroups*sizeof(XkbModsRec));
- if (which&XkbSymInterpMask) {
- if ((compat->sym_interpret)&&(compat->size_si>0))
- free(compat->sym_interpret);
- compat->size_si= compat->num_si= 0;
- compat->sym_interpret= NULL;
+ which = XkbAllCompatMask;
+ if (which & XkbGroupCompatMask)
+ memset((char *) &compat->groups[0], 0,
+ XkbNumKbdGroups * sizeof(XkbModsRec));
+ if (which & XkbSymInterpMask) {
+ if ((compat->sym_interpret) && (compat->size_si > 0))
+ free(compat->sym_interpret);
+ compat->size_si = compat->num_si = 0;
+ compat->sym_interpret = NULL;
}
if (freeMap) {
- free(compat);
- xkb->compat= NULL;
+ free(compat);
+ xkb->compat = NULL;
}
return;
}
@@ -116,153 +117,158 @@ register XkbCompatMapPtr compat;
/***===================================================================***/
Status
-XkbAllocNames(XkbDescPtr xkb,unsigned which,int nTotalRG,int nTotalAliases)
+XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases)
{
-XkbNamesPtr names;
-
- if (xkb==NULL)
- return BadMatch;
- if (xkb->names==NULL) {
- xkb->names = calloc(1, sizeof(XkbNamesRec));
- if (xkb->names==NULL)
- return BadAlloc;
+ XkbNamesPtr names;
+
+ if (xkb == NULL)
+ return BadMatch;
+ if (xkb->names == NULL) {
+ xkb->names = calloc(1, sizeof(XkbNamesRec));
+ if (xkb->names == NULL)
+ return BadAlloc;
}
- names= xkb->names;
- if ((which&XkbKTLevelNamesMask)&&(xkb->map!=NULL)&&(xkb->map->types!=NULL)){
- register int i;
- XkbKeyTypePtr type;
-
- type= xkb->map->types;
- for (i=0;i<xkb->map->num_types;i++,type++) {
- if (type->level_names==NULL) {
- type->level_names= calloc(type->num_levels, sizeof(Atom));
- if (type->level_names==NULL)
- return BadAlloc;
- }
- }
+ names = xkb->names;
+ if ((which & XkbKTLevelNamesMask) && (xkb->map != NULL) &&
+ (xkb->map->types != NULL)) {
+ register int i;
+ XkbKeyTypePtr type;
+
+ type = xkb->map->types;
+ for (i = 0; i < xkb->map->num_types; i++, type++) {
+ if (type->level_names == NULL) {
+ type->level_names = calloc(type->num_levels, sizeof(Atom));
+ if (type->level_names == NULL)
+ return BadAlloc;
+ }
+ }
}
- if ((which&XkbKeyNamesMask)&&(names->keys==NULL)) {
- if ((!XkbIsLegalKeycode(xkb->min_key_code))||
- (!XkbIsLegalKeycode(xkb->max_key_code))||
- (xkb->max_key_code<xkb->min_key_code))
- return BadValue;
- names->keys= calloc((xkb->max_key_code+1), sizeof(XkbKeyNameRec));
- if (names->keys==NULL)
- return BadAlloc;
+ if ((which & XkbKeyNamesMask) && (names->keys == NULL)) {
+ if ((!XkbIsLegalKeycode(xkb->min_key_code)) ||
+ (!XkbIsLegalKeycode(xkb->max_key_code)) ||
+ (xkb->max_key_code < xkb->min_key_code))
+ return BadValue;
+ names->keys = calloc((xkb->max_key_code + 1), sizeof(XkbKeyNameRec));
+ if (names->keys == NULL)
+ return BadAlloc;
}
- if ((which&XkbKeyAliasesMask)&&(nTotalAliases>0)) {
- if (names->key_aliases==NULL) {
- names->key_aliases= calloc(nTotalAliases, sizeof(XkbKeyAliasRec));
- }
- else if (nTotalAliases>names->num_key_aliases) {
- XkbKeyAliasRec *prev_aliases = names->key_aliases;
-
- names->key_aliases= realloc(names->key_aliases,
- nTotalAliases * sizeof(XkbKeyAliasRec));
- if (names->key_aliases!=NULL) {
- memset(&names->key_aliases[names->num_key_aliases], 0,
- (nTotalAliases - names->num_key_aliases) * sizeof(XkbKeyAliasRec));
- } else {
- free(prev_aliases);
- }
- }
- if (names->key_aliases==NULL) {
- names->num_key_aliases= 0;
- return BadAlloc;
- }
- names->num_key_aliases= nTotalAliases;
+ if ((which & XkbKeyAliasesMask) && (nTotalAliases > 0)) {
+ if (names->key_aliases == NULL) {
+ names->key_aliases = calloc(nTotalAliases, sizeof(XkbKeyAliasRec));
+ }
+ else if (nTotalAliases > names->num_key_aliases) {
+ XkbKeyAliasRec *prev_aliases = names->key_aliases;
+
+ names->key_aliases = realloc(names->key_aliases,
+ nTotalAliases *
+ sizeof(XkbKeyAliasRec));
+ if (names->key_aliases != NULL) {
+ memset(&names->key_aliases[names->num_key_aliases], 0,
+ (nTotalAliases -
+ names->num_key_aliases) * sizeof(XkbKeyAliasRec));
+ }
+ else {
+ free(prev_aliases);
+ }
+ }
+ if (names->key_aliases == NULL) {
+ names->num_key_aliases = 0;
+ return BadAlloc;
+ }
+ names->num_key_aliases = nTotalAliases;
}
- if ((which&XkbRGNamesMask)&&(nTotalRG>0)) {
- if (names->radio_groups==NULL) {
- names->radio_groups= calloc(nTotalRG, sizeof(Atom));
- }
- else if (nTotalRG>names->num_rg) {
- Atom *prev_radio_groups = names->radio_groups;
-
- names->radio_groups= realloc(names->radio_groups,
- nTotalRG * sizeof(Atom));
- if (names->radio_groups!=NULL) {
- memset(&names->radio_groups[names->num_rg], 0,
- (nTotalRG - names->num_rg) * sizeof(Atom));
- } else {
- free(prev_radio_groups);
- }
- }
- if (names->radio_groups==NULL)
- return BadAlloc;
- names->num_rg= nTotalRG;
+ if ((which & XkbRGNamesMask) && (nTotalRG > 0)) {
+ if (names->radio_groups == NULL) {
+ names->radio_groups = calloc(nTotalRG, sizeof(Atom));
+ }
+ else if (nTotalRG > names->num_rg) {
+ Atom *prev_radio_groups = names->radio_groups;
+
+ names->radio_groups = realloc(names->radio_groups,
+ nTotalRG * sizeof(Atom));
+ if (names->radio_groups != NULL) {
+ memset(&names->radio_groups[names->num_rg], 0,
+ (nTotalRG - names->num_rg) * sizeof(Atom));
+ }
+ else {
+ free(prev_radio_groups);
+ }
+ }
+ if (names->radio_groups == NULL)
+ return BadAlloc;
+ names->num_rg = nTotalRG;
}
return Success;
}
void
-XkbFreeNames(XkbDescPtr xkb,unsigned which,Bool freeMap)
+XkbFreeNames(XkbDescPtr xkb, unsigned which, Bool freeMap)
{
-XkbNamesPtr names;
+ XkbNamesPtr names;
- if ((xkb==NULL)||(xkb->names==NULL))
- return;
- names= xkb->names;
+ if ((xkb == NULL) || (xkb->names == NULL))
+ return;
+ names = xkb->names;
if (freeMap)
- which= XkbAllNamesMask;
- if (which&XkbKTLevelNamesMask) {
- XkbClientMapPtr map= xkb->map;
- if ((map!=NULL)&&(map->types!=NULL)) {
- register int i;
- register XkbKeyTypePtr type;
- type= map->types;
- for (i=0;i<map->num_types;i++,type++) {
- free(type->level_names);
- type->level_names = NULL;
- }
- }
+ which = XkbAllNamesMask;
+ if (which & XkbKTLevelNamesMask) {
+ XkbClientMapPtr map = xkb->map;
+
+ if ((map != NULL) && (map->types != NULL)) {
+ register int i;
+ register XkbKeyTypePtr type;
+
+ type = map->types;
+ for (i = 0; i < map->num_types; i++, type++) {
+ free(type->level_names);
+ type->level_names = NULL;
+ }
+ }
}
- if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) {
- free(names->keys);
- names->keys= NULL;
- names->num_keys= 0;
+ if ((which & XkbKeyNamesMask) && (names->keys != NULL)) {
+ free(names->keys);
+ names->keys = NULL;
+ names->num_keys = 0;
}
- if ((which&XkbKeyAliasesMask)&&(names->key_aliases)){
- free(names->key_aliases);
- names->key_aliases=NULL;
- names->num_key_aliases=0;
+ if ((which & XkbKeyAliasesMask) && (names->key_aliases)) {
+ free(names->key_aliases);
+ names->key_aliases = NULL;
+ names->num_key_aliases = 0;
}
- if ((which&XkbRGNamesMask)&&(names->radio_groups)) {
- free(names->radio_groups);
- names->radio_groups= NULL;
- names->num_rg= 0;
+ if ((which & XkbRGNamesMask) && (names->radio_groups)) {
+ free(names->radio_groups);
+ names->radio_groups = NULL;
+ names->num_rg = 0;
}
if (freeMap) {
- free(names);
- xkb->names= NULL;
+ free(names);
+ xkb->names = NULL;
}
return;
}
/***===================================================================***/
-/*ARGSUSED*/
-Status
-XkbAllocControls(XkbDescPtr xkb,unsigned which)
+ /*ARGSUSED*/ Status
+XkbAllocControls(XkbDescPtr xkb, unsigned which)
{
- if (xkb==NULL)
- return BadMatch;
+ if (xkb == NULL)
+ return BadMatch;
- if (xkb->ctrls==NULL) {
- xkb->ctrls= calloc(1, sizeof(XkbControlsRec));
- if (!xkb->ctrls)
- return BadAlloc;
+ if (xkb->ctrls == NULL) {
+ xkb->ctrls = calloc(1, sizeof(XkbControlsRec));
+ if (!xkb->ctrls)
+ return BadAlloc;
}
return Success;
}
-/*ARGSUSED*/
-static void
-XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap)
+ /*ARGSUSED*/ static void
+XkbFreeControls(XkbDescPtr xkb, unsigned which, Bool freeMap)
{
- if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) {
- free(xkb->ctrls);
- xkb->ctrls= NULL;
+ if (freeMap && (xkb != NULL) && (xkb->ctrls != NULL)) {
+ free(xkb->ctrls);
+ xkb->ctrls = NULL;
}
return;
}
@@ -272,12 +278,12 @@ XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap)
Status
XkbAllocIndicatorMaps(XkbDescPtr xkb)
{
- if (xkb==NULL)
- return BadMatch;
- if (xkb->indicators==NULL) {
- xkb->indicators= calloc(1, sizeof(XkbIndicatorRec));
- if (!xkb->indicators)
- return BadAlloc;
+ if (xkb == NULL)
+ return BadMatch;
+ if (xkb->indicators == NULL) {
+ xkb->indicators = calloc(1, sizeof(XkbIndicatorRec));
+ if (!xkb->indicators)
+ return BadAlloc;
}
return Success;
}
@@ -285,63 +291,61 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb)
static void
XkbFreeIndicatorMaps(XkbDescPtr xkb)
{
- if ((xkb!=NULL)&&(xkb->indicators!=NULL)) {
- free(xkb->indicators);
- xkb->indicators= NULL;
+ if ((xkb != NULL) && (xkb->indicators != NULL)) {
+ free(xkb->indicators);
+ xkb->indicators = NULL;
}
return;
}
/***====================================================================***/
-XkbDescRec *
+XkbDescRec *
XkbAllocKeyboard(void)
{
-XkbDescRec *xkb;
+ XkbDescRec *xkb;
xkb = calloc(1, sizeof(XkbDescRec));
if (xkb)
- xkb->device_spec= XkbUseCoreKbd;
+ xkb->device_spec = XkbUseCoreKbd;
return xkb;
}
void
-XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
+XkbFreeKeyboard(XkbDescPtr xkb, unsigned which, Bool freeAll)
{
- if (xkb==NULL)
- return;
+ if (xkb == NULL)
+ return;
if (freeAll)
- which= XkbAllComponentsMask;
- if (which&XkbClientMapMask)
- XkbFreeClientMap(xkb,XkbAllClientInfoMask,TRUE);
- if (which&XkbServerMapMask)
- XkbFreeServerMap(xkb,XkbAllServerInfoMask,TRUE);
- if (which&XkbCompatMapMask)
- XkbFreeCompatMap(xkb,XkbAllCompatMask,TRUE);
- if (which&XkbIndicatorMapMask)
- XkbFreeIndicatorMaps(xkb);
- if (which&XkbNamesMask)
- XkbFreeNames(xkb,XkbAllNamesMask,TRUE);
- if ((which&XkbGeometryMask) && (xkb->geom!=NULL)) {
- XkbFreeGeometry(xkb->geom,XkbGeomAllMask,TRUE);
+ which = XkbAllComponentsMask;
+ if (which & XkbClientMapMask)
+ XkbFreeClientMap(xkb, XkbAllClientInfoMask, TRUE);
+ if (which & XkbServerMapMask)
+ XkbFreeServerMap(xkb, XkbAllServerInfoMask, TRUE);
+ if (which & XkbCompatMapMask)
+ XkbFreeCompatMap(xkb, XkbAllCompatMask, TRUE);
+ if (which & XkbIndicatorMapMask)
+ XkbFreeIndicatorMaps(xkb);
+ if (which & XkbNamesMask)
+ XkbFreeNames(xkb, XkbAllNamesMask, TRUE);
+ if ((which & XkbGeometryMask) && (xkb->geom != NULL)) {
+ XkbFreeGeometry(xkb->geom, XkbGeomAllMask, TRUE);
/* PERHAPS BONGHITS etc */
xkb->geom = NULL;
}
- if (which&XkbControlsMask)
- XkbFreeControls(xkb,XkbAllControlsMask,TRUE);
+ if (which & XkbControlsMask)
+ XkbFreeControls(xkb, XkbAllControlsMask, TRUE);
if (freeAll)
- free(xkb);
+ free(xkb);
return;
}
-
/***====================================================================***/
void
XkbFreeComponentNames(XkbComponentNamesPtr names, Bool freeNames)
{
- if (names)
- {
+ if (names) {
free(names->keycodes);
free(names->types);
free(names->compat);
diff --git a/xorg-server/xkb/XKBGAlloc.c b/xorg-server/xkb/XKBGAlloc.c
index dd2b04696..f7e017682 100644
--- a/xorg-server/xkb/XKBGAlloc.c
+++ b/xorg-server/xkb/XKBGAlloc.c
@@ -28,7 +28,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <dix-config.h>
#endif
-
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
@@ -39,89 +38,88 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***====================================================================***/
-static void
-_XkbFreeGeomLeafElems( Bool freeAll,
- int first,
- int count,
- unsigned short * num_inout,
- unsigned short * sz_inout,
- char ** elems,
- unsigned int elem_sz)
+static void
+_XkbFreeGeomLeafElems(Bool freeAll,
+ int first,
+ int count,
+ unsigned short *num_inout,
+ unsigned short *sz_inout,
+ char **elems, unsigned int elem_sz)
{
- if ((freeAll)||(*elems==NULL)) {
- *num_inout= *sz_inout= 0;
- free(*elems);
- *elems = NULL;
- return;
+ if ((freeAll) || (*elems == NULL)) {
+ *num_inout = *sz_inout = 0;
+ free(*elems);
+ *elems = NULL;
+ return;
}
- if ((first>=(*num_inout))||(first<0)||(count<1))
- return;
+ if ((first >= (*num_inout)) || (first < 0) || (count < 1))
+ return;
- if (first+count>=(*num_inout)) {
- /* truncating the array is easy */
- (*num_inout)= first;
+ if (first + count >= (*num_inout)) {
+ /* truncating the array is easy */
+ (*num_inout) = first;
}
else {
- char * ptr;
- int extra;
- ptr= *elems;
- extra= ((*num_inout)-(first+count))*elem_sz;
- if (extra>0)
- memmove(&ptr[first*elem_sz],&ptr[(first+count)*elem_sz],extra);
- (*num_inout)-= count;
+ char *ptr;
+ int extra;
+
+ ptr = *elems;
+ extra = ((*num_inout) - (first + count)) * elem_sz;
+ if (extra > 0)
+ memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz],
+ extra);
+ (*num_inout) -= count;
}
return;
}
-typedef void (*ContentsClearFunc)(
- char * /* priv */
-);
+typedef void (*ContentsClearFunc) (char * /* priv */
+ );
-static void
-_XkbFreeGeomNonLeafElems( Bool freeAll,
- int first,
- int count,
- unsigned short * num_inout,
- unsigned short * sz_inout,
- char ** elems,
- unsigned int elem_sz,
- ContentsClearFunc freeFunc)
+static void
+_XkbFreeGeomNonLeafElems(Bool freeAll,
+ int first,
+ int count,
+ unsigned short *num_inout,
+ unsigned short *sz_inout,
+ char **elems,
+ unsigned int elem_sz, ContentsClearFunc freeFunc)
{
-register int i;
-register char *ptr;
+ register int i;
+ register char *ptr;
if (freeAll) {
- first= 0;
- count= (*num_inout);
+ first = 0;
+ count = (*num_inout);
}
- else if ((first>=(*num_inout))||(first<0)||(count<1))
- return;
- else if (first+count>(*num_inout))
- count= (*num_inout)-first;
- if (*elems==NULL)
- return;
+ else if ((first >= (*num_inout)) || (first < 0) || (count < 1))
+ return;
+ else if (first + count > (*num_inout))
+ count = (*num_inout) - first;
+ if (*elems == NULL)
+ return;
if (freeFunc) {
- ptr= *elems;
- ptr+= first*elem_sz;
- for (i=0;i<count;i++) {
- (*freeFunc)(ptr);
- ptr+= elem_sz;
- }
+ ptr = *elems;
+ ptr += first * elem_sz;
+ for (i = 0; i < count; i++) {
+ (*freeFunc) (ptr);
+ ptr += elem_sz;
+ }
}
if (freeAll) {
- (*num_inout)= (*sz_inout)= 0;
- free(*elems);
- *elems = NULL;
+ (*num_inout) = (*sz_inout) = 0;
+ free(*elems);
+ *elems = NULL;
}
- else if (first+count>=(*num_inout))
- *num_inout= first;
+ else if (first + count >= (*num_inout))
+ *num_inout = first;
else {
- i= ((*num_inout)-(first+count))*elem_sz;
- ptr= *elems;
- memmove(&ptr[first*elem_sz],&ptr[(first+count)*elem_sz],i);
- (*num_inout)-= count;
+ i = ((*num_inout) - (first + count)) * elem_sz;
+ ptr = *elems;
+ memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz], i);
+ (*num_inout) -= count;
}
return;
}
@@ -131,7 +129,7 @@ register char *ptr;
static void
_XkbClearProperty(char *prop_in)
{
-XkbPropertyPtr prop= (XkbPropertyPtr)prop_in;
+ XkbPropertyPtr prop = (XkbPropertyPtr) prop_in;
free(prop->name);
prop->name = NULL;
@@ -141,30 +139,23 @@ XkbPropertyPtr prop= (XkbPropertyPtr)prop_in;
}
void
-XkbFreeGeomProperties( XkbGeometryPtr geom,
- int first,
- int count,
- Bool freeAll)
-{
- _XkbFreeGeomNonLeafElems(freeAll,first,count,
- &geom->num_properties,&geom->sz_properties,
- (char **)&geom->properties,
- sizeof(XkbPropertyRec),_XkbClearProperty);
+XkbFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll)
+{
+ _XkbFreeGeomNonLeafElems(freeAll, first, count,
+ &geom->num_properties, &geom->sz_properties,
+ (char **) &geom->properties,
+ sizeof(XkbPropertyRec), _XkbClearProperty);
return;
}
/***====================================================================***/
void
-XkbFreeGeomKeyAliases( XkbGeometryPtr geom,
- int first,
- int count,
- Bool freeAll)
-{
- _XkbFreeGeomLeafElems(freeAll,first,count,
- &geom->num_key_aliases,&geom->sz_key_aliases,
- (char **)&geom->key_aliases,
- sizeof(XkbKeyAliasRec));
+XkbFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll)
+{
+ _XkbFreeGeomLeafElems(freeAll, first, count,
+ &geom->num_key_aliases, &geom->sz_key_aliases,
+ (char **) &geom->key_aliases, sizeof(XkbKeyAliasRec));
return;
}
@@ -173,31 +164,30 @@ XkbFreeGeomKeyAliases( XkbGeometryPtr geom,
static void
_XkbClearColor(char *color_in)
{
-XkbColorPtr color= (XkbColorPtr)color_in;
+ XkbColorPtr color = (XkbColorPtr) color_in;
free(color->spec);
return;
}
void
-XkbFreeGeomColors(XkbGeometryPtr geom,int first,int count,Bool freeAll)
+XkbFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll)
{
- _XkbFreeGeomNonLeafElems(freeAll,first,count,
- &geom->num_colors,&geom->sz_colors,
- (char **)&geom->colors,
- sizeof(XkbColorRec),_XkbClearColor);
+ _XkbFreeGeomNonLeafElems(freeAll, first, count,
+ &geom->num_colors, &geom->sz_colors,
+ (char **) &geom->colors,
+ sizeof(XkbColorRec), _XkbClearColor);
return;
}
/***====================================================================***/
void
-XkbFreeGeomPoints(XkbOutlinePtr outline,int first,int count,Bool freeAll)
+XkbFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll)
{
- _XkbFreeGeomLeafElems(freeAll,first,count,
- &outline->num_points,&outline->sz_points,
- (char **)&outline->points,
- sizeof(XkbPointRec));
+ _XkbFreeGeomLeafElems(freeAll, first, count,
+ &outline->num_points, &outline->sz_points,
+ (char **) &outline->points, sizeof(XkbPointRec));
return;
}
@@ -206,21 +196,21 @@ XkbFreeGeomPoints(XkbOutlinePtr outline,int first,int count,Bool freeAll)
static void
_XkbClearOutline(char *outline_in)
{
-XkbOutlinePtr outline= (XkbOutlinePtr)outline_in;
+ XkbOutlinePtr outline = (XkbOutlinePtr) outline_in;
- if (outline->points!=NULL)
- XkbFreeGeomPoints(outline,0,outline->num_points,TRUE);
+ if (outline->points != NULL)
+ XkbFreeGeomPoints(outline, 0, outline->num_points, TRUE);
return;
}
void
-XkbFreeGeomOutlines(XkbShapePtr shape,int first,int count,Bool freeAll)
+XkbFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll)
{
- _XkbFreeGeomNonLeafElems(freeAll,first,count,
- &shape->num_outlines,&shape->sz_outlines,
- (char **)&shape->outlines,
- sizeof(XkbOutlineRec),_XkbClearOutline);
-
+ _XkbFreeGeomNonLeafElems(freeAll, first, count,
+ &shape->num_outlines, &shape->sz_outlines,
+ (char **) &shape->outlines,
+ sizeof(XkbOutlineRec), _XkbClearOutline);
+
return;
}
@@ -229,32 +219,31 @@ XkbFreeGeomOutlines(XkbShapePtr shape,int first,int count,Bool freeAll)
static void
_XkbClearShape(char *shape_in)
{
-XkbShapePtr shape= (XkbShapePtr)shape_in;
+ XkbShapePtr shape = (XkbShapePtr) shape_in;
if (shape->outlines)
- XkbFreeGeomOutlines(shape,0,shape->num_outlines,TRUE);
+ XkbFreeGeomOutlines(shape, 0, shape->num_outlines, TRUE);
return;
}
void
-XkbFreeGeomShapes(XkbGeometryPtr geom,int first,int count,Bool freeAll)
+XkbFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll)
{
- _XkbFreeGeomNonLeafElems(freeAll,first,count,
- &geom->num_shapes,&geom->sz_shapes,
- (char **)&geom->shapes,
- sizeof(XkbShapeRec),_XkbClearShape);
+ _XkbFreeGeomNonLeafElems(freeAll, first, count,
+ &geom->num_shapes, &geom->sz_shapes,
+ (char **) &geom->shapes,
+ sizeof(XkbShapeRec), _XkbClearShape);
return;
}
/***====================================================================***/
-void
-XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row,int first,int count,Bool freeAll)
+void
+XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count, Bool freeAll)
{
- _XkbFreeGeomLeafElems(freeAll,first,count,
- &row->num_keys,&row->sz_keys,
- (char **)&row->keys,
- sizeof(XkbOverlayKeyRec));
+ _XkbFreeGeomLeafElems(freeAll, first, count,
+ &row->num_keys, &row->sz_keys,
+ (char **) &row->keys, sizeof(XkbOverlayKeyRec));
return;
}
@@ -263,20 +252,21 @@ XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row,int first,int count,Bool freeAll)
static void
_XkbClearOverlayRow(char *row_in)
{
-XkbOverlayRowPtr row= (XkbOverlayRowPtr)row_in;
+ XkbOverlayRowPtr row = (XkbOverlayRowPtr) row_in;
- if (row->keys!=NULL)
- XkbFreeGeomOverlayKeys(row,0,row->num_keys,TRUE);
+ if (row->keys != NULL)
+ XkbFreeGeomOverlayKeys(row, 0, row->num_keys, TRUE);
return;
}
void
-XkbFreeGeomOverlayRows(XkbOverlayPtr overlay,int first,int count,Bool freeAll)
+XkbFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count,
+ Bool freeAll)
{
- _XkbFreeGeomNonLeafElems(freeAll,first,count,
- &overlay->num_rows,&overlay->sz_rows,
- (char **)&overlay->rows,
- sizeof(XkbOverlayRowRec),_XkbClearOverlayRow);
+ _XkbFreeGeomNonLeafElems(freeAll, first, count,
+ &overlay->num_rows, &overlay->sz_rows,
+ (char **) &overlay->rows,
+ sizeof(XkbOverlayRowRec), _XkbClearOverlayRow);
return;
}
@@ -285,32 +275,31 @@ XkbFreeGeomOverlayRows(XkbOverlayPtr overlay,int first,int count,Bool freeAll)
static void
_XkbClearOverlay(char *overlay_in)
{
-XkbOverlayPtr overlay= (XkbOverlayPtr)overlay_in;
+ XkbOverlayPtr overlay = (XkbOverlayPtr) overlay_in;
- if (overlay->rows!=NULL)
- XkbFreeGeomOverlayRows(overlay,0,overlay->num_rows,TRUE);
+ if (overlay->rows != NULL)
+ XkbFreeGeomOverlayRows(overlay, 0, overlay->num_rows, TRUE);
return;
}
void
-XkbFreeGeomOverlays(XkbSectionPtr section,int first,int count,Bool freeAll)
+XkbFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll)
{
- _XkbFreeGeomNonLeafElems(freeAll,first,count,
- &section->num_overlays,&section->sz_overlays,
- (char **)&section->overlays,
- sizeof(XkbOverlayRec),_XkbClearOverlay);
+ _XkbFreeGeomNonLeafElems(freeAll, first, count,
+ &section->num_overlays, &section->sz_overlays,
+ (char **) &section->overlays,
+ sizeof(XkbOverlayRec), _XkbClearOverlay);
return;
}
/***====================================================================***/
void
-XkbFreeGeomKeys(XkbRowPtr row,int first,int count,Bool freeAll)
+XkbFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll)
{
- _XkbFreeGeomLeafElems(freeAll,first,count,
- &row->num_keys,&row->sz_keys,
- (char **)&row->keys,
- sizeof(XkbKeyRec));
+ _XkbFreeGeomLeafElems(freeAll, first, count,
+ &row->num_keys, &row->sz_keys,
+ (char **) &row->keys, sizeof(XkbKeyRec));
return;
}
@@ -319,20 +308,20 @@ XkbFreeGeomKeys(XkbRowPtr row,int first,int count,Bool freeAll)
static void
_XkbClearRow(char *row_in)
{
-XkbRowPtr row= (XkbRowPtr)row_in;
+ XkbRowPtr row = (XkbRowPtr) row_in;
- if (row->keys!=NULL)
- XkbFreeGeomKeys(row,0,row->num_keys,TRUE);
+ if (row->keys != NULL)
+ XkbFreeGeomKeys(row, 0, row->num_keys, TRUE);
return;
}
void
-XkbFreeGeomRows(XkbSectionPtr section,int first,int count,Bool freeAll)
+XkbFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll)
{
- _XkbFreeGeomNonLeafElems(freeAll,first,count,
- &section->num_rows,&section->sz_rows,
- (char **)&section->rows,
- sizeof(XkbRowRec),_XkbClearRow);
+ _XkbFreeGeomNonLeafElems(freeAll, first, count,
+ &section->num_rows, &section->sz_rows,
+ (char **) &section->rows,
+ sizeof(XkbRowRec), _XkbClearRow);
}
/***====================================================================***/
@@ -340,24 +329,24 @@ XkbFreeGeomRows(XkbSectionPtr section,int first,int count,Bool freeAll)
static void
_XkbClearSection(char *section_in)
{
-XkbSectionPtr section= (XkbSectionPtr)section_in;
+ XkbSectionPtr section = (XkbSectionPtr) section_in;
- if (section->rows!=NULL)
- XkbFreeGeomRows(section,0,section->num_rows,TRUE);
- if (section->doodads!=NULL) {
- XkbFreeGeomDoodads(section->doodads,section->num_doodads,TRUE);
- section->doodads= NULL;
+ if (section->rows != NULL)
+ XkbFreeGeomRows(section, 0, section->num_rows, TRUE);
+ if (section->doodads != NULL) {
+ XkbFreeGeomDoodads(section->doodads, section->num_doodads, TRUE);
+ section->doodads = NULL;
}
return;
}
void
-XkbFreeGeomSections(XkbGeometryPtr geom,int first,int count,Bool freeAll)
+XkbFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll)
{
- _XkbFreeGeomNonLeafElems(freeAll,first,count,
- &geom->num_sections,&geom->sz_sections,
- (char **)&geom->sections,
- sizeof(XkbSectionRec),_XkbClearSection);
+ _XkbFreeGeomNonLeafElems(freeAll, first, count,
+ &geom->num_sections, &geom->sz_sections,
+ (char **) &geom->sections,
+ sizeof(XkbSectionRec), _XkbClearSection);
return;
}
@@ -366,69 +355,69 @@ XkbFreeGeomSections(XkbGeometryPtr geom,int first,int count,Bool freeAll)
static void
_XkbClearDoodad(char *doodad_in)
{
-XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in;
+ XkbDoodadPtr doodad = (XkbDoodadPtr) doodad_in;
switch (doodad->any.type) {
- case XkbTextDoodad:
- {
- free(doodad->text.text);
- doodad->text.text = NULL;
- free(doodad->text.font);
- doodad->text.font = NULL;
- }
- break;
- case XkbLogoDoodad:
- {
- free(doodad->logo.logo_name);
- doodad->logo.logo_name = NULL;
- }
- break;
+ case XkbTextDoodad:
+ {
+ free(doodad->text.text);
+ doodad->text.text = NULL;
+ free(doodad->text.font);
+ doodad->text.font = NULL;
+ }
+ break;
+ case XkbLogoDoodad:
+ {
+ free(doodad->logo.logo_name);
+ doodad->logo.logo_name = NULL;
+ }
+ break;
}
return;
}
void
-XkbFreeGeomDoodads(XkbDoodadPtr doodads,int nDoodads,Bool freeAll)
+XkbFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll)
{
-register int i;
-register XkbDoodadPtr doodad;
+ register int i;
+ register XkbDoodadPtr doodad;
if (doodads) {
- for (i=0,doodad= doodads;i<nDoodads;i++,doodad++) {
- _XkbClearDoodad((char *)doodad);
- }
- if (freeAll)
- free(doodads);
+ for (i = 0, doodad = doodads; i < nDoodads; i++, doodad++) {
+ _XkbClearDoodad((char *) doodad);
+ }
+ if (freeAll)
+ free(doodads);
}
return;
}
void
-XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
+XkbFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap)
{
- if (geom==NULL)
- return;
+ if (geom == NULL)
+ return;
if (freeMap)
- which= XkbGeomAllMask;
- if ((which&XkbGeomPropertiesMask)&&(geom->properties!=NULL))
- XkbFreeGeomProperties(geom,0,geom->num_properties,TRUE);
- if ((which&XkbGeomColorsMask)&&(geom->colors!=NULL))
- XkbFreeGeomColors(geom,0,geom->num_colors,TRUE);
- if ((which&XkbGeomShapesMask)&&(geom->shapes!=NULL))
- XkbFreeGeomShapes(geom,0,geom->num_shapes,TRUE);
- if ((which&XkbGeomSectionsMask)&&(geom->sections!=NULL))
- XkbFreeGeomSections(geom,0,geom->num_sections,TRUE);
- if ((which&XkbGeomDoodadsMask)&&(geom->doodads!= NULL)) {
- XkbFreeGeomDoodads(geom->doodads,geom->num_doodads,TRUE);
- geom->doodads= NULL;
- geom->num_doodads= geom->sz_doodads= 0;
- }
- if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL))
- XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE);
+ which = XkbGeomAllMask;
+ if ((which & XkbGeomPropertiesMask) && (geom->properties != NULL))
+ XkbFreeGeomProperties(geom, 0, geom->num_properties, TRUE);
+ if ((which & XkbGeomColorsMask) && (geom->colors != NULL))
+ XkbFreeGeomColors(geom, 0, geom->num_colors, TRUE);
+ if ((which & XkbGeomShapesMask) && (geom->shapes != NULL))
+ XkbFreeGeomShapes(geom, 0, geom->num_shapes, TRUE);
+ if ((which & XkbGeomSectionsMask) && (geom->sections != NULL))
+ XkbFreeGeomSections(geom, 0, geom->num_sections, TRUE);
+ if ((which & XkbGeomDoodadsMask) && (geom->doodads != NULL)) {
+ XkbFreeGeomDoodads(geom->doodads, geom->num_doodads, TRUE);
+ geom->doodads = NULL;
+ geom->num_doodads = geom->sz_doodads = 0;
+ }
+ if ((which & XkbGeomKeyAliasesMask) && (geom->key_aliases != NULL))
+ XkbFreeGeomKeyAliases(geom, 0, geom->num_key_aliases, TRUE);
if (freeMap) {
- free(geom->label_font);
- geom->label_font = NULL;
- free(geom);
+ free(geom->label_font);
+ geom->label_font = NULL;
+ free(geom);
}
return;
}
@@ -456,6 +445,7 @@ XkbGeomRealloc(void **buffer, int szItems, int nrItems,
{
void *items;
int clearBegin;
+
/* Check validity of arguments. */
if (!buffer)
return FALSE;
@@ -467,8 +457,7 @@ XkbGeomRealloc(void **buffer, int szItems, int nrItems,
if (!(items = realloc(items, nrItems * itemSize)))
return FALSE;
/* Clear specified items to zero. */
- switch (clearance)
- {
+ switch (clearance) {
case XKB_GEOM_CLEAR_EXCESS:
clearBegin = szItems;
break;
@@ -481,34 +470,32 @@ XkbGeomRealloc(void **buffer, int szItems, int nrItems,
break;
}
if (items && (clearBegin < nrItems))
- memset((char *)items + (clearBegin * itemSize), 0, (nrItems - clearBegin) * itemSize);
+ memset((char *) items + (clearBegin * itemSize), 0,
+ (nrItems - clearBegin) * itemSize);
*buffer = items;
return TRUE;
}
static Status
-_XkbGeomAlloc( void ** old,
- unsigned short * num,
- unsigned short * total,
- int num_new,
- size_t sz_elem)
+_XkbGeomAlloc(void **old,
+ unsigned short *num,
+ unsigned short *total, int num_new, size_t sz_elem)
{
- if (num_new<1)
- return Success;
- if ((*old)==NULL)
- *num= *total= 0;
+ if (num_new < 1)
+ return Success;
+ if ((*old) == NULL)
+ *num = *total = 0;
- if ((*num)+num_new<=(*total))
- return Success;
+ if ((*num) + num_new <= (*total))
+ return Success;
- *total= (*num)+num_new;
+ *total = (*num) + num_new;
- if (!XkbGeomRealloc(old, *num, *total, sz_elem, XKB_GEOM_CLEAR_EXCESS))
- {
- free(*old);
- (*old)= NULL;
- *total= *num= 0;
- return BadAlloc;
+ if (!XkbGeomRealloc(old, *num, *total, sz_elem, XKB_GEOM_CLEAR_EXCESS)) {
+ free(*old);
+ (*old) = NULL;
+ *total = *num = 0;
+ return BadAlloc;
}
return Success;
@@ -554,265 +541,267 @@ _XkbGeomAlloc( void ** old,
#define _XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((void *)&(r)->keys,\
&(r)->num_keys,&(r)->sz_keys,\
(n),sizeof(XkbOverlayKeyRec))
-
+
Status
-XkbAllocGeomProps(XkbGeometryPtr geom,int nProps)
+XkbAllocGeomProps(XkbGeometryPtr geom, int nProps)
{
- return _XkbAllocProps(geom,nProps);
+ return _XkbAllocProps(geom, nProps);
}
Status
-XkbAllocGeomColors(XkbGeometryPtr geom,int nColors)
+XkbAllocGeomColors(XkbGeometryPtr geom, int nColors)
{
- return _XkbAllocColors(geom,nColors);
+ return _XkbAllocColors(geom, nColors);
}
Status
-XkbAllocGeomKeyAliases(XkbGeometryPtr geom,int nKeyAliases)
+XkbAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases)
{
- return _XkbAllocKeyAliases(geom,nKeyAliases);
+ return _XkbAllocKeyAliases(geom, nKeyAliases);
}
Status
-XkbAllocGeomShapes(XkbGeometryPtr geom,int nShapes)
+XkbAllocGeomShapes(XkbGeometryPtr geom, int nShapes)
{
- return _XkbAllocShapes(geom,nShapes);
+ return _XkbAllocShapes(geom, nShapes);
}
Status
-XkbAllocGeomSections(XkbGeometryPtr geom,int nSections)
+XkbAllocGeomSections(XkbGeometryPtr geom, int nSections)
{
- return _XkbAllocSections(geom,nSections);
+ return _XkbAllocSections(geom, nSections);
}
Status
-XkbAllocGeomOverlays(XkbSectionPtr section,int nOverlays)
+XkbAllocGeomOverlays(XkbSectionPtr section, int nOverlays)
{
- return _XkbAllocOverlays(section,nOverlays);
+ return _XkbAllocOverlays(section, nOverlays);
}
Status
-XkbAllocGeomOverlayRows(XkbOverlayPtr overlay,int nRows)
+XkbAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows)
{
- return _XkbAllocOverlayRows(overlay,nRows);
+ return _XkbAllocOverlayRows(overlay, nRows);
}
Status
-XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row,int nKeys)
+XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys)
{
- return _XkbAllocOverlayKeys(row,nKeys);
+ return _XkbAllocOverlayKeys(row, nKeys);
}
Status
-XkbAllocGeomDoodads(XkbGeometryPtr geom,int nDoodads)
+XkbAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads)
{
- return _XkbAllocDoodads(geom,nDoodads);
+ return _XkbAllocDoodads(geom, nDoodads);
}
Status
-XkbAllocGeomSectionDoodads(XkbSectionPtr section,int nDoodads)
+XkbAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads)
{
- return _XkbAllocDoodads(section,nDoodads);
+ return _XkbAllocDoodads(section, nDoodads);
}
Status
-XkbAllocGeomOutlines(XkbShapePtr shape,int nOL)
+XkbAllocGeomOutlines(XkbShapePtr shape, int nOL)
{
- return _XkbAllocOutlines(shape,nOL);
+ return _XkbAllocOutlines(shape, nOL);
}
Status
-XkbAllocGeomRows(XkbSectionPtr section,int nRows)
+XkbAllocGeomRows(XkbSectionPtr section, int nRows)
{
- return _XkbAllocRows(section,nRows);
+ return _XkbAllocRows(section, nRows);
}
Status
-XkbAllocGeomPoints(XkbOutlinePtr ol,int nPts)
+XkbAllocGeomPoints(XkbOutlinePtr ol, int nPts)
{
- return _XkbAllocPoints(ol,nPts);
+ return _XkbAllocPoints(ol, nPts);
}
Status
-XkbAllocGeomKeys(XkbRowPtr row,int nKeys)
+XkbAllocGeomKeys(XkbRowPtr row, int nKeys)
{
- return _XkbAllocKeys(row,nKeys);
+ return _XkbAllocKeys(row, nKeys);
}
Status
-XkbAllocGeometry(XkbDescPtr xkb,XkbGeometrySizesPtr sizes)
+XkbAllocGeometry(XkbDescPtr xkb, XkbGeometrySizesPtr sizes)
{
-XkbGeometryPtr geom;
-Status rtrn;
+ XkbGeometryPtr geom;
+ Status rtrn;
- if (xkb->geom==NULL) {
- xkb->geom= calloc(1, sizeof(XkbGeometryRec));
- if (!xkb->geom)
- return BadAlloc;
+ if (xkb->geom == NULL) {
+ xkb->geom = calloc(1, sizeof(XkbGeometryRec));
+ if (!xkb->geom)
+ return BadAlloc;
}
- geom= xkb->geom;
- if ((sizes->which&XkbGeomPropertiesMask)&&
- ((rtrn=_XkbAllocProps(geom,sizes->num_properties))!=Success)) {
- goto BAIL;
+ geom = xkb->geom;
+ if ((sizes->which & XkbGeomPropertiesMask) &&
+ ((rtrn = _XkbAllocProps(geom, sizes->num_properties)) != Success)) {
+ goto BAIL;
}
- if ((sizes->which&XkbGeomColorsMask)&&
- ((rtrn=_XkbAllocColors(geom,sizes->num_colors))!=Success)) {
- goto BAIL;
+ if ((sizes->which & XkbGeomColorsMask) &&
+ ((rtrn = _XkbAllocColors(geom, sizes->num_colors)) != Success)) {
+ goto BAIL;
}
- if ((sizes->which&XkbGeomShapesMask)&&
- ((rtrn=_XkbAllocShapes(geom,sizes->num_shapes))!=Success)) {
- goto BAIL;
+ if ((sizes->which & XkbGeomShapesMask) &&
+ ((rtrn = _XkbAllocShapes(geom, sizes->num_shapes)) != Success)) {
+ goto BAIL;
}
- if ((sizes->which&XkbGeomSectionsMask)&&
- ((rtrn=_XkbAllocSections(geom,sizes->num_sections))!=Success)) {
- goto BAIL;
+ if ((sizes->which & XkbGeomSectionsMask) &&
+ ((rtrn = _XkbAllocSections(geom, sizes->num_sections)) != Success)) {
+ goto BAIL;
}
- if ((sizes->which&XkbGeomDoodadsMask)&&
- ((rtrn=_XkbAllocDoodads(geom,sizes->num_doodads))!=Success)) {
- goto BAIL;
+ if ((sizes->which & XkbGeomDoodadsMask) &&
+ ((rtrn = _XkbAllocDoodads(geom, sizes->num_doodads)) != Success)) {
+ goto BAIL;
}
- if ((sizes->which&XkbGeomKeyAliasesMask)&&
- ((rtrn=_XkbAllocKeyAliases(geom,sizes->num_key_aliases))!=Success)) {
- goto BAIL;
+ if ((sizes->which & XkbGeomKeyAliasesMask) &&
+ ((rtrn =
+ _XkbAllocKeyAliases(geom, sizes->num_key_aliases)) != Success)) {
+ goto BAIL;
}
return Success;
-BAIL:
- XkbFreeGeometry(geom,XkbGeomAllMask,TRUE);
- xkb->geom= NULL;
+ BAIL:
+ XkbFreeGeometry(geom, XkbGeomAllMask, TRUE);
+ xkb->geom = NULL;
return rtrn;
}
/***====================================================================***/
XkbPropertyPtr
-XkbAddGeomProperty(XkbGeometryPtr geom,char *name,char *value)
-{
-register int i;
-register XkbPropertyPtr prop;
-
- if ((!geom)||(!name)||(!value))
- return NULL;
- for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
- if ((prop->name)&&(strcmp(name,prop->name)==0)) {
- free(prop->value);
- prop->value= strdup(value);
- return prop;
- }
- }
- if ((geom->num_properties>=geom->sz_properties)&&
- (_XkbAllocProps(geom,1)!=Success)) {
- return NULL;
- }
- prop= &geom->properties[geom->num_properties];
- prop->name= strdup(name);
+XkbAddGeomProperty(XkbGeometryPtr geom, char *name, char *value)
+{
+ register int i;
+ register XkbPropertyPtr prop;
+
+ if ((!geom) || (!name) || (!value))
+ return NULL;
+ for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) {
+ if ((prop->name) && (strcmp(name, prop->name) == 0)) {
+ free(prop->value);
+ prop->value = strdup(value);
+ return prop;
+ }
+ }
+ if ((geom->num_properties >= geom->sz_properties) &&
+ (_XkbAllocProps(geom, 1) != Success)) {
+ return NULL;
+ }
+ prop = &geom->properties[geom->num_properties];
+ prop->name = strdup(name);
if (!prop->name)
- return NULL;
- prop->value= strdup(value);
+ return NULL;
+ prop->value = strdup(value);
if (!prop->value) {
- free(prop->name);
- prop->name= NULL;
- return NULL;
+ free(prop->name);
+ prop->name = NULL;
+ return NULL;
}
geom->num_properties++;
return prop;
}
XkbKeyAliasPtr
-XkbAddGeomKeyAlias(XkbGeometryPtr geom,char *aliasStr,char *realStr)
-{
-register int i;
-register XkbKeyAliasPtr alias;
-
- if ((!geom)||(!aliasStr)||(!realStr)||(!aliasStr[0])||(!realStr[0]))
- return NULL;
- for (i=0,alias=geom->key_aliases;i<geom->num_key_aliases;i++,alias++) {
- if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) {
- memset(alias->real, 0, XkbKeyNameLength);
- strncpy(alias->real,realStr,XkbKeyNameLength);
- return alias;
- }
- }
- if ((geom->num_key_aliases>=geom->sz_key_aliases)&&
- (_XkbAllocKeyAliases(geom,1)!=Success)) {
- return NULL;
- }
- alias= &geom->key_aliases[geom->num_key_aliases];
+XkbAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr)
+{
+ register int i;
+ register XkbKeyAliasPtr alias;
+
+ if ((!geom) || (!aliasStr) || (!realStr) || (!aliasStr[0]) || (!realStr[0]))
+ return NULL;
+ for (i = 0, alias = geom->key_aliases; i < geom->num_key_aliases;
+ i++, alias++) {
+ if (strncmp(alias->alias, aliasStr, XkbKeyNameLength) == 0) {
+ memset(alias->real, 0, XkbKeyNameLength);
+ strncpy(alias->real, realStr, XkbKeyNameLength);
+ return alias;
+ }
+ }
+ if ((geom->num_key_aliases >= geom->sz_key_aliases) &&
+ (_XkbAllocKeyAliases(geom, 1) != Success)) {
+ return NULL;
+ }
+ alias = &geom->key_aliases[geom->num_key_aliases];
memset(alias, 0, sizeof(XkbKeyAliasRec));
- strncpy(alias->alias,aliasStr,XkbKeyNameLength);
- strncpy(alias->real,realStr,XkbKeyNameLength);
+ strncpy(alias->alias, aliasStr, XkbKeyNameLength);
+ strncpy(alias->real, realStr, XkbKeyNameLength);
geom->num_key_aliases++;
return alias;
}
XkbColorPtr
-XkbAddGeomColor(XkbGeometryPtr geom,char *spec,unsigned int pixel)
-{
-register int i;
-register XkbColorPtr color;
-
- if ((!geom)||(!spec))
- return NULL;
- for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) {
- if ((color->spec)&&(strcmp(color->spec,spec)==0)) {
- color->pixel= pixel;
- return color;
- }
- }
- if ((geom->num_colors>=geom->sz_colors)&&
- (_XkbAllocColors(geom,1)!=Success)) {
- return NULL;
- }
- color= &geom->colors[geom->num_colors];
- color->pixel= pixel;
- color->spec= strdup(spec);
+XkbAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel)
+{
+ register int i;
+ register XkbColorPtr color;
+
+ if ((!geom) || (!spec))
+ return NULL;
+ for (i = 0, color = geom->colors; i < geom->num_colors; i++, color++) {
+ if ((color->spec) && (strcmp(color->spec, spec) == 0)) {
+ color->pixel = pixel;
+ return color;
+ }
+ }
+ if ((geom->num_colors >= geom->sz_colors) &&
+ (_XkbAllocColors(geom, 1) != Success)) {
+ return NULL;
+ }
+ color = &geom->colors[geom->num_colors];
+ color->pixel = pixel;
+ color->spec = strdup(spec);
if (!color->spec)
- return NULL;
+ return NULL;
geom->num_colors++;
return color;
}
XkbOutlinePtr
-XkbAddGeomOutline(XkbShapePtr shape,int sz_points)
+XkbAddGeomOutline(XkbShapePtr shape, int sz_points)
{
-XkbOutlinePtr outline;
+ XkbOutlinePtr outline;
- if ((!shape)||(sz_points<0))
- return NULL;
- if ((shape->num_outlines>=shape->sz_outlines)&&
- (_XkbAllocOutlines(shape,1)!=Success)) {
- return NULL;
+ if ((!shape) || (sz_points < 0))
+ return NULL;
+ if ((shape->num_outlines >= shape->sz_outlines) &&
+ (_XkbAllocOutlines(shape, 1) != Success)) {
+ return NULL;
}
- outline= &shape->outlines[shape->num_outlines];
+ outline = &shape->outlines[shape->num_outlines];
memset(outline, 0, sizeof(XkbOutlineRec));
- if ((sz_points>0)&&(_XkbAllocPoints(outline,sz_points)!=Success))
- return NULL;
+ if ((sz_points > 0) && (_XkbAllocPoints(outline, sz_points) != Success))
+ return NULL;
shape->num_outlines++;
return outline;
}
XkbShapePtr
-XkbAddGeomShape(XkbGeometryPtr geom,Atom name,int sz_outlines)
-{
-XkbShapePtr shape;
-register int i;
-
- if ((!geom)||(!name)||(sz_outlines<0))
- return NULL;
- if (geom->num_shapes>0) {
- for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) {
- if (name==shape->name)
- return shape;
- }
- }
- if ((geom->num_shapes>=geom->sz_shapes)&&
- (_XkbAllocShapes(geom,1)!=Success))
- return NULL;
- shape= &geom->shapes[geom->num_shapes];
+XkbAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines)
+{
+ XkbShapePtr shape;
+ register int i;
+
+ if ((!geom) || (!name) || (sz_outlines < 0))
+ return NULL;
+ if (geom->num_shapes > 0) {
+ for (shape = geom->shapes, i = 0; i < geom->num_shapes; i++, shape++) {
+ if (name == shape->name)
+ return shape;
+ }
+ }
+ if ((geom->num_shapes >= geom->sz_shapes) &&
+ (_XkbAllocShapes(geom, 1) != Success))
+ return NULL;
+ shape = &geom->shapes[geom->num_shapes];
memset(shape, 0, sizeof(XkbShapeRec));
- if ((sz_outlines>0)&&(_XkbAllocOutlines(shape,sz_outlines)!=Success))
- return NULL;
- shape->name= name;
- shape->primary= shape->approx= NULL;
+ if ((sz_outlines > 0) && (_XkbAllocOutlines(shape, sz_outlines) != Success))
+ return NULL;
+ shape->name = name;
+ shape->primary = shape->approx = NULL;
geom->num_shapes++;
return shape;
}
@@ -820,203 +809,204 @@ register int i;
XkbKeyPtr
XkbAddGeomKey(XkbRowPtr row)
{
-XkbKeyPtr key;
+ XkbKeyPtr key;
+
if (!row)
- return NULL;
- if ((row->num_keys>=row->sz_keys)&&(_XkbAllocKeys(row,1)!=Success))
- return NULL;
- key= &row->keys[row->num_keys++];
+ return NULL;
+ if ((row->num_keys >= row->sz_keys) && (_XkbAllocKeys(row, 1) != Success))
+ return NULL;
+ key = &row->keys[row->num_keys++];
memset(key, 0, sizeof(XkbKeyRec));
return key;
}
XkbRowPtr
-XkbAddGeomRow(XkbSectionPtr section,int sz_keys)
+XkbAddGeomRow(XkbSectionPtr section, int sz_keys)
{
-XkbRowPtr row;
+ XkbRowPtr row;
- if ((!section)||(sz_keys<0))
- return NULL;
- if ((section->num_rows>=section->sz_rows)&&
- (_XkbAllocRows(section,1)!=Success))
- return NULL;
- row= &section->rows[section->num_rows];
+ if ((!section) || (sz_keys < 0))
+ return NULL;
+ if ((section->num_rows >= section->sz_rows) &&
+ (_XkbAllocRows(section, 1) != Success))
+ return NULL;
+ row = &section->rows[section->num_rows];
memset(row, 0, sizeof(XkbRowRec));
- if ((sz_keys>0)&&(_XkbAllocKeys(row,sz_keys)!=Success))
- return NULL;
+ if ((sz_keys > 0) && (_XkbAllocKeys(row, sz_keys) != Success))
+ return NULL;
section->num_rows++;
return row;
}
XkbSectionPtr
-XkbAddGeomSection( XkbGeometryPtr geom,
- Atom name,
- int sz_rows,
- int sz_doodads,
- int sz_over)
-{
-register int i;
-XkbSectionPtr section;
-
- if ((!geom)||(name==None)||(sz_rows<0))
- return NULL;
- for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) {
- if (section->name!=name)
- continue;
- if (((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))||
- ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success))||
- ((sz_over>0)&&(_XkbAllocOverlays(section,sz_over)!=Success)))
- return NULL;
- return section;
- }
- if ((geom->num_sections>=geom->sz_sections)&&
- (_XkbAllocSections(geom,1)!=Success))
- return NULL;
- section= &geom->sections[geom->num_sections];
- if ((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))
- return NULL;
- if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) {
- if (section->rows) {
- free(section->rows);
- section->rows= NULL;
- section->sz_rows= section->num_rows= 0;
- }
- return NULL;
- }
- section->name= name;
+XkbAddGeomSection(XkbGeometryPtr geom,
+ Atom name, int sz_rows, int sz_doodads, int sz_over)
+{
+ register int i;
+ XkbSectionPtr section;
+
+ if ((!geom) || (name == None) || (sz_rows < 0))
+ return NULL;
+ for (i = 0, section = geom->sections; i < geom->num_sections;
+ i++, section++) {
+ if (section->name != name)
+ continue;
+ if (((sz_rows > 0) && (_XkbAllocRows(section, sz_rows) != Success)) ||
+ ((sz_doodads > 0) &&
+ (_XkbAllocDoodads(section, sz_doodads) != Success)) ||
+ ((sz_over > 0) && (_XkbAllocOverlays(section, sz_over) != Success)))
+ return NULL;
+ return section;
+ }
+ if ((geom->num_sections >= geom->sz_sections) &&
+ (_XkbAllocSections(geom, 1) != Success))
+ return NULL;
+ section = &geom->sections[geom->num_sections];
+ if ((sz_rows > 0) && (_XkbAllocRows(section, sz_rows) != Success))
+ return NULL;
+ if ((sz_doodads > 0) && (_XkbAllocDoodads(section, sz_doodads) != Success)) {
+ if (section->rows) {
+ free(section->rows);
+ section->rows = NULL;
+ section->sz_rows = section->num_rows = 0;
+ }
+ return NULL;
+ }
+ section->name = name;
geom->num_sections++;
return section;
}
XkbDoodadPtr
-XkbAddGeomDoodad(XkbGeometryPtr geom,XkbSectionPtr section,Atom name)
+XkbAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name)
{
-XkbDoodadPtr old,doodad;
-register int i,nDoodads;
+ XkbDoodadPtr old, doodad;
+ register int i, nDoodads;
- if ((!geom)||(name==None))
- return NULL;
- if ((section!=NULL)&&(section->num_doodads>0)) {
- old= section->doodads;
- nDoodads= section->num_doodads;
+ if ((!geom) || (name == None))
+ return NULL;
+ if ((section != NULL) && (section->num_doodads > 0)) {
+ old = section->doodads;
+ nDoodads = section->num_doodads;
}
else {
- old= geom->doodads;
- nDoodads= geom->num_doodads;
+ old = geom->doodads;
+ nDoodads = geom->num_doodads;
}
- for (i=0,doodad=old;i<nDoodads;i++,doodad++) {
- if (doodad->any.name==name)
- return doodad;
+ for (i = 0, doodad = old; i < nDoodads; i++, doodad++) {
+ if (doodad->any.name == name)
+ return doodad;
}
if (section) {
- if ((section->num_doodads>=geom->sz_doodads)&&
- (_XkbAllocDoodads(section,1)!=Success)) {
- return NULL;
- }
- doodad= &section->doodads[section->num_doodads++];
+ if ((section->num_doodads >= geom->sz_doodads) &&
+ (_XkbAllocDoodads(section, 1) != Success)) {
+ return NULL;
+ }
+ doodad = &section->doodads[section->num_doodads++];
}
else {
- if ((geom->num_doodads>=geom->sz_doodads)&&
- (_XkbAllocDoodads(geom,1)!=Success))
- return NULL;
- doodad= &geom->doodads[geom->num_doodads++];
+ if ((geom->num_doodads >= geom->sz_doodads) &&
+ (_XkbAllocDoodads(geom, 1) != Success))
+ return NULL;
+ doodad = &geom->doodads[geom->num_doodads++];
}
memset(doodad, 0, sizeof(XkbDoodadRec));
- doodad->any.name= name;
+ doodad->any.name = name;
return doodad;
}
XkbOverlayKeyPtr
-XkbAddGeomOverlayKey( XkbOverlayPtr overlay,
- XkbOverlayRowPtr row,
- char * over,
- char * under)
-{
-register int i;
-XkbOverlayKeyPtr key;
-XkbSectionPtr section;
-XkbRowPtr row_under;
-Bool found;
-
- if ((!overlay)||(!row)||(!over)||(!under))
- return NULL;
- section= overlay->section_under;
- if (row->row_under>=section->num_rows)
- return NULL;
- row_under= &section->rows[row->row_under];
- for (i=0,found=FALSE;i<row_under->num_keys;i++) {
- if (strncmp(under,row_under->keys[i].name.name,XkbKeyNameLength)==0) {
- found= TRUE;
- break;
- }
+XkbAddGeomOverlayKey(XkbOverlayPtr overlay,
+ XkbOverlayRowPtr row, char *over, char *under)
+{
+ register int i;
+ XkbOverlayKeyPtr key;
+ XkbSectionPtr section;
+ XkbRowPtr row_under;
+ Bool found;
+
+ if ((!overlay) || (!row) || (!over) || (!under))
+ return NULL;
+ section = overlay->section_under;
+ if (row->row_under >= section->num_rows)
+ return NULL;
+ row_under = &section->rows[row->row_under];
+ for (i = 0, found = FALSE; i < row_under->num_keys; i++) {
+ if (strncmp(under, row_under->keys[i].name.name, XkbKeyNameLength) == 0) {
+ found = TRUE;
+ break;
+ }
}
if (!found)
- return NULL;
- if ((row->num_keys>=row->sz_keys)&&(_XkbAllocOverlayKeys(row,1)!=Success))
- return NULL;
- key= &row->keys[row->num_keys];
- strncpy(key->under.name,under,XkbKeyNameLength);
- strncpy(key->over.name,over,XkbKeyNameLength);
+ return NULL;
+ if ((row->num_keys >= row->sz_keys) &&
+ (_XkbAllocOverlayKeys(row, 1) != Success))
+ return NULL;
+ key = &row->keys[row->num_keys];
+ strncpy(key->under.name, under, XkbKeyNameLength);
+ strncpy(key->over.name, over, XkbKeyNameLength);
row->num_keys++;
return key;
}
XkbOverlayRowPtr
-XkbAddGeomOverlayRow(XkbOverlayPtr overlay,int row_under,int sz_keys)
-{
-register int i;
-XkbOverlayRowPtr row;
-
- if ((!overlay)||(sz_keys<0))
- return NULL;
- if (row_under>=overlay->section_under->num_rows)
- return NULL;
- for (i=0;i<overlay->num_rows;i++) {
- if (overlay->rows[i].row_under==row_under) {
- row= &overlay->rows[i];
- if ((row->sz_keys<sz_keys)&&
- (_XkbAllocOverlayKeys(row,sz_keys)!=Success)) {
- return NULL;
- }
- return &overlay->rows[i];
- }
- }
- if ((overlay->num_rows>=overlay->sz_rows)&&
- (_XkbAllocOverlayRows(overlay,1)!=Success))
- return NULL;
- row= &overlay->rows[overlay->num_rows];
+XkbAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys)
+{
+ register int i;
+ XkbOverlayRowPtr row;
+
+ if ((!overlay) || (sz_keys < 0))
+ return NULL;
+ if (row_under >= overlay->section_under->num_rows)
+ return NULL;
+ for (i = 0; i < overlay->num_rows; i++) {
+ if (overlay->rows[i].row_under == row_under) {
+ row = &overlay->rows[i];
+ if ((row->sz_keys < sz_keys) &&
+ (_XkbAllocOverlayKeys(row, sz_keys) != Success)) {
+ return NULL;
+ }
+ return &overlay->rows[i];
+ }
+ }
+ if ((overlay->num_rows >= overlay->sz_rows) &&
+ (_XkbAllocOverlayRows(overlay, 1) != Success))
+ return NULL;
+ row = &overlay->rows[overlay->num_rows];
memset(row, 0, sizeof(XkbOverlayRowRec));
- if ((sz_keys>0)&&(_XkbAllocOverlayKeys(row,sz_keys)!=Success))
- return NULL;
- row->row_under= row_under;
+ if ((sz_keys > 0) && (_XkbAllocOverlayKeys(row, sz_keys) != Success))
+ return NULL;
+ row->row_under = row_under;
overlay->num_rows++;
return row;
}
XkbOverlayPtr
-XkbAddGeomOverlay(XkbSectionPtr section,Atom name,int sz_rows)
-{
-register int i;
-XkbOverlayPtr overlay;
-
- if ((!section)||(name==None)||(sz_rows==0))
- return NULL;
-
- for (i=0,overlay=section->overlays;i<section->num_overlays;i++,overlay++) {
- if (overlay->name==name) {
- if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
- return NULL;
- return overlay;
- }
- }
- if ((section->num_overlays>=section->sz_overlays)&&
- (_XkbAllocOverlays(section,1)!=Success))
- return NULL;
- overlay= &section->overlays[section->num_overlays];
- if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
- return NULL;
- overlay->name= name;
- overlay->section_under= section;
+XkbAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows)
+{
+ register int i;
+ XkbOverlayPtr overlay;
+
+ if ((!section) || (name == None) || (sz_rows == 0))
+ return NULL;
+
+ for (i = 0, overlay = section->overlays; i < section->num_overlays;
+ i++, overlay++) {
+ if (overlay->name == name) {
+ if ((sz_rows > 0) &&
+ (_XkbAllocOverlayRows(overlay, sz_rows) != Success))
+ return NULL;
+ return overlay;
+ }
+ }
+ if ((section->num_overlays >= section->sz_overlays) &&
+ (_XkbAllocOverlays(section, 1) != Success))
+ return NULL;
+ overlay = &section->overlays[section->num_overlays];
+ if ((sz_rows > 0) && (_XkbAllocOverlayRows(overlay, sz_rows) != Success))
+ return NULL;
+ overlay->name = name;
+ overlay->section_under = section;
section->num_overlays++;
return overlay;
}
diff --git a/xorg-server/xkb/XKBMAlloc.c b/xorg-server/xkb/XKBMAlloc.c
index ad13b940c..645e90544 100644
--- a/xorg-server/xkb/XKBMAlloc.c
+++ b/xorg-server/xkb/XKBMAlloc.c
@@ -1,879 +1,930 @@
-/************************************************************
-Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#elif defined(HAVE_CONFIG_H)
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "inputstr.h"
-#include <X11/keysym.h>
-#define XKBSRV_NEED_FILE_FUNCS
-#include <xkbsrv.h>
-
-/***====================================================================***/
-
-Status
-XkbAllocClientMap(XkbDescPtr xkb,unsigned which,unsigned nTotalTypes)
-{
-register int i;
-XkbClientMapPtr map;
-
- if ((xkb==NULL)||((nTotalTypes>0)&&(nTotalTypes<XkbNumRequiredTypes)))
- return BadValue;
- if ((which&XkbKeySymsMask)&&
- ((!XkbIsLegalKeycode(xkb->min_key_code))||
- (!XkbIsLegalKeycode(xkb->max_key_code))||
- (xkb->max_key_code<xkb->min_key_code))) {
- DebugF("bad keycode (%d,%d) in XkbAllocClientMap\n",
- xkb->min_key_code,xkb->max_key_code);
- return BadValue;
- }
-
- if (xkb->map==NULL) {
- map= calloc(1, sizeof(XkbClientMapRec));
- if (map==NULL)
- return BadAlloc;
- xkb->map= map;
- }
- else map= xkb->map;
-
- if ((which&XkbKeyTypesMask)&&(nTotalTypes>0)) {
- if (map->types==NULL) {
- map->types= calloc(nTotalTypes, sizeof(XkbKeyTypeRec));
- if (map->types==NULL)
- return BadAlloc;
- map->num_types= 0;
- map->size_types= nTotalTypes;
- }
- else if (map->size_types<nTotalTypes) {
- XkbKeyTypeRec *prev_types = map->types;
-
- map->types= realloc(map->types,nTotalTypes * sizeof(XkbKeyTypeRec));
- if (map->types==NULL) {
- free(prev_types);
- map->num_types= map->size_types= 0;
- return BadAlloc;
- }
- map->size_types= nTotalTypes;
- memset(&map->types[map->num_types], 0,
- ((map->size_types-map->num_types)*sizeof(XkbKeyTypeRec)));
- }
- }
- if (which&XkbKeySymsMask) {
- int nKeys= XkbNumKeys(xkb);
- if (map->syms==NULL) {
- map->size_syms= (nKeys*15)/10;
- map->syms= calloc(map->size_syms, sizeof(KeySym));
- if (!map->syms) {
- map->size_syms= 0;
- return BadAlloc;
- }
- map->num_syms= 1;
- map->syms[0]= NoSymbol;
- }
- if (map->key_sym_map==NULL) {
- i= xkb->max_key_code+1;
- map->key_sym_map= calloc(i, sizeof(XkbSymMapRec));
- if (map->key_sym_map==NULL)
- return BadAlloc;
- }
- }
- if (which&XkbModifierMapMask) {
- if ((!XkbIsLegalKeycode(xkb->min_key_code))||
- (!XkbIsLegalKeycode(xkb->max_key_code))||
- (xkb->max_key_code<xkb->min_key_code))
- return BadMatch;
- if (map->modmap==NULL) {
- i= xkb->max_key_code+1;
- map->modmap= calloc(i, sizeof(unsigned char));
- if (map->modmap==NULL)
- return BadAlloc;
- }
- }
- return Success;
-}
-
-Status
-XkbAllocServerMap(XkbDescPtr xkb,unsigned which,unsigned nNewActions)
-{
-register int i;
-XkbServerMapPtr map;
-
- if (xkb==NULL)
- return BadMatch;
- if (xkb->server==NULL) {
- map= calloc(1, sizeof(XkbServerMapRec));
- if (map==NULL)
- return BadAlloc;
- for (i=0;i<XkbNumVirtualMods;i++) {
- map->vmods[i]= XkbNoModifierMask;
- }
- xkb->server= map;
- }
- else map= xkb->server;
- if (which&XkbExplicitComponentsMask) {
- if ((!XkbIsLegalKeycode(xkb->min_key_code))||
- (!XkbIsLegalKeycode(xkb->max_key_code))||
- (xkb->max_key_code<xkb->min_key_code))
- return BadMatch;
- if (map->explicit==NULL) {
- i= xkb->max_key_code+1;
- map->explicit= calloc(i, sizeof(unsigned char));
- if (map->explicit==NULL)
- return BadAlloc;
- }
- }
- if (which&XkbKeyActionsMask) {
- if ((!XkbIsLegalKeycode(xkb->min_key_code))||
- (!XkbIsLegalKeycode(xkb->max_key_code))||
- (xkb->max_key_code<xkb->min_key_code))
- return BadMatch;
- if (nNewActions<1)
- nNewActions= 1;
- if (map->acts==NULL) {
- map->acts= calloc((nNewActions+1), sizeof(XkbAction));
- if (map->acts==NULL)
- return BadAlloc;
- map->num_acts= 1;
- map->size_acts= nNewActions+1;
- }
- else if ((map->size_acts-map->num_acts)<nNewActions) {
- unsigned need;
- XkbAction *prev_acts = map->acts;
- need= map->num_acts+nNewActions;
- map->acts= realloc(map->acts,need * sizeof(XkbAction));
- if (map->acts==NULL) {
- free(prev_acts);
- map->num_acts= map->size_acts= 0;
- return BadAlloc;
- }
- map->size_acts= need;
- memset(&map->acts[map->num_acts], 0,
- ((map->size_acts-map->num_acts)*sizeof(XkbAction)));
- }
- if (map->key_acts==NULL) {
- i= xkb->max_key_code+1;
- map->key_acts= calloc(i, sizeof(unsigned short));
- if (map->key_acts==NULL)
- return BadAlloc;
- }
- }
- if (which&XkbKeyBehaviorsMask) {
- if ((!XkbIsLegalKeycode(xkb->min_key_code))||
- (!XkbIsLegalKeycode(xkb->max_key_code))||
- (xkb->max_key_code<xkb->min_key_code))
- return BadMatch;
- if (map->behaviors==NULL) {
- i= xkb->max_key_code+1;
- map->behaviors= calloc(i, sizeof(XkbBehavior));
- if (map->behaviors==NULL)
- return BadAlloc;
- }
- }
- if (which&XkbVirtualModMapMask) {
- if ((!XkbIsLegalKeycode(xkb->min_key_code))||
- (!XkbIsLegalKeycode(xkb->max_key_code))||
- (xkb->max_key_code<xkb->min_key_code))
- return BadMatch;
- if (map->vmodmap==NULL) {
- i= xkb->max_key_code+1;
- map->vmodmap= calloc(i, sizeof(unsigned short));
- if (map->vmodmap==NULL)
- return BadAlloc;
- }
- }
- return Success;
-}
-
-/***====================================================================***/
-
-static Status
-XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into)
-{
- if ((!from)||(!into))
- return BadMatch;
- free(into->map);
- into->map = NULL;
- free(into->preserve);
- into->preserve = NULL;
- free(into->level_names);
- into->level_names = NULL;
- *into= *from;
- if ((from->map)&&(into->map_count>0)) {
- into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec));
- if (!into->map)
- return BadAlloc;
- memcpy(into->map,from->map,into->map_count*sizeof(XkbKTMapEntryRec));
- }
- if ((from->preserve)&&(into->map_count>0)) {
- into->preserve= calloc(into->map_count, sizeof(XkbModsRec));
- if (!into->preserve)
- return BadAlloc;
- memcpy(into->preserve,from->preserve,
- into->map_count*sizeof(XkbModsRec));
- }
- if ((from->level_names)&&(into->num_levels>0)) {
- into->level_names= calloc(into->num_levels, sizeof(Atom));
- if (!into->level_names)
- return BadAlloc;
- memcpy(into->level_names,from->level_names,
- into->num_levels*sizeof(Atom));
- }
- return Success;
-}
-
-Status
-XkbCopyKeyTypes(XkbKeyTypePtr from,XkbKeyTypePtr into,int num_types)
-{
-register int i,rtrn;
-
- if ((!from)||(!into)||(num_types<0))
- return BadMatch;
- for (i=0;i<num_types;i++) {
- if ((rtrn= XkbCopyKeyType(from++,into++))!=Success)
- return rtrn;
- }
- return Success;
-}
-
-Status
-XkbResizeKeyType( XkbDescPtr xkb,
- int type_ndx,
- int map_count,
- Bool want_preserve,
- int new_num_lvls)
-{
-XkbKeyTypePtr type;
-KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
-
- if ((type_ndx<0)||(type_ndx>=xkb->map->num_types)||(map_count<0)||
- (new_num_lvls<1))
- return BadValue;
- switch (type_ndx) {
- case XkbOneLevelIndex:
- if (new_num_lvls!=1)
- return BadMatch;
- break;
- case XkbTwoLevelIndex:
- case XkbAlphabeticIndex:
- case XkbKeypadIndex:
- if (new_num_lvls!=2)
- return BadMatch;
- break;
- }
- type= &xkb->map->types[type_ndx];
- if (map_count==0) {
- free(type->map);
- type->map= NULL;
- free(type->preserve);
- type->preserve= NULL;
- type->map_count= 0;
- }
- else {
- XkbKTMapEntryRec *prev_map = type->map;
-
- if ((map_count>type->map_count)||(type->map==NULL))
- type->map = realloc(type->map,map_count * sizeof(XkbKTMapEntryRec));
- if (!type->map) {
- free(prev_map);
- return BadAlloc;
- }
- if (want_preserve) {
- XkbModsRec *prev_preserve = type->preserve;
-
- if ((map_count>type->map_count)||(type->preserve==NULL)) {
- type->preserve = realloc(type->preserve,
- map_count * sizeof(XkbModsRec));
- }
- if (!type->preserve) {
- free(prev_preserve);
- return BadAlloc;
- }
- }
- else {
- free(type->preserve);
- type->preserve = NULL;
- }
- type->map_count= map_count;
- }
-
- if ((new_num_lvls>type->num_levels)||(type->level_names==NULL)) {
- Atom * prev_level_names = type->level_names;
-
- type->level_names = realloc(type->level_names,
- new_num_lvls * sizeof(Atom));
- if (!type->level_names) {
- free(prev_level_names);
- return BadAlloc;
- }
- }
- /*
- * Here's the theory:
- * If the width of the type changed, we might have to resize the symbol
- * maps for any keys that use the type for one or more groups. This is
- * expensive, so we'll try to cull out any keys that are obviously okay:
- * In any case:
- * - keys that have a group width <= the old width are okay (because
- * they could not possibly have been associated with the old type)
- * If the key type increased in size:
- * - keys that already have a group width >= to the new width are okay
- * + keys that have a group width >= the old width but < the new width
- * might have to be enlarged.
- * If the key type decreased in size:
- * - keys that have a group width > the old width don't have to be
- * resized (because they must have some other wider type associated
- * with some group).
- * + keys that have a group width == the old width might have to be
- * shrunk.
- * The possibilities marked with '+' require us to examine the key types
- * associated with each group for the key.
- */
- memset(matchingKeys, 0, XkbMaxKeyCount*sizeof(KeyCode));
- nMatchingKeys= 0;
- if (new_num_lvls>type->num_levels) {
- int nTotal;
- KeySym * newSyms;
- int width,match,nResize;
- register int i,g,nSyms;
-
- nResize= 0;
- for (nTotal=1,i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- width= XkbKeyGroupsWidth(xkb,i);
- if (width<type->num_levels)
- continue;
- for (match=0,g=XkbKeyNumGroups(xkb,i)-1;(g>=0)&&(!match);g--) {
- if (XkbKeyKeyTypeIndex(xkb,i,g)==type_ndx) {
- matchingKeys[nMatchingKeys++]= i;
- match= 1;
- }
- }
- if ((!match)||(width>=new_num_lvls))
- nTotal+= XkbKeyNumSyms(xkb,i);
- else {
- nTotal+= XkbKeyNumGroups(xkb,i)*new_num_lvls;
- nResize++;
- }
- }
- if (nResize>0) {
- int nextMatch;
- xkb->map->size_syms= (nTotal*15)/10;
- newSyms = calloc(xkb->map->size_syms, sizeof(KeySym));
- if (newSyms==NULL)
- return BadAlloc;
- nextMatch= 0;
- nSyms= 1;
- for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- if (matchingKeys[nextMatch]==i) {
- KeySym *pOld;
- nextMatch++;
- width= XkbKeyGroupsWidth(xkb,i);
- pOld= XkbKeySymsPtr(xkb,i);
- for (g=XkbKeyNumGroups(xkb,i)-1;g>=0;g--) {
- memcpy(&newSyms[nSyms+(new_num_lvls*g)],&pOld[width*g],
- width*sizeof(KeySym));
- }
- xkb->map->key_sym_map[i].offset= nSyms;
- nSyms+= XkbKeyNumGroups(xkb,i)*new_num_lvls;
- }
- else {
- memcpy(&newSyms[nSyms],XkbKeySymsPtr(xkb,i),
- XkbKeyNumSyms(xkb,i)*sizeof(KeySym));
- xkb->map->key_sym_map[i].offset= nSyms;
- nSyms+= XkbKeyNumSyms(xkb,i);
- }
- }
- type->num_levels= new_num_lvls;
- free(xkb->map->syms);
- xkb->map->syms= newSyms;
- xkb->map->num_syms= nSyms;
- return Success;
- }
- }
- else if (new_num_lvls<type->num_levels) {
- int width,match;
- register int g,i;
- for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- width= XkbKeyGroupsWidth(xkb,i);
- if (width<type->num_levels)
- continue;
- for (match=0,g=XkbKeyNumGroups(xkb,i)-1;(g>=0)&&(!match);g--) {
- if (XkbKeyKeyTypeIndex(xkb,i,g)==type_ndx) {
- matchingKeys[nMatchingKeys++]= i;
- match= 1;
- }
- }
- }
- }
- if (nMatchingKeys>0) {
- int key,firstClear;
- register int i,g;
- if (new_num_lvls>type->num_levels)
- firstClear= type->num_levels;
- else firstClear= new_num_lvls;
- for (i=0;i<nMatchingKeys;i++) {
- KeySym * pSyms;
- int width,nClear;
-
- key= matchingKeys[i];
- width= XkbKeyGroupsWidth(xkb,key);
- nClear= width-firstClear;
- pSyms= XkbKeySymsPtr(xkb,key);
- for (g=XkbKeyNumGroups(xkb,key)-1;g>=0;g--) {
- if (XkbKeyKeyTypeIndex(xkb,key,g)==type_ndx) {
- if (nClear>0)
- memset(&pSyms[g*width+firstClear], 0, nClear*sizeof(KeySym));
- }
- }
- }
- }
- type->num_levels= new_num_lvls;
- return Success;
-}
-
-KeySym *
-XkbResizeKeySyms(XkbDescPtr xkb,int key,int needed)
-{
-register int i,nSyms,nKeySyms;
-unsigned nOldSyms;
-KeySym *newSyms;
-
- if (needed==0) {
- xkb->map->key_sym_map[key].offset= 0;
- return xkb->map->syms;
- }
- nOldSyms= XkbKeyNumSyms(xkb,key);
- if (nOldSyms>=(unsigned)needed) {
- return XkbKeySymsPtr(xkb,key);
- }
- if (xkb->map->size_syms-xkb->map->num_syms>=(unsigned)needed) {
- if (nOldSyms>0) {
- memcpy(&xkb->map->syms[xkb->map->num_syms],XkbKeySymsPtr(xkb,key),
- nOldSyms*sizeof(KeySym));
- }
- if ((needed-nOldSyms)>0) {
- memset(&xkb->map->syms[xkb->map->num_syms+XkbKeyNumSyms(xkb, key)],
- 0, (needed-nOldSyms)*sizeof(KeySym));
- }
- xkb->map->key_sym_map[key].offset = xkb->map->num_syms;
- xkb->map->num_syms+= needed;
- return &xkb->map->syms[xkb->map->key_sym_map[key].offset];
- }
- xkb->map->size_syms+= (needed>32?needed:32);
- newSyms = calloc(xkb->map->size_syms, sizeof(KeySym));
- if (newSyms==NULL)
- return NULL;
- newSyms[0]= NoSymbol;
- nSyms = 1;
- for (i=xkb->min_key_code;i<=(int)xkb->max_key_code;i++) {
- int nCopy;
-
- nCopy= nKeySyms= XkbKeyNumSyms(xkb,i);
- if ((nKeySyms==0)&&(i!=key))
- continue;
- if (i==key)
- nKeySyms= needed;
- if (nCopy!=0)
- memcpy(&newSyms[nSyms],XkbKeySymsPtr(xkb,i),nCopy*sizeof(KeySym));
- if (nKeySyms>nCopy)
- memset(&newSyms[nSyms+nCopy], 0, (nKeySyms-nCopy)*sizeof(KeySym));
- xkb->map->key_sym_map[i].offset = nSyms;
- nSyms+= nKeySyms;
- }
- free(xkb->map->syms);
- xkb->map->syms = newSyms;
- xkb->map->num_syms = nSyms;
- return &xkb->map->syms[xkb->map->key_sym_map[key].offset];
-}
-
-static unsigned
-_ExtendRange( unsigned int old_flags,
- unsigned int flag,
- KeyCode newKC,
- KeyCode * old_min,
- unsigned char * old_num)
-{
- if ((old_flags&flag)==0) {
- old_flags|= flag;
- *old_min= newKC;
- *old_num= 1;
- }
- else {
- int last= (*old_min)+(*old_num)-1;
- if (newKC<*old_min) {
- *old_min= newKC;
- *old_num= (last-newKC)+1;
- }
- else if (newKC>last) {
- *old_num= (newKC-(*old_min))+1;
- }
- }
- return old_flags;
-}
-
-Status
-XkbChangeKeycodeRange( XkbDescPtr xkb,
- int minKC,
- int maxKC,
- XkbChangesPtr changes)
-{
-int tmp;
-
- if ((!xkb)||(minKC<XkbMinLegalKeyCode)||(maxKC>XkbMaxLegalKeyCode))
- return BadValue;
- if (minKC>maxKC)
- return BadMatch;
- if (minKC<xkb->min_key_code) {
- if (changes)
- changes->map.min_key_code= minKC;
- tmp= xkb->min_key_code-minKC;
- if (xkb->map) {
- if (xkb->map->key_sym_map) {
- memset((char *)&xkb->map->key_sym_map[minKC], 0,
- tmp*sizeof(XkbSymMapRec));
- if (changes) {
- changes->map.changed= _ExtendRange(changes->map.changed,
- XkbKeySymsMask,minKC,
- &changes->map.first_key_sym,
- &changes->map.num_key_syms);
- }
- }
- if (xkb->map->modmap) {
- memset((char *)&xkb->map->modmap[minKC], 0, tmp);
- if (changes) {
- changes->map.changed= _ExtendRange(changes->map.changed,
- XkbModifierMapMask,minKC,
- &changes->map.first_modmap_key,
- &changes->map.num_modmap_keys);
- }
- }
- }
- if (xkb->server) {
- if (xkb->server->behaviors) {
- memset((char *)&xkb->server->behaviors[minKC], 0,
- tmp*sizeof(XkbBehavior));
- if (changes) {
- changes->map.changed= _ExtendRange(changes->map.changed,
- XkbKeyBehaviorsMask,minKC,
- &changes->map.first_key_behavior,
- &changes->map.num_key_behaviors);
- }
- }
- if (xkb->server->key_acts) {
- memset((char *)&xkb->server->key_acts[minKC], 0,
- tmp*sizeof(unsigned short));
- if (changes) {
- changes->map.changed= _ExtendRange(changes->map.changed,
- XkbKeyActionsMask,minKC,
- &changes->map.first_key_act,
- &changes->map.num_key_acts);
- }
- }
- if (xkb->server->vmodmap) {
- memset((char *)&xkb->server->vmodmap[minKC], 0,
- tmp*sizeof(unsigned short));
- if (changes) {
- changes->map.changed= _ExtendRange(changes->map.changed,
- XkbVirtualModMapMask,minKC,
- &changes->map.first_modmap_key,
- &changes->map.num_vmodmap_keys);
- }
- }
- }
- if ((xkb->names)&&(xkb->names->keys)) {
- memset((char *)&xkb->names->keys[minKC], 0, tmp*sizeof(XkbKeyNameRec));
- if (changes) {
- changes->names.changed= _ExtendRange(changes->names.changed,
- XkbKeyNamesMask,minKC,
- &changes->names.first_key,
- &changes->names.num_keys);
- }
- }
- xkb->min_key_code= minKC;
- }
- if (maxKC>xkb->max_key_code) {
- if (changes)
- changes->map.max_key_code= maxKC;
- tmp= maxKC-xkb->max_key_code;
- if (xkb->map) {
- if (xkb->map->key_sym_map) {
- XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map;
-
- xkb->map->key_sym_map = realloc(xkb->map->key_sym_map,
- (maxKC+1) * sizeof(XkbSymMapRec));
- if (!xkb->map->key_sym_map) {
- free(prev_key_sym_map);
- return BadAlloc;
- }
- memset((char *)&xkb->map->key_sym_map[xkb->max_key_code], 0,
- tmp*sizeof(XkbSymMapRec));
- if (changes) {
- changes->map.changed= _ExtendRange(changes->map.changed,
- XkbKeySymsMask,maxKC,
- &changes->map.first_key_sym,
- &changes->map.num_key_syms);
- }
- }
- if (xkb->map->modmap) {
- unsigned char *prev_modmap = xkb->map->modmap;
-
- xkb->map->modmap = realloc(xkb->map->modmap,
- (maxKC+1) * sizeof(unsigned char));
- if (!xkb->map->modmap) {
- free(prev_modmap);
- return BadAlloc;
- }
- memset((char *)&xkb->map->modmap[xkb->max_key_code], 0, tmp);
- if (changes) {
- changes->map.changed= _ExtendRange(changes->map.changed,
- XkbModifierMapMask,maxKC,
- &changes->map.first_modmap_key,
- &changes->map.num_modmap_keys);
- }
- }
- }
- if (xkb->server) {
- if (xkb->server->behaviors) {
- XkbBehavior *prev_behaviors = xkb->server->behaviors;
-
- xkb->server->behaviors = realloc(xkb->server->behaviors,
- (maxKC+1) * sizeof(XkbBehavior));
- if (!xkb->server->behaviors) {
- free(prev_behaviors);
- return BadAlloc;
- }
- memset((char *)&xkb->server->behaviors[xkb->max_key_code], 0,
- tmp*sizeof(XkbBehavior));
- if (changes) {
- changes->map.changed= _ExtendRange(changes->map.changed,
- XkbKeyBehaviorsMask,maxKC,
- &changes->map.first_key_behavior,
- &changes->map.num_key_behaviors);
- }
- }
- if (xkb->server->key_acts) {
- unsigned short *prev_key_acts = xkb->server->key_acts;
-
- xkb->server->key_acts= realloc(xkb->server->key_acts,
- (maxKC+1) * sizeof(unsigned short));
- if (!xkb->server->key_acts) {
- free(prev_key_acts);
- return BadAlloc;
- }
- memset((char *)&xkb->server->key_acts[xkb->max_key_code], 0,
- tmp*sizeof(unsigned short));
- if (changes) {
- changes->map.changed= _ExtendRange(changes->map.changed,
- XkbKeyActionsMask,maxKC,
- &changes->map.first_key_act,
- &changes->map.num_key_acts);
- }
- }
- if (xkb->server->vmodmap) {
- unsigned short *prev_vmodmap = xkb->server->vmodmap;
-
- xkb->server->vmodmap= realloc(xkb->server->vmodmap,
- (maxKC+1) * sizeof(unsigned short));
- if (!xkb->server->vmodmap) {
- free(prev_vmodmap);
- return BadAlloc;
- }
- memset((char *)&xkb->server->vmodmap[xkb->max_key_code], 0,
- tmp*sizeof(unsigned short));
- if (changes) {
- changes->map.changed= _ExtendRange(changes->map.changed,
- XkbVirtualModMapMask,maxKC,
- &changes->map.first_modmap_key,
- &changes->map.num_vmodmap_keys);
- }
- }
- }
- if ((xkb->names)&&(xkb->names->keys)) {
- XkbKeyNameRec *prev_keys = xkb->names->keys;
-
- xkb->names->keys = realloc(xkb->names->keys,
- (maxKC+1) * sizeof(XkbKeyNameRec));
- if (!xkb->names->keys) {
- free(prev_keys);
- return BadAlloc;
- }
- memset((char *)&xkb->names->keys[xkb->max_key_code], 0,
- tmp*sizeof(XkbKeyNameRec));
- if (changes) {
- changes->names.changed= _ExtendRange(changes->names.changed,
- XkbKeyNamesMask,maxKC,
- &changes->names.first_key,
- &changes->names.num_keys);
- }
- }
- xkb->max_key_code= maxKC;
- }
- return Success;
-}
-
-XkbAction *
-XkbResizeKeyActions(XkbDescPtr xkb,int key,int needed)
-{
-register int i,nActs;
-XkbAction *newActs;
-
- if (needed==0) {
- xkb->server->key_acts[key]= 0;
- return NULL;
- }
- if (XkbKeyHasActions(xkb,key)&&(XkbKeyNumSyms(xkb,key)>=(unsigned)needed))
- return XkbKeyActionsPtr(xkb,key);
- if (xkb->server->size_acts-xkb->server->num_acts>=(unsigned)needed) {
- xkb->server->key_acts[key]= xkb->server->num_acts;
- xkb->server->num_acts+= needed;
- return &xkb->server->acts[xkb->server->key_acts[key]];
- }
- xkb->server->size_acts= xkb->server->num_acts+needed+8;
- newActs = calloc(xkb->server->size_acts, sizeof(XkbAction));
- if (newActs==NULL)
- return NULL;
- newActs[0].type = XkbSA_NoAction;
- nActs = 1;
- for (i=xkb->min_key_code;i<=(int)xkb->max_key_code;i++) {
- int nKeyActs,nCopy;
-
- if ((xkb->server->key_acts[i]==0)&&(i!=key))
- continue;
-
- nCopy= nKeyActs= XkbKeyNumActions(xkb,i);
- if (i==key) {
- nKeyActs= needed;
- if (needed<nCopy)
- nCopy= needed;
- }
-
- if (nCopy>0)
- memcpy(&newActs[nActs],XkbKeyActionsPtr(xkb,i),
- nCopy*sizeof(XkbAction));
- if (nCopy<nKeyActs)
- memset(&newActs[nActs+nCopy], 0, (nKeyActs-nCopy)*sizeof(XkbAction));
- xkb->server->key_acts[i]= nActs;
- nActs+= nKeyActs;
- }
- free(xkb->server->acts);
- xkb->server->acts = newActs;
- xkb->server->num_acts= nActs;
- return &xkb->server->acts[xkb->server->key_acts[key]];
-}
-
-void
-XkbFreeClientMap(XkbDescPtr xkb,unsigned what,Bool freeMap)
-{
-XkbClientMapPtr map;
-
- if ((xkb==NULL)||(xkb->map==NULL))
- return;
- if (freeMap)
- what= XkbAllClientInfoMask;
- map= xkb->map;
- if (what&XkbKeyTypesMask) {
- if (map->types!=NULL) {
- if (map->num_types>0) {
- register int i;
- XkbKeyTypePtr type;
- for (i=0,type=map->types;i<map->num_types;i++,type++) {
- free(type->map);
- type->map = NULL;
- free(type->preserve);
- type->preserve = NULL;
- type->map_count= 0;
- free(type->level_names);
- type->level_names = NULL;
- }
- }
- free(map->types);
- map->num_types= map->size_types= 0;
- map->types= NULL;
- }
- }
- if (what&XkbKeySymsMask) {
- free(map->key_sym_map);
- map->key_sym_map = NULL;
- if (map->syms!=NULL) {
- free(map->syms);
- map->size_syms= map->num_syms= 0;
- map->syms= NULL;
- }
- }
- if ((what&XkbModifierMapMask)&&(map->modmap!=NULL)) {
- free(map->modmap);
- map->modmap= NULL;
- }
- if (freeMap) {
- free(xkb->map);
- xkb->map= NULL;
- }
- return;
-}
-
-void
-XkbFreeServerMap(XkbDescPtr xkb,unsigned what,Bool freeMap)
-{
-XkbServerMapPtr map;
-
- if ((xkb==NULL)||(xkb->server==NULL))
- return;
- if (freeMap)
- what= XkbAllServerInfoMask;
- map= xkb->server;
- if ((what&XkbExplicitComponentsMask)&&(map->explicit!=NULL)) {
- free(map->explicit);
- map->explicit= NULL;
- }
- if (what&XkbKeyActionsMask) {
- free(map->key_acts);
- map->key_acts = NULL;
- if (map->acts!=NULL) {
- free(map->acts);
- map->num_acts= map->size_acts= 0;
- map->acts= NULL;
- }
- }
- if ((what&XkbKeyBehaviorsMask)&&(map->behaviors!=NULL)) {
- free(map->behaviors);
- map->behaviors= NULL;
- }
- if ((what&XkbVirtualModMapMask)&&(map->vmodmap!=NULL)) {
- free(map->vmodmap);
- map->vmodmap= NULL;
- }
-
- if (freeMap) {
- free(xkb->server);
- xkb->server= NULL;
- }
- return;
-}
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#elif defined(HAVE_CONFIG_H)
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "inputstr.h"
+#include <X11/keysym.h>
+#define XKBSRV_NEED_FILE_FUNCS
+#include <xkbsrv.h>
+
+/***====================================================================***/
+
+Status
+XkbAllocClientMap(XkbDescPtr xkb, unsigned which, unsigned nTotalTypes)
+{
+ register int i;
+ XkbClientMapPtr map;
+
+ if ((xkb == NULL) ||
+ ((nTotalTypes > 0) && (nTotalTypes < XkbNumRequiredTypes)))
+ return BadValue;
+ if ((which & XkbKeySymsMask) &&
+ ((!XkbIsLegalKeycode(xkb->min_key_code)) ||
+ (!XkbIsLegalKeycode(xkb->max_key_code)) ||
+ (xkb->max_key_code < xkb->min_key_code))) {
+ DebugF("bad keycode (%d,%d) in XkbAllocClientMap\n",
+ xkb->min_key_code, xkb->max_key_code);
+ return BadValue;
+ }
+
+ if (xkb->map == NULL) {
+ map = calloc(1, sizeof(XkbClientMapRec));
+ if (map == NULL)
+ return BadAlloc;
+ xkb->map = map;
+ }
+ else
+ map = xkb->map;
+
+ if ((which & XkbKeyTypesMask) && (nTotalTypes > 0)) {
+ if (map->types == NULL) {
+ map->types = calloc(nTotalTypes, sizeof(XkbKeyTypeRec));
+ if (map->types == NULL)
+ return BadAlloc;
+ map->num_types = 0;
+ map->size_types = nTotalTypes;
+ }
+ else if (map->size_types < nTotalTypes) {
+ XkbKeyTypeRec *prev_types = map->types;
+
+ map->types =
+ realloc(map->types, nTotalTypes * sizeof(XkbKeyTypeRec));
+ if (map->types == NULL) {
+ free(prev_types);
+ map->num_types = map->size_types = 0;
+ return BadAlloc;
+ }
+ map->size_types = nTotalTypes;
+ memset(&map->types[map->num_types], 0,
+ ((map->size_types -
+ map->num_types) * sizeof(XkbKeyTypeRec)));
+ }
+ }
+ if (which & XkbKeySymsMask) {
+ int nKeys = XkbNumKeys(xkb);
+
+ if (map->syms == NULL) {
+ map->size_syms = (nKeys * 15) / 10;
+ map->syms = calloc(map->size_syms, sizeof(KeySym));
+ if (!map->syms) {
+ map->size_syms = 0;
+ return BadAlloc;
+ }
+ map->num_syms = 1;
+ map->syms[0] = NoSymbol;
+ }
+ if (map->key_sym_map == NULL) {
+ i = xkb->max_key_code + 1;
+ map->key_sym_map = calloc(i, sizeof(XkbSymMapRec));
+ if (map->key_sym_map == NULL)
+ return BadAlloc;
+ }
+ }
+ if (which & XkbModifierMapMask) {
+ if ((!XkbIsLegalKeycode(xkb->min_key_code)) ||
+ (!XkbIsLegalKeycode(xkb->max_key_code)) ||
+ (xkb->max_key_code < xkb->min_key_code))
+ return BadMatch;
+ if (map->modmap == NULL) {
+ i = xkb->max_key_code + 1;
+ map->modmap = calloc(i, sizeof(unsigned char));
+ if (map->modmap == NULL)
+ return BadAlloc;
+ }
+ }
+ return Success;
+}
+
+Status
+XkbAllocServerMap(XkbDescPtr xkb, unsigned which, unsigned nNewActions)
+{
+ register int i;
+ XkbServerMapPtr map;
+
+ if (xkb == NULL)
+ return BadMatch;
+ if (xkb->server == NULL) {
+ map = calloc(1, sizeof(XkbServerMapRec));
+ if (map == NULL)
+ return BadAlloc;
+ for (i = 0; i < XkbNumVirtualMods; i++) {
+ map->vmods[i] = XkbNoModifierMask;
+ }
+ xkb->server = map;
+ }
+ else
+ map = xkb->server;
+ if (which & XkbExplicitComponentsMask) {
+ if ((!XkbIsLegalKeycode(xkb->min_key_code)) ||
+ (!XkbIsLegalKeycode(xkb->max_key_code)) ||
+ (xkb->max_key_code < xkb->min_key_code))
+ return BadMatch;
+ if (map->explicit == NULL) {
+ i = xkb->max_key_code + 1;
+ map->explicit = calloc(i, sizeof(unsigned char));
+ if (map->explicit == NULL)
+ return BadAlloc;
+ }
+ }
+ if (which & XkbKeyActionsMask) {
+ if ((!XkbIsLegalKeycode(xkb->min_key_code)) ||
+ (!XkbIsLegalKeycode(xkb->max_key_code)) ||
+ (xkb->max_key_code < xkb->min_key_code))
+ return BadMatch;
+ if (nNewActions < 1)
+ nNewActions = 1;
+ if (map->acts == NULL) {
+ map->acts = calloc((nNewActions + 1), sizeof(XkbAction));
+ if (map->acts == NULL)
+ return BadAlloc;
+ map->num_acts = 1;
+ map->size_acts = nNewActions + 1;
+ }
+ else if ((map->size_acts - map->num_acts) < nNewActions) {
+ unsigned need;
+ XkbAction *prev_acts = map->acts;
+
+ need = map->num_acts + nNewActions;
+ map->acts = realloc(map->acts, need * sizeof(XkbAction));
+ if (map->acts == NULL) {
+ free(prev_acts);
+ map->num_acts = map->size_acts = 0;
+ return BadAlloc;
+ }
+ map->size_acts = need;
+ memset(&map->acts[map->num_acts], 0,
+ ((map->size_acts - map->num_acts) * sizeof(XkbAction)));
+ }
+ if (map->key_acts == NULL) {
+ i = xkb->max_key_code + 1;
+ map->key_acts = calloc(i, sizeof(unsigned short));
+ if (map->key_acts == NULL)
+ return BadAlloc;
+ }
+ }
+ if (which & XkbKeyBehaviorsMask) {
+ if ((!XkbIsLegalKeycode(xkb->min_key_code)) ||
+ (!XkbIsLegalKeycode(xkb->max_key_code)) ||
+ (xkb->max_key_code < xkb->min_key_code))
+ return BadMatch;
+ if (map->behaviors == NULL) {
+ i = xkb->max_key_code + 1;
+ map->behaviors = calloc(i, sizeof(XkbBehavior));
+ if (map->behaviors == NULL)
+ return BadAlloc;
+ }
+ }
+ if (which & XkbVirtualModMapMask) {
+ if ((!XkbIsLegalKeycode(xkb->min_key_code)) ||
+ (!XkbIsLegalKeycode(xkb->max_key_code)) ||
+ (xkb->max_key_code < xkb->min_key_code))
+ return BadMatch;
+ if (map->vmodmap == NULL) {
+ i = xkb->max_key_code + 1;
+ map->vmodmap = calloc(i, sizeof(unsigned short));
+ if (map->vmodmap == NULL)
+ return BadAlloc;
+ }
+ }
+ return Success;
+}
+
+/***====================================================================***/
+
+static Status
+XkbCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into)
+{
+ if ((!from) || (!into))
+ return BadMatch;
+ free(into->map);
+ into->map = NULL;
+ free(into->preserve);
+ into->preserve = NULL;
+ free(into->level_names);
+ into->level_names = NULL;
+ *into = *from;
+ if ((from->map) && (into->map_count > 0)) {
+ into->map = calloc(into->map_count, sizeof(XkbKTMapEntryRec));
+ if (!into->map)
+ return BadAlloc;
+ memcpy(into->map, from->map,
+ into->map_count * sizeof(XkbKTMapEntryRec));
+ }
+ if ((from->preserve) && (into->map_count > 0)) {
+ into->preserve = calloc(into->map_count, sizeof(XkbModsRec));
+ if (!into->preserve)
+ return BadAlloc;
+ memcpy(into->preserve, from->preserve,
+ into->map_count * sizeof(XkbModsRec));
+ }
+ if ((from->level_names) && (into->num_levels > 0)) {
+ into->level_names = calloc(into->num_levels, sizeof(Atom));
+ if (!into->level_names)
+ return BadAlloc;
+ memcpy(into->level_names, from->level_names,
+ into->num_levels * sizeof(Atom));
+ }
+ return Success;
+}
+
+Status
+XkbCopyKeyTypes(XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types)
+{
+ register int i, rtrn;
+
+ if ((!from) || (!into) || (num_types < 0))
+ return BadMatch;
+ for (i = 0; i < num_types; i++) {
+ if ((rtrn = XkbCopyKeyType(from++, into++)) != Success)
+ return rtrn;
+ }
+ return Success;
+}
+
+Status
+XkbResizeKeyType(XkbDescPtr xkb,
+ int type_ndx,
+ int map_count, Bool want_preserve, int new_num_lvls)
+{
+ XkbKeyTypePtr type;
+ KeyCode matchingKeys[XkbMaxKeyCount], nMatchingKeys;
+
+ if ((type_ndx < 0) || (type_ndx >= xkb->map->num_types) || (map_count < 0)
+ || (new_num_lvls < 1))
+ return BadValue;
+ switch (type_ndx) {
+ case XkbOneLevelIndex:
+ if (new_num_lvls != 1)
+ return BadMatch;
+ break;
+ case XkbTwoLevelIndex:
+ case XkbAlphabeticIndex:
+ case XkbKeypadIndex:
+ if (new_num_lvls != 2)
+ return BadMatch;
+ break;
+ }
+ type = &xkb->map->types[type_ndx];
+ if (map_count == 0) {
+ free(type->map);
+ type->map = NULL;
+ free(type->preserve);
+ type->preserve = NULL;
+ type->map_count = 0;
+ }
+ else {
+ XkbKTMapEntryRec *prev_map = type->map;
+
+ if ((map_count > type->map_count) || (type->map == NULL))
+ type->map =
+ realloc(type->map, map_count * sizeof(XkbKTMapEntryRec));
+ if (!type->map) {
+ free(prev_map);
+ return BadAlloc;
+ }
+ if (want_preserve) {
+ XkbModsRec *prev_preserve = type->preserve;
+
+ if ((map_count > type->map_count) || (type->preserve == NULL)) {
+ type->preserve = realloc(type->preserve,
+ map_count * sizeof(XkbModsRec));
+ }
+ if (!type->preserve) {
+ free(prev_preserve);
+ return BadAlloc;
+ }
+ }
+ else {
+ free(type->preserve);
+ type->preserve = NULL;
+ }
+ type->map_count = map_count;
+ }
+
+ if ((new_num_lvls > type->num_levels) || (type->level_names == NULL)) {
+ Atom *prev_level_names = type->level_names;
+
+ type->level_names = realloc(type->level_names,
+ new_num_lvls * sizeof(Atom));
+ if (!type->level_names) {
+ free(prev_level_names);
+ return BadAlloc;
+ }
+ }
+ /*
+ * Here's the theory:
+ * If the width of the type changed, we might have to resize the symbol
+ * maps for any keys that use the type for one or more groups. This is
+ * expensive, so we'll try to cull out any keys that are obviously okay:
+ * In any case:
+ * - keys that have a group width <= the old width are okay (because
+ * they could not possibly have been associated with the old type)
+ * If the key type increased in size:
+ * - keys that already have a group width >= to the new width are okay
+ * + keys that have a group width >= the old width but < the new width
+ * might have to be enlarged.
+ * If the key type decreased in size:
+ * - keys that have a group width > the old width don't have to be
+ * resized (because they must have some other wider type associated
+ * with some group).
+ * + keys that have a group width == the old width might have to be
+ * shrunk.
+ * The possibilities marked with '+' require us to examine the key types
+ * associated with each group for the key.
+ */
+ memset(matchingKeys, 0, XkbMaxKeyCount * sizeof(KeyCode));
+ nMatchingKeys = 0;
+ if (new_num_lvls > type->num_levels) {
+ int nTotal;
+ KeySym *newSyms;
+ int width, match, nResize;
+ register int i, g, nSyms;
+
+ nResize = 0;
+ for (nTotal = 1, i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ width = XkbKeyGroupsWidth(xkb, i);
+ if (width < type->num_levels)
+ continue;
+ for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1;
+ (g >= 0) && (!match); g--) {
+ if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) {
+ matchingKeys[nMatchingKeys++] = i;
+ match = 1;
+ }
+ }
+ if ((!match) || (width >= new_num_lvls))
+ nTotal += XkbKeyNumSyms(xkb, i);
+ else {
+ nTotal += XkbKeyNumGroups(xkb, i) * new_num_lvls;
+ nResize++;
+ }
+ }
+ if (nResize > 0) {
+ int nextMatch;
+
+ xkb->map->size_syms = (nTotal * 15) / 10;
+ newSyms = calloc(xkb->map->size_syms, sizeof(KeySym));
+ if (newSyms == NULL)
+ return BadAlloc;
+ nextMatch = 0;
+ nSyms = 1;
+ for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ if (matchingKeys[nextMatch] == i) {
+ KeySym *pOld;
+
+ nextMatch++;
+ width = XkbKeyGroupsWidth(xkb, i);
+ pOld = XkbKeySymsPtr(xkb, i);
+ for (g = XkbKeyNumGroups(xkb, i) - 1; g >= 0; g--) {
+ memcpy(&newSyms[nSyms + (new_num_lvls * g)],
+ &pOld[width * g], width * sizeof(KeySym));
+ }
+ xkb->map->key_sym_map[i].offset = nSyms;
+ nSyms += XkbKeyNumGroups(xkb, i) * new_num_lvls;
+ }
+ else {
+ memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i),
+ XkbKeyNumSyms(xkb, i) * sizeof(KeySym));
+ xkb->map->key_sym_map[i].offset = nSyms;
+ nSyms += XkbKeyNumSyms(xkb, i);
+ }
+ }
+ type->num_levels = new_num_lvls;
+ free(xkb->map->syms);
+ xkb->map->syms = newSyms;
+ xkb->map->num_syms = nSyms;
+ return Success;
+ }
+ }
+ else if (new_num_lvls < type->num_levels) {
+ int width, match;
+ register int g, i;
+
+ for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ width = XkbKeyGroupsWidth(xkb, i);
+ if (width < type->num_levels)
+ continue;
+ for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1;
+ (g >= 0) && (!match); g--) {
+ if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) {
+ matchingKeys[nMatchingKeys++] = i;
+ match = 1;
+ }
+ }
+ }
+ }
+ if (nMatchingKeys > 0) {
+ int key, firstClear;
+ register int i, g;
+
+ if (new_num_lvls > type->num_levels)
+ firstClear = type->num_levels;
+ else
+ firstClear = new_num_lvls;
+ for (i = 0; i < nMatchingKeys; i++) {
+ KeySym *pSyms;
+ int width, nClear;
+
+ key = matchingKeys[i];
+ width = XkbKeyGroupsWidth(xkb, key);
+ nClear = width - firstClear;
+ pSyms = XkbKeySymsPtr(xkb, key);
+ for (g = XkbKeyNumGroups(xkb, key) - 1; g >= 0; g--) {
+ if (XkbKeyKeyTypeIndex(xkb, key, g) == type_ndx) {
+ if (nClear > 0)
+ memset(&pSyms[g * width + firstClear], 0,
+ nClear * sizeof(KeySym));
+ }
+ }
+ }
+ }
+ type->num_levels = new_num_lvls;
+ return Success;
+}
+
+KeySym *
+XkbResizeKeySyms(XkbDescPtr xkb, int key, int needed)
+{
+ register int i, nSyms, nKeySyms;
+ unsigned nOldSyms;
+ KeySym *newSyms;
+
+ if (needed == 0) {
+ xkb->map->key_sym_map[key].offset = 0;
+ return xkb->map->syms;
+ }
+ nOldSyms = XkbKeyNumSyms(xkb, key);
+ if (nOldSyms >= (unsigned) needed) {
+ return XkbKeySymsPtr(xkb, key);
+ }
+ if (xkb->map->size_syms - xkb->map->num_syms >= (unsigned) needed) {
+ if (nOldSyms > 0) {
+ memcpy(&xkb->map->syms[xkb->map->num_syms], XkbKeySymsPtr(xkb, key),
+ nOldSyms * sizeof(KeySym));
+ }
+ if ((needed - nOldSyms) > 0) {
+ memset(&xkb->map->
+ syms[xkb->map->num_syms + XkbKeyNumSyms(xkb, key)], 0,
+ (needed - nOldSyms) * sizeof(KeySym));
+ }
+ xkb->map->key_sym_map[key].offset = xkb->map->num_syms;
+ xkb->map->num_syms += needed;
+ return &xkb->map->syms[xkb->map->key_sym_map[key].offset];
+ }
+ xkb->map->size_syms += (needed > 32 ? needed : 32);
+ newSyms = calloc(xkb->map->size_syms, sizeof(KeySym));
+ if (newSyms == NULL)
+ return NULL;
+ newSyms[0] = NoSymbol;
+ nSyms = 1;
+ for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) {
+ int nCopy;
+
+ nCopy = nKeySyms = XkbKeyNumSyms(xkb, i);
+ if ((nKeySyms == 0) && (i != key))
+ continue;
+ if (i == key)
+ nKeySyms = needed;
+ if (nCopy != 0)
+ memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i),
+ nCopy * sizeof(KeySym));
+ if (nKeySyms > nCopy)
+ memset(&newSyms[nSyms + nCopy], 0,
+ (nKeySyms - nCopy) * sizeof(KeySym));
+ xkb->map->key_sym_map[i].offset = nSyms;
+ nSyms += nKeySyms;
+ }
+ free(xkb->map->syms);
+ xkb->map->syms = newSyms;
+ xkb->map->num_syms = nSyms;
+ return &xkb->map->syms[xkb->map->key_sym_map[key].offset];
+}
+
+static unsigned
+_ExtendRange(unsigned int old_flags,
+ unsigned int flag,
+ KeyCode newKC, KeyCode *old_min, unsigned char *old_num)
+{
+ if ((old_flags & flag) == 0) {
+ old_flags |= flag;
+ *old_min = newKC;
+ *old_num = 1;
+ }
+ else {
+ int last = (*old_min) + (*old_num) - 1;
+
+ if (newKC < *old_min) {
+ *old_min = newKC;
+ *old_num = (last - newKC) + 1;
+ }
+ else if (newKC > last) {
+ *old_num = (newKC - (*old_min)) + 1;
+ }
+ }
+ return old_flags;
+}
+
+Status
+XkbChangeKeycodeRange(XkbDescPtr xkb,
+ int minKC, int maxKC, XkbChangesPtr changes)
+{
+ int tmp;
+
+ if ((!xkb) || (minKC < XkbMinLegalKeyCode) || (maxKC > XkbMaxLegalKeyCode))
+ return BadValue;
+ if (minKC > maxKC)
+ return BadMatch;
+ if (minKC < xkb->min_key_code) {
+ if (changes)
+ changes->map.min_key_code = minKC;
+ tmp = xkb->min_key_code - minKC;
+ if (xkb->map) {
+ if (xkb->map->key_sym_map) {
+ memset((char *) &xkb->map->key_sym_map[minKC], 0,
+ tmp * sizeof(XkbSymMapRec));
+ if (changes) {
+ changes->map.changed = _ExtendRange(changes->map.changed,
+ XkbKeySymsMask, minKC,
+ &changes->map.
+ first_key_sym,
+ &changes->map.
+ num_key_syms);
+ }
+ }
+ if (xkb->map->modmap) {
+ memset((char *) &xkb->map->modmap[minKC], 0, tmp);
+ if (changes) {
+ changes->map.changed = _ExtendRange(changes->map.changed,
+ XkbModifierMapMask,
+ minKC,
+ &changes->map.
+ first_modmap_key,
+ &changes->map.
+ num_modmap_keys);
+ }
+ }
+ }
+ if (xkb->server) {
+ if (xkb->server->behaviors) {
+ memset((char *) &xkb->server->behaviors[minKC], 0,
+ tmp * sizeof(XkbBehavior));
+ if (changes) {
+ changes->map.changed = _ExtendRange(changes->map.changed,
+ XkbKeyBehaviorsMask,
+ minKC,
+ &changes->map.
+ first_key_behavior,
+ &changes->map.
+ num_key_behaviors);
+ }
+ }
+ if (xkb->server->key_acts) {
+ memset((char *) &xkb->server->key_acts[minKC], 0,
+ tmp * sizeof(unsigned short));
+ if (changes) {
+ changes->map.changed = _ExtendRange(changes->map.changed,
+ XkbKeyActionsMask,
+ minKC,
+ &changes->map.
+ first_key_act,
+ &changes->map.
+ num_key_acts);
+ }
+ }
+ if (xkb->server->vmodmap) {
+ memset((char *) &xkb->server->vmodmap[minKC], 0,
+ tmp * sizeof(unsigned short));
+ if (changes) {
+ changes->map.changed = _ExtendRange(changes->map.changed,
+ XkbVirtualModMapMask,
+ minKC,
+ &changes->map.
+ first_modmap_key,
+ &changes->map.
+ num_vmodmap_keys);
+ }
+ }
+ }
+ if ((xkb->names) && (xkb->names->keys)) {
+ memset((char *) &xkb->names->keys[minKC], 0,
+ tmp * sizeof(XkbKeyNameRec));
+ if (changes) {
+ changes->names.changed = _ExtendRange(changes->names.changed,
+ XkbKeyNamesMask, minKC,
+ &changes->names.first_key,
+ &changes->names.num_keys);
+ }
+ }
+ xkb->min_key_code = minKC;
+ }
+ if (maxKC > xkb->max_key_code) {
+ if (changes)
+ changes->map.max_key_code = maxKC;
+ tmp = maxKC - xkb->max_key_code;
+ if (xkb->map) {
+ if (xkb->map->key_sym_map) {
+ XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map;
+
+ xkb->map->key_sym_map = realloc(xkb->map->key_sym_map,
+ (maxKC +
+ 1) * sizeof(XkbSymMapRec));
+ if (!xkb->map->key_sym_map) {
+ free(prev_key_sym_map);
+ return BadAlloc;
+ }
+ memset((char *) &xkb->map->key_sym_map[xkb->max_key_code], 0,
+ tmp * sizeof(XkbSymMapRec));
+ if (changes) {
+ changes->map.changed = _ExtendRange(changes->map.changed,
+ XkbKeySymsMask, maxKC,
+ &changes->map.
+ first_key_sym,
+ &changes->map.
+ num_key_syms);
+ }
+ }
+ if (xkb->map->modmap) {
+ unsigned char *prev_modmap = xkb->map->modmap;
+
+ xkb->map->modmap = realloc(xkb->map->modmap,
+ (maxKC + 1) * sizeof(unsigned char));
+ if (!xkb->map->modmap) {
+ free(prev_modmap);
+ return BadAlloc;
+ }
+ memset((char *) &xkb->map->modmap[xkb->max_key_code], 0, tmp);
+ if (changes) {
+ changes->map.changed = _ExtendRange(changes->map.changed,
+ XkbModifierMapMask,
+ maxKC,
+ &changes->map.
+ first_modmap_key,
+ &changes->map.
+ num_modmap_keys);
+ }
+ }
+ }
+ if (xkb->server) {
+ if (xkb->server->behaviors) {
+ XkbBehavior *prev_behaviors = xkb->server->behaviors;
+
+ xkb->server->behaviors = realloc(xkb->server->behaviors,
+ (maxKC +
+ 1) * sizeof(XkbBehavior));
+ if (!xkb->server->behaviors) {
+ free(prev_behaviors);
+ return BadAlloc;
+ }
+ memset((char *) &xkb->server->behaviors[xkb->max_key_code], 0,
+ tmp * sizeof(XkbBehavior));
+ if (changes) {
+ changes->map.changed = _ExtendRange(changes->map.changed,
+ XkbKeyBehaviorsMask,
+ maxKC,
+ &changes->map.
+ first_key_behavior,
+ &changes->map.
+ num_key_behaviors);
+ }
+ }
+ if (xkb->server->key_acts) {
+ unsigned short *prev_key_acts = xkb->server->key_acts;
+
+ xkb->server->key_acts = realloc(xkb->server->key_acts,
+ (maxKC +
+ 1) * sizeof(unsigned short));
+ if (!xkb->server->key_acts) {
+ free(prev_key_acts);
+ return BadAlloc;
+ }
+ memset((char *) &xkb->server->key_acts[xkb->max_key_code], 0,
+ tmp * sizeof(unsigned short));
+ if (changes) {
+ changes->map.changed = _ExtendRange(changes->map.changed,
+ XkbKeyActionsMask,
+ maxKC,
+ &changes->map.
+ first_key_act,
+ &changes->map.
+ num_key_acts);
+ }
+ }
+ if (xkb->server->vmodmap) {
+ unsigned short *prev_vmodmap = xkb->server->vmodmap;
+
+ xkb->server->vmodmap = realloc(xkb->server->vmodmap,
+ (maxKC +
+ 1) * sizeof(unsigned short));
+ if (!xkb->server->vmodmap) {
+ free(prev_vmodmap);
+ return BadAlloc;
+ }
+ memset((char *) &xkb->server->vmodmap[xkb->max_key_code], 0,
+ tmp * sizeof(unsigned short));
+ if (changes) {
+ changes->map.changed = _ExtendRange(changes->map.changed,
+ XkbVirtualModMapMask,
+ maxKC,
+ &changes->map.
+ first_modmap_key,
+ &changes->map.
+ num_vmodmap_keys);
+ }
+ }
+ }
+ if ((xkb->names) && (xkb->names->keys)) {
+ XkbKeyNameRec *prev_keys = xkb->names->keys;
+
+ xkb->names->keys = realloc(xkb->names->keys,
+ (maxKC + 1) * sizeof(XkbKeyNameRec));
+ if (!xkb->names->keys) {
+ free(prev_keys);
+ return BadAlloc;
+ }
+ memset((char *) &xkb->names->keys[xkb->max_key_code], 0,
+ tmp * sizeof(XkbKeyNameRec));
+ if (changes) {
+ changes->names.changed = _ExtendRange(changes->names.changed,
+ XkbKeyNamesMask, maxKC,
+ &changes->names.first_key,
+ &changes->names.num_keys);
+ }
+ }
+ xkb->max_key_code = maxKC;
+ }
+ return Success;
+}
+
+XkbAction *
+XkbResizeKeyActions(XkbDescPtr xkb, int key, int needed)
+{
+ register int i, nActs;
+ XkbAction *newActs;
+
+ if (needed == 0) {
+ xkb->server->key_acts[key] = 0;
+ return NULL;
+ }
+ if (XkbKeyHasActions(xkb, key) &&
+ (XkbKeyNumSyms(xkb, key) >= (unsigned) needed))
+ return XkbKeyActionsPtr(xkb, key);
+ if (xkb->server->size_acts - xkb->server->num_acts >= (unsigned) needed) {
+ xkb->server->key_acts[key] = xkb->server->num_acts;
+ xkb->server->num_acts += needed;
+ return &xkb->server->acts[xkb->server->key_acts[key]];
+ }
+ xkb->server->size_acts = xkb->server->num_acts + needed + 8;
+ newActs = calloc(xkb->server->size_acts, sizeof(XkbAction));
+ if (newActs == NULL)
+ return NULL;
+ newActs[0].type = XkbSA_NoAction;
+ nActs = 1;
+ for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) {
+ int nKeyActs, nCopy;
+
+ if ((xkb->server->key_acts[i] == 0) && (i != key))
+ continue;
+
+ nCopy = nKeyActs = XkbKeyNumActions(xkb, i);
+ if (i == key) {
+ nKeyActs = needed;
+ if (needed < nCopy)
+ nCopy = needed;
+ }
+
+ if (nCopy > 0)
+ memcpy(&newActs[nActs], XkbKeyActionsPtr(xkb, i),
+ nCopy * sizeof(XkbAction));
+ if (nCopy < nKeyActs)
+ memset(&newActs[nActs + nCopy], 0,
+ (nKeyActs - nCopy) * sizeof(XkbAction));
+ xkb->server->key_acts[i] = nActs;
+ nActs += nKeyActs;
+ }
+ free(xkb->server->acts);
+ xkb->server->acts = newActs;
+ xkb->server->num_acts = nActs;
+ return &xkb->server->acts[xkb->server->key_acts[key]];
+}
+
+void
+XkbFreeClientMap(XkbDescPtr xkb, unsigned what, Bool freeMap)
+{
+ XkbClientMapPtr map;
+
+ if ((xkb == NULL) || (xkb->map == NULL))
+ return;
+ if (freeMap)
+ what = XkbAllClientInfoMask;
+ map = xkb->map;
+ if (what & XkbKeyTypesMask) {
+ if (map->types != NULL) {
+ if (map->num_types > 0) {
+ register int i;
+ XkbKeyTypePtr type;
+
+ for (i = 0, type = map->types; i < map->num_types; i++, type++) {
+ free(type->map);
+ type->map = NULL;
+ free(type->preserve);
+ type->preserve = NULL;
+ type->map_count = 0;
+ free(type->level_names);
+ type->level_names = NULL;
+ }
+ }
+ free(map->types);
+ map->num_types = map->size_types = 0;
+ map->types = NULL;
+ }
+ }
+ if (what & XkbKeySymsMask) {
+ free(map->key_sym_map);
+ map->key_sym_map = NULL;
+ if (map->syms != NULL) {
+ free(map->syms);
+ map->size_syms = map->num_syms = 0;
+ map->syms = NULL;
+ }
+ }
+ if ((what & XkbModifierMapMask) && (map->modmap != NULL)) {
+ free(map->modmap);
+ map->modmap = NULL;
+ }
+ if (freeMap) {
+ free(xkb->map);
+ xkb->map = NULL;
+ }
+ return;
+}
+
+void
+XkbFreeServerMap(XkbDescPtr xkb, unsigned what, Bool freeMap)
+{
+ XkbServerMapPtr map;
+
+ if ((xkb == NULL) || (xkb->server == NULL))
+ return;
+ if (freeMap)
+ what = XkbAllServerInfoMask;
+ map = xkb->server;
+ if ((what & XkbExplicitComponentsMask) && (map->explicit != NULL)) {
+ free(map->explicit);
+ map->explicit = NULL;
+ }
+ if (what & XkbKeyActionsMask) {
+ free(map->key_acts);
+ map->key_acts = NULL;
+ if (map->acts != NULL) {
+ free(map->acts);
+ map->num_acts = map->size_acts = 0;
+ map->acts = NULL;
+ }
+ }
+ if ((what & XkbKeyBehaviorsMask) && (map->behaviors != NULL)) {
+ free(map->behaviors);
+ map->behaviors = NULL;
+ }
+ if ((what & XkbVirtualModMapMask) && (map->vmodmap != NULL)) {
+ free(map->vmodmap);
+ map->vmodmap = NULL;
+ }
+
+ if (freeMap) {
+ free(xkb->server);
+ xkb->server = NULL;
+ }
+ return;
+}
diff --git a/xorg-server/xkb/XKBMisc.c b/xorg-server/xkb/XKBMisc.c
index 96688be18..6abd1d11a 100644
--- a/xorg-server/xkb/XKBMisc.c
+++ b/xorg-server/xkb/XKBMisc.c
@@ -45,56 +45,54 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define XKB_OFFSET(g,l) (((g)*groupsWidth)+(l))
int
-XkbKeyTypesForCoreSymbols( XkbDescPtr xkb,
- int map_width,
- KeySym * core_syms,
- unsigned int protected,
- int * types_inout,
- KeySym * xkb_syms_rtrn)
+XkbKeyTypesForCoreSymbols(XkbDescPtr xkb,
+ int map_width,
+ KeySym * core_syms,
+ unsigned int protected,
+ int *types_inout, KeySym * xkb_syms_rtrn)
{
-register int i;
-unsigned int empty;
-int nSyms[XkbNumKbdGroups];
-int nGroups,tmp,groupsWidth;
-BOOL replicated = FALSE;
+ register int i;
+ unsigned int empty;
+ int nSyms[XkbNumKbdGroups];
+ int nGroups, tmp, groupsWidth;
+ BOOL replicated = FALSE;
/* Section 12.2 of the protocol describes this process in more detail */
/* Step 1: find the # of symbols in the core mapping per group */
- groupsWidth= 2;
- for (i=0;i<XkbNumKbdGroups;i++) {
- if ((protected&(1<<i))&&(types_inout[i]<xkb->map->num_types)) {
- nSyms[i]= xkb->map->types[types_inout[i]].num_levels;
- if (nSyms[i]>groupsWidth)
- groupsWidth= nSyms[i];
- }
- else {
- types_inout[i]= XkbTwoLevelIndex; /* don't really know, yet */
- nSyms[i]= 2;
- }
- }
- if (nSyms[XkbGroup1Index]<2)
- nSyms[XkbGroup1Index]= 2;
- if (nSyms[XkbGroup2Index]<2)
- nSyms[XkbGroup2Index]= 2;
- /* Step 2: Copy the symbols from the core ordering to XKB ordering */
- /* symbols in the core are in the order: */
- /* G1L1 G1L2 G2L1 G2L2 [G1L[3-n]] [G2L[3-n]] [G3L*] [G3L*] */
- xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index,0)]= CORE_SYM(0);
- xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index,1)]= CORE_SYM(1);
- for (i=2;i<nSyms[XkbGroup1Index];i++) {
- xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index,i)]= CORE_SYM(2+i);
- }
- xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index,0)]= CORE_SYM(2);
- xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index,1)]= CORE_SYM(3);
- tmp= 2+(nSyms[XkbGroup1Index]-2); /* offset to extra group2 syms */
- for (i=2;i<nSyms[XkbGroup2Index];i++) {
- xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index,i)]= CORE_SYM(tmp+i);
+ groupsWidth = 2;
+ for (i = 0; i < XkbNumKbdGroups; i++) {
+ if ((protected & (1 << i)) && (types_inout[i] < xkb->map->num_types)) {
+ nSyms[i] = xkb->map->types[types_inout[i]].num_levels;
+ if (nSyms[i] > groupsWidth)
+ groupsWidth = nSyms[i];
+ }
+ else {
+ types_inout[i] = XkbTwoLevelIndex; /* don't really know, yet */
+ nSyms[i] = 2;
+ }
+ }
+ if (nSyms[XkbGroup1Index] < 2)
+ nSyms[XkbGroup1Index] = 2;
+ if (nSyms[XkbGroup2Index] < 2)
+ nSyms[XkbGroup2Index] = 2;
+ /* Step 2: Copy the symbols from the core ordering to XKB ordering */
+ /* symbols in the core are in the order: */
+ /* G1L1 G1L2 G2L1 G2L2 [G1L[3-n]] [G2L[3-n]] [G3L*] [G3L*] */
+ xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, 0)] = CORE_SYM(0);
+ xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, 1)] = CORE_SYM(1);
+ for (i = 2; i < nSyms[XkbGroup1Index]; i++) {
+ xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, i)] = CORE_SYM(2 + i);
+ }
+ xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, 0)] = CORE_SYM(2);
+ xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, 1)] = CORE_SYM(3);
+ tmp = 2 + (nSyms[XkbGroup1Index] - 2); /* offset to extra group2 syms */
+ for (i = 2; i < nSyms[XkbGroup2Index]; i++) {
+ xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, i)] = CORE_SYM(tmp + i);
}
/* Special case: if only the first group is explicit, and the symbols
* replicate across all groups, then we have a Section 12.4 replication */
- if ((protected & ~XkbExplicitKeyType1Mask) == 0)
- {
+ if ((protected & ~XkbExplicitKeyType1Mask) == 0) {
int j, width = nSyms[XkbGroup1Index];
replicated = TRUE;
@@ -105,119 +103,123 @@ BOOL replicated = FALSE;
replicated = FALSE;
/* Check CDECDE in ABABCDECDEABCDE */
- for (i = 2; i < width && replicated; i++)
- {
+ for (i = 2; i < width && replicated; i++) {
if (CORE_SYM(2 + i) != CORE_SYM(i + width))
replicated = FALSE;
}
/* Check ABCDE in ABABCDECDEABCDE */
for (j = 2; replicated &&
- j < XkbNumKbdGroups &&
- map_width >= width * (j + 1); j++)
- {
- for (i = 0; i < width && replicated; i++)
- {
+ j < XkbNumKbdGroups && map_width >= width * (j + 1); j++) {
+ for (i = 0; i < width && replicated; i++) {
if (CORE_SYM(((i < 2) ? i : 2 + i)) != CORE_SYM(i + width * j))
replicated = FALSE;
}
}
}
- if (replicated)
- {
- nSyms[XkbGroup2Index]= 0;
- nSyms[XkbGroup3Index]= 0;
- nSyms[XkbGroup4Index]= 0;
- nGroups= 1;
- } else
- {
- tmp= nSyms[XkbGroup1Index]+nSyms[XkbGroup2Index];
- if ((tmp>=map_width)&&
- ((protected&(XkbExplicitKeyType3Mask|XkbExplicitKeyType4Mask))==0)) {
- nSyms[XkbGroup3Index]= 0;
- nSyms[XkbGroup4Index]= 0;
- nGroups= 2;
- } else
- {
- nGroups= 3;
- for (i=0;i<nSyms[XkbGroup3Index];i++,tmp++) {
- xkb_syms_rtrn[XKB_OFFSET(XkbGroup3Index,i)]= CORE_SYM(tmp);
+ if (replicated) {
+ nSyms[XkbGroup2Index] = 0;
+ nSyms[XkbGroup3Index] = 0;
+ nSyms[XkbGroup4Index] = 0;
+ nGroups = 1;
+ }
+ else {
+ tmp = nSyms[XkbGroup1Index] + nSyms[XkbGroup2Index];
+ if ((tmp >= map_width) &&
+ ((protected & (XkbExplicitKeyType3Mask | XkbExplicitKeyType4Mask))
+ == 0)) {
+ nSyms[XkbGroup3Index] = 0;
+ nSyms[XkbGroup4Index] = 0;
+ nGroups = 2;
+ }
+ else {
+ nGroups = 3;
+ for (i = 0; i < nSyms[XkbGroup3Index]; i++, tmp++) {
+ xkb_syms_rtrn[XKB_OFFSET(XkbGroup3Index, i)] = CORE_SYM(tmp);
}
- if ((tmp<map_width)||(protected&XkbExplicitKeyType4Mask)) {
- nGroups= 4;
- for (i=0;i<nSyms[XkbGroup4Index];i++,tmp++) {
- xkb_syms_rtrn[XKB_OFFSET(XkbGroup4Index,i)]= CORE_SYM(tmp);
+ if ((tmp < map_width) || (protected & XkbExplicitKeyType4Mask)) {
+ nGroups = 4;
+ for (i = 0; i < nSyms[XkbGroup4Index]; i++, tmp++) {
+ xkb_syms_rtrn[XKB_OFFSET(XkbGroup4Index, i)] =
+ CORE_SYM(tmp);
}
}
else {
- nSyms[XkbGroup4Index]= 0;
+ nSyms[XkbGroup4Index] = 0;
}
}
}
/* steps 3&4: alphanumeric expansion, assign canonical types */
- empty= 0;
- for (i=0;i<nGroups;i++) {
- KeySym *syms;
- syms= &xkb_syms_rtrn[XKB_OFFSET(i,0)];
- if ((nSyms[i]>1)&&(syms[1]==NoSymbol)&&(syms[0]!=NoSymbol)) {
- KeySym upper,lower;
- XkbConvertCase(syms[0],&lower,&upper);
- if (upper!=lower) {
- xkb_syms_rtrn[XKB_OFFSET(i,0)]= lower;
- xkb_syms_rtrn[XKB_OFFSET(i,1)]= upper;
- if ((protected&(1<<i))==0)
- types_inout[i]= XkbAlphabeticIndex;
- }
- else if ((protected&(1<<i))==0) {
- types_inout[i]= XkbOneLevelIndex;
- /* nSyms[i]= 1;*/
- }
- }
- if (((protected&(1<<i))==0)&&(types_inout[i]==XkbTwoLevelIndex)) {
- if (XkbKSIsKeypad(syms[0])||XkbKSIsKeypad(syms[1]))
- types_inout[i]= XkbKeypadIndex;
- else {
- KeySym upper,lower;
- XkbConvertCase(syms[0],&lower,&upper);
- if ((syms[0]==lower)&&(syms[1]==upper))
- types_inout[i]= XkbAlphabeticIndex;
- }
- }
- if (syms[0]==NoSymbol) {
- register int n;
- Bool found;
- for (n=1,found=FALSE;(!found)&&(n<nSyms[i]);n++) {
- found= (syms[n]!=NoSymbol);
- }
- if (!found)
- empty|= (1<<i);
- }
+ empty = 0;
+ for (i = 0; i < nGroups; i++) {
+ KeySym *syms;
+
+ syms = &xkb_syms_rtrn[XKB_OFFSET(i, 0)];
+ if ((nSyms[i] > 1) && (syms[1] == NoSymbol) && (syms[0] != NoSymbol)) {
+ KeySym upper, lower;
+
+ XkbConvertCase(syms[0], &lower, &upper);
+ if (upper != lower) {
+ xkb_syms_rtrn[XKB_OFFSET(i, 0)] = lower;
+ xkb_syms_rtrn[XKB_OFFSET(i, 1)] = upper;
+ if ((protected & (1 << i)) == 0)
+ types_inout[i] = XkbAlphabeticIndex;
+ }
+ else if ((protected & (1 << i)) == 0) {
+ types_inout[i] = XkbOneLevelIndex;
+ /* nSyms[i]= 1; */
+ }
+ }
+ if (((protected & (1 << i)) == 0) &&
+ (types_inout[i] == XkbTwoLevelIndex)) {
+ if (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1]))
+ types_inout[i] = XkbKeypadIndex;
+ else {
+ KeySym upper, lower;
+
+ XkbConvertCase(syms[0], &lower, &upper);
+ if ((syms[0] == lower) && (syms[1] == upper))
+ types_inout[i] = XkbAlphabeticIndex;
+ }
+ }
+ if (syms[0] == NoSymbol) {
+ register int n;
+ Bool found;
+
+ for (n = 1, found = FALSE; (!found) && (n < nSyms[i]); n++) {
+ found = (syms[n] != NoSymbol);
+ }
+ if (!found)
+ empty |= (1 << i);
+ }
}
/* step 5: squoosh out empty groups */
if (empty) {
- for (i=nGroups-1;i>=0;i--) {
- if (((empty&(1<<i))==0)||(protected&(1<<i)))
- break;
- nGroups--;
- }
+ for (i = nGroups - 1; i >= 0; i--) {
+ if (((empty & (1 << i)) == 0) || (protected & (1 << i)))
+ break;
+ nGroups--;
+ }
}
- if (nGroups<1)
- return 0;
+ if (nGroups < 1)
+ return 0;
/* step 6: replicate group 1 into group two, if necessary */
- if ((nGroups>1)&&((empty&(XkbGroup1Mask|XkbGroup2Mask))==XkbGroup2Mask)) {
- if ((protected&(XkbExplicitKeyType1Mask|XkbExplicitKeyType2Mask))==0) {
- nSyms[XkbGroup2Index]= nSyms[XkbGroup1Index];
- types_inout[XkbGroup2Index]= types_inout[XkbGroup1Index];
- memcpy((char *)&xkb_syms_rtrn[2],(char *)xkb_syms_rtrn,
- 2*sizeof(KeySym));
- }
- else if (types_inout[XkbGroup1Index]==types_inout[XkbGroup2Index]) {
- memcpy((char *)&xkb_syms_rtrn[nSyms[XkbGroup1Index]],
- (char *)xkb_syms_rtrn,
- nSyms[XkbGroup1Index]*sizeof(KeySym));
- }
+ if ((nGroups > 1) &&
+ ((empty & (XkbGroup1Mask | XkbGroup2Mask)) == XkbGroup2Mask)) {
+ if ((protected & (XkbExplicitKeyType1Mask | XkbExplicitKeyType2Mask)) ==
+ 0) {
+ nSyms[XkbGroup2Index] = nSyms[XkbGroup1Index];
+ types_inout[XkbGroup2Index] = types_inout[XkbGroup1Index];
+ memcpy((char *) &xkb_syms_rtrn[2], (char *) xkb_syms_rtrn,
+ 2 * sizeof(KeySym));
+ }
+ else if (types_inout[XkbGroup1Index] == types_inout[XkbGroup2Index]) {
+ memcpy((char *) &xkb_syms_rtrn[nSyms[XkbGroup1Index]],
+ (char *) xkb_syms_rtrn,
+ nSyms[XkbGroup1Index] * sizeof(KeySym));
+ }
}
/* step 7: check for all groups identical or all width 1
@@ -226,136 +228,145 @@ BOOL replicated = FALSE;
* have canonical types with same symbols, we assume it's info lost from
* the core replication.
*/
- if (nGroups>1) {
- Bool sameType,allOneLevel, canonical = TRUE;
- allOneLevel= (xkb->map->types[types_inout[0]].num_levels==1);
- for (i=1,sameType=TRUE;(allOneLevel||sameType)&&(i<nGroups);i++) {
- sameType=(sameType&&(types_inout[i]==types_inout[XkbGroup1Index]));
- if (allOneLevel)
- allOneLevel= (xkb->map->types[types_inout[i]].num_levels==1);
- if (types_inout[i] > XkbLastRequiredType)
- canonical = FALSE;
- }
- if (((sameType) || canonical)&&
- (!(protected&(XkbExplicitKeyTypesMask&~XkbExplicitKeyType1Mask)))){
- register int s;
- Bool identical;
- for (i=1,identical=TRUE;identical&&(i<nGroups);i++) {
- KeySym *syms;
+ if (nGroups > 1) {
+ Bool sameType, allOneLevel, canonical = TRUE;
+
+ allOneLevel = (xkb->map->types[types_inout[0]].num_levels == 1);
+ for (i = 1, sameType = TRUE; (allOneLevel || sameType) && (i < nGroups);
+ i++) {
+ sameType = (sameType &&
+ (types_inout[i] == types_inout[XkbGroup1Index]));
+ if (allOneLevel)
+ allOneLevel = (xkb->map->types[types_inout[i]].num_levels == 1);
+ if (types_inout[i] > XkbLastRequiredType)
+ canonical = FALSE;
+ }
+ if (((sameType) || canonical) &&
+ (!(protected &
+ (XkbExplicitKeyTypesMask & ~XkbExplicitKeyType1Mask)))) {
+ register int s;
+ Bool identical;
+
+ for (i = 1, identical = TRUE; identical && (i < nGroups); i++) {
+ KeySym *syms;
+
if (nSyms[i] != nSyms[XkbGroup1Index])
identical = FALSE;
- syms= &xkb_syms_rtrn[XKB_OFFSET(i,0)];
- for (s=0;identical&&(s<nSyms[i]);s++) {
- if (syms[s]!=xkb_syms_rtrn[s])
- identical= FALSE;
- }
- }
- if (identical)
- nGroups= 1;
- }
- if (allOneLevel && (nGroups>1)) {
- KeySym *syms;
- syms= &xkb_syms_rtrn[nSyms[XkbGroup1Index]];
- nSyms[XkbGroup1Index]= 1;
- for (i=1;i<nGroups;i++) {
- xkb_syms_rtrn[i]= syms[0];
- syms+= nSyms[i];
- nSyms[i]= 1;
- }
- }
+ syms = &xkb_syms_rtrn[XKB_OFFSET(i, 0)];
+ for (s = 0; identical && (s < nSyms[i]); s++) {
+ if (syms[s] != xkb_syms_rtrn[s])
+ identical = FALSE;
+ }
+ }
+ if (identical)
+ nGroups = 1;
+ }
+ if (allOneLevel && (nGroups > 1)) {
+ KeySym *syms;
+
+ syms = &xkb_syms_rtrn[nSyms[XkbGroup1Index]];
+ nSyms[XkbGroup1Index] = 1;
+ for (i = 1; i < nGroups; i++) {
+ xkb_syms_rtrn[i] = syms[0];
+ syms += nSyms[i];
+ nSyms[i] = 1;
+ }
+ }
}
return nGroups;
}
static XkbSymInterpretPtr
-_XkbFindMatchingInterp( XkbDescPtr xkb,
- KeySym sym,
- unsigned int real_mods,
- unsigned int level)
+_XkbFindMatchingInterp(XkbDescPtr xkb,
+ KeySym sym, unsigned int real_mods, unsigned int level)
{
-register unsigned i;
-XkbSymInterpretPtr interp,rtrn;
-CARD8 mods;
-
- rtrn= NULL;
- interp= xkb->compat->sym_interpret;
- for (i=0;i<xkb->compat->num_si;i++,interp++) {
- if ((interp->sym==NoSymbol)||(sym==interp->sym)) {
- int match;
- if ((level==0)||((interp->match&XkbSI_LevelOneOnly)==0))
- mods= real_mods;
- else mods= 0;
- switch (interp->match&XkbSI_OpMask) {
- case XkbSI_NoneOf:
- match= ((interp->mods&mods)==0);
- break;
- case XkbSI_AnyOfOrNone:
- match= ((mods==0)||((interp->mods&mods)!=0));
- break;
- case XkbSI_AnyOf:
- match= ((interp->mods&mods)!=0);
- break;
- case XkbSI_AllOf:
- match= ((interp->mods&mods)==interp->mods);
- break;
- case XkbSI_Exactly:
- match= (interp->mods==mods);
- break;
- default:
- match= 0;
- break;
- }
- if (match) {
- if (interp->sym!=NoSymbol) {
- return interp;
- }
- else if (rtrn==NULL) {
- rtrn= interp;
- }
- }
- }
+ register unsigned i;
+ XkbSymInterpretPtr interp, rtrn;
+ CARD8 mods;
+
+ rtrn = NULL;
+ interp = xkb->compat->sym_interpret;
+ for (i = 0; i < xkb->compat->num_si; i++, interp++) {
+ if ((interp->sym == NoSymbol) || (sym == interp->sym)) {
+ int match;
+
+ if ((level == 0) || ((interp->match & XkbSI_LevelOneOnly) == 0))
+ mods = real_mods;
+ else
+ mods = 0;
+ switch (interp->match & XkbSI_OpMask) {
+ case XkbSI_NoneOf:
+ match = ((interp->mods & mods) == 0);
+ break;
+ case XkbSI_AnyOfOrNone:
+ match = ((mods == 0) || ((interp->mods & mods) != 0));
+ break;
+ case XkbSI_AnyOf:
+ match = ((interp->mods & mods) != 0);
+ break;
+ case XkbSI_AllOf:
+ match = ((interp->mods & mods) == interp->mods);
+ break;
+ case XkbSI_Exactly:
+ match = (interp->mods == mods);
+ break;
+ default:
+ match = 0;
+ break;
+ }
+ if (match) {
+ if (interp->sym != NoSymbol) {
+ return interp;
+ }
+ else if (rtrn == NULL) {
+ rtrn = interp;
+ }
+ }
+ }
}
return rtrn;
}
static void
-_XkbAddKeyChange(KeyCode *pFirst,unsigned char *pNum,KeyCode newKey)
+_XkbAddKeyChange(KeyCode *pFirst, unsigned char *pNum, KeyCode newKey)
{
-KeyCode last;
+ KeyCode last;
- last= (*pFirst)+(*pNum);
- if (newKey<*pFirst) {
- *pFirst= newKey;
- *pNum= (last-newKey)+1;
+ last = (*pFirst) + (*pNum);
+ if (newKey < *pFirst) {
+ *pFirst = newKey;
+ *pNum = (last - newKey) + 1;
}
- else if (newKey>last) {
- *pNum= (last-*pFirst)+1;
+ else if (newKey > last) {
+ *pNum = (last - *pFirst) + 1;
}
return;
}
static void
-_XkbSetActionKeyMods(XkbDescPtr xkb,XkbAction *act,unsigned mods)
+_XkbSetActionKeyMods(XkbDescPtr xkb, XkbAction *act, unsigned mods)
{
-unsigned tmp;
+ unsigned tmp;
switch (act->type) {
- case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
- if (act->mods.flags&XkbSA_UseModMapMods)
- act->mods.real_mods= act->mods.mask= mods;
- if ((tmp= XkbModActionVMods(&act->mods))!=0) {
- XkbVirtualModsToReal(xkb,tmp,&tmp);
- act->mods.mask|= tmp;
- }
- break;
- case XkbSA_ISOLock:
- if (act->iso.flags&XkbSA_UseModMapMods)
- act->iso.real_mods= act->iso.mask= mods;
- if ((tmp= XkbModActionVMods(&act->iso))!=0) {
- XkbVirtualModsToReal(xkb,tmp,&tmp);
- act->iso.mask|= tmp;
- }
- break;
+ case XkbSA_SetMods:
+ case XkbSA_LatchMods:
+ case XkbSA_LockMods:
+ if (act->mods.flags & XkbSA_UseModMapMods)
+ act->mods.real_mods = act->mods.mask = mods;
+ if ((tmp = XkbModActionVMods(&act->mods)) != 0) {
+ XkbVirtualModsToReal(xkb, tmp, &tmp);
+ act->mods.mask |= tmp;
+ }
+ break;
+ case XkbSA_ISOLock:
+ if (act->iso.flags & XkbSA_UseModMapMods)
+ act->iso.real_mods = act->iso.mask = mods;
+ if ((tmp = XkbModActionVMods(&act->iso)) != 0) {
+ XkbVirtualModsToReal(xkb, tmp, &tmp);
+ act->iso.mask |= tmp;
+ }
+ break;
}
return;
}
@@ -363,273 +374,285 @@ unsigned tmp;
#define IBUF_SIZE 8
Bool
-XkbApplyCompatMapToKey(XkbDescPtr xkb,KeyCode key,XkbChangesPtr changes)
+XkbApplyCompatMapToKey(XkbDescPtr xkb, KeyCode key, XkbChangesPtr changes)
{
-KeySym * syms;
-unsigned char explicit,mods;
-XkbSymInterpretPtr *interps,ibuf[IBUF_SIZE];
-int n,nSyms,found;
-unsigned changed,tmp;
-
- if ((!xkb)||(!xkb->map)||(!xkb->map->key_sym_map)||
- (!xkb->compat)||(!xkb->compat->sym_interpret)||
- (key<xkb->min_key_code)||(key>xkb->max_key_code)) {
- return FALSE;
- }
- if (((!xkb->server)||(!xkb->server->key_acts))&&
- (XkbAllocServerMap(xkb,XkbAllServerInfoMask,0)!=Success)) {
- return FALSE;
- }
- changed= 0; /* keeps track of what has changed in _this_ call */
- explicit= xkb->server->explicit[key];
- if (explicit&XkbExplicitInterpretMask) /* nothing to do */
- return TRUE;
- mods= (xkb->map->modmap?xkb->map->modmap[key]:0);
- nSyms= XkbKeyNumSyms(xkb,key);
- syms= XkbKeySymsPtr(xkb,key);
- if (nSyms>IBUF_SIZE) {
- interps= calloc(nSyms, sizeof(XkbSymInterpretPtr));
- if (interps==NULL) {
- interps= ibuf;
- nSyms= IBUF_SIZE;
- }
+ KeySym *syms;
+ unsigned char explicit, mods;
+ XkbSymInterpretPtr *interps, ibuf[IBUF_SIZE];
+ int n, nSyms, found;
+ unsigned changed, tmp;
+
+ if ((!xkb) || (!xkb->map) || (!xkb->map->key_sym_map) ||
+ (!xkb->compat) || (!xkb->compat->sym_interpret) ||
+ (key < xkb->min_key_code) || (key > xkb->max_key_code)) {
+ return FALSE;
+ }
+ if (((!xkb->server) || (!xkb->server->key_acts)) &&
+ (XkbAllocServerMap(xkb, XkbAllServerInfoMask, 0) != Success)) {
+ return FALSE;
+ }
+ changed = 0; /* keeps track of what has changed in _this_ call */
+ explicit = xkb->server->explicit[key];
+ if (explicit & XkbExplicitInterpretMask) /* nothing to do */
+ return TRUE;
+ mods = (xkb->map->modmap ? xkb->map->modmap[key] : 0);
+ nSyms = XkbKeyNumSyms(xkb, key);
+ syms = XkbKeySymsPtr(xkb, key);
+ if (nSyms > IBUF_SIZE) {
+ interps = calloc(nSyms, sizeof(XkbSymInterpretPtr));
+ if (interps == NULL) {
+ interps = ibuf;
+ nSyms = IBUF_SIZE;
+ }
}
else {
- interps= ibuf;
- }
- found= 0;
- for (n=0;n<nSyms;n++) {
- unsigned level= (n%XkbKeyGroupsWidth(xkb,key));
- interps[n]= NULL;
- if (syms[n]!=NoSymbol) {
- interps[n]= _XkbFindMatchingInterp(xkb,syms[n],mods,level);
- if (interps[n]&&interps[n]->act.type!=XkbSA_NoAction)
- found++;
- else interps[n]= NULL;
- }
+ interps = ibuf;
+ }
+ found = 0;
+ for (n = 0; n < nSyms; n++) {
+ unsigned level = (n % XkbKeyGroupsWidth(xkb, key));
+
+ interps[n] = NULL;
+ if (syms[n] != NoSymbol) {
+ interps[n] = _XkbFindMatchingInterp(xkb, syms[n], mods, level);
+ if (interps[n] && interps[n]->act.type != XkbSA_NoAction)
+ found++;
+ else
+ interps[n] = NULL;
+ }
}
/* 1/28/96 (ef) -- XXX! WORKING HERE */
if (!found) {
- if (xkb->server->key_acts[key]!=0) {
- xkb->server->key_acts[key]= 0;
- changed|= XkbKeyActionsMask;
- }
+ if (xkb->server->key_acts[key] != 0) {
+ xkb->server->key_acts[key] = 0;
+ changed |= XkbKeyActionsMask;
+ }
}
else {
- XkbAction *pActs;
- unsigned int new_vmodmask;
- changed|= XkbKeyActionsMask;
- pActs= XkbResizeKeyActions(xkb,key,nSyms);
- if (!pActs) {
+ XkbAction *pActs;
+ unsigned int new_vmodmask;
+
+ changed |= XkbKeyActionsMask;
+ pActs = XkbResizeKeyActions(xkb, key, nSyms);
+ if (!pActs) {
if (nSyms > IBUF_SIZE)
free(interps);
- return FALSE;
- }
- new_vmodmask= 0;
- for (n=0;n<nSyms;n++) {
- if (interps[n]) {
- unsigned effMods;
-
- pActs[n]= *((XkbAction *)&interps[n]->act);
- if ((n==0)||((interps[n]->match&XkbSI_LevelOneOnly)==0)) {
- effMods= mods;
- if (interps[n]->virtual_mod!=XkbNoModifier)
- new_vmodmask|= (1<<interps[n]->virtual_mod);
- }
- else effMods= 0;
- _XkbSetActionKeyMods(xkb,&pActs[n],effMods);
- }
- else pActs[n].type= XkbSA_NoAction;
- }
- if (((explicit&XkbExplicitVModMapMask)==0)&&
- (xkb->server->vmodmap[key]!=new_vmodmask)) {
- changed|= XkbVirtualModMapMask;
- xkb->server->vmodmap[key]= new_vmodmask;
- }
- if (interps[0]) {
- if ((interps[0]->flags&XkbSI_LockingKey)&&
- ((explicit&XkbExplicitBehaviorMask)==0)) {
- xkb->server->behaviors[key].type= XkbKB_Lock;
- changed|= XkbKeyBehaviorsMask;
- }
- if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
- CARD8 old;
- old= BitIsOn(xkb->ctrls->per_key_repeat, key);
- if (interps[0]->flags&XkbSI_AutoRepeat)
- SetBit(xkb->ctrls->per_key_repeat, key);
- else
- ClearBit(xkb->ctrls->per_key_repeat, key);
- if (changes && old != BitIsOn(xkb->ctrls->per_key_repeat, key))
- changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask;
- }
- }
- }
- if ((!found)||(interps[0]==NULL)) {
- if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
- CARD8 old;
- old = BitIsOn(xkb->ctrls->per_key_repeat, key);
- SetBit(xkb->ctrls->per_key_repeat, key);
- if (changes && (old != BitIsOn(xkb->ctrls->per_key_repeat, key)))
- changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask;
- }
- if (((explicit&XkbExplicitBehaviorMask)==0)&&
- (xkb->server->behaviors[key].type==XkbKB_Lock)) {
- xkb->server->behaviors[key].type= XkbKB_Default;
- changed|= XkbKeyBehaviorsMask;
- }
+ return FALSE;
+ }
+ new_vmodmask = 0;
+ for (n = 0; n < nSyms; n++) {
+ if (interps[n]) {
+ unsigned effMods;
+
+ pActs[n] = *((XkbAction *) &interps[n]->act);
+ if ((n == 0) || ((interps[n]->match & XkbSI_LevelOneOnly) == 0)) {
+ effMods = mods;
+ if (interps[n]->virtual_mod != XkbNoModifier)
+ new_vmodmask |= (1 << interps[n]->virtual_mod);
+ }
+ else
+ effMods = 0;
+ _XkbSetActionKeyMods(xkb, &pActs[n], effMods);
+ }
+ else
+ pActs[n].type = XkbSA_NoAction;
+ }
+ if (((explicit & XkbExplicitVModMapMask) == 0) &&
+ (xkb->server->vmodmap[key] != new_vmodmask)) {
+ changed |= XkbVirtualModMapMask;
+ xkb->server->vmodmap[key] = new_vmodmask;
+ }
+ if (interps[0]) {
+ if ((interps[0]->flags & XkbSI_LockingKey) &&
+ ((explicit & XkbExplicitBehaviorMask) == 0)) {
+ xkb->server->behaviors[key].type = XkbKB_Lock;
+ changed |= XkbKeyBehaviorsMask;
+ }
+ if (((explicit & XkbExplicitAutoRepeatMask) == 0) && (xkb->ctrls)) {
+ CARD8 old;
+
+ old = BitIsOn(xkb->ctrls->per_key_repeat, key);
+ if (interps[0]->flags & XkbSI_AutoRepeat)
+ SetBit(xkb->ctrls->per_key_repeat, key);
+ else
+ ClearBit(xkb->ctrls->per_key_repeat, key);
+ if (changes && old != BitIsOn(xkb->ctrls->per_key_repeat, key))
+ changes->ctrls.changed_ctrls |= XkbPerKeyRepeatMask;
+ }
+ }
+ }
+ if ((!found) || (interps[0] == NULL)) {
+ if (((explicit & XkbExplicitAutoRepeatMask) == 0) && (xkb->ctrls)) {
+ CARD8 old;
+
+ old = BitIsOn(xkb->ctrls->per_key_repeat, key);
+ SetBit(xkb->ctrls->per_key_repeat, key);
+ if (changes && (old != BitIsOn(xkb->ctrls->per_key_repeat, key)))
+ changes->ctrls.changed_ctrls |= XkbPerKeyRepeatMask;
+ }
+ if (((explicit & XkbExplicitBehaviorMask) == 0) &&
+ (xkb->server->behaviors[key].type == XkbKB_Lock)) {
+ xkb->server->behaviors[key].type = XkbKB_Default;
+ changed |= XkbKeyBehaviorsMask;
+ }
}
if (changes) {
- XkbMapChangesPtr mc;
- mc= &changes->map;
- tmp= (changed&mc->changed);
- if (tmp&XkbKeyActionsMask)
- _XkbAddKeyChange(&mc->first_key_act,&mc->num_key_acts,key);
- else if (changed&XkbKeyActionsMask) {
- mc->changed|= XkbKeyActionsMask;
- mc->first_key_act= key;
- mc->num_key_acts= 1;
- }
- if (tmp&XkbKeyBehaviorsMask) {
- _XkbAddKeyChange(&mc->first_key_behavior,&mc->num_key_behaviors,
- key);
- }
- else if (changed&XkbKeyBehaviorsMask) {
- mc->changed|= XkbKeyBehaviorsMask;
- mc->first_key_behavior= key;
- mc->num_key_behaviors= 1;
- }
- if (tmp&XkbVirtualModMapMask)
- _XkbAddKeyChange(&mc->first_vmodmap_key,&mc->num_vmodmap_keys,key);
- else if (changed&XkbVirtualModMapMask) {
- mc->changed|= XkbVirtualModMapMask;
- mc->first_vmodmap_key= key;
- mc->num_vmodmap_keys= 1;
- }
- mc->changed|= changed;
- }
- if (interps!=ibuf)
- free(interps);
+ XkbMapChangesPtr mc;
+
+ mc = &changes->map;
+ tmp = (changed & mc->changed);
+ if (tmp & XkbKeyActionsMask)
+ _XkbAddKeyChange(&mc->first_key_act, &mc->num_key_acts, key);
+ else if (changed & XkbKeyActionsMask) {
+ mc->changed |= XkbKeyActionsMask;
+ mc->first_key_act = key;
+ mc->num_key_acts = 1;
+ }
+ if (tmp & XkbKeyBehaviorsMask) {
+ _XkbAddKeyChange(&mc->first_key_behavior, &mc->num_key_behaviors,
+ key);
+ }
+ else if (changed & XkbKeyBehaviorsMask) {
+ mc->changed |= XkbKeyBehaviorsMask;
+ mc->first_key_behavior = key;
+ mc->num_key_behaviors = 1;
+ }
+ if (tmp & XkbVirtualModMapMask)
+ _XkbAddKeyChange(&mc->first_vmodmap_key, &mc->num_vmodmap_keys,
+ key);
+ else if (changed & XkbVirtualModMapMask) {
+ mc->changed |= XkbVirtualModMapMask;
+ mc->first_vmodmap_key = key;
+ mc->num_vmodmap_keys = 1;
+ }
+ mc->changed |= changed;
+ }
+ if (interps != ibuf)
+ free(interps);
return TRUE;
}
Status
-XkbChangeTypesOfKey( XkbDescPtr xkb,
- int key,
- int nGroups,
- unsigned groups,
- int * newTypesIn,
- XkbMapChangesPtr changes)
+XkbChangeTypesOfKey(XkbDescPtr xkb,
+ int key,
+ int nGroups,
+ unsigned groups, int *newTypesIn, XkbMapChangesPtr changes)
{
-XkbKeyTypePtr pOldType,pNewType;
-register int i;
-int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups];
-
- if ((!xkb) || (!XkbKeycodeInRange(xkb,key)) || (!xkb->map) ||
- (!xkb->map->types)||(!newTypesIn)||((groups&XkbAllGroupsMask)==0)||
- (nGroups>XkbNumKbdGroups)) {
- return BadMatch;
- }
- if (nGroups==0) {
- for (i=0;i<XkbNumKbdGroups;i++) {
- xkb->map->key_sym_map[key].kt_index[i]= XkbOneLevelIndex;
- }
- i= xkb->map->key_sym_map[key].group_info;
- i= XkbSetNumGroups(i,0);
- xkb->map->key_sym_map[key].group_info= i;
- XkbResizeKeySyms(xkb,key,0);
- return Success;
- }
-
- nOldGroups= XkbKeyNumGroups(xkb,key);
- oldWidth= XkbKeyGroupsWidth(xkb,key);
- for (width=i=0;i<nGroups;i++) {
- if (groups&(1<<i))
- newTypes[i]= newTypesIn[i];
- else if (i<nOldGroups)
- newTypes[i]= XkbKeyKeyTypeIndex(xkb,key,i);
- else if (nOldGroups>0)
- newTypes[i]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index);
- else newTypes[i]= XkbTwoLevelIndex;
- if (newTypes[i]>xkb->map->num_types)
- return BadMatch;
- pNewType= &xkb->map->types[newTypes[i]];
- if (pNewType->num_levels>width)
- width= pNewType->num_levels;
- }
- if ((xkb->ctrls)&&(nGroups>xkb->ctrls->num_groups))
- xkb->ctrls->num_groups= nGroups;
- if ((width!=oldWidth)||(nGroups!=nOldGroups)) {
- KeySym oldSyms[XkbMaxSymsPerKey],*pSyms;
- int nCopy;
-
- if (nOldGroups==0) {
- pSyms= XkbResizeKeySyms(xkb,key,width*nGroups);
- if (pSyms!=NULL) {
- i= xkb->map->key_sym_map[key].group_info;
- i= XkbSetNumGroups(i,nGroups);
- xkb->map->key_sym_map[key].group_info= i;
- xkb->map->key_sym_map[key].width= width;
- for (i=0;i<nGroups;i++) {
- xkb->map->key_sym_map[key].kt_index[i]= newTypes[i];
- }
- return Success;
- }
- return BadAlloc;
- }
- pSyms= XkbKeySymsPtr(xkb,key);
- memcpy(oldSyms,pSyms,XkbKeyNumSyms(xkb,key)*sizeof(KeySym));
- pSyms= XkbResizeKeySyms(xkb,key,width*nGroups);
- if (pSyms==NULL)
- return BadAlloc;
- memset(pSyms, 0, width*nGroups*sizeof(KeySym));
- for (i=0;(i<nGroups)&&(i<nOldGroups);i++) {
- pOldType= XkbKeyKeyType(xkb,key,i);
- pNewType= &xkb->map->types[newTypes[i]];
- if (pNewType->num_levels>pOldType->num_levels)
- nCopy= pOldType->num_levels;
- else nCopy= pNewType->num_levels;
- memcpy(&pSyms[i*width],&oldSyms[i*oldWidth],nCopy*sizeof(KeySym));
- }
- if (XkbKeyHasActions(xkb,key)) {
- XkbAction oldActs[XkbMaxSymsPerKey],*pActs;
- pActs= XkbKeyActionsPtr(xkb,key);
- memcpy(oldActs,pActs,XkbKeyNumSyms(xkb,key)*sizeof(XkbAction));
- pActs= XkbResizeKeyActions(xkb,key,width*nGroups);
- if (pActs==NULL)
- return BadAlloc;
- memset(pActs, 0, width*nGroups*sizeof(XkbAction));
- for (i=0;(i<nGroups)&&(i<nOldGroups);i++) {
- pOldType= XkbKeyKeyType(xkb,key,i);
- pNewType= &xkb->map->types[newTypes[i]];
- if (pNewType->num_levels>pOldType->num_levels)
- nCopy= pOldType->num_levels;
- else nCopy= pNewType->num_levels;
- memcpy(&pActs[i*width],&oldActs[i*oldWidth],
- nCopy*sizeof(XkbAction));
- }
- }
- i= xkb->map->key_sym_map[key].group_info;
- i= XkbSetNumGroups(i,nGroups);
- xkb->map->key_sym_map[key].group_info= i;
- xkb->map->key_sym_map[key].width= width;
- }
- width= 0;
- for (i=0;i<nGroups;i++) {
- xkb->map->key_sym_map[key].kt_index[i]= newTypes[i];
- if (xkb->map->types[newTypes[i]].num_levels>width)
- width= xkb->map->types[newTypes[i]].num_levels;
- }
- xkb->map->key_sym_map[key].width= width;
- if (changes!=NULL) {
- if (changes->changed&XkbKeySymsMask) {
- _XkbAddKeyChange(&changes->first_key_sym,&changes->num_key_syms,
- key);
- }
- else {
- changes->changed|= XkbKeySymsMask;
- changes->first_key_sym= key;
- changes->num_key_syms= 1;
- }
+ XkbKeyTypePtr pOldType, pNewType;
+ register int i;
+ int width, nOldGroups, oldWidth, newTypes[XkbNumKbdGroups];
+
+ if ((!xkb) || (!XkbKeycodeInRange(xkb, key)) || (!xkb->map) ||
+ (!xkb->map->types) || (!newTypesIn) ||
+ ((groups & XkbAllGroupsMask) == 0) || (nGroups > XkbNumKbdGroups)) {
+ return BadMatch;
+ }
+ if (nGroups == 0) {
+ for (i = 0; i < XkbNumKbdGroups; i++) {
+ xkb->map->key_sym_map[key].kt_index[i] = XkbOneLevelIndex;
+ }
+ i = xkb->map->key_sym_map[key].group_info;
+ i = XkbSetNumGroups(i, 0);
+ xkb->map->key_sym_map[key].group_info = i;
+ XkbResizeKeySyms(xkb, key, 0);
+ return Success;
+ }
+
+ nOldGroups = XkbKeyNumGroups(xkb, key);
+ oldWidth = XkbKeyGroupsWidth(xkb, key);
+ for (width = i = 0; i < nGroups; i++) {
+ if (groups & (1 << i))
+ newTypes[i] = newTypesIn[i];
+ else if (i < nOldGroups)
+ newTypes[i] = XkbKeyKeyTypeIndex(xkb, key, i);
+ else if (nOldGroups > 0)
+ newTypes[i] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup1Index);
+ else
+ newTypes[i] = XkbTwoLevelIndex;
+ if (newTypes[i] > xkb->map->num_types)
+ return BadMatch;
+ pNewType = &xkb->map->types[newTypes[i]];
+ if (pNewType->num_levels > width)
+ width = pNewType->num_levels;
+ }
+ if ((xkb->ctrls) && (nGroups > xkb->ctrls->num_groups))
+ xkb->ctrls->num_groups = nGroups;
+ if ((width != oldWidth) || (nGroups != nOldGroups)) {
+ KeySym oldSyms[XkbMaxSymsPerKey], *pSyms;
+ int nCopy;
+
+ if (nOldGroups == 0) {
+ pSyms = XkbResizeKeySyms(xkb, key, width * nGroups);
+ if (pSyms != NULL) {
+ i = xkb->map->key_sym_map[key].group_info;
+ i = XkbSetNumGroups(i, nGroups);
+ xkb->map->key_sym_map[key].group_info = i;
+ xkb->map->key_sym_map[key].width = width;
+ for (i = 0; i < nGroups; i++) {
+ xkb->map->key_sym_map[key].kt_index[i] = newTypes[i];
+ }
+ return Success;
+ }
+ return BadAlloc;
+ }
+ pSyms = XkbKeySymsPtr(xkb, key);
+ memcpy(oldSyms, pSyms, XkbKeyNumSyms(xkb, key) * sizeof(KeySym));
+ pSyms = XkbResizeKeySyms(xkb, key, width * nGroups);
+ if (pSyms == NULL)
+ return BadAlloc;
+ memset(pSyms, 0, width * nGroups * sizeof(KeySym));
+ for (i = 0; (i < nGroups) && (i < nOldGroups); i++) {
+ pOldType = XkbKeyKeyType(xkb, key, i);
+ pNewType = &xkb->map->types[newTypes[i]];
+ if (pNewType->num_levels > pOldType->num_levels)
+ nCopy = pOldType->num_levels;
+ else
+ nCopy = pNewType->num_levels;
+ memcpy(&pSyms[i * width], &oldSyms[i * oldWidth],
+ nCopy * sizeof(KeySym));
+ }
+ if (XkbKeyHasActions(xkb, key)) {
+ XkbAction oldActs[XkbMaxSymsPerKey], *pActs;
+
+ pActs = XkbKeyActionsPtr(xkb, key);
+ memcpy(oldActs, pActs, XkbKeyNumSyms(xkb, key) * sizeof(XkbAction));
+ pActs = XkbResizeKeyActions(xkb, key, width * nGroups);
+ if (pActs == NULL)
+ return BadAlloc;
+ memset(pActs, 0, width * nGroups * sizeof(XkbAction));
+ for (i = 0; (i < nGroups) && (i < nOldGroups); i++) {
+ pOldType = XkbKeyKeyType(xkb, key, i);
+ pNewType = &xkb->map->types[newTypes[i]];
+ if (pNewType->num_levels > pOldType->num_levels)
+ nCopy = pOldType->num_levels;
+ else
+ nCopy = pNewType->num_levels;
+ memcpy(&pActs[i * width], &oldActs[i * oldWidth],
+ nCopy * sizeof(XkbAction));
+ }
+ }
+ i = xkb->map->key_sym_map[key].group_info;
+ i = XkbSetNumGroups(i, nGroups);
+ xkb->map->key_sym_map[key].group_info = i;
+ xkb->map->key_sym_map[key].width = width;
+ }
+ width = 0;
+ for (i = 0; i < nGroups; i++) {
+ xkb->map->key_sym_map[key].kt_index[i] = newTypes[i];
+ if (xkb->map->types[newTypes[i]].num_levels > width)
+ width = xkb->map->types[newTypes[i]].num_levels;
+ }
+ xkb->map->key_sym_map[key].width = width;
+ if (changes != NULL) {
+ if (changes->changed & XkbKeySymsMask) {
+ _XkbAddKeyChange(&changes->first_key_sym, &changes->num_key_syms,
+ key);
+ }
+ else {
+ changes->changed |= XkbKeySymsMask;
+ changes->first_key_sym = key;
+ changes->num_key_syms = 1;
+ }
}
return Success;
}
@@ -637,204 +660,221 @@ int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups];
/***====================================================================***/
Bool
-XkbVirtualModsToReal(XkbDescPtr xkb,unsigned virtual_mask,unsigned *mask_rtrn)
+XkbVirtualModsToReal(XkbDescPtr xkb, unsigned virtual_mask, unsigned *mask_rtrn)
{
-register int i,bit;
-register unsigned mask;
-
- if (xkb==NULL)
- return FALSE;
- if (virtual_mask==0) {
- *mask_rtrn= 0;
- return TRUE;
- }
- if (xkb->server==NULL)
- return FALSE;
- for (i=mask=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (virtual_mask&bit)
- mask|= xkb->server->vmods[i];
- }
- *mask_rtrn= mask;
+ register int i, bit;
+ register unsigned mask;
+
+ if (xkb == NULL)
+ return FALSE;
+ if (virtual_mask == 0) {
+ *mask_rtrn = 0;
+ return TRUE;
+ }
+ if (xkb->server == NULL)
+ return FALSE;
+ for (i = mask = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if (virtual_mask & bit)
+ mask |= xkb->server->vmods[i];
+ }
+ *mask_rtrn = mask;
return TRUE;
}
/***====================================================================***/
static Bool
-XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed)
+XkbUpdateActionVirtualMods(XkbDescPtr xkb, XkbAction *act, unsigned changed)
{
-unsigned int tmp;
+ unsigned int tmp;
switch (act->type) {
- case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
- if (((tmp= XkbModActionVMods(&act->mods))&changed)!=0) {
- XkbVirtualModsToReal(xkb,tmp,&tmp);
- act->mods.mask= act->mods.real_mods;
- act->mods.mask|= tmp;
- return TRUE;
- }
- break;
- case XkbSA_ISOLock:
- if ((((tmp= XkbModActionVMods(&act->iso))!=0)&changed)!=0) {
- XkbVirtualModsToReal(xkb,tmp,&tmp);
- act->iso.mask= act->iso.real_mods;
- act->iso.mask|= tmp;
- return TRUE;
- }
- break;
+ case XkbSA_SetMods:
+ case XkbSA_LatchMods:
+ case XkbSA_LockMods:
+ if (((tmp = XkbModActionVMods(&act->mods)) & changed) != 0) {
+ XkbVirtualModsToReal(xkb, tmp, &tmp);
+ act->mods.mask = act->mods.real_mods;
+ act->mods.mask |= tmp;
+ return TRUE;
+ }
+ break;
+ case XkbSA_ISOLock:
+ if ((((tmp = XkbModActionVMods(&act->iso)) != 0) & changed) != 0) {
+ XkbVirtualModsToReal(xkb, tmp, &tmp);
+ act->iso.mask = act->iso.real_mods;
+ act->iso.mask |= tmp;
+ return TRUE;
+ }
+ break;
}
return FALSE;
}
static void
-XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb,
- XkbKeyTypePtr type,
- unsigned int changed,
- XkbChangesPtr changes)
+XkbUpdateKeyTypeVirtualMods(XkbDescPtr xkb,
+ XkbKeyTypePtr type,
+ unsigned int changed, XkbChangesPtr changes)
{
-register unsigned int i;
-unsigned int mask;
-
- XkbVirtualModsToReal(xkb,type->mods.vmods,&mask);
- type->mods.mask= type->mods.real_mods|mask;
- if ((type->map_count>0)&&(type->mods.vmods!=0)) {
- XkbKTMapEntryPtr entry;
- for (i=0,entry=type->map;i<type->map_count;i++,entry++) {
- if (entry->mods.vmods!=0) {
- XkbVirtualModsToReal(xkb,entry->mods.vmods,&mask);
- entry->mods.mask=entry->mods.real_mods|mask;
- /* entry is active if vmods are bound*/
- entry->active= (mask!=0);
- }
- else entry->active= 1;
- }
+ register unsigned int i;
+ unsigned int mask;
+
+ XkbVirtualModsToReal(xkb, type->mods.vmods, &mask);
+ type->mods.mask = type->mods.real_mods | mask;
+ if ((type->map_count > 0) && (type->mods.vmods != 0)) {
+ XkbKTMapEntryPtr entry;
+
+ for (i = 0, entry = type->map; i < type->map_count; i++, entry++) {
+ if (entry->mods.vmods != 0) {
+ XkbVirtualModsToReal(xkb, entry->mods.vmods, &mask);
+ entry->mods.mask = entry->mods.real_mods | mask;
+ /* entry is active if vmods are bound */
+ entry->active = (mask != 0);
+ }
+ else
+ entry->active = 1;
+ }
}
if (changes) {
- int type_ndx;
- type_ndx= type-xkb->map->types;
- if ((type_ndx<0)||(type_ndx>xkb->map->num_types))
- return;
- if (changes->map.changed&XkbKeyTypesMask) {
- int last;
- last= changes->map.first_type+changes->map.num_types-1;
- if (type_ndx<changes->map.first_type) {
- changes->map.first_type= type_ndx;
- changes->map.num_types= (last-type_ndx)+1;
- }
- else if (type_ndx>last) {
- changes->map.num_types= (type_ndx-changes->map.first_type)+1;
- }
- }
- else {
- changes->map.changed|= XkbKeyTypesMask;
- changes->map.first_type= type_ndx;
- changes->map.num_types= 1;
- }
+ int type_ndx;
+
+ type_ndx = type - xkb->map->types;
+ if ((type_ndx < 0) || (type_ndx > xkb->map->num_types))
+ return;
+ if (changes->map.changed & XkbKeyTypesMask) {
+ int last;
+
+ last = changes->map.first_type + changes->map.num_types - 1;
+ if (type_ndx < changes->map.first_type) {
+ changes->map.first_type = type_ndx;
+ changes->map.num_types = (last - type_ndx) + 1;
+ }
+ else if (type_ndx > last) {
+ changes->map.num_types =
+ (type_ndx - changes->map.first_type) + 1;
+ }
+ }
+ else {
+ changes->map.changed |= XkbKeyTypesMask;
+ changes->map.first_type = type_ndx;
+ changes->map.num_types = 1;
+ }
}
return;
}
Bool
-XkbApplyVirtualModChanges(XkbDescPtr xkb,unsigned changed,XkbChangesPtr changes)
+XkbApplyVirtualModChanges(XkbDescPtr xkb, unsigned changed,
+ XkbChangesPtr changes)
{
-register int i;
-unsigned int checkState = 0;
-
- if ((!xkb) || (!xkb->map) || (changed==0))
- return FALSE;
- for (i=0;i<xkb->map->num_types;i++) {
- if (xkb->map->types[i].mods.vmods & changed)
- XkbUpdateKeyTypeVirtualMods(xkb,&xkb->map->types[i],changed,changes);
- }
- if (changed&xkb->ctrls->internal.vmods) {
- unsigned int newMask;
- XkbVirtualModsToReal(xkb,xkb->ctrls->internal.vmods,&newMask);
- newMask|= xkb->ctrls->internal.real_mods;
- if (xkb->ctrls->internal.mask!=newMask) {
- xkb->ctrls->internal.mask= newMask;
- if (changes) {
- changes->ctrls.changed_ctrls|= XkbInternalModsMask;
- checkState= TRUE;
- }
- }
- }
- if (changed&xkb->ctrls->ignore_lock.vmods) {
- unsigned int newMask;
- XkbVirtualModsToReal(xkb,xkb->ctrls->ignore_lock.vmods,&newMask);
- newMask|= xkb->ctrls->ignore_lock.real_mods;
- if (xkb->ctrls->ignore_lock.mask!=newMask) {
- xkb->ctrls->ignore_lock.mask= newMask;
- if (changes) {
- changes->ctrls.changed_ctrls|= XkbIgnoreLockModsMask;
- checkState= TRUE;
- }
- }
- }
- if (xkb->indicators!=NULL) {
- XkbIndicatorMapPtr map;
- map= &xkb->indicators->maps[0];
- for (i=0;i<XkbNumIndicators;i++,map++) {
- if (map->mods.vmods&changed) {
- unsigned int newMask;
- XkbVirtualModsToReal(xkb,map->mods.vmods,&newMask);
- newMask|= map->mods.real_mods;
- if (newMask!=map->mods.mask) {
- map->mods.mask= newMask;
- if (changes) {
- changes->indicators.map_changes|= (1<<i);
- checkState= TRUE;
- }
- }
- }
- }
- }
- if (xkb->compat!=NULL) {
- XkbCompatMapPtr compat;
- compat= xkb->compat;
- for (i=0;i<XkbNumKbdGroups;i++) {
- unsigned int newMask;
- XkbVirtualModsToReal(xkb,compat->groups[i].vmods,&newMask);
- newMask|= compat->groups[i].real_mods;
- if (compat->groups[i].mask!=newMask) {
- compat->groups[i].mask= newMask;
- if (changes) {
- changes->compat.changed_groups|= (1<<i);
- checkState= TRUE;
- }
- }
- }
+ register int i;
+ unsigned int checkState = 0;
+
+ if ((!xkb) || (!xkb->map) || (changed == 0))
+ return FALSE;
+ for (i = 0; i < xkb->map->num_types; i++) {
+ if (xkb->map->types[i].mods.vmods & changed)
+ XkbUpdateKeyTypeVirtualMods(xkb, &xkb->map->types[i], changed,
+ changes);
+ }
+ if (changed & xkb->ctrls->internal.vmods) {
+ unsigned int newMask;
+
+ XkbVirtualModsToReal(xkb, xkb->ctrls->internal.vmods, &newMask);
+ newMask |= xkb->ctrls->internal.real_mods;
+ if (xkb->ctrls->internal.mask != newMask) {
+ xkb->ctrls->internal.mask = newMask;
+ if (changes) {
+ changes->ctrls.changed_ctrls |= XkbInternalModsMask;
+ checkState = TRUE;
+ }
+ }
+ }
+ if (changed & xkb->ctrls->ignore_lock.vmods) {
+ unsigned int newMask;
+
+ XkbVirtualModsToReal(xkb, xkb->ctrls->ignore_lock.vmods, &newMask);
+ newMask |= xkb->ctrls->ignore_lock.real_mods;
+ if (xkb->ctrls->ignore_lock.mask != newMask) {
+ xkb->ctrls->ignore_lock.mask = newMask;
+ if (changes) {
+ changes->ctrls.changed_ctrls |= XkbIgnoreLockModsMask;
+ checkState = TRUE;
+ }
+ }
+ }
+ if (xkb->indicators != NULL) {
+ XkbIndicatorMapPtr map;
+
+ map = &xkb->indicators->maps[0];
+ for (i = 0; i < XkbNumIndicators; i++, map++) {
+ if (map->mods.vmods & changed) {
+ unsigned int newMask;
+
+ XkbVirtualModsToReal(xkb, map->mods.vmods, &newMask);
+ newMask |= map->mods.real_mods;
+ if (newMask != map->mods.mask) {
+ map->mods.mask = newMask;
+ if (changes) {
+ changes->indicators.map_changes |= (1 << i);
+ checkState = TRUE;
+ }
+ }
+ }
+ }
+ }
+ if (xkb->compat != NULL) {
+ XkbCompatMapPtr compat;
+
+ compat = xkb->compat;
+ for (i = 0; i < XkbNumKbdGroups; i++) {
+ unsigned int newMask;
+
+ XkbVirtualModsToReal(xkb, compat->groups[i].vmods, &newMask);
+ newMask |= compat->groups[i].real_mods;
+ if (compat->groups[i].mask != newMask) {
+ compat->groups[i].mask = newMask;
+ if (changes) {
+ changes->compat.changed_groups |= (1 << i);
+ checkState = TRUE;
+ }
+ }
+ }
}
if (xkb->map && xkb->server) {
- int highChange = 0, lowChange = -1;
- for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- if (XkbKeyHasActions(xkb,i)) {
- register XkbAction *pAct;
- register int n;
-
- pAct= XkbKeyActionsPtr(xkb,i);
- for (n=XkbKeyNumActions(xkb,i);n>0;n--,pAct++) {
- if ((pAct->type!=XkbSA_NoAction)&&
- XkbUpdateActionVirtualMods(xkb,pAct,changed)) {
- if (lowChange<0)
- lowChange= i;
- highChange= i;
- }
- }
- }
- }
- if (changes && (lowChange>0)) { /* something changed */
- if (changes->map.changed&XkbKeyActionsMask) {
- int last;
- if (changes->map.first_key_act<lowChange)
- lowChange= changes->map.first_key_act;
- last= changes->map.first_key_act+changes->map.num_key_acts-1;
- if (last>highChange)
- highChange= last;
- }
- changes->map.changed|= XkbKeyActionsMask;
- changes->map.first_key_act= lowChange;
- changes->map.num_key_acts= (highChange-lowChange)+1;
- }
+ int highChange = 0, lowChange = -1;
+
+ for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ if (XkbKeyHasActions(xkb, i)) {
+ register XkbAction *pAct;
+ register int n;
+
+ pAct = XkbKeyActionsPtr(xkb, i);
+ for (n = XkbKeyNumActions(xkb, i); n > 0; n--, pAct++) {
+ if ((pAct->type != XkbSA_NoAction) &&
+ XkbUpdateActionVirtualMods(xkb, pAct, changed)) {
+ if (lowChange < 0)
+ lowChange = i;
+ highChange = i;
+ }
+ }
+ }
+ }
+ if (changes && (lowChange > 0)) { /* something changed */
+ if (changes->map.changed & XkbKeyActionsMask) {
+ int last;
+
+ if (changes->map.first_key_act < lowChange)
+ lowChange = changes->map.first_key_act;
+ last =
+ changes->map.first_key_act + changes->map.num_key_acts - 1;
+ if (last > highChange)
+ highChange = last;
+ }
+ changes->map.changed |= XkbKeyActionsMask;
+ changes->map.first_key_act = lowChange;
+ changes->map.num_key_acts = (highChange - lowChange) + 1;
+ }
}
return checkState;
}
diff --git a/xorg-server/xkb/ddxBeep.c b/xorg-server/xkb/ddxBeep.c
index 6f74cb541..f95d0ee81 100644
--- a/xorg-server/xkb/ddxBeep.c
+++ b/xorg-server/xkb/ddxBeep.c
@@ -55,23 +55,23 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define HIGH_PITCH 2000
#define CLICK_PITCH 1500
-static unsigned long atomGeneration= 0;
-static Atom featureOn;
-static Atom featureOff;
-static Atom featureChange;
-static Atom ledOn;
-static Atom ledOff;
-static Atom ledChange;
-static Atom slowWarn;
-static Atom slowPress;
-static Atom slowReject;
-static Atom slowAccept;
-static Atom slowRelease;
-static Atom stickyLatch;
-static Atom stickyLock;
-static Atom stickyUnlock;
-static Atom bounceReject;
-static char doesPitch = 1;
+static unsigned long atomGeneration = 0;
+static Atom featureOn;
+static Atom featureOff;
+static Atom featureChange;
+static Atom ledOn;
+static Atom ledOff;
+static Atom ledChange;
+static Atom slowWarn;
+static Atom slowPress;
+static Atom slowReject;
+static Atom slowAccept;
+static Atom slowRelease;
+static Atom stickyLatch;
+static Atom stickyLock;
+static Atom stickyUnlock;
+static Atom bounceReject;
+static char doesPitch = 1;
#define FEATURE_ON "AX_FeatureOn"
#define FEATURE_OFF "AX_FeatureOff"
@@ -94,238 +94,257 @@ static char doesPitch = 1;
static void
_XkbDDXBeepInitAtoms(void)
{
- featureOn= MAKE_ATOM(FEATURE_ON);
- featureOff= MAKE_ATOM(FEATURE_OFF);
- featureChange= MAKE_ATOM(FEATURE_CHANGE);
- ledOn= MAKE_ATOM(LED_ON);
- ledOff= MAKE_ATOM(LED_OFF);
- ledChange= MAKE_ATOM(LED_CHANGE);
- slowWarn= MAKE_ATOM(SLOW_WARN);
- slowPress= MAKE_ATOM(SLOW_PRESS);
- slowReject= MAKE_ATOM(SLOW_REJECT);
- slowAccept= MAKE_ATOM(SLOW_ACCEPT);
- slowRelease= MAKE_ATOM(SLOW_RELEASE);
- stickyLatch= MAKE_ATOM(STICKY_LATCH);
- stickyLock= MAKE_ATOM(STICKY_LOCK);
- stickyUnlock= MAKE_ATOM(STICKY_UNLOCK);
- bounceReject= MAKE_ATOM(BOUNCE_REJECT);
+ featureOn = MAKE_ATOM(FEATURE_ON);
+ featureOff = MAKE_ATOM(FEATURE_OFF);
+ featureChange = MAKE_ATOM(FEATURE_CHANGE);
+ ledOn = MAKE_ATOM(LED_ON);
+ ledOff = MAKE_ATOM(LED_OFF);
+ ledChange = MAKE_ATOM(LED_CHANGE);
+ slowWarn = MAKE_ATOM(SLOW_WARN);
+ slowPress = MAKE_ATOM(SLOW_PRESS);
+ slowReject = MAKE_ATOM(SLOW_REJECT);
+ slowAccept = MAKE_ATOM(SLOW_ACCEPT);
+ slowRelease = MAKE_ATOM(SLOW_RELEASE);
+ stickyLatch = MAKE_ATOM(STICKY_LATCH);
+ stickyLock = MAKE_ATOM(STICKY_LOCK);
+ stickyUnlock = MAKE_ATOM(STICKY_UNLOCK);
+ bounceReject = MAKE_ATOM(BOUNCE_REJECT);
return;
}
static CARD32
-_XkbDDXBeepExpire(OsTimerPtr timer,CARD32 now,pointer arg)
+_XkbDDXBeepExpire(OsTimerPtr timer, CARD32 now, pointer arg)
{
-DeviceIntPtr dev= (DeviceIntPtr)arg;
-KbdFeedbackPtr feed;
-KeybdCtrl * ctrl;
-XkbSrvInfoPtr xkbInfo;
-CARD32 next;
-int pitch,duration;
-int oldPitch,oldDuration;
-Atom name;
+ DeviceIntPtr dev = (DeviceIntPtr) arg;
+ KbdFeedbackPtr feed;
+ KeybdCtrl *ctrl;
+ XkbSrvInfoPtr xkbInfo;
+ CARD32 next;
+ int pitch, duration;
+ int oldPitch, oldDuration;
+ Atom name;
- if ((dev==NULL)||(dev->key==NULL)||(dev->key->xkbInfo==NULL)||
- (dev->kbdfeed==NULL))
- return 0;
- if (atomGeneration!=serverGeneration) {
- _XkbDDXBeepInitAtoms();
- atomGeneration= serverGeneration;
+ if ((dev == NULL) || (dev->key == NULL) || (dev->key->xkbInfo == NULL) ||
+ (dev->kbdfeed == NULL))
+ return 0;
+ if (atomGeneration != serverGeneration) {
+ _XkbDDXBeepInitAtoms();
+ atomGeneration = serverGeneration;
}
- feed= dev->kbdfeed;
- ctrl= &feed->ctrl;
- xkbInfo= dev->key->xkbInfo;
- next= 0;
- pitch= oldPitch= ctrl->bell_pitch;
- duration= oldDuration= ctrl->bell_duration;
- name= None;
+ feed = dev->kbdfeed;
+ ctrl = &feed->ctrl;
+ xkbInfo = dev->key->xkbInfo;
+ next = 0;
+ pitch = oldPitch = ctrl->bell_pitch;
+ duration = oldDuration = ctrl->bell_duration;
+ name = None;
switch (xkbInfo->beepType) {
- default:
- ErrorF("[xkb] Unknown beep type %d\n",xkbInfo->beepType);
- case _BEEP_NONE:
- duration= 0;
- break;
+ default:
+ ErrorF("[xkb] Unknown beep type %d\n", xkbInfo->beepType);
+ case _BEEP_NONE:
+ duration = 0;
+ break;
- /* When an LED is turned on, we want a high-pitched beep.
- * When the LED it turned off, we want a low-pitched beep.
- * If we cannot do pitch, we want a single beep for on and two
- * beeps for off.
+ /* When an LED is turned on, we want a high-pitched beep.
+ * When the LED it turned off, we want a low-pitched beep.
+ * If we cannot do pitch, we want a single beep for on and two
+ * beeps for off.
*/
- case _BEEP_LED_ON:
- if (name==None) name= ledOn;
- duration= SHORT_TONE;
- pitch= HIGH_PITCH;
- break;
- case _BEEP_LED_OFF:
- if (name==None) name= ledOff;
- duration= SHORT_TONE;
- pitch= LOW_PITCH;
- if (!doesPitch && xkbInfo->beepCount<1)
- next = SHORT_DELAY;
- break;
+ case _BEEP_LED_ON:
+ if (name == None)
+ name = ledOn;
+ duration = SHORT_TONE;
+ pitch = HIGH_PITCH;
+ break;
+ case _BEEP_LED_OFF:
+ if (name == None)
+ name = ledOff;
+ duration = SHORT_TONE;
+ pitch = LOW_PITCH;
+ if (!doesPitch && xkbInfo->beepCount < 1)
+ next = SHORT_DELAY;
+ break;
- /* When a Feature is turned on, we want an up-siren.
- * When a Feature is turned off, we want a down-siren.
- * If we cannot do pitch, we want a single beep for on and two
- * beeps for off.
+ /* When a Feature is turned on, we want an up-siren.
+ * When a Feature is turned off, we want a down-siren.
+ * If we cannot do pitch, we want a single beep for on and two
+ * beeps for off.
*/
- case _BEEP_FEATURE_ON:
- if (name==None) name= featureOn;
- if (xkbInfo->beepCount<1) {
- pitch= LOW_PITCH;
- duration= VERY_LONG_TONE;
- if (doesPitch)
- next= SHORT_DELAY;
- }
- else {
- pitch= MID_PITCH;
- duration= SHORT_TONE;
- }
- break;
+ case _BEEP_FEATURE_ON:
+ if (name == None)
+ name = featureOn;
+ if (xkbInfo->beepCount < 1) {
+ pitch = LOW_PITCH;
+ duration = VERY_LONG_TONE;
+ if (doesPitch)
+ next = SHORT_DELAY;
+ }
+ else {
+ pitch = MID_PITCH;
+ duration = SHORT_TONE;
+ }
+ break;
- case _BEEP_FEATURE_OFF:
- if (name==None) name= featureOff;
- if (xkbInfo->beepCount<1) {
- pitch= MID_PITCH;
- if (doesPitch)
- duration= VERY_LONG_TONE;
- else duration= SHORT_TONE;
- next= SHORT_DELAY;
- }
- else {
- pitch= LOW_PITCH;
- duration= SHORT_TONE;
- }
- break;
+ case _BEEP_FEATURE_OFF:
+ if (name == None)
+ name = featureOff;
+ if (xkbInfo->beepCount < 1) {
+ pitch = MID_PITCH;
+ if (doesPitch)
+ duration = VERY_LONG_TONE;
+ else
+ duration = SHORT_TONE;
+ next = SHORT_DELAY;
+ }
+ else {
+ pitch = LOW_PITCH;
+ duration = SHORT_TONE;
+ }
+ break;
- /* Two high beeps indicate an LED or Feature changed
- * state, but that another LED or Feature is also on.
- * [[[WDW - This is not in AccessDOS ]]]
- */
- case _BEEP_LED_CHANGE:
- if (name==None) name= ledChange;
- case _BEEP_FEATURE_CHANGE:
- if (name==None) name= featureChange;
- duration= SHORT_TONE;
- pitch= HIGH_PITCH;
- if (xkbInfo->beepCount<1) {
- next= SHORT_DELAY;
- }
- break;
+ /* Two high beeps indicate an LED or Feature changed
+ * state, but that another LED or Feature is also on.
+ * [[[WDW - This is not in AccessDOS ]]]
+ */
+ case _BEEP_LED_CHANGE:
+ if (name == None)
+ name = ledChange;
+ case _BEEP_FEATURE_CHANGE:
+ if (name == None)
+ name = featureChange;
+ duration = SHORT_TONE;
+ pitch = HIGH_PITCH;
+ if (xkbInfo->beepCount < 1) {
+ next = SHORT_DELAY;
+ }
+ break;
- /* Three high-pitched beeps are the warning that SlowKeys
- * is going to be turned on or off.
- */
- case _BEEP_SLOW_WARN:
- if (name==None) name= slowWarn;
- duration= SHORT_TONE;
- pitch= HIGH_PITCH;
- if (xkbInfo->beepCount<2)
- next= SHORT_DELAY;
- break;
+ /* Three high-pitched beeps are the warning that SlowKeys
+ * is going to be turned on or off.
+ */
+ case _BEEP_SLOW_WARN:
+ if (name == None)
+ name = slowWarn;
+ duration = SHORT_TONE;
+ pitch = HIGH_PITCH;
+ if (xkbInfo->beepCount < 2)
+ next = SHORT_DELAY;
+ break;
- /* Click on SlowKeys press and accept.
- * Deep pitch when a SlowKey or BounceKey is rejected.
- * [[[WDW - Rejects are not in AccessDOS ]]]
- * If we cannot do pitch, we want single beeps.
- */
- case _BEEP_SLOW_PRESS:
- if (name==None) name= slowPress;
- case _BEEP_SLOW_ACCEPT:
- if (name==None) name= slowAccept;
- case _BEEP_SLOW_RELEASE:
- if (name==None) name= slowRelease;
- duration= CLICK_DURATION;
- pitch= CLICK_PITCH;
- break;
- case _BEEP_BOUNCE_REJECT:
- if (name==None) name= bounceReject;
- case _BEEP_SLOW_REJECT:
- if (name==None) name= slowReject;
- duration= SHORT_TONE;
- pitch= DEEP_PITCH;
- break;
+ /* Click on SlowKeys press and accept.
+ * Deep pitch when a SlowKey or BounceKey is rejected.
+ * [[[WDW - Rejects are not in AccessDOS ]]]
+ * If we cannot do pitch, we want single beeps.
+ */
+ case _BEEP_SLOW_PRESS:
+ if (name == None)
+ name = slowPress;
+ case _BEEP_SLOW_ACCEPT:
+ if (name == None)
+ name = slowAccept;
+ case _BEEP_SLOW_RELEASE:
+ if (name == None)
+ name = slowRelease;
+ duration = CLICK_DURATION;
+ pitch = CLICK_PITCH;
+ break;
+ case _BEEP_BOUNCE_REJECT:
+ if (name == None)
+ name = bounceReject;
+ case _BEEP_SLOW_REJECT:
+ if (name == None)
+ name = slowReject;
+ duration = SHORT_TONE;
+ pitch = DEEP_PITCH;
+ break;
- /* Low followed by high pitch when a StickyKey is latched.
- * High pitch when a StickyKey is locked.
- * Low pitch when unlocked.
+ /* Low followed by high pitch when a StickyKey is latched.
+ * High pitch when a StickyKey is locked.
+ * Low pitch when unlocked.
* If we cannot do pitch, two beeps for latch, nothing for
- * lock, and two for unlock.
- */
- case _BEEP_STICKY_LATCH:
- if (name==None) name= stickyLatch;
- duration= SHORT_TONE;
- if (xkbInfo->beepCount<1) {
- next= SHORT_DELAY;
- pitch= LOW_PITCH;
- }
- else pitch= HIGH_PITCH;
- break;
- case _BEEP_STICKY_LOCK:
- if (name==None) name= stickyLock;
- if (doesPitch) {
- duration= SHORT_TONE;
- pitch= HIGH_PITCH;
- }
- break;
- case _BEEP_STICKY_UNLOCK:
- if (name==None) name= stickyUnlock;
- duration= SHORT_TONE;
- pitch= LOW_PITCH;
- if (!doesPitch && xkbInfo->beepCount<1)
- next = SHORT_DELAY;
- break;
+ * lock, and two for unlock.
+ */
+ case _BEEP_STICKY_LATCH:
+ if (name == None)
+ name = stickyLatch;
+ duration = SHORT_TONE;
+ if (xkbInfo->beepCount < 1) {
+ next = SHORT_DELAY;
+ pitch = LOW_PITCH;
+ }
+ else
+ pitch = HIGH_PITCH;
+ break;
+ case _BEEP_STICKY_LOCK:
+ if (name == None)
+ name = stickyLock;
+ if (doesPitch) {
+ duration = SHORT_TONE;
+ pitch = HIGH_PITCH;
+ }
+ break;
+ case _BEEP_STICKY_UNLOCK:
+ if (name == None)
+ name = stickyUnlock;
+ duration = SHORT_TONE;
+ pitch = LOW_PITCH;
+ if (!doesPitch && xkbInfo->beepCount < 1)
+ next = SHORT_DELAY;
+ break;
}
- if (timer == NULL && duration>0) {
- CARD32 starttime = GetTimeInMillis();
- CARD32 elapsedtime;
+ if (timer == NULL && duration > 0) {
+ CARD32 starttime = GetTimeInMillis();
+ CARD32 elapsedtime;
- ctrl->bell_duration= duration;
- ctrl->bell_pitch= pitch;
- if (xkbInfo->beepCount==0) {
- XkbHandleBell(0,0,dev,ctrl->bell,(pointer)ctrl,KbdFeedbackClass,name,None,
- NULL);
- }
- else if (xkbInfo->desc->ctrls->enabled_ctrls&XkbAudibleBellMask) {
- (*dev->kbdfeed->BellProc)(ctrl->bell,dev,(pointer)ctrl,KbdFeedbackClass);
- }
- ctrl->bell_duration= oldDuration;
- ctrl->bell_pitch= oldPitch;
- xkbInfo->beepCount++;
+ ctrl->bell_duration = duration;
+ ctrl->bell_pitch = pitch;
+ if (xkbInfo->beepCount == 0) {
+ XkbHandleBell(0, 0, dev, ctrl->bell, (pointer) ctrl,
+ KbdFeedbackClass, name, None, NULL);
+ }
+ else if (xkbInfo->desc->ctrls->enabled_ctrls & XkbAudibleBellMask) {
+ (*dev->kbdfeed->BellProc) (ctrl->bell, dev, (pointer) ctrl,
+ KbdFeedbackClass);
+ }
+ ctrl->bell_duration = oldDuration;
+ ctrl->bell_pitch = oldPitch;
+ xkbInfo->beepCount++;
- /* Some DDX schedule the beep and return immediately, others don't
- return until the beep is completed. We measure the time and if
- it's less than the beep duration, make sure not to schedule the
- next beep until after the current one finishes. */
+ /* Some DDX schedule the beep and return immediately, others don't
+ return until the beep is completed. We measure the time and if
+ it's less than the beep duration, make sure not to schedule the
+ next beep until after the current one finishes. */
- elapsedtime = GetTimeInMillis();
- if (elapsedtime > starttime) { /* watch out for millisecond counter
- overflow! */
- elapsedtime -= starttime;
- } else {
- elapsedtime = 0;
- }
- if (elapsedtime < duration) {
- next += duration - elapsedtime;
- }
+ elapsedtime = GetTimeInMillis();
+ if (elapsedtime > starttime) { /* watch out for millisecond counter
+ overflow! */
+ elapsedtime -= starttime;
+ }
+ else {
+ elapsedtime = 0;
+ }
+ if (elapsedtime < duration) {
+ next += duration - elapsedtime;
+ }
}
return next;
}
int
-XkbDDXAccessXBeep(DeviceIntPtr dev,unsigned what,unsigned which)
+XkbDDXAccessXBeep(DeviceIntPtr dev, unsigned what, unsigned which)
{
-XkbSrvInfoRec *xkbInfo= dev->key->xkbInfo;
-CARD32 next;
+ XkbSrvInfoRec *xkbInfo = dev->key->xkbInfo;
+ CARD32 next;
- xkbInfo->beepType= what;
- xkbInfo->beepCount= 0;
- next= _XkbDDXBeepExpire(NULL,0,(pointer)dev);
- if (next>0) {
- xkbInfo->beepTimer= TimerSet(xkbInfo->beepTimer,
- 0, next,
- _XkbDDXBeepExpire, (pointer)dev);
+ xkbInfo->beepType = what;
+ xkbInfo->beepCount = 0;
+ next = _XkbDDXBeepExpire(NULL, 0, (pointer) dev);
+ if (next > 0) {
+ xkbInfo->beepTimer = TimerSet(xkbInfo->beepTimer,
+ 0, next,
+ _XkbDDXBeepExpire, (pointer) dev);
}
return 1;
}
diff --git a/xorg-server/xkb/ddxLEDs.c b/xorg-server/xkb/ddxLEDs.c
index 246d58c31..81b7b00e0 100644
--- a/xorg-server/xkb/ddxLEDs.c
+++ b/xorg-server/xkb/ddxLEDs.c
@@ -39,33 +39,33 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XI.h>
static void
-XkbDDXUpdateIndicators(DeviceIntPtr dev,CARD32 new)
+XkbDDXUpdateIndicators(DeviceIntPtr dev, CARD32 new)
{
- dev->kbdfeed->ctrl.leds= new;
- (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl);
+ dev->kbdfeed->ctrl.leds = new;
+ (*dev->kbdfeed->CtrlProc) (dev, &dev->kbdfeed->ctrl);
return;
}
void
-XkbDDXUpdateDeviceIndicators( DeviceIntPtr dev,
- XkbSrvLedInfoPtr sli,
- CARD32 new)
+XkbDDXUpdateDeviceIndicators(DeviceIntPtr dev, XkbSrvLedInfoPtr sli, CARD32 new)
{
- if (sli->fb.kf==dev->kbdfeed)
- XkbDDXUpdateIndicators(dev,new);
- else if (sli->class==KbdFeedbackClass) {
- KbdFeedbackPtr kf;
- kf= sli->fb.kf;
- if (kf && kf->CtrlProc) {
- (*kf->CtrlProc)(dev,&kf->ctrl);
- }
+ if (sli->fb.kf == dev->kbdfeed)
+ XkbDDXUpdateIndicators(dev, new);
+ else if (sli->class == KbdFeedbackClass) {
+ KbdFeedbackPtr kf;
+
+ kf = sli->fb.kf;
+ if (kf && kf->CtrlProc) {
+ (*kf->CtrlProc) (dev, &kf->ctrl);
+ }
}
- else if (sli->class==LedFeedbackClass) {
- LedFeedbackPtr lf;
- lf= sli->fb.lf;
- if (lf && lf->CtrlProc) {
- (*lf->CtrlProc)(dev,&lf->ctrl);
- }
+ else if (sli->class == LedFeedbackClass) {
+ LedFeedbackPtr lf;
+
+ lf = sli->fb.lf;
+ if (lf && lf->CtrlProc) {
+ (*lf->CtrlProc) (dev, &lf->ctrl);
+ }
}
return;
}
diff --git a/xorg-server/xkb/ddxList.c b/xorg-server/xkb/ddxList.c
index db34c8df5..9b69b2b82 100644
--- a/xorg-server/xkb/ddxList.c
+++ b/xorg-server/xkb/ddxList.c
@@ -44,8 +44,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef WIN32
/* from ddxLoad.c */
-extern const char* Win32TempDir(void);
+extern const char *Win32TempDir(void);
extern int Win32System(const char *cmdline);
+
#undef System
#define System Win32System
@@ -54,63 +55,62 @@ extern int Win32System(const char *cmdline);
#define W32_tmplen strlen(tmpname)+3
#else
#define W32_tmparg
-#define W32_tmpfile
+#define W32_tmpfile
#define W32_tmplen 0
-#endif
+#endif
/***====================================================================***/
static const char *componentDirs[_XkbListNumComponents] = {
- "keycodes", "types", "compat", "symbols", "geometry"
+ "keycodes", "types", "compat", "symbols", "geometry"
};
/***====================================================================***/
static Status
-_AddListComponent( XkbSrvListInfoPtr list,
- int what,
- unsigned flags,
- char * str,
- ClientPtr client)
+_AddListComponent(XkbSrvListInfoPtr list,
+ int what, unsigned flags, char *str, ClientPtr client)
{
-int slen,wlen;
-unsigned char * wire8;
-unsigned short *wire16;
-char * tmp;
+ int slen, wlen;
+ unsigned char *wire8;
+ unsigned short *wire16;
+ char *tmp;
- if (list->nTotal>=list->maxRtrn) {
- list->nTotal++;
- return Success;
+ if (list->nTotal >= list->maxRtrn) {
+ list->nTotal++;
+ return Success;
}
- tmp= strchr(str,')');
- if ((tmp==NULL)&&((tmp=strchr(str,'('))==NULL)) {
- slen= strlen(str);
- while ((slen>0) && isspace(str[slen-1])) {
- slen--;
- }
+ tmp = strchr(str, ')');
+ if ((tmp == NULL) && ((tmp = strchr(str, '(')) == NULL)) {
+ slen = strlen(str);
+ while ((slen > 0) && isspace(str[slen - 1])) {
+ slen--;
+ }
}
else {
- slen= (tmp-str+1);
+ slen = (tmp - str + 1);
}
- wlen= (((slen+1)/2)*2)+4; /* four bytes for flags and length, pad to */
- /* 2-byte boundary */
- if ((list->szPool-list->nPool)<wlen) {
- if (wlen>1024) list->szPool+= XkbPaddedSize(wlen*2);
- else list->szPool+= 1024;
- list->pool= realloc(list->pool, list->szPool * sizeof(char));
- if (!list->pool)
- return BadAlloc;
+ wlen = (((slen + 1) / 2) * 2) + 4; /* four bytes for flags and length, pad to */
+ /* 2-byte boundary */
+ if ((list->szPool - list->nPool) < wlen) {
+ if (wlen > 1024)
+ list->szPool += XkbPaddedSize(wlen * 2);
+ else
+ list->szPool += 1024;
+ list->pool = realloc(list->pool, list->szPool * sizeof(char));
+ if (!list->pool)
+ return BadAlloc;
}
- wire16= (unsigned short *)&list->pool[list->nPool];
- wire8= (unsigned char *)&wire16[2];
- wire16[0]= flags;
- wire16[1]= slen;
- memcpy(wire8,str,slen);
+ wire16 = (unsigned short *) &list->pool[list->nPool];
+ wire8 = (unsigned char *) &wire16[2];
+ wire16[0] = flags;
+ wire16[1] = slen;
+ memcpy(wire8, str, slen);
if (client->swapped) {
- swaps(&wire16[0]);
- swaps(&wire16[1]);
+ swaps(&wire16[0]);
+ swaps(&wire16[1]);
}
- list->nPool+= wlen;
+ list->nPool += wlen;
list->nFound[what]++;
list->nTotal++;
return Success;
@@ -118,108 +118,104 @@ char * tmp;
/***====================================================================***/
static Status
-XkbDDXListComponent( DeviceIntPtr dev,
- int what,
- XkbSrvListInfoPtr list,
- ClientPtr client)
+XkbDDXListComponent(DeviceIntPtr dev,
+ int what, XkbSrvListInfoPtr list, ClientPtr client)
{
-char *file,*map,*tmp,*buf=NULL;
-FILE *in;
-Status status;
-Bool haveDir;
+ char *file, *map, *tmp, *buf = NULL;
+ FILE *in;
+ Status status;
+ Bool haveDir;
+
#ifdef WIN32
-char tmpname[PATH_MAX];
+ char tmpname[PATH_MAX];
#else
-int rval;
+ int rval;
#endif
- if ((list->pattern[what]==NULL)||(list->pattern[what][0]=='\0'))
- return Success;
- file= list->pattern[what];
- map= strrchr(file,'(');
- if (map!=NULL) {
- char *tmp;
- map++;
- tmp= strrchr(map,')');
- if ((tmp==NULL)||(tmp[1]!='\0')) {
- /* illegal pattern. No error, but no match */
- return Success;
- }
+ if ((list->pattern[what] == NULL) || (list->pattern[what][0] == '\0'))
+ return Success;
+ file = list->pattern[what];
+ map = strrchr(file, '(');
+ if (map != NULL) {
+ char *tmp;
+
+ map++;
+ tmp = strrchr(map, ')');
+ if ((tmp == NULL) || (tmp[1] != '\0')) {
+ /* illegal pattern. No error, but no match */
+ return Success;
+ }
}
- in= NULL;
- haveDir= TRUE;
+ in = NULL;
+ haveDir = TRUE;
#ifdef WIN32
strcpy(tmpname, Win32TempDir());
strcat(tmpname, "\\xkb_XXXXXX");
(void) mktemp(tmpname);
#endif
- if (XkbBaseDirectory!=NULL) {
- if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
- if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
- componentDirs[what]) == -1)
- buf = NULL;
- else
- in = fopen(buf,"r");
- }
- if (!in) {
- haveDir= FALSE;
- free(buf);
- if (asprintf
- (&buf,
- "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
- XkbBinDirectory, XkbBaseDirectory, componentDirs[what],
- (long) ((xkbDebugFlags < 2) ? 1 :
- ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
- file W32_tmpfile
- ) == -1)
- buf = NULL;
- }
+ if (XkbBaseDirectory != NULL) {
+ if ((list->pattern[what][0] == '*') && (list->pattern[what][1] == '\0')) {
+ if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
+ componentDirs[what]) == -1)
+ buf = NULL;
+ else
+ in = fopen(buf, "r");
+ }
+ if (!in) {
+ haveDir = FALSE;
+ free(buf);
+ if (asprintf
+ (&buf,
+ "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
+ XkbBinDirectory, XkbBaseDirectory, componentDirs[what],
+ (long) ((xkbDebugFlags < 2) ? 1 :
+ ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
+ file W32_tmpfile) == -1)
+ buf = NULL;
+ }
}
else {
- if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
- if (asprintf(&buf, "%s.dir", componentDirs[what]) == -1)
- buf = NULL;
- else
- in = fopen(buf,"r");
- }
- if (!in) {
- haveDir= FALSE;
- free(buf);
- if (asprintf
- (&buf,
- "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
- componentDirs[what],
- (long) ((xkbDebugFlags < 2) ? 1 :
- ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
- file W32_tmpfile
- ) == -1)
- buf = NULL;
- }
+ if ((list->pattern[what][0] == '*') && (list->pattern[what][1] == '\0')) {
+ if (asprintf(&buf, "%s.dir", componentDirs[what]) == -1)
+ buf = NULL;
+ else
+ in = fopen(buf, "r");
+ }
+ if (!in) {
+ haveDir = FALSE;
+ free(buf);
+ if (asprintf
+ (&buf,
+ "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
+ componentDirs[what],
+ (long) ((xkbDebugFlags < 2) ? 1 :
+ ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
+ file W32_tmpfile) == -1)
+ buf = NULL;
+ }
}
- status= Success;
- if (!haveDir)
- {
+ status = Success;
+ if (!haveDir) {
#ifndef WIN32
- in= Popen(buf,"r");
+ in = Popen(buf, "r");
#else
if (xkbDebugFlags)
- DebugF("[xkb] xkbList executes: %s\n",buf);
- if (System(buf) < 0)
- ErrorF("[xkb] Could not invoke keymap compiler\n");
- else
- in= fopen(tmpname, "r");
+ DebugF("[xkb] xkbList executes: %s\n", buf);
+ if (System(buf) < 0)
+ ErrorF("[xkb] Could not invoke keymap compiler\n");
+ else
+ in = fopen(tmpname, "r");
#endif
}
- if (!in)
- {
- free(buf);
+ if (!in) {
+ free(buf);
#ifdef WIN32
- unlink(tmpname);
+ unlink(tmpname);
#endif
- return BadImplementation;
+ return BadImplementation;
}
- list->nFound[what]= 0;
+ list->nFound[what] = 0;
free(buf);
buf = malloc(PATH_MAX * sizeof(char));
if (!buf) {
@@ -229,53 +225,61 @@ int rval;
#endif
return BadAlloc;
}
- while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) {
- unsigned flags;
- register unsigned int i;
- if (*tmp=='#') /* comment, skip it */
- continue;
- if (!strncmp(tmp, "Warning:", 8) || !strncmp(tmp, " ", 8))
- /* skip warnings too */
- continue;
- flags= 0;
- /* each line in the listing is supposed to start with two */
- /* groups of eight characters, which specify the general */
- /* flags and the flags that are specific to the component */
- /* if they're missing, fail with BadImplementation */
- for (i=0;(i<8)&&(status==Success);i++) { /* read the general flags */
- if (isalpha(*tmp)) flags|= (1L<<i);
- else if (*tmp!='-') status= BadImplementation;
- tmp++;
- }
- if (status != Success) break;
- if (!isspace(*tmp)) {
- status= BadImplementation;
- break;
- }
- else tmp++;
- for (i=0;(i<8)&&(status==Success);i++) { /* read the component flags */
- if (isalpha(*tmp)) flags|= (1L<<(i+8));
- else if (*tmp!='-') status= BadImplementation;
- tmp++;
- }
- if (status != Success) break;
- if (isspace(*tmp)) {
- while (isspace(*tmp)) {
- tmp++;
- }
- }
- else {
- status= BadImplementation;
- break;
- }
- status= _AddListComponent(list,what,flags,tmp,client);
+ while ((status == Success) && ((tmp = fgets(buf, PATH_MAX, in)) != NULL)) {
+ unsigned flags;
+ register unsigned int i;
+
+ if (*tmp == '#') /* comment, skip it */
+ continue;
+ if (!strncmp(tmp, "Warning:", 8) || !strncmp(tmp, " ", 8))
+ /* skip warnings too */
+ continue;
+ flags = 0;
+ /* each line in the listing is supposed to start with two */
+ /* groups of eight characters, which specify the general */
+ /* flags and the flags that are specific to the component */
+ /* if they're missing, fail with BadImplementation */
+ for (i = 0; (i < 8) && (status == Success); i++) { /* read the general flags */
+ if (isalpha(*tmp))
+ flags |= (1L << i);
+ else if (*tmp != '-')
+ status = BadImplementation;
+ tmp++;
+ }
+ if (status != Success)
+ break;
+ if (!isspace(*tmp)) {
+ status = BadImplementation;
+ break;
+ }
+ else
+ tmp++;
+ for (i = 0; (i < 8) && (status == Success); i++) { /* read the component flags */
+ if (isalpha(*tmp))
+ flags |= (1L << (i + 8));
+ else if (*tmp != '-')
+ status = BadImplementation;
+ tmp++;
+ }
+ if (status != Success)
+ break;
+ if (isspace(*tmp)) {
+ while (isspace(*tmp)) {
+ tmp++;
+ }
+ }
+ else {
+ status = BadImplementation;
+ break;
+ }
+ status = _AddListComponent(list, what, flags, tmp, client);
}
#ifndef WIN32
if (haveDir)
- fclose(in);
- else if ((rval=Pclose(in))!=0) {
- if (xkbDebugFlags)
- ErrorF("[xkb] xkbcomp returned exit code %d\n",rval);
+ fclose(in);
+ else if ((rval = Pclose(in)) != 0) {
+ if (xkbDebugFlags)
+ ErrorF("[xkb] xkbcomp returned exit code %d\n", rval);
}
#else
fclose(in);
@@ -289,18 +293,18 @@ int rval;
/* ARGSUSED */
Status
-XkbDDXList(DeviceIntPtr dev,XkbSrvListInfoPtr list,ClientPtr client)
+XkbDDXList(DeviceIntPtr dev, XkbSrvListInfoPtr list, ClientPtr client)
{
-Status status;
+ Status status;
- status= XkbDDXListComponent(dev,_XkbListKeycodes,list,client);
- if (status==Success)
- status= XkbDDXListComponent(dev,_XkbListTypes,list,client);
- if (status==Success)
- status= XkbDDXListComponent(dev,_XkbListCompat,list,client);
- if (status==Success)
- status= XkbDDXListComponent(dev,_XkbListSymbols,list,client);
- if (status==Success)
- status= XkbDDXListComponent(dev,_XkbListGeometry,list,client);
+ status = XkbDDXListComponent(dev, _XkbListKeycodes, list, client);
+ if (status == Success)
+ status = XkbDDXListComponent(dev, _XkbListTypes, list, client);
+ if (status == Success)
+ status = XkbDDXListComponent(dev, _XkbListCompat, list, client);
+ if (status == Success)
+ status = XkbDDXListComponent(dev, _XkbListSymbols, list, client);
+ if (status == Success)
+ status = XkbDDXListComponent(dev, _XkbListGeometry, list, client);
return status;
}
diff --git a/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c
index 196142318..cb2dfc31c 100644
--- a/xorg-server/xkb/ddxLoad.c
+++ b/xorg-server/xkb/ddxLoad.c
@@ -45,14 +45,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XI.h>
#include "xkb.h"
- /*
- * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is
- * relative to the top-level XKB configuration directory.
- * Making the server write to a subdirectory of that directory
- * requires some work in the general case (install procedure
- * has to create links to /var or somesuch on many machines),
- * so we just compile into /usr/tmp for now.
- */
+ /*
+ * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is
+ * relative to the top-level XKB configuration directory.
+ * Making the server write to a subdirectory of that directory
+ * requires some work in the general case (install procedure
+ * has to create links to /var or somesuch on many machines),
+ * so we just compile into /usr/tmp for now.
+ */
#ifndef XKM_OUTPUT_DIR
#define XKM_OUTPUT_DIR "compiled/"
#endif
@@ -71,18 +71,19 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef WIN32
#include <X11/Xwindows.h>
-const char*
+const char *
Win32TempDir()
{
static char buffer[PATH_MAX];
- if (GetTempPath(sizeof(buffer), buffer))
- {
+
+ if (GetTempPath(sizeof(buffer), buffer)) {
int len;
- buffer[sizeof(buffer)-1] = 0;
+
+ buffer[sizeof(buffer) - 1] = 0;
len = strlen(buffer);
if (len > 0)
- if (buffer[len-1] == '\\')
- buffer[len-1] = 0;
+ if (buffer[len - 1] == '\\')
+ buffer[len - 1] = 0;
return buffer;
}
if (getenv("TEMP") != NULL)
@@ -93,7 +94,7 @@ Win32TempDir()
return "/tmp";
}
-int
+int
Win32System(const char *cmdline)
{
STARTUPINFO si;
@@ -101,90 +102,82 @@ Win32System(const char *cmdline)
DWORD dwExitCode;
char *cmd = strdup(cmdline);
- ZeroMemory( &si, sizeof(si) );
+ ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
- ZeroMemory( &pi, sizeof(pi) );
-
- if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
- {
- LPVOID buffer;
- if (!FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &buffer,
- 0,
- NULL ))
- {
- ErrorF("[xkb] Starting '%s' failed!\n", cmdline);
- }
- else
- {
- ErrorF("[xkb] Starting '%s' failed: %s", cmdline, (char *)buffer);
- LocalFree(buffer);
- }
-
- free(cmd);
- return -1;
+ ZeroMemory(&pi, sizeof(pi));
+
+ if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
+ LPVOID buffer;
+
+ if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) & buffer, 0, NULL)) {
+ ErrorF("[xkb] Starting '%s' failed!\n", cmdline);
+ }
+ else {
+ ErrorF("[xkb] Starting '%s' failed: %s", cmdline, (char *) buffer);
+ LocalFree(buffer);
+ }
+
+ free(cmd);
+ return -1;
}
/* Wait until child process exits. */
- WaitForSingleObject( pi.hProcess, INFINITE );
+ WaitForSingleObject(pi.hProcess, INFINITE);
+
+ GetExitCodeProcess(pi.hProcess, &dwExitCode);
- GetExitCodeProcess( pi.hProcess, &dwExitCode);
-
/* Close process and thread handles. */
- CloseHandle( pi.hProcess );
- CloseHandle( pi.hThread );
+ CloseHandle(pi.hProcess);
+ CloseHandle(pi.hThread);
free(cmd);
return dwExitCode;
}
+
#undef System
#define System(x) Win32System(x)
#endif
static void
-OutputDirectory(
- char* outdir,
- size_t size)
+OutputDirectory(char *outdir, size_t size)
{
#ifndef WIN32
/* Can we write an xkm and then open it too? */
- if (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0 && (strlen(XKM_OUTPUT_DIR) < size))
- {
- (void) strcpy (outdir, XKM_OUTPUT_DIR);
- } else
+ if (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0 &&
+ (strlen(XKM_OUTPUT_DIR) < size)) {
+ (void) strcpy(outdir, XKM_OUTPUT_DIR);
+ }
+ else
#else
- if (strlen(Win32TempDir()) + 1 < size)
- {
- (void) strcpy(outdir, Win32TempDir());
- (void) strcat(outdir, "\\");
- } else
+ if (strlen(Win32TempDir()) + 1 < size) {
+ (void) strcpy(outdir, Win32TempDir());
+ (void) strcat(outdir, "\\");
+ }
+ else
#endif
- if (strlen("/tmp/") < size)
- {
- (void) strcpy (outdir, "/tmp/");
+ if (strlen("/tmp/") < size) {
+ (void) strcpy(outdir, "/tmp/");
}
}
static Bool
-XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
- XkbComponentNamesPtr names,
- unsigned want,
- unsigned need,
- char * nameRtrn,
- int nameRtrnLen)
+XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
+ XkbComponentNamesPtr names,
+ unsigned want,
+ unsigned need, char *nameRtrn, int nameRtrnLen)
{
- FILE * out;
- char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
+ FILE *out;
+ char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
- const char *emptystring = "";
+ const char *emptystring = "";
char *xkbbasedirflag = NULL;
- const char *xkbbindir = emptystring;
- const char *xkbbindirsep = emptystring;
+ const char *xkbbindir = emptystring;
+ const char *xkbbindirsep = emptystring;
#ifdef WIN32
/* WIN32 has no popen. The input must be stored in a file which is
@@ -206,73 +199,73 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
#endif
if (XkbBaseDirectory != NULL) {
- if (asprintf(&xkbbasedirflag, "\"-R%s\"", XkbBaseDirectory) == -1)
- xkbbasedirflag = NULL;
+ if (asprintf(&xkbbasedirflag, "\"-R%s\"", XkbBaseDirectory) == -1)
+ xkbbasedirflag = NULL;
}
if (XkbBinDirectory != NULL) {
- int ld = strlen(XkbBinDirectory);
- int lps = strlen(PATHSEPARATOR);
+ int ld = strlen(XkbBinDirectory);
+ int lps = strlen(PATHSEPARATOR);
- xkbbindir = XkbBinDirectory;
+ xkbbindir = XkbBinDirectory;
- if ((ld >= lps) &&
- (strcmp(xkbbindir + ld - lps, PATHSEPARATOR) != 0)) {
- xkbbindirsep = PATHSEPARATOR;
- }
+ if ((ld >= lps) && (strcmp(xkbbindir + ld - lps, PATHSEPARATOR) != 0)) {
+ xkbbindirsep = PATHSEPARATOR;
+ }
}
if (asprintf(&buf,
- "\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
- "-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
- xkbbindir, xkbbindirsep,
- ((xkbDebugFlags < 2) ? 1 :
- ((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)),
- xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
- PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
- xkm_output_dir, keymap) == -1)
- buf = NULL;
+ "\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
+ "-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
+ xkbbindir, xkbbindirsep,
+ ((xkbDebugFlags < 2) ? 1 :
+ ((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)),
+ xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
+ PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
+ xkm_output_dir, keymap) == -1)
+ buf = NULL;
free(xkbbasedirflag);
if (!buf) {
- LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp: not enough memory\n");
+ LogMessage(X_ERROR,
+ "XKB: Could not invoke xkbcomp: not enough memory\n");
return FALSE;
}
-
+
#ifndef WIN32
- out= Popen(buf,"w");
+ out = Popen(buf, "w");
#else
- out= fopen(tmpname, "w");
+ out = fopen(tmpname, "w");
#endif
-
- if (out!=NULL) {
+
+ if (out != NULL) {
#ifdef DEBUG
- if (xkbDebugFlags) {
- ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
- XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need);
- }
+ if (xkbDebugFlags) {
+ ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
+ XkbWriteXKBKeymapForNames(stderr, names, xkb, want, need);
+ }
#endif
- XkbWriteXKBKeymapForNames(out,names,xkb,want,need);
+ XkbWriteXKBKeymapForNames(out, names, xkb, want, need);
#ifndef WIN32
- if (Pclose(out)==0)
+ if (Pclose(out) == 0)
#else
- if (fclose(out)==0 && System(buf) >= 0)
+ if (fclose(out) == 0 && System(buf) >= 0)
#endif
- {
+ {
if (xkbDebugFlags)
- DebugF("[xkb] xkb executes: %s\n",buf);
- if (nameRtrn) {
- strlcpy(nameRtrn,keymap,nameRtrnLen);
- }
+ DebugF("[xkb] xkb executes: %s\n", buf);
+ if (nameRtrn) {
+ strlcpy(nameRtrn, keymap, nameRtrnLen);
+ }
free(buf);
#ifdef WIN32
- unlink(tmpname);
+ unlink(tmpname);
#endif
- return TRUE;
- }
- else
- LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
+ return TRUE;
+ }
+ else
+ LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
#ifdef WIN32
/* remove the temporary file */
unlink(tmpname);
@@ -280,115 +273,117 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
}
else {
#ifndef WIN32
- LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
+ LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
#else
- LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
+ LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
#endif
}
if (nameRtrn)
- nameRtrn[0]= '\0';
+ nameRtrn[0] = '\0';
free(buf);
return FALSE;
}
static FILE *
-XkbDDXOpenConfigFile(char *mapName,char *fileNameRtrn,int fileNameRtrnLen)
+XkbDDXOpenConfigFile(char *mapName, char *fileNameRtrn, int fileNameRtrnLen)
{
-char buf[PATH_MAX],xkm_output_dir[PATH_MAX];
-FILE * file;
+ char buf[PATH_MAX], xkm_output_dir[PATH_MAX];
+ FILE *file;
- buf[0]= '\0';
- if (mapName!=NULL) {
- OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
- if ((XkbBaseDirectory!=NULL)&&(xkm_output_dir[0]!='/')
+ buf[0] = '\0';
+ if (mapName != NULL) {
+ OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
+ if ((XkbBaseDirectory != NULL) && (xkm_output_dir[0] != '/')
#ifdef WIN32
- &&(!isalpha(xkm_output_dir[0]) || xkm_output_dir[1]!=':')
+ && (!isalpha(xkm_output_dir[0]) || xkm_output_dir[1] != ':')
#endif
- ) {
+ ) {
if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory,
xkm_output_dir, mapName) >= PATH_MAX)
buf[0] = '\0';
- }
- else
- {
+ }
+ else {
if (snprintf(buf, PATH_MAX, "%s%s.xkm", xkm_output_dir, mapName)
>= PATH_MAX)
buf[0] = '\0';
- }
- if (buf[0] != '\0')
- file= fopen(buf,"rb");
- else file= NULL;
+ }
+ if (buf[0] != '\0')
+ file = fopen(buf, "rb");
+ else
+ file = NULL;
}
- else file= NULL;
- if ((fileNameRtrn!=NULL)&&(fileNameRtrnLen>0)) {
- strlcpy(fileNameRtrn,buf,fileNameRtrnLen);
+ else
+ file = NULL;
+ if ((fileNameRtrn != NULL) && (fileNameRtrnLen > 0)) {
+ strlcpy(fileNameRtrn, buf, fileNameRtrnLen);
}
return file;
}
unsigned
-XkbDDXLoadKeymapByNames( DeviceIntPtr keybd,
- XkbComponentNamesPtr names,
- unsigned want,
- unsigned need,
- XkbDescPtr * xkbRtrn,
- char * nameRtrn,
- int nameRtrnLen)
+XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
+ XkbComponentNamesPtr names,
+ unsigned want,
+ unsigned need,
+ XkbDescPtr *xkbRtrn, char *nameRtrn, int nameRtrnLen)
{
-XkbDescPtr xkb;
-FILE * file;
-char fileName[PATH_MAX];
-unsigned missing;
+ XkbDescPtr xkb;
+ FILE *file;
+ char fileName[PATH_MAX];
+ unsigned missing;
*xkbRtrn = NULL;
- if ((keybd==NULL)||(keybd->key==NULL)||(keybd->key->xkbInfo==NULL))
- xkb= NULL;
- else xkb= keybd->key->xkbInfo->desc;
- if ((names->keycodes==NULL)&&(names->types==NULL)&&
- (names->compat==NULL)&&(names->symbols==NULL)&&
- (names->geometry==NULL)) {
+ if ((keybd == NULL) || (keybd->key == NULL) ||
+ (keybd->key->xkbInfo == NULL))
+ xkb = NULL;
+ else
+ xkb = keybd->key->xkbInfo->desc;
+ if ((names->keycodes == NULL) && (names->types == NULL) &&
+ (names->compat == NULL) && (names->symbols == NULL) &&
+ (names->geometry == NULL)) {
LogMessage(X_ERROR, "XKB: No components provided for device %s\n",
keybd->name ? keybd->name : "(unnamed keyboard)");
return 0;
}
- else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
- nameRtrn,nameRtrnLen)){
- LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
- return 0;
+ else if (!XkbDDXCompileKeymapByNames(xkb, names, want, need,
+ nameRtrn, nameRtrnLen)) {
+ LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
+ return 0;
}
- file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX);
- if (file==NULL) {
- LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",fileName);
- return 0;
+ file = XkbDDXOpenConfigFile(nameRtrn, fileName, PATH_MAX);
+ if (file == NULL) {
+ LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",
+ fileName);
+ return 0;
}
- missing= XkmReadFile(file,need,want,xkbRtrn);
- if (*xkbRtrn==NULL) {
- LogMessage(X_ERROR, "Error loading keymap %s\n",fileName);
- fclose(file);
- (void) unlink (fileName);
- return 0;
+ missing = XkmReadFile(file, need, want, xkbRtrn);
+ if (*xkbRtrn == NULL) {
+ LogMessage(X_ERROR, "Error loading keymap %s\n", fileName);
+ fclose(file);
+ (void) unlink(fileName);
+ return 0;
}
else {
- DebugF("Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined);
+ DebugF("Loaded XKB keymap %s, defined=0x%x\n", fileName,
+ (*xkbRtrn)->defined);
}
fclose(file);
- (void) unlink (fileName);
- return (need|want)&(~missing);
+ (void) unlink(fileName);
+ return (need | want) & (~missing);
}
Bool
-XkbDDXNamesFromRules( DeviceIntPtr keybd,
- char * rules_name,
- XkbRF_VarDefsPtr defs,
- XkbComponentNamesPtr names)
+XkbDDXNamesFromRules(DeviceIntPtr keybd,
+ char *rules_name,
+ XkbRF_VarDefsPtr defs, XkbComponentNamesPtr names)
{
-char buf[PATH_MAX];
-FILE * file;
-Bool complete;
-XkbRF_RulesPtr rules;
+ char buf[PATH_MAX];
+ FILE *file;
+ Bool complete;
+ XkbRF_RulesPtr rules;
if (!rules_name)
- return FALSE;
+ return FALSE;
if (snprintf(buf, PATH_MAX, "%s/rules/%s", XkbBaseDirectory, rules_name)
>= PATH_MAX) {
@@ -399,25 +394,25 @@ XkbRF_RulesPtr rules;
file = fopen(buf, "r");
if (!file) {
LogMessage(X_ERROR, "XKB: Couldn't open rules file %s\n", buf);
- return FALSE;
+ return FALSE;
}
rules = XkbRF_Create();
if (!rules) {
LogMessage(X_ERROR, "XKB: Couldn't create rules struct\n");
- fclose(file);
- return FALSE;
+ fclose(file);
+ return FALSE;
}
if (!XkbRF_LoadRules(file, rules)) {
LogMessage(X_ERROR, "XKB: Couldn't parse rules file %s\n", rules_name);
- fclose(file);
- XkbRF_Free(rules,TRUE);
- return FALSE;
+ fclose(file);
+ XkbRF_Free(rules, TRUE);
+ return FALSE;
}
memset(names, 0, sizeof(*names));
- complete = XkbRF_GetComponents(rules,defs,names);
+ complete = XkbRF_GetComponents(rules, defs, names);
fclose(file);
XkbRF_Free(rules, TRUE);
@@ -428,7 +423,8 @@ XkbRF_RulesPtr rules;
}
static Bool
-XkbRMLVOtoKcCGST(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbComponentNamesPtr kccgst)
+XkbRMLVOtoKcCGST(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
+ XkbComponentNamesPtr kccgst)
{
XkbRF_VarDefsRec mlvo;
@@ -446,16 +442,17 @@ XkbRMLVOtoKcCGST(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbComponentNamesPtr kccg
* or equal to need, the compiliation is treated as failure.
*/
static XkbDescPtr
-XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, int need)
+XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, int need)
{
XkbDescPtr xkb = NULL;
unsigned int provided;
- XkbComponentNamesRec kccgst = {0};
+ XkbComponentNamesRec kccgst = { 0 };
char name[PATH_MAX];
if (XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst)) {
- provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need,
- &xkb, name, PATH_MAX);
+ provided =
+ XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need, &xkb,
+ name, PATH_MAX);
if ((need & provided) != need) {
if (xkb) {
XkbFreeKeyboard(xkb, 0, TRUE);
@@ -469,7 +466,7 @@ XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, int need)
}
XkbDescPtr
-XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet *rmlvo)
+XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo)
{
XkbDescPtr xkb;
unsigned int need;
@@ -481,8 +478,7 @@ XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet *rmlvo)
/* These are the components we really really need */
need = XkmSymbolsMask | XkmCompatMapMask | XkmTypesMask |
- XkmKeyNamesMask | XkmVirtualModsMask;
-
+ XkmKeyNamesMask | XkmVirtualModsMask;
xkb = XkbCompileKeymapForDevice(dev, rmlvo, need);
diff --git a/xorg-server/xkb/maprules.c b/xorg-server/xkb/maprules.c
index 66800478c..c6900eccb 100644
--- a/xorg-server/xkb/maprules.c
+++ b/xorg-server/xkb/maprules.c
@@ -52,54 +52,52 @@
/***====================================================================***/
-
-
#define DFLT_LINE_SIZE 128
typedef struct {
- int line_num;
- int sz_line;
- int num_line;
- char buf[DFLT_LINE_SIZE];
- char * line;
+ int line_num;
+ int sz_line;
+ int num_line;
+ char buf[DFLT_LINE_SIZE];
+ char *line;
} InputLine;
static void
-InitInputLine(InputLine *line)
+InitInputLine(InputLine * line)
{
- line->line_num= 1;
- line->num_line= 0;
- line->sz_line= DFLT_LINE_SIZE;
- line->line= line->buf;
+ line->line_num = 1;
+ line->num_line = 0;
+ line->sz_line = DFLT_LINE_SIZE;
+ line->line = line->buf;
return;
}
static void
-FreeInputLine(InputLine *line)
+FreeInputLine(InputLine * line)
{
- if (line->line!=line->buf)
- free(line->line);
- line->line_num= 1;
- line->num_line= 0;
- line->sz_line= DFLT_LINE_SIZE;
- line->line= line->buf;
+ if (line->line != line->buf)
+ free(line->line);
+ line->line_num = 1;
+ line->num_line = 0;
+ line->sz_line = DFLT_LINE_SIZE;
+ line->line = line->buf;
return;
}
static int
-InputLineAddChar(InputLine *line,int ch)
+InputLineAddChar(InputLine * line, int ch)
{
- if (line->num_line>=line->sz_line) {
- if (line->line==line->buf) {
- line->line= malloc(line->sz_line*2);
- memcpy(line->line,line->buf,line->sz_line);
- }
- else {
- line->line= realloc((char *)line->line,line->sz_line*2);
- }
- line->sz_line*= 2;
- }
- line->line[line->num_line++]= ch;
+ if (line->num_line >= line->sz_line) {
+ if (line->line == line->buf) {
+ line->line = malloc(line->sz_line * 2);
+ memcpy(line->line, line->buf, line->sz_line);
+ }
+ else {
+ line->line = realloc((char *) line->line, line->sz_line * 2);
+ }
+ line->sz_line *= 2;
+ }
+ line->line[line->num_line++] = ch;
return ch;
}
@@ -108,80 +106,80 @@ InputLineAddChar(InputLine *line,int ch)
InputLineAddChar(l,c))
static Bool
-GetInputLine(FILE *file,InputLine *line,Bool checkbang)
+GetInputLine(FILE * file, InputLine * line, Bool checkbang)
{
-int ch;
-Bool endOfFile,spacePending,slashPending,inComment;
-
- endOfFile= FALSE;
- while ((!endOfFile)&&(line->num_line==0)) {
- spacePending= slashPending= inComment= FALSE;
- while (((ch=getc(file))!='\n')&&(ch!=EOF)) {
- if (ch=='\\') {
- if ((ch=getc(file))==EOF)
- break;
- if (ch=='\n') {
- inComment= FALSE;
- ch= ' ';
- line->line_num++;
- }
- }
- if (inComment)
- continue;
- if (ch=='/') {
- if (slashPending) {
- inComment= TRUE;
- slashPending= FALSE;
- }
- else {
- slashPending= TRUE;
- }
- continue;
- }
- else if (slashPending) {
- if (spacePending) {
- ADD_CHAR(line,' ');
- spacePending= FALSE;
- }
- ADD_CHAR(line,'/');
- slashPending= FALSE;
- }
- if (isspace(ch)) {
- while (isspace(ch)&&(ch!='\n')&&(ch!=EOF)) {
- ch= getc(file);
- }
- if (ch==EOF)
- break;
- if ((ch!='\n')&&(line->num_line>0))
- spacePending= TRUE;
- ungetc(ch,file);
- }
- else {
- if (spacePending) {
- ADD_CHAR(line,' ');
- spacePending= FALSE;
- }
- if (checkbang && ch=='!') {
- if (line->num_line!=0) {
- DebugF("The '!' legal only at start of line\n");
- DebugF("Line containing '!' ignored\n");
- line->num_line= 0;
- inComment= 0;
- break;
- }
-
- }
- ADD_CHAR(line,ch);
- }
- }
- if (ch==EOF)
- endOfFile= TRUE;
+ int ch;
+ Bool endOfFile, spacePending, slashPending, inComment;
+
+ endOfFile = FALSE;
+ while ((!endOfFile) && (line->num_line == 0)) {
+ spacePending = slashPending = inComment = FALSE;
+ while (((ch = getc(file)) != '\n') && (ch != EOF)) {
+ if (ch == '\\') {
+ if ((ch = getc(file)) == EOF)
+ break;
+ if (ch == '\n') {
+ inComment = FALSE;
+ ch = ' ';
+ line->line_num++;
+ }
+ }
+ if (inComment)
+ continue;
+ if (ch == '/') {
+ if (slashPending) {
+ inComment = TRUE;
+ slashPending = FALSE;
+ }
+ else {
+ slashPending = TRUE;
+ }
+ continue;
+ }
+ else if (slashPending) {
+ if (spacePending) {
+ ADD_CHAR(line, ' ');
+ spacePending = FALSE;
+ }
+ ADD_CHAR(line, '/');
+ slashPending = FALSE;
+ }
+ if (isspace(ch)) {
+ while (isspace(ch) && (ch != '\n') && (ch != EOF)) {
+ ch = getc(file);
+ }
+ if (ch == EOF)
+ break;
+ if ((ch != '\n') && (line->num_line > 0))
+ spacePending = TRUE;
+ ungetc(ch, file);
+ }
+ else {
+ if (spacePending) {
+ ADD_CHAR(line, ' ');
+ spacePending = FALSE;
+ }
+ if (checkbang && ch == '!') {
+ if (line->num_line != 0) {
+ DebugF("The '!' legal only at start of line\n");
+ DebugF("Line containing '!' ignored\n");
+ line->num_line = 0;
+ inComment = 0;
+ break;
+ }
+
+ }
+ ADD_CHAR(line, ch);
+ }
+ }
+ if (ch == EOF)
+ endOfFile = TRUE;
/* else line->num_line++;*/
- }
- if ((line->num_line==0)&&(endOfFile))
- return FALSE;
- ADD_CHAR(line,'\0');
- return TRUE;
+ }
+ if ((line->num_line == 0) && (endOfFile))
+ return FALSE;
+ ADD_CHAR(line, '\0');
+ return TRUE;
}
/***====================================================================***/
@@ -200,164 +198,169 @@ Bool endOfFile,spacePending,slashPending,inComment;
#define PART_MASK 0x000F
#define COMPONENT_MASK 0x03F0
-static const char * cname[MAX_WORDS] = {
- "model", "layout", "variant", "option",
- "keycodes", "symbols", "types", "compat", "geometry"
+static const char *cname[MAX_WORDS] = {
+ "model", "layout", "variant", "option",
+ "keycodes", "symbols", "types", "compat", "geometry"
};
-typedef struct _RemapSpec {
- int number;
- int num_remap;
- struct {
- int word;
- int index;
- } remap[MAX_WORDS];
+typedef struct _RemapSpec {
+ int number;
+ int num_remap;
+ struct {
+ int word;
+ int index;
+ } remap[MAX_WORDS];
} RemapSpec;
typedef struct _FileSpec {
- char * name[MAX_WORDS];
- struct _FileSpec * pending;
+ char *name[MAX_WORDS];
+ struct _FileSpec *pending;
} FileSpec;
typedef struct {
- char * model;
- char * layout[XkbNumKbdGroups+1];
- char * variant[XkbNumKbdGroups+1];
- char * options;
+ char *model;
+ char *layout[XkbNumKbdGroups + 1];
+ char *variant[XkbNumKbdGroups + 1];
+ char *options;
} XkbRF_MultiDefsRec, *XkbRF_MultiDefsPtr;
#define NDX_BUFF_SIZE 4
/***====================================================================***/
-static char*
+static char *
get_index(char *str, int *ndx)
{
- char ndx_buf[NDX_BUFF_SIZE];
- char *end;
-
- if (*str != '[') {
- *ndx = 0;
- return str;
- }
- str++;
- end = strchr(str, ']');
- if (end == NULL) {
- *ndx = -1;
- return str - 1;
- }
- if ( (end - str) >= NDX_BUFF_SIZE) {
- *ndx = -1;
- return end + 1;
- }
- strlcpy(ndx_buf, str, 1 + end - str);
- *ndx = atoi(ndx_buf);
- return end + 1;
+ char ndx_buf[NDX_BUFF_SIZE];
+ char *end;
+
+ if (*str != '[') {
+ *ndx = 0;
+ return str;
+ }
+ str++;
+ end = strchr(str, ']');
+ if (end == NULL) {
+ *ndx = -1;
+ return str - 1;
+ }
+ if ((end - str) >= NDX_BUFF_SIZE) {
+ *ndx = -1;
+ return end + 1;
+ }
+ strlcpy(ndx_buf, str, 1 + end - str);
+ *ndx = atoi(ndx_buf);
+ return end + 1;
}
static void
-SetUpRemap(InputLine *line,RemapSpec *remap)
+SetUpRemap(InputLine * line, RemapSpec * remap)
{
-char * tok,*str;
-unsigned present, l_ndx_present, v_ndx_present;
-register int i;
-int len, ndx;
-_Xstrtokparams strtok_buf;
-Bool found;
-
-
- l_ndx_present = v_ndx_present = present= 0;
- str= &line->line[1];
- len = remap->number;
- memset((char *)remap, 0, sizeof(RemapSpec));
- remap->number = len;
- while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) {
- found= FALSE;
- str= NULL;
- if (strcmp(tok,"=")==0)
- continue;
- for (i=0;i<MAX_WORDS;i++) {
+ char *tok, *str;
+ unsigned present, l_ndx_present, v_ndx_present;
+ register int i;
+ int len, ndx;
+ _Xstrtokparams strtok_buf;
+ Bool found;
+
+ l_ndx_present = v_ndx_present = present = 0;
+ str = &line->line[1];
+ len = remap->number;
+ memset((char *) remap, 0, sizeof(RemapSpec));
+ remap->number = len;
+ while ((tok = _XStrtok(str, " ", strtok_buf)) != NULL) {
+ found = FALSE;
+ str = NULL;
+ if (strcmp(tok, "=") == 0)
+ continue;
+ for (i = 0; i < MAX_WORDS; i++) {
len = strlen(cname[i]);
- if (strncmp(cname[i],tok,len)==0) {
- if(strlen(tok) > len) {
- char *end = get_index(tok+len, &ndx);
- if ((i != LAYOUT && i != VARIANT) ||
- *end != '\0' || ndx == -1)
- break;
- if (ndx < 1 || ndx > XkbNumKbdGroups) {
- DebugF("Illegal %s index: %d\n", cname[i], ndx);
- DebugF("Index must be in range 1..%d\n",
- XkbNumKbdGroups);
- break;
- }
- } else {
- ndx = 0;
+ if (strncmp(cname[i], tok, len) == 0) {
+ if (strlen(tok) > len) {
+ char *end = get_index(tok + len, &ndx);
+
+ if ((i != LAYOUT && i != VARIANT) ||
+ *end != '\0' || ndx == -1)
+ break;
+ if (ndx < 1 || ndx > XkbNumKbdGroups) {
+ DebugF("Illegal %s index: %d\n", cname[i], ndx);
+ DebugF("Index must be in range 1..%d\n",
+ XkbNumKbdGroups);
+ break;
+ }
}
- found= TRUE;
- if (present&(1<<i)) {
- if ((i == LAYOUT && l_ndx_present&(1<<ndx)) ||
- (i == VARIANT && v_ndx_present&(1<<ndx)) ) {
- DebugF("Component \"%s\" listed twice\n",tok);
- DebugF("Second definition ignored\n");
- break;
- }
- }
- present |= (1<<i);
+ else {
+ ndx = 0;
+ }
+ found = TRUE;
+ if (present & (1 << i)) {
+ if ((i == LAYOUT && l_ndx_present & (1 << ndx)) ||
+ (i == VARIANT && v_ndx_present & (1 << ndx))) {
+ DebugF("Component \"%s\" listed twice\n", tok);
+ DebugF("Second definition ignored\n");
+ break;
+ }
+ }
+ present |= (1 << i);
if (i == LAYOUT)
l_ndx_present |= 1 << ndx;
if (i == VARIANT)
v_ndx_present |= 1 << ndx;
- remap->remap[remap->num_remap].word= i;
- remap->remap[remap->num_remap++].index= ndx;
- break;
- }
- }
- if (!found) {
- fprintf(stderr,"Unknown component \"%s\" ignored\n",tok);
- }
- }
- if ((present&PART_MASK)==0) {
- unsigned mask= PART_MASK;
- ErrorF("Mapping needs at least one of ");
- for (i=0; (i<MAX_WORDS); i++) {
- if ((1L<<i)&mask) {
- mask&= ~(1L<<i);
- if (mask) DebugF("\"%s,\" ",cname[i]);
- else DebugF("or \"%s\"\n",cname[i]);
- }
- }
- DebugF("Illegal mapping ignored\n");
- remap->num_remap= 0;
- return;
- }
- if ((present&COMPONENT_MASK)==0) {
- DebugF("Mapping needs at least one component\n");
- DebugF("Illegal mapping ignored\n");
- remap->num_remap= 0;
- return;
- }
- remap->number++;
- return;
+ remap->remap[remap->num_remap].word = i;
+ remap->remap[remap->num_remap++].index = ndx;
+ break;
+ }
+ }
+ if (!found) {
+ fprintf(stderr, "Unknown component \"%s\" ignored\n", tok);
+ }
+ }
+ if ((present & PART_MASK) == 0) {
+ unsigned mask = PART_MASK;
+
+ ErrorF("Mapping needs at least one of ");
+ for (i = 0; (i < MAX_WORDS); i++) {
+ if ((1L << i) & mask) {
+ mask &= ~(1L << i);
+ if (mask)
+ DebugF("\"%s,\" ", cname[i]);
+ else
+ DebugF("or \"%s\"\n", cname[i]);
+ }
+ }
+ DebugF("Illegal mapping ignored\n");
+ remap->num_remap = 0;
+ return;
+ }
+ if ((present & COMPONENT_MASK) == 0) {
+ DebugF("Mapping needs at least one component\n");
+ DebugF("Illegal mapping ignored\n");
+ remap->num_remap = 0;
+ return;
+ }
+ remap->number++;
+ return;
}
static Bool
-MatchOneOf(char *wanted,char *vals_defined)
+MatchOneOf(char *wanted, char *vals_defined)
{
-char *str,*next;
-int want_len= strlen(wanted);
-
- for (str=vals_defined,next=NULL;str!=NULL;str=next) {
- int len;
- next= strchr(str,',');
- if (next) {
- len= next-str;
- next++;
- }
- else {
- len= strlen(str);
- }
- if ((len==want_len)&&(strncmp(wanted,str,len)==0))
- return TRUE;
+ char *str, *next;
+ int want_len = strlen(wanted);
+
+ for (str = vals_defined, next = NULL; str != NULL; str = next) {
+ int len;
+
+ next = strchr(str, ',');
+ if (next) {
+ len = next - str;
+ next++;
+ }
+ else {
+ len = strlen(str);
+ }
+ if ((len == want_len) && (strncmp(wanted, str, len) == 0))
+ return TRUE;
}
return FALSE;
}
@@ -365,23 +368,22 @@ int want_len= strlen(wanted);
/***====================================================================***/
static Bool
-CheckLine( InputLine * line,
- RemapSpec * remap,
- XkbRF_RulePtr rule,
- XkbRF_GroupPtr group)
+CheckLine(InputLine * line,
+ RemapSpec * remap, XkbRF_RulePtr rule, XkbRF_GroupPtr group)
{
-char * str,*tok;
-register int nread, i;
-FileSpec tmp;
-_Xstrtokparams strtok_buf;
-Bool append = FALSE;
+ char *str, *tok;
+ register int nread, i;
+ FileSpec tmp;
+ _Xstrtokparams strtok_buf;
+ Bool append = FALSE;
- if (line->line[0]=='!') {
+ if (line->line[0] == '!') {
if (line->line[1] == '$' ||
(line->line[1] == ' ' && line->line[2] == '$')) {
char *gname = strchr(line->line, '$');
char *words = strchr(gname, ' ');
- if(!words)
+
+ if (!words)
return FALSE;
*words++ = '\0';
for (; *words; words++) {
@@ -393,168 +395,178 @@ Bool append = FALSE;
group->name = Xstrdup(gname);
group->words = Xstrdup(words);
for (i = 1, words = group->words; *words; words++) {
- if ( *words == ' ') {
- *words++ = '\0';
- i++;
- }
+ if (*words == ' ') {
+ *words++ = '\0';
+ i++;
+ }
}
group->number = i;
return TRUE;
- } else {
- SetUpRemap(line,remap);
- return FALSE;
- }
- }
-
- if (remap->num_remap==0) {
- DebugF("Must have a mapping before first line of data\n");
- DebugF("Illegal line of data ignored\n");
- return FALSE;
- }
- memset((char *)&tmp, 0, sizeof(FileSpec));
- str= line->line;
- for (nread= 0;(tok=_XStrtok(str," ",strtok_buf))!=NULL;nread++) {
- str= NULL;
- if (strcmp(tok,"=")==0) {
- nread--;
- continue;
- }
- if (nread>remap->num_remap) {
- DebugF("Too many words on a line\n");
- DebugF("Extra word \"%s\" ignored\n",tok);
- continue;
- }
- tmp.name[remap->remap[nread].word]= tok;
- if (*tok == '+' || *tok == '|')
- append = TRUE;
- }
- if (nread<remap->num_remap) {
- DebugF("Too few words on a line: %s\n", line->line);
- DebugF("line ignored\n");
- return FALSE;
- }
-
- rule->flags= 0;
+ }
+ else {
+ SetUpRemap(line, remap);
+ return FALSE;
+ }
+ }
+
+ if (remap->num_remap == 0) {
+ DebugF("Must have a mapping before first line of data\n");
+ DebugF("Illegal line of data ignored\n");
+ return FALSE;
+ }
+ memset((char *) &tmp, 0, sizeof(FileSpec));
+ str = line->line;
+ for (nread = 0; (tok = _XStrtok(str, " ", strtok_buf)) != NULL; nread++) {
+ str = NULL;
+ if (strcmp(tok, "=") == 0) {
+ nread--;
+ continue;
+ }
+ if (nread > remap->num_remap) {
+ DebugF("Too many words on a line\n");
+ DebugF("Extra word \"%s\" ignored\n", tok);
+ continue;
+ }
+ tmp.name[remap->remap[nread].word] = tok;
+ if (*tok == '+' || *tok == '|')
+ append = TRUE;
+ }
+ if (nread < remap->num_remap) {
+ DebugF("Too few words on a line: %s\n", line->line);
+ DebugF("line ignored\n");
+ return FALSE;
+ }
+
+ rule->flags = 0;
rule->number = remap->number;
if (tmp.name[OPTION])
- rule->flags|= XkbRF_Option;
+ rule->flags |= XkbRF_Option;
else if (append)
- rule->flags|= XkbRF_Append;
+ rule->flags |= XkbRF_Append;
else
- rule->flags|= XkbRF_Normal;
- rule->model= Xstrdup(tmp.name[MODEL]);
- rule->layout= Xstrdup(tmp.name[LAYOUT]);
- rule->variant= Xstrdup(tmp.name[VARIANT]);
- rule->option= Xstrdup(tmp.name[OPTION]);
-
- rule->keycodes= Xstrdup(tmp.name[KEYCODES]);
- rule->symbols= Xstrdup(tmp.name[SYMBOLS]);
- rule->types= Xstrdup(tmp.name[TYPES]);
- rule->compat= Xstrdup(tmp.name[COMPAT]);
- rule->geometry= Xstrdup(tmp.name[GEOMETRY]);
+ rule->flags |= XkbRF_Normal;
+ rule->model = Xstrdup(tmp.name[MODEL]);
+ rule->layout = Xstrdup(tmp.name[LAYOUT]);
+ rule->variant = Xstrdup(tmp.name[VARIANT]);
+ rule->option = Xstrdup(tmp.name[OPTION]);
+
+ rule->keycodes = Xstrdup(tmp.name[KEYCODES]);
+ rule->symbols = Xstrdup(tmp.name[SYMBOLS]);
+ rule->types = Xstrdup(tmp.name[TYPES]);
+ rule->compat = Xstrdup(tmp.name[COMPAT]);
+ rule->geometry = Xstrdup(tmp.name[GEOMETRY]);
rule->layout_num = rule->variant_num = 0;
for (i = 0; i < nread; i++) {
if (remap->remap[i].index) {
- if (remap->remap[i].word == LAYOUT)
- rule->layout_num = remap->remap[i].index;
- if (remap->remap[i].word == VARIANT)
- rule->variant_num = remap->remap[i].index;
+ if (remap->remap[i].word == LAYOUT)
+ rule->layout_num = remap->remap[i].index;
+ if (remap->remap[i].word == VARIANT)
+ rule->variant_num = remap->remap[i].index;
}
}
return TRUE;
}
static char *
-_Concat(char *str1,char *str2)
+_Concat(char *str1, char *str2)
{
-int len;
+ int len;
- if ((!str1)||(!str2))
- return str1;
- len= strlen(str1)+strlen(str2)+1;
- str1= realloc(str1,len * sizeof(char));
+ if ((!str1) || (!str2))
+ return str1;
+ len = strlen(str1) + strlen(str2) + 1;
+ str1 = realloc(str1, len * sizeof(char));
if (str1)
- strcat(str1,str2);
+ strcat(str1, str2);
return str1;
}
static void
squeeze_spaces(char *p1)
{
- char *p2;
- for (p2 = p1; *p2; p2++) {
- *p1 = *p2;
- if (*p1 != ' ') p1++;
- }
- *p1 = '\0';
+ char *p2;
+
+ for (p2 = p1; *p2; p2++) {
+ *p1 = *p2;
+ if (*p1 != ' ')
+ p1++;
+ }
+ *p1 = '\0';
}
static Bool
MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
{
- memset((char *)mdefs, 0, sizeof(XkbRF_MultiDefsRec));
- mdefs->model = defs->model;
- mdefs->options = Xstrdup(defs->options);
- if (mdefs->options) squeeze_spaces(mdefs->options);
-
- if (defs->layout) {
- if (!strchr(defs->layout, ',')) {
- mdefs->layout[0] = defs->layout;
- } else {
- char *p;
- int i;
- mdefs->layout[1] = Xstrdup(defs->layout);
- if (mdefs->layout[1] == NULL)
- return FALSE;
- squeeze_spaces(mdefs->layout[1]);
- p = mdefs->layout[1];
- for (i = 2; i <= XkbNumKbdGroups; i++) {
- if ((p = strchr(p, ','))) {
- *p++ = '\0';
- mdefs->layout[i] = p;
- } else {
- break;
- }
- }
- if (p && (p = strchr(p, ',')))
- *p = '\0';
- }
- }
-
- if (defs->variant) {
- if (!strchr(defs->variant, ',')) {
- mdefs->variant[0] = defs->variant;
- } else {
- char *p;
- int i;
- mdefs->variant[1] = Xstrdup(defs->variant);
- if (mdefs->variant[1] == NULL)
- return FALSE;
- squeeze_spaces(mdefs->variant[1]);
- p = mdefs->variant[1];
- for (i = 2; i <= XkbNumKbdGroups; i++) {
- if ((p = strchr(p, ','))) {
- *p++ = '\0';
- mdefs->variant[i] = p;
- } else {
- break;
- }
- }
- if (p && (p = strchr(p, ',')))
- *p = '\0';
- }
- }
- return TRUE;
+ memset((char *) mdefs, 0, sizeof(XkbRF_MultiDefsRec));
+ mdefs->model = defs->model;
+ mdefs->options = Xstrdup(defs->options);
+ if (mdefs->options)
+ squeeze_spaces(mdefs->options);
+
+ if (defs->layout) {
+ if (!strchr(defs->layout, ',')) {
+ mdefs->layout[0] = defs->layout;
+ }
+ else {
+ char *p;
+ int i;
+
+ mdefs->layout[1] = Xstrdup(defs->layout);
+ if (mdefs->layout[1] == NULL)
+ return FALSE;
+ squeeze_spaces(mdefs->layout[1]);
+ p = mdefs->layout[1];
+ for (i = 2; i <= XkbNumKbdGroups; i++) {
+ if ((p = strchr(p, ','))) {
+ *p++ = '\0';
+ mdefs->layout[i] = p;
+ }
+ else {
+ break;
+ }
+ }
+ if (p && (p = strchr(p, ',')))
+ *p = '\0';
+ }
+ }
+
+ if (defs->variant) {
+ if (!strchr(defs->variant, ',')) {
+ mdefs->variant[0] = defs->variant;
+ }
+ else {
+ char *p;
+ int i;
+
+ mdefs->variant[1] = Xstrdup(defs->variant);
+ if (mdefs->variant[1] == NULL)
+ return FALSE;
+ squeeze_spaces(mdefs->variant[1]);
+ p = mdefs->variant[1];
+ for (i = 2; i <= XkbNumKbdGroups; i++) {
+ if ((p = strchr(p, ','))) {
+ *p++ = '\0';
+ mdefs->variant[i] = p;
+ }
+ else {
+ break;
+ }
+ }
+ if (p && (p = strchr(p, ',')))
+ *p = '\0';
+ }
+ }
+ return TRUE;
}
static void
FreeMultiDefs(XkbRF_MultiDefsPtr defs)
{
- free(defs->options);
- free(defs->layout[1]);
- free(defs->variant[1]);
+ free(defs->options);
+ free(defs->layout[1]);
+ free(defs->variant[1]);
}
static void
@@ -562,168 +574,171 @@ Apply(char *src, char **dst)
{
if (src) {
if (*src == '+' || *src == '!') {
- *dst= _Concat(*dst, src);
- } else {
+ *dst = _Concat(*dst, src);
+ }
+ else {
if (*dst == NULL)
- *dst= Xstrdup(src);
+ *dst = Xstrdup(src);
}
}
}
static void
-XkbRF_ApplyRule( XkbRF_RulePtr rule,
- XkbComponentNamesPtr names)
+XkbRF_ApplyRule(XkbRF_RulePtr rule, XkbComponentNamesPtr names)
{
- rule->flags&= ~XkbRF_PendingMatch; /* clear the flag because it's applied */
+ rule->flags &= ~XkbRF_PendingMatch; /* clear the flag because it's applied */
Apply(rule->keycodes, &names->keycodes);
- Apply(rule->symbols, &names->symbols);
- Apply(rule->types, &names->types);
- Apply(rule->compat, &names->compat);
+ Apply(rule->symbols, &names->symbols);
+ Apply(rule->types, &names->types);
+ Apply(rule->compat, &names->compat);
Apply(rule->geometry, &names->geometry);
}
static Bool
-CheckGroup( XkbRF_RulesPtr rules,
- char * group_name,
- char * name)
+CheckGroup(XkbRF_RulesPtr rules, char *group_name, char *name)
{
- int i;
- char *p;
- XkbRF_GroupPtr group;
-
- for (i = 0, group = rules->groups; i < rules->num_groups; i++, group++) {
- if (! strcmp(group->name, group_name)) {
- break;
- }
- }
- if (i == rules->num_groups)
- return FALSE;
- for (i = 0, p = group->words; i < group->number; i++, p += strlen(p)+1) {
- if (! strcmp(p, name)) {
- return TRUE;
- }
- }
- return FALSE;
+ int i;
+ char *p;
+ XkbRF_GroupPtr group;
+
+ for (i = 0, group = rules->groups; i < rules->num_groups; i++, group++) {
+ if (!strcmp(group->name, group_name)) {
+ break;
+ }
+ }
+ if (i == rules->num_groups)
+ return FALSE;
+ for (i = 0, p = group->words; i < group->number; i++, p += strlen(p) + 1) {
+ if (!strcmp(p, name)) {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
static int
-XkbRF_CheckApplyRule( XkbRF_RulePtr rule,
- XkbRF_MultiDefsPtr mdefs,
- XkbComponentNamesPtr names,
- XkbRF_RulesPtr rules)
+XkbRF_CheckApplyRule(XkbRF_RulePtr rule,
+ XkbRF_MultiDefsPtr mdefs,
+ XkbComponentNamesPtr names, XkbRF_RulesPtr rules)
{
Bool pending = FALSE;
if (rule->model != NULL) {
- if(mdefs->model == NULL)
+ if (mdefs->model == NULL)
return 0;
if (strcmp(rule->model, "*") == 0) {
pending = TRUE;
- } else {
+ }
+ else {
if (rule->model[0] == '$') {
- if (!CheckGroup(rules, rule->model, mdefs->model))
- return 0;
- } else {
- if (strcmp(rule->model, mdefs->model) != 0)
- return 0;
- }
- }
+ if (!CheckGroup(rules, rule->model, mdefs->model))
+ return 0;
+ }
+ else {
+ if (strcmp(rule->model, mdefs->model) != 0)
+ return 0;
+ }
+ }
}
if (rule->option != NULL) {
- if (mdefs->options == NULL)
- return 0;
- if ((!MatchOneOf(rule->option,mdefs->options)))
- return 0;
+ if (mdefs->options == NULL)
+ return 0;
+ if ((!MatchOneOf(rule->option, mdefs->options)))
+ return 0;
}
if (rule->layout != NULL) {
- if(mdefs->layout[rule->layout_num] == NULL ||
- *mdefs->layout[rule->layout_num] == '\0')
- return 0;
+ if (mdefs->layout[rule->layout_num] == NULL ||
+ *mdefs->layout[rule->layout_num] == '\0')
+ return 0;
if (strcmp(rule->layout, "*") == 0) {
pending = TRUE;
- } else {
+ }
+ else {
if (rule->layout[0] == '$') {
- if (!CheckGroup(rules, rule->layout,
- mdefs->layout[rule->layout_num]))
- return 0;
- } else {
- if (strcmp(rule->layout, mdefs->layout[rule->layout_num]) != 0)
- return 0;
- }
- }
+ if (!CheckGroup(rules, rule->layout,
+ mdefs->layout[rule->layout_num]))
+ return 0;
+ }
+ else {
+ if (strcmp(rule->layout, mdefs->layout[rule->layout_num]) != 0)
+ return 0;
+ }
+ }
}
if (rule->variant != NULL) {
- if (mdefs->variant[rule->variant_num] == NULL ||
- *mdefs->variant[rule->variant_num] == '\0')
- return 0;
+ if (mdefs->variant[rule->variant_num] == NULL ||
+ *mdefs->variant[rule->variant_num] == '\0')
+ return 0;
if (strcmp(rule->variant, "*") == 0) {
pending = TRUE;
- } else {
+ }
+ else {
if (rule->variant[0] == '$') {
- if (!CheckGroup(rules, rule->variant,
- mdefs->variant[rule->variant_num]))
- return 0;
- } else {
- if (strcmp(rule->variant,
- mdefs->variant[rule->variant_num]) != 0)
- return 0;
- }
- }
+ if (!CheckGroup(rules, rule->variant,
+ mdefs->variant[rule->variant_num]))
+ return 0;
+ }
+ else {
+ if (strcmp(rule->variant,
+ mdefs->variant[rule->variant_num]) != 0)
+ return 0;
+ }
+ }
}
if (pending) {
- rule->flags|= XkbRF_PendingMatch;
- return rule->number;
+ rule->flags |= XkbRF_PendingMatch;
+ return rule->number;
}
/* exact match, apply it now */
- XkbRF_ApplyRule(rule,names);
+ XkbRF_ApplyRule(rule, names);
return rule->number;
}
static void
XkbRF_ClearPartialMatches(XkbRF_RulesPtr rules)
{
-register int i;
-XkbRF_RulePtr rule;
+ register int i;
+ XkbRF_RulePtr rule;
- for (i=0,rule=rules->rules;i<rules->num_rules;i++,rule++) {
- rule->flags&= ~XkbRF_PendingMatch;
+ for (i = 0, rule = rules->rules; i < rules->num_rules; i++, rule++) {
+ rule->flags &= ~XkbRF_PendingMatch;
}
}
static void
-XkbRF_ApplyPartialMatches(XkbRF_RulesPtr rules,XkbComponentNamesPtr names)
+XkbRF_ApplyPartialMatches(XkbRF_RulesPtr rules, XkbComponentNamesPtr names)
{
-int i;
-XkbRF_RulePtr rule;
+ int i;
+ XkbRF_RulePtr rule;
for (rule = rules->rules, i = 0; i < rules->num_rules; i++, rule++) {
- if ((rule->flags&XkbRF_PendingMatch)==0)
- continue;
- XkbRF_ApplyRule(rule,names);
+ if ((rule->flags & XkbRF_PendingMatch) == 0)
+ continue;
+ XkbRF_ApplyRule(rule, names);
}
}
static void
-XkbRF_CheckApplyRules( XkbRF_RulesPtr rules,
- XkbRF_MultiDefsPtr mdefs,
- XkbComponentNamesPtr names,
- int flags)
+XkbRF_CheckApplyRules(XkbRF_RulesPtr rules,
+ XkbRF_MultiDefsPtr mdefs,
+ XkbComponentNamesPtr names, int flags)
{
-int i;
-XkbRF_RulePtr rule;
-int skip;
-
- for (rule = rules->rules, i=0; i < rules->num_rules; rule++, i++) {
- if ((rule->flags & flags) != flags)
- continue;
- skip = XkbRF_CheckApplyRule(rule, mdefs, names, rules);
- if (skip && !(flags & XkbRF_Option)) {
- for ( ;(i < rules->num_rules) && (rule->number == skip);
- rule++, i++);
- rule--; i--;
- }
+ int i;
+ XkbRF_RulePtr rule;
+ int skip;
+
+ for (rule = rules->rules, i = 0; i < rules->num_rules; rule++, i++) {
+ if ((rule->flags & flags) != flags)
+ continue;
+ skip = XkbRF_CheckApplyRule(rule, mdefs, names, rules);
+ if (skip && !(flags & XkbRF_Option)) {
+ for (; (i < rules->num_rules) && (rule->number == skip);
+ rule++, i++);
+ rule--;
+ i--;
+ }
}
}
@@ -732,108 +747,117 @@ int skip;
static char *
XkbRF_SubstituteVars(char *name, XkbRF_MultiDefsPtr mdefs)
{
-char *str, *outstr, *orig, *var;
-int len, ndx;
-
- orig= name;
- str= index(name,'%');
- if (str==NULL)
- return name;
- len= strlen(name);
- while (str!=NULL) {
- char pfx= str[1];
- int extra_len= 0;
- if ((pfx=='+')||(pfx=='|')||(pfx=='_')||(pfx=='-')) {
- extra_len= 1;
- str++;
- }
- else if (pfx=='(') {
- extra_len= 2;
- str++;
- }
- var = str + 1;
- str = get_index(var + 1, &ndx);
- if (ndx == -1) {
- str = index(str,'%');
- continue;
- }
- if ((*var=='l') && mdefs->layout[ndx] && *mdefs->layout[ndx])
- len+= strlen(mdefs->layout[ndx])+extra_len;
- else if ((*var=='m')&&mdefs->model)
- len+= strlen(mdefs->model)+extra_len;
- else if ((*var=='v') && mdefs->variant[ndx] && *mdefs->variant[ndx])
- len+= strlen(mdefs->variant[ndx])+extra_len;
- if ((pfx=='(')&&(*str==')')) {
- str++;
- }
- str= index(&str[0],'%');
- }
- name= malloc(len+1);
- str= orig;
- outstr= name;
- while (*str!='\0') {
- if (str[0]=='%') {
- char pfx,sfx;
- str++;
- pfx= str[0];
- sfx= '\0';
- if ((pfx=='+')||(pfx=='|')||(pfx=='_')||(pfx=='-')) {
- str++;
- }
- else if (pfx=='(') {
- sfx= ')';
- str++;
- }
- else pfx= '\0';
-
- var = str;
- str = get_index(var + 1, &ndx);
- if (ndx == -1) {
- continue;
+ char *str, *outstr, *orig, *var;
+ int len, ndx;
+
+ orig = name;
+ str = index(name, '%');
+ if (str == NULL)
+ return name;
+ len = strlen(name);
+ while (str != NULL) {
+ char pfx = str[1];
+ int extra_len = 0;
+
+ if ((pfx == '+') || (pfx == '|') || (pfx == '_') || (pfx == '-')) {
+ extra_len = 1;
+ str++;
+ }
+ else if (pfx == '(') {
+ extra_len = 2;
+ str++;
+ }
+ var = str + 1;
+ str = get_index(var + 1, &ndx);
+ if (ndx == -1) {
+ str = index(str, '%');
+ continue;
+ }
+ if ((*var == 'l') && mdefs->layout[ndx] && *mdefs->layout[ndx])
+ len += strlen(mdefs->layout[ndx]) + extra_len;
+ else if ((*var == 'm') && mdefs->model)
+ len += strlen(mdefs->model) + extra_len;
+ else if ((*var == 'v') && mdefs->variant[ndx] && *mdefs->variant[ndx])
+ len += strlen(mdefs->variant[ndx]) + extra_len;
+ if ((pfx == '(') && (*str == ')')) {
+ str++;
+ }
+ str = index(&str[0], '%');
+ }
+ name = malloc(len + 1);
+ str = orig;
+ outstr = name;
+ while (*str != '\0') {
+ if (str[0] == '%') {
+ char pfx, sfx;
+
+ str++;
+ pfx = str[0];
+ sfx = '\0';
+ if ((pfx == '+') || (pfx == '|') || (pfx == '_') || (pfx == '-')) {
+ str++;
+ }
+ else if (pfx == '(') {
+ sfx = ')';
+ str++;
}
- if ((*var=='l') && mdefs->layout[ndx] && *mdefs->layout[ndx]) {
- if (pfx) *outstr++= pfx;
- strcpy(outstr,mdefs->layout[ndx]);
- outstr+= strlen(mdefs->layout[ndx]);
- if (sfx) *outstr++= sfx;
- }
- else if ((*var=='m')&&(mdefs->model)) {
- if (pfx) *outstr++= pfx;
- strcpy(outstr,mdefs->model);
- outstr+= strlen(mdefs->model);
- if (sfx) *outstr++= sfx;
- }
- else if ((*var=='v') && mdefs->variant[ndx] && *mdefs->variant[ndx]) {
- if (pfx) *outstr++= pfx;
- strcpy(outstr,mdefs->variant[ndx]);
- outstr+= strlen(mdefs->variant[ndx]);
- if (sfx) *outstr++= sfx;
- }
- if ((pfx=='(')&&(*str==')'))
- str++;
- }
- else {
- *outstr++= *str++;
- }
- }
- *outstr++= '\0';
- if (orig!=name)
- free(orig);
+ else
+ pfx = '\0';
+
+ var = str;
+ str = get_index(var + 1, &ndx);
+ if (ndx == -1) {
+ continue;
+ }
+ if ((*var == 'l') && mdefs->layout[ndx] && *mdefs->layout[ndx]) {
+ if (pfx)
+ *outstr++ = pfx;
+ strcpy(outstr, mdefs->layout[ndx]);
+ outstr += strlen(mdefs->layout[ndx]);
+ if (sfx)
+ *outstr++ = sfx;
+ }
+ else if ((*var == 'm') && (mdefs->model)) {
+ if (pfx)
+ *outstr++ = pfx;
+ strcpy(outstr, mdefs->model);
+ outstr += strlen(mdefs->model);
+ if (sfx)
+ *outstr++ = sfx;
+ }
+ else if ((*var == 'v') && mdefs->variant[ndx] &&
+ *mdefs->variant[ndx]) {
+ if (pfx)
+ *outstr++ = pfx;
+ strcpy(outstr, mdefs->variant[ndx]);
+ outstr += strlen(mdefs->variant[ndx]);
+ if (sfx)
+ *outstr++ = sfx;
+ }
+ if ((pfx == '(') && (*str == ')'))
+ str++;
+ }
+ else {
+ *outstr++ = *str++;
+ }
+ }
+ *outstr++ = '\0';
+ if (orig != name)
+ free(orig);
return name;
}
/***====================================================================***/
Bool
-XkbRF_GetComponents( XkbRF_RulesPtr rules,
- XkbRF_VarDefsPtr defs,
- XkbComponentNamesPtr names)
+XkbRF_GetComponents(XkbRF_RulesPtr rules,
+ XkbRF_VarDefsPtr defs, XkbComponentNamesPtr names)
{
XkbRF_MultiDefsRec mdefs;
MakeMultiDefs(&mdefs, defs);
- memset((char *)names, 0, sizeof(XkbComponentNamesRec));
+ memset((char *) names, 0, sizeof(XkbComponentNamesRec));
XkbRF_ClearPartialMatches(rules);
XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Normal);
XkbRF_ApplyPartialMatches(rules, names);
@@ -842,125 +866,127 @@ XkbRF_GetComponents( XkbRF_RulesPtr rules,
XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Option);
if (names->keycodes)
- names->keycodes= XkbRF_SubstituteVars(names->keycodes, &mdefs);
- if (names->symbols)
- names->symbols= XkbRF_SubstituteVars(names->symbols, &mdefs);
+ names->keycodes = XkbRF_SubstituteVars(names->keycodes, &mdefs);
+ if (names->symbols)
+ names->symbols = XkbRF_SubstituteVars(names->symbols, &mdefs);
if (names->types)
- names->types= XkbRF_SubstituteVars(names->types, &mdefs);
+ names->types = XkbRF_SubstituteVars(names->types, &mdefs);
if (names->compat)
- names->compat= XkbRF_SubstituteVars(names->compat, &mdefs);
+ names->compat = XkbRF_SubstituteVars(names->compat, &mdefs);
if (names->geometry)
- names->geometry= XkbRF_SubstituteVars(names->geometry, &mdefs);
+ names->geometry = XkbRF_SubstituteVars(names->geometry, &mdefs);
FreeMultiDefs(&mdefs);
return (names->keycodes && names->symbols && names->types &&
- names->compat && names->geometry);
+ names->compat && names->geometry);
}
static XkbRF_RulePtr
-XkbRF_AddRule(XkbRF_RulesPtr rules)
+XkbRF_AddRule(XkbRF_RulesPtr rules)
{
- if (rules->sz_rules<1) {
- rules->sz_rules= 16;
- rules->num_rules= 0;
- rules->rules= calloc(rules->sz_rules, sizeof(XkbRF_RuleRec));
+ if (rules->sz_rules < 1) {
+ rules->sz_rules = 16;
+ rules->num_rules = 0;
+ rules->rules = calloc(rules->sz_rules, sizeof(XkbRF_RuleRec));
}
- else if (rules->num_rules>=rules->sz_rules) {
- rules->sz_rules*= 2;
- rules->rules= realloc(rules->rules,
- rules->sz_rules * sizeof(XkbRF_RuleRec));
+ else if (rules->num_rules >= rules->sz_rules) {
+ rules->sz_rules *= 2;
+ rules->rules = realloc(rules->rules,
+ rules->sz_rules * sizeof(XkbRF_RuleRec));
}
if (!rules->rules) {
- rules->sz_rules= rules->num_rules= 0;
- DebugF("Allocation failure in XkbRF_AddRule\n");
- return NULL;
+ rules->sz_rules = rules->num_rules = 0;
+ DebugF("Allocation failure in XkbRF_AddRule\n");
+ return NULL;
}
- memset((char *)&rules->rules[rules->num_rules], 0, sizeof(XkbRF_RuleRec));
+ memset((char *) &rules->rules[rules->num_rules], 0, sizeof(XkbRF_RuleRec));
return &rules->rules[rules->num_rules++];
}
static XkbRF_GroupPtr
-XkbRF_AddGroup(XkbRF_RulesPtr rules)
+XkbRF_AddGroup(XkbRF_RulesPtr rules)
{
- if (rules->sz_groups<1) {
- rules->sz_groups= 16;
- rules->num_groups= 0;
- rules->groups= calloc(rules->sz_groups, sizeof(XkbRF_GroupRec));
+ if (rules->sz_groups < 1) {
+ rules->sz_groups = 16;
+ rules->num_groups = 0;
+ rules->groups = calloc(rules->sz_groups, sizeof(XkbRF_GroupRec));
}
else if (rules->num_groups >= rules->sz_groups) {
- rules->sz_groups *= 2;
- rules->groups= realloc(rules->groups,
- rules->sz_groups * sizeof(XkbRF_GroupRec));
+ rules->sz_groups *= 2;
+ rules->groups = realloc(rules->groups,
+ rules->sz_groups * sizeof(XkbRF_GroupRec));
}
if (!rules->groups) {
- rules->sz_groups= rules->num_groups= 0;
- return NULL;
+ rules->sz_groups = rules->num_groups = 0;
+ return NULL;
}
- memset((char *)&rules->groups[rules->num_groups], 0, sizeof(XkbRF_GroupRec));
+ memset((char *) &rules->groups[rules->num_groups], 0,
+ sizeof(XkbRF_GroupRec));
return &rules->groups[rules->num_groups++];
}
Bool
-XkbRF_LoadRules(FILE *file, XkbRF_RulesPtr rules)
+XkbRF_LoadRules(FILE * file, XkbRF_RulesPtr rules)
{
-InputLine line;
-RemapSpec remap;
-XkbRF_RuleRec trule,*rule;
-XkbRF_GroupRec tgroup,*group;
+ InputLine line;
+ RemapSpec remap;
+ XkbRF_RuleRec trule, *rule;
+ XkbRF_GroupRec tgroup, *group;
if (!(rules && file))
- return FALSE;
- memset((char *)&remap, 0, sizeof(RemapSpec));
- memset((char *)&tgroup, 0, sizeof(XkbRF_GroupRec));
+ return FALSE;
+ memset((char *) &remap, 0, sizeof(RemapSpec));
+ memset((char *) &tgroup, 0, sizeof(XkbRF_GroupRec));
InitInputLine(&line);
- while (GetInputLine(file,&line,TRUE)) {
- if (CheckLine(&line,&remap,&trule,&tgroup)) {
+ while (GetInputLine(file, &line, TRUE)) {
+ if (CheckLine(&line, &remap, &trule, &tgroup)) {
if (tgroup.number) {
- if ((group= XkbRF_AddGroup(rules))!=NULL) {
- *group= tgroup;
- memset((char *)&tgroup, 0, sizeof(XkbRF_GroupRec));
- }
- } else {
- if ((rule= XkbRF_AddRule(rules))!=NULL) {
- *rule= trule;
- memset((char *)&trule, 0, sizeof(XkbRF_RuleRec));
- }
- }
- }
- line.num_line= 0;
+ if ((group = XkbRF_AddGroup(rules)) != NULL) {
+ *group = tgroup;
+ memset((char *) &tgroup, 0, sizeof(XkbRF_GroupRec));
+ }
+ }
+ else {
+ if ((rule = XkbRF_AddRule(rules)) != NULL) {
+ *rule = trule;
+ memset((char *) &trule, 0, sizeof(XkbRF_RuleRec));
+ }
+ }
+ }
+ line.num_line = 0;
}
FreeInputLine(&line);
return TRUE;
}
Bool
-XkbRF_LoadRulesByName(char *base,char *locale,XkbRF_RulesPtr rules)
+XkbRF_LoadRulesByName(char *base, char *locale, XkbRF_RulesPtr rules)
{
-FILE * file;
-char buf[PATH_MAX];
-Bool ok;
+ FILE *file;
+ char buf[PATH_MAX];
+ Bool ok;
- if ((!base)||(!rules))
- return FALSE;
+ if ((!base) || (!rules))
+ return FALSE;
if (locale) {
- if (snprintf(buf, PATH_MAX, "%s-%s", base, locale) >= PATH_MAX)
- return FALSE;
+ if (snprintf(buf, PATH_MAX, "%s-%s", base, locale) >= PATH_MAX)
+ return FALSE;
}
else {
- if (strlen(base)+1 > PATH_MAX)
- return FALSE;
- strcpy(buf,base);
+ if (strlen(base) + 1 > PATH_MAX)
+ return FALSE;
+ strcpy(buf, base);
}
- file= fopen(buf, "r");
- if ((!file)&&(locale)) { /* fallback if locale was specified */
- strcpy(buf,base);
- file= fopen(buf, "r");
+ file = fopen(buf, "r");
+ if ((!file) && (locale)) { /* fallback if locale was specified */
+ strcpy(buf, base);
+ file = fopen(buf, "r");
}
if (!file)
- return FALSE;
- ok= XkbRF_LoadRules(file,rules);
+ return FALSE;
+ ok = XkbRF_LoadRules(file, rules);
fclose(file);
return ok;
}
@@ -970,48 +996,48 @@ Bool ok;
XkbRF_RulesPtr
XkbRF_Create(void)
{
- return calloc(1, sizeof( XkbRF_RulesRec));
+ return calloc(1, sizeof(XkbRF_RulesRec));
}
/***====================================================================***/
void
-XkbRF_Free(XkbRF_RulesPtr rules,Bool freeRules)
+XkbRF_Free(XkbRF_RulesPtr rules, Bool freeRules)
{
-int i;
-XkbRF_RulePtr rule;
-XkbRF_GroupPtr group;
+ int i;
+ XkbRF_RulePtr rule;
+ XkbRF_GroupPtr group;
if (!rules)
- return;
+ return;
if (rules->rules) {
- for (i=0,rule=rules->rules;i<rules->num_rules;i++,rule++) {
- free(rule->model);
- free(rule->layout);
- free(rule->variant);
- free(rule->option);
- free(rule->keycodes);
- free(rule->symbols);
- free(rule->types);
- free(rule->compat);
- free(rule->geometry);
- memset((char *)rule, 0, sizeof(XkbRF_RuleRec));
- }
- free(rules->rules);
- rules->num_rules= rules->sz_rules= 0;
- rules->rules= NULL;
+ for (i = 0, rule = rules->rules; i < rules->num_rules; i++, rule++) {
+ free(rule->model);
+ free(rule->layout);
+ free(rule->variant);
+ free(rule->option);
+ free(rule->keycodes);
+ free(rule->symbols);
+ free(rule->types);
+ free(rule->compat);
+ free(rule->geometry);
+ memset((char *) rule, 0, sizeof(XkbRF_RuleRec));
+ }
+ free(rules->rules);
+ rules->num_rules = rules->sz_rules = 0;
+ rules->rules = NULL;
}
if (rules->groups) {
- for (i=0, group=rules->groups;i<rules->num_groups;i++,group++) {
- free(group->name);
- free(group->words);
- }
- free(rules->groups);
- rules->num_groups= 0;
- rules->groups= NULL;
+ for (i = 0, group = rules->groups; i < rules->num_groups; i++, group++) {
+ free(group->name);
+ free(group->words);
+ }
+ free(rules->groups);
+ rules->num_groups = 0;
+ rules->groups = NULL;
}
if (freeRules)
- free(rules);
+ free(rules);
return;
}
diff --git a/xorg-server/xkb/xkb.c b/xorg-server/xkb/xkb.c
index 260f4a067..dc15e5de3 100644
--- a/xorg-server/xkb/xkb.c
+++ b/xorg-server/xkb/xkb.c
@@ -43,14 +43,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XI.h>
#include <X11/extensions/XKMformat.h>
-int XkbEventBase;
-static int XkbErrorBase;
-int XkbReqCode;
-int XkbKeyboardErrorCode;
-CARD32 xkbDebugFlags = 0;
-static CARD32 xkbDebugCtrls = 0;
+int XkbEventBase;
+static int XkbErrorBase;
+int XkbReqCode;
+int XkbKeyboardErrorCode;
+CARD32 xkbDebugFlags = 0;
+static CARD32 xkbDebugCtrls = 0;
-static RESTYPE RT_XKBCLIENT;
+static RESTYPE RT_XKBCLIENT;
/***====================================================================***/
@@ -157,28 +157,29 @@ int
ProcXkbUseExtension(ClientPtr client)
{
REQUEST(xkbUseExtensionReq);
- xkbUseExtensionReply rep;
- int supported;
+ xkbUseExtensionReply rep;
+ int supported;
REQUEST_SIZE_MATCH(xkbUseExtensionReq);
if (stuff->wantedMajor != SERVER_XKB_MAJOR_VERSION) {
- /* pre-release version 0.65 is compatible with 1.00 */
- supported= ((SERVER_XKB_MAJOR_VERSION==1)&&
- (stuff->wantedMajor==0)&&(stuff->wantedMinor==65));
+ /* pre-release version 0.65 is compatible with 1.00 */
+ supported = ((SERVER_XKB_MAJOR_VERSION == 1) &&
+ (stuff->wantedMajor == 0) && (stuff->wantedMinor == 65));
}
- else supported = 1;
+ else
+ supported = 1;
- if ((supported) && (!(client->xkbClientFlags&_XkbClientInitialized))) {
- client->xkbClientFlags= _XkbClientInitialized;
- client->vMajor= stuff->wantedMajor;
- client->vMinor= stuff->wantedMinor;
+ if ((supported) && (!(client->xkbClientFlags & _XkbClientInitialized))) {
+ client->xkbClientFlags = _XkbClientInitialized;
+ client->vMajor = stuff->wantedMajor;
+ client->vMinor = stuff->wantedMinor;
}
- else if (xkbDebugFlags&0x1) {
- ErrorF("[xkb] Rejecting client %d (0x%lx) (wants %d.%02d, have %d.%02d)\n",
- client->index,
- (long)client->clientAsMask,
- stuff->wantedMajor,stuff->wantedMinor,
- SERVER_XKB_MAJOR_VERSION,SERVER_XKB_MINOR_VERSION);
+ else if (xkbDebugFlags & 0x1) {
+ ErrorF
+ ("[xkb] Rejecting client %d (0x%lx) (wants %d.%02d, have %d.%02d)\n",
+ client->index, (long) client->clientAsMask, stuff->wantedMajor,
+ stuff->wantedMinor, SERVER_XKB_MAJOR_VERSION,
+ SERVER_XKB_MINOR_VERSION);
}
memset(&rep, 0, sizeof(xkbUseExtensionReply));
rep.type = X_Reply;
@@ -187,12 +188,12 @@ ProcXkbUseExtension(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.serverMajor = SERVER_XKB_MAJOR_VERSION;
rep.serverMinor = SERVER_XKB_MINOR_VERSION;
- if ( client->swapped ) {
- swaps(&rep.sequenceNumber);
- swaps(&rep.serverMajor);
- swaps(&rep.serverMinor);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.serverMajor);
+ swaps(&rep.serverMinor);
}
- WriteToClient(client,SIZEOF(xkbUseExtensionReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xkbUseExtensionReply), (char *) &rep);
return Success;
}
@@ -201,149 +202,158 @@ ProcXkbUseExtension(ClientPtr client)
int
ProcXkbSelectEvents(ClientPtr client)
{
- unsigned legal;
- DeviceIntPtr dev;
- XkbInterestPtr masks;
+ unsigned legal;
+ DeviceIntPtr dev;
+ XkbInterestPtr masks;
+
REQUEST(xkbSelectEventsReq);
REQUEST_AT_LEAST_SIZE(xkbSelectEventsReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixUseAccess);
- if (((stuff->affectWhich&XkbMapNotifyMask)!=0)&&(stuff->affectMap)) {
- client->mapNotifyMask&= ~stuff->affectMap;
- client->mapNotifyMask|= (stuff->affectMap&stuff->map);
+ if (((stuff->affectWhich & XkbMapNotifyMask) != 0) && (stuff->affectMap)) {
+ client->mapNotifyMask &= ~stuff->affectMap;
+ client->mapNotifyMask |= (stuff->affectMap & stuff->map);
}
- if ((stuff->affectWhich&(~XkbMapNotifyMask))==0)
- return Success;
+ if ((stuff->affectWhich & (~XkbMapNotifyMask)) == 0)
+ return Success;
+
+ masks = XkbFindClientResource((DevicePtr) dev, client);
+ if (!masks) {
+ XID id = FakeClientID(client->index);
- masks = XkbFindClientResource((DevicePtr)dev,client);
- if (!masks){
- XID id = FakeClientID(client->index);
- if (!AddResource(id,RT_XKBCLIENT,dev))
- return BadAlloc;
- masks= XkbAddClientResource((DevicePtr)dev,client,id);
+ if (!AddResource(id, RT_XKBCLIENT, dev))
+ return BadAlloc;
+ masks = XkbAddClientResource((DevicePtr) dev, client, id);
}
if (masks) {
- union {
- CARD8 *c8;
- CARD16 *c16;
- CARD32 *c32;
- } from,to;
- register unsigned bit,ndx,maskLeft,dataLeft,size;
-
- from.c8= (CARD8 *)&stuff[1];
- dataLeft= (stuff->length*4)-SIZEOF(xkbSelectEventsReq);
- maskLeft= (stuff->affectWhich&(~XkbMapNotifyMask));
- for (ndx=0,bit=1; (maskLeft!=0); ndx++, bit<<=1) {
- if ((bit&maskLeft)==0)
- continue;
- maskLeft&= ~bit;
- switch (ndx) {
- case XkbNewKeyboardNotify:
- to.c16= &client->newKeyboardNotifyMask;
- legal= XkbAllNewKeyboardEventsMask;
- size= 2;
- break;
- case XkbStateNotify:
- to.c16= &masks->stateNotifyMask;
- legal= XkbAllStateEventsMask;
- size= 2;
- break;
- case XkbControlsNotify:
- to.c32= &masks->ctrlsNotifyMask;
- legal= XkbAllControlEventsMask;
- size= 4;
- break;
- case XkbIndicatorStateNotify:
- to.c32= &masks->iStateNotifyMask;
- legal= XkbAllIndicatorEventsMask;
- size= 4;
- break;
- case XkbIndicatorMapNotify:
- to.c32= &masks->iMapNotifyMask;
- legal= XkbAllIndicatorEventsMask;
- size= 4;
- break;
- case XkbNamesNotify:
- to.c16= &masks->namesNotifyMask;
- legal= XkbAllNameEventsMask;
- size= 2;
- break;
- case XkbCompatMapNotify:
- to.c8= &masks->compatNotifyMask;
- legal= XkbAllCompatMapEventsMask;
- size= 1;
- break;
- case XkbBellNotify:
- to.c8= &masks->bellNotifyMask;
- legal= XkbAllBellEventsMask;
- size= 1;
- break;
- case XkbActionMessage:
- to.c8= &masks->actionMessageMask;
- legal= XkbAllActionMessagesMask;
- size= 1;
- break;
- case XkbAccessXNotify:
- to.c16= &masks->accessXNotifyMask;
- legal= XkbAllAccessXEventsMask;
- size= 2;
- break;
- case XkbExtensionDeviceNotify:
- to.c16= &masks->extDevNotifyMask;
- legal= XkbAllExtensionDeviceEventsMask;
- size= 2;
- break;
- default:
- client->errorValue = _XkbErrCode2(33,bit);
- return BadValue;
- }
-
- if (stuff->clear&bit) {
- if (size==2) to.c16[0]= 0;
- else if (size==4) to.c32[0]= 0;
- else to.c8[0]= 0;
- }
- else if (stuff->selectAll&bit) {
- if (size==2) to.c16[0]= ~0;
- else if (size==4) to.c32[0]= ~0;
- else to.c8[0]= ~0;
- }
- else {
- if (dataLeft<(size*2))
- return BadLength;
- if (size==2) {
- CHK_MASK_MATCH(ndx,from.c16[0],from.c16[1]);
- CHK_MASK_LEGAL(ndx,from.c16[0],legal);
- to.c16[0]&= ~from.c16[0];
- to.c16[0]|= (from.c16[0]&from.c16[1]);
- }
- else if (size==4) {
- CHK_MASK_MATCH(ndx,from.c32[0],from.c32[1]);
- CHK_MASK_LEGAL(ndx,from.c32[0],legal);
- to.c32[0]&= ~from.c32[0];
- to.c32[0]|= (from.c32[0]&from.c32[1]);
- }
- else {
- CHK_MASK_MATCH(ndx,from.c8[0],from.c8[1]);
- CHK_MASK_LEGAL(ndx,from.c8[0],legal);
- to.c8[0]&= ~from.c8[0];
- to.c8[0]|= (from.c8[0]&from.c8[1]);
- size= 2;
- }
- from.c8+= (size*2);
- dataLeft-= (size*2);
- }
- }
- if (dataLeft>2) {
- ErrorF("[xkb] Extra data (%d bytes) after SelectEvents\n",dataLeft);
- return BadLength;
- }
- return Success;
+ union {
+ CARD8 *c8;
+ CARD16 *c16;
+ CARD32 *c32;
+ } from, to;
+ register unsigned bit, ndx, maskLeft, dataLeft, size;
+
+ from.c8 = (CARD8 *) &stuff[1];
+ dataLeft = (stuff->length * 4) - SIZEOF(xkbSelectEventsReq);
+ maskLeft = (stuff->affectWhich & (~XkbMapNotifyMask));
+ for (ndx = 0, bit = 1; (maskLeft != 0); ndx++, bit <<= 1) {
+ if ((bit & maskLeft) == 0)
+ continue;
+ maskLeft &= ~bit;
+ switch (ndx) {
+ case XkbNewKeyboardNotify:
+ to.c16 = &client->newKeyboardNotifyMask;
+ legal = XkbAllNewKeyboardEventsMask;
+ size = 2;
+ break;
+ case XkbStateNotify:
+ to.c16 = &masks->stateNotifyMask;
+ legal = XkbAllStateEventsMask;
+ size = 2;
+ break;
+ case XkbControlsNotify:
+ to.c32 = &masks->ctrlsNotifyMask;
+ legal = XkbAllControlEventsMask;
+ size = 4;
+ break;
+ case XkbIndicatorStateNotify:
+ to.c32 = &masks->iStateNotifyMask;
+ legal = XkbAllIndicatorEventsMask;
+ size = 4;
+ break;
+ case XkbIndicatorMapNotify:
+ to.c32 = &masks->iMapNotifyMask;
+ legal = XkbAllIndicatorEventsMask;
+ size = 4;
+ break;
+ case XkbNamesNotify:
+ to.c16 = &masks->namesNotifyMask;
+ legal = XkbAllNameEventsMask;
+ size = 2;
+ break;
+ case XkbCompatMapNotify:
+ to.c8 = &masks->compatNotifyMask;
+ legal = XkbAllCompatMapEventsMask;
+ size = 1;
+ break;
+ case XkbBellNotify:
+ to.c8 = &masks->bellNotifyMask;
+ legal = XkbAllBellEventsMask;
+ size = 1;
+ break;
+ case XkbActionMessage:
+ to.c8 = &masks->actionMessageMask;
+ legal = XkbAllActionMessagesMask;
+ size = 1;
+ break;
+ case XkbAccessXNotify:
+ to.c16 = &masks->accessXNotifyMask;
+ legal = XkbAllAccessXEventsMask;
+ size = 2;
+ break;
+ case XkbExtensionDeviceNotify:
+ to.c16 = &masks->extDevNotifyMask;
+ legal = XkbAllExtensionDeviceEventsMask;
+ size = 2;
+ break;
+ default:
+ client->errorValue = _XkbErrCode2(33, bit);
+ return BadValue;
+ }
+
+ if (stuff->clear & bit) {
+ if (size == 2)
+ to.c16[0] = 0;
+ else if (size == 4)
+ to.c32[0] = 0;
+ else
+ to.c8[0] = 0;
+ }
+ else if (stuff->selectAll & bit) {
+ if (size == 2)
+ to.c16[0] = ~0;
+ else if (size == 4)
+ to.c32[0] = ~0;
+ else
+ to.c8[0] = ~0;
+ }
+ else {
+ if (dataLeft < (size * 2))
+ return BadLength;
+ if (size == 2) {
+ CHK_MASK_MATCH(ndx, from.c16[0], from.c16[1]);
+ CHK_MASK_LEGAL(ndx, from.c16[0], legal);
+ to.c16[0] &= ~from.c16[0];
+ to.c16[0] |= (from.c16[0] & from.c16[1]);
+ }
+ else if (size == 4) {
+ CHK_MASK_MATCH(ndx, from.c32[0], from.c32[1]);
+ CHK_MASK_LEGAL(ndx, from.c32[0], legal);
+ to.c32[0] &= ~from.c32[0];
+ to.c32[0] |= (from.c32[0] & from.c32[1]);
+ }
+ else {
+ CHK_MASK_MATCH(ndx, from.c8[0], from.c8[1]);
+ CHK_MASK_LEGAL(ndx, from.c8[0], legal);
+ to.c8[0] &= ~from.c8[0];
+ to.c8[0] |= (from.c8[0] & from.c8[1]);
+ size = 2;
+ }
+ from.c8 += (size * 2);
+ dataLeft -= (size * 2);
+ }
+ }
+ if (dataLeft > 2) {
+ ErrorF("[xkb] Extra data (%d bytes) after SelectEvents\n",
+ dataLeft);
+ return BadLength;
+ }
+ return Success;
}
return BadAlloc;
}
@@ -357,67 +367,73 @@ _XkbBell(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin,
int bellClass, int bellID, int pitch, int duration,
int percent, int forceSound, int eventOnly, Atom name)
{
- int base;
- pointer ctrl;
- int oldPitch, oldDuration;
- int newPercent;
+ int base;
+ pointer ctrl;
+ int oldPitch, oldDuration;
+ int newPercent;
if (bellClass == KbdFeedbackClass) {
- KbdFeedbackPtr k;
- if (bellID==XkbDfltXIId)
- k= dev->kbdfeed;
+ KbdFeedbackPtr k;
+
+ if (bellID == XkbDfltXIId)
+ k = dev->kbdfeed;
else {
- for (k=dev->kbdfeed; k; k=k->next) {
+ for (k = dev->kbdfeed; k; k = k->next) {
if (k->ctrl.id == bellID)
break;
}
}
if (!k) {
- client->errorValue = _XkbErrCode2(0x5,bellID);
+ client->errorValue = _XkbErrCode2(0x5, bellID);
return BadValue;
}
base = k->ctrl.bell;
ctrl = (pointer) &(k->ctrl);
- oldPitch= k->ctrl.bell_pitch;
- oldDuration= k->ctrl.bell_duration;
- if (pitch!=0) {
- if (pitch==-1)
- k->ctrl.bell_pitch= defaultKeyboardControl.bell_pitch;
- else k->ctrl.bell_pitch= pitch;
+ oldPitch = k->ctrl.bell_pitch;
+ oldDuration = k->ctrl.bell_duration;
+ if (pitch != 0) {
+ if (pitch == -1)
+ k->ctrl.bell_pitch = defaultKeyboardControl.bell_pitch;
+ else
+ k->ctrl.bell_pitch = pitch;
}
- if (duration!=0) {
- if (duration==-1)
- k->ctrl.bell_duration= defaultKeyboardControl.bell_duration;
- else k->ctrl.bell_duration= duration;
+ if (duration != 0) {
+ if (duration == -1)
+ k->ctrl.bell_duration = defaultKeyboardControl.bell_duration;
+ else
+ k->ctrl.bell_duration = duration;
}
}
else if (bellClass == BellFeedbackClass) {
- BellFeedbackPtr b;
- if (bellID==XkbDfltXIId)
- b= dev->bell;
+ BellFeedbackPtr b;
+
+ if (bellID == XkbDfltXIId)
+ b = dev->bell;
else {
- for (b=dev->bell; b; b=b->next) {
+ for (b = dev->bell; b; b = b->next) {
if (b->ctrl.id == bellID)
break;
}
}
if (!b) {
- client->errorValue = _XkbErrCode2(0x6,bellID);
+ client->errorValue = _XkbErrCode2(0x6, bellID);
return BadValue;
}
base = b->ctrl.percent;
ctrl = (pointer) &(b->ctrl);
- oldPitch= b->ctrl.pitch;
- oldDuration= b->ctrl.duration;
- if (pitch!=0) {
- if (pitch==-1)
- b->ctrl.pitch= defaultKeyboardControl.bell_pitch;
- else b->ctrl.pitch= pitch;
+ oldPitch = b->ctrl.pitch;
+ oldDuration = b->ctrl.duration;
+ if (pitch != 0) {
+ if (pitch == -1)
+ b->ctrl.pitch = defaultKeyboardControl.bell_pitch;
+ else
+ b->ctrl.pitch = pitch;
}
- if (duration!=0) {
- if (duration==-1)
- b->ctrl.duration= defaultKeyboardControl.bell_duration;
- else b->ctrl.duration= duration;
+ if (duration != 0) {
+ if (duration == -1)
+ b->ctrl.duration = defaultKeyboardControl.bell_duration;
+ else
+ b->ctrl.duration = duration;
}
}
else {
@@ -425,30 +441,32 @@ _XkbBell(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin,
return BadValue;
}
- newPercent = (base * percent)/100;
+ newPercent = (base * percent) / 100;
if (percent < 0)
- newPercent = base + newPercent;
- else newPercent = base - newPercent + percent;
+ newPercent = base + newPercent;
+ else
+ newPercent = base - newPercent + percent;
XkbHandleBell(forceSound, eventOnly,
- dev, newPercent, ctrl, bellClass,
- name, pWin, client);
- if ((pitch!=0)||(duration!=0)) {
+ dev, newPercent, ctrl, bellClass, name, pWin, client);
+ if ((pitch != 0) || (duration != 0)) {
if (bellClass == KbdFeedbackClass) {
- KbdFeedbackPtr k;
- k= (KbdFeedbackPtr)ctrl;
- if (pitch!=0)
- k->ctrl.bell_pitch= oldPitch;
- if (duration!=0)
- k->ctrl.bell_duration= oldDuration;
+ KbdFeedbackPtr k;
+
+ k = (KbdFeedbackPtr) ctrl;
+ if (pitch != 0)
+ k->ctrl.bell_pitch = oldPitch;
+ if (duration != 0)
+ k->ctrl.bell_duration = oldDuration;
}
else {
- BellFeedbackPtr b;
- b= (BellFeedbackPtr)ctrl;
- if (pitch!=0)
- b->ctrl.pitch= oldPitch;
- if (duration!=0)
- b->ctrl.duration= oldDuration;
+ BellFeedbackPtr b;
+
+ b = (BellFeedbackPtr) ctrl;
+ if (pitch != 0)
+ b->ctrl.pitch = oldPitch;
+ if (duration != 0)
+ b->ctrl.duration = oldDuration;
}
}
@@ -460,49 +478,52 @@ ProcXkbBell(ClientPtr client)
{
REQUEST(xkbBellReq);
DeviceIntPtr dev;
- WindowPtr pWin;
+ WindowPtr pWin;
int rc;
REQUEST_SIZE_MATCH(xkbBellReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_BELL_DEVICE(dev, stuff->deviceSpec, client, DixBellAccess);
CHK_ATOM_OR_NONE(stuff->name);
/* device-independent checks request for sane values */
- if ((stuff->forceSound)&&(stuff->eventOnly)) {
- client->errorValue=_XkbErrCode3(0x1,stuff->forceSound,stuff->eventOnly);
- return BadMatch;
+ if ((stuff->forceSound) && (stuff->eventOnly)) {
+ client->errorValue =
+ _XkbErrCode3(0x1, stuff->forceSound, stuff->eventOnly);
+ return BadMatch;
}
if (stuff->percent < -100 || stuff->percent > 100) {
- client->errorValue = _XkbErrCode2(0x2,stuff->percent);
- return BadValue;
+ client->errorValue = _XkbErrCode2(0x2, stuff->percent);
+ return BadValue;
}
- if (stuff->duration<-1) {
- client->errorValue = _XkbErrCode2(0x3,stuff->duration);
- return BadValue;
+ if (stuff->duration < -1) {
+ client->errorValue = _XkbErrCode2(0x3, stuff->duration);
+ return BadValue;
}
- if (stuff->pitch<-1) {
- client->errorValue = _XkbErrCode2(0x4,stuff->pitch);
- return BadValue;
+ if (stuff->pitch < -1) {
+ client->errorValue = _XkbErrCode2(0x4, stuff->pitch);
+ return BadValue;
}
if (stuff->bellClass == XkbDfltXIClass) {
- if (dev->kbdfeed!=NULL)
- stuff->bellClass= KbdFeedbackClass;
- else stuff->bellClass= BellFeedbackClass;
+ if (dev->kbdfeed != NULL)
+ stuff->bellClass = KbdFeedbackClass;
+ else
+ stuff->bellClass = BellFeedbackClass;
}
- if (stuff->window!=None) {
- rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
- if (rc != Success) {
- client->errorValue= stuff->window;
- return rc;
- }
+ if (stuff->window != None) {
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
}
- else pWin= NULL;
+ else
+ pWin = NULL;
/* Client wants to ring a bell on the core keyboard?
Ring the bell on the core keyboard (which does nothing, but if that
@@ -518,13 +539,12 @@ ProcXkbBell(ClientPtr client)
stuff->forceSound, stuff->eventOnly, stuff->name);
if ((rc == Success) && ((stuff->deviceSpec == XkbUseCoreKbd) ||
- (stuff->deviceSpec == XkbUseCorePtr)))
- {
+ (stuff->deviceSpec == XkbUseCorePtr))) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
- {
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && other->key && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) {
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixBellAccess);
if (rc == Success)
_XkbBell(client, other, pWin, stuff->bellClass,
@@ -533,7 +553,7 @@ ProcXkbBell(ClientPtr client)
stuff->eventOnly, stuff->name);
}
}
- rc = Success; /* reset to success, that's what we got for the VCK */
+ rc = Success; /* reset to success, that's what we got for the VCK */
}
return rc;
@@ -545,21 +565,21 @@ int
ProcXkbGetState(ClientPtr client)
{
REQUEST(xkbGetStateReq);
- DeviceIntPtr dev;
- xkbGetStateReply rep;
- XkbStateRec *xkb;
+ DeviceIntPtr dev;
+ xkbGetStateReply rep;
+ XkbStateRec *xkb;
REQUEST_SIZE_MATCH(xkbGetStateReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
- xkb= &dev->key->xkbInfo->state;
+ xkb = &dev->key->xkbInfo->state;
memset(&rep, 0, sizeof(xkbGetStateReply));
- rep.type= X_Reply;
- rep.sequenceNumber= client->sequence;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.deviceID = dev->id;
rep.mods = XkbStateFieldFromRec(xkb) & 0xff;
@@ -573,10 +593,10 @@ ProcXkbGetState(ClientPtr client)
rep.compatState = xkb->compat_state;
rep.ptrBtnState = xkb->ptr_buttons;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swaps(&rep.ptrBtnState);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.ptrBtnState);
}
- WriteToClient(client, SIZEOF(xkbGetStateReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xkbGetStateReply), (char *) &rep);
return Success;
}
@@ -587,7 +607,7 @@ ProcXkbLatchLockState(ClientPtr client)
{
int status;
DeviceIntPtr dev, tmpd;
- XkbStateRec oldState,*newState;
+ XkbStateRec oldState, *newState;
CARD16 changed;
xkbStateNotify sn;
XkbEventCauseRec cause;
@@ -596,7 +616,7 @@ ProcXkbLatchLockState(ClientPtr client)
REQUEST_SIZE_MATCH(xkbLatchLockStateReq);
if (!(client->xkbClientFlags & _XkbClientInitialized))
- return BadAccess;
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
CHK_MASK_MATCH(0x01, stuff->affectModLocks, stuff->modLocks);
@@ -605,7 +625,8 @@ ProcXkbLatchLockState(ClientPtr client)
status = Success;
for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
- if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) {
+ if ((tmpd == dev) ||
+ (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) {
if (!tmpd->key || !tmpd->key->xkbInfo)
continue;
@@ -613,7 +634,8 @@ ProcXkbLatchLockState(ClientPtr client)
newState = &tmpd->key->xkbInfo->state;
if (stuff->affectModLocks) {
newState->locked_mods &= ~stuff->affectModLocks;
- newState->locked_mods |= (stuff->affectModLocks & stuff->modLocks);
+ newState->locked_mods |=
+ (stuff->affectModLocks & stuff->modLocks);
}
if (status == Success && stuff->lockGroup)
newState->locked_group = stuff->groupLock;
@@ -640,7 +662,7 @@ ProcXkbLatchLockState(ClientPtr client)
if (changed) {
XkbSetCauseXkbReq(&cause, X_kbLatchLockState, client);
XkbUpdateIndicators(tmpd, changed, TRUE, NULL, &cause);
- }
+ }
}
}
}
@@ -654,23 +676,23 @@ int
ProcXkbGetControls(ClientPtr client)
{
xkbGetControlsReply rep;
- XkbControlsPtr xkb;
- DeviceIntPtr dev;
+ XkbControlsPtr xkb;
+ DeviceIntPtr dev;
REQUEST(xkbGetControlsReq);
REQUEST_SIZE_MATCH(xkbGetControlsReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
-
+
xkb = dev->key->xkbInfo->desc->ctrls;
rep.type = X_Reply;
- rep.length = bytes_to_int32(SIZEOF(xkbGetControlsReply)-
- SIZEOF(xGenericReply));
+ rep.length = bytes_to_int32(SIZEOF(xkbGetControlsReply) -
+ SIZEOF(xGenericReply));
rep.sequenceNumber = client->sequence;
- rep.deviceID = ((DeviceIntPtr)dev)->id;
+ rep.deviceID = ((DeviceIntPtr) dev)->id;
rep.numGroups = xkb->num_groups;
rep.groupsWrap = xkb->groups_wrap;
rep.internalMods = xkb->internal.mask;
@@ -696,49 +718,49 @@ ProcXkbGetControls(ClientPtr client)
rep.axtOptsMask = xkb->axt_opts_mask;
rep.axtOptsValues = xkb->axt_opts_values;
rep.axOptions = xkb->ax_options;
- memcpy(rep.perKeyRepeat,xkb->per_key_repeat,XkbPerKeyBitArraySize);
+ memcpy(rep.perKeyRepeat, xkb->per_key_repeat, XkbPerKeyBitArraySize);
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.internalVMods);
- swaps(&rep.ignoreLockVMods);
- swapl(&rep.enabledCtrls);
- swaps(&rep.repeatDelay);
- swaps(&rep.repeatInterval);
- swaps(&rep.slowKeysDelay);
- swaps(&rep.debounceDelay);
- swaps(&rep.mkDelay);
- swaps(&rep.mkInterval);
- swaps(&rep.mkTimeToMax);
- swaps(&rep.mkMaxSpeed);
- swaps(&rep.mkCurve);
- swaps(&rep.axTimeout);
- swapl(&rep.axtCtrlsMask);
- swapl(&rep.axtCtrlsValues);
- swaps(&rep.axtOptsMask);
- swaps(&rep.axtOptsValues);
- swaps(&rep.axOptions);
- }
- WriteToClient(client, SIZEOF(xkbGetControlsReply), (char *)&rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.internalVMods);
+ swaps(&rep.ignoreLockVMods);
+ swapl(&rep.enabledCtrls);
+ swaps(&rep.repeatDelay);
+ swaps(&rep.repeatInterval);
+ swaps(&rep.slowKeysDelay);
+ swaps(&rep.debounceDelay);
+ swaps(&rep.mkDelay);
+ swaps(&rep.mkInterval);
+ swaps(&rep.mkTimeToMax);
+ swaps(&rep.mkMaxSpeed);
+ swaps(&rep.mkCurve);
+ swaps(&rep.axTimeout);
+ swapl(&rep.axtCtrlsMask);
+ swapl(&rep.axtCtrlsValues);
+ swaps(&rep.axtOptsMask);
+ swaps(&rep.axtOptsValues);
+ swaps(&rep.axOptions);
+ }
+ WriteToClient(client, SIZEOF(xkbGetControlsReply), (char *) &rep);
return Success;
}
int
ProcXkbSetControls(ClientPtr client)
{
- DeviceIntPtr dev, tmpd;
- XkbSrvInfoPtr xkbi;
- XkbControlsPtr ctrl;
- XkbControlsRec new,old;
- xkbControlsNotify cn;
- XkbEventCauseRec cause;
- XkbSrvLedInfoPtr sli;
+ DeviceIntPtr dev, tmpd;
+ XkbSrvInfoPtr xkbi;
+ XkbControlsPtr ctrl;
+ XkbControlsRec new, old;
+ xkbControlsNotify cn;
+ XkbEventCauseRec cause;
+ XkbSrvLedInfoPtr sli;
REQUEST(xkbSetControlsReq);
REQUEST_SIZE_MATCH(xkbSetControlsReq);
if (!(client->xkbClientFlags & _XkbClientInitialized))
- return BadAccess;
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
CHK_MASK_LEGAL(0x01, stuff->changeCtrls, XkbAllControlsMask);
@@ -746,7 +768,8 @@ ProcXkbSetControls(ClientPtr client)
for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
if (!tmpd->key || !tmpd->key->xkbInfo)
continue;
- if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) {
+ if ((tmpd == dev) ||
+ (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) {
xkbi = tmpd->key->xkbInfo;
ctrl = xkbi->desc->ctrls;
new = *ctrl;
@@ -765,8 +788,7 @@ ProcXkbSetControls(ClientPtr client)
new.internal.vmods |= (stuff->affectInternalVMods &
stuff->internalVMods);
new.internal.mask = new.internal.real_mods |
- XkbMaskForVMask(xkbi->desc,
- new.internal.vmods);
+ XkbMaskForVMask(xkbi->desc, new.internal.vmods);
}
if (stuff->changeCtrls & XkbIgnoreLockModsMask) {
@@ -782,8 +804,7 @@ ProcXkbSetControls(ClientPtr client)
new.ignore_lock.vmods |= (stuff->affectIgnoreLockVMods &
stuff->ignoreLockVMods);
new.ignore_lock.mask = new.ignore_lock.real_mods |
- XkbMaskForVMask(xkbi->desc,
- new.ignore_lock.vmods);
+ XkbMaskForVMask(xkbi->desc, new.ignore_lock.vmods);
}
CHK_MASK_MATCH(0x06, stuff->affectEnabledCtrls,
@@ -841,7 +862,7 @@ ProcXkbSetControls(ClientPtr client)
if (stuff->mkDelay < 1 || stuff->mkInterval < 1 ||
stuff->mkTimeToMax < 1 || stuff->mkMaxSpeed < 1 ||
stuff->mkCurve < -1000) {
- client->errorValue = _XkbErrCode2(0x0C,0);
+ client->errorValue = _XkbErrCode2(0x0C, 0);
return BadValue;
}
@@ -873,7 +894,7 @@ ProcXkbSetControls(ClientPtr client)
return BadValue;
}
- new.groups_wrap= stuff->groupsWrap;
+ new.groups_wrap = stuff->groupsWrap;
}
CHK_MASK_LEGAL(0x0F, stuff->axOptions, XkbAX_AllOptionsMask);
@@ -885,7 +906,7 @@ ProcXkbSetControls(ClientPtr client)
new.ax_options &= ~(XkbAX_SKOptionsMask);
new.ax_options |= (stuff->axOptions & XkbAX_SKOptionsMask);
}
-
+
if (stuff->changeCtrls & XkbAccessXFeedbackMask) {
new.ax_options &= ~(XkbAX_FBOptionsMask);
new.ax_options |= (stuff->axOptions & XkbAX_FBOptionsMask);
@@ -921,8 +942,8 @@ ProcXkbSetControls(ClientPtr client)
}
}
- old= *ctrl;
- *ctrl= new;
+ old = *ctrl;
+ *ctrl = new;
XkbDDXChangeControls(tmpd, &old, ctrl);
if (XkbComputeControlsNotify(tmpd, &old, ctrl, &cn, FALSE)) {
@@ -951,704 +972,725 @@ ProcXkbSetControls(ClientPtr client)
/***====================================================================***/
static int
-XkbSizeKeyTypes(XkbDescPtr xkb,xkbGetMapReply *rep)
+XkbSizeKeyTypes(XkbDescPtr xkb, xkbGetMapReply * rep)
{
- XkbKeyTypeRec *type;
- unsigned i,len;
-
- len= 0;
- if (((rep->present&XkbKeyTypesMask)==0)||(rep->nTypes<1)||
- (!xkb)||(!xkb->map)||(!xkb->map->types)) {
- rep->present&= ~XkbKeyTypesMask;
- rep->firstType= rep->nTypes= 0;
- return 0;
- }
- type= &xkb->map->types[rep->firstType];
- for (i=0;i<rep->nTypes;i++,type++){
- len+= SIZEOF(xkbKeyTypeWireDesc);
- if (type->map_count>0) {
- len+= (type->map_count*SIZEOF(xkbKTMapEntryWireDesc));
- if (type->preserve)
- len+= (type->map_count*SIZEOF(xkbModsWireDesc));
- }
+ XkbKeyTypeRec *type;
+ unsigned i, len;
+
+ len = 0;
+ if (((rep->present & XkbKeyTypesMask) == 0) || (rep->nTypes < 1) ||
+ (!xkb) || (!xkb->map) || (!xkb->map->types)) {
+ rep->present &= ~XkbKeyTypesMask;
+ rep->firstType = rep->nTypes = 0;
+ return 0;
+ }
+ type = &xkb->map->types[rep->firstType];
+ for (i = 0; i < rep->nTypes; i++, type++) {
+ len += SIZEOF(xkbKeyTypeWireDesc);
+ if (type->map_count > 0) {
+ len += (type->map_count * SIZEOF(xkbKTMapEntryWireDesc));
+ if (type->preserve)
+ len += (type->map_count * SIZEOF(xkbModsWireDesc));
+ }
}
return len;
}
static char *
-XkbWriteKeyTypes( XkbDescPtr xkb,
- xkbGetMapReply * rep,
- char * buf,
- ClientPtr client)
+XkbWriteKeyTypes(XkbDescPtr xkb,
+ xkbGetMapReply * rep, char *buf, ClientPtr client)
{
- XkbKeyTypePtr type;
- unsigned i;
+ XkbKeyTypePtr type;
+ unsigned i;
xkbKeyTypeWireDesc *wire;
- type= &xkb->map->types[rep->firstType];
- for (i=0;i<rep->nTypes;i++,type++) {
- register unsigned n;
- wire= (xkbKeyTypeWireDesc *)buf;
- wire->mask = type->mods.mask;
- wire->realMods = type->mods.real_mods;
- wire->virtualMods = type->mods.vmods;
- wire->numLevels = type->num_levels;
- wire->nMapEntries = type->map_count;
- wire->preserve = (type->preserve!=NULL);
- if (client->swapped) {
- swaps(&wire->virtualMods);
- }
-
- buf= (char *)&wire[1];
- if (wire->nMapEntries>0) {
- xkbKTMapEntryWireDesc * wire;
- XkbKTMapEntryPtr entry;
- wire= (xkbKTMapEntryWireDesc *)buf;
- entry= type->map;
- for (n=0;n<type->map_count;n++,wire++,entry++) {
- wire->active= entry->active;
- wire->mask= entry->mods.mask;
- wire->level= entry->level;
- wire->realMods= entry->mods.real_mods;
- wire->virtualMods= entry->mods.vmods;
- if (client->swapped) {
- swaps(&wire->virtualMods);
- }
- }
- buf= (char *)wire;
- if (type->preserve!=NULL) {
- xkbModsWireDesc * pwire;
- XkbModsPtr preserve;
- pwire= (xkbModsWireDesc *)buf;
- preserve= type->preserve;
- for (n=0;n<type->map_count;n++,pwire++,preserve++) {
- pwire->mask= preserve->mask;
- pwire->realMods= preserve->real_mods;
- pwire->virtualMods= preserve->vmods;
- if (client->swapped) {
- swaps(&pwire->virtualMods);
- }
- }
- buf= (char *)pwire;
- }
- }
+ type = &xkb->map->types[rep->firstType];
+ for (i = 0; i < rep->nTypes; i++, type++) {
+ register unsigned n;
+
+ wire = (xkbKeyTypeWireDesc *) buf;
+ wire->mask = type->mods.mask;
+ wire->realMods = type->mods.real_mods;
+ wire->virtualMods = type->mods.vmods;
+ wire->numLevels = type->num_levels;
+ wire->nMapEntries = type->map_count;
+ wire->preserve = (type->preserve != NULL);
+ if (client->swapped) {
+ swaps(&wire->virtualMods);
+ }
+
+ buf = (char *) &wire[1];
+ if (wire->nMapEntries > 0) {
+ xkbKTMapEntryWireDesc *wire;
+ XkbKTMapEntryPtr entry;
+
+ wire = (xkbKTMapEntryWireDesc *) buf;
+ entry = type->map;
+ for (n = 0; n < type->map_count; n++, wire++, entry++) {
+ wire->active = entry->active;
+ wire->mask = entry->mods.mask;
+ wire->level = entry->level;
+ wire->realMods = entry->mods.real_mods;
+ wire->virtualMods = entry->mods.vmods;
+ if (client->swapped) {
+ swaps(&wire->virtualMods);
+ }
+ }
+ buf = (char *) wire;
+ if (type->preserve != NULL) {
+ xkbModsWireDesc *pwire;
+ XkbModsPtr preserve;
+
+ pwire = (xkbModsWireDesc *) buf;
+ preserve = type->preserve;
+ for (n = 0; n < type->map_count; n++, pwire++, preserve++) {
+ pwire->mask = preserve->mask;
+ pwire->realMods = preserve->real_mods;
+ pwire->virtualMods = preserve->vmods;
+ if (client->swapped) {
+ swaps(&pwire->virtualMods);
+ }
+ }
+ buf = (char *) pwire;
+ }
+ }
}
return buf;
}
static int
-XkbSizeKeySyms(XkbDescPtr xkb,xkbGetMapReply *rep)
+XkbSizeKeySyms(XkbDescPtr xkb, xkbGetMapReply * rep)
{
- XkbSymMapPtr symMap;
- unsigned i,len;
- unsigned nSyms,nSymsThisKey;
-
- if (((rep->present&XkbKeySymsMask)==0)||(rep->nKeySyms<1)||
- (!xkb)||(!xkb->map)||(!xkb->map->key_sym_map)) {
- rep->present&= ~XkbKeySymsMask;
- rep->firstKeySym= rep->nKeySyms= 0;
- rep->totalSyms= 0;
- return 0;
- }
- len= rep->nKeySyms*SIZEOF(xkbSymMapWireDesc);
+ XkbSymMapPtr symMap;
+ unsigned i, len;
+ unsigned nSyms, nSymsThisKey;
+
+ if (((rep->present & XkbKeySymsMask) == 0) || (rep->nKeySyms < 1) ||
+ (!xkb) || (!xkb->map) || (!xkb->map->key_sym_map)) {
+ rep->present &= ~XkbKeySymsMask;
+ rep->firstKeySym = rep->nKeySyms = 0;
+ rep->totalSyms = 0;
+ return 0;
+ }
+ len = rep->nKeySyms * SIZEOF(xkbSymMapWireDesc);
symMap = &xkb->map->key_sym_map[rep->firstKeySym];
- for (i=nSyms=0;i<rep->nKeySyms;i++,symMap++) {
- if (symMap->offset!=0) {
- nSymsThisKey= XkbNumGroups(symMap->group_info)*symMap->width;
- nSyms+= nSymsThisKey;
- }
- }
- len+= nSyms*4;
- rep->totalSyms= nSyms;
+ for (i = nSyms = 0; i < rep->nKeySyms; i++, symMap++) {
+ if (symMap->offset != 0) {
+ nSymsThisKey = XkbNumGroups(symMap->group_info) * symMap->width;
+ nSyms += nSymsThisKey;
+ }
+ }
+ len += nSyms * 4;
+ rep->totalSyms = nSyms;
return len;
}
static int
-XkbSizeVirtualMods(XkbDescPtr xkb,xkbGetMapReply *rep)
+XkbSizeVirtualMods(XkbDescPtr xkb, xkbGetMapReply * rep)
{
-register unsigned i,nMods,bit;
+ register unsigned i, nMods, bit;
- if (((rep->present&XkbVirtualModsMask)==0)||(rep->virtualMods==0)||
- (!xkb)||(!xkb->server)) {
- rep->present&= ~XkbVirtualModsMask;
- rep->virtualMods= 0;
- return 0;
+ if (((rep->present & XkbVirtualModsMask) == 0) || (rep->virtualMods == 0) ||
+ (!xkb) || (!xkb->server)) {
+ rep->present &= ~XkbVirtualModsMask;
+ rep->virtualMods = 0;
+ return 0;
}
- for (i=nMods=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (rep->virtualMods&bit)
- nMods++;
+ for (i = nMods = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if (rep->virtualMods & bit)
+ nMods++;
}
return XkbPaddedSize(nMods);
}
static char *
-XkbWriteKeySyms(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf,ClientPtr client)
+XkbWriteKeySyms(XkbDescPtr xkb, xkbGetMapReply * rep, char *buf,
+ ClientPtr client)
{
-register KeySym * pSym;
-XkbSymMapPtr symMap;
-xkbSymMapWireDesc * outMap;
-register unsigned i;
+ register KeySym *pSym;
+ XkbSymMapPtr symMap;
+ xkbSymMapWireDesc *outMap;
+ register unsigned i;
symMap = &xkb->map->key_sym_map[rep->firstKeySym];
- for (i=0;i<rep->nKeySyms;i++,symMap++) {
- outMap = (xkbSymMapWireDesc *)buf;
- outMap->ktIndex[0] = symMap->kt_index[0];
- outMap->ktIndex[1] = symMap->kt_index[1];
- outMap->ktIndex[2] = symMap->kt_index[2];
- outMap->ktIndex[3] = symMap->kt_index[3];
- outMap->groupInfo = symMap->group_info;
- outMap->width= symMap->width;
- outMap->nSyms = symMap->width*XkbNumGroups(symMap->group_info);
- buf= (char *)&outMap[1];
- if (outMap->nSyms==0)
- continue;
-
- pSym = &xkb->map->syms[symMap->offset];
- memcpy((char *)buf,(char *)pSym,outMap->nSyms*4);
- if (client->swapped) {
- register int nSyms= outMap->nSyms;
- swaps(&outMap->nSyms);
- while (nSyms-->0) {
- swapl((int *)buf);
- buf+= 4;
- }
- }
- else buf+= outMap->nSyms*4;
+ for (i = 0; i < rep->nKeySyms; i++, symMap++) {
+ outMap = (xkbSymMapWireDesc *) buf;
+ outMap->ktIndex[0] = symMap->kt_index[0];
+ outMap->ktIndex[1] = symMap->kt_index[1];
+ outMap->ktIndex[2] = symMap->kt_index[2];
+ outMap->ktIndex[3] = symMap->kt_index[3];
+ outMap->groupInfo = symMap->group_info;
+ outMap->width = symMap->width;
+ outMap->nSyms = symMap->width * XkbNumGroups(symMap->group_info);
+ buf = (char *) &outMap[1];
+ if (outMap->nSyms == 0)
+ continue;
+
+ pSym = &xkb->map->syms[symMap->offset];
+ memcpy((char *) buf, (char *) pSym, outMap->nSyms * 4);
+ if (client->swapped) {
+ register int nSyms = outMap->nSyms;
+
+ swaps(&outMap->nSyms);
+ while (nSyms-- > 0) {
+ swapl((int *) buf);
+ buf += 4;
+ }
+ }
+ else
+ buf += outMap->nSyms * 4;
}
return buf;
}
static int
-XkbSizeKeyActions(XkbDescPtr xkb,xkbGetMapReply *rep)
+XkbSizeKeyActions(XkbDescPtr xkb, xkbGetMapReply * rep)
{
- unsigned i,len,nActs;
- register KeyCode firstKey;
-
- if (((rep->present&XkbKeyActionsMask)==0)||(rep->nKeyActs<1)||
- (!xkb)||(!xkb->server)||(!xkb->server->key_acts)) {
- rep->present&= ~XkbKeyActionsMask;
- rep->firstKeyAct= rep->nKeyActs= 0;
- rep->totalActs= 0;
- return 0;
- }
- firstKey= rep->firstKeyAct;
- for (nActs=i=0;i<rep->nKeyActs;i++) {
- if (xkb->server->key_acts[i+firstKey]!=0)
- nActs+= XkbKeyNumActions(xkb,i+firstKey);
- }
- len= XkbPaddedSize(rep->nKeyActs)+(nActs*SIZEOF(xkbActionWireDesc));
- rep->totalActs= nActs;
+ unsigned i, len, nActs;
+ register KeyCode firstKey;
+
+ if (((rep->present & XkbKeyActionsMask) == 0) || (rep->nKeyActs < 1) ||
+ (!xkb) || (!xkb->server) || (!xkb->server->key_acts)) {
+ rep->present &= ~XkbKeyActionsMask;
+ rep->firstKeyAct = rep->nKeyActs = 0;
+ rep->totalActs = 0;
+ return 0;
+ }
+ firstKey = rep->firstKeyAct;
+ for (nActs = i = 0; i < rep->nKeyActs; i++) {
+ if (xkb->server->key_acts[i + firstKey] != 0)
+ nActs += XkbKeyNumActions(xkb, i + firstKey);
+ }
+ len = XkbPaddedSize(rep->nKeyActs) + (nActs * SIZEOF(xkbActionWireDesc));
+ rep->totalActs = nActs;
return len;
}
static char *
-XkbWriteKeyActions(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf,
- ClientPtr client)
+XkbWriteKeyActions(XkbDescPtr xkb, xkbGetMapReply * rep, char *buf,
+ ClientPtr client)
{
- unsigned i;
- CARD8 * numDesc;
- XkbAnyAction * actDesc;
-
- numDesc = (CARD8 *)buf;
- for (i=0;i<rep->nKeyActs;i++) {
- if (xkb->server->key_acts[i+rep->firstKeyAct]==0)
- numDesc[i] = 0;
- else numDesc[i] = XkbKeyNumActions(xkb,(i+rep->firstKeyAct));
- }
- buf+= XkbPaddedSize(rep->nKeyActs);
-
- actDesc = (XkbAnyAction *)buf;
- for (i=0;i<rep->nKeyActs;i++) {
- if (xkb->server->key_acts[i+rep->firstKeyAct]!=0) {
- unsigned int num;
- num = XkbKeyNumActions(xkb,(i+rep->firstKeyAct));
- memcpy((char *)actDesc,
- (char*)XkbKeyActionsPtr(xkb,(i+rep->firstKeyAct)),
- num*SIZEOF(xkbActionWireDesc));
- actDesc+= num;
- }
- }
- buf = (char *)actDesc;
+ unsigned i;
+ CARD8 *numDesc;
+ XkbAnyAction *actDesc;
+
+ numDesc = (CARD8 *) buf;
+ for (i = 0; i < rep->nKeyActs; i++) {
+ if (xkb->server->key_acts[i + rep->firstKeyAct] == 0)
+ numDesc[i] = 0;
+ else
+ numDesc[i] = XkbKeyNumActions(xkb, (i + rep->firstKeyAct));
+ }
+ buf += XkbPaddedSize(rep->nKeyActs);
+
+ actDesc = (XkbAnyAction *) buf;
+ for (i = 0; i < rep->nKeyActs; i++) {
+ if (xkb->server->key_acts[i + rep->firstKeyAct] != 0) {
+ unsigned int num;
+
+ num = XkbKeyNumActions(xkb, (i + rep->firstKeyAct));
+ memcpy((char *) actDesc,
+ (char *) XkbKeyActionsPtr(xkb, (i + rep->firstKeyAct)),
+ num * SIZEOF(xkbActionWireDesc));
+ actDesc += num;
+ }
+ }
+ buf = (char *) actDesc;
return buf;
}
static int
-XkbSizeKeyBehaviors(XkbDescPtr xkb,xkbGetMapReply *rep)
+XkbSizeKeyBehaviors(XkbDescPtr xkb, xkbGetMapReply * rep)
{
- unsigned i,len,nBhvr;
- XkbBehavior * bhv;
-
- if (((rep->present&XkbKeyBehaviorsMask)==0)||(rep->nKeyBehaviors<1)||
- (!xkb)||(!xkb->server)||(!xkb->server->behaviors)) {
- rep->present&= ~XkbKeyBehaviorsMask;
- rep->firstKeyBehavior= rep->nKeyBehaviors= 0;
- rep->totalKeyBehaviors= 0;
- return 0;
- }
- bhv= &xkb->server->behaviors[rep->firstKeyBehavior];
- for (nBhvr=i=0;i<rep->nKeyBehaviors;i++,bhv++) {
- if (bhv->type!=XkbKB_Default)
- nBhvr++;
- }
- len= nBhvr*SIZEOF(xkbBehaviorWireDesc);
- rep->totalKeyBehaviors= nBhvr;
+ unsigned i, len, nBhvr;
+ XkbBehavior *bhv;
+
+ if (((rep->present & XkbKeyBehaviorsMask) == 0) || (rep->nKeyBehaviors < 1)
+ || (!xkb) || (!xkb->server) || (!xkb->server->behaviors)) {
+ rep->present &= ~XkbKeyBehaviorsMask;
+ rep->firstKeyBehavior = rep->nKeyBehaviors = 0;
+ rep->totalKeyBehaviors = 0;
+ return 0;
+ }
+ bhv = &xkb->server->behaviors[rep->firstKeyBehavior];
+ for (nBhvr = i = 0; i < rep->nKeyBehaviors; i++, bhv++) {
+ if (bhv->type != XkbKB_Default)
+ nBhvr++;
+ }
+ len = nBhvr * SIZEOF(xkbBehaviorWireDesc);
+ rep->totalKeyBehaviors = nBhvr;
return len;
}
static char *
-XkbWriteKeyBehaviors(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf,
- ClientPtr client)
+XkbWriteKeyBehaviors(XkbDescPtr xkb, xkbGetMapReply * rep, char *buf,
+ ClientPtr client)
{
- unsigned i;
- xkbBehaviorWireDesc *wire;
- XkbBehavior *pBhvr;
-
- wire = (xkbBehaviorWireDesc *)buf;
- pBhvr= &xkb->server->behaviors[rep->firstKeyBehavior];
- for (i=0;i<rep->nKeyBehaviors;i++,pBhvr++) {
- if (pBhvr->type!=XkbKB_Default) {
- wire->key= i+rep->firstKeyBehavior;
- wire->type= pBhvr->type;
- wire->data= pBhvr->data;
- wire++;
- }
- }
- buf = (char *)wire;
+ unsigned i;
+ xkbBehaviorWireDesc *wire;
+ XkbBehavior *pBhvr;
+
+ wire = (xkbBehaviorWireDesc *) buf;
+ pBhvr = &xkb->server->behaviors[rep->firstKeyBehavior];
+ for (i = 0; i < rep->nKeyBehaviors; i++, pBhvr++) {
+ if (pBhvr->type != XkbKB_Default) {
+ wire->key = i + rep->firstKeyBehavior;
+ wire->type = pBhvr->type;
+ wire->data = pBhvr->data;
+ wire++;
+ }
+ }
+ buf = (char *) wire;
return buf;
}
static int
-XkbSizeExplicit(XkbDescPtr xkb,xkbGetMapReply *rep)
+XkbSizeExplicit(XkbDescPtr xkb, xkbGetMapReply * rep)
{
- unsigned i,len,nRtrn;
-
- if (((rep->present&XkbExplicitComponentsMask)==0)||(rep->nKeyExplicit<1)||
- (!xkb)||(!xkb->server)||(!xkb->server->explicit)) {
- rep->present&= ~XkbExplicitComponentsMask;
- rep->firstKeyExplicit= rep->nKeyExplicit= 0;
- rep->totalKeyExplicit= 0;
- return 0;
- }
- for (nRtrn=i=0;i<rep->nKeyExplicit;i++) {
- if (xkb->server->explicit[i+rep->firstKeyExplicit]!=0)
- nRtrn++;
- }
- rep->totalKeyExplicit= nRtrn;
- len= XkbPaddedSize(nRtrn*2); /* two bytes per non-zero explicit component */
+ unsigned i, len, nRtrn;
+
+ if (((rep->present & XkbExplicitComponentsMask) == 0) ||
+ (rep->nKeyExplicit < 1) || (!xkb) || (!xkb->server) ||
+ (!xkb->server->explicit)) {
+ rep->present &= ~XkbExplicitComponentsMask;
+ rep->firstKeyExplicit = rep->nKeyExplicit = 0;
+ rep->totalKeyExplicit = 0;
+ return 0;
+ }
+ for (nRtrn = i = 0; i < rep->nKeyExplicit; i++) {
+ if (xkb->server->explicit[i + rep->firstKeyExplicit] != 0)
+ nRtrn++;
+ }
+ rep->totalKeyExplicit = nRtrn;
+ len = XkbPaddedSize(nRtrn * 2); /* two bytes per non-zero explicit component */
return len;
}
static char *
-XkbWriteExplicit(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf,ClientPtr client)
+XkbWriteExplicit(XkbDescPtr xkb, xkbGetMapReply * rep, char *buf,
+ ClientPtr client)
{
-unsigned i;
-char * start;
-unsigned char * pExp;
-
- start= buf;
- pExp= &xkb->server->explicit[rep->firstKeyExplicit];
- for (i=0;i<rep->nKeyExplicit;i++,pExp++) {
- if (*pExp!=0) {
- *buf++= i+rep->firstKeyExplicit;
- *buf++= *pExp;
- }
- }
- i= XkbPaddedSize(buf-start)-(buf-start); /* pad to word boundary */
- return buf+i;
+ unsigned i;
+ char *start;
+ unsigned char *pExp;
+
+ start = buf;
+ pExp = &xkb->server->explicit[rep->firstKeyExplicit];
+ for (i = 0; i < rep->nKeyExplicit; i++, pExp++) {
+ if (*pExp != 0) {
+ *buf++ = i + rep->firstKeyExplicit;
+ *buf++ = *pExp;
+ }
+ }
+ i = XkbPaddedSize(buf - start) - (buf - start); /* pad to word boundary */
+ return buf + i;
}
static int
-XkbSizeModifierMap(XkbDescPtr xkb,xkbGetMapReply *rep)
+XkbSizeModifierMap(XkbDescPtr xkb, xkbGetMapReply * rep)
{
- unsigned i,len,nRtrn;
+ unsigned i, len, nRtrn;
- if (((rep->present&XkbModifierMapMask)==0)||(rep->nModMapKeys<1)||
- (!xkb)||(!xkb->map)||(!xkb->map->modmap)) {
- rep->present&= ~XkbModifierMapMask;
- rep->firstModMapKey= rep->nModMapKeys= 0;
- rep->totalModMapKeys= 0;
- return 0;
+ if (((rep->present & XkbModifierMapMask) == 0) || (rep->nModMapKeys < 1) ||
+ (!xkb) || (!xkb->map) || (!xkb->map->modmap)) {
+ rep->present &= ~XkbModifierMapMask;
+ rep->firstModMapKey = rep->nModMapKeys = 0;
+ rep->totalModMapKeys = 0;
+ return 0;
}
- for (nRtrn=i=0;i<rep->nModMapKeys;i++) {
- if (xkb->map->modmap[i+rep->firstModMapKey]!=0)
- nRtrn++;
+ for (nRtrn = i = 0; i < rep->nModMapKeys; i++) {
+ if (xkb->map->modmap[i + rep->firstModMapKey] != 0)
+ nRtrn++;
}
- rep->totalModMapKeys= nRtrn;
- len= XkbPaddedSize(nRtrn*2); /* two bytes per non-zero modmap component */
+ rep->totalModMapKeys = nRtrn;
+ len = XkbPaddedSize(nRtrn * 2); /* two bytes per non-zero modmap component */
return len;
}
static char *
-XkbWriteModifierMap(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf,
- ClientPtr client)
+XkbWriteModifierMap(XkbDescPtr xkb, xkbGetMapReply * rep, char *buf,
+ ClientPtr client)
{
-unsigned i;
-char * start;
-unsigned char * pMap;
-
- start= buf;
- pMap= &xkb->map->modmap[rep->firstModMapKey];
- for (i=0;i<rep->nModMapKeys;i++,pMap++) {
- if (*pMap!=0) {
- *buf++= i+rep->firstModMapKey;
- *buf++= *pMap;
- }
- }
- i= XkbPaddedSize(buf-start)-(buf-start); /* pad to word boundary */
- return buf+i;
+ unsigned i;
+ char *start;
+ unsigned char *pMap;
+
+ start = buf;
+ pMap = &xkb->map->modmap[rep->firstModMapKey];
+ for (i = 0; i < rep->nModMapKeys; i++, pMap++) {
+ if (*pMap != 0) {
+ *buf++ = i + rep->firstModMapKey;
+ *buf++ = *pMap;
+ }
+ }
+ i = XkbPaddedSize(buf - start) - (buf - start); /* pad to word boundary */
+ return buf + i;
}
static int
-XkbSizeVirtualModMap(XkbDescPtr xkb,xkbGetMapReply *rep)
+XkbSizeVirtualModMap(XkbDescPtr xkb, xkbGetMapReply * rep)
{
- unsigned i,len,nRtrn;
+ unsigned i, len, nRtrn;
- if (((rep->present&XkbVirtualModMapMask)==0)||(rep->nVModMapKeys<1)||
- (!xkb)||(!xkb->server)||(!xkb->server->vmodmap)) {
- rep->present&= ~XkbVirtualModMapMask;
- rep->firstVModMapKey= rep->nVModMapKeys= 0;
- rep->totalVModMapKeys= 0;
- return 0;
+ if (((rep->present & XkbVirtualModMapMask) == 0) || (rep->nVModMapKeys < 1)
+ || (!xkb) || (!xkb->server) || (!xkb->server->vmodmap)) {
+ rep->present &= ~XkbVirtualModMapMask;
+ rep->firstVModMapKey = rep->nVModMapKeys = 0;
+ rep->totalVModMapKeys = 0;
+ return 0;
}
- for (nRtrn=i=0;i<rep->nVModMapKeys;i++) {
- if (xkb->server->vmodmap[i+rep->firstVModMapKey]!=0)
- nRtrn++;
+ for (nRtrn = i = 0; i < rep->nVModMapKeys; i++) {
+ if (xkb->server->vmodmap[i + rep->firstVModMapKey] != 0)
+ nRtrn++;
}
- rep->totalVModMapKeys= nRtrn;
- len= nRtrn*SIZEOF(xkbVModMapWireDesc);
+ rep->totalVModMapKeys = nRtrn;
+ len = nRtrn * SIZEOF(xkbVModMapWireDesc);
return len;
}
static char *
-XkbWriteVirtualModMap(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf,
- ClientPtr client)
+XkbWriteVirtualModMap(XkbDescPtr xkb, xkbGetMapReply * rep, char *buf,
+ ClientPtr client)
{
-unsigned i;
-xkbVModMapWireDesc * wire;
-unsigned short * pMap;
-
- wire= (xkbVModMapWireDesc *)buf;
- pMap= &xkb->server->vmodmap[rep->firstVModMapKey];
- for (i=0;i<rep->nVModMapKeys;i++,pMap++) {
- if (*pMap!=0) {
- wire->key= i+rep->firstVModMapKey;
- wire->vmods= *pMap;
- wire++;
- }
- }
- return (char *)wire;
+ unsigned i;
+ xkbVModMapWireDesc *wire;
+ unsigned short *pMap;
+
+ wire = (xkbVModMapWireDesc *) buf;
+ pMap = &xkb->server->vmodmap[rep->firstVModMapKey];
+ for (i = 0; i < rep->nVModMapKeys; i++, pMap++) {
+ if (*pMap != 0) {
+ wire->key = i + rep->firstVModMapKey;
+ wire->vmods = *pMap;
+ wire++;
+ }
+ }
+ return (char *) wire;
}
static Status
-XkbComputeGetMapReplySize(XkbDescPtr xkb,xkbGetMapReply *rep)
+XkbComputeGetMapReplySize(XkbDescPtr xkb, xkbGetMapReply * rep)
{
-int len;
-
- rep->minKeyCode= xkb->min_key_code;
- rep->maxKeyCode= xkb->max_key_code;
- len= XkbSizeKeyTypes(xkb,rep);
- len+= XkbSizeKeySyms(xkb,rep);
- len+= XkbSizeKeyActions(xkb,rep);
- len+= XkbSizeKeyBehaviors(xkb,rep);
- len+= XkbSizeVirtualMods(xkb,rep);
- len+= XkbSizeExplicit(xkb,rep);
- len+= XkbSizeModifierMap(xkb,rep);
- len+= XkbSizeVirtualModMap(xkb,rep);
- rep->length+= (len/4);
+ int len;
+
+ rep->minKeyCode = xkb->min_key_code;
+ rep->maxKeyCode = xkb->max_key_code;
+ len = XkbSizeKeyTypes(xkb, rep);
+ len += XkbSizeKeySyms(xkb, rep);
+ len += XkbSizeKeyActions(xkb, rep);
+ len += XkbSizeKeyBehaviors(xkb, rep);
+ len += XkbSizeVirtualMods(xkb, rep);
+ len += XkbSizeExplicit(xkb, rep);
+ len += XkbSizeModifierMap(xkb, rep);
+ len += XkbSizeVirtualModMap(xkb, rep);
+ rep->length += (len / 4);
return Success;
}
static int
-XkbSendMap(ClientPtr client,XkbDescPtr xkb,xkbGetMapReply *rep)
+XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply * rep)
{
-unsigned i,len;
-char *desc,*start;
+ unsigned i, len;
+ char *desc, *start;
- len= (rep->length*4)-(SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply));
- start= desc= calloc(1, len);
+ len = (rep->length * 4) - (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply));
+ start = desc = calloc(1, len);
if (!start)
- return BadAlloc;
- if ( rep->nTypes>0 )
- desc = XkbWriteKeyTypes(xkb,rep,desc,client);
- if ( rep->nKeySyms>0 )
- desc = XkbWriteKeySyms(xkb,rep,desc,client);
- if ( rep->nKeyActs>0 )
- desc = XkbWriteKeyActions(xkb,rep,desc,client);
- if ( rep->totalKeyBehaviors>0 )
- desc = XkbWriteKeyBehaviors(xkb,rep,desc,client);
- if ( rep->virtualMods ) {
- register int sz,bit;
- for (i=sz=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (rep->virtualMods&bit) {
- desc[sz++]= xkb->server->vmods[i];
- }
- }
- desc+= XkbPaddedSize(sz);
- }
- if ( rep->totalKeyExplicit>0 )
- desc= XkbWriteExplicit(xkb,rep,desc,client);
- if ( rep->totalModMapKeys>0 )
- desc= XkbWriteModifierMap(xkb,rep,desc,client);
- if ( rep->totalVModMapKeys>0 )
- desc= XkbWriteVirtualModMap(xkb,rep,desc,client);
- if ((desc-start)!=(len)) {
- ErrorF("[xkb] BOGUS LENGTH in write keyboard desc, expected %d, got %ld\n",
- len, (unsigned long)(desc-start));
+ return BadAlloc;
+ if (rep->nTypes > 0)
+ desc = XkbWriteKeyTypes(xkb, rep, desc, client);
+ if (rep->nKeySyms > 0)
+ desc = XkbWriteKeySyms(xkb, rep, desc, client);
+ if (rep->nKeyActs > 0)
+ desc = XkbWriteKeyActions(xkb, rep, desc, client);
+ if (rep->totalKeyBehaviors > 0)
+ desc = XkbWriteKeyBehaviors(xkb, rep, desc, client);
+ if (rep->virtualMods) {
+ register int sz, bit;
+
+ for (i = sz = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if (rep->virtualMods & bit) {
+ desc[sz++] = xkb->server->vmods[i];
+ }
+ }
+ desc += XkbPaddedSize(sz);
+ }
+ if (rep->totalKeyExplicit > 0)
+ desc = XkbWriteExplicit(xkb, rep, desc, client);
+ if (rep->totalModMapKeys > 0)
+ desc = XkbWriteModifierMap(xkb, rep, desc, client);
+ if (rep->totalVModMapKeys > 0)
+ desc = XkbWriteVirtualModMap(xkb, rep, desc, client);
+ if ((desc - start) != (len)) {
+ ErrorF
+ ("[xkb] BOGUS LENGTH in write keyboard desc, expected %d, got %ld\n",
+ len, (unsigned long) (desc - start));
}
if (client->swapped) {
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swaps(&rep->present);
- swaps(&rep->totalSyms);
- swaps(&rep->totalActs);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->present);
+ swaps(&rep->totalSyms);
+ swaps(&rep->totalActs);
}
- WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), (char *)rep);
+ WriteToClient(client, (i = SIZEOF(xkbGetMapReply)), (char *) rep);
WriteToClient(client, len, start);
- free((char *)start);
+ free((char *) start);
return Success;
}
int
ProcXkbGetMap(ClientPtr client)
{
- DeviceIntPtr dev;
- xkbGetMapReply rep;
- XkbDescRec *xkb;
- int n,status;
+ DeviceIntPtr dev;
+ xkbGetMapReply rep;
+ XkbDescRec *xkb;
+ int n, status;
REQUEST(xkbGetMapReq);
REQUEST_SIZE_MATCH(xkbGetMapReq);
-
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
- CHK_MASK_OVERLAP(0x01,stuff->full,stuff->partial);
- CHK_MASK_LEGAL(0x02,stuff->full,XkbAllMapComponentsMask);
- CHK_MASK_LEGAL(0x03,stuff->partial,XkbAllMapComponentsMask);
+ CHK_MASK_OVERLAP(0x01, stuff->full, stuff->partial);
+ CHK_MASK_LEGAL(0x02, stuff->full, XkbAllMapComponentsMask);
+ CHK_MASK_LEGAL(0x03, stuff->partial, XkbAllMapComponentsMask);
- xkb= dev->key->xkbInfo->desc;
+ xkb = dev->key->xkbInfo->desc;
memset(&rep, 0, sizeof(xkbGetMapReply));
- rep.type= X_Reply;
- rep.sequenceNumber= client->sequence;
- rep.length = (SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply))>>2;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2;
rep.deviceID = dev->id;
- rep.present = stuff->partial|stuff->full;
+ rep.present = stuff->partial | stuff->full;
rep.minKeyCode = xkb->min_key_code;
rep.maxKeyCode = xkb->max_key_code;
- if ( stuff->full&XkbKeyTypesMask ) {
- rep.firstType = 0;
- rep.nTypes = xkb->map->num_types;
- }
- else if (stuff->partial&XkbKeyTypesMask) {
- if (((unsigned)stuff->firstType+stuff->nTypes)>xkb->map->num_types) {
- client->errorValue = _XkbErrCode4(0x04,xkb->map->num_types,
- stuff->firstType,stuff->nTypes);
- return BadValue;
- }
- rep.firstType = stuff->firstType;
- rep.nTypes = stuff->nTypes;
- }
- else rep.nTypes = 0;
- rep.totalTypes = xkb->map->num_types;
-
- n= XkbNumKeys(xkb);
- if ( stuff->full&XkbKeySymsMask ) {
- rep.firstKeySym = xkb->min_key_code;
- rep.nKeySyms = n;
- }
- else if (stuff->partial&XkbKeySymsMask) {
- CHK_KEY_RANGE(0x05,stuff->firstKeySym,stuff->nKeySyms,xkb);
- rep.firstKeySym = stuff->firstKeySym;
- rep.nKeySyms = stuff->nKeySyms;
+ if (stuff->full & XkbKeyTypesMask) {
+ rep.firstType = 0;
+ rep.nTypes = xkb->map->num_types;
+ }
+ else if (stuff->partial & XkbKeyTypesMask) {
+ if (((unsigned) stuff->firstType + stuff->nTypes) > xkb->map->num_types) {
+ client->errorValue = _XkbErrCode4(0x04, xkb->map->num_types,
+ stuff->firstType, stuff->nTypes);
+ return BadValue;
+ }
+ rep.firstType = stuff->firstType;
+ rep.nTypes = stuff->nTypes;
}
- else rep.nKeySyms = 0;
- rep.totalSyms= 0;
+ else
+ rep.nTypes = 0;
+ rep.totalTypes = xkb->map->num_types;
- if ( stuff->full&XkbKeyActionsMask ) {
- rep.firstKeyAct= xkb->min_key_code;
- rep.nKeyActs= n;
- }
- else if (stuff->partial&XkbKeyActionsMask) {
- CHK_KEY_RANGE(0x07,stuff->firstKeyAct,stuff->nKeyActs,xkb);
- rep.firstKeyAct= stuff->firstKeyAct;
- rep.nKeyActs= stuff->nKeyActs;
- }
- else rep.nKeyActs= 0;
- rep.totalActs= 0;
+ n = XkbNumKeys(xkb);
+ if (stuff->full & XkbKeySymsMask) {
+ rep.firstKeySym = xkb->min_key_code;
+ rep.nKeySyms = n;
+ }
+ else if (stuff->partial & XkbKeySymsMask) {
+ CHK_KEY_RANGE(0x05, stuff->firstKeySym, stuff->nKeySyms, xkb);
+ rep.firstKeySym = stuff->firstKeySym;
+ rep.nKeySyms = stuff->nKeySyms;
+ }
+ else
+ rep.nKeySyms = 0;
+ rep.totalSyms = 0;
+
+ if (stuff->full & XkbKeyActionsMask) {
+ rep.firstKeyAct = xkb->min_key_code;
+ rep.nKeyActs = n;
+ }
+ else if (stuff->partial & XkbKeyActionsMask) {
+ CHK_KEY_RANGE(0x07, stuff->firstKeyAct, stuff->nKeyActs, xkb);
+ rep.firstKeyAct = stuff->firstKeyAct;
+ rep.nKeyActs = stuff->nKeyActs;
+ }
+ else
+ rep.nKeyActs = 0;
+ rep.totalActs = 0;
+
+ if (stuff->full & XkbKeyBehaviorsMask) {
+ rep.firstKeyBehavior = xkb->min_key_code;
+ rep.nKeyBehaviors = n;
+ }
+ else if (stuff->partial & XkbKeyBehaviorsMask) {
+ CHK_KEY_RANGE(0x09, stuff->firstKeyBehavior, stuff->nKeyBehaviors, xkb);
+ rep.firstKeyBehavior = stuff->firstKeyBehavior;
+ rep.nKeyBehaviors = stuff->nKeyBehaviors;
+ }
+ else
+ rep.nKeyBehaviors = 0;
+ rep.totalKeyBehaviors = 0;
+
+ if (stuff->full & XkbVirtualModsMask)
+ rep.virtualMods = ~0;
+ else if (stuff->partial & XkbVirtualModsMask)
+ rep.virtualMods = stuff->virtualMods;
+
+ if (stuff->full & XkbExplicitComponentsMask) {
+ rep.firstKeyExplicit = xkb->min_key_code;
+ rep.nKeyExplicit = n;
+ }
+ else if (stuff->partial & XkbExplicitComponentsMask) {
+ CHK_KEY_RANGE(0x0B, stuff->firstKeyExplicit, stuff->nKeyExplicit, xkb);
+ rep.firstKeyExplicit = stuff->firstKeyExplicit;
+ rep.nKeyExplicit = stuff->nKeyExplicit;
+ }
+ else
+ rep.nKeyExplicit = 0;
+ rep.totalKeyExplicit = 0;
+
+ if (stuff->full & XkbModifierMapMask) {
+ rep.firstModMapKey = xkb->min_key_code;
+ rep.nModMapKeys = n;
+ }
+ else if (stuff->partial & XkbModifierMapMask) {
+ CHK_KEY_RANGE(0x0D, stuff->firstModMapKey, stuff->nModMapKeys, xkb);
+ rep.firstModMapKey = stuff->firstModMapKey;
+ rep.nModMapKeys = stuff->nModMapKeys;
+ }
+ else
+ rep.nModMapKeys = 0;
+ rep.totalModMapKeys = 0;
+
+ if (stuff->full & XkbVirtualModMapMask) {
+ rep.firstVModMapKey = xkb->min_key_code;
+ rep.nVModMapKeys = n;
+ }
+ else if (stuff->partial & XkbVirtualModMapMask) {
+ CHK_KEY_RANGE(0x0F, stuff->firstVModMapKey, stuff->nVModMapKeys, xkb);
+ rep.firstVModMapKey = stuff->firstVModMapKey;
+ rep.nVModMapKeys = stuff->nVModMapKeys;
+ }
+ else
+ rep.nVModMapKeys = 0;
+ rep.totalVModMapKeys = 0;
+
+ if ((status = XkbComputeGetMapReplySize(xkb, &rep)) != Success)
+ return status;
+ return XkbSendMap(client, xkb, &rep);
+}
- if ( stuff->full&XkbKeyBehaviorsMask ) {
- rep.firstKeyBehavior = xkb->min_key_code;
- rep.nKeyBehaviors = n;
- }
- else if (stuff->partial&XkbKeyBehaviorsMask) {
- CHK_KEY_RANGE(0x09,stuff->firstKeyBehavior,stuff->nKeyBehaviors,xkb);
- rep.firstKeyBehavior= stuff->firstKeyBehavior;
- rep.nKeyBehaviors= stuff->nKeyBehaviors;
- }
- else rep.nKeyBehaviors = 0;
- rep.totalKeyBehaviors= 0;
+/***====================================================================***/
- if (stuff->full&XkbVirtualModsMask)
- rep.virtualMods= ~0;
- else if (stuff->partial&XkbVirtualModsMask)
- rep.virtualMods= stuff->virtualMods;
-
- if (stuff->full&XkbExplicitComponentsMask) {
- rep.firstKeyExplicit= xkb->min_key_code;
- rep.nKeyExplicit= n;
- }
- else if (stuff->partial&XkbExplicitComponentsMask) {
- CHK_KEY_RANGE(0x0B,stuff->firstKeyExplicit,stuff->nKeyExplicit,xkb);
- rep.firstKeyExplicit= stuff->firstKeyExplicit;
- rep.nKeyExplicit= stuff->nKeyExplicit;
+static int
+CheckKeyTypes(ClientPtr client,
+ XkbDescPtr xkb,
+ xkbSetMapReq * req,
+ xkbKeyTypeWireDesc ** wireRtrn,
+ int *nMapsRtrn, CARD8 *mapWidthRtrn)
+{
+ unsigned nMaps;
+ register unsigned i, n;
+ register CARD8 *map;
+ register xkbKeyTypeWireDesc *wire = *wireRtrn;
+
+ if (req->firstType > ((unsigned) xkb->map->num_types)) {
+ *nMapsRtrn = _XkbErrCode3(0x01, req->firstType, xkb->map->num_types);
+ return 0;
+ }
+ if (req->flags & XkbSetMapResizeTypes) {
+ nMaps = req->firstType + req->nTypes;
+ if (nMaps < XkbNumRequiredTypes) { /* canonical types must be there */
+ *nMapsRtrn = _XkbErrCode4(0x02, req->firstType, req->nTypes, 4);
+ return 0;
+ }
}
- else rep.nKeyExplicit = 0;
- rep.totalKeyExplicit= 0;
-
- if (stuff->full&XkbModifierMapMask) {
- rep.firstModMapKey= xkb->min_key_code;
- rep.nModMapKeys= n;
+ else if (req->present & XkbKeyTypesMask) {
+ nMaps = xkb->map->num_types;
+ if ((req->firstType + req->nTypes) > nMaps) {
+ *nMapsRtrn = req->firstType + req->nTypes;
+ return 0;
+ }
}
- else if (stuff->partial&XkbModifierMapMask) {
- CHK_KEY_RANGE(0x0D,stuff->firstModMapKey,stuff->nModMapKeys,xkb);
- rep.firstModMapKey= stuff->firstModMapKey;
- rep.nModMapKeys= stuff->nModMapKeys;
+ else {
+ *nMapsRtrn = xkb->map->num_types;
+ for (i = 0; i < xkb->map->num_types; i++) {
+ mapWidthRtrn[i] = xkb->map->types[i].num_levels;
+ }
+ return 1;
}
- else rep.nModMapKeys = 0;
- rep.totalModMapKeys= 0;
- if (stuff->full&XkbVirtualModMapMask) {
- rep.firstVModMapKey= xkb->min_key_code;
- rep.nVModMapKeys= n;
- }
- else if (stuff->partial&XkbVirtualModMapMask) {
- CHK_KEY_RANGE(0x0F,stuff->firstVModMapKey,stuff->nVModMapKeys,xkb);
- rep.firstVModMapKey= stuff->firstVModMapKey;
- rep.nVModMapKeys= stuff->nVModMapKeys;
+ for (i = 0; i < req->firstType; i++) {
+ mapWidthRtrn[i] = xkb->map->types[i].num_levels;
}
- else rep.nVModMapKeys = 0;
- rep.totalVModMapKeys= 0;
+ for (i = 0; i < req->nTypes; i++) {
+ unsigned width;
- if ((status=XkbComputeGetMapReplySize(xkb,&rep))!=Success)
- return status;
- return XkbSendMap(client,xkb,&rep);
-}
-
-/***====================================================================***/
+ if (client->swapped) {
+ swaps(&wire->virtualMods);
+ }
+ n = i + req->firstType;
+ width = wire->numLevels;
+ if (width < 1) {
+ *nMapsRtrn = _XkbErrCode3(0x04, n, width);
+ return 0;
+ }
+ else if ((n == XkbOneLevelIndex) && (width != 1)) { /* must be width 1 */
+ *nMapsRtrn = _XkbErrCode3(0x05, n, width);
+ return 0;
+ }
+ else if ((width != 2) &&
+ ((n == XkbTwoLevelIndex) || (n == XkbKeypadIndex) ||
+ (n == XkbAlphabeticIndex))) {
+ /* TWO_LEVEL, ALPHABETIC and KEYPAD must be width 2 */
+ *nMapsRtrn = _XkbErrCode3(0x05, n, width);
+ return 0;
+ }
+ if (wire->nMapEntries > 0) {
+ xkbKTSetMapEntryWireDesc *mapWire;
+ xkbModsWireDesc *preWire;
-static int
-CheckKeyTypes( ClientPtr client,
- XkbDescPtr xkb,
- xkbSetMapReq * req,
- xkbKeyTypeWireDesc **wireRtrn,
- int * nMapsRtrn,
- CARD8 * mapWidthRtrn)
-{
-unsigned nMaps;
-register unsigned i,n;
-register CARD8 * map;
-register xkbKeyTypeWireDesc *wire = *wireRtrn;
-
- if (req->firstType>((unsigned)xkb->map->num_types)) {
- *nMapsRtrn = _XkbErrCode3(0x01,req->firstType,xkb->map->num_types);
- return 0;
- }
- if (req->flags&XkbSetMapResizeTypes) {
- nMaps = req->firstType+req->nTypes;
- if (nMaps<XkbNumRequiredTypes) { /* canonical types must be there */
- *nMapsRtrn= _XkbErrCode4(0x02,req->firstType,req->nTypes,4);
- return 0;
- }
- }
- else if (req->present&XkbKeyTypesMask) {
- nMaps = xkb->map->num_types;
- if ((req->firstType+req->nTypes)>nMaps) {
- *nMapsRtrn = req->firstType+req->nTypes;
- return 0;
- }
+ mapWire = (xkbKTSetMapEntryWireDesc *) & wire[1];
+ preWire = (xkbModsWireDesc *) & mapWire[wire->nMapEntries];
+ for (n = 0; n < wire->nMapEntries; n++) {
+ if (client->swapped) {
+ swaps(&mapWire[n].virtualMods);
+ }
+ if (mapWire[n].realMods & (~wire->realMods)) {
+ *nMapsRtrn = _XkbErrCode4(0x06, n, mapWire[n].realMods,
+ wire->realMods);
+ return 0;
+ }
+ if (mapWire[n].virtualMods & (~wire->virtualMods)) {
+ *nMapsRtrn = _XkbErrCode3(0x07, n, mapWire[n].virtualMods);
+ return 0;
+ }
+ if (mapWire[n].level >= wire->numLevels) {
+ *nMapsRtrn = _XkbErrCode4(0x08, n, wire->numLevels,
+ mapWire[n].level);
+ return 0;
+ }
+ if (wire->preserve) {
+ if (client->swapped) {
+ swaps(&preWire[n].virtualMods);
+ }
+ if (preWire[n].realMods & (~mapWire[n].realMods)) {
+ *nMapsRtrn = _XkbErrCode4(0x09, n, preWire[n].realMods,
+ mapWire[n].realMods);
+ return 0;
+ }
+ if (preWire[n].virtualMods & (~mapWire[n].virtualMods)) {
+ *nMapsRtrn =
+ _XkbErrCode3(0x0a, n, preWire[n].virtualMods);
+ return 0;
+ }
+ }
+ }
+ if (wire->preserve)
+ map = (CARD8 *) &preWire[wire->nMapEntries];
+ else
+ map = (CARD8 *) &mapWire[wire->nMapEntries];
+ }
+ else
+ map = (CARD8 *) &wire[1];
+ mapWidthRtrn[i + req->firstType] = wire->numLevels;
+ wire = (xkbKeyTypeWireDesc *) map;
}
- else {
- *nMapsRtrn = xkb->map->num_types;
- for (i=0;i<xkb->map->num_types;i++) {
- mapWidthRtrn[i] = xkb->map->types[i].num_levels;
- }
- return 1;
- }
-
- for (i=0;i<req->firstType;i++) {
- mapWidthRtrn[i] = xkb->map->types[i].num_levels;
- }
- for (i=0;i<req->nTypes;i++) {
- unsigned width;
- if (client->swapped) {
- swaps(&wire->virtualMods);
- }
- n= i+req->firstType;
- width= wire->numLevels;
- if (width<1) {
- *nMapsRtrn= _XkbErrCode3(0x04,n,width);
- return 0;
- }
- else if ((n==XkbOneLevelIndex)&&(width!=1)) { /* must be width 1 */
- *nMapsRtrn= _XkbErrCode3(0x05,n,width);
- return 0;
- }
- else if ((width!=2)&&
- ((n==XkbTwoLevelIndex)||(n==XkbKeypadIndex)||
- (n==XkbAlphabeticIndex))) {
- /* TWO_LEVEL, ALPHABETIC and KEYPAD must be width 2 */
- *nMapsRtrn= _XkbErrCode3(0x05,n,width);
- return 0;
- }
- if (wire->nMapEntries>0) {
- xkbKTSetMapEntryWireDesc * mapWire;
- xkbModsWireDesc * preWire;
- mapWire= (xkbKTSetMapEntryWireDesc *)&wire[1];
- preWire= (xkbModsWireDesc *)&mapWire[wire->nMapEntries];
- for (n=0;n<wire->nMapEntries;n++) {
- if (client->swapped) {
- swaps(&mapWire[n].virtualMods);
- }
- if (mapWire[n].realMods&(~wire->realMods)) {
- *nMapsRtrn= _XkbErrCode4(0x06,n,mapWire[n].realMods,
- wire->realMods);
- return 0;
- }
- if (mapWire[n].virtualMods&(~wire->virtualMods)) {
- *nMapsRtrn= _XkbErrCode3(0x07,n,mapWire[n].virtualMods);
- return 0;
- }
- if (mapWire[n].level>=wire->numLevels) {
- *nMapsRtrn= _XkbErrCode4(0x08,n,wire->numLevels,
- mapWire[n].level);
- return 0;
- }
- if (wire->preserve) {
- if (client->swapped) {
- swaps(&preWire[n].virtualMods);
- }
- if (preWire[n].realMods&(~mapWire[n].realMods)) {
- *nMapsRtrn= _XkbErrCode4(0x09,n,preWire[n].realMods,
- mapWire[n].realMods);
- return 0;
- }
- if (preWire[n].virtualMods&(~mapWire[n].virtualMods)) {
- *nMapsRtrn=_XkbErrCode3(0x0a,n,preWire[n].virtualMods);
- return 0;
- }
- }
- }
- if (wire->preserve)
- map= (CARD8 *)&preWire[wire->nMapEntries];
- else map= (CARD8 *)&mapWire[wire->nMapEntries];
- }
- else map= (CARD8 *)&wire[1];
- mapWidthRtrn[i+req->firstType] = wire->numLevels;
- wire= (xkbKeyTypeWireDesc *)map;
- }
- for (i=req->firstType+req->nTypes;i<nMaps;i++) {
- mapWidthRtrn[i] = xkb->map->types[i].num_levels;
+ for (i = req->firstType + req->nTypes; i < nMaps; i++) {
+ mapWidthRtrn[i] = xkb->map->types[i].num_levels;
}
*nMapsRtrn = nMaps;
*wireRtrn = wire;
@@ -1656,660 +1698,666 @@ register xkbKeyTypeWireDesc *wire = *wireRtrn;
}
static int
-CheckKeySyms( ClientPtr client,
- XkbDescPtr xkb,
- xkbSetMapReq * req,
- int nTypes,
- CARD8 * mapWidths,
- CARD16 * symsPerKey,
- xkbSymMapWireDesc ** wireRtrn,
- int * errorRtrn)
+CheckKeySyms(ClientPtr client,
+ XkbDescPtr xkb,
+ xkbSetMapReq * req,
+ int nTypes,
+ CARD8 *mapWidths,
+ CARD16 *symsPerKey, xkbSymMapWireDesc ** wireRtrn, int *errorRtrn)
{
-register unsigned i;
-XkbSymMapPtr map;
-xkbSymMapWireDesc* wire = *wireRtrn;
-
- if (!(XkbKeySymsMask&req->present))
- return 1;
- CHK_REQ_KEY_RANGE2(0x11,req->firstKeySym,req->nKeySyms,req,(*errorRtrn),0);
- for (i=0;i<req->nKeySyms;i++) {
- KeySym *pSyms;
- register unsigned nG;
- if (client->swapped) {
- swaps(&wire->nSyms);
- }
- nG = XkbNumGroups(wire->groupInfo);
- if (nG>XkbNumKbdGroups) {
- *errorRtrn = _XkbErrCode3(0x14,i+req->firstKeySym,nG);
- return 0;
- }
- if (nG>0) {
- register int g,w;
- for (g=w=0;g<nG;g++) {
- if (wire->ktIndex[g]>=(unsigned)nTypes) {
- *errorRtrn= _XkbErrCode4(0x15,i+req->firstKeySym,g,
- wire->ktIndex[g]);
- return 0;
- }
- if (mapWidths[wire->ktIndex[g]]>w)
- w= mapWidths[wire->ktIndex[g]];
- }
- if (wire->width!=w) {
- *errorRtrn= _XkbErrCode3(0x16,i+req->firstKeySym,wire->width);
- return 0;
- }
- w*= nG;
- symsPerKey[i+req->firstKeySym] = w;
- if (w!=wire->nSyms) {
- *errorRtrn=_XkbErrCode4(0x16,i+req->firstKeySym,wire->nSyms,w);
- return 0;
- }
- }
- else if (wire->nSyms!=0) {
- *errorRtrn = _XkbErrCode3(0x17,i+req->firstKeySym,wire->nSyms);
- return 0;
- }
- pSyms = (KeySym *)&wire[1];
- wire = (xkbSymMapWireDesc *)&pSyms[wire->nSyms];
+ register unsigned i;
+ XkbSymMapPtr map;
+ xkbSymMapWireDesc *wire = *wireRtrn;
+
+ if (!(XkbKeySymsMask & req->present))
+ return 1;
+ CHK_REQ_KEY_RANGE2(0x11, req->firstKeySym, req->nKeySyms, req, (*errorRtrn),
+ 0);
+ for (i = 0; i < req->nKeySyms; i++) {
+ KeySym *pSyms;
+ register unsigned nG;
+
+ if (client->swapped) {
+ swaps(&wire->nSyms);
+ }
+ nG = XkbNumGroups(wire->groupInfo);
+ if (nG > XkbNumKbdGroups) {
+ *errorRtrn = _XkbErrCode3(0x14, i + req->firstKeySym, nG);
+ return 0;
+ }
+ if (nG > 0) {
+ register int g, w;
+
+ for (g = w = 0; g < nG; g++) {
+ if (wire->ktIndex[g] >= (unsigned) nTypes) {
+ *errorRtrn = _XkbErrCode4(0x15, i + req->firstKeySym, g,
+ wire->ktIndex[g]);
+ return 0;
+ }
+ if (mapWidths[wire->ktIndex[g]] > w)
+ w = mapWidths[wire->ktIndex[g]];
+ }
+ if (wire->width != w) {
+ *errorRtrn =
+ _XkbErrCode3(0x16, i + req->firstKeySym, wire->width);
+ return 0;
+ }
+ w *= nG;
+ symsPerKey[i + req->firstKeySym] = w;
+ if (w != wire->nSyms) {
+ *errorRtrn =
+ _XkbErrCode4(0x16, i + req->firstKeySym, wire->nSyms, w);
+ return 0;
+ }
+ }
+ else if (wire->nSyms != 0) {
+ *errorRtrn = _XkbErrCode3(0x17, i + req->firstKeySym, wire->nSyms);
+ return 0;
+ }
+ pSyms = (KeySym *) & wire[1];
+ wire = (xkbSymMapWireDesc *) & pSyms[wire->nSyms];
}
map = &xkb->map->key_sym_map[i];
- for (;i<=(unsigned)xkb->max_key_code;i++,map++) {
- register int g,nG,w;
- nG= XkbKeyNumGroups(xkb,i);
- for (w=g=0;g<nG;g++) {
- if (map->kt_index[g]>=(unsigned)nTypes) {
- *errorRtrn = _XkbErrCode4(0x18,i,g,map->kt_index[g]);
- return 0;
- }
- if (mapWidths[map->kt_index[g]]>w)
- w= mapWidths[map->kt_index[g]];
- }
- symsPerKey[i] = w*nG;
+ for (; i <= (unsigned) xkb->max_key_code; i++, map++) {
+ register int g, nG, w;
+
+ nG = XkbKeyNumGroups(xkb, i);
+ for (w = g = 0; g < nG; g++) {
+ if (map->kt_index[g] >= (unsigned) nTypes) {
+ *errorRtrn = _XkbErrCode4(0x18, i, g, map->kt_index[g]);
+ return 0;
+ }
+ if (mapWidths[map->kt_index[g]] > w)
+ w = mapWidths[map->kt_index[g]];
+ }
+ symsPerKey[i] = w * nG;
}
*wireRtrn = wire;
return 1;
}
static int
-CheckKeyActions( XkbDescPtr xkb,
- xkbSetMapReq * req,
- int nTypes,
- CARD8 * mapWidths,
- CARD16 * symsPerKey,
- CARD8 ** wireRtrn,
- int * nActsRtrn)
+CheckKeyActions(XkbDescPtr xkb,
+ xkbSetMapReq * req,
+ int nTypes,
+ CARD8 *mapWidths,
+ CARD16 *symsPerKey, CARD8 **wireRtrn, int *nActsRtrn)
{
-int nActs;
-CARD8 * wire = *wireRtrn;
-register unsigned i;
-
- if (!(XkbKeyActionsMask&req->present))
- return 1;
- CHK_REQ_KEY_RANGE2(0x21,req->firstKeyAct,req->nKeyActs,req,(*nActsRtrn),0);
- for (nActs=i=0;i<req->nKeyActs;i++) {
- if (wire[0]!=0) {
- if (wire[0]==symsPerKey[i+req->firstKeyAct])
- nActs+= wire[0];
- else {
- *nActsRtrn= _XkbErrCode3(0x23,i+req->firstKeyAct,wire[0]);
- return 0;
- }
- }
- wire++;
- }
- if (req->nKeyActs%4)
- wire+= 4-(req->nKeyActs%4);
- *wireRtrn = (CARD8 *)(((XkbAnyAction *)wire)+nActs);
+ int nActs;
+ CARD8 *wire = *wireRtrn;
+ register unsigned i;
+
+ if (!(XkbKeyActionsMask & req->present))
+ return 1;
+ CHK_REQ_KEY_RANGE2(0x21, req->firstKeyAct, req->nKeyActs, req, (*nActsRtrn),
+ 0);
+ for (nActs = i = 0; i < req->nKeyActs; i++) {
+ if (wire[0] != 0) {
+ if (wire[0] == symsPerKey[i + req->firstKeyAct])
+ nActs += wire[0];
+ else {
+ *nActsRtrn = _XkbErrCode3(0x23, i + req->firstKeyAct, wire[0]);
+ return 0;
+ }
+ }
+ wire++;
+ }
+ if (req->nKeyActs % 4)
+ wire += 4 - (req->nKeyActs % 4);
+ *wireRtrn = (CARD8 *) (((XkbAnyAction *) wire) + nActs);
*nActsRtrn = nActs;
return 1;
}
static int
-CheckKeyBehaviors( XkbDescPtr xkb,
- xkbSetMapReq * req,
- xkbBehaviorWireDesc ** wireRtrn,
- int * errorRtrn)
+CheckKeyBehaviors(XkbDescPtr xkb,
+ xkbSetMapReq * req,
+ xkbBehaviorWireDesc ** wireRtrn, int *errorRtrn)
{
-register xkbBehaviorWireDesc * wire = *wireRtrn;
-register XkbServerMapPtr server = xkb->server;
-register unsigned i;
-unsigned first,last;
-
- if (((req->present&XkbKeyBehaviorsMask)==0)||(req->nKeyBehaviors<1)) {
- req->present&= ~XkbKeyBehaviorsMask;
- req->nKeyBehaviors= 0;
- return 1;
- }
- first= req->firstKeyBehavior;
- last= req->firstKeyBehavior+req->nKeyBehaviors-1;
- if (first<req->minKeyCode) {
- *errorRtrn = _XkbErrCode3(0x31,first,req->minKeyCode);
- return 0;
- }
- if (last>req->maxKeyCode) {
- *errorRtrn = _XkbErrCode3(0x32,last,req->maxKeyCode);
- return 0;
- }
-
- for (i=0;i<req->totalKeyBehaviors;i++,wire++) {
- if ((wire->key<first)||(wire->key>last)) {
- *errorRtrn = _XkbErrCode4(0x33,first,last,wire->key);
- return 0;
- }
- if ((wire->type&XkbKB_Permanent)&&
- ((server->behaviors[wire->key].type!=wire->type)||
- (server->behaviors[wire->key].data!=wire->data))) {
- *errorRtrn = _XkbErrCode3(0x33,wire->key,wire->type);
- return 0;
- }
- if ((wire->type==XkbKB_RadioGroup)&&
- ((wire->data&(~XkbKB_RGAllowNone))>XkbMaxRadioGroups)) {
- *errorRtrn= _XkbErrCode4(0x34,wire->key,wire->data,
- XkbMaxRadioGroups);
- return 0;
- }
- if ((wire->type==XkbKB_Overlay1)||(wire->type==XkbKB_Overlay2)) {
- CHK_KEY_RANGE2(0x35,wire->key,1,xkb,*errorRtrn,0);
- }
+ register xkbBehaviorWireDesc *wire = *wireRtrn;
+ register XkbServerMapPtr server = xkb->server;
+ register unsigned i;
+ unsigned first, last;
+
+ if (((req->present & XkbKeyBehaviorsMask) == 0) || (req->nKeyBehaviors < 1)) {
+ req->present &= ~XkbKeyBehaviorsMask;
+ req->nKeyBehaviors = 0;
+ return 1;
+ }
+ first = req->firstKeyBehavior;
+ last = req->firstKeyBehavior + req->nKeyBehaviors - 1;
+ if (first < req->minKeyCode) {
+ *errorRtrn = _XkbErrCode3(0x31, first, req->minKeyCode);
+ return 0;
+ }
+ if (last > req->maxKeyCode) {
+ *errorRtrn = _XkbErrCode3(0x32, last, req->maxKeyCode);
+ return 0;
+ }
+
+ for (i = 0; i < req->totalKeyBehaviors; i++, wire++) {
+ if ((wire->key < first) || (wire->key > last)) {
+ *errorRtrn = _XkbErrCode4(0x33, first, last, wire->key);
+ return 0;
+ }
+ if ((wire->type & XkbKB_Permanent) &&
+ ((server->behaviors[wire->key].type != wire->type) ||
+ (server->behaviors[wire->key].data != wire->data))) {
+ *errorRtrn = _XkbErrCode3(0x33, wire->key, wire->type);
+ return 0;
+ }
+ if ((wire->type == XkbKB_RadioGroup) &&
+ ((wire->data & (~XkbKB_RGAllowNone)) > XkbMaxRadioGroups)) {
+ *errorRtrn = _XkbErrCode4(0x34, wire->key, wire->data,
+ XkbMaxRadioGroups);
+ return 0;
+ }
+ if ((wire->type == XkbKB_Overlay1) || (wire->type == XkbKB_Overlay2)) {
+ CHK_KEY_RANGE2(0x35, wire->key, 1, xkb, *errorRtrn, 0);
+ }
}
*wireRtrn = wire;
return 1;
}
static int
-CheckVirtualMods( XkbDescRec * xkb,
- xkbSetMapReq * req,
- CARD8 ** wireRtrn,
- int * errorRtrn)
+CheckVirtualMods(XkbDescRec * xkb,
+ xkbSetMapReq * req, CARD8 **wireRtrn, int *errorRtrn)
{
-register CARD8 *wire = *wireRtrn;
-register unsigned i,nMods,bit;
+ register CARD8 *wire = *wireRtrn;
+ register unsigned i, nMods, bit;
- if (((req->present&XkbVirtualModsMask)==0)||(req->virtualMods==0))
- return 1;
- for (i=nMods=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (req->virtualMods&bit)
- nMods++;
+ if (((req->present & XkbVirtualModsMask) == 0) || (req->virtualMods == 0))
+ return 1;
+ for (i = nMods = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if (req->virtualMods & bit)
+ nMods++;
}
- *wireRtrn= (wire+XkbPaddedSize(nMods));
+ *wireRtrn = (wire + XkbPaddedSize(nMods));
return 1;
}
static int
-CheckKeyExplicit( XkbDescPtr xkb,
- xkbSetMapReq * req,
- CARD8 ** wireRtrn,
- int * errorRtrn)
+CheckKeyExplicit(XkbDescPtr xkb,
+ xkbSetMapReq * req, CARD8 **wireRtrn, int *errorRtrn)
{
-register CARD8 * wire = *wireRtrn;
-CARD8 * start;
-register unsigned i;
-int first,last;
-
- if (((req->present&XkbExplicitComponentsMask)==0)||(req->nKeyExplicit<1)) {
- req->present&= ~XkbExplicitComponentsMask;
- req->nKeyExplicit= 0;
- return 1;
- }
- first= req->firstKeyExplicit;
- last= first+req->nKeyExplicit-1;
- if (first<req->minKeyCode) {
- *errorRtrn = _XkbErrCode3(0x51,first,req->minKeyCode);
- return 0;
- }
- if (last>req->maxKeyCode) {
- *errorRtrn = _XkbErrCode3(0x52,last,req->maxKeyCode);
- return 0;
- }
- start= wire;
- for (i=0;i<req->totalKeyExplicit;i++,wire+=2) {
- if ((wire[0]<first)||(wire[0]>last)) {
- *errorRtrn = _XkbErrCode4(0x53,first,last,wire[0]);
- return 0;
- }
- if (wire[1]&(~XkbAllExplicitMask)) {
- *errorRtrn= _XkbErrCode3(0x52,~XkbAllExplicitMask,wire[1]);
- return 0;
- }
- }
- wire+= XkbPaddedSize(wire-start)-(wire-start);
- *wireRtrn= wire;
+ register CARD8 *wire = *wireRtrn;
+ CARD8 *start;
+ register unsigned i;
+ int first, last;
+
+ if (((req->present & XkbExplicitComponentsMask) == 0) ||
+ (req->nKeyExplicit < 1)) {
+ req->present &= ~XkbExplicitComponentsMask;
+ req->nKeyExplicit = 0;
+ return 1;
+ }
+ first = req->firstKeyExplicit;
+ last = first + req->nKeyExplicit - 1;
+ if (first < req->minKeyCode) {
+ *errorRtrn = _XkbErrCode3(0x51, first, req->minKeyCode);
+ return 0;
+ }
+ if (last > req->maxKeyCode) {
+ *errorRtrn = _XkbErrCode3(0x52, last, req->maxKeyCode);
+ return 0;
+ }
+ start = wire;
+ for (i = 0; i < req->totalKeyExplicit; i++, wire += 2) {
+ if ((wire[0] < first) || (wire[0] > last)) {
+ *errorRtrn = _XkbErrCode4(0x53, first, last, wire[0]);
+ return 0;
+ }
+ if (wire[1] & (~XkbAllExplicitMask)) {
+ *errorRtrn = _XkbErrCode3(0x52, ~XkbAllExplicitMask, wire[1]);
+ return 0;
+ }
+ }
+ wire += XkbPaddedSize(wire - start) - (wire - start);
+ *wireRtrn = wire;
return 1;
}
static int
-CheckModifierMap(XkbDescPtr xkb,xkbSetMapReq *req,CARD8 **wireRtrn,int *errRtrn)
+CheckModifierMap(XkbDescPtr xkb, xkbSetMapReq * req, CARD8 **wireRtrn,
+ int *errRtrn)
{
-register CARD8 * wire = *wireRtrn;
-CARD8 * start;
-register unsigned i;
-int first,last;
-
- if (((req->present&XkbModifierMapMask)==0)||(req->nModMapKeys<1)) {
- req->present&= ~XkbModifierMapMask;
- req->nModMapKeys= 0;
- return 1;
- }
- first= req->firstModMapKey;
- last= first+req->nModMapKeys-1;
- if (first<req->minKeyCode) {
- *errRtrn = _XkbErrCode3(0x61,first,req->minKeyCode);
- return 0;
- }
- if (last>req->maxKeyCode) {
- *errRtrn = _XkbErrCode3(0x62,last,req->maxKeyCode);
- return 0;
- }
- start= wire;
- for (i=0;i<req->totalModMapKeys;i++,wire+=2) {
- if ((wire[0]<first)||(wire[0]>last)) {
- *errRtrn = _XkbErrCode4(0x63,first,last,wire[0]);
- return 0;
- }
- }
- wire+= XkbPaddedSize(wire-start)-(wire-start);
- *wireRtrn= wire;
+ register CARD8 *wire = *wireRtrn;
+ CARD8 *start;
+ register unsigned i;
+ int first, last;
+
+ if (((req->present & XkbModifierMapMask) == 0) || (req->nModMapKeys < 1)) {
+ req->present &= ~XkbModifierMapMask;
+ req->nModMapKeys = 0;
+ return 1;
+ }
+ first = req->firstModMapKey;
+ last = first + req->nModMapKeys - 1;
+ if (first < req->minKeyCode) {
+ *errRtrn = _XkbErrCode3(0x61, first, req->minKeyCode);
+ return 0;
+ }
+ if (last > req->maxKeyCode) {
+ *errRtrn = _XkbErrCode3(0x62, last, req->maxKeyCode);
+ return 0;
+ }
+ start = wire;
+ for (i = 0; i < req->totalModMapKeys; i++, wire += 2) {
+ if ((wire[0] < first) || (wire[0] > last)) {
+ *errRtrn = _XkbErrCode4(0x63, first, last, wire[0]);
+ return 0;
+ }
+ }
+ wire += XkbPaddedSize(wire - start) - (wire - start);
+ *wireRtrn = wire;
return 1;
}
static int
-CheckVirtualModMap( XkbDescPtr xkb,
- xkbSetMapReq *req,
- xkbVModMapWireDesc **wireRtrn,
- int *errRtrn)
+CheckVirtualModMap(XkbDescPtr xkb,
+ xkbSetMapReq * req,
+ xkbVModMapWireDesc ** wireRtrn, int *errRtrn)
{
-register xkbVModMapWireDesc * wire = *wireRtrn;
-register unsigned i;
-int first,last;
-
- if (((req->present&XkbVirtualModMapMask)==0)||(req->nVModMapKeys<1)) {
- req->present&= ~XkbVirtualModMapMask;
- req->nVModMapKeys= 0;
- return 1;
- }
- first= req->firstVModMapKey;
- last= first+req->nVModMapKeys-1;
- if (first<req->minKeyCode) {
- *errRtrn = _XkbErrCode3(0x71,first,req->minKeyCode);
- return 0;
- }
- if (last>req->maxKeyCode) {
- *errRtrn = _XkbErrCode3(0x72,last,req->maxKeyCode);
- return 0;
- }
- for (i=0;i<req->totalVModMapKeys;i++,wire++) {
- if ((wire->key<first)||(wire->key>last)) {
- *errRtrn = _XkbErrCode4(0x73,first,last,wire->key);
- return 0;
- }
- }
- *wireRtrn= wire;
+ register xkbVModMapWireDesc *wire = *wireRtrn;
+ register unsigned i;
+ int first, last;
+
+ if (((req->present & XkbVirtualModMapMask) == 0) || (req->nVModMapKeys < 1)) {
+ req->present &= ~XkbVirtualModMapMask;
+ req->nVModMapKeys = 0;
+ return 1;
+ }
+ first = req->firstVModMapKey;
+ last = first + req->nVModMapKeys - 1;
+ if (first < req->minKeyCode) {
+ *errRtrn = _XkbErrCode3(0x71, first, req->minKeyCode);
+ return 0;
+ }
+ if (last > req->maxKeyCode) {
+ *errRtrn = _XkbErrCode3(0x72, last, req->maxKeyCode);
+ return 0;
+ }
+ for (i = 0; i < req->totalVModMapKeys; i++, wire++) {
+ if ((wire->key < first) || (wire->key > last)) {
+ *errRtrn = _XkbErrCode4(0x73, first, last, wire->key);
+ return 0;
+ }
+ }
+ *wireRtrn = wire;
return 1;
}
static char *
-SetKeyTypes( XkbDescPtr xkb,
- xkbSetMapReq * req,
- xkbKeyTypeWireDesc * wire,
- XkbChangesPtr changes)
+SetKeyTypes(XkbDescPtr xkb,
+ xkbSetMapReq * req,
+ xkbKeyTypeWireDesc * wire, XkbChangesPtr changes)
{
-register unsigned i;
-unsigned first,last;
-CARD8 *map;
-
- if ((unsigned)(req->firstType+req->nTypes)>xkb->map->size_types) {
- i= req->firstType+req->nTypes;
- if (XkbAllocClientMap(xkb,XkbKeyTypesMask,i)!=Success) {
- return NULL;
- }
- }
- if ((unsigned)(req->firstType+req->nTypes)>xkb->map->num_types)
- xkb->map->num_types= req->firstType+req->nTypes;
-
- for (i=0;i<req->nTypes;i++) {
- XkbKeyTypePtr pOld;
- register unsigned n;
-
- if (XkbResizeKeyType(xkb,i+req->firstType,wire->nMapEntries,
- wire->preserve,wire->numLevels)!=Success) {
- return NULL;
- }
- pOld = &xkb->map->types[i+req->firstType];
- map = (CARD8 *)&wire[1];
-
- pOld->mods.real_mods = wire->realMods;
- pOld->mods.vmods= wire->virtualMods;
- pOld->num_levels = wire->numLevels;
- pOld->map_count= wire->nMapEntries;
-
- pOld->mods.mask= pOld->mods.real_mods|
- XkbMaskForVMask(xkb,pOld->mods.vmods);
-
- if (wire->nMapEntries) {
- xkbKTSetMapEntryWireDesc *mapWire;
- xkbModsWireDesc *preWire;
- unsigned tmp;
- mapWire= (xkbKTSetMapEntryWireDesc *)map;
- preWire= (xkbModsWireDesc *)&mapWire[wire->nMapEntries];
- for (n=0;n<wire->nMapEntries;n++) {
- pOld->map[n].active= 1;
- pOld->map[n].mods.mask= mapWire[n].realMods;
- pOld->map[n].mods.real_mods= mapWire[n].realMods;
- pOld->map[n].mods.vmods= mapWire[n].virtualMods;
- pOld->map[n].level= mapWire[n].level;
- if (mapWire[n].virtualMods!=0) {
- tmp= XkbMaskForVMask(xkb,mapWire[n].virtualMods);
- pOld->map[n].active= (tmp!=0);
- pOld->map[n].mods.mask|= tmp;
- }
- if (wire->preserve) {
- pOld->preserve[n].real_mods= preWire[n].realMods;
- pOld->preserve[n].vmods= preWire[n].virtualMods;
- tmp= XkbMaskForVMask(xkb,preWire[n].virtualMods);
- pOld->preserve[n].mask= preWire[n].realMods|tmp;
- }
- }
- if (wire->preserve)
- map= (CARD8 *)&preWire[wire->nMapEntries];
- else map= (CARD8 *)&mapWire[wire->nMapEntries];
- }
- else map= (CARD8 *)&wire[1];
- wire = (xkbKeyTypeWireDesc *)map;
- }
- first= req->firstType;
- last= first+req->nTypes-1; /* last changed type */
- if (changes->map.changed&XkbKeyTypesMask) {
- int oldLast;
- oldLast= changes->map.first_type+changes->map.num_types-1;
- if (changes->map.first_type<first)
- first= changes->map.first_type;
- if (oldLast>last)
- last= oldLast;
- }
- changes->map.changed|= XkbKeyTypesMask;
+ register unsigned i;
+ unsigned first, last;
+ CARD8 *map;
+
+ if ((unsigned) (req->firstType + req->nTypes) > xkb->map->size_types) {
+ i = req->firstType + req->nTypes;
+ if (XkbAllocClientMap(xkb, XkbKeyTypesMask, i) != Success) {
+ return NULL;
+ }
+ }
+ if ((unsigned) (req->firstType + req->nTypes) > xkb->map->num_types)
+ xkb->map->num_types = req->firstType + req->nTypes;
+
+ for (i = 0; i < req->nTypes; i++) {
+ XkbKeyTypePtr pOld;
+ register unsigned n;
+
+ if (XkbResizeKeyType(xkb, i + req->firstType, wire->nMapEntries,
+ wire->preserve, wire->numLevels) != Success) {
+ return NULL;
+ }
+ pOld = &xkb->map->types[i + req->firstType];
+ map = (CARD8 *) &wire[1];
+
+ pOld->mods.real_mods = wire->realMods;
+ pOld->mods.vmods = wire->virtualMods;
+ pOld->num_levels = wire->numLevels;
+ pOld->map_count = wire->nMapEntries;
+
+ pOld->mods.mask = pOld->mods.real_mods |
+ XkbMaskForVMask(xkb, pOld->mods.vmods);
+
+ if (wire->nMapEntries) {
+ xkbKTSetMapEntryWireDesc *mapWire;
+ xkbModsWireDesc *preWire;
+ unsigned tmp;
+
+ mapWire = (xkbKTSetMapEntryWireDesc *) map;
+ preWire = (xkbModsWireDesc *) & mapWire[wire->nMapEntries];
+ for (n = 0; n < wire->nMapEntries; n++) {
+ pOld->map[n].active = 1;
+ pOld->map[n].mods.mask = mapWire[n].realMods;
+ pOld->map[n].mods.real_mods = mapWire[n].realMods;
+ pOld->map[n].mods.vmods = mapWire[n].virtualMods;
+ pOld->map[n].level = mapWire[n].level;
+ if (mapWire[n].virtualMods != 0) {
+ tmp = XkbMaskForVMask(xkb, mapWire[n].virtualMods);
+ pOld->map[n].active = (tmp != 0);
+ pOld->map[n].mods.mask |= tmp;
+ }
+ if (wire->preserve) {
+ pOld->preserve[n].real_mods = preWire[n].realMods;
+ pOld->preserve[n].vmods = preWire[n].virtualMods;
+ tmp = XkbMaskForVMask(xkb, preWire[n].virtualMods);
+ pOld->preserve[n].mask = preWire[n].realMods | tmp;
+ }
+ }
+ if (wire->preserve)
+ map = (CARD8 *) &preWire[wire->nMapEntries];
+ else
+ map = (CARD8 *) &mapWire[wire->nMapEntries];
+ }
+ else
+ map = (CARD8 *) &wire[1];
+ wire = (xkbKeyTypeWireDesc *) map;
+ }
+ first = req->firstType;
+ last = first + req->nTypes - 1; /* last changed type */
+ if (changes->map.changed & XkbKeyTypesMask) {
+ int oldLast;
+
+ oldLast = changes->map.first_type + changes->map.num_types - 1;
+ if (changes->map.first_type < first)
+ first = changes->map.first_type;
+ if (oldLast > last)
+ last = oldLast;
+ }
+ changes->map.changed |= XkbKeyTypesMask;
changes->map.first_type = first;
- changes->map.num_types = (last-first)+1;
- return (char *)wire;
+ changes->map.num_types = (last - first) + 1;
+ return (char *) wire;
}
static char *
-SetKeySyms( ClientPtr client,
- XkbDescPtr xkb,
- xkbSetMapReq * req,
- xkbSymMapWireDesc * wire,
- XkbChangesPtr changes,
- DeviceIntPtr dev)
+SetKeySyms(ClientPtr client,
+ XkbDescPtr xkb,
+ xkbSetMapReq * req,
+ xkbSymMapWireDesc * wire, XkbChangesPtr changes, DeviceIntPtr dev)
{
-register unsigned i,s;
-XkbSymMapPtr oldMap;
-KeySym * newSyms;
-KeySym * pSyms;
-unsigned first,last;
+ register unsigned i, s;
+ XkbSymMapPtr oldMap;
+ KeySym *newSyms;
+ KeySym *pSyms;
+ unsigned first, last;
oldMap = &xkb->map->key_sym_map[req->firstKeySym];
- for (i=0;i<req->nKeySyms;i++,oldMap++) {
- pSyms = (KeySym *)&wire[1];
- if (wire->nSyms>0) {
- newSyms = XkbResizeKeySyms(xkb,i+req->firstKeySym,wire->nSyms);
- for (s=0;s<wire->nSyms;s++) {
- newSyms[s]= pSyms[s];
- }
- if (client->swapped) {
- for (s=0;s<wire->nSyms;s++) {
- swapl(&newSyms[s]);
- }
- }
- }
- oldMap->kt_index[0] = wire->ktIndex[0];
- oldMap->kt_index[1] = wire->ktIndex[1];
- oldMap->kt_index[2] = wire->ktIndex[2];
- oldMap->kt_index[3] = wire->ktIndex[3];
- oldMap->group_info = wire->groupInfo;
- oldMap->width = wire->width;
- wire= (xkbSymMapWireDesc *)&pSyms[wire->nSyms];
- }
- first= req->firstKeySym;
- last= first+req->nKeySyms-1;
- if (changes->map.changed&XkbKeySymsMask) {
- int oldLast= (changes->map.first_key_sym+changes->map.num_key_syms-1);
- if (changes->map.first_key_sym<first)
- first= changes->map.first_key_sym;
- if (oldLast>last)
- last= oldLast;
- }
- changes->map.changed|= XkbKeySymsMask;
+ for (i = 0; i < req->nKeySyms; i++, oldMap++) {
+ pSyms = (KeySym *) & wire[1];
+ if (wire->nSyms > 0) {
+ newSyms = XkbResizeKeySyms(xkb, i + req->firstKeySym, wire->nSyms);
+ for (s = 0; s < wire->nSyms; s++) {
+ newSyms[s] = pSyms[s];
+ }
+ if (client->swapped) {
+ for (s = 0; s < wire->nSyms; s++) {
+ swapl(&newSyms[s]);
+ }
+ }
+ }
+ oldMap->kt_index[0] = wire->ktIndex[0];
+ oldMap->kt_index[1] = wire->ktIndex[1];
+ oldMap->kt_index[2] = wire->ktIndex[2];
+ oldMap->kt_index[3] = wire->ktIndex[3];
+ oldMap->group_info = wire->groupInfo;
+ oldMap->width = wire->width;
+ wire = (xkbSymMapWireDesc *) & pSyms[wire->nSyms];
+ }
+ first = req->firstKeySym;
+ last = first + req->nKeySyms - 1;
+ if (changes->map.changed & XkbKeySymsMask) {
+ int oldLast =
+ (changes->map.first_key_sym + changes->map.num_key_syms - 1);
+ if (changes->map.first_key_sym < first)
+ first = changes->map.first_key_sym;
+ if (oldLast > last)
+ last = oldLast;
+ }
+ changes->map.changed |= XkbKeySymsMask;
changes->map.first_key_sym = first;
- changes->map.num_key_syms = (last-first+1);
-
- s= 0;
- for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- if (XkbKeyNumGroups(xkb,i)>s)
- s= XkbKeyNumGroups(xkb,i);
- }
- if (s!=xkb->ctrls->num_groups) {
- xkbControlsNotify cn;
- XkbControlsRec old;
- cn.keycode= 0;
- cn.eventType= 0;
- cn.requestMajor= XkbReqCode;
- cn.requestMinor= X_kbSetMap;
- old= *xkb->ctrls;
- xkb->ctrls->num_groups= s;
- if (XkbComputeControlsNotify(dev,&old,xkb->ctrls,&cn,FALSE))
- XkbSendControlsNotify(dev,&cn);
- }
- return (char *)wire;
+ changes->map.num_key_syms = (last - first + 1);
+
+ s = 0;
+ for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ if (XkbKeyNumGroups(xkb, i) > s)
+ s = XkbKeyNumGroups(xkb, i);
+ }
+ if (s != xkb->ctrls->num_groups) {
+ xkbControlsNotify cn;
+ XkbControlsRec old;
+
+ cn.keycode = 0;
+ cn.eventType = 0;
+ cn.requestMajor = XkbReqCode;
+ cn.requestMinor = X_kbSetMap;
+ old = *xkb->ctrls;
+ xkb->ctrls->num_groups = s;
+ if (XkbComputeControlsNotify(dev, &old, xkb->ctrls, &cn, FALSE))
+ XkbSendControlsNotify(dev, &cn);
+ }
+ return (char *) wire;
}
static char *
-SetKeyActions( XkbDescPtr xkb,
- xkbSetMapReq * req,
- CARD8 * wire,
- XkbChangesPtr changes)
+SetKeyActions(XkbDescPtr xkb,
+ xkbSetMapReq * req, CARD8 *wire, XkbChangesPtr changes)
{
-register unsigned i,first,last;
-CARD8 * nActs = wire;
-XkbAction * newActs;
-
- wire+= XkbPaddedSize(req->nKeyActs);
- for (i=0;i<req->nKeyActs;i++) {
- if (nActs[i]==0)
- xkb->server->key_acts[i+req->firstKeyAct]= 0;
- else {
- newActs= XkbResizeKeyActions(xkb,i+req->firstKeyAct,nActs[i]);
- memcpy((char *)newActs,(char *)wire,
- nActs[i]*SIZEOF(xkbActionWireDesc));
- wire+= nActs[i]*SIZEOF(xkbActionWireDesc);
- }
- }
- first= req->firstKeyAct;
- last= (first+req->nKeyActs-1);
- if (changes->map.changed&XkbKeyActionsMask) {
- int oldLast;
- oldLast= changes->map.first_key_act+changes->map.num_key_acts-1;
- if (changes->map.first_key_act<first)
- first= changes->map.first_key_act;
- if (oldLast>last)
- last= oldLast;
- }
- changes->map.changed|= XkbKeyActionsMask;
- changes->map.first_key_act= first;
- changes->map.num_key_acts= (last-first+1);
- return (char *)wire;
+ register unsigned i, first, last;
+ CARD8 *nActs = wire;
+ XkbAction *newActs;
+
+ wire += XkbPaddedSize(req->nKeyActs);
+ for (i = 0; i < req->nKeyActs; i++) {
+ if (nActs[i] == 0)
+ xkb->server->key_acts[i + req->firstKeyAct] = 0;
+ else {
+ newActs = XkbResizeKeyActions(xkb, i + req->firstKeyAct, nActs[i]);
+ memcpy((char *) newActs, (char *) wire,
+ nActs[i] * SIZEOF(xkbActionWireDesc));
+ wire += nActs[i] * SIZEOF(xkbActionWireDesc);
+ }
+ }
+ first = req->firstKeyAct;
+ last = (first + req->nKeyActs - 1);
+ if (changes->map.changed & XkbKeyActionsMask) {
+ int oldLast;
+
+ oldLast = changes->map.first_key_act + changes->map.num_key_acts - 1;
+ if (changes->map.first_key_act < first)
+ first = changes->map.first_key_act;
+ if (oldLast > last)
+ last = oldLast;
+ }
+ changes->map.changed |= XkbKeyActionsMask;
+ changes->map.first_key_act = first;
+ changes->map.num_key_acts = (last - first + 1);
+ return (char *) wire;
}
static char *
-SetKeyBehaviors( XkbSrvInfoPtr xkbi,
- xkbSetMapReq *req,
- xkbBehaviorWireDesc *wire,
- XkbChangesPtr changes)
+SetKeyBehaviors(XkbSrvInfoPtr xkbi,
+ xkbSetMapReq * req,
+ xkbBehaviorWireDesc * wire, XkbChangesPtr changes)
{
-register unsigned i;
-int maxRG = -1;
-XkbDescPtr xkb = xkbi->desc;
-XkbServerMapPtr server = xkb->server;
-unsigned first,last;
-
- first= req->firstKeyBehavior;
- last= req->firstKeyBehavior+req->nKeyBehaviors-1;
- memset(&server->behaviors[first], 0, req->nKeyBehaviors*sizeof(XkbBehavior));
- for (i=0;i<req->totalKeyBehaviors;i++) {
- if ((server->behaviors[wire->key].type&XkbKB_Permanent)==0) {
- server->behaviors[wire->key].type= wire->type;
- server->behaviors[wire->key].data= wire->data;
- if ((wire->type==XkbKB_RadioGroup)&&(((int)wire->data)>maxRG))
- maxRG= wire->data + 1;
- }
- wire++;
- }
-
- if (maxRG>(int)xkbi->nRadioGroups) {
- int sz = maxRG*sizeof(XkbRadioGroupRec);
+ register unsigned i;
+ int maxRG = -1;
+ XkbDescPtr xkb = xkbi->desc;
+ XkbServerMapPtr server = xkb->server;
+ unsigned first, last;
+
+ first = req->firstKeyBehavior;
+ last = req->firstKeyBehavior + req->nKeyBehaviors - 1;
+ memset(&server->behaviors[first], 0,
+ req->nKeyBehaviors * sizeof(XkbBehavior));
+ for (i = 0; i < req->totalKeyBehaviors; i++) {
+ if ((server->behaviors[wire->key].type & XkbKB_Permanent) == 0) {
+ server->behaviors[wire->key].type = wire->type;
+ server->behaviors[wire->key].data = wire->data;
+ if ((wire->type == XkbKB_RadioGroup) &&
+ (((int) wire->data) > maxRG))
+ maxRG = wire->data + 1;
+ }
+ wire++;
+ }
+
+ if (maxRG > (int) xkbi->nRadioGroups) {
+ int sz = maxRG * sizeof(XkbRadioGroupRec);
+
if (xkbi->radioGroups)
- xkbi->radioGroups= realloc(xkbi->radioGroups,sz);
- else xkbi->radioGroups= calloc(1, sz);
+ xkbi->radioGroups = realloc(xkbi->radioGroups, sz);
+ else
+ xkbi->radioGroups = calloc(1, sz);
if (xkbi->radioGroups) {
- if (xkbi->nRadioGroups)
- memset(&xkbi->radioGroups[xkbi->nRadioGroups], 0,
- (maxRG-xkbi->nRadioGroups)*sizeof(XkbRadioGroupRec));
- xkbi->nRadioGroups= maxRG;
+ if (xkbi->nRadioGroups)
+ memset(&xkbi->radioGroups[xkbi->nRadioGroups], 0,
+ (maxRG - xkbi->nRadioGroups) * sizeof(XkbRadioGroupRec));
+ xkbi->nRadioGroups = maxRG;
}
- else xkbi->nRadioGroups= 0;
+ else
+ xkbi->nRadioGroups = 0;
/* should compute members here */
}
- if (changes->map.changed&XkbKeyBehaviorsMask) {
- unsigned oldLast;
- oldLast= changes->map.first_key_behavior+
- changes->map.num_key_behaviors-1;
- if (changes->map.first_key_behavior<req->firstKeyBehavior)
- first= changes->map.first_key_behavior;
- if (oldLast>last)
- last= oldLast;
+ if (changes->map.changed & XkbKeyBehaviorsMask) {
+ unsigned oldLast;
+
+ oldLast = changes->map.first_key_behavior +
+ changes->map.num_key_behaviors - 1;
+ if (changes->map.first_key_behavior < req->firstKeyBehavior)
+ first = changes->map.first_key_behavior;
+ if (oldLast > last)
+ last = oldLast;
}
- changes->map.changed|= XkbKeyBehaviorsMask;
+ changes->map.changed |= XkbKeyBehaviorsMask;
changes->map.first_key_behavior = first;
- changes->map.num_key_behaviors = (last-first+1);
- return (char *)wire;
+ changes->map.num_key_behaviors = (last - first + 1);
+ return (char *) wire;
}
static char *
-SetVirtualMods(XkbSrvInfoPtr xkbi,xkbSetMapReq *req,CARD8 *wire,
- XkbChangesPtr changes)
+SetVirtualMods(XkbSrvInfoPtr xkbi, xkbSetMapReq * req, CARD8 *wire,
+ XkbChangesPtr changes)
{
-register int i,bit,nMods;
-XkbServerMapPtr srv = xkbi->desc->server;
-
- if (((req->present&XkbVirtualModsMask)==0)||(req->virtualMods==0))
- return (char *)wire;
- for (i=nMods=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (req->virtualMods&bit) {
- if (srv->vmods[i]!=wire[nMods]) {
- changes->map.changed|= XkbVirtualModsMask;
- changes->map.vmods|= bit;
- srv->vmods[i]= wire[nMods];
- }
- nMods++;
- }
- }
- return (char *)(wire+XkbPaddedSize(nMods));
+ register int i, bit, nMods;
+ XkbServerMapPtr srv = xkbi->desc->server;
+
+ if (((req->present & XkbVirtualModsMask) == 0) || (req->virtualMods == 0))
+ return (char *) wire;
+ for (i = nMods = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if (req->virtualMods & bit) {
+ if (srv->vmods[i] != wire[nMods]) {
+ changes->map.changed |= XkbVirtualModsMask;
+ changes->map.vmods |= bit;
+ srv->vmods[i] = wire[nMods];
+ }
+ nMods++;
+ }
+ }
+ return (char *) (wire + XkbPaddedSize(nMods));
}
static char *
-SetKeyExplicit(XkbSrvInfoPtr xkbi,xkbSetMapReq *req,CARD8 *wire,
- XkbChangesPtr changes)
+SetKeyExplicit(XkbSrvInfoPtr xkbi, xkbSetMapReq * req, CARD8 *wire,
+ XkbChangesPtr changes)
{
-register unsigned i,first,last;
-XkbServerMapPtr xkb = xkbi->desc->server;
-CARD8 * start;
+ register unsigned i, first, last;
+ XkbServerMapPtr xkb = xkbi->desc->server;
+ CARD8 *start;
- start= wire;
- first= req->firstKeyExplicit;
- last= req->firstKeyExplicit+req->nKeyExplicit-1;
+ start = wire;
+ first = req->firstKeyExplicit;
+ last = req->firstKeyExplicit + req->nKeyExplicit - 1;
memset(&xkb->explicit[first], 0, req->nKeyExplicit);
- for (i=0;i<req->totalKeyExplicit;i++,wire+= 2) {
- xkb->explicit[wire[0]]= wire[1];
- }
- if (first>0) {
- if (changes->map.changed&XkbExplicitComponentsMask) {
- int oldLast;
- oldLast= changes->map.first_key_explicit+
- changes->map.num_key_explicit-1;
- if (changes->map.first_key_explicit<first)
- first= changes->map.first_key_explicit;
- if (oldLast>last)
- last= oldLast;
- }
- changes->map.first_key_explicit= first;
- changes->map.num_key_explicit= (last-first)+1;
- }
- wire+= XkbPaddedSize(wire-start)-(wire-start);
- return (char *)wire;
+ for (i = 0; i < req->totalKeyExplicit; i++, wire += 2) {
+ xkb->explicit[wire[0]] = wire[1];
+ }
+ if (first > 0) {
+ if (changes->map.changed & XkbExplicitComponentsMask) {
+ int oldLast;
+
+ oldLast = changes->map.first_key_explicit +
+ changes->map.num_key_explicit - 1;
+ if (changes->map.first_key_explicit < first)
+ first = changes->map.first_key_explicit;
+ if (oldLast > last)
+ last = oldLast;
+ }
+ changes->map.first_key_explicit = first;
+ changes->map.num_key_explicit = (last - first) + 1;
+ }
+ wire += XkbPaddedSize(wire - start) - (wire - start);
+ return (char *) wire;
}
static char *
-SetModifierMap( XkbSrvInfoPtr xkbi,
- xkbSetMapReq * req,
- CARD8 * wire,
- XkbChangesPtr changes)
+SetModifierMap(XkbSrvInfoPtr xkbi,
+ xkbSetMapReq * req, CARD8 *wire, XkbChangesPtr changes)
{
-register unsigned i,first,last;
-XkbClientMapPtr xkb = xkbi->desc->map;
-CARD8 * start;
+ register unsigned i, first, last;
+ XkbClientMapPtr xkb = xkbi->desc->map;
+ CARD8 *start;
- start= wire;
- first= req->firstModMapKey;
- last= req->firstModMapKey+req->nModMapKeys-1;
+ start = wire;
+ first = req->firstModMapKey;
+ last = req->firstModMapKey + req->nModMapKeys - 1;
memset(&xkb->modmap[first], 0, req->nModMapKeys);
- for (i=0;i<req->totalModMapKeys;i++,wire+= 2) {
- xkb->modmap[wire[0]]= wire[1];
- }
- if (first>0) {
- if (changes->map.changed&XkbModifierMapMask) {
- int oldLast;
- oldLast= changes->map.first_modmap_key+
- changes->map.num_modmap_keys-1;
- if (changes->map.first_modmap_key<first)
- first= changes->map.first_modmap_key;
- if (oldLast>last)
- last= oldLast;
- }
- changes->map.first_modmap_key= first;
- changes->map.num_modmap_keys= (last-first)+1;
- }
- wire+= XkbPaddedSize(wire-start)-(wire-start);
- return (char *)wire;
+ for (i = 0; i < req->totalModMapKeys; i++, wire += 2) {
+ xkb->modmap[wire[0]] = wire[1];
+ }
+ if (first > 0) {
+ if (changes->map.changed & XkbModifierMapMask) {
+ int oldLast;
+
+ oldLast = changes->map.first_modmap_key +
+ changes->map.num_modmap_keys - 1;
+ if (changes->map.first_modmap_key < first)
+ first = changes->map.first_modmap_key;
+ if (oldLast > last)
+ last = oldLast;
+ }
+ changes->map.first_modmap_key = first;
+ changes->map.num_modmap_keys = (last - first) + 1;
+ }
+ wire += XkbPaddedSize(wire - start) - (wire - start);
+ return (char *) wire;
}
static char *
-SetVirtualModMap( XkbSrvInfoPtr xkbi,
- xkbSetMapReq * req,
- xkbVModMapWireDesc * wire,
- XkbChangesPtr changes)
+SetVirtualModMap(XkbSrvInfoPtr xkbi,
+ xkbSetMapReq * req,
+ xkbVModMapWireDesc * wire, XkbChangesPtr changes)
{
-register unsigned i,first,last;
-XkbServerMapPtr srv = xkbi->desc->server;
-
- first= req->firstVModMapKey;
- last= req->firstVModMapKey+req->nVModMapKeys-1;
- memset(&srv->vmodmap[first], 0, req->nVModMapKeys*sizeof(unsigned short));
- for (i=0;i<req->totalVModMapKeys;i++,wire++) {
- srv->vmodmap[wire->key]= wire->vmods;
- }
- if (first>0) {
- if (changes->map.changed&XkbVirtualModMapMask) {
- int oldLast;
- oldLast= changes->map.first_vmodmap_key+
- changes->map.num_vmodmap_keys-1;
- if (changes->map.first_vmodmap_key<first)
- first= changes->map.first_vmodmap_key;
- if (oldLast>last)
- last= oldLast;
- }
- changes->map.first_vmodmap_key= first;
- changes->map.num_vmodmap_keys= (last-first)+1;
- }
- return (char *)wire;
+ register unsigned i, first, last;
+ XkbServerMapPtr srv = xkbi->desc->server;
+
+ first = req->firstVModMapKey;
+ last = req->firstVModMapKey + req->nVModMapKeys - 1;
+ memset(&srv->vmodmap[first], 0, req->nVModMapKeys * sizeof(unsigned short));
+ for (i = 0; i < req->totalVModMapKeys; i++, wire++) {
+ srv->vmodmap[wire->key] = wire->vmods;
+ }
+ if (first > 0) {
+ if (changes->map.changed & XkbVirtualModMapMask) {
+ int oldLast;
+
+ oldLast = changes->map.first_vmodmap_key +
+ changes->map.num_vmodmap_keys - 1;
+ if (changes->map.first_vmodmap_key < first)
+ first = changes->map.first_vmodmap_key;
+ if (oldLast > last)
+ last = oldLast;
+ }
+ changes->map.first_vmodmap_key = first;
+ changes->map.num_vmodmap_keys = (last - first) + 1;
+ }
+ return (char *) wire;
}
/**
@@ -2317,106 +2365,112 @@ XkbServerMapPtr srv = xkbi->desc->server;
* actually do anything..
*/
static int
-_XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char* values)
+_XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req,
+ char *values)
{
- XkbSrvInfoPtr xkbi;
- XkbDescPtr xkb;
- int error;
- int nTypes = 0, nActions;
- CARD8 mapWidths[XkbMaxLegalKeyCode + 1] = {0};
- CARD16 symsPerKey[XkbMaxLegalKeyCode + 1] = {0};
- XkbSymMapPtr map;
- int i;
-
- xkbi= dev->key->xkbInfo;
+ XkbSrvInfoPtr xkbi;
+ XkbDescPtr xkb;
+ int error;
+ int nTypes = 0, nActions;
+ CARD8 mapWidths[XkbMaxLegalKeyCode + 1] = { 0 };
+ CARD16 symsPerKey[XkbMaxLegalKeyCode + 1] = { 0 };
+ XkbSymMapPtr map;
+ int i;
+
+ xkbi = dev->key->xkbInfo;
xkb = xkbi->desc;
- if ((xkb->min_key_code != req->minKeyCode)||
+ if ((xkb->min_key_code != req->minKeyCode) ||
(xkb->max_key_code != req->maxKeyCode)) {
- if (client->vMajor!=1) { /* pre 1.0 versions of Xlib have a bug */
- req->minKeyCode= xkb->min_key_code;
- req->maxKeyCode= xkb->max_key_code;
- }
- else {
- if (!XkbIsLegalKeycode(req->minKeyCode)) {
- client->errorValue = _XkbErrCode3(2, req->minKeyCode, req->maxKeyCode);
- return BadValue;
- }
- if (req->minKeyCode > req->maxKeyCode) {
- client->errorValue = _XkbErrCode3(3, req->minKeyCode, req->maxKeyCode);
- return BadMatch;
- }
- }
+ if (client->vMajor != 1) { /* pre 1.0 versions of Xlib have a bug */
+ req->minKeyCode = xkb->min_key_code;
+ req->maxKeyCode = xkb->max_key_code;
+ }
+ else {
+ if (!XkbIsLegalKeycode(req->minKeyCode)) {
+ client->errorValue =
+ _XkbErrCode3(2, req->minKeyCode, req->maxKeyCode);
+ return BadValue;
+ }
+ if (req->minKeyCode > req->maxKeyCode) {
+ client->errorValue =
+ _XkbErrCode3(3, req->minKeyCode, req->maxKeyCode);
+ return BadMatch;
+ }
+ }
}
if ((req->present & XkbKeyTypesMask) &&
- (!CheckKeyTypes(client,xkb,req,(xkbKeyTypeWireDesc **)&values,
- &nTypes,mapWidths))) {
- client->errorValue = nTypes;
- return BadValue;
+ (!CheckKeyTypes(client, xkb, req, (xkbKeyTypeWireDesc **) & values,
+ &nTypes, mapWidths))) {
+ client->errorValue = nTypes;
+ return BadValue;
}
/* symsPerKey/mapWidths must be filled regardless of client-side flags */
map = &xkb->map->key_sym_map[xkb->min_key_code];
- for (i=xkb->min_key_code;i<xkb->max_key_code;i++,map++) {
- register int g,ng,w;
- ng= XkbNumGroups(map->group_info);
- for (w=g=0;g<ng;g++) {
- if (map->kt_index[g]>=(unsigned)nTypes) {
- client->errorValue = _XkbErrCode4(0x13,i,g,map->kt_index[g]);
- return 0;
- }
- if (mapWidths[map->kt_index[g]]>w)
- w= mapWidths[map->kt_index[g]];
- }
- symsPerKey[i] = w*ng;
+ for (i = xkb->min_key_code; i < xkb->max_key_code; i++, map++) {
+ register int g, ng, w;
+
+ ng = XkbNumGroups(map->group_info);
+ for (w = g = 0; g < ng; g++) {
+ if (map->kt_index[g] >= (unsigned) nTypes) {
+ client->errorValue = _XkbErrCode4(0x13, i, g, map->kt_index[g]);
+ return 0;
+ }
+ if (mapWidths[map->kt_index[g]] > w)
+ w = mapWidths[map->kt_index[g]];
+ }
+ symsPerKey[i] = w * ng;
}
if ((req->present & XkbKeySymsMask) &&
- (!CheckKeySyms(client,xkb,req,nTypes,mapWidths,symsPerKey,
- (xkbSymMapWireDesc **)&values,&error))) {
- client->errorValue = error;
- return BadValue;
+ (!CheckKeySyms(client, xkb, req, nTypes, mapWidths, symsPerKey,
+ (xkbSymMapWireDesc **) & values, &error))) {
+ client->errorValue = error;
+ return BadValue;
}
if ((req->present & XkbKeyActionsMask) &&
- (!CheckKeyActions(xkb,req,nTypes,mapWidths,symsPerKey,
- (CARD8 **)&values,&nActions))) {
- client->errorValue = nActions;
- return BadValue;
+ (!CheckKeyActions(xkb, req, nTypes, mapWidths, symsPerKey,
+ (CARD8 **) &values, &nActions))) {
+ client->errorValue = nActions;
+ return BadValue;
}
if ((req->present & XkbKeyBehaviorsMask) &&
- (!CheckKeyBehaviors(xkb,req,(xkbBehaviorWireDesc**)&values,&error))) {
- client->errorValue = error;
- return BadValue;
+ (!CheckKeyBehaviors
+ (xkb, req, (xkbBehaviorWireDesc **) & values, &error))) {
+ client->errorValue = error;
+ return BadValue;
}
if ((req->present & XkbVirtualModsMask) &&
- (!CheckVirtualMods(xkb,req,(CARD8 **)&values,&error))) {
- client->errorValue= error;
- return BadValue;
+ (!CheckVirtualMods(xkb, req, (CARD8 **) &values, &error))) {
+ client->errorValue = error;
+ return BadValue;
}
- if ((req->present&XkbExplicitComponentsMask) &&
- (!CheckKeyExplicit(xkb,req,(CARD8 **)&values,&error))) {
- client->errorValue= error;
- return BadValue;
+ if ((req->present & XkbExplicitComponentsMask) &&
+ (!CheckKeyExplicit(xkb, req, (CARD8 **) &values, &error))) {
+ client->errorValue = error;
+ return BadValue;
}
- if ((req->present&XkbModifierMapMask) &&
- (!CheckModifierMap(xkb,req,(CARD8 **)&values,&error))) {
- client->errorValue= error;
- return BadValue;
+ if ((req->present & XkbModifierMapMask) &&
+ (!CheckModifierMap(xkb, req, (CARD8 **) &values, &error))) {
+ client->errorValue = error;
+ return BadValue;
}
- if ((req->present&XkbVirtualModMapMask) &&
- (!CheckVirtualModMap(xkb,req,(xkbVModMapWireDesc **)&values,&error))) {
- client->errorValue= error;
- return BadValue;
+ if ((req->present & XkbVirtualModMapMask) &&
+ (!CheckVirtualModMap
+ (xkb, req, (xkbVModMapWireDesc **) & values, &error))) {
+ client->errorValue = error;
+ return BadValue;
}
- if (((values-((char *)req))/4)!= req->length) {
- ErrorF("[xkb] Internal error! Bad length in XkbSetMap (after check)\n");
- client->errorValue = values-((char *)&req[1]);
- return BadLength;
+ if (((values - ((char *) req)) / 4) != req->length) {
+ ErrorF("[xkb] Internal error! Bad length in XkbSetMap (after check)\n");
+ client->errorValue = values - ((char *) &req[1]);
+ return BadLength;
}
return Success;
@@ -2426,124 +2480,137 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char* va
* Apply the given request on the given device.
*/
static int
-_XkbSetMap(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char *values)
+_XkbSetMap(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req, char *values)
{
- XkbEventCauseRec cause;
- XkbChangesRec change;
- Bool sentNKN;
- XkbSrvInfoPtr xkbi;
- XkbDescPtr xkb;
+ XkbEventCauseRec cause;
+ XkbChangesRec change;
+ Bool sentNKN;
+ XkbSrvInfoPtr xkbi;
+ XkbDescPtr xkb;
- xkbi= dev->key->xkbInfo;
+ xkbi = dev->key->xkbInfo;
xkb = xkbi->desc;
- XkbSetCauseXkbReq(&cause,X_kbSetMap,client);
+ XkbSetCauseXkbReq(&cause, X_kbSetMap, client);
memset(&change, 0, sizeof(change));
sentNKN = FALSE;
- if ((xkb->min_key_code!=req->minKeyCode)||
- (xkb->max_key_code!=req->maxKeyCode)) {
- Status status;
- xkbNewKeyboardNotify nkn;
- nkn.deviceID = nkn.oldDeviceID = dev->id;
- nkn.oldMinKeyCode = xkb->min_key_code;
- nkn.oldMaxKeyCode = xkb->max_key_code;
- status= XkbChangeKeycodeRange(xkb, req->minKeyCode,
- req->maxKeyCode, &change);
- if (status != Success)
- return status; /* oh-oh. what about the other keyboards? */
- nkn.minKeyCode = xkb->min_key_code;
- nkn.maxKeyCode = xkb->max_key_code;
- nkn.requestMajor = XkbReqCode;
- nkn.requestMinor = X_kbSetMap;
- nkn.changed = XkbNKN_KeycodesMask;
- XkbSendNewKeyboardNotify(dev,&nkn);
- sentNKN = TRUE;
- }
-
- if (req->present&XkbKeyTypesMask) {
- values = SetKeyTypes(xkb,req,(xkbKeyTypeWireDesc *)values,&change);
- if (!values) goto allocFailure;
- }
- if (req->present&XkbKeySymsMask) {
- values = SetKeySyms(client,xkb,req,(xkbSymMapWireDesc *)values,&change,dev);
- if (!values) goto allocFailure;
- }
- if (req->present&XkbKeyActionsMask) {
- values = SetKeyActions(xkb,req,(CARD8 *)values,&change);
- if (!values) goto allocFailure;
- }
- if (req->present&XkbKeyBehaviorsMask) {
- values= SetKeyBehaviors(xkbi,req,(xkbBehaviorWireDesc *)values,&change);
- if (!values) goto allocFailure;
- }
- if (req->present&XkbVirtualModsMask)
- values= SetVirtualMods(xkbi,req,(CARD8 *)values,&change);
- if (req->present&XkbExplicitComponentsMask)
- values= SetKeyExplicit(xkbi,req,(CARD8 *)values,&change);
- if (req->present&XkbModifierMapMask)
- values= SetModifierMap(xkbi,req,(CARD8 *)values,&change);
- if (req->present&XkbVirtualModMapMask)
- values= SetVirtualModMap(xkbi,req,(xkbVModMapWireDesc *)values,&change);
- if (((values-((char *)req))/4)!=req->length) {
- ErrorF("[xkb] Internal error! Bad length in XkbSetMap (after set)\n");
- client->errorValue = values-((char *)&req[1]);
- return BadLength;
- }
- if (req->flags&XkbSetMapRecomputeActions) {
- KeyCode first,last,firstMM,lastMM;
- if (change.map.num_key_syms>0) {
- first= change.map.first_key_sym;
- last= first+change.map.num_key_syms-1;
- }
- else first= last= 0;
- if (change.map.num_modmap_keys>0) {
- firstMM= change.map.first_modmap_key;
- lastMM= first+change.map.num_modmap_keys-1;
- }
- else firstMM= lastMM= 0;
- if ((last>0) && (lastMM>0)) {
- if (firstMM<first)
- first= firstMM;
- if (lastMM>last)
- last= lastMM;
- }
- else if (lastMM>0) {
- first= firstMM;
- last= lastMM;
- }
- if (last>0) {
- unsigned check= 0;
- XkbUpdateActions(dev,first,(last-first+1),&change,&check,&cause);
- if (check)
- XkbCheckSecondaryEffects(xkbi,check,&change,&cause);
- }
+ if ((xkb->min_key_code != req->minKeyCode) ||
+ (xkb->max_key_code != req->maxKeyCode)) {
+ Status status;
+ xkbNewKeyboardNotify nkn;
+
+ nkn.deviceID = nkn.oldDeviceID = dev->id;
+ nkn.oldMinKeyCode = xkb->min_key_code;
+ nkn.oldMaxKeyCode = xkb->max_key_code;
+ status = XkbChangeKeycodeRange(xkb, req->minKeyCode,
+ req->maxKeyCode, &change);
+ if (status != Success)
+ return status; /* oh-oh. what about the other keyboards? */
+ nkn.minKeyCode = xkb->min_key_code;
+ nkn.maxKeyCode = xkb->max_key_code;
+ nkn.requestMajor = XkbReqCode;
+ nkn.requestMinor = X_kbSetMap;
+ nkn.changed = XkbNKN_KeycodesMask;
+ XkbSendNewKeyboardNotify(dev, &nkn);
+ sentNKN = TRUE;
+ }
+
+ if (req->present & XkbKeyTypesMask) {
+ values = SetKeyTypes(xkb, req, (xkbKeyTypeWireDesc *) values, &change);
+ if (!values)
+ goto allocFailure;
+ }
+ if (req->present & XkbKeySymsMask) {
+ values =
+ SetKeySyms(client, xkb, req, (xkbSymMapWireDesc *) values, &change,
+ dev);
+ if (!values)
+ goto allocFailure;
+ }
+ if (req->present & XkbKeyActionsMask) {
+ values = SetKeyActions(xkb, req, (CARD8 *) values, &change);
+ if (!values)
+ goto allocFailure;
+ }
+ if (req->present & XkbKeyBehaviorsMask) {
+ values =
+ SetKeyBehaviors(xkbi, req, (xkbBehaviorWireDesc *) values, &change);
+ if (!values)
+ goto allocFailure;
+ }
+ if (req->present & XkbVirtualModsMask)
+ values = SetVirtualMods(xkbi, req, (CARD8 *) values, &change);
+ if (req->present & XkbExplicitComponentsMask)
+ values = SetKeyExplicit(xkbi, req, (CARD8 *) values, &change);
+ if (req->present & XkbModifierMapMask)
+ values = SetModifierMap(xkbi, req, (CARD8 *) values, &change);
+ if (req->present & XkbVirtualModMapMask)
+ values =
+ SetVirtualModMap(xkbi, req, (xkbVModMapWireDesc *) values, &change);
+ if (((values - ((char *) req)) / 4) != req->length) {
+ ErrorF("[xkb] Internal error! Bad length in XkbSetMap (after set)\n");
+ client->errorValue = values - ((char *) &req[1]);
+ return BadLength;
+ }
+ if (req->flags & XkbSetMapRecomputeActions) {
+ KeyCode first, last, firstMM, lastMM;
+
+ if (change.map.num_key_syms > 0) {
+ first = change.map.first_key_sym;
+ last = first + change.map.num_key_syms - 1;
+ }
+ else
+ first = last = 0;
+ if (change.map.num_modmap_keys > 0) {
+ firstMM = change.map.first_modmap_key;
+ lastMM = first + change.map.num_modmap_keys - 1;
+ }
+ else
+ firstMM = lastMM = 0;
+ if ((last > 0) && (lastMM > 0)) {
+ if (firstMM < first)
+ first = firstMM;
+ if (lastMM > last)
+ last = lastMM;
+ }
+ else if (lastMM > 0) {
+ first = firstMM;
+ last = lastMM;
+ }
+ if (last > 0) {
+ unsigned check = 0;
+
+ XkbUpdateActions(dev, first, (last - first + 1), &change, &check,
+ &cause);
+ if (check)
+ XkbCheckSecondaryEffects(xkbi, check, &change, &cause);
+ }
}
if (!sentNKN)
- XkbSendNotification(dev,&change,&cause);
+ XkbSendNotification(dev, &change, &cause);
return Success;
-allocFailure:
+ allocFailure:
return BadAlloc;
}
-
int
ProcXkbSetMap(ClientPtr client)
{
- DeviceIntPtr dev;
- char * tmp;
- int rc;
+ DeviceIntPtr dev;
+ char *tmp;
+ int rc;
REQUEST(xkbSetMapReq);
REQUEST_AT_LEAST_SIZE(xkbSetMapReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
- CHK_MASK_LEGAL(0x01,stuff->present,XkbAllMapComponentsMask);
+ CHK_MASK_LEGAL(0x01, stuff->present, XkbAllMapComponentsMask);
- tmp = (char *)&stuff[1];
+ tmp = (char *) &stuff[1];
/* Check if we can to the SetMap on the requested device. If this
succeeds, do the same thing for all extension devices (if needed).
@@ -2553,16 +2620,15 @@ ProcXkbSetMap(ClientPtr client)
if (rc != Success)
return rc;
- if (stuff->deviceSpec == XkbUseCoreKbd)
- {
+ if (stuff->deviceSpec == XkbUseCoreKbd) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
- {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
- if (rc == Success)
- {
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && other->key && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other,
+ DixManageAccess);
+ if (rc == Success) {
rc = _XkbSetMapChecks(client, other, stuff, tmp);
if (rc != Success)
return rc;
@@ -2576,14 +2642,14 @@ ProcXkbSetMap(ClientPtr client)
if (rc != Success)
return rc;
- if (stuff->deviceSpec == XkbUseCoreKbd)
- {
+ if (stuff->deviceSpec == XkbUseCoreKbd) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
- {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && other->key && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other,
+ DixManageAccess);
if (rc == Success)
_XkbSetMap(client, other, stuff, tmp);
/* ignore rc. if the SetMap failed although the check above
@@ -2600,84 +2666,88 @@ ProcXkbSetMap(ClientPtr client)
/***====================================================================***/
static Status
-XkbComputeGetCompatMapReplySize( XkbCompatMapPtr compat,
- xkbGetCompatMapReply * rep)
+XkbComputeGetCompatMapReplySize(XkbCompatMapPtr compat,
+ xkbGetCompatMapReply * rep)
{
-unsigned size,nGroups;
-
- nGroups= 0;
- if (rep->groups!=0) {
- register int i,bit;
- for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) {
- if (rep->groups&bit)
- nGroups++;
- }
- }
- size= nGroups*SIZEOF(xkbModsWireDesc);
- size+= (rep->nSI*SIZEOF(xkbSymInterpretWireDesc));
- rep->length= size/4;
+ unsigned size, nGroups;
+
+ nGroups = 0;
+ if (rep->groups != 0) {
+ register int i, bit;
+
+ for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
+ if (rep->groups & bit)
+ nGroups++;
+ }
+ }
+ size = nGroups * SIZEOF(xkbModsWireDesc);
+ size += (rep->nSI * SIZEOF(xkbSymInterpretWireDesc));
+ rep->length = size / 4;
return Success;
}
static int
-XkbSendCompatMap( ClientPtr client,
- XkbCompatMapPtr compat,
- xkbGetCompatMapReply * rep)
+XkbSendCompatMap(ClientPtr client,
+ XkbCompatMapPtr compat, xkbGetCompatMapReply * rep)
{
-char * data;
-int size;
-
- size= rep->length*4;
- if (size>0) {
- data = malloc(size);
- if (data) {
- register unsigned i,bit;
- xkbModsWireDesc * grp;
- XkbSymInterpretPtr sym= &compat->sym_interpret[rep->firstSI];
- xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *)data;
- for (i=0;i<rep->nSI;i++,sym++,wire++) {
- wire->sym= sym->sym;
- wire->mods= sym->mods;
- wire->match= sym->match;
- wire->virtualMod= sym->virtual_mod;
- wire->flags= sym->flags;
- memcpy((char*)&wire->act,(char*)&sym->act,sz_xkbActionWireDesc);
- if (client->swapped) {
- swapl(&wire->sym);
- }
- }
- if (rep->groups) {
- grp = (xkbModsWireDesc *)wire;
- for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) {
- if (rep->groups&bit) {
- grp->mask= compat->groups[i].mask;
- grp->realMods= compat->groups[i].real_mods;
- grp->virtualMods= compat->groups[i].vmods;
- if (client->swapped) {
- swaps(&grp->virtualMods);
- }
- grp++;
- }
- }
- wire= (xkbSymInterpretWireDesc*)grp;
- }
- }
- else return BadAlloc;
- }
- else data= NULL;
+ char *data;
+ int size;
+
+ size = rep->length * 4;
+ if (size > 0) {
+ data = malloc(size);
+ if (data) {
+ register unsigned i, bit;
+ xkbModsWireDesc *grp;
+ XkbSymInterpretPtr sym = &compat->sym_interpret[rep->firstSI];
+ xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *) data;
+
+ for (i = 0; i < rep->nSI; i++, sym++, wire++) {
+ wire->sym = sym->sym;
+ wire->mods = sym->mods;
+ wire->match = sym->match;
+ wire->virtualMod = sym->virtual_mod;
+ wire->flags = sym->flags;
+ memcpy((char *) &wire->act, (char *) &sym->act,
+ sz_xkbActionWireDesc);
+ if (client->swapped) {
+ swapl(&wire->sym);
+ }
+ }
+ if (rep->groups) {
+ grp = (xkbModsWireDesc *) wire;
+ for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
+ if (rep->groups & bit) {
+ grp->mask = compat->groups[i].mask;
+ grp->realMods = compat->groups[i].real_mods;
+ grp->virtualMods = compat->groups[i].vmods;
+ if (client->swapped) {
+ swaps(&grp->virtualMods);
+ }
+ grp++;
+ }
+ }
+ wire = (xkbSymInterpretWireDesc *) grp;
+ }
+ }
+ else
+ return BadAlloc;
+ }
+ else
+ data = NULL;
if (client->swapped) {
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swaps(&rep->firstSI);
- swaps(&rep->nSI);
- swaps(&rep->nTotalSI);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->firstSI);
+ swaps(&rep->nSI);
+ swaps(&rep->nTotalSI);
}
- WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *)rep);
+ WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *) rep);
if (data) {
- WriteToClient(client, size, data);
- free((char *)data);
+ WriteToClient(client, size, data);
+ free((char *) data);
}
return Success;
}
@@ -2685,21 +2755,21 @@ int size;
int
ProcXkbGetCompatMap(ClientPtr client)
{
- xkbGetCompatMapReply rep;
- DeviceIntPtr dev;
- XkbDescPtr xkb;
- XkbCompatMapPtr compat;
+ xkbGetCompatMapReply rep;
+ DeviceIntPtr dev;
+ XkbDescPtr xkb;
+ XkbCompatMapPtr compat;
REQUEST(xkbGetCompatMapReq);
REQUEST_SIZE_MATCH(xkbGetCompatMapReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
xkb = dev->key->xkbInfo->desc;
- compat= xkb->compat;
+ compat = xkb->compat;
rep.type = X_Reply;
rep.deviceID = dev->id;
@@ -2708,18 +2778,18 @@ ProcXkbGetCompatMap(ClientPtr client)
rep.firstSI = stuff->firstSI;
rep.nSI = stuff->nSI;
if (stuff->getAllSI) {
- rep.firstSI = 0;
- rep.nSI = compat->num_si;
+ rep.firstSI = 0;
+ rep.nSI = compat->num_si;
}
- else if ((((unsigned)stuff->nSI)>0)&&
- ((unsigned)(stuff->firstSI+stuff->nSI-1)>=compat->num_si)) {
- client->errorValue = _XkbErrCode2(0x05,compat->num_si);
- return BadValue;
+ else if ((((unsigned) stuff->nSI) > 0) &&
+ ((unsigned) (stuff->firstSI + stuff->nSI - 1) >= compat->num_si)) {
+ client->errorValue = _XkbErrCode2(0x05, compat->num_si);
+ return BadValue;
}
rep.nTotalSI = compat->num_si;
- rep.groups= stuff->groups;
- XkbComputeGetCompatMapReplySize(compat,&rep);
- return XkbSendCompatMap(client,compat,&rep);
+ rep.groups = stuff->groups;
+ XkbComputeGetCompatMapReplySize(compat, &rep);
+ return XkbSendCompatMap(client, compat, &rep);
}
/**
@@ -2729,146 +2799,152 @@ ProcXkbGetCompatMap(ClientPtr client)
*/
static int
_XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev,
- xkbSetCompatMapReq *req, char* data, BOOL dryRun)
+ xkbSetCompatMapReq * req, char *data, BOOL dryRun)
{
- XkbSrvInfoPtr xkbi;
- XkbDescPtr xkb;
- XkbCompatMapPtr compat;
- int nGroups;
- unsigned i,bit;
+ XkbSrvInfoPtr xkbi;
+ XkbDescPtr xkb;
+ XkbCompatMapPtr compat;
+ int nGroups;
+ unsigned i, bit;
xkbi = dev->key->xkbInfo;
xkb = xkbi->desc;
compat = xkb->compat;
- if ((req->nSI>0)||(req->truncateSI)) {
- xkbSymInterpretWireDesc *wire;
- if (req->firstSI>compat->num_si) {
- client->errorValue = _XkbErrCode2(0x02,compat->num_si);
- return BadValue;
- }
- wire= (xkbSymInterpretWireDesc *)data;
- wire+= req->nSI;
- data = (char *)wire;
+ if ((req->nSI > 0) || (req->truncateSI)) {
+ xkbSymInterpretWireDesc *wire;
+
+ if (req->firstSI > compat->num_si) {
+ client->errorValue = _XkbErrCode2(0x02, compat->num_si);
+ return BadValue;
+ }
+ wire = (xkbSymInterpretWireDesc *) data;
+ wire += req->nSI;
+ data = (char *) wire;
}
- nGroups= 0;
- if (req->groups!=0) {
- for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) {
- if ( req->groups&bit )
- nGroups++;
- }
+ nGroups = 0;
+ if (req->groups != 0) {
+ for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
+ if (req->groups & bit)
+ nGroups++;
+ }
}
- data+= nGroups*SIZEOF(xkbModsWireDesc);
- if (((data-((char *)req))/4)!=req->length) {
- return BadLength;
+ data += nGroups * SIZEOF(xkbModsWireDesc);
+ if (((data - ((char *) req)) / 4) != req->length) {
+ return BadLength;
}
/* Done all the checks we can do */
if (dryRun)
return Success;
- data = (char *)&req[1];
- if (req->nSI>0) {
- xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *)data;
- XkbSymInterpretPtr sym;
- unsigned int skipped = 0;
- if ((unsigned)(req->firstSI+req->nSI)>compat->num_si) {
- compat->num_si= req->firstSI+req->nSI;
- compat->sym_interpret= realloc(compat->sym_interpret,
- compat->num_si * sizeof(XkbSymInterpretRec));
- if (!compat->sym_interpret) {
- compat->num_si= 0;
- return BadAlloc;
- }
- }
- else if (req->truncateSI) {
- compat->num_si = req->firstSI+req->nSI;
- }
- sym = &compat->sym_interpret[req->firstSI];
- for (i=0;i<req->nSI;i++,wire++) {
- if (client->swapped) {
- swapl(&wire->sym);
- }
- if (wire->sym == NoSymbol && wire->match == XkbSI_AnyOfOrNone &&
- (wire->mods & 0xff) == 0xff &&
- wire->act.type == XkbSA_XFree86Private) {
- ErrorF("XKB: Skipping broken Any+AnyOfOrNone(All) -> Private "
- "action from client\n");
- skipped++;
- continue;
- }
- sym->sym= wire->sym;
- sym->mods= wire->mods;
- sym->match= wire->match;
- sym->flags= wire->flags;
- sym->virtual_mod= wire->virtualMod;
- memcpy((char *)&sym->act,(char *)&wire->act,
+ data = (char *) &req[1];
+ if (req->nSI > 0) {
+ xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *) data;
+ XkbSymInterpretPtr sym;
+ unsigned int skipped = 0;
+
+ if ((unsigned) (req->firstSI + req->nSI) > compat->num_si) {
+ compat->num_si = req->firstSI + req->nSI;
+ compat->sym_interpret = realloc(compat->sym_interpret,
+ compat->num_si *
+ sizeof(XkbSymInterpretRec));
+ if (!compat->sym_interpret) {
+ compat->num_si = 0;
+ return BadAlloc;
+ }
+ }
+ else if (req->truncateSI) {
+ compat->num_si = req->firstSI + req->nSI;
+ }
+ sym = &compat->sym_interpret[req->firstSI];
+ for (i = 0; i < req->nSI; i++, wire++) {
+ if (client->swapped) {
+ swapl(&wire->sym);
+ }
+ if (wire->sym == NoSymbol && wire->match == XkbSI_AnyOfOrNone &&
+ (wire->mods & 0xff) == 0xff &&
+ wire->act.type == XkbSA_XFree86Private) {
+ ErrorF("XKB: Skipping broken Any+AnyOfOrNone(All) -> Private "
+ "action from client\n");
+ skipped++;
+ continue;
+ }
+ sym->sym = wire->sym;
+ sym->mods = wire->mods;
+ sym->match = wire->match;
+ sym->flags = wire->flags;
+ sym->virtual_mod = wire->virtualMod;
+ memcpy((char *) &sym->act, (char *) &wire->act,
SIZEOF(xkbActionWireDesc));
sym++;
- }
- if (skipped) {
- if (req->firstSI + req->nSI < compat->num_si)
- memmove(sym, sym + skipped,
- (compat->num_si - req->firstSI - req->nSI) *
- sizeof(*sym));
- compat->num_si -= skipped;
- }
- data = (char *)wire;
+ }
+ if (skipped) {
+ if (req->firstSI + req->nSI < compat->num_si)
+ memmove(sym, sym + skipped,
+ (compat->num_si - req->firstSI - req->nSI) *
+ sizeof(*sym));
+ compat->num_si -= skipped;
+ }
+ data = (char *) wire;
}
else if (req->truncateSI) {
- compat->num_si = req->firstSI;
- }
-
- if (req->groups!=0) {
- unsigned i, bit;
- xkbModsWireDesc *wire = (xkbModsWireDesc *)data;
- for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
- if (req->groups & bit) {
- if (client->swapped) {
- swaps(&wire->virtualMods);
- }
- compat->groups[i].mask= wire->realMods;
- compat->groups[i].real_mods= wire->realMods;
- compat->groups[i].vmods= wire->virtualMods;
- if (wire->virtualMods!=0) {
- unsigned tmp;
- tmp= XkbMaskForVMask(xkb,wire->virtualMods);
- compat->groups[i].mask|= tmp;
- }
- data+= SIZEOF(xkbModsWireDesc);
- wire= (xkbModsWireDesc *)data;
- }
- }
- }
- i= XkbPaddedSize((data-((char *)req)));
- if ((i/4)!=req->length) {
- ErrorF("[xkb] Internal length error on read in _XkbSetCompatMap\n");
- return BadLength;
+ compat->num_si = req->firstSI;
+ }
+
+ if (req->groups != 0) {
+ unsigned i, bit;
+ xkbModsWireDesc *wire = (xkbModsWireDesc *) data;
+
+ for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
+ if (req->groups & bit) {
+ if (client->swapped) {
+ swaps(&wire->virtualMods);
+ }
+ compat->groups[i].mask = wire->realMods;
+ compat->groups[i].real_mods = wire->realMods;
+ compat->groups[i].vmods = wire->virtualMods;
+ if (wire->virtualMods != 0) {
+ unsigned tmp;
+
+ tmp = XkbMaskForVMask(xkb, wire->virtualMods);
+ compat->groups[i].mask |= tmp;
+ }
+ data += SIZEOF(xkbModsWireDesc);
+ wire = (xkbModsWireDesc *) data;
+ }
+ }
+ }
+ i = XkbPaddedSize((data - ((char *) req)));
+ if ((i / 4) != req->length) {
+ ErrorF("[xkb] Internal length error on read in _XkbSetCompatMap\n");
+ return BadLength;
}
if (dev->xkb_interest) {
- xkbCompatMapNotify ev;
- ev.deviceID = dev->id;
- ev.changedGroups = req->groups;
- ev.firstSI = req->firstSI;
- ev.nSI = req->nSI;
- ev.nTotalSI = compat->num_si;
- XkbSendCompatMapNotify(dev,&ev);
+ xkbCompatMapNotify ev;
+
+ ev.deviceID = dev->id;
+ ev.changedGroups = req->groups;
+ ev.firstSI = req->firstSI;
+ ev.nSI = req->nSI;
+ ev.nTotalSI = compat->num_si;
+ XkbSendCompatMapNotify(dev, &ev);
}
if (req->recomputeActions) {
- XkbChangesRec change;
- unsigned check;
- XkbEventCauseRec cause;
-
- XkbSetCauseXkbReq(&cause,X_kbSetCompatMap,client);
- memset(&change, 0, sizeof(XkbChangesRec));
- XkbUpdateActions(dev,xkb->min_key_code,XkbNumKeys(xkb),&change,&check,
- &cause);
- if (check)
- XkbCheckSecondaryEffects(xkbi,check,&change,&cause);
- XkbSendNotification(dev,&change,&cause);
+ XkbChangesRec change;
+ unsigned check;
+ XkbEventCauseRec cause;
+
+ XkbSetCauseXkbReq(&cause, X_kbSetCompatMap, client);
+ memset(&change, 0, sizeof(XkbChangesRec));
+ XkbUpdateActions(dev, xkb->min_key_code, XkbNumKeys(xkb), &change,
+ &check, &cause);
+ if (check)
+ XkbCheckSecondaryEffects(xkbi, check, &change, &cause);
+ XkbSendNotification(dev, &change, &cause);
}
return Success;
}
@@ -2876,34 +2952,33 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev,
int
ProcXkbSetCompatMap(ClientPtr client)
{
- DeviceIntPtr dev;
- char *data;
- int rc;
+ DeviceIntPtr dev;
+ char *data;
+ int rc;
REQUEST(xkbSetCompatMapReq);
REQUEST_AT_LEAST_SIZE(xkbSetCompatMapReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
- data = (char *)&stuff[1];
+ data = (char *) &stuff[1];
/* check first using a dry-run */
rc = _XkbSetCompatMap(client, dev, stuff, data, TRUE);
if (rc != Success)
return rc;
- if (stuff->deviceSpec == XkbUseCoreKbd)
- {
+ if (stuff->deviceSpec == XkbUseCoreKbd) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
- {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
- if (rc == Success)
- {
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && other->key && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other,
+ DixManageAccess);
+ if (rc == Success) {
/* dry-run */
rc = _XkbSetCompatMap(client, other, stuff, data, TRUE);
if (rc != Success)
@@ -2917,16 +2992,15 @@ ProcXkbSetCompatMap(ClientPtr client)
rc = _XkbSetCompatMap(client, dev, stuff, data, FALSE);
if (rc != Success)
return rc;
- if (stuff->deviceSpec == XkbUseCoreKbd)
- {
+ if (stuff->deviceSpec == XkbUseCoreKbd) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
- {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
- if (rc == Success)
- {
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && other->key && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other,
+ DixManageAccess);
+ if (rc == Success) {
rc = _XkbSetCompatMap(client, other, stuff, data, FALSE);
if (rc != Success)
return rc;
@@ -2943,22 +3017,22 @@ ProcXkbSetCompatMap(ClientPtr client)
int
ProcXkbGetIndicatorState(ClientPtr client)
{
- xkbGetIndicatorStateReply rep;
- XkbSrvLedInfoPtr sli;
- DeviceIntPtr dev;
+ xkbGetIndicatorStateReply rep;
+ XkbSrvLedInfoPtr sli;
+ DeviceIntPtr dev;
REQUEST(xkbGetIndicatorStateReq);
REQUEST_SIZE_MATCH(xkbGetIndicatorStateReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess);
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,
- XkbXI_IndicatorStateMask);
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId,
+ XkbXI_IndicatorStateMask);
if (!sli)
- return BadAlloc;
+ return BadAlloc;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
@@ -2967,85 +3041,87 @@ ProcXkbGetIndicatorState(ClientPtr client)
rep.state = sli->effectiveState;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.state);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.state);
}
- WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), (char *) &rep);
return Success;
}
/***====================================================================***/
static Status
-XkbComputeGetIndicatorMapReplySize(
- XkbIndicatorPtr indicators,
- xkbGetIndicatorMapReply *rep)
+XkbComputeGetIndicatorMapReplySize(XkbIndicatorPtr indicators,
+ xkbGetIndicatorMapReply * rep)
{
-register int i,bit;
-int nIndicators;
+ register int i, bit;
+ int nIndicators;
rep->realIndicators = indicators->phys_indicators;
- for (i=nIndicators=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
- if (rep->which&bit)
- nIndicators++;
+ for (i = nIndicators = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
+ if (rep->which & bit)
+ nIndicators++;
}
- rep->length = (nIndicators*SIZEOF(xkbIndicatorMapWireDesc))/4;
+ rep->length = (nIndicators * SIZEOF(xkbIndicatorMapWireDesc)) / 4;
return Success;
}
static int
-XkbSendIndicatorMap( ClientPtr client,
- XkbIndicatorPtr indicators,
- xkbGetIndicatorMapReply * rep)
+XkbSendIndicatorMap(ClientPtr client,
+ XkbIndicatorPtr indicators, xkbGetIndicatorMapReply * rep)
{
-int length;
-CARD8 * map;
-register int i;
-register unsigned bit;
-
- length = rep->length*4;
- if (length>0) {
- CARD8 *to;
- to= map= malloc(length);
- if (map) {
- xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *)to;
- for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
- if (rep->which&bit) {
- wire->flags= indicators->maps[i].flags;
- wire->whichGroups= indicators->maps[i].which_groups;
- wire->groups= indicators->maps[i].groups;
- wire->whichMods= indicators->maps[i].which_mods;
- wire->mods= indicators->maps[i].mods.mask;
- wire->realMods= indicators->maps[i].mods.real_mods;
- wire->virtualMods= indicators->maps[i].mods.vmods;
- wire->ctrls= indicators->maps[i].ctrls;
- if (client->swapped) {
- swaps(&wire->virtualMods);
- swapl(&wire->ctrls);
- }
- wire++;
- }
- }
- to = (CARD8 *)wire;
- if ((to-map)!=length) {
- client->errorValue = _XkbErrCode2(0xff,length);
- free(map);
- return BadLength;
- }
- }
- else return BadAlloc;
- }
- else map = NULL;
+ int length;
+ CARD8 *map;
+ register int i;
+ register unsigned bit;
+
+ length = rep->length * 4;
+ if (length > 0) {
+ CARD8 *to;
+
+ to = map = malloc(length);
+ if (map) {
+ xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *) to;
+
+ for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
+ if (rep->which & bit) {
+ wire->flags = indicators->maps[i].flags;
+ wire->whichGroups = indicators->maps[i].which_groups;
+ wire->groups = indicators->maps[i].groups;
+ wire->whichMods = indicators->maps[i].which_mods;
+ wire->mods = indicators->maps[i].mods.mask;
+ wire->realMods = indicators->maps[i].mods.real_mods;
+ wire->virtualMods = indicators->maps[i].mods.vmods;
+ wire->ctrls = indicators->maps[i].ctrls;
+ if (client->swapped) {
+ swaps(&wire->virtualMods);
+ swapl(&wire->ctrls);
+ }
+ wire++;
+ }
+ }
+ to = (CARD8 *) wire;
+ if ((to - map) != length) {
+ client->errorValue = _XkbErrCode2(0xff, length);
+ free(map);
+ return BadLength;
+ }
+ }
+ else
+ return BadAlloc;
+ }
+ else
+ map = NULL;
if (client->swapped) {
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swapl(&rep->which);
- swapl(&rep->realIndicators);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->which);
+ swapl(&rep->realIndicators);
}
- WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *)rep);
+ WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *) rep);
if (map) {
- WriteToClient(client, length, (char *)map);
- free((char *)map);
+ WriteToClient(client, length, (char *) map);
+ free((char *) map);
}
return Success;
}
@@ -3053,29 +3129,29 @@ register unsigned bit;
int
ProcXkbGetIndicatorMap(ClientPtr client)
{
-xkbGetIndicatorMapReply rep;
-DeviceIntPtr dev;
-XkbDescPtr xkb;
-XkbIndicatorPtr leds;
+ xkbGetIndicatorMapReply rep;
+ DeviceIntPtr dev;
+ XkbDescPtr xkb;
+ XkbIndicatorPtr leds;
REQUEST(xkbGetIndicatorMapReq);
REQUEST_SIZE_MATCH(xkbGetIndicatorMapReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
- xkb= dev->key->xkbInfo->desc;
- leds= xkb->indicators;
+ xkb = dev->key->xkbInfo->desc;
+ leds = xkb->indicators;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.deviceID = dev->id;
rep.which = stuff->which;
- XkbComputeGetIndicatorMapReplySize(leds,&rep);
- return XkbSendIndicatorMap(client,leds,&rep);
+ XkbComputeGetIndicatorMapReplySize(leds, &rep);
+ return XkbSendIndicatorMap(client, leds, &rep);
}
/**
@@ -3084,41 +3160,42 @@ XkbIndicatorPtr leds;
*/
static int
_XkbSetIndicatorMap(ClientPtr client, DeviceIntPtr dev,
- int which, xkbIndicatorMapWireDesc *desc)
+ int which, xkbIndicatorMapWireDesc * desc)
{
- XkbSrvInfoPtr xkbi;
- XkbSrvLedInfoPtr sli;
- XkbEventCauseRec cause;
- int i, bit;
+ XkbSrvInfoPtr xkbi;
+ XkbSrvLedInfoPtr sli;
+ XkbEventCauseRec cause;
+ int i, bit;
xkbi = dev->key->xkbInfo;
- sli= XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId,
- XkbXI_IndicatorMapsMask);
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId,
+ XkbXI_IndicatorMapsMask);
if (!sli)
- return BadAlloc;
+ return BadAlloc;
for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
- if (which & bit) {
- sli->maps[i].flags = desc->flags;
- sli->maps[i].which_groups = desc->whichGroups;
- sli->maps[i].groups = desc->groups;
- sli->maps[i].which_mods = desc->whichMods;
- sli->maps[i].mods.mask = desc->mods;
- sli->maps[i].mods.real_mods = desc->mods;
- sli->maps[i].mods.vmods= desc->virtualMods;
- sli->maps[i].ctrls = desc->ctrls;
- if (desc->virtualMods!=0) {
- unsigned tmp;
- tmp= XkbMaskForVMask(xkbi->desc,desc->virtualMods);
- sli->maps[i].mods.mask= desc->mods|tmp;
- }
- desc++;
- }
- }
-
- XkbSetCauseXkbReq(&cause,X_kbSetIndicatorMap,client);
- XkbApplyLedMapChanges(dev,sli,which,NULL,NULL,&cause);
+ if (which & bit) {
+ sli->maps[i].flags = desc->flags;
+ sli->maps[i].which_groups = desc->whichGroups;
+ sli->maps[i].groups = desc->groups;
+ sli->maps[i].which_mods = desc->whichMods;
+ sli->maps[i].mods.mask = desc->mods;
+ sli->maps[i].mods.real_mods = desc->mods;
+ sli->maps[i].mods.vmods = desc->virtualMods;
+ sli->maps[i].ctrls = desc->ctrls;
+ if (desc->virtualMods != 0) {
+ unsigned tmp;
+
+ tmp = XkbMaskForVMask(xkbi->desc, desc->virtualMods);
+ sli->maps[i].mods.mask = desc->mods | tmp;
+ }
+ desc++;
+ }
+ }
+
+ XkbSetCauseXkbReq(&cause, X_kbSetIndicatorMap, client);
+ XkbApplyLedMapChanges(dev, sli, which, NULL, NULL, &cause);
return Success;
}
@@ -3126,58 +3203,59 @@ _XkbSetIndicatorMap(ClientPtr client, DeviceIntPtr dev,
int
ProcXkbSetIndicatorMap(ClientPtr client)
{
- int i, bit;
- int nIndicators;
- DeviceIntPtr dev;
- xkbIndicatorMapWireDesc *from;
- int rc;
+ int i, bit;
+ int nIndicators;
+ DeviceIntPtr dev;
+ xkbIndicatorMapWireDesc *from;
+ int rc;
REQUEST(xkbSetIndicatorMapReq);
REQUEST_AT_LEAST_SIZE(xkbSetIndicatorMapReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
- if (stuff->which==0)
- return Success;
+ if (stuff->which == 0)
+ return Success;
- for (nIndicators=i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
- if (stuff->which&bit)
- nIndicators++;
+ for (nIndicators = i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
+ if (stuff->which & bit)
+ nIndicators++;
}
- if (stuff->length!=((SIZEOF(xkbSetIndicatorMapReq)+
- (nIndicators*SIZEOF(xkbIndicatorMapWireDesc)))/4)) {
- return BadLength;
+ if (stuff->length != ((SIZEOF(xkbSetIndicatorMapReq) +
+ (nIndicators * SIZEOF(xkbIndicatorMapWireDesc))) /
+ 4)) {
+ return BadLength;
}
- from = (xkbIndicatorMapWireDesc *)&stuff[1];
- for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
- if (stuff->which&bit) {
- if (client->swapped) {
- swaps(&from->virtualMods);
- swapl(&from->ctrls);
- }
- CHK_MASK_LEGAL(i,from->whichGroups,XkbIM_UseAnyGroup);
- CHK_MASK_LEGAL(i,from->whichMods,XkbIM_UseAnyMods);
- from++;
- }
+ from = (xkbIndicatorMapWireDesc *) &stuff[1];
+ for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
+ if (stuff->which & bit) {
+ if (client->swapped) {
+ swaps(&from->virtualMods);
+ swapl(&from->ctrls);
+ }
+ CHK_MASK_LEGAL(i, from->whichGroups, XkbIM_UseAnyGroup);
+ CHK_MASK_LEGAL(i, from->whichMods, XkbIM_UseAnyMods);
+ from++;
+ }
}
- from = (xkbIndicatorMapWireDesc *)&stuff[1];
+ from = (xkbIndicatorMapWireDesc *) &stuff[1];
rc = _XkbSetIndicatorMap(client, dev, stuff->which, from);
if (rc != Success)
return rc;
- if (stuff->deviceSpec == XkbUseCoreKbd)
- {
+ if (stuff->deviceSpec == XkbUseCoreKbd) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
- {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess);
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && other->key && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other,
+ DixSetAttrAccess);
if (rc == Success)
_XkbSetIndicatorMap(client, other, stuff->which, from);
}
@@ -3192,84 +3270,83 @@ ProcXkbSetIndicatorMap(ClientPtr client)
int
ProcXkbGetNamedIndicator(ClientPtr client)
{
- DeviceIntPtr dev;
- xkbGetNamedIndicatorReply rep;
- register int i = 0;
- XkbSrvLedInfoPtr sli;
- XkbIndicatorMapPtr map = NULL;
+ DeviceIntPtr dev;
+ xkbGetNamedIndicatorReply rep;
+ register int i = 0;
+ XkbSrvLedInfoPtr sli;
+ XkbIndicatorMapPtr map = NULL;
REQUEST(xkbGetNamedIndicatorReq);
REQUEST_SIZE_MATCH(xkbGetNamedIndicatorReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_LED_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess);
CHK_ATOM_ONLY(stuff->indicator);
- sli= XkbFindSrvLedInfo(dev,stuff->ledClass,stuff->ledID,0);
+ sli = XkbFindSrvLedInfo(dev, stuff->ledClass, stuff->ledID, 0);
if (!sli)
- return BadAlloc;
-
- i= 0;
- map= NULL;
- if ((sli->names)&&(sli->maps)) {
- for (i=0;i<XkbNumIndicators;i++) {
- if (stuff->indicator==sli->names[i]) {
- map= &sli->maps[i];
+ return BadAlloc;
+
+ i = 0;
+ map = NULL;
+ if ((sli->names) && (sli->maps)) {
+ for (i = 0; i < XkbNumIndicators; i++) {
+ if (stuff->indicator == sli->names[i]) {
+ map = &sli->maps[i];
break;
}
}
}
- rep.type= X_Reply;
+ rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.deviceID = dev->id;
- rep.indicator= stuff->indicator;
- if (map!=NULL) {
- rep.found= TRUE;
- rep.on= ((sli->effectiveState&(1<<i))!=0);
- rep.realIndicator= ((sli->physIndicators&(1<<i))!=0);
- rep.ndx= i;
- rep.flags= map->flags;
- rep.whichGroups= map->which_groups;
- rep.groups= map->groups;
- rep.whichMods= map->which_mods;
- rep.mods= map->mods.mask;
- rep.realMods= map->mods.real_mods;
- rep.virtualMods= map->mods.vmods;
- rep.ctrls= map->ctrls;
- rep.supported= TRUE;
- }
- else {
- rep.found= FALSE;
- rep.on= FALSE;
- rep.realIndicator= FALSE;
- rep.ndx= XkbNoIndicator;
- rep.flags= 0;
- rep.whichGroups= 0;
- rep.groups= 0;
- rep.whichMods= 0;
- rep.mods= 0;
- rep.realMods= 0;
- rep.virtualMods= 0;
- rep.ctrls= 0;
- rep.supported= TRUE;
- }
- if ( client->swapped ) {
- swapl(&rep.length);
- swaps(&rep.sequenceNumber);
- swapl(&rep.indicator);
- swaps(&rep.virtualMods);
- swapl(&rep.ctrls);
- }
-
- WriteToClient(client,SIZEOF(xkbGetNamedIndicatorReply), (char *)&rep);
+ rep.indicator = stuff->indicator;
+ if (map != NULL) {
+ rep.found = TRUE;
+ rep.on = ((sli->effectiveState & (1 << i)) != 0);
+ rep.realIndicator = ((sli->physIndicators & (1 << i)) != 0);
+ rep.ndx = i;
+ rep.flags = map->flags;
+ rep.whichGroups = map->which_groups;
+ rep.groups = map->groups;
+ rep.whichMods = map->which_mods;
+ rep.mods = map->mods.mask;
+ rep.realMods = map->mods.real_mods;
+ rep.virtualMods = map->mods.vmods;
+ rep.ctrls = map->ctrls;
+ rep.supported = TRUE;
+ }
+ else {
+ rep.found = FALSE;
+ rep.on = FALSE;
+ rep.realIndicator = FALSE;
+ rep.ndx = XkbNoIndicator;
+ rep.flags = 0;
+ rep.whichGroups = 0;
+ rep.groups = 0;
+ rep.whichMods = 0;
+ rep.mods = 0;
+ rep.realMods = 0;
+ rep.virtualMods = 0;
+ rep.ctrls = 0;
+ rep.supported = TRUE;
+ }
+ if (client->swapped) {
+ swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.indicator);
+ swaps(&rep.virtualMods);
+ swapl(&rep.ctrls);
+ }
+
+ WriteToClient(client, SIZEOF(xkbGetNamedIndicatorReply), (char *) &rep);
return Success;
}
-
/**
* Find the IM on the device.
* Returns the map, or NULL if the map doesn't exist.
@@ -3277,23 +3354,22 @@ ProcXkbGetNamedIndicator(ClientPtr client)
* is set to the led index of the map.
*/
static XkbIndicatorMapPtr
-_XkbFindNamedIndicatorMap(XkbSrvLedInfoPtr sli, Atom indicator,
- int *led_return)
+_XkbFindNamedIndicatorMap(XkbSrvLedInfoPtr sli, Atom indicator, int *led_return)
{
- XkbIndicatorMapPtr map;
+ XkbIndicatorMapPtr map;
/* search for the right indicator */
map = NULL;
if (sli->names && sli->maps) {
- int led;
+ int led;
- for (led = 0; (led < XkbNumIndicators) && (map == NULL); led++) {
- if (sli->names[led] == indicator) {
- map= &sli->maps[led];
- *led_return = led;
- break;
- }
- }
+ for (led = 0; (led < XkbNumIndicators) && (map == NULL); led++) {
+ if (sli->names[led] == indicator) {
+ map = &sli->maps[led];
+ *led_return = led;
+ break;
+ }
+ }
}
return map;
@@ -3306,12 +3382,12 @@ _XkbFindNamedIndicatorMap(XkbSrvLedInfoPtr sli, Atom indicator,
static int
_XkbCreateIndicatorMap(DeviceIntPtr dev, Atom indicator,
int ledClass, int ledID,
- XkbIndicatorMapPtr *map_return, int *led_return,
+ XkbIndicatorMapPtr * map_return, int *led_return,
Bool dryRun)
{
- XkbSrvLedInfoPtr sli;
- XkbIndicatorMapPtr map;
- int led;
+ XkbSrvLedInfoPtr sli;
+ XkbIndicatorMapPtr map;
+ int led;
sli = XkbFindSrvLedInfo(dev, ledClass, ledID, XkbXI_IndicatorsMask);
if (!sli)
@@ -3319,13 +3395,12 @@ _XkbCreateIndicatorMap(DeviceIntPtr dev, Atom indicator,
map = _XkbFindNamedIndicatorMap(sli, indicator, &led);
- if (!map)
- {
+ if (!map) {
/* find first unused indicator maps and assign the name to it */
- for (led = 0, map = NULL; (led < XkbNumIndicators) && (map == NULL); led++) {
+ for (led = 0, map = NULL; (led < XkbNumIndicators) && (map == NULL);
+ led++) {
if ((sli->names) && (sli->maps) && (sli->names[led] == None) &&
- (!XkbIM_InUse(&sli->maps[led])))
- {
+ (!XkbIM_InUse(&sli->maps[led]))) {
map = &sli->maps[led];
if (!dryRun)
sli->names[led] = indicator;
@@ -3344,22 +3419,22 @@ _XkbCreateIndicatorMap(DeviceIntPtr dev, Atom indicator,
static int
_XkbSetNamedIndicator(ClientPtr client, DeviceIntPtr dev,
- xkbSetNamedIndicatorReq *stuff)
+ xkbSetNamedIndicatorReq * stuff)
{
- unsigned int extDevReason;
- unsigned int statec, namec, mapc;
- XkbSrvLedInfoPtr sli;
- int led = 0;
- XkbIndicatorMapPtr map;
- DeviceIntPtr kbd;
- XkbEventCauseRec cause;
- xkbExtensionDeviceNotify ed;
- XkbChangesRec changes;
- int rc;
+ unsigned int extDevReason;
+ unsigned int statec, namec, mapc;
+ XkbSrvLedInfoPtr sli;
+ int led = 0;
+ XkbIndicatorMapPtr map;
+ DeviceIntPtr kbd;
+ XkbEventCauseRec cause;
+ xkbExtensionDeviceNotify ed;
+ XkbChangesRec changes;
+ int rc;
rc = _XkbCreateIndicatorMap(dev, stuff->indicator, stuff->ledClass,
stuff->ledID, &map, &led, FALSE);
- if (rc != Success || !map) /* oh-oh */
+ if (rc != Success || !map) /* oh-oh */
return rc;
sli = XkbFindSrvLedInfo(dev, stuff->ledClass, stuff->ledID,
@@ -3370,7 +3445,7 @@ _XkbSetNamedIndicator(ClientPtr client, DeviceIntPtr dev,
namec = mapc = statec = 0;
extDevReason = 0;
- namec |= (1<<led);
+ namec |= (1 << led);
sli->namesPresent |= ((stuff->indicator != None) ? (1 << led) : 0);
extDevReason |= XkbXI_IndicatorNamesMask;
@@ -3381,30 +3456,31 @@ _XkbSetNamedIndicator(ClientPtr client, DeviceIntPtr dev,
map->which_mods = stuff->whichMods;
map->mods.mask = stuff->realMods;
map->mods.real_mods = stuff->realMods;
- map->mods.vmods= stuff->virtualMods;
+ map->mods.vmods = stuff->virtualMods;
map->ctrls = stuff->ctrls;
- mapc|= (1<<led);
+ mapc |= (1 << led);
}
- if ((stuff->setState) && ((map->flags & XkbIM_NoExplicit) == 0))
- {
- if (stuff->on) sli->explicitState |= (1<<led);
- else sli->explicitState &= ~(1<<led);
+ if ((stuff->setState) && ((map->flags & XkbIM_NoExplicit) == 0)) {
+ if (stuff->on)
+ sli->explicitState |= (1 << led);
+ else
+ sli->explicitState &= ~(1 << led);
statec |= ((sli->effectiveState ^ sli->explicitState) & (1 << led));
}
- memset((char *)&ed, 0, sizeof(xkbExtensionDeviceNotify));
- memset((char *)&changes, 0, sizeof(XkbChangesRec));
- XkbSetCauseXkbReq(&cause,X_kbSetNamedIndicator,client);
+ memset((char *) &ed, 0, sizeof(xkbExtensionDeviceNotify));
+ memset((char *) &changes, 0, sizeof(XkbChangesRec));
+ XkbSetCauseXkbReq(&cause, X_kbSetNamedIndicator, client);
if (namec)
- XkbApplyLedNameChanges(dev,sli,namec,&ed,&changes,&cause);
+ XkbApplyLedNameChanges(dev, sli, namec, &ed, &changes, &cause);
if (mapc)
- XkbApplyLedMapChanges(dev,sli,mapc,&ed,&changes,&cause);
+ XkbApplyLedMapChanges(dev, sli, mapc, &ed, &changes, &cause);
if (statec)
- XkbApplyLedStateChanges(dev,sli,statec,&ed,&changes,&cause);
+ XkbApplyLedStateChanges(dev, sli, statec, &ed, &changes, &cause);
kbd = dev;
- if ((sli->flags&XkbSLI_HasOwnState)==0)
+ if ((sli->flags & XkbSLI_HasOwnState) == 0)
kbd = inputInfo.keyboard;
XkbFlushLedEvents(dev, kbd, sli, &ed, &changes, &cause);
@@ -3414,42 +3490,42 @@ _XkbSetNamedIndicator(ClientPtr client, DeviceIntPtr dev,
int
ProcXkbSetNamedIndicator(ClientPtr client)
{
- int rc;
- DeviceIntPtr dev;
- int led = 0;
- XkbIndicatorMapPtr map;
+ int rc;
+ DeviceIntPtr dev;
+ int led = 0;
+ XkbIndicatorMapPtr map;
REQUEST(xkbSetNamedIndicatorReq);
REQUEST_SIZE_MATCH(xkbSetNamedIndicatorReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_LED_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
CHK_ATOM_ONLY(stuff->indicator);
- CHK_MASK_LEGAL(0x10,stuff->whichGroups,XkbIM_UseAnyGroup);
- CHK_MASK_LEGAL(0x11,stuff->whichMods,XkbIM_UseAnyMods);
+ CHK_MASK_LEGAL(0x10, stuff->whichGroups, XkbIM_UseAnyGroup);
+ CHK_MASK_LEGAL(0x11, stuff->whichMods, XkbIM_UseAnyMods);
/* Dry-run for checks */
rc = _XkbCreateIndicatorMap(dev, stuff->indicator,
stuff->ledClass, stuff->ledID,
&map, &led, TRUE);
- if (rc != Success || !map) /* couldn't be created or didn't exist */
+ if (rc != Success || !map) /* couldn't be created or didn't exist */
return rc;
if (stuff->deviceSpec == XkbUseCoreKbd ||
- stuff->deviceSpec == XkbUseCorePtr)
- {
+ stuff->deviceSpec == XkbUseCorePtr) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev &&
- (other->kbdfeed || other->leds) &&
- (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success))
- {
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev && (other->kbdfeed ||
+ other->leds) &&
+ (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess)
+ == Success)) {
rc = _XkbCreateIndicatorMap(other, stuff->indicator,
- stuff->ledClass, stuff->ledID,
- &map, &led, TRUE);
+ stuff->ledClass, stuff->ledID, &map,
+ &led, TRUE);
if (rc != Success || !map)
return rc;
}
@@ -3462,15 +3538,15 @@ ProcXkbSetNamedIndicator(ClientPtr client)
return rc;
if (stuff->deviceSpec == XkbUseCoreKbd ||
- stuff->deviceSpec == XkbUseCorePtr)
- {
+ stuff->deviceSpec == XkbUseCorePtr) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev &&
- (other->kbdfeed || other->leds) &&
- (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success))
- {
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev && (other->kbdfeed ||
+ other->leds) &&
+ (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess)
+ == Success)) {
_XkbSetNamedIndicator(client, other, stuff);
}
}
@@ -3482,393 +3558,410 @@ ProcXkbSetNamedIndicator(ClientPtr client)
/***====================================================================***/
static CARD32
-_XkbCountAtoms(Atom *atoms,int maxAtoms,int *count)
+_XkbCountAtoms(Atom *atoms, int maxAtoms, int *count)
{
-register unsigned int i,bit,nAtoms;
-register CARD32 atomsPresent;
+ register unsigned int i, bit, nAtoms;
+ register CARD32 atomsPresent;
- for (i=nAtoms=atomsPresent=0,bit=1;i<maxAtoms;i++,bit<<=1) {
- if (atoms[i]!=None) {
- atomsPresent|= bit;
- nAtoms++;
- }
+ for (i = nAtoms = atomsPresent = 0, bit = 1; i < maxAtoms; i++, bit <<= 1) {
+ if (atoms[i] != None) {
+ atomsPresent |= bit;
+ nAtoms++;
+ }
}
if (count)
- *count= nAtoms;
+ *count = nAtoms;
return atomsPresent;
}
static char *
-_XkbWriteAtoms(char *wire,Atom *atoms,int maxAtoms,int swap)
+_XkbWriteAtoms(char *wire, Atom *atoms, int maxAtoms, int swap)
{
-register unsigned int i;
-Atom *atm;
-
- atm = (Atom *)wire;
- for (i=0;i<maxAtoms;i++) {
- if (atoms[i]!=None) {
- *atm= atoms[i];
- if (swap) {
- swapl(atm);
- }
- atm++;
- }
- }
- return (char *)atm;
+ register unsigned int i;
+ Atom *atm;
+
+ atm = (Atom *) wire;
+ for (i = 0; i < maxAtoms; i++) {
+ if (atoms[i] != None) {
+ *atm = atoms[i];
+ if (swap) {
+ swapl(atm);
+ }
+ atm++;
+ }
+ }
+ return (char *) atm;
}
static Status
-XkbComputeGetNamesReplySize(XkbDescPtr xkb,xkbGetNamesReply *rep)
+XkbComputeGetNamesReplySize(XkbDescPtr xkb, xkbGetNamesReply * rep)
{
-register unsigned which,length;
-register int i;
-
- rep->minKeyCode= xkb->min_key_code;
- rep->maxKeyCode= xkb->max_key_code;
- which= rep->which;
- length= 0;
- if (xkb->names!=NULL) {
- if (which&XkbKeycodesNameMask) length++;
- if (which&XkbGeometryNameMask) length++;
- if (which&XkbSymbolsNameMask) length++;
- if (which&XkbPhysSymbolsNameMask) length++;
- if (which&XkbTypesNameMask) length++;
- if (which&XkbCompatNameMask) length++;
- }
- else which&= ~XkbComponentNamesMask;
-
- if (xkb->map!=NULL) {
- if (which&XkbKeyTypeNamesMask)
- length+= xkb->map->num_types;
- rep->nTypes= xkb->map->num_types;
- if (which&XkbKTLevelNamesMask) {
- XkbKeyTypePtr pType = xkb->map->types;
- int nKTLevels = 0;
-
- length+= XkbPaddedSize(xkb->map->num_types)/4;
- for (i=0;i<xkb->map->num_types;i++,pType++) {
- if (pType->level_names!=NULL)
- nKTLevels+= pType->num_levels;
- }
- rep->nKTLevels= nKTLevels;
- length+= nKTLevels;
- }
+ register unsigned which, length;
+ register int i;
+
+ rep->minKeyCode = xkb->min_key_code;
+ rep->maxKeyCode = xkb->max_key_code;
+ which = rep->which;
+ length = 0;
+ if (xkb->names != NULL) {
+ if (which & XkbKeycodesNameMask)
+ length++;
+ if (which & XkbGeometryNameMask)
+ length++;
+ if (which & XkbSymbolsNameMask)
+ length++;
+ if (which & XkbPhysSymbolsNameMask)
+ length++;
+ if (which & XkbTypesNameMask)
+ length++;
+ if (which & XkbCompatNameMask)
+ length++;
+ }
+ else
+ which &= ~XkbComponentNamesMask;
+
+ if (xkb->map != NULL) {
+ if (which & XkbKeyTypeNamesMask)
+ length += xkb->map->num_types;
+ rep->nTypes = xkb->map->num_types;
+ if (which & XkbKTLevelNamesMask) {
+ XkbKeyTypePtr pType = xkb->map->types;
+ int nKTLevels = 0;
+
+ length += XkbPaddedSize(xkb->map->num_types) / 4;
+ for (i = 0; i < xkb->map->num_types; i++, pType++) {
+ if (pType->level_names != NULL)
+ nKTLevels += pType->num_levels;
+ }
+ rep->nKTLevels = nKTLevels;
+ length += nKTLevels;
+ }
}
else {
- rep->nTypes= 0;
- rep->nKTLevels= 0;
- which&= ~(XkbKeyTypeNamesMask|XkbKTLevelNamesMask);
- }
-
- rep->minKeyCode= xkb->min_key_code;
- rep->maxKeyCode= xkb->max_key_code;
- rep->indicators= 0;
- rep->virtualMods= 0;
- rep->groupNames= 0;
- if (xkb->names!=NULL) {
- if (which&XkbIndicatorNamesMask) {
- int nLeds;
- rep->indicators=
- _XkbCountAtoms(xkb->names->indicators,XkbNumIndicators,&nLeds);
- length+= nLeds;
- if (nLeds==0)
- which&= ~XkbIndicatorNamesMask;
- }
-
- if (which&XkbVirtualModNamesMask) {
- int nVMods;
- rep->virtualMods=
- _XkbCountAtoms(xkb->names->vmods,XkbNumVirtualMods,&nVMods);
- length+= nVMods;
- if (nVMods==0)
- which&= ~XkbVirtualModNamesMask;
- }
-
- if (which&XkbGroupNamesMask) {
- int nGroups;
- rep->groupNames=
- _XkbCountAtoms(xkb->names->groups,XkbNumKbdGroups,&nGroups);
- length+= nGroups;
- if (nGroups==0)
- which&= ~XkbGroupNamesMask;
- }
-
- if ((which&XkbKeyNamesMask)&&(xkb->names->keys))
- length+= rep->nKeys;
- else which&= ~XkbKeyNamesMask;
-
- if ((which&XkbKeyAliasesMask)&&
- (xkb->names->key_aliases)&&(xkb->names->num_key_aliases>0)) {
- rep->nKeyAliases= xkb->names->num_key_aliases;
- length+= rep->nKeyAliases*2;
- }
- else {
- which&= ~XkbKeyAliasesMask;
- rep->nKeyAliases= 0;
- }
-
- if ((which&XkbRGNamesMask)&&(xkb->names->num_rg>0))
- length+= xkb->names->num_rg;
- else which&= ~XkbRGNamesMask;
+ rep->nTypes = 0;
+ rep->nKTLevels = 0;
+ which &= ~(XkbKeyTypeNamesMask | XkbKTLevelNamesMask);
+ }
+
+ rep->minKeyCode = xkb->min_key_code;
+ rep->maxKeyCode = xkb->max_key_code;
+ rep->indicators = 0;
+ rep->virtualMods = 0;
+ rep->groupNames = 0;
+ if (xkb->names != NULL) {
+ if (which & XkbIndicatorNamesMask) {
+ int nLeds;
+
+ rep->indicators =
+ _XkbCountAtoms(xkb->names->indicators, XkbNumIndicators,
+ &nLeds);
+ length += nLeds;
+ if (nLeds == 0)
+ which &= ~XkbIndicatorNamesMask;
+ }
+
+ if (which & XkbVirtualModNamesMask) {
+ int nVMods;
+
+ rep->virtualMods =
+ _XkbCountAtoms(xkb->names->vmods, XkbNumVirtualMods, &nVMods);
+ length += nVMods;
+ if (nVMods == 0)
+ which &= ~XkbVirtualModNamesMask;
+ }
+
+ if (which & XkbGroupNamesMask) {
+ int nGroups;
+
+ rep->groupNames =
+ _XkbCountAtoms(xkb->names->groups, XkbNumKbdGroups, &nGroups);
+ length += nGroups;
+ if (nGroups == 0)
+ which &= ~XkbGroupNamesMask;
+ }
+
+ if ((which & XkbKeyNamesMask) && (xkb->names->keys))
+ length += rep->nKeys;
+ else
+ which &= ~XkbKeyNamesMask;
+
+ if ((which & XkbKeyAliasesMask) &&
+ (xkb->names->key_aliases) && (xkb->names->num_key_aliases > 0)) {
+ rep->nKeyAliases = xkb->names->num_key_aliases;
+ length += rep->nKeyAliases * 2;
+ }
+ else {
+ which &= ~XkbKeyAliasesMask;
+ rep->nKeyAliases = 0;
+ }
+
+ if ((which & XkbRGNamesMask) && (xkb->names->num_rg > 0))
+ length += xkb->names->num_rg;
+ else
+ which &= ~XkbRGNamesMask;
}
else {
- which&= ~(XkbIndicatorNamesMask|XkbVirtualModNamesMask);
- which&= ~(XkbGroupNamesMask|XkbKeyNamesMask|XkbKeyAliasesMask);
- which&= ~XkbRGNamesMask;
+ which &= ~(XkbIndicatorNamesMask | XkbVirtualModNamesMask);
+ which &= ~(XkbGroupNamesMask | XkbKeyNamesMask | XkbKeyAliasesMask);
+ which &= ~XkbRGNamesMask;
}
- rep->length= length;
- rep->which= which;
+ rep->length = length;
+ rep->which = which;
return Success;
}
static int
-XkbSendNames(ClientPtr client,XkbDescPtr xkb,xkbGetNamesReply *rep)
+XkbSendNames(ClientPtr client, XkbDescPtr xkb, xkbGetNamesReply * rep)
{
-register unsigned i,length,which;
-char * start;
-char * desc;
+ register unsigned i, length, which;
+ char *start;
+ char *desc;
- length= rep->length*4;
- which= rep->which;
+ length = rep->length * 4;
+ which = rep->which;
if (client->swapped) {
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swapl(&rep->which);
- swaps(&rep->virtualMods);
- swapl(&rep->indicators);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->which);
+ swaps(&rep->virtualMods);
+ swapl(&rep->indicators);
}
start = desc = calloc(1, length);
- if ( !start )
- return BadAlloc;
+ if (!start)
+ return BadAlloc;
if (xkb->names) {
- if (which&XkbKeycodesNameMask) {
- *((CARD32 *)desc)= xkb->names->keycodes;
+ if (which & XkbKeycodesNameMask) {
+ *((CARD32 *) desc) = xkb->names->keycodes;
if (client->swapped) {
- swapl((int *)desc);
+ swapl((int *) desc);
}
- desc+= 4;
+ desc += 4;
}
- if (which&XkbGeometryNameMask) {
- *((CARD32 *)desc)= xkb->names->geometry;
+ if (which & XkbGeometryNameMask) {
+ *((CARD32 *) desc) = xkb->names->geometry;
if (client->swapped) {
- swapl((int *)desc);
+ swapl((int *) desc);
}
- desc+= 4;
+ desc += 4;
}
- if (which&XkbSymbolsNameMask) {
- *((CARD32 *)desc)= xkb->names->symbols;
+ if (which & XkbSymbolsNameMask) {
+ *((CARD32 *) desc) = xkb->names->symbols;
if (client->swapped) {
- swapl((int *)desc);
+ swapl((int *) desc);
}
- desc+= 4;
+ desc += 4;
}
- if (which&XkbPhysSymbolsNameMask) {
- register CARD32 *atm= (CARD32 *)desc;
- atm[0]= (CARD32)xkb->names->phys_symbols;
+ if (which & XkbPhysSymbolsNameMask) {
+ register CARD32 *atm = (CARD32 *) desc;
+
+ atm[0] = (CARD32) xkb->names->phys_symbols;
if (client->swapped) {
swapl(&atm[0]);
}
- desc+= 4;
+ desc += 4;
}
- if (which&XkbTypesNameMask) {
- *((CARD32 *)desc)= (CARD32)xkb->names->types;
+ if (which & XkbTypesNameMask) {
+ *((CARD32 *) desc) = (CARD32) xkb->names->types;
if (client->swapped) {
- swapl((int *)desc);
+ swapl((int *) desc);
}
- desc+= 4;
+ desc += 4;
}
- if (which&XkbCompatNameMask) {
- *((CARD32 *)desc)= (CARD32)xkb->names->compat;
+ if (which & XkbCompatNameMask) {
+ *((CARD32 *) desc) = (CARD32) xkb->names->compat;
if (client->swapped) {
- swapl((int *)desc);
+ swapl((int *) desc);
}
- desc+= 4;
+ desc += 4;
}
- if (which&XkbKeyTypeNamesMask) {
- register CARD32 *atm= (CARD32 *)desc;
- register XkbKeyTypePtr type= xkb->map->types;
+ if (which & XkbKeyTypeNamesMask) {
+ register CARD32 *atm = (CARD32 *) desc;
+ register XkbKeyTypePtr type = xkb->map->types;
- for (i=0;i<xkb->map->num_types;i++,atm++,type++) {
- *atm= (CARD32)type->name;
+ for (i = 0; i < xkb->map->num_types; i++, atm++, type++) {
+ *atm = (CARD32) type->name;
if (client->swapped) {
swapl(atm);
}
}
- desc= (char *)atm;
+ desc = (char *) atm;
}
- if (which&XkbKTLevelNamesMask && xkb->map) {
+ if (which & XkbKTLevelNamesMask && xkb->map) {
XkbKeyTypePtr type = xkb->map->types;
register CARD32 *atm;
- for (i=0;i<rep->nTypes;i++,type++) {
+
+ for (i = 0; i < rep->nTypes; i++, type++) {
*desc++ = type->num_levels;
}
- desc+= XkbPaddedSize(rep->nTypes)-rep->nTypes;
+ desc += XkbPaddedSize(rep->nTypes) - rep->nTypes;
- atm= (CARD32 *)desc;
+ atm = (CARD32 *) desc;
type = xkb->map->types;
- for (i=0;i<xkb->map->num_types;i++,type++) {
+ for (i = 0; i < xkb->map->num_types; i++, type++) {
register unsigned l;
+
if (type->level_names) {
- for (l=0;l<type->num_levels;l++,atm++) {
- *atm= type->level_names[l];
+ for (l = 0; l < type->num_levels; l++, atm++) {
+ *atm = type->level_names[l];
if (client->swapped) {
swapl(atm);
}
}
- desc+= type->num_levels*4;
+ desc += type->num_levels * 4;
}
}
}
- if (which&XkbIndicatorNamesMask) {
- desc= _XkbWriteAtoms(desc,xkb->names->indicators,XkbNumIndicators,
- client->swapped);
+ if (which & XkbIndicatorNamesMask) {
+ desc =
+ _XkbWriteAtoms(desc, xkb->names->indicators, XkbNumIndicators,
+ client->swapped);
}
- if (which&XkbVirtualModNamesMask) {
- desc= _XkbWriteAtoms(desc,xkb->names->vmods,XkbNumVirtualMods,
- client->swapped);
+ if (which & XkbVirtualModNamesMask) {
+ desc = _XkbWriteAtoms(desc, xkb->names->vmods, XkbNumVirtualMods,
+ client->swapped);
}
- if (which&XkbGroupNamesMask) {
- desc= _XkbWriteAtoms(desc,xkb->names->groups,XkbNumKbdGroups,
- client->swapped);
+ if (which & XkbGroupNamesMask) {
+ desc = _XkbWriteAtoms(desc, xkb->names->groups, XkbNumKbdGroups,
+ client->swapped);
}
- if (which&XkbKeyNamesMask) {
- for (i=0;i<rep->nKeys;i++,desc+= sizeof(XkbKeyNameRec)) {
- *((XkbKeyNamePtr)desc)= xkb->names->keys[i+rep->firstKey];
+ if (which & XkbKeyNamesMask) {
+ for (i = 0; i < rep->nKeys; i++, desc += sizeof(XkbKeyNameRec)) {
+ *((XkbKeyNamePtr) desc) = xkb->names->keys[i + rep->firstKey];
}
}
- if (which&XkbKeyAliasesMask) {
- XkbKeyAliasPtr pAl;
- pAl= xkb->names->key_aliases;
- for (i=0;i<rep->nKeyAliases;i++,pAl++,desc+=2*XkbKeyNameLength) {
- *((XkbKeyAliasPtr)desc)= *pAl;
+ if (which & XkbKeyAliasesMask) {
+ XkbKeyAliasPtr pAl;
+
+ pAl = xkb->names->key_aliases;
+ for (i = 0; i < rep->nKeyAliases;
+ i++, pAl++, desc += 2 * XkbKeyNameLength) {
+ *((XkbKeyAliasPtr) desc) = *pAl;
}
}
- if ((which&XkbRGNamesMask)&&(rep->nRadioGroups>0)) {
- register CARD32 *atm= (CARD32 *)desc;
- for (i=0;i<rep->nRadioGroups;i++,atm++) {
- *atm= (CARD32)xkb->names->radio_groups[i];
+ if ((which & XkbRGNamesMask) && (rep->nRadioGroups > 0)) {
+ register CARD32 *atm = (CARD32 *) desc;
+
+ for (i = 0; i < rep->nRadioGroups; i++, atm++) {
+ *atm = (CARD32) xkb->names->radio_groups[i];
if (client->swapped) {
swapl(atm);
}
}
- desc+= rep->nRadioGroups*4;
+ desc += rep->nRadioGroups * 4;
}
}
- if ((desc-start)!=(length)) {
- ErrorF("[xkb] BOGUS LENGTH in write names, expected %d, got %ld\n",
- length, (unsigned long)(desc-start));
+ if ((desc - start) != (length)) {
+ ErrorF("[xkb] BOGUS LENGTH in write names, expected %d, got %ld\n",
+ length, (unsigned long) (desc - start));
}
- WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *)rep);
+ WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *) rep);
WriteToClient(client, length, start);
- free((char *)start);
+ free((char *) start);
return Success;
}
int
ProcXkbGetNames(ClientPtr client)
{
- DeviceIntPtr dev;
- XkbDescPtr xkb;
- xkbGetNamesReply rep;
+ DeviceIntPtr dev;
+ XkbDescPtr xkb;
+ xkbGetNamesReply rep;
REQUEST(xkbGetNamesReq);
REQUEST_SIZE_MATCH(xkbGetNamesReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
- CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask);
+ CHK_MASK_LEGAL(0x01, stuff->which, XkbAllNamesMask);
xkb = dev->key->xkbInfo->desc;
memset(&rep, 0, sizeof(xkbGetNamesReply));
- rep.type= X_Reply;
- rep.sequenceNumber= client->sequence;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.deviceID = dev->id;
rep.which = stuff->which;
rep.nTypes = xkb->map->num_types;
rep.firstKey = xkb->min_key_code;
rep.nKeys = XkbNumKeys(xkb);
- if (xkb->names!=NULL) {
- rep.nKeyAliases= xkb->names->num_key_aliases;
- rep.nRadioGroups = xkb->names->num_rg;
+ if (xkb->names != NULL) {
+ rep.nKeyAliases = xkb->names->num_key_aliases;
+ rep.nRadioGroups = xkb->names->num_rg;
}
else {
- rep.nKeyAliases= rep.nRadioGroups= 0;
+ rep.nKeyAliases = rep.nRadioGroups = 0;
}
- XkbComputeGetNamesReplySize(xkb,&rep);
- return XkbSendNames(client,xkb,&rep);
+ XkbComputeGetNamesReplySize(xkb, &rep);
+ return XkbSendNames(client, xkb, &rep);
}
/***====================================================================***/
static CARD32 *
-_XkbCheckAtoms(CARD32 *wire,int nAtoms,int swapped,Atom *pError)
+_XkbCheckAtoms(CARD32 *wire, int nAtoms, int swapped, Atom *pError)
{
-register int i;
+ register int i;
- for (i=0;i<nAtoms;i++,wire++) {
- if (swapped) {
- swapl(wire);
- }
- if ((((Atom)*wire)!=None)&&(!ValidAtom((Atom)*wire))) {
- *pError= ((Atom)*wire);
- return NULL;
- }
+ for (i = 0; i < nAtoms; i++, wire++) {
+ if (swapped) {
+ swapl(wire);
+ }
+ if ((((Atom) *wire) != None) && (!ValidAtom((Atom) *wire))) {
+ *pError = ((Atom) *wire);
+ return NULL;
+ }
}
return wire;
}
static CARD32 *
-_XkbCheckMaskedAtoms(CARD32 *wire,int nAtoms,CARD32 present,int swapped,
- Atom *pError)
+_XkbCheckMaskedAtoms(CARD32 *wire, int nAtoms, CARD32 present, int swapped,
+ Atom *pError)
{
-register unsigned i,bit;
-
- for (i=0,bit=1;(i<nAtoms)&&(present);i++,bit<<=1) {
- if ((present&bit)==0)
- continue;
- if (swapped) {
- swapl(wire);
- }
- if ((((Atom)*wire)!=None)&&(!ValidAtom(((Atom)*wire)))) {
- *pError= (Atom)*wire;
- return NULL;
- }
- wire++;
+ register unsigned i, bit;
+
+ for (i = 0, bit = 1; (i < nAtoms) && (present); i++, bit <<= 1) {
+ if ((present & bit) == 0)
+ continue;
+ if (swapped) {
+ swapl(wire);
+ }
+ if ((((Atom) *wire) != None) && (!ValidAtom(((Atom) *wire)))) {
+ *pError = (Atom) *wire;
+ return NULL;
+ }
+ wire++;
}
return wire;
}
static Atom *
-_XkbCopyMaskedAtoms( Atom *wire,
- Atom *dest,
- int nAtoms,
- CARD32 present)
+_XkbCopyMaskedAtoms(Atom *wire, Atom *dest, int nAtoms, CARD32 present)
{
-register int i,bit;
+ register int i, bit;
- for (i=0,bit=1;(i<nAtoms)&&(present);i++,bit<<=1) {
- if ((present&bit)==0)
- continue;
- dest[i]= *wire++;
+ for (i = 0, bit = 1; (i < nAtoms) && (present); i++, bit <<= 1) {
+ if ((present & bit) == 0)
+ continue;
+ dest[i] = *wire++;
}
return wire;
}
static Bool
-_XkbCheckTypeName(Atom name,int typeNdx)
+_XkbCheckTypeName(Atom name, int typeNdx)
{
-const char * str;
+ const char *str;
- str= NameForAtom(name);
- if ((strcmp(str,"ONE_LEVEL")==0)||(strcmp(str,"TWO_LEVEL")==0)||
- (strcmp(str,"ALPHABETIC")==0)||(strcmp(str,"KEYPAD")==0))
- return FALSE;
+ str = NameForAtom(name);
+ if ((strcmp(str, "ONE_LEVEL") == 0) || (strcmp(str, "TWO_LEVEL") == 0) ||
+ (strcmp(str, "ALPHABETIC") == 0) || (strcmp(str, "KEYPAD") == 0))
+ return FALSE;
return TRUE;
}
@@ -3878,304 +3971,310 @@ const char * str;
*/
static int
_XkbSetNamesCheck(ClientPtr client, DeviceIntPtr dev,
- xkbSetNamesReq *stuff, CARD32 *data)
+ xkbSetNamesReq * stuff, CARD32 *data)
{
- XkbDescRec *xkb;
- XkbNamesRec *names;
- CARD32 *tmp;
- Atom bad;
+ XkbDescRec *xkb;
+ XkbNamesRec *names;
+ CARD32 *tmp;
+ Atom bad;
tmp = data;
xkb = dev->key->xkbInfo->desc;
names = xkb->names;
-
if (stuff->which & XkbKeyTypeNamesMask) {
int i;
- CARD32 *old;
- if ( stuff->nTypes<1 ) {
- client->errorValue = _XkbErrCode2(0x02,stuff->nTypes);
+ CARD32 *old;
+
+ if (stuff->nTypes < 1) {
+ client->errorValue = _XkbErrCode2(0x02, stuff->nTypes);
return BadValue;
}
- if ((unsigned)(stuff->firstType+stuff->nTypes-1)>=xkb->map->num_types) {
- client->errorValue = _XkbErrCode4(0x03,stuff->firstType,
- stuff->nTypes,
- xkb->map->num_types);
+ if ((unsigned) (stuff->firstType + stuff->nTypes - 1) >=
+ xkb->map->num_types) {
+ client->errorValue =
+ _XkbErrCode4(0x03, stuff->firstType, stuff->nTypes,
+ xkb->map->num_types);
return BadValue;
}
- if (((unsigned)stuff->firstType)<=XkbLastRequiredType) {
- client->errorValue = _XkbErrCode2(0x04,stuff->firstType);
+ if (((unsigned) stuff->firstType) <= XkbLastRequiredType) {
+ client->errorValue = _XkbErrCode2(0x04, stuff->firstType);
return BadAccess;
}
- old= tmp;
- tmp= _XkbCheckAtoms(tmp,stuff->nTypes,client->swapped,&bad);
+ old = tmp;
+ tmp = _XkbCheckAtoms(tmp, stuff->nTypes, client->swapped, &bad);
if (!tmp) {
- client->errorValue= bad;
+ client->errorValue = bad;
return BadAtom;
}
- for (i=0;i<stuff->nTypes;i++,old++) {
- if (!_XkbCheckTypeName((Atom)*old,stuff->firstType+i))
- client->errorValue= _XkbErrCode2(0x05,i);
+ for (i = 0; i < stuff->nTypes; i++, old++) {
+ if (!_XkbCheckTypeName((Atom) *old, stuff->firstType + i))
+ client->errorValue = _XkbErrCode2(0x05, i);
}
}
- if (stuff->which&XkbKTLevelNamesMask) {
+ if (stuff->which & XkbKTLevelNamesMask) {
unsigned i;
- XkbKeyTypePtr type;
- CARD8 * width;
- if ( stuff->nKTLevels<1 ) {
- client->errorValue = _XkbErrCode2(0x05,stuff->nKTLevels);
+ XkbKeyTypePtr type;
+ CARD8 *width;
+
+ if (stuff->nKTLevels < 1) {
+ client->errorValue = _XkbErrCode2(0x05, stuff->nKTLevels);
return BadValue;
}
- if ((unsigned)(stuff->firstKTLevel+stuff->nKTLevels-1)>=
- xkb->map->num_types) {
- client->errorValue = _XkbErrCode4(0x06,stuff->firstKTLevel,
- stuff->nKTLevels,xkb->map->num_types);
+ if ((unsigned) (stuff->firstKTLevel + stuff->nKTLevels - 1) >=
+ xkb->map->num_types) {
+ client->errorValue = _XkbErrCode4(0x06, stuff->firstKTLevel,
+ stuff->nKTLevels,
+ xkb->map->num_types);
return BadValue;
}
- width = (CARD8 *)tmp;
- tmp= (CARD32 *)(((char *)tmp)+XkbPaddedSize(stuff->nKTLevels));
+ width = (CARD8 *) tmp;
+ tmp = (CARD32 *) (((char *) tmp) + XkbPaddedSize(stuff->nKTLevels));
type = &xkb->map->types[stuff->firstKTLevel];
- for (i=0;i<stuff->nKTLevels;i++,type++) {
- if (width[i]==0)
+ for (i = 0; i < stuff->nKTLevels; i++, type++) {
+ if (width[i] == 0)
continue;
- else if (width[i]!=type->num_levels) {
- client->errorValue= _XkbErrCode4(0x07,i+stuff->firstKTLevel,
- type->num_levels,width[i]);
+ else if (width[i] != type->num_levels) {
+ client->errorValue = _XkbErrCode4(0x07, i + stuff->firstKTLevel,
+ type->num_levels, width[i]);
return BadMatch;
}
- tmp= _XkbCheckAtoms(tmp,width[i],client->swapped,&bad);
+ tmp = _XkbCheckAtoms(tmp, width[i], client->swapped, &bad);
if (!tmp) {
- client->errorValue= bad;
+ client->errorValue = bad;
return BadAtom;
}
}
}
- if (stuff->which&XkbIndicatorNamesMask) {
- if (stuff->indicators==0) {
- client->errorValue= 0x08;
+ if (stuff->which & XkbIndicatorNamesMask) {
+ if (stuff->indicators == 0) {
+ client->errorValue = 0x08;
return BadMatch;
}
- tmp= _XkbCheckMaskedAtoms(tmp,XkbNumIndicators,stuff->indicators,
- client->swapped,&bad);
+ tmp = _XkbCheckMaskedAtoms(tmp, XkbNumIndicators, stuff->indicators,
+ client->swapped, &bad);
if (!tmp) {
- client->errorValue= bad;
+ client->errorValue = bad;
return BadAtom;
}
}
- if (stuff->which&XkbVirtualModNamesMask) {
- if (stuff->virtualMods==0) {
- client->errorValue= 0x09;
+ if (stuff->which & XkbVirtualModNamesMask) {
+ if (stuff->virtualMods == 0) {
+ client->errorValue = 0x09;
return BadMatch;
}
- tmp= _XkbCheckMaskedAtoms(tmp,XkbNumVirtualMods,
- (CARD32)stuff->virtualMods,
- client->swapped,&bad);
+ tmp = _XkbCheckMaskedAtoms(tmp, XkbNumVirtualMods,
+ (CARD32) stuff->virtualMods,
+ client->swapped, &bad);
if (!tmp) {
client->errorValue = bad;
return BadAtom;
}
}
- if (stuff->which&XkbGroupNamesMask) {
- if (stuff->groupNames==0) {
- client->errorValue= 0x0a;
+ if (stuff->which & XkbGroupNamesMask) {
+ if (stuff->groupNames == 0) {
+ client->errorValue = 0x0a;
return BadMatch;
}
- tmp= _XkbCheckMaskedAtoms(tmp,XkbNumKbdGroups,
- (CARD32)stuff->groupNames,
- client->swapped,&bad);
+ tmp = _XkbCheckMaskedAtoms(tmp, XkbNumKbdGroups,
+ (CARD32) stuff->groupNames,
+ client->swapped, &bad);
if (!tmp) {
client->errorValue = bad;
return BadAtom;
}
}
- if (stuff->which&XkbKeyNamesMask) {
- if (stuff->firstKey<(unsigned)xkb->min_key_code) {
- client->errorValue= _XkbErrCode3(0x0b,xkb->min_key_code,
- stuff->firstKey);
+ if (stuff->which & XkbKeyNamesMask) {
+ if (stuff->firstKey < (unsigned) xkb->min_key_code) {
+ client->errorValue = _XkbErrCode3(0x0b, xkb->min_key_code,
+ stuff->firstKey);
return BadValue;
}
- if (((unsigned)(stuff->firstKey+stuff->nKeys-1)>xkb->max_key_code)||
- (stuff->nKeys<1)) {
- client->errorValue= _XkbErrCode4(0x0c,xkb->max_key_code,
- stuff->firstKey,stuff->nKeys);
+ if (((unsigned) (stuff->firstKey + stuff->nKeys - 1) >
+ xkb->max_key_code) || (stuff->nKeys < 1)) {
+ client->errorValue =
+ _XkbErrCode4(0x0c, xkb->max_key_code, stuff->firstKey,
+ stuff->nKeys);
return BadValue;
}
- tmp+= stuff->nKeys;
+ tmp += stuff->nKeys;
}
- if ((stuff->which&XkbKeyAliasesMask)&&(stuff->nKeyAliases>0)) {
- tmp+= stuff->nKeyAliases*2;
+ if ((stuff->which & XkbKeyAliasesMask) && (stuff->nKeyAliases > 0)) {
+ tmp += stuff->nKeyAliases * 2;
}
- if (stuff->which&XkbRGNamesMask) {
- if ( stuff->nRadioGroups<1 ) {
- client->errorValue= _XkbErrCode2(0x0d,stuff->nRadioGroups);
+ if (stuff->which & XkbRGNamesMask) {
+ if (stuff->nRadioGroups < 1) {
+ client->errorValue = _XkbErrCode2(0x0d, stuff->nRadioGroups);
return BadValue;
}
- tmp= _XkbCheckAtoms(tmp,stuff->nRadioGroups,client->swapped,&bad);
+ tmp = _XkbCheckAtoms(tmp, stuff->nRadioGroups, client->swapped, &bad);
if (!tmp) {
- client->errorValue= bad;
+ client->errorValue = bad;
return BadAtom;
}
}
- if ((tmp-((CARD32 *)stuff))!=stuff->length) {
+ if ((tmp - ((CARD32 *) stuff)) != stuff->length) {
client->errorValue = stuff->length;
return BadLength;
}
-
-
return Success;
}
static int
-_XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff)
+_XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq * stuff)
{
- XkbDescRec *xkb;
- XkbNamesRec *names;
- CARD32 *tmp;
- xkbNamesNotify nn;
+ XkbDescRec *xkb;
+ XkbNamesRec *names;
+ CARD32 *tmp;
+ xkbNamesNotify nn;
- tmp = (CARD32 *)&stuff[1];
+ tmp = (CARD32 *) &stuff[1];
xkb = dev->key->xkbInfo->desc;
names = xkb->names;
- if (XkbAllocNames(xkb,stuff->which,stuff->nRadioGroups,
- stuff->nKeyAliases)!=Success) {
+ if (XkbAllocNames(xkb, stuff->which, stuff->nRadioGroups,
+ stuff->nKeyAliases) != Success) {
return BadAlloc;
}
memset(&nn, 0, sizeof(xkbNamesNotify));
- nn.changed= stuff->which;
- tmp = (CARD32 *)&stuff[1];
- if (stuff->which&XkbKeycodesNameMask)
- names->keycodes= *tmp++;
- if (stuff->which&XkbGeometryNameMask)
- names->geometry= *tmp++;
- if (stuff->which&XkbSymbolsNameMask)
- names->symbols= *tmp++;
- if (stuff->which&XkbPhysSymbolsNameMask)
- names->phys_symbols= *tmp++;
- if (stuff->which&XkbTypesNameMask)
- names->types= *tmp++;
- if (stuff->which&XkbCompatNameMask)
- names->compat= *tmp++;
- if ((stuff->which&XkbKeyTypeNamesMask)&&(stuff->nTypes>0)) {
+ nn.changed = stuff->which;
+ tmp = (CARD32 *) &stuff[1];
+ if (stuff->which & XkbKeycodesNameMask)
+ names->keycodes = *tmp++;
+ if (stuff->which & XkbGeometryNameMask)
+ names->geometry = *tmp++;
+ if (stuff->which & XkbSymbolsNameMask)
+ names->symbols = *tmp++;
+ if (stuff->which & XkbPhysSymbolsNameMask)
+ names->phys_symbols = *tmp++;
+ if (stuff->which & XkbTypesNameMask)
+ names->types = *tmp++;
+ if (stuff->which & XkbCompatNameMask)
+ names->compat = *tmp++;
+ if ((stuff->which & XkbKeyTypeNamesMask) && (stuff->nTypes > 0)) {
register unsigned i;
register XkbKeyTypePtr type;
- type= &xkb->map->types[stuff->firstType];
- for (i=0;i<stuff->nTypes;i++,type++) {
- type->name= *tmp++;
+ type = &xkb->map->types[stuff->firstType];
+ for (i = 0; i < stuff->nTypes; i++, type++) {
+ type->name = *tmp++;
}
- nn.firstType= stuff->firstType;
- nn.nTypes= stuff->nTypes;
+ nn.firstType = stuff->firstType;
+ nn.nTypes = stuff->nTypes;
}
- if (stuff->which&XkbKTLevelNamesMask) {
- register XkbKeyTypePtr type;
+ if (stuff->which & XkbKTLevelNamesMask) {
+ register XkbKeyTypePtr type;
register unsigned i;
CARD8 *width;
- width = (CARD8 *)tmp;
- tmp= (CARD32 *)(((char *)tmp)+XkbPaddedSize(stuff->nKTLevels));
- type= &xkb->map->types[stuff->firstKTLevel];
- for (i=0;i<stuff->nKTLevels;i++,type++) {
- if (width[i]>0) {
+ width = (CARD8 *) tmp;
+ tmp = (CARD32 *) (((char *) tmp) + XkbPaddedSize(stuff->nKTLevels));
+ type = &xkb->map->types[stuff->firstKTLevel];
+ for (i = 0; i < stuff->nKTLevels; i++, type++) {
+ if (width[i] > 0) {
if (type->level_names) {
register unsigned n;
- for (n=0;n<width[i];n++) {
- type->level_names[n]= tmp[n];
+
+ for (n = 0; n < width[i]; n++) {
+ type->level_names[n] = tmp[n];
}
}
- tmp+= width[i];
+ tmp += width[i];
}
}
- nn.firstLevelName= 0;
- nn.nLevelNames= stuff->nTypes;
- }
- if (stuff->which&XkbIndicatorNamesMask) {
- tmp= _XkbCopyMaskedAtoms(tmp,names->indicators,XkbNumIndicators,
- stuff->indicators);
- nn.changedIndicators= stuff->indicators;
- }
- if (stuff->which&XkbVirtualModNamesMask) {
- tmp= _XkbCopyMaskedAtoms(tmp,names->vmods,XkbNumVirtualMods,
- stuff->virtualMods);
- nn.changedVirtualMods= stuff->virtualMods;
- }
- if (stuff->which&XkbGroupNamesMask) {
- tmp= _XkbCopyMaskedAtoms(tmp,names->groups,XkbNumKbdGroups,
- stuff->groupNames);
- nn.changedVirtualMods= stuff->groupNames;
- }
- if (stuff->which&XkbKeyNamesMask) {
- memcpy((char*)&names->keys[stuff->firstKey],(char *)tmp,
- stuff->nKeys*XkbKeyNameLength);
- tmp+= stuff->nKeys;
- nn.firstKey= stuff->firstKey;
- nn.nKeys= stuff->nKeys;
- }
- if (stuff->which&XkbKeyAliasesMask) {
- if (stuff->nKeyAliases>0) {
- register int na= stuff->nKeyAliases;
- if (XkbAllocNames(xkb,XkbKeyAliasesMask,0,na)!=Success)
+ nn.firstLevelName = 0;
+ nn.nLevelNames = stuff->nTypes;
+ }
+ if (stuff->which & XkbIndicatorNamesMask) {
+ tmp = _XkbCopyMaskedAtoms(tmp, names->indicators, XkbNumIndicators,
+ stuff->indicators);
+ nn.changedIndicators = stuff->indicators;
+ }
+ if (stuff->which & XkbVirtualModNamesMask) {
+ tmp = _XkbCopyMaskedAtoms(tmp, names->vmods, XkbNumVirtualMods,
+ stuff->virtualMods);
+ nn.changedVirtualMods = stuff->virtualMods;
+ }
+ if (stuff->which & XkbGroupNamesMask) {
+ tmp = _XkbCopyMaskedAtoms(tmp, names->groups, XkbNumKbdGroups,
+ stuff->groupNames);
+ nn.changedVirtualMods = stuff->groupNames;
+ }
+ if (stuff->which & XkbKeyNamesMask) {
+ memcpy((char *) &names->keys[stuff->firstKey], (char *) tmp,
+ stuff->nKeys * XkbKeyNameLength);
+ tmp += stuff->nKeys;
+ nn.firstKey = stuff->firstKey;
+ nn.nKeys = stuff->nKeys;
+ }
+ if (stuff->which & XkbKeyAliasesMask) {
+ if (stuff->nKeyAliases > 0) {
+ register int na = stuff->nKeyAliases;
+
+ if (XkbAllocNames(xkb, XkbKeyAliasesMask, 0, na) != Success)
return BadAlloc;
- memcpy((char *)names->key_aliases,(char *)tmp,
- stuff->nKeyAliases*sizeof(XkbKeyAliasRec));
- tmp+= stuff->nKeyAliases*2;
+ memcpy((char *) names->key_aliases, (char *) tmp,
+ stuff->nKeyAliases * sizeof(XkbKeyAliasRec));
+ tmp += stuff->nKeyAliases * 2;
}
- else if (names->key_aliases!=NULL) {
+ else if (names->key_aliases != NULL) {
free(names->key_aliases);
- names->key_aliases= NULL;
- names->num_key_aliases= 0;
+ names->key_aliases = NULL;
+ names->num_key_aliases = 0;
}
- nn.nAliases= names->num_key_aliases;
+ nn.nAliases = names->num_key_aliases;
}
- if (stuff->which&XkbRGNamesMask) {
- if (stuff->nRadioGroups>0) {
- register unsigned i,nrg;
- nrg= stuff->nRadioGroups;
- if (XkbAllocNames(xkb,XkbRGNamesMask,nrg,0)!=Success)
+ if (stuff->which & XkbRGNamesMask) {
+ if (stuff->nRadioGroups > 0) {
+ register unsigned i, nrg;
+
+ nrg = stuff->nRadioGroups;
+ if (XkbAllocNames(xkb, XkbRGNamesMask, nrg, 0) != Success)
return BadAlloc;
- for (i=0;i<stuff->nRadioGroups;i++) {
- names->radio_groups[i]= tmp[i];
+ for (i = 0; i < stuff->nRadioGroups; i++) {
+ names->radio_groups[i] = tmp[i];
}
- tmp+= stuff->nRadioGroups;
+ tmp += stuff->nRadioGroups;
}
else if (names->radio_groups) {
free(names->radio_groups);
- names->radio_groups= NULL;
- names->num_rg= 0;
+ names->radio_groups = NULL;
+ names->num_rg = 0;
}
- nn.nRadioGroups= names->num_rg;
+ nn.nRadioGroups = names->num_rg;
}
if (nn.changed) {
Bool needExtEvent;
- needExtEvent= (nn.changed&XkbIndicatorNamesMask)!=0;
- XkbSendNamesNotify(dev,&nn);
+
+ needExtEvent = (nn.changed & XkbIndicatorNamesMask) != 0;
+ XkbSendNamesNotify(dev, &nn);
if (needExtEvent) {
- XkbSrvLedInfoPtr sli;
- xkbExtensionDeviceNotify edev;
- register int i;
- register unsigned bit;
-
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,
- XkbXI_IndicatorsMask);
- sli->namesPresent= 0;
- for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
- if (names->indicators[i]!=None)
- sli->namesPresent|= bit;
+ XkbSrvLedInfoPtr sli;
+ xkbExtensionDeviceNotify edev;
+ register int i;
+ register unsigned bit;
+
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId,
+ XkbXI_IndicatorsMask);
+ sli->namesPresent = 0;
+ for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
+ if (names->indicators[i] != None)
+ sli->namesPresent |= bit;
}
memset(&edev, 0, sizeof(xkbExtensionDeviceNotify));
- edev.reason= XkbXI_IndicatorNamesMask;
- edev.ledClass= KbdFeedbackClass;
- edev.ledID= dev->kbdfeed->ctrl.id;
- edev.ledsDefined= sli->namesPresent|sli->mapsPresent;
- edev.ledState= sli->effectiveState;
- edev.firstBtn= 0;
- edev.nBtns= 0;
- edev.supported= XkbXI_AllFeaturesMask;
- edev.unsupported= 0;
- XkbSendExtensionDeviceNotify(dev,client,&edev);
+ edev.reason = XkbXI_IndicatorNamesMask;
+ edev.ledClass = KbdFeedbackClass;
+ edev.ledID = dev->kbdfeed->ctrl.id;
+ edev.ledsDefined = sli->namesPresent | sli->mapsPresent;
+ edev.ledState = sli->effectiveState;
+ edev.firstBtn = 0;
+ edev.nBtns = 0;
+ edev.supported = XkbXI_AllFeaturesMask;
+ edev.unsupported = 0;
+ XkbSendExtensionDeviceNotify(dev, client, &edev);
}
}
return Success;
@@ -4184,64 +4283,64 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff)
int
ProcXkbSetNames(ClientPtr client)
{
- DeviceIntPtr dev;
- CARD32 *tmp;
- Atom bad;
- int rc;
+ DeviceIntPtr dev;
+ CARD32 *tmp;
+ Atom bad;
+ int rc;
REQUEST(xkbSetNamesReq);
REQUEST_AT_LEAST_SIZE(xkbSetNamesReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
- CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask);
+ CHK_MASK_LEGAL(0x01, stuff->which, XkbAllNamesMask);
/* check device-independent stuff */
- tmp = (CARD32 *)&stuff[1];
-
- if (stuff->which&XkbKeycodesNameMask) {
- tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad);
- if (!tmp) {
- client->errorValue = bad;
- return BadAtom;
- }
- }
- if (stuff->which&XkbGeometryNameMask) {
- tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad);
- if (!tmp) {
- client->errorValue = bad;
- return BadAtom;
- }
- }
- if (stuff->which&XkbSymbolsNameMask) {
- tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad);
- if (!tmp) {
- client->errorValue = bad;
- return BadAtom;
- }
- }
- if (stuff->which&XkbPhysSymbolsNameMask) {
- tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad);
- if (!tmp) {
- client->errorValue= bad;
- return BadAtom;
- }
- }
- if (stuff->which&XkbTypesNameMask) {
- tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad);
- if (!tmp) {
- client->errorValue = bad;
- return BadAtom;
- }
- }
- if (stuff->which&XkbCompatNameMask) {
- tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad);
- if (!tmp) {
- client->errorValue = bad;
- return BadAtom;
- }
+ tmp = (CARD32 *) &stuff[1];
+
+ if (stuff->which & XkbKeycodesNameMask) {
+ tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
+ if (!tmp) {
+ client->errorValue = bad;
+ return BadAtom;
+ }
+ }
+ if (stuff->which & XkbGeometryNameMask) {
+ tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
+ if (!tmp) {
+ client->errorValue = bad;
+ return BadAtom;
+ }
+ }
+ if (stuff->which & XkbSymbolsNameMask) {
+ tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
+ if (!tmp) {
+ client->errorValue = bad;
+ return BadAtom;
+ }
+ }
+ if (stuff->which & XkbPhysSymbolsNameMask) {
+ tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
+ if (!tmp) {
+ client->errorValue = bad;
+ return BadAtom;
+ }
+ }
+ if (stuff->which & XkbTypesNameMask) {
+ tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
+ if (!tmp) {
+ client->errorValue = bad;
+ return BadAtom;
+ }
+ }
+ if (stuff->which & XkbCompatNameMask) {
+ tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad);
+ if (!tmp) {
+ client->errorValue = bad;
+ return BadAtom;
+ }
}
/* start of device-dependent tests */
@@ -4249,17 +4348,16 @@ ProcXkbSetNames(ClientPtr client)
if (rc != Success)
return rc;
- if (stuff->deviceSpec == XkbUseCoreKbd)
- {
+ if (stuff->deviceSpec == XkbUseCoreKbd) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
- {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
- if (rc == Success)
- {
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && other->key && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) {
+
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other,
+ DixManageAccess);
+ if (rc == Success) {
rc = _XkbSetNamesCheck(client, other, stuff, tmp);
if (rc != Success)
return rc;
@@ -4274,15 +4372,15 @@ ProcXkbSetNames(ClientPtr client)
if (rc != Success)
return rc;
- if (stuff->deviceSpec == XkbUseCoreKbd)
- {
+ if (stuff->deviceSpec == XkbUseCoreKbd) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
- {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && other->key && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) {
+
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other,
+ DixManageAccess);
if (rc == Success)
_XkbSetNames(client, other, stuff);
}
@@ -4312,47 +4410,48 @@ ProcXkbSetNames(ClientPtr client)
* (swapped) 16 bit string length, non-zero terminated.
*/
static char *
-XkbWriteCountedString(char *wire,char *str,Bool swap)
+XkbWriteCountedString(char *wire, char *str, Bool swap)
{
- CARD16 len,*pLen, paddedLen;
+ CARD16 len, *pLen, paddedLen;
if (!str)
return wire;
- len= strlen(str);
- pLen= (CARD16 *)wire;
- *pLen= len;
+ len = strlen(str);
+ pLen = (CARD16 *) wire;
+ *pLen = len;
if (swap) {
- swaps(pLen);
+ swaps(pLen);
}
- paddedLen= pad_to_int32(sizeof(len)+len)-sizeof(len);
- strncpy(&wire[sizeof(len)],str,paddedLen);
- wire+= sizeof(len)+paddedLen;
+ paddedLen = pad_to_int32(sizeof(len) + len) - sizeof(len);
+ strncpy(&wire[sizeof(len)], str, paddedLen);
+ wire += sizeof(len) + paddedLen;
return wire;
}
static int
XkbSizeGeomProperties(XkbGeometryPtr geom)
{
-register int i,size;
-XkbPropertyPtr prop;
-
- for (size=i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
- size+= XkbSizeCountedString(prop->name);
- size+= XkbSizeCountedString(prop->value);
+ register int i, size;
+ XkbPropertyPtr prop;
+
+ for (size = i = 0, prop = geom->properties; i < geom->num_properties;
+ i++, prop++) {
+ size += XkbSizeCountedString(prop->name);
+ size += XkbSizeCountedString(prop->value);
}
return size;
}
static char *
-XkbWriteGeomProperties(char *wire,XkbGeometryPtr geom,Bool swap)
+XkbWriteGeomProperties(char *wire, XkbGeometryPtr geom, Bool swap)
{
-register int i;
-register XkbPropertyPtr prop;
-
- for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
- wire= XkbWriteCountedString(wire,prop->name,swap);
- wire= XkbWriteCountedString(wire,prop->value,swap);
+ register int i;
+ register XkbPropertyPtr prop;
+
+ for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) {
+ wire = XkbWriteCountedString(wire, prop->name, swap);
+ wire = XkbWriteCountedString(wire, prop->value, swap);
}
return wire;
}
@@ -4360,18 +4459,18 @@ register XkbPropertyPtr prop;
static int
XkbSizeGeomKeyAliases(XkbGeometryPtr geom)
{
- return geom->num_key_aliases*(2*XkbKeyNameLength);
+ return geom->num_key_aliases * (2 * XkbKeyNameLength);
}
static char *
-XkbWriteGeomKeyAliases(char *wire,XkbGeometryPtr geom,Bool swap)
+XkbWriteGeomKeyAliases(char *wire, XkbGeometryPtr geom, Bool swap)
{
-register int sz;
-
- sz= geom->num_key_aliases*(XkbKeyNameLength*2);
- if (sz>0) {
- memcpy(wire,(char *)geom->key_aliases,sz);
- wire+= sz;
+ register int sz;
+
+ sz = geom->num_key_aliases * (XkbKeyNameLength * 2);
+ if (sz > 0) {
+ memcpy(wire, (char *) geom->key_aliases, sz);
+ wire += sz;
}
return wire;
}
@@ -4379,23 +4478,23 @@ register int sz;
static int
XkbSizeGeomColors(XkbGeometryPtr geom)
{
-register int i,size;
-register XkbColorPtr color;
+ register int i, size;
+ register XkbColorPtr color;
- for (i=size=0,color=geom->colors;i<geom->num_colors;i++,color++) {
- size+= XkbSizeCountedString(color->spec);
+ for (i = size = 0, color = geom->colors; i < geom->num_colors; i++, color++) {
+ size += XkbSizeCountedString(color->spec);
}
return size;
}
static char *
-XkbWriteGeomColors(char *wire,XkbGeometryPtr geom,Bool swap)
+XkbWriteGeomColors(char *wire, XkbGeometryPtr geom, Bool swap)
{
-register int i;
-register XkbColorPtr color;
+ register int i;
+ register XkbColorPtr color;
- for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) {
- wire= XkbWriteCountedString(wire,color->spec,swap);
+ for (i = 0, color = geom->colors; i < geom->num_colors; i++, color++) {
+ wire = XkbWriteCountedString(wire, color->spec, swap);
}
return wire;
}
@@ -4403,922 +4502,941 @@ register XkbColorPtr color;
static int
XkbSizeGeomShapes(XkbGeometryPtr geom)
{
-register int i,size;
-register XkbShapePtr shape;
-
- for (i=size=0,shape=geom->shapes;i<geom->num_shapes;i++,shape++) {
- register int n;
- register XkbOutlinePtr ol;
- size+= SIZEOF(xkbShapeWireDesc);
- for (n=0,ol=shape->outlines;n<shape->num_outlines;n++,ol++) {
- size+= SIZEOF(xkbOutlineWireDesc);
- size+= ol->num_points*SIZEOF(xkbPointWireDesc);
- }
+ register int i, size;
+ register XkbShapePtr shape;
+
+ for (i = size = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) {
+ register int n;
+ register XkbOutlinePtr ol;
+
+ size += SIZEOF(xkbShapeWireDesc);
+ for (n = 0, ol = shape->outlines; n < shape->num_outlines; n++, ol++) {
+ size += SIZEOF(xkbOutlineWireDesc);
+ size += ol->num_points * SIZEOF(xkbPointWireDesc);
+ }
}
return size;
}
static char *
-XkbWriteGeomShapes(char *wire,XkbGeometryPtr geom,Bool swap)
+XkbWriteGeomShapes(char *wire, XkbGeometryPtr geom, Bool swap)
{
-int i;
-XkbShapePtr shape;
-xkbShapeWireDesc * shapeWire;
-
- for (i=0,shape=geom->shapes;i<geom->num_shapes;i++,shape++) {
- register int o;
- XkbOutlinePtr ol;
- xkbOutlineWireDesc * olWire;
- shapeWire= (xkbShapeWireDesc *)wire;
- shapeWire->name= shape->name;
- shapeWire->nOutlines= shape->num_outlines;
- if (shape->primary!=NULL)
- shapeWire->primaryNdx= XkbOutlineIndex(shape,shape->primary);
- else shapeWire->primaryNdx= XkbNoShape;
- if (shape->approx!=NULL)
- shapeWire->approxNdx= XkbOutlineIndex(shape,shape->approx);
- else shapeWire->approxNdx= XkbNoShape;
- shapeWire->pad= 0;
- if (swap) {
- swapl(&shapeWire->name);
- }
- wire= (char *)&shapeWire[1];
- for (o=0,ol=shape->outlines;o<shape->num_outlines;o++,ol++) {
- register int p;
- XkbPointPtr pt;
- xkbPointWireDesc * ptWire;
- olWire= (xkbOutlineWireDesc *)wire;
- olWire->nPoints= ol->num_points;
- olWire->cornerRadius= ol->corner_radius;
- olWire->pad= 0;
- wire= (char *)&olWire[1];
- ptWire= (xkbPointWireDesc *)wire;
- for (p=0,pt=ol->points;p<ol->num_points;p++,pt++) {
- ptWire[p].x= pt->x;
- ptWire[p].y= pt->y;
- if (swap) {
- swaps(&ptWire[p].x);
- swaps(&ptWire[p].y);
- }
- }
- wire= (char *)&ptWire[ol->num_points];
- }
+ int i;
+ XkbShapePtr shape;
+ xkbShapeWireDesc *shapeWire;
+
+ for (i = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) {
+ register int o;
+ XkbOutlinePtr ol;
+ xkbOutlineWireDesc *olWire;
+
+ shapeWire = (xkbShapeWireDesc *) wire;
+ shapeWire->name = shape->name;
+ shapeWire->nOutlines = shape->num_outlines;
+ if (shape->primary != NULL)
+ shapeWire->primaryNdx = XkbOutlineIndex(shape, shape->primary);
+ else
+ shapeWire->primaryNdx = XkbNoShape;
+ if (shape->approx != NULL)
+ shapeWire->approxNdx = XkbOutlineIndex(shape, shape->approx);
+ else
+ shapeWire->approxNdx = XkbNoShape;
+ shapeWire->pad = 0;
+ if (swap) {
+ swapl(&shapeWire->name);
+ }
+ wire = (char *) &shapeWire[1];
+ for (o = 0, ol = shape->outlines; o < shape->num_outlines; o++, ol++) {
+ register int p;
+ XkbPointPtr pt;
+ xkbPointWireDesc *ptWire;
+
+ olWire = (xkbOutlineWireDesc *) wire;
+ olWire->nPoints = ol->num_points;
+ olWire->cornerRadius = ol->corner_radius;
+ olWire->pad = 0;
+ wire = (char *) &olWire[1];
+ ptWire = (xkbPointWireDesc *) wire;
+ for (p = 0, pt = ol->points; p < ol->num_points; p++, pt++) {
+ ptWire[p].x = pt->x;
+ ptWire[p].y = pt->y;
+ if (swap) {
+ swaps(&ptWire[p].x);
+ swaps(&ptWire[p].y);
+ }
+ }
+ wire = (char *) &ptWire[ol->num_points];
+ }
}
return wire;
}
static int
-XkbSizeGeomDoodads(int num_doodads,XkbDoodadPtr doodad)
+XkbSizeGeomDoodads(int num_doodads, XkbDoodadPtr doodad)
{
-register int i,size;
-
- for (i=size=0;i<num_doodads;i++,doodad++) {
- size+= SIZEOF(xkbAnyDoodadWireDesc);
- if (doodad->any.type==XkbTextDoodad) {
- size+= XkbSizeCountedString(doodad->text.text);
- size+= XkbSizeCountedString(doodad->text.font);
- }
- else if (doodad->any.type==XkbLogoDoodad) {
- size+= XkbSizeCountedString(doodad->logo.logo_name);
- }
+ register int i, size;
+
+ for (i = size = 0; i < num_doodads; i++, doodad++) {
+ size += SIZEOF(xkbAnyDoodadWireDesc);
+ if (doodad->any.type == XkbTextDoodad) {
+ size += XkbSizeCountedString(doodad->text.text);
+ size += XkbSizeCountedString(doodad->text.font);
+ }
+ else if (doodad->any.type == XkbLogoDoodad) {
+ size += XkbSizeCountedString(doodad->logo.logo_name);
+ }
}
return size;
}
static char *
-XkbWriteGeomDoodads(char *wire,int num_doodads,XkbDoodadPtr doodad,Bool swap)
+XkbWriteGeomDoodads(char *wire, int num_doodads, XkbDoodadPtr doodad, Bool swap)
{
-register int i;
-xkbDoodadWireDesc * doodadWire;
-
- for (i=0;i<num_doodads;i++,doodad++) {
- doodadWire= (xkbDoodadWireDesc *)wire;
- wire= (char *)&doodadWire[1];
- memset(doodadWire, 0, SIZEOF(xkbDoodadWireDesc));
- doodadWire->any.name= doodad->any.name;
- doodadWire->any.type= doodad->any.type;
- doodadWire->any.priority= doodad->any.priority;
- doodadWire->any.top= doodad->any.top;
- doodadWire->any.left= doodad->any.left;
- if (swap) {
- swapl(&doodadWire->any.name);
- swaps(&doodadWire->any.top);
- swaps(&doodadWire->any.left);
- }
- switch (doodad->any.type) {
- case XkbOutlineDoodad:
- case XkbSolidDoodad:
- doodadWire->shape.angle= doodad->shape.angle;
- doodadWire->shape.colorNdx= doodad->shape.color_ndx;
- doodadWire->shape.shapeNdx= doodad->shape.shape_ndx;
- if (swap) {
- swaps(&doodadWire->shape.angle);
- }
- break;
- case XkbTextDoodad:
- doodadWire->text.angle= doodad->text.angle;
- doodadWire->text.width= doodad->text.width;
- doodadWire->text.height= doodad->text.height;
- doodadWire->text.colorNdx= doodad->text.color_ndx;
- if (swap) {
- swaps(&doodadWire->text.angle);
- swaps(&doodadWire->text.width);
- swaps(&doodadWire->text.height);
- }
- wire= XkbWriteCountedString(wire,doodad->text.text,swap);
- wire= XkbWriteCountedString(wire,doodad->text.font,swap);
- break;
- case XkbIndicatorDoodad:
- doodadWire->indicator.shapeNdx= doodad->indicator.shape_ndx;
- doodadWire->indicator.onColorNdx=doodad->indicator.on_color_ndx;
- doodadWire->indicator.offColorNdx=
- doodad->indicator.off_color_ndx;
- break;
- case XkbLogoDoodad:
- doodadWire->logo.angle= doodad->logo.angle;
- doodadWire->logo.colorNdx= doodad->logo.color_ndx;
- doodadWire->logo.shapeNdx= doodad->logo.shape_ndx;
- wire= XkbWriteCountedString(wire,doodad->logo.logo_name,swap);
- break;
- default:
- ErrorF("[xkb] Unknown doodad type %d in XkbWriteGeomDoodads\n",
- doodad->any.type);
- ErrorF("[xkb] Ignored\n");
- break;
- }
+ register int i;
+ xkbDoodadWireDesc *doodadWire;
+
+ for (i = 0; i < num_doodads; i++, doodad++) {
+ doodadWire = (xkbDoodadWireDesc *) wire;
+ wire = (char *) &doodadWire[1];
+ memset(doodadWire, 0, SIZEOF(xkbDoodadWireDesc));
+ doodadWire->any.name = doodad->any.name;
+ doodadWire->any.type = doodad->any.type;
+ doodadWire->any.priority = doodad->any.priority;
+ doodadWire->any.top = doodad->any.top;
+ doodadWire->any.left = doodad->any.left;
+ if (swap) {
+ swapl(&doodadWire->any.name);
+ swaps(&doodadWire->any.top);
+ swaps(&doodadWire->any.left);
+ }
+ switch (doodad->any.type) {
+ case XkbOutlineDoodad:
+ case XkbSolidDoodad:
+ doodadWire->shape.angle = doodad->shape.angle;
+ doodadWire->shape.colorNdx = doodad->shape.color_ndx;
+ doodadWire->shape.shapeNdx = doodad->shape.shape_ndx;
+ if (swap) {
+ swaps(&doodadWire->shape.angle);
+ }
+ break;
+ case XkbTextDoodad:
+ doodadWire->text.angle = doodad->text.angle;
+ doodadWire->text.width = doodad->text.width;
+ doodadWire->text.height = doodad->text.height;
+ doodadWire->text.colorNdx = doodad->text.color_ndx;
+ if (swap) {
+ swaps(&doodadWire->text.angle);
+ swaps(&doodadWire->text.width);
+ swaps(&doodadWire->text.height);
+ }
+ wire = XkbWriteCountedString(wire, doodad->text.text, swap);
+ wire = XkbWriteCountedString(wire, doodad->text.font, swap);
+ break;
+ case XkbIndicatorDoodad:
+ doodadWire->indicator.shapeNdx = doodad->indicator.shape_ndx;
+ doodadWire->indicator.onColorNdx = doodad->indicator.on_color_ndx;
+ doodadWire->indicator.offColorNdx = doodad->indicator.off_color_ndx;
+ break;
+ case XkbLogoDoodad:
+ doodadWire->logo.angle = doodad->logo.angle;
+ doodadWire->logo.colorNdx = doodad->logo.color_ndx;
+ doodadWire->logo.shapeNdx = doodad->logo.shape_ndx;
+ wire = XkbWriteCountedString(wire, doodad->logo.logo_name, swap);
+ break;
+ default:
+ ErrorF("[xkb] Unknown doodad type %d in XkbWriteGeomDoodads\n",
+ doodad->any.type);
+ ErrorF("[xkb] Ignored\n");
+ break;
+ }
}
return wire;
}
static char *
-XkbWriteGeomOverlay(char *wire,XkbOverlayPtr ol,Bool swap)
+XkbWriteGeomOverlay(char *wire, XkbOverlayPtr ol, Bool swap)
{
-register int r;
-XkbOverlayRowPtr row;
-xkbOverlayWireDesc * olWire;
-
- olWire= (xkbOverlayWireDesc *)wire;
- olWire->name= ol->name;
- olWire->nRows= ol->num_rows;
- olWire->pad1= 0;
- olWire->pad2= 0;
- if (swap) {
- swapl(&olWire->name);
- }
- wire= (char *)&olWire[1];
- for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) {
- unsigned int k;
- XkbOverlayKeyPtr key;
- xkbOverlayRowWireDesc * rowWire;
- rowWire= (xkbOverlayRowWireDesc *)wire;
- rowWire->rowUnder= row->row_under;
- rowWire->nKeys= row->num_keys;
- rowWire->pad1= 0;
- wire= (char *)&rowWire[1];
- for (k=0,key=row->keys;k<row->num_keys;k++,key++) {
- xkbOverlayKeyWireDesc * keyWire;
- keyWire= (xkbOverlayKeyWireDesc *)wire;
- memcpy(keyWire->over,key->over.name,XkbKeyNameLength);
- memcpy(keyWire->under,key->under.name,XkbKeyNameLength);
- wire= (char *)&keyWire[1];
- }
- }
- return wire;
+ register int r;
+ XkbOverlayRowPtr row;
+ xkbOverlayWireDesc *olWire;
+
+ olWire = (xkbOverlayWireDesc *) wire;
+ olWire->name = ol->name;
+ olWire->nRows = ol->num_rows;
+ olWire->pad1 = 0;
+ olWire->pad2 = 0;
+ if (swap) {
+ swapl(&olWire->name);
+ }
+ wire = (char *) &olWire[1];
+ for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) {
+ unsigned int k;
+ XkbOverlayKeyPtr key;
+ xkbOverlayRowWireDesc *rowWire;
+
+ rowWire = (xkbOverlayRowWireDesc *) wire;
+ rowWire->rowUnder = row->row_under;
+ rowWire->nKeys = row->num_keys;
+ rowWire->pad1 = 0;
+ wire = (char *) &rowWire[1];
+ for (k = 0, key = row->keys; k < row->num_keys; k++, key++) {
+ xkbOverlayKeyWireDesc *keyWire;
+
+ keyWire = (xkbOverlayKeyWireDesc *) wire;
+ memcpy(keyWire->over, key->over.name, XkbKeyNameLength);
+ memcpy(keyWire->under, key->under.name, XkbKeyNameLength);
+ wire = (char *) &keyWire[1];
+ }
+ }
+ return wire;
}
static int
XkbSizeGeomSections(XkbGeometryPtr geom)
{
-register int i,size;
-XkbSectionPtr section;
-
- for (i=size=0,section=geom->sections;i<geom->num_sections;i++,section++) {
- size+= SIZEOF(xkbSectionWireDesc);
- if (section->rows) {
- int r;
- XkbRowPtr row;
- for (r=0,row=section->rows;r<section->num_rows;row++,r++) {
- size+= SIZEOF(xkbRowWireDesc);
- size+= row->num_keys*SIZEOF(xkbKeyWireDesc);
- }
- }
- if (section->doodads)
- size+= XkbSizeGeomDoodads(section->num_doodads,section->doodads);
- if (section->overlays) {
- int o;
- XkbOverlayPtr ol;
- for (o=0,ol=section->overlays;o<section->num_overlays;o++,ol++) {
- int r;
- XkbOverlayRowPtr row;
- size+= SIZEOF(xkbOverlayWireDesc);
- for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) {
- size+= SIZEOF(xkbOverlayRowWireDesc);
- size+= row->num_keys*SIZEOF(xkbOverlayKeyWireDesc);
- }
- }
- }
+ register int i, size;
+ XkbSectionPtr section;
+
+ for (i = size = 0, section = geom->sections; i < geom->num_sections;
+ i++, section++) {
+ size += SIZEOF(xkbSectionWireDesc);
+ if (section->rows) {
+ int r;
+ XkbRowPtr row;
+
+ for (r = 0, row = section->rows; r < section->num_rows; row++, r++) {
+ size += SIZEOF(xkbRowWireDesc);
+ size += row->num_keys * SIZEOF(xkbKeyWireDesc);
+ }
+ }
+ if (section->doodads)
+ size += XkbSizeGeomDoodads(section->num_doodads, section->doodads);
+ if (section->overlays) {
+ int o;
+ XkbOverlayPtr ol;
+
+ for (o = 0, ol = section->overlays; o < section->num_overlays;
+ o++, ol++) {
+ int r;
+ XkbOverlayRowPtr row;
+
+ size += SIZEOF(xkbOverlayWireDesc);
+ for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) {
+ size += SIZEOF(xkbOverlayRowWireDesc);
+ size += row->num_keys * SIZEOF(xkbOverlayKeyWireDesc);
+ }
+ }
+ }
}
return size;
}
static char *
-XkbWriteGeomSections(char *wire,XkbGeometryPtr geom,Bool swap)
+XkbWriteGeomSections(char *wire, XkbGeometryPtr geom, Bool swap)
{
-register int i;
-XkbSectionPtr section;
-xkbSectionWireDesc * sectionWire;
-
- for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) {
- sectionWire= (xkbSectionWireDesc *)wire;
- sectionWire->name= section->name;
- sectionWire->top= section->top;
- sectionWire->left= section->left;
- sectionWire->width= section->width;
- sectionWire->height= section->height;
- sectionWire->angle= section->angle;
- sectionWire->priority= section->priority;
- sectionWire->nRows= section->num_rows;
- sectionWire->nDoodads= section->num_doodads;
- sectionWire->nOverlays= section->num_overlays;
- sectionWire->pad= 0;
- if (swap) {
- swapl(&sectionWire->name);
- swaps(&sectionWire->top);
- swaps(&sectionWire->left);
- swaps(&sectionWire->width);
- swaps(&sectionWire->height);
- swaps(&sectionWire->angle);
- }
- wire= (char *)&sectionWire[1];
- if (section->rows) {
- int r;
- XkbRowPtr row;
- xkbRowWireDesc * rowWire;
- for (r=0,row=section->rows;r<section->num_rows;r++,row++) {
- rowWire= (xkbRowWireDesc *)wire;
- rowWire->top= row->top;
- rowWire->left= row->left;
- rowWire->nKeys= row->num_keys;
- rowWire->vertical= row->vertical;
- rowWire->pad= 0;
- if (swap) {
- swaps(&rowWire->top);
- swaps(&rowWire->left);
- }
- wire= (char *)&rowWire[1];
- if (row->keys) {
- int k;
- XkbKeyPtr key;
- xkbKeyWireDesc * keyWire;
- keyWire= (xkbKeyWireDesc *)wire;
- for (k=0,key=row->keys;k<row->num_keys;k++,key++) {
- memcpy(keyWire[k].name,key->name.name,XkbKeyNameLength);
- keyWire[k].gap= key->gap;
- keyWire[k].shapeNdx= key->shape_ndx;
- keyWire[k].colorNdx= key->color_ndx;
- if (swap) {
- swaps(&keyWire[k].gap);
- }
- }
- wire= (char *)&keyWire[row->num_keys];
- }
- }
- }
- if (section->doodads) {
- wire= XkbWriteGeomDoodads(wire,
- section->num_doodads,section->doodads,
- swap);
- }
- if (section->overlays) {
- register int o;
- for (o=0;o<section->num_overlays;o++) {
- wire= XkbWriteGeomOverlay(wire,&section->overlays[o],swap);
- }
- }
+ register int i;
+ XkbSectionPtr section;
+ xkbSectionWireDesc *sectionWire;
+
+ for (i = 0, section = geom->sections; i < geom->num_sections;
+ i++, section++) {
+ sectionWire = (xkbSectionWireDesc *) wire;
+ sectionWire->name = section->name;
+ sectionWire->top = section->top;
+ sectionWire->left = section->left;
+ sectionWire->width = section->width;
+ sectionWire->height = section->height;
+ sectionWire->angle = section->angle;
+ sectionWire->priority = section->priority;
+ sectionWire->nRows = section->num_rows;
+ sectionWire->nDoodads = section->num_doodads;
+ sectionWire->nOverlays = section->num_overlays;
+ sectionWire->pad = 0;
+ if (swap) {
+ swapl(&sectionWire->name);
+ swaps(&sectionWire->top);
+ swaps(&sectionWire->left);
+ swaps(&sectionWire->width);
+ swaps(&sectionWire->height);
+ swaps(&sectionWire->angle);
+ }
+ wire = (char *) &sectionWire[1];
+ if (section->rows) {
+ int r;
+ XkbRowPtr row;
+ xkbRowWireDesc *rowWire;
+
+ for (r = 0, row = section->rows; r < section->num_rows; r++, row++) {
+ rowWire = (xkbRowWireDesc *) wire;
+ rowWire->top = row->top;
+ rowWire->left = row->left;
+ rowWire->nKeys = row->num_keys;
+ rowWire->vertical = row->vertical;
+ rowWire->pad = 0;
+ if (swap) {
+ swaps(&rowWire->top);
+ swaps(&rowWire->left);
+ }
+ wire = (char *) &rowWire[1];
+ if (row->keys) {
+ int k;
+ XkbKeyPtr key;
+ xkbKeyWireDesc *keyWire;
+
+ keyWire = (xkbKeyWireDesc *) wire;
+ for (k = 0, key = row->keys; k < row->num_keys; k++, key++) {
+ memcpy(keyWire[k].name, key->name.name,
+ XkbKeyNameLength);
+ keyWire[k].gap = key->gap;
+ keyWire[k].shapeNdx = key->shape_ndx;
+ keyWire[k].colorNdx = key->color_ndx;
+ if (swap) {
+ swaps(&keyWire[k].gap);
+ }
+ }
+ wire = (char *) &keyWire[row->num_keys];
+ }
+ }
+ }
+ if (section->doodads) {
+ wire = XkbWriteGeomDoodads(wire,
+ section->num_doodads, section->doodads,
+ swap);
+ }
+ if (section->overlays) {
+ register int o;
+
+ for (o = 0; o < section->num_overlays; o++) {
+ wire = XkbWriteGeomOverlay(wire, &section->overlays[o], swap);
+ }
+ }
}
return wire;
}
static Status
-XkbComputeGetGeometryReplySize( XkbGeometryPtr geom,
- xkbGetGeometryReply * rep,
- Atom name)
+XkbComputeGetGeometryReplySize(XkbGeometryPtr geom,
+ xkbGetGeometryReply * rep, Atom name)
{
-int len;
-
- if (geom!=NULL) {
- len= XkbSizeCountedString(geom->label_font);
- len+= XkbSizeGeomProperties(geom);
- len+= XkbSizeGeomColors(geom);
- len+= XkbSizeGeomShapes(geom);
- len+= XkbSizeGeomSections(geom);
- len+= XkbSizeGeomDoodads(geom->num_doodads,geom->doodads);
- len+= XkbSizeGeomKeyAliases(geom);
- rep->length= len/4;
- rep->found= TRUE;
- rep->name= geom->name;
- rep->widthMM= geom->width_mm;
- rep->heightMM= geom->height_mm;
- rep->nProperties= geom->num_properties;
- rep->nColors= geom->num_colors;
- rep->nShapes= geom->num_shapes;
- rep->nSections= geom->num_sections;
- rep->nDoodads= geom->num_doodads;
- rep->nKeyAliases= geom->num_key_aliases;
- rep->baseColorNdx= XkbGeomColorIndex(geom,geom->base_color);
- rep->labelColorNdx= XkbGeomColorIndex(geom,geom->label_color);
+ int len;
+
+ if (geom != NULL) {
+ len = XkbSizeCountedString(geom->label_font);
+ len += XkbSizeGeomProperties(geom);
+ len += XkbSizeGeomColors(geom);
+ len += XkbSizeGeomShapes(geom);
+ len += XkbSizeGeomSections(geom);
+ len += XkbSizeGeomDoodads(geom->num_doodads, geom->doodads);
+ len += XkbSizeGeomKeyAliases(geom);
+ rep->length = len / 4;
+ rep->found = TRUE;
+ rep->name = geom->name;
+ rep->widthMM = geom->width_mm;
+ rep->heightMM = geom->height_mm;
+ rep->nProperties = geom->num_properties;
+ rep->nColors = geom->num_colors;
+ rep->nShapes = geom->num_shapes;
+ rep->nSections = geom->num_sections;
+ rep->nDoodads = geom->num_doodads;
+ rep->nKeyAliases = geom->num_key_aliases;
+ rep->baseColorNdx = XkbGeomColorIndex(geom, geom->base_color);
+ rep->labelColorNdx = XkbGeomColorIndex(geom, geom->label_color);
}
else {
- rep->length= 0;
- rep->found= FALSE;
- rep->name= name;
- rep->widthMM= rep->heightMM= 0;
- rep->nProperties= rep->nColors= rep->nShapes= 0;
- rep->nSections= rep->nDoodads= 0;
- rep->nKeyAliases= 0;
- rep->labelColorNdx= rep->baseColorNdx= 0;
+ rep->length = 0;
+ rep->found = FALSE;
+ rep->name = name;
+ rep->widthMM = rep->heightMM = 0;
+ rep->nProperties = rep->nColors = rep->nShapes = 0;
+ rep->nSections = rep->nDoodads = 0;
+ rep->nKeyAliases = 0;
+ rep->labelColorNdx = rep->baseColorNdx = 0;
}
return Success;
}
static int
-XkbSendGeometry( ClientPtr client,
- XkbGeometryPtr geom,
- xkbGetGeometryReply * rep,
- Bool freeGeom)
+XkbSendGeometry(ClientPtr client,
+ XkbGeometryPtr geom, xkbGetGeometryReply * rep, Bool freeGeom)
{
- char *desc,*start;
- int len;
-
- if (geom!=NULL) {
- len= rep->length*4;
- start= desc= malloc(len);
- if (!start)
- return BadAlloc;
- desc= XkbWriteCountedString(desc,geom->label_font,client->swapped);
- if ( rep->nProperties>0 )
- desc = XkbWriteGeomProperties(desc,geom,client->swapped);
- if ( rep->nColors>0 )
- desc = XkbWriteGeomColors(desc,geom,client->swapped);
- if ( rep->nShapes>0 )
- desc = XkbWriteGeomShapes(desc,geom,client->swapped);
- if ( rep->nSections>0 )
- desc = XkbWriteGeomSections(desc,geom,client->swapped);
- if ( rep->nDoodads>0 )
- desc = XkbWriteGeomDoodads(desc,geom->num_doodads,geom->doodads,
- client->swapped);
- if ( rep->nKeyAliases>0 )
- desc = XkbWriteGeomKeyAliases(desc,geom,client->swapped);
- if ((desc-start)!=(len)) {
- ErrorF("[xkb] BOGUS LENGTH in XkbSendGeometry, expected %d, got %ld\n",
- len, (unsigned long)(desc-start));
- }
+ char *desc, *start;
+ int len;
+
+ if (geom != NULL) {
+ len = rep->length * 4;
+ start = desc = malloc(len);
+ if (!start)
+ return BadAlloc;
+ desc = XkbWriteCountedString(desc, geom->label_font, client->swapped);
+ if (rep->nProperties > 0)
+ desc = XkbWriteGeomProperties(desc, geom, client->swapped);
+ if (rep->nColors > 0)
+ desc = XkbWriteGeomColors(desc, geom, client->swapped);
+ if (rep->nShapes > 0)
+ desc = XkbWriteGeomShapes(desc, geom, client->swapped);
+ if (rep->nSections > 0)
+ desc = XkbWriteGeomSections(desc, geom, client->swapped);
+ if (rep->nDoodads > 0)
+ desc = XkbWriteGeomDoodads(desc, geom->num_doodads, geom->doodads,
+ client->swapped);
+ if (rep->nKeyAliases > 0)
+ desc = XkbWriteGeomKeyAliases(desc, geom, client->swapped);
+ if ((desc - start) != (len)) {
+ ErrorF
+ ("[xkb] BOGUS LENGTH in XkbSendGeometry, expected %d, got %ld\n",
+ len, (unsigned long) (desc - start));
+ }
}
else {
- len= 0;
- start= NULL;
+ len = 0;
+ start = NULL;
}
if (client->swapped) {
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swapl(&rep->name);
- swaps(&rep->widthMM);
- swaps(&rep->heightMM);
- swaps(&rep->nProperties);
- swaps(&rep->nColors);
- swaps(&rep->nShapes);
- swaps(&rep->nSections);
- swaps(&rep->nDoodads);
- swaps(&rep->nKeyAliases);
- }
- WriteToClient(client, SIZEOF(xkbGetGeometryReply), (char *)rep);
- if (len>0)
- WriteToClient(client, len, start);
- if (start!=NULL)
- free((char *)start);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->name);
+ swaps(&rep->widthMM);
+ swaps(&rep->heightMM);
+ swaps(&rep->nProperties);
+ swaps(&rep->nColors);
+ swaps(&rep->nShapes);
+ swaps(&rep->nSections);
+ swaps(&rep->nDoodads);
+ swaps(&rep->nKeyAliases);
+ }
+ WriteToClient(client, SIZEOF(xkbGetGeometryReply), (char *) rep);
+ if (len > 0)
+ WriteToClient(client, len, start);
+ if (start != NULL)
+ free((char *) start);
if (freeGeom)
- XkbFreeGeometry(geom,XkbGeomAllMask,TRUE);
+ XkbFreeGeometry(geom, XkbGeomAllMask, TRUE);
return Success;
}
int
ProcXkbGetGeometry(ClientPtr client)
{
- DeviceIntPtr dev;
+ DeviceIntPtr dev;
xkbGetGeometryReply rep;
- XkbGeometryPtr geom;
- Bool shouldFree;
- Status status;
+ XkbGeometryPtr geom;
+ Bool shouldFree;
+ Status status;
REQUEST(xkbGetGeometryReq);
REQUEST_SIZE_MATCH(xkbGetGeometryReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
CHK_ATOM_OR_NONE(stuff->name);
- geom= XkbLookupNamedGeometry(dev,stuff->name,&shouldFree);
- rep.type= X_Reply;
- rep.deviceID= dev->id;
- rep.sequenceNumber= client->sequence;
- rep.length= 0;
- status= XkbComputeGetGeometryReplySize(geom,&rep,stuff->name);
- if (status!=Success)
- return status;
- else return XkbSendGeometry(client,geom,&rep,shouldFree);
+ geom = XkbLookupNamedGeometry(dev, stuff->name, &shouldFree);
+ rep.type = X_Reply;
+ rep.deviceID = dev->id;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ status = XkbComputeGetGeometryReplySize(geom, &rep, stuff->name);
+ if (status != Success)
+ return status;
+ else
+ return XkbSendGeometry(client, geom, &rep, shouldFree);
}
/***====================================================================***/
static char *
-_GetCountedString(char **wire_inout,Bool swap)
+_GetCountedString(char **wire_inout, Bool swap)
{
-char * wire,*str;
-CARD16 len,*plen;
+ char *wire, *str;
+ CARD16 len, *plen;
- wire= *wire_inout;
- plen= (CARD16 *)wire;
+ wire = *wire_inout;
+ plen = (CARD16 *) wire;
if (swap) {
- swaps(plen);
+ swaps(plen);
}
- len= *plen;
- str= malloc(len+1);
+ len = *plen;
+ str = malloc(len + 1);
if (str) {
- memcpy(str,&wire[2],len);
- str[len]= '\0';
+ memcpy(str, &wire[2], len);
+ str[len] = '\0';
}
- wire+= XkbPaddedSize(len+2);
- *wire_inout= wire;
+ wire += XkbPaddedSize(len + 2);
+ *wire_inout = wire;
return str;
}
static Status
-_CheckSetDoodad( char ** wire_inout,
- XkbGeometryPtr geom,
- XkbSectionPtr section,
- ClientPtr client)
+_CheckSetDoodad(char **wire_inout,
+ XkbGeometryPtr geom, XkbSectionPtr section, ClientPtr client)
{
-char * wire;
-xkbDoodadWireDesc * dWire;
-XkbDoodadPtr doodad;
+ char *wire;
+ xkbDoodadWireDesc *dWire;
+ XkbDoodadPtr doodad;
- dWire= (xkbDoodadWireDesc *)(*wire_inout);
- wire= (char *)&dWire[1];
+ dWire = (xkbDoodadWireDesc *) (*wire_inout);
+ wire = (char *) &dWire[1];
if (client->swapped) {
- swapl(&dWire->any.name);
- swaps(&dWire->any.top);
- swaps(&dWire->any.left);
- swaps(&dWire->any.angle);
+ swapl(&dWire->any.name);
+ swaps(&dWire->any.top);
+ swaps(&dWire->any.left);
+ swaps(&dWire->any.angle);
}
CHK_ATOM_ONLY(dWire->any.name);
- doodad= XkbAddGeomDoodad(geom,section,dWire->any.name);
+ doodad = XkbAddGeomDoodad(geom, section, dWire->any.name);
if (!doodad)
- return BadAlloc;
- doodad->any.type= dWire->any.type;
- doodad->any.priority= dWire->any.priority;
- doodad->any.top= dWire->any.top;
- doodad->any.left= dWire->any.left;
- doodad->any.angle= dWire->any.angle;
+ return BadAlloc;
+ doodad->any.type = dWire->any.type;
+ doodad->any.priority = dWire->any.priority;
+ doodad->any.top = dWire->any.top;
+ doodad->any.left = dWire->any.left;
+ doodad->any.angle = dWire->any.angle;
switch (doodad->any.type) {
- case XkbOutlineDoodad:
- case XkbSolidDoodad:
- if (dWire->shape.colorNdx>=geom->num_colors) {
- client->errorValue= _XkbErrCode3(0x40,geom->num_colors,
- dWire->shape.colorNdx);
- return BadMatch;
- }
- if (dWire->shape.shapeNdx>=geom->num_shapes) {
- client->errorValue= _XkbErrCode3(0x41,geom->num_shapes,
- dWire->shape.shapeNdx);
- return BadMatch;
- }
- doodad->shape.color_ndx= dWire->shape.colorNdx;
- doodad->shape.shape_ndx= dWire->shape.shapeNdx;
- break;
- case XkbTextDoodad:
- if (dWire->text.colorNdx>=geom->num_colors) {
- client->errorValue= _XkbErrCode3(0x42,geom->num_colors,
- dWire->text.colorNdx);
- return BadMatch;
- }
- if (client->swapped) {
- swaps(&dWire->text.width);
- swaps(&dWire->text.height);
- }
- doodad->text.width= dWire->text.width;
- doodad->text.height= dWire->text.height;
- doodad->text.color_ndx= dWire->text.colorNdx;
- doodad->text.text= _GetCountedString(&wire,client->swapped);
- doodad->text.font= _GetCountedString(&wire,client->swapped);
- break;
- case XkbIndicatorDoodad:
- if (dWire->indicator.onColorNdx>=geom->num_colors) {
- client->errorValue= _XkbErrCode3(0x43,geom->num_colors,
- dWire->indicator.onColorNdx);
- return BadMatch;
- }
- if (dWire->indicator.offColorNdx>=geom->num_colors) {
- client->errorValue= _XkbErrCode3(0x44,geom->num_colors,
- dWire->indicator.offColorNdx);
- return BadMatch;
- }
- if (dWire->indicator.shapeNdx>=geom->num_shapes) {
- client->errorValue= _XkbErrCode3(0x45,geom->num_shapes,
- dWire->indicator.shapeNdx);
- return BadMatch;
- }
- doodad->indicator.shape_ndx= dWire->indicator.shapeNdx;
- doodad->indicator.on_color_ndx= dWire->indicator.onColorNdx;
- doodad->indicator.off_color_ndx= dWire->indicator.offColorNdx;
- break;
- case XkbLogoDoodad:
- if (dWire->logo.colorNdx>=geom->num_colors) {
- client->errorValue= _XkbErrCode3(0x46,geom->num_colors,
- dWire->logo.colorNdx);
- return BadMatch;
- }
- if (dWire->logo.shapeNdx>=geom->num_shapes) {
- client->errorValue= _XkbErrCode3(0x47,geom->num_shapes,
- dWire->logo.shapeNdx);
- return BadMatch;
- }
- doodad->logo.color_ndx= dWire->logo.colorNdx;
- doodad->logo.shape_ndx= dWire->logo.shapeNdx;
- doodad->logo.logo_name= _GetCountedString(&wire,client->swapped);
- break;
- default:
- client->errorValue= _XkbErrCode2(0x4F,dWire->any.type);
- return BadValue;
- }
- *wire_inout= wire;
+ case XkbOutlineDoodad:
+ case XkbSolidDoodad:
+ if (dWire->shape.colorNdx >= geom->num_colors) {
+ client->errorValue = _XkbErrCode3(0x40, geom->num_colors,
+ dWire->shape.colorNdx);
+ return BadMatch;
+ }
+ if (dWire->shape.shapeNdx >= geom->num_shapes) {
+ client->errorValue = _XkbErrCode3(0x41, geom->num_shapes,
+ dWire->shape.shapeNdx);
+ return BadMatch;
+ }
+ doodad->shape.color_ndx = dWire->shape.colorNdx;
+ doodad->shape.shape_ndx = dWire->shape.shapeNdx;
+ break;
+ case XkbTextDoodad:
+ if (dWire->text.colorNdx >= geom->num_colors) {
+ client->errorValue = _XkbErrCode3(0x42, geom->num_colors,
+ dWire->text.colorNdx);
+ return BadMatch;
+ }
+ if (client->swapped) {
+ swaps(&dWire->text.width);
+ swaps(&dWire->text.height);
+ }
+ doodad->text.width = dWire->text.width;
+ doodad->text.height = dWire->text.height;
+ doodad->text.color_ndx = dWire->text.colorNdx;
+ doodad->text.text = _GetCountedString(&wire, client->swapped);
+ doodad->text.font = _GetCountedString(&wire, client->swapped);
+ break;
+ case XkbIndicatorDoodad:
+ if (dWire->indicator.onColorNdx >= geom->num_colors) {
+ client->errorValue = _XkbErrCode3(0x43, geom->num_colors,
+ dWire->indicator.onColorNdx);
+ return BadMatch;
+ }
+ if (dWire->indicator.offColorNdx >= geom->num_colors) {
+ client->errorValue = _XkbErrCode3(0x44, geom->num_colors,
+ dWire->indicator.offColorNdx);
+ return BadMatch;
+ }
+ if (dWire->indicator.shapeNdx >= geom->num_shapes) {
+ client->errorValue = _XkbErrCode3(0x45, geom->num_shapes,
+ dWire->indicator.shapeNdx);
+ return BadMatch;
+ }
+ doodad->indicator.shape_ndx = dWire->indicator.shapeNdx;
+ doodad->indicator.on_color_ndx = dWire->indicator.onColorNdx;
+ doodad->indicator.off_color_ndx = dWire->indicator.offColorNdx;
+ break;
+ case XkbLogoDoodad:
+ if (dWire->logo.colorNdx >= geom->num_colors) {
+ client->errorValue = _XkbErrCode3(0x46, geom->num_colors,
+ dWire->logo.colorNdx);
+ return BadMatch;
+ }
+ if (dWire->logo.shapeNdx >= geom->num_shapes) {
+ client->errorValue = _XkbErrCode3(0x47, geom->num_shapes,
+ dWire->logo.shapeNdx);
+ return BadMatch;
+ }
+ doodad->logo.color_ndx = dWire->logo.colorNdx;
+ doodad->logo.shape_ndx = dWire->logo.shapeNdx;
+ doodad->logo.logo_name = _GetCountedString(&wire, client->swapped);
+ break;
+ default:
+ client->errorValue = _XkbErrCode2(0x4F, dWire->any.type);
+ return BadValue;
+ }
+ *wire_inout = wire;
return Success;
}
static Status
-_CheckSetOverlay( char ** wire_inout,
- XkbGeometryPtr geom,
- XkbSectionPtr section,
- ClientPtr client)
+_CheckSetOverlay(char **wire_inout,
+ XkbGeometryPtr geom, XkbSectionPtr section, ClientPtr client)
{
-register int r;
-char * wire;
-XkbOverlayPtr ol;
-xkbOverlayWireDesc * olWire;
-xkbOverlayRowWireDesc * rWire;
-
- wire= *wire_inout;
- olWire= (xkbOverlayWireDesc *)wire;
+ register int r;
+ char *wire;
+ XkbOverlayPtr ol;
+ xkbOverlayWireDesc *olWire;
+ xkbOverlayRowWireDesc *rWire;
+
+ wire = *wire_inout;
+ olWire = (xkbOverlayWireDesc *) wire;
if (client->swapped) {
- swapl(&olWire->name);
+ swapl(&olWire->name);
}
CHK_ATOM_ONLY(olWire->name);
- ol= XkbAddGeomOverlay(section,olWire->name,olWire->nRows);
- rWire= (xkbOverlayRowWireDesc *)&olWire[1];
- for (r=0;r<olWire->nRows;r++) {
- register int k;
- xkbOverlayKeyWireDesc * kWire;
- XkbOverlayRowPtr row;
-
- if (rWire->rowUnder>section->num_rows) {
- client->errorValue= _XkbErrCode4(0x20,r,section->num_rows,
- rWire->rowUnder);
- return BadMatch;
- }
- row= XkbAddGeomOverlayRow(ol,rWire->rowUnder,rWire->nKeys);
- kWire= (xkbOverlayKeyWireDesc *)&rWire[1];
- for (k=0;k<rWire->nKeys;k++,kWire++) {
- if (XkbAddGeomOverlayKey(ol,row,
- (char *)kWire->over,(char *)kWire->under)==NULL) {
- client->errorValue= _XkbErrCode3(0x21,r,k);
- return BadMatch;
- }
- }
- rWire= (xkbOverlayRowWireDesc *)kWire;
- }
- olWire= (xkbOverlayWireDesc *)rWire;
- wire= (char *)olWire;
- *wire_inout= wire;
+ ol = XkbAddGeomOverlay(section, olWire->name, olWire->nRows);
+ rWire = (xkbOverlayRowWireDesc *) & olWire[1];
+ for (r = 0; r < olWire->nRows; r++) {
+ register int k;
+ xkbOverlayKeyWireDesc *kWire;
+ XkbOverlayRowPtr row;
+
+ if (rWire->rowUnder > section->num_rows) {
+ client->errorValue = _XkbErrCode4(0x20, r, section->num_rows,
+ rWire->rowUnder);
+ return BadMatch;
+ }
+ row = XkbAddGeomOverlayRow(ol, rWire->rowUnder, rWire->nKeys);
+ kWire = (xkbOverlayKeyWireDesc *) & rWire[1];
+ for (k = 0; k < rWire->nKeys; k++, kWire++) {
+ if (XkbAddGeomOverlayKey(ol, row,
+ (char *) kWire->over,
+ (char *) kWire->under) == NULL) {
+ client->errorValue = _XkbErrCode3(0x21, r, k);
+ return BadMatch;
+ }
+ }
+ rWire = (xkbOverlayRowWireDesc *) kWire;
+ }
+ olWire = (xkbOverlayWireDesc *) rWire;
+ wire = (char *) olWire;
+ *wire_inout = wire;
return Success;
}
static Status
-_CheckSetSections( XkbGeometryPtr geom,
- xkbSetGeometryReq * req,
- char ** wire_inout,
- ClientPtr client)
+_CheckSetSections(XkbGeometryPtr geom,
+ xkbSetGeometryReq * req, char **wire_inout, ClientPtr client)
{
-Status status;
-register int s;
-char * wire;
-xkbSectionWireDesc * sWire;
-XkbSectionPtr section;
-
- wire= *wire_inout;
- if (req->nSections<1)
- return Success;
- sWire= (xkbSectionWireDesc *)wire;
- for (s=0;s<req->nSections;s++) {
- register int r;
- xkbRowWireDesc * rWire;
- if (client->swapped) {
- swapl(&sWire->name);
- swaps(&sWire->top);
- swaps(&sWire->left);
- swaps(&sWire->width);
- swaps(&sWire->height);
- swaps(&sWire->angle);
- }
- CHK_ATOM_ONLY(sWire->name);
- section= XkbAddGeomSection(geom,sWire->name,sWire->nRows,
- sWire->nDoodads,sWire->nOverlays);
- if (!section)
- return BadAlloc;
- section->priority= sWire->priority;
- section->top= sWire->top;
- section->left= sWire->left;
- section->width= sWire->width;
- section->height= sWire->height;
- section->angle= sWire->angle;
- rWire= (xkbRowWireDesc *)&sWire[1];
- for (r=0;r<sWire->nRows;r++) {
- register int k;
- XkbRowPtr row;
- xkbKeyWireDesc * kWire;
- if (client->swapped) {
- swaps(&rWire->top);
- swaps(&rWire->left);
- }
- row= XkbAddGeomRow(section,rWire->nKeys);
- if (!row)
- return BadAlloc;
- row->top= rWire->top;
- row->left= rWire->left;
- row->vertical= rWire->vertical;
- kWire= (xkbKeyWireDesc *)&rWire[1];
- for (k=0;k<rWire->nKeys;k++) {
- XkbKeyPtr key;
- key= XkbAddGeomKey(row);
- if (!key)
- return BadAlloc;
- memcpy(key->name.name,kWire[k].name,XkbKeyNameLength);
- key->gap= kWire[k].gap;
- key->shape_ndx= kWire[k].shapeNdx;
- key->color_ndx= kWire[k].colorNdx;
- if (key->shape_ndx>=geom->num_shapes) {
- client->errorValue= _XkbErrCode3(0x10,key->shape_ndx,
- geom->num_shapes);
- return BadMatch;
- }
- if (key->color_ndx>=geom->num_colors) {
- client->errorValue= _XkbErrCode3(0x11,key->color_ndx,
- geom->num_colors);
- return BadMatch;
- }
- }
- rWire= (xkbRowWireDesc *)&kWire[rWire->nKeys];
- }
- wire= (char *)rWire;
- if (sWire->nDoodads>0) {
- register int d;
- for (d=0;d<sWire->nDoodads;d++) {
- status=_CheckSetDoodad(&wire,geom,section,client);
- if (status!=Success)
- return status;
- }
- }
- if (sWire->nOverlays>0) {
- register int o;
- for (o=0;o<sWire->nOverlays;o++) {
- status= _CheckSetOverlay(&wire,geom,section,client);
- if (status!=Success)
- return status;
- }
- }
- sWire= (xkbSectionWireDesc *)wire;
- }
- wire= (char *)sWire;
- *wire_inout= wire;
+ Status status;
+ register int s;
+ char *wire;
+ xkbSectionWireDesc *sWire;
+ XkbSectionPtr section;
+
+ wire = *wire_inout;
+ if (req->nSections < 1)
+ return Success;
+ sWire = (xkbSectionWireDesc *) wire;
+ for (s = 0; s < req->nSections; s++) {
+ register int r;
+ xkbRowWireDesc *rWire;
+
+ if (client->swapped) {
+ swapl(&sWire->name);
+ swaps(&sWire->top);
+ swaps(&sWire->left);
+ swaps(&sWire->width);
+ swaps(&sWire->height);
+ swaps(&sWire->angle);
+ }
+ CHK_ATOM_ONLY(sWire->name);
+ section = XkbAddGeomSection(geom, sWire->name, sWire->nRows,
+ sWire->nDoodads, sWire->nOverlays);
+ if (!section)
+ return BadAlloc;
+ section->priority = sWire->priority;
+ section->top = sWire->top;
+ section->left = sWire->left;
+ section->width = sWire->width;
+ section->height = sWire->height;
+ section->angle = sWire->angle;
+ rWire = (xkbRowWireDesc *) & sWire[1];
+ for (r = 0; r < sWire->nRows; r++) {
+ register int k;
+ XkbRowPtr row;
+ xkbKeyWireDesc *kWire;
+
+ if (client->swapped) {
+ swaps(&rWire->top);
+ swaps(&rWire->left);
+ }
+ row = XkbAddGeomRow(section, rWire->nKeys);
+ if (!row)
+ return BadAlloc;
+ row->top = rWire->top;
+ row->left = rWire->left;
+ row->vertical = rWire->vertical;
+ kWire = (xkbKeyWireDesc *) & rWire[1];
+ for (k = 0; k < rWire->nKeys; k++) {
+ XkbKeyPtr key;
+
+ key = XkbAddGeomKey(row);
+ if (!key)
+ return BadAlloc;
+ memcpy(key->name.name, kWire[k].name, XkbKeyNameLength);
+ key->gap = kWire[k].gap;
+ key->shape_ndx = kWire[k].shapeNdx;
+ key->color_ndx = kWire[k].colorNdx;
+ if (key->shape_ndx >= geom->num_shapes) {
+ client->errorValue = _XkbErrCode3(0x10, key->shape_ndx,
+ geom->num_shapes);
+ return BadMatch;
+ }
+ if (key->color_ndx >= geom->num_colors) {
+ client->errorValue = _XkbErrCode3(0x11, key->color_ndx,
+ geom->num_colors);
+ return BadMatch;
+ }
+ }
+ rWire = (xkbRowWireDesc *) & kWire[rWire->nKeys];
+ }
+ wire = (char *) rWire;
+ if (sWire->nDoodads > 0) {
+ register int d;
+
+ for (d = 0; d < sWire->nDoodads; d++) {
+ status = _CheckSetDoodad(&wire, geom, section, client);
+ if (status != Success)
+ return status;
+ }
+ }
+ if (sWire->nOverlays > 0) {
+ register int o;
+
+ for (o = 0; o < sWire->nOverlays; o++) {
+ status = _CheckSetOverlay(&wire, geom, section, client);
+ if (status != Success)
+ return status;
+ }
+ }
+ sWire = (xkbSectionWireDesc *) wire;
+ }
+ wire = (char *) sWire;
+ *wire_inout = wire;
return Success;
}
static Status
-_CheckSetShapes( XkbGeometryPtr geom,
- xkbSetGeometryReq * req,
- char ** wire_inout,
- ClientPtr client)
+_CheckSetShapes(XkbGeometryPtr geom,
+ xkbSetGeometryReq * req, char **wire_inout, ClientPtr client)
{
-register int i;
-char * wire;
+ register int i;
+ char *wire;
- wire= *wire_inout;
- if (req->nShapes<1) {
- client->errorValue= _XkbErrCode2(0x06,req->nShapes);
- return BadValue;
+ wire = *wire_inout;
+ if (req->nShapes < 1) {
+ client->errorValue = _XkbErrCode2(0x06, req->nShapes);
+ return BadValue;
}
else {
- xkbShapeWireDesc * shapeWire;
- XkbShapePtr shape;
- register int o;
- shapeWire= (xkbShapeWireDesc *)wire;
- for (i=0;i<req->nShapes;i++) {
- xkbOutlineWireDesc * olWire;
- XkbOutlinePtr ol;
- shape= XkbAddGeomShape(geom,shapeWire->name,shapeWire->nOutlines);
- if (!shape)
- return BadAlloc;
- olWire= (xkbOutlineWireDesc *)(&shapeWire[1]);
- for (o=0;o<shapeWire->nOutlines;o++) {
- register int p;
- XkbPointPtr pt;
- xkbPointWireDesc * ptWire;
-
- ol= XkbAddGeomOutline(shape,olWire->nPoints);
- if (!ol)
- return BadAlloc;
- ol->corner_radius= olWire->cornerRadius;
- ptWire= (xkbPointWireDesc *)&olWire[1];
- for (p=0,pt=ol->points;p<olWire->nPoints;p++,pt++) {
- pt->x= ptWire[p].x;
- pt->y= ptWire[p].y;
- if (client->swapped) {
- swaps(&pt->x);
- swaps(&pt->y);
- }
- }
- ol->num_points= olWire->nPoints;
- olWire= (xkbOutlineWireDesc *)(&ptWire[olWire->nPoints]);
- }
- if (shapeWire->primaryNdx!=XkbNoShape)
- shape->primary= &shape->outlines[shapeWire->primaryNdx];
- if (shapeWire->approxNdx!=XkbNoShape)
- shape->approx= &shape->outlines[shapeWire->approxNdx];
- shapeWire= (xkbShapeWireDesc *)olWire;
- }
- wire= (char *)shapeWire;
- }
- if (geom->num_shapes!=req->nShapes) {
- client->errorValue= _XkbErrCode3(0x07,geom->num_shapes,req->nShapes);
- return BadMatch;
- }
-
- *wire_inout= wire;
+ xkbShapeWireDesc *shapeWire;
+ XkbShapePtr shape;
+ register int o;
+
+ shapeWire = (xkbShapeWireDesc *) wire;
+ for (i = 0; i < req->nShapes; i++) {
+ xkbOutlineWireDesc *olWire;
+ XkbOutlinePtr ol;
+
+ shape =
+ XkbAddGeomShape(geom, shapeWire->name, shapeWire->nOutlines);
+ if (!shape)
+ return BadAlloc;
+ olWire = (xkbOutlineWireDesc *) (&shapeWire[1]);
+ for (o = 0; o < shapeWire->nOutlines; o++) {
+ register int p;
+ XkbPointPtr pt;
+ xkbPointWireDesc *ptWire;
+
+ ol = XkbAddGeomOutline(shape, olWire->nPoints);
+ if (!ol)
+ return BadAlloc;
+ ol->corner_radius = olWire->cornerRadius;
+ ptWire = (xkbPointWireDesc *) & olWire[1];
+ for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) {
+ pt->x = ptWire[p].x;
+ pt->y = ptWire[p].y;
+ if (client->swapped) {
+ swaps(&pt->x);
+ swaps(&pt->y);
+ }
+ }
+ ol->num_points = olWire->nPoints;
+ olWire = (xkbOutlineWireDesc *) (&ptWire[olWire->nPoints]);
+ }
+ if (shapeWire->primaryNdx != XkbNoShape)
+ shape->primary = &shape->outlines[shapeWire->primaryNdx];
+ if (shapeWire->approxNdx != XkbNoShape)
+ shape->approx = &shape->outlines[shapeWire->approxNdx];
+ shapeWire = (xkbShapeWireDesc *) olWire;
+ }
+ wire = (char *) shapeWire;
+ }
+ if (geom->num_shapes != req->nShapes) {
+ client->errorValue = _XkbErrCode3(0x07, geom->num_shapes, req->nShapes);
+ return BadMatch;
+ }
+
+ *wire_inout = wire;
return Success;
}
static Status
-_CheckSetGeom( XkbGeometryPtr geom,
- xkbSetGeometryReq * req,
- ClientPtr client)
+_CheckSetGeom(XkbGeometryPtr geom, xkbSetGeometryReq * req, ClientPtr client)
{
-register int i;
-Status status;
-char * wire;
+ register int i;
+ Status status;
+ char *wire;
+
+ wire = (char *) &req[1];
+ geom->label_font = _GetCountedString(&wire, client->swapped);
- wire= (char *)&req[1];
- geom->label_font= _GetCountedString(&wire,client->swapped);
+ for (i = 0; i < req->nProperties; i++) {
+ char *name, *val;
- for (i=0;i<req->nProperties;i++) {
- char *name,*val;
- name= _GetCountedString(&wire,client->swapped);
+ name = _GetCountedString(&wire, client->swapped);
if (!name)
return BadAlloc;
- val= _GetCountedString(&wire,client->swapped);
+ val = _GetCountedString(&wire, client->swapped);
if (!val) {
free(name);
return BadAlloc;
}
- if (XkbAddGeomProperty(geom,name,val)==NULL) {
+ if (XkbAddGeomProperty(geom, name, val) == NULL) {
free(name);
free(val);
- return BadAlloc;
+ return BadAlloc;
}
free(name);
free(val);
}
- if (req->nColors<2) {
- client->errorValue= _XkbErrCode3(0x01,2,req->nColors);
- return BadValue;
+ if (req->nColors < 2) {
+ client->errorValue = _XkbErrCode3(0x01, 2, req->nColors);
+ return BadValue;
}
- if (req->baseColorNdx>req->nColors) {
- client->errorValue=_XkbErrCode3(0x03,req->nColors,req->baseColorNdx);
- return BadMatch;
+ if (req->baseColorNdx > req->nColors) {
+ client->errorValue =
+ _XkbErrCode3(0x03, req->nColors, req->baseColorNdx);
+ return BadMatch;
}
- if (req->labelColorNdx>req->nColors) {
- client->errorValue= _XkbErrCode3(0x03,req->nColors,req->labelColorNdx);
- return BadMatch;
+ if (req->labelColorNdx > req->nColors) {
+ client->errorValue =
+ _XkbErrCode3(0x03, req->nColors, req->labelColorNdx);
+ return BadMatch;
}
- if (req->labelColorNdx==req->baseColorNdx) {
- client->errorValue= _XkbErrCode3(0x04,req->baseColorNdx,
- req->labelColorNdx);
- return BadMatch;
+ if (req->labelColorNdx == req->baseColorNdx) {
+ client->errorValue = _XkbErrCode3(0x04, req->baseColorNdx,
+ req->labelColorNdx);
+ return BadMatch;
}
- for (i=0;i<req->nColors;i++) {
- char *name;
- name= _GetCountedString(&wire,client->swapped);
- if (!name)
+ for (i = 0; i < req->nColors; i++) {
+ char *name;
+
+ name = _GetCountedString(&wire, client->swapped);
+ if (!name)
return BadAlloc;
- if (!XkbAddGeomColor(geom,name,geom->num_colors)) {
+ if (!XkbAddGeomColor(geom, name, geom->num_colors)) {
free(name);
- return BadAlloc;
+ return BadAlloc;
}
free(name);
}
- if (req->nColors!=geom->num_colors) {
- client->errorValue= _XkbErrCode3(0x05,req->nColors,geom->num_colors);
- return BadMatch;
+ if (req->nColors != geom->num_colors) {
+ client->errorValue = _XkbErrCode3(0x05, req->nColors, geom->num_colors);
+ return BadMatch;
}
- geom->label_color= &geom->colors[req->labelColorNdx];
- geom->base_color= &geom->colors[req->baseColorNdx];
+ geom->label_color = &geom->colors[req->labelColorNdx];
+ geom->base_color = &geom->colors[req->baseColorNdx];
- if ((status=_CheckSetShapes(geom,req,&wire,client))!=Success)
- return status;
+ if ((status = _CheckSetShapes(geom, req, &wire, client)) != Success)
+ return status;
- if ((status=_CheckSetSections(geom,req,&wire,client))!=Success)
- return status;
+ if ((status = _CheckSetSections(geom, req, &wire, client)) != Success)
+ return status;
- for (i=0;i<req->nDoodads;i++) {
- status=_CheckSetDoodad(&wire,geom,NULL,client);
- if (status!=Success)
- return status;
+ for (i = 0; i < req->nDoodads; i++) {
+ status = _CheckSetDoodad(&wire, geom, NULL, client);
+ if (status != Success)
+ return status;
}
- for (i=0;i<req->nKeyAliases;i++) {
- if (XkbAddGeomKeyAlias(geom,&wire[XkbKeyNameLength],wire)==NULL)
- return BadAlloc;
- wire+= 2*XkbKeyNameLength;
+ for (i = 0; i < req->nKeyAliases; i++) {
+ if (XkbAddGeomKeyAlias(geom, &wire[XkbKeyNameLength], wire) == NULL)
+ return BadAlloc;
+ wire += 2 * XkbKeyNameLength;
}
return Success;
}
static int
-_XkbSetGeometry(ClientPtr client, DeviceIntPtr dev, xkbSetGeometryReq *stuff)
+_XkbSetGeometry(ClientPtr client, DeviceIntPtr dev, xkbSetGeometryReq * stuff)
{
- XkbDescPtr xkb;
- Bool new_name;
- xkbNewKeyboardNotify nkn;
- XkbGeometryPtr geom,old;
- XkbGeometrySizesRec sizes;
- Status status;
-
- xkb= dev->key->xkbInfo->desc;
- old= xkb->geom;
- xkb->geom= NULL;
-
- sizes.which= XkbGeomAllMask;
- sizes.num_properties= stuff->nProperties;
- sizes.num_colors= stuff->nColors;
- sizes.num_shapes= stuff->nShapes;
- sizes.num_sections= stuff->nSections;
- sizes.num_doodads= stuff->nDoodads;
- sizes.num_key_aliases= stuff->nKeyAliases;
- if ((status= XkbAllocGeometry(xkb,&sizes))!=Success) {
- xkb->geom= old;
+ XkbDescPtr xkb;
+ Bool new_name;
+ xkbNewKeyboardNotify nkn;
+ XkbGeometryPtr geom, old;
+ XkbGeometrySizesRec sizes;
+ Status status;
+
+ xkb = dev->key->xkbInfo->desc;
+ old = xkb->geom;
+ xkb->geom = NULL;
+
+ sizes.which = XkbGeomAllMask;
+ sizes.num_properties = stuff->nProperties;
+ sizes.num_colors = stuff->nColors;
+ sizes.num_shapes = stuff->nShapes;
+ sizes.num_sections = stuff->nSections;
+ sizes.num_doodads = stuff->nDoodads;
+ sizes.num_key_aliases = stuff->nKeyAliases;
+ if ((status = XkbAllocGeometry(xkb, &sizes)) != Success) {
+ xkb->geom = old;
return status;
}
- geom= xkb->geom;
- geom->name= stuff->name;
- geom->width_mm= stuff->widthMM;
- geom->height_mm= stuff->heightMM;
- if ((status= _CheckSetGeom(geom,stuff,client))!=Success) {
- XkbFreeGeometry(geom,XkbGeomAllMask,TRUE);
- xkb->geom= old;
+ geom = xkb->geom;
+ geom->name = stuff->name;
+ geom->width_mm = stuff->widthMM;
+ geom->height_mm = stuff->heightMM;
+ if ((status = _CheckSetGeom(geom, stuff, client)) != Success) {
+ XkbFreeGeometry(geom, XkbGeomAllMask, TRUE);
+ xkb->geom = old;
return status;
}
- new_name= (xkb->names->geometry!=geom->name);
- xkb->names->geometry= geom->name;
+ new_name = (xkb->names->geometry != geom->name);
+ xkb->names->geometry = geom->name;
if (old)
- XkbFreeGeometry(old,XkbGeomAllMask,TRUE);
+ XkbFreeGeometry(old, XkbGeomAllMask, TRUE);
if (new_name) {
- xkbNamesNotify nn;
+ xkbNamesNotify nn;
+
memset(&nn, 0, sizeof(xkbNamesNotify));
- nn.changed= XkbGeometryNameMask;
- XkbSendNamesNotify(dev,&nn);
- }
- nkn.deviceID= nkn.oldDeviceID= dev->id;
- nkn.minKeyCode= nkn.oldMinKeyCode= xkb->min_key_code;
- nkn.maxKeyCode= nkn.oldMaxKeyCode= xkb->max_key_code;
- nkn.requestMajor= XkbReqCode;
- nkn.requestMinor= X_kbSetGeometry;
- nkn.changed= XkbNKN_GeometryMask;
- XkbSendNewKeyboardNotify(dev,&nkn);
+ nn.changed = XkbGeometryNameMask;
+ XkbSendNamesNotify(dev, &nn);
+ }
+ nkn.deviceID = nkn.oldDeviceID = dev->id;
+ nkn.minKeyCode = nkn.oldMinKeyCode = xkb->min_key_code;
+ nkn.maxKeyCode = nkn.oldMaxKeyCode = xkb->max_key_code;
+ nkn.requestMajor = XkbReqCode;
+ nkn.requestMinor = X_kbSetGeometry;
+ nkn.changed = XkbNKN_GeometryMask;
+ XkbSendNewKeyboardNotify(dev, &nkn);
return Success;
}
int
ProcXkbSetGeometry(ClientPtr client)
{
- DeviceIntPtr dev;
- int rc;
+ DeviceIntPtr dev;
+ int rc;
REQUEST(xkbSetGeometryReq);
REQUEST_AT_LEAST_SIZE(xkbSetGeometryReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
CHK_ATOM_OR_NONE(stuff->name);
@@ -5327,14 +5445,14 @@ ProcXkbSetGeometry(ClientPtr client)
if (rc != Success)
return rc;
- if (stuff->deviceSpec == XkbUseCoreKbd)
- {
+ if (stuff->deviceSpec == XkbUseCoreKbd) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev)
- {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if ((other != dev) && other->key && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other,
+ DixManageAccess);
if (rc == Success)
_XkbSetGeometry(client, other, stuff);
}
@@ -5349,75 +5467,78 @@ ProcXkbSetGeometry(ClientPtr client)
int
ProcXkbPerClientFlags(ClientPtr client)
{
- DeviceIntPtr dev;
- xkbPerClientFlagsReply rep;
- XkbInterestPtr interest;
+ DeviceIntPtr dev;
+ xkbPerClientFlagsReply rep;
+ XkbInterestPtr interest;
Mask access_mode = DixGetAttrAccess | DixSetAttrAccess;
REQUEST(xkbPerClientFlagsReq);
REQUEST_SIZE_MATCH(xkbPerClientFlagsReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, access_mode);
- CHK_MASK_LEGAL(0x01,stuff->change,XkbPCF_AllFlagsMask);
- CHK_MASK_MATCH(0x02,stuff->change,stuff->value);
+ CHK_MASK_LEGAL(0x01, stuff->change, XkbPCF_AllFlagsMask);
+ CHK_MASK_MATCH(0x02, stuff->change, stuff->value);
- interest = XkbFindClientResource((DevicePtr)dev,client);
+ interest = XkbFindClientResource((DevicePtr) dev, client);
memset(&rep, 0, sizeof(xkbPerClientFlagsReply));
- rep.type= X_Reply;
+ rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (stuff->change) {
- client->xkbClientFlags&= ~stuff->change;
- client->xkbClientFlags|= stuff->value;
- }
- if (stuff->change&XkbPCF_AutoResetControlsMask) {
- Bool want;
- want= stuff->value&XkbPCF_AutoResetControlsMask;
- if (interest && !want) {
- interest->autoCtrls= interest->autoCtrlValues= 0;
- }
- else if (want && (!interest)) {
- XID id = FakeClientID(client->index);
- if (!AddResource(id,RT_XKBCLIENT,dev))
- return BadAlloc;
- interest= XkbAddClientResource((DevicePtr)dev,client,id);
- if (!interest)
- return BadAlloc;
- }
- if (interest && want ) {
- register unsigned affect;
- affect= stuff->ctrlsToChange;
-
- CHK_MASK_LEGAL(0x03,affect,XkbAllBooleanCtrlsMask);
- CHK_MASK_MATCH(0x04,affect,stuff->autoCtrls);
- CHK_MASK_MATCH(0x05,stuff->autoCtrls,stuff->autoCtrlValues);
-
- interest->autoCtrls&= ~affect;
- interest->autoCtrlValues&= ~affect;
- interest->autoCtrls|= stuff->autoCtrls&affect;
- interest->autoCtrlValues|= stuff->autoCtrlValues&affect;
- }
+ client->xkbClientFlags &= ~stuff->change;
+ client->xkbClientFlags |= stuff->value;
+ }
+ if (stuff->change & XkbPCF_AutoResetControlsMask) {
+ Bool want;
+
+ want = stuff->value & XkbPCF_AutoResetControlsMask;
+ if (interest && !want) {
+ interest->autoCtrls = interest->autoCtrlValues = 0;
+ }
+ else if (want && (!interest)) {
+ XID id = FakeClientID(client->index);
+
+ if (!AddResource(id, RT_XKBCLIENT, dev))
+ return BadAlloc;
+ interest = XkbAddClientResource((DevicePtr) dev, client, id);
+ if (!interest)
+ return BadAlloc;
+ }
+ if (interest && want) {
+ register unsigned affect;
+
+ affect = stuff->ctrlsToChange;
+
+ CHK_MASK_LEGAL(0x03, affect, XkbAllBooleanCtrlsMask);
+ CHK_MASK_MATCH(0x04, affect, stuff->autoCtrls);
+ CHK_MASK_MATCH(0x05, stuff->autoCtrls, stuff->autoCtrlValues);
+
+ interest->autoCtrls &= ~affect;
+ interest->autoCtrlValues &= ~affect;
+ interest->autoCtrls |= stuff->autoCtrls & affect;
+ interest->autoCtrlValues |= stuff->autoCtrlValues & affect;
+ }
}
rep.supported = XkbPCF_AllFlagsMask;
- rep.value= client->xkbClientFlags&XkbPCF_AllFlagsMask;
+ rep.value = client->xkbClientFlags & XkbPCF_AllFlagsMask;
if (interest) {
- rep.autoCtrls= interest->autoCtrls;
- rep.autoCtrlValues= interest->autoCtrlValues;
+ rep.autoCtrls = interest->autoCtrls;
+ rep.autoCtrlValues = interest->autoCtrlValues;
}
else {
- rep.autoCtrls= rep.autoCtrlValues= 0;
+ rep.autoCtrls = rep.autoCtrlValues = 0;
}
- if ( client->swapped ) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.supported);
- swapl(&rep.value);
- swapl(&rep.autoCtrls);
- swapl(&rep.autoCtrlValues);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.supported);
+ swapl(&rep.value);
+ swapl(&rep.autoCtrls);
+ swapl(&rep.autoCtrlValues);
}
- WriteToClient(client,SIZEOF(xkbPerClientFlagsReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xkbPerClientFlagsReply), (char *) &rep);
return Success;
}
@@ -5426,57 +5547,60 @@ ProcXkbPerClientFlags(ClientPtr client)
/* all latin-1 alphanumerics, plus parens, minus, underscore, slash */
/* and wildcards */
static unsigned char componentSpecLegal[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x87,
- 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x87,
+ 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff
};
/* same as above but accepts percent, plus and bar too */
static unsigned char componentExprLegal[] = {
- 0x00, 0x00, 0x00, 0x00, 0x20, 0xaf, 0xff, 0x87,
- 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x17,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0xaf, 0xff, 0x87,
+ 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x17,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff
};
static char *
-GetComponentSpec(unsigned char **pWire,Bool allowExpr,int *errRtrn)
+GetComponentSpec(unsigned char **pWire, Bool allowExpr, int *errRtrn)
{
-int len;
-register int i;
-unsigned char *wire,*str,*tmp,*legal;
-
- if (allowExpr) legal= &componentExprLegal[0];
- else legal= &componentSpecLegal[0];
-
- wire= *pWire;
- len= (*(unsigned char *)wire++);
- if (len>0) {
- str= calloc(1, len+1);
- if (str) {
- tmp= str;
- for (i=0;i<len;i++) {
- if (legal[(*wire)/8]&(1<<((*wire)%8)))
- *tmp++= *wire++;
- else wire++;
- }
- if (tmp!=str)
- *tmp++= '\0';
- else {
- free(str);
- str= NULL;
- }
- }
- else {
- *errRtrn= BadAlloc;
- }
+ int len;
+ register int i;
+ unsigned char *wire, *str, *tmp, *legal;
+
+ if (allowExpr)
+ legal = &componentExprLegal[0];
+ else
+ legal = &componentSpecLegal[0];
+
+ wire = *pWire;
+ len = (*(unsigned char *) wire++);
+ if (len > 0) {
+ str = calloc(1, len + 1);
+ if (str) {
+ tmp = str;
+ for (i = 0; i < len; i++) {
+ if (legal[(*wire) / 8] & (1 << ((*wire) % 8)))
+ *tmp++ = *wire++;
+ else
+ wire++;
+ }
+ if (tmp != str)
+ *tmp++ = '\0';
+ else {
+ free(str);
+ str = NULL;
+ }
+ }
+ else {
+ *errRtrn = BadAlloc;
+ }
}
else {
- str= NULL;
+ str = NULL;
}
- *pWire= wire;
- return (char *)str;
+ *pWire = wire;
+ return (char *) str;
}
/***====================================================================***/
@@ -5484,70 +5608,70 @@ unsigned char *wire,*str,*tmp,*legal;
int
ProcXkbListComponents(ClientPtr client)
{
- DeviceIntPtr dev;
- xkbListComponentsReply rep;
- unsigned len;
- int status;
- unsigned char * str;
- XkbSrvListInfoRec list;
+ DeviceIntPtr dev;
+ xkbListComponentsReply rep;
+ unsigned len;
+ int status;
+ unsigned char *str;
+ XkbSrvListInfoRec list;
REQUEST(xkbListComponentsReq);
REQUEST_AT_LEAST_SIZE(xkbListComponentsReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
- status= Success;
- str= (unsigned char *)&stuff[1];
+ status = Success;
+ str = (unsigned char *) &stuff[1];
memset(&list, 0, sizeof(XkbSrvListInfoRec));
- list.maxRtrn= stuff->maxNames;
- list.pattern[_XkbListKeycodes]= GetComponentSpec(&str,FALSE,&status);
- list.pattern[_XkbListTypes]= GetComponentSpec(&str,FALSE,&status);
- list.pattern[_XkbListCompat]= GetComponentSpec(&str,FALSE,&status);
- list.pattern[_XkbListSymbols]= GetComponentSpec(&str,FALSE,&status);
- list.pattern[_XkbListGeometry]= GetComponentSpec(&str,FALSE,&status);
- if (status!=Success)
- return status;
- len= str-((unsigned char *)stuff);
- if ((XkbPaddedSize(len)/4)!=stuff->length)
- return BadLength;
- if ((status=XkbDDXList(dev,&list,client))!=Success) {
- free(list.pool);
- list.pool = NULL;
- return status;
+ list.maxRtrn = stuff->maxNames;
+ list.pattern[_XkbListKeycodes] = GetComponentSpec(&str, FALSE, &status);
+ list.pattern[_XkbListTypes] = GetComponentSpec(&str, FALSE, &status);
+ list.pattern[_XkbListCompat] = GetComponentSpec(&str, FALSE, &status);
+ list.pattern[_XkbListSymbols] = GetComponentSpec(&str, FALSE, &status);
+ list.pattern[_XkbListGeometry] = GetComponentSpec(&str, FALSE, &status);
+ if (status != Success)
+ return status;
+ len = str - ((unsigned char *) stuff);
+ if ((XkbPaddedSize(len) / 4) != stuff->length)
+ return BadLength;
+ if ((status = XkbDDXList(dev, &list, client)) != Success) {
+ free(list.pool);
+ list.pool = NULL;
+ return status;
}
memset(&rep, 0, sizeof(xkbListComponentsReply));
- rep.type= X_Reply;
+ rep.type = X_Reply;
rep.deviceID = dev->id;
rep.sequenceNumber = client->sequence;
- rep.length = XkbPaddedSize(list.nPool)/4;
+ rep.length = XkbPaddedSize(list.nPool) / 4;
rep.nKeymaps = 0;
rep.nKeycodes = list.nFound[_XkbListKeycodes];
rep.nTypes = list.nFound[_XkbListTypes];
rep.nCompatMaps = list.nFound[_XkbListCompat];
rep.nSymbols = list.nFound[_XkbListSymbols];
rep.nGeometries = list.nFound[_XkbListGeometry];
- rep.extra= 0;
- if (list.nTotal>list.maxRtrn)
- rep.extra = (list.nTotal-list.maxRtrn);
+ rep.extra = 0;
+ if (list.nTotal > list.maxRtrn)
+ rep.extra = (list.nTotal - list.maxRtrn);
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.nKeymaps);
- swaps(&rep.nKeycodes);
- swaps(&rep.nTypes);
- swaps(&rep.nCompatMaps);
- swaps(&rep.nSymbols);
- swaps(&rep.nGeometries);
- swaps(&rep.extra);
- }
- WriteToClient(client,SIZEOF(xkbListComponentsReply),(char *)&rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.nKeymaps);
+ swaps(&rep.nKeycodes);
+ swaps(&rep.nTypes);
+ swaps(&rep.nCompatMaps);
+ swaps(&rep.nSymbols);
+ swaps(&rep.nGeometries);
+ swaps(&rep.extra);
+ }
+ WriteToClient(client, SIZEOF(xkbListComponentsReply), (char *) &rep);
if (list.nPool && list.pool) {
- WriteToClient(client,XkbPaddedSize(list.nPool), (char *)list.pool);
- free(list.pool);
- list.pool= NULL;
+ WriteToClient(client, XkbPaddedSize(list.nPool), (char *) list.pool);
+ free(list.pool);
+ list.pool = NULL;
}
return Success;
}
@@ -5557,32 +5681,32 @@ ProcXkbListComponents(ClientPtr client)
int
ProcXkbGetKbdByName(ClientPtr client)
{
- DeviceIntPtr dev;
- DeviceIntPtr tmpd;
- DeviceIntPtr master;
- xkbGetKbdByNameReply rep = {0};
- xkbGetMapReply mrep = {0};
- xkbGetCompatMapReply crep = {0};
- xkbGetIndicatorMapReply irep = {0};
- xkbGetNamesReply nrep = {0};
- xkbGetGeometryReply grep = {0};
- XkbComponentNamesRec names = {0};
- XkbDescPtr xkb, new;
- unsigned char * str;
- char mapFile[PATH_MAX];
- unsigned len;
- unsigned fwant,fneed,reported;
- int status;
- Bool geom_changed;
- XkbSrvLedInfoPtr old_sli;
- XkbSrvLedInfoPtr sli;
+ DeviceIntPtr dev;
+ DeviceIntPtr tmpd;
+ DeviceIntPtr master;
+ xkbGetKbdByNameReply rep = { 0 };
+ xkbGetMapReply mrep = { 0 };
+ xkbGetCompatMapReply crep = { 0 };
+ xkbGetIndicatorMapReply irep = { 0 };
+ xkbGetNamesReply nrep = { 0 };
+ xkbGetGeometryReply grep = { 0 };
+ XkbComponentNamesRec names = { 0 };
+ XkbDescPtr xkb, new;
+ unsigned char *str;
+ char mapFile[PATH_MAX];
+ unsigned len;
+ unsigned fwant, fneed, reported;
+ int status;
+ Bool geom_changed;
+ XkbSrvLedInfoPtr old_sli;
+ XkbSrvLedInfoPtr sli;
Mask access_mode = DixGetAttrAccess | DixManageAccess;
REQUEST(xkbGetKbdByNameReq);
REQUEST_AT_LEAST_SIZE(xkbGetKbdByNameReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
memset(&mrep,0,sizeof(mrep)); //MH
@@ -5590,272 +5714,278 @@ ProcXkbGetKbdByName(ClientPtr client)
master = GetMaster(dev, MASTER_KEYBOARD);
xkb = dev->key->xkbInfo->desc;
- status= Success;
- str= (unsigned char *)&stuff[1];
- if (GetComponentSpec(&str,TRUE,&status)) /* keymap, unsupported */
+ status = Success;
+ str = (unsigned char *) &stuff[1];
+ if (GetComponentSpec(&str, TRUE, &status)) /* keymap, unsupported */
return BadMatch;
- names.keycodes= GetComponentSpec(&str,TRUE,&status);
- names.types= GetComponentSpec(&str,TRUE,&status);
- names.compat= GetComponentSpec(&str,TRUE,&status);
- names.symbols= GetComponentSpec(&str,TRUE,&status);
- names.geometry= GetComponentSpec(&str,TRUE,&status);
- if (status!=Success)
- return status;
- len= str-((unsigned char *)stuff);
- if ((XkbPaddedSize(len)/4)!=stuff->length)
- return BadLength;
-
- CHK_MASK_LEGAL(0x01,stuff->want,XkbGBN_AllComponentsMask);
- CHK_MASK_LEGAL(0x02,stuff->need,XkbGBN_AllComponentsMask);
-
+ names.keycodes = GetComponentSpec(&str, TRUE, &status);
+ names.types = GetComponentSpec(&str, TRUE, &status);
+ names.compat = GetComponentSpec(&str, TRUE, &status);
+ names.symbols = GetComponentSpec(&str, TRUE, &status);
+ names.geometry = GetComponentSpec(&str, TRUE, &status);
+ if (status != Success)
+ return status;
+ len = str - ((unsigned char *) stuff);
+ if ((XkbPaddedSize(len) / 4) != stuff->length)
+ return BadLength;
+
+ CHK_MASK_LEGAL(0x01, stuff->want, XkbGBN_AllComponentsMask);
+ CHK_MASK_LEGAL(0x02, stuff->need, XkbGBN_AllComponentsMask);
+
if (stuff->load)
- fwant= XkbGBN_AllComponentsMask;
- else fwant= stuff->want|stuff->need;
- if ((!names.compat)&&
- (fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) {
- names.compat= Xstrdup("%");
+ fwant = XkbGBN_AllComponentsMask;
+ else
+ fwant = stuff->want | stuff->need;
+ if ((!names.compat) &&
+ (fwant & (XkbGBN_CompatMapMask | XkbGBN_IndicatorMapMask))) {
+ names.compat = Xstrdup("%");
}
- if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) {
- names.types= Xstrdup("%");
+ if ((!names.types) && (fwant & (XkbGBN_TypesMask))) {
+ names.types = Xstrdup("%");
}
- if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) {
- names.symbols= Xstrdup("%");
+ if ((!names.symbols) && (fwant & XkbGBN_SymbolsMask)) {
+ names.symbols = Xstrdup("%");
}
- geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0));
- if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) {
- names.geometry= Xstrdup("%");
- geom_changed= FALSE;
+ geom_changed = ((names.geometry != NULL) &&
+ (strcmp(names.geometry, "%") != 0));
+ if ((!names.geometry) && (fwant & XkbGBN_GeometryMask)) {
+ names.geometry = Xstrdup("%");
+ geom_changed = FALSE;
}
memset(mapFile, 0, PATH_MAX);
- rep.type= X_Reply;
+ rep.type = X_Reply;
rep.deviceID = dev->id;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.minKeyCode = xkb->min_key_code;
rep.maxKeyCode = xkb->max_key_code;
- rep.loaded= FALSE;
- fwant= XkbConvertGetByNameComponents(TRUE,stuff->want)|XkmVirtualModsMask;
- fneed= XkbConvertGetByNameComponents(TRUE,stuff->need);
- rep.reported= XkbConvertGetByNameComponents(FALSE,fwant|fneed);
+ rep.loaded = FALSE;
+ fwant =
+ XkbConvertGetByNameComponents(TRUE, stuff->want) | XkmVirtualModsMask;
+ fneed = XkbConvertGetByNameComponents(TRUE, stuff->need);
+ rep.reported = XkbConvertGetByNameComponents(FALSE, fwant | fneed);
if (stuff->load) {
- fneed|= XkmKeymapRequired;
- fwant|= XkmKeymapLegal;
+ fneed |= XkmKeymapRequired;
+ fwant |= XkmKeymapLegal;
}
- if ((fwant|fneed)&XkmSymbolsMask) {
- fneed|= XkmKeyNamesIndex|XkmTypesIndex;
- fwant|= XkmIndicatorsIndex;
+ if ((fwant | fneed) & XkmSymbolsMask) {
+ fneed |= XkmKeyNamesIndex | XkmTypesIndex;
+ fwant |= XkmIndicatorsIndex;
}
/* We pass dev in here so we can get the old names out if needed. */
- rep.found = XkbDDXLoadKeymapByNames(dev,&names,fwant,fneed,&new,
- mapFile,PATH_MAX);
- rep.newKeyboard= FALSE;
- rep.pad1= rep.pad2= rep.pad3= rep.pad4= 0;
-
- stuff->want|= stuff->need;
- if (new==NULL)
- rep.reported= 0;
+ rep.found = XkbDDXLoadKeymapByNames(dev, &names, fwant, fneed, &new,
+ mapFile, PATH_MAX);
+ rep.newKeyboard = FALSE;
+ rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
+
+ stuff->want |= stuff->need;
+ if (new == NULL)
+ rep.reported = 0;
else {
- if (stuff->load)
- rep.loaded= TRUE;
- if (stuff->load ||
- ((rep.reported&XkbGBN_SymbolsMask) && (new->compat))) {
- XkbChangesRec changes;
- memset(&changes, 0, sizeof(changes));
- XkbUpdateDescActions(new,
- new->min_key_code,XkbNumKeys(new),
- &changes);
- }
-
- if (new->map==NULL)
- rep.reported&= ~(XkbGBN_SymbolsMask|XkbGBN_TypesMask);
- else if (rep.reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask)) {
- mrep.type= X_Reply;
- mrep.deviceID = dev->id;
- mrep.sequenceNumber= client->sequence;
- mrep.length = ((SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply))>>2);
- mrep.minKeyCode = new->min_key_code;
- mrep.maxKeyCode = new->max_key_code;
- mrep.present = 0;
- mrep.totalSyms = mrep.totalActs =
- mrep.totalKeyBehaviors= mrep.totalKeyExplicit=
- mrep.totalModMapKeys= mrep.totalVModMapKeys= 0;
- if (rep.reported&(XkbGBN_TypesMask|XkbGBN_ClientSymbolsMask)) {
- mrep.present|= XkbKeyTypesMask;
- mrep.firstType = 0;
- mrep.nTypes = mrep.totalTypes= new->map->num_types;
- }
- else {
- mrep.firstType = mrep.nTypes= 0;
- mrep.totalTypes= 0;
- }
- if (rep.reported&XkbGBN_ClientSymbolsMask) {
- mrep.present|= (XkbKeySymsMask|XkbModifierMapMask);
- mrep.firstKeySym = mrep.firstModMapKey= new->min_key_code;
- mrep.nKeySyms = mrep.nModMapKeys= XkbNumKeys(new);
- }
- else {
- mrep.firstKeySym= mrep.firstModMapKey= 0;
- mrep.nKeySyms= mrep.nModMapKeys= 0;
- }
- if (rep.reported&XkbGBN_ServerSymbolsMask) {
- mrep.present|= XkbAllServerInfoMask;
- mrep.virtualMods= ~0;
- mrep.firstKeyAct = mrep.firstKeyBehavior =
- mrep.firstKeyExplicit = new->min_key_code;
- mrep.nKeyActs = mrep.nKeyBehaviors =
- mrep.nKeyExplicit = XkbNumKeys(new);
- mrep.firstVModMapKey= new->min_key_code;
- mrep.nVModMapKeys= XkbNumKeys(new);
- }
- else {
- mrep.virtualMods= 0;
- mrep.firstKeyAct= mrep.firstKeyBehavior=
- mrep.firstKeyExplicit = 0;
- mrep.nKeyActs= mrep.nKeyBehaviors= mrep.nKeyExplicit= 0;
- }
- XkbComputeGetMapReplySize(new,&mrep);
- rep.length+= SIZEOF(xGenericReply)/4+mrep.length;
- }
- if (new->compat==NULL)
- rep.reported&= ~XkbGBN_CompatMapMask;
- else if (rep.reported&XkbGBN_CompatMapMask) {
- crep.type= X_Reply;
- crep.deviceID= dev->id;
- crep.sequenceNumber= client->sequence;
- crep.length= 0;
- crep.groups= XkbAllGroupsMask;
- crep.firstSI= 0;
- crep.nSI= crep.nTotalSI= new->compat->num_si;
- XkbComputeGetCompatMapReplySize(new->compat,&crep);
- rep.length+= SIZEOF(xGenericReply)/4+crep.length;
- }
- if (new->indicators==NULL)
- rep.reported&= ~XkbGBN_IndicatorMapMask;
- else if (rep.reported&XkbGBN_IndicatorMapMask) {
- irep.type= X_Reply;
- irep.deviceID= dev->id;
- irep.sequenceNumber= client->sequence;
- irep.length= 0;
- irep.which= XkbAllIndicatorsMask;
- XkbComputeGetIndicatorMapReplySize(new->indicators,&irep);
- rep.length+= SIZEOF(xGenericReply)/4+irep.length;
- }
- if (new->names==NULL)
- rep.reported&= ~(XkbGBN_OtherNamesMask|XkbGBN_KeyNamesMask);
- else if (rep.reported&(XkbGBN_OtherNamesMask|XkbGBN_KeyNamesMask)) {
- nrep.type= X_Reply;
- nrep.deviceID= dev->id;
- nrep.sequenceNumber= client->sequence;
- nrep.length= 0;
- nrep.minKeyCode= new->min_key_code;
- nrep.maxKeyCode= new->max_key_code;
- if (rep.reported&XkbGBN_OtherNamesMask) {
- nrep.which= XkbAllNamesMask;
- if (new->map!=NULL)
- nrep.nTypes= new->map->num_types;
- else nrep.nTypes= 0;
- nrep.nKTLevels= 0;
- nrep.groupNames= XkbAllGroupsMask;
- nrep.virtualMods= XkbAllVirtualModsMask;
- nrep.indicators= XkbAllIndicatorsMask;
- nrep.nRadioGroups= new->names->num_rg;
- }
- else {
- nrep.which= 0;
- nrep.nTypes= 0;
- nrep.nKTLevels= 0;
- nrep.groupNames= 0;
- nrep.virtualMods= 0;
- nrep.indicators= 0;
- nrep.nRadioGroups= 0;
- }
- if (rep.reported&XkbGBN_KeyNamesMask) {
- nrep.which|= XkbKeyNamesMask;
- nrep.firstKey= new->min_key_code;
- nrep.nKeys= XkbNumKeys(new);
- nrep.nKeyAliases= new->names->num_key_aliases;
- if (nrep.nKeyAliases)
- nrep.which|= XkbKeyAliasesMask;
- }
- else {
- nrep.which&= ~(XkbKeyNamesMask|XkbKeyAliasesMask);
- nrep.firstKey= nrep.nKeys= 0;
- nrep.nKeyAliases= 0;
- }
- XkbComputeGetNamesReplySize(new,&nrep);
- rep.length+= SIZEOF(xGenericReply)/4+nrep.length;
- }
- if (new->geom==NULL)
- rep.reported&= ~XkbGBN_GeometryMask;
- else if (rep.reported&XkbGBN_GeometryMask) {
- grep.type= X_Reply;
- grep.deviceID= dev->id;
- grep.sequenceNumber= client->sequence;
- grep.length= 0;
- grep.found= TRUE;
- grep.pad= 0;
- grep.widthMM= grep.heightMM= 0;
- grep.nProperties= grep.nColors= grep.nShapes= 0;
- grep.nSections= grep.nDoodads= 0;
- grep.baseColorNdx= grep.labelColorNdx= 0;
- XkbComputeGetGeometryReplySize(new->geom,&grep,None);
- rep.length+= SIZEOF(xGenericReply)/4+grep.length;
- }
- }
-
- reported= rep.reported;
- if ( client->swapped ) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.found);
- swaps(&rep.reported);
- }
- WriteToClient(client,SIZEOF(xkbGetKbdByNameReply), (char *)&rep);
- if (reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask))
- XkbSendMap(client,new,&mrep);
- if (reported&XkbGBN_CompatMapMask)
- XkbSendCompatMap(client,new->compat,&crep);
- if (reported&XkbGBN_IndicatorMapMask)
- XkbSendIndicatorMap(client,new->indicators,&irep);
- if (reported&(XkbGBN_KeyNamesMask|XkbGBN_OtherNamesMask))
- XkbSendNames(client,new,&nrep);
- if (reported&XkbGBN_GeometryMask)
- XkbSendGeometry(client,new->geom,&grep,FALSE);
+ if (stuff->load)
+ rep.loaded = TRUE;
+ if (stuff->load ||
+ ((rep.reported & XkbGBN_SymbolsMask) && (new->compat))) {
+ XkbChangesRec changes;
+
+ memset(&changes, 0, sizeof(changes));
+ XkbUpdateDescActions(new,
+ new->min_key_code, XkbNumKeys(new), &changes);
+ }
+
+ if (new->map == NULL)
+ rep.reported &= ~(XkbGBN_SymbolsMask | XkbGBN_TypesMask);
+ else if (rep.reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask)) {
+ mrep.type = X_Reply;
+ mrep.deviceID = dev->id;
+ mrep.sequenceNumber = client->sequence;
+ mrep.length =
+ ((SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2);
+ mrep.minKeyCode = new->min_key_code;
+ mrep.maxKeyCode = new->max_key_code;
+ mrep.present = 0;
+ mrep.totalSyms = mrep.totalActs =
+ mrep.totalKeyBehaviors = mrep.totalKeyExplicit =
+ mrep.totalModMapKeys = mrep.totalVModMapKeys = 0;
+ if (rep.reported & (XkbGBN_TypesMask | XkbGBN_ClientSymbolsMask)) {
+ mrep.present |= XkbKeyTypesMask;
+ mrep.firstType = 0;
+ mrep.nTypes = mrep.totalTypes = new->map->num_types;
+ }
+ else {
+ mrep.firstType = mrep.nTypes = 0;
+ mrep.totalTypes = 0;
+ }
+ if (rep.reported & XkbGBN_ClientSymbolsMask) {
+ mrep.present |= (XkbKeySymsMask | XkbModifierMapMask);
+ mrep.firstKeySym = mrep.firstModMapKey = new->min_key_code;
+ mrep.nKeySyms = mrep.nModMapKeys = XkbNumKeys(new);
+ }
+ else {
+ mrep.firstKeySym = mrep.firstModMapKey = 0;
+ mrep.nKeySyms = mrep.nModMapKeys = 0;
+ }
+ if (rep.reported & XkbGBN_ServerSymbolsMask) {
+ mrep.present |= XkbAllServerInfoMask;
+ mrep.virtualMods = ~0;
+ mrep.firstKeyAct = mrep.firstKeyBehavior =
+ mrep.firstKeyExplicit = new->min_key_code;
+ mrep.nKeyActs = mrep.nKeyBehaviors =
+ mrep.nKeyExplicit = XkbNumKeys(new);
+ mrep.firstVModMapKey = new->min_key_code;
+ mrep.nVModMapKeys = XkbNumKeys(new);
+ }
+ else {
+ mrep.virtualMods = 0;
+ mrep.firstKeyAct = mrep.firstKeyBehavior =
+ mrep.firstKeyExplicit = 0;
+ mrep.nKeyActs = mrep.nKeyBehaviors = mrep.nKeyExplicit = 0;
+ }
+ XkbComputeGetMapReplySize(new, &mrep);
+ rep.length += SIZEOF(xGenericReply) / 4 + mrep.length;
+ }
+ if (new->compat == NULL)
+ rep.reported &= ~XkbGBN_CompatMapMask;
+ else if (rep.reported & XkbGBN_CompatMapMask) {
+ crep.type = X_Reply;
+ crep.deviceID = dev->id;
+ crep.sequenceNumber = client->sequence;
+ crep.length = 0;
+ crep.groups = XkbAllGroupsMask;
+ crep.firstSI = 0;
+ crep.nSI = crep.nTotalSI = new->compat->num_si;
+ XkbComputeGetCompatMapReplySize(new->compat, &crep);
+ rep.length += SIZEOF(xGenericReply) / 4 + crep.length;
+ }
+ if (new->indicators == NULL)
+ rep.reported &= ~XkbGBN_IndicatorMapMask;
+ else if (rep.reported & XkbGBN_IndicatorMapMask) {
+ irep.type = X_Reply;
+ irep.deviceID = dev->id;
+ irep.sequenceNumber = client->sequence;
+ irep.length = 0;
+ irep.which = XkbAllIndicatorsMask;
+ XkbComputeGetIndicatorMapReplySize(new->indicators, &irep);
+ rep.length += SIZEOF(xGenericReply) / 4 + irep.length;
+ }
+ if (new->names == NULL)
+ rep.reported &= ~(XkbGBN_OtherNamesMask | XkbGBN_KeyNamesMask);
+ else if (rep.reported & (XkbGBN_OtherNamesMask | XkbGBN_KeyNamesMask)) {
+ nrep.type = X_Reply;
+ nrep.deviceID = dev->id;
+ nrep.sequenceNumber = client->sequence;
+ nrep.length = 0;
+ nrep.minKeyCode = new->min_key_code;
+ nrep.maxKeyCode = new->max_key_code;
+ if (rep.reported & XkbGBN_OtherNamesMask) {
+ nrep.which = XkbAllNamesMask;
+ if (new->map != NULL)
+ nrep.nTypes = new->map->num_types;
+ else
+ nrep.nTypes = 0;
+ nrep.nKTLevels = 0;
+ nrep.groupNames = XkbAllGroupsMask;
+ nrep.virtualMods = XkbAllVirtualModsMask;
+ nrep.indicators = XkbAllIndicatorsMask;
+ nrep.nRadioGroups = new->names->num_rg;
+ }
+ else {
+ nrep.which = 0;
+ nrep.nTypes = 0;
+ nrep.nKTLevels = 0;
+ nrep.groupNames = 0;
+ nrep.virtualMods = 0;
+ nrep.indicators = 0;
+ nrep.nRadioGroups = 0;
+ }
+ if (rep.reported & XkbGBN_KeyNamesMask) {
+ nrep.which |= XkbKeyNamesMask;
+ nrep.firstKey = new->min_key_code;
+ nrep.nKeys = XkbNumKeys(new);
+ nrep.nKeyAliases = new->names->num_key_aliases;
+ if (nrep.nKeyAliases)
+ nrep.which |= XkbKeyAliasesMask;
+ }
+ else {
+ nrep.which &= ~(XkbKeyNamesMask | XkbKeyAliasesMask);
+ nrep.firstKey = nrep.nKeys = 0;
+ nrep.nKeyAliases = 0;
+ }
+ XkbComputeGetNamesReplySize(new, &nrep);
+ rep.length += SIZEOF(xGenericReply) / 4 + nrep.length;
+ }
+ if (new->geom == NULL)
+ rep.reported &= ~XkbGBN_GeometryMask;
+ else if (rep.reported & XkbGBN_GeometryMask) {
+ grep.type = X_Reply;
+ grep.deviceID = dev->id;
+ grep.sequenceNumber = client->sequence;
+ grep.length = 0;
+ grep.found = TRUE;
+ grep.pad = 0;
+ grep.widthMM = grep.heightMM = 0;
+ grep.nProperties = grep.nColors = grep.nShapes = 0;
+ grep.nSections = grep.nDoodads = 0;
+ grep.baseColorNdx = grep.labelColorNdx = 0;
+ XkbComputeGetGeometryReplySize(new->geom, &grep, None);
+ rep.length += SIZEOF(xGenericReply) / 4 + grep.length;
+ }
+ }
+
+ reported = rep.reported;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.found);
+ swaps(&rep.reported);
+ }
+ WriteToClient(client, SIZEOF(xkbGetKbdByNameReply), (char *) &rep);
+ if (reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask))
+ XkbSendMap(client, new, &mrep);
+ if (reported & XkbGBN_CompatMapMask)
+ XkbSendCompatMap(client, new->compat, &crep);
+ if (reported & XkbGBN_IndicatorMapMask)
+ XkbSendIndicatorMap(client, new->indicators, &irep);
+ if (reported & (XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask))
+ XkbSendNames(client, new, &nrep);
+ if (reported & XkbGBN_GeometryMask)
+ XkbSendGeometry(client, new->geom, &grep, FALSE);
if (rep.loaded) {
- XkbDescPtr old_xkb;
- xkbNewKeyboardNotify nkn;
- int i,nG,nTG;
- old_xkb= xkb;
- xkb= new;
- dev->key->xkbInfo->desc= xkb;
- new= old_xkb; /* so it'll get freed automatically */
-
- *xkb->ctrls= *old_xkb->ctrls;
- for (nG=nTG=0,i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- nG= XkbKeyNumGroups(xkb,i);
- if (nG>=XkbNumKbdGroups) {
- nTG= XkbNumKbdGroups;
- break;
- }
- if (nG>nTG) {
- nTG= nG;
- }
- }
- xkb->ctrls->num_groups= nTG;
-
- nkn.deviceID= nkn.oldDeviceID= dev->id;
- nkn.minKeyCode= new->min_key_code;
- nkn.maxKeyCode= new->max_key_code;
- nkn.oldMinKeyCode= xkb->min_key_code;
- nkn.oldMaxKeyCode= xkb->max_key_code;
- nkn.requestMajor= XkbReqCode;
- nkn.requestMinor= X_kbGetKbdByName;
- nkn.changed= XkbNKN_KeycodesMask;
- if (geom_changed)
- nkn.changed|= XkbNKN_GeometryMask;
- XkbSendNewKeyboardNotify(dev,&nkn);
+ XkbDescPtr old_xkb;
+ xkbNewKeyboardNotify nkn;
+ int i, nG, nTG;
+
+ old_xkb = xkb;
+ xkb = new;
+ dev->key->xkbInfo->desc = xkb;
+ new = old_xkb; /* so it'll get freed automatically */
+
+ *xkb->ctrls = *old_xkb->ctrls;
+ for (nG = nTG = 0, i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ nG = XkbKeyNumGroups(xkb, i);
+ if (nG >= XkbNumKbdGroups) {
+ nTG = XkbNumKbdGroups;
+ break;
+ }
+ if (nG > nTG) {
+ nTG = nG;
+ }
+ }
+ xkb->ctrls->num_groups = nTG;
+
+ nkn.deviceID = nkn.oldDeviceID = dev->id;
+ nkn.minKeyCode = new->min_key_code;
+ nkn.maxKeyCode = new->max_key_code;
+ nkn.oldMinKeyCode = xkb->min_key_code;
+ nkn.oldMaxKeyCode = xkb->max_key_code;
+ nkn.requestMajor = XkbReqCode;
+ nkn.requestMinor = X_kbGetKbdByName;
+ nkn.changed = XkbNKN_KeycodesMask;
+ if (geom_changed)
+ nkn.changed |= XkbNKN_GeometryMask;
+ XkbSendNewKeyboardNotify(dev, &nkn);
/* Update the map and LED info on the device itself, as well as
* any slaves if it's an MD, or its MD if it's an SD and was the
@@ -5881,9 +6011,9 @@ ProcXkbGetKbdByName(ClientPtr client)
}
}
}
- if ((new!=NULL)&&(new!=xkb)) {
- XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);
- new= NULL;
+ if ((new != NULL) && (new != xkb)) {
+ XkbFreeKeyboard(new, XkbAllComponentsMask, TRUE);
+ new = NULL;
}
XkbFreeComponentNames(&names, FALSE);
return Success;
@@ -5892,627 +6022,648 @@ ProcXkbGetKbdByName(ClientPtr client)
/***====================================================================***/
static int
-ComputeDeviceLedInfoSize( DeviceIntPtr dev,
- unsigned int what,
- XkbSrvLedInfoPtr sli)
+ComputeDeviceLedInfoSize(DeviceIntPtr dev,
+ unsigned int what, XkbSrvLedInfoPtr sli)
{
-int nNames,nMaps;
-register unsigned n,bit;
-
- if (sli==NULL)
- return 0;
- nNames= nMaps= 0;
- if ((what&XkbXI_IndicatorNamesMask)==0)
- sli->namesPresent= 0;
- if ((what&XkbXI_IndicatorMapsMask)==0)
- sli->mapsPresent= 0;
-
- for (n=0,bit=1;n<XkbNumIndicators;n++,bit<<=1) {
- if (sli->names && sli->names[n]!=None) {
- sli->namesPresent|= bit;
- nNames++;
- }
- if (sli->maps && XkbIM_InUse(&sli->maps[n])) {
- sli->mapsPresent|= bit;
- nMaps++;
- }
- }
- return (nNames*4)+(nMaps*SIZEOF(xkbIndicatorMapWireDesc));
+ int nNames, nMaps;
+ register unsigned n, bit;
+
+ if (sli == NULL)
+ return 0;
+ nNames = nMaps = 0;
+ if ((what & XkbXI_IndicatorNamesMask) == 0)
+ sli->namesPresent = 0;
+ if ((what & XkbXI_IndicatorMapsMask) == 0)
+ sli->mapsPresent = 0;
+
+ for (n = 0, bit = 1; n < XkbNumIndicators; n++, bit <<= 1) {
+ if (sli->names && sli->names[n] != None) {
+ sli->namesPresent |= bit;
+ nNames++;
+ }
+ if (sli->maps && XkbIM_InUse(&sli->maps[n])) {
+ sli->mapsPresent |= bit;
+ nMaps++;
+ }
+ }
+ return (nNames * 4) + (nMaps * SIZEOF(xkbIndicatorMapWireDesc));
}
-static int
-CheckDeviceLedFBs( DeviceIntPtr dev,
- int class,
- int id,
- xkbGetDeviceInfoReply * rep,
- ClientPtr client)
+static int
+CheckDeviceLedFBs(DeviceIntPtr dev,
+ int class,
+ int id, xkbGetDeviceInfoReply * rep, ClientPtr client)
{
-int nFBs= 0;
-int length= 0;
-Bool classOk;
-
- if (class==XkbDfltXIClass) {
- if (dev->kbdfeed) class= KbdFeedbackClass;
- else if (dev->leds) class= LedFeedbackClass;
- else {
- client->errorValue= _XkbErrCode2(XkbErr_BadClass,class);
- return XkbKeyboardErrorCode;
- }
- }
- classOk= FALSE;
- if ((dev->kbdfeed)&&((class==KbdFeedbackClass)||(class==XkbAllXIClasses))) {
- KbdFeedbackPtr kf;
- classOk= TRUE;
- for (kf= dev->kbdfeed;(kf);kf=kf->next) {
- if ((id!=XkbAllXIIds)&&(id!=XkbDfltXIId)&&(id!=kf->ctrl.id))
- continue;
- nFBs++;
- length+= SIZEOF(xkbDeviceLedsWireDesc);
- if (!kf->xkb_sli)
- kf->xkb_sli= XkbAllocSrvLedInfo(dev,kf,NULL,0);
- length+= ComputeDeviceLedInfoSize(dev,rep->present,kf->xkb_sli);
- if (id!=XkbAllXIIds)
- break;
- }
- }
- if ((dev->leds)&&((class==LedFeedbackClass)||(class==XkbAllXIClasses))) {
- LedFeedbackPtr lf;
- classOk= TRUE;
- for (lf= dev->leds;(lf);lf=lf->next) {
- if ((id!=XkbAllXIIds)&&(id!=XkbDfltXIId)&&(id!=lf->ctrl.id))
- continue;
- nFBs++;
- length+= SIZEOF(xkbDeviceLedsWireDesc);
- if (!lf->xkb_sli)
- lf->xkb_sli= XkbAllocSrvLedInfo(dev,NULL,lf,0);
- length+= ComputeDeviceLedInfoSize(dev,rep->present,lf->xkb_sli);
- if (id!=XkbAllXIIds)
- break;
- }
- }
- if (nFBs>0) {
- rep->nDeviceLedFBs= nFBs;
- rep->length+= (length/4);
- return Success;
- }
- if (classOk) client->errorValue= _XkbErrCode2(XkbErr_BadId,id);
- else client->errorValue= _XkbErrCode2(XkbErr_BadClass,class);
+ int nFBs = 0;
+ int length = 0;
+ Bool classOk;
+
+ if (class == XkbDfltXIClass) {
+ if (dev->kbdfeed)
+ class = KbdFeedbackClass;
+ else if (dev->leds)
+ class = LedFeedbackClass;
+ else {
+ client->errorValue = _XkbErrCode2(XkbErr_BadClass, class);
+ return XkbKeyboardErrorCode;
+ }
+ }
+ classOk = FALSE;
+ if ((dev->kbdfeed) &&
+ ((class == KbdFeedbackClass) || (class == XkbAllXIClasses))) {
+ KbdFeedbackPtr kf;
+
+ classOk = TRUE;
+ for (kf = dev->kbdfeed; (kf); kf = kf->next) {
+ if ((id != XkbAllXIIds) && (id != XkbDfltXIId) &&
+ (id != kf->ctrl.id))
+ continue;
+ nFBs++;
+ length += SIZEOF(xkbDeviceLedsWireDesc);
+ if (!kf->xkb_sli)
+ kf->xkb_sli = XkbAllocSrvLedInfo(dev, kf, NULL, 0);
+ length += ComputeDeviceLedInfoSize(dev, rep->present, kf->xkb_sli);
+ if (id != XkbAllXIIds)
+ break;
+ }
+ }
+ if ((dev->leds) &&
+ ((class == LedFeedbackClass) || (class == XkbAllXIClasses))) {
+ LedFeedbackPtr lf;
+
+ classOk = TRUE;
+ for (lf = dev->leds; (lf); lf = lf->next) {
+ if ((id != XkbAllXIIds) && (id != XkbDfltXIId) &&
+ (id != lf->ctrl.id))
+ continue;
+ nFBs++;
+ length += SIZEOF(xkbDeviceLedsWireDesc);
+ if (!lf->xkb_sli)
+ lf->xkb_sli = XkbAllocSrvLedInfo(dev, NULL, lf, 0);
+ length += ComputeDeviceLedInfoSize(dev, rep->present, lf->xkb_sli);
+ if (id != XkbAllXIIds)
+ break;
+ }
+ }
+ if (nFBs > 0) {
+ rep->nDeviceLedFBs = nFBs;
+ rep->length += (length / 4);
+ return Success;
+ }
+ if (classOk)
+ client->errorValue = _XkbErrCode2(XkbErr_BadId, id);
+ else
+ client->errorValue = _XkbErrCode2(XkbErr_BadClass, class);
return XkbKeyboardErrorCode;
}
static int
-SendDeviceLedInfo( XkbSrvLedInfoPtr sli,
- ClientPtr client)
+SendDeviceLedInfo(XkbSrvLedInfoPtr sli, ClientPtr client)
{
-xkbDeviceLedsWireDesc wire;
-int length;
-
- length= 0;
- wire.ledClass= sli->class;
- wire.ledID= sli->id;
- wire.namesPresent= sli->namesPresent;
- wire.mapsPresent= sli->mapsPresent;
- wire.physIndicators= sli->physIndicators;
- wire.state= sli->effectiveState;
+ xkbDeviceLedsWireDesc wire;
+ int length;
+
+ length = 0;
+ wire.ledClass = sli->class;
+ wire.ledID = sli->id;
+ wire.namesPresent = sli->namesPresent;
+ wire.mapsPresent = sli->mapsPresent;
+ wire.physIndicators = sli->physIndicators;
+ wire.state = sli->effectiveState;
if (client->swapped) {
- swaps(&wire.ledClass);
- swaps(&wire.ledID);
- swapl(&wire.namesPresent);
- swapl(&wire.mapsPresent);
- swapl(&wire.physIndicators);
- swapl(&wire.state);
- }
- WriteToClient(client,SIZEOF(xkbDeviceLedsWireDesc),(char *)&wire);
- length+= SIZEOF(xkbDeviceLedsWireDesc);
- if (sli->namesPresent|sli->mapsPresent) {
- register unsigned i,bit;
- if (sli->namesPresent) {
- CARD32 awire;
- for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
- if (sli->namesPresent&bit) {
- awire= (CARD32)sli->names[i];
- if (client->swapped) {
- swapl(&awire);
- }
- WriteToClient(client,4,(char *)&awire);
- length+= 4;
- }
- }
- }
- if (sli->mapsPresent) {
- for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
- xkbIndicatorMapWireDesc iwire;
- if (sli->mapsPresent&bit) {
- iwire.flags= sli->maps[i].flags;
- iwire.whichGroups= sli->maps[i].which_groups;
- iwire.groups= sli->maps[i].groups;
- iwire.whichMods= sli->maps[i].which_mods;
- iwire.mods= sli->maps[i].mods.mask;
- iwire.realMods= sli->maps[i].mods.real_mods;
- iwire.virtualMods= sli->maps[i].mods.vmods;
- iwire.ctrls= sli->maps[i].ctrls;
- if (client->swapped) {
- swaps(&iwire.virtualMods);
- swapl(&iwire.ctrls);
- }
- WriteToClient(client,SIZEOF(xkbIndicatorMapWireDesc),
- (char *)&iwire);
- length+= SIZEOF(xkbIndicatorMapWireDesc);
- }
- }
- }
+ swaps(&wire.ledClass);
+ swaps(&wire.ledID);
+ swapl(&wire.namesPresent);
+ swapl(&wire.mapsPresent);
+ swapl(&wire.physIndicators);
+ swapl(&wire.state);
+ }
+ WriteToClient(client, SIZEOF(xkbDeviceLedsWireDesc), (char *) &wire);
+ length += SIZEOF(xkbDeviceLedsWireDesc);
+ if (sli->namesPresent | sli->mapsPresent) {
+ register unsigned i, bit;
+
+ if (sli->namesPresent) {
+ CARD32 awire;
+
+ for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
+ if (sli->namesPresent & bit) {
+ awire = (CARD32) sli->names[i];
+ if (client->swapped) {
+ swapl(&awire);
+ }
+ WriteToClient(client, 4, (char *) &awire);
+ length += 4;
+ }
+ }
+ }
+ if (sli->mapsPresent) {
+ for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
+ xkbIndicatorMapWireDesc iwire;
+
+ if (sli->mapsPresent & bit) {
+ iwire.flags = sli->maps[i].flags;
+ iwire.whichGroups = sli->maps[i].which_groups;
+ iwire.groups = sli->maps[i].groups;
+ iwire.whichMods = sli->maps[i].which_mods;
+ iwire.mods = sli->maps[i].mods.mask;
+ iwire.realMods = sli->maps[i].mods.real_mods;
+ iwire.virtualMods = sli->maps[i].mods.vmods;
+ iwire.ctrls = sli->maps[i].ctrls;
+ if (client->swapped) {
+ swaps(&iwire.virtualMods);
+ swapl(&iwire.ctrls);
+ }
+ WriteToClient(client, SIZEOF(xkbIndicatorMapWireDesc),
+ (char *) &iwire);
+ length += SIZEOF(xkbIndicatorMapWireDesc);
+ }
+ }
+ }
}
return length;
}
static int
-SendDeviceLedFBs( DeviceIntPtr dev,
- int class,
- int id,
- unsigned wantLength,
- ClientPtr client)
+SendDeviceLedFBs(DeviceIntPtr dev,
+ int class, int id, unsigned wantLength, ClientPtr client)
{
-int length= 0;
-
- if (class==XkbDfltXIClass) {
- if (dev->kbdfeed) class= KbdFeedbackClass;
- else if (dev->leds) class= LedFeedbackClass;
- }
- if ((dev->kbdfeed)&&
- ((class==KbdFeedbackClass)||(class==XkbAllXIClasses))) {
- KbdFeedbackPtr kf;
- for (kf= dev->kbdfeed;(kf);kf=kf->next) {
- if ((id==XkbAllXIIds)||(id==XkbDfltXIId)||(id==kf->ctrl.id)) {
- length+= SendDeviceLedInfo(kf->xkb_sli,client);
- if (id!=XkbAllXIIds)
- break;
- }
- }
- }
- if ((dev->leds)&&
- ((class==LedFeedbackClass)||(class==XkbAllXIClasses))) {
- LedFeedbackPtr lf;
- for (lf= dev->leds;(lf);lf=lf->next) {
- if ((id==XkbAllXIIds)||(id==XkbDfltXIId)||(id==lf->ctrl.id)) {
- length+= SendDeviceLedInfo(lf->xkb_sli,client);
- if (id!=XkbAllXIIds)
- break;
- }
- }
- }
- if (length==wantLength)
- return Success;
- else return BadLength;
+ int length = 0;
+
+ if (class == XkbDfltXIClass) {
+ if (dev->kbdfeed)
+ class = KbdFeedbackClass;
+ else if (dev->leds)
+ class = LedFeedbackClass;
+ }
+ if ((dev->kbdfeed) &&
+ ((class == KbdFeedbackClass) || (class == XkbAllXIClasses))) {
+ KbdFeedbackPtr kf;
+
+ for (kf = dev->kbdfeed; (kf); kf = kf->next) {
+ if ((id == XkbAllXIIds) || (id == XkbDfltXIId) ||
+ (id == kf->ctrl.id)) {
+ length += SendDeviceLedInfo(kf->xkb_sli, client);
+ if (id != XkbAllXIIds)
+ break;
+ }
+ }
+ }
+ if ((dev->leds) &&
+ ((class == LedFeedbackClass) || (class == XkbAllXIClasses))) {
+ LedFeedbackPtr lf;
+
+ for (lf = dev->leds; (lf); lf = lf->next) {
+ if ((id == XkbAllXIIds) || (id == XkbDfltXIId) ||
+ (id == lf->ctrl.id)) {
+ length += SendDeviceLedInfo(lf->xkb_sli, client);
+ if (id != XkbAllXIIds)
+ break;
+ }
+ }
+ }
+ if (length == wantLength)
+ return Success;
+ else
+ return BadLength;
}
int
ProcXkbGetDeviceInfo(ClientPtr client)
{
-DeviceIntPtr dev;
-xkbGetDeviceInfoReply rep;
-int status,nDeviceLedFBs;
-unsigned length,nameLen;
-CARD16 ledClass,ledID;
-unsigned wanted;
-char * str;
+ DeviceIntPtr dev;
+ xkbGetDeviceInfoReply rep;
+ int status, nDeviceLedFBs;
+ unsigned length, nameLen;
+ CARD16 ledClass, ledID;
+ unsigned wanted;
+ char *str;
REQUEST(xkbGetDeviceInfoReq);
REQUEST_SIZE_MATCH(xkbGetDeviceInfoReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
- wanted= stuff->wanted;
+ wanted = stuff->wanted;
CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
- CHK_MASK_LEGAL(0x01,wanted,XkbXI_AllDeviceFeaturesMask);
+ CHK_MASK_LEGAL(0x01, wanted, XkbXI_AllDeviceFeaturesMask);
- if ((!dev->button)||((stuff->nBtns<1)&&(!stuff->allBtns)))
- wanted&= ~XkbXI_ButtonActionsMask;
- if ((!dev->kbdfeed)&&(!dev->leds))
- wanted&= ~XkbXI_IndicatorsMask;
+ if ((!dev->button) || ((stuff->nBtns < 1) && (!stuff->allBtns)))
+ wanted &= ~XkbXI_ButtonActionsMask;
+ if ((!dev->kbdfeed) && (!dev->leds))
+ wanted &= ~XkbXI_IndicatorsMask;
- nameLen= XkbSizeCountedString(dev->name);
- memset((char *)&rep, 0, SIZEOF(xkbGetDeviceInfoReply));
+ nameLen = XkbSizeCountedString(dev->name);
+ memset((char *) &rep, 0, SIZEOF(xkbGetDeviceInfoReply));
rep.type = X_Reply;
- rep.deviceID= dev->id;
+ rep.deviceID = dev->id;
rep.sequenceNumber = client->sequence;
- rep.length = nameLen/4;
+ rep.length = nameLen / 4;
rep.present = wanted;
rep.supported = XkbXI_AllDeviceFeaturesMask;
rep.unsupported = 0;
rep.firstBtnWanted = rep.nBtnsWanted = 0;
rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
if (dev->button)
- rep.totalBtns= dev->button->numButtons;
- else rep.totalBtns= 0;
- rep.devType= dev->xinput_type;
- rep.hasOwnState= (dev->key && dev->key->xkbInfo);
+ rep.totalBtns = dev->button->numButtons;
+ else
+ rep.totalBtns = 0;
+ rep.devType = dev->xinput_type;
+ rep.hasOwnState = (dev->key && dev->key->xkbInfo);
rep.nDeviceLedFBs = 0;
- if (dev->kbdfeed) rep.dfltKbdFB= dev->kbdfeed->ctrl.id;
- else rep.dfltKbdFB= XkbXINone;
- if (dev->leds) rep.dfltLedFB= dev->leds->ctrl.id;
- else rep.dfltLedFB= XkbXINone;
-
- ledClass= stuff->ledClass;
- ledID= stuff->ledID;
-
- rep.firstBtnWanted= rep.nBtnsWanted= 0;
- rep.firstBtnRtrn= rep.nBtnsRtrn= 0;
- if (wanted&XkbXI_ButtonActionsMask) {
- if (stuff->allBtns) {
- stuff->firstBtn= 0;
- stuff->nBtns= dev->button->numButtons;
- }
-
- if ((stuff->firstBtn+stuff->nBtns)>dev->button->numButtons) {
- client->errorValue = _XkbErrCode4(0x02,dev->button->numButtons,
- stuff->firstBtn,
- stuff->nBtns);
- return BadValue;
- }
- else {
- rep.firstBtnWanted= stuff->firstBtn;
- rep.nBtnsWanted= stuff->nBtns;
- if (dev->button->xkb_acts!=NULL) {
- XkbAction *act;
- register int i;
-
- rep.firstBtnRtrn= stuff->firstBtn;
- rep.nBtnsRtrn= stuff->nBtns;
- act= &dev->button->xkb_acts[rep.firstBtnWanted];
- for (i=0;i<rep.nBtnsRtrn;i++,act++) {
- if (act->type!=XkbSA_NoAction)
- break;
- }
- rep.firstBtnRtrn+= i;
- rep.nBtnsRtrn-= i;
- act= &dev->button->xkb_acts[rep.firstBtnRtrn+rep.nBtnsRtrn-1];
- for (i=0;i<rep.nBtnsRtrn;i++,act--) {
- if (act->type!=XkbSA_NoAction)
- break;
- }
- rep.nBtnsRtrn-= i;
- }
- rep.length+= (rep.nBtnsRtrn*SIZEOF(xkbActionWireDesc))/4;
- }
- }
-
- if (wanted&XkbXI_IndicatorsMask) {
- status= CheckDeviceLedFBs(dev,ledClass,ledID,&rep,client);
- if (status!=Success)
- return status;
- }
- length= rep.length*4;
+ if (dev->kbdfeed)
+ rep.dfltKbdFB = dev->kbdfeed->ctrl.id;
+ else
+ rep.dfltKbdFB = XkbXINone;
+ if (dev->leds)
+ rep.dfltLedFB = dev->leds->ctrl.id;
+ else
+ rep.dfltLedFB = XkbXINone;
+
+ ledClass = stuff->ledClass;
+ ledID = stuff->ledID;
+
+ rep.firstBtnWanted = rep.nBtnsWanted = 0;
+ rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
+ if (wanted & XkbXI_ButtonActionsMask) {
+ if (stuff->allBtns) {
+ stuff->firstBtn = 0;
+ stuff->nBtns = dev->button->numButtons;
+ }
+
+ if ((stuff->firstBtn + stuff->nBtns) > dev->button->numButtons) {
+ client->errorValue = _XkbErrCode4(0x02, dev->button->numButtons,
+ stuff->firstBtn, stuff->nBtns);
+ return BadValue;
+ }
+ else {
+ rep.firstBtnWanted = stuff->firstBtn;
+ rep.nBtnsWanted = stuff->nBtns;
+ if (dev->button->xkb_acts != NULL) {
+ XkbAction *act;
+ register int i;
+
+ rep.firstBtnRtrn = stuff->firstBtn;
+ rep.nBtnsRtrn = stuff->nBtns;
+ act = &dev->button->xkb_acts[rep.firstBtnWanted];
+ for (i = 0; i < rep.nBtnsRtrn; i++, act++) {
+ if (act->type != XkbSA_NoAction)
+ break;
+ }
+ rep.firstBtnRtrn += i;
+ rep.nBtnsRtrn -= i;
+ act =
+ &dev->button->xkb_acts[rep.firstBtnRtrn + rep.nBtnsRtrn -
+ 1];
+ for (i = 0; i < rep.nBtnsRtrn; i++, act--) {
+ if (act->type != XkbSA_NoAction)
+ break;
+ }
+ rep.nBtnsRtrn -= i;
+ }
+ rep.length += (rep.nBtnsRtrn * SIZEOF(xkbActionWireDesc)) / 4;
+ }
+ }
+
+ if (wanted & XkbXI_IndicatorsMask) {
+ status = CheckDeviceLedFBs(dev, ledClass, ledID, &rep, client);
+ if (status != Success)
+ return status;
+ }
+ length = rep.length * 4;
nDeviceLedFBs = rep.nDeviceLedFBs;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.present);
- swaps(&rep.supported);
- swaps(&rep.unsupported);
- swaps(&rep.nDeviceLedFBs);
- swaps(&rep.dfltKbdFB);
- swaps(&rep.dfltLedFB);
- swapl(&rep.devType);
- }
- WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep);
-
- str= malloc(nameLen);
- if (!str)
- return BadAlloc;
- XkbWriteCountedString(str,dev->name,client->swapped);
- WriteToClient(client,nameLen,str);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.present);
+ swaps(&rep.supported);
+ swaps(&rep.unsupported);
+ swaps(&rep.nDeviceLedFBs);
+ swaps(&rep.dfltKbdFB);
+ swaps(&rep.dfltLedFB);
+ swapl(&rep.devType);
+ }
+ WriteToClient(client, SIZEOF(xkbGetDeviceInfoReply), (char *) &rep);
+
+ str = malloc(nameLen);
+ if (!str)
+ return BadAlloc;
+ XkbWriteCountedString(str, dev->name, client->swapped);
+ WriteToClient(client, nameLen, str);
free(str);
- length-= nameLen;
-
- if (rep.nBtnsRtrn>0) {
- int sz;
- xkbActionWireDesc * awire;
- sz= rep.nBtnsRtrn*SIZEOF(xkbActionWireDesc);
- awire= (xkbActionWireDesc *)&dev->button->xkb_acts[rep.firstBtnRtrn];
- WriteToClient(client,sz,(char *)awire);
- length-= sz;
- }
- if (nDeviceLedFBs>0) {
- status= SendDeviceLedFBs(dev,ledClass,ledID,length,client);
- if (status!=Success)
- return status;
- }
- else if (length!=0) {
- ErrorF("[xkb] Internal Error! BadLength in ProcXkbGetDeviceInfo\n");
- ErrorF("[xkb] Wrote %d fewer bytes than expected\n",length);
- return BadLength;
+ length -= nameLen;
+
+ if (rep.nBtnsRtrn > 0) {
+ int sz;
+ xkbActionWireDesc *awire;
+
+ sz = rep.nBtnsRtrn * SIZEOF(xkbActionWireDesc);
+ awire = (xkbActionWireDesc *) & dev->button->xkb_acts[rep.firstBtnRtrn];
+ WriteToClient(client, sz, (char *) awire);
+ length -= sz;
+ }
+ if (nDeviceLedFBs > 0) {
+ status = SendDeviceLedFBs(dev, ledClass, ledID, length, client);
+ if (status != Success)
+ return status;
+ }
+ else if (length != 0) {
+ ErrorF("[xkb] Internal Error! BadLength in ProcXkbGetDeviceInfo\n");
+ ErrorF("[xkb] Wrote %d fewer bytes than expected\n",
+ length);
+ return BadLength;
}
return Success;
}
static char *
-CheckSetDeviceIndicators( char * wire,
- DeviceIntPtr dev,
- int num,
- int * status_rtrn,
- ClientPtr client)
+CheckSetDeviceIndicators(char *wire,
+ DeviceIntPtr dev,
+ int num, int *status_rtrn, ClientPtr client)
{
-xkbDeviceLedsWireDesc * ledWire;
-int i;
-XkbSrvLedInfoPtr sli;
-
- ledWire= (xkbDeviceLedsWireDesc *)wire;
- for (i=0;i<num;i++) {
- if (client->swapped) {
- swaps(&ledWire->ledClass);
- swaps(&ledWire->ledID);
- swapl(&ledWire->namesPresent);
- swapl(&ledWire->mapsPresent);
- swapl(&ledWire->physIndicators);
- }
-
- sli= XkbFindSrvLedInfo(dev,ledWire->ledClass,ledWire->ledID,
- XkbXI_IndicatorsMask);
- if (sli!=NULL) {
- register int n;
- register unsigned bit;
- int nMaps,nNames;
- CARD32 *atomWire;
- xkbIndicatorMapWireDesc *mapWire;
-
- nMaps= nNames= 0;
- for (n=0,bit=1;n<XkbNumIndicators;n++,bit<<=1) {
- if (ledWire->namesPresent&bit)
- nNames++;
- if (ledWire->mapsPresent&bit)
- nMaps++;
- }
- atomWire= (CARD32 *)&ledWire[1];
- if (nNames>0) {
- for (n=0;n<nNames;n++) {
- if (client->swapped) {
- swapl(atomWire);
- }
- CHK_ATOM_OR_NONE3(((Atom)(*atomWire)),client->errorValue,
- *status_rtrn,NULL);
- atomWire++;
- }
- }
- mapWire= (xkbIndicatorMapWireDesc *)atomWire;
- if (nMaps>0) {
- for (n=0;n<nMaps;n++) {
- if (client->swapped) {
- swaps(&mapWire->virtualMods);
- swapl(&mapWire->ctrls);
- }
- CHK_MASK_LEGAL3(0x21,mapWire->whichGroups,
- XkbIM_UseAnyGroup,
- client->errorValue,
- *status_rtrn,NULL);
- CHK_MASK_LEGAL3(0x22,mapWire->whichMods,XkbIM_UseAnyMods,
- client->errorValue,
- *status_rtrn,NULL);
- mapWire++;
- }
- }
- ledWire= (xkbDeviceLedsWireDesc *)mapWire;
- }
- else {
- /* SHOULD NEVER HAPPEN */
- return (char *)ledWire;
- }
- }
- return (char *)ledWire;
+ xkbDeviceLedsWireDesc *ledWire;
+ int i;
+ XkbSrvLedInfoPtr sli;
+
+ ledWire = (xkbDeviceLedsWireDesc *) wire;
+ for (i = 0; i < num; i++) {
+ if (client->swapped) {
+ swaps(&ledWire->ledClass);
+ swaps(&ledWire->ledID);
+ swapl(&ledWire->namesPresent);
+ swapl(&ledWire->mapsPresent);
+ swapl(&ledWire->physIndicators);
+ }
+
+ sli = XkbFindSrvLedInfo(dev, ledWire->ledClass, ledWire->ledID,
+ XkbXI_IndicatorsMask);
+ if (sli != NULL) {
+ register int n;
+ register unsigned bit;
+ int nMaps, nNames;
+ CARD32 *atomWire;
+ xkbIndicatorMapWireDesc *mapWire;
+
+ nMaps = nNames = 0;
+ for (n = 0, bit = 1; n < XkbNumIndicators; n++, bit <<= 1) {
+ if (ledWire->namesPresent & bit)
+ nNames++;
+ if (ledWire->mapsPresent & bit)
+ nMaps++;
+ }
+ atomWire = (CARD32 *) &ledWire[1];
+ if (nNames > 0) {
+ for (n = 0; n < nNames; n++) {
+ if (client->swapped) {
+ swapl(atomWire);
+ }
+ CHK_ATOM_OR_NONE3(((Atom) (*atomWire)), client->errorValue,
+ *status_rtrn, NULL);
+ atomWire++;
+ }
+ }
+ mapWire = (xkbIndicatorMapWireDesc *) atomWire;
+ if (nMaps > 0) {
+ for (n = 0; n < nMaps; n++) {
+ if (client->swapped) {
+ swaps(&mapWire->virtualMods);
+ swapl(&mapWire->ctrls);
+ }
+ CHK_MASK_LEGAL3(0x21, mapWire->whichGroups,
+ XkbIM_UseAnyGroup,
+ client->errorValue, *status_rtrn, NULL);
+ CHK_MASK_LEGAL3(0x22, mapWire->whichMods, XkbIM_UseAnyMods,
+ client->errorValue, *status_rtrn, NULL);
+ mapWire++;
+ }
+ }
+ ledWire = (xkbDeviceLedsWireDesc *) mapWire;
+ }
+ else {
+ /* SHOULD NEVER HAPPEN */
+ return (char *) ledWire;
+ }
+ }
+ return (char *) ledWire;
}
static char *
-SetDeviceIndicators( char * wire,
- DeviceIntPtr dev,
- unsigned changed,
- int num,
- int * status_rtrn,
- ClientPtr client,
- xkbExtensionDeviceNotify *ev)
+SetDeviceIndicators(char *wire,
+ DeviceIntPtr dev,
+ unsigned changed,
+ int num,
+ int *status_rtrn,
+ ClientPtr client, xkbExtensionDeviceNotify * ev)
{
-xkbDeviceLedsWireDesc * ledWire;
-int i;
-XkbEventCauseRec cause;
-unsigned namec,mapc,statec;
-xkbExtensionDeviceNotify ed;
-XkbChangesRec changes;
-DeviceIntPtr kbd;
-
- memset((char *)&ed, 0, sizeof(xkbExtensionDeviceNotify));
- memset((char *)&changes, 0, sizeof(XkbChangesRec));
- XkbSetCauseXkbReq(&cause,X_kbSetDeviceInfo,client);
- ledWire= (xkbDeviceLedsWireDesc *)wire;
- for (i=0;i<num;i++) {
- register int n;
- register unsigned bit;
- CARD32 * atomWire;
- xkbIndicatorMapWireDesc * mapWire;
- XkbSrvLedInfoPtr sli;
-
- namec= mapc= statec= 0;
- sli= XkbFindSrvLedInfo(dev,ledWire->ledClass,ledWire->ledID,
- XkbXI_IndicatorMapsMask);
- if (!sli) {
- /* SHOULD NEVER HAPPEN!! */
- return (char *)ledWire;
- }
-
- atomWire= (CARD32 *)&ledWire[1];
- if (changed&XkbXI_IndicatorNamesMask) {
- namec= sli->namesPresent|ledWire->namesPresent;
- memset((char *)sli->names, 0, XkbNumIndicators*sizeof(Atom));
- }
- if (ledWire->namesPresent) {
- sli->namesPresent= ledWire->namesPresent;
- memset((char *)sli->names, 0, XkbNumIndicators*sizeof(Atom));
- for (n=0,bit=1;n<XkbNumIndicators;n++,bit<<=1) {
- if (ledWire->namesPresent&bit) {
- sli->names[n]= (Atom)*atomWire;
- if (sli->names[n]==None)
- ledWire->namesPresent&= ~bit;
- atomWire++;
- }
- }
- }
- mapWire= (xkbIndicatorMapWireDesc *)atomWire;
- if (changed&XkbXI_IndicatorMapsMask) {
- mapc= sli->mapsPresent|ledWire->mapsPresent;
- sli->mapsPresent= ledWire->mapsPresent;
- memset((char*)sli->maps, 0, XkbNumIndicators*sizeof(XkbIndicatorMapRec));
- }
- if (ledWire->mapsPresent) {
- for (n=0,bit=1;n<XkbNumIndicators;n++,bit<<=1) {
- if (ledWire->mapsPresent&bit) {
- sli->maps[n].flags= mapWire->flags;
- sli->maps[n].which_groups= mapWire->whichGroups;
- sli->maps[n].groups= mapWire->groups;
- sli->maps[n].which_mods= mapWire->whichMods;
- sli->maps[n].mods.mask= mapWire->mods;
- sli->maps[n].mods.real_mods=mapWire->realMods;
- sli->maps[n].mods.vmods= mapWire->virtualMods;
- sli->maps[n].ctrls= mapWire->ctrls;
- mapWire++;
- }
- }
- }
- if (changed&XkbXI_IndicatorStateMask) {
- statec= sli->effectiveState^ledWire->state;
- sli->explicitState&= ~statec;
- sli->explicitState|= (ledWire->state&statec);
- }
- if (namec)
- XkbApplyLedNameChanges(dev,sli,namec,&ed,&changes,&cause);
- if (mapc)
- XkbApplyLedMapChanges(dev,sli,mapc,&ed,&changes,&cause);
- if (statec)
- XkbApplyLedStateChanges(dev,sli,statec,&ed,&changes,&cause);
-
- kbd= dev;
- if ((sli->flags&XkbSLI_HasOwnState)==0)
- kbd = inputInfo.keyboard;
-
- XkbFlushLedEvents(dev,kbd,sli,&ed,&changes,&cause);
- ledWire= (xkbDeviceLedsWireDesc *)mapWire;
- }
- return (char *)ledWire;
-}
+ xkbDeviceLedsWireDesc *ledWire;
+ int i;
+ XkbEventCauseRec cause;
+ unsigned namec, mapc, statec;
+ xkbExtensionDeviceNotify ed;
+ XkbChangesRec changes;
+ DeviceIntPtr kbd;
+
+ memset((char *) &ed, 0, sizeof(xkbExtensionDeviceNotify));
+ memset((char *) &changes, 0, sizeof(XkbChangesRec));
+ XkbSetCauseXkbReq(&cause, X_kbSetDeviceInfo, client);
+ ledWire = (xkbDeviceLedsWireDesc *) wire;
+ for (i = 0; i < num; i++) {
+ register int n;
+ register unsigned bit;
+ CARD32 *atomWire;
+ xkbIndicatorMapWireDesc *mapWire;
+ XkbSrvLedInfoPtr sli;
+
+ namec = mapc = statec = 0;
+ sli = XkbFindSrvLedInfo(dev, ledWire->ledClass, ledWire->ledID,
+ XkbXI_IndicatorMapsMask);
+ if (!sli) {
+ /* SHOULD NEVER HAPPEN!! */
+ return (char *) ledWire;
+ }
+ atomWire = (CARD32 *) &ledWire[1];
+ if (changed & XkbXI_IndicatorNamesMask) {
+ namec = sli->namesPresent | ledWire->namesPresent;
+ memset((char *) sli->names, 0, XkbNumIndicators * sizeof(Atom));
+ }
+ if (ledWire->namesPresent) {
+ sli->namesPresent = ledWire->namesPresent;
+ memset((char *) sli->names, 0, XkbNumIndicators * sizeof(Atom));
+ for (n = 0, bit = 1; n < XkbNumIndicators; n++, bit <<= 1) {
+ if (ledWire->namesPresent & bit) {
+ sli->names[n] = (Atom) *atomWire;
+ if (sli->names[n] == None)
+ ledWire->namesPresent &= ~bit;
+ atomWire++;
+ }
+ }
+ }
+ mapWire = (xkbIndicatorMapWireDesc *) atomWire;
+ if (changed & XkbXI_IndicatorMapsMask) {
+ mapc = sli->mapsPresent | ledWire->mapsPresent;
+ sli->mapsPresent = ledWire->mapsPresent;
+ memset((char *) sli->maps, 0,
+ XkbNumIndicators * sizeof(XkbIndicatorMapRec));
+ }
+ if (ledWire->mapsPresent) {
+ for (n = 0, bit = 1; n < XkbNumIndicators; n++, bit <<= 1) {
+ if (ledWire->mapsPresent & bit) {
+ sli->maps[n].flags = mapWire->flags;
+ sli->maps[n].which_groups = mapWire->whichGroups;
+ sli->maps[n].groups = mapWire->groups;
+ sli->maps[n].which_mods = mapWire->whichMods;
+ sli->maps[n].mods.mask = mapWire->mods;
+ sli->maps[n].mods.real_mods = mapWire->realMods;
+ sli->maps[n].mods.vmods = mapWire->virtualMods;
+ sli->maps[n].ctrls = mapWire->ctrls;
+ mapWire++;
+ }
+ }
+ }
+ if (changed & XkbXI_IndicatorStateMask) {
+ statec = sli->effectiveState ^ ledWire->state;
+ sli->explicitState &= ~statec;
+ sli->explicitState |= (ledWire->state & statec);
+ }
+ if (namec)
+ XkbApplyLedNameChanges(dev, sli, namec, &ed, &changes, &cause);
+ if (mapc)
+ XkbApplyLedMapChanges(dev, sli, mapc, &ed, &changes, &cause);
+ if (statec)
+ XkbApplyLedStateChanges(dev, sli, statec, &ed, &changes, &cause);
+
+ kbd = dev;
+ if ((sli->flags & XkbSLI_HasOwnState) == 0)
+ kbd = inputInfo.keyboard;
+
+ XkbFlushLedEvents(dev, kbd, sli, &ed, &changes, &cause);
+ ledWire = (xkbDeviceLedsWireDesc *) mapWire;
+ }
+ return (char *) ledWire;
+}
static int
_XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev,
- xkbSetDeviceInfoReq *stuff)
+ xkbSetDeviceInfoReq * stuff)
{
- char *wire;
-
- wire= (char *)&stuff[1];
- if (stuff->change&XkbXI_ButtonActionsMask) {
- if (!dev->button) {
- client->errorValue = _XkbErrCode2(XkbErr_BadClass,ButtonClass);
- return XkbKeyboardErrorCode;
- }
- if ((stuff->firstBtn+stuff->nBtns)>dev->button->numButtons) {
- client->errorValue= _XkbErrCode4(0x02,stuff->firstBtn,stuff->nBtns,
- dev->button->numButtons);
- return BadMatch;
- }
- wire+= (stuff->nBtns*SIZEOF(xkbActionWireDesc));
- }
- if (stuff->change&XkbXI_IndicatorsMask) {
- int status= Success;
- wire= CheckSetDeviceIndicators(wire,dev,stuff->nDeviceLedFBs,
- &status,client);
- if (status!=Success)
- return status;
- }
- if (((wire-((char *)stuff))/4)!=stuff->length)
- return BadLength;
+ char *wire;
+
+ wire = (char *) &stuff[1];
+ if (stuff->change & XkbXI_ButtonActionsMask) {
+ if (!dev->button) {
+ client->errorValue = _XkbErrCode2(XkbErr_BadClass, ButtonClass);
+ return XkbKeyboardErrorCode;
+ }
+ if ((stuff->firstBtn + stuff->nBtns) > dev->button->numButtons) {
+ client->errorValue =
+ _XkbErrCode4(0x02, stuff->firstBtn, stuff->nBtns,
+ dev->button->numButtons);
+ return BadMatch;
+ }
+ wire += (stuff->nBtns * SIZEOF(xkbActionWireDesc));
+ }
+ if (stuff->change & XkbXI_IndicatorsMask) {
+ int status = Success;
+
+ wire = CheckSetDeviceIndicators(wire, dev, stuff->nDeviceLedFBs,
+ &status, client);
+ if (status != Success)
+ return status;
+ }
+ if (((wire - ((char *) stuff)) / 4) != stuff->length)
+ return BadLength;
return Success;
}
static int
_XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev,
- xkbSetDeviceInfoReq *stuff)
+ xkbSetDeviceInfoReq * stuff)
{
- char *wire;
- xkbExtensionDeviceNotify ed;
-
- memset((char *)&ed, 0, SIZEOF(xkbExtensionDeviceNotify));
- ed.deviceID= dev->id;
- wire= (char *)&stuff[1];
- if (stuff->change&XkbXI_ButtonActionsMask) {
- int nBtns,sz,i;
- XkbAction * acts;
- DeviceIntPtr kbd;
-
- nBtns= dev->button->numButtons;
- acts= dev->button->xkb_acts;
- if (acts==NULL) {
- acts= calloc(nBtns, sizeof(XkbAction));
- if (!acts)
- return BadAlloc;
- dev->button->xkb_acts= acts;
- }
- sz= stuff->nBtns*SIZEOF(xkbActionWireDesc);
- memcpy((char *)&acts[stuff->firstBtn],(char *)wire,sz);
- wire+= sz;
- ed.reason|= XkbXI_ButtonActionsMask;
- ed.firstBtn= stuff->firstBtn;
- ed.nBtns= stuff->nBtns;
-
- if (dev->key) kbd= dev;
- else kbd= inputInfo.keyboard;
- acts= &dev->button->xkb_acts[stuff->firstBtn];
- for (i=0;i<stuff->nBtns;i++,acts++) {
- if (acts->type!=XkbSA_NoAction)
- XkbSetActionKeyMods(kbd->key->xkbInfo->desc,acts,0);
- }
- }
- if (stuff->change&XkbXI_IndicatorsMask) {
- int status= Success;
- wire= SetDeviceIndicators(wire,dev,stuff->change,
- stuff->nDeviceLedFBs, &status,client,&ed);
- if (status!=Success)
- return status;
- }
- if ((stuff->change)&&(ed.reason))
- XkbSendExtensionDeviceNotify(dev,client,&ed);
+ char *wire;
+ xkbExtensionDeviceNotify ed;
+
+ memset((char *) &ed, 0, SIZEOF(xkbExtensionDeviceNotify));
+ ed.deviceID = dev->id;
+ wire = (char *) &stuff[1];
+ if (stuff->change & XkbXI_ButtonActionsMask) {
+ int nBtns, sz, i;
+ XkbAction *acts;
+ DeviceIntPtr kbd;
+
+ nBtns = dev->button->numButtons;
+ acts = dev->button->xkb_acts;
+ if (acts == NULL) {
+ acts = calloc(nBtns, sizeof(XkbAction));
+ if (!acts)
+ return BadAlloc;
+ dev->button->xkb_acts = acts;
+ }
+ sz = stuff->nBtns * SIZEOF(xkbActionWireDesc);
+ memcpy((char *) &acts[stuff->firstBtn], (char *) wire, sz);
+ wire += sz;
+ ed.reason |= XkbXI_ButtonActionsMask;
+ ed.firstBtn = stuff->firstBtn;
+ ed.nBtns = stuff->nBtns;
+
+ if (dev->key)
+ kbd = dev;
+ else
+ kbd = inputInfo.keyboard;
+ acts = &dev->button->xkb_acts[stuff->firstBtn];
+ for (i = 0; i < stuff->nBtns; i++, acts++) {
+ if (acts->type != XkbSA_NoAction)
+ XkbSetActionKeyMods(kbd->key->xkbInfo->desc, acts, 0);
+ }
+ }
+ if (stuff->change & XkbXI_IndicatorsMask) {
+ int status = Success;
+
+ wire = SetDeviceIndicators(wire, dev, stuff->change,
+ stuff->nDeviceLedFBs, &status, client, &ed);
+ if (status != Success)
+ return status;
+ }
+ if ((stuff->change) && (ed.reason))
+ XkbSendExtensionDeviceNotify(dev, client, &ed);
return Success;
}
int
ProcXkbSetDeviceInfo(ClientPtr client)
{
- DeviceIntPtr dev;
- int rc;
+ DeviceIntPtr dev;
+ int rc;
REQUEST(xkbSetDeviceInfoReq);
REQUEST_AT_LEAST_SIZE(xkbSetDeviceInfoReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
+ return BadAccess;
CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
- CHK_MASK_LEGAL(0x01,stuff->change,XkbXI_AllFeaturesMask);
+ CHK_MASK_LEGAL(0x01, stuff->change, XkbXI_AllFeaturesMask);
rc = _XkbSetDeviceInfoCheck(client, dev, stuff);
if (rc != Success)
return rc;
- if (stuff->deviceSpec == XkbUseCoreKbd || stuff->deviceSpec == XkbUseCorePtr)
- {
+ if (stuff->deviceSpec == XkbUseCoreKbd ||
+ stuff->deviceSpec == XkbUseCorePtr) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if (((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) &&
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if (((other != dev) && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) &&
((stuff->deviceSpec == XkbUseCoreKbd && other->key) ||
- (stuff->deviceSpec == XkbUseCorePtr && other->button)))
- {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
- if (rc == Success)
- {
+ (stuff->deviceSpec == XkbUseCorePtr && other->button))) {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other,
+ DixManageAccess);
+ if (rc == Success) {
rc = _XkbSetDeviceInfoCheck(client, other, stuff);
if (rc != Success)
return rc;
@@ -6526,18 +6677,18 @@ ProcXkbSetDeviceInfo(ClientPtr client)
if (rc != Success)
return rc;
- if (stuff->deviceSpec == XkbUseCoreKbd || stuff->deviceSpec == XkbUseCorePtr)
- {
+ if (stuff->deviceSpec == XkbUseCoreKbd ||
+ stuff->deviceSpec == XkbUseCorePtr) {
DeviceIntPtr other;
- for (other = inputInfo.devices; other; other = other->next)
- {
- if (((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) &&
+
+ for (other = inputInfo.devices; other; other = other->next) {
+ if (((other != dev) && !IsMaster(other) &&
+ GetMaster(other, MASTER_KEYBOARD) == dev) &&
((stuff->deviceSpec == XkbUseCoreKbd && other->key) ||
- (stuff->deviceSpec == XkbUseCorePtr && other->button)))
- {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
- if (rc == Success)
- {
+ (stuff->deviceSpec == XkbUseCorePtr && other->button))) {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other,
+ DixManageAccess);
+ if (rc == Success) {
rc = _XkbSetDeviceInfo(client, other, stuff);
if (rc != Success)
return rc;
@@ -6554,135 +6705,139 @@ ProcXkbSetDeviceInfo(ClientPtr client)
int
ProcXkbSetDebuggingFlags(ClientPtr client)
{
-CARD32 newFlags,newCtrls,extraLength;
-xkbSetDebuggingFlagsReply rep;
-int rc;
+ CARD32 newFlags, newCtrls, extraLength;
+ xkbSetDebuggingFlagsReply rep;
+ int rc;
REQUEST(xkbSetDebuggingFlagsReq);
REQUEST_AT_LEAST_SIZE(xkbSetDebuggingFlagsReq);
rc = XaceHook(XACE_SERVER_ACCESS, client, DixDebugAccess);
if (rc != Success)
- return rc;
+ return rc;
- newFlags= xkbDebugFlags&(~stuff->affectFlags);
- newFlags|= (stuff->flags&stuff->affectFlags);
- newCtrls= xkbDebugCtrls&(~stuff->affectCtrls);
- newCtrls|= (stuff->ctrls&stuff->affectCtrls);
+ newFlags = xkbDebugFlags & (~stuff->affectFlags);
+ newFlags |= (stuff->flags & stuff->affectFlags);
+ newCtrls = xkbDebugCtrls & (~stuff->affectCtrls);
+ newCtrls |= (stuff->ctrls & stuff->affectCtrls);
if (xkbDebugFlags || newFlags || stuff->msgLength) {
- ErrorF("[xkb] XkbDebug: Setting debug flags to 0x%lx\n",(long)newFlags);
- if (newCtrls!=xkbDebugCtrls)
- ErrorF("[xkb] XkbDebug: Setting debug controls to 0x%lx\n",(long)newCtrls);
- }
- extraLength= (stuff->length<<2)-sz_xkbSetDebuggingFlagsReq;
- if (stuff->msgLength>0) {
- char *msg;
- if (extraLength<XkbPaddedSize(stuff->msgLength)) {
- ErrorF("[xkb] XkbDebug: msgLength= %d, length= %ld (should be %d)\n",
- stuff->msgLength,(long)extraLength,
- XkbPaddedSize(stuff->msgLength));
- return BadLength;
- }
- msg= (char *)&stuff[1];
- if (msg[stuff->msgLength-1]!='\0') {
- ErrorF("[xkb] XkbDebug: message not null-terminated\n");
- return BadValue;
- }
- ErrorF("[xkb] XkbDebug: %s\n",msg);
+ ErrorF("[xkb] XkbDebug: Setting debug flags to 0x%lx\n",
+ (long) newFlags);
+ if (newCtrls != xkbDebugCtrls)
+ ErrorF("[xkb] XkbDebug: Setting debug controls to 0x%lx\n",
+ (long) newCtrls);
+ }
+ extraLength = (stuff->length << 2) - sz_xkbSetDebuggingFlagsReq;
+ if (stuff->msgLength > 0) {
+ char *msg;
+
+ if (extraLength < XkbPaddedSize(stuff->msgLength)) {
+ ErrorF
+ ("[xkb] XkbDebug: msgLength= %d, length= %ld (should be %d)\n",
+ stuff->msgLength, (long) extraLength,
+ XkbPaddedSize(stuff->msgLength));
+ return BadLength;
+ }
+ msg = (char *) &stuff[1];
+ if (msg[stuff->msgLength - 1] != '\0') {
+ ErrorF("[xkb] XkbDebug: message not null-terminated\n");
+ return BadValue;
+ }
+ ErrorF("[xkb] XkbDebug: %s\n", msg);
}
xkbDebugFlags = newFlags;
xkbDebugCtrls = newCtrls;
- rep.type= X_Reply;
+ rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.currentFlags = newFlags;
rep.currentCtrls = newCtrls;
rep.supportedFlags = ~0;
rep.supportedCtrls = ~0;
- if ( client->swapped ) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.currentFlags);
- swapl(&rep.currentCtrls);
- swapl(&rep.supportedFlags);
- swapl(&rep.supportedCtrls);
- }
- WriteToClient(client,SIZEOF(xkbSetDebuggingFlagsReply), (char *)&rep);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.currentFlags);
+ swapl(&rep.currentCtrls);
+ swapl(&rep.supportedFlags);
+ swapl(&rep.supportedCtrls);
+ }
+ WriteToClient(client, SIZEOF(xkbSetDebuggingFlagsReply), (char *) &rep);
return Success;
}
/***====================================================================***/
static int
-ProcXkbDispatch (ClientPtr client)
+ProcXkbDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_kbUseExtension:
- return ProcXkbUseExtension(client);
+ return ProcXkbUseExtension(client);
case X_kbSelectEvents:
- return ProcXkbSelectEvents(client);
+ return ProcXkbSelectEvents(client);
case X_kbBell:
- return ProcXkbBell(client);
+ return ProcXkbBell(client);
case X_kbGetState:
- return ProcXkbGetState(client);
+ return ProcXkbGetState(client);
case X_kbLatchLockState:
- return ProcXkbLatchLockState(client);
+ return ProcXkbLatchLockState(client);
case X_kbGetControls:
- return ProcXkbGetControls(client);
+ return ProcXkbGetControls(client);
case X_kbSetControls:
- return ProcXkbSetControls(client);
+ return ProcXkbSetControls(client);
case X_kbGetMap:
- return ProcXkbGetMap(client);
+ return ProcXkbGetMap(client);
case X_kbSetMap:
- return ProcXkbSetMap(client);
+ return ProcXkbSetMap(client);
case X_kbGetCompatMap:
- return ProcXkbGetCompatMap(client);
+ return ProcXkbGetCompatMap(client);
case X_kbSetCompatMap:
- return ProcXkbSetCompatMap(client);
+ return ProcXkbSetCompatMap(client);
case X_kbGetIndicatorState:
- return ProcXkbGetIndicatorState(client);
+ return ProcXkbGetIndicatorState(client);
case X_kbGetIndicatorMap:
- return ProcXkbGetIndicatorMap(client);
+ return ProcXkbGetIndicatorMap(client);
case X_kbSetIndicatorMap:
- return ProcXkbSetIndicatorMap(client);
+ return ProcXkbSetIndicatorMap(client);
case X_kbGetNamedIndicator:
- return ProcXkbGetNamedIndicator(client);
+ return ProcXkbGetNamedIndicator(client);
case X_kbSetNamedIndicator:
- return ProcXkbSetNamedIndicator(client);
+ return ProcXkbSetNamedIndicator(client);
case X_kbGetNames:
- return ProcXkbGetNames(client);
+ return ProcXkbGetNames(client);
case X_kbSetNames:
- return ProcXkbSetNames(client);
+ return ProcXkbSetNames(client);
case X_kbGetGeometry:
- return ProcXkbGetGeometry(client);
+ return ProcXkbGetGeometry(client);
case X_kbSetGeometry:
- return ProcXkbSetGeometry(client);
+ return ProcXkbSetGeometry(client);
case X_kbPerClientFlags:
- return ProcXkbPerClientFlags(client);
+ return ProcXkbPerClientFlags(client);
case X_kbListComponents:
- return ProcXkbListComponents(client);
+ return ProcXkbListComponents(client);
case X_kbGetKbdByName:
- return ProcXkbGetKbdByName(client);
+ return ProcXkbGetKbdByName(client);
case X_kbGetDeviceInfo:
- return ProcXkbGetDeviceInfo(client);
+ return ProcXkbGetDeviceInfo(client);
case X_kbSetDeviceInfo:
- return ProcXkbSetDeviceInfo(client);
+ return ProcXkbSetDeviceInfo(client);
case X_kbSetDebuggingFlags:
- return ProcXkbSetDebuggingFlags(client);
+ return ProcXkbSetDebuggingFlags(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
static int
-XkbClientGone(pointer data,XID id)
+XkbClientGone(pointer data, XID id)
{
- DevicePtr pXDev = (DevicePtr)data;
+ DevicePtr pXDev = (DevicePtr) data;
- if (!XkbRemoveResourceClient(pXDev,id)) {
- ErrorF("[xkb] Internal Error! bad RemoveResourceClient in XkbClientGone\n");
+ if (!XkbRemoveResourceClient(pXDev, id)) {
+ ErrorF
+ ("[xkb] Internal Error! bad RemoveResourceClient in XkbClientGone\n");
}
return 1;
}
@@ -6694,20 +6849,18 @@ XkbExtensionInit(void)
RT_XKBCLIENT = CreateNewResourceType(XkbClientGone, "XkbClient");
if (!RT_XKBCLIENT)
- return;
+ return;
if (!XkbInitPrivates())
- return;
+ return;
if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors,
- ProcXkbDispatch, SProcXkbDispatch,
- NULL, StandardMinorOpcode))) {
- XkbReqCode = (unsigned char)extEntry->base;
- XkbEventBase = (unsigned char)extEntry->eventBase;
- XkbErrorBase = (unsigned char)extEntry->errorBase;
- XkbKeyboardErrorCode = XkbErrorBase+XkbKeyboard;
+ ProcXkbDispatch, SProcXkbDispatch,
+ NULL, StandardMinorOpcode))) {
+ XkbReqCode = (unsigned char) extEntry->base;
+ XkbEventBase = (unsigned char) extEntry->eventBase;
+ XkbErrorBase = (unsigned char) extEntry->errorBase;
+ XkbKeyboardErrorCode = XkbErrorBase + XkbKeyboard;
}
return;
}
-
-
diff --git a/xorg-server/xkb/xkbAccessX.c b/xorg-server/xkb/xkbAccessX.c
index d246827ea..111bf9f40 100644
--- a/xorg-server/xkb/xkbAccessX.c
+++ b/xorg-server/xkb/xkbAccessX.c
@@ -43,49 +43,52 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <sys/time.h>
#endif
-int XkbDfltRepeatDelay= 660;
-int XkbDfltRepeatInterval= 40;
+int XkbDfltRepeatDelay = 660;
+int XkbDfltRepeatInterval = 40;
#define DFLT_TIMEOUT_CTRLS (XkbAX_KRGMask|XkbStickyKeysMask|XkbMouseKeysMask)
#define DFLT_TIMEOUT_OPTS (XkbAX_IndicatorFBMask)
-unsigned short XkbDfltAccessXTimeout= 120;
-unsigned int XkbDfltAccessXTimeoutMask= DFLT_TIMEOUT_CTRLS;
-static unsigned int XkbDfltAccessXTimeoutValues= 0;
-static unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS;
-static unsigned int XkbDfltAccessXTimeoutOptionsValues= 0;
-unsigned int XkbDfltAccessXFeedback= XkbAccessXFeedbackMask;
-unsigned short XkbDfltAccessXOptions= XkbAX_AllOptionsMask & ~(XkbAX_IndicatorFBMask|XkbAX_SKReleaseFBMask|XkbAX_SKRejectFBMask);
+unsigned short XkbDfltAccessXTimeout = 120;
+unsigned int XkbDfltAccessXTimeoutMask = DFLT_TIMEOUT_CTRLS;
+static unsigned int XkbDfltAccessXTimeoutValues = 0;
+static unsigned int XkbDfltAccessXTimeoutOptionsMask = DFLT_TIMEOUT_OPTS;
+static unsigned int XkbDfltAccessXTimeoutOptionsValues = 0;
+unsigned int XkbDfltAccessXFeedback = XkbAccessXFeedbackMask;
+unsigned short XkbDfltAccessXOptions =
+ XkbAX_AllOptionsMask & ~(XkbAX_IndicatorFBMask | XkbAX_SKReleaseFBMask |
+ XkbAX_SKRejectFBMask);
void
-AccessXComputeCurveFactor(XkbSrvInfoPtr xkbi,XkbControlsPtr ctrls)
+AccessXComputeCurveFactor(XkbSrvInfoPtr xkbi, XkbControlsPtr ctrls)
{
- xkbi->mouseKeysCurve= 1.0+(((double)ctrls->mk_curve)*0.001);
- xkbi->mouseKeysCurveFactor= ( ((double)ctrls->mk_max_speed)/
- pow((double)ctrls->mk_time_to_max,xkbi->mouseKeysCurve));
+ xkbi->mouseKeysCurve = 1.0 + (((double) ctrls->mk_curve) * 0.001);
+ xkbi->mouseKeysCurveFactor = (((double) ctrls->mk_max_speed) /
+ pow((double) ctrls->mk_time_to_max,
+ xkbi->mouseKeysCurve));
return;
}
void
AccessXInit(DeviceIntPtr keybd)
{
-XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
-XkbControlsPtr ctrls = xkbi->desc->ctrls;
-
- xkbi->shiftKeyCount= 0;
- xkbi->mouseKeysCounter= 0;
- xkbi->inactiveKey= 0;
- xkbi->slowKey= 0;
- xkbi->repeatKey= 0;
- xkbi->krgTimerActive= _OFF_TIMER;
- xkbi->beepType= _BEEP_NONE;
- xkbi->beepCount= 0;
- xkbi->mouseKeyTimer= NULL;
- xkbi->slowKeysTimer= NULL;
- xkbi->bounceKeysTimer= NULL;
- xkbi->repeatKeyTimer= NULL;
- xkbi->krgTimer= NULL;
- xkbi->beepTimer= NULL;
+ XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+
+ xkbi->shiftKeyCount = 0;
+ xkbi->mouseKeysCounter = 0;
+ xkbi->inactiveKey = 0;
+ xkbi->slowKey = 0;
+ xkbi->repeatKey = 0;
+ xkbi->krgTimerActive = _OFF_TIMER;
+ xkbi->beepType = _BEEP_NONE;
+ xkbi->beepCount = 0;
+ xkbi->mouseKeyTimer = NULL;
+ xkbi->slowKeysTimer = NULL;
+ xkbi->bounceKeysTimer = NULL;
+ xkbi->repeatKeyTimer = NULL;
+ xkbi->krgTimer = NULL;
+ xkbi->beepTimer = NULL;
ctrls->repeat_delay = XkbDfltRepeatDelay;
ctrls->repeat_interval = XkbDfltRepeatInterval;
ctrls->debounce_delay = 300;
@@ -102,12 +105,12 @@ XkbControlsPtr ctrls = xkbi->desc->ctrls;
ctrls->axt_opts_mask = XkbDfltAccessXTimeoutOptionsMask;
ctrls->axt_opts_values = XkbDfltAccessXTimeoutOptionsValues;
if (XkbDfltAccessXTimeout)
- ctrls->enabled_ctrls |= XkbAccessXTimeoutMask;
+ ctrls->enabled_ctrls |= XkbAccessXTimeoutMask;
else
- ctrls->enabled_ctrls &= ~XkbAccessXTimeoutMask;
+ ctrls->enabled_ctrls &= ~XkbAccessXTimeoutMask;
ctrls->enabled_ctrls |= XkbDfltAccessXFeedback;
- ctrls->ax_options = XkbDfltAccessXOptions;
- AccessXComputeCurveFactor(xkbi,ctrls);
+ ctrls->ax_options = XkbDfltAccessXOptions;
+ AccessXComputeCurveFactor(xkbi, ctrls);
return;
}
@@ -118,11 +121,8 @@ XkbControlsPtr ctrls = xkbi->desc->ctrls;
/* Generate a synthetic keyboard event. */
/* */
/************************************************************************/
-static void
-AccessXKeyboardEvent(DeviceIntPtr keybd,
- int type,
- BYTE keyCode,
- Bool isRepeat)
+static void
+AccessXKeyboardEvent(DeviceIntPtr keybd, int type, BYTE keyCode, Bool isRepeat)
{
DeviceEvent event;
@@ -131,14 +131,14 @@ AccessXKeyboardEvent(DeviceIntPtr keybd,
event.detail.key = keyCode;
event.key_repeat = isRepeat;
- if (xkbDebugFlags&0x8) {
- DebugF("[xkb] AXKE: Key %d %s\n", keyCode,
+ if (xkbDebugFlags & 0x8) {
+ DebugF("[xkb] AXKE: Key %d %s\n", keyCode,
(event.type == ET_KeyPress ? "down" : "up"));
}
XkbProcessKeyboardEvent(&event, keybd);
return;
-} /* AccessXKeyboardEvent */
+} /* AccessXKeyboardEvent */
/************************************************************************/
/* */
@@ -148,29 +148,29 @@ AccessXKeyboardEvent(DeviceIntPtr keybd,
/* */
/************************************************************************/
static void
-AccessXKRGTurnOn(DeviceIntPtr dev,CARD16 KRGControl,xkbControlsNotify *pCN)
+AccessXKRGTurnOn(DeviceIntPtr dev, CARD16 KRGControl, xkbControlsNotify * pCN)
{
-XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
-XkbControlsPtr ctrls = xkbi->desc->ctrls;
-XkbControlsRec old;
-XkbEventCauseRec cause;
-XkbSrvLedInfoPtr sli;
-
- old= *ctrls;
- ctrls->enabled_ctrls |= (KRGControl&XkbAX_KRGMask);
- if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,FALSE))
- XkbSendControlsNotify(dev,pCN);
- cause.kc= pCN->keycode;
- cause.event= pCN->eventType;
- cause.mjr= pCN->requestMajor;
- cause.mnr= pCN->requestMinor;
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
- XkbUpdateIndicators(dev,sli->usesControls,TRUE,NULL,&cause);
- if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask))
- XkbDDXAccessXBeep(dev,_BEEP_FEATURE_ON,KRGControl);
+ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ XkbControlsRec old;
+ XkbEventCauseRec cause;
+ XkbSrvLedInfoPtr sli;
+
+ old = *ctrls;
+ ctrls->enabled_ctrls |= (KRGControl & XkbAX_KRGMask);
+ if (XkbComputeControlsNotify(dev, &old, ctrls, pCN, FALSE))
+ XkbSendControlsNotify(dev, pCN);
+ cause.kc = pCN->keycode;
+ cause.event = pCN->eventType;
+ cause.mjr = pCN->requestMajor;
+ cause.mnr = pCN->requestMinor;
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId, 0);
+ XkbUpdateIndicators(dev, sli->usesControls, TRUE, NULL, &cause);
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_FeatureFBMask))
+ XkbDDXAccessXBeep(dev, _BEEP_FEATURE_ON, KRGControl);
return;
-
-} /* AccessXKRGTurnOn */
+
+} /* AccessXKRGTurnOn */
/************************************************************************/
/* */
@@ -179,32 +179,33 @@ XkbSrvLedInfoPtr sli;
/* Turn the keyboard response group off. */
/* */
/************************************************************************/
-static void
-AccessXKRGTurnOff(DeviceIntPtr dev,xkbControlsNotify *pCN)
+static void
+AccessXKRGTurnOff(DeviceIntPtr dev, xkbControlsNotify * pCN)
{
-XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
-XkbControlsPtr ctrls = xkbi->desc->ctrls;
-XkbControlsRec old;
-XkbEventCauseRec cause;
-XkbSrvLedInfoPtr sli;
+ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ XkbControlsRec old;
+ XkbEventCauseRec cause;
+ XkbSrvLedInfoPtr sli;
old = *ctrls;
ctrls->enabled_ctrls &= ~XkbAX_KRGMask;
- if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,FALSE))
- XkbSendControlsNotify(dev,pCN);
- cause.kc= pCN->keycode;
- cause.event= pCN->eventType;
- cause.mjr= pCN->requestMajor;
- cause.mnr= pCN->requestMinor;
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
- XkbUpdateIndicators(dev,sli->usesControls,TRUE,NULL,&cause);
- if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) {
- unsigned changes= old.enabled_ctrls^ctrls->enabled_ctrls;
- XkbDDXAccessXBeep(dev,_BEEP_FEATURE_OFF,changes);
+ if (XkbComputeControlsNotify(dev, &old, ctrls, pCN, FALSE))
+ XkbSendControlsNotify(dev, pCN);
+ cause.kc = pCN->keycode;
+ cause.event = pCN->eventType;
+ cause.mjr = pCN->requestMajor;
+ cause.mnr = pCN->requestMinor;
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId, 0);
+ XkbUpdateIndicators(dev, sli->usesControls, TRUE, NULL, &cause);
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_FeatureFBMask)) {
+ unsigned changes = old.enabled_ctrls ^ ctrls->enabled_ctrls;
+
+ XkbDDXAccessXBeep(dev, _BEEP_FEATURE_OFF, changes);
}
return;
-
-} /* AccessXKRGTurnOff */
+
+} /* AccessXKRGTurnOff */
/************************************************************************/
/* */
@@ -214,31 +215,31 @@ XkbSrvLedInfoPtr sli;
/* */
/************************************************************************/
static void
-AccessXStickyKeysTurnOn(DeviceIntPtr dev,xkbControlsNotify *pCN)
+AccessXStickyKeysTurnOn(DeviceIntPtr dev, xkbControlsNotify * pCN)
{
-XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
-XkbControlsPtr ctrls = xkbi->desc->ctrls;
-XkbControlsRec old;
-XkbEventCauseRec cause;
-XkbSrvLedInfoPtr sli;
+ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ XkbControlsRec old;
+ XkbEventCauseRec cause;
+ XkbSrvLedInfoPtr sli;
old = *ctrls;
ctrls->enabled_ctrls |= XkbStickyKeysMask;
xkbi->shiftKeyCount = 0;
- if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,FALSE))
- XkbSendControlsNotify(dev,pCN);
- cause.kc= pCN->keycode;
- cause.event= pCN->eventType;
- cause.mjr= pCN->requestMajor;
- cause.mnr= pCN->requestMinor;
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
- XkbUpdateIndicators(dev,sli->usesControls,TRUE,NULL,&cause);
- if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) {
- XkbDDXAccessXBeep(dev,_BEEP_FEATURE_ON,XkbStickyKeysMask);
+ if (XkbComputeControlsNotify(dev, &old, ctrls, pCN, FALSE))
+ XkbSendControlsNotify(dev, pCN);
+ cause.kc = pCN->keycode;
+ cause.event = pCN->eventType;
+ cause.mjr = pCN->requestMajor;
+ cause.mnr = pCN->requestMinor;
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId, 0);
+ XkbUpdateIndicators(dev, sli->usesControls, TRUE, NULL, &cause);
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_FeatureFBMask)) {
+ XkbDDXAccessXBeep(dev, _BEEP_FEATURE_ON, XkbStickyKeysMask);
}
return;
-
-} /* AccessXStickyKeysTurnOn */
+
+} /* AccessXStickyKeysTurnOn */
/************************************************************************/
/* */
@@ -248,65 +249,67 @@ XkbSrvLedInfoPtr sli;
/* */
/************************************************************************/
static void
-AccessXStickyKeysTurnOff(DeviceIntPtr dev,xkbControlsNotify *pCN)
+AccessXStickyKeysTurnOff(DeviceIntPtr dev, xkbControlsNotify * pCN)
{
-XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
-XkbControlsPtr ctrls = xkbi->desc->ctrls;
-XkbControlsRec old;
-XkbEventCauseRec cause;
-XkbSrvLedInfoPtr sli;
+ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ XkbControlsRec old;
+ XkbEventCauseRec cause;
+ XkbSrvLedInfoPtr sli;
old = *ctrls;
ctrls->enabled_ctrls &= ~XkbStickyKeysMask;
xkbi->shiftKeyCount = 0;
- if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,FALSE))
- XkbSendControlsNotify(dev,pCN);
-
- cause.kc= pCN->keycode;
- cause.event= pCN->eventType;
- cause.mjr= pCN->requestMajor;
- cause.mnr= pCN->requestMinor;
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
- XkbUpdateIndicators(dev,sli->usesControls,TRUE,NULL,&cause);
- if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) {
- XkbDDXAccessXBeep(dev,_BEEP_FEATURE_OFF,XkbStickyKeysMask);
+ if (XkbComputeControlsNotify(dev, &old, ctrls, pCN, FALSE))
+ XkbSendControlsNotify(dev, pCN);
+
+ cause.kc = pCN->keycode;
+ cause.event = pCN->eventType;
+ cause.mjr = pCN->requestMajor;
+ cause.mnr = pCN->requestMinor;
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId, 0);
+ XkbUpdateIndicators(dev, sli->usesControls, TRUE, NULL, &cause);
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_FeatureFBMask)) {
+ XkbDDXAccessXBeep(dev, _BEEP_FEATURE_OFF, XkbStickyKeysMask);
}
#ifndef NO_CLEAR_LATCHES_FOR_STICKY_KEYS_OFF
- XkbClearAllLatchesAndLocks(dev,xkbi,FALSE,&cause);
+ XkbClearAllLatchesAndLocks(dev, xkbi, FALSE, &cause);
#endif
return;
-} /* AccessXStickyKeysTurnOff */
+} /* AccessXStickyKeysTurnOff */
static CARD32
-AccessXKRGExpire(OsTimerPtr timer,CARD32 now,pointer arg)
+AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
{
-XkbSrvInfoPtr xkbi= ((DeviceIntPtr)arg)->key->xkbInfo;
-xkbControlsNotify cn;
-
- if (xkbi->krgTimerActive==_KRG_WARN_TIMER) {
- XkbDDXAccessXBeep((DeviceIntPtr)arg,_BEEP_SLOW_WARN,XkbStickyKeysMask);
- xkbi->krgTimerActive= _KRG_TIMER;
- return 4000;
+ XkbSrvInfoPtr xkbi = ((DeviceIntPtr) arg)->key->xkbInfo;
+ xkbControlsNotify cn;
+
+ if (xkbi->krgTimerActive == _KRG_WARN_TIMER) {
+ XkbDDXAccessXBeep((DeviceIntPtr) arg, _BEEP_SLOW_WARN,
+ XkbStickyKeysMask);
+ xkbi->krgTimerActive = _KRG_TIMER;
+ return 4000;
}
- xkbi->krgTimerActive= _OFF_TIMER;
+ xkbi->krgTimerActive = _OFF_TIMER;
cn.keycode = 0;
cn.eventType = 0;
cn.requestMajor = 0;
cn.requestMinor = 0;
- if (xkbi->desc->ctrls->enabled_ctrls&XkbSlowKeysMask)
- AccessXKRGTurnOff((DeviceIntPtr)arg,&cn);
- else AccessXKRGTurnOn((DeviceIntPtr)arg,XkbSlowKeysMask,&cn);
+ if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask)
+ AccessXKRGTurnOff((DeviceIntPtr) arg, &cn);
+ else
+ AccessXKRGTurnOn((DeviceIntPtr) arg, XkbSlowKeysMask, &cn);
return 0;
}
static CARD32
-AccessXRepeatKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg)
+AccessXRepeatKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg)
{
-DeviceIntPtr dev = (DeviceIntPtr) arg;
-XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+ DeviceIntPtr dev = (DeviceIntPtr) arg;
+ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
if (xkbi->repeatKey == 0)
- return 0;
+ return 0;
AccessXKeyboardEvent(dev, ET_KeyPress, xkbi->repeatKey, TRUE);
@@ -314,118 +317,122 @@ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
}
void
-AccessXCancelRepeatKey(XkbSrvInfoPtr xkbi,KeyCode key)
+AccessXCancelRepeatKey(XkbSrvInfoPtr xkbi, KeyCode key)
{
- if (xkbi->repeatKey==key)
- xkbi->repeatKey= 0;
+ if (xkbi->repeatKey == key)
+ xkbi->repeatKey = 0;
return;
}
static CARD32
-AccessXSlowKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg)
+AccessXSlowKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg)
{
-DeviceIntPtr keybd;
-XkbSrvInfoPtr xkbi;
-XkbDescPtr xkb;
-XkbControlsPtr ctrls;
-
- keybd= (DeviceIntPtr)arg;
- xkbi= keybd->key->xkbInfo;
- xkb= xkbi->desc;
- ctrls= xkb->ctrls;
- if (xkbi->slowKey!=0) {
- xkbAccessXNotify ev;
- KeySym *sym= XkbKeySymsPtr(xkb,xkbi->slowKey);
- ev.detail= XkbAXN_SKAccept;
- ev.keycode= xkbi->slowKey;
- ev.slowKeysDelay= ctrls->slow_keys_delay;
- ev.debounceDelay= ctrls->debounce_delay;
- XkbSendAccessXNotify(keybd,&ev);
- if (XkbAX_NeedFeedback(ctrls,XkbAX_SKAcceptFBMask))
- XkbDDXAccessXBeep(keybd,_BEEP_SLOW_ACCEPT,XkbSlowKeysMask);
- AccessXKeyboardEvent(keybd, ET_KeyPress,xkbi->slowKey,FALSE);
- /* check for magic sequences */
- if ((ctrls->enabled_ctrls&XkbAccessXKeysMask) &&
- ((sym[0]==XK_Shift_R)||(sym[0]==XK_Shift_L)))
- xkbi->shiftKeyCount++;
-
- /* Start repeating if necessary. Stop autorepeating if the user
- * presses a non-modifier key that doesn't autorepeat.
- */
- if (keybd->kbdfeed->ctrl.autoRepeat &&
- ((xkbi->slowKey != xkbi->mouseKey) || (!xkbi->mouseKeysAccel)) &&
- (ctrls->enabled_ctrls&XkbRepeatKeysMask)) {
- if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,xkbi->slowKey)) {
- xkbi->repeatKey = xkbi->slowKey;
- xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer,
- 0, ctrls->repeat_delay,
- AccessXRepeatKeyExpire, (pointer)keybd);
- }
- }
+ DeviceIntPtr keybd;
+ XkbSrvInfoPtr xkbi;
+ XkbDescPtr xkb;
+ XkbControlsPtr ctrls;
+
+ keybd = (DeviceIntPtr) arg;
+ xkbi = keybd->key->xkbInfo;
+ xkb = xkbi->desc;
+ ctrls = xkb->ctrls;
+ if (xkbi->slowKey != 0) {
+ xkbAccessXNotify ev;
+ KeySym *sym = XkbKeySymsPtr(xkb, xkbi->slowKey);
+
+ ev.detail = XkbAXN_SKAccept;
+ ev.keycode = xkbi->slowKey;
+ ev.slowKeysDelay = ctrls->slow_keys_delay;
+ ev.debounceDelay = ctrls->debounce_delay;
+ XkbSendAccessXNotify(keybd, &ev);
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_SKAcceptFBMask))
+ XkbDDXAccessXBeep(keybd, _BEEP_SLOW_ACCEPT, XkbSlowKeysMask);
+ AccessXKeyboardEvent(keybd, ET_KeyPress, xkbi->slowKey, FALSE);
+ /* check for magic sequences */
+ if ((ctrls->enabled_ctrls & XkbAccessXKeysMask) &&
+ ((sym[0] == XK_Shift_R) || (sym[0] == XK_Shift_L)))
+ xkbi->shiftKeyCount++;
+
+ /* Start repeating if necessary. Stop autorepeating if the user
+ * presses a non-modifier key that doesn't autorepeat.
+ */
+ if (keybd->kbdfeed->ctrl.autoRepeat &&
+ ((xkbi->slowKey != xkbi->mouseKey) || (!xkbi->mouseKeysAccel)) &&
+ (ctrls->enabled_ctrls & XkbRepeatKeysMask)) {
+ if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats, xkbi->slowKey)) {
+ xkbi->repeatKey = xkbi->slowKey;
+ xkbi->repeatKeyTimer = TimerSet(xkbi->repeatKeyTimer,
+ 0, ctrls->repeat_delay,
+ AccessXRepeatKeyExpire,
+ (pointer) keybd);
+ }
+ }
}
return 0;
}
static CARD32
-AccessXBounceKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg)
+AccessXBounceKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg)
{
-XkbSrvInfoPtr xkbi= ((DeviceIntPtr)arg)->key->xkbInfo;
+ XkbSrvInfoPtr xkbi = ((DeviceIntPtr) arg)->key->xkbInfo;
- xkbi->inactiveKey= 0;
+ xkbi->inactiveKey = 0;
return 0;
}
static CARD32
-AccessXTimeoutExpire(OsTimerPtr timer,CARD32 now,pointer arg)
+AccessXTimeoutExpire(OsTimerPtr timer, CARD32 now, pointer arg)
{
-DeviceIntPtr dev = (DeviceIntPtr)arg;
-XkbSrvInfoPtr xkbi= dev->key->xkbInfo;
-XkbControlsPtr ctrls= xkbi->desc->ctrls;
-XkbControlsRec old;
-xkbControlsNotify cn;
-XkbEventCauseRec cause;
-XkbSrvLedInfoPtr sli;
+ DeviceIntPtr dev = (DeviceIntPtr) arg;
+ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ XkbControlsRec old;
+ xkbControlsNotify cn;
+ XkbEventCauseRec cause;
+ XkbSrvLedInfoPtr sli;
if (xkbi->lastPtrEventTime) {
- unsigned timeToWait = (ctrls->ax_timeout*1000);
- unsigned timeElapsed = (now-xkbi->lastPtrEventTime);
+ unsigned timeToWait = (ctrls->ax_timeout * 1000);
+ unsigned timeElapsed = (now - xkbi->lastPtrEventTime);
- if (timeToWait > timeElapsed)
- return timeToWait - timeElapsed;
+ if (timeToWait > timeElapsed)
+ return timeToWait - timeElapsed;
}
- old= *ctrls;
- xkbi->shiftKeyCount= 0;
- ctrls->enabled_ctrls&= ~ctrls->axt_ctrls_mask;
- ctrls->enabled_ctrls|=
- (ctrls->axt_ctrls_values&ctrls->axt_ctrls_mask);
+ old = *ctrls;
+ xkbi->shiftKeyCount = 0;
+ ctrls->enabled_ctrls &= ~ctrls->axt_ctrls_mask;
+ ctrls->enabled_ctrls |= (ctrls->axt_ctrls_values & ctrls->axt_ctrls_mask);
if (ctrls->axt_opts_mask) {
- ctrls->ax_options&= ~ctrls->axt_opts_mask;
- ctrls->ax_options|= (ctrls->axt_opts_values&ctrls->axt_opts_mask);
+ ctrls->ax_options &= ~ctrls->axt_opts_mask;
+ ctrls->ax_options |= (ctrls->axt_opts_values & ctrls->axt_opts_mask);
}
- if (XkbComputeControlsNotify(dev,&old,ctrls,&cn,FALSE)) {
- cn.keycode = 0;
- cn.eventType = 0;
- cn.requestMajor = 0;
- cn.requestMinor = 0;
- XkbSendControlsNotify(dev,&cn);
+ if (XkbComputeControlsNotify(dev, &old, ctrls, &cn, FALSE)) {
+ cn.keycode = 0;
+ cn.eventType = 0;
+ cn.requestMajor = 0;
+ cn.requestMinor = 0;
+ XkbSendControlsNotify(dev, &cn);
}
XkbSetCauseUnknown(&cause);
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
- XkbUpdateIndicators(dev,sli->usesControls,TRUE,NULL,&cause);
- if (ctrls->ax_options!=old.ax_options) {
- unsigned set,cleared,bell;
- set= ctrls->ax_options&(~old.ax_options);
- cleared= (~ctrls->ax_options)&old.ax_options;
- if (set && cleared) bell= _BEEP_FEATURE_CHANGE;
- else if (set) bell= _BEEP_FEATURE_ON;
- else bell= _BEEP_FEATURE_OFF;
- XkbDDXAccessXBeep(dev,bell,XkbAccessXTimeoutMask);
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId, 0);
+ XkbUpdateIndicators(dev, sli->usesControls, TRUE, NULL, &cause);
+ if (ctrls->ax_options != old.ax_options) {
+ unsigned set, cleared, bell;
+
+ set = ctrls->ax_options & (~old.ax_options);
+ cleared = (~ctrls->ax_options) & old.ax_options;
+ if (set && cleared)
+ bell = _BEEP_FEATURE_CHANGE;
+ else if (set)
+ bell = _BEEP_FEATURE_ON;
+ else
+ bell = _BEEP_FEATURE_OFF;
+ XkbDDXAccessXBeep(dev, bell, XkbAccessXTimeoutMask);
}
- xkbi->krgTimerActive= _OFF_TIMER;
+ xkbi->krgTimerActive = _OFF_TIMER;
return 0;
}
-
/************************************************************************/
/* */
/* AccessXFilterPressEvent */
@@ -439,125 +446,129 @@ XkbSrvLedInfoPtr sli;
/* */
/************************************************************************/
Bool
-AccessXFilterPressEvent( DeviceEvent* event,
- DeviceIntPtr keybd)
+AccessXFilterPressEvent(DeviceEvent *event, DeviceIntPtr keybd)
{
-XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
-XkbControlsPtr ctrls = xkbi->desc->ctrls;
-Bool ignoreKeyEvent = FALSE;
-KeyCode key = event->detail.key;
-KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
-
- if (ctrls->enabled_ctrls&XkbAccessXKeysMask) {
- /* check for magic sequences */
- if ((sym[0]==XK_Shift_R)||(sym[0]==XK_Shift_L)) {
- if (XkbAX_NeedFeedback(ctrls,XkbAX_SlowWarnFBMask)) {
- xkbi->krgTimerActive = _KRG_WARN_TIMER;
- xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0, 4000,
- AccessXKRGExpire, (pointer)keybd);
- }
- else {
- xkbi->krgTimerActive = _KRG_TIMER;
- xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0, 8000,
- AccessXKRGExpire, (pointer)keybd);
- }
- if (!(ctrls->enabled_ctrls & XkbSlowKeysMask)) {
- CARD32 now= GetTimeInMillis();
- if ((now-xkbi->lastShiftEventTime)>15000)
- xkbi->shiftKeyCount= 1;
- else xkbi->shiftKeyCount++;
- xkbi->lastShiftEventTime= now;
- }
- }
- else {
- if (xkbi->krgTimerActive) {
- xkbi->krgTimer= TimerSet(xkbi->krgTimer,0, 0, NULL, NULL);
- xkbi->krgTimerActive= _OFF_TIMER;
- }
- }
+ XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ Bool ignoreKeyEvent = FALSE;
+ KeyCode key = event->detail.key;
+ KeySym *sym = XkbKeySymsPtr(xkbi->desc, key);
+
+ if (ctrls->enabled_ctrls & XkbAccessXKeysMask) {
+ /* check for magic sequences */
+ if ((sym[0] == XK_Shift_R) || (sym[0] == XK_Shift_L)) {
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_SlowWarnFBMask)) {
+ xkbi->krgTimerActive = _KRG_WARN_TIMER;
+ xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0, 4000,
+ AccessXKRGExpire, (pointer) keybd);
+ }
+ else {
+ xkbi->krgTimerActive = _KRG_TIMER;
+ xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0, 8000,
+ AccessXKRGExpire, (pointer) keybd);
+ }
+ if (!(ctrls->enabled_ctrls & XkbSlowKeysMask)) {
+ CARD32 now = GetTimeInMillis();
+
+ if ((now - xkbi->lastShiftEventTime) > 15000)
+ xkbi->shiftKeyCount = 1;
+ else
+ xkbi->shiftKeyCount++;
+ xkbi->lastShiftEventTime = now;
+ }
+ }
+ else {
+ if (xkbi->krgTimerActive) {
+ xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0, 0, NULL, NULL);
+ xkbi->krgTimerActive = _OFF_TIMER;
+ }
+ }
}
-
+
/* Don't transmit the KeyPress if SlowKeys is turned on;
* The wakeup handler will synthesize one for us if the user
* has held the key long enough.
*/
if (ctrls->enabled_ctrls & XkbSlowKeysMask) {
- xkbAccessXNotify ev;
- /* If key was already pressed, ignore subsequent press events
- * from the server's autorepeat
- */
- if(xkbi->slowKey == key)
- return TRUE;
- ev.detail= XkbAXN_SKPress;
- ev.keycode= key;
- ev.slowKeysDelay= ctrls->slow_keys_delay;
- ev.debounceDelay= ctrls->debounce_delay;
- XkbSendAccessXNotify(keybd,&ev);
- if (XkbAX_NeedFeedback(ctrls,XkbAX_SKPressFBMask))
- XkbDDXAccessXBeep(keybd,_BEEP_SLOW_PRESS,XkbSlowKeysMask);
- xkbi->slowKey= key;
- xkbi->slowKeysTimer = TimerSet(xkbi->slowKeysTimer,
- 0, ctrls->slow_keys_delay,
- AccessXSlowKeyExpire, (pointer)keybd);
- ignoreKeyEvent = TRUE;
+ xkbAccessXNotify ev;
+
+ /* If key was already pressed, ignore subsequent press events
+ * from the server's autorepeat
+ */
+ if (xkbi->slowKey == key)
+ return TRUE;
+ ev.detail = XkbAXN_SKPress;
+ ev.keycode = key;
+ ev.slowKeysDelay = ctrls->slow_keys_delay;
+ ev.debounceDelay = ctrls->debounce_delay;
+ XkbSendAccessXNotify(keybd, &ev);
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_SKPressFBMask))
+ XkbDDXAccessXBeep(keybd, _BEEP_SLOW_PRESS, XkbSlowKeysMask);
+ xkbi->slowKey = key;
+ xkbi->slowKeysTimer = TimerSet(xkbi->slowKeysTimer,
+ 0, ctrls->slow_keys_delay,
+ AccessXSlowKeyExpire, (pointer) keybd);
+ ignoreKeyEvent = TRUE;
}
/* Don't transmit the KeyPress if BounceKeys is turned on
* and the user pressed the same key within a given time period
* from the last release.
*/
- else if ((ctrls->enabled_ctrls & XkbBounceKeysMask) &&
- (key == xkbi->inactiveKey)) {
- if (XkbAX_NeedFeedback(ctrls,XkbAX_BKRejectFBMask))
- XkbDDXAccessXBeep(keybd,_BEEP_BOUNCE_REJECT,XkbBounceKeysMask);
- ignoreKeyEvent = TRUE;
+ else if ((ctrls->enabled_ctrls & XkbBounceKeysMask) &&
+ (key == xkbi->inactiveKey)) {
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_BKRejectFBMask))
+ XkbDDXAccessXBeep(keybd, _BEEP_BOUNCE_REJECT, XkbBounceKeysMask);
+ ignoreKeyEvent = TRUE;
}
/* Start repeating if necessary. Stop autorepeating if the user
* presses a non-modifier key that doesn't autorepeat.
*/
if (XkbDDXUsesSoftRepeat(keybd)) {
- if ((keybd->kbdfeed->ctrl.autoRepeat) &&
- ((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))==
- XkbRepeatKeysMask)) {
- if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) {
- if (xkbDebugFlags&0x10)
- DebugF("Starting software autorepeat...\n");
- if (xkbi->repeatKey == key)
- ignoreKeyEvent = TRUE;
- else {
- xkbi->repeatKey = key;
- xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer,
- 0, ctrls->repeat_delay,
- AccessXRepeatKeyExpire, (pointer)keybd);
- }
- }
- }
+ if ((keybd->kbdfeed->ctrl.autoRepeat) &&
+ ((ctrls->enabled_ctrls & (XkbSlowKeysMask | XkbRepeatKeysMask)) ==
+ XkbRepeatKeysMask)) {
+ if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats, key)) {
+ if (xkbDebugFlags & 0x10)
+ DebugF("Starting software autorepeat...\n");
+ if (xkbi->repeatKey == key)
+ ignoreKeyEvent = TRUE;
+ else {
+ xkbi->repeatKey = key;
+ xkbi->repeatKeyTimer = TimerSet(xkbi->repeatKeyTimer,
+ 0, ctrls->repeat_delay,
+ AccessXRepeatKeyExpire,
+ (pointer) keybd);
+ }
+ }
+ }
}
-
+
/* Check for two keys being pressed at the same time. This section
* essentially says the following:
*
- * If StickyKeys is on, and a modifier is currently being held down,
+ * If StickyKeys is on, and a modifier is currently being held down,
* and one of the following is true: the current key is not a modifier
* or the currentKey is a modifier, but not the only modifier being
* held down, turn StickyKeys off if the TwoKeys off ctrl is set.
*/
- if ((ctrls->enabled_ctrls & XkbStickyKeysMask) &&
- (xkbi->state.base_mods!=0) &&
- (XkbAX_NeedOption(ctrls,XkbAX_TwoKeysMask))) {
- xkbControlsNotify cn;
- cn.keycode = key;
- cn.eventType = KeyPress;
- cn.requestMajor = 0;
- cn.requestMinor = 0;
- AccessXStickyKeysTurnOff(keybd,&cn);
+ if ((ctrls->enabled_ctrls & XkbStickyKeysMask) &&
+ (xkbi->state.base_mods != 0) &&
+ (XkbAX_NeedOption(ctrls, XkbAX_TwoKeysMask))) {
+ xkbControlsNotify cn;
+
+ cn.keycode = key;
+ cn.eventType = KeyPress;
+ cn.requestMajor = 0;
+ cn.requestMinor = 0;
+ AccessXStickyKeysTurnOff(keybd, &cn);
}
-
+
if (!ignoreKeyEvent)
- XkbProcessKeyboardEvent(event, keybd);
+ XkbProcessKeyboardEvent(event, keybd);
return ignoreKeyEvent;
-} /* AccessXFilterPressEvent */
+} /* AccessXFilterPressEvent */
/************************************************************************/
/* */
@@ -572,25 +583,25 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
/* */
/************************************************************************/
Bool
-AccessXFilterReleaseEvent( DeviceEvent* event,
- DeviceIntPtr keybd)
+AccessXFilterReleaseEvent(DeviceEvent *event, DeviceIntPtr keybd)
{
-XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
-XkbControlsPtr ctrls = xkbi->desc->ctrls;
-KeyCode key = event->detail.key;
-Bool ignoreKeyEvent = FALSE;
-
+ XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ KeyCode key = event->detail.key;
+ Bool ignoreKeyEvent = FALSE;
+
/* Don't transmit the KeyRelease if BounceKeys is on and
* this is the release of a key that was ignored due to
* BounceKeys.
*/
if (ctrls->enabled_ctrls & XkbBounceKeysMask) {
- if ((key!=xkbi->mouseKey)&&(!BitIsOn(keybd->key->down,key)))
- ignoreKeyEvent = TRUE;
- xkbi->inactiveKey= key;
- xkbi->bounceKeysTimer= TimerSet(xkbi->bounceKeysTimer, 0,
- ctrls->debounce_delay,
- AccessXBounceKeyExpire, (pointer)keybd);
+ if ((key != xkbi->mouseKey) && (!BitIsOn(keybd->key->down, key)))
+ ignoreKeyEvent = TRUE;
+ xkbi->inactiveKey = key;
+ xkbi->bounceKeysTimer = TimerSet(xkbi->bounceKeysTimer, 0,
+ ctrls->debounce_delay,
+ AccessXBounceKeyExpire,
+ (pointer) keybd);
}
/* Don't transmit the KeyRelease if SlowKeys is turned on and
@@ -598,75 +609,79 @@ Bool ignoreKeyEvent = FALSE;
* the key if the down bit was set by CoreProcessKeyboadEvent.
*/
if (ctrls->enabled_ctrls & XkbSlowKeysMask) {
- xkbAccessXNotify ev;
- unsigned beep_type;
- ev.keycode= key;
- ev.slowKeysDelay= ctrls->slow_keys_delay;
- ev.debounceDelay= ctrls->debounce_delay;
- if (BitIsOn(keybd->key->down,key) || (xkbi->mouseKey == key)) {
- ev.detail= XkbAXN_SKRelease;
- beep_type= _BEEP_SLOW_RELEASE;
- }
- else {
- ev.detail= XkbAXN_SKReject;
- beep_type= _BEEP_SLOW_REJECT;
- ignoreKeyEvent = TRUE;
- }
- XkbSendAccessXNotify(keybd,&ev);
- if (XkbAX_NeedFeedback(ctrls,XkbAX_SKRejectFBMask)) {
- XkbDDXAccessXBeep(keybd,beep_type,XkbSlowKeysMask);
- }
- if (xkbi->slowKey==key)
- xkbi->slowKey= 0;
+ xkbAccessXNotify ev;
+ unsigned beep_type;
+
+ ev.keycode = key;
+ ev.slowKeysDelay = ctrls->slow_keys_delay;
+ ev.debounceDelay = ctrls->debounce_delay;
+ if (BitIsOn(keybd->key->down, key) || (xkbi->mouseKey == key)) {
+ ev.detail = XkbAXN_SKRelease;
+ beep_type = _BEEP_SLOW_RELEASE;
+ }
+ else {
+ ev.detail = XkbAXN_SKReject;
+ beep_type = _BEEP_SLOW_REJECT;
+ ignoreKeyEvent = TRUE;
+ }
+ XkbSendAccessXNotify(keybd, &ev);
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_SKRejectFBMask)) {
+ XkbDDXAccessXBeep(keybd, beep_type, XkbSlowKeysMask);
+ }
+ if (xkbi->slowKey == key)
+ xkbi->slowKey = 0;
}
/* Stop Repeating if the user releases the key that is currently
* repeating.
*/
- if (xkbi->repeatKey==key) {
- xkbi->repeatKey= 0;
+ if (xkbi->repeatKey == key) {
+ xkbi->repeatKey = 0;
}
- if ((ctrls->enabled_ctrls&XkbAccessXTimeoutMask)&&(ctrls->ax_timeout>0)) {
- xkbi->lastPtrEventTime= 0;
- xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0,
- ctrls->ax_timeout*1000,
- AccessXTimeoutExpire, (pointer)keybd);
- xkbi->krgTimerActive= _ALL_TIMEOUT_TIMER;
+ if ((ctrls->enabled_ctrls & XkbAccessXTimeoutMask) &&
+ (ctrls->ax_timeout > 0)) {
+ xkbi->lastPtrEventTime = 0;
+ xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0,
+ ctrls->ax_timeout * 1000,
+ AccessXTimeoutExpire, (pointer) keybd);
+ xkbi->krgTimerActive = _ALL_TIMEOUT_TIMER;
}
- else if (xkbi->krgTimerActive!=_OFF_TIMER) {
- xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0, 0, NULL, NULL);
- xkbi->krgTimerActive= _OFF_TIMER;
+ else if (xkbi->krgTimerActive != _OFF_TIMER) {
+ xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0, 0, NULL, NULL);
+ xkbi->krgTimerActive = _OFF_TIMER;
}
-
+
/* Keep track of how many times the Shift key has been pressed.
* If it has been pressed and released 5 times in a row, toggle
* the state of StickyKeys.
*/
- if ((!ignoreKeyEvent)&&(xkbi->shiftKeyCount)) {
- KeySym *pSym= XkbKeySymsPtr(xkbi->desc,key);
- if ((pSym[0]!=XK_Shift_L)&&(pSym[0]!=XK_Shift_R)) {
- xkbi->shiftKeyCount= 0;
- }
- else if (xkbi->shiftKeyCount>=5) {
- xkbControlsNotify cn;
- cn.keycode = key;
- cn.eventType = KeyPress;
- cn.requestMajor = 0;
- cn.requestMinor = 0;
- if (ctrls->enabled_ctrls & XkbStickyKeysMask)
- AccessXStickyKeysTurnOff(keybd,&cn);
- else
- AccessXStickyKeysTurnOn(keybd,&cn);
- xkbi->shiftKeyCount= 0;
- }
+ if ((!ignoreKeyEvent) && (xkbi->shiftKeyCount)) {
+ KeySym *pSym = XkbKeySymsPtr(xkbi->desc, key);
+
+ if ((pSym[0] != XK_Shift_L) && (pSym[0] != XK_Shift_R)) {
+ xkbi->shiftKeyCount = 0;
+ }
+ else if (xkbi->shiftKeyCount >= 5) {
+ xkbControlsNotify cn;
+
+ cn.keycode = key;
+ cn.eventType = KeyPress;
+ cn.requestMajor = 0;
+ cn.requestMinor = 0;
+ if (ctrls->enabled_ctrls & XkbStickyKeysMask)
+ AccessXStickyKeysTurnOff(keybd, &cn);
+ else
+ AccessXStickyKeysTurnOn(keybd, &cn);
+ xkbi->shiftKeyCount = 0;
+ }
}
-
+
if (!ignoreKeyEvent)
- XkbProcessKeyboardEvent(event, keybd);
+ XkbProcessKeyboardEvent(event, keybd);
return ignoreKeyEvent;
-
-} /* AccessXFilterReleaseEvent */
+
+} /* AccessXFilterReleaseEvent */
/************************************************************************/
/* */
@@ -681,90 +696,87 @@ Bool ignoreKeyEvent = FALSE;
extern int xkbDevicePrivateIndex;
extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer);
void
-ProcessPointerEvent( InternalEvent *ev,
- DeviceIntPtr mouse)
+ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse)
{
-DeviceIntPtr dev;
-XkbSrvInfoPtr xkbi = NULL;
-unsigned changed = 0;
-ProcessInputProc backupproc;
-xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
-DeviceEvent *event = &ev->device_event;
+ DeviceIntPtr dev;
+ XkbSrvInfoPtr xkbi = NULL;
+ unsigned changed = 0;
+ ProcessInputProc backupproc;
+ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
+ DeviceEvent *event = &ev->device_event;
dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
- if (dev && dev->key)
- {
- xkbi = dev->key->xkbInfo;
- xkbi->shiftKeyCount = 0;
- xkbi->lastPtrEventTime= event->time;
+ if (dev && dev->key) {
+ xkbi = dev->key->xkbInfo;
+ xkbi->shiftKeyCount = 0;
+ xkbi->lastPtrEventTime = event->time;
}
if (event->type == ET_ButtonPress) {
- changed |= XkbPointerButtonMask;
+ changed |= XkbPointerButtonMask;
}
else if (event->type == ET_ButtonRelease) {
- if (xkbi) {
- xkbi->lockedPtrButtons&= ~(1 << (event->detail.key & 0x7));
+ if (xkbi) {
+ xkbi->lockedPtrButtons &= ~(1 << (event->detail.key & 0x7));
- if (IsMaster(dev))
- {
+ if (IsMaster(dev)) {
DeviceIntPtr source;
int rc;
- rc = dixLookupDevice(&source, event->sourceid, serverClient, DixWriteAccess);
+
+ rc = dixLookupDevice(&source, event->sourceid, serverClient,
+ DixWriteAccess);
if (rc != Success)
- ErrorF("[xkb] bad sourceid '%d' on button release event.\n", event->sourceid);
+ ErrorF("[xkb] bad sourceid '%d' on button release event.\n",
+ event->sourceid);
else if (!IsXTestDevice(source, GetMaster(dev, MASTER_POINTER)))
XkbFakeDeviceButton(dev, FALSE, event->detail.key);
}
- }
+ }
- changed |= XkbPointerButtonMask;
+ changed |= XkbPointerButtonMask;
}
UNWRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr, backupproc);
mouse->public.processInputProc(ev, mouse);
- COND_WRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr,
- backupproc, xkbUnwrapProc);
+ COND_WRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr, backupproc, xkbUnwrapProc);
if (!xkbi)
- return;
+ return;
xkbi->state.ptr_buttons = (mouse->button) ? mouse->button->state : 0;
-
- /* clear any latched modifiers */
- if ( xkbi->state.latched_mods && (event->type == ET_ButtonRelease) ) {
- unsigned changed_leds;
- XkbStateRec oldState;
- XkbSrvLedInfoPtr sli;
-
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
- oldState= xkbi->state;
- XkbLatchModifiers(dev,0xFF,0x00);
-
- XkbComputeDerivedState(xkbi);
- changed |= XkbStateChangedFlags(&oldState,&xkbi->state);
- if (changed&sli->usedComponents) {
- changed_leds= XkbIndicatorsToUpdate(dev,changed,FALSE);
- if (changed_leds) {
- XkbEventCauseRec cause;
- XkbSetCauseKey(&cause,(event->detail.key & 0x7), event->type);
- XkbUpdateIndicators(dev,changed_leds,TRUE,NULL,&cause);
- }
- }
- }
- if (((xkbi->flags&_XkbStateNotifyInProgress)==0)&&(changed!=0)) {
- xkbStateNotify sn;
- sn.keycode= event->detail.key;
- sn.eventType= event->type;
- sn.requestMajor = sn.requestMinor = 0;
- sn.changed= changed;
- XkbSendStateNotify(dev,&sn);
+ /* clear any latched modifiers */
+ if (xkbi->state.latched_mods && (event->type == ET_ButtonRelease)) {
+ unsigned changed_leds;
+ XkbStateRec oldState;
+ XkbSrvLedInfoPtr sli;
+
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId, 0);
+ oldState = xkbi->state;
+ XkbLatchModifiers(dev, 0xFF, 0x00);
+
+ XkbComputeDerivedState(xkbi);
+ changed |= XkbStateChangedFlags(&oldState, &xkbi->state);
+ if (changed & sli->usedComponents) {
+ changed_leds = XkbIndicatorsToUpdate(dev, changed, FALSE);
+ if (changed_leds) {
+ XkbEventCauseRec cause;
+
+ XkbSetCauseKey(&cause, (event->detail.key & 0x7), event->type);
+ XkbUpdateIndicators(dev, changed_leds, TRUE, NULL, &cause);
+ }
+ }
}
-} /* ProcessPointerEvent */
-
-
+ if (((xkbi->flags & _XkbStateNotifyInProgress) == 0) && (changed != 0)) {
+ xkbStateNotify sn;
+ sn.keycode = event->detail.key;
+ sn.eventType = event->type;
+ sn.requestMajor = sn.requestMinor = 0;
+ sn.changed = changed;
+ XkbSendStateNotify(dev, &sn);
+ }
+} /* ProcessPointerEvent */
diff --git a/xorg-server/xkb/xkbActions.c b/xorg-server/xkb/xkbActions.c
index 8f3c3dd2b..323886274 100644
--- a/xorg-server/xkb/xkbActions.c
+++ b/xorg-server/xkb/xkbActions.c
@@ -47,122 +47,129 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
DevPrivateKeyRec xkbDevicePrivateKeyRec;
-void XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button);
-static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y);
+void XkbFakeDeviceButton(DeviceIntPtr dev, Bool press, int button);
+static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags, int x,
+ int y);
void
-xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
- pointer data)
+xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data)
{
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device);
ProcessInputProc backupproc;
- if(xkbPrivPtr->unwrapProc)
- xkbPrivPtr->unwrapProc = NULL;
- UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, backupproc);
- proc(device,data);
- COND_WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr,
- backupproc,xkbUnwrapProc);
+ if (xkbPrivPtr->unwrapProc)
+ xkbPrivPtr->unwrapProc = NULL;
+
+ UNWRAP_PROCESS_INPUT_PROC(device, xkbPrivPtr, backupproc);
+ proc(device, data);
+ COND_WRAP_PROCESS_INPUT_PROC(device, xkbPrivPtr, backupproc, xkbUnwrapProc);
}
Bool
XkbInitPrivates(void)
{
- return dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE, sizeof(xkbDeviceInfoRec));
+ return dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE,
+ sizeof(xkbDeviceInfoRec));
}
void
XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
{
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device);
+
WRAP_PROCESS_INPUT_PROC(device, xkbPrivPtr, proc, xkbUnwrapProc);
}
/***====================================================================***/
static XkbAction
-_FixUpAction(XkbDescPtr xkb,XkbAction *act)
+_FixUpAction(XkbDescPtr xkb, XkbAction *act)
{
-static XkbAction fake;
+ static XkbAction fake;
- if (XkbIsPtrAction(act)&&(!(xkb->ctrls->enabled_ctrls&XkbMouseKeysMask))) {
- fake.type = XkbSA_NoAction;
- return fake;
+ if (XkbIsPtrAction(act) &&
+ (!(xkb->ctrls->enabled_ctrls & XkbMouseKeysMask))) {
+ fake.type = XkbSA_NoAction;
+ return fake;
}
- if (xkb->ctrls->enabled_ctrls&XkbStickyKeysMask) {
- if (act->any.type==XkbSA_SetMods) {
- fake.mods.type = XkbSA_LatchMods;
- fake.mods.mask = act->mods.mask;
- if (XkbAX_NeedOption(xkb->ctrls,XkbAX_LatchToLockMask))
- fake.mods.flags= XkbSA_ClearLocks|XkbSA_LatchToLock;
- else fake.mods.flags= XkbSA_ClearLocks;
- return fake;
- }
- if (act->any.type==XkbSA_SetGroup) {
- fake.group.type = XkbSA_LatchGroup;
- if (XkbAX_NeedOption(xkb->ctrls,XkbAX_LatchToLockMask))
- fake.group.flags= XkbSA_ClearLocks|XkbSA_LatchToLock;
- else fake.group.flags= XkbSA_ClearLocks;
- XkbSASetGroup(&fake.group,XkbSAGroup(&act->group));
- return fake;
- }
+ if (xkb->ctrls->enabled_ctrls & XkbStickyKeysMask) {
+ if (act->any.type == XkbSA_SetMods) {
+ fake.mods.type = XkbSA_LatchMods;
+ fake.mods.mask = act->mods.mask;
+ if (XkbAX_NeedOption(xkb->ctrls, XkbAX_LatchToLockMask))
+ fake.mods.flags = XkbSA_ClearLocks | XkbSA_LatchToLock;
+ else
+ fake.mods.flags = XkbSA_ClearLocks;
+ return fake;
+ }
+ if (act->any.type == XkbSA_SetGroup) {
+ fake.group.type = XkbSA_LatchGroup;
+ if (XkbAX_NeedOption(xkb->ctrls, XkbAX_LatchToLockMask))
+ fake.group.flags = XkbSA_ClearLocks | XkbSA_LatchToLock;
+ else
+ fake.group.flags = XkbSA_ClearLocks;
+ XkbSASetGroup(&fake.group, XkbSAGroup(&act->group));
+ return fake;
+ }
}
return *act;
}
static XkbAction
-XkbGetKeyAction(XkbSrvInfoPtr xkbi,XkbStatePtr xkbState,CARD8 key)
+XkbGetKeyAction(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 key)
{
-int effectiveGroup;
-int col;
-XkbDescPtr xkb;
-XkbKeyTypePtr type;
-XkbAction * pActs;
-static XkbAction fake;
-
- xkb= xkbi->desc;
- if (!XkbKeyHasActions(xkb,key) || !XkbKeycodeInRange(xkb,key)) {
- fake.type = XkbSA_NoAction;
- return fake;
+ int effectiveGroup;
+ int col;
+ XkbDescPtr xkb;
+ XkbKeyTypePtr type;
+ XkbAction *pActs;
+ static XkbAction fake;
+
+ xkb = xkbi->desc;
+ if (!XkbKeyHasActions(xkb, key) || !XkbKeycodeInRange(xkb, key)) {
+ fake.type = XkbSA_NoAction;
+ return fake;
}
- pActs= XkbKeyActionsPtr(xkb,key);
- col= 0;
+ pActs = XkbKeyActionsPtr(xkb, key);
+ col = 0;
effectiveGroup = XkbGetEffectiveGroup(xkbi, xkbState, key);
if (effectiveGroup != XkbGroup1Index)
col += (effectiveGroup * XkbKeyGroupsWidth(xkb, key));
- type= XkbKeyKeyType(xkb,key,effectiveGroup);
- if (type->map!=NULL) {
- register unsigned i,mods;
- register XkbKTMapEntryPtr entry;
- mods= xkbState->mods&type->mods.mask;
- for (entry= type->map,i=0;i<type->map_count;i++,entry++) {
- if ((entry->active)&&(entry->mods.mask==mods)) {
- col+= entry->level;
- break;
- }
- }
+ type = XkbKeyKeyType(xkb, key, effectiveGroup);
+ if (type->map != NULL) {
+ register unsigned i, mods;
+ register XkbKTMapEntryPtr entry;
+
+ mods = xkbState->mods & type->mods.mask;
+ for (entry = type->map, i = 0; i < type->map_count; i++, entry++) {
+ if ((entry->active) && (entry->mods.mask == mods)) {
+ col += entry->level;
+ break;
+ }
+ }
}
- if (pActs[col].any.type==XkbSA_NoAction)
- return pActs[col];
- fake= _FixUpAction(xkb,&pActs[col]);
+ if (pActs[col].any.type == XkbSA_NoAction)
+ return pActs[col];
+ fake = _FixUpAction(xkb, &pActs[col]);
return fake;
}
static XkbAction
-XkbGetButtonAction(DeviceIntPtr kbd,DeviceIntPtr dev,int button)
+XkbGetButtonAction(DeviceIntPtr kbd, DeviceIntPtr dev, int button)
{
-XkbAction fake;
- if ((dev->button)&&(dev->button->xkb_acts)) {
- if (dev->button->xkb_acts[button-1].any.type!=XkbSA_NoAction) {
- fake= _FixUpAction(kbd->key->xkbInfo->desc,
- &dev->button->xkb_acts[button-1]);
- return fake;
- }
- }
- fake.any.type= XkbSA_NoAction;
- return fake;
+ XkbAction fake;
+
+ if ((dev->button) && (dev->button->xkb_acts)) {
+ if (dev->button->xkb_acts[button - 1].any.type != XkbSA_NoAction) {
+ fake = _FixUpAction(kbd->key->xkbInfo->desc,
+ &dev->button->xkb_acts[button - 1]);
+ return fake;
+ }
+ }
+ fake.any.type = XkbSA_NoAction;
+ return fake;
}
/***====================================================================***/
@@ -171,47 +178,45 @@ XkbAction fake;
#define BTN_ACT_FLAG 0x100
static int
-_XkbFilterSetState( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction *pAction)
+_XkbFilterSetState(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
{
- if (filter->keycode==0) { /* initial press */
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = ((pAction->mods.mask&XkbSA_ClearLocks)!=0);
- filter->priv = 0;
- filter->filter = _XkbFilterSetState;
- if (pAction->type==XkbSA_SetMods) {
- filter->upAction = *pAction;
- xkbi->setMods= pAction->mods.mask;
- }
- else {
- xkbi->groupChange = XkbSAGroup(&pAction->group);
- if (pAction->group.flags&XkbSA_GroupAbsolute)
- xkbi->groupChange-= xkbi->state.base_group;
- filter->upAction= *pAction;
- XkbSASetGroup(&filter->upAction.group,xkbi->groupChange);
- }
+ if (filter->keycode == 0) { /* initial press */
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = ((pAction->mods.mask & XkbSA_ClearLocks) != 0);
+ filter->priv = 0;
+ filter->filter = _XkbFilterSetState;
+ if (pAction->type == XkbSA_SetMods) {
+ filter->upAction = *pAction;
+ xkbi->setMods = pAction->mods.mask;
+ }
+ else {
+ xkbi->groupChange = XkbSAGroup(&pAction->group);
+ if (pAction->group.flags & XkbSA_GroupAbsolute)
+ xkbi->groupChange -= xkbi->state.base_group;
+ filter->upAction = *pAction;
+ XkbSASetGroup(&filter->upAction.group, xkbi->groupChange);
+ }
}
- else if (filter->keycode==keycode) {
- if (filter->upAction.type==XkbSA_SetMods) {
- xkbi->clearMods = filter->upAction.mods.mask;
- if (filter->upAction.mods.flags&XkbSA_ClearLocks) {
- xkbi->state.locked_mods&= ~filter->upAction.mods.mask;
- }
- }
- else {
- if (filter->upAction.group.flags&XkbSA_ClearLocks) {
- xkbi->state.locked_group = 0;
- }
- xkbi->groupChange = -XkbSAGroup(&filter->upAction.group);
- }
- filter->active = 0;
+ else if (filter->keycode == keycode) {
+ if (filter->upAction.type == XkbSA_SetMods) {
+ xkbi->clearMods = filter->upAction.mods.mask;
+ if (filter->upAction.mods.flags & XkbSA_ClearLocks) {
+ xkbi->state.locked_mods &= ~filter->upAction.mods.mask;
+ }
+ }
+ else {
+ if (filter->upAction.group.flags & XkbSA_ClearLocks) {
+ xkbi->state.locked_group = 0;
+ }
+ xkbi->groupChange = -XkbSAGroup(&filter->upAction.group);
+ }
+ filter->active = 0;
}
else {
- filter->upAction.mods.flags&= ~XkbSA_ClearLocks;
- filter->filterOthers = 0;
+ filter->upAction.mods.flags &= ~XkbSA_ClearLocks;
+ filter->filterOthers = 0;
}
return 1;
}
@@ -221,141 +226,147 @@ _XkbFilterSetState( XkbSrvInfoPtr xkbi,
#define NO_LATCH 3
static int
-_XkbFilterLatchState( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterLatchState(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
{
- if (filter->keycode==0) { /* initial press */
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 1;
- filter->priv = LATCH_KEY_DOWN;
- filter->filter = _XkbFilterLatchState;
- if (pAction->type==XkbSA_LatchMods) {
- filter->upAction = *pAction;
- xkbi->setMods = pAction->mods.mask;
- }
- else {
- xkbi->groupChange = XkbSAGroup(&pAction->group);
- if (pAction->group.flags&XkbSA_GroupAbsolute)
- xkbi->groupChange-= xkbi->state.base_group;
- filter->upAction= *pAction;
- XkbSASetGroup(&filter->upAction.group,xkbi->groupChange);
- }
+ if (filter->keycode == 0) { /* initial press */
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 1;
+ filter->priv = LATCH_KEY_DOWN;
+ filter->filter = _XkbFilterLatchState;
+ if (pAction->type == XkbSA_LatchMods) {
+ filter->upAction = *pAction;
+ xkbi->setMods = pAction->mods.mask;
+ }
+ else {
+ xkbi->groupChange = XkbSAGroup(&pAction->group);
+ if (pAction->group.flags & XkbSA_GroupAbsolute)
+ xkbi->groupChange -= xkbi->state.base_group;
+ filter->upAction = *pAction;
+ XkbSASetGroup(&filter->upAction.group, xkbi->groupChange);
+ }
}
- else if ( pAction && (filter->priv==LATCH_PENDING) ) {
- if (((1<<pAction->type)&XkbSA_BreakLatch)!=0) {
- filter->active = 0;
- if (filter->upAction.type==XkbSA_LatchMods)
- xkbi->state.latched_mods&= ~filter->upAction.mods.mask;
- else xkbi->state.latched_group-=XkbSAGroup(&filter->upAction.group);
- }
- else if ((pAction->type==filter->upAction.type)&&
- (pAction->mods.flags==filter->upAction.mods.flags)&&
- (pAction->mods.mask==filter->upAction.mods.mask)) {
- if (filter->upAction.mods.flags&XkbSA_LatchToLock) {
- XkbControlsPtr ctrls= xkbi->desc->ctrls;
- if (filter->upAction.type==XkbSA_LatchMods)
- pAction->mods.type= XkbSA_LockMods;
- else pAction->group.type= XkbSA_LockGroup;
- if (XkbAX_NeedFeedback(ctrls,XkbAX_StickyKeysFBMask)&&
- (ctrls->enabled_ctrls&XkbStickyKeysMask)) {
- XkbDDXAccessXBeep(xkbi->device,_BEEP_STICKY_LOCK,
- XkbStickyKeysMask);
- }
- }
- else {
- if (filter->upAction.type==XkbSA_LatchMods)
- pAction->mods.type= XkbSA_SetMods;
- else pAction->group.type= XkbSA_SetGroup;
- }
- if (filter->upAction.type==XkbSA_LatchMods)
- xkbi->state.latched_mods&= ~filter->upAction.mods.mask;
- else xkbi->state.latched_group-=XkbSAGroup(&filter->upAction.group);
- filter->active = 0;
- }
+ else if (pAction && (filter->priv == LATCH_PENDING)) {
+ if (((1 << pAction->type) & XkbSA_BreakLatch) != 0) {
+ filter->active = 0;
+ if (filter->upAction.type == XkbSA_LatchMods)
+ xkbi->state.latched_mods &= ~filter->upAction.mods.mask;
+ else
+ xkbi->state.latched_group -=
+ XkbSAGroup(&filter->upAction.group);
+ }
+ else if ((pAction->type == filter->upAction.type) &&
+ (pAction->mods.flags == filter->upAction.mods.flags) &&
+ (pAction->mods.mask == filter->upAction.mods.mask)) {
+ if (filter->upAction.mods.flags & XkbSA_LatchToLock) {
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+
+ if (filter->upAction.type == XkbSA_LatchMods)
+ pAction->mods.type = XkbSA_LockMods;
+ else
+ pAction->group.type = XkbSA_LockGroup;
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_StickyKeysFBMask) &&
+ (ctrls->enabled_ctrls & XkbStickyKeysMask)) {
+ XkbDDXAccessXBeep(xkbi->device, _BEEP_STICKY_LOCK,
+ XkbStickyKeysMask);
+ }
+ }
+ else {
+ if (filter->upAction.type == XkbSA_LatchMods)
+ pAction->mods.type = XkbSA_SetMods;
+ else
+ pAction->group.type = XkbSA_SetGroup;
+ }
+ if (filter->upAction.type == XkbSA_LatchMods)
+ xkbi->state.latched_mods &= ~filter->upAction.mods.mask;
+ else
+ xkbi->state.latched_group -=
+ XkbSAGroup(&filter->upAction.group);
+ filter->active = 0;
+ }
}
- else if (filter->keycode==keycode) { /* release */
- XkbControlsPtr ctrls= xkbi->desc->ctrls;
- int needBeep;
- int beepType= _BEEP_NONE;
-
- needBeep= ((ctrls->enabled_ctrls&XkbStickyKeysMask)&&
- XkbAX_NeedFeedback(ctrls,XkbAX_StickyKeysFBMask));
- if (filter->upAction.type==XkbSA_LatchMods) {
- xkbi->clearMods = filter->upAction.mods.mask;
- if ((filter->upAction.mods.flags&XkbSA_ClearLocks)&&
- (xkbi->clearMods&xkbi->state.locked_mods)==xkbi->clearMods) {
- xkbi->state.locked_mods&= ~xkbi->clearMods;
- filter->priv= NO_LATCH;
- beepType= _BEEP_STICKY_UNLOCK;
- }
- }
- else {
- xkbi->groupChange = -XkbSAGroup(&filter->upAction.group);
- if ((filter->upAction.group.flags&XkbSA_ClearLocks)&&
- (xkbi->state.locked_group)) {
- xkbi->state.locked_group = 0;
- filter->priv = NO_LATCH;
- beepType= _BEEP_STICKY_UNLOCK;
- }
- }
- if (filter->priv==NO_LATCH) {
- filter->active= 0;
- }
- else {
- filter->priv= LATCH_PENDING;
- if (filter->upAction.type==XkbSA_LatchMods) {
- xkbi->state.latched_mods |= filter->upAction.mods.mask;
- needBeep = xkbi->state.latched_mods ? needBeep : 0;
- xkbi->state.latched_mods |= filter->upAction.mods.mask;
- }
- else {
- xkbi->state.latched_group+= XkbSAGroup(&filter->upAction.group);
- }
- if (needBeep && (beepType==_BEEP_NONE))
- beepType= _BEEP_STICKY_LATCH;
- }
- if (needBeep && (beepType!=_BEEP_NONE))
- XkbDDXAccessXBeep(xkbi->device,beepType,XkbStickyKeysMask);
+ else if (filter->keycode == keycode) { /* release */
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ int needBeep;
+ int beepType = _BEEP_NONE;
+
+ needBeep = ((ctrls->enabled_ctrls & XkbStickyKeysMask) &&
+ XkbAX_NeedFeedback(ctrls, XkbAX_StickyKeysFBMask));
+ if (filter->upAction.type == XkbSA_LatchMods) {
+ xkbi->clearMods = filter->upAction.mods.mask;
+ if ((filter->upAction.mods.flags & XkbSA_ClearLocks) &&
+ (xkbi->clearMods & xkbi->state.locked_mods) ==
+ xkbi->clearMods) {
+ xkbi->state.locked_mods &= ~xkbi->clearMods;
+ filter->priv = NO_LATCH;
+ beepType = _BEEP_STICKY_UNLOCK;
+ }
+ }
+ else {
+ xkbi->groupChange = -XkbSAGroup(&filter->upAction.group);
+ if ((filter->upAction.group.flags & XkbSA_ClearLocks) &&
+ (xkbi->state.locked_group)) {
+ xkbi->state.locked_group = 0;
+ filter->priv = NO_LATCH;
+ beepType = _BEEP_STICKY_UNLOCK;
+ }
+ }
+ if (filter->priv == NO_LATCH) {
+ filter->active = 0;
+ }
+ else {
+ filter->priv = LATCH_PENDING;
+ if (filter->upAction.type == XkbSA_LatchMods) {
+ xkbi->state.latched_mods |= filter->upAction.mods.mask;
+ needBeep = xkbi->state.latched_mods ? needBeep : 0;
+ xkbi->state.latched_mods |= filter->upAction.mods.mask;
+ }
+ else {
+ xkbi->state.latched_group +=
+ XkbSAGroup(&filter->upAction.group);
+ }
+ if (needBeep && (beepType == _BEEP_NONE))
+ beepType = _BEEP_STICKY_LATCH;
+ }
+ if (needBeep && (beepType != _BEEP_NONE))
+ XkbDDXAccessXBeep(xkbi->device, beepType, XkbStickyKeysMask);
}
- else if (filter->priv==LATCH_KEY_DOWN) {
- filter->priv= NO_LATCH;
- filter->filterOthers = 0;
+ else if (filter->priv == LATCH_KEY_DOWN) {
+ filter->priv = NO_LATCH;
+ filter->filterOthers = 0;
}
return 1;
}
static int
-_XkbFilterLockState( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterLockState(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
{
- if (pAction&&(pAction->type==XkbSA_LockGroup)) {
- if (pAction->group.flags&XkbSA_GroupAbsolute)
- xkbi->state.locked_group= XkbSAGroup(&pAction->group);
- else xkbi->state.locked_group+= XkbSAGroup(&pAction->group);
- return 1;
+ if (pAction && (pAction->type == XkbSA_LockGroup)) {
+ if (pAction->group.flags & XkbSA_GroupAbsolute)
+ xkbi->state.locked_group = XkbSAGroup(&pAction->group);
+ else
+ xkbi->state.locked_group += XkbSAGroup(&pAction->group);
+ return 1;
}
- if (filter->keycode==0) { /* initial press */
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 0;
- filter->priv = xkbi->state.locked_mods&pAction->mods.mask;
- filter->filter = _XkbFilterLockState;
- filter->upAction = *pAction;
- if (!(filter->upAction.mods.flags&XkbSA_LockNoLock))
- xkbi->state.locked_mods|= pAction->mods.mask;
- xkbi->setMods = pAction->mods.mask;
+ if (filter->keycode == 0) { /* initial press */
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->priv = xkbi->state.locked_mods & pAction->mods.mask;
+ filter->filter = _XkbFilterLockState;
+ filter->upAction = *pAction;
+ if (!(filter->upAction.mods.flags & XkbSA_LockNoLock))
+ xkbi->state.locked_mods |= pAction->mods.mask;
+ xkbi->setMods = pAction->mods.mask;
}
- else if (filter->keycode==keycode) {
- filter->active = 0;
- xkbi->clearMods = filter->upAction.mods.mask;
- if (!(filter->upAction.mods.flags&XkbSA_LockNoUnlock))
- xkbi->state.locked_mods&= ~filter->priv;
+ else if (filter->keycode == keycode) {
+ filter->active = 0;
+ xkbi->clearMods = filter->upAction.mods.mask;
+ if (!(filter->upAction.mods.flags & XkbSA_LockNoUnlock))
+ xkbi->state.locked_mods &= ~filter->priv;
}
return 1;
}
@@ -364,922 +375,944 @@ _XkbFilterLockState( XkbSrvInfoPtr xkbi,
#define NO_ISO_LOCK 1
static int
-_XkbFilterISOLock( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterISOLock(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
{
- if (filter->keycode==0) { /* initial press */
- CARD8 flags= pAction->iso.flags;
-
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 1;
- filter->priv = ISO_KEY_DOWN;
- filter->upAction = *pAction;
- filter->filter = _XkbFilterISOLock;
- if (flags&XkbSA_ISODfltIsGroup) {
- xkbi->groupChange = XkbSAGroup(&pAction->iso);
- xkbi->setMods = 0;
- }
- else {
- xkbi->setMods = pAction->iso.mask;
- xkbi->groupChange = 0;
- }
- if ((!(flags&XkbSA_ISONoAffectMods))&&(xkbi->state.base_mods)) {
- filter->priv= NO_ISO_LOCK;
- xkbi->state.locked_mods^= xkbi->state.base_mods;
- }
- if ((!(flags&XkbSA_ISONoAffectGroup))&&(xkbi->state.base_group)) {
+ if (filter->keycode == 0) { /* initial press */
+ CARD8 flags = pAction->iso.flags;
+
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 1;
+ filter->priv = ISO_KEY_DOWN;
+ filter->upAction = *pAction;
+ filter->filter = _XkbFilterISOLock;
+ if (flags & XkbSA_ISODfltIsGroup) {
+ xkbi->groupChange = XkbSAGroup(&pAction->iso);
+ xkbi->setMods = 0;
+ }
+ else {
+ xkbi->setMods = pAction->iso.mask;
+ xkbi->groupChange = 0;
+ }
+ if ((!(flags & XkbSA_ISONoAffectMods)) && (xkbi->state.base_mods)) {
+ filter->priv = NO_ISO_LOCK;
+ xkbi->state.locked_mods ^= xkbi->state.base_mods;
+ }
+ if ((!(flags & XkbSA_ISONoAffectGroup)) && (xkbi->state.base_group)) {
/* 6/22/93 (ef) -- lock groups if group key is down first */
- }
- if (!(flags&XkbSA_ISONoAffectPtr)) {
+ }
+ if (!(flags & XkbSA_ISONoAffectPtr)) {
/* 6/22/93 (ef) -- lock mouse buttons if they're down */
- }
+ }
}
- else if (filter->keycode==keycode) {
- CARD8 flags= filter->upAction.iso.flags;
-
- if (flags&XkbSA_ISODfltIsGroup) {
- xkbi->groupChange = -XkbSAGroup(&filter->upAction.iso);
- xkbi->clearMods = 0;
- if (filter->priv==ISO_KEY_DOWN)
- xkbi->state.locked_group+= XkbSAGroup(&filter->upAction.iso);
- }
- else {
- xkbi->clearMods= filter->upAction.iso.mask;
- xkbi->groupChange= 0;
- if (filter->priv==ISO_KEY_DOWN)
- xkbi->state.locked_mods^= filter->upAction.iso.mask;
- }
- filter->active = 0;
+ else if (filter->keycode == keycode) {
+ CARD8 flags = filter->upAction.iso.flags;
+
+ if (flags & XkbSA_ISODfltIsGroup) {
+ xkbi->groupChange = -XkbSAGroup(&filter->upAction.iso);
+ xkbi->clearMods = 0;
+ if (filter->priv == ISO_KEY_DOWN)
+ xkbi->state.locked_group += XkbSAGroup(&filter->upAction.iso);
+ }
+ else {
+ xkbi->clearMods = filter->upAction.iso.mask;
+ xkbi->groupChange = 0;
+ if (filter->priv == ISO_KEY_DOWN)
+ xkbi->state.locked_mods ^= filter->upAction.iso.mask;
+ }
+ filter->active = 0;
}
else if (pAction) {
- CARD8 flags= filter->upAction.iso.flags;
-
- switch (pAction->type) {
- case XkbSA_SetMods: case XkbSA_LatchMods:
- if (!(flags&XkbSA_ISONoAffectMods)) {
- pAction->type= XkbSA_LockMods;
- filter->priv= NO_ISO_LOCK;
- }
- break;
- case XkbSA_SetGroup: case XkbSA_LatchGroup:
- if (!(flags&XkbSA_ISONoAffectGroup)) {
- pAction->type= XkbSA_LockGroup;
- filter->priv= NO_ISO_LOCK;
- }
- break;
- case XkbSA_PtrBtn:
- if (!(flags&XkbSA_ISONoAffectPtr)) {
- pAction->type= XkbSA_LockPtrBtn;
- filter->priv= NO_ISO_LOCK;
- }
- break;
- case XkbSA_SetControls:
- if (!(flags&XkbSA_ISONoAffectCtrls)) {
- pAction->type= XkbSA_LockControls;
- filter->priv= NO_ISO_LOCK;
- }
- break;
- }
+ CARD8 flags = filter->upAction.iso.flags;
+
+ switch (pAction->type) {
+ case XkbSA_SetMods:
+ case XkbSA_LatchMods:
+ if (!(flags & XkbSA_ISONoAffectMods)) {
+ pAction->type = XkbSA_LockMods;
+ filter->priv = NO_ISO_LOCK;
+ }
+ break;
+ case XkbSA_SetGroup:
+ case XkbSA_LatchGroup:
+ if (!(flags & XkbSA_ISONoAffectGroup)) {
+ pAction->type = XkbSA_LockGroup;
+ filter->priv = NO_ISO_LOCK;
+ }
+ break;
+ case XkbSA_PtrBtn:
+ if (!(flags & XkbSA_ISONoAffectPtr)) {
+ pAction->type = XkbSA_LockPtrBtn;
+ filter->priv = NO_ISO_LOCK;
+ }
+ break;
+ case XkbSA_SetControls:
+ if (!(flags & XkbSA_ISONoAffectCtrls)) {
+ pAction->type = XkbSA_LockControls;
+ filter->priv = NO_ISO_LOCK;
+ }
+ break;
+ }
}
return 1;
}
-
static CARD32
-_XkbPtrAccelExpire(OsTimerPtr timer,CARD32 now,pointer arg)
+_XkbPtrAccelExpire(OsTimerPtr timer, CARD32 now, pointer arg)
{
-XkbSrvInfoPtr xkbi= (XkbSrvInfoPtr)arg;
-XkbControlsPtr ctrls= xkbi->desc->ctrls;
-int dx,dy;
+ XkbSrvInfoPtr xkbi = (XkbSrvInfoPtr) arg;
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ int dx, dy;
- if (xkbi->mouseKey==0)
- return 0;
+ if (xkbi->mouseKey == 0)
+ return 0;
if (xkbi->mouseKeysAccel) {
- if ((xkbi->mouseKeysCounter)<ctrls->mk_time_to_max) {
- double step;
- xkbi->mouseKeysCounter++;
- step= xkbi->mouseKeysCurveFactor*
- pow((double)xkbi->mouseKeysCounter,xkbi->mouseKeysCurve);
- if (xkbi->mouseKeysDX<0)
- dx= floor( ((double)xkbi->mouseKeysDX)*step );
- else dx= ceil( ((double)xkbi->mouseKeysDX)*step );
- if (xkbi->mouseKeysDY<0)
- dy= floor( ((double)xkbi->mouseKeysDY)*step );
- else dy= ceil( ((double)xkbi->mouseKeysDY)*step );
- }
- else {
- dx= xkbi->mouseKeysDX*ctrls->mk_max_speed;
- dy= xkbi->mouseKeysDY*ctrls->mk_max_speed;
- }
- if (xkbi->mouseKeysFlags&XkbSA_MoveAbsoluteX)
- dx= xkbi->mouseKeysDX;
- if (xkbi->mouseKeysFlags&XkbSA_MoveAbsoluteY)
- dy= xkbi->mouseKeysDY;
+ if ((xkbi->mouseKeysCounter) < ctrls->mk_time_to_max) {
+ double step;
+
+ xkbi->mouseKeysCounter++;
+ step = xkbi->mouseKeysCurveFactor *
+ pow((double) xkbi->mouseKeysCounter, xkbi->mouseKeysCurve);
+ if (xkbi->mouseKeysDX < 0)
+ dx = floor(((double) xkbi->mouseKeysDX) * step);
+ else
+ dx = ceil(((double) xkbi->mouseKeysDX) * step);
+ if (xkbi->mouseKeysDY < 0)
+ dy = floor(((double) xkbi->mouseKeysDY) * step);
+ else
+ dy = ceil(((double) xkbi->mouseKeysDY) * step);
+ }
+ else {
+ dx = xkbi->mouseKeysDX * ctrls->mk_max_speed;
+ dy = xkbi->mouseKeysDY * ctrls->mk_max_speed;
+ }
+ if (xkbi->mouseKeysFlags & XkbSA_MoveAbsoluteX)
+ dx = xkbi->mouseKeysDX;
+ if (xkbi->mouseKeysFlags & XkbSA_MoveAbsoluteY)
+ dy = xkbi->mouseKeysDY;
}
else {
- dx= xkbi->mouseKeysDX;
- dy= xkbi->mouseKeysDY;
+ dx = xkbi->mouseKeysDX;
+ dy = xkbi->mouseKeysDY;
}
- XkbFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags,dx,dy);
+ XkbFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags, dx, dy);
return xkbi->desc->ctrls->mk_interval;
}
static int
-_XkbFilterPointerMove( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterPointerMove(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
{
-int x,y;
-Bool accel;
-
- if (filter->keycode==0) { /* initial press */
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 0;
- filter->priv=0;
- filter->filter = _XkbFilterPointerMove;
- filter->upAction= *pAction;
- xkbi->mouseKeysCounter= 0;
- xkbi->mouseKey= keycode;
- accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0);
- x= XkbPtrActionX(&pAction->ptr);
- y= XkbPtrActionY(&pAction->ptr);
- XkbFakePointerMotion(xkbi->device, pAction->ptr.flags,x,y);
- AccessXCancelRepeatKey(xkbi,keycode);
- xkbi->mouseKeysAccel= accel&&
- (xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask);
- xkbi->mouseKeysFlags= pAction->ptr.flags;
- xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr);
- xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr);
- xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0,
- xkbi->desc->ctrls->mk_delay,
- _XkbPtrAccelExpire,(pointer)xkbi);
+ int x, y;
+ Bool accel;
+
+ if (filter->keycode == 0) { /* initial press */
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->priv = 0;
+ filter->filter = _XkbFilterPointerMove;
+ filter->upAction = *pAction;
+ xkbi->mouseKeysCounter = 0;
+ xkbi->mouseKey = keycode;
+ accel = ((pAction->ptr.flags & XkbSA_NoAcceleration) == 0);
+ x = XkbPtrActionX(&pAction->ptr);
+ y = XkbPtrActionY(&pAction->ptr);
+ XkbFakePointerMotion(xkbi->device, pAction->ptr.flags, x, y);
+ AccessXCancelRepeatKey(xkbi, keycode);
+ xkbi->mouseKeysAccel = accel &&
+ (xkbi->desc->ctrls->enabled_ctrls & XkbMouseKeysAccelMask);
+ xkbi->mouseKeysFlags = pAction->ptr.flags;
+ xkbi->mouseKeysDX = XkbPtrActionX(&pAction->ptr);
+ xkbi->mouseKeysDY = XkbPtrActionY(&pAction->ptr);
+ xkbi->mouseKeyTimer = TimerSet(xkbi->mouseKeyTimer, 0,
+ xkbi->desc->ctrls->mk_delay,
+ _XkbPtrAccelExpire, (pointer) xkbi);
}
- else if (filter->keycode==keycode) {
- filter->active = 0;
- if (xkbi->mouseKey==keycode) {
- xkbi->mouseKey= 0;
- xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0, 0,
- NULL, NULL);
- }
+ else if (filter->keycode == keycode) {
+ filter->active = 0;
+ if (xkbi->mouseKey == keycode) {
+ xkbi->mouseKey = 0;
+ xkbi->mouseKeyTimer = TimerSet(xkbi->mouseKeyTimer, 0, 0,
+ NULL, NULL);
+ }
}
return 0;
}
static int
-_XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterPointerBtn(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
{
- if (filter->keycode==0) { /* initial press */
- int button= pAction->btn.button;
-
- if (button==XkbSA_UseDfltButton)
- button = xkbi->desc->ctrls->mk_dflt_btn;
-
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 0;
- filter->priv=0;
- filter->filter = _XkbFilterPointerBtn;
- filter->upAction= *pAction;
- filter->upAction.btn.button= button;
- switch (pAction->type) {
- case XkbSA_LockPtrBtn:
- if (((xkbi->lockedPtrButtons&(1<<button))==0)&&
- ((pAction->btn.flags&XkbSA_LockNoLock)==0)) {
- xkbi->lockedPtrButtons|= (1<<button);
- AccessXCancelRepeatKey(xkbi,keycode);
- XkbFakeDeviceButton(xkbi->device, 1, button);
- filter->upAction.type= XkbSA_NoAction;
- }
- break;
- case XkbSA_PtrBtn:
- {
- register int i,nClicks;
- AccessXCancelRepeatKey(xkbi,keycode);
- if (pAction->btn.count>0) {
- nClicks= pAction->btn.count;
- for (i=0;i<nClicks;i++) {
- XkbFakeDeviceButton(xkbi->device, 1, button);
- XkbFakeDeviceButton(xkbi->device, 0, button);
- }
- filter->upAction.type= XkbSA_NoAction;
- }
- else XkbFakeDeviceButton(xkbi->device, 1, button);
- }
- break;
- case XkbSA_SetPtrDflt:
- {
- XkbControlsPtr ctrls= xkbi->desc->ctrls;
- XkbControlsRec old;
- xkbControlsNotify cn;
-
- old= *ctrls;
- AccessXCancelRepeatKey(xkbi,keycode);
- switch (pAction->dflt.affect) {
- case XkbSA_AffectDfltBtn:
- if (pAction->dflt.flags&XkbSA_DfltBtnAbsolute)
- ctrls->mk_dflt_btn=
- XkbSAPtrDfltValue(&pAction->dflt);
- else {
- ctrls->mk_dflt_btn+=
- XkbSAPtrDfltValue(&pAction->dflt);
- if (ctrls->mk_dflt_btn>5)
- ctrls->mk_dflt_btn= 5;
- else if (ctrls->mk_dflt_btn<1)
- ctrls->mk_dflt_btn= 1;
- }
- break;
- default:
- ErrorF(
- "Attempt to change unknown pointer default (%d) ignored\n",
- pAction->dflt.affect);
- break;
- }
- if (XkbComputeControlsNotify(xkbi->device,
- &old,xkbi->desc->ctrls,
- &cn,FALSE)) {
- cn.keycode = keycode;
- /* XXX: what about DeviceKeyPress? */
- cn.eventType = KeyPress;
- cn.requestMajor = 0;
- cn.requestMinor = 0;
- XkbSendControlsNotify(xkbi->device,&cn);
- }
- }
- break;
- }
+ if (filter->keycode == 0) { /* initial press */
+ int button = pAction->btn.button;
+
+ if (button == XkbSA_UseDfltButton)
+ button = xkbi->desc->ctrls->mk_dflt_btn;
+
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->priv = 0;
+ filter->filter = _XkbFilterPointerBtn;
+ filter->upAction = *pAction;
+ filter->upAction.btn.button = button;
+ switch (pAction->type) {
+ case XkbSA_LockPtrBtn:
+ if (((xkbi->lockedPtrButtons & (1 << button)) == 0) &&
+ ((pAction->btn.flags & XkbSA_LockNoLock) == 0)) {
+ xkbi->lockedPtrButtons |= (1 << button);
+ AccessXCancelRepeatKey(xkbi, keycode);
+ XkbFakeDeviceButton(xkbi->device, 1, button);
+ filter->upAction.type = XkbSA_NoAction;
+ }
+ break;
+ case XkbSA_PtrBtn:
+ {
+ register int i, nClicks;
+
+ AccessXCancelRepeatKey(xkbi, keycode);
+ if (pAction->btn.count > 0) {
+ nClicks = pAction->btn.count;
+ for (i = 0; i < nClicks; i++) {
+ XkbFakeDeviceButton(xkbi->device, 1, button);
+ XkbFakeDeviceButton(xkbi->device, 0, button);
+ }
+ filter->upAction.type = XkbSA_NoAction;
+ }
+ else
+ XkbFakeDeviceButton(xkbi->device, 1, button);
+ }
+ break;
+ case XkbSA_SetPtrDflt:
+ {
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ XkbControlsRec old;
+ xkbControlsNotify cn;
+
+ old = *ctrls;
+ AccessXCancelRepeatKey(xkbi, keycode);
+ switch (pAction->dflt.affect) {
+ case XkbSA_AffectDfltBtn:
+ if (pAction->dflt.flags & XkbSA_DfltBtnAbsolute)
+ ctrls->mk_dflt_btn = XkbSAPtrDfltValue(&pAction->dflt);
+ else {
+ ctrls->mk_dflt_btn += XkbSAPtrDfltValue(&pAction->dflt);
+ if (ctrls->mk_dflt_btn > 5)
+ ctrls->mk_dflt_btn = 5;
+ else if (ctrls->mk_dflt_btn < 1)
+ ctrls->mk_dflt_btn = 1;
+ }
+ break;
+ default:
+ ErrorF
+ ("Attempt to change unknown pointer default (%d) ignored\n",
+ pAction->dflt.affect);
+ break;
+ }
+ if (XkbComputeControlsNotify(xkbi->device,
+ &old, xkbi->desc->ctrls, &cn, FALSE)) {
+ cn.keycode = keycode;
+ /* XXX: what about DeviceKeyPress? */
+ cn.eventType = KeyPress;
+ cn.requestMajor = 0;
+ cn.requestMinor = 0;
+ XkbSendControlsNotify(xkbi->device, &cn);
+ }
+ }
+ break;
+ }
}
- else if (filter->keycode==keycode) {
- int button= filter->upAction.btn.button;
-
- switch (filter->upAction.type) {
- case XkbSA_LockPtrBtn:
- if (((filter->upAction.btn.flags&XkbSA_LockNoUnlock)!=0)||
- ((xkbi->lockedPtrButtons&(1<<button))==0)) {
- break;
- }
- xkbi->lockedPtrButtons&= ~(1<<button);
-
- if (IsMaster(xkbi->device))
- {
- XkbMergeLockedPtrBtns(xkbi->device);
- /* One SD still has lock set, don't post event */
- if ((xkbi->lockedPtrButtons & (1 << button)) != 0)
- break;
- }
-
- /* fallthrough */
- case XkbSA_PtrBtn:
- XkbFakeDeviceButton(xkbi->device, 0, button);
- break;
- }
- filter->active = 0;
+ else if (filter->keycode == keycode) {
+ int button = filter->upAction.btn.button;
+
+ switch (filter->upAction.type) {
+ case XkbSA_LockPtrBtn:
+ if (((filter->upAction.btn.flags & XkbSA_LockNoUnlock) != 0) ||
+ ((xkbi->lockedPtrButtons & (1 << button)) == 0)) {
+ break;
+ }
+ xkbi->lockedPtrButtons &= ~(1 << button);
+
+ if (IsMaster(xkbi->device)) {
+ XkbMergeLockedPtrBtns(xkbi->device);
+ /* One SD still has lock set, don't post event */
+ if ((xkbi->lockedPtrButtons & (1 << button)) != 0)
+ break;
+ }
+
+ /* fallthrough */
+ case XkbSA_PtrBtn:
+ XkbFakeDeviceButton(xkbi->device, 0, button);
+ break;
+ }
+ filter->active = 0;
}
return 0;
}
static int
-_XkbFilterControls( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterControls(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
{
-XkbControlsRec old;
-XkbControlsPtr ctrls;
-DeviceIntPtr kbd;
-unsigned int change;
-XkbEventCauseRec cause;
-
- kbd= xkbi->device;
- ctrls= xkbi->desc->ctrls;
- old= *ctrls;
- if (filter->keycode==0) { /* initial press */
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 0;
- change= XkbActionCtrls(&pAction->ctrls);
- filter->priv = change;
- filter->filter = _XkbFilterControls;
- filter->upAction = *pAction;
-
- if (pAction->type==XkbSA_LockControls) {
- filter->priv= (ctrls->enabled_ctrls&change);
- change&= ~ctrls->enabled_ctrls;
- }
-
- if (change) {
- xkbControlsNotify cn;
- XkbSrvLedInfoPtr sli;
-
- ctrls->enabled_ctrls|= change;
- if (XkbComputeControlsNotify(kbd,&old,ctrls,&cn,FALSE)) {
- cn.keycode = keycode;
+ XkbControlsRec old;
+ XkbControlsPtr ctrls;
+ DeviceIntPtr kbd;
+ unsigned int change;
+ XkbEventCauseRec cause;
+
+ kbd = xkbi->device;
+ ctrls = xkbi->desc->ctrls;
+ old = *ctrls;
+ if (filter->keycode == 0) { /* initial press */
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ change = XkbActionCtrls(&pAction->ctrls);
+ filter->priv = change;
+ filter->filter = _XkbFilterControls;
+ filter->upAction = *pAction;
+
+ if (pAction->type == XkbSA_LockControls) {
+ filter->priv = (ctrls->enabled_ctrls & change);
+ change &= ~ctrls->enabled_ctrls;
+ }
+
+ if (change) {
+ xkbControlsNotify cn;
+ XkbSrvLedInfoPtr sli;
+
+ ctrls->enabled_ctrls |= change;
+ if (XkbComputeControlsNotify(kbd, &old, ctrls, &cn, FALSE)) {
+ cn.keycode = keycode;
/* XXX: what about DeviceKeyPress? */
- cn.eventType = KeyPress;
- cn.requestMajor = 0;
- cn.requestMinor = 0;
- XkbSendControlsNotify(kbd,&cn);
- }
-
- XkbSetCauseKey(&cause,keycode,KeyPress);
-
- /* If sticky keys were disabled, clear all locks and latches */
- if ((old.enabled_ctrls&XkbStickyKeysMask)&&
- (!(ctrls->enabled_ctrls&XkbStickyKeysMask))) {
- XkbClearAllLatchesAndLocks(kbd,xkbi,FALSE,&cause);
- }
- sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0);
- XkbUpdateIndicators(kbd,sli->usesControls,TRUE,NULL,&cause);
- if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask))
- XkbDDXAccessXBeep(kbd,_BEEP_FEATURE_ON,change);
- }
+ cn.eventType = KeyPress;
+ cn.requestMajor = 0;
+ cn.requestMinor = 0;
+ XkbSendControlsNotify(kbd, &cn);
+ }
+
+ XkbSetCauseKey(&cause, keycode, KeyPress);
+
+ /* If sticky keys were disabled, clear all locks and latches */
+ if ((old.enabled_ctrls & XkbStickyKeysMask) &&
+ (!(ctrls->enabled_ctrls & XkbStickyKeysMask))) {
+ XkbClearAllLatchesAndLocks(kbd, xkbi, FALSE, &cause);
+ }
+ sli = XkbFindSrvLedInfo(kbd, XkbDfltXIClass, XkbDfltXIId, 0);
+ XkbUpdateIndicators(kbd, sli->usesControls, TRUE, NULL, &cause);
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_FeatureFBMask))
+ XkbDDXAccessXBeep(kbd, _BEEP_FEATURE_ON, change);
+ }
}
- else if (filter->keycode==keycode) {
- change= filter->priv;
- if (change) {
- xkbControlsNotify cn;
- XkbSrvLedInfoPtr sli;
-
- ctrls->enabled_ctrls&= ~change;
- if (XkbComputeControlsNotify(kbd,&old,ctrls,&cn,FALSE)) {
- cn.keycode = keycode;
- cn.eventType = KeyRelease;
- cn.requestMajor = 0;
- cn.requestMinor = 0;
- XkbSendControlsNotify(kbd,&cn);
- }
-
- XkbSetCauseKey(&cause,keycode,KeyRelease);
- /* If sticky keys were disabled, clear all locks and latches */
- if ((old.enabled_ctrls&XkbStickyKeysMask)&&
- (!(ctrls->enabled_ctrls&XkbStickyKeysMask))) {
- XkbClearAllLatchesAndLocks(kbd,xkbi,FALSE,&cause);
- }
- sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0);
- XkbUpdateIndicators(kbd,sli->usesControls,TRUE,NULL,&cause);
- if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask))
- XkbDDXAccessXBeep(kbd,_BEEP_FEATURE_OFF,change);
- }
- filter->keycode= 0;
- filter->active= 0;
+ else if (filter->keycode == keycode) {
+ change = filter->priv;
+ if (change) {
+ xkbControlsNotify cn;
+ XkbSrvLedInfoPtr sli;
+
+ ctrls->enabled_ctrls &= ~change;
+ if (XkbComputeControlsNotify(kbd, &old, ctrls, &cn, FALSE)) {
+ cn.keycode = keycode;
+ cn.eventType = KeyRelease;
+ cn.requestMajor = 0;
+ cn.requestMinor = 0;
+ XkbSendControlsNotify(kbd, &cn);
+ }
+
+ XkbSetCauseKey(&cause, keycode, KeyRelease);
+ /* If sticky keys were disabled, clear all locks and latches */
+ if ((old.enabled_ctrls & XkbStickyKeysMask) &&
+ (!(ctrls->enabled_ctrls & XkbStickyKeysMask))) {
+ XkbClearAllLatchesAndLocks(kbd, xkbi, FALSE, &cause);
+ }
+ sli = XkbFindSrvLedInfo(kbd, XkbDfltXIClass, XkbDfltXIId, 0);
+ XkbUpdateIndicators(kbd, sli->usesControls, TRUE, NULL, &cause);
+ if (XkbAX_NeedFeedback(ctrls, XkbAX_FeatureFBMask))
+ XkbDDXAccessXBeep(kbd, _BEEP_FEATURE_OFF, change);
+ }
+ filter->keycode = 0;
+ filter->active = 0;
}
return 1;
}
static int
-_XkbFilterActionMessage(XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterActionMessage(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter,
+ unsigned keycode, XkbAction *pAction)
{
-XkbMessageAction * pMsg;
-DeviceIntPtr kbd;
-
- kbd= xkbi->device;
- if (filter->keycode==0) { /* initial press */
- pMsg= &pAction->msg;
- if ((pMsg->flags&XkbSA_MessageOnRelease)||
- ((pMsg->flags&XkbSA_MessageGenKeyEvent)==0)) {
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 0;
- filter->priv = 0;
- filter->filter = _XkbFilterActionMessage;
- filter->upAction = *pAction;
- }
- if (pMsg->flags&XkbSA_MessageOnPress) {
- xkbActionMessage msg;
-
- msg.keycode= keycode;
- msg.press= 1;
- msg.keyEventFollows=((pMsg->flags&XkbSA_MessageGenKeyEvent)!=0);
- memcpy((char *)msg.message,
- (char *)pMsg->message,XkbActionMessageLength);
- XkbSendActionMessage(kbd,&msg);
- }
- return ((pAction->msg.flags&XkbSA_MessageGenKeyEvent)!=0);
+ XkbMessageAction *pMsg;
+ DeviceIntPtr kbd;
+
+ kbd = xkbi->device;
+ if (filter->keycode == 0) { /* initial press */
+ pMsg = &pAction->msg;
+ if ((pMsg->flags & XkbSA_MessageOnRelease) ||
+ ((pMsg->flags & XkbSA_MessageGenKeyEvent) == 0)) {
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->priv = 0;
+ filter->filter = _XkbFilterActionMessage;
+ filter->upAction = *pAction;
+ }
+ if (pMsg->flags & XkbSA_MessageOnPress) {
+ xkbActionMessage msg;
+
+ msg.keycode = keycode;
+ msg.press = 1;
+ msg.keyEventFollows =
+ ((pMsg->flags & XkbSA_MessageGenKeyEvent) != 0);
+ memcpy((char *) msg.message, (char *) pMsg->message,
+ XkbActionMessageLength);
+ XkbSendActionMessage(kbd, &msg);
+ }
+ return ((pAction->msg.flags & XkbSA_MessageGenKeyEvent) != 0);
}
- else if (filter->keycode==keycode) {
- pMsg= &filter->upAction.msg;
- if (pMsg->flags&XkbSA_MessageOnRelease) {
- xkbActionMessage msg;
-
- msg.keycode= keycode;
- msg.press= 0;
- msg.keyEventFollows=((pMsg->flags&XkbSA_MessageGenKeyEvent)!=0);
- memcpy((char *)msg.message,(char *)pMsg->message,
- XkbActionMessageLength);
- XkbSendActionMessage(kbd,&msg);
- }
- filter->keycode= 0;
- filter->active= 0;
- return ((pMsg->flags&XkbSA_MessageGenKeyEvent)!=0);
+ else if (filter->keycode == keycode) {
+ pMsg = &filter->upAction.msg;
+ if (pMsg->flags & XkbSA_MessageOnRelease) {
+ xkbActionMessage msg;
+
+ msg.keycode = keycode;
+ msg.press = 0;
+ msg.keyEventFollows =
+ ((pMsg->flags & XkbSA_MessageGenKeyEvent) != 0);
+ memcpy((char *) msg.message, (char *) pMsg->message,
+ XkbActionMessageLength);
+ XkbSendActionMessage(kbd, &msg);
+ }
+ filter->keycode = 0;
+ filter->active = 0;
+ return ((pMsg->flags & XkbSA_MessageGenKeyEvent) != 0);
}
return 1;
}
static int
-_XkbFilterRedirectKey( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterRedirectKey(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
{
-DeviceEvent ev;
-int x,y;
-XkbStateRec old;
-unsigned mods,mask;
-xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(xkbi->device);
-ProcessInputProc backupproc;
+ DeviceEvent ev;
+ int x, y;
+ XkbStateRec old, old_prev;
+ unsigned mods, mask;
+ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(xkbi->device);
+ ProcessInputProc backupproc;
/* never actually used uninitialised, but gcc isn't smart enough
* to work that out. */
memset(&old, 0, sizeof(old));
+ memset(&old_prev, 0, sizeof(old_prev));
memset(&ev, 0, sizeof(ev));
- if ((filter->keycode!=0)&&(filter->keycode!=keycode))
- return 1;
+ if ((filter->keycode != 0) && (filter->keycode != keycode))
+ return 1;
- GetSpritePosition(xkbi->device, &x,&y);
+ GetSpritePosition(xkbi->device, &x, &y);
ev.header = ET_Internal;
ev.length = sizeof(DeviceEvent);
ev.time = GetTimeInMillis();
ev.root_x = x;
ev.root_y = y;
-
- if (filter->keycode==0) { /* initial press */
- if ((pAction->redirect.new_key<xkbi->desc->min_key_code)||
- (pAction->redirect.new_key>xkbi->desc->max_key_code)) {
- return 1;
- }
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 0;
- filter->priv = 0;
- filter->filter = _XkbFilterRedirectKey;
- filter->upAction = *pAction;
+ /* redirect actions do not work across devices, therefore the following is
+ * correct: */
+ ev.deviceid = xkbi->device->id;
+ /* filter->priv must be set up by the caller for the initial press. */
+ ev.sourceid = filter->priv;
+
+ if (filter->keycode == 0) { /* initial press */
+ if ((pAction->redirect.new_key < xkbi->desc->min_key_code) ||
+ (pAction->redirect.new_key > xkbi->desc->max_key_code)) {
+ return 1;
+ }
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->filter = _XkbFilterRedirectKey;
+ filter->upAction = *pAction;
ev.type = ET_KeyPress;
ev.detail.key = pAction->redirect.new_key;
- mask= XkbSARedirectVModsMask(&pAction->redirect);
- mods= XkbSARedirectVMods(&pAction->redirect);
- if (mask) XkbVirtualModsToReal(xkbi->desc,mask,&mask);
- if (mods) XkbVirtualModsToReal(xkbi->desc,mods,&mods);
- mask|= pAction->redirect.mods_mask;
- mods|= pAction->redirect.mods;
-
- if ( mask || mods ) {
- old= xkbi->state;
- xkbi->state.base_mods&= ~mask;
- xkbi->state.base_mods|= (mods&mask);
- xkbi->state.latched_mods&= ~mask;
- xkbi->state.latched_mods|= (mods&mask);
- xkbi->state.locked_mods&= ~mask;
- xkbi->state.locked_mods|= (mods&mask);
- XkbComputeDerivedState(xkbi);
- }
-
- UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc);
- xkbi->device->public.processInputProc((InternalEvent*)&ev, xkbi->device);
- COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
- backupproc,xkbUnwrapProc);
-
- if ( mask || mods )
- xkbi->state= old;
+ mask = XkbSARedirectVModsMask(&pAction->redirect);
+ mods = XkbSARedirectVMods(&pAction->redirect);
+ if (mask)
+ XkbVirtualModsToReal(xkbi->desc, mask, &mask);
+ if (mods)
+ XkbVirtualModsToReal(xkbi->desc, mods, &mods);
+ mask |= pAction->redirect.mods_mask;
+ mods |= pAction->redirect.mods;
+
+ if (mask || mods) {
+ old = xkbi->state;
+ old_prev = xkbi->prev_state;
+ xkbi->state.base_mods &= ~mask;
+ xkbi->state.base_mods |= (mods & mask);
+ xkbi->state.latched_mods &= ~mask;
+ xkbi->state.latched_mods |= (mods & mask);
+ xkbi->state.locked_mods &= ~mask;
+ xkbi->state.locked_mods |= (mods & mask);
+ XkbComputeDerivedState(xkbi);
+ xkbi->prev_state = xkbi->state;
+ }
+
+ UNWRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, backupproc);
+ xkbi->device->public.processInputProc((InternalEvent *) &ev,
+ xkbi->device);
+ COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, backupproc,
+ xkbUnwrapProc);
+
+ if (mask || mods) {
+ xkbi->state = old;
+ xkbi->prev_state = old_prev;
+ }
}
- else if (filter->keycode==keycode) {
+ else if (filter->keycode == keycode) {
ev.type = ET_KeyRelease;
ev.detail.key = filter->upAction.redirect.new_key;
- mask= XkbSARedirectVModsMask(&filter->upAction.redirect);
- mods= XkbSARedirectVMods(&filter->upAction.redirect);
- if (mask) XkbVirtualModsToReal(xkbi->desc,mask,&mask);
- if (mods) XkbVirtualModsToReal(xkbi->desc,mods,&mods);
- mask|= filter->upAction.redirect.mods_mask;
- mods|= filter->upAction.redirect.mods;
-
- if ( mask || mods ) {
- old= xkbi->state;
- xkbi->state.base_mods&= ~mask;
- xkbi->state.base_mods|= (mods&mask);
- xkbi->state.latched_mods&= ~mask;
- xkbi->state.latched_mods|= (mods&mask);
- xkbi->state.locked_mods&= ~mask;
- xkbi->state.locked_mods|= (mods&mask);
- XkbComputeDerivedState(xkbi);
- }
-
- UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc);
- xkbi->device->public.processInputProc((InternalEvent*)&ev, xkbi->device);
- COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
- backupproc,xkbUnwrapProc);
-
- if ( mask || mods )
- xkbi->state= old;
-
- filter->keycode= 0;
- filter->active= 0;
+ mask = XkbSARedirectVModsMask(&filter->upAction.redirect);
+ mods = XkbSARedirectVMods(&filter->upAction.redirect);
+ if (mask)
+ XkbVirtualModsToReal(xkbi->desc, mask, &mask);
+ if (mods)
+ XkbVirtualModsToReal(xkbi->desc, mods, &mods);
+ mask |= filter->upAction.redirect.mods_mask;
+ mods |= filter->upAction.redirect.mods;
+
+ if (mask || mods) {
+ old = xkbi->state;
+ old_prev = xkbi->prev_state;
+ xkbi->state.base_mods &= ~mask;
+ xkbi->state.base_mods |= (mods & mask);
+ xkbi->state.latched_mods &= ~mask;
+ xkbi->state.latched_mods |= (mods & mask);
+ xkbi->state.locked_mods &= ~mask;
+ xkbi->state.locked_mods |= (mods & mask);
+ XkbComputeDerivedState(xkbi);
+ xkbi->prev_state = xkbi->state;
+ }
+
+ UNWRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, backupproc);
+ xkbi->device->public.processInputProc((InternalEvent *) &ev,
+ xkbi->device);
+ COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, backupproc,
+ xkbUnwrapProc);
+
+ if (mask || mods) {
+ xkbi->state = old;
+ xkbi->prev_state = old_prev;
+ }
+
+ filter->keycode = 0;
+ filter->active = 0;
}
return 0;
}
static int
-_XkbFilterSwitchScreen( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterSwitchScreen(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter,
+ unsigned keycode, XkbAction *pAction)
{
DeviceIntPtr dev = xkbi->device;
+
if (dev == inputInfo.keyboard)
return 0;
- if (filter->keycode==0) { /* initial press */
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 0;
- filter->filter = _XkbFilterSwitchScreen;
- AccessXCancelRepeatKey(xkbi, keycode);
- XkbDDXSwitchScreen(dev,keycode,pAction);
- return 0;
+ if (filter->keycode == 0) { /* initial press */
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->filter = _XkbFilterSwitchScreen;
+ AccessXCancelRepeatKey(xkbi, keycode);
+ XkbDDXSwitchScreen(dev, keycode, pAction);
+ return 0;
}
- else if (filter->keycode==keycode) {
- filter->active= 0;
- return 0;
+ else if (filter->keycode == keycode) {
+ filter->active = 0;
+ return 0;
}
return 1;
}
static int
-_XkbFilterXF86Private( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterXF86Private(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
{
DeviceIntPtr dev = xkbi->device;
+
if (dev == inputInfo.keyboard)
return 0;
- if (filter->keycode==0) { /* initial press */
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 0;
- filter->filter = _XkbFilterXF86Private;
- XkbDDXPrivate(dev,keycode,pAction);
- return 0;
+ if (filter->keycode == 0) { /* initial press */
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->filter = _XkbFilterXF86Private;
+ XkbDDXPrivate(dev, keycode, pAction);
+ return 0;
}
- else if (filter->keycode==keycode) {
- filter->active= 0;
- return 0;
+ else if (filter->keycode == keycode) {
+ filter->active = 0;
+ return 0;
}
return 1;
}
-
static int
-_XkbFilterDeviceBtn( XkbSrvInfoPtr xkbi,
- XkbFilterPtr filter,
- unsigned keycode,
- XkbAction * pAction)
+_XkbFilterDeviceBtn(XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
{
if (xkbi->device == inputInfo.keyboard)
return 0;
- if (filter->keycode==0) { /* initial press */
- DeviceIntPtr dev;
- int button;
-
- _XkbLookupButtonDevice(&dev, pAction->devbtn.device, serverClient,
- DixUnknownAccess, &button);
- if (!dev || !dev->public.on)
- return 1;
-
- button= pAction->devbtn.button;
- if ((button<1)||(button>dev->button->numButtons))
- return 1;
-
- filter->keycode = keycode;
- filter->active = 1;
- filter->filterOthers = 0;
- filter->priv=0;
- filter->filter = _XkbFilterDeviceBtn;
- filter->upAction= *pAction;
- switch (pAction->type) {
- case XkbSA_LockDeviceBtn:
- if ((pAction->devbtn.flags&XkbSA_LockNoLock)||
- BitIsOn(dev->button->down, button))
- return 0;
- XkbFakeDeviceButton(dev,TRUE,button);
- filter->upAction.type= XkbSA_NoAction;
- break;
- case XkbSA_DeviceBtn:
- if (pAction->devbtn.count>0) {
- int nClicks,i;
- nClicks= pAction->btn.count;
- for (i=0;i<nClicks;i++) {
- XkbFakeDeviceButton(dev,TRUE,button);
- XkbFakeDeviceButton(dev,FALSE,button);
- }
- filter->upAction.type= XkbSA_NoAction;
- }
- else XkbFakeDeviceButton(dev,TRUE,button);
- break;
- }
+ if (filter->keycode == 0) { /* initial press */
+ DeviceIntPtr dev;
+ int button;
+
+ _XkbLookupButtonDevice(&dev, pAction->devbtn.device, serverClient,
+ DixUnknownAccess, &button);
+ if (!dev || !dev->public.on)
+ return 1;
+
+ button = pAction->devbtn.button;
+ if ((button < 1) || (button > dev->button->numButtons))
+ return 1;
+
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->priv = 0;
+ filter->filter = _XkbFilterDeviceBtn;
+ filter->upAction = *pAction;
+ switch (pAction->type) {
+ case XkbSA_LockDeviceBtn:
+ if ((pAction->devbtn.flags & XkbSA_LockNoLock) ||
+ BitIsOn(dev->button->down, button))
+ return 0;
+ XkbFakeDeviceButton(dev, TRUE, button);
+ filter->upAction.type = XkbSA_NoAction;
+ break;
+ case XkbSA_DeviceBtn:
+ if (pAction->devbtn.count > 0) {
+ int nClicks, i;
+
+ nClicks = pAction->btn.count;
+ for (i = 0; i < nClicks; i++) {
+ XkbFakeDeviceButton(dev, TRUE, button);
+ XkbFakeDeviceButton(dev, FALSE, button);
+ }
+ filter->upAction.type = XkbSA_NoAction;
+ }
+ else
+ XkbFakeDeviceButton(dev, TRUE, button);
+ break;
+ }
}
- else if (filter->keycode==keycode) {
- DeviceIntPtr dev;
- int button;
-
- filter->active= 0;
- _XkbLookupButtonDevice(&dev, filter->upAction.devbtn.device,
- serverClient, DixUnknownAccess, &button);
- if (!dev || !dev->public.on)
- return 1;
-
- button= filter->upAction.btn.button;
- switch (filter->upAction.type) {
- case XkbSA_LockDeviceBtn:
- if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)||
- !BitIsOn(dev->button->down, button))
- return 0;
- XkbFakeDeviceButton(dev,FALSE,button);
- break;
- case XkbSA_DeviceBtn:
- XkbFakeDeviceButton(dev,FALSE,button);
- break;
- }
- filter->active = 0;
+ else if (filter->keycode == keycode) {
+ DeviceIntPtr dev;
+ int button;
+
+ filter->active = 0;
+ _XkbLookupButtonDevice(&dev, filter->upAction.devbtn.device,
+ serverClient, DixUnknownAccess, &button);
+ if (!dev || !dev->public.on)
+ return 1;
+
+ button = filter->upAction.btn.button;
+ switch (filter->upAction.type) {
+ case XkbSA_LockDeviceBtn:
+ if ((filter->upAction.devbtn.flags & XkbSA_LockNoUnlock) ||
+ !BitIsOn(dev->button->down, button))
+ return 0;
+ XkbFakeDeviceButton(dev, FALSE, button);
+ break;
+ case XkbSA_DeviceBtn:
+ XkbFakeDeviceButton(dev, FALSE, button);
+ break;
+ }
+ filter->active = 0;
}
return 0;
}
static XkbFilterPtr
-_XkbNextFreeFilter(
- XkbSrvInfoPtr xkbi
-)
+_XkbNextFreeFilter(XkbSrvInfoPtr xkbi)
{
-register int i;
+ register int i;
- if (xkbi->szFilters==0) {
- xkbi->szFilters = 4;
- xkbi->filters = calloc(xkbi->szFilters, sizeof(XkbFilterRec));
- /* 6/21/93 (ef) -- XXX! deal with allocation failure */
+ if (xkbi->szFilters == 0) {
+ xkbi->szFilters = 4;
+ xkbi->filters = calloc(xkbi->szFilters, sizeof(XkbFilterRec));
+ /* 6/21/93 (ef) -- XXX! deal with allocation failure */
}
- for (i=0;i<xkbi->szFilters;i++) {
- if (!xkbi->filters[i].active) {
- xkbi->filters[i].keycode = 0;
- return &xkbi->filters[i];
- }
+ for (i = 0; i < xkbi->szFilters; i++) {
+ if (!xkbi->filters[i].active) {
+ xkbi->filters[i].keycode = 0;
+ return &xkbi->filters[i];
+ }
}
- xkbi->szFilters*=2;
- xkbi->filters= realloc(xkbi->filters,
+ xkbi->szFilters *= 2;
+ xkbi->filters = realloc(xkbi->filters,
xkbi->szFilters * sizeof(XkbFilterRec));
/* 6/21/93 (ef) -- XXX! deal with allocation failure */
- memset(&xkbi->filters[xkbi->szFilters/2], 0,
- (xkbi->szFilters/2)*sizeof(XkbFilterRec));
- return &xkbi->filters[xkbi->szFilters/2];
+ memset(&xkbi->filters[xkbi->szFilters / 2], 0,
+ (xkbi->szFilters / 2) * sizeof(XkbFilterRec));
+ return &xkbi->filters[xkbi->szFilters / 2];
}
static int
-_XkbApplyFilters(XkbSrvInfoPtr xkbi,unsigned kc,XkbAction *pAction)
+_XkbApplyFilters(XkbSrvInfoPtr xkbi, unsigned kc, XkbAction *pAction)
{
-register int i,send;
-
- send= 1;
- for (i=0;i<xkbi->szFilters;i++) {
- if ((xkbi->filters[i].active)&&(xkbi->filters[i].filter))
- send= ((*xkbi->filters[i].filter)(xkbi,&xkbi->filters[i],kc,pAction)
- && send);
+ register int i, send;
+
+ send = 1;
+ for (i = 0; i < xkbi->szFilters; i++) {
+ if ((xkbi->filters[i].active) && (xkbi->filters[i].filter))
+ send =
+ ((*xkbi->filters[i].filter) (xkbi, &xkbi->filters[i], kc,
+ pAction)
+ && send);
}
return send;
}
void
-XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent* event)
+XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
{
-int key,bit,i;
-XkbSrvInfoPtr xkbi;
-KeyClassPtr keyc;
-int changed,sendEvent;
-Bool genStateNotify;
-XkbAction act;
-XkbFilterPtr filter;
-Bool keyEvent;
-Bool pressEvent;
-ProcessInputProc backupproc;
-
-xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
-
- keyc= kbd->key;
- xkbi= keyc->xkbInfo;
- key= event->detail.key;
+ int key, bit, i;
+ XkbSrvInfoPtr xkbi;
+ KeyClassPtr keyc;
+ int changed, sendEvent;
+ Bool genStateNotify;
+ XkbAction act;
+ XkbFilterPtr filter;
+ Bool keyEvent;
+ Bool pressEvent;
+ ProcessInputProc backupproc;
+
+ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
+
+ keyc = kbd->key;
+ xkbi = keyc->xkbInfo;
+ key = event->detail.key;
/* The state may change, so if we're not in the middle of sending a state
* notify, prepare for it */
- if ((xkbi->flags&_XkbStateNotifyInProgress)==0) {
- xkbi->prev_state = xkbi->state;
- xkbi->flags|= _XkbStateNotifyInProgress;
- genStateNotify= TRUE;
+ if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) {
+ xkbi->prev_state = xkbi->state;
+ xkbi->flags |= _XkbStateNotifyInProgress;
+ genStateNotify = TRUE;
}
- else genStateNotify= FALSE;
+ else
+ genStateNotify = FALSE;
xkbi->clearMods = xkbi->setMods = 0;
xkbi->groupChange = 0;
sendEvent = 1;
- keyEvent= ((event->type == ET_KeyPress) || (event->type == ET_KeyRelease));
- pressEvent= ((event->type == ET_KeyPress)|| (event->type == ET_ButtonPress));
+ keyEvent = ((event->type == ET_KeyPress) || (event->type == ET_KeyRelease));
+ pressEvent = ((event->type == ET_KeyPress) ||
+ (event->type == ET_ButtonPress));
if (pressEvent) {
- if (keyEvent)
- act = XkbGetKeyAction(xkbi,&xkbi->state,key);
- else {
- act = XkbGetButtonAction(kbd,dev,key);
- key|= BTN_ACT_FLAG;
- }
- sendEvent = _XkbApplyFilters(xkbi,key,&act);
- if (sendEvent) {
- switch (act.type) {
- case XkbSA_SetMods:
- case XkbSA_SetGroup:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent = _XkbFilterSetState(xkbi,filter,key,&act);
- break;
- case XkbSA_LatchMods:
- case XkbSA_LatchGroup:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent=_XkbFilterLatchState(xkbi,filter,key,&act);
- break;
- case XkbSA_LockMods:
- case XkbSA_LockGroup:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent=_XkbFilterLockState(xkbi,filter,key,&act);
- break;
- case XkbSA_ISOLock:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent=_XkbFilterISOLock(xkbi,filter,key,&act);
- break;
- case XkbSA_MovePtr:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent= _XkbFilterPointerMove(xkbi,filter,key,&act);
- break;
- case XkbSA_PtrBtn:
- case XkbSA_LockPtrBtn:
- case XkbSA_SetPtrDflt:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent= _XkbFilterPointerBtn(xkbi,filter,key,&act);
- break;
- case XkbSA_Terminate:
- sendEvent= XkbDDXTerminateServer(dev,key,&act);
- break;
- case XkbSA_SwitchScreen:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent=_XkbFilterSwitchScreen(xkbi,filter,key,&act);
- break;
- case XkbSA_SetControls:
- case XkbSA_LockControls:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent=_XkbFilterControls(xkbi,filter,key,&act);
- break;
- case XkbSA_ActionMessage:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent=_XkbFilterActionMessage(xkbi,filter,key,&act);
- break;
- case XkbSA_RedirectKey:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent= _XkbFilterRedirectKey(xkbi,filter,key,&act);
- break;
- case XkbSA_DeviceBtn:
- case XkbSA_LockDeviceBtn:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent= _XkbFilterDeviceBtn(xkbi,filter,key,&act);
- break;
- case XkbSA_XFree86Private:
- filter = _XkbNextFreeFilter(xkbi);
- sendEvent= _XkbFilterXF86Private(xkbi,filter,key,&act);
- break;
- }
- }
+ if (keyEvent)
+ act = XkbGetKeyAction(xkbi, &xkbi->state, key);
+ else {
+ act = XkbGetButtonAction(kbd, dev, key);
+ key |= BTN_ACT_FLAG;
+ }
+ sendEvent = _XkbApplyFilters(xkbi, key, &act);
+ if (sendEvent) {
+ switch (act.type) {
+ case XkbSA_SetMods:
+ case XkbSA_SetGroup:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterSetState(xkbi, filter, key, &act);
+ break;
+ case XkbSA_LatchMods:
+ case XkbSA_LatchGroup:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterLatchState(xkbi, filter, key, &act);
+ break;
+ case XkbSA_LockMods:
+ case XkbSA_LockGroup:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterLockState(xkbi, filter, key, &act);
+ break;
+ case XkbSA_ISOLock:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterISOLock(xkbi, filter, key, &act);
+ break;
+ case XkbSA_MovePtr:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterPointerMove(xkbi, filter, key, &act);
+ break;
+ case XkbSA_PtrBtn:
+ case XkbSA_LockPtrBtn:
+ case XkbSA_SetPtrDflt:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterPointerBtn(xkbi, filter, key, &act);
+ break;
+ case XkbSA_Terminate:
+ sendEvent = XkbDDXTerminateServer(dev, key, &act);
+ break;
+ case XkbSA_SwitchScreen:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterSwitchScreen(xkbi, filter, key, &act);
+ break;
+ case XkbSA_SetControls:
+ case XkbSA_LockControls:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterControls(xkbi, filter, key, &act);
+ break;
+ case XkbSA_ActionMessage:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterActionMessage(xkbi, filter, key, &act);
+ break;
+ case XkbSA_RedirectKey:
+ filter = _XkbNextFreeFilter(xkbi);
+ /* redirect actions must create a new DeviceEvent. The
+ * source device id for this event cannot be obtained from
+ * xkbi, so we pass it here explicitly. The field deviceid
+ * equals to xkbi->device->id. */
+ filter->priv = event->sourceid;
+ sendEvent = _XkbFilterRedirectKey(xkbi, filter, key, &act);
+ break;
+ case XkbSA_DeviceBtn:
+ case XkbSA_LockDeviceBtn:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterDeviceBtn(xkbi, filter, key, &act);
+ break;
+ case XkbSA_XFree86Private:
+ filter = _XkbNextFreeFilter(xkbi);
+ sendEvent = _XkbFilterXF86Private(xkbi, filter, key, &act);
+ break;
+ }
+ }
}
else {
- if (!keyEvent)
- key|= BTN_ACT_FLAG;
- sendEvent = _XkbApplyFilters(xkbi,key,NULL);
+ if (!keyEvent)
+ key |= BTN_ACT_FLAG;
+ sendEvent = _XkbApplyFilters(xkbi, key, NULL);
}
- if (xkbi->groupChange!=0)
- xkbi->state.base_group+= xkbi->groupChange;
+ if (xkbi->groupChange != 0)
+ xkbi->state.base_group += xkbi->groupChange;
if (xkbi->setMods) {
- for (i=0,bit=1; xkbi->setMods; i++,bit<<=1 ) {
- if (xkbi->setMods&bit) {
- keyc->modifierKeyCount[i]++;
- xkbi->state.base_mods|= bit;
- xkbi->setMods&= ~bit;
- }
- }
+ for (i = 0, bit = 1; xkbi->setMods; i++, bit <<= 1) {
+ if (xkbi->setMods & bit) {
+ keyc->modifierKeyCount[i]++;
+ xkbi->state.base_mods |= bit;
+ xkbi->setMods &= ~bit;
+ }
+ }
}
if (xkbi->clearMods) {
- for (i=0,bit=1; xkbi->clearMods; i++,bit<<=1 ) {
- if (xkbi->clearMods&bit) {
- keyc->modifierKeyCount[i]--;
- if (keyc->modifierKeyCount[i]<=0) {
- xkbi->state.base_mods&= ~bit;
- keyc->modifierKeyCount[i] = 0;
- }
- xkbi->clearMods&= ~bit;
- }
- }
+ for (i = 0, bit = 1; xkbi->clearMods; i++, bit <<= 1) {
+ if (xkbi->clearMods & bit) {
+ keyc->modifierKeyCount[i]--;
+ if (keyc->modifierKeyCount[i] <= 0) {
+ xkbi->state.base_mods &= ~bit;
+ keyc->modifierKeyCount[i] = 0;
+ }
+ xkbi->clearMods &= ~bit;
+ }
+ }
}
if (sendEvent) {
DeviceIntPtr tmpdev;
- if (keyEvent)
+
+ if (keyEvent)
tmpdev = dev;
else
tmpdev = GetMaster(dev, POINTER_OR_FLOAT);
- UNWRAP_PROCESS_INPUT_PROC(tmpdev,xkbPrivPtr, backupproc);
- dev->public.processInputProc((InternalEvent*)event, tmpdev);
+ UNWRAP_PROCESS_INPUT_PROC(tmpdev, xkbPrivPtr, backupproc);
+ dev->public.processInputProc((InternalEvent *) event, tmpdev);
COND_WRAP_PROCESS_INPUT_PROC(tmpdev, xkbPrivPtr,
- backupproc,xkbUnwrapProc);
+ backupproc, xkbUnwrapProc);
}
else if (keyEvent) {
- FixKeyState(event, dev);
+ FixKeyState(event, dev);
}
XkbComputeDerivedState(xkbi);
- changed = XkbStateChangedFlags(&xkbi->prev_state,&xkbi->state);
+ changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state);
if (genStateNotify) {
- if (changed) {
- xkbStateNotify sn;
- sn.keycode= key;
- sn.eventType= event->type;
- sn.requestMajor = sn.requestMinor = 0;
- sn.changed= changed;
- XkbSendStateNotify(dev,&sn);
- }
- xkbi->flags&= ~_XkbStateNotifyInProgress;
+ if (changed) {
+ xkbStateNotify sn;
+
+ sn.keycode = key;
+ sn.eventType = event->type;
+ sn.requestMajor = sn.requestMinor = 0;
+ sn.changed = changed;
+ XkbSendStateNotify(dev, &sn);
+ }
+ xkbi->flags &= ~_XkbStateNotifyInProgress;
}
- changed= XkbIndicatorsToUpdate(dev,changed,FALSE);
+ changed = XkbIndicatorsToUpdate(dev, changed, FALSE);
if (changed) {
- XkbEventCauseRec cause;
- XkbSetCauseKey(&cause, key, event->type);
- XkbUpdateIndicators(dev,changed,FALSE,NULL,&cause);
+ XkbEventCauseRec cause;
+
+ XkbSetCauseKey(&cause, key, event->type);
+ XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause);
}
return;
}
int
-XkbLatchModifiers(DeviceIntPtr pXDev,CARD8 mask,CARD8 latches)
+XkbLatchModifiers(DeviceIntPtr pXDev, CARD8 mask, CARD8 latches)
{
-XkbSrvInfoPtr xkbi;
-XkbFilterPtr filter;
-XkbAction act;
-unsigned clear;
-
- if ( pXDev && pXDev->key && pXDev->key->xkbInfo ) {
- xkbi = pXDev->key->xkbInfo;
- clear= (mask&(~latches));
- xkbi->state.latched_mods&= ~clear;
- /* Clear any pending latch to locks.
- */
- act.type = XkbSA_NoAction;
- _XkbApplyFilters(xkbi,SYNTHETIC_KEYCODE,&act);
- act.type = XkbSA_LatchMods;
- act.mods.flags = 0;
- act.mods.mask = mask&latches;
- filter = _XkbNextFreeFilter(xkbi);
- _XkbFilterLatchState(xkbi,filter,SYNTHETIC_KEYCODE,&act);
- _XkbFilterLatchState(xkbi,filter,SYNTHETIC_KEYCODE,(XkbAction *)NULL);
- return Success;
+ XkbSrvInfoPtr xkbi;
+ XkbFilterPtr filter;
+ XkbAction act;
+ unsigned clear;
+
+ if (pXDev && pXDev->key && pXDev->key->xkbInfo) {
+ xkbi = pXDev->key->xkbInfo;
+ clear = (mask & (~latches));
+ xkbi->state.latched_mods &= ~clear;
+ /* Clear any pending latch to locks.
+ */
+ act.type = XkbSA_NoAction;
+ _XkbApplyFilters(xkbi, SYNTHETIC_KEYCODE, &act);
+ act.type = XkbSA_LatchMods;
+ act.mods.flags = 0;
+ act.mods.mask = mask & latches;
+ filter = _XkbNextFreeFilter(xkbi);
+ _XkbFilterLatchState(xkbi, filter, SYNTHETIC_KEYCODE, &act);
+ _XkbFilterLatchState(xkbi, filter, SYNTHETIC_KEYCODE,
+ (XkbAction *) NULL);
+ return Success;
}
return BadValue;
}
int
-XkbLatchGroup(DeviceIntPtr pXDev,int group)
+XkbLatchGroup(DeviceIntPtr pXDev, int group)
{
-XkbSrvInfoPtr xkbi;
-XkbFilterPtr filter;
-XkbAction act;
-
- if ( pXDev && pXDev->key && pXDev->key->xkbInfo ) {
- xkbi = pXDev->key->xkbInfo;
- act.type = XkbSA_LatchGroup;
- act.group.flags = 0;
- XkbSASetGroup(&act.group,group);
- filter = _XkbNextFreeFilter(xkbi);
- _XkbFilterLatchState(xkbi,filter,SYNTHETIC_KEYCODE,&act);
- _XkbFilterLatchState(xkbi,filter,SYNTHETIC_KEYCODE,(XkbAction *)NULL);
- return Success;
+ XkbSrvInfoPtr xkbi;
+ XkbFilterPtr filter;
+ XkbAction act;
+
+ if (pXDev && pXDev->key && pXDev->key->xkbInfo) {
+ xkbi = pXDev->key->xkbInfo;
+ act.type = XkbSA_LatchGroup;
+ act.group.flags = 0;
+ XkbSASetGroup(&act.group, group);
+ filter = _XkbNextFreeFilter(xkbi);
+ _XkbFilterLatchState(xkbi, filter, SYNTHETIC_KEYCODE, &act);
+ _XkbFilterLatchState(xkbi, filter, SYNTHETIC_KEYCODE,
+ (XkbAction *) NULL);
+ return Success;
}
return BadValue;
}
@@ -1287,46 +1320,45 @@ XkbAction act;
/***====================================================================***/
void
-XkbClearAllLatchesAndLocks( DeviceIntPtr dev,
- XkbSrvInfoPtr xkbi,
- Bool genEv,
- XkbEventCausePtr cause)
+XkbClearAllLatchesAndLocks(DeviceIntPtr dev,
+ XkbSrvInfoPtr xkbi,
+ Bool genEv, XkbEventCausePtr cause)
{
-XkbStateRec os;
-xkbStateNotify sn;
-
- sn.changed= 0;
- os= xkbi->state;
- if (os.latched_mods) { /* clear all latches */
- XkbLatchModifiers(dev,~0,0);
- sn.changed|= XkbModifierLatchMask;
+ XkbStateRec os;
+ xkbStateNotify sn;
+
+ sn.changed = 0;
+ os = xkbi->state;
+ if (os.latched_mods) { /* clear all latches */
+ XkbLatchModifiers(dev, ~0, 0);
+ sn.changed |= XkbModifierLatchMask;
}
if (os.latched_group) {
- XkbLatchGroup(dev,0);
- sn.changed|= XkbGroupLatchMask;
+ XkbLatchGroup(dev, 0);
+ sn.changed |= XkbGroupLatchMask;
}
if (os.locked_mods) {
- xkbi->state.locked_mods= 0;
- sn.changed|= XkbModifierLockMask;
+ xkbi->state.locked_mods = 0;
+ sn.changed |= XkbModifierLockMask;
}
if (os.locked_group) {
- xkbi->state.locked_group= 0;
- sn.changed|= XkbGroupLockMask;
+ xkbi->state.locked_group = 0;
+ sn.changed |= XkbGroupLockMask;
}
- if ( genEv && sn.changed) {
- CARD32 changed;
-
- XkbComputeDerivedState(xkbi);
- sn.keycode= cause->kc;
- sn.eventType= cause->event;
- sn.requestMajor= cause->mjr;
- sn.requestMinor= cause->mnr;
- sn.changed= XkbStateChangedFlags(&os,&xkbi->state);
- XkbSendStateNotify(dev,&sn);
- changed= XkbIndicatorsToUpdate(dev,sn.changed,FALSE);
- if (changed) {
- XkbUpdateIndicators(dev,changed,TRUE,NULL,cause);
- }
+ if (genEv && sn.changed) {
+ CARD32 changed;
+
+ XkbComputeDerivedState(xkbi);
+ sn.keycode = cause->kc;
+ sn.eventType = cause->event;
+ sn.requestMajor = cause->mjr;
+ sn.requestMinor = cause->mnr;
+ sn.changed = XkbStateChangedFlags(&os, &xkbi->state);
+ XkbSendStateNotify(dev, &sn);
+ changed = XkbIndicatorsToUpdate(dev, sn.changed, FALSE);
+ if (changed) {
+ XkbUpdateIndicators(dev, changed, TRUE, NULL, cause);
+ }
}
return;
}
@@ -1352,31 +1384,33 @@ xkbStateNotify sn;
* First one on drinking island wins!
*/
static void
-InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, ValuatorMask *mask)
+InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags,
+ ValuatorMask *mask)
{
- ScreenPtr pScreen;
- InternalEvent* events;
- int nevents, i;
- DeviceIntPtr ptr, mpointer, lastSlave = NULL;
- Bool saveWait;
+ ScreenPtr pScreen;
+ InternalEvent *events;
+ int nevents, i;
+ DeviceIntPtr ptr, mpointer, lastSlave = NULL;
+ Bool saveWait;
if (IsMaster(dev)) {
mpointer = GetMaster(dev, MASTER_POINTER);
lastSlave = mpointer->lastSlave;
ptr = GetXTestDevice(mpointer);
- } else if (IsFloating(dev))
+ }
+ else if (IsFloating(dev))
ptr = dev;
else
return;
-
events = InitEventList(GetMaximumEventsNum() + 1);
OsBlockSignals();
pScreen = miPointerGetScreen(ptr);
saveWait = miPointerSetWaitForUpdate(pScreen, FALSE);
nevents = GetPointerEvents(events, ptr, type, button, flags, mask);
if (IsMaster(dev) && (lastSlave && lastSlave != ptr))
- UpdateFromMaster(&events[nevents], lastSlave, DEVCHANGE_POINTER_EVENT, &nevents);
+ UpdateFromMaster(&events[nevents], lastSlave, DEVCHANGE_POINTER_EVENT,
+ &nevents);
miPointerSetWaitForUpdate(pScreen, saveWait);
OsReleaseSignals();
@@ -1388,10 +1422,10 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, Valuat
}
static void
-XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
+XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags, int x, int y)
{
- ValuatorMask mask;
- int gpe_flags = 0;
+ ValuatorMask mask;
+ int gpe_flags = 0;
int Point[]={x, y};
/* ignore attached SDs */
@@ -1403,16 +1437,17 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
else
gpe_flags = POINTER_RELATIVE;
- valuator_mask_set_range(&mask, 0, 2, Point);
+ valuator_mask_set_range(&mask, 0, 2,
+ Point);
InjectPointerKeyEvents(dev, MotionNotify, 0, gpe_flags, &mask);
}
void
-XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
+XkbFakeDeviceButton(DeviceIntPtr dev, Bool press, int button)
{
- DeviceIntPtr ptr;
- int down;
+ DeviceIntPtr ptr;
+ int down;
/* If dev is a slave device, and the SD is attached, do nothing. If we'd
* post through the attached master pointer we'd get duplicate events.
@@ -1424,8 +1459,10 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
if (IsMaster(dev)) {
DeviceIntPtr mpointer = GetMaster(dev, MASTER_POINTER);
+
ptr = GetXTestDevice(mpointer);
- } else if (IsFloating(dev))
+ }
+ else if (IsFloating(dev))
ptr = dev;
else
return;
diff --git a/xorg-server/xkb/xkbDflts.h b/xorg-server/xkb/xkbDflts.h
index 5d8690650..994726c0f 100644
--- a/xorg-server/xkb/xkbDflts.h
+++ b/xorg-server/xkb/xkbDflts.h
@@ -26,444 +26,446 @@
/* types name is "default" */
static Atom lnames_ONE_LEVEL[1];
-static XkbKTMapEntryRec map_TWO_LEVEL[1]= {
- { 1, 1, { ShiftMask, ShiftMask, 0 } }
+static XkbKTMapEntryRec map_TWO_LEVEL[1] = {
+ {1, 1, {ShiftMask, ShiftMask, 0}}
};
+
static Atom lnames_TWO_LEVEL[2];
-static XkbKTMapEntryRec map_ALPHABETIC[2]= {
- { 1, 1, { ShiftMask, ShiftMask, 0 } },
- { 1, 0, { LockMask, LockMask, 0 } }
+static XkbKTMapEntryRec map_ALPHABETIC[2] = {
+ {1, 1, {ShiftMask, ShiftMask, 0}},
+ {1, 0, {LockMask, LockMask, 0}}
};
-static XkbModsRec preserve_ALPHABETIC[2]= {
- { 0, 0, 0 },
- { LockMask, LockMask, 0 }
+
+static XkbModsRec preserve_ALPHABETIC[2] = {
+ {0, 0, 0},
+ {LockMask, LockMask, 0}
};
+
static Atom lnames_ALPHABETIC[2];
-static XkbKTMapEntryRec map_KEYPAD[2]= {
- { 1, 1, { ShiftMask, ShiftMask, 0 } },
- { 0, 1, { 0, 0, vmod_NumLockMask } }
+static XkbKTMapEntryRec map_KEYPAD[2] = {
+ {1, 1, {ShiftMask, ShiftMask, 0}},
+ {0, 1, {0, 0, vmod_NumLockMask}}
};
+
static Atom lnames_KEYPAD[2];
-static XkbKTMapEntryRec map_PC_BREAK[1]= {
- { 1, 1, { ControlMask, ControlMask, 0 } }
+static XkbKTMapEntryRec map_PC_BREAK[1] = {
+ {1, 1, {ControlMask, ControlMask, 0}}
};
+
static Atom lnames_PC_BREAK[2];
-static XkbKTMapEntryRec map_PC_SYSRQ[1]= {
- { 0, 1, { 0, 0, vmod_AltMask } }
+static XkbKTMapEntryRec map_PC_SYSRQ[1] = {
+ {0, 1, {0, 0, vmod_AltMask}}
};
+
static Atom lnames_PC_SYSRQ[2];
-static XkbKTMapEntryRec map_CTRL_ALT[1]= {
- { 0, 1, { ControlMask, ControlMask, vmod_AltMask } }
+static XkbKTMapEntryRec map_CTRL_ALT[1] = {
+ {0, 1, {ControlMask, ControlMask, vmod_AltMask}}
};
+
static Atom lnames_CTRL_ALT[2];
-static XkbKTMapEntryRec map_THREE_LEVEL[3]= {
- { 1, 1, { ShiftMask, ShiftMask, 0 } },
- { 0, 2, { 0, 0, vmod_LevelThreeMask } },
- { 0, 2, { ShiftMask, ShiftMask, vmod_LevelThreeMask } }
+static XkbKTMapEntryRec map_THREE_LEVEL[3] = {
+ {1, 1, {ShiftMask, ShiftMask, 0}},
+ {0, 2, {0, 0, vmod_LevelThreeMask}},
+ {0, 2, {ShiftMask, ShiftMask, vmod_LevelThreeMask}}
};
+
static Atom lnames_THREE_LEVEL[3];
-static XkbKTMapEntryRec map_SHIFT_ALT[1]= {
- { 0, 1, { ShiftMask, ShiftMask, vmod_AltMask } }
+static XkbKTMapEntryRec map_SHIFT_ALT[1] = {
+ {0, 1, {ShiftMask, ShiftMask, vmod_AltMask}}
};
+
static Atom lnames_SHIFT_ALT[2];
-static XkbKeyTypeRec dflt_types[]= {
+static XkbKeyTypeRec dflt_types[] = {
{
- { 0, 0, 0 },
- 1,
- 0, NULL, NULL,
- None, lnames_ONE_LEVEL
- },
+ {0, 0, 0},
+ 1,
+ 0, NULL, NULL,
+ None, lnames_ONE_LEVEL},
{
- { ShiftMask, ShiftMask, 0 },
- 2,
- 1, map_TWO_LEVEL, NULL,
- None, lnames_TWO_LEVEL
- },
+ {ShiftMask, ShiftMask, 0},
+ 2,
+ 1, map_TWO_LEVEL, NULL,
+ None, lnames_TWO_LEVEL},
{
- { ShiftMask|LockMask, ShiftMask|LockMask, 0 },
- 2,
- 2, map_ALPHABETIC, preserve_ALPHABETIC,
- None, lnames_ALPHABETIC
- },
+ {ShiftMask | LockMask, ShiftMask | LockMask, 0},
+ 2,
+ 2, map_ALPHABETIC, preserve_ALPHABETIC,
+ None, lnames_ALPHABETIC},
{
- { ShiftMask, ShiftMask, vmod_NumLockMask },
- 2,
- 2, map_KEYPAD, NULL,
- None, lnames_KEYPAD
- },
+ {ShiftMask, ShiftMask, vmod_NumLockMask},
+ 2,
+ 2, map_KEYPAD, NULL,
+ None, lnames_KEYPAD},
{
- { ControlMask, ControlMask, 0 },
- 2,
- 1, map_PC_BREAK, NULL,
- None, lnames_PC_BREAK
- },
+ {ControlMask, ControlMask, 0},
+ 2,
+ 1, map_PC_BREAK, NULL,
+ None, lnames_PC_BREAK},
{
- { 0, 0, vmod_AltMask },
- 2,
- 1, map_PC_SYSRQ, NULL,
- None, lnames_PC_SYSRQ
- },
+ {0, 0, vmod_AltMask},
+ 2,
+ 1, map_PC_SYSRQ, NULL,
+ None, lnames_PC_SYSRQ},
{
- { ControlMask, ControlMask, vmod_AltMask },
- 2,
- 1, map_CTRL_ALT, NULL,
- None, lnames_CTRL_ALT
- },
+ {ControlMask, ControlMask, vmod_AltMask},
+ 2,
+ 1, map_CTRL_ALT, NULL,
+ None, lnames_CTRL_ALT},
{
- { ShiftMask, ShiftMask, vmod_LevelThreeMask },
- 3,
- 3, map_THREE_LEVEL, NULL,
- None, lnames_THREE_LEVEL
- },
+ {ShiftMask, ShiftMask, vmod_LevelThreeMask},
+ 3,
+ 3, map_THREE_LEVEL, NULL,
+ None, lnames_THREE_LEVEL},
{
- { ShiftMask, ShiftMask, vmod_AltMask },
- 2,
- 1, map_SHIFT_ALT, NULL,
- None, lnames_SHIFT_ALT
- }
+ {ShiftMask, ShiftMask, vmod_AltMask},
+ 2,
+ 1, map_SHIFT_ALT, NULL,
+ None, lnames_SHIFT_ALT}
};
-#define num_dflt_types (sizeof(dflt_types)/sizeof(XkbKeyTypeRec))
+#define num_dflt_types (sizeof(dflt_types)/sizeof(XkbKeyTypeRec))
static void
initTypeNames(DPYTYPE dpy)
{
- dflt_types[0].name= GET_ATOM(dpy,"ONE_LEVEL");
- lnames_ONE_LEVEL[0]= GET_ATOM(dpy,"Any");
- dflt_types[1].name= GET_ATOM(dpy,"TWO_LEVEL");
- lnames_TWO_LEVEL[0]= GET_ATOM(dpy,"Base");
- lnames_TWO_LEVEL[1]= GET_ATOM(dpy,"Shift");
- dflt_types[2].name= GET_ATOM(dpy,"ALPHABETIC");
- lnames_ALPHABETIC[0]= GET_ATOM(dpy,"Base");
- lnames_ALPHABETIC[1]= GET_ATOM(dpy,"Caps");
- dflt_types[3].name= GET_ATOM(dpy,"KEYPAD");
- lnames_KEYPAD[0]= GET_ATOM(dpy,"Base");
- lnames_KEYPAD[1]= GET_ATOM(dpy,"Number");
- dflt_types[4].name= GET_ATOM(dpy,"PC_BREAK");
- lnames_PC_BREAK[0]= GET_ATOM(dpy,"Base");
- lnames_PC_BREAK[1]= GET_ATOM(dpy,"Control");
- dflt_types[5].name= GET_ATOM(dpy,"PC_SYSRQ");
- lnames_PC_SYSRQ[0]= GET_ATOM(dpy,"Base");
- lnames_PC_SYSRQ[1]= GET_ATOM(dpy,"Alt");
- dflt_types[6].name= GET_ATOM(dpy,"CTRL+ALT");
- lnames_CTRL_ALT[0]= GET_ATOM(dpy,"Base");
- lnames_CTRL_ALT[1]= GET_ATOM(dpy,"Ctrl+Alt");
- dflt_types[7].name= GET_ATOM(dpy,"THREE_LEVEL");
- lnames_THREE_LEVEL[0]= GET_ATOM(dpy,"Base");
- lnames_THREE_LEVEL[1]= GET_ATOM(dpy,"Shift");
- lnames_THREE_LEVEL[2]= GET_ATOM(dpy,"Level3");
- dflt_types[8].name= GET_ATOM(dpy,"SHIFT+ALT");
- lnames_SHIFT_ALT[0]= GET_ATOM(dpy,"Base");
- lnames_SHIFT_ALT[1]= GET_ATOM(dpy,"Shift+Alt");
+ dflt_types[0].name = GET_ATOM(dpy, "ONE_LEVEL");
+ lnames_ONE_LEVEL[0] = GET_ATOM(dpy, "Any");
+ dflt_types[1].name = GET_ATOM(dpy, "TWO_LEVEL");
+ lnames_TWO_LEVEL[0] = GET_ATOM(dpy, "Base");
+ lnames_TWO_LEVEL[1] = GET_ATOM(dpy, "Shift");
+ dflt_types[2].name = GET_ATOM(dpy, "ALPHABETIC");
+ lnames_ALPHABETIC[0] = GET_ATOM(dpy, "Base");
+ lnames_ALPHABETIC[1] = GET_ATOM(dpy, "Caps");
+ dflt_types[3].name = GET_ATOM(dpy, "KEYPAD");
+ lnames_KEYPAD[0] = GET_ATOM(dpy, "Base");
+ lnames_KEYPAD[1] = GET_ATOM(dpy, "Number");
+ dflt_types[4].name = GET_ATOM(dpy, "PC_BREAK");
+ lnames_PC_BREAK[0] = GET_ATOM(dpy, "Base");
+ lnames_PC_BREAK[1] = GET_ATOM(dpy, "Control");
+ dflt_types[5].name = GET_ATOM(dpy, "PC_SYSRQ");
+ lnames_PC_SYSRQ[0] = GET_ATOM(dpy, "Base");
+ lnames_PC_SYSRQ[1] = GET_ATOM(dpy, "Alt");
+ dflt_types[6].name = GET_ATOM(dpy, "CTRL+ALT");
+ lnames_CTRL_ALT[0] = GET_ATOM(dpy, "Base");
+ lnames_CTRL_ALT[1] = GET_ATOM(dpy, "Ctrl+Alt");
+ dflt_types[7].name = GET_ATOM(dpy, "THREE_LEVEL");
+ lnames_THREE_LEVEL[0] = GET_ATOM(dpy, "Base");
+ lnames_THREE_LEVEL[1] = GET_ATOM(dpy, "Shift");
+ lnames_THREE_LEVEL[2] = GET_ATOM(dpy, "Level3");
+ dflt_types[8].name = GET_ATOM(dpy, "SHIFT+ALT");
+ lnames_SHIFT_ALT[0] = GET_ATOM(dpy, "Base");
+ lnames_SHIFT_ALT[1] = GET_ATOM(dpy, "Shift+Alt");
}
+
/* compat name is "default" */
-static XkbSymInterpretRec dfltSI[69]= {
- { XK_ISO_Level2_Latch, 0x0000,
- XkbSI_LevelOneOnly|XkbSI_Exactly, ShiftMask,
- 255,
- { XkbSA_LatchMods, { 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Eisu_Shift, 0x0000,
- XkbSI_Exactly, LockMask,
- 255,
- { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Eisu_toggle, 0x0000,
- XkbSI_Exactly, LockMask,
- 255,
- { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Kana_Shift, 0x0000,
- XkbSI_Exactly, LockMask,
- 255,
- { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Kana_Lock, 0x0000,
- XkbSI_Exactly, LockMask,
- 255,
- { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Shift_Lock, 0x0000,
- XkbSI_AnyOf, ShiftMask|LockMask,
- 255,
- { XkbSA_LockMods, { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Num_Lock, 0x0000,
- XkbSI_AnyOf, 0xff,
- 0,
- { XkbSA_LockMods, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } },
- { XK_Alt_L, 0x0000,
- XkbSI_AnyOf, 0xff,
- 1,
- { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Alt_R, 0x0000,
- XkbSI_AnyOf, 0xff,
- 1,
- { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Scroll_Lock, 0x0000,
- XkbSI_AnyOf, 0xff,
- 4,
- { XkbSA_LockMods, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_ISO_Lock, 0x0000,
- XkbSI_AnyOf, 0xff,
- 255,
- { XkbSA_ISOLock, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_ISO_Level3_Shift, 0x0000,
- XkbSI_LevelOneOnly|XkbSI_AnyOf, 0xff,
- 2,
- { XkbSA_SetMods, { 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } } },
- { XK_ISO_Level3_Latch, 0x0000,
- XkbSI_LevelOneOnly|XkbSI_AnyOf, 0xff,
- 2,
- { XkbSA_LatchMods, { 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } } },
- { XK_Mode_switch, 0x0000,
- XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
- 3,
- { XkbSA_SetGroup, { 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_1, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } } },
- { XK_KP_End, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } } },
- { XK_KP_2, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } },
- { XK_KP_Down, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } },
- { XK_KP_3, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } } },
- { XK_KP_Next, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } } },
- { XK_KP_4, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Left, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_6, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Right, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_7, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } } },
- { XK_KP_Home, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } } },
- { XK_KP_8, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } },
- { XK_KP_Up, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } },
- { XK_KP_9, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } },
- { XK_KP_Prior, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00 } } },
- { XK_KP_5, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Begin, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_F1, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Divide, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_F2, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Multiply, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_F3, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Subtract, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Separator, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Add, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_0, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockPtrBtn, { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Insert, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockPtrBtn, { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Decimal, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockPtrBtn, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_KP_Delete, 0x0001,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockPtrBtn, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_Button_Dflt, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_Button1, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_Button2, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_Button3, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_DblClick_Dflt, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_DblClick1, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_DblClick2, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_DblClick3, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_PtrBtn, { 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_Drag_Dflt, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_Drag1, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_Drag2, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_Drag3, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_EnableKeys, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00 } } },
- { XK_Pointer_Accelerate, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00 } } },
- { XK_Pointer_DfltBtnNext, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_SetPtrDflt, { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_Pointer_DfltBtnPrev, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_SetPtrDflt, { 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_AccessX_Enable, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 } } },
- { XK_Terminate_Server, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_Terminate, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_ISO_Group_Latch, 0x0000,
- XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
- 3,
- { XkbSA_LatchGroup, { 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_ISO_Next_Group, 0x0000,
- XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
- 3,
- { XkbSA_LockGroup, { 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_ISO_Prev_Group, 0x0000,
- XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
- 3,
- { XkbSA_LockGroup, { 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_ISO_First_Group, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockGroup, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { XK_ISO_Last_Group, 0x0000,
- XkbSI_AnyOfOrNone, 0xff,
- 255,
- { XkbSA_LockGroup, { 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
- { NoSymbol, 0x0000,
- XkbSI_Exactly, LockMask,
- 255,
- { XkbSA_LockMods, { 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } } },
- { NoSymbol, 0x0000,
- XkbSI_AnyOf, 0xff,
- 255,
- { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }
+static XkbSymInterpretRec dfltSI[69] = {
+ {XK_ISO_Level2_Latch, 0x0000,
+ XkbSI_LevelOneOnly | XkbSI_Exactly, ShiftMask,
+ 255,
+ {XkbSA_LatchMods, {0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Eisu_Shift, 0x0000,
+ XkbSI_Exactly, LockMask,
+ 255,
+ {XkbSA_NoAction, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Eisu_toggle, 0x0000,
+ XkbSI_Exactly, LockMask,
+ 255,
+ {XkbSA_NoAction, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Kana_Shift, 0x0000,
+ XkbSI_Exactly, LockMask,
+ 255,
+ {XkbSA_NoAction, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Kana_Lock, 0x0000,
+ XkbSI_Exactly, LockMask,
+ 255,
+ {XkbSA_NoAction, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Shift_Lock, 0x0000,
+ XkbSI_AnyOf, ShiftMask | LockMask,
+ 255,
+ {XkbSA_LockMods, {0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Num_Lock, 0x0000,
+ XkbSI_AnyOf, 0xff,
+ 0,
+ {XkbSA_LockMods, {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00}}},
+ {XK_Alt_L, 0x0000,
+ XkbSI_AnyOf, 0xff,
+ 1,
+ {XkbSA_SetMods, {0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Alt_R, 0x0000,
+ XkbSI_AnyOf, 0xff,
+ 1,
+ {XkbSA_SetMods, {0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Scroll_Lock, 0x0000,
+ XkbSI_AnyOf, 0xff,
+ 4,
+ {XkbSA_LockMods, {0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_ISO_Lock, 0x0000,
+ XkbSI_AnyOf, 0xff,
+ 255,
+ {XkbSA_ISOLock, {0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_ISO_Level3_Shift, 0x0000,
+ XkbSI_LevelOneOnly | XkbSI_AnyOf, 0xff,
+ 2,
+ {XkbSA_SetMods, {0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00}}},
+ {XK_ISO_Level3_Latch, 0x0000,
+ XkbSI_LevelOneOnly | XkbSI_AnyOf, 0xff,
+ 2,
+ {XkbSA_LatchMods, {0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00}}},
+ {XK_Mode_switch, 0x0000,
+ XkbSI_LevelOneOnly | XkbSI_AnyOfOrNone, 0xff,
+ 3,
+ {XkbSA_SetGroup, {0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_1, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00}}},
+ {XK_KP_End, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00}}},
+ {XK_KP_2, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00}}},
+ {XK_KP_Down, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00}}},
+ {XK_KP_3, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00}}},
+ {XK_KP_Next, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00}}},
+ {XK_KP_4, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Left, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_6, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Right, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_7, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00}}},
+ {XK_KP_Home, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00}}},
+ {XK_KP_8, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00}}},
+ {XK_KP_Up, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00}}},
+ {XK_KP_9, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00}}},
+ {XK_KP_Prior, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_MovePtr, {0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00}}},
+ {XK_KP_5, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Begin, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_F1, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_SetPtrDflt, {0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Divide, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_SetPtrDflt, {0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_F2, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_SetPtrDflt, {0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Multiply, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_SetPtrDflt, {0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_F3, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_SetPtrDflt, {0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Subtract, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_SetPtrDflt, {0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Separator, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Add, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_0, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockPtrBtn, {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Insert, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockPtrBtn, {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Decimal, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockPtrBtn, {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_KP_Delete, 0x0001,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockPtrBtn, {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_Button_Dflt, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_Button1, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_Button2, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_Button3, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_DblClick_Dflt, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_DblClick1, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_DblClick2, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_DblClick3, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_PtrBtn, {0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_Drag_Dflt, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockPtrBtn, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_Drag1, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockPtrBtn, {0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_Drag2, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockPtrBtn, {0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_Drag3, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockPtrBtn, {0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_EnableKeys, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockControls, {0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00}}},
+ {XK_Pointer_Accelerate, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockControls, {0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00}}},
+ {XK_Pointer_DfltBtnNext, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_SetPtrDflt, {0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_Pointer_DfltBtnPrev, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_SetPtrDflt, {0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_AccessX_Enable, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockControls, {0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}}},
+ {XK_Terminate_Server, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_Terminate, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_ISO_Group_Latch, 0x0000,
+ XkbSI_LevelOneOnly | XkbSI_AnyOfOrNone, 0xff,
+ 3,
+ {XkbSA_LatchGroup, {0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_ISO_Next_Group, 0x0000,
+ XkbSI_LevelOneOnly | XkbSI_AnyOfOrNone, 0xff,
+ 3,
+ {XkbSA_LockGroup, {0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_ISO_Prev_Group, 0x0000,
+ XkbSI_LevelOneOnly | XkbSI_AnyOfOrNone, 0xff,
+ 3,
+ {XkbSA_LockGroup, {0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_ISO_First_Group, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockGroup, {0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {XK_ISO_Last_Group, 0x0000,
+ XkbSI_AnyOfOrNone, 0xff,
+ 255,
+ {XkbSA_LockGroup, {0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}}},
+ {NoSymbol, 0x0000,
+ XkbSI_Exactly, LockMask,
+ 255,
+ {XkbSA_LockMods, {0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00}}},
+ {NoSymbol, 0x0000,
+ XkbSI_AnyOf, 0xff,
+ 255,
+ {XkbSA_SetMods, {0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}}
};
+
#define num_dfltSI (sizeof(dfltSI)/sizeof(XkbSymInterpretRec))
-static XkbCompatMapRec compatMap= {
+static XkbCompatMapRec compatMap = {
dfltSI,
- { /* group compatibility */
- { 0, 0, 0 },
- { 0, 0, vmod_AltGrMask },
- { 0, 0, vmod_AltGrMask },
- { 0, 0, vmod_AltGrMask }
- },
+ { /* group compatibility */
+ {0, 0, 0},
+ {0, 0, vmod_AltGrMask},
+ {0, 0, vmod_AltGrMask},
+ {0, 0, vmod_AltGrMask}
+ },
num_dfltSI, num_dfltSI
};
static void
-initIndicatorNames(DPYTYPE dpy,XkbDescPtr xkb)
+initIndicatorNames(DPYTYPE dpy, XkbDescPtr xkb)
{
- xkb->names->indicators[ 0]= GET_ATOM(dpy,"Caps Lock");
- xkb->names->indicators[ 1]= GET_ATOM(dpy,"Num Lock");
- xkb->names->indicators[ 2]= GET_ATOM(dpy,"Shift Lock");
- xkb->names->indicators[ 3]= GET_ATOM(dpy,"Mouse Keys");
- xkb->names->indicators[ 4]= GET_ATOM(dpy,"Scroll Lock");
- xkb->names->indicators[ 5]= GET_ATOM(dpy,"Group 2");
+ xkb->names->indicators[0] = GET_ATOM(dpy, "Caps Lock");
+ xkb->names->indicators[1] = GET_ATOM(dpy, "Num Lock");
+ xkb->names->indicators[2] = GET_ATOM(dpy, "Shift Lock");
+ xkb->names->indicators[3] = GET_ATOM(dpy, "Mouse Keys");
+ xkb->names->indicators[4] = GET_ATOM(dpy, "Scroll Lock");
+ xkb->names->indicators[5] = GET_ATOM(dpy, "Group 2");
}
-#endif /* DEFAULT_H */
+#endif /* DEFAULT_H */
diff --git a/xorg-server/xkb/xkbEvents.c b/xorg-server/xkb/xkbEvents.c
index 347f0f8a4..d49e4c1ba 100644
--- a/xorg-server/xkb/xkbEvents.c
+++ b/xorg-server/xkb/xkbEvents.c
@@ -118,7 +118,7 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
core_mn.u.mappingNotify.count = num_keys;
else
core_mn.u.mappingNotify.count = clients[i]->maxKC -
- clients[i]->minKC + 1;
+ clients[i]->minKC + 1;
WriteEventsToClient(clients[i], 1, &core_mn);
}
@@ -152,7 +152,7 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
/***====================================================================***/
void
-XkbSendNewKeyboardNotify(DeviceIntPtr kbd,xkbNewKeyboardNotify *pNKN)
+XkbSendNewKeyboardNotify(DeviceIntPtr kbd, xkbNewKeyboardNotify * pNKN)
{
int i;
Time time = GetTimeInMillis();
@@ -161,7 +161,7 @@ XkbSendNewKeyboardNotify(DeviceIntPtr kbd,xkbNewKeyboardNotify *pNKN)
pNKN->type = XkbEventCode + XkbEventBase;
pNKN->xkbType = XkbNewKeyboardNotify;
- for (i=1; i<currentMaxClients; i++) {
+ for (i = 1; i < currentMaxClients; i++) {
if (!clients[i] || clients[i]->clientState != ClientStateRunning)
continue;
@@ -193,19 +193,19 @@ XkbSendNewKeyboardNotify(DeviceIntPtr kbd,xkbNewKeyboardNotify *pNKN)
/***====================================================================***/
void
-XkbSendStateNotify(DeviceIntPtr kbd,xkbStateNotify *pSN)
+XkbSendStateNotify(DeviceIntPtr kbd, xkbStateNotify * pSN)
{
-XkbSrvInfoPtr xkbi;
-XkbStatePtr state;
-XkbInterestPtr interest;
-Time time;
-register CARD16 changed,bState;
+ XkbSrvInfoPtr xkbi;
+ XkbStatePtr state;
+ XkbInterestPtr interest;
+ Time time;
+ register CARD16 changed, bState;
interest = kbd->xkb_interest;
if (!interest || !kbd->key || !kbd->key->xkbInfo)
- return;
+ return;
xkbi = kbd->key->xkbInfo;
- state= &xkbi->state;
+ state = &xkbi->state;
pSN->type = XkbEventCode + XkbEventBase;
pSN->xkbType = XkbStateNotify;
@@ -226,26 +226,26 @@ register CARD16 changed,bState;
pSN->compatLookupMods = state->compat_lookup_mods;
pSN->ptrBtnState = state->ptr_buttons;
changed = pSN->changed;
- bState= pSN->ptrBtnState;
+ bState = pSN->ptrBtnState;
while (interest) {
- if ((!interest->client->clientGone) &&
- (interest->client->requestVector != InitialVector) &&
- (interest->client->xkbClientFlags&_XkbClientInitialized) &&
- (interest->stateNotifyMask&changed)) {
- pSN->sequenceNumber = interest->client->sequence;
- pSN->time = time;
- pSN->changed = changed;
- pSN->ptrBtnState = bState;
- if ( interest->client->swapped ) {
- swaps(&pSN->sequenceNumber);
- swapl(&pSN->time);
- swaps(&pSN->changed);
- swaps(&pSN->ptrBtnState);
- }
- WriteToClient(interest->client, sizeof(xEvent), (char *)pSN);
- }
- interest= interest->next;
+ if ((!interest->client->clientGone) &&
+ (interest->client->requestVector != InitialVector) &&
+ (interest->client->xkbClientFlags & _XkbClientInitialized) &&
+ (interest->stateNotifyMask & changed)) {
+ pSN->sequenceNumber = interest->client->sequence;
+ pSN->time = time;
+ pSN->changed = changed;
+ pSN->ptrBtnState = bState;
+ if (interest->client->swapped) {
+ swaps(&pSN->sequenceNumber);
+ swapl(&pSN->time);
+ swaps(&pSN->changed);
+ swaps(&pSN->ptrBtnState);
+ }
+ WriteToClient(interest->client, sizeof(xEvent), (char *) pSN);
+ }
+ interest = interest->next;
}
return;
}
@@ -257,7 +257,7 @@ register CARD16 changed,bState;
* have explicitly selected for them. Core and Xi events are handled by
* XkbSendLegacyMapNotify. */
void
-XkbSendMapNotify(DeviceIntPtr kbd, xkbMapNotify *pMN)
+XkbSendMapNotify(DeviceIntPtr kbd, xkbMapNotify * pMN)
{
int i;
CARD32 time = GetTimeInMillis();
@@ -295,595 +295,599 @@ XkbSendMapNotify(DeviceIntPtr kbd, xkbMapNotify *pMN)
}
int
-XkbComputeControlsNotify( DeviceIntPtr kbd,
- XkbControlsPtr old,
- XkbControlsPtr new,
- xkbControlsNotify * pCN,
- Bool forceCtrlProc)
+XkbComputeControlsNotify(DeviceIntPtr kbd,
+ XkbControlsPtr old,
+ XkbControlsPtr new,
+ xkbControlsNotify * pCN, Bool forceCtrlProc)
{
-int i;
-CARD32 changedControls;
+ int i;
+ CARD32 changedControls;
- changedControls= 0;
+ changedControls = 0;
if (!kbd || !kbd->kbdfeed)
return 0;
-
- if (old->enabled_ctrls!=new->enabled_ctrls)
- changedControls|= XkbControlsEnabledMask;
- if ((old->repeat_delay!=new->repeat_delay)||
- (old->repeat_interval!=new->repeat_interval))
- changedControls|= XkbRepeatKeysMask;
+
+ if (old->enabled_ctrls != new->enabled_ctrls)
+ changedControls |= XkbControlsEnabledMask;
+ if ((old->repeat_delay != new->repeat_delay) ||
+ (old->repeat_interval != new->repeat_interval))
+ changedControls |= XkbRepeatKeysMask;
for (i = 0; i < XkbPerKeyBitArraySize; i++)
- if (old->per_key_repeat[i] != new->per_key_repeat[i])
- changedControls|= XkbPerKeyRepeatMask;
- if (old->slow_keys_delay!=new->slow_keys_delay)
- changedControls|= XkbSlowKeysMask;
- if (old->debounce_delay!=new->debounce_delay)
- changedControls|= XkbBounceKeysMask;
- if ((old->mk_delay!=new->mk_delay)||
- (old->mk_interval!=new->mk_interval)||
- (old->mk_dflt_btn!=new->mk_dflt_btn))
- changedControls|= XkbMouseKeysMask;
- if ((old->mk_time_to_max!=new->mk_time_to_max)||
- (old->mk_curve!=new->mk_curve)||
- (old->mk_max_speed!=new->mk_max_speed))
- changedControls|= XkbMouseKeysAccelMask;
- if (old->ax_options!=new->ax_options)
- changedControls|= XkbAccessXKeysMask;
- if ((old->ax_options^new->ax_options) & XkbAX_SKOptionsMask)
- changedControls|= XkbStickyKeysMask;
- if ((old->ax_options^new->ax_options) & XkbAX_FBOptionsMask)
- changedControls|= XkbAccessXFeedbackMask;
- if ((old->ax_timeout!=new->ax_timeout)||
- (old->axt_ctrls_mask!=new->axt_ctrls_mask)||
- (old->axt_ctrls_values!=new->axt_ctrls_values)||
- (old->axt_opts_mask!=new->axt_opts_mask)||
- (old->axt_opts_values!= new->axt_opts_values)) {
- changedControls|= XkbAccessXTimeoutMask;
+ if (old->per_key_repeat[i] != new->per_key_repeat[i])
+ changedControls |= XkbPerKeyRepeatMask;
+ if (old->slow_keys_delay != new->slow_keys_delay)
+ changedControls |= XkbSlowKeysMask;
+ if (old->debounce_delay != new->debounce_delay)
+ changedControls |= XkbBounceKeysMask;
+ if ((old->mk_delay != new->mk_delay) ||
+ (old->mk_interval != new->mk_interval) ||
+ (old->mk_dflt_btn != new->mk_dflt_btn))
+ changedControls |= XkbMouseKeysMask;
+ if ((old->mk_time_to_max != new->mk_time_to_max) ||
+ (old->mk_curve != new->mk_curve) ||
+ (old->mk_max_speed != new->mk_max_speed))
+ changedControls |= XkbMouseKeysAccelMask;
+ if (old->ax_options != new->ax_options)
+ changedControls |= XkbAccessXKeysMask;
+ if ((old->ax_options ^ new->ax_options) & XkbAX_SKOptionsMask)
+ changedControls |= XkbStickyKeysMask;
+ if ((old->ax_options ^ new->ax_options) & XkbAX_FBOptionsMask)
+ changedControls |= XkbAccessXFeedbackMask;
+ if ((old->ax_timeout != new->ax_timeout) ||
+ (old->axt_ctrls_mask != new->axt_ctrls_mask) ||
+ (old->axt_ctrls_values != new->axt_ctrls_values) ||
+ (old->axt_opts_mask != new->axt_opts_mask) ||
+ (old->axt_opts_values != new->axt_opts_values)) {
+ changedControls |= XkbAccessXTimeoutMask;
}
- if ((old->internal.mask!=new->internal.mask)||
- (old->internal.real_mods!=new->internal.real_mods)||
- (old->internal.vmods!=new->internal.vmods))
- changedControls|= XkbInternalModsMask;
- if ((old->ignore_lock.mask!=new->ignore_lock.mask)||
- (old->ignore_lock.real_mods!=new->ignore_lock.real_mods)||
- (old->ignore_lock.vmods!=new->ignore_lock.vmods))
- changedControls|= XkbIgnoreLockModsMask;
-
- if (new->enabled_ctrls&XkbRepeatKeysMask)
- kbd->kbdfeed->ctrl.autoRepeat=TRUE;
- else kbd->kbdfeed->ctrl.autoRepeat=FALSE;
+ if ((old->internal.mask != new->internal.mask) ||
+ (old->internal.real_mods != new->internal.real_mods) ||
+ (old->internal.vmods != new->internal.vmods))
+ changedControls |= XkbInternalModsMask;
+ if ((old->ignore_lock.mask != new->ignore_lock.mask) ||
+ (old->ignore_lock.real_mods != new->ignore_lock.real_mods) ||
+ (old->ignore_lock.vmods != new->ignore_lock.vmods))
+ changedControls |= XkbIgnoreLockModsMask;
+
+ if (new->enabled_ctrls & XkbRepeatKeysMask)
+ kbd->kbdfeed->ctrl.autoRepeat = TRUE;
+ else
+ kbd->kbdfeed->ctrl.autoRepeat = FALSE;
if (kbd->kbdfeed && kbd->kbdfeed->CtrlProc &&
- (changedControls || forceCtrlProc))
- (*kbd->kbdfeed->CtrlProc)(kbd, &kbd->kbdfeed->ctrl);
+ (changedControls || forceCtrlProc))
+ (*kbd->kbdfeed->CtrlProc) (kbd, &kbd->kbdfeed->ctrl);
- if ((!changedControls)&&(old->num_groups==new->num_groups))
- return 0;
+ if ((!changedControls) && (old->num_groups == new->num_groups))
+ return 0;
if (!kbd->xkb_interest)
- return 0;
+ return 0;
pCN->changedControls = changedControls;
pCN->enabledControls = new->enabled_ctrls;
- pCN->enabledControlChanges = (new->enabled_ctrls^old->enabled_ctrls);
+ pCN->enabledControlChanges = (new->enabled_ctrls ^ old->enabled_ctrls);
pCN->numGroups = new->num_groups;
return 1;
}
void
-XkbSendControlsNotify(DeviceIntPtr kbd,xkbControlsNotify *pCN)
+XkbSendControlsNotify(DeviceIntPtr kbd, xkbControlsNotify * pCN)
{
-int initialized;
-CARD32 changedControls, enabledControls, enabledChanges = 0;
-XkbSrvInfoPtr xkbi;
-XkbInterestPtr interest;
-Time time = 0;
+ int initialized;
+ CARD32 changedControls, enabledControls, enabledChanges = 0;
+ XkbSrvInfoPtr xkbi;
+ XkbInterestPtr interest;
+ Time time = 0;
interest = kbd->xkb_interest;
if (!interest || !kbd->key || !kbd->key->xkbInfo)
- return;
+ return;
xkbi = kbd->key->xkbInfo;
-
+
initialized = 0;
enabledControls = xkbi->desc->ctrls->enabled_ctrls;
changedControls = pCN->changedControls;
- pCN->numGroups= xkbi->desc->ctrls->num_groups;
+ pCN->numGroups = xkbi->desc->ctrls->num_groups;
while (interest) {
- if ((!interest->client->clientGone) &&
- (interest->client->requestVector != InitialVector) &&
- (interest->client->xkbClientFlags&_XkbClientInitialized) &&
- (interest->ctrlsNotifyMask&changedControls)) {
- if (!initialized) {
- pCN->type = XkbEventCode + XkbEventBase;
- pCN->xkbType = XkbControlsNotify;
- pCN->deviceID = kbd->id;
- pCN->time = time = GetTimeInMillis();
- enabledChanges = pCN->enabledControlChanges;
- initialized= 1;
- }
- pCN->changedControls = changedControls;
- pCN->enabledControls = enabledControls;
- pCN->enabledControlChanges = enabledChanges;
- pCN->sequenceNumber = interest->client->sequence;
- pCN->time = time;
- if ( interest->client->swapped ) {
- swaps(&pCN->sequenceNumber);
- swapl(&pCN->changedControls);
- swapl(&pCN->enabledControls);
- swapl(&pCN->enabledControlChanges);
- swapl(&pCN->time);
- }
- WriteToClient(interest->client, sizeof(xEvent), (char *)pCN);
- }
- interest= interest->next;
+ if ((!interest->client->clientGone) &&
+ (interest->client->requestVector != InitialVector) &&
+ (interest->client->xkbClientFlags & _XkbClientInitialized) &&
+ (interest->ctrlsNotifyMask & changedControls)) {
+ if (!initialized) {
+ pCN->type = XkbEventCode + XkbEventBase;
+ pCN->xkbType = XkbControlsNotify;
+ pCN->deviceID = kbd->id;
+ pCN->time = time = GetTimeInMillis();
+ enabledChanges = pCN->enabledControlChanges;
+ initialized = 1;
+ }
+ pCN->changedControls = changedControls;
+ pCN->enabledControls = enabledControls;
+ pCN->enabledControlChanges = enabledChanges;
+ pCN->sequenceNumber = interest->client->sequence;
+ pCN->time = time;
+ if (interest->client->swapped) {
+ swaps(&pCN->sequenceNumber);
+ swapl(&pCN->changedControls);
+ swapl(&pCN->enabledControls);
+ swapl(&pCN->enabledControlChanges);
+ swapl(&pCN->time);
+ }
+ WriteToClient(interest->client, sizeof(xEvent), (char *) pCN);
+ }
+ interest = interest->next;
}
return;
}
static void
-XkbSendIndicatorNotify(DeviceIntPtr kbd,int xkbType,xkbIndicatorNotify *pEv)
+XkbSendIndicatorNotify(DeviceIntPtr kbd, int xkbType, xkbIndicatorNotify * pEv)
{
-int initialized;
-XkbInterestPtr interest;
-Time time = 0;
-CARD32 state,changed;
+ int initialized;
+ XkbInterestPtr interest;
+ Time time = 0;
+ CARD32 state, changed;
interest = kbd->xkb_interest;
if (!interest)
- return;
-
+ return;
+
initialized = 0;
state = pEv->state;
changed = pEv->changed;
while (interest) {
- if ((!interest->client->clientGone) &&
- (interest->client->requestVector != InitialVector) &&
- (interest->client->xkbClientFlags&_XkbClientInitialized) &&
- (((xkbType==XkbIndicatorStateNotify)&&
- (interest->iStateNotifyMask&changed))||
- ((xkbType==XkbIndicatorMapNotify)&&
- (interest->iMapNotifyMask&changed)))) {
- if (!initialized) {
- pEv->type = XkbEventCode + XkbEventBase;
- pEv->xkbType = xkbType;
- pEv->deviceID = kbd->id;
- pEv->time = time = GetTimeInMillis();
- initialized= 1;
- }
- pEv->sequenceNumber = interest->client->sequence;
- pEv->time = time;
- pEv->changed = changed;
- pEv->state = state;
- if ( interest->client->swapped ) {
- swaps(&pEv->sequenceNumber);
- swapl(&pEv->time);
- swapl(&pEv->changed);
- swapl(&pEv->state);
- }
- WriteToClient(interest->client, sizeof(xEvent), (char *)pEv);
- }
- interest= interest->next;
+ if ((!interest->client->clientGone) &&
+ (interest->client->requestVector != InitialVector) &&
+ (interest->client->xkbClientFlags & _XkbClientInitialized) &&
+ (((xkbType == XkbIndicatorStateNotify) &&
+ (interest->iStateNotifyMask & changed)) ||
+ ((xkbType == XkbIndicatorMapNotify) &&
+ (interest->iMapNotifyMask & changed)))) {
+ if (!initialized) {
+ pEv->type = XkbEventCode + XkbEventBase;
+ pEv->xkbType = xkbType;
+ pEv->deviceID = kbd->id;
+ pEv->time = time = GetTimeInMillis();
+ initialized = 1;
+ }
+ pEv->sequenceNumber = interest->client->sequence;
+ pEv->time = time;
+ pEv->changed = changed;
+ pEv->state = state;
+ if (interest->client->swapped) {
+ swaps(&pEv->sequenceNumber);
+ swapl(&pEv->time);
+ swapl(&pEv->changed);
+ swapl(&pEv->state);
+ }
+ WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ }
+ interest = interest->next;
}
return;
}
-
void
-XkbHandleBell( BOOL force,
- BOOL eventOnly,
- DeviceIntPtr kbd,
- CARD8 percent,
- pointer pCtrl,
- CARD8 class,
- Atom name,
- WindowPtr pWin,
- ClientPtr pClient)
+XkbHandleBell(BOOL force,
+ BOOL eventOnly,
+ DeviceIntPtr kbd,
+ CARD8 percent,
+ pointer pCtrl,
+ CARD8 class, Atom name, WindowPtr pWin, ClientPtr pClient)
{
-xkbBellNotify bn;
-int initialized;
-XkbSrvInfoPtr xkbi;
-XkbInterestPtr interest;
-CARD8 id;
-CARD16 pitch,duration;
-Time time = 0;
-XID winID = 0;
+ xkbBellNotify bn;
+ int initialized;
+ XkbSrvInfoPtr xkbi;
+ XkbInterestPtr interest;
+ CARD8 id;
+ CARD16 pitch, duration;
+ Time time = 0;
+ XID winID = 0;
if (!kbd->key || !kbd->key->xkbInfo)
return;
xkbi = kbd->key->xkbInfo;
- if ((force||(xkbi->desc->ctrls->enabled_ctrls&XkbAudibleBellMask))&&
- (!eventOnly)) {
+ if ((force || (xkbi->desc->ctrls->enabled_ctrls & XkbAudibleBellMask)) &&
+ (!eventOnly)) {
if (kbd->kbdfeed->BellProc)
- (*kbd->kbdfeed->BellProc)(percent,kbd,(pointer)pCtrl,class);
+ (*kbd->kbdfeed->BellProc) (percent, kbd, (pointer) pCtrl, class);
}
interest = kbd->xkb_interest;
- if ((!interest)||(force))
- return;
-
- if ((class==0)||(class==KbdFeedbackClass)) {
- KeybdCtrl *pKeyCtrl= (KeybdCtrl *)pCtrl;
- id= pKeyCtrl->id;
- pitch= pKeyCtrl->bell_pitch;
- duration= pKeyCtrl->bell_duration;
+ if ((!interest) || (force))
+ return;
+
+ if ((class == 0) || (class == KbdFeedbackClass)) {
+ KeybdCtrl *pKeyCtrl = (KeybdCtrl *) pCtrl;
+
+ id = pKeyCtrl->id;
+ pitch = pKeyCtrl->bell_pitch;
+ duration = pKeyCtrl->bell_duration;
}
- else if (class==BellFeedbackClass) {
- BellCtrl *pBellCtrl= (BellCtrl *)pCtrl;
- id= pBellCtrl->id;
- pitch= pBellCtrl->pitch;
- duration= pBellCtrl->duration;
+ else if (class == BellFeedbackClass) {
+ BellCtrl *pBellCtrl = (BellCtrl *) pCtrl;
+
+ id = pBellCtrl->id;
+ pitch = pBellCtrl->pitch;
+ duration = pBellCtrl->duration;
}
- else return;
-
+ else
+ return;
+
initialized = 0;
while (interest) {
- if ((!interest->client->clientGone) &&
- (interest->client->requestVector != InitialVector) &&
- (interest->client->xkbClientFlags&_XkbClientInitialized) &&
- (interest->bellNotifyMask)) {
- if (!initialized) {
- time = GetTimeInMillis();
- bn.type = XkbEventCode + XkbEventBase;
- bn.xkbType = XkbBellNotify;
- bn.deviceID = kbd->id;
- bn.bellClass = class;
- bn.bellID = id;
- bn.percent= percent;
- bn.eventOnly = (eventOnly!=0);
- winID= (pWin?pWin->drawable.id:None);
- initialized= 1;
- }
- bn.sequenceNumber = interest->client->sequence;
- bn.time = time;
- bn.pitch = pitch;
- bn.duration = duration;
- bn.name = name;
- bn.window= winID;
- if ( interest->client->swapped ) {
- swaps(&bn.sequenceNumber);
- swapl(&bn.time);
- swaps(&bn.pitch);
- swaps(&bn.duration);
- swapl(&bn.name);
- swapl(&bn.window);
- }
- WriteToClient(interest->client, sizeof(xEvent), (char *)&bn);
- }
- interest= interest->next;
+ if ((!interest->client->clientGone) &&
+ (interest->client->requestVector != InitialVector) &&
+ (interest->client->xkbClientFlags & _XkbClientInitialized) &&
+ (interest->bellNotifyMask)) {
+ if (!initialized) {
+ time = GetTimeInMillis();
+ bn.type = XkbEventCode + XkbEventBase;
+ bn.xkbType = XkbBellNotify;
+ bn.deviceID = kbd->id;
+ bn.bellClass = class;
+ bn.bellID = id;
+ bn.percent = percent;
+ bn.eventOnly = (eventOnly != 0);
+ winID = (pWin ? pWin->drawable.id : None);
+ initialized = 1;
+ }
+ bn.sequenceNumber = interest->client->sequence;
+ bn.time = time;
+ bn.pitch = pitch;
+ bn.duration = duration;
+ bn.name = name;
+ bn.window = winID;
+ if (interest->client->swapped) {
+ swaps(&bn.sequenceNumber);
+ swapl(&bn.time);
+ swaps(&bn.pitch);
+ swaps(&bn.duration);
+ swapl(&bn.name);
+ swapl(&bn.window);
+ }
+ WriteToClient(interest->client, sizeof(xEvent), (char *) &bn);
+ }
+ interest = interest->next;
}
return;
}
void
-XkbSendAccessXNotify(DeviceIntPtr kbd,xkbAccessXNotify *pEv)
+XkbSendAccessXNotify(DeviceIntPtr kbd, xkbAccessXNotify * pEv)
{
-int initialized;
-XkbInterestPtr interest;
-Time time = 0;
-CARD16 sk_delay,db_delay;
+ int initialized;
+ XkbInterestPtr interest;
+ Time time = 0;
+ CARD16 sk_delay, db_delay;
interest = kbd->xkb_interest;
if (!interest)
- return;
-
+ return;
+
initialized = 0;
- sk_delay= pEv->slowKeysDelay;
- db_delay= pEv->debounceDelay;
+ sk_delay = pEv->slowKeysDelay;
+ db_delay = pEv->debounceDelay;
while (interest) {
- if ((!interest->client->clientGone) &&
- (interest->client->requestVector != InitialVector) &&
- (interest->client->xkbClientFlags&_XkbClientInitialized) &&
- (interest->accessXNotifyMask&(1<<pEv->detail))) {
- if (!initialized) {
- pEv->type = XkbEventCode + XkbEventBase;
- pEv->xkbType = XkbAccessXNotify;
- pEv->deviceID = kbd->id;
- pEv->time = time = GetTimeInMillis();
- initialized= 1;
- }
- pEv->sequenceNumber = interest->client->sequence;
- pEv->time = time;
- pEv->slowKeysDelay = sk_delay;
- pEv->debounceDelay = db_delay;
- if ( interest->client->swapped ) {
- swaps(&pEv->sequenceNumber);
- swapl(&pEv->time);
- swaps(&pEv->slowKeysDelay);
- swaps(&pEv->debounceDelay);
- }
- WriteToClient(interest->client, sizeof(xEvent), (char *)pEv);
- }
- interest= interest->next;
+ if ((!interest->client->clientGone) &&
+ (interest->client->requestVector != InitialVector) &&
+ (interest->client->xkbClientFlags & _XkbClientInitialized) &&
+ (interest->accessXNotifyMask & (1 << pEv->detail))) {
+ if (!initialized) {
+ pEv->type = XkbEventCode + XkbEventBase;
+ pEv->xkbType = XkbAccessXNotify;
+ pEv->deviceID = kbd->id;
+ pEv->time = time = GetTimeInMillis();
+ initialized = 1;
+ }
+ pEv->sequenceNumber = interest->client->sequence;
+ pEv->time = time;
+ pEv->slowKeysDelay = sk_delay;
+ pEv->debounceDelay = db_delay;
+ if (interest->client->swapped) {
+ swaps(&pEv->sequenceNumber);
+ swapl(&pEv->time);
+ swaps(&pEv->slowKeysDelay);
+ swaps(&pEv->debounceDelay);
+ }
+ WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ }
+ interest = interest->next;
}
return;
}
void
-XkbSendNamesNotify(DeviceIntPtr kbd,xkbNamesNotify *pEv)
+XkbSendNamesNotify(DeviceIntPtr kbd, xkbNamesNotify * pEv)
{
-int initialized;
-XkbInterestPtr interest;
-Time time = 0;
-CARD16 changed,changedVirtualMods;
-CARD32 changedIndicators;
+ int initialized;
+ XkbInterestPtr interest;
+ Time time = 0;
+ CARD16 changed, changedVirtualMods;
+ CARD32 changedIndicators;
interest = kbd->xkb_interest;
if (!interest)
- return;
-
+ return;
+
initialized = 0;
- changed= pEv->changed;
- changedIndicators= pEv->changedIndicators;
- changedVirtualMods= pEv->changedVirtualMods;
+ changed = pEv->changed;
+ changedIndicators = pEv->changedIndicators;
+ changedVirtualMods = pEv->changedVirtualMods;
while (interest) {
- if ((!interest->client->clientGone) &&
- (interest->client->requestVector != InitialVector) &&
- (interest->client->xkbClientFlags&_XkbClientInitialized) &&
- (interest->namesNotifyMask&pEv->changed)) {
- if (!initialized) {
- pEv->type = XkbEventCode + XkbEventBase;
- pEv->xkbType = XkbNamesNotify;
- pEv->deviceID = kbd->id;
- pEv->time = time = GetTimeInMillis();
- initialized= 1;
- }
- pEv->sequenceNumber = interest->client->sequence;
- pEv->time = time;
- pEv->changed = changed;
- pEv->changedIndicators = changedIndicators;
- pEv->changedVirtualMods= changedVirtualMods;
- if ( interest->client->swapped ) {
- swaps(&pEv->sequenceNumber);
- swapl(&pEv->time);
- swaps(&pEv->changed);
- swapl(&pEv->changedIndicators);
- swaps(&pEv->changedVirtualMods);
- }
- WriteToClient(interest->client, sizeof(xEvent), (char *)pEv);
- }
- interest= interest->next;
+ if ((!interest->client->clientGone) &&
+ (interest->client->requestVector != InitialVector) &&
+ (interest->client->xkbClientFlags & _XkbClientInitialized) &&
+ (interest->namesNotifyMask & pEv->changed)) {
+ if (!initialized) {
+ pEv->type = XkbEventCode + XkbEventBase;
+ pEv->xkbType = XkbNamesNotify;
+ pEv->deviceID = kbd->id;
+ pEv->time = time = GetTimeInMillis();
+ initialized = 1;
+ }
+ pEv->sequenceNumber = interest->client->sequence;
+ pEv->time = time;
+ pEv->changed = changed;
+ pEv->changedIndicators = changedIndicators;
+ pEv->changedVirtualMods = changedVirtualMods;
+ if (interest->client->swapped) {
+ swaps(&pEv->sequenceNumber);
+ swapl(&pEv->time);
+ swaps(&pEv->changed);
+ swapl(&pEv->changedIndicators);
+ swaps(&pEv->changedVirtualMods);
+ }
+ WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ }
+ interest = interest->next;
}
return;
}
void
-XkbSendCompatMapNotify(DeviceIntPtr kbd,xkbCompatMapNotify *pEv)
+XkbSendCompatMapNotify(DeviceIntPtr kbd, xkbCompatMapNotify * pEv)
{
-int initialized;
-XkbInterestPtr interest;
-Time time = 0;
-CARD16 firstSI = 0, nSI = 0, nTotalSI = 0;
+ int initialized;
+ XkbInterestPtr interest;
+ Time time = 0;
+ CARD16 firstSI = 0, nSI = 0, nTotalSI = 0;
interest = kbd->xkb_interest;
if (!interest)
- return;
-
+ return;
+
initialized = 0;
while (interest) {
- if ((!interest->client->clientGone) &&
- (interest->client->requestVector != InitialVector) &&
- (interest->client->xkbClientFlags&_XkbClientInitialized) &&
- (interest->compatNotifyMask)) {
- if (!initialized) {
- pEv->type = XkbEventCode + XkbEventBase;
- pEv->xkbType = XkbCompatMapNotify;
- pEv->deviceID = kbd->id;
- pEv->time = time = GetTimeInMillis();
- firstSI= pEv->firstSI;
- nSI= pEv->nSI;
- nTotalSI= pEv->nTotalSI;
- initialized= 1;
- }
- pEv->sequenceNumber = interest->client->sequence;
- pEv->time = time;
- pEv->firstSI = firstSI;
- pEv->nSI = nSI;
- pEv->nTotalSI = nTotalSI;
- if ( interest->client->swapped ) {
- swaps(&pEv->sequenceNumber);
- swapl(&pEv->time);
- swaps(&pEv->firstSI);
- swaps(&pEv->nSI);
- swaps(&pEv->nTotalSI);
- }
- WriteToClient(interest->client, sizeof(xEvent), (char *)pEv);
- }
- interest= interest->next;
+ if ((!interest->client->clientGone) &&
+ (interest->client->requestVector != InitialVector) &&
+ (interest->client->xkbClientFlags & _XkbClientInitialized) &&
+ (interest->compatNotifyMask)) {
+ if (!initialized) {
+ pEv->type = XkbEventCode + XkbEventBase;
+ pEv->xkbType = XkbCompatMapNotify;
+ pEv->deviceID = kbd->id;
+ pEv->time = time = GetTimeInMillis();
+ firstSI = pEv->firstSI;
+ nSI = pEv->nSI;
+ nTotalSI = pEv->nTotalSI;
+ initialized = 1;
+ }
+ pEv->sequenceNumber = interest->client->sequence;
+ pEv->time = time;
+ pEv->firstSI = firstSI;
+ pEv->nSI = nSI;
+ pEv->nTotalSI = nTotalSI;
+ if (interest->client->swapped) {
+ swaps(&pEv->sequenceNumber);
+ swapl(&pEv->time);
+ swaps(&pEv->firstSI);
+ swaps(&pEv->nSI);
+ swaps(&pEv->nTotalSI);
+ }
+ WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ }
+ interest = interest->next;
}
return;
}
void
-XkbSendActionMessage(DeviceIntPtr kbd,xkbActionMessage *pEv)
+XkbSendActionMessage(DeviceIntPtr kbd, xkbActionMessage * pEv)
{
-int initialized;
-XkbSrvInfoPtr xkbi;
-XkbInterestPtr interest;
-Time time = 0;
+ int initialized;
+ XkbSrvInfoPtr xkbi;
+ XkbInterestPtr interest;
+ Time time = 0;
interest = kbd->xkb_interest;
if (!interest || !kbd->key || !kbd->key->xkbInfo)
- return;
-
+ return;
+
xkbi = kbd->key->xkbInfo;
initialized = 0;
- pEv->mods= xkbi->state.mods;
- pEv->group= xkbi->state.group;
+ pEv->mods = xkbi->state.mods;
+ pEv->group = xkbi->state.group;
while (interest) {
- if ((!interest->client->clientGone) &&
- (interest->client->requestVector != InitialVector) &&
- (interest->client->xkbClientFlags&_XkbClientInitialized) &&
- (interest->actionMessageMask)) {
- if (!initialized) {
- pEv->type = XkbEventCode + XkbEventBase;
- pEv->xkbType = XkbActionMessage;
- pEv->deviceID = kbd->id;
- pEv->sequenceNumber = interest->client->sequence;
- pEv->time = time = GetTimeInMillis();
- initialized= 1;
- }
- pEv->sequenceNumber = interest->client->sequence;
- pEv->time = time;
- if ( interest->client->swapped ) {
- swaps(&pEv->sequenceNumber);
- swapl(&pEv->time);
- }
- WriteToClient(interest->client, sizeof(xEvent), (char *)pEv);
- }
- interest= interest->next;
+ if ((!interest->client->clientGone) &&
+ (interest->client->requestVector != InitialVector) &&
+ (interest->client->xkbClientFlags & _XkbClientInitialized) &&
+ (interest->actionMessageMask)) {
+ if (!initialized) {
+ pEv->type = XkbEventCode + XkbEventBase;
+ pEv->xkbType = XkbActionMessage;
+ pEv->deviceID = kbd->id;
+ pEv->sequenceNumber = interest->client->sequence;
+ pEv->time = time = GetTimeInMillis();
+ initialized = 1;
+ }
+ pEv->sequenceNumber = interest->client->sequence;
+ pEv->time = time;
+ if (interest->client->swapped) {
+ swaps(&pEv->sequenceNumber);
+ swapl(&pEv->time);
+ }
+ WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ }
+ interest = interest->next;
}
return;
}
void
-XkbSendExtensionDeviceNotify( DeviceIntPtr dev,
- ClientPtr client,
- xkbExtensionDeviceNotify * pEv)
+XkbSendExtensionDeviceNotify(DeviceIntPtr dev,
+ ClientPtr client, xkbExtensionDeviceNotify * pEv)
{
-int initialized;
-XkbInterestPtr interest;
-Time time = 0;
-CARD32 defined, state;
-CARD16 reason;
+ int initialized;
+ XkbInterestPtr interest;
+ Time time = 0;
+ CARD32 defined, state;
+ CARD16 reason;
interest = dev->xkb_interest;
if (!interest)
- return;
-
+ return;
+
initialized = 0;
- reason= pEv->reason;
- defined= pEv->ledsDefined;
- state= pEv->ledState;
+ reason = pEv->reason;
+ defined = pEv->ledsDefined;
+ state = pEv->ledState;
while (interest) {
- if ((!interest->client->clientGone) &&
- (interest->client->requestVector != InitialVector) &&
- (interest->client->xkbClientFlags&_XkbClientInitialized) &&
- (interest->extDevNotifyMask&reason)) {
- if (!initialized) {
- pEv->type = XkbEventCode + XkbEventBase;
- pEv->xkbType = XkbExtensionDeviceNotify;
- pEv->deviceID = dev->id;
- pEv->sequenceNumber = interest->client->sequence;
- pEv->time = time = GetTimeInMillis();
- initialized= 1;
- }
- else {
- pEv->sequenceNumber = interest->client->sequence;
- pEv->time = time;
- pEv->ledsDefined= defined;
- pEv->ledState= state;
- pEv->reason= reason;
- pEv->supported= XkbXI_AllFeaturesMask;
- }
- if ( interest->client->swapped ) {
- swaps(&pEv->sequenceNumber);
- swapl(&pEv->time);
- swapl(&pEv->ledsDefined);
- swapl(&pEv->ledState);
- swaps(&pEv->reason);
- swaps(&pEv->supported);
- }
- WriteToClient(interest->client, sizeof(xEvent), (char *)pEv);
- }
- interest= interest->next;
+ if ((!interest->client->clientGone) &&
+ (interest->client->requestVector != InitialVector) &&
+ (interest->client->xkbClientFlags & _XkbClientInitialized) &&
+ (interest->extDevNotifyMask & reason)) {
+ if (!initialized) {
+ pEv->type = XkbEventCode + XkbEventBase;
+ pEv->xkbType = XkbExtensionDeviceNotify;
+ pEv->deviceID = dev->id;
+ pEv->sequenceNumber = interest->client->sequence;
+ pEv->time = time = GetTimeInMillis();
+ initialized = 1;
+ }
+ else {
+ pEv->sequenceNumber = interest->client->sequence;
+ pEv->time = time;
+ pEv->ledsDefined = defined;
+ pEv->ledState = state;
+ pEv->reason = reason;
+ pEv->supported = XkbXI_AllFeaturesMask;
+ }
+ if (interest->client->swapped) {
+ swaps(&pEv->sequenceNumber);
+ swapl(&pEv->time);
+ swapl(&pEv->ledsDefined);
+ swapl(&pEv->ledState);
+ swaps(&pEv->reason);
+ swaps(&pEv->supported);
+ }
+ WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ }
+ interest = interest->next;
}
return;
}
void
-XkbSendNotification( DeviceIntPtr kbd,
- XkbChangesPtr pChanges,
- XkbEventCausePtr cause)
+XkbSendNotification(DeviceIntPtr kbd,
+ XkbChangesPtr pChanges, XkbEventCausePtr cause)
{
-XkbSrvLedInfoPtr sli;
+ XkbSrvLedInfoPtr sli;
- sli= NULL;
+ sli = NULL;
if (pChanges->state_changes) {
- xkbStateNotify sn;
- sn.changed= pChanges->state_changes;
- sn.keycode= cause->kc;
- sn.eventType= cause->event;
- sn.requestMajor= cause->mjr;
- sn.requestMinor= cause->mnr;
- XkbSendStateNotify(kbd,&sn);
+ xkbStateNotify sn;
+
+ sn.changed = pChanges->state_changes;
+ sn.keycode = cause->kc;
+ sn.eventType = cause->event;
+ sn.requestMajor = cause->mjr;
+ sn.requestMinor = cause->mnr;
+ XkbSendStateNotify(kbd, &sn);
}
if (pChanges->map.changed) {
- xkbMapNotify mn;
- memset(&mn, 0, sizeof(xkbMapNotify));
- mn.changed= pChanges->map.changed;
- mn.firstType= pChanges->map.first_type;
- mn.nTypes= pChanges->map.num_types;
- mn.firstKeySym= pChanges->map.first_key_sym;
- mn.nKeySyms= pChanges->map.num_key_syms;
- mn.firstKeyAct= pChanges->map.first_key_act;
- mn.nKeyActs= pChanges->map.num_key_acts;
- mn.firstKeyBehavior= pChanges->map.first_key_behavior;
- mn.nKeyBehaviors= pChanges->map.num_key_behaviors;
- mn.virtualMods= pChanges->map.vmods;
- mn.firstKeyExplicit= pChanges->map.first_key_explicit;
- mn.nKeyExplicit= pChanges->map.num_key_explicit;
- mn.firstModMapKey= pChanges->map.first_modmap_key;
- mn.nModMapKeys= pChanges->map.num_modmap_keys;
- mn.firstVModMapKey= pChanges->map.first_vmodmap_key;
- mn.nVModMapKeys= pChanges->map.num_vmodmap_keys;
- XkbSendMapNotify(kbd,&mn);
+ xkbMapNotify mn;
+
+ memset(&mn, 0, sizeof(xkbMapNotify));
+ mn.changed = pChanges->map.changed;
+ mn.firstType = pChanges->map.first_type;
+ mn.nTypes = pChanges->map.num_types;
+ mn.firstKeySym = pChanges->map.first_key_sym;
+ mn.nKeySyms = pChanges->map.num_key_syms;
+ mn.firstKeyAct = pChanges->map.first_key_act;
+ mn.nKeyActs = pChanges->map.num_key_acts;
+ mn.firstKeyBehavior = pChanges->map.first_key_behavior;
+ mn.nKeyBehaviors = pChanges->map.num_key_behaviors;
+ mn.virtualMods = pChanges->map.vmods;
+ mn.firstKeyExplicit = pChanges->map.first_key_explicit;
+ mn.nKeyExplicit = pChanges->map.num_key_explicit;
+ mn.firstModMapKey = pChanges->map.first_modmap_key;
+ mn.nModMapKeys = pChanges->map.num_modmap_keys;
+ mn.firstVModMapKey = pChanges->map.first_vmodmap_key;
+ mn.nVModMapKeys = pChanges->map.num_vmodmap_keys;
+ XkbSendMapNotify(kbd, &mn);
}
- if ((pChanges->ctrls.changed_ctrls)||
- (pChanges->ctrls.enabled_ctrls_changes)) {
- xkbControlsNotify cn;
- memset(&cn, 0, sizeof(xkbControlsNotify));
- cn.changedControls= pChanges->ctrls.changed_ctrls;
- cn.enabledControlChanges= pChanges->ctrls.enabled_ctrls_changes;
- cn.keycode= cause->kc;
- cn.eventType= cause->event;
- cn.requestMajor= cause->mjr;
- cn.requestMinor= cause->mnr;
- XkbSendControlsNotify(kbd,&cn);
+ if ((pChanges->ctrls.changed_ctrls) ||
+ (pChanges->ctrls.enabled_ctrls_changes)) {
+ xkbControlsNotify cn;
+
+ memset(&cn, 0, sizeof(xkbControlsNotify));
+ cn.changedControls = pChanges->ctrls.changed_ctrls;
+ cn.enabledControlChanges = pChanges->ctrls.enabled_ctrls_changes;
+ cn.keycode = cause->kc;
+ cn.eventType = cause->event;
+ cn.requestMajor = cause->mjr;
+ cn.requestMinor = cause->mnr;
+ XkbSendControlsNotify(kbd, &cn);
}
if (pChanges->indicators.map_changes) {
- xkbIndicatorNotify in;
- if (sli==NULL)
- sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0);
- memset(&in, 0, sizeof(xkbIndicatorNotify));
- in.state= sli->effectiveState;
- in.changed= pChanges->indicators.map_changes;
- XkbSendIndicatorNotify(kbd,XkbIndicatorMapNotify,&in);
+ xkbIndicatorNotify in;
+
+ if (sli == NULL)
+ sli = XkbFindSrvLedInfo(kbd, XkbDfltXIClass, XkbDfltXIId, 0);
+ memset(&in, 0, sizeof(xkbIndicatorNotify));
+ in.state = sli->effectiveState;
+ in.changed = pChanges->indicators.map_changes;
+ XkbSendIndicatorNotify(kbd, XkbIndicatorMapNotify, &in);
}
if (pChanges->indicators.state_changes) {
- xkbIndicatorNotify in;
- if (sli==NULL)
- sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0);
- memset(&in, 0, sizeof(xkbIndicatorNotify));
- in.state= sli->effectiveState;
- in.changed= pChanges->indicators.state_changes;
- XkbSendIndicatorNotify(kbd,XkbIndicatorStateNotify,&in);
+ xkbIndicatorNotify in;
+
+ if (sli == NULL)
+ sli = XkbFindSrvLedInfo(kbd, XkbDfltXIClass, XkbDfltXIId, 0);
+ memset(&in, 0, sizeof(xkbIndicatorNotify));
+ in.state = sli->effectiveState;
+ in.changed = pChanges->indicators.state_changes;
+ XkbSendIndicatorNotify(kbd, XkbIndicatorStateNotify, &in);
}
if (pChanges->names.changed) {
- xkbNamesNotify nn;
- memset(&nn, 0, sizeof(xkbNamesNotify));
- nn.changed= pChanges->names.changed;
- nn.firstType= pChanges->names.first_type;
- nn.nTypes= pChanges->names.num_types;
- nn.firstLevelName= pChanges->names.first_lvl;
- nn.nLevelNames= pChanges->names.num_lvls;
- nn.nRadioGroups= pChanges->names.num_rg;
- nn.changedVirtualMods= pChanges->names.changed_vmods;
- nn.changedIndicators= pChanges->names.changed_indicators;
- XkbSendNamesNotify(kbd,&nn);
+ xkbNamesNotify nn;
+
+ memset(&nn, 0, sizeof(xkbNamesNotify));
+ nn.changed = pChanges->names.changed;
+ nn.firstType = pChanges->names.first_type;
+ nn.nTypes = pChanges->names.num_types;
+ nn.firstLevelName = pChanges->names.first_lvl;
+ nn.nLevelNames = pChanges->names.num_lvls;
+ nn.nRadioGroups = pChanges->names.num_rg;
+ nn.changedVirtualMods = pChanges->names.changed_vmods;
+ nn.changedIndicators = pChanges->names.changed_indicators;
+ XkbSendNamesNotify(kbd, &nn);
}
- if ((pChanges->compat.changed_groups)||(pChanges->compat.num_si>0)) {
- xkbCompatMapNotify cmn;
- memset(&cmn, 0, sizeof(xkbCompatMapNotify));
- cmn.changedGroups= pChanges->compat.changed_groups;
- cmn.firstSI= pChanges->compat.first_si;
- cmn.nSI= pChanges->compat.num_si;
- cmn.nTotalSI= kbd->key->xkbInfo->desc->compat->num_si;
- XkbSendCompatMapNotify(kbd,&cmn);
+ if ((pChanges->compat.changed_groups) || (pChanges->compat.num_si > 0)) {
+ xkbCompatMapNotify cmn;
+
+ memset(&cmn, 0, sizeof(xkbCompatMapNotify));
+ cmn.changedGroups = pChanges->compat.changed_groups;
+ cmn.firstSI = pChanges->compat.first_si;
+ cmn.nSI = pChanges->compat.num_si;
+ cmn.nTotalSI = kbd->key->xkbInfo->desc->compat->num_si;
+ XkbSendCompatMapNotify(kbd, &cmn);
}
return;
}
@@ -891,7 +895,7 @@ XkbSrvLedInfoPtr sli;
/***====================================================================***/
void
-XkbFilterEvents(ClientPtr client,int nEvents,xEvent *xE)
+XkbFilterEvents(ClientPtr client, int nEvents, xEvent *xE)
{
DeviceIntPtr dev = NULL;
XkbSrvInfoPtr xkbi;
@@ -909,76 +913,78 @@ XkbFilterEvents(ClientPtr client,int nEvents,xEvent *xE)
xkbi = dev->key->xkbInfo;
if (client->xkbClientFlags & _XkbClientInitialized) {
- if ((xkbDebugFlags&0x10)&&
+ if ((xkbDebugFlags & 0x10) &&
(type == KeyPress || type == KeyRelease ||
type == DeviceKeyPress || type == DeviceKeyRelease))
- DebugF("[xkb] XkbFilterWriteEvents (XKB client): state 0x%04x\n",
+ DebugF("[xkb] XkbFilterWriteEvents (XKB client): state 0x%04x\n",
xE[0].u.keyButtonPointer.state);
- if (dev->deviceGrab.grab != NullGrab && dev->deviceGrab.fromPassiveGrab &&
- (type == KeyPress || type == KeyRelease ||
- type == DeviceKeyPress || type == DeviceKeyRelease)) {
- unsigned int state, flags;
-
- flags = client->xkbClientFlags;
- state = xkbi->state.compat_grab_mods;
- if (flags & XkbPCF_GrabsUseXKBStateMask) {
- int group;
- if (flags & XkbPCF_LookupStateWhenGrabbed) {
- group = xkbi->state.group;
- state = xkbi->state.lookup_mods;
- }
- else {
- state = xkbi->state.grab_mods;
- group = xkbi->state.base_group + xkbi->state.latched_group;
- if (group < 0 || group >= xkbi->desc->ctrls->num_groups)
- group = XkbAdjustGroup(group, xkbi->desc->ctrls);
- }
- state = XkbBuildCoreState(state, group);
- }
- else if (flags & XkbPCF_LookupStateWhenGrabbed) {
- state = xkbi->state.compat_lookup_mods;
+ if (dev->deviceGrab.grab != NullGrab && dev->deviceGrab.fromPassiveGrab
+ && (type == KeyPress || type == KeyRelease || type == DeviceKeyPress
+ || type == DeviceKeyRelease)) {
+ unsigned int state, flags;
+
+ flags = client->xkbClientFlags;
+ state = xkbi->state.compat_grab_mods;
+ if (flags & XkbPCF_GrabsUseXKBStateMask) {
+ int group;
+
+ if (flags & XkbPCF_LookupStateWhenGrabbed) {
+ group = xkbi->state.group;
+ state = xkbi->state.lookup_mods;
+ }
+ else {
+ state = xkbi->state.grab_mods;
+ group = xkbi->state.base_group + xkbi->state.latched_group;
+ if (group < 0 || group >= xkbi->desc->ctrls->num_groups)
+ group = XkbAdjustGroup(group, xkbi->desc->ctrls);
+ }
+ state = XkbBuildCoreState(state, group);
+ }
+ else if (flags & XkbPCF_LookupStateWhenGrabbed) {
+ state = xkbi->state.compat_lookup_mods;
}
- xE[0].u.keyButtonPointer.state = state;
- }
+ xE[0].u.keyButtonPointer.state = state;
+ }
}
else {
if ((xkbDebugFlags & 0x4) &&
- (xE[0].u.u.type == KeyPress || xE[0].u.u.type==KeyRelease ||
+ (xE[0].u.u.type == KeyPress || xE[0].u.u.type == KeyRelease ||
xE[0].u.u.type == DeviceKeyPress ||
xE[0].u.u.type == DeviceKeyRelease)) {
- DebugF("[xkb] XKbFilterWriteEvents (non-XKB):\n");
- DebugF("[xkb] event= 0x%04x\n",xE[0].u.keyButtonPointer.state);
- DebugF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",
+ DebugF("[xkb] XKbFilterWriteEvents (non-XKB):\n");
+ DebugF("[xkb] event= 0x%04x\n", xE[0].u.keyButtonPointer.state);
+ DebugF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",
xkbi->state.lookup_mods, xkbi->state.grab_mods);
- DebugF("[xkb] compat lookup= 0x%02x, grab= 0x%02x\n",
- xkbi->state.compat_lookup_mods, xkbi->state.compat_grab_mods);
- }
- if (type >= KeyPress && type <= MotionNotify) {
- CARD16 old, new;
-
- old = xE[0].u.keyButtonPointer.state & ~0x1f00;
- new = xE[0].u.keyButtonPointer.state & 0x1F00;
-
- if (old == XkbStateFieldFromRec(&xkbi->state))
- new |= xkbi->state.compat_lookup_mods;
- else
+ DebugF("[xkb] compat lookup= 0x%02x, grab= 0x%02x\n",
+ xkbi->state.compat_lookup_mods,
+ xkbi->state.compat_grab_mods);
+ }
+ if (type >= KeyPress && type <= MotionNotify) {
+ CARD16 old, new;
+
+ old = xE[0].u.keyButtonPointer.state & ~0x1f00;
+ new = xE[0].u.keyButtonPointer.state & 0x1F00;
+
+ if (old == XkbStateFieldFromRec(&xkbi->state))
+ new |= xkbi->state.compat_lookup_mods;
+ else
new |= xkbi->state.compat_grab_mods;
- xE[0].u.keyButtonPointer.state = new;
- }
- else if (type == EnterNotify || type == LeaveNotify) {
- xE[0].u.enterLeave.state &= 0x1F00;
- xE[0].u.enterLeave.state |= xkbi->state.compat_grab_mods;
- }
+ xE[0].u.keyButtonPointer.state = new;
+ }
+ else if (type == EnterNotify || type == LeaveNotify) {
+ xE[0].u.enterLeave.state &= 0x1F00;
+ xE[0].u.enterLeave.state |= xkbi->state.compat_grab_mods;
+ }
else if (type >= DeviceKeyPress && type <= DeviceMotionNotify) {
CARD16 old, new;
- deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer*) &xE[0];
+ deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer *) &xE[0];
old = kbp->state & ~0x1F00;
new = kbp->state & 0x1F00;
- if (old == XkbStateFieldFromRec(&xkbi->state))
- new |= xkbi->state.compat_lookup_mods;
- else
+ if (old == XkbStateFieldFromRec(&xkbi->state))
+ new |= xkbi->state.compat_lookup_mods;
+ else
new |= xkbi->state.compat_grab_mods;
kbp->state = new;
}
@@ -988,92 +994,93 @@ XkbFilterEvents(ClientPtr client,int nEvents,xEvent *xE)
/***====================================================================***/
XkbInterestPtr
-XkbFindClientResource(DevicePtr inDev,ClientPtr client)
+XkbFindClientResource(DevicePtr inDev, ClientPtr client)
{
-DeviceIntPtr dev = (DeviceIntPtr)inDev;
-XkbInterestPtr interest;
-
- if ( dev->xkb_interest ) {
- interest = dev->xkb_interest;
- while (interest){
- if (interest->client==client) {
- return interest;
- }
- interest = interest->next;
- }
+ DeviceIntPtr dev = (DeviceIntPtr) inDev;
+ XkbInterestPtr interest;
+
+ if (dev->xkb_interest) {
+ interest = dev->xkb_interest;
+ while (interest) {
+ if (interest->client == client) {
+ return interest;
+ }
+ interest = interest->next;
+ }
}
return NULL;
}
XkbInterestPtr
-XkbAddClientResource(DevicePtr inDev,ClientPtr client,XID id)
+XkbAddClientResource(DevicePtr inDev, ClientPtr client, XID id)
{
-DeviceIntPtr dev = (DeviceIntPtr)inDev;
-XkbInterestPtr interest;
+ DeviceIntPtr dev = (DeviceIntPtr) inDev;
+ XkbInterestPtr interest;
interest = dev->xkb_interest;
while (interest) {
- if (interest->client==client)
- return ((interest->resource==id)?interest:NULL);
- interest = interest->next;
+ if (interest->client == client)
+ return ((interest->resource == id) ? interest : NULL);
+ interest = interest->next;
}
interest = calloc(1, sizeof(XkbInterestRec));
if (interest) {
- interest->dev = dev;
- interest->client = client;
- interest->resource = id;
- interest->next = dev->xkb_interest;
- dev->xkb_interest= interest;
- return interest;
+ interest->dev = dev;
+ interest->client = client;
+ interest->resource = id;
+ interest->next = dev->xkb_interest;
+ dev->xkb_interest = interest;
+ return interest;
}
return NULL;
}
int
-XkbRemoveResourceClient(DevicePtr inDev,XID id)
+XkbRemoveResourceClient(DevicePtr inDev, XID id)
{
-XkbSrvInfoPtr xkbi;
-DeviceIntPtr dev = (DeviceIntPtr)inDev;
-XkbInterestPtr interest;
-Bool found;
-unsigned long autoCtrls,autoValues;
-ClientPtr client = NULL;
+ XkbSrvInfoPtr xkbi;
+ DeviceIntPtr dev = (DeviceIntPtr) inDev;
+ XkbInterestPtr interest;
+ Bool found;
+ unsigned long autoCtrls, autoValues;
+ ClientPtr client = NULL;
- found= FALSE;
+ found = FALSE;
if (!dev->key || !dev->key->xkbInfo)
return found;
- autoCtrls= autoValues= 0;
- if ( dev->xkb_interest ) {
- interest = dev->xkb_interest;
- if (interest && (interest->resource==id)){
- dev->xkb_interest = interest->next;
- autoCtrls= interest->autoCtrls;
- autoValues= interest->autoCtrlValues;
- client= interest->client;
- free(interest);
- found= TRUE;
- }
- while ((!found)&&(interest->next)) {
- if (interest->next->resource==id) {
- XkbInterestPtr victim = interest->next;
- interest->next = victim->next;
- autoCtrls= victim->autoCtrls;
- autoValues= victim->autoCtrlValues;
- client= victim->client;
- free(victim);
- found= TRUE;
- }
- interest = interest->next;
- }
+ autoCtrls = autoValues = 0;
+ if (dev->xkb_interest) {
+ interest = dev->xkb_interest;
+ if (interest && (interest->resource == id)) {
+ dev->xkb_interest = interest->next;
+ autoCtrls = interest->autoCtrls;
+ autoValues = interest->autoCtrlValues;
+ client = interest->client;
+ free(interest);
+ found = TRUE;
+ }
+ while ((!found) && (interest->next)) {
+ if (interest->next->resource == id) {
+ XkbInterestPtr victim = interest->next;
+
+ interest->next = victim->next;
+ autoCtrls = victim->autoCtrls;
+ autoValues = victim->autoCtrlValues;
+ client = victim->client;
+ free(victim);
+ found = TRUE;
+ }
+ interest = interest->next;
+ }
}
- if (found && autoCtrls && dev->key && dev->key->xkbInfo ) {
- XkbEventCauseRec cause;
+ if (found && autoCtrls && dev->key && dev->key->xkbInfo) {
+ XkbEventCauseRec cause;
- xkbi= dev->key->xkbInfo;
- XkbSetCauseXkbReq(&cause,X_kbPerClientFlags,client);
- XkbEnableDisableControls(xkbi,autoCtrls,autoValues,NULL,&cause);
+ xkbi = dev->key->xkbInfo;
+ XkbSetCauseXkbReq(&cause, X_kbPerClientFlags, client);
+ XkbEnableDisableControls(xkbi, autoCtrls, autoValues, NULL, &cause);
}
return found;
}
diff --git a/xorg-server/xkb/xkbInit.c b/xorg-server/xkb/xkbInit.c
index 219f414e2..861c2815d 100644
--- a/xorg-server/xkb/xkbInit.c
+++ b/xorg-server/xkb/xkbInit.c
@@ -75,38 +75,37 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#endif
#define MAX_TOC 16
-typedef struct _SrvXkmInfo {
- DeviceIntPtr dev;
- FILE * file;
- XkbDescPtr xkb;
+typedef struct _SrvXkmInfo {
+ DeviceIntPtr dev;
+ FILE *file;
+ XkbDescPtr xkb;
} SrvXkmInfo;
-
/***====================================================================***/
#ifndef XKB_DFLT_RULES_PROP
#define XKB_DFLT_RULES_PROP TRUE
#endif
-const char * XkbBaseDirectory= XKB_BASE_DIRECTORY;
-const char * XkbBinDirectory= XKB_BIN_DIRECTORY;
-static int XkbWantAccessX= 0;
+const char *XkbBaseDirectory = XKB_BASE_DIRECTORY;
+const char *XkbBinDirectory = XKB_BIN_DIRECTORY;
+static int XkbWantAccessX = 0;
-static char * XkbRulesDflt= NULL;
-static char * XkbModelDflt= NULL;
-static char * XkbLayoutDflt= NULL;
-static char * XkbVariantDflt= NULL;
-static char * XkbOptionsDflt= NULL;
+static char *XkbRulesDflt = NULL;
+static char *XkbModelDflt = NULL;
+static char *XkbLayoutDflt = NULL;
+static char *XkbVariantDflt = NULL;
+static char *XkbOptionsDflt = NULL;
-static char * XkbRulesUsed= NULL;
-static char * XkbModelUsed= NULL;
-static char * XkbLayoutUsed= NULL;
-static char * XkbVariantUsed= NULL;
-static char * XkbOptionsUsed= NULL;
+static char *XkbRulesUsed = NULL;
+static char *XkbModelUsed = NULL;
+static char *XkbLayoutUsed = NULL;
+static char *XkbVariantUsed = NULL;
+static char *XkbOptionsUsed = NULL;
-static XkbDescPtr xkb_cached_map = NULL;
+static XkbDescPtr xkb_cached_map = NULL;
-static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
+static Bool XkbWantRulesProp = XKB_DFLT_RULES_PROP;
/***====================================================================***/
@@ -115,17 +114,17 @@ static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
* Caller must free the data in rmlvo.
*/
void
-XkbGetRulesDflts(XkbRMLVOSet *rmlvo)
+XkbGetRulesDflts(XkbRMLVOSet * rmlvo)
{
- rmlvo->rules = strdup(XkbRulesDflt ? XkbRulesDflt : XKB_DFLT_RULES);
- rmlvo->model = strdup(XkbModelDflt ? XkbModelDflt : XKB_DFLT_MODEL);
- rmlvo->layout = strdup(XkbLayoutDflt ? XkbLayoutDflt : XKB_DFLT_LAYOUT);
- rmlvo->variant= strdup(XkbVariantDflt ? XkbVariantDflt : XKB_DFLT_VARIANT);
- rmlvo->options= strdup(XkbOptionsDflt ? XkbOptionsDflt : XKB_DFLT_OPTIONS);
+ rmlvo->rules = strdup(XkbRulesDflt ? XkbRulesDflt : XKB_DFLT_RULES);
+ rmlvo->model = strdup(XkbModelDflt ? XkbModelDflt : XKB_DFLT_MODEL);
+ rmlvo->layout = strdup(XkbLayoutDflt ? XkbLayoutDflt : XKB_DFLT_LAYOUT);
+ rmlvo->variant = strdup(XkbVariantDflt ? XkbVariantDflt : XKB_DFLT_VARIANT);
+ rmlvo->options = strdup(XkbOptionsDflt ? XkbOptionsDflt : XKB_DFLT_OPTIONS);
}
void
-XkbFreeRMLVOSet(XkbRMLVOSet *rmlvo, Bool freeRMLVO)
+XkbFreeRMLVOSet(XkbRMLVOSet * rmlvo, Bool freeRMLVO)
{
if (!rmlvo)
return;
@@ -145,107 +144,108 @@ XkbFreeRMLVOSet(XkbRMLVOSet *rmlvo, Bool freeRMLVO)
static Bool
XkbWriteRulesProp(ClientPtr client, pointer closure)
{
-int len,out;
-Atom name;
-char * pval;
-
- len= (XkbRulesUsed?strlen(XkbRulesUsed):0);
- len+= (XkbModelUsed?strlen(XkbModelUsed):0);
- len+= (XkbLayoutUsed?strlen(XkbLayoutUsed):0);
- len+= (XkbVariantUsed?strlen(XkbVariantUsed):0);
- len+= (XkbOptionsUsed?strlen(XkbOptionsUsed):0);
- if (len<1)
- return TRUE;
-
- len+= 5; /* trailing NULs */
-
- name= MakeAtom(_XKB_RF_NAMES_PROP_ATOM,strlen(_XKB_RF_NAMES_PROP_ATOM),1);
- if (name==None) {
- ErrorF("[xkb] Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM);
- return TRUE;
- }
- pval= (char*) malloc(len);
+ int len, out;
+ Atom name;
+ char *pval;
+
+ len = (XkbRulesUsed ? strlen(XkbRulesUsed) : 0);
+ len += (XkbModelUsed ? strlen(XkbModelUsed) : 0);
+ len += (XkbLayoutUsed ? strlen(XkbLayoutUsed) : 0);
+ len += (XkbVariantUsed ? strlen(XkbVariantUsed) : 0);
+ len += (XkbOptionsUsed ? strlen(XkbOptionsUsed) : 0);
+ if (len < 1)
+ return TRUE;
+
+ len += 5; /* trailing NULs */
+
+ name =
+ MakeAtom(_XKB_RF_NAMES_PROP_ATOM, strlen(_XKB_RF_NAMES_PROP_ATOM), 1);
+ if (name == None) {
+ ErrorF("[xkb] Atom error: %s not created\n", _XKB_RF_NAMES_PROP_ATOM);
+ return TRUE;
+ }
+ pval = (char *) malloc(len);
if (!pval) {
- ErrorF("[xkb] Allocation error: %s proprerty not created\n",
- _XKB_RF_NAMES_PROP_ATOM);
- return TRUE;
+ ErrorF("[xkb] Allocation error: %s proprerty not created\n",
+ _XKB_RF_NAMES_PROP_ATOM);
+ return TRUE;
}
- out= 0;
+ out = 0;
if (XkbRulesUsed) {
- strcpy(&pval[out],XkbRulesUsed);
- out+= strlen(XkbRulesUsed);
+ strcpy(&pval[out], XkbRulesUsed);
+ out += strlen(XkbRulesUsed);
}
- pval[out++]= '\0';
+ pval[out++] = '\0';
if (XkbModelUsed) {
- strcpy(&pval[out],XkbModelUsed);
- out+= strlen(XkbModelUsed);
- }
- pval[out++]= '\0';
+ strcpy(&pval[out], XkbModelUsed);
+ out += strlen(XkbModelUsed);
+ }
+ pval[out++] = '\0';
if (XkbLayoutUsed) {
- strcpy(&pval[out],XkbLayoutUsed);
- out+= strlen(XkbLayoutUsed);
+ strcpy(&pval[out], XkbLayoutUsed);
+ out += strlen(XkbLayoutUsed);
}
- pval[out++]= '\0';
+ pval[out++] = '\0';
if (XkbVariantUsed) {
- strcpy(&pval[out],XkbVariantUsed);
- out+= strlen(XkbVariantUsed);
+ strcpy(&pval[out], XkbVariantUsed);
+ out += strlen(XkbVariantUsed);
}
- pval[out++]= '\0';
+ pval[out++] = '\0';
if (XkbOptionsUsed) {
- strcpy(&pval[out],XkbOptionsUsed);
- out+= strlen(XkbOptionsUsed);
+ strcpy(&pval[out], XkbOptionsUsed);
+ out += strlen(XkbOptionsUsed);
}
- pval[out++]= '\0';
- if (out!=len) {
- ErrorF("[xkb] Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
- out,len);
+ pval[out++] = '\0';
+ if (out != len) {
+ ErrorF("[xkb] Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
+ out, len);
}
- dixChangeWindowProperty(serverClient, screenInfo.screens[0]->root, name, XA_STRING, 8,
- PropModeReplace, len, pval, TRUE);
+ dixChangeWindowProperty(serverClient, screenInfo.screens[0]->root, name,
+ XA_STRING, 8, PropModeReplace, len, pval, TRUE);
free(pval);
return TRUE;
}
static void
-XkbSetRulesUsed(XkbRMLVOSet *rmlvo)
+XkbSetRulesUsed(XkbRMLVOSet * rmlvo)
{
free(XkbRulesUsed);
- XkbRulesUsed= (rmlvo->rules?Xstrdup(rmlvo->rules):NULL);
+ XkbRulesUsed = (rmlvo->rules ? Xstrdup(rmlvo->rules) : NULL);
free(XkbModelUsed);
- XkbModelUsed= (rmlvo->model?Xstrdup(rmlvo->model):NULL);
+ XkbModelUsed = (rmlvo->model ? Xstrdup(rmlvo->model) : NULL);
free(XkbLayoutUsed);
- XkbLayoutUsed= (rmlvo->layout?Xstrdup(rmlvo->layout):NULL);
+ XkbLayoutUsed = (rmlvo->layout ? Xstrdup(rmlvo->layout) : NULL);
free(XkbVariantUsed);
- XkbVariantUsed= (rmlvo->variant?Xstrdup(rmlvo->variant):NULL);
+ XkbVariantUsed = (rmlvo->variant ? Xstrdup(rmlvo->variant) : NULL);
free(XkbOptionsUsed);
- XkbOptionsUsed= (rmlvo->options?Xstrdup(rmlvo->options):NULL);
+ XkbOptionsUsed = (rmlvo->options ? Xstrdup(rmlvo->options) : NULL);
if (XkbWantRulesProp)
- QueueWorkProc(XkbWriteRulesProp,NULL,NULL);
+ QueueWorkProc(XkbWriteRulesProp, NULL, NULL);
return;
}
void
-XkbSetRulesDflts(XkbRMLVOSet *rmlvo)
+XkbSetRulesDflts(XkbRMLVOSet * rmlvo)
{
if (rmlvo->rules) {
free(XkbRulesDflt);
- XkbRulesDflt= Xstrdup(rmlvo->rules);
+ XkbRulesDflt = Xstrdup(rmlvo->rules);
}
if (rmlvo->model) {
- free(XkbModelDflt);
- XkbModelDflt= Xstrdup(rmlvo->model);
+ free(XkbModelDflt);
+ XkbModelDflt = Xstrdup(rmlvo->model);
}
if (rmlvo->layout) {
- free(XkbLayoutDflt);
- XkbLayoutDflt= Xstrdup(rmlvo->layout);
+ free(XkbLayoutDflt);
+ XkbLayoutDflt = Xstrdup(rmlvo->layout);
}
if (rmlvo->variant) {
- free(XkbVariantDflt);
- XkbVariantDflt= Xstrdup(rmlvo->variant);
+ free(XkbVariantDflt);
+ XkbVariantDflt = Xstrdup(rmlvo->variant);
}
if (rmlvo->options) {
- free(XkbOptionsDflt);
- XkbOptionsDflt= Xstrdup(rmlvo->options);
+ free(XkbOptionsDflt);
+ XkbOptionsDflt = Xstrdup(rmlvo->options);
}
return;
}
@@ -271,7 +271,7 @@ XkbDeleteRulesDflts(void)
#define DIFFERS(a, b) (strcmp((a) ? (a) : "", (b) ? (b) : "") != 0)
static Bool
-XkbCompareUsedRMLVO(XkbRMLVOSet *rmlvo)
+XkbCompareUsedRMLVO(XkbRMLVOSet * rmlvo)
{
if (DIFFERS(rmlvo->rules, XkbRulesUsed) ||
DIFFERS(rmlvo->model, XkbModelUsed) ||
@@ -295,13 +295,12 @@ XkbInitKeyTypes(XkbDescPtr xkb)
return TRUE;
initTypeNames(NULL);
- if (XkbAllocClientMap(xkb,XkbKeyTypesMask,num_dflt_types)!=Success)
- return FALSE;
- if (XkbCopyKeyTypes(dflt_types,xkb->map->types,num_dflt_types)!=
- Success) {
- return FALSE;
+ if (XkbAllocClientMap(xkb, XkbKeyTypesMask, num_dflt_types) != Success)
+ return FALSE;
+ if (XkbCopyKeyTypes(dflt_types, xkb->map->types, num_dflt_types) != Success) {
+ return FALSE;
}
- xkb->map->size_types= xkb->map->num_types= num_dflt_types;
+ xkb->map->size_types = xkb->map->num_types = num_dflt_types;
return TRUE;
}
@@ -313,31 +312,32 @@ XkbInitRadioGroups(XkbSrvInfoPtr xkbi)
return;
}
-
static Status
XkbInitCompatStructs(XkbDescPtr xkb)
{
-register int i;
-XkbCompatMapPtr compat;
+ register int i;
+ XkbCompatMapPtr compat;
if (xkb->defined & XkmCompatMapMask)
return TRUE;
- if (XkbAllocCompatMap(xkb,XkbAllCompatMask,num_dfltSI)!=Success)
- return BadAlloc;
+ if (XkbAllocCompatMap(xkb, XkbAllCompatMask, num_dfltSI) != Success)
+ return BadAlloc;
compat = xkb->compat;
if (compat->sym_interpret) {
- compat->num_si = num_dfltSI;
- memcpy((char *)compat->sym_interpret,(char *)dfltSI,sizeof(dfltSI));
- }
- for (i=0;i<XkbNumKbdGroups;i++) {
- compat->groups[i]= compatMap.groups[i];
- if (compat->groups[i].vmods!=0) {
- unsigned mask;
- mask= XkbMaskForVMask(xkb,compat->groups[i].vmods);
- compat->groups[i].mask= compat->groups[i].real_mods|mask;
- }
- else compat->groups[i].mask= compat->groups[i].real_mods;
+ compat->num_si = num_dfltSI;
+ memcpy((char *) compat->sym_interpret, (char *) dfltSI, sizeof(dfltSI));
+ }
+ for (i = 0; i < XkbNumKbdGroups; i++) {
+ compat->groups[i] = compatMap.groups[i];
+ if (compat->groups[i].vmods != 0) {
+ unsigned mask;
+
+ mask = XkbMaskForVMask(xkb, compat->groups[i].vmods);
+ compat->groups[i].mask = compat->groups[i].real_mods | mask;
+ }
+ else
+ compat->groups[i].mask = compat->groups[i].real_mods;
}
return Success;
}
@@ -355,49 +355,56 @@ XkbInitSemantics(XkbDescPtr xkb)
static Status
XkbInitNames(XkbSrvInfoPtr xkbi)
{
-XkbDescPtr xkb;
-XkbNamesPtr names;
-Status rtrn;
-Atom unknown;
-
- xkb= xkbi->desc;
- if ((rtrn=XkbAllocNames(xkb,XkbAllNamesMask,0,0))!=Success)
- return rtrn;
- unknown= CREATE_ATOM("unknown");
+ XkbDescPtr xkb;
+ XkbNamesPtr names;
+ Status rtrn;
+ Atom unknown;
+
+ xkb = xkbi->desc;
+ if ((rtrn = XkbAllocNames(xkb, XkbAllNamesMask, 0, 0)) != Success)
+ return rtrn;
+ unknown = CREATE_ATOM("unknown");
names = xkb->names;
- if (names->keycodes==None) names->keycodes= unknown;
- if (names->geometry==None) names->geometry= unknown;
- if (names->phys_symbols==None) names->phys_symbols= unknown;
- if (names->symbols==None) names->symbols= unknown;
- if (names->types==None) names->types= unknown;
- if (names->compat==None) names->compat= unknown;
+ if (names->keycodes == None)
+ names->keycodes = unknown;
+ if (names->geometry == None)
+ names->geometry = unknown;
+ if (names->phys_symbols == None)
+ names->phys_symbols = unknown;
+ if (names->symbols == None)
+ names->symbols = unknown;
+ if (names->types == None)
+ names->types = unknown;
+ if (names->compat == None)
+ names->compat = unknown;
if (!(xkb->defined & XkmVirtualModsMask)) {
- if (names->vmods[vmod_NumLock]==None)
- names->vmods[vmod_NumLock]= CREATE_ATOM("NumLock");
- if (names->vmods[vmod_Alt]==None)
- names->vmods[vmod_Alt]= CREATE_ATOM("Alt");
- if (names->vmods[vmod_AltGr]==None)
- names->vmods[vmod_AltGr]= CREATE_ATOM("ModeSwitch");
+ if (names->vmods[vmod_NumLock] == None)
+ names->vmods[vmod_NumLock] = CREATE_ATOM("NumLock");
+ if (names->vmods[vmod_Alt] == None)
+ names->vmods[vmod_Alt] = CREATE_ATOM("Alt");
+ if (names->vmods[vmod_AltGr] == None)
+ names->vmods[vmod_AltGr] = CREATE_ATOM("ModeSwitch");
}
if (!(xkb->defined & XkmIndicatorsMask) ||
!(xkb->defined & XkmGeometryMask)) {
- initIndicatorNames(NULL,xkb);
- if (names->indicators[LED_CAPS-1]==None)
- names->indicators[LED_CAPS-1] = CREATE_ATOM("Caps Lock");
- if (names->indicators[LED_NUM-1]==None)
- names->indicators[LED_NUM-1] = CREATE_ATOM("Num Lock");
- if (names->indicators[LED_SCROLL-1]==None)
- names->indicators[LED_SCROLL-1] = CREATE_ATOM("Scroll Lock");
+ initIndicatorNames(NULL, xkb);
+ if (names->indicators[LED_CAPS - 1] == None)
+ names->indicators[LED_CAPS - 1] = CREATE_ATOM("Caps Lock");
+ if (names->indicators[LED_NUM - 1] == None)
+ names->indicators[LED_NUM - 1] = CREATE_ATOM("Num Lock");
+ if (names->indicators[LED_SCROLL - 1] == None)
+ names->indicators[LED_SCROLL - 1] = CREATE_ATOM("Scroll Lock");
#ifdef LED_COMPOSE
- if (names->indicators[LED_COMPOSE-1]==None)
- names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose");
+ if (names->indicators[LED_COMPOSE - 1] == None)
+ names->indicators[LED_COMPOSE - 1] = CREATE_ATOM("Compose");
#endif
}
- if (xkb->geom!=NULL)
- names->geometry= xkb->geom->name;
- else names->geometry= unknown;
+ if (xkb->geom != NULL)
+ names->geometry = xkb->geom->name;
+ else
+ names->geometry = unknown;
return Success;
}
@@ -405,75 +412,74 @@ Atom unknown;
static Status
XkbInitIndicatorMap(XkbSrvInfoPtr xkbi)
{
-XkbDescPtr xkb;
-XkbIndicatorPtr map;
-XkbSrvLedInfoPtr sli;
+ XkbDescPtr xkb;
+ XkbIndicatorPtr map;
+ XkbSrvLedInfoPtr sli;
- xkb= xkbi->desc;
- if (XkbAllocIndicatorMaps(xkb)!=Success)
- return BadAlloc;
+ xkb = xkbi->desc;
+ if (XkbAllocIndicatorMaps(xkb) != Success)
+ return BadAlloc;
if (!(xkb->defined & XkmIndicatorsMask)) {
- map= xkb->indicators;
+ map = xkb->indicators;
map->phys_indicators = PHYS_LEDS;
- map->maps[LED_CAPS-1].flags= XkbIM_NoExplicit;
- map->maps[LED_CAPS-1].which_mods= XkbIM_UseLocked;
- map->maps[LED_CAPS-1].mods.mask= LockMask;
- map->maps[LED_CAPS-1].mods.real_mods= LockMask;
+ map->maps[LED_CAPS - 1].flags = XkbIM_NoExplicit;
+ map->maps[LED_CAPS - 1].which_mods = XkbIM_UseLocked;
+ map->maps[LED_CAPS - 1].mods.mask = LockMask;
+ map->maps[LED_CAPS - 1].mods.real_mods = LockMask;
- map->maps[LED_NUM-1].flags= XkbIM_NoExplicit;
- map->maps[LED_NUM-1].which_mods= XkbIM_UseLocked;
- map->maps[LED_NUM-1].mods.mask= 0;
- map->maps[LED_NUM-1].mods.real_mods= 0;
- map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask;
+ map->maps[LED_NUM - 1].flags = XkbIM_NoExplicit;
+ map->maps[LED_NUM - 1].which_mods = XkbIM_UseLocked;
+ map->maps[LED_NUM - 1].mods.mask = 0;
+ map->maps[LED_NUM - 1].mods.real_mods = 0;
+ map->maps[LED_NUM - 1].mods.vmods = vmod_NumLockMask;
- map->maps[LED_SCROLL-1].flags= XkbIM_NoExplicit;
- map->maps[LED_SCROLL-1].which_mods= XkbIM_UseLocked;
- map->maps[LED_SCROLL-1].mods.mask= Mod3Mask;
- map->maps[LED_SCROLL-1].mods.real_mods= Mod3Mask;
+ map->maps[LED_SCROLL - 1].flags = XkbIM_NoExplicit;
+ map->maps[LED_SCROLL - 1].which_mods = XkbIM_UseLocked;
+ map->maps[LED_SCROLL - 1].mods.mask = Mod3Mask;
+ map->maps[LED_SCROLL - 1].mods.real_mods = Mod3Mask;
}
- sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0);
+ sli = XkbFindSrvLedInfo(xkbi->device, XkbDfltXIClass, XkbDfltXIId, 0);
if (sli)
- XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask);
+ XkbCheckIndicatorMaps(xkbi->device, sli, XkbAllIndicatorsMask);
return Success;
}
static Status
-XkbInitControls(DeviceIntPtr pXDev,XkbSrvInfoPtr xkbi)
+XkbInitControls(DeviceIntPtr pXDev, XkbSrvInfoPtr xkbi)
{
-XkbDescPtr xkb;
-XkbControlsPtr ctrls;
+ XkbDescPtr xkb;
+ XkbControlsPtr ctrls;
- xkb= xkbi->desc;
+ xkb = xkbi->desc;
/* 12/31/94 (ef) -- XXX! Should check if controls loaded from file */
- if (XkbAllocControls(xkb,XkbAllControlsMask)!=Success)
- FatalError("Couldn't allocate keyboard controls\n");
- ctrls= xkb->ctrls;
+ if (XkbAllocControls(xkb, XkbAllControlsMask) != Success)
+ FatalError("Couldn't allocate keyboard controls\n");
+ ctrls = xkb->ctrls;
if (!(xkb->defined & XkmSymbolsMask))
ctrls->num_groups = 1;
- ctrls->groups_wrap = XkbSetGroupInfo(1,XkbWrapIntoRange,0);
+ ctrls->groups_wrap = XkbSetGroupInfo(1, XkbWrapIntoRange, 0);
ctrls->internal.mask = 0;
ctrls->internal.real_mods = 0;
ctrls->internal.vmods = 0;
ctrls->ignore_lock.mask = 0;
ctrls->ignore_lock.real_mods = 0;
ctrls->ignore_lock.vmods = 0;
- ctrls->enabled_ctrls = XkbAccessXTimeoutMask|XkbRepeatKeysMask|
- XkbMouseKeysAccelMask|XkbAudibleBellMask|
- XkbIgnoreGroupLockMask;
+ ctrls->enabled_ctrls = XkbAccessXTimeoutMask | XkbRepeatKeysMask |
+ XkbMouseKeysAccelMask | XkbAudibleBellMask | XkbIgnoreGroupLockMask;
if (XkbWantAccessX)
- ctrls->enabled_ctrls|= XkbAccessXKeysMask;
+ ctrls->enabled_ctrls |= XkbAccessXKeysMask;
AccessXInit(pXDev);
return Success;
}
_X_EXPORT Bool
-InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
+InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
{
- int i;
+ int i;
unsigned int check;
XkbSrvInfoPtr xkbi;
XkbDescPtr xkb;
@@ -483,15 +489,13 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
XkbRMLVOSet rmlvo_dflts = { NULL };
if (dev->key || dev->kbdfeed)
- return FALSE;
+ return FALSE;
- if (!rmlvo)
- {
+ if (!rmlvo) {
rmlvo = &rmlvo_dflts;
XkbGetRulesDflts(rmlvo);
}
-
memset(&changes, 0, sizeof(changes));
XkbSetCauseUnknown(&cause);
@@ -585,11 +589,11 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId, 0);
if (sli)
- XkbCheckIndicatorMaps(dev, sli, XkbAllIndicatorsMask);
+ XkbCheckIndicatorMaps(dev, sli, XkbAllIndicatorsMask);
else
DebugF("XKB: No indicator feedback in XkbFinishInit!\n");
- dev->kbdfeed->CtrlProc(dev,&dev->kbdfeed->ctrl);
+ dev->kbdfeed->CtrlProc(dev, &dev->kbdfeed->ctrl);
XkbSetRulesDflts(rmlvo);
XkbSetRulesUsed(rmlvo);
@@ -597,63 +601,62 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
return TRUE;
-unwind_desc:
+ unwind_desc:
XkbFreeKeyboard(xkb, 0, TRUE);
-unwind_info:
+ unwind_info:
free(xkbi);
dev->key->xkbInfo = NULL;
-unwind_kbdfeed:
+ unwind_kbdfeed:
free(dev->kbdfeed);
dev->kbdfeed = NULL;
-unwind_key:
+ unwind_key:
free(dev->key);
dev->key = NULL;
return FALSE;
}
-
/***====================================================================***/
- /*
- * Be very careful about what does and doesn't get freed by this
- * function. To reduce fragmentation, XkbInitDevice allocates a
- * single huge block per device and divides it up into most of the
- * fixed-size structures for the device. Don't free anything that
- * is part of this larger block.
- */
+ /*
+ * Be very careful about what does and doesn't get freed by this
+ * function. To reduce fragmentation, XkbInitDevice allocates a
+ * single huge block per device and divides it up into most of the
+ * fixed-size structures for the device. Don't free anything that
+ * is part of this larger block.
+ */
void
XkbFreeInfo(XkbSrvInfoPtr xkbi)
{
free(xkbi->radioGroups);
xkbi->radioGroups = NULL;
if (xkbi->mouseKeyTimer) {
- TimerFree(xkbi->mouseKeyTimer);
- xkbi->mouseKeyTimer= NULL;
+ TimerFree(xkbi->mouseKeyTimer);
+ xkbi->mouseKeyTimer = NULL;
}
if (xkbi->slowKeysTimer) {
- TimerFree(xkbi->slowKeysTimer);
- xkbi->slowKeysTimer= NULL;
+ TimerFree(xkbi->slowKeysTimer);
+ xkbi->slowKeysTimer = NULL;
}
if (xkbi->bounceKeysTimer) {
- TimerFree(xkbi->bounceKeysTimer);
- xkbi->bounceKeysTimer= NULL;
+ TimerFree(xkbi->bounceKeysTimer);
+ xkbi->bounceKeysTimer = NULL;
}
if (xkbi->repeatKeyTimer) {
- TimerFree(xkbi->repeatKeyTimer);
- xkbi->repeatKeyTimer= NULL;
+ TimerFree(xkbi->repeatKeyTimer);
+ xkbi->repeatKeyTimer = NULL;
}
if (xkbi->krgTimer) {
- TimerFree(xkbi->krgTimer);
- xkbi->krgTimer= NULL;
+ TimerFree(xkbi->krgTimer);
+ xkbi->krgTimer = NULL;
}
- xkbi->beepType= _BEEP_NONE;
+ xkbi->beepType = _BEEP_NONE;
if (xkbi->beepTimer) {
- TimerFree(xkbi->beepTimer);
- xkbi->beepTimer= NULL;
+ TimerFree(xkbi->beepTimer);
+ xkbi->beepTimer = NULL;
}
if (xkbi->desc) {
- XkbFreeKeyboard(xkbi->desc,XkbAllComponentsMask,TRUE);
- xkbi->desc= NULL;
+ XkbFreeKeyboard(xkbi->desc, XkbAllComponentsMask, TRUE);
+ xkbi->desc = NULL;
}
free(xkbi);
return;
@@ -661,88 +664,92 @@ XkbFreeInfo(XkbSrvInfoPtr xkbi)
/***====================================================================***/
-extern int XkbDfltRepeatDelay;
-extern int XkbDfltRepeatInterval;
+extern int XkbDfltRepeatDelay;
+extern int XkbDfltRepeatInterval;
-extern unsigned short XkbDfltAccessXTimeout;
-extern unsigned int XkbDfltAccessXTimeoutMask;
-extern unsigned int XkbDfltAccessXFeedback;
+extern unsigned short XkbDfltAccessXTimeout;
+extern unsigned int XkbDfltAccessXTimeoutMask;
+extern unsigned int XkbDfltAccessXFeedback;
extern unsigned short XkbDfltAccessXOptions;
int
-XkbProcessArguments(int argc,char *argv[],int i)
+XkbProcessArguments(int argc, char *argv[], int i)
{
if (strncmp(argv[i], "-xkbdir", 7) == 0) {
- if(++i < argc) {
+ if (++i < argc) {
#if !defined(WIN32) && !defined(__CYGWIN__)
- if (getuid() != geteuid()) {
- LogMessage(X_WARNING, "-xkbdir is not available for setuid X servers\n");
- return -1;
- } else
+ if (getuid() != geteuid()) {
+ LogMessage(X_WARNING,
+ "-xkbdir is not available for setuid X servers\n");
+ return -1;
+ }
+ else
#endif
- {
- if (strlen(argv[i]) < PATH_MAX) {
- XkbBaseDirectory= argv[i];
- return 2;
- } else {
- LogMessage(X_ERROR, "-xkbdir pathname too long\n");
- return -1;
- }
- }
- }
- else {
- return -1;
- }
- }
- else if ((strncmp(argv[i],"-accessx",8)==0)||
- (strncmp(argv[i],"+accessx",8)==0)) {
- int j=1;
- if (argv[i][0]=='-')
- XkbWantAccessX= 0;
- else {
- XkbWantAccessX= 1;
-
- if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
- XkbDfltAccessXTimeout = atoi(argv[++i]);
- j++;
-
- if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
- /*
- * presumption that the reasonably useful range of
- * values fits in 0..MAXINT since SunOS 4 doesn't
- * have strtoul.
- */
- XkbDfltAccessXTimeoutMask=(unsigned int)
- strtol(argv[++i],NULL,16);
- j++;
- }
- if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
- if (argv[++i][0] == '1' )
- XkbDfltAccessXFeedback=XkbAccessXFeedbackMask;
- else
- XkbDfltAccessXFeedback=0;
- j++;
- }
- if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
- XkbDfltAccessXOptions=(unsigned short)
- strtol(argv[++i],NULL,16);
- j++;
- }
- }
- }
- return j;
- }
- if ((strcmp(argv[i], "-ardelay") == 0) ||
- (strcmp (argv[i], "-ar1") == 0)) { /* -ardelay int */
- if (++i >= argc) UseMsg ();
- XkbDfltRepeatDelay = (long)atoi(argv[i]);
- return 2;
- }
- if ((strcmp(argv[i], "-arinterval") == 0) ||
- (strcmp (argv[i], "-ar2") == 0)) { /* -arinterval int */
- if (++i >= argc) UseMsg ();
- XkbDfltRepeatInterval = (long)atoi(argv[i]);
- return 2;
+ {
+ if (strlen(argv[i]) < PATH_MAX) {
+ XkbBaseDirectory = argv[i];
+ return 2;
+ }
+ else {
+ LogMessage(X_ERROR, "-xkbdir pathname too long\n");
+ return -1;
+ }
+ }
+ }
+ else {
+ return -1;
+ }
+ }
+ else if ((strncmp(argv[i], "-accessx", 8) == 0) ||
+ (strncmp(argv[i], "+accessx", 8) == 0)) {
+ int j = 1;
+
+ if (argv[i][0] == '-')
+ XkbWantAccessX = 0;
+ else {
+ XkbWantAccessX = 1;
+
+ if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
+ XkbDfltAccessXTimeout = atoi(argv[++i]);
+ j++;
+
+ if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
+ /*
+ * presumption that the reasonably useful range of
+ * values fits in 0..MAXINT since SunOS 4 doesn't
+ * have strtoul.
+ */
+ XkbDfltAccessXTimeoutMask = (unsigned int)
+ strtol(argv[++i], NULL, 16);
+ j++;
+ }
+ if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
+ if (argv[++i][0] == '1')
+ XkbDfltAccessXFeedback = XkbAccessXFeedbackMask;
+ else
+ XkbDfltAccessXFeedback = 0;
+ j++;
+ }
+ if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
+ XkbDfltAccessXOptions=(unsigned short)
+ strtol(argv[++i], NULL, 16);
+ j++;
+ }
+ }
+ }
+ return j;
+ }
+ if ((strcmp(argv[i], "-ardelay") == 0) || (strcmp(argv[i], "-ar1") == 0)) { /* -ardelay int */
+ if (++i >= argc)
+ UseMsg();
+ XkbDfltRepeatDelay = (long) atoi(argv[i]);
+ return 2;
+ }
+ if ((strcmp(argv[i], "-arinterval") == 0) || (strcmp(argv[i], "-ar2") == 0)) { /* -arinterval int */
+ if (++i >= argc)
+ UseMsg();
+ XkbDfltRepeatInterval = (long) atoi(argv[i]);
+ return 2;
}
return 0;
}
@@ -750,7 +757,8 @@ XkbProcessArguments(int argc,char *argv[],int i)
void
XkbUseMsg(void)
{
- ErrorF("[+-]accessx [ timeout [ timeout_mask [ feedback [ options_mask] ] ] ]\n");
+ ErrorF
+ ("[+-]accessx [ timeout [ timeout_mask [ feedback [ options_mask] ] ] ]\n");
ErrorF(" enable/disable accessx key sequences\n");
ErrorF("-ardelay set XKB autorepeat delay\n");
ErrorF("-arinterval set XKB autorepeat interval\n");
diff --git a/xorg-server/xkb/xkbLEDs.c b/xorg-server/xkb/xkbLEDs.c
index 24fcd3b48..e1e22d178 100644
--- a/xorg-server/xkb/xkbLEDs.c
+++ b/xorg-server/xkb/xkbLEDs.c
@@ -42,347 +42,358 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***====================================================================***/
- /*
- * unsigned
- * XkbIndicatorsToUpdate(dev,changed,check_devs_rtrn)
- *
- * Given a keyboard and a set of state components that have changed,
- * this function returns the indicators on the default keyboard
- * feedback that might be affected. It also reports whether or not
- * any extension devices might be affected in check_devs_rtrn.
- */
+ /*
+ * unsigned
+ * XkbIndicatorsToUpdate(dev,changed,check_devs_rtrn)
+ *
+ * Given a keyboard and a set of state components that have changed,
+ * this function returns the indicators on the default keyboard
+ * feedback that might be affected. It also reports whether or not
+ * any extension devices might be affected in check_devs_rtrn.
+ */
unsigned
-XkbIndicatorsToUpdate( DeviceIntPtr dev,
- unsigned long state_changes,
- Bool enable_changes)
+XkbIndicatorsToUpdate(DeviceIntPtr dev,
+ unsigned long state_changes, Bool enable_changes)
{
-register unsigned update= 0;
-XkbSrvLedInfoPtr sli;
+ register unsigned update = 0;
+ XkbSrvLedInfoPtr sli;
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId, 0);
if (!sli)
return update;
- if (state_changes&(XkbModifierStateMask|XkbGroupStateMask))
- update|= sli->usesEffective;
- if (state_changes&(XkbModifierBaseMask|XkbGroupBaseMask))
- update|= sli->usesBase;
- if (state_changes&(XkbModifierLatchMask|XkbGroupLatchMask))
- update|= sli->usesLatched;
- if (state_changes&(XkbModifierLockMask|XkbGroupLockMask))
- update|= sli->usesLocked;
- if (state_changes&XkbCompatStateMask)
- update|= sli->usesCompat;
+ if (state_changes & (XkbModifierStateMask | XkbGroupStateMask))
+ update |= sli->usesEffective;
+ if (state_changes & (XkbModifierBaseMask | XkbGroupBaseMask))
+ update |= sli->usesBase;
+ if (state_changes & (XkbModifierLatchMask | XkbGroupLatchMask))
+ update |= sli->usesLatched;
+ if (state_changes & (XkbModifierLockMask | XkbGroupLockMask))
+ update |= sli->usesLocked;
+ if (state_changes & XkbCompatStateMask)
+ update |= sli->usesCompat;
if (enable_changes)
- update|= sli->usesControls;
+ update |= sli->usesControls;
return update;
}
/***====================================================================***/
- /*
- * Bool
- *XkbApplyLEDChangeToKeyboard(xkbi,map,on,change)
- *
- * Some indicators "drive" the keyboard when their state is explicitly
- * changed, as described in section 9.2.1 of the XKB protocol spec.
- * This function updates the state and controls for the keyboard
- * specified by 'xkbi' to reflect any changes that are required
- * when the indicator described by 'map' is turned on or off. The
- * extent of the changes is reported in change, which must be defined.
- */
+ /*
+ * Bool
+ *XkbApplyLEDChangeToKeyboard(xkbi,map,on,change)
+ *
+ * Some indicators "drive" the keyboard when their state is explicitly
+ * changed, as described in section 9.2.1 of the XKB protocol spec.
+ * This function updates the state and controls for the keyboard
+ * specified by 'xkbi' to reflect any changes that are required
+ * when the indicator described by 'map' is turned on or off. The
+ * extent of the changes is reported in change, which must be defined.
+ */
static Bool
-XkbApplyLEDChangeToKeyboard( XkbSrvInfoPtr xkbi,
- XkbIndicatorMapPtr map,
- Bool on,
- XkbChangesPtr change)
+XkbApplyLEDChangeToKeyboard(XkbSrvInfoPtr xkbi,
+ XkbIndicatorMapPtr map,
+ Bool on, XkbChangesPtr change)
{
-Bool ctrlChange,stateChange;
-XkbStatePtr state;
+ Bool ctrlChange, stateChange;
+ XkbStatePtr state;
- if ((map->flags&XkbIM_NoExplicit)||((map->flags&XkbIM_LEDDrivesKB)==0))
- return FALSE;
- ctrlChange= stateChange= FALSE;
+ if ((map->flags & XkbIM_NoExplicit) ||
+ ((map->flags & XkbIM_LEDDrivesKB) == 0))
+ return FALSE;
+ ctrlChange = stateChange = FALSE;
if (map->ctrls) {
- XkbControlsPtr ctrls= xkbi->desc->ctrls;
- unsigned old;
-
- old= ctrls->enabled_ctrls;
- if (on) ctrls->enabled_ctrls|= map->ctrls;
- else ctrls->enabled_ctrls&= ~map->ctrls;
- if (old!=ctrls->enabled_ctrls) {
- change->ctrls.changed_ctrls= XkbControlsEnabledMask;
- change->ctrls.enabled_ctrls_changes= old^ctrls->enabled_ctrls;
- ctrlChange= TRUE;
- }
- }
- state= &xkbi->state;
- if ((map->groups)&&((map->which_groups&(~XkbIM_UseBase))!=0)) {
- register int i;
- register unsigned bit,match;
-
- if (on) match= (map->groups)&XkbAllGroupsMask;
- else match= (~map->groups)&XkbAllGroupsMask;
- if (map->which_groups&(XkbIM_UseLocked|XkbIM_UseEffective)) {
- for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) {
- if (bit&match)
- break;
- }
- if (map->which_groups&XkbIM_UseLatched)
- XkbLatchGroup(xkbi->device,0); /* unlatch group */
- state->locked_group= i;
- stateChange= TRUE;
- }
- else if (map->which_groups&(XkbIM_UseLatched|XkbIM_UseEffective)) {
- for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) {
- if (bit&match)
- break;
- }
- state->locked_group= 0;
- XkbLatchGroup(xkbi->device,i);
- stateChange= TRUE;
- }
- }
- if ((map->mods.mask)&&((map->which_mods&(~XkbIM_UseBase))!=0)) {
- if (map->which_mods&(XkbIM_UseLocked|XkbIM_UseEffective)) {
- register unsigned long old;
- old= state->locked_mods;
- if (on) state->locked_mods|= map->mods.mask;
- else state->locked_mods&= ~map->mods.mask;
- if (state->locked_mods!=old)
- stateChange= TRUE;
- }
- if (map->which_mods&(XkbIM_UseLatched|XkbIM_UseEffective)) {
- register unsigned long newmods;
- newmods= state->latched_mods;
- if (on) newmods|= map->mods.mask;
- else newmods&= ~map->mods.mask;
- if (newmods!=state->locked_mods) {
- newmods&= map->mods.mask;
- XkbLatchModifiers(xkbi->device,map->mods.mask,newmods);
- stateChange= TRUE;
- }
- }
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ unsigned old;
+
+ old = ctrls->enabled_ctrls;
+ if (on)
+ ctrls->enabled_ctrls |= map->ctrls;
+ else
+ ctrls->enabled_ctrls &= ~map->ctrls;
+ if (old != ctrls->enabled_ctrls) {
+ change->ctrls.changed_ctrls = XkbControlsEnabledMask;
+ change->ctrls.enabled_ctrls_changes = old ^ ctrls->enabled_ctrls;
+ ctrlChange = TRUE;
+ }
+ }
+ state = &xkbi->state;
+ if ((map->groups) && ((map->which_groups & (~XkbIM_UseBase)) != 0)) {
+ register int i;
+ register unsigned bit, match;
+
+ if (on)
+ match = (map->groups) & XkbAllGroupsMask;
+ else
+ match = (~map->groups) & XkbAllGroupsMask;
+ if (map->which_groups & (XkbIM_UseLocked | XkbIM_UseEffective)) {
+ for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
+ if (bit & match)
+ break;
+ }
+ if (map->which_groups & XkbIM_UseLatched)
+ XkbLatchGroup(xkbi->device, 0); /* unlatch group */
+ state->locked_group = i;
+ stateChange = TRUE;
+ }
+ else if (map->which_groups & (XkbIM_UseLatched | XkbIM_UseEffective)) {
+ for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
+ if (bit & match)
+ break;
+ }
+ state->locked_group = 0;
+ XkbLatchGroup(xkbi->device, i);
+ stateChange = TRUE;
+ }
+ }
+ if ((map->mods.mask) && ((map->which_mods & (~XkbIM_UseBase)) != 0)) {
+ if (map->which_mods & (XkbIM_UseLocked | XkbIM_UseEffective)) {
+ register unsigned long old;
+
+ old = state->locked_mods;
+ if (on)
+ state->locked_mods |= map->mods.mask;
+ else
+ state->locked_mods &= ~map->mods.mask;
+ if (state->locked_mods != old)
+ stateChange = TRUE;
+ }
+ if (map->which_mods & (XkbIM_UseLatched | XkbIM_UseEffective)) {
+ register unsigned long newmods;
+
+ newmods = state->latched_mods;
+ if (on)
+ newmods |= map->mods.mask;
+ else
+ newmods &= ~map->mods.mask;
+ if (newmods != state->locked_mods) {
+ newmods &= map->mods.mask;
+ XkbLatchModifiers(xkbi->device, map->mods.mask, newmods);
+ stateChange = TRUE;
+ }
+ }
}
return stateChange || ctrlChange;
}
-
- /*
- * Bool
- * ComputeAutoState(map,state,ctrls)
- *
- * This function reports the effect of applying the specified
- * indicator map given the specified state and controls, as
- * described in section 9.2 of the XKB protocol specification.
- */
+
+ /*
+ * Bool
+ * ComputeAutoState(map,state,ctrls)
+ *
+ * This function reports the effect of applying the specified
+ * indicator map given the specified state and controls, as
+ * described in section 9.2 of the XKB protocol specification.
+ */
static Bool
-ComputeAutoState( XkbIndicatorMapPtr map,
- XkbStatePtr state,
- XkbControlsPtr ctrls)
+ComputeAutoState(XkbIndicatorMapPtr map,
+ XkbStatePtr state, XkbControlsPtr ctrls)
{
-Bool on;
-CARD8 mods,group;
-
- on= FALSE;
- mods= group= 0;
- if (map->which_mods&XkbIM_UseAnyMods) {
- if (map->which_mods&XkbIM_UseBase)
- mods|= state->base_mods;
- if (map->which_mods&XkbIM_UseLatched)
- mods|= state->latched_mods;
- if (map->which_mods&XkbIM_UseLocked)
- mods|= state->locked_mods;
- if (map->which_mods&XkbIM_UseEffective)
- mods|= state->mods;
- if (map->which_mods&XkbIM_UseCompat)
- mods|= state->compat_state;
- on = ((map->mods.mask&mods)!=0);
- on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0));
- }
- if (map->which_groups&XkbIM_UseAnyGroup) {
- if (map->which_groups&XkbIM_UseBase)
- group|= (1L << state->base_group);
- if (map->which_groups&XkbIM_UseLatched)
- group|= (1L << state->latched_group);
- if (map->which_groups&XkbIM_UseLocked)
- group|= (1L << state->locked_group);
- if (map->which_groups&XkbIM_UseEffective)
- group|= (1L << state->group);
- on = on||(((map->groups&group)!=0)||(map->groups==0));
+ Bool on;
+ CARD8 mods, group;
+
+ on = FALSE;
+ mods = group = 0;
+ if (map->which_mods & XkbIM_UseAnyMods) {
+ if (map->which_mods & XkbIM_UseBase)
+ mods |= state->base_mods;
+ if (map->which_mods & XkbIM_UseLatched)
+ mods |= state->latched_mods;
+ if (map->which_mods & XkbIM_UseLocked)
+ mods |= state->locked_mods;
+ if (map->which_mods & XkbIM_UseEffective)
+ mods |= state->mods;
+ if (map->which_mods & XkbIM_UseCompat)
+ mods |= state->compat_state;
+ on = ((map->mods.mask & mods) != 0);
+ on = on || ((mods == 0) && (map->mods.mask == 0) &&
+ (map->mods.vmods == 0));
+ }
+ if (map->which_groups & XkbIM_UseAnyGroup) {
+ if (map->which_groups & XkbIM_UseBase)
+ group |= (1L << state->base_group);
+ if (map->which_groups & XkbIM_UseLatched)
+ group |= (1L << state->latched_group);
+ if (map->which_groups & XkbIM_UseLocked)
+ group |= (1L << state->locked_group);
+ if (map->which_groups & XkbIM_UseEffective)
+ group |= (1L << state->group);
+ on = on || (((map->groups & group) != 0) || (map->groups == 0));
}
if (map->ctrls)
- on = on||(ctrls->enabled_ctrls&map->ctrls);
+ on = on || (ctrls->enabled_ctrls & map->ctrls);
return on;
}
-
static void
-XkbUpdateLedAutoState( DeviceIntPtr dev,
- XkbSrvLedInfoPtr sli,
- unsigned maps_to_check,
- xkbExtensionDeviceNotify * ed,
- XkbChangesPtr changes,
- XkbEventCausePtr cause)
+XkbUpdateLedAutoState(DeviceIntPtr dev,
+ XkbSrvLedInfoPtr sli,
+ unsigned maps_to_check,
+ xkbExtensionDeviceNotify * ed,
+ XkbChangesPtr changes, XkbEventCausePtr cause)
{
-DeviceIntPtr kbd;
-XkbStatePtr state;
-XkbControlsPtr ctrls;
-XkbChangesRec my_changes;
-xkbExtensionDeviceNotify my_ed;
-register unsigned i,bit,affected;
-register XkbIndicatorMapPtr map;
-unsigned oldState;
-
- if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0))
- return;
+ DeviceIntPtr kbd;
+ XkbStatePtr state;
+ XkbControlsPtr ctrls;
+ XkbChangesRec my_changes;
+ xkbExtensionDeviceNotify my_ed;
+ register unsigned i, bit, affected;
+ register XkbIndicatorMapPtr map;
+ unsigned oldState;
+
+ if ((maps_to_check == 0) || (sli->maps == NULL) || (sli->mapsPresent == 0))
+ return;
if (dev->key && dev->key->xkbInfo)
- kbd= dev;
- else kbd= inputInfo.keyboard;
-
- state= &kbd->key->xkbInfo->state;
- ctrls= kbd->key->xkbInfo->desc->ctrls;
- affected= maps_to_check;
- oldState= sli->effectiveState;
- sli->autoState&= ~affected;
- for (i=0,bit=1;(i<XkbNumIndicators)&&(affected);i++,bit<<=1) {
- if ((affected&bit)==0)
- continue;
- affected&= ~bit;
- map= &sli->maps[i];
- if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls))
- sli->autoState|= bit;
- }
- sli->effectiveState= (sli->autoState|sli->explicitState);
- affected= sli->effectiveState^oldState;
- if (affected==0)
- return;
-
- if (ed==NULL) {
- ed= &my_ed;
- memset((char *)ed, 0, sizeof(xkbExtensionDeviceNotify));
- }
- else if ((ed->reason&XkbXI_IndicatorsMask)&&
- ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) {
- XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
- }
-
- if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) {
- if (changes==NULL) {
- changes= &my_changes;
- memset((char *)changes, 0, sizeof(XkbChangesRec));
- }
- changes->indicators.state_changes|= affected;
- }
-
- ed->reason|= XkbXI_IndicatorStateMask;
- ed->ledClass= sli->class;
- ed->ledID= sli->id;
- ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
- ed->ledState= sli->effectiveState;
- ed->unsupported= 0;
- ed->supported= XkbXI_AllFeaturesMask;
-
- if (changes!=&my_changes) changes= NULL;
- if (ed!=&my_ed) ed= NULL;
+ kbd = dev;
+ else
+ kbd = inputInfo.keyboard;
+
+ state = &kbd->key->xkbInfo->state;
+ ctrls = kbd->key->xkbInfo->desc->ctrls;
+ affected = maps_to_check;
+ oldState = sli->effectiveState;
+ sli->autoState &= ~affected;
+ for (i = 0, bit = 1; (i < XkbNumIndicators) && (affected); i++, bit <<= 1) {
+ if ((affected & bit) == 0)
+ continue;
+ affected &= ~bit;
+ map = &sli->maps[i];
+ if ((!(map->flags & XkbIM_NoAutomatic)) &&
+ ComputeAutoState(map, state, ctrls))
+ sli->autoState |= bit;
+ }
+ sli->effectiveState = (sli->autoState | sli->explicitState);
+ affected = sli->effectiveState ^ oldState;
+ if (affected == 0)
+ return;
+
+ if (ed == NULL) {
+ ed = &my_ed;
+ memset((char *) ed, 0, sizeof(xkbExtensionDeviceNotify));
+ }
+ else if ((ed->reason & XkbXI_IndicatorsMask) &&
+ ((ed->ledClass != sli->class) || (ed->ledID != sli->id))) {
+ XkbFlushLedEvents(dev, kbd, sli, ed, changes, cause);
+ }
+
+ if ((kbd == dev) && (sli->flags & XkbSLI_IsDefault)) {
+ if (changes == NULL) {
+ changes = &my_changes;
+ memset((char *) changes, 0, sizeof(XkbChangesRec));
+ }
+ changes->indicators.state_changes |= affected;
+ }
+
+ ed->reason |= XkbXI_IndicatorStateMask;
+ ed->ledClass = sli->class;
+ ed->ledID = sli->id;
+ ed->ledsDefined = sli->namesPresent | sli->mapsPresent;
+ ed->ledState = sli->effectiveState;
+ ed->unsupported = 0;
+ ed->supported = XkbXI_AllFeaturesMask;
+
+ if (changes != &my_changes)
+ changes = NULL;
+ if (ed != &my_ed)
+ ed = NULL;
if (changes || ed)
- XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
+ XkbFlushLedEvents(dev, kbd, sli, ed, changes, cause);
return;
}
static void
-XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause)
+XkbUpdateAllDeviceIndicators(XkbChangesPtr changes, XkbEventCausePtr cause)
{
-DeviceIntPtr edev;
-XkbSrvLedInfoPtr sli;
-
- for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) {
- if (edev->kbdfeed) {
- KbdFeedbackPtr kf;
- for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) {
- if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL))
- continue;
- sli= kf->xkb_sli;
- XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL,
- changes,cause);
-
- }
- }
- if (edev->leds) {
- LedFeedbackPtr lf;
- for (lf=edev->leds;lf!=NULL;lf=lf->next) {
- if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL))
- continue;
- sli= lf->xkb_sli;
- XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL,
- changes,cause);
-
- }
- }
+ DeviceIntPtr edev;
+ XkbSrvLedInfoPtr sli;
+
+ for (edev = inputInfo.devices; edev != NULL; edev = edev->next) {
+ if (edev->kbdfeed) {
+ KbdFeedbackPtr kf;
+
+ for (kf = edev->kbdfeed; kf != NULL; kf = kf->next) {
+ if ((kf->xkb_sli == NULL) || (kf->xkb_sli->maps == NULL))
+ continue;
+ sli = kf->xkb_sli;
+ XkbUpdateLedAutoState(edev, sli, sli->mapsPresent, NULL,
+ changes, cause);
+
+ }
+ }
+ if (edev->leds) {
+ LedFeedbackPtr lf;
+
+ for (lf = edev->leds; lf != NULL; lf = lf->next) {
+ if ((lf->xkb_sli == NULL) || (lf->xkb_sli->maps == NULL))
+ continue;
+ sli = lf->xkb_sli;
+ XkbUpdateLedAutoState(edev, sli, sli->mapsPresent, NULL,
+ changes, cause);
+
+ }
+ }
}
return;
}
-
/***====================================================================***/
- /*
- * void
- * XkbSetIndicators(dev,affect,values,cause)
- *
- * Attempts to change the indicators specified in 'affect' to the
- * states specified in 'values' for the default keyboard feedback
- * on the keyboard specified by 'dev.' Attempts to change indicator
- * state might be ignored or have no affect, depending on the XKB
- * indicator map for any affected indicators, as described in section
- * 9.2 of the XKB protocol specification.
- *
- * If 'changes' is non-NULL, this function notes any changes to the
- * keyboard state, controls, or indicator state that result from this
- * attempted change. If 'changes' is NULL, this function generates
- * XKB events to report any such changes to interested clients.
- *
- * If 'cause' is non-NULL, it specifies the reason for the change,
- * as reported in some XKB events. If it is NULL, this function
- * assumes that the change is the result of a core protocol
- * ChangeKeyboardMapping request.
- */
+ /*
+ * void
+ * XkbSetIndicators(dev,affect,values,cause)
+ *
+ * Attempts to change the indicators specified in 'affect' to the
+ * states specified in 'values' for the default keyboard feedback
+ * on the keyboard specified by 'dev.' Attempts to change indicator
+ * state might be ignored or have no affect, depending on the XKB
+ * indicator map for any affected indicators, as described in section
+ * 9.2 of the XKB protocol specification.
+ *
+ * If 'changes' is non-NULL, this function notes any changes to the
+ * keyboard state, controls, or indicator state that result from this
+ * attempted change. If 'changes' is NULL, this function generates
+ * XKB events to report any such changes to interested clients.
+ *
+ * If 'cause' is non-NULL, it specifies the reason for the change,
+ * as reported in some XKB events. If it is NULL, this function
+ * assumes that the change is the result of a core protocol
+ * ChangeKeyboardMapping request.
+ */
void
-XkbSetIndicators( DeviceIntPtr dev,
- CARD32 affect,
- CARD32 values,
- XkbEventCausePtr cause)
+XkbSetIndicators(DeviceIntPtr dev,
+ CARD32 affect, CARD32 values, XkbEventCausePtr cause)
{
-XkbSrvLedInfoPtr sli;
-XkbChangesRec changes;
-xkbExtensionDeviceNotify ed;
-unsigned side_affected;
-
- memset((char *)&changes, 0, sizeof(XkbChangesRec));
- memset((char *)&ed, 0, sizeof(xkbExtensionDeviceNotify));
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
- sli->explicitState&= ~affect;
- sli->explicitState|= (affect&values);
- XkbApplyLedStateChanges(dev,sli,affect,&ed,&changes,cause);
-
- side_affected= 0;
- if (changes.state_changes!=0)
- side_affected|= XkbIndicatorsToUpdate(dev,changes.state_changes,FALSE);
+ XkbSrvLedInfoPtr sli;
+ XkbChangesRec changes;
+ xkbExtensionDeviceNotify ed;
+ unsigned side_affected;
+
+ memset((char *) &changes, 0, sizeof(XkbChangesRec));
+ memset((char *) &ed, 0, sizeof(xkbExtensionDeviceNotify));
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId, 0);
+ sli->explicitState &= ~affect;
+ sli->explicitState |= (affect & values);
+ XkbApplyLedStateChanges(dev, sli, affect, &ed, &changes, cause);
+
+ side_affected = 0;
+ if (changes.state_changes != 0)
+ side_affected |=
+ XkbIndicatorsToUpdate(dev, changes.state_changes, FALSE);
if (changes.ctrls.enabled_ctrls_changes)
- side_affected|= sli->usesControls;
+ side_affected |= sli->usesControls;
if (side_affected) {
- XkbUpdateLedAutoState(dev,sli,side_affected,&ed,&changes,cause);
- affect|= side_affected;
+ XkbUpdateLedAutoState(dev, sli, side_affected, &ed, &changes, cause);
+ affect |= side_affected;
}
if (changes.state_changes || changes.ctrls.enabled_ctrls_changes)
- XkbUpdateAllDeviceIndicators(NULL,cause);
+ XkbUpdateAllDeviceIndicators(NULL, cause);
- XkbFlushLedEvents(dev,dev,sli,&ed,&changes,cause);
+ XkbFlushLedEvents(dev, dev, sli, &ed, &changes, cause);
return;
}
@@ -390,36 +401,35 @@ unsigned side_affected;
/***====================================================================***/
- /*
- * void
- * XkbUpdateIndicators(dev,update,check_edevs,changes,cause)
- *
- * Applies the indicator maps for any indicators specified in
- * 'update' from the default keyboard feedback on the device
- * specified by 'dev.'
- *
- * If 'changes' is NULL, this function generates and XKB events
- * required to report the necessary changes, otherwise it simply
- * notes the indicators with changed state.
- *
- * If 'check_edevs' is TRUE, this function also checks the indicator
- * maps for any open extension devices that have them, and updates
- * the state of any extension device indicators as necessary.
- */
+ /*
+ * void
+ * XkbUpdateIndicators(dev,update,check_edevs,changes,cause)
+ *
+ * Applies the indicator maps for any indicators specified in
+ * 'update' from the default keyboard feedback on the device
+ * specified by 'dev.'
+ *
+ * If 'changes' is NULL, this function generates and XKB events
+ * required to report the necessary changes, otherwise it simply
+ * notes the indicators with changed state.
+ *
+ * If 'check_edevs' is TRUE, this function also checks the indicator
+ * maps for any open extension devices that have them, and updates
+ * the state of any extension device indicators as necessary.
+ */
void
-XkbUpdateIndicators( DeviceIntPtr dev,
- register CARD32 update,
- Bool check_edevs,
- XkbChangesPtr changes,
- XkbEventCausePtr cause)
+XkbUpdateIndicators(DeviceIntPtr dev,
+ register CARD32 update,
+ Bool check_edevs,
+ XkbChangesPtr changes, XkbEventCausePtr cause)
{
-XkbSrvLedInfoPtr sli;
+ XkbSrvLedInfoPtr sli;
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
- XkbUpdateLedAutoState(dev,sli,update,NULL,changes,cause);
+ sli = XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId, 0);
+ XkbUpdateLedAutoState(dev, sli, update, NULL, changes, cause);
if (check_edevs)
- XkbUpdateAllDeviceIndicators(changes,cause);
+ XkbUpdateAllDeviceIndicators(changes, cause);
return;
}
@@ -427,192 +437,196 @@ XkbSrvLedInfoPtr sli;
/***====================================================================***/
- /*
- * void
- * XkbCheckIndicatorMaps(dev,sli,which)
- *
- * Updates the 'indicator accelerators' for the indicators specified
- * by 'which' in the feedback specified by 'sli.' The indicator
- * accelerators are internal to the server and are used to simplify
- * and speed up the process of figuring out which indicators might
- * be affected by a particular change in keyboard state or controls.
- */
+ /*
+ * void
+ * XkbCheckIndicatorMaps(dev,sli,which)
+ *
+ * Updates the 'indicator accelerators' for the indicators specified
+ * by 'which' in the feedback specified by 'sli.' The indicator
+ * accelerators are internal to the server and are used to simplify
+ * and speed up the process of figuring out which indicators might
+ * be affected by a particular change in keyboard state or controls.
+ */
void
-XkbCheckIndicatorMaps(DeviceIntPtr dev,XkbSrvLedInfoPtr sli,unsigned which)
+XkbCheckIndicatorMaps(DeviceIntPtr dev, XkbSrvLedInfoPtr sli, unsigned which)
{
-register unsigned i,bit;
-XkbIndicatorMapPtr map;
-XkbDescPtr xkb;
+ register unsigned i, bit;
+ XkbIndicatorMapPtr map;
+ XkbDescPtr xkb;
- if ((sli->flags&XkbSLI_HasOwnState)==0)
+ if ((sli->flags & XkbSLI_HasOwnState) == 0)
return;
- sli->usesBase&= ~which;
- sli->usesLatched&= ~which;
- sli->usesLocked&= ~which;
- sli->usesEffective&= ~which;
- sli->usesCompat&= ~which;
- sli->usesControls&= ~which;
- sli->mapsPresent&= ~which;
-
- xkb= dev->key->xkbInfo->desc;
- for (i=0,bit=1,map=sli->maps;i<XkbNumIndicators;i++,bit<<=1,map++) {
- if (which&bit) {
- CARD8 what;
-
- if (!map || !XkbIM_InUse(map))
- continue;
- sli->mapsPresent|= bit;
-
- what= (map->which_mods|map->which_groups);
- if (what&XkbIM_UseBase)
- sli->usesBase|= bit;
- if (what&XkbIM_UseLatched)
- sli->usesLatched|= bit;
- if (what&XkbIM_UseLocked)
- sli->usesLocked|= bit;
- if (what&XkbIM_UseEffective)
- sli->usesEffective|= bit;
- if (what&XkbIM_UseCompat)
- sli->usesCompat|= bit;
- if (map->ctrls)
- sli->usesControls|= bit;
-
- map->mods.mask= map->mods.real_mods;
- if (map->mods.vmods!=0) {
- map->mods.mask|= XkbMaskForVMask(xkb,map->mods.vmods);
- }
- }
- }
- sli->usedComponents= 0;
+ sli->usesBase &= ~which;
+ sli->usesLatched &= ~which;
+ sli->usesLocked &= ~which;
+ sli->usesEffective &= ~which;
+ sli->usesCompat &= ~which;
+ sli->usesControls &= ~which;
+ sli->mapsPresent &= ~which;
+
+ xkb = dev->key->xkbInfo->desc;
+ for (i = 0, bit = 1, map = sli->maps; i < XkbNumIndicators;
+ i++, bit <<= 1, map++) {
+ if (which & bit) {
+ CARD8 what;
+
+ if (!map || !XkbIM_InUse(map))
+ continue;
+ sli->mapsPresent |= bit;
+
+ what = (map->which_mods | map->which_groups);
+ if (what & XkbIM_UseBase)
+ sli->usesBase |= bit;
+ if (what & XkbIM_UseLatched)
+ sli->usesLatched |= bit;
+ if (what & XkbIM_UseLocked)
+ sli->usesLocked |= bit;
+ if (what & XkbIM_UseEffective)
+ sli->usesEffective |= bit;
+ if (what & XkbIM_UseCompat)
+ sli->usesCompat |= bit;
+ if (map->ctrls)
+ sli->usesControls |= bit;
+
+ map->mods.mask = map->mods.real_mods;
+ if (map->mods.vmods != 0) {
+ map->mods.mask |= XkbMaskForVMask(xkb, map->mods.vmods);
+ }
+ }
+ }
+ sli->usedComponents = 0;
if (sli->usesBase)
- sli->usedComponents|= XkbModifierBaseMask|XkbGroupBaseMask;
+ sli->usedComponents |= XkbModifierBaseMask | XkbGroupBaseMask;
if (sli->usesLatched)
- sli->usedComponents|= XkbModifierLatchMask|XkbGroupLatchMask;
+ sli->usedComponents |= XkbModifierLatchMask | XkbGroupLatchMask;
if (sli->usesLocked)
- sli->usedComponents|= XkbModifierLockMask|XkbGroupLockMask;
+ sli->usedComponents |= XkbModifierLockMask | XkbGroupLockMask;
if (sli->usesEffective)
- sli->usedComponents|= XkbModifierStateMask|XkbGroupStateMask;
+ sli->usedComponents |= XkbModifierStateMask | XkbGroupStateMask;
if (sli->usesCompat)
- sli->usedComponents|= XkbCompatStateMask;
+ sli->usedComponents |= XkbCompatStateMask;
return;
}
/***====================================================================***/
- /*
- * XkbSrvLedInfoPtr
- * XkbAllocSrvLedInfo(dev,kf,lf,needed_parts)
- *
- * Allocates an XkbSrvLedInfoPtr for the feedback specified by either
- * 'kf' or 'lf' on the keyboard specified by 'dev.'
- *
- * If 'needed_parts' is non-zero, this function makes sure that any
- * of the parts speicified therein are allocated.
- */
+ /*
+ * XkbSrvLedInfoPtr
+ * XkbAllocSrvLedInfo(dev,kf,lf,needed_parts)
+ *
+ * Allocates an XkbSrvLedInfoPtr for the feedback specified by either
+ * 'kf' or 'lf' on the keyboard specified by 'dev.'
+ *
+ * If 'needed_parts' is non-zero, this function makes sure that any
+ * of the parts speicified therein are allocated.
+ */
XkbSrvLedInfoPtr
-XkbAllocSrvLedInfo( DeviceIntPtr dev,
- KbdFeedbackPtr kf,
- LedFeedbackPtr lf,
- unsigned needed_parts)
+XkbAllocSrvLedInfo(DeviceIntPtr dev,
+ KbdFeedbackPtr kf, LedFeedbackPtr lf, unsigned needed_parts)
{
-XkbSrvLedInfoPtr sli;
-Bool checkAccel;
-Bool checkNames;
-
- sli= NULL;
- checkAccel= checkNames= FALSE;
- if ((kf!=NULL)&&(kf->xkb_sli==NULL)) {
- kf->xkb_sli= sli= calloc(1, sizeof(XkbSrvLedInfoRec));
- if (sli==NULL)
- return NULL; /* ALLOCATION ERROR */
- if (dev->key && dev->key->xkbInfo)
- sli->flags= XkbSLI_HasOwnState;
- else sli->flags= 0;
- sli->class= KbdFeedbackClass;
- sli->id= kf->ctrl.id;
- sli->fb.kf= kf;
-
- sli->autoState= 0;
- sli->explicitState= kf->ctrl.leds;
- sli->effectiveState= kf->ctrl.leds;
-
- if ((kf==dev->kbdfeed) && (dev->key) && (dev->key->xkbInfo)) {
- XkbDescPtr xkb;
- xkb= dev->key->xkbInfo->desc;
- sli->flags|= XkbSLI_IsDefault;
- sli->physIndicators= xkb->indicators->phys_indicators;
- sli->names= xkb->names->indicators;
- sli->maps= xkb->indicators->maps;
- checkNames= checkAccel= TRUE;
- }
- else {
- sli->physIndicators= XkbAllIndicatorsMask;
- sli->names= NULL;
- sli->maps= NULL;
- }
- }
- else if ((kf!=NULL)&&((kf->xkb_sli->flags&XkbSLI_IsDefault)!=0)) {
- XkbDescPtr xkb;
- xkb= dev->key->xkbInfo->desc;
- sli= kf->xkb_sli;
- sli->physIndicators= xkb->indicators->phys_indicators;
- if (xkb->names->indicators!=sli->names) {
- checkNames= TRUE;
- sli->names= xkb->names->indicators;
- }
- if (xkb->indicators->maps!=sli->maps) {
- checkAccel= TRUE;
- sli->maps= xkb->indicators->maps;
- }
- }
- else if ((lf!=NULL)&&(lf->xkb_sli==NULL)) {
- lf->xkb_sli= sli= calloc(1, sizeof(XkbSrvLedInfoRec));
- if (sli==NULL)
- return NULL; /* ALLOCATION ERROR */
- if (dev->key && dev->key->xkbInfo)
- sli->flags= XkbSLI_HasOwnState;
- else sli->flags= 0;
- sli->class= LedFeedbackClass;
- sli->id= lf->ctrl.id;
- sli->fb.lf= lf;
-
- sli->physIndicators= lf->ctrl.led_mask;
- sli->autoState= 0;
- sli->explicitState= lf->ctrl.led_values;
- sli->effectiveState= lf->ctrl.led_values;
- sli->maps= NULL;
- sli->names= NULL;
+ XkbSrvLedInfoPtr sli;
+ Bool checkAccel;
+ Bool checkNames;
+
+ sli = NULL;
+ checkAccel = checkNames = FALSE;
+ if ((kf != NULL) && (kf->xkb_sli == NULL)) {
+ kf->xkb_sli = sli = calloc(1, sizeof(XkbSrvLedInfoRec));
+ if (sli == NULL)
+ return NULL; /* ALLOCATION ERROR */
+ if (dev->key && dev->key->xkbInfo)
+ sli->flags = XkbSLI_HasOwnState;
+ else
+ sli->flags = 0;
+ sli->class = KbdFeedbackClass;
+ sli->id = kf->ctrl.id;
+ sli->fb.kf = kf;
+
+ sli->autoState = 0;
+ sli->explicitState = kf->ctrl.leds;
+ sli->effectiveState = kf->ctrl.leds;
+
+ if ((kf == dev->kbdfeed) && (dev->key) && (dev->key->xkbInfo)) {
+ XkbDescPtr xkb;
+
+ xkb = dev->key->xkbInfo->desc;
+ sli->flags |= XkbSLI_IsDefault;
+ sli->physIndicators = xkb->indicators->phys_indicators;
+ sli->names = xkb->names->indicators;
+ sli->maps = xkb->indicators->maps;
+ checkNames = checkAccel = TRUE;
+ }
+ else {
+ sli->physIndicators = XkbAllIndicatorsMask;
+ sli->names = NULL;
+ sli->maps = NULL;
+ }
+ }
+ else if ((kf != NULL) && ((kf->xkb_sli->flags & XkbSLI_IsDefault) != 0)) {
+ XkbDescPtr xkb;
+
+ xkb = dev->key->xkbInfo->desc;
+ sli = kf->xkb_sli;
+ sli->physIndicators = xkb->indicators->phys_indicators;
+ if (xkb->names->indicators != sli->names) {
+ checkNames = TRUE;
+ sli->names = xkb->names->indicators;
+ }
+ if (xkb->indicators->maps != sli->maps) {
+ checkAccel = TRUE;
+ sli->maps = xkb->indicators->maps;
+ }
+ }
+ else if ((lf != NULL) && (lf->xkb_sli == NULL)) {
+ lf->xkb_sli = sli = calloc(1, sizeof(XkbSrvLedInfoRec));
+ if (sli == NULL)
+ return NULL; /* ALLOCATION ERROR */
+ if (dev->key && dev->key->xkbInfo)
+ sli->flags = XkbSLI_HasOwnState;
+ else
+ sli->flags = 0;
+ sli->class = LedFeedbackClass;
+ sli->id = lf->ctrl.id;
+ sli->fb.lf = lf;
+
+ sli->physIndicators = lf->ctrl.led_mask;
+ sli->autoState = 0;
+ sli->explicitState = lf->ctrl.led_values;
+ sli->effectiveState = lf->ctrl.led_values;
+ sli->maps = NULL;
+ sli->names = NULL;
}
else
- return NULL;
- if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask))
- sli->names= calloc(XkbNumIndicators, sizeof(Atom));
- if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask))
- sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
+ return NULL;
+ if ((sli->names == NULL) && (needed_parts & XkbXI_IndicatorNamesMask))
+ sli->names = calloc(XkbNumIndicators, sizeof(Atom));
+ if ((sli->maps == NULL) && (needed_parts & XkbXI_IndicatorMapsMask))
+ sli->maps = calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
if (checkNames) {
- register unsigned i,bit;
- sli->namesPresent= 0;
- for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
- if (sli->names[i]!=None)
- sli->namesPresent|= bit;
- }
+ register unsigned i, bit;
+
+ sli->namesPresent = 0;
+ for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
+ if (sli->names[i] != None)
+ sli->namesPresent |= bit;
+ }
}
if (checkAccel)
- XkbCheckIndicatorMaps(dev,sli,XkbAllIndicatorsMask);
+ XkbCheckIndicatorMaps(dev, sli, XkbAllIndicatorsMask);
return sli;
}
void
XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli)
{
- if ((sli->flags&XkbSLI_IsDefault)==0) {
- free(sli->maps);
- free(sli->names);
+ if ((sli->flags & XkbSLI_IsDefault) == 0) {
+ free(sli->maps);
+ free(sli->names);
}
- sli->maps= NULL;
- sli->names= NULL;
+ sli->maps = NULL;
+ sli->names = NULL;
free(sli);
return;
}
@@ -626,100 +640,103 @@ XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli)
* XkbFreeSrvLedInfo.
*/
XkbSrvLedInfoPtr
-XkbCopySrvLedInfo( DeviceIntPtr from,
- XkbSrvLedInfoPtr src,
- KbdFeedbackPtr kf,
- LedFeedbackPtr lf)
+XkbCopySrvLedInfo(DeviceIntPtr from,
+ XkbSrvLedInfoPtr src, KbdFeedbackPtr kf, LedFeedbackPtr lf)
{
XkbSrvLedInfoPtr sli_new = NULL;
if (!src)
- goto finish;
+ goto finish;
- sli_new = calloc(1, sizeof( XkbSrvLedInfoRec));
+ sli_new = calloc(1, sizeof(XkbSrvLedInfoRec));
if (!sli_new)
- goto finish;
+ goto finish;
memcpy(sli_new, src, sizeof(XkbSrvLedInfoRec));
if (sli_new->class == KbdFeedbackClass)
- sli_new->fb.kf = kf;
+ sli_new->fb.kf = kf;
else
- sli_new->fb.lf = lf;
+ sli_new->fb.lf = lf;
if (!(sli_new->flags & XkbSLI_IsDefault)) {
- sli_new->names= calloc(XkbNumIndicators, sizeof(Atom));
- sli_new->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
- } /* else sli_new->names/maps is pointing to
- dev->key->xkbInfo->desc->names->indicators;
- dev->key->xkbInfo->desc->names->indicators; */
+ sli_new->names = calloc(XkbNumIndicators, sizeof(Atom));
+ sli_new->maps = calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
+ } /* else sli_new->names/maps is pointing to
+ dev->key->xkbInfo->desc->names->indicators;
+ dev->key->xkbInfo->desc->names->indicators; */
-finish:
+ finish:
return sli_new;
}
/***====================================================================***/
- /*
- * XkbSrvLedInfoPtr
- * XkbFindSrvLedInfo(dev,class,id,needed_parts)
- *
- * Finds the XkbSrvLedInfoPtr for the specified 'class' and 'id'
- * on the device specified by 'dev.' If the class and id specify
- * a valid device feedback, this function returns the existing
- * feedback or allocates a new one.
- *
- */
+ /*
+ * XkbSrvLedInfoPtr
+ * XkbFindSrvLedInfo(dev,class,id,needed_parts)
+ *
+ * Finds the XkbSrvLedInfoPtr for the specified 'class' and 'id'
+ * on the device specified by 'dev.' If the class and id specify
+ * a valid device feedback, this function returns the existing
+ * feedback or allocates a new one.
+ *
+ */
XkbSrvLedInfoPtr
-XkbFindSrvLedInfo( DeviceIntPtr dev,
- unsigned class,
- unsigned id,
- unsigned needed_parts)
+XkbFindSrvLedInfo(DeviceIntPtr dev,
+ unsigned class, unsigned id, unsigned needed_parts)
{
-XkbSrvLedInfoPtr sli;
+ XkbSrvLedInfoPtr sli;
/* optimization to check for most common case */
- if (((class==XkbDfltXIClass)&&(id==XkbDfltXIId))&&(dev->kbdfeed)) {
- if (dev->kbdfeed->xkb_sli==NULL) {
- dev->kbdfeed->xkb_sli=
- XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,needed_parts);
- }
- return dev->kbdfeed->xkb_sli;
- }
-
- sli= NULL;
- if (class==XkbDfltXIClass) {
- if (dev->kbdfeed) class= KbdFeedbackClass;
- else if (dev->leds) class= LedFeedbackClass;
- else return NULL;
- }
- if (class==KbdFeedbackClass) {
- KbdFeedbackPtr kf;
- for (kf=dev->kbdfeed;kf!=NULL;kf=kf->next) {
- if ((id==XkbDfltXIId)||(id==kf->ctrl.id)) {
- if (kf->xkb_sli==NULL)
- kf->xkb_sli= XkbAllocSrvLedInfo(dev,kf,NULL,needed_parts);
- sli= kf->xkb_sli;
- break;
- }
- }
- }
- else if (class==LedFeedbackClass) {
- LedFeedbackPtr lf;
- for (lf=dev->leds;lf!=NULL;lf=lf->next) {
- if ((id==XkbDfltXIId)||(id==lf->ctrl.id)) {
- if (lf->xkb_sli==NULL)
- lf->xkb_sli= XkbAllocSrvLedInfo(dev,NULL,lf,needed_parts);
- sli= lf->xkb_sli;
- break;
- }
- }
+ if (((class == XkbDfltXIClass) && (id == XkbDfltXIId)) && (dev->kbdfeed)) {
+ if (dev->kbdfeed->xkb_sli == NULL) {
+ dev->kbdfeed->xkb_sli =
+ XkbAllocSrvLedInfo(dev, dev->kbdfeed, NULL, needed_parts);
+ }
+ return dev->kbdfeed->xkb_sli;
+ }
+
+ sli = NULL;
+ if (class == XkbDfltXIClass) {
+ if (dev->kbdfeed)
+ class = KbdFeedbackClass;
+ else if (dev->leds)
+ class = LedFeedbackClass;
+ else
+ return NULL;
+ }
+ if (class == KbdFeedbackClass) {
+ KbdFeedbackPtr kf;
+
+ for (kf = dev->kbdfeed; kf != NULL; kf = kf->next) {
+ if ((id == XkbDfltXIId) || (id == kf->ctrl.id)) {
+ if (kf->xkb_sli == NULL)
+ kf->xkb_sli =
+ XkbAllocSrvLedInfo(dev, kf, NULL, needed_parts);
+ sli = kf->xkb_sli;
+ break;
+ }
+ }
+ }
+ else if (class == LedFeedbackClass) {
+ LedFeedbackPtr lf;
+
+ for (lf = dev->leds; lf != NULL; lf = lf->next) {
+ if ((id == XkbDfltXIId) || (id == lf->ctrl.id)) {
+ if (lf->xkb_sli == NULL)
+ lf->xkb_sli =
+ XkbAllocSrvLedInfo(dev, NULL, lf, needed_parts);
+ sli = lf->xkb_sli;
+ break;
+ }
+ }
}
if (sli) {
- if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask))
- sli->names= calloc(XkbNumIndicators, sizeof(Atom));
- if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask))
- sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
+ if ((sli->names == NULL) && (needed_parts & XkbXI_IndicatorNamesMask))
+ sli->names = calloc(XkbNumIndicators, sizeof(Atom));
+ if ((sli->maps == NULL) && (needed_parts & XkbXI_IndicatorMapsMask))
+ sli->maps = calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
}
return sli;
}
@@ -727,34 +744,34 @@ XkbSrvLedInfoPtr sli;
/***====================================================================***/
void
-XkbFlushLedEvents( DeviceIntPtr dev,
- DeviceIntPtr kbd,
- XkbSrvLedInfoPtr sli,
- xkbExtensionDeviceNotify * ed,
- XkbChangesPtr changes,
- XkbEventCausePtr cause)
+XkbFlushLedEvents(DeviceIntPtr dev,
+ DeviceIntPtr kbd,
+ XkbSrvLedInfoPtr sli,
+ xkbExtensionDeviceNotify * ed,
+ XkbChangesPtr changes, XkbEventCausePtr cause)
{
if (changes) {
- if (changes->indicators.state_changes)
- XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState);
- XkbSendNotification(kbd,changes,cause);
- memset((char *)changes, 0, sizeof(XkbChangesRec));
-
- if (XkbAX_NeedFeedback(kbd->key->xkbInfo->desc->ctrls, XkbAX_IndicatorFBMask)) {
- if (sli->effectiveState)
- /* it appears that the which parameter is not used */
- XkbDDXAccessXBeep(dev, _BEEP_LED_ON, XkbAccessXFeedbackMask);
- else
- XkbDDXAccessXBeep(dev, _BEEP_LED_OFF, XkbAccessXFeedbackMask);
- }
+ if (changes->indicators.state_changes)
+ XkbDDXUpdateDeviceIndicators(dev, sli, sli->effectiveState);
+ XkbSendNotification(kbd, changes, cause);
+ memset((char *) changes, 0, sizeof(XkbChangesRec));
+
+ if (XkbAX_NeedFeedback
+ (kbd->key->xkbInfo->desc->ctrls, XkbAX_IndicatorFBMask)) {
+ if (sli->effectiveState)
+ /* it appears that the which parameter is not used */
+ XkbDDXAccessXBeep(dev, _BEEP_LED_ON, XkbAccessXFeedbackMask);
+ else
+ XkbDDXAccessXBeep(dev, _BEEP_LED_OFF, XkbAccessXFeedbackMask);
+ }
}
if (ed) {
- if (ed->reason) {
- if ((dev!=kbd)&&(ed->reason&XkbXI_IndicatorStateMask))
- XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState);
- XkbSendExtensionDeviceNotify(dev,cause->client,ed);
- }
- memset((char *)ed, 0, sizeof(XkbExtensionDeviceNotify));
+ if (ed->reason) {
+ if ((dev != kbd) && (ed->reason & XkbXI_IndicatorStateMask))
+ XkbDDXUpdateDeviceIndicators(dev, sli, sli->effectiveState);
+ XkbSendExtensionDeviceNotify(dev, cause->client, ed);
+ }
+ memset((char *) ed, 0, sizeof(XkbExtensionDeviceNotify));
}
return;
}
@@ -762,219 +779,227 @@ XkbFlushLedEvents( DeviceIntPtr dev,
/***====================================================================***/
void
-XkbApplyLedNameChanges( DeviceIntPtr dev,
- XkbSrvLedInfoPtr sli,
- unsigned changed_names,
- xkbExtensionDeviceNotify * ed,
- XkbChangesPtr changes,
- XkbEventCausePtr cause)
+XkbApplyLedNameChanges(DeviceIntPtr dev,
+ XkbSrvLedInfoPtr sli,
+ unsigned changed_names,
+ xkbExtensionDeviceNotify * ed,
+ XkbChangesPtr changes, XkbEventCausePtr cause)
{
-DeviceIntPtr kbd;
-XkbChangesRec my_changes;
-xkbExtensionDeviceNotify my_ed;
+ DeviceIntPtr kbd;
+ XkbChangesRec my_changes;
+ xkbExtensionDeviceNotify my_ed;
- if (changed_names==0)
- return;
+ if (changed_names == 0)
+ return;
if (dev->key && dev->key->xkbInfo)
- kbd= dev;
- else kbd= inputInfo.keyboard;
-
- if (ed==NULL) {
- ed= &my_ed;
- memset((char *)ed, 0, sizeof(xkbExtensionDeviceNotify));
- }
- else if ((ed->reason&XkbXI_IndicatorsMask)&&
- ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) {
- XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
- }
-
- if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) {
- if (changes==NULL) {
- changes= &my_changes;
- memset((char *)changes, 0, sizeof(XkbChangesRec));
- }
- changes->names.changed|= XkbIndicatorNamesMask;
- changes->names.changed_indicators|= changed_names;
- }
-
- ed->reason|= XkbXI_IndicatorNamesMask;
- ed->ledClass= sli->class;
- ed->ledID= sli->id;
- ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
- ed->ledState= sli->effectiveState;
- ed->unsupported= 0;
- ed->supported= XkbXI_AllFeaturesMask;
-
- if (changes!=&my_changes) changes= NULL;
- if (ed!=&my_ed) ed= NULL;
+ kbd = dev;
+ else
+ kbd = inputInfo.keyboard;
+
+ if (ed == NULL) {
+ ed = &my_ed;
+ memset((char *) ed, 0, sizeof(xkbExtensionDeviceNotify));
+ }
+ else if ((ed->reason & XkbXI_IndicatorsMask) &&
+ ((ed->ledClass != sli->class) || (ed->ledID != sli->id))) {
+ XkbFlushLedEvents(dev, kbd, sli, ed, changes, cause);
+ }
+
+ if ((kbd == dev) && (sli->flags & XkbSLI_IsDefault)) {
+ if (changes == NULL) {
+ changes = &my_changes;
+ memset((char *) changes, 0, sizeof(XkbChangesRec));
+ }
+ changes->names.changed |= XkbIndicatorNamesMask;
+ changes->names.changed_indicators |= changed_names;
+ }
+
+ ed->reason |= XkbXI_IndicatorNamesMask;
+ ed->ledClass = sli->class;
+ ed->ledID = sli->id;
+ ed->ledsDefined = sli->namesPresent | sli->mapsPresent;
+ ed->ledState = sli->effectiveState;
+ ed->unsupported = 0;
+ ed->supported = XkbXI_AllFeaturesMask;
+
+ if (changes != &my_changes)
+ changes = NULL;
+ if (ed != &my_ed)
+ ed = NULL;
if (changes || ed)
- XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
+ XkbFlushLedEvents(dev, kbd, sli, ed, changes, cause);
return;
}
+
/***====================================================================***/
- /*
- * void
- * XkbApplyLedMapChanges(dev,sli,changed_maps,changes,cause)
- *
- * Handles all of the secondary effects of the changes to the
- * feedback specified by 'sli' on the device specified by 'dev.'
- *
- * If 'changed_maps' specifies any indicators, this function generates
- * XkbExtensionDeviceNotify events and possibly IndicatorMapNotify
- * events to report the changes, and recalculates the effective
- * state of each indicator with a changed map. If any indicators
- * change state, the server generates XkbExtensionDeviceNotify and
- * XkbIndicatorStateNotify events as appropriate.
- *
- * If 'changes' is non-NULL, this function updates it to reflect
- * any changes to the keyboard state or controls or to the 'core'
- * indicator names, maps, or state. If 'changes' is NULL, this
- * function generates XKB events as needed to report the changes.
- * If 'dev' is not a keyboard device, any changes are reported
- * for the core keyboard.
- *
- * The 'cause' specifies the reason for the event (key event or
- * request) for the change, as reported in some XKB events.
- */
+ /*
+ * void
+ * XkbApplyLedMapChanges(dev,sli,changed_maps,changes,cause)
+ *
+ * Handles all of the secondary effects of the changes to the
+ * feedback specified by 'sli' on the device specified by 'dev.'
+ *
+ * If 'changed_maps' specifies any indicators, this function generates
+ * XkbExtensionDeviceNotify events and possibly IndicatorMapNotify
+ * events to report the changes, and recalculates the effective
+ * state of each indicator with a changed map. If any indicators
+ * change state, the server generates XkbExtensionDeviceNotify and
+ * XkbIndicatorStateNotify events as appropriate.
+ *
+ * If 'changes' is non-NULL, this function updates it to reflect
+ * any changes to the keyboard state or controls or to the 'core'
+ * indicator names, maps, or state. If 'changes' is NULL, this
+ * function generates XKB events as needed to report the changes.
+ * If 'dev' is not a keyboard device, any changes are reported
+ * for the core keyboard.
+ *
+ * The 'cause' specifies the reason for the event (key event or
+ * request) for the change, as reported in some XKB events.
+ */
void
-XkbApplyLedMapChanges( DeviceIntPtr dev,
- XkbSrvLedInfoPtr sli,
- unsigned changed_maps,
- xkbExtensionDeviceNotify * ed,
- XkbChangesPtr changes,
- XkbEventCausePtr cause)
+XkbApplyLedMapChanges(DeviceIntPtr dev,
+ XkbSrvLedInfoPtr sli,
+ unsigned changed_maps,
+ xkbExtensionDeviceNotify * ed,
+ XkbChangesPtr changes, XkbEventCausePtr cause)
{
-DeviceIntPtr kbd;
-XkbChangesRec my_changes;
-xkbExtensionDeviceNotify my_ed;
+ DeviceIntPtr kbd;
+ XkbChangesRec my_changes;
+ xkbExtensionDeviceNotify my_ed;
- if (changed_maps==0)
- return;
+ if (changed_maps == 0)
+ return;
if (dev->key && dev->key->xkbInfo)
- kbd= dev;
- else kbd= inputInfo.keyboard;
+ kbd = dev;
+ else
+ kbd = inputInfo.keyboard;
- if (ed==NULL) {
- ed= &my_ed;
- memset((char *)ed, 0, sizeof(xkbExtensionDeviceNotify));
+ if (ed == NULL) {
+ ed = &my_ed;
+ memset((char *) ed, 0, sizeof(xkbExtensionDeviceNotify));
}
- else if ((ed->reason&XkbXI_IndicatorsMask)&&
- ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) {
- XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
+ else if ((ed->reason & XkbXI_IndicatorsMask) &&
+ ((ed->ledClass != sli->class) || (ed->ledID != sli->id))) {
+ XkbFlushLedEvents(dev, kbd, sli, ed, changes, cause);
}
- if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) {
- if (changes==NULL) {
- changes= &my_changes;
- memset((char *)changes, 0, sizeof(XkbChangesRec));
- }
- changes->indicators.map_changes|= changed_maps;
+ if ((kbd == dev) && (sli->flags & XkbSLI_IsDefault)) {
+ if (changes == NULL) {
+ changes = &my_changes;
+ memset((char *) changes, 0, sizeof(XkbChangesRec));
+ }
+ changes->indicators.map_changes |= changed_maps;
}
- XkbCheckIndicatorMaps(dev,sli,changed_maps);
+ XkbCheckIndicatorMaps(dev, sli, changed_maps);
- ed->reason|= XkbXI_IndicatorMapsMask;
- ed->ledClass= sli->class;
- ed->ledID= sli->id;
- ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
- ed->ledState= sli->effectiveState;
- ed->unsupported= 0;
- ed->supported= XkbXI_AllFeaturesMask;
+ ed->reason |= XkbXI_IndicatorMapsMask;
+ ed->ledClass = sli->class;
+ ed->ledID = sli->id;
+ ed->ledsDefined = sli->namesPresent | sli->mapsPresent;
+ ed->ledState = sli->effectiveState;
+ ed->unsupported = 0;
+ ed->supported = XkbXI_AllFeaturesMask;
- XkbUpdateLedAutoState(dev,sli,changed_maps,ed,changes,cause);
+ XkbUpdateLedAutoState(dev, sli, changed_maps, ed, changes, cause);
- if (changes!=&my_changes) changes= NULL;
- if (ed!=&my_ed) ed= NULL;
+ if (changes != &my_changes)
+ changes = NULL;
+ if (ed != &my_ed)
+ ed = NULL;
if (changes || ed)
- XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
+ XkbFlushLedEvents(dev, kbd, sli, ed, changes, cause);
return;
}
/***====================================================================***/
void
-XkbApplyLedStateChanges(DeviceIntPtr dev,
- XkbSrvLedInfoPtr sli,
- unsigned changed_leds,
- xkbExtensionDeviceNotify * ed,
- XkbChangesPtr changes,
- XkbEventCausePtr cause)
+XkbApplyLedStateChanges(DeviceIntPtr dev,
+ XkbSrvLedInfoPtr sli,
+ unsigned changed_leds,
+ xkbExtensionDeviceNotify * ed,
+ XkbChangesPtr changes, XkbEventCausePtr cause)
{
-XkbSrvInfoPtr xkbi;
-DeviceIntPtr kbd;
-XkbChangesRec my_changes;
-xkbExtensionDeviceNotify my_ed;
-register unsigned i,bit,affected;
-XkbIndicatorMapPtr map;
-unsigned oldState;
-Bool kb_changed;
-
- if (changed_leds==0)
- return;
+ XkbSrvInfoPtr xkbi;
+ DeviceIntPtr kbd;
+ XkbChangesRec my_changes;
+ xkbExtensionDeviceNotify my_ed;
+ register unsigned i, bit, affected;
+ XkbIndicatorMapPtr map;
+ unsigned oldState;
+ Bool kb_changed;
+
+ if (changed_leds == 0)
+ return;
if (dev->key && dev->key->xkbInfo)
- kbd= dev;
- else kbd= inputInfo.keyboard;
- xkbi= kbd->key->xkbInfo;
-
- if (changes==NULL) {
- changes= &my_changes;
- memset((char *)changes, 0, sizeof(XkbChangesRec));
- }
-
- kb_changed= FALSE;
- affected= changed_leds;
- oldState= sli->effectiveState;
- for (i=0,bit=1;(i<XkbNumIndicators)&&(affected);i++,bit<<=1) {
- if ((affected&bit)==0)
- continue;
- affected&= ~bit;
- map= &sli->maps[i];
- if (map->flags&XkbIM_NoExplicit) {
- sli->explicitState&= ~bit;
- continue;
- }
- if (map->flags&XkbIM_LEDDrivesKB) {
- Bool on= ((sli->explicitState&bit)!=0);
- if (XkbApplyLEDChangeToKeyboard(xkbi,map,on,changes))
- kb_changed= TRUE;
- }
- }
- sli->effectiveState= (sli->autoState|sli->explicitState);
- affected= sli->effectiveState^oldState;
-
- if (ed==NULL) {
- ed= &my_ed;
- memset((char *)ed, 0, sizeof(xkbExtensionDeviceNotify));
- }
- else if (affected&&(ed->reason&XkbXI_IndicatorsMask)&&
- ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) {
- XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
- }
-
- if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault))
- changes->indicators.state_changes|= affected;
+ kbd = dev;
+ else
+ kbd = inputInfo.keyboard;
+ xkbi = kbd->key->xkbInfo;
+
+ if (changes == NULL) {
+ changes = &my_changes;
+ memset((char *) changes, 0, sizeof(XkbChangesRec));
+ }
+
+ kb_changed = FALSE;
+ affected = changed_leds;
+ oldState = sli->effectiveState;
+ for (i = 0, bit = 1; (i < XkbNumIndicators) && (affected); i++, bit <<= 1) {
+ if ((affected & bit) == 0)
+ continue;
+ affected &= ~bit;
+ map = &sli->maps[i];
+ if (map->flags & XkbIM_NoExplicit) {
+ sli->explicitState &= ~bit;
+ continue;
+ }
+ if (map->flags & XkbIM_LEDDrivesKB) {
+ Bool on = ((sli->explicitState & bit) != 0);
+
+ if (XkbApplyLEDChangeToKeyboard(xkbi, map, on, changes))
+ kb_changed = TRUE;
+ }
+ }
+ sli->effectiveState = (sli->autoState | sli->explicitState);
+ affected = sli->effectiveState ^ oldState;
+
+ if (ed == NULL) {
+ ed = &my_ed;
+ memset((char *) ed, 0, sizeof(xkbExtensionDeviceNotify));
+ }
+ else if (affected && (ed->reason & XkbXI_IndicatorsMask) &&
+ ((ed->ledClass != sli->class) || (ed->ledID != sli->id))) {
+ XkbFlushLedEvents(dev, kbd, sli, ed, changes, cause);
+ }
+
+ if ((kbd == dev) && (sli->flags & XkbSLI_IsDefault))
+ changes->indicators.state_changes |= affected;
if (affected) {
- ed->reason|= XkbXI_IndicatorStateMask;
- ed->ledClass= sli->class;
- ed->ledID= sli->id;
- ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
- ed->ledState= sli->effectiveState;
- ed->unsupported= 0;
- ed->supported= XkbXI_AllFeaturesMask;
+ ed->reason |= XkbXI_IndicatorStateMask;
+ ed->ledClass = sli->class;
+ ed->ledID = sli->id;
+ ed->ledsDefined = sli->namesPresent | sli->mapsPresent;
+ ed->ledState = sli->effectiveState;
+ ed->unsupported = 0;
+ ed->supported = XkbXI_AllFeaturesMask;
}
if (kb_changed) {
- XkbComputeDerivedState(kbd->key->xkbInfo);
- XkbUpdateLedAutoState(dev,sli,sli->mapsPresent,ed,changes,cause);
+ XkbComputeDerivedState(kbd->key->xkbInfo);
+ XkbUpdateLedAutoState(dev, sli, sli->mapsPresent, ed, changes, cause);
}
- if (changes!=&my_changes) changes= NULL;
- if (ed!=&my_ed) ed= NULL;
+ if (changes != &my_changes)
+ changes = NULL;
+ if (ed != &my_ed)
+ ed = NULL;
if (changes || ed)
- XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
+ XkbFlushLedEvents(dev, kbd, sli, ed, changes, cause);
if (kb_changed)
- XkbUpdateAllDeviceIndicators(NULL,cause);
+ XkbUpdateAllDeviceIndicators(NULL, cause);
return;
}
diff --git a/xorg-server/xkb/xkbPrKeyEv.c b/xorg-server/xkb/xkbPrKeyEv.c
index 630f17c23..32411838d 100644
--- a/xorg-server/xkb/xkbPrKeyEv.c
+++ b/xorg-server/xkb/xkbPrKeyEv.c
@@ -46,20 +46,21 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
void
XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr keybd)
{
-KeyClassPtr keyc = keybd->key;
-XkbSrvInfoPtr xkbi;
-int key;
-XkbBehavior behavior;
-unsigned ndx;
+ KeyClassPtr keyc = keybd->key;
+ XkbSrvInfoPtr xkbi;
+ int key;
+ XkbBehavior behavior;
+ unsigned ndx;
xkbi = keyc->xkbInfo;
key = event->detail.key;
if (xkbDebugFlags & 0x8)
- DebugF("[xkb] XkbPKE: Key %d %s\n",key,(event->type == ET_KeyPress?"down":"up"));
+ DebugF("[xkb] XkbPKE: Key %d %s\n", key,
+ (event->type == ET_KeyPress ? "down" : "up"));
- if (xkbi->repeatKey == key && event->type== ET_KeyRelease &&
+ if (xkbi->repeatKey == key && event->type == ET_KeyRelease &&
!(xkbi->desc->ctrls->enabled_ctrls & XkbRepeatKeysMask))
- AccessXCancelRepeatKey(xkbi, key);
+ AccessXCancelRepeatKey(xkbi, key);
behavior = xkbi->desc->server->behaviors[key];
/* The "permanent" flag indicates a hard-wired behavior that occurs */
@@ -68,73 +69,79 @@ unsigned ndx;
/* key is hardwired */
if (!(behavior.type & XkbKB_Permanent)) {
- switch (behavior.type) {
- case XkbKB_Default:
- /* Neither of these should happen in practice, but ignore them
- anyway. */
- if (event->type == ET_KeyPress && !event->key_repeat &&
- key_is_down(keybd, key, KEY_PROCESSED))
+ switch (behavior.type) {
+ case XkbKB_Default:
+ /* Neither of these should happen in practice, but ignore them
+ anyway. */
+ if (event->type == ET_KeyPress && !event->key_repeat &&
+ key_is_down(keybd, key, KEY_PROCESSED))
+ return;
+ else if (event->type == ET_KeyRelease &&
+ !key_is_down(keybd, key, KEY_PROCESSED))
+ return;
+ break;
+ case XkbKB_Lock:
+ if (event->type == ET_KeyRelease)
+ return;
+ else if (key_is_down(keybd, key, KEY_PROCESSED))
+ event->type = ET_KeyRelease;
+ break;
+ case XkbKB_RadioGroup:
+ ndx = (behavior.data & (~XkbKB_RGAllowNone));
+ if (ndx < xkbi->nRadioGroups) {
+ XkbRadioGroupPtr rg;
+
+ if (event->type == ET_KeyRelease)
return;
- else if (event->type == ET_KeyRelease &&
- !key_is_down(keybd, key, KEY_PROCESSED))
+
+ rg = &xkbi->radioGroups[ndx];
+ if (rg->currentDown == event->detail.key) {
+ if (behavior.data & XkbKB_RGAllowNone) {
+ event->type = ET_KeyRelease;
+ XkbHandleActions(keybd, keybd, event);
+ rg->currentDown = 0;
+ }
return;
- break;
- case XkbKB_Lock:
- if (event->type == ET_KeyRelease)
- return;
- else if (key_is_down(keybd, key, KEY_PROCESSED))
+ }
+ if (rg->currentDown != 0) {
+ int key = event->detail.key;
+
event->type = ET_KeyRelease;
- break;
- case XkbKB_RadioGroup:
- ndx= (behavior.data&(~XkbKB_RGAllowNone));
- if ( ndx<xkbi->nRadioGroups ) {
- XkbRadioGroupPtr rg;
-
- if (event->type == ET_KeyRelease)
- return;
-
- rg = &xkbi->radioGroups[ndx];
- if ( rg->currentDown == event->detail.key) {
- if (behavior.data&XkbKB_RGAllowNone) {
- event->type = ET_KeyRelease;
- XkbHandleActions(keybd, keybd, event);
- rg->currentDown= 0;
- }
- return;
- }
- if ( rg->currentDown!=0 ) {
- int key = event->detail.key;
- event->type = ET_KeyRelease;
- event->detail.key = rg->currentDown;
- XkbHandleActions(keybd, keybd, event);
- event->type = ET_KeyPress;
- event->detail.key = key;
- }
- rg->currentDown= key;
- }
- else ErrorF("[xkb] InternalError! Illegal radio group %d\n",ndx);
- break;
- case XkbKB_Overlay1: case XkbKB_Overlay2:
- {
- unsigned which;
- if (behavior.type==XkbKB_Overlay1) which= XkbOverlay1Mask;
- else which= XkbOverlay2Mask;
- if ( (xkbi->desc->ctrls->enabled_ctrls&which)==0 )
- break;
- if ((behavior.data>=xkbi->desc->min_key_code)&&
- (behavior.data<=xkbi->desc->max_key_code)) {
- event->detail.key = behavior.data;
- /* 9/11/94 (ef) -- XXX! need to match release with */
- /* press even if the state of the */
- /* corresponding overlay control */
- /* changes while the key is down */
- }
- }
- break;
- default:
- ErrorF("[xkb] unknown key behavior 0x%04x\n",behavior.type);
- break;
- }
+ event->detail.key = rg->currentDown;
+ XkbHandleActions(keybd, keybd, event);
+ event->type = ET_KeyPress;
+ event->detail.key = key;
+ }
+ rg->currentDown = key;
+ }
+ else
+ ErrorF("[xkb] InternalError! Illegal radio group %d\n", ndx);
+ break;
+ case XkbKB_Overlay1:
+ case XkbKB_Overlay2:
+ {
+ unsigned which;
+
+ if (behavior.type == XkbKB_Overlay1)
+ which = XkbOverlay1Mask;
+ else
+ which = XkbOverlay2Mask;
+ if ((xkbi->desc->ctrls->enabled_ctrls & which) == 0)
+ break;
+ if ((behavior.data >= xkbi->desc->min_key_code) &&
+ (behavior.data <= xkbi->desc->max_key_code)) {
+ event->detail.key = behavior.data;
+ /* 9/11/94 (ef) -- XXX! need to match release with */
+ /* press even if the state of the */
+ /* corresponding overlay control */
+ /* changes while the key is down */
+ }
+ }
+ break;
+ default:
+ ErrorF("[xkb] unknown key behavior 0x%04x\n", behavior.type);
+ break;
+ }
}
XkbHandleActions(keybd, keybd, event);
return;
diff --git a/xorg-server/xkb/xkbSwap.c b/xorg-server/xkb/xkbSwap.c
index fcae918a9..076da340b 100644
--- a/xorg-server/xkb/xkbSwap.c
+++ b/xorg-server/xkb/xkbSwap.c
@@ -38,9 +38,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "extnsionst.h"
#include "xkb.h"
- /*
- * REQUEST SWAPPING
- */
+ /*
+ * REQUEST SWAPPING
+ */
static int
SProcXkbUseExtension(ClientPtr client)
{
@@ -66,66 +66,67 @@ SProcXkbSelectEvents(ClientPtr client)
swaps(&stuff->selectAll);
swaps(&stuff->affectMap);
swaps(&stuff->map);
- if ((stuff->affectWhich&(~XkbMapNotifyMask))!=0) {
- union {
- BOOL *b;
- CARD8 *c8;
- CARD16 *c16;
- CARD32 *c32;
- } from;
- register unsigned bit,ndx,maskLeft,dataLeft,size;
-
- from.c8= (CARD8 *)&stuff[1];
- dataLeft= (stuff->length*4)-SIZEOF(xkbSelectEventsReq);
- maskLeft= (stuff->affectWhich&(~XkbMapNotifyMask));
- for (ndx=0,bit=1; (maskLeft!=0); ndx++, bit<<=1) {
- if (((bit&maskLeft)==0)||(ndx==XkbMapNotify))
- continue;
- maskLeft&= ~bit;
- if ((stuff->selectAll&bit)||(stuff->clear&bit))
- continue;
- switch (ndx) {
- case XkbNewKeyboardNotify:
- case XkbStateNotify:
- case XkbNamesNotify:
- case XkbAccessXNotify:
- case XkbExtensionDeviceNotify:
- size= 2;
- break;
- case XkbControlsNotify:
- case XkbIndicatorStateNotify:
- case XkbIndicatorMapNotify:
- size= 4;
- break;
- case XkbBellNotify:
- case XkbActionMessage:
- case XkbCompatMapNotify:
- size= 1;
- break;
- default:
- client->errorValue = _XkbErrCode2(0x1,bit);
- return BadValue;
- }
- if (dataLeft<(size*2))
- return BadLength;
- if (size==2) {
- swaps(&from.c16[0]);
- swaps(&from.c16[1]);
- }
- else if (size==4) {
- swapl(&from.c32[0]);
- swapl(&from.c32[1]);
- }
- else {
- size= 2;
- }
- from.c8+= (size*2);
- dataLeft-= (size*2);
- }
- if (dataLeft>2) {
- ErrorF("[xkb] Extra data (%d bytes) after SelectEvents\n",dataLeft);
- return BadLength;
- }
+ if ((stuff->affectWhich & (~XkbMapNotifyMask)) != 0) {
+ union {
+ BOOL *b;
+ CARD8 *c8;
+ CARD16 *c16;
+ CARD32 *c32;
+ } from;
+ register unsigned bit, ndx, maskLeft, dataLeft, size;
+
+ from.c8 = (CARD8 *) &stuff[1];
+ dataLeft = (stuff->length * 4) - SIZEOF(xkbSelectEventsReq);
+ maskLeft = (stuff->affectWhich & (~XkbMapNotifyMask));
+ for (ndx = 0, bit = 1; (maskLeft != 0); ndx++, bit <<= 1) {
+ if (((bit & maskLeft) == 0) || (ndx == XkbMapNotify))
+ continue;
+ maskLeft &= ~bit;
+ if ((stuff->selectAll & bit) || (stuff->clear & bit))
+ continue;
+ switch (ndx) {
+ case XkbNewKeyboardNotify:
+ case XkbStateNotify:
+ case XkbNamesNotify:
+ case XkbAccessXNotify:
+ case XkbExtensionDeviceNotify:
+ size = 2;
+ break;
+ case XkbControlsNotify:
+ case XkbIndicatorStateNotify:
+ case XkbIndicatorMapNotify:
+ size = 4;
+ break;
+ case XkbBellNotify:
+ case XkbActionMessage:
+ case XkbCompatMapNotify:
+ size = 1;
+ break;
+ default:
+ client->errorValue = _XkbErrCode2(0x1, bit);
+ return BadValue;
+ }
+ if (dataLeft < (size * 2))
+ return BadLength;
+ if (size == 2) {
+ swaps(&from.c16[0]);
+ swaps(&from.c16[1]);
+ }
+ else if (size == 4) {
+ swapl(&from.c32[0]);
+ swapl(&from.c32[1]);
+ }
+ else {
+ size = 2;
+ }
+ from.c8 += (size * 2);
+ dataLeft -= (size * 2);
+ }
+ if (dataLeft > 2) {
+ ErrorF("[xkb] Extra data (%d bytes) after SelectEvents\n",
+ dataLeft);
+ return BadLength;
+ }
}
return ProcXkbSelectEvents(client);
}
@@ -244,7 +245,6 @@ SProcXkbSetMap(ClientPtr client)
return ProcXkbSetMap(client);
}
-
static int
SProcXkbGetCompatMap(ClientPtr client)
{
@@ -336,7 +336,6 @@ SProcXkbSetNamedIndicator(ClientPtr client)
return ProcXkbSetNamedIndicator(client);
}
-
static int
SProcXkbGetNames(ClientPtr client)
{
@@ -478,64 +477,63 @@ SProcXkbSetDebuggingFlags(ClientPtr client)
}
int
-SProcXkbDispatch (ClientPtr client)
+SProcXkbDispatch(ClientPtr client)
{
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_kbUseExtension:
- return SProcXkbUseExtension(client);
+ return SProcXkbUseExtension(client);
case X_kbSelectEvents:
- return SProcXkbSelectEvents(client);
+ return SProcXkbSelectEvents(client);
case X_kbBell:
- return SProcXkbBell(client);
+ return SProcXkbBell(client);
case X_kbGetState:
- return SProcXkbGetState(client);
+ return SProcXkbGetState(client);
case X_kbLatchLockState:
- return SProcXkbLatchLockState(client);
+ return SProcXkbLatchLockState(client);
case X_kbGetControls:
- return SProcXkbGetControls(client);
+ return SProcXkbGetControls(client);
case X_kbSetControls:
- return SProcXkbSetControls(client);
+ return SProcXkbSetControls(client);
case X_kbGetMap:
- return SProcXkbGetMap(client);
+ return SProcXkbGetMap(client);
case X_kbSetMap:
- return SProcXkbSetMap(client);
+ return SProcXkbSetMap(client);
case X_kbGetCompatMap:
- return SProcXkbGetCompatMap(client);
+ return SProcXkbGetCompatMap(client);
case X_kbSetCompatMap:
- return SProcXkbSetCompatMap(client);
+ return SProcXkbSetCompatMap(client);
case X_kbGetIndicatorState:
- return SProcXkbGetIndicatorState(client);
+ return SProcXkbGetIndicatorState(client);
case X_kbGetIndicatorMap:
- return SProcXkbGetIndicatorMap(client);
+ return SProcXkbGetIndicatorMap(client);
case X_kbSetIndicatorMap:
- return SProcXkbSetIndicatorMap(client);
+ return SProcXkbSetIndicatorMap(client);
case X_kbGetNamedIndicator:
- return SProcXkbGetNamedIndicator(client);
+ return SProcXkbGetNamedIndicator(client);
case X_kbSetNamedIndicator:
- return SProcXkbSetNamedIndicator(client);
+ return SProcXkbSetNamedIndicator(client);
case X_kbGetNames:
- return SProcXkbGetNames(client);
+ return SProcXkbGetNames(client);
case X_kbSetNames:
- return SProcXkbSetNames(client);
+ return SProcXkbSetNames(client);
case X_kbGetGeometry:
- return SProcXkbGetGeometry(client);
+ return SProcXkbGetGeometry(client);
case X_kbSetGeometry:
- return SProcXkbSetGeometry(client);
+ return SProcXkbSetGeometry(client);
case X_kbPerClientFlags:
- return SProcXkbPerClientFlags(client);
+ return SProcXkbPerClientFlags(client);
case X_kbListComponents:
- return SProcXkbListComponents(client);
+ return SProcXkbListComponents(client);
case X_kbGetKbdByName:
- return SProcXkbGetKbdByName(client);
+ return SProcXkbGetKbdByName(client);
case X_kbGetDeviceInfo:
- return SProcXkbGetDeviceInfo(client);
+ return SProcXkbGetDeviceInfo(client);
case X_kbSetDeviceInfo:
- return SProcXkbSetDeviceInfo(client);
+ return SProcXkbSetDeviceInfo(client);
case X_kbSetDebuggingFlags:
- return SProcXkbSetDebuggingFlags(client);
+ return SProcXkbSetDebuggingFlags(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
diff --git a/xorg-server/xkb/xkbUtils.c b/xorg-server/xkb/xkbUtils.c
index cc9aaa75a..c23cd7784 100644
--- a/xorg-server/xkb/xkbUtils.c
+++ b/xorg-server/xkb/xkbUtils.c
@@ -73,7 +73,7 @@ DEALINGS IN THE SOFTWARE.
int
_XkbLookupAnyDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
- Mask access_mode, int *xkb_err)
+ Mask access_mode, int *xkb_err)
{
int rc = XkbKeyboardErrorCode;
@@ -84,14 +84,14 @@ _XkbLookupAnyDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
rc = dixLookupDevice(pDev, id, client, access_mode);
if (rc != Success)
- *xkb_err = XkbErr_BadDevice;
+ *xkb_err = XkbErr_BadDevice;
return rc;
}
int
_XkbLookupKeyboard(DeviceIntPtr *pDev, int id, ClientPtr client,
- Mask access_mode, int *xkb_err)
+ Mask access_mode, int *xkb_err)
{
DeviceIntPtr dev;
int rc;
@@ -101,40 +101,40 @@ _XkbLookupKeyboard(DeviceIntPtr *pDev, int id, ClientPtr client,
rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err);
if (rc != Success)
- return rc;
+ return rc;
dev = *pDev;
if (!dev->key || !dev->key->xkbInfo) {
- *pDev = NULL;
- *xkb_err= XkbErr_BadClass;
- return XkbKeyboardErrorCode;
+ *pDev = NULL;
+ *xkb_err = XkbErr_BadClass;
+ return XkbKeyboardErrorCode;
}
return Success;
}
int
_XkbLookupBellDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
- Mask access_mode, int *xkb_err)
+ Mask access_mode, int *xkb_err)
{
DeviceIntPtr dev;
int rc;
rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err);
if (rc != Success)
- return rc;
+ return rc;
dev = *pDev;
if (!dev->kbdfeed && !dev->bell) {
- *pDev = NULL;
- *xkb_err= XkbErr_BadClass;
- return XkbKeyboardErrorCode;
+ *pDev = NULL;
+ *xkb_err = XkbErr_BadClass;
+ return XkbKeyboardErrorCode;
}
return Success;
}
int
_XkbLookupLedDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
- Mask access_mode, int *xkb_err)
+ Mask access_mode, int *xkb_err)
{
DeviceIntPtr dev;
int rc;
@@ -144,68 +144,70 @@ _XkbLookupLedDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err);
if (rc != Success)
- return rc;
+ return rc;
dev = *pDev;
if (!dev->kbdfeed && !dev->leds) {
- *pDev = NULL;
- *xkb_err= XkbErr_BadClass;
- return XkbKeyboardErrorCode;
+ *pDev = NULL;
+ *xkb_err = XkbErr_BadClass;
+ return XkbKeyboardErrorCode;
}
return Success;
}
int
_XkbLookupButtonDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
- Mask access_mode, int *xkb_err)
+ Mask access_mode, int *xkb_err)
{
DeviceIntPtr dev;
int rc;
rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err);
if (rc != Success)
- return rc;
+ return rc;
dev = *pDev;
if (!dev->button) {
- *pDev = NULL;
- *xkb_err= XkbErr_BadClass;
- return XkbKeyboardErrorCode;
+ *pDev = NULL;
+ *xkb_err = XkbErr_BadClass;
+ return XkbKeyboardErrorCode;
}
return Success;
}
void
-XkbSetActionKeyMods(XkbDescPtr xkb,XkbAction *act,unsigned mods)
+XkbSetActionKeyMods(XkbDescPtr xkb, XkbAction *act, unsigned mods)
{
-register unsigned tmp;
+ register unsigned tmp;
switch (act->type) {
- case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
- if (act->mods.flags&XkbSA_UseModMapMods)
- act->mods.real_mods= act->mods.mask= mods;
- if ((tmp= XkbModActionVMods(&act->mods))!=0)
- act->mods.mask|= XkbMaskForVMask(xkb,tmp);
- break;
- case XkbSA_ISOLock:
- if (act->iso.flags&XkbSA_UseModMapMods)
- act->iso.real_mods= act->iso.mask= mods;
- if ((tmp= XkbModActionVMods(&act->iso))!=0)
- act->iso.mask|= XkbMaskForVMask(xkb,tmp);
- break;
+ case XkbSA_SetMods:
+ case XkbSA_LatchMods:
+ case XkbSA_LockMods:
+ if (act->mods.flags & XkbSA_UseModMapMods)
+ act->mods.real_mods = act->mods.mask = mods;
+ if ((tmp = XkbModActionVMods(&act->mods)) != 0)
+ act->mods.mask |= XkbMaskForVMask(xkb, tmp);
+ break;
+ case XkbSA_ISOLock:
+ if (act->iso.flags & XkbSA_UseModMapMods)
+ act->iso.real_mods = act->iso.mask = mods;
+ if ((tmp = XkbModActionVMods(&act->iso)) != 0)
+ act->iso.mask |= XkbMaskForVMask(xkb, tmp);
+ break;
}
return;
}
unsigned
-XkbMaskForVMask(XkbDescPtr xkb,unsigned vmask)
+XkbMaskForVMask(XkbDescPtr xkb, unsigned vmask)
{
-register int i,bit;
-register unsigned mask;
-
- for (mask=i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (vmask&bit)
- mask|= xkb->server->vmods[i];
+ register int i, bit;
+ register unsigned mask;
+
+ for (mask = i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if (vmask & bit)
+ mask |= xkb->server->vmods[i];
}
return mask;
}
@@ -213,147 +215,144 @@ register unsigned mask;
/***====================================================================***/
void
-XkbUpdateKeyTypesFromCore( DeviceIntPtr pXDev,
- KeySymsPtr pCore,
- KeyCode first,
- CARD8 num,
- XkbChangesPtr changes)
+XkbUpdateKeyTypesFromCore(DeviceIntPtr pXDev,
+ KeySymsPtr pCore,
+ KeyCode first, CARD8 num, XkbChangesPtr changes)
{
-XkbDescPtr xkb;
-unsigned key,nG,explicit;
-int types[XkbNumKbdGroups];
-KeySym tsyms[XkbMaxSymsPerKey],*syms;
-XkbMapChangesPtr mc;
-
- xkb= pXDev->key->xkbInfo->desc;
- if (first+num-1>xkb->max_key_code) {
- /* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */
- num= xkb->max_key_code-first+1;
+ XkbDescPtr xkb;
+ unsigned key, nG, explicit;
+ int types[XkbNumKbdGroups];
+ KeySym tsyms[XkbMaxSymsPerKey], *syms;
+ XkbMapChangesPtr mc;
+
+ xkb = pXDev->key->xkbInfo->desc;
+ if (first + num - 1 > xkb->max_key_code) {
+ /* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */
+ num = xkb->max_key_code - first + 1;
}
- mc= (changes?(&changes->map):NULL);
-
- syms= &pCore->map[(first - pCore->minKeyCode) * pCore->mapWidth];
- for (key=first; key<(first+num); key++,syms+= pCore->mapWidth) {
- explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask;
- types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index);
- types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index);
- types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index);
- types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index);
- nG= XkbKeyTypesForCoreSymbols(xkb,pCore->mapWidth,syms,explicit,types,
- tsyms);
- XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc);
- memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms,
- XkbKeyNumSyms(xkb,key)*sizeof(KeySym));
+ mc = (changes ? (&changes->map) : NULL);
+
+ syms = &pCore->map[(first - pCore->minKeyCode) * pCore->mapWidth];
+ for (key = first; key < (first + num); key++, syms += pCore->mapWidth) {
+ explicit = xkb->server->explicit[key] & XkbExplicitKeyTypesMask;
+ types[XkbGroup1Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup1Index);
+ types[XkbGroup2Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup2Index);
+ types[XkbGroup3Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup3Index);
+ types[XkbGroup4Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup4Index);
+ nG = XkbKeyTypesForCoreSymbols(xkb, pCore->mapWidth, syms, explicit,
+ types, tsyms);
+ XkbChangeTypesOfKey(xkb, key, nG, XkbAllGroupsMask, types, mc);
+ memcpy((char *) XkbKeySymsPtr(xkb, key), (char *) tsyms,
+ XkbKeyNumSyms(xkb, key) * sizeof(KeySym));
}
- if (changes->map.changed&XkbKeySymsMask) {
- CARD8 oldLast,newLast;
- oldLast = changes->map.first_key_sym+changes->map.num_key_syms-1;
- newLast = first+num-1;
-
- if (first<changes->map.first_key_sym)
- changes->map.first_key_sym = first;
- if (oldLast>newLast)
- newLast= oldLast;
- changes->map.num_key_syms = newLast-changes->map.first_key_sym+1;
+ if (changes->map.changed & XkbKeySymsMask) {
+ CARD8 oldLast, newLast;
+
+ oldLast = changes->map.first_key_sym + changes->map.num_key_syms - 1;
+ newLast = first + num - 1;
+
+ if (first < changes->map.first_key_sym)
+ changes->map.first_key_sym = first;
+ if (oldLast > newLast)
+ newLast = oldLast;
+ changes->map.num_key_syms = newLast - changes->map.first_key_sym + 1;
}
else {
- changes->map.changed|= XkbKeySymsMask;
- changes->map.first_key_sym = first;
- changes->map.num_key_syms = num;
+ changes->map.changed |= XkbKeySymsMask;
+ changes->map.first_key_sym = first;
+ changes->map.num_key_syms = num;
}
return;
}
void
-XkbUpdateDescActions( XkbDescPtr xkb,
- KeyCode first,
- CARD8 num,
- XkbChangesPtr changes)
+XkbUpdateDescActions(XkbDescPtr xkb,
+ KeyCode first, CARD8 num, XkbChangesPtr changes)
{
-register unsigned key;
+ register unsigned key;
- for (key=first;key<(first+num);key++) {
- XkbApplyCompatMapToKey(xkb,key,changes);
+ for (key = first; key < (first + num); key++) {
+ XkbApplyCompatMapToKey(xkb, key, changes);
}
- if (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask)) {
- unsigned char newVMods[XkbNumVirtualMods];
- register unsigned bit,i;
- unsigned present;
+ if (changes->map.changed & (XkbVirtualModMapMask | XkbModifierMapMask)) {
+ unsigned char newVMods[XkbNumVirtualMods];
+ register unsigned bit, i;
+ unsigned present;
memset(newVMods, 0, XkbNumVirtualMods);
- present= 0;
- for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) {
- if (xkb->server->vmodmap[key]==0)
+ present = 0;
+ for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
+ if (xkb->server->vmodmap[key] == 0)
continue;
- for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (bit&xkb->server->vmodmap[key]) {
- present|= bit;
- newVMods[i]|= xkb->map->modmap[key];
+ for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if (bit & xkb->server->vmodmap[key]) {
+ present |= bit;
+ newVMods[i] |= xkb->map->modmap[key];
}
}
}
- for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if ((bit&present)&&(newVMods[i]!=xkb->server->vmods[i])) {
- changes->map.changed|= XkbVirtualModsMask;
- changes->map.vmods|= bit;
- xkb->server->vmods[i]= newVMods[i];
+ for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if ((bit & present) && (newVMods[i] != xkb->server->vmods[i])) {
+ changes->map.changed |= XkbVirtualModsMask;
+ changes->map.vmods |= bit;
+ xkb->server->vmods[i] = newVMods[i];
}
}
}
- if (changes->map.changed&XkbVirtualModsMask)
- XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes);
-
- if (changes->map.changed&XkbKeyActionsMask) {
- CARD8 oldLast,newLast;
- oldLast= changes->map.first_key_act+changes->map.num_key_acts-1;
- newLast = first+num-1;
-
- if (first<changes->map.first_key_act)
- changes->map.first_key_act = first;
- if (newLast>oldLast)
- newLast= oldLast;
- changes->map.num_key_acts= newLast-changes->map.first_key_act+1;
+ if (changes->map.changed & XkbVirtualModsMask)
+ XkbApplyVirtualModChanges(xkb, changes->map.vmods, changes);
+
+ if (changes->map.changed & XkbKeyActionsMask) {
+ CARD8 oldLast, newLast;
+
+ oldLast = changes->map.first_key_act + changes->map.num_key_acts - 1;
+ newLast = first + num - 1;
+
+ if (first < changes->map.first_key_act)
+ changes->map.first_key_act = first;
+ if (newLast > oldLast)
+ newLast = oldLast;
+ changes->map.num_key_acts = newLast - changes->map.first_key_act + 1;
}
else {
- changes->map.changed|= XkbKeyActionsMask;
- changes->map.first_key_act = first;
- changes->map.num_key_acts = num;
+ changes->map.changed |= XkbKeyActionsMask;
+ changes->map.first_key_act = first;
+ changes->map.num_key_acts = num;
}
return;
}
void
-XkbUpdateActions( DeviceIntPtr pXDev,
- KeyCode first,
- CARD8 num,
- XkbChangesPtr changes,
- unsigned * needChecksRtrn,
- XkbEventCausePtr cause)
+XkbUpdateActions(DeviceIntPtr pXDev,
+ KeyCode first,
+ CARD8 num,
+ XkbChangesPtr changes,
+ unsigned *needChecksRtrn, XkbEventCausePtr cause)
{
-XkbSrvInfoPtr xkbi;
-XkbDescPtr xkb;
-CARD8 * repeat;
+ XkbSrvInfoPtr xkbi;
+ XkbDescPtr xkb;
+ CARD8 *repeat;
if (needChecksRtrn)
- *needChecksRtrn= 0;
- xkbi= pXDev->key->xkbInfo;
- xkb= xkbi->desc;
- repeat= xkb->ctrls->per_key_repeat;
+ *needChecksRtrn = 0;
+ xkbi = pXDev->key->xkbInfo;
+ xkb = xkbi->desc;
+ repeat = xkb->ctrls->per_key_repeat;
/* before letting XKB do any changes, copy the current core values */
if (pXDev->kbdfeed)
- memcpy(repeat,pXDev->kbdfeed->ctrl.autoRepeats,XkbPerKeyBitArraySize);
+ memcpy(repeat, pXDev->kbdfeed->ctrl.autoRepeats, XkbPerKeyBitArraySize);
- XkbUpdateDescActions(xkb,first,num,changes);
+ XkbUpdateDescActions(xkb, first, num, changes);
- if ((pXDev->kbdfeed)&&
- (changes->ctrls.changed_ctrls&XkbPerKeyRepeatMask)) {
- /* now copy the modified changes back to core */
- memcpy(pXDev->kbdfeed->ctrl.autoRepeats,repeat, XkbPerKeyBitArraySize);
- if (pXDev->kbdfeed->CtrlProc)
- (*pXDev->kbdfeed->CtrlProc)(pXDev, &pXDev->kbdfeed->ctrl);
+ if ((pXDev->kbdfeed) &&
+ (changes->ctrls.changed_ctrls & XkbPerKeyRepeatMask)) {
+ /* now copy the modified changes back to core */
+ memcpy(pXDev->kbdfeed->ctrl.autoRepeats, repeat, XkbPerKeyBitArraySize);
+ if (pXDev->kbdfeed->CtrlProc)
+ (*pXDev->kbdfeed->CtrlProc) (pXDev, &pXDev->kbdfeed->ctrl);
}
return;
}
@@ -361,53 +360,57 @@ CARD8 * repeat;
KeySymsPtr
XkbGetCoreMap(DeviceIntPtr keybd)
{
-register int key,tmp;
-int maxSymsPerKey, maxGroup1Width;
-XkbDescPtr xkb;
-KeySymsPtr syms;
-int maxNumberOfGroups;
+ register int key, tmp;
+ int maxSymsPerKey, maxGroup1Width;
+ XkbDescPtr xkb;
+ KeySymsPtr syms;
+ int maxNumberOfGroups;
if (!keybd || !keybd->key || !keybd->key->xkbInfo)
- return NULL;
+ return NULL;
- xkb= keybd->key->xkbInfo->desc;
- maxSymsPerKey= maxGroup1Width= 0;
+ xkb = keybd->key->xkbInfo->desc;
+ maxSymsPerKey = maxGroup1Width = 0;
maxNumberOfGroups = 0;
/* determine sizes */
- for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) {
- if (XkbKeycodeInRange(xkb,key)) {
- int nGroups;
- int w;
- nGroups= XkbKeyNumGroups(xkb,key);
- tmp= 0;
- if (nGroups>0) {
- if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup1Index))<=2)
- tmp+= 2;
- else tmp+= w + 2;
+ for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
+ if (XkbKeycodeInRange(xkb, key)) {
+ int nGroups;
+ int w;
+
+ nGroups = XkbKeyNumGroups(xkb, key);
+ tmp = 0;
+ if (nGroups > 0) {
+ if ((w = XkbKeyGroupWidth(xkb, key, XkbGroup1Index)) <= 2)
+ tmp += 2;
+ else
+ tmp += w + 2;
/* remember highest G1 width */
if (w > maxGroup1Width)
maxGroup1Width = w;
- }
- if (nGroups>1) {
+ }
+ if (nGroups > 1) {
if (tmp <= 2) {
- if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup2Index))<2)
- tmp+= 2;
- else tmp+= w;
- } else {
- if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup2Index))>2)
- tmp+= w - 2;
+ if ((w = XkbKeyGroupWidth(xkb, key, XkbGroup2Index)) < 2)
+ tmp += 2;
+ else
+ tmp += w;
+ }
+ else {
+ if ((w = XkbKeyGroupWidth(xkb, key, XkbGroup2Index)) > 2)
+ tmp += w - 2;
}
- }
- if (nGroups>2)
- tmp+= XkbKeyGroupWidth(xkb,key,XkbGroup3Index);
- if (nGroups>3)
- tmp+= XkbKeyGroupWidth(xkb,key,XkbGroup4Index);
- if (tmp>maxSymsPerKey)
- maxSymsPerKey= tmp;
+ }
+ if (nGroups > 2)
+ tmp += XkbKeyGroupWidth(xkb, key, XkbGroup3Index);
+ if (nGroups > 3)
+ tmp += XkbKeyGroupWidth(xkb, key, XkbGroup4Index);
+ if (tmp > maxSymsPerKey)
+ maxSymsPerKey = tmp;
if (nGroups > maxNumberOfGroups)
- maxNumberOfGroups = nGroups;
- }
+ maxNumberOfGroups = nGroups;
+ }
}
if (maxSymsPerKey <= 0)
@@ -436,104 +439,110 @@ int maxNumberOfGroups;
return NULL;
}
- for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) {
- KeySym *pCore,*pXKB;
- unsigned nGroups,groupWidth,n,nOut;
-
- nGroups= XkbKeyNumGroups(xkb,key);
- n= (key-xkb->min_key_code)*syms->mapWidth;
- pCore= &syms->map[n];
- pXKB= XkbKeySymsPtr(xkb,key);
- nOut= 2;
- if (nGroups>0) {
- groupWidth= XkbKeyGroupWidth(xkb,key,XkbGroup1Index);
- if (groupWidth>0) pCore[0]= pXKB[0];
- if (groupWidth>1) pCore[1]= pXKB[1];
- for (n=2;n<groupWidth;n++)
- pCore[2+n]= pXKB[n];
- if (groupWidth>2)
- nOut= groupWidth;
- }
-
- /* See XKB Protocol Sec, Section 12.4.
+ for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) {
+ KeySym *pCore, *pXKB;
+ unsigned nGroups, groupWidth, n, nOut;
+
+ nGroups = XkbKeyNumGroups(xkb, key);
+ n = (key - xkb->min_key_code) * syms->mapWidth;
+ pCore = &syms->map[n];
+ pXKB = XkbKeySymsPtr(xkb, key);
+ nOut = 2;
+ if (nGroups > 0) {
+ groupWidth = XkbKeyGroupWidth(xkb, key, XkbGroup1Index);
+ if (groupWidth > 0)
+ pCore[0] = pXKB[0];
+ if (groupWidth > 1)
+ pCore[1] = pXKB[1];
+ for (n = 2; n < groupWidth; n++)
+ pCore[2 + n] = pXKB[n];
+ if (groupWidth > 2)
+ nOut = groupWidth;
+ }
+
+ /* See XKB Protocol Sec, Section 12.4.
A 1-group key with ABCDE on a 2 group keyboard must be
- duplicated across all groups as ABABCDECDE.
- */
- if (nGroups == 1)
- {
- int idx, j;
-
- groupWidth = XkbKeyGroupWidth(xkb, key, XkbGroup1Index);
-
- /* AB..CDE... -> ABABCDE... */
- if (groupWidth > 0 && syms->mapWidth >= 3)
- pCore[2] = pCore[0];
- if (groupWidth > 1 && syms->mapWidth >= 4)
- pCore[3] = pCore[1];
-
- /* ABABCDE... -> ABABCDECDE */
- idx = 2 + groupWidth;
- while (groupWidth > 2 && idx < syms->mapWidth &&
- idx < groupWidth * 2)
- {
- pCore[idx] = pCore[idx - groupWidth + 2];
- idx++;
- }
- idx = 2 * groupWidth;
- if (idx < 4)
- idx = 4;
- /* 3 or more groups: ABABCDECDEABCDEABCDE */
- for (j = 3; j <= maxNumberOfGroups; j++)
- for (n = 0; n < groupWidth && idx < maxSymsPerKey; n++)
- pCore[idx++] = pXKB[n];
- }
-
- pXKB+= XkbKeyGroupsWidth(xkb,key);
- nOut+= 2;
- if (nGroups>1) {
- groupWidth= XkbKeyGroupWidth(xkb,key,XkbGroup2Index);
- if (groupWidth>0) pCore[2]= pXKB[0];
- if (groupWidth>1) pCore[3]= pXKB[1];
- for (n=2;n<groupWidth;n++) {
- pCore[nOut+(n-2)]= pXKB[n];
- }
- if (groupWidth>2)
- nOut+= (groupWidth-2);
- }
- pXKB+= XkbKeyGroupsWidth(xkb,key);
- for (n=XkbGroup3Index;n<nGroups;n++) {
- register int s;
- groupWidth= XkbKeyGroupWidth(xkb,key,n);
- for (s=0;s<groupWidth;s++) {
- pCore[nOut++]= pXKB[s];
- }
- pXKB+= XkbKeyGroupsWidth(xkb,key);
- }
+ duplicated across all groups as ABABCDECDE.
+ */
+ if (nGroups == 1) {
+ int idx, j;
+
+ groupWidth = XkbKeyGroupWidth(xkb, key, XkbGroup1Index);
+
+ /* AB..CDE... -> ABABCDE... */
+ if (groupWidth > 0 && syms->mapWidth >= 3)
+ pCore[2] = pCore[0];
+ if (groupWidth > 1 && syms->mapWidth >= 4)
+ pCore[3] = pCore[1];
+
+ /* ABABCDE... -> ABABCDECDE */
+ idx = 2 + groupWidth;
+ while (groupWidth > 2 && idx < syms->mapWidth &&
+ idx < groupWidth * 2) {
+ pCore[idx] = pCore[idx - groupWidth + 2];
+ idx++;
+ }
+ idx = 2 * groupWidth;
+ if (idx < 4)
+ idx = 4;
+ /* 3 or more groups: ABABCDECDEABCDEABCDE */
+ for (j = 3; j <= maxNumberOfGroups; j++)
+ for (n = 0; n < groupWidth && idx < maxSymsPerKey; n++)
+ pCore[idx++] = pXKB[n];
+ }
+
+ pXKB += XkbKeyGroupsWidth(xkb, key);
+ nOut += 2;
+ if (nGroups > 1) {
+ groupWidth = XkbKeyGroupWidth(xkb, key, XkbGroup2Index);
+ if (groupWidth > 0)
+ pCore[2] = pXKB[0];
+ if (groupWidth > 1)
+ pCore[3] = pXKB[1];
+ for (n = 2; n < groupWidth; n++) {
+ pCore[nOut + (n - 2)] = pXKB[n];
+ }
+ if (groupWidth > 2)
+ nOut += (groupWidth - 2);
+ }
+ pXKB += XkbKeyGroupsWidth(xkb, key);
+ for (n = XkbGroup3Index; n < nGroups; n++) {
+ register int s;
+
+ groupWidth = XkbKeyGroupWidth(xkb, key, n);
+ for (s = 0; s < groupWidth; s++) {
+ pCore[nOut++] = pXKB[s];
+ }
+ pXKB += XkbKeyGroupsWidth(xkb, key);
+ }
}
return syms;
}
void
-XkbSetRepeatKeys(DeviceIntPtr pXDev,int key,int onoff)
+XkbSetRepeatKeys(DeviceIntPtr pXDev, int key, int onoff)
{
if (pXDev && pXDev->key && pXDev->key->xkbInfo) {
- xkbControlsNotify cn;
- XkbControlsPtr ctrls = pXDev->key->xkbInfo->desc->ctrls;
- XkbControlsRec old;
- old = *ctrls;
-
- if (key== -1) { /* global autorepeat setting changed */
- if (onoff) ctrls->enabled_ctrls |= XkbRepeatKeysMask;
- else ctrls->enabled_ctrls &= ~XkbRepeatKeysMask;
- }
- else if (pXDev->kbdfeed) {
- ctrls->per_key_repeat[key/8] =
- pXDev->kbdfeed->ctrl.autoRepeats[key/8];
- }
-
- if (XkbComputeControlsNotify(pXDev,&old,ctrls,&cn,TRUE))
- XkbSendControlsNotify(pXDev,&cn);
+ xkbControlsNotify cn;
+ XkbControlsPtr ctrls = pXDev->key->xkbInfo->desc->ctrls;
+ XkbControlsRec old;
+
+ old = *ctrls;
+
+ if (key == -1) { /* global autorepeat setting changed */
+ if (onoff)
+ ctrls->enabled_ctrls |= XkbRepeatKeysMask;
+ else
+ ctrls->enabled_ctrls &= ~XkbRepeatKeysMask;
+ }
+ else if (pXDev->kbdfeed) {
+ ctrls->per_key_repeat[key / 8] =
+ pXDev->kbdfeed->ctrl.autoRepeats[key / 8];
+ }
+
+ if (XkbComputeControlsNotify(pXDev, &old, ctrls, &cn, TRUE))
+ XkbSendControlsNotify(pXDev, &cn);
}
return;
}
@@ -566,7 +575,7 @@ XkbApplyMappingChange(DeviceIntPtr kbd, KeySymsPtr map, KeyCode first_key,
/* A keymap change can imply a modmap change, se we prefer the
* former. */
if (!cause.mjr)
- XkbSetCauseCoreReq(&cause,X_SetModifierMapping,client);
+ XkbSetCauseCoreReq(&cause, X_SetModifierMapping, client);
check = 0;
num_keys = xkb->max_key_code - xkb->min_key_code + 1;
@@ -585,102 +594,110 @@ XkbApplyMappingChange(DeviceIntPtr kbd, KeySymsPtr map, KeyCode first_key,
}
void
-XkbDisableComputedAutoRepeats(DeviceIntPtr dev,unsigned key)
+XkbDisableComputedAutoRepeats(DeviceIntPtr dev, unsigned key)
{
-XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
-xkbMapNotify mn;
+ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+ xkbMapNotify mn;
- xkbi->desc->server->explicit[key]|= XkbExplicitAutoRepeatMask;
+ xkbi->desc->server->explicit[key] |= XkbExplicitAutoRepeatMask;
memset(&mn, 0, sizeof(mn));
- mn.changed= XkbExplicitComponentsMask;
- mn.firstKeyExplicit= key;
- mn.nKeyExplicit= 1;
- XkbSendMapNotify(dev,&mn);
+ mn.changed = XkbExplicitComponentsMask;
+ mn.firstKeyExplicit = key;
+ mn.nKeyExplicit = 1;
+ XkbSendMapNotify(dev, &mn);
return;
}
unsigned
-XkbStateChangedFlags(XkbStatePtr old,XkbStatePtr new)
+XkbStateChangedFlags(XkbStatePtr old, XkbStatePtr new)
{
-int changed;
-
- changed=(old->group!=new->group?XkbGroupStateMask:0);
- changed|=(old->base_group!=new->base_group?XkbGroupBaseMask:0);
- changed|=(old->latched_group!=new->latched_group?XkbGroupLatchMask:0);
- changed|=(old->locked_group!=new->locked_group?XkbGroupLockMask:0);
- changed|=(old->mods!=new->mods?XkbModifierStateMask:0);
- changed|=(old->base_mods!=new->base_mods?XkbModifierBaseMask:0);
- changed|=(old->latched_mods!=new->latched_mods?XkbModifierLatchMask:0);
- changed|=(old->locked_mods!=new->locked_mods?XkbModifierLockMask:0);
- changed|=(old->compat_state!=new->compat_state?XkbCompatStateMask:0);
- changed|=(old->grab_mods!=new->grab_mods?XkbGrabModsMask:0);
- if (old->compat_grab_mods!=new->compat_grab_mods)
- changed|= XkbCompatGrabModsMask;
- changed|=(old->lookup_mods!=new->lookup_mods?XkbLookupModsMask:0);
- if (old->compat_lookup_mods!=new->compat_lookup_mods)
- changed|= XkbCompatLookupModsMask;
- changed|=(old->ptr_buttons!=new->ptr_buttons?XkbPointerButtonMask:0);
+ int changed;
+
+ changed = (old->group != new->group ? XkbGroupStateMask : 0);
+ changed |= (old->base_group != new->base_group ? XkbGroupBaseMask : 0);
+ changed |=
+ (old->latched_group != new->latched_group ? XkbGroupLatchMask : 0);
+ changed |= (old->locked_group != new->locked_group ? XkbGroupLockMask : 0);
+ changed |= (old->mods != new->mods ? XkbModifierStateMask : 0);
+ changed |= (old->base_mods != new->base_mods ? XkbModifierBaseMask : 0);
+ changed |=
+ (old->latched_mods != new->latched_mods ? XkbModifierLatchMask : 0);
+ changed |= (old->locked_mods != new->locked_mods ? XkbModifierLockMask : 0);
+ changed |=
+ (old->compat_state != new->compat_state ? XkbCompatStateMask : 0);
+ changed |= (old->grab_mods != new->grab_mods ? XkbGrabModsMask : 0);
+ if (old->compat_grab_mods != new->compat_grab_mods)
+ changed |= XkbCompatGrabModsMask;
+ changed |= (old->lookup_mods != new->lookup_mods ? XkbLookupModsMask : 0);
+ if (old->compat_lookup_mods != new->compat_lookup_mods)
+ changed |= XkbCompatLookupModsMask;
+ changed |=
+ (old->ptr_buttons != new->ptr_buttons ? XkbPointerButtonMask : 0);
return changed;
}
static void
XkbComputeCompatState(XkbSrvInfoPtr xkbi)
{
-CARD16 grp_mask;
-XkbStatePtr state= &xkbi->state;
-XkbCompatMapPtr map;
+ CARD16 grp_mask;
+ XkbStatePtr state = &xkbi->state;
+ XkbCompatMapPtr map;
if (!state || !xkbi->desc || !xkbi->desc->ctrls || !xkbi->desc->compat)
return;
- map= xkbi->desc->compat;
- grp_mask= map->groups[state->group].mask;
- state->compat_state = state->mods|grp_mask;
- state->compat_lookup_mods= state->lookup_mods|grp_mask;
+ map = xkbi->desc->compat;
+ grp_mask = map->groups[state->group].mask;
+ state->compat_state = state->mods | grp_mask;
+ state->compat_lookup_mods = state->lookup_mods | grp_mask;
- if (xkbi->desc->ctrls->enabled_ctrls&XkbIgnoreGroupLockMask)
- grp_mask= map->groups[state->base_group].mask;
- state->compat_grab_mods= state->grab_mods|grp_mask;
+ if (xkbi->desc->ctrls->enabled_ctrls & XkbIgnoreGroupLockMask)
+ grp_mask = map->groups[state->base_group].mask;
+ state->compat_grab_mods = state->grab_mods | grp_mask;
return;
}
unsigned
-XkbAdjustGroup(int group,XkbControlsPtr ctrls)
+XkbAdjustGroup(int group, XkbControlsPtr ctrls)
{
-unsigned act;
-
- act= XkbOutOfRangeGroupAction(ctrls->groups_wrap);
- if (group<0) {
- while ( group < 0 ) {
- if (act==XkbClampIntoRange) {
- group= XkbGroup1Index;
- }
- else if (act==XkbRedirectIntoRange) {
- int newGroup;
- newGroup= XkbOutOfRangeGroupNumber(ctrls->groups_wrap);
- if (newGroup>=ctrls->num_groups)
- group= XkbGroup1Index;
- else group= newGroup;
- }
- else {
- group+= ctrls->num_groups;
- }
- }
+ unsigned act;
+
+ act = XkbOutOfRangeGroupAction(ctrls->groups_wrap);
+ if (group < 0) {
+ while (group < 0) {
+ if (act == XkbClampIntoRange) {
+ group = XkbGroup1Index;
+ }
+ else if (act == XkbRedirectIntoRange) {
+ int newGroup;
+
+ newGroup = XkbOutOfRangeGroupNumber(ctrls->groups_wrap);
+ if (newGroup >= ctrls->num_groups)
+ group = XkbGroup1Index;
+ else
+ group = newGroup;
+ }
+ else {
+ group += ctrls->num_groups;
+ }
+ }
}
- else if (group>=ctrls->num_groups) {
- if (act==XkbClampIntoRange) {
- group= ctrls->num_groups-1;
- }
- else if (act==XkbRedirectIntoRange) {
- int newGroup;
- newGroup= XkbOutOfRangeGroupNumber(ctrls->groups_wrap);
- if (newGroup>=ctrls->num_groups)
- group= XkbGroup1Index;
- else group= newGroup;
- }
- else {
- group%= ctrls->num_groups;
- }
+ else if (group >= ctrls->num_groups) {
+ if (act == XkbClampIntoRange) {
+ group = ctrls->num_groups - 1;
+ }
+ else if (act == XkbRedirectIntoRange) {
+ int newGroup;
+
+ newGroup = XkbOutOfRangeGroupNumber(ctrls->groups_wrap);
+ if (newGroup >= ctrls->num_groups)
+ group = XkbGroup1Index;
+ else
+ group = newGroup;
+ }
+ else {
+ group %= ctrls->num_groups;
+ }
}
return group;
}
@@ -688,28 +705,28 @@ unsigned act;
void
XkbComputeDerivedState(XkbSrvInfoPtr xkbi)
{
-XkbStatePtr state= &xkbi->state;
-XkbControlsPtr ctrls= xkbi->desc->ctrls;
-unsigned char grp;
+ XkbStatePtr state = &xkbi->state;
+ XkbControlsPtr ctrls = xkbi->desc->ctrls;
+ unsigned char grp;
if (!state || !ctrls)
return;
- state->mods= (state->base_mods|state->latched_mods|state->locked_mods);
- state->lookup_mods= state->mods&(~ctrls->internal.mask);
- state->grab_mods= state->lookup_mods&(~ctrls->ignore_lock.mask);
- state->grab_mods|=
- ((state->base_mods|state->latched_mods)&ctrls->ignore_lock.mask);
-
+ state->mods = (state->base_mods | state->latched_mods | state->locked_mods);
+ state->lookup_mods = state->mods & (~ctrls->internal.mask);
+ state->grab_mods = state->lookup_mods & (~ctrls->ignore_lock.mask);
+ state->grab_mods |=
+ ((state->base_mods | state->latched_mods) & ctrls->ignore_lock.mask);
- grp= state->locked_group;
- if (grp>=ctrls->num_groups)
- state->locked_group= XkbAdjustGroup(XkbCharToInt(grp),ctrls);
+ grp = state->locked_group;
+ if (grp >= ctrls->num_groups)
+ state->locked_group = XkbAdjustGroup(XkbCharToInt(grp), ctrls);
- grp= state->locked_group+state->base_group+state->latched_group;
- if (grp>=ctrls->num_groups)
- state->group= XkbAdjustGroup(XkbCharToInt(grp),ctrls);
- else state->group= grp;
+ grp = state->locked_group + state->base_group + state->latched_group;
+ if (grp >= ctrls->num_groups)
+ state->group = XkbAdjustGroup(XkbCharToInt(grp), ctrls);
+ else
+ state->group = grp;
XkbComputeCompatState(xkbi);
return;
}
@@ -717,67 +734,68 @@ unsigned char grp;
/***====================================================================***/
void
-XkbCheckSecondaryEffects( XkbSrvInfoPtr xkbi,
- unsigned which,
- XkbChangesPtr changes,
- XkbEventCausePtr cause)
+XkbCheckSecondaryEffects(XkbSrvInfoPtr xkbi,
+ unsigned which,
+ XkbChangesPtr changes, XkbEventCausePtr cause)
{
- if (which&XkbStateNotifyMask) {
- XkbStateRec old;
- old= xkbi->state;
- changes->state_changes|= XkbStateChangedFlags(&old,&xkbi->state);
- XkbComputeDerivedState(xkbi);
+ if (which & XkbStateNotifyMask) {
+ XkbStateRec old;
+
+ old = xkbi->state;
+ changes->state_changes |= XkbStateChangedFlags(&old, &xkbi->state);
+ XkbComputeDerivedState(xkbi);
}
- if (which&XkbIndicatorStateNotifyMask)
- XkbUpdateIndicators(xkbi->device,XkbAllIndicatorsMask,TRUE,changes,
- cause);
+ if (which & XkbIndicatorStateNotifyMask)
+ XkbUpdateIndicators(xkbi->device, XkbAllIndicatorsMask, TRUE, changes,
+ cause);
return;
}
/***====================================================================***/
Bool
-XkbEnableDisableControls( XkbSrvInfoPtr xkbi,
- unsigned long change,
- unsigned long newValues,
- XkbChangesPtr changes,
- XkbEventCausePtr cause)
+XkbEnableDisableControls(XkbSrvInfoPtr xkbi,
+ unsigned long change,
+ unsigned long newValues,
+ XkbChangesPtr changes, XkbEventCausePtr cause)
{
-XkbControlsPtr ctrls;
-unsigned old;
-XkbSrvLedInfoPtr sli;
-
- ctrls= xkbi->desc->ctrls;
- old= ctrls->enabled_ctrls;
- ctrls->enabled_ctrls&= ~change;
- ctrls->enabled_ctrls|= (change&newValues);
- if (old==ctrls->enabled_ctrls)
- return FALSE;
- if (cause!=NULL) {
- xkbControlsNotify cn;
- cn.numGroups= ctrls->num_groups;
- cn.changedControls= XkbControlsEnabledMask;
- cn.enabledControls= ctrls->enabled_ctrls;
- cn.enabledControlChanges= (ctrls->enabled_ctrls^old);
- cn.keycode= cause->kc;
- cn.eventType= cause->event;
- cn.requestMajor= cause->mjr;
- cn.requestMinor= cause->mnr;
- XkbSendControlsNotify(xkbi->device,&cn);
+ XkbControlsPtr ctrls;
+ unsigned old;
+ XkbSrvLedInfoPtr sli;
+
+ ctrls = xkbi->desc->ctrls;
+ old = ctrls->enabled_ctrls;
+ ctrls->enabled_ctrls &= ~change;
+ ctrls->enabled_ctrls |= (change & newValues);
+ if (old == ctrls->enabled_ctrls)
+ return FALSE;
+ if (cause != NULL) {
+ xkbControlsNotify cn;
+
+ cn.numGroups = ctrls->num_groups;
+ cn.changedControls = XkbControlsEnabledMask;
+ cn.enabledControls = ctrls->enabled_ctrls;
+ cn.enabledControlChanges = (ctrls->enabled_ctrls ^ old);
+ cn.keycode = cause->kc;
+ cn.eventType = cause->event;
+ cn.requestMajor = cause->mjr;
+ cn.requestMinor = cause->mnr;
+ XkbSendControlsNotify(xkbi->device, &cn);
}
else {
- /* Yes, this really should be an XOR. If ctrls->enabled_ctrls_changes*/
- /* is non-zero, the controls in question changed already in "this" */
- /* request and this change merely undoes the previous one. By the */
- /* same token, we have to figure out whether or not ControlsEnabled */
- /* should be set or not in the changes structure */
- changes->ctrls.enabled_ctrls_changes^= (ctrls->enabled_ctrls^old);
- if (changes->ctrls.enabled_ctrls_changes)
- changes->ctrls.changed_ctrls|= XkbControlsEnabledMask;
- else changes->ctrls.changed_ctrls&= ~XkbControlsEnabledMask;
+ /* Yes, this really should be an XOR. If ctrls->enabled_ctrls_changes */
+ /* is non-zero, the controls in question changed already in "this" */
+ /* request and this change merely undoes the previous one. By the */
+ /* same token, we have to figure out whether or not ControlsEnabled */
+ /* should be set or not in the changes structure */
+ changes->ctrls.enabled_ctrls_changes ^= (ctrls->enabled_ctrls ^ old);
+ if (changes->ctrls.enabled_ctrls_changes)
+ changes->ctrls.changed_ctrls |= XkbControlsEnabledMask;
+ else
+ changes->ctrls.changed_ctrls &= ~XkbControlsEnabledMask;
}
- sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0);
- XkbUpdateIndicators(xkbi->device,sli->usesControls,TRUE,changes,cause);
+ sli = XkbFindSrvLedInfo(xkbi->device, XkbDfltXIClass, XkbDfltXIId, 0);
+ XkbUpdateIndicators(xkbi->device, sli->usesControls, TRUE, changes, cause);
return TRUE;
}
@@ -786,120 +804,120 @@ XkbSrvLedInfoPtr sli;
#define MAX_TOC 16
XkbGeometryPtr
-XkbLookupNamedGeometry(DeviceIntPtr dev,Atom name,Bool *shouldFree)
+XkbLookupNamedGeometry(DeviceIntPtr dev, Atom name, Bool *shouldFree)
{
-XkbSrvInfoPtr xkbi= dev->key->xkbInfo;
-XkbDescPtr xkb= xkbi->desc;
-
- *shouldFree= 0;
- if (name==None) {
- if (xkb->geom!=NULL)
- return xkb->geom;
- name= xkb->names->geometry;
+ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+ XkbDescPtr xkb = xkbi->desc;
+
+ *shouldFree = 0;
+ if (name == None) {
+ if (xkb->geom != NULL)
+ return xkb->geom;
+ name = xkb->names->geometry;
}
- if ((xkb->geom!=NULL)&&(xkb->geom->name==name))
- return xkb->geom;
- *shouldFree= 1;
+ if ((xkb->geom != NULL) && (xkb->geom->name == name))
+ return xkb->geom;
+ *shouldFree = 1;
return NULL;
}
void
-XkbConvertCase(register KeySym sym, KeySym *lower, KeySym *upper)
+XkbConvertCase(register KeySym sym, KeySym * lower, KeySym * upper)
{
*lower = sym;
*upper = sym;
- switch(sym >> 8) {
- case 0: /* Latin 1 */
- if ((sym >= XK_A) && (sym <= XK_Z))
- *lower += (XK_a - XK_A);
- else if ((sym >= XK_a) && (sym <= XK_z))
- *upper -= (XK_a - XK_A);
- else if ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
- *lower += (XK_agrave - XK_Agrave);
- else if ((sym >= XK_agrave) && (sym <= XK_odiaeresis))
- *upper -= (XK_agrave - XK_Agrave);
- else if ((sym >= XK_Ooblique) && (sym <= XK_Thorn))
- *lower += (XK_oslash - XK_Ooblique);
- else if ((sym >= XK_oslash) && (sym <= XK_thorn))
- *upper -= (XK_oslash - XK_Ooblique);
- break;
- case 1: /* Latin 2 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym == XK_Aogonek)
- *lower = XK_aogonek;
- else if (sym >= XK_Lstroke && sym <= XK_Sacute)
- *lower += (XK_lstroke - XK_Lstroke);
- else if (sym >= XK_Scaron && sym <= XK_Zacute)
- *lower += (XK_scaron - XK_Scaron);
- else if (sym >= XK_Zcaron && sym <= XK_Zabovedot)
- *lower += (XK_zcaron - XK_Zcaron);
- else if (sym == XK_aogonek)
- *upper = XK_Aogonek;
- else if (sym >= XK_lstroke && sym <= XK_sacute)
- *upper -= (XK_lstroke - XK_Lstroke);
- else if (sym >= XK_scaron && sym <= XK_zacute)
- *upper -= (XK_scaron - XK_Scaron);
- else if (sym >= XK_zcaron && sym <= XK_zabovedot)
- *upper -= (XK_zcaron - XK_Zcaron);
- else if (sym >= XK_Racute && sym <= XK_Tcedilla)
- *lower += (XK_racute - XK_Racute);
- else if (sym >= XK_racute && sym <= XK_tcedilla)
- *upper -= (XK_racute - XK_Racute);
- break;
- case 2: /* Latin 3 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= XK_Hstroke && sym <= XK_Hcircumflex)
- *lower += (XK_hstroke - XK_Hstroke);
- else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex)
- *lower += (XK_gbreve - XK_Gbreve);
- else if (sym >= XK_hstroke && sym <= XK_hcircumflex)
- *upper -= (XK_hstroke - XK_Hstroke);
- else if (sym >= XK_gbreve && sym <= XK_jcircumflex)
- *upper -= (XK_gbreve - XK_Gbreve);
- else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex)
- *lower += (XK_cabovedot - XK_Cabovedot);
- else if (sym >= XK_cabovedot && sym <= XK_scircumflex)
- *upper -= (XK_cabovedot - XK_Cabovedot);
- break;
- case 3: /* Latin 4 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= XK_Rcedilla && sym <= XK_Tslash)
- *lower += (XK_rcedilla - XK_Rcedilla);
- else if (sym >= XK_rcedilla && sym <= XK_tslash)
- *upper -= (XK_rcedilla - XK_Rcedilla);
- else if (sym == XK_ENG)
- *lower = XK_eng;
- else if (sym == XK_eng)
- *upper = XK_ENG;
- else if (sym >= XK_Amacron && sym <= XK_Umacron)
- *lower += (XK_amacron - XK_Amacron);
- else if (sym >= XK_amacron && sym <= XK_umacron)
- *upper -= (XK_amacron - XK_Amacron);
- break;
- case 6: /* Cyrillic */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE)
- *lower -= (XK_Serbian_DJE - XK_Serbian_dje);
- else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze)
- *upper += (XK_Serbian_DJE - XK_Serbian_dje);
- else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN)
- *lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu);
- else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign)
- *upper += (XK_Cyrillic_YU - XK_Cyrillic_yu);
+ switch (sym >> 8) {
+ case 0: /* Latin 1 */
+ if ((sym >= XK_A) && (sym <= XK_Z))
+ *lower += (XK_a - XK_A);
+ else if ((sym >= XK_a) && (sym <= XK_z))
+ *upper -= (XK_a - XK_A);
+ else if ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
+ *lower += (XK_agrave - XK_Agrave);
+ else if ((sym >= XK_agrave) && (sym <= XK_odiaeresis))
+ *upper -= (XK_agrave - XK_Agrave);
+ else if ((sym >= XK_Ooblique) && (sym <= XK_Thorn))
+ *lower += (XK_oslash - XK_Ooblique);
+ else if ((sym >= XK_oslash) && (sym <= XK_thorn))
+ *upper -= (XK_oslash - XK_Ooblique);
+ break;
+ case 1: /* Latin 2 */
+ /* Assume the KeySym is a legal value (ignore discontinuities) */
+ if (sym == XK_Aogonek)
+ *lower = XK_aogonek;
+ else if (sym >= XK_Lstroke && sym <= XK_Sacute)
+ *lower += (XK_lstroke - XK_Lstroke);
+ else if (sym >= XK_Scaron && sym <= XK_Zacute)
+ *lower += (XK_scaron - XK_Scaron);
+ else if (sym >= XK_Zcaron && sym <= XK_Zabovedot)
+ *lower += (XK_zcaron - XK_Zcaron);
+ else if (sym == XK_aogonek)
+ *upper = XK_Aogonek;
+ else if (sym >= XK_lstroke && sym <= XK_sacute)
+ *upper -= (XK_lstroke - XK_Lstroke);
+ else if (sym >= XK_scaron && sym <= XK_zacute)
+ *upper -= (XK_scaron - XK_Scaron);
+ else if (sym >= XK_zcaron && sym <= XK_zabovedot)
+ *upper -= (XK_zcaron - XK_Zcaron);
+ else if (sym >= XK_Racute && sym <= XK_Tcedilla)
+ *lower += (XK_racute - XK_Racute);
+ else if (sym >= XK_racute && sym <= XK_tcedilla)
+ *upper -= (XK_racute - XK_Racute);
+ break;
+ case 2: /* Latin 3 */
+ /* Assume the KeySym is a legal value (ignore discontinuities) */
+ if (sym >= XK_Hstroke && sym <= XK_Hcircumflex)
+ *lower += (XK_hstroke - XK_Hstroke);
+ else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex)
+ *lower += (XK_gbreve - XK_Gbreve);
+ else if (sym >= XK_hstroke && sym <= XK_hcircumflex)
+ *upper -= (XK_hstroke - XK_Hstroke);
+ else if (sym >= XK_gbreve && sym <= XK_jcircumflex)
+ *upper -= (XK_gbreve - XK_Gbreve);
+ else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex)
+ *lower += (XK_cabovedot - XK_Cabovedot);
+ else if (sym >= XK_cabovedot && sym <= XK_scircumflex)
+ *upper -= (XK_cabovedot - XK_Cabovedot);
+ break;
+ case 3: /* Latin 4 */
+ /* Assume the KeySym is a legal value (ignore discontinuities) */
+ if (sym >= XK_Rcedilla && sym <= XK_Tslash)
+ *lower += (XK_rcedilla - XK_Rcedilla);
+ else if (sym >= XK_rcedilla && sym <= XK_tslash)
+ *upper -= (XK_rcedilla - XK_Rcedilla);
+ else if (sym == XK_ENG)
+ *lower = XK_eng;
+ else if (sym == XK_eng)
+ *upper = XK_ENG;
+ else if (sym >= XK_Amacron && sym <= XK_Umacron)
+ *lower += (XK_amacron - XK_Amacron);
+ else if (sym >= XK_amacron && sym <= XK_umacron)
+ *upper -= (XK_amacron - XK_Amacron);
break;
- case 7: /* Greek */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent)
- *lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
- else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent &&
- sym != XK_Greek_iotaaccentdieresis &&
- sym != XK_Greek_upsilonaccentdieresis)
- *upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
- else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA)
- *lower += (XK_Greek_alpha - XK_Greek_ALPHA);
- else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega &&
- sym != XK_Greek_finalsmallsigma)
- *upper -= (XK_Greek_alpha - XK_Greek_ALPHA);
+ case 6: /* Cyrillic */
+ /* Assume the KeySym is a legal value (ignore discontinuities) */
+ if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE)
+ *lower -= (XK_Serbian_DJE - XK_Serbian_dje);
+ else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze)
+ *upper += (XK_Serbian_DJE - XK_Serbian_dje);
+ else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN)
+ *lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu);
+ else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign)
+ *upper += (XK_Cyrillic_YU - XK_Cyrillic_yu);
+ break;
+ case 7: /* Greek */
+ /* Assume the KeySym is a legal value (ignore discontinuities) */
+ if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent)
+ *lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
+ else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent &&
+ sym != XK_Greek_iotaaccentdieresis &&
+ sym != XK_Greek_upsilonaccentdieresis)
+ *upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
+ else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA)
+ *lower += (XK_Greek_alpha - XK_Greek_ALPHA);
+ else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega &&
+ sym != XK_Greek_finalsmallsigma)
+ *upper -= (XK_Greek_alpha - XK_Greek_ALPHA);
break;
}
}
@@ -960,13 +978,13 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
!dst->map->types || !dst->map->size_types) {
if (dst->map->types && dst->map->size_types) {
tmp = realloc(dst->map->types,
- src->map->num_types * sizeof(XkbKeyTypeRec));
+ src->map->num_types * sizeof(XkbKeyTypeRec));
if (!tmp)
return FALSE;
dst->map->types = tmp;
memset(dst->map->types + dst->map->num_types, 0,
- (src->map->num_types - dst->map->num_types) *
- sizeof(XkbKeyTypeRec));
+ (src->map->num_types - dst->map->num_types) *
+ sizeof(XkbKeyTypeRec));
}
else {
tmp = calloc(src->map->num_types, sizeof(XkbKeyTypeRec));
@@ -997,7 +1015,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
dtype->num_levels && dtype->level_names &&
i < dst->map->num_types) {
tmp = realloc(dtype->level_names,
- stype->num_levels * sizeof(Atom));
+ stype->num_levels * sizeof(Atom));
if (!tmp)
continue;
dtype->level_names = tmp;
@@ -1030,8 +1048,8 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
dtype->map_count && dtype->map &&
i < dst->map->num_types) {
tmp = realloc(dtype->map,
- stype->map_count *
- sizeof(XkbKTMapEntryRec));
+ stype->map_count *
+ sizeof(XkbKTMapEntryRec));
if (!tmp)
return FALSE;
dtype->map = tmp;
@@ -1039,7 +1057,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
else if (!dtype->map_count || !dtype->map ||
i >= dst->map->num_types) {
tmp = malloc(stype->map_count *
- sizeof(XkbKTMapEntryRec));
+ sizeof(XkbKTMapEntryRec));
if (!tmp)
return FALSE;
dtype->map = tmp;
@@ -1059,16 +1077,15 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
dtype->map_count && dtype->preserve &&
i < dst->map->num_types) {
tmp = realloc(dtype->preserve,
- stype->map_count *
- sizeof(XkbModsRec));
+ stype->map_count *
+ sizeof(XkbModsRec));
if (!tmp)
return FALSE;
dtype->preserve = tmp;
}
else if (!dtype->preserve || !dtype->map_count ||
i >= dst->map->num_types) {
- tmp = malloc(stype->map_count *
- sizeof(XkbModsRec));
+ tmp = malloc(stype->map_count * sizeof(XkbModsRec));
if (!tmp)
return FALSE;
dtype->preserve = tmp;
@@ -1182,8 +1199,8 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
free(dst->server->acts);
dst->server->acts = NULL;
}
- dst->server->size_acts = src->server->size_acts;
- dst->server->num_acts = src->server->num_acts;
+ dst->server->size_acts = src->server->size_acts;
+ dst->server->num_acts = src->server->num_acts;
if (src->server->key_acts) {
if (src->max_key_code != dst->max_key_code) {
@@ -1402,8 +1419,8 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
* the source, run through and free all the excess ones
* first. */
if (src->geom->num_properties < dst->geom->sz_properties) {
- for (i = src->geom->num_properties, dprop = dst->geom->properties + i;
- i < dst->geom->num_properties;
+ for (i = src->geom->num_properties, dprop =
+ dst->geom->properties + i; i < dst->geom->num_properties;
i++, dprop++) {
free(dprop->name);
free(dprop->value);
@@ -1411,18 +1428,19 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
}
/* Reallocate and clear all new items if the buffer grows. */
- if (!XkbGeomRealloc((void **)&dst->geom->properties, dst->geom->sz_properties, src->geom->num_properties,
- sizeof(XkbPropertyRec), XKB_GEOM_CLEAR_EXCESS))
+ if (!XkbGeomRealloc
+ ((void **) &dst->geom->properties, dst->geom->sz_properties,
+ src->geom->num_properties, sizeof(XkbPropertyRec),
+ XKB_GEOM_CLEAR_EXCESS))
return FALSE;
/* We don't set num_properties as we need it to try and avoid
* too much reallocing. */
dst->geom->sz_properties = src->geom->num_properties;
for (i = 0,
- sprop = src->geom->properties,
- dprop = dst->geom->properties;
- i < src->geom->num_properties;
- i++, sprop++, dprop++) {
+ sprop = src->geom->properties,
+ dprop = dst->geom->properties;
+ i < src->geom->num_properties; i++, sprop++, dprop++) {
if (i < dst->geom->num_properties) {
if (strlen(sprop->name) != strlen(dprop->name)) {
tmp = realloc(dprop->name, strlen(sprop->name) + 1);
@@ -1451,8 +1469,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
else {
if (dst->geom->sz_properties) {
for (i = 0, dprop = dst->geom->properties;
- i < dst->geom->num_properties;
- i++, dprop++) {
+ i < dst->geom->num_properties; i++, dprop++) {
free(dprop->name);
free(dprop->value);
}
@@ -1468,23 +1485,23 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
if (src->geom->num_colors) {
if (src->geom->num_colors < dst->geom->sz_colors) {
for (i = src->geom->num_colors, dcolor = dst->geom->colors + i;
- i < dst->geom->num_colors;
- i++, dcolor++) {
+ i < dst->geom->num_colors; i++, dcolor++) {
free(dcolor->spec);
}
}
/* Reallocate and clear all new items if the buffer grows. */
- if (!XkbGeomRealloc((void **)&dst->geom->colors, dst->geom->sz_colors, src->geom->num_colors,
- sizeof(XkbColorRec), XKB_GEOM_CLEAR_EXCESS))
+ if (!XkbGeomRealloc
+ ((void **) &dst->geom->colors, dst->geom->sz_colors,
+ src->geom->num_colors, sizeof(XkbColorRec),
+ XKB_GEOM_CLEAR_EXCESS))
return FALSE;
dst->geom->sz_colors = src->geom->num_colors;
for (i = 0,
- scolor = src->geom->colors,
- dcolor = dst->geom->colors;
- i < src->geom->num_colors;
- i++, scolor++, dcolor++) {
+ scolor = src->geom->colors,
+ dcolor = dst->geom->colors;
+ i < src->geom->num_colors; i++, scolor++, dcolor++) {
if (i < dst->geom->num_colors) {
if (strlen(scolor->spec) != strlen(dcolor->spec)) {
tmp = realloc(dcolor->spec, strlen(scolor->spec) + 1);
@@ -1505,8 +1522,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
else {
if (dst->geom->sz_colors) {
for (i = 0, dcolor = dst->geom->colors;
- i < dst->geom->num_colors;
- i++, dcolor++) {
+ i < dst->geom->num_colors; i++, dcolor++) {
free(dcolor->spec);
}
free(dst->geom->colors);
@@ -1521,11 +1537,9 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
/* shapes break down into outlines, which break down into points. */
if (dst->geom->num_shapes) {
for (i = 0, dshape = dst->geom->shapes;
- i < dst->geom->num_shapes;
- i++, dshape++) {
+ i < dst->geom->num_shapes; i++, dshape++) {
for (j = 0, doutline = dshape->outlines;
- j < dshape->num_outlines;
- j++, doutline++) {
+ j < dshape->num_outlines; j++, doutline++) {
if (doutline->sz_points)
free(doutline->points);
}
@@ -1542,27 +1556,28 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
if (src->geom->num_shapes) {
/* Reallocate and clear all items. */
- if (!XkbGeomRealloc((void **)&dst->geom->shapes, dst->geom->sz_shapes, src->geom->num_shapes,
- sizeof(XkbShapeRec), XKB_GEOM_CLEAR_ALL))
+ if (!XkbGeomRealloc
+ ((void **) &dst->geom->shapes, dst->geom->sz_shapes,
+ src->geom->num_shapes, sizeof(XkbShapeRec),
+ XKB_GEOM_CLEAR_ALL))
return FALSE;
for (i = 0, sshape = src->geom->shapes, dshape = dst->geom->shapes;
- i < src->geom->num_shapes;
- i++, sshape++, dshape++) {
+ i < src->geom->num_shapes; i++, sshape++, dshape++) {
if (sshape->num_outlines) {
tmp = calloc(sshape->num_outlines, sizeof(XkbOutlineRec));
if (!tmp)
return FALSE;
dshape->outlines = tmp;
-
+
for (j = 0,
- soutline = sshape->outlines,
- doutline = dshape->outlines;
+ soutline = sshape->outlines,
+ doutline = dshape->outlines;
j < sshape->num_outlines;
j++, soutline++, doutline++) {
if (soutline->num_points) {
tmp = malloc(soutline->num_points *
- sizeof(XkbPointRec));
+ sizeof(XkbPointRec));
if (!tmp)
return FALSE;
doutline->points = tmp;
@@ -1587,13 +1602,14 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
if (sshape->approx && sshape->num_outlines > 0) {
const ptrdiff_t approx_idx =
- sshape->approx - sshape->outlines;
+ sshape->approx - sshape->outlines;
if (approx_idx < dshape->num_outlines) {
- dshape->approx = dshape->outlines + approx_idx;
- } else {
- LogMessage(X_WARNING, "XKB: approx outline "
- "index is out of range\n");
+ dshape->approx = dshape->outlines + approx_idx;
+ }
+ else {
+ LogMessage(X_WARNING, "XKB: approx outline "
+ "index is out of range\n");
}
}
@@ -1601,13 +1617,14 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
if (sshape->primary && sshape->num_outlines > 0) {
const ptrdiff_t primary_idx =
- sshape->primary - sshape->outlines;
+ sshape->primary - sshape->outlines;
if (primary_idx < dshape->num_outlines) {
- dshape->primary = dshape->outlines + primary_idx;
- } else {
- LogMessage(X_WARNING, "XKB: primary outline "
- "index is out of range\n");
+ dshape->primary = dshape->outlines + primary_idx;
+ }
+ else {
+ LogMessage(X_WARNING, "XKB: primary outline "
+ "index is out of range\n");
}
}
}
@@ -1629,11 +1646,9 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
* down into keys. */
if (dst->geom->num_sections) {
for (i = 0, dsection = dst->geom->sections;
- i < dst->geom->num_sections;
- i++, dsection++) {
+ i < dst->geom->num_sections; i++, dsection++) {
for (j = 0, drow = dsection->rows;
- j < dsection->num_rows;
- j++, drow++) {
+ j < dsection->num_rows; j++, drow++) {
if (drow->num_keys)
free(drow->keys);
}
@@ -1643,17 +1658,16 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
/* cut and waste from geom/doodad below. */
for (j = 0, ddoodad = dsection->doodads;
- j < dsection->num_doodads;
- j++, ddoodad++) {
+ j < dsection->num_doodads; j++, ddoodad++) {
if (ddoodad->any.type == XkbTextDoodad) {
free(ddoodad->text.text);
ddoodad->text.text = NULL;
free(ddoodad->text.font);
ddoodad->text.font = NULL;
- }
- else if (ddoodad->any.type == XkbLogoDoodad) {
- free(ddoodad->logo.logo_name);
- ddoodad->logo.logo_name = NULL;
+ }
+ else if (ddoodad->any.type == XkbLogoDoodad) {
+ free(ddoodad->logo.logo_name);
+ ddoodad->logo.logo_name = NULL;
}
}
@@ -1665,17 +1679,18 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
if (src->geom->num_sections) {
/* Reallocate and clear all items. */
- if (!XkbGeomRealloc((void **)&dst->geom->sections, dst->geom->sz_sections, src->geom->num_sections,
- sizeof(XkbSectionRec), XKB_GEOM_CLEAR_ALL))
+ if (!XkbGeomRealloc
+ ((void **) &dst->geom->sections, dst->geom->sz_sections,
+ src->geom->num_sections, sizeof(XkbSectionRec),
+ XKB_GEOM_CLEAR_ALL))
return FALSE;
dst->geom->num_sections = src->geom->num_sections;
dst->geom->sz_sections = src->geom->num_sections;
for (i = 0,
- ssection = src->geom->sections,
- dsection = dst->geom->sections;
- i < src->geom->num_sections;
- i++, ssection++, dsection++) {
+ ssection = src->geom->sections,
+ dsection = dst->geom->sections;
+ i < src->geom->num_sections; i++, ssection++, dsection++) {
*dsection = *ssection;
if (ssection->num_rows) {
tmp = calloc(ssection->num_rows, sizeof(XkbRowRec));
@@ -1687,8 +1702,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
dsection->sz_rows = ssection->num_rows;
for (j = 0, srow = ssection->rows, drow = dsection->rows;
- j < ssection->num_rows;
- j++, srow++, drow++) {
+ j < ssection->num_rows; j++, srow++, drow++) {
if (srow->num_keys) {
tmp = malloc(srow->num_keys * sizeof(XkbKeyRec));
if (!tmp)
@@ -1717,23 +1731,20 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
dsection->sz_doodads = ssection->num_doodads;
for (k = 0,
- sdoodad = ssection->doodads,
- ddoodad = dsection->doodads;
- k < ssection->num_doodads;
- k++, sdoodad++, ddoodad++) {
- memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec));
+ sdoodad = ssection->doodads,
+ ddoodad = dsection->doodads;
+ k < ssection->num_doodads; k++, sdoodad++, ddoodad++) {
+ memcpy(ddoodad, sdoodad, sizeof(XkbDoodadRec));
if (sdoodad->any.type == XkbTextDoodad) {
if (sdoodad->text.text)
- ddoodad->text.text =
- strdup(sdoodad->text.text);
+ ddoodad->text.text = strdup(sdoodad->text.text);
if (sdoodad->text.font)
- ddoodad->text.font =
- strdup(sdoodad->text.font);
+ ddoodad->text.font = strdup(sdoodad->text.font);
}
else if (sdoodad->any.type == XkbLogoDoodad) {
if (sdoodad->logo.logo_name)
ddoodad->logo.logo_name =
- strdup(sdoodad->logo.logo_name);
+ strdup(sdoodad->logo.logo_name);
}
}
dsection->overlays = NULL;
@@ -1754,19 +1765,18 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
/* doodads */
if (dst->geom->num_doodads) {
for (i = src->geom->num_doodads,
- ddoodad = dst->geom->doodads +
- src->geom->num_doodads;
- i < dst->geom->num_doodads;
- i++, ddoodad++) {
- if (ddoodad->any.type == XkbTextDoodad) {
- free(ddoodad->text.text);
- ddoodad->text.text = NULL;
- free(ddoodad->text.font);
- ddoodad->text.font = NULL;
- }
- else if (ddoodad->any.type == XkbLogoDoodad) {
- free(ddoodad->logo.logo_name);
- ddoodad->logo.logo_name = NULL;
+ ddoodad = dst->geom->doodads +
+ src->geom->num_doodads;
+ i < dst->geom->num_doodads; i++, ddoodad++) {
+ if (ddoodad->any.type == XkbTextDoodad) {
+ free(ddoodad->text.text);
+ ddoodad->text.text = NULL;
+ free(ddoodad->text.font);
+ ddoodad->text.font = NULL;
+ }
+ else if (ddoodad->any.type == XkbLogoDoodad) {
+ free(ddoodad->logo.logo_name);
+ ddoodad->logo.logo_name = NULL;
}
}
dst->geom->num_doodads = 0;
@@ -1774,18 +1784,19 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
if (src->geom->num_doodads) {
/* Reallocate and clear all items. */
- if (!XkbGeomRealloc((void **)&dst->geom->doodads, dst->geom->sz_doodads, src->geom->num_doodads,
- sizeof(XkbDoodadRec), XKB_GEOM_CLEAR_ALL))
+ if (!XkbGeomRealloc
+ ((void **) &dst->geom->doodads, dst->geom->sz_doodads,
+ src->geom->num_doodads, sizeof(XkbDoodadRec),
+ XKB_GEOM_CLEAR_ALL))
return FALSE;
dst->geom->sz_doodads = src->geom->num_doodads;
for (i = 0,
- sdoodad = src->geom->doodads,
- ddoodad = dst->geom->doodads;
- i < src->geom->num_doodads;
- i++, sdoodad++, ddoodad++) {
- memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec));
+ sdoodad = src->geom->doodads,
+ ddoodad = dst->geom->doodads;
+ i < src->geom->num_doodads; i++, sdoodad++, ddoodad++) {
+ memcpy(ddoodad, sdoodad, sizeof(XkbDoodadRec));
if (sdoodad->any.type == XkbTextDoodad) {
if (sdoodad->text.text)
ddoodad->text.text = strdup(sdoodad->text.text);
@@ -1795,7 +1806,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
else if (sdoodad->any.type == XkbLogoDoodad) {
if (sdoodad->logo.logo_name)
ddoodad->logo.logo_name =
- strdup(sdoodad->logo.logo_name);
+ strdup(sdoodad->logo.logo_name);
}
}
@@ -1816,8 +1827,10 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
/* Reallocate but don't clear any items. There is no need
* to clear anything because data is immediately copied
* over the whole memory area with memcpy. */
- if (!XkbGeomRealloc((void **)&dst->geom->key_aliases, dst->geom->sz_key_aliases, src->geom->num_key_aliases,
- 2 * XkbKeyNameLength, XKB_GEOM_CLEAR_NONE))
+ if (!XkbGeomRealloc
+ ((void **) &dst->geom->key_aliases, dst->geom->sz_key_aliases,
+ src->geom->num_key_aliases, 2 * XkbKeyNameLength,
+ XKB_GEOM_CLEAR_NONE))
return FALSE;
dst->geom->sz_key_aliases = src->geom->num_key_aliases;
@@ -1833,7 +1846,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
dst->geom->num_key_aliases = 0;
dst->geom->sz_key_aliases = 0;
}
-
+
/* font */
if (src->geom->label_font) {
if (!dst->geom->label_font) {
@@ -1843,9 +1856,9 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
dst->geom->label_font = tmp;
}
else if (strlen(src->geom->label_font) !=
- strlen(dst->geom->label_font)) {
+ strlen(dst->geom->label_font)) {
tmp = realloc(dst->geom->label_font,
- strlen(src->geom->label_font) + 1);
+ strlen(src->geom->label_font) + 1);
if (!tmp)
return FALSE;
dst->geom->label_font = tmp;
@@ -1868,8 +1881,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
dst->geom->width_mm = src->geom->width_mm;
dst->geom->height_mm = src->geom->height_mm;
}
- else
- {
+ else {
if (dst->geom) {
/* I LOVE THE DIFFERENT CALL SIGNATURE. REALLY, I DO. */
XkbFreeGeometry(dst->geom, XkbGeomAllMask, TRUE);
@@ -1993,11 +2005,11 @@ XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src)
nkn.oldMinKeyCode = dst->key->xkbInfo->desc->min_key_code;
nkn.oldMaxKeyCode = dst->key->xkbInfo->desc->max_key_code;
nkn.deviceID = dst->id;
- nkn.oldDeviceID = dst->id; /* maybe src->id? */
+ nkn.oldDeviceID = dst->id; /* maybe src->id? */
nkn.minKeyCode = src->key->xkbInfo->desc->min_key_code;
nkn.maxKeyCode = src->key->xkbInfo->desc->max_key_code;
nkn.requestMajor = XkbReqCode;
- nkn.requestMinor = X_kbSetMap; /* Near enough's good enough. */
+ nkn.requestMinor = X_kbSetMap; /* Near enough's good enough. */
nkn.changed = XkbNKN_KeycodesMask;
if (src->key->xkbInfo->desc->geom)
nkn.changed |= XkbNKN_GeometryMask;
@@ -2021,26 +2033,28 @@ XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode)
if (effectiveGroup == XkbGroup1Index)
return effectiveGroup;
- if (XkbKeyNumGroups(xkb,keycode) > 1U) {
- if (effectiveGroup >= XkbKeyNumGroups(xkb,keycode)) {
- unsigned int gi = XkbKeyGroupInfo(xkb,keycode);
+ if (XkbKeyNumGroups(xkb, keycode) > 1U) {
+ if (effectiveGroup >= XkbKeyNumGroups(xkb, keycode)) {
+ unsigned int gi = XkbKeyGroupInfo(xkb, keycode);
+
switch (XkbOutOfRangeGroupAction(gi)) {
- default:
- case XkbWrapIntoRange:
- effectiveGroup %= XkbKeyNumGroups(xkb, keycode);
- break;
- case XkbClampIntoRange:
- effectiveGroup = XkbKeyNumGroups(xkb, keycode) - 1;
- break;
- case XkbRedirectIntoRange:
- effectiveGroup = XkbOutOfRangeGroupInfo(gi);
- if (effectiveGroup >= XkbKeyNumGroups(xkb, keycode))
- effectiveGroup = 0;
- break;
+ default:
+ case XkbWrapIntoRange:
+ effectiveGroup %= XkbKeyNumGroups(xkb, keycode);
+ break;
+ case XkbClampIntoRange:
+ effectiveGroup = XkbKeyNumGroups(xkb, keycode) - 1;
+ break;
+ case XkbRedirectIntoRange:
+ effectiveGroup = XkbOutOfRangeGroupInfo(gi);
+ if (effectiveGroup >= XkbKeyNumGroups(xkb, keycode))
+ effectiveGroup = 0;
+ break;
}
}
}
- else effectiveGroup = XkbGroup1Index;
+ else
+ effectiveGroup = XkbGroup1Index;
return effectiveGroup;
}
diff --git a/xorg-server/xkb/xkbfmisc.c b/xorg-server/xkb/xkbfmisc.c
index 782b823bb..d96ee4b52 100644
--- a/xorg-server/xkb/xkbfmisc.c
+++ b/xorg-server/xkb/xkbfmisc.c
@@ -51,94 +51,92 @@
unsigned
_XkbKSCheckCase(KeySym ks)
{
-unsigned set,rtrn;
+ unsigned set, rtrn;
- set= (ks & (~0xff)) >> 8;
- rtrn= 0;
+ set = (ks & (~0xff)) >> 8;
+ rtrn = 0;
switch (set) {
- case 0: /* latin 1 */
- if (((ks>=XK_A)&&(ks<=XK_Z))||
- ((ks>=XK_Agrave)&&(ks<=XK_THORN)&&(ks!=XK_multiply))) {
- rtrn|= _XkbKSUpper;
- }
- if (((ks>=XK_a)&&(ks<=XK_z))||
- ((ks>=XK_ssharp)&&(ks<=XK_ydiaeresis)&&(ks!=XK_division))) {
- rtrn|= _XkbKSLower;
- }
- break;
- case 1: /* latin 2 */
- if (((ks>=XK_Aogonek)&&(ks<=XK_Zabovedot)&&(ks!=XK_breve))||
- ((ks>=XK_Racute)&&(ks<=XK_Tcedilla))) {
- rtrn|= _XkbKSUpper;
- }
- if (((ks>=XK_aogonek)&&(ks<=XK_zabovedot)&&(ks!=XK_ogonek)&&(ks!=XK_caron)&&(ks!=XK_doubleacute))||
- ((ks>=XK_racute)&&(ks<=XK_tcedilla))) {
- rtrn|= _XkbKSLower;
- }
- break;
- case 2: /* latin 3 */
- if (((ks>=XK_Hstroke)&&(ks<=XK_Jcircumflex))||
- ((ks>=XK_Cabovedot)&&(ks<=XK_Scircumflex))) {
- rtrn|= _XkbKSUpper;
- }
- if (((ks>=XK_hstroke)&&(ks<=XK_jcircumflex))||
- ((ks>=XK_cabovedot)&&(ks<=XK_scircumflex))) {
- rtrn|= _XkbKSLower;
- }
- break;
- case 3: /* latin 4 */
- if (((ks>=XK_Rcedilla)&&(ks<=XK_Tslash))||
- (ks==XK_ENG)||
- ((ks>=XK_Amacron)&&(ks<=XK_Umacron))) {
- rtrn|= _XkbKSUpper;
- }
- if ((ks==XK_kra)||
- ((ks>=XK_rcedilla)&&(ks<=XK_tslash))||
- (ks==XK_eng)||
- ((ks>=XK_amacron)&&(ks<=XK_umacron))) {
- rtrn|= _XkbKSLower;
- }
- break;
- case 18: /* latin 8 */
- if ((ks==XK_Wcircumflex)||
- (ks==XK_Ycircumflex)||
- (ks==XK_Babovedot)||
- (ks==XK_Dabovedot)||
- (ks==XK_Fabovedot)||
- (ks==XK_Mabovedot)||
- (ks==XK_Pabovedot)||
- (ks==XK_Sabovedot)||
- (ks==XK_Tabovedot)||
- (ks==XK_Wgrave)||
- (ks==XK_Wacute)||
- (ks==XK_Wdiaeresis)||
- (ks==XK_Ygrave)) {
- rtrn|= _XkbKSUpper;
- }
- if ((ks==XK_wcircumflex)||
- (ks==XK_ycircumflex)||
- (ks==XK_babovedot)||
- (ks==XK_dabovedot)||
- (ks==XK_fabovedot)||
- (ks==XK_mabovedot)||
- (ks==XK_pabovedot)||
- (ks==XK_sabovedot)||
- (ks==XK_tabovedot)||
- (ks==XK_wgrave)||
- (ks==XK_wacute)||
- (ks==XK_wdiaeresis)||
- (ks==XK_ygrave)) {
- rtrn|= _XkbKSLower;
- }
- break;
- case 19: /* latin 9 */
- if ((ks==XK_OE)||(ks==XK_Ydiaeresis)) {
- rtrn|= _XkbKSUpper;
- }
- if (ks==XK_oe) {
- rtrn|= _XkbKSLower;
- }
- break;
+ case 0: /* latin 1 */
+ if (((ks >= XK_A) && (ks <= XK_Z)) ||
+ ((ks >= XK_Agrave) && (ks <= XK_THORN) && (ks != XK_multiply))) {
+ rtrn |= _XkbKSUpper;
+ }
+ if (((ks >= XK_a) && (ks <= XK_z)) ||
+ ((ks >= XK_ssharp) && (ks <= XK_ydiaeresis) &&
+ (ks != XK_division))) {
+ rtrn |= _XkbKSLower;
+ }
+ break;
+ case 1: /* latin 2 */
+ if (((ks >= XK_Aogonek) && (ks <= XK_Zabovedot) && (ks != XK_breve)) ||
+ ((ks >= XK_Racute) && (ks <= XK_Tcedilla))) {
+ rtrn |= _XkbKSUpper;
+ }
+ if (((ks >= XK_aogonek) && (ks <= XK_zabovedot) && (ks != XK_ogonek) &&
+ (ks != XK_caron) && (ks != XK_doubleacute)) || ((ks >= XK_racute)
+ && (ks <=
+ XK_tcedilla)))
+ {
+ rtrn |= _XkbKSLower;
+ }
+ break;
+ case 2: /* latin 3 */
+ if (((ks >= XK_Hstroke) && (ks <= XK_Jcircumflex)) ||
+ ((ks >= XK_Cabovedot) && (ks <= XK_Scircumflex))) {
+ rtrn |= _XkbKSUpper;
+ }
+ if (((ks >= XK_hstroke) && (ks <= XK_jcircumflex)) ||
+ ((ks >= XK_cabovedot) && (ks <= XK_scircumflex))) {
+ rtrn |= _XkbKSLower;
+ }
+ break;
+ case 3: /* latin 4 */
+ if (((ks >= XK_Rcedilla) && (ks <= XK_Tslash)) ||
+ (ks == XK_ENG) || ((ks >= XK_Amacron) && (ks <= XK_Umacron))) {
+ rtrn |= _XkbKSUpper;
+ }
+ if ((ks == XK_kra) ||
+ ((ks >= XK_rcedilla) && (ks <= XK_tslash)) ||
+ (ks == XK_eng) || ((ks >= XK_amacron) && (ks <= XK_umacron))) {
+ rtrn |= _XkbKSLower;
+ }
+ break;
+ case 18: /* latin 8 */
+ if ((ks == XK_Wcircumflex) ||
+ (ks == XK_Ycircumflex) ||
+ (ks == XK_Babovedot) ||
+ (ks == XK_Dabovedot) ||
+ (ks == XK_Fabovedot) ||
+ (ks == XK_Mabovedot) ||
+ (ks == XK_Pabovedot) ||
+ (ks == XK_Sabovedot) ||
+ (ks == XK_Tabovedot) ||
+ (ks == XK_Wgrave) ||
+ (ks == XK_Wacute) || (ks == XK_Wdiaeresis) || (ks == XK_Ygrave)) {
+ rtrn |= _XkbKSUpper;
+ }
+ if ((ks == XK_wcircumflex) ||
+ (ks == XK_ycircumflex) ||
+ (ks == XK_babovedot) ||
+ (ks == XK_dabovedot) ||
+ (ks == XK_fabovedot) ||
+ (ks == XK_mabovedot) ||
+ (ks == XK_pabovedot) ||
+ (ks == XK_sabovedot) ||
+ (ks == XK_tabovedot) ||
+ (ks == XK_wgrave) ||
+ (ks == XK_wacute) || (ks == XK_wdiaeresis) || (ks == XK_ygrave)) {
+ rtrn |= _XkbKSLower;
+ }
+ break;
+ case 19: /* latin 9 */
+ if ((ks == XK_OE) || (ks == XK_Ydiaeresis)) {
+ rtrn |= _XkbKSUpper;
+ }
+ if (ks == XK_oe) {
+ rtrn |= _XkbKSLower;
+ }
+ break;
}
return rtrn;
}
@@ -146,9 +144,9 @@ unsigned set,rtrn;
/***===================================================================***/
static Bool
-XkbWriteSectionFromName(FILE *file,const char *sectionName,const char *name)
+XkbWriteSectionFromName(FILE * file, const char *sectionName, const char *name)
{
- fprintf(file," xkb_%-20s { include \"%s\" };\n",sectionName,name);
+ fprintf(file, " xkb_%-20s { include \"%s\" };\n", sectionName, name);
return TRUE;
}
@@ -157,43 +155,43 @@ XkbWriteSectionFromName(FILE *file,const char *sectionName,const char *name)
/* ARGSUSED */
static void
-_AddIncl( FILE * file,
- XkbDescPtr xkb,
- Bool topLevel,
- Bool showImplicit,
- int index,
- void * priv)
+_AddIncl(FILE * file,
+ XkbDescPtr xkb,
+ Bool topLevel, Bool showImplicit, int index, void *priv)
{
- if ((priv)&&(strcmp((char *)priv,"%")!=0))
- fprintf(file," include \"%s\"\n",(char *)priv);
+ if ((priv) && (strcmp((char *) priv, "%") != 0))
+ fprintf(file, " include \"%s\"\n", (char *) priv);
return;
}
Bool
-XkbWriteXKBKeymapForNames( FILE * file,
- XkbComponentNamesPtr names,
- XkbDescPtr xkb,
- unsigned want,
- unsigned need)
+XkbWriteXKBKeymapForNames(FILE * file,
+ XkbComponentNamesPtr names,
+ XkbDescPtr xkb, unsigned want, unsigned need)
{
-const char * tmp;
-unsigned complete;
-XkbNamesPtr old_names;
-int multi_section;
-unsigned wantNames,wantConfig,wantDflts;
-
- complete= 0;
- if (COMPLETE(names->keycodes)) complete|= XkmKeyNamesMask;
- if (COMPLETE(names->types)) complete|= XkmTypesMask;
- if (COMPLETE(names->compat)) complete|= XkmCompatMapMask;
- if (COMPLETE(names->symbols)) complete|= XkmSymbolsMask;
- if (COMPLETE(names->geometry)) complete|= XkmGeometryMask;
- want|= (complete|need);
- if (want&XkmSymbolsMask)
- want|= XkmKeyNamesMask|XkmTypesMask;
-
- if (want==0)
- return FALSE;
+ const char *tmp;
+ unsigned complete;
+ XkbNamesPtr old_names;
+ int multi_section;
+ unsigned wantNames, wantConfig, wantDflts;
+
+ complete = 0;
+ if (COMPLETE(names->keycodes))
+ complete |= XkmKeyNamesMask;
+ if (COMPLETE(names->types))
+ complete |= XkmTypesMask;
+ if (COMPLETE(names->compat))
+ complete |= XkmCompatMapMask;
+ if (COMPLETE(names->symbols))
+ complete |= XkmSymbolsMask;
+ if (COMPLETE(names->geometry))
+ complete |= XkmGeometryMask;
+ want |= (complete | need);
+ if (want & XkmSymbolsMask)
+ want |= XkmKeyNamesMask | XkmTypesMask;
+
+ if (want == 0)
+ return FALSE;
if (xkb) {
old_names = xkb->names;
@@ -214,207 +212,224 @@ unsigned wantNames,wantConfig,wantDflts;
xkb->defined |= XkmGeometryMask;
}
else {
- old_names= NULL;
+ old_names = NULL;
}
- wantConfig= want&(~complete);
- if (xkb!=NULL) {
- if (wantConfig&XkmTypesMask) {
- if ((!xkb->map) || (xkb->map->num_types<XkbNumRequiredTypes))
- wantConfig&= ~XkmTypesMask;
- }
- if (wantConfig&XkmCompatMapMask) {
- if ((!xkb->compat) || (xkb->compat->num_si<1))
- wantConfig&= ~XkmCompatMapMask;
- }
- if (wantConfig&XkmSymbolsMask) {
- if ((!xkb->map) || (!xkb->map->key_sym_map))
- wantConfig&= ~XkmSymbolsMask;
- }
- if (wantConfig&XkmIndicatorsMask) {
- if (!xkb->indicators)
- wantConfig&= ~XkmIndicatorsMask;
- }
- if (wantConfig&XkmKeyNamesMask) {
- if ((!xkb->names)||(!xkb->names->keys))
- wantConfig&= ~XkmKeyNamesMask;
- }
- if ((wantConfig&XkmGeometryMask)&&(!xkb->geom))
- wantConfig&= ~XkmGeometryMask;
+ wantConfig = want & (~complete);
+ if (xkb != NULL) {
+ if (wantConfig & XkmTypesMask) {
+ if ((!xkb->map) || (xkb->map->num_types < XkbNumRequiredTypes))
+ wantConfig &= ~XkmTypesMask;
+ }
+ if (wantConfig & XkmCompatMapMask) {
+ if ((!xkb->compat) || (xkb->compat->num_si < 1))
+ wantConfig &= ~XkmCompatMapMask;
+ }
+ if (wantConfig & XkmSymbolsMask) {
+ if ((!xkb->map) || (!xkb->map->key_sym_map))
+ wantConfig &= ~XkmSymbolsMask;
+ }
+ if (wantConfig & XkmIndicatorsMask) {
+ if (!xkb->indicators)
+ wantConfig &= ~XkmIndicatorsMask;
+ }
+ if (wantConfig & XkmKeyNamesMask) {
+ if ((!xkb->names) || (!xkb->names->keys))
+ wantConfig &= ~XkmKeyNamesMask;
+ }
+ if ((wantConfig & XkmGeometryMask) && (!xkb->geom))
+ wantConfig &= ~XkmGeometryMask;
}
else {
- wantConfig= 0;
+ wantConfig = 0;
}
- complete|= wantConfig;
-
- wantDflts= 0;
- wantNames= want&(~complete);
- if ((xkb!=NULL) && (old_names!=NULL)) {
- if (wantNames&XkmTypesMask) {
- if (old_names->types!=None) {
- tmp= NameForAtom(old_names->types);
- names->types= Xstrdup(tmp);
- }
- else {
- wantDflts|= XkmTypesMask;
- }
- complete|= XkmTypesMask;
- }
- if (wantNames&XkmCompatMapMask) {
- if (old_names->compat!=None) {
- tmp= NameForAtom(old_names->compat);
- names->compat= Xstrdup(tmp);
- }
- else wantDflts|= XkmCompatMapMask;
- complete|= XkmCompatMapMask;
- }
- if (wantNames&XkmSymbolsMask) {
- if (old_names->symbols==None)
- return FALSE;
- tmp= NameForAtom(old_names->symbols);
- names->symbols= Xstrdup(tmp);
- complete|= XkmSymbolsMask;
- }
- if (wantNames&XkmKeyNamesMask) {
- if (old_names->keycodes!=None) {
- tmp= NameForAtom(old_names->keycodes);
- names->keycodes= Xstrdup(tmp);
- }
- else wantDflts|= XkmKeyNamesMask;
- complete|= XkmKeyNamesMask;
- }
- if (wantNames&XkmGeometryMask) {
- if (old_names->geometry==None)
- return FALSE;
- tmp= NameForAtom(old_names->geometry);
- names->geometry= Xstrdup(tmp);
- complete|= XkmGeometryMask;
- wantNames&= ~XkmGeometryMask;
- }
+ complete |= wantConfig;
+
+ wantDflts = 0;
+ wantNames = want & (~complete);
+ if ((xkb != NULL) && (old_names != NULL)) {
+ if (wantNames & XkmTypesMask) {
+ if (old_names->types != None) {
+ tmp = NameForAtom(old_names->types);
+ names->types = Xstrdup(tmp);
+ }
+ else {
+ wantDflts |= XkmTypesMask;
+ }
+ complete |= XkmTypesMask;
+ }
+ if (wantNames & XkmCompatMapMask) {
+ if (old_names->compat != None) {
+ tmp = NameForAtom(old_names->compat);
+ names->compat = Xstrdup(tmp);
+ }
+ else
+ wantDflts |= XkmCompatMapMask;
+ complete |= XkmCompatMapMask;
+ }
+ if (wantNames & XkmSymbolsMask) {
+ if (old_names->symbols == None)
+ return FALSE;
+ tmp = NameForAtom(old_names->symbols);
+ names->symbols = Xstrdup(tmp);
+ complete |= XkmSymbolsMask;
+ }
+ if (wantNames & XkmKeyNamesMask) {
+ if (old_names->keycodes != None) {
+ tmp = NameForAtom(old_names->keycodes);
+ names->keycodes = Xstrdup(tmp);
+ }
+ else
+ wantDflts |= XkmKeyNamesMask;
+ complete |= XkmKeyNamesMask;
+ }
+ if (wantNames & XkmGeometryMask) {
+ if (old_names->geometry == None)
+ return FALSE;
+ tmp = NameForAtom(old_names->geometry);
+ names->geometry = Xstrdup(tmp);
+ complete |= XkmGeometryMask;
+ wantNames &= ~XkmGeometryMask;
+ }
}
- if (complete&XkmCompatMapMask)
- complete|= XkmIndicatorsMask|XkmVirtualModsMask;
- else if (complete&(XkmSymbolsMask|XkmTypesMask))
- complete|= XkmVirtualModsMask;
+ if (complete & XkmCompatMapMask)
+ complete |= XkmIndicatorsMask | XkmVirtualModsMask;
+ else if (complete & (XkmSymbolsMask | XkmTypesMask))
+ complete |= XkmVirtualModsMask;
if (need & (~complete))
- return FALSE;
- if ((complete&XkmSymbolsMask)&&((XkmKeyNamesMask|XkmTypesMask)&(~complete)))
- return FALSE;
-
- multi_section= 1;
- if (((complete&XkmKeymapRequired)==XkmKeymapRequired)&&
- ((complete&(~XkmKeymapLegal))==0)) {
- fprintf(file,"xkb_keymap \"default\" {\n");
+ return FALSE;
+ if ((complete & XkmSymbolsMask) &&
+ ((XkmKeyNamesMask | XkmTypesMask) & (~complete)))
+ return FALSE;
+
+ multi_section = 1;
+ if (((complete & XkmKeymapRequired) == XkmKeymapRequired) &&
+ ((complete & (~XkmKeymapLegal)) == 0)) {
+ fprintf(file, "xkb_keymap \"default\" {\n");
}
- else if (((complete&XkmSemanticsRequired)==XkmSemanticsRequired)&&
- ((complete&(~XkmSemanticsLegal))==0)) {
- fprintf(file,"xkb_semantics \"default\" {\n");
+ else if (((complete & XkmSemanticsRequired) == XkmSemanticsRequired) &&
+ ((complete & (~XkmSemanticsLegal)) == 0)) {
+ fprintf(file, "xkb_semantics \"default\" {\n");
}
- else if (((complete&XkmLayoutRequired)==XkmLayoutRequired)&&
- ((complete&(~XkmLayoutLegal))==0)) {
- fprintf(file,"xkb_layout \"default\" {\n");
+ else if (((complete & XkmLayoutRequired) == XkmLayoutRequired) &&
+ ((complete & (~XkmLayoutLegal)) == 0)) {
+ fprintf(file, "xkb_layout \"default\" {\n");
}
- else if (XkmSingleSection(complete&(~XkmVirtualModsMask))) {
- multi_section= 0;
+ else if (XkmSingleSection(complete & (~XkmVirtualModsMask))) {
+ multi_section = 0;
}
else {
- return FALSE;
+ return FALSE;
}
- wantNames= complete&(~(wantConfig|wantDflts));
- if (wantConfig&XkmKeyNamesMask)
- XkbWriteXKBKeycodes(file,xkb,FALSE,FALSE,_AddIncl,names->keycodes);
- else if (wantDflts&XkmKeyNamesMask)
- fprintf(stderr,"Default symbols not implemented yet!\n");
- else if (wantNames&XkmKeyNamesMask)
- XkbWriteSectionFromName(file,"keycodes",names->keycodes);
-
- if (wantConfig&XkmTypesMask)
- XkbWriteXKBKeyTypes(file,xkb,FALSE,FALSE,_AddIncl,names->types);
- else if (wantDflts&XkmTypesMask)
- fprintf(stderr,"Default types not implemented yet!\n");
- else if (wantNames&XkmTypesMask)
- XkbWriteSectionFromName(file,"types",names->types);
-
- if (wantConfig&XkmCompatMapMask)
- XkbWriteXKBCompatMap(file,xkb,FALSE,FALSE,_AddIncl,names->compat);
- else if (wantDflts&XkmCompatMapMask)
- fprintf(stderr,"Default interps not implemented yet!\n");
- else if (wantNames&XkmCompatMapMask)
- XkbWriteSectionFromName(file,"compatibility",names->compat);
-
- if (wantConfig&XkmSymbolsMask)
- XkbWriteXKBSymbols(file,xkb,FALSE,FALSE,_AddIncl,names->symbols);
- else if (wantNames&XkmSymbolsMask)
- XkbWriteSectionFromName(file,"symbols",names->symbols);
-
- if (wantConfig&XkmGeometryMask)
- XkbWriteXKBGeometry(file,xkb,FALSE,FALSE,_AddIncl,names->geometry);
- else if (wantNames&XkmGeometryMask)
- XkbWriteSectionFromName(file,"geometry",names->geometry);
+ wantNames = complete & (~(wantConfig | wantDflts));
+ if (wantConfig & XkmKeyNamesMask)
+ XkbWriteXKBKeycodes(file, xkb, FALSE, FALSE, _AddIncl, names->keycodes);
+ else if (wantDflts & XkmKeyNamesMask)
+ fprintf(stderr, "Default symbols not implemented yet!\n");
+ else if (wantNames & XkmKeyNamesMask)
+ XkbWriteSectionFromName(file, "keycodes", names->keycodes);
+
+ if (wantConfig & XkmTypesMask)
+ XkbWriteXKBKeyTypes(file, xkb, FALSE, FALSE, _AddIncl, names->types);
+ else if (wantDflts & XkmTypesMask)
+ fprintf(stderr, "Default types not implemented yet!\n");
+ else if (wantNames & XkmTypesMask)
+ XkbWriteSectionFromName(file, "types", names->types);
+
+ if (wantConfig & XkmCompatMapMask)
+ XkbWriteXKBCompatMap(file, xkb, FALSE, FALSE, _AddIncl, names->compat);
+ else if (wantDflts & XkmCompatMapMask)
+ fprintf(stderr, "Default interps not implemented yet!\n");
+ else if (wantNames & XkmCompatMapMask)
+ XkbWriteSectionFromName(file, "compatibility", names->compat);
+
+ if (wantConfig & XkmSymbolsMask)
+ XkbWriteXKBSymbols(file, xkb, FALSE, FALSE, _AddIncl, names->symbols);
+ else if (wantNames & XkmSymbolsMask)
+ XkbWriteSectionFromName(file, "symbols", names->symbols);
+
+ if (wantConfig & XkmGeometryMask)
+ XkbWriteXKBGeometry(file, xkb, FALSE, FALSE, _AddIncl, names->geometry);
+ else if (wantNames & XkmGeometryMask)
+ XkbWriteSectionFromName(file, "geometry", names->geometry);
if (multi_section)
- fprintf(file,"};\n");
+ fprintf(file, "};\n");
return TRUE;
}
/***====================================================================***/
int
-XkbFindKeycodeByName(XkbDescPtr xkb,char *name,Bool use_aliases)
+XkbFindKeycodeByName(XkbDescPtr xkb, char *name, Bool use_aliases)
{
-register int i;
+ register int i;
- if ((!xkb)||(!xkb->names)||(!xkb->names->keys))
- return 0;
- for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- if (strncmp(xkb->names->keys[i].name,name,XkbKeyNameLength)==0)
- return i;
+ if ((!xkb) || (!xkb->names) || (!xkb->names->keys))
+ return 0;
+ for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ if (strncmp(xkb->names->keys[i].name, name, XkbKeyNameLength) == 0)
+ return i;
}
if (!use_aliases)
- return 0;
+ return 0;
if (xkb->geom && xkb->geom->key_aliases) {
- XkbKeyAliasPtr a;
- a= xkb->geom->key_aliases;
- for (i=0;i<xkb->geom->num_key_aliases;i++,a++) {
- if (strncmp(name,a->alias,XkbKeyNameLength)==0)
- return XkbFindKeycodeByName(xkb,a->real,FALSE);
- }
+ XkbKeyAliasPtr a;
+
+ a = xkb->geom->key_aliases;
+ for (i = 0; i < xkb->geom->num_key_aliases; i++, a++) {
+ if (strncmp(name, a->alias, XkbKeyNameLength) == 0)
+ return XkbFindKeycodeByName(xkb, a->real, FALSE);
+ }
}
if (xkb->names && xkb->names->key_aliases) {
- XkbKeyAliasPtr a;
- a= xkb->names->key_aliases;
- for (i=0;i<xkb->names->num_key_aliases;i++,a++) {
- if (strncmp(name,a->alias,XkbKeyNameLength)==0)
- return XkbFindKeycodeByName(xkb,a->real,FALSE);
- }
+ XkbKeyAliasPtr a;
+
+ a = xkb->names->key_aliases;
+ for (i = 0; i < xkb->names->num_key_aliases; i++, a++) {
+ if (strncmp(name, a->alias, XkbKeyNameLength) == 0)
+ return XkbFindKeycodeByName(xkb, a->real, FALSE);
+ }
}
return 0;
}
-
unsigned
-XkbConvertGetByNameComponents(Bool toXkm,unsigned orig)
+XkbConvertGetByNameComponents(Bool toXkm, unsigned orig)
{
-unsigned rtrn;
+ unsigned rtrn;
- rtrn= 0;
+ rtrn = 0;
if (toXkm) {
- if (orig&XkbGBN_TypesMask) rtrn|= XkmTypesMask;
- if (orig&XkbGBN_CompatMapMask) rtrn|= XkmCompatMapMask;
- if (orig&XkbGBN_SymbolsMask) rtrn|= XkmSymbolsMask;
- if (orig&XkbGBN_IndicatorMapMask) rtrn|= XkmIndicatorsMask;
- if (orig&XkbGBN_KeyNamesMask) rtrn|= XkmKeyNamesMask;
- if (orig&XkbGBN_GeometryMask) rtrn|= XkmGeometryMask;
+ if (orig & XkbGBN_TypesMask)
+ rtrn |= XkmTypesMask;
+ if (orig & XkbGBN_CompatMapMask)
+ rtrn |= XkmCompatMapMask;
+ if (orig & XkbGBN_SymbolsMask)
+ rtrn |= XkmSymbolsMask;
+ if (orig & XkbGBN_IndicatorMapMask)
+ rtrn |= XkmIndicatorsMask;
+ if (orig & XkbGBN_KeyNamesMask)
+ rtrn |= XkmKeyNamesMask;
+ if (orig & XkbGBN_GeometryMask)
+ rtrn |= XkmGeometryMask;
}
else {
- if (orig&XkmTypesMask) rtrn|= XkbGBN_TypesMask;
- if (orig&XkmCompatMapMask) rtrn|= XkbGBN_CompatMapMask;
- if (orig&XkmSymbolsMask) rtrn|= XkbGBN_SymbolsMask;
- if (orig&XkmIndicatorsMask) rtrn|= XkbGBN_IndicatorMapMask;
- if (orig&XkmKeyNamesMask) rtrn|= XkbGBN_KeyNamesMask;
- if (orig&XkmGeometryMask) rtrn|= XkbGBN_GeometryMask;
- if (orig!=0) rtrn|= XkbGBN_OtherNamesMask;
+ if (orig & XkmTypesMask)
+ rtrn |= XkbGBN_TypesMask;
+ if (orig & XkmCompatMapMask)
+ rtrn |= XkbGBN_CompatMapMask;
+ if (orig & XkmSymbolsMask)
+ rtrn |= XkbGBN_SymbolsMask;
+ if (orig & XkmIndicatorsMask)
+ rtrn |= XkbGBN_IndicatorMapMask;
+ if (orig & XkmKeyNamesMask)
+ rtrn |= XkbGBN_KeyNamesMask;
+ if (orig & XkmGeometryMask)
+ rtrn |= XkbGBN_GeometryMask;
+ if (orig != 0)
+ rtrn |= XkbGBN_OtherNamesMask;
}
return rtrn;
}
@@ -424,30 +439,31 @@ unsigned rtrn;
#define UNMATCHABLE(c) (((c)=='(')||((c)==')')||((c)=='/'))
Bool
-XkbNameMatchesPattern(char *name,char *ptrn)
+XkbNameMatchesPattern(char *name, char *ptrn)
{
- while (ptrn[0]!='\0') {
- if (name[0]=='\0') {
- if (ptrn[0]=='*') {
- ptrn++;
- continue;
- }
- return FALSE;
- }
- if (ptrn[0]=='?') {
- if (UNMATCHABLE(name[0]))
- return FALSE;
- }
- else if (ptrn[0]=='*') {
- if ((!UNMATCHABLE(name[0]))&&XkbNameMatchesPattern(name+1,ptrn))
- return TRUE;
- return XkbNameMatchesPattern(name,ptrn+1);
- }
- else if (ptrn[0]!=name[0])
- return FALSE;
- name++;
- ptrn++;
+ while (ptrn[0] != '\0') {
+ if (name[0] == '\0') {
+ if (ptrn[0] == '*') {
+ ptrn++;
+ continue;
+ }
+ return FALSE;
+ }
+ if (ptrn[0] == '?') {
+ if (UNMATCHABLE(name[0]))
+ return FALSE;
+ }
+ else if (ptrn[0] == '*') {
+ if ((!UNMATCHABLE(name[0])) &&
+ XkbNameMatchesPattern(name + 1, ptrn))
+ return TRUE;
+ return XkbNameMatchesPattern(name, ptrn + 1);
+ }
+ else if (ptrn[0] != name[0])
+ return FALSE;
+ name++;
+ ptrn++;
}
/* if we get here, the pattern is exhausted (-:just like me:-) */
- return name[0]=='\0';
+ return name[0] == '\0';
}
diff --git a/xorg-server/xkb/xkbgeom.h b/xorg-server/xkb/xkbgeom.h
index d10b956a6..bef3775db 100644
--- a/xorg-server/xkb/xkbgeom.h
+++ b/xorg-server/xkb/xkbgeom.h
@@ -71,88 +71,93 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define XkbFreeGeomShapes SrvXkbFreeGeomShapes
#define XkbFreeGeometry SrvXkbFreeGeometry
-typedef struct _XkbProperty {
- char *name;
- char *value;
-} XkbPropertyRec,*XkbPropertyPtr;
+typedef struct _XkbProperty {
+ char *name;
+ char *value;
+} XkbPropertyRec, *XkbPropertyPtr;
typedef struct _XkbColor {
- unsigned int pixel;
- char * spec;
-} XkbColorRec,*XkbColorPtr;
+ unsigned int pixel;
+ char *spec;
+} XkbColorRec, *XkbColorPtr;
-typedef struct _XkbPoint {
- short x;
- short y;
+typedef struct _XkbPoint {
+ short x;
+ short y;
} XkbPointRec, *XkbPointPtr;
-typedef struct _XkbBounds {
- short x1,y1;
- short x2,y2;
+typedef struct _XkbBounds {
+ short x1, y1;
+ short x2, y2;
} XkbBoundsRec, *XkbBoundsPtr;
+
#define XkbBoundsWidth(b) (((b)->x2)-((b)->x1))
#define XkbBoundsHeight(b) (((b)->y2)-((b)->y1))
typedef struct _XkbOutline {
- unsigned short num_points;
- unsigned short sz_points;
- unsigned short corner_radius;
- XkbPointPtr points;
+ unsigned short num_points;
+ unsigned short sz_points;
+ unsigned short corner_radius;
+ XkbPointPtr points;
} XkbOutlineRec, *XkbOutlinePtr;
typedef struct _XkbShape {
- Atom name;
- unsigned short num_outlines;
- unsigned short sz_outlines;
- XkbOutlinePtr outlines;
- XkbOutlinePtr approx;
- XkbOutlinePtr primary;
- XkbBoundsRec bounds;
+ Atom name;
+ unsigned short num_outlines;
+ unsigned short sz_outlines;
+ XkbOutlinePtr outlines;
+ XkbOutlinePtr approx;
+ XkbOutlinePtr primary;
+ XkbBoundsRec bounds;
} XkbShapeRec, *XkbShapePtr;
+
#define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0]))
typedef struct _XkbShapeDoodad {
- Atom name;
- unsigned char type;
- unsigned char priority;
- short top;
- short left;
- short angle;
- unsigned short color_ndx;
- unsigned short shape_ndx;
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ unsigned short color_ndx;
+ unsigned short shape_ndx;
} XkbShapeDoodadRec, *XkbShapeDoodadPtr;
+
#define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
#define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
#define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
#define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
typedef struct _XkbTextDoodad {
- Atom name;
- unsigned char type;
- unsigned char priority;
- short top;
- short left;
- short angle;
- short width;
- short height;
- unsigned short color_ndx;
- char * text;
- char * font;
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ short width;
+ short height;
+ unsigned short color_ndx;
+ char *text;
+ char *font;
} XkbTextDoodadRec, *XkbTextDoodadPtr;
+
#define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
#define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
typedef struct _XkbIndicatorDoodad {
- Atom name;
- unsigned char type;
- unsigned char priority;
- short top;
- short left;
- short angle;
- unsigned short shape_ndx;
- unsigned short on_color_ndx;
- unsigned short off_color_ndx;
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ unsigned short shape_ndx;
+ unsigned short on_color_ndx;
+ unsigned short off_color_ndx;
} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr;
+
#define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
#define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx])
#define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx])
@@ -164,36 +169,37 @@ typedef struct _XkbIndicatorDoodad {
((d)->shape_ndx= (s)-&(g)->shapes[0])
typedef struct _XkbLogoDoodad {
- Atom name;
- unsigned char type;
- unsigned char priority;
- short top;
- short left;
- short angle;
- unsigned short color_ndx;
- unsigned short shape_ndx;
- char * logo_name;
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ unsigned short color_ndx;
+ unsigned short shape_ndx;
+ char *logo_name;
} XkbLogoDoodadRec, *XkbLogoDoodadPtr;
+
#define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
#define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
#define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
#define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
typedef struct _XkbAnyDoodad {
- Atom name;
- unsigned char type;
- unsigned char priority;
- short top;
- short left;
- short angle;
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
} XkbAnyDoodadRec, *XkbAnyDoodadPtr;
typedef union _XkbDoodad {
- XkbAnyDoodadRec any;
- XkbShapeDoodadRec shape;
- XkbTextDoodadRec text;
- XkbIndicatorDoodadRec indicator;
- XkbLogoDoodadRec logo;
+ XkbAnyDoodadRec any;
+ XkbShapeDoodadRec shape;
+ XkbTextDoodadRec text;
+ XkbIndicatorDoodadRec indicator;
+ XkbLogoDoodadRec logo;
} XkbDoodadRec, *XkbDoodadPtr;
#define XkbUnknownDoodad 0
@@ -204,93 +210,95 @@ typedef union _XkbDoodad {
#define XkbLogoDoodad 5
typedef struct _XkbKey {
- XkbKeyNameRec name;
- short gap;
- unsigned char shape_ndx;
- unsigned char color_ndx;
+ XkbKeyNameRec name;
+ short gap;
+ unsigned char shape_ndx;
+ unsigned char color_ndx;
} XkbKeyRec, *XkbKeyPtr;
+
#define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx])
#define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx])
#define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0])
#define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0])
typedef struct _XkbRow {
- short top;
- short left;
- unsigned short num_keys;
- unsigned short sz_keys;
- int vertical;
- XkbKeyPtr keys;
- XkbBoundsRec bounds;
+ short top;
+ short left;
+ unsigned short num_keys;
+ unsigned short sz_keys;
+ int vertical;
+ XkbKeyPtr keys;
+ XkbBoundsRec bounds;
} XkbRowRec, *XkbRowPtr;
typedef struct _XkbSection {
- Atom name;
- unsigned char priority;
- short top;
- short left;
- unsigned short width;
- unsigned short height;
- short angle;
- unsigned short num_rows;
- unsigned short num_doodads;
- unsigned short num_overlays;
- unsigned short sz_rows;
- unsigned short sz_doodads;
- unsigned short sz_overlays;
- XkbRowPtr rows;
- XkbDoodadPtr doodads;
- XkbBoundsRec bounds;
- struct _XkbOverlay *overlays;
+ Atom name;
+ unsigned char priority;
+ short top;
+ short left;
+ unsigned short width;
+ unsigned short height;
+ short angle;
+ unsigned short num_rows;
+ unsigned short num_doodads;
+ unsigned short num_overlays;
+ unsigned short sz_rows;
+ unsigned short sz_doodads;
+ unsigned short sz_overlays;
+ XkbRowPtr rows;
+ XkbDoodadPtr doodads;
+ XkbBoundsRec bounds;
+ struct _XkbOverlay *overlays;
} XkbSectionRec, *XkbSectionPtr;
-typedef struct _XkbOverlayKey {
- XkbKeyNameRec over;
- XkbKeyNameRec under;
-} XkbOverlayKeyRec,*XkbOverlayKeyPtr;
+typedef struct _XkbOverlayKey {
+ XkbKeyNameRec over;
+ XkbKeyNameRec under;
+} XkbOverlayKeyRec, *XkbOverlayKeyPtr;
typedef struct _XkbOverlayRow {
- unsigned short row_under;
- unsigned short num_keys;
- unsigned short sz_keys;
- XkbOverlayKeyPtr keys;
-} XkbOverlayRowRec,*XkbOverlayRowPtr;
+ unsigned short row_under;
+ unsigned short num_keys;
+ unsigned short sz_keys;
+ XkbOverlayKeyPtr keys;
+} XkbOverlayRowRec, *XkbOverlayRowPtr;
typedef struct _XkbOverlay {
- Atom name;
- XkbSectionPtr section_under;
- unsigned short num_rows;
- unsigned short sz_rows;
- XkbOverlayRowPtr rows;
- XkbBoundsPtr bounds;
-} XkbOverlayRec,*XkbOverlayPtr;
+ Atom name;
+ XkbSectionPtr section_under;
+ unsigned short num_rows;
+ unsigned short sz_rows;
+ XkbOverlayRowPtr rows;
+ XkbBoundsPtr bounds;
+} XkbOverlayRec, *XkbOverlayPtr;
typedef struct _XkbGeometry {
- Atom name;
- unsigned short width_mm;
- unsigned short height_mm;
- char * label_font;
- XkbColorPtr label_color;
- XkbColorPtr base_color;
- unsigned short sz_properties;
- unsigned short sz_colors;
- unsigned short sz_shapes;
- unsigned short sz_sections;
- unsigned short sz_doodads;
- unsigned short sz_key_aliases;
- unsigned short num_properties;
- unsigned short num_colors;
- unsigned short num_shapes;
- unsigned short num_sections;
- unsigned short num_doodads;
- unsigned short num_key_aliases;
- XkbPropertyPtr properties;
- XkbColorPtr colors;
- XkbShapePtr shapes;
- XkbSectionPtr sections;
- XkbDoodadPtr doodads;
- XkbKeyAliasPtr key_aliases;
+ Atom name;
+ unsigned short width_mm;
+ unsigned short height_mm;
+ char *label_font;
+ XkbColorPtr label_color;
+ XkbColorPtr base_color;
+ unsigned short sz_properties;
+ unsigned short sz_colors;
+ unsigned short sz_shapes;
+ unsigned short sz_sections;
+ unsigned short sz_doodads;
+ unsigned short sz_key_aliases;
+ unsigned short num_properties;
+ unsigned short num_colors;
+ unsigned short num_shapes;
+ unsigned short num_sections;
+ unsigned short num_doodads;
+ unsigned short num_key_aliases;
+ XkbPropertyPtr properties;
+ XkbColorPtr colors;
+ XkbShapePtr shapes;
+ XkbSectionPtr sections;
+ XkbDoodadPtr doodads;
+ XkbKeyAliasPtr key_aliases;
} XkbGeometryRec;
+
#define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0]))
#define XkbGeomPropertiesMask (1<<0)
@@ -302,350 +310,271 @@ typedef struct _XkbGeometry {
#define XkbGeomAllMask (0x3f)
typedef struct _XkbGeometrySizes {
- unsigned int which;
- unsigned short num_properties;
- unsigned short num_colors;
- unsigned short num_shapes;
- unsigned short num_sections;
- unsigned short num_doodads;
- unsigned short num_key_aliases;
-} XkbGeometrySizesRec,*XkbGeometrySizesPtr;
+ unsigned int which;
+ unsigned short num_properties;
+ unsigned short num_colors;
+ unsigned short num_shapes;
+ unsigned short num_sections;
+ unsigned short num_doodads;
+ unsigned short num_key_aliases;
+} XkbGeometrySizesRec, *XkbGeometrySizesPtr;
/**
* Specifies which items should be cleared in an XKB geometry array
* when the array is reallocated.
*/
-typedef enum
-{
- XKB_GEOM_CLEAR_NONE, /* Don't clear any items, just reallocate. */
- XKB_GEOM_CLEAR_EXCESS, /* Clear new extra items after reallocation. */
- XKB_GEOM_CLEAR_ALL /* Clear all items after reallocation. */
+typedef enum {
+ XKB_GEOM_CLEAR_NONE, /* Don't clear any items, just reallocate. */
+ XKB_GEOM_CLEAR_EXCESS, /* Clear new extra items after reallocation. */
+ XKB_GEOM_CLEAR_ALL /* Clear all items after reallocation. */
} XkbGeomClearance;
-extern XkbPropertyPtr
-XkbAddGeomProperty(
- XkbGeometryPtr /* geom */,
- char * /* name */,
- char * /* value */
-);
-
-extern XkbKeyAliasPtr
-XkbAddGeomKeyAlias(
- XkbGeometryPtr /* geom */,
- char * /* alias */,
- char * /* real */
-);
-
-extern XkbColorPtr
-XkbAddGeomColor(
- XkbGeometryPtr /* geom */,
- char * /* spec */,
- unsigned int /* pixel */
-);
-
-extern XkbOutlinePtr
-XkbAddGeomOutline(
- XkbShapePtr /* shape */,
- int /* sz_points */
-);
-
-extern XkbShapePtr
-XkbAddGeomShape(
- XkbGeometryPtr /* geom */,
- Atom /* name */,
- int /* sz_outlines */
-);
-
-extern XkbKeyPtr
-XkbAddGeomKey(
- XkbRowPtr /* row */
-);
-
-extern XkbRowPtr
-XkbAddGeomRow(
- XkbSectionPtr /* section */,
- int /* sz_keys */
-);
-
-extern XkbSectionPtr
-XkbAddGeomSection(
- XkbGeometryPtr /* geom */,
- Atom /* name */,
- int /* sz_rows */,
- int /* sz_doodads */,
- int /* sz_overlays */
-);
-
-extern XkbOverlayPtr
-XkbAddGeomOverlay(
- XkbSectionPtr /* section */,
- Atom /* name */,
- int /* sz_rows */
-);
-
-extern XkbOverlayRowPtr
-XkbAddGeomOverlayRow(
- XkbOverlayPtr /* overlay */,
- int /* row_under */,
- int /* sz_keys */
-);
-
-extern XkbOverlayKeyPtr
-XkbAddGeomOverlayKey(
- XkbOverlayPtr /* overlay */,
- XkbOverlayRowPtr /* row */,
- char * /* over */,
- char * /* under */
-);
-
-extern XkbDoodadPtr
-XkbAddGeomDoodad(
- XkbGeometryPtr /* geom */,
- XkbSectionPtr /* section */,
- Atom /* name */
-);
-
+extern XkbPropertyPtr XkbAddGeomProperty(XkbGeometryPtr /* geom */ ,
+ char * /* name */ ,
+ char * /* value */
+ );
+
+extern XkbKeyAliasPtr XkbAddGeomKeyAlias(XkbGeometryPtr /* geom */ ,
+ char * /* alias */ ,
+ char * /* real */
+ );
+
+extern XkbColorPtr XkbAddGeomColor(XkbGeometryPtr /* geom */ ,
+ char * /* spec */ ,
+ unsigned int /* pixel */
+ );
+
+extern XkbOutlinePtr XkbAddGeomOutline(XkbShapePtr /* shape */ ,
+ int /* sz_points */
+ );
+
+extern XkbShapePtr XkbAddGeomShape(XkbGeometryPtr /* geom */ ,
+ Atom /* name */ ,
+ int /* sz_outlines */
+ );
+
+extern XkbKeyPtr XkbAddGeomKey(XkbRowPtr /* row */
+ );
+
+extern XkbRowPtr XkbAddGeomRow(XkbSectionPtr /* section */ ,
+ int /* sz_keys */
+ );
+
+extern XkbSectionPtr XkbAddGeomSection(XkbGeometryPtr /* geom */ ,
+ Atom /* name */ ,
+ int /* sz_rows */ ,
+ int /* sz_doodads */ ,
+ int /* sz_overlays */
+ );
+
+extern XkbOverlayPtr XkbAddGeomOverlay(XkbSectionPtr /* section */ ,
+ Atom /* name */ ,
+ int /* sz_rows */
+ );
+
+extern XkbOverlayRowPtr XkbAddGeomOverlayRow(XkbOverlayPtr /* overlay */ ,
+ int /* row_under */ ,
+ int /* sz_keys */
+ );
+
+extern XkbOverlayKeyPtr XkbAddGeomOverlayKey(XkbOverlayPtr /* overlay */ ,
+ XkbOverlayRowPtr /* row */ ,
+ char * /* over */ ,
+ char * /* under */
+ );
+
+extern XkbDoodadPtr XkbAddGeomDoodad(XkbGeometryPtr /* geom */ ,
+ XkbSectionPtr /* section */ ,
+ Atom /* name */
+ );
extern void
-XkbFreeGeomKeyAliases(
- XkbGeometryPtr /* geom */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomKeyAliases(XkbGeometryPtr /* geom */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomColors(
- XkbGeometryPtr /* geom */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomColors(XkbGeometryPtr /* geom */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomDoodads(
- XkbDoodadPtr /* doodads */,
- int /* nDoodads */,
- Bool /* freeAll */
-);
-
+ XkbFreeGeomDoodads(XkbDoodadPtr /* doodads */ ,
+ int /* nDoodads */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomProperties(
- XkbGeometryPtr /* geom */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomProperties(XkbGeometryPtr /* geom */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomOverlayKeys(
- XkbOverlayRowPtr /* row */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomOverlayKeys(XkbOverlayRowPtr /* row */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomOverlayRows(
- XkbOverlayPtr /* overlay */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomOverlayRows(XkbOverlayPtr /* overlay */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomOverlays(
- XkbSectionPtr /* section */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomOverlays(XkbSectionPtr /* section */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomKeys(
- XkbRowPtr /* row */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomKeys(XkbRowPtr /* row */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomRows(
- XkbSectionPtr /* section */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomRows(XkbSectionPtr /* section */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomSections(
- XkbGeometryPtr /* geom */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
-
+ XkbFreeGeomSections(XkbGeometryPtr /* geom */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomPoints(
- XkbOutlinePtr /* outline */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomPoints(XkbOutlinePtr /* outline */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomOutlines(
- XkbShapePtr /* shape */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomOutlines(XkbShapePtr /* shape */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeomShapes(
- XkbGeometryPtr /* geom */,
- int /* first */,
- int /* count */,
- Bool /* freeAll */
-);
+ XkbFreeGeomShapes(XkbGeometryPtr /* geom */ ,
+ int /* first */ ,
+ int /* count */ ,
+ Bool /* freeAll */
+ );
extern void
-XkbFreeGeometry(
- XkbGeometryPtr /* geom */,
- unsigned int /* which */,
- Bool /* freeMap */
-);
+ XkbFreeGeometry(XkbGeometryPtr /* geom */ ,
+ unsigned int /* which */ ,
+ Bool /* freeMap */
+ );
+
+extern Bool
+ XkbGeomRealloc(void ** /* buffer */ ,
+ int /* szItems */ ,
+ int /* nrItems */ ,
+ int /* itemSize */ ,
+ XkbGeomClearance /* clearance */
+ );
+
+extern Status XkbAllocGeomProps(XkbGeometryPtr /* geom */ ,
+ int /* nProps */
+ );
+
+extern Status XkbAllocGeomKeyAliases(XkbGeometryPtr /* geom */ ,
+ int /* nAliases */
+ );
+
+extern Status XkbAllocGeomColors(XkbGeometryPtr /* geom */ ,
+ int /* nColors */
+ );
+
+extern Status XkbAllocGeomShapes(XkbGeometryPtr /* geom */ ,
+ int /* nShapes */
+ );
+
+extern Status XkbAllocGeomSections(XkbGeometryPtr /* geom */ ,
+ int /* nSections */
+ );
+
+extern Status XkbAllocGeomOverlays(XkbSectionPtr /* section */ ,
+ int /* num_needed */
+ );
+
+extern Status XkbAllocGeomOverlayRows(XkbOverlayPtr /* overlay */ ,
+ int /* num_needed */
+ );
+
+extern Status XkbAllocGeomOverlayKeys(XkbOverlayRowPtr /* row */ ,
+ int /* num_needed */
+ );
+
+extern Status XkbAllocGeomDoodads(XkbGeometryPtr /* geom */ ,
+ int /* nDoodads */
+ );
+
+extern Status XkbAllocGeomSectionDoodads(XkbSectionPtr /* section */ ,
+ int /* nDoodads */
+ );
+
+extern Status XkbAllocGeomOutlines(XkbShapePtr /* shape */ ,
+ int /* nOL */
+ );
+
+extern Status XkbAllocGeomRows(XkbSectionPtr /* section */ ,
+ int /* nRows */
+ );
+
+extern Status XkbAllocGeomPoints(XkbOutlinePtr /* ol */ ,
+ int /* nPts */
+ );
+
+extern Status XkbAllocGeomKeys(XkbRowPtr /* row */ ,
+ int /* nKeys */
+ );
+
+extern Status XkbAllocGeometry(XkbDescPtr /* xkb */ ,
+ XkbGeometrySizesPtr /* sizes */
+ );
+
+extern Bool
+ XkbComputeShapeTop(XkbShapePtr /* shape */ ,
+ XkbBoundsPtr /* bounds */
+ );
+
+extern Bool
+ XkbComputeShapeBounds(XkbShapePtr /* shape */
+ );
extern Bool
-XkbGeomRealloc(
- void ** /* buffer */,
- int /* szItems */,
- int /* nrItems */,
- int /* itemSize */,
- XkbGeomClearance /* clearance */
-);
-
-extern Status
-XkbAllocGeomProps(
- XkbGeometryPtr /* geom */,
- int /* nProps */
-);
-
-extern Status
-XkbAllocGeomKeyAliases(
- XkbGeometryPtr /* geom */,
- int /* nAliases */
-);
-
-extern Status
-XkbAllocGeomColors(
- XkbGeometryPtr /* geom */,
- int /* nColors */
-);
-
-extern Status
-XkbAllocGeomShapes(
- XkbGeometryPtr /* geom */,
- int /* nShapes */
-);
-
-extern Status
-XkbAllocGeomSections(
- XkbGeometryPtr /* geom */,
- int /* nSections */
-);
-
-extern Status
-XkbAllocGeomOverlays(
- XkbSectionPtr /* section */,
- int /* num_needed */
-);
-
-extern Status
-XkbAllocGeomOverlayRows(
- XkbOverlayPtr /* overlay */,
- int /* num_needed */
-);
-
-extern Status
-XkbAllocGeomOverlayKeys(
- XkbOverlayRowPtr /* row */,
- int /* num_needed */
-);
-
-extern Status
-XkbAllocGeomDoodads(
- XkbGeometryPtr /* geom */,
- int /* nDoodads */
-);
-
-extern Status
-XkbAllocGeomSectionDoodads(
- XkbSectionPtr /* section */,
- int /* nDoodads */
-);
-
-extern Status
-XkbAllocGeomOutlines(
- XkbShapePtr /* shape */,
- int /* nOL */
-);
-
-extern Status
-XkbAllocGeomRows(
- XkbSectionPtr /* section */,
- int /* nRows */
-);
-
-extern Status
-XkbAllocGeomPoints(
- XkbOutlinePtr /* ol */,
- int /* nPts */
-);
-
-extern Status
-XkbAllocGeomKeys(
- XkbRowPtr /* row */,
- int /* nKeys */
-);
-
-extern Status
-XkbAllocGeometry(
- XkbDescPtr /* xkb */,
- XkbGeometrySizesPtr /* sizes */
-);
-
-extern Bool
-XkbComputeShapeTop(
- XkbShapePtr /* shape */,
- XkbBoundsPtr /* bounds */
-);
-
-extern Bool
-XkbComputeShapeBounds(
- XkbShapePtr /* shape */
-);
-
-extern Bool
-XkbComputeRowBounds(
- XkbGeometryPtr /* geom */,
- XkbSectionPtr /* section */,
- XkbRowPtr /* row */
-);
-
-extern Bool
-XkbComputeSectionBounds(
- XkbGeometryPtr /* geom */,
- XkbSectionPtr /* section */
-);
-
-extern char *
-XkbFindOverlayForKey(
- XkbGeometryPtr /* geom */,
- XkbSectionPtr /* wanted */,
- char * /* under */
-);
-
-#endif /* _XKBGEOM_H_ */
+ XkbComputeRowBounds(XkbGeometryPtr /* geom */ ,
+ XkbSectionPtr /* section */ ,
+ XkbRowPtr /* row */
+ );
+
+extern Bool
+ XkbComputeSectionBounds(XkbGeometryPtr /* geom */ ,
+ XkbSectionPtr /* section */
+ );
+
+extern char *XkbFindOverlayForKey(XkbGeometryPtr /* geom */ ,
+ XkbSectionPtr /* wanted */ ,
+ char * /* under */
+ );
+
+#endif /* _XKBGEOM_H_ */
diff --git a/xorg-server/xkb/xkbout.c b/xorg-server/xkb/xkbout.c
index 889d5cc39..cd1ae0b4e 100644
--- a/xorg-server/xkb/xkbout.c
+++ b/xorg-server/xkb/xkbout.c
@@ -52,849 +52,874 @@
#define VMOD_COMMENT_VALUE 2
static Bool
-WriteXKBVModDecl(FILE *file,XkbDescPtr xkb,int showValue)
+WriteXKBVModDecl(FILE * file, XkbDescPtr xkb, int showValue)
{
-register int i,nMods;
-Atom * vmodNames;
-
- if (xkb==NULL)
- return FALSE;
- if (xkb->names!=NULL)
- vmodNames= xkb->names->vmods;
- else vmodNames= NULL;
-
- for (i=nMods=0;i<XkbNumVirtualMods;i++) {
- if ((vmodNames!=NULL)&&(vmodNames[i]!=None)) {
- if (nMods==0) fprintf(file," virtual_modifiers ");
- else fprintf(file,",");
- fprintf(file,"%s",XkbAtomText(vmodNames[i],XkbXKBFile));
- if ((showValue!=VMOD_HIDE_VALUE)&&
- (xkb->server)&&(xkb->server->vmods[i]!=XkbNoModifierMask)) {
- if (showValue==VMOD_COMMENT_VALUE) {
- fprintf(file,"/* = %s */",
- XkbModMaskText(xkb->server->vmods[i],XkbXKBFile));
- }
- else {
- fprintf(file,"= %s",
- XkbModMaskText(xkb->server->vmods[i],XkbXKBFile));
- }
- }
- nMods++;
- }
- }
- if (nMods>0)
- fprintf(file,";\n\n");
+ register int i, nMods;
+ Atom *vmodNames;
+
+ if (xkb == NULL)
+ return FALSE;
+ if (xkb->names != NULL)
+ vmodNames = xkb->names->vmods;
+ else
+ vmodNames = NULL;
+
+ for (i = nMods = 0; i < XkbNumVirtualMods; i++) {
+ if ((vmodNames != NULL) && (vmodNames[i] != None)) {
+ if (nMods == 0)
+ fprintf(file, " virtual_modifiers ");
+ else
+ fprintf(file, ",");
+ fprintf(file, "%s", XkbAtomText(vmodNames[i], XkbXKBFile));
+ if ((showValue != VMOD_HIDE_VALUE) &&
+ (xkb->server) && (xkb->server->vmods[i] != XkbNoModifierMask)) {
+ if (showValue == VMOD_COMMENT_VALUE) {
+ fprintf(file, "/* = %s */",
+ XkbModMaskText(xkb->server->vmods[i], XkbXKBFile));
+ }
+ else {
+ fprintf(file, "= %s",
+ XkbModMaskText(xkb->server->vmods[i], XkbXKBFile));
+ }
+ }
+ nMods++;
+ }
+ }
+ if (nMods > 0)
+ fprintf(file, ";\n\n");
return TRUE;
}
/***====================================================================***/
static Bool
-WriteXKBAction(FILE *file,XkbDescPtr xkb,XkbAnyAction *action)
+WriteXKBAction(FILE * file, XkbDescPtr xkb, XkbAnyAction * action)
{
- fprintf(file,"%s",XkbActionText(xkb,(XkbAction *)action,XkbXKBFile));
+ fprintf(file, "%s", XkbActionText(xkb, (XkbAction *) action, XkbXKBFile));
return TRUE;
}
/***====================================================================***/
Bool
-XkbWriteXKBKeycodes( FILE * file,
- XkbDescPtr xkb,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
+XkbWriteXKBKeycodes(FILE * file,
+ XkbDescPtr xkb,
+ Bool topLevel,
+ Bool showImplicit, XkbFileAddOnFunc addOn, void *priv)
{
-Atom kcName;
-register unsigned i;
-const char * alternate;
-
- if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) {
- _XkbLibError(_XkbErrMissingNames,"XkbWriteXKBKeycodes",0);
- return FALSE;
- }
- kcName= xkb->names->keycodes;
- if (kcName!=None)
- fprintf(file,"xkb_keycodes \"%s\" {\n",
- XkbAtomText(kcName,XkbXKBFile));
- else fprintf(file,"xkb_keycodes {\n");
- fprintf(file," minimum = %d;\n",xkb->min_key_code);
- fprintf(file," maximum = %d;\n",xkb->max_key_code);
- for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- if (xkb->names->keys[i].name[0]!='\0') {
- if (XkbFindKeycodeByName(xkb,xkb->names->keys[i].name,TRUE)!=i)
- alternate= "alternate ";
- else alternate= "";
- fprintf(file," %s%6s = %d;\n",alternate,
- XkbKeyNameText(xkb->names->keys[i].name,XkbXKBFile),
- i);
- }
- }
- if (xkb->indicators!=NULL) {
- for (i=0;i<XkbNumIndicators;i++) {
- const char *type;
- if (xkb->indicators->phys_indicators&(1<<i))
- type= " ";
- else type= " virtual ";
- if (xkb->names->indicators[i]!=None) {
- fprintf(file,"%sindicator %d = \"%s\";\n",type,i+1,
- XkbAtomText(xkb->names->indicators[i],XkbXKBFile));
- }
- }
- }
- if (xkb->names->key_aliases!=NULL) {
- XkbKeyAliasPtr pAl;
- pAl= xkb->names->key_aliases;
- for (i=0;i<xkb->names->num_key_aliases;i++,pAl++) {
- fprintf(file," alias %6s = %6s;\n",
- XkbKeyNameText(pAl->alias,XkbXKBFile),
- XkbKeyNameText(pAl->real,XkbXKBFile));
- }
+ Atom kcName;
+ register unsigned i;
+ const char *alternate;
+
+ if ((!xkb) || (!xkb->names) || (!xkb->names->keys)) {
+ _XkbLibError(_XkbErrMissingNames, "XkbWriteXKBKeycodes", 0);
+ return FALSE;
+ }
+ kcName = xkb->names->keycodes;
+ if (kcName != None)
+ fprintf(file, "xkb_keycodes \"%s\" {\n",
+ XkbAtomText(kcName, XkbXKBFile));
+ else
+ fprintf(file, "xkb_keycodes {\n");
+ fprintf(file, " minimum = %d;\n", xkb->min_key_code);
+ fprintf(file, " maximum = %d;\n", xkb->max_key_code);
+ for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ if (xkb->names->keys[i].name[0] != '\0') {
+ if (XkbFindKeycodeByName(xkb, xkb->names->keys[i].name, TRUE) != i)
+ alternate = "alternate ";
+ else
+ alternate = "";
+ fprintf(file, " %s%6s = %d;\n", alternate,
+ XkbKeyNameText(xkb->names->keys[i].name, XkbXKBFile), i);
+ }
+ }
+ if (xkb->indicators != NULL) {
+ for (i = 0; i < XkbNumIndicators; i++) {
+ const char *type;
+
+ if (xkb->indicators->phys_indicators & (1 << i))
+ type = " ";
+ else
+ type = " virtual ";
+ if (xkb->names->indicators[i] != None) {
+ fprintf(file, "%sindicator %d = \"%s\";\n", type, i + 1,
+ XkbAtomText(xkb->names->indicators[i], XkbXKBFile));
+ }
+ }
+ }
+ if (xkb->names->key_aliases != NULL) {
+ XkbKeyAliasPtr pAl;
+
+ pAl = xkb->names->key_aliases;
+ for (i = 0; i < xkb->names->num_key_aliases; i++, pAl++) {
+ fprintf(file, " alias %6s = %6s;\n",
+ XkbKeyNameText(pAl->alias, XkbXKBFile),
+ XkbKeyNameText(pAl->real, XkbXKBFile));
+ }
}
if (addOn)
- (*addOn)(file,xkb,topLevel,showImplicit,XkmKeyNamesIndex,priv);
- fprintf(file,"};\n\n");
+ (*addOn) (file, xkb, topLevel, showImplicit, XkmKeyNamesIndex, priv);
+ fprintf(file, "};\n\n");
return TRUE;
}
Bool
-XkbWriteXKBKeyTypes( FILE * file,
- XkbDescPtr xkb,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
+XkbWriteXKBKeyTypes(FILE * file,
+ XkbDescPtr xkb,
+ Bool topLevel,
+ Bool showImplicit, XkbFileAddOnFunc addOn, void *priv)
{
-register unsigned i,n;
-XkbKeyTypePtr type;
-XkbKTMapEntryPtr entry;
-
- if ((!xkb)||(!xkb->map)||(!xkb->map->types)) {
- _XkbLibError(_XkbErrMissingTypes,"XkbWriteXKBKeyTypes",0);
- return FALSE;
- }
- if (xkb->map->num_types<XkbNumRequiredTypes) {
- _XkbLibError(_XkbErrMissingReqTypes,"XkbWriteXKBKeyTypes",0);
- return 0;
- }
- if ((xkb->names==NULL)||(xkb->names->types==None))
- fprintf(file,"xkb_types {\n\n");
- else fprintf(file,"xkb_types \"%s\" {\n\n",
- XkbAtomText(xkb->names->types,XkbXKBFile));
- WriteXKBVModDecl(file,xkb,
- (showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE));
-
- type= xkb->map->types;
- for (i=0;i<xkb->map->num_types;i++,type++) {
- fprintf(file," type \"%s\" {\n",
- XkbAtomText(type->name,XkbXKBFile));
- fprintf(file," modifiers= %s;\n",
- XkbVModMaskText(xkb,type->mods.real_mods,type->mods.vmods,
- XkbXKBFile));
- entry= type->map;
- for (n=0;n<type->map_count;n++,entry++) {
- char *str;
- str=XkbVModMaskText(xkb,entry->mods.real_mods,entry->mods.vmods,
- XkbXKBFile);
- fprintf(file," map[%s]= Level%d;\n",str,entry->level+1);
- if ((type->preserve)&&((type->preserve[n].real_mods)||
- (type->preserve[n].vmods))) {
- fprintf(file," preserve[%s]= ",str);
- fprintf(file,"%s;\n",XkbVModMaskText(xkb,
- type->preserve[n].real_mods,
- type->preserve[n].vmods,
- XkbXKBFile));
- }
- }
- if (type->level_names!=NULL) {
- Atom *name= type->level_names;
- for (n=0;n<type->num_levels;n++,name++) {
- if ((*name)==None)
- continue;
- fprintf(file," level_name[Level%d]= \"%s\";\n",n+1,
- XkbAtomText(*name,XkbXKBFile));
- }
- }
- fprintf(file," };\n");
+ register unsigned i, n;
+ XkbKeyTypePtr type;
+ XkbKTMapEntryPtr entry;
+
+ if ((!xkb) || (!xkb->map) || (!xkb->map->types)) {
+ _XkbLibError(_XkbErrMissingTypes, "XkbWriteXKBKeyTypes", 0);
+ return FALSE;
+ }
+ if (xkb->map->num_types < XkbNumRequiredTypes) {
+ _XkbLibError(_XkbErrMissingReqTypes, "XkbWriteXKBKeyTypes", 0);
+ return 0;
+ }
+ if ((xkb->names == NULL) || (xkb->names->types == None))
+ fprintf(file, "xkb_types {\n\n");
+ else
+ fprintf(file, "xkb_types \"%s\" {\n\n",
+ XkbAtomText(xkb->names->types, XkbXKBFile));
+ WriteXKBVModDecl(file, xkb,
+ (showImplicit ? VMOD_COMMENT_VALUE : VMOD_HIDE_VALUE));
+
+ type = xkb->map->types;
+ for (i = 0; i < xkb->map->num_types; i++, type++) {
+ fprintf(file, " type \"%s\" {\n",
+ XkbAtomText(type->name, XkbXKBFile));
+ fprintf(file, " modifiers= %s;\n",
+ XkbVModMaskText(xkb, type->mods.real_mods, type->mods.vmods,
+ XkbXKBFile));
+ entry = type->map;
+ for (n = 0; n < type->map_count; n++, entry++) {
+ char *str;
+
+ str = XkbVModMaskText(xkb, entry->mods.real_mods, entry->mods.vmods,
+ XkbXKBFile);
+ fprintf(file, " map[%s]= Level%d;\n", str, entry->level + 1);
+ if ((type->preserve) && ((type->preserve[n].real_mods) ||
+ (type->preserve[n].vmods))) {
+ fprintf(file, " preserve[%s]= ", str);
+ fprintf(file, "%s;\n", XkbVModMaskText(xkb,
+ type->preserve[n].
+ real_mods,
+ type->preserve[n].vmods,
+ XkbXKBFile));
+ }
+ }
+ if (type->level_names != NULL) {
+ Atom *name = type->level_names;
+
+ for (n = 0; n < type->num_levels; n++, name++) {
+ if ((*name) == None)
+ continue;
+ fprintf(file, " level_name[Level%d]= \"%s\";\n", n + 1,
+ XkbAtomText(*name, XkbXKBFile));
+ }
+ }
+ fprintf(file, " };\n");
}
if (addOn)
- (*addOn)(file,xkb,topLevel,showImplicit,XkmTypesIndex,priv);
- fprintf(file,"};\n\n");
+ (*addOn) (file, xkb, topLevel, showImplicit, XkmTypesIndex, priv);
+ fprintf(file, "};\n\n");
return TRUE;
}
static Bool
-WriteXKBIndicatorMap( FILE * file,
- XkbDescPtr xkb,
- Atom name,
- XkbIndicatorMapPtr led,
- XkbFileAddOnFunc addOn,
- void * priv)
+WriteXKBIndicatorMap(FILE * file,
+ XkbDescPtr xkb,
+ Atom name,
+ XkbIndicatorMapPtr led, XkbFileAddOnFunc addOn, void *priv)
{
- fprintf(file," indicator \"%s\" {\n",NameForAtom(name));
- if (led->flags&XkbIM_NoExplicit)
- fprintf(file," !allowExplicit;\n");
- if (led->flags&XkbIM_LEDDrivesKB)
- fprintf(file," indicatorDrivesKeyboard;\n");
- if (led->which_groups!=0) {
- if (led->which_groups!=XkbIM_UseEffective) {
- fprintf(file," whichGroupState= %s;\n",
- XkbIMWhichStateMaskText(led->which_groups,XkbXKBFile));
- }
- fprintf(file," groups= 0x%02x;\n",led->groups);
- }
- if (led->which_mods!=0) {
- if (led->which_mods!=XkbIM_UseEffective) {
- fprintf(file," whichModState= %s;\n",
- XkbIMWhichStateMaskText(led->which_mods,XkbXKBFile));
- }
- fprintf(file," modifiers= %s;\n",
- XkbVModMaskText(xkb,
- led->mods.real_mods,led->mods.vmods,
- XkbXKBFile));
- }
- if (led->ctrls!=0) {
- fprintf(file," controls= %s;\n",
- XkbControlsMaskText(led->ctrls,XkbXKBFile));
+ fprintf(file, " indicator \"%s\" {\n", NameForAtom(name));
+ if (led->flags & XkbIM_NoExplicit)
+ fprintf(file, " !allowExplicit;\n");
+ if (led->flags & XkbIM_LEDDrivesKB)
+ fprintf(file, " indicatorDrivesKeyboard;\n");
+ if (led->which_groups != 0) {
+ if (led->which_groups != XkbIM_UseEffective) {
+ fprintf(file, " whichGroupState= %s;\n",
+ XkbIMWhichStateMaskText(led->which_groups, XkbXKBFile));
+ }
+ fprintf(file, " groups= 0x%02x;\n", led->groups);
+ }
+ if (led->which_mods != 0) {
+ if (led->which_mods != XkbIM_UseEffective) {
+ fprintf(file, " whichModState= %s;\n",
+ XkbIMWhichStateMaskText(led->which_mods, XkbXKBFile));
+ }
+ fprintf(file, " modifiers= %s;\n",
+ XkbVModMaskText(xkb,
+ led->mods.real_mods, led->mods.vmods,
+ XkbXKBFile));
+ }
+ if (led->ctrls != 0) {
+ fprintf(file, " controls= %s;\n",
+ XkbControlsMaskText(led->ctrls, XkbXKBFile));
}
if (addOn)
- (*addOn)(file,xkb,FALSE,TRUE,XkmIndicatorsIndex,priv);
- fprintf(file," };\n");
+ (*addOn) (file, xkb, FALSE, TRUE, XkmIndicatorsIndex, priv);
+ fprintf(file, " };\n");
return TRUE;
}
Bool
-XkbWriteXKBCompatMap( FILE * file,
- XkbDescPtr xkb,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
+XkbWriteXKBCompatMap(FILE * file,
+ XkbDescPtr xkb,
+ Bool topLevel,
+ Bool showImplicit, XkbFileAddOnFunc addOn, void *priv)
{
-register unsigned i;
-XkbSymInterpretPtr interp;
-
- if ((!xkb)||(!xkb->compat)||(!xkb->compat->sym_interpret)) {
- _XkbLibError(_XkbErrMissingCompatMap,"XkbWriteXKBCompatMap",0);
- return FALSE;
- }
- if ((xkb->names==NULL)||(xkb->names->compat==None))
- fprintf(file,"xkb_compatibility {\n\n");
- else fprintf(file,"xkb_compatibility \"%s\" {\n\n",
- XkbAtomText(xkb->names->compat,XkbXKBFile));
- WriteXKBVModDecl(file,xkb,
- (showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE));
-
- fprintf(file," interpret.useModMapMods= AnyLevel;\n");
- fprintf(file," interpret.repeat= FALSE;\n");
- fprintf(file," interpret.locking= FALSE;\n");
- interp= xkb->compat->sym_interpret;
- for (i=0;i<xkb->compat->num_si;i++,interp++) {
- fprintf(file," interpret %s+%s(%s) {\n",
- ((interp->sym==NoSymbol)?"Any":
- XkbKeysymText(interp->sym,XkbXKBFile)),
- XkbSIMatchText(interp->match,XkbXKBFile),
- XkbModMaskText(interp->mods,XkbXKBFile));
- if (interp->virtual_mod!=XkbNoModifier) {
- fprintf(file," virtualModifier= %s;\n",
- XkbVModIndexText(xkb,interp->virtual_mod,XkbXKBFile));
- }
- if (interp->match&XkbSI_LevelOneOnly)
- fprintf(file," useModMapMods=level1;\n");
- if (interp->flags&XkbSI_LockingKey)
- fprintf(file," locking= TRUE;\n");
- if (interp->flags&XkbSI_AutoRepeat)
- fprintf(file," repeat= TRUE;\n");
- fprintf(file," action= ");
- WriteXKBAction(file,xkb,&interp->act);
- fprintf(file,";\n");
- fprintf(file," };\n");
- }
- for (i=0;i<XkbNumKbdGroups;i++) {
- XkbModsPtr gc;
-
- gc= &xkb->compat->groups[i];
- if ((gc->real_mods==0)&&(gc->vmods==0))
- continue;
- fprintf(file," group %d = %s;\n",i+1,XkbVModMaskText(xkb,
- gc->real_mods,gc->vmods,
- XkbXKBFile));
+ register unsigned i;
+ XkbSymInterpretPtr interp;
+
+ if ((!xkb) || (!xkb->compat) || (!xkb->compat->sym_interpret)) {
+ _XkbLibError(_XkbErrMissingCompatMap, "XkbWriteXKBCompatMap", 0);
+ return FALSE;
+ }
+ if ((xkb->names == NULL) || (xkb->names->compat == None))
+ fprintf(file, "xkb_compatibility {\n\n");
+ else
+ fprintf(file, "xkb_compatibility \"%s\" {\n\n",
+ XkbAtomText(xkb->names->compat, XkbXKBFile));
+ WriteXKBVModDecl(file, xkb,
+ (showImplicit ? VMOD_COMMENT_VALUE : VMOD_HIDE_VALUE));
+
+ fprintf(file, " interpret.useModMapMods= AnyLevel;\n");
+ fprintf(file, " interpret.repeat= FALSE;\n");
+ fprintf(file, " interpret.locking= FALSE;\n");
+ interp = xkb->compat->sym_interpret;
+ for (i = 0; i < xkb->compat->num_si; i++, interp++) {
+ fprintf(file, " interpret %s+%s(%s) {\n",
+ ((interp->sym == NoSymbol) ? "Any" :
+ XkbKeysymText(interp->sym, XkbXKBFile)),
+ XkbSIMatchText(interp->match, XkbXKBFile),
+ XkbModMaskText(interp->mods, XkbXKBFile));
+ if (interp->virtual_mod != XkbNoModifier) {
+ fprintf(file, " virtualModifier= %s;\n",
+ XkbVModIndexText(xkb, interp->virtual_mod, XkbXKBFile));
+ }
+ if (interp->match & XkbSI_LevelOneOnly)
+ fprintf(file, " useModMapMods=level1;\n");
+ if (interp->flags & XkbSI_LockingKey)
+ fprintf(file, " locking= TRUE;\n");
+ if (interp->flags & XkbSI_AutoRepeat)
+ fprintf(file, " repeat= TRUE;\n");
+ fprintf(file, " action= ");
+ WriteXKBAction(file, xkb, &interp->act);
+ fprintf(file, ";\n");
+ fprintf(file, " };\n");
+ }
+ for (i = 0; i < XkbNumKbdGroups; i++) {
+ XkbModsPtr gc;
+
+ gc = &xkb->compat->groups[i];
+ if ((gc->real_mods == 0) && (gc->vmods == 0))
+ continue;
+ fprintf(file, " group %d = %s;\n", i + 1, XkbVModMaskText(xkb,
+ gc->
+ real_mods,
+ gc->vmods,
+ XkbXKBFile));
}
if (xkb->indicators) {
- for (i=0;i<XkbNumIndicators;i++) {
- XkbIndicatorMapPtr map= &xkb->indicators->maps[i];
- if ((map->flags!=0)||(map->which_groups!=0)||(map->groups!=0)||
- (map->which_mods!=0)||
- (map->mods.real_mods!=0)||(map->mods.vmods!=0)||
- (map->ctrls!=0)) {
- WriteXKBIndicatorMap(file,xkb,xkb->names->indicators[i],map,
- addOn,priv);
- }
- }
+ for (i = 0; i < XkbNumIndicators; i++) {
+ XkbIndicatorMapPtr map = &xkb->indicators->maps[i];
+
+ if ((map->flags != 0) || (map->which_groups != 0) ||
+ (map->groups != 0) || (map->which_mods != 0) ||
+ (map->mods.real_mods != 0) || (map->mods.vmods != 0) ||
+ (map->ctrls != 0)) {
+ WriteXKBIndicatorMap(file, xkb, xkb->names->indicators[i], map,
+ addOn, priv);
+ }
+ }
}
if (addOn)
- (*addOn)(file,xkb,topLevel,showImplicit,XkmCompatMapIndex,priv);
- fprintf(file,"};\n\n");
+ (*addOn) (file, xkb, topLevel, showImplicit, XkmCompatMapIndex, priv);
+ fprintf(file, "};\n\n");
return TRUE;
}
Bool
-XkbWriteXKBSymbols( FILE * file,
- XkbDescPtr xkb,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
+XkbWriteXKBSymbols(FILE * file,
+ XkbDescPtr xkb,
+ Bool topLevel,
+ Bool showImplicit, XkbFileAddOnFunc addOn, void *priv)
{
-register unsigned i,tmp;
-XkbClientMapPtr map;
-XkbServerMapPtr srv;
-Bool showActions;
+ register unsigned i, tmp;
+ XkbClientMapPtr map;
+ XkbServerMapPtr srv;
+ Bool showActions;
if (!xkb) {
- _XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0);
- return FALSE;
- }
-
- map= xkb->map;
- if ((!map)||(!map->syms)||(!map->key_sym_map)) {
- _XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0);
- return FALSE;
- }
- if ((!xkb->names)||(!xkb->names->keys)) {
- _XkbLibError(_XkbErrMissingNames,"XkbWriteXKBSymbols",0);
- return FALSE;
- }
- if ((xkb->names==NULL)||(xkb->names->symbols==None))
- fprintf(file,"xkb_symbols {\n\n");
- else fprintf(file,"xkb_symbols \"%s\" {\n\n",
- XkbAtomText(xkb->names->symbols,XkbXKBFile));
- for (tmp=i=0;i<XkbNumKbdGroups;i++) {
- if (xkb->names->groups[i]!=None) {
- fprintf(file," name[group%d]=\"%s\";\n",i+1,
- XkbAtomText(xkb->names->groups[i],XkbXKBFile));
- tmp++;
- }
- }
- if (tmp>0)
- fprintf(file,"\n");
- srv= xkb->server;
- for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- Bool simple;
- if ((int)XkbKeyNumSyms(xkb,i)<1)
- continue;
- if (XkbFindKeycodeByName(xkb,xkb->names->keys[i].name,TRUE)!=i)
- continue;
- simple= TRUE;
- fprintf(file," key %6s {",
- XkbKeyNameText(xkb->names->keys[i].name,XkbXKBFile));
- if (srv->explicit) {
- if (((srv->explicit[i]&XkbExplicitKeyTypesMask)!=0)||
- (showImplicit)) {
- int typeNdx,g;
- Bool multi;
- const char * comment=" ";
-
- if ((srv->explicit[i]&XkbExplicitKeyTypesMask)==0)
- comment= "//";
- multi= FALSE;
- typeNdx= XkbKeyKeyTypeIndex(xkb,i,0);
- for (g=1;(g<XkbKeyNumGroups(xkb,i))&&(!multi);g++) {
- if (XkbKeyKeyTypeIndex(xkb,i,g)!=typeNdx)
- multi= TRUE;
- }
- if (multi) {
- for (g=0;g<XkbKeyNumGroups(xkb,i);g++) {
- typeNdx= XkbKeyKeyTypeIndex(xkb,i,g);
- if (srv->explicit[i]&(1<<g)) {
- fprintf(file,"\n%s type[group%d]= \"%s\",",
- comment,g+1,
- XkbAtomText(map->types[typeNdx].name,
- XkbXKBFile));
- }
- else if (showImplicit) {
- fprintf(file,"\n// type[group%d]= \"%s\",",g+1,
- XkbAtomText(map->types[typeNdx].name,
- XkbXKBFile));
- }
- }
- }
- else {
- fprintf(file,"\n%s type= \"%s\",",comment,
- XkbAtomText(map->types[typeNdx].name,
- XkbXKBFile));
- }
- simple= FALSE;
- }
- if (((srv->explicit[i]&XkbExplicitAutoRepeatMask)!=0)&&
- (xkb->ctrls!=NULL)) {
- if (xkb->ctrls->per_key_repeat[i/8]&(1<<(i%8)))
- fprintf(file,"\n repeat= Yes,");
- else fprintf(file,"\n repeat= No,");
- simple= FALSE;
- }
- if ((xkb->server!=NULL)&&(xkb->server->vmodmap!=NULL)&&
- (xkb->server->vmodmap[i]!=0)) {
- if ((srv->explicit[i]&XkbExplicitVModMapMask)!=0) {
- fprintf(file,"\n virtualMods= %s,",
- XkbVModMaskText(xkb,0,
- xkb->server->vmodmap[i],
- XkbXKBFile));
- }
- else if (showImplicit) {
- fprintf(file,"\n// virtualMods= %s,",
- XkbVModMaskText(xkb,0,
- xkb->server->vmodmap[i],
- XkbXKBFile));
- }
- }
- }
- switch (XkbOutOfRangeGroupAction(XkbKeyGroupInfo(xkb,i))) {
- case XkbClampIntoRange:
- fprintf(file,"\n groupsClamp,");
- break;
- case XkbRedirectIntoRange:
- fprintf(file,"\n groupsRedirect= Group%d,",
- XkbOutOfRangeGroupNumber(XkbKeyGroupInfo(xkb,i))+1);
- break;
- }
- if (srv->behaviors!=NULL) {
- unsigned type;
- type= srv->behaviors[i].type&XkbKB_OpMask;
-
- if (type!=XkbKB_Default) {
- simple= FALSE;
- fprintf(file,"\n %s,",
- XkbBehaviorText(xkb,&srv->behaviors[i],XkbXKBFile));
- }
- }
- if ((srv->explicit==NULL) || showImplicit ||
- ((srv->explicit[i]&XkbExplicitInterpretMask)!=0))
- showActions= XkbKeyHasActions(xkb,i);
- else showActions= FALSE;
-
- if (((unsigned)XkbKeyNumGroups(xkb,i)>1)||showActions)
- simple= FALSE;
- if (simple) {
- KeySym *syms;
- unsigned s;
-
- syms= XkbKeySymsPtr(xkb,i);
- fprintf(file," [ ");
- for (s=0;s<XkbKeyGroupWidth(xkb,i,XkbGroup1Index);s++) {
- if (s!=0)
- fprintf(file,", ");
- fprintf(file,"%15s",XkbKeysymText(*syms++,XkbXKBFile));
- }
- fprintf(file," ] };\n");
- }
- else {
- unsigned g,s;
- KeySym *syms;
- XkbAction *acts;
- syms= XkbKeySymsPtr(xkb,i);
- acts= XkbKeyActionsPtr(xkb,i);
- for (g=0;g<XkbKeyNumGroups(xkb,i);g++) {
- if (g!=0)
- fprintf(file,",");
- fprintf(file,"\n symbols[Group%d]= [ ",g+1);
- for (s=0;s<XkbKeyGroupWidth(xkb,i,g);s++) {
- if (s!=0)
- fprintf(file,", ");
- fprintf(file,"%15s",XkbKeysymText(syms[s],XkbXKBFile));
- }
- fprintf(file," ]");
- syms+= XkbKeyGroupsWidth(xkb,i);
- if (showActions) {
- fprintf(file,",\n actions[Group%d]= [ ",g+1);
- for (s=0;s<XkbKeyGroupWidth(xkb,i,g);s++) {
- if (s!=0)
- fprintf(file,", ");
- WriteXKBAction(file,xkb,(XkbAnyAction *)&acts[s]);
- }
- fprintf(file," ]");
- acts+= XkbKeyGroupsWidth(xkb,i);
- }
- }
- fprintf(file,"\n };\n");
- }
+ _XkbLibError(_XkbErrMissingSymbols, "XkbWriteXKBSymbols", 0);
+ return FALSE;
+ }
+
+ map = xkb->map;
+ if ((!map) || (!map->syms) || (!map->key_sym_map)) {
+ _XkbLibError(_XkbErrMissingSymbols, "XkbWriteXKBSymbols", 0);
+ return FALSE;
+ }
+ if ((!xkb->names) || (!xkb->names->keys)) {
+ _XkbLibError(_XkbErrMissingNames, "XkbWriteXKBSymbols", 0);
+ return FALSE;
+ }
+ if ((xkb->names == NULL) || (xkb->names->symbols == None))
+ fprintf(file, "xkb_symbols {\n\n");
+ else
+ fprintf(file, "xkb_symbols \"%s\" {\n\n",
+ XkbAtomText(xkb->names->symbols, XkbXKBFile));
+ for (tmp = i = 0; i < XkbNumKbdGroups; i++) {
+ if (xkb->names->groups[i] != None) {
+ fprintf(file, " name[group%d]=\"%s\";\n", i + 1,
+ XkbAtomText(xkb->names->groups[i], XkbXKBFile));
+ tmp++;
+ }
+ }
+ if (tmp > 0)
+ fprintf(file, "\n");
+ srv = xkb->server;
+ for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ Bool simple;
+
+ if ((int) XkbKeyNumSyms(xkb, i) < 1)
+ continue;
+ if (XkbFindKeycodeByName(xkb, xkb->names->keys[i].name, TRUE) != i)
+ continue;
+ simple = TRUE;
+ fprintf(file, " key %6s {",
+ XkbKeyNameText(xkb->names->keys[i].name, XkbXKBFile));
+ if (srv->explicit) {
+ if (((srv->explicit[i] & XkbExplicitKeyTypesMask) != 0) ||
+ (showImplicit)) {
+ int typeNdx, g;
+ Bool multi;
+ const char *comment = " ";
+
+ if ((srv->explicit[i] & XkbExplicitKeyTypesMask) == 0)
+ comment = "//";
+ multi = FALSE;
+ typeNdx = XkbKeyKeyTypeIndex(xkb, i, 0);
+ for (g = 1; (g < XkbKeyNumGroups(xkb, i)) && (!multi); g++) {
+ if (XkbKeyKeyTypeIndex(xkb, i, g) != typeNdx)
+ multi = TRUE;
+ }
+ if (multi) {
+ for (g = 0; g < XkbKeyNumGroups(xkb, i); g++) {
+ typeNdx = XkbKeyKeyTypeIndex(xkb, i, g);
+ if (srv->explicit[i] & (1 << g)) {
+ fprintf(file, "\n%s type[group%d]= \"%s\",",
+ comment, g + 1,
+ XkbAtomText(map->types[typeNdx].name,
+ XkbXKBFile));
+ }
+ else if (showImplicit) {
+ fprintf(file, "\n// type[group%d]= \"%s\",",
+ g + 1, XkbAtomText(map->types[typeNdx].name,
+ XkbXKBFile));
+ }
+ }
+ }
+ else {
+ fprintf(file, "\n%s type= \"%s\",", comment,
+ XkbAtomText(map->types[typeNdx].name, XkbXKBFile));
+ }
+ simple = FALSE;
+ }
+ if (((srv->explicit[i] & XkbExplicitAutoRepeatMask) != 0) &&
+ (xkb->ctrls != NULL)) {
+ if (xkb->ctrls->per_key_repeat[i / 8] & (1 << (i % 8)))
+ fprintf(file, "\n repeat= Yes,");
+ else
+ fprintf(file, "\n repeat= No,");
+ simple = FALSE;
+ }
+ if ((xkb->server != NULL) && (xkb->server->vmodmap != NULL) &&
+ (xkb->server->vmodmap[i] != 0)) {
+ if ((srv->explicit[i] & XkbExplicitVModMapMask) != 0) {
+ fprintf(file, "\n virtualMods= %s,",
+ XkbVModMaskText(xkb, 0,
+ xkb->server->vmodmap[i],
+ XkbXKBFile));
+ }
+ else if (showImplicit) {
+ fprintf(file, "\n// virtualMods= %s,",
+ XkbVModMaskText(xkb, 0,
+ xkb->server->vmodmap[i],
+ XkbXKBFile));
+ }
+ }
+ }
+ switch (XkbOutOfRangeGroupAction(XkbKeyGroupInfo(xkb, i))) {
+ case XkbClampIntoRange:
+ fprintf(file, "\n groupsClamp,");
+ break;
+ case XkbRedirectIntoRange:
+ fprintf(file, "\n groupsRedirect= Group%d,",
+ XkbOutOfRangeGroupNumber(XkbKeyGroupInfo(xkb, i)) + 1);
+ break;
+ }
+ if (srv->behaviors != NULL) {
+ unsigned type;
+
+ type = srv->behaviors[i].type & XkbKB_OpMask;
+
+ if (type != XkbKB_Default) {
+ simple = FALSE;
+ fprintf(file, "\n %s,",
+ XkbBehaviorText(xkb, &srv->behaviors[i], XkbXKBFile));
+ }
+ }
+ if ((srv->explicit == NULL) || showImplicit ||
+ ((srv->explicit[i] & XkbExplicitInterpretMask) != 0))
+ showActions = XkbKeyHasActions(xkb, i);
+ else
+ showActions = FALSE;
+
+ if (((unsigned) XkbKeyNumGroups(xkb, i) > 1) || showActions)
+ simple = FALSE;
+ if (simple) {
+ KeySym *syms;
+ unsigned s;
+
+ syms = XkbKeySymsPtr(xkb, i);
+ fprintf(file, " [ ");
+ for (s = 0; s < XkbKeyGroupWidth(xkb, i, XkbGroup1Index); s++) {
+ if (s != 0)
+ fprintf(file, ", ");
+ fprintf(file, "%15s", XkbKeysymText(*syms++, XkbXKBFile));
+ }
+ fprintf(file, " ] };\n");
+ }
+ else {
+ unsigned g, s;
+ KeySym *syms;
+ XkbAction *acts;
+
+ syms = XkbKeySymsPtr(xkb, i);
+ acts = XkbKeyActionsPtr(xkb, i);
+ for (g = 0; g < XkbKeyNumGroups(xkb, i); g++) {
+ if (g != 0)
+ fprintf(file, ",");
+ fprintf(file, "\n symbols[Group%d]= [ ", g + 1);
+ for (s = 0; s < XkbKeyGroupWidth(xkb, i, g); s++) {
+ if (s != 0)
+ fprintf(file, ", ");
+ fprintf(file, "%15s", XkbKeysymText(syms[s], XkbXKBFile));
+ }
+ fprintf(file, " ]");
+ syms += XkbKeyGroupsWidth(xkb, i);
+ if (showActions) {
+ fprintf(file, ",\n actions[Group%d]= [ ", g + 1);
+ for (s = 0; s < XkbKeyGroupWidth(xkb, i, g); s++) {
+ if (s != 0)
+ fprintf(file, ", ");
+ WriteXKBAction(file, xkb, (XkbAnyAction *) & acts[s]);
+ }
+ fprintf(file, " ]");
+ acts += XkbKeyGroupsWidth(xkb, i);
+ }
+ }
+ fprintf(file, "\n };\n");
+ }
}
if (map && map->modmap) {
- for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- if (map->modmap[i]!=0) {
- register int n,bit;
- for (bit=1,n=0;n<XkbNumModifiers;n++,bit<<=1) {
- if (map->modmap[i]&bit) {
- char buf[5];
- memcpy(buf,xkb->names->keys[i].name,4);
- buf[4]= '\0';
- fprintf(file," modifier_map %s { <%s> };\n",
- XkbModIndexText(n,XkbXKBFile),buf);
- }
- }
- }
- }
+ for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ if (map->modmap[i] != 0) {
+ register int n, bit;
+
+ for (bit = 1, n = 0; n < XkbNumModifiers; n++, bit <<= 1) {
+ if (map->modmap[i] & bit) {
+ char buf[5];
+
+ memcpy(buf, xkb->names->keys[i].name, 4);
+ buf[4] = '\0';
+ fprintf(file, " modifier_map %s { <%s> };\n",
+ XkbModIndexText(n, XkbXKBFile), buf);
+ }
+ }
+ }
+ }
}
if (addOn)
- (*addOn)(file,xkb,topLevel,showImplicit,XkmSymbolsIndex,priv);
- fprintf(file,"};\n\n");
+ (*addOn) (file, xkb, topLevel, showImplicit, XkmSymbolsIndex, priv);
+ fprintf(file, "};\n\n");
return TRUE;
}
static Bool
-WriteXKBOutline( FILE * file,
- XkbShapePtr shape,
- XkbOutlinePtr outline,
- int lastRadius,
- int first,
- int indent)
+WriteXKBOutline(FILE * file,
+ XkbShapePtr shape,
+ XkbOutlinePtr outline, int lastRadius, int first, int indent)
{
-register int i;
-XkbPointPtr pt;
-char * iStr;
-
- fprintf(file,"%s",iStr= XkbIndentText(first));
- if (first!=indent)
- iStr= XkbIndentText(indent);
- if (outline->corner_radius!=lastRadius) {
- fprintf(file,"corner= %s,",
- XkbGeomFPText(outline->corner_radius,XkbMessage));
- if (shape!=NULL) {
- fprintf(file,"\n%s",iStr);
- }
+ register int i;
+ XkbPointPtr pt;
+ char *iStr;
+
+ fprintf(file, "%s", iStr = XkbIndentText(first));
+ if (first != indent)
+ iStr = XkbIndentText(indent);
+ if (outline->corner_radius != lastRadius) {
+ fprintf(file, "corner= %s,",
+ XkbGeomFPText(outline->corner_radius, XkbMessage));
+ if (shape != NULL) {
+ fprintf(file, "\n%s", iStr);
+ }
}
if (shape) {
- if (outline==shape->approx)
- fprintf(file,"approx= ");
- else if (outline==shape->primary)
- fprintf(file,"primary= ");
- }
- fprintf(file,"{");
- for (pt=outline->points,i=0;i<outline->num_points;i++,pt++) {
- if (i==0) fprintf(file," ");
- else if ((i%4)==0) fprintf(file,",\n%s ",iStr);
- else fprintf(file,", ");
- fprintf(file,"[ %3s, %3s ]",XkbGeomFPText(pt->x,XkbXKBFile),
- XkbGeomFPText(pt->y,XkbXKBFile));
- }
- fprintf(file," }");
+ if (outline == shape->approx)
+ fprintf(file, "approx= ");
+ else if (outline == shape->primary)
+ fprintf(file, "primary= ");
+ }
+ fprintf(file, "{");
+ for (pt = outline->points, i = 0; i < outline->num_points; i++, pt++) {
+ if (i == 0)
+ fprintf(file, " ");
+ else if ((i % 4) == 0)
+ fprintf(file, ",\n%s ", iStr);
+ else
+ fprintf(file, ", ");
+ fprintf(file, "[ %3s, %3s ]", XkbGeomFPText(pt->x, XkbXKBFile),
+ XkbGeomFPText(pt->y, XkbXKBFile));
+ }
+ fprintf(file, " }");
return TRUE;
}
static Bool
-WriteXKBDoodad( FILE * file,
- unsigned indent,
- XkbGeometryPtr geom,
- XkbDoodadPtr doodad)
+WriteXKBDoodad(FILE * file,
+ unsigned indent, XkbGeometryPtr geom, XkbDoodadPtr doodad)
{
-register char * i_str;
-XkbShapePtr shape;
-XkbColorPtr color;
-
- i_str= XkbIndentText(indent);
- fprintf(file,"%s%s \"%s\" {\n",i_str,
- XkbDoodadTypeText(doodad->any.type,XkbMessage),
- XkbAtomText(doodad->any.name,XkbMessage));
- fprintf(file,"%s top= %s;\n",i_str,
- XkbGeomFPText(doodad->any.top,XkbXKBFile));
- fprintf(file,"%s left= %s;\n",i_str,
- XkbGeomFPText(doodad->any.left,XkbXKBFile));
- fprintf(file,"%s priority= %d;\n",i_str,doodad->any.priority);
+ register char *i_str;
+ XkbShapePtr shape;
+ XkbColorPtr color;
+
+ i_str = XkbIndentText(indent);
+ fprintf(file, "%s%s \"%s\" {\n", i_str,
+ XkbDoodadTypeText(doodad->any.type, XkbMessage),
+ XkbAtomText(doodad->any.name, XkbMessage));
+ fprintf(file, "%s top= %s;\n", i_str,
+ XkbGeomFPText(doodad->any.top, XkbXKBFile));
+ fprintf(file, "%s left= %s;\n", i_str,
+ XkbGeomFPText(doodad->any.left, XkbXKBFile));
+ fprintf(file, "%s priority= %d;\n", i_str, doodad->any.priority);
switch (doodad->any.type) {
- case XkbOutlineDoodad:
- case XkbSolidDoodad:
- if (doodad->shape.angle!=0) {
- fprintf(file,"%s angle= %s;\n",i_str,
- XkbGeomFPText(doodad->shape.angle,XkbXKBFile));
- }
- if (doodad->shape.color_ndx!=0) {
- fprintf(file,"%s color= \"%s\";\n",i_str,
- XkbShapeDoodadColor(geom,&doodad->shape)->spec);
- }
- shape= XkbShapeDoodadShape(geom,&doodad->shape);
- fprintf(file,"%s shape= \"%s\";\n",i_str,
- XkbAtomText(shape->name,XkbXKBFile));
- break;
- case XkbTextDoodad:
- if (doodad->text.angle!=0) {
- fprintf(file,"%s angle= %s;\n",i_str,
- XkbGeomFPText(doodad->text.angle,XkbXKBFile));
- }
- if (doodad->text.width!=0) {
- fprintf(file,"%s width= %s;\n",i_str,
- XkbGeomFPText(doodad->text.width,XkbXKBFile));
-
- }
- if (doodad->text.height!=0) {
- fprintf(file,"%s height= %s;\n",i_str,
- XkbGeomFPText(doodad->text.height,XkbXKBFile));
-
- }
- if (doodad->text.color_ndx!=0) {
- color= XkbTextDoodadColor(geom,&doodad->text);
- fprintf(file,"%s color= \"%s\";\n",i_str,
- XkbStringText(color->spec,XkbXKBFile));
- }
- fprintf(file,"%s XFont= \"%s\";\n",i_str,
- XkbStringText(doodad->text.font,XkbXKBFile));
- fprintf(file,"%s text= \"%s\";\n",i_str,
- XkbStringText(doodad->text.text,XkbXKBFile));
- break;
- case XkbIndicatorDoodad:
- shape= XkbIndicatorDoodadShape(geom,&doodad->indicator);
- color= XkbIndicatorDoodadOnColor(geom,&doodad->indicator);
- fprintf(file,"%s onColor= \"%s\";\n",i_str,
- XkbStringText(color->spec,XkbXKBFile));
- color= XkbIndicatorDoodadOffColor(geom,&doodad->indicator);
- fprintf(file,"%s offColor= \"%s\";\n",i_str,
- XkbStringText(color->spec,XkbXKBFile));
- fprintf(file,"%s shape= \"%s\";\n",i_str,
- XkbAtomText(shape->name,XkbXKBFile));
- break;
- case XkbLogoDoodad:
- fprintf(file,"%s logoName= \"%s\";\n",i_str,
- XkbStringText(doodad->logo.logo_name,XkbXKBFile));
- if (doodad->shape.angle!=0) {
- fprintf(file,"%s angle= %s;\n",i_str,
- XkbGeomFPText(doodad->logo.angle,XkbXKBFile));
- }
- if (doodad->shape.color_ndx!=0) {
- fprintf(file,"%s color= \"%s\";\n",i_str,
- XkbLogoDoodadColor(geom,&doodad->logo)->spec);
- }
- shape= XkbLogoDoodadShape(geom,&doodad->logo);
- fprintf(file,"%s shape= \"%s\";\n",i_str,
- XkbAtomText(shape->name,XkbXKBFile));
- break;
- }
- fprintf(file,"%s};\n",i_str);
+ case XkbOutlineDoodad:
+ case XkbSolidDoodad:
+ if (doodad->shape.angle != 0) {
+ fprintf(file, "%s angle= %s;\n", i_str,
+ XkbGeomFPText(doodad->shape.angle, XkbXKBFile));
+ }
+ if (doodad->shape.color_ndx != 0) {
+ fprintf(file, "%s color= \"%s\";\n", i_str,
+ XkbShapeDoodadColor(geom, &doodad->shape)->spec);
+ }
+ shape = XkbShapeDoodadShape(geom, &doodad->shape);
+ fprintf(file, "%s shape= \"%s\";\n", i_str,
+ XkbAtomText(shape->name, XkbXKBFile));
+ break;
+ case XkbTextDoodad:
+ if (doodad->text.angle != 0) {
+ fprintf(file, "%s angle= %s;\n", i_str,
+ XkbGeomFPText(doodad->text.angle, XkbXKBFile));
+ }
+ if (doodad->text.width != 0) {
+ fprintf(file, "%s width= %s;\n", i_str,
+ XkbGeomFPText(doodad->text.width, XkbXKBFile));
+
+ }
+ if (doodad->text.height != 0) {
+ fprintf(file, "%s height= %s;\n", i_str,
+ XkbGeomFPText(doodad->text.height, XkbXKBFile));
+
+ }
+ if (doodad->text.color_ndx != 0) {
+ color = XkbTextDoodadColor(geom, &doodad->text);
+ fprintf(file, "%s color= \"%s\";\n", i_str,
+ XkbStringText(color->spec, XkbXKBFile));
+ }
+ fprintf(file, "%s XFont= \"%s\";\n", i_str,
+ XkbStringText(doodad->text.font, XkbXKBFile));
+ fprintf(file, "%s text= \"%s\";\n", i_str,
+ XkbStringText(doodad->text.text, XkbXKBFile));
+ break;
+ case XkbIndicatorDoodad:
+ shape = XkbIndicatorDoodadShape(geom, &doodad->indicator);
+ color = XkbIndicatorDoodadOnColor(geom, &doodad->indicator);
+ fprintf(file, "%s onColor= \"%s\";\n", i_str,
+ XkbStringText(color->spec, XkbXKBFile));
+ color = XkbIndicatorDoodadOffColor(geom, &doodad->indicator);
+ fprintf(file, "%s offColor= \"%s\";\n", i_str,
+ XkbStringText(color->spec, XkbXKBFile));
+ fprintf(file, "%s shape= \"%s\";\n", i_str,
+ XkbAtomText(shape->name, XkbXKBFile));
+ break;
+ case XkbLogoDoodad:
+ fprintf(file, "%s logoName= \"%s\";\n", i_str,
+ XkbStringText(doodad->logo.logo_name, XkbXKBFile));
+ if (doodad->shape.angle != 0) {
+ fprintf(file, "%s angle= %s;\n", i_str,
+ XkbGeomFPText(doodad->logo.angle, XkbXKBFile));
+ }
+ if (doodad->shape.color_ndx != 0) {
+ fprintf(file, "%s color= \"%s\";\n", i_str,
+ XkbLogoDoodadColor(geom, &doodad->logo)->spec);
+ }
+ shape = XkbLogoDoodadShape(geom, &doodad->logo);
+ fprintf(file, "%s shape= \"%s\";\n", i_str,
+ XkbAtomText(shape->name, XkbXKBFile));
+ break;
+ }
+ fprintf(file, "%s};\n", i_str);
return TRUE;
}
-/*ARGSUSED*/
-static Bool
-WriteXKBOverlay( FILE * file,
- unsigned indent,
- XkbGeometryPtr geom,
- XkbOverlayPtr ol)
+ /*ARGSUSED*/ static Bool
+WriteXKBOverlay(FILE * file,
+ unsigned indent, XkbGeometryPtr geom, XkbOverlayPtr ol)
{
-register char * i_str;
-int r,k,nOut;
-XkbOverlayRowPtr row;
-XkbOverlayKeyPtr key;
-
- i_str= XkbIndentText(indent);
- if (ol->name!=None) {
- fprintf(file,"%soverlay \"%s\" {\n",i_str,
- XkbAtomText(ol->name,XkbMessage));
- }
- else fprintf(file,"%soverlay {\n",i_str);
- for (nOut=r=0,row=ol->rows;r<ol->num_rows;r++,row++) {
- for (k=0,key=row->keys;k<row->num_keys;k++,key++) {
- char *over,*under;
- over= XkbKeyNameText(key->over.name,XkbXKBFile);
- under= XkbKeyNameText(key->under.name,XkbXKBFile);
- if (nOut==0)
- fprintf(file,"%s %6s=%6s",i_str,under,over);
- else if ((nOut%4)==0)
- fprintf(file,",\n%s %6s=%6s",i_str,under,over);
- else fprintf(file,", %6s=%6s",under,over);
- nOut++;
- }
- }
- fprintf(file,"\n%s};\n",i_str);
+ register char *i_str;
+ int r, k, nOut;
+ XkbOverlayRowPtr row;
+ XkbOverlayKeyPtr key;
+
+ i_str = XkbIndentText(indent);
+ if (ol->name != None) {
+ fprintf(file, "%soverlay \"%s\" {\n", i_str,
+ XkbAtomText(ol->name, XkbMessage));
+ }
+ else
+ fprintf(file, "%soverlay {\n", i_str);
+ for (nOut = r = 0, row = ol->rows; r < ol->num_rows; r++, row++) {
+ for (k = 0, key = row->keys; k < row->num_keys; k++, key++) {
+ char *over, *under;
+
+ over = XkbKeyNameText(key->over.name, XkbXKBFile);
+ under = XkbKeyNameText(key->under.name, XkbXKBFile);
+ if (nOut == 0)
+ fprintf(file, "%s %6s=%6s", i_str, under, over);
+ else if ((nOut % 4) == 0)
+ fprintf(file, ",\n%s %6s=%6s", i_str, under, over);
+ else
+ fprintf(file, ", %6s=%6s", under, over);
+ nOut++;
+ }
+ }
+ fprintf(file, "\n%s};\n", i_str);
return TRUE;
}
static Bool
-WriteXKBSection( FILE * file,
- XkbSectionPtr s,
- XkbGeometryPtr geom)
+WriteXKBSection(FILE * file, XkbSectionPtr s, XkbGeometryPtr geom)
{
-register int i;
-XkbRowPtr row;
-int dfltKeyColor = 0;
-
- fprintf(file," section \"%s\" {\n",
- XkbAtomText(s->name,XkbXKBFile));
- if (s->rows&&(s->rows->num_keys>0)) {
- dfltKeyColor= s->rows->keys[0].color_ndx;
- fprintf(file," key.color= \"%s\";\n",
- XkbStringText(geom->colors[dfltKeyColor].spec,XkbXKBFile));
- }
- fprintf(file," priority= %d;\n",s->priority);
- fprintf(file," top= %s;\n",XkbGeomFPText(s->top,XkbXKBFile));
- fprintf(file," left= %s;\n",XkbGeomFPText(s->left,XkbXKBFile));
- fprintf(file," width= %s;\n",XkbGeomFPText(s->width,XkbXKBFile));
- fprintf(file," height= %s;\n",
- XkbGeomFPText(s->height,XkbXKBFile));
- if (s->angle!=0) {
- fprintf(file," angle= %s;\n",
- XkbGeomFPText(s->angle,XkbXKBFile));
- }
- for (i=0,row=s->rows;i<s->num_rows;i++,row++) {
- fprintf(file," row {\n");
- fprintf(file," top= %s;\n",
- XkbGeomFPText(row->top,XkbXKBFile));
- fprintf(file," left= %s;\n",
- XkbGeomFPText(row->left,XkbXKBFile));
- if (row->vertical)
- fprintf(file," vertical;\n");
- if (row->num_keys>0) {
- register int k;
- register XkbKeyPtr key;
- int forceNL=0;
- int nThisLine= 0;
- fprintf(file," keys {\n");
- for (k=0,key=row->keys;k<row->num_keys;k++,key++) {
- XkbShapePtr shape;
- if (key->color_ndx!=dfltKeyColor)
- forceNL= 1;
- if (k==0) {
- fprintf(file," ");
- nThisLine= 0;
- }
- else if (((nThisLine%2)==1)||(forceNL)) {
- fprintf(file,",\n ");
- forceNL= nThisLine= 0;
- }
- else {
- fprintf(file,", ");
- nThisLine++;
- }
- shape= XkbKeyShape(geom,key);
- fprintf(file,"{ %6s, \"%s\", %3s",
- XkbKeyNameText(key->name.name,XkbXKBFile),
- XkbAtomText(shape->name,XkbXKBFile),
- XkbGeomFPText(key->gap,XkbXKBFile));
- if (key->color_ndx!=dfltKeyColor) {
- fprintf(file,", color=\"%s\"",XkbKeyColor(geom,key)->spec);
- forceNL= 1;
- }
- fprintf(file," }");
- }
- fprintf(file,"\n };\n");
- }
- fprintf(file," };\n");
- }
- if (s->doodads!=NULL) {
- XkbDoodadPtr doodad;
- for (i=0,doodad=s->doodads;i<s->num_doodads;i++,doodad++) {
- WriteXKBDoodad(file,8,geom,doodad);
- }
- }
- if (s->overlays!=NULL) {
- XkbOverlayPtr ol;
- for (i=0,ol=s->overlays;i<s->num_overlays;i++,ol++) {
- WriteXKBOverlay(file,8,geom,ol);
- }
- }
- fprintf(file," }; // End of \"%s\" section\n\n",
- XkbAtomText(s->name,XkbXKBFile));
+ register int i;
+ XkbRowPtr row;
+ int dfltKeyColor = 0;
+
+ fprintf(file, " section \"%s\" {\n", XkbAtomText(s->name, XkbXKBFile));
+ if (s->rows && (s->rows->num_keys > 0)) {
+ dfltKeyColor = s->rows->keys[0].color_ndx;
+ fprintf(file, " key.color= \"%s\";\n",
+ XkbStringText(geom->colors[dfltKeyColor].spec, XkbXKBFile));
+ }
+ fprintf(file, " priority= %d;\n", s->priority);
+ fprintf(file, " top= %s;\n",
+ XkbGeomFPText(s->top, XkbXKBFile));
+ fprintf(file, " left= %s;\n",
+ XkbGeomFPText(s->left, XkbXKBFile));
+ fprintf(file, " width= %s;\n",
+ XkbGeomFPText(s->width, XkbXKBFile));
+ fprintf(file, " height= %s;\n",
+ XkbGeomFPText(s->height, XkbXKBFile));
+ if (s->angle != 0) {
+ fprintf(file, " angle= %s;\n",
+ XkbGeomFPText(s->angle, XkbXKBFile));
+ }
+ for (i = 0, row = s->rows; i < s->num_rows; i++, row++) {
+ fprintf(file, " row {\n");
+ fprintf(file, " top= %s;\n",
+ XkbGeomFPText(row->top, XkbXKBFile));
+ fprintf(file, " left= %s;\n",
+ XkbGeomFPText(row->left, XkbXKBFile));
+ if (row->vertical)
+ fprintf(file, " vertical;\n");
+ if (row->num_keys > 0) {
+ register int k;
+ register XkbKeyPtr key;
+ int forceNL = 0;
+ int nThisLine = 0;
+
+ fprintf(file, " keys {\n");
+ for (k = 0, key = row->keys; k < row->num_keys; k++, key++) {
+ XkbShapePtr shape;
+
+ if (key->color_ndx != dfltKeyColor)
+ forceNL = 1;
+ if (k == 0) {
+ fprintf(file, " ");
+ nThisLine = 0;
+ }
+ else if (((nThisLine % 2) == 1) || (forceNL)) {
+ fprintf(file, ",\n ");
+ forceNL = nThisLine = 0;
+ }
+ else {
+ fprintf(file, ", ");
+ nThisLine++;
+ }
+ shape = XkbKeyShape(geom, key);
+ fprintf(file, "{ %6s, \"%s\", %3s",
+ XkbKeyNameText(key->name.name, XkbXKBFile),
+ XkbAtomText(shape->name, XkbXKBFile),
+ XkbGeomFPText(key->gap, XkbXKBFile));
+ if (key->color_ndx != dfltKeyColor) {
+ fprintf(file, ", color=\"%s\"",
+ XkbKeyColor(geom, key)->spec);
+ forceNL = 1;
+ }
+ fprintf(file, " }");
+ }
+ fprintf(file, "\n };\n");
+ }
+ fprintf(file, " };\n");
+ }
+ if (s->doodads != NULL) {
+ XkbDoodadPtr doodad;
+
+ for (i = 0, doodad = s->doodads; i < s->num_doodads; i++, doodad++) {
+ WriteXKBDoodad(file, 8, geom, doodad);
+ }
+ }
+ if (s->overlays != NULL) {
+ XkbOverlayPtr ol;
+
+ for (i = 0, ol = s->overlays; i < s->num_overlays; i++, ol++) {
+ WriteXKBOverlay(file, 8, geom, ol);
+ }
+ }
+ fprintf(file, " }; // End of \"%s\" section\n\n",
+ XkbAtomText(s->name, XkbXKBFile));
return TRUE;
}
Bool
-XkbWriteXKBGeometry( FILE * file,
- XkbDescPtr xkb,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
+XkbWriteXKBGeometry(FILE * file,
+ XkbDescPtr xkb,
+ Bool topLevel,
+ Bool showImplicit, XkbFileAddOnFunc addOn, void *priv)
{
-register unsigned i,n;
-XkbGeometryPtr geom;
-
- if ((!xkb)||(!xkb->geom)) {
- _XkbLibError(_XkbErrMissingGeometry,"XkbWriteXKBGeometry",0);
- return FALSE;
- }
- geom= xkb->geom;
- if (geom->name==None)
- fprintf(file,"xkb_geometry {\n\n");
- else fprintf(file,"xkb_geometry \"%s\" {\n\n",
- XkbAtomText(geom->name,XkbXKBFile));
- fprintf(file," width= %s;\n",
- XkbGeomFPText(geom->width_mm,XkbXKBFile));
- fprintf(file," height= %s;\n\n",
- XkbGeomFPText(geom->height_mm,XkbXKBFile));
-
- if (geom->key_aliases!=NULL) {
- XkbKeyAliasPtr pAl;
- pAl= geom->key_aliases;
- for (i=0;i<geom->num_key_aliases;i++,pAl++) {
- fprintf(file," alias %6s = %6s;\n",
- XkbKeyNameText(pAl->alias,XkbXKBFile),
- XkbKeyNameText(pAl->real,XkbXKBFile));
- }
- fprintf(file,"\n");
- }
-
- if (geom->base_color!=NULL)
- fprintf(file," baseColor= \"%s\";\n",
- XkbStringText(geom->base_color->spec,XkbXKBFile));
- if (geom->label_color!=NULL)
- fprintf(file," labelColor= \"%s\";\n",
- XkbStringText(geom->label_color->spec,XkbXKBFile));
- if (geom->label_font!=NULL)
- fprintf(file," xfont= \"%s\";\n",
- XkbStringText(geom->label_font,XkbXKBFile));
- if ((geom->num_colors>0)&&(showImplicit)) {
- XkbColorPtr color;
- for (color=geom->colors,i=0;i<geom->num_colors;i++,color++) {
- fprintf(file,"// color[%d]= \"%s\"\n",i,
- XkbStringText(color->spec,XkbXKBFile));
- }
- fprintf(file,"\n");
- }
- if (geom->num_properties>0) {
- XkbPropertyPtr prop;
- for (prop=geom->properties,i=0;i<geom->num_properties;i++,prop++) {
- fprintf(file," %s= \"%s\";\n",prop->name,
- XkbStringText(prop->value,XkbXKBFile));
- }
- fprintf(file,"\n");
- }
- if (geom->num_shapes>0) {
- XkbShapePtr shape;
- XkbOutlinePtr outline;
- int lastR;
- for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) {
- lastR=0;
- fprintf(file," shape \"%s\" {",
- XkbAtomText(shape->name,XkbXKBFile));
- outline= shape->outlines;
- if (shape->num_outlines>1) {
- for (n=0;n<shape->num_outlines;n++,outline++) {
- if (n==0) fprintf(file,"\n");
- else fprintf(file,",\n");
- WriteXKBOutline(file,shape,outline,lastR,8,8);
- lastR= outline->corner_radius;
- }
- fprintf(file,"\n };\n");
- }
- else {
- WriteXKBOutline(file,NULL,outline,lastR,1,8);
- fprintf(file," };\n");
- }
- }
- }
- if (geom->num_sections>0) {
- XkbSectionPtr section;
- for (section=geom->sections,i=0;i<geom->num_sections;i++,section++){
- WriteXKBSection(file,section,geom);
- }
- }
- if (geom->num_doodads>0) {
- XkbDoodadPtr doodad;
- for (i=0,doodad=geom->doodads;i<geom->num_doodads;i++,doodad++) {
- WriteXKBDoodad(file,4,geom,doodad);
- }
+ register unsigned i, n;
+ XkbGeometryPtr geom;
+
+ if ((!xkb) || (!xkb->geom)) {
+ _XkbLibError(_XkbErrMissingGeometry, "XkbWriteXKBGeometry", 0);
+ return FALSE;
+ }
+ geom = xkb->geom;
+ if (geom->name == None)
+ fprintf(file, "xkb_geometry {\n\n");
+ else
+ fprintf(file, "xkb_geometry \"%s\" {\n\n",
+ XkbAtomText(geom->name, XkbXKBFile));
+ fprintf(file, " width= %s;\n",
+ XkbGeomFPText(geom->width_mm, XkbXKBFile));
+ fprintf(file, " height= %s;\n\n",
+ XkbGeomFPText(geom->height_mm, XkbXKBFile));
+
+ if (geom->key_aliases != NULL) {
+ XkbKeyAliasPtr pAl;
+
+ pAl = geom->key_aliases;
+ for (i = 0; i < geom->num_key_aliases; i++, pAl++) {
+ fprintf(file, " alias %6s = %6s;\n",
+ XkbKeyNameText(pAl->alias, XkbXKBFile),
+ XkbKeyNameText(pAl->real, XkbXKBFile));
+ }
+ fprintf(file, "\n");
+ }
+
+ if (geom->base_color != NULL)
+ fprintf(file, " baseColor= \"%s\";\n",
+ XkbStringText(geom->base_color->spec, XkbXKBFile));
+ if (geom->label_color != NULL)
+ fprintf(file, " labelColor= \"%s\";\n",
+ XkbStringText(geom->label_color->spec, XkbXKBFile));
+ if (geom->label_font != NULL)
+ fprintf(file, " xfont= \"%s\";\n",
+ XkbStringText(geom->label_font, XkbXKBFile));
+ if ((geom->num_colors > 0) && (showImplicit)) {
+ XkbColorPtr color;
+
+ for (color = geom->colors, i = 0; i < geom->num_colors; i++, color++) {
+ fprintf(file, "// color[%d]= \"%s\"\n", i,
+ XkbStringText(color->spec, XkbXKBFile));
+ }
+ fprintf(file, "\n");
+ }
+ if (geom->num_properties > 0) {
+ XkbPropertyPtr prop;
+
+ for (prop = geom->properties, i = 0; i < geom->num_properties;
+ i++, prop++) {
+ fprintf(file, " %s= \"%s\";\n", prop->name,
+ XkbStringText(prop->value, XkbXKBFile));
+ }
+ fprintf(file, "\n");
+ }
+ if (geom->num_shapes > 0) {
+ XkbShapePtr shape;
+ XkbOutlinePtr outline;
+ int lastR;
+
+ for (shape = geom->shapes, i = 0; i < geom->num_shapes; i++, shape++) {
+ lastR = 0;
+ fprintf(file, " shape \"%s\" {",
+ XkbAtomText(shape->name, XkbXKBFile));
+ outline = shape->outlines;
+ if (shape->num_outlines > 1) {
+ for (n = 0; n < shape->num_outlines; n++, outline++) {
+ if (n == 0)
+ fprintf(file, "\n");
+ else
+ fprintf(file, ",\n");
+ WriteXKBOutline(file, shape, outline, lastR, 8, 8);
+ lastR = outline->corner_radius;
+ }
+ fprintf(file, "\n };\n");
+ }
+ else {
+ WriteXKBOutline(file, NULL, outline, lastR, 1, 8);
+ fprintf(file, " };\n");
+ }
+ }
+ }
+ if (geom->num_sections > 0) {
+ XkbSectionPtr section;
+
+ for (section = geom->sections, i = 0; i < geom->num_sections;
+ i++, section++) {
+ WriteXKBSection(file, section, geom);
+ }
+ }
+ if (geom->num_doodads > 0) {
+ XkbDoodadPtr doodad;
+
+ for (i = 0, doodad = geom->doodads; i < geom->num_doodads;
+ i++, doodad++) {
+ WriteXKBDoodad(file, 4, geom, doodad);
+ }
}
if (addOn)
- (*addOn)(file,xkb,topLevel,showImplicit,XkmGeometryIndex,priv);
- fprintf(file,"};\n\n");
+ (*addOn) (file, xkb, topLevel, showImplicit, XkmGeometryIndex, priv);
+ fprintf(file, "};\n\n");
return TRUE;
}
diff --git a/xorg-server/xkb/xkbtext.c b/xorg-server/xkb/xkbtext.c
index 8ef2b05b0..f66a08f75 100644
--- a/xorg-server/xkb/xkbtext.c
+++ b/xorg-server/xkb/xkbtext.c
@@ -50,168 +50,179 @@
#define BUFFER_SIZE 512
static char textBuffer[BUFFER_SIZE];
-static int tbNext= 0;
+static int tbNext = 0;
static char *
tbGetBuffer(unsigned size)
{
-char *rtrn;
-
- if (size>=BUFFER_SIZE)
- return NULL;
- if ((BUFFER_SIZE-tbNext)<=size)
- tbNext= 0;
- rtrn= &textBuffer[tbNext];
- tbNext+= size;
+ char *rtrn;
+
+ if (size >= BUFFER_SIZE)
+ return NULL;
+ if ((BUFFER_SIZE - tbNext) <= size)
+ tbNext = 0;
+ rtrn = &textBuffer[tbNext];
+ tbNext += size;
return rtrn;
}
/***====================================================================***/
char *
-XkbAtomText(Atom atm,unsigned format)
+XkbAtomText(Atom atm, unsigned format)
{
-const char *atmstr;
-char *rtrn,*tmp;
+ const char *atmstr;
+ char *rtrn, *tmp;
atmstr = NameForAtom(atm);
if (atmstr != NULL) {
- int len;
- len= strlen(atmstr)+1;
- if (len>BUFFER_SIZE)
- len= BUFFER_SIZE-2;
- rtrn= tbGetBuffer(len);
- strlcpy(rtrn,atmstr,len);
+ int len;
+
+ len = strlen(atmstr) + 1;
+ if (len > BUFFER_SIZE)
+ len = BUFFER_SIZE - 2;
+ rtrn = tbGetBuffer(len);
+ strlcpy(rtrn, atmstr, len);
}
else {
- rtrn= tbGetBuffer(1);
- rtrn[0]= '\0';
+ rtrn = tbGetBuffer(1);
+ rtrn[0] = '\0';
}
- if (format==XkbCFile) {
- for (tmp=rtrn;*tmp!='\0';tmp++) {
- if ((tmp==rtrn)&&(!isalpha(*tmp)))
- *tmp= '_';
- else if (!isalnum(*tmp))
- *tmp= '_';
- }
+ if (format == XkbCFile) {
+ for (tmp = rtrn; *tmp != '\0'; tmp++) {
+ if ((tmp == rtrn) && (!isalpha(*tmp)))
+ *tmp = '_';
+ else if (!isalnum(*tmp))
+ *tmp = '_';
+ }
}
- return XkbStringText(rtrn,format);
+ return XkbStringText(rtrn, format);
}
/***====================================================================***/
char *
-XkbVModIndexText(XkbDescPtr xkb,unsigned ndx,unsigned format)
+XkbVModIndexText(XkbDescPtr xkb, unsigned ndx, unsigned format)
{
-register int len;
-register Atom *vmodNames;
-char *rtrn;
-const char *tmp;
-char numBuf[20];
+ register int len;
+ register Atom *vmodNames;
+ char *rtrn;
+ const char *tmp;
+ char numBuf[20];
if (xkb && xkb->names)
- vmodNames= xkb->names->vmods;
- else vmodNames= NULL;
-
- tmp= NULL;
- if (ndx>=XkbNumVirtualMods)
- tmp= "illegal";
- else if (vmodNames&&(vmodNames[ndx]!=None))
- tmp= NameForAtom(vmodNames[ndx]);
- if (tmp==NULL) {
- snprintf(numBuf,sizeof(numBuf),"%d",ndx);
- tmp = numBuf;
+ vmodNames = xkb->names->vmods;
+ else
+ vmodNames = NULL;
+
+ tmp = NULL;
+ if (ndx >= XkbNumVirtualMods)
+ tmp = "illegal";
+ else if (vmodNames && (vmodNames[ndx] != None))
+ tmp = NameForAtom(vmodNames[ndx]);
+ if (tmp == NULL) {
+ snprintf(numBuf, sizeof(numBuf), "%d", ndx);
+ tmp = numBuf;
}
- len= strlen(tmp)+1;
- if (format==XkbCFile)
- len+= 4;
- if (len>=BUFFER_SIZE)
- len= BUFFER_SIZE-1;
- rtrn= tbGetBuffer(len);
- if (format==XkbCFile) {
- strcpy(rtrn,"vmod_");
- strncpy(&rtrn[5],tmp,len-4);
+ len = strlen(tmp) + 1;
+ if (format == XkbCFile)
+ len += 4;
+ if (len >= BUFFER_SIZE)
+ len = BUFFER_SIZE - 1;
+ rtrn = tbGetBuffer(len);
+ if (format == XkbCFile) {
+ strcpy(rtrn, "vmod_");
+ strncpy(&rtrn[5], tmp, len - 4);
}
- else strncpy(rtrn,tmp,len);
+ else
+ strncpy(rtrn, tmp, len);
return rtrn;
}
char *
-XkbVModMaskText( XkbDescPtr xkb,
- unsigned modMask,
- unsigned mask,
- unsigned format)
+XkbVModMaskText(XkbDescPtr xkb,
+ unsigned modMask, unsigned mask, unsigned format)
{
-register int i,bit;
-int len;
-char *mm,*rtrn;
-char *str,buf[BUFFER_SIZE];
-
- if ((modMask==0)&&(mask==0)) {
- rtrn= tbGetBuffer(5);
- if (format==XkbCFile)
- sprintf(rtrn,"0");
- else sprintf(rtrn,"none");
- return rtrn;
+ register int i, bit;
+ int len;
+ char *mm, *rtrn;
+ char *str, buf[BUFFER_SIZE];
+
+ if ((modMask == 0) && (mask == 0)) {
+ rtrn = tbGetBuffer(5);
+ if (format == XkbCFile)
+ sprintf(rtrn, "0");
+ else
+ sprintf(rtrn, "none");
+ return rtrn;
}
- if (modMask!=0)
- mm= XkbModMaskText(modMask,format);
- else mm= NULL;
+ if (modMask != 0)
+ mm = XkbModMaskText(modMask, format);
+ else
+ mm = NULL;
- str= buf;
- buf[0]= '\0';
+ str = buf;
+ buf[0] = '\0';
if (mask) {
- char *tmp;
- for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (mask&bit) {
- tmp= XkbVModIndexText(xkb,i,format);
- len= strlen(tmp)+1+(str==buf?0:1);
- if (format==XkbCFile)
- len+= 4;
- if ((str-(buf+len))<=BUFFER_SIZE) {
- if (str!=buf) {
- if (format==XkbCFile) *str++= '|';
- else *str++= '+';
- len--;
- }
- }
- if (format==XkbCFile)
- sprintf(str,"%sMask",tmp);
- else strcpy(str,tmp);
- str= &str[len-1];
- }
- }
- str= buf;
+ char *tmp;
+
+ for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if (mask & bit) {
+ tmp = XkbVModIndexText(xkb, i, format);
+ len = strlen(tmp) + 1 + (str == buf ? 0 : 1);
+ if (format == XkbCFile)
+ len += 4;
+ if ((str - (buf + len)) <= BUFFER_SIZE) {
+ if (str != buf) {
+ if (format == XkbCFile)
+ *str++ = '|';
+ else
+ *str++ = '+';
+ len--;
+ }
+ }
+ if (format == XkbCFile)
+ sprintf(str, "%sMask", tmp);
+ else
+ strcpy(str, tmp);
+ str = &str[len - 1];
+ }
+ }
+ str = buf;
}
- else str= NULL;
- if (mm)
- len= strlen(mm);
- else len= 0;
+ else
+ str = NULL;
+ if (mm)
+ len = strlen(mm);
+ else
+ len = 0;
if (str)
- len+= strlen(str)+(mm==NULL?0:1);
- if (len>=BUFFER_SIZE)
- len= BUFFER_SIZE-1;
- rtrn= tbGetBuffer(len+1);
- rtrn[0]= '\0';
-
- if (mm!=NULL) {
- i= strlen(mm);
- if (i>len)
- i= len;
- strcpy(rtrn,mm);
+ len += strlen(str) + (mm == NULL ? 0 : 1);
+ if (len >= BUFFER_SIZE)
+ len = BUFFER_SIZE - 1;
+ rtrn = tbGetBuffer(len + 1);
+ rtrn[0] = '\0';
+
+ if (mm != NULL) {
+ i = strlen(mm);
+ if (i > len)
+ i = len;
+ strcpy(rtrn, mm);
}
else {
- i=0;
+ i = 0;
}
- if (str!=NULL) {
- if (mm!=NULL) {
- if (format==XkbCFile) strcat(rtrn,"|");
- else strcat(rtrn,"+");
- }
- strncat(rtrn,str,len-i);
+ if (str != NULL) {
+ if (mm != NULL) {
+ if (format == XkbCFile)
+ strcat(rtrn, "|");
+ else
+ strcat(rtrn, "+");
+ }
+ strncat(rtrn, str, len - i);
}
- rtrn[len]= '\0';
+ rtrn[len] = '\0';
return rtrn;
}
@@ -220,111 +231,119 @@ static const char *modNames[XkbNumModifiers] = {
};
char *
-XkbModIndexText(unsigned ndx,unsigned format)
+XkbModIndexText(unsigned ndx, unsigned format)
{
-char * rtrn;
-char buf[100];
-
- if (format==XkbCFile) {
- if (ndx<XkbNumModifiers)
- snprintf(buf,sizeof(buf),"%sMapIndex",modNames[ndx]);
- else if (ndx==XkbNoModifier)
- snprintf(buf,sizeof(buf),"XkbNoModifier");
- else snprintf(buf,sizeof(buf),"0x%02x",ndx);
+ char *rtrn;
+ char buf[100];
+
+ if (format == XkbCFile) {
+ if (ndx < XkbNumModifiers)
+ snprintf(buf, sizeof(buf), "%sMapIndex", modNames[ndx]);
+ else if (ndx == XkbNoModifier)
+ snprintf(buf, sizeof(buf), "XkbNoModifier");
+ else
+ snprintf(buf, sizeof(buf), "0x%02x", ndx);
}
else {
- if (ndx<XkbNumModifiers)
- strcpy(buf,modNames[ndx]);
- else if (ndx==XkbNoModifier)
- strcpy(buf,"none");
- else snprintf(buf,sizeof(buf),"ILLEGAL_%02x",ndx);
+ if (ndx < XkbNumModifiers)
+ strcpy(buf, modNames[ndx]);
+ else if (ndx == XkbNoModifier)
+ strcpy(buf, "none");
+ else
+ snprintf(buf, sizeof(buf), "ILLEGAL_%02x", ndx);
}
- rtrn= tbGetBuffer(strlen(buf)+1);
- strcpy(rtrn,buf);
+ rtrn = tbGetBuffer(strlen(buf) + 1);
+ strcpy(rtrn, buf);
return rtrn;
}
char *
-XkbModMaskText(unsigned mask,unsigned format)
+XkbModMaskText(unsigned mask, unsigned format)
{
-register int i,bit;
-char buf[64],*rtrn;
-
- if ((mask&0xff)==0xff) {
- if (format==XkbCFile) strcpy(buf,"0xff");
- else strcpy(buf,"all");
+ register int i, bit;
+ char buf[64], *rtrn;
+
+ if ((mask & 0xff) == 0xff) {
+ if (format == XkbCFile)
+ strcpy(buf, "0xff");
+ else
+ strcpy(buf, "all");
}
- else if ((mask&0xff)==0) {
- if (format==XkbCFile) strcpy(buf,"0");
- else strcpy(buf,"none");
+ else if ((mask & 0xff) == 0) {
+ if (format == XkbCFile)
+ strcpy(buf, "0");
+ else
+ strcpy(buf, "none");
}
else {
- char *str= buf;
- buf[0]= '\0';
- for (i=0,bit=1;i<XkbNumModifiers;i++,bit<<=1) {
- if (mask&bit) {
- if (str!=buf) {
- if (format==XkbCFile) *str++= '|';
- else *str++= '+';
- }
- strcpy(str,modNames[i]);
- str= &str[strlen(str)];
- if (format==XkbCFile) {
- strcpy(str,"Mask");
- str+= 4;
- }
- }
- }
+ char *str = buf;
+
+ buf[0] = '\0';
+ for (i = 0, bit = 1; i < XkbNumModifiers; i++, bit <<= 1) {
+ if (mask & bit) {
+ if (str != buf) {
+ if (format == XkbCFile)
+ *str++ = '|';
+ else
+ *str++ = '+';
+ }
+ strcpy(str, modNames[i]);
+ str = &str[strlen(str)];
+ if (format == XkbCFile) {
+ strcpy(str, "Mask");
+ str += 4;
+ }
+ }
+ }
}
- rtrn= tbGetBuffer(strlen(buf)+1);
- strcpy(rtrn,buf);
+ rtrn = tbGetBuffer(strlen(buf) + 1);
+ strcpy(rtrn, buf);
return rtrn;
}
/***====================================================================***/
-/*ARGSUSED*/
-char *
-XkbConfigText(unsigned config,unsigned format)
+ /*ARGSUSED*/ char *
+XkbConfigText(unsigned config, unsigned format)
{
-static char *buf;
+ static char *buf;
- buf= tbGetBuffer(32);
+ buf = tbGetBuffer(32);
switch (config) {
- case XkmSemanticsFile:
- strcpy(buf,"Semantics");
- break;
- case XkmLayoutFile:
- strcpy(buf,"Layout");
- break;
- case XkmKeymapFile:
- strcpy(buf,"Keymap");
- break;
- case XkmGeometryFile:
- case XkmGeometryIndex:
- strcpy(buf,"Geometry");
- break;
- case XkmTypesIndex:
- strcpy(buf,"Types");
- break;
- case XkmCompatMapIndex:
- strcpy(buf,"CompatMap");
- break;
- case XkmSymbolsIndex:
- strcpy(buf,"Symbols");
- break;
- case XkmIndicatorsIndex:
- strcpy(buf,"Indicators");
- break;
- case XkmKeyNamesIndex:
- strcpy(buf,"KeyNames");
- break;
- case XkmVirtualModsIndex:
- strcpy(buf,"VirtualMods");
- break;
- default:
- sprintf(buf,"unknown(%d)",config);
- break;
+ case XkmSemanticsFile:
+ strcpy(buf, "Semantics");
+ break;
+ case XkmLayoutFile:
+ strcpy(buf, "Layout");
+ break;
+ case XkmKeymapFile:
+ strcpy(buf, "Keymap");
+ break;
+ case XkmGeometryFile:
+ case XkmGeometryIndex:
+ strcpy(buf, "Geometry");
+ break;
+ case XkmTypesIndex:
+ strcpy(buf, "Types");
+ break;
+ case XkmCompatMapIndex:
+ strcpy(buf, "CompatMap");
+ break;
+ case XkmSymbolsIndex:
+ strcpy(buf, "Symbols");
+ break;
+ case XkmIndicatorsIndex:
+ strcpy(buf, "Indicators");
+ break;
+ case XkmKeyNamesIndex:
+ strcpy(buf, "KeyNames");
+ break;
+ case XkmVirtualModsIndex:
+ strcpy(buf, "VirtualMods");
+ break;
+ default:
+ sprintf(buf, "unknown(%d)", config);
+ break;
}
return buf;
}
@@ -332,35 +351,37 @@ static char *buf;
/***====================================================================***/
char *
-XkbKeysymText(KeySym sym,unsigned format)
+XkbKeysymText(KeySym sym, unsigned format)
{
-static char buf[32];
+ static char buf[32];
- if (sym==NoSymbol)
- strcpy(buf,"NoSymbol");
- else snprintf(buf, sizeof(buf), "0x%lx", (long)sym);
+ if (sym == NoSymbol)
+ strcpy(buf, "NoSymbol");
+ else
+ snprintf(buf, sizeof(buf), "0x%lx", (long) sym);
return buf;
}
char *
-XkbKeyNameText(char *name,unsigned format)
+XkbKeyNameText(char *name, unsigned format)
{
-char *buf;
+ char *buf;
- if (format==XkbCFile) {
- buf= tbGetBuffer(5);
- memcpy(buf,name,4);
- buf[4]= '\0';
+ if (format == XkbCFile) {
+ buf = tbGetBuffer(5);
+ memcpy(buf, name, 4);
+ buf[4] = '\0';
}
else {
- int len;
- buf= tbGetBuffer(7);
- buf[0]= '<';
- memcpy(&buf[1],name,4);
- buf[5]= '\0';
- len= strlen(buf);
- buf[len++]= '>';
- buf[len]= '\0';
+ int len;
+
+ buf = tbGetBuffer(7);
+ buf[0] = '<';
+ memcpy(&buf[1], name, 4);
+ buf[5] = '\0';
+ len = strlen(buf);
+ buf[len++] = '>';
+ buf[len] = '\0';
}
return buf;
}
@@ -368,143 +389,156 @@ char *buf;
/***====================================================================***/
static const char *siMatchText[5] = {
- "NoneOf", "AnyOfOrNone", "AnyOf", "AllOf", "Exactly"
+ "NoneOf", "AnyOfOrNone", "AnyOf", "AllOf", "Exactly"
};
const char *
-XkbSIMatchText(unsigned type,unsigned format)
+XkbSIMatchText(unsigned type, unsigned format)
{
-static char buf[40];
-const char *rtrn;
-
- switch (type&XkbSI_OpMask) {
- case XkbSI_NoneOf: rtrn= siMatchText[0]; break;
- case XkbSI_AnyOfOrNone: rtrn= siMatchText[1]; break;
- case XkbSI_AnyOf: rtrn= siMatchText[2]; break;
- case XkbSI_AllOf: rtrn= siMatchText[3]; break;
- case XkbSI_Exactly: rtrn= siMatchText[4]; break;
- default: snprintf(buf,sizeof(buf),"0x%x",type&XkbSI_OpMask);
- return buf;
+ static char buf[40];
+ const char *rtrn;
+
+ switch (type & XkbSI_OpMask) {
+ case XkbSI_NoneOf:
+ rtrn = siMatchText[0];
+ break;
+ case XkbSI_AnyOfOrNone:
+ rtrn = siMatchText[1];
+ break;
+ case XkbSI_AnyOf:
+ rtrn = siMatchText[2];
+ break;
+ case XkbSI_AllOf:
+ rtrn = siMatchText[3];
+ break;
+ case XkbSI_Exactly:
+ rtrn = siMatchText[4];
+ break;
+ default:
+ snprintf(buf, sizeof(buf), "0x%x", type & XkbSI_OpMask);
+ return buf;
}
- if (format==XkbCFile) {
- if (type&XkbSI_LevelOneOnly)
- snprintf(buf,sizeof(buf),"XkbSI_LevelOneOnly|XkbSI_%s",rtrn);
- else snprintf(buf,sizeof(buf),"XkbSI_%s",rtrn);
- rtrn= buf;
+ if (format == XkbCFile) {
+ if (type & XkbSI_LevelOneOnly)
+ snprintf(buf, sizeof(buf), "XkbSI_LevelOneOnly|XkbSI_%s", rtrn);
+ else
+ snprintf(buf, sizeof(buf), "XkbSI_%s", rtrn);
+ rtrn = buf;
}
return rtrn;
}
/***====================================================================***/
-static const char *imWhichNames[]= {
- "base",
- "latched",
- "locked",
- "effective",
- "compat"
+static const char *imWhichNames[] = {
+ "base",
+ "latched",
+ "locked",
+ "effective",
+ "compat"
};
char *
-XkbIMWhichStateMaskText(unsigned use_which,unsigned format)
+XkbIMWhichStateMaskText(unsigned use_which, unsigned format)
{
-int len;
-unsigned i,bit,tmp;
-char * buf;
-
- if (use_which==0) {
- buf= tbGetBuffer(2);
- strcpy(buf,"0");
- return buf;
+ int len;
+ unsigned i, bit, tmp;
+ char *buf;
+
+ if (use_which == 0) {
+ buf = tbGetBuffer(2);
+ strcpy(buf, "0");
+ return buf;
}
- tmp= use_which&XkbIM_UseAnyMods;
- for (len=i=0,bit=1;tmp!=0;i++,bit<<=1) {
- if (tmp&bit) {
- tmp&= ~bit;
- len+= strlen(imWhichNames[i])+1;
- if (format==XkbCFile)
- len+= 9;
- }
+ tmp = use_which & XkbIM_UseAnyMods;
+ for (len = i = 0, bit = 1; tmp != 0; i++, bit <<= 1) {
+ if (tmp & bit) {
+ tmp &= ~bit;
+ len += strlen(imWhichNames[i]) + 1;
+ if (format == XkbCFile)
+ len += 9;
+ }
}
- buf= tbGetBuffer(len+1);
- tmp= use_which&XkbIM_UseAnyMods;
- for (len=i=0,bit=1;tmp!=0;i++,bit<<=1) {
- if (tmp&bit) {
- tmp&= ~bit;
- if (format==XkbCFile) {
- if (len!=0)
- buf[len++]= '|';
- sprintf(&buf[len],"XkbIM_Use%s",imWhichNames[i]);
- buf[len+9]= toupper(buf[len+9]);
- }
- else {
- if (len!=0)
- buf[len++]= '+';
- sprintf(&buf[len],"%s",imWhichNames[i]);
- }
- len+= strlen(&buf[len]);
- }
+ buf = tbGetBuffer(len + 1);
+ tmp = use_which & XkbIM_UseAnyMods;
+ for (len = i = 0, bit = 1; tmp != 0; i++, bit <<= 1) {
+ if (tmp & bit) {
+ tmp &= ~bit;
+ if (format == XkbCFile) {
+ if (len != 0)
+ buf[len++] = '|';
+ sprintf(&buf[len], "XkbIM_Use%s", imWhichNames[i]);
+ buf[len + 9] = toupper(buf[len + 9]);
+ }
+ else {
+ if (len != 0)
+ buf[len++] = '+';
+ sprintf(&buf[len], "%s", imWhichNames[i]);
+ }
+ len += strlen(&buf[len]);
+ }
}
return buf;
}
static const char *ctrlNames[] = {
- "repeatKeys",
- "slowKeys",
- "bounceKeys",
- "stickyKeys",
- "mouseKeys",
- "mouseKeysAccel",
- "accessXKeys",
- "accessXTimeout",
- "accessXFeedback",
- "audibleBell",
- "overlay1",
- "overlay2",
- "ignoreGroupLock"
+ "repeatKeys",
+ "slowKeys",
+ "bounceKeys",
+ "stickyKeys",
+ "mouseKeys",
+ "mouseKeysAccel",
+ "accessXKeys",
+ "accessXTimeout",
+ "accessXFeedback",
+ "audibleBell",
+ "overlay1",
+ "overlay2",
+ "ignoreGroupLock"
};
char *
-XkbControlsMaskText(unsigned ctrls,unsigned format)
+XkbControlsMaskText(unsigned ctrls, unsigned format)
{
-int len;
-unsigned i,bit,tmp;
-char * buf;
-
- if (ctrls==0) {
- buf= tbGetBuffer(5);
- if (format==XkbCFile)
- strcpy(buf,"0");
- else strcpy(buf,"none");
- return buf;
+ int len;
+ unsigned i, bit, tmp;
+ char *buf;
+
+ if (ctrls == 0) {
+ buf = tbGetBuffer(5);
+ if (format == XkbCFile)
+ strcpy(buf, "0");
+ else
+ strcpy(buf, "none");
+ return buf;
}
- tmp= ctrls&XkbAllBooleanCtrlsMask;
- for (len=i=0,bit=1;tmp!=0;i++,bit<<=1) {
- if (tmp&bit) {
- tmp&= ~bit;
- len+= strlen(ctrlNames[i])+1;
- if (format==XkbCFile)
- len+= 7;
- }
+ tmp = ctrls & XkbAllBooleanCtrlsMask;
+ for (len = i = 0, bit = 1; tmp != 0; i++, bit <<= 1) {
+ if (tmp & bit) {
+ tmp &= ~bit;
+ len += strlen(ctrlNames[i]) + 1;
+ if (format == XkbCFile)
+ len += 7;
+ }
}
- buf= tbGetBuffer(len+1);
- tmp= ctrls&XkbAllBooleanCtrlsMask;
- for (len=i=0,bit=1;tmp!=0;i++,bit<<=1) {
- if (tmp&bit) {
- tmp&= ~bit;
- if (format==XkbCFile) {
- if (len!=0)
- buf[len++]= '|';
- sprintf(&buf[len],"Xkb%sMask",ctrlNames[i]);
- buf[len+3]= toupper(buf[len+3]);
- }
- else {
- if (len!=0)
- buf[len++]= '+';
- sprintf(&buf[len],"%s",ctrlNames[i]);
- }
- len+= strlen(&buf[len]);
- }
+ buf = tbGetBuffer(len + 1);
+ tmp = ctrls & XkbAllBooleanCtrlsMask;
+ for (len = i = 0, bit = 1; tmp != 0; i++, bit <<= 1) {
+ if (tmp & bit) {
+ tmp &= ~bit;
+ if (format == XkbCFile) {
+ if (len != 0)
+ buf[len++] = '|';
+ sprintf(&buf[len], "Xkb%sMask", ctrlNames[i]);
+ buf[len + 3] = toupper(buf[len + 3]);
+ }
+ else {
+ if (len != 0)
+ buf[len++] = '+';
+ sprintf(&buf[len], "%s", ctrlNames[i]);
+ }
+ len += strlen(&buf[len]);
+ }
}
return buf;
}
@@ -512,700 +546,763 @@ char * buf;
/***====================================================================***/
char *
-XkbStringText(char *str,unsigned format)
+XkbStringText(char *str, unsigned format)
{
-char * buf;
-register char *in,*out;
-int len;
-Bool ok;
-
- if (str==NULL) {
- buf= tbGetBuffer(2);
- buf[0]='\0';
- return buf;
+ char *buf;
+ register char *in, *out;
+ int len;
+ Bool ok;
+
+ if (str == NULL) {
+ buf = tbGetBuffer(2);
+ buf[0] = '\0';
+ return buf;
}
- else if (format==XkbXKMFile)
- return str;
- for (ok= TRUE,len=0,in=str;*in!='\0';in++,len++) {
- if (!isprint(*in)) {
- ok= FALSE;
- switch (*in) {
- case '\n': case '\t': case '\v':
- case '\b': case '\r': case '\f':
- len++;
- break;
- default:
- len+= 4;
- break;
- }
- }
+ else if (format == XkbXKMFile)
+ return str;
+ for (ok = TRUE, len = 0, in = str; *in != '\0'; in++, len++) {
+ if (!isprint(*in)) {
+ ok = FALSE;
+ switch (*in) {
+ case '\n':
+ case '\t':
+ case '\v':
+ case '\b':
+ case '\r':
+ case '\f':
+ len++;
+ break;
+ default:
+ len += 4;
+ break;
+ }
+ }
}
if (ok)
- return str;
- buf= tbGetBuffer(len+1);
- for (in=str,out=buf;*in!='\0';in++) {
- if (isprint(*in))
- *out++= *in;
- else {
- *out++= '\\';
- if (*in=='\n') *out++= 'n';
- else if (*in=='\t') *out++= 't';
- else if (*in=='\v') *out++= 'v';
- else if (*in=='\b') *out++= 'b';
- else if (*in=='\r') *out++= 'r';
- else if (*in=='\f') *out++= 'f';
- else if ((*in=='\033')&&(format==XkbXKMFile)) {
- *out++= 'e';
- }
- else {
- *out++= '0';
- sprintf(out,"%o",*in);
- while (*out!='\0')
- out++;
- }
- }
+ return str;
+ buf = tbGetBuffer(len + 1);
+ for (in = str, out = buf; *in != '\0'; in++) {
+ if (isprint(*in))
+ *out++ = *in;
+ else {
+ *out++ = '\\';
+ if (*in == '\n')
+ *out++ = 'n';
+ else if (*in == '\t')
+ *out++ = 't';
+ else if (*in == '\v')
+ *out++ = 'v';
+ else if (*in == '\b')
+ *out++ = 'b';
+ else if (*in == '\r')
+ *out++ = 'r';
+ else if (*in == '\f')
+ *out++ = 'f';
+ else if ((*in == '\033') && (format == XkbXKMFile)) {
+ *out++ = 'e';
+ }
+ else {
+ *out++ = '0';
+ sprintf(out, "%o", *in);
+ while (*out != '\0')
+ out++;
+ }
+ }
}
- *out++= '\0';
+ *out++ = '\0';
return buf;
}
/***====================================================================***/
char *
-XkbGeomFPText(int val,unsigned format)
+XkbGeomFPText(int val, unsigned format)
{
-int whole,frac;
-char * buf;
+ int whole, frac;
+ char *buf;
- buf= tbGetBuffer(12);
- if (format==XkbCFile) {
- sprintf(buf,"%d",val);
+ buf = tbGetBuffer(12);
+ if (format == XkbCFile) {
+ sprintf(buf, "%d", val);
}
else {
- whole= val/XkbGeomPtsPerMM;
- frac= val%XkbGeomPtsPerMM;
- if (frac!=0)
- sprintf(buf,"%d.%d",whole,frac);
- else sprintf(buf,"%d",whole);
+ whole = val / XkbGeomPtsPerMM;
+ frac = val % XkbGeomPtsPerMM;
+ if (frac != 0)
+ sprintf(buf, "%d.%d", whole, frac);
+ else
+ sprintf(buf, "%d", whole);
}
return buf;
}
char *
-XkbDoodadTypeText(unsigned type,unsigned format)
+XkbDoodadTypeText(unsigned type, unsigned format)
{
-char * buf;
- if (format==XkbCFile) {
- buf= tbGetBuffer(24);
- if (type==XkbOutlineDoodad) strcpy(buf,"XkbOutlineDoodad");
- else if (type==XkbSolidDoodad) strcpy(buf,"XkbSolidDoodad");
- else if (type==XkbTextDoodad) strcpy(buf,"XkbTextDoodad");
- else if (type==XkbIndicatorDoodad) strcpy(buf,"XkbIndicatorDoodad");
- else if (type==XkbLogoDoodad) strcpy(buf,"XkbLogoDoodad");
- else sprintf(buf,"UnknownDoodad%d",type);
+ char *buf;
+
+ if (format == XkbCFile) {
+ buf = tbGetBuffer(24);
+ if (type == XkbOutlineDoodad)
+ strcpy(buf, "XkbOutlineDoodad");
+ else if (type == XkbSolidDoodad)
+ strcpy(buf, "XkbSolidDoodad");
+ else if (type == XkbTextDoodad)
+ strcpy(buf, "XkbTextDoodad");
+ else if (type == XkbIndicatorDoodad)
+ strcpy(buf, "XkbIndicatorDoodad");
+ else if (type == XkbLogoDoodad)
+ strcpy(buf, "XkbLogoDoodad");
+ else
+ sprintf(buf, "UnknownDoodad%d", type);
}
else {
- buf= tbGetBuffer(12);
- if (type==XkbOutlineDoodad) strcpy(buf,"outline");
- else if (type==XkbSolidDoodad) strcpy(buf,"solid");
- else if (type==XkbTextDoodad) strcpy(buf,"text");
- else if (type==XkbIndicatorDoodad) strcpy(buf,"indicator");
- else if (type==XkbLogoDoodad) strcpy(buf,"logo");
- else sprintf(buf,"unknown%d",type);
+ buf = tbGetBuffer(12);
+ if (type == XkbOutlineDoodad)
+ strcpy(buf, "outline");
+ else if (type == XkbSolidDoodad)
+ strcpy(buf, "solid");
+ else if (type == XkbTextDoodad)
+ strcpy(buf, "text");
+ else if (type == XkbIndicatorDoodad)
+ strcpy(buf, "indicator");
+ else if (type == XkbLogoDoodad)
+ strcpy(buf, "logo");
+ else
+ sprintf(buf, "unknown%d", type);
}
return buf;
}
-static const char *actionTypeNames[XkbSA_NumActions]= {
- "NoAction",
- "SetMods", "LatchMods", "LockMods",
- "SetGroup", "LatchGroup", "LockGroup",
+static const char *actionTypeNames[XkbSA_NumActions] = {
+ "NoAction",
+ "SetMods", "LatchMods", "LockMods",
+ "SetGroup", "LatchGroup", "LockGroup",
"MovePtr",
- "PtrBtn", "LockPtrBtn",
+ "PtrBtn", "LockPtrBtn",
"SetPtrDflt",
"ISOLock",
- "Terminate", "SwitchScreen",
- "SetControls", "LockControls",
+ "Terminate", "SwitchScreen",
+ "SetControls", "LockControls",
"ActionMessage",
"RedirectKey",
- "DeviceBtn", "LockDeviceBtn"
+ "DeviceBtn", "LockDeviceBtn"
};
const char *
-XkbActionTypeText(unsigned type,unsigned format)
+XkbActionTypeText(unsigned type, unsigned format)
{
-static char buf[32];
-const char *rtrn;
-
- if (type<=XkbSA_LastAction) {
- rtrn= actionTypeNames[type];
- if (format==XkbCFile) {
- snprintf(buf,sizeof(buf),"XkbSA_%s",rtrn);
- return buf;
- }
- return rtrn;
+ static char buf[32];
+ const char *rtrn;
+
+ if (type <= XkbSA_LastAction) {
+ rtrn = actionTypeNames[type];
+ if (format == XkbCFile) {
+ snprintf(buf, sizeof(buf), "XkbSA_%s", rtrn);
+ return buf;
+ }
+ return rtrn;
}
- snprintf(buf,sizeof(buf),"Private");
+ snprintf(buf, sizeof(buf), "Private");
return buf;
}
/***====================================================================***/
static int
-TryCopyStr(char *to,const char *from,int *pLeft)
+TryCopyStr(char *to, const char *from, int *pLeft)
{
-register int len;
- if (*pLeft>0) {
- len= strlen(from);
- if (len<((*pLeft)-3)) {
- strcat(to,from);
- *pLeft-= len;
- return TRUE;
- }
+ register int len;
+
+ if (*pLeft > 0) {
+ len = strlen(from);
+ if (len < ((*pLeft) - 3)) {
+ strcat(to, from);
+ *pLeft -= len;
+ return TRUE;
+ }
}
- *pLeft= -1;
+ *pLeft = -1;
return FALSE;
}
-/*ARGSUSED*/
-static Bool
-CopyNoActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int*sz)
+ /*ARGSUSED*/ static Bool
+CopyNoActionArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
return TRUE;
}
static Bool
-CopyModActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
- int* sz)
+CopyModActionArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbModAction * act;
-unsigned tmp;
-
- act= &action->mods;
- tmp= XkbModActionVMods(act);
- TryCopyStr(buf,"modifiers=",sz);
- if (act->flags&XkbSA_UseModMapMods)
- TryCopyStr(buf,"modMapMods",sz);
+ XkbModAction *act;
+ unsigned tmp;
+
+ act = &action->mods;
+ tmp = XkbModActionVMods(act);
+ TryCopyStr(buf, "modifiers=", sz);
+ if (act->flags & XkbSA_UseModMapMods)
+ TryCopyStr(buf, "modMapMods", sz);
else if (act->real_mods || tmp) {
- TryCopyStr(buf,
- XkbVModMaskText(xkb,act->real_mods,tmp,XkbXKBFile),
- sz);
+ TryCopyStr(buf,
+ XkbVModMaskText(xkb, act->real_mods, tmp, XkbXKBFile), sz);
}
- else TryCopyStr(buf,"none",sz);
- if (act->type==XkbSA_LockMods)
- return TRUE;
- if (act->flags&XkbSA_ClearLocks)
- TryCopyStr(buf,",clearLocks",sz);
- if (act->flags&XkbSA_LatchToLock)
- TryCopyStr(buf,",latchToLock",sz);
+ else
+ TryCopyStr(buf, "none", sz);
+ if (act->type == XkbSA_LockMods)
+ return TRUE;
+ if (act->flags & XkbSA_ClearLocks)
+ TryCopyStr(buf, ",clearLocks", sz);
+ if (act->flags & XkbSA_LatchToLock)
+ TryCopyStr(buf, ",latchToLock", sz);
return TRUE;
}
-/*ARGSUSED*/
-static Bool
-CopyGroupActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
- int *sz)
+ /*ARGSUSED*/ static Bool
+CopyGroupActionArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbGroupAction * act;
-char tbuf[32];
-
- act= &action->group;
- TryCopyStr(buf,"group=",sz);
- if (act->flags&XkbSA_GroupAbsolute)
- snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act)+1);
- else if (XkbSAGroup(act)<0)
- snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act));
- else snprintf(tbuf,sizeof(tbuf),"+%d",XkbSAGroup(act));
- TryCopyStr(buf,tbuf,sz);
- if (act->type==XkbSA_LockGroup)
- return TRUE;
- if (act->flags&XkbSA_ClearLocks)
- TryCopyStr(buf,",clearLocks",sz);
- if (act->flags&XkbSA_LatchToLock)
- TryCopyStr(buf,",latchToLock",sz);
+ XkbGroupAction *act;
+ char tbuf[32];
+
+ act = &action->group;
+ TryCopyStr(buf, "group=", sz);
+ if (act->flags & XkbSA_GroupAbsolute)
+ snprintf(tbuf, sizeof(tbuf), "%d", XkbSAGroup(act) + 1);
+ else if (XkbSAGroup(act) < 0)
+ snprintf(tbuf, sizeof(tbuf), "%d", XkbSAGroup(act));
+ else
+ snprintf(tbuf, sizeof(tbuf), "+%d", XkbSAGroup(act));
+ TryCopyStr(buf, tbuf, sz);
+ if (act->type == XkbSA_LockGroup)
+ return TRUE;
+ if (act->flags & XkbSA_ClearLocks)
+ TryCopyStr(buf, ",clearLocks", sz);
+ if (act->flags & XkbSA_LatchToLock)
+ TryCopyStr(buf, ",latchToLock", sz);
return TRUE;
}
-/*ARGSUSED*/
-static Bool
-CopyMovePtrArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+ /*ARGSUSED*/ static Bool
+CopyMovePtrArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbPtrAction * act;
-int x,y;
-char tbuf[32];
-
- act= &action->ptr;
- x= XkbPtrActionX(act);
- y= XkbPtrActionY(act);
- if ((act->flags&XkbSA_MoveAbsoluteX)||(x<0))
- snprintf(tbuf,sizeof(tbuf),"x=%d",x);
- else snprintf(tbuf,sizeof(tbuf),"x=+%d",x);
- TryCopyStr(buf,tbuf,sz);
-
- if ((act->flags&XkbSA_MoveAbsoluteY)||(y<0))
- snprintf(tbuf,sizeof(tbuf),",y=%d",y);
- else snprintf(tbuf,sizeof(tbuf),",y=+%d",y);
- TryCopyStr(buf,tbuf,sz);
- if (act->flags&XkbSA_NoAcceleration)
- TryCopyStr(buf,",!accel",sz);
+ XkbPtrAction *act;
+ int x, y;
+ char tbuf[32];
+
+ act = &action->ptr;
+ x = XkbPtrActionX(act);
+ y = XkbPtrActionY(act);
+ if ((act->flags & XkbSA_MoveAbsoluteX) || (x < 0))
+ snprintf(tbuf, sizeof(tbuf), "x=%d", x);
+ else
+ snprintf(tbuf, sizeof(tbuf), "x=+%d", x);
+ TryCopyStr(buf, tbuf, sz);
+
+ if ((act->flags & XkbSA_MoveAbsoluteY) || (y < 0))
+ snprintf(tbuf, sizeof(tbuf), ",y=%d", y);
+ else
+ snprintf(tbuf, sizeof(tbuf), ",y=+%d", y);
+ TryCopyStr(buf, tbuf, sz);
+ if (act->flags & XkbSA_NoAcceleration)
+ TryCopyStr(buf, ",!accel", sz);
return TRUE;
}
-/*ARGSUSED*/
-static Bool
-CopyPtrBtnArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+ /*ARGSUSED*/ static Bool
+CopyPtrBtnArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbPtrBtnAction * act;
-char tbuf[32];
-
- act= &action->btn;
- TryCopyStr(buf,"button=",sz);
- if ((act->button>0)&&(act->button<6)) {
- snprintf(tbuf,sizeof(tbuf),"%d",act->button);
- TryCopyStr(buf,tbuf,sz);
+ XkbPtrBtnAction *act;
+ char tbuf[32];
+
+ act = &action->btn;
+ TryCopyStr(buf, "button=", sz);
+ if ((act->button > 0) && (act->button < 6)) {
+ snprintf(tbuf, sizeof(tbuf), "%d", act->button);
+ TryCopyStr(buf, tbuf, sz);
}
- else TryCopyStr(buf,"default",sz);
- if (act->count>0) {
- snprintf(tbuf,sizeof(tbuf),",count=%d",act->count);
- TryCopyStr(buf,tbuf,sz);
+ else
+ TryCopyStr(buf, "default", sz);
+ if (act->count > 0) {
+ snprintf(tbuf, sizeof(tbuf), ",count=%d", act->count);
+ TryCopyStr(buf, tbuf, sz);
}
- if (action->type==XkbSA_LockPtrBtn) {
- switch (act->flags&(XkbSA_LockNoUnlock|XkbSA_LockNoLock)) {
- case XkbSA_LockNoLock:
- TryCopyStr(buf,",affect=unlock",sz); break;
- case XkbSA_LockNoUnlock:
- TryCopyStr(buf,",affect=lock",sz); break;
- case XkbSA_LockNoUnlock|XkbSA_LockNoLock:
- TryCopyStr(buf,",affect=neither",sz); break;
- default:
- TryCopyStr(buf,",affect=both",sz); break;
- }
+ if (action->type == XkbSA_LockPtrBtn) {
+ switch (act->flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
+ case XkbSA_LockNoLock:
+ TryCopyStr(buf, ",affect=unlock", sz);
+ break;
+ case XkbSA_LockNoUnlock:
+ TryCopyStr(buf, ",affect=lock", sz);
+ break;
+ case XkbSA_LockNoUnlock | XkbSA_LockNoLock:
+ TryCopyStr(buf, ",affect=neither", sz);
+ break;
+ default:
+ TryCopyStr(buf, ",affect=both", sz);
+ break;
+ }
}
return TRUE;
}
-/*ARGSUSED*/
-static Bool
-CopySetPtrDfltArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
- int *sz)
+ /*ARGSUSED*/ static Bool
+CopySetPtrDfltArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbPtrDfltAction * act;
-char tbuf[32];
-
- act= &action->dflt;
- if (act->affect==XkbSA_AffectDfltBtn) {
- TryCopyStr(buf,"affect=button,button=",sz);
- if ((act->flags&XkbSA_DfltBtnAbsolute)||(XkbSAPtrDfltValue(act)<0))
- snprintf(tbuf,sizeof(tbuf),"%d",XkbSAPtrDfltValue(act));
- else snprintf(tbuf,sizeof(tbuf),"+%d",XkbSAPtrDfltValue(act));
- TryCopyStr(buf,tbuf,sz);
+ XkbPtrDfltAction *act;
+ char tbuf[32];
+
+ act = &action->dflt;
+ if (act->affect == XkbSA_AffectDfltBtn) {
+ TryCopyStr(buf, "affect=button,button=", sz);
+ if ((act->flags & XkbSA_DfltBtnAbsolute) ||
+ (XkbSAPtrDfltValue(act) < 0))
+ snprintf(tbuf, sizeof(tbuf), "%d", XkbSAPtrDfltValue(act));
+ else
+ snprintf(tbuf, sizeof(tbuf), "+%d", XkbSAPtrDfltValue(act));
+ TryCopyStr(buf, tbuf, sz);
}
return TRUE;
}
static Bool
-CopyISOLockArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+CopyISOLockArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbISOAction * act;
-char tbuf[64];
-
- act= &action->iso;
- if (act->flags&XkbSA_ISODfltIsGroup) {
- TryCopyStr(tbuf,"group=",sz);
- if (act->flags&XkbSA_GroupAbsolute)
- snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act)+1);
- else if (XkbSAGroup(act)<0)
- snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act));
- else snprintf(tbuf,sizeof(tbuf),"+%d",XkbSAGroup(act));
- TryCopyStr(buf,tbuf,sz);
+ XkbISOAction *act;
+ char tbuf[64];
+
+ act = &action->iso;
+ if (act->flags & XkbSA_ISODfltIsGroup) {
+ TryCopyStr(tbuf, "group=", sz);
+ if (act->flags & XkbSA_GroupAbsolute)
+ snprintf(tbuf, sizeof(tbuf), "%d", XkbSAGroup(act) + 1);
+ else if (XkbSAGroup(act) < 0)
+ snprintf(tbuf, sizeof(tbuf), "%d", XkbSAGroup(act));
+ else
+ snprintf(tbuf, sizeof(tbuf), "+%d", XkbSAGroup(act));
+ TryCopyStr(buf, tbuf, sz);
}
else {
- unsigned tmp;
- tmp= XkbModActionVMods(act);
- TryCopyStr(buf,"modifiers=",sz);
- if (act->flags&XkbSA_UseModMapMods)
- TryCopyStr(buf,"modMapMods",sz);
- else if (act->real_mods || tmp) {
- if (act->real_mods) {
- TryCopyStr(buf,XkbModMaskText(act->real_mods,XkbXKBFile),sz);
- if (tmp)
- TryCopyStr(buf,"+",sz);
- }
- if (tmp)
- TryCopyStr(buf,XkbVModMaskText(xkb,0,tmp,XkbXKBFile),sz);
- }
- else TryCopyStr(buf,"none",sz);
+ unsigned tmp;
+
+ tmp = XkbModActionVMods(act);
+ TryCopyStr(buf, "modifiers=", sz);
+ if (act->flags & XkbSA_UseModMapMods)
+ TryCopyStr(buf, "modMapMods", sz);
+ else if (act->real_mods || tmp) {
+ if (act->real_mods) {
+ TryCopyStr(buf, XkbModMaskText(act->real_mods, XkbXKBFile), sz);
+ if (tmp)
+ TryCopyStr(buf, "+", sz);
+ }
+ if (tmp)
+ TryCopyStr(buf, XkbVModMaskText(xkb, 0, tmp, XkbXKBFile), sz);
+ }
+ else
+ TryCopyStr(buf, "none", sz);
}
- TryCopyStr(buf,",affect=",sz);
- if ((act->affect&XkbSA_ISOAffectMask)==0)
- TryCopyStr(buf,"all",sz);
+ TryCopyStr(buf, ",affect=", sz);
+ if ((act->affect & XkbSA_ISOAffectMask) == 0)
+ TryCopyStr(buf, "all", sz);
else {
- int nOut= 0;
- if ((act->affect&XkbSA_ISONoAffectMods)==0) {
- TryCopyStr(buf,"mods",sz);
- nOut++;
- }
- if ((act->affect&XkbSA_ISONoAffectGroup)==0) {
- snprintf(tbuf,sizeof(tbuf),"%sgroups",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if ((act->affect&XkbSA_ISONoAffectPtr)==0) {
- snprintf(tbuf,sizeof(tbuf),"%spointer",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if ((act->affect&XkbSA_ISONoAffectCtrls)==0) {
- snprintf(tbuf,sizeof(tbuf),"%scontrols",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
+ int nOut = 0;
+
+ if ((act->affect & XkbSA_ISONoAffectMods) == 0) {
+ TryCopyStr(buf, "mods", sz);
+ nOut++;
+ }
+ if ((act->affect & XkbSA_ISONoAffectGroup) == 0) {
+ snprintf(tbuf, sizeof(tbuf), "%sgroups", (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if ((act->affect & XkbSA_ISONoAffectPtr) == 0) {
+ snprintf(tbuf, sizeof(tbuf), "%spointer", (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if ((act->affect & XkbSA_ISONoAffectCtrls) == 0) {
+ snprintf(tbuf, sizeof(tbuf), "%scontrols", (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
}
return TRUE;
}
-/*ARGSUSED*/
-static Bool
-CopySwitchScreenArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
- int *sz)
+ /*ARGSUSED*/ static Bool
+CopySwitchScreenArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbSwitchScreenAction * act;
-char tbuf[32];
-
- act= &action->screen;
- if ((act->flags&XkbSA_SwitchAbsolute)||(XkbSAScreen(act)<0))
- snprintf(tbuf,sizeof(tbuf),"screen=%d",XkbSAScreen(act));
- else snprintf(tbuf,sizeof(tbuf),"screen=+%d",XkbSAScreen(act));
- TryCopyStr(buf,tbuf,sz);
- if (act->flags&XkbSA_SwitchApplication)
- TryCopyStr(buf,",!same",sz);
- else TryCopyStr(buf,",same",sz);
+ XkbSwitchScreenAction *act;
+ char tbuf[32];
+
+ act = &action->screen;
+ if ((act->flags & XkbSA_SwitchAbsolute) || (XkbSAScreen(act) < 0))
+ snprintf(tbuf, sizeof(tbuf), "screen=%d", XkbSAScreen(act));
+ else
+ snprintf(tbuf, sizeof(tbuf), "screen=+%d", XkbSAScreen(act));
+ TryCopyStr(buf, tbuf, sz);
+ if (act->flags & XkbSA_SwitchApplication)
+ TryCopyStr(buf, ",!same", sz);
+ else
+ TryCopyStr(buf, ",same", sz);
return TRUE;
}
-/*ARGSUSED*/
-static Bool
-CopySetLockControlsArgs(XkbDescPtr xkb,XkbAction *action,
- char *buf,int *sz)
+ /*ARGSUSED*/ static Bool
+CopySetLockControlsArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbCtrlsAction * act;
-unsigned tmp;
-char tbuf[32];
-
- act= &action->ctrls;
- tmp= XkbActionCtrls(act);
- TryCopyStr(buf,"controls=",sz);
- if (tmp==0)
- TryCopyStr(buf,"none",sz);
- else if ((tmp&XkbAllBooleanCtrlsMask)==XkbAllBooleanCtrlsMask)
- TryCopyStr(buf,"all",sz);
+ XkbCtrlsAction *act;
+ unsigned tmp;
+ char tbuf[32];
+
+ act = &action->ctrls;
+ tmp = XkbActionCtrls(act);
+ TryCopyStr(buf, "controls=", sz);
+ if (tmp == 0)
+ TryCopyStr(buf, "none", sz);
+ else if ((tmp & XkbAllBooleanCtrlsMask) == XkbAllBooleanCtrlsMask)
+ TryCopyStr(buf, "all", sz);
else {
- int nOut= 0;
- if (tmp&XkbRepeatKeysMask) {
- snprintf(tbuf,sizeof(tbuf),"%sRepeatKeys",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbSlowKeysMask) {
- snprintf(tbuf,sizeof(tbuf),"%sSlowKeys",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbBounceKeysMask) {
- snprintf(tbuf,sizeof(tbuf),"%sBounceKeys",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbStickyKeysMask) {
- snprintf(tbuf,sizeof(tbuf),"%sStickyKeys",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbMouseKeysMask) {
- snprintf(tbuf,sizeof(tbuf),"%sMouseKeys",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbMouseKeysAccelMask) {
- snprintf(tbuf,sizeof(tbuf),"%sMouseKeysAccel",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbAccessXKeysMask) {
- snprintf(tbuf,sizeof(tbuf),"%sAccessXKeys",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbAccessXTimeoutMask) {
- snprintf(tbuf,sizeof(tbuf),"%sAccessXTimeout",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbAccessXFeedbackMask) {
- snprintf(tbuf,sizeof(tbuf),"%sAccessXFeedback",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbAudibleBellMask) {
- snprintf(tbuf,sizeof(tbuf),"%sAudibleBell",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbOverlay1Mask) {
- snprintf(tbuf,sizeof(tbuf),"%sOverlay1",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbOverlay2Mask) {
- snprintf(tbuf,sizeof(tbuf),"%sOverlay2",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
- if (tmp&XkbIgnoreGroupLockMask) {
- snprintf(tbuf,sizeof(tbuf),"%sIgnoreGroupLock",(nOut>0?"+":""));
- TryCopyStr(buf,tbuf,sz);
- nOut++;
- }
+ int nOut = 0;
+
+ if (tmp & XkbRepeatKeysMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sRepeatKeys", (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbSlowKeysMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sSlowKeys", (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbBounceKeysMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sBounceKeys", (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbStickyKeysMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sStickyKeys", (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbMouseKeysMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sMouseKeys", (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbMouseKeysAccelMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sMouseKeysAccel",
+ (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbAccessXKeysMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sAccessXKeys",
+ (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbAccessXTimeoutMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sAccessXTimeout",
+ (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbAccessXFeedbackMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sAccessXFeedback",
+ (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbAudibleBellMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sAudibleBell",
+ (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbOverlay1Mask) {
+ snprintf(tbuf, sizeof(tbuf), "%sOverlay1", (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbOverlay2Mask) {
+ snprintf(tbuf, sizeof(tbuf), "%sOverlay2", (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
+ if (tmp & XkbIgnoreGroupLockMask) {
+ snprintf(tbuf, sizeof(tbuf), "%sIgnoreGroupLock",
+ (nOut > 0 ? "+" : ""));
+ TryCopyStr(buf, tbuf, sz);
+ nOut++;
+ }
}
return TRUE;
}
-/*ARGSUSED*/
-static Bool
-CopyActionMessageArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
- int *sz)
+ /*ARGSUSED*/ static Bool
+CopyActionMessageArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbMessageAction * act;
-unsigned all;
-char tbuf[32];
-
- act= &action->msg;
- all= XkbSA_MessageOnPress|XkbSA_MessageOnRelease;
- TryCopyStr(buf,"report=",sz);
- if ((act->flags&all)==0)
- TryCopyStr(buf,"none",sz);
- else if ((act->flags&all)==all)
- TryCopyStr(buf,"all",sz);
- else if (act->flags&XkbSA_MessageOnPress)
- TryCopyStr(buf,"KeyPress",sz);
- else TryCopyStr(buf,"KeyRelease",sz);
- snprintf(tbuf,sizeof(tbuf),",data[0]=0x%02x",act->message[0]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[1]=0x%02x",act->message[1]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[2]=0x%02x",act->message[2]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[3]=0x%02x",act->message[3]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[4]=0x%02x",act->message[4]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[5]=0x%02x",act->message[5]); TryCopyStr(buf,tbuf,sz);
+ XkbMessageAction *act;
+ unsigned all;
+ char tbuf[32];
+
+ act = &action->msg;
+ all = XkbSA_MessageOnPress | XkbSA_MessageOnRelease;
+ TryCopyStr(buf, "report=", sz);
+ if ((act->flags & all) == 0)
+ TryCopyStr(buf, "none", sz);
+ else if ((act->flags & all) == all)
+ TryCopyStr(buf, "all", sz);
+ else if (act->flags & XkbSA_MessageOnPress)
+ TryCopyStr(buf, "KeyPress", sz);
+ else
+ TryCopyStr(buf, "KeyRelease", sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[0]=0x%02x", act->message[0]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[1]=0x%02x", act->message[1]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[2]=0x%02x", act->message[2]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[3]=0x%02x", act->message[3]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[4]=0x%02x", act->message[4]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[5]=0x%02x", act->message[5]);
+ TryCopyStr(buf, tbuf, sz);
return TRUE;
}
static Bool
-CopyRedirectKeyArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
- int *sz)
+CopyRedirectKeyArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbRedirectKeyAction * act;
-char tbuf[32],*tmp;
-unsigned kc;
-unsigned vmods,vmods_mask;
-
- act= &action->redirect;
- kc= act->new_key;
- vmods= XkbSARedirectVMods(act);
- vmods_mask= XkbSARedirectVModsMask(act);
- if (xkb && xkb->names && xkb->names->keys && (kc<=xkb->max_key_code) &&
- (xkb->names->keys[kc].name[0]!='\0')) {
- char *kn;
- kn= XkbKeyNameText(xkb->names->keys[kc].name,XkbXKBFile);
- snprintf(tbuf,sizeof(tbuf),"key=%s",kn);
+ XkbRedirectKeyAction *act;
+ char tbuf[32], *tmp;
+ unsigned kc;
+ unsigned vmods, vmods_mask;
+
+ act = &action->redirect;
+ kc = act->new_key;
+ vmods = XkbSARedirectVMods(act);
+ vmods_mask = XkbSARedirectVModsMask(act);
+ if (xkb && xkb->names && xkb->names->keys && (kc <= xkb->max_key_code) &&
+ (xkb->names->keys[kc].name[0] != '\0')) {
+ char *kn;
+
+ kn = XkbKeyNameText(xkb->names->keys[kc].name, XkbXKBFile);
+ snprintf(tbuf, sizeof(tbuf), "key=%s", kn);
}
- else snprintf(tbuf,sizeof(tbuf),"key=%d",kc);
- TryCopyStr(buf,tbuf,sz);
- if ((act->mods_mask==0)&&(vmods_mask==0))
- return TRUE;
- if ((act->mods_mask==XkbAllModifiersMask)&&
- (vmods_mask==XkbAllVirtualModsMask)) {
- tmp= XkbVModMaskText(xkb,act->mods,vmods,XkbXKBFile);
- TryCopyStr(buf,",mods=",sz);
- TryCopyStr(buf,tmp,sz);
+ else
+ snprintf(tbuf, sizeof(tbuf), "key=%d", kc);
+ TryCopyStr(buf, tbuf, sz);
+ if ((act->mods_mask == 0) && (vmods_mask == 0))
+ return TRUE;
+ if ((act->mods_mask == XkbAllModifiersMask) &&
+ (vmods_mask == XkbAllVirtualModsMask)) {
+ tmp = XkbVModMaskText(xkb, act->mods, vmods, XkbXKBFile);
+ TryCopyStr(buf, ",mods=", sz);
+ TryCopyStr(buf, tmp, sz);
}
else {
- if ((act->mods_mask&act->mods)||(vmods_mask&vmods)) {
- tmp= XkbVModMaskText(xkb,act->mods_mask&act->mods,
- vmods_mask&vmods,XkbXKBFile);
- TryCopyStr(buf,",mods= ",sz);
- TryCopyStr(buf,tmp,sz);
- }
- if ((act->mods_mask&(~act->mods))||(vmods_mask&(~vmods))) {
- tmp= XkbVModMaskText(xkb,act->mods_mask&(~act->mods),
- vmods_mask&(~vmods),XkbXKBFile);
- TryCopyStr(buf,",clearMods= ",sz);
- TryCopyStr(buf,tmp,sz);
- }
+ if ((act->mods_mask & act->mods) || (vmods_mask & vmods)) {
+ tmp = XkbVModMaskText(xkb, act->mods_mask & act->mods,
+ vmods_mask & vmods, XkbXKBFile);
+ TryCopyStr(buf, ",mods= ", sz);
+ TryCopyStr(buf, tmp, sz);
+ }
+ if ((act->mods_mask & (~act->mods)) || (vmods_mask & (~vmods))) {
+ tmp = XkbVModMaskText(xkb, act->mods_mask & (~act->mods),
+ vmods_mask & (~vmods), XkbXKBFile);
+ TryCopyStr(buf, ",clearMods= ", sz);
+ TryCopyStr(buf, tmp, sz);
+ }
}
return TRUE;
}
-/*ARGSUSED*/
-static Bool
-CopyDeviceBtnArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
- int *sz)
+ /*ARGSUSED*/ static Bool
+CopyDeviceBtnArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbDeviceBtnAction * act;
-char tbuf[32];
-
- act= &action->devbtn;
- snprintf(tbuf,sizeof(tbuf),"device= %d",act->device); TryCopyStr(buf,tbuf,sz);
- TryCopyStr(buf,",button=",sz);
- snprintf(tbuf,sizeof(tbuf),"%d",act->button);
- TryCopyStr(buf,tbuf,sz);
- if (act->count>0) {
- snprintf(tbuf,sizeof(tbuf),",count=%d",act->count);
- TryCopyStr(buf,tbuf,sz);
+ XkbDeviceBtnAction *act;
+ char tbuf[32];
+
+ act = &action->devbtn;
+ snprintf(tbuf, sizeof(tbuf), "device= %d", act->device);
+ TryCopyStr(buf, tbuf, sz);
+ TryCopyStr(buf, ",button=", sz);
+ snprintf(tbuf, sizeof(tbuf), "%d", act->button);
+ TryCopyStr(buf, tbuf, sz);
+ if (act->count > 0) {
+ snprintf(tbuf, sizeof(tbuf), ",count=%d", act->count);
+ TryCopyStr(buf, tbuf, sz);
}
- if (action->type==XkbSA_LockDeviceBtn) {
- switch (act->flags&(XkbSA_LockNoUnlock|XkbSA_LockNoLock)) {
- case XkbSA_LockNoLock:
- TryCopyStr(buf,",affect=unlock",sz); break;
- case XkbSA_LockNoUnlock:
- TryCopyStr(buf,",affect=lock",sz); break;
- case XkbSA_LockNoUnlock|XkbSA_LockNoLock:
- TryCopyStr(buf,",affect=neither",sz); break;
- default:
- TryCopyStr(buf,",affect=both",sz); break;
- }
+ if (action->type == XkbSA_LockDeviceBtn) {
+ switch (act->flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
+ case XkbSA_LockNoLock:
+ TryCopyStr(buf, ",affect=unlock", sz);
+ break;
+ case XkbSA_LockNoUnlock:
+ TryCopyStr(buf, ",affect=lock", sz);
+ break;
+ case XkbSA_LockNoUnlock | XkbSA_LockNoLock:
+ TryCopyStr(buf, ",affect=neither", sz);
+ break;
+ default:
+ TryCopyStr(buf, ",affect=both", sz);
+ break;
+ }
}
return TRUE;
}
-/*ARGSUSED*/
-static Bool
-CopyOtherArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+ /*ARGSUSED*/ static Bool
+CopyOtherArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
{
-XkbAnyAction * act;
-char tbuf[32];
-
- act= &action->any;
- snprintf(tbuf,sizeof(tbuf),"type=0x%02x",act->type); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[0]=0x%02x",act->data[0]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[1]=0x%02x",act->data[1]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[2]=0x%02x",act->data[2]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[3]=0x%02x",act->data[3]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[4]=0x%02x",act->data[4]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[5]=0x%02x",act->data[5]); TryCopyStr(buf,tbuf,sz);
- snprintf(tbuf,sizeof(tbuf),",data[6]=0x%02x",act->data[6]); TryCopyStr(buf,tbuf,sz);
+ XkbAnyAction *act;
+ char tbuf[32];
+
+ act = &action->any;
+ snprintf(tbuf, sizeof(tbuf), "type=0x%02x", act->type);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[0]=0x%02x", act->data[0]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[1]=0x%02x", act->data[1]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[2]=0x%02x", act->data[2]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[3]=0x%02x", act->data[3]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[4]=0x%02x", act->data[4]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[5]=0x%02x", act->data[5]);
+ TryCopyStr(buf, tbuf, sz);
+ snprintf(tbuf, sizeof(tbuf), ",data[6]=0x%02x", act->data[6]);
+ TryCopyStr(buf, tbuf, sz);
return TRUE;
}
-typedef Bool (*actionCopy)(
- XkbDescPtr /* xkb */,
- XkbAction * /* action */,
- char * /* buf */,
- int* /* sz */
-);
-static actionCopy copyActionArgs[XkbSA_NumActions] = {
- CopyNoActionArgs /* NoAction */,
- CopyModActionArgs /* SetMods */,
- CopyModActionArgs /* LatchMods */,
- CopyModActionArgs /* LockMods */,
- CopyGroupActionArgs /* SetGroup */,
- CopyGroupActionArgs /* LatchGroup */,
- CopyGroupActionArgs /* LockGroup */,
- CopyMovePtrArgs /* MovePtr */,
- CopyPtrBtnArgs /* PtrBtn */,
- CopyPtrBtnArgs /* LockPtrBtn */,
- CopySetPtrDfltArgs /* SetPtrDflt */,
- CopyISOLockArgs /* ISOLock */,
- CopyNoActionArgs /* Terminate */,
- CopySwitchScreenArgs /* SwitchScreen */,
- CopySetLockControlsArgs /* SetControls */,
- CopySetLockControlsArgs /* LockControls */,
- CopyActionMessageArgs /* ActionMessage*/,
- CopyRedirectKeyArgs /* RedirectKey */,
- CopyDeviceBtnArgs /* DeviceBtn */,
- CopyDeviceBtnArgs /* LockDeviceBtn*/
+typedef Bool (*actionCopy) (XkbDescPtr /* xkb */ ,
+ XkbAction * /* action */ ,
+ char * /* buf */ ,
+ int * /* sz */
+ );
+
+static actionCopy copyActionArgs[XkbSA_NumActions] = {
+ CopyNoActionArgs /* NoAction */ ,
+ CopyModActionArgs /* SetMods */ ,
+ CopyModActionArgs /* LatchMods */ ,
+ CopyModActionArgs /* LockMods */ ,
+ CopyGroupActionArgs /* SetGroup */ ,
+ CopyGroupActionArgs /* LatchGroup */ ,
+ CopyGroupActionArgs /* LockGroup */ ,
+ CopyMovePtrArgs /* MovePtr */ ,
+ CopyPtrBtnArgs /* PtrBtn */ ,
+ CopyPtrBtnArgs /* LockPtrBtn */ ,
+ CopySetPtrDfltArgs /* SetPtrDflt */ ,
+ CopyISOLockArgs /* ISOLock */ ,
+ CopyNoActionArgs /* Terminate */ ,
+ CopySwitchScreenArgs /* SwitchScreen */ ,
+ CopySetLockControlsArgs /* SetControls */ ,
+ CopySetLockControlsArgs /* LockControls */ ,
+ CopyActionMessageArgs /* ActionMessage */ ,
+ CopyRedirectKeyArgs /* RedirectKey */ ,
+ CopyDeviceBtnArgs /* DeviceBtn */ ,
+ CopyDeviceBtnArgs /* LockDeviceBtn */
};
#define ACTION_SZ 256
char *
-XkbActionText(XkbDescPtr xkb,XkbAction *action,unsigned format)
+XkbActionText(XkbDescPtr xkb, XkbAction *action, unsigned format)
{
-char buf[ACTION_SZ],*tmp;
-int sz;
-
- if (format==XkbCFile) {
- snprintf(buf,sizeof(buf),
- "{ %20s, { 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x } }",
- XkbActionTypeText(action->type,XkbCFile),
- action->any.data[0],action->any.data[1],action->any.data[2],
- action->any.data[3],action->any.data[4],action->any.data[5],
- action->any.data[6]);
+ char buf[ACTION_SZ], *tmp;
+ int sz;
+
+ if (format == XkbCFile) {
+ snprintf(buf, sizeof(buf),
+ "{ %20s, { 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x } }",
+ XkbActionTypeText(action->type, XkbCFile),
+ action->any.data[0], action->any.data[1], action->any.data[2],
+ action->any.data[3], action->any.data[4], action->any.data[5],
+ action->any.data[6]);
}
else {
- snprintf(buf,sizeof(buf),"%s(",XkbActionTypeText(action->type,XkbXKBFile));
- sz= ACTION_SZ-strlen(buf)+2; /* room for close paren and NULL */
- if (action->type<(unsigned)XkbSA_NumActions)
- (*copyActionArgs[action->type])(xkb,action,buf,&sz);
- else CopyOtherArgs(xkb,action,buf,&sz);
- TryCopyStr(buf,")",&sz);
+ snprintf(buf, sizeof(buf), "%s(",
+ XkbActionTypeText(action->type, XkbXKBFile));
+ sz = ACTION_SZ - strlen(buf) + 2; /* room for close paren and NULL */
+ if (action->type < (unsigned) XkbSA_NumActions)
+ (*copyActionArgs[action->type]) (xkb, action, buf, &sz);
+ else
+ CopyOtherArgs(xkb, action, buf, &sz);
+ TryCopyStr(buf, ")", &sz);
}
- tmp= tbGetBuffer(strlen(buf)+1);
- if (tmp!=NULL)
- strcpy(tmp,buf);
+ tmp = tbGetBuffer(strlen(buf) + 1);
+ if (tmp != NULL)
+ strcpy(tmp, buf);
return tmp;
}
char *
-XkbBehaviorText(XkbDescPtr xkb,XkbBehavior *behavior,unsigned format)
+XkbBehaviorText(XkbDescPtr xkb, XkbBehavior * behavior, unsigned format)
{
-char buf[256],*tmp;
-
- if (format==XkbCFile) {
- if (behavior->type==XkbKB_Default)
- snprintf(buf,sizeof(buf),"{ 0, 0 }");
- else snprintf(buf,sizeof(buf),"{ %3d, 0x%02x }",behavior->type,behavior->data);
+ char buf[256], *tmp;
+
+ if (format == XkbCFile) {
+ if (behavior->type == XkbKB_Default)
+ snprintf(buf, sizeof(buf), "{ 0, 0 }");
+ else
+ snprintf(buf, sizeof(buf), "{ %3d, 0x%02x }", behavior->type,
+ behavior->data);
}
else {
- unsigned type,permanent;
- type= behavior->type&XkbKB_OpMask;
- permanent=((behavior->type&XkbKB_Permanent)!=0);
-
- if (type==XkbKB_Lock) {
- snprintf(buf,sizeof(buf),"lock= %s",(permanent?"Permanent":"TRUE"));
- }
- else if (type==XkbKB_RadioGroup) {
- int g;
- char *tmp;
- g= ((behavior->data)&(~XkbKB_RGAllowNone))+1;
- if (XkbKB_RGAllowNone&behavior->data) {
- snprintf(buf,sizeof(buf),"allowNone,");
- tmp= &buf[strlen(buf)];
- }
- else tmp= buf;
- if (permanent)
- sprintf(tmp,"permanentRadioGroup= %d",g);
- else sprintf(tmp,"radioGroup= %d",g);
- }
- else if ((type==XkbKB_Overlay1)||(type==XkbKB_Overlay2)) {
- int ndx,kc;
- char *kn;
-
- ndx= ((type==XkbKB_Overlay1)?1:2);
- kc= behavior->data;
- if ((xkb)&&(xkb->names)&&(xkb->names->keys))
- kn= XkbKeyNameText(xkb->names->keys[kc].name,XkbXKBFile);
- else {
- static char tbuf[8];
- snprintf(tbuf,sizeof(tbuf),"%d",kc);
- kn= tbuf;
- }
- if (permanent)
- snprintf(buf,sizeof(buf),"permanentOverlay%d= %s",ndx,kn);
- else snprintf(buf,sizeof(buf),"overlay%d= %s",ndx,kn);
- }
+ unsigned type, permanent;
+
+ type = behavior->type & XkbKB_OpMask;
+ permanent = ((behavior->type & XkbKB_Permanent) != 0);
+
+ if (type == XkbKB_Lock) {
+ snprintf(buf, sizeof(buf), "lock= %s",
+ (permanent ? "Permanent" : "TRUE"));
+ }
+ else if (type == XkbKB_RadioGroup) {
+ int g;
+ char *tmp;
+
+ g = ((behavior->data) & (~XkbKB_RGAllowNone)) + 1;
+ if (XkbKB_RGAllowNone & behavior->data) {
+ snprintf(buf, sizeof(buf), "allowNone,");
+ tmp = &buf[strlen(buf)];
+ }
+ else
+ tmp = buf;
+ if (permanent)
+ sprintf(tmp, "permanentRadioGroup= %d", g);
+ else
+ sprintf(tmp, "radioGroup= %d", g);
+ }
+ else if ((type == XkbKB_Overlay1) || (type == XkbKB_Overlay2)) {
+ int ndx, kc;
+ char *kn;
+
+ ndx = ((type == XkbKB_Overlay1) ? 1 : 2);
+ kc = behavior->data;
+ if ((xkb) && (xkb->names) && (xkb->names->keys))
+ kn = XkbKeyNameText(xkb->names->keys[kc].name, XkbXKBFile);
+ else {
+ static char tbuf[8];
+
+ snprintf(tbuf, sizeof(tbuf), "%d", kc);
+ kn = tbuf;
+ }
+ if (permanent)
+ snprintf(buf, sizeof(buf), "permanentOverlay%d= %s", ndx, kn);
+ else
+ snprintf(buf, sizeof(buf), "overlay%d= %s", ndx, kn);
+ }
}
- tmp= tbGetBuffer(strlen(buf)+1);
- if (tmp!=NULL)
- strcpy(tmp,buf);
+ tmp = tbGetBuffer(strlen(buf) + 1);
+ if (tmp != NULL)
+ strcpy(tmp, buf);
return tmp;
}
@@ -1214,15 +1311,15 @@ char buf[256],*tmp;
char *
XkbIndentText(unsigned size)
{
-static char buf[32];
-register int i;
+ static char buf[32];
+ register int i;
- if (size>31)
- size= 31;
+ if (size > 31)
+ size = 31;
- for (i=0;i<size;i++) {
- buf[i]= ' ';
+ for (i = 0; i < size; i++) {
+ buf[i] = ' ';
}
- buf[size]= '\0';
+ buf[size] = '\0';
return buf;
}
diff --git a/xorg-server/xkb/xkmread.c b/xorg-server/xkb/xkmread.c
index a5c1ecfff..45da965dc 100644
--- a/xorg-server/xkb/xkmread.c
+++ b/xorg-server/xkb/xkmread.c
@@ -44,34 +44,36 @@
#include "xkbgeom.h"
Atom
-XkbInternAtom(char *str,Bool only_if_exists)
+XkbInternAtom(char *str, Bool only_if_exists)
{
- if (str==NULL)
- return None;
- return MakeAtom(str,strlen(str),!only_if_exists);
+ if (str == NULL)
+ return None;
+ return MakeAtom(str, strlen(str), !only_if_exists);
}
/***====================================================================***/
static void *
-XkmInsureSize(void *oldPtr,int oldCount,int *newCountRtrn,int elemSize)
+XkmInsureSize(void *oldPtr, int oldCount, int *newCountRtrn, int elemSize)
{
-int newCount= *newCountRtrn;
+ int newCount = *newCountRtrn;
- if (oldPtr==NULL) {
- if (newCount==0)
- return NULL;
- oldPtr= calloc(newCount,elemSize);
+ if (oldPtr == NULL) {
+ if (newCount == 0)
+ return NULL;
+ oldPtr = calloc(newCount, elemSize);
}
- else if (oldCount<newCount) {
- oldPtr= realloc(oldPtr,newCount*elemSize);
- if (oldPtr!=NULL) {
- char *tmp= (char *)oldPtr;
- memset(&tmp[oldCount*elemSize], 0, (newCount-oldCount)*elemSize);
- }
+ else if (oldCount < newCount) {
+ oldPtr = realloc(oldPtr, newCount * elemSize);
+ if (oldPtr != NULL) {
+ char *tmp = (char *) oldPtr;
+
+ memset(&tmp[oldCount * elemSize], 0,
+ (newCount - oldCount) * elemSize);
+ }
}
- else if (newCount<oldCount) {
- *newCountRtrn= oldCount;
+ else if (newCount < oldCount) {
+ *newCountRtrn = oldCount;
}
return oldPtr;
}
@@ -79,114 +81,120 @@ int newCount= *newCountRtrn;
#define XkmInsureTypedSize(p,o,n,t) ((p)=((t *)XkmInsureSize((char *)(p),(o),(n),sizeof(t))))
static CARD8
-XkmGetCARD8(FILE *file,int *pNRead)
+XkmGetCARD8(FILE * file, int *pNRead)
{
-int tmp;
- tmp= getc(file);
- if (pNRead&&(tmp!=EOF))
- (*pNRead)+= 1;
+ int tmp;
+
+ tmp = getc(file);
+ if (pNRead && (tmp != EOF))
+ (*pNRead) += 1;
return tmp;
}
static CARD16
-XkmGetCARD16(FILE *file,int *pNRead)
+XkmGetCARD16(FILE * file, int *pNRead)
{
-CARD16 val;
+ CARD16 val;
- if ((fread(&val,2,1,file)==1)&&(pNRead))
- (*pNRead)+= 2;
+ if ((fread(&val, 2, 1, file) == 1) && (pNRead))
+ (*pNRead) += 2;
return val;
}
static CARD32
-XkmGetCARD32(FILE *file,int *pNRead)
+XkmGetCARD32(FILE * file, int *pNRead)
{
-CARD32 val;
+ CARD32 val;
- if ((fread(&val,4,1,file)==1)&&(pNRead))
- (*pNRead)+= 4;
+ if ((fread(&val, 4, 1, file) == 1) && (pNRead))
+ (*pNRead) += 4;
return val;
}
static int
-XkmSkipPadding(FILE *file,unsigned pad)
+XkmSkipPadding(FILE * file, unsigned pad)
{
-register int i,nRead=0;
+ register int i, nRead = 0;
- for (i=0;i<pad;i++) {
- if (getc(file)!=EOF)
- nRead++;
+ for (i = 0; i < pad; i++) {
+ if (getc(file) != EOF)
+ nRead++;
}
return nRead;
}
static int
-XkmGetCountedString(FILE *file,char *str,int max_len)
+XkmGetCountedString(FILE * file, char *str, int max_len)
{
-int count,nRead=0;
-
- count= XkmGetCARD16(file,&nRead);
- if (count>0) {
- int tmp;
- if (count>max_len) {
- tmp= fread(str,1,max_len,file);
- while (tmp<count) {
- if ((getc(file))!=EOF)
- tmp++;
- else break;
- }
- }
- else {
- tmp= fread(str,1,count,file);
- }
- nRead+= tmp;
+ int count, nRead = 0;
+
+ count = XkmGetCARD16(file, &nRead);
+ if (count > 0) {
+ int tmp;
+
+ if (count > max_len) {
+ tmp = fread(str, 1, max_len, file);
+ while (tmp < count) {
+ if ((getc(file)) != EOF)
+ tmp++;
+ else
+ break;
+ }
+ }
+ else {
+ tmp = fread(str, 1, count, file);
+ }
+ nRead += tmp;
}
- if (count>=max_len) str[max_len-1]= '\0';
- else str[count]= '\0';
- count= XkbPaddedSize(nRead)-nRead;
- if (count>0)
- nRead+= XkmSkipPadding(file,count);
+ if (count >= max_len)
+ str[max_len - 1] = '\0';
+ else
+ str[count] = '\0';
+ count = XkbPaddedSize(nRead) - nRead;
+ if (count > 0)
+ nRead += XkmSkipPadding(file, count);
return nRead;
}
/***====================================================================***/
static int
-ReadXkmVirtualMods(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
+ReadXkmVirtualMods(FILE * file, XkbDescPtr xkb, XkbChangesPtr changes)
{
-register unsigned int i,bit;
-unsigned int bound,named,tmp;
-int nRead=0;
+ register unsigned int i, bit;
+ unsigned int bound, named, tmp;
+ int nRead = 0;
- if (XkbAllocServerMap(xkb,XkbVirtualModsMask,0)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmVirtualMods",0);
- return -1;
+ if (XkbAllocServerMap(xkb, XkbVirtualModsMask, 0) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmVirtualMods", 0);
+ return -1;
}
- bound= XkmGetCARD16(file,&nRead);
- named= XkmGetCARD16(file,&nRead);
- for (i=tmp=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (bound&bit) {
- xkb->server->vmods[i]= XkmGetCARD8(file,&nRead);
- if (changes)
- changes->map.vmods|= bit;
- tmp++;
- }
+ bound = XkmGetCARD16(file, &nRead);
+ named = XkmGetCARD16(file, &nRead);
+ for (i = tmp = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if (bound & bit) {
+ xkb->server->vmods[i] = XkmGetCARD8(file, &nRead);
+ if (changes)
+ changes->map.vmods |= bit;
+ tmp++;
+ }
}
- if ((i= XkbPaddedSize(tmp)-tmp)>0)
- nRead+= XkmSkipPadding(file,i);
- if (XkbAllocNames(xkb,XkbVirtualModNamesMask,0,0)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmVirtualMods",0);
- return -1;
+ if ((i = XkbPaddedSize(tmp) - tmp) > 0)
+ nRead += XkmSkipPadding(file, i);
+ if (XkbAllocNames(xkb, XkbVirtualModNamesMask, 0, 0) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmVirtualMods", 0);
+ return -1;
}
- for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- char name[100];
- if (named&bit) {
- if (nRead+=XkmGetCountedString(file,name,100)) {
- xkb->names->vmods[i]= XkbInternAtom(name,FALSE);
- if (changes)
- changes->names.changed_vmods|= bit;
- }
- }
+ for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ char name[100];
+
+ if (named & bit) {
+ if (nRead += XkmGetCountedString(file, name, 100)) {
+ xkb->names->vmods[i] = XkbInternAtom(name, FALSE);
+ if (changes)
+ changes->names.changed_vmods |= bit;
+ }
+ }
}
return nRead;
}
@@ -194,200 +202,208 @@ int nRead=0;
/***====================================================================***/
static int
-ReadXkmKeycodes(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
+ReadXkmKeycodes(FILE * file, XkbDescPtr xkb, XkbChangesPtr changes)
{
-register int i;
-unsigned minKC,maxKC,nAl;
-int nRead=0;
-char name[100];
-XkbKeyNamePtr pN;
-
- name[0]= '\0';
- nRead+= XkmGetCountedString(file,name,100);
- minKC= XkmGetCARD8(file,&nRead);
- maxKC= XkmGetCARD8(file,&nRead);
- if (xkb->min_key_code==0) {
- xkb->min_key_code= minKC;
- xkb->max_key_code= maxKC;
+ register int i;
+ unsigned minKC, maxKC, nAl;
+ int nRead = 0;
+ char name[100];
+ XkbKeyNamePtr pN;
+
+ name[0] = '\0';
+ nRead += XkmGetCountedString(file, name, 100);
+ minKC = XkmGetCARD8(file, &nRead);
+ maxKC = XkmGetCARD8(file, &nRead);
+ if (xkb->min_key_code == 0) {
+ xkb->min_key_code = minKC;
+ xkb->max_key_code = maxKC;
}
else {
- if (minKC<xkb->min_key_code)
- xkb->min_key_code= minKC;
- if (maxKC>xkb->max_key_code) {
- _XkbLibError(_XkbErrBadValue,"ReadXkmKeycodes",maxKC);
- return -1;
- }
+ if (minKC < xkb->min_key_code)
+ xkb->min_key_code = minKC;
+ if (maxKC > xkb->max_key_code) {
+ _XkbLibError(_XkbErrBadValue, "ReadXkmKeycodes", maxKC);
+ return -1;
+ }
}
- nAl= XkmGetCARD8(file,&nRead);
- nRead+= XkmSkipPadding(file,1);
+ nAl = XkmGetCARD8(file, &nRead);
+ nRead += XkmSkipPadding(file, 1);
#define WANTED (XkbKeycodesNameMask|XkbKeyNamesMask|XkbKeyAliasesMask)
- if (XkbAllocNames(xkb,WANTED,0,nAl)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmKeycodes",0);
- return -1;
+ if (XkbAllocNames(xkb, WANTED, 0, nAl) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmKeycodes", 0);
+ return -1;
}
- if (name[0]!='\0') {
- xkb->names->keycodes= XkbInternAtom(name,FALSE);
+ if (name[0] != '\0') {
+ xkb->names->keycodes = XkbInternAtom(name, FALSE);
}
- for (pN=&xkb->names->keys[minKC],i=minKC;i<=(int)maxKC;i++,pN++) {
- if (fread(pN,1,XkbKeyNameLength,file)!=XkbKeyNameLength) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmKeycodes",0);
- return -1;
- }
- nRead+= XkbKeyNameLength;
+ for (pN = &xkb->names->keys[minKC], i = minKC; i <= (int) maxKC; i++, pN++) {
+ if (fread(pN, 1, XkbKeyNameLength, file) != XkbKeyNameLength) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmKeycodes", 0);
+ return -1;
+ }
+ nRead += XkbKeyNameLength;
}
- if (nAl>0) {
- XkbKeyAliasPtr pAl;
- for (pAl= xkb->names->key_aliases,i=0;i<nAl;i++,pAl++) {
- int tmp;
- tmp= fread(pAl,1,2*XkbKeyNameLength,file);
- if (tmp!=2*XkbKeyNameLength) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmKeycodes",0);
- return -1;
- }
- nRead+= 2*XkbKeyNameLength;
- }
- if (changes)
- changes->names.changed|= XkbKeyAliasesMask;
+ if (nAl > 0) {
+ XkbKeyAliasPtr pAl;
+
+ for (pAl = xkb->names->key_aliases, i = 0; i < nAl; i++, pAl++) {
+ int tmp;
+
+ tmp = fread(pAl, 1, 2 * XkbKeyNameLength, file);
+ if (tmp != 2 * XkbKeyNameLength) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmKeycodes", 0);
+ return -1;
+ }
+ nRead += 2 * XkbKeyNameLength;
+ }
+ if (changes)
+ changes->names.changed |= XkbKeyAliasesMask;
}
if (changes)
- changes->names.changed|= XkbKeyNamesMask;
+ changes->names.changed |= XkbKeyNamesMask;
return nRead;
}
/***====================================================================***/
static int
-ReadXkmKeyTypes(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
+ReadXkmKeyTypes(FILE * file, XkbDescPtr xkb, XkbChangesPtr changes)
{
-register unsigned i,n;
-unsigned num_types;
-int nRead=0;
-int tmp;
-XkbKeyTypePtr type;
-xkmKeyTypeDesc wire;
-XkbKTMapEntryPtr entry;
-xkmKTMapEntryDesc wire_entry;
-char buf[100];
-
- if ((tmp= XkmGetCountedString(file,buf,100))<1) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmKeyTypes",0);
- return -1;
- }
- nRead+= tmp;
- if (buf[0]!='\0') {
- if (XkbAllocNames(xkb,XkbTypesNameMask,0,0)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmKeyTypes",0);
- return -1;
+ register unsigned i, n;
+ unsigned num_types;
+ int nRead = 0;
+ int tmp;
+ XkbKeyTypePtr type;
+ xkmKeyTypeDesc wire;
+ XkbKTMapEntryPtr entry;
+ xkmKTMapEntryDesc wire_entry;
+ char buf[100];
+
+ if ((tmp = XkmGetCountedString(file, buf, 100)) < 1) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmKeyTypes", 0);
+ return -1;
+ }
+ nRead += tmp;
+ if (buf[0] != '\0') {
+ if (XkbAllocNames(xkb, XkbTypesNameMask, 0, 0) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmKeyTypes", 0);
+ return -1;
}
- xkb->names->types= XkbInternAtom(buf,FALSE);
+ xkb->names->types = XkbInternAtom(buf, FALSE);
}
- num_types= XkmGetCARD16(file,&nRead);
- nRead+= XkmSkipPadding(file,2);
- if (num_types<1)
- return nRead;
- if (XkbAllocClientMap(xkb,XkbKeyTypesMask,num_types)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmKeyTypes",0);
- return nRead;
+ num_types = XkmGetCARD16(file, &nRead);
+ nRead += XkmSkipPadding(file, 2);
+ if (num_types < 1)
+ return nRead;
+ if (XkbAllocClientMap(xkb, XkbKeyTypesMask, num_types) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmKeyTypes", 0);
+ return nRead;
}
- xkb->map->num_types= num_types;
- if (num_types<XkbNumRequiredTypes) {
- _XkbLibError(_XkbErrMissingReqTypes,"ReadXkmKeyTypes",0);
- return -1;
+ xkb->map->num_types = num_types;
+ if (num_types < XkbNumRequiredTypes) {
+ _XkbLibError(_XkbErrMissingReqTypes, "ReadXkmKeyTypes", 0);
+ return -1;
}
- type= xkb->map->types;
- for (i=0;i<num_types;i++,type++) {
- if ((int)fread(&wire,SIZEOF(xkmKeyTypeDesc),1,file)<1) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmKeyTypes",0);
- return -1;
- }
- nRead+= SIZEOF(xkmKeyTypeDesc);
- if (((i==XkbOneLevelIndex)&&(wire.numLevels!=1))||
- (((i==XkbTwoLevelIndex)||(i==XkbAlphabeticIndex)||
- ((i)==XkbKeypadIndex))&&(wire.numLevels!=2))) {
- _XkbLibError(_XkbErrBadTypeWidth,"ReadXkmKeyTypes",i);
- return -1;
- }
- tmp= wire.nMapEntries;
- XkmInsureTypedSize(type->map,type->map_count,&tmp,XkbKTMapEntryRec);
- if ((wire.nMapEntries>0)&&(type->map==NULL)) {
- _XkbLibError(_XkbErrBadValue,"ReadXkmKeyTypes",wire.nMapEntries);
- return -1;
- }
- for (n=0,entry= type->map;n<wire.nMapEntries;n++,entry++) {
- if (fread(&wire_entry,SIZEOF(xkmKTMapEntryDesc),1,file)<(int)1) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmKeyTypes",0);
- return -1;
- }
- nRead+= SIZEOF(xkmKTMapEntryDesc);
- entry->active= (wire_entry.virtualMods==0);
- entry->level= wire_entry.level;
- entry->mods.mask= wire_entry.realMods;
- entry->mods.real_mods= wire_entry.realMods;
- entry->mods.vmods= wire_entry.virtualMods;
- }
- nRead+= XkmGetCountedString(file,buf,100);
- if (((i==XkbOneLevelIndex)&&(strcmp(buf,"ONE_LEVEL")!=0))||
- ((i==XkbTwoLevelIndex)&&(strcmp(buf,"TWO_LEVEL")!=0))||
- ((i==XkbAlphabeticIndex)&&(strcmp(buf,"ALPHABETIC")!=0))||
- ((i==XkbKeypadIndex)&&(strcmp(buf,"KEYPAD")!=0))) {
- _XkbLibError(_XkbErrBadTypeName,"ReadXkmKeyTypes",0);
- return -1;
- }
- if (buf[0]!='\0') {
- type->name= XkbInternAtom(buf,FALSE);
- }
- else type->name= None;
-
- if (wire.preserve) {
- xkmModsDesc p_entry;
- XkbModsPtr pre;
- XkmInsureTypedSize(type->preserve,type->map_count,&tmp,
- XkbModsRec);
- if (type->preserve==NULL) {
- _XkbLibError(_XkbErrBadMatch,"ReadXkmKeycodes",0);
- return -1;
- }
- for (n=0,pre=type->preserve;n<wire.nMapEntries;n++,pre++) {
- if (fread(&p_entry,SIZEOF(xkmModsDesc),1,file)<1) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmKeycodes",0);
- return -1;
- }
- nRead+= SIZEOF(xkmModsDesc);
- pre->mask= p_entry.realMods;
- pre->real_mods= p_entry.realMods;
- pre->vmods= p_entry.virtualMods;
- }
- }
- if (wire.nLevelNames>0) {
- int width= wire.numLevels;
- if (wire.nLevelNames>(unsigned)width) {
- _XkbLibError(_XkbErrBadMatch,"ReadXkmKeycodes",0);
- return -1;
- }
- XkmInsureTypedSize(type->level_names,type->num_levels,&width,Atom);
- if (type->level_names!=NULL) {
- for (n=0;n<wire.nLevelNames;n++) {
- if ((tmp=XkmGetCountedString(file,buf,100))<1)
- return -1;
- nRead+= tmp;
- if (strlen(buf)==0)
- type->level_names[n]= None;
- else type->level_names[n]= XkbInternAtom(buf,0);
- }
- }
- }
- type->mods.mask= wire.realMods;
- type->mods.real_mods= wire.realMods;
- type->mods.vmods= wire.virtualMods;
- type->num_levels= wire.numLevels;
- type->map_count= wire.nMapEntries;
+ type = xkb->map->types;
+ for (i = 0; i < num_types; i++, type++) {
+ if ((int) fread(&wire, SIZEOF(xkmKeyTypeDesc), 1, file) < 1) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmKeyTypes", 0);
+ return -1;
+ }
+ nRead += SIZEOF(xkmKeyTypeDesc);
+ if (((i == XkbOneLevelIndex) && (wire.numLevels != 1)) ||
+ (((i == XkbTwoLevelIndex) || (i == XkbAlphabeticIndex) ||
+ ((i) == XkbKeypadIndex)) && (wire.numLevels != 2))) {
+ _XkbLibError(_XkbErrBadTypeWidth, "ReadXkmKeyTypes", i);
+ return -1;
+ }
+ tmp = wire.nMapEntries;
+ XkmInsureTypedSize(type->map, type->map_count, &tmp, XkbKTMapEntryRec);
+ if ((wire.nMapEntries > 0) && (type->map == NULL)) {
+ _XkbLibError(_XkbErrBadValue, "ReadXkmKeyTypes", wire.nMapEntries);
+ return -1;
+ }
+ for (n = 0, entry = type->map; n < wire.nMapEntries; n++, entry++) {
+ if (fread(&wire_entry, SIZEOF(xkmKTMapEntryDesc), 1, file) <
+ (int) 1) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmKeyTypes", 0);
+ return -1;
+ }
+ nRead += SIZEOF(xkmKTMapEntryDesc);
+ entry->active = (wire_entry.virtualMods == 0);
+ entry->level = wire_entry.level;
+ entry->mods.mask = wire_entry.realMods;
+ entry->mods.real_mods = wire_entry.realMods;
+ entry->mods.vmods = wire_entry.virtualMods;
+ }
+ nRead += XkmGetCountedString(file, buf, 100);
+ if (((i == XkbOneLevelIndex) && (strcmp(buf, "ONE_LEVEL") != 0)) ||
+ ((i == XkbTwoLevelIndex) && (strcmp(buf, "TWO_LEVEL") != 0)) ||
+ ((i == XkbAlphabeticIndex) && (strcmp(buf, "ALPHABETIC") != 0)) ||
+ ((i == XkbKeypadIndex) && (strcmp(buf, "KEYPAD") != 0))) {
+ _XkbLibError(_XkbErrBadTypeName, "ReadXkmKeyTypes", 0);
+ return -1;
+ }
+ if (buf[0] != '\0') {
+ type->name = XkbInternAtom(buf, FALSE);
+ }
+ else
+ type->name = None;
+
+ if (wire.preserve) {
+ xkmModsDesc p_entry;
+ XkbModsPtr pre;
+
+ XkmInsureTypedSize(type->preserve, type->map_count, &tmp,
+ XkbModsRec);
+ if (type->preserve == NULL) {
+ _XkbLibError(_XkbErrBadMatch, "ReadXkmKeycodes", 0);
+ return -1;
+ }
+ for (n = 0, pre = type->preserve; n < wire.nMapEntries; n++, pre++) {
+ if (fread(&p_entry, SIZEOF(xkmModsDesc), 1, file) < 1) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmKeycodes", 0);
+ return -1;
+ }
+ nRead += SIZEOF(xkmModsDesc);
+ pre->mask = p_entry.realMods;
+ pre->real_mods = p_entry.realMods;
+ pre->vmods = p_entry.virtualMods;
+ }
+ }
+ if (wire.nLevelNames > 0) {
+ int width = wire.numLevels;
+
+ if (wire.nLevelNames > (unsigned) width) {
+ _XkbLibError(_XkbErrBadMatch, "ReadXkmKeycodes", 0);
+ return -1;
+ }
+ XkmInsureTypedSize(type->level_names, type->num_levels, &width,
+ Atom);
+ if (type->level_names != NULL) {
+ for (n = 0; n < wire.nLevelNames; n++) {
+ if ((tmp = XkmGetCountedString(file, buf, 100)) < 1)
+ return -1;
+ nRead += tmp;
+ if (strlen(buf) == 0)
+ type->level_names[n] = None;
+ else
+ type->level_names[n] = XkbInternAtom(buf, 0);
+ }
+ }
+ }
+ type->mods.mask = wire.realMods;
+ type->mods.real_mods = wire.realMods;
+ type->mods.vmods = wire.virtualMods;
+ type->num_levels = wire.numLevels;
+ type->map_count = wire.nMapEntries;
}
if (changes) {
- changes->map.changed|= XkbKeyTypesMask;
- changes->map.first_type= 0;
- changes->map.num_types= xkb->map->num_types;
+ changes->map.changed |= XkbKeyTypesMask;
+ changes->map.first_type = 0;
+ changes->map.num_types = xkb->map->num_types;
}
return nRead;
}
@@ -395,47 +411,47 @@ char buf[100];
/***====================================================================***/
static int
-ReadXkmCompatMap(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
+ReadXkmCompatMap(FILE * file, XkbDescPtr xkb, XkbChangesPtr changes)
{
-register int i;
-unsigned num_si,groups;
-char name[100];
-XkbSymInterpretPtr interp;
-xkmSymInterpretDesc wire;
-unsigned tmp;
-int nRead=0;
-XkbCompatMapPtr compat;
-XkbAction *act;
-
- if ((tmp= XkmGetCountedString(file,name,100))<1) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmCompatMap",0);
- return -1;
+ register int i;
+ unsigned num_si, groups;
+ char name[100];
+ XkbSymInterpretPtr interp;
+ xkmSymInterpretDesc wire;
+ unsigned tmp;
+ int nRead = 0;
+ XkbCompatMapPtr compat;
+ XkbAction *act;
+
+ if ((tmp = XkmGetCountedString(file, name, 100)) < 1) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmCompatMap", 0);
+ return -1;
}
- nRead+= tmp;
- if (name[0]!='\0') {
- if (XkbAllocNames(xkb,XkbCompatNameMask,0,0)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmCompatMap",0);
- return -1;
- }
- xkb->names->compat= XkbInternAtom(name,FALSE);
+ nRead += tmp;
+ if (name[0] != '\0') {
+ if (XkbAllocNames(xkb, XkbCompatNameMask, 0, 0) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmCompatMap", 0);
+ return -1;
+ }
+ xkb->names->compat = XkbInternAtom(name, FALSE);
}
- num_si= XkmGetCARD16(file,&nRead);
- groups= XkmGetCARD8(file,&nRead);
- nRead+= XkmSkipPadding(file,1);
- if (XkbAllocCompatMap(xkb,XkbAllCompatMask,num_si)!=Success)
- return -1;
- compat= xkb->compat;
- compat->num_si= 0;
- interp= compat->sym_interpret;
- for (i=0;i<num_si;i++) {
- tmp= fread(&wire,SIZEOF(xkmSymInterpretDesc),1,file);
- nRead+= tmp*SIZEOF(xkmSymInterpretDesc);
- interp->sym= wire.sym;
- interp->mods= wire.mods;
- interp->match= wire.match;
- interp->virtual_mod= wire.virtualMod;
- interp->flags= wire.flags;
- interp->act.type= wire.actionType;
+ num_si = XkmGetCARD16(file, &nRead);
+ groups = XkmGetCARD8(file, &nRead);
+ nRead += XkmSkipPadding(file, 1);
+ if (XkbAllocCompatMap(xkb, XkbAllCompatMask, num_si) != Success)
+ return -1;
+ compat = xkb->compat;
+ compat->num_si = 0;
+ interp = compat->sym_interpret;
+ for (i = 0; i < num_si; i++) {
+ tmp = fread(&wire, SIZEOF(xkmSymInterpretDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmSymInterpretDesc);
+ interp->sym = wire.sym;
+ interp->mods = wire.mods;
+ interp->match = wire.match;
+ interp->virtual_mod = wire.virtualMod;
+ interp->flags = wire.flags;
+ interp->act.type = wire.actionType;
act = (XkbAction *) &interp->act;
switch (interp->act.type) {
@@ -545,7 +561,7 @@ XkbAction *act;
}
/* copy the kind of action */
memcpy(act->any.data, wire.actionData, XkbAnyActionDataSize);
- break ;
+ break;
case XkbSA_Terminate:
/* no args, kinda (note: untrue for xfree86). */
@@ -557,624 +573,648 @@ XkbAction *act;
interp++;
compat->num_si++;
}
- if ((num_si>0)&&(changes)) {
- changes->compat.first_si= 0;
- changes->compat.num_si= compat->num_si;
+ if ((num_si > 0) && (changes)) {
+ changes->compat.first_si = 0;
+ changes->compat.num_si = compat->num_si;
}
if (groups) {
- register unsigned bit;
- for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) {
- xkmModsDesc md;
- if (groups&bit) {
- tmp= fread(&md,SIZEOF(xkmModsDesc),1,file);
- nRead+= tmp*SIZEOF(xkmModsDesc);
- xkb->compat->groups[i].real_mods= md.realMods;
- xkb->compat->groups[i].vmods= md.virtualMods;
- if (md.virtualMods != 0) {
- unsigned mask;
- if (XkbVirtualModsToReal(xkb,md.virtualMods,&mask))
- xkb->compat->groups[i].mask= md.realMods|mask;
- }
- else xkb->compat->groups[i].mask= md.realMods;
- }
- }
- if (changes)
- changes->compat.changed_groups|= groups;
+ register unsigned bit;
+
+ for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
+ xkmModsDesc md;
+
+ if (groups & bit) {
+ tmp = fread(&md, SIZEOF(xkmModsDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmModsDesc);
+ xkb->compat->groups[i].real_mods = md.realMods;
+ xkb->compat->groups[i].vmods = md.virtualMods;
+ if (md.virtualMods != 0) {
+ unsigned mask;
+
+ if (XkbVirtualModsToReal(xkb, md.virtualMods, &mask))
+ xkb->compat->groups[i].mask = md.realMods | mask;
+ }
+ else
+ xkb->compat->groups[i].mask = md.realMods;
+ }
+ }
+ if (changes)
+ changes->compat.changed_groups |= groups;
}
return nRead;
}
static int
-ReadXkmIndicators(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
+ReadXkmIndicators(FILE * file, XkbDescPtr xkb, XkbChangesPtr changes)
{
-register unsigned nLEDs;
-xkmIndicatorMapDesc wire;
-char buf[100];
-unsigned tmp;
-int nRead=0;
-
- if ((xkb->indicators==NULL)&&(XkbAllocIndicatorMaps(xkb)!=Success)) {
- _XkbLibError(_XkbErrBadAlloc,"indicator rec",0);
- return -1;
+ register unsigned nLEDs;
+ xkmIndicatorMapDesc wire;
+ char buf[100];
+ unsigned tmp;
+ int nRead = 0;
+
+ if ((xkb->indicators == NULL) && (XkbAllocIndicatorMaps(xkb) != Success)) {
+ _XkbLibError(_XkbErrBadAlloc, "indicator rec", 0);
+ return -1;
}
- if (XkbAllocNames(xkb,XkbIndicatorNamesMask,0,0)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"indicator names",0);
- return -1;
+ if (XkbAllocNames(xkb, XkbIndicatorNamesMask, 0, 0) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "indicator names", 0);
+ return -1;
}
- nLEDs= XkmGetCARD8(file,&nRead);
- nRead+= XkmSkipPadding(file,3);
- xkb->indicators->phys_indicators= XkmGetCARD32(file,&nRead);
- while (nLEDs-->0) {
- Atom name;
- XkbIndicatorMapPtr map;
-
- if ((tmp=XkmGetCountedString(file,buf,100))<1) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmIndicators",0);
- return -1;
- }
- nRead+= tmp;
- if (buf[0]!='\0')
- name= XkbInternAtom(buf,FALSE);
- else name= None;
- if ((tmp=fread(&wire,SIZEOF(xkmIndicatorMapDesc),1,file))<1) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmIndicators",0);
- return -1;
- }
- nRead+= tmp*SIZEOF(xkmIndicatorMapDesc);
- if (xkb->names) {
- xkb->names->indicators[wire.indicator-1]= name;
- if (changes)
- changes->names.changed_indicators|= (1<<(wire.indicator-1));
- }
- map= &xkb->indicators->maps[wire.indicator-1];
- map->flags= wire.flags;
- map->which_groups= wire.which_groups;
- map->groups= wire.groups;
- map->which_mods= wire.which_mods;
- map->mods.mask= wire.real_mods;
- map->mods.real_mods= wire.real_mods;
- map->mods.vmods= wire.vmods;
- map->ctrls= wire.ctrls;
+ nLEDs = XkmGetCARD8(file, &nRead);
+ nRead += XkmSkipPadding(file, 3);
+ xkb->indicators->phys_indicators = XkmGetCARD32(file, &nRead);
+ while (nLEDs-- > 0) {
+ Atom name;
+ XkbIndicatorMapPtr map;
+
+ if ((tmp = XkmGetCountedString(file, buf, 100)) < 1) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmIndicators", 0);
+ return -1;
+ }
+ nRead += tmp;
+ if (buf[0] != '\0')
+ name = XkbInternAtom(buf, FALSE);
+ else
+ name = None;
+ if ((tmp = fread(&wire, SIZEOF(xkmIndicatorMapDesc), 1, file)) < 1) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmIndicators", 0);
+ return -1;
+ }
+ nRead += tmp * SIZEOF(xkmIndicatorMapDesc);
+ if (xkb->names) {
+ xkb->names->indicators[wire.indicator - 1] = name;
+ if (changes)
+ changes->names.changed_indicators |=
+ (1 << (wire.indicator - 1));
+ }
+ map = &xkb->indicators->maps[wire.indicator - 1];
+ map->flags = wire.flags;
+ map->which_groups = wire.which_groups;
+ map->groups = wire.groups;
+ map->which_mods = wire.which_mods;
+ map->mods.mask = wire.real_mods;
+ map->mods.real_mods = wire.real_mods;
+ map->mods.vmods = wire.vmods;
+ map->ctrls = wire.ctrls;
}
return nRead;
}
static XkbKeyTypePtr
-FindTypeForKey(XkbDescPtr xkb,Atom name,unsigned width,KeySym *syms)
+FindTypeForKey(XkbDescPtr xkb, Atom name, unsigned width, KeySym * syms)
{
- if ((!xkb)||(!xkb->map))
- return NULL;
- if (name!=None) {
- register unsigned i;
- for (i=0;i<xkb->map->num_types;i++) {
- if (xkb->map->types[i].name==name) {
- if (xkb->map->types[i].num_levels!=width)
- DebugF("Group width mismatch between key and type\n");
- return &xkb->map->types[i];
- }
- }
+ if ((!xkb) || (!xkb->map))
+ return NULL;
+ if (name != None) {
+ register unsigned i;
+
+ for (i = 0; i < xkb->map->num_types; i++) {
+ if (xkb->map->types[i].name == name) {
+ if (xkb->map->types[i].num_levels != width)
+ DebugF("Group width mismatch between key and type\n");
+ return &xkb->map->types[i];
+ }
+ }
}
- if ((width<2)||((syms!=NULL)&&(syms[1]==NoSymbol)))
- return &xkb->map->types[XkbOneLevelIndex];
- if (syms!=NULL) {
- if (XkbKSIsLower(syms[0])&&XkbKSIsUpper(syms[1]))
- return &xkb->map->types[XkbAlphabeticIndex];
- else if (XkbKSIsKeypad(syms[0])||XkbKSIsKeypad(syms[1]))
- return &xkb->map->types[XkbKeypadIndex];
+ if ((width < 2) || ((syms != NULL) && (syms[1] == NoSymbol)))
+ return &xkb->map->types[XkbOneLevelIndex];
+ if (syms != NULL) {
+ if (XkbKSIsLower(syms[0]) && XkbKSIsUpper(syms[1]))
+ return &xkb->map->types[XkbAlphabeticIndex];
+ else if (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1]))
+ return &xkb->map->types[XkbKeypadIndex];
}
return &xkb->map->types[XkbTwoLevelIndex];
}
static int
-ReadXkmSymbols(FILE *file,XkbDescPtr xkb)
+ReadXkmSymbols(FILE * file, XkbDescPtr xkb)
{
-register int i,g,s,totalVModMaps;
-xkmKeySymMapDesc wireMap;
-char buf[100];
-unsigned minKC,maxKC,groupNames,tmp;
-int nRead=0;
-
- if ((tmp=XkmGetCountedString(file,buf,100))<1)
- return -1;
- nRead+= tmp;
- minKC= XkmGetCARD8(file,&nRead);
- maxKC= XkmGetCARD8(file,&nRead);
- groupNames= XkmGetCARD8(file,&nRead);
- totalVModMaps= XkmGetCARD8(file,&nRead);
+ register int i, g, s, totalVModMaps;
+ xkmKeySymMapDesc wireMap;
+ char buf[100];
+ unsigned minKC, maxKC, groupNames, tmp;
+ int nRead = 0;
+
+ if ((tmp = XkmGetCountedString(file, buf, 100)) < 1)
+ return -1;
+ nRead += tmp;
+ minKC = XkmGetCARD8(file, &nRead);
+ maxKC = XkmGetCARD8(file, &nRead);
+ groupNames = XkmGetCARD8(file, &nRead);
+ totalVModMaps = XkmGetCARD8(file, &nRead);
if (XkbAllocNames(xkb,
- XkbSymbolsNameMask|XkbPhysSymbolsNameMask|XkbGroupNamesMask,
- 0,0)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"physical names",0);
- return -1;
+ XkbSymbolsNameMask | XkbPhysSymbolsNameMask |
+ XkbGroupNamesMask, 0, 0) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "physical names", 0);
+ return -1;
}
- if ((buf[0]!='\0')&&(xkb->names)) {
- Atom name;
- name= XkbInternAtom(buf,0);
- xkb->names->symbols= name;
- xkb->names->phys_symbols= name;
+ if ((buf[0] != '\0') && (xkb->names)) {
+ Atom name;
+
+ name = XkbInternAtom(buf, 0);
+ xkb->names->symbols = name;
+ xkb->names->phys_symbols = name;
}
- for (i=0,g=1;i<XkbNumKbdGroups;i++,g<<=1) {
- if (groupNames&g) {
- if ((tmp=XkmGetCountedString(file,buf,100))<1)
- return -1;
- nRead+= tmp;
-
- if (!xkb->names)
- continue;
-
- if (buf[0]!='\0') {
- Atom name;
- name= XkbInternAtom(buf,0);
- xkb->names->groups[i]= name;
- }
- else xkb->names->groups[i]= None;
- }
+ for (i = 0, g = 1; i < XkbNumKbdGroups; i++, g <<= 1) {
+ if (groupNames & g) {
+ if ((tmp = XkmGetCountedString(file, buf, 100)) < 1)
+ return -1;
+ nRead += tmp;
+
+ if (!xkb->names)
+ continue;
+
+ if (buf[0] != '\0') {
+ Atom name;
+
+ name = XkbInternAtom(buf, 0);
+ xkb->names->groups[i] = name;
+ }
+ else
+ xkb->names->groups[i] = None;
+ }
}
- if (XkbAllocServerMap(xkb,XkbAllServerInfoMask,0)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"server map",0);
- return -1;
+ if (XkbAllocServerMap(xkb, XkbAllServerInfoMask, 0) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "server map", 0);
+ return -1;
}
- if (XkbAllocClientMap(xkb,XkbAllClientInfoMask,0)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"client map",0);
- return -1;
+ if (XkbAllocClientMap(xkb, XkbAllClientInfoMask, 0) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "client map", 0);
+ return -1;
}
- if (XkbAllocControls(xkb,XkbAllControlsMask)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"controls",0);
- return -1;
+ if (XkbAllocControls(xkb, XkbAllControlsMask) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "controls", 0);
+ return -1;
}
- if ((xkb->map==NULL)||(xkb->server==NULL))
- return -1;
- if (xkb->min_key_code<8) xkb->min_key_code= minKC;
- if (xkb->max_key_code<8) xkb->max_key_code= maxKC;
- if ((minKC>=8)&&(minKC<xkb->min_key_code))
- xkb->min_key_code= minKC;
- if ((maxKC>=8)&&(maxKC>xkb->max_key_code)) {
- _XkbLibError(_XkbErrBadValue,"keys in symbol map",maxKC);
- return -1;
+ if ((xkb->map == NULL) || (xkb->server == NULL))
+ return -1;
+ if (xkb->min_key_code < 8)
+ xkb->min_key_code = minKC;
+ if (xkb->max_key_code < 8)
+ xkb->max_key_code = maxKC;
+ if ((minKC >= 8) && (minKC < xkb->min_key_code))
+ xkb->min_key_code = minKC;
+ if ((maxKC >= 8) && (maxKC > xkb->max_key_code)) {
+ _XkbLibError(_XkbErrBadValue, "keys in symbol map", maxKC);
+ return -1;
}
- for (i=minKC;i<=(int)maxKC;i++) {
- Atom typeName[XkbNumKbdGroups];
- XkbKeyTypePtr type[XkbNumKbdGroups];
- if ((tmp=fread(&wireMap,SIZEOF(xkmKeySymMapDesc),1,file))<1) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmSymbols",0);
- return -1;
- }
- nRead+= tmp*SIZEOF(xkmKeySymMapDesc);
- memset((char *)typeName, 0, XkbNumKbdGroups*sizeof(Atom));
- memset((char *)type, 0, XkbNumKbdGroups*sizeof(XkbKeyTypePtr));
- if (wireMap.flags&XkmKeyHasTypes) {
- register int g;
- for (g=0;g<XkbNumKbdGroups;g++) {
- if ((wireMap.flags&(1<<g))&&
- ((tmp=XkmGetCountedString(file,buf,100))>0)) {
- typeName[g]= XkbInternAtom(buf,1);
- nRead+= tmp;
- }
- type[g]=FindTypeForKey(xkb,typeName[g],wireMap.width,NULL);
- if (type[g]==NULL) {
- _XkbLibError(_XkbErrMissingTypes,"ReadXkmSymbols",0);
- return -1;
- }
- if (typeName[g]==type[g]->name)
- xkb->server->explicit[i]|= (1<<g);
- }
- }
- if (wireMap.flags&XkmRepeatingKey) {
- xkb->ctrls->per_key_repeat[i/8]|= (1<<(i%8));
- xkb->server->explicit[i]|= XkbExplicitAutoRepeatMask;
- }
- else if (wireMap.flags&XkmNonRepeatingKey) {
- xkb->ctrls->per_key_repeat[i/8]&= ~(1<<(i%8));
- xkb->server->explicit[i]|= XkbExplicitAutoRepeatMask;
- }
- xkb->map->modmap[i]= wireMap.modifier_map;
- if (XkbNumGroups(wireMap.num_groups)>0) {
- KeySym *sym;
- int nSyms;
-
- if (XkbNumGroups(wireMap.num_groups)>xkb->ctrls->num_groups)
- xkb->ctrls->num_groups= wireMap.num_groups;
- nSyms= XkbNumGroups(wireMap.num_groups)*wireMap.width;
- sym= XkbResizeKeySyms(xkb,i,nSyms);
- if (!sym)
- return -1;
- for (s=0;s<nSyms;s++) {
- *sym++= XkmGetCARD32(file,&nRead);
- }
- if (wireMap.flags&XkmKeyHasActions) {
- XkbAction * act;
- act= XkbResizeKeyActions(xkb,i,nSyms);
- for (s=0;s<nSyms;s++,act++) {
- tmp=fread(act,SIZEOF(xkmActionDesc),1,file);
- nRead+= tmp*SIZEOF(xkmActionDesc);
- }
- xkb->server->explicit[i]|= XkbExplicitInterpretMask;
- }
- }
- for (g=0;g<XkbNumGroups(wireMap.num_groups);g++) {
- if (((xkb->server->explicit[i]&(1<<g))==0)||(type[g]==NULL)) {
- KeySym *tmpSyms;
- tmpSyms= XkbKeySymsPtr(xkb,i)+(wireMap.width*g);
- type[g]= FindTypeForKey(xkb,None,wireMap.width,tmpSyms);
- }
- xkb->map->key_sym_map[i].kt_index[g]= type[g]-(&xkb->map->types[0]);
- }
- xkb->map->key_sym_map[i].group_info= wireMap.num_groups;
- xkb->map->key_sym_map[i].width= wireMap.width;
- if (wireMap.flags&XkmKeyHasBehavior) {
- xkmBehaviorDesc b;
- tmp= fread(&b,SIZEOF(xkmBehaviorDesc),1,file);
- nRead+= tmp*SIZEOF(xkmBehaviorDesc);
- xkb->server->behaviors[i].type= b.type;
- xkb->server->behaviors[i].data= b.data;
- xkb->server->explicit[i]|= XkbExplicitBehaviorMask;
- }
+ for (i = minKC; i <= (int) maxKC; i++) {
+ Atom typeName[XkbNumKbdGroups];
+ XkbKeyTypePtr type[XkbNumKbdGroups];
+
+ if ((tmp = fread(&wireMap, SIZEOF(xkmKeySymMapDesc), 1, file)) < 1) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmSymbols", 0);
+ return -1;
+ }
+ nRead += tmp * SIZEOF(xkmKeySymMapDesc);
+ memset((char *) typeName, 0, XkbNumKbdGroups * sizeof(Atom));
+ memset((char *) type, 0, XkbNumKbdGroups * sizeof(XkbKeyTypePtr));
+ if (wireMap.flags & XkmKeyHasTypes) {
+ register int g;
+
+ for (g = 0; g < XkbNumKbdGroups; g++) {
+ if ((wireMap.flags & (1 << g)) &&
+ ((tmp = XkmGetCountedString(file, buf, 100)) > 0)) {
+ typeName[g] = XkbInternAtom(buf, 1);
+ nRead += tmp;
+ }
+ type[g] = FindTypeForKey(xkb, typeName[g], wireMap.width, NULL);
+ if (type[g] == NULL) {
+ _XkbLibError(_XkbErrMissingTypes, "ReadXkmSymbols", 0);
+ return -1;
+ }
+ if (typeName[g] == type[g]->name)
+ xkb->server->explicit[i] |= (1 << g);
+ }
+ }
+ if (wireMap.flags & XkmRepeatingKey) {
+ xkb->ctrls->per_key_repeat[i / 8] |= (1 << (i % 8));
+ xkb->server->explicit[i] |= XkbExplicitAutoRepeatMask;
+ }
+ else if (wireMap.flags & XkmNonRepeatingKey) {
+ xkb->ctrls->per_key_repeat[i / 8] &= ~(1 << (i % 8));
+ xkb->server->explicit[i] |= XkbExplicitAutoRepeatMask;
+ }
+ xkb->map->modmap[i] = wireMap.modifier_map;
+ if (XkbNumGroups(wireMap.num_groups) > 0) {
+ KeySym *sym;
+ int nSyms;
+
+ if (XkbNumGroups(wireMap.num_groups) > xkb->ctrls->num_groups)
+ xkb->ctrls->num_groups = wireMap.num_groups;
+ nSyms = XkbNumGroups(wireMap.num_groups) * wireMap.width;
+ sym = XkbResizeKeySyms(xkb, i, nSyms);
+ if (!sym)
+ return -1;
+ for (s = 0; s < nSyms; s++) {
+ *sym++ = XkmGetCARD32(file, &nRead);
+ }
+ if (wireMap.flags & XkmKeyHasActions) {
+ XkbAction *act;
+
+ act = XkbResizeKeyActions(xkb, i, nSyms);
+ for (s = 0; s < nSyms; s++, act++) {
+ tmp = fread(act, SIZEOF(xkmActionDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmActionDesc);
+ }
+ xkb->server->explicit[i] |= XkbExplicitInterpretMask;
+ }
+ }
+ for (g = 0; g < XkbNumGroups(wireMap.num_groups); g++) {
+ if (((xkb->server->explicit[i] & (1 << g)) == 0) ||
+ (type[g] == NULL)) {
+ KeySym *tmpSyms;
+
+ tmpSyms = XkbKeySymsPtr(xkb, i) + (wireMap.width * g);
+ type[g] = FindTypeForKey(xkb, None, wireMap.width, tmpSyms);
+ }
+ xkb->map->key_sym_map[i].kt_index[g] =
+ type[g] - (&xkb->map->types[0]);
+ }
+ xkb->map->key_sym_map[i].group_info = wireMap.num_groups;
+ xkb->map->key_sym_map[i].width = wireMap.width;
+ if (wireMap.flags & XkmKeyHasBehavior) {
+ xkmBehaviorDesc b;
+
+ tmp = fread(&b, SIZEOF(xkmBehaviorDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmBehaviorDesc);
+ xkb->server->behaviors[i].type = b.type;
+ xkb->server->behaviors[i].data = b.data;
+ xkb->server->explicit[i] |= XkbExplicitBehaviorMask;
+ }
}
- if (totalVModMaps>0) {
- xkmVModMapDesc v;
- for (i=0;i<totalVModMaps;i++) {
- tmp= fread(&v,SIZEOF(xkmVModMapDesc),1,file);
- nRead+= tmp*SIZEOF(xkmVModMapDesc);
- if (tmp>0)
- xkb->server->vmodmap[v.key]= v.vmods;
- }
+ if (totalVModMaps > 0) {
+ xkmVModMapDesc v;
+
+ for (i = 0; i < totalVModMaps; i++) {
+ tmp = fread(&v, SIZEOF(xkmVModMapDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmVModMapDesc);
+ if (tmp > 0)
+ xkb->server->vmodmap[v.key] = v.vmods;
+ }
}
return nRead;
}
static int
-ReadXkmGeomDoodad(
- FILE * file,
- XkbGeometryPtr geom,
- XkbSectionPtr section)
+ReadXkmGeomDoodad(FILE * file, XkbGeometryPtr geom, XkbSectionPtr section)
{
-XkbDoodadPtr doodad;
-xkmDoodadDesc doodadWire;
-char buf[100];
-unsigned tmp;
-int nRead=0;
-
- nRead+= XkmGetCountedString(file,buf,100);
- tmp= fread(&doodadWire,SIZEOF(xkmDoodadDesc),1,file);
- nRead+= SIZEOF(xkmDoodadDesc)*tmp;
- doodad= XkbAddGeomDoodad(geom,section,XkbInternAtom(buf,FALSE));
+ XkbDoodadPtr doodad;
+ xkmDoodadDesc doodadWire;
+ char buf[100];
+ unsigned tmp;
+ int nRead = 0;
+
+ nRead += XkmGetCountedString(file, buf, 100);
+ tmp = fread(&doodadWire, SIZEOF(xkmDoodadDesc), 1, file);
+ nRead += SIZEOF(xkmDoodadDesc) * tmp;
+ doodad = XkbAddGeomDoodad(geom, section, XkbInternAtom(buf, FALSE));
if (!doodad)
- return nRead;
- doodad->any.type= doodadWire.any.type;
- doodad->any.priority= doodadWire.any.priority;
- doodad->any.top= doodadWire.any.top;
- doodad->any.left= doodadWire.any.left;
+ return nRead;
+ doodad->any.type = doodadWire.any.type;
+ doodad->any.priority = doodadWire.any.priority;
+ doodad->any.top = doodadWire.any.top;
+ doodad->any.left = doodadWire.any.left;
switch (doodadWire.any.type) {
- case XkbOutlineDoodad:
- case XkbSolidDoodad:
- doodad->shape.angle= doodadWire.shape.angle;
- doodad->shape.color_ndx= doodadWire.shape.color_ndx;
- doodad->shape.shape_ndx= doodadWire.shape.shape_ndx;
- break;
- case XkbTextDoodad:
- doodad->text.angle= doodadWire.text.angle;
- doodad->text.width= doodadWire.text.width;
- doodad->text.height= doodadWire.text.height;
- doodad->text.color_ndx= doodadWire.text.color_ndx;
- nRead+= XkmGetCountedString(file,buf,100);
- doodad->text.text= Xstrdup(buf);
- nRead+= XkmGetCountedString(file,buf,100);
- doodad->text.font= Xstrdup(buf);
- break;
- case XkbIndicatorDoodad:
- doodad->indicator.shape_ndx= doodadWire.indicator.shape_ndx;
- doodad->indicator.on_color_ndx= doodadWire.indicator.on_color_ndx;
- doodad->indicator.off_color_ndx= doodadWire.indicator.off_color_ndx;
- break;
- case XkbLogoDoodad:
- doodad->logo.angle= doodadWire.logo.angle;
- doodad->logo.color_ndx= doodadWire.logo.color_ndx;
- doodad->logo.shape_ndx= doodadWire.logo.shape_ndx;
- nRead+= XkmGetCountedString(file,buf,100);
- doodad->logo.logo_name= Xstrdup(buf);
- break;
- default:
- /* report error? */
- return nRead;
+ case XkbOutlineDoodad:
+ case XkbSolidDoodad:
+ doodad->shape.angle = doodadWire.shape.angle;
+ doodad->shape.color_ndx = doodadWire.shape.color_ndx;
+ doodad->shape.shape_ndx = doodadWire.shape.shape_ndx;
+ break;
+ case XkbTextDoodad:
+ doodad->text.angle = doodadWire.text.angle;
+ doodad->text.width = doodadWire.text.width;
+ doodad->text.height = doodadWire.text.height;
+ doodad->text.color_ndx = doodadWire.text.color_ndx;
+ nRead += XkmGetCountedString(file, buf, 100);
+ doodad->text.text = Xstrdup(buf);
+ nRead += XkmGetCountedString(file, buf, 100);
+ doodad->text.font = Xstrdup(buf);
+ break;
+ case XkbIndicatorDoodad:
+ doodad->indicator.shape_ndx = doodadWire.indicator.shape_ndx;
+ doodad->indicator.on_color_ndx = doodadWire.indicator.on_color_ndx;
+ doodad->indicator.off_color_ndx = doodadWire.indicator.off_color_ndx;
+ break;
+ case XkbLogoDoodad:
+ doodad->logo.angle = doodadWire.logo.angle;
+ doodad->logo.color_ndx = doodadWire.logo.color_ndx;
+ doodad->logo.shape_ndx = doodadWire.logo.shape_ndx;
+ nRead += XkmGetCountedString(file, buf, 100);
+ doodad->logo.logo_name = Xstrdup(buf);
+ break;
+ default:
+ /* report error? */
+ return nRead;
}
return nRead;
}
static int
-ReadXkmGeomOverlay( FILE * file,
- XkbGeometryPtr geom,
- XkbSectionPtr section)
+ReadXkmGeomOverlay(FILE * file, XkbGeometryPtr geom, XkbSectionPtr section)
{
-char buf[100];
-unsigned tmp;
-int nRead=0;
-XkbOverlayPtr ol;
-XkbOverlayRowPtr row;
-xkmOverlayDesc olWire;
-xkmOverlayRowDesc rowWire;
-register int r;
-
- nRead+= XkmGetCountedString(file,buf,100);
- tmp= fread(&olWire,SIZEOF(xkmOverlayDesc),1,file);
- nRead+= tmp*SIZEOF(xkmOverlayDesc);
- ol= XkbAddGeomOverlay(section,XkbInternAtom(buf,FALSE),
- olWire.num_rows);
+ char buf[100];
+ unsigned tmp;
+ int nRead = 0;
+ XkbOverlayPtr ol;
+ XkbOverlayRowPtr row;
+ xkmOverlayDesc olWire;
+ xkmOverlayRowDesc rowWire;
+ register int r;
+
+ nRead += XkmGetCountedString(file, buf, 100);
+ tmp = fread(&olWire, SIZEOF(xkmOverlayDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmOverlayDesc);
+ ol = XkbAddGeomOverlay(section, XkbInternAtom(buf, FALSE), olWire.num_rows);
if (!ol)
- return nRead;
- for (r=0;r<olWire.num_rows;r++) {
- int k;
- xkmOverlayKeyDesc keyWire;
- tmp= fread(&rowWire,SIZEOF(xkmOverlayRowDesc),1,file);
- nRead+= tmp*SIZEOF(xkmOverlayRowDesc);
- row= XkbAddGeomOverlayRow(ol,rowWire.row_under,rowWire.num_keys);
- if (!row) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeomOverlay",0);
- return nRead;
- }
- for (k=0;k<rowWire.num_keys;k++) {
- tmp= fread(&keyWire,SIZEOF(xkmOverlayKeyDesc),1,file);
- nRead+= tmp*SIZEOF(xkmOverlayKeyDesc);
- memcpy(row->keys[k].over.name,keyWire.over,XkbKeyNameLength);
- memcpy(row->keys[k].under.name,keyWire.under,XkbKeyNameLength);
- }
- row->num_keys= rowWire.num_keys;
+ return nRead;
+ for (r = 0; r < olWire.num_rows; r++) {
+ int k;
+ xkmOverlayKeyDesc keyWire;
+
+ tmp = fread(&rowWire, SIZEOF(xkmOverlayRowDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmOverlayRowDesc);
+ row = XkbAddGeomOverlayRow(ol, rowWire.row_under, rowWire.num_keys);
+ if (!row) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmGeomOverlay", 0);
+ return nRead;
+ }
+ for (k = 0; k < rowWire.num_keys; k++) {
+ tmp = fread(&keyWire, SIZEOF(xkmOverlayKeyDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmOverlayKeyDesc);
+ memcpy(row->keys[k].over.name, keyWire.over, XkbKeyNameLength);
+ memcpy(row->keys[k].under.name, keyWire.under, XkbKeyNameLength);
+ }
+ row->num_keys = rowWire.num_keys;
}
return nRead;
}
static int
-ReadXkmGeomSection( FILE * file,
- XkbGeometryPtr geom)
+ReadXkmGeomSection(FILE * file, XkbGeometryPtr geom)
{
-register int i;
-XkbSectionPtr section;
-xkmSectionDesc sectionWire;
-unsigned tmp;
-int nRead= 0;
-char buf[100];
-Atom nameAtom;
-
- nRead+= XkmGetCountedString(file,buf,100);
- nameAtom= XkbInternAtom(buf,FALSE);
- tmp= fread(&sectionWire,SIZEOF(xkmSectionDesc),1,file);
- nRead+= SIZEOF(xkmSectionDesc)*tmp;
- section= XkbAddGeomSection(geom,nameAtom,sectionWire.num_rows,
- sectionWire.num_doodads,
- sectionWire.num_overlays);
+ register int i;
+ XkbSectionPtr section;
+ xkmSectionDesc sectionWire;
+ unsigned tmp;
+ int nRead = 0;
+ char buf[100];
+ Atom nameAtom;
+
+ nRead += XkmGetCountedString(file, buf, 100);
+ nameAtom = XkbInternAtom(buf, FALSE);
+ tmp = fread(&sectionWire, SIZEOF(xkmSectionDesc), 1, file);
+ nRead += SIZEOF(xkmSectionDesc) * tmp;
+ section = XkbAddGeomSection(geom, nameAtom, sectionWire.num_rows,
+ sectionWire.num_doodads,
+ sectionWire.num_overlays);
if (!section) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeomSection",0);
- return nRead;
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmGeomSection", 0);
+ return nRead;
}
- section->top= sectionWire.top;
- section->left= sectionWire.left;
- section->width= sectionWire.width;
- section->height= sectionWire.height;
- section->angle= sectionWire.angle;
- section->priority= sectionWire.priority;
- if (sectionWire.num_rows>0) {
- register int k;
- XkbRowPtr row;
- xkmRowDesc rowWire;
- XkbKeyPtr key;
- xkmKeyDesc keyWire;
-
- for (i=0;i<sectionWire.num_rows;i++) {
- tmp= fread(&rowWire,SIZEOF(xkmRowDesc),1,file);
- nRead+= SIZEOF(xkmRowDesc)*tmp;
- row= XkbAddGeomRow(section,rowWire.num_keys);
- if (!row) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmKeycodes",0);
- return nRead;
- }
- row->top= rowWire.top;
- row->left= rowWire.left;
- row->vertical= rowWire.vertical;
- for (k=0;k<rowWire.num_keys;k++) {
- tmp= fread(&keyWire,SIZEOF(xkmKeyDesc),1,file);
- nRead+= SIZEOF(xkmKeyDesc)*tmp;
- key= XkbAddGeomKey(row);
- if (!key) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeomSection",0);
- return nRead;
- }
- memcpy(key->name.name,keyWire.name,XkbKeyNameLength);
- key->gap= keyWire.gap;
- key->shape_ndx= keyWire.shape_ndx;
- key->color_ndx= keyWire.color_ndx;
- }
- }
+ section->top = sectionWire.top;
+ section->left = sectionWire.left;
+ section->width = sectionWire.width;
+ section->height = sectionWire.height;
+ section->angle = sectionWire.angle;
+ section->priority = sectionWire.priority;
+ if (sectionWire.num_rows > 0) {
+ register int k;
+ XkbRowPtr row;
+ xkmRowDesc rowWire;
+ XkbKeyPtr key;
+ xkmKeyDesc keyWire;
+
+ for (i = 0; i < sectionWire.num_rows; i++) {
+ tmp = fread(&rowWire, SIZEOF(xkmRowDesc), 1, file);
+ nRead += SIZEOF(xkmRowDesc) * tmp;
+ row = XkbAddGeomRow(section, rowWire.num_keys);
+ if (!row) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmKeycodes", 0);
+ return nRead;
+ }
+ row->top = rowWire.top;
+ row->left = rowWire.left;
+ row->vertical = rowWire.vertical;
+ for (k = 0; k < rowWire.num_keys; k++) {
+ tmp = fread(&keyWire, SIZEOF(xkmKeyDesc), 1, file);
+ nRead += SIZEOF(xkmKeyDesc) * tmp;
+ key = XkbAddGeomKey(row);
+ if (!key) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmGeomSection", 0);
+ return nRead;
+ }
+ memcpy(key->name.name, keyWire.name, XkbKeyNameLength);
+ key->gap = keyWire.gap;
+ key->shape_ndx = keyWire.shape_ndx;
+ key->color_ndx = keyWire.color_ndx;
+ }
+ }
}
- if (sectionWire.num_doodads>0) {
- for (i=0;i<sectionWire.num_doodads;i++) {
- tmp= ReadXkmGeomDoodad(file,geom,section);
- nRead+= tmp;
- if (tmp<1)
- return nRead;
- }
+ if (sectionWire.num_doodads > 0) {
+ for (i = 0; i < sectionWire.num_doodads; i++) {
+ tmp = ReadXkmGeomDoodad(file, geom, section);
+ nRead += tmp;
+ if (tmp < 1)
+ return nRead;
+ }
}
- if (sectionWire.num_overlays>0) {
- for (i=0;i<sectionWire.num_overlays;i++) {
- tmp= ReadXkmGeomOverlay(file,geom,section);
- nRead+= tmp;
- if (tmp<1)
- return nRead;
- }
+ if (sectionWire.num_overlays > 0) {
+ for (i = 0; i < sectionWire.num_overlays; i++) {
+ tmp = ReadXkmGeomOverlay(file, geom, section);
+ nRead += tmp;
+ if (tmp < 1)
+ return nRead;
+ }
}
return nRead;
}
static int
-ReadXkmGeometry(FILE *file,XkbDescPtr xkb)
+ReadXkmGeometry(FILE * file, XkbDescPtr xkb)
{
-register int i;
-char buf[100];
-unsigned tmp;
-int nRead= 0;
-xkmGeometryDesc wireGeom;
-XkbGeometryPtr geom;
-XkbGeometrySizesRec sizes;
-
- nRead+= XkmGetCountedString(file,buf,100);
- tmp= fread(&wireGeom,SIZEOF(xkmGeometryDesc),1,file);
- nRead+= tmp*SIZEOF(xkmGeometryDesc);
- sizes.which= XkbGeomAllMask;
- sizes.num_properties= wireGeom.num_properties;
- sizes.num_colors= wireGeom.num_colors;
- sizes.num_shapes= wireGeom.num_shapes;
- sizes.num_sections= wireGeom.num_sections;
- sizes.num_doodads= wireGeom.num_doodads;
- sizes.num_key_aliases= wireGeom.num_key_aliases;
- if (XkbAllocGeometry(xkb,&sizes)!=Success) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeometry",0);
- return nRead;
+ register int i;
+ char buf[100];
+ unsigned tmp;
+ int nRead = 0;
+ xkmGeometryDesc wireGeom;
+ XkbGeometryPtr geom;
+ XkbGeometrySizesRec sizes;
+
+ nRead += XkmGetCountedString(file, buf, 100);
+ tmp = fread(&wireGeom, SIZEOF(xkmGeometryDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmGeometryDesc);
+ sizes.which = XkbGeomAllMask;
+ sizes.num_properties = wireGeom.num_properties;
+ sizes.num_colors = wireGeom.num_colors;
+ sizes.num_shapes = wireGeom.num_shapes;
+ sizes.num_sections = wireGeom.num_sections;
+ sizes.num_doodads = wireGeom.num_doodads;
+ sizes.num_key_aliases = wireGeom.num_key_aliases;
+ if (XkbAllocGeometry(xkb, &sizes) != Success) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmGeometry", 0);
+ return nRead;
}
- geom= xkb->geom;
- geom->name= XkbInternAtom(buf,FALSE);
- geom->width_mm= wireGeom.width_mm;
- geom->height_mm= wireGeom.height_mm;
- nRead+= XkmGetCountedString(file,buf,100);
- geom->label_font= Xstrdup(buf);
- if (wireGeom.num_properties>0) {
- char val[1024];
- for (i=0;i<wireGeom.num_properties;i++) {
- nRead+= XkmGetCountedString(file,buf,100);
- nRead+= XkmGetCountedString(file,val,1024);
- if (XkbAddGeomProperty(geom,buf,val)==NULL) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeometry",0);
- return nRead;
- }
- }
+ geom = xkb->geom;
+ geom->name = XkbInternAtom(buf, FALSE);
+ geom->width_mm = wireGeom.width_mm;
+ geom->height_mm = wireGeom.height_mm;
+ nRead += XkmGetCountedString(file, buf, 100);
+ geom->label_font = Xstrdup(buf);
+ if (wireGeom.num_properties > 0) {
+ char val[1024];
+
+ for (i = 0; i < wireGeom.num_properties; i++) {
+ nRead += XkmGetCountedString(file, buf, 100);
+ nRead += XkmGetCountedString(file, val, 1024);
+ if (XkbAddGeomProperty(geom, buf, val) == NULL) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmGeometry", 0);
+ return nRead;
+ }
+ }
}
- if (wireGeom.num_colors>0) {
- for (i=0;i<wireGeom.num_colors;i++) {
- nRead+= XkmGetCountedString(file,buf,100);
- if (XkbAddGeomColor(geom,buf,i)==NULL) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeometry",0);
- return nRead;
- }
- }
+ if (wireGeom.num_colors > 0) {
+ for (i = 0; i < wireGeom.num_colors; i++) {
+ nRead += XkmGetCountedString(file, buf, 100);
+ if (XkbAddGeomColor(geom, buf, i) == NULL) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmGeometry", 0);
+ return nRead;
+ }
+ }
}
- geom->base_color= &geom->colors[wireGeom.base_color_ndx];
- geom->label_color= &geom->colors[wireGeom.label_color_ndx];
- if (wireGeom.num_shapes>0) {
- XkbShapePtr shape;
- xkmShapeDesc shapeWire;
- Atom nameAtom;
- for (i=0;i<wireGeom.num_shapes;i++) {
- register int n;
- XkbOutlinePtr ol;
- xkmOutlineDesc olWire;
- nRead+= XkmGetCountedString(file,buf,100);
- nameAtom= XkbInternAtom(buf,FALSE);
- tmp= fread(&shapeWire,SIZEOF(xkmShapeDesc),1,file);
- nRead+= tmp*SIZEOF(xkmShapeDesc);
- shape= XkbAddGeomShape(geom,nameAtom,shapeWire.num_outlines);
- if (!shape) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeometry",0);
- return nRead;
- }
- for (n=0;n<shapeWire.num_outlines;n++) {
- register int p;
- xkmPointDesc ptWire;
- tmp= fread(&olWire,SIZEOF(xkmOutlineDesc),1,file);
- nRead+= tmp*SIZEOF(xkmOutlineDesc);
- ol= XkbAddGeomOutline(shape,olWire.num_points);
- if (!ol) {
- _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeometry",0);
- return nRead;
- }
- ol->num_points= olWire.num_points;
- ol->corner_radius= olWire.corner_radius;
- for (p=0;p<olWire.num_points;p++) {
- tmp= fread(&ptWire,SIZEOF(xkmPointDesc),1,file);
- nRead+= tmp*SIZEOF(xkmPointDesc);
- ol->points[p].x= ptWire.x;
- ol->points[p].y= ptWire.y;
- if (ptWire.x<shape->bounds.x1) shape->bounds.x1= ptWire.x;
- if (ptWire.x>shape->bounds.x2) shape->bounds.x2= ptWire.x;
- if (ptWire.y<shape->bounds.y1) shape->bounds.y1= ptWire.y;
- if (ptWire.y>shape->bounds.y2) shape->bounds.y2= ptWire.y;
- }
- }
- if (shapeWire.primary_ndx!=XkbNoShape)
- shape->primary= &shape->outlines[shapeWire.primary_ndx];
- if (shapeWire.approx_ndx!=XkbNoShape)
- shape->approx= &shape->outlines[shapeWire.approx_ndx];
- }
+ geom->base_color = &geom->colors[wireGeom.base_color_ndx];
+ geom->label_color = &geom->colors[wireGeom.label_color_ndx];
+ if (wireGeom.num_shapes > 0) {
+ XkbShapePtr shape;
+ xkmShapeDesc shapeWire;
+ Atom nameAtom;
+
+ for (i = 0; i < wireGeom.num_shapes; i++) {
+ register int n;
+ XkbOutlinePtr ol;
+ xkmOutlineDesc olWire;
+
+ nRead += XkmGetCountedString(file, buf, 100);
+ nameAtom = XkbInternAtom(buf, FALSE);
+ tmp = fread(&shapeWire, SIZEOF(xkmShapeDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmShapeDesc);
+ shape = XkbAddGeomShape(geom, nameAtom, shapeWire.num_outlines);
+ if (!shape) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmGeometry", 0);
+ return nRead;
+ }
+ for (n = 0; n < shapeWire.num_outlines; n++) {
+ register int p;
+ xkmPointDesc ptWire;
+
+ tmp = fread(&olWire, SIZEOF(xkmOutlineDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmOutlineDesc);
+ ol = XkbAddGeomOutline(shape, olWire.num_points);
+ if (!ol) {
+ _XkbLibError(_XkbErrBadAlloc, "ReadXkmGeometry", 0);
+ return nRead;
+ }
+ ol->num_points = olWire.num_points;
+ ol->corner_radius = olWire.corner_radius;
+ for (p = 0; p < olWire.num_points; p++) {
+ tmp = fread(&ptWire, SIZEOF(xkmPointDesc), 1, file);
+ nRead += tmp * SIZEOF(xkmPointDesc);
+ ol->points[p].x = ptWire.x;
+ ol->points[p].y = ptWire.y;
+ if (ptWire.x < shape->bounds.x1)
+ shape->bounds.x1 = ptWire.x;
+ if (ptWire.x > shape->bounds.x2)
+ shape->bounds.x2 = ptWire.x;
+ if (ptWire.y < shape->bounds.y1)
+ shape->bounds.y1 = ptWire.y;
+ if (ptWire.y > shape->bounds.y2)
+ shape->bounds.y2 = ptWire.y;
+ }
+ }
+ if (shapeWire.primary_ndx != XkbNoShape)
+ shape->primary = &shape->outlines[shapeWire.primary_ndx];
+ if (shapeWire.approx_ndx != XkbNoShape)
+ shape->approx = &shape->outlines[shapeWire.approx_ndx];
+ }
}
- if (wireGeom.num_sections>0) {
- for (i=0;i<wireGeom.num_sections;i++) {
- tmp= ReadXkmGeomSection(file,geom);
- nRead+= tmp;
- if (tmp==0)
- return nRead;
- }
+ if (wireGeom.num_sections > 0) {
+ for (i = 0; i < wireGeom.num_sections; i++) {
+ tmp = ReadXkmGeomSection(file, geom);
+ nRead += tmp;
+ if (tmp == 0)
+ return nRead;
+ }
}
- if (wireGeom.num_doodads>0) {
- for (i=0;i<wireGeom.num_doodads;i++) {
- tmp= ReadXkmGeomDoodad(file,geom,NULL);
- nRead+= tmp;
- if (tmp==0)
- return nRead;
- }
+ if (wireGeom.num_doodads > 0) {
+ for (i = 0; i < wireGeom.num_doodads; i++) {
+ tmp = ReadXkmGeomDoodad(file, geom, NULL);
+ nRead += tmp;
+ if (tmp == 0)
+ return nRead;
+ }
}
- if ((wireGeom.num_key_aliases>0)&&(geom->key_aliases)) {
- int sz= XkbKeyNameLength*2;
- int num= wireGeom.num_key_aliases;
- if (fread(geom->key_aliases,sz,num,file)!=num) {
- _XkbLibError(_XkbErrBadLength,"ReadXkmGeometry",0);
- return -1;
- }
- nRead+= (num*sz);
- geom->num_key_aliases= num;
+ if ((wireGeom.num_key_aliases > 0) && (geom->key_aliases)) {
+ int sz = XkbKeyNameLength * 2;
+ int num = wireGeom.num_key_aliases;
+
+ if (fread(geom->key_aliases, sz, num, file) != num) {
+ _XkbLibError(_XkbErrBadLength, "ReadXkmGeometry", 0);
+ return -1;
+ }
+ nRead += (num * sz);
+ geom->num_key_aliases = num;
}
return nRead;
}
Bool
-XkmProbe(FILE *file)
+XkmProbe(FILE * file)
{
-unsigned hdr,tmp;
-int nRead=0;
-
- hdr= (('x'<<24)|('k'<<16)|('m'<<8)|XkmFileVersion);
- tmp= XkmGetCARD32(file,&nRead);
- if (tmp!=hdr) {
- if ((tmp&(~0xff))==(hdr&(~0xff))) {
- _XkbLibError(_XkbErrBadFileVersion,"XkmProbe",tmp&0xff);
- }
- return 0;
+ unsigned hdr, tmp;
+ int nRead = 0;
+
+ hdr = (('x' << 24) | ('k' << 16) | ('m' << 8) | XkmFileVersion);
+ tmp = XkmGetCARD32(file, &nRead);
+ if (tmp != hdr) {
+ if ((tmp & (~0xff)) == (hdr & (~0xff))) {
+ _XkbLibError(_XkbErrBadFileVersion, "XkmProbe", tmp & 0xff);
+ }
+ return 0;
}
return 1;
}
static Bool
-XkmReadTOC(FILE *file,xkmFileInfo* file_info,int max_toc,xkmSectionInfo *toc)
+XkmReadTOC(FILE * file, xkmFileInfo * file_info, int max_toc,
+ xkmSectionInfo * toc)
{
-unsigned hdr,tmp;
-int nRead=0;
-unsigned i,size_toc;
-
- hdr= (('x'<<24)|('k'<<16)|('m'<<8)|XkmFileVersion);
- tmp= XkmGetCARD32(file,&nRead);
- if (tmp!=hdr) {
- if ((tmp&(~0xff))==(hdr&(~0xff))) {
- _XkbLibError(_XkbErrBadFileVersion,"XkmReadTOC",tmp&0xff);
- }
- else {
- _XkbLibError(_XkbErrBadFileType,"XkmReadTOC",tmp);
- }
- return 0;
+ unsigned hdr, tmp;
+ int nRead = 0;
+ unsigned i, size_toc;
+
+ hdr = (('x' << 24) | ('k' << 16) | ('m' << 8) | XkmFileVersion);
+ tmp = XkmGetCARD32(file, &nRead);
+ if (tmp != hdr) {
+ if ((tmp & (~0xff)) == (hdr & (~0xff))) {
+ _XkbLibError(_XkbErrBadFileVersion, "XkmReadTOC", tmp & 0xff);
+ }
+ else {
+ _XkbLibError(_XkbErrBadFileType, "XkmReadTOC", tmp);
+ }
+ return 0;
}
- fread(file_info,SIZEOF(xkmFileInfo),1,file);
- size_toc= file_info->num_toc;
- if (size_toc>max_toc) {
- DebugF("Warning! Too many TOC entries; last %d ignored\n",
- size_toc-max_toc);
- size_toc= max_toc;
+ fread(file_info, SIZEOF(xkmFileInfo), 1, file);
+ size_toc = file_info->num_toc;
+ if (size_toc > max_toc) {
+ DebugF("Warning! Too many TOC entries; last %d ignored\n",
+ size_toc - max_toc);
+ size_toc = max_toc;
}
- for (i=0;i<size_toc;i++) {
- fread(&toc[i],SIZEOF(xkmSectionInfo),1,file);
+ for (i = 0; i < size_toc; i++) {
+ fread(&toc[i], SIZEOF(xkmSectionInfo), 1, file);
}
return 1;
}
@@ -1183,71 +1223,72 @@ unsigned i,size_toc;
#define MAX_TOC 16
unsigned
-XkmReadFile(FILE *file,unsigned need,unsigned want,XkbDescPtr *xkb)
+XkmReadFile(FILE * file, unsigned need, unsigned want, XkbDescPtr *xkb)
{
-register unsigned i;
-xkmSectionInfo toc[MAX_TOC],tmpTOC;
-xkmFileInfo fileInfo;
-unsigned tmp,nRead=0;
-unsigned which= need|want;
-
- if (!XkmReadTOC(file,&fileInfo,MAX_TOC,toc))
- return which;
- if ((fileInfo.present&need)!=need) {
- _XkbLibError(_XkbErrIllegalContents,"XkmReadFile",
- need&(~fileInfo.present));
- return which;
+ register unsigned i;
+ xkmSectionInfo toc[MAX_TOC], tmpTOC;
+ xkmFileInfo fileInfo;
+ unsigned tmp, nRead = 0;
+ unsigned which = need | want;
+
+ if (!XkmReadTOC(file, &fileInfo, MAX_TOC, toc))
+ return which;
+ if ((fileInfo.present & need) != need) {
+ _XkbLibError(_XkbErrIllegalContents, "XkmReadFile",
+ need & (~fileInfo.present));
+ return which;
}
- if (*xkb==NULL)
- *xkb= XkbAllocKeyboard();
- for (i=0;i<fileInfo.num_toc;i++) {
- fseek(file,toc[i].offset,SEEK_SET);
- tmp= fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file);
- nRead= tmp*SIZEOF(xkmSectionInfo);
- if ((tmpTOC.type!=toc[i].type)||(tmpTOC.format!=toc[i].format)||
- (tmpTOC.size!=toc[i].size)||(tmpTOC.offset!=toc[i].offset)) {
- return which;
- }
- if ((which&(1<<tmpTOC.type))==0) {
- continue;
- }
- switch (tmpTOC.type) {
- case XkmVirtualModsIndex:
- tmp= ReadXkmVirtualMods(file,*xkb,NULL);
- break;
- case XkmTypesIndex:
- tmp= ReadXkmKeyTypes(file,*xkb,NULL);
- break;
- case XkmCompatMapIndex:
- tmp= ReadXkmCompatMap(file,*xkb,NULL);
- break;
- case XkmKeyNamesIndex:
- tmp= ReadXkmKeycodes(file,*xkb,NULL);
- break;
- case XkmIndicatorsIndex:
- tmp= ReadXkmIndicators(file,*xkb,NULL);
- break;
- case XkmSymbolsIndex:
- tmp= ReadXkmSymbols(file,*xkb);
- break;
- case XkmGeometryIndex:
- tmp= ReadXkmGeometry(file,*xkb);
- break;
- default:
- _XkbLibError(_XkbErrBadImplementation,
- XkbConfigText(tmpTOC.type,XkbMessage),0);
- tmp= 0;
- break;
- }
- if (tmp>0) {
- nRead+= tmp;
- which&= ~(1<<toc[i].type);
- (*xkb)->defined|= (1<<toc[i].type);
- }
- if (nRead!=tmpTOC.size) {
- _XkbLibError(_XkbErrBadLength,XkbConfigText(tmpTOC.type,XkbMessage),
- nRead-tmpTOC.size);
- }
+ if (*xkb == NULL)
+ *xkb = XkbAllocKeyboard();
+ for (i = 0; i < fileInfo.num_toc; i++) {
+ fseek(file, toc[i].offset, SEEK_SET);
+ tmp = fread(&tmpTOC, SIZEOF(xkmSectionInfo), 1, file);
+ nRead = tmp * SIZEOF(xkmSectionInfo);
+ if ((tmpTOC.type != toc[i].type) || (tmpTOC.format != toc[i].format) ||
+ (tmpTOC.size != toc[i].size) || (tmpTOC.offset != toc[i].offset)) {
+ return which;
+ }
+ if ((which & (1 << tmpTOC.type)) == 0) {
+ continue;
+ }
+ switch (tmpTOC.type) {
+ case XkmVirtualModsIndex:
+ tmp = ReadXkmVirtualMods(file, *xkb, NULL);
+ break;
+ case XkmTypesIndex:
+ tmp = ReadXkmKeyTypes(file, *xkb, NULL);
+ break;
+ case XkmCompatMapIndex:
+ tmp = ReadXkmCompatMap(file, *xkb, NULL);
+ break;
+ case XkmKeyNamesIndex:
+ tmp = ReadXkmKeycodes(file, *xkb, NULL);
+ break;
+ case XkmIndicatorsIndex:
+ tmp = ReadXkmIndicators(file, *xkb, NULL);
+ break;
+ case XkmSymbolsIndex:
+ tmp = ReadXkmSymbols(file, *xkb);
+ break;
+ case XkmGeometryIndex:
+ tmp = ReadXkmGeometry(file, *xkb);
+ break;
+ default:
+ _XkbLibError(_XkbErrBadImplementation,
+ XkbConfigText(tmpTOC.type, XkbMessage), 0);
+ tmp = 0;
+ break;
+ }
+ if (tmp > 0) {
+ nRead += tmp;
+ which &= ~(1 << toc[i].type);
+ (*xkb)->defined |= (1 << toc[i].type);
+ }
+ if (nRead != tmpTOC.size) {
+ _XkbLibError(_XkbErrBadLength,
+ XkbConfigText(tmpTOC.type, XkbMessage),
+ nRead - tmpTOC.size);
+ }
}
return which;
}
diff --git a/xorg-server/xkeyboard-config/compat/default.in b/xorg-server/xkeyboard-config/compat/default.in
deleted file mode 100644
index 4c4461fb9..000000000
--- a/xorg-server/xkeyboard-config/compat/default.in
+++ /dev/null
@@ -1,12 +0,0 @@
-default xkb_compatibility "default" {
- include "basic"
- augment "mousekeys"
- augment "accessx(basic)"
- augment "misc"
- augment "iso9995"
- augment "level5"
-// ??should be changed/renamed/removed
-// augment "xfree86"
- augment "japan"
- augment "caps(caps_lock)"
-};
diff --git a/xorg-server/xkeyboard-config/compat/iso9995 b/xorg-server/xkeyboard-config/compat/iso9995
index 4dea5bf01..76188d1f0 100644
--- a/xorg-server/xkeyboard-config/compat/iso9995
+++ b/xorg-server/xkeyboard-config/compat/iso9995
@@ -1,80 +1,76 @@
-// Fairly complete set of symbol interpretations
-// to provide reasonable default behavior
-
-default partial xkb_compatibility "default" {
- virtual_modifiers LevelThree,AltGr;
-
- interpret.repeat= False;
- setMods.clearLocks= True;
- latchMods.clearLocks= True;
- latchMods.latchToLock= True;
-
- interpret ISO_Lock+Any {
- action= ISOLock(affect= all,modifiers=modMapMods);
- };
-
- interpret ISO_Level2_Latch+Shift {
- useModMapMods= level1;
- action= LatchMods(modifiers=Shift);
- };
-
- interpret ISO_Level3_Shift+Any {
- useModMapMods= level1;
- virtualModifier= LevelThree;
- action= SetMods(modifiers=LevelThree);
- };
-
- interpret ISO_Level3_Shift {
- action= SetMods(modifiers=LevelThree);
- };
-
- interpret ISO_Level3_Latch+Any {
- useModMapMods= level1;
- virtualModifier= LevelThree;
- action= LatchMods(modifiers=LevelThree);
- };
-
- interpret ISO_Level3_Latch {
- action= LatchMods(modifiers=LevelThree);
- };
-
- interpret ISO_Level3_Lock+Any {
- useModMapMods= level1;
- virtualModifier= LevelThree;
- action= LockMods(modifiers=LevelThree);
- };
-
- interpret ISO_Level3_Lock {
- action= LockMods(modifiers=LevelThree);
- };
-
- interpret ISO_Group_Latch {
- useModMapMods= level1;
- virtualModifier= AltGr;
- action= LatchGroup(group=2);
- };
-
- interpret ISO_Next_Group {
- useModMapMods= level1;
- virtualModifier= AltGr;
- action= LockGroup(group=+1);
- };
-
- interpret ISO_Prev_Group {
- useModMapMods= level1;
- virtualModifier= AltGr;
- action= LockGroup(group=-1);
- };
- interpret ISO_First_Group {
- action= LockGroup(group=1);
- };
-
- interpret ISO_Last_Group {
- action= LockGroup(group=2);
- };
-
- indicator "Group 2" {
- !allowExplicit;
- groups= All-Group1;
- };
-};
+// Fairly complete set of symbol interpretations
+// to provide reasonable default behavior
+
+default partial xkb_compatibility "default" {
+ virtual_modifiers LevelThree,AltGr;
+
+ interpret.repeat= False;
+ setMods.clearLocks= True;
+ latchMods.clearLocks= True;
+ latchMods.latchToLock= True;
+
+ interpret ISO_Level2_Latch+Shift {
+ useModMapMods= level1;
+ action= LatchMods(modifiers=Shift);
+ };
+
+ interpret ISO_Level3_Shift+Any {
+ useModMapMods= level1;
+ virtualModifier= LevelThree;
+ action= SetMods(modifiers=LevelThree);
+ };
+
+ interpret ISO_Level3_Shift {
+ action= SetMods(modifiers=LevelThree);
+ };
+
+ interpret ISO_Level3_Latch+Any {
+ useModMapMods= level1;
+ virtualModifier= LevelThree;
+ action= LatchMods(modifiers=LevelThree);
+ };
+
+ interpret ISO_Level3_Latch {
+ action= LatchMods(modifiers=LevelThree);
+ };
+
+ interpret ISO_Level3_Lock+Any {
+ useModMapMods= level1;
+ virtualModifier= LevelThree;
+ action= LockMods(modifiers=LevelThree);
+ };
+
+ interpret ISO_Level3_Lock {
+ action= LockMods(modifiers=LevelThree);
+ };
+
+ interpret ISO_Group_Latch {
+ useModMapMods= level1;
+ virtualModifier= AltGr;
+ action= LatchGroup(group=2);
+ };
+
+ interpret ISO_Next_Group {
+ useModMapMods= level1;
+ virtualModifier= AltGr;
+ action= LockGroup(group=+1);
+ };
+
+ interpret ISO_Prev_Group {
+ useModMapMods= level1;
+ virtualModifier= AltGr;
+ action= LockGroup(group=-1);
+ };
+ interpret ISO_First_Group {
+ action= LockGroup(group=1);
+ };
+
+ interpret ISO_Last_Group {
+ action= LockGroup(group=2);
+ };
+
+ indicator "Group 2" {
+ !allowExplicit;
+ groups= All-Group1;
+ };
+};
diff --git a/xorg-server/xkeyboard-config/compat/makefile b/xorg-server/xkeyboard-config/compat/makefile
index 225163288..d8dc5d8c4 100644
--- a/xorg-server/xkeyboard-config/compat/makefile
+++ b/xorg-server/xkeyboard-config/compat/makefile
@@ -8,10 +8,10 @@ DESTDIR=$(MHMAKECONF)\xorg-server\xkbdata\$(THISDIR)
dist_xkbdata_compat_DATA = \
accessx basic caps complete \
-default iso9995 \
-japan keypad ledcaps \
+iso9995 \
+japan ledcaps \
lednum ledscroll level5 \
-misc mousekeys norepeat \
+misc mousekeys \
olpc pc pc98 xfree86 \
xtest README
diff --git a/xorg-server/xkeyboard-config/keymap/digital_vndr/makefile b/xorg-server/xkeyboard-config/keymap/digital_vndr/makefile
deleted file mode 100644
index 09dd6f797..000000000
--- a/xorg-server/xkeyboard-config/keymap/digital_vndr/makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-ifeq ($(MAKESERVER),1)
-$(error Please do not specify MAKESERVER=1)
-endif
-
-DESTDIR=$(MHMAKECONF)\xorg-server\xkbdata\keymap\digital_vndr
-
-dist_keymap_DATA = \
-us
-
-DATA_FILES=$(dist_keymap_DATA:%=$(DESTDIR)\%)
-
-include ..\..\xkbrules.mak
diff --git a/xorg-server/xkeyboard-config/keymap/makefile b/xorg-server/xkeyboard-config/keymap/makefile
deleted file mode 100644
index 1b549a08f..000000000
--- a/xorg-server/xkeyboard-config/keymap/makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-ifeq ($(MAKESERVER),1)
-$(error Please do not specify MAKESERVER=1)
-endif
-
-THISDIR=keymap
-
-DESTDIR=$(MHMAKECONF)\xorg-server\xkbdata\$(THISDIR)
-
-SUBDIRS = digital_vndr sgi_vndr sun_vndr
-
-dist_xkbdata_keymap_DATA = \
-amiga ataritt macintosh \
-sony xfree86 xfree98 \
-README
-
-DATA_FILES=$(dist_xkbdata_keymap_DATA:%=$(DESTDIR)\%)
-
-load_makefile $(SUBDIRS:%=%\makefile MAKESERVER=0 DEBUG=$(DEBUG);)
-
-extrastuff: $(SUBDIRS:%=%\all)
-
-include ..\xkbrules.mak
diff --git a/xorg-server/xkeyboard-config/keymap/sgi_vndr/makefile b/xorg-server/xkeyboard-config/keymap/sgi_vndr/makefile
deleted file mode 100644
index d2cb6083e..000000000
--- a/xorg-server/xkeyboard-config/keymap/sgi_vndr/makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-ifeq ($(MAKESERVER),1)
-$(error Please do not specify MAKESERVER=1)
-endif
-
-DESTDIR=$(MHMAKECONF)\xorg-server\xkbdata\keymap\sgi_vndr
-
-dist_keymap_DATA = \
-be bg ca \
-ch cz de \
-dk dvorak \
-es fi \
-fr gb \
-hu it jp \
-no pl pt \
-ru se sk \
-th us
-
-DATA_FILES=$(dist_keymap_DATA:%=$(DESTDIR)\%)
-
-include ..\..\xkbrules.mak
diff --git a/xorg-server/xkeyboard-config/keymap/sun_vndr/makefile b/xorg-server/xkeyboard-config/keymap/sun_vndr/makefile
deleted file mode 100644
index 1dd8b4c45..000000000
--- a/xorg-server/xkeyboard-config/keymap/sun_vndr/makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-ifeq ($(MAKESERVER),1)
-$(error Please do not specify MAKESERVER=1)
-endif
-
-DESTDIR=$(MHMAKECONF)\xorg-server\xkbdata\keymap\sun_vndr
-
-dist_keymap_DATA = \
-all de es fi \
-fr no pl \
-ru se uk \
-us
-
-DATA_FILES=$(dist_keymap_DATA:%=$(DESTDIR)\%)
-
-# We need to make the rule for all explicit since searching it in the implicit rules doesn't work for all
-$(DESTDIR)\all: all.in
- copy $< $@
-
-
-include ..\..\xkbrules.mak
diff --git a/xorg-server/xkeyboard-config/makefile b/xorg-server/xkeyboard-config/makefile
index 94c550947..47ce6dd7b 100644
--- a/xorg-server/xkeyboard-config/makefile
+++ b/xorg-server/xkeyboard-config/makefile
@@ -2,7 +2,7 @@ ifeq ($(MAKESERVER),1)
$(error Please do not specify MAKESERVER=1)
endif
-SUBDIRS = compat geometry keycodes keymap rules semantics symbols types
+SUBDIRS = compat geometry keycodes rules symbols types
load_makefile $(SUBDIRS:%=%\makefile MAKESERVER=0 DEBUG=$(DEBUG);)
diff --git a/xorg-server/xkeyboard-config/semantics/makefile b/xorg-server/xkeyboard-config/semantics/makefile
deleted file mode 100644
index 0181c169f..000000000
--- a/xorg-server/xkeyboard-config/semantics/makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-ifeq ($(MAKESERVER),1)
-$(error Please do not specify MAKESERVER=1)
-endif
-
-THISDIR=semantics
-
-DESTDIR=$(MHMAKECONF)\xorg-server\xkbdata\$(THISDIR)
-
-dist_xkbdata_semantics_DATA = \
- basic \
- complete \
- default \
- xtest
-
-DATA_FILES=$(dist_xkbdata_semantics_DATA:%=$(DESTDIR)\%)
-
-include ..\xkbrules.mak
diff --git a/xorg-server/xkeyboard-config/symbols/fr b/xorg-server/xkeyboard-config/symbols/fr
index a1dbb5921..c58eb0deb 100644
--- a/xorg-server/xkeyboard-config/symbols/fr
+++ b/xorg-server/xkeyboard-config/symbols/fr
@@ -527,7 +527,7 @@ xkb_symbols "bepo" {
key <AB05> { [ k, K, asciitilde ] }; // k K ~
key <AB06> { [ apostrophe, question, questiondown, dead_hook ] }; // ' ? ¿ ̉
key <AB07> { [ q, Q, dead_abovering, dead_belowdot ] }; // q Q ˚ ̣
- key <AB08> { [ g, G, mu ] }; // g G µ
+ key <AB08> { [ g, G, dead_greek ] }; // g G µ
key <AB09> { [ h, H, dagger, doubledagger ] }; // h H † ‡
key <AB10> { [ f, F, dead_ogonek, ordfeminine ] }; // f F ̨ ª
diff --git a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us
index 6da1c67bf..36f4429cc 100644
--- a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us
+++ b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us
@@ -1,148 +1,148 @@
-// symbols definition for a Macintosh "Extended" keyboard
-
-xkb_symbols "extended" {
-
- name[Group1]= "USA";
- key <ESC> { [ Escape ] };
-
- // Alphanumeric section
- key <TLDE> { [ quoteleft, asciitilde ] };
- key <AE01> { [ 1, exclam ] };
- key <AE02> { [ 2, at ] };
- key <AE03> { [ 3, numbersign ] };
- key <AE04> { [ 4, dollar ] };
- key <AE05> { [ 5, percent ] };
- key <AE06> { [ 6, asciicircum ] };
- key <AE07> { [ 7, ampersand ] };
- key <AE08> { [ 8, asterisk ] };
- key <AE09> { [ 9, parenleft ] };
- key <AE10> { [ 0, parenright ] };
- key <AE11> { [ minus, underscore ] };
- key <AE12> { [ equal, plus ] };
-
- key <AD01> { [ q, Q ] };
- key <AD02> { [ w, W ] };
- key <AD03> { [ e, E ] };
- key <AD04> { [ r, R ] };
- key <AD05> { [ t, T ] };
- key <AD06> { [ y, Y ] };
- key <AD07> { [ u, U ] };
- key <AD08> { [ i, I ] };
- key <AD09> { [ o, O ] };
- key <AD10> { [ p, P ] };
- key <AD11> { [ bracketleft, braceleft ] };
- key <AD12> { [ bracketright, braceright ] };
- key <BKSL> { [ backslash, bar ] };
-
- key <AC01> { [ a, A ] };
- key <AC02> { [ s, S ] };
- key <AC03> { [ d, D ] };
- key <AC04> { [ f, F ] };
- key <AC05> { [ g, G ] };
- key <AC06> { [ h, H ] };
- key <AC07> { [ j, J ] };
- key <AC08> { [ k, K ] };
- key <AC09> { [ l, L ] };
- key <AC10> { [ semicolon, colon ] };
- key <AC11> { [ quoteright, quotedbl ] };
-
- key <AB01> { [ z, Z ] };
- key <AB02> { [ x, X ] };
- key <AB03> { [ c, C ] };
- key <AB04> { [ v, V ] };
- key <AB05> { [ b, B ] };
- key <AB06> { [ n, N ] };
- key <AB07> { [ m, M ] };
- key <AB08> { [ comma, less ] };
- key <AB09> { [ period, greater ] };
- key <AB10> { [ slash, question ] };
-
- key <SPCE> { [ space ] };
- // End alphanumeric section
-
-
- include "eurosign(e)"
- include "keypad"
-
- key <KPEQ> { [ equal ] };
-};
-
-hidden
-xkb_symbols "oldmac" {
-
- include "macintosh_vndr/us(extended)"
-
- // Begin "Function" section
- key <FK01> { [ F1 ] };
- key <FK02> { [ F2 ] };
- key <FK03> { [ F3 ] };
- key <FK04> { [ F4 ] };
- key <FK05> { [ F5 ] };
- key <FK06> { [ F6 ] };
- key <FK07> { [ F7 ] };
- key <FK08> { [ F8 ] };
- key <FK09> { [ F9 ] };
- key <FK10> { [ F10 ] };
- key <FK11> { [ F11 ] };
- key <FK12> { [ F12 ] };
- key <FK13> { [ Print ] };
- key <FK14> { [ Scroll_Lock ] };
- key <FK15> { [ Pause ] };
- // End "Function" section
-
- // Begin "Editing" section
- key <INS> { [ Insert ] };
- key <HOME> { [ Home ] };
- key <PGUP> { [ Prior ] };
- key <DELE> { [ Delete ] };
- key <END> { [ End ] };
- key <PGDN> { [ Next ] };
-
- key <UP> { [ Up ] };
- key <LEFT> { [ Left ] };
- key <DOWN> { [ Down ] };
- key <RGHT> { [ Right ] };
- // End "Editing" section
-
- key <BKSP> { [ BackSpace ] };
- key <TAB> { [ Tab, ISO_Left_Tab ] };
- key <RTRN> { [ Return ] };
- key <CAPS> { [ Caps_Lock ] };
- key <NMLK> { [ Num_Lock, Pointer_EnableKeys ] };
-
- // Begin "Modifier" section
- key <LFSH> { [ Shift_L ] };
- key <RTSH> { [ Shift_R ] };
- key <LCTL> { [ Control_L ] };
- key <RCTL> { [ Control_R ] };
- key <LALT> { [ Alt_L, Meta_L ] };
- key <RALT> { [ Alt_R, Meta_R ] };
- key <LWIN> { [ Super_L ] };
- key <RWIN> { [ Super_R ] };
- // End "Modifier" section
-
- // begin modifier mappings
- modifier_map Shift { Shift_L, Shift_R };
- modifier_map Lock { Caps_Lock, ISO_Lock };
- modifier_map Control{ Control_L, Control_R };
- modifier_map Mod2 { Num_Lock };
-
- // Fake keys for virtual<->real modifiers mapping
- key <LVL3> { [ ISO_Level3_Shift ] };
- key <MDSW> { [ Mode_switch ] };
- modifier_map Mod5 { <LVL3>, <MDSW> };
-
- key <ALT> { [ NoSymbol, Alt_L ] };
- modifier_map Mod1 { <ALT>, <LALT> };
-
- key <META> { [ NoSymbol, Meta_L ] };
- modifier_map Mod1 { <META> };
-
- key <SUPR> { [ NoSymbol, Super_L ] };
- modifier_map Mod4 { <SUPR> };
-
- key <HYPR> { [ NoSymbol, Hyper_L ] };
- modifier_map Mod4 { <HYPR> };
- // end modifier mappings
-
-};
+// symbols definition for a Macintosh "Extended" keyboard
+
+xkb_symbols "extended" {
+
+ name[Group1]= "USA";
+ key <ESC> { [ Escape ] };
+
+ // Alphanumeric section
+ key <TLDE> { [ quoteleft, asciitilde ] };
+ key <AE01> { [ 1, exclam ] };
+ key <AE02> { [ 2, at ] };
+ key <AE03> { [ 3, numbersign ] };
+ key <AE04> { [ 4, dollar ] };
+ key <AE05> { [ 5, percent ] };
+ key <AE06> { [ 6, asciicircum ] };
+ key <AE07> { [ 7, ampersand ] };
+ key <AE08> { [ 8, asterisk ] };
+ key <AE09> { [ 9, parenleft ] };
+ key <AE10> { [ 0, parenright ] };
+ key <AE11> { [ minus, underscore ] };
+ key <AE12> { [ equal, plus ] };
+
+ key <AD01> { [ q, Q ] };
+ key <AD02> { [ w, W ] };
+ key <AD03> { [ e, E ] };
+ key <AD04> { [ r, R ] };
+ key <AD05> { [ t, T ] };
+ key <AD06> { [ y, Y ] };
+ key <AD07> { [ u, U ] };
+ key <AD08> { [ i, I ] };
+ key <AD09> { [ o, O ] };
+ key <AD10> { [ p, P ] };
+ key <AD11> { [ bracketleft, braceleft ] };
+ key <AD12> { [ bracketright, braceright ] };
+ key <BKSL> { [ backslash, bar ] };
+
+ key <AC01> { [ a, A ] };
+ key <AC02> { [ s, S ] };
+ key <AC03> { [ d, D ] };
+ key <AC04> { [ f, F ] };
+ key <AC05> { [ g, G ] };
+ key <AC06> { [ h, H ] };
+ key <AC07> { [ j, J ] };
+ key <AC08> { [ k, K ] };
+ key <AC09> { [ l, L ] };
+ key <AC10> { [ semicolon, colon ] };
+ key <AC11> { [ quoteright, quotedbl ] };
+
+ key <AB01> { [ z, Z ] };
+ key <AB02> { [ x, X ] };
+ key <AB03> { [ c, C ] };
+ key <AB04> { [ v, V ] };
+ key <AB05> { [ b, B ] };
+ key <AB06> { [ n, N ] };
+ key <AB07> { [ m, M ] };
+ key <AB08> { [ comma, less ] };
+ key <AB09> { [ period, greater ] };
+ key <AB10> { [ slash, question ] };
+
+ key <SPCE> { [ space ] };
+ // End alphanumeric section
+
+
+ include "eurosign(e)"
+ include "keypad"
+
+ key <KPEQ> { [ equal ] };
+};
+
+hidden
+xkb_symbols "oldmac" {
+
+ include "macintosh_vndr/us(extended)"
+
+ // Begin "Function" section
+ key <FK01> { [ F1 ] };
+ key <FK02> { [ F2 ] };
+ key <FK03> { [ F3 ] };
+ key <FK04> { [ F4 ] };
+ key <FK05> { [ F5 ] };
+ key <FK06> { [ F6 ] };
+ key <FK07> { [ F7 ] };
+ key <FK08> { [ F8 ] };
+ key <FK09> { [ F9 ] };
+ key <FK10> { [ F10 ] };
+ key <FK11> { [ F11 ] };
+ key <FK12> { [ F12 ] };
+ key <FK13> { [ Print ] };
+ key <FK14> { [ Scroll_Lock ] };
+ key <FK15> { [ Pause ] };
+ // End "Function" section
+
+ // Begin "Editing" section
+ key <INS> { [ Insert ] };
+ key <HOME> { [ Home ] };
+ key <PGUP> { [ Prior ] };
+ key <DELE> { [ Delete ] };
+ key <END> { [ End ] };
+ key <PGDN> { [ Next ] };
+
+ key <UP> { [ Up ] };
+ key <LEFT> { [ Left ] };
+ key <DOWN> { [ Down ] };
+ key <RGHT> { [ Right ] };
+ // End "Editing" section
+
+ key <BKSP> { [ BackSpace ] };
+ key <TAB> { [ Tab, ISO_Left_Tab ] };
+ key <RTRN> { [ Return ] };
+ key <CAPS> { [ Caps_Lock ] };
+ key <NMLK> { [ Num_Lock, Pointer_EnableKeys ] };
+
+ // Begin "Modifier" section
+ key <LFSH> { [ Shift_L ] };
+ key <RTSH> { [ Shift_R ] };
+ key <LCTL> { [ Control_L ] };
+ key <RCTL> { [ Control_R ] };
+ key <LALT> { [ Alt_L, Meta_L ] };
+ key <RALT> { [ Alt_R, Meta_R ] };
+ key <LWIN> { [ Super_L ] };
+ key <RWIN> { [ Super_R ] };
+ // End "Modifier" section
+
+ // begin modifier mappings
+ modifier_map Shift { Shift_L, Shift_R };
+ modifier_map Lock { Caps_Lock };
+ modifier_map Control{ Control_L, Control_R };
+ modifier_map Mod2 { Num_Lock };
+
+ // Fake keys for virtual<->real modifiers mapping
+ key <LVL3> { [ ISO_Level3_Shift ] };
+ key <MDSW> { [ Mode_switch ] };
+ modifier_map Mod5 { <LVL3>, <MDSW> };
+
+ key <ALT> { [ NoSymbol, Alt_L ] };
+ modifier_map Mod1 { <ALT>, <LALT> };
+
+ key <META> { [ NoSymbol, Meta_L ] };
+ modifier_map Mod1 { <META> };
+
+ key <SUPR> { [ NoSymbol, Super_L ] };
+ modifier_map Mod4 { <SUPR> };
+
+ key <HYPR> { [ NoSymbol, Hyper_L ] };
+ modifier_map Mod4 { <HYPR> };
+ // end modifier mappings
+
+};
diff --git a/xorg-server/xkeyboard-config/symbols/makefile b/xorg-server/xkeyboard-config/symbols/makefile
index 6fdc02f24..f42aeb48d 100644
--- a/xorg-server/xkeyboard-config/symbols/makefile
+++ b/xorg-server/xkeyboard-config/symbols/makefile
@@ -15,8 +15,8 @@ at az \
ba bd be \
bg br brai \
bt bw by \
-ca cd \
-ch cn cz \
+ca cd ch \
+cm cn cz \
de dk \
ee es et epo \
fi fo fr \
diff --git a/xorg-server/xkeyboard-config/symbols/mv b/xorg-server/xkeyboard-config/symbols/mv
index ed530612c..ee9a7986b 100644
--- a/xorg-server/xkeyboard-config/symbols/mv
+++ b/xorg-server/xkeyboard-config/symbols/mv
@@ -73,7 +73,7 @@ xkb_symbols "basic" {
// Begin modifier mappings
modifier_map Shift { Shift_L };
- modifier_map Lock { Caps_Lock, ISO_Lock };
+ modifier_map Lock { Caps_Lock };
modifier_map Control{ Control_L };
modifier_map Mod3 { Mode_switch };
};
diff --git a/xorg-server/xkeyboard-config/symbols/nokia_vndr/su-8w b/xorg-server/xkeyboard-config/symbols/nokia_vndr/su-8w
index 6962aa971..441b3fee3 100644
--- a/xorg-server/xkeyboard-config/symbols/nokia_vndr/su-8w
+++ b/xorg-server/xkeyboard-config/symbols/nokia_vndr/su-8w
@@ -430,7 +430,7 @@ xkb_symbols "base" {
// begin modifier mappings
modifier_map Shift { Shift_L, Shift_R };
- modifier_map Lock { Caps_Lock, ISO_Lock };
+ modifier_map Lock { Caps_Lock };
modifier_map Control{ Control_L, Control_R };
modifier_map Mod2 { Num_Lock };
diff --git a/xorg-server/xkeyboard-config/symbols/pc b/xorg-server/xkeyboard-config/symbols/pc
index 7e13ecb25..d25970963 100644
--- a/xorg-server/xkeyboard-config/symbols/pc
+++ b/xorg-server/xkeyboard-config/symbols/pc
@@ -37,7 +37,7 @@ xkb_symbols "pc105" {
// begin modifier mappings
modifier_map Shift { Shift_L, Shift_R };
- modifier_map Lock { Caps_Lock, ISO_Lock };
+ modifier_map Lock { Caps_Lock };
modifier_map Control{ Control_L, Control_R };
modifier_map Mod2 { Num_Lock };
modifier_map Mod4 { Super_L, Super_R };
diff --git a/xorg-server/xkeyboard-config/symbols/sun_vndr/us b/xorg-server/xkeyboard-config/symbols/sun_vndr/us
index f2689a8a7..6bc09a2cd 100644
--- a/xorg-server/xkeyboard-config/symbols/sun_vndr/us
+++ b/xorg-server/xkeyboard-config/symbols/sun_vndr/us
@@ -110,7 +110,7 @@ xkb_symbols "sunbasic" {
// begin modifier mappings
modifier_map Shift { Shift_L, Shift_R };
- modifier_map Lock { Caps_Lock, ISO_Lock };
+ modifier_map Lock { Caps_Lock };
modifier_map Control{ Control_L, Control_R };
modifier_map Mod2 { Num_Lock };
diff --git a/xorg-server/xkeyboard-config/symbols/sy b/xorg-server/xkeyboard-config/symbols/sy
index 6e2932b14..1a82f0e6e 100644
--- a/xorg-server/xkeyboard-config/symbols/sy
+++ b/xorg-server/xkeyboard-config/symbols/sy
@@ -67,7 +67,7 @@ xkb_symbols "syc" {
// Begin Modifier Mappings
modifier_map Shift { Shift_L, Shift_R };
- modifier_map Lock { Caps_Lock, ISO_Lock };
+ modifier_map Lock { Caps_Lock };
modifier_map Control{ Control_L, Control_R };
modifier_map Mod1 { Alt_L, Alt_R };
modifier_map Mod2 { Mode_switch };
@@ -136,7 +136,7 @@ xkb_symbols "syc_phonetic" {
// Begin Modifier Mappings
modifier_map Shift { Shift_L, Shift_R };
- modifier_map Lock { Caps_Lock, ISO_Lock };
+ modifier_map Lock { Caps_Lock };
modifier_map Control{ Control_L, Control_R };
modifier_map Mod1 { Alt_L, Alt_R };
modifier_map Mod2 { Mode_switch };